From: Andrea Bianco Date: Thu, 25 Mar 2021 08:56:48 +0000 (+0100) Subject: Built motion from commit (unavailable).|2.5.23 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22%7B%7Blicense.chat?a=commitdiff_plain;h=8ddd26079cba0b4a5cf7abd6792f03469afbac2c;p=motion2.git Built motion from commit (unavailable).|2.5.23 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 9e9b094..6e51ec2 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-03-25T08:27:06.210Z", + "time": "2021-03-25T08:46:40.883Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index b04ea97..f885ad9 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-03-25T08:27:06.210Z", + "time": "2021-03-25T08:46:40.883Z", "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 13cbcc0..9e4603e 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 _0x9bab=['motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','urlForward','browser','bot','script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'];(function(_0x1cd045,_0x1135ad){var _0x35eaac=function(_0x45e8f0){while(--_0x45e8f0){_0x1cd045['push'](_0x1cd045['shift']());}};_0x35eaac(++_0x1135ad);}(_0x9bab,0x98));var _0xb9ba=function(_0x43fb37,_0x1504bf){_0x43fb37=_0x43fb37-0x0;var _0x252e58=_0x9bab[_0x43fb37];return _0x252e58;};'use strict';var Sequelize=require(_0xb9ba('0x0'));module[_0xb9ba('0x1')]={'name':{'type':Sequelize[_0xb9ba('0x2')],'get':function(_0x52abbe){return this[_0xb9ba('0x3')](_0xb9ba('0x4'));}},'action':{'type':Sequelize[_0xb9ba('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0xb9ba('0x6'),_0xb9ba('0x7'),'motionbar','jscripty',_0xb9ba('0x8'),_0xb9ba('0x9'),_0xb9ba('0xa'),_0xb9ba('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0xb9ba('0x5')](0x1000),'comment':_0xb9ba('0xc')},'data2':{'type':Sequelize[_0xb9ba('0x5')](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0xb9ba('0x5')](0x1000),'comment':_0xb9ba('0xd')},'data4':{'type':Sequelize[_0xb9ba('0x5')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0xb9ba('0x5')]},'data7':{'type':Sequelize[_0xb9ba('0xe')]}}; \ No newline at end of file +var _0xf875=['STRING','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL','getDataValue','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x5b6fd4,_0x3891dc){var _0x336a68=function(_0x289131){while(--_0x289131){_0x5b6fd4['push'](_0x5b6fd4['shift']());}};_0x336a68(++_0x3891dc);}(_0xf875,0x1c7));var _0x5f87=function(_0x435674,_0x5d1b00){_0x435674=_0x435674-0x0;var _0xde33b2=_0xf875[_0x435674];return _0xde33b2;};'use strict';var Sequelize=require(_0x5f87('0x0'));module[_0x5f87('0x1')]={'name':{'type':Sequelize[_0x5f87('0x2')],'get':function(_0x321ebf){return this[_0x5f87('0x3')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x5f87('0x4'),_0x5f87('0x5'),_0x5f87('0x6'),_0x5f87('0x7'),_0x5f87('0x8'),_0x5f87('0x9'),_0x5f87('0xa'),_0x5f87('0xb')]],'msg':_0x5f87('0xc')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x5f87('0xd')](0x1000),'comment':_0x5f87('0xe')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x5f87('0xf')},'data3':{'type':Sequelize[_0x5f87('0xd')](0x1000),'comment':_0x5f87('0x10')},'data4':{'type':Sequelize[_0x5f87('0xd')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0x5f87('0xd')]},'data7':{'type':Sequelize[_0x5f87('0x11')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index e440bf8..b8189e3 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 _0x1b65=['crypto','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','body','Action','find','catch','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel'];(function(_0xa5b907,_0x4c7750){var _0x4120a8=function(_0x2d7080){while(--_0x2d7080){_0xa5b907['push'](_0xa5b907['shift']());}};_0x4120a8(++_0x4c7750);}(_0x1b65,0x1b4));var _0x51b6=function(_0x3167b1,_0x5ad266){_0x3167b1=_0x3167b1-0x0;var _0x362152=_0x1b65[_0x3167b1];return _0x362152;};'use strict';var pdf=require(_0x51b6('0x0'));var emlformat=require(_0x51b6('0x1'));var rimraf=require(_0x51b6('0x2'));var zipdir=require(_0x51b6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x51b6('0x4'));var moment=require(_0x51b6('0x5'));var BPromise=require(_0x51b6('0x6'));var Mustache=require(_0x51b6('0x7'));var util=require(_0x51b6('0x8'));var path=require(_0x51b6('0x9'));var sox=require(_0x51b6('0xa'));var csv=require('to-csv');var ejs=require(_0x51b6('0xb'));var fs=require('fs');var _=require(_0x51b6('0xc'));var squel=require(_0x51b6('0xd'));var crypto=require(_0x51b6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x51b6('0xf'));var toCsv=require(_0x51b6('0x10'));var querystring=require('querystring');var Papa=require(_0x51b6('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x51b6('0x12'));var as=require(_0x51b6('0x13'));var hardwareService=require(_0x51b6('0x14'));var logger=require(_0x51b6('0x15'))(_0x51b6('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x51b6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cd605,_0x422bd4){_0x422bd4=_0x422bd4||0xcc;return function(_0x4ca143){if(_0x4ca143){return _0x4cd605[_0x51b6('0x18')](_0x422bd4);}return _0x4cd605['status'](_0x422bd4)[_0x51b6('0x19')]();};}function respondWithResult(_0x24a386,_0x2890ee){_0x2890ee=_0x2890ee||0xc8;return function(_0x235d8c){if(_0x235d8c){return _0x24a386[_0x51b6('0x1a')](_0x2890ee)[_0x51b6('0x1b')](_0x235d8c);}};}function respondWithFilteredResult(_0x4c6cd0,_0x23549b){return function(_0x596863){if(_0x596863){var _0x39583d=_0x596863[_0x51b6('0x1c')],_0x4c99fb=_0x23549b[_0x51b6('0x1d')],_0x4007b0=_0x23549b[_0x51b6('0x1d')]+_0x23549b[_0x51b6('0x1e')],_0x500a82;if(_0x4007b0>=_0x39583d){_0x4007b0=_0x39583d;_0x500a82=0xc8;}else{_0x500a82=0xce;}_0x4c6cd0[_0x51b6('0x1a')](_0x500a82);return _0x4c6cd0[_0x51b6('0x1f')]('Content-Range',_0x4c99fb+'-'+_0x4007b0+'/'+_0x39583d)[_0x51b6('0x1b')](_0x596863);}return null;};}function patchUpdates(_0x5b8a31){return function(_0x2974f0){try{jsonpatch[_0x51b6('0x20')](_0x2974f0,_0x5b8a31,!![]);}catch(_0x506367){return BPromise[_0x51b6('0x21')](_0x506367);}return _0x2974f0[_0x51b6('0x22')]();};}function saveUpdates(_0x3fee21,_0x471783){return function(_0x21c90c){if(_0x21c90c){return _0x21c90c[_0x51b6('0x23')](_0x3fee21)[_0x51b6('0x24')](function(_0x1e70fc){return _0x1e70fc;});}return null;};}function removeEntity(_0x4ab876,_0x35d2ab){return function(_0x11db4e){if(_0x11db4e){return _0x11db4e[_0x51b6('0x25')]()[_0x51b6('0x24')](function(){_0x4ab876['status'](0xcc)[_0x51b6('0x19')]();});}};}function handleEntityNotFound(_0x3680af,_0x51c013){return function(_0x5de6e3){if(!_0x5de6e3){_0x3680af[_0x51b6('0x18')](0x194);}return _0x5de6e3;};}function handleError(_0x47499e,_0x3518ba){_0x3518ba=_0x3518ba||0x1f4;return function(_0x59193e){logger['error'](_0x59193e[_0x51b6('0x26')]);if(_0x59193e[_0x51b6('0x27')]){delete _0x59193e[_0x51b6('0x27')];}_0x47499e['status'](_0x3518ba)[_0x51b6('0x28')](_0x59193e);};}exports[_0x51b6('0x23')]=function(_0x5a8a5b,_0x2df2fa){if(_0x5a8a5b[_0x51b6('0x29')]['id']){delete _0x5a8a5b[_0x51b6('0x29')]['id'];}return db[_0x51b6('0x2a')][_0x51b6('0x2b')]({'where':{'id':_0x5a8a5b['params']['id']}})[_0x51b6('0x24')](handleEntityNotFound(_0x2df2fa,null))[_0x51b6('0x24')](saveUpdates(_0x5a8a5b[_0x51b6('0x29')],null))['then'](respondWithResult(_0x2df2fa,null))[_0x51b6('0x2c')](handleError(_0x2df2fa,null));};exports[_0x51b6('0x25')]=function(_0x29d89b,_0x155e67){return db['Action'][_0x51b6('0x2b')]({'where':{'id':_0x29d89b['params']['id']}})[_0x51b6('0x24')](handleEntityNotFound(_0x155e67,null))[_0x51b6('0x24')](removeEntity(_0x155e67,null))['catch'](handleError(_0x155e67,null));}; \ No newline at end of file +var _0x4819=['to-csv','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','json','apply','reject','update','then','destroy','error','name','send','body','Action','params','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0x4819,0xcd));var _0x9481=function(_0x4b03c9,_0x17ce03){_0x4b03c9=_0x4b03c9-0x0;var _0x161ba2=_0x4819[_0x4b03c9];return _0x161ba2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9481('0x0'));var rimraf=require(_0x9481('0x1'));var zipdir=require(_0x9481('0x2'));var jsonpatch=require(_0x9481('0x3'));var rp=require(_0x9481('0x4'));var moment=require(_0x9481('0x5'));var BPromise=require(_0x9481('0x6'));var Mustache=require(_0x9481('0x7'));var util=require(_0x9481('0x8'));var path=require(_0x9481('0x9'));var sox=require('sox');var csv=require(_0x9481('0xa'));var ejs=require('ejs');var fs=require('fs');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('0xa'));var querystring=require('querystring');var Papa=require(_0x9481('0xf'));var Redis=require('ioredis');var authService=require(_0x9481('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9481('0x11'));var hardwareService=require(_0x9481('0x12'));var logger=require(_0x9481('0x13'))(_0x9481('0x14'));var utils=require(_0x9481('0x15'));var config=require(_0x9481('0x16'));var licenseUtil=require(_0x9481('0x17'));var db=require(_0x9481('0x18'))['db'];function respondWithStatusCode(_0xed8e9,_0x499b87){_0x499b87=_0x499b87||0xcc;return function(_0x5aac02){if(_0x5aac02){return _0xed8e9[_0x9481('0x19')](_0x499b87);}return _0xed8e9[_0x9481('0x1a')](_0x499b87)[_0x9481('0x1b')]();};}function respondWithResult(_0x28fcb6,_0x3d23c2){_0x3d23c2=_0x3d23c2||0xc8;return function(_0xc7a0b5){if(_0xc7a0b5){return _0x28fcb6[_0x9481('0x1a')](_0x3d23c2)['json'](_0xc7a0b5);}};}function respondWithFilteredResult(_0x4220f1,_0x7a7ee){return function(_0x5b1fe6){if(_0x5b1fe6){var _0x2266d5=_0x5b1fe6[_0x9481('0x1c')],_0x518150=_0x7a7ee[_0x9481('0x1d')],_0x34108d=_0x7a7ee['offset']+_0x7a7ee['limit'],_0x7a2ac8;if(_0x34108d>=_0x2266d5){_0x34108d=_0x2266d5;_0x7a2ac8=0xc8;}else{_0x7a2ac8=0xce;}_0x4220f1[_0x9481('0x1a')](_0x7a2ac8);return _0x4220f1['set']('Content-Range',_0x518150+'-'+_0x34108d+'/'+_0x2266d5)[_0x9481('0x1e')](_0x5b1fe6);}return null;};}function patchUpdates(_0x33e32b){return function(_0x18c6f5){try{jsonpatch[_0x9481('0x1f')](_0x18c6f5,_0x33e32b,!![]);}catch(_0x7000e7){return BPromise[_0x9481('0x20')](_0x7000e7);}return _0x18c6f5['save']();};}function saveUpdates(_0x2cf1aa,_0x272a84){return function(_0x45f9df){if(_0x45f9df){return _0x45f9df[_0x9481('0x21')](_0x2cf1aa)[_0x9481('0x22')](function(_0x56da97){return _0x56da97;});}return null;};}function removeEntity(_0x215dd7,_0x294908){return function(_0x572599){if(_0x572599){return _0x572599[_0x9481('0x23')]()[_0x9481('0x22')](function(){_0x215dd7[_0x9481('0x1a')](0xcc)[_0x9481('0x1b')]();});}};}function handleEntityNotFound(_0x2dc02e,_0x49ecfa){return function(_0x91e3d9){if(!_0x91e3d9){_0x2dc02e[_0x9481('0x19')](0x194);}return _0x91e3d9;};}function handleError(_0x56c889,_0x5eb4f5){_0x5eb4f5=_0x5eb4f5||0x1f4;return function(_0x12b0c3){logger[_0x9481('0x24')](_0x12b0c3['stack']);if(_0x12b0c3[_0x9481('0x25')]){delete _0x12b0c3[_0x9481('0x25')];}_0x56c889[_0x9481('0x1a')](_0x5eb4f5)[_0x9481('0x26')](_0x12b0c3);};}exports['update']=function(_0x14f03e,_0x3ca064){if(_0x14f03e[_0x9481('0x27')]['id']){delete _0x14f03e['body']['id'];}return db[_0x9481('0x28')]['find']({'where':{'id':_0x14f03e[_0x9481('0x29')]['id']}})[_0x9481('0x22')](handleEntityNotFound(_0x3ca064,null))[_0x9481('0x22')](saveUpdates(_0x14f03e[_0x9481('0x27')],null))[_0x9481('0x22')](respondWithResult(_0x3ca064,null))['catch'](handleError(_0x3ca064,null));};exports[_0x9481('0x23')]=function(_0x469a80,_0x46e4ab){return db['Action']['find']({'where':{'id':_0x469a80[_0x9481('0x29')]['id']}})[_0x9481('0x22')](handleEntityNotFound(_0x46e4ab,null))[_0x9481('0x22')](removeEntity(_0x46e4ab,null))[_0x9481('0x2a')](handleError(_0x46e4ab,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 5348509..2129188 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 _0xa5c5=['exports','Action','lodash','util','moment','bluebird','request-promise','../../config/environment','./action.attributes'];(function(_0x3e5830,_0x31b12d){var _0x3bdf52=function(_0xb69a7){while(--_0xb69a7){_0x3e5830['push'](_0x3e5830['shift']());}};_0x3bdf52(++_0x31b12d);}(_0xa5c5,0x185));var _0x5a5c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa5c5[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x5a5c('0x0'));var util=require(_0x5a5c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5a5c('0x2'));var BPromise=require(_0x5a5c('0x3'));var rp=require(_0x5a5c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5a5c('0x5'));var attributes=require(_0x5a5c('0x6'));module[_0x5a5c('0x7')]=function(_0x4f37e5,_0x1f53ef){return _0x4f37e5['define'](_0x5a5c('0x8'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4e2=['tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Action'];(function(_0x59c9ee,_0x3e18f1){var _0x329f14=function(_0x5365c8){while(--_0x5365c8){_0x59c9ee['push'](_0x59c9ee['shift']());}};_0x329f14(++_0x3e18f1);}(_0xc4e2,0x11f));var _0x2c4e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xc4e2[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x2c4e('0x0'));var util=require(_0x2c4e('0x1'));var logger=require(_0x2c4e('0x2'))(_0x2c4e('0x3'));var moment=require(_0x2c4e('0x4'));var BPromise=require(_0x2c4e('0x5'));var rp=require(_0x2c4e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2c4e('0x7'));var config=require(_0x2c4e('0x8'));var attributes=require('./action.attributes');module[_0x2c4e('0x9')]=function(_0x18a5af,_0x2ebcc2){return _0x18a5af[_0x2c4e('0xa')](_0x2c4e('0xb'),attributes,{'tableName':_0x2c4e('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 93ec43b..86b8fab 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 _0xa9e0=['http','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\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(_0x563493,_0x274414){var _0x52b5fb=function(_0x23772d){while(--_0x23772d){_0x563493['push'](_0x563493['shift']());}};_0x52b5fb(++_0x274414);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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 _0xe706=['http','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5e2f68,_0x178467){var _0x1ce9ba=function(_0x16f001){while(--_0x16f001){_0x5e2f68['push'](_0x5e2f68['shift']());}};_0x1ce9ba(++_0x178467);}(_0xe706,0xa3));var _0x6e70=function(_0x534af9,_0x1fa0a8){_0x534af9=_0x534af9-0x0;var _0x1a79dd=_0xe706[_0x534af9];return _0x1a79dd;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('Action,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('Action,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 7bb8880..9138dcd 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 _0x3654=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','update','exports','multer','util','path'];(function(_0x2c5fe4,_0x2ae8e5){var _0x20a6cf=function(_0x55e50f){while(--_0x55e50f){_0x2c5fe4['push'](_0x2c5fe4['shift']());}};_0x20a6cf(++_0x2ae8e5);}(_0x3654,0x19d));var _0x4365=function(_0x9203df,_0x13ac20){_0x9203df=_0x9203df-0x0;var _0x26b9b9=_0x3654[_0x9203df];return _0x26b9b9;};'use strict';var multer=require(_0x4365('0x0'));var util=require(_0x4365('0x1'));var path=require(_0x4365('0x2'));var timeout=require(_0x4365('0x3'));var express=require('express');var router=express[_0x4365('0x4')]();var auth=require(_0x4365('0x5'));var interaction=require(_0x4365('0x6'));var config=require(_0x4365('0x7'));var controller=require(_0x4365('0x8'));router['put'](_0x4365('0x9'),auth[_0x4365('0xa')](),controller[_0x4365('0xb')]);router['delete'](_0x4365('0x9'),auth[_0x4365('0xa')](),controller['destroy']);module[_0x4365('0xc')]=router; \ No newline at end of file +var _0x83fc=['destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put','isAuthenticated','update','delete','/:id'];(function(_0x1c0127,_0x360c8a){var _0x4678f8=function(_0x2a3e12){while(--_0x2a3e12){_0x1c0127['push'](_0x1c0127['shift']());}};_0x4678f8(++_0x360c8a);}(_0x83fc,0x80));var _0xc83f=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x83fc[_0x474bc0];return _0x4b24cf;};'use strict';var multer=require('multer');var util=require(_0xc83f('0x0'));var path=require(_0xc83f('0x1'));var timeout=require(_0xc83f('0x2'));var express=require('express');var router=express[_0xc83f('0x3')]();var auth=require(_0xc83f('0x4'));var interaction=require(_0xc83f('0x5'));var config=require(_0xc83f('0x6'));var controller=require('./action.controller');router[_0xc83f('0x7')]('/:id',auth[_0xc83f('0x8')](),controller[_0xc83f('0x9')]);router[_0xc83f('0xa')](_0xc83f('0xb'),auth['isAuthenticated'](),controller[_0xc83f('0xc')]);module[_0xc83f('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 0aea8af..3d7935f 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 _0x9e44=['exports','STRING','TEXT','sequelize'];(function(_0x2dcbde,_0xabbf8){var _0x45cb97=function(_0x61c4f6){while(--_0x61c4f6){_0x2dcbde['push'](_0x2dcbde['shift']());}};_0x45cb97(++_0xabbf8);}(_0x9e44,0x1db));var _0x49e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9e44[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x49e4('0x0'));module[_0x49e4('0x1')]={'name':{'type':Sequelize[_0x49e4('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x49e4('0x2')]},'table':{'type':Sequelize[_0x49e4('0x2')]},'conditions':{'type':Sequelize[_0x49e4('0x3')]},'joins':{'type':Sequelize[_0x49e4('0x3')]}}; \ No newline at end of file +var _0x32a0=['STRING','TEXT','exports'];(function(_0xae85cd,_0xc4eb1b){var _0x104690=function(_0x5ea438){while(--_0x5ea438){_0xae85cd['push'](_0xae85cd['shift']());}};_0x104690(++_0xc4eb1b);}(_0x32a0,0x1ee));var _0x032a=function(_0x4b043b,_0x598b17){_0x4b043b=_0x4b043b-0x0;var _0x398f5a=_0x32a0[_0x4b043b];return _0x398f5a;};'use strict';var Sequelize=require('sequelize');module[_0x032a('0x0')]={'name':{'type':Sequelize[_0x032a('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x032a('0x1')]},'table':{'type':Sequelize[_0x032a('0x1')]},'conditions':{'type':Sequelize[_0x032a('0x2')]},'joins':{'type':Sequelize[_0x032a('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 5f31903..a673774 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 _0x784c=['error','stack','name','send','index','map','AnalyticCustomReport','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','findAll','rows','params','intersection','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','table','MetricId','function','replace','format','DESC','joins','parse','includes','foreignTable','parentKey','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','left_join','AVG(%s)','DATE(%s)','Please\x20insert\x20at\x20least\x20one\x20field','from','metric','groupBy','orderBy','alias','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','COUNT(*)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','dbH','sendStatus','status','end','json','offset','limit','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource'];(function(_0x861987,_0x556ef0){var _0x77b1c0=function(_0x18b9dc){while(--_0x18b9dc){_0x861987['push'](_0x861987['shift']());}};_0x77b1c0(++_0x556ef0);}(_0x784c,0x78));var _0xc784=function(_0xdb96b4,_0x53bee7){_0xdb96b4=_0xdb96b4-0x0;var _0x19b93f=_0x784c[_0xdb96b4];return _0x19b93f;};'use strict';var pdf=require(_0xc784('0x0'));var emlformat=require(_0xc784('0x1'));var rimraf=require(_0xc784('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc784('0x3'));var rp=require('request-promise');var moment=require(_0xc784('0x4'));var BPromise=require(_0xc784('0x5'));var Mustache=require(_0xc784('0x6'));var util=require(_0xc784('0x7'));var path=require(_0xc784('0x8'));var sox=require(_0xc784('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc784('0xa'));var squel=require(_0xc784('0xb'));var crypto=require(_0xc784('0xc'));var jsforce=require(_0xc784('0xd'));var deskjs=require(_0xc784('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc784('0xf'));var Papa=require('papaparse');var Redis=require(_0xc784('0x10'));var authService=require(_0xc784('0x11'));var qs=require(_0xc784('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc784('0x13'));var logger=require(_0xc784('0x14'))(_0xc784('0x15'));var utils=require(_0xc784('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc784('0x17'))['db'];var dbH=require('../../mysqldb')[_0xc784('0x18')];function respondWithStatusCode(_0x2ebb97,_0x46ace6){_0x46ace6=_0x46ace6||0xcc;return function(_0x2db913){if(_0x2db913){return _0x2ebb97[_0xc784('0x19')](_0x46ace6);}return _0x2ebb97[_0xc784('0x1a')](_0x46ace6)[_0xc784('0x1b')]();};}function respondWithResult(_0x2b2472,_0x36dc49){_0x36dc49=_0x36dc49||0xc8;return function(_0x5d27ec){if(_0x5d27ec){return _0x2b2472[_0xc784('0x1a')](_0x36dc49)[_0xc784('0x1c')](_0x5d27ec);}};}function respondWithFilteredResult(_0x1961e7,_0xb11365){return function(_0x2048fe){if(_0x2048fe){var _0x2e7c87=_0x2048fe['count'],_0x252d3f=_0xb11365[_0xc784('0x1d')],_0x3b9b08=_0xb11365[_0xc784('0x1d')]+_0xb11365[_0xc784('0x1e')],_0x467ddd;if(_0x3b9b08>=_0x2e7c87){_0x3b9b08=_0x2e7c87;_0x467ddd=0xc8;}else{_0x467ddd=0xce;}_0x1961e7[_0xc784('0x1a')](_0x467ddd);return _0x1961e7['set']('Content-Range',_0x252d3f+'-'+_0x3b9b08+'/'+_0x2e7c87)['json'](_0x2048fe);}return null;};}function patchUpdates(_0x321268){return function(_0x183228){try{jsonpatch[_0xc784('0x1f')](_0x183228,_0x321268,!![]);}catch(_0x35abb0){return BPromise[_0xc784('0x20')](_0x35abb0);}return _0x183228[_0xc784('0x21')]();};}function saveUpdates(_0x525cc3,_0x554a57){return function(_0x5eb921){if(_0x5eb921){return _0x5eb921[_0xc784('0x22')](_0x525cc3)[_0xc784('0x23')](function(_0x1ff92d){return _0x1ff92d;});}return null;};}function removeEntity(_0x313b18,_0x5f582d){return function(_0x1ca107){if(_0x1ca107){return _0x1ca107[_0xc784('0x24')]()[_0xc784('0x23')](function(){var _0x324cd3=_0x1ca107[_0xc784('0x25')]({'plain':!![]});var _0x5f2e7d=_0xc784('0x26');return db[_0xc784('0x27')][_0xc784('0x24')]({'where':{'type':_0x5f2e7d,'resourceId':_0x324cd3['id']}})[_0xc784('0x23')](function(){return _0x1ca107;});})[_0xc784('0x23')](function(){_0x313b18['status'](0xcc)[_0xc784('0x1b')]();});}};}function handleEntityNotFound(_0x56e175,_0x39f6a8){return function(_0x2fb6ba){if(!_0x2fb6ba){_0x56e175[_0xc784('0x19')](0x194);}return _0x2fb6ba;};}function handleError(_0x5532ec,_0x33b093){_0x33b093=_0x33b093||0x1f4;return function(_0x2a482c){logger[_0xc784('0x28')](_0x2a482c[_0xc784('0x29')]);if(_0x2a482c[_0xc784('0x2a')]){delete _0x2a482c[_0xc784('0x2a')];}_0x5532ec[_0xc784('0x1a')](_0x33b093)[_0xc784('0x2b')](_0x2a482c);};}exports[_0xc784('0x2c')]=function(_0x30b4a2,_0x2ceec5){var _0x54a345={},_0x162c66={},_0x1d1875={'count':0x0,'rows':[]};var _0x845853=_[_0xc784('0x2d')](db[_0xc784('0x2e')]['rawAttributes'],function(_0x48cc0c){return{'name':_0x48cc0c[_0xc784('0x2f')],'type':_0x48cc0c[_0xc784('0x30')]['key']};});_0x162c66[_0xc784('0x31')]=_[_0xc784('0x2d')](_0x845853,_0xc784('0x2a'));_0x162c66[_0xc784('0x32')]=_[_0xc784('0x33')](_0x30b4a2[_0xc784('0x32')]);_0x162c66[_0xc784('0x34')]=_['intersection'](_0x162c66[_0xc784('0x31')],_0x162c66[_0xc784('0x32')]);_0x54a345[_0xc784('0x35')]=_['intersection'](_0x162c66['model'],qs[_0xc784('0x36')](_0x30b4a2[_0xc784('0x32')]['fields']));_0x54a345['attributes']=_0x54a345['attributes'][_0xc784('0x37')]?_0x54a345[_0xc784('0x35')]:_0x162c66['model'];if(!_0x30b4a2[_0xc784('0x32')][_0xc784('0x38')](_0xc784('0x39'))){_0x54a345[_0xc784('0x1e')]=qs[_0xc784('0x1e')](_0x30b4a2[_0xc784('0x32')]['limit']);_0x54a345['offset']=qs[_0xc784('0x1d')](_0x30b4a2[_0xc784('0x32')][_0xc784('0x1d')]);}_0x54a345[_0xc784('0x3a')]=qs['sort'](_0x30b4a2[_0xc784('0x32')][_0xc784('0x3b')]);_0x54a345[_0xc784('0x3c')]=qs[_0xc784('0x34')](_[_0xc784('0x3d')](_0x30b4a2[_0xc784('0x32')],_0x162c66[_0xc784('0x34')]),_0x845853);if(_0x30b4a2[_0xc784('0x32')][_0xc784('0x3e')]){_0x54a345[_0xc784('0x3c')]=_[_0xc784('0x3f')](_0x54a345[_0xc784('0x3c')],{'$or':_[_0xc784('0x2d')](_0x845853,function(_0x42bc26){if(_0x42bc26['type']!==_0xc784('0x40')){var _0x4e06ce={};_0x4e06ce[_0x42bc26[_0xc784('0x2a')]]={'$like':'%'+_0x30b4a2[_0xc784('0x32')][_0xc784('0x3e')]+'%'};return _0x4e06ce;}})});}_0x54a345=_['merge']({},_0x54a345,_0x30b4a2[_0xc784('0x41')]);var _0x328cde={'where':_0x54a345['where']};return db[_0xc784('0x2e')]['count'](_0x328cde)['then'](function(_0x14ef5b){_0x1d1875[_0xc784('0x42')]=_0x14ef5b;if(_0x30b4a2[_0xc784('0x32')]['includeAll']){_0x54a345['include']=[{'all':!![]}];}return db[_0xc784('0x2e')][_0xc784('0x43')](_0x54a345);})['then'](function(_0x458973){_0x1d1875[_0xc784('0x44')]=_0x458973;return _0x1d1875;})[_0xc784('0x23')](respondWithFilteredResult(_0x2ceec5,_0x54a345))['catch'](handleError(_0x2ceec5,null));};exports['show']=function(_0x5b7ec2,_0x4edb28){var _0x469cf6={'raw':![],'where':{'id':_0x5b7ec2[_0xc784('0x45')]['id']}},_0x101234={};_0x101234[_0xc784('0x31')]=_[_0xc784('0x33')](db[_0xc784('0x2e')]['rawAttributes']);_0x101234['query']=_[_0xc784('0x33')](_0x5b7ec2[_0xc784('0x32')]);_0x101234[_0xc784('0x34')]=_['intersection'](_0x101234[_0xc784('0x31')],_0x101234[_0xc784('0x32')]);_0x469cf6[_0xc784('0x35')]=_[_0xc784('0x46')](_0x101234[_0xc784('0x31')],qs[_0xc784('0x36')](_0x5b7ec2[_0xc784('0x32')][_0xc784('0x36')]));_0x469cf6[_0xc784('0x35')]=_0x469cf6[_0xc784('0x35')]['length']?_0x469cf6['attributes']:_0x101234[_0xc784('0x31')];if(_0x5b7ec2[_0xc784('0x32')][_0xc784('0x47')]){_0x469cf6['include']=[{'all':!![]}];}_0x469cf6=_[_0xc784('0x3f')]({},_0x469cf6,_0x5b7ec2['options']);return db[_0xc784('0x2e')][_0xc784('0x48')](_0x469cf6)['then'](handleEntityNotFound(_0x4edb28,null))['then'](respondWithResult(_0x4edb28,null))[_0xc784('0x49')](handleError(_0x4edb28,null));};exports['create']=function(_0x2ce7b8,_0x45fb3a){return db[_0xc784('0x2e')][_0xc784('0x4a')](_0x2ce7b8['body'],{})[_0xc784('0x23')](function(_0xfe0d76){var _0x508bfb=_0x2ce7b8[_0xc784('0x4b')]['get']({'plain':!![]});if(!_0x508bfb)throw new Error(_0xc784('0x4c'));if(_0x508bfb['role']===_0xc784('0x4b')){var _0x189989=_0xfe0d76[_0xc784('0x25')]({'plain':!![]});var _0x4c623a=_0xc784('0x4d');return db[_0xc784('0x4e')][_0xc784('0x48')]({'where':{'name':_0x4c623a,'userProfileId':_0x508bfb[_0xc784('0x4f')]},'raw':!![]})[_0xc784('0x23')](function(_0x4bcde6){if(_0x4bcde6&&_0x4bcde6['autoAssociation']===0x0){return db[_0xc784('0x27')]['create']({'name':_0x189989['name'],'resourceId':_0x189989['id'],'type':_0xc784('0x26'),'sectionId':_0x4bcde6['id']},{})[_0xc784('0x23')](function(){return _0xfe0d76;});}else{return _0xfe0d76;}})['catch'](function(_0x52db8f){logger[_0xc784('0x28')](_0xc784('0x50'),_0x52db8f);throw _0x52db8f;});}return _0xfe0d76;})[_0xc784('0x23')](respondWithResult(_0x45fb3a,0xc9))[_0xc784('0x49')](handleError(_0x45fb3a,null));};exports['update']=function(_0x552745,_0x11a6a0){if(_0x552745[_0xc784('0x51')]['id']){delete _0x552745[_0xc784('0x51')]['id'];}return db[_0xc784('0x2e')][_0xc784('0x48')]({'where':{'id':_0x552745[_0xc784('0x45')]['id']}})[_0xc784('0x23')](handleEntityNotFound(_0x11a6a0,null))[_0xc784('0x23')](saveUpdates(_0x552745[_0xc784('0x51')],null))[_0xc784('0x23')](respondWithResult(_0x11a6a0,null))[_0xc784('0x49')](handleError(_0x11a6a0,null));};exports[_0xc784('0x24')]=function(_0x329d77,_0x46f2a9){return db[_0xc784('0x2e')]['find']({'where':{'id':_0x329d77['params']['id']}})['then'](handleEntityNotFound(_0x46f2a9,null))[_0xc784('0x23')](removeEntity(_0x46f2a9,null))[_0xc784('0x49')](handleError(_0x46f2a9,null));};exports['preview']=function(_0x275a05,_0x1f8042){var _0x559d46=0xa;var _0x281117=['join','left_join',_0xc784('0x52'),_0xc784('0x53')];var _0x244c06={'SUM':_0xc784('0x54'),'COUNT':_0xc784('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc784('0x56'),'MIN':_0xc784('0x57'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xc784('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc784('0x59')};var _0x1bcd4d={'SEC_TO_TIME':_0xc784('0x5a'),'DATE':'DATE(%s)','HOUR':_0xc784('0x5b'),'ROUND':_0xc784('0x5c'),'UNIX_TIMESTAMP':_0xc784('0x5d')};var _0x1ebd71=function(_0x38e932){return!_['includes']([_0xc784('0x5e'),_0xc784('0x5f'),_0xc784('0x60'),_0xc784('0x61')],_0x38e932);};var _0x22ed1d=function(_0x54f9e5){if(!_0x54f9e5||!_0x54f9e5[_0xc784('0x62')][_0xc784('0x37')]){return'';}for(var _0x447d0b='(',_0x364f1e=0x0;_0x364f1e<_0x54f9e5[_0xc784('0x62')][_0xc784('0x37')];_0x364f1e+=0x1){_0x364f1e>0x0&&(_0x447d0b+='\x20'+_0x54f9e5[_0xc784('0x63')]+'\x20');_0x447d0b+=_0x54f9e5['rules'][_0x364f1e][_0xc784('0x64')]?_0x22ed1d(_0x54f9e5[_0xc784('0x62')][_0x364f1e]['group']):_0x54f9e5[_0xc784('0x62')][_0x364f1e][_0xc784('0x65')]+'\x20'+_0x54f9e5[_0xc784('0x62')][_0x364f1e][_0xc784('0x66')]+(_0x1ebd71(_0x54f9e5[_0xc784('0x62')][_0x364f1e][_0xc784('0x66')])?'\x20'+_0x54f9e5[_0xc784('0x62')][_0x364f1e][_0xc784('0x67')]:'');}return _0x447d0b+')';};var _0x4da044={'where':{'id':_0x275a05[_0xc784('0x45')]['id']}},_0x4b0e5b,_0x271073,_0x478260,_0xd5eb94,_0x21471a;_0x4da044=_[_0xc784('0x3f')]({},_0x4da044,_0x275a05[_0xc784('0x41')]);return db[_0xc784('0x2e')][_0xc784('0x48')](_0x4da044)[_0xc784('0x23')](function(_0x1e786d){if(_0x1e786d){_0x4b0e5b=_0x1e786d;return _0x1e786d['getFields']();}return null;})[_0xc784('0x23')](function(_0x470b3e){if(_0x470b3e){if(!_0x470b3e[_0xc784('0x37')]){throw new db[(_0xc784('0x68'))][(_0xc784('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x271073=_0x470b3e;return db[_0xc784('0x6a')][_0xc784('0x43')]({'raw':!![]});}return null;})[_0xc784('0x23')](function(_0x598476){if(_0x598476){_0x478260=_[_0xc784('0x6b')](_0x598476,'id');var _0x5bf078;var _0x242b75=squel[_0xc784('0x6c')]();_0x242b75['from'](_0x4b0e5b[_0xc784('0x6d')]);for(var _0x5c40cd=0x0;_0x5c40cd<_0x271073['length'];_0x5c40cd+=0x1){_0x5bf078=_0x271073[_0x5c40cd][_0xc784('0x6e')]?_0x478260[_0x271073[_0x5c40cd][_0xc784('0x6e')]]['metric']:_0x271073[_0x5c40cd][_0xc784('0x65')];_0x5bf078=_0x271073[_0x5c40cd][_0xc784('0x6f')]?_[_0xc784('0x70')](_0x244c06[_0x271073[_0x5c40cd][_0xc784('0x6f')]],'%s',_0x5bf078):_0x5bf078;_0x5bf078=_0x271073[_0x5c40cd][_0xc784('0x71')]?_[_0xc784('0x70')](_0x1bcd4d[_0x271073[_0x5c40cd][_0xc784('0x71')]],'%s',_0x5bf078):_0x5bf078;if(_0x271073[_0x5c40cd]['groupBy']){_0x242b75[_0xc784('0x64')](_0x5bf078);}_0x271073[_0x5c40cd]['orderBy']&&_0x242b75[_0xc784('0x3a')](_0x5bf078,_0x271073[_0x5c40cd]['orderBy']===_0xc784('0x72')?![]:!![]);_0x242b75[_0xc784('0x65')](_0x5bf078,_0x271073[_0x5c40cd]['alias']||_0x5bf078);}if(_0x4b0e5b['joins']){_0x4b0e5b[_0xc784('0x73')]=JSON[_0xc784('0x74')](_0x4b0e5b[_0xc784('0x73')]);for(var _0x14c410=0x0;_0x14c410<_0x4b0e5b[_0xc784('0x73')][_0xc784('0x37')];_0x14c410+=0x1){if(_0x4b0e5b['joins'][_0x14c410]['type']&&_[_0xc784('0x75')](_0x281117,_0x4b0e5b[_0xc784('0x73')][_0x14c410][_0xc784('0x30')])&&_0x4b0e5b[_0xc784('0x73')][_0x14c410]['parentKey']&&_0x4b0e5b[_0xc784('0x73')][_0x14c410][_0xc784('0x76')]&&_0x4b0e5b[_0xc784('0x73')][_0x14c410]['foreignKey']){_0x242b75[_0x4b0e5b['joins'][_0x14c410][_0xc784('0x30')]](_0x4b0e5b[_0xc784('0x73')][_0x14c410][_0xc784('0x76')],null,util[_0xc784('0x71')]('%s.%s\x20=\x20%s.%s',_0x4b0e5b[_0xc784('0x6d')],_0x4b0e5b[_0xc784('0x73')][_0x14c410][_0xc784('0x77')],_0x4b0e5b[_0xc784('0x73')][_0x14c410][_0xc784('0x76')],_0x4b0e5b[_0xc784('0x73')][_0x14c410][_0xc784('0x78')]));}}}if(_0x4b0e5b[_0xc784('0x79')]){_0x4b0e5b[_0xc784('0x79')]=JSON['parse'](_0x4b0e5b[_0xc784('0x79')]);_0x242b75[_0xc784('0x3c')](_0x22ed1d(_0x4b0e5b['conditions']['group']));}_0x21471a=_0x242b75[_0xc784('0x7a')]();_0x242b75['limit'](_0x559d46);_0x242b75['offset'](0x0);logger[_0xc784('0x7b')](_0xc784('0x7c'),_0x242b75[_0xc784('0x7d')]());return dbH[_0xc784('0x7e')][_0xc784('0x32')](_0x242b75[_0xc784('0x7d')](),{'type':dbH[_0xc784('0x7e')][_0xc784('0x7f')][_0xc784('0x80')]});}})['then'](respondWithResult(_0x1f8042,null))[_0xc784('0x49')](handleError(_0x1f8042,null));};function runReport(_0x15c5b3,_0x5cb170,_0x5ddac8){var _0x357613=_0x5cb170['name'];var _0x4691b9=0xa;var _0x1694e7=[_0xc784('0x81'),_0xc784('0x82'),_0xc784('0x52'),'cross_join'];var _0x3b3ab7={'SUM':_0xc784('0x54'),'COUNT':_0xc784('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc784('0x56'),'MIN':_0xc784('0x57'),'AVG':_0xc784('0x83'),'GROUP_CONCAT':_0xc784('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc784('0x59')};var _0x451b28={'SEC_TO_TIME':_0xc784('0x5a'),'DATE':_0xc784('0x84'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2cedfe=function(_0xb7bde6){return!_[_0xc784('0x75')]([_0xc784('0x5e'),_0xc784('0x5f'),_0xc784('0x60'),_0xc784('0x61')],_0xb7bde6);};var _0xe34133=function(_0x4aa8b9){if(!_0x4aa8b9||!_0x4aa8b9[_0xc784('0x62')]['length']){return'';}for(var _0x4c7548='(',_0x584d90=0x0;_0x584d90<_0x4aa8b9[_0xc784('0x62')][_0xc784('0x37')];_0x584d90+=0x1){_0x584d90>0x0&&(_0x4c7548+='\x20'+_0x4aa8b9[_0xc784('0x63')]+'\x20');_0x4c7548+=_0x4aa8b9['rules'][_0x584d90][_0xc784('0x64')]?_0xe34133(_0x4aa8b9[_0xc784('0x62')][_0x584d90][_0xc784('0x64')]):_0x4aa8b9['rules'][_0x584d90][_0xc784('0x65')]+'\x20'+_0x4aa8b9['rules'][_0x584d90][_0xc784('0x66')]+(_0x2cedfe(_0x4aa8b9[_0xc784('0x62')][_0x584d90]['condition'])?'\x20'+_0x4aa8b9[_0xc784('0x62')][_0x584d90][_0xc784('0x67')]:'');}return _0x4c7548+')';};var _0x38b6ae={'where':{'id':_0x15c5b3['id']}},_0x48f06a,_0x20c756,_0x4821a8,_0x55956c,_0x37d183;_0x38b6ae=_[_0xc784('0x3f')]({},_0x38b6ae,_0x5ddac8);return db[_0xc784('0x2e')]['find'](_0x38b6ae)[_0xc784('0x23')](function(_0xd0bcc8){if(_0xd0bcc8){_0x48f06a=_0xd0bcc8;return _0xd0bcc8['getFields']();}return null;})[_0xc784('0x23')](function(_0x2f34fb){if(_0x2f34fb){if(!_0x2f34fb[_0xc784('0x37')]){throw new db[(_0xc784('0x68'))][(_0xc784('0x69'))](_0xc784('0x85'),0x193);}_0x20c756=_0x2f34fb;return db['AnalyticMetric'][_0xc784('0x43')]({'raw':!![]});}return null;})[_0xc784('0x23')](function(_0x3e964d){if(_0x3e964d){_0x4821a8=_['keyBy'](_0x3e964d,'id');var _0x4d5e57;var _0x5a6c35=squel['select']();_0x5a6c35[_0xc784('0x86')](_0x48f06a['table']);for(var _0xff6c6f=0x0;_0xff6c6f<_0x20c756[_0xc784('0x37')];_0xff6c6f+=0x1){_0x4d5e57=_0x20c756[_0xff6c6f][_0xc784('0x6e')]?_0x4821a8[_0x20c756[_0xff6c6f][_0xc784('0x6e')]][_0xc784('0x87')]:_0x20c756[_0xff6c6f]['field'];_0x4d5e57=_0x20c756[_0xff6c6f][_0xc784('0x6f')]?_[_0xc784('0x70')](_0x3b3ab7[_0x20c756[_0xff6c6f][_0xc784('0x6f')]],'%s',_0x4d5e57):_0x4d5e57;_0x4d5e57=_0x20c756[_0xff6c6f][_0xc784('0x71')]?_[_0xc784('0x70')](_0x451b28[_0x20c756[_0xff6c6f][_0xc784('0x71')]],'%s',_0x4d5e57):_0x4d5e57;if(_0x20c756[_0xff6c6f][_0xc784('0x88')]){_0x5a6c35[_0xc784('0x64')](_0x4d5e57);}_0x20c756[_0xff6c6f][_0xc784('0x89')]&&_0x5a6c35['order'](_0x4d5e57,_0x20c756[_0xff6c6f][_0xc784('0x89')]==='DESC'?![]:!![]);_0x5a6c35['field'](_0x4d5e57,_0x20c756[_0xff6c6f][_0xc784('0x8a')]||_0x4d5e57);}if(_0x48f06a[_0xc784('0x73')]){_0x48f06a[_0xc784('0x73')]=JSON[_0xc784('0x74')](_0x48f06a[_0xc784('0x73')]);for(var _0x5b384b=0x0;_0x5b384b<_0x48f06a['joins'][_0xc784('0x37')];_0x5b384b+=0x1){if(_0x48f06a[_0xc784('0x73')][_0x5b384b][_0xc784('0x30')]&&_[_0xc784('0x75')](_0x1694e7,_0x48f06a[_0xc784('0x73')][_0x5b384b][_0xc784('0x30')])&&_0x48f06a[_0xc784('0x73')][_0x5b384b][_0xc784('0x77')]&&_0x48f06a[_0xc784('0x73')][_0x5b384b]['foreignTable']&&_0x48f06a['joins'][_0x5b384b][_0xc784('0x78')]){_0x5a6c35[_0x48f06a[_0xc784('0x73')][_0x5b384b][_0xc784('0x30')]](_0x48f06a[_0xc784('0x73')][_0x5b384b]['foreignTable'],null,util[_0xc784('0x71')](_0xc784('0x8b'),_0x48f06a[_0xc784('0x6d')],_0x48f06a[_0xc784('0x73')][_0x5b384b][_0xc784('0x77')],_0x48f06a[_0xc784('0x73')][_0x5b384b][_0xc784('0x76')],_0x48f06a['joins'][_0x5b384b][_0xc784('0x78')]));}}}if(_0x48f06a[_0xc784('0x79')]){_0x48f06a['conditions']=JSON[_0xc784('0x74')](_0x48f06a[_0xc784('0x79')]);_0x5a6c35['where'](_0xe34133(_0x48f06a[_0xc784('0x79')][_0xc784('0x64')]));}_0x37d183=_0x5a6c35['clone']();_0x5a6c35[_0xc784('0x1e')](_0x4691b9);_0x5a6c35[_0xc784('0x1d')](0x0);return;}})[_0xc784('0x23')](function(){if(_0x5cb170[_0xc784('0x8c')]===_0xc784('0x8d')){return null;}var _0xafea32=_['merge'](_0x5cb170,{'name':_0x5cb170[_0xc784('0x8e')]||_0x5cb170['name']||_0x48f06a[_0xc784('0x2a')],'basename':_0x357613,'savename':util['format'](_0xc784('0x8f'),_0x5cb170['name']||_0x48f06a[_0xc784('0x2a')],require('randomstring')[_0xc784('0x90')](0x4),_0x5cb170[_0xc784('0x8c')]||_0xc784('0x91')),'reportId':_0x48f06a['id'],'reportType':'custom'});return db[_0xc784('0x92')][_0xc784('0x4a')](_0xafea32,{'raw':!![]});})[_0xc784('0x23')](function(_0x514161){if(_0x48f06a[_0xc784('0x6d')]===_0xc784('0x93')){_0x37d183['where'](_0x48f06a[_0xc784('0x6d')]+_0xc784('0x94'),_0x5cb170['startDate'],_0x5cb170['endDate']);}else{_0x37d183['where'](_0x48f06a[_0xc784('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5cb170[_0xc784('0x95')],_0x5cb170[_0xc784('0x96')]);}if(_0x514161){logger['info'](_0xc784('0x97'),_0x37d183['toString']());require(_0xc784('0x98'))[_0xc784('0x99')](path[_0xc784('0x81')](__dirname,_0xc784('0x9a'),_0x514161['output']),[_0x514161['id'],_0x37d183['toString'](),path[_0xc784('0x81')](__dirname,_0xc784('0x9b'),_0x514161[_0xc784('0x9c')]),_0x357613]);return _0x514161;}else{var _0x2d1c34=squel['select']();_0x2d1c34[_0xc784('0x86')]('('+_0x37d183[_0xc784('0x7d')]()+')','countTable');_0x2d1c34['field'](_0xc784('0x9d'),_0xc784('0x42'));_0x37d183[_0xc784('0x1e')](_0x5cb170['limit']||_0x4691b9);_0x37d183['offset'](_0x5cb170['offset']||0x0);return dbH['sequelize'][_0xc784('0x32')](_0x2d1c34[_0xc784('0x7d')](),{'type':dbH['sequelize'][_0xc784('0x7f')][_0xc784('0x80')]})['then'](function(_0x2dffd0){if(!_0x2dffd0[_0xc784('0x37')]){_0x55956c=0x0;}else{_0x55956c=_0x2dffd0[0x0][_0xc784('0x42')]||0x0;}return dbH['sequelize'][_0xc784('0x32')](_0x37d183['toString'](),{'type':dbH[_0xc784('0x7e')][_0xc784('0x7f')][_0xc784('0x80')]});})['then'](function(_0x272264){return{'rows':_0x272264||[],'count':_0x55956c};});}});}exports['run']=function(_0x15975a,_0xa3bd80){return runReport(_0x15975a[_0xc784('0x45')],_0x15975a[_0xc784('0x32')],_0x15975a[_0xc784('0x41')])[_0xc784('0x23')](respondWithResult(_0xa3bd80,null))[_0xc784('0x49')](handleError(_0xa3bd80,null));};exports['runReport']=runReport;exports[_0xc784('0x32')]=function(_0x2b5e3f,_0x4ce2c5){var _0x579bbd=0xa;var _0x156890=[_0xc784('0x81'),_0xc784('0x82'),_0xc784('0x52'),_0xc784('0x53')];var _0x2bb110={'SUM':_0xc784('0x54'),'COUNT':_0xc784('0x55'),'COUNT DISTINCT':_0xc784('0x9e'),'MAX':_0xc784('0x56'),'MIN':_0xc784('0x57'),'AVG':_0xc784('0x83'),'GROUP_CONCAT':_0xc784('0x58'),'GROUP_CONCAT ASC':_0xc784('0x9f'),'GROUP_CONCAT DESC':_0xc784('0x59')};var _0x5232af={'SEC_TO_TIME':_0xc784('0x5a'),'DATE':_0xc784('0x84'),'HOUR':_0xc784('0x5b'),'ROUND':_0xc784('0x5c'),'UNIX_TIMESTAMP':_0xc784('0x5d')};var _0x5257d2=function(_0x21e2f2){return!_['includes'](['IS\x20NULL',_0xc784('0x5f'),_0xc784('0x60'),'IS\x20NOT\x20EMPTY'],_0x21e2f2);};var _0x3a2cff=function(_0x3987cc){if(!_0x3987cc||!_0x3987cc[_0xc784('0x62')]['length']){return'';}for(var _0x167c0e='(',_0x592655=0x0;_0x592655<_0x3987cc['rules'][_0xc784('0x37')];_0x592655+=0x1){_0x592655>0x0&&(_0x167c0e+='\x20'+_0x3987cc[_0xc784('0x63')]+'\x20');_0x167c0e+=_0x3987cc[_0xc784('0x62')][_0x592655][_0xc784('0x64')]?_0x3a2cff(_0x3987cc['rules'][_0x592655][_0xc784('0x64')]):_0x3987cc[_0xc784('0x62')][_0x592655]['field']+'\x20'+_0x3987cc['rules'][_0x592655][_0xc784('0x66')]+(_0x5257d2(_0x3987cc['rules'][_0x592655][_0xc784('0x66')])?'\x20'+_0x3987cc[_0xc784('0x62')][_0x592655][_0xc784('0x67')]:'');}return _0x167c0e+')';};var _0x554156={'where':{'id':_0x2b5e3f[_0xc784('0x45')]['id']}},_0x497656,_0x117d3f,_0x13b726,_0x5aefab,_0x5d0ca8;_0x554156=_[_0xc784('0x3f')]({},_0x554156,_0x2b5e3f['options']);return db['AnalyticCustomReport'][_0xc784('0x48')](_0x554156)[_0xc784('0x23')](function(_0x50f4d3){if(_0x50f4d3){_0x497656=_0x50f4d3;return _0x50f4d3['getFields']();}return null;})[_0xc784('0x23')](function(_0x2aa1d3){if(_0x2aa1d3){if(!_0x2aa1d3[_0xc784('0x37')]){throw new db[(_0xc784('0x68'))][(_0xc784('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x117d3f=_0x2aa1d3;return db['AnalyticMetric'][_0xc784('0x43')]({'raw':!![]});}return null;})[_0xc784('0x23')](function(_0x4c41bb){if(_0x4c41bb){_0x13b726=_[_0xc784('0x6b')](_0x4c41bb,'id');var _0x259698;var _0x4781b4=squel[_0xc784('0x6c')]();_0x4781b4[_0xc784('0x86')](_0x497656[_0xc784('0x6d')]);for(var _0x164d9f=0x0;_0x164d9f<_0x117d3f[_0xc784('0x37')];_0x164d9f+=0x1){_0x259698=_0x117d3f[_0x164d9f][_0xc784('0x6e')]?_0x13b726[_0x117d3f[_0x164d9f][_0xc784('0x6e')]][_0xc784('0x87')]:_0x117d3f[_0x164d9f][_0xc784('0x65')];_0x259698=_0x117d3f[_0x164d9f][_0xc784('0x6f')]?_[_0xc784('0x70')](_0x2bb110[_0x117d3f[_0x164d9f]['function']],'%s',_0x259698):_0x259698;_0x259698=_0x117d3f[_0x164d9f][_0xc784('0x71')]?_[_0xc784('0x70')](_0x5232af[_0x117d3f[_0x164d9f][_0xc784('0x71')]],'%s',_0x259698):_0x259698;if(_0x117d3f[_0x164d9f][_0xc784('0x88')]){_0x4781b4[_0xc784('0x64')](_0x259698);}_0x117d3f[_0x164d9f]['orderBy']&&_0x4781b4[_0xc784('0x3a')](_0x259698,_0x117d3f[_0x164d9f][_0xc784('0x89')]==='DESC'?![]:!![]);_0x4781b4[_0xc784('0x65')](_0x259698,_0x117d3f[_0x164d9f][_0xc784('0x8a')]||_0x259698);}if(_0x497656[_0xc784('0x73')]){_0x497656[_0xc784('0x73')]=JSON[_0xc784('0x74')](_0x497656[_0xc784('0x73')]);for(var _0x60a388=0x0;_0x60a388<_0x497656['joins']['length'];_0x60a388+=0x1){if(_0x497656['joins'][_0x60a388]['type']&&_[_0xc784('0x75')](_0x156890,_0x497656[_0xc784('0x73')][_0x60a388][_0xc784('0x30')])&&_0x497656['joins'][_0x60a388][_0xc784('0x77')]&&_0x497656['joins'][_0x60a388]['foreignTable']&&_0x497656['joins'][_0x60a388][_0xc784('0x78')]){_0x4781b4[_0x497656[_0xc784('0x73')][_0x60a388][_0xc784('0x30')]](_0x497656[_0xc784('0x73')][_0x60a388][_0xc784('0x76')],null,util['format'](_0xc784('0x8b'),_0x497656[_0xc784('0x6d')],_0x497656['joins'][_0x60a388][_0xc784('0x77')],_0x497656['joins'][_0x60a388]['foreignTable'],_0x497656[_0xc784('0x73')][_0x60a388][_0xc784('0x78')]));}}}if(_0x497656[_0xc784('0x79')]){_0x497656[_0xc784('0x79')]=JSON[_0xc784('0x74')](_0x497656['conditions']);_0x4781b4[_0xc784('0x3c')](_0x3a2cff(_0x497656[_0xc784('0x79')][_0xc784('0x64')]));}_0x5d0ca8=_0x4781b4[_0xc784('0x7a')]();_0x4781b4['limit'](_0x579bbd);_0x4781b4['offset'](0x0);logger[_0xc784('0x7b')](_0xc784('0x7c'),_0x4781b4[_0xc784('0x7d')]());return dbH[_0xc784('0x7e')]['query'](_0x4781b4[_0xc784('0x7d')](),{'type':dbH[_0xc784('0x7e')][_0xc784('0x7f')][_0xc784('0x80')]});}})[_0xc784('0x23')](function(){return{'sql':_0x5d0ca8[_0xc784('0x7d')]()};})['then'](respondWithResult(_0x4ce2c5,null))[_0xc784('0x49')](handleError(_0x4ce2c5,null));}; \ No newline at end of file +var _0xa6ed=['order','sort','pick','filter','merge','VIRTUAL','options','where','count','includeAll','include','AnalyticCustomReport','findAll','rows','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','cross_join','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','clone','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','left_join','IS\x20NOT\x20EMPTY','metric','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','dbH','sendStatus','status','end','json','offset','limit','Content-Range','apply','save','update','then','destroy','get','CustomReports','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa6ed,0x111));var _0xda6e=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xa6ed[_0x413feb];return _0x40ee88;};'use strict';var pdf=require(_0xda6e('0x0'));var emlformat=require(_0xda6e('0x1'));var rimraf=require(_0xda6e('0x2'));var zipdir=require(_0xda6e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xda6e('0x4'));var BPromise=require(_0xda6e('0x5'));var Mustache=require(_0xda6e('0x6'));var util=require('util');var path=require('path');var sox=require(_0xda6e('0x7'));var csv=require(_0xda6e('0x8'));var ejs=require(_0xda6e('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xda6e('0xa'));var crypto=require(_0xda6e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xda6e('0xc'));var toCsv=require(_0xda6e('0x8'));var querystring=require(_0xda6e('0xd'));var Papa=require(_0xda6e('0xe'));var Redis=require(_0xda6e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xda6e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xda6e('0x11'));var logger=require(_0xda6e('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xda6e('0x13'));var licenseUtil=require(_0xda6e('0x14'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xda6e('0x15')];function respondWithStatusCode(_0xb58365,_0x51d6a8){_0x51d6a8=_0x51d6a8||0xcc;return function(_0xc663ca){if(_0xc663ca){return _0xb58365[_0xda6e('0x16')](_0x51d6a8);}return _0xb58365[_0xda6e('0x17')](_0x51d6a8)[_0xda6e('0x18')]();};}function respondWithResult(_0x203b02,_0x2a3c6e){_0x2a3c6e=_0x2a3c6e||0xc8;return function(_0x55f160){if(_0x55f160){return _0x203b02['status'](_0x2a3c6e)[_0xda6e('0x19')](_0x55f160);}};}function respondWithFilteredResult(_0x1ceb21,_0x11ff98){return function(_0x197543){if(_0x197543){var _0x152564=_0x197543['count'],_0x185d92=_0x11ff98[_0xda6e('0x1a')],_0x21d615=_0x11ff98[_0xda6e('0x1a')]+_0x11ff98[_0xda6e('0x1b')],_0x2d6486;if(_0x21d615>=_0x152564){_0x21d615=_0x152564;_0x2d6486=0xc8;}else{_0x2d6486=0xce;}_0x1ceb21[_0xda6e('0x17')](_0x2d6486);return _0x1ceb21['set'](_0xda6e('0x1c'),_0x185d92+'-'+_0x21d615+'/'+_0x152564)[_0xda6e('0x19')](_0x197543);}return null;};}function patchUpdates(_0x2c2e1d){return function(_0x4e0c2e){try{jsonpatch[_0xda6e('0x1d')](_0x4e0c2e,_0x2c2e1d,!![]);}catch(_0x13c6f4){return BPromise['reject'](_0x13c6f4);}return _0x4e0c2e[_0xda6e('0x1e')]();};}function saveUpdates(_0x570ad6,_0x4b5cd5){return function(_0x344ef6){if(_0x344ef6){return _0x344ef6[_0xda6e('0x1f')](_0x570ad6)[_0xda6e('0x20')](function(_0x434c61){return _0x434c61;});}return null;};}function removeEntity(_0x5917b9,_0xaccf9){return function(_0x15aabb){if(_0x15aabb){return _0x15aabb[_0xda6e('0x21')]()[_0xda6e('0x20')](function(){var _0x4c0133=_0x15aabb[_0xda6e('0x22')]({'plain':!![]});var _0xcc213e=_0xda6e('0x23');return db[_0xda6e('0x24')][_0xda6e('0x21')]({'where':{'type':_0xcc213e,'resourceId':_0x4c0133['id']}})['then'](function(){return _0x15aabb;});})[_0xda6e('0x20')](function(){_0x5917b9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x24f927,_0x2e6e1f){return function(_0x34d06f){if(!_0x34d06f){_0x24f927['sendStatus'](0x194);}return _0x34d06f;};}function handleError(_0x51c2f8,_0x27eb2a){_0x27eb2a=_0x27eb2a||0x1f4;return function(_0x2b83a3){logger[_0xda6e('0x25')](_0x2b83a3['stack']);if(_0x2b83a3[_0xda6e('0x26')]){delete _0x2b83a3['name'];}_0x51c2f8[_0xda6e('0x17')](_0x27eb2a)[_0xda6e('0x27')](_0x2b83a3);};}exports[_0xda6e('0x28')]=function(_0x48910f,_0x4ca0d7){var _0x50eb15={},_0x2d877f={},_0x562e6f={'count':0x0,'rows':[]};var _0x557470=_[_0xda6e('0x29')](db['AnalyticCustomReport'][_0xda6e('0x2a')],function(_0x5bfbd2){return{'name':_0x5bfbd2[_0xda6e('0x2b')],'type':_0x5bfbd2[_0xda6e('0x2c')][_0xda6e('0x2d')]};});_0x2d877f['model']=_[_0xda6e('0x29')](_0x557470,_0xda6e('0x26'));_0x2d877f[_0xda6e('0x2e')]=_[_0xda6e('0x2f')](_0x48910f[_0xda6e('0x2e')]);_0x2d877f[_0xda6e('0x30')]=_[_0xda6e('0x31')](_0x2d877f[_0xda6e('0x32')],_0x2d877f['query']);_0x50eb15[_0xda6e('0x33')]=_['intersection'](_0x2d877f[_0xda6e('0x32')],qs['fields'](_0x48910f[_0xda6e('0x2e')][_0xda6e('0x34')]));_0x50eb15[_0xda6e('0x33')]=_0x50eb15[_0xda6e('0x33')]['length']?_0x50eb15[_0xda6e('0x33')]:_0x2d877f[_0xda6e('0x32')];if(!_0x48910f[_0xda6e('0x2e')][_0xda6e('0x35')](_0xda6e('0x36'))){_0x50eb15['limit']=qs['limit'](_0x48910f['query'][_0xda6e('0x1b')]);_0x50eb15[_0xda6e('0x1a')]=qs[_0xda6e('0x1a')](_0x48910f[_0xda6e('0x2e')][_0xda6e('0x1a')]);}_0x50eb15[_0xda6e('0x37')]=qs[_0xda6e('0x38')](_0x48910f[_0xda6e('0x2e')][_0xda6e('0x38')]);_0x50eb15['where']=qs[_0xda6e('0x30')](_[_0xda6e('0x39')](_0x48910f[_0xda6e('0x2e')],_0x2d877f[_0xda6e('0x30')]),_0x557470);if(_0x48910f[_0xda6e('0x2e')][_0xda6e('0x3a')]){_0x50eb15['where']=_[_0xda6e('0x3b')](_0x50eb15['where'],{'$or':_[_0xda6e('0x29')](_0x557470,function(_0x564e49){if(_0x564e49[_0xda6e('0x2c')]!==_0xda6e('0x3c')){var _0x19004a={};_0x19004a[_0x564e49[_0xda6e('0x26')]]={'$like':'%'+_0x48910f[_0xda6e('0x2e')][_0xda6e('0x3a')]+'%'};return _0x19004a;}})});}_0x50eb15=_[_0xda6e('0x3b')]({},_0x50eb15,_0x48910f[_0xda6e('0x3d')]);var _0x398638={'where':_0x50eb15[_0xda6e('0x3e')]};return db['AnalyticCustomReport'][_0xda6e('0x3f')](_0x398638)[_0xda6e('0x20')](function(_0x3c8998){_0x562e6f[_0xda6e('0x3f')]=_0x3c8998;if(_0x48910f[_0xda6e('0x2e')][_0xda6e('0x40')]){_0x50eb15[_0xda6e('0x41')]=[{'all':!![]}];}return db[_0xda6e('0x42')][_0xda6e('0x43')](_0x50eb15);})[_0xda6e('0x20')](function(_0x149a0b){_0x562e6f[_0xda6e('0x44')]=_0x149a0b;return _0x562e6f;})['then'](respondWithFilteredResult(_0x4ca0d7,_0x50eb15))['catch'](handleError(_0x4ca0d7,null));};exports[_0xda6e('0x45')]=function(_0x3f5433,_0x1983fc){var _0x23301e={'raw':![],'where':{'id':_0x3f5433[_0xda6e('0x46')]['id']}},_0xebf8cb={};_0xebf8cb[_0xda6e('0x32')]=_[_0xda6e('0x2f')](db[_0xda6e('0x42')]['rawAttributes']);_0xebf8cb['query']=_[_0xda6e('0x2f')](_0x3f5433[_0xda6e('0x2e')]);_0xebf8cb['filters']=_[_0xda6e('0x31')](_0xebf8cb[_0xda6e('0x32')],_0xebf8cb[_0xda6e('0x2e')]);_0x23301e[_0xda6e('0x33')]=_[_0xda6e('0x31')](_0xebf8cb[_0xda6e('0x32')],qs[_0xda6e('0x34')](_0x3f5433[_0xda6e('0x2e')][_0xda6e('0x34')]));_0x23301e[_0xda6e('0x33')]=_0x23301e['attributes'][_0xda6e('0x47')]?_0x23301e[_0xda6e('0x33')]:_0xebf8cb[_0xda6e('0x32')];if(_0x3f5433[_0xda6e('0x2e')]['includeAll']){_0x23301e[_0xda6e('0x41')]=[{'all':!![]}];}_0x23301e=_['merge']({},_0x23301e,_0x3f5433[_0xda6e('0x3d')]);return db[_0xda6e('0x42')][_0xda6e('0x48')](_0x23301e)[_0xda6e('0x20')](handleEntityNotFound(_0x1983fc,null))[_0xda6e('0x20')](respondWithResult(_0x1983fc,null))['catch'](handleError(_0x1983fc,null));};exports[_0xda6e('0x49')]=function(_0x4d9592,_0x5d3a65){return db['AnalyticCustomReport'][_0xda6e('0x49')](_0x4d9592[_0xda6e('0x4a')],{})['then'](function(_0x59fbcf){var _0xc386fe=_0x4d9592[_0xda6e('0x4b')][_0xda6e('0x22')]({'plain':!![]});if(!_0xc386fe)throw new Error(_0xda6e('0x4c'));if(_0xc386fe[_0xda6e('0x4d')]===_0xda6e('0x4b')){var _0x282fa3=_0x59fbcf[_0xda6e('0x22')]({'plain':!![]});var _0x5c4a4c=_0xda6e('0x4e');return db[_0xda6e('0x4f')][_0xda6e('0x48')]({'where':{'name':_0x5c4a4c,'userProfileId':_0xc386fe[_0xda6e('0x50')]},'raw':!![]})['then'](function(_0x7c1508){if(_0x7c1508&&_0x7c1508['autoAssociation']===0x0){return db[_0xda6e('0x24')]['create']({'name':_0x282fa3[_0xda6e('0x26')],'resourceId':_0x282fa3['id'],'type':_0xda6e('0x23'),'sectionId':_0x7c1508['id']},{})[_0xda6e('0x20')](function(){return _0x59fbcf;});}else{return _0x59fbcf;}})[_0xda6e('0x51')](function(_0x574015){logger[_0xda6e('0x25')](_0xda6e('0x52'),_0x574015);throw _0x574015;});}return _0x59fbcf;})[_0xda6e('0x20')](respondWithResult(_0x5d3a65,0xc9))[_0xda6e('0x51')](handleError(_0x5d3a65,null));};exports[_0xda6e('0x1f')]=function(_0x3b4d79,_0x4fe262){if(_0x3b4d79[_0xda6e('0x4a')]['id']){delete _0x3b4d79[_0xda6e('0x4a')]['id'];}return db[_0xda6e('0x42')][_0xda6e('0x48')]({'where':{'id':_0x3b4d79['params']['id']}})['then'](handleEntityNotFound(_0x4fe262,null))[_0xda6e('0x20')](saveUpdates(_0x3b4d79[_0xda6e('0x4a')],null))['then'](respondWithResult(_0x4fe262,null))[_0xda6e('0x51')](handleError(_0x4fe262,null));};exports[_0xda6e('0x21')]=function(_0xecbd45,_0x36c030){return db[_0xda6e('0x42')][_0xda6e('0x48')]({'where':{'id':_0xecbd45[_0xda6e('0x46')]['id']}})[_0xda6e('0x20')](handleEntityNotFound(_0x36c030,null))[_0xda6e('0x20')](removeEntity(_0x36c030,null))[_0xda6e('0x51')](handleError(_0x36c030,null));};exports['preview']=function(_0x3268a0,_0x3e3d0d){var _0xf35c62=0xa;var _0x5a11c2=[_0xda6e('0x53'),'left_join','right_join',_0xda6e('0x54')];var _0x3e81f5={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xda6e('0x55'),'MIN':_0xda6e('0x56'),'AVG':_0xda6e('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xda6e('0x58'),'GROUP_CONCAT DESC':_0xda6e('0x59')};var _0x1abdb3={'SEC_TO_TIME':_0xda6e('0x5a'),'DATE':_0xda6e('0x5b'),'HOUR':_0xda6e('0x5c'),'ROUND':_0xda6e('0x5d'),'UNIX_TIMESTAMP':_0xda6e('0x5e')};var _0x35f9e6=function(_0x21a2fc){return!_['includes']([_0xda6e('0x5f'),_0xda6e('0x60'),_0xda6e('0x61'),'IS\x20NOT\x20EMPTY'],_0x21a2fc);};var _0x38fa11=function(_0x3e2fc0){if(!_0x3e2fc0||!_0x3e2fc0[_0xda6e('0x62')][_0xda6e('0x47')]){return'';}for(var _0x1430c1='(',_0x4399fb=0x0;_0x4399fb<_0x3e2fc0[_0xda6e('0x62')][_0xda6e('0x47')];_0x4399fb+=0x1){_0x4399fb>0x0&&(_0x1430c1+='\x20'+_0x3e2fc0[_0xda6e('0x63')]+'\x20');_0x1430c1+=_0x3e2fc0['rules'][_0x4399fb][_0xda6e('0x64')]?_0x38fa11(_0x3e2fc0[_0xda6e('0x62')][_0x4399fb][_0xda6e('0x64')]):_0x3e2fc0['rules'][_0x4399fb][_0xda6e('0x65')]+'\x20'+_0x3e2fc0[_0xda6e('0x62')][_0x4399fb][_0xda6e('0x66')]+(_0x35f9e6(_0x3e2fc0[_0xda6e('0x62')][_0x4399fb][_0xda6e('0x66')])?'\x20'+_0x3e2fc0[_0xda6e('0x62')][_0x4399fb][_0xda6e('0x67')]:'');}return _0x1430c1+')';};var _0x3461f8={'where':{'id':_0x3268a0[_0xda6e('0x46')]['id']}},_0x1eb71d,_0x1f34d4,_0x41d6d4,_0x11df34,_0x3d3da2;_0x3461f8=_[_0xda6e('0x3b')]({},_0x3461f8,_0x3268a0[_0xda6e('0x3d')]);return db[_0xda6e('0x42')][_0xda6e('0x48')](_0x3461f8)['then'](function(_0x252ef3){if(_0x252ef3){_0x1eb71d=_0x252ef3;return _0x252ef3['getFields']();}return null;})[_0xda6e('0x20')](function(_0x3be6bd){if(_0x3be6bd){if(!_0x3be6bd['length']){throw new db['Sequelize'][(_0xda6e('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1f34d4=_0x3be6bd;return db[_0xda6e('0x69')][_0xda6e('0x43')]({'raw':!![]});}return null;})[_0xda6e('0x20')](function(_0x1f37ff){if(_0x1f37ff){_0x41d6d4=_[_0xda6e('0x6a')](_0x1f37ff,'id');var _0x2d97c3;var _0x15d620=squel[_0xda6e('0x6b')]();_0x15d620[_0xda6e('0x6c')](_0x1eb71d[_0xda6e('0x6d')]);for(var _0x506685=0x0;_0x506685<_0x1f34d4[_0xda6e('0x47')];_0x506685+=0x1){_0x2d97c3=_0x1f34d4[_0x506685][_0xda6e('0x6e')]?_0x41d6d4[_0x1f34d4[_0x506685][_0xda6e('0x6e')]]['metric']:_0x1f34d4[_0x506685][_0xda6e('0x65')];_0x2d97c3=_0x1f34d4[_0x506685][_0xda6e('0x6f')]?_[_0xda6e('0x70')](_0x3e81f5[_0x1f34d4[_0x506685]['function']],'%s',_0x2d97c3):_0x2d97c3;_0x2d97c3=_0x1f34d4[_0x506685]['format']?_[_0xda6e('0x70')](_0x1abdb3[_0x1f34d4[_0x506685][_0xda6e('0x71')]],'%s',_0x2d97c3):_0x2d97c3;if(_0x1f34d4[_0x506685][_0xda6e('0x72')]){_0x15d620[_0xda6e('0x64')](_0x2d97c3);}_0x1f34d4[_0x506685][_0xda6e('0x73')]&&_0x15d620[_0xda6e('0x37')](_0x2d97c3,_0x1f34d4[_0x506685][_0xda6e('0x73')]===_0xda6e('0x74')?![]:!![]);_0x15d620[_0xda6e('0x65')](_0x2d97c3,_0x1f34d4[_0x506685][_0xda6e('0x75')]||_0x2d97c3);}if(_0x1eb71d[_0xda6e('0x76')]){_0x1eb71d['joins']=JSON[_0xda6e('0x77')](_0x1eb71d[_0xda6e('0x76')]);for(var _0x2b2163=0x0;_0x2b2163<_0x1eb71d[_0xda6e('0x76')][_0xda6e('0x47')];_0x2b2163+=0x1){if(_0x1eb71d[_0xda6e('0x76')][_0x2b2163][_0xda6e('0x2c')]&&_[_0xda6e('0x78')](_0x5a11c2,_0x1eb71d[_0xda6e('0x76')][_0x2b2163][_0xda6e('0x2c')])&&_0x1eb71d[_0xda6e('0x76')][_0x2b2163][_0xda6e('0x79')]&&_0x1eb71d[_0xda6e('0x76')][_0x2b2163][_0xda6e('0x7a')]&&_0x1eb71d[_0xda6e('0x76')][_0x2b2163][_0xda6e('0x7b')]){_0x15d620[_0x1eb71d['joins'][_0x2b2163][_0xda6e('0x2c')]](_0x1eb71d[_0xda6e('0x76')][_0x2b2163]['foreignTable'],null,util[_0xda6e('0x71')](_0xda6e('0x7c'),_0x1eb71d['table'],_0x1eb71d[_0xda6e('0x76')][_0x2b2163]['parentKey'],_0x1eb71d[_0xda6e('0x76')][_0x2b2163][_0xda6e('0x7a')],_0x1eb71d[_0xda6e('0x76')][_0x2b2163][_0xda6e('0x7b')]));}}}if(_0x1eb71d['conditions']){_0x1eb71d[_0xda6e('0x7d')]=JSON[_0xda6e('0x77')](_0x1eb71d[_0xda6e('0x7d')]);_0x15d620[_0xda6e('0x3e')](_0x38fa11(_0x1eb71d[_0xda6e('0x7d')][_0xda6e('0x64')]));}_0x3d3da2=_0x15d620['clone']();_0x15d620['limit'](_0xf35c62);_0x15d620[_0xda6e('0x1a')](0x0);logger[_0xda6e('0x7e')](_0xda6e('0x7f'),_0x15d620['toString']());return dbH[_0xda6e('0x80')][_0xda6e('0x2e')](_0x15d620[_0xda6e('0x81')](),{'type':dbH[_0xda6e('0x80')][_0xda6e('0x82')][_0xda6e('0x83')]});}})['then'](respondWithResult(_0x3e3d0d,null))['catch'](handleError(_0x3e3d0d,null));};function runReport(_0x4a1748,_0x583f5a,_0x4eed64){var _0x2f4c69=_0x583f5a['name'];var _0xbd9dc4=0xa;var _0x5ae8ca=['join','left_join',_0xda6e('0x84'),_0xda6e('0x54')];var _0x4f4363={'SUM':_0xda6e('0x85'),'COUNT':_0xda6e('0x86'),'COUNT DISTINCT':_0xda6e('0x87'),'MAX':_0xda6e('0x55'),'MIN':_0xda6e('0x56'),'AVG':_0xda6e('0x57'),'GROUP_CONCAT':_0xda6e('0x88'),'GROUP_CONCAT ASC':_0xda6e('0x58'),'GROUP_CONCAT DESC':_0xda6e('0x59')};var _0x551f17={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xda6e('0x5b'),'HOUR':_0xda6e('0x5c'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xda6e('0x5e')};var _0x5ced1b=function(_0x54bb63){return!_[_0xda6e('0x78')]([_0xda6e('0x5f'),_0xda6e('0x60'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x54bb63);};var _0x28036d=function(_0x449949){if(!_0x449949||!_0x449949[_0xda6e('0x62')][_0xda6e('0x47')]){return'';}for(var _0x19036d='(',_0x4200be=0x0;_0x4200be<_0x449949[_0xda6e('0x62')]['length'];_0x4200be+=0x1){_0x4200be>0x0&&(_0x19036d+='\x20'+_0x449949[_0xda6e('0x63')]+'\x20');_0x19036d+=_0x449949[_0xda6e('0x62')][_0x4200be][_0xda6e('0x64')]?_0x28036d(_0x449949[_0xda6e('0x62')][_0x4200be]['group']):_0x449949[_0xda6e('0x62')][_0x4200be][_0xda6e('0x65')]+'\x20'+_0x449949[_0xda6e('0x62')][_0x4200be][_0xda6e('0x66')]+(_0x5ced1b(_0x449949[_0xda6e('0x62')][_0x4200be]['condition'])?'\x20'+_0x449949[_0xda6e('0x62')][_0x4200be][_0xda6e('0x67')]:'');}return _0x19036d+')';};var _0x3db0fd={'where':{'id':_0x4a1748['id']}},_0x1a9d75,_0x313c37,_0x1a6c66,_0x3422fc,_0x375fc0;_0x3db0fd=_[_0xda6e('0x3b')]({},_0x3db0fd,_0x4eed64);return db[_0xda6e('0x42')]['find'](_0x3db0fd)[_0xda6e('0x20')](function(_0x179609){if(_0x179609){_0x1a9d75=_0x179609;return _0x179609[_0xda6e('0x89')]();}return null;})[_0xda6e('0x20')](function(_0x286c76){if(_0x286c76){if(!_0x286c76[_0xda6e('0x47')]){throw new db[(_0xda6e('0x8a'))][(_0xda6e('0x68'))](_0xda6e('0x8b'),0x193);}_0x313c37=_0x286c76;return db['AnalyticMetric'][_0xda6e('0x43')]({'raw':!![]});}return null;})[_0xda6e('0x20')](function(_0x453a03){if(_0x453a03){_0x1a6c66=_[_0xda6e('0x6a')](_0x453a03,'id');var _0x367a68;var _0x2c385b=squel[_0xda6e('0x6b')]();_0x2c385b['from'](_0x1a9d75[_0xda6e('0x6d')]);for(var _0x4449fe=0x0;_0x4449fe<_0x313c37[_0xda6e('0x47')];_0x4449fe+=0x1){_0x367a68=_0x313c37[_0x4449fe][_0xda6e('0x6e')]?_0x1a6c66[_0x313c37[_0x4449fe]['MetricId']]['metric']:_0x313c37[_0x4449fe]['field'];_0x367a68=_0x313c37[_0x4449fe][_0xda6e('0x6f')]?_[_0xda6e('0x70')](_0x4f4363[_0x313c37[_0x4449fe][_0xda6e('0x6f')]],'%s',_0x367a68):_0x367a68;_0x367a68=_0x313c37[_0x4449fe][_0xda6e('0x71')]?_['replace'](_0x551f17[_0x313c37[_0x4449fe][_0xda6e('0x71')]],'%s',_0x367a68):_0x367a68;if(_0x313c37[_0x4449fe][_0xda6e('0x72')]){_0x2c385b[_0xda6e('0x64')](_0x367a68);}_0x313c37[_0x4449fe][_0xda6e('0x73')]&&_0x2c385b[_0xda6e('0x37')](_0x367a68,_0x313c37[_0x4449fe]['orderBy']===_0xda6e('0x74')?![]:!![]);_0x2c385b[_0xda6e('0x65')](_0x367a68,_0x313c37[_0x4449fe][_0xda6e('0x75')]||_0x367a68);}if(_0x1a9d75['joins']){_0x1a9d75[_0xda6e('0x76')]=JSON['parse'](_0x1a9d75[_0xda6e('0x76')]);for(var _0x5575ff=0x0;_0x5575ff<_0x1a9d75[_0xda6e('0x76')][_0xda6e('0x47')];_0x5575ff+=0x1){if(_0x1a9d75[_0xda6e('0x76')][_0x5575ff][_0xda6e('0x2c')]&&_[_0xda6e('0x78')](_0x5ae8ca,_0x1a9d75[_0xda6e('0x76')][_0x5575ff][_0xda6e('0x2c')])&&_0x1a9d75[_0xda6e('0x76')][_0x5575ff][_0xda6e('0x79')]&&_0x1a9d75[_0xda6e('0x76')][_0x5575ff][_0xda6e('0x7a')]&&_0x1a9d75['joins'][_0x5575ff][_0xda6e('0x7b')]){_0x2c385b[_0x1a9d75[_0xda6e('0x76')][_0x5575ff][_0xda6e('0x2c')]](_0x1a9d75['joins'][_0x5575ff][_0xda6e('0x7a')],null,util[_0xda6e('0x71')]('%s.%s\x20=\x20%s.%s',_0x1a9d75[_0xda6e('0x6d')],_0x1a9d75[_0xda6e('0x76')][_0x5575ff][_0xda6e('0x79')],_0x1a9d75[_0xda6e('0x76')][_0x5575ff]['foreignTable'],_0x1a9d75[_0xda6e('0x76')][_0x5575ff]['foreignKey']));}}}if(_0x1a9d75[_0xda6e('0x7d')]){_0x1a9d75[_0xda6e('0x7d')]=JSON[_0xda6e('0x77')](_0x1a9d75[_0xda6e('0x7d')]);_0x2c385b['where'](_0x28036d(_0x1a9d75[_0xda6e('0x7d')][_0xda6e('0x64')]));}_0x375fc0=_0x2c385b[_0xda6e('0x8c')]();_0x2c385b[_0xda6e('0x1b')](_0xbd9dc4);_0x2c385b[_0xda6e('0x1a')](0x0);return;}})['then'](function(){if(_0x583f5a[_0xda6e('0x8d')]==='web'){return null;}var _0x26771a=_[_0xda6e('0x3b')](_0x583f5a,{'name':_0x583f5a[_0xda6e('0x8e')]||_0x583f5a[_0xda6e('0x26')]||_0x1a9d75[_0xda6e('0x26')],'basename':_0x2f4c69,'savename':util[_0xda6e('0x71')](_0xda6e('0x8f'),_0x583f5a[_0xda6e('0x26')]||_0x1a9d75['name'],require(_0xda6e('0x90'))[_0xda6e('0x91')](0x4),_0x583f5a[_0xda6e('0x8d')]||_0xda6e('0x92')),'reportId':_0x1a9d75['id'],'reportType':_0xda6e('0x93')});return db['AnalyticExtractedReport']['create'](_0x26771a,{'raw':!![]});})[_0xda6e('0x20')](function(_0x2d5fd5){if(_0x1a9d75[_0xda6e('0x6d')]===_0xda6e('0x94')){_0x375fc0[_0xda6e('0x3e')](_0x1a9d75[_0xda6e('0x6d')]+_0xda6e('0x95'),_0x583f5a[_0xda6e('0x96')],_0x583f5a[_0xda6e('0x97')]);}else{_0x375fc0['where'](_0x1a9d75['table']+_0xda6e('0x98'),_0x583f5a[_0xda6e('0x96')],_0x583f5a['endDate']);}if(_0x2d5fd5){logger[_0xda6e('0x99')](_0xda6e('0x9a'),_0x375fc0[_0xda6e('0x81')]());require(_0xda6e('0x9b'))[_0xda6e('0x9c')](path[_0xda6e('0x53')](__dirname,'../../components/export/',_0x2d5fd5[_0xda6e('0x8d')]),[_0x2d5fd5['id'],_0x375fc0[_0xda6e('0x81')](),path['join'](__dirname,_0xda6e('0x9d'),_0x2d5fd5[_0xda6e('0x9e')]),_0x2f4c69]);return _0x2d5fd5;}else{var _0x6ec1e2=squel[_0xda6e('0x6b')]();_0x6ec1e2[_0xda6e('0x6c')]('('+_0x375fc0['toString']()+')',_0xda6e('0x9f'));_0x6ec1e2[_0xda6e('0x65')](_0xda6e('0xa0'),'count');_0x375fc0['limit'](_0x583f5a[_0xda6e('0x1b')]||_0xbd9dc4);_0x375fc0[_0xda6e('0x1a')](_0x583f5a[_0xda6e('0x1a')]||0x0);return dbH[_0xda6e('0x80')][_0xda6e('0x2e')](_0x6ec1e2['toString'](),{'type':dbH[_0xda6e('0x80')]['QueryTypes'][_0xda6e('0x83')]})[_0xda6e('0x20')](function(_0x268a03){if(!_0x268a03[_0xda6e('0x47')]){_0x3422fc=0x0;}else{_0x3422fc=_0x268a03[0x0]['count']||0x0;}return dbH[_0xda6e('0x80')]['query'](_0x375fc0[_0xda6e('0x81')](),{'type':dbH[_0xda6e('0x80')][_0xda6e('0x82')][_0xda6e('0x83')]});})[_0xda6e('0x20')](function(_0x13bad9){return{'rows':_0x13bad9||[],'count':_0x3422fc};});}});}exports['run']=function(_0x263885,_0x438029){return runReport(_0x263885[_0xda6e('0x46')],_0x263885[_0xda6e('0x2e')],_0x263885[_0xda6e('0x3d')])[_0xda6e('0x20')](respondWithResult(_0x438029,null))[_0xda6e('0x51')](handleError(_0x438029,null));};exports['runReport']=runReport;exports[_0xda6e('0x2e')]=function(_0x2bd3d7,_0x3e81e3){var _0x433193=0xa;var _0x1d1bb0=[_0xda6e('0x53'),_0xda6e('0xa1'),_0xda6e('0x84'),'cross_join'];var _0x11fcc1={'SUM':'SUM(%s)','COUNT':_0xda6e('0x86'),'COUNT DISTINCT':_0xda6e('0x87'),'MAX':_0xda6e('0x55'),'MIN':_0xda6e('0x56'),'AVG':_0xda6e('0x57'),'GROUP_CONCAT':_0xda6e('0x88'),'GROUP_CONCAT ASC':_0xda6e('0x58'),'GROUP_CONCAT DESC':_0xda6e('0x59')};var _0xf46083={'SEC_TO_TIME':_0xda6e('0x5a'),'DATE':_0xda6e('0x5b'),'HOUR':_0xda6e('0x5c'),'ROUND':_0xda6e('0x5d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x293595=function(_0x253359){return!_['includes']([_0xda6e('0x5f'),'IS\x20NOT\x20NULL',_0xda6e('0x61'),_0xda6e('0xa2')],_0x253359);};var _0x48310d=function(_0x840225){if(!_0x840225||!_0x840225[_0xda6e('0x62')]['length']){return'';}for(var _0x2163e8='(',_0x5bfc6e=0x0;_0x5bfc6e<_0x840225[_0xda6e('0x62')][_0xda6e('0x47')];_0x5bfc6e+=0x1){_0x5bfc6e>0x0&&(_0x2163e8+='\x20'+_0x840225[_0xda6e('0x63')]+'\x20');_0x2163e8+=_0x840225[_0xda6e('0x62')][_0x5bfc6e][_0xda6e('0x64')]?_0x48310d(_0x840225[_0xda6e('0x62')][_0x5bfc6e][_0xda6e('0x64')]):_0x840225['rules'][_0x5bfc6e][_0xda6e('0x65')]+'\x20'+_0x840225[_0xda6e('0x62')][_0x5bfc6e][_0xda6e('0x66')]+(_0x293595(_0x840225[_0xda6e('0x62')][_0x5bfc6e][_0xda6e('0x66')])?'\x20'+_0x840225[_0xda6e('0x62')][_0x5bfc6e][_0xda6e('0x67')]:'');}return _0x2163e8+')';};var _0x1519b2={'where':{'id':_0x2bd3d7[_0xda6e('0x46')]['id']}},_0x3f2f88,_0x109cc1,_0x4591c1,_0x3d51b4,_0x189e6a;_0x1519b2=_[_0xda6e('0x3b')]({},_0x1519b2,_0x2bd3d7['options']);return db[_0xda6e('0x42')]['find'](_0x1519b2)[_0xda6e('0x20')](function(_0x538940){if(_0x538940){_0x3f2f88=_0x538940;return _0x538940['getFields']();}return null;})[_0xda6e('0x20')](function(_0xbac87f){if(_0xbac87f){if(!_0xbac87f[_0xda6e('0x47')]){throw new db[(_0xda6e('0x8a'))][(_0xda6e('0x68'))](_0xda6e('0x8b'),0x193);}_0x109cc1=_0xbac87f;return db['AnalyticMetric'][_0xda6e('0x43')]({'raw':!![]});}return null;})['then'](function(_0x4999e9){if(_0x4999e9){_0x4591c1=_[_0xda6e('0x6a')](_0x4999e9,'id');var _0x4c29b8;var _0xa2f62=squel[_0xda6e('0x6b')]();_0xa2f62[_0xda6e('0x6c')](_0x3f2f88[_0xda6e('0x6d')]);for(var _0x339ab1=0x0;_0x339ab1<_0x109cc1[_0xda6e('0x47')];_0x339ab1+=0x1){_0x4c29b8=_0x109cc1[_0x339ab1][_0xda6e('0x6e')]?_0x4591c1[_0x109cc1[_0x339ab1][_0xda6e('0x6e')]][_0xda6e('0xa3')]:_0x109cc1[_0x339ab1][_0xda6e('0x65')];_0x4c29b8=_0x109cc1[_0x339ab1][_0xda6e('0x6f')]?_['replace'](_0x11fcc1[_0x109cc1[_0x339ab1]['function']],'%s',_0x4c29b8):_0x4c29b8;_0x4c29b8=_0x109cc1[_0x339ab1]['format']?_[_0xda6e('0x70')](_0xf46083[_0x109cc1[_0x339ab1]['format']],'%s',_0x4c29b8):_0x4c29b8;if(_0x109cc1[_0x339ab1][_0xda6e('0x72')]){_0xa2f62['group'](_0x4c29b8);}_0x109cc1[_0x339ab1]['orderBy']&&_0xa2f62[_0xda6e('0x37')](_0x4c29b8,_0x109cc1[_0x339ab1]['orderBy']==='DESC'?![]:!![]);_0xa2f62[_0xda6e('0x65')](_0x4c29b8,_0x109cc1[_0x339ab1][_0xda6e('0x75')]||_0x4c29b8);}if(_0x3f2f88['joins']){_0x3f2f88[_0xda6e('0x76')]=JSON['parse'](_0x3f2f88[_0xda6e('0x76')]);for(var _0x40f46c=0x0;_0x40f46c<_0x3f2f88[_0xda6e('0x76')]['length'];_0x40f46c+=0x1){if(_0x3f2f88[_0xda6e('0x76')][_0x40f46c][_0xda6e('0x2c')]&&_[_0xda6e('0x78')](_0x1d1bb0,_0x3f2f88[_0xda6e('0x76')][_0x40f46c][_0xda6e('0x2c')])&&_0x3f2f88[_0xda6e('0x76')][_0x40f46c][_0xda6e('0x79')]&&_0x3f2f88[_0xda6e('0x76')][_0x40f46c]['foreignTable']&&_0x3f2f88['joins'][_0x40f46c][_0xda6e('0x7b')]){_0xa2f62[_0x3f2f88[_0xda6e('0x76')][_0x40f46c][_0xda6e('0x2c')]](_0x3f2f88[_0xda6e('0x76')][_0x40f46c][_0xda6e('0x7a')],null,util[_0xda6e('0x71')](_0xda6e('0x7c'),_0x3f2f88[_0xda6e('0x6d')],_0x3f2f88['joins'][_0x40f46c]['parentKey'],_0x3f2f88[_0xda6e('0x76')][_0x40f46c]['foreignTable'],_0x3f2f88[_0xda6e('0x76')][_0x40f46c][_0xda6e('0x7b')]));}}}if(_0x3f2f88['conditions']){_0x3f2f88[_0xda6e('0x7d')]=JSON[_0xda6e('0x77')](_0x3f2f88[_0xda6e('0x7d')]);_0xa2f62[_0xda6e('0x3e')](_0x48310d(_0x3f2f88['conditions']['group']));}_0x189e6a=_0xa2f62[_0xda6e('0x8c')]();_0xa2f62[_0xda6e('0x1b')](_0x433193);_0xa2f62[_0xda6e('0x1a')](0x0);logger['debug'](_0xda6e('0x7f'),_0xa2f62[_0xda6e('0x81')]());return dbH[_0xda6e('0x80')][_0xda6e('0x2e')](_0xa2f62[_0xda6e('0x81')](),{'type':dbH['sequelize'][_0xda6e('0x82')][_0xda6e('0x83')]});}})[_0xda6e('0x20')](function(){return{'sql':_0x189e6a[_0xda6e('0x81')]()};})['then'](respondWithResult(_0x3e81e3,null))['catch'](handleError(_0x3e81e3,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 67d39cc..c3afaae 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 _0xaacd=['exports','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./analyticCustomReport.attributes'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xaacd,0xb3));var _0xdaac=function(_0x4d400d,_0x30a6e6){_0x4d400d=_0x4d400d-0x0;var _0x327fc4=_0xaacd[_0x4d400d];return _0x327fc4;};'use strict';var _=require(_0xdaac('0x0'));var util=require('util');var logger=require(_0xdaac('0x1'))(_0xdaac('0x2'));var moment=require('moment');var BPromise=require(_0xdaac('0x3'));var rp=require(_0xdaac('0x4'));var fs=require('fs');var path=require(_0xdaac('0x5'));var rimraf=require(_0xdaac('0x6'));var config=require('../../config/environment');var attributes=require(_0xdaac('0x7'));module[_0xdaac('0x8')]=function(_0x5bc382,_0xc2bc00){return _0x5bc382['define'](_0xdaac('0x9'),attributes,{'tableName':_0xdaac('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d66=['./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9d66,0xd1));var _0x69d6=function(_0x4e813c,_0x5f3232){_0x4e813c=_0x4e813c-0x0;var _0x73270e=_0x9d66[_0x4e813c];return _0x73270e;};'use strict';var _=require(_0x69d6('0x0'));var util=require('util');var logger=require(_0x69d6('0x1'))('api');var moment=require('moment');var BPromise=require(_0x69d6('0x2'));var rp=require(_0x69d6('0x3'));var fs=require('fs');var path=require(_0x69d6('0x4'));var rimraf=require(_0x69d6('0x5'));var config=require(_0x69d6('0x6'));var attributes=require(_0x69d6('0x7'));module[_0x69d6('0x8')]=function(_0x4b3ea4,_0x59272a){return _0x4b3ea4[_0x69d6('0x9')](_0x69d6('0xa'),attributes,{'tableName':_0x69d6('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 63f59e7..6e484bf 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 _0x3204=['rpc','jayson/promise','client','http','then','info','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','AnalyticCustomReport,\x20%s,\x20%s','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x279a08,_0x251bfc){var _0x5912b4=function(_0xb05807){while(--_0xb05807){_0x279a08['push'](_0x279a08['shift']());}};_0x5912b4(++_0x251bfc);}(_0x3204,0x111));var _0x4320=function(_0x437894,_0x29d1be){_0x437894=_0x437894-0x0;var _0x25322b=_0x3204[_0x437894];return _0x25322b;};'use strict';var _=require(_0x4320('0x0'));var util=require(_0x4320('0x1'));var moment=require(_0x4320('0x2'));var BPromise=require(_0x4320('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4320('0x4'));var db=require(_0x4320('0x5'))['db'];var utils=require(_0x4320('0x6'));var logger=require('../../config/logger')(_0x4320('0x7'));var config=require('../../config/environment');var jayson=require(_0x4320('0x8'));var client=jayson[_0x4320('0x9')][_0x4320('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ce54a,_0x34717a,_0x4060dc){return new BPromise(function(_0xa58b2a,_0x986bb1){return client['request'](_0x1ce54a,_0x4060dc)[_0x4320('0xb')](function(_0x17f78a){logger[_0x4320('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x34717a,_0x4320('0xd'));logger['debug'](_0x4320('0xe'),_0x34717a,'request\x20sent',JSON['stringify'](_0x17f78a));if(_0x17f78a[_0x4320('0xf')]){if(_0x17f78a[_0x4320('0xf')][_0x4320('0x10')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x34717a,_0x17f78a['error'][_0x4320('0x11')]);return _0x986bb1(_0x17f78a[_0x4320('0xf')]['message']);}logger[_0x4320('0xf')](_0x4320('0x12'),_0x34717a,_0x17f78a[_0x4320('0xf')]['message']);return _0xa58b2a(_0x17f78a[_0x4320('0xf')][_0x4320('0x11')]);}else{logger[_0x4320('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x34717a,_0x4320('0xd'));_0xa58b2a(_0x17f78a[_0x4320('0x13')][_0x4320('0x11')]);}})['catch'](function(_0x50569b){logger[_0x4320('0xf')](_0x4320('0x12'),_0x34717a,_0x50569b);_0x986bb1(_0x50569b);});});} \ No newline at end of file +var _0xabe3=['moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash'];(function(_0x1b62a9,_0xfe98af){var _0x396ad6=function(_0x78c6d1){while(--_0x78c6d1){_0x1b62a9['push'](_0x1b62a9['shift']());}};_0x396ad6(++_0xfe98af);}(_0xabe3,0x179));var _0x3abe=function(_0x41fef3,_0x4c9eff){_0x41fef3=_0x41fef3-0x0;var _0x8ee292=_0xabe3[_0x41fef3];return _0x8ee292;};'use strict';var _=require(_0x3abe('0x0'));var util=require('util');var moment=require(_0x3abe('0x1'));var BPromise=require(_0x3abe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3abe('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3abe('0x4'));var logger=require(_0x3abe('0x5'))(_0x3abe('0x6'));var config=require('../../config/environment');var jayson=require(_0x3abe('0x7'));var client=jayson[_0x3abe('0x8')][_0x3abe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5353e7,_0x1fa945,_0x27d115){return new BPromise(function(_0x48d11f,_0x57cd7a){return client[_0x3abe('0xa')](_0x5353e7,_0x27d115)[_0x3abe('0xb')](function(_0x33a5b0){logger[_0x3abe('0xc')](_0x3abe('0xd'),_0x1fa945,_0x3abe('0xe'));logger[_0x3abe('0xf')](_0x3abe('0x10'),_0x1fa945,_0x3abe('0xe'),JSON['stringify'](_0x33a5b0));if(_0x33a5b0['error']){if(_0x33a5b0[_0x3abe('0x11')]['code']===0x1f4){logger['error'](_0x3abe('0xd'),_0x1fa945,_0x33a5b0['error'][_0x3abe('0x12')]);return _0x57cd7a(_0x33a5b0[_0x3abe('0x11')][_0x3abe('0x12')]);}logger['error'](_0x3abe('0xd'),_0x1fa945,_0x33a5b0[_0x3abe('0x11')][_0x3abe('0x12')]);return _0x48d11f(_0x33a5b0['error']['message']);}else{logger[_0x3abe('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1fa945,_0x3abe('0xe'));_0x48d11f(_0x33a5b0[_0x3abe('0x13')][_0x3abe('0x12')]);}})[_0x3abe('0x14')](function(_0x47fa6d){logger[_0x3abe('0x11')](_0x3abe('0xd'),_0x1fa945,_0x47fa6d);_0x57cd7a(_0x47fa6d);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 0fe083b..3dcefaa 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 _0xbff3=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','/:id','isAuthenticated','show','/:id/preview','/:id/run','run','/:id/query','query','post','create','put','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x1b4002,_0x5b4094){var _0x1716f3=function(_0x47cfd1){while(--_0x47cfd1){_0x1b4002['push'](_0x1b4002['shift']());}};_0x1716f3(++_0x5b4094);}(_0xbff3,0x111));var _0x3bff=function(_0x383bcc,_0x5e1352){_0x383bcc=_0x383bcc-0x0;var _0x3d3a23=_0xbff3[_0x383bcc];return _0x3d3a23;};'use strict';var multer=require(_0x3bff('0x0'));var util=require('util');var path=require(_0x3bff('0x1'));var timeout=require(_0x3bff('0x2'));var express=require(_0x3bff('0x3'));var router=express['Router']();var auth=require(_0x3bff('0x4'));var interaction=require(_0x3bff('0x5'));var config=require(_0x3bff('0x6'));var controller=require(_0x3bff('0x7'));router[_0x3bff('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3bff('0x9'),auth[_0x3bff('0xa')](),controller[_0x3bff('0xb')]);router[_0x3bff('0x8')](_0x3bff('0xc'),auth[_0x3bff('0xa')](),controller['preview']);router[_0x3bff('0x8')](_0x3bff('0xd'),auth[_0x3bff('0xa')](),controller[_0x3bff('0xe')]);router[_0x3bff('0x8')](_0x3bff('0xf'),auth[_0x3bff('0xa')](),controller[_0x3bff('0x10')]);router[_0x3bff('0x11')]('/',auth[_0x3bff('0xa')](),controller[_0x3bff('0x12')]);router[_0x3bff('0x13')](_0x3bff('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x3bff('0x14')](_0x3bff('0x9'),auth[_0x3bff('0xa')](),controller[_0x3bff('0x15')]);module[_0x3bff('0x16')]=router; \ No newline at end of file +var _0xf1f4=['/:id/preview','preview','run','query','post','create','put','update','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x9ac91d,_0x434001){var _0x458709=function(_0x995c26){while(--_0x995c26){_0x9ac91d['push'](_0x9ac91d['shift']());}};_0x458709(++_0x434001);}(_0xf1f4,0x1c2));var _0x4f1f=function(_0x13b779,_0x2101c2){_0x13b779=_0x13b779-0x0;var _0x2bbb05=_0xf1f4[_0x13b779];return _0x2bbb05;};'use strict';var multer=require(_0x4f1f('0x0'));var util=require(_0x4f1f('0x1'));var path=require(_0x4f1f('0x2'));var timeout=require(_0x4f1f('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x4f1f('0x4'));var interaction=require(_0x4f1f('0x5'));var config=require('../../config/environment');var controller=require(_0x4f1f('0x6'));router[_0x4f1f('0x7')]('/',auth[_0x4f1f('0x8')](),controller[_0x4f1f('0x9')]);router['get'](_0x4f1f('0xa'),auth[_0x4f1f('0x8')](),controller[_0x4f1f('0xb')]);router[_0x4f1f('0x7')](_0x4f1f('0xc'),auth[_0x4f1f('0x8')](),controller[_0x4f1f('0xd')]);router[_0x4f1f('0x7')]('/:id/run',auth[_0x4f1f('0x8')](),controller[_0x4f1f('0xe')]);router['get']('/:id/query',auth['isAuthenticated'](),controller[_0x4f1f('0xf')]);router[_0x4f1f('0x10')]('/',auth[_0x4f1f('0x8')](),controller[_0x4f1f('0x11')]);router[_0x4f1f('0x12')]('/:id',auth[_0x4f1f('0x8')](),controller[_0x4f1f('0x13')]);router[_0x4f1f('0x14')](_0x4f1f('0xa'),auth[_0x4f1f('0x8')](),controller['destroy']);module[_0x4f1f('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 57adb13..bf96f2a 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 _0x7b8e=['TEXT','sequelize','exports','STRING'];(function(_0x23a9a0,_0x5be833){var _0x57d10b=function(_0x56c095){while(--_0x56c095){_0x23a9a0['push'](_0x23a9a0['shift']());}};_0x57d10b(++_0x5be833);}(_0x7b8e,0xe1));var _0xe7b8=function(_0x3f684e,_0x4217c3){_0x3f684e=_0x3f684e-0x0;var _0xa8ae4a=_0x7b8e[_0x3f684e];return _0xa8ae4a;};'use strict';var Sequelize=require(_0xe7b8('0x0'));module[_0xe7b8('0x1')]={'name':{'type':Sequelize[_0xe7b8('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe7b8('0x2')]},'parent':{'type':Sequelize[_0xe7b8('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xe7b8('0x3')]},'joins':{'type':Sequelize[_0xe7b8('0x3')]}}; \ No newline at end of file +var _0xc099=['TEXT','sequelize','exports','STRING'];(function(_0x12c26e,_0x163982){var _0x5d12ea=function(_0x13fea8){while(--_0x13fea8){_0x12c26e['push'](_0x12c26e['shift']());}};_0x5d12ea(++_0x163982);}(_0xc099,0x65));var _0x9c09=function(_0x2629ee,_0x39c723){_0x2629ee=_0x2629ee-0x0;var _0x4a21f3=_0xc099[_0x2629ee];return _0x4a21f3;};'use strict';var Sequelize=require(_0x9c09('0x0'));module[_0x9c09('0x1')]={'name':{'type':Sequelize[_0x9c09('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x9c09('0x2')]},'table':{'type':Sequelize[_0x9c09('0x2')]},'conditions':{'type':Sequelize[_0x9c09('0x3')]},'joins':{'type':Sequelize[_0x9c09('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 0e6a1cf..e65cbc4 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 _0x1d0c=['SUM(%s)','COUNT(%s)','DATE(%s)','operator','DESC','%s.%s\x20=\x20%s.%s','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','join','../../components/export/','../../files/reports','run','runReport','Please\x20insert\x20at\x20least\x20one\x20field','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','AnalyticDefaultReport','rawAttributes','type','key','model','map','keys','filters','intersection','query','attributes','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','fields','find','user','get','role','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','left_join','right_join','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','format','replace','groupBy','orderBy','alias','joins','parse','includes','foreignTable','foreignKey','parentKey','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT'];(function(_0x49073,_0x883237){var _0x53d2a7=function(_0x5286c6){while(--_0x5286c6){_0x49073['push'](_0x49073['shift']());}};_0x53d2a7(++_0x883237);}(_0x1d0c,0xc2));var _0xc1d0=function(_0x3637ea,_0x35d383){_0x3637ea=_0x3637ea-0x0;var _0x5ef88b=_0x1d0c[_0x3637ea];return _0x5ef88b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc1d0('0x0'));var rimraf=require(_0xc1d0('0x1'));var zipdir=require(_0xc1d0('0x2'));var jsonpatch=require(_0xc1d0('0x3'));var rp=require(_0xc1d0('0x4'));var moment=require(_0xc1d0('0x5'));var BPromise=require(_0xc1d0('0x6'));var Mustache=require(_0xc1d0('0x7'));var util=require(_0xc1d0('0x8'));var path=require(_0xc1d0('0x9'));var sox=require(_0xc1d0('0xa'));var csv=require(_0xc1d0('0xb'));var ejs=require(_0xc1d0('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc1d0('0xd'));var crypto=require(_0xc1d0('0xe'));var jsforce=require(_0xc1d0('0xf'));var deskjs=require(_0xc1d0('0x10'));var toCsv=require(_0xc1d0('0xb'));var querystring=require(_0xc1d0('0x11'));var Papa=require('papaparse');var Redis=require(_0xc1d0('0x12'));var authService=require(_0xc1d0('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc1d0('0x14'));var hardwareService=require(_0xc1d0('0x15'));var logger=require('../../config/logger')(_0xc1d0('0x16'));var utils=require('../../config/utils');var config=require(_0xc1d0('0x17'));var licenseUtil=require(_0xc1d0('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0xc1d0('0x19'))[_0xc1d0('0x1a')];function respondWithStatusCode(_0x4f385f,_0x56b370){_0x56b370=_0x56b370||0xcc;return function(_0x650531){if(_0x650531){return _0x4f385f[_0xc1d0('0x1b')](_0x56b370);}return _0x4f385f[_0xc1d0('0x1c')](_0x56b370)[_0xc1d0('0x1d')]();};}function respondWithResult(_0x4db489,_0x5513ab){_0x5513ab=_0x5513ab||0xc8;return function(_0x115aca){if(_0x115aca){return _0x4db489[_0xc1d0('0x1c')](_0x5513ab)[_0xc1d0('0x1e')](_0x115aca);}};}function respondWithFilteredResult(_0x179453,_0x11c808){return function(_0x237a2d){if(_0x237a2d){var _0xa840bc=_0x237a2d[_0xc1d0('0x1f')],_0x247d3e=_0x11c808[_0xc1d0('0x20')],_0x1edb7e=_0x11c808['offset']+_0x11c808[_0xc1d0('0x21')],_0xa07ace;if(_0x1edb7e>=_0xa840bc){_0x1edb7e=_0xa840bc;_0xa07ace=0xc8;}else{_0xa07ace=0xce;}_0x179453['status'](_0xa07ace);return _0x179453[_0xc1d0('0x22')](_0xc1d0('0x23'),_0x247d3e+'-'+_0x1edb7e+'/'+_0xa840bc)[_0xc1d0('0x1e')](_0x237a2d);}return null;};}function patchUpdates(_0xb86e8d){return function(_0x4a7c0e){try{jsonpatch['apply'](_0x4a7c0e,_0xb86e8d,!![]);}catch(_0x5acbee){return BPromise[_0xc1d0('0x24')](_0x5acbee);}return _0x4a7c0e[_0xc1d0('0x25')]();};}function saveUpdates(_0x4a1c96,_0x24cf0e){return function(_0x24535d){if(_0x24535d){return _0x24535d[_0xc1d0('0x26')](_0x4a1c96)[_0xc1d0('0x27')](function(_0x5f40c9){return _0x5f40c9;});}return null;};}function removeEntity(_0x4ce2da,_0xf40063){return function(_0x2365eb){if(_0x2365eb){return _0x2365eb[_0xc1d0('0x28')]()[_0xc1d0('0x27')](function(){var _0x34635a=_0x2365eb['get']({'plain':!![]});var _0x255b99='DefaultReports';return db['UserProfileResource'][_0xc1d0('0x28')]({'where':{'type':_0x255b99,'resourceId':_0x34635a['id']}})[_0xc1d0('0x27')](function(){return _0x2365eb;});})[_0xc1d0('0x27')](function(){_0x4ce2da[_0xc1d0('0x1c')](0xcc)[_0xc1d0('0x1d')]();});}};}function handleEntityNotFound(_0x772f3a,_0x184885){return function(_0x251603){if(!_0x251603){_0x772f3a['sendStatus'](0x194);}return _0x251603;};}function handleError(_0x3fafeb,_0xd222a2){_0xd222a2=_0xd222a2||0x1f4;return function(_0xbd928c){logger[_0xc1d0('0x29')](_0xbd928c[_0xc1d0('0x2a')]);if(_0xbd928c[_0xc1d0('0x2b')]){delete _0xbd928c[_0xc1d0('0x2b')];}_0x3fafeb['status'](_0xd222a2)[_0xc1d0('0x2c')](_0xbd928c);};}exports['index']=function(_0x515229,_0xeaff9c){var _0x404130={},_0x15ff2e={},_0x3045a3={'count':0x0,'rows':[]};var _0x5db936=_['map'](db[_0xc1d0('0x2d')][_0xc1d0('0x2e')],function(_0x3eb3ee){return{'name':_0x3eb3ee['fieldName'],'type':_0x3eb3ee[_0xc1d0('0x2f')][_0xc1d0('0x30')]};});_0x15ff2e[_0xc1d0('0x31')]=_[_0xc1d0('0x32')](_0x5db936,_0xc1d0('0x2b'));_0x15ff2e['query']=_[_0xc1d0('0x33')](_0x515229['query']);_0x15ff2e[_0xc1d0('0x34')]=_[_0xc1d0('0x35')](_0x15ff2e['model'],_0x15ff2e['query']);_0x404130['attributes']=_[_0xc1d0('0x35')](_0x15ff2e[_0xc1d0('0x31')],qs['fields'](_0x515229[_0xc1d0('0x36')]['fields']));_0x404130[_0xc1d0('0x37')]=_0x404130[_0xc1d0('0x37')][_0xc1d0('0x38')]?_0x404130[_0xc1d0('0x37')]:_0x15ff2e['model'];if(!_0x515229[_0xc1d0('0x36')]['hasOwnProperty'](_0xc1d0('0x39'))){_0x404130[_0xc1d0('0x21')]=qs['limit'](_0x515229[_0xc1d0('0x36')][_0xc1d0('0x21')]);_0x404130[_0xc1d0('0x20')]=qs[_0xc1d0('0x20')](_0x515229['query'][_0xc1d0('0x20')]);}_0x404130[_0xc1d0('0x3a')]=qs[_0xc1d0('0x3b')](_0x515229[_0xc1d0('0x36')]['sort']);_0x404130['where']=qs[_0xc1d0('0x34')](_[_0xc1d0('0x3c')](_0x515229[_0xc1d0('0x36')],_0x15ff2e[_0xc1d0('0x34')]),_0x5db936);if(_0x515229['query'][_0xc1d0('0x3d')]){_0x404130['where']=_[_0xc1d0('0x3e')](_0x404130[_0xc1d0('0x3f')],{'$or':_[_0xc1d0('0x32')](_0x5db936,function(_0x3922dd){if(_0x3922dd[_0xc1d0('0x2f')]!==_0xc1d0('0x40')){var _0x23bc08={};_0x23bc08[_0x3922dd[_0xc1d0('0x2b')]]={'$like':'%'+_0x515229['query']['filter']+'%'};return _0x23bc08;}})});}_0x404130=_['merge']({},_0x404130,_0x515229[_0xc1d0('0x41')]);var _0x1d30a1={'where':_0x404130[_0xc1d0('0x3f')]};return db[_0xc1d0('0x2d')][_0xc1d0('0x1f')](_0x1d30a1)[_0xc1d0('0x27')](function(_0x357044){_0x3045a3[_0xc1d0('0x1f')]=_0x357044;if(_0x515229[_0xc1d0('0x36')][_0xc1d0('0x42')]){_0x404130[_0xc1d0('0x43')]=[{'all':!![]}];}return db['AnalyticDefaultReport']['findAll'](_0x404130);})['then'](function(_0x5df4b6){_0x3045a3[_0xc1d0('0x44')]=_0x5df4b6;return _0x3045a3;})[_0xc1d0('0x27')](respondWithFilteredResult(_0xeaff9c,_0x404130))[_0xc1d0('0x45')](handleError(_0xeaff9c,null));};exports[_0xc1d0('0x46')]=function(_0x57b257,_0x32c28b){var _0x9dfc1d={'raw':!![],'where':{'id':_0x57b257[_0xc1d0('0x47')]['id']}},_0x7b4396={};_0x7b4396[_0xc1d0('0x31')]=_[_0xc1d0('0x33')](db[_0xc1d0('0x2d')][_0xc1d0('0x2e')]);_0x7b4396[_0xc1d0('0x36')]=_[_0xc1d0('0x33')](_0x57b257[_0xc1d0('0x36')]);_0x7b4396[_0xc1d0('0x34')]=_[_0xc1d0('0x35')](_0x7b4396[_0xc1d0('0x31')],_0x7b4396[_0xc1d0('0x36')]);_0x9dfc1d[_0xc1d0('0x37')]=_[_0xc1d0('0x35')](_0x7b4396[_0xc1d0('0x31')],qs[_0xc1d0('0x48')](_0x57b257[_0xc1d0('0x36')][_0xc1d0('0x48')]));_0x9dfc1d[_0xc1d0('0x37')]=_0x9dfc1d[_0xc1d0('0x37')]['length']?_0x9dfc1d['attributes']:_0x7b4396['model'];if(_0x57b257['query'][_0xc1d0('0x42')]){_0x9dfc1d['include']=[{'all':!![]}];}_0x9dfc1d=_['merge']({},_0x9dfc1d,_0x57b257[_0xc1d0('0x41')]);return db['AnalyticDefaultReport'][_0xc1d0('0x49')](_0x9dfc1d)[_0xc1d0('0x27')](handleEntityNotFound(_0x32c28b,null))[_0xc1d0('0x27')](respondWithResult(_0x32c28b,null))[_0xc1d0('0x45')](handleError(_0x32c28b,null));};exports['create']=function(_0x1c5601,_0x205126){return db[_0xc1d0('0x2d')]['create'](_0x1c5601['body'],{})[_0xc1d0('0x27')](function(_0x1ab6dd){var _0x315cc=_0x1c5601[_0xc1d0('0x4a')][_0xc1d0('0x4b')]({'plain':!![]});if(!_0x315cc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x315cc[_0xc1d0('0x4c')]==='user'){var _0x3a8fd2=_0x1ab6dd['get']({'plain':!![]});var _0x323dbd=_0xc1d0('0x4d');return db[_0xc1d0('0x4e')]['find']({'where':{'name':_0x323dbd,'userProfileId':_0x315cc[_0xc1d0('0x4f')]},'raw':!![]})['then'](function(_0x505158){if(_0x505158&&_0x505158[_0xc1d0('0x50')]===0x0){return db[_0xc1d0('0x51')][_0xc1d0('0x52')]({'name':_0x3a8fd2[_0xc1d0('0x2b')],'resourceId':_0x3a8fd2['id'],'type':_0xc1d0('0x53'),'sectionId':_0x505158['id']},{})['then'](function(){return _0x1ab6dd;});}else{return _0x1ab6dd;}})[_0xc1d0('0x45')](function(_0x8f4c6f){logger[_0xc1d0('0x29')](_0xc1d0('0x54'),_0x8f4c6f);throw _0x8f4c6f;});}return _0x1ab6dd;})['then'](respondWithResult(_0x205126,0xc9))[_0xc1d0('0x45')](handleError(_0x205126,null));};exports[_0xc1d0('0x26')]=function(_0x588217,_0x566edc){if(_0x588217['body']['id']){delete _0x588217[_0xc1d0('0x55')]['id'];}return db[_0xc1d0('0x2d')]['find']({'where':{'id':_0x588217[_0xc1d0('0x47')]['id']}})[_0xc1d0('0x27')](handleEntityNotFound(_0x566edc,null))[_0xc1d0('0x27')](saveUpdates(_0x588217[_0xc1d0('0x55')],null))[_0xc1d0('0x27')](respondWithResult(_0x566edc,null))[_0xc1d0('0x45')](handleError(_0x566edc,null));};exports['destroy']=function(_0x54fc33,_0x2aa357){return db[_0xc1d0('0x2d')]['find']({'where':{'id':_0x54fc33[_0xc1d0('0x47')]['id']}})['then'](handleEntityNotFound(_0x2aa357,null))[_0xc1d0('0x27')](removeEntity(_0x2aa357,null))[_0xc1d0('0x45')](handleError(_0x2aa357,null));};exports[_0xc1d0('0x56')]=function(_0x4d8418,_0x5bd6f9){var _0x16b4f6=0xa;var _0x575a02=['join',_0xc1d0('0x57'),_0xc1d0('0x58'),_0xc1d0('0x59')];var _0x113989={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc1d0('0x5a'),'MAX':_0xc1d0('0x5b'),'MIN':_0xc1d0('0x5c'),'AVG':_0xc1d0('0x5d'),'GROUP_CONCAT':_0xc1d0('0x5e'),'GROUP_CONCAT ASC':_0xc1d0('0x5f'),'GROUP_CONCAT DESC':_0xc1d0('0x60')};var _0x545259={'SEC_TO_TIME':_0xc1d0('0x61'),'DATE':'DATE(%s)','HOUR':_0xc1d0('0x62'),'ROUND':_0xc1d0('0x63'),'UNIX_TIMESTAMP':_0xc1d0('0x64')};var _0x575be9=function(_0x46494d){return!_['includes']([_0xc1d0('0x65'),_0xc1d0('0x66'),_0xc1d0('0x67'),_0xc1d0('0x68')],_0x46494d);};var _0x3e60fa=function(_0x2961b5){if(!_0x2961b5||!_0x2961b5['rules'][_0xc1d0('0x38')]){return'';}for(var _0x3bf53c='(',_0x124bde=0x0;_0x124bde<_0x2961b5[_0xc1d0('0x69')][_0xc1d0('0x38')];_0x124bde+=0x1){_0x124bde>0x0&&(_0x3bf53c+='\x20'+_0x2961b5['operator']+'\x20');_0x3bf53c+=_0x2961b5[_0xc1d0('0x69')][_0x124bde][_0xc1d0('0x6a')]?_0x3e60fa(_0x2961b5[_0xc1d0('0x69')][_0x124bde][_0xc1d0('0x6a')]):_0x2961b5[_0xc1d0('0x69')][_0x124bde][_0xc1d0('0x6b')]+'\x20'+_0x2961b5[_0xc1d0('0x69')][_0x124bde][_0xc1d0('0x6c')]+(_0x575be9(_0x2961b5['rules'][_0x124bde]['condition'])?'\x20'+_0x2961b5[_0xc1d0('0x69')][_0x124bde][_0xc1d0('0x6d')]:'');}return _0x3bf53c+')';};var _0x3bc785={'where':{'id':_0x4d8418[_0xc1d0('0x47')]['id']}},_0x2677b4,_0x3e2c4f,_0x5a7b8b,_0x2e8f6a,_0x28cd72;_0x3bc785=_['merge']({},_0x3bc785,_0x4d8418[_0xc1d0('0x41')]);return db[_0xc1d0('0x2d')][_0xc1d0('0x49')](_0x3bc785)[_0xc1d0('0x27')](function(_0x23932f){if(_0x23932f){_0x2677b4=_0x23932f;return _0x23932f[_0xc1d0('0x6e')]();}return null;})[_0xc1d0('0x27')](function(_0xc11def){if(_0xc11def){if(!_0xc11def[_0xc1d0('0x38')]){throw new db[(_0xc1d0('0x6f'))][(_0xc1d0('0x70'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x3e2c4f=_0xc11def;return db[_0xc1d0('0x71')][_0xc1d0('0x72')]({'raw':!![]});}return null;})[_0xc1d0('0x27')](function(_0x12a4de){if(_0x12a4de){_0x5a7b8b=_[_0xc1d0('0x73')](_0x12a4de,'id');var _0x2ee8d0;var _0x46e047=squel[_0xc1d0('0x74')]();_0x46e047[_0xc1d0('0x75')](_0x2677b4[_0xc1d0('0x76')]);for(var _0x335b63=0x0;_0x335b63<_0x3e2c4f[_0xc1d0('0x38')];_0x335b63+=0x1){_0x2ee8d0=_0x3e2c4f[_0x335b63][_0xc1d0('0x77')]?_0x5a7b8b[_0x3e2c4f[_0x335b63][_0xc1d0('0x77')]][_0xc1d0('0x78')]:_0x3e2c4f[_0x335b63][_0xc1d0('0x6b')];_0x2ee8d0=_0x3e2c4f[_0x335b63][_0xc1d0('0x79')]?_['replace'](_0x113989[_0x3e2c4f[_0x335b63][_0xc1d0('0x79')]],'%s',_0x2ee8d0):_0x2ee8d0;_0x2ee8d0=_0x3e2c4f[_0x335b63][_0xc1d0('0x7a')]?_[_0xc1d0('0x7b')](_0x545259[_0x3e2c4f[_0x335b63]['format']],'%s',_0x2ee8d0):_0x2ee8d0;if(_0x3e2c4f[_0x335b63][_0xc1d0('0x7c')]){_0x46e047[_0xc1d0('0x6a')](_0x2ee8d0);}_0x3e2c4f[_0x335b63]['orderBy']&&_0x46e047[_0xc1d0('0x3a')](_0x2ee8d0,_0x3e2c4f[_0x335b63][_0xc1d0('0x7d')]==='DESC'?![]:!![]);_0x46e047[_0xc1d0('0x6b')](_0x2ee8d0,_0x3e2c4f[_0x335b63][_0xc1d0('0x7e')]||_0x2ee8d0);}if(_0x2677b4['joins']){_0x2677b4[_0xc1d0('0x7f')]=JSON[_0xc1d0('0x80')](_0x2677b4['joins']);for(var _0x1c2311=0x0;_0x1c2311<_0x2677b4[_0xc1d0('0x7f')]['length'];_0x1c2311+=0x1){if(_0x2677b4[_0xc1d0('0x7f')][_0x1c2311][_0xc1d0('0x2f')]&&_[_0xc1d0('0x81')](_0x575a02,_0x2677b4[_0xc1d0('0x7f')][_0x1c2311]['type'])&&_0x2677b4[_0xc1d0('0x7f')][_0x1c2311]['parentKey']&&_0x2677b4[_0xc1d0('0x7f')][_0x1c2311][_0xc1d0('0x82')]&&_0x2677b4[_0xc1d0('0x7f')][_0x1c2311][_0xc1d0('0x83')]){_0x46e047[_0x2677b4[_0xc1d0('0x7f')][_0x1c2311][_0xc1d0('0x2f')]](_0x2677b4[_0xc1d0('0x7f')][_0x1c2311][_0xc1d0('0x82')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x2677b4[_0xc1d0('0x76')],_0x2677b4[_0xc1d0('0x7f')][_0x1c2311][_0xc1d0('0x84')],_0x2677b4['joins'][_0x1c2311][_0xc1d0('0x82')],_0x2677b4['joins'][_0x1c2311][_0xc1d0('0x83')]));}}}if(_0x2677b4[_0xc1d0('0x85')]){_0x2677b4[_0xc1d0('0x85')]=JSON[_0xc1d0('0x80')](_0x2677b4[_0xc1d0('0x85')]);_0x46e047['where'](_0x3e60fa(_0x2677b4[_0xc1d0('0x85')][_0xc1d0('0x6a')]));}_0x28cd72=_0x46e047[_0xc1d0('0x86')]();_0x46e047[_0xc1d0('0x21')](_0x16b4f6);_0x46e047[_0xc1d0('0x20')](0x0);logger['debug'](_0xc1d0('0x87'),_0x46e047[_0xc1d0('0x88')]());return dbH['sequelize'][_0xc1d0('0x36')](_0x46e047[_0xc1d0('0x88')](),{'type':dbH[_0xc1d0('0x89')][_0xc1d0('0x8a')][_0xc1d0('0x8b')]});}})[_0xc1d0('0x27')](respondWithResult(_0x5bd6f9,null))['catch'](handleError(_0x5bd6f9,null));};function runReport(_0x31ba7e,_0xd8f6f0,_0x31c4ff){var _0x495b6a=_0xd8f6f0[_0xc1d0('0x2b')];var _0x411f1f=0xa;var _0x43d4a9=['join',_0xc1d0('0x57'),_0xc1d0('0x58'),_0xc1d0('0x59')];var _0x15be7d={'SUM':_0xc1d0('0x8c'),'COUNT':_0xc1d0('0x8d'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xc1d0('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc1d0('0x60')};var _0x5939c7={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xc1d0('0x8e'),'HOUR':_0xc1d0('0x62'),'ROUND':_0xc1d0('0x63'),'UNIX_TIMESTAMP':_0xc1d0('0x64')};var _0x31c8dc=function(_0x2f39a2){return!_[_0xc1d0('0x81')]([_0xc1d0('0x65'),_0xc1d0('0x66'),_0xc1d0('0x67'),_0xc1d0('0x68')],_0x2f39a2);};var _0x29dbb5=function(_0x52abf4){if(!_0x52abf4||!_0x52abf4[_0xc1d0('0x69')][_0xc1d0('0x38')]){return'';}for(var _0xe369e9='(',_0x5eadcd=0x0;_0x5eadcd<_0x52abf4['rules'][_0xc1d0('0x38')];_0x5eadcd+=0x1){_0x5eadcd>0x0&&(_0xe369e9+='\x20'+_0x52abf4[_0xc1d0('0x8f')]+'\x20');_0xe369e9+=_0x52abf4['rules'][_0x5eadcd][_0xc1d0('0x6a')]?_0x29dbb5(_0x52abf4['rules'][_0x5eadcd][_0xc1d0('0x6a')]):_0x52abf4[_0xc1d0('0x69')][_0x5eadcd]['field']+'\x20'+_0x52abf4[_0xc1d0('0x69')][_0x5eadcd][_0xc1d0('0x6c')]+(_0x31c8dc(_0x52abf4[_0xc1d0('0x69')][_0x5eadcd]['condition'])?'\x20'+_0x52abf4['rules'][_0x5eadcd][_0xc1d0('0x6d')]:'');}return _0xe369e9+')';};var _0x8deb79={'where':{'id':_0x31ba7e['id']}},_0x4e8c8f,_0x444467,_0x22fc0e,_0x36843c,_0x49f949;_0x8deb79=_[_0xc1d0('0x3e')]({},_0x8deb79,_0x31c4ff);return db['AnalyticDefaultReport']['find'](_0x8deb79)[_0xc1d0('0x27')](function(_0x4b3cf0){if(_0x4b3cf0){_0x4e8c8f=_0x4b3cf0;return _0x4b3cf0['getFields']();}return null;})[_0xc1d0('0x27')](function(_0x3624d8){if(_0x3624d8){if(!_0x3624d8[_0xc1d0('0x38')]){throw new db[(_0xc1d0('0x6f'))][(_0xc1d0('0x70'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x444467=_0x3624d8;return db['AnalyticMetric'][_0xc1d0('0x72')]({'raw':!![]});}return null;})[_0xc1d0('0x27')](function(_0x2fcdd0){if(_0x2fcdd0){_0x22fc0e=_[_0xc1d0('0x73')](_0x2fcdd0,'id');var _0x4c05ca;var _0x916636=squel['select']();_0x916636['from'](_0x4e8c8f[_0xc1d0('0x76')]);for(var _0xad7634=0x0;_0xad7634<_0x444467['length'];_0xad7634+=0x1){_0x4c05ca=_0x444467[_0xad7634]['MetricId']?_0x22fc0e[_0x444467[_0xad7634][_0xc1d0('0x77')]][_0xc1d0('0x78')]:_0x444467[_0xad7634][_0xc1d0('0x6b')];_0x4c05ca=_0x444467[_0xad7634][_0xc1d0('0x79')]?_['replace'](_0x15be7d[_0x444467[_0xad7634][_0xc1d0('0x79')]],'%s',_0x4c05ca):_0x4c05ca;_0x4c05ca=_0x444467[_0xad7634][_0xc1d0('0x7a')]?_[_0xc1d0('0x7b')](_0x5939c7[_0x444467[_0xad7634][_0xc1d0('0x7a')]],'%s',_0x4c05ca):_0x4c05ca;if(_0x444467[_0xad7634]['groupBy']){_0x916636[_0xc1d0('0x6a')](_0x4c05ca);}_0x444467[_0xad7634][_0xc1d0('0x7d')]&&_0x916636[_0xc1d0('0x3a')](_0x4c05ca,_0x444467[_0xad7634]['orderBy']===_0xc1d0('0x90')?![]:!![]);_0x916636[_0xc1d0('0x6b')](_0x4c05ca,_0x444467[_0xad7634]['alias']||_0x4c05ca);}if(_0x4e8c8f[_0xc1d0('0x7f')]){_0x4e8c8f['joins']=JSON[_0xc1d0('0x80')](_0x4e8c8f[_0xc1d0('0x7f')]);for(var _0x2dda23=0x0;_0x2dda23<_0x4e8c8f[_0xc1d0('0x7f')][_0xc1d0('0x38')];_0x2dda23+=0x1){if(_0x4e8c8f['joins'][_0x2dda23][_0xc1d0('0x2f')]&&_['includes'](_0x43d4a9,_0x4e8c8f[_0xc1d0('0x7f')][_0x2dda23][_0xc1d0('0x2f')])&&_0x4e8c8f[_0xc1d0('0x7f')][_0x2dda23][_0xc1d0('0x84')]&&_0x4e8c8f[_0xc1d0('0x7f')][_0x2dda23][_0xc1d0('0x82')]&&_0x4e8c8f[_0xc1d0('0x7f')][_0x2dda23][_0xc1d0('0x83')]){_0x916636[_0x4e8c8f[_0xc1d0('0x7f')][_0x2dda23]['type']](_0x4e8c8f['joins'][_0x2dda23][_0xc1d0('0x82')],null,util['format'](_0xc1d0('0x91'),_0x4e8c8f['table'],_0x4e8c8f[_0xc1d0('0x7f')][_0x2dda23][_0xc1d0('0x84')],_0x4e8c8f['joins'][_0x2dda23][_0xc1d0('0x82')],_0x4e8c8f[_0xc1d0('0x7f')][_0x2dda23]['foreignKey']));}}}if(_0x4e8c8f['conditions']){_0x4e8c8f[_0xc1d0('0x85')]=JSON[_0xc1d0('0x80')](_0x4e8c8f[_0xc1d0('0x85')]);_0x916636[_0xc1d0('0x3f')](_0x29dbb5(_0x4e8c8f[_0xc1d0('0x85')][_0xc1d0('0x6a')]));}_0x49f949=_0x916636[_0xc1d0('0x86')]();_0x916636['limit'](_0x411f1f);_0x916636['offset'](0x0);return;}})[_0xc1d0('0x27')](function(){if(_0xd8f6f0[_0xc1d0('0x92')]==='web'){return null;}var _0x41e413=_[_0xc1d0('0x3e')](_0xd8f6f0,{'name':_0xd8f6f0[_0xc1d0('0x93')]||_0xd8f6f0['name']||_0x4e8c8f[_0xc1d0('0x2b')],'basename':_0x495b6a,'savename':util[_0xc1d0('0x7a')](_0xc1d0('0x94'),_0xd8f6f0['name']||_0x4e8c8f[_0xc1d0('0x2b')],require(_0xc1d0('0x95'))[_0xc1d0('0x96')](0x4),_0xd8f6f0['output']||_0xc1d0('0x97')),'reportId':_0x4e8c8f['id'],'reportType':_0xc1d0('0x98')});return db[_0xc1d0('0x99')][_0xc1d0('0x52')](_0x41e413,{'raw':!![]});})['then'](function(_0x5b575c){if(_0x4e8c8f['table']===_0xc1d0('0x9a')){_0x49f949['where'](_0x4e8c8f[_0xc1d0('0x76')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xd8f6f0[_0xc1d0('0x9b')],_0xd8f6f0[_0xc1d0('0x9c')]);}else{_0x49f949[_0xc1d0('0x3f')](_0x4e8c8f['table']+_0xc1d0('0x9d'),_0xd8f6f0[_0xc1d0('0x9b')],_0xd8f6f0[_0xc1d0('0x9c')]);}if(_0x5b575c){logger[_0xc1d0('0x9e')](_0xc1d0('0x9f'),_0x49f949[_0xc1d0('0x88')]());require(_0xc1d0('0xa0'))['fork'](path[_0xc1d0('0xa1')](__dirname,_0xc1d0('0xa2'),_0x5b575c[_0xc1d0('0x92')]),[_0x5b575c['id'],_0x49f949[_0xc1d0('0x88')](),path[_0xc1d0('0xa1')](__dirname,_0xc1d0('0xa3'),_0x5b575c['savename']),_0x495b6a]);return _0x5b575c;}else{var _0x225996=squel[_0xc1d0('0x74')]();_0x225996[_0xc1d0('0x75')]('('+_0x49f949[_0xc1d0('0x88')]()+')','countTable');_0x225996[_0xc1d0('0x6b')]('COUNT(*)','count');_0x49f949['limit'](_0xd8f6f0[_0xc1d0('0x21')]||_0x411f1f);_0x49f949[_0xc1d0('0x20')](_0xd8f6f0[_0xc1d0('0x20')]||0x0);return dbH['sequelize']['query'](_0x225996[_0xc1d0('0x88')](),{'type':dbH['sequelize'][_0xc1d0('0x8a')][_0xc1d0('0x8b')]})[_0xc1d0('0x27')](function(_0x48cdf5){if(!_0x48cdf5[_0xc1d0('0x38')]){_0x36843c=0x0;}else{_0x36843c=_0x48cdf5[0x0][_0xc1d0('0x1f')]||0x0;}return dbH[_0xc1d0('0x89')][_0xc1d0('0x36')](_0x49f949[_0xc1d0('0x88')](),{'type':dbH[_0xc1d0('0x89')][_0xc1d0('0x8a')][_0xc1d0('0x8b')]});})[_0xc1d0('0x27')](function(_0x339740){return{'rows':_0x339740||[],'count':_0x36843c};});}});}exports[_0xc1d0('0xa4')]=function(_0x387cf2,_0x36679a){return runReport(_0x387cf2[_0xc1d0('0x47')],_0x387cf2[_0xc1d0('0x36')],_0x387cf2[_0xc1d0('0x41')])[_0xc1d0('0x27')](respondWithResult(_0x36679a,null))[_0xc1d0('0x45')](handleError(_0x36679a,null));};exports[_0xc1d0('0xa5')]=runReport;exports[_0xc1d0('0x36')]=function(_0x21c793,_0x5e920a){var _0x51e33d=0xa;var _0x41d3df=[_0xc1d0('0xa1'),_0xc1d0('0x57'),_0xc1d0('0x58'),_0xc1d0('0x59')];var _0x11da8c={'SUM':_0xc1d0('0x8c'),'COUNT':_0xc1d0('0x8d'),'COUNT DISTINCT':_0xc1d0('0x5a'),'MAX':_0xc1d0('0x5b'),'MIN':_0xc1d0('0x5c'),'AVG':_0xc1d0('0x5d'),'GROUP_CONCAT':_0xc1d0('0x5e'),'GROUP_CONCAT ASC':_0xc1d0('0x5f'),'GROUP_CONCAT DESC':_0xc1d0('0x60')};var _0x35934b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xc1d0('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x20c801=function(_0x179c32){return!_[_0xc1d0('0x81')](['IS\x20NULL',_0xc1d0('0x66'),_0xc1d0('0x67'),_0xc1d0('0x68')],_0x179c32);};var _0x199c9c=function(_0x3b0a0b){if(!_0x3b0a0b||!_0x3b0a0b[_0xc1d0('0x69')][_0xc1d0('0x38')]){return'';}for(var _0x4aedc1='(',_0x5bba4f=0x0;_0x5bba4f<_0x3b0a0b[_0xc1d0('0x69')][_0xc1d0('0x38')];_0x5bba4f+=0x1){_0x5bba4f>0x0&&(_0x4aedc1+='\x20'+_0x3b0a0b[_0xc1d0('0x8f')]+'\x20');_0x4aedc1+=_0x3b0a0b[_0xc1d0('0x69')][_0x5bba4f][_0xc1d0('0x6a')]?_0x199c9c(_0x3b0a0b[_0xc1d0('0x69')][_0x5bba4f][_0xc1d0('0x6a')]):_0x3b0a0b[_0xc1d0('0x69')][_0x5bba4f][_0xc1d0('0x6b')]+'\x20'+_0x3b0a0b[_0xc1d0('0x69')][_0x5bba4f][_0xc1d0('0x6c')]+(_0x20c801(_0x3b0a0b[_0xc1d0('0x69')][_0x5bba4f][_0xc1d0('0x6c')])?'\x20'+_0x3b0a0b[_0xc1d0('0x69')][_0x5bba4f][_0xc1d0('0x6d')]:'');}return _0x4aedc1+')';};var _0x43d08f={'where':{'id':_0x21c793['params']['id']}},_0x54f51f,_0x5d1386,_0x203e87,_0x35bd4c,_0x2c1474;_0x43d08f=_[_0xc1d0('0x3e')]({},_0x43d08f,_0x21c793['options']);return db[_0xc1d0('0x2d')][_0xc1d0('0x49')](_0x43d08f)[_0xc1d0('0x27')](function(_0x37b203){if(_0x37b203){_0x54f51f=_0x37b203;return _0x37b203[_0xc1d0('0x6e')]();}return null;})[_0xc1d0('0x27')](function(_0x51fc26){if(_0x51fc26){if(!_0x51fc26['length']){throw new db[(_0xc1d0('0x6f'))][(_0xc1d0('0x70'))](_0xc1d0('0xa6'),0x193);}_0x5d1386=_0x51fc26;return db[_0xc1d0('0x71')][_0xc1d0('0x72')]({'raw':!![]});}return null;})['then'](function(_0x454e97){if(_0x454e97){_0x203e87=_[_0xc1d0('0x73')](_0x454e97,'id');var _0x11e66f;var _0x26f5dc=squel[_0xc1d0('0x74')]();_0x26f5dc[_0xc1d0('0x75')](_0x54f51f[_0xc1d0('0x76')]);for(var _0x470d6a=0x0;_0x470d6a<_0x5d1386[_0xc1d0('0x38')];_0x470d6a+=0x1){_0x11e66f=_0x5d1386[_0x470d6a][_0xc1d0('0x77')]?_0x203e87[_0x5d1386[_0x470d6a]['MetricId']][_0xc1d0('0x78')]:_0x5d1386[_0x470d6a]['field'];_0x11e66f=_0x5d1386[_0x470d6a]['function']?_[_0xc1d0('0x7b')](_0x11da8c[_0x5d1386[_0x470d6a][_0xc1d0('0x79')]],'%s',_0x11e66f):_0x11e66f;_0x11e66f=_0x5d1386[_0x470d6a][_0xc1d0('0x7a')]?_[_0xc1d0('0x7b')](_0x35934b[_0x5d1386[_0x470d6a][_0xc1d0('0x7a')]],'%s',_0x11e66f):_0x11e66f;if(_0x5d1386[_0x470d6a][_0xc1d0('0x7c')]){_0x26f5dc['group'](_0x11e66f);}_0x5d1386[_0x470d6a][_0xc1d0('0x7d')]&&_0x26f5dc['order'](_0x11e66f,_0x5d1386[_0x470d6a][_0xc1d0('0x7d')]===_0xc1d0('0x90')?![]:!![]);_0x26f5dc[_0xc1d0('0x6b')](_0x11e66f,_0x5d1386[_0x470d6a][_0xc1d0('0x7e')]||_0x11e66f);}if(_0x54f51f['joins']){_0x54f51f[_0xc1d0('0x7f')]=JSON[_0xc1d0('0x80')](_0x54f51f[_0xc1d0('0x7f')]);for(var _0x4f3db0=0x0;_0x4f3db0<_0x54f51f[_0xc1d0('0x7f')]['length'];_0x4f3db0+=0x1){if(_0x54f51f[_0xc1d0('0x7f')][_0x4f3db0]['type']&&_['includes'](_0x41d3df,_0x54f51f[_0xc1d0('0x7f')][_0x4f3db0]['type'])&&_0x54f51f[_0xc1d0('0x7f')][_0x4f3db0][_0xc1d0('0x84')]&&_0x54f51f[_0xc1d0('0x7f')][_0x4f3db0][_0xc1d0('0x82')]&&_0x54f51f[_0xc1d0('0x7f')][_0x4f3db0][_0xc1d0('0x83')]){_0x26f5dc[_0x54f51f['joins'][_0x4f3db0][_0xc1d0('0x2f')]](_0x54f51f[_0xc1d0('0x7f')][_0x4f3db0][_0xc1d0('0x82')],null,util[_0xc1d0('0x7a')]('%s.%s\x20=\x20%s.%s',_0x54f51f[_0xc1d0('0x76')],_0x54f51f[_0xc1d0('0x7f')][_0x4f3db0][_0xc1d0('0x84')],_0x54f51f['joins'][_0x4f3db0]['foreignTable'],_0x54f51f[_0xc1d0('0x7f')][_0x4f3db0][_0xc1d0('0x83')]));}}}if(_0x54f51f[_0xc1d0('0x85')]){_0x54f51f[_0xc1d0('0x85')]=JSON['parse'](_0x54f51f[_0xc1d0('0x85')]);_0x26f5dc[_0xc1d0('0x3f')](_0x199c9c(_0x54f51f[_0xc1d0('0x85')]['group']));}_0x2c1474=_0x26f5dc['clone']();_0x26f5dc[_0xc1d0('0x21')](_0x51e33d);_0x26f5dc['offset'](0x0);logger['debug']('Limited\x20Query:',_0x26f5dc['toString']());return dbH[_0xc1d0('0x89')][_0xc1d0('0x36')](_0x26f5dc[_0xc1d0('0x88')](),{'type':dbH[_0xc1d0('0x89')][_0xc1d0('0x8a')][_0xc1d0('0x8b')]});}})[_0xc1d0('0x27')](function(){return{'sql':_0x2c1474[_0xc1d0('0x88')]()};})['then'](respondWithResult(_0x5e920a,null))[_0xc1d0('0x45')](handleError(_0x5e920a,null));}; \ No newline at end of file +var _0x6689=['AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','fork','../../files/reports','savename','countTable','run','Sequelize','debug','Limited\x20Query:','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','then','DefaultReports','destroy','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','show','params','include','find','catch','create','body','user','get','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','table','MetricId','metric','field','replace','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','HOUR(%s)','IS\x20EMPTY','value','keyBy','select','from','output','web','fullPath','%s-%s.%s','default'];(function(_0x49b343,_0x89e908){var _0x44621b=function(_0x5a4fec){while(--_0x5a4fec){_0x49b343['push'](_0x49b343['shift']());}};_0x44621b(++_0x89e908);}(_0x6689,0x146));var _0x9668=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6689[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9668('0x0'));var jsonpatch=require(_0x9668('0x1'));var rp=require(_0x9668('0x2'));var moment=require(_0x9668('0x3'));var BPromise=require(_0x9668('0x4'));var Mustache=require(_0x9668('0x5'));var util=require(_0x9668('0x6'));var path=require('path');var sox=require(_0x9668('0x7'));var csv=require(_0x9668('0x8'));var ejs=require(_0x9668('0x9'));var fs=require('fs');var _=require(_0x9668('0xa'));var squel=require(_0x9668('0xb'));var crypto=require(_0x9668('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9668('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9668('0xe'));var Redis=require(_0x9668('0xf'));var authService=require(_0x9668('0x10'));var qs=require(_0x9668('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9668('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x9668('0x13'));var config=require(_0x9668('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9668('0x15'))['db'];var dbH=require(_0x9668('0x15'))[_0x9668('0x16')];function respondWithStatusCode(_0x264021,_0x240e5c){_0x240e5c=_0x240e5c||0xcc;return function(_0x4d86fa){if(_0x4d86fa){return _0x264021[_0x9668('0x17')](_0x240e5c);}return _0x264021['status'](_0x240e5c)[_0x9668('0x18')]();};}function respondWithResult(_0x1c3dab,_0x407255){_0x407255=_0x407255||0xc8;return function(_0x2381e5){if(_0x2381e5){return _0x1c3dab[_0x9668('0x19')](_0x407255)[_0x9668('0x1a')](_0x2381e5);}};}function respondWithFilteredResult(_0x3d34bc,_0x2b4bd1){return function(_0x440578){if(_0x440578){var _0x1b9c71=_0x440578['count'],_0x22eedd=_0x2b4bd1[_0x9668('0x1b')],_0x2c5c04=_0x2b4bd1[_0x9668('0x1b')]+_0x2b4bd1[_0x9668('0x1c')],_0x1a1137;if(_0x2c5c04>=_0x1b9c71){_0x2c5c04=_0x1b9c71;_0x1a1137=0xc8;}else{_0x1a1137=0xce;}_0x3d34bc[_0x9668('0x19')](_0x1a1137);return _0x3d34bc[_0x9668('0x1d')](_0x9668('0x1e'),_0x22eedd+'-'+_0x2c5c04+'/'+_0x1b9c71)[_0x9668('0x1a')](_0x440578);}return null;};}function patchUpdates(_0x418e29){return function(_0x4736cd){try{jsonpatch[_0x9668('0x1f')](_0x4736cd,_0x418e29,!![]);}catch(_0x47749d){return BPromise[_0x9668('0x20')](_0x47749d);}return _0x4736cd[_0x9668('0x21')]();};}function saveUpdates(_0x4bc783,_0x450207){return function(_0xe4d9d0){if(_0xe4d9d0){return _0xe4d9d0['update'](_0x4bc783)['then'](function(_0x40c49c){return _0x40c49c;});}return null;};}function removeEntity(_0x35fa67,_0x5128d3){return function(_0x203a0d){if(_0x203a0d){return _0x203a0d['destroy']()[_0x9668('0x22')](function(){var _0x26732c=_0x203a0d['get']({'plain':!![]});var _0x2be1a8=_0x9668('0x23');return db['UserProfileResource'][_0x9668('0x24')]({'where':{'type':_0x2be1a8,'resourceId':_0x26732c['id']}})[_0x9668('0x22')](function(){return _0x203a0d;});})[_0x9668('0x22')](function(){_0x35fa67[_0x9668('0x19')](0xcc)[_0x9668('0x18')]();});}};}function handleEntityNotFound(_0x122a27,_0x37fce3){return function(_0x4c8fb4){if(!_0x4c8fb4){_0x122a27[_0x9668('0x17')](0x194);}return _0x4c8fb4;};}function handleError(_0x270b4b,_0x4d353e){_0x4d353e=_0x4d353e||0x1f4;return function(_0x5acc16){logger[_0x9668('0x25')](_0x5acc16[_0x9668('0x26')]);if(_0x5acc16[_0x9668('0x27')]){delete _0x5acc16['name'];}_0x270b4b[_0x9668('0x19')](_0x4d353e)[_0x9668('0x28')](_0x5acc16);};}exports['index']=function(_0x341e3c,_0x219e9c){var _0x501263={},_0x1df39d={},_0x5ec38a={'count':0x0,'rows':[]};var _0x376962=_[_0x9668('0x29')](db[_0x9668('0x2a')][_0x9668('0x2b')],function(_0x217583){return{'name':_0x217583[_0x9668('0x2c')],'type':_0x217583[_0x9668('0x2d')][_0x9668('0x2e')]};});_0x1df39d[_0x9668('0x2f')]=_[_0x9668('0x29')](_0x376962,_0x9668('0x27'));_0x1df39d[_0x9668('0x30')]=_[_0x9668('0x31')](_0x341e3c[_0x9668('0x30')]);_0x1df39d[_0x9668('0x32')]=_[_0x9668('0x33')](_0x1df39d[_0x9668('0x2f')],_0x1df39d['query']);_0x501263[_0x9668('0x34')]=_[_0x9668('0x33')](_0x1df39d[_0x9668('0x2f')],qs[_0x9668('0x35')](_0x341e3c[_0x9668('0x30')][_0x9668('0x35')]));_0x501263[_0x9668('0x34')]=_0x501263[_0x9668('0x34')][_0x9668('0x36')]?_0x501263[_0x9668('0x34')]:_0x1df39d[_0x9668('0x2f')];if(!_0x341e3c[_0x9668('0x30')]['hasOwnProperty']('nolimit')){_0x501263['limit']=qs[_0x9668('0x1c')](_0x341e3c[_0x9668('0x30')][_0x9668('0x1c')]);_0x501263[_0x9668('0x1b')]=qs[_0x9668('0x1b')](_0x341e3c['query'][_0x9668('0x1b')]);}_0x501263[_0x9668('0x37')]=qs[_0x9668('0x38')](_0x341e3c['query'][_0x9668('0x38')]);_0x501263['where']=qs[_0x9668('0x32')](_['pick'](_0x341e3c['query'],_0x1df39d[_0x9668('0x32')]),_0x376962);if(_0x341e3c[_0x9668('0x30')][_0x9668('0x39')]){_0x501263['where']=_[_0x9668('0x3a')](_0x501263[_0x9668('0x3b')],{'$or':_[_0x9668('0x29')](_0x376962,function(_0x25b05a){if(_0x25b05a[_0x9668('0x2d')]!==_0x9668('0x3c')){var _0x122ace={};_0x122ace[_0x25b05a[_0x9668('0x27')]]={'$like':'%'+_0x341e3c[_0x9668('0x30')][_0x9668('0x39')]+'%'};return _0x122ace;}})});}_0x501263=_[_0x9668('0x3a')]({},_0x501263,_0x341e3c[_0x9668('0x3d')]);var _0x506165={'where':_0x501263[_0x9668('0x3b')]};return db['AnalyticDefaultReport'][_0x9668('0x3e')](_0x506165)[_0x9668('0x22')](function(_0x4ee3fd){_0x5ec38a[_0x9668('0x3e')]=_0x4ee3fd;if(_0x341e3c[_0x9668('0x30')][_0x9668('0x3f')]){_0x501263['include']=[{'all':!![]}];}return db[_0x9668('0x2a')][_0x9668('0x40')](_0x501263);})['then'](function(_0x5511bc){_0x5ec38a['rows']=_0x5511bc;return _0x5ec38a;})[_0x9668('0x22')](respondWithFilteredResult(_0x219e9c,_0x501263))['catch'](handleError(_0x219e9c,null));};exports[_0x9668('0x41')]=function(_0x3ace60,_0x4eb812){var _0x1b4472={'raw':!![],'where':{'id':_0x3ace60[_0x9668('0x42')]['id']}},_0x196a07={};_0x196a07[_0x9668('0x2f')]=_[_0x9668('0x31')](db[_0x9668('0x2a')]['rawAttributes']);_0x196a07[_0x9668('0x30')]=_['keys'](_0x3ace60['query']);_0x196a07[_0x9668('0x32')]=_[_0x9668('0x33')](_0x196a07['model'],_0x196a07['query']);_0x1b4472[_0x9668('0x34')]=_[_0x9668('0x33')](_0x196a07['model'],qs[_0x9668('0x35')](_0x3ace60[_0x9668('0x30')]['fields']));_0x1b4472[_0x9668('0x34')]=_0x1b4472['attributes'][_0x9668('0x36')]?_0x1b4472[_0x9668('0x34')]:_0x196a07[_0x9668('0x2f')];if(_0x3ace60[_0x9668('0x30')][_0x9668('0x3f')]){_0x1b4472[_0x9668('0x43')]=[{'all':!![]}];}_0x1b4472=_[_0x9668('0x3a')]({},_0x1b4472,_0x3ace60[_0x9668('0x3d')]);return db[_0x9668('0x2a')][_0x9668('0x44')](_0x1b4472)[_0x9668('0x22')](handleEntityNotFound(_0x4eb812,null))[_0x9668('0x22')](respondWithResult(_0x4eb812,null))[_0x9668('0x45')](handleError(_0x4eb812,null));};exports[_0x9668('0x46')]=function(_0x1a05cb,_0xe5bab3){return db['AnalyticDefaultReport']['create'](_0x1a05cb[_0x9668('0x47')],{})[_0x9668('0x22')](function(_0x210327){var _0x11be3d=_0x1a05cb[_0x9668('0x48')]['get']({'plain':!![]});if(!_0x11be3d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x11be3d['role']===_0x9668('0x48')){var _0x498ae3=_0x210327[_0x9668('0x49')]({'plain':!![]});var _0x5b29e3=_0x9668('0x4a');return db[_0x9668('0x4b')]['find']({'where':{'name':_0x5b29e3,'userProfileId':_0x11be3d[_0x9668('0x4c')]},'raw':!![]})[_0x9668('0x22')](function(_0x3c769c){if(_0x3c769c&&_0x3c769c[_0x9668('0x4d')]===0x0){return db[_0x9668('0x4e')][_0x9668('0x46')]({'name':_0x498ae3['name'],'resourceId':_0x498ae3['id'],'type':'DefaultReports','sectionId':_0x3c769c['id']},{})[_0x9668('0x22')](function(){return _0x210327;});}else{return _0x210327;}})['catch'](function(_0xe449d2){logger[_0x9668('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe449d2);throw _0xe449d2;});}return _0x210327;})[_0x9668('0x22')](respondWithResult(_0xe5bab3,0xc9))['catch'](handleError(_0xe5bab3,null));};exports['update']=function(_0xc6d32c,_0x27c89b){if(_0xc6d32c[_0x9668('0x47')]['id']){delete _0xc6d32c[_0x9668('0x47')]['id'];}return db[_0x9668('0x2a')][_0x9668('0x44')]({'where':{'id':_0xc6d32c[_0x9668('0x42')]['id']}})[_0x9668('0x22')](handleEntityNotFound(_0x27c89b,null))[_0x9668('0x22')](saveUpdates(_0xc6d32c[_0x9668('0x47')],null))[_0x9668('0x22')](respondWithResult(_0x27c89b,null))['catch'](handleError(_0x27c89b,null));};exports[_0x9668('0x24')]=function(_0x326b5f,_0x1a1bd2){return db[_0x9668('0x2a')]['find']({'where':{'id':_0x326b5f[_0x9668('0x42')]['id']}})['then'](handleEntityNotFound(_0x1a1bd2,null))[_0x9668('0x22')](removeEntity(_0x1a1bd2,null))[_0x9668('0x45')](handleError(_0x1a1bd2,null));};exports[_0x9668('0x4f')]=function(_0xc675e0,_0x5359b6){var _0x820e45=0xa;var _0x5c59f7=[_0x9668('0x50'),'left_join',_0x9668('0x51'),_0x9668('0x52')];var _0x15dd61={'SUM':_0x9668('0x53'),'COUNT':_0x9668('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9668('0x55'),'MIN':_0x9668('0x56'),'AVG':_0x9668('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x9668('0x58'),'GROUP_CONCAT DESC':_0x9668('0x59')};var _0xa2da5e={'SEC_TO_TIME':_0x9668('0x5a'),'DATE':_0x9668('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x9668('0x5c'),'UNIX_TIMESTAMP':_0x9668('0x5d')};var _0xf5d8dc=function(_0x2837cc){return!_[_0x9668('0x5e')]([_0x9668('0x5f'),_0x9668('0x60'),'IS\x20EMPTY',_0x9668('0x61')],_0x2837cc);};var _0x3587d1=function(_0x4e9715){if(!_0x4e9715||!_0x4e9715[_0x9668('0x62')][_0x9668('0x36')]){return'';}for(var _0x24a9fe='(',_0x1fb1e4=0x0;_0x1fb1e4<_0x4e9715['rules'][_0x9668('0x36')];_0x1fb1e4+=0x1){_0x1fb1e4>0x0&&(_0x24a9fe+='\x20'+_0x4e9715[_0x9668('0x63')]+'\x20');_0x24a9fe+=_0x4e9715['rules'][_0x1fb1e4]['group']?_0x3587d1(_0x4e9715['rules'][_0x1fb1e4][_0x9668('0x64')]):_0x4e9715[_0x9668('0x62')][_0x1fb1e4]['field']+'\x20'+_0x4e9715['rules'][_0x1fb1e4]['condition']+(_0xf5d8dc(_0x4e9715['rules'][_0x1fb1e4][_0x9668('0x65')])?'\x20'+_0x4e9715[_0x9668('0x62')][_0x1fb1e4]['value']:'');}return _0x24a9fe+')';};var _0x347dfb={'where':{'id':_0xc675e0[_0x9668('0x42')]['id']}},_0x3c2a9b,_0x58a84f,_0x1fd320,_0x3d72e1,_0x38c893;_0x347dfb=_[_0x9668('0x3a')]({},_0x347dfb,_0xc675e0[_0x9668('0x3d')]);return db[_0x9668('0x2a')][_0x9668('0x44')](_0x347dfb)[_0x9668('0x22')](function(_0x8c0ff5){if(_0x8c0ff5){_0x3c2a9b=_0x8c0ff5;return _0x8c0ff5[_0x9668('0x66')]();}return null;})[_0x9668('0x22')](function(_0x536508){if(_0x536508){if(!_0x536508[_0x9668('0x36')]){throw new db['Sequelize'][(_0x9668('0x67'))](_0x9668('0x68'),0x193);}_0x58a84f=_0x536508;return db[_0x9668('0x69')][_0x9668('0x40')]({'raw':!![]});}return null;})[_0x9668('0x22')](function(_0x4cff77){if(_0x4cff77){_0x1fd320=_['keyBy'](_0x4cff77,'id');var _0x3295ee;var _0x433af5=squel['select']();_0x433af5['from'](_0x3c2a9b[_0x9668('0x6a')]);for(var _0x58a628=0x0;_0x58a628<_0x58a84f[_0x9668('0x36')];_0x58a628+=0x1){_0x3295ee=_0x58a84f[_0x58a628][_0x9668('0x6b')]?_0x1fd320[_0x58a84f[_0x58a628][_0x9668('0x6b')]][_0x9668('0x6c')]:_0x58a84f[_0x58a628][_0x9668('0x6d')];_0x3295ee=_0x58a84f[_0x58a628]['function']?_[_0x9668('0x6e')](_0x15dd61[_0x58a84f[_0x58a628][_0x9668('0x6f')]],'%s',_0x3295ee):_0x3295ee;_0x3295ee=_0x58a84f[_0x58a628][_0x9668('0x70')]?_['replace'](_0xa2da5e[_0x58a84f[_0x58a628][_0x9668('0x70')]],'%s',_0x3295ee):_0x3295ee;if(_0x58a84f[_0x58a628][_0x9668('0x71')]){_0x433af5[_0x9668('0x64')](_0x3295ee);}_0x58a84f[_0x58a628][_0x9668('0x72')]&&_0x433af5[_0x9668('0x37')](_0x3295ee,_0x58a84f[_0x58a628][_0x9668('0x72')]===_0x9668('0x73')?![]:!![]);_0x433af5[_0x9668('0x6d')](_0x3295ee,_0x58a84f[_0x58a628][_0x9668('0x74')]||_0x3295ee);}if(_0x3c2a9b[_0x9668('0x75')]){_0x3c2a9b['joins']=JSON[_0x9668('0x76')](_0x3c2a9b[_0x9668('0x75')]);for(var _0x52a6c1=0x0;_0x52a6c1<_0x3c2a9b[_0x9668('0x75')][_0x9668('0x36')];_0x52a6c1+=0x1){if(_0x3c2a9b[_0x9668('0x75')][_0x52a6c1][_0x9668('0x2d')]&&_[_0x9668('0x5e')](_0x5c59f7,_0x3c2a9b['joins'][_0x52a6c1]['type'])&&_0x3c2a9b['joins'][_0x52a6c1][_0x9668('0x77')]&&_0x3c2a9b[_0x9668('0x75')][_0x52a6c1][_0x9668('0x78')]&&_0x3c2a9b[_0x9668('0x75')][_0x52a6c1][_0x9668('0x79')]){_0x433af5[_0x3c2a9b['joins'][_0x52a6c1][_0x9668('0x2d')]](_0x3c2a9b[_0x9668('0x75')][_0x52a6c1][_0x9668('0x78')],null,util[_0x9668('0x70')](_0x9668('0x7a'),_0x3c2a9b[_0x9668('0x6a')],_0x3c2a9b[_0x9668('0x75')][_0x52a6c1][_0x9668('0x77')],_0x3c2a9b[_0x9668('0x75')][_0x52a6c1]['foreignTable'],_0x3c2a9b[_0x9668('0x75')][_0x52a6c1]['foreignKey']));}}}if(_0x3c2a9b[_0x9668('0x7b')]){_0x3c2a9b[_0x9668('0x7b')]=JSON[_0x9668('0x76')](_0x3c2a9b[_0x9668('0x7b')]);_0x433af5[_0x9668('0x3b')](_0x3587d1(_0x3c2a9b[_0x9668('0x7b')][_0x9668('0x64')]));}_0x38c893=_0x433af5[_0x9668('0x7c')]();_0x433af5[_0x9668('0x1c')](_0x820e45);_0x433af5[_0x9668('0x1b')](0x0);logger['debug']('Limited\x20Query:',_0x433af5[_0x9668('0x7d')]());return dbH['sequelize'][_0x9668('0x30')](_0x433af5[_0x9668('0x7d')](),{'type':dbH[_0x9668('0x7e')][_0x9668('0x7f')][_0x9668('0x80')]});}})[_0x9668('0x22')](respondWithResult(_0x5359b6,null))[_0x9668('0x45')](handleError(_0x5359b6,null));};function runReport(_0x37b436,_0x296994,_0x524001){var _0x12c66d=_0x296994[_0x9668('0x27')];var _0x36ad23=0xa;var _0x36b2bd=['join','left_join',_0x9668('0x51'),_0x9668('0x52')];var _0x425201={'SUM':_0x9668('0x53'),'COUNT':_0x9668('0x54'),'COUNT DISTINCT':_0x9668('0x81'),'MAX':_0x9668('0x55'),'MIN':_0x9668('0x56'),'AVG':_0x9668('0x57'),'GROUP_CONCAT':_0x9668('0x82'),'GROUP_CONCAT ASC':_0x9668('0x58'),'GROUP_CONCAT DESC':_0x9668('0x59')};var _0x3b0dc6={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9668('0x5b'),'HOUR':_0x9668('0x83'),'ROUND':_0x9668('0x5c'),'UNIX_TIMESTAMP':_0x9668('0x5d')};var _0x2d691c=function(_0x5a3302){return!_['includes']([_0x9668('0x5f'),'IS\x20NOT\x20NULL',_0x9668('0x84'),_0x9668('0x61')],_0x5a3302);};var _0x21542b=function(_0x37abf4){if(!_0x37abf4||!_0x37abf4[_0x9668('0x62')][_0x9668('0x36')]){return'';}for(var _0x30b3b7='(',_0x53dfc3=0x0;_0x53dfc3<_0x37abf4['rules']['length'];_0x53dfc3+=0x1){_0x53dfc3>0x0&&(_0x30b3b7+='\x20'+_0x37abf4[_0x9668('0x63')]+'\x20');_0x30b3b7+=_0x37abf4[_0x9668('0x62')][_0x53dfc3][_0x9668('0x64')]?_0x21542b(_0x37abf4[_0x9668('0x62')][_0x53dfc3][_0x9668('0x64')]):_0x37abf4[_0x9668('0x62')][_0x53dfc3]['field']+'\x20'+_0x37abf4[_0x9668('0x62')][_0x53dfc3]['condition']+(_0x2d691c(_0x37abf4[_0x9668('0x62')][_0x53dfc3]['condition'])?'\x20'+_0x37abf4[_0x9668('0x62')][_0x53dfc3][_0x9668('0x85')]:'');}return _0x30b3b7+')';};var _0x43a15b={'where':{'id':_0x37b436['id']}},_0x54f423,_0x61bdfc,_0x5c4069,_0x5b466c,_0x27129f;_0x43a15b=_['merge']({},_0x43a15b,_0x524001);return db[_0x9668('0x2a')][_0x9668('0x44')](_0x43a15b)['then'](function(_0x3f19e5){if(_0x3f19e5){_0x54f423=_0x3f19e5;return _0x3f19e5[_0x9668('0x66')]();}return null;})['then'](function(_0x432877){if(_0x432877){if(!_0x432877['length']){throw new db['Sequelize'][(_0x9668('0x67'))](_0x9668('0x68'),0x193);}_0x61bdfc=_0x432877;return db['AnalyticMetric'][_0x9668('0x40')]({'raw':!![]});}return null;})[_0x9668('0x22')](function(_0x3ee343){if(_0x3ee343){_0x5c4069=_[_0x9668('0x86')](_0x3ee343,'id');var _0x417f54;var _0x1ad48b=squel[_0x9668('0x87')]();_0x1ad48b[_0x9668('0x88')](_0x54f423[_0x9668('0x6a')]);for(var _0x4306af=0x0;_0x4306af<_0x61bdfc['length'];_0x4306af+=0x1){_0x417f54=_0x61bdfc[_0x4306af][_0x9668('0x6b')]?_0x5c4069[_0x61bdfc[_0x4306af][_0x9668('0x6b')]][_0x9668('0x6c')]:_0x61bdfc[_0x4306af][_0x9668('0x6d')];_0x417f54=_0x61bdfc[_0x4306af][_0x9668('0x6f')]?_[_0x9668('0x6e')](_0x425201[_0x61bdfc[_0x4306af][_0x9668('0x6f')]],'%s',_0x417f54):_0x417f54;_0x417f54=_0x61bdfc[_0x4306af]['format']?_[_0x9668('0x6e')](_0x3b0dc6[_0x61bdfc[_0x4306af][_0x9668('0x70')]],'%s',_0x417f54):_0x417f54;if(_0x61bdfc[_0x4306af][_0x9668('0x71')]){_0x1ad48b[_0x9668('0x64')](_0x417f54);}_0x61bdfc[_0x4306af][_0x9668('0x72')]&&_0x1ad48b[_0x9668('0x37')](_0x417f54,_0x61bdfc[_0x4306af][_0x9668('0x72')]===_0x9668('0x73')?![]:!![]);_0x1ad48b[_0x9668('0x6d')](_0x417f54,_0x61bdfc[_0x4306af][_0x9668('0x74')]||_0x417f54);}if(_0x54f423[_0x9668('0x75')]){_0x54f423['joins']=JSON[_0x9668('0x76')](_0x54f423[_0x9668('0x75')]);for(var _0x22aa39=0x0;_0x22aa39<_0x54f423['joins'][_0x9668('0x36')];_0x22aa39+=0x1){if(_0x54f423[_0x9668('0x75')][_0x22aa39][_0x9668('0x2d')]&&_['includes'](_0x36b2bd,_0x54f423[_0x9668('0x75')][_0x22aa39][_0x9668('0x2d')])&&_0x54f423[_0x9668('0x75')][_0x22aa39]['parentKey']&&_0x54f423['joins'][_0x22aa39][_0x9668('0x78')]&&_0x54f423[_0x9668('0x75')][_0x22aa39]['foreignKey']){_0x1ad48b[_0x54f423['joins'][_0x22aa39]['type']](_0x54f423['joins'][_0x22aa39]['foreignTable'],null,util[_0x9668('0x70')](_0x9668('0x7a'),_0x54f423[_0x9668('0x6a')],_0x54f423['joins'][_0x22aa39][_0x9668('0x77')],_0x54f423[_0x9668('0x75')][_0x22aa39][_0x9668('0x78')],_0x54f423[_0x9668('0x75')][_0x22aa39]['foreignKey']));}}}if(_0x54f423[_0x9668('0x7b')]){_0x54f423['conditions']=JSON[_0x9668('0x76')](_0x54f423[_0x9668('0x7b')]);_0x1ad48b[_0x9668('0x3b')](_0x21542b(_0x54f423[_0x9668('0x7b')][_0x9668('0x64')]));}_0x27129f=_0x1ad48b[_0x9668('0x7c')]();_0x1ad48b[_0x9668('0x1c')](_0x36ad23);_0x1ad48b[_0x9668('0x1b')](0x0);return;}})[_0x9668('0x22')](function(){if(_0x296994[_0x9668('0x89')]===_0x9668('0x8a')){return null;}var _0x1e17e4=_['merge'](_0x296994,{'name':_0x296994[_0x9668('0x8b')]||_0x296994[_0x9668('0x27')]||_0x54f423['name'],'basename':_0x12c66d,'savename':util[_0x9668('0x70')](_0x9668('0x8c'),_0x296994[_0x9668('0x27')]||_0x54f423[_0x9668('0x27')],require('randomstring')['generate'](0x4),_0x296994[_0x9668('0x89')]||'csv'),'reportId':_0x54f423['id'],'reportType':_0x9668('0x8d')});return db[_0x9668('0x8e')]['create'](_0x1e17e4,{'raw':!![]});})[_0x9668('0x22')](function(_0x2d936b){if(_0x54f423[_0x9668('0x6a')]==='cdr'){_0x27129f['where'](_0x54f423[_0x9668('0x6a')]+_0x9668('0x8f'),_0x296994[_0x9668('0x90')],_0x296994[_0x9668('0x91')]);}else{_0x27129f['where'](_0x54f423[_0x9668('0x6a')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x296994[_0x9668('0x90')],_0x296994[_0x9668('0x91')]);}if(_0x2d936b){logger[_0x9668('0x92')](_0x9668('0x93'),_0x27129f[_0x9668('0x7d')]());require('child_process')[_0x9668('0x94')](path[_0x9668('0x50')](__dirname,'../../components/export/',_0x2d936b['output']),[_0x2d936b['id'],_0x27129f['toString'](),path['join'](__dirname,_0x9668('0x95'),_0x2d936b[_0x9668('0x96')]),_0x12c66d]);return _0x2d936b;}else{var _0x42a0da=squel[_0x9668('0x87')]();_0x42a0da['from']('('+_0x27129f[_0x9668('0x7d')]()+')',_0x9668('0x97'));_0x42a0da[_0x9668('0x6d')]('COUNT(*)',_0x9668('0x3e'));_0x27129f['limit'](_0x296994[_0x9668('0x1c')]||_0x36ad23);_0x27129f[_0x9668('0x1b')](_0x296994['offset']||0x0);return dbH[_0x9668('0x7e')][_0x9668('0x30')](_0x42a0da[_0x9668('0x7d')](),{'type':dbH[_0x9668('0x7e')][_0x9668('0x7f')]['SELECT']})[_0x9668('0x22')](function(_0x1b46f5){if(!_0x1b46f5[_0x9668('0x36')]){_0x5b466c=0x0;}else{_0x5b466c=_0x1b46f5[0x0][_0x9668('0x3e')]||0x0;}return dbH[_0x9668('0x7e')][_0x9668('0x30')](_0x27129f[_0x9668('0x7d')](),{'type':dbH['sequelize'][_0x9668('0x7f')][_0x9668('0x80')]});})['then'](function(_0xc402eb){return{'rows':_0xc402eb||[],'count':_0x5b466c};});}});}exports[_0x9668('0x98')]=function(_0x50874b,_0x4d3093){return runReport(_0x50874b[_0x9668('0x42')],_0x50874b[_0x9668('0x30')],_0x50874b[_0x9668('0x3d')])['then'](respondWithResult(_0x4d3093,null))[_0x9668('0x45')](handleError(_0x4d3093,null));};exports['runReport']=runReport;exports['query']=function(_0x132963,_0x20ec5a){var _0x524cf9=0xa;var _0x48670e=[_0x9668('0x50'),'left_join','right_join',_0x9668('0x52')];var _0x2514ae={'SUM':'SUM(%s)','COUNT':_0x9668('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9668('0x55'),'MIN':'MIN(%s)','AVG':_0x9668('0x57'),'GROUP_CONCAT':_0x9668('0x82'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9668('0x59')};var _0x49a126={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9668('0x5b'),'HOUR':_0x9668('0x83'),'ROUND':_0x9668('0x5c'),'UNIX_TIMESTAMP':_0x9668('0x5d')};var _0x599034=function(_0x162224){return!_[_0x9668('0x5e')]([_0x9668('0x5f'),_0x9668('0x60'),_0x9668('0x84'),_0x9668('0x61')],_0x162224);};var _0x2af22c=function(_0xf658d5){if(!_0xf658d5||!_0xf658d5[_0x9668('0x62')]['length']){return'';}for(var _0x226b2b='(',_0x2aa75c=0x0;_0x2aa75c<_0xf658d5['rules'][_0x9668('0x36')];_0x2aa75c+=0x1){_0x2aa75c>0x0&&(_0x226b2b+='\x20'+_0xf658d5['operator']+'\x20');_0x226b2b+=_0xf658d5[_0x9668('0x62')][_0x2aa75c][_0x9668('0x64')]?_0x2af22c(_0xf658d5[_0x9668('0x62')][_0x2aa75c][_0x9668('0x64')]):_0xf658d5['rules'][_0x2aa75c][_0x9668('0x6d')]+'\x20'+_0xf658d5[_0x9668('0x62')][_0x2aa75c][_0x9668('0x65')]+(_0x599034(_0xf658d5[_0x9668('0x62')][_0x2aa75c][_0x9668('0x65')])?'\x20'+_0xf658d5[_0x9668('0x62')][_0x2aa75c][_0x9668('0x85')]:'');}return _0x226b2b+')';};var _0x46312d={'where':{'id':_0x132963[_0x9668('0x42')]['id']}},_0x6417b1,_0x34c86e,_0x40b7c4,_0x40d819,_0x41f130;_0x46312d=_[_0x9668('0x3a')]({},_0x46312d,_0x132963[_0x9668('0x3d')]);return db[_0x9668('0x2a')][_0x9668('0x44')](_0x46312d)[_0x9668('0x22')](function(_0x167497){if(_0x167497){_0x6417b1=_0x167497;return _0x167497[_0x9668('0x66')]();}return null;})['then'](function(_0x5d5b7d){if(_0x5d5b7d){if(!_0x5d5b7d[_0x9668('0x36')]){throw new db[(_0x9668('0x99'))][(_0x9668('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x34c86e=_0x5d5b7d;return db[_0x9668('0x69')][_0x9668('0x40')]({'raw':!![]});}return null;})['then'](function(_0x48c26b){if(_0x48c26b){_0x40b7c4=_[_0x9668('0x86')](_0x48c26b,'id');var _0x4da4da;var _0x41283e=squel[_0x9668('0x87')]();_0x41283e[_0x9668('0x88')](_0x6417b1['table']);for(var _0x4c1013=0x0;_0x4c1013<_0x34c86e['length'];_0x4c1013+=0x1){_0x4da4da=_0x34c86e[_0x4c1013][_0x9668('0x6b')]?_0x40b7c4[_0x34c86e[_0x4c1013][_0x9668('0x6b')]][_0x9668('0x6c')]:_0x34c86e[_0x4c1013][_0x9668('0x6d')];_0x4da4da=_0x34c86e[_0x4c1013][_0x9668('0x6f')]?_['replace'](_0x2514ae[_0x34c86e[_0x4c1013][_0x9668('0x6f')]],'%s',_0x4da4da):_0x4da4da;_0x4da4da=_0x34c86e[_0x4c1013][_0x9668('0x70')]?_[_0x9668('0x6e')](_0x49a126[_0x34c86e[_0x4c1013]['format']],'%s',_0x4da4da):_0x4da4da;if(_0x34c86e[_0x4c1013][_0x9668('0x71')]){_0x41283e[_0x9668('0x64')](_0x4da4da);}_0x34c86e[_0x4c1013][_0x9668('0x72')]&&_0x41283e[_0x9668('0x37')](_0x4da4da,_0x34c86e[_0x4c1013][_0x9668('0x72')]===_0x9668('0x73')?![]:!![]);_0x41283e[_0x9668('0x6d')](_0x4da4da,_0x34c86e[_0x4c1013]['alias']||_0x4da4da);}if(_0x6417b1[_0x9668('0x75')]){_0x6417b1[_0x9668('0x75')]=JSON['parse'](_0x6417b1[_0x9668('0x75')]);for(var _0x3e7a96=0x0;_0x3e7a96<_0x6417b1[_0x9668('0x75')]['length'];_0x3e7a96+=0x1){if(_0x6417b1[_0x9668('0x75')][_0x3e7a96]['type']&&_[_0x9668('0x5e')](_0x48670e,_0x6417b1[_0x9668('0x75')][_0x3e7a96][_0x9668('0x2d')])&&_0x6417b1[_0x9668('0x75')][_0x3e7a96][_0x9668('0x77')]&&_0x6417b1['joins'][_0x3e7a96]['foreignTable']&&_0x6417b1[_0x9668('0x75')][_0x3e7a96][_0x9668('0x79')]){_0x41283e[_0x6417b1[_0x9668('0x75')][_0x3e7a96]['type']](_0x6417b1[_0x9668('0x75')][_0x3e7a96][_0x9668('0x78')],null,util[_0x9668('0x70')]('%s.%s\x20=\x20%s.%s',_0x6417b1['table'],_0x6417b1[_0x9668('0x75')][_0x3e7a96][_0x9668('0x77')],_0x6417b1[_0x9668('0x75')][_0x3e7a96][_0x9668('0x78')],_0x6417b1[_0x9668('0x75')][_0x3e7a96][_0x9668('0x79')]));}}}if(_0x6417b1[_0x9668('0x7b')]){_0x6417b1[_0x9668('0x7b')]=JSON[_0x9668('0x76')](_0x6417b1[_0x9668('0x7b')]);_0x41283e[_0x9668('0x3b')](_0x2af22c(_0x6417b1[_0x9668('0x7b')][_0x9668('0x64')]));}_0x41f130=_0x41283e['clone']();_0x41283e[_0x9668('0x1c')](_0x524cf9);_0x41283e[_0x9668('0x1b')](0x0);logger[_0x9668('0x9a')](_0x9668('0x9b'),_0x41283e[_0x9668('0x7d')]());return dbH[_0x9668('0x7e')][_0x9668('0x30')](_0x41283e[_0x9668('0x7d')](),{'type':dbH[_0x9668('0x7e')][_0x9668('0x7f')]['SELECT']});}})[_0x9668('0x22')](function(){return{'sql':_0x41f130[_0x9668('0x7d')]()};})['then'](respondWithResult(_0x20ec5a,null))['catch'](handleError(_0x20ec5a,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 206640c..f5e80c6 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 _0x81c9=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports'];(function(_0x4a1e75,_0x3fd6bc){var _0x33868d=function(_0x48af0){while(--_0x48af0){_0x4a1e75['push'](_0x4a1e75['shift']());}};_0x33868d(++_0x3fd6bc);}(_0x81c9,0xf7));var _0x981c=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x81c9[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0x981c('0x0'));var util=require(_0x981c('0x1'));var logger=require(_0x981c('0x2'))(_0x981c('0x3'));var moment=require(_0x981c('0x4'));var BPromise=require(_0x981c('0x5'));var rp=require(_0x981c('0x6'));var fs=require('fs');var path=require(_0x981c('0x7'));var rimraf=require('rimraf');var config=require(_0x981c('0x8'));var attributes=require(_0x981c('0x9'));module[_0x981c('0xa')]=function(_0x21d3ca,_0x1ed49c){return _0x21d3ca['define'](_0x981c('0xb'),attributes,{'tableName':_0x981c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e5b=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define'];(function(_0x1d9620,_0x3576ea){var _0x41f68e=function(_0x116181){while(--_0x116181){_0x1d9620['push'](_0x1d9620['shift']());}};_0x41f68e(++_0x3576ea);}(_0x5e5b,0x113));var _0xb5e5=function(_0x1bc2a8,_0x22d0f7){_0x1bc2a8=_0x1bc2a8-0x0;var _0x5d62f3=_0x5e5b[_0x1bc2a8];return _0x5d62f3;};'use strict';var _=require(_0xb5e5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb5e5('0x1'));var moment=require(_0xb5e5('0x2'));var BPromise=require(_0xb5e5('0x3'));var rp=require(_0xb5e5('0x4'));var fs=require('fs');var path=require(_0xb5e5('0x5'));var rimraf=require(_0xb5e5('0x6'));var config=require(_0xb5e5('0x7'));var attributes=require(_0xb5e5('0x8'));module[_0xb5e5('0x9')]=function(_0x747bc7,_0x2e07a3){return _0x747bc7[_0xb5e5('0xa')]('AnalyticDefaultReport',attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index a444dcc..205ac0d 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 _0xd5b6=['jayson/promise','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x350667,_0x1f1d12){var _0x76abd3=function(_0x596716){while(--_0x596716){_0x350667['push'](_0x350667['shift']());}};_0x76abd3(++_0x1f1d12);}(_0xd5b6,0x73));var _0x6d5b=function(_0x9b3ae2,_0x44179e){_0x9b3ae2=_0x9b3ae2-0x0;var _0x791d45=_0xd5b6[_0x9b3ae2];return _0x791d45;};'use strict';var _=require(_0x6d5b('0x0'));var util=require(_0x6d5b('0x1'));var moment=require(_0x6d5b('0x2'));var BPromise=require(_0x6d5b('0x3'));var rs=require(_0x6d5b('0x4'));var fs=require('fs');var Redis=require(_0x6d5b('0x5'));var db=require(_0x6d5b('0x6'))['db'];var utils=require(_0x6d5b('0x7'));var logger=require('../../config/logger')(_0x6d5b('0x8'));var config=require(_0x6d5b('0x9'));var jayson=require(_0x6d5b('0xa'));var client=jayson['client'][_0x6d5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e722d,_0x1e6d0e,_0x3cdc91){return new BPromise(function(_0x5b57cb,_0x5351ee){return client[_0x6d5b('0xc')](_0x3e722d,_0x3cdc91)[_0x6d5b('0xd')](function(_0x1947e5){logger[_0x6d5b('0xe')](_0x6d5b('0xf'),_0x1e6d0e,_0x6d5b('0x10'));logger[_0x6d5b('0x11')](_0x6d5b('0x12'),_0x1e6d0e,_0x6d5b('0x10'),JSON[_0x6d5b('0x13')](_0x1947e5));if(_0x1947e5[_0x6d5b('0x14')]){if(_0x1947e5[_0x6d5b('0x14')][_0x6d5b('0x15')]===0x1f4){logger[_0x6d5b('0x14')](_0x6d5b('0xf'),_0x1e6d0e,_0x1947e5[_0x6d5b('0x14')][_0x6d5b('0x16')]);return _0x5351ee(_0x1947e5[_0x6d5b('0x14')]['message']);}logger[_0x6d5b('0x14')](_0x6d5b('0xf'),_0x1e6d0e,_0x1947e5[_0x6d5b('0x14')][_0x6d5b('0x16')]);return _0x5b57cb(_0x1947e5[_0x6d5b('0x14')]['message']);}else{logger[_0x6d5b('0xe')](_0x6d5b('0xf'),_0x1e6d0e,'request\x20sent');_0x5b57cb(_0x1947e5[_0x6d5b('0x17')]['message']);}})[_0x6d5b('0x18')](function(_0x4dfd99){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x1e6d0e,_0x4dfd99);_0x5351ee(_0x4dfd99);});});} \ No newline at end of file +var _0xd7a0=['message','AnalyticDefaultReport,\x20%s,\x20%s','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xd7a0,0x163));var _0x0d7a=function(_0x5e76ec,_0x560f3d){_0x5e76ec=_0x5e76ec-0x0;var _0x3511b6=_0xd7a0[_0x5e76ec];return _0x3511b6;};'use strict';var _=require(_0x0d7a('0x0'));var util=require(_0x0d7a('0x1'));var moment=require('moment');var BPromise=require(_0x0d7a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d7a('0x3'));var db=require(_0x0d7a('0x4'))['db'];var utils=require(_0x0d7a('0x5'));var logger=require(_0x0d7a('0x6'))(_0x0d7a('0x7'));var config=require('../../config/environment');var jayson=require(_0x0d7a('0x8'));var client=jayson[_0x0d7a('0x9')][_0x0d7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16461e,_0x22b404,_0x371b7d){return new BPromise(function(_0x1514ae,_0x55d585){return client[_0x0d7a('0xb')](_0x16461e,_0x371b7d)[_0x0d7a('0xc')](function(_0x450d42){logger[_0x0d7a('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x22b404,_0x0d7a('0xe'));logger[_0x0d7a('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x22b404,_0x0d7a('0xe'),JSON[_0x0d7a('0x10')](_0x450d42));if(_0x450d42[_0x0d7a('0x11')]){if(_0x450d42[_0x0d7a('0x11')][_0x0d7a('0x12')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x22b404,_0x450d42[_0x0d7a('0x11')][_0x0d7a('0x13')]);return _0x55d585(_0x450d42[_0x0d7a('0x11')]['message']);}logger[_0x0d7a('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x22b404,_0x450d42['error'][_0x0d7a('0x13')]);return _0x1514ae(_0x450d42['error'][_0x0d7a('0x13')]);}else{logger[_0x0d7a('0xd')](_0x0d7a('0x14'),_0x22b404,_0x0d7a('0xe'));_0x1514ae(_0x450d42['result'][_0x0d7a('0x13')]);}})[_0x0d7a('0x15')](function(_0x497cbb){logger[_0x0d7a('0x11')](_0x0d7a('0x14'),_0x22b404,_0x497cbb);_0x55d585(_0x497cbb);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 9b18edf..5226d6a 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 _0xb488=['destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','isAuthenticated','index','/:id','show','get','/:id/preview','/:id/run','run','query','post','create','put','update','delete'];(function(_0x3edf96,_0x11e492){var _0x128e0e=function(_0x2db51f){while(--_0x2db51f){_0x3edf96['push'](_0x3edf96['shift']());}};_0x128e0e(++_0x11e492);}(_0xb488,0x1d0));var _0x8b48=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xb488[_0x4565bf];return _0x5610ba;};'use strict';var multer=require('multer');var util=require(_0x8b48('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8b48('0x1'));var router=express[_0x8b48('0x2')]();var auth=require(_0x8b48('0x3'));var interaction=require(_0x8b48('0x4'));var config=require('../../config/environment');var controller=require(_0x8b48('0x5'));router['get']('/',auth[_0x8b48('0x6')](),controller[_0x8b48('0x7')]);router['get'](_0x8b48('0x8'),auth[_0x8b48('0x6')](),controller[_0x8b48('0x9')]);router[_0x8b48('0xa')](_0x8b48('0xb'),auth['isAuthenticated'](),controller['preview']);router[_0x8b48('0xa')](_0x8b48('0xc'),auth[_0x8b48('0x6')](),controller[_0x8b48('0xd')]);router[_0x8b48('0xa')]('/:id/query',auth[_0x8b48('0x6')](),controller[_0x8b48('0xe')]);router[_0x8b48('0xf')]('/',auth['isAuthenticated'](),controller[_0x8b48('0x10')]);router[_0x8b48('0x11')](_0x8b48('0x8'),auth['isAuthenticated'](),controller[_0x8b48('0x12')]);router[_0x8b48('0x13')]('/:id',auth[_0x8b48('0x6')](),controller[_0x8b48('0x14')]);module[_0x8b48('0x15')]=router; \ No newline at end of file +var _0x0118=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','query','post','put','update','delete','destroy'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x0118,0xfe));var _0x8011=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0118[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x8011('0x0'));var path=require(_0x8011('0x1'));var timeout=require(_0x8011('0x2'));var express=require(_0x8011('0x3'));var router=express[_0x8011('0x4')]();var auth=require(_0x8011('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8011('0x6'));var controller=require(_0x8011('0x7'));router[_0x8011('0x8')]('/',auth[_0x8011('0x9')](),controller[_0x8011('0xa')]);router['get'](_0x8011('0xb'),auth['isAuthenticated'](),controller[_0x8011('0xc')]);router[_0x8011('0x8')](_0x8011('0xd'),auth[_0x8011('0x9')](),controller[_0x8011('0xe')]);router[_0x8011('0x8')]('/:id/run',auth[_0x8011('0x9')](),controller[_0x8011('0xf')]);router[_0x8011('0x8')]('/:id/query',auth[_0x8011('0x9')](),controller[_0x8011('0x10')]);router[_0x8011('0x11')]('/',auth[_0x8011('0x9')](),controller['create']);router[_0x8011('0x12')](_0x8011('0xb'),auth['isAuthenticated'](),controller[_0x8011('0x13')]);router[_0x8011('0x14')](_0x8011('0xb'),auth[_0x8011('0x9')](),controller[_0x8011('0x15')]);module[_0x8011('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 d4fa3a3..f4b8d70 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 _0x54b1=['UNSIGNED','sequelize','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','scheduled','INTEGER'];(function(_0x36ffab,_0x45010a){var _0x1afc6c=function(_0x460a7a){while(--_0x460a7a){_0x36ffab['push'](_0x36ffab['shift']());}};_0x1afc6c(++_0x45010a);}(_0x54b1,0x11f));var _0x154b=function(_0x47b4dc,_0xc337ee){_0x47b4dc=_0x47b4dc-0x0;var _0x2d134d=_0x54b1[_0x47b4dc];return _0x2d134d;};'use strict';var Sequelize=require(_0x154b('0x0'));var moment=require('moment');module[_0x154b('0x1')]={'name':{'type':Sequelize[_0x154b('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x154b('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x154b('0x3')](_0x154b('0x4'),_0x154b('0x5'),_0x154b('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x154b('0x7')]},'status':{'type':Sequelize[_0x154b('0x2')],'defaultValue':_0x154b('0x8')},'type':{'type':Sequelize[_0x154b('0x3')](_0x154b('0x9'),_0x154b('0xa')),'allowNull':![],'defaultValue':_0x154b('0x9')},'reportId':{'type':Sequelize[_0x154b('0xb')](0xb)[_0x154b('0xc')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfd27=['STRING','csv','pdf','DATE','Loading','ENUM','manual','scheduled','INTEGER','UNSIGNED','exports'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xfd27,0xf1));var _0x7fd2=function(_0x36f69c,_0x27e693){_0x36f69c=_0x36f69c-0x0;var _0x1add64=_0xfd27[_0x36f69c];return _0x1add64;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x7fd2('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x7fd2('0x1')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x7fd2('0x2'),_0x7fd2('0x3'),'xlsx'),'allowNull':![],'defaultValue':_0x7fd2('0x2')},'savename':{'type':Sequelize[_0x7fd2('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x7fd2('0x4')]},'endDate':{'type':Sequelize[_0x7fd2('0x4')]},'status':{'type':Sequelize[_0x7fd2('0x1')],'defaultValue':_0x7fd2('0x5')},'type':{'type':Sequelize[_0x7fd2('0x6')](_0x7fd2('0x7'),_0x7fd2('0x8')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x7fd2('0x9')](0xb)[_0x7fd2('0xa')]},'reportType':{'type':Sequelize[_0x7fd2('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 2899e7d..cf0aba7 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 _0xaee7=['key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','savename','output','existsSync','join','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','basename','toLowerCase','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','ExtractedReports','UserProfileResource','destroy','sendStatus','error','name','send','index','map','AnalyticExtractedReport','fieldName'];(function(_0x20056a,_0x177c80){var _0x425b83=function(_0x4ed52b){while(--_0x4ed52b){_0x20056a['push'](_0x20056a['shift']());}};_0x425b83(++_0x177c80);}(_0xaee7,0x95));var _0x7aee=function(_0x262099,_0x5ba72a){_0x262099=_0x262099-0x0;var _0x3850b0=_0xaee7[_0x262099];return _0x3850b0;};'use strict';var pdf=require(_0x7aee('0x0'));var emlformat=require(_0x7aee('0x1'));var rimraf=require(_0x7aee('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7aee('0x3'));var rp=require('request-promise');var moment=require(_0x7aee('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7aee('0x5'));var util=require(_0x7aee('0x6'));var path=require('path');var sox=require(_0x7aee('0x7'));var csv=require(_0x7aee('0x8'));var ejs=require(_0x7aee('0x9'));var fs=require('fs');var _=require(_0x7aee('0xa'));var squel=require(_0x7aee('0xb'));var crypto=require(_0x7aee('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7aee('0xd'));var toCsv=require(_0x7aee('0x8'));var querystring=require(_0x7aee('0xe'));var Papa=require(_0x7aee('0xf'));var Redis=require(_0x7aee('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7aee('0x11'));var as=require(_0x7aee('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7aee('0x13'));var utils=require(_0x7aee('0x14'));var config=require(_0x7aee('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7aee('0x16'))['db'];function respondWithStatusCode(_0x5f0647,_0x30bf85){_0x30bf85=_0x30bf85||0xcc;return function(_0x9f64a2){if(_0x9f64a2){return _0x5f0647['sendStatus'](_0x30bf85);}return _0x5f0647[_0x7aee('0x17')](_0x30bf85)[_0x7aee('0x18')]();};}function respondWithResult(_0x4e5746,_0x4efa3d){_0x4efa3d=_0x4efa3d||0xc8;return function(_0x5e1e68){if(_0x5e1e68){return _0x4e5746[_0x7aee('0x17')](_0x4efa3d)[_0x7aee('0x19')](_0x5e1e68);}};}function respondWithFilteredResult(_0x27e393,_0x2b4647){return function(_0xd460d9){if(_0xd460d9){var _0x4cf088=_0xd460d9[_0x7aee('0x1a')],_0x36d0f4=_0x2b4647[_0x7aee('0x1b')],_0x3762e8=_0x2b4647[_0x7aee('0x1b')]+_0x2b4647[_0x7aee('0x1c')],_0x4bef65;if(_0x3762e8>=_0x4cf088){_0x3762e8=_0x4cf088;_0x4bef65=0xc8;}else{_0x4bef65=0xce;}_0x27e393['status'](_0x4bef65);return _0x27e393[_0x7aee('0x1d')](_0x7aee('0x1e'),_0x36d0f4+'-'+_0x3762e8+'/'+_0x4cf088)['json'](_0xd460d9);}return null;};}function patchUpdates(_0x2f7a50){return function(_0x3426eb){try{jsonpatch[_0x7aee('0x1f')](_0x3426eb,_0x2f7a50,!![]);}catch(_0xf270dc){return BPromise[_0x7aee('0x20')](_0xf270dc);}return _0x3426eb[_0x7aee('0x21')]();};}function saveUpdates(_0x31457b,_0x55f062){return function(_0x1d9145){if(_0x1d9145){return _0x1d9145[_0x7aee('0x22')](_0x31457b)['then'](function(_0x5dac8a){return _0x5dac8a;});}return null;};}function removeEntity(_0x1a0d3a,_0x3f6b78){return function(_0x36950c){if(_0x36950c){return _0x36950c['destroy']()[_0x7aee('0x23')](function(){var _0x34f97d=_0x36950c['get']({'plain':!![]});var _0x2ff0db=_0x7aee('0x24');return db[_0x7aee('0x25')][_0x7aee('0x26')]({'where':{'type':_0x2ff0db,'resourceId':_0x34f97d['id']}})[_0x7aee('0x23')](function(){return _0x36950c;});})[_0x7aee('0x23')](function(){_0x1a0d3a[_0x7aee('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dbef6,_0x33adea){return function(_0x78d271){if(!_0x78d271){_0x3dbef6[_0x7aee('0x27')](0x194);}return _0x78d271;};}function handleError(_0x325a9f,_0x12bb22){_0x12bb22=_0x12bb22||0x1f4;return function(_0x6d1117){logger[_0x7aee('0x28')](_0x6d1117['stack']);if(_0x6d1117[_0x7aee('0x29')]){delete _0x6d1117[_0x7aee('0x29')];}_0x325a9f[_0x7aee('0x17')](_0x12bb22)[_0x7aee('0x2a')](_0x6d1117);};}exports[_0x7aee('0x2b')]=function(_0x1a5914,_0x3b0060){var _0x3bc86e={},_0x46fca2={},_0x142320={'count':0x0,'rows':[]};var _0x391eaa=_[_0x7aee('0x2c')](db[_0x7aee('0x2d')]['rawAttributes'],function(_0x128dc2){return{'name':_0x128dc2[_0x7aee('0x2e')],'type':_0x128dc2['type'][_0x7aee('0x2f')]};});_0x46fca2[_0x7aee('0x30')]=_[_0x7aee('0x2c')](_0x391eaa,_0x7aee('0x29'));_0x46fca2[_0x7aee('0x31')]=_[_0x7aee('0x32')](_0x1a5914[_0x7aee('0x31')]);_0x46fca2[_0x7aee('0x33')]=_[_0x7aee('0x34')](_0x46fca2[_0x7aee('0x30')],_0x46fca2[_0x7aee('0x31')]);_0x3bc86e[_0x7aee('0x35')]=_[_0x7aee('0x34')](_0x46fca2[_0x7aee('0x30')],qs[_0x7aee('0x36')](_0x1a5914[_0x7aee('0x31')][_0x7aee('0x36')]));_0x3bc86e[_0x7aee('0x35')]=_0x3bc86e[_0x7aee('0x35')]['length']?_0x3bc86e[_0x7aee('0x35')]:_0x46fca2[_0x7aee('0x30')];if(!_0x1a5914[_0x7aee('0x31')][_0x7aee('0x37')](_0x7aee('0x38'))){_0x3bc86e[_0x7aee('0x1c')]=qs[_0x7aee('0x1c')](_0x1a5914['query'][_0x7aee('0x1c')]);_0x3bc86e[_0x7aee('0x1b')]=qs[_0x7aee('0x1b')](_0x1a5914[_0x7aee('0x31')][_0x7aee('0x1b')]);}_0x3bc86e[_0x7aee('0x39')]=qs[_0x7aee('0x3a')](_0x1a5914['query'][_0x7aee('0x3a')]);_0x3bc86e[_0x7aee('0x3b')]=qs['filters'](_['pick'](_0x1a5914[_0x7aee('0x31')],_0x46fca2[_0x7aee('0x33')]),_0x391eaa);if(_0x1a5914[_0x7aee('0x31')][_0x7aee('0x3c')]){_0x3bc86e[_0x7aee('0x3b')]=_[_0x7aee('0x3d')](_0x3bc86e[_0x7aee('0x3b')],{'$or':_[_0x7aee('0x2c')](_0x391eaa,function(_0x53811c){if(_0x53811c[_0x7aee('0x3e')]!==_0x7aee('0x3f')){var _0x8a9994={};_0x8a9994[_0x53811c[_0x7aee('0x29')]]={'$like':'%'+_0x1a5914[_0x7aee('0x31')][_0x7aee('0x3c')]+'%'};return _0x8a9994;}})});}_0x3bc86e=_['merge']({},_0x3bc86e,_0x1a5914[_0x7aee('0x40')]);var _0x338ba7={'where':_0x3bc86e[_0x7aee('0x3b')]};return db['AnalyticExtractedReport']['count'](_0x338ba7)[_0x7aee('0x23')](function(_0x337dba){_0x142320[_0x7aee('0x1a')]=_0x337dba;if(_0x1a5914[_0x7aee('0x31')][_0x7aee('0x41')]){_0x3bc86e['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x7aee('0x42')](_0x3bc86e);})[_0x7aee('0x23')](function(_0x1d8342){_0x142320[_0x7aee('0x43')]=_0x1d8342;return _0x142320;})['then'](respondWithFilteredResult(_0x3b0060,_0x3bc86e))[_0x7aee('0x44')](handleError(_0x3b0060,null));};exports[_0x7aee('0x45')]=function(_0x24ae1e,_0x1aeaf9){var _0x4d5075={'raw':!![],'where':{'id':_0x24ae1e[_0x7aee('0x46')]['id']}},_0x459b3e={};_0x459b3e[_0x7aee('0x30')]=_[_0x7aee('0x32')](db['AnalyticExtractedReport'][_0x7aee('0x47')]);_0x459b3e[_0x7aee('0x31')]=_['keys'](_0x24ae1e['query']);_0x459b3e[_0x7aee('0x33')]=_[_0x7aee('0x34')](_0x459b3e[_0x7aee('0x30')],_0x459b3e['query']);_0x4d5075[_0x7aee('0x35')]=_[_0x7aee('0x34')](_0x459b3e[_0x7aee('0x30')],qs[_0x7aee('0x36')](_0x24ae1e[_0x7aee('0x31')][_0x7aee('0x36')]));_0x4d5075['attributes']=_0x4d5075[_0x7aee('0x35')][_0x7aee('0x48')]?_0x4d5075[_0x7aee('0x35')]:_0x459b3e['model'];if(_0x24ae1e[_0x7aee('0x31')]['includeAll']){_0x4d5075[_0x7aee('0x49')]=[{'all':!![]}];}_0x4d5075=_[_0x7aee('0x3d')]({},_0x4d5075,_0x24ae1e[_0x7aee('0x40')]);return db[_0x7aee('0x2d')]['find'](_0x4d5075)[_0x7aee('0x23')](handleEntityNotFound(_0x1aeaf9,null))['then'](respondWithResult(_0x1aeaf9,null))['catch'](handleError(_0x1aeaf9,null));};exports['create']=function(_0x30ff44,_0x464e89){return db[_0x7aee('0x2d')]['create'](_0x30ff44['body'],{})[_0x7aee('0x23')](function(_0x28a41d){var _0x540cce=_0x30ff44['user'][_0x7aee('0x4a')]({'plain':!![]});if(!_0x540cce)throw new Error(_0x7aee('0x4b'));if(_0x540cce[_0x7aee('0x4c')]===_0x7aee('0x4d')){var _0x144835=_0x28a41d[_0x7aee('0x4a')]({'plain':!![]});var _0x12c680=_0x7aee('0x24');return db[_0x7aee('0x4e')][_0x7aee('0x4f')]({'where':{'name':_0x12c680,'userProfileId':_0x540cce['userProfileId']},'raw':!![]})['then'](function(_0x56d09d){if(_0x56d09d&&_0x56d09d[_0x7aee('0x50')]===0x0){return db['UserProfileResource'][_0x7aee('0x51')]({'name':_0x144835['name'],'resourceId':_0x144835['id'],'type':_0x56d09d[_0x7aee('0x29')],'sectionId':_0x56d09d['id']},{})['then'](function(){return _0x28a41d;});}else{return _0x28a41d;}})['catch'](function(_0x4d148c){logger['error'](_0x7aee('0x52'),_0x4d148c);throw _0x4d148c;});}return _0x28a41d;})[_0x7aee('0x23')](respondWithResult(_0x464e89,0xc9))['catch'](handleError(_0x464e89,null));};exports[_0x7aee('0x22')]=function(_0x4669d2,_0x46d9f1){if(_0x4669d2['body']['id']){delete _0x4669d2[_0x7aee('0x53')]['id'];}return db[_0x7aee('0x2d')][_0x7aee('0x4f')]({'where':{'id':_0x4669d2[_0x7aee('0x46')]['id']}})['then'](handleEntityNotFound(_0x46d9f1,null))[_0x7aee('0x23')](saveUpdates(_0x4669d2['body'],null))['then'](respondWithResult(_0x46d9f1,null))[_0x7aee('0x44')](handleError(_0x46d9f1,null));};exports[_0x7aee('0x26')]=function(_0x36f657,_0x4e40ef){return db['AnalyticExtractedReport'][_0x7aee('0x4f')]({'where':{'id':_0x36f657[_0x7aee('0x46')]['id']}})['then'](handleEntityNotFound(_0x4e40ef,null))[_0x7aee('0x23')](removeEntity(_0x4e40ef,null))[_0x7aee('0x44')](handleError(_0x4e40ef,null));};exports[_0x7aee('0x54')]=function(_0x1b0192,_0x3b68cb,_0x142089){return db[_0x7aee('0x2d')][_0x7aee('0x4f')]({'where':{'id':_0x1b0192['params']['id']},'attributes':[_0x7aee('0x29'),'basename',_0x7aee('0x55'),_0x7aee('0x56')],'raw':!![]})[_0x7aee('0x23')](handleEntityNotFound(_0x3b68cb,null))[_0x7aee('0x23')](function(_0x246c56){if(_0x246c56){if(!fs[_0x7aee('0x57')](path[_0x7aee('0x58')](config[_0x7aee('0x59')],_0x7aee('0x5a'),_0x246c56[_0x7aee('0x55')]))){throw new db['Sequelize'][(_0x7aee('0x5b'))](_0x7aee('0x5c'));}if(_0x1b0192[_0x7aee('0x31')][_0x7aee('0x5d')]){return _0x3b68cb[_0x7aee('0x27')](0xc8);}return _0x3b68cb['download'](path[_0x7aee('0x58')](config['root'],'server/files/reports',_0x246c56['savename']),util[_0x7aee('0x5e')](_0x7aee('0x5f'),_0x246c56[_0x7aee('0x60')]||_0x246c56[_0x7aee('0x29')],_0x246c56[_0x7aee('0x56')][_0x7aee('0x61')]()));}})['catch'](handleError(_0x3b68cb,null));}; \ No newline at end of file +var _0xdabe=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','count','includeAll','include','rows','catch','params','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','basename','savename','output','existsSync','root','server/files/reports','Report\x20not\x20found\x20or\x20empty','download','%s.%s','toLowerCase','eml-format','fast-json-patch','request-promise'];(function(_0x34d275,_0x5d84ee){var _0x1379cc=function(_0x320fbe){while(--_0x320fbe){_0x34d275['push'](_0x34d275['shift']());}};_0x1379cc(++_0x5d84ee);}(_0xdabe,0x17d));var _0xedab=function(_0x3a567b,_0x14c5ec){_0x3a567b=_0x3a567b-0x0;var _0x38c50c=_0xdabe[_0x3a567b];return _0x38c50c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xedab('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xedab('0x1'));var rp=require(_0xedab('0x2'));var moment=require(_0xedab('0x3'));var BPromise=require(_0xedab('0x4'));var Mustache=require(_0xedab('0x5'));var util=require(_0xedab('0x6'));var path=require(_0xedab('0x7'));var sox=require(_0xedab('0x8'));var csv=require(_0xedab('0x9'));var ejs=require(_0xedab('0xa'));var fs=require('fs');var _=require(_0xedab('0xb'));var squel=require(_0xedab('0xc'));var crypto=require(_0xedab('0xd'));var jsforce=require(_0xedab('0xe'));var deskjs=require(_0xedab('0xf'));var toCsv=require(_0xedab('0x9'));var querystring=require('querystring');var Papa=require(_0xedab('0x10'));var Redis=require(_0xedab('0x11'));var authService=require(_0xedab('0x12'));var qs=require(_0xedab('0x13'));var as=require(_0xedab('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xedab('0x15'))(_0xedab('0x16'));var utils=require(_0xedab('0x17'));var config=require(_0xedab('0x18'));var licenseUtil=require(_0xedab('0x19'));var db=require(_0xedab('0x1a'))['db'];function respondWithStatusCode(_0x4f37a9,_0x1a6635){_0x1a6635=_0x1a6635||0xcc;return function(_0x3253e5){if(_0x3253e5){return _0x4f37a9[_0xedab('0x1b')](_0x1a6635);}return _0x4f37a9['status'](_0x1a6635)[_0xedab('0x1c')]();};}function respondWithResult(_0x2c490d,_0x413303){_0x413303=_0x413303||0xc8;return function(_0x6bacd7){if(_0x6bacd7){return _0x2c490d[_0xedab('0x1d')](_0x413303)['json'](_0x6bacd7);}};}function respondWithFilteredResult(_0x562f5b,_0x3ff367){return function(_0x3ffab7){if(_0x3ffab7){var _0x8d9480=_0x3ffab7['count'],_0x27d18b=_0x3ff367[_0xedab('0x1e')],_0xa6d93a=_0x3ff367[_0xedab('0x1e')]+_0x3ff367[_0xedab('0x1f')],_0x7cb3de;if(_0xa6d93a>=_0x8d9480){_0xa6d93a=_0x8d9480;_0x7cb3de=0xc8;}else{_0x7cb3de=0xce;}_0x562f5b['status'](_0x7cb3de);return _0x562f5b[_0xedab('0x20')](_0xedab('0x21'),_0x27d18b+'-'+_0xa6d93a+'/'+_0x8d9480)[_0xedab('0x22')](_0x3ffab7);}return null;};}function patchUpdates(_0x2584e3){return function(_0x33cbe7){try{jsonpatch[_0xedab('0x23')](_0x33cbe7,_0x2584e3,!![]);}catch(_0x443015){return BPromise[_0xedab('0x24')](_0x443015);}return _0x33cbe7[_0xedab('0x25')]();};}function saveUpdates(_0x55f2bc,_0x434d3d){return function(_0x59090a){if(_0x59090a){return _0x59090a['update'](_0x55f2bc)[_0xedab('0x26')](function(_0x27b6ab){return _0x27b6ab;});}return null;};}function removeEntity(_0x28cc5f,_0x597704){return function(_0x1344bb){if(_0x1344bb){return _0x1344bb[_0xedab('0x27')]()['then'](function(){var _0x2af723=_0x1344bb[_0xedab('0x28')]({'plain':!![]});var _0x389154=_0xedab('0x29');return db[_0xedab('0x2a')][_0xedab('0x27')]({'where':{'type':_0x389154,'resourceId':_0x2af723['id']}})[_0xedab('0x26')](function(){return _0x1344bb;});})[_0xedab('0x26')](function(){_0x28cc5f[_0xedab('0x1d')](0xcc)[_0xedab('0x1c')]();});}};}function handleEntityNotFound(_0x11c7e4,_0x313775){return function(_0x1cfdf8){if(!_0x1cfdf8){_0x11c7e4[_0xedab('0x1b')](0x194);}return _0x1cfdf8;};}function handleError(_0x485f74,_0x36df49){_0x36df49=_0x36df49||0x1f4;return function(_0x4e34a4){logger[_0xedab('0x2b')](_0x4e34a4[_0xedab('0x2c')]);if(_0x4e34a4['name']){delete _0x4e34a4[_0xedab('0x2d')];}_0x485f74['status'](_0x36df49)['send'](_0x4e34a4);};}exports[_0xedab('0x2e')]=function(_0x15a4fd,_0x23c21d){var _0x1f8a81={},_0xf1c1d2={},_0x48d750={'count':0x0,'rows':[]};var _0x186a51=_[_0xedab('0x2f')](db[_0xedab('0x30')][_0xedab('0x31')],function(_0x3b6b88){return{'name':_0x3b6b88[_0xedab('0x32')],'type':_0x3b6b88[_0xedab('0x33')][_0xedab('0x34')]};});_0xf1c1d2[_0xedab('0x35')]=_[_0xedab('0x2f')](_0x186a51,_0xedab('0x2d'));_0xf1c1d2['query']=_[_0xedab('0x36')](_0x15a4fd[_0xedab('0x37')]);_0xf1c1d2[_0xedab('0x38')]=_[_0xedab('0x39')](_0xf1c1d2[_0xedab('0x35')],_0xf1c1d2[_0xedab('0x37')]);_0x1f8a81['attributes']=_['intersection'](_0xf1c1d2['model'],qs[_0xedab('0x3a')](_0x15a4fd[_0xedab('0x37')][_0xedab('0x3a')]));_0x1f8a81[_0xedab('0x3b')]=_0x1f8a81[_0xedab('0x3b')][_0xedab('0x3c')]?_0x1f8a81[_0xedab('0x3b')]:_0xf1c1d2['model'];if(!_0x15a4fd[_0xedab('0x37')][_0xedab('0x3d')](_0xedab('0x3e'))){_0x1f8a81['limit']=qs[_0xedab('0x1f')](_0x15a4fd[_0xedab('0x37')][_0xedab('0x1f')]);_0x1f8a81[_0xedab('0x1e')]=qs['offset'](_0x15a4fd['query'][_0xedab('0x1e')]);}_0x1f8a81[_0xedab('0x3f')]=qs['sort'](_0x15a4fd[_0xedab('0x37')]['sort']);_0x1f8a81[_0xedab('0x40')]=qs[_0xedab('0x38')](_[_0xedab('0x41')](_0x15a4fd[_0xedab('0x37')],_0xf1c1d2[_0xedab('0x38')]),_0x186a51);if(_0x15a4fd[_0xedab('0x37')][_0xedab('0x42')]){_0x1f8a81[_0xedab('0x40')]=_['merge'](_0x1f8a81[_0xedab('0x40')],{'$or':_['map'](_0x186a51,function(_0x187806){if(_0x187806[_0xedab('0x33')]!==_0xedab('0x43')){var _0x3a5abb={};_0x3a5abb[_0x187806[_0xedab('0x2d')]]={'$like':'%'+_0x15a4fd[_0xedab('0x37')][_0xedab('0x42')]+'%'};return _0x3a5abb;}})});}_0x1f8a81=_['merge']({},_0x1f8a81,_0x15a4fd['options']);var _0xaa68ae={'where':_0x1f8a81['where']};return db[_0xedab('0x30')][_0xedab('0x44')](_0xaa68ae)[_0xedab('0x26')](function(_0x2dc63f){_0x48d750['count']=_0x2dc63f;if(_0x15a4fd[_0xedab('0x37')][_0xedab('0x45')]){_0x1f8a81[_0xedab('0x46')]=[{'all':!![]}];}return db[_0xedab('0x30')]['findAll'](_0x1f8a81);})['then'](function(_0x4ba61d){_0x48d750[_0xedab('0x47')]=_0x4ba61d;return _0x48d750;})[_0xedab('0x26')](respondWithFilteredResult(_0x23c21d,_0x1f8a81))[_0xedab('0x48')](handleError(_0x23c21d,null));};exports['show']=function(_0x1e9a8a,_0x166308){var _0x6327be={'raw':!![],'where':{'id':_0x1e9a8a[_0xedab('0x49')]['id']}},_0x512671={};_0x512671['model']=_[_0xedab('0x36')](db['AnalyticExtractedReport'][_0xedab('0x31')]);_0x512671[_0xedab('0x37')]=_['keys'](_0x1e9a8a['query']);_0x512671[_0xedab('0x38')]=_[_0xedab('0x39')](_0x512671[_0xedab('0x35')],_0x512671['query']);_0x6327be['attributes']=_['intersection'](_0x512671['model'],qs[_0xedab('0x3a')](_0x1e9a8a[_0xedab('0x37')]['fields']));_0x6327be[_0xedab('0x3b')]=_0x6327be[_0xedab('0x3b')][_0xedab('0x3c')]?_0x6327be[_0xedab('0x3b')]:_0x512671[_0xedab('0x35')];if(_0x1e9a8a[_0xedab('0x37')][_0xedab('0x45')]){_0x6327be[_0xedab('0x46')]=[{'all':!![]}];}_0x6327be=_[_0xedab('0x4a')]({},_0x6327be,_0x1e9a8a[_0xedab('0x4b')]);return db[_0xedab('0x30')][_0xedab('0x4c')](_0x6327be)[_0xedab('0x26')](handleEntityNotFound(_0x166308,null))['then'](respondWithResult(_0x166308,null))['catch'](handleError(_0x166308,null));};exports[_0xedab('0x4d')]=function(_0x33bfa9,_0x1d3737){return db['AnalyticExtractedReport'][_0xedab('0x4d')](_0x33bfa9['body'],{})['then'](function(_0x598e13){var _0x273882=_0x33bfa9[_0xedab('0x4e')][_0xedab('0x28')]({'plain':!![]});if(!_0x273882)throw new Error(_0xedab('0x4f'));if(_0x273882[_0xedab('0x50')]===_0xedab('0x4e')){var _0x4425f0=_0x598e13['get']({'plain':!![]});var _0x4a0b86=_0xedab('0x29');return db[_0xedab('0x51')][_0xedab('0x4c')]({'where':{'name':_0x4a0b86,'userProfileId':_0x273882[_0xedab('0x52')]},'raw':!![]})[_0xedab('0x26')](function(_0x6e53c5){if(_0x6e53c5&&_0x6e53c5['autoAssociation']===0x0){return db[_0xedab('0x2a')][_0xedab('0x4d')]({'name':_0x4425f0[_0xedab('0x2d')],'resourceId':_0x4425f0['id'],'type':_0x6e53c5[_0xedab('0x2d')],'sectionId':_0x6e53c5['id']},{})['then'](function(){return _0x598e13;});}else{return _0x598e13;}})[_0xedab('0x48')](function(_0x39ee05){logger[_0xedab('0x2b')](_0xedab('0x53'),_0x39ee05);throw _0x39ee05;});}return _0x598e13;})['then'](respondWithResult(_0x1d3737,0xc9))[_0xedab('0x48')](handleError(_0x1d3737,null));};exports[_0xedab('0x54')]=function(_0x1c2734,_0x1bb5aa){if(_0x1c2734['body']['id']){delete _0x1c2734[_0xedab('0x55')]['id'];}return db[_0xedab('0x30')][_0xedab('0x4c')]({'where':{'id':_0x1c2734['params']['id']}})['then'](handleEntityNotFound(_0x1bb5aa,null))['then'](saveUpdates(_0x1c2734[_0xedab('0x55')],null))[_0xedab('0x26')](respondWithResult(_0x1bb5aa,null))[_0xedab('0x48')](handleError(_0x1bb5aa,null));};exports[_0xedab('0x27')]=function(_0x13046a,_0x3734b9){return db[_0xedab('0x30')][_0xedab('0x4c')]({'where':{'id':_0x13046a['params']['id']}})[_0xedab('0x26')](handleEntityNotFound(_0x3734b9,null))['then'](removeEntity(_0x3734b9,null))[_0xedab('0x48')](handleError(_0x3734b9,null));};exports['download']=function(_0x1c8e59,_0x2cf1cf,_0x3c84bf){return db['AnalyticExtractedReport'][_0xedab('0x4c')]({'where':{'id':_0x1c8e59[_0xedab('0x49')]['id']},'attributes':[_0xedab('0x2d'),_0xedab('0x56'),_0xedab('0x57'),_0xedab('0x58')],'raw':!![]})[_0xedab('0x26')](handleEntityNotFound(_0x2cf1cf,null))[_0xedab('0x26')](function(_0xfc0717){if(_0xfc0717){if(!fs[_0xedab('0x59')](path['join'](config[_0xedab('0x5a')],_0xedab('0x5b'),_0xfc0717['savename']))){throw new db['Sequelize']['ValidationError'](_0xedab('0x5c'));}if(_0x1c8e59[_0xedab('0x37')]['exists']){return _0x2cf1cf[_0xedab('0x1b')](0xc8);}return _0x2cf1cf[_0xedab('0x5d')](path['join'](config['root'],_0xedab('0x5b'),_0xfc0717[_0xedab('0x57')]),util['format'](_0xedab('0x5e'),_0xfc0717[_0xedab('0x56')]||_0xfc0717[_0xedab('0x2d')],_0xfc0717[_0xedab('0x58')][_0xedab('0x5f')]()));}})[_0xedab('0x48')](handleError(_0x2cf1cf,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index e7aaf7e..573a460 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 _0x890e=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticExtractedReport.attributes','define'];(function(_0x33c3f0,_0x32f6de){var _0x240830=function(_0xeeef3c){while(--_0xeeef3c){_0x33c3f0['push'](_0x33c3f0['shift']());}};_0x240830(++_0x32f6de);}(_0x890e,0xe6));var _0xe890=function(_0x54f5dc,_0x154acb){_0x54f5dc=_0x54f5dc-0x0;var _0x174d40=_0x890e[_0x54f5dc];return _0x174d40;};'use strict';var _=require('lodash');var util=require(_0xe890('0x0'));var logger=require(_0xe890('0x1'))(_0xe890('0x2'));var moment=require(_0xe890('0x3'));var BPromise=require(_0xe890('0x4'));var rp=require(_0xe890('0x5'));var fs=require('fs');var path=require(_0xe890('0x6'));var rimraf=require(_0xe890('0x7'));var config=require('../../config/environment');var attributes=require(_0xe890('0x8'));module['exports']=function(_0x3d1aec,_0x2710d0){return _0x3d1aec[_0xe890('0x9')]('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x18c0=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','lodash'];(function(_0x46689e,_0xa61f8a){var _0x48f843=function(_0x31e952){while(--_0x31e952){_0x46689e['push'](_0x46689e['shift']());}};_0x48f843(++_0xa61f8a);}(_0x18c0,0xa7));var _0x018c=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x18c0[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x018c('0x0'));var util=require(_0x018c('0x1'));var logger=require(_0x018c('0x2'))('api');var moment=require(_0x018c('0x3'));var BPromise=require(_0x018c('0x4'));var rp=require(_0x018c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x018c('0x6'));var config=require(_0x018c('0x7'));var attributes=require(_0x018c('0x8'));module['exports']=function(_0x2befd0,_0x4c90c6){return _0x2befd0[_0x018c('0x9')](_0x018c('0xa'),attributes,{'tableName':_0x018c('0xb'),'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 06f953a..b1f4a26 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 _0xb849=['AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','AnalyticExtractedReport,\x20%s,\x20%s','debug'];(function(_0x56e51e,_0x3e7905){var _0x421b2a=function(_0x355f52){while(--_0x355f52){_0x56e51e['push'](_0x56e51e['shift']());}};_0x421b2a(++_0x3e7905);}(_0xb849,0x92));var _0x9b84=function(_0x2f0da3,_0xeeca16){_0x2f0da3=_0x2f0da3-0x0;var _0x872fd9=_0xb849[_0x2f0da3];return _0x872fd9;};'use strict';var _=require('lodash');var util=require(_0x9b84('0x0'));var moment=require(_0x9b84('0x1'));var BPromise=require(_0x9b84('0x2'));var rs=require(_0x9b84('0x3'));var fs=require('fs');var Redis=require(_0x9b84('0x4'));var db=require(_0x9b84('0x5'))['db'];var utils=require(_0x9b84('0x6'));var logger=require(_0x9b84('0x7'))(_0x9b84('0x8'));var config=require(_0x9b84('0x9'));var jayson=require(_0x9b84('0xa'));var client=jayson[_0x9b84('0xb')][_0x9b84('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ed871,_0x514f23,_0x222835){return new BPromise(function(_0x2f3cfc,_0x7a7408){return client['request'](_0x2ed871,_0x222835)['then'](function(_0x58753d){logger['info'](_0x9b84('0xd'),_0x514f23,'request\x20sent');logger[_0x9b84('0xe')](_0x9b84('0xf'),_0x514f23,_0x9b84('0x10'),JSON[_0x9b84('0x11')](_0x58753d));if(_0x58753d['error']){if(_0x58753d[_0x9b84('0x12')]['code']===0x1f4){logger[_0x9b84('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x514f23,_0x58753d[_0x9b84('0x12')][_0x9b84('0x13')]);return _0x7a7408(_0x58753d[_0x9b84('0x12')][_0x9b84('0x13')]);}logger[_0x9b84('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x514f23,_0x58753d[_0x9b84('0x12')]['message']);return _0x2f3cfc(_0x58753d['error'][_0x9b84('0x13')]);}else{logger[_0x9b84('0x14')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x514f23,'request\x20sent');_0x2f3cfc(_0x58753d[_0x9b84('0x15')][_0x9b84('0x13')]);}})[_0x9b84('0x16')](function(_0x3f8d8d){logger[_0x9b84('0x12')](_0x9b84('0xd'),_0x514f23,_0x3f8d8d);_0x7a7408(_0x3f8d8d);});});} \ No newline at end of file +var _0x6fc5=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','result'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6fc5,0x18c));var _0x56fc=function(_0x217b7b,_0x1cb732){_0x217b7b=_0x217b7b-0x0;var _0x232e92=_0x6fc5[_0x217b7b];return _0x232e92;};'use strict';var _=require(_0x56fc('0x0'));var util=require(_0x56fc('0x1'));var moment=require(_0x56fc('0x2'));var BPromise=require(_0x56fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x56fc('0x4'));var db=require(_0x56fc('0x5'))['db'];var utils=require(_0x56fc('0x6'));var logger=require(_0x56fc('0x7'))(_0x56fc('0x8'));var config=require('../../config/environment');var jayson=require(_0x56fc('0x9'));var client=jayson[_0x56fc('0xa')][_0x56fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc3a903,_0x1e4b0d,_0x2969ce){return new BPromise(function(_0x411f6e,_0x345f4d){return client['request'](_0xc3a903,_0x2969ce)[_0x56fc('0xc')](function(_0x244111){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1e4b0d,_0x56fc('0xd'));logger[_0x56fc('0xe')](_0x56fc('0xf'),_0x1e4b0d,_0x56fc('0xd'),JSON[_0x56fc('0x10')](_0x244111));if(_0x244111[_0x56fc('0x11')]){if(_0x244111[_0x56fc('0x11')][_0x56fc('0x12')]===0x1f4){logger['error'](_0x56fc('0x13'),_0x1e4b0d,_0x244111[_0x56fc('0x11')][_0x56fc('0x14')]);return _0x345f4d(_0x244111[_0x56fc('0x11')][_0x56fc('0x14')]);}logger[_0x56fc('0x11')](_0x56fc('0x13'),_0x1e4b0d,_0x244111[_0x56fc('0x11')][_0x56fc('0x14')]);return _0x411f6e(_0x244111['error'][_0x56fc('0x14')]);}else{logger['info'](_0x56fc('0x13'),_0x1e4b0d,_0x56fc('0xd'));_0x411f6e(_0x244111[_0x56fc('0x15')]['message']);}})['catch'](function(_0x1606cb){logger[_0x56fc('0x11')](_0x56fc('0x13'),_0x1e4b0d,_0x1606cb);_0x345f4d(_0x1606cb);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 1404c00..e720682 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 _0x4220=['Router','../../components/auth/service','../../components/interaction/service','get','index','/:id','show','isAuthenticated','download','create','put','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x4220,0xd4));var _0x0422=function(_0x203cd6,_0x1dff71){_0x203cd6=_0x203cd6-0x0;var _0x4dd940=_0x4220[_0x203cd6];return _0x4dd940;};'use strict';var multer=require('multer');var util=require(_0x0422('0x0'));var path=require(_0x0422('0x1'));var timeout=require(_0x0422('0x2'));var express=require(_0x0422('0x3'));var router=express[_0x0422('0x4')]();var auth=require(_0x0422('0x5'));var interaction=require(_0x0422('0x6'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0x0422('0x7')]('/',auth['isAuthenticated'](),controller[_0x0422('0x8')]);router[_0x0422('0x7')](_0x0422('0x9'),auth['isAuthenticated'](),controller[_0x0422('0xa')]);router[_0x0422('0x7')]('/:id/download',auth[_0x0422('0xb')](),controller[_0x0422('0xc')]);router['post']('/',auth[_0x0422('0xb')](),controller[_0x0422('0xd')]);router[_0x0422('0xe')](_0x0422('0x9'),auth[_0x0422('0xb')](),controller[_0x0422('0xf')]);router['delete'](_0x0422('0x9'),auth[_0x0422('0xb')](),controller[_0x0422('0x10')]);module[_0x0422('0x11')]=router; \ No newline at end of file +var _0xb068=['get','isAuthenticated','index','/:id','show','/:id/download','post','put','update','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller'];(function(_0x570361,_0x3d0066){var _0xa19529=function(_0x28c7a3){while(--_0x28c7a3){_0x570361['push'](_0x570361['shift']());}};_0xa19529(++_0x3d0066);}(_0xb068,0x119));var _0x8b06=function(_0x158264,_0x5e4924){_0x158264=_0x158264-0x0;var _0x1fc9f6=_0xb068[_0x158264];return _0x1fc9f6;};'use strict';var multer=require('multer');var util=require(_0x8b06('0x0'));var path=require('path');var timeout=require(_0x8b06('0x1'));var express=require(_0x8b06('0x2'));var router=express[_0x8b06('0x3')]();var auth=require(_0x8b06('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8b06('0x5'));var controller=require(_0x8b06('0x6'));router[_0x8b06('0x7')]('/',auth[_0x8b06('0x8')](),controller[_0x8b06('0x9')]);router['get'](_0x8b06('0xa'),auth[_0x8b06('0x8')](),controller[_0x8b06('0xb')]);router['get'](_0x8b06('0xc'),auth[_0x8b06('0x8')](),controller['download']);router[_0x8b06('0xd')]('/',auth[_0x8b06('0x8')](),controller['create']);router[_0x8b06('0xe')](_0x8b06('0xa'),auth[_0x8b06('0x8')](),controller[_0x8b06('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x8b06('0x10')]);module[_0x8b06('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index e7d43f1..f2de38d 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 _0x1261=['exports','TEXT','STRING','BOOLEAN'];(function(_0x4e23a7,_0x18ef13){var _0x3f56dc=function(_0x29df4e){while(--_0x29df4e){_0x4e23a7['push'](_0x4e23a7['shift']());}};_0x3f56dc(++_0x18ef13);}(_0x1261,0x144));var _0x1126=function(_0x3a2225,_0xb6600){_0x3a2225=_0x3a2225-0x0;var _0x5c8040=_0x1261[_0x3a2225];return _0x5c8040;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'field':{'type':Sequelize[_0x1126('0x1')]},'alias':{'type':Sequelize[_0x1126('0x2')]},'function':{'type':Sequelize[_0x1126('0x2')]},'format':{'type':Sequelize[_0x1126('0x2')]},'groupBy':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1126('0x2')]},'custom':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3f4b3e,_0x161ad3){var _0x1dd600=function(_0x42aab0){while(--_0x42aab0){_0x3f4b3e['push'](_0x3f4b3e['shift']());}};_0x1dd600(++_0x161ad3);}(_0x5fc3,0xa8));var _0x35fc=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x5fc3[_0xd0b415];return _0x2bdf2c;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x35fc('0x2')]},'function':{'type':Sequelize[_0x35fc('0x2')]},'format':{'type':Sequelize[_0x35fc('0x2')]},'groupBy':{'type':Sequelize[_0x35fc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x35fc('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 31d6d48..6d11ac3 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 _0x6078=['save','update','then','destroy','end','stack','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','merge','VIRTUAL','name','filter','options','include','findAll','catch','params','keys','includeAll','create','body','bulkCreate','find','bulkDestroy','ids','addFields','findOne','sequelize','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','set','Content-Range','apply','reject'];(function(_0x149083,_0x4047b6){var _0x4dc74e=function(_0x1211f9){while(--_0x1211f9){_0x149083['push'](_0x149083['shift']());}};_0x4dc74e(++_0x4047b6);}(_0x6078,0xcb));var _0x8607=function(_0x48572f,_0x579215){_0x48572f=_0x48572f-0x0;var _0x54f2bf=_0x6078[_0x48572f];return _0x54f2bf;};'use strict';var pdf=require(_0x8607('0x0'));var emlformat=require(_0x8607('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8607('0x2'));var jsonpatch=require(_0x8607('0x3'));var rp=require(_0x8607('0x4'));var moment=require(_0x8607('0x5'));var BPromise=require(_0x8607('0x6'));var Mustache=require(_0x8607('0x7'));var util=require(_0x8607('0x8'));var path=require(_0x8607('0x9'));var sox=require('sox');var csv=require(_0x8607('0xa'));var ejs=require(_0x8607('0xb'));var fs=require('fs');var _=require(_0x8607('0xc'));var squel=require(_0x8607('0xd'));var crypto=require(_0x8607('0xe'));var jsforce=require(_0x8607('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8607('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8607('0x10'));var authService=require(_0x8607('0x11'));var qs=require(_0x8607('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8607('0x13'));var logger=require(_0x8607('0x14'))(_0x8607('0x15'));var utils=require(_0x8607('0x16'));var config=require(_0x8607('0x17'));var licenseUtil=require(_0x8607('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e1bc2,_0x1dd065){_0x1dd065=_0x1dd065||0xcc;return function(_0x593688){if(_0x593688){return _0x3e1bc2[_0x8607('0x19')](_0x1dd065);}return _0x3e1bc2['status'](_0x1dd065)['end']();};}function respondWithResult(_0x498c55,_0x4f551a){_0x4f551a=_0x4f551a||0xc8;return function(_0x142a81){if(_0x142a81){return _0x498c55[_0x8607('0x1a')](_0x4f551a)[_0x8607('0x1b')](_0x142a81);}};}function respondWithFilteredResult(_0x4418db,_0x2cbbb7){return function(_0x1f2071){if(_0x1f2071){var _0x59065c=_0x1f2071[_0x8607('0x1c')],_0x32ff2c=_0x2cbbb7[_0x8607('0x1d')],_0x21db83=_0x2cbbb7[_0x8607('0x1d')]+_0x2cbbb7['limit'],_0x21f830;if(_0x21db83>=_0x59065c){_0x21db83=_0x59065c;_0x21f830=0xc8;}else{_0x21f830=0xce;}_0x4418db[_0x8607('0x1a')](_0x21f830);return _0x4418db[_0x8607('0x1e')](_0x8607('0x1f'),_0x32ff2c+'-'+_0x21db83+'/'+_0x59065c)[_0x8607('0x1b')](_0x1f2071);}return null;};}function patchUpdates(_0x4e8bc8){return function(_0x134c8d){try{jsonpatch[_0x8607('0x20')](_0x134c8d,_0x4e8bc8,!![]);}catch(_0x59833e){return BPromise[_0x8607('0x21')](_0x59833e);}return _0x134c8d[_0x8607('0x22')]();};}function saveUpdates(_0x3e718a,_0x2e1518){return function(_0x4e4145){if(_0x4e4145){return _0x4e4145[_0x8607('0x23')](_0x3e718a)[_0x8607('0x24')](function(_0x54ba8e){return _0x54ba8e;});}return null;};}function removeEntity(_0x281e41,_0x1e9251){return function(_0x3a8060){if(_0x3a8060){return _0x3a8060[_0x8607('0x25')]()[_0x8607('0x24')](function(){_0x281e41[_0x8607('0x1a')](0xcc)[_0x8607('0x26')]();});}};}function handleEntityNotFound(_0x2aeb6f,_0x9f0f3){return function(_0x4b463c){if(!_0x4b463c){_0x2aeb6f[_0x8607('0x19')](0x194);}return _0x4b463c;};}function handleError(_0x3b9191,_0xa570eb){_0xa570eb=_0xa570eb||0x1f4;return function(_0x4eb1d3){logger['error'](_0x4eb1d3[_0x8607('0x27')]);if(_0x4eb1d3['name']){delete _0x4eb1d3['name'];}_0x3b9191[_0x8607('0x1a')](_0xa570eb)['send'](_0x4eb1d3);};}exports[_0x8607('0x28')]=function(_0x4c5e06,_0x5c3d82){var _0x3d7541={},_0x13ed77={},_0x81092f={'count':0x0,'rows':[]};var _0x9c37b=_[_0x8607('0x29')](db[_0x8607('0x2a')][_0x8607('0x2b')],function(_0x22ea5a){return{'name':_0x22ea5a[_0x8607('0x2c')],'type':_0x22ea5a[_0x8607('0x2d')][_0x8607('0x2e')]};});_0x13ed77['model']=_[_0x8607('0x29')](_0x9c37b,'name');_0x13ed77[_0x8607('0x2f')]=_['keys'](_0x4c5e06[_0x8607('0x2f')]);_0x13ed77[_0x8607('0x30')]=_[_0x8607('0x31')](_0x13ed77[_0x8607('0x32')],_0x13ed77[_0x8607('0x2f')]);_0x3d7541[_0x8607('0x33')]=_[_0x8607('0x31')](_0x13ed77[_0x8607('0x32')],qs[_0x8607('0x34')](_0x4c5e06[_0x8607('0x2f')][_0x8607('0x34')]));_0x3d7541['attributes']=_0x3d7541['attributes'][_0x8607('0x35')]?_0x3d7541[_0x8607('0x33')]:_0x13ed77[_0x8607('0x32')];if(!_0x4c5e06[_0x8607('0x2f')][_0x8607('0x36')](_0x8607('0x37'))){_0x3d7541[_0x8607('0x38')]=qs[_0x8607('0x38')](_0x4c5e06[_0x8607('0x2f')][_0x8607('0x38')]);_0x3d7541[_0x8607('0x1d')]=qs[_0x8607('0x1d')](_0x4c5e06[_0x8607('0x2f')][_0x8607('0x1d')]);}_0x3d7541['order']=qs[_0x8607('0x39')](_0x4c5e06[_0x8607('0x2f')][_0x8607('0x39')]);_0x3d7541[_0x8607('0x3a')]=qs[_0x8607('0x30')](_['pick'](_0x4c5e06[_0x8607('0x2f')],_0x13ed77[_0x8607('0x30')]),_0x9c37b);if(_0x4c5e06[_0x8607('0x2f')]['filter']){_0x3d7541[_0x8607('0x3a')]=_[_0x8607('0x3b')](_0x3d7541['where'],{'$or':_[_0x8607('0x29')](_0x9c37b,function(_0x33f917){if(_0x33f917[_0x8607('0x2d')]!==_0x8607('0x3c')){var _0x22475f={};_0x22475f[_0x33f917[_0x8607('0x3d')]]={'$like':'%'+_0x4c5e06[_0x8607('0x2f')][_0x8607('0x3e')]+'%'};return _0x22475f;}})});}_0x3d7541=_['merge']({},_0x3d7541,_0x4c5e06[_0x8607('0x3f')]);var _0x981c29={'where':_0x3d7541[_0x8607('0x3a')]};return db[_0x8607('0x2a')][_0x8607('0x1c')](_0x981c29)[_0x8607('0x24')](function(_0x1e0431){_0x81092f['count']=_0x1e0431;if(_0x4c5e06[_0x8607('0x2f')]['includeAll']){_0x3d7541[_0x8607('0x40')]=[{'all':!![]}];}return db[_0x8607('0x2a')][_0x8607('0x41')](_0x3d7541);})[_0x8607('0x24')](function(_0x4dc2c5){_0x81092f['rows']=_0x4dc2c5;return _0x81092f;})[_0x8607('0x24')](respondWithFilteredResult(_0x5c3d82,_0x3d7541))[_0x8607('0x42')](handleError(_0x5c3d82,null));};exports['show']=function(_0x8ba16e,_0x3d568f){var _0x49615d={'raw':![],'where':{'id':_0x8ba16e[_0x8607('0x43')]['id']}},_0x1ec100={};_0x1ec100['model']=_[_0x8607('0x44')](db['AnalyticFieldReport']['rawAttributes']);_0x1ec100['query']=_[_0x8607('0x44')](_0x8ba16e[_0x8607('0x2f')]);_0x1ec100[_0x8607('0x30')]=_['intersection'](_0x1ec100['model'],_0x1ec100[_0x8607('0x2f')]);_0x49615d[_0x8607('0x33')]=_[_0x8607('0x31')](_0x1ec100[_0x8607('0x32')],qs[_0x8607('0x34')](_0x8ba16e[_0x8607('0x2f')][_0x8607('0x34')]));_0x49615d[_0x8607('0x33')]=_0x49615d[_0x8607('0x33')][_0x8607('0x35')]?_0x49615d[_0x8607('0x33')]:_0x1ec100['model'];if(_0x8ba16e[_0x8607('0x2f')][_0x8607('0x45')]){_0x49615d[_0x8607('0x40')]=[{'all':!![]}];}_0x49615d=_[_0x8607('0x3b')]({},_0x49615d,_0x8ba16e[_0x8607('0x3f')]);return db[_0x8607('0x2a')]['find'](_0x49615d)[_0x8607('0x24')](handleEntityNotFound(_0x3d568f,null))[_0x8607('0x24')](respondWithResult(_0x3d568f,null))['catch'](handleError(_0x3d568f,null));};exports[_0x8607('0x46')]=function(_0xd92601,_0x4dc474){return db[_0x8607('0x2a')][_0x8607('0x46')](_0xd92601[_0x8607('0x47')],{})[_0x8607('0x24')](respondWithResult(_0x4dc474,0xc9))[_0x8607('0x42')](handleError(_0x4dc474,null));};exports[_0x8607('0x48')]=function(_0x518ecc,_0x380a1a){return db['AnalyticFieldReport'][_0x8607('0x48')](_0x518ecc[_0x8607('0x47')],{'raw':![],'individualHooks':!![]})[_0x8607('0x24')](respondWithResult(_0x380a1a,0xc9))[_0x8607('0x42')](handleError(_0x380a1a,null));};exports['update']=function(_0x368cfb,_0x40467c){if(_0x368cfb[_0x8607('0x47')]['id']){delete _0x368cfb[_0x8607('0x47')]['id'];}return db['AnalyticFieldReport'][_0x8607('0x49')]({'where':{'id':_0x368cfb['params']['id']}})[_0x8607('0x24')](handleEntityNotFound(_0x40467c,null))['then'](saveUpdates(_0x368cfb[_0x8607('0x47')],null))['then'](respondWithResult(_0x40467c,null))[_0x8607('0x42')](handleError(_0x40467c,null));};exports[_0x8607('0x25')]=function(_0x1425bf,_0x2d2133){return db['AnalyticFieldReport'][_0x8607('0x49')]({'where':{'id':_0x1425bf['params']['id']}})[_0x8607('0x24')](handleEntityNotFound(_0x2d2133,null))['then'](removeEntity(_0x2d2133,null))[_0x8607('0x42')](handleError(_0x2d2133,null));};exports[_0x8607('0x4a')]=function(_0x3778eb,_0x16e24a){return db[_0x8607('0x2a')][_0x8607('0x25')]({'where':{'id':_0x3778eb[_0x8607('0x2f')][_0x8607('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x8607('0x24')](respondWithResult(_0x16e24a,0xcc))[_0x8607('0x42')](handleError(_0x16e24a,null));};exports[_0x8607('0x4c')]=function(_0x58b403,_0x2a5821,_0x4dc071){return db['AnalyticCustomReport'][_0x8607('0x4d')]({'where':{'id':_0x58b403['params']['id']}})[_0x8607('0x24')](handleEntityNotFound(_0x2a5821,null))[_0x8607('0x24')](function(_0x539ba2){if(_0x539ba2){return db[_0x8607('0x4e')]['transaction'](function(_0x563729){return db['AnalyticFieldReport'][_0x8607('0x25')]({'where':{'CustomReportId':_0x58b403['params']['id']},'transaction':_0x563729})[_0x8607('0x24')](function(_0x2aeba3){var _0x107d26=_[_0x8607('0x29')](_0x58b403['body'],function(_0x235817){delete _0x235817['id'];_0x235817['CustomReportId']=_0x58b403['params']['id'];return _0x235817;});return db[_0x8607('0x2a')][_0x8607('0x48')](_0x107d26,{'transaction':_0x563729});});})[_0x8607('0x24')](function(){return db[_0x8607('0x2a')][_0x8607('0x41')]({'where':{'CustomReportId':_0x58b403[_0x8607('0x43')]['id']}});});}})[_0x8607('0x24')](respondWithResult(_0x2a5821,null))[_0x8607('0x42')](handleError(_0x2a5821,null));}; \ No newline at end of file +var _0x3154=['rows','catch','show','create','bulkCreate','body','find','params','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','AnalyticFieldReport','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','limit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0x3154,0xaf));var _0x4315=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x3154[_0x346737];return _0x1ade2e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4315('0x0'));var rimraf=require(_0x4315('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4315('0x2'));var rp=require('request-promise');var moment=require(_0x4315('0x3'));var BPromise=require(_0x4315('0x4'));var Mustache=require(_0x4315('0x5'));var util=require(_0x4315('0x6'));var path=require(_0x4315('0x7'));var sox=require(_0x4315('0x8'));var csv=require(_0x4315('0x9'));var ejs=require(_0x4315('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4315('0xb'));var jsforce=require(_0x4315('0xc'));var deskjs=require(_0x4315('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4315('0xe'));var Papa=require(_0x4315('0xf'));var Redis=require(_0x4315('0x10'));var authService=require(_0x4315('0x11'));var qs=require(_0x4315('0x12'));var as=require(_0x4315('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4315('0x14'))('api');var utils=require(_0x4315('0x15'));var config=require(_0x4315('0x16'));var licenseUtil=require(_0x4315('0x17'));var db=require(_0x4315('0x18'))['db'];function respondWithStatusCode(_0x5413ee,_0x59641a){_0x59641a=_0x59641a||0xcc;return function(_0x5e4708){if(_0x5e4708){return _0x5413ee['sendStatus'](_0x59641a);}return _0x5413ee['status'](_0x59641a)[_0x4315('0x19')]();};}function respondWithResult(_0x9c8cd5,_0x413994){_0x413994=_0x413994||0xc8;return function(_0x4e924d){if(_0x4e924d){return _0x9c8cd5[_0x4315('0x1a')](_0x413994)['json'](_0x4e924d);}};}function respondWithFilteredResult(_0x44c3a8,_0x2c95cc){return function(_0x3301a2){if(_0x3301a2){var _0x59672f=_0x3301a2[_0x4315('0x1b')],_0x40d492=_0x2c95cc['offset'],_0x3d6d94=_0x2c95cc['offset']+_0x2c95cc['limit'],_0x25972c;if(_0x3d6d94>=_0x59672f){_0x3d6d94=_0x59672f;_0x25972c=0xc8;}else{_0x25972c=0xce;}_0x44c3a8['status'](_0x25972c);return _0x44c3a8[_0x4315('0x1c')](_0x4315('0x1d'),_0x40d492+'-'+_0x3d6d94+'/'+_0x59672f)['json'](_0x3301a2);}return null;};}function patchUpdates(_0xdae1c6){return function(_0x3b94de){try{jsonpatch[_0x4315('0x1e')](_0x3b94de,_0xdae1c6,!![]);}catch(_0x5f2796){return BPromise['reject'](_0x5f2796);}return _0x3b94de[_0x4315('0x1f')]();};}function saveUpdates(_0x13cb0a,_0x3d9caf){return function(_0x5d4ea3){if(_0x5d4ea3){return _0x5d4ea3[_0x4315('0x20')](_0x13cb0a)[_0x4315('0x21')](function(_0x32a30f){return _0x32a30f;});}return null;};}function removeEntity(_0x42fae0,_0x48e447){return function(_0x1f9643){if(_0x1f9643){return _0x1f9643[_0x4315('0x22')]()['then'](function(){_0x42fae0['status'](0xcc)[_0x4315('0x19')]();});}};}function handleEntityNotFound(_0x3477d8,_0x2271e2){return function(_0x568065){if(!_0x568065){_0x3477d8['sendStatus'](0x194);}return _0x568065;};}function handleError(_0x170506,_0x29f9a7){_0x29f9a7=_0x29f9a7||0x1f4;return function(_0x41a2de){logger[_0x4315('0x23')](_0x41a2de['stack']);if(_0x41a2de[_0x4315('0x24')]){delete _0x41a2de[_0x4315('0x24')];}_0x170506['status'](_0x29f9a7)[_0x4315('0x25')](_0x41a2de);};}exports[_0x4315('0x26')]=function(_0x4a9595,_0x38edf5){var _0x4041c9={},_0x338e30={},_0x4874={'count':0x0,'rows':[]};var _0x90c463=_[_0x4315('0x27')](db[_0x4315('0x28')][_0x4315('0x29')],function(_0x4f5923){return{'name':_0x4f5923['fieldName'],'type':_0x4f5923[_0x4315('0x2a')][_0x4315('0x2b')]};});_0x338e30[_0x4315('0x2c')]=_[_0x4315('0x27')](_0x90c463,'name');_0x338e30['query']=_[_0x4315('0x2d')](_0x4a9595[_0x4315('0x2e')]);_0x338e30[_0x4315('0x2f')]=_['intersection'](_0x338e30[_0x4315('0x2c')],_0x338e30[_0x4315('0x2e')]);_0x4041c9[_0x4315('0x30')]=_[_0x4315('0x31')](_0x338e30['model'],qs[_0x4315('0x32')](_0x4a9595[_0x4315('0x2e')][_0x4315('0x32')]));_0x4041c9[_0x4315('0x30')]=_0x4041c9[_0x4315('0x30')][_0x4315('0x33')]?_0x4041c9[_0x4315('0x30')]:_0x338e30[_0x4315('0x2c')];if(!_0x4a9595[_0x4315('0x2e')]['hasOwnProperty'](_0x4315('0x34'))){_0x4041c9['limit']=qs[_0x4315('0x35')](_0x4a9595[_0x4315('0x2e')][_0x4315('0x35')]);_0x4041c9[_0x4315('0x36')]=qs[_0x4315('0x36')](_0x4a9595[_0x4315('0x2e')][_0x4315('0x36')]);}_0x4041c9[_0x4315('0x37')]=qs['sort'](_0x4a9595[_0x4315('0x2e')][_0x4315('0x38')]);_0x4041c9[_0x4315('0x39')]=qs['filters'](_[_0x4315('0x3a')](_0x4a9595[_0x4315('0x2e')],_0x338e30['filters']),_0x90c463);if(_0x4a9595['query'][_0x4315('0x3b')]){_0x4041c9['where']=_[_0x4315('0x3c')](_0x4041c9[_0x4315('0x39')],{'$or':_[_0x4315('0x27')](_0x90c463,function(_0x11b98d){if(_0x11b98d['type']!==_0x4315('0x3d')){var _0x2ffd73={};_0x2ffd73[_0x11b98d[_0x4315('0x24')]]={'$like':'%'+_0x4a9595[_0x4315('0x2e')][_0x4315('0x3b')]+'%'};return _0x2ffd73;}})});}_0x4041c9=_[_0x4315('0x3c')]({},_0x4041c9,_0x4a9595[_0x4315('0x3e')]);var _0x492310={'where':_0x4041c9[_0x4315('0x39')]};return db[_0x4315('0x28')][_0x4315('0x1b')](_0x492310)['then'](function(_0x107244){_0x4874[_0x4315('0x1b')]=_0x107244;if(_0x4a9595[_0x4315('0x2e')][_0x4315('0x3f')]){_0x4041c9['include']=[{'all':!![]}];}return db[_0x4315('0x28')][_0x4315('0x40')](_0x4041c9);})[_0x4315('0x21')](function(_0x3e8f28){_0x4874[_0x4315('0x41')]=_0x3e8f28;return _0x4874;})[_0x4315('0x21')](respondWithFilteredResult(_0x38edf5,_0x4041c9))[_0x4315('0x42')](handleError(_0x38edf5,null));};exports[_0x4315('0x43')]=function(_0x58597c,_0x359dad){var _0x5f0834={'raw':![],'where':{'id':_0x58597c['params']['id']}},_0x3086f1={};_0x3086f1[_0x4315('0x2c')]=_[_0x4315('0x2d')](db[_0x4315('0x28')][_0x4315('0x29')]);_0x3086f1[_0x4315('0x2e')]=_[_0x4315('0x2d')](_0x58597c['query']);_0x3086f1[_0x4315('0x2f')]=_[_0x4315('0x31')](_0x3086f1[_0x4315('0x2c')],_0x3086f1['query']);_0x5f0834[_0x4315('0x30')]=_['intersection'](_0x3086f1[_0x4315('0x2c')],qs[_0x4315('0x32')](_0x58597c['query'][_0x4315('0x32')]));_0x5f0834[_0x4315('0x30')]=_0x5f0834['attributes'][_0x4315('0x33')]?_0x5f0834[_0x4315('0x30')]:_0x3086f1['model'];if(_0x58597c['query']['includeAll']){_0x5f0834['include']=[{'all':!![]}];}_0x5f0834=_[_0x4315('0x3c')]({},_0x5f0834,_0x58597c[_0x4315('0x3e')]);return db[_0x4315('0x28')]['find'](_0x5f0834)[_0x4315('0x21')](handleEntityNotFound(_0x359dad,null))[_0x4315('0x21')](respondWithResult(_0x359dad,null))[_0x4315('0x42')](handleError(_0x359dad,null));};exports[_0x4315('0x44')]=function(_0x2205cf,_0xf9af94){return db['AnalyticFieldReport'][_0x4315('0x44')](_0x2205cf['body'],{})[_0x4315('0x21')](respondWithResult(_0xf9af94,0xc9))[_0x4315('0x42')](handleError(_0xf9af94,null));};exports[_0x4315('0x45')]=function(_0x4a58a2,_0x10ba1c){return db['AnalyticFieldReport'][_0x4315('0x45')](_0x4a58a2[_0x4315('0x46')],{'raw':![],'individualHooks':!![]})[_0x4315('0x21')](respondWithResult(_0x10ba1c,0xc9))['catch'](handleError(_0x10ba1c,null));};exports[_0x4315('0x20')]=function(_0x47c636,_0x40dfad){if(_0x47c636[_0x4315('0x46')]['id']){delete _0x47c636[_0x4315('0x46')]['id'];}return db[_0x4315('0x28')][_0x4315('0x47')]({'where':{'id':_0x47c636[_0x4315('0x48')]['id']}})[_0x4315('0x21')](handleEntityNotFound(_0x40dfad,null))[_0x4315('0x21')](saveUpdates(_0x47c636[_0x4315('0x46')],null))[_0x4315('0x21')](respondWithResult(_0x40dfad,null))[_0x4315('0x42')](handleError(_0x40dfad,null));};exports['destroy']=function(_0x5a174d,_0x522efc){return db[_0x4315('0x28')]['find']({'where':{'id':_0x5a174d[_0x4315('0x48')]['id']}})['then'](handleEntityNotFound(_0x522efc,null))[_0x4315('0x21')](removeEntity(_0x522efc,null))[_0x4315('0x42')](handleError(_0x522efc,null));};exports[_0x4315('0x49')]=function(_0x289bac,_0x20e429){return db[_0x4315('0x28')]['destroy']({'where':{'id':_0x289bac[_0x4315('0x2e')][_0x4315('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0x4315('0x21')](respondWithResult(_0x20e429,0xcc))[_0x4315('0x42')](handleError(_0x20e429,null));};exports['addFields']=function(_0x4750bc,_0x415923,_0x498781){return db[_0x4315('0x4b')][_0x4315('0x4c')]({'where':{'id':_0x4750bc[_0x4315('0x48')]['id']}})[_0x4315('0x21')](handleEntityNotFound(_0x415923,null))[_0x4315('0x21')](function(_0x22f5cf){if(_0x22f5cf){return db[_0x4315('0x4d')][_0x4315('0x4e')](function(_0x3f2011){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0x4750bc['params']['id']},'transaction':_0x3f2011})[_0x4315('0x21')](function(_0x5842ca){var _0x4a8e1c=_[_0x4315('0x27')](_0x4750bc['body'],function(_0x293c82){delete _0x293c82['id'];_0x293c82[_0x4315('0x4f')]=_0x4750bc[_0x4315('0x48')]['id'];return _0x293c82;});return db['AnalyticFieldReport']['bulkCreate'](_0x4a8e1c,{'transaction':_0x3f2011});});})[_0x4315('0x21')](function(){return db['AnalyticFieldReport'][_0x4315('0x40')]({'where':{'CustomReportId':_0x4750bc['params']['id']}});});}})[_0x4315('0x21')](respondWithResult(_0x415923,null))['catch'](handleError(_0x415923,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 18bbc6b..a68133e 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 _0x3e10=['../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0xa4be81,_0x261167){var _0x2320f9=function(_0x2863c4){while(--_0x2863c4){_0xa4be81['push'](_0xa4be81['shift']());}};_0x2320f9(++_0x261167);}(_0x3e10,0x1c8));var _0x03e1=function(_0x4affc1,_0x235d4d){_0x4affc1=_0x4affc1-0x0;var _0x451eb3=_0x3e10[_0x4affc1];return _0x451eb3;};'use strict';var _=require(_0x03e1('0x0'));var util=require(_0x03e1('0x1'));var logger=require(_0x03e1('0x2'))('api');var moment=require(_0x03e1('0x3'));var BPromise=require(_0x03e1('0x4'));var rp=require(_0x03e1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x03e1('0x6'));var attributes=require(_0x03e1('0x7'));module[_0x03e1('0x8')]=function(_0x400737,_0x29f711){return _0x400737[_0x03e1('0x9')](_0x03e1('0xa'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15b2=['analytics_report_fields','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport'];(function(_0x3bc72d,_0x5aaa33){var _0x3b7fbf=function(_0x106a76){while(--_0x106a76){_0x3bc72d['push'](_0x3bc72d['shift']());}};_0x3b7fbf(++_0x5aaa33);}(_0x15b2,0x145));var _0x215b=function(_0x23f58d,_0x22b11c){_0x23f58d=_0x23f58d-0x0;var _0x515d10=_0x15b2[_0x23f58d];return _0x515d10;};'use strict';var _=require(_0x215b('0x0'));var util=require('util');var logger=require(_0x215b('0x1'))(_0x215b('0x2'));var moment=require(_0x215b('0x3'));var BPromise=require(_0x215b('0x4'));var rp=require(_0x215b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x215b('0x6'));var config=require(_0x215b('0x7'));var attributes=require(_0x215b('0x8'));module[_0x215b('0x9')]=function(_0x4db4e6,_0x14ac71){return _0x4db4e6['define'](_0x215b('0xa'),attributes,{'tableName':_0x215b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index e5d116d..855ddf4 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 _0x0fd0=['jayson/promise','request','then','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','ioredis','../../config/utils','rpc'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0fd0,0x12d));var _0x00fd=function(_0x1ca5c6,_0x3f23ba){_0x1ca5c6=_0x1ca5c6-0x0;var _0x314371=_0x0fd0[_0x1ca5c6];return _0x314371;};'use strict';var _=require(_0x00fd('0x0'));var util=require(_0x00fd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x00fd('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x00fd('0x3'));var logger=require('../../config/logger')(_0x00fd('0x4'));var config=require('../../config/environment');var jayson=require(_0x00fd('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2fad18,_0x386d0e,_0x5cee5c){return new BPromise(function(_0x50a052,_0x4e9bf9){return client[_0x00fd('0x6')](_0x2fad18,_0x5cee5c)[_0x00fd('0x7')](function(_0x492dfa){logger['info'](_0x00fd('0x8'),_0x386d0e,'request\x20sent');logger[_0x00fd('0x9')](_0x00fd('0xa'),_0x386d0e,'request\x20sent',JSON[_0x00fd('0xb')](_0x492dfa));if(_0x492dfa[_0x00fd('0xc')]){if(_0x492dfa[_0x00fd('0xc')][_0x00fd('0xd')]===0x1f4){logger[_0x00fd('0xc')](_0x00fd('0x8'),_0x386d0e,_0x492dfa['error'][_0x00fd('0xe')]);return _0x4e9bf9(_0x492dfa[_0x00fd('0xc')][_0x00fd('0xe')]);}logger[_0x00fd('0xc')](_0x00fd('0x8'),_0x386d0e,_0x492dfa['error'][_0x00fd('0xe')]);return _0x50a052(_0x492dfa['error']['message']);}else{logger['info'](_0x00fd('0x8'),_0x386d0e,_0x00fd('0xf'));_0x50a052(_0x492dfa[_0x00fd('0x10')][_0x00fd('0xe')]);}})[_0x00fd('0x11')](function(_0x1afd9e){logger[_0x00fd('0xc')](_0x00fd('0x8'),_0x386d0e,_0x1afd9e);_0x4e9bf9(_0x1afd9e);});});} \ No newline at end of file +var _0x116e=['bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x2e98f8,_0x2029ac){var _0x17da8f=function(_0x50c695){while(--_0x50c695){_0x2e98f8['push'](_0x2e98f8['shift']());}};_0x17da8f(++_0x2029ac);}(_0x116e,0x1e0));var _0xe116=function(_0x34412f,_0x116bea){_0x34412f=_0x34412f-0x0;var _0x4b4b5a=_0x116e[_0x34412f];return _0x4b4b5a;};'use strict';var _=require(_0xe116('0x0'));var util=require(_0xe116('0x1'));var moment=require(_0xe116('0x2'));var BPromise=require(_0xe116('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe116('0x4'))['db'];var utils=require(_0xe116('0x5'));var logger=require(_0xe116('0x6'))('rpc');var config=require(_0xe116('0x7'));var jayson=require(_0xe116('0x8'));var client=jayson[_0xe116('0x9')][_0xe116('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9aae51,_0x365b54,_0x59dab2){return new BPromise(function(_0x1cab49,_0x2edb7b){return client[_0xe116('0xb')](_0x9aae51,_0x59dab2)[_0xe116('0xc')](function(_0x125262){logger[_0xe116('0xd')](_0xe116('0xe'),_0x365b54,_0xe116('0xf'));logger[_0xe116('0x10')](_0xe116('0x11'),_0x365b54,_0xe116('0xf'),JSON[_0xe116('0x12')](_0x125262));if(_0x125262[_0xe116('0x13')]){if(_0x125262[_0xe116('0x13')][_0xe116('0x14')]===0x1f4){logger[_0xe116('0x13')](_0xe116('0xe'),_0x365b54,_0x125262[_0xe116('0x13')]['message']);return _0x2edb7b(_0x125262[_0xe116('0x13')]['message']);}logger[_0xe116('0x13')](_0xe116('0xe'),_0x365b54,_0x125262[_0xe116('0x13')][_0xe116('0x15')]);return _0x1cab49(_0x125262[_0xe116('0x13')][_0xe116('0x15')]);}else{logger[_0xe116('0xd')](_0xe116('0xe'),_0x365b54,'request\x20sent');_0x1cab49(_0x125262['result'][_0xe116('0x15')]);}})[_0xe116('0x16')](function(_0x5917f3){logger['error'](_0xe116('0xe'),_0x365b54,_0x5917f3);_0x2edb7b(_0x5917f3);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 464bb5a..8ae766c 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 _0x5fc3=['get','isAuthenticated','/:id','show','post','create','/create_many','/:id/create_many','addFields','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticFieldReport.controller'];(function(_0x4e18bb,_0x2b28df){var _0x5ebf1f=function(_0x2f43cc){while(--_0x2f43cc){_0x4e18bb['push'](_0x4e18bb['shift']());}};_0x5ebf1f(++_0x2b28df);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4f3c9b,_0x28e078){_0x4f3c9b=_0x4f3c9b-0x0;var _0x84e58a=_0x5fc3[_0x4f3c9b];return _0x84e58a;};'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 auth=require(_0x35fc('0x5'));var interaction=require(_0x35fc('0x6'));var config=require('../../config/environment');var controller=require(_0x35fc('0x7'));router[_0x35fc('0x8')]('/',auth[_0x35fc('0x9')](),controller['index']);router['get'](_0x35fc('0xa'),auth['isAuthenticated'](),controller[_0x35fc('0xb')]);router[_0x35fc('0xc')]('/',auth[_0x35fc('0x9')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xc')](_0x35fc('0xe'),auth[_0x35fc('0x9')](),controller['bulkCreate']);router[_0x35fc('0xc')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x10')]);router[_0x35fc('0x11')]('/:id',auth[_0x35fc('0x9')](),controller[_0x35fc('0x12')]);router['delete']('/destroy_many',auth[_0x35fc('0x9')](),controller['bulkDestroy']);router[_0x35fc('0x13')](_0x35fc('0xa'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x14')]);module[_0x35fc('0x15')]=router; \ No newline at end of file +var _0x5fc3=['get','isAuthenticated','/:id','show','post','create','/create_many','/:id/create_many','addFields','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticFieldReport.controller'];(function(_0x33a20e,_0x1fd72d){var _0x3eb207=function(_0x25dc5a){while(--_0x25dc5a){_0x33a20e['push'](_0x33a20e['shift']());}};_0x3eb207(++_0x1fd72d);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x5fc3[_0x3de8a4];return _0x4635cf;};'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 auth=require(_0x35fc('0x5'));var interaction=require(_0x35fc('0x6'));var config=require('../../config/environment');var controller=require(_0x35fc('0x7'));router[_0x35fc('0x8')]('/',auth[_0x35fc('0x9')](),controller['index']);router['get'](_0x35fc('0xa'),auth['isAuthenticated'](),controller[_0x35fc('0xb')]);router[_0x35fc('0xc')]('/',auth[_0x35fc('0x9')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xc')](_0x35fc('0xe'),auth[_0x35fc('0x9')](),controller['bulkCreate']);router[_0x35fc('0xc')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x10')]);router[_0x35fc('0x11')]('/:id',auth[_0x35fc('0x9')](),controller[_0x35fc('0x12')]);router['delete']('/destroy_many',auth[_0x35fc('0x9')](),controller['bulkDestroy']);router[_0x35fc('0x13')](_0x35fc('0xa'),auth[_0x35fc('0x9')](),controller[_0x35fc('0x14')]);module[_0x35fc('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 9a05499..9ce6f14 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 _0x84cd=['exports','STRING','name','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84cd,0x1e0));var _0xd84c=function(_0x199c8f,_0x1db1e8){_0x199c8f=_0x199c8f-0x0;var _0x2c2e4d=_0x84cd[_0x199c8f];return _0x2c2e4d;};'use strict';var Sequelize=require('sequelize');module[_0xd84c('0x0')]={'name':{'type':Sequelize[_0xd84c('0x1')],'allowNull':![],'unique':_0xd84c('0x2')},'table':{'type':Sequelize[_0xd84c('0x1')]},'metric':{'type':Sequelize[_0xd84c('0x3')]},'description':{'type':Sequelize[_0xd84c('0x1')]}}; \ No newline at end of file +var _0x83e1=['TEXT','sequelize','exports','name'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x83e1,0x1ad));var _0x183e=function(_0x246edf,_0x306744){_0x246edf=_0x246edf-0x0;var _0x23466e=_0x83e1[_0x246edf];return _0x23466e;};'use strict';var Sequelize=require(_0x183e('0x0'));module[_0x183e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x183e('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x183e('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 3943a57..2d3d6e3 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 _0x4db7=['key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','count','includeAll','include','findAll','rows','catch','params','keys','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','autoAssociation','error','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','Content-Range','apply','save','update','then','destroy','Metrics','UserProfileResource','stack','name','send','index','AnalyticMetric','fieldName','type'];(function(_0x59230a,_0x5be5f0){var _0x383d36=function(_0x5d39a1){while(--_0x5d39a1){_0x59230a['push'](_0x59230a['shift']());}};_0x383d36(++_0x5be5f0);}(_0x4db7,0x74));var _0x74db=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x4db7[_0x2be8c2];return _0x97f531;};'use strict';var pdf=require(_0x74db('0x0'));var emlformat=require(_0x74db('0x1'));var rimraf=require(_0x74db('0x2'));var zipdir=require(_0x74db('0x3'));var jsonpatch=require(_0x74db('0x4'));var rp=require(_0x74db('0x5'));var moment=require(_0x74db('0x6'));var BPromise=require(_0x74db('0x7'));var Mustache=require(_0x74db('0x8'));var util=require('util');var path=require(_0x74db('0x9'));var sox=require('sox');var csv=require(_0x74db('0xa'));var ejs=require(_0x74db('0xb'));var fs=require('fs');var _=require(_0x74db('0xc'));var squel=require('squel');var crypto=require(_0x74db('0xd'));var jsforce=require(_0x74db('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x74db('0xa'));var querystring=require(_0x74db('0xf'));var Papa=require(_0x74db('0x10'));var Redis=require(_0x74db('0x11'));var authService=require(_0x74db('0x12'));var qs=require(_0x74db('0x13'));var as=require(_0x74db('0x14'));var hardwareService=require(_0x74db('0x15'));var logger=require(_0x74db('0x16'))(_0x74db('0x17'));var utils=require(_0x74db('0x18'));var config=require(_0x74db('0x19'));var licenseUtil=require(_0x74db('0x1a'));var db=require(_0x74db('0x1b'))['db'];function respondWithStatusCode(_0x39950e,_0x2abcb0){_0x2abcb0=_0x2abcb0||0xcc;return function(_0x224035){if(_0x224035){return _0x39950e[_0x74db('0x1c')](_0x2abcb0);}return _0x39950e[_0x74db('0x1d')](_0x2abcb0)[_0x74db('0x1e')]();};}function respondWithResult(_0xa971ea,_0x2551b0){_0x2551b0=_0x2551b0||0xc8;return function(_0xe004b7){if(_0xe004b7){return _0xa971ea[_0x74db('0x1d')](_0x2551b0)[_0x74db('0x1f')](_0xe004b7);}};}function respondWithFilteredResult(_0x124b4f,_0x525d56){return function(_0x4c9bf4){if(_0x4c9bf4){var _0x5a0957=_0x4c9bf4['count'],_0x2da10d=_0x525d56[_0x74db('0x20')],_0x376efc=_0x525d56[_0x74db('0x20')]+_0x525d56['limit'],_0x7a40cf;if(_0x376efc>=_0x5a0957){_0x376efc=_0x5a0957;_0x7a40cf=0xc8;}else{_0x7a40cf=0xce;}_0x124b4f[_0x74db('0x1d')](_0x7a40cf);return _0x124b4f['set'](_0x74db('0x21'),_0x2da10d+'-'+_0x376efc+'/'+_0x5a0957)[_0x74db('0x1f')](_0x4c9bf4);}return null;};}function patchUpdates(_0x4aa5d6){return function(_0x1a5ffd){try{jsonpatch[_0x74db('0x22')](_0x1a5ffd,_0x4aa5d6,!![]);}catch(_0x36b3bb){return BPromise['reject'](_0x36b3bb);}return _0x1a5ffd[_0x74db('0x23')]();};}function saveUpdates(_0x5d13ed,_0x319030){return function(_0x3f00bf){if(_0x3f00bf){return _0x3f00bf[_0x74db('0x24')](_0x5d13ed)[_0x74db('0x25')](function(_0x2aa2aa){return _0x2aa2aa;});}return null;};}function removeEntity(_0x4e52c4,_0x327da7){return function(_0x2d1198){if(_0x2d1198){return _0x2d1198[_0x74db('0x26')]()[_0x74db('0x25')](function(){var _0x214f0e=_0x2d1198['get']({'plain':!![]});var _0x3865ab=_0x74db('0x27');return db[_0x74db('0x28')][_0x74db('0x26')]({'where':{'type':_0x3865ab,'resourceId':_0x214f0e['id']}})['then'](function(){return _0x2d1198;});})[_0x74db('0x25')](function(){_0x4e52c4[_0x74db('0x1d')](0xcc)[_0x74db('0x1e')]();});}};}function handleEntityNotFound(_0x385a93,_0x875586){return function(_0x357d61){if(!_0x357d61){_0x385a93[_0x74db('0x1c')](0x194);}return _0x357d61;};}function handleError(_0x29a6c9,_0x33f8a6){_0x33f8a6=_0x33f8a6||0x1f4;return function(_0x13166a){logger['error'](_0x13166a[_0x74db('0x29')]);if(_0x13166a['name']){delete _0x13166a[_0x74db('0x2a')];}_0x29a6c9[_0x74db('0x1d')](_0x33f8a6)[_0x74db('0x2b')](_0x13166a);};}exports[_0x74db('0x2c')]=function(_0x466dd0,_0x47c805){var _0x57cd5e={},_0x59f2ee={},_0x48ab8c={'count':0x0,'rows':[]};var _0x44948f=_['map'](db[_0x74db('0x2d')]['rawAttributes'],function(_0x33e7d7){return{'name':_0x33e7d7[_0x74db('0x2e')],'type':_0x33e7d7[_0x74db('0x2f')][_0x74db('0x30')]};});_0x59f2ee[_0x74db('0x31')]=_[_0x74db('0x32')](_0x44948f,_0x74db('0x2a'));_0x59f2ee[_0x74db('0x33')]=_['keys'](_0x466dd0[_0x74db('0x33')]);_0x59f2ee[_0x74db('0x34')]=_[_0x74db('0x35')](_0x59f2ee[_0x74db('0x31')],_0x59f2ee[_0x74db('0x33')]);_0x57cd5e[_0x74db('0x36')]=_[_0x74db('0x35')](_0x59f2ee[_0x74db('0x31')],qs[_0x74db('0x37')](_0x466dd0[_0x74db('0x33')][_0x74db('0x37')]));_0x57cd5e[_0x74db('0x36')]=_0x57cd5e[_0x74db('0x36')][_0x74db('0x38')]?_0x57cd5e['attributes']:_0x59f2ee['model'];if(!_0x466dd0[_0x74db('0x33')][_0x74db('0x39')](_0x74db('0x3a'))){_0x57cd5e[_0x74db('0x3b')]=qs[_0x74db('0x3b')](_0x466dd0[_0x74db('0x33')]['limit']);_0x57cd5e[_0x74db('0x20')]=qs[_0x74db('0x20')](_0x466dd0[_0x74db('0x33')]['offset']);}_0x57cd5e[_0x74db('0x3c')]=qs['sort'](_0x466dd0[_0x74db('0x33')][_0x74db('0x3d')]);_0x57cd5e[_0x74db('0x3e')]=qs[_0x74db('0x34')](_['pick'](_0x466dd0[_0x74db('0x33')],_0x59f2ee[_0x74db('0x34')]),_0x44948f);if(_0x466dd0[_0x74db('0x33')]['filter']){_0x57cd5e['where']=_['merge'](_0x57cd5e[_0x74db('0x3e')],{'$or':_[_0x74db('0x32')](_0x44948f,function(_0x38537b){if(_0x38537b[_0x74db('0x2f')]!=='VIRTUAL'){var _0x479047={};_0x479047[_0x38537b[_0x74db('0x2a')]]={'$like':'%'+_0x466dd0[_0x74db('0x33')]['filter']+'%'};return _0x479047;}})});}_0x57cd5e=_[_0x74db('0x3f')]({},_0x57cd5e,_0x466dd0['options']);var _0xec7c2c={'where':_0x57cd5e['where']};return db[_0x74db('0x2d')][_0x74db('0x40')](_0xec7c2c)[_0x74db('0x25')](function(_0x129eb2){_0x48ab8c[_0x74db('0x40')]=_0x129eb2;if(_0x466dd0[_0x74db('0x33')][_0x74db('0x41')]){_0x57cd5e[_0x74db('0x42')]=[{'all':!![]}];}return db[_0x74db('0x2d')][_0x74db('0x43')](_0x57cd5e);})['then'](function(_0xd8cc55){_0x48ab8c[_0x74db('0x44')]=_0xd8cc55;return _0x48ab8c;})[_0x74db('0x25')](respondWithFilteredResult(_0x47c805,_0x57cd5e))[_0x74db('0x45')](handleError(_0x47c805,null));};exports['show']=function(_0x15545f,_0x1ffc9d){var _0x25ac9a={'raw':!![],'where':{'id':_0x15545f[_0x74db('0x46')]['id']}},_0x5ea840={};_0x5ea840[_0x74db('0x31')]=_[_0x74db('0x47')](db[_0x74db('0x2d')]['rawAttributes']);_0x5ea840[_0x74db('0x33')]=_[_0x74db('0x47')](_0x15545f['query']);_0x5ea840[_0x74db('0x34')]=_[_0x74db('0x35')](_0x5ea840['model'],_0x5ea840[_0x74db('0x33')]);_0x25ac9a[_0x74db('0x36')]=_['intersection'](_0x5ea840[_0x74db('0x31')],qs[_0x74db('0x37')](_0x15545f[_0x74db('0x33')][_0x74db('0x37')]));_0x25ac9a[_0x74db('0x36')]=_0x25ac9a['attributes']['length']?_0x25ac9a[_0x74db('0x36')]:_0x5ea840['model'];if(_0x15545f[_0x74db('0x33')][_0x74db('0x41')]){_0x25ac9a[_0x74db('0x42')]=[{'all':!![]}];}_0x25ac9a=_[_0x74db('0x3f')]({},_0x25ac9a,_0x15545f[_0x74db('0x48')]);return db[_0x74db('0x2d')][_0x74db('0x49')](_0x25ac9a)[_0x74db('0x25')](handleEntityNotFound(_0x1ffc9d,null))[_0x74db('0x25')](respondWithResult(_0x1ffc9d,null))[_0x74db('0x45')](handleError(_0x1ffc9d,null));};exports[_0x74db('0x4a')]=function(_0x1fa90a,_0x165d3a){return db[_0x74db('0x2d')][_0x74db('0x4a')](_0x1fa90a['body'],{})[_0x74db('0x25')](function(_0x1f9ecd){var _0x4f8afd=_0x1fa90a['user']['get']({'plain':!![]});if(!_0x4f8afd)throw new Error(_0x74db('0x4b'));if(_0x4f8afd[_0x74db('0x4c')]===_0x74db('0x4d')){var _0x20394e=_0x1f9ecd[_0x74db('0x4e')]({'plain':!![]});var _0x386a1c='Metrics';return db['UserProfileSection'][_0x74db('0x49')]({'where':{'name':_0x386a1c,'userProfileId':_0x4f8afd['userProfileId']},'raw':!![]})[_0x74db('0x25')](function(_0x1b2a70){if(_0x1b2a70&&_0x1b2a70[_0x74db('0x4f')]===0x0){return db[_0x74db('0x28')]['create']({'name':_0x20394e[_0x74db('0x2a')],'resourceId':_0x20394e['id'],'type':_0x1b2a70['name'],'sectionId':_0x1b2a70['id']},{})[_0x74db('0x25')](function(){return _0x1f9ecd;});}else{return _0x1f9ecd;}})[_0x74db('0x45')](function(_0x7d898b){logger[_0x74db('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7d898b);throw _0x7d898b;});}return _0x1f9ecd;})['then'](respondWithResult(_0x165d3a,0xc9))[_0x74db('0x45')](handleError(_0x165d3a,null));};exports[_0x74db('0x24')]=function(_0x174f35,_0x3d5ba8){if(_0x174f35[_0x74db('0x51')]['id']){delete _0x174f35[_0x74db('0x51')]['id'];}return db[_0x74db('0x2d')][_0x74db('0x49')]({'where':{'id':_0x174f35[_0x74db('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d5ba8,null))[_0x74db('0x25')](saveUpdates(_0x174f35['body'],null))[_0x74db('0x25')](respondWithResult(_0x3d5ba8,null))[_0x74db('0x45')](handleError(_0x3d5ba8,null));};exports[_0x74db('0x26')]=function(_0x9b4421,_0x4680d9){return db['AnalyticMetric'][_0x74db('0x49')]({'where':{'id':_0x9b4421[_0x74db('0x46')]['id']}})[_0x74db('0x25')](handleEntityNotFound(_0x4680d9,null))[_0x74db('0x25')](removeEntity(_0x4680d9,null))['catch'](handleError(_0x4680d9,null));}; \ No newline at end of file +var _0x2f1a=['../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','Metrics','UserProfileResource','error','stack','name','send','map','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','AnalyticMetric','includeAll','include','rows','catch','show','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','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'];(function(_0x24200b,_0x34d173){var _0x8a8d42=function(_0x21cd8c){while(--_0x21cd8c){_0x24200b['push'](_0x24200b['shift']());}};_0x8a8d42(++_0x34d173);}(_0x2f1a,0x17b));var _0xa2f1=function(_0x534b58,_0x53ecd6){_0x534b58=_0x534b58-0x0;var _0x446260=_0x2f1a[_0x534b58];return _0x446260;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa2f1('0x0'));var rimraf=require(_0xa2f1('0x1'));var zipdir=require(_0xa2f1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa2f1('0x3'));var moment=require(_0xa2f1('0x4'));var BPromise=require(_0xa2f1('0x5'));var Mustache=require(_0xa2f1('0x6'));var util=require('util');var path=require(_0xa2f1('0x7'));var sox=require(_0xa2f1('0x8'));var csv=require(_0xa2f1('0x9'));var ejs=require(_0xa2f1('0xa'));var fs=require('fs');var _=require(_0xa2f1('0xb'));var squel=require(_0xa2f1('0xc'));var crypto=require(_0xa2f1('0xd'));var jsforce=require(_0xa2f1('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa2f1('0xf'));var Redis=require(_0xa2f1('0x10'));var authService=require(_0xa2f1('0x11'));var qs=require(_0xa2f1('0x12'));var as=require(_0xa2f1('0x13'));var hardwareService=require(_0xa2f1('0x14'));var logger=require(_0xa2f1('0x15'))(_0xa2f1('0x16'));var utils=require(_0xa2f1('0x17'));var config=require(_0xa2f1('0x18'));var licenseUtil=require(_0xa2f1('0x19'));var db=require(_0xa2f1('0x1a'))['db'];function respondWithStatusCode(_0x286e6b,_0x1b98ac){_0x1b98ac=_0x1b98ac||0xcc;return function(_0x3e8f85){if(_0x3e8f85){return _0x286e6b[_0xa2f1('0x1b')](_0x1b98ac);}return _0x286e6b[_0xa2f1('0x1c')](_0x1b98ac)[_0xa2f1('0x1d')]();};}function respondWithResult(_0x565674,_0x490344){_0x490344=_0x490344||0xc8;return function(_0x409b91){if(_0x409b91){return _0x565674[_0xa2f1('0x1c')](_0x490344)[_0xa2f1('0x1e')](_0x409b91);}};}function respondWithFilteredResult(_0x13796e,_0x52f990){return function(_0x5a5076){if(_0x5a5076){var _0x592f01=_0x5a5076[_0xa2f1('0x1f')],_0xf936db=_0x52f990[_0xa2f1('0x20')],_0x126940=_0x52f990[_0xa2f1('0x20')]+_0x52f990[_0xa2f1('0x21')],_0x294fd2;if(_0x126940>=_0x592f01){_0x126940=_0x592f01;_0x294fd2=0xc8;}else{_0x294fd2=0xce;}_0x13796e[_0xa2f1('0x1c')](_0x294fd2);return _0x13796e['set'](_0xa2f1('0x22'),_0xf936db+'-'+_0x126940+'/'+_0x592f01)[_0xa2f1('0x1e')](_0x5a5076);}return null;};}function patchUpdates(_0x3791e0){return function(_0x4f0aa7){try{jsonpatch[_0xa2f1('0x23')](_0x4f0aa7,_0x3791e0,!![]);}catch(_0x2f2e40){return BPromise['reject'](_0x2f2e40);}return _0x4f0aa7[_0xa2f1('0x24')]();};}function saveUpdates(_0x2b5ee5,_0x2d3d11){return function(_0x5f1a6a){if(_0x5f1a6a){return _0x5f1a6a[_0xa2f1('0x25')](_0x2b5ee5)[_0xa2f1('0x26')](function(_0x45cb2f){return _0x45cb2f;});}return null;};}function removeEntity(_0x30badf,_0x4f5047){return function(_0x54bbd7){if(_0x54bbd7){return _0x54bbd7[_0xa2f1('0x27')]()[_0xa2f1('0x26')](function(){var _0x23dcce=_0x54bbd7['get']({'plain':!![]});var _0x510a05=_0xa2f1('0x28');return db[_0xa2f1('0x29')][_0xa2f1('0x27')]({'where':{'type':_0x510a05,'resourceId':_0x23dcce['id']}})[_0xa2f1('0x26')](function(){return _0x54bbd7;});})[_0xa2f1('0x26')](function(){_0x30badf[_0xa2f1('0x1c')](0xcc)[_0xa2f1('0x1d')]();});}};}function handleEntityNotFound(_0x9c00c8,_0x2ac368){return function(_0x290671){if(!_0x290671){_0x9c00c8[_0xa2f1('0x1b')](0x194);}return _0x290671;};}function handleError(_0x2ec214,_0x28c05a){_0x28c05a=_0x28c05a||0x1f4;return function(_0x33928b){logger[_0xa2f1('0x2a')](_0x33928b[_0xa2f1('0x2b')]);if(_0x33928b[_0xa2f1('0x2c')]){delete _0x33928b['name'];}_0x2ec214[_0xa2f1('0x1c')](_0x28c05a)[_0xa2f1('0x2d')](_0x33928b);};}exports['index']=function(_0x18e43b,_0x455a42){var _0x231ffd={},_0x55bacd={},_0x10b336={'count':0x0,'rows':[]};var _0x22ec9d=_[_0xa2f1('0x2e')](db['AnalyticMetric'][_0xa2f1('0x2f')],function(_0x12bf9a){return{'name':_0x12bf9a['fieldName'],'type':_0x12bf9a[_0xa2f1('0x30')]['key']};});_0x55bacd['model']=_[_0xa2f1('0x2e')](_0x22ec9d,_0xa2f1('0x2c'));_0x55bacd[_0xa2f1('0x31')]=_[_0xa2f1('0x32')](_0x18e43b[_0xa2f1('0x31')]);_0x55bacd[_0xa2f1('0x33')]=_[_0xa2f1('0x34')](_0x55bacd[_0xa2f1('0x35')],_0x55bacd['query']);_0x231ffd[_0xa2f1('0x36')]=_['intersection'](_0x55bacd[_0xa2f1('0x35')],qs[_0xa2f1('0x37')](_0x18e43b[_0xa2f1('0x31')][_0xa2f1('0x37')]));_0x231ffd['attributes']=_0x231ffd[_0xa2f1('0x36')][_0xa2f1('0x38')]?_0x231ffd[_0xa2f1('0x36')]:_0x55bacd[_0xa2f1('0x35')];if(!_0x18e43b[_0xa2f1('0x31')][_0xa2f1('0x39')](_0xa2f1('0x3a'))){_0x231ffd[_0xa2f1('0x21')]=qs['limit'](_0x18e43b[_0xa2f1('0x31')][_0xa2f1('0x21')]);_0x231ffd[_0xa2f1('0x20')]=qs[_0xa2f1('0x20')](_0x18e43b[_0xa2f1('0x31')]['offset']);}_0x231ffd[_0xa2f1('0x3b')]=qs[_0xa2f1('0x3c')](_0x18e43b[_0xa2f1('0x31')]['sort']);_0x231ffd['where']=qs[_0xa2f1('0x33')](_[_0xa2f1('0x3d')](_0x18e43b[_0xa2f1('0x31')],_0x55bacd['filters']),_0x22ec9d);if(_0x18e43b[_0xa2f1('0x31')][_0xa2f1('0x3e')]){_0x231ffd[_0xa2f1('0x3f')]=_[_0xa2f1('0x40')](_0x231ffd[_0xa2f1('0x3f')],{'$or':_[_0xa2f1('0x2e')](_0x22ec9d,function(_0x290354){if(_0x290354['type']!=='VIRTUAL'){var _0x22f0e2={};_0x22f0e2[_0x290354[_0xa2f1('0x2c')]]={'$like':'%'+_0x18e43b[_0xa2f1('0x31')][_0xa2f1('0x3e')]+'%'};return _0x22f0e2;}})});}_0x231ffd=_['merge']({},_0x231ffd,_0x18e43b['options']);var _0x83647={'where':_0x231ffd[_0xa2f1('0x3f')]};return db[_0xa2f1('0x41')][_0xa2f1('0x1f')](_0x83647)[_0xa2f1('0x26')](function(_0x1080a4){_0x10b336[_0xa2f1('0x1f')]=_0x1080a4;if(_0x18e43b[_0xa2f1('0x31')][_0xa2f1('0x42')]){_0x231ffd[_0xa2f1('0x43')]=[{'all':!![]}];}return db[_0xa2f1('0x41')]['findAll'](_0x231ffd);})['then'](function(_0x2eb628){_0x10b336[_0xa2f1('0x44')]=_0x2eb628;return _0x10b336;})[_0xa2f1('0x26')](respondWithFilteredResult(_0x455a42,_0x231ffd))[_0xa2f1('0x45')](handleError(_0x455a42,null));};exports[_0xa2f1('0x46')]=function(_0x4b2b5b,_0x159773){var _0x45b416={'raw':!![],'where':{'id':_0x4b2b5b[_0xa2f1('0x47')]['id']}},_0x18c261={};_0x18c261[_0xa2f1('0x35')]=_[_0xa2f1('0x32')](db[_0xa2f1('0x41')][_0xa2f1('0x2f')]);_0x18c261[_0xa2f1('0x31')]=_[_0xa2f1('0x32')](_0x4b2b5b[_0xa2f1('0x31')]);_0x18c261[_0xa2f1('0x33')]=_[_0xa2f1('0x34')](_0x18c261[_0xa2f1('0x35')],_0x18c261['query']);_0x45b416[_0xa2f1('0x36')]=_[_0xa2f1('0x34')](_0x18c261[_0xa2f1('0x35')],qs[_0xa2f1('0x37')](_0x4b2b5b[_0xa2f1('0x31')][_0xa2f1('0x37')]));_0x45b416[_0xa2f1('0x36')]=_0x45b416[_0xa2f1('0x36')][_0xa2f1('0x38')]?_0x45b416[_0xa2f1('0x36')]:_0x18c261[_0xa2f1('0x35')];if(_0x4b2b5b[_0xa2f1('0x31')][_0xa2f1('0x42')]){_0x45b416['include']=[{'all':!![]}];}_0x45b416=_['merge']({},_0x45b416,_0x4b2b5b[_0xa2f1('0x48')]);return db[_0xa2f1('0x41')][_0xa2f1('0x49')](_0x45b416)[_0xa2f1('0x26')](handleEntityNotFound(_0x159773,null))['then'](respondWithResult(_0x159773,null))['catch'](handleError(_0x159773,null));};exports[_0xa2f1('0x4a')]=function(_0x308eb7,_0x41cdbe){return db[_0xa2f1('0x41')][_0xa2f1('0x4a')](_0x308eb7[_0xa2f1('0x4b')],{})['then'](function(_0x4359fd){var _0xd5af70=_0x308eb7[_0xa2f1('0x4c')][_0xa2f1('0x4d')]({'plain':!![]});if(!_0xd5af70)throw new Error(_0xa2f1('0x4e'));if(_0xd5af70['role']===_0xa2f1('0x4c')){var _0x48789f=_0x4359fd[_0xa2f1('0x4d')]({'plain':!![]});var _0x2c2a52='Metrics';return db[_0xa2f1('0x4f')][_0xa2f1('0x49')]({'where':{'name':_0x2c2a52,'userProfileId':_0xd5af70[_0xa2f1('0x50')]},'raw':!![]})[_0xa2f1('0x26')](function(_0x2cbddf){if(_0x2cbddf&&_0x2cbddf['autoAssociation']===0x0){return db[_0xa2f1('0x29')][_0xa2f1('0x4a')]({'name':_0x48789f[_0xa2f1('0x2c')],'resourceId':_0x48789f['id'],'type':_0x2cbddf['name'],'sectionId':_0x2cbddf['id']},{})[_0xa2f1('0x26')](function(){return _0x4359fd;});}else{return _0x4359fd;}})[_0xa2f1('0x45')](function(_0x1049d8){logger[_0xa2f1('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1049d8);throw _0x1049d8;});}return _0x4359fd;})[_0xa2f1('0x26')](respondWithResult(_0x41cdbe,0xc9))[_0xa2f1('0x45')](handleError(_0x41cdbe,null));};exports['update']=function(_0x3b0bca,_0x976b){if(_0x3b0bca[_0xa2f1('0x4b')]['id']){delete _0x3b0bca[_0xa2f1('0x4b')]['id'];}return db[_0xa2f1('0x41')][_0xa2f1('0x49')]({'where':{'id':_0x3b0bca[_0xa2f1('0x47')]['id']}})[_0xa2f1('0x26')](handleEntityNotFound(_0x976b,null))[_0xa2f1('0x26')](saveUpdates(_0x3b0bca[_0xa2f1('0x4b')],null))[_0xa2f1('0x26')](respondWithResult(_0x976b,null))[_0xa2f1('0x45')](handleError(_0x976b,null));};exports[_0xa2f1('0x27')]=function(_0xa07200,_0x54adbc){return db[_0xa2f1('0x41')][_0xa2f1('0x49')]({'where':{'id':_0xa07200[_0xa2f1('0x47')]['id']}})[_0xa2f1('0x26')](handleEntityNotFound(_0x54adbc,null))[_0xa2f1('0x26')](removeEntity(_0x54adbc,null))['catch'](handleError(_0x54adbc,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 67b02f2..4de8dce 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 _0xac72=['path','../../config/environment','exports','define','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4632c2,_0x385d92){var _0x3d969c=function(_0x5d5222){while(--_0x5d5222){_0x4632c2['push'](_0x4632c2['shift']());}};_0x3d969c(++_0x385d92);}(_0xac72,0x186));var _0x2ac7=function(_0x251b4b,_0x41d712){_0x251b4b=_0x251b4b-0x0;var _0x4c57ea=_0xac72[_0x251b4b];return _0x4c57ea;};'use strict';var _=require(_0x2ac7('0x0'));var util=require(_0x2ac7('0x1'));var logger=require(_0x2ac7('0x2'))(_0x2ac7('0x3'));var moment=require(_0x2ac7('0x4'));var BPromise=require(_0x2ac7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ac7('0x6'));var rimraf=require('rimraf');var config=require(_0x2ac7('0x7'));var attributes=require('./analyticMetric.attributes');module[_0x2ac7('0x8')]=function(_0x231225,_0x538123){return _0x231225[_0x2ac7('0x9')]('AnalyticMetric',attributes,{'tableName':_0x2ac7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19ba=['path','rimraf','./analyticMetric.attributes','exports','define','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x19ba,0x131));var _0xa19b=function(_0x551be0,_0x3372c1){_0x551be0=_0x551be0-0x0;var _0x112d08=_0x19ba[_0x551be0];return _0x112d08;};'use strict';var _=require('lodash');var util=require(_0xa19b('0x0'));var logger=require(_0xa19b('0x1'))(_0xa19b('0x2'));var moment=require('moment');var BPromise=require(_0xa19b('0x3'));var rp=require(_0xa19b('0x4'));var fs=require('fs');var path=require(_0xa19b('0x5'));var rimraf=require(_0xa19b('0x6'));var config=require('../../config/environment');var attributes=require(_0xa19b('0x7'));module[_0xa19b('0x8')]=function(_0x34992f,_0x26ee4a){return _0x34992f[_0xa19b('0x9')]('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 3e84bd0..a989ffd 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 _0x72eb=['AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','info','request\x20sent','debug'];(function(_0xd40ade,_0x49bf07){var _0xc7bc65=function(_0x44dd6f){while(--_0x44dd6f){_0xd40ade['push'](_0xd40ade['shift']());}};_0xc7bc65(++_0x49bf07);}(_0x72eb,0x15b));var _0xb72e=function(_0x169f33,_0x26d892){_0x169f33=_0x169f33-0x0;var _0x4f0ce9=_0x72eb[_0x169f33];return _0x4f0ce9;};'use strict';var _=require(_0xb72e('0x0'));var util=require(_0xb72e('0x1'));var moment=require(_0xb72e('0x2'));var BPromise=require(_0xb72e('0x3'));var rs=require(_0xb72e('0x4'));var fs=require('fs');var Redis=require(_0xb72e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb72e('0x6'));var logger=require(_0xb72e('0x7'))(_0xb72e('0x8'));var config=require(_0xb72e('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x285bb9,_0x2744ed,_0x5115ab){return new BPromise(function(_0x428edd,_0xf9e985){return client['request'](_0x285bb9,_0x5115ab)['then'](function(_0x4a7c68){logger[_0xb72e('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x2744ed,_0xb72e('0xb'));logger[_0xb72e('0xc')](_0xb72e('0xd'),_0x2744ed,_0xb72e('0xb'),JSON[_0xb72e('0xe')](_0x4a7c68));if(_0x4a7c68[_0xb72e('0xf')]){if(_0x4a7c68['error'][_0xb72e('0x10')]===0x1f4){logger[_0xb72e('0xf')](_0xb72e('0x11'),_0x2744ed,_0x4a7c68[_0xb72e('0xf')]['message']);return _0xf9e985(_0x4a7c68['error']['message']);}logger[_0xb72e('0xf')](_0xb72e('0x11'),_0x2744ed,_0x4a7c68[_0xb72e('0xf')][_0xb72e('0x12')]);return _0x428edd(_0x4a7c68[_0xb72e('0xf')][_0xb72e('0x12')]);}else{logger[_0xb72e('0xa')](_0xb72e('0x11'),_0x2744ed,_0xb72e('0xb'));_0x428edd(_0x4a7c68['result'][_0xb72e('0x12')]);}})[_0xb72e('0x13')](function(_0x4bca7f){logger[_0xb72e('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x2744ed,_0x4bca7f);_0xf9e985(_0x4bca7f);});});} \ No newline at end of file +var _0xebf3=['http','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x4db713,_0x240f07){var _0x5c719a=function(_0x142c5a){while(--_0x142c5a){_0x4db713['push'](_0x4db713['shift']());}};_0x5c719a(++_0x240f07);}(_0xebf3,0x1b0));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 rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3ebf('0x3'));var db=require(_0x3ebf('0x4'))['db'];var utils=require(_0x3ebf('0x5'));var logger=require(_0x3ebf('0x6'))('rpc');var config=require(_0x3ebf('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3ebf('0x8')][_0x3ebf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x715ea2,_0x1e045c,_0x1877b9){return new BPromise(function(_0x518fbd,_0x13f84b){return client['request'](_0x715ea2,_0x1877b9)[_0x3ebf('0xa')](function(_0x4c8213){logger['info'](_0x3ebf('0xb'),_0x1e045c,_0x3ebf('0xc'));logger[_0x3ebf('0xd')](_0x3ebf('0xe'),_0x1e045c,'request\x20sent',JSON[_0x3ebf('0xf')](_0x4c8213));if(_0x4c8213[_0x3ebf('0x10')]){if(_0x4c8213[_0x3ebf('0x10')][_0x3ebf('0x11')]===0x1f4){logger[_0x3ebf('0x10')](_0x3ebf('0xb'),_0x1e045c,_0x4c8213['error'][_0x3ebf('0x12')]);return _0x13f84b(_0x4c8213['error'][_0x3ebf('0x12')]);}logger[_0x3ebf('0x10')](_0x3ebf('0xb'),_0x1e045c,_0x4c8213[_0x3ebf('0x10')]['message']);return _0x518fbd(_0x4c8213['error'][_0x3ebf('0x12')]);}else{logger[_0x3ebf('0x13')](_0x3ebf('0xb'),_0x1e045c,_0x3ebf('0xc'));_0x518fbd(_0x4c8213['result'][_0x3ebf('0x12')]);}})[_0x3ebf('0x14')](function(_0x523b22){logger[_0x3ebf('0x10')](_0x3ebf('0xb'),_0x1e045c,_0x523b22);_0x13f84b(_0x523b22);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 8861dfa..df6bf67 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 _0x2542=['exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy'];(function(_0x21ba39,_0x413046){var _0x7a1e4f=function(_0x734831){while(--_0x734831){_0x21ba39['push'](_0x21ba39['shift']());}};_0x7a1e4f(++_0x413046);}(_0x2542,0x169));var _0x2254=function(_0x40c2fe,_0x560efc){_0x40c2fe=_0x40c2fe-0x0;var _0x215126=_0x2542[_0x40c2fe];return _0x215126;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2254('0x5'));var config=require(_0x2254('0x6'));var controller=require(_0x2254('0x7'));router[_0x2254('0x8')]('/',auth[_0x2254('0x9')](),controller['index']);router[_0x2254('0x8')](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0xb')]);router[_0x2254('0xc')]('/',auth[_0x2254('0x9')](),controller[_0x2254('0xd')]);router[_0x2254('0xe')](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0xf')]);router['delete'](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0x10')]);module[_0x2254('0x11')]=router; \ No newline at end of file +var _0x2675=['post','put','update','delete','exports','multer','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x251732,_0x1626ef){var _0x112ef7=function(_0x3657de){while(--_0x3657de){_0x251732['push'](_0x251732['shift']());}};_0x112ef7(++_0x1626ef);}(_0x2675,0x75));var _0x5267=function(_0x22a6e5,_0x2cb524){_0x22a6e5=_0x22a6e5-0x0;var _0x30abde=_0x2675[_0x22a6e5];return _0x30abde;};'use strict';var multer=require(_0x5267('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5267('0x1'));var router=express[_0x5267('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x5267('0x3'));var config=require(_0x5267('0x4'));var controller=require('./analyticMetric.controller');router[_0x5267('0x5')]('/',auth[_0x5267('0x6')](),controller[_0x5267('0x7')]);router[_0x5267('0x5')](_0x5267('0x8'),auth[_0x5267('0x6')](),controller['show']);router[_0x5267('0x9')]('/',auth[_0x5267('0x6')](),controller['create']);router[_0x5267('0xa')]('/:id',auth[_0x5267('0x6')](),controller[_0x5267('0xb')]);router[_0x5267('0xc')]('/:id',auth[_0x5267('0x6')](),controller['destroy']);module[_0x5267('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 352a84b..e5e7994 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 _0x452a=['exports','sequelize'];(function(_0x9d11b3,_0x3c9d3a){var _0x14f25f=function(_0x5627cc){while(--_0x5627cc){_0x9d11b3['push'](_0x9d11b3['shift']());}};_0x14f25f(++_0x3c9d3a);}(_0x452a,0x12d));var _0xa452=function(_0x333fc8,_0x2b292c){_0x333fc8=_0x333fc8-0x0;var _0x432439=_0x452a[_0x333fc8];return _0x432439;};'use strict';var Sequelize=require(_0xa452('0x0'));module[_0xa452('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0xa04d=['sequelize','TEXT'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xa04d,0x1a6));var _0xda04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa04d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xda04('0x0'));module['exports']={'tree':{'type':Sequelize[_0xda04('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 1849fa1..cec8621 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 _0xf5c5=['to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','index','AnalyticTreeReport','fieldName','type','key','map','query','keys','filters','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','intersection','params','find','html-pdf','eml-format','rimraf','zip-dir','mustache','ejs','squel','crypto','desk.js'];(function(_0x5cad4d,_0x7b9470){var _0x3c7cef=function(_0x5b372b){while(--_0x5b372b){_0x5cad4d['push'](_0x5cad4d['shift']());}};_0x3c7cef(++_0x7b9470);}(_0xf5c5,0x132));var _0x5f5c=function(_0x1de474,_0xa0ecb6){_0x1de474=_0x1de474-0x0;var _0x59f631=_0xf5c5[_0x1de474];return _0x59f631;};'use strict';var pdf=require(_0x5f5c('0x0'));var emlformat=require(_0x5f5c('0x1'));var rimraf=require(_0x5f5c('0x2'));var zipdir=require(_0x5f5c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5f5c('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5f5c('0x5'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5f5c('0x6'));var crypto=require(_0x5f5c('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x5f5c('0x8'));var toCsv=require(_0x5f5c('0x9'));var querystring=require('querystring');var Papa=require(_0x5f5c('0xa'));var Redis=require(_0x5f5c('0xb'));var authService=require(_0x5f5c('0xc'));var qs=require(_0x5f5c('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5f5c('0xe'));var logger=require('../../config/logger')(_0x5f5c('0xf'));var utils=require('../../config/utils');var config=require(_0x5f5c('0x10'));var licenseUtil=require(_0x5f5c('0x11'));var db=require(_0x5f5c('0x12'))['db'];function respondWithStatusCode(_0x672af9,_0x5e1840){_0x5e1840=_0x5e1840||0xcc;return function(_0x5589d4){if(_0x5589d4){return _0x672af9[_0x5f5c('0x13')](_0x5e1840);}return _0x672af9[_0x5f5c('0x14')](_0x5e1840)[_0x5f5c('0x15')]();};}function respondWithResult(_0x5ac72c,_0x55838e){_0x55838e=_0x55838e||0xc8;return function(_0x5b4ca4){if(_0x5b4ca4){return _0x5ac72c[_0x5f5c('0x14')](_0x55838e)[_0x5f5c('0x16')](_0x5b4ca4);}};}function respondWithFilteredResult(_0x11dc1e,_0x167bfa){return function(_0x1ee33b){if(_0x1ee33b){var _0x49fd70=_0x1ee33b[_0x5f5c('0x17')],_0x452264=_0x167bfa[_0x5f5c('0x18')],_0x2e4fef=_0x167bfa[_0x5f5c('0x18')]+_0x167bfa[_0x5f5c('0x19')],_0x354e74;if(_0x2e4fef>=_0x49fd70){_0x2e4fef=_0x49fd70;_0x354e74=0xc8;}else{_0x354e74=0xce;}_0x11dc1e[_0x5f5c('0x14')](_0x354e74);return _0x11dc1e['set'](_0x5f5c('0x1a'),_0x452264+'-'+_0x2e4fef+'/'+_0x49fd70)[_0x5f5c('0x16')](_0x1ee33b);}return null;};}function patchUpdates(_0x33cee3){return function(_0x14c666){try{jsonpatch['apply'](_0x14c666,_0x33cee3,!![]);}catch(_0x26cf73){return BPromise[_0x5f5c('0x1b')](_0x26cf73);}return _0x14c666[_0x5f5c('0x1c')]();};}function saveUpdates(_0x2f3a46,_0x240b52){return function(_0x23ec57){if(_0x23ec57){return _0x23ec57[_0x5f5c('0x1d')](_0x2f3a46)[_0x5f5c('0x1e')](function(_0x3d6466){return _0x3d6466;});}return null;};}function removeEntity(_0x5e4b61,_0x3c62d7){return function(_0xbb32eb){if(_0xbb32eb){return _0xbb32eb[_0x5f5c('0x1f')]()[_0x5f5c('0x1e')](function(){_0x5e4b61[_0x5f5c('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc0d202,_0x427fc5){return function(_0x256c03){if(!_0x256c03){_0xc0d202[_0x5f5c('0x13')](0x194);}return _0x256c03;};}function handleError(_0x2df899,_0x3bd8f7){_0x3bd8f7=_0x3bd8f7||0x1f4;return function(_0x1446e1){logger[_0x5f5c('0x20')](_0x1446e1[_0x5f5c('0x21')]);if(_0x1446e1['name']){delete _0x1446e1[_0x5f5c('0x22')];}_0x2df899[_0x5f5c('0x14')](_0x3bd8f7)['send'](_0x1446e1);};}exports[_0x5f5c('0x23')]=function(_0x24b73c,_0x26038f){var _0x393a17={},_0x3f321a={},_0x4ba624={'count':0x0,'rows':[]};var _0x1ce1d4=_['map'](db[_0x5f5c('0x24')]['rawAttributes'],function(_0x13241e){return{'name':_0x13241e[_0x5f5c('0x25')],'type':_0x13241e[_0x5f5c('0x26')][_0x5f5c('0x27')]};});_0x3f321a['model']=_[_0x5f5c('0x28')](_0x1ce1d4,_0x5f5c('0x22'));_0x3f321a[_0x5f5c('0x29')]=_[_0x5f5c('0x2a')](_0x24b73c[_0x5f5c('0x29')]);_0x3f321a[_0x5f5c('0x2b')]=_['intersection'](_0x3f321a[_0x5f5c('0x2c')],_0x3f321a['query']);_0x393a17[_0x5f5c('0x2d')]=_['intersection'](_0x3f321a[_0x5f5c('0x2c')],qs[_0x5f5c('0x2e')](_0x24b73c[_0x5f5c('0x29')]['fields']));_0x393a17[_0x5f5c('0x2d')]=_0x393a17['attributes'][_0x5f5c('0x2f')]?_0x393a17[_0x5f5c('0x2d')]:_0x3f321a[_0x5f5c('0x2c')];if(!_0x24b73c[_0x5f5c('0x29')]['hasOwnProperty'](_0x5f5c('0x30'))){_0x393a17['limit']=qs['limit'](_0x24b73c[_0x5f5c('0x29')][_0x5f5c('0x19')]);_0x393a17[_0x5f5c('0x18')]=qs[_0x5f5c('0x18')](_0x24b73c[_0x5f5c('0x29')]['offset']);}_0x393a17[_0x5f5c('0x31')]=qs[_0x5f5c('0x32')](_0x24b73c[_0x5f5c('0x29')][_0x5f5c('0x32')]);_0x393a17[_0x5f5c('0x33')]=qs[_0x5f5c('0x2b')](_['pick'](_0x24b73c[_0x5f5c('0x29')],_0x3f321a[_0x5f5c('0x2b')]),_0x1ce1d4);if(_0x24b73c[_0x5f5c('0x29')][_0x5f5c('0x34')]){_0x393a17['where']=_[_0x5f5c('0x35')](_0x393a17[_0x5f5c('0x33')],{'$or':_[_0x5f5c('0x28')](_0x1ce1d4,function(_0x517ee3){if(_0x517ee3['type']!==_0x5f5c('0x36')){var _0x5aaac5={};_0x5aaac5[_0x517ee3[_0x5f5c('0x22')]]={'$like':'%'+_0x24b73c['query'][_0x5f5c('0x34')]+'%'};return _0x5aaac5;}})});}_0x393a17=_['merge']({},_0x393a17,_0x24b73c[_0x5f5c('0x37')]);var _0x298928={'where':_0x393a17['where']};return db[_0x5f5c('0x24')][_0x5f5c('0x17')](_0x298928)[_0x5f5c('0x1e')](function(_0x463f10){_0x4ba624['count']=_0x463f10;if(_0x24b73c[_0x5f5c('0x29')]['includeAll']){_0x393a17[_0x5f5c('0x38')]=[{'all':!![]}];}return db[_0x5f5c('0x24')][_0x5f5c('0x39')](_0x393a17);})[_0x5f5c('0x1e')](function(_0x3bead8){_0x4ba624['rows']=_0x3bead8;return _0x4ba624;})['then'](respondWithFilteredResult(_0x26038f,_0x393a17))[_0x5f5c('0x3a')](handleError(_0x26038f,null));};exports[_0x5f5c('0x3b')]=function(_0x2f7470,_0x12fd28){var _0x1d2644={'raw':!![],'where':{'id':_0x2f7470['params']['id']}},_0x8d628={};_0x8d628[_0x5f5c('0x2c')]=_[_0x5f5c('0x2a')](db['AnalyticTreeReport']['rawAttributes']);_0x8d628[_0x5f5c('0x29')]=_[_0x5f5c('0x2a')](_0x2f7470[_0x5f5c('0x29')]);_0x8d628['filters']=_[_0x5f5c('0x3c')](_0x8d628['model'],_0x8d628['query']);_0x1d2644[_0x5f5c('0x2d')]=_['intersection'](_0x8d628[_0x5f5c('0x2c')],qs[_0x5f5c('0x2e')](_0x2f7470[_0x5f5c('0x29')]['fields']));_0x1d2644[_0x5f5c('0x2d')]=_0x1d2644['attributes']['length']?_0x1d2644[_0x5f5c('0x2d')]:_0x8d628[_0x5f5c('0x2c')];if(_0x2f7470[_0x5f5c('0x29')]['includeAll']){_0x1d2644['include']=[{'all':!![]}];}_0x1d2644=_[_0x5f5c('0x35')]({},_0x1d2644,_0x2f7470[_0x5f5c('0x37')]);return db[_0x5f5c('0x24')]['find'](_0x1d2644)[_0x5f5c('0x1e')](handleEntityNotFound(_0x12fd28,null))[_0x5f5c('0x1e')](respondWithResult(_0x12fd28,null))[_0x5f5c('0x3a')](handleError(_0x12fd28,null));};exports['create']=function(_0x17494c,_0x274e48){return db[_0x5f5c('0x24')]['create'](_0x17494c['body'],{})['then'](respondWithResult(_0x274e48,0xc9))[_0x5f5c('0x3a')](handleError(_0x274e48,null));};exports[_0x5f5c('0x1d')]=function(_0x3d7051,_0x264452){if(_0x3d7051['body']['id']){delete _0x3d7051['body']['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x3d7051[_0x5f5c('0x3d')]['id']}})['then'](handleEntityNotFound(_0x264452,null))[_0x5f5c('0x1e')](saveUpdates(_0x3d7051['body'],null))[_0x5f5c('0x1e')](respondWithResult(_0x264452,null))[_0x5f5c('0x3a')](handleError(_0x264452,null));};exports[_0x5f5c('0x1f')]=function(_0x52809b,_0x107d9b){return db[_0x5f5c('0x24')][_0x5f5c('0x3e')]({'where':{'id':_0x52809b['params']['id']}})[_0x5f5c('0x1e')](handleEntityNotFound(_0x107d9b,null))[_0x5f5c('0x1e')](removeEntity(_0x107d9b,null))[_0x5f5c('0x3a')](handleError(_0x107d9b,null));}; \ No newline at end of file +var _0x5455=['save','then','destroy','error','stack','name','send','map','AnalyticTreeReport','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','create','body','catch','update','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject'];(function(_0x392368,_0x1e14a5){var _0x33efe7=function(_0x385d1a){while(--_0x385d1a){_0x392368['push'](_0x392368['shift']());}};_0x33efe7(++_0x1e14a5);}(_0x5455,0x18c));var _0x5545=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x5455[_0x1d1779];return _0x2377e9;};'use strict';var pdf=require(_0x5545('0x0'));var emlformat=require(_0x5545('0x1'));var rimraf=require(_0x5545('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5545('0x3'));var moment=require(_0x5545('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5545('0x5'));var util=require(_0x5545('0x6'));var path=require(_0x5545('0x7'));var sox=require(_0x5545('0x8'));var csv=require(_0x5545('0x9'));var ejs=require(_0x5545('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5545('0xb'));var jsforce=require(_0x5545('0xc'));var deskjs=require(_0x5545('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5545('0xe'));var authService=require(_0x5545('0xf'));var qs=require(_0x5545('0x10'));var as=require(_0x5545('0x11'));var hardwareService=require(_0x5545('0x12'));var logger=require('../../config/logger')(_0x5545('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x119afe,_0x26b5d2){_0x26b5d2=_0x26b5d2||0xcc;return function(_0xbb60b4){if(_0xbb60b4){return _0x119afe[_0x5545('0x14')](_0x26b5d2);}return _0x119afe[_0x5545('0x15')](_0x26b5d2)[_0x5545('0x16')]();};}function respondWithResult(_0x56390e,_0x1116d5){_0x1116d5=_0x1116d5||0xc8;return function(_0x380c7d){if(_0x380c7d){return _0x56390e[_0x5545('0x15')](_0x1116d5)[_0x5545('0x17')](_0x380c7d);}};}function respondWithFilteredResult(_0x1474bb,_0x50189c){return function(_0x2a6aaa){if(_0x2a6aaa){var _0x570a66=_0x2a6aaa[_0x5545('0x18')],_0x429962=_0x50189c[_0x5545('0x19')],_0xd88f19=_0x50189c[_0x5545('0x19')]+_0x50189c['limit'],_0x1994f8;if(_0xd88f19>=_0x570a66){_0xd88f19=_0x570a66;_0x1994f8=0xc8;}else{_0x1994f8=0xce;}_0x1474bb[_0x5545('0x15')](_0x1994f8);return _0x1474bb[_0x5545('0x1a')](_0x5545('0x1b'),_0x429962+'-'+_0xd88f19+'/'+_0x570a66)[_0x5545('0x17')](_0x2a6aaa);}return null;};}function patchUpdates(_0x555af4){return function(_0x2f1733){try{jsonpatch[_0x5545('0x1c')](_0x2f1733,_0x555af4,!![]);}catch(_0x17e964){return BPromise[_0x5545('0x1d')](_0x17e964);}return _0x2f1733[_0x5545('0x1e')]();};}function saveUpdates(_0x2701dc,_0x116df0){return function(_0x23c6f5){if(_0x23c6f5){return _0x23c6f5['update'](_0x2701dc)[_0x5545('0x1f')](function(_0x4272ea){return _0x4272ea;});}return null;};}function removeEntity(_0x422b16,_0x44d629){return function(_0x1da3b0){if(_0x1da3b0){return _0x1da3b0[_0x5545('0x20')]()[_0x5545('0x1f')](function(){_0x422b16['status'](0xcc)[_0x5545('0x16')]();});}};}function handleEntityNotFound(_0x18c9f0,_0x5332c1){return function(_0x121902){if(!_0x121902){_0x18c9f0[_0x5545('0x14')](0x194);}return _0x121902;};}function handleError(_0x5d6a55,_0x3e6042){_0x3e6042=_0x3e6042||0x1f4;return function(_0xc3d917){logger[_0x5545('0x21')](_0xc3d917[_0x5545('0x22')]);if(_0xc3d917[_0x5545('0x23')]){delete _0xc3d917[_0x5545('0x23')];}_0x5d6a55[_0x5545('0x15')](_0x3e6042)[_0x5545('0x24')](_0xc3d917);};}exports['index']=function(_0x45db30,_0x22e1d3){var _0x482ecb={},_0x1f1c7a={},_0x8b4c5e={'count':0x0,'rows':[]};var _0x54395a=_[_0x5545('0x25')](db[_0x5545('0x26')][_0x5545('0x27')],function(_0xcc516d){return{'name':_0xcc516d['fieldName'],'type':_0xcc516d[_0x5545('0x28')][_0x5545('0x29')]};});_0x1f1c7a['model']=_[_0x5545('0x25')](_0x54395a,_0x5545('0x23'));_0x1f1c7a[_0x5545('0x2a')]=_['keys'](_0x45db30[_0x5545('0x2a')]);_0x1f1c7a[_0x5545('0x2b')]=_[_0x5545('0x2c')](_0x1f1c7a[_0x5545('0x2d')],_0x1f1c7a[_0x5545('0x2a')]);_0x482ecb[_0x5545('0x2e')]=_[_0x5545('0x2c')](_0x1f1c7a[_0x5545('0x2d')],qs['fields'](_0x45db30[_0x5545('0x2a')][_0x5545('0x2f')]));_0x482ecb[_0x5545('0x2e')]=_0x482ecb[_0x5545('0x2e')][_0x5545('0x30')]?_0x482ecb[_0x5545('0x2e')]:_0x1f1c7a[_0x5545('0x2d')];if(!_0x45db30[_0x5545('0x2a')][_0x5545('0x31')](_0x5545('0x32'))){_0x482ecb[_0x5545('0x33')]=qs[_0x5545('0x33')](_0x45db30[_0x5545('0x2a')][_0x5545('0x33')]);_0x482ecb['offset']=qs[_0x5545('0x19')](_0x45db30['query'][_0x5545('0x19')]);}_0x482ecb[_0x5545('0x34')]=qs[_0x5545('0x35')](_0x45db30[_0x5545('0x2a')][_0x5545('0x35')]);_0x482ecb['where']=qs[_0x5545('0x2b')](_[_0x5545('0x36')](_0x45db30[_0x5545('0x2a')],_0x1f1c7a[_0x5545('0x2b')]),_0x54395a);if(_0x45db30[_0x5545('0x2a')][_0x5545('0x37')]){_0x482ecb[_0x5545('0x38')]=_[_0x5545('0x39')](_0x482ecb[_0x5545('0x38')],{'$or':_['map'](_0x54395a,function(_0x2b0c62){if(_0x2b0c62[_0x5545('0x28')]!==_0x5545('0x3a')){var _0x5e40d0={};_0x5e40d0[_0x2b0c62[_0x5545('0x23')]]={'$like':'%'+_0x45db30[_0x5545('0x2a')][_0x5545('0x37')]+'%'};return _0x5e40d0;}})});}_0x482ecb=_[_0x5545('0x39')]({},_0x482ecb,_0x45db30[_0x5545('0x3b')]);var _0x4a3ff2={'where':_0x482ecb[_0x5545('0x38')]};return db[_0x5545('0x26')][_0x5545('0x18')](_0x4a3ff2)['then'](function(_0x1968e3){_0x8b4c5e[_0x5545('0x18')]=_0x1968e3;if(_0x45db30[_0x5545('0x2a')][_0x5545('0x3c')]){_0x482ecb[_0x5545('0x3d')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x5545('0x3e')](_0x482ecb);})[_0x5545('0x1f')](function(_0x1e9561){_0x8b4c5e[_0x5545('0x3f')]=_0x1e9561;return _0x8b4c5e;})[_0x5545('0x1f')](respondWithFilteredResult(_0x22e1d3,_0x482ecb))['catch'](handleError(_0x22e1d3,null));};exports['show']=function(_0x1e7245,_0x56480d){var _0x54146={'raw':!![],'where':{'id':_0x1e7245[_0x5545('0x40')]['id']}},_0x3030ae={};_0x3030ae[_0x5545('0x2d')]=_[_0x5545('0x41')](db[_0x5545('0x26')]['rawAttributes']);_0x3030ae[_0x5545('0x2a')]=_[_0x5545('0x41')](_0x1e7245['query']);_0x3030ae[_0x5545('0x2b')]=_[_0x5545('0x2c')](_0x3030ae[_0x5545('0x2d')],_0x3030ae[_0x5545('0x2a')]);_0x54146['attributes']=_[_0x5545('0x2c')](_0x3030ae[_0x5545('0x2d')],qs['fields'](_0x1e7245['query'][_0x5545('0x2f')]));_0x54146[_0x5545('0x2e')]=_0x54146['attributes'][_0x5545('0x30')]?_0x54146['attributes']:_0x3030ae['model'];if(_0x1e7245['query'][_0x5545('0x3c')]){_0x54146[_0x5545('0x3d')]=[{'all':!![]}];}_0x54146=_[_0x5545('0x39')]({},_0x54146,_0x1e7245[_0x5545('0x3b')]);return db['AnalyticTreeReport'][_0x5545('0x42')](_0x54146)[_0x5545('0x1f')](handleEntityNotFound(_0x56480d,null))[_0x5545('0x1f')](respondWithResult(_0x56480d,null))['catch'](handleError(_0x56480d,null));};exports[_0x5545('0x43')]=function(_0x2e27ee,_0x5bc8fa){return db[_0x5545('0x26')][_0x5545('0x43')](_0x2e27ee[_0x5545('0x44')],{})[_0x5545('0x1f')](respondWithResult(_0x5bc8fa,0xc9))[_0x5545('0x45')](handleError(_0x5bc8fa,null));};exports[_0x5545('0x46')]=function(_0x50f5ad,_0x579817){if(_0x50f5ad[_0x5545('0x44')]['id']){delete _0x50f5ad['body']['id'];}return db['AnalyticTreeReport'][_0x5545('0x42')]({'where':{'id':_0x50f5ad[_0x5545('0x40')]['id']}})[_0x5545('0x1f')](handleEntityNotFound(_0x579817,null))[_0x5545('0x1f')](saveUpdates(_0x50f5ad[_0x5545('0x44')],null))[_0x5545('0x1f')](respondWithResult(_0x579817,null))[_0x5545('0x45')](handleError(_0x579817,null));};exports['destroy']=function(_0x405981,_0x171986){return db[_0x5545('0x26')][_0x5545('0x42')]({'where':{'id':_0x405981['params']['id']}})[_0x5545('0x1f')](handleEntityNotFound(_0x171986,null))[_0x5545('0x1f')](removeEntity(_0x171986,null))[_0x5545('0x45')](handleError(_0x171986,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index a97bd47..10fda92 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 _0x4ccb=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','AnalyticTreeReport','analytics_report_trees','lodash'];(function(_0x6e8e3e,_0x372fb7){var _0x1e8406=function(_0x18418f){while(--_0x18418f){_0x6e8e3e['push'](_0x6e8e3e['shift']());}};_0x1e8406(++_0x372fb7);}(_0x4ccb,0x196));var _0xb4cc=function(_0x488bad,_0x41351f){_0x488bad=_0x488bad-0x0;var _0x4e7302=_0x4ccb[_0x488bad];return _0x4e7302;};'use strict';var _=require(_0xb4cc('0x0'));var util=require(_0xb4cc('0x1'));var logger=require(_0xb4cc('0x2'))('api');var moment=require(_0xb4cc('0x3'));var BPromise=require(_0xb4cc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb4cc('0x5'));var rimraf=require(_0xb4cc('0x6'));var config=require(_0xb4cc('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0xb4cc('0x8')]=function(_0x2181b2,_0x1e19dd){return _0x2181b2['define'](_0xb4cc('0x9'),attributes,{'tableName':_0xb4cc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xad40=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util'];(function(_0xc6bb16,_0x21f1ae){var _0x5a3155=function(_0x1f5684){while(--_0x1f5684){_0xc6bb16['push'](_0xc6bb16['shift']());}};_0x5a3155(++_0x21f1ae);}(_0xad40,0xfa));var _0x0ad4=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xad40[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x0ad4('0x0'));var util=require(_0x0ad4('0x1'));var logger=require(_0x0ad4('0x2'))(_0x0ad4('0x3'));var moment=require('moment');var BPromise=require(_0x0ad4('0x4'));var rp=require(_0x0ad4('0x5'));var fs=require('fs');var path=require(_0x0ad4('0x6'));var rimraf=require(_0x0ad4('0x7'));var config=require(_0x0ad4('0x8'));var attributes=require(_0x0ad4('0x9'));module[_0x0ad4('0xa')]=function(_0x4ec948,_0x1a074c){return _0x4ec948[_0x0ad4('0xb')](_0x0ad4('0xc'),attributes,{'tableName':_0x0ad4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 73c48de..57966ce 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 _0x4128=['message','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x18c89b,_0x10b2c4){var _0x46c8bb=function(_0x28d7ca){while(--_0x28d7ca){_0x18c89b['push'](_0x18c89b['shift']());}};_0x46c8bb(++_0x10b2c4);}(_0x4128,0xc8));var _0x8412=function(_0xa65ae3,_0x25b2f1){_0xa65ae3=_0xa65ae3-0x0;var _0x59743d=_0x4128[_0xa65ae3];return _0x59743d;};'use strict';var _=require(_0x8412('0x0'));var util=require(_0x8412('0x1'));var moment=require('moment');var BPromise=require(_0x8412('0x2'));var rs=require(_0x8412('0x3'));var fs=require('fs');var Redis=require(_0x8412('0x4'));var db=require(_0x8412('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8412('0x6'))(_0x8412('0x7'));var config=require(_0x8412('0x8'));var jayson=require(_0x8412('0x9'));var client=jayson[_0x8412('0xa')][_0x8412('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40b7b6,_0x537fbc,_0x2e5403){return new BPromise(function(_0x1efa09,_0x1fc7c6){return client[_0x8412('0xc')](_0x40b7b6,_0x2e5403)[_0x8412('0xd')](function(_0x4f5c71){logger['info'](_0x8412('0xe'),_0x537fbc,_0x8412('0xf'));logger[_0x8412('0x10')](_0x8412('0x11'),_0x537fbc,_0x8412('0xf'),JSON['stringify'](_0x4f5c71));if(_0x4f5c71[_0x8412('0x12')]){if(_0x4f5c71['error'][_0x8412('0x13')]===0x1f4){logger['error'](_0x8412('0xe'),_0x537fbc,_0x4f5c71[_0x8412('0x12')][_0x8412('0x14')]);return _0x1fc7c6(_0x4f5c71[_0x8412('0x12')][_0x8412('0x14')]);}logger[_0x8412('0x12')](_0x8412('0xe'),_0x537fbc,_0x4f5c71['error'][_0x8412('0x14')]);return _0x1efa09(_0x4f5c71[_0x8412('0x12')][_0x8412('0x14')]);}else{logger[_0x8412('0x15')]('AnalyticTreeReport,\x20%s,\x20%s',_0x537fbc,_0x8412('0xf'));_0x1efa09(_0x4f5c71['result'][_0x8412('0x14')]);}})['catch'](function(_0x362686){logger[_0x8412('0x12')](_0x8412('0xe'),_0x537fbc,_0x362686);_0x1fc7c6(_0x362686);});});} \ No newline at end of file +var _0xe9f7=['AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x540b17,_0x2ee988){var _0x35f9e5=function(_0x40fc22){while(--_0x40fc22){_0x540b17['push'](_0x540b17['shift']());}};_0x35f9e5(++_0x2ee988);}(_0xe9f7,0x7c));var _0x7e9f=function(_0x13945b,_0x289c94){_0x13945b=_0x13945b-0x0;var _0x1b1643=_0xe9f7[_0x13945b];return _0x1b1643;};'use strict';var _=require(_0x7e9f('0x0'));var util=require(_0x7e9f('0x1'));var moment=require(_0x7e9f('0x2'));var BPromise=require(_0x7e9f('0x3'));var rs=require(_0x7e9f('0x4'));var fs=require('fs');var Redis=require(_0x7e9f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e9f('0x6'));var logger=require(_0x7e9f('0x7'))(_0x7e9f('0x8'));var config=require('../../config/environment');var jayson=require(_0x7e9f('0x9'));var client=jayson[_0x7e9f('0xa')][_0x7e9f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbf9297,_0x429a99,_0x526585){return new BPromise(function(_0x31e39f,_0x3f7305){return client[_0x7e9f('0xc')](_0xbf9297,_0x526585)[_0x7e9f('0xd')](function(_0x4babf4){logger['info'](_0x7e9f('0xe'),_0x429a99,_0x7e9f('0xf'));logger[_0x7e9f('0x10')](_0x7e9f('0x11'),_0x429a99,_0x7e9f('0xf'),JSON[_0x7e9f('0x12')](_0x4babf4));if(_0x4babf4[_0x7e9f('0x13')]){if(_0x4babf4[_0x7e9f('0x13')][_0x7e9f('0x14')]===0x1f4){logger[_0x7e9f('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x429a99,_0x4babf4[_0x7e9f('0x13')]['message']);return _0x3f7305(_0x4babf4[_0x7e9f('0x13')][_0x7e9f('0x15')]);}logger['error'](_0x7e9f('0xe'),_0x429a99,_0x4babf4[_0x7e9f('0x13')][_0x7e9f('0x15')]);return _0x31e39f(_0x4babf4[_0x7e9f('0x13')]['message']);}else{logger['info'](_0x7e9f('0xe'),_0x429a99,_0x7e9f('0xf'));_0x31e39f(_0x4babf4['result']['message']);}})[_0x7e9f('0x16')](function(_0xb1484f){logger['error'](_0x7e9f('0xe'),_0x429a99,_0xb1484f);_0x3f7305(_0xb1484f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index f794f5e..fb2c7b3 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 _0x9f19=['index','get','/:id','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated'];(function(_0x20f34f,_0x32a7dc){var _0x5901a4=function(_0x463917){while(--_0x463917){_0x20f34f['push'](_0x20f34f['shift']());}};_0x5901a4(++_0x32a7dc);}(_0x9f19,0x86));var _0x99f1=function(_0x1cc8fe,_0x34ece5){_0x1cc8fe=_0x1cc8fe-0x0;var _0x461db5=_0x9f19[_0x1cc8fe];return _0x461db5;};'use strict';var multer=require(_0x99f1('0x0'));var util=require(_0x99f1('0x1'));var path=require(_0x99f1('0x2'));var timeout=require(_0x99f1('0x3'));var express=require(_0x99f1('0x4'));var router=express[_0x99f1('0x5')]();var auth=require(_0x99f1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x99f1('0x7'));var controller=require(_0x99f1('0x8'));router['get']('/',auth[_0x99f1('0x9')](),controller[_0x99f1('0xa')]);router[_0x99f1('0xb')](_0x99f1('0xc'),auth[_0x99f1('0x9')](),controller['show']);router[_0x99f1('0xd')]('/',auth[_0x99f1('0x9')](),controller['create']);router[_0x99f1('0xe')](_0x99f1('0xc'),auth['isAuthenticated'](),controller[_0x99f1('0xf')]);router['delete']('/:id',auth[_0x99f1('0x9')](),controller[_0x99f1('0x10')]);module[_0x99f1('0x11')]=router; \ No newline at end of file +var _0x3459=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','/:id','show','put','update','delete','destroy','exports','util'];(function(_0x556452,_0x30f4f7){var _0x496c74=function(_0x221296){while(--_0x221296){_0x556452['push'](_0x556452['shift']());}};_0x496c74(++_0x30f4f7);}(_0x3459,0xba));var _0x9345=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x3459[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require('multer');var util=require(_0x9345('0x0'));var path=require('path');var timeout=require(_0x9345('0x1'));var express=require(_0x9345('0x2'));var router=express[_0x9345('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x9345('0x4'));var config=require(_0x9345('0x5'));var controller=require(_0x9345('0x6'));router['get']('/',auth[_0x9345('0x7')](),controller[_0x9345('0x8')]);router[_0x9345('0x9')](_0x9345('0xa'),auth[_0x9345('0x7')](),controller[_0x9345('0xb')]);router['post']('/',auth[_0x9345('0x7')](),controller['create']);router[_0x9345('0xc')](_0x9345('0xa'),auth[_0x9345('0x7')](),controller[_0x9345('0xd')]);router[_0x9345('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x9345('0xf')]);module[_0x9345('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index bfc40d9..3712caa 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 _0xf60d=['exports','STRING','sequelize'];(function(_0x5dc554,_0x4156ac){var _0x1c767f=function(_0x362b96){while(--_0x362b96){_0x5dc554['push'](_0x5dc554['shift']());}};_0x1c767f(++_0x4156ac);}(_0xf60d,0x158));var _0xdf60=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0xf60d[_0x2283dc];return _0x16db90;};'use strict';var Sequelize=require(_0xdf60('0x0'));module[_0xdf60('0x1')]={'name':{'type':Sequelize[_0xdf60('0x2')]},'basename':{'type':Sequelize[_0xdf60('0x2')]},'type':{'type':Sequelize[_0xdf60('0x2')]}}; \ No newline at end of file +var _0x42a9=['STRING','sequelize'];(function(_0x825d97,_0x4b3fd0){var _0x49b554=function(_0x575234){while(--_0x575234){_0x825d97['push'](_0x825d97['shift']());}};_0x49b554(++_0x4b3fd0);}(_0x42a9,0x147));var _0x942a=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x42a9[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0x942a('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x942a('0x1')]},'type':{'type':Sequelize[_0x942a('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 8a66181..08753e8 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 _0xda02=['filename','file','mimetype','findOne','download','join','root','server/files/attachments/','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','status','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','rawAttributes','type','key','name','query','model','intersection','fields','length','attributes','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Attachment','count','includeAll','include','findAll','rows','catch','show','params','keys','find','clone','get','updatedAt','body','createdAt','create','basename'];(function(_0x41ed13,_0x1044be){var _0x1bb4d5=function(_0x15d224){while(--_0x15d224){_0x41ed13['push'](_0x41ed13['shift']());}};_0x1bb4d5(++_0x1044be);}(_0xda02,0x1a2));var _0x2da0=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xda02[_0x263a74];return _0x2aa86c;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2da0('0x0'));var zipdir=require(_0x2da0('0x1'));var jsonpatch=require(_0x2da0('0x2'));var rp=require(_0x2da0('0x3'));var moment=require('moment');var BPromise=require(_0x2da0('0x4'));var Mustache=require(_0x2da0('0x5'));var util=require(_0x2da0('0x6'));var path=require(_0x2da0('0x7'));var sox=require(_0x2da0('0x8'));var csv=require(_0x2da0('0x9'));var ejs=require(_0x2da0('0xa'));var fs=require('fs');var _=require(_0x2da0('0xb'));var squel=require(_0x2da0('0xc'));var crypto=require(_0x2da0('0xd'));var jsforce=require(_0x2da0('0xe'));var deskjs=require(_0x2da0('0xf'));var toCsv=require(_0x2da0('0x9'));var querystring=require('querystring');var Papa=require(_0x2da0('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2da0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2da0('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x2da0('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2da0('0x14'))['db'];function respondWithStatusCode(_0x531c95,_0xbceb2){_0xbceb2=_0xbceb2||0xcc;return function(_0x5059e2){if(_0x5059e2){return _0x531c95['sendStatus'](_0xbceb2);}return _0x531c95[_0x2da0('0x15')](_0xbceb2)['end']();};}function respondWithResult(_0x7ffc3a,_0xe3b410){_0xe3b410=_0xe3b410||0xc8;return function(_0x4603de){if(_0x4603de){return _0x7ffc3a[_0x2da0('0x15')](_0xe3b410)['json'](_0x4603de);}};}function respondWithFilteredResult(_0x10bbd8,_0x1c439f){return function(_0x1b0fa4){if(_0x1b0fa4){var _0x18b09c=_0x1b0fa4['count'],_0x3c7f75=_0x1c439f['offset'],_0x4367d8=_0x1c439f[_0x2da0('0x16')]+_0x1c439f[_0x2da0('0x17')],_0x33e930;if(_0x4367d8>=_0x18b09c){_0x4367d8=_0x18b09c;_0x33e930=0xc8;}else{_0x33e930=0xce;}_0x10bbd8[_0x2da0('0x15')](_0x33e930);return _0x10bbd8['set'](_0x2da0('0x18'),_0x3c7f75+'-'+_0x4367d8+'/'+_0x18b09c)['json'](_0x1b0fa4);}return null;};}function patchUpdates(_0x4f6d17){return function(_0x488b9d){try{jsonpatch[_0x2da0('0x19')](_0x488b9d,_0x4f6d17,!![]);}catch(_0x470345){return BPromise[_0x2da0('0x1a')](_0x470345);}return _0x488b9d[_0x2da0('0x1b')]();};}function saveUpdates(_0x2c8e2b,_0xd67197){return function(_0x5ddf74){if(_0x5ddf74){return _0x5ddf74[_0x2da0('0x1c')](_0x2c8e2b)[_0x2da0('0x1d')](function(_0x12759e){return _0x12759e;});}return null;};}function removeEntity(_0x4c8893,_0xb7eb4d){return function(_0x2e3068){if(_0x2e3068){return _0x2e3068[_0x2da0('0x1e')]()['then'](function(){_0x4c8893[_0x2da0('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ad443,_0xf6ca){return function(_0x89ef75){if(!_0x89ef75){_0x3ad443[_0x2da0('0x1f')](0x194);}return _0x89ef75;};}function handleError(_0x160d8c,_0x174505){_0x174505=_0x174505||0x1f4;return function(_0x1c0280){logger['error'](_0x1c0280[_0x2da0('0x20')]);if(_0x1c0280['name']){delete _0x1c0280['name'];}_0x160d8c[_0x2da0('0x15')](_0x174505)[_0x2da0('0x21')](_0x1c0280);};}exports[_0x2da0('0x22')]=function(_0x3f1dd2,_0x329c4b){var _0x25ab74={},_0x1365e2={},_0xd9fb97={'count':0x0,'rows':[]};var _0x53cfdb=_[_0x2da0('0x23')](db['Attachment'][_0x2da0('0x24')],function(_0x5b8c3e){return{'name':_0x5b8c3e['fieldName'],'type':_0x5b8c3e[_0x2da0('0x25')][_0x2da0('0x26')]};});_0x1365e2['model']=_['map'](_0x53cfdb,_0x2da0('0x27'));_0x1365e2['query']=_['keys'](_0x3f1dd2[_0x2da0('0x28')]);_0x1365e2['filters']=_['intersection'](_0x1365e2[_0x2da0('0x29')],_0x1365e2[_0x2da0('0x28')]);_0x25ab74['attributes']=_[_0x2da0('0x2a')](_0x1365e2['model'],qs[_0x2da0('0x2b')](_0x3f1dd2['query'][_0x2da0('0x2b')]));_0x25ab74['attributes']=_0x25ab74['attributes'][_0x2da0('0x2c')]?_0x25ab74[_0x2da0('0x2d')]:_0x1365e2[_0x2da0('0x29')];if(!_0x3f1dd2['query']['hasOwnProperty'](_0x2da0('0x2e'))){_0x25ab74[_0x2da0('0x17')]=qs['limit'](_0x3f1dd2[_0x2da0('0x28')][_0x2da0('0x17')]);_0x25ab74['offset']=qs[_0x2da0('0x16')](_0x3f1dd2[_0x2da0('0x28')][_0x2da0('0x16')]);}_0x25ab74[_0x2da0('0x2f')]=qs['sort'](_0x3f1dd2[_0x2da0('0x28')][_0x2da0('0x30')]);_0x25ab74[_0x2da0('0x31')]=qs[_0x2da0('0x32')](_[_0x2da0('0x33')](_0x3f1dd2['query'],_0x1365e2[_0x2da0('0x32')]),_0x53cfdb);if(_0x3f1dd2['query'][_0x2da0('0x34')]){_0x25ab74['where']=_[_0x2da0('0x35')](_0x25ab74[_0x2da0('0x31')],{'$or':_['map'](_0x53cfdb,function(_0xa5152){if(_0xa5152[_0x2da0('0x25')]!==_0x2da0('0x36')){var _0x5ea2ef={};_0x5ea2ef[_0xa5152[_0x2da0('0x27')]]={'$like':'%'+_0x3f1dd2['query'][_0x2da0('0x34')]+'%'};return _0x5ea2ef;}})});}_0x25ab74=_[_0x2da0('0x35')]({},_0x25ab74,_0x3f1dd2[_0x2da0('0x37')]);var _0x32d28c={'where':_0x25ab74[_0x2da0('0x31')]};return db[_0x2da0('0x38')][_0x2da0('0x39')](_0x32d28c)[_0x2da0('0x1d')](function(_0x3f7735){_0xd9fb97[_0x2da0('0x39')]=_0x3f7735;if(_0x3f1dd2[_0x2da0('0x28')][_0x2da0('0x3a')]){_0x25ab74[_0x2da0('0x3b')]=[{'all':!![]}];}return db[_0x2da0('0x38')][_0x2da0('0x3c')](_0x25ab74);})[_0x2da0('0x1d')](function(_0xb1a6d1){_0xd9fb97[_0x2da0('0x3d')]=_0xb1a6d1;return _0xd9fb97;})[_0x2da0('0x1d')](respondWithFilteredResult(_0x329c4b,_0x25ab74))[_0x2da0('0x3e')](handleError(_0x329c4b,null));};exports[_0x2da0('0x3f')]=function(_0x185835,_0x1f5763){var _0x2a0b76={'raw':!![],'where':{'id':_0x185835[_0x2da0('0x40')]['id']}},_0x22b622={};_0x22b622['model']=_['keys'](db[_0x2da0('0x38')][_0x2da0('0x24')]);_0x22b622[_0x2da0('0x28')]=_[_0x2da0('0x41')](_0x185835[_0x2da0('0x28')]);_0x22b622['filters']=_['intersection'](_0x22b622[_0x2da0('0x29')],_0x22b622[_0x2da0('0x28')]);_0x2a0b76[_0x2da0('0x2d')]=_[_0x2da0('0x2a')](_0x22b622[_0x2da0('0x29')],qs['fields'](_0x185835[_0x2da0('0x28')][_0x2da0('0x2b')]));_0x2a0b76['attributes']=_0x2a0b76[_0x2da0('0x2d')][_0x2da0('0x2c')]?_0x2a0b76[_0x2da0('0x2d')]:_0x22b622['model'];if(_0x185835['query']['includeAll']){_0x2a0b76[_0x2da0('0x3b')]=[{'all':!![]}];}_0x2a0b76=_[_0x2da0('0x35')]({},_0x2a0b76,_0x185835[_0x2da0('0x37')]);return db['Attachment'][_0x2da0('0x42')](_0x2a0b76)['then'](handleEntityNotFound(_0x1f5763,null))['then'](respondWithResult(_0x1f5763,null))['catch'](handleError(_0x1f5763,null));};exports[_0x2da0('0x43')]=function(_0x249797,_0x3c9bc9){var _0x499003={'where':{'id':_0x249797['params']['id']}},_0x725d44={};_0x725d44['model']=_[_0x2da0('0x41')](db[_0x2da0('0x38')][_0x2da0('0x24')]);_0x499003['attributes']=_[_0x2da0('0x2a')](_0x725d44[_0x2da0('0x29')],qs[_0x2da0('0x2b')](_0x249797[_0x2da0('0x28')][_0x2da0('0x2b')]));_0x499003[_0x2da0('0x2d')]=_0x499003['attributes'][_0x2da0('0x2c')]?_0x499003[_0x2da0('0x2d')]:_0x725d44[_0x2da0('0x29')];if(_0x249797[_0x2da0('0x28')]['includeAll']){_0x499003[_0x2da0('0x3b')]=[{'all':!![]}];}_0x499003=_[_0x2da0('0x35')]({},_0x499003,_0x249797[_0x2da0('0x37')]);return db[_0x2da0('0x38')][_0x2da0('0x42')](_0x499003)[_0x2da0('0x1d')](handleEntityNotFound(_0x3c9bc9,null))[_0x2da0('0x1d')](function(_0xa69430){if(_0xa69430){var _0x1aeaba=_0xa69430[_0x2da0('0x44')]({'plain':!![]});_0x1aeaba=qs['omit'](_0x1aeaba,['id','createdAt',_0x2da0('0x45')]);_0x249797['body']=_['omit'](_0x249797[_0x2da0('0x46')],['id',_0x2da0('0x47'),_0x2da0('0x45')]);return db['Attachment']['create'](_[_0x2da0('0x35')](_0x1aeaba,_0x249797['body']),{'include':_0x249797['query'][_0x2da0('0x3a')]?[{'all':!![]}]:undefined});}})[_0x2da0('0x1d')](respondWithResult(_0x3c9bc9,0xc9))[_0x2da0('0x3e')](handleError(_0x3c9bc9,null));};exports[_0x2da0('0x1c')]=function(_0x558d15,_0x4ae283){if(_0x558d15[_0x2da0('0x46')]['id']){delete _0x558d15[_0x2da0('0x46')]['id'];}return db[_0x2da0('0x38')][_0x2da0('0x42')]({'where':{'id':_0x558d15['params']['id']}})['then'](handleEntityNotFound(_0x4ae283,null))[_0x2da0('0x1d')](saveUpdates(_0x558d15[_0x2da0('0x46')],null))[_0x2da0('0x1d')](respondWithResult(_0x4ae283,null))[_0x2da0('0x3e')](handleError(_0x4ae283,null));};exports[_0x2da0('0x1e')]=function(_0x26b732,_0x173127){return db['Attachment']['find']({'where':{'id':_0x26b732[_0x2da0('0x40')]['id']}})[_0x2da0('0x1d')](handleEntityNotFound(_0x173127,null))[_0x2da0('0x1d')](removeEntity(_0x173127,null))[_0x2da0('0x3e')](handleError(_0x173127,null));};exports[_0x2da0('0x48')]=function(_0x534348,_0x4331b2,_0x54d29e){_0x534348[_0x2da0('0x46')][_0x2da0('0x27')]=_0x534348['file']['originalname'];_0x534348[_0x2da0('0x46')][_0x2da0('0x49')]=_0x534348['file'][_0x2da0('0x4a')];_0x534348[_0x2da0('0x46')]['type']=_0x534348[_0x2da0('0x4b')][_0x2da0('0x4c')];return db[_0x2da0('0x38')]['create'](_0x534348[_0x2da0('0x46')])[_0x2da0('0x1d')](respondWithResult(_0x4331b2,0xc9))[_0x2da0('0x3e')](handleError(_0x4331b2,null));};exports['download']=function(_0x500219,_0x67130a,_0x4593c4){return db[_0x2da0('0x38')][_0x2da0('0x4d')]({'where':{'id':_0x500219[_0x2da0('0x40')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x67130a,null))[_0x2da0('0x1d')](function(_0x56f928){if(_0x56f928){return _0x67130a[_0x2da0('0x4e')](path[_0x2da0('0x4f')](config[_0x2da0('0x50')],_0x2da0('0x51'),_0x56f928[_0x2da0('0x49')]));}})['catch'](handleError(_0x67130a,null));}; \ No newline at end of file +var _0x17a4=['length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','Attachment','count','rows','catch','show','params','keys','rawAttributes','find','clone','includeAll','omit','createdAt','updatedAt','body','create','destroy','file','basename','filename','mimetype','download','join','root','server/files/attachments/','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','status','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','fieldName','type','key','query','filters','intersection','model','attributes','fields'];(function(_0x13b7fd,_0x4eaf7f){var _0x32a74a=function(_0x2c5d80){while(--_0x2c5d80){_0x13b7fd['push'](_0x13b7fd['shift']());}};_0x32a74a(++_0x4eaf7f);}(_0x17a4,0x176));var _0x417a=function(_0xfd9b19,_0x21d75f){_0xfd9b19=_0xfd9b19-0x0;var _0x514918=_0x17a4[_0xfd9b19];return _0x514918;};'use strict';var pdf=require(_0x417a('0x0'));var emlformat=require(_0x417a('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x417a('0x2'));var rp=require(_0x417a('0x3'));var moment=require('moment');var BPromise=require(_0x417a('0x4'));var Mustache=require(_0x417a('0x5'));var util=require(_0x417a('0x6'));var path=require(_0x417a('0x7'));var sox=require(_0x417a('0x8'));var csv=require(_0x417a('0x9'));var ejs=require(_0x417a('0xa'));var fs=require('fs');var _=require(_0x417a('0xb'));var squel=require(_0x417a('0xc'));var crypto=require(_0x417a('0xd'));var jsforce=require(_0x417a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x417a('0x9'));var querystring=require(_0x417a('0xf'));var Papa=require(_0x417a('0x10'));var Redis=require(_0x417a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x417a('0x12'));var hardwareService=require(_0x417a('0x13'));var logger=require('../../config/logger')(_0x417a('0x14'));var utils=require('../../config/utils');var config=require(_0x417a('0x15'));var licenseUtil=require(_0x417a('0x16'));var db=require(_0x417a('0x17'))['db'];function respondWithStatusCode(_0x33a95f,_0x4eaeb9){_0x4eaeb9=_0x4eaeb9||0xcc;return function(_0x403985){if(_0x403985){return _0x33a95f[_0x417a('0x18')](_0x4eaeb9);}return _0x33a95f['status'](_0x4eaeb9)[_0x417a('0x19')]();};}function respondWithResult(_0x1ca66e,_0x17de37){_0x17de37=_0x17de37||0xc8;return function(_0x2a1e3d){if(_0x2a1e3d){return _0x1ca66e['status'](_0x17de37)[_0x417a('0x1a')](_0x2a1e3d);}};}function respondWithFilteredResult(_0x39b7d8,_0x544a8c){return function(_0x1366e0){if(_0x1366e0){var _0x410722=_0x1366e0['count'],_0x545dcb=_0x544a8c['offset'],_0x222d8e=_0x544a8c[_0x417a('0x1b')]+_0x544a8c[_0x417a('0x1c')],_0x3aa520;if(_0x222d8e>=_0x410722){_0x222d8e=_0x410722;_0x3aa520=0xc8;}else{_0x3aa520=0xce;}_0x39b7d8[_0x417a('0x1d')](_0x3aa520);return _0x39b7d8[_0x417a('0x1e')](_0x417a('0x1f'),_0x545dcb+'-'+_0x222d8e+'/'+_0x410722)['json'](_0x1366e0);}return null;};}function patchUpdates(_0x395966){return function(_0x22acaf){try{jsonpatch['apply'](_0x22acaf,_0x395966,!![]);}catch(_0x36054e){return BPromise[_0x417a('0x20')](_0x36054e);}return _0x22acaf[_0x417a('0x21')]();};}function saveUpdates(_0xdbf080,_0x16c01d){return function(_0x5c02b4){if(_0x5c02b4){return _0x5c02b4[_0x417a('0x22')](_0xdbf080)[_0x417a('0x23')](function(_0x16ba81){return _0x16ba81;});}return null;};}function removeEntity(_0x5f139d,_0x42a75d){return function(_0x5abe46){if(_0x5abe46){return _0x5abe46['destroy']()[_0x417a('0x23')](function(){_0x5f139d[_0x417a('0x1d')](0xcc)[_0x417a('0x19')]();});}};}function handleEntityNotFound(_0x277baf,_0x295d9c){return function(_0x37f0ea){if(!_0x37f0ea){_0x277baf[_0x417a('0x18')](0x194);}return _0x37f0ea;};}function handleError(_0x1861d6,_0x4b18a2){_0x4b18a2=_0x4b18a2||0x1f4;return function(_0x643795){logger[_0x417a('0x24')](_0x643795[_0x417a('0x25')]);if(_0x643795['name']){delete _0x643795[_0x417a('0x26')];}_0x1861d6[_0x417a('0x1d')](_0x4b18a2)[_0x417a('0x27')](_0x643795);};}exports[_0x417a('0x28')]=function(_0x25238e,_0x279766){var _0x5674e7={},_0x3475fe={},_0x32259f={'count':0x0,'rows':[]};var _0x3e2e69=_[_0x417a('0x29')](db['Attachment']['rawAttributes'],function(_0x3d11e9){return{'name':_0x3d11e9[_0x417a('0x2a')],'type':_0x3d11e9[_0x417a('0x2b')][_0x417a('0x2c')]};});_0x3475fe['model']=_[_0x417a('0x29')](_0x3e2e69,_0x417a('0x26'));_0x3475fe[_0x417a('0x2d')]=_['keys'](_0x25238e[_0x417a('0x2d')]);_0x3475fe[_0x417a('0x2e')]=_[_0x417a('0x2f')](_0x3475fe[_0x417a('0x30')],_0x3475fe[_0x417a('0x2d')]);_0x5674e7[_0x417a('0x31')]=_['intersection'](_0x3475fe[_0x417a('0x30')],qs[_0x417a('0x32')](_0x25238e['query']['fields']));_0x5674e7['attributes']=_0x5674e7['attributes'][_0x417a('0x33')]?_0x5674e7[_0x417a('0x31')]:_0x3475fe[_0x417a('0x30')];if(!_0x25238e['query']['hasOwnProperty'](_0x417a('0x34'))){_0x5674e7['limit']=qs[_0x417a('0x1c')](_0x25238e['query'][_0x417a('0x1c')]);_0x5674e7[_0x417a('0x1b')]=qs['offset'](_0x25238e[_0x417a('0x2d')][_0x417a('0x1b')]);}_0x5674e7['order']=qs[_0x417a('0x35')](_0x25238e[_0x417a('0x2d')][_0x417a('0x35')]);_0x5674e7[_0x417a('0x36')]=qs[_0x417a('0x2e')](_[_0x417a('0x37')](_0x25238e['query'],_0x3475fe[_0x417a('0x2e')]),_0x3e2e69);if(_0x25238e[_0x417a('0x2d')][_0x417a('0x38')]){_0x5674e7[_0x417a('0x36')]=_[_0x417a('0x39')](_0x5674e7[_0x417a('0x36')],{'$or':_[_0x417a('0x29')](_0x3e2e69,function(_0x3c7129){if(_0x3c7129[_0x417a('0x2b')]!==_0x417a('0x3a')){var _0x5087c8={};_0x5087c8[_0x3c7129[_0x417a('0x26')]]={'$like':'%'+_0x25238e[_0x417a('0x2d')][_0x417a('0x38')]+'%'};return _0x5087c8;}})});}_0x5674e7=_[_0x417a('0x39')]({},_0x5674e7,_0x25238e[_0x417a('0x3b')]);var _0x34eea1={'where':_0x5674e7[_0x417a('0x36')]};return db[_0x417a('0x3c')][_0x417a('0x3d')](_0x34eea1)[_0x417a('0x23')](function(_0x3b888b){_0x32259f['count']=_0x3b888b;if(_0x25238e['query']['includeAll']){_0x5674e7['include']=[{'all':!![]}];}return db['Attachment']['findAll'](_0x5674e7);})['then'](function(_0xc8462d){_0x32259f[_0x417a('0x3e')]=_0xc8462d;return _0x32259f;})[_0x417a('0x23')](respondWithFilteredResult(_0x279766,_0x5674e7))[_0x417a('0x3f')](handleError(_0x279766,null));};exports[_0x417a('0x40')]=function(_0x112c20,_0x35116c){var _0xcd7ca5={'raw':!![],'where':{'id':_0x112c20[_0x417a('0x41')]['id']}},_0x366f2b={};_0x366f2b[_0x417a('0x30')]=_[_0x417a('0x42')](db[_0x417a('0x3c')][_0x417a('0x43')]);_0x366f2b[_0x417a('0x2d')]=_['keys'](_0x112c20[_0x417a('0x2d')]);_0x366f2b[_0x417a('0x2e')]=_[_0x417a('0x2f')](_0x366f2b[_0x417a('0x30')],_0x366f2b[_0x417a('0x2d')]);_0xcd7ca5[_0x417a('0x31')]=_['intersection'](_0x366f2b['model'],qs[_0x417a('0x32')](_0x112c20[_0x417a('0x2d')][_0x417a('0x32')]));_0xcd7ca5[_0x417a('0x31')]=_0xcd7ca5[_0x417a('0x31')][_0x417a('0x33')]?_0xcd7ca5['attributes']:_0x366f2b[_0x417a('0x30')];if(_0x112c20[_0x417a('0x2d')]['includeAll']){_0xcd7ca5['include']=[{'all':!![]}];}_0xcd7ca5=_[_0x417a('0x39')]({},_0xcd7ca5,_0x112c20['options']);return db[_0x417a('0x3c')][_0x417a('0x44')](_0xcd7ca5)['then'](handleEntityNotFound(_0x35116c,null))['then'](respondWithResult(_0x35116c,null))[_0x417a('0x3f')](handleError(_0x35116c,null));};exports[_0x417a('0x45')]=function(_0x550797,_0x44558f){var _0x2640dc={'where':{'id':_0x550797[_0x417a('0x41')]['id']}},_0x37fe7e={};_0x37fe7e[_0x417a('0x30')]=_['keys'](db[_0x417a('0x3c')][_0x417a('0x43')]);_0x2640dc['attributes']=_[_0x417a('0x2f')](_0x37fe7e[_0x417a('0x30')],qs[_0x417a('0x32')](_0x550797['query'][_0x417a('0x32')]));_0x2640dc['attributes']=_0x2640dc['attributes'][_0x417a('0x33')]?_0x2640dc[_0x417a('0x31')]:_0x37fe7e[_0x417a('0x30')];if(_0x550797[_0x417a('0x2d')][_0x417a('0x46')]){_0x2640dc['include']=[{'all':!![]}];}_0x2640dc=_[_0x417a('0x39')]({},_0x2640dc,_0x550797['options']);return db[_0x417a('0x3c')][_0x417a('0x44')](_0x2640dc)['then'](handleEntityNotFound(_0x44558f,null))['then'](function(_0x507223){if(_0x507223){var _0xdbd63=_0x507223['get']({'plain':!![]});_0xdbd63=qs[_0x417a('0x47')](_0xdbd63,['id',_0x417a('0x48'),_0x417a('0x49')]);_0x550797[_0x417a('0x4a')]=_[_0x417a('0x47')](_0x550797[_0x417a('0x4a')],['id',_0x417a('0x48'),'updatedAt']);return db[_0x417a('0x3c')][_0x417a('0x4b')](_[_0x417a('0x39')](_0xdbd63,_0x550797[_0x417a('0x4a')]),{'include':_0x550797['query'][_0x417a('0x46')]?[{'all':!![]}]:undefined});}})[_0x417a('0x23')](respondWithResult(_0x44558f,0xc9))['catch'](handleError(_0x44558f,null));};exports[_0x417a('0x22')]=function(_0x3002b5,_0x17bb0f){if(_0x3002b5[_0x417a('0x4a')]['id']){delete _0x3002b5[_0x417a('0x4a')]['id'];}return db[_0x417a('0x3c')][_0x417a('0x44')]({'where':{'id':_0x3002b5[_0x417a('0x41')]['id']}})[_0x417a('0x23')](handleEntityNotFound(_0x17bb0f,null))[_0x417a('0x23')](saveUpdates(_0x3002b5[_0x417a('0x4a')],null))[_0x417a('0x23')](respondWithResult(_0x17bb0f,null))[_0x417a('0x3f')](handleError(_0x17bb0f,null));};exports[_0x417a('0x4c')]=function(_0x1db3f6,_0x4f7a7e){return db[_0x417a('0x3c')][_0x417a('0x44')]({'where':{'id':_0x1db3f6['params']['id']}})[_0x417a('0x23')](handleEntityNotFound(_0x4f7a7e,null))[_0x417a('0x23')](removeEntity(_0x4f7a7e,null))[_0x417a('0x3f')](handleError(_0x4f7a7e,null));};exports[_0x417a('0x4b')]=function(_0xb66280,_0x2f2239,_0x5c020a){_0xb66280[_0x417a('0x4a')][_0x417a('0x26')]=_0xb66280[_0x417a('0x4d')]['originalname'];_0xb66280[_0x417a('0x4a')][_0x417a('0x4e')]=_0xb66280[_0x417a('0x4d')][_0x417a('0x4f')];_0xb66280['body']['type']=_0xb66280[_0x417a('0x4d')][_0x417a('0x50')];return db[_0x417a('0x3c')][_0x417a('0x4b')](_0xb66280[_0x417a('0x4a')])[_0x417a('0x23')](respondWithResult(_0x2f2239,0xc9))[_0x417a('0x3f')](handleError(_0x2f2239,null));};exports[_0x417a('0x51')]=function(_0x4b9708,_0x45def3,_0xf68808){return db[_0x417a('0x3c')]['findOne']({'where':{'id':_0x4b9708['params']['id']},'raw':!![]})[_0x417a('0x23')](handleEntityNotFound(_0x45def3,null))[_0x417a('0x23')](function(_0x512c8c){if(_0x512c8c){return _0x45def3[_0x417a('0x51')](path[_0x417a('0x52')](config[_0x417a('0x53')],_0x417a('0x54'),_0x512c8c[_0x417a('0x4e')]));}})['catch'](handleError(_0x45def3,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 7bb732b..a1adf8b 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 _0x110f=['lodash','util','bluebird','path','rimraf','../../config/environment','exports','Attachment','attachments'];(function(_0x9db67c,_0x27dfea){var _0x47b305=function(_0xf2834d){while(--_0xf2834d){_0x9db67c['push'](_0x9db67c['shift']());}};_0x47b305(++_0x27dfea);}(_0x110f,0x1e6));var _0xf110=function(_0x476835,_0x51438a){_0x476835=_0x476835-0x0;var _0x192249=_0x110f[_0x476835];return _0x192249;};'use strict';var _=require(_0xf110('0x0'));var util=require(_0xf110('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf110('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf110('0x3'));var rimraf=require(_0xf110('0x4'));var config=require(_0xf110('0x5'));var attributes=require('./attachment.attributes');module[_0xf110('0x6')]=function(_0x3147fd,_0xc27675){return _0x3147fd['define'](_0xf110('0x7'),attributes,{'tableName':_0xf110('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ccd=['attachments','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment'];(function(_0x16cc2f,_0x52d554){var _0x469660=function(_0x2821db){while(--_0x2821db){_0x16cc2f['push'](_0x16cc2f['shift']());}};_0x469660(++_0x52d554);}(_0x9ccd,0x1a3));var _0xd9cc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ccd[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd9cc('0x0'));var util=require('util');var logger=require(_0xd9cc('0x1'))(_0xd9cc('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd9cc('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd9cc('0x4'));var config=require(_0xd9cc('0x5'));var attributes=require(_0xd9cc('0x6'));module[_0xd9cc('0x7')]=function(_0x126f77,_0x113744){return _0x126f77[_0xd9cc('0x8')](_0xd9cc('0x9'),attributes,{'tableName':_0xd9cc('0xa'),'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 8e2b9d6..9a3f356 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 _0xeed9=['stringify','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','debug','request\x20sent','code','error','message','Attachment,\x20%s,\x20%s','CreateAttachment','Attachment','create','body','options','then'];(function(_0xe40cbd,_0x7114b1){var _0x362362=function(_0x2d0b1f){while(--_0x2d0b1f){_0xe40cbd['push'](_0xe40cbd['shift']());}};_0x362362(++_0x7114b1);}(_0xeed9,0x15b));var _0x9eed=function(_0xce9195,_0x1963e1){_0xce9195=_0xce9195-0x0;var _0x530fe6=_0xeed9[_0xce9195];return _0x530fe6;};'use strict';var _=require(_0x9eed('0x0'));var util=require(_0x9eed('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9eed('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9eed('0x3'))['db'];var utils=require(_0x9eed('0x4'));var logger=require('../../config/logger')(_0x9eed('0x5'));var config=require(_0x9eed('0x6'));var jayson=require(_0x9eed('0x7'));var client=jayson['client'][_0x9eed('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58c53b,_0x89eb7d,_0xf5e994){return new BPromise(function(_0x3d9656,_0xb22ab8){return client['request'](_0x58c53b,_0xf5e994)['then'](function(_0x15d69b){logger['info']('Attachment,\x20%s,\x20%s',_0x89eb7d,'request\x20sent');logger[_0x9eed('0x9')]('Attachment,\x20%s,\x20%s,\x20%s',_0x89eb7d,_0x9eed('0xa'),JSON['stringify'](_0x15d69b));if(_0x15d69b['error']){if(_0x15d69b['error'][_0x9eed('0xb')]===0x1f4){logger[_0x9eed('0xc')]('Attachment,\x20%s,\x20%s',_0x89eb7d,_0x15d69b['error'][_0x9eed('0xd')]);return _0xb22ab8(_0x15d69b[_0x9eed('0xc')][_0x9eed('0xd')]);}logger[_0x9eed('0xc')](_0x9eed('0xe'),_0x89eb7d,_0x15d69b['error'][_0x9eed('0xd')]);return _0x3d9656(_0x15d69b[_0x9eed('0xc')][_0x9eed('0xd')]);}else{logger['info'](_0x9eed('0xe'),_0x89eb7d,_0x9eed('0xa'));_0x3d9656(_0x15d69b['result'][_0x9eed('0xd')]);}})['catch'](function(_0x2a5428){logger['error']('Attachment,\x20%s,\x20%s',_0x89eb7d,_0x2a5428);_0xb22ab8(_0x2a5428);});});}exports[_0x9eed('0xf')]=function(_0x11a87b){var _0x25d6a4=this;return new Promise(function(_0x59a26f,_0x3a10a0){return db[_0x9eed('0x10')][_0x9eed('0x11')](_0x11a87b[_0x9eed('0x12')],{'raw':_0x11a87b[_0x9eed('0x13')]?_0x11a87b[_0x9eed('0x13')]['raw']===undefined?!![]:![]:!![]})[_0x9eed('0x14')](function(_0x5ad82c){logger['info'](_0x9eed('0xf'),_0x11a87b);logger[_0x9eed('0x9')]('CreateAttachment',_0x11a87b,JSON[_0x9eed('0x15')](_0x5ad82c));_0x59a26f(_0x5ad82c);})[_0x9eed('0x16')](function(_0x522357){logger[_0x9eed('0xc')](_0x9eed('0xf'),_0x522357[_0x9eed('0xd')],_0x11a87b);_0x3a10a0(_0x25d6a4[_0x9eed('0xc')](0x1f4,_0x522357[_0x9eed('0xd')]));});});}; \ No newline at end of file +var _0xd1dd=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Attachment','options','raw','then','CreateAttachment','stringify','lodash','moment','bluebird'];(function(_0x2a025c,_0x5bca20){var _0x3f4437=function(_0x2c60db){while(--_0x2c60db){_0x2a025c['push'](_0x2a025c['shift']());}};_0x3f4437(++_0x5bca20);}(_0xd1dd,0x10b));var _0xdd1d=function(_0x46e986,_0x3e7118){_0x46e986=_0x46e986-0x0;var _0x2e8ad5=_0xd1dd[_0x46e986];return _0x2e8ad5;};'use strict';var _=require(_0xdd1d('0x0'));var util=require('util');var moment=require(_0xdd1d('0x1'));var BPromise=require(_0xdd1d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdd1d('0x3'));var db=require(_0xdd1d('0x4'))['db'];var utils=require(_0xdd1d('0x5'));var logger=require(_0xdd1d('0x6'))(_0xdd1d('0x7'));var config=require(_0xdd1d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdd1d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4cd878,_0x438ea0,_0x3d14ab){return new BPromise(function(_0x1bb78d,_0x20acef){return client[_0xdd1d('0xa')](_0x4cd878,_0x3d14ab)['then'](function(_0x196829){logger[_0xdd1d('0xb')](_0xdd1d('0xc'),_0x438ea0,_0xdd1d('0xd'));logger[_0xdd1d('0xe')](_0xdd1d('0xf'),_0x438ea0,_0xdd1d('0xd'),JSON['stringify'](_0x196829));if(_0x196829[_0xdd1d('0x10')]){if(_0x196829[_0xdd1d('0x10')][_0xdd1d('0x11')]===0x1f4){logger[_0xdd1d('0x10')](_0xdd1d('0xc'),_0x438ea0,_0x196829['error'][_0xdd1d('0x12')]);return _0x20acef(_0x196829[_0xdd1d('0x10')][_0xdd1d('0x12')]);}logger['error'](_0xdd1d('0xc'),_0x438ea0,_0x196829[_0xdd1d('0x10')][_0xdd1d('0x12')]);return _0x1bb78d(_0x196829[_0xdd1d('0x10')][_0xdd1d('0x12')]);}else{logger[_0xdd1d('0xb')](_0xdd1d('0xc'),_0x438ea0,'request\x20sent');_0x1bb78d(_0x196829[_0xdd1d('0x13')][_0xdd1d('0x12')]);}})[_0xdd1d('0x14')](function(_0x5e5801){logger[_0xdd1d('0x10')]('Attachment,\x20%s,\x20%s',_0x438ea0,_0x5e5801);_0x20acef(_0x5e5801);});});}exports['CreateAttachment']=function(_0x198d95){var _0x605573=this;return new Promise(function(_0x54d852,_0xf136fd){return db[_0xdd1d('0x15')]['create'](_0x198d95['body'],{'raw':_0x198d95['options']?_0x198d95[_0xdd1d('0x16')][_0xdd1d('0x17')]===undefined?!![]:![]:!![]})[_0xdd1d('0x18')](function(_0x2b8456){logger[_0xdd1d('0xb')](_0xdd1d('0x19'),_0x198d95);logger[_0xdd1d('0xe')]('CreateAttachment',_0x198d95,JSON[_0xdd1d('0x1a')](_0x2b8456));_0x54d852(_0x2b8456);})['catch'](function(_0x5e2ea6){logger[_0xdd1d('0x10')]('CreateAttachment',_0x5e2ea6['message'],_0x198d95);_0xf136fd(_0x605573['error'](0x1f4,_0x5e2ea6[_0xdd1d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index e2de918..0ae4c13 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 _0xd05a=['root','server/files/attachments/','%s-%s','originalname','post','single','file','put','update','delete','destroy','util','path','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','/:id','show','/:id/download','download','diskStorage','join'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd05a,0x143));var _0xad05=function(_0x108b7e,_0x57329f){_0x108b7e=_0x108b7e-0x0;var _0x15e657=_0xd05a[_0x108b7e];return _0x15e657;};'use strict';var multer=require('multer');var util=require(_0xad05('0x0'));var path=require(_0xad05('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xad05('0x2'));var config=require(_0xad05('0x3'));var controller=require(_0xad05('0x4'));router[_0xad05('0x5')]('/',auth[_0xad05('0x6')](),controller['index']);router['get'](_0xad05('0x7'),auth[_0xad05('0x6')](),controller[_0xad05('0x8')]);router['get'](_0xad05('0x9'),auth[_0xad05('0x6')](),controller[_0xad05('0xa')]);router['post']('/:id/clone',auth[_0xad05('0x6')](),controller['clone']);var upload=multer({'storage':multer[_0xad05('0xb')]({'destination':function(_0x3ec191,_0x104fd4,_0x1fde1b){_0x1fde1b(null,path[_0xad05('0xc')](config[_0xad05('0xd')],_0xad05('0xe')));},'filename':function(_0x200eed,_0x144310,_0x4281b7){_0x4281b7(null,util['format'](_0xad05('0xf'),Date['now'](),_0x144310[_0xad05('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xad05('0x11')]('/',upload[_0xad05('0x12')](_0xad05('0x13')),controller['create']);router[_0xad05('0x14')]('/:id',auth[_0xad05('0x6')](),controller[_0xad05('0x15')]);router[_0xad05('0x16')](_0xad05('0x7'),auth[_0xad05('0x6')](),controller[_0xad05('0x17')]);module['exports']=router; \ No newline at end of file +var _0x21ad=['isAuthenticated','index','/:id','show','/:id/download','post','/:id/clone','clone','diskStorage','join','server/files/attachments/','format','%s-%s','now','originalname','replace','create','put','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','./attachment.controller','get'];(function(_0x1acc2d,_0x597696){var _0xabfa6d=function(_0x41e83c){while(--_0x41e83c){_0x1acc2d['push'](_0x1acc2d['shift']());}};_0xabfa6d(++_0x597696);}(_0x21ad,0x85));var _0xd21a=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x21ad[_0x3826ad];return _0x17b900;};'use strict';var multer=require(_0xd21a('0x0'));var util=require('util');var path=require(_0xd21a('0x1'));var timeout=require(_0xd21a('0x2'));var express=require(_0xd21a('0x3'));var router=express['Router']();var auth=require(_0xd21a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd21a('0x5'));router[_0xd21a('0x6')]('/',auth[_0xd21a('0x7')](),controller[_0xd21a('0x8')]);router['get'](_0xd21a('0x9'),auth[_0xd21a('0x7')](),controller[_0xd21a('0xa')]);router['get'](_0xd21a('0xb'),auth[_0xd21a('0x7')](),controller['download']);router[_0xd21a('0xc')](_0xd21a('0xd'),auth['isAuthenticated'](),controller[_0xd21a('0xe')]);var upload=multer({'storage':multer[_0xd21a('0xf')]({'destination':function(_0x458d78,_0x46c29e,_0x3c8fe4){_0x3c8fe4(null,path[_0xd21a('0x10')](config['root'],_0xd21a('0x11')));},'filename':function(_0x2e2104,_0x559f4a,_0x12c44e){_0x12c44e(null,util[_0xd21a('0x12')](_0xd21a('0x13'),Date[_0xd21a('0x14')](),_0x559f4a[_0xd21a('0x15')][_0xd21a('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xd21a('0xc')]('/',upload['single']('file'),controller[_0xd21a('0x17')]);router[_0xd21a('0x18')](_0xd21a('0x9'),auth[_0xd21a('0x7')](),controller['update']);router[_0xd21a('0x19')](_0xd21a('0x9'),auth[_0xd21a('0x7')](),controller[_0xd21a('0x1a')]);module[_0xd21a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index b9af37d..c033f8c 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 _0x2c90=['secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','User','map','emails','value','admin','user','agent','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','minutes','getLicense','catch','lodash','passport','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','email','callback','use','clientID','clientSecret'];(function(_0xd06d80,_0x5579e7){var _0x4753d3=function(_0x39af5a){while(--_0x39af5a){_0xd06d80['push'](_0xd06d80['shift']());}};_0x4753d3(++_0x5579e7);}(_0x2c90,0x1b6));var _0x02c9=function(_0x407dc6,_0x2d2db9){_0x407dc6=_0x407dc6-0x0;var _0x119332=_0x2c90[_0x407dc6];return _0x119332;};'use strict';var _=require(_0x02c9('0x0'));var passport=require(_0x02c9('0x1'));var GoogleStrategy=require('passport-google-oauth20')[_0x02c9('0x2')];var moment=require(_0x02c9('0x3'));var db=require(_0x02c9('0x4'))['db'];var config=require(_0x02c9('0x5'));var signToken=require(_0x02c9('0x6'))[_0x02c9('0x7')];var utils=require(_0x02c9('0x8'));exports[_0x02c9('0x9')]=passport[_0x02c9('0xa')](_0x02c9('0xb'),{'failureRedirect':_0x02c9('0xc'),'scope':['profile',_0x02c9('0xd')],'session':![]});exports[_0x02c9('0xe')]=passport['authenticate']('google',{'failureRedirect':'/login','session':![]});passport[_0x02c9('0xf')](new GoogleStrategy({'clientID':config[_0x02c9('0xb')]?config[_0x02c9('0xb')][_0x02c9('0x10')]:'id','clientSecret':config[_0x02c9('0xb')]?config[_0x02c9('0xb')][_0x02c9('0x11')]:_0x02c9('0x12'),'callbackURL':config[_0x02c9('0xb')]?config[_0x02c9('0xb')][_0x02c9('0x13')]:''},function(_0x4a4129,_0x128b8a,_0x331788,_0x4e8e80){var _0x5d1a9b,_0x5c5654;return db[_0x02c9('0x14')][_0x02c9('0x15')]({'where':{'id':0x1},'attributes':[_0x02c9('0x16'),_0x02c9('0x17')],'raw':!![]})['then'](function(_0x55a4f8){_0x5d1a9b=_0x55a4f8;return db[_0x02c9('0x18')]['find']({'where':{'email':_[_0x02c9('0x19')](_0x331788[_0x02c9('0x1a')],_0x02c9('0x1b')),'role':{'$or':[_0x02c9('0x1c'),_0x02c9('0x1d'),_0x02c9('0x1e')]}}});})[_0x02c9('0x1f')](function(_0x58ea41){_0x5c5654=_0x58ea41;if(_0x5c5654){if(_0x5c5654[_0x02c9('0x20')]){return _0x4e8e80(_0x02c9('0x21'));}else if(_0x5d1a9b['blockDuration']>0x0){if(_0x5c5654['blocked']){if(moment(_0x5c5654[_0x02c9('0x22')])['add'](_0x5d1a9b[_0x02c9('0x17')],_0x02c9('0x23'))>moment()){return _0x4e8e80('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils['clearBlockUser'](_0x5c5654,0x0,![],null)['then'](function(){return utils['getLicense'](_0x5c5654);})[_0x02c9('0x1f')](function(){return _0x4e8e80(null,_0x5c5654);});}}else{return utils[_0x02c9('0x24')](_0x5c5654)[_0x02c9('0x1f')](function(){return _0x4e8e80(null,_0x5c5654);});}}else{return utils[_0x02c9('0x24')](_0x5c5654)[_0x02c9('0x1f')](function(){return _0x4e8e80(null,_0x5c5654);});}}return _0x4e8e80(_0x02c9('0x21'));})[_0x02c9('0x25')](function(_0x3965df){_0x4e8e80(_0x3965df);});})); \ No newline at end of file +var _0x2bd6=['agent','disabled','add','minutes','clearBlockUser','getLicense','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','catch','lodash','passport-google-oauth20','Strategy','../../mysqldb','../../config/environment','login','/login','profile','google','use','clientID','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','emails','value','admin','user'];(function(_0x4a84cf,_0x6a4be1){var _0x3d5835=function(_0x449072){while(--_0x449072){_0x4a84cf['push'](_0x4a84cf['shift']());}};_0x3d5835(++_0x6a4be1);}(_0x2bd6,0x194));var _0x62bd=function(_0x5275b8,_0x51e5dd){_0x5275b8=_0x5275b8-0x0;var _0x568a9b=_0x2bd6[_0x5275b8];return _0x568a9b;};'use strict';var _=require(_0x62bd('0x0'));var passport=require('passport');var GoogleStrategy=require(_0x62bd('0x1'))[_0x62bd('0x2')];var moment=require('moment');var db=require(_0x62bd('0x3'))['db'];var config=require(_0x62bd('0x4'));var signToken=require('../../components/auth/service')['signToken'];var utils=require('../../config/utils');exports[_0x62bd('0x5')]=passport['authenticate']('google',{'failureRedirect':_0x62bd('0x6'),'scope':[_0x62bd('0x7'),'email'],'session':![]});exports['callback']=passport['authenticate'](_0x62bd('0x8'),{'failureRedirect':_0x62bd('0x6'),'session':![]});passport[_0x62bd('0x9')](new GoogleStrategy({'clientID':config['google']?config[_0x62bd('0x8')][_0x62bd('0xa')]:'id','clientSecret':config[_0x62bd('0x8')]?config[_0x62bd('0x8')]['clientSecret']:_0x62bd('0xb'),'callbackURL':config[_0x62bd('0x8')]?config['google'][_0x62bd('0xc')]:''},function(_0x58a9cb,_0x55bc8e,_0x2ca0db,_0x3d9f82){var _0xbcf0f2,_0x2cb2a3;return db[_0x62bd('0xd')][_0x62bd('0xe')]({'where':{'id':0x1},'attributes':[_0x62bd('0xf'),_0x62bd('0x10')],'raw':!![]})[_0x62bd('0x11')](function(_0x1c5753){_0xbcf0f2=_0x1c5753;return db[_0x62bd('0x12')][_0x62bd('0x13')]({'where':{'email':_[_0x62bd('0x14')](_0x2ca0db[_0x62bd('0x15')],_0x62bd('0x16')),'role':{'$or':[_0x62bd('0x17'),_0x62bd('0x18'),_0x62bd('0x19')]}}});})[_0x62bd('0x11')](function(_0x31f8e2){_0x2cb2a3=_0x31f8e2;if(_0x2cb2a3){if(_0x2cb2a3[_0x62bd('0x1a')]){return _0x3d9f82('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0xbcf0f2[_0x62bd('0x10')]>0x0){if(_0x2cb2a3['blocked']){if(moment(_0x2cb2a3['blockedAt'])[_0x62bd('0x1b')](_0xbcf0f2[_0x62bd('0x10')],_0x62bd('0x1c'))>moment()){return _0x3d9f82('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0x62bd('0x1d')](_0x2cb2a3,0x0,![],null)[_0x62bd('0x11')](function(){return utils['getLicense'](_0x2cb2a3);})['then'](function(){return _0x3d9f82(null,_0x2cb2a3);});}}else{return utils[_0x62bd('0x1e')](_0x2cb2a3)[_0x62bd('0x11')](function(){return _0x3d9f82(null,_0x2cb2a3);});}}else{return utils[_0x62bd('0x1e')](_0x2cb2a3)[_0x62bd('0x11')](function(){return _0x3d9f82(null,_0x2cb2a3);});}}return _0x3d9f82(_0x62bd('0x1f'));})[_0x62bd('0x20')](function(_0x36e256){_0x3d9f82(_0x36e256);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 338c62d..1be4f08 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 _0x280f=['get','login','callback','isMiddleware','setTokenCookie','exports','express','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service'];(function(_0x548627,_0x4ec392){var _0x844a84=function(_0x2ffdd2){while(--_0x2ffdd2){_0x548627['push'](_0x548627['shift']());}};_0x844a84(++_0x4ec392);}(_0x280f,0xe2));var _0xf280=function(_0x20cc29,_0x30a46d){_0x20cc29=_0x20cc29-0x0;var _0x28d513=_0x280f[_0x20cc29];return _0x28d513;};'use strict';var express=require(_0xf280('0x0'));var passport=require('passport');var router=express[_0xf280('0x1')]();var controller=require(_0xf280('0x2'));var userController=require(_0xf280('0x3'));var authService=require(_0xf280('0x4'));router[_0xf280('0x5')]('/',controller[_0xf280('0x6')]);router[_0xf280('0x5')]('/callback',controller[_0xf280('0x7')],authService[_0xf280('0x8')],userController[_0xf280('0x6')],authService[_0xf280('0x9')]);module[_0xf280('0xa')]=router; \ No newline at end of file +var _0x2392=['passport','./authGoogle.controller','../user/user.controller.js','login','get','/callback','callback','isMiddleware','setTokenCookie','exports','express'];(function(_0xfe8ea7,_0x57e74c){var _0x510256=function(_0xe96ca){while(--_0xe96ca){_0xfe8ea7['push'](_0xfe8ea7['shift']());}};_0x510256(++_0x57e74c);}(_0x2392,0xd0));var _0x2239=function(_0x43a48c,_0x5bdd8b){_0x43a48c=_0x43a48c-0x0;var _0xc081ab=_0x2392[_0x43a48c];return _0xc081ab;};'use strict';var express=require(_0x2239('0x0'));var passport=require(_0x2239('0x1'));var router=express['Router']();var controller=require(_0x2239('0x2'));var userController=require(_0x2239('0x3'));var authService=require('../../components/auth/service');router['get']('/',controller[_0x2239('0x4')]);router[_0x2239('0x5')](_0x2239('0x6'),controller[_0x2239('0x7')],authService[_0x2239('0x8')],userController[_0x2239('0x4')],authService[_0x2239('0x9')]);module[_0x2239('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index d8af504..58fdaa6 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 _0x2d72=['../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','name','password','salt','blocked','loginAttempts','admin','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','blockDuration','blockedAt','add','minutes','clearBlockUser','getLicense','catch','find','email','MailServerOut','service','Smtp','host','port','secure','authentication','user','pass','\x22%s\x22\x20<%s>','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','body','generate','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','save','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','User','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','previousPasswords','resetPasswordExpires','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment'];(function(_0x58bfd4,_0x2b9431){var _0x3268d3=function(_0x1afb14){while(--_0x1afb14){_0x58bfd4['push'](_0x58bfd4['shift']());}};_0x3268d3(++_0x2b9431);}(_0x2d72,0xa8));var _0x22d7=function(_0x64b57e,_0x50515a){_0x64b57e=_0x64b57e-0x0;var _0x2266e0=_0x2d72[_0x64b57e];return _0x2266e0;};'use strict';var util=require(_0x22d7('0x0'));var passport=require(_0x22d7('0x1'));var LocalStrategy=require(_0x22d7('0x2'))[_0x22d7('0x3')];var jayson=require(_0x22d7('0x4'));var _=require(_0x22d7('0x5'));var rs=require(_0x22d7('0x6'));var moment=require(_0x22d7('0x7'));var db=require(_0x22d7('0x8'))['db'];var authService=require(_0x22d7('0x9'));var utils=require(_0x22d7('0xa'));var client=jayson[_0x22d7('0xb')][_0x22d7('0xc')]({'port':0x232b});function localAuthenticate(_0x100426,_0x52a3e3,_0x23a731,_0x3791d6){var _0x492ca8,_0x3b12cd;return db[_0x22d7('0xd')][_0x22d7('0xe')]({'where':{'id':0x1},'attributes':[_0x22d7('0xf'),'blockDuration'],'raw':!![]})['then'](function(_0x1810b8){_0x492ca8=_0x1810b8;return _0x100426[_0x22d7('0xe')]({'attributes':['id',_0x22d7('0x10'),_0x22d7('0x11'),_0x22d7('0x12'),'role','disabled',_0x22d7('0x13'),'blockedAt',_0x22d7('0x14')],'where':{'name':_0x52a3e3,'role':{'$or':[_0x22d7('0x15'),'user',_0x22d7('0x16')]}}});})[_0x22d7('0x17')](function(_0x204439){if(!_0x204439||_0x204439&&_0x204439[_0x22d7('0x10')]!==_0x52a3e3){throw new Error(_0x22d7('0x18'));}else{_0x3b12cd=_0x204439;return _0x3b12cd;}})[_0x22d7('0x17')](function(){_0x3b12cd[_0x22d7('0x19')](_0x23a731,function(_0x286a87,_0x534223){var _0x352a78=_0x3b12cd[_0x22d7('0x14')]+0x1;if(_0x286a87){return _0x3791d6(_0x286a87);}else if(!_0x534223){if(_0x3b12cd[_0x22d7('0x1a')]){return _0x3791d6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x492ca8['allowedLoginAttempts']>0x0){if(_0x3b12cd['blocked']){if(_0x492ca8[_0x22d7('0x1b')]>0x0){if(moment(_0x3b12cd[_0x22d7('0x1c')])[_0x22d7('0x1d')](_0x492ca8[_0x22d7('0x1b')],_0x22d7('0x1e'))>moment()){return _0x3791d6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x22d7('0x1f')](_0x3b12cd,_0x352a78,![],null)[_0x22d7('0x17')](function(){return _0x3791d6(null,![],{'message':_0x22d7('0x18')});});}}else{return _0x3791d6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x352a78>=_0x492ca8[_0x22d7('0xf')]){return utils[_0x22d7('0x1f')](_0x3b12cd,0x0,!![],moment())[_0x22d7('0x17')](function(){return _0x3791d6(null,![],{'message':_0x22d7('0x18')});});}else{return utils[_0x22d7('0x1f')](_0x3b12cd,_0x352a78,![],null)['then'](function(){return _0x3791d6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x3791d6(null,![],{'message':_0x22d7('0x18')});}}else{if(_0x3b12cd[_0x22d7('0x1a')]){return _0x3791d6(null,![],{'message':_0x22d7('0x18')});}else if(_0x492ca8[_0x22d7('0xf')]>0x0){if(_0x3b12cd['blocked']){if(_0x492ca8[_0x22d7('0x1b')]>0x0){if(moment(_0x3b12cd[_0x22d7('0x1c')])[_0x22d7('0x1d')](_0x492ca8['blockDuration'],_0x22d7('0x1e'))>moment()){return _0x3791d6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x22d7('0x1f')](_0x3b12cd,0x0,![],null)[_0x22d7('0x17')](function(){return utils[_0x22d7('0x20')](_0x3b12cd);})['then'](function(){return _0x3791d6(null,_0x3b12cd);});}}else{return _0x3791d6(null,![],{'message':_0x22d7('0x18')});}}else{return utils['clearBlockUser'](_0x3b12cd,0x0,![],null)['then'](function(){return utils[_0x22d7('0x20')](_0x3b12cd);})[_0x22d7('0x17')](function(){return _0x3791d6(null,_0x3b12cd);})[_0x22d7('0x21')](function(_0x27998a){return _0x3791d6(null,![],_0x27998a);});}}else{if(_0x3b12cd[_0x22d7('0x13')]){return _0x3791d6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x22d7('0x20')](_0x3b12cd)[_0x22d7('0x17')](function(){return _0x3791d6(null,_0x3b12cd);});}}}});})[_0x22d7('0x21')](function(_0xce7f15){return _0x3791d6(null,![],_0xce7f15);});}function sendServiceMail(_0x45dc29){return db['MailAccount'][_0x22d7('0x22')]({'where':{'service':!![]},'attributes':['id',_0x22d7('0x10'),_0x22d7('0x23')],'include':[{'model':db[_0x22d7('0x24')],'as':'Smtp'}]})[_0x22d7('0x17')](function(_0x21c334){if(!_0x21c334){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x5a672d={'tls':{'rejectUnauthorized':![]}};if(_0x21c334['Smtp'][_0x22d7('0x25')]){_0x5a672d[_0x22d7('0x25')]=_0x21c334[_0x22d7('0x26')]['service'];}else{_0x5a672d[_0x22d7('0x27')]=_0x21c334['Smtp'][_0x22d7('0x27')];_0x5a672d[_0x22d7('0x28')]=_0x21c334[_0x22d7('0x26')][_0x22d7('0x28')];_0x5a672d[_0x22d7('0x29')]=_0x21c334[_0x22d7('0x26')]['secure'];}if(_0x21c334['Smtp'][_0x22d7('0x2a')]){_0x5a672d['auth']={'user':_0x21c334[_0x22d7('0x26')][_0x22d7('0x2b')],'pass':_0x21c334[_0x22d7('0x26')][_0x22d7('0x2c')]};}var _0x3b8d37={'account':_0x5a672d,'message':_['merge']({'from':util['format'](_0x22d7('0x2d'),_0x21c334['name'],_0x21c334['email']||_0x21c334[_0x22d7('0x26')]['user'])},_0x45dc29)};return client[_0x22d7('0x2e')](_0x22d7('0x2f'),_0x3b8d37);})[_0x22d7('0x17')](function(_0x5976d6){if(_0x5976d6[_0x22d7('0x30')]){throw new Error(util[_0x22d7('0x31')](_0x22d7('0x32'),_0x5976d6[_0x22d7('0x30')][_0x22d7('0x33')]||JSON[_0x22d7('0x34')](_0x5976d6[_0x22d7('0x30')])));}return!![];});}function handleError(_0x158ccd,_0x4f487d,_0x52e1ae){return _0x158ccd[_0x22d7('0x35')](_0x4f487d||0x1f4)[_0x22d7('0x36')]({'message':_0x52e1ae?_0x52e1ae[_0x22d7('0x33')]||_0x52e1ae:''});}exports[_0x22d7('0x37')]=function(_0x4bc6cc,_0x33239e,_0x5191d1){passport['authenticate'](_0x22d7('0x38'),function(_0x296ad3,_0x3b7808,_0x431592){var _0x798f9a=_0x296ad3||_0x431592;if(_0x798f9a){return handleError(_0x33239e,0x191,_0x798f9a);}if(!_0x3b7808){return handleError(_0x33239e,0x194,{'message':_0x22d7('0x39')});}else{var _0x33d434={'payload':{'id':_0x3b7808['id'],'role':_0x3b7808[_0x22d7('0x3a')]},'options':{'expiresIn':0x15180}};return authService[_0x22d7('0x3b')](_0x33d434)[_0x22d7('0x17')](function(_0x3b30b5){_0x33239e[_0x22d7('0x3c')]({'id':_0x3b7808['id'],'token':_0x3b30b5,'statusCall':'','isAlreadyLogged':_0x3b7808[_0x22d7('0x3d')]});});}})(_0x4bc6cc,_0x33239e,_0x5191d1);};exports['forgot']=function(_0x3f2cdb,_0x1033a2,_0x1aa4d8){if(!_0x3f2cdb[_0x22d7('0x3e')][_0x22d7('0x23')]){return handleError(_0x1033a2,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x53b10f=rs[_0x22d7('0x3f')]();_0x3f2cdb[_0x22d7('0x3e')][_0x22d7('0x23')]=_0x3f2cdb[_0x22d7('0x3e')]['email']['trim']()[_0x22d7('0x40')]();var _0x4613b2;return db['Setting'][_0x22d7('0xe')]({'where':{'id':0x1},'attributes':[_0x22d7('0xf'),_0x22d7('0x1b')],'raw':!![]})[_0x22d7('0x17')](function(_0x32f8ef){_0x4613b2=_0x32f8ef;return db['User']['find']({'where':{'email':_0x3f2cdb['body'][_0x22d7('0x23')]}});})[_0x22d7('0x17')](function(_0xbdc416){if(!_0xbdc416){throw new Error(_0x22d7('0x41'));}if(_0xbdc416[_0x22d7('0x1a')]){throw new Error(_0x22d7('0x42'));}if(_0xbdc416[_0x22d7('0x13')]){if(moment(_0xbdc416[_0x22d7('0x1c')])['add'](_0x4613b2[_0x22d7('0x1b')],'minutes')>moment()){throw new Error(_0x22d7('0x43'));}else{_0xbdc416[_0x22d7('0x13')]=![];_0xbdc416[_0x22d7('0x1c')]=null;}}_0xbdc416[_0x22d7('0x44')]=_0x53b10f;_0xbdc416['resetPasswordExpires']=Date['now']()+0x36ee80;return _0xbdc416[_0x22d7('0x45')]();})[_0x22d7('0x17')](function(){return sendServiceMail({'to':_0x3f2cdb[_0x22d7('0x3e')][_0x22d7('0x23')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x22d7('0x46')+'https://'+_0x3f2cdb[_0x22d7('0x47')][_0x22d7('0x27')]+'/reset/'+_0x53b10f+'\x0a\x0a'+_0x22d7('0x48')});})[_0x22d7('0x17')](function(){_0x1033a2[_0x22d7('0x35')](0xc8)[_0x22d7('0x36')]({'message':_0x22d7('0x49')});})['catch'](function(_0x2e9dcf){return handleError(_0x1033a2,0x1f4,_0x2e9dcf);});};exports[_0x22d7('0x4a')]=function(_0x43edb0,_0x447938,_0x35206a){return db[_0x22d7('0x4b')][_0x22d7('0x22')]({'where':{'resetPasswordToken':_0x43edb0[_0x22d7('0x4c')][_0x22d7('0x4d')],'resetPasswordExpires':{'$gt':Date[_0x22d7('0x4e')]()}}})[_0x22d7('0x17')](function(_0x4c4a7d){if(!_0x4c4a7d){throw new Error(_0x22d7('0x4f'));}return db[_0x22d7('0xd')][_0x22d7('0xe')]({'attributes':['id',_0x22d7('0x50'),_0x22d7('0x51'),_0x22d7('0x52')]})[_0x22d7('0x17')](function(_0xf7e694){if(_0xf7e694[_0x22d7('0x50')])authService['validatePasswordPattern'](_0x43edb0[_0x22d7('0x3e')][_0x22d7('0x11')]);if(!_0xf7e694[_0x22d7('0x51')]||!_0x4c4a7d['previousPasswords'])return _0x4c4a7d;authService[_0x22d7('0x53')](_0x43edb0['body'][_0x22d7('0x11')],_0x4c4a7d[_0x22d7('0x54')],_0xf7e694[_0x22d7('0x52')]);return _0x4c4a7d;})['then'](function(){_0x4c4a7d[_0x22d7('0x11')]=_0x43edb0['body'][_0x22d7('0x11')];_0x4c4a7d[_0x22d7('0x44')]=null;_0x4c4a7d[_0x22d7('0x55')]=null;return _0x4c4a7d[_0x22d7('0x45')]();});})['then'](function(){_0x447938[_0x22d7('0x35')](0xc8)[_0x22d7('0x36')]({'message':_0x22d7('0x56')});})['catch'](function(_0x22d330){return handleError(_0x447938,0x1f4,_0x22d330);});};passport[_0x22d7('0x57')](new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x221542,_0x1c20ca,_0x3ee60f){return localAuthenticate(db[_0x22d7('0x4b')],_0x221542,_0x1c20ca,_0x3ee60f);})); \ No newline at end of file +var _0x9fd4=['resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','client','http','Setting','findOne','blockDuration','then','name','password','salt','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','pass','merge','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','role','forgot','Email\x20parameter\x20is\x20missing','generate','body','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken'];(function(_0x110da2,_0x536249){var _0x3476a6=function(_0x1dbc14){while(--_0x1dbc14){_0x110da2['push'](_0x110da2['shift']());}};_0x3476a6(++_0x536249);}(_0x9fd4,0x16c));var _0x49fd=function(_0x1c66f1,_0x53c85c){_0x1c66f1=_0x1c66f1-0x0;var _0x682d89=_0x9fd4[_0x1c66f1];return _0x682d89;};'use strict';var util=require(_0x49fd('0x0'));var passport=require(_0x49fd('0x1'));var LocalStrategy=require(_0x49fd('0x2'))[_0x49fd('0x3')];var jayson=require(_0x49fd('0x4'));var _=require(_0x49fd('0x5'));var rs=require(_0x49fd('0x6'));var moment=require(_0x49fd('0x7'));var db=require(_0x49fd('0x8'))['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var client=jayson[_0x49fd('0x9')][_0x49fd('0xa')]({'port':0x232b});function localAuthenticate(_0x1bc16e,_0x9353cd,_0x48b999,_0x14bb94){var _0x461ac1,_0x36f605;return db[_0x49fd('0xb')][_0x49fd('0xc')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x49fd('0xd')],'raw':!![]})[_0x49fd('0xe')](function(_0x3e1c71){_0x461ac1=_0x3e1c71;return _0x1bc16e[_0x49fd('0xc')]({'attributes':['id',_0x49fd('0xf'),_0x49fd('0x10'),_0x49fd('0x11'),'role',_0x49fd('0x12'),_0x49fd('0x13'),_0x49fd('0x14'),_0x49fd('0x15')],'where':{'name':_0x9353cd,'role':{'$or':[_0x49fd('0x16'),_0x49fd('0x17'),_0x49fd('0x18')]}}});})[_0x49fd('0xe')](function(_0x1d900b){if(!_0x1d900b||_0x1d900b&&_0x1d900b[_0x49fd('0xf')]!==_0x9353cd){throw new Error(_0x49fd('0x19'));}else{_0x36f605=_0x1d900b;return _0x36f605;}})[_0x49fd('0xe')](function(){_0x36f605[_0x49fd('0x1a')](_0x48b999,function(_0x1a9063,_0x264ab1){var _0x201109=_0x36f605[_0x49fd('0x15')]+0x1;if(_0x1a9063){return _0x14bb94(_0x1a9063);}else if(!_0x264ab1){if(_0x36f605[_0x49fd('0x12')]){return _0x14bb94(null,![],{'message':_0x49fd('0x19')});}else if(_0x461ac1[_0x49fd('0x1b')]>0x0){if(_0x36f605[_0x49fd('0x13')]){if(_0x461ac1[_0x49fd('0xd')]>0x0){if(moment(_0x36f605[_0x49fd('0x14')])[_0x49fd('0x1c')](_0x461ac1[_0x49fd('0xd')],_0x49fd('0x1d'))>moment()){return _0x14bb94(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x49fd('0x1e')](_0x36f605,_0x201109,![],null)[_0x49fd('0xe')](function(){return _0x14bb94(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x14bb94(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x201109>=_0x461ac1[_0x49fd('0x1b')]){return utils['clearBlockUser'](_0x36f605,0x0,!![],moment())[_0x49fd('0xe')](function(){return _0x14bb94(null,![],{'message':_0x49fd('0x19')});});}else{return utils['clearBlockUser'](_0x36f605,_0x201109,![],null)[_0x49fd('0xe')](function(){return _0x14bb94(null,![],{'message':_0x49fd('0x19')});});}}}else{return _0x14bb94(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x36f605[_0x49fd('0x12')]){return _0x14bb94(null,![],{'message':_0x49fd('0x19')});}else if(_0x461ac1[_0x49fd('0x1b')]>0x0){if(_0x36f605[_0x49fd('0x13')]){if(_0x461ac1[_0x49fd('0xd')]>0x0){if(moment(_0x36f605[_0x49fd('0x14')])['add'](_0x461ac1[_0x49fd('0xd')],_0x49fd('0x1d'))>moment()){return _0x14bb94(null,![],{'message':_0x49fd('0x19')});}else{return utils['clearBlockUser'](_0x36f605,0x0,![],null)[_0x49fd('0xe')](function(){return utils[_0x49fd('0x1f')](_0x36f605);})[_0x49fd('0xe')](function(){return _0x14bb94(null,_0x36f605);});}}else{return _0x14bb94(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0x36f605,0x0,![],null)['then'](function(){return utils[_0x49fd('0x1f')](_0x36f605);})[_0x49fd('0xe')](function(){return _0x14bb94(null,_0x36f605);})[_0x49fd('0x20')](function(_0x302ab2){return _0x14bb94(null,![],_0x302ab2);});}}else{if(_0x36f605[_0x49fd('0x13')]){return _0x14bb94(null,![],{'message':_0x49fd('0x19')});}else{return utils[_0x49fd('0x1f')](_0x36f605)[_0x49fd('0xe')](function(){return _0x14bb94(null,_0x36f605);});}}}});})['catch'](function(_0x2b2710){return _0x14bb94(null,![],_0x2b2710);});}function sendServiceMail(_0x52b35d){return db[_0x49fd('0x21')][_0x49fd('0x22')]({'where':{'service':!![]},'attributes':['id','name',_0x49fd('0x23')],'include':[{'model':db[_0x49fd('0x24')],'as':_0x49fd('0x25')}]})[_0x49fd('0xe')](function(_0x404bc1){if(!_0x404bc1){throw new Error(_0x49fd('0x26'));}var _0x23dcc0={'tls':{'rejectUnauthorized':![]}};if(_0x404bc1[_0x49fd('0x25')]['service']){_0x23dcc0[_0x49fd('0x27')]=_0x404bc1['Smtp'][_0x49fd('0x27')];}else{_0x23dcc0['host']=_0x404bc1[_0x49fd('0x25')][_0x49fd('0x28')];_0x23dcc0[_0x49fd('0x29')]=_0x404bc1['Smtp']['port'];_0x23dcc0['secure']=_0x404bc1[_0x49fd('0x25')][_0x49fd('0x2a')];}if(_0x404bc1['Smtp'][_0x49fd('0x2b')]){_0x23dcc0['auth']={'user':_0x404bc1['Smtp'][_0x49fd('0x17')],'pass':_0x404bc1[_0x49fd('0x25')][_0x49fd('0x2c')]};}var _0x373f1f={'account':_0x23dcc0,'message':_[_0x49fd('0x2d')]({'from':util['format']('\x22%s\x22\x20<%s>',_0x404bc1[_0x49fd('0xf')],_0x404bc1[_0x49fd('0x23')]||_0x404bc1[_0x49fd('0x25')][_0x49fd('0x17')])},_0x52b35d)};return client['request'](_0x49fd('0x2e'),_0x373f1f);})[_0x49fd('0xe')](function(_0x143769){if(_0x143769[_0x49fd('0x2f')]){throw new Error(util[_0x49fd('0x30')](_0x49fd('0x31'),_0x143769[_0x49fd('0x2f')][_0x49fd('0x32')]||JSON[_0x49fd('0x33')](_0x143769[_0x49fd('0x2f')])));}return!![];});}function handleError(_0x3762c7,_0x5502ca,_0x2ecbed){return _0x3762c7[_0x49fd('0x34')](_0x5502ca||0x1f4)[_0x49fd('0x35')]({'message':_0x2ecbed?_0x2ecbed[_0x49fd('0x32')]||_0x2ecbed:''});}exports[_0x49fd('0x36')]=function(_0x44c7d5,_0x353899,_0x3df101){passport[_0x49fd('0x1a')]('local',function(_0x246459,_0x5878a8,_0x46e84c){var _0x13d0db=_0x246459||_0x46e84c;if(_0x13d0db){return handleError(_0x353899,0x191,_0x13d0db);}if(!_0x5878a8){return handleError(_0x353899,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x1bdf6e={'payload':{'id':_0x5878a8['id'],'role':_0x5878a8[_0x49fd('0x37')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1bdf6e)[_0x49fd('0xe')](function(_0x4f525f){_0x353899['json']({'id':_0x5878a8['id'],'token':_0x4f525f,'statusCall':'','isAlreadyLogged':_0x5878a8['online']});});}})(_0x44c7d5,_0x353899,_0x3df101);};exports[_0x49fd('0x38')]=function(_0x32982e,_0x36739b,_0x3f73d3){if(!_0x32982e['body'][_0x49fd('0x23')]){return handleError(_0x36739b,0x1f4,{'message':_0x49fd('0x39')});}var _0x42c130=rs[_0x49fd('0x3a')]();_0x32982e[_0x49fd('0x3b')][_0x49fd('0x23')]=_0x32982e[_0x49fd('0x3b')][_0x49fd('0x23')]['trim']()[_0x49fd('0x3c')]();var _0x2c8ab1;return db['Setting'][_0x49fd('0xc')]({'where':{'id':0x1},'attributes':[_0x49fd('0x1b'),'blockDuration'],'raw':!![]})[_0x49fd('0xe')](function(_0x4a851d){_0x2c8ab1=_0x4a851d;return db[_0x49fd('0x3d')][_0x49fd('0x22')]({'where':{'email':_0x32982e[_0x49fd('0x3b')][_0x49fd('0x23')]}});})['then'](function(_0x567075){if(!_0x567075){throw new Error(_0x49fd('0x3e'));}if(_0x567075['disabled']){throw new Error(_0x49fd('0x3f'));}if(_0x567075[_0x49fd('0x13')]){if(moment(_0x567075[_0x49fd('0x14')])[_0x49fd('0x1c')](_0x2c8ab1['blockDuration'],_0x49fd('0x1d'))>moment()){throw new Error(_0x49fd('0x40'));}else{_0x567075[_0x49fd('0x13')]=![];_0x567075[_0x49fd('0x14')]=null;}}_0x567075[_0x49fd('0x41')]=_0x42c130;_0x567075[_0x49fd('0x42')]=Date[_0x49fd('0x43')]()+0x36ee80;return _0x567075[_0x49fd('0x44')]();})[_0x49fd('0xe')](function(){return sendServiceMail({'to':_0x32982e[_0x49fd('0x3b')][_0x49fd('0x23')],'subject':_0x49fd('0x45'),'text':_0x49fd('0x46')+_0x49fd('0x47')+'https://'+_0x32982e['headers'][_0x49fd('0x28')]+_0x49fd('0x48')+_0x42c130+'\x0a\x0a'+_0x49fd('0x49')});})[_0x49fd('0xe')](function(){_0x36739b['status'](0xc8)[_0x49fd('0x35')]({'message':_0x49fd('0x4a')});})['catch'](function(_0x341728){return handleError(_0x36739b,0x1f4,_0x341728);});};exports[_0x49fd('0x4b')]=function(_0xaac56f,_0x408e17,_0x1316cb){return db[_0x49fd('0x3d')][_0x49fd('0x22')]({'where':{'resetPasswordToken':_0xaac56f[_0x49fd('0x4c')][_0x49fd('0x4d')],'resetPasswordExpires':{'$gt':Date[_0x49fd('0x43')]()}}})[_0x49fd('0xe')](function(_0x5e2532){if(!_0x5e2532){throw new Error(_0x49fd('0x4e'));}return db[_0x49fd('0xb')][_0x49fd('0xc')]({'attributes':['id',_0x49fd('0x4f'),_0x49fd('0x50'),_0x49fd('0x51')]})['then'](function(_0x5a75d7){if(_0x5a75d7[_0x49fd('0x4f')])authService[_0x49fd('0x52')](_0xaac56f[_0x49fd('0x3b')]['password']);if(!_0x5a75d7[_0x49fd('0x50')]||!_0x5e2532[_0x49fd('0x53')])return _0x5e2532;authService['validatePasswordHistory'](_0xaac56f['body']['password'],_0x5e2532[_0x49fd('0x53')],_0x5a75d7['passwordHistoryLimit']);return _0x5e2532;})['then'](function(){_0x5e2532['password']=_0xaac56f[_0x49fd('0x3b')][_0x49fd('0x10')];_0x5e2532[_0x49fd('0x41')]=null;_0x5e2532[_0x49fd('0x42')]=null;return _0x5e2532[_0x49fd('0x44')]();});})[_0x49fd('0xe')](function(){_0x408e17[_0x49fd('0x34')](0xc8)[_0x49fd('0x35')]({'message':_0x49fd('0x54')});})[_0x49fd('0x20')](function(_0x503502){return handleError(_0x408e17,0x1f4,_0x503502);});};passport[_0x49fd('0x55')](new LocalStrategy({'usernameField':_0x49fd('0xf'),'passwordField':_0x49fd('0x10')},function(_0x3deda9,_0x7e201c,_0x24bfde){return localAuthenticate(db['User'],_0x3deda9,_0x7e201c,_0x24bfde);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 1302bec..edd5e07 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 _0x2c58=['./authLocal.controller','post','login','/forgot','/reset/:token','reset','exports','express'];(function(_0x240a29,_0x2e281c){var _0x67dac5=function(_0x558f32){while(--_0x558f32){_0x240a29['push'](_0x240a29['shift']());}};_0x67dac5(++_0x2e281c);}(_0x2c58,0x147));var _0x82c5=function(_0x23d3f9,_0xaa163e){_0x23d3f9=_0x23d3f9-0x0;var _0x30c37f=_0x2c58[_0x23d3f9];return _0x30c37f;};'use strict';var express=require(_0x82c5('0x0'));var router=express['Router']();var controller=require(_0x82c5('0x1'));router[_0x82c5('0x2')]('/',controller[_0x82c5('0x3')]);router['post'](_0x82c5('0x4'),controller['forgot']);router[_0x82c5('0x2')](_0x82c5('0x5'),controller[_0x82c5('0x6')]);module[_0x82c5('0x7')]=router; \ No newline at end of file +var _0x9012=['forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller','post','login','/forgot'];(function(_0x4aec22,_0x50f67b){var _0x26e184=function(_0x4f070e){while(--_0x4f070e){_0x4aec22['push'](_0x4aec22['shift']());}};_0x26e184(++_0x50f67b);}(_0x9012,0x1e4));var _0x2901=function(_0x59ee41,_0xaf7db8){_0x59ee41=_0x59ee41-0x0;var _0x3ecd3e=_0x9012[_0x59ee41];return _0x3ecd3e;};'use strict';var express=require(_0x2901('0x0'));var router=express[_0x2901('0x1')]();var controller=require(_0x2901('0x2'));router[_0x2901('0x3')]('/',controller[_0x2901('0x4')]);router[_0x2901('0x3')](_0x2901('0x5'),controller[_0x2901('0x6')]);router['post'](_0x2901('0x7'),controller[_0x2901('0x8')]);module[_0x2901('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 bec6a70..737e49f 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 _0xb4e0=['STRING','BOOLEAN','INTEGER','exports'];(function(_0x2231bd,_0x4a7050){var _0x51385f=function(_0x596d1f){while(--_0x596d1f){_0x2231bd['push'](_0x2231bd['shift']());}};_0x51385f(++_0x4a7050);}(_0xb4e0,0xb3));var _0x0b4e=function(_0x1dd344,_0x239356){_0x1dd344=_0x1dd344-0x0;var _0x433de4=_0xb4e0[_0x1dd344];return _0x433de4;};'use strict';var Sequelize=require('sequelize');module[_0x0b4e('0x0')]={'name':{'type':Sequelize[_0x0b4e('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x0b4e('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x0b4e('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x0b4e('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x92fc=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x2d7e83,_0x150c1a){var _0x3d1fd8=function(_0x5c39ff){while(--_0x5c39ff){_0x2d7e83['push'](_0x2d7e83['shift']());}};_0x3d1fd8(++_0x150c1a);}(_0x92fc,0x99));var _0xc92f=function(_0x30c57f,_0x4e26ca){_0x30c57f=_0x30c57f-0x0;var _0x570756=_0x92fc[_0x30c57f];return _0x570756;};'use strict';var Sequelize=require(_0xc92f('0x0'));module[_0xc92f('0x1')]={'name':{'type':Sequelize[_0xc92f('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xc92f('0x2')]},'description':{'type':Sequelize[_0xc92f('0x2')]},'status':{'type':Sequelize[_0xc92f('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xc92f('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 76a20d2..a63a8a1 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 _0xa9e0=['apply','reject','save','update','destroy','then','name','send','map','Automation','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','addConditions','Condition','ids','findOne','pick','getConditions','addActions','Action','omit','getActions','hasOwnProperty','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range'];(function(_0x3c6c9d,_0x3ecf9){var _0x2c8eba=function(_0x4495e1){while(--_0x4495e1){_0x3c6c9d['push'](_0x3c6c9d['shift']());}};_0x2c8eba(++_0x3ecf9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['Automation'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x45')]=function(_0x4f7240,_0x4ae14b,_0x5ddf84){return db[_0x0a9e('0x46')][_0x0a9e('0x41')]({'where':{'id':_0x4f7240[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4ae14b,null))[_0x0a9e('0x22')](function(_0x30decb){if(_0x30decb){return _0x30decb[_0x0a9e('0x45')](_0x4f7240[_0x0a9e('0x44')]['ids'],_['omit'](_0x4f7240['body'],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports['getConditions']=function(_0x2b69d9,_0x161aa7,_0x53d113){var _0x5a88da={};var _0x2ef381={};var _0x59c6ff;var _0x443e72;return db['Automation'][_0x0a9e('0x48')]({'where':{'id':_0x2b69d9[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x161aa7,null))['then'](function(_0x2f82da){if(_0x2f82da){_0x59c6ff=_0x2f82da;_0x2ef381[_0x0a9e('0x2a')]=_['keys'](db['Condition'][_0x0a9e('0x27')]);_0x2ef381[_0x0a9e('0x2b')]=_['keys'](_0x2b69d9[_0x0a9e('0x2b')]);_0x2ef381['filters']=_[_0x0a9e('0x2d')](_0x2ef381['model'],_0x2ef381[_0x0a9e('0x2b')]);_0x5a88da['attributes']=_['intersection'](_0x2ef381['model'],qs[_0x0a9e('0x2f')](_0x2b69d9['query'][_0x0a9e('0x2f')]));_0x5a88da[_0x0a9e('0x2e')]=_0x5a88da[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5a88da[_0x0a9e('0x2e')]:_0x2ef381[_0x0a9e('0x2a')];_0x5a88da[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x2b69d9['query'][_0x0a9e('0x33')]);_0x5a88da[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x49')](_0x2b69d9[_0x0a9e('0x2b')],_0x2ef381[_0x0a9e('0x2c')]));if(_0x2b69d9['query'][_0x0a9e('0x35')]){_0x5a88da[_0x0a9e('0x34')]=_['merge'](_0x5a88da[_0x0a9e('0x34')],{'$or':_['map'](_0x5a88da[_0x0a9e('0x2e')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x2b69d9['query'][_0x0a9e('0x35')]+'%'};return _0x4b3c1a;})});}_0x5a88da=_['merge']({},_0x5a88da,_0x2b69d9[_0x0a9e('0x40')]);return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})[_0x0a9e('0x22')](function(_0x7be420){if(_0x7be420){_0x443e72=_0x7be420[_0x0a9e('0x30')];if(!_0x2b69d9[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x5a88da['limit']=qs[_0x0a9e('0x1a')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x5a88da['offset']=qs[_0x0a9e('0x19')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})['then'](function(_0x1d0dc8){if(_0x1d0dc8){return _0x1d0dc8?{'count':_0x443e72,'rows':_0x1d0dc8}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x161aa7,null))['catch'](handleError(_0x161aa7,null));};exports[_0x0a9e('0x4b')]=function(_0x17e88c,_0x88dcbf,_0x409b29){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x17e88c[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x88dcbf,null))[_0x0a9e('0x22')](function(_0x47bb43){if(_0x47bb43){return _0x47bb43[_0x0a9e('0x4b')](_0x17e88c['body']['ids'],_[_0x0a9e('0x4d')](_0x17e88c[_0x0a9e('0x44')],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x88dcbf,null))[_0x0a9e('0x42')](handleError(_0x88dcbf,null));};exports[_0x0a9e('0x4e')]=function(_0x387489,_0x54a37d,_0x2d7205){var _0x1cc4f3={};var _0x2e89b7={};var _0x19012b;var _0x2bbb86;return db[_0x0a9e('0x26')][_0x0a9e('0x48')]({'where':{'id':_0x387489[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x54a37d,null))[_0x0a9e('0x22')](function(_0x5150a4){if(_0x5150a4){_0x19012b=_0x5150a4;_0x2e89b7[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x4c')]['rawAttributes']);_0x2e89b7[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x387489['query']);_0x2e89b7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x2e89b7[_0x0a9e('0x2a')],_0x2e89b7[_0x0a9e('0x2b')]);_0x1cc4f3[_0x0a9e('0x2e')]=_['intersection'](_0x2e89b7['model'],qs['fields'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x1cc4f3[_0x0a9e('0x2e')]=_0x1cc4f3[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x1cc4f3[_0x0a9e('0x2e')]:_0x2e89b7[_0x0a9e('0x2a')];_0x1cc4f3[_0x0a9e('0x32')]=qs['sort'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x1cc4f3[_0x0a9e('0x34')]=qs['filters'](_[_0x0a9e('0x49')](_0x387489['query'],_0x2e89b7[_0x0a9e('0x2c')]));if(_0x387489[_0x0a9e('0x2b')]['filter']){_0x1cc4f3[_0x0a9e('0x34')]=_[_0x0a9e('0x37')](_0x1cc4f3[_0x0a9e('0x34')],{'$or':_[_0x0a9e('0x25')](_0x1cc4f3['attributes'],function(_0x1d442c){var _0x2e9552={};_0x2e9552[_0x1d442c]={'$like':'%'+_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x2e9552;})});}_0x1cc4f3=_['merge']({},_0x1cc4f3,_0x387489[_0x0a9e('0x40')]);return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0x361b21){if(_0x361b21){_0x2bbb86=_0x361b21['length'];if(!_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x4f')](_0x0a9e('0x31'))){_0x1cc4f3[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x1cc4f3[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0xe0749e){if(_0xe0749e){return _0xe0749e?{'count':_0x2bbb86,'rows':_0xe0749e}:null;}})['then'](respondWithResult(_0x54a37d,null))[_0x0a9e('0x42')](handleError(_0x54a37d,null));}; \ No newline at end of file +var _0xa9e0=['apply','reject','save','update','destroy','then','name','send','map','Automation','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','keys','options','find','catch','create','body','addConditions','Condition','ids','findOne','pick','getConditions','addActions','Action','omit','getActions','hasOwnProperty','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range'];(function(_0x5bc03a,_0xf03abe){var _0x20057b=function(_0x3eecdd){while(--_0x3eecdd){_0x5bc03a['push'](_0x5bc03a['shift']());}};_0x20057b(++_0xf03abe);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'all':!![]}];}return db[_0x0a9e('0x26')][_0x0a9e('0x3b')](_0x45a1e7);})['then'](function(_0x5a594b){_0x1dc186[_0x0a9e('0x3c')]=_0x5a594b;return _0x1dc186;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x479bc4,_0x45a1e7))['catch'](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3d')]=function(_0x1dec2e,_0x1459bb){var _0x5b4f5e={'raw':![],'where':{'id':_0x1dec2e[_0x0a9e('0x3e')]['id']}},_0x316c8f={};_0x316c8f[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0x316c8f[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x1dec2e[_0x0a9e('0x2b')]);_0x316c8f[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x316c8f[_0x0a9e('0x2a')],_0x316c8f[_0x0a9e('0x2b')]);_0x5b4f5e[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x316c8f['model'],qs['fields'](_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x5b4f5e[_0x0a9e('0x2e')]=_0x5b4f5e[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5b4f5e[_0x0a9e('0x2e')]:_0x316c8f[_0x0a9e('0x2a')];if(_0x1dec2e[_0x0a9e('0x2b')][_0x0a9e('0x39')]){_0x5b4f5e[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x5b4f5e=_[_0x0a9e('0x37')]({},_0x5b4f5e,_0x1dec2e[_0x0a9e('0x40')]);return db['Automation'][_0x0a9e('0x41')](_0x5b4f5e)[_0x0a9e('0x22')](handleEntityNotFound(_0x1459bb,null))[_0x0a9e('0x22')](respondWithResult(_0x1459bb,null))[_0x0a9e('0x42')](handleError(_0x1459bb,null));};exports[_0x0a9e('0x43')]=function(_0xbe9d19,_0x21eb86){return db[_0x0a9e('0x26')]['create'](_0xbe9d19[_0x0a9e('0x44')],{})['then'](respondWithResult(_0x21eb86,0xc9))[_0x0a9e('0x42')](handleError(_0x21eb86,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x44')]['id']){delete _0x8d6dd1[_0x0a9e('0x44')]['id'];}return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x26')][_0x0a9e('0x41')]({'where':{'id':_0x16f976[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x45')]=function(_0x4f7240,_0x4ae14b,_0x5ddf84){return db[_0x0a9e('0x46')][_0x0a9e('0x41')]({'where':{'id':_0x4f7240[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4ae14b,null))[_0x0a9e('0x22')](function(_0x30decb){if(_0x30decb){return _0x30decb[_0x0a9e('0x45')](_0x4f7240[_0x0a9e('0x44')]['ids'],_['omit'](_0x4f7240['body'],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,null))[_0x0a9e('0x42')](handleError(_0x4ae14b,null));};exports['getConditions']=function(_0x2b69d9,_0x161aa7,_0x53d113){var _0x5a88da={};var _0x2ef381={};var _0x59c6ff;var _0x443e72;return db['Automation'][_0x0a9e('0x48')]({'where':{'id':_0x2b69d9[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x161aa7,null))['then'](function(_0x2f82da){if(_0x2f82da){_0x59c6ff=_0x2f82da;_0x2ef381[_0x0a9e('0x2a')]=_['keys'](db['Condition'][_0x0a9e('0x27')]);_0x2ef381[_0x0a9e('0x2b')]=_['keys'](_0x2b69d9[_0x0a9e('0x2b')]);_0x2ef381['filters']=_[_0x0a9e('0x2d')](_0x2ef381['model'],_0x2ef381[_0x0a9e('0x2b')]);_0x5a88da['attributes']=_['intersection'](_0x2ef381['model'],qs[_0x0a9e('0x2f')](_0x2b69d9['query'][_0x0a9e('0x2f')]));_0x5a88da[_0x0a9e('0x2e')]=_0x5a88da[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x5a88da[_0x0a9e('0x2e')]:_0x2ef381[_0x0a9e('0x2a')];_0x5a88da[_0x0a9e('0x32')]=qs[_0x0a9e('0x33')](_0x2b69d9['query'][_0x0a9e('0x33')]);_0x5a88da[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_[_0x0a9e('0x49')](_0x2b69d9[_0x0a9e('0x2b')],_0x2ef381[_0x0a9e('0x2c')]));if(_0x2b69d9['query'][_0x0a9e('0x35')]){_0x5a88da[_0x0a9e('0x34')]=_['merge'](_0x5a88da[_0x0a9e('0x34')],{'$or':_['map'](_0x5a88da[_0x0a9e('0x2e')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x2b69d9['query'][_0x0a9e('0x35')]+'%'};return _0x4b3c1a;})});}_0x5a88da=_['merge']({},_0x5a88da,_0x2b69d9[_0x0a9e('0x40')]);return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})[_0x0a9e('0x22')](function(_0x7be420){if(_0x7be420){_0x443e72=_0x7be420[_0x0a9e('0x30')];if(!_0x2b69d9[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x5a88da['limit']=qs[_0x0a9e('0x1a')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x5a88da['offset']=qs[_0x0a9e('0x19')](_0x2b69d9[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x59c6ff[_0x0a9e('0x4a')](_0x5a88da);}})['then'](function(_0x1d0dc8){if(_0x1d0dc8){return _0x1d0dc8?{'count':_0x443e72,'rows':_0x1d0dc8}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x161aa7,null))['catch'](handleError(_0x161aa7,null));};exports[_0x0a9e('0x4b')]=function(_0x17e88c,_0x88dcbf,_0x409b29){return db[_0x0a9e('0x4c')]['find']({'where':{'id':_0x17e88c[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x88dcbf,null))[_0x0a9e('0x22')](function(_0x47bb43){if(_0x47bb43){return _0x47bb43[_0x0a9e('0x4b')](_0x17e88c['body']['ids'],_[_0x0a9e('0x4d')](_0x17e88c[_0x0a9e('0x44')],[_0x0a9e('0x47'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x88dcbf,null))[_0x0a9e('0x42')](handleError(_0x88dcbf,null));};exports[_0x0a9e('0x4e')]=function(_0x387489,_0x54a37d,_0x2d7205){var _0x1cc4f3={};var _0x2e89b7={};var _0x19012b;var _0x2bbb86;return db[_0x0a9e('0x26')][_0x0a9e('0x48')]({'where':{'id':_0x387489[_0x0a9e('0x3e')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x54a37d,null))[_0x0a9e('0x22')](function(_0x5150a4){if(_0x5150a4){_0x19012b=_0x5150a4;_0x2e89b7[_0x0a9e('0x2a')]=_[_0x0a9e('0x3f')](db[_0x0a9e('0x4c')]['rawAttributes']);_0x2e89b7[_0x0a9e('0x2b')]=_[_0x0a9e('0x3f')](_0x387489['query']);_0x2e89b7[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x2e89b7[_0x0a9e('0x2a')],_0x2e89b7[_0x0a9e('0x2b')]);_0x1cc4f3[_0x0a9e('0x2e')]=_['intersection'](_0x2e89b7['model'],qs['fields'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x1cc4f3[_0x0a9e('0x2e')]=_0x1cc4f3[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x1cc4f3[_0x0a9e('0x2e')]:_0x2e89b7[_0x0a9e('0x2a')];_0x1cc4f3[_0x0a9e('0x32')]=qs['sort'](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x1cc4f3[_0x0a9e('0x34')]=qs['filters'](_[_0x0a9e('0x49')](_0x387489['query'],_0x2e89b7[_0x0a9e('0x2c')]));if(_0x387489[_0x0a9e('0x2b')]['filter']){_0x1cc4f3[_0x0a9e('0x34')]=_[_0x0a9e('0x37')](_0x1cc4f3[_0x0a9e('0x34')],{'$or':_[_0x0a9e('0x25')](_0x1cc4f3['attributes'],function(_0x1d442c){var _0x2e9552={};_0x2e9552[_0x1d442c]={'$like':'%'+_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x2e9552;})});}_0x1cc4f3=_['merge']({},_0x1cc4f3,_0x387489[_0x0a9e('0x40')]);return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0x361b21){if(_0x361b21){_0x2bbb86=_0x361b21['length'];if(!_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x4f')](_0x0a9e('0x31'))){_0x1cc4f3[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x1cc4f3[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x387489[_0x0a9e('0x2b')][_0x0a9e('0x19')]);}return _0x19012b[_0x0a9e('0x4e')](_0x1cc4f3);}})[_0x0a9e('0x22')](function(_0xe0749e){if(_0xe0749e){return _0xe0749e?{'count':_0x2bbb86,'rows':_0xe0749e}:null;}})['then'](respondWithResult(_0x54a37d,null))[_0x0a9e('0x42')](handleError(_0x54a37d,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 4c81f9e..d2c73c0 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 _0x1e36=['api','moment','bluebird','rimraf','../../config/environment','./automation.attributes','exports','Automation','util'];(function(_0x1486ee,_0x37885b){var _0x5928a6=function(_0x4f3b75){while(--_0x4f3b75){_0x1486ee['push'](_0x1486ee['shift']());}};_0x5928a6(++_0x37885b);}(_0x1e36,0x131));var _0x61e3=function(_0x430459,_0x58519c){_0x430459=_0x430459-0x0;var _0x3a2439=_0x1e36[_0x430459];return _0x3a2439;};'use strict';var _=require('lodash');var util=require(_0x61e3('0x0'));var logger=require('../../config/logger')(_0x61e3('0x1'));var moment=require(_0x61e3('0x2'));var BPromise=require(_0x61e3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x61e3('0x4'));var config=require(_0x61e3('0x5'));var attributes=require(_0x61e3('0x6'));module[_0x61e3('0x7')]=function(_0x149946,_0x5998c9){return _0x149946['define'](_0x61e3('0x8'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf88a=['exports','define','Automation','tools_automations','lodash','api','moment','request-promise','rimraf','../../config/environment','./automation.attributes'];(function(_0x170178,_0x3e742e){var _0x1a4242=function(_0x45340c){while(--_0x45340c){_0x170178['push'](_0x170178['shift']());}};_0x1a4242(++_0x3e742e);}(_0xf88a,0x1e8));var _0xaf88=function(_0x11918f,_0x4f640b){_0x11918f=_0x11918f-0x0;var _0x1145ab=_0xf88a[_0x11918f];return _0x1145ab;};'use strict';var _=require(_0xaf88('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaf88('0x1'));var moment=require(_0xaf88('0x2'));var BPromise=require('bluebird');var rp=require(_0xaf88('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf88('0x4'));var config=require(_0xaf88('0x5'));var attributes=require(_0xaf88('0x6'));module[_0xaf88('0x7')]=function(_0x153c24,_0x2a5f63){return _0x153c24[_0xaf88('0x8')](_0xaf88('0x9'),attributes,{'tableName':_0xaf88('0xa'),'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 1d96283..614a884 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 _0xd245=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x58f8d6,_0x3de6e9){var _0x249399=function(_0x5a2d88){while(--_0x5a2d88){_0x58f8d6['push'](_0x58f8d6['shift']());}};_0x249399(++_0x3de6e9);}(_0xd245,0x12a));var _0x5d24=function(_0x502953,_0x28de83){_0x502953=_0x502953-0x0;var _0x2fa32d=_0xd245[_0x502953];return _0x2fa32d;};'use strict';var _=require(_0x5d24('0x0'));var util=require(_0x5d24('0x1'));var moment=require('moment');var BPromise=require(_0x5d24('0x2'));var rs=require(_0x5d24('0x3'));var fs=require('fs');var Redis=require(_0x5d24('0x4'));var db=require(_0x5d24('0x5'))['db'];var utils=require(_0x5d24('0x6'));var logger=require(_0x5d24('0x7'))(_0x5d24('0x8'));var config=require(_0x5d24('0x9'));var jayson=require(_0x5d24('0xa'));var client=jayson[_0x5d24('0xb')][_0x5d24('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5218db,_0x2cdd4a,_0x27d80e){return new BPromise(function(_0x36d11f,_0x26cf34){return client[_0x5d24('0xd')](_0x5218db,_0x27d80e)['then'](function(_0x4fda07){logger[_0x5d24('0xe')]('Automation,\x20%s,\x20%s',_0x2cdd4a,_0x5d24('0xf'));logger[_0x5d24('0x10')](_0x5d24('0x11'),_0x2cdd4a,'request\x20sent',JSON[_0x5d24('0x12')](_0x4fda07));if(_0x4fda07[_0x5d24('0x13')]){if(_0x4fda07[_0x5d24('0x13')][_0x5d24('0x14')]===0x1f4){logger[_0x5d24('0x13')](_0x5d24('0x15'),_0x2cdd4a,_0x4fda07[_0x5d24('0x13')][_0x5d24('0x16')]);return _0x26cf34(_0x4fda07[_0x5d24('0x13')][_0x5d24('0x16')]);}logger['error'](_0x5d24('0x15'),_0x2cdd4a,_0x4fda07[_0x5d24('0x13')][_0x5d24('0x16')]);return _0x36d11f(_0x4fda07[_0x5d24('0x13')][_0x5d24('0x16')]);}else{logger['info'](_0x5d24('0x15'),_0x2cdd4a,'request\x20sent');_0x36d11f(_0x4fda07[_0x5d24('0x17')][_0x5d24('0x16')]);}})[_0x5d24('0x18')](function(_0x2d3a81){logger[_0x5d24('0x13')]('Automation,\x20%s,\x20%s',_0x2cdd4a,_0x2d3a81);_0x26cf34(_0x2d3a81);});});} \ No newline at end of file +var _0xf62f=['debug','Automation,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent'];(function(_0x269d46,_0x18e67a){var _0x4d3573=function(_0x1f5e40){while(--_0x1f5e40){_0x269d46['push'](_0x269d46['shift']());}};_0x4d3573(++_0x18e67a);}(_0xf62f,0xed));var _0xff62=function(_0x35bb5d,_0xa0fea3){_0x35bb5d=_0x35bb5d-0x0;var _0x2dd0be=_0xf62f[_0x35bb5d];return _0x2dd0be;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xff62('0x0'));var BPromise=require(_0xff62('0x1'));var rs=require(_0xff62('0x2'));var fs=require('fs');var Redis=require(_0xff62('0x3'));var db=require(_0xff62('0x4'))['db'];var utils=require(_0xff62('0x5'));var logger=require(_0xff62('0x6'))(_0xff62('0x7'));var config=require(_0xff62('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xff62('0x9')][_0xff62('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x481a5e,_0x27e2a4,_0x3ead6a){return new BPromise(function(_0x227abc,_0x287381){return client[_0xff62('0xb')](_0x481a5e,_0x3ead6a)[_0xff62('0xc')](function(_0x3cd5e0){logger[_0xff62('0xd')](_0xff62('0xe'),_0x27e2a4,_0xff62('0xf'));logger[_0xff62('0x10')](_0xff62('0x11'),_0x27e2a4,_0xff62('0xf'),JSON['stringify'](_0x3cd5e0));if(_0x3cd5e0['error']){if(_0x3cd5e0[_0xff62('0x12')][_0xff62('0x13')]===0x1f4){logger[_0xff62('0x12')](_0xff62('0xe'),_0x27e2a4,_0x3cd5e0[_0xff62('0x12')]['message']);return _0x287381(_0x3cd5e0[_0xff62('0x12')]['message']);}logger[_0xff62('0x12')](_0xff62('0xe'),_0x27e2a4,_0x3cd5e0[_0xff62('0x12')][_0xff62('0x14')]);return _0x227abc(_0x3cd5e0[_0xff62('0x12')][_0xff62('0x14')]);}else{logger[_0xff62('0xd')](_0xff62('0xe'),_0x27e2a4,_0xff62('0xf'));_0x227abc(_0x3cd5e0[_0xff62('0x15')]['message']);}})[_0xff62('0x16')](function(_0x5e6bd9){logger[_0xff62('0x12')](_0xff62('0xe'),_0x27e2a4,_0x5e6bd9);_0x287381(_0x5e6bd9);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index f0cc90b..3571350 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 _0xcefd=['getActions','create','post','addActions','/:id','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./automation.controller','get','isAuthenticated','index','show','/:id/conditions','getConditions','/:id/actions'];(function(_0x1e83ce,_0x49f4e3){var _0x3ae04f=function(_0x487902){while(--_0x487902){_0x1e83ce['push'](_0x1e83ce['shift']());}};_0x3ae04f(++_0x49f4e3);}(_0xcefd,0x1bd));var _0xdcef=function(_0x5b2cff,_0x43db7a){_0x5b2cff=_0x5b2cff-0x0;var _0x1a1288=_0xcefd[_0x5b2cff];return _0x1a1288;};'use strict';var multer=require('multer');var util=require(_0xdcef('0x0'));var path=require(_0xdcef('0x1'));var timeout=require(_0xdcef('0x2'));var express=require(_0xdcef('0x3'));var router=express[_0xdcef('0x4')]();var auth=require(_0xdcef('0x5'));var interaction=require(_0xdcef('0x6'));var config=require('../../config/environment');var controller=require(_0xdcef('0x7'));router[_0xdcef('0x8')]('/',auth[_0xdcef('0x9')](),controller[_0xdcef('0xa')]);router[_0xdcef('0x8')]('/:id',auth[_0xdcef('0x9')](),controller[_0xdcef('0xb')]);router[_0xdcef('0x8')](_0xdcef('0xc'),auth['isAuthenticated'](),controller[_0xdcef('0xd')]);router[_0xdcef('0x8')](_0xdcef('0xe'),auth['isAuthenticated'](),controller[_0xdcef('0xf')]);router['post']('/',auth[_0xdcef('0x9')](),controller[_0xdcef('0x10')]);router[_0xdcef('0x11')](_0xdcef('0xc'),auth[_0xdcef('0x9')](),controller['addConditions']);router[_0xdcef('0x11')](_0xdcef('0xe'),auth['isAuthenticated'](),controller[_0xdcef('0x12')]);router['put'](_0xdcef('0x13'),auth[_0xdcef('0x9')](),controller[_0xdcef('0x14')]);router[_0xdcef('0x15')]('/:id',auth[_0xdcef('0x9')](),controller[_0xdcef('0x16')]);module['exports']=router; \ No newline at end of file +var _0x2782=['isAuthenticated','index','get','/:id','show','/:id/conditions','getConditions','getActions','post','create','addConditions','addActions','put','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller'];(function(_0x27a5bb,_0x3f4cfb){var _0x2e17ea=function(_0x22912d){while(--_0x22912d){_0x27a5bb['push'](_0x27a5bb['shift']());}};_0x2e17ea(++_0x3f4cfb);}(_0x2782,0x17f));var _0x2278=function(_0x57e00e,_0x36e79a){_0x57e00e=_0x57e00e-0x0;var _0x415e60=_0x2782[_0x57e00e];return _0x415e60;};'use strict';var multer=require(_0x2278('0x0'));var util=require(_0x2278('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2278('0x2'));var router=express[_0x2278('0x3')]();var auth=require(_0x2278('0x4'));var interaction=require(_0x2278('0x5'));var config=require(_0x2278('0x6'));var controller=require(_0x2278('0x7'));router['get']('/',auth[_0x2278('0x8')](),controller[_0x2278('0x9')]);router[_0x2278('0xa')](_0x2278('0xb'),auth[_0x2278('0x8')](),controller[_0x2278('0xc')]);router[_0x2278('0xa')](_0x2278('0xd'),auth[_0x2278('0x8')](),controller[_0x2278('0xe')]);router['get']('/:id/actions',auth[_0x2278('0x8')](),controller[_0x2278('0xf')]);router[_0x2278('0x10')]('/',auth[_0x2278('0x8')](),controller[_0x2278('0x11')]);router[_0x2278('0x10')](_0x2278('0xd'),auth[_0x2278('0x8')](),controller[_0x2278('0x12')]);router[_0x2278('0x10')]('/:id/actions',auth[_0x2278('0x8')](),controller[_0x2278('0x13')]);router[_0x2278('0x14')](_0x2278('0xb'),auth[_0x2278('0x8')](),controller['update']);router['delete'](_0x2278('0xb'),auth[_0x2278('0x8')](),controller[_0x2278('0x15')]);module[_0x2278('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 3a82bf8..61156c5 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 _0xb0ea=['UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','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,*,*,*','ENUM','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','ivr','BOOLEAN','Active/Disactive\x20Campaign'];(function(_0x546c79,_0x9ba5c8){var _0x11f140=function(_0x3c0f22){while(--_0x3c0f22){_0x546c79['push'](_0x546c79['shift']());}};_0x11f140(++_0x9ba5c8);}(_0xb0ea,0x1c2));var _0xab0e=function(_0xd22d95,_0xc59f8f){_0xd22d95=_0xd22d95-0x0;var _0x15d7a3=_0xb0ea[_0xd22d95];return _0x15d7a3;};'use strict';var Sequelize=require('sequelize');module[_0xab0e('0x0')]={'name':{'type':Sequelize[_0xab0e('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xab0e('0x2')),'allowNull':![],'defaultValue':_0xab0e('0x2')},'description':{'type':Sequelize[_0xab0e('0x1')]},'active':{'type':Sequelize[_0xab0e('0x3')],'defaultValue':0x0,'comment':_0xab0e('0x4')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xab0e('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xab0e('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0xab0e('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xab0e('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xab0e('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xab0e('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xab0e('0x7')](0x3)[_0xab0e('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xab0e('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xab0e('0x7')](0x5)[_0xab0e('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab0e('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xab0e('0x7')](0x3)[_0xab0e('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xab0e('0xb')},'dialBusyRetryFrequency':{'type':Sequelize[_0xab0e('0x7')](0x5)[_0xab0e('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab0e('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xab0e('0x5')],'defaultValue':0x3,'comment':_0xab0e('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xab0e('0x7')](0x5)[_0xab0e('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab0e('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xab0e('0x5')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xab0e('0xf')},'dialTimezone':{'type':Sequelize[_0xab0e('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xab0e('0x1')],'defaultValue':_0xab0e('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xab0e('0x11')]('always','never',_0xab0e('0x12')),'defaultValue':_0xab0e('0x13')},'dialAMDActive':{'type':Sequelize[_0xab0e('0x3')],'defaultValue':0x0,'comment':_0xab0e('0x14')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xab0e('0x5')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xab0e('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xab0e('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xab0e('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xab0e('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xab0e('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xab0e('0x7')](0x9)[_0xab0e('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xab0e('0x7')](0x9)[_0xab0e('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xab0e('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xab0e('0x7')](0x9)[_0xab0e('0x5')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xab0e('0x7')](0x5)[_0xab0e('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xab0e('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xab0e('0x7')](0x9)[_0xab0e('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xab0e('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xab0e('0x11')](_0xab0e('0x1b'),_0xab0e('0x1c')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xab0e('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xab0e('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xab0e('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xab0e('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xab0e('0x7')](0x5)[_0xab0e('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab0e('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0xab0e('0x7')](0x3)[_0xab0e('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xab0e('0x1f')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xab0e('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab0e('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xab0e('0x7')](0x3)[_0xab0e('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xab0e('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xab0e('0x7')](0x3)[_0xab0e('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xab0e('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0xab0e('0x7')](0x5)[_0xab0e('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xab0e('0x7')](0x3)[_0xab0e('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xab0e('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xab0e('0x22')}}; \ No newline at end of file +var _0x7275=['Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','STRING','name','ivr','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','UNSIGNED','#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,*,*,*','ENUM','always','never','BOOLEAN'];(function(_0xa052d4,_0x88006f){var _0x3f56b9=function(_0x5554d7){while(--_0x5554d7){_0xa052d4['push'](_0xa052d4['shift']());}};_0x3f56b9(++_0x88006f);}(_0x7275,0x138));var _0x5727=function(_0x3311be,_0x3b3209){_0x3311be=_0x3311be-0x0;var _0x4d6ddc=_0x7275[_0x3311be];return _0x4d6ddc;};'use strict';var Sequelize=require(_0x5727('0x0'));module['exports']={'name':{'type':Sequelize[_0x5727('0x1')],'unique':_0x5727('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x5727('0x3')),'allowNull':![],'defaultValue':_0x5727('0x3')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x5727('0x4')},'limitCalls':{'type':Sequelize[_0x5727('0x5')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x5727('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5727('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x5727('0x5')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5727('0x7')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5727('0x5')](0x3)[_0x5727('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5727('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5727('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5727('0xa')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5727('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5727('0xb')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5727('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5727('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5727('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x5727('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5727('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5727('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x5727('0x5')](0x3)[_0x5727('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x5727('0xf')},'dialTimezone':{'type':Sequelize[_0x5727('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x5727('0x1')],'defaultValue':_0x5727('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x5727('0x11')](_0x5727('0x12'),_0x5727('0x13'),'onlyIfOpen'),'defaultValue':_0x5727('0x12')},'dialAMDActive':{'type':Sequelize[_0x5727('0x14')],'defaultValue':0x0,'comment':_0x5727('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0x5727('0x5')](0x9)[_0x5727('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5727('0x16')},'dialAMDGreeting':{'type':Sequelize[_0x5727('0x5')](0x9)[_0x5727('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5727('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5727('0x5')](0x9)[_0x5727('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5727('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5727('0x5')](0x9)[_0x5727('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x5727('0x5')](0x9)[_0x5727('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5727('0x19')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5727('0x5')](0x9)[_0x5727('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5727('0x5')](0x9)[_0x5727('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5727('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5727('0x5')](0x5)[_0x5727('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x5727('0x5')](0x9)[_0x5727('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5727('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x5727('0x11')](_0x5727('0x1c'),'ASC'),'defaultValue':_0x5727('0x1c')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x5727('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5727('0x1d')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x5727('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5727('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5727('0x5')](0x3)[_0x5727('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5727('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5727('0x5')](0x5)[_0x5727('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x5727('0x5')](0x3)[_0x5727('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5727('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x5727('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5727('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5727('0x5')](0x3)[_0x5727('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5727('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5727('0x22')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5727('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5727('0x23')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5727('0x5')](0x5)[_0x5727('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5727('0x5')](0x3)[_0x5727('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5727('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5727('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 171487c..5989498 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 _0x8ce1=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','name','index','map','fieldName','type','query','keys','filters','intersection','model','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','Campaign','include','findAll','rows','catch','show','params','rawAttributes','fields','includeAll','create','body','user','get','role','IvrCampaigns','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','omit','updatedAt','UserProfileSection','autoAssociation','error','findOne','CmHopper','hasOwnProperty','CampaignId','getHopperHistories','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','select','COALESCE(phone,\x27\x27)','onlyIfOpen','scheduledAt','ListId\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api'];(function(_0x551e71,_0xda3812){var _0x4960c5=function(_0x1dd271){while(--_0x1dd271){_0x551e71['push'](_0x551e71['shift']());}};_0x4960c5(++_0xda3812);}(_0x8ce1,0x183));var _0x18ce=function(_0x3fa51f,_0x3cc15a){_0x3fa51f=_0x3fa51f-0x0;var _0x2dfc0d=_0x8ce1[_0x3fa51f];return _0x2dfc0d;};'use strict';var pdf=require(_0x18ce('0x0'));var emlformat=require(_0x18ce('0x1'));var rimraf=require(_0x18ce('0x2'));var zipdir=require(_0x18ce('0x3'));var jsonpatch=require(_0x18ce('0x4'));var rp=require(_0x18ce('0x5'));var moment=require(_0x18ce('0x6'));var BPromise=require(_0x18ce('0x7'));var Mustache=require(_0x18ce('0x8'));var util=require(_0x18ce('0x9'));var path=require(_0x18ce('0xa'));var sox=require(_0x18ce('0xb'));var csv=require(_0x18ce('0xc'));var ejs=require(_0x18ce('0xd'));var fs=require('fs');var _=require(_0x18ce('0xe'));var squel=require(_0x18ce('0xf'));var crypto=require('crypto');var jsforce=require(_0x18ce('0x10'));var deskjs=require(_0x18ce('0x11'));var toCsv=require(_0x18ce('0xc'));var querystring=require(_0x18ce('0x12'));var Papa=require('papaparse');var Redis=require(_0x18ce('0x13'));var authService=require(_0x18ce('0x14'));var qs=require(_0x18ce('0x15'));var as=require(_0x18ce('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x18ce('0x17'));var utils=require(_0x18ce('0x18'));var config=require(_0x18ce('0x19'));var licenseUtil=require(_0x18ce('0x1a'));var db=require(_0x18ce('0x1b'))['db'];function respondWithStatusCode(_0x5e8c23,_0xbd514b){_0xbd514b=_0xbd514b||0xcc;return function(_0x402ba4){if(_0x402ba4){return _0x5e8c23[_0x18ce('0x1c')](_0xbd514b);}return _0x5e8c23[_0x18ce('0x1d')](_0xbd514b)[_0x18ce('0x1e')]();};}function respondWithResult(_0x5daf04,_0x176797){_0x176797=_0x176797||0xc8;return function(_0xdd4626){if(_0xdd4626){return _0x5daf04[_0x18ce('0x1d')](_0x176797)[_0x18ce('0x1f')](_0xdd4626);}};}function respondWithFilteredResult(_0x46e346,_0x36b5da){return function(_0x17460e){if(_0x17460e){var _0x4a934f=_0x17460e[_0x18ce('0x20')],_0x959ce=_0x36b5da[_0x18ce('0x21')],_0x1357ef=_0x36b5da[_0x18ce('0x21')]+_0x36b5da['limit'],_0x204d1a;if(_0x1357ef>=_0x4a934f){_0x1357ef=_0x4a934f;_0x204d1a=0xc8;}else{_0x204d1a=0xce;}_0x46e346[_0x18ce('0x1d')](_0x204d1a);return _0x46e346[_0x18ce('0x22')](_0x18ce('0x23'),_0x959ce+'-'+_0x1357ef+'/'+_0x4a934f)['json'](_0x17460e);}return null;};}function patchUpdates(_0x35e446){return function(_0x2fa3d4){try{jsonpatch[_0x18ce('0x24')](_0x2fa3d4,_0x35e446,!![]);}catch(_0x57a706){return BPromise[_0x18ce('0x25')](_0x57a706);}return _0x2fa3d4[_0x18ce('0x26')]();};}function saveUpdates(_0x5d22cd,_0x29c1ab){return function(_0x1099c9){if(_0x1099c9){return _0x1099c9[_0x18ce('0x27')](_0x5d22cd)[_0x18ce('0x28')](function(_0x31b789){return _0x31b789;});}return null;};}function removeEntity(_0xd41f29,_0x35abf9){return function(_0x545459){if(_0x545459){return _0x545459[_0x18ce('0x29')]()['then'](function(){var _0x482c90=_0x545459['get']({'plain':!![]});var _0x32e910='IvrCampaigns';return db[_0x18ce('0x2a')][_0x18ce('0x29')]({'where':{'type':_0x32e910,'resourceId':_0x482c90['id']}})[_0x18ce('0x28')](function(){return _0x545459;});})['then'](function(){_0xd41f29['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x317812,_0x12b1ed){return function(_0x12dbd2){if(!_0x12dbd2){_0x317812[_0x18ce('0x1c')](0x194);}return _0x12dbd2;};}function handleError(_0x62b2bd,_0xc3cd4){_0xc3cd4=_0xc3cd4||0x1f4;return function(_0x5583c6){logger['error'](_0x5583c6['stack']);if(_0x5583c6[_0x18ce('0x2b')]){delete _0x5583c6[_0x18ce('0x2b')];}_0x62b2bd[_0x18ce('0x1d')](_0xc3cd4)['send'](_0x5583c6);};}exports[_0x18ce('0x2c')]=function(_0xf2683f,_0x1988e4){var _0x5ef96c={},_0x56d296={},_0x59e472={'count':0x0,'rows':[]};var _0x3e6d7c=_[_0x18ce('0x2d')](db['Campaign']['rawAttributes'],function(_0x3394a9){return{'name':_0x3394a9[_0x18ce('0x2e')],'type':_0x3394a9[_0x18ce('0x2f')]['key']};});_0x56d296['model']=_[_0x18ce('0x2d')](_0x3e6d7c,_0x18ce('0x2b'));_0x56d296[_0x18ce('0x30')]=_[_0x18ce('0x31')](_0xf2683f[_0x18ce('0x30')]);_0x56d296[_0x18ce('0x32')]=_[_0x18ce('0x33')](_0x56d296[_0x18ce('0x34')],_0x56d296['query']);_0x5ef96c['attributes']=_[_0x18ce('0x33')](_0x56d296[_0x18ce('0x34')],qs['fields'](_0xf2683f[_0x18ce('0x30')]['fields']));_0x5ef96c[_0x18ce('0x35')]=_0x5ef96c['attributes'][_0x18ce('0x36')]?_0x5ef96c[_0x18ce('0x35')]:_0x56d296[_0x18ce('0x34')];if(!_0xf2683f['query']['hasOwnProperty'](_0x18ce('0x37'))){_0x5ef96c[_0x18ce('0x38')]=qs['limit'](_0xf2683f['query'][_0x18ce('0x38')]);_0x5ef96c[_0x18ce('0x21')]=qs[_0x18ce('0x21')](_0xf2683f[_0x18ce('0x30')][_0x18ce('0x21')]);}_0x5ef96c[_0x18ce('0x39')]=qs[_0x18ce('0x3a')](_0xf2683f[_0x18ce('0x30')][_0x18ce('0x3a')]);_0x5ef96c[_0x18ce('0x3b')]=qs[_0x18ce('0x32')](_[_0x18ce('0x3c')](_0xf2683f[_0x18ce('0x30')],_0x56d296['filters']),_0x3e6d7c);if(_0xf2683f[_0x18ce('0x30')][_0x18ce('0x3d')]){_0x5ef96c[_0x18ce('0x3b')]=_[_0x18ce('0x3e')](_0x5ef96c[_0x18ce('0x3b')],{'$or':_[_0x18ce('0x2d')](_0x3e6d7c,function(_0x112954){if(_0x112954[_0x18ce('0x2f')]!==_0x18ce('0x3f')){var _0x109d36={};_0x109d36[_0x112954['name']]={'$like':'%'+_0xf2683f['query'][_0x18ce('0x3d')]+'%'};return _0x109d36;}})});}_0x5ef96c=_[_0x18ce('0x3e')]({},_0x5ef96c,_0xf2683f[_0x18ce('0x40')]);var _0xb991da={'where':_0x5ef96c[_0x18ce('0x3b')]};return db[_0x18ce('0x41')][_0x18ce('0x20')](_0xb991da)['then'](function(_0x584985){_0x59e472[_0x18ce('0x20')]=_0x584985;if(_0xf2683f[_0x18ce('0x30')]['includeAll']){_0x5ef96c[_0x18ce('0x42')]=[{'all':!![]}];}return db[_0x18ce('0x41')][_0x18ce('0x43')](_0x5ef96c);})[_0x18ce('0x28')](function(_0xcd9536){_0x59e472[_0x18ce('0x44')]=_0xcd9536;return _0x59e472;})[_0x18ce('0x28')](respondWithFilteredResult(_0x1988e4,_0x5ef96c))[_0x18ce('0x45')](handleError(_0x1988e4,null));};exports[_0x18ce('0x46')]=function(_0x1d6d5f,_0x3885e6){var _0x20d107={'raw':![],'where':{'id':_0x1d6d5f[_0x18ce('0x47')]['id']}},_0x5968d6={};_0x5968d6[_0x18ce('0x34')]=_[_0x18ce('0x31')](db[_0x18ce('0x41')][_0x18ce('0x48')]);_0x5968d6[_0x18ce('0x30')]=_[_0x18ce('0x31')](_0x1d6d5f['query']);_0x5968d6['filters']=_[_0x18ce('0x33')](_0x5968d6[_0x18ce('0x34')],_0x5968d6[_0x18ce('0x30')]);_0x20d107[_0x18ce('0x35')]=_['intersection'](_0x5968d6[_0x18ce('0x34')],qs[_0x18ce('0x49')](_0x1d6d5f[_0x18ce('0x30')]['fields']));_0x20d107['attributes']=_0x20d107[_0x18ce('0x35')][_0x18ce('0x36')]?_0x20d107['attributes']:_0x5968d6[_0x18ce('0x34')];if(_0x1d6d5f[_0x18ce('0x30')][_0x18ce('0x4a')]){_0x20d107[_0x18ce('0x42')]=[{'all':!![]}];}_0x20d107=_[_0x18ce('0x3e')]({},_0x20d107,_0x1d6d5f[_0x18ce('0x40')]);return db[_0x18ce('0x41')]['find'](_0x20d107)[_0x18ce('0x28')](handleEntityNotFound(_0x3885e6,null))[_0x18ce('0x28')](respondWithResult(_0x3885e6,null))[_0x18ce('0x45')](handleError(_0x3885e6,null));};exports[_0x18ce('0x4b')]=function(_0x227fb6,_0xae0547){return db[_0x18ce('0x41')][_0x18ce('0x4b')](_0x227fb6[_0x18ce('0x4c')],{})[_0x18ce('0x28')](function(_0x1211d0){var _0x3f9960=_0x227fb6[_0x18ce('0x4d')][_0x18ce('0x4e')]({'plain':!![]});if(!_0x3f9960)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f9960[_0x18ce('0x4f')]===_0x18ce('0x4d')){var _0x530314=_0x1211d0[_0x18ce('0x4e')]({'plain':!![]});var _0x59e301=_0x18ce('0x50');return db['UserProfileSection'][_0x18ce('0x51')]({'where':{'name':_0x59e301,'userProfileId':_0x3f9960[_0x18ce('0x52')]},'raw':!![]})[_0x18ce('0x28')](function(_0xdfa85e){if(_0xdfa85e&&_0xdfa85e['autoAssociation']===0x0){return db[_0x18ce('0x2a')]['create']({'name':_0x530314['name'],'resourceId':_0x530314['id'],'type':_0xdfa85e[_0x18ce('0x2b')],'sectionId':_0xdfa85e['id']},{})[_0x18ce('0x28')](function(){return _0x1211d0;});}else{return _0x1211d0;}})[_0x18ce('0x45')](function(_0x5f164a){logger['error'](_0x18ce('0x53'),_0x5f164a);throw _0x5f164a;});}return _0x1211d0;})[_0x18ce('0x28')](respondWithResult(_0xae0547,0xc9))[_0x18ce('0x45')](handleError(_0xae0547,null));};exports[_0x18ce('0x54')]=function(_0x493a2c,_0x4dff1b){var _0x23dcf7={'where':{'id':_0x493a2c[_0x18ce('0x47')]['id']}},_0x4b095c={};_0x4b095c[_0x18ce('0x34')]=_[_0x18ce('0x31')](db['Campaign'][_0x18ce('0x48')]);_0x23dcf7[_0x18ce('0x35')]=_[_0x18ce('0x33')](_0x4b095c['model'],qs[_0x18ce('0x49')](_0x493a2c[_0x18ce('0x30')][_0x18ce('0x49')]));_0x23dcf7['attributes']=_0x23dcf7[_0x18ce('0x35')][_0x18ce('0x36')]?_0x23dcf7[_0x18ce('0x35')]:_0x4b095c[_0x18ce('0x34')];if(_0x493a2c['query']['includeAll']){_0x23dcf7[_0x18ce('0x42')]=[{'all':!![]}];}_0x23dcf7=_[_0x18ce('0x3e')]({},_0x23dcf7,_0x493a2c[_0x18ce('0x40')]);return db[_0x18ce('0x41')][_0x18ce('0x51')](_0x23dcf7)[_0x18ce('0x28')](handleEntityNotFound(_0x4dff1b,null))[_0x18ce('0x28')](function(_0x4f3ba4){if(_0x4f3ba4){var _0x14ffaf=_0x4f3ba4[_0x18ce('0x4e')]({'plain':!![]});_0x14ffaf=qs['omit'](_0x14ffaf,['id',_0x18ce('0x55'),'updatedAt']);_0x493a2c['body']=_[_0x18ce('0x56')](_0x493a2c[_0x18ce('0x4c')],['id',_0x18ce('0x55'),_0x18ce('0x57')]);return db[_0x18ce('0x41')][_0x18ce('0x4b')](_['merge'](_0x14ffaf,_0x493a2c[_0x18ce('0x4c')]),{'include':_0x493a2c[_0x18ce('0x30')][_0x18ce('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0xeb4215){var _0x5a080b=_0x493a2c[_0x18ce('0x4d')][_0x18ce('0x4e')]({'plain':!![]});if(!_0x5a080b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a080b['role']===_0x18ce('0x4d')){var _0x28beeb=_0xeb4215['get']({'plain':!![]});var _0x1d8734=_0x18ce('0x50');return db[_0x18ce('0x58')][_0x18ce('0x51')]({'where':{'name':_0x1d8734,'userProfileId':_0x5a080b[_0x18ce('0x52')]},'raw':!![]})['then'](function(_0x2f2fb8){if(_0x2f2fb8&&_0x2f2fb8[_0x18ce('0x59')]===0x0){return db['UserProfileResource']['create']({'name':_0x28beeb[_0x18ce('0x2b')],'resourceId':_0x28beeb['id'],'type':_0x2f2fb8[_0x18ce('0x2b')],'sectionId':_0x2f2fb8['id']},{})[_0x18ce('0x28')](function(){return _0xeb4215;});}else{return _0xeb4215;}})[_0x18ce('0x45')](function(_0x2ff5c7){logger[_0x18ce('0x5a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ff5c7);throw _0x2ff5c7;});}return _0xeb4215;});}})['then'](respondWithResult(_0x4dff1b,0xc9))[_0x18ce('0x45')](handleError(_0x4dff1b,null));};exports[_0x18ce('0x27')]=function(_0xaa90d8,_0x4cbf50){if(_0xaa90d8[_0x18ce('0x4c')]['id']){delete _0xaa90d8[_0x18ce('0x4c')]['id'];}return db['Campaign'][_0x18ce('0x51')]({'where':{'id':_0xaa90d8[_0x18ce('0x47')]['id']}})['then'](handleEntityNotFound(_0x4cbf50,null))[_0x18ce('0x28')](saveUpdates(_0xaa90d8['body'],null))['then'](respondWithResult(_0x4cbf50,null))[_0x18ce('0x45')](handleError(_0x4cbf50,null));};exports[_0x18ce('0x29')]=function(_0x2c6802,_0x44d6d7){return db[_0x18ce('0x41')]['find']({'where':{'id':_0x2c6802[_0x18ce('0x47')]['id']}})['then'](handleEntityNotFound(_0x44d6d7,null))[_0x18ce('0x28')](removeEntity(_0x44d6d7,null))['catch'](handleError(_0x44d6d7,null));};exports['getHoppers']=function(_0x35d9c3,_0x59f9d0,_0x1ef9f9){var _0x2bdc69={'raw':!![],'where':{}};var _0x583afc={};var _0x159ddb={'count':0x0,'rows':[]};return db[_0x18ce('0x41')][_0x18ce('0x5b')]({'where':{'id':_0x35d9c3[_0x18ce('0x47')]['id']}})[_0x18ce('0x28')](handleEntityNotFound(_0x59f9d0,null))[_0x18ce('0x28')](function(_0xdff27){if(_0xdff27){_0x583afc[_0x18ce('0x34')]=_[_0x18ce('0x31')](db[_0x18ce('0x5c')]['rawAttributes']);_0x583afc[_0x18ce('0x30')]=_[_0x18ce('0x31')](_0x35d9c3[_0x18ce('0x30')]);_0x583afc[_0x18ce('0x32')]=_[_0x18ce('0x33')](_0x583afc[_0x18ce('0x34')],_0x583afc[_0x18ce('0x30')]);_0x2bdc69['attributes']=_['intersection'](_0x583afc[_0x18ce('0x34')],qs[_0x18ce('0x49')](_0x35d9c3[_0x18ce('0x30')][_0x18ce('0x49')]));_0x2bdc69['attributes']=_0x2bdc69[_0x18ce('0x35')][_0x18ce('0x36')]?_0x2bdc69[_0x18ce('0x35')]:_0x583afc[_0x18ce('0x34')];if(!_0x35d9c3[_0x18ce('0x30')][_0x18ce('0x5d')](_0x18ce('0x37'))){_0x2bdc69[_0x18ce('0x38')]=qs[_0x18ce('0x38')](_0x35d9c3[_0x18ce('0x30')][_0x18ce('0x38')]);_0x2bdc69[_0x18ce('0x21')]=qs[_0x18ce('0x21')](_0x35d9c3['query']['offset']);}_0x2bdc69[_0x18ce('0x39')]=qs[_0x18ce('0x3a')](_0x35d9c3['query'][_0x18ce('0x3a')]);_0x2bdc69[_0x18ce('0x3b')]=qs[_0x18ce('0x32')](_[_0x18ce('0x3c')](_0x35d9c3[_0x18ce('0x30')],_0x583afc['filters']));_0x2bdc69[_0x18ce('0x3b')][_0x18ce('0x5e')]=_0xdff27['id'];if(_0x35d9c3['query']['filter']){_0x2bdc69[_0x18ce('0x3b')]=_[_0x18ce('0x3e')](_0x2bdc69[_0x18ce('0x3b')],{'$or':_[_0x18ce('0x2d')](_0x2bdc69[_0x18ce('0x35')],function(_0x3691b9){var _0x1e6dee={};_0x1e6dee[_0x3691b9]={'$like':'%'+_0x35d9c3[_0x18ce('0x30')]['filter']+'%'};return _0x1e6dee;})});}_0x2bdc69=_[_0x18ce('0x3e')]({},_0x2bdc69,_0x35d9c3[_0x18ce('0x40')]);return db['CmHopper'][_0x18ce('0x20')]({'where':_0x2bdc69[_0x18ce('0x3b')]})['then'](function(_0xb3f779){_0x159ddb[_0x18ce('0x20')]=_0xb3f779;if(_0x35d9c3[_0x18ce('0x30')]['includeAll']){_0x2bdc69[_0x18ce('0x42')]=[{'all':!![]}];}return db['CmHopper'][_0x18ce('0x43')](_0x2bdc69);})['then'](function(_0x40b904){_0x159ddb[_0x18ce('0x44')]=_0x40b904;return _0x159ddb;});}})[_0x18ce('0x28')](respondWithFilteredResult(_0x59f9d0,_0x2bdc69))[_0x18ce('0x45')](handleError(_0x59f9d0,null));};exports[_0x18ce('0x5f')]=function(_0x124c96,_0x64c013,_0x3ccccb){var _0x2d9e23={'raw':!![],'where':{}};var _0xf5565c={};var _0xa05dcb={'count':0x0,'rows':[]};return db[_0x18ce('0x41')]['findOne']({'where':{'id':_0x124c96[_0x18ce('0x47')]['id']}})[_0x18ce('0x28')](handleEntityNotFound(_0x64c013,null))[_0x18ce('0x28')](function(_0x2556b8){if(_0x2556b8){_0xf5565c[_0x18ce('0x34')]=_['keys'](db['CmHopperHistory'][_0x18ce('0x48')]);_0xf5565c[_0x18ce('0x30')]=_[_0x18ce('0x31')](_0x124c96[_0x18ce('0x30')]);_0xf5565c[_0x18ce('0x32')]=_[_0x18ce('0x33')](_0xf5565c['model'],_0xf5565c['query']);_0x2d9e23[_0x18ce('0x35')]=_['intersection'](_0xf5565c[_0x18ce('0x34')],qs[_0x18ce('0x49')](_0x124c96['query'][_0x18ce('0x49')]));_0x2d9e23[_0x18ce('0x35')]=_0x2d9e23[_0x18ce('0x35')][_0x18ce('0x36')]?_0x2d9e23[_0x18ce('0x35')]:_0xf5565c['model'];if(!_0x124c96[_0x18ce('0x30')][_0x18ce('0x5d')](_0x18ce('0x37'))){_0x2d9e23[_0x18ce('0x38')]=qs[_0x18ce('0x38')](_0x124c96[_0x18ce('0x30')][_0x18ce('0x38')]);_0x2d9e23['offset']=qs[_0x18ce('0x21')](_0x124c96[_0x18ce('0x30')]['offset']);}_0x2d9e23[_0x18ce('0x39')]=qs[_0x18ce('0x3a')](_0x124c96[_0x18ce('0x30')][_0x18ce('0x3a')]);_0x2d9e23[_0x18ce('0x3b')]=qs[_0x18ce('0x32')](_[_0x18ce('0x3c')](_0x124c96[_0x18ce('0x30')],_0xf5565c[_0x18ce('0x32')]));_0x2d9e23[_0x18ce('0x3b')]['CampaignId']=_0x2556b8['id'];if(_0x124c96[_0x18ce('0x30')]['filter']){_0x2d9e23['where']=_[_0x18ce('0x3e')](_0x2d9e23[_0x18ce('0x3b')],{'$or':_['map'](_0x2d9e23[_0x18ce('0x35')],function(_0xe2cf21){var _0x37bbec={};_0x37bbec[_0xe2cf21]={'$like':'%'+_0x124c96[_0x18ce('0x30')]['filter']+'%'};return _0x37bbec;})});}_0x2d9e23=_[_0x18ce('0x3e')]({},_0x2d9e23,_0x124c96[_0x18ce('0x40')]);return db['CmHopperHistory'][_0x18ce('0x20')]({'where':_0x2d9e23[_0x18ce('0x3b')]})['then'](function(_0x465796){_0xa05dcb[_0x18ce('0x20')]=_0x465796;if(_0x124c96[_0x18ce('0x30')][_0x18ce('0x4a')]){_0x2d9e23[_0x18ce('0x42')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x18ce('0x43')](_0x2d9e23);})[_0x18ce('0x28')](function(_0x45ef95){_0xa05dcb['rows']=_0x45ef95;return _0xa05dcb;});}})[_0x18ce('0x28')](respondWithFilteredResult(_0x64c013,_0x2d9e23))[_0x18ce('0x45')](handleError(_0x64c013,null));};exports[_0x18ce('0x60')]=function(_0x188bfa,_0x2b9fce,_0x10b9fd){var _0x2297ea={'raw':!![],'where':{}};var _0x3c1701={};var _0x43d2d1={'count':0x0,'rows':[]};return db['Campaign'][_0x18ce('0x5b')]({'where':{'id':_0x188bfa[_0x18ce('0x47')]['id']}})[_0x18ce('0x28')](handleEntityNotFound(_0x2b9fce,null))[_0x18ce('0x28')](function(_0x16677a){if(_0x16677a){_0x3c1701[_0x18ce('0x34')]=_[_0x18ce('0x31')](db[_0x18ce('0x61')][_0x18ce('0x48')]);_0x3c1701[_0x18ce('0x30')]=_[_0x18ce('0x31')](_0x188bfa[_0x18ce('0x30')]);_0x3c1701['filters']=_[_0x18ce('0x33')](_0x3c1701[_0x18ce('0x34')],_0x3c1701[_0x18ce('0x30')]);_0x2297ea[_0x18ce('0x35')]=_[_0x18ce('0x33')](_0x3c1701['model'],qs[_0x18ce('0x49')](_0x188bfa[_0x18ce('0x30')][_0x18ce('0x49')]));_0x2297ea[_0x18ce('0x35')]=_0x2297ea[_0x18ce('0x35')][_0x18ce('0x36')]?_0x2297ea[_0x18ce('0x35')]:_0x3c1701[_0x18ce('0x34')];if(!_0x188bfa[_0x18ce('0x30')][_0x18ce('0x5d')](_0x18ce('0x37'))){_0x2297ea[_0x18ce('0x38')]=qs[_0x18ce('0x38')](_0x188bfa[_0x18ce('0x30')][_0x18ce('0x38')]);_0x2297ea[_0x18ce('0x21')]=qs[_0x18ce('0x21')](_0x188bfa[_0x18ce('0x30')]['offset']);}_0x2297ea[_0x18ce('0x39')]=qs[_0x18ce('0x3a')](_0x188bfa[_0x18ce('0x30')][_0x18ce('0x3a')]);_0x2297ea['where']=qs[_0x18ce('0x32')](_[_0x18ce('0x3c')](_0x188bfa[_0x18ce('0x30')],_0x3c1701[_0x18ce('0x32')]));_0x2297ea[_0x18ce('0x3b')][_0x18ce('0x5e')]=_0x16677a['id'];if(_0x188bfa[_0x18ce('0x30')][_0x18ce('0x3d')]){_0x2297ea[_0x18ce('0x3b')]=_['merge'](_0x2297ea['where'],{'$or':_[_0x18ce('0x2d')](_0x2297ea['attributes'],function(_0x752ec6){var _0x3eb07b={};_0x3eb07b[_0x752ec6]={'$like':'%'+_0x188bfa['query'][_0x18ce('0x3d')]+'%'};return _0x3eb07b;})});}_0x2297ea=_[_0x18ce('0x3e')]({},_0x2297ea,_0x188bfa[_0x18ce('0x40')]);return db[_0x18ce('0x61')]['count']({'where':_0x2297ea[_0x18ce('0x3b')]})['then'](function(_0x451286){_0x43d2d1[_0x18ce('0x20')]=_0x451286;if(_0x188bfa[_0x18ce('0x30')][_0x18ce('0x4a')]){_0x2297ea[_0x18ce('0x42')]=[{'all':!![]}];}return db[_0x18ce('0x61')][_0x18ce('0x43')](_0x2297ea);})[_0x18ce('0x28')](function(_0x9907da){_0x43d2d1[_0x18ce('0x44')]=_0x9907da;return _0x43d2d1;});}})[_0x18ce('0x28')](respondWithFilteredResult(_0x2b9fce,_0x2297ea))['catch'](handleError(_0x2b9fce,null));};exports['getHopperBlacks']=function(_0x35c2bd,_0x4b2378,_0x81444e){var _0x33653e={'raw':!![],'where':{}};var _0x4042db={};var _0x502a34={'count':0x0,'rows':[]};return db[_0x18ce('0x41')]['findOne']({'where':{'id':_0x35c2bd['params']['id']}})[_0x18ce('0x28')](handleEntityNotFound(_0x4b2378,null))[_0x18ce('0x28')](function(_0x6c0346){if(_0x6c0346){_0x4042db[_0x18ce('0x34')]=_[_0x18ce('0x31')](db['CmHopperBlack']['rawAttributes']);_0x4042db['query']=_[_0x18ce('0x31')](_0x35c2bd['query']);_0x4042db['filters']=_[_0x18ce('0x33')](_0x4042db[_0x18ce('0x34')],_0x4042db[_0x18ce('0x30')]);_0x33653e['attributes']=_[_0x18ce('0x33')](_0x4042db[_0x18ce('0x34')],qs['fields'](_0x35c2bd[_0x18ce('0x30')]['fields']));_0x33653e[_0x18ce('0x35')]=_0x33653e[_0x18ce('0x35')][_0x18ce('0x36')]?_0x33653e[_0x18ce('0x35')]:_0x4042db[_0x18ce('0x34')];if(!_0x35c2bd[_0x18ce('0x30')][_0x18ce('0x5d')](_0x18ce('0x37'))){_0x33653e['limit']=qs[_0x18ce('0x38')](_0x35c2bd[_0x18ce('0x30')][_0x18ce('0x38')]);_0x33653e[_0x18ce('0x21')]=qs[_0x18ce('0x21')](_0x35c2bd[_0x18ce('0x30')][_0x18ce('0x21')]);}_0x33653e['order']=qs[_0x18ce('0x3a')](_0x35c2bd[_0x18ce('0x30')][_0x18ce('0x3a')]);_0x33653e[_0x18ce('0x3b')]=qs['filters'](_[_0x18ce('0x3c')](_0x35c2bd['query'],_0x4042db[_0x18ce('0x32')]));_0x33653e[_0x18ce('0x3b')][_0x18ce('0x5e')]=_0x6c0346['id'];if(_0x35c2bd[_0x18ce('0x30')][_0x18ce('0x3d')]){_0x33653e[_0x18ce('0x3b')]=_[_0x18ce('0x3e')](_0x33653e[_0x18ce('0x3b')],{'$or':_['map'](_0x33653e[_0x18ce('0x35')],function(_0x201fd0){var _0xc8c5c5={};_0xc8c5c5[_0x201fd0]={'$like':'%'+_0x35c2bd[_0x18ce('0x30')][_0x18ce('0x3d')]+'%'};return _0xc8c5c5;})});}_0x33653e=_[_0x18ce('0x3e')]({},_0x33653e,_0x35c2bd[_0x18ce('0x40')]);return db[_0x18ce('0x62')][_0x18ce('0x20')]({'where':_0x33653e[_0x18ce('0x3b')]})[_0x18ce('0x28')](function(_0x3a29bc){_0x502a34[_0x18ce('0x20')]=_0x3a29bc;if(_0x35c2bd[_0x18ce('0x30')][_0x18ce('0x4a')]){_0x33653e[_0x18ce('0x42')]=[{'all':!![]}];}return db[_0x18ce('0x62')][_0x18ce('0x43')](_0x33653e);})[_0x18ce('0x28')](function(_0x168bef){_0x502a34[_0x18ce('0x44')]=_0x168bef;return _0x502a34;});}})[_0x18ce('0x28')](respondWithFilteredResult(_0x4b2378,_0x33653e))[_0x18ce('0x45')](handleError(_0x4b2378,null));};exports[_0x18ce('0x63')]=function(_0xfe9465,_0x3e3d11,_0x2ca914){var _0x481518={};var _0x2f4a64={};var _0x3b3a52;var _0x33a2bb;return db[_0x18ce('0x41')][_0x18ce('0x5b')]({'where':{'id':_0xfe9465[_0x18ce('0x47')]['id']}})['then'](handleEntityNotFound(_0x3e3d11,null))[_0x18ce('0x28')](function(_0x578391){if(_0x578391){_0x3b3a52=_0x578391;_0x2f4a64[_0x18ce('0x34')]=_[_0x18ce('0x31')](db[_0x18ce('0x64')][_0x18ce('0x48')]);_0x2f4a64[_0x18ce('0x30')]=_[_0x18ce('0x31')](_0xfe9465['query']);_0x2f4a64[_0x18ce('0x32')]=_[_0x18ce('0x33')](_0x2f4a64[_0x18ce('0x34')],_0x2f4a64[_0x18ce('0x30')]);_0x481518['attributes']=_[_0x18ce('0x33')](_0x2f4a64['model'],qs[_0x18ce('0x49')](_0xfe9465[_0x18ce('0x30')][_0x18ce('0x49')]));_0x481518[_0x18ce('0x35')]=_0x481518[_0x18ce('0x35')][_0x18ce('0x36')]?_0x481518[_0x18ce('0x35')]:_0x2f4a64['model'];_0x481518[_0x18ce('0x39')]=qs[_0x18ce('0x3a')](_0xfe9465[_0x18ce('0x30')][_0x18ce('0x3a')]);_0x481518[_0x18ce('0x3b')]=qs['filters'](_[_0x18ce('0x3c')](_0xfe9465[_0x18ce('0x30')],_0x2f4a64[_0x18ce('0x32')]));if(_0xfe9465[_0x18ce('0x30')][_0x18ce('0x3d')]){_0x481518[_0x18ce('0x3b')]=_[_0x18ce('0x3e')](_0x481518[_0x18ce('0x3b')],{'$or':_[_0x18ce('0x2d')](_0x481518['attributes'],function(_0x27a521){var _0x50745b={};_0x50745b[_0x27a521]={'$like':'%'+_0xfe9465['query'][_0x18ce('0x3d')]+'%'};return _0x50745b;})});}_0x481518=_[_0x18ce('0x3e')]({},_0x481518,_0xfe9465[_0x18ce('0x40')]);return _0x3b3a52[_0x18ce('0x63')](_0x481518);}})['then'](function(_0x30b6e0){if(_0x30b6e0){_0x33a2bb=_0x30b6e0[_0x18ce('0x36')];if(!_0xfe9465[_0x18ce('0x30')][_0x18ce('0x5d')](_0x18ce('0x37'))){_0x481518[_0x18ce('0x38')]=qs[_0x18ce('0x38')](_0xfe9465[_0x18ce('0x30')]['limit']);_0x481518[_0x18ce('0x21')]=qs[_0x18ce('0x21')](_0xfe9465[_0x18ce('0x30')][_0x18ce('0x21')]);}return _0x3b3a52['getLists'](_0x481518);}})[_0x18ce('0x28')](function(_0xd312a1){if(_0xd312a1){return _0xd312a1?{'count':_0x33a2bb,'rows':_0xd312a1}:null;}})[_0x18ce('0x28')](respondWithResult(_0x3e3d11,null))[_0x18ce('0x45')](handleError(_0x3e3d11,null));};exports[_0x18ce('0x65')]=function(_0xbac32b,_0xfa0a7,_0x505163){var _0x350654,_0x1ecf8b;return db[_0x18ce('0x41')][_0x18ce('0x51')]({'where':{'id':_0xbac32b[_0x18ce('0x47')]['id']}})[_0x18ce('0x28')](handleEntityNotFound(_0xfa0a7,null))[_0x18ce('0x28')](function(_0xa82cfa){if(_0xa82cfa){_0x1ecf8b=_0xa82cfa;return _0xa82cfa['addLists'](_0xbac32b[_0x18ce('0x4c')][_0x18ce('0x66')],_[_0x18ce('0x56')](_0xbac32b[_0x18ce('0x4c')],[_0x18ce('0x66'),'id'])||{});}return null;})[_0x18ce('0x67')](function(_0xbe8375){var _0x3a4bf9;_0x350654=_0xbe8375||[];var _0x49980b=[];if(_0xbe8375){for(var _0x415bb8=0x0;_0x415bb8<_0xbe8375['length'];_0x415bb8+=0x1){var _0x5a234a=_0xbe8375[_0x415bb8][_0x18ce('0x4e')]({'plain':!![]});_0x1ecf8b[_0x18ce('0x68')]=_0xbac32b[_0x18ce('0x4c')][_0x18ce('0x68')]?_0xbac32b[_0x18ce('0x4c')][_0x18ce('0x68')]:_0x1ecf8b['dialCheckDuplicateType'];switch(_0x1ecf8b[_0x18ce('0x68')]){case _0x18ce('0x69'):_0x3a4bf9=squel[_0x18ce('0x6a')]()[_0x18ce('0x6b')](_0x18ce('0x6c'))[_0x18ce('0x6d')]([_0x18ce('0x6e'),'scheduledAt',_0x18ce('0x6f'),_0x18ce('0x70'),'CampaignId',_0x18ce('0x55'),'updatedAt'],squel['select']()[_0x18ce('0x71')](_0x18ce('0x6e'),'phone')[_0x18ce('0x71')](_0x18ce('0x72'),'scheduledAt')[_0x18ce('0x71')]('id',_0x18ce('0x6f'))[_0x18ce('0x71')](_0x5a234a[_0x18ce('0x73')][_0x18ce('0x74')](),_0x18ce('0x70'))[_0x18ce('0x71')](_0xbac32b[_0x18ce('0x47')]['id'][_0x18ce('0x74')](),_0x18ce('0x5e'))['field']('NOW()','createdAt')['field'](_0x18ce('0x72'),_0x18ce('0x57'))[_0x18ce('0x75')](_0x18ce('0x76'))[_0x18ce('0x3b')](_0x18ce('0x77'))[_0x18ce('0x3b')]('ListId\x20=\x20?',_0x5a234a[_0x18ce('0x73')][_0x18ce('0x74')]())[_0x18ce('0x3b')](_0x18ce('0x78'))['where'](_0x18ce('0x79'),squel['select']()[_0x18ce('0x71')](_0x18ce('0x7a'))['from']('cm_hopper_final')[_0x18ce('0x3b')](_0x18ce('0x7b'),_0xbac32b[_0x18ce('0x47')]['id']['toString']()))[_0x18ce('0x3b')](_0x18ce('0x79'),squel[_0x18ce('0x7c')]()[_0x18ce('0x71')](_0x18ce('0x7d'))[_0x18ce('0x75')]('cm_hopper')[_0x18ce('0x3b')](_0x18ce('0x7b'),_0xbac32b[_0x18ce('0x47')]['id'][_0x18ce('0x74')]())))[_0x18ce('0x74')]();break;case _0x18ce('0x7e'):_0x3a4bf9=squel[_0x18ce('0x6a')]()[_0x18ce('0x6b')](_0x18ce('0x6c'))['fromQuery'](['phone',_0x18ce('0x7f'),'ContactId',_0x18ce('0x70'),'CampaignId',_0x18ce('0x55'),_0x18ce('0x57')],squel[_0x18ce('0x7c')]()[_0x18ce('0x71')](_0x18ce('0x6e'),_0x18ce('0x6e'))[_0x18ce('0x71')](_0x18ce('0x72'),_0x18ce('0x7f'))[_0x18ce('0x71')]('id',_0x18ce('0x6f'))['field'](_0x5a234a[_0x18ce('0x73')]['toString'](),_0x18ce('0x70'))[_0x18ce('0x71')](_0xbac32b['params']['id']['toString'](),_0x18ce('0x5e'))[_0x18ce('0x71')](_0x18ce('0x72'),_0x18ce('0x55'))[_0x18ce('0x71')](_0x18ce('0x72'),_0x18ce('0x57'))[_0x18ce('0x75')](_0x18ce('0x76'))[_0x18ce('0x3b')](_0x18ce('0x77'))[_0x18ce('0x3b')](_0x18ce('0x80'),_0x5a234a[_0x18ce('0x73')][_0x18ce('0x74')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x18ce('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x18ce('0x71')]('COALESCE(phone,\x27\x27)')[_0x18ce('0x75')](_0x18ce('0x6c'))[_0x18ce('0x3b')](_0x18ce('0x7b'),_0xbac32b['params']['id'][_0x18ce('0x74')]())))[_0x18ce('0x74')]();break;default:_0x3a4bf9=squel[_0x18ce('0x6a')]()[_0x18ce('0x6b')]('cm_hopper')['fromQuery']([_0x18ce('0x6e'),_0x18ce('0x7f'),_0x18ce('0x6f'),_0x18ce('0x70'),_0x18ce('0x5e'),_0x18ce('0x55'),_0x18ce('0x57')],squel[_0x18ce('0x7c')]()[_0x18ce('0x71')]('phone','phone')[_0x18ce('0x71')](_0x18ce('0x72'),_0x18ce('0x7f'))[_0x18ce('0x71')]('id','ContactId')['field'](_0x5a234a[_0x18ce('0x73')][_0x18ce('0x74')](),_0x18ce('0x70'))[_0x18ce('0x71')](_0xbac32b['params']['id']['toString'](),_0x18ce('0x5e'))[_0x18ce('0x71')]('NOW()',_0x18ce('0x55'))[_0x18ce('0x71')](_0x18ce('0x72'),_0x18ce('0x57'))[_0x18ce('0x75')]('cm_contacts')[_0x18ce('0x3b')](_0x18ce('0x77'))['where'](_0x18ce('0x80'),_0x5a234a['CmListId']['toString']())['where'](_0x18ce('0x78')))[_0x18ce('0x74')]();}_0x49980b[_0x18ce('0x81')](db[_0x18ce('0x82')][_0x18ce('0x30')](_0x3a4bf9));}return BPromise[_0x18ce('0x83')](_0x49980b);}})[_0x18ce('0x28')](function(){return _0x350654;})[_0x18ce('0x28')](respondWithResult(_0xfa0a7,null))[_0x18ce('0x45')](handleError(_0xfa0a7,null));};exports[_0x18ce('0x84')]=function(_0x22968a,_0x13afd1,_0xcdb634){return db[_0x18ce('0x41')][_0x18ce('0x51')]({'where':{'id':_0x22968a[_0x18ce('0x47')]['id']}})[_0x18ce('0x28')](handleEntityNotFound(_0x13afd1,null))[_0x18ce('0x28')](function(_0x5bffe9){if(_0x5bffe9){return _0x5bffe9[_0x18ce('0x84')](_0x22968a[_0x18ce('0x30')]['ids']);}})[_0x18ce('0x28')](function(_0x414d9e){if(_0x414d9e){return db['CmHopper'][_0x18ce('0x29')]({'where':{'ListId':_0x22968a[_0x18ce('0x30')][_0x18ce('0x66')],'CampaignId':_0x22968a[_0x18ce('0x47')]['id']}})[_0x18ce('0x28')](function(){return _0x414d9e;});}})['then'](respondWithStatusCode(_0x13afd1,null))[_0x18ce('0x45')](handleError(_0x13afd1,null));};exports['getBlackLists']=function(_0x3b7c1a,_0xbab991,_0x186ef0){var _0xf522fe={};var _0x3c9f92={};var _0x33cf97;var _0x52905;return db[_0x18ce('0x41')][_0x18ce('0x5b')]({'where':{'id':_0x3b7c1a['params']['id']}})[_0x18ce('0x28')](handleEntityNotFound(_0xbab991,null))[_0x18ce('0x28')](function(_0x27a23c){if(_0x27a23c){_0x33cf97=_0x27a23c;_0x3c9f92[_0x18ce('0x34')]=_[_0x18ce('0x31')](db[_0x18ce('0x64')][_0x18ce('0x48')]);_0x3c9f92[_0x18ce('0x30')]=_[_0x18ce('0x31')](_0x3b7c1a['query']);_0x3c9f92['filters']=_[_0x18ce('0x33')](_0x3c9f92[_0x18ce('0x34')],_0x3c9f92[_0x18ce('0x30')]);_0xf522fe[_0x18ce('0x35')]=_[_0x18ce('0x33')](_0x3c9f92[_0x18ce('0x34')],qs[_0x18ce('0x49')](_0x3b7c1a[_0x18ce('0x30')][_0x18ce('0x49')]));_0xf522fe[_0x18ce('0x35')]=_0xf522fe[_0x18ce('0x35')][_0x18ce('0x36')]?_0xf522fe['attributes']:_0x3c9f92['model'];_0xf522fe[_0x18ce('0x39')]=qs[_0x18ce('0x3a')](_0x3b7c1a[_0x18ce('0x30')][_0x18ce('0x3a')]);_0xf522fe[_0x18ce('0x3b')]=qs[_0x18ce('0x32')](_['pick'](_0x3b7c1a[_0x18ce('0x30')],_0x3c9f92[_0x18ce('0x32')]));if(_0x3b7c1a['query'][_0x18ce('0x3d')]){_0xf522fe[_0x18ce('0x3b')]=_['merge'](_0xf522fe['where'],{'$or':_[_0x18ce('0x2d')](_0xf522fe[_0x18ce('0x35')],function(_0x5afd6c){var _0xe0a15f={};_0xe0a15f[_0x5afd6c]={'$like':'%'+_0x3b7c1a[_0x18ce('0x30')][_0x18ce('0x3d')]+'%'};return _0xe0a15f;})});}_0xf522fe=_[_0x18ce('0x3e')]({},_0xf522fe,_0x3b7c1a['options']);return _0x33cf97[_0x18ce('0x85')](_0xf522fe);}})['then'](function(_0x19dda6){if(_0x19dda6){_0x52905=_0x19dda6[_0x18ce('0x36')];if(!_0x3b7c1a['query']['hasOwnProperty'](_0x18ce('0x37'))){_0xf522fe[_0x18ce('0x38')]=qs['limit'](_0x3b7c1a[_0x18ce('0x30')][_0x18ce('0x38')]);_0xf522fe[_0x18ce('0x21')]=qs[_0x18ce('0x21')](_0x3b7c1a['query'][_0x18ce('0x21')]);}return _0x33cf97[_0x18ce('0x85')](_0xf522fe);}})['then'](function(_0x4a3f06){if(_0x4a3f06){return _0x4a3f06?{'count':_0x52905,'rows':_0x4a3f06}:null;}})[_0x18ce('0x28')](respondWithResult(_0xbab991,null))[_0x18ce('0x45')](handleError(_0xbab991,null));};exports['addBlackLists']=function(_0x269244,_0x44105d,_0x59ade5){var _0x8f74d3,_0x50d7d7;return db[_0x18ce('0x41')][_0x18ce('0x51')]({'where':{'id':_0x269244['params']['id']}})[_0x18ce('0x28')](handleEntityNotFound(_0x44105d,null))[_0x18ce('0x28')](function(_0x35d46a){if(_0x35d46a){_0x50d7d7=_0x35d46a;return _0x35d46a[_0x18ce('0x86')](_0x269244[_0x18ce('0x4c')][_0x18ce('0x66')],_[_0x18ce('0x56')](_0x269244[_0x18ce('0x4c')],[_0x18ce('0x66'),'id'])||{});}return null;})['spread'](function(_0x49c868){var _0x3c142e;_0x8f74d3=_0x49c868||[];var _0x1ac775=[];if(_0x49c868){for(var _0x162d62=0x0;_0x162d62<_0x49c868[_0x18ce('0x36')];_0x162d62+=0x1){var _0x1992c3=_0x49c868[_0x162d62][_0x18ce('0x4e')]({'plain':!![]});_0x3c142e=squel[_0x18ce('0x6a')]()[_0x18ce('0x6b')](_0x18ce('0x87'))[_0x18ce('0x6d')]([_0x18ce('0x6e'),'ContactId','ListId',_0x18ce('0x5e'),'createdAt','updatedAt'],squel[_0x18ce('0x7c')]()['field'](_0x18ce('0x6e'),_0x18ce('0x6e'))[_0x18ce('0x71')]('id',_0x18ce('0x6f'))[_0x18ce('0x71')](_0x1992c3['CmListId'][_0x18ce('0x74')](),_0x18ce('0x70'))[_0x18ce('0x71')](_0x269244[_0x18ce('0x47')]['id'][_0x18ce('0x74')](),'CampaignId')['field'](_0x18ce('0x72'),'createdAt')[_0x18ce('0x71')](_0x18ce('0x72'),_0x18ce('0x57'))[_0x18ce('0x75')](_0x18ce('0x76'))[_0x18ce('0x3b')](_0x18ce('0x77'))['where'](_0x18ce('0x80'),_0x1992c3[_0x18ce('0x73')][_0x18ce('0x74')]())[_0x18ce('0x3b')](_0x18ce('0x78')))[_0x18ce('0x74')]();_0x1ac775[_0x18ce('0x81')](db[_0x18ce('0x82')]['query'](_0x3c142e));}return BPromise['all'](_0x1ac775);}})[_0x18ce('0x28')](function(){return _0x8f74d3;})[_0x18ce('0x28')](respondWithResult(_0x44105d,null))[_0x18ce('0x45')](handleError(_0x44105d,null));};exports[_0x18ce('0x88')]=function(_0x1fd67b,_0x149ef5,_0x44c61b){return db[_0x18ce('0x41')]['find']({'where':{'id':_0x1fd67b['params']['id']}})[_0x18ce('0x28')](handleEntityNotFound(_0x149ef5,null))['then'](function(_0x39e766){if(_0x39e766){return _0x39e766['removeBlackLists'](_0x1fd67b[_0x18ce('0x30')][_0x18ce('0x66')]);}})['then'](function(_0x4dde1a){if(_0x4dde1a){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x1fd67b[_0x18ce('0x30')]['ids'],'CampaignId':_0x1fd67b['params']['id']}})[_0x18ce('0x28')](function(){return _0x4dde1a;});}})[_0x18ce('0x28')](respondWithStatusCode(_0x149ef5,null))['catch'](handleError(_0x149ef5,null));}; \ No newline at end of file +var _0x6bee=['set','Content-Range','apply','save','then','destroy','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','Campaign','includeAll','findAll','catch','show','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','IvrCampaigns','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','length','include','omit','createdAt','updatedAt','body','role','params','getHoppers','findOne','CmHopper','nolimit','CampaignId','getHopperHistories','CmHopperHistory','rows','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','ContactId','ListId','select','field','phone','toString','NOW()','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','scheduledAt','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','fromQuery','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','all','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset'];(function(_0x51aab2,_0x4e7ee3){var _0x1c25a2=function(_0x3189e5){while(--_0x3189e5){_0x51aab2['push'](_0x51aab2['shift']());}};_0x1c25a2(++_0x4e7ee3);}(_0x6bee,0x66));var _0xe6be=function(_0x218daf,_0x266ab3){_0x218daf=_0x218daf-0x0;var _0x1477fe=_0x6bee[_0x218daf];return _0x1477fe;};'use strict';var pdf=require(_0xe6be('0x0'));var emlformat=require(_0xe6be('0x1'));var rimraf=require(_0xe6be('0x2'));var zipdir=require(_0xe6be('0x3'));var jsonpatch=require(_0xe6be('0x4'));var rp=require(_0xe6be('0x5'));var moment=require(_0xe6be('0x6'));var BPromise=require(_0xe6be('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe6be('0x8'));var csv=require('to-csv');var ejs=require(_0xe6be('0x9'));var fs=require('fs');var _=require(_0xe6be('0xa'));var squel=require(_0xe6be('0xb'));var crypto=require(_0xe6be('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe6be('0xd'));var toCsv=require(_0xe6be('0xe'));var querystring=require('querystring');var Papa=require(_0xe6be('0xf'));var Redis=require(_0xe6be('0x10'));var authService=require(_0xe6be('0x11'));var qs=require(_0xe6be('0x12'));var as=require(_0xe6be('0x13'));var hardwareService=require(_0xe6be('0x14'));var logger=require(_0xe6be('0x15'))('api');var utils=require(_0xe6be('0x16'));var config=require(_0xe6be('0x17'));var licenseUtil=require(_0xe6be('0x18'));var db=require(_0xe6be('0x19'))['db'];function respondWithStatusCode(_0x4d24e2,_0x59186f){_0x59186f=_0x59186f||0xcc;return function(_0x35ad14){if(_0x35ad14){return _0x4d24e2[_0xe6be('0x1a')](_0x59186f);}return _0x4d24e2[_0xe6be('0x1b')](_0x59186f)[_0xe6be('0x1c')]();};}function respondWithResult(_0x7f4344,_0x470789){_0x470789=_0x470789||0xc8;return function(_0x292ae4){if(_0x292ae4){return _0x7f4344[_0xe6be('0x1b')](_0x470789)['json'](_0x292ae4);}};}function respondWithFilteredResult(_0x468817,_0x410c47){return function(_0x53d86a){if(_0x53d86a){var _0x507d8b=_0x53d86a[_0xe6be('0x1d')],_0x5156d6=_0x410c47['offset'],_0x1d2e1e=_0x410c47[_0xe6be('0x1e')]+_0x410c47['limit'],_0x5d681c;if(_0x1d2e1e>=_0x507d8b){_0x1d2e1e=_0x507d8b;_0x5d681c=0xc8;}else{_0x5d681c=0xce;}_0x468817[_0xe6be('0x1b')](_0x5d681c);return _0x468817[_0xe6be('0x1f')](_0xe6be('0x20'),_0x5156d6+'-'+_0x1d2e1e+'/'+_0x507d8b)['json'](_0x53d86a);}return null;};}function patchUpdates(_0x3f6a43){return function(_0x7d0d7b){try{jsonpatch[_0xe6be('0x21')](_0x7d0d7b,_0x3f6a43,!![]);}catch(_0x4ec69e){return BPromise['reject'](_0x4ec69e);}return _0x7d0d7b[_0xe6be('0x22')]();};}function saveUpdates(_0x50d5b2,_0x38d2e6){return function(_0x1e2c9e){if(_0x1e2c9e){return _0x1e2c9e['update'](_0x50d5b2)[_0xe6be('0x23')](function(_0x4eff0f){return _0x4eff0f;});}return null;};}function removeEntity(_0x1bcc54,_0x1747e2){return function(_0x5bf6ad){if(_0x5bf6ad){return _0x5bf6ad[_0xe6be('0x24')]()['then'](function(){var _0x496dd6=_0x5bf6ad['get']({'plain':!![]});var _0x3238bb='IvrCampaigns';return db['UserProfileResource'][_0xe6be('0x24')]({'where':{'type':_0x3238bb,'resourceId':_0x496dd6['id']}})[_0xe6be('0x23')](function(){return _0x5bf6ad;});})[_0xe6be('0x23')](function(){_0x1bcc54[_0xe6be('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8b2a66,_0x107f6b){return function(_0x1a5d81){if(!_0x1a5d81){_0x8b2a66['sendStatus'](0x194);}return _0x1a5d81;};}function handleError(_0x1c33ee,_0x294994){_0x294994=_0x294994||0x1f4;return function(_0x373b81){logger[_0xe6be('0x25')](_0x373b81['stack']);if(_0x373b81['name']){delete _0x373b81[_0xe6be('0x26')];}_0x1c33ee['status'](_0x294994)['send'](_0x373b81);};}exports[_0xe6be('0x27')]=function(_0x21c821,_0x132d6b){var _0x183a4d={},_0x12448d={},_0x44b729={'count':0x0,'rows':[]};var _0x5d6409=_[_0xe6be('0x28')](db['Campaign'][_0xe6be('0x29')],function(_0x3cd156){return{'name':_0x3cd156[_0xe6be('0x2a')],'type':_0x3cd156[_0xe6be('0x2b')][_0xe6be('0x2c')]};});_0x12448d[_0xe6be('0x2d')]=_[_0xe6be('0x28')](_0x5d6409,'name');_0x12448d[_0xe6be('0x2e')]=_[_0xe6be('0x2f')](_0x21c821[_0xe6be('0x2e')]);_0x12448d[_0xe6be('0x30')]=_['intersection'](_0x12448d[_0xe6be('0x2d')],_0x12448d['query']);_0x183a4d[_0xe6be('0x31')]=_[_0xe6be('0x32')](_0x12448d[_0xe6be('0x2d')],qs[_0xe6be('0x33')](_0x21c821[_0xe6be('0x2e')][_0xe6be('0x33')]));_0x183a4d[_0xe6be('0x31')]=_0x183a4d[_0xe6be('0x31')]['length']?_0x183a4d[_0xe6be('0x31')]:_0x12448d[_0xe6be('0x2d')];if(!_0x21c821[_0xe6be('0x2e')][_0xe6be('0x34')]('nolimit')){_0x183a4d['limit']=qs[_0xe6be('0x35')](_0x21c821[_0xe6be('0x2e')][_0xe6be('0x35')]);_0x183a4d[_0xe6be('0x1e')]=qs[_0xe6be('0x1e')](_0x21c821[_0xe6be('0x2e')]['offset']);}_0x183a4d[_0xe6be('0x36')]=qs[_0xe6be('0x37')](_0x21c821[_0xe6be('0x2e')][_0xe6be('0x37')]);_0x183a4d[_0xe6be('0x38')]=qs['filters'](_[_0xe6be('0x39')](_0x21c821[_0xe6be('0x2e')],_0x12448d[_0xe6be('0x30')]),_0x5d6409);if(_0x21c821[_0xe6be('0x2e')][_0xe6be('0x3a')]){_0x183a4d[_0xe6be('0x38')]=_[_0xe6be('0x3b')](_0x183a4d[_0xe6be('0x38')],{'$or':_[_0xe6be('0x28')](_0x5d6409,function(_0x54d740){if(_0x54d740[_0xe6be('0x2b')]!==_0xe6be('0x3c')){var _0x4b72a3={};_0x4b72a3[_0x54d740[_0xe6be('0x26')]]={'$like':'%'+_0x21c821[_0xe6be('0x2e')][_0xe6be('0x3a')]+'%'};return _0x4b72a3;}})});}_0x183a4d=_['merge']({},_0x183a4d,_0x21c821[_0xe6be('0x3d')]);var _0x3044e4={'where':_0x183a4d[_0xe6be('0x38')]};return db[_0xe6be('0x3e')][_0xe6be('0x1d')](_0x3044e4)[_0xe6be('0x23')](function(_0x396ea7){_0x44b729[_0xe6be('0x1d')]=_0x396ea7;if(_0x21c821['query'][_0xe6be('0x3f')]){_0x183a4d['include']=[{'all':!![]}];}return db[_0xe6be('0x3e')][_0xe6be('0x40')](_0x183a4d);})['then'](function(_0x2b1574){_0x44b729['rows']=_0x2b1574;return _0x44b729;})['then'](respondWithFilteredResult(_0x132d6b,_0x183a4d))[_0xe6be('0x41')](handleError(_0x132d6b,null));};exports[_0xe6be('0x42')]=function(_0xed8307,_0x31a6aa){var _0x424128={'raw':![],'where':{'id':_0xed8307['params']['id']}},_0x2ea572={};_0x2ea572[_0xe6be('0x2d')]=_['keys'](db[_0xe6be('0x3e')][_0xe6be('0x29')]);_0x2ea572[_0xe6be('0x2e')]=_[_0xe6be('0x2f')](_0xed8307[_0xe6be('0x2e')]);_0x2ea572[_0xe6be('0x30')]=_[_0xe6be('0x32')](_0x2ea572[_0xe6be('0x2d')],_0x2ea572[_0xe6be('0x2e')]);_0x424128[_0xe6be('0x31')]=_['intersection'](_0x2ea572[_0xe6be('0x2d')],qs[_0xe6be('0x33')](_0xed8307['query']['fields']));_0x424128[_0xe6be('0x31')]=_0x424128[_0xe6be('0x31')]['length']?_0x424128[_0xe6be('0x31')]:_0x2ea572[_0xe6be('0x2d')];if(_0xed8307['query']['includeAll']){_0x424128['include']=[{'all':!![]}];}_0x424128=_[_0xe6be('0x3b')]({},_0x424128,_0xed8307['options']);return db[_0xe6be('0x3e')]['find'](_0x424128)[_0xe6be('0x23')](handleEntityNotFound(_0x31a6aa,null))['then'](respondWithResult(_0x31a6aa,null))[_0xe6be('0x41')](handleError(_0x31a6aa,null));};exports[_0xe6be('0x43')]=function(_0x59eb51,_0x5b60da){return db[_0xe6be('0x3e')][_0xe6be('0x43')](_0x59eb51['body'],{})['then'](function(_0x567bd6){var _0x38a1b1=_0x59eb51[_0xe6be('0x44')][_0xe6be('0x45')]({'plain':!![]});if(!_0x38a1b1)throw new Error(_0xe6be('0x46'));if(_0x38a1b1['role']==='user'){var _0x4cc9ab=_0x567bd6['get']({'plain':!![]});var _0x4b20c5=_0xe6be('0x47');return db[_0xe6be('0x48')][_0xe6be('0x49')]({'where':{'name':_0x4b20c5,'userProfileId':_0x38a1b1[_0xe6be('0x4a')]},'raw':!![]})[_0xe6be('0x23')](function(_0x5b14db){if(_0x5b14db&&_0x5b14db[_0xe6be('0x4b')]===0x0){return db[_0xe6be('0x4c')]['create']({'name':_0x4cc9ab[_0xe6be('0x26')],'resourceId':_0x4cc9ab['id'],'type':_0x5b14db['name'],'sectionId':_0x5b14db['id']},{})[_0xe6be('0x23')](function(){return _0x567bd6;});}else{return _0x567bd6;}})[_0xe6be('0x41')](function(_0x4b9a44){logger[_0xe6be('0x25')](_0xe6be('0x4d'),_0x4b9a44);throw _0x4b9a44;});}return _0x567bd6;})['then'](respondWithResult(_0x5b60da,0xc9))[_0xe6be('0x41')](handleError(_0x5b60da,null));};exports['clone']=function(_0x38744d,_0x2b0ce3){var _0x19503f={'where':{'id':_0x38744d['params']['id']}},_0x2741be={};_0x2741be[_0xe6be('0x2d')]=_['keys'](db[_0xe6be('0x3e')]['rawAttributes']);_0x19503f['attributes']=_[_0xe6be('0x32')](_0x2741be[_0xe6be('0x2d')],qs['fields'](_0x38744d[_0xe6be('0x2e')][_0xe6be('0x33')]));_0x19503f[_0xe6be('0x31')]=_0x19503f[_0xe6be('0x31')][_0xe6be('0x4e')]?_0x19503f[_0xe6be('0x31')]:_0x2741be['model'];if(_0x38744d[_0xe6be('0x2e')][_0xe6be('0x3f')]){_0x19503f[_0xe6be('0x4f')]=[{'all':!![]}];}_0x19503f=_[_0xe6be('0x3b')]({},_0x19503f,_0x38744d[_0xe6be('0x3d')]);return db['Campaign'][_0xe6be('0x49')](_0x19503f)['then'](handleEntityNotFound(_0x2b0ce3,null))[_0xe6be('0x23')](function(_0x3710da){if(_0x3710da){var _0x52da9b=_0x3710da['get']({'plain':!![]});_0x52da9b=qs[_0xe6be('0x50')](_0x52da9b,['id',_0xe6be('0x51'),_0xe6be('0x52')]);_0x38744d[_0xe6be('0x53')]=_[_0xe6be('0x50')](_0x38744d['body'],['id',_0xe6be('0x51'),_0xe6be('0x52')]);return db[_0xe6be('0x3e')]['create'](_[_0xe6be('0x3b')](_0x52da9b,_0x38744d[_0xe6be('0x53')]),{'include':_0x38744d[_0xe6be('0x2e')][_0xe6be('0x3f')]?[{'all':!![]}]:undefined})['then'](function(_0x129ffb){var _0x216a19=_0x38744d[_0xe6be('0x44')]['get']({'plain':!![]});if(!_0x216a19)throw new Error(_0xe6be('0x46'));if(_0x216a19[_0xe6be('0x54')]==='user'){var _0x579f28=_0x129ffb[_0xe6be('0x45')]({'plain':!![]});var _0x11f714=_0xe6be('0x47');return db[_0xe6be('0x48')][_0xe6be('0x49')]({'where':{'name':_0x11f714,'userProfileId':_0x216a19[_0xe6be('0x4a')]},'raw':!![]})['then'](function(_0x28a370){if(_0x28a370&&_0x28a370['autoAssociation']===0x0){return db[_0xe6be('0x4c')]['create']({'name':_0x579f28['name'],'resourceId':_0x579f28['id'],'type':_0x28a370[_0xe6be('0x26')],'sectionId':_0x28a370['id']},{})[_0xe6be('0x23')](function(){return _0x129ffb;});}else{return _0x129ffb;}})['catch'](function(_0x116888){logger[_0xe6be('0x25')](_0xe6be('0x4d'),_0x116888);throw _0x116888;});}return _0x129ffb;});}})['then'](respondWithResult(_0x2b0ce3,0xc9))[_0xe6be('0x41')](handleError(_0x2b0ce3,null));};exports['update']=function(_0x5c42e4,_0x1e806b){if(_0x5c42e4['body']['id']){delete _0x5c42e4[_0xe6be('0x53')]['id'];}return db[_0xe6be('0x3e')][_0xe6be('0x49')]({'where':{'id':_0x5c42e4[_0xe6be('0x55')]['id']}})['then'](handleEntityNotFound(_0x1e806b,null))['then'](saveUpdates(_0x5c42e4[_0xe6be('0x53')],null))['then'](respondWithResult(_0x1e806b,null))[_0xe6be('0x41')](handleError(_0x1e806b,null));};exports['destroy']=function(_0x2a2868,_0x99b299){return db['Campaign'][_0xe6be('0x49')]({'where':{'id':_0x2a2868[_0xe6be('0x55')]['id']}})[_0xe6be('0x23')](handleEntityNotFound(_0x99b299,null))[_0xe6be('0x23')](removeEntity(_0x99b299,null))[_0xe6be('0x41')](handleError(_0x99b299,null));};exports[_0xe6be('0x56')]=function(_0x234c6e,_0x43bd8f,_0x470132){var _0x42b232={'raw':!![],'where':{}};var _0x35f5e8={};var _0xd97f19={'count':0x0,'rows':[]};return db['Campaign'][_0xe6be('0x57')]({'where':{'id':_0x234c6e[_0xe6be('0x55')]['id']}})[_0xe6be('0x23')](handleEntityNotFound(_0x43bd8f,null))['then'](function(_0x2982c2){if(_0x2982c2){_0x35f5e8[_0xe6be('0x2d')]=_[_0xe6be('0x2f')](db[_0xe6be('0x58')]['rawAttributes']);_0x35f5e8['query']=_['keys'](_0x234c6e[_0xe6be('0x2e')]);_0x35f5e8[_0xe6be('0x30')]=_['intersection'](_0x35f5e8[_0xe6be('0x2d')],_0x35f5e8['query']);_0x42b232[_0xe6be('0x31')]=_[_0xe6be('0x32')](_0x35f5e8['model'],qs[_0xe6be('0x33')](_0x234c6e[_0xe6be('0x2e')]['fields']));_0x42b232[_0xe6be('0x31')]=_0x42b232[_0xe6be('0x31')][_0xe6be('0x4e')]?_0x42b232['attributes']:_0x35f5e8['model'];if(!_0x234c6e[_0xe6be('0x2e')]['hasOwnProperty'](_0xe6be('0x59'))){_0x42b232['limit']=qs['limit'](_0x234c6e[_0xe6be('0x2e')][_0xe6be('0x35')]);_0x42b232[_0xe6be('0x1e')]=qs['offset'](_0x234c6e[_0xe6be('0x2e')][_0xe6be('0x1e')]);}_0x42b232[_0xe6be('0x36')]=qs[_0xe6be('0x37')](_0x234c6e['query'][_0xe6be('0x37')]);_0x42b232['where']=qs['filters'](_[_0xe6be('0x39')](_0x234c6e['query'],_0x35f5e8[_0xe6be('0x30')]));_0x42b232[_0xe6be('0x38')][_0xe6be('0x5a')]=_0x2982c2['id'];if(_0x234c6e['query']['filter']){_0x42b232[_0xe6be('0x38')]=_[_0xe6be('0x3b')](_0x42b232[_0xe6be('0x38')],{'$or':_[_0xe6be('0x28')](_0x42b232['attributes'],function(_0x2757d5){var _0x564a9c={};_0x564a9c[_0x2757d5]={'$like':'%'+_0x234c6e[_0xe6be('0x2e')]['filter']+'%'};return _0x564a9c;})});}_0x42b232=_[_0xe6be('0x3b')]({},_0x42b232,_0x234c6e[_0xe6be('0x3d')]);return db[_0xe6be('0x58')][_0xe6be('0x1d')]({'where':_0x42b232[_0xe6be('0x38')]})[_0xe6be('0x23')](function(_0x5176af){_0xd97f19['count']=_0x5176af;if(_0x234c6e[_0xe6be('0x2e')][_0xe6be('0x3f')]){_0x42b232[_0xe6be('0x4f')]=[{'all':!![]}];}return db[_0xe6be('0x58')][_0xe6be('0x40')](_0x42b232);})[_0xe6be('0x23')](function(_0x33acf3){_0xd97f19['rows']=_0x33acf3;return _0xd97f19;});}})[_0xe6be('0x23')](respondWithFilteredResult(_0x43bd8f,_0x42b232))[_0xe6be('0x41')](handleError(_0x43bd8f,null));};exports[_0xe6be('0x5b')]=function(_0x1f72b9,_0x2b6c33,_0x19e45f){var _0x1863fc={'raw':!![],'where':{}};var _0x137c1c={};var _0x33d9af={'count':0x0,'rows':[]};return db[_0xe6be('0x3e')][_0xe6be('0x57')]({'where':{'id':_0x1f72b9['params']['id']}})[_0xe6be('0x23')](handleEntityNotFound(_0x2b6c33,null))[_0xe6be('0x23')](function(_0x32aa8a){if(_0x32aa8a){_0x137c1c['model']=_[_0xe6be('0x2f')](db[_0xe6be('0x5c')]['rawAttributes']);_0x137c1c[_0xe6be('0x2e')]=_['keys'](_0x1f72b9[_0xe6be('0x2e')]);_0x137c1c['filters']=_['intersection'](_0x137c1c['model'],_0x137c1c[_0xe6be('0x2e')]);_0x1863fc['attributes']=_[_0xe6be('0x32')](_0x137c1c[_0xe6be('0x2d')],qs[_0xe6be('0x33')](_0x1f72b9[_0xe6be('0x2e')]['fields']));_0x1863fc['attributes']=_0x1863fc[_0xe6be('0x31')][_0xe6be('0x4e')]?_0x1863fc['attributes']:_0x137c1c['model'];if(!_0x1f72b9[_0xe6be('0x2e')][_0xe6be('0x34')](_0xe6be('0x59'))){_0x1863fc['limit']=qs[_0xe6be('0x35')](_0x1f72b9[_0xe6be('0x2e')][_0xe6be('0x35')]);_0x1863fc[_0xe6be('0x1e')]=qs[_0xe6be('0x1e')](_0x1f72b9[_0xe6be('0x2e')][_0xe6be('0x1e')]);}_0x1863fc['order']=qs[_0xe6be('0x37')](_0x1f72b9[_0xe6be('0x2e')][_0xe6be('0x37')]);_0x1863fc[_0xe6be('0x38')]=qs[_0xe6be('0x30')](_[_0xe6be('0x39')](_0x1f72b9['query'],_0x137c1c[_0xe6be('0x30')]));_0x1863fc[_0xe6be('0x38')]['CampaignId']=_0x32aa8a['id'];if(_0x1f72b9['query']['filter']){_0x1863fc[_0xe6be('0x38')]=_['merge'](_0x1863fc[_0xe6be('0x38')],{'$or':_[_0xe6be('0x28')](_0x1863fc[_0xe6be('0x31')],function(_0x20d77a){var _0x6c54c3={};_0x6c54c3[_0x20d77a]={'$like':'%'+_0x1f72b9['query']['filter']+'%'};return _0x6c54c3;})});}_0x1863fc=_[_0xe6be('0x3b')]({},_0x1863fc,_0x1f72b9[_0xe6be('0x3d')]);return db[_0xe6be('0x5c')][_0xe6be('0x1d')]({'where':_0x1863fc['where']})['then'](function(_0x5d1ac2){_0x33d9af[_0xe6be('0x1d')]=_0x5d1ac2;if(_0x1f72b9[_0xe6be('0x2e')][_0xe6be('0x3f')]){_0x1863fc[_0xe6be('0x4f')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x1863fc);})[_0xe6be('0x23')](function(_0x2eb5ab){_0x33d9af[_0xe6be('0x5d')]=_0x2eb5ab;return _0x33d9af;});}})[_0xe6be('0x23')](respondWithFilteredResult(_0x2b6c33,_0x1863fc))[_0xe6be('0x41')](handleError(_0x2b6c33,null));};exports['getHopperFinals']=function(_0x7114e1,_0x380538,_0x4746cf){var _0xbd9c2a={'raw':!![],'where':{}};var _0x3350d4={};var _0x4d7d61={'count':0x0,'rows':[]};return db['Campaign'][_0xe6be('0x57')]({'where':{'id':_0x7114e1['params']['id']}})[_0xe6be('0x23')](handleEntityNotFound(_0x380538,null))[_0xe6be('0x23')](function(_0x1e7c0c){if(_0x1e7c0c){_0x3350d4[_0xe6be('0x2d')]=_[_0xe6be('0x2f')](db[_0xe6be('0x5e')]['rawAttributes']);_0x3350d4[_0xe6be('0x2e')]=_[_0xe6be('0x2f')](_0x7114e1[_0xe6be('0x2e')]);_0x3350d4['filters']=_[_0xe6be('0x32')](_0x3350d4['model'],_0x3350d4[_0xe6be('0x2e')]);_0xbd9c2a[_0xe6be('0x31')]=_['intersection'](_0x3350d4[_0xe6be('0x2d')],qs['fields'](_0x7114e1[_0xe6be('0x2e')][_0xe6be('0x33')]));_0xbd9c2a[_0xe6be('0x31')]=_0xbd9c2a[_0xe6be('0x31')][_0xe6be('0x4e')]?_0xbd9c2a[_0xe6be('0x31')]:_0x3350d4['model'];if(!_0x7114e1[_0xe6be('0x2e')]['hasOwnProperty'](_0xe6be('0x59'))){_0xbd9c2a['limit']=qs[_0xe6be('0x35')](_0x7114e1[_0xe6be('0x2e')]['limit']);_0xbd9c2a[_0xe6be('0x1e')]=qs['offset'](_0x7114e1[_0xe6be('0x2e')]['offset']);}_0xbd9c2a[_0xe6be('0x36')]=qs[_0xe6be('0x37')](_0x7114e1['query'][_0xe6be('0x37')]);_0xbd9c2a[_0xe6be('0x38')]=qs[_0xe6be('0x30')](_[_0xe6be('0x39')](_0x7114e1['query'],_0x3350d4[_0xe6be('0x30')]));_0xbd9c2a['where'][_0xe6be('0x5a')]=_0x1e7c0c['id'];if(_0x7114e1['query']['filter']){_0xbd9c2a[_0xe6be('0x38')]=_[_0xe6be('0x3b')](_0xbd9c2a['where'],{'$or':_[_0xe6be('0x28')](_0xbd9c2a[_0xe6be('0x31')],function(_0x5a3736){var _0x8c9cc5={};_0x8c9cc5[_0x5a3736]={'$like':'%'+_0x7114e1[_0xe6be('0x2e')][_0xe6be('0x3a')]+'%'};return _0x8c9cc5;})});}_0xbd9c2a=_[_0xe6be('0x3b')]({},_0xbd9c2a,_0x7114e1[_0xe6be('0x3d')]);return db['CmHopperFinal'][_0xe6be('0x1d')]({'where':_0xbd9c2a[_0xe6be('0x38')]})[_0xe6be('0x23')](function(_0x22d6dd){_0x4d7d61[_0xe6be('0x1d')]=_0x22d6dd;if(_0x7114e1[_0xe6be('0x2e')][_0xe6be('0x3f')]){_0xbd9c2a[_0xe6be('0x4f')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0xbd9c2a);})[_0xe6be('0x23')](function(_0x8b9801){_0x4d7d61[_0xe6be('0x5d')]=_0x8b9801;return _0x4d7d61;});}})[_0xe6be('0x23')](respondWithFilteredResult(_0x380538,_0xbd9c2a))[_0xe6be('0x41')](handleError(_0x380538,null));};exports[_0xe6be('0x5f')]=function(_0x5eae69,_0x57bbd9,_0x9623df){var _0x4c01d1={'raw':!![],'where':{}};var _0x429266={};var _0xc6eb0b={'count':0x0,'rows':[]};return db['Campaign'][_0xe6be('0x57')]({'where':{'id':_0x5eae69[_0xe6be('0x55')]['id']}})[_0xe6be('0x23')](handleEntityNotFound(_0x57bbd9,null))['then'](function(_0x38fc23){if(_0x38fc23){_0x429266[_0xe6be('0x2d')]=_[_0xe6be('0x2f')](db[_0xe6be('0x60')][_0xe6be('0x29')]);_0x429266[_0xe6be('0x2e')]=_['keys'](_0x5eae69[_0xe6be('0x2e')]);_0x429266['filters']=_[_0xe6be('0x32')](_0x429266['model'],_0x429266['query']);_0x4c01d1[_0xe6be('0x31')]=_[_0xe6be('0x32')](_0x429266[_0xe6be('0x2d')],qs['fields'](_0x5eae69['query'][_0xe6be('0x33')]));_0x4c01d1[_0xe6be('0x31')]=_0x4c01d1[_0xe6be('0x31')]['length']?_0x4c01d1[_0xe6be('0x31')]:_0x429266[_0xe6be('0x2d')];if(!_0x5eae69[_0xe6be('0x2e')][_0xe6be('0x34')](_0xe6be('0x59'))){_0x4c01d1[_0xe6be('0x35')]=qs['limit'](_0x5eae69[_0xe6be('0x2e')][_0xe6be('0x35')]);_0x4c01d1[_0xe6be('0x1e')]=qs['offset'](_0x5eae69[_0xe6be('0x2e')]['offset']);}_0x4c01d1['order']=qs[_0xe6be('0x37')](_0x5eae69[_0xe6be('0x2e')][_0xe6be('0x37')]);_0x4c01d1[_0xe6be('0x38')]=qs[_0xe6be('0x30')](_[_0xe6be('0x39')](_0x5eae69[_0xe6be('0x2e')],_0x429266['filters']));_0x4c01d1['where'][_0xe6be('0x5a')]=_0x38fc23['id'];if(_0x5eae69[_0xe6be('0x2e')]['filter']){_0x4c01d1['where']=_[_0xe6be('0x3b')](_0x4c01d1[_0xe6be('0x38')],{'$or':_[_0xe6be('0x28')](_0x4c01d1[_0xe6be('0x31')],function(_0x495c50){var _0x22103a={};_0x22103a[_0x495c50]={'$like':'%'+_0x5eae69[_0xe6be('0x2e')][_0xe6be('0x3a')]+'%'};return _0x22103a;})});}_0x4c01d1=_['merge']({},_0x4c01d1,_0x5eae69[_0xe6be('0x3d')]);return db['CmHopperBlack'][_0xe6be('0x1d')]({'where':_0x4c01d1[_0xe6be('0x38')]})[_0xe6be('0x23')](function(_0x34d530){_0xc6eb0b[_0xe6be('0x1d')]=_0x34d530;if(_0x5eae69[_0xe6be('0x2e')][_0xe6be('0x3f')]){_0x4c01d1[_0xe6be('0x4f')]=[{'all':!![]}];}return db[_0xe6be('0x60')][_0xe6be('0x40')](_0x4c01d1);})[_0xe6be('0x23')](function(_0x148cee){_0xc6eb0b[_0xe6be('0x5d')]=_0x148cee;return _0xc6eb0b;});}})[_0xe6be('0x23')](respondWithFilteredResult(_0x57bbd9,_0x4c01d1))[_0xe6be('0x41')](handleError(_0x57bbd9,null));};exports[_0xe6be('0x61')]=function(_0x3f6da2,_0x1ff4e2,_0x4a1393){var _0x16ae18={};var _0x1a4054={};var _0x182ba;var _0x54f6b5;return db['Campaign']['findOne']({'where':{'id':_0x3f6da2[_0xe6be('0x55')]['id']}})[_0xe6be('0x23')](handleEntityNotFound(_0x1ff4e2,null))['then'](function(_0x7355eb){if(_0x7355eb){_0x182ba=_0x7355eb;_0x1a4054['model']=_[_0xe6be('0x2f')](db['CmList']['rawAttributes']);_0x1a4054[_0xe6be('0x2e')]=_[_0xe6be('0x2f')](_0x3f6da2[_0xe6be('0x2e')]);_0x1a4054[_0xe6be('0x30')]=_['intersection'](_0x1a4054[_0xe6be('0x2d')],_0x1a4054[_0xe6be('0x2e')]);_0x16ae18[_0xe6be('0x31')]=_[_0xe6be('0x32')](_0x1a4054['model'],qs[_0xe6be('0x33')](_0x3f6da2[_0xe6be('0x2e')][_0xe6be('0x33')]));_0x16ae18[_0xe6be('0x31')]=_0x16ae18[_0xe6be('0x31')][_0xe6be('0x4e')]?_0x16ae18[_0xe6be('0x31')]:_0x1a4054[_0xe6be('0x2d')];_0x16ae18[_0xe6be('0x36')]=qs['sort'](_0x3f6da2[_0xe6be('0x2e')][_0xe6be('0x37')]);_0x16ae18[_0xe6be('0x38')]=qs[_0xe6be('0x30')](_[_0xe6be('0x39')](_0x3f6da2[_0xe6be('0x2e')],_0x1a4054[_0xe6be('0x30')]));if(_0x3f6da2[_0xe6be('0x2e')][_0xe6be('0x3a')]){_0x16ae18[_0xe6be('0x38')]=_[_0xe6be('0x3b')](_0x16ae18[_0xe6be('0x38')],{'$or':_[_0xe6be('0x28')](_0x16ae18['attributes'],function(_0x9d0dfa){var _0x1651a9={};_0x1651a9[_0x9d0dfa]={'$like':'%'+_0x3f6da2[_0xe6be('0x2e')][_0xe6be('0x3a')]+'%'};return _0x1651a9;})});}_0x16ae18=_[_0xe6be('0x3b')]({},_0x16ae18,_0x3f6da2[_0xe6be('0x3d')]);return _0x182ba[_0xe6be('0x61')](_0x16ae18);}})[_0xe6be('0x23')](function(_0x411015){if(_0x411015){_0x54f6b5=_0x411015['length'];if(!_0x3f6da2['query']['hasOwnProperty']('nolimit')){_0x16ae18['limit']=qs[_0xe6be('0x35')](_0x3f6da2[_0xe6be('0x2e')]['limit']);_0x16ae18[_0xe6be('0x1e')]=qs['offset'](_0x3f6da2[_0xe6be('0x2e')][_0xe6be('0x1e')]);}return _0x182ba['getLists'](_0x16ae18);}})[_0xe6be('0x23')](function(_0x2ae37d){if(_0x2ae37d){return _0x2ae37d?{'count':_0x54f6b5,'rows':_0x2ae37d}:null;}})[_0xe6be('0x23')](respondWithResult(_0x1ff4e2,null))[_0xe6be('0x41')](handleError(_0x1ff4e2,null));};exports[_0xe6be('0x62')]=function(_0x592ca7,_0xb81041,_0x38b3ec){var _0x43336a,_0x3a07af;return db['Campaign']['find']({'where':{'id':_0x592ca7[_0xe6be('0x55')]['id']}})[_0xe6be('0x23')](handleEntityNotFound(_0xb81041,null))[_0xe6be('0x23')](function(_0x1b71a6){if(_0x1b71a6){_0x3a07af=_0x1b71a6;return _0x1b71a6[_0xe6be('0x62')](_0x592ca7[_0xe6be('0x53')][_0xe6be('0x63')],_[_0xe6be('0x50')](_0x592ca7['body'],['ids','id'])||{});}return null;})[_0xe6be('0x64')](function(_0x54db67){var _0x38049b;_0x43336a=_0x54db67||[];var _0x5d0958=[];if(_0x54db67){for(var _0x496243=0x0;_0x496243<_0x54db67[_0xe6be('0x4e')];_0x496243+=0x1){var _0x139ed8=_0x54db67[_0x496243][_0xe6be('0x45')]({'plain':!![]});_0x3a07af[_0xe6be('0x65')]=_0x592ca7[_0xe6be('0x53')][_0xe6be('0x65')]?_0x592ca7['body']['dialCheckDuplicateType']:_0x3a07af[_0xe6be('0x65')];switch(_0x3a07af['dialCheckDuplicateType']){case _0xe6be('0x66'):_0x38049b=squel[_0xe6be('0x67')]()[_0xe6be('0x68')](_0xe6be('0x69'))['fromQuery'](['phone','scheduledAt',_0xe6be('0x6a'),_0xe6be('0x6b'),_0xe6be('0x5a'),_0xe6be('0x51'),_0xe6be('0x52')],squel[_0xe6be('0x6c')]()[_0xe6be('0x6d')]('phone',_0xe6be('0x6e'))['field']('NOW()','scheduledAt')[_0xe6be('0x6d')]('id','ContactId')[_0xe6be('0x6d')](_0x139ed8['CmListId']['toString'](),_0xe6be('0x6b'))[_0xe6be('0x6d')](_0x592ca7[_0xe6be('0x55')]['id'][_0xe6be('0x6f')](),_0xe6be('0x5a'))[_0xe6be('0x6d')]('NOW()',_0xe6be('0x51'))[_0xe6be('0x6d')](_0xe6be('0x70'),_0xe6be('0x52'))[_0xe6be('0x71')](_0xe6be('0x72'))['where'](_0xe6be('0x73'))[_0xe6be('0x38')](_0xe6be('0x74'),_0x139ed8[_0xe6be('0x75')][_0xe6be('0x6f')]())[_0xe6be('0x38')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xe6be('0x76'),squel['select']()[_0xe6be('0x6d')](_0xe6be('0x77'))[_0xe6be('0x71')]('cm_hopper_final')[_0xe6be('0x38')](_0xe6be('0x78'),_0x592ca7[_0xe6be('0x55')]['id'][_0xe6be('0x6f')]()))['where'](_0xe6be('0x76'),squel[_0xe6be('0x6c')]()[_0xe6be('0x6d')]('COALESCE(phone,\x27\x27)')['from'](_0xe6be('0x69'))['where'](_0xe6be('0x78'),_0x592ca7[_0xe6be('0x55')]['id']['toString']())))[_0xe6be('0x6f')]();break;case'onlyIfOpen':_0x38049b=squel[_0xe6be('0x67')]()[_0xe6be('0x68')](_0xe6be('0x69'))['fromQuery']([_0xe6be('0x6e'),_0xe6be('0x79'),_0xe6be('0x6a'),_0xe6be('0x6b'),_0xe6be('0x5a'),_0xe6be('0x51'),_0xe6be('0x52')],squel[_0xe6be('0x6c')]()[_0xe6be('0x6d')](_0xe6be('0x6e'),_0xe6be('0x6e'))[_0xe6be('0x6d')]('NOW()',_0xe6be('0x79'))[_0xe6be('0x6d')]('id',_0xe6be('0x6a'))[_0xe6be('0x6d')](_0x139ed8[_0xe6be('0x75')][_0xe6be('0x6f')](),_0xe6be('0x6b'))[_0xe6be('0x6d')](_0x592ca7[_0xe6be('0x55')]['id'][_0xe6be('0x6f')](),_0xe6be('0x5a'))['field']('NOW()','createdAt')[_0xe6be('0x6d')](_0xe6be('0x70'),'updatedAt')[_0xe6be('0x71')](_0xe6be('0x72'))[_0xe6be('0x38')]('deletedAt\x20IS\x20NULL')[_0xe6be('0x38')](_0xe6be('0x74'),_0x139ed8['CmListId'][_0xe6be('0x6f')]())['where'](_0xe6be('0x7a'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xe6be('0x6c')]()[_0xe6be('0x6d')](_0xe6be('0x7b'))[_0xe6be('0x71')](_0xe6be('0x69'))[_0xe6be('0x38')](_0xe6be('0x78'),_0x592ca7[_0xe6be('0x55')]['id']['toString']())))[_0xe6be('0x6f')]();break;default:_0x38049b=squel[_0xe6be('0x67')]()[_0xe6be('0x68')](_0xe6be('0x69'))[_0xe6be('0x7c')](['phone','scheduledAt',_0xe6be('0x6a'),'ListId',_0xe6be('0x5a'),'createdAt',_0xe6be('0x52')],squel[_0xe6be('0x6c')]()[_0xe6be('0x6d')]('phone',_0xe6be('0x6e'))[_0xe6be('0x6d')](_0xe6be('0x70'),_0xe6be('0x79'))['field']('id',_0xe6be('0x6a'))[_0xe6be('0x6d')](_0x139ed8['CmListId'][_0xe6be('0x6f')](),_0xe6be('0x6b'))[_0xe6be('0x6d')](_0x592ca7[_0xe6be('0x55')]['id'][_0xe6be('0x6f')](),_0xe6be('0x5a'))[_0xe6be('0x6d')]('NOW()',_0xe6be('0x51'))[_0xe6be('0x6d')]('NOW()',_0xe6be('0x52'))[_0xe6be('0x71')](_0xe6be('0x72'))[_0xe6be('0x38')](_0xe6be('0x73'))[_0xe6be('0x38')](_0xe6be('0x74'),_0x139ed8['CmListId'][_0xe6be('0x6f')]())[_0xe6be('0x38')](_0xe6be('0x7a')))[_0xe6be('0x6f')]();}_0x5d0958[_0xe6be('0x7d')](db[_0xe6be('0x7e')][_0xe6be('0x2e')](_0x38049b));}return BPromise['all'](_0x5d0958);}})[_0xe6be('0x23')](function(){return _0x43336a;})[_0xe6be('0x23')](respondWithResult(_0xb81041,null))[_0xe6be('0x41')](handleError(_0xb81041,null));};exports[_0xe6be('0x7f')]=function(_0x45a663,_0x1b8a30,_0x41238a){return db[_0xe6be('0x3e')][_0xe6be('0x49')]({'where':{'id':_0x45a663['params']['id']}})[_0xe6be('0x23')](handleEntityNotFound(_0x1b8a30,null))[_0xe6be('0x23')](function(_0x176654){if(_0x176654){return _0x176654[_0xe6be('0x7f')](_0x45a663['query'][_0xe6be('0x63')]);}})[_0xe6be('0x23')](function(_0x178f46){if(_0x178f46){return db[_0xe6be('0x58')][_0xe6be('0x24')]({'where':{'ListId':_0x45a663[_0xe6be('0x2e')][_0xe6be('0x63')],'CampaignId':_0x45a663[_0xe6be('0x55')]['id']}})['then'](function(){return _0x178f46;});}})[_0xe6be('0x23')](respondWithStatusCode(_0x1b8a30,null))[_0xe6be('0x41')](handleError(_0x1b8a30,null));};exports[_0xe6be('0x80')]=function(_0x15ebd4,_0xdece87,_0x1a4c10){var _0x1b92a8={};var _0x18cb77={};var _0x41226c;var _0x100787;return db['Campaign'][_0xe6be('0x57')]({'where':{'id':_0x15ebd4[_0xe6be('0x55')]['id']}})[_0xe6be('0x23')](handleEntityNotFound(_0xdece87,null))['then'](function(_0x16ac6e){if(_0x16ac6e){_0x41226c=_0x16ac6e;_0x18cb77[_0xe6be('0x2d')]=_[_0xe6be('0x2f')](db['CmList'][_0xe6be('0x29')]);_0x18cb77[_0xe6be('0x2e')]=_[_0xe6be('0x2f')](_0x15ebd4[_0xe6be('0x2e')]);_0x18cb77['filters']=_[_0xe6be('0x32')](_0x18cb77['model'],_0x18cb77[_0xe6be('0x2e')]);_0x1b92a8[_0xe6be('0x31')]=_[_0xe6be('0x32')](_0x18cb77['model'],qs[_0xe6be('0x33')](_0x15ebd4[_0xe6be('0x2e')][_0xe6be('0x33')]));_0x1b92a8['attributes']=_0x1b92a8[_0xe6be('0x31')][_0xe6be('0x4e')]?_0x1b92a8['attributes']:_0x18cb77['model'];_0x1b92a8[_0xe6be('0x36')]=qs[_0xe6be('0x37')](_0x15ebd4[_0xe6be('0x2e')][_0xe6be('0x37')]);_0x1b92a8['where']=qs[_0xe6be('0x30')](_[_0xe6be('0x39')](_0x15ebd4[_0xe6be('0x2e')],_0x18cb77[_0xe6be('0x30')]));if(_0x15ebd4[_0xe6be('0x2e')][_0xe6be('0x3a')]){_0x1b92a8[_0xe6be('0x38')]=_[_0xe6be('0x3b')](_0x1b92a8['where'],{'$or':_[_0xe6be('0x28')](_0x1b92a8['attributes'],function(_0x52d778){var _0x36638b={};_0x36638b[_0x52d778]={'$like':'%'+_0x15ebd4['query']['filter']+'%'};return _0x36638b;})});}_0x1b92a8=_['merge']({},_0x1b92a8,_0x15ebd4['options']);return _0x41226c[_0xe6be('0x80')](_0x1b92a8);}})[_0xe6be('0x23')](function(_0x1bcf11){if(_0x1bcf11){_0x100787=_0x1bcf11[_0xe6be('0x4e')];if(!_0x15ebd4[_0xe6be('0x2e')][_0xe6be('0x34')](_0xe6be('0x59'))){_0x1b92a8[_0xe6be('0x35')]=qs[_0xe6be('0x35')](_0x15ebd4[_0xe6be('0x2e')][_0xe6be('0x35')]);_0x1b92a8[_0xe6be('0x1e')]=qs[_0xe6be('0x1e')](_0x15ebd4[_0xe6be('0x2e')][_0xe6be('0x1e')]);}return _0x41226c[_0xe6be('0x80')](_0x1b92a8);}})['then'](function(_0x5b1651){if(_0x5b1651){return _0x5b1651?{'count':_0x100787,'rows':_0x5b1651}:null;}})[_0xe6be('0x23')](respondWithResult(_0xdece87,null))[_0xe6be('0x41')](handleError(_0xdece87,null));};exports[_0xe6be('0x81')]=function(_0x1a4be5,_0xdd9177,_0x52cc5a){var _0x48a5d7,_0x5b510a;return db[_0xe6be('0x3e')]['find']({'where':{'id':_0x1a4be5[_0xe6be('0x55')]['id']}})[_0xe6be('0x23')](handleEntityNotFound(_0xdd9177,null))[_0xe6be('0x23')](function(_0x43d9dd){if(_0x43d9dd){_0x5b510a=_0x43d9dd;return _0x43d9dd['addBlackLists'](_0x1a4be5[_0xe6be('0x53')]['ids'],_[_0xe6be('0x50')](_0x1a4be5['body'],[_0xe6be('0x63'),'id'])||{});}return null;})['spread'](function(_0x220ab7){var _0x52e237;_0x48a5d7=_0x220ab7||[];var _0x44b628=[];if(_0x220ab7){for(var _0xfdeeaa=0x0;_0xfdeeaa<_0x220ab7[_0xe6be('0x4e')];_0xfdeeaa+=0x1){var _0x2c1307=_0x220ab7[_0xfdeeaa][_0xe6be('0x45')]({'plain':!![]});_0x52e237=squel[_0xe6be('0x67')]()[_0xe6be('0x68')](_0xe6be('0x82'))[_0xe6be('0x7c')]([_0xe6be('0x6e'),_0xe6be('0x6a'),_0xe6be('0x6b'),_0xe6be('0x5a'),_0xe6be('0x51'),_0xe6be('0x52')],squel[_0xe6be('0x6c')]()[_0xe6be('0x6d')]('phone','phone')[_0xe6be('0x6d')]('id',_0xe6be('0x6a'))[_0xe6be('0x6d')](_0x2c1307[_0xe6be('0x75')][_0xe6be('0x6f')](),_0xe6be('0x6b'))['field'](_0x1a4be5[_0xe6be('0x55')]['id'][_0xe6be('0x6f')](),'CampaignId')['field']('NOW()',_0xe6be('0x51'))[_0xe6be('0x6d')](_0xe6be('0x70'),_0xe6be('0x52'))['from'](_0xe6be('0x72'))[_0xe6be('0x38')](_0xe6be('0x73'))[_0xe6be('0x38')](_0xe6be('0x74'),_0x2c1307[_0xe6be('0x75')][_0xe6be('0x6f')]())[_0xe6be('0x38')](_0xe6be('0x7a')))['toString']();_0x44b628['push'](db['sequelize'][_0xe6be('0x2e')](_0x52e237));}return BPromise[_0xe6be('0x83')](_0x44b628);}})['then'](function(){return _0x48a5d7;})[_0xe6be('0x23')](respondWithResult(_0xdd9177,null))[_0xe6be('0x41')](handleError(_0xdd9177,null));};exports[_0xe6be('0x84')]=function(_0xbc5962,_0x496953,_0x61ada7){return db[_0xe6be('0x3e')]['find']({'where':{'id':_0xbc5962[_0xe6be('0x55')]['id']}})[_0xe6be('0x23')](handleEntityNotFound(_0x496953,null))[_0xe6be('0x23')](function(_0x32b8bc){if(_0x32b8bc){return _0x32b8bc[_0xe6be('0x84')](_0xbc5962[_0xe6be('0x2e')][_0xe6be('0x63')]);}})['then'](function(_0x2b1344){if(_0x2b1344){return db[_0xe6be('0x60')][_0xe6be('0x24')]({'where':{'ListId':_0xbc5962[_0xe6be('0x2e')][_0xe6be('0x63')],'CampaignId':_0xbc5962[_0xe6be('0x55')]['id']}})[_0xe6be('0x23')](function(){return _0x2b1344;});}})[_0xe6be('0x23')](respondWithStatusCode(_0x496953,null))['catch'](handleError(_0x496953,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 82f068b..d955c05 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 _0x44ea=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./campaign.attributes','exports','define','Campaign','campaigns','lodash','../../config/logger'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x44ea,0xa7));var _0xa44e=function(_0x206ea5,_0x1d209e){_0x206ea5=_0x206ea5-0x0;var _0x15d2ed=_0x44ea[_0x206ea5];return _0x15d2ed;};'use strict';var _=require(_0xa44e('0x0'));var util=require('util');var logger=require(_0xa44e('0x1'))(_0xa44e('0x2'));var moment=require(_0xa44e('0x3'));var BPromise=require(_0xa44e('0x4'));var rp=require(_0xa44e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa44e('0x6'));var config=require(_0xa44e('0x7'));var attributes=require(_0xa44e('0x8'));module[_0xa44e('0x9')]=function(_0x238714,_0x5e098b){return _0x238714[_0xa44e('0xa')](_0xa44e('0xb'),attributes,{'tableName':_0xa44e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc733=['request-promise','path','rimraf','../../config/environment','exports','Campaign','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xc733,0xc6));var _0x3c73=function(_0x31f7a0,_0x1a8fd4){_0x31f7a0=_0x31f7a0-0x0;var _0x90b0f9=_0xc733[_0x31f7a0];return _0x90b0f9;};'use strict';var _=require(_0x3c73('0x0'));var util=require(_0x3c73('0x1'));var logger=require(_0x3c73('0x2'))(_0x3c73('0x3'));var moment=require(_0x3c73('0x4'));var BPromise=require(_0x3c73('0x5'));var rp=require(_0x3c73('0x6'));var fs=require('fs');var path=require(_0x3c73('0x7'));var rimraf=require(_0x3c73('0x8'));var config=require(_0x3c73('0x9'));var attributes=require('./campaign.attributes');module[_0x3c73('0xa')]=function(_0x101216,_0x3933ff){return _0x101216['define'](_0x3c73('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 c2f3db8..cf6a349 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 _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x55c22f,_0x55bea0){var _0x4e037c=function(_0x48d82b){while(--_0x48d82b){_0x55c22f['push'](_0x55c22f['shift']());}};_0x4e037c(++_0x55bea0);}(_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);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x3fcde0,_0x1a0412){var _0x14cd13=function(_0xc35fe3){while(--_0xc35fe3){_0x3fcde0['push'](_0x3fcde0['shift']());}};_0x14cd13(++_0x1a0412);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 811c8a7..cb344a3 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 _0x5e1d=['clone','addLists','addBlackLists','put','destroy','delete','removeLists','removeBlackLists','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone'];(function(_0x1235b9,_0x42c5d8){var _0x190f27=function(_0x334b5f){while(--_0x334b5f){_0x1235b9['push'](_0x1235b9['shift']());}};_0x190f27(++_0x42c5d8);}(_0x5e1d,0x1e5));var _0xd5e1=function(_0x141749,_0x477b04){_0x141749=_0x141749-0x0;var _0x3e6932=_0x5e1d[_0x141749];return _0x3e6932;};'use strict';var multer=require(_0xd5e1('0x0'));var util=require(_0xd5e1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd5e1('0x2'));var router=express[_0xd5e1('0x3')]();var auth=require(_0xd5e1('0x4'));var interaction=require(_0xd5e1('0x5'));var config=require(_0xd5e1('0x6'));var controller=require(_0xd5e1('0x7'));router[_0xd5e1('0x8')]('/',auth['isAuthenticated'](),controller[_0xd5e1('0x9')]);router['get'](_0xd5e1('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xd5e1('0x8')]('/:id/hoppers',auth[_0xd5e1('0xb')](),controller[_0xd5e1('0xc')]);router[_0xd5e1('0x8')](_0xd5e1('0xd'),auth['isAuthenticated'](),controller[_0xd5e1('0xe')]);router['get'](_0xd5e1('0xf'),auth['isAuthenticated'](),controller[_0xd5e1('0x10')]);router[_0xd5e1('0x8')](_0xd5e1('0x11'),auth[_0xd5e1('0xb')](),controller[_0xd5e1('0x12')]);router[_0xd5e1('0x8')](_0xd5e1('0x13'),auth[_0xd5e1('0xb')](),controller[_0xd5e1('0x14')]);router['get'](_0xd5e1('0x15'),auth[_0xd5e1('0xb')](),controller['getBlackLists']);router[_0xd5e1('0x16')]('/',auth['isAuthenticated'](),controller[_0xd5e1('0x17')]);router[_0xd5e1('0x16')](_0xd5e1('0x18'),auth['isAuthenticated'](),controller[_0xd5e1('0x19')]);router[_0xd5e1('0x16')](_0xd5e1('0x13'),auth['isAuthenticated'](),controller[_0xd5e1('0x1a')]);router['post']('/:id/blacklists',auth['isAuthenticated'](),controller[_0xd5e1('0x1b')]);router[_0xd5e1('0x1c')](_0xd5e1('0xa'),auth[_0xd5e1('0xb')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd5e1('0x1d')]);router[_0xd5e1('0x1e')](_0xd5e1('0x13'),auth[_0xd5e1('0xb')](),controller[_0xd5e1('0x1f')]);router[_0xd5e1('0x1e')](_0xd5e1('0x15'),auth[_0xd5e1('0xb')](),controller[_0xd5e1('0x20')]);module[_0xd5e1('0x21')]=router; \ No newline at end of file +var _0x5444=['../../components/interaction/service','../../config/environment','./campaign.controller','index','get','/:id','isAuthenticated','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','/:id/lists','addBlackLists','put','update','delete','destroy','removeLists','exports','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x132d96,_0x13bd74){var _0x38530c=function(_0x38a2f){while(--_0x38a2f){_0x132d96['push'](_0x132d96['shift']());}};_0x38530c(++_0x13bd74);}(_0x5444,0x12d));var _0x4544=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5444[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x4544('0x0'));var util=require(_0x4544('0x1'));var path=require('path');var timeout=require(_0x4544('0x2'));var express=require(_0x4544('0x3'));var router=express['Router']();var auth=require(_0x4544('0x4'));var interaction=require(_0x4544('0x5'));var config=require(_0x4544('0x6'));var controller=require(_0x4544('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x4544('0x8')]);router[_0x4544('0x9')](_0x4544('0xa'),auth[_0x4544('0xb')](),controller['show']);router[_0x4544('0x9')]('/:id/hoppers',auth[_0x4544('0xb')](),controller[_0x4544('0xc')]);router[_0x4544('0x9')](_0x4544('0xd'),auth['isAuthenticated'](),controller[_0x4544('0xe')]);router[_0x4544('0x9')](_0x4544('0xf'),auth[_0x4544('0xb')](),controller[_0x4544('0x10')]);router[_0x4544('0x9')](_0x4544('0x11'),auth[_0x4544('0xb')](),controller[_0x4544('0x12')]);router[_0x4544('0x9')]('/:id/lists',auth[_0x4544('0xb')](),controller[_0x4544('0x13')]);router[_0x4544('0x9')](_0x4544('0x14'),auth[_0x4544('0xb')](),controller[_0x4544('0x15')]);router[_0x4544('0x16')]('/',auth[_0x4544('0xb')](),controller[_0x4544('0x17')]);router[_0x4544('0x16')](_0x4544('0x18'),auth[_0x4544('0xb')](),controller[_0x4544('0x19')]);router[_0x4544('0x16')](_0x4544('0x1a'),auth[_0x4544('0xb')](),controller['addLists']);router[_0x4544('0x16')]('/:id/blacklists',auth[_0x4544('0xb')](),controller[_0x4544('0x1b')]);router[_0x4544('0x1c')]('/:id',auth[_0x4544('0xb')](),controller[_0x4544('0x1d')]);router[_0x4544('0x1e')]('/:id',auth[_0x4544('0xb')](),controller[_0x4544('0x1f')]);router['delete'](_0x4544('0x1a'),auth[_0x4544('0xb')](),controller[_0x4544('0x20')]);router['delete'](_0x4544('0x14'),auth[_0x4544('0xb')](),controller['removeBlackLists']);module[_0x4544('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index af5cddc..e7f8b31 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 _0x2626=['sequelize','exports','STRING','TEXT','getDataValue'];(function(_0xc7a70c,_0x4441b3){var _0x187ed6=function(_0x4a732d){while(--_0x4a732d){_0xc7a70c['push'](_0xc7a70c['shift']());}};_0x187ed6(++_0x4441b3);}(_0x2626,0x1e5));var _0x6262=function(_0x582244,_0x33f08b){_0x582244=_0x582244-0x0;var _0x81f9e4=_0x2626[_0x582244];return _0x81f9e4;};'use strict';var Sequelize=require(_0x6262('0x0'));module[_0x6262('0x1')]={'key':{'type':Sequelize[_0x6262('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x6262('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x6262('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x6262('0x4')]('key');}}}; \ No newline at end of file +var _0xca1b=['TEXT','key','sequelize','exports','STRING'];(function(_0x268038,_0x489989){var _0x37c6f0=function(_0x4af567){while(--_0x4af567){_0x268038['push'](_0x268038['shift']());}};_0x37c6f0(++_0x489989);}(_0xca1b,0x16a));var _0xbca1=function(_0x3c1d69,_0x1f8e78){_0x3c1d69=_0x3c1d69-0x0;var _0x275716=_0xca1b[_0x3c1d69];return _0x275716;};'use strict';var Sequelize=require(_0xbca1('0x0'));module[_0xbca1('0x1')]={'key':{'type':Sequelize[_0xbca1('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xbca1('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xbca1('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 2f362aa..debb23a 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 _0x9957=['set','reject','update','then','get','CannedAnswers','UserProfileResource','destroy','end','error','stack','name','index','CannedAnswer','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','catch','show','find','body','params','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');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=_0x2202ce[_0x7995('0x1e')],_0x5377e5=_0x1a5310[_0x7995('0x1f')],_0x2eeacc=_0x1a5310[_0x7995('0x1f')]+_0x1a5310[_0x7995('0x20')],_0x565d97;if(_0x2eeacc>=_0x41cbf0){_0x2eeacc=_0x41cbf0;_0x565d97=0xc8;}else{_0x565d97=0xce;}_0x3f1d3e[_0x7995('0x1c')](_0x565d97);return _0x3f1d3e[_0x7995('0x21')]('Content-Range',_0x5377e5+'-'+_0x2eeacc+'/'+_0x41cbf0)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x2536c8){return function(_0x5e6f90){try{jsonpatch['apply'](_0x5e6f90,_0x2536c8,!![]);}catch(_0x3ec178){return BPromise[_0x7995('0x22')](_0x3ec178);}return _0x5e6f90['save']();};}function saveUpdates(_0x3a9b54,_0x51f276){return function(_0x4b1a8e){if(_0x4b1a8e){return _0x4b1a8e[_0x7995('0x23')](_0x3a9b54)[_0x7995('0x24')](function(_0x350fd9){return _0x350fd9;});}return null;};}function removeEntity(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['destroy']()[_0x7995('0x24')](function(){var _0x46ee4b=_0x1c278a[_0x7995('0x25')]({'plain':!![]});var _0x285437=_0x7995('0x26');return db[_0x7995('0x27')][_0x7995('0x28')]({'where':{'type':_0x285437,'resourceId':_0x46ee4b['id']}})[_0x7995('0x24')](function(){return _0x1c278a;});})['then'](function(){_0x1a8568[_0x7995('0x1c')](0xcc)[_0x7995('0x29')]();});}};}function handleEntityNotFound(_0x401dc3,_0x268ce7){return function(_0x3a3fcf){if(!_0x3a3fcf){_0x401dc3[_0x7995('0x1b')](0x194);}return _0x3a3fcf;};}function handleError(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0x1f4;return function(_0x5911c3){logger[_0x7995('0x2a')](_0x5911c3[_0x7995('0x2b')]);if(_0x5911c3[_0x7995('0x2c')]){delete _0x5911c3[_0x7995('0x2c')];}_0x56691a[_0x7995('0x1c')](_0x47625f)['send'](_0x5911c3);};}exports[_0x7995('0x2d')]=function(_0x514445,_0x456a28){var _0x3250e0={},_0x4253e5={},_0x574574={'count':0x0,'rows':[]};var _0x530611=_['map'](db[_0x7995('0x2e')][_0x7995('0x2f')],function(_0x327a81){return{'name':_0x327a81[_0x7995('0x30')],'type':_0x327a81[_0x7995('0x31')][_0x7995('0x32')]};});_0x4253e5['model']=_['map'](_0x530611,_0x7995('0x2c'));_0x4253e5['query']=_[_0x7995('0x33')](_0x514445[_0x7995('0x34')]);_0x4253e5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x4253e5[_0x7995('0x37')],_0x4253e5['query']);_0x3250e0[_0x7995('0x38')]=_[_0x7995('0x36')](_0x4253e5['model'],qs['fields'](_0x514445['query'][_0x7995('0x39')]));_0x3250e0[_0x7995('0x38')]=_0x3250e0['attributes'][_0x7995('0x3a')]?_0x3250e0['attributes']:_0x4253e5[_0x7995('0x37')];if(!_0x514445[_0x7995('0x34')][_0x7995('0x3b')]('nolimit')){_0x3250e0['limit']=qs[_0x7995('0x20')](_0x514445['query']['limit']);_0x3250e0[_0x7995('0x1f')]=qs[_0x7995('0x1f')](_0x514445['query'][_0x7995('0x1f')]);}_0x3250e0[_0x7995('0x3c')]=qs[_0x7995('0x3d')](_0x514445[_0x7995('0x34')][_0x7995('0x3d')]);_0x3250e0['where']=qs[_0x7995('0x35')](_[_0x7995('0x3e')](_0x514445[_0x7995('0x34')],_0x4253e5[_0x7995('0x35')]),_0x530611);if(_0x514445['query'][_0x7995('0x3f')]){_0x3250e0[_0x7995('0x40')]=_[_0x7995('0x41')](_0x3250e0[_0x7995('0x40')],{'$or':_[_0x7995('0x42')](_0x530611,function(_0x1035dc){if(_0x1035dc['type']!==_0x7995('0x43')){var _0x3be298={};_0x3be298[_0x1035dc[_0x7995('0x2c')]]={'$like':'%'+_0x514445[_0x7995('0x34')][_0x7995('0x3f')]+'%'};return _0x3be298;}})});}_0x3250e0=_[_0x7995('0x41')]({},_0x3250e0,_0x514445[_0x7995('0x44')]);var _0x270c0e={'where':_0x3250e0[_0x7995('0x40')]};return db[_0x7995('0x2e')][_0x7995('0x1e')](_0x270c0e)[_0x7995('0x24')](function(_0x7b4e67){_0x574574['count']=_0x7b4e67;if(_0x514445['query'][_0x7995('0x45')]){_0x3250e0[_0x7995('0x46')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3250e0);})[_0x7995('0x24')](function(_0x4a9fef){_0x574574['rows']=_0x4a9fef;return _0x574574;})[_0x7995('0x24')](respondWithFilteredResult(_0x456a28,_0x3250e0))[_0x7995('0x47')](handleError(_0x456a28,null));};exports[_0x7995('0x48')]=function(_0x576b96,_0x46ac4f){var _0x5e85b9={'raw':!![],'where':{'id':_0x576b96['params']['id']}},_0x3993b5={};_0x3993b5['model']=_[_0x7995('0x33')](db[_0x7995('0x2e')][_0x7995('0x2f')]);_0x3993b5[_0x7995('0x34')]=_['keys'](_0x576b96[_0x7995('0x34')]);_0x3993b5[_0x7995('0x35')]=_[_0x7995('0x36')](_0x3993b5[_0x7995('0x37')],_0x3993b5['query']);_0x5e85b9['attributes']=_[_0x7995('0x36')](_0x3993b5['model'],qs[_0x7995('0x39')](_0x576b96['query'][_0x7995('0x39')]));_0x5e85b9['attributes']=_0x5e85b9[_0x7995('0x38')][_0x7995('0x3a')]?_0x5e85b9['attributes']:_0x3993b5[_0x7995('0x37')];if(_0x576b96[_0x7995('0x34')][_0x7995('0x45')]){_0x5e85b9[_0x7995('0x46')]=[{'all':!![]}];}_0x5e85b9=_['merge']({},_0x5e85b9,_0x576b96[_0x7995('0x44')]);return db[_0x7995('0x2e')][_0x7995('0x49')](_0x5e85b9)['then'](handleEntityNotFound(_0x46ac4f,null))[_0x7995('0x24')](respondWithResult(_0x46ac4f,null))[_0x7995('0x47')](handleError(_0x46ac4f,null));};exports[_0x7995('0x23')]=function(_0x3d8ae3,_0x255313){if(_0x3d8ae3['body']['id']){delete _0x3d8ae3[_0x7995('0x4a')]['id'];}return db[_0x7995('0x2e')]['find']({'where':{'id':_0x3d8ae3[_0x7995('0x4b')]['id']}})['then'](handleEntityNotFound(_0x255313,null))[_0x7995('0x24')](saveUpdates(_0x3d8ae3[_0x7995('0x4a')],null))[_0x7995('0x24')](respondWithResult(_0x255313,null))[_0x7995('0x47')](handleError(_0x255313,null));};exports[_0x7995('0x28')]=function(_0x14b537,_0x1579b9){return db['CannedAnswer'][_0x7995('0x49')]({'where':{'id':_0x14b537[_0x7995('0x4b')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x1579b9,null))['then'](removeEntity(_0x1579b9,null))[_0x7995('0x47')](handleError(_0x1579b9,null));};exports[_0x7995('0x4c')]=function(_0x12d4b8,_0x47d1d8){var _0x4ec548={'key':_0x12d4b8['body'][_0x7995('0x32')]};if(_0x12d4b8[_0x7995('0x4a')]['MailAccountId']){_0x4ec548[_0x7995('0x4d')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4d')];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4e')]){_0x4ec548['SmsAccountId']=_0x12d4b8[_0x7995('0x4a')]['SmsAccountId'];}else if(_0x12d4b8[_0x7995('0x4a')][_0x7995('0x4f')]){_0x4ec548[_0x7995('0x4f')]=_0x12d4b8['body']['OpenchannelAccountId'];}else if(_0x12d4b8['body']['ChatWebsiteId']){_0x4ec548[_0x7995('0x50')]=_0x12d4b8[_0x7995('0x4a')][_0x7995('0x50')];}return db[_0x7995('0x2e')][_0x7995('0x49')]({'where':_0x4ec548})[_0x7995('0x24')](function(_0x1f4270){if(_0x1f4270){throw new db[(_0x7995('0x51'))][(_0x7995('0x52'))](_0x7995('0x53'));}return db[_0x7995('0x2e')][_0x7995('0x4c')](_0x12d4b8[_0x7995('0x4a')]);})[_0x7995('0x24')](function(_0x1ea1dc){var _0x416133=_0x12d4b8[_0x7995('0x54')][_0x7995('0x25')]({'plain':!![]});if(!_0x416133)throw new Error(_0x7995('0x55'));if(_0x416133['role']===_0x7995('0x54')){var _0x630737=_0x1ea1dc[_0x7995('0x25')]({'plain':!![]});return db[_0x7995('0x56')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x416133[_0x7995('0x57')]},'raw':!![]})[_0x7995('0x24')](function(_0x5b9467){if(_0x5b9467&&_0x5b9467[_0x7995('0x58')]===0x0){return db['UserProfileResource'][_0x7995('0x4c')]({'name':_0x630737[_0x7995('0x2c')],'resourceId':_0x630737['id'],'type':_0x5b9467[_0x7995('0x2c')],'sectionId':_0x5b9467['id']},{})[_0x7995('0x24')](function(){return _0x1ea1dc;});}else{return _0x1ea1dc;}})['catch'](function(_0x5e2d97){logger[_0x7995('0x2a')](_0x7995('0x59'),_0x5e2d97);throw _0x5e2d97;});}return _0x1ea1dc;})[_0x7995('0x24')](respondWithResult(_0x47d1d8,0xc9))[_0x7995('0x47')](handleError(_0x47d1d8,null));}; \ No newline at end of file +var _0xa9e0=['filters','filter','merge','where','VIRTUAL','count','include','findAll','rows','catch','show','params','includeAll','options','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','get','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','CannedAnswers','UserProfileResource','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x396145,_0x4a8196){var _0x1a8bc4=function(_0xd2f8e5){while(--_0xd2f8e5){_0x396145['push'](_0x396145['shift']());}};_0x1a8bc4(++_0x4a8196);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x30bae6=_0x3a02e1['get']({'plain':!![]});var _0xfb6e48=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0xfb6e48,'resourceId':_0x30bae6['id']}})[_0x0a9e('0x22')](function(){return _0x3a02e1;});})[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x15')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x25')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x26')];}_0x33161b[_0x0a9e('0x17')](_0x526cf3)[_0x0a9e('0x27')](_0x384319);};}exports[_0x0a9e('0x28')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x29')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2c')],'type':_0x5c877d[_0x0a9e('0x2d')][_0x0a9e('0x2e')]};});_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x29')](_0x3652a7,_0x0a9e('0x26'));_0x14de77[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x140511[_0x0a9e('0x30')]);_0x14de77['filters']=_[_0x0a9e('0x32')](_0x14de77['model'],_0x14de77[_0x0a9e('0x30')]);_0x11c3b6[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x14de77[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0x140511['query'][_0x0a9e('0x34')]));_0x11c3b6[_0x0a9e('0x33')]=_0x11c3b6[_0x0a9e('0x33')][_0x0a9e('0x35')]?_0x11c3b6[_0x0a9e('0x33')]:_0x14de77[_0x0a9e('0x2f')];if(!_0x140511[_0x0a9e('0x30')][_0x0a9e('0x36')]('nolimit')){_0x11c3b6[_0x0a9e('0x1a')]=qs['limit'](_0x140511[_0x0a9e('0x30')][_0x0a9e('0x1a')]);_0x11c3b6[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x140511['query'][_0x0a9e('0x19')]);}_0x11c3b6[_0x0a9e('0x37')]=qs[_0x0a9e('0x38')](_0x140511[_0x0a9e('0x30')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x39')](_['pick'](_0x140511[_0x0a9e('0x30')],_0x14de77[_0x0a9e('0x39')]),_0x3652a7);if(_0x140511[_0x0a9e('0x30')][_0x0a9e('0x3a')]){_0x11c3b6['where']=_[_0x0a9e('0x3b')](_0x11c3b6[_0x0a9e('0x3c')],{'$or':_[_0x0a9e('0x29')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2d')]!==_0x0a9e('0x3d')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x3a')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3b')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3c')]};return db[_0x0a9e('0x2a')][_0x0a9e('0x3e')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x3e')]=_0x5a594b;if(_0x140511[_0x0a9e('0x30')]['includeAll']){_0x11c3b6[_0x0a9e('0x3f')]=[{'all':!![]}];}return db[_0x0a9e('0x2a')][_0x0a9e('0x40')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x41')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x42')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x43')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':!![],'where':{'id':_0xeaa5e5[_0x0a9e('0x44')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2f')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x23b089[_0x0a9e('0x30')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x39')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],_0x23b089[_0x0a9e('0x30')]);_0x45a9b8[_0x0a9e('0x33')]=_[_0x0a9e('0x32')](_0x23b089[_0x0a9e('0x2f')],qs[_0x0a9e('0x34')](_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x34')]));_0x45a9b8[_0x0a9e('0x33')]=_0x45a9b8[_0x0a9e('0x33')]['length']?_0x45a9b8[_0x0a9e('0x33')]:_0x23b089[_0x0a9e('0x2f')];if(_0xeaa5e5[_0x0a9e('0x30')][_0x0a9e('0x45')]){_0x45a9b8[_0x0a9e('0x3f')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3b')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x46')]);return db[_0x0a9e('0x2a')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x42')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x20')]=function(_0x8d6dd1,_0x562fb4){if(_0x8d6dd1[_0x0a9e('0x47')]['id']){delete _0x8d6dd1[_0x0a9e('0x47')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x8d6dd1[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x562fb4,null))[_0x0a9e('0x22')](saveUpdates(_0x8d6dd1['body'],null))[_0x0a9e('0x22')](respondWithResult(_0x562fb4,null))[_0x0a9e('0x42')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x21')]=function(_0x16f976,_0x409789){return db[_0x0a9e('0x2a')][_0x0a9e('0x48')]({'where':{'id':_0x16f976[_0x0a9e('0x44')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x409789,null))['then'](removeEntity(_0x409789,null))[_0x0a9e('0x42')](handleError(_0x409789,null));};exports[_0x0a9e('0x49')]=function(_0x4f7240,_0x4ae14b){var _0x5ddf84={'key':_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x2e')]};if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')]){_0x5ddf84[_0x0a9e('0x4a')]=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4a')];}else if(_0x4f7240[_0x0a9e('0x47')]['SmsAccountId']){_0x5ddf84['SmsAccountId']=_0x4f7240['body'][_0x0a9e('0x4b')];}else if(_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')]){_0x5ddf84['OpenchannelAccountId']=_0x4f7240[_0x0a9e('0x47')][_0x0a9e('0x4c')];}else if(_0x4f7240['body']['ChatWebsiteId']){_0x5ddf84[_0x0a9e('0x4d')]=_0x4f7240['body'][_0x0a9e('0x4d')];}return db['CannedAnswer'][_0x0a9e('0x48')]({'where':_0x5ddf84})[_0x0a9e('0x22')](function(_0x439340){if(_0x439340){throw new db['Sequelize'][(_0x0a9e('0x4e'))](_0x0a9e('0x4f'));}return db['CannedAnswer']['create'](_0x4f7240[_0x0a9e('0x47')]);})[_0x0a9e('0x22')](function(_0x49c095){var _0x145931=_0x4f7240['user'][_0x0a9e('0x50')]({'plain':!![]});if(!_0x145931)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x145931[_0x0a9e('0x51')]==='user'){var _0x5da27d=_0x49c095['get']({'plain':!![]});return db[_0x0a9e('0x52')]['find']({'where':{'name':_0x0a9e('0x23'),'userProfileId':_0x145931[_0x0a9e('0x53')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x19b4df){if(_0x19b4df&&_0x19b4df[_0x0a9e('0x54')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x49')]({'name':_0x5da27d[_0x0a9e('0x26')],'resourceId':_0x5da27d['id'],'type':_0x19b4df['name'],'sectionId':_0x19b4df['id']},{})[_0x0a9e('0x22')](function(){return _0x49c095;});}else{return _0x49c095;}})[_0x0a9e('0x42')](function(_0x2642bb){logger[_0x0a9e('0x55')](_0x0a9e('0x56'),_0x2642bb);throw _0x2642bb;});}return _0x49c095;})[_0x0a9e('0x22')](respondWithResult(_0x4ae14b,0xc9))['catch'](handleError(_0x4ae14b,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 8797571..3c030ae 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 _0xe4e8=['moment','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','CannedAnswer','tools_canned_answers','lodash','util','../../config/logger','api'];(function(_0x5cb62c,_0x1c4972){var _0x241fd0=function(_0x4eadb5){while(--_0x4eadb5){_0x5cb62c['push'](_0x5cb62c['shift']());}};_0x241fd0(++_0x1c4972);}(_0xe4e8,0x104));var _0x8e4e=function(_0x29976e,_0x5d1721){_0x29976e=_0x29976e-0x0;var _0x188bf0=_0xe4e8[_0x29976e];return _0x188bf0;};'use strict';var _=require(_0x8e4e('0x0'));var util=require(_0x8e4e('0x1'));var logger=require(_0x8e4e('0x2'))(_0x8e4e('0x3'));var moment=require(_0x8e4e('0x4'));var BPromise=require('bluebird');var rp=require(_0x8e4e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8e4e('0x6'));var config=require(_0x8e4e('0x7'));var attributes=require(_0x8e4e('0x8'));module['exports']=function(_0x134c85,_0x3a9568){return _0x134c85['define'](_0x8e4e('0x9'),attributes,{'tableName':_0x8e4e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x773c=['lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','utf8mb4_unicode_ci'];(function(_0x178c03,_0x31c7b2){var _0x13e510=function(_0x2f551a){while(--_0x2f551a){_0x178c03['push'](_0x178c03['shift']());}};_0x13e510(++_0x31c7b2);}(_0x773c,0x6e));var _0xc773=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0x773c[_0x2c3255];return _0x282aba;};'use strict';var _=require(_0xc773('0x0'));var util=require(_0xc773('0x1'));var logger=require(_0xc773('0x2'))(_0xc773('0x3'));var moment=require('moment');var BPromise=require(_0xc773('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc773('0x5'));var config=require(_0xc773('0x6'));var attributes=require(_0xc773('0x7'));module[_0xc773('0x8')]=function(_0x454881,_0x2f23f8){return _0x454881['define'](_0xc773('0x9'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc773('0xa')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 5eecc39..051291c 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 _0x01e9=['CannedAnswer,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','request','then','info'];(function(_0x8d3b4b,_0xd1db47){var _0x509753=function(_0x2e5ef8){while(--_0x2e5ef8){_0x8d3b4b['push'](_0x8d3b4b['shift']());}};_0x509753(++_0xd1db47);}(_0x01e9,0x192));var _0x901e=function(_0x223e4a,_0x321047){_0x223e4a=_0x223e4a-0x0;var _0x1322b2=_0x01e9[_0x223e4a];return _0x1322b2;};'use strict';var _=require(_0x901e('0x0'));var util=require(_0x901e('0x1'));var moment=require('moment');var BPromise=require(_0x901e('0x2'));var rs=require(_0x901e('0x3'));var fs=require('fs');var Redis=require(_0x901e('0x4'));var db=require(_0x901e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x901e('0x6'));var config=require(_0x901e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x901e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x242039,_0x210bec,_0xf51d85){return new BPromise(function(_0x32b8c6,_0x541ad7){return client[_0x901e('0x9')](_0x242039,_0xf51d85)[_0x901e('0xa')](function(_0x4c0e36){logger[_0x901e('0xb')](_0x901e('0xc'),_0x210bec,_0x901e('0xd'));logger['debug']('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x210bec,_0x901e('0xd'),JSON[_0x901e('0xe')](_0x4c0e36));if(_0x4c0e36[_0x901e('0xf')]){if(_0x4c0e36[_0x901e('0xf')]['code']===0x1f4){logger[_0x901e('0xf')](_0x901e('0xc'),_0x210bec,_0x4c0e36[_0x901e('0xf')]['message']);return _0x541ad7(_0x4c0e36[_0x901e('0xf')][_0x901e('0x10')]);}logger[_0x901e('0xf')](_0x901e('0xc'),_0x210bec,_0x4c0e36[_0x901e('0xf')][_0x901e('0x10')]);return _0x32b8c6(_0x4c0e36['error'][_0x901e('0x10')]);}else{logger[_0x901e('0xb')](_0x901e('0xc'),_0x210bec,_0x901e('0xd'));_0x32b8c6(_0x4c0e36['result'][_0x901e('0x10')]);}})[_0x901e('0x11')](function(_0x1fdb5f){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x210bec,_0x1fdb5f);_0x541ad7(_0x1fdb5f);});});} \ No newline at end of file +var _0xb057=['code','message','CannedAnswer,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xdb4d5f,_0x5f295a){var _0x5041d3=function(_0x243954){while(--_0x243954){_0xdb4d5f['push'](_0xdb4d5f['shift']());}};_0x5041d3(++_0x5f295a);}(_0xb057,0x1e8));var _0x7b05=function(_0x5f1b05,_0x4429a1){_0x5f1b05=_0x5f1b05-0x0;var _0x22cca2=_0xb057[_0x5f1b05];return _0x22cca2;};'use strict';var _=require('lodash');var util=require(_0x7b05('0x0'));var moment=require(_0x7b05('0x1'));var BPromise=require(_0x7b05('0x2'));var rs=require(_0x7b05('0x3'));var fs=require('fs');var Redis=require(_0x7b05('0x4'));var db=require(_0x7b05('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b05('0x6'))('rpc');var config=require(_0x7b05('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7b05('0x8')][_0x7b05('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9a0572,_0x27adda,_0x599e41){return new BPromise(function(_0x519a87,_0x42351d){return client[_0x7b05('0xa')](_0x9a0572,_0x599e41)[_0x7b05('0xb')](function(_0x2acca6){logger[_0x7b05('0xc')]('CannedAnswer,\x20%s,\x20%s',_0x27adda,_0x7b05('0xd'));logger[_0x7b05('0xe')](_0x7b05('0xf'),_0x27adda,_0x7b05('0xd'),JSON[_0x7b05('0x10')](_0x2acca6));if(_0x2acca6['error']){if(_0x2acca6[_0x7b05('0x11')][_0x7b05('0x12')]===0x1f4){logger[_0x7b05('0x11')]('CannedAnswer,\x20%s,\x20%s',_0x27adda,_0x2acca6['error']['message']);return _0x42351d(_0x2acca6[_0x7b05('0x11')][_0x7b05('0x13')]);}logger[_0x7b05('0x11')](_0x7b05('0x14'),_0x27adda,_0x2acca6[_0x7b05('0x11')][_0x7b05('0x13')]);return _0x519a87(_0x2acca6[_0x7b05('0x11')][_0x7b05('0x13')]);}else{logger[_0x7b05('0xc')]('CannedAnswer,\x20%s,\x20%s',_0x27adda,_0x7b05('0xd'));_0x519a87(_0x2acca6[_0x7b05('0x15')]['message']);}})[_0x7b05('0x16')](function(_0x3567f2){logger[_0x7b05('0x11')](_0x7b05('0x14'),_0x27adda,_0x3567f2);_0x42351d(_0x3567f2);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 2c01073..21892cf 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 _0x42eb=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x32ee03,_0x70c6ac){var _0x298bee=function(_0x28c75b){while(--_0x28c75b){_0x32ee03['push'](_0x32ee03['shift']());}};_0x298bee(++_0x70c6ac);}(_0x42eb,0xf5));var _0xb42e=function(_0x263f4c,_0x438626){_0x263f4c=_0x263f4c-0x0;var _0x3a78d3=_0x42eb[_0x263f4c];return _0x3a78d3;};'use strict';var multer=require(_0xb42e('0x0'));var util=require(_0xb42e('0x1'));var path=require(_0xb42e('0x2'));var timeout=require('connect-timeout');var express=require(_0xb42e('0x3'));var router=express[_0xb42e('0x4')]();var auth=require(_0xb42e('0x5'));var interaction=require(_0xb42e('0x6'));var config=require(_0xb42e('0x7'));var controller=require('./cannedAnswer.controller');router[_0xb42e('0x8')]('/',auth[_0xb42e('0x9')](),controller['index']);router['get'](_0xb42e('0xa'),auth[_0xb42e('0x9')](),controller[_0xb42e('0xb')]);router[_0xb42e('0xc')]('/',auth[_0xb42e('0x9')](),controller[_0xb42e('0xd')]);router[_0xb42e('0xe')](_0xb42e('0xa'),auth[_0xb42e('0x9')](),controller['update']);router[_0xb42e('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xb42e('0x10')]);module[_0xb42e('0x11')]=router; \ No newline at end of file +var _0x816e=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0xbfbef3,_0x235b3b){var _0x200406=function(_0x19f9b6){while(--_0x19f9b6){_0xbfbef3['push'](_0xbfbef3['shift']());}};_0x200406(++_0x235b3b);}(_0x816e,0x1f1));var _0xe816=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x816e[_0x58dc25];return _0x21b0a7;};'use strict';var multer=require(_0xe816('0x0'));var util=require(_0xe816('0x1'));var path=require(_0xe816('0x2'));var timeout=require(_0xe816('0x3'));var express=require(_0xe816('0x4'));var router=express[_0xe816('0x5')]();var auth=require(_0xe816('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe816('0x7'));var controller=require(_0xe816('0x8'));router[_0xe816('0x9')]('/',auth[_0xe816('0xa')](),controller['index']);router['get'](_0xe816('0xb'),auth[_0xe816('0xa')](),controller[_0xe816('0xc')]);router[_0xe816('0xd')]('/',auth[_0xe816('0xa')](),controller[_0xe816('0xe')]);router[_0xe816('0xf')]('/:id',auth[_0xe816('0xa')](),controller[_0xe816('0x10')]);router[_0xe816('0x11')](_0xe816('0xb'),auth[_0xe816('0xa')](),controller[_0xe816('0x12')]);module[_0xe816('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index aea923d..d6a596d 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 _0x28a9=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','DATE'];(function(_0x3f9882,_0x4063bb){var _0x18b725=function(_0x8e5916){while(--_0x8e5916){_0x3f9882['push'](_0x3f9882['shift']());}};_0x18b725(++_0x4063bb);}(_0x28a9,0xc6));var _0x928a=function(_0x4cd7fd,_0x315a81){_0x4cd7fd=_0x4cd7fd-0x0;var _0x11157d=_0x28a9[_0x4cd7fd];return _0x11157d;};'use strict';var Sequelize=require(_0x928a('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x928a('0x1')],'allowNull':![],'defaultValue':_0x928a('0x2')},'clid':{'type':Sequelize[_0x928a('0x3')]},'src':{'type':Sequelize[_0x928a('0x3')]},'dst':{'type':Sequelize[_0x928a('0x3')]},'dcontext':{'type':Sequelize[_0x928a('0x3')]},'channel':{'type':Sequelize[_0x928a('0x3')]},'dstchannel':{'type':Sequelize[_0x928a('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x928a('0x3')]},'duration':{'type':Sequelize[_0x928a('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x928a('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x928a('0x3')]},'userfield':{'type':Sequelize[_0x928a('0x3')]},'uniqueid':{'type':Sequelize[_0x928a('0x3')]},'linkedid':{'type':Sequelize[_0x928a('0x3')]},'sequence':{'type':Sequelize[_0x928a('0x3')]},'peeraccount':{'type':Sequelize[_0x928a('0x3')]},'type':{'type':Sequelize[_0x928a('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd784=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x1cfe5e,_0x44c3de){var _0x1875df=function(_0x5ab321){while(--_0x5ab321){_0x1cfe5e['push'](_0x1cfe5e['shift']());}};_0x1875df(++_0x44c3de);}(_0xd784,0x18d));var _0x4d78=function(_0x334a29,_0x3fa9e3){_0x334a29=_0x334a29-0x0;var _0xdb33fc=_0xd784[_0x334a29];return _0xdb33fc;};'use strict';var Sequelize=require(_0x4d78('0x0'));module[_0x4d78('0x1')]={'calldate':{'type':Sequelize[_0x4d78('0x2')],'allowNull':![],'defaultValue':_0x4d78('0x3')},'clid':{'type':Sequelize[_0x4d78('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x4d78('0x4')]},'channel':{'type':Sequelize[_0x4d78('0x4')]},'dstchannel':{'type':Sequelize[_0x4d78('0x4')]},'lastapp':{'type':Sequelize[_0x4d78('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x4d78('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4d78('0x4')]},'amaflags':{'type':Sequelize[_0x4d78('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x4d78('0x4')]},'uniqueid':{'type':Sequelize[_0x4d78('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x4d78('0x4')]},'type':{'type':Sequelize[_0x4d78('0x4')]},'tag':{'type':Sequelize[_0x4d78('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 7b8b8c1..e8afeb8 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 _0xc7ef=['Cdr','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','length','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','offset','json','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','index','map'];(function(_0x512589,_0x3daf18){var _0x18243b=function(_0x4d2910){while(--_0x4d2910){_0x512589['push'](_0x512589['shift']());}};_0x18243b(++_0x3daf18);}(_0xc7ef,0x158));var _0xfc7e=function(_0x3c86ae,_0x59fc98){_0x3c86ae=_0x3c86ae-0x0;var _0x277981=_0xc7ef[_0x3c86ae];return _0x277981;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xfc7e('0x0'));var rimraf=require(_0xfc7e('0x1'));var zipdir=require(_0xfc7e('0x2'));var jsonpatch=require(_0xfc7e('0x3'));var rp=require(_0xfc7e('0x4'));var moment=require(_0xfc7e('0x5'));var BPromise=require(_0xfc7e('0x6'));var Mustache=require('mustache');var util=require(_0xfc7e('0x7'));var path=require(_0xfc7e('0x8'));var sox=require(_0xfc7e('0x9'));var csv=require(_0xfc7e('0xa'));var ejs=require(_0xfc7e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xfc7e('0xc'));var jsforce=require(_0xfc7e('0xd'));var deskjs=require(_0xfc7e('0xe'));var toCsv=require(_0xfc7e('0xa'));var querystring=require(_0xfc7e('0xf'));var Papa=require(_0xfc7e('0x10'));var Redis=require(_0xfc7e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfc7e('0x12'));var as=require(_0xfc7e('0x13'));var hardwareService=require(_0xfc7e('0x14'));var logger=require(_0xfc7e('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xfc7e('0x16'));var licenseUtil=require(_0xfc7e('0x17'));var db=require(_0xfc7e('0x18'))['db'];function respondWithStatusCode(_0x31e998,_0x2d3374){_0x2d3374=_0x2d3374||0xcc;return function(_0x6952e7){if(_0x6952e7){return _0x31e998['sendStatus'](_0x2d3374);}return _0x31e998[_0xfc7e('0x19')](_0x2d3374)['end']();};}function respondWithResult(_0x74ad40,_0x399535){_0x399535=_0x399535||0xc8;return function(_0x4276ad){if(_0x4276ad){return _0x74ad40[_0xfc7e('0x19')](_0x399535)['json'](_0x4276ad);}};}function respondWithFilteredResult(_0xbebeab,_0xabcb0){return function(_0x90dd6f){if(_0x90dd6f){var _0xf46c2f=_0x90dd6f['count'],_0x271588=_0xabcb0[_0xfc7e('0x1a')],_0x25954e=_0xabcb0[_0xfc7e('0x1a')]+_0xabcb0['limit'],_0x4bb7e3;if(_0x25954e>=_0xf46c2f){_0x25954e=_0xf46c2f;_0x4bb7e3=0xc8;}else{_0x4bb7e3=0xce;}_0xbebeab[_0xfc7e('0x19')](_0x4bb7e3);return _0xbebeab['set']('Content-Range',_0x271588+'-'+_0x25954e+'/'+_0xf46c2f)[_0xfc7e('0x1b')](_0x90dd6f);}return null;};}function patchUpdates(_0x11fd3f){return function(_0x2fe482){try{jsonpatch[_0xfc7e('0x1c')](_0x2fe482,_0x11fd3f,!![]);}catch(_0x2fa8bb){return BPromise[_0xfc7e('0x1d')](_0x2fa8bb);}return _0x2fe482[_0xfc7e('0x1e')]();};}function saveUpdates(_0x224dce,_0x3e10a5){return function(_0x158d24){if(_0x158d24){return _0x158d24['update'](_0x224dce)[_0xfc7e('0x1f')](function(_0x1f65b9){return _0x1f65b9;});}return null;};}function removeEntity(_0xa22ba0,_0x7ebe8a){return function(_0x396177){if(_0x396177){return _0x396177[_0xfc7e('0x20')]()[_0xfc7e('0x1f')](function(){_0xa22ba0['status'](0xcc)[_0xfc7e('0x21')]();});}};}function handleEntityNotFound(_0x185c74,_0x291bd7){return function(_0x2fcac4){if(!_0x2fcac4){_0x185c74[_0xfc7e('0x22')](0x194);}return _0x2fcac4;};}function handleError(_0x1297cd,_0x19a21a){_0x19a21a=_0x19a21a||0x1f4;return function(_0xb8331e){logger[_0xfc7e('0x23')](_0xb8331e[_0xfc7e('0x24')]);if(_0xb8331e[_0xfc7e('0x25')]){delete _0xb8331e[_0xfc7e('0x25')];}_0x1297cd[_0xfc7e('0x19')](_0x19a21a)[_0xfc7e('0x26')](_0xb8331e);};}exports[_0xfc7e('0x27')]=function(_0x544a83,_0x469d29){var _0x271d74={},_0x54101b={},_0x2e0e4b={'count':0x0,'rows':[]};var _0x35a15b=_[_0xfc7e('0x28')](db[_0xfc7e('0x29')][_0xfc7e('0x2a')],function(_0x4d1efa){return{'name':_0x4d1efa[_0xfc7e('0x2b')],'type':_0x4d1efa['type'][_0xfc7e('0x2c')]};});_0x54101b[_0xfc7e('0x2d')]=_[_0xfc7e('0x28')](_0x35a15b,_0xfc7e('0x25'));_0x54101b[_0xfc7e('0x2e')]=_[_0xfc7e('0x2f')](_0x544a83[_0xfc7e('0x2e')]);_0x54101b[_0xfc7e('0x30')]=_['intersection'](_0x54101b['model'],_0x54101b[_0xfc7e('0x2e')]);_0x271d74[_0xfc7e('0x31')]=_[_0xfc7e('0x32')](_0x54101b[_0xfc7e('0x2d')],qs[_0xfc7e('0x33')](_0x544a83[_0xfc7e('0x2e')][_0xfc7e('0x33')]));_0x271d74[_0xfc7e('0x31')]=_0x271d74['attributes']['length']?_0x271d74[_0xfc7e('0x31')]:_0x54101b[_0xfc7e('0x2d')];if(!_0x544a83[_0xfc7e('0x2e')][_0xfc7e('0x34')](_0xfc7e('0x35'))){_0x271d74['limit']=qs[_0xfc7e('0x36')](_0x544a83['query'][_0xfc7e('0x36')]);_0x271d74[_0xfc7e('0x1a')]=qs['offset'](_0x544a83[_0xfc7e('0x2e')][_0xfc7e('0x1a')]);}_0x271d74[_0xfc7e('0x37')]=qs[_0xfc7e('0x38')](_0x544a83[_0xfc7e('0x2e')][_0xfc7e('0x38')]);_0x271d74[_0xfc7e('0x39')]=qs[_0xfc7e('0x30')](_[_0xfc7e('0x3a')](_0x544a83[_0xfc7e('0x2e')],_0x54101b['filters']),_0x35a15b);if(_0x544a83[_0xfc7e('0x2e')][_0xfc7e('0x3b')]){_0x271d74[_0xfc7e('0x39')]=_[_0xfc7e('0x3c')](_0x271d74[_0xfc7e('0x39')],{'$or':_[_0xfc7e('0x28')](_0x35a15b,function(_0x3d2048){if(_0x3d2048[_0xfc7e('0x3d')]!==_0xfc7e('0x3e')){var _0x5de7ac={};_0x5de7ac[_0x3d2048[_0xfc7e('0x25')]]={'$like':'%'+_0x544a83[_0xfc7e('0x2e')][_0xfc7e('0x3b')]+'%'};return _0x5de7ac;}})});}_0x271d74=_[_0xfc7e('0x3c')]({},_0x271d74,_0x544a83[_0xfc7e('0x3f')]);var _0x59f444={'where':_0x271d74[_0xfc7e('0x39')]};return db['Cdr']['count'](_0x59f444)[_0xfc7e('0x1f')](function(_0x8aa6fa){_0x2e0e4b[_0xfc7e('0x40')]=_0x8aa6fa;if(_0x544a83['query'][_0xfc7e('0x41')]){_0x271d74[_0xfc7e('0x42')]=[{'all':!![]}];}return db[_0xfc7e('0x29')]['findAll'](_0x271d74);})[_0xfc7e('0x1f')](function(_0x2c4e9f){_0x2e0e4b[_0xfc7e('0x43')]=_0x2c4e9f;return _0x2e0e4b;})[_0xfc7e('0x1f')](respondWithFilteredResult(_0x469d29,_0x271d74))[_0xfc7e('0x44')](handleError(_0x469d29,null));};exports[_0xfc7e('0x45')]=function(_0x626685,_0x395480){var _0x5aee7a={'raw':!![],'where':{'id':_0x626685[_0xfc7e('0x46')]['id']}},_0x2ebb85={};_0x2ebb85[_0xfc7e('0x2d')]=_[_0xfc7e('0x2f')](db['Cdr'][_0xfc7e('0x2a')]);_0x2ebb85[_0xfc7e('0x2e')]=_[_0xfc7e('0x2f')](_0x626685[_0xfc7e('0x2e')]);_0x2ebb85['filters']=_[_0xfc7e('0x32')](_0x2ebb85[_0xfc7e('0x2d')],_0x2ebb85['query']);_0x5aee7a[_0xfc7e('0x31')]=_[_0xfc7e('0x32')](_0x2ebb85['model'],qs['fields'](_0x626685[_0xfc7e('0x2e')][_0xfc7e('0x33')]));_0x5aee7a[_0xfc7e('0x31')]=_0x5aee7a[_0xfc7e('0x31')][_0xfc7e('0x47')]?_0x5aee7a[_0xfc7e('0x31')]:_0x2ebb85[_0xfc7e('0x2d')];if(_0x626685[_0xfc7e('0x2e')][_0xfc7e('0x41')]){_0x5aee7a['include']=[{'all':!![]}];}_0x5aee7a=_[_0xfc7e('0x3c')]({},_0x5aee7a,_0x626685[_0xfc7e('0x3f')]);return db[_0xfc7e('0x29')][_0xfc7e('0x48')](_0x5aee7a)[_0xfc7e('0x1f')](handleEntityNotFound(_0x395480,null))[_0xfc7e('0x1f')](respondWithResult(_0x395480,null))[_0xfc7e('0x44')](handleError(_0x395480,null));};exports['create']=function(_0x14e1dd,_0x1d45e6){return db[_0xfc7e('0x29')][_0xfc7e('0x49')](_0x14e1dd['body'],{})['then'](respondWithResult(_0x1d45e6,0xc9))[_0xfc7e('0x44')](handleError(_0x1d45e6,null));};exports[_0xfc7e('0x4a')]=function(_0x2b1206,_0x2d65bf){if(_0x2b1206['body']['id']){delete _0x2b1206[_0xfc7e('0x4b')]['id'];}return db[_0xfc7e('0x29')]['find']({'where':{'id':_0x2b1206[_0xfc7e('0x46')]['id']}})[_0xfc7e('0x1f')](handleEntityNotFound(_0x2d65bf,null))[_0xfc7e('0x1f')](saveUpdates(_0x2b1206[_0xfc7e('0x4b')],null))[_0xfc7e('0x1f')](respondWithResult(_0x2d65bf,null))['catch'](handleError(_0x2d65bf,null));};exports[_0xfc7e('0x20')]=function(_0x46df0e,_0x13fc1b){return db['Cdr'][_0xfc7e('0x48')]({'where':{'id':_0x46df0e[_0xfc7e('0x46')]['id']}})[_0xfc7e('0x1f')](handleEntityNotFound(_0x13fc1b,null))['then'](removeEntity(_0x13fc1b,null))[_0xfc7e('0x44')](handleError(_0x13fc1b,null));};exports['describe']=function(_0x3e43f6,_0x394ee7){return db['Cdr'][_0xfc7e('0x4c')]()[_0xfc7e('0x1f')](respondWithResult(_0x394ee7,null))['catch'](handleError(_0x394ee7,null));}; \ No newline at end of file +var _0x38f3=['status','end','json','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','Cdr','includeAll','include','findAll','catch','create','body','find','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x38f3,0x111));var _0x338f=function(_0x41bfa8,_0x2222f0){_0x41bfa8=_0x41bfa8-0x0;var _0x5a689e=_0x38f3[_0x41bfa8];return _0x5a689e;};'use strict';var pdf=require(_0x338f('0x0'));var emlformat=require(_0x338f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x338f('0x2'));var jsonpatch=require(_0x338f('0x3'));var rp=require('request-promise');var moment=require(_0x338f('0x4'));var BPromise=require(_0x338f('0x5'));var Mustache=require(_0x338f('0x6'));var util=require('util');var path=require(_0x338f('0x7'));var sox=require(_0x338f('0x8'));var csv=require(_0x338f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x338f('0xa'));var squel=require(_0x338f('0xb'));var crypto=require(_0x338f('0xc'));var jsforce=require(_0x338f('0xd'));var deskjs=require(_0x338f('0xe'));var toCsv=require(_0x338f('0x9'));var querystring=require(_0x338f('0xf'));var Papa=require(_0x338f('0x10'));var Redis=require(_0x338f('0x11'));var authService=require(_0x338f('0x12'));var qs=require(_0x338f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x338f('0x14'));var logger=require(_0x338f('0x15'))(_0x338f('0x16'));var utils=require('../../config/utils');var config=require(_0x338f('0x17'));var licenseUtil=require(_0x338f('0x18'));var db=require(_0x338f('0x19'))['db'];function respondWithStatusCode(_0x3142b8,_0x48bd54){_0x48bd54=_0x48bd54||0xcc;return function(_0x5c0c30){if(_0x5c0c30){return _0x3142b8[_0x338f('0x1a')](_0x48bd54);}return _0x3142b8[_0x338f('0x1b')](_0x48bd54)[_0x338f('0x1c')]();};}function respondWithResult(_0x167b7d,_0x379cfe){_0x379cfe=_0x379cfe||0xc8;return function(_0x36521b){if(_0x36521b){return _0x167b7d[_0x338f('0x1b')](_0x379cfe)[_0x338f('0x1d')](_0x36521b);}};}function respondWithFilteredResult(_0x29f468,_0x1ad428){return function(_0x43b193){if(_0x43b193){var _0x1245cd=_0x43b193[_0x338f('0x1e')],_0x1d464a=_0x1ad428[_0x338f('0x1f')],_0x585597=_0x1ad428['offset']+_0x1ad428['limit'],_0xf01d66;if(_0x585597>=_0x1245cd){_0x585597=_0x1245cd;_0xf01d66=0xc8;}else{_0xf01d66=0xce;}_0x29f468[_0x338f('0x1b')](_0xf01d66);return _0x29f468[_0x338f('0x20')]('Content-Range',_0x1d464a+'-'+_0x585597+'/'+_0x1245cd)['json'](_0x43b193);}return null;};}function patchUpdates(_0x318b04){return function(_0x550708){try{jsonpatch[_0x338f('0x21')](_0x550708,_0x318b04,!![]);}catch(_0x20a120){return BPromise[_0x338f('0x22')](_0x20a120);}return _0x550708[_0x338f('0x23')]();};}function saveUpdates(_0x54ada1,_0x3eee61){return function(_0x57deaa){if(_0x57deaa){return _0x57deaa[_0x338f('0x24')](_0x54ada1)[_0x338f('0x25')](function(_0xc83587){return _0xc83587;});}return null;};}function removeEntity(_0x9a86b4,_0x405b19){return function(_0xa27432){if(_0xa27432){return _0xa27432[_0x338f('0x26')]()[_0x338f('0x25')](function(){_0x9a86b4[_0x338f('0x1b')](0xcc)[_0x338f('0x1c')]();});}};}function handleEntityNotFound(_0x309a42,_0x4ee035){return function(_0x3b0b29){if(!_0x3b0b29){_0x309a42['sendStatus'](0x194);}return _0x3b0b29;};}function handleError(_0x292941,_0x45598d){_0x45598d=_0x45598d||0x1f4;return function(_0xc57bb){logger[_0x338f('0x27')](_0xc57bb[_0x338f('0x28')]);if(_0xc57bb[_0x338f('0x29')]){delete _0xc57bb['name'];}_0x292941[_0x338f('0x1b')](_0x45598d)['send'](_0xc57bb);};}exports['index']=function(_0x52d92c,_0x569ee6){var _0x44fe18={},_0x4f86c8={},_0x35cf7b={'count':0x0,'rows':[]};var _0x2a3355=_[_0x338f('0x2a')](db['Cdr'][_0x338f('0x2b')],function(_0x122e59){return{'name':_0x122e59[_0x338f('0x2c')],'type':_0x122e59[_0x338f('0x2d')][_0x338f('0x2e')]};});_0x4f86c8[_0x338f('0x2f')]=_[_0x338f('0x2a')](_0x2a3355,_0x338f('0x29'));_0x4f86c8[_0x338f('0x30')]=_[_0x338f('0x31')](_0x52d92c[_0x338f('0x30')]);_0x4f86c8['filters']=_[_0x338f('0x32')](_0x4f86c8[_0x338f('0x2f')],_0x4f86c8['query']);_0x44fe18[_0x338f('0x33')]=_[_0x338f('0x32')](_0x4f86c8[_0x338f('0x2f')],qs[_0x338f('0x34')](_0x52d92c[_0x338f('0x30')]['fields']));_0x44fe18['attributes']=_0x44fe18[_0x338f('0x33')][_0x338f('0x35')]?_0x44fe18[_0x338f('0x33')]:_0x4f86c8[_0x338f('0x2f')];if(!_0x52d92c[_0x338f('0x30')][_0x338f('0x36')](_0x338f('0x37'))){_0x44fe18[_0x338f('0x38')]=qs['limit'](_0x52d92c[_0x338f('0x30')][_0x338f('0x38')]);_0x44fe18[_0x338f('0x1f')]=qs[_0x338f('0x1f')](_0x52d92c[_0x338f('0x30')]['offset']);}_0x44fe18[_0x338f('0x39')]=qs[_0x338f('0x3a')](_0x52d92c[_0x338f('0x30')][_0x338f('0x3a')]);_0x44fe18[_0x338f('0x3b')]=qs[_0x338f('0x3c')](_[_0x338f('0x3d')](_0x52d92c['query'],_0x4f86c8['filters']),_0x2a3355);if(_0x52d92c[_0x338f('0x30')][_0x338f('0x3e')]){_0x44fe18[_0x338f('0x3b')]=_[_0x338f('0x3f')](_0x44fe18[_0x338f('0x3b')],{'$or':_[_0x338f('0x2a')](_0x2a3355,function(_0x74b27b){if(_0x74b27b[_0x338f('0x2d')]!==_0x338f('0x40')){var _0x41c43f={};_0x41c43f[_0x74b27b[_0x338f('0x29')]]={'$like':'%'+_0x52d92c[_0x338f('0x30')][_0x338f('0x3e')]+'%'};return _0x41c43f;}})});}_0x44fe18=_[_0x338f('0x3f')]({},_0x44fe18,_0x52d92c['options']);var _0x569ca4={'where':_0x44fe18[_0x338f('0x3b')]};return db[_0x338f('0x41')]['count'](_0x569ca4)[_0x338f('0x25')](function(_0x53eeb7){_0x35cf7b[_0x338f('0x1e')]=_0x53eeb7;if(_0x52d92c[_0x338f('0x30')][_0x338f('0x42')]){_0x44fe18[_0x338f('0x43')]=[{'all':!![]}];}return db[_0x338f('0x41')][_0x338f('0x44')](_0x44fe18);})[_0x338f('0x25')](function(_0x25698b){_0x35cf7b['rows']=_0x25698b;return _0x35cf7b;})[_0x338f('0x25')](respondWithFilteredResult(_0x569ee6,_0x44fe18))[_0x338f('0x45')](handleError(_0x569ee6,null));};exports['show']=function(_0x306907,_0x279b19){var _0x8dc9a4={'raw':!![],'where':{'id':_0x306907['params']['id']}},_0x1a3b89={};_0x1a3b89['model']=_[_0x338f('0x31')](db[_0x338f('0x41')][_0x338f('0x2b')]);_0x1a3b89[_0x338f('0x30')]=_[_0x338f('0x31')](_0x306907[_0x338f('0x30')]);_0x1a3b89[_0x338f('0x3c')]=_[_0x338f('0x32')](_0x1a3b89[_0x338f('0x2f')],_0x1a3b89[_0x338f('0x30')]);_0x8dc9a4[_0x338f('0x33')]=_['intersection'](_0x1a3b89[_0x338f('0x2f')],qs[_0x338f('0x34')](_0x306907['query']['fields']));_0x8dc9a4['attributes']=_0x8dc9a4[_0x338f('0x33')][_0x338f('0x35')]?_0x8dc9a4[_0x338f('0x33')]:_0x1a3b89[_0x338f('0x2f')];if(_0x306907[_0x338f('0x30')][_0x338f('0x42')]){_0x8dc9a4[_0x338f('0x43')]=[{'all':!![]}];}_0x8dc9a4=_[_0x338f('0x3f')]({},_0x8dc9a4,_0x306907['options']);return db[_0x338f('0x41')]['find'](_0x8dc9a4)['then'](handleEntityNotFound(_0x279b19,null))['then'](respondWithResult(_0x279b19,null))[_0x338f('0x45')](handleError(_0x279b19,null));};exports[_0x338f('0x46')]=function(_0x3939ca,_0x4bcb9d){return db[_0x338f('0x41')][_0x338f('0x46')](_0x3939ca[_0x338f('0x47')],{})[_0x338f('0x25')](respondWithResult(_0x4bcb9d,0xc9))[_0x338f('0x45')](handleError(_0x4bcb9d,null));};exports['update']=function(_0x7aac82,_0x4a8c81){if(_0x7aac82[_0x338f('0x47')]['id']){delete _0x7aac82[_0x338f('0x47')]['id'];}return db[_0x338f('0x41')][_0x338f('0x48')]({'where':{'id':_0x7aac82[_0x338f('0x49')]['id']}})['then'](handleEntityNotFound(_0x4a8c81,null))[_0x338f('0x25')](saveUpdates(_0x7aac82[_0x338f('0x47')],null))['then'](respondWithResult(_0x4a8c81,null))['catch'](handleError(_0x4a8c81,null));};exports[_0x338f('0x26')]=function(_0x2ca97e,_0x13ecdb){return db['Cdr'][_0x338f('0x48')]({'where':{'id':_0x2ca97e[_0x338f('0x49')]['id']}})[_0x338f('0x25')](handleEntityNotFound(_0x13ecdb,null))[_0x338f('0x25')](removeEntity(_0x13ecdb,null))['catch'](handleError(_0x13ecdb,null));};exports[_0x338f('0x4a')]=function(_0xeca6af,_0x49821d){return db[_0x338f('0x41')][_0x338f('0x4a')]()[_0x338f('0x25')](respondWithResult(_0x49821d,null))[_0x338f('0x45')](handleError(_0x49821d,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index e708aad..988008f 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 _0x430c=['bluebird','./cdr.attributes','exports','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','api','moment'];(function(_0x4de26f,_0x36330f){var _0x4e9c21=function(_0x29b058){while(--_0x29b058){_0x4de26f['push'](_0x4de26f['shift']());}};_0x4e9c21(++_0x36330f);}(_0x430c,0x1a1));var _0xc430=function(_0x1fdb40,_0x51351c){_0x1fdb40=_0x1fdb40-0x0;var _0x281f93=_0x430c[_0x1fdb40];return _0x281f93;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc430('0x1'));var moment=require(_0xc430('0x2'));var BPromise=require(_0xc430('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc430('0x4'));module[_0xc430('0x5')]=function(_0x50b256,_0x42aa9c){return _0x50b256['define'](_0xc430('0x6'),attributes,{'tableName':_0xc430('0x7'),'paranoid':![],'indexes':[{'name':_0xc430('0x8'),'fields':[_0xc430('0x8')]},{'name':_0xc430('0x9'),'fields':[_0xc430('0x9')]},{'name':_0xc430('0xa'),'fields':[_0xc430('0xa')]},{'name':_0xc430('0xb'),'fields':['dst']},{'name':_0xc430('0xc'),'fields':[_0xc430('0xc')]},{'name':'uniqueid','fields':[_0xc430('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x1883=['dst','src','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define','Cdr','cdr','accountcode','calldate','disposition'];(function(_0x4f3457,_0x171430){var _0x5694ce=function(_0x1ed511){while(--_0x1ed511){_0x4f3457['push'](_0x4f3457['shift']());}};_0x5694ce(++_0x171430);}(_0x1883,0xab));var _0x3188=function(_0x3a7dbd,_0x5bd3a2){_0x3a7dbd=_0x3a7dbd-0x0;var _0x24f5e9=_0x1883[_0x3a7dbd];return _0x24f5e9;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));module[_0x3188('0xb')]=function(_0x408ae0,_0x33b62d){return _0x408ae0[_0x3188('0xc')](_0x3188('0xd'),attributes,{'tableName':_0x3188('0xe'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x3188('0xf')]},{'name':_0x3188('0x10'),'fields':['calldate']},{'name':_0x3188('0x11'),'fields':['disposition']},{'name':_0x3188('0x12'),'fields':[_0x3188('0x12')]},{'name':_0x3188('0x13'),'fields':[_0x3188('0x13')]},{'name':'uniqueid','fields':[_0x3188('0x14')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 2448049..229d723 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 _0x8cc4=['client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4db4f9,_0x223229){var _0x7c1ba1=function(_0x5a1d9a){while(--_0x5a1d9a){_0x4db4f9['push'](_0x4db4f9['shift']());}};_0x7c1ba1(++_0x223229);}(_0x8cc4,0x8c));var _0x48cc=function(_0x279de4,_0x5d552d){_0x279de4=_0x279de4-0x0;var _0x104a16=_0x8cc4[_0x279de4];return _0x104a16;};'use strict';var _=require('lodash');var util=require(_0x48cc('0x0'));var moment=require(_0x48cc('0x1'));var BPromise=require(_0x48cc('0x2'));var rs=require(_0x48cc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x48cc('0x4'))['db'];var utils=require(_0x48cc('0x5'));var logger=require(_0x48cc('0x6'))(_0x48cc('0x7'));var config=require(_0x48cc('0x8'));var jayson=require(_0x48cc('0x9'));var client=jayson[_0x48cc('0xa')][_0x48cc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x721875,_0x2fbc89,_0xc91b95){return new BPromise(function(_0x56458e,_0xd576b4){return client[_0x48cc('0xc')](_0x721875,_0xc91b95)[_0x48cc('0xd')](function(_0x41c239){logger['info'](_0x48cc('0xe'),_0x2fbc89,_0x48cc('0xf'));logger[_0x48cc('0x10')](_0x48cc('0x11'),_0x2fbc89,_0x48cc('0xf'),JSON[_0x48cc('0x12')](_0x41c239));if(_0x41c239['error']){if(_0x41c239[_0x48cc('0x13')][_0x48cc('0x14')]===0x1f4){logger[_0x48cc('0x13')](_0x48cc('0xe'),_0x2fbc89,_0x41c239[_0x48cc('0x13')]['message']);return _0xd576b4(_0x41c239['error'][_0x48cc('0x15')]);}logger[_0x48cc('0x13')]('Cdr,\x20%s,\x20%s',_0x2fbc89,_0x41c239[_0x48cc('0x13')][_0x48cc('0x15')]);return _0x56458e(_0x41c239['error']['message']);}else{logger[_0x48cc('0x16')](_0x48cc('0xe'),_0x2fbc89,_0x48cc('0xf'));_0x56458e(_0x41c239[_0x48cc('0x17')][_0x48cc('0x15')]);}})[_0x48cc('0x18')](function(_0x247426){logger['error'](_0x48cc('0xe'),_0x2fbc89,_0x247426);_0xd576b4(_0x247426);});});} \ No newline at end of file +var _0xff9b=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','message','info','result'];(function(_0x3eba11,_0x1fdfe2){var _0x265640=function(_0x317ba2){while(--_0x317ba2){_0x3eba11['push'](_0x3eba11['shift']());}};_0x265640(++_0x1fdfe2);}(_0xff9b,0xf3));var _0xbff9=function(_0x631aa1,_0x2f7d83){_0x631aa1=_0x631aa1-0x0;var _0x319a1b=_0xff9b[_0x631aa1];return _0x319a1b;};'use strict';var _=require(_0xbff9('0x0'));var util=require(_0xbff9('0x1'));var moment=require(_0xbff9('0x2'));var BPromise=require(_0xbff9('0x3'));var rs=require(_0xbff9('0x4'));var fs=require('fs');var Redis=require(_0xbff9('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbff9('0x6'))(_0xbff9('0x7'));var config=require(_0xbff9('0x8'));var jayson=require(_0xbff9('0x9'));var client=jayson[_0xbff9('0xa')][_0xbff9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x544c9a,_0x2d2e4c,_0xb4dff8){return new BPromise(function(_0x1560ed,_0x48663b){return client[_0xbff9('0xc')](_0x544c9a,_0xb4dff8)['then'](function(_0x299886){logger['info'](_0xbff9('0xd'),_0x2d2e4c,_0xbff9('0xe'));logger[_0xbff9('0xf')](_0xbff9('0x10'),_0x2d2e4c,_0xbff9('0xe'),JSON['stringify'](_0x299886));if(_0x299886['error']){if(_0x299886['error']['code']===0x1f4){logger[_0xbff9('0x11')](_0xbff9('0xd'),_0x2d2e4c,_0x299886[_0xbff9('0x11')][_0xbff9('0x12')]);return _0x48663b(_0x299886[_0xbff9('0x11')]['message']);}logger['error'](_0xbff9('0xd'),_0x2d2e4c,_0x299886[_0xbff9('0x11')][_0xbff9('0x12')]);return _0x1560ed(_0x299886['error']['message']);}else{logger[_0xbff9('0x13')](_0xbff9('0xd'),_0x2d2e4c,'request\x20sent');_0x1560ed(_0x299886[_0xbff9('0x14')]['message']);}})[_0xbff9('0x15')](function(_0x3de7ac){logger[_0xbff9('0x11')](_0xbff9('0xd'),_0x2d2e4c,_0x3de7ac);_0x48663b(_0x3de7ac);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 61e537a..076f230 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 _0xe5dc=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get'];(function(_0x353c20,_0x57b579){var _0x3fdd2c=function(_0x3e50c9){while(--_0x3e50c9){_0x353c20['push'](_0x353c20['shift']());}};_0x3fdd2c(++_0x57b579);}(_0xe5dc,0x79));var _0xce5d=function(_0x33bc21,_0x5127ae){_0x33bc21=_0x33bc21-0x0;var _0x4f8076=_0xe5dc[_0x33bc21];return _0x4f8076;};'use strict';var multer=require(_0xce5d('0x0'));var util=require(_0xce5d('0x1'));var path=require(_0xce5d('0x2'));var timeout=require(_0xce5d('0x3'));var express=require(_0xce5d('0x4'));var router=express[_0xce5d('0x5')]();var auth=require(_0xce5d('0x6'));var interaction=require(_0xce5d('0x7'));var config=require(_0xce5d('0x8'));var controller=require(_0xce5d('0x9'));router[_0xce5d('0xa')]('/',auth[_0xce5d('0xb')](),controller[_0xce5d('0xc')]);router[_0xce5d('0xa')](_0xce5d('0xd'),auth[_0xce5d('0xb')](),controller[_0xce5d('0xe')]);router[_0xce5d('0xa')](_0xce5d('0xf'),auth[_0xce5d('0xb')](),controller[_0xce5d('0x10')]);router[_0xce5d('0x11')]('/',auth[_0xce5d('0xb')](),controller[_0xce5d('0x12')]);router[_0xce5d('0x13')](_0xce5d('0xf'),auth[_0xce5d('0xb')](),controller['update']);router['delete'](_0xce5d('0xf'),auth[_0xce5d('0xb')](),controller[_0xce5d('0x14')]);module[_0xce5d('0x15')]=router; \ No newline at end of file +var _0x3451=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cdr.controller','get','isAuthenticated','describe','show','post','put','/:id','update','delete','exports','multer','util'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x3451,0x83));var _0x1345=function(_0x2a9783,_0x1ef1ef){_0x2a9783=_0x2a9783-0x0;var _0x3c3e13=_0x3451[_0x2a9783];return _0x3c3e13;};'use strict';var multer=require(_0x1345('0x0'));var util=require(_0x1345('0x1'));var path=require(_0x1345('0x2'));var timeout=require(_0x1345('0x3'));var express=require(_0x1345('0x4'));var router=express[_0x1345('0x5')]();var auth=require(_0x1345('0x6'));var interaction=require(_0x1345('0x7'));var config=require('../../config/environment');var controller=require(_0x1345('0x8'));router[_0x1345('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1345('0x9')]('/describe',auth[_0x1345('0xa')](),controller[_0x1345('0xb')]);router[_0x1345('0x9')]('/:id',auth[_0x1345('0xa')](),controller[_0x1345('0xc')]);router[_0x1345('0xd')]('/',auth[_0x1345('0xa')](),controller['create']);router[_0x1345('0xe')](_0x1345('0xf'),auth[_0x1345('0xa')](),controller[_0x1345('0x10')]);router[_0x1345('0x11')]('/:id',auth[_0x1345('0xa')](),controller['destroy']);module[_0x1345('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 d2a9d34..69d5395 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 _0x6889=['TEXT','sequelize','exports','STRING'];(function(_0x256910,_0x3f61c3){var _0x540331=function(_0xe952de){while(--_0xe952de){_0x256910['push'](_0x256910['shift']());}};_0x540331(++_0x3f61c3);}(_0x6889,0x159));var _0x9688=function(_0x523adf,_0x3e1620){_0x523adf=_0x523adf-0x0;var _0x283870=_0x6889[_0x523adf];return _0x283870;};'use strict';var Sequelize=require(_0x9688('0x0'));module[_0x9688('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9688('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9688('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9688('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xe4a9=['INTEGER','STRING','noop','exports'];(function(_0x38f086,_0x329727){var _0x1457b3=function(_0x395a38){while(--_0x395a38){_0x38f086['push'](_0x38f086['shift']());}};_0x1457b3(++_0x329727);}(_0xe4a9,0x117));var _0x9e4a=function(_0x49e454,_0x22328f){_0x49e454=_0x49e454-0x0;var _0x21d045=_0xe4a9[_0x49e454];return _0x21d045;};'use strict';var Sequelize=require('sequelize');module[_0x9e4a('0x0')]={'priority':{'type':Sequelize[_0x9e4a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9e4a('0x2')],'allowNull':![],'defaultValue':_0x9e4a('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9e4a('0x2')]},'interval':{'type':Sequelize[_0x9e4a('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 9a7f624..f05ef7e 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 _0x8306=['ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','catch','body','find','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','show','model','keys'];(function(_0x39b80d,_0x126b06){var _0x352c7d=function(_0x4ab19a){while(--_0x4ab19a){_0x39b80d['push'](_0x39b80d['shift']());}};_0x352c7d(++_0x126b06);}(_0x8306,0x125));var _0x6830=function(_0x214994,_0x10ecd8){_0x214994=_0x214994-0x0;var _0x484156=_0x8306[_0x214994];return _0x484156;};'use strict';var pdf=require(_0x6830('0x0'));var emlformat=require(_0x6830('0x1'));var rimraf=require(_0x6830('0x2'));var zipdir=require(_0x6830('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6830('0x4'));var moment=require('moment');var BPromise=require(_0x6830('0x5'));var Mustache=require(_0x6830('0x6'));var util=require(_0x6830('0x7'));var path=require(_0x6830('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6830('0x9'));var fs=require('fs');var _=require(_0x6830('0xa'));var squel=require(_0x6830('0xb'));var crypto=require('crypto');var jsforce=require(_0x6830('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6830('0xd'));var querystring=require(_0x6830('0xe'));var Papa=require(_0x6830('0xf'));var Redis=require(_0x6830('0x10'));var authService=require(_0x6830('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x6830('0x12'));var hardwareService=require(_0x6830('0x13'));var logger=require('../../config/logger')(_0x6830('0x14'));var utils=require(_0x6830('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6830('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36b7bf,_0x4391d3){_0x4391d3=_0x4391d3||0xcc;return function(_0x1ea247){if(_0x1ea247){return _0x36b7bf['sendStatus'](_0x4391d3);}return _0x36b7bf[_0x6830('0x17')](_0x4391d3)[_0x6830('0x18')]();};}function respondWithResult(_0x309299,_0x313f0b){_0x313f0b=_0x313f0b||0xc8;return function(_0x185a1e){if(_0x185a1e){return _0x309299[_0x6830('0x17')](_0x313f0b)[_0x6830('0x19')](_0x185a1e);}};}function respondWithFilteredResult(_0x2447c5,_0x4e33d7){return function(_0xbad3c3){if(_0xbad3c3){var _0x5186c6=_0xbad3c3[_0x6830('0x1a')],_0x1305ab=_0x4e33d7[_0x6830('0x1b')],_0x13ac5c=_0x4e33d7[_0x6830('0x1b')]+_0x4e33d7[_0x6830('0x1c')],_0x16e011;if(_0x13ac5c>=_0x5186c6){_0x13ac5c=_0x5186c6;_0x16e011=0xc8;}else{_0x16e011=0xce;}_0x2447c5[_0x6830('0x17')](_0x16e011);return _0x2447c5[_0x6830('0x1d')](_0x6830('0x1e'),_0x1305ab+'-'+_0x13ac5c+'/'+_0x5186c6)[_0x6830('0x19')](_0xbad3c3);}return null;};}function patchUpdates(_0x5cf2cb){return function(_0x1d98f8){try{jsonpatch[_0x6830('0x1f')](_0x1d98f8,_0x5cf2cb,!![]);}catch(_0x1dcbda){return BPromise['reject'](_0x1dcbda);}return _0x1d98f8[_0x6830('0x20')]();};}function saveUpdates(_0x57e41e,_0x32b34b){return function(_0x35acb2){if(_0x35acb2){return _0x35acb2['update'](_0x57e41e)[_0x6830('0x21')](function(_0x41475b){return _0x41475b;});}return null;};}function removeEntity(_0x19a7e9,_0x3fb27e){return function(_0x26e9d4){if(_0x26e9d4){return _0x26e9d4[_0x6830('0x22')]()[_0x6830('0x21')](function(){_0x19a7e9[_0x6830('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x478d9b,_0x108082){return function(_0xdeaac8){if(!_0xdeaac8){_0x478d9b[_0x6830('0x23')](0x194);}return _0xdeaac8;};}function handleError(_0x1e8c8a,_0x24bcd3){_0x24bcd3=_0x24bcd3||0x1f4;return function(_0x55a23a){logger[_0x6830('0x24')](_0x55a23a[_0x6830('0x25')]);if(_0x55a23a[_0x6830('0x26')]){delete _0x55a23a[_0x6830('0x26')];}_0x1e8c8a['status'](_0x24bcd3)[_0x6830('0x27')](_0x55a23a);};}exports[_0x6830('0x28')]=function(_0x1e15c6,_0x562ef4){var _0x257aa1={'raw':!![],'where':{'id':_0x1e15c6['params']['id']}},_0x5234b7={};_0x5234b7[_0x6830('0x29')]=_[_0x6830('0x2a')](db[_0x6830('0x2b')][_0x6830('0x2c')]);_0x5234b7[_0x6830('0x2d')]=_['keys'](_0x1e15c6['query']);_0x5234b7[_0x6830('0x2e')]=_[_0x6830('0x2f')](_0x5234b7[_0x6830('0x29')],_0x5234b7[_0x6830('0x2d')]);_0x257aa1[_0x6830('0x30')]=_[_0x6830('0x2f')](_0x5234b7[_0x6830('0x29')],qs[_0x6830('0x31')](_0x1e15c6['query']['fields']));_0x257aa1[_0x6830('0x30')]=_0x257aa1[_0x6830('0x30')]['length']?_0x257aa1[_0x6830('0x30')]:_0x5234b7[_0x6830('0x29')];if(_0x1e15c6[_0x6830('0x2d')][_0x6830('0x32')]){_0x257aa1[_0x6830('0x33')]=[{'all':!![]}];}_0x257aa1=_['merge']({},_0x257aa1,_0x1e15c6['options']);return db[_0x6830('0x2b')]['find'](_0x257aa1)[_0x6830('0x21')](handleEntityNotFound(_0x562ef4,null))[_0x6830('0x21')](respondWithResult(_0x562ef4,null))[_0x6830('0x34')](handleError(_0x562ef4,null));};exports['update']=function(_0x4e1cb8,_0x2d0289){if(_0x4e1cb8[_0x6830('0x35')]['id']){delete _0x4e1cb8['body']['id'];}return db['ChatApplication'][_0x6830('0x36')]({'where':{'id':_0x4e1cb8[_0x6830('0x37')]['id']}})[_0x6830('0x21')](handleEntityNotFound(_0x2d0289,null))[_0x6830('0x21')](saveUpdates(_0x4e1cb8[_0x6830('0x35')],null))[_0x6830('0x21')](respondWithResult(_0x2d0289,null))[_0x6830('0x34')](handleError(_0x2d0289,null));};exports['destroy']=function(_0x1805c3,_0x3e5a52){return db['ChatApplication'][_0x6830('0x36')]({'where':{'id':_0x1805c3[_0x6830('0x37')]['id']}})[_0x6830('0x21')](handleEntityNotFound(_0x3e5a52,null))[_0x6830('0x21')](removeEntity(_0x3e5a52,null))[_0x6830('0x34')](handleError(_0x3e5a52,null));}; \ No newline at end of file +var _0x9a6a=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','params','model','keys','rawAttributes','intersection','query','attributes','fields','includeAll','include','ChatApplication','find','catch','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x5e2daf,_0x9eb3d3){var _0x2742bf=function(_0x3e7a21){while(--_0x3e7a21){_0x5e2daf['push'](_0x5e2daf['shift']());}};_0x2742bf(++_0x9eb3d3);}(_0x9a6a,0xce));var _0xa9a6=function(_0x5ce883,_0x54c931){_0x5ce883=_0x5ce883-0x0;var _0x51f64a=_0x9a6a[_0x5ce883];return _0x51f64a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa9a6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa9a6('0x1'));var jsonpatch=require(_0xa9a6('0x2'));var rp=require('request-promise');var moment=require(_0xa9a6('0x3'));var BPromise=require(_0xa9a6('0x4'));var Mustache=require(_0xa9a6('0x5'));var util=require(_0xa9a6('0x6'));var path=require(_0xa9a6('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa9a6('0x8'));var fs=require('fs');var _=require(_0xa9a6('0x9'));var squel=require(_0xa9a6('0xa'));var crypto=require(_0xa9a6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa9a6('0xc'));var toCsv=require(_0xa9a6('0xd'));var querystring=require(_0xa9a6('0xe'));var Papa=require(_0xa9a6('0xf'));var Redis=require(_0xa9a6('0x10'));var authService=require(_0xa9a6('0x11'));var qs=require(_0xa9a6('0x12'));var as=require(_0xa9a6('0x13'));var hardwareService=require(_0xa9a6('0x14'));var logger=require(_0xa9a6('0x15'))(_0xa9a6('0x16'));var utils=require(_0xa9a6('0x17'));var config=require(_0xa9a6('0x18'));var licenseUtil=require(_0xa9a6('0x19'));var db=require(_0xa9a6('0x1a'))['db'];function respondWithStatusCode(_0x109122,_0x2d469a){_0x2d469a=_0x2d469a||0xcc;return function(_0x8a2d3c){if(_0x8a2d3c){return _0x109122['sendStatus'](_0x2d469a);}return _0x109122[_0xa9a6('0x1b')](_0x2d469a)[_0xa9a6('0x1c')]();};}function respondWithResult(_0x11356f,_0x245517){_0x245517=_0x245517||0xc8;return function(_0x51111c){if(_0x51111c){return _0x11356f['status'](_0x245517)[_0xa9a6('0x1d')](_0x51111c);}};}function respondWithFilteredResult(_0x4a7d12,_0x2107f1){return function(_0xd4b6e8){if(_0xd4b6e8){var _0x44d3c8=_0xd4b6e8[_0xa9a6('0x1e')],_0x43b043=_0x2107f1[_0xa9a6('0x1f')],_0x3ba429=_0x2107f1[_0xa9a6('0x1f')]+_0x2107f1[_0xa9a6('0x20')],_0x207a03;if(_0x3ba429>=_0x44d3c8){_0x3ba429=_0x44d3c8;_0x207a03=0xc8;}else{_0x207a03=0xce;}_0x4a7d12[_0xa9a6('0x1b')](_0x207a03);return _0x4a7d12[_0xa9a6('0x21')](_0xa9a6('0x22'),_0x43b043+'-'+_0x3ba429+'/'+_0x44d3c8)[_0xa9a6('0x1d')](_0xd4b6e8);}return null;};}function patchUpdates(_0x321bad){return function(_0x5ac0e6){try{jsonpatch['apply'](_0x5ac0e6,_0x321bad,!![]);}catch(_0x7a4625){return BPromise[_0xa9a6('0x23')](_0x7a4625);}return _0x5ac0e6[_0xa9a6('0x24')]();};}function saveUpdates(_0x3145fd,_0x5a1975){return function(_0x1d04da){if(_0x1d04da){return _0x1d04da[_0xa9a6('0x25')](_0x3145fd)[_0xa9a6('0x26')](function(_0x2fb10c){return _0x2fb10c;});}return null;};}function removeEntity(_0x3b38f2,_0x45ff9b){return function(_0x5e2dd9){if(_0x5e2dd9){return _0x5e2dd9['destroy']()[_0xa9a6('0x26')](function(){_0x3b38f2['status'](0xcc)[_0xa9a6('0x1c')]();});}};}function handleEntityNotFound(_0x931180,_0x1b5659){return function(_0x753d50){if(!_0x753d50){_0x931180[_0xa9a6('0x27')](0x194);}return _0x753d50;};}function handleError(_0x40f27d,_0x15e08c){_0x15e08c=_0x15e08c||0x1f4;return function(_0x21cd23){logger[_0xa9a6('0x28')](_0x21cd23[_0xa9a6('0x29')]);if(_0x21cd23[_0xa9a6('0x2a')]){delete _0x21cd23[_0xa9a6('0x2a')];}_0x40f27d['status'](_0x15e08c)['send'](_0x21cd23);};}exports['show']=function(_0x4f4b89,_0x2b939a){var _0x6a8890={'raw':!![],'where':{'id':_0x4f4b89[_0xa9a6('0x2b')]['id']}},_0x72fa59={};_0x72fa59[_0xa9a6('0x2c')]=_[_0xa9a6('0x2d')](db['ChatApplication'][_0xa9a6('0x2e')]);_0x72fa59['query']=_[_0xa9a6('0x2d')](_0x4f4b89['query']);_0x72fa59['filters']=_[_0xa9a6('0x2f')](_0x72fa59[_0xa9a6('0x2c')],_0x72fa59[_0xa9a6('0x30')]);_0x6a8890[_0xa9a6('0x31')]=_[_0xa9a6('0x2f')](_0x72fa59['model'],qs[_0xa9a6('0x32')](_0x4f4b89['query'][_0xa9a6('0x32')]));_0x6a8890[_0xa9a6('0x31')]=_0x6a8890['attributes']['length']?_0x6a8890[_0xa9a6('0x31')]:_0x72fa59[_0xa9a6('0x2c')];if(_0x4f4b89[_0xa9a6('0x30')][_0xa9a6('0x33')]){_0x6a8890[_0xa9a6('0x34')]=[{'all':!![]}];}_0x6a8890=_['merge']({},_0x6a8890,_0x4f4b89['options']);return db[_0xa9a6('0x35')][_0xa9a6('0x36')](_0x6a8890)[_0xa9a6('0x26')](handleEntityNotFound(_0x2b939a,null))[_0xa9a6('0x26')](respondWithResult(_0x2b939a,null))[_0xa9a6('0x37')](handleError(_0x2b939a,null));};exports['update']=function(_0x389637,_0x2410db){if(_0x389637[_0xa9a6('0x38')]['id']){delete _0x389637[_0xa9a6('0x38')]['id'];}return db[_0xa9a6('0x35')][_0xa9a6('0x36')]({'where':{'id':_0x389637[_0xa9a6('0x2b')]['id']}})[_0xa9a6('0x26')](handleEntityNotFound(_0x2410db,null))[_0xa9a6('0x26')](saveUpdates(_0x389637['body'],null))['then'](respondWithResult(_0x2410db,null))[_0xa9a6('0x37')](handleError(_0x2410db,null));};exports['destroy']=function(_0x59b4f5,_0x3fa224){return db[_0xa9a6('0x35')][_0xa9a6('0x36')]({'where':{'id':_0x59b4f5[_0xa9a6('0x2b')]['id']}})[_0xa9a6('0x26')](handleEntityNotFound(_0x3fa224,null))[_0xa9a6('0x26')](removeEntity(_0x3fa224,null))[_0xa9a6('0x37')](handleError(_0x3fa224,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 75e16e7..568b752 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 _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file +var _0xa9e0=['define','ChatApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0a9e('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index e38b8b2..db7e845 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 _0xe105=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','bluebird'];(function(_0x238cb1,_0x22ed74){var _0x1baccc=function(_0x1d9b66){while(--_0x1d9b66){_0x238cb1['push'](_0x238cb1['shift']());}};_0x1baccc(++_0x22ed74);}(_0xe105,0x1b3));var _0x5e10=function(_0x1f0c2a,_0x49fd88){_0x1f0c2a=_0x1f0c2a-0x0;var _0x4200d=_0xe105[_0x1f0c2a];return _0x4200d;};'use strict';var _=require(_0x5e10('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5e10('0x1'));var rs=require(_0x5e10('0x2'));var fs=require('fs');var Redis=require(_0x5e10('0x3'));var db=require(_0x5e10('0x4'))['db'];var utils=require(_0x5e10('0x5'));var logger=require(_0x5e10('0x6'))(_0x5e10('0x7'));var config=require(_0x5e10('0x8'));var jayson=require(_0x5e10('0x9'));var client=jayson[_0x5e10('0xa')][_0x5e10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdaa7b2,_0x2a0d54,_0x3a4c7f){return new BPromise(function(_0x2dbd60,_0x20c1db){return client[_0x5e10('0xc')](_0xdaa7b2,_0x3a4c7f)[_0x5e10('0xd')](function(_0x5be284){logger[_0x5e10('0xe')]('ChatApplication,\x20%s,\x20%s',_0x2a0d54,'request\x20sent');logger['debug']('ChatApplication,\x20%s,\x20%s,\x20%s',_0x2a0d54,'request\x20sent',JSON[_0x5e10('0xf')](_0x5be284));if(_0x5be284[_0x5e10('0x10')]){if(_0x5be284[_0x5e10('0x10')][_0x5e10('0x11')]===0x1f4){logger[_0x5e10('0x10')](_0x5e10('0x12'),_0x2a0d54,_0x5be284['error'][_0x5e10('0x13')]);return _0x20c1db(_0x5be284[_0x5e10('0x10')][_0x5e10('0x13')]);}logger[_0x5e10('0x10')](_0x5e10('0x12'),_0x2a0d54,_0x5be284[_0x5e10('0x10')][_0x5e10('0x13')]);return _0x2dbd60(_0x5be284[_0x5e10('0x10')][_0x5e10('0x13')]);}else{logger[_0x5e10('0xe')](_0x5e10('0x12'),_0x2a0d54,_0x5e10('0x14'));_0x2dbd60(_0x5be284[_0x5e10('0x15')][_0x5e10('0x13')]);}})[_0x5e10('0x16')](function(_0x5716ae){logger[_0x5e10('0x10')]('ChatApplication,\x20%s,\x20%s',_0x2a0d54,_0x5716ae);_0x20c1db(_0x5716ae);});});} \ No newline at end of file +var _0x38e3=['info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request'];(function(_0x189cfa,_0x4b9ff5){var _0x765f8c=function(_0x2cd221){while(--_0x2cd221){_0x189cfa['push'](_0x189cfa['shift']());}};_0x765f8c(++_0x4b9ff5);}(_0x38e3,0x187));var _0x338e=function(_0x11fb3e,_0x56d153){_0x11fb3e=_0x11fb3e-0x0;var _0x50ebf6=_0x38e3[_0x11fb3e];return _0x50ebf6;};'use strict';var _=require('lodash');var util=require(_0x338e('0x0'));var moment=require(_0x338e('0x1'));var BPromise=require(_0x338e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x338e('0x3'))['db'];var utils=require(_0x338e('0x4'));var logger=require(_0x338e('0x5'))('rpc');var config=require(_0x338e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x338e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x279661,_0x387f7e,_0x5a1119){return new BPromise(function(_0x25cbb5,_0x4a82aa){return client[_0x338e('0x8')](_0x279661,_0x5a1119)['then'](function(_0x41012c){logger[_0x338e('0x9')](_0x338e('0xa'),_0x387f7e,_0x338e('0xb'));logger[_0x338e('0xc')](_0x338e('0xd'),_0x387f7e,'request\x20sent',JSON[_0x338e('0xe')](_0x41012c));if(_0x41012c[_0x338e('0xf')]){if(_0x41012c[_0x338e('0xf')][_0x338e('0x10')]===0x1f4){logger[_0x338e('0xf')](_0x338e('0xa'),_0x387f7e,_0x41012c[_0x338e('0xf')]['message']);return _0x4a82aa(_0x41012c['error']['message']);}logger[_0x338e('0xf')](_0x338e('0xa'),_0x387f7e,_0x41012c['error'][_0x338e('0x11')]);return _0x25cbb5(_0x41012c[_0x338e('0xf')][_0x338e('0x11')]);}else{logger[_0x338e('0x9')](_0x338e('0xa'),_0x387f7e,_0x338e('0xb'));_0x25cbb5(_0x41012c[_0x338e('0x12')][_0x338e('0x11')]);}})[_0x338e('0x13')](function(_0x2c0cde){logger[_0x338e('0xf')]('ChatApplication,\x20%s,\x20%s',_0x387f7e,_0x2c0cde);_0x4a82aa(_0x2c0cde);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index a3ac597..5c3cb0f 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 _0x522c=['../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x4edaf1,_0x3c0639){var _0x4c4a2a=function(_0xc7556b){while(--_0xc7556b){_0x4edaf1['push'](_0x4edaf1['shift']());}};_0x4c4a2a(++_0x3c0639);}(_0x522c,0x16a));var _0xc522=function(_0x26f6d1,_0x5298e2){_0x26f6d1=_0x26f6d1-0x0;var _0x25c970=_0x522c[_0x26f6d1];return _0x25c970;};'use strict';var multer=require(_0xc522('0x0'));var util=require(_0xc522('0x1'));var path=require('path');var timeout=require(_0xc522('0x2'));var express=require(_0xc522('0x3'));var router=express[_0xc522('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc522('0x5'));var config=require(_0xc522('0x6'));var controller=require(_0xc522('0x7'));router['get'](_0xc522('0x8'),auth[_0xc522('0x9')](),controller[_0xc522('0xa')]);router[_0xc522('0xb')](_0xc522('0x8'),auth[_0xc522('0x9')](),controller[_0xc522('0xc')]);router[_0xc522('0xd')](_0xc522('0x8'),auth[_0xc522('0x9')](),controller[_0xc522('0xe')]);module[_0xc522('0xf')]=router; \ No newline at end of file +var _0x54be=['../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','update','delete','destroy','exports','path','express','../../components/interaction/service'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x54be,0x99));var _0xe54b=function(_0x32d9ce,_0x31c5b7){_0x32d9ce=_0x32d9ce-0x0;var _0x374b63=_0x54be[_0x32d9ce];return _0x374b63;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe54b('0x0'));var timeout=require('connect-timeout');var express=require(_0xe54b('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe54b('0x2'));var config=require(_0xe54b('0x3'));var controller=require(_0xe54b('0x4'));router[_0xe54b('0x5')](_0xe54b('0x6'),auth[_0xe54b('0x7')](),controller[_0xe54b('0x8')]);router['put'](_0xe54b('0x6'),auth[_0xe54b('0x7')](),controller[_0xe54b('0x9')]);router[_0xe54b('0xa')](_0xe54b('0x6'),auth[_0xe54b('0x7')](),controller[_0xe54b('0xb')]);module[_0xe54b('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index d61c6bb..7c5d481 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 _0x54f2=['BOOLEAN','sequelize','exports','STRING'];(function(_0x4b24de,_0x59ba2a){var _0x25a05d=function(_0x5e28c4){while(--_0x5e28c4){_0x4b24de['push'](_0x4b24de['shift']());}};_0x25a05d(++_0x59ba2a);}(_0x54f2,0xa9));var _0x254f=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x54f2[_0x32f7d7];return _0x133d09;};'use strict';var Sequelize=require(_0x254f('0x0'));module[_0x254f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x254f('0x2')]},'write':{'type':Sequelize[_0x254f('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x6384=['exports','STRING'];(function(_0x219536,_0x8e0b9b){var _0x231e4d=function(_0x37b376){while(--_0x37b376){_0x219536['push'](_0x219536['shift']());}};_0x231e4d(++_0x8e0b9b);}(_0x6384,0x112));var _0x4638=function(_0x560589,_0x3889f0){_0x560589=_0x560589-0x0;var _0x386054=_0x6384[_0x560589];return _0x386054;};'use strict';var Sequelize=require('sequelize');module[_0x4638('0x0')]={'name':{'type':Sequelize[_0x4638('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4638('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 722f59b..0c90082 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 _0x707d=['crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','client','http','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','json','count','offset','limit','set','reject','save','update','stack','name','send','index','map','ChatGroup','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','catch','params','keys','rawAttributes','fields','create','body','find','describe','getUnread','ChatInternalMessage','toInteger','addMembers','omit','getMembers','findOne','order','pick','removeMembers','ids','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash'];(function(_0x1b8c71,_0x41d8ab){var _0x539905=function(_0x395edd){while(--_0x395edd){_0x1b8c71['push'](_0x1b8c71['shift']());}};_0x539905(++_0x41d8ab);}(_0x707d,0x18b));var _0xd707=function(_0x2e3baf,_0x30c161){_0x2e3baf=_0x2e3baf-0x0;var _0x4d3f23=_0x707d[_0x2e3baf];return _0x4d3f23;};'use strict';var pdf=require(_0xd707('0x0'));var emlformat=require(_0xd707('0x1'));var rimraf=require(_0xd707('0x2'));var zipdir=require(_0xd707('0x3'));var jsonpatch=require(_0xd707('0x4'));var rp=require(_0xd707('0x5'));var moment=require(_0xd707('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xd707('0x7'));var util=require(_0xd707('0x8'));var path=require(_0xd707('0x9'));var sox=require(_0xd707('0xa'));var csv=require('to-csv');var ejs=require(_0xd707('0xb'));var fs=require('fs');var _=require(_0xd707('0xc'));var squel=require('squel');var crypto=require(_0xd707('0xd'));var jsforce=require(_0xd707('0xe'));var deskjs=require(_0xd707('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd707('0x10'));var Papa=require(_0xd707('0x11'));var Redis=require('ioredis');var authService=require(_0xd707('0x12'));var qs=require(_0xd707('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd707('0x14'))(_0xd707('0x15'));var utils=require(_0xd707('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd707('0x17'));var db=require(_0xd707('0x18'))['db'];config[_0xd707('0x19')]=_['defaults'](config['redis'],{'host':_0xd707('0x1a'),'port':0x18eb});var socket=require(_0xd707('0x1b'))(new Redis(config['redis']));require(_0xd707('0x1c'))[_0xd707('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd707('0x1e')][_0xd707('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4ef57a,_0x4f5e4e,_0x8d4e1c,_0x49ec72){return new BPromise(function(_0x356836,_0x18211b){var _0x479aea=_0x49ec72||client;return _0x479aea[_0xd707('0x20')](_0x4ef57a,_0x8d4e1c)[_0xd707('0x21')](function(_0x26412c){logger[_0xd707('0x22')](_0xd707('0x23'),_0x4f5e4e,_0xd707('0x24'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x4f5e4e,_0xd707('0x24'),JSON['stringify'](_0x26412c));if(_0x26412c[_0xd707('0x25')]){if(_0x26412c[_0xd707('0x25')][_0xd707('0x26')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x4f5e4e,_0x26412c[_0xd707('0x25')][_0xd707('0x27')]);return _0x18211b(_0x26412c[_0xd707('0x25')][_0xd707('0x27')]);}logger[_0xd707('0x25')](_0xd707('0x23'),_0x4f5e4e,_0x26412c[_0xd707('0x25')]['message']);return _0x356836(_0x26412c[_0xd707('0x25')]['message']);}else{logger[_0xd707('0x22')]('ChatGroup,\x20%s,\x20%s',_0x4f5e4e,_0xd707('0x24'));_0x356836(_0x26412c[_0xd707('0x28')][_0xd707('0x27')]);}})['catch'](function(_0xef6093){logger[_0xd707('0x25')]('ChatGroup,\x20%s,\x20%s',_0x4f5e4e,_0xef6093);_0x18211b(_0xef6093);});});}function respondWithStatusCode(_0x24340b,_0x472981){_0x472981=_0x472981||0xcc;return function(_0xdf8e03){if(_0xdf8e03){return _0x24340b[_0xd707('0x29')](_0x472981);}return _0x24340b[_0xd707('0x2a')](_0x472981)[_0xd707('0x2b')]();};}function respondWithResult(_0x18b314,_0x3330e6){_0x3330e6=_0x3330e6||0xc8;return function(_0x3feb7f){if(_0x3feb7f){return _0x18b314[_0xd707('0x2a')](_0x3330e6)[_0xd707('0x2c')](_0x3feb7f);}};}function respondWithFilteredResult(_0x53d5db,_0x2c0750){return function(_0x340b79){if(_0x340b79){var _0x17145b=_0x340b79[_0xd707('0x2d')],_0x2cf61d=_0x2c0750[_0xd707('0x2e')],_0x47029e=_0x2c0750[_0xd707('0x2e')]+_0x2c0750[_0xd707('0x2f')],_0x5c0310;if(_0x47029e>=_0x17145b){_0x47029e=_0x17145b;_0x5c0310=0xc8;}else{_0x5c0310=0xce;}_0x53d5db[_0xd707('0x2a')](_0x5c0310);return _0x53d5db[_0xd707('0x30')]('Content-Range',_0x2cf61d+'-'+_0x47029e+'/'+_0x17145b)[_0xd707('0x2c')](_0x340b79);}return null;};}function patchUpdates(_0x94486d){return function(_0x75ed05){try{jsonpatch['apply'](_0x75ed05,_0x94486d,!![]);}catch(_0x56e642){return BPromise[_0xd707('0x31')](_0x56e642);}return _0x75ed05[_0xd707('0x32')]();};}function saveUpdates(_0x4bfbb7,_0x345382){return function(_0x11b05b){if(_0x11b05b){return _0x11b05b[_0xd707('0x33')](_0x4bfbb7)[_0xd707('0x21')](function(_0x542b08){return _0x542b08;});}return null;};}function removeEntity(_0x4f1cfd,_0x17d75e){return function(_0x1a6c3c){if(_0x1a6c3c){return _0x1a6c3c['destroy']()[_0xd707('0x21')](function(){_0x4f1cfd[_0xd707('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cb9fd,_0x31be53){return function(_0x4b69d4){if(!_0x4b69d4){_0x4cb9fd[_0xd707('0x29')](0x194);}return _0x4b69d4;};}function handleError(_0x5bfe4e,_0x133c48){_0x133c48=_0x133c48||0x1f4;return function(_0x244c0e){logger['error'](_0x244c0e[_0xd707('0x34')]);if(_0x244c0e[_0xd707('0x35')]){delete _0x244c0e[_0xd707('0x35')];}_0x5bfe4e[_0xd707('0x2a')](_0x133c48)[_0xd707('0x36')](_0x244c0e);};}exports[_0xd707('0x37')]=function(_0x5424f7,_0x1b0ac8){var _0x2c0853={},_0x187f8f={},_0xda9b7b={'count':0x0,'rows':[]};var _0x226d17=_[_0xd707('0x38')](db[_0xd707('0x39')]['rawAttributes'],function(_0x5beb41){return{'name':_0x5beb41['fieldName'],'type':_0x5beb41['type'][_0xd707('0x3a')]};});_0x187f8f[_0xd707('0x3b')]=_[_0xd707('0x38')](_0x226d17,_0xd707('0x35'));_0x187f8f[_0xd707('0x3c')]=_['keys'](_0x5424f7['query']);_0x187f8f[_0xd707('0x3d')]=_[_0xd707('0x3e')](_0x187f8f[_0xd707('0x3b')],_0x187f8f[_0xd707('0x3c')]);_0x2c0853[_0xd707('0x3f')]=_[_0xd707('0x3e')](_0x187f8f[_0xd707('0x3b')],qs['fields'](_0x5424f7[_0xd707('0x3c')]['fields']));_0x2c0853[_0xd707('0x3f')]=_0x2c0853[_0xd707('0x3f')][_0xd707('0x40')]?_0x2c0853[_0xd707('0x3f')]:_0x187f8f['model'];if(!_0x5424f7[_0xd707('0x3c')][_0xd707('0x41')](_0xd707('0x42'))){_0x2c0853[_0xd707('0x2f')]=qs[_0xd707('0x2f')](_0x5424f7[_0xd707('0x3c')][_0xd707('0x2f')]);_0x2c0853[_0xd707('0x2e')]=qs[_0xd707('0x2e')](_0x5424f7[_0xd707('0x3c')][_0xd707('0x2e')]);}_0x2c0853['order']=qs[_0xd707('0x43')](_0x5424f7['query'][_0xd707('0x43')]);_0x2c0853[_0xd707('0x44')]=qs['filters'](_['pick'](_0x5424f7['query'],_0x187f8f[_0xd707('0x3d')]),_0x226d17);if(_0x5424f7[_0xd707('0x3c')][_0xd707('0x45')]){_0x2c0853[_0xd707('0x44')]=_[_0xd707('0x46')](_0x2c0853['where'],{'$or':_['map'](_0x226d17,function(_0x2e9c9b){if(_0x2e9c9b[_0xd707('0x47')]!==_0xd707('0x48')){var _0x15b120={};_0x15b120[_0x2e9c9b['name']]={'$like':'%'+_0x5424f7[_0xd707('0x3c')][_0xd707('0x45')]+'%'};return _0x15b120;}})});}_0x2c0853=_[_0xd707('0x46')]({},_0x2c0853,_0x5424f7[_0xd707('0x49')]);var _0x2d4c52={'where':_0x2c0853[_0xd707('0x44')]};return db[_0xd707('0x39')][_0xd707('0x2d')](_0x2d4c52)[_0xd707('0x21')](function(_0x5a9f4f){_0xda9b7b[_0xd707('0x2d')]=_0x5a9f4f;if(_0x5424f7[_0xd707('0x3c')][_0xd707('0x4a')]){_0x2c0853['include']=[{'all':!![]}];}return db[_0xd707('0x39')]['findAll'](_0x2c0853);})['then'](function(_0x3d51e1){_0xda9b7b['rows']=_0x3d51e1;return _0xda9b7b;})[_0xd707('0x21')](respondWithFilteredResult(_0x1b0ac8,_0x2c0853))[_0xd707('0x4b')](handleError(_0x1b0ac8,null));};exports['show']=function(_0x3f9145,_0x4109a2){var _0x4ca3e7={'raw':!![],'where':{'id':_0x3f9145[_0xd707('0x4c')]['id']}},_0x2f6f8e={};_0x2f6f8e[_0xd707('0x3b')]=_[_0xd707('0x4d')](db[_0xd707('0x39')][_0xd707('0x4e')]);_0x2f6f8e[_0xd707('0x3c')]=_['keys'](_0x3f9145[_0xd707('0x3c')]);_0x2f6f8e[_0xd707('0x3d')]=_[_0xd707('0x3e')](_0x2f6f8e[_0xd707('0x3b')],_0x2f6f8e[_0xd707('0x3c')]);_0x4ca3e7[_0xd707('0x3f')]=_['intersection'](_0x2f6f8e[_0xd707('0x3b')],qs[_0xd707('0x4f')](_0x3f9145[_0xd707('0x3c')]['fields']));_0x4ca3e7[_0xd707('0x3f')]=_0x4ca3e7['attributes'][_0xd707('0x40')]?_0x4ca3e7[_0xd707('0x3f')]:_0x2f6f8e['model'];if(_0x3f9145[_0xd707('0x3c')][_0xd707('0x4a')]){_0x4ca3e7['include']=[{'all':!![]}];}_0x4ca3e7=_[_0xd707('0x46')]({},_0x4ca3e7,_0x3f9145[_0xd707('0x49')]);return db[_0xd707('0x39')]['find'](_0x4ca3e7)[_0xd707('0x21')](handleEntityNotFound(_0x4109a2,null))[_0xd707('0x21')](respondWithResult(_0x4109a2,null))[_0xd707('0x4b')](handleError(_0x4109a2,null));};exports[_0xd707('0x50')]=function(_0x3d1de1,_0x55a964){return db[_0xd707('0x39')][_0xd707('0x50')](_0x3d1de1[_0xd707('0x51')],{})['then'](respondWithResult(_0x55a964,0xc9))[_0xd707('0x4b')](handleError(_0x55a964,null));};exports['update']=function(_0x2ed82a,_0x3f797d){if(_0x2ed82a[_0xd707('0x51')]['id']){delete _0x2ed82a[_0xd707('0x51')]['id'];}return db[_0xd707('0x39')][_0xd707('0x52')]({'where':{'id':_0x2ed82a[_0xd707('0x4c')]['id']}})[_0xd707('0x21')](handleEntityNotFound(_0x3f797d,null))[_0xd707('0x21')](saveUpdates(_0x2ed82a[_0xd707('0x51')],null))[_0xd707('0x21')](respondWithResult(_0x3f797d,null))[_0xd707('0x4b')](handleError(_0x3f797d,null));};exports['destroy']=function(_0xd7c202,_0x21f3a5){return db['ChatGroup'][_0xd707('0x52')]({'where':{'id':_0xd7c202[_0xd707('0x4c')]['id']}})[_0xd707('0x21')](handleEntityNotFound(_0x21f3a5,null))['then'](removeEntity(_0x21f3a5,null))['catch'](handleError(_0x21f3a5,null));};exports['describe']=function(_0x35ed2b,_0x5cc402){return db[_0xd707('0x39')][_0xd707('0x53')]()[_0xd707('0x21')](respondWithResult(_0x5cc402,null))[_0xd707('0x4b')](handleError(_0x5cc402,null));};exports[_0xd707('0x54')]=function(_0x5398dd,_0x50713f,_0x2c4bec){return db[_0xd707('0x55')]['count']({'where':{'ChatGroupId':_0x5398dd[_0xd707('0x4c')]['id'],'ToId':_0x5398dd['user']['id'],'read':![]}})[_0xd707('0x21')](function(_0x3e3946){return{'id':_[_0xd707('0x56')](_0x5398dd[_0xd707('0x4c')]['id']),'count':_0x3e3946};})['then'](respondWithResult(_0x50713f,null))[_0xd707('0x4b')](handleError(_0x50713f,null));};exports[_0xd707('0x57')]=function(_0x34c187,_0x1d8d1e,_0x2d8c99){return db[_0xd707('0x39')]['find']({'where':{'id':_0x34c187[_0xd707('0x4c')]['id']}})[_0xd707('0x21')](handleEntityNotFound(_0x1d8d1e,null))[_0xd707('0x21')](function(_0x50c950){if(_0x50c950){return _0x50c950[_0xd707('0x57')](_0x34c187[_0xd707('0x51')]['ids'],_[_0xd707('0x58')](_0x34c187[_0xd707('0x51')],['ids','id'])||{});}})['then'](respondWithResult(_0x1d8d1e,null))[_0xd707('0x4b')](handleError(_0x1d8d1e,null));};exports[_0xd707('0x59')]=function(_0x5863ff,_0x5ac9f8,_0xf0bcee){var _0x206a93={};var _0x44adb7={};var _0xd32a4e;var _0x102f6a;return db['ChatGroup'][_0xd707('0x5a')]({'where':{'id':_0x5863ff[_0xd707('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5ac9f8,null))[_0xd707('0x21')](function(_0x793a27){if(_0x793a27){_0xd32a4e=_0x793a27;_0x44adb7[_0xd707('0x3b')]=_[_0xd707('0x4d')](db['User'][_0xd707('0x4e')]);_0x44adb7[_0xd707('0x3c')]=_[_0xd707('0x4d')](_0x5863ff['query']);_0x44adb7[_0xd707('0x3d')]=_['intersection'](_0x44adb7['model'],_0x44adb7['query']);_0x206a93[_0xd707('0x3f')]=_[_0xd707('0x3e')](_0x44adb7[_0xd707('0x3b')],qs[_0xd707('0x4f')](_0x5863ff['query']['fields']));_0x206a93[_0xd707('0x3f')]=_0x206a93[_0xd707('0x3f')][_0xd707('0x40')]?_0x206a93[_0xd707('0x3f')]:_0x44adb7[_0xd707('0x3b')];_0x206a93[_0xd707('0x5b')]=qs['sort'](_0x5863ff[_0xd707('0x3c')]['sort']);_0x206a93['where']=qs['filters'](_[_0xd707('0x5c')](_0x5863ff['query'],_0x44adb7[_0xd707('0x3d')]));if(_0x5863ff[_0xd707('0x3c')][_0xd707('0x45')]){_0x206a93[_0xd707('0x44')]=_[_0xd707('0x46')](_0x206a93[_0xd707('0x44')],{'$or':_[_0xd707('0x38')](_0x206a93[_0xd707('0x3f')],function(_0x1db12c){var _0xe33e49={};_0xe33e49[_0x1db12c]={'$like':'%'+_0x5863ff[_0xd707('0x3c')][_0xd707('0x45')]+'%'};return _0xe33e49;})});}_0x206a93=_[_0xd707('0x46')]({},_0x206a93,_0x5863ff['options']);return _0xd32a4e[_0xd707('0x59')](_0x206a93);}})[_0xd707('0x21')](function(_0x50c560){if(_0x50c560){_0x102f6a=_0x50c560[_0xd707('0x40')];if(!_0x5863ff[_0xd707('0x3c')][_0xd707('0x41')](_0xd707('0x42'))){_0x206a93['limit']=qs[_0xd707('0x2f')](_0x5863ff[_0xd707('0x3c')][_0xd707('0x2f')]);_0x206a93['offset']=qs['offset'](_0x5863ff['query'][_0xd707('0x2e')]);}return _0xd32a4e[_0xd707('0x59')](_0x206a93);}})[_0xd707('0x21')](function(_0x341173){if(_0x341173){return _0x341173?{'count':_0x102f6a,'rows':_0x341173}:null;}})[_0xd707('0x21')](respondWithResult(_0x5ac9f8,null))[_0xd707('0x4b')](handleError(_0x5ac9f8,null));};exports[_0xd707('0x5d')]=function(_0x13ff8b,_0x1d44e3,_0x1a8868){return db[_0xd707('0x39')][_0xd707('0x52')]({'where':{'id':_0x13ff8b[_0xd707('0x4c')]['id']}})[_0xd707('0x21')](handleEntityNotFound(_0x1d44e3,null))[_0xd707('0x21')](function(_0x35f13b){if(_0x35f13b){return _0x35f13b['removeMembers'](_0x13ff8b[_0xd707('0x3c')][_0xd707('0x5e')]);}})[_0xd707('0x21')](respondWithStatusCode(_0x1d44e3,null))[_0xd707('0x4b')](handleError(_0x1d44e3,null));};exports[_0xd707('0x5f')]=function(_0x590efa,_0x108e6e,_0x5b527c){if(_0x590efa['body']['id']){delete _0x590efa[_0xd707('0x51')]['id'];}return db[_0xd707('0x39')][_0xd707('0x52')]({'where':{'id':_0x590efa['params']['id']}})['then'](handleEntityNotFound(_0x108e6e,null))['then'](function(_0x3fa0a2){if(_0x3fa0a2){_0x590efa[_0xd707('0x51')][_0xd707('0x60')]=_0x3fa0a2['id'];return db[_0xd707('0x55')][_0xd707('0x50')](_0x590efa[_0xd707('0x51')]);}})['then'](respondWithResult(_0x108e6e,null))['catch'](handleError(_0x108e6e,null));};exports[_0xd707('0x61')]=function(_0x4a369d,_0x1c0f99,_0x4de75c){var _0x3a9b8e={};var _0x4f9ece={};var _0x3535d3;var _0x4f9df4;return db[_0xd707('0x39')][_0xd707('0x5a')]({'where':{'id':_0x4a369d[_0xd707('0x4c')]['id']}})[_0xd707('0x21')](handleEntityNotFound(_0x1c0f99,null))['then'](function(_0x1f69e4){if(_0x1f69e4){_0x3535d3=_0x1f69e4;_0x4f9ece['model']=_[_0xd707('0x4d')](db[_0xd707('0x55')][_0xd707('0x4e')]);_0x4f9ece[_0xd707('0x3c')]=_[_0xd707('0x4d')](_0x4a369d[_0xd707('0x3c')]);_0x4f9ece['filters']=_[_0xd707('0x3e')](_0x4f9ece[_0xd707('0x3b')],_0x4f9ece[_0xd707('0x3c')]);_0x3a9b8e[_0xd707('0x3f')]=_['intersection'](_0x4f9ece[_0xd707('0x3b')],qs['fields'](_0x4a369d['query'][_0xd707('0x4f')]));_0x3a9b8e['attributes']=_0x3a9b8e[_0xd707('0x3f')][_0xd707('0x40')]?_0x3a9b8e['attributes']:_0x4f9ece[_0xd707('0x3b')];_0x3a9b8e['order']=qs[_0xd707('0x43')](_0x4a369d[_0xd707('0x3c')][_0xd707('0x43')]);_0x3a9b8e[_0xd707('0x44')]=qs[_0xd707('0x3d')](_[_0xd707('0x5c')](_0x4a369d[_0xd707('0x3c')],_0x4f9ece[_0xd707('0x3d')]));if(_0x4a369d['query'][_0xd707('0x45')]){_0x3a9b8e['where']=_[_0xd707('0x46')](_0x3a9b8e[_0xd707('0x44')],{'$or':_[_0xd707('0x38')](_0x3a9b8e['attributes'],function(_0x3255c1){var _0x3e5f51={};_0x3e5f51[_0x3255c1]={'$like':'%'+_0x4a369d[_0xd707('0x3c')][_0xd707('0x45')]+'%'};return _0x3e5f51;})});}if(_0x4a369d[_0xd707('0x3c')]['$gte']){var _0x3caf96=_0x4a369d[_0xd707('0x3c')][_0xd707('0x62')][_0xd707('0x63')](',');var _0x545acf={};_0x545acf[_0x3caf96[0x0]]={'$gte':moment(_0x3caf96[0x1])[_0xd707('0x64')](_0xd707('0x65'))};_0x3a9b8e[_0xd707('0x44')]=_[_0xd707('0x46')](_0x3a9b8e[_0xd707('0x44')],_0x545acf);}_0x3a9b8e=_[_0xd707('0x46')]({},_0x3a9b8e,_0x4a369d['options']);return _0x3535d3[_0xd707('0x61')](_0x3a9b8e);}})[_0xd707('0x21')](function(_0x52b298){if(_0x52b298){_0x4f9df4=_0x52b298[_0xd707('0x40')];if(!_0x4a369d[_0xd707('0x3c')][_0xd707('0x41')](_0xd707('0x42'))){_0x3a9b8e[_0xd707('0x2f')]=qs['limit'](_0x4a369d[_0xd707('0x3c')][_0xd707('0x2f')]);_0x3a9b8e[_0xd707('0x2e')]=qs['offset'](_0x4a369d['query'][_0xd707('0x2e')]);}return _0x3535d3[_0xd707('0x61')](_0x3a9b8e);}})[_0xd707('0x21')](function(_0xfdab1e){if(_0xfdab1e){return _0xfdab1e?{'count':_0x4f9df4,'rows':_0xfdab1e}:null;}})[_0xd707('0x21')](respondWithResult(_0x1c0f99,null))['catch'](handleError(_0x1c0f99,null));}; \ No newline at end of file +var _0xa848=['rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','ChatGroup','includeAll','include','findAll','rows','params','create','update','body','find','describe','ChatInternalMessage','user','toInteger','omit','ids','getMembers','findOne','User','options','removeMembers','addMessage','ChatGroupId','$gte','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','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','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','status','count','offset','limit','Content-Range','apply','reject','save','destroy','end','sendStatus','stack','name','send','index'];(function(_0x46ca21,_0x16c6bd){var _0x33bb1e=function(_0x3f84a0){while(--_0x3f84a0){_0x46ca21['push'](_0x46ca21['shift']());}};_0x33bb1e(++_0x16c6bd);}(_0xa848,0x99));var _0x8a84=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa848[_0x2dafbe];return _0x58a45a;};'use strict';var pdf=require(_0x8a84('0x0'));var emlformat=require(_0x8a84('0x1'));var rimraf=require(_0x8a84('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8a84('0x3'));var rp=require(_0x8a84('0x4'));var moment=require(_0x8a84('0x5'));var BPromise=require(_0x8a84('0x6'));var Mustache=require(_0x8a84('0x7'));var util=require(_0x8a84('0x8'));var path=require(_0x8a84('0x9'));var sox=require(_0x8a84('0xa'));var csv=require(_0x8a84('0xb'));var ejs=require(_0x8a84('0xc'));var fs=require('fs');var _=require(_0x8a84('0xd'));var squel=require(_0x8a84('0xe'));var crypto=require(_0x8a84('0xf'));var jsforce=require(_0x8a84('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x8a84('0xb'));var querystring=require(_0x8a84('0x11'));var Papa=require(_0x8a84('0x12'));var Redis=require('ioredis');var authService=require(_0x8a84('0x13'));var qs=require(_0x8a84('0x14'));var as=require(_0x8a84('0x15'));var hardwareService=require(_0x8a84('0x16'));var logger=require(_0x8a84('0x17'))(_0x8a84('0x18'));var utils=require(_0x8a84('0x19'));var config=require(_0x8a84('0x1a'));var licenseUtil=require(_0x8a84('0x1b'));var db=require(_0x8a84('0x1c'))['db'];config[_0x8a84('0x1d')]=_[_0x8a84('0x1e')](config['redis'],{'host':_0x8a84('0x1f'),'port':0x18eb});var socket=require(_0x8a84('0x20'))(new Redis(config[_0x8a84('0x1d')]));require('./chatGroup.socket')[_0x8a84('0x21')](socket);var jayson=require(_0x8a84('0x22'));var client=jayson[_0x8a84('0x23')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a939e,_0x2558d9,_0x50a338,_0x44144a){return new BPromise(function(_0x335f65,_0x9e386a){var _0x209516=_0x44144a||client;return _0x209516['request'](_0x2a939e,_0x50a338)[_0x8a84('0x24')](function(_0x1082d8){logger[_0x8a84('0x25')](_0x8a84('0x26'),_0x2558d9,_0x8a84('0x27'));logger[_0x8a84('0x28')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x2558d9,_0x8a84('0x27'),JSON['stringify'](_0x1082d8));if(_0x1082d8[_0x8a84('0x29')]){if(_0x1082d8['error'][_0x8a84('0x2a')]===0x1f4){logger[_0x8a84('0x29')](_0x8a84('0x26'),_0x2558d9,_0x1082d8['error'][_0x8a84('0x2b')]);return _0x9e386a(_0x1082d8[_0x8a84('0x29')][_0x8a84('0x2b')]);}logger[_0x8a84('0x29')](_0x8a84('0x26'),_0x2558d9,_0x1082d8['error'][_0x8a84('0x2b')]);return _0x335f65(_0x1082d8[_0x8a84('0x29')][_0x8a84('0x2b')]);}else{logger[_0x8a84('0x25')](_0x8a84('0x26'),_0x2558d9,'request\x20sent');_0x335f65(_0x1082d8[_0x8a84('0x2c')][_0x8a84('0x2b')]);}})[_0x8a84('0x2d')](function(_0x3751d8){logger['error'](_0x8a84('0x26'),_0x2558d9,_0x3751d8);_0x9e386a(_0x3751d8);});});}function respondWithStatusCode(_0x244126,_0x260f6d){_0x260f6d=_0x260f6d||0xcc;return function(_0x34e448){if(_0x34e448){return _0x244126['sendStatus'](_0x260f6d);}return _0x244126['status'](_0x260f6d)['end']();};}function respondWithResult(_0x272252,_0x44632e){_0x44632e=_0x44632e||0xc8;return function(_0x5520bf){if(_0x5520bf){return _0x272252[_0x8a84('0x2e')](_0x44632e)['json'](_0x5520bf);}};}function respondWithFilteredResult(_0x508720,_0x47b658){return function(_0x4940af){if(_0x4940af){var _0x482067=_0x4940af[_0x8a84('0x2f')],_0x141921=_0x47b658[_0x8a84('0x30')],_0x3083c0=_0x47b658['offset']+_0x47b658[_0x8a84('0x31')],_0x396c46;if(_0x3083c0>=_0x482067){_0x3083c0=_0x482067;_0x396c46=0xc8;}else{_0x396c46=0xce;}_0x508720[_0x8a84('0x2e')](_0x396c46);return _0x508720['set'](_0x8a84('0x32'),_0x141921+'-'+_0x3083c0+'/'+_0x482067)['json'](_0x4940af);}return null;};}function patchUpdates(_0x5c9215){return function(_0x785abb){try{jsonpatch[_0x8a84('0x33')](_0x785abb,_0x5c9215,!![]);}catch(_0x150d4a){return BPromise[_0x8a84('0x34')](_0x150d4a);}return _0x785abb[_0x8a84('0x35')]();};}function saveUpdates(_0x16707a,_0x42cce4){return function(_0x572789){if(_0x572789){return _0x572789['update'](_0x16707a)[_0x8a84('0x24')](function(_0x4b2ab3){return _0x4b2ab3;});}return null;};}function removeEntity(_0x2479a8,_0x274316){return function(_0x25908d){if(_0x25908d){return _0x25908d[_0x8a84('0x36')]()['then'](function(){_0x2479a8[_0x8a84('0x2e')](0xcc)[_0x8a84('0x37')]();});}};}function handleEntityNotFound(_0x140d90,_0x4aa3bb){return function(_0x227eb6){if(!_0x227eb6){_0x140d90[_0x8a84('0x38')](0x194);}return _0x227eb6;};}function handleError(_0x1fcbb8,_0x58eea2){_0x58eea2=_0x58eea2||0x1f4;return function(_0x25ae1c){logger[_0x8a84('0x29')](_0x25ae1c[_0x8a84('0x39')]);if(_0x25ae1c[_0x8a84('0x3a')]){delete _0x25ae1c[_0x8a84('0x3a')];}_0x1fcbb8[_0x8a84('0x2e')](_0x58eea2)[_0x8a84('0x3b')](_0x25ae1c);};}exports[_0x8a84('0x3c')]=function(_0x5b81d6,_0x1f4a68){var _0x471572={},_0x335dcf={},_0x429051={'count':0x0,'rows':[]};var _0x25861d=_['map'](db['ChatGroup'][_0x8a84('0x3d')],function(_0x2c54eb){return{'name':_0x2c54eb[_0x8a84('0x3e')],'type':_0x2c54eb[_0x8a84('0x3f')][_0x8a84('0x40')]};});_0x335dcf['model']=_[_0x8a84('0x41')](_0x25861d,_0x8a84('0x3a'));_0x335dcf[_0x8a84('0x42')]=_[_0x8a84('0x43')](_0x5b81d6[_0x8a84('0x42')]);_0x335dcf[_0x8a84('0x44')]=_[_0x8a84('0x45')](_0x335dcf[_0x8a84('0x46')],_0x335dcf['query']);_0x471572['attributes']=_['intersection'](_0x335dcf[_0x8a84('0x46')],qs[_0x8a84('0x47')](_0x5b81d6['query'][_0x8a84('0x47')]));_0x471572[_0x8a84('0x48')]=_0x471572['attributes'][_0x8a84('0x49')]?_0x471572[_0x8a84('0x48')]:_0x335dcf[_0x8a84('0x46')];if(!_0x5b81d6[_0x8a84('0x42')][_0x8a84('0x4a')](_0x8a84('0x4b'))){_0x471572[_0x8a84('0x31')]=qs['limit'](_0x5b81d6[_0x8a84('0x42')]['limit']);_0x471572[_0x8a84('0x30')]=qs['offset'](_0x5b81d6['query'][_0x8a84('0x30')]);}_0x471572[_0x8a84('0x4c')]=qs[_0x8a84('0x4d')](_0x5b81d6['query'][_0x8a84('0x4d')]);_0x471572[_0x8a84('0x4e')]=qs[_0x8a84('0x44')](_[_0x8a84('0x4f')](_0x5b81d6['query'],_0x335dcf[_0x8a84('0x44')]),_0x25861d);if(_0x5b81d6[_0x8a84('0x42')][_0x8a84('0x50')]){_0x471572[_0x8a84('0x4e')]=_[_0x8a84('0x51')](_0x471572[_0x8a84('0x4e')],{'$or':_[_0x8a84('0x41')](_0x25861d,function(_0xf295f1){if(_0xf295f1[_0x8a84('0x3f')]!=='VIRTUAL'){var _0x590b34={};_0x590b34[_0xf295f1['name']]={'$like':'%'+_0x5b81d6[_0x8a84('0x42')][_0x8a84('0x50')]+'%'};return _0x590b34;}})});}_0x471572=_[_0x8a84('0x51')]({},_0x471572,_0x5b81d6['options']);var _0x872e1b={'where':_0x471572['where']};return db[_0x8a84('0x52')][_0x8a84('0x2f')](_0x872e1b)['then'](function(_0x1216c3){_0x429051[_0x8a84('0x2f')]=_0x1216c3;if(_0x5b81d6['query'][_0x8a84('0x53')]){_0x471572[_0x8a84('0x54')]=[{'all':!![]}];}return db[_0x8a84('0x52')][_0x8a84('0x55')](_0x471572);})['then'](function(_0x2274b0){_0x429051[_0x8a84('0x56')]=_0x2274b0;return _0x429051;})[_0x8a84('0x24')](respondWithFilteredResult(_0x1f4a68,_0x471572))[_0x8a84('0x2d')](handleError(_0x1f4a68,null));};exports['show']=function(_0x4bea7a,_0x4925af){var _0x5660e3={'raw':!![],'where':{'id':_0x4bea7a[_0x8a84('0x57')]['id']}},_0x5e87c9={};_0x5e87c9[_0x8a84('0x46')]=_[_0x8a84('0x43')](db[_0x8a84('0x52')][_0x8a84('0x3d')]);_0x5e87c9['query']=_[_0x8a84('0x43')](_0x4bea7a['query']);_0x5e87c9[_0x8a84('0x44')]=_[_0x8a84('0x45')](_0x5e87c9[_0x8a84('0x46')],_0x5e87c9['query']);_0x5660e3[_0x8a84('0x48')]=_[_0x8a84('0x45')](_0x5e87c9[_0x8a84('0x46')],qs[_0x8a84('0x47')](_0x4bea7a['query'][_0x8a84('0x47')]));_0x5660e3['attributes']=_0x5660e3['attributes'][_0x8a84('0x49')]?_0x5660e3['attributes']:_0x5e87c9[_0x8a84('0x46')];if(_0x4bea7a[_0x8a84('0x42')]['includeAll']){_0x5660e3['include']=[{'all':!![]}];}_0x5660e3=_['merge']({},_0x5660e3,_0x4bea7a['options']);return db[_0x8a84('0x52')]['find'](_0x5660e3)[_0x8a84('0x24')](handleEntityNotFound(_0x4925af,null))[_0x8a84('0x24')](respondWithResult(_0x4925af,null))[_0x8a84('0x2d')](handleError(_0x4925af,null));};exports[_0x8a84('0x58')]=function(_0x2c44c5,_0x269726){return db[_0x8a84('0x52')][_0x8a84('0x58')](_0x2c44c5['body'],{})[_0x8a84('0x24')](respondWithResult(_0x269726,0xc9))['catch'](handleError(_0x269726,null));};exports[_0x8a84('0x59')]=function(_0x1776cc,_0x5f3088){if(_0x1776cc[_0x8a84('0x5a')]['id']){delete _0x1776cc[_0x8a84('0x5a')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x1776cc[_0x8a84('0x57')]['id']}})[_0x8a84('0x24')](handleEntityNotFound(_0x5f3088,null))[_0x8a84('0x24')](saveUpdates(_0x1776cc['body'],null))[_0x8a84('0x24')](respondWithResult(_0x5f3088,null))[_0x8a84('0x2d')](handleError(_0x5f3088,null));};exports[_0x8a84('0x36')]=function(_0x27a2e5,_0x3f74dc){return db[_0x8a84('0x52')][_0x8a84('0x5b')]({'where':{'id':_0x27a2e5[_0x8a84('0x57')]['id']}})[_0x8a84('0x24')](handleEntityNotFound(_0x3f74dc,null))[_0x8a84('0x24')](removeEntity(_0x3f74dc,null))[_0x8a84('0x2d')](handleError(_0x3f74dc,null));};exports['describe']=function(_0x173085,_0xd92bb2){return db[_0x8a84('0x52')][_0x8a84('0x5c')]()[_0x8a84('0x24')](respondWithResult(_0xd92bb2,null))[_0x8a84('0x2d')](handleError(_0xd92bb2,null));};exports['getUnread']=function(_0xbe0618,_0x26269a,_0x1e1a24){return db[_0x8a84('0x5d')][_0x8a84('0x2f')]({'where':{'ChatGroupId':_0xbe0618[_0x8a84('0x57')]['id'],'ToId':_0xbe0618[_0x8a84('0x5e')]['id'],'read':![]}})[_0x8a84('0x24')](function(_0x3d8202){return{'id':_[_0x8a84('0x5f')](_0xbe0618[_0x8a84('0x57')]['id']),'count':_0x3d8202};})[_0x8a84('0x24')](respondWithResult(_0x26269a,null))[_0x8a84('0x2d')](handleError(_0x26269a,null));};exports['addMembers']=function(_0x2f10d5,_0x49b854,_0x40134c){return db[_0x8a84('0x52')]['find']({'where':{'id':_0x2f10d5[_0x8a84('0x57')]['id']}})[_0x8a84('0x24')](handleEntityNotFound(_0x49b854,null))['then'](function(_0x270934){if(_0x270934){return _0x270934['addMembers'](_0x2f10d5[_0x8a84('0x5a')]['ids'],_[_0x8a84('0x60')](_0x2f10d5[_0x8a84('0x5a')],[_0x8a84('0x61'),'id'])||{});}})[_0x8a84('0x24')](respondWithResult(_0x49b854,null))['catch'](handleError(_0x49b854,null));};exports[_0x8a84('0x62')]=function(_0x4a3bcc,_0x2a5d9f,_0x23e261){var _0x208b01={};var _0x4000e1={};var _0x5ca8e6;var _0x2c7428;return db[_0x8a84('0x52')][_0x8a84('0x63')]({'where':{'id':_0x4a3bcc[_0x8a84('0x57')]['id']}})['then'](handleEntityNotFound(_0x2a5d9f,null))['then'](function(_0x5c61b1){if(_0x5c61b1){_0x5ca8e6=_0x5c61b1;_0x4000e1['model']=_[_0x8a84('0x43')](db[_0x8a84('0x64')][_0x8a84('0x3d')]);_0x4000e1['query']=_[_0x8a84('0x43')](_0x4a3bcc['query']);_0x4000e1[_0x8a84('0x44')]=_[_0x8a84('0x45')](_0x4000e1[_0x8a84('0x46')],_0x4000e1['query']);_0x208b01['attributes']=_['intersection'](_0x4000e1[_0x8a84('0x46')],qs[_0x8a84('0x47')](_0x4a3bcc['query'][_0x8a84('0x47')]));_0x208b01['attributes']=_0x208b01['attributes'][_0x8a84('0x49')]?_0x208b01[_0x8a84('0x48')]:_0x4000e1[_0x8a84('0x46')];_0x208b01[_0x8a84('0x4c')]=qs[_0x8a84('0x4d')](_0x4a3bcc['query'][_0x8a84('0x4d')]);_0x208b01[_0x8a84('0x4e')]=qs[_0x8a84('0x44')](_['pick'](_0x4a3bcc[_0x8a84('0x42')],_0x4000e1[_0x8a84('0x44')]));if(_0x4a3bcc[_0x8a84('0x42')]['filter']){_0x208b01[_0x8a84('0x4e')]=_[_0x8a84('0x51')](_0x208b01['where'],{'$or':_[_0x8a84('0x41')](_0x208b01['attributes'],function(_0x1d7b44){var _0x2c4403={};_0x2c4403[_0x1d7b44]={'$like':'%'+_0x4a3bcc['query'][_0x8a84('0x50')]+'%'};return _0x2c4403;})});}_0x208b01=_[_0x8a84('0x51')]({},_0x208b01,_0x4a3bcc[_0x8a84('0x65')]);return _0x5ca8e6[_0x8a84('0x62')](_0x208b01);}})[_0x8a84('0x24')](function(_0x2bf938){if(_0x2bf938){_0x2c7428=_0x2bf938['length'];if(!_0x4a3bcc[_0x8a84('0x42')][_0x8a84('0x4a')](_0x8a84('0x4b'))){_0x208b01[_0x8a84('0x31')]=qs[_0x8a84('0x31')](_0x4a3bcc['query'][_0x8a84('0x31')]);_0x208b01[_0x8a84('0x30')]=qs[_0x8a84('0x30')](_0x4a3bcc[_0x8a84('0x42')]['offset']);}return _0x5ca8e6['getMembers'](_0x208b01);}})[_0x8a84('0x24')](function(_0x1979f6){if(_0x1979f6){return _0x1979f6?{'count':_0x2c7428,'rows':_0x1979f6}:null;}})['then'](respondWithResult(_0x2a5d9f,null))[_0x8a84('0x2d')](handleError(_0x2a5d9f,null));};exports[_0x8a84('0x66')]=function(_0x50fefd,_0x49c5eb,_0x961e35){return db[_0x8a84('0x52')][_0x8a84('0x5b')]({'where':{'id':_0x50fefd[_0x8a84('0x57')]['id']}})[_0x8a84('0x24')](handleEntityNotFound(_0x49c5eb,null))['then'](function(_0x3acdfb){if(_0x3acdfb){return _0x3acdfb[_0x8a84('0x66')](_0x50fefd['query']['ids']);}})['then'](respondWithStatusCode(_0x49c5eb,null))['catch'](handleError(_0x49c5eb,null));};exports[_0x8a84('0x67')]=function(_0x591fe4,_0xb37e89,_0x37ae8f){if(_0x591fe4['body']['id']){delete _0x591fe4[_0x8a84('0x5a')]['id'];}return db['ChatGroup'][_0x8a84('0x5b')]({'where':{'id':_0x591fe4[_0x8a84('0x57')]['id']}})[_0x8a84('0x24')](handleEntityNotFound(_0xb37e89,null))['then'](function(_0x5b3dcb){if(_0x5b3dcb){_0x591fe4[_0x8a84('0x5a')][_0x8a84('0x68')]=_0x5b3dcb['id'];return db[_0x8a84('0x5d')][_0x8a84('0x58')](_0x591fe4[_0x8a84('0x5a')]);}})[_0x8a84('0x24')](respondWithResult(_0xb37e89,null))[_0x8a84('0x2d')](handleError(_0xb37e89,null));};exports['getMessages']=function(_0x3995db,_0x4aa7a6,_0xf9422e){var _0x4336d8={};var _0x15ef64={};var _0x1a8be9;var _0x353bb5;return db['ChatGroup'][_0x8a84('0x63')]({'where':{'id':_0x3995db['params']['id']}})[_0x8a84('0x24')](handleEntityNotFound(_0x4aa7a6,null))[_0x8a84('0x24')](function(_0x3a4e62){if(_0x3a4e62){_0x1a8be9=_0x3a4e62;_0x15ef64[_0x8a84('0x46')]=_['keys'](db[_0x8a84('0x5d')][_0x8a84('0x3d')]);_0x15ef64[_0x8a84('0x42')]=_[_0x8a84('0x43')](_0x3995db[_0x8a84('0x42')]);_0x15ef64['filters']=_[_0x8a84('0x45')](_0x15ef64['model'],_0x15ef64[_0x8a84('0x42')]);_0x4336d8[_0x8a84('0x48')]=_[_0x8a84('0x45')](_0x15ef64[_0x8a84('0x46')],qs[_0x8a84('0x47')](_0x3995db[_0x8a84('0x42')][_0x8a84('0x47')]));_0x4336d8[_0x8a84('0x48')]=_0x4336d8[_0x8a84('0x48')][_0x8a84('0x49')]?_0x4336d8[_0x8a84('0x48')]:_0x15ef64[_0x8a84('0x46')];_0x4336d8[_0x8a84('0x4c')]=qs[_0x8a84('0x4d')](_0x3995db[_0x8a84('0x42')][_0x8a84('0x4d')]);_0x4336d8[_0x8a84('0x4e')]=qs[_0x8a84('0x44')](_[_0x8a84('0x4f')](_0x3995db[_0x8a84('0x42')],_0x15ef64[_0x8a84('0x44')]));if(_0x3995db[_0x8a84('0x42')]['filter']){_0x4336d8[_0x8a84('0x4e')]=_[_0x8a84('0x51')](_0x4336d8[_0x8a84('0x4e')],{'$or':_[_0x8a84('0x41')](_0x4336d8[_0x8a84('0x48')],function(_0x19ccc4){var _0x8730e3={};_0x8730e3[_0x19ccc4]={'$like':'%'+_0x3995db[_0x8a84('0x42')][_0x8a84('0x50')]+'%'};return _0x8730e3;})});}if(_0x3995db[_0x8a84('0x42')][_0x8a84('0x69')]){var _0x1cd699=_0x3995db[_0x8a84('0x42')][_0x8a84('0x69')]['split'](',');var _0x2e1320={};_0x2e1320[_0x1cd699[0x0]]={'$gte':moment(_0x1cd699[0x1])['format'](_0x8a84('0x6a'))};_0x4336d8[_0x8a84('0x4e')]=_[_0x8a84('0x51')](_0x4336d8[_0x8a84('0x4e')],_0x2e1320);}_0x4336d8=_[_0x8a84('0x51')]({},_0x4336d8,_0x3995db[_0x8a84('0x65')]);return _0x1a8be9['getMessages'](_0x4336d8);}})[_0x8a84('0x24')](function(_0x3fb197){if(_0x3fb197){_0x353bb5=_0x3fb197['length'];if(!_0x3995db[_0x8a84('0x42')]['hasOwnProperty'](_0x8a84('0x4b'))){_0x4336d8[_0x8a84('0x31')]=qs['limit'](_0x3995db['query'][_0x8a84('0x31')]);_0x4336d8['offset']=qs[_0x8a84('0x30')](_0x3995db[_0x8a84('0x42')][_0x8a84('0x30')]);}return _0x1a8be9['getMessages'](_0x4336d8);}})[_0x8a84('0x24')](function(_0x53a913){if(_0x53a913){return _0x53a913?{'count':_0x353bb5,'rows':_0x53a913}:null;}})['then'](respondWithResult(_0x4aa7a6,null))['catch'](handleError(_0x4aa7a6,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index b017c0b..d1e75eb 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 _0x2ef3=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','ChatGroup'];(function(_0x2788e5,_0x562bf4){var _0x7b12fd=function(_0x462a59){while(--_0x462a59){_0x2788e5['push'](_0x2788e5['shift']());}};_0x7b12fd(++_0x562bf4);}(_0x2ef3,0xba));var _0x32ef=function(_0x4afde0,_0x17627c){_0x4afde0=_0x4afde0-0x0;var _0x2b7aa6=_0x2ef3[_0x4afde0];return _0x2b7aa6;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var ChatGroup=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x32ef('0x3')](0x0);var events={'afterCreate':_0x32ef('0x4'),'afterUpdate':_0x32ef('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38f865){return function(_0x38b7f3,_0x524ab6,_0x402857){ChatGroupEvents[_0x32ef('0x6')](_0x38f865+':'+_0x38b7f3['id'],_0x38b7f3);ChatGroupEvents['emit'](_0x38f865,_0x38b7f3);_0x402857(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x32ef('0x7')](e,emitEvent(event));}}module[_0x32ef('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x2ef3=['setMaxListeners','save','update','emit','hook','exports','events','../../mysqldb','ChatGroup'];(function(_0x13c625,_0xc65b8e){var _0x1f2506=function(_0x318ccc){while(--_0x318ccc){_0x13c625['push'](_0x13c625['shift']());}};_0x1f2506(++_0xc65b8e);}(_0x2ef3,0xba));var _0x32ef=function(_0x5c11ca,_0x49e68c){_0x5c11ca=_0x5c11ca-0x0;var _0x2c2adc=_0x2ef3[_0x5c11ca];return _0x2c2adc;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var ChatGroup=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x32ef('0x3')](0x0);var events={'afterCreate':_0x32ef('0x4'),'afterUpdate':_0x32ef('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38f865){return function(_0x38b7f3,_0x524ab6,_0x402857){ChatGroupEvents[_0x32ef('0x6')](_0x38f865+':'+_0x38b7f3['id'],_0x38b7f3);ChatGroupEvents['emit'](_0x38f865,_0x38b7f3);_0x402857(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x32ef('0x7')](e,emitEvent(event));}}module[_0x32ef('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index f5fc29f..70f44e4 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 _0xeedf=['exports','define','chat_groups','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xeedf,0x12c));var _0xfeed=function(_0x270e85,_0x3e8000){_0x270e85=_0x270e85-0x0;var _0x47d9a8=_0xeedf[_0x270e85];return _0x47d9a8;};'use strict';var _=require(_0xfeed('0x0'));var util=require(_0xfeed('0x1'));var logger=require(_0xfeed('0x2'))('api');var moment=require(_0xfeed('0x3'));var BPromise=require('bluebird');var rp=require(_0xfeed('0x4'));var fs=require('fs');var path=require(_0xfeed('0x5'));var rimraf=require(_0xfeed('0x6'));var config=require(_0xfeed('0x7'));var attributes=require('./chatGroup.attributes');module[_0xfeed('0x8')]=function(_0x2c211d,_0x5df4fe){return _0x2c211d[_0xfeed('0x9')]('ChatGroup',attributes,{'tableName':_0xfeed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb647=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ChatGroup','chat_groups','lodash','util'];(function(_0x4c1fd8,_0x331322){var _0x9c2caf=function(_0x508452){while(--_0x508452){_0x4c1fd8['push'](_0x4c1fd8['shift']());}};_0x9c2caf(++_0x331322);}(_0xb647,0xdb));var _0x7b64=function(_0x1a697a,_0x8e5f3e){_0x1a697a=_0x1a697a-0x0;var _0x2b8617=_0xb647[_0x1a697a];return _0x2b8617;};'use strict';var _=require(_0x7b64('0x0'));var util=require(_0x7b64('0x1'));var logger=require(_0x7b64('0x2'))(_0x7b64('0x3'));var moment=require(_0x7b64('0x4'));var BPromise=require(_0x7b64('0x5'));var rp=require(_0x7b64('0x6'));var fs=require('fs');var path=require(_0x7b64('0x7'));var rimraf=require('rimraf');var config=require(_0x7b64('0x8'));var attributes=require('./chatGroup.attributes');module[_0x7b64('0x9')]=function(_0x38ebf7,_0x31915b){return _0x38ebf7[_0x7b64('0xa')](_0x7b64('0xb'),attributes,{'tableName':_0x7b64('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 3bec748..9235079 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 _0xfe04=['redis','socket.io-emitter','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xfe04,0x1eb));var _0x4fe0=function(_0x20337c,_0x1cce51){_0x20337c=_0x20337c-0x0;var _0x1bd93e=_0xfe04[_0x20337c];return _0x1bd93e;};'use strict';var _=require(_0x4fe0('0x0'));var util=require('util');var moment=require(_0x4fe0('0x1'));var BPromise=require(_0x4fe0('0x2'));var rs=require(_0x4fe0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4fe0('0x4'))['db'];var utils=require(_0x4fe0('0x5'));var logger=require(_0x4fe0('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4fe0('0x7'));var client=jayson[_0x4fe0('0x8')]['http']({'port':0x232a});config[_0x4fe0('0x9')]=_['defaults'](config[_0x4fe0('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4fe0('0xa'))(new Redis(config[_0x4fe0('0x9')]));require(_0x4fe0('0xb'))['register'](socket);function respondWithRpcPromise(_0x3114e3,_0x5255ca,_0xbbd565){return new BPromise(function(_0x4a60b5,_0x1d533c){return client[_0x4fe0('0xc')](_0x3114e3,_0xbbd565)[_0x4fe0('0xd')](function(_0x2aa745){logger[_0x4fe0('0xe')](_0x4fe0('0xf'),_0x5255ca,_0x4fe0('0x10'));logger[_0x4fe0('0x11')](_0x4fe0('0x12'),_0x5255ca,_0x4fe0('0x10'),JSON[_0x4fe0('0x13')](_0x2aa745));if(_0x2aa745[_0x4fe0('0x14')]){if(_0x2aa745['error'][_0x4fe0('0x15')]===0x1f4){logger[_0x4fe0('0x14')](_0x4fe0('0xf'),_0x5255ca,_0x2aa745['error'][_0x4fe0('0x16')]);return _0x1d533c(_0x2aa745[_0x4fe0('0x14')]['message']);}logger[_0x4fe0('0x14')](_0x4fe0('0xf'),_0x5255ca,_0x2aa745[_0x4fe0('0x14')][_0x4fe0('0x16')]);return _0x4a60b5(_0x2aa745[_0x4fe0('0x14')]['message']);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x5255ca,'request\x20sent');_0x4a60b5(_0x2aa745[_0x4fe0('0x17')][_0x4fe0('0x16')]);}})[_0x4fe0('0x18')](function(_0xe55ba9){logger['error']('ChatGroup,\x20%s,\x20%s',_0x5255ca,_0xe55ba9);_0x1d533c(_0xe55ba9);});});} \ No newline at end of file +var _0x5efe=['jayson/promise','client','redis','./chatGroup.socket','register','request','then','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x270e98,_0x20ab12){var _0x2764b8=function(_0xd80520){while(--_0xd80520){_0x270e98['push'](_0x270e98['shift']());}};_0x2764b8(++_0x20ab12);}(_0x5efe,0x1db));var _0xe5ef=function(_0x248897,_0x1676b6){_0x248897=_0x248897-0x0;var _0x46793c=_0x5efe[_0x248897];return _0x46793c;};'use strict';var _=require(_0xe5ef('0x0'));var util=require(_0xe5ef('0x1'));var moment=require(_0xe5ef('0x2'));var BPromise=require(_0xe5ef('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5ef('0x4'));var db=require(_0xe5ef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe5ef('0x6'))('rpc');var config=require(_0xe5ef('0x7'));var jayson=require(_0xe5ef('0x8'));var client=jayson[_0xe5ef('0x9')]['http']({'port':0x232a});config[_0xe5ef('0xa')]=_['defaults'](config[_0xe5ef('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe5ef('0xa')]));require(_0xe5ef('0xb'))[_0xe5ef('0xc')](socket);function respondWithRpcPromise(_0x564908,_0x45d4c4,_0x3dcafd){return new BPromise(function(_0x3de699,_0x1eb459){return client[_0xe5ef('0xd')](_0x564908,_0x3dcafd)[_0xe5ef('0xe')](function(_0xfdb808){logger['info'](_0xe5ef('0xf'),_0x45d4c4,_0xe5ef('0x10'));logger[_0xe5ef('0x11')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x45d4c4,'request\x20sent',JSON[_0xe5ef('0x12')](_0xfdb808));if(_0xfdb808[_0xe5ef('0x13')]){if(_0xfdb808[_0xe5ef('0x13')]['code']===0x1f4){logger[_0xe5ef('0x13')]('ChatGroup,\x20%s,\x20%s',_0x45d4c4,_0xfdb808[_0xe5ef('0x13')][_0xe5ef('0x14')]);return _0x1eb459(_0xfdb808[_0xe5ef('0x13')][_0xe5ef('0x14')]);}logger[_0xe5ef('0x13')](_0xe5ef('0xf'),_0x45d4c4,_0xfdb808[_0xe5ef('0x13')][_0xe5ef('0x14')]);return _0x3de699(_0xfdb808[_0xe5ef('0x13')]['message']);}else{logger['info'](_0xe5ef('0xf'),_0x45d4c4,_0xe5ef('0x10'));_0x3de699(_0xfdb808[_0xe5ef('0x15')][_0xe5ef('0x14')]);}})[_0xe5ef('0x16')](function(_0x13e3f5){logger['error'](_0xe5ef('0xf'),_0x45d4c4,_0x13e3f5);_0x1eb459(_0x13e3f5);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index aa3dbad..53468f4 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 _0x563f=['removeListener','length','chatGroup:','./chatGroup.events','remove','update','emit'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x563f,0xdc));var _0xf563=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x563f[_0x501510];return _0x1e6ee5;};'use strict';var ChatGroupEvents=require(_0xf563('0x0'));var events=['save',_0xf563('0x1'),_0xf563('0x2')];function createListener(_0x5cfcfc,_0x5a8fca){return function(_0x2b691d){_0x5a8fca[_0xf563('0x3')](_0x5cfcfc,_0x2b691d);};}function removeListener(_0x4b9287,_0x2246fc){return function(){ChatGroupEvents[_0xf563('0x4')](_0x4b9287,_0x2246fc);};}exports['register']=function(_0x203b4c){for(var _0x369fe8=0x0,_0xa14e7c=events[_0xf563('0x5')];_0x369fe8<_0xa14e7c;_0x369fe8++){var _0x126e07=events[_0x369fe8];var _0x381d4a=createListener(_0xf563('0x6')+_0x126e07,_0x203b4c);ChatGroupEvents['on'](_0x126e07,_0x381d4a);}}; \ No newline at end of file +var _0x3601=['update','emit','register','length','chatGroup:','./chatGroup.events','remove'];(function(_0x307c25,_0x4373db){var _0x1593f2=function(_0x21d345){while(--_0x21d345){_0x307c25['push'](_0x307c25['shift']());}};_0x1593f2(++_0x4373db);}(_0x3601,0x83));var _0x1360=function(_0x50e459,_0x11196e){_0x50e459=_0x50e459-0x0;var _0x2e4a07=_0x3601[_0x50e459];return _0x2e4a07;};'use strict';var ChatGroupEvents=require(_0x1360('0x0'));var events=['save',_0x1360('0x1'),_0x1360('0x2')];function createListener(_0x4eaa2c,_0x5705c6){return function(_0x536054){_0x5705c6[_0x1360('0x3')](_0x4eaa2c,_0x536054);};}function removeListener(_0x1b7b04,_0x1bba47){return function(){ChatGroupEvents['removeListener'](_0x1b7b04,_0x1bba47);};}exports[_0x1360('0x4')]=function(_0x2c3b41){for(var _0x45e4de=0x0,_0x1bd78a=events[_0x1360('0x5')];_0x45e4de<_0x1bd78a;_0x45e4de++){var _0x2ad995=events[_0x45e4de];var _0x41602f=createListener(_0x1360('0x6')+_0x2ad995,_0x2c3b41);ChatGroupEvents['on'](_0x2ad995,_0x41602f);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 810c3ac..2e883e2 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 _0x47d6=['/:id','show','getUnread','/:id/members','getMembers','getMessages','post','create','addMembers','addMessage','update','destroy','delete','removeMembers','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','index','/describe'];(function(_0x4f2f43,_0x189566){var _0x538cd2=function(_0x565243){while(--_0x565243){_0x4f2f43['push'](_0x4f2f43['shift']());}};_0x538cd2(++_0x189566);}(_0x47d6,0x91));var _0x647d=function(_0x302d97,_0x4f5a37){_0x302d97=_0x302d97-0x0;var _0x4b434b=_0x47d6[_0x302d97];return _0x4b434b;};'use strict';var multer=require(_0x647d('0x0'));var util=require('util');var path=require(_0x647d('0x1'));var timeout=require(_0x647d('0x2'));var express=require('express');var router=express[_0x647d('0x3')]();var auth=require(_0x647d('0x4'));var interaction=require(_0x647d('0x5'));var config=require('../../config/environment');var controller=require(_0x647d('0x6'));router[_0x647d('0x7')]('/',auth[_0x647d('0x8')](),controller[_0x647d('0x9')]);router[_0x647d('0x7')](_0x647d('0xa'),auth[_0x647d('0x8')](),controller['describe']);router[_0x647d('0x7')](_0x647d('0xb'),auth['isAuthenticated'](),controller[_0x647d('0xc')]);router[_0x647d('0x7')]('/:id/unread',auth[_0x647d('0x8')](),controller[_0x647d('0xd')]);router[_0x647d('0x7')](_0x647d('0xe'),auth['isAuthenticated'](),controller[_0x647d('0xf')]);router[_0x647d('0x7')]('/:id/messages',auth[_0x647d('0x8')](),controller[_0x647d('0x10')]);router[_0x647d('0x11')]('/',auth[_0x647d('0x8')](),controller[_0x647d('0x12')]);router['post']('/:id/members',auth['isAuthenticated'](),controller[_0x647d('0x13')]);router['post']('/:id/messages',auth[_0x647d('0x8')](),controller[_0x647d('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x647d('0x15')]);router['delete']('/:id',auth[_0x647d('0x8')](),controller[_0x647d('0x16')]);router[_0x647d('0x17')](_0x647d('0xe'),auth[_0x647d('0x8')](),controller[_0x647d('0x18')]);module[_0x647d('0x19')]=router; \ No newline at end of file +var _0xb28f=['destroy','removeMembers','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','index','/describe','/:id','show','isAuthenticated','getMembers','getMessages','post','create','/:id/members','addMembers','/:id/messages','addMessage','update','delete'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb28f,0x6f));var _0xfb28=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0xb28f[_0x2ed8f3];return _0x525a55;};'use strict';var multer=require(_0xfb28('0x0'));var util=require(_0xfb28('0x1'));var path=require(_0xfb28('0x2'));var timeout=require(_0xfb28('0x3'));var express=require(_0xfb28('0x4'));var router=express['Router']();var auth=require(_0xfb28('0x5'));var interaction=require(_0xfb28('0x6'));var config=require('../../config/environment');var controller=require(_0xfb28('0x7'));router[_0xfb28('0x8')]('/',auth['isAuthenticated'](),controller[_0xfb28('0x9')]);router[_0xfb28('0x8')](_0xfb28('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xfb28('0x8')](_0xfb28('0xb'),auth['isAuthenticated'](),controller[_0xfb28('0xc')]);router[_0xfb28('0x8')]('/:id/unread',auth['isAuthenticated'](),controller['getUnread']);router[_0xfb28('0x8')]('/:id/members',auth[_0xfb28('0xd')](),controller[_0xfb28('0xe')]);router['get']('/:id/messages',auth[_0xfb28('0xd')](),controller[_0xfb28('0xf')]);router[_0xfb28('0x10')]('/',auth[_0xfb28('0xd')](),controller[_0xfb28('0x11')]);router[_0xfb28('0x10')](_0xfb28('0x12'),auth[_0xfb28('0xd')](),controller[_0xfb28('0x13')]);router['post'](_0xfb28('0x14'),auth[_0xfb28('0xd')](),controller[_0xfb28('0x15')]);router['put'](_0xfb28('0xb'),auth[_0xfb28('0xd')](),controller[_0xfb28('0x16')]);router[_0xfb28('0x17')](_0xfb28('0xb'),auth[_0xfb28('0xd')](),controller[_0xfb28('0x18')]);router[_0xfb28('0x17')](_0xfb28('0x12'),auth[_0xfb28('0xd')](),controller[_0xfb28('0x19')]);module[_0xfb28('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 2b65f9c..bb1de28 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 _0x3e22=['INTEGER','ENUM','star','thumb','DATE','STRING','TEXT','out','sequelize'];(function(_0x167657,_0x4102e5){var _0x2ed3c2=function(_0x49455d){while(--_0x49455d){_0x167657['push'](_0x167657['shift']());}};_0x2ed3c2(++_0x4102e5);}(_0x3e22,0x1ca));var _0x23e2=function(_0xe1fcfb,_0x24fcee){_0xe1fcfb=_0xe1fcfb-0x0;var _0x21528f=_0x3e22[_0xe1fcfb];return _0x21528f;};'use strict';var Sequelize=require(_0x23e2('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x23e2('0x1')]},'ratingType':{'type':Sequelize[_0x23e2('0x2')](_0x23e2('0x3'),_0x23e2('0x4')),'defaultValue':_0x23e2('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x23e2('0x5')]},'disposition':{'type':Sequelize[_0x23e2('0x6')]},'secondDisposition':{'type':Sequelize[_0x23e2('0x6')]},'thirdDisposition':{'type':Sequelize[_0x23e2('0x6')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x23e2('0x6')]},'browserVersion':{'type':Sequelize[_0x23e2('0x6')]},'osName':{'type':Sequelize[_0x23e2('0x6')]},'osVersion':{'type':Sequelize[_0x23e2('0x6')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x23e2('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x23e2('0x7')]},'customerIp':{'type':Sequelize[_0x23e2('0x6')]},'formData':{'type':Sequelize[_0x23e2('0x7')]('long')},'read1stAt':{'type':Sequelize[_0x23e2('0x5')]},'lastMsgAt':{'type':Sequelize[_0x23e2('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x23e2('0x2')]('in',_0x23e2('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x23e2('0x6')]},'customerPort':{'type':Sequelize[_0x23e2('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x23e2('0x7')]}}; \ No newline at end of file +var _0x5d4d=['sequelize','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','DATE','STRING','long','out'];(function(_0x188d31,_0x576e87){var _0x30ed33=function(_0x15f9a5){while(--_0x15f9a5){_0x188d31['push'](_0x188d31['shift']());}};_0x30ed33(++_0x576e87);}(_0x5d4d,0xb4));var _0xd5d4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d4d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd5d4('0x0'));module[_0xd5d4('0x1')]={'closed':{'type':Sequelize[_0xd5d4('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xd5d4('0x3')]},'ratingType':{'type':Sequelize[_0xd5d4('0x4')](_0xd5d4('0x5'),_0xd5d4('0x6')),'defaultValue':_0xd5d4('0x5')},'ratingMessage':{'type':Sequelize[_0xd5d4('0x7')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xd5d4('0x8')]},'disposition':{'type':Sequelize[_0xd5d4('0x9')]},'secondDisposition':{'type':Sequelize[_0xd5d4('0x9')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd5d4('0x9')]},'browserName':{'type':Sequelize[_0xd5d4('0x9')]},'browserVersion':{'type':Sequelize[_0xd5d4('0x9')]},'osName':{'type':Sequelize[_0xd5d4('0x9')]},'osVersion':{'type':Sequelize[_0xd5d4('0x9')]},'deviceModel':{'type':Sequelize[_0xd5d4('0x9')]},'deviceVendor':{'type':Sequelize[_0xd5d4('0x9')]},'deviceType':{'type':Sequelize[_0xd5d4('0x9')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xd5d4('0x9')]},'formData':{'type':Sequelize[_0xd5d4('0x7')](_0xd5d4('0xa'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xd5d4('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xd5d4('0x4')]('in',_0xd5d4('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xd5d4('0x9')]},'customerPort':{'type':Sequelize[_0xd5d4('0x9')]},'vidaooSessionId':{'type':Sequelize[_0xd5d4('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index d646f11..b06036a 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 _0x2a87=['firstName','lastName','renderFile','views','downloadInteraction.html','transcript-','.pdf','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatInteraction.socket','register','jayson/promise','client','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','update','end','stack','name','send','Users','map','fullname','TagIds','forEach','Tags','push','ChatInteraction','rawAttributes','fieldName','type','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','filters','select','field','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','user_has_chat_interactions','left_join','users','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','chat_websites','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','split','ContactId','buildExpression','union','User','UserId','text','start','compact','isEmpty','ChatWebsiteId','where','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','i.id','contactName','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','agent','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','i.ChatWebsiteId\x20IN\x20?','role','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','ChatInteractionId','all','show','params','includeAll','include','merge','options','create','body','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','POST','https://api-vidaoo.xcally.com/api/v1/sessions','follow','ValidationError','join_url','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','attachmentUpload','originalname','basename','filename','file','Attachment','attachmentDownload','closed','Unauthorized','attachId','join','root','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','CmContact','%s%d','System','customer','website_alias','agentAlias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','secret','MailAccount','Smtp','service','host','port','secure','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','omit','ids','getMessages','nolimit','$gte','findAll','rows','pick','includeAgent','addTags','spread','Tag','color','chatInteractionTags:save','removeTags','download','unix','server','files','tmp','attachments','direction','Account','mkdirSync','10px','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Chat','YYYY-MM-DD','Owner','YYYY-MM-DD\x20HH:mm:ss','disposition','browserName','referer','customerIp','customerPort','existsSync','createReadStream','pipe','createWriteStream','out'];(function(_0xda556a,_0x27c0fe){var _0x141697=function(_0x3e621c){while(--_0x3e621c){_0xda556a['push'](_0xda556a['shift']());}};_0x141697(++_0x27c0fe);}(_0x2a87,0x136));var _0x72a8=function(_0x33007f,_0x4b38d2){_0x33007f=_0x33007f-0x0;var _0x10d38c=_0x2a87[_0x33007f];return _0x10d38c;};'use strict';var pdf=require(_0x72a8('0x0'));var emlformat=require(_0x72a8('0x1'));var rimraf=require(_0x72a8('0x2'));var zipdir=require(_0x72a8('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x72a8('0x4'));var BPromise=require(_0x72a8('0x5'));var Mustache=require('mustache');var util=require(_0x72a8('0x6'));var path=require(_0x72a8('0x7'));var sox=require(_0x72a8('0x8'));var csv=require('to-csv');var ejs=require(_0x72a8('0x9'));var fs=require('fs');var _=require(_0x72a8('0xa'));var squel=require(_0x72a8('0xb'));var crypto=require('crypto');var jsforce=require(_0x72a8('0xc'));var deskjs=require(_0x72a8('0xd'));var toCsv=require(_0x72a8('0xe'));var querystring=require(_0x72a8('0xf'));var Papa=require(_0x72a8('0x10'));var Redis=require(_0x72a8('0x11'));var authService=require(_0x72a8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x72a8('0x13'));var hardwareService=require(_0x72a8('0x14'));var logger=require(_0x72a8('0x15'))(_0x72a8('0x16'));var utils=require(_0x72a8('0x17'));var config=require(_0x72a8('0x18'));var licenseUtil=require(_0x72a8('0x19'));var db=require(_0x72a8('0x1a'))['db'];config['redis']=_[_0x72a8('0x1b')](config['redis'],{'host':_0x72a8('0x1c'),'port':0x18eb});var socket=require(_0x72a8('0x1d'))(new Redis(config[_0x72a8('0x1e')]));require(_0x72a8('0x1f'))[_0x72a8('0x20')](socket);var jayson=require(_0x72a8('0x21'));var client=jayson['client']['http']({'port':0x232b});var client9004=jayson[_0x72a8('0x22')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3903dc,_0x52e4d5,_0x2642d0,_0x2cf2eb){return new BPromise(function(_0x55f8bd,_0x44b3c5){var _0x4cc4af=_0x2cf2eb||client;return _0x4cc4af['request'](_0x3903dc,_0x2642d0)[_0x72a8('0x23')](function(_0x3e1b8b){logger['info'](_0x72a8('0x24'),_0x52e4d5,_0x72a8('0x25'));logger['debug'](_0x72a8('0x26'),_0x52e4d5,_0x72a8('0x25'),JSON['stringify'](_0x3e1b8b));if(_0x3e1b8b['error']){if(_0x3e1b8b[_0x72a8('0x27')][_0x72a8('0x28')]===0x1f4){logger['error'](_0x72a8('0x24'),_0x52e4d5,_0x3e1b8b[_0x72a8('0x27')]['message']);return _0x44b3c5(_0x3e1b8b[_0x72a8('0x27')]['message']);}logger[_0x72a8('0x27')](_0x72a8('0x24'),_0x52e4d5,_0x3e1b8b[_0x72a8('0x27')][_0x72a8('0x29')]);return _0x55f8bd(_0x3e1b8b[_0x72a8('0x27')][_0x72a8('0x29')]);}else{logger[_0x72a8('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x52e4d5,_0x72a8('0x25'));_0x55f8bd(_0x3e1b8b['result']['message']);}})[_0x72a8('0x2b')](function(_0x2db648){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x52e4d5,_0x2db648);_0x44b3c5(_0x2db648);});});}function respondWithStatusCode(_0x343f8e,_0x58ea6b){_0x58ea6b=_0x58ea6b||0xcc;return function(_0x43223f){if(_0x43223f){return _0x343f8e[_0x72a8('0x2c')](_0x58ea6b);}return _0x343f8e[_0x72a8('0x2d')](_0x58ea6b)['end']();};}function respondWithResult(_0x31e75e,_0x2c6ce7){_0x2c6ce7=_0x2c6ce7||0xc8;return function(_0x47e4ec){if(_0x47e4ec){return _0x31e75e[_0x72a8('0x2d')](_0x2c6ce7)[_0x72a8('0x2e')](_0x47e4ec);}};}function respondWithFilteredResult(_0x4109a4,_0x125299){return function(_0xb89bee){if(_0xb89bee){var _0x29dc81=_0xb89bee[_0x72a8('0x2f')],_0x599fc4=_0x125299[_0x72a8('0x30')],_0x50cce7=_0x125299[_0x72a8('0x30')]+_0x125299[_0x72a8('0x31')],_0x5e66a6;if(_0x50cce7>=_0x29dc81){_0x50cce7=_0x29dc81;_0x5e66a6=0xc8;}else{_0x5e66a6=0xce;}_0x4109a4[_0x72a8('0x2d')](_0x5e66a6);return _0x4109a4[_0x72a8('0x32')](_0x72a8('0x33'),_0x599fc4+'-'+_0x50cce7+'/'+_0x29dc81)[_0x72a8('0x2e')](_0xb89bee);}return null;};}function patchUpdates(_0x17ae6e){return function(_0x2f38a7){try{jsonpatch['apply'](_0x2f38a7,_0x17ae6e,!![]);}catch(_0x38fced){return BPromise[_0x72a8('0x34')](_0x38fced);}return _0x2f38a7['save']();};}function saveUpdates(_0x23e7f4,_0x103fc4){return function(_0x661f5c){if(_0x661f5c){return _0x661f5c[_0x72a8('0x35')](_0x23e7f4)[_0x72a8('0x23')](function(_0x55f673){return _0x55f673;});}return null;};}function removeEntity(_0xc691c3,_0x210993){return function(_0x512c29){if(_0x512c29){return _0x512c29['destroy']()[_0x72a8('0x23')](function(){_0xc691c3[_0x72a8('0x2d')](0xcc)[_0x72a8('0x36')]();});}};}function handleEntityNotFound(_0x1b67a3,_0x340946){return function(_0x3a61ba){if(!_0x3a61ba){_0x1b67a3['sendStatus'](0x194);}return _0x3a61ba;};}function handleError(_0x42d77d,_0x303cf2){_0x303cf2=_0x303cf2||0x1f4;return function(_0x42e753){logger[_0x72a8('0x27')](_0x42e753[_0x72a8('0x37')]);if(_0x42e753[_0x72a8('0x38')]){delete _0x42e753[_0x72a8('0x38')];}_0x42d77d[_0x72a8('0x2d')](_0x303cf2)[_0x72a8('0x39')](_0x42e753);};}function getInteractionUsers(_0xfcc551,_0x4dfdcc){return new BPromise(function(_0x593d12,_0x41e637){try{if(_0x4dfdcc[_0xfcc551['id']]){_0xfcc551[_0x72a8('0x3a')]=_[_0x72a8('0x3b')](_0x4dfdcc[_0xfcc551['id']],function(_0x1ae475){return{'id':_0x1ae475['id'],'fullname':_0x1ae475[_0x72a8('0x3c')]};});}}catch(_0x53f591){_0x41e637(_0x53f591);}_0x593d12(_0xfcc551);});}function getInteractionTags(_0x3c8fb1,_0x4ded84){return new BPromise(function(_0x74aafe,_0xe87e23){try{if(_0x3c8fb1[_0x72a8('0x3d')]){_0x3c8fb1['Tags']=[];_0x3c8fb1[_0x72a8('0x3d')]['split'](',')[_0x72a8('0x3e')](function(_0x49645d){_0x3c8fb1[_0x72a8('0x3f')][_0x72a8('0x40')](_0x4ded84[_0x49645d]);});}delete _0x3c8fb1[_0x72a8('0x3d')];}catch(_0x256ac1){_0xe87e23(_0x256ac1);}_0x74aafe(_0x3c8fb1);});}function updateChatInteraction(_0x4cd68a,_0x27a9e2,_0x43ea96){return new BPromise(function(_0x29f6e0,_0x3034fa){return getInteractionUsers(_0x4cd68a,_0x43ea96)['then'](function(_0x306a68){return getInteractionTags(_0x306a68,_0x27a9e2);})[_0x72a8('0x23')](function(_0x1c8763){_0x29f6e0(_0x1c8763);})[_0x72a8('0x2b')](function(_0x288658){_0x3034fa(_0x288658);});});}exports['index']=function(_0x6a224f,_0x5da46a){var _0x2e84ba={},_0x5cb237={},_0x33e37c={'count':0x0,'rows':[]};var _0x44dede=_[_0x72a8('0x3b')](db[_0x72a8('0x41')][_0x72a8('0x42')],function(_0x464add){return{'name':_0x464add[_0x72a8('0x43')],'type':_0x464add[_0x72a8('0x44')]['key']};});_0x5cb237['model']=_[_0x72a8('0x3b')](_0x44dede,_0x72a8('0x38'));_0x5cb237[_0x72a8('0x45')]=_[_0x72a8('0x46')](_0x6a224f['query']);_0x5cb237['filters']=_['intersection'](_0x5cb237['model'],_0x5cb237[_0x72a8('0x45')]);_0x2e84ba[_0x72a8('0x47')]=_[_0x72a8('0x48')](_0x5cb237[_0x72a8('0x49')],qs[_0x72a8('0x4a')](_0x6a224f['query'][_0x72a8('0x4a')]));_0x2e84ba['attributes']=_0x2e84ba['attributes'][_0x72a8('0x4b')]?_0x2e84ba[_0x72a8('0x47')]:_0x5cb237[_0x72a8('0x49')];if(!_0x6a224f[_0x72a8('0x45')][_0x72a8('0x4c')]('nolimit')){_0x2e84ba[_0x72a8('0x31')]=qs[_0x72a8('0x31')](_0x6a224f[_0x72a8('0x45')]['limit']);_0x2e84ba[_0x72a8('0x30')]=qs[_0x72a8('0x30')](_0x6a224f[_0x72a8('0x45')][_0x72a8('0x30')]);}_0x2e84ba[_0x72a8('0x4d')]=qs[_0x72a8('0x4e')](_0x6a224f[_0x72a8('0x45')][_0x72a8('0x4e')]);_0x2e84ba['where']=qs['filters'](_['pick'](_0x6a224f[_0x72a8('0x45')],_0x5cb237[_0x72a8('0x4f')]),_0x44dede);var _0x2678a4=[];var _0x417c30=squel[_0x72a8('0x50')]()[_0x72a8('0x51')]('id')['field'](_0x72a8('0x38'))[_0x72a8('0x51')]('color')[_0x72a8('0x52')](_0x72a8('0x53'));var _0x11b041=squel[_0x72a8('0x50')]()[_0x72a8('0x51')](_0x72a8('0x54'))[_0x72a8('0x51')](_0x72a8('0x55'))[_0x72a8('0x51')](_0x72a8('0x56'))[_0x72a8('0x52')](_0x72a8('0x57'),'ui')[_0x72a8('0x58')](_0x72a8('0x59'),'u','u.id\x20=\x20ui.UserId');var _0x43edeb=squel['select']()[_0x72a8('0x52')](_0x72a8('0x5a'),'i')[_0x72a8('0x58')](_0x72a8('0x5b'),'c',_0x72a8('0x5c'))[_0x72a8('0x58')](_0x72a8('0x59'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x72a8('0x5d'),'a','a.id\x20=\x20i.ChatWebsiteId')['left_join'](_0x72a8('0x5e'),'me','me.ChatInteractionId\x20=\x20i.id')[_0x72a8('0x58')](_0x72a8('0x5f'),'it',_0x72a8('0x60'))[_0x72a8('0x58')](_0x72a8('0x53'),'t',_0x72a8('0x61'));var _0x2b841f=squel[_0x72a8('0x62')]();var _0x5379f8=[];var _0xb76a9=squel[_0x72a8('0x62')]();var _0x5d16ff;if(_0x6a224f[_0x72a8('0x45')][_0x72a8('0x63')]){_0x5d16ff=as['parseSearch'](_0x6a224f['query'][_0x72a8('0x63')]);var _0x9f8fed=_0x5d16ff[_0x72a8('0x64')];for(var _0x561e1d=0x0;_0x561e1d<_0x5d16ff[_0x72a8('0x65')]['length'];_0x561e1d++){var _0x1d3f29=_0x5d16ff[_0x72a8('0x65')][_0x561e1d];var _0xac4424='i';var _0xe8f48c=_[_0x72a8('0x66')](_0x44dede,['name',_0x1d3f29[_0x72a8('0x51')]]);if(!_0xe8f48c){switch(_0x1d3f29[_0x72a8('0x51')]){case _0x72a8('0x67'):if(_0x1d3f29[_0x72a8('0x68')]==0x1){_0x43edeb[_0x72a8('0x69')]('`'+_0x1d3f29[_0x72a8('0x51')]+_0x72a8('0x6a'));}else{_0x43edeb[_0x72a8('0x69')]('`'+_0x1d3f29[_0x72a8('0x51')]+_0x72a8('0x6b'));}break;case _0x72a8('0x6c'):if(_0x1d3f29[_0x72a8('0x6d')]===_0x72a8('0x6e')){if(_0x1d3f29[_0x72a8('0x68')][_0x72a8('0x6f')]('\x20')[_0x72a8('0x4b')]>0x1){_0x2b841f[_0x9f8fed]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x1d3f29['value']),null);}else{var _0x2a12e6='%'+_0x1d3f29[_0x72a8('0x68')]+'%';_0x2b841f[_0x9f8fed]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x2a12e6,_0x2a12e6,_0x2a12e6);}}else{_0xe8f48c=_[_0x72a8('0x66')](_0x44dede,[_0x72a8('0x38'),_0x72a8('0x70')]);_0x1d3f29[_0x72a8('0x51')]=_0x72a8('0x70');_0x3fa487=as[_0x72a8('0x71')](_0xac4424,_0xe8f48c[_0x72a8('0x44')],_0x1d3f29);_0x2b841f[_0x9f8fed](_0x3fa487['text'],_0x3fa487[_0x72a8('0x68')]['start'],_0x3fa487['value']['end']);}break;case'Tag':var _0x40f717=_0x1d3f29['value'][_0x72a8('0x6f')](',')[_0x72a8('0x3b')](function(_0x25820d){return Number(_0x25820d);});_0x40f717[_0x72a8('0x3e')](function(_0x531ca4){_0xb76a9['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x531ca4+',%');});_0x5379f8=_[_0x72a8('0x72')](_0x5379f8,_0x40f717);break;case _0x72a8('0x73'):if(_0x1d3f29[_0x72a8('0x6d')]===_0x72a8('0x6e')){_0x2b841f[_0x9f8fed]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x1d3f29[_0x72a8('0x68')]+'%',null);}else{_0xe8f48c=_['find'](_0x44dede,[_0x72a8('0x38'),_0x72a8('0x74')]);_0x1d3f29[_0x72a8('0x51')]=_0x72a8('0x74');_0x3fa487=as[_0x72a8('0x71')](_0xac4424,_0xe8f48c[_0x72a8('0x44')],_0x1d3f29);_0x2b841f[_0x9f8fed](_0x3fa487[_0x72a8('0x75')],_0x3fa487[_0x72a8('0x68')][_0x72a8('0x76')],_0x3fa487[_0x72a8('0x68')][_0x72a8('0x36')]);}break;case'body':_0x3fa487=as['buildExpression']('me',null,_0x1d3f29);_0x2b841f[_0x9f8fed](_0x3fa487['text'],_0x3fa487[_0x72a8('0x68')][_0x72a8('0x76')],_0x3fa487['value'][_0x72a8('0x36')]);break;}}else{var _0x3fa487=as[_0x72a8('0x71')](_0xac4424,_0xe8f48c['type'],_0x1d3f29);_0x2b841f[_0x9f8fed](_0x3fa487['text'],_0x3fa487[_0x72a8('0x68')][_0x72a8('0x76')],_0x3fa487[_0x72a8('0x68')][_0x72a8('0x36')]);}}}else{var _0x2fbfa0=_(_0x6a224f[_0x72a8('0x45')])[_0x72a8('0x46')]()[_0x72a8('0x3b')](function(_0x39837a){return _['some'](_0x44dede,[_0x72a8('0x38'),_0x39837a])?_0x39837a:undefined;})[_0x72a8('0x77')]()['value']();if(!_[_0x72a8('0x78')](_0x2fbfa0)){_0x2fbfa0['forEach'](function(_0x2506a9){if(_0x2506a9===_0x72a8('0x79')){_0x43edeb[_0x72a8('0x7a')]('i.ChatWebsiteId\x20IN\x20?',[]['concat'](_0x6a224f[_0x72a8('0x45')][_0x2506a9]));}else if(_0x2506a9===_0x72a8('0x7b')){var _0x5b741d=JSON[_0x72a8('0x7c')](_0x6a224f[_0x72a8('0x45')][_0x2506a9])['$gte'];var _0x30c6c1=JSON[_0x72a8('0x7c')](_0x6a224f[_0x72a8('0x45')][_0x2506a9])['$lte'];_0x43edeb['where'](_0x72a8('0x7d'),_0x5b741d,_0x30c6c1);}else{if(_0x6a224f[_0x72a8('0x45')][_0x2506a9]===_0x72a8('0x7e')){_0x43edeb[_0x72a8('0x7a')]('i.'+_0x2506a9+'\x20IS\x20NULL');}else{_0x43edeb[_0x72a8('0x7a')]('i.'+_0x2506a9+'\x20=\x20?',_0x6a224f['query'][_0x2506a9]);}}});}if(_0x6a224f[_0x72a8('0x45')][_0x72a8('0x7f')]){if(_0x6a224f[_0x72a8('0x45')][_0x72a8('0x7f')]==0x1){_0x43edeb[_0x72a8('0x69')](_0x72a8('0x80'));}else{_0x43edeb['having'](_0x72a8('0x81'));}}if(_0x6a224f[_0x72a8('0x45')]['tag']){_0x5379f8=_[_0x72a8('0x82')](_0x6a224f[_0x72a8('0x45')]['tag'])?_0x6a224f[_0x72a8('0x45')][_0x72a8('0x83')]:new Array(_0x6a224f[_0x72a8('0x45')][_0x72a8('0x83')]);_0x5379f8['forEach'](function(_0x28d268){_0xb76a9['or'](_0x72a8('0x84'),'%,'+_0x28d268+',%');});}if(_0x6a224f[_0x72a8('0x45')][_0x72a8('0x85')]){var _0x1a103e=_0x6a224f['query'][_0x72a8('0x85')]['replace']('\x5c','\x5c\x5c')[_0x72a8('0x86')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1a103e)){_0x2b841f['or'](_0x72a8('0x87'),_0x1a103e+'%');}else{_0x2b841f['or'](_0x72a8('0x88'),qs[_0x72a8('0x89')](_0x1a103e))['or'](_0x72a8('0x8a'),_0x1a103e+'%');}}}_0x43edeb[_0x72a8('0x7a')](_0x2b841f);_0x43edeb[_0x72a8('0x8b')]('i.id');var _0x51a3a8={'type':db[_0x72a8('0x8c')][_0x72a8('0x8d')]['SELECT'],'raw':!![]};var _0x1f0f07=_0x43edeb[_0x72a8('0x8e')]();_0x1f0f07[_0x72a8('0x51')](_0x72a8('0x8f'));_0x1f0f07[_0x72a8('0x51')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x2e84ba[_0x72a8('0x4d')]){_0x2e84ba['order'][_0x72a8('0x3e')](function(_0x56a44a){var _0x1ebd8a=_0x56a44a[0x0]===_0x72a8('0x90')?_0x56a44a[0x0]:'i.'+_0x56a44a[0x0];_0x43edeb[_0x72a8('0x4d')](_0x1ebd8a,_0x56a44a[0x1]==='DESC'?![]:!![]);});}if(!_[_0x72a8('0x78')](_0x5379f8)){_0x43edeb[_0x72a8('0x69')](_0xb76a9);_0x1f0f07[_0x72a8('0x7a')](_0x72a8('0x91'),_0x5379f8);}BPromise[_0x72a8('0x92')]()[_0x72a8('0x23')](function(){if(!_0x5d16ff){if(_0x6a224f[_0x72a8('0x45')][_0x72a8('0x79')])return;_0x1f0f07[_0x72a8('0x7a')](_0x72a8('0x93'));_0x43edeb[_0x72a8('0x7a')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x6a224f['user']['role']!==_0x72a8('0x94'))return;return _0x6a224f[_0x72a8('0x95')][_0x72a8('0x96')]({'attributes':['id'],'raw':!![]})[_0x72a8('0x23')](function(_0x11c551){if(_[_0x72a8('0x78')](_0x11c551)){_0x1f0f07[_0x72a8('0x7a')](_0x72a8('0x97'));_0x43edeb[_0x72a8('0x7a')](_0x72a8('0x97'));}else{_0x1f0f07['where'](_0x72a8('0x98'),_['map'](_0x11c551,'id'));_0x43edeb[_0x72a8('0x7a')](_0x72a8('0x98'),_['map'](_0x11c551,'id'));}});})['then'](function(){if(_0x6a224f['user'][_0x72a8('0x99')]===_0x72a8('0x94')&&!_0x5d16ff&&!_0x6a224f[_0x72a8('0x45')][_0x72a8('0x79')])return[];return db[_0x72a8('0x9a')][_0x72a8('0x45')](_0x1f0f07[_0x72a8('0x9b')](),_0x51a3a8);})['then'](function(_0x81dcfa){_0x33e37c[_0x72a8('0x2f')]=_0x81dcfa[_0x72a8('0x4b')];if(_0x33e37c[_0x72a8('0x2f')]===0x0)return[];return db[_0x72a8('0x9a')][_0x72a8('0x45')](_0x417c30[_0x72a8('0x9b')](),_0x51a3a8)[_0x72a8('0x23')](function(_0x35d6b7){_0x2678a4=_[_0x72a8('0x9c')](_0x35d6b7,'id');_0x51a3a8=_['merge'](_0x51a3a8,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x6a224f[_0x72a8('0x45')][_0x72a8('0x4a')]){_0x2e84ba[_0x72a8('0x47')][_0x72a8('0x3e')](function(_0x29b539){_0x43edeb[_0x72a8('0x51')]('i.'+_0x29b539);});}else{_0x43edeb[_0x72a8('0x51')](_0x72a8('0x9d'),'unreadMessages');_0x43edeb[_0x72a8('0x51')](_0x72a8('0x9e'),_0x72a8('0x9f'));_0x43edeb['field'](_0x72a8('0xa0'),_0x72a8('0xa1'));_0x43edeb[_0x72a8('0x51')](_0x72a8('0xa2'),_0x72a8('0x90'));_0x43edeb['field']('i.*');_0x43edeb['field'](_0x72a8('0xa3'),'Contact.firstName');_0x43edeb[_0x72a8('0x51')](_0x72a8('0xa4'),_0x72a8('0xa5'));_0x43edeb[_0x72a8('0x51')](_0x72a8('0xa6'),_0x72a8('0xa7'));_0x43edeb['field'](_0x72a8('0xa8'),_0x72a8('0xa9'));_0x43edeb['field'](_0x72a8('0xaa'),_0x72a8('0xab'));_0x43edeb[_0x72a8('0x51')](_0x72a8('0xac'),_0x72a8('0xad'));_0x43edeb[_0x72a8('0x51')](_0x72a8('0xae'),_0x72a8('0xaf'));_0x43edeb[_0x72a8('0x51')](_0x72a8('0xb0'),'Owner.internal');_0x43edeb['field'](_0x72a8('0xb1'),_0x72a8('0x3d'));}if(_0x2e84ba[_0x72a8('0x31')])_0x43edeb[_0x72a8('0x31')](_0x2e84ba[_0x72a8('0x31')]);if(_0x2e84ba[_0x72a8('0x30')])_0x43edeb[_0x72a8('0x30')](_0x2e84ba[_0x72a8('0x30')]);return db[_0x72a8('0x9a')][_0x72a8('0x45')](_0x43edeb['toString'](),_0x51a3a8);})[_0x72a8('0x23')](function(_0x239698){_0x11b041[_0x72a8('0x7a')]('ui.ChatInteractionId\x20IN\x20?',_[_0x72a8('0x3b')](_0x239698,'id'));return db[_0x72a8('0x9a')]['query'](_0x11b041[_0x72a8('0x9b')](),_0x51a3a8)[_0x72a8('0x23')](function(_0x34d2b9){var _0x3fe78f=_[_0x72a8('0xb2')](_0x34d2b9,_0x72a8('0xb3'));var _0x269c9a=[];_0x239698[_0x72a8('0x3e')](function(_0xda50b2){_0x269c9a[_0x72a8('0x40')](updateChatInteraction(_0xda50b2,_0x2678a4,_0x3fe78f));});return BPromise[_0x72a8('0xb4')](_0x269c9a);});});})[_0x72a8('0x23')](function(_0x3bb191){_0x33e37c['rows']=_0x3bb191;return _0x33e37c;})['then'](respondWithFilteredResult(_0x5da46a,_0x2e84ba))['catch'](handleError(_0x5da46a,null));};exports[_0x72a8('0xb5')]=function(_0x25e011,_0x4fc4ba){var _0x1aacf8={'raw':![],'where':{'id':_0x25e011[_0x72a8('0xb6')]['id']}},_0x21795d={};_0x21795d['model']=_[_0x72a8('0x46')](db[_0x72a8('0x41')]['rawAttributes']);_0x21795d[_0x72a8('0x45')]=_[_0x72a8('0x46')](_0x25e011[_0x72a8('0x45')]);_0x21795d[_0x72a8('0x4f')]=_['intersection'](_0x21795d[_0x72a8('0x49')],_0x21795d[_0x72a8('0x45')]);_0x1aacf8['attributes']=_[_0x72a8('0x48')](_0x21795d[_0x72a8('0x49')],qs['fields'](_0x25e011['query'][_0x72a8('0x4a')]));_0x1aacf8[_0x72a8('0x47')]=_0x1aacf8[_0x72a8('0x47')][_0x72a8('0x4b')]?_0x1aacf8[_0x72a8('0x47')]:_0x21795d[_0x72a8('0x49')];if(_0x25e011[_0x72a8('0x45')][_0x72a8('0xb7')]){_0x1aacf8[_0x72a8('0xb8')]=[{'all':!![]}];}_0x1aacf8=_[_0x72a8('0xb9')]({},_0x1aacf8,_0x25e011[_0x72a8('0xba')]);return db[_0x72a8('0x41')][_0x72a8('0x66')](_0x1aacf8)[_0x72a8('0x23')](handleEntityNotFound(_0x4fc4ba,null))['then'](respondWithResult(_0x4fc4ba,null))[_0x72a8('0x2b')](handleError(_0x4fc4ba,null));};exports[_0x72a8('0xbb')]=function(_0x2168aa,_0x227ffa){return db['ChatInteraction']['create'](_0x2168aa[_0x72a8('0xbc')],{})[_0x72a8('0x23')](respondWithResult(_0x227ffa,0xc9))[_0x72a8('0x2b')](handleError(_0x227ffa,null));};exports[_0x72a8('0x35')]=function(_0x40faa2,_0x7c9818){if(_0x40faa2[_0x72a8('0xbc')]['id']){delete _0x40faa2[_0x72a8('0xbc')]['id'];}return db['ChatInteraction'][_0x72a8('0x66')]({'where':{'id':_0x40faa2['params']['id']}})['then'](handleEntityNotFound(_0x7c9818,null))['then'](saveUpdates(_0x40faa2[_0x72a8('0xbc')],null))[_0x72a8('0x23')](respondWithResult(_0x7c9818,null))[_0x72a8('0x2b')](handleError(_0x7c9818,null));};exports[_0x72a8('0xbd')]=function(_0x4ddf50,_0x5b57a9){return db[_0x72a8('0x41')][_0x72a8('0x66')]({'where':{'id':_0x4ddf50[_0x72a8('0xb6')]['id']}})['then'](handleEntityNotFound(_0x5b57a9,null))['then'](removeEntity(_0x5b57a9,null))[_0x72a8('0x2b')](handleError(_0x5b57a9,null));};exports[_0x72a8('0xbe')]=function(_0x146efa,_0x5752b2){return db[_0x72a8('0x41')][_0x72a8('0xbe')]()['then'](respondWithResult(_0x5752b2,null))[_0x72a8('0x2b')](handleError(_0x5752b2,null));};exports[_0x72a8('0xbf')]=function(_0x43181a,_0x4bbf75){var _0x3baf1c=_0x43181a[_0x72a8('0xb6')]['id'];var _0x7500c;var _0x1ee58d;var _0x3345b4;return db[_0x72a8('0x41')][_0x72a8('0xc0')]({'where':{'id':_0x3baf1c}})[_0x72a8('0x23')](function(_0x3dfca0){_0x7500c=_0x3dfca0;return db[_0x72a8('0xc1')]['findOne']({'where':{'id':_0x3dfca0['ChatWebsiteId']},'attributes':['id',_0x72a8('0xc2'),_0x72a8('0xc3')],'raw':!![]});})[_0x72a8('0x23')](function(_0x12b5a2){if(_0x12b5a2&&_0x12b5a2[_0x72a8('0xc2')]&&_0x12b5a2[_0x72a8('0xc3')]){_0x1ee58d=_0x12b5a2;var _0x265b5b={'rejectUnauthorized':![],'method':_0x72a8('0xc4'),'uri':_0x72a8('0xc5'),'headers':{'X-APIKEY':_0x12b5a2[_0x72a8('0xc2')]},'body':{'name':'MotionCWB:'+_0x3baf1c},'redirect':_0x72a8('0xc6'),'json':!![]};return rp(_0x265b5b);}else{throw new db['Sequelize'][(_0x72a8('0xc7'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x72a8('0x23')](function(_0x3d6183){_0x3345b4=_0x3d6183;if(_0x3345b4['id']){var _0x6feaec={'body':_0x3345b4[_0x72a8('0xc8')],'ChatWebsiteId':_0x1ee58d['id'],'ChatInteractionId':_0x7500c['id'],'direction':'out','UserId':_0x43181a[_0x72a8('0x95')]['id']};return db['ChatMessage'][_0x72a8('0xbb')](_0x6feaec,{});}else{throw new db[(_0x72a8('0x8c'))][(_0x72a8('0xc7'))](_0x72a8('0xc9'));}})[_0x72a8('0x23')](function(){return _0x7500c[_0x72a8('0xca')]({'vidaooSessionId':_0x3345b4['id']});})['then'](respondWithResult(_0x4bbf75,null))['catch'](handleError(_0x4bbf75,null));};exports['customUpdate']=function(_0x531f52,_0x3e00b1){if(_0x531f52['body']['id']){delete _0x531f52[_0x72a8('0xbc')]['id'];}return db[_0x72a8('0x41')][_0x72a8('0x66')]({'where':{'id':_0x531f52[_0x72a8('0xb6')]['id']},'include':[{'model':db['CmContact'],'as':_0x72a8('0x6c')}]})[_0x72a8('0x23')](handleEntityNotFound(_0x3e00b1,null))[_0x72a8('0x23')](saveUpdates(_0x531f52['body'],null))['then'](respondWithResult(_0x3e00b1,null))[_0x72a8('0x2b')](handleError(_0x3e00b1,null));};exports[_0x72a8('0xcb')]=function(_0x455977,_0x522ddc,_0x55f259){if(_0x455977[_0x72a8('0xbc')]['id']){delete _0x455977[_0x72a8('0xbc')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x455977[_0x72a8('0xb6')]['id']}})[_0x72a8('0x23')](function(_0x42a731){if(!_0x42a731){logger[_0x72a8('0x27')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x72a8('0xcb'),0x194,_0x72a8('0xcc'));_0x522ddc[_0x72a8('0x2c')](0x194);}else{if(_0x42a731[_0x72a8('0x74')]){throw new db['Sequelize'][(_0x72a8('0xc7'))](_0x72a8('0xcd'));}}return _0x42a731;})[_0x72a8('0x23')](function(_0x988a26){if(_0x988a26){return _0x988a26[_0x72a8('0x35')]({'closed':_0x455977['body']['closed'],'disposition':_0x455977[_0x72a8('0xbc')]['disposition']})[_0x72a8('0x23')](function(_0x3a5d7c){return _0x3a5d7c;});}})[_0x72a8('0x23')](function(_0x3a4f9d){return respondWithRpcPromise('AbandonInteraction','abandon',_0x455977[_0x72a8('0xbc')],client9004);})[_0x72a8('0x23')](respondWithResult(_0x522ddc,null))[_0x72a8('0x2b')](handleError(_0x522ddc,null));};exports[_0x72a8('0xce')]=function(_0x3f00d2,_0x90faa,_0x5b3956){_0x3f00d2[_0x72a8('0xbc')][_0x72a8('0x38')]=_0x3f00d2['file'][_0x72a8('0xcf')];_0x3f00d2['body'][_0x72a8('0xd0')]=_0x3f00d2['file'][_0x72a8('0xd1')];_0x3f00d2[_0x72a8('0xbc')][_0x72a8('0x44')]=_0x3f00d2[_0x72a8('0xd2')]['mimetype'];return db[_0x72a8('0xd3')][_0x72a8('0xbb')](_0x3f00d2[_0x72a8('0xbc')])[_0x72a8('0x23')](respondWithResult(_0x90faa,0xc9))['catch'](handleError(_0x90faa,null));};exports[_0x72a8('0xd4')]=function(_0x5898ff,_0x32dfc7,_0x1ba970){return db[_0x72a8('0x41')][_0x72a8('0xc0')]({'where':{'id':_0x5898ff['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x32dfc7,null))[_0x72a8('0x23')](function(_0x38075b){if(_0x38075b){if(_0x38075b[_0x72a8('0xd5')]){return _0x32dfc7[_0x72a8('0x2d')](0x193)[_0x72a8('0x2e')]({'status':0x193,'message':_0x72a8('0xd6')});}return db[_0x72a8('0xd3')][_0x72a8('0xc0')]({'where':{'id':_0x5898ff[_0x72a8('0x45')][_0x72a8('0xd7')]},'raw':!![]})[_0x72a8('0x23')](handleEntityNotFound(_0x32dfc7,null));}})[_0x72a8('0x23')](function(_0x374827){if(_0x374827){return _0x32dfc7['download'](path[_0x72a8('0xd8')](config[_0x72a8('0xd9')],'server/files/attachments/',_0x374827[_0x72a8('0xd0')]));}})[_0x72a8('0x2b')](handleError(_0x32dfc7,null));};exports['close']=function(_0x4e4200,_0x295d0a){var _0x1167a5=null;var _0x38e34a=null;var _0x455da2=null;var _0x4fe4dc=null;if(_0x4e4200[_0x72a8('0xbc')]['id']){delete _0x4e4200[_0x72a8('0xbc')]['id'];}if(_0x4e4200['body'][_0x72a8('0xda')]){_0x4fe4dc=path[_0x72a8('0xd8')](config[_0x72a8('0xd9')],_0x72a8('0xdb'),util[_0x72a8('0xdc')](_0x72a8('0xdd'),Date[_0x72a8('0xde')]()));_0x4e4200[_0x72a8('0xbc')][_0x72a8('0xdf')]=_0x4fe4dc;}return db['ChatInteraction'][_0x72a8('0x66')]({'where':{'id':_0x4e4200[_0x72a8('0xb6')]['id']},'include':[{'model':db[_0x72a8('0xe0')],'as':_0x72a8('0xe1'),'include':[{'model':db['User'],'as':'User'}]}]})[_0x72a8('0x23')](handleEntityNotFound(_0x295d0a,null))[_0x72a8('0x23')](saveUpdates(_0x4e4200['body'],null))[_0x72a8('0x23')](function(_0x18193b){if(_0x18193b){_0x1167a5=_0x18193b;return db[_0x72a8('0xc1')][_0x72a8('0x66')]({'where':{'id':_0x1167a5['ChatWebsiteId']}});}})[_0x72a8('0x23')](function(_0x3ab27a){if(_0x3ab27a){_0x455da2=_0x3ab27a;return db[_0x72a8('0xe2')][_0x72a8('0x66')]({'where':{'id':_0x1167a5['ContactId']}});}})['then'](function(_0x109666){if(_0x109666){_0x38e34a=_0x109666;if(_0x4fe4dc){var _0x2f31af=null;for(var _0x2f1c23=0x1;_0x2f1c23<_0x1167a5[_0x72a8('0xe1')]['length'];++_0x2f1c23){_0x2f31af=_0x1167a5[_0x72a8('0xe1')][_0x2f1c23];var _0x507f1b=_0x2f31af['UserId']?util[_0x72a8('0xdc')](_0x72a8('0xe3'),_0x455da2['agentAlias'],_0x2f31af[_0x72a8('0x74')]):_0x72a8('0xe4');var _0x4b07e8=_0x4e4200['body'][_0x72a8('0xe5')]||util[_0x72a8('0xdc')](_0x72a8('0xe3'),'Visitor',_0x2f31af[_0x72a8('0x70')]);switch(_0x455da2['agentIdentifier']){case _0x72a8('0xe6'):_0x507f1b=_0x2f31af[_0x72a8('0x74')]?util['format'](_0x72a8('0xe3'),_0x455da2[_0x72a8('0xe7')],_0x2f31af[_0x72a8('0x74')]):_0x72a8('0xe4');break;case _0x72a8('0xe8'):_0x507f1b=_0x2f31af[_0x72a8('0x74')]?_0x2f31af[_0x72a8('0x73')][_0x72a8('0xe9')]||_0x2f31af[_0x72a8('0x73')][_0x72a8('0x3c')]:_0x72a8('0xe4');break;case _0x72a8('0xea'):_0x507f1b=_0x2f31af[_0x72a8('0x74')]?_0x2f31af[_0x72a8('0x73')][_0x72a8('0x3c')]:_0x72a8('0xe4');break;default:_0x507f1b=_0x2f31af[_0x72a8('0x74')]?util[_0x72a8('0xdc')](_0x72a8('0xe3'),_0x455da2[_0x72a8('0xe7')],_0x2f31af['UserId']):_0x72a8('0xe4');}var _0x402720=util[_0x72a8('0xdc')](_0x72a8('0xeb'),moment(_0x2f31af[_0x72a8('0x7b')])[_0x72a8('0xdc')]('MM/DD/YYYY\x20HH:mm:ss'),_0x2f31af['direction']==='in'?_0x4b07e8:_0x507f1b,_0x2f31af[_0x72a8('0xbc')]);if(!_0x2f31af[_0x72a8('0xec')]){fs['appendFileSync'](_0x4fe4dc,_0x402720);}}return db[_0x72a8('0xed')][_0x72a8('0xc0')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x72a8('0xee'),'raw':!![]}]});}}})[_0x72a8('0x23')](function(_0x5b7f4e){if(_0x5b7f4e&&_0x5b7f4e['Smtp']&&_0x4e4200[_0x72a8('0xbc')]){var _0x46efb4={'tls':{'rejectUnauthorized':![]}};if(_0x5b7f4e['Smtp'][_0x72a8('0xef')]){_0x46efb4[_0x72a8('0xef')]=_0x5b7f4e[_0x72a8('0xee')]['service'];}else{_0x46efb4['host']=_0x5b7f4e[_0x72a8('0xee')][_0x72a8('0xf0')];_0x46efb4[_0x72a8('0xf1')]=_0x5b7f4e['Smtp'][_0x72a8('0xf1')];_0x46efb4['secure']=_0x5b7f4e[_0x72a8('0xee')][_0x72a8('0xf2')];}if(_0x5b7f4e[_0x72a8('0xee')]['authentication']){_0x46efb4[_0x72a8('0xf3')]={'user':_0x5b7f4e[_0x72a8('0xee')]['user'],'pass':_0x5b7f4e[_0x72a8('0xee')][_0x72a8('0xf4')]};}return respondWithRpcPromise(_0x72a8('0xf5'),_0x72a8('0xf6'),{'account':_0x46efb4,'message':{'from':util[_0x72a8('0xdc')](_0x72a8('0xf7'),_0x5b7f4e[_0x72a8('0x38')],_0x5b7f4e[_0x72a8('0xf8')]||_0x5b7f4e[_0x72a8('0xee')][_0x72a8('0x95')]),'to':_0x4e4200[_0x72a8('0xbc')]['mailTranscript'],'subject':_0x72a8('0xf9'),'text':util[_0x72a8('0xdc')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x4e4200[_0x72a8('0xbc')][_0x72a8('0xda')]),'attachments':[{'path':_0x4fe4dc}]}})['then'](function(){return _0x1167a5;})[_0x72a8('0x2b')](function(_0x4b724b){console[_0x72a8('0x27')](_0x4b724b);});}else{return _0x1167a5;}})[_0x72a8('0x23')](respondWithStatusCode(_0x295d0a,0xc8))['catch'](handleError(_0x295d0a,null));};exports['addMessage']=function(_0x1f9935,_0x3dfa0c,_0xc88fec){return db[_0x72a8('0xe0')][_0x72a8('0x66')]({'where':{'id':_0x1f9935[_0x72a8('0xb6')]['id']}})[_0x72a8('0x23')](handleEntityNotFound(_0x3dfa0c,null))['then'](function(_0x1b230f){if(_0x1b230f){return _0x1b230f['addMessage'](_0x1f9935[_0x72a8('0xbc')]['ids'],_[_0x72a8('0xfa')](_0x1f9935[_0x72a8('0xbc')],[_0x72a8('0xfb'),'id'])||{});}})[_0x72a8('0x23')](respondWithResult(_0x3dfa0c,null))[_0x72a8('0x2b')](handleError(_0x3dfa0c,null));};exports[_0x72a8('0xfc')]=function(_0x2a036d,_0x5e7bba,_0x45adb8){var _0x24b827={'raw':![],'where':{}};var _0x279124={};var _0x321eb5={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x72a8('0xc0')]({'where':{'id':_0x2a036d[_0x72a8('0xb6')]['id']}})[_0x72a8('0x23')](handleEntityNotFound(_0x5e7bba,null))[_0x72a8('0x23')](function(_0x2c5fee){if(_0x2c5fee){_0x279124[_0x72a8('0x49')]=_['keys'](db[_0x72a8('0xe0')][_0x72a8('0x42')]);_0x279124[_0x72a8('0x45')]=_[_0x72a8('0x46')](_0x2a036d[_0x72a8('0x45')]);_0x279124[_0x72a8('0x4f')]=_[_0x72a8('0x48')](_0x279124['model'],_0x279124[_0x72a8('0x45')]);_0x24b827['attributes']=_['intersection'](_0x279124['model'],qs[_0x72a8('0x4a')](_0x2a036d[_0x72a8('0x45')][_0x72a8('0x4a')]));_0x24b827[_0x72a8('0x47')]=_0x24b827['attributes']['length']?_0x24b827[_0x72a8('0x47')]:_0x279124[_0x72a8('0x49')];if(!_0x2a036d[_0x72a8('0x45')]['hasOwnProperty'](_0x72a8('0xfd'))){_0x24b827[_0x72a8('0x31')]=qs[_0x72a8('0x31')](_0x2a036d[_0x72a8('0x45')][_0x72a8('0x31')]);_0x24b827[_0x72a8('0x30')]=qs[_0x72a8('0x30')](_0x2a036d[_0x72a8('0x45')][_0x72a8('0x30')]);}_0x24b827['order']=qs[_0x72a8('0x4e')](_0x2a036d[_0x72a8('0x45')][_0x72a8('0x4e')]);_0x24b827[_0x72a8('0x7a')]=qs[_0x72a8('0x4f')](_['pick'](_0x2a036d[_0x72a8('0x45')],_0x279124[_0x72a8('0x4f')]));_0x24b827['where'][_0x72a8('0xb3')]=_0x2c5fee['id'];if(_0x2a036d['query'][_0x72a8('0x85')]){_0x24b827['where']=_[_0x72a8('0xb9')](_0x24b827['where'],{'$or':_[_0x72a8('0x3b')](_0x24b827[_0x72a8('0x47')],function(_0x24c3ae){var _0x494f23={};_0x494f23[_0x24c3ae]={'$like':'%'+_0x2a036d[_0x72a8('0x45')][_0x72a8('0x85')]+'%'};return _0x494f23;})});}if(_0x2a036d['query'][_0x72a8('0xfe')]){var _0x486c3a=_0x2a036d['query'][_0x72a8('0xfe')][_0x72a8('0x6f')](',');var _0x16d6f8={};_0x16d6f8[_0x486c3a[0x0]]={'$gte':moment(_0x486c3a[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x24b827[_0x72a8('0x7a')]=_['merge'](_0x24b827[_0x72a8('0x7a')],_0x16d6f8);}_0x24b827=_[_0x72a8('0xb9')]({},_0x24b827,_0x2a036d[_0x72a8('0xba')]);return db[_0x72a8('0xe0')][_0x72a8('0x2f')]({'where':_0x24b827['where']})['then'](function(_0x4be66f){_0x321eb5[_0x72a8('0x2f')]=_0x4be66f;if(_0x2a036d['query'][_0x72a8('0xb7')]){_0x24b827[_0x72a8('0xb8')]=[{'all':!![]}];}return db[_0x72a8('0xe0')][_0x72a8('0xff')](_0x24b827);})[_0x72a8('0x23')](function(_0x262e47){_0x321eb5[_0x72a8('0x100')]=_0x262e47;return _0x321eb5;});}})[_0x72a8('0x23')](respondWithFilteredResult(_0x5e7bba,_0x24b827))[_0x72a8('0x2b')](handleError(_0x5e7bba,null));};exports['getMyMessages']=function(_0x15beb5,_0x37aa41,_0x13afa2){var _0x3bbb8f={'where':{}},_0x6b7243={},_0x239191={'count':0x0,'rows':[]};return db[_0x72a8('0x41')][_0x72a8('0xc0')]({'where':{'id':_0x15beb5[_0x72a8('0xb6')]['id']}})[_0x72a8('0x23')](handleEntityNotFound(_0x37aa41,null))[_0x72a8('0x23')](function(_0x2ea1c5){if(_0x2ea1c5){_0x6b7243['model']=_[_0x72a8('0x46')](db[_0x72a8('0xe0')][_0x72a8('0x42')]);_0x6b7243['query']=_[_0x72a8('0x46')](_0x15beb5['query']);_0x6b7243[_0x72a8('0x4f')]=_['intersection'](_0x6b7243[_0x72a8('0x49')],_0x6b7243[_0x72a8('0x45')]);_0x3bbb8f[_0x72a8('0x47')]=_['intersection'](_0x6b7243[_0x72a8('0x49')],qs['fields'](_0x15beb5[_0x72a8('0x45')][_0x72a8('0x4a')]));_0x3bbb8f[_0x72a8('0x47')]=_0x3bbb8f[_0x72a8('0x47')][_0x72a8('0x4b')]?_0x3bbb8f['attributes']:_0x6b7243[_0x72a8('0x49')];if(!_0x15beb5[_0x72a8('0x45')][_0x72a8('0x4c')](_0x72a8('0xfd'))){_0x3bbb8f[_0x72a8('0x31')]=qs[_0x72a8('0x31')](_0x15beb5[_0x72a8('0x45')][_0x72a8('0x31')]);_0x3bbb8f[_0x72a8('0x30')]=qs[_0x72a8('0x30')](_0x15beb5['query'][_0x72a8('0x30')]);}_0x3bbb8f[_0x72a8('0x4d')]=qs['sort'](_0x15beb5[_0x72a8('0x45')][_0x72a8('0x4e')]);_0x3bbb8f['where']=qs['filters'](_[_0x72a8('0x101')](_0x15beb5['query'],_0x6b7243[_0x72a8('0x4f')]));_0x3bbb8f['where'][_0x72a8('0xb3')]=_0x2ea1c5['id'];if(_0x15beb5[_0x72a8('0x45')][_0x72a8('0x85')]){_0x3bbb8f['where']=_[_0x72a8('0xb9')](_0x3bbb8f[_0x72a8('0x7a')],{'$or':_[_0x72a8('0x3b')](_0x3bbb8f[_0x72a8('0x47')],function(_0x1f3bdf){var _0x53b5be={};_0x53b5be[_0x1f3bdf]={'$like':'%'+_0x15beb5[_0x72a8('0x45')]['filter']+'%'};return _0x53b5be;})});}_0x3bbb8f[_0x72a8('0x7a')]['secret']=![];if(_0x15beb5[_0x72a8('0x45')]['id']){_0x3bbb8f[_0x72a8('0x7a')]['id']={'$gt':_0x15beb5[_0x72a8('0x45')]['id']};}_0x3bbb8f=_['merge']({},_0x3bbb8f,_0x15beb5[_0x72a8('0xba')]);return db['ChatMessage'][_0x72a8('0x2f')]({'where':_0x3bbb8f[_0x72a8('0x7a')]})['then'](function(_0x4bfc31){_0x239191['count']=_0x4bfc31;_0x3bbb8f[_0x72a8('0xb8')]=[];if(_0x15beb5['query'][_0x72a8('0x102')]){_0x3bbb8f[_0x72a8('0xb8')][_0x72a8('0x40')]({'model':db[_0x72a8('0x73')],'as':_0x72a8('0x73'),'attributes':['id',_0x72a8('0x3c'),'alias']});}if(_0x15beb5[_0x72a8('0x45')][_0x72a8('0xb7')]){_0x3bbb8f[_0x72a8('0xb8')]=[{'all':!![]}];}return db[_0x72a8('0xe0')][_0x72a8('0xff')](_0x3bbb8f);})['then'](function(_0x4dacd5){_0x239191[_0x72a8('0x100')]=_0x4dacd5;return _0x239191;});}})[_0x72a8('0x23')](respondWithFilteredResult(_0x37aa41,_0x3bbb8f))[_0x72a8('0x2b')](handleError(_0x37aa41,null));};exports[_0x72a8('0x103')]=function(_0x409d1f,_0x3421af,_0x22d266){return db[_0x72a8('0x41')][_0x72a8('0x66')]({'where':{'id':_0x409d1f[_0x72a8('0xb6')]['id']}})[_0x72a8('0x23')](handleEntityNotFound(_0x3421af,null))['then'](function(_0x3ad554){if(_0x3ad554){return _0x3ad554['setTags'](_0x409d1f[_0x72a8('0xbc')][_0x72a8('0xfb')],_[_0x72a8('0xfa')](_0x409d1f[_0x72a8('0xbc')],[_0x72a8('0xfb'),'id'])||{})[_0x72a8('0x104')](function(){return db[_0x72a8('0x105')][_0x72a8('0xff')]({'attributes':['id',_0x72a8('0x38'),_0x72a8('0x106')],'where':{'id':_0x409d1f[_0x72a8('0xbc')]['ids']}});})['then'](function(_0x366e8f){socket['emit'](_0x72a8('0x107'),{'id':Number(_0x409d1f['params']['id']),'tags':_0x366e8f||[]});return{'id':Number(_0x409d1f['params']['id']),'tags':_0x366e8f||[]};});}})['then'](respondWithResult(_0x3421af,null))[_0x72a8('0x2b')](handleError(_0x3421af,null));};exports[_0x72a8('0x108')]=function(_0x3d1de6,_0x3d3db4,_0x5e1caa){return db[_0x72a8('0x41')][_0x72a8('0x66')]({'where':{'id':_0x3d1de6[_0x72a8('0xb6')]['id']}})[_0x72a8('0x23')](handleEntityNotFound(_0x3d3db4,null))[_0x72a8('0x23')](function(_0x167ce9){if(_0x167ce9){return _0x167ce9['removeTags'](_0x3d1de6[_0x72a8('0x45')][_0x72a8('0xfb')]);}})[_0x72a8('0x23')](respondWithStatusCode(_0x3d3db4,null))[_0x72a8('0x2b')](handleError(_0x3d3db4,null));};exports[_0x72a8('0x109')]=function(_0x103d84,_0x1f1115){var _0x49bcf6=moment()[_0x72a8('0x10a')]()[_0x72a8('0x9b')]();var _0x2175ed=path[_0x72a8('0xd8')](config[_0x72a8('0xd9')],_0x72a8('0x10b'),_0x72a8('0x10c'),_0x72a8('0x10d'));var _0x34a937=path['join'](config['root'],_0x72a8('0x10b'),'files',_0x72a8('0x10e'));var _0x292932=path[_0x72a8('0xd8')](_0x2175ed,_0x49bcf6);var _0x53d3b6=util[_0x72a8('0xdc')]('transcript-%d-%s.zip',_0x103d84[_0x72a8('0xb6')]['id'],_0x49bcf6);var _0x3dc1aa=path[_0x72a8('0xd8')](_0x2175ed,_0x53d3b6);var _0x45fca2=[];_0x45fca2[_0x72a8('0x40')]({'model':db['User'],'as':_0x72a8('0x73'),'attributes':['id',_0x72a8('0x3c')],'raw':!![]});_0x45fca2['push']({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x103d84[_0x72a8('0x45')][_0x72a8('0x10e')]){_0x45fca2[_0x72a8('0x40')]({'model':db['Attachment'],'as':_0x72a8('0xd3'),'raw':!![]});}var _0xbce967=[{'model':db[_0x72a8('0xe0')],'as':_0x72a8('0xe1'),'attributes':['id','body',_0x72a8('0x7b'),_0x72a8('0x10f'),_0x72a8('0xec'),_0x72a8('0x7f')],'include':_0x45fca2}];_0xbce967[_0x72a8('0x40')]({'model':db['ChatWebsite'],'as':_0x72a8('0x110'),'attributes':['id',_0x72a8('0x38')]});_0xbce967[_0x72a8('0x40')]({'model':db['User'],'as':'Owner','attributes':['id',_0x72a8('0x3c')]});return db['ChatInteraction'][_0x72a8('0x66')]({'where':{'id':_0x103d84['params']['id']},'include':_0xbce967})['then'](handleEntityNotFound(_0x1f1115,null))['then'](function(_0x4e99ae){if(_0x4e99ae){var _0x18a8cb=_0x4e99ae['get']({'plain':!![]});fs[_0x72a8('0x111')](_0x292932);var _0x573be={'format':'A4','border':_0x72a8('0x112'),'header':{'height':_0x72a8('0x113'),'contents':{'first':'\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20'}},'footer':{'height':_0x72a8('0x114'),'contents':{'default':util['format'](_0x72a8('0x115'),util[_0x72a8('0xdc')]('%s\x20#%d',_0x72a8('0x116'),_0x18a8cb['id']),moment()[_0x72a8('0xdc')](_0x72a8('0x117'))['toString']())}}};var _0xe8b833={'channel':'Chat','account':_0x18a8cb['Account'][_0x72a8('0x38')],'agent':_0x18a8cb['Owner']?_0x18a8cb[_0x72a8('0x118')][_0x72a8('0x3c')]:'N.A.','createdAt':moment(_0x18a8cb[_0x72a8('0x7b')])[_0x72a8('0xdc')]('YYYY-MM-DD\x20HH:mm:ss')[_0x72a8('0x9b')](),'closedAt':_0x18a8cb[_0x72a8('0xd5')]?moment(_0x18a8cb['closedAt'])[_0x72a8('0xdc')](_0x72a8('0x119'))[_0x72a8('0x9b')]():'','disposition':_0x18a8cb[_0x72a8('0x11a')],'chatInfo':{'browser':_0x18a8cb[_0x72a8('0x11b')],'os':_0x18a8cb['osName'],'referer':_0x18a8cb[_0x72a8('0x11c')],'customerIp':_0x18a8cb[_0x72a8('0x11d')],'customerPort':_0x18a8cb[_0x72a8('0x11e')]?_0x18a8cb['customerPort']:'N.A.'},'messages':_(_0x18a8cb['Messages'])['tail']()[_0x72a8('0x85')]({'secret':![]})[_0x72a8('0x3b')](function(_0x870c2b){if(_0x870c2b['Attachment']){var _0x3eda97=path['join'](_0x34a937,_0x870c2b[_0x72a8('0xd3')]['basename']);if(fs[_0x72a8('0x11f')](_0x3eda97)){fs[_0x72a8('0x120')](_0x3eda97)[_0x72a8('0x121')](fs[_0x72a8('0x122')](path[_0x72a8('0xd8')](_0x292932,_0x870c2b[_0x72a8('0xd3')][_0x72a8('0xd0')])));}}return{'date':moment(_0x870c2b['createdAt'])[_0x72a8('0xdc')](_0x72a8('0x119'))[_0x72a8('0x9b')](),'sender':_0x870c2b[_0x72a8('0x10f')]===_0x72a8('0x123')?_0x870c2b[_0x72a8('0x73')]?_0x870c2b['User'][_0x72a8('0x3c')]:_0x72a8('0xe4'):_0x870c2b[_0x72a8('0x6c')][_0x72a8('0x124')]+(_0x870c2b[_0x72a8('0x6c')][_0x72a8('0x125')]?'\x20'+_0x870c2b[_0x72a8('0x6c')][_0x72a8('0x125')]:''),'body':_0x870c2b[_0x72a8('0xd3')]?_0x870c2b[_0x72a8('0xd3')]['basename']:_0x870c2b[_0x72a8('0xbc')],'direction':_0x870c2b[_0x72a8('0x10f')]==='out'?'A':'C','secret':_0x870c2b[_0x72a8('0xec')],'read':_0x870c2b[_0x72a8('0x7f')],'attachment':_0x870c2b['Attachment']};})[_0x72a8('0x68')]()};return ejs[_0x72a8('0x126')](path[_0x72a8('0xd8')](config[_0x72a8('0xd9')],_0x72a8('0x10b'),_0x72a8('0x127'),_0x72a8('0x128')),{'interaction':_0xe8b833})[_0x72a8('0x23')](function(_0x50e6bf){return new BPromise(function(_0x4a370a,_0x41a4a9){pdf[_0x72a8('0xbb')](_0x50e6bf,_0x573be)['toFile'](path[_0x72a8('0xd8')](_0x292932,_0x72a8('0x129')+_0x18a8cb['id']+'-'+_0x49bcf6+_0x72a8('0x12a')),function(_0x48ca41,_0x50b216){if(_0x48ca41)return _0x41a4a9(_0x48ca41);_0x4a370a(_0x50b216);});});})[_0x72a8('0x23')](function(){return new BPromise(function(_0x4cd2c0,_0x211ffe){zipdir(_0x292932,{'saveTo':_0x3dc1aa},function(_0x52c202,_0x5ca3c8){if(_0x52c202)return _0x211ffe(_0x52c202);return _0x4cd2c0(_0x5ca3c8);});})[_0x72a8('0x23')](function(){return new BPromise(function(_0x2a5968,_0x2f1deb){rimraf(_0x292932,function(_0x20e0b6){if(_0x20e0b6)_0x2f1deb(_0x20e0b6);return _0x2a5968();});});})[_0x72a8('0x23')](function(){return _0x1f1115['download'](_0x3dc1aa,_0x53d3b6,function(_0x4bfc95){if(_0x4bfc95){console['log'](_0x72a8('0x12b'),_0x4bfc95);}else{fs[_0x72a8('0x12c')](_0x3dc1aa);}});});});}else{return _0x1f1115[_0x72a8('0x2c')](0xc8);}})[_0x72a8('0x2b')](handleError(_0x1f1115,null));}; \ No newline at end of file +var _0x08c9=['findOne','vidaooEscalation','vidaooApiKey','POST','https://api-vidaoo.xcally.com/api/v1/sessions','follow','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','updateAttributes','CmContact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','Interaction\x20already\x20assigned','update','disposition','AbandonInteraction','attachmentUpload','originalname','basename','file','filename','mimetype','attachmentDownload','closed','Attachment','attachId','download','join','root','server/files/attachments/','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','agentAlias','System','customer','%s%d','Visitor','agentIdentifier','website_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','pass','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','addMessage','omit','ids','getMessages','hasOwnProperty','pick','ChatInteractionId','$gte','findAll','getMyMessages','includeAgent','addTags','Tag','chatInteractionTags:save','removeTags','unix','server','files','tmp','attachments','transcript-%d-%s.zip','Owner','mkdirSync','10px','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','YYYY-MM-DD','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','browserName','referer','customerPort','tail','createReadStream','pipe','createWriteStream','firstName','lastName','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','request','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','save','then','name','send','Users','fullname','TagIds','Tags','split','forEach','push','index','fieldName','type','key','model','filters','intersection','attributes','fields','query','nolimit','order','sort','where','select','field','color','u.id','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','chat_websites','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','map','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','having','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','agent','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','all','rows','show','params','keys','rawAttributes','includeAll','include','options','ChatInteraction','create','destroy','createVidaooSession','ChatWebsite'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0x08c9,0x75));var _0x908c=function(_0x4a8bad,_0x4bfb2f){_0x4a8bad=_0x4a8bad-0x0;var _0x30cf32=_0x08c9[_0x4a8bad];return _0x30cf32;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x908c('0x0'));var zipdir=require(_0x908c('0x1'));var jsonpatch=require(_0x908c('0x2'));var rp=require(_0x908c('0x3'));var moment=require('moment');var BPromise=require(_0x908c('0x4'));var Mustache=require(_0x908c('0x5'));var util=require(_0x908c('0x6'));var path=require(_0x908c('0x7'));var sox=require(_0x908c('0x8'));var csv=require('to-csv');var ejs=require(_0x908c('0x9'));var fs=require('fs');var _=require(_0x908c('0xa'));var squel=require('squel');var crypto=require(_0x908c('0xb'));var jsforce=require(_0x908c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x908c('0xd'));var querystring=require(_0x908c('0xe'));var Papa=require(_0x908c('0xf'));var Redis=require(_0x908c('0x10'));var authService=require(_0x908c('0x11'));var qs=require(_0x908c('0x12'));var as=require(_0x908c('0x13'));var hardwareService=require(_0x908c('0x14'));var logger=require(_0x908c('0x15'))(_0x908c('0x16'));var utils=require(_0x908c('0x17'));var config=require(_0x908c('0x18'));var licenseUtil=require(_0x908c('0x19'));var db=require(_0x908c('0x1a'))['db'];config[_0x908c('0x1b')]=_[_0x908c('0x1c')](config[_0x908c('0x1b')],{'host':_0x908c('0x1d'),'port':0x18eb});var socket=require(_0x908c('0x1e'))(new Redis(config[_0x908c('0x1b')]));require('./chatInteraction.socket')[_0x908c('0x1f')](socket);var jayson=require(_0x908c('0x20'));var client=jayson['client'][_0x908c('0x21')]({'port':0x232b});var client9004=jayson[_0x908c('0x22')]['http']({'port':0x232c});function respondWithRpcPromise(_0x998d7,_0xb7440c,_0x1c2f86,_0x1f52ad){return new BPromise(function(_0x32bf01,_0x5d32be){var _0x2e4f47=_0x1f52ad||client;return _0x2e4f47[_0x908c('0x23')](_0x998d7,_0x1c2f86)['then'](function(_0x3c8457){logger['info'](_0x908c('0x24'),_0xb7440c,_0x908c('0x25'));logger[_0x908c('0x26')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0xb7440c,'request\x20sent',JSON[_0x908c('0x27')](_0x3c8457));if(_0x3c8457['error']){if(_0x3c8457['error'][_0x908c('0x28')]===0x1f4){logger[_0x908c('0x29')](_0x908c('0x24'),_0xb7440c,_0x3c8457['error'][_0x908c('0x2a')]);return _0x5d32be(_0x3c8457['error'][_0x908c('0x2a')]);}logger[_0x908c('0x29')](_0x908c('0x24'),_0xb7440c,_0x3c8457[_0x908c('0x29')][_0x908c('0x2a')]);return _0x32bf01(_0x3c8457[_0x908c('0x29')][_0x908c('0x2a')]);}else{logger[_0x908c('0x2b')]('ChatInteraction,\x20%s,\x20%s',_0xb7440c,_0x908c('0x25'));_0x32bf01(_0x3c8457[_0x908c('0x2c')][_0x908c('0x2a')]);}})[_0x908c('0x2d')](function(_0x390b51){logger[_0x908c('0x29')](_0x908c('0x24'),_0xb7440c,_0x390b51);_0x5d32be(_0x390b51);});});}function respondWithStatusCode(_0x3135a9,_0x5f0f32){_0x5f0f32=_0x5f0f32||0xcc;return function(_0x4c92ea){if(_0x4c92ea){return _0x3135a9[_0x908c('0x2e')](_0x5f0f32);}return _0x3135a9[_0x908c('0x2f')](_0x5f0f32)[_0x908c('0x30')]();};}function respondWithResult(_0x3d3b90,_0x5c77ee){_0x5c77ee=_0x5c77ee||0xc8;return function(_0x2d3509){if(_0x2d3509){return _0x3d3b90['status'](_0x5c77ee)[_0x908c('0x31')](_0x2d3509);}};}function respondWithFilteredResult(_0x590b5b,_0x5a055a){return function(_0x88f855){if(_0x88f855){var _0x5634f0=_0x88f855[_0x908c('0x32')],_0x37ade8=_0x5a055a[_0x908c('0x33')],_0x106788=_0x5a055a[_0x908c('0x33')]+_0x5a055a[_0x908c('0x34')],_0x3fc1cd;if(_0x106788>=_0x5634f0){_0x106788=_0x5634f0;_0x3fc1cd=0xc8;}else{_0x3fc1cd=0xce;}_0x590b5b[_0x908c('0x2f')](_0x3fc1cd);return _0x590b5b['set']('Content-Range',_0x37ade8+'-'+_0x106788+'/'+_0x5634f0)[_0x908c('0x31')](_0x88f855);}return null;};}function patchUpdates(_0x2048b4){return function(_0x37604c){try{jsonpatch['apply'](_0x37604c,_0x2048b4,!![]);}catch(_0x56a7ea){return BPromise['reject'](_0x56a7ea);}return _0x37604c[_0x908c('0x35')]();};}function saveUpdates(_0x30680a,_0x2ea62d){return function(_0x5f5298){if(_0x5f5298){return _0x5f5298['update'](_0x30680a)[_0x908c('0x36')](function(_0x2f8241){return _0x2f8241;});}return null;};}function removeEntity(_0x571e70,_0x5db500){return function(_0x1f987c){if(_0x1f987c){return _0x1f987c['destroy']()[_0x908c('0x36')](function(){_0x571e70[_0x908c('0x2f')](0xcc)[_0x908c('0x30')]();});}};}function handleEntityNotFound(_0x2d9634,_0x527c61){return function(_0x192a30){if(!_0x192a30){_0x2d9634['sendStatus'](0x194);}return _0x192a30;};}function handleError(_0x5dc54b,_0x5cd376){_0x5cd376=_0x5cd376||0x1f4;return function(_0x3ac6b6){logger['error'](_0x3ac6b6['stack']);if(_0x3ac6b6[_0x908c('0x37')]){delete _0x3ac6b6['name'];}_0x5dc54b[_0x908c('0x2f')](_0x5cd376)[_0x908c('0x38')](_0x3ac6b6);};}function getInteractionUsers(_0x37b612,_0x556c2f){return new BPromise(function(_0x599952,_0x3ae476){try{if(_0x556c2f[_0x37b612['id']]){_0x37b612[_0x908c('0x39')]=_['map'](_0x556c2f[_0x37b612['id']],function(_0x498565){return{'id':_0x498565['id'],'fullname':_0x498565[_0x908c('0x3a')]};});}}catch(_0x43b82f){_0x3ae476(_0x43b82f);}_0x599952(_0x37b612);});}function getInteractionTags(_0x3d8f54,_0x3b2aeb){return new BPromise(function(_0x10efbf,_0x402e41){try{if(_0x3d8f54[_0x908c('0x3b')]){_0x3d8f54[_0x908c('0x3c')]=[];_0x3d8f54[_0x908c('0x3b')][_0x908c('0x3d')](',')[_0x908c('0x3e')](function(_0x4bca3f){_0x3d8f54['Tags'][_0x908c('0x3f')](_0x3b2aeb[_0x4bca3f]);});}delete _0x3d8f54[_0x908c('0x3b')];}catch(_0x1ae8a0){_0x402e41(_0x1ae8a0);}_0x10efbf(_0x3d8f54);});}function updateChatInteraction(_0x52924b,_0x2c080c,_0x10fc08){return new BPromise(function(_0x17ce46,_0x39a419){return getInteractionUsers(_0x52924b,_0x10fc08)[_0x908c('0x36')](function(_0xc02e40){return getInteractionTags(_0xc02e40,_0x2c080c);})['then'](function(_0x5ca211){_0x17ce46(_0x5ca211);})['catch'](function(_0x468d94){_0x39a419(_0x468d94);});});}exports[_0x908c('0x40')]=function(_0x5cb947,_0x10767d){var _0x2961e3={},_0x362dcb={},_0xa22935={'count':0x0,'rows':[]};var _0xd2888b=_['map'](db['ChatInteraction']['rawAttributes'],function(_0x546331){return{'name':_0x546331[_0x908c('0x41')],'type':_0x546331[_0x908c('0x42')][_0x908c('0x43')]};});_0x362dcb[_0x908c('0x44')]=_['map'](_0xd2888b,'name');_0x362dcb['query']=_['keys'](_0x5cb947['query']);_0x362dcb[_0x908c('0x45')]=_[_0x908c('0x46')](_0x362dcb[_0x908c('0x44')],_0x362dcb['query']);_0x2961e3[_0x908c('0x47')]=_[_0x908c('0x46')](_0x362dcb[_0x908c('0x44')],qs[_0x908c('0x48')](_0x5cb947[_0x908c('0x49')][_0x908c('0x48')]));_0x2961e3[_0x908c('0x47')]=_0x2961e3[_0x908c('0x47')]['length']?_0x2961e3[_0x908c('0x47')]:_0x362dcb[_0x908c('0x44')];if(!_0x5cb947[_0x908c('0x49')]['hasOwnProperty'](_0x908c('0x4a'))){_0x2961e3[_0x908c('0x34')]=qs[_0x908c('0x34')](_0x5cb947['query'][_0x908c('0x34')]);_0x2961e3['offset']=qs[_0x908c('0x33')](_0x5cb947[_0x908c('0x49')]['offset']);}_0x2961e3[_0x908c('0x4b')]=qs[_0x908c('0x4c')](_0x5cb947[_0x908c('0x49')]['sort']);_0x2961e3[_0x908c('0x4d')]=qs[_0x908c('0x45')](_['pick'](_0x5cb947[_0x908c('0x49')],_0x362dcb[_0x908c('0x45')]),_0xd2888b);var _0xd2877a=[];var _0x2c476b=squel[_0x908c('0x4e')]()['field']('id')[_0x908c('0x4f')](_0x908c('0x37'))[_0x908c('0x4f')](_0x908c('0x50'))['from']('tools_tags');var _0x4b3611=squel[_0x908c('0x4e')]()[_0x908c('0x4f')](_0x908c('0x51'))['field'](_0x908c('0x52'))[_0x908c('0x4f')](_0x908c('0x53'))[_0x908c('0x54')](_0x908c('0x55'),'ui')['left_join'](_0x908c('0x56'),'u',_0x908c('0x57'));var _0x15ba85=squel[_0x908c('0x4e')]()[_0x908c('0x54')]('chat_interactions','i')[_0x908c('0x58')](_0x908c('0x59'),'c',_0x908c('0x5a'))[_0x908c('0x58')](_0x908c('0x56'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x908c('0x5b'),'a','a.id\x20=\x20i.ChatWebsiteId')['left_join'](_0x908c('0x5c'),'me',_0x908c('0x5d'))['left_join']('chat_interaction_has_tags','it',_0x908c('0x5e'))[_0x908c('0x58')](_0x908c('0x5f'),'t',_0x908c('0x60'));var _0x5cb996=squel[_0x908c('0x61')]();var _0x46d08a=[];var _0x592b3c=squel[_0x908c('0x61')]();var _0x2fb1a3;if(_0x5cb947[_0x908c('0x49')][_0x908c('0x62')]){_0x2fb1a3=as['parseSearch'](_0x5cb947['query']['search']);var _0x41def8=_0x2fb1a3[_0x908c('0x63')];for(var _0x44c10c=0x0;_0x44c10c<_0x2fb1a3[_0x908c('0x64')][_0x908c('0x65')];_0x44c10c++){var _0x2d6d68=_0x2fb1a3[_0x908c('0x64')][_0x44c10c];var _0x2d9ce1='i';var _0x376b27=_[_0x908c('0x66')](_0xd2888b,[_0x908c('0x37'),_0x2d6d68[_0x908c('0x4f')]]);if(!_0x376b27){switch(_0x2d6d68[_0x908c('0x4f')]){case _0x908c('0x67'):if(_0x2d6d68[_0x908c('0x68')]==0x1){_0x15ba85['having']('`'+_0x2d6d68[_0x908c('0x4f')]+_0x908c('0x69'));}else{_0x15ba85['having']('`'+_0x2d6d68[_0x908c('0x4f')]+_0x908c('0x6a'));}break;case _0x908c('0x6b'):if(_0x2d6d68[_0x908c('0x6c')]===_0x908c('0x6d')){if(_0x2d6d68[_0x908c('0x68')][_0x908c('0x3d')]('\x20')[_0x908c('0x65')]>0x1){_0x5cb996[_0x41def8](_0x908c('0x6e'),qs[_0x908c('0x6f')](_0x2d6d68['value']),null);}else{var _0x55aafa='%'+_0x2d6d68[_0x908c('0x68')]+'%';_0x5cb996[_0x41def8](_0x908c('0x70'),_0x55aafa,_0x55aafa,_0x55aafa);}}else{_0x376b27=_[_0x908c('0x66')](_0xd2888b,[_0x908c('0x37'),_0x908c('0x71')]);_0x2d6d68[_0x908c('0x4f')]=_0x908c('0x71');_0x2154c3=as[_0x908c('0x72')](_0x2d9ce1,_0x376b27[_0x908c('0x42')],_0x2d6d68);_0x5cb996[_0x41def8](_0x2154c3['text'],_0x2154c3[_0x908c('0x68')][_0x908c('0x73')],_0x2154c3[_0x908c('0x68')][_0x908c('0x30')]);}break;case'Tag':var _0x3907e1=_0x2d6d68[_0x908c('0x68')]['split'](',')[_0x908c('0x74')](function(_0x2b8014){return Number(_0x2b8014);});_0x3907e1['forEach'](function(_0x5e422d){_0x592b3c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5e422d+',%');});_0x46d08a=_[_0x908c('0x75')](_0x46d08a,_0x3907e1);break;case _0x908c('0x76'):if(_0x2d6d68['operator']==='$substring'){_0x5cb996[_0x41def8](_0x908c('0x77'),'%'+_0x2d6d68[_0x908c('0x68')]+'%',null);}else{_0x376b27=_['find'](_0xd2888b,['name',_0x908c('0x78')]);_0x2d6d68[_0x908c('0x4f')]=_0x908c('0x78');_0x2154c3=as[_0x908c('0x72')](_0x2d9ce1,_0x376b27[_0x908c('0x42')],_0x2d6d68);_0x5cb996[_0x41def8](_0x2154c3[_0x908c('0x79')],_0x2154c3[_0x908c('0x68')][_0x908c('0x73')],_0x2154c3[_0x908c('0x68')][_0x908c('0x30')]);}break;case _0x908c('0x7a'):_0x2154c3=as['buildExpression']('me',null,_0x2d6d68);_0x5cb996[_0x41def8](_0x2154c3[_0x908c('0x79')],_0x2154c3['value'][_0x908c('0x73')],_0x2154c3[_0x908c('0x68')][_0x908c('0x30')]);break;}}else{var _0x2154c3=as[_0x908c('0x72')](_0x2d9ce1,_0x376b27['type'],_0x2d6d68);_0x5cb996[_0x41def8](_0x2154c3[_0x908c('0x79')],_0x2154c3[_0x908c('0x68')][_0x908c('0x73')],_0x2154c3[_0x908c('0x68')][_0x908c('0x30')]);}}}else{var _0x3e6b2d=_(_0x5cb947[_0x908c('0x49')])['keys']()['map'](function(_0x1f104e){return _[_0x908c('0x7b')](_0xd2888b,[_0x908c('0x37'),_0x1f104e])?_0x1f104e:undefined;})[_0x908c('0x7c')]()[_0x908c('0x68')]();if(!_[_0x908c('0x7d')](_0x3e6b2d)){_0x3e6b2d[_0x908c('0x3e')](function(_0x68b1a4){if(_0x68b1a4===_0x908c('0x7e')){_0x15ba85['where'](_0x908c('0x7f'),[][_0x908c('0x80')](_0x5cb947[_0x908c('0x49')][_0x68b1a4]));}else if(_0x68b1a4===_0x908c('0x81')){var _0x8818f3=JSON['parse'](_0x5cb947[_0x908c('0x49')][_0x68b1a4])['$gte'];var _0x53d768=JSON[_0x908c('0x82')](_0x5cb947[_0x908c('0x49')][_0x68b1a4])[_0x908c('0x83')];_0x15ba85['where'](_0x908c('0x84'),_0x8818f3,_0x53d768);}else{if(_0x5cb947[_0x908c('0x49')][_0x68b1a4]===_0x908c('0x85')){_0x15ba85[_0x908c('0x4d')]('i.'+_0x68b1a4+_0x908c('0x86'));}else{_0x15ba85[_0x908c('0x4d')]('i.'+_0x68b1a4+'\x20=\x20?',_0x5cb947[_0x908c('0x49')][_0x68b1a4]);}}});}if(_0x5cb947[_0x908c('0x49')]['read']){if(_0x5cb947[_0x908c('0x49')][_0x908c('0x87')]==0x1){_0x15ba85[_0x908c('0x88')](_0x908c('0x89'));}else{_0x15ba85[_0x908c('0x88')](_0x908c('0x8a'));}}if(_0x5cb947[_0x908c('0x49')]['tag']){_0x46d08a=_['isArray'](_0x5cb947[_0x908c('0x49')][_0x908c('0x8b')])?_0x5cb947['query'][_0x908c('0x8b')]:new Array(_0x5cb947[_0x908c('0x49')][_0x908c('0x8b')]);_0x46d08a[_0x908c('0x3e')](function(_0x2a40f2){_0x592b3c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2a40f2+',%');});}if(_0x5cb947['query'][_0x908c('0x8c')]){var _0x3677d3=_0x5cb947['query']['filter'][_0x908c('0x8d')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x908c('0x8e')](_0x3677d3)){_0x5cb996['or'](_0x908c('0x8f'),_0x3677d3+'%');}else{_0x5cb996['or'](_0x908c('0x90'),qs[_0x908c('0x6f')](_0x3677d3))['or'](_0x908c('0x91'),_0x3677d3+'%');}}}_0x15ba85[_0x908c('0x4d')](_0x5cb996);_0x15ba85[_0x908c('0x92')](_0x908c('0x93'));var _0x48b65f={'type':db[_0x908c('0x94')][_0x908c('0x95')][_0x908c('0x96')],'raw':!![]};var _0x565213=_0x15ba85[_0x908c('0x97')]();_0x565213[_0x908c('0x4f')](_0x908c('0x93'));_0x565213['field'](_0x908c('0x98'),_0x908c('0x67'));if(_0x2961e3[_0x908c('0x4b')]){_0x2961e3[_0x908c('0x4b')][_0x908c('0x3e')](function(_0x1a101f){var _0xb6e0d5=_0x1a101f[0x0]===_0x908c('0x99')?_0x1a101f[0x0]:'i.'+_0x1a101f[0x0];_0x15ba85[_0x908c('0x4b')](_0xb6e0d5,_0x1a101f[0x1]===_0x908c('0x9a')?![]:!![]);});}if(!_['isEmpty'](_0x46d08a)){_0x15ba85['having'](_0x592b3c);_0x565213['where']('t.id\x20IN\x20?',_0x46d08a);}BPromise[_0x908c('0x9b')]()[_0x908c('0x36')](function(){if(!_0x2fb1a3){if(_0x5cb947[_0x908c('0x49')][_0x908c('0x7e')])return;_0x565213[_0x908c('0x4d')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x15ba85['where'](_0x908c('0x9c'));return;}if(_0x5cb947[_0x908c('0x9d')]['role']!==_0x908c('0x9e'))return;return _0x5cb947['user']['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0x908c('0x36')](function(_0x30c51e){if(_['isEmpty'](_0x30c51e)){_0x565213[_0x908c('0x4d')](_0x908c('0x9f'));_0x15ba85[_0x908c('0x4d')](_0x908c('0x9f'));}else{_0x565213['where'](_0x908c('0x7f'),_['map'](_0x30c51e,'id'));_0x15ba85[_0x908c('0x4d')](_0x908c('0x7f'),_[_0x908c('0x74')](_0x30c51e,'id'));}});})[_0x908c('0x36')](function(){if(_0x5cb947['user']['role']==='agent'&&!_0x2fb1a3&&!_0x5cb947[_0x908c('0x49')][_0x908c('0x7e')])return[];return db[_0x908c('0xa0')]['query'](_0x565213[_0x908c('0xa1')](),_0x48b65f);})[_0x908c('0x36')](function(_0x1ff4cf){_0xa22935[_0x908c('0x32')]=_0x1ff4cf[_0x908c('0x65')];if(_0xa22935['count']===0x0)return[];return db[_0x908c('0xa0')]['query'](_0x2c476b[_0x908c('0xa1')](),_0x48b65f)[_0x908c('0x36')](function(_0x2b45a4){_0xd2877a=_[_0x908c('0xa2')](_0x2b45a4,'id');_0x48b65f=_[_0x908c('0xa3')](_0x48b65f,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5cb947[_0x908c('0x49')][_0x908c('0x48')]){_0x2961e3[_0x908c('0x47')]['forEach'](function(_0x3454d5){_0x15ba85[_0x908c('0x4f')]('i.'+_0x3454d5);});}else{_0x15ba85[_0x908c('0x4f')](_0x908c('0x98'),_0x908c('0x67'));_0x15ba85[_0x908c('0x4f')](_0x908c('0xa4'),_0x908c('0xa5'));_0x15ba85[_0x908c('0x4f')](_0x908c('0xa6'),_0x908c('0xa7'));_0x15ba85[_0x908c('0x4f')](_0x908c('0xa8'),_0x908c('0x99'));_0x15ba85[_0x908c('0x4f')](_0x908c('0xa9'));_0x15ba85['field'](_0x908c('0xaa'),'Contact.firstName');_0x15ba85[_0x908c('0x4f')](_0x908c('0xab'),_0x908c('0xac'));_0x15ba85[_0x908c('0x4f')](_0x908c('0xad'),_0x908c('0xae'));_0x15ba85['field'](_0x908c('0xaf'),_0x908c('0xb0'));_0x15ba85[_0x908c('0x4f')](_0x908c('0xb1'),'Contact.mobile');_0x15ba85[_0x908c('0x4f')](_0x908c('0xb2'),'Contact.fax');_0x15ba85[_0x908c('0x4f')](_0x908c('0xb3'),_0x908c('0xb4'));_0x15ba85[_0x908c('0x4f')](_0x908c('0xb5'),_0x908c('0xb6'));_0x15ba85[_0x908c('0x4f')](_0x908c('0xb7'),_0x908c('0x3b'));}if(_0x2961e3[_0x908c('0x34')])_0x15ba85[_0x908c('0x34')](_0x2961e3[_0x908c('0x34')]);if(_0x2961e3['offset'])_0x15ba85[_0x908c('0x33')](_0x2961e3['offset']);return db[_0x908c('0xa0')][_0x908c('0x49')](_0x15ba85[_0x908c('0xa1')](),_0x48b65f);})[_0x908c('0x36')](function(_0x48de15){_0x4b3611[_0x908c('0x4d')]('ui.ChatInteractionId\x20IN\x20?',_[_0x908c('0x74')](_0x48de15,'id'));return db['sequelize']['query'](_0x4b3611[_0x908c('0xa1')](),_0x48b65f)[_0x908c('0x36')](function(_0x5e68a1){var _0x18153b=_[_0x908c('0xb8')](_0x5e68a1,'ChatInteractionId');var _0x1d811f=[];_0x48de15[_0x908c('0x3e')](function(_0x256741){_0x1d811f[_0x908c('0x3f')](updateChatInteraction(_0x256741,_0xd2877a,_0x18153b));});return BPromise[_0x908c('0xb9')](_0x1d811f);});});})['then'](function(_0x29dc22){_0xa22935[_0x908c('0xba')]=_0x29dc22;return _0xa22935;})['then'](respondWithFilteredResult(_0x10767d,_0x2961e3))[_0x908c('0x2d')](handleError(_0x10767d,null));};exports[_0x908c('0xbb')]=function(_0x18a210,_0x132a85){var _0x13a349={'raw':![],'where':{'id':_0x18a210[_0x908c('0xbc')]['id']}},_0x41368d={};_0x41368d[_0x908c('0x44')]=_[_0x908c('0xbd')](db['ChatInteraction'][_0x908c('0xbe')]);_0x41368d[_0x908c('0x49')]=_['keys'](_0x18a210[_0x908c('0x49')]);_0x41368d[_0x908c('0x45')]=_[_0x908c('0x46')](_0x41368d[_0x908c('0x44')],_0x41368d['query']);_0x13a349[_0x908c('0x47')]=_[_0x908c('0x46')](_0x41368d['model'],qs[_0x908c('0x48')](_0x18a210['query']['fields']));_0x13a349[_0x908c('0x47')]=_0x13a349['attributes'][_0x908c('0x65')]?_0x13a349[_0x908c('0x47')]:_0x41368d[_0x908c('0x44')];if(_0x18a210[_0x908c('0x49')][_0x908c('0xbf')]){_0x13a349[_0x908c('0xc0')]=[{'all':!![]}];}_0x13a349=_[_0x908c('0xa3')]({},_0x13a349,_0x18a210[_0x908c('0xc1')]);return db['ChatInteraction'][_0x908c('0x66')](_0x13a349)[_0x908c('0x36')](handleEntityNotFound(_0x132a85,null))[_0x908c('0x36')](respondWithResult(_0x132a85,null))[_0x908c('0x2d')](handleError(_0x132a85,null));};exports['create']=function(_0x5c2e3a,_0x4393b6){return db[_0x908c('0xc2')][_0x908c('0xc3')](_0x5c2e3a[_0x908c('0x7a')],{})['then'](respondWithResult(_0x4393b6,0xc9))['catch'](handleError(_0x4393b6,null));};exports['update']=function(_0x2702f2,_0x4ae31f){if(_0x2702f2[_0x908c('0x7a')]['id']){delete _0x2702f2[_0x908c('0x7a')]['id'];}return db[_0x908c('0xc2')][_0x908c('0x66')]({'where':{'id':_0x2702f2[_0x908c('0xbc')]['id']}})[_0x908c('0x36')](handleEntityNotFound(_0x4ae31f,null))['then'](saveUpdates(_0x2702f2[_0x908c('0x7a')],null))[_0x908c('0x36')](respondWithResult(_0x4ae31f,null))[_0x908c('0x2d')](handleError(_0x4ae31f,null));};exports[_0x908c('0xc4')]=function(_0x29c458,_0x38173e){return db[_0x908c('0xc2')][_0x908c('0x66')]({'where':{'id':_0x29c458['params']['id']}})['then'](handleEntityNotFound(_0x38173e,null))[_0x908c('0x36')](removeEntity(_0x38173e,null))[_0x908c('0x2d')](handleError(_0x38173e,null));};exports['describe']=function(_0x2092de,_0x37aa0d){return db[_0x908c('0xc2')]['describe']()['then'](respondWithResult(_0x37aa0d,null))[_0x908c('0x2d')](handleError(_0x37aa0d,null));};exports[_0x908c('0xc5')]=function(_0x216988,_0x5e9021){var _0xaa4c3=_0x216988['params']['id'];var _0x527b7a;var _0xba5352;var _0x4bb378;return db['ChatInteraction']['findOne']({'where':{'id':_0xaa4c3}})['then'](function(_0x4927b0){_0x527b7a=_0x4927b0;return db[_0x908c('0xc6')][_0x908c('0xc7')]({'where':{'id':_0x4927b0[_0x908c('0x7e')]},'attributes':['id','vidaooApiKey',_0x908c('0xc8')],'raw':!![]});})[_0x908c('0x36')](function(_0x3900ac){if(_0x3900ac&&_0x3900ac[_0x908c('0xc9')]&&_0x3900ac[_0x908c('0xc8')]){_0xba5352=_0x3900ac;var _0x1dc4cc={'rejectUnauthorized':![],'method':_0x908c('0xca'),'uri':_0x908c('0xcb'),'headers':{'X-APIKEY':_0x3900ac[_0x908c('0xc9')]},'body':{'name':'MotionCWB:'+_0xaa4c3},'redirect':_0x908c('0xcc'),'json':!![]};return rp(_0x1dc4cc);}else{throw new db[(_0x908c('0x94'))][(_0x908c('0xcd'))](_0x908c('0xce'));}})['then'](function(_0xf67e72){_0x4bb378=_0xf67e72;if(_0x4bb378['id']){var _0x3622df={'body':_0x4bb378[_0x908c('0xcf')],'ChatWebsiteId':_0xba5352['id'],'ChatInteractionId':_0x527b7a['id'],'direction':_0x908c('0xd0'),'UserId':_0x216988[_0x908c('0x9d')]['id']};return db[_0x908c('0xd1')][_0x908c('0xc3')](_0x3622df,{});}else{throw new db[(_0x908c('0x94'))]['ValidationError']('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x527b7a[_0x908c('0xd2')]({'vidaooSessionId':_0x4bb378['id']});})['then'](respondWithResult(_0x5e9021,null))['catch'](handleError(_0x5e9021,null));};exports['customUpdate']=function(_0x12f07c,_0x2b0de7){if(_0x12f07c[_0x908c('0x7a')]['id']){delete _0x12f07c[_0x908c('0x7a')]['id'];}return db['ChatInteraction'][_0x908c('0x66')]({'where':{'id':_0x12f07c[_0x908c('0xbc')]['id']},'include':[{'model':db[_0x908c('0xd3')],'as':_0x908c('0x6b')}]})[_0x908c('0x36')](handleEntityNotFound(_0x2b0de7,null))[_0x908c('0x36')](saveUpdates(_0x12f07c[_0x908c('0x7a')],null))[_0x908c('0x36')](respondWithResult(_0x2b0de7,null))[_0x908c('0x2d')](handleError(_0x2b0de7,null));};exports['abandon']=function(_0xb0d833,_0x2fef27,_0xf04a61){if(_0xb0d833[_0x908c('0x7a')]['id']){delete _0xb0d833[_0x908c('0x7a')]['id'];}return db[_0x908c('0xc2')][_0x908c('0x66')]({'where':{'id':_0xb0d833[_0x908c('0xbc')]['id']}})[_0x908c('0x36')](function(_0x39711c){if(!_0x39711c){logger['error'](_0x908c('0xd4'),_0x908c('0xd5'),0x194,'entity\x20not\x20found');_0x2fef27[_0x908c('0x2e')](0x194);}else{if(_0x39711c['UserId']){throw new db[(_0x908c('0x94'))][(_0x908c('0xcd'))](_0x908c('0xd6'));}}return _0x39711c;})[_0x908c('0x36')](function(_0x33a105){if(_0x33a105){return _0x33a105[_0x908c('0xd7')]({'closed':_0xb0d833['body']['closed'],'disposition':_0xb0d833['body'][_0x908c('0xd8')]})[_0x908c('0x36')](function(_0x28d80a){return _0x28d80a;});}})[_0x908c('0x36')](function(_0x4399f0){return respondWithRpcPromise(_0x908c('0xd9'),_0x908c('0xd5'),_0xb0d833['body'],client9004);})[_0x908c('0x36')](respondWithResult(_0x2fef27,null))[_0x908c('0x2d')](handleError(_0x2fef27,null));};exports[_0x908c('0xda')]=function(_0x19b865,_0x256c64,_0x1ac8f1){_0x19b865['body'][_0x908c('0x37')]=_0x19b865['file'][_0x908c('0xdb')];_0x19b865[_0x908c('0x7a')][_0x908c('0xdc')]=_0x19b865[_0x908c('0xdd')][_0x908c('0xde')];_0x19b865[_0x908c('0x7a')]['type']=_0x19b865[_0x908c('0xdd')][_0x908c('0xdf')];return db['Attachment'][_0x908c('0xc3')](_0x19b865['body'])['then'](respondWithResult(_0x256c64,0xc9))['catch'](handleError(_0x256c64,null));};exports[_0x908c('0xe0')]=function(_0xc95693,_0x5e4727,_0x31cd8b){return db['ChatInteraction']['findOne']({'where':{'id':_0xc95693[_0x908c('0xbc')]['id']},'raw':!![]})[_0x908c('0x36')](handleEntityNotFound(_0x5e4727,null))[_0x908c('0x36')](function(_0x207eb4){if(_0x207eb4){if(_0x207eb4[_0x908c('0xe1')]){return _0x5e4727['status'](0x193)[_0x908c('0x31')]({'status':0x193,'message':'Unauthorized'});}return db[_0x908c('0xe2')]['findOne']({'where':{'id':_0xc95693['query'][_0x908c('0xe3')]},'raw':!![]})[_0x908c('0x36')](handleEntityNotFound(_0x5e4727,null));}})[_0x908c('0x36')](function(_0x22bc53){if(_0x22bc53){return _0x5e4727[_0x908c('0xe4')](path[_0x908c('0xe5')](config[_0x908c('0xe6')],_0x908c('0xe7'),_0x22bc53[_0x908c('0xdc')]));}})[_0x908c('0x2d')](handleError(_0x5e4727,null));};exports[_0x908c('0xe8')]=function(_0x5569ea,_0x23be91){var _0x31a6a5=null;var _0x4bf9e5=null;var _0xb0d2b3=null;var _0x1c4dab=null;if(_0x5569ea[_0x908c('0x7a')]['id']){delete _0x5569ea[_0x908c('0x7a')]['id'];}if(_0x5569ea[_0x908c('0x7a')][_0x908c('0xe9')]){_0x1c4dab=path[_0x908c('0xe5')](config[_0x908c('0xe6')],_0x908c('0xea'),util[_0x908c('0xeb')](_0x908c('0xec'),Date[_0x908c('0xed')]()));_0x5569ea[_0x908c('0x7a')][_0x908c('0xee')]=_0x1c4dab;}return db[_0x908c('0xc2')][_0x908c('0x66')]({'where':{'id':_0x5569ea[_0x908c('0xbc')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0x908c('0x76')],'as':_0x908c('0x76')}]}]})[_0x908c('0x36')](handleEntityNotFound(_0x23be91,null))[_0x908c('0x36')](saveUpdates(_0x5569ea['body'],null))[_0x908c('0x36')](function(_0x107728){if(_0x107728){_0x31a6a5=_0x107728;return db[_0x908c('0xc6')][_0x908c('0x66')]({'where':{'id':_0x31a6a5['ChatWebsiteId']}});}})[_0x908c('0x36')](function(_0x126028){if(_0x126028){_0xb0d2b3=_0x126028;return db[_0x908c('0xd3')][_0x908c('0x66')]({'where':{'id':_0x31a6a5[_0x908c('0x71')]}});}})[_0x908c('0x36')](function(_0x3df679){if(_0x3df679){_0x4bf9e5=_0x3df679;if(_0x1c4dab){var _0x1ea3e5=null;for(var _0x5d51f2=0x1;_0x5d51f2<_0x31a6a5['Messages'][_0x908c('0x65')];++_0x5d51f2){_0x1ea3e5=_0x31a6a5[_0x908c('0xef')][_0x5d51f2];var _0x110d3b=_0x1ea3e5[_0x908c('0x78')]?util[_0x908c('0xeb')]('%s%d',_0xb0d2b3[_0x908c('0xf0')],_0x1ea3e5[_0x908c('0x78')]):_0x908c('0xf1');var _0x118eb0=_0x5569ea['body'][_0x908c('0xf2')]||util[_0x908c('0xeb')](_0x908c('0xf3'),_0x908c('0xf4'),_0x1ea3e5[_0x908c('0x71')]);switch(_0xb0d2b3[_0x908c('0xf5')]){case _0x908c('0xf6'):_0x110d3b=_0x1ea3e5[_0x908c('0x78')]?util['format']('%s%d',_0xb0d2b3['agentAlias'],_0x1ea3e5['UserId']):'System';break;case'agent_alias':_0x110d3b=_0x1ea3e5['UserId']?_0x1ea3e5['User'][_0x908c('0xf7')]||_0x1ea3e5[_0x908c('0x76')][_0x908c('0x3a')]:_0x908c('0xf1');break;case _0x908c('0xf8'):_0x110d3b=_0x1ea3e5[_0x908c('0x78')]?_0x1ea3e5['User'][_0x908c('0x3a')]:'System';break;default:_0x110d3b=_0x1ea3e5['UserId']?util[_0x908c('0xeb')]('%s%d',_0xb0d2b3['agentAlias'],_0x1ea3e5[_0x908c('0x78')]):_0x908c('0xf1');}var _0x69b8af=util[_0x908c('0xeb')](_0x908c('0xf9'),moment(_0x1ea3e5['createdAt'])[_0x908c('0xeb')]('MM/DD/YYYY\x20HH:mm:ss'),_0x1ea3e5[_0x908c('0xfa')]==='in'?_0x118eb0:_0x110d3b,_0x1ea3e5[_0x908c('0x7a')]);if(!_0x1ea3e5[_0x908c('0xfb')]){fs[_0x908c('0xfc')](_0x1c4dab,_0x69b8af);}}return db[_0x908c('0xfd')][_0x908c('0xc7')]({'where':{'service':!![]},'include':[{'model':db[_0x908c('0xfe')],'as':'Smtp','raw':!![]}]});}}})['then'](function(_0x3ede9c){if(_0x3ede9c&&_0x3ede9c[_0x908c('0xff')]&&_0x5569ea[_0x908c('0x7a')]){var _0x14531d={'tls':{'rejectUnauthorized':![]}};if(_0x3ede9c[_0x908c('0xff')]['service']){_0x14531d[_0x908c('0x100')]=_0x3ede9c[_0x908c('0xff')][_0x908c('0x100')];}else{_0x14531d[_0x908c('0x101')]=_0x3ede9c['Smtp'][_0x908c('0x101')];_0x14531d[_0x908c('0x102')]=_0x3ede9c[_0x908c('0xff')][_0x908c('0x102')];_0x14531d[_0x908c('0x103')]=_0x3ede9c[_0x908c('0xff')]['secure'];}if(_0x3ede9c[_0x908c('0xff')][_0x908c('0x104')]){_0x14531d['auth']={'user':_0x3ede9c[_0x908c('0xff')]['user'],'pass':_0x3ede9c['Smtp'][_0x908c('0x105')]};}return respondWithRpcPromise('SendMail',_0x908c('0x106'),{'account':_0x14531d,'message':{'from':util[_0x908c('0xeb')](_0x908c('0x107'),_0x3ede9c[_0x908c('0x37')],_0x3ede9c[_0x908c('0x108')]||_0x3ede9c['Smtp']['user']),'to':_0x5569ea[_0x908c('0x7a')][_0x908c('0xe9')],'subject':_0x908c('0x109'),'text':util[_0x908c('0xeb')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x5569ea[_0x908c('0x7a')][_0x908c('0xe9')]),'attachments':[{'path':_0x1c4dab}]}})[_0x908c('0x36')](function(){return _0x31a6a5;})['catch'](function(_0x4fc04c){console[_0x908c('0x29')](_0x4fc04c);});}else{return _0x31a6a5;}})['then'](respondWithStatusCode(_0x23be91,0xc8))[_0x908c('0x2d')](handleError(_0x23be91,null));};exports[_0x908c('0x10a')]=function(_0x429e3f,_0x40dd02,_0x3d5bfd){return db['ChatMessage'][_0x908c('0x66')]({'where':{'id':_0x429e3f[_0x908c('0xbc')]['id']}})[_0x908c('0x36')](handleEntityNotFound(_0x40dd02,null))['then'](function(_0x1daca7){if(_0x1daca7){return _0x1daca7[_0x908c('0x10a')](_0x429e3f[_0x908c('0x7a')]['ids'],_[_0x908c('0x10b')](_0x429e3f[_0x908c('0x7a')],[_0x908c('0x10c'),'id'])||{});}})['then'](respondWithResult(_0x40dd02,null))[_0x908c('0x2d')](handleError(_0x40dd02,null));};exports[_0x908c('0x10d')]=function(_0x18f544,_0xbeb275,_0x19fa22){var _0x9623ac={'raw':![],'where':{}};var _0xe6b713={};var _0x20b7d4={'count':0x0,'rows':[]};return db[_0x908c('0xc2')][_0x908c('0xc7')]({'where':{'id':_0x18f544[_0x908c('0xbc')]['id']}})[_0x908c('0x36')](handleEntityNotFound(_0xbeb275,null))[_0x908c('0x36')](function(_0x146b04){if(_0x146b04){_0xe6b713['model']=_[_0x908c('0xbd')](db[_0x908c('0xd1')][_0x908c('0xbe')]);_0xe6b713[_0x908c('0x49')]=_['keys'](_0x18f544[_0x908c('0x49')]);_0xe6b713['filters']=_[_0x908c('0x46')](_0xe6b713[_0x908c('0x44')],_0xe6b713['query']);_0x9623ac[_0x908c('0x47')]=_[_0x908c('0x46')](_0xe6b713[_0x908c('0x44')],qs[_0x908c('0x48')](_0x18f544[_0x908c('0x49')]['fields']));_0x9623ac['attributes']=_0x9623ac['attributes'][_0x908c('0x65')]?_0x9623ac[_0x908c('0x47')]:_0xe6b713[_0x908c('0x44')];if(!_0x18f544[_0x908c('0x49')][_0x908c('0x10e')](_0x908c('0x4a'))){_0x9623ac[_0x908c('0x34')]=qs[_0x908c('0x34')](_0x18f544[_0x908c('0x49')]['limit']);_0x9623ac['offset']=qs[_0x908c('0x33')](_0x18f544['query'][_0x908c('0x33')]);}_0x9623ac[_0x908c('0x4b')]=qs[_0x908c('0x4c')](_0x18f544['query'][_0x908c('0x4c')]);_0x9623ac['where']=qs['filters'](_[_0x908c('0x10f')](_0x18f544[_0x908c('0x49')],_0xe6b713[_0x908c('0x45')]));_0x9623ac[_0x908c('0x4d')][_0x908c('0x110')]=_0x146b04['id'];if(_0x18f544[_0x908c('0x49')]['filter']){_0x9623ac[_0x908c('0x4d')]=_[_0x908c('0xa3')](_0x9623ac['where'],{'$or':_[_0x908c('0x74')](_0x9623ac[_0x908c('0x47')],function(_0x160128){var _0x2d28f2={};_0x2d28f2[_0x160128]={'$like':'%'+_0x18f544[_0x908c('0x49')][_0x908c('0x8c')]+'%'};return _0x2d28f2;})});}if(_0x18f544[_0x908c('0x49')][_0x908c('0x111')]){var _0x191ae6=_0x18f544[_0x908c('0x49')][_0x908c('0x111')][_0x908c('0x3d')](',');var _0x5de813={};_0x5de813[_0x191ae6[0x0]]={'$gte':moment(_0x191ae6[0x1])[_0x908c('0xeb')]('YYYY-MM-DD\x20HH:mm:ss')};_0x9623ac[_0x908c('0x4d')]=_[_0x908c('0xa3')](_0x9623ac[_0x908c('0x4d')],_0x5de813);}_0x9623ac=_[_0x908c('0xa3')]({},_0x9623ac,_0x18f544[_0x908c('0xc1')]);return db['ChatMessage']['count']({'where':_0x9623ac[_0x908c('0x4d')]})[_0x908c('0x36')](function(_0x7f73d4){_0x20b7d4[_0x908c('0x32')]=_0x7f73d4;if(_0x18f544[_0x908c('0x49')]['includeAll']){_0x9623ac['include']=[{'all':!![]}];}return db[_0x908c('0xd1')][_0x908c('0x112')](_0x9623ac);})[_0x908c('0x36')](function(_0x13624a){_0x20b7d4[_0x908c('0xba')]=_0x13624a;return _0x20b7d4;});}})[_0x908c('0x36')](respondWithFilteredResult(_0xbeb275,_0x9623ac))[_0x908c('0x2d')](handleError(_0xbeb275,null));};exports[_0x908c('0x113')]=function(_0x35f3e3,_0xb6a400,_0x378aac){var _0xc9f8cf={'where':{}},_0x1915b7={},_0x4b9b37={'count':0x0,'rows':[]};return db[_0x908c('0xc2')][_0x908c('0xc7')]({'where':{'id':_0x35f3e3[_0x908c('0xbc')]['id']}})[_0x908c('0x36')](handleEntityNotFound(_0xb6a400,null))[_0x908c('0x36')](function(_0x454ef4){if(_0x454ef4){_0x1915b7[_0x908c('0x44')]=_[_0x908c('0xbd')](db['ChatMessage'][_0x908c('0xbe')]);_0x1915b7[_0x908c('0x49')]=_[_0x908c('0xbd')](_0x35f3e3['query']);_0x1915b7['filters']=_[_0x908c('0x46')](_0x1915b7[_0x908c('0x44')],_0x1915b7['query']);_0xc9f8cf['attributes']=_[_0x908c('0x46')](_0x1915b7[_0x908c('0x44')],qs[_0x908c('0x48')](_0x35f3e3['query'][_0x908c('0x48')]));_0xc9f8cf[_0x908c('0x47')]=_0xc9f8cf[_0x908c('0x47')][_0x908c('0x65')]?_0xc9f8cf[_0x908c('0x47')]:_0x1915b7[_0x908c('0x44')];if(!_0x35f3e3[_0x908c('0x49')][_0x908c('0x10e')](_0x908c('0x4a'))){_0xc9f8cf['limit']=qs[_0x908c('0x34')](_0x35f3e3[_0x908c('0x49')][_0x908c('0x34')]);_0xc9f8cf['offset']=qs[_0x908c('0x33')](_0x35f3e3['query'][_0x908c('0x33')]);}_0xc9f8cf['order']=qs[_0x908c('0x4c')](_0x35f3e3[_0x908c('0x49')][_0x908c('0x4c')]);_0xc9f8cf[_0x908c('0x4d')]=qs[_0x908c('0x45')](_[_0x908c('0x10f')](_0x35f3e3[_0x908c('0x49')],_0x1915b7[_0x908c('0x45')]));_0xc9f8cf[_0x908c('0x4d')]['ChatInteractionId']=_0x454ef4['id'];if(_0x35f3e3['query'][_0x908c('0x8c')]){_0xc9f8cf[_0x908c('0x4d')]=_[_0x908c('0xa3')](_0xc9f8cf['where'],{'$or':_[_0x908c('0x74')](_0xc9f8cf[_0x908c('0x47')],function(_0x23f4bd){var _0x2fc780={};_0x2fc780[_0x23f4bd]={'$like':'%'+_0x35f3e3[_0x908c('0x49')][_0x908c('0x8c')]+'%'};return _0x2fc780;})});}_0xc9f8cf[_0x908c('0x4d')][_0x908c('0xfb')]=![];if(_0x35f3e3[_0x908c('0x49')]['id']){_0xc9f8cf['where']['id']={'$gt':_0x35f3e3[_0x908c('0x49')]['id']};}_0xc9f8cf=_[_0x908c('0xa3')]({},_0xc9f8cf,_0x35f3e3[_0x908c('0xc1')]);return db[_0x908c('0xd1')][_0x908c('0x32')]({'where':_0xc9f8cf[_0x908c('0x4d')]})['then'](function(_0x137ef9){_0x4b9b37[_0x908c('0x32')]=_0x137ef9;_0xc9f8cf['include']=[];if(_0x35f3e3[_0x908c('0x49')][_0x908c('0x114')]){_0xc9f8cf['include']['push']({'model':db['User'],'as':_0x908c('0x76'),'attributes':['id','fullname',_0x908c('0xf7')]});}if(_0x35f3e3[_0x908c('0x49')]['includeAll']){_0xc9f8cf['include']=[{'all':!![]}];}return db[_0x908c('0xd1')][_0x908c('0x112')](_0xc9f8cf);})[_0x908c('0x36')](function(_0x3e4012){_0x4b9b37[_0x908c('0xba')]=_0x3e4012;return _0x4b9b37;});}})[_0x908c('0x36')](respondWithFilteredResult(_0xb6a400,_0xc9f8cf))[_0x908c('0x2d')](handleError(_0xb6a400,null));};exports[_0x908c('0x115')]=function(_0x318da7,_0x32fe7c,_0xec7c76){return db['ChatInteraction'][_0x908c('0x66')]({'where':{'id':_0x318da7[_0x908c('0xbc')]['id']}})[_0x908c('0x36')](handleEntityNotFound(_0x32fe7c,null))['then'](function(_0x475c69){if(_0x475c69){return _0x475c69['setTags'](_0x318da7[_0x908c('0x7a')][_0x908c('0x10c')],_['omit'](_0x318da7[_0x908c('0x7a')],[_0x908c('0x10c'),'id'])||{})['spread'](function(){return db[_0x908c('0x116')]['findAll']({'attributes':['id',_0x908c('0x37'),_0x908c('0x50')],'where':{'id':_0x318da7[_0x908c('0x7a')][_0x908c('0x10c')]}});})[_0x908c('0x36')](function(_0xb68260){socket['emit'](_0x908c('0x117'),{'id':Number(_0x318da7[_0x908c('0xbc')]['id']),'tags':_0xb68260||[]});return{'id':Number(_0x318da7[_0x908c('0xbc')]['id']),'tags':_0xb68260||[]};});}})[_0x908c('0x36')](respondWithResult(_0x32fe7c,null))['catch'](handleError(_0x32fe7c,null));};exports[_0x908c('0x118')]=function(_0x5e30c7,_0x234238,_0xa2da6d){return db[_0x908c('0xc2')][_0x908c('0x66')]({'where':{'id':_0x5e30c7[_0x908c('0xbc')]['id']}})['then'](handleEntityNotFound(_0x234238,null))[_0x908c('0x36')](function(_0x3610a9){if(_0x3610a9){return _0x3610a9[_0x908c('0x118')](_0x5e30c7[_0x908c('0x49')][_0x908c('0x10c')]);}})[_0x908c('0x36')](respondWithStatusCode(_0x234238,null))[_0x908c('0x2d')](handleError(_0x234238,null));};exports[_0x908c('0xe4')]=function(_0x2b1c97,_0x382401){var _0x24d67d=moment()[_0x908c('0x119')]()[_0x908c('0xa1')]();var _0x589ff8=path[_0x908c('0xe5')](config[_0x908c('0xe6')],_0x908c('0x11a'),_0x908c('0x11b'),_0x908c('0x11c'));var _0x5549af=path['join'](config[_0x908c('0xe6')],_0x908c('0x11a'),'files',_0x908c('0x11d'));var _0x2be6e6=path['join'](_0x589ff8,_0x24d67d);var _0x2ae0c2=util[_0x908c('0xeb')](_0x908c('0x11e'),_0x2b1c97[_0x908c('0xbc')]['id'],_0x24d67d);var _0x256ce6=path[_0x908c('0xe5')](_0x589ff8,_0x2ae0c2);var _0x1f7660=[];_0x1f7660['push']({'model':db[_0x908c('0x76')],'as':_0x908c('0x76'),'attributes':['id',_0x908c('0x3a')],'raw':!![]});_0x1f7660[_0x908c('0x3f')]({'model':db[_0x908c('0xd3')],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x2b1c97[_0x908c('0x49')][_0x908c('0x11d')]){_0x1f7660[_0x908c('0x3f')]({'model':db[_0x908c('0xe2')],'as':_0x908c('0xe2'),'raw':!![]});}var _0x3c5c40=[{'model':db['ChatMessage'],'as':_0x908c('0xef'),'attributes':['id',_0x908c('0x7a'),_0x908c('0x81'),_0x908c('0xfa'),_0x908c('0xfb'),'read'],'include':_0x1f7660}];_0x3c5c40[_0x908c('0x3f')]({'model':db[_0x908c('0xc6')],'as':'Account','attributes':['id','name']});_0x3c5c40[_0x908c('0x3f')]({'model':db[_0x908c('0x76')],'as':_0x908c('0x11f'),'attributes':['id','fullname']});return db['ChatInteraction'][_0x908c('0x66')]({'where':{'id':_0x2b1c97[_0x908c('0xbc')]['id']},'include':_0x3c5c40})[_0x908c('0x36')](handleEntityNotFound(_0x382401,null))[_0x908c('0x36')](function(_0x2e5106){if(_0x2e5106){var _0xf89b21=_0x2e5106['get']({'plain':!![]});fs[_0x908c('0x120')](_0x2be6e6);var _0x9288ab={'format':'A4','border':_0x908c('0x121'),'header':{'height':_0x908c('0x122'),'contents':{'first':_0x908c('0x123')}},'footer':{'height':_0x908c('0x124'),'contents':{'default':util['format'](_0x908c('0x125'),util['format']('%s\x20#%d','Chat',_0xf89b21['id']),moment()[_0x908c('0xeb')](_0x908c('0x126'))[_0x908c('0xa1')]())}}};var _0x53c0a7={'channel':'Chat','account':_0xf89b21[_0x908c('0x127')][_0x908c('0x37')],'agent':_0xf89b21[_0x908c('0x11f')]?_0xf89b21[_0x908c('0x11f')]['fullname']:_0x908c('0x128'),'createdAt':moment(_0xf89b21['createdAt'])['format'](_0x908c('0x129'))[_0x908c('0xa1')](),'closedAt':_0xf89b21[_0x908c('0xe1')]?moment(_0xf89b21[_0x908c('0x12a')])[_0x908c('0xeb')](_0x908c('0x129'))['toString']():'','disposition':_0xf89b21[_0x908c('0xd8')],'chatInfo':{'browser':_0xf89b21[_0x908c('0x12b')],'os':_0xf89b21['osName'],'referer':_0xf89b21[_0x908c('0x12c')],'customerIp':_0xf89b21['customerIp'],'customerPort':_0xf89b21[_0x908c('0x12d')]?_0xf89b21[_0x908c('0x12d')]:_0x908c('0x128')},'messages':_(_0xf89b21[_0x908c('0xef')])[_0x908c('0x12e')]()[_0x908c('0x8c')]({'secret':![]})[_0x908c('0x74')](function(_0x42f45a){if(_0x42f45a['Attachment']){var _0x57c8f2=path[_0x908c('0xe5')](_0x5549af,_0x42f45a[_0x908c('0xe2')]['basename']);if(fs['existsSync'](_0x57c8f2)){fs[_0x908c('0x12f')](_0x57c8f2)[_0x908c('0x130')](fs[_0x908c('0x131')](path[_0x908c('0xe5')](_0x2be6e6,_0x42f45a[_0x908c('0xe2')][_0x908c('0xdc')])));}}return{'date':moment(_0x42f45a[_0x908c('0x81')])[_0x908c('0xeb')](_0x908c('0x129'))[_0x908c('0xa1')](),'sender':_0x42f45a['direction']===_0x908c('0xd0')?_0x42f45a[_0x908c('0x76')]?_0x42f45a[_0x908c('0x76')][_0x908c('0x3a')]:_0x908c('0xf1'):_0x42f45a[_0x908c('0x6b')][_0x908c('0x132')]+(_0x42f45a[_0x908c('0x6b')][_0x908c('0x133')]?'\x20'+_0x42f45a[_0x908c('0x6b')][_0x908c('0x133')]:''),'body':_0x42f45a[_0x908c('0xe2')]?_0x42f45a[_0x908c('0xe2')]['basename']:_0x42f45a['body'],'direction':_0x42f45a[_0x908c('0xfa')]===_0x908c('0xd0')?'A':'C','secret':_0x42f45a[_0x908c('0xfb')],'read':_0x42f45a[_0x908c('0x87')],'attachment':_0x42f45a[_0x908c('0xe2')]};})['value']()};return ejs[_0x908c('0x134')](path[_0x908c('0xe5')](config[_0x908c('0xe6')],_0x908c('0x11a'),_0x908c('0x135'),_0x908c('0x136')),{'interaction':_0x53c0a7})[_0x908c('0x36')](function(_0x842820){return new BPromise(function(_0xe53b9a,_0x22d980){pdf['create'](_0x842820,_0x9288ab)[_0x908c('0x137')](path[_0x908c('0xe5')](_0x2be6e6,_0x908c('0x138')+_0xf89b21['id']+'-'+_0x24d67d+_0x908c('0x139')),function(_0x549e01,_0x22a3ca){if(_0x549e01)return _0x22d980(_0x549e01);_0xe53b9a(_0x22a3ca);});});})[_0x908c('0x36')](function(){return new BPromise(function(_0x10a023,_0x254675){zipdir(_0x2be6e6,{'saveTo':_0x256ce6},function(_0xbdc9a2,_0x4c0ebc){if(_0xbdc9a2)return _0x254675(_0xbdc9a2);return _0x10a023(_0x4c0ebc);});})[_0x908c('0x36')](function(){return new BPromise(function(_0x41b319,_0x403b32){rimraf(_0x2be6e6,function(_0x5800c8){if(_0x5800c8)_0x403b32(_0x5800c8);return _0x41b319();});});})[_0x908c('0x36')](function(){return _0x382401[_0x908c('0xe4')](_0x256ce6,_0x2ae0c2,function(_0x320a13){if(_0x320a13){console['log'](_0x908c('0x13a'),_0x320a13);}else{fs[_0x908c('0x13b')](_0x256ce6);}});});});}else{return _0x382401[_0x908c('0x2e')](0xc8);}})[_0x908c('0x2d')](handleError(_0x382401,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 9224332..2be5f2e 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 _0x1fcc=['unreadMessages','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','map','then'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1fcc,0x125));var _0xc1fc=function(_0x5bfb78,_0x22e3ff){_0x5bfb78=_0x5bfb78-0x0;var _0x4efd00=_0x1fcc[_0x5bfb78];return _0x4efd00;};'use strict';var EventEmitter=require(_0xc1fc('0x0'));var ChatInteraction=require(_0xc1fc('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0xc1fc('0x1'))['db'][_0xc1fc('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xc1fc('0x3')](0x0);var events={'afterCreate':_0xc1fc('0x4'),'afterUpdate':_0xc1fc('0x5'),'afterDestroy':_0xc1fc('0x6')};function emitEvent(_0xf9bb59){return function(_0x51605f,_0x205d03,_0x2fe1fc){_0x51605f[_0xc1fc('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1b8560){_0x51605f[_0xc1fc('0x8')]('Users',_0x1b8560[_0xc1fc('0x9')](function(_0xf5f298){return{'id':_0xf5f298['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x51605f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc1fc('0xa')](function(_0x57df7c){_0x51605f[_0xc1fc('0x8')](_0xc1fc('0xb'),_0x57df7c['length']);ChatInteractionEvents[_0xc1fc('0xc')](_0xf9bb59+':'+_0x51605f['id'],_0x51605f);ChatInteractionEvents[_0xc1fc('0xc')](_0xf9bb59,_0x51605f);_0x2fe1fc(null);})[_0xc1fc('0xd')](_0x2fe1fc(null));};}for(var e in events){if(events[_0xc1fc('0xe')](e)){var event=events[e];ChatInteraction[_0xc1fc('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0xdebe=['events','../../mysqldb','ChatInteraction','setMaxListeners','update','remove','setDataValue','map','findAll','then','unreadMessages','emit','catch','hasOwnProperty'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0xdebe,0x142));var _0xedeb=function(_0x123e9c,_0x427731){_0x123e9c=_0x123e9c-0x0;var _0x88ab05=_0xdebe[_0x123e9c];return _0x88ab05;};'use strict';var EventEmitter=require(_0xedeb('0x0'));var ChatInteraction=require(_0xedeb('0x1'))['db'][_0xedeb('0x2')];var ChatMessage=require(_0xedeb('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xedeb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xedeb('0x4'),'afterDestroy':_0xedeb('0x5')};function emitEvent(_0x5781ad){return function(_0x43b7c8,_0x25babf,_0x4b3965){_0x43b7c8['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x14b98b){_0x43b7c8[_0xedeb('0x6')]('Users',_0x14b98b[_0xedeb('0x7')](function(_0x58538a){return{'id':_0x58538a['id']};}));return ChatMessage[_0xedeb('0x8')]({'where':{'ChatInteractionId':_0x43b7c8['id'],'direction':'in','read':![]},'raw':!![]});})[_0xedeb('0x9')](function(_0x2136c3){_0x43b7c8[_0xedeb('0x6')](_0xedeb('0xa'),_0x2136c3['length']);ChatInteractionEvents[_0xedeb('0xb')](_0x5781ad+':'+_0x43b7c8['id'],_0x43b7c8);ChatInteractionEvents[_0xedeb('0xb')](_0x5781ad,_0x43b7c8);_0x4b3965(null);})[_0xedeb('0xc')](_0x4b3965(null));};}for(var e in events){if(events[_0xedeb('0xd')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index c7fbfa4..9e59891 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 _0x46b0=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','ChatInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x152449,_0x49f41d){var _0x5b58b2=function(_0x226c30){while(--_0x226c30){_0x152449['push'](_0x152449['shift']());}};_0x5b58b2(++_0x49f41d);}(_0x46b0,0xa2));var _0x046b=function(_0x1dc131,_0x5b64d9){_0x1dc131=_0x1dc131-0x0;var _0x47722a=_0x46b0[_0x1dc131];return _0x47722a;};'use strict';var _=require('lodash');var util=require(_0x046b('0x0'));var logger=require(_0x046b('0x1'))(_0x046b('0x2'));var moment=require(_0x046b('0x3'));var BPromise=require(_0x046b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x046b('0x5'));var config=require(_0x046b('0x6'));var attributes=require('./chatInteraction.attributes');module[_0x046b('0x7')]=function(_0x567bb9,_0x79b041){return _0x567bb9['define'](_0x046b('0x8'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57107a,_0xbaf8bc,_0x183e24){if(_0x57107a[_0x046b('0x9')](_0x046b('0xa'))){_0x57107a[_0x046b('0xb')]=moment()[_0x046b('0xc')](_0x046b('0xd'));}_0x183e24(null,_0x57107a);}},'charset':_0x046b('0xe'),'collate':_0x046b('0xf')});}; \ No newline at end of file +var _0xe6e1=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x441167,_0x2134d8){var _0xcc96f3=function(_0x2431f1){while(--_0x2431f1){_0x441167['push'](_0x441167['shift']());}};_0xcc96f3(++_0x2134d8);}(_0xe6e1,0x1ba));var _0x1e6e=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xe6e1[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x1e6e('0x0'));var util=require(_0x1e6e('0x1'));var logger=require('../../config/logger')(_0x1e6e('0x2'));var moment=require(_0x1e6e('0x3'));var BPromise=require(_0x1e6e('0x4'));var rp=require(_0x1e6e('0x5'));var fs=require('fs');var path=require(_0x1e6e('0x6'));var rimraf=require(_0x1e6e('0x7'));var config=require('../../config/environment');var attributes=require(_0x1e6e('0x8'));module[_0x1e6e('0x9')]=function(_0x3afdcd,_0x12935f){return _0x3afdcd[_0x1e6e('0xa')](_0x1e6e('0xb'),attributes,{'tableName':_0x1e6e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x29f4c0,_0x23d98b,_0x2bfb19){if(_0x29f4c0[_0x1e6e('0xd')](_0x1e6e('0xe'))){_0x29f4c0[_0x1e6e('0xf')]=moment()[_0x1e6e('0x10')](_0x1e6e('0x11'));}_0x2bfb19(null,_0x29f4c0);}},'charset':_0x1e6e('0x12'),'collate':_0x1e6e('0x13')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 3cccc62..a84f062 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 _0xc796=['localhost','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ChatInteraction','body','options','raw','where','attributes','limit','UpdateChatInteraction','AddTagsToChatInteraction','find','addTags','ids','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x4e32b3,_0x1b6243){var _0x394b68=function(_0x5c65d9){while(--_0x5c65d9){_0x4e32b3['push'](_0x4e32b3['shift']());}};_0x394b68(++_0x1b6243);}(_0xc796,0x141));var _0x6c79=function(_0xae282f,_0x2d9368){_0xae282f=_0xae282f-0x0;var _0x5f46d4=_0xc796[_0xae282f];return _0x5f46d4;};'use strict';var _=require(_0x6c79('0x0'));var util=require('util');var moment=require(_0x6c79('0x1'));var BPromise=require(_0x6c79('0x2'));var rs=require(_0x6c79('0x3'));var fs=require('fs');var Redis=require(_0x6c79('0x4'));var db=require(_0x6c79('0x5'))['db'];var utils=require(_0x6c79('0x6'));var logger=require(_0x6c79('0x7'))(_0x6c79('0x8'));var config=require(_0x6c79('0x9'));var jayson=require(_0x6c79('0xa'));var client=jayson[_0x6c79('0xb')][_0x6c79('0xc')]({'port':0x232a});config['redis']=_[_0x6c79('0xd')](config[_0x6c79('0xe')],{'host':_0x6c79('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6c79('0xe')]));require(_0x6c79('0x10'))['register'](socket);function respondWithRpcPromise(_0x1f0538,_0x5d9b79,_0xd3a3e){return new BPromise(function(_0xae6e09,_0x19aaf3){return client[_0x6c79('0x11')](_0x1f0538,_0xd3a3e)[_0x6c79('0x12')](function(_0x264457){logger[_0x6c79('0x13')](_0x6c79('0x14'),_0x5d9b79,_0x6c79('0x15'));logger[_0x6c79('0x16')](_0x6c79('0x17'),_0x5d9b79,_0x6c79('0x15'),JSON[_0x6c79('0x18')](_0x264457));if(_0x264457[_0x6c79('0x19')]){if(_0x264457[_0x6c79('0x19')][_0x6c79('0x1a')]===0x1f4){logger[_0x6c79('0x19')](_0x6c79('0x14'),_0x5d9b79,_0x264457[_0x6c79('0x19')][_0x6c79('0x1b')]);return _0x19aaf3(_0x264457[_0x6c79('0x19')][_0x6c79('0x1b')]);}logger[_0x6c79('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x5d9b79,_0x264457['error']['message']);return _0xae6e09(_0x264457[_0x6c79('0x19')][_0x6c79('0x1b')]);}else{logger[_0x6c79('0x13')](_0x6c79('0x14'),_0x5d9b79,_0x6c79('0x15'));_0xae6e09(_0x264457['result']['message']);}})[_0x6c79('0x1c')](function(_0x327fc8){logger[_0x6c79('0x19')](_0x6c79('0x14'),_0x5d9b79,_0x327fc8);_0x19aaf3(_0x327fc8);});});}exports['UpdateChatInteraction']=function(_0x531b0e){var _0x2edfe0=this;return new Promise(function(_0x1dd85f,_0x236921){return db[_0x6c79('0x1d')]['update'](_0x531b0e[_0x6c79('0x1e')],{'raw':_0x531b0e[_0x6c79('0x1f')]?_0x531b0e[_0x6c79('0x1f')][_0x6c79('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x531b0e[_0x6c79('0x1f')]?_0x531b0e['options'][_0x6c79('0x21')]||null:null,'attributes':_0x531b0e['options']?_0x531b0e[_0x6c79('0x1f')][_0x6c79('0x22')]||null:null,'limit':_0x531b0e[_0x6c79('0x1f')]?_0x531b0e[_0x6c79('0x1f')][_0x6c79('0x23')]||null:null})['then'](function(_0x69948a){logger[_0x6c79('0x13')](_0x6c79('0x24'),_0x531b0e);logger['debug'](_0x6c79('0x24'),_0x531b0e,JSON[_0x6c79('0x18')](_0x69948a));_0x1dd85f(_0x69948a);})[_0x6c79('0x1c')](function(_0x336e6b){logger['error'](_0x6c79('0x24'),_0x336e6b[_0x6c79('0x1b')],_0x531b0e);_0x236921(_0x2edfe0['error'](0x1f4,_0x336e6b['message']));});});};exports[_0x6c79('0x25')]=function(_0x4914c2){return new Promise(function(_0x55104d,_0x55194c){return db['ChatInteraction'][_0x6c79('0x26')]({'where':_0x4914c2[_0x6c79('0x1f')]?_0x4914c2['options']['where']||null:null})[_0x6c79('0x12')](function(_0x146595){if(_0x146595){return _0x146595[_0x6c79('0x27')](_0x4914c2[_0x6c79('0x1e')][_0x6c79('0x28')],_['omit'](_0x4914c2['body'],[_0x6c79('0x28'),'id'])||{});}})['spread'](function(_0xa8258d){logger[_0x6c79('0x13')](_0x6c79('0x29'),_0x4914c2);logger['debug'](_0x6c79('0x29'),_0x4914c2,JSON[_0x6c79('0x18')](_0xa8258d));_0x55104d(_0xa8258d);})[_0x6c79('0x1c')](function(_0x3c4800){logger[_0x6c79('0x19')](_0x6c79('0x29'),_0x3c4800['message'],_0x4914c2);_0x55194c(_this[_0x6c79('0x19')](0x1f4,_0x3c4800['message']));});});}; \ No newline at end of file +var _0x427a=['options','raw','where','attributes','limit','then','stringify','AddTagsToChatInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','request','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','ChatInteraction,\x20%s,\x20%s','info','catch','UpdateChatInteraction','ChatInteraction'];(function(_0x34d6ad,_0x139695){var _0x373b30=function(_0x403fde){while(--_0x403fde){_0x34d6ad['push'](_0x34d6ad['shift']());}};_0x373b30(++_0x139695);}(_0x427a,0xbb));var _0xa427=function(_0x3815ac,_0x4b3151){_0x3815ac=_0x3815ac-0x0;var _0x218cec=_0x427a[_0x3815ac];return _0x218cec;};'use strict';var _=require(_0xa427('0x0'));var util=require(_0xa427('0x1'));var moment=require(_0xa427('0x2'));var BPromise=require(_0xa427('0x3'));var rs=require(_0xa427('0x4'));var fs=require('fs');var Redis=require(_0xa427('0x5'));var db=require(_0xa427('0x6'))['db'];var utils=require(_0xa427('0x7'));var logger=require(_0xa427('0x8'))(_0xa427('0x9'));var config=require(_0xa427('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa427('0xb')]({'port':0x232a});config['redis']=_[_0xa427('0xc')](config[_0xa427('0xd')],{'host':_0xa427('0xe'),'port':0x18eb});var socket=require(_0xa427('0xf'))(new Redis(config[_0xa427('0xd')]));require(_0xa427('0x10'))['register'](socket);function respondWithRpcPromise(_0x1e5e76,_0x57c9b0,_0x35468b){return new BPromise(function(_0x3adfc0,_0x1b52d9){return client[_0xa427('0x11')](_0x1e5e76,_0x35468b)['then'](function(_0x535980){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x57c9b0,_0xa427('0x12'));logger[_0xa427('0x13')](_0xa427('0x14'),_0x57c9b0,_0xa427('0x12'),JSON['stringify'](_0x535980));if(_0x535980[_0xa427('0x15')]){if(_0x535980[_0xa427('0x15')]['code']===0x1f4){logger[_0xa427('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x57c9b0,_0x535980[_0xa427('0x15')][_0xa427('0x16')]);return _0x1b52d9(_0x535980['error'][_0xa427('0x16')]);}logger[_0xa427('0x15')](_0xa427('0x17'),_0x57c9b0,_0x535980[_0xa427('0x15')]['message']);return _0x3adfc0(_0x535980['error'][_0xa427('0x16')]);}else{logger[_0xa427('0x18')](_0xa427('0x17'),_0x57c9b0,'request\x20sent');_0x3adfc0(_0x535980['result']['message']);}})[_0xa427('0x19')](function(_0x2d4aee){logger[_0xa427('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x57c9b0,_0x2d4aee);_0x1b52d9(_0x2d4aee);});});}exports[_0xa427('0x1a')]=function(_0x190906){var _0x4e9cb8=this;return new Promise(function(_0x518bc0,_0x16213c){return db[_0xa427('0x1b')]['update'](_0x190906['body'],{'raw':_0x190906['options']?_0x190906[_0xa427('0x1c')][_0xa427('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x190906[_0xa427('0x1c')]?_0x190906['options'][_0xa427('0x1e')]||null:null,'attributes':_0x190906['options']?_0x190906[_0xa427('0x1c')][_0xa427('0x1f')]||null:null,'limit':_0x190906[_0xa427('0x1c')]?_0x190906[_0xa427('0x1c')][_0xa427('0x20')]||null:null})[_0xa427('0x21')](function(_0x2f9e3e){logger[_0xa427('0x18')](_0xa427('0x1a'),_0x190906);logger['debug'](_0xa427('0x1a'),_0x190906,JSON[_0xa427('0x22')](_0x2f9e3e));_0x518bc0(_0x2f9e3e);})['catch'](function(_0x359dc0){logger[_0xa427('0x15')](_0xa427('0x1a'),_0x359dc0['message'],_0x190906);_0x16213c(_0x4e9cb8['error'](0x1f4,_0x359dc0[_0xa427('0x16')]));});});};exports[_0xa427('0x23')]=function(_0x435427){return new Promise(function(_0xb728e,_0x25b96c){return db[_0xa427('0x1b')][_0xa427('0x24')]({'where':_0x435427[_0xa427('0x1c')]?_0x435427[_0xa427('0x1c')][_0xa427('0x1e')]||null:null})[_0xa427('0x21')](function(_0xf77749){if(_0xf77749){return _0xf77749[_0xa427('0x25')](_0x435427[_0xa427('0x26')][_0xa427('0x27')],_[_0xa427('0x28')](_0x435427[_0xa427('0x26')],[_0xa427('0x27'),'id'])||{});}})[_0xa427('0x29')](function(_0x8db232){logger['info'](_0xa427('0x2a'),_0x435427);logger[_0xa427('0x13')]('AddTags',_0x435427,JSON['stringify'](_0x8db232));_0xb728e(_0x8db232);})['catch'](function(_0xc037d1){logger[_0xa427('0x15')](_0xa427('0x2a'),_0xc037d1[_0xa427('0x16')],_0x435427);_0x25b96c(_this[_0xa427('0x15')](0x1f4,_0xc037d1[_0xa427('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 1f708c3..8829c16 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 _0xadce=['chatInteraction:','./chatInteraction.events','remove','removeListener','length'];(function(_0x3eeb40,_0x3a11d8){var _0x115527=function(_0x5c993e){while(--_0x5c993e){_0x3eeb40['push'](_0x3eeb40['shift']());}};_0x115527(++_0x3a11d8);}(_0xadce,0x1dc));var _0xeadc=function(_0x100e36,_0x4da225){_0x100e36=_0x100e36-0x0;var _0x1df0c9=_0xadce[_0x100e36];return _0x1df0c9;};'use strict';var ChatInteractionEvents=require(_0xeadc('0x0'));var events=['save',_0xeadc('0x1'),'update'];function createListener(_0x22594e,_0x3d2164){return function(_0x4c13ac){_0x3d2164['emit'](_0x22594e,_0x4c13ac);};}function removeListener(_0x2a93d3,_0x3cdaaa){return function(){ChatInteractionEvents[_0xeadc('0x2')](_0x2a93d3,_0x3cdaaa);};}exports['register']=function(_0x5db8d2){for(var _0x47afed=0x0,_0x51460f=events[_0xeadc('0x3')];_0x47afed<_0x51460f;_0x47afed++){var _0x368a9a=events[_0x47afed];var _0x4860de=createListener(_0xeadc('0x4')+_0x368a9a,_0x5db8d2);ChatInteractionEvents['on'](_0x368a9a,_0x4860de);}}; \ No newline at end of file +var _0xe82c=['remove','emit','removeListener','register','chatInteraction:','./chatInteraction.events'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe82c,0x197));var _0xce82=function(_0x55afe4,_0x3ffeb2){_0x55afe4=_0x55afe4-0x0;var _0x13cf26=_0xe82c[_0x55afe4];return _0x13cf26;};'use strict';var ChatInteractionEvents=require(_0xce82('0x0'));var events=['save',_0xce82('0x1'),'update'];function createListener(_0x3d60d1,_0x32682d){return function(_0x546eea){_0x32682d[_0xce82('0x2')](_0x3d60d1,_0x546eea);};}function removeListener(_0x5be9ef,_0x3791e7){return function(){ChatInteractionEvents[_0xce82('0x3')](_0x5be9ef,_0x3791e7);};}exports[_0xce82('0x4')]=function(_0x1f3340){for(var _0x527da9=0x0,_0x28179f=events['length'];_0x527da9<_0x28179f;_0x527da9++){var _0x1dbe82=events[_0x527da9];var _0x1e1f0d=createListener(_0xce82('0x5')+_0x1dbe82,_0x1f3340);ChatInteractionEvents['on'](_0x1dbe82,_0x1e1f0d);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 888dd8a..4d32c87 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 _0x75fd=['/describe','/:id','/:id/attachment_download','attachmentDownload','getMessages','isChatInteractionAuthorized','getMyMessages','/:id/download','download','create','post','diskStorage','root','now','originalname','replace','/:id/attachment_upload','single','file','/:id/messages','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','put','chatinteraction:update','/:id/abandon','abandon','/:id/close','close','delete','destroy','removeTags','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x462c93,_0x1e94df){var _0x2332bc=function(_0x4ce224){while(--_0x4ce224){_0x462c93['push'](_0x462c93['shift']());}};_0x2332bc(++_0x1e94df);}(_0x75fd,0x131));var _0xd75f=function(_0x3d71f2,_0x519c4c){_0x3d71f2=_0x3d71f2-0x0;var _0x4b1ea8=_0x75fd[_0x3d71f2];return _0x4b1ea8;};'use strict';var multer=require(_0xd75f('0x0'));var util=require(_0xd75f('0x1'));var path=require(_0xd75f('0x2'));var timeout=require('connect-timeout');var express=require(_0xd75f('0x3'));var router=express[_0xd75f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd75f('0x5'));var config=require(_0xd75f('0x6'));var controller=require('./chatInteraction.controller');router['get']('/',auth[_0xd75f('0x7')](),controller[_0xd75f('0x8')]);router[_0xd75f('0x9')](_0xd75f('0xa'),auth[_0xd75f('0x7')](),controller['describe']);router[_0xd75f('0x9')](_0xd75f('0xb'),auth['isChatInteractionAuthorized'](),controller['show']);router[_0xd75f('0x9')](_0xd75f('0xc'),auth['isChatInteractionAuthorized'](),controller[_0xd75f('0xd')]);router['get']('/:id/messages',auth[_0xd75f('0x7')](),controller[_0xd75f('0xe')]);router[_0xd75f('0x9')]('/:id/my_messages',auth[_0xd75f('0xf')](),controller[_0xd75f('0x10')]);router[_0xd75f('0x9')](_0xd75f('0x11'),auth['isAuthenticated'](),controller[_0xd75f('0x12')]);router['post']('/',auth[_0xd75f('0x7')](),controller[_0xd75f('0x13')]);router[_0xd75f('0x14')]('/:id/vidaoo',auth[_0xd75f('0x7')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xd75f('0x15')]({'destination':function(_0x3493c0,_0x5468d2,_0x178d76){_0x178d76(null,path['join'](config[_0xd75f('0x16')],'server/files/attachments/'));},'filename':function(_0xa719ee,_0x42334f,_0x3ef27e){_0x3ef27e(null,util['format']('%s-%s',Date[_0xd75f('0x17')](),_0x42334f[_0xd75f('0x18')][_0xd75f('0x19')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0xd75f('0x1a'),upload[_0xd75f('0x1b')](_0xd75f('0x1c')),controller['attachmentUpload']);router[_0xd75f('0x14')](_0xd75f('0x1d'),auth[_0xd75f('0xf')](),controller[_0xd75f('0x1e')]);router[_0xd75f('0x14')](_0xd75f('0x1f'),auth['isAuthenticated'](),interaction[_0xd75f('0x20')](_0xd75f('0x21'),_0xd75f('0x22')),controller['addTags']);router[_0xd75f('0x23')](_0xd75f('0xb'),auth[_0xd75f('0x7')](),interaction[_0xd75f('0x20')](_0xd75f('0x21'),_0xd75f('0x24')),controller['update']);router[_0xd75f('0x23')]('/:id/custom_update',controller['customUpdate']);router[_0xd75f('0x23')](_0xd75f('0x25'),auth[_0xd75f('0xf')](),controller[_0xd75f('0x26')]);router[_0xd75f('0x23')](_0xd75f('0x27'),controller[_0xd75f('0x28')]);router[_0xd75f('0x29')](_0xd75f('0xb'),auth[_0xd75f('0x7')](),interaction[_0xd75f('0x20')](_0xd75f('0x21'),'chatinteraction:destroy'),controller[_0xd75f('0x2a')]);router[_0xd75f('0x29')](_0xd75f('0x1f'),auth[_0xd75f('0x7')](),controller[_0xd75f('0x2b')]);module[_0xd75f('0x2c')]=router; \ No newline at end of file +var _0x6fd7=['describe','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','/:id/download','download','create','post','join','root','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','attachmentUpload','/:id/tags','tracked','addTags','put','update','/:id/custom_update','/:id/abandon','abandon','/:id/close','close','delete','chat','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated'];(function(_0x1e081a,_0x482d6b){var _0x428209=function(_0x524b53){while(--_0x524b53){_0x1e081a['push'](_0x1e081a['shift']());}};_0x428209(++_0x482d6b);}(_0x6fd7,0x18a));var _0x76fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6fd7[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x76fd('0x0'));var util=require(_0x76fd('0x1'));var path=require(_0x76fd('0x2'));var timeout=require(_0x76fd('0x3'));var express=require(_0x76fd('0x4'));var router=express[_0x76fd('0x5')]();var auth=require(_0x76fd('0x6'));var interaction=require(_0x76fd('0x7'));var config=require('../../config/environment');var controller=require(_0x76fd('0x8'));router[_0x76fd('0x9')]('/',auth[_0x76fd('0xa')](),controller['index']);router[_0x76fd('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x76fd('0xb')]);router[_0x76fd('0x9')]('/:id',auth[_0x76fd('0xc')](),controller['show']);router['get'](_0x76fd('0xd'),auth['isChatInteractionAuthorized'](),controller[_0x76fd('0xe')]);router[_0x76fd('0x9')](_0x76fd('0xf'),auth[_0x76fd('0xa')](),controller['getMessages']);router['get'](_0x76fd('0x10'),auth['isChatInteractionAuthorized'](),controller[_0x76fd('0x11')]);router[_0x76fd('0x9')](_0x76fd('0x12'),auth['isAuthenticated'](),controller[_0x76fd('0x13')]);router['post']('/',auth[_0x76fd('0xa')](),controller[_0x76fd('0x14')]);router[_0x76fd('0x15')]('/:id/vidaoo',auth[_0x76fd('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x130a0d,_0xd3fa01,_0x11a1c4){_0x11a1c4(null,path[_0x76fd('0x16')](config[_0x76fd('0x17')],'server/files/attachments/'));},'filename':function(_0xe9ddbd,_0x35c754,_0x466860){_0x466860(null,util[_0x76fd('0x18')](_0x76fd('0x19'),Date[_0x76fd('0x1a')](),_0x35c754[_0x76fd('0x1b')][_0x76fd('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x76fd('0x15')](_0x76fd('0x1d'),upload[_0x76fd('0x1e')]('file'),controller[_0x76fd('0x1f')]);router[_0x76fd('0x15')](_0x76fd('0xf'),auth[_0x76fd('0xc')](),controller['addMessage']);router[_0x76fd('0x15')](_0x76fd('0x20'),auth[_0x76fd('0xa')](),interaction[_0x76fd('0x21')]('chat','chatinteraction:addtags'),controller[_0x76fd('0x22')]);router[_0x76fd('0x23')]('/:id',auth[_0x76fd('0xa')](),interaction[_0x76fd('0x21')]('chat','chatinteraction:update'),controller[_0x76fd('0x24')]);router['put'](_0x76fd('0x25'),controller['customUpdate']);router[_0x76fd('0x23')](_0x76fd('0x26'),auth[_0x76fd('0xc')](),controller[_0x76fd('0x27')]);router[_0x76fd('0x23')](_0x76fd('0x28'),controller[_0x76fd('0x29')]);router[_0x76fd('0x2a')]('/:id',auth[_0x76fd('0xa')](),interaction[_0x76fd('0x21')](_0x76fd('0x2b'),'chatinteraction:destroy'),controller['destroy']);router['delete'](_0x76fd('0x20'),auth[_0x76fd('0xa')](),controller['removeTags']);module[_0x76fd('0x2c')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index d06bc38..7cb8e41 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 _0x4975=['TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4975,0x86));var _0x5497=function(_0x2d3bd1,_0x1de3d3){_0x2d3bd1=_0x2d3bd1-0x0;var _0x539ee6=_0x4975[_0x2d3bd1];return _0x539ee6;};'use strict';var Sequelize=require(_0x5497('0x0'));module['exports']={'body':{'type':Sequelize[_0x5497('0x1')](_0x5497('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5497('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x5497('0x4')]}}; \ No newline at end of file +var _0xdb28=['medium','INTEGER','sequelize','exports','TEXT'];(function(_0x5aa24d,_0x498a5a){var _0x428126=function(_0x3eb2f2){while(--_0x3eb2f2){_0x5aa24d['push'](_0x5aa24d['shift']());}};_0x428126(++_0x498a5a);}(_0xdb28,0x106));var _0x8db2=function(_0x4bc13e,_0xec7eb6){_0x4bc13e=_0x4bc13e-0x0;var _0x495a39=_0xdb28[_0x4bc13e];return _0x495a39;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x8db2('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 203123a..46bda0d 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 _0x0134=['api','../../config/license/util','redis','defaults','localhost','./chatInternalMessage.socket','register','sendStatus','status','json','count','offset','limit','set','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','catch','create','body','describe','get','messages','createdAt','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','agent','admin','user','fullname','role','userpic','internal','online','allowmessenger','VoiceQueue','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','read','-createdAt','all','html-pdf','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2efe50,_0x24a6cb){var _0x1d7801=function(_0x5e2647){while(--_0x5e2647){_0x2efe50['push'](_0x2efe50['shift']());}};_0x1d7801(++_0x24a6cb);}(_0x0134,0xc3));var _0x4013=function(_0x8de950,_0x2693be){_0x8de950=_0x8de950-0x0;var _0x587a48=_0x0134[_0x8de950];return _0x587a48;};'use strict';var pdf=require(_0x4013('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4013('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4013('0x2'));var rp=require(_0x4013('0x3'));var moment=require('moment');var BPromise=require(_0x4013('0x4'));var Mustache=require(_0x4013('0x5'));var util=require(_0x4013('0x6'));var path=require(_0x4013('0x7'));var sox=require('sox');var csv=require(_0x4013('0x8'));var ejs=require(_0x4013('0x9'));var fs=require('fs');var _=require(_0x4013('0xa'));var squel=require(_0x4013('0xb'));var crypto=require(_0x4013('0xc'));var jsforce=require(_0x4013('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4013('0x8'));var querystring=require(_0x4013('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4013('0xf'));var as=require(_0x4013('0x10'));var hardwareService=require(_0x4013('0x11'));var logger=require(_0x4013('0x12'))(_0x4013('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4013('0x14'));var db=require('../../mysqldb')['db'];config[_0x4013('0x15')]=_[_0x4013('0x16')](config['redis'],{'host':_0x4013('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4013('0x15')]));require(_0x4013('0x18'))[_0x4013('0x19')](socket);function respondWithStatusCode(_0x7c0c70,_0xba4d47){_0xba4d47=_0xba4d47||0xcc;return function(_0x588de4){if(_0x588de4){return _0x7c0c70[_0x4013('0x1a')](_0xba4d47);}return _0x7c0c70['status'](_0xba4d47)['end']();};}function respondWithResult(_0x1975fd,_0x405bed){_0x405bed=_0x405bed||0xc8;return function(_0x5d1e6b){if(_0x5d1e6b){return _0x1975fd[_0x4013('0x1b')](_0x405bed)[_0x4013('0x1c')](_0x5d1e6b);}};}function respondWithFilteredResult(_0x1c05d5,_0x58824e){return function(_0x5999b2){if(_0x5999b2){var _0x343ddc=_0x5999b2[_0x4013('0x1d')],_0x31dc40=_0x58824e[_0x4013('0x1e')],_0x4e2ddb=_0x58824e['offset']+_0x58824e[_0x4013('0x1f')],_0x4e821f;if(_0x4e2ddb>=_0x343ddc){_0x4e2ddb=_0x343ddc;_0x4e821f=0xc8;}else{_0x4e821f=0xce;}_0x1c05d5[_0x4013('0x1b')](_0x4e821f);return _0x1c05d5[_0x4013('0x20')]('Content-Range',_0x31dc40+'-'+_0x4e2ddb+'/'+_0x343ddc)[_0x4013('0x1c')](_0x5999b2);}return null;};}function patchUpdates(_0x160e17){return function(_0x4ec6a0){try{jsonpatch[_0x4013('0x21')](_0x4ec6a0,_0x160e17,!![]);}catch(_0x4952a0){return BPromise[_0x4013('0x22')](_0x4952a0);}return _0x4ec6a0['save']();};}function saveUpdates(_0x5d199e,_0x1ae300){return function(_0x10e7fe){if(_0x10e7fe){return _0x10e7fe[_0x4013('0x23')](_0x5d199e)[_0x4013('0x24')](function(_0x2cc4ef){return _0x2cc4ef;});}return null;};}function removeEntity(_0x158504,_0x115901){return function(_0x22f5a4){if(_0x22f5a4){return _0x22f5a4[_0x4013('0x25')]()[_0x4013('0x24')](function(){_0x158504[_0x4013('0x1b')](0xcc)[_0x4013('0x26')]();});}};}function handleEntityNotFound(_0x3feddb,_0xf9d811){return function(_0x2fab2c){if(!_0x2fab2c){_0x3feddb[_0x4013('0x1a')](0x194);}return _0x2fab2c;};}function handleError(_0x496432,_0x12e6cf){_0x12e6cf=_0x12e6cf||0x1f4;return function(_0x2dedff){logger[_0x4013('0x27')](_0x2dedff[_0x4013('0x28')]);if(_0x2dedff[_0x4013('0x29')]){delete _0x2dedff[_0x4013('0x29')];}_0x496432[_0x4013('0x1b')](_0x12e6cf)[_0x4013('0x2a')](_0x2dedff);};}exports[_0x4013('0x2b')]=function(_0x42e83b,_0xa10a10){var _0x389adf={},_0x4f444f={},_0x584f9c={'count':0x0,'rows':[]};var _0x1dca28=_[_0x4013('0x2c')](db[_0x4013('0x2d')][_0x4013('0x2e')],function(_0x178f17){return{'name':_0x178f17['fieldName'],'type':_0x178f17[_0x4013('0x2f')][_0x4013('0x30')]};});_0x4f444f[_0x4013('0x31')]=_[_0x4013('0x2c')](_0x1dca28,'name');_0x4f444f['query']=_['keys'](_0x42e83b['query']);_0x4f444f[_0x4013('0x32')]=_[_0x4013('0x33')](_0x4f444f['model'],_0x4f444f[_0x4013('0x34')]);_0x389adf[_0x4013('0x35')]=_['intersection'](_0x4f444f[_0x4013('0x31')],qs[_0x4013('0x36')](_0x42e83b[_0x4013('0x34')][_0x4013('0x36')]));_0x389adf[_0x4013('0x35')]=_0x389adf[_0x4013('0x35')][_0x4013('0x37')]?_0x389adf[_0x4013('0x35')]:_0x4f444f[_0x4013('0x31')];if(!_0x42e83b['query'][_0x4013('0x38')]('nolimit')){_0x389adf[_0x4013('0x1f')]=qs['limit'](_0x42e83b[_0x4013('0x34')][_0x4013('0x1f')]);_0x389adf[_0x4013('0x1e')]=qs[_0x4013('0x1e')](_0x42e83b[_0x4013('0x34')]['offset']);}_0x389adf[_0x4013('0x39')]=qs[_0x4013('0x3a')](_0x42e83b['query']['sort']);_0x389adf[_0x4013('0x3b')]=qs[_0x4013('0x32')](_[_0x4013('0x3c')](_0x42e83b[_0x4013('0x34')],_0x4f444f[_0x4013('0x32')]),_0x1dca28);if(_0x42e83b[_0x4013('0x34')][_0x4013('0x3d')]){_0x389adf['where']=_[_0x4013('0x3e')](_0x389adf['where'],{'$or':_[_0x4013('0x2c')](_0x1dca28,function(_0x4f7f59){if(_0x4f7f59[_0x4013('0x2f')]!==_0x4013('0x3f')){var _0x5ad16f={};_0x5ad16f[_0x4f7f59[_0x4013('0x29')]]={'$like':'%'+_0x42e83b[_0x4013('0x34')]['filter']+'%'};return _0x5ad16f;}})});}_0x389adf=_[_0x4013('0x3e')]({},_0x389adf,_0x42e83b[_0x4013('0x40')]);var _0x5294f0={'where':_0x389adf[_0x4013('0x3b')]};return db[_0x4013('0x2d')]['count'](_0x5294f0)[_0x4013('0x24')](function(_0x2335c7){_0x584f9c[_0x4013('0x1d')]=_0x2335c7;if(_0x42e83b['query'][_0x4013('0x41')]){_0x389adf[_0x4013('0x42')]=[{'all':!![]}];}return db[_0x4013('0x2d')][_0x4013('0x43')](_0x389adf);})[_0x4013('0x24')](function(_0x5d25b9){_0x584f9c[_0x4013('0x44')]=_0x5d25b9;return _0x584f9c;})['then'](respondWithFilteredResult(_0xa10a10,_0x389adf))['catch'](handleError(_0xa10a10,null));};exports['show']=function(_0x51fde0,_0x3b787f){var _0x379214={'raw':!![],'where':{'id':_0x51fde0[_0x4013('0x45')]['id']}},_0x1c0e2a={};_0x1c0e2a[_0x4013('0x31')]=_[_0x4013('0x46')](db['ChatInternalMessage'][_0x4013('0x2e')]);_0x1c0e2a['query']=_[_0x4013('0x46')](_0x51fde0['query']);_0x1c0e2a['filters']=_[_0x4013('0x33')](_0x1c0e2a[_0x4013('0x31')],_0x1c0e2a[_0x4013('0x34')]);_0x379214[_0x4013('0x35')]=_[_0x4013('0x33')](_0x1c0e2a[_0x4013('0x31')],qs[_0x4013('0x36')](_0x51fde0['query'][_0x4013('0x36')]));_0x379214[_0x4013('0x35')]=_0x379214[_0x4013('0x35')][_0x4013('0x37')]?_0x379214[_0x4013('0x35')]:_0x1c0e2a[_0x4013('0x31')];if(_0x51fde0['query'][_0x4013('0x41')]){_0x379214[_0x4013('0x42')]=[{'all':!![]}];}_0x379214=_[_0x4013('0x3e')]({},_0x379214,_0x51fde0['options']);return db[_0x4013('0x2d')][_0x4013('0x47')](_0x379214)[_0x4013('0x24')](handleEntityNotFound(_0x3b787f,null))['then'](respondWithResult(_0x3b787f,null))[_0x4013('0x48')](handleError(_0x3b787f,null));};exports[_0x4013('0x49')]=function(_0x2668b8,_0x57c27f){return db[_0x4013('0x2d')][_0x4013('0x49')](_0x2668b8[_0x4013('0x4a')],{})['then'](respondWithResult(_0x57c27f,0xc9))['catch'](handleError(_0x57c27f,null));};exports[_0x4013('0x23')]=function(_0x2fb5fc,_0x51f428){if(_0x2fb5fc[_0x4013('0x4a')]['id']){delete _0x2fb5fc[_0x4013('0x4a')]['id'];}return db['ChatInternalMessage'][_0x4013('0x47')]({'where':{'id':_0x2fb5fc['params']['id']}})[_0x4013('0x24')](handleEntityNotFound(_0x51f428,null))[_0x4013('0x24')](saveUpdates(_0x2fb5fc[_0x4013('0x4a')],null))[_0x4013('0x24')](respondWithResult(_0x51f428,null))[_0x4013('0x48')](handleError(_0x51f428,null));};exports[_0x4013('0x25')]=function(_0xfad765,_0x222696){return db[_0x4013('0x2d')][_0x4013('0x47')]({'where':{'id':_0xfad765[_0x4013('0x45')]['id']}})[_0x4013('0x24')](handleEntityNotFound(_0x222696,null))[_0x4013('0x24')](removeEntity(_0x222696,null))[_0x4013('0x48')](handleError(_0x222696,null));};exports['describe']=function(_0x6f2d3b,_0x3e1f46){return db[_0x4013('0x2d')][_0x4013('0x4b')]()[_0x4013('0x24')](respondWithResult(_0x3e1f46,null))[_0x4013('0x48')](handleError(_0x3e1f46,null));};function wrapUser(_0x451ebb){return function(_0x522fab){var _0x1d9cc2=_0x451ebb[_0x4013('0x4c')]({'plain':!![]});_0x1d9cc2[_0x4013('0x4d')]=[];if(_0x522fab){_0x1d9cc2['lastMessageAt']=_0x522fab[_0x4013('0x4e')];_0x1d9cc2['lastMessage']=_0x522fab;}else{_0x1d9cc2[_0x4013('0x4f')]=moment(0x0)[_0x4013('0x50')](_0x4013('0x51'));_0x1d9cc2[_0x4013('0x52')]={};}return _0x1d9cc2;};}exports[_0x4013('0x53')]=function(_0x2daffc,_0x2e4a7f,_0x44c02d){var _0x593096=[];return db[_0x4013('0x54')][_0x4013('0x43')]({'where':{'role':[_0x4013('0x55'),_0x4013('0x56'),_0x4013('0x57')]},'attributes':['id',_0x4013('0x58'),_0x4013('0x29'),_0x4013('0x59'),_0x4013('0x5a'),_0x4013('0x5b'),_0x4013('0x5c'),'lastLoginAt',_0x4013('0x5d'),'showWebBar'],'order':qs[_0x4013('0x3a')]('-online'),'include':[{'model':db[_0x4013('0x5e')],'as':'VoiceQueues','attributes':['id','name',_0x4013('0x2f')],'through':{'attributes':[]}}]})[_0x4013('0x24')](function(_0x4b7e67){if(_0x4b7e67){var _0x4ace6e=_0x2daffc[_0x4013('0x57')][_0x4013('0x4c')]({'plain':!![]});if(!_0x4ace6e)throw new Error(_0x4013('0x5f'));if(_0x4ace6e[_0x4013('0x59')]===_0x4013('0x57')){return db[_0x4013('0x60')][_0x4013('0x47')]({'where':{'name':'Agents','userProfileId':_0x4ace6e[_0x4013('0x61')]},'raw':!![]})[_0x4013('0x24')](function(_0x50dda4){if(_0x50dda4){if(_0x50dda4[_0x4013('0x62')]===0x0){return db[_0x4013('0x63')][_0x4013('0x43')]({'where':{'sectionId':_0x50dda4['id']},'raw':!![]})[_0x4013('0x24')](function(_0x4aeb19){var _0x4c80f5=[];if(_[_0x4013('0x64')](_0x4aeb19)){_0x4c80f5=_[_0x4013('0x3d')](_0x4b7e67,function(_0x34af91){if(_0x34af91['role']!==_0x4013('0x55')){return _0x34af91;}});return _0x4c80f5;}else{for(var _0x387e92=0x0;_0x387e92<_0x4b7e67[_0x4013('0x37')];_0x387e92++){var _0x5b7763=_0x4b7e67[_0x387e92];if(_0x5b7763[_0x4013('0x59')]==='agent'){var _0x4b2af5=_['find'](_0x4aeb19,function(_0x72bf51){return _0x72bf51[_0x4013('0x65')]===_0x5b7763['id'];});if(_0x4b2af5)_0x4c80f5[_0x4013('0x66')](_0x5b7763);}else{_0x4c80f5[_0x4013('0x66')](_0x5b7763);}}return _0x4c80f5;}});}else{return _0x4b7e67;}}else{var _0x483424=_['filter'](_0x4b7e67,function(_0x4a64e0){if(_0x4a64e0['role']!==_0x4013('0x55')){return _0x4a64e0;}});return _0x483424;}});}else{return _0x4b7e67;}}})['then'](function(_0x480aaa){var _0x44852a=[];if(_0x480aaa){_0x593096=_0x480aaa;for(var _0x24644c=0x0;_0x24644c<_0x480aaa[_0x4013('0x37')];_0x24644c+=0x1){_0x593096[_0x24644c]['messages']=[];_0x44852a['push'](db[_0x4013('0x2d')]['find']({'where':{'FromId':[_0x2daffc[_0x4013('0x57')]['id'],_0x480aaa[_0x24644c]['id']],'ToId':[_0x2daffc[_0x4013('0x57')]['id'],_0x480aaa[_0x24644c]['id']],'ChatGroupId':null},'attributes':['id',_0x4013('0x4e'),_0x4013('0x67'),'ToId',_0x4013('0x68'),_0x4013('0x4a')],'order':qs[_0x4013('0x3a')](_0x4013('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x4013('0x24')](wrapUser(_0x480aaa[_0x24644c])));}return BPromise[_0x4013('0x6a')](_0x44852a);}return[];})[_0x4013('0x24')](function(_0x11b941){return{'rows':_0x11b941,'count':_0x11b941[_0x4013('0x37')]};})[_0x4013('0x24')](respondWithResult(_0x2e4a7f,null))[_0x4013('0x48')](handleError(_0x2e4a7f,null));}; \ No newline at end of file +var _0xf7c3=['isEmpty','resourceId','push','FromId','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','ChatInternalMessage','findAll','rows','catch','show','params','find','create','body','update','describe','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','role','userpic','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','autoAssociation','UserProfileResource'];(function(_0x5abb9c,_0x32f2eb){var _0x33916e=function(_0x1f45ef){while(--_0x1f45ef){_0x5abb9c['push'](_0x5abb9c['shift']());}};_0x33916e(++_0x32f2eb);}(_0xf7c3,0xe3));var _0x3f7c=function(_0x3fae23,_0x3388df){_0x3fae23=_0x3fae23-0x0;var _0x1d3a0a=_0xf7c3[_0x3fae23];return _0x1d3a0a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3f7c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3f7c('0x1'));var jsonpatch=require(_0x3f7c('0x2'));var rp=require(_0x3f7c('0x3'));var moment=require(_0x3f7c('0x4'));var BPromise=require(_0x3f7c('0x5'));var Mustache=require('mustache');var util=require(_0x3f7c('0x6'));var path=require(_0x3f7c('0x7'));var sox=require(_0x3f7c('0x8'));var csv=require(_0x3f7c('0x9'));var ejs=require(_0x3f7c('0xa'));var fs=require('fs');var _=require(_0x3f7c('0xb'));var squel=require(_0x3f7c('0xc'));var crypto=require(_0x3f7c('0xd'));var jsforce=require(_0x3f7c('0xe'));var deskjs=require(_0x3f7c('0xf'));var toCsv=require(_0x3f7c('0x9'));var querystring=require(_0x3f7c('0x10'));var Papa=require(_0x3f7c('0x11'));var Redis=require(_0x3f7c('0x12'));var authService=require(_0x3f7c('0x13'));var qs=require(_0x3f7c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f7c('0x15'));var logger=require(_0x3f7c('0x16'))(_0x3f7c('0x17'));var utils=require(_0x3f7c('0x18'));var config=require(_0x3f7c('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f7c('0x1a'))['db'];config[_0x3f7c('0x1b')]=_['defaults'](config[_0x3f7c('0x1b')],{'host':_0x3f7c('0x1c'),'port':0x18eb});var socket=require(_0x3f7c('0x1d'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x3f7c('0x1e')](socket);function respondWithStatusCode(_0xb0e86f,_0x5e0d7d){_0x5e0d7d=_0x5e0d7d||0xcc;return function(_0x87abfa){if(_0x87abfa){return _0xb0e86f[_0x3f7c('0x1f')](_0x5e0d7d);}return _0xb0e86f[_0x3f7c('0x20')](_0x5e0d7d)[_0x3f7c('0x21')]();};}function respondWithResult(_0x117d55,_0x5f599f){_0x5f599f=_0x5f599f||0xc8;return function(_0x229570){if(_0x229570){return _0x117d55[_0x3f7c('0x20')](_0x5f599f)[_0x3f7c('0x22')](_0x229570);}};}function respondWithFilteredResult(_0xe80c9e,_0xb12c0c){return function(_0x1bc1c7){if(_0x1bc1c7){var _0x5da2bf=_0x1bc1c7['count'],_0x16c298=_0xb12c0c[_0x3f7c('0x23')],_0x5cae70=_0xb12c0c['offset']+_0xb12c0c[_0x3f7c('0x24')],_0x3e4e72;if(_0x5cae70>=_0x5da2bf){_0x5cae70=_0x5da2bf;_0x3e4e72=0xc8;}else{_0x3e4e72=0xce;}_0xe80c9e['status'](_0x3e4e72);return _0xe80c9e[_0x3f7c('0x25')](_0x3f7c('0x26'),_0x16c298+'-'+_0x5cae70+'/'+_0x5da2bf)[_0x3f7c('0x22')](_0x1bc1c7);}return null;};}function patchUpdates(_0x10a5e9){return function(_0x8c506){try{jsonpatch[_0x3f7c('0x27')](_0x8c506,_0x10a5e9,!![]);}catch(_0x2b6e78){return BPromise[_0x3f7c('0x28')](_0x2b6e78);}return _0x8c506[_0x3f7c('0x29')]();};}function saveUpdates(_0x5998af,_0x810ba5){return function(_0x36befa){if(_0x36befa){return _0x36befa['update'](_0x5998af)[_0x3f7c('0x2a')](function(_0xb0038b){return _0xb0038b;});}return null;};}function removeEntity(_0x53bad5,_0x274756){return function(_0x44c340){if(_0x44c340){return _0x44c340[_0x3f7c('0x2b')]()[_0x3f7c('0x2a')](function(){_0x53bad5['status'](0xcc)[_0x3f7c('0x21')]();});}};}function handleEntityNotFound(_0x5996de,_0x3e48c6){return function(_0x2f20e2){if(!_0x2f20e2){_0x5996de['sendStatus'](0x194);}return _0x2f20e2;};}function handleError(_0x35f47a,_0x55a940){_0x55a940=_0x55a940||0x1f4;return function(_0x233b13){logger['error'](_0x233b13[_0x3f7c('0x2c')]);if(_0x233b13[_0x3f7c('0x2d')]){delete _0x233b13[_0x3f7c('0x2d')];}_0x35f47a[_0x3f7c('0x20')](_0x55a940)[_0x3f7c('0x2e')](_0x233b13);};}exports[_0x3f7c('0x2f')]=function(_0x3223ab,_0x450882){var _0xa4030f={},_0x4ca997={},_0x521a52={'count':0x0,'rows':[]};var _0x4a3ce7=_[_0x3f7c('0x30')](db['ChatInternalMessage'][_0x3f7c('0x31')],function(_0x534cec){return{'name':_0x534cec[_0x3f7c('0x32')],'type':_0x534cec['type']['key']};});_0x4ca997['model']=_['map'](_0x4a3ce7,_0x3f7c('0x2d'));_0x4ca997[_0x3f7c('0x33')]=_[_0x3f7c('0x34')](_0x3223ab[_0x3f7c('0x33')]);_0x4ca997[_0x3f7c('0x35')]=_[_0x3f7c('0x36')](_0x4ca997[_0x3f7c('0x37')],_0x4ca997[_0x3f7c('0x33')]);_0xa4030f[_0x3f7c('0x38')]=_[_0x3f7c('0x36')](_0x4ca997['model'],qs['fields'](_0x3223ab['query'][_0x3f7c('0x39')]));_0xa4030f[_0x3f7c('0x38')]=_0xa4030f[_0x3f7c('0x38')][_0x3f7c('0x3a')]?_0xa4030f['attributes']:_0x4ca997[_0x3f7c('0x37')];if(!_0x3223ab['query'][_0x3f7c('0x3b')]('nolimit')){_0xa4030f['limit']=qs[_0x3f7c('0x24')](_0x3223ab['query'][_0x3f7c('0x24')]);_0xa4030f[_0x3f7c('0x23')]=qs['offset'](_0x3223ab[_0x3f7c('0x33')][_0x3f7c('0x23')]);}_0xa4030f['order']=qs[_0x3f7c('0x3c')](_0x3223ab[_0x3f7c('0x33')]['sort']);_0xa4030f[_0x3f7c('0x3d')]=qs['filters'](_[_0x3f7c('0x3e')](_0x3223ab['query'],_0x4ca997['filters']),_0x4a3ce7);if(_0x3223ab[_0x3f7c('0x33')][_0x3f7c('0x3f')]){_0xa4030f[_0x3f7c('0x3d')]=_[_0x3f7c('0x40')](_0xa4030f[_0x3f7c('0x3d')],{'$or':_['map'](_0x4a3ce7,function(_0x3f24d8){if(_0x3f24d8[_0x3f7c('0x41')]!==_0x3f7c('0x42')){var _0x41ab1e={};_0x41ab1e[_0x3f24d8[_0x3f7c('0x2d')]]={'$like':'%'+_0x3223ab[_0x3f7c('0x33')]['filter']+'%'};return _0x41ab1e;}})});}_0xa4030f=_['merge']({},_0xa4030f,_0x3223ab[_0x3f7c('0x43')]);var _0x5d6ff0={'where':_0xa4030f[_0x3f7c('0x3d')]};return db['ChatInternalMessage'][_0x3f7c('0x44')](_0x5d6ff0)['then'](function(_0x10d6b1){_0x521a52['count']=_0x10d6b1;if(_0x3223ab[_0x3f7c('0x33')][_0x3f7c('0x45')]){_0xa4030f['include']=[{'all':!![]}];}return db[_0x3f7c('0x46')][_0x3f7c('0x47')](_0xa4030f);})[_0x3f7c('0x2a')](function(_0x9aab56){_0x521a52[_0x3f7c('0x48')]=_0x9aab56;return _0x521a52;})['then'](respondWithFilteredResult(_0x450882,_0xa4030f))[_0x3f7c('0x49')](handleError(_0x450882,null));};exports[_0x3f7c('0x4a')]=function(_0x2a1803,_0x3a4924){var _0x495fb7={'raw':!![],'where':{'id':_0x2a1803[_0x3f7c('0x4b')]['id']}},_0x18a8a3={};_0x18a8a3[_0x3f7c('0x37')]=_[_0x3f7c('0x34')](db[_0x3f7c('0x46')]['rawAttributes']);_0x18a8a3[_0x3f7c('0x33')]=_[_0x3f7c('0x34')](_0x2a1803[_0x3f7c('0x33')]);_0x18a8a3['filters']=_[_0x3f7c('0x36')](_0x18a8a3[_0x3f7c('0x37')],_0x18a8a3[_0x3f7c('0x33')]);_0x495fb7[_0x3f7c('0x38')]=_[_0x3f7c('0x36')](_0x18a8a3[_0x3f7c('0x37')],qs[_0x3f7c('0x39')](_0x2a1803[_0x3f7c('0x33')][_0x3f7c('0x39')]));_0x495fb7[_0x3f7c('0x38')]=_0x495fb7[_0x3f7c('0x38')]['length']?_0x495fb7[_0x3f7c('0x38')]:_0x18a8a3[_0x3f7c('0x37')];if(_0x2a1803[_0x3f7c('0x33')][_0x3f7c('0x45')]){_0x495fb7['include']=[{'all':!![]}];}_0x495fb7=_['merge']({},_0x495fb7,_0x2a1803[_0x3f7c('0x43')]);return db[_0x3f7c('0x46')][_0x3f7c('0x4c')](_0x495fb7)['then'](handleEntityNotFound(_0x3a4924,null))[_0x3f7c('0x2a')](respondWithResult(_0x3a4924,null))[_0x3f7c('0x49')](handleError(_0x3a4924,null));};exports[_0x3f7c('0x4d')]=function(_0x4e2650,_0x19fa26){return db[_0x3f7c('0x46')][_0x3f7c('0x4d')](_0x4e2650[_0x3f7c('0x4e')],{})[_0x3f7c('0x2a')](respondWithResult(_0x19fa26,0xc9))[_0x3f7c('0x49')](handleError(_0x19fa26,null));};exports[_0x3f7c('0x4f')]=function(_0x3f1864,_0x12d946){if(_0x3f1864[_0x3f7c('0x4e')]['id']){delete _0x3f1864[_0x3f7c('0x4e')]['id'];}return db['ChatInternalMessage'][_0x3f7c('0x4c')]({'where':{'id':_0x3f1864['params']['id']}})[_0x3f7c('0x2a')](handleEntityNotFound(_0x12d946,null))[_0x3f7c('0x2a')](saveUpdates(_0x3f1864['body'],null))[_0x3f7c('0x2a')](respondWithResult(_0x12d946,null))[_0x3f7c('0x49')](handleError(_0x12d946,null));};exports[_0x3f7c('0x2b')]=function(_0x25c969,_0x2c2558){return db[_0x3f7c('0x46')]['find']({'where':{'id':_0x25c969['params']['id']}})['then'](handleEntityNotFound(_0x2c2558,null))[_0x3f7c('0x2a')](removeEntity(_0x2c2558,null))[_0x3f7c('0x49')](handleError(_0x2c2558,null));};exports[_0x3f7c('0x50')]=function(_0xcf987b,_0x5dd0c6){return db[_0x3f7c('0x46')][_0x3f7c('0x50')]()[_0x3f7c('0x2a')](respondWithResult(_0x5dd0c6,null))[_0x3f7c('0x49')](handleError(_0x5dd0c6,null));};function wrapUser(_0x315a16){return function(_0x31a4b2){var _0x1f6a09=_0x315a16['get']({'plain':!![]});_0x1f6a09[_0x3f7c('0x51')]=[];if(_0x31a4b2){_0x1f6a09[_0x3f7c('0x52')]=_0x31a4b2[_0x3f7c('0x53')];_0x1f6a09[_0x3f7c('0x54')]=_0x31a4b2;}else{_0x1f6a09[_0x3f7c('0x52')]=moment(0x0)[_0x3f7c('0x55')](_0x3f7c('0x56'));_0x1f6a09['lastMessage']={};}return _0x1f6a09;};}exports[_0x3f7c('0x57')]=function(_0x5d1cee,_0x457dcd,_0x2104b3){var _0x598212=[];return db[_0x3f7c('0x58')][_0x3f7c('0x47')]({'where':{'role':[_0x3f7c('0x59'),_0x3f7c('0x5a'),'user']},'attributes':['id','fullname','name',_0x3f7c('0x5b'),_0x3f7c('0x5c'),_0x3f7c('0x5d'),_0x3f7c('0x5e'),_0x3f7c('0x5f'),_0x3f7c('0x60'),'showWebBar'],'order':qs['sort'](_0x3f7c('0x61')),'include':[{'model':db[_0x3f7c('0x62')],'as':_0x3f7c('0x63'),'attributes':['id',_0x3f7c('0x2d'),_0x3f7c('0x41')],'through':{'attributes':[]}}]})[_0x3f7c('0x2a')](function(_0x526eb9){if(_0x526eb9){var _0x4405cc=_0x5d1cee[_0x3f7c('0x64')]['get']({'plain':!![]});if(!_0x4405cc)throw new Error(_0x3f7c('0x65'));if(_0x4405cc['role']==='user'){return db['UserProfileSection'][_0x3f7c('0x4c')]({'where':{'name':_0x3f7c('0x66'),'userProfileId':_0x4405cc[_0x3f7c('0x67')]},'raw':!![]})[_0x3f7c('0x2a')](function(_0x5241f2){if(_0x5241f2){if(_0x5241f2[_0x3f7c('0x68')]===0x0){return db[_0x3f7c('0x69')][_0x3f7c('0x47')]({'where':{'sectionId':_0x5241f2['id']},'raw':!![]})['then'](function(_0x362f84){var _0x3cccc6=[];if(_[_0x3f7c('0x6a')](_0x362f84)){_0x3cccc6=_['filter'](_0x526eb9,function(_0x97c3ad){if(_0x97c3ad[_0x3f7c('0x5b')]!==_0x3f7c('0x59')){return _0x97c3ad;}});return _0x3cccc6;}else{for(var _0x5f1204=0x0;_0x5f1204<_0x526eb9[_0x3f7c('0x3a')];_0x5f1204++){var _0x4b3a76=_0x526eb9[_0x5f1204];if(_0x4b3a76['role']===_0x3f7c('0x59')){var _0x1f8df4=_[_0x3f7c('0x4c')](_0x362f84,function(_0x96e77){return _0x96e77[_0x3f7c('0x6b')]===_0x4b3a76['id'];});if(_0x1f8df4)_0x3cccc6[_0x3f7c('0x6c')](_0x4b3a76);}else{_0x3cccc6[_0x3f7c('0x6c')](_0x4b3a76);}}return _0x3cccc6;}});}else{return _0x526eb9;}}else{var _0x55133c=_[_0x3f7c('0x3f')](_0x526eb9,function(_0x47a444){if(_0x47a444[_0x3f7c('0x5b')]!==_0x3f7c('0x59')){return _0x47a444;}});return _0x55133c;}});}else{return _0x526eb9;}}})[_0x3f7c('0x2a')](function(_0xcc625e){var _0x45dbf4=[];if(_0xcc625e){_0x598212=_0xcc625e;for(var _0x1760e7=0x0;_0x1760e7<_0xcc625e[_0x3f7c('0x3a')];_0x1760e7+=0x1){_0x598212[_0x1760e7][_0x3f7c('0x51')]=[];_0x45dbf4[_0x3f7c('0x6c')](db[_0x3f7c('0x46')][_0x3f7c('0x4c')]({'where':{'FromId':[_0x5d1cee['user']['id'],_0xcc625e[_0x1760e7]['id']],'ToId':[_0x5d1cee['user']['id'],_0xcc625e[_0x1760e7]['id']],'ChatGroupId':null},'attributes':['id',_0x3f7c('0x53'),_0x3f7c('0x6d'),'ToId','read',_0x3f7c('0x4e')],'order':qs[_0x3f7c('0x3c')]('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0x3f7c('0x2a')](wrapUser(_0xcc625e[_0x1760e7])));}return BPromise[_0x3f7c('0x6e')](_0x45dbf4);}return[];})['then'](function(_0x1bbc55){return{'rows':_0x1bbc55,'count':_0x1bbc55[_0x3f7c('0x3a')]};})[_0x3f7c('0x2a')](respondWithResult(_0x457dcd,null))[_0x3f7c('0x49')](handleError(_0x457dcd,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 1a85f5b..ea0e9d4 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 _0xaeaf=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove'];(function(_0x41bc2a,_0x5d16b8){var _0xe0e3d9=function(_0x28ebf6){while(--_0x28ebf6){_0x41bc2a['push'](_0x41bc2a['shift']());}};_0xe0e3d9(++_0x5d16b8);}(_0xaeaf,0x14e));var _0xfaea=function(_0x284240,_0x555b56){_0x284240=_0x284240-0x0;var _0x390667=_0xaeaf[_0x284240];return _0x390667;};'use strict';var EventEmitter=require(_0xfaea('0x0'));var ChatInternalMessage=require(_0xfaea('0x1'))['db'][_0xfaea('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xfaea('0x3')](0x0);var events={'afterCreate':_0xfaea('0x4'),'afterUpdate':_0xfaea('0x5'),'afterDestroy':_0xfaea('0x6')};function emitEvent(_0x5f592a){return function(_0xe432fa,_0x2061d3,_0x265544){ChatInternalMessageEvents[_0xfaea('0x7')](_0x5f592a+':'+_0xe432fa['id'],_0xe432fa);ChatInternalMessageEvents['emit'](_0x5f592a,_0xe432fa);_0x265544(null);};}for(var e in events){if(events[_0xfaea('0x8')](e)){var event=events[e];ChatInternalMessage[_0xfaea('0x9')](e,emitEvent(event));}}module[_0xfaea('0xa')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xd89f=['exports','events','../../mysqldb','ChatInternalMessage','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5edb6c,_0x595ab4){var _0x548a22=function(_0x4e6e35){while(--_0x4e6e35){_0x5edb6c['push'](_0x5edb6c['shift']());}};_0x548a22(++_0x595ab4);}(_0xd89f,0x191));var _0xfd89=function(_0x126578,_0x20a7ba){_0x126578=_0x126578-0x0;var _0x1ac788=_0xd89f[_0x126578];return _0x1ac788;};'use strict';var EventEmitter=require(_0xfd89('0x0'));var ChatInternalMessage=require(_0xfd89('0x1'))['db'][_0xfd89('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfd89('0x3'),'afterUpdate':_0xfd89('0x4'),'afterDestroy':_0xfd89('0x5')};function emitEvent(_0x2ff053){return function(_0x3de2e2,_0x15bdb8,_0x4e6429){ChatInternalMessageEvents[_0xfd89('0x6')](_0x2ff053+':'+_0x3de2e2['id'],_0x3de2e2);ChatInternalMessageEvents[_0xfd89('0x6')](_0x2ff053,_0x3de2e2);_0x4e6429(null);};}for(var e in events){if(events[_0xfd89('0x7')](e)){var event=events[e];ChatInternalMessage[_0xfd89('0x8')](e,emitEvent(event));}}module[_0xfd89('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 3930119..f4e0509 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 _0xac4a=['bluebird','rimraf','../../config/environment','./chatInternalMessage.attributes','define','chat_internal_messages','utf8mb4','lodash','util','../../config/logger','api','moment'];(function(_0x5c846d,_0x5c02ce){var _0xd064e4=function(_0x5631f3){while(--_0x5631f3){_0x5c846d['push'](_0x5c846d['shift']());}};_0xd064e4(++_0x5c02ce);}(_0xac4a,0x13f));var _0xaac4=function(_0x5f0dfd,_0x42ac17){_0x5f0dfd=_0x5f0dfd-0x0;var _0xe62a37=_0xac4a[_0x5f0dfd];return _0xe62a37;};'use strict';var _=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var moment=require(_0xaac4('0x4'));var BPromise=require(_0xaac4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var attributes=require(_0xaac4('0x8'));module['exports']=function(_0x1283a5,_0x53d03a){return _0x1283a5[_0xaac4('0x9')]('ChatInternalMessage',attributes,{'tableName':_0xaac4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xaac4('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xd8b0=['define','chat_internal_messages','utf8mb4','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4d0d4e,_0x2df972){var _0x19f63b=function(_0x1ce569){while(--_0x1ce569){_0x4d0d4e['push'](_0x4d0d4e['shift']());}};_0x19f63b(++_0x2df972);}(_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 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('./chatInternalMessage.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatInternalMessage',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0d8b('0x9'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 885b3d3..2ef7afb 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 _0x799f=['defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis'];(function(_0x55969b,_0x1ebe62){var _0x3d7fc1=function(_0x5f2dbe){while(--_0x5f2dbe){_0x55969b['push'](_0x55969b['shift']());}};_0x3d7fc1(++_0x1ebe62);}(_0x799f,0x1d0));var _0xf799=function(_0x5013f2,_0x3d896b){_0x5013f2=_0x5013f2-0x0;var _0x166b9f=_0x799f[_0x5013f2];return _0x166b9f;};'use strict';var _=require(_0xf799('0x0'));var util=require(_0xf799('0x1'));var moment=require(_0xf799('0x2'));var BPromise=require(_0xf799('0x3'));var rs=require(_0xf799('0x4'));var fs=require('fs');var Redis=require(_0xf799('0x5'));var db=require(_0xf799('0x6'))['db'];var utils=require(_0xf799('0x7'));var logger=require('../../config/logger')(_0xf799('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf799('0x9')][_0xf799('0xa')]({'port':0x232a});config[_0xf799('0xb')]=_[_0xf799('0xc')](config['redis'],{'host':_0xf799('0xd'),'port':0x18eb});var socket=require(_0xf799('0xe'))(new Redis(config[_0xf799('0xb')]));require(_0xf799('0xf'))[_0xf799('0x10')](socket);function respondWithRpcPromise(_0x1e8c37,_0x17d0f5,_0x1019d6){return new BPromise(function(_0x3c7782,_0x651e79){return client['request'](_0x1e8c37,_0x1019d6)['then'](function(_0x3495d7){logger[_0xf799('0x11')](_0xf799('0x12'),_0x17d0f5,_0xf799('0x13'));logger[_0xf799('0x14')](_0xf799('0x15'),_0x17d0f5,_0xf799('0x13'),JSON[_0xf799('0x16')](_0x3495d7));if(_0x3495d7['error']){if(_0x3495d7['error'][_0xf799('0x17')]===0x1f4){logger[_0xf799('0x18')](_0xf799('0x12'),_0x17d0f5,_0x3495d7[_0xf799('0x18')]['message']);return _0x651e79(_0x3495d7[_0xf799('0x18')][_0xf799('0x19')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x17d0f5,_0x3495d7[_0xf799('0x18')][_0xf799('0x19')]);return _0x3c7782(_0x3495d7['error']['message']);}else{logger[_0xf799('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x17d0f5,_0xf799('0x13'));_0x3c7782(_0x3495d7[_0xf799('0x1a')][_0xf799('0x19')]);}})[_0xf799('0x1b')](function(_0x18dc10){logger[_0xf799('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x17d0f5,_0x18dc10);_0x651e79(_0x18dc10);});});} \ No newline at end of file +var _0x1ae2=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3fa56b,_0x5284f7){var _0x362eb4=function(_0x13aa80){while(--_0x13aa80){_0x3fa56b['push'](_0x3fa56b['shift']());}};_0x362eb4(++_0x5284f7);}(_0x1ae2,0x6d));var _0x21ae=function(_0x24cd4f,_0x5dc624){_0x24cd4f=_0x24cd4f-0x0;var _0x5e91bc=_0x1ae2[_0x24cd4f];return _0x5e91bc;};'use strict';var _=require(_0x21ae('0x0'));var util=require(_0x21ae('0x1'));var moment=require(_0x21ae('0x2'));var BPromise=require(_0x21ae('0x3'));var rs=require(_0x21ae('0x4'));var fs=require('fs');var Redis=require(_0x21ae('0x5'));var db=require(_0x21ae('0x6'))['db'];var utils=require(_0x21ae('0x7'));var logger=require(_0x21ae('0x8'))(_0x21ae('0x9'));var config=require(_0x21ae('0xa'));var jayson=require(_0x21ae('0xb'));var client=jayson['client'][_0x21ae('0xc')]({'port':0x232a});config[_0x21ae('0xd')]=_['defaults'](config[_0x21ae('0xd')],{'host':_0x21ae('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x21ae('0xf'))[_0x21ae('0x10')](socket);function respondWithRpcPromise(_0x14af3e,_0x1057b1,_0x5c5d04){return new BPromise(function(_0x12749b,_0x48dd96){return client[_0x21ae('0x11')](_0x14af3e,_0x5c5d04)['then'](function(_0x489745){logger[_0x21ae('0x12')](_0x21ae('0x13'),_0x1057b1,_0x21ae('0x14'));logger[_0x21ae('0x15')](_0x21ae('0x16'),_0x1057b1,'request\x20sent',JSON[_0x21ae('0x17')](_0x489745));if(_0x489745['error']){if(_0x489745[_0x21ae('0x18')]['code']===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x1057b1,_0x489745['error']['message']);return _0x48dd96(_0x489745[_0x21ae('0x18')][_0x21ae('0x19')]);}logger[_0x21ae('0x18')](_0x21ae('0x13'),_0x1057b1,_0x489745[_0x21ae('0x18')][_0x21ae('0x19')]);return _0x12749b(_0x489745[_0x21ae('0x18')][_0x21ae('0x19')]);}else{logger[_0x21ae('0x12')](_0x21ae('0x13'),_0x1057b1,'request\x20sent');_0x12749b(_0x489745['result'][_0x21ae('0x19')]);}})[_0x21ae('0x1a')](function(_0xa9d9b4){logger[_0x21ae('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x1057b1,_0xa9d9b4);_0x48dd96(_0xa9d9b4);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 93fb49a..075a4b0 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 _0x5640=['./chatInternalMessage.events','remove','update','emit','removeListener','register','chatInternalMessage:'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x5640,0x111));var _0x0564=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5640[_0x17d9e3];return _0x14192d;};'use strict';var ChatInternalMessageEvents=require(_0x0564('0x0'));var events=['save',_0x0564('0x1'),_0x0564('0x2')];function createListener(_0x8ebafe,_0xa50680){return function(_0xc558b4){_0xa50680[_0x0564('0x3')](_0x8ebafe,_0xc558b4);};}function removeListener(_0x1cbb9d,_0x1c229d){return function(){ChatInternalMessageEvents[_0x0564('0x4')](_0x1cbb9d,_0x1c229d);};}exports[_0x0564('0x5')]=function(_0x23566f){for(var _0x1260bf=0x0,_0x3deac1=events['length'];_0x1260bf<_0x3deac1;_0x1260bf++){var _0x52b032=events[_0x1260bf];var _0x9e3a60=createListener(_0x0564('0x6')+_0x52b032,_0x23566f);ChatInternalMessageEvents['on'](_0x52b032,_0x9e3a60);}}; \ No newline at end of file +var _0xe700=['length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update'];(function(_0x369ae2,_0x5af5f8){var _0x1d0301=function(_0x6985f2){while(--_0x6985f2){_0x369ae2['push'](_0x369ae2['shift']());}};_0x1d0301(++_0x5af5f8);}(_0xe700,0x16a));var _0x0e70=function(_0x4a7379,_0x925fbe){_0x4a7379=_0x4a7379-0x0;var _0x47bdfb=_0xe700[_0x4a7379];return _0x47bdfb;};'use strict';var ChatInternalMessageEvents=require(_0x0e70('0x0'));var events=[_0x0e70('0x1'),_0x0e70('0x2'),_0x0e70('0x3')];function createListener(_0xbe3d20,_0x48dbb7){return function(_0x203ec7){_0x48dbb7['emit'](_0xbe3d20,_0x203ec7);};}function removeListener(_0x20335e,_0x2cc22e){return function(){ChatInternalMessageEvents['removeListener'](_0x20335e,_0x2cc22e);};}exports['register']=function(_0xf3ba11){for(var _0xc96045=0x0,_0x4415bb=events[_0x0e70('0x4')];_0xc96045<_0x4415bb;_0xc96045++){var _0x51382d=events[_0xc96045];var _0x33f0c3=createListener(_0x0e70('0x5')+_0x51382d,_0xf3ba11);ChatInternalMessageEvents['on'](_0x51382d,_0x33f0c3);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 2161cd1..223c482 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 _0xb7e7=['exports','multer','path','express','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','/describe','isAuthenticated','/users','getUsers','/:id','post','create','put','update','delete'];(function(_0x3f8983,_0x2af9cb){var _0x3f594f=function(_0x403ccb){while(--_0x403ccb){_0x3f8983['push'](_0x3f8983['shift']());}};_0x3f594f(++_0x2af9cb);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb7e7[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var auth=require(_0x7b7e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7e('0x4'));var controller=require(_0x7b7e('0x5'));router[_0x7b7e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b7e('0x6')](_0x7b7e('0x7'),auth[_0x7b7e('0x8')](),controller['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x6')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['show']);router[_0x7b7e('0xc')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0xb'),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['destroy']);module[_0x7b7e('0x11')]=router; \ No newline at end of file +var _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','put','update','delete'];(function(_0xa28e6e,_0xccf150){var _0x55451d=function(_0x3df686){while(--_0x3df686){_0xa28e6e['push'](_0xa28e6e['shift']());}};_0x55451d(++_0xccf150);}(_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 auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['get'](_0x3071('0xe'),auth[_0x3071('0x8')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')]('/',auth[_0x3071('0x8')](),controller['create']);router[_0x3071('0x11')](_0x3071('0xe'),controller[_0x3071('0x12')]);router[_0x3071('0x13')](_0x3071('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 598b690..bf6b6f9 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 _0x65fb=['sequelize','TEXT','medium','BOOLEAN','out','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x65fb,0x138));var _0xb65f=function(_0x5499ab,_0x4c1128){_0x5499ab=_0x5499ab-0x0;var _0x344478=_0x65fb[_0x5499ab];return _0x344478;};'use strict';var Sequelize=require(_0xb65f('0x0'));module['exports']={'body':{'type':Sequelize[_0xb65f('0x1')](_0xb65f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xb65f('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xb65f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xb65f('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xb65f('0x5')]},'providerResponse':{'type':Sequelize[_0xb65f('0x1')]}}; \ No newline at end of file +var _0x1b93=['DATE','STRING','sequelize','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x4a93bb,_0x495404){var _0x208468=function(_0x1d82b7){while(--_0x1d82b7){_0x4a93bb['push'](_0x4a93bb['shift']());}};_0x208468(++_0x495404);}(_0x1b93,0xe2));var _0x31b9=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x1b93[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x31b9('0x0'));module['exports']={'body':{'type':Sequelize[_0x31b9('0x1')](_0x31b9('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x31b9('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x31b9('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x31b9('0x4')]('in',_0x31b9('0x5')),'defaultValue':_0x31b9('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x31b9('0x6')]},'providerName':{'type':Sequelize[_0x31b9('0x7')]},'providerResponse':{'type':Sequelize[_0x31b9('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 1cb1c03..c36186f 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 _0x6ae2=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','stack','name','send','map','ChatMessage','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','chat-interactions','accept','chat','format','UserId','user','ChatInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','acceptMessage','interface','channel','event','EventManager','acceptmessage','parse','formData','agent','RejectMessage','rejectMessage','SIP/%s','rejectmessage','html-pdf','eml-format','rimraf'];(function(_0x88fafe,_0x3a31a2){var _0x257d2d=function(_0x4ee9b0){while(--_0x4ee9b0){_0x88fafe['push'](_0x88fafe['shift']());}};_0x257d2d(++_0x3a31a2);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x36e868,_0x2e2fb4){_0x36e868=_0x36e868-0x0;var _0x46926d=_0x6ae2[_0x36e868];return _0x46926d;};'use strict';var pdf=require(_0x26ae('0x0'));var emlformat=require(_0x26ae('0x1'));var rimraf=require(_0x26ae('0x2'));var zipdir=require(_0x26ae('0x3'));var jsonpatch=require(_0x26ae('0x4'));var rp=require(_0x26ae('0x5'));var moment=require(_0x26ae('0x6'));var BPromise=require(_0x26ae('0x7'));var Mustache=require(_0x26ae('0x8'));var util=require('util');var path=require(_0x26ae('0x9'));var sox=require(_0x26ae('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x26ae('0xb'));var squel=require(_0x26ae('0xc'));var crypto=require(_0x26ae('0xd'));var jsforce=require(_0x26ae('0xe'));var deskjs=require(_0x26ae('0xf'));var toCsv=require(_0x26ae('0x10'));var querystring=require(_0x26ae('0x11'));var Papa=require(_0x26ae('0x12'));var Redis=require(_0x26ae('0x13'));var authService=require(_0x26ae('0x14'));var qs=require(_0x26ae('0x15'));var as=require(_0x26ae('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x26ae('0x17'))('api');var utils=require(_0x26ae('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x26ae('0x19'))['db'];config[_0x26ae('0x1a')]=_[_0x26ae('0x1b')](config[_0x26ae('0x1a')],{'host':_0x26ae('0x1c'),'port':0x18eb});var socket=require(_0x26ae('0x1d'))(new Redis(config[_0x26ae('0x1a')]));require(_0x26ae('0x1e'))[_0x26ae('0x1f')](socket);var jayson=require(_0x26ae('0x20'));var client=jayson[_0x26ae('0x21')][_0x26ae('0x22')]({'port':0x232c});var client9002=jayson['client'][_0x26ae('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x32cd9e,_0x497974,_0x444397,_0x3426d8){return new BPromise(function(_0x4f71d8,_0x11a091){var _0x13ad43=_0x3426d8||client;return _0x13ad43[_0x26ae('0x23')](_0x32cd9e,_0x444397)[_0x26ae('0x24')](function(_0x3418c9){logger[_0x26ae('0x25')](_0x26ae('0x26'),_0x497974,_0x26ae('0x27'));logger[_0x26ae('0x28')](_0x26ae('0x29'),_0x497974,_0x26ae('0x27'),JSON[_0x26ae('0x2a')](_0x3418c9));if(_0x3418c9[_0x26ae('0x2b')]){if(_0x3418c9[_0x26ae('0x2b')][_0x26ae('0x2c')]===0x1f4){logger[_0x26ae('0x2b')](_0x26ae('0x26'),_0x497974,_0x3418c9[_0x26ae('0x2b')]['message']);return _0x11a091(_0x3418c9['error'][_0x26ae('0x2d')]);}logger['error'](_0x26ae('0x26'),_0x497974,_0x3418c9['error'][_0x26ae('0x2d')]);return _0x4f71d8(_0x3418c9[_0x26ae('0x2b')][_0x26ae('0x2d')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x497974,_0x26ae('0x27'));_0x4f71d8(_0x3418c9[_0x26ae('0x2e')][_0x26ae('0x2d')]);}})['catch'](function(_0x2caf20){logger[_0x26ae('0x2b')]('ChatMessage,\x20%s,\x20%s',_0x497974,_0x2caf20);_0x11a091(_0x2caf20);});});}function respondWithStatusCode(_0x1a0a32,_0x2658ed){_0x2658ed=_0x2658ed||0xcc;return function(_0x19eacc){if(_0x19eacc){return _0x1a0a32['sendStatus'](_0x2658ed);}return _0x1a0a32[_0x26ae('0x2f')](_0x2658ed)['end']();};}function respondWithResult(_0x28e5a4,_0x1ac4e6){_0x1ac4e6=_0x1ac4e6||0xc8;return function(_0x76c2b3){if(_0x76c2b3){return _0x28e5a4['status'](_0x1ac4e6)[_0x26ae('0x30')](_0x76c2b3);}};}function respondWithFilteredResult(_0x5a8301,_0x4cddc4){return function(_0x2f2e9d){if(_0x2f2e9d){var _0x2fcc89=_0x2f2e9d[_0x26ae('0x31')],_0x5979ec=_0x4cddc4[_0x26ae('0x32')],_0x5308c=_0x4cddc4[_0x26ae('0x32')]+_0x4cddc4['limit'],_0x2ef88f;if(_0x5308c>=_0x2fcc89){_0x5308c=_0x2fcc89;_0x2ef88f=0xc8;}else{_0x2ef88f=0xce;}_0x5a8301[_0x26ae('0x2f')](_0x2ef88f);return _0x5a8301[_0x26ae('0x33')](_0x26ae('0x34'),_0x5979ec+'-'+_0x5308c+'/'+_0x2fcc89)[_0x26ae('0x30')](_0x2f2e9d);}return null;};}function patchUpdates(_0x247219){return function(_0x56588f){try{jsonpatch[_0x26ae('0x35')](_0x56588f,_0x247219,!![]);}catch(_0x3c9267){return BPromise[_0x26ae('0x36')](_0x3c9267);}return _0x56588f[_0x26ae('0x37')]();};}function saveUpdates(_0xa3c097,_0x298df4){return function(_0x270dae){if(_0x270dae){return _0x270dae[_0x26ae('0x38')](_0xa3c097)['then'](function(_0x170dd4){return _0x170dd4;});}return null;};}function removeEntity(_0x543044,_0x4c961d){return function(_0x23c723){if(_0x23c723){return _0x23c723[_0x26ae('0x39')]()[_0x26ae('0x24')](function(){_0x543044['status'](0xcc)[_0x26ae('0x3a')]();});}};}function handleEntityNotFound(_0x3bbdaa,_0x3d2195){return function(_0x1a5ad4){if(!_0x1a5ad4){_0x3bbdaa[_0x26ae('0x3b')](0x194);}return _0x1a5ad4;};}function handleError(_0x20aa74,_0x9ed674){_0x9ed674=_0x9ed674||0x1f4;return function(_0x1afa84){logger[_0x26ae('0x2b')](_0x1afa84[_0x26ae('0x3c')]);if(_0x1afa84[_0x26ae('0x3d')]){delete _0x1afa84[_0x26ae('0x3d')];}_0x20aa74[_0x26ae('0x2f')](_0x9ed674)[_0x26ae('0x3e')](_0x1afa84);};}exports['index']=function(_0x14d0ed,_0x3b9bb4){var _0x2e5d70={},_0x484dec={},_0x20c60a={'count':0x0,'rows':[]};var _0x37855d=_[_0x26ae('0x3f')](db[_0x26ae('0x40')][_0x26ae('0x41')],function(_0x4e3f44){return{'name':_0x4e3f44[_0x26ae('0x42')],'type':_0x4e3f44[_0x26ae('0x43')][_0x26ae('0x44')]};});_0x484dec[_0x26ae('0x45')]=_[_0x26ae('0x3f')](_0x37855d,_0x26ae('0x3d'));_0x484dec['query']=_['keys'](_0x14d0ed['query']);_0x484dec[_0x26ae('0x46')]=_[_0x26ae('0x47')](_0x484dec[_0x26ae('0x45')],_0x484dec[_0x26ae('0x48')]);_0x2e5d70[_0x26ae('0x49')]=_['intersection'](_0x484dec[_0x26ae('0x45')],qs[_0x26ae('0x4a')](_0x14d0ed[_0x26ae('0x48')][_0x26ae('0x4a')]));_0x2e5d70[_0x26ae('0x49')]=_0x2e5d70[_0x26ae('0x49')][_0x26ae('0x4b')]?_0x2e5d70['attributes']:_0x484dec[_0x26ae('0x45')];if(!_0x14d0ed[_0x26ae('0x48')]['hasOwnProperty'](_0x26ae('0x4c'))){_0x2e5d70['limit']=qs[_0x26ae('0x4d')](_0x14d0ed[_0x26ae('0x48')][_0x26ae('0x4d')]);_0x2e5d70['offset']=qs[_0x26ae('0x32')](_0x14d0ed[_0x26ae('0x48')][_0x26ae('0x32')]);}_0x2e5d70[_0x26ae('0x4e')]=qs[_0x26ae('0x4f')](_0x14d0ed[_0x26ae('0x48')]['sort']);_0x2e5d70['where']=qs['filters'](_[_0x26ae('0x50')](_0x14d0ed[_0x26ae('0x48')],_0x484dec[_0x26ae('0x46')]),_0x37855d);if(_0x14d0ed[_0x26ae('0x48')][_0x26ae('0x51')]){_0x2e5d70['where']=_['merge'](_0x2e5d70[_0x26ae('0x52')],{'$or':_[_0x26ae('0x3f')](_0x37855d,function(_0x686879){if(_0x686879['type']!==_0x26ae('0x53')){var _0x50317d={};_0x50317d[_0x686879[_0x26ae('0x3d')]]={'$like':'%'+_0x14d0ed[_0x26ae('0x48')]['filter']+'%'};return _0x50317d;}})});}_0x2e5d70=_['merge']({},_0x2e5d70,_0x14d0ed[_0x26ae('0x54')]);var _0x4f0b67={'where':_0x2e5d70[_0x26ae('0x52')]};return db[_0x26ae('0x40')][_0x26ae('0x31')](_0x4f0b67)[_0x26ae('0x24')](function(_0x2c0d31){_0x20c60a[_0x26ae('0x31')]=_0x2c0d31;if(_0x14d0ed[_0x26ae('0x48')][_0x26ae('0x55')]){_0x2e5d70[_0x26ae('0x56')]=[{'all':!![]}];}return db[_0x26ae('0x40')][_0x26ae('0x57')](_0x2e5d70);})['then'](function(_0x205036){_0x20c60a[_0x26ae('0x58')]=_0x205036;return _0x20c60a;})[_0x26ae('0x24')](respondWithFilteredResult(_0x3b9bb4,_0x2e5d70))[_0x26ae('0x59')](handleError(_0x3b9bb4,null));};exports[_0x26ae('0x5a')]=function(_0x34d5e7,_0x2af049){var _0x38c4c2={'raw':!![],'where':{'id':_0x34d5e7[_0x26ae('0x5b')]['id']}},_0x27a516={};_0x27a516[_0x26ae('0x45')]=_[_0x26ae('0x5c')](db[_0x26ae('0x40')]['rawAttributes']);_0x27a516[_0x26ae('0x48')]=_['keys'](_0x34d5e7[_0x26ae('0x48')]);_0x27a516[_0x26ae('0x46')]=_[_0x26ae('0x47')](_0x27a516[_0x26ae('0x45')],_0x27a516[_0x26ae('0x48')]);_0x38c4c2[_0x26ae('0x49')]=_['intersection'](_0x27a516[_0x26ae('0x45')],qs['fields'](_0x34d5e7[_0x26ae('0x48')]['fields']));_0x38c4c2[_0x26ae('0x49')]=_0x38c4c2[_0x26ae('0x49')]['length']?_0x38c4c2[_0x26ae('0x49')]:_0x27a516[_0x26ae('0x45')];if(_0x34d5e7[_0x26ae('0x48')][_0x26ae('0x55')]){_0x38c4c2[_0x26ae('0x56')]=[{'all':!![]}];}_0x38c4c2=_['merge']({},_0x38c4c2,_0x34d5e7['options']);return db[_0x26ae('0x40')][_0x26ae('0x5d')](_0x38c4c2)['then'](handleEntityNotFound(_0x2af049,null))[_0x26ae('0x24')](respondWithResult(_0x2af049,null))[_0x26ae('0x59')](handleError(_0x2af049,null));};exports[_0x26ae('0x5e')]=function(_0x51b9ec,_0x162ace){return db[_0x26ae('0x40')][_0x26ae('0x5e')](_0x51b9ec[_0x26ae('0x5f')],{})[_0x26ae('0x24')](respondWithResult(_0x162ace,0xc9))[_0x26ae('0x59')](handleError(_0x162ace,null));};exports[_0x26ae('0x38')]=function(_0x2312e4,_0x3ca5a1){if(_0x2312e4[_0x26ae('0x5f')]['id']){delete _0x2312e4[_0x26ae('0x5f')]['id'];}return db[_0x26ae('0x40')][_0x26ae('0x5d')]({'where':{'id':_0x2312e4[_0x26ae('0x5b')]['id']}})[_0x26ae('0x24')](handleEntityNotFound(_0x3ca5a1,null))[_0x26ae('0x24')](saveUpdates(_0x2312e4[_0x26ae('0x5f')],null))[_0x26ae('0x24')](respondWithResult(_0x3ca5a1,null))[_0x26ae('0x59')](handleError(_0x3ca5a1,null));};exports[_0x26ae('0x39')]=function(_0x534b4a,_0x49aa21){return db[_0x26ae('0x40')][_0x26ae('0x5d')]({'where':{'id':_0x534b4a[_0x26ae('0x5b')]['id']}})['then'](handleEntityNotFound(_0x49aa21,null))[_0x26ae('0x24')](removeEntity(_0x49aa21,null))['catch'](handleError(_0x49aa21,null));};exports[_0x26ae('0x60')]=function(_0x29ff49,_0x57f922){return db[_0x26ae('0x40')][_0x26ae('0x60')]()[_0x26ae('0x24')](respondWithResult(_0x57f922,null))[_0x26ae('0x59')](handleError(_0x57f922,null));};var interaction_log=require(_0x26ae('0x17'))(_0x26ae('0x61'));exports[_0x26ae('0x62')]=function(_0x277156,_0xfb8aba,_0x4c183a){var _0x391e07={'agent':{},'channel':_0x26ae('0x63')};if(_0x277156[_0x26ae('0x5f')]['id']){delete _0x277156[_0x26ae('0x5f')]['id'];}_0x277156[_0x26ae('0x5f')]['read']=!![];_0x277156[_0x26ae('0x5f')]['readAt']=moment()[_0x26ae('0x64')]('YYYY-MM-DD\x20HH:mm:ss');_0x277156[_0x26ae('0x5f')][_0x26ae('0x65')]=_0x277156[_0x26ae('0x5f')][_0x26ae('0x65')]||_0x277156[_0x26ae('0x66')]['id'];_0x391e07['agent']['id']=_0x277156['body'][_0x26ae('0x65')];return db[_0x26ae('0x40')][_0x26ae('0x5d')]({'where':{'id':_0x277156['params']['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})['then'](handleEntityNotFound(_0xfb8aba,null))['then'](saveUpdates(_0x277156[_0x26ae('0x5f')],null))['then'](function(_0x3651ac){if(_0x3651ac){_0x391e07[_0x26ae('0x2d')]=_0x3651ac['get']({'plain':!![]});return db[_0x26ae('0x67')][_0x26ae('0x5d')]({'where':{'id':_0x3651ac['ChatInteractionId']}});}return null;})[_0x26ae('0x24')](handleEntityNotFound(_0xfb8aba,null))['then'](function(_0x3f071f){if(_0x3f071f){return _0x3f071f[_0x26ae('0x38')]({'UserId':_0x277156[_0x26ae('0x5f')][_0x26ae('0x65')],'read1stAt':_[_0x26ae('0x68')](_0x3f071f[_0x26ae('0x69')])?moment()[_0x26ae('0x64')](_0x26ae('0x6a')):undefined});}return null;})[_0x26ae('0x24')](function(_0x576eeb){if(_0x576eeb){_0x391e07['interaction']=_0x576eeb[_0x26ae('0x6b')]({'plain':!![]});interaction_log[_0x26ae('0x25')](_0x26ae('0x6c'),_0x277156[_0x26ae('0x66')]['id'],_0x277156[_0x26ae('0x66')][_0x26ae('0x3d')],_0x277156[_0x26ae('0x66')][_0x26ae('0x6d')],_0x391e07[_0x26ae('0x6e')]['id'],_0x277156[_0x26ae('0x5f')]?JSON[_0x26ae('0x2a')](_0x277156['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x26ae('0x6f'),_0x391e07);}return null;})[_0x26ae('0x24')](function(_0x4bec54){if(_0x4bec54){if(_0x277156['body']['manual']){_0x391e07['message'][_0x26ae('0x70')]=util[_0x26ae('0x64')]('SIP/%s',_0x277156['user'][_0x26ae('0x3d')]);_0x391e07[_0x26ae('0x2d')][_0x26ae('0x71')]=_0x391e07[_0x26ae('0x71')];_0x391e07[_0x26ae('0x2d')][_0x26ae('0x72')]=_0x26ae('0x62');return respondWithRpcPromise('EventManager',_0x26ae('0x73'),{'event':_0x26ae('0x74'),'message':_['merge'](_0x391e07[_0x26ae('0x2d')],JSON[_0x26ae('0x75')](_0x391e07[_0x26ae('0x6e')][_0x26ae('0x76')]))},client9002)[_0x26ae('0x24')](function(){return _0x391e07;});}return _0x391e07;}return null;})['then'](respondWithResult(_0xfb8aba,null))[_0x26ae('0x59')](handleError(_0xfb8aba,null));};var interaction_log=require(_0x26ae('0x17'))(_0x26ae('0x61'));exports['reject']=function(_0x1c013b,_0x4fbf27,_0x2fde0b){var _0x2be899={'agent':{},'channel':_0x26ae('0x63')};if(_0x1c013b[_0x26ae('0x5f')]['id']){delete _0x1c013b[_0x26ae('0x5f')]['id'];}_0x1c013b[_0x26ae('0x5f')][_0x26ae('0x65')]=_0x1c013b[_0x26ae('0x5f')][_0x26ae('0x65')]||_0x1c013b['user']['id'];_0x2be899[_0x26ae('0x77')]['id']=_0x1c013b[_0x26ae('0x5f')][_0x26ae('0x65')];return db[_0x26ae('0x40')][_0x26ae('0x5d')]({'where':{'id':_0x1c013b[_0x26ae('0x5b')]['id'],'UserId':null}})[_0x26ae('0x24')](handleEntityNotFound(_0x4fbf27,null))[_0x26ae('0x24')](function(_0xbf1c87){if(_0xbf1c87){_0x2be899[_0x26ae('0x2d')]=_0xbf1c87['get']({'plain':!![]});return db[_0x26ae('0x67')][_0x26ae('0x5d')]({'where':{'id':_0xbf1c87['ChatInteractionId']}});}return null;})[_0x26ae('0x24')](handleEntityNotFound(_0x4fbf27,null))[_0x26ae('0x24')](function(_0x5b9797){if(_0x5b9797){_0x2be899['interaction']=_0x5b9797[_0x26ae('0x6b')]({'plain':!![]});interaction_log[_0x26ae('0x25')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1c013b[_0x26ae('0x66')]['id'],_0x1c013b['user'][_0x26ae('0x3d')],_0x1c013b[_0x26ae('0x66')][_0x26ae('0x6d')],_0x2be899[_0x26ae('0x6e')]['id'],_0x1c013b['body']?JSON[_0x26ae('0x2a')](_0x1c013b['body']):'null');return respondWithRpcPromise(_0x26ae('0x78'),_0x26ae('0x79'),_0x2be899);}return null;})[_0x26ae('0x24')](function(_0x252e9d){if(_0x252e9d){_0x252e9d[_0x26ae('0x2d')]['interface']=util[_0x26ae('0x64')](_0x26ae('0x7a'),_0x1c013b[_0x26ae('0x66')][_0x26ae('0x3d')]);_0x252e9d[_0x26ae('0x2d')][_0x26ae('0x71')]=_0x2be899[_0x26ae('0x71')];_0x252e9d[_0x26ae('0x2d')][_0x26ae('0x72')]=_0x26ae('0x36');respondWithRpcPromise(_0x26ae('0x73'),'EventManager',{'event':_0x26ae('0x7b'),'message':_0x252e9d[_0x26ae('0x2d')]},client9002);return _0x2be899;}return null;})[_0x26ae('0x24')](respondWithResult(_0x4fbf27,null))['catch'](handleError(_0x4fbf27,null));}; \ No newline at end of file +var _0xef8e=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./chatMessage.socket','register','jayson/promise','http','client','request','then','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','limit','status','set','Content-Range','apply','reject','save','update','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','options','ChatMessage','count','includeAll','include','findAll','show','params','find','create','body','destroy','describe','chat-interactions','accept','chat','read','readAt','format','UserId','user','agent','CmContact','Contact','get','ChatInteraction','ChatInteractionId','isNil','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','interface'];(function(_0x1acb97,_0x2561f5){var _0x1eb306=function(_0x2a60fe){while(--_0x2a60fe){_0x1acb97['push'](_0x1acb97['shift']());}};_0x1eb306(++_0x2561f5);}(_0xef8e,0x1f0));var _0xeef8=function(_0xc23857,_0x58914c){_0xc23857=_0xc23857-0x0;var _0x2bca10=_0xef8e[_0xc23857];return _0x2bca10;};'use strict';var pdf=require(_0xeef8('0x0'));var emlformat=require(_0xeef8('0x1'));var rimraf=require(_0xeef8('0x2'));var zipdir=require(_0xeef8('0x3'));var jsonpatch=require(_0xeef8('0x4'));var rp=require(_0xeef8('0x5'));var moment=require(_0xeef8('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xeef8('0x7'));var util=require(_0xeef8('0x8'));var path=require(_0xeef8('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeef8('0xa'));var fs=require('fs');var _=require(_0xeef8('0xb'));var squel=require(_0xeef8('0xc'));var crypto=require(_0xeef8('0xd'));var jsforce=require(_0xeef8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xeef8('0xf'));var querystring=require('querystring');var Papa=require(_0xeef8('0x10'));var Redis=require(_0xeef8('0x11'));var authService=require(_0xeef8('0x12'));var qs=require(_0xeef8('0x13'));var as=require(_0xeef8('0x14'));var hardwareService=require(_0xeef8('0x15'));var logger=require(_0xeef8('0x16'))(_0xeef8('0x17'));var utils=require(_0xeef8('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xeef8('0x19'));var db=require('../../mysqldb')['db'];config[_0xeef8('0x1a')]=_[_0xeef8('0x1b')](config[_0xeef8('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xeef8('0x1c'))(new Redis(config['redis']));require(_0xeef8('0x1d'))[_0xeef8('0x1e')](socket);var jayson=require(_0xeef8('0x1f'));var client=jayson['client'][_0xeef8('0x20')]({'port':0x232c});var client9002=jayson[_0xeef8('0x21')][_0xeef8('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x4f14e4,_0x5adb83,_0x13e870,_0x15becb){return new BPromise(function(_0x3a47de,_0xf032a1){var _0x516657=_0x15becb||client;return _0x516657[_0xeef8('0x22')](_0x4f14e4,_0x13e870)[_0xeef8('0x23')](function(_0x4fc274){logger['info'](_0xeef8('0x24'),_0x5adb83,'request\x20sent');logger[_0xeef8('0x25')](_0xeef8('0x26'),_0x5adb83,_0xeef8('0x27'),JSON[_0xeef8('0x28')](_0x4fc274));if(_0x4fc274[_0xeef8('0x29')]){if(_0x4fc274[_0xeef8('0x29')][_0xeef8('0x2a')]===0x1f4){logger[_0xeef8('0x29')](_0xeef8('0x24'),_0x5adb83,_0x4fc274[_0xeef8('0x29')][_0xeef8('0x2b')]);return _0xf032a1(_0x4fc274['error'][_0xeef8('0x2b')]);}logger[_0xeef8('0x29')]('ChatMessage,\x20%s,\x20%s',_0x5adb83,_0x4fc274[_0xeef8('0x29')][_0xeef8('0x2b')]);return _0x3a47de(_0x4fc274['error']['message']);}else{logger[_0xeef8('0x2c')](_0xeef8('0x24'),_0x5adb83,'request\x20sent');_0x3a47de(_0x4fc274[_0xeef8('0x2d')]['message']);}})[_0xeef8('0x2e')](function(_0x268fd6){logger[_0xeef8('0x29')](_0xeef8('0x24'),_0x5adb83,_0x268fd6);_0xf032a1(_0x268fd6);});});}function respondWithStatusCode(_0xdfa6d3,_0x8e0b0c){_0x8e0b0c=_0x8e0b0c||0xcc;return function(_0x245c69){if(_0x245c69){return _0xdfa6d3[_0xeef8('0x2f')](_0x8e0b0c);}return _0xdfa6d3['status'](_0x8e0b0c)['end']();};}function respondWithResult(_0x3f0fc0,_0x2eb6ef){_0x2eb6ef=_0x2eb6ef||0xc8;return function(_0x5afac9){if(_0x5afac9){return _0x3f0fc0['status'](_0x2eb6ef)['json'](_0x5afac9);}};}function respondWithFilteredResult(_0x11f9ee,_0xe94f17){return function(_0x1636be){if(_0x1636be){var _0x233a75=_0x1636be['count'],_0x1830a2=_0xe94f17['offset'],_0x2c66b3=_0xe94f17['offset']+_0xe94f17[_0xeef8('0x30')],_0x316295;if(_0x2c66b3>=_0x233a75){_0x2c66b3=_0x233a75;_0x316295=0xc8;}else{_0x316295=0xce;}_0x11f9ee[_0xeef8('0x31')](_0x316295);return _0x11f9ee[_0xeef8('0x32')](_0xeef8('0x33'),_0x1830a2+'-'+_0x2c66b3+'/'+_0x233a75)['json'](_0x1636be);}return null;};}function patchUpdates(_0x191c48){return function(_0x159ebc){try{jsonpatch[_0xeef8('0x34')](_0x159ebc,_0x191c48,!![]);}catch(_0x4cda61){return BPromise[_0xeef8('0x35')](_0x4cda61);}return _0x159ebc[_0xeef8('0x36')]();};}function saveUpdates(_0x45edfd,_0x57b406){return function(_0x2fff82){if(_0x2fff82){return _0x2fff82[_0xeef8('0x37')](_0x45edfd)[_0xeef8('0x23')](function(_0x5830f9){return _0x5830f9;});}return null;};}function removeEntity(_0x20bdd3,_0x2adc2c){return function(_0x474968){if(_0x474968){return _0x474968['destroy']()['then'](function(){_0x20bdd3[_0xeef8('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4220f8,_0x128189){return function(_0x5d1f69){if(!_0x5d1f69){_0x4220f8[_0xeef8('0x2f')](0x194);}return _0x5d1f69;};}function handleError(_0x1f633b,_0x22e470){_0x22e470=_0x22e470||0x1f4;return function(_0x5ae31d){logger[_0xeef8('0x29')](_0x5ae31d[_0xeef8('0x38')]);if(_0x5ae31d[_0xeef8('0x39')]){delete _0x5ae31d[_0xeef8('0x39')];}_0x1f633b['status'](_0x22e470)['send'](_0x5ae31d);};}exports[_0xeef8('0x3a')]=function(_0x3dcd0e,_0x610044){var _0x2f6b89={},_0xbd19a0={},_0x57116e={'count':0x0,'rows':[]};var _0x51be0a=_[_0xeef8('0x3b')](db['ChatMessage'][_0xeef8('0x3c')],function(_0x10fc22){return{'name':_0x10fc22['fieldName'],'type':_0x10fc22[_0xeef8('0x3d')][_0xeef8('0x3e')]};});_0xbd19a0[_0xeef8('0x3f')]=_[_0xeef8('0x3b')](_0x51be0a,_0xeef8('0x39'));_0xbd19a0[_0xeef8('0x40')]=_[_0xeef8('0x41')](_0x3dcd0e[_0xeef8('0x40')]);_0xbd19a0[_0xeef8('0x42')]=_[_0xeef8('0x43')](_0xbd19a0[_0xeef8('0x3f')],_0xbd19a0[_0xeef8('0x40')]);_0x2f6b89[_0xeef8('0x44')]=_[_0xeef8('0x43')](_0xbd19a0[_0xeef8('0x3f')],qs[_0xeef8('0x45')](_0x3dcd0e['query'][_0xeef8('0x45')]));_0x2f6b89[_0xeef8('0x44')]=_0x2f6b89[_0xeef8('0x44')][_0xeef8('0x46')]?_0x2f6b89['attributes']:_0xbd19a0[_0xeef8('0x3f')];if(!_0x3dcd0e[_0xeef8('0x40')][_0xeef8('0x47')](_0xeef8('0x48'))){_0x2f6b89[_0xeef8('0x30')]=qs[_0xeef8('0x30')](_0x3dcd0e['query'][_0xeef8('0x30')]);_0x2f6b89['offset']=qs[_0xeef8('0x49')](_0x3dcd0e[_0xeef8('0x40')]['offset']);}_0x2f6b89['order']=qs[_0xeef8('0x4a')](_0x3dcd0e[_0xeef8('0x40')][_0xeef8('0x4a')]);_0x2f6b89[_0xeef8('0x4b')]=qs[_0xeef8('0x42')](_[_0xeef8('0x4c')](_0x3dcd0e[_0xeef8('0x40')],_0xbd19a0['filters']),_0x51be0a);if(_0x3dcd0e[_0xeef8('0x40')][_0xeef8('0x4d')]){_0x2f6b89[_0xeef8('0x4b')]=_[_0xeef8('0x4e')](_0x2f6b89[_0xeef8('0x4b')],{'$or':_[_0xeef8('0x3b')](_0x51be0a,function(_0x373c52){if(_0x373c52['type']!==_0xeef8('0x4f')){var _0x8b5417={};_0x8b5417[_0x373c52[_0xeef8('0x39')]]={'$like':'%'+_0x3dcd0e['query']['filter']+'%'};return _0x8b5417;}})});}_0x2f6b89=_[_0xeef8('0x4e')]({},_0x2f6b89,_0x3dcd0e[_0xeef8('0x50')]);var _0x4ee233={'where':_0x2f6b89[_0xeef8('0x4b')]};return db[_0xeef8('0x51')][_0xeef8('0x52')](_0x4ee233)['then'](function(_0x4ddf7f){_0x57116e[_0xeef8('0x52')]=_0x4ddf7f;if(_0x3dcd0e[_0xeef8('0x40')][_0xeef8('0x53')]){_0x2f6b89[_0xeef8('0x54')]=[{'all':!![]}];}return db[_0xeef8('0x51')][_0xeef8('0x55')](_0x2f6b89);})[_0xeef8('0x23')](function(_0x46adbf){_0x57116e['rows']=_0x46adbf;return _0x57116e;})[_0xeef8('0x23')](respondWithFilteredResult(_0x610044,_0x2f6b89))[_0xeef8('0x2e')](handleError(_0x610044,null));};exports[_0xeef8('0x56')]=function(_0x58c6d1,_0xe5b931){var _0x35f4b={'raw':!![],'where':{'id':_0x58c6d1[_0xeef8('0x57')]['id']}},_0x389cbc={};_0x389cbc[_0xeef8('0x3f')]=_[_0xeef8('0x41')](db[_0xeef8('0x51')][_0xeef8('0x3c')]);_0x389cbc[_0xeef8('0x40')]=_[_0xeef8('0x41')](_0x58c6d1[_0xeef8('0x40')]);_0x389cbc[_0xeef8('0x42')]=_[_0xeef8('0x43')](_0x389cbc[_0xeef8('0x3f')],_0x389cbc[_0xeef8('0x40')]);_0x35f4b[_0xeef8('0x44')]=_['intersection'](_0x389cbc[_0xeef8('0x3f')],qs[_0xeef8('0x45')](_0x58c6d1['query'][_0xeef8('0x45')]));_0x35f4b[_0xeef8('0x44')]=_0x35f4b[_0xeef8('0x44')][_0xeef8('0x46')]?_0x35f4b[_0xeef8('0x44')]:_0x389cbc['model'];if(_0x58c6d1[_0xeef8('0x40')][_0xeef8('0x53')]){_0x35f4b[_0xeef8('0x54')]=[{'all':!![]}];}_0x35f4b=_[_0xeef8('0x4e')]({},_0x35f4b,_0x58c6d1[_0xeef8('0x50')]);return db['ChatMessage'][_0xeef8('0x58')](_0x35f4b)['then'](handleEntityNotFound(_0xe5b931,null))[_0xeef8('0x23')](respondWithResult(_0xe5b931,null))[_0xeef8('0x2e')](handleError(_0xe5b931,null));};exports[_0xeef8('0x59')]=function(_0xa956e9,_0x2e471e){return db['ChatMessage'][_0xeef8('0x59')](_0xa956e9['body'],{})['then'](respondWithResult(_0x2e471e,0xc9))['catch'](handleError(_0x2e471e,null));};exports[_0xeef8('0x37')]=function(_0x55ba89,_0x251921){if(_0x55ba89[_0xeef8('0x5a')]['id']){delete _0x55ba89['body']['id'];}return db[_0xeef8('0x51')][_0xeef8('0x58')]({'where':{'id':_0x55ba89[_0xeef8('0x57')]['id']}})['then'](handleEntityNotFound(_0x251921,null))['then'](saveUpdates(_0x55ba89[_0xeef8('0x5a')],null))[_0xeef8('0x23')](respondWithResult(_0x251921,null))[_0xeef8('0x2e')](handleError(_0x251921,null));};exports[_0xeef8('0x5b')]=function(_0x4a6c0c,_0x202eff){return db[_0xeef8('0x51')]['find']({'where':{'id':_0x4a6c0c[_0xeef8('0x57')]['id']}})[_0xeef8('0x23')](handleEntityNotFound(_0x202eff,null))[_0xeef8('0x23')](removeEntity(_0x202eff,null))[_0xeef8('0x2e')](handleError(_0x202eff,null));};exports[_0xeef8('0x5c')]=function(_0x229269,_0x3fe15e){return db[_0xeef8('0x51')][_0xeef8('0x5c')]()[_0xeef8('0x23')](respondWithResult(_0x3fe15e,null))['catch'](handleError(_0x3fe15e,null));};var interaction_log=require(_0xeef8('0x16'))(_0xeef8('0x5d'));exports[_0xeef8('0x5e')]=function(_0x45530e,_0x5b5699,_0x2a4f68){var _0x511adc={'agent':{},'channel':_0xeef8('0x5f')};if(_0x45530e[_0xeef8('0x5a')]['id']){delete _0x45530e[_0xeef8('0x5a')]['id'];}_0x45530e[_0xeef8('0x5a')][_0xeef8('0x60')]=!![];_0x45530e['body'][_0xeef8('0x61')]=moment()[_0xeef8('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x45530e['body']['UserId']=_0x45530e[_0xeef8('0x5a')][_0xeef8('0x63')]||_0x45530e[_0xeef8('0x64')]['id'];_0x511adc[_0xeef8('0x65')]['id']=_0x45530e[_0xeef8('0x5a')]['UserId'];return db['ChatMessage']['find']({'where':{'id':_0x45530e[_0xeef8('0x57')]['id'],'UserId':null},'include':[{'model':db[_0xeef8('0x66')],'as':_0xeef8('0x67')}]})[_0xeef8('0x23')](handleEntityNotFound(_0x5b5699,null))[_0xeef8('0x23')](saveUpdates(_0x45530e[_0xeef8('0x5a')],null))[_0xeef8('0x23')](function(_0x182364){if(_0x182364){_0x511adc[_0xeef8('0x2b')]=_0x182364[_0xeef8('0x68')]({'plain':!![]});return db[_0xeef8('0x69')][_0xeef8('0x58')]({'where':{'id':_0x182364[_0xeef8('0x6a')]}});}return null;})[_0xeef8('0x23')](handleEntityNotFound(_0x5b5699,null))[_0xeef8('0x23')](function(_0x496fae){if(_0x496fae){return _0x496fae['update']({'UserId':_0x45530e['body'][_0xeef8('0x63')],'read1stAt':_[_0xeef8('0x6b')](_0x496fae['read1stAt'])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x3dfdfa){if(_0x3dfdfa){_0x511adc[_0xeef8('0x6c')]=_0x3dfdfa[_0xeef8('0x68')]({'plain':!![]});interaction_log[_0xeef8('0x2c')](_0xeef8('0x6d'),_0x45530e['user']['id'],_0x45530e[_0xeef8('0x64')][_0xeef8('0x39')],_0x45530e[_0xeef8('0x64')][_0xeef8('0x6e')],_0x511adc['interaction']['id'],_0x45530e[_0xeef8('0x5a')]?JSON['stringify'](_0x45530e[_0xeef8('0x5a')]):_0xeef8('0x6f'));return respondWithRpcPromise('AcceptMessage',_0xeef8('0x70'),_0x511adc);}return null;})[_0xeef8('0x23')](function(_0x3d820d){if(_0x3d820d){if(_0x45530e[_0xeef8('0x5a')][_0xeef8('0x71')]){_0x511adc[_0xeef8('0x2b')]['interface']=util['format'](_0xeef8('0x72'),_0x45530e[_0xeef8('0x64')][_0xeef8('0x39')]);_0x511adc[_0xeef8('0x2b')][_0xeef8('0x73')]=_0x511adc[_0xeef8('0x73')];_0x511adc[_0xeef8('0x2b')][_0xeef8('0x74')]=_0xeef8('0x5e');return respondWithRpcPromise('EventManager',_0xeef8('0x75'),{'event':_0xeef8('0x76'),'message':_['merge'](_0x511adc[_0xeef8('0x2b')],JSON[_0xeef8('0x77')](_0x511adc[_0xeef8('0x6c')][_0xeef8('0x78')]))},client9002)[_0xeef8('0x23')](function(){return _0x511adc;});}return _0x511adc;}return null;})['then'](respondWithResult(_0x5b5699,null))[_0xeef8('0x2e')](handleError(_0x5b5699,null));};var interaction_log=require(_0xeef8('0x16'))('chat-interactions');exports['reject']=function(_0x460506,_0x26f9ae,_0x35ad5e){var _0x1d9bf8={'agent':{},'channel':'chat'};if(_0x460506[_0xeef8('0x5a')]['id']){delete _0x460506['body']['id'];}_0x460506[_0xeef8('0x5a')][_0xeef8('0x63')]=_0x460506[_0xeef8('0x5a')][_0xeef8('0x63')]||_0x460506[_0xeef8('0x64')]['id'];_0x1d9bf8[_0xeef8('0x65')]['id']=_0x460506[_0xeef8('0x5a')][_0xeef8('0x63')];return db['ChatMessage'][_0xeef8('0x58')]({'where':{'id':_0x460506[_0xeef8('0x57')]['id'],'UserId':null}})[_0xeef8('0x23')](handleEntityNotFound(_0x26f9ae,null))[_0xeef8('0x23')](function(_0x2ce232){if(_0x2ce232){_0x1d9bf8[_0xeef8('0x2b')]=_0x2ce232['get']({'plain':!![]});return db[_0xeef8('0x69')][_0xeef8('0x58')]({'where':{'id':_0x2ce232[_0xeef8('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x26f9ae,null))[_0xeef8('0x23')](function(_0x20a2f2){if(_0x20a2f2){_0x1d9bf8[_0xeef8('0x6c')]=_0x20a2f2[_0xeef8('0x68')]({'plain':!![]});interaction_log[_0xeef8('0x2c')](_0xeef8('0x79'),_0x460506[_0xeef8('0x64')]['id'],_0x460506[_0xeef8('0x64')][_0xeef8('0x39')],_0x460506[_0xeef8('0x64')][_0xeef8('0x6e')],_0x1d9bf8['interaction']['id'],_0x460506[_0xeef8('0x5a')]?JSON[_0xeef8('0x28')](_0x460506[_0xeef8('0x5a')]):'null');return respondWithRpcPromise(_0xeef8('0x7a'),'rejectMessage',_0x1d9bf8);}return null;})[_0xeef8('0x23')](function(_0x11eb15){if(_0x11eb15){_0x11eb15['message'][_0xeef8('0x7b')]=util['format'](_0xeef8('0x72'),_0x460506[_0xeef8('0x64')][_0xeef8('0x39')]);_0x11eb15[_0xeef8('0x2b')]['channel']=_0x1d9bf8[_0xeef8('0x73')];_0x11eb15['message'][_0xeef8('0x74')]='reject';respondWithRpcPromise(_0xeef8('0x75'),'EventManager',{'event':'rejectmessage','message':_0x11eb15[_0xeef8('0x2b')]},client9002);return _0x1d9bf8;}return null;})[_0xeef8('0x23')](respondWithResult(_0x26f9ae,null))[_0xeef8('0x2e')](handleError(_0x26f9ae,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 28c89f9..375aff2 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 _0x36e7=['save','emit','hook','events','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x32357c,_0x527372){var _0x4e5f39=function(_0x15fe36){while(--_0x15fe36){_0x32357c['push'](_0x32357c['shift']());}};_0x4e5f39(++_0x527372);}(_0x36e7,0x9d));var _0x736e=function(_0x2a659d,_0x3d07f4){_0x2a659d=_0x2a659d-0x0;var _0x11685b=_0x36e7[_0x2a659d];return _0x11685b;};'use strict';var EventEmitter=require(_0x736e('0x0'));var ChatMessage=require(_0x736e('0x1'))['db'][_0x736e('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x736e('0x3')](0x0);var events={'afterCreate':_0x736e('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x706426){return function(_0x49da7f,_0x3dd3e1,_0x4342e9){ChatMessageEvents[_0x736e('0x5')](_0x706426+':'+_0x49da7f['id'],_0x49da7f);ChatMessageEvents[_0x736e('0x5')](_0x706426,_0x49da7f);_0x4342e9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x736e('0x6')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x724e=['events','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x1e4a7e,_0x57c055){var _0x3c021f=function(_0x335a0b){while(--_0x335a0b){_0x1e4a7e['push'](_0x1e4a7e['shift']());}};_0x3c021f(++_0x57c055);}(_0x724e,0xf0));var _0xe724=function(_0x3c5442,_0x5c6a6b){_0x3c5442=_0x3c5442-0x0;var _0x591149=_0x724e[_0x3c5442];return _0x591149;};'use strict';var EventEmitter=require(_0xe724('0x0'));var ChatMessage=require(_0xe724('0x1'))['db'][_0xe724('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xe724('0x3')](0x0);var events={'afterCreate':_0xe724('0x4'),'afterUpdate':_0xe724('0x5'),'afterDestroy':_0xe724('0x6')};function emitEvent(_0x495252){return function(_0x1d14a0,_0x654f66,_0x598eeb){ChatMessageEvents[_0xe724('0x7')](_0x495252+':'+_0x1d14a0['id'],_0x1d14a0);ChatMessageEvents[_0xe724('0x7')](_0x495252,_0x1d14a0);_0x598eeb(null);};}for(var e in events){if(events[_0xe724('0x8')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xe724('0x9')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 390c9e2..73559d7 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 _0xdeac=['toLowerCase','secret','isNil','ChatInteraction','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./chatMessage.attributes','exports','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction'];(function(_0x8082ef,_0x369378){var _0x1c83b8=function(_0x17d95f){while(--_0x17d95f){_0x8082ef['push'](_0x8082ef['shift']());}};_0x1c83b8(++_0x369378);}(_0xdeac,0x97));var _0xcdea=function(_0x5d2eb5,_0x4d2cbd){_0x5d2eb5=_0x5d2eb5-0x0;var _0x5dfd99=_0xdeac[_0x5d2eb5];return _0x5dfd99;};'use strict';var _=require('lodash');var util=require(_0xcdea('0x0'));var logger=require(_0xcdea('0x1'))('api');var moment=require(_0xcdea('0x2'));var BPromise=require(_0xcdea('0x3'));var rp=require(_0xcdea('0x4'));var fs=require('fs');var path=require(_0xcdea('0x5'));var rimraf=require(_0xcdea('0x6'));var config=require('../../config/environment');var attributes=require(_0xcdea('0x7'));module[_0xcdea('0x8')]=function(_0x355930,_0x31baa2){return _0x355930['define'](_0xcdea('0x9'),attributes,{'tableName':_0xcdea('0xa'),'paranoid':![],'indexes':[{'name':_0xcdea('0xb'),'fields':[_0xcdea('0xc')],'type':_0xcdea('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x399df2,_0x5f16f3,_0x56b599){var _0x55f7dc=_0x355930[_0xcdea('0xe')];var _0x2e4c5f=_0x399df2[_0xcdea('0xf')]({'plain':!![]});if(_0x2e4c5f[_0xcdea('0x10')][_0xcdea('0x11')]()==='in'||_0x2e4c5f['direction'][_0xcdea('0x11')]()==='out'&&!_0x2e4c5f[_0xcdea('0x12')]&&!_[_0xcdea('0x13')](_0x2e4c5f['UserId'])){_0x55f7dc[_0xcdea('0x14')]['findOne']({'where':{'id':_0x2e4c5f[_0xcdea('0x15')]}})[_0xcdea('0x16')](function(_0x4b95e6){if(_0x4b95e6){_0x4b95e6[_0xcdea('0x17')]({'lastMsgAt':_0x2e4c5f[_0xcdea('0x18')],'lastMsgDirection':_0x2e4c5f['direction'][_0xcdea('0x11')]()});}})[_0xcdea('0x19')](function(_0x5459c7){console[_0xcdea('0x1a')](_0x5459c7);});}_0x56b599();}},'charset':_0xcdea('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb652=['body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','then','createdAt','catch','utf8mb4_unicode_ci','util','moment','request-promise','path','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages'];(function(_0x15bd72,_0x61624d){var _0x5c30dc=function(_0xe010d4){while(--_0xe010d4){_0x15bd72['push'](_0x15bd72['shift']());}};_0x5c30dc(++_0x61624d);}(_0xb652,0x1e3));var _0x2b65=function(_0x1ffbe6,_0xd50c91){_0x1ffbe6=_0x1ffbe6-0x0;var _0x2726ae=_0xb652[_0x1ffbe6];return _0x2726ae;};'use strict';var _=require('lodash');var util=require(_0x2b65('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x2b65('0x1'));var BPromise=require('bluebird');var rp=require(_0x2b65('0x2'));var fs=require('fs');var path=require(_0x2b65('0x3'));var rimraf=require('rimraf');var config=require(_0x2b65('0x4'));var attributes=require(_0x2b65('0x5'));module[_0x2b65('0x6')]=function(_0x4b58a5,_0x35bba4){return _0x4b58a5[_0x2b65('0x7')](_0x2b65('0x8'),attributes,{'tableName':_0x2b65('0x9'),'paranoid':![],'indexes':[{'name':_0x2b65('0xa'),'fields':[_0x2b65('0xb')],'type':_0x2b65('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d64f7,_0xa524e5,_0x5becfa){var _0x1ab175=_0x4b58a5[_0x2b65('0xd')];var _0x5ad285=_0x3d64f7['get']({'plain':!![]});if(_0x5ad285[_0x2b65('0xe')][_0x2b65('0xf')]()==='in'||_0x5ad285[_0x2b65('0xe')][_0x2b65('0xf')]()===_0x2b65('0x10')&&!_0x5ad285[_0x2b65('0x11')]&&!_[_0x2b65('0x12')](_0x5ad285[_0x2b65('0x13')])){_0x1ab175[_0x2b65('0x14')][_0x2b65('0x15')]({'where':{'id':_0x5ad285['ChatInteractionId']}})[_0x2b65('0x16')](function(_0x2fe1cb){if(_0x2fe1cb){_0x2fe1cb['update']({'lastMsgAt':_0x5ad285[_0x2b65('0x17')],'lastMsgDirection':_0x5ad285[_0x2b65('0xe')][_0x2b65('0xf')]()});}})[_0x2b65('0x18')](function(_0x3edddd){console['error'](_0x3edddd);});}_0x5becfa();}},'charset':'utf8mb4','collate':_0x2b65('0x19')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index dc8cc2e..fac068b 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 _0x05ee=['http','redis','localhost','./chatMessage.socket','request','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','CreateChatMessage','ChatMessage','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x05ee,0x1e6));var _0xe05e=function(_0x51e79c,_0x51485e){_0x51e79c=_0x51e79c-0x0;var _0x2467be=_0x05ee[_0x51e79c];return _0x2467be;};'use strict';var _=require(_0xe05e('0x0'));var util=require(_0xe05e('0x1'));var moment=require(_0xe05e('0x2'));var BPromise=require(_0xe05e('0x3'));var rs=require(_0xe05e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe05e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe05e('0x6'))('rpc');var config=require(_0xe05e('0x7'));var jayson=require(_0xe05e('0x8'));var client=jayson[_0xe05e('0x9')][_0xe05e('0xa')]({'port':0x232a});config[_0xe05e('0xb')]=_['defaults'](config[_0xe05e('0xb')],{'host':_0xe05e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe05e('0xb')]));require(_0xe05e('0xd'))['register'](socket);function respondWithRpcPromise(_0x2dd19c,_0x2eb6f7,_0x2b8b4b){return new BPromise(function(_0x282d8a,_0xd060ed){return client[_0xe05e('0xe')](_0x2dd19c,_0x2b8b4b)['then'](function(_0x5c0677){logger['info'](_0xe05e('0xf'),_0x2eb6f7,_0xe05e('0x10'));logger[_0xe05e('0x11')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x2eb6f7,_0xe05e('0x10'),JSON[_0xe05e('0x12')](_0x5c0677));if(_0x5c0677['error']){if(_0x5c0677[_0xe05e('0x13')]['code']===0x1f4){logger[_0xe05e('0x13')]('ChatMessage,\x20%s,\x20%s',_0x2eb6f7,_0x5c0677['error'][_0xe05e('0x14')]);return _0xd060ed(_0x5c0677[_0xe05e('0x13')][_0xe05e('0x14')]);}logger[_0xe05e('0x13')]('ChatMessage,\x20%s,\x20%s',_0x2eb6f7,_0x5c0677[_0xe05e('0x13')][_0xe05e('0x14')]);return _0x282d8a(_0x5c0677['error']['message']);}else{logger[_0xe05e('0x15')](_0xe05e('0xf'),_0x2eb6f7,'request\x20sent');_0x282d8a(_0x5c0677[_0xe05e('0x16')][_0xe05e('0x14')]);}})[_0xe05e('0x17')](function(_0x2ef6b0){logger[_0xe05e('0x13')](_0xe05e('0xf'),_0x2eb6f7,_0x2ef6b0);_0xd060ed(_0x2ef6b0);});});}exports[_0xe05e('0x18')]=function(_0x49be91){var _0x5dba8c=this;return new Promise(function(_0x5aae60,_0x5efde7){return db[_0xe05e('0x19')][_0xe05e('0x1a')](_0x49be91[_0xe05e('0x1b')],{'raw':_0x49be91[_0xe05e('0x1c')]?_0x49be91['options'][_0xe05e('0x1d')]===undefined?!![]:![]:!![]})[_0xe05e('0x1e')](function(_0x30cb11){logger[_0xe05e('0x15')](_0xe05e('0x18'),_0x49be91);logger['debug']('CreateChatMessage',_0x49be91,JSON[_0xe05e('0x12')](_0x30cb11));_0x5aae60(_0x30cb11);})[_0xe05e('0x17')](function(_0x59affc){logger['error']('CreateChatMessage',_0x59affc[_0xe05e('0x14')],_0x49be91);_0x5efde7(_0x5dba8c[_0xe05e('0x13')](0x1f4,_0x59affc[_0xe05e('0x14')]));});});}; \ No newline at end of file +var _0x7e8a=['stringify','error','code','message','result','catch','CreateChatMessage','create','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','./chatMessage.socket','register','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s'];(function(_0x484283,_0x43d088){var _0x4c6e17=function(_0x5a4d10){while(--_0x5a4d10){_0x484283['push'](_0x484283['shift']());}};_0x4c6e17(++_0x43d088);}(_0x7e8a,0x14b));var _0xa7e8=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x7e8a[_0x45d3f0];return _0x314b79;};'use strict';var _=require('lodash');var util=require(_0xa7e8('0x0'));var moment=require(_0xa7e8('0x1'));var BPromise=require(_0xa7e8('0x2'));var rs=require(_0xa7e8('0x3'));var fs=require('fs');var Redis=require(_0xa7e8('0x4'));var db=require(_0xa7e8('0x5'))['db'];var utils=require(_0xa7e8('0x6'));var logger=require('../../config/logger')(_0xa7e8('0x7'));var config=require('../../config/environment');var jayson=require(_0xa7e8('0x8'));var client=jayson['client'][_0xa7e8('0x9')]({'port':0x232a});config[_0xa7e8('0xa')]=_[_0xa7e8('0xb')](config[_0xa7e8('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa7e8('0xc'))(new Redis(config[_0xa7e8('0xa')]));require(_0xa7e8('0xd'))[_0xa7e8('0xe')](socket);function respondWithRpcPromise(_0x50fcfd,_0x5e41d5,_0x294cdb){return new BPromise(function(_0x3bc13d,_0x1214e9){return client['request'](_0x50fcfd,_0x294cdb)[_0xa7e8('0xf')](function(_0x286046){logger[_0xa7e8('0x10')](_0xa7e8('0x11'),_0x5e41d5,_0xa7e8('0x12'));logger[_0xa7e8('0x13')](_0xa7e8('0x14'),_0x5e41d5,'request\x20sent',JSON[_0xa7e8('0x15')](_0x286046));if(_0x286046[_0xa7e8('0x16')]){if(_0x286046[_0xa7e8('0x16')][_0xa7e8('0x17')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x5e41d5,_0x286046['error'][_0xa7e8('0x18')]);return _0x1214e9(_0x286046[_0xa7e8('0x16')][_0xa7e8('0x18')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x5e41d5,_0x286046['error']['message']);return _0x3bc13d(_0x286046['error'][_0xa7e8('0x18')]);}else{logger[_0xa7e8('0x10')]('ChatMessage,\x20%s,\x20%s',_0x5e41d5,_0xa7e8('0x12'));_0x3bc13d(_0x286046[_0xa7e8('0x19')]['message']);}})[_0xa7e8('0x1a')](function(_0x449cd6){logger[_0xa7e8('0x16')](_0xa7e8('0x11'),_0x5e41d5,_0x449cd6);_0x1214e9(_0x449cd6);});});}exports[_0xa7e8('0x1b')]=function(_0x18b454){var _0x126726=this;return new Promise(function(_0x40ea60,_0x11780a){return db['ChatMessage'][_0xa7e8('0x1c')](_0x18b454[_0xa7e8('0x1d')],{'raw':_0x18b454[_0xa7e8('0x1e')]?_0x18b454[_0xa7e8('0x1e')][_0xa7e8('0x1f')]===undefined?!![]:![]:!![]})[_0xa7e8('0xf')](function(_0x145508){logger['info']('CreateChatMessage',_0x18b454);logger[_0xa7e8('0x13')](_0xa7e8('0x1b'),_0x18b454,JSON[_0xa7e8('0x15')](_0x145508));_0x40ea60(_0x145508);})[_0xa7e8('0x1a')](function(_0x57b47a){logger[_0xa7e8('0x16')]('CreateChatMessage',_0x57b47a[_0xa7e8('0x18')],_0x18b454);_0x11780a(_0x126726['error'](0x1f4,_0x57b47a[_0xa7e8('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 0c0bdff..9491d79 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 _0x7880=['register','length','save','remove','update','removeListener'];(function(_0x2972af,_0x1b1b6b){var _0x31e129=function(_0x13628e){while(--_0x13628e){_0x2972af['push'](_0x2972af['shift']());}};_0x31e129(++_0x1b1b6b);}(_0x7880,0x1f4));var _0x0788=function(_0x5be8ab,_0x4000a6){_0x5be8ab=_0x5be8ab-0x0;var _0x35914d=_0x7880[_0x5be8ab];return _0x35914d;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x0788('0x0'),_0x0788('0x1'),_0x0788('0x2')];function createListener(_0x1b196a,_0x47dc20){return function(_0x446ded){_0x47dc20['emit'](_0x1b196a,_0x446ded);};}function removeListener(_0x3925a6,_0x1e0814){return function(){ChatMessageEvents[_0x0788('0x3')](_0x3925a6,_0x1e0814);};}exports[_0x0788('0x4')]=function(_0x262f5c){for(var _0x775629=0x0,_0x3f9cb8=events[_0x0788('0x5')];_0x775629<_0x3f9cb8;_0x775629++){var _0x3c29f3=events[_0x775629];var _0x422f8b=createListener('chatMessage:'+_0x3c29f3,_0x262f5c);ChatMessageEvents['on'](_0x3c29f3,_0x422f8b);}}; \ No newline at end of file +var _0x326f=['update','emit','removeListener','register','length','./chatMessage.events'];(function(_0x399658,_0x2e514b){var _0x3371c2=function(_0x33185e){while(--_0x33185e){_0x399658['push'](_0x399658['shift']());}};_0x3371c2(++_0x2e514b);}(_0x326f,0xd1));var _0xf326=function(_0xeac6a,_0x542b64){_0xeac6a=_0xeac6a-0x0;var _0x3ee02d=_0x326f[_0xeac6a];return _0x3ee02d;};'use strict';var ChatMessageEvents=require(_0xf326('0x0'));var events=['save','remove',_0xf326('0x1')];function createListener(_0x330ddb,_0x22aabf){return function(_0x408257){_0x22aabf[_0xf326('0x2')](_0x330ddb,_0x408257);};}function removeListener(_0x120a26,_0x9445c6){return function(){ChatMessageEvents[_0xf326('0x3')](_0x120a26,_0x9445c6);};}exports[_0xf326('0x4')]=function(_0x3ace29){for(var _0x4c2249=0x0,_0x3c254d=events[_0xf326('0x5')];_0x4c2249<_0x3c254d;_0x4c2249++){var _0x165f95=events[_0x4c2249];var _0x1e7b8a=createListener('chatMessage:'+_0x165f95,_0x3ace29);ChatMessageEvents['on'](_0x165f95,_0x1e7b8a);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index b876a66..38e44ed 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 _0x4ab2=['index','get','describe','/:id','show','post','chat','chatmessage:create','create','put','update','/:id/accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./chatMessage.controller','isAuthenticated'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x4ab2,0xbf));var _0x24ab=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x4ab2[_0x178e48];return _0x440d7e;};'use strict';var multer=require(_0x24ab('0x0'));var util=require(_0x24ab('0x1'));var path=require(_0x24ab('0x2'));var timeout=require(_0x24ab('0x3'));var express=require(_0x24ab('0x4'));var router=express[_0x24ab('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x24ab('0x6'));var config=require('../../config/environment');var controller=require(_0x24ab('0x7'));router['get']('/',auth[_0x24ab('0x8')](),controller[_0x24ab('0x9')]);router[_0x24ab('0xa')]('/describe',auth['isAuthenticated'](),controller[_0x24ab('0xb')]);router[_0x24ab('0xa')](_0x24ab('0xc'),auth[_0x24ab('0x8')](),controller[_0x24ab('0xd')]);router[_0x24ab('0xe')]('/',auth[_0x24ab('0x8')](),interaction['tracked'](_0x24ab('0xf'),_0x24ab('0x10')),controller[_0x24ab('0x11')]);router[_0x24ab('0x12')]('/:id',controller[_0x24ab('0x13')]);router['put'](_0x24ab('0x14'),auth[_0x24ab('0x8')](),controller['accept']);router[_0x24ab('0x12')](_0x24ab('0x15'),auth[_0x24ab('0x8')](),controller[_0x24ab('0x16')]);router['delete'](_0x24ab('0xc'),auth['isAuthenticated'](),controller[_0x24ab('0x17')]);module[_0x24ab('0x18')]=router; \ No newline at end of file +var _0xd04f=['express','Router','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','tracked','chat','put','update','accept','/:id/reject','reject','delete','exports','multer','util','path'];(function(_0x46efd7,_0x43f84d){var _0x5637e4=function(_0x54e078){while(--_0x54e078){_0x46efd7['push'](_0x46efd7['shift']());}};_0x5637e4(++_0x43f84d);}(_0xd04f,0xac));var _0xfd04=function(_0x510dbc,_0x11093f){_0x510dbc=_0x510dbc-0x0;var _0x5d3e94=_0xd04f[_0x510dbc];return _0x5d3e94;};'use strict';var multer=require(_0xfd04('0x0'));var util=require(_0xfd04('0x1'));var path=require(_0xfd04('0x2'));var timeout=require('connect-timeout');var express=require(_0xfd04('0x3'));var router=express[_0xfd04('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xfd04('0x5'));var config=require(_0xfd04('0x6'));var controller=require(_0xfd04('0x7'));router['get']('/',auth[_0xfd04('0x8')](),controller[_0xfd04('0x9')]);router[_0xfd04('0xa')](_0xfd04('0xb'),auth[_0xfd04('0x8')](),controller[_0xfd04('0xc')]);router[_0xfd04('0xa')](_0xfd04('0xd'),auth[_0xfd04('0x8')](),controller[_0xfd04('0xe')]);router[_0xfd04('0xf')]('/',auth['isAuthenticated'](),interaction[_0xfd04('0x10')](_0xfd04('0x11'),'chatmessage:create'),controller['create']);router[_0xfd04('0x12')](_0xfd04('0xd'),controller[_0xfd04('0x13')]);router[_0xfd04('0x12')]('/:id/accept',auth[_0xfd04('0x8')](),controller[_0xfd04('0x14')]);router['put'](_0xfd04('0x15'),auth[_0xfd04('0x8')](),controller[_0xfd04('0x16')]);router[_0xfd04('0x17')](_0xfd04('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xfd04('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 51e4f9f..67a3c25 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 _0x7490=['TEXT','sequelize','exports'];(function(_0x1daace,_0x5b64ab){var _0x2dfecb=function(_0x3dfaf7){while(--_0x3dfaf7){_0x1daace['push'](_0x1daace['shift']());}};_0x2dfecb(++_0x5b64ab);}(_0x7490,0x1e1));var _0x0749=function(_0x1905da,_0x225a71){_0x1905da=_0x1905da-0x0;var _0xba82cb=_0x7490[_0x1905da];return _0xba82cb;};'use strict';var Sequelize=require(_0x0749('0x0'));module[_0x0749('0x1')]={'body':{'type':Sequelize[_0x0749('0x2')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x0ea7=['sequelize','exports','medium'];(function(_0x5e24d7,_0x11218f){var _0x10063d=function(_0x39fc21){while(--_0x39fc21){_0x5e24d7['push'](_0x5e24d7['shift']());}};_0x10063d(++_0x11218f);}(_0x0ea7,0x150));var _0x70ea=function(_0x39a1be,_0x598284){_0x39a1be=_0x39a1be-0x0;var _0x2d4f3d=_0x0ea7[_0x39a1be];return _0x2d4f3d;};'use strict';var Sequelize=require(_0x70ea('0x0'));module[_0x70ea('0x1')]={'body':{'type':Sequelize['TEXT'](_0x70ea('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 dc39487..52e675b 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 _0xd7d1=['zip-dir','fast-json-patch','request-promise','moment','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','sendStatus','status','json','count','offset','set','apply','reject','save','update','destroy','then','name','send','index','ChatOfflineMessage','rawAttributes','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','find','body','describe','html-pdf','eml-format','rimraf'];(function(_0x3d58fa,_0x27620b){var _0x13da0f=function(_0x3f2301){while(--_0x3f2301){_0x3d58fa['push'](_0x3d58fa['shift']());}};_0x13da0f(++_0x27620b);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x42f37d,_0x47b63a){_0x42f37d=_0x42f37d-0x0;var _0x3f1cd4=_0xd7d1[_0x42f37d];return _0x3f1cd4;};'use strict';var pdf=require(_0x1d7d('0x0'));var emlformat=require(_0x1d7d('0x1'));var rimraf=require(_0x1d7d('0x2'));var zipdir=require(_0x1d7d('0x3'));var jsonpatch=require(_0x1d7d('0x4'));var rp=require(_0x1d7d('0x5'));var moment=require(_0x1d7d('0x6'));var BPromise=require(_0x1d7d('0x7'));var Mustache=require(_0x1d7d('0x8'));var util=require(_0x1d7d('0x9'));var path=require(_0x1d7d('0xa'));var sox=require(_0x1d7d('0xb'));var csv=require(_0x1d7d('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1d7d('0xd'));var squel=require(_0x1d7d('0xe'));var crypto=require(_0x1d7d('0xf'));var jsforce=require(_0x1d7d('0x10'));var deskjs=require(_0x1d7d('0x11'));var toCsv=require(_0x1d7d('0xc'));var querystring=require(_0x1d7d('0x12'));var Papa=require(_0x1d7d('0x13'));var Redis=require(_0x1d7d('0x14'));var authService=require(_0x1d7d('0x15'));var qs=require(_0x1d7d('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d7d('0x17'));var logger=require('../../config/logger')(_0x1d7d('0x18'));var utils=require(_0x1d7d('0x19'));var config=require(_0x1d7d('0x1a'));var licenseUtil=require(_0x1d7d('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11b83f,_0x5ae1c9){_0x5ae1c9=_0x5ae1c9||0xcc;return function(_0x577e07){if(_0x577e07){return _0x11b83f[_0x1d7d('0x1c')](_0x5ae1c9);}return _0x11b83f[_0x1d7d('0x1d')](_0x5ae1c9)['end']();};}function respondWithResult(_0x55dba7,_0x1d3822){_0x1d3822=_0x1d3822||0xc8;return function(_0x334e78){if(_0x334e78){return _0x55dba7[_0x1d7d('0x1d')](_0x1d3822)[_0x1d7d('0x1e')](_0x334e78);}};}function respondWithFilteredResult(_0xeb05b3,_0x53423f){return function(_0x28adf3){if(_0x28adf3){var _0x1de6cc=_0x28adf3[_0x1d7d('0x1f')],_0x51cbca=_0x53423f[_0x1d7d('0x20')],_0xb90a8c=_0x53423f[_0x1d7d('0x20')]+_0x53423f['limit'],_0x162c3a;if(_0xb90a8c>=_0x1de6cc){_0xb90a8c=_0x1de6cc;_0x162c3a=0xc8;}else{_0x162c3a=0xce;}_0xeb05b3[_0x1d7d('0x1d')](_0x162c3a);return _0xeb05b3[_0x1d7d('0x21')]('Content-Range',_0x51cbca+'-'+_0xb90a8c+'/'+_0x1de6cc)['json'](_0x28adf3);}return null;};}function patchUpdates(_0x2406dd){return function(_0x1a5101){try{jsonpatch[_0x1d7d('0x22')](_0x1a5101,_0x2406dd,!![]);}catch(_0x396802){return BPromise[_0x1d7d('0x23')](_0x396802);}return _0x1a5101[_0x1d7d('0x24')]();};}function saveUpdates(_0x54d401,_0x225f85){return function(_0x40c27f){if(_0x40c27f){return _0x40c27f[_0x1d7d('0x25')](_0x54d401)['then'](function(_0x29caf4){return _0x29caf4;});}return null;};}function removeEntity(_0x12c54b,_0x4a1cdc){return function(_0x5950bd){if(_0x5950bd){return _0x5950bd[_0x1d7d('0x26')]()[_0x1d7d('0x27')](function(){_0x12c54b[_0x1d7d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x377653,_0x106376){return function(_0x2d4c0c){if(!_0x2d4c0c){_0x377653[_0x1d7d('0x1c')](0x194);}return _0x2d4c0c;};}function handleError(_0x4fa346,_0x233463){_0x233463=_0x233463||0x1f4;return function(_0x151198){logger['error'](_0x151198['stack']);if(_0x151198[_0x1d7d('0x28')]){delete _0x151198['name'];}_0x4fa346[_0x1d7d('0x1d')](_0x233463)[_0x1d7d('0x29')](_0x151198);};}exports[_0x1d7d('0x2a')]=function(_0x22c40d,_0x465938){var _0x59f827={},_0x1c2616={},_0x98c1ad={'count':0x0,'rows':[]};var _0x352d5a=_['map'](db[_0x1d7d('0x2b')][_0x1d7d('0x2c')],function(_0x23ad85){return{'name':_0x23ad85['fieldName'],'type':_0x23ad85['type']['key']};});_0x1c2616[_0x1d7d('0x2d')]=_[_0x1d7d('0x2e')](_0x352d5a,'name');_0x1c2616[_0x1d7d('0x2f')]=_[_0x1d7d('0x30')](_0x22c40d[_0x1d7d('0x2f')]);_0x1c2616[_0x1d7d('0x31')]=_[_0x1d7d('0x32')](_0x1c2616[_0x1d7d('0x2d')],_0x1c2616[_0x1d7d('0x2f')]);_0x59f827[_0x1d7d('0x33')]=_[_0x1d7d('0x32')](_0x1c2616[_0x1d7d('0x2d')],qs['fields'](_0x22c40d['query'][_0x1d7d('0x34')]));_0x59f827[_0x1d7d('0x33')]=_0x59f827[_0x1d7d('0x33')][_0x1d7d('0x35')]?_0x59f827[_0x1d7d('0x33')]:_0x1c2616[_0x1d7d('0x2d')];if(!_0x22c40d[_0x1d7d('0x2f')][_0x1d7d('0x36')](_0x1d7d('0x37'))){_0x59f827['limit']=qs[_0x1d7d('0x38')](_0x22c40d[_0x1d7d('0x2f')][_0x1d7d('0x38')]);_0x59f827[_0x1d7d('0x20')]=qs['offset'](_0x22c40d['query'][_0x1d7d('0x20')]);}_0x59f827[_0x1d7d('0x39')]=qs['sort'](_0x22c40d[_0x1d7d('0x2f')][_0x1d7d('0x3a')]);_0x59f827['where']=qs['filters'](_[_0x1d7d('0x3b')](_0x22c40d[_0x1d7d('0x2f')],_0x1c2616[_0x1d7d('0x31')]),_0x352d5a);if(_0x22c40d[_0x1d7d('0x2f')][_0x1d7d('0x3c')]){_0x59f827[_0x1d7d('0x3d')]=_[_0x1d7d('0x3e')](_0x59f827[_0x1d7d('0x3d')],{'$or':_[_0x1d7d('0x2e')](_0x352d5a,function(_0x318b9a){if(_0x318b9a['type']!=='VIRTUAL'){var _0x57db7a={};_0x57db7a[_0x318b9a['name']]={'$like':'%'+_0x22c40d[_0x1d7d('0x2f')]['filter']+'%'};return _0x57db7a;}})});}_0x59f827=_[_0x1d7d('0x3e')]({},_0x59f827,_0x22c40d[_0x1d7d('0x3f')]);var _0x3d7c65={'where':_0x59f827['where']};return db[_0x1d7d('0x2b')][_0x1d7d('0x1f')](_0x3d7c65)[_0x1d7d('0x27')](function(_0x5b7e01){_0x98c1ad[_0x1d7d('0x1f')]=_0x5b7e01;if(_0x22c40d[_0x1d7d('0x2f')][_0x1d7d('0x40')]){_0x59f827[_0x1d7d('0x41')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x1d7d('0x42')](_0x59f827);})[_0x1d7d('0x27')](function(_0x4239fa){_0x98c1ad[_0x1d7d('0x43')]=_0x4239fa;return _0x98c1ad;})['then'](respondWithFilteredResult(_0x465938,_0x59f827))[_0x1d7d('0x44')](handleError(_0x465938,null));};exports['show']=function(_0xc38ee,_0x31b850){var _0x671580={'raw':!![],'where':{'id':_0xc38ee[_0x1d7d('0x45')]['id']}},_0x1106d1={};_0x1106d1['model']=_['keys'](db[_0x1d7d('0x2b')][_0x1d7d('0x2c')]);_0x1106d1[_0x1d7d('0x2f')]=_['keys'](_0xc38ee['query']);_0x1106d1[_0x1d7d('0x31')]=_['intersection'](_0x1106d1[_0x1d7d('0x2d')],_0x1106d1[_0x1d7d('0x2f')]);_0x671580[_0x1d7d('0x33')]=_[_0x1d7d('0x32')](_0x1106d1[_0x1d7d('0x2d')],qs[_0x1d7d('0x34')](_0xc38ee[_0x1d7d('0x2f')]['fields']));_0x671580[_0x1d7d('0x33')]=_0x671580[_0x1d7d('0x33')]['length']?_0x671580[_0x1d7d('0x33')]:_0x1106d1[_0x1d7d('0x2d')];if(_0xc38ee[_0x1d7d('0x2f')][_0x1d7d('0x40')]){_0x671580[_0x1d7d('0x41')]=[{'all':!![]}];}_0x671580=_[_0x1d7d('0x3e')]({},_0x671580,_0xc38ee[_0x1d7d('0x3f')]);return db[_0x1d7d('0x2b')][_0x1d7d('0x46')](_0x671580)[_0x1d7d('0x27')](handleEntityNotFound(_0x31b850,null))[_0x1d7d('0x27')](respondWithResult(_0x31b850,null))[_0x1d7d('0x44')](handleError(_0x31b850,null));};exports['create']=function(_0x14e80d,_0x5904e0){return db[_0x1d7d('0x2b')]['create'](_0x14e80d[_0x1d7d('0x47')],{})[_0x1d7d('0x27')](respondWithResult(_0x5904e0,0xc9))[_0x1d7d('0x44')](handleError(_0x5904e0,null));};exports[_0x1d7d('0x25')]=function(_0x5d0ccd,_0x2dbb61){if(_0x5d0ccd['body']['id']){delete _0x5d0ccd['body']['id'];}return db[_0x1d7d('0x2b')]['find']({'where':{'id':_0x5d0ccd['params']['id']}})[_0x1d7d('0x27')](handleEntityNotFound(_0x2dbb61,null))[_0x1d7d('0x27')](saveUpdates(_0x5d0ccd['body'],null))[_0x1d7d('0x27')](respondWithResult(_0x2dbb61,null))[_0x1d7d('0x44')](handleError(_0x2dbb61,null));};exports['destroy']=function(_0x1f3a63,_0x2b9faa){return db[_0x1d7d('0x2b')][_0x1d7d('0x46')]({'where':{'id':_0x1f3a63['params']['id']}})['then'](handleEntityNotFound(_0x2b9faa,null))[_0x1d7d('0x27')](removeEntity(_0x2b9faa,null))[_0x1d7d('0x44')](handleError(_0x2b9faa,null));};exports[_0x1d7d('0x48')]=function(_0x3938d0,_0x3cc5b7){return db['ChatOfflineMessage'][_0x1d7d('0x48')]()[_0x1d7d('0x27')](respondWithResult(_0x3cc5b7,null))[_0x1d7d('0x44')](handleError(_0x3cc5b7,null));}; \ No newline at end of file +var _0xfa2c=['eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','send','index','ChatOfflineMessage','key','model','map','keys','query','intersection','attributes','hasOwnProperty','nolimit','filters','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','catch','params','fields','options','create','body','find','destroy','describe','html-pdf'];(function(_0x3bac97,_0x5ef0e4){var _0x310e70=function(_0x4e1317){while(--_0x4e1317){_0x3bac97['push'](_0x3bac97['shift']());}};_0x310e70(++_0x5ef0e4);}(_0xfa2c,0xda));var _0xcfa2=function(_0x5f563a,_0x32882a){_0x5f563a=_0x5f563a-0x0;var _0x3a6684=_0xfa2c[_0x5f563a];return _0x3a6684;};'use strict';var pdf=require(_0xcfa2('0x0'));var emlformat=require(_0xcfa2('0x1'));var rimraf=require(_0xcfa2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcfa2('0x3'));var rp=require(_0xcfa2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcfa2('0x5'));var util=require(_0xcfa2('0x6'));var path=require(_0xcfa2('0x7'));var sox=require(_0xcfa2('0x8'));var csv=require(_0xcfa2('0x9'));var ejs=require(_0xcfa2('0xa'));var fs=require('fs');var _=require(_0xcfa2('0xb'));var squel=require(_0xcfa2('0xc'));var crypto=require(_0xcfa2('0xd'));var jsforce=require(_0xcfa2('0xe'));var deskjs=require(_0xcfa2('0xf'));var toCsv=require(_0xcfa2('0x9'));var querystring=require(_0xcfa2('0x10'));var Papa=require(_0xcfa2('0x11'));var Redis=require(_0xcfa2('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xcfa2('0x13'));var as=require(_0xcfa2('0x14'));var hardwareService=require(_0xcfa2('0x15'));var logger=require(_0xcfa2('0x16'))('api');var utils=require(_0xcfa2('0x17'));var config=require(_0xcfa2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xcfa2('0x19'))['db'];function respondWithStatusCode(_0x859b74,_0x4dbb29){_0x4dbb29=_0x4dbb29||0xcc;return function(_0x572637){if(_0x572637){return _0x859b74['sendStatus'](_0x4dbb29);}return _0x859b74['status'](_0x4dbb29)[_0xcfa2('0x1a')]();};}function respondWithResult(_0xcc8676,_0x2e2629){_0x2e2629=_0x2e2629||0xc8;return function(_0x9022dd){if(_0x9022dd){return _0xcc8676[_0xcfa2('0x1b')](_0x2e2629)[_0xcfa2('0x1c')](_0x9022dd);}};}function respondWithFilteredResult(_0x4a9591,_0x15e8ca){return function(_0x17613c){if(_0x17613c){var _0x33b05a=_0x17613c[_0xcfa2('0x1d')],_0x582af7=_0x15e8ca[_0xcfa2('0x1e')],_0x198bbb=_0x15e8ca['offset']+_0x15e8ca[_0xcfa2('0x1f')],_0x41df11;if(_0x198bbb>=_0x33b05a){_0x198bbb=_0x33b05a;_0x41df11=0xc8;}else{_0x41df11=0xce;}_0x4a9591['status'](_0x41df11);return _0x4a9591[_0xcfa2('0x20')](_0xcfa2('0x21'),_0x582af7+'-'+_0x198bbb+'/'+_0x33b05a)[_0xcfa2('0x1c')](_0x17613c);}return null;};}function patchUpdates(_0x175f5b){return function(_0x20c28b){try{jsonpatch[_0xcfa2('0x22')](_0x20c28b,_0x175f5b,!![]);}catch(_0x3a9c67){return BPromise['reject'](_0x3a9c67);}return _0x20c28b[_0xcfa2('0x23')]();};}function saveUpdates(_0x48ca3e,_0x4d508f){return function(_0x6c2546){if(_0x6c2546){return _0x6c2546[_0xcfa2('0x24')](_0x48ca3e)[_0xcfa2('0x25')](function(_0x232853){return _0x232853;});}return null;};}function removeEntity(_0x2c79c6,_0x26dbfd){return function(_0x21a743){if(_0x21a743){return _0x21a743['destroy']()[_0xcfa2('0x25')](function(){_0x2c79c6['status'](0xcc)[_0xcfa2('0x1a')]();});}};}function handleEntityNotFound(_0x1c5464,_0x110b93){return function(_0x507c71){if(!_0x507c71){_0x1c5464[_0xcfa2('0x26')](0x194);}return _0x507c71;};}function handleError(_0x508931,_0x14acb8){_0x14acb8=_0x14acb8||0x1f4;return function(_0xb6a22d){logger[_0xcfa2('0x27')](_0xb6a22d[_0xcfa2('0x28')]);if(_0xb6a22d[_0xcfa2('0x29')]){delete _0xb6a22d[_0xcfa2('0x29')];}_0x508931['status'](_0x14acb8)[_0xcfa2('0x2a')](_0xb6a22d);};}exports[_0xcfa2('0x2b')]=function(_0x313208,_0x39add3){var _0x1cabec={},_0x48736c={},_0xf65090={'count':0x0,'rows':[]};var _0x5d1852=_['map'](db[_0xcfa2('0x2c')]['rawAttributes'],function(_0x2c5bd0){return{'name':_0x2c5bd0['fieldName'],'type':_0x2c5bd0['type'][_0xcfa2('0x2d')]};});_0x48736c[_0xcfa2('0x2e')]=_[_0xcfa2('0x2f')](_0x5d1852,_0xcfa2('0x29'));_0x48736c['query']=_[_0xcfa2('0x30')](_0x313208[_0xcfa2('0x31')]);_0x48736c['filters']=_[_0xcfa2('0x32')](_0x48736c['model'],_0x48736c[_0xcfa2('0x31')]);_0x1cabec[_0xcfa2('0x33')]=_['intersection'](_0x48736c['model'],qs['fields'](_0x313208[_0xcfa2('0x31')]['fields']));_0x1cabec[_0xcfa2('0x33')]=_0x1cabec[_0xcfa2('0x33')]['length']?_0x1cabec[_0xcfa2('0x33')]:_0x48736c[_0xcfa2('0x2e')];if(!_0x313208[_0xcfa2('0x31')][_0xcfa2('0x34')](_0xcfa2('0x35'))){_0x1cabec[_0xcfa2('0x1f')]=qs[_0xcfa2('0x1f')](_0x313208[_0xcfa2('0x31')][_0xcfa2('0x1f')]);_0x1cabec[_0xcfa2('0x1e')]=qs[_0xcfa2('0x1e')](_0x313208[_0xcfa2('0x31')]['offset']);}_0x1cabec['order']=qs['sort'](_0x313208['query']['sort']);_0x1cabec['where']=qs[_0xcfa2('0x36')](_[_0xcfa2('0x37')](_0x313208[_0xcfa2('0x31')],_0x48736c['filters']),_0x5d1852);if(_0x313208[_0xcfa2('0x31')][_0xcfa2('0x38')]){_0x1cabec[_0xcfa2('0x39')]=_[_0xcfa2('0x3a')](_0x1cabec[_0xcfa2('0x39')],{'$or':_[_0xcfa2('0x2f')](_0x5d1852,function(_0x45baf8){if(_0x45baf8[_0xcfa2('0x3b')]!==_0xcfa2('0x3c')){var _0x22e85d={};_0x22e85d[_0x45baf8[_0xcfa2('0x29')]]={'$like':'%'+_0x313208[_0xcfa2('0x31')]['filter']+'%'};return _0x22e85d;}})});}_0x1cabec=_[_0xcfa2('0x3a')]({},_0x1cabec,_0x313208['options']);var _0x39338e={'where':_0x1cabec[_0xcfa2('0x39')]};return db['ChatOfflineMessage']['count'](_0x39338e)[_0xcfa2('0x25')](function(_0x5bf8bd){_0xf65090[_0xcfa2('0x1d')]=_0x5bf8bd;if(_0x313208[_0xcfa2('0x31')][_0xcfa2('0x3d')]){_0x1cabec[_0xcfa2('0x3e')]=[{'all':!![]}];}return db[_0xcfa2('0x2c')][_0xcfa2('0x3f')](_0x1cabec);})[_0xcfa2('0x25')](function(_0x8cda81){_0xf65090['rows']=_0x8cda81;return _0xf65090;})[_0xcfa2('0x25')](respondWithFilteredResult(_0x39add3,_0x1cabec))[_0xcfa2('0x40')](handleError(_0x39add3,null));};exports['show']=function(_0x5742ba,_0x1e8448){var _0x3a4b8={'raw':!![],'where':{'id':_0x5742ba[_0xcfa2('0x41')]['id']}},_0x30e559={};_0x30e559[_0xcfa2('0x2e')]=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x30e559[_0xcfa2('0x31')]=_[_0xcfa2('0x30')](_0x5742ba[_0xcfa2('0x31')]);_0x30e559[_0xcfa2('0x36')]=_[_0xcfa2('0x32')](_0x30e559['model'],_0x30e559[_0xcfa2('0x31')]);_0x3a4b8[_0xcfa2('0x33')]=_[_0xcfa2('0x32')](_0x30e559[_0xcfa2('0x2e')],qs[_0xcfa2('0x42')](_0x5742ba[_0xcfa2('0x31')][_0xcfa2('0x42')]));_0x3a4b8[_0xcfa2('0x33')]=_0x3a4b8['attributes']['length']?_0x3a4b8[_0xcfa2('0x33')]:_0x30e559[_0xcfa2('0x2e')];if(_0x5742ba[_0xcfa2('0x31')][_0xcfa2('0x3d')]){_0x3a4b8[_0xcfa2('0x3e')]=[{'all':!![]}];}_0x3a4b8=_[_0xcfa2('0x3a')]({},_0x3a4b8,_0x5742ba[_0xcfa2('0x43')]);return db[_0xcfa2('0x2c')]['find'](_0x3a4b8)[_0xcfa2('0x25')](handleEntityNotFound(_0x1e8448,null))['then'](respondWithResult(_0x1e8448,null))[_0xcfa2('0x40')](handleError(_0x1e8448,null));};exports[_0xcfa2('0x44')]=function(_0x1d17da,_0x405541){return db[_0xcfa2('0x2c')]['create'](_0x1d17da['body'],{})[_0xcfa2('0x25')](respondWithResult(_0x405541,0xc9))[_0xcfa2('0x40')](handleError(_0x405541,null));};exports[_0xcfa2('0x24')]=function(_0x4ad42f,_0x393296){if(_0x4ad42f[_0xcfa2('0x45')]['id']){delete _0x4ad42f['body']['id'];}return db[_0xcfa2('0x2c')][_0xcfa2('0x46')]({'where':{'id':_0x4ad42f[_0xcfa2('0x41')]['id']}})['then'](handleEntityNotFound(_0x393296,null))[_0xcfa2('0x25')](saveUpdates(_0x4ad42f['body'],null))[_0xcfa2('0x25')](respondWithResult(_0x393296,null))[_0xcfa2('0x40')](handleError(_0x393296,null));};exports[_0xcfa2('0x47')]=function(_0x53eac3,_0x15557b){return db[_0xcfa2('0x2c')][_0xcfa2('0x46')]({'where':{'id':_0x53eac3[_0xcfa2('0x41')]['id']}})['then'](handleEntityNotFound(_0x15557b,null))['then'](removeEntity(_0x15557b,null))[_0xcfa2('0x40')](handleError(_0x15557b,null));};exports['describe']=function(_0x77e42b,_0x29b00d){return db[_0xcfa2('0x2c')][_0xcfa2('0x48')]()[_0xcfa2('0x25')](respondWithResult(_0x29b00d,null))[_0xcfa2('0x40')](handleError(_0x29b00d,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 2d2a24e..fb56d3c 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 _0x9a19=['exports','define','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x9a19,0x114));var _0x99a1=function(_0x218972,_0x1f9794){_0x218972=_0x218972-0x0;var _0x1bb1a8=_0x9a19[_0x218972];return _0x1bb1a8;};'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')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x99a1('0xc')});}; \ No newline at end of file +var _0x222f=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','chat_offline_messages','utf8mb4'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x222f,0x1a4));var _0xf222=function(_0x39c684,_0x1e0093){_0x39c684=_0x39c684-0x0;var _0x3da800=_0x222f[_0x39c684];return _0x3da800;};'use strict';var _=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var logger=require(_0xf222('0x2'))(_0xf222('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf222('0x4'));var fs=require('fs');var path=require(_0xf222('0x5'));var rimraf=require(_0xf222('0x6'));var config=require(_0xf222('0x7'));var attributes=require('./chatOfflineMessage.attributes');module[_0xf222('0x8')]=function(_0x54a758,_0x112e6d){return _0x54a758[_0xf222('0x9')]('ChatOfflineMessage',attributes,{'tableName':_0xf222('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf222('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 156475b..c16747b 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 _0x160a=['request','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatOfflineMessage,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x167f0e,_0x2e6be2){var _0x5c7c20=function(_0x2e3a72){while(--_0x2e3a72){_0x167f0e['push'](_0x167f0e['shift']());}};_0x5c7c20(++_0x2e6be2);}(_0x160a,0x9d));var _0xa160=function(_0x54de5d,_0x1f8b26){_0x54de5d=_0x54de5d-0x0;var _0x1b349e=_0x160a[_0x54de5d];return _0x1b349e;};'use strict';var _=require(_0xa160('0x0'));var util=require(_0xa160('0x1'));var moment=require(_0xa160('0x2'));var BPromise=require(_0xa160('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa160('0x4'));var db=require(_0xa160('0x5'))['db'];var utils=require(_0xa160('0x6'));var logger=require(_0xa160('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa160('0x8'));var client=jayson[_0xa160('0x9')][_0xa160('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x483fcf,_0x59e808,_0xfd9b46){return new BPromise(function(_0x58783f,_0x1bb356){return client[_0xa160('0xb')](_0x483fcf,_0xfd9b46)['then'](function(_0x514f91){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x59e808,_0xa160('0xc'));logger[_0xa160('0xd')](_0xa160('0xe'),_0x59e808,_0xa160('0xc'),JSON[_0xa160('0xf')](_0x514f91));if(_0x514f91[_0xa160('0x10')]){if(_0x514f91[_0xa160('0x10')]['code']===0x1f4){logger[_0xa160('0x10')](_0xa160('0x11'),_0x59e808,_0x514f91[_0xa160('0x10')][_0xa160('0x12')]);return _0x1bb356(_0x514f91[_0xa160('0x10')][_0xa160('0x12')]);}logger[_0xa160('0x10')](_0xa160('0x11'),_0x59e808,_0x514f91[_0xa160('0x10')][_0xa160('0x12')]);return _0x58783f(_0x514f91[_0xa160('0x10')]['message']);}else{logger[_0xa160('0x13')](_0xa160('0x11'),_0x59e808,_0xa160('0xc'));_0x58783f(_0x514f91['result']['message']);}})[_0xa160('0x14')](function(_0x499e02){logger[_0xa160('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x59e808,_0x499e02);_0x1bb356(_0x499e02);});});} \ No newline at end of file +var _0xf553=['ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf553,0x177));var _0x3f55=function(_0x41b0a8,_0x1b05cc){_0x41b0a8=_0x41b0a8-0x0;var _0x3a83d4=_0xf553[_0x41b0a8];return _0x3a83d4;};'use strict';var _=require(_0x3f55('0x0'));var util=require(_0x3f55('0x1'));var moment=require(_0x3f55('0x2'));var BPromise=require('bluebird');var rs=require(_0x3f55('0x3'));var fs=require('fs');var Redis=require(_0x3f55('0x4'));var db=require(_0x3f55('0x5'))['db'];var utils=require(_0x3f55('0x6'));var logger=require('../../config/logger')(_0x3f55('0x7'));var config=require(_0x3f55('0x8'));var jayson=require(_0x3f55('0x9'));var client=jayson[_0x3f55('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cf460,_0x1f7dd4,_0x37bec4){return new BPromise(function(_0x480fad,_0x46d863){return client[_0x3f55('0xb')](_0x3cf460,_0x37bec4)[_0x3f55('0xc')](function(_0x67fb78){logger[_0x3f55('0xd')](_0x3f55('0xe'),_0x1f7dd4,_0x3f55('0xf'));logger['debug'](_0x3f55('0x10'),_0x1f7dd4,'request\x20sent',JSON[_0x3f55('0x11')](_0x67fb78));if(_0x67fb78[_0x3f55('0x12')]){if(_0x67fb78[_0x3f55('0x12')][_0x3f55('0x13')]===0x1f4){logger['error'](_0x3f55('0xe'),_0x1f7dd4,_0x67fb78[_0x3f55('0x12')][_0x3f55('0x14')]);return _0x46d863(_0x67fb78[_0x3f55('0x12')][_0x3f55('0x14')]);}logger[_0x3f55('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1f7dd4,_0x67fb78[_0x3f55('0x12')][_0x3f55('0x14')]);return _0x480fad(_0x67fb78[_0x3f55('0x12')][_0x3f55('0x14')]);}else{logger[_0x3f55('0xd')](_0x3f55('0xe'),_0x1f7dd4,_0x3f55('0xf'));_0x480fad(_0x67fb78[_0x3f55('0x15')][_0x3f55('0x14')]);}})[_0x3f55('0x16')](function(_0x8afd04){logger[_0x3f55('0x12')](_0x3f55('0xe'),_0x1f7dd4,_0x8afd04);_0x46d863(_0x8afd04);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 3fafaad..3d103ed 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 _0x72a4=['show','post','create','put','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','/:id','isAuthenticated'];(function(_0x4195da,_0x581b75){var _0x213303=function(_0x41c3aa){while(--_0x41c3aa){_0x4195da['push'](_0x4195da['shift']());}};_0x213303(++_0x581b75);}(_0x72a4,0x1e2));var _0x472a=function(_0x193bef,_0x229b65){_0x193bef=_0x193bef-0x0;var _0x4c725e=_0x72a4[_0x193bef];return _0x4c725e;};'use strict';var multer=require('multer');var util=require(_0x472a('0x0'));var path=require(_0x472a('0x1'));var timeout=require(_0x472a('0x2'));var express=require(_0x472a('0x3'));var router=express[_0x472a('0x4')]();var auth=require(_0x472a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x472a('0x6'));var controller=require(_0x472a('0x7'));router[_0x472a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x472a('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x472a('0x9'),auth[_0x472a('0xa')](),controller[_0x472a('0xb')]);router[_0x472a('0xc')]('/',auth['isAuthenticated'](),controller[_0x472a('0xd')]);router[_0x472a('0xe')]('/:id',auth[_0x472a('0xa')](),controller['update']);router['delete'](_0x472a('0x9'),auth[_0x472a('0xa')](),controller[_0x472a('0xf')]);module[_0x472a('0x10')]=router; \ No newline at end of file +var _0x098f=['isAuthenticated','describe','show','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get'];(function(_0x2c719b,_0x2cdcba){var _0x5cb81a=function(_0x4a4152){while(--_0x4a4152){_0x2c719b['push'](_0x2c719b['shift']());}};_0x5cb81a(++_0x2cdcba);}(_0x098f,0xf3));var _0xf098=function(_0x2f3c7f,_0x2d6f25){_0x2f3c7f=_0x2f3c7f-0x0;var _0x2bc5d1=_0x098f[_0x2f3c7f];return _0x2bc5d1;};'use strict';var multer=require('multer');var util=require(_0xf098('0x0'));var path=require(_0xf098('0x1'));var timeout=require(_0xf098('0x2'));var express=require('express');var router=express[_0xf098('0x3')]();var auth=require(_0xf098('0x4'));var interaction=require(_0xf098('0x5'));var config=require(_0xf098('0x6'));var controller=require(_0xf098('0x7'));router[_0xf098('0x8')]('/',auth[_0xf098('0x9')](),controller['index']);router['get']('/describe',auth[_0xf098('0x9')](),controller[_0xf098('0xa')]);router[_0xf098('0x8')]('/:id',auth[_0xf098('0x9')](),controller[_0xf098('0xb')]);router[_0xf098('0xc')]('/',auth[_0xf098('0x9')](),controller[_0xf098('0xd')]);router['put'](_0xf098('0xe'),auth[_0xf098('0x9')](),controller['update']);router[_0xf098('0xf')](_0xf098('0xe'),auth[_0xf098('0x9')](),controller[_0xf098('0x10')]);module[_0xf098('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 4a1c85a..7db8a0c 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 _0xe5e8=['STRING','mouseOver','timeout','INTEGER','sequelize','exports'];(function(_0x4915c2,_0x42d37b){var _0x5e26df=function(_0x175bd3){while(--_0x175bd3){_0x4915c2['push'](_0x4915c2['shift']());}};_0x5e26df(++_0x42d37b);}(_0xe5e8,0x64));var _0x8e5e=function(_0x368cae,_0x1815f4){_0x368cae=_0x368cae-0x0;var _0x10557e=_0xe5e8[_0x368cae];return _0x10557e;};'use strict';var Sequelize=require(_0x8e5e('0x0'));module[_0x8e5e('0x1')]={'name':{'type':Sequelize[_0x8e5e('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8e5e('0x3'),_0x8e5e('0x4')),'defaultValue':_0x8e5e('0x3')},'selector':{'type':Sequelize[_0x8e5e('0x2')]},'timeout':{'type':Sequelize[_0x8e5e('0x5')]}}; \ No newline at end of file +var _0x7e4e=['timeout','INTEGER','exports','STRING','ENUM','mouseOver'];(function(_0x19b031,_0x13f200){var _0xda5ec8=function(_0x393fcb){while(--_0x393fcb){_0x19b031['push'](_0x19b031['shift']());}};_0xda5ec8(++_0x13f200);}(_0x7e4e,0xe6));var _0xe7e4=function(_0x1bcc92,_0x4929b8){_0x1bcc92=_0x1bcc92-0x0;var _0x88406a=_0x7e4e[_0x1bcc92];return _0x88406a;};'use strict';var Sequelize=require('sequelize');module[_0xe7e4('0x0')]={'name':{'type':Sequelize[_0xe7e4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe7e4('0x2')](_0xe7e4('0x3'),_0xe7e4('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0xe7e4('0x1')]},'timeout':{'type':Sequelize[_0xe7e4('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 2df9f16..8375945 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 _0x1afe=['zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','name','params','model','keys','rawAttributes','query','intersection','fields','attributes','length','includeAll','include','options','ChatProactiveAction','find','catch','create','body','html-pdf','eml-format','rimraf'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x1afe,0x11a));var _0xe1af=function(_0x328740,_0x26e1b2){_0x328740=_0x328740-0x0;var _0x30e10c=_0x1afe[_0x328740];return _0x30e10c;};'use strict';var pdf=require(_0xe1af('0x0'));var emlformat=require(_0xe1af('0x1'));var rimraf=require(_0xe1af('0x2'));var zipdir=require(_0xe1af('0x3'));var jsonpatch=require(_0xe1af('0x4'));var rp=require(_0xe1af('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe1af('0x6'));var util=require(_0xe1af('0x7'));var path=require(_0xe1af('0x8'));var sox=require(_0xe1af('0x9'));var csv=require(_0xe1af('0xa'));var ejs=require(_0xe1af('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe1af('0xc'));var crypto=require(_0xe1af('0xd'));var jsforce=require(_0xe1af('0xe'));var deskjs=require(_0xe1af('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe1af('0x10'));var Papa=require(_0xe1af('0x11'));var Redis=require('ioredis');var authService=require(_0xe1af('0x12'));var qs=require(_0xe1af('0x13'));var as=require(_0xe1af('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe1af('0x15'))(_0xe1af('0x16'));var utils=require(_0xe1af('0x17'));var config=require(_0xe1af('0x18'));var licenseUtil=require(_0xe1af('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11cb64,_0x192b1a){_0x192b1a=_0x192b1a||0xcc;return function(_0x31ff40){if(_0x31ff40){return _0x11cb64['sendStatus'](_0x192b1a);}return _0x11cb64[_0xe1af('0x1a')](_0x192b1a)[_0xe1af('0x1b')]();};}function respondWithResult(_0x5b51be,_0x37cabf){_0x37cabf=_0x37cabf||0xc8;return function(_0x6efed5){if(_0x6efed5){return _0x5b51be[_0xe1af('0x1a')](_0x37cabf)['json'](_0x6efed5);}};}function respondWithFilteredResult(_0x2dac70,_0x204847){return function(_0x4ed476){if(_0x4ed476){var _0x5d54d3=_0x4ed476[_0xe1af('0x1c')],_0x285702=_0x204847[_0xe1af('0x1d')],_0x1c5eb8=_0x204847[_0xe1af('0x1d')]+_0x204847[_0xe1af('0x1e')],_0x2b5ba1;if(_0x1c5eb8>=_0x5d54d3){_0x1c5eb8=_0x5d54d3;_0x2b5ba1=0xc8;}else{_0x2b5ba1=0xce;}_0x2dac70[_0xe1af('0x1a')](_0x2b5ba1);return _0x2dac70[_0xe1af('0x1f')](_0xe1af('0x20'),_0x285702+'-'+_0x1c5eb8+'/'+_0x5d54d3)['json'](_0x4ed476);}return null;};}function patchUpdates(_0x1dc37b){return function(_0x3c8099){try{jsonpatch['apply'](_0x3c8099,_0x1dc37b,!![]);}catch(_0x422daa){return BPromise[_0xe1af('0x21')](_0x422daa);}return _0x3c8099[_0xe1af('0x22')]();};}function saveUpdates(_0x4a263b,_0x5c1d0b){return function(_0x5b8dac){if(_0x5b8dac){return _0x5b8dac[_0xe1af('0x23')](_0x4a263b)[_0xe1af('0x24')](function(_0xe73e1c){return _0xe73e1c;});}return null;};}function removeEntity(_0x97b380,_0x163f77){return function(_0x7791f0){if(_0x7791f0){return _0x7791f0[_0xe1af('0x25')]()[_0xe1af('0x24')](function(){_0x97b380[_0xe1af('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x469435,_0x263aad){return function(_0x4b8244){if(!_0x4b8244){_0x469435['sendStatus'](0x194);}return _0x4b8244;};}function handleError(_0x5b3b9f,_0x5ec3bf){_0x5ec3bf=_0x5ec3bf||0x1f4;return function(_0x4c295d){logger[_0xe1af('0x26')](_0x4c295d['stack']);if(_0x4c295d[_0xe1af('0x27')]){delete _0x4c295d[_0xe1af('0x27')];}_0x5b3b9f[_0xe1af('0x1a')](_0x5ec3bf)['send'](_0x4c295d);};}exports['show']=function(_0x31a969,_0x541dc7){var _0x39c0bc={'raw':!![],'where':{'id':_0x31a969[_0xe1af('0x28')]['id']}},_0x9b4de7={};_0x9b4de7[_0xe1af('0x29')]=_[_0xe1af('0x2a')](db['ChatProactiveAction'][_0xe1af('0x2b')]);_0x9b4de7[_0xe1af('0x2c')]=_['keys'](_0x31a969[_0xe1af('0x2c')]);_0x9b4de7['filters']=_[_0xe1af('0x2d')](_0x9b4de7[_0xe1af('0x29')],_0x9b4de7[_0xe1af('0x2c')]);_0x39c0bc['attributes']=_['intersection'](_0x9b4de7[_0xe1af('0x29')],qs['fields'](_0x31a969[_0xe1af('0x2c')][_0xe1af('0x2e')]));_0x39c0bc[_0xe1af('0x2f')]=_0x39c0bc['attributes'][_0xe1af('0x30')]?_0x39c0bc[_0xe1af('0x2f')]:_0x9b4de7[_0xe1af('0x29')];if(_0x31a969['query'][_0xe1af('0x31')]){_0x39c0bc[_0xe1af('0x32')]=[{'all':!![]}];}_0x39c0bc=_['merge']({},_0x39c0bc,_0x31a969[_0xe1af('0x33')]);return db[_0xe1af('0x34')][_0xe1af('0x35')](_0x39c0bc)[_0xe1af('0x24')](handleEntityNotFound(_0x541dc7,null))['then'](respondWithResult(_0x541dc7,null))[_0xe1af('0x36')](handleError(_0x541dc7,null));};exports[_0xe1af('0x37')]=function(_0x3ef638,_0x3f6d29){return db[_0xe1af('0x34')]['create'](_0x3ef638[_0xe1af('0x38')],{})['then'](respondWithResult(_0x3f6d29,0xc9))[_0xe1af('0x36')](handleError(_0x3f6d29,null));};exports[_0xe1af('0x23')]=function(_0x2a3121,_0x152d78){if(_0x2a3121[_0xe1af('0x38')]['id']){delete _0x2a3121[_0xe1af('0x38')]['id'];}return db['ChatProactiveAction'][_0xe1af('0x35')]({'where':{'id':_0x2a3121[_0xe1af('0x28')]['id']}})[_0xe1af('0x24')](handleEntityNotFound(_0x152d78,null))[_0xe1af('0x24')](saveUpdates(_0x2a3121[_0xe1af('0x38')],null))[_0xe1af('0x24')](respondWithResult(_0x152d78,null))[_0xe1af('0x36')](handleError(_0x152d78,null));};exports[_0xe1af('0x25')]=function(_0x41c8f3,_0x5e46e4){return db[_0xe1af('0x34')][_0xe1af('0x35')]({'where':{'id':_0x41c8f3[_0xe1af('0x28')]['id']}})[_0xe1af('0x24')](handleEntityNotFound(_0x5e46e4,null))[_0xe1af('0x24')](removeEntity(_0x5e46e4,null))[_0xe1af('0x36')](handleError(_0x5e46e4,null));}; \ No newline at end of file +var _0x1865=['../../config/license/util','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','model','ChatProactiveAction','rawAttributes','query','intersection','attributes','fields','length','include','merge','options','find','catch','create','params','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1865,0x1bf));var _0x5186=function(_0x20f2c9,_0x371080){_0x20f2c9=_0x20f2c9-0x0;var _0x1d9c40=_0x1865[_0x20f2c9];return _0x1d9c40;};'use strict';var pdf=require(_0x5186('0x0'));var emlformat=require(_0x5186('0x1'));var rimraf=require(_0x5186('0x2'));var zipdir=require(_0x5186('0x3'));var jsonpatch=require(_0x5186('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5186('0x5'));var util=require(_0x5186('0x6'));var path=require(_0x5186('0x7'));var sox=require(_0x5186('0x8'));var csv=require('to-csv');var ejs=require(_0x5186('0x9'));var fs=require('fs');var _=require(_0x5186('0xa'));var squel=require(_0x5186('0xb'));var crypto=require(_0x5186('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5186('0xd'));var toCsv=require(_0x5186('0xe'));var querystring=require(_0x5186('0xf'));var Papa=require(_0x5186('0x10'));var Redis=require(_0x5186('0x11'));var authService=require(_0x5186('0x12'));var qs=require(_0x5186('0x13'));var as=require(_0x5186('0x14'));var hardwareService=require(_0x5186('0x15'));var logger=require(_0x5186('0x16'))('api');var utils=require(_0x5186('0x17'));var config=require(_0x5186('0x18'));var licenseUtil=require(_0x5186('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c6fee,_0x392afd){_0x392afd=_0x392afd||0xcc;return function(_0x2ea497){if(_0x2ea497){return _0x2c6fee['sendStatus'](_0x392afd);}return _0x2c6fee['status'](_0x392afd)[_0x5186('0x1a')]();};}function respondWithResult(_0x4c8473,_0x1bbd1d){_0x1bbd1d=_0x1bbd1d||0xc8;return function(_0xbbfedd){if(_0xbbfedd){return _0x4c8473[_0x5186('0x1b')](_0x1bbd1d)[_0x5186('0x1c')](_0xbbfedd);}};}function respondWithFilteredResult(_0xb983df,_0x33e0c4){return function(_0x432636){if(_0x432636){var _0x5b988a=_0x432636[_0x5186('0x1d')],_0x2a38a4=_0x33e0c4[_0x5186('0x1e')],_0x2d2ac3=_0x33e0c4[_0x5186('0x1e')]+_0x33e0c4[_0x5186('0x1f')],_0x3a4267;if(_0x2d2ac3>=_0x5b988a){_0x2d2ac3=_0x5b988a;_0x3a4267=0xc8;}else{_0x3a4267=0xce;}_0xb983df[_0x5186('0x1b')](_0x3a4267);return _0xb983df[_0x5186('0x20')](_0x5186('0x21'),_0x2a38a4+'-'+_0x2d2ac3+'/'+_0x5b988a)[_0x5186('0x1c')](_0x432636);}return null;};}function patchUpdates(_0x2a0ef5){return function(_0x2f555d){try{jsonpatch[_0x5186('0x22')](_0x2f555d,_0x2a0ef5,!![]);}catch(_0x542b1c){return BPromise['reject'](_0x542b1c);}return _0x2f555d[_0x5186('0x23')]();};}function saveUpdates(_0x28a6db,_0x2ce746){return function(_0x5c0f1d){if(_0x5c0f1d){return _0x5c0f1d[_0x5186('0x24')](_0x28a6db)[_0x5186('0x25')](function(_0x542a51){return _0x542a51;});}return null;};}function removeEntity(_0x3caa51,_0x2ac761){return function(_0x500762){if(_0x500762){return _0x500762[_0x5186('0x26')]()[_0x5186('0x25')](function(){_0x3caa51['status'](0xcc)[_0x5186('0x1a')]();});}};}function handleEntityNotFound(_0x27e114,_0x651c7d){return function(_0x471f3a){if(!_0x471f3a){_0x27e114[_0x5186('0x27')](0x194);}return _0x471f3a;};}function handleError(_0x49c826,_0x42218e){_0x42218e=_0x42218e||0x1f4;return function(_0x2d2568){logger[_0x5186('0x28')](_0x2d2568['stack']);if(_0x2d2568['name']){delete _0x2d2568[_0x5186('0x29')];}_0x49c826['status'](_0x42218e)[_0x5186('0x2a')](_0x2d2568);};}exports['show']=function(_0x557b97,_0x3ca89d){var _0x1ef302={'raw':!![],'where':{'id':_0x557b97['params']['id']}},_0xe66b3c={};_0xe66b3c[_0x5186('0x2b')]=_['keys'](db[_0x5186('0x2c')][_0x5186('0x2d')]);_0xe66b3c[_0x5186('0x2e')]=_['keys'](_0x557b97[_0x5186('0x2e')]);_0xe66b3c['filters']=_[_0x5186('0x2f')](_0xe66b3c[_0x5186('0x2b')],_0xe66b3c[_0x5186('0x2e')]);_0x1ef302[_0x5186('0x30')]=_['intersection'](_0xe66b3c[_0x5186('0x2b')],qs[_0x5186('0x31')](_0x557b97['query']['fields']));_0x1ef302[_0x5186('0x30')]=_0x1ef302[_0x5186('0x30')][_0x5186('0x32')]?_0x1ef302[_0x5186('0x30')]:_0xe66b3c[_0x5186('0x2b')];if(_0x557b97[_0x5186('0x2e')]['includeAll']){_0x1ef302[_0x5186('0x33')]=[{'all':!![]}];}_0x1ef302=_[_0x5186('0x34')]({},_0x1ef302,_0x557b97[_0x5186('0x35')]);return db['ChatProactiveAction'][_0x5186('0x36')](_0x1ef302)[_0x5186('0x25')](handleEntityNotFound(_0x3ca89d,null))[_0x5186('0x25')](respondWithResult(_0x3ca89d,null))[_0x5186('0x37')](handleError(_0x3ca89d,null));};exports[_0x5186('0x38')]=function(_0x4b59eb,_0x266a73){return db[_0x5186('0x2c')][_0x5186('0x38')](_0x4b59eb['body'],{})[_0x5186('0x25')](respondWithResult(_0x266a73,0xc9))['catch'](handleError(_0x266a73,null));};exports[_0x5186('0x24')]=function(_0x43fba9,_0x5d7489){if(_0x43fba9['body']['id']){delete _0x43fba9['body']['id'];}return db[_0x5186('0x2c')][_0x5186('0x36')]({'where':{'id':_0x43fba9[_0x5186('0x39')]['id']}})[_0x5186('0x25')](handleEntityNotFound(_0x5d7489,null))[_0x5186('0x25')](saveUpdates(_0x43fba9[_0x5186('0x3a')],null))['then'](respondWithResult(_0x5d7489,null))[_0x5186('0x37')](handleError(_0x5d7489,null));};exports[_0x5186('0x26')]=function(_0xe29ae5,_0x13f853){return db[_0x5186('0x2c')][_0x5186('0x36')]({'where':{'id':_0xe29ae5[_0x5186('0x39')]['id']}})['then'](handleEntityNotFound(_0x13f853,null))[_0x5186('0x25')](removeEntity(_0x13f853,null))[_0x5186('0x37')](handleError(_0x13f853,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 6c63774..c426368 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 _0xdd26=['exports','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd26,0xe0));var _0x6dd2=function(_0x29cd05,_0x38abdc){_0x29cd05=_0x29cd05-0x0;var _0x3181ae=_0xdd26[_0x29cd05];return _0x3181ae;};'use strict';var _=require(_0x6dd2('0x0'));var util=require(_0x6dd2('0x1'));var logger=require(_0x6dd2('0x2'))('api');var moment=require(_0x6dd2('0x3'));var BPromise=require(_0x6dd2('0x4'));var rp=require(_0x6dd2('0x5'));var fs=require('fs');var path=require(_0x6dd2('0x6'));var rimraf=require(_0x6dd2('0x7'));var config=require(_0x6dd2('0x8'));var attributes=require(_0x6dd2('0x9'));module[_0x6dd2('0xa')]=function(_0x302315,_0x3a0098){return _0x302315['define'](_0x6dd2('0xb'),attributes,{'tableName':_0x6dd2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd278=['request-promise','rimraf','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','lodash','util','api','moment','bluebird'];(function(_0x1511ea,_0x2d8c62){var _0x23556f=function(_0x1e1608){while(--_0x1e1608){_0x1511ea['push'](_0x1511ea['shift']());}};_0x23556f(++_0x2d8c62);}(_0xd278,0xc1));var _0x8d27=function(_0x3614ca,_0x2cdbe9){_0x3614ca=_0x3614ca-0x0;var _0x25a340=_0xd278[_0x3614ca];return _0x25a340;};'use strict';var _=require(_0x8d27('0x0'));var util=require(_0x8d27('0x1'));var logger=require('../../config/logger')(_0x8d27('0x2'));var moment=require(_0x8d27('0x3'));var BPromise=require(_0x8d27('0x4'));var rp=require(_0x8d27('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8d27('0x6'));var config=require('../../config/environment');var attributes=require(_0x8d27('0x7'));module[_0x8d27('0x8')]=function(_0x3fe1a8,_0x4f38b2){return _0x3fe1a8['define'](_0x8d27('0x9'),attributes,{'tableName':_0x8d27('0xa'),'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 8bb2472..ee042c5 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 _0x76a2=['result','lodash','util','moment','bluebird','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x76a2,0x65));var _0x276a=function(_0x5c4585,_0x3d0eab){_0x5c4585=_0x5c4585-0x0;var _0x21dede=_0x76a2[_0x5c4585];return _0x21dede;};'use strict';var _=require(_0x276a('0x0'));var util=require(_0x276a('0x1'));var moment=require(_0x276a('0x2'));var BPromise=require(_0x276a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x276a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x276a('0x5'));var jayson=require(_0x276a('0x6'));var client=jayson[_0x276a('0x7')][_0x276a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16e52d,_0x40f550,_0x49a1c1){return new BPromise(function(_0x4ac7b2,_0x4d0180){return client[_0x276a('0x9')](_0x16e52d,_0x49a1c1)[_0x276a('0xa')](function(_0x51eaa0){logger[_0x276a('0xb')](_0x276a('0xc'),_0x40f550,_0x276a('0xd'));logger[_0x276a('0xe')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x40f550,_0x276a('0xd'),JSON[_0x276a('0xf')](_0x51eaa0));if(_0x51eaa0[_0x276a('0x10')]){if(_0x51eaa0[_0x276a('0x10')][_0x276a('0x11')]===0x1f4){logger[_0x276a('0x10')](_0x276a('0xc'),_0x40f550,_0x51eaa0[_0x276a('0x10')][_0x276a('0x12')]);return _0x4d0180(_0x51eaa0[_0x276a('0x10')][_0x276a('0x12')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x40f550,_0x51eaa0[_0x276a('0x10')][_0x276a('0x12')]);return _0x4ac7b2(_0x51eaa0[_0x276a('0x10')][_0x276a('0x12')]);}else{logger['info'](_0x276a('0xc'),_0x40f550,_0x276a('0xd'));_0x4ac7b2(_0x51eaa0[_0x276a('0x13')][_0x276a('0x12')]);}})['catch'](function(_0x51d2ea){logger['error'](_0x276a('0xc'),_0x40f550,_0x51d2ea);_0x4d0180(_0x51d2ea);});});} \ No newline at end of file +var _0x5062=['info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request'];(function(_0x5aa71c,_0x2427ae){var _0x308fd5=function(_0x54b674){while(--_0x54b674){_0x5aa71c['push'](_0x5aa71c['shift']());}};_0x308fd5(++_0x2427ae);}(_0x5062,0x1be));var _0x2506=function(_0xdda6ef,_0x5da52a){_0xdda6ef=_0xdda6ef-0x0;var _0x51b344=_0x5062[_0xdda6ef];return _0x51b344;};'use strict';var _=require('lodash');var util=require(_0x2506('0x0'));var moment=require('moment');var BPromise=require(_0x2506('0x1'));var rs=require(_0x2506('0x2'));var fs=require('fs');var Redis=require(_0x2506('0x3'));var db=require(_0x2506('0x4'))['db'];var utils=require(_0x2506('0x5'));var logger=require(_0x2506('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2506('0x7')][_0x2506('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e1504,_0x3524b3,_0x226b6a){return new BPromise(function(_0xa9be8,_0x1efd77){return client[_0x2506('0x9')](_0x1e1504,_0x226b6a)['then'](function(_0x570450){logger[_0x2506('0xa')]('ChatProactiveAction,\x20%s,\x20%s',_0x3524b3,_0x2506('0xb'));logger[_0x2506('0xc')](_0x2506('0xd'),_0x3524b3,_0x2506('0xb'),JSON['stringify'](_0x570450));if(_0x570450[_0x2506('0xe')]){if(_0x570450[_0x2506('0xe')][_0x2506('0xf')]===0x1f4){logger[_0x2506('0xe')](_0x2506('0x10'),_0x3524b3,_0x570450['error'][_0x2506('0x11')]);return _0x1efd77(_0x570450[_0x2506('0xe')][_0x2506('0x11')]);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x3524b3,_0x570450[_0x2506('0xe')][_0x2506('0x11')]);return _0xa9be8(_0x570450[_0x2506('0xe')][_0x2506('0x11')]);}else{logger[_0x2506('0xa')](_0x2506('0x10'),_0x3524b3,'request\x20sent');_0xa9be8(_0x570450[_0x2506('0x12')][_0x2506('0x11')]);}})['catch'](function(_0x4dda85){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x3524b3,_0x4dda85);_0x1efd77(_0x4dda85);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index a37500e..a5c8fcf 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 _0x262d=['update','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','show','isAuthenticated'];(function(_0x137e7d,_0x5d6c6d){var _0x4fcc8c=function(_0x29d829){while(--_0x29d829){_0x137e7d['push'](_0x137e7d['shift']());}};_0x4fcc8c(++_0x5d6c6d);}(_0x262d,0x14c));var _0xd262=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x262d[_0x25bea7];return _0x175952;};'use strict';var multer=require(_0xd262('0x0'));var util=require(_0xd262('0x1'));var path=require(_0xd262('0x2'));var timeout=require(_0xd262('0x3'));var express=require(_0xd262('0x4'));var router=express['Router']();var auth=require(_0xd262('0x5'));var interaction=require(_0xd262('0x6'));var config=require(_0xd262('0x7'));var controller=require(_0xd262('0x8'));router[_0xd262('0x9')](_0xd262('0xa'),auth['isAuthenticated'](),controller[_0xd262('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xd262('0xc')](),controller[_0xd262('0xd')]);router['delete'](_0xd262('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xd262('0xe')]=router; \ No newline at end of file +var _0x91c7=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','post','create','put','delete','destroy','exports','multer','util'];(function(_0x2d8f6c,_0x44db4c){var _0x3a00f6=function(_0x1b16ea){while(--_0x1b16ea){_0x2d8f6c['push'](_0x2d8f6c['shift']());}};_0x3a00f6(++_0x44db4c);}(_0x91c7,0x10e));var _0x791c=function(_0x4e85c4,_0x447081){_0x4e85c4=_0x4e85c4-0x0;var _0x48b799=_0x91c7[_0x4e85c4];return _0x48b799;};'use strict';var multer=require(_0x791c('0x0'));var util=require(_0x791c('0x1'));var path=require(_0x791c('0x2'));var timeout=require(_0x791c('0x3'));var express=require(_0x791c('0x4'));var router=express[_0x791c('0x5')]();var auth=require(_0x791c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x791c('0x7'));var controller=require(_0x791c('0x8'));router['get'](_0x791c('0x9'),auth[_0x791c('0xa')](),controller['show']);router[_0x791c('0xb')]('/',auth[_0x791c('0xa')](),controller[_0x791c('0xc')]);router[_0x791c('0xd')](_0x791c('0x9'),auth[_0x791c('0xa')](),controller['update']);router[_0x791c('0xe')](_0x791c('0x9'),auth['isAuthenticated'](),controller[_0x791c('0xf')]);module[_0x791c('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 0375161..696e008 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 _0xb1fa=['sequelize','exports','STRING','name','rrmemory','roundrobin'];(function(_0x3851fe,_0x50e4dc){var _0x198ecd=function(_0x4070c5){while(--_0x4070c5){_0x3851fe['push'](_0x3851fe['shift']());}};_0x198ecd(++_0x50e4dc);}(_0xb1fa,0xae));var _0xab1f=function(_0x597be3,_0x181b87){_0x597be3=_0x597be3-0x0;var _0x36b627=_0xb1fa[_0x597be3];return _0x36b627;};'use strict';var Sequelize=require(_0xab1f('0x0'));module[_0xab1f('0x1')]={'name':{'type':Sequelize[_0xab1f('0x2')],'unique':_0xab1f('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xab1f('0x4'),'beepall',_0xab1f('0x5'))}}; \ No newline at end of file +var _0xbd8a=['name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x164580,_0x3c81f9){var _0xed7154=function(_0x3b7929){while(--_0x3b7929){_0x164580['push'](_0x164580['shift']());}};_0xed7154(++_0x3c81f9);}(_0xbd8a,0x12f));var _0xabd8=function(_0x16539a,_0x31409a){_0x16539a=_0x16539a-0x0;var _0x200796=_0xbd8a[_0x16539a];return _0x200796;};'use strict';var Sequelize=require('sequelize');module[_0xabd8('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xabd8('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xabd8('0x2')]},'timeout':{'type':Sequelize[_0xabd8('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xabd8('0x4')](_0xabd8('0x5'),_0xabd8('0x6'),_0xabd8('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 161b0c4..0c34154 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 _0x8fbf=['ChatQueues','sendStatus','name','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','include','findAll','catch','show','params','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','find','describe','findOne','User','agent','chatPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','Team','online','voicePause','interface','flatMap','Agents','each','UserChatQueue','findOrCreate','forEach','userChatQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','emit','userChatQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','./chatQueue.socket','jayson/promise','client','request','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','get'];(function(_0x299027,_0xb6e99e){var _0x3d55c7=function(_0x5506dd){while(--_0x5506dd){_0x299027['push'](_0x299027['shift']());}};_0x3d55c7(++_0xb6e99e);}(_0x8fbf,0x18b));var _0xf8fb=function(_0x15170c,_0x1d419c){_0x15170c=_0x15170c-0x0;var _0x32ea40=_0x8fbf[_0x15170c];return _0x32ea40;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf8fb('0x0'));var rimraf=require(_0xf8fb('0x1'));var zipdir=require(_0xf8fb('0x2'));var jsonpatch=require(_0xf8fb('0x3'));var rp=require(_0xf8fb('0x4'));var moment=require('moment');var BPromise=require(_0xf8fb('0x5'));var Mustache=require(_0xf8fb('0x6'));var util=require(_0xf8fb('0x7'));var path=require(_0xf8fb('0x8'));var sox=require(_0xf8fb('0x9'));var csv=require(_0xf8fb('0xa'));var ejs=require(_0xf8fb('0xb'));var fs=require('fs');var _=require(_0xf8fb('0xc'));var squel=require(_0xf8fb('0xd'));var crypto=require(_0xf8fb('0xe'));var jsforce=require(_0xf8fb('0xf'));var deskjs=require(_0xf8fb('0x10'));var toCsv=require(_0xf8fb('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf8fb('0x11'));var authService=require(_0xf8fb('0x12'));var qs=require(_0xf8fb('0x13'));var as=require(_0xf8fb('0x14'));var hardwareService=require(_0xf8fb('0x15'));var logger=require(_0xf8fb('0x16'))(_0xf8fb('0x17'));var utils=require(_0xf8fb('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf8fb('0x19'));var db=require(_0xf8fb('0x1a'))['db'];config['redis']=_[_0xf8fb('0x1b')](config[_0xf8fb('0x1c')],{'host':_0xf8fb('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf8fb('0x1c')]));require(_0xf8fb('0x1e'))['register'](socket);var jayson=require(_0xf8fb('0x1f'));var client=jayson[_0xf8fb('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ecef8,_0x204eaa,_0x4334b4,_0x2b6159){return new BPromise(function(_0x40469e,_0x4406f2){var _0x1fd24a=_0x2b6159||client;return _0x1fd24a[_0xf8fb('0x21')](_0x4ecef8,_0x4334b4)['then'](function(_0x490e35){logger[_0xf8fb('0x22')](_0xf8fb('0x23'),_0x204eaa,'request\x20sent');logger[_0xf8fb('0x24')](_0xf8fb('0x25'),_0x204eaa,_0xf8fb('0x26'),JSON[_0xf8fb('0x27')](_0x490e35));if(_0x490e35[_0xf8fb('0x28')]){if(_0x490e35['error']['code']===0x1f4){logger[_0xf8fb('0x28')](_0xf8fb('0x23'),_0x204eaa,_0x490e35[_0xf8fb('0x28')]['message']);return _0x4406f2(_0x490e35[_0xf8fb('0x28')]['message']);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x204eaa,_0x490e35[_0xf8fb('0x28')]['message']);return _0x40469e(_0x490e35['error'][_0xf8fb('0x29')]);}else{logger[_0xf8fb('0x22')](_0xf8fb('0x23'),_0x204eaa,'request\x20sent');_0x40469e(_0x490e35['result'][_0xf8fb('0x29')]);}})['catch'](function(_0x2dce91){logger[_0xf8fb('0x28')](_0xf8fb('0x23'),_0x204eaa,_0x2dce91);_0x4406f2(_0x2dce91);});});}function respondWithStatusCode(_0x15b7d3,_0x23bb50){_0x23bb50=_0x23bb50||0xcc;return function(_0x10a59c){if(_0x10a59c){return _0x15b7d3['sendStatus'](_0x23bb50);}return _0x15b7d3[_0xf8fb('0x2a')](_0x23bb50)['end']();};}function respondWithResult(_0x4dd04a,_0x2639f6){_0x2639f6=_0x2639f6||0xc8;return function(_0x548a69){if(_0x548a69){return _0x4dd04a['status'](_0x2639f6)[_0xf8fb('0x2b')](_0x548a69);}};}function respondWithFilteredResult(_0x25fa7d,_0x423d2d){return function(_0x42d4c7){if(_0x42d4c7){var _0x47b500=_0x42d4c7[_0xf8fb('0x2c')],_0xffd350=_0x423d2d[_0xf8fb('0x2d')],_0x4890fb=_0x423d2d[_0xf8fb('0x2d')]+_0x423d2d[_0xf8fb('0x2e')],_0x720551;if(_0x4890fb>=_0x47b500){_0x4890fb=_0x47b500;_0x720551=0xc8;}else{_0x720551=0xce;}_0x25fa7d['status'](_0x720551);return _0x25fa7d['set'](_0xf8fb('0x2f'),_0xffd350+'-'+_0x4890fb+'/'+_0x47b500)[_0xf8fb('0x2b')](_0x42d4c7);}return null;};}function patchUpdates(_0x57dd06){return function(_0x2ad550){try{jsonpatch[_0xf8fb('0x30')](_0x2ad550,_0x57dd06,!![]);}catch(_0x46364f){return BPromise[_0xf8fb('0x31')](_0x46364f);}return _0x2ad550[_0xf8fb('0x32')]();};}function saveUpdates(_0x5297e4,_0xf3ab5c){return function(_0x3c617c){if(_0x3c617c){return _0x3c617c[_0xf8fb('0x33')](_0x5297e4)[_0xf8fb('0x34')](function(_0x5ea602){return _0x5ea602;});}return null;};}function removeEntity(_0xbd89c8,_0x462ad9){return function(_0x5de32a){if(_0x5de32a){return _0x5de32a[_0xf8fb('0x35')]()['then'](function(){var _0x5c3095=_0x5de32a[_0xf8fb('0x36')]({'plain':!![]});var _0xfab7c2=_0xf8fb('0x37');return db['UserProfileResource'][_0xf8fb('0x35')]({'where':{'type':_0xfab7c2,'resourceId':_0x5c3095['id']}})[_0xf8fb('0x34')](function(){return _0x5de32a;});})[_0xf8fb('0x34')](function(){_0xbd89c8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x135526,_0x1caa27){return function(_0x171aaf){if(!_0x171aaf){_0x135526[_0xf8fb('0x38')](0x194);}return _0x171aaf;};}function handleError(_0x215810,_0x2d58be){_0x2d58be=_0x2d58be||0x1f4;return function(_0x2cced6){logger[_0xf8fb('0x28')](_0x2cced6['stack']);if(_0x2cced6['name']){delete _0x2cced6[_0xf8fb('0x39')];}_0x215810['status'](_0x2d58be)['send'](_0x2cced6);};}exports[_0xf8fb('0x3a')]=function(_0x436454,_0xce66fc){var _0x263f62={},_0x5818b5={},_0x46152d={'count':0x0,'rows':[]};var _0x80f1d1=_[_0xf8fb('0x3b')](db[_0xf8fb('0x3c')][_0xf8fb('0x3d')],function(_0x3c3a3d){return{'name':_0x3c3a3d[_0xf8fb('0x3e')],'type':_0x3c3a3d[_0xf8fb('0x3f')][_0xf8fb('0x40')]};});_0x5818b5[_0xf8fb('0x41')]=_[_0xf8fb('0x3b')](_0x80f1d1,'name');_0x5818b5[_0xf8fb('0x42')]=_[_0xf8fb('0x43')](_0x436454[_0xf8fb('0x42')]);_0x5818b5['filters']=_['intersection'](_0x5818b5['model'],_0x5818b5[_0xf8fb('0x42')]);_0x263f62[_0xf8fb('0x44')]=_[_0xf8fb('0x45')](_0x5818b5[_0xf8fb('0x41')],qs['fields'](_0x436454['query'][_0xf8fb('0x46')]));_0x263f62[_0xf8fb('0x44')]=_0x263f62[_0xf8fb('0x44')][_0xf8fb('0x47')]?_0x263f62[_0xf8fb('0x44')]:_0x5818b5[_0xf8fb('0x41')];if(!_0x436454[_0xf8fb('0x42')][_0xf8fb('0x48')](_0xf8fb('0x49'))){_0x263f62[_0xf8fb('0x2e')]=qs['limit'](_0x436454['query'][_0xf8fb('0x2e')]);_0x263f62[_0xf8fb('0x2d')]=qs[_0xf8fb('0x2d')](_0x436454[_0xf8fb('0x42')][_0xf8fb('0x2d')]);}_0x263f62[_0xf8fb('0x4a')]=qs[_0xf8fb('0x4b')](_0x436454[_0xf8fb('0x42')][_0xf8fb('0x4b')]);_0x263f62[_0xf8fb('0x4c')]=qs[_0xf8fb('0x4d')](_[_0xf8fb('0x4e')](_0x436454['query'],_0x5818b5[_0xf8fb('0x4d')]),_0x80f1d1);if(_0x436454[_0xf8fb('0x42')][_0xf8fb('0x4f')]){_0x263f62[_0xf8fb('0x4c')]=_['merge'](_0x263f62['where'],{'$or':_['map'](_0x80f1d1,function(_0x302465){if(_0x302465[_0xf8fb('0x3f')]!==_0xf8fb('0x50')){var _0x5946ec={};_0x5946ec[_0x302465[_0xf8fb('0x39')]]={'$like':'%'+_0x436454[_0xf8fb('0x42')][_0xf8fb('0x4f')]+'%'};return _0x5946ec;}})});}_0x263f62=_[_0xf8fb('0x51')]({},_0x263f62,_0x436454['options']);var _0x9d5c00={'where':_0x263f62[_0xf8fb('0x4c')]};return db[_0xf8fb('0x3c')][_0xf8fb('0x2c')](_0x9d5c00)[_0xf8fb('0x34')](function(_0x5c836b){_0x46152d[_0xf8fb('0x2c')]=_0x5c836b;if(_0x436454[_0xf8fb('0x42')]['includeAll']){_0x263f62[_0xf8fb('0x52')]=[{'all':!![]}];}return db[_0xf8fb('0x3c')][_0xf8fb('0x53')](_0x263f62);})[_0xf8fb('0x34')](function(_0x18d2a4){_0x46152d['rows']=_0x18d2a4;return _0x46152d;})[_0xf8fb('0x34')](respondWithFilteredResult(_0xce66fc,_0x263f62))[_0xf8fb('0x54')](handleError(_0xce66fc,null));};exports[_0xf8fb('0x55')]=function(_0x33f327,_0x1a5347){var _0x517bdf={'raw':!![],'where':{'id':_0x33f327[_0xf8fb('0x56')]['id']}},_0x4f73f2={};_0x4f73f2[_0xf8fb('0x41')]=_[_0xf8fb('0x43')](db[_0xf8fb('0x3c')][_0xf8fb('0x3d')]);_0x4f73f2[_0xf8fb('0x42')]=_['keys'](_0x33f327[_0xf8fb('0x42')]);_0x4f73f2[_0xf8fb('0x4d')]=_[_0xf8fb('0x45')](_0x4f73f2[_0xf8fb('0x41')],_0x4f73f2['query']);_0x517bdf[_0xf8fb('0x44')]=_[_0xf8fb('0x45')](_0x4f73f2[_0xf8fb('0x41')],qs[_0xf8fb('0x46')](_0x33f327['query'][_0xf8fb('0x46')]));_0x517bdf[_0xf8fb('0x44')]=_0x517bdf[_0xf8fb('0x44')][_0xf8fb('0x47')]?_0x517bdf[_0xf8fb('0x44')]:_0x4f73f2[_0xf8fb('0x41')];if(_0x33f327[_0xf8fb('0x42')][_0xf8fb('0x57')]){_0x517bdf[_0xf8fb('0x52')]=[{'all':!![]}];}_0x517bdf=_[_0xf8fb('0x51')]({},_0x517bdf,_0x33f327[_0xf8fb('0x58')]);return db[_0xf8fb('0x3c')]['find'](_0x517bdf)[_0xf8fb('0x34')](handleEntityNotFound(_0x1a5347,null))[_0xf8fb('0x34')](respondWithResult(_0x1a5347,null))[_0xf8fb('0x54')](handleError(_0x1a5347,null));};exports[_0xf8fb('0x59')]=function(_0x4e3fbd,_0x9a2a1e){return db[_0xf8fb('0x3c')][_0xf8fb('0x59')](_0x4e3fbd[_0xf8fb('0x5a')],{})[_0xf8fb('0x34')](function(_0x1f068a){var _0x5171ff=_0x4e3fbd[_0xf8fb('0x5b')][_0xf8fb('0x36')]({'plain':!![]});if(!_0x5171ff)throw new Error(_0xf8fb('0x5c'));if(_0x5171ff[_0xf8fb('0x5d')]===_0xf8fb('0x5b')){var _0x19ee6f=_0x1f068a[_0xf8fb('0x36')]({'plain':!![]});var _0x325e6e=_0xf8fb('0x37');return db[_0xf8fb('0x5e')]['find']({'where':{'name':_0x325e6e,'userProfileId':_0x5171ff[_0xf8fb('0x5f')]},'raw':!![]})[_0xf8fb('0x34')](function(_0x537281){if(_0x537281&&_0x537281['autoAssociation']===0x0){return db['UserProfileResource'][_0xf8fb('0x59')]({'name':_0x19ee6f[_0xf8fb('0x39')],'resourceId':_0x19ee6f['id'],'type':_0x537281['name'],'sectionId':_0x537281['id']},{})[_0xf8fb('0x34')](function(){return _0x1f068a;});}else{return _0x1f068a;}})[_0xf8fb('0x54')](function(_0xdd8da1){logger[_0xf8fb('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdd8da1);throw _0xdd8da1;});}return _0x1f068a;})[_0xf8fb('0x34')](respondWithResult(_0x9a2a1e,0xc9))[_0xf8fb('0x54')](handleError(_0x9a2a1e,null));};exports['update']=function(_0x5b16b1,_0x467f3a){if(_0x5b16b1[_0xf8fb('0x5a')]['id']){delete _0x5b16b1['body']['id'];}return db[_0xf8fb('0x3c')][_0xf8fb('0x60')]({'where':{'id':_0x5b16b1[_0xf8fb('0x56')]['id']}})[_0xf8fb('0x34')](handleEntityNotFound(_0x467f3a,null))[_0xf8fb('0x34')](saveUpdates(_0x5b16b1[_0xf8fb('0x5a')],null))[_0xf8fb('0x34')](respondWithResult(_0x467f3a,null))[_0xf8fb('0x54')](handleError(_0x467f3a,null));};exports['destroy']=function(_0x4f265d,_0x45c00){return db['ChatQueue'][_0xf8fb('0x60')]({'where':{'id':_0x4f265d[_0xf8fb('0x56')]['id']}})[_0xf8fb('0x34')](handleEntityNotFound(_0x45c00,null))[_0xf8fb('0x34')](removeEntity(_0x45c00,null))[_0xf8fb('0x54')](handleError(_0x45c00,null));};exports[_0xf8fb('0x61')]=function(_0x428f86,_0x58d829){return db[_0xf8fb('0x3c')]['describe']()[_0xf8fb('0x34')](respondWithResult(_0x58d829,null))[_0xf8fb('0x54')](handleError(_0x58d829,null));};exports['getMembers']=function(_0x1daeac,_0x4c5725,_0x112beb){var _0x2453cc={'raw':!![],'where':{}},_0x342acb={},_0xb3fa15;return db['ChatQueue'][_0xf8fb('0x62')]({'where':{'id':_0x1daeac['params']['id']}})['then'](handleEntityNotFound(_0x4c5725,null))[_0xf8fb('0x34')](function(_0x18e5ea){if(_0x18e5ea){_0xb3fa15=_0x18e5ea[_0xf8fb('0x36')]({'plain':!![]});_0x342acb['model']=_[_0xf8fb('0x43')](db['UserChatQueue'][_0xf8fb('0x3d')]);_0x342acb[_0xf8fb('0x42')]=_[_0xf8fb('0x43')](_0x1daeac[_0xf8fb('0x42')]);_0x342acb[_0xf8fb('0x4d')]=_['intersection'](_0x342acb['model'],_0x342acb[_0xf8fb('0x42')]);_0x2453cc[_0xf8fb('0x44')]=_['intersection'](_0x342acb[_0xf8fb('0x41')],qs[_0xf8fb('0x46')](_0x1daeac[_0xf8fb('0x42')][_0xf8fb('0x46')]));_0x2453cc[_0xf8fb('0x44')]=_0x2453cc[_0xf8fb('0x44')][_0xf8fb('0x47')]?_0x2453cc[_0xf8fb('0x44')]:_0x342acb['model'];if(!_0x1daeac['query']['hasOwnProperty'](_0xf8fb('0x49'))){_0x2453cc['limit']=qs[_0xf8fb('0x2e')](_0x1daeac[_0xf8fb('0x42')][_0xf8fb('0x2e')]);_0x2453cc[_0xf8fb('0x2d')]=qs[_0xf8fb('0x2d')](_0x1daeac[_0xf8fb('0x42')][_0xf8fb('0x2d')]);}_0x2453cc[_0xf8fb('0x4a')]=qs[_0xf8fb('0x4b')](_0x1daeac['query'][_0xf8fb('0x4b')]);_0x2453cc[_0xf8fb('0x4c')]=qs[_0xf8fb('0x4d')](_[_0xf8fb('0x4e')](_0x1daeac['query'],_0x342acb[_0xf8fb('0x4d')]));_0x2453cc[_0xf8fb('0x4c')]['ChatQueueId']=_0x18e5ea['id'];if(_0x1daeac['query'][_0xf8fb('0x4f')]){_0x2453cc[_0xf8fb('0x4c')]=_[_0xf8fb('0x51')](_0x2453cc['where'],{'$or':_[_0xf8fb('0x3b')](_0x2453cc[_0xf8fb('0x44')],function(_0x5df0f4){var _0x375ee6={};_0x375ee6[_0x5df0f4]={'$like':'%'+_0x1daeac[_0xf8fb('0x42')][_0xf8fb('0x4f')]+'%'};return _0x375ee6;})});}_0x2453cc=_['merge']({},_0x2453cc,_0x1daeac[_0xf8fb('0x58')]);return db['UserChatQueue'][_0xf8fb('0x53')](_0x2453cc);}})[_0xf8fb('0x34')](function(_0x300bd2){if(_0x300bd2){return db[_0xf8fb('0x63')]['findAndCountAll']({'where':{'id':_['map'](_0x300bd2,'UserId'),'role':_0xf8fb('0x64')},'attributes':['id','name',_0xf8fb('0x65'),_0xf8fb('0x66'),'createdAt']});}})[_0xf8fb('0x34')](function(_0x1d68f7){if(_0x1d68f7){return{'count':_0x1d68f7[_0xf8fb('0x2c')],'rows':_['map'](_0x1d68f7[_0xf8fb('0x67')],function(_0x21ca1e){return{'membername':_0x21ca1e[_0xf8fb('0x39')],'UserId':_0x21ca1e['id'],'queue_name':_0xb3fa15[_0xf8fb('0x39')],'ChatQueueId':_0xb3fa15['id'],'interface':util[_0xf8fb('0x68')](_0xf8fb('0x69'),_0xf8fb('0x6a'),_0x21ca1e[_0xf8fb('0x39')]),'penalty':0x0,'paused':_0x21ca1e[_0xf8fb('0x65')],'createdAt':_0x21ca1e[_0xf8fb('0x6b')],'updatedAt':_0x21ca1e[_0xf8fb('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf8fb('0x34')](respondWithFilteredResult(_0x4c5725,_0x2453cc))[_0xf8fb('0x54')](handleError(_0x4c5725,null));};exports[_0xf8fb('0x6c')]=function(_0x1db51a,_0xa7d337,_0x286574){var _0x3f69c0={};var _0x32f2ec={};var _0x266a04;var _0xad9d79;return db[_0xf8fb('0x3c')][_0xf8fb('0x62')]({'where':{'id':_0x1db51a[_0xf8fb('0x56')]['id']}})['then'](handleEntityNotFound(_0xa7d337,null))[_0xf8fb('0x34')](function(_0x129f32){if(_0x129f32){_0x266a04=_0x129f32;_0x32f2ec['model']=_[_0xf8fb('0x43')](db['Team'][_0xf8fb('0x3d')]);_0x32f2ec[_0xf8fb('0x42')]=_[_0xf8fb('0x43')](_0x1db51a[_0xf8fb('0x42')]);_0x32f2ec[_0xf8fb('0x4d')]=_[_0xf8fb('0x45')](_0x32f2ec[_0xf8fb('0x41')],_0x32f2ec[_0xf8fb('0x42')]);_0x3f69c0[_0xf8fb('0x44')]=_[_0xf8fb('0x45')](_0x32f2ec[_0xf8fb('0x41')],qs[_0xf8fb('0x46')](_0x1db51a[_0xf8fb('0x42')]['fields']));_0x3f69c0['attributes']=_0x3f69c0['attributes'][_0xf8fb('0x47')]?_0x3f69c0['attributes']:_0x32f2ec[_0xf8fb('0x41')];_0x3f69c0[_0xf8fb('0x4a')]=qs[_0xf8fb('0x4b')](_0x1db51a[_0xf8fb('0x42')][_0xf8fb('0x4b')]);_0x3f69c0[_0xf8fb('0x4c')]=qs['filters'](_[_0xf8fb('0x4e')](_0x1db51a[_0xf8fb('0x42')],_0x32f2ec[_0xf8fb('0x4d')]));if(_0x1db51a[_0xf8fb('0x42')][_0xf8fb('0x4f')]){_0x3f69c0[_0xf8fb('0x4c')]=_[_0xf8fb('0x51')](_0x3f69c0[_0xf8fb('0x4c')],{'$or':_[_0xf8fb('0x3b')](_0x3f69c0[_0xf8fb('0x44')],function(_0x3da56e){var _0xff1af={};_0xff1af[_0x3da56e]={'$like':'%'+_0x1db51a[_0xf8fb('0x42')]['filter']+'%'};return _0xff1af;})});}_0x3f69c0=_['merge']({},_0x3f69c0,_0x1db51a[_0xf8fb('0x58')]);return _0x266a04[_0xf8fb('0x6c')](_0x3f69c0);}})[_0xf8fb('0x34')](function(_0x5cd65f){if(_0x5cd65f){_0xad9d79=_0x5cd65f['length'];if(!_0x1db51a[_0xf8fb('0x42')]['hasOwnProperty'](_0xf8fb('0x49'))){_0x3f69c0[_0xf8fb('0x2e')]=qs[_0xf8fb('0x2e')](_0x1db51a[_0xf8fb('0x42')]['limit']);_0x3f69c0[_0xf8fb('0x2d')]=qs[_0xf8fb('0x2d')](_0x1db51a['query'][_0xf8fb('0x2d')]);}return _0x266a04['getTeams'](_0x3f69c0);}})[_0xf8fb('0x34')](function(_0x41d0af){if(_0x41d0af){return _0x41d0af?{'count':_0xad9d79,'rows':_0x41d0af}:null;}})[_0xf8fb('0x34')](respondWithResult(_0xa7d337,null))['catch'](handleError(_0xa7d337,null));};exports['addTeams']=function(_0x2c3d19,_0x7ea70b,_0x6d45ac){var _0x2a8b4f=_0x2c3d19[_0xf8fb('0x5a')]['ids'];return db[_0xf8fb('0x6d')][_0xf8fb('0x53')]({'where':{'id':_0x2a8b4f},'attributes':['id'],'include':[{'model':db[_0xf8fb('0x63')],'as':'Agents','attributes':['id',_0xf8fb('0x39'),_0xf8fb('0x6e'),_0xf8fb('0x6f'),_0xf8fb('0x70')],'raw':!![]}]})[_0xf8fb('0x34')](function(_0x526825){if(_0x526825){var _0x4193c7=_[_0xf8fb('0x71')](_0x526825,function(_0x1fee10){var _0x363a13=_0x1fee10[_0xf8fb('0x36')]({'plain':!![]});return _0x363a13[_0xf8fb('0x72')];});return db[_0xf8fb('0x3c')][_0xf8fb('0x60')]({'where':{'id':_0x2c3d19[_0xf8fb('0x56')]['id']}})[_0xf8fb('0x34')](function(_0x23d411){return db['sequelize']['transaction'](function(_0x523bc5){return _0x23d411['addTeams'](_0x2a8b4f,{'transaction':_0x523bc5})[_0xf8fb('0x34')](function(){return BPromise[_0xf8fb('0x73')](_0x4193c7,function(_0x27e150){return db[_0xf8fb('0x74')][_0xf8fb('0x75')]({'where':{'UserId':_0x27e150['id'],'ChatQueueId':_0x2c3d19[_0xf8fb('0x56')]['id']},'transaction':_0x523bc5});});})[_0xf8fb('0x34')](function(){_0x4193c7[_0xf8fb('0x76')](function(_0x2ac4c6){socket['emit'](_0xf8fb('0x77'),{'UserId':_0x2ac4c6['id'],'ChatQueueId':_0x23d411['id']});});});});});}})['then'](respondWithStatusCode(_0x7ea70b,null))['catch'](handleError(_0x7ea70b,null));};exports[_0xf8fb('0x78')]=function(_0x47064b,_0x4143db,_0x5c773a){return db['Team'][_0xf8fb('0x53')]({'where':{'id':_0x47064b[_0xf8fb('0x42')][_0xf8fb('0x79')]},'attributes':['id'],'include':[{'model':db[_0xf8fb('0x63')],'as':_0xf8fb('0x72'),'attributes':['id'],'raw':!![]}]})[_0xf8fb('0x34')](handleEntityNotFound(_0x4143db,null))['then'](function(_0x44df4d){var _0x4dcd93=_['map'](_0x44df4d,'id');var _0x208c8e=[];var _0x16d2d3=[];var _0x5562d6=squel[_0xf8fb('0x7a')]();_0x5562d6[_0xf8fb('0x7b')](_0xf8fb('0x7c'))['from'](_0xf8fb('0x7d'),'tq')[_0xf8fb('0x7e')](_0xf8fb('0x7f'),'ut',_0xf8fb('0x80'))['where'](_0xf8fb('0x81'),_0x47064b[_0xf8fb('0x56')]['id']);for(var _0x148aad=0x0;_0x148aad<_0x44df4d[_0xf8fb('0x47')];_0x148aad+=0x1){let _0xc82ff3=_0x44df4d[_0x148aad];for(var _0x20e0fe=0x0;_0x20e0fe<_0xc82ff3[_0xf8fb('0x72')]['length'];_0x20e0fe+=0x1){let _0x443c35=_0xc82ff3[_0xf8fb('0x72')][_0x20e0fe];var _0x2b79bf=_0x5562d6['clone']();_0x2b79bf[_0xf8fb('0x4c')](_0xf8fb('0x82'),_0x443c35['id']);_0x16d2d3[_0xf8fb('0x83')](db[_0xf8fb('0x84')][_0xf8fb('0x42')](_0x2b79bf[_0xf8fb('0x85')](),{'type':db[_0xf8fb('0x84')][_0xf8fb('0x86')][_0xf8fb('0x87')]})[_0xf8fb('0x34')](function(_0x90837d){if(_0x90837d[_0xf8fb('0x47')]===0x1){return _0x443c35['id'];}else{var _0x14c103=_[_0xf8fb('0x88')](_[_0xf8fb('0x3b')](_0x90837d,_0xf8fb('0x89')),function(_0x3a5fe9){return _[_0xf8fb('0x8a')](_0x4dcd93,_0x3a5fe9);});if(_0x14c103){return _0x443c35['id'];}}}));}}return BPromise[_0xf8fb('0x8b')](_0x16d2d3)[_0xf8fb('0x34')](function(_0x20ae3e){_0x208c8e=_(_0x208c8e)[_0xf8fb('0x8c')](_0x20ae3e)['compact']()[_0xf8fb('0x8d')]();return db[_0xf8fb('0x3c')][_0xf8fb('0x60')]({'where':{'id':_0x47064b[_0xf8fb('0x56')]['id']}})[_0xf8fb('0x34')](function(_0x3f5681){return db['sequelize']['transaction'](function(_0x2c5705){return _0x3f5681['removeTeams'](_0x47064b[_0xf8fb('0x42')][_0xf8fb('0x79')],{'transaction':_0x2c5705})[_0xf8fb('0x34')](function(){if(!_[_0xf8fb('0x8e')](_0x208c8e)){return _0x3f5681[_0xf8fb('0x8f')](_0x208c8e,{'transaction':_0x2c5705});}})[_0xf8fb('0x34')](function(){_0x208c8e[_0xf8fb('0x76')](function(_0x2baabd){socket[_0xf8fb('0x90')](_0xf8fb('0x91'),{'UserId':_0x2baabd,'ChatQueueId':_0x3f5681['id']});});});});});});})['then'](respondWithStatusCode(_0x4143db,null))[_0xf8fb('0x54')](handleError(_0x4143db,null));};exports[_0xf8fb('0x92')]=function(_0x5a0b3,_0x31e0fc,_0x3f4d5c){return db[_0xf8fb('0x3c')][_0xf8fb('0x60')]({'where':{'id':_0x5a0b3[_0xf8fb('0x56')]['id']}})[_0xf8fb('0x34')](handleEntityNotFound(_0x31e0fc,null))[_0xf8fb('0x34')](function(_0x3dcf1f){if(_0x3dcf1f){return _0x3dcf1f[_0xf8fb('0x92')](_0x5a0b3[_0xf8fb('0x5a')][_0xf8fb('0x79')],_['omit'](_0x5a0b3['body'],[_0xf8fb('0x79'),'id'])||{})[_0xf8fb('0x93')](function(_0x4a29de){for(var _0x2347f4=0x0;_0x2347f4<_0x5a0b3[_0xf8fb('0x5a')][_0xf8fb('0x79')][_0xf8fb('0x47')];_0x2347f4+=0x1){socket[_0xf8fb('0x90')](_0xf8fb('0x77'),{'UserId':_0x5a0b3[_0xf8fb('0x5a')][_0xf8fb('0x79')][_0x2347f4],'ChatQueueId':_0x5a0b3[_0xf8fb('0x56')]['id']});}return _0x4a29de;});}})[_0xf8fb('0x34')](respondWithResult(_0x31e0fc,null))[_0xf8fb('0x54')](handleError(_0x31e0fc,null));};exports[_0xf8fb('0x8f')]=function(_0x496b10,_0xd1033b,_0x425709){return db[_0xf8fb('0x3c')][_0xf8fb('0x60')]({'where':{'id':_0x496b10[_0xf8fb('0x56')]['id']}})[_0xf8fb('0x34')](handleEntityNotFound(_0xd1033b,null))[_0xf8fb('0x34')](function(_0x3e7694){if(_0x3e7694){return _0x3e7694[_0xf8fb('0x8f')](_0x496b10[_0xf8fb('0x42')][_0xf8fb('0x79')])['then'](function(){if(_[_0xf8fb('0x94')](_0x496b10['query'][_0xf8fb('0x79')])){for(var _0x27ecb1=0x0;_0x27ecb1<_0x496b10['query'][_0xf8fb('0x79')]['length'];_0x27ecb1+=0x1){socket[_0xf8fb('0x90')](_0xf8fb('0x91'),{'UserId':Number(_0x496b10[_0xf8fb('0x42')][_0xf8fb('0x79')][_0x27ecb1]),'ChatQueueId':Number(_0x496b10[_0xf8fb('0x56')]['id'])});}}else{socket[_0xf8fb('0x90')](_0xf8fb('0x91'),{'UserId':Number(_0x496b10[_0xf8fb('0x42')][_0xf8fb('0x79')]),'ChatQueueId':Number(_0x496b10['params']['id'])});}});}})[_0xf8fb('0x34')](respondWithStatusCode(_0xd1033b,null))['catch'](handleError(_0xd1033b,null));};exports[_0xf8fb('0x95')]=function(_0x59a0c3,_0x4a74a1,_0x503897){var _0x40b6a1={};var _0x4682cb={};var _0x2cc46f;var _0x440612;return db[_0xf8fb('0x3c')]['findOne']({'where':{'id':_0x59a0c3[_0xf8fb('0x56')]['id']}})['then'](handleEntityNotFound(_0x4a74a1,null))[_0xf8fb('0x34')](function(_0x2ca88e){if(_0x2ca88e){_0x2cc46f=_0x2ca88e;_0x4682cb[_0xf8fb('0x41')]=_[_0xf8fb('0x43')](db[_0xf8fb('0x63')][_0xf8fb('0x3d')]);_0x4682cb[_0xf8fb('0x42')]=_['keys'](_0x59a0c3[_0xf8fb('0x42')]);_0x4682cb[_0xf8fb('0x4d')]=_[_0xf8fb('0x45')](_0x4682cb[_0xf8fb('0x41')],_0x4682cb['query']);_0x40b6a1[_0xf8fb('0x44')]=_[_0xf8fb('0x45')](_0x4682cb['model'],qs[_0xf8fb('0x46')](_0x59a0c3[_0xf8fb('0x42')]['fields']));_0x40b6a1[_0xf8fb('0x44')]=_0x40b6a1[_0xf8fb('0x44')]['length']?_0x40b6a1['attributes']:_0x4682cb[_0xf8fb('0x41')];_0x40b6a1['order']=qs[_0xf8fb('0x4b')](_0x59a0c3['query'][_0xf8fb('0x4b')]);_0x40b6a1['where']=qs[_0xf8fb('0x4d')](_[_0xf8fb('0x4e')](_0x59a0c3[_0xf8fb('0x42')],_0x4682cb[_0xf8fb('0x4d')]));if(_0x59a0c3[_0xf8fb('0x42')]['filter']){_0x40b6a1[_0xf8fb('0x4c')]=_['merge'](_0x40b6a1[_0xf8fb('0x4c')],{'$or':_[_0xf8fb('0x3b')](_0x40b6a1[_0xf8fb('0x44')],function(_0x57044a){var _0x5ab225={};_0x5ab225[_0x57044a]={'$like':'%'+_0x59a0c3[_0xf8fb('0x42')][_0xf8fb('0x4f')]+'%'};return _0x5ab225;})});}_0x40b6a1=_[_0xf8fb('0x51')]({},_0x40b6a1,_0x59a0c3[_0xf8fb('0x58')]);return _0x2cc46f[_0xf8fb('0x95')](_0x40b6a1);}})[_0xf8fb('0x34')](function(_0x367608){if(_0x367608){_0x440612=_0x367608[_0xf8fb('0x47')];if(!_0x59a0c3['query'][_0xf8fb('0x48')](_0xf8fb('0x49'))){_0x40b6a1[_0xf8fb('0x2e')]=qs[_0xf8fb('0x2e')](_0x59a0c3[_0xf8fb('0x42')][_0xf8fb('0x2e')]);_0x40b6a1[_0xf8fb('0x2d')]=qs[_0xf8fb('0x2d')](_0x59a0c3[_0xf8fb('0x42')][_0xf8fb('0x2d')]);}return _0x2cc46f[_0xf8fb('0x95')](_0x40b6a1);}})['then'](function(_0x315546){if(_0x315546){return _0x315546?{'count':_0x440612,'rows':_0x315546}:null;}})[_0xf8fb('0x34')](respondWithResult(_0x4a74a1,null))[_0xf8fb('0x54')](handleError(_0x4a74a1,null));}; \ No newline at end of file +var _0xeed0=['send','ChatQueue','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','length','options','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','ChatQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','pick','ChatQueueId','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','getTeams','Team','addTeams','ids','Agents','interface','flatMap','transaction','each','findOrCreate','emit','User','select','field','tq.TeamId','from','join','user_has_teams','ChatQueueId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','removeTeams','removeAgents','addAgents','omit','spread','userChatQueue:save','isArray','userChatQueue:remove','getAgents','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','jayson/promise','client','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','UserProfileResource','end','stack','name'];(function(_0x279bf9,_0x457b07){var _0x2cd266=function(_0x361a36){while(--_0x361a36){_0x279bf9['push'](_0x279bf9['shift']());}};_0x2cd266(++_0x457b07);}(_0xeed0,0xf1));var _0x0eed=function(_0x2b1f6e,_0x5d16f1){_0x2b1f6e=_0x2b1f6e-0x0;var _0x37eb42=_0xeed0[_0x2b1f6e];return _0x37eb42;};'use strict';var pdf=require(_0x0eed('0x0'));var emlformat=require(_0x0eed('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0eed('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0eed('0x3'));var moment=require(_0x0eed('0x4'));var BPromise=require(_0x0eed('0x5'));var Mustache=require(_0x0eed('0x6'));var util=require(_0x0eed('0x7'));var path=require(_0x0eed('0x8'));var sox=require(_0x0eed('0x9'));var csv=require(_0x0eed('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0eed('0xb'));var squel=require('squel');var crypto=require(_0x0eed('0xc'));var jsforce=require(_0x0eed('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0eed('0xe'));var Redis=require(_0x0eed('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0eed('0x10'));var as=require(_0x0eed('0x11'));var hardwareService=require(_0x0eed('0x12'));var logger=require('../../config/logger')(_0x0eed('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0eed('0x14'));var db=require(_0x0eed('0x15'))['db'];config[_0x0eed('0x16')]=_[_0x0eed('0x17')](config[_0x0eed('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x0eed('0x18'))(new Redis(config[_0x0eed('0x16')]));require(_0x0eed('0x19'))['register'](socket);var jayson=require(_0x0eed('0x1a'));var client=jayson[_0x0eed('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x172ba2,_0xc47bcd,_0x42d53e,_0x2074c0){return new BPromise(function(_0x34dc33,_0x16e24d){var _0x1d2678=_0x2074c0||client;return _0x1d2678['request'](_0x172ba2,_0x42d53e)[_0x0eed('0x1c')](function(_0x1c8f19){logger[_0x0eed('0x1d')](_0x0eed('0x1e'),_0xc47bcd,_0x0eed('0x1f'));logger[_0x0eed('0x20')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0xc47bcd,_0x0eed('0x1f'),JSON[_0x0eed('0x21')](_0x1c8f19));if(_0x1c8f19[_0x0eed('0x22')]){if(_0x1c8f19[_0x0eed('0x22')][_0x0eed('0x23')]===0x1f4){logger[_0x0eed('0x22')](_0x0eed('0x1e'),_0xc47bcd,_0x1c8f19[_0x0eed('0x22')][_0x0eed('0x24')]);return _0x16e24d(_0x1c8f19[_0x0eed('0x22')][_0x0eed('0x24')]);}logger[_0x0eed('0x22')](_0x0eed('0x1e'),_0xc47bcd,_0x1c8f19[_0x0eed('0x22')][_0x0eed('0x24')]);return _0x34dc33(_0x1c8f19[_0x0eed('0x22')][_0x0eed('0x24')]);}else{logger[_0x0eed('0x1d')](_0x0eed('0x1e'),_0xc47bcd,_0x0eed('0x1f'));_0x34dc33(_0x1c8f19[_0x0eed('0x25')][_0x0eed('0x24')]);}})['catch'](function(_0x5a39bb){logger[_0x0eed('0x22')](_0x0eed('0x1e'),_0xc47bcd,_0x5a39bb);_0x16e24d(_0x5a39bb);});});}function respondWithStatusCode(_0x3642fb,_0x49c3bf){_0x49c3bf=_0x49c3bf||0xcc;return function(_0x356a15){if(_0x356a15){return _0x3642fb['sendStatus'](_0x49c3bf);}return _0x3642fb[_0x0eed('0x26')](_0x49c3bf)['end']();};}function respondWithResult(_0x58188d,_0x10a19b){_0x10a19b=_0x10a19b||0xc8;return function(_0x46783e){if(_0x46783e){return _0x58188d[_0x0eed('0x26')](_0x10a19b)['json'](_0x46783e);}};}function respondWithFilteredResult(_0x30568b,_0x4c441f){return function(_0x5c77dd){if(_0x5c77dd){var _0xff97e6=_0x5c77dd[_0x0eed('0x27')],_0x4cdb33=_0x4c441f['offset'],_0xd91179=_0x4c441f[_0x0eed('0x28')]+_0x4c441f['limit'],_0x3002b2;if(_0xd91179>=_0xff97e6){_0xd91179=_0xff97e6;_0x3002b2=0xc8;}else{_0x3002b2=0xce;}_0x30568b[_0x0eed('0x26')](_0x3002b2);return _0x30568b[_0x0eed('0x29')](_0x0eed('0x2a'),_0x4cdb33+'-'+_0xd91179+'/'+_0xff97e6)[_0x0eed('0x2b')](_0x5c77dd);}return null;};}function patchUpdates(_0x2dbeb4){return function(_0x852977){try{jsonpatch[_0x0eed('0x2c')](_0x852977,_0x2dbeb4,!![]);}catch(_0x522296){return BPromise[_0x0eed('0x2d')](_0x522296);}return _0x852977[_0x0eed('0x2e')]();};}function saveUpdates(_0x4a93fe,_0xdc96f3){return function(_0xbcc30d){if(_0xbcc30d){return _0xbcc30d[_0x0eed('0x2f')](_0x4a93fe)[_0x0eed('0x1c')](function(_0x1437c1){return _0x1437c1;});}return null;};}function removeEntity(_0x1dc6c5,_0x990ff2){return function(_0x19e55b){if(_0x19e55b){return _0x19e55b[_0x0eed('0x30')]()['then'](function(){var _0x2ba810=_0x19e55b['get']({'plain':!![]});var _0xbb55eb='ChatQueues';return db[_0x0eed('0x31')][_0x0eed('0x30')]({'where':{'type':_0xbb55eb,'resourceId':_0x2ba810['id']}})[_0x0eed('0x1c')](function(){return _0x19e55b;});})['then'](function(){_0x1dc6c5[_0x0eed('0x26')](0xcc)[_0x0eed('0x32')]();});}};}function handleEntityNotFound(_0x10ce88,_0x3760b8){return function(_0x315289){if(!_0x315289){_0x10ce88['sendStatus'](0x194);}return _0x315289;};}function handleError(_0x1c3160,_0x421a88){_0x421a88=_0x421a88||0x1f4;return function(_0x2fe75b){logger['error'](_0x2fe75b[_0x0eed('0x33')]);if(_0x2fe75b[_0x0eed('0x34')]){delete _0x2fe75b['name'];}_0x1c3160[_0x0eed('0x26')](_0x421a88)[_0x0eed('0x35')](_0x2fe75b);};}exports['index']=function(_0x25442f,_0x4abc6d){var _0x366db9={},_0x109544={},_0x462764={'count':0x0,'rows':[]};var _0x49234e=_['map'](db[_0x0eed('0x36')][_0x0eed('0x37')],function(_0x40a46e){return{'name':_0x40a46e[_0x0eed('0x38')],'type':_0x40a46e[_0x0eed('0x39')][_0x0eed('0x3a')]};});_0x109544[_0x0eed('0x3b')]=_[_0x0eed('0x3c')](_0x49234e,_0x0eed('0x34'));_0x109544[_0x0eed('0x3d')]=_[_0x0eed('0x3e')](_0x25442f['query']);_0x109544[_0x0eed('0x3f')]=_[_0x0eed('0x40')](_0x109544[_0x0eed('0x3b')],_0x109544[_0x0eed('0x3d')]);_0x366db9[_0x0eed('0x41')]=_[_0x0eed('0x40')](_0x109544['model'],qs[_0x0eed('0x42')](_0x25442f[_0x0eed('0x3d')][_0x0eed('0x42')]));_0x366db9[_0x0eed('0x41')]=_0x366db9[_0x0eed('0x41')]['length']?_0x366db9[_0x0eed('0x41')]:_0x109544['model'];if(!_0x25442f[_0x0eed('0x3d')][_0x0eed('0x43')](_0x0eed('0x44'))){_0x366db9[_0x0eed('0x45')]=qs[_0x0eed('0x45')](_0x25442f[_0x0eed('0x3d')]['limit']);_0x366db9[_0x0eed('0x28')]=qs[_0x0eed('0x28')](_0x25442f[_0x0eed('0x3d')][_0x0eed('0x28')]);}_0x366db9[_0x0eed('0x46')]=qs[_0x0eed('0x47')](_0x25442f['query']['sort']);_0x366db9[_0x0eed('0x48')]=qs['filters'](_['pick'](_0x25442f['query'],_0x109544['filters']),_0x49234e);if(_0x25442f[_0x0eed('0x3d')][_0x0eed('0x49')]){_0x366db9['where']=_[_0x0eed('0x4a')](_0x366db9[_0x0eed('0x48')],{'$or':_[_0x0eed('0x3c')](_0x49234e,function(_0x2aa628){if(_0x2aa628[_0x0eed('0x39')]!==_0x0eed('0x4b')){var _0x22c8c4={};_0x22c8c4[_0x2aa628[_0x0eed('0x34')]]={'$like':'%'+_0x25442f[_0x0eed('0x3d')][_0x0eed('0x49')]+'%'};return _0x22c8c4;}})});}_0x366db9=_['merge']({},_0x366db9,_0x25442f['options']);var _0x4e0abe={'where':_0x366db9[_0x0eed('0x48')]};return db[_0x0eed('0x36')][_0x0eed('0x27')](_0x4e0abe)[_0x0eed('0x1c')](function(_0x13bb33){_0x462764[_0x0eed('0x27')]=_0x13bb33;if(_0x25442f[_0x0eed('0x3d')][_0x0eed('0x4c')]){_0x366db9[_0x0eed('0x4d')]=[{'all':!![]}];}return db[_0x0eed('0x36')][_0x0eed('0x4e')](_0x366db9);})[_0x0eed('0x1c')](function(_0x3cc9fe){_0x462764[_0x0eed('0x4f')]=_0x3cc9fe;return _0x462764;})[_0x0eed('0x1c')](respondWithFilteredResult(_0x4abc6d,_0x366db9))[_0x0eed('0x50')](handleError(_0x4abc6d,null));};exports['show']=function(_0x5c3174,_0x2d5472){var _0x3c178b={'raw':!![],'where':{'id':_0x5c3174[_0x0eed('0x51')]['id']}},_0x53f23f={};_0x53f23f[_0x0eed('0x3b')]=_['keys'](db[_0x0eed('0x36')][_0x0eed('0x37')]);_0x53f23f[_0x0eed('0x3d')]=_[_0x0eed('0x3e')](_0x5c3174[_0x0eed('0x3d')]);_0x53f23f[_0x0eed('0x3f')]=_[_0x0eed('0x40')](_0x53f23f[_0x0eed('0x3b')],_0x53f23f[_0x0eed('0x3d')]);_0x3c178b[_0x0eed('0x41')]=_['intersection'](_0x53f23f['model'],qs[_0x0eed('0x42')](_0x5c3174[_0x0eed('0x3d')][_0x0eed('0x42')]));_0x3c178b[_0x0eed('0x41')]=_0x3c178b[_0x0eed('0x41')][_0x0eed('0x52')]?_0x3c178b[_0x0eed('0x41')]:_0x53f23f[_0x0eed('0x3b')];if(_0x5c3174['query'][_0x0eed('0x4c')]){_0x3c178b['include']=[{'all':!![]}];}_0x3c178b=_[_0x0eed('0x4a')]({},_0x3c178b,_0x5c3174[_0x0eed('0x53')]);return db[_0x0eed('0x36')][_0x0eed('0x54')](_0x3c178b)[_0x0eed('0x1c')](handleEntityNotFound(_0x2d5472,null))[_0x0eed('0x1c')](respondWithResult(_0x2d5472,null))[_0x0eed('0x50')](handleError(_0x2d5472,null));};exports[_0x0eed('0x55')]=function(_0x486e52,_0x478ddf){return db[_0x0eed('0x36')][_0x0eed('0x55')](_0x486e52[_0x0eed('0x56')],{})['then'](function(_0x5d9219){var _0x10a1aa=_0x486e52['user'][_0x0eed('0x57')]({'plain':!![]});if(!_0x10a1aa)throw new Error(_0x0eed('0x58'));if(_0x10a1aa['role']===_0x0eed('0x59')){var _0x5d33dc=_0x5d9219[_0x0eed('0x57')]({'plain':!![]});var _0x218303=_0x0eed('0x5a');return db[_0x0eed('0x5b')]['find']({'where':{'name':_0x218303,'userProfileId':_0x10a1aa[_0x0eed('0x5c')]},'raw':!![]})[_0x0eed('0x1c')](function(_0x34a12f){if(_0x34a12f&&_0x34a12f[_0x0eed('0x5d')]===0x0){return db['UserProfileResource'][_0x0eed('0x55')]({'name':_0x5d33dc[_0x0eed('0x34')],'resourceId':_0x5d33dc['id'],'type':_0x34a12f[_0x0eed('0x34')],'sectionId':_0x34a12f['id']},{})[_0x0eed('0x1c')](function(){return _0x5d9219;});}else{return _0x5d9219;}})[_0x0eed('0x50')](function(_0x150265){logger['error'](_0x0eed('0x5e'),_0x150265);throw _0x150265;});}return _0x5d9219;})[_0x0eed('0x1c')](respondWithResult(_0x478ddf,0xc9))[_0x0eed('0x50')](handleError(_0x478ddf,null));};exports['update']=function(_0x29dea6,_0x47c77a){if(_0x29dea6[_0x0eed('0x56')]['id']){delete _0x29dea6[_0x0eed('0x56')]['id'];}return db['ChatQueue'][_0x0eed('0x54')]({'where':{'id':_0x29dea6[_0x0eed('0x51')]['id']}})[_0x0eed('0x1c')](handleEntityNotFound(_0x47c77a,null))[_0x0eed('0x1c')](saveUpdates(_0x29dea6['body'],null))[_0x0eed('0x1c')](respondWithResult(_0x47c77a,null))[_0x0eed('0x50')](handleError(_0x47c77a,null));};exports[_0x0eed('0x30')]=function(_0x1bfbde,_0x52f7a9){return db['ChatQueue']['find']({'where':{'id':_0x1bfbde[_0x0eed('0x51')]['id']}})['then'](handleEntityNotFound(_0x52f7a9,null))[_0x0eed('0x1c')](removeEntity(_0x52f7a9,null))[_0x0eed('0x50')](handleError(_0x52f7a9,null));};exports[_0x0eed('0x5f')]=function(_0x5c5e28,_0x125f2a){return db['ChatQueue'][_0x0eed('0x5f')]()[_0x0eed('0x1c')](respondWithResult(_0x125f2a,null))[_0x0eed('0x50')](handleError(_0x125f2a,null));};exports[_0x0eed('0x60')]=function(_0x20cfc8,_0x725885,_0x165f0d){var _0x5d381e={'raw':!![],'where':{}},_0x11506b={},_0x592bf0;return db[_0x0eed('0x36')][_0x0eed('0x61')]({'where':{'id':_0x20cfc8[_0x0eed('0x51')]['id']}})[_0x0eed('0x1c')](handleEntityNotFound(_0x725885,null))[_0x0eed('0x1c')](function(_0x153176){if(_0x153176){_0x592bf0=_0x153176[_0x0eed('0x57')]({'plain':!![]});_0x11506b[_0x0eed('0x3b')]=_[_0x0eed('0x3e')](db[_0x0eed('0x62')]['rawAttributes']);_0x11506b[_0x0eed('0x3d')]=_[_0x0eed('0x3e')](_0x20cfc8[_0x0eed('0x3d')]);_0x11506b[_0x0eed('0x3f')]=_[_0x0eed('0x40')](_0x11506b['model'],_0x11506b[_0x0eed('0x3d')]);_0x5d381e[_0x0eed('0x41')]=_[_0x0eed('0x40')](_0x11506b[_0x0eed('0x3b')],qs[_0x0eed('0x42')](_0x20cfc8['query']['fields']));_0x5d381e[_0x0eed('0x41')]=_0x5d381e[_0x0eed('0x41')]['length']?_0x5d381e[_0x0eed('0x41')]:_0x11506b[_0x0eed('0x3b')];if(!_0x20cfc8[_0x0eed('0x3d')]['hasOwnProperty'](_0x0eed('0x44'))){_0x5d381e['limit']=qs['limit'](_0x20cfc8[_0x0eed('0x3d')][_0x0eed('0x45')]);_0x5d381e[_0x0eed('0x28')]=qs[_0x0eed('0x28')](_0x20cfc8[_0x0eed('0x3d')][_0x0eed('0x28')]);}_0x5d381e['order']=qs[_0x0eed('0x47')](_0x20cfc8[_0x0eed('0x3d')][_0x0eed('0x47')]);_0x5d381e['where']=qs['filters'](_[_0x0eed('0x63')](_0x20cfc8[_0x0eed('0x3d')],_0x11506b['filters']));_0x5d381e[_0x0eed('0x48')][_0x0eed('0x64')]=_0x153176['id'];if(_0x20cfc8[_0x0eed('0x3d')][_0x0eed('0x49')]){_0x5d381e[_0x0eed('0x48')]=_[_0x0eed('0x4a')](_0x5d381e[_0x0eed('0x48')],{'$or':_[_0x0eed('0x3c')](_0x5d381e[_0x0eed('0x41')],function(_0x13b739){var _0x11fbd9={};_0x11fbd9[_0x13b739]={'$like':'%'+_0x20cfc8[_0x0eed('0x3d')]['filter']+'%'};return _0x11fbd9;})});}_0x5d381e=_[_0x0eed('0x4a')]({},_0x5d381e,_0x20cfc8['options']);return db[_0x0eed('0x62')][_0x0eed('0x4e')](_0x5d381e);}})[_0x0eed('0x1c')](function(_0x4a5964){if(_0x4a5964){return db['User'][_0x0eed('0x65')]({'where':{'id':_[_0x0eed('0x3c')](_0x4a5964,_0x0eed('0x66')),'role':_0x0eed('0x67')},'attributes':['id',_0x0eed('0x34'),_0x0eed('0x68'),_0x0eed('0x69'),_0x0eed('0x6a')]});}})[_0x0eed('0x1c')](function(_0x4996b0){if(_0x4996b0){return{'count':_0x4996b0[_0x0eed('0x27')],'rows':_[_0x0eed('0x3c')](_0x4996b0[_0x0eed('0x4f')],function(_0x4639db){return{'membername':_0x4639db[_0x0eed('0x34')],'UserId':_0x4639db['id'],'queue_name':_0x592bf0[_0x0eed('0x34')],'ChatQueueId':_0x592bf0['id'],'interface':util[_0x0eed('0x6b')]('%s/%s','SIP',_0x4639db[_0x0eed('0x34')]),'penalty':0x0,'paused':_0x4639db[_0x0eed('0x68')],'createdAt':_0x4639db['createdAt'],'updatedAt':_0x4639db[_0x0eed('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0eed('0x1c')](respondWithFilteredResult(_0x725885,_0x5d381e))[_0x0eed('0x50')](handleError(_0x725885,null));};exports[_0x0eed('0x6c')]=function(_0x27c340,_0x5efe31,_0x1af03f){var _0x570c91={};var _0x51005e={};var _0x33b120;var _0x94363e;return db['ChatQueue'][_0x0eed('0x61')]({'where':{'id':_0x27c340[_0x0eed('0x51')]['id']}})['then'](handleEntityNotFound(_0x5efe31,null))['then'](function(_0x113b88){if(_0x113b88){_0x33b120=_0x113b88;_0x51005e['model']=_[_0x0eed('0x3e')](db[_0x0eed('0x6d')][_0x0eed('0x37')]);_0x51005e[_0x0eed('0x3d')]=_[_0x0eed('0x3e')](_0x27c340[_0x0eed('0x3d')]);_0x51005e[_0x0eed('0x3f')]=_['intersection'](_0x51005e[_0x0eed('0x3b')],_0x51005e[_0x0eed('0x3d')]);_0x570c91['attributes']=_[_0x0eed('0x40')](_0x51005e[_0x0eed('0x3b')],qs[_0x0eed('0x42')](_0x27c340[_0x0eed('0x3d')][_0x0eed('0x42')]));_0x570c91[_0x0eed('0x41')]=_0x570c91[_0x0eed('0x41')]['length']?_0x570c91['attributes']:_0x51005e[_0x0eed('0x3b')];_0x570c91[_0x0eed('0x46')]=qs[_0x0eed('0x47')](_0x27c340[_0x0eed('0x3d')]['sort']);_0x570c91[_0x0eed('0x48')]=qs[_0x0eed('0x3f')](_[_0x0eed('0x63')](_0x27c340['query'],_0x51005e[_0x0eed('0x3f')]));if(_0x27c340[_0x0eed('0x3d')][_0x0eed('0x49')]){_0x570c91[_0x0eed('0x48')]=_[_0x0eed('0x4a')](_0x570c91[_0x0eed('0x48')],{'$or':_['map'](_0x570c91['attributes'],function(_0x37ffec){var _0x1272f3={};_0x1272f3[_0x37ffec]={'$like':'%'+_0x27c340[_0x0eed('0x3d')]['filter']+'%'};return _0x1272f3;})});}_0x570c91=_[_0x0eed('0x4a')]({},_0x570c91,_0x27c340['options']);return _0x33b120[_0x0eed('0x6c')](_0x570c91);}})[_0x0eed('0x1c')](function(_0x44a0b9){if(_0x44a0b9){_0x94363e=_0x44a0b9[_0x0eed('0x52')];if(!_0x27c340[_0x0eed('0x3d')][_0x0eed('0x43')](_0x0eed('0x44'))){_0x570c91[_0x0eed('0x45')]=qs[_0x0eed('0x45')](_0x27c340[_0x0eed('0x3d')][_0x0eed('0x45')]);_0x570c91[_0x0eed('0x28')]=qs[_0x0eed('0x28')](_0x27c340['query'][_0x0eed('0x28')]);}return _0x33b120['getTeams'](_0x570c91);}})[_0x0eed('0x1c')](function(_0x306cd8){if(_0x306cd8){return _0x306cd8?{'count':_0x94363e,'rows':_0x306cd8}:null;}})[_0x0eed('0x1c')](respondWithResult(_0x5efe31,null))[_0x0eed('0x50')](handleError(_0x5efe31,null));};exports[_0x0eed('0x6e')]=function(_0x2d7ee8,_0xf3b7f2,_0x2dd5ab){var _0x4c732e=_0x2d7ee8['body'][_0x0eed('0x6f')];return db['Team']['findAll']({'where':{'id':_0x4c732e},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0eed('0x70'),'attributes':['id',_0x0eed('0x34'),'online','voicePause',_0x0eed('0x71')],'raw':!![]}]})[_0x0eed('0x1c')](function(_0x3338de){if(_0x3338de){var _0x3da5a3=_[_0x0eed('0x72')](_0x3338de,function(_0x2cddcb){var _0x2b088c=_0x2cddcb['get']({'plain':!![]});return _0x2b088c[_0x0eed('0x70')];});return db['ChatQueue'][_0x0eed('0x54')]({'where':{'id':_0x2d7ee8[_0x0eed('0x51')]['id']}})[_0x0eed('0x1c')](function(_0x1810cc){return db['sequelize'][_0x0eed('0x73')](function(_0x1b8638){return _0x1810cc[_0x0eed('0x6e')](_0x4c732e,{'transaction':_0x1b8638})['then'](function(){return BPromise[_0x0eed('0x74')](_0x3da5a3,function(_0xf3c015){return db[_0x0eed('0x62')][_0x0eed('0x75')]({'where':{'UserId':_0xf3c015['id'],'ChatQueueId':_0x2d7ee8[_0x0eed('0x51')]['id']},'transaction':_0x1b8638});});})[_0x0eed('0x1c')](function(){_0x3da5a3['forEach'](function(_0x38a26b){socket[_0x0eed('0x76')]('userChatQueue:save',{'UserId':_0x38a26b['id'],'ChatQueueId':_0x1810cc['id']});});});});});}})[_0x0eed('0x1c')](respondWithStatusCode(_0xf3b7f2,null))[_0x0eed('0x50')](handleError(_0xf3b7f2,null));};exports['removeTeams']=function(_0x284ce6,_0xf728ca,_0x474f65){return db[_0x0eed('0x6d')][_0x0eed('0x4e')]({'where':{'id':_0x284ce6[_0x0eed('0x3d')][_0x0eed('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x0eed('0x77')],'as':_0x0eed('0x70'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xf728ca,null))[_0x0eed('0x1c')](function(_0x56083b){var _0x7c1480=_[_0x0eed('0x3c')](_0x56083b,'id');var _0x49c082=[];var _0x5033bf=[];var _0x22518c=squel[_0x0eed('0x78')]();_0x22518c[_0x0eed('0x79')](_0x0eed('0x7a'))[_0x0eed('0x7b')]('team_has_chat_queues','tq')[_0x0eed('0x7c')](_0x0eed('0x7d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0eed('0x48')](_0x0eed('0x7e'),_0x284ce6[_0x0eed('0x51')]['id']);for(var _0x53dadc=0x0;_0x53dadc<_0x56083b[_0x0eed('0x52')];_0x53dadc+=0x1){let _0x4ab024=_0x56083b[_0x53dadc];for(var _0x238434=0x0;_0x238434<_0x4ab024[_0x0eed('0x70')][_0x0eed('0x52')];_0x238434+=0x1){let _0x31ff25=_0x4ab024[_0x0eed('0x70')][_0x238434];var _0x32c494=_0x22518c['clone']();_0x32c494['where']('ut.UserId\x20=\x20?',_0x31ff25['id']);_0x5033bf[_0x0eed('0x7f')](db[_0x0eed('0x80')][_0x0eed('0x3d')](_0x32c494[_0x0eed('0x81')](),{'type':db[_0x0eed('0x80')][_0x0eed('0x82')]['SELECT']})[_0x0eed('0x1c')](function(_0x347d16){if(_0x347d16['length']===0x1){return _0x31ff25['id'];}else{var _0x3cf0d1=_[_0x0eed('0x83')](_['map'](_0x347d16,_0x0eed('0x84')),function(_0x39a266){return _[_0x0eed('0x85')](_0x7c1480,_0x39a266);});if(_0x3cf0d1){return _0x31ff25['id'];}}}));}}return BPromise[_0x0eed('0x86')](_0x5033bf)[_0x0eed('0x1c')](function(_0x393453){_0x49c082=_(_0x49c082)[_0x0eed('0x87')](_0x393453)[_0x0eed('0x88')]()[_0x0eed('0x89')]();return db['ChatQueue'][_0x0eed('0x54')]({'where':{'id':_0x284ce6[_0x0eed('0x51')]['id']}})[_0x0eed('0x1c')](function(_0x2ac1ec){return db[_0x0eed('0x80')][_0x0eed('0x73')](function(_0x5982f4){return _0x2ac1ec[_0x0eed('0x8a')](_0x284ce6[_0x0eed('0x3d')][_0x0eed('0x6f')],{'transaction':_0x5982f4})[_0x0eed('0x1c')](function(){if(!_['isEmpty'](_0x49c082)){return _0x2ac1ec[_0x0eed('0x8b')](_0x49c082,{'transaction':_0x5982f4});}})[_0x0eed('0x1c')](function(){_0x49c082['forEach'](function(_0x2a2f76){socket[_0x0eed('0x76')]('userChatQueue:remove',{'UserId':_0x2a2f76,'ChatQueueId':_0x2ac1ec['id']});});});});});});})[_0x0eed('0x1c')](respondWithStatusCode(_0xf728ca,null))[_0x0eed('0x50')](handleError(_0xf728ca,null));};exports[_0x0eed('0x8c')]=function(_0x5edf03,_0x5512c9,_0x504866){return db['ChatQueue'][_0x0eed('0x54')]({'where':{'id':_0x5edf03[_0x0eed('0x51')]['id']}})[_0x0eed('0x1c')](handleEntityNotFound(_0x5512c9,null))[_0x0eed('0x1c')](function(_0x24269c){if(_0x24269c){return _0x24269c[_0x0eed('0x8c')](_0x5edf03[_0x0eed('0x56')]['ids'],_[_0x0eed('0x8d')](_0x5edf03['body'],[_0x0eed('0x6f'),'id'])||{})[_0x0eed('0x8e')](function(_0x2f0183){for(var _0x47d674=0x0;_0x47d674<_0x5edf03[_0x0eed('0x56')][_0x0eed('0x6f')][_0x0eed('0x52')];_0x47d674+=0x1){socket[_0x0eed('0x76')](_0x0eed('0x8f'),{'UserId':_0x5edf03[_0x0eed('0x56')][_0x0eed('0x6f')][_0x47d674],'ChatQueueId':_0x5edf03[_0x0eed('0x51')]['id']});}return _0x2f0183;});}})[_0x0eed('0x1c')](respondWithResult(_0x5512c9,null))[_0x0eed('0x50')](handleError(_0x5512c9,null));};exports[_0x0eed('0x8b')]=function(_0x210ded,_0x49546f,_0x29b19d){return db[_0x0eed('0x36')][_0x0eed('0x54')]({'where':{'id':_0x210ded[_0x0eed('0x51')]['id']}})[_0x0eed('0x1c')](handleEntityNotFound(_0x49546f,null))[_0x0eed('0x1c')](function(_0x5ba42b){if(_0x5ba42b){return _0x5ba42b[_0x0eed('0x8b')](_0x210ded['query'][_0x0eed('0x6f')])[_0x0eed('0x1c')](function(){if(_[_0x0eed('0x90')](_0x210ded[_0x0eed('0x3d')][_0x0eed('0x6f')])){for(var _0x37e1a4=0x0;_0x37e1a4<_0x210ded[_0x0eed('0x3d')][_0x0eed('0x6f')][_0x0eed('0x52')];_0x37e1a4+=0x1){socket['emit'](_0x0eed('0x91'),{'UserId':Number(_0x210ded[_0x0eed('0x3d')][_0x0eed('0x6f')][_0x37e1a4]),'ChatQueueId':Number(_0x210ded[_0x0eed('0x51')]['id'])});}}else{socket[_0x0eed('0x76')](_0x0eed('0x91'),{'UserId':Number(_0x210ded[_0x0eed('0x3d')]['ids']),'ChatQueueId':Number(_0x210ded[_0x0eed('0x51')]['id'])});}});}})[_0x0eed('0x1c')](respondWithStatusCode(_0x49546f,null))['catch'](handleError(_0x49546f,null));};exports[_0x0eed('0x92')]=function(_0x59aa47,_0x4da085,_0x7d7466){var _0x24f2b8={};var _0x190cbc={};var _0x1c9922;var _0x24f35a;return db[_0x0eed('0x36')]['findOne']({'where':{'id':_0x59aa47['params']['id']}})[_0x0eed('0x1c')](handleEntityNotFound(_0x4da085,null))[_0x0eed('0x1c')](function(_0x4f1f2b){if(_0x4f1f2b){_0x1c9922=_0x4f1f2b;_0x190cbc[_0x0eed('0x3b')]=_[_0x0eed('0x3e')](db[_0x0eed('0x77')][_0x0eed('0x37')]);_0x190cbc[_0x0eed('0x3d')]=_['keys'](_0x59aa47[_0x0eed('0x3d')]);_0x190cbc[_0x0eed('0x3f')]=_[_0x0eed('0x40')](_0x190cbc[_0x0eed('0x3b')],_0x190cbc['query']);_0x24f2b8[_0x0eed('0x41')]=_['intersection'](_0x190cbc[_0x0eed('0x3b')],qs[_0x0eed('0x42')](_0x59aa47[_0x0eed('0x3d')][_0x0eed('0x42')]));_0x24f2b8[_0x0eed('0x41')]=_0x24f2b8['attributes'][_0x0eed('0x52')]?_0x24f2b8[_0x0eed('0x41')]:_0x190cbc[_0x0eed('0x3b')];_0x24f2b8[_0x0eed('0x46')]=qs[_0x0eed('0x47')](_0x59aa47[_0x0eed('0x3d')][_0x0eed('0x47')]);_0x24f2b8[_0x0eed('0x48')]=qs['filters'](_[_0x0eed('0x63')](_0x59aa47[_0x0eed('0x3d')],_0x190cbc[_0x0eed('0x3f')]));if(_0x59aa47[_0x0eed('0x3d')]['filter']){_0x24f2b8['where']=_[_0x0eed('0x4a')](_0x24f2b8['where'],{'$or':_[_0x0eed('0x3c')](_0x24f2b8['attributes'],function(_0x5b96ba){var _0xf4c2d8={};_0xf4c2d8[_0x5b96ba]={'$like':'%'+_0x59aa47[_0x0eed('0x3d')][_0x0eed('0x49')]+'%'};return _0xf4c2d8;})});}_0x24f2b8=_[_0x0eed('0x4a')]({},_0x24f2b8,_0x59aa47[_0x0eed('0x53')]);return _0x1c9922[_0x0eed('0x92')](_0x24f2b8);}})[_0x0eed('0x1c')](function(_0x540269){if(_0x540269){_0x24f35a=_0x540269[_0x0eed('0x52')];if(!_0x59aa47[_0x0eed('0x3d')][_0x0eed('0x43')](_0x0eed('0x44'))){_0x24f2b8[_0x0eed('0x45')]=qs[_0x0eed('0x45')](_0x59aa47[_0x0eed('0x3d')][_0x0eed('0x45')]);_0x24f2b8[_0x0eed('0x28')]=qs[_0x0eed('0x28')](_0x59aa47[_0x0eed('0x3d')][_0x0eed('0x28')]);}return _0x1c9922['getAgents'](_0x24f2b8);}})[_0x0eed('0x1c')](function(_0x279c22){if(_0x279c22){return _0x279c22?{'count':_0x24f35a,'rows':_0x279c22}:null;}})['then'](respondWithResult(_0x4da085,null))[_0x0eed('0x50')](handleError(_0x4da085,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 25297c7..6487fc2 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 _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x48df38,_0x19622b){var _0x49c19d=function(_0x44921a){while(--_0x44921a){_0x48df38['push'](_0x48df38['shift']());}};_0x49c19d(++_0x19622b);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d34f0,_0x4a5dc0){_0x3d34f0=_0x3d34f0-0x0;var _0x135ecd=_0xb10b[_0x3d34f0];return _0x135ecd;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','ChatQueue','setMaxListeners','save','remove','emit'];(function(_0x2d6036,_0xf4dc6){var _0x20d3c9=function(_0x2092e0){while(--_0x2092e0){_0x2d6036['push'](_0x2d6036['shift']());}};_0x20d3c9(++_0xf4dc6);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e9402,_0x130b9e){_0x3e9402=_0x3e9402-0x0;var _0x1f5996=_0xb10b[_0x3e9402];return _0x1f5996;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xbb10('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){ChatQueueEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);ChatQueueEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];ChatQueue[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index febef24..fb23133 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 _0x1885=['bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','util','../../config/logger','api'];(function(_0x469393,_0x247969){var _0x5f720d=function(_0x40aeb3){while(--_0x40aeb3){_0x469393['push'](_0x469393['shift']());}};_0x5f720d(++_0x247969);}(_0x1885,0xb8));var _0x5188=function(_0x216601,_0x581843){_0x216601=_0x216601-0x0;var _0x17a913=_0x1885[_0x216601];return _0x17a913;};'use strict';var _=require('lodash');var util=require(_0x5188('0x0'));var logger=require(_0x5188('0x1'))(_0x5188('0x2'));var moment=require('moment');var BPromise=require(_0x5188('0x3'));var rp=require(_0x5188('0x4'));var fs=require('fs');var path=require(_0x5188('0x5'));var rimraf=require(_0x5188('0x6'));var config=require(_0x5188('0x7'));var attributes=require(_0x5188('0x8'));module[_0x5188('0x9')]=function(_0x46491d,_0x3aa2b1){return _0x46491d[_0x5188('0xa')]('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x981b=['rimraf','./chatQueue.attributes','ChatQueue','chat_queues','lodash','api','path'];(function(_0xc5a279,_0x155360){var _0xc755d3=function(_0x15051c){while(--_0x15051c){_0xc5a279['push'](_0xc5a279['shift']());}};_0xc755d3(++_0x155360);}(_0x981b,0x1d9));var _0xb981=function(_0x21d1fd,_0x3e738c){_0x21d1fd=_0x21d1fd-0x0;var _0x50e7ee=_0x981b[_0x21d1fd];return _0x50e7ee;};'use strict';var _=require(_0xb981('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb981('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb981('0x2'));var rimraf=require(_0xb981('0x3'));var config=require('../../config/environment');var attributes=require(_0xb981('0x4'));module['exports']=function(_0x5e111d,_0x3173b7){return _0x5e111d['define'](_0xb981('0x5'),attributes,{'tableName':_0xb981('0x6'),'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 b4dd175..d5017e3 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 _0xcefd=['ChatQueue,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','catch','GetChatQueue','ChatQueue','options','raw','where','attributes','limit','map','include','model','ShowChatQueue','find','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request','info'];(function(_0x2974c9,_0x4a1a06){var _0x1a1b26=function(_0x4d4d98){while(--_0x4d4d98){_0x2974c9['push'](_0x2974c9['shift']());}};_0x1a1b26(++_0x4a1a06);}(_0xcefd,0x126));var _0xdcef=function(_0x1aefea,_0x39e5fa){_0x1aefea=_0x1aefea-0x0;var _0x33a7a1=_0xcefd[_0x1aefea];return _0x33a7a1;};'use strict';var _=require(_0xdcef('0x0'));var util=require(_0xdcef('0x1'));var moment=require(_0xdcef('0x2'));var BPromise=require('bluebird');var rs=require(_0xdcef('0x3'));var fs=require('fs');var Redis=require(_0xdcef('0x4'));var db=require(_0xdcef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdcef('0x6'))(_0xdcef('0x7'));var config=require(_0xdcef('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdcef('0x9')][_0xdcef('0xa')]({'port':0x232a});config[_0xdcef('0xb')]=_[_0xdcef('0xc')](config['redis'],{'host':_0xdcef('0xd'),'port':0x18eb});var socket=require(_0xdcef('0xe'))(new Redis(config[_0xdcef('0xb')]));require(_0xdcef('0xf'))['register'](socket);function respondWithRpcPromise(_0x1946c9,_0x451606,_0x28ac35){return new BPromise(function(_0x37c1c3,_0x3fd234){return client[_0xdcef('0x10')](_0x1946c9,_0x28ac35)['then'](function(_0x4a2973){logger[_0xdcef('0x11')](_0xdcef('0x12'),_0x451606,'request\x20sent');logger[_0xdcef('0x13')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x451606,'request\x20sent',JSON[_0xdcef('0x14')](_0x4a2973));if(_0x4a2973[_0xdcef('0x15')]){if(_0x4a2973[_0xdcef('0x15')][_0xdcef('0x16')]===0x1f4){logger[_0xdcef('0x15')](_0xdcef('0x12'),_0x451606,_0x4a2973[_0xdcef('0x15')][_0xdcef('0x17')]);return _0x3fd234(_0x4a2973[_0xdcef('0x15')][_0xdcef('0x17')]);}logger[_0xdcef('0x15')](_0xdcef('0x12'),_0x451606,_0x4a2973['error'][_0xdcef('0x17')]);return _0x37c1c3(_0x4a2973['error'][_0xdcef('0x17')]);}else{logger[_0xdcef('0x11')](_0xdcef('0x12'),_0x451606,_0xdcef('0x18'));_0x37c1c3(_0x4a2973['result']['message']);}})[_0xdcef('0x19')](function(_0x19283a){logger[_0xdcef('0x15')](_0xdcef('0x12'),_0x451606,_0x19283a);_0x3fd234(_0x19283a);});});}exports[_0xdcef('0x1a')]=function(_0x465fed){var _0x43d0f1=this;return new Promise(function(_0x510d1e,_0x417de7){return db[_0xdcef('0x1b')]['findAll']({'raw':_0x465fed[_0xdcef('0x1c')]?_0x465fed[_0xdcef('0x1c')][_0xdcef('0x1d')]===undefined?!![]:![]:!![],'where':_0x465fed[_0xdcef('0x1c')]?_0x465fed[_0xdcef('0x1c')][_0xdcef('0x1e')]||null:null,'attributes':_0x465fed[_0xdcef('0x1c')]?_0x465fed[_0xdcef('0x1c')][_0xdcef('0x1f')]||null:null,'limit':_0x465fed[_0xdcef('0x1c')]?_0x465fed[_0xdcef('0x1c')][_0xdcef('0x20')]||null:null,'include':_0x465fed[_0xdcef('0x1c')]?_0x465fed[_0xdcef('0x1c')]['include']?_[_0xdcef('0x21')](_0x465fed[_0xdcef('0x1c')][_0xdcef('0x22')],function(_0x50fdcb){return{'model':db[_0x50fdcb[_0xdcef('0x23')]],'as':_0x50fdcb['as'],'attributes':_0x50fdcb[_0xdcef('0x1f')],'include':_0x50fdcb[_0xdcef('0x22')]?_[_0xdcef('0x21')](_0x50fdcb[_0xdcef('0x22')],function(_0x7fce54){return{'model':db[_0x7fce54['model']],'as':_0x7fce54['as'],'attributes':_0x7fce54['attributes'],'include':_0x7fce54['include']?_[_0xdcef('0x21')](_0x7fce54[_0xdcef('0x22')],function(_0x21f960){return{'model':db[_0x21f960[_0xdcef('0x23')]],'as':_0x21f960['as'],'attributes':_0x21f960[_0xdcef('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc6bbb3){logger['info'](_0xdcef('0x1a'),_0x465fed);logger[_0xdcef('0x13')](_0xdcef('0x1a'),_0x465fed,JSON['stringify'](_0xc6bbb3));_0x510d1e(_0xc6bbb3);})[_0xdcef('0x19')](function(_0x2114e8){logger['error']('GetChatQueue',_0x2114e8[_0xdcef('0x17')],_0x465fed);_0x417de7(_0x43d0f1[_0xdcef('0x15')](0x1f4,_0x2114e8[_0xdcef('0x17')]));});});};exports[_0xdcef('0x24')]=function(_0x3c1e51){var _0xe253ee=this;return new Promise(function(_0x4d9ef4,_0xa099cf){return db['ChatQueue'][_0xdcef('0x25')]({'raw':_0x3c1e51['options']?_0x3c1e51['options'][_0xdcef('0x1d')]===undefined?!![]:![]:!![],'where':_0x3c1e51[_0xdcef('0x1c')]?_0x3c1e51[_0xdcef('0x1c')][_0xdcef('0x1e')]||null:null,'attributes':_0x3c1e51['options']?_0x3c1e51['options']['attributes']||null:null,'include':_0x3c1e51[_0xdcef('0x1c')]?_0x3c1e51[_0xdcef('0x1c')]['include']?_['map'](_0x3c1e51[_0xdcef('0x1c')]['include'],function(_0x18def8){return{'model':db[_0x18def8[_0xdcef('0x23')]],'as':_0x18def8['as'],'attributes':_0x18def8[_0xdcef('0x1f')],'include':_0x18def8[_0xdcef('0x22')]?_['map'](_0x18def8[_0xdcef('0x22')],function(_0x3f64f4){return{'model':db[_0x3f64f4[_0xdcef('0x23')]],'as':_0x3f64f4['as'],'attributes':_0x3f64f4[_0xdcef('0x1f')],'include':_0x3f64f4[_0xdcef('0x22')]?_['map'](_0x3f64f4['include'],function(_0x41b760){return{'model':db[_0x41b760[_0xdcef('0x23')]],'as':_0x41b760['as'],'attributes':_0x41b760[_0xdcef('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdcef('0x26')](function(_0x13d5a5){logger[_0xdcef('0x11')](_0xdcef('0x24'),_0x3c1e51);logger[_0xdcef('0x13')](_0xdcef('0x24'),_0x3c1e51,JSON['stringify'](_0x13d5a5));_0x4d9ef4(_0x13d5a5);})[_0xdcef('0x19')](function(_0x246d63){logger[_0xdcef('0x15')]('ShowChatQueue',_0x246d63[_0xdcef('0x17')],_0x3c1e51);_0xa099cf(_0xe253ee[_0xdcef('0x15')](0x1f4,_0x246d63['message']));});});}; \ No newline at end of file +var _0x761c=['./chatQueue.socket','register','then','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','info','result','ChatQueue','options','raw','attributes','include','map','model','GetChatQueue','debug','catch','ShowChatQueue','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x4cd82e,_0x424c24){var _0x3cb0e1=function(_0x4f7403){while(--_0x4f7403){_0x4cd82e['push'](_0x4cd82e['shift']());}};_0x3cb0e1(++_0x424c24);}(_0x761c,0x18a));var _0xc761=function(_0x4a6159,_0x1b9ade){_0x4a6159=_0x4a6159-0x0;var _0x227793=_0x761c[_0x4a6159];return _0x227793;};'use strict';var _=require(_0xc761('0x0'));var util=require('util');var moment=require(_0xc761('0x1'));var BPromise=require(_0xc761('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc761('0x3'));var db=require(_0xc761('0x4'))['db'];var utils=require(_0xc761('0x5'));var logger=require('../../config/logger')(_0xc761('0x6'));var config=require('../../config/environment');var jayson=require(_0xc761('0x7'));var client=jayson[_0xc761('0x8')][_0xc761('0x9')]({'port':0x232a});config[_0xc761('0xa')]=_[_0xc761('0xb')](config[_0xc761('0xa')],{'host':_0xc761('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc761('0xa')]));require(_0xc761('0xd'))[_0xc761('0xe')](socket);function respondWithRpcPromise(_0x2440e3,_0x1dd2a0,_0x2bde36){return new BPromise(function(_0x205c96,_0x49add8){return client['request'](_0x2440e3,_0x2bde36)[_0xc761('0xf')](function(_0x4405a2){logger['info']('ChatQueue,\x20%s,\x20%s',_0x1dd2a0,_0xc761('0x10'));logger['debug'](_0xc761('0x11'),_0x1dd2a0,'request\x20sent',JSON[_0xc761('0x12')](_0x4405a2));if(_0x4405a2['error']){if(_0x4405a2[_0xc761('0x13')][_0xc761('0x14')]===0x1f4){logger[_0xc761('0x13')](_0xc761('0x15'),_0x1dd2a0,_0x4405a2[_0xc761('0x13')][_0xc761('0x16')]);return _0x49add8(_0x4405a2[_0xc761('0x13')]['message']);}logger['error'](_0xc761('0x15'),_0x1dd2a0,_0x4405a2[_0xc761('0x13')][_0xc761('0x16')]);return _0x205c96(_0x4405a2['error'][_0xc761('0x16')]);}else{logger[_0xc761('0x17')](_0xc761('0x15'),_0x1dd2a0,_0xc761('0x10'));_0x205c96(_0x4405a2[_0xc761('0x18')]['message']);}})['catch'](function(_0x505b5c){logger[_0xc761('0x13')]('ChatQueue,\x20%s,\x20%s',_0x1dd2a0,_0x505b5c);_0x49add8(_0x505b5c);});});}exports['GetChatQueue']=function(_0x3bebd6){var _0x40d48d=this;return new Promise(function(_0x3abd83,_0x4ba60c){return db[_0xc761('0x19')]['findAll']({'raw':_0x3bebd6[_0xc761('0x1a')]?_0x3bebd6[_0xc761('0x1a')][_0xc761('0x1b')]===undefined?!![]:![]:!![],'where':_0x3bebd6[_0xc761('0x1a')]?_0x3bebd6[_0xc761('0x1a')]['where']||null:null,'attributes':_0x3bebd6[_0xc761('0x1a')]?_0x3bebd6[_0xc761('0x1a')][_0xc761('0x1c')]||null:null,'limit':_0x3bebd6[_0xc761('0x1a')]?_0x3bebd6['options']['limit']||null:null,'include':_0x3bebd6[_0xc761('0x1a')]?_0x3bebd6[_0xc761('0x1a')][_0xc761('0x1d')]?_[_0xc761('0x1e')](_0x3bebd6[_0xc761('0x1a')][_0xc761('0x1d')],function(_0x2909ce){return{'model':db[_0x2909ce[_0xc761('0x1f')]],'as':_0x2909ce['as'],'attributes':_0x2909ce['attributes'],'include':_0x2909ce[_0xc761('0x1d')]?_[_0xc761('0x1e')](_0x2909ce[_0xc761('0x1d')],function(_0x4e8db5){return{'model':db[_0x4e8db5['model']],'as':_0x4e8db5['as'],'attributes':_0x4e8db5[_0xc761('0x1c')],'include':_0x4e8db5[_0xc761('0x1d')]?_['map'](_0x4e8db5[_0xc761('0x1d')],function(_0x5f2655){return{'model':db[_0x5f2655[_0xc761('0x1f')]],'as':_0x5f2655['as'],'attributes':_0x5f2655['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x53b615){logger[_0xc761('0x17')](_0xc761('0x20'),_0x3bebd6);logger[_0xc761('0x21')](_0xc761('0x20'),_0x3bebd6,JSON['stringify'](_0x53b615));_0x3abd83(_0x53b615);})[_0xc761('0x22')](function(_0x4f494){logger[_0xc761('0x13')](_0xc761('0x20'),_0x4f494[_0xc761('0x16')],_0x3bebd6);_0x4ba60c(_0x40d48d['error'](0x1f4,_0x4f494[_0xc761('0x16')]));});});};exports[_0xc761('0x23')]=function(_0xe0f026){var _0x46741d=this;return new Promise(function(_0x41e5a0,_0x3b047b){return db[_0xc761('0x19')][_0xc761('0x24')]({'raw':_0xe0f026[_0xc761('0x1a')]?_0xe0f026[_0xc761('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xe0f026[_0xc761('0x1a')]?_0xe0f026[_0xc761('0x1a')]['where']||null:null,'attributes':_0xe0f026['options']?_0xe0f026[_0xc761('0x1a')][_0xc761('0x1c')]||null:null,'include':_0xe0f026[_0xc761('0x1a')]?_0xe0f026['options']['include']?_['map'](_0xe0f026[_0xc761('0x1a')][_0xc761('0x1d')],function(_0x254603){return{'model':db[_0x254603[_0xc761('0x1f')]],'as':_0x254603['as'],'attributes':_0x254603['attributes'],'include':_0x254603[_0xc761('0x1d')]?_['map'](_0x254603['include'],function(_0x1f5918){return{'model':db[_0x1f5918[_0xc761('0x1f')]],'as':_0x1f5918['as'],'attributes':_0x1f5918[_0xc761('0x1c')],'include':_0x1f5918['include']?_[_0xc761('0x1e')](_0x1f5918[_0xc761('0x1d')],function(_0x4733b5){return{'model':db[_0x4733b5['model']],'as':_0x4733b5['as'],'attributes':_0x4733b5[_0xc761('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc761('0xf')](function(_0x2a8d75){logger['info'](_0xc761('0x23'),_0xe0f026);logger[_0xc761('0x21')]('ShowChatQueue',_0xe0f026,JSON[_0xc761('0x12')](_0x2a8d75));_0x41e5a0(_0x2a8d75);})['catch'](function(_0x4d521a){logger[_0xc761('0x13')](_0xc761('0x23'),_0x4d521a[_0xc761('0x16')],_0xe0f026);_0x3b047b(_0x46741d[_0xc761('0x13')](0x1f4,_0x4d521a['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index ef074b2..ef49b51 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 _0xbaf0=['removeListener','register','length','chatQueue:','save','remove','update'];(function(_0x3acef0,_0x3c7d19){var _0x5c497e=function(_0xe26552){while(--_0xe26552){_0x3acef0['push'](_0x3acef0['shift']());}};_0x5c497e(++_0x3c7d19);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){ChatQueueEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);ChatQueueEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x5d115e,_0x35ce96){var _0x420939=function(_0x597832){while(--_0x597832){_0x5d115e['push'](_0x5d115e['shift']());}};_0x420939(++_0x35ce96);}(_0x5f2f,0x73));var _0xf5f2=function(_0x10a34e,_0x2f44e9){_0x10a34e=_0x10a34e-0x0;var _0x1115e0=_0x5f2f[_0x10a34e];return _0x1115e0;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 250668e..674a72c 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 _0x6179=['getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','put','/:id','removeTeams','delete','exports','multer','util','path','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','describe','/:id/members'];(function(_0x599c94,_0x464f0e){var _0x34e215=function(_0x36295a){while(--_0x36295a){_0x599c94['push'](_0x599c94['shift']());}};_0x34e215(++_0x464f0e);}(_0x6179,0x80));var _0x9617=function(_0x27f2b9,_0x144e11){_0x27f2b9=_0x27f2b9-0x0;var _0x440385=_0x6179[_0x27f2b9];return _0x440385;};'use strict';var multer=require(_0x9617('0x0'));var util=require(_0x9617('0x1'));var path=require(_0x9617('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9617('0x3')]();var auth=require(_0x9617('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9617('0x5'));router[_0x9617('0x6')]('/',auth[_0x9617('0x7')](),controller['index']);router['get']('/describe',auth[_0x9617('0x7')](),controller[_0x9617('0x8')]);router[_0x9617('0x6')]('/:id',auth[_0x9617('0x7')](),controller['show']);router[_0x9617('0x6')](_0x9617('0x9'),auth[_0x9617('0x7')](),controller[_0x9617('0xa')]);router[_0x9617('0x6')](_0x9617('0xb'),auth[_0x9617('0x7')](),controller[_0x9617('0xc')]);router[_0x9617('0x6')](_0x9617('0xd'),auth[_0x9617('0x7')](),controller[_0x9617('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9617('0xf')]);router[_0x9617('0x10')](_0x9617('0xb'),auth[_0x9617('0x7')](),controller['addTeams']);router[_0x9617('0x10')](_0x9617('0xd'),auth[_0x9617('0x7')](),controller[_0x9617('0x11')]);router[_0x9617('0x12')](_0x9617('0x13'),auth[_0x9617('0x7')](),controller['update']);router['delete'](_0x9617('0x13'),auth[_0x9617('0x7')](),controller['destroy']);router['delete'](_0x9617('0xb'),auth[_0x9617('0x7')](),controller[_0x9617('0x14')]);router[_0x9617('0x15')](_0x9617('0xd'),auth[_0x9617('0x7')](),controller['removeAgents']);module[_0x9617('0x16')]=router; \ No newline at end of file +var _0x14cc=['addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueue.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users'];(function(_0x42f0e5,_0x43a6ea){var _0x4fb1d7=function(_0x4dbedc){while(--_0x4dbedc){_0x42f0e5['push'](_0x42f0e5['shift']());}};_0x4fb1d7(++_0x43a6ea);}(_0x14cc,0x1bb));var _0xc14c=function(_0x496738,_0x3f1a9f){_0x496738=_0x496738-0x0;var _0xee1381=_0x14cc[_0x496738];return _0xee1381;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc14c('0x0'));var timeout=require('connect-timeout');var express=require(_0xc14c('0x1'));var router=express['Router']();var auth=require(_0xc14c('0x2'));var interaction=require(_0xc14c('0x3'));var config=require(_0xc14c('0x4'));var controller=require(_0xc14c('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xc14c('0x6')]);router[_0xc14c('0x7')](_0xc14c('0x8'),auth[_0xc14c('0x9')](),controller[_0xc14c('0xa')]);router[_0xc14c('0x7')](_0xc14c('0xb'),auth['isAuthenticated'](),controller[_0xc14c('0xc')]);router[_0xc14c('0x7')](_0xc14c('0xd'),auth['isAuthenticated'](),controller[_0xc14c('0xe')]);router['get'](_0xc14c('0xf'),auth[_0xc14c('0x9')](),controller[_0xc14c('0x10')]);router[_0xc14c('0x7')]('/:id/users',auth[_0xc14c('0x9')](),controller[_0xc14c('0x11')]);router[_0xc14c('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xc14c('0xf'),auth['isAuthenticated'](),controller[_0xc14c('0x13')]);router[_0xc14c('0x12')](_0xc14c('0x14'),auth['isAuthenticated'](),controller[_0xc14c('0x15')]);router[_0xc14c('0x16')](_0xc14c('0xb'),auth['isAuthenticated'](),controller[_0xc14c('0x17')]);router['delete'](_0xc14c('0xb'),auth['isAuthenticated'](),controller[_0xc14c('0x18')]);router[_0xc14c('0x19')](_0xc14c('0xf'),auth['isAuthenticated'](),controller[_0xc14c('0x1a')]);router['delete'](_0xc14c('0x14'),auth[_0xc14c('0x9')](),controller[_0xc14c('0x1b')]);module[_0xc14c('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index deef160..a341d72 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 _0xcb04=['STRING','DATE','moment','sequelize','exports'];(function(_0x31f9c7,_0x1d5f54){var _0x46c5b3=function(_0x3180e3){while(--_0x3180e3){_0x31f9c7['push'](_0x31f9c7['shift']());}};_0x46c5b3(++_0x1d5f54);}(_0xcb04,0x84));var _0x4cb0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcb04[_0x20a584];return _0x4b41a8;};'use strict';var moment=require(_0x4cb0('0x0'));var Sequelize=require(_0x4cb0('0x1'));module[_0x4cb0('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x4cb0('0x3')]},'joinAt':{'type':Sequelize[_0x4cb0('0x4')]},'leaveAt':{'type':Sequelize[_0x4cb0('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x4cb0('0x4')]},'reason':{'type':Sequelize[_0x4cb0('0x3')]}}; \ No newline at end of file +var _0x4d37=['DATE','moment','exports','STRING'];(function(_0x4c5210,_0x5e44f0){var _0x128bff=function(_0x1ea610){while(--_0x1ea610){_0x4c5210['push'](_0x4c5210['shift']());}};_0x128bff(++_0x5e44f0);}(_0x4d37,0x1b5));var _0x74d3=function(_0x303864,_0x1a0eaf){_0x303864=_0x303864-0x0;var _0x250c15=_0x4d37[_0x303864];return _0x250c15;};'use strict';var moment=require(_0x74d3('0x0'));var Sequelize=require('sequelize');module[_0x74d3('0x1')]={'uniqueid':{'type':Sequelize[_0x74d3('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x74d3('0x2')]},'joinAt':{'type':Sequelize[_0x74d3('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x74d3('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x74d3('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 715300d..78489e6 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 _0x74f9=['reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','options','ChatQueueReport','include','findAll','rows','catch','show','params','keys','includeAll','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply'];(function(_0x5c4777,_0x3022fe){var _0x3e9643=function(_0x2c9594){while(--_0x2c9594){_0x5c4777['push'](_0x5c4777['shift']());}};_0x3e9643(++_0x3022fe);}(_0x74f9,0x190));var _0x974f=function(_0x2d5572,_0x19eba6){_0x2d5572=_0x2d5572-0x0;var _0x1bb95c=_0x74f9[_0x2d5572];return _0x1bb95c;};'use strict';var pdf=require(_0x974f('0x0'));var emlformat=require(_0x974f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x974f('0x2'));var jsonpatch=require(_0x974f('0x3'));var rp=require(_0x974f('0x4'));var moment=require('moment');var BPromise=require(_0x974f('0x5'));var Mustache=require(_0x974f('0x6'));var util=require('util');var path=require(_0x974f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x974f('0x8'));var fs=require('fs');var _=require(_0x974f('0x9'));var squel=require(_0x974f('0xa'));var crypto=require(_0x974f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x974f('0xc'));var toCsv=require(_0x974f('0xd'));var querystring=require(_0x974f('0xe'));var Papa=require(_0x974f('0xf'));var Redis=require(_0x974f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x974f('0x11'));var as=require(_0x974f('0x12'));var hardwareService=require(_0x974f('0x13'));var logger=require('../../config/logger')(_0x974f('0x14'));var utils=require(_0x974f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x974f('0x16'));var db=require(_0x974f('0x17'))['db'];function respondWithStatusCode(_0xd9953a,_0x2bbd64){_0x2bbd64=_0x2bbd64||0xcc;return function(_0x47989){if(_0x47989){return _0xd9953a['sendStatus'](_0x2bbd64);}return _0xd9953a[_0x974f('0x18')](_0x2bbd64)['end']();};}function respondWithResult(_0x7456ba,_0x39b745){_0x39b745=_0x39b745||0xc8;return function(_0x3aa60c){if(_0x3aa60c){return _0x7456ba[_0x974f('0x18')](_0x39b745)[_0x974f('0x19')](_0x3aa60c);}};}function respondWithFilteredResult(_0xf6cc92,_0x43db22){return function(_0x5c616a){if(_0x5c616a){var _0x34d82b=_0x5c616a[_0x974f('0x1a')],_0x1073ec=_0x43db22[_0x974f('0x1b')],_0x3348fc=_0x43db22[_0x974f('0x1b')]+_0x43db22[_0x974f('0x1c')],_0x5d8cee;if(_0x3348fc>=_0x34d82b){_0x3348fc=_0x34d82b;_0x5d8cee=0xc8;}else{_0x5d8cee=0xce;}_0xf6cc92[_0x974f('0x18')](_0x5d8cee);return _0xf6cc92[_0x974f('0x1d')](_0x974f('0x1e'),_0x1073ec+'-'+_0x3348fc+'/'+_0x34d82b)['json'](_0x5c616a);}return null;};}function patchUpdates(_0x596895){return function(_0x46ac0f){try{jsonpatch[_0x974f('0x1f')](_0x46ac0f,_0x596895,!![]);}catch(_0x1615be){return BPromise[_0x974f('0x20')](_0x1615be);}return _0x46ac0f[_0x974f('0x21')]();};}function saveUpdates(_0x1400bc,_0x417e43){return function(_0x41eecf){if(_0x41eecf){return _0x41eecf[_0x974f('0x22')](_0x1400bc)[_0x974f('0x23')](function(_0x5e393f){return _0x5e393f;});}return null;};}function removeEntity(_0x29f5d4,_0x43b846){return function(_0x6b18d8){if(_0x6b18d8){return _0x6b18d8[_0x974f('0x24')]()['then'](function(){_0x29f5d4[_0x974f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1584f0,_0x3bc8eb){return function(_0x55a4ce){if(!_0x55a4ce){_0x1584f0[_0x974f('0x25')](0x194);}return _0x55a4ce;};}function handleError(_0x546ded,_0xe6f6a9){_0xe6f6a9=_0xe6f6a9||0x1f4;return function(_0xcc4ed1){logger[_0x974f('0x26')](_0xcc4ed1[_0x974f('0x27')]);if(_0xcc4ed1[_0x974f('0x28')]){delete _0xcc4ed1['name'];}_0x546ded[_0x974f('0x18')](_0xe6f6a9)[_0x974f('0x29')](_0xcc4ed1);};}exports['index']=function(_0x43316c,_0x3974d8){var _0x582c41={},_0x49b8c4={},_0x4ee28d={'count':0x0,'rows':[]};var _0x4550fb=_[_0x974f('0x2a')](db['ChatQueueReport'][_0x974f('0x2b')],function(_0x92fa02){return{'name':_0x92fa02['fieldName'],'type':_0x92fa02[_0x974f('0x2c')][_0x974f('0x2d')]};});_0x49b8c4[_0x974f('0x2e')]=_[_0x974f('0x2a')](_0x4550fb,_0x974f('0x28'));_0x49b8c4[_0x974f('0x2f')]=_['keys'](_0x43316c[_0x974f('0x2f')]);_0x49b8c4[_0x974f('0x30')]=_[_0x974f('0x31')](_0x49b8c4[_0x974f('0x2e')],_0x49b8c4[_0x974f('0x2f')]);_0x582c41[_0x974f('0x32')]=_[_0x974f('0x31')](_0x49b8c4['model'],qs[_0x974f('0x33')](_0x43316c[_0x974f('0x2f')]['fields']));_0x582c41[_0x974f('0x32')]=_0x582c41[_0x974f('0x32')][_0x974f('0x34')]?_0x582c41['attributes']:_0x49b8c4[_0x974f('0x2e')];if(!_0x43316c[_0x974f('0x2f')]['hasOwnProperty']('nolimit')){_0x582c41['limit']=qs['limit'](_0x43316c[_0x974f('0x2f')][_0x974f('0x1c')]);_0x582c41[_0x974f('0x1b')]=qs[_0x974f('0x1b')](_0x43316c[_0x974f('0x2f')]['offset']);}_0x582c41['order']=qs['sort'](_0x43316c['query'][_0x974f('0x35')]);_0x582c41[_0x974f('0x36')]=qs[_0x974f('0x30')](_[_0x974f('0x37')](_0x43316c[_0x974f('0x2f')],_0x49b8c4[_0x974f('0x30')]),_0x4550fb);if(_0x43316c[_0x974f('0x2f')][_0x974f('0x38')]){_0x582c41[_0x974f('0x36')]=_[_0x974f('0x39')](_0x582c41[_0x974f('0x36')],{'$or':_['map'](_0x4550fb,function(_0xf606ea){if(_0xf606ea[_0x974f('0x2c')]!=='VIRTUAL'){var _0x4f9a1b={};_0x4f9a1b[_0xf606ea[_0x974f('0x28')]]={'$like':'%'+_0x43316c[_0x974f('0x2f')][_0x974f('0x38')]+'%'};return _0x4f9a1b;}})});}_0x582c41=_[_0x974f('0x39')]({},_0x582c41,_0x43316c[_0x974f('0x3a')]);var _0x52655e={'where':_0x582c41[_0x974f('0x36')]};return db[_0x974f('0x3b')][_0x974f('0x1a')](_0x52655e)['then'](function(_0xd17a7e){_0x4ee28d['count']=_0xd17a7e;if(_0x43316c[_0x974f('0x2f')]['includeAll']){_0x582c41[_0x974f('0x3c')]=[{'all':!![]}];}return db[_0x974f('0x3b')][_0x974f('0x3d')](_0x582c41);})['then'](function(_0x5dd1df){_0x4ee28d[_0x974f('0x3e')]=_0x5dd1df;return _0x4ee28d;})[_0x974f('0x23')](respondWithFilteredResult(_0x3974d8,_0x582c41))[_0x974f('0x3f')](handleError(_0x3974d8,null));};exports[_0x974f('0x40')]=function(_0x2d2cae,_0x12f8db){var _0x5a5f88={'raw':!![],'where':{'id':_0x2d2cae[_0x974f('0x41')]['id']}},_0x3943fa={};_0x3943fa[_0x974f('0x2e')]=_[_0x974f('0x42')](db['ChatQueueReport']['rawAttributes']);_0x3943fa[_0x974f('0x2f')]=_[_0x974f('0x42')](_0x2d2cae[_0x974f('0x2f')]);_0x3943fa[_0x974f('0x30')]=_['intersection'](_0x3943fa['model'],_0x3943fa['query']);_0x5a5f88[_0x974f('0x32')]=_[_0x974f('0x31')](_0x3943fa['model'],qs[_0x974f('0x33')](_0x2d2cae[_0x974f('0x2f')]['fields']));_0x5a5f88[_0x974f('0x32')]=_0x5a5f88['attributes'][_0x974f('0x34')]?_0x5a5f88[_0x974f('0x32')]:_0x3943fa[_0x974f('0x2e')];if(_0x2d2cae[_0x974f('0x2f')][_0x974f('0x43')]){_0x5a5f88[_0x974f('0x3c')]=[{'all':!![]}];}_0x5a5f88=_[_0x974f('0x39')]({},_0x5a5f88,_0x2d2cae[_0x974f('0x3a')]);return db[_0x974f('0x3b')][_0x974f('0x44')](_0x5a5f88)[_0x974f('0x23')](handleEntityNotFound(_0x12f8db,null))[_0x974f('0x23')](respondWithResult(_0x12f8db,null))['catch'](handleError(_0x12f8db,null));};exports['create']=function(_0x50411b,_0x39484c){return db[_0x974f('0x3b')][_0x974f('0x45')](_0x50411b[_0x974f('0x46')],{})[_0x974f('0x23')](respondWithResult(_0x39484c,0xc9))[_0x974f('0x3f')](handleError(_0x39484c,null));};exports[_0x974f('0x22')]=function(_0x264cfb,_0x4e5302){if(_0x264cfb[_0x974f('0x46')]['id']){delete _0x264cfb['body']['id'];}return db[_0x974f('0x3b')][_0x974f('0x44')]({'where':{'id':_0x264cfb[_0x974f('0x41')]['id']}})['then'](handleEntityNotFound(_0x4e5302,null))[_0x974f('0x23')](saveUpdates(_0x264cfb[_0x974f('0x46')],null))[_0x974f('0x23')](respondWithResult(_0x4e5302,null))[_0x974f('0x3f')](handleError(_0x4e5302,null));};exports[_0x974f('0x24')]=function(_0x149a32,_0x8e87af){return db['ChatQueueReport'][_0x974f('0x44')]({'where':{'id':_0x149a32['params']['id']}})[_0x974f('0x23')](handleEntityNotFound(_0x8e87af,null))['then'](removeEntity(_0x8e87af,null))[_0x974f('0x3f')](handleError(_0x8e87af,null));};exports[_0x974f('0x47')]=function(_0xaec048,_0x44dca7){return db[_0x974f('0x3b')][_0x974f('0x47')]()['then'](respondWithResult(_0x44dca7,null))[_0x974f('0x3f')](handleError(_0x44dca7,null));}; \ No newline at end of file +var _0xe644=['desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','then','sendStatus','error','stack','send','index','ChatQueueReport','rawAttributes','type','key','model','map','name','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','ejs','lodash','crypto'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe644,0x11e));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x4e64('0x0'));var zipdir=require(_0x4e64('0x1'));var jsonpatch=require(_0x4e64('0x2'));var rp=require(_0x4e64('0x3'));var moment=require(_0x4e64('0x4'));var BPromise=require(_0x4e64('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4e64('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4e64('0x7'));var fs=require('fs');var _=require(_0x4e64('0x8'));var squel=require('squel');var crypto=require(_0x4e64('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x4e64('0xa'));var toCsv=require('to-csv');var querystring=require(_0x4e64('0xb'));var Papa=require(_0x4e64('0xc'));var Redis=require('ioredis');var authService=require(_0x4e64('0xd'));var qs=require(_0x4e64('0xe'));var as=require(_0x4e64('0xf'));var hardwareService=require(_0x4e64('0x10'));var logger=require(_0x4e64('0x11'))(_0x4e64('0x12'));var utils=require(_0x4e64('0x13'));var config=require(_0x4e64('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4e64('0x15'))['db'];function respondWithStatusCode(_0xe5f300,_0x29c920){_0x29c920=_0x29c920||0xcc;return function(_0x4fe6eb){if(_0x4fe6eb){return _0xe5f300['sendStatus'](_0x29c920);}return _0xe5f300[_0x4e64('0x16')](_0x29c920)[_0x4e64('0x17')]();};}function respondWithResult(_0x3f6f0e,_0xbf7dd7){_0xbf7dd7=_0xbf7dd7||0xc8;return function(_0x23f0e9){if(_0x23f0e9){return _0x3f6f0e[_0x4e64('0x16')](_0xbf7dd7)[_0x4e64('0x18')](_0x23f0e9);}};}function respondWithFilteredResult(_0xf96bb8,_0x46d1ce){return function(_0x50f482){if(_0x50f482){var _0x3bd2b9=_0x50f482[_0x4e64('0x19')],_0x5c189f=_0x46d1ce[_0x4e64('0x1a')],_0x24b500=_0x46d1ce[_0x4e64('0x1a')]+_0x46d1ce[_0x4e64('0x1b')],_0x3e5d7b;if(_0x24b500>=_0x3bd2b9){_0x24b500=_0x3bd2b9;_0x3e5d7b=0xc8;}else{_0x3e5d7b=0xce;}_0xf96bb8[_0x4e64('0x16')](_0x3e5d7b);return _0xf96bb8[_0x4e64('0x1c')](_0x4e64('0x1d'),_0x5c189f+'-'+_0x24b500+'/'+_0x3bd2b9)[_0x4e64('0x18')](_0x50f482);}return null;};}function patchUpdates(_0x35edab){return function(_0x5e5538){try{jsonpatch[_0x4e64('0x1e')](_0x5e5538,_0x35edab,!![]);}catch(_0x3b35ae){return BPromise['reject'](_0x3b35ae);}return _0x5e5538[_0x4e64('0x1f')]();};}function saveUpdates(_0xe882c6,_0x4470cb){return function(_0x2d89b2){if(_0x2d89b2){return _0x2d89b2[_0x4e64('0x20')](_0xe882c6)['then'](function(_0x4319ba){return _0x4319ba;});}return null;};}function removeEntity(_0x2f0ee4,_0xb80bcc){return function(_0x503c40){if(_0x503c40){return _0x503c40[_0x4e64('0x21')]()[_0x4e64('0x22')](function(){_0x2f0ee4['status'](0xcc)[_0x4e64('0x17')]();});}};}function handleEntityNotFound(_0x21fd98,_0x436dc0){return function(_0x1d8c69){if(!_0x1d8c69){_0x21fd98[_0x4e64('0x23')](0x194);}return _0x1d8c69;};}function handleError(_0x19cf8e,_0x2602fa){_0x2602fa=_0x2602fa||0x1f4;return function(_0x631183){logger[_0x4e64('0x24')](_0x631183[_0x4e64('0x25')]);if(_0x631183['name']){delete _0x631183['name'];}_0x19cf8e[_0x4e64('0x16')](_0x2602fa)[_0x4e64('0x26')](_0x631183);};}exports[_0x4e64('0x27')]=function(_0x7a82c7,_0x408ce8){var _0x36fca6={},_0x3f7ac0={},_0x4794b2={'count':0x0,'rows':[]};var _0x352d1b=_['map'](db[_0x4e64('0x28')][_0x4e64('0x29')],function(_0xfc7213){return{'name':_0xfc7213['fieldName'],'type':_0xfc7213[_0x4e64('0x2a')][_0x4e64('0x2b')]};});_0x3f7ac0[_0x4e64('0x2c')]=_[_0x4e64('0x2d')](_0x352d1b,_0x4e64('0x2e'));_0x3f7ac0[_0x4e64('0x2f')]=_['keys'](_0x7a82c7[_0x4e64('0x2f')]);_0x3f7ac0[_0x4e64('0x30')]=_[_0x4e64('0x31')](_0x3f7ac0[_0x4e64('0x2c')],_0x3f7ac0[_0x4e64('0x2f')]);_0x36fca6['attributes']=_['intersection'](_0x3f7ac0[_0x4e64('0x2c')],qs[_0x4e64('0x32')](_0x7a82c7['query']['fields']));_0x36fca6[_0x4e64('0x33')]=_0x36fca6[_0x4e64('0x33')]['length']?_0x36fca6[_0x4e64('0x33')]:_0x3f7ac0[_0x4e64('0x2c')];if(!_0x7a82c7[_0x4e64('0x2f')][_0x4e64('0x34')](_0x4e64('0x35'))){_0x36fca6[_0x4e64('0x1b')]=qs[_0x4e64('0x1b')](_0x7a82c7[_0x4e64('0x2f')]['limit']);_0x36fca6[_0x4e64('0x1a')]=qs[_0x4e64('0x1a')](_0x7a82c7[_0x4e64('0x2f')][_0x4e64('0x1a')]);}_0x36fca6[_0x4e64('0x36')]=qs[_0x4e64('0x37')](_0x7a82c7[_0x4e64('0x2f')][_0x4e64('0x37')]);_0x36fca6[_0x4e64('0x38')]=qs[_0x4e64('0x30')](_[_0x4e64('0x39')](_0x7a82c7[_0x4e64('0x2f')],_0x3f7ac0[_0x4e64('0x30')]),_0x352d1b);if(_0x7a82c7[_0x4e64('0x2f')][_0x4e64('0x3a')]){_0x36fca6[_0x4e64('0x38')]=_[_0x4e64('0x3b')](_0x36fca6[_0x4e64('0x38')],{'$or':_[_0x4e64('0x2d')](_0x352d1b,function(_0x1789c1){if(_0x1789c1['type']!==_0x4e64('0x3c')){var _0x2a5db0={};_0x2a5db0[_0x1789c1[_0x4e64('0x2e')]]={'$like':'%'+_0x7a82c7[_0x4e64('0x2f')][_0x4e64('0x3a')]+'%'};return _0x2a5db0;}})});}_0x36fca6=_[_0x4e64('0x3b')]({},_0x36fca6,_0x7a82c7[_0x4e64('0x3d')]);var _0x54671b={'where':_0x36fca6[_0x4e64('0x38')]};return db[_0x4e64('0x28')]['count'](_0x54671b)[_0x4e64('0x22')](function(_0x2869eb){_0x4794b2[_0x4e64('0x19')]=_0x2869eb;if(_0x7a82c7['query'][_0x4e64('0x3e')]){_0x36fca6[_0x4e64('0x3f')]=[{'all':!![]}];}return db[_0x4e64('0x28')][_0x4e64('0x40')](_0x36fca6);})[_0x4e64('0x22')](function(_0xa3353f){_0x4794b2[_0x4e64('0x41')]=_0xa3353f;return _0x4794b2;})['then'](respondWithFilteredResult(_0x408ce8,_0x36fca6))[_0x4e64('0x42')](handleError(_0x408ce8,null));};exports[_0x4e64('0x43')]=function(_0x45f2d2,_0x198705){var _0x36a270={'raw':!![],'where':{'id':_0x45f2d2[_0x4e64('0x44')]['id']}},_0x18d030={};_0x18d030[_0x4e64('0x2c')]=_['keys'](db['ChatQueueReport'][_0x4e64('0x29')]);_0x18d030[_0x4e64('0x2f')]=_[_0x4e64('0x45')](_0x45f2d2[_0x4e64('0x2f')]);_0x18d030['filters']=_[_0x4e64('0x31')](_0x18d030[_0x4e64('0x2c')],_0x18d030['query']);_0x36a270['attributes']=_[_0x4e64('0x31')](_0x18d030[_0x4e64('0x2c')],qs[_0x4e64('0x32')](_0x45f2d2[_0x4e64('0x2f')][_0x4e64('0x32')]));_0x36a270['attributes']=_0x36a270[_0x4e64('0x33')]['length']?_0x36a270[_0x4e64('0x33')]:_0x18d030[_0x4e64('0x2c')];if(_0x45f2d2[_0x4e64('0x2f')][_0x4e64('0x3e')]){_0x36a270[_0x4e64('0x3f')]=[{'all':!![]}];}_0x36a270=_[_0x4e64('0x3b')]({},_0x36a270,_0x45f2d2[_0x4e64('0x3d')]);return db[_0x4e64('0x28')][_0x4e64('0x46')](_0x36a270)[_0x4e64('0x22')](handleEntityNotFound(_0x198705,null))[_0x4e64('0x22')](respondWithResult(_0x198705,null))[_0x4e64('0x42')](handleError(_0x198705,null));};exports[_0x4e64('0x47')]=function(_0x29d7be,_0x502d60){return db[_0x4e64('0x28')][_0x4e64('0x47')](_0x29d7be[_0x4e64('0x48')],{})['then'](respondWithResult(_0x502d60,0xc9))['catch'](handleError(_0x502d60,null));};exports['update']=function(_0x46be92,_0x581492){if(_0x46be92[_0x4e64('0x48')]['id']){delete _0x46be92[_0x4e64('0x48')]['id'];}return db[_0x4e64('0x28')][_0x4e64('0x46')]({'where':{'id':_0x46be92[_0x4e64('0x44')]['id']}})[_0x4e64('0x22')](handleEntityNotFound(_0x581492,null))[_0x4e64('0x22')](saveUpdates(_0x46be92[_0x4e64('0x48')],null))[_0x4e64('0x22')](respondWithResult(_0x581492,null))['catch'](handleError(_0x581492,null));};exports[_0x4e64('0x21')]=function(_0x3bff5a,_0x170431){return db['ChatQueueReport'][_0x4e64('0x46')]({'where':{'id':_0x3bff5a[_0x4e64('0x44')]['id']}})[_0x4e64('0x22')](handleEntityNotFound(_0x170431,null))[_0x4e64('0x22')](removeEntity(_0x170431,null))['catch'](handleError(_0x170431,null));};exports[_0x4e64('0x49')]=function(_0xdb481f,_0x333ce7){return db[_0x4e64('0x28')][_0x4e64('0x49')]()[_0x4e64('0x22')](respondWithResult(_0x333ce7,null))[_0x4e64('0x42')](handleError(_0x333ce7,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index ca2ac8d..f9f0cc1 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 _0x54e1=['request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','define','report_chat_queue','uniqueid','util','api'];(function(_0x4a7b64,_0x16733c){var _0x500da6=function(_0x3454da){while(--_0x3454da){_0x4a7b64['push'](_0x4a7b64['shift']());}};_0x500da6(++_0x16733c);}(_0x54e1,0xd0));var _0x154e=function(_0x9f44e9,_0x5e0780){_0x9f44e9=_0x9f44e9-0x0;var _0x3fadc7=_0x54e1[_0x9f44e9];return _0x3fadc7;};'use strict';var _=require('lodash');var util=require(_0x154e('0x0'));var logger=require('../../config/logger')(_0x154e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x154e('0x2'));var fs=require('fs');var path=require(_0x154e('0x3'));var rimraf=require(_0x154e('0x4'));var config=require(_0x154e('0x5'));var attributes=require(_0x154e('0x6'));module['exports']=function(_0x973c5b,_0x1eeece){return _0x973c5b[_0x154e('0x7')]('ChatQueueReport',attributes,{'tableName':_0x154e('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x154e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0aa5=['path','rimraf','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3ed234,_0x189761){var _0x4664d0=function(_0x5b433){while(--_0x5b433){_0x3ed234['push'](_0x3ed234['shift']());}};_0x4664d0(++_0x189761);}(_0x0aa5,0x1e9));var _0x50aa=function(_0xab810c,_0x5bbc23){_0xab810c=_0xab810c-0x0;var _0x9e7ae1=_0x0aa5[_0xab810c];return _0x9e7ae1;};'use strict';var _=require('lodash');var util=require(_0x50aa('0x0'));var logger=require(_0x50aa('0x1'))(_0x50aa('0x2'));var moment=require('moment');var BPromise=require(_0x50aa('0x3'));var rp=require(_0x50aa('0x4'));var fs=require('fs');var path=require(_0x50aa('0x5'));var rimraf=require(_0x50aa('0x6'));var config=require('../../config/environment');var attributes=require(_0x50aa('0x7'));module[_0x50aa('0x8')]=function(_0x32ba4c,_0x304104){return _0x32ba4c[_0x50aa('0x9')](_0x50aa('0xa'),attributes,{'tableName':_0x50aa('0xb'),'paranoid':![],'indexes':[{'name':_0x50aa('0xc'),'fields':[_0x50aa('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 0b0c0a0..43a00cf 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 _0x3bf9=['request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch','CreateChatQueueReport','create','options','info','debug','stringify','UpdateChatQueueReport','body','raw','where','attributes','limit','then','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','client','http','request'];(function(_0x97654e,_0x4a899a){var _0x51a984=function(_0x20fc40){while(--_0x20fc40){_0x97654e['push'](_0x97654e['shift']());}};_0x51a984(++_0x4a899a);}(_0x3bf9,0x16a));var _0x93bf=function(_0x1c37a5,_0x59ee51){_0x1c37a5=_0x1c37a5-0x0;var _0x389d03=_0x3bf9[_0x1c37a5];return _0x389d03;};'use strict';var _=require(_0x93bf('0x0'));var util=require(_0x93bf('0x1'));var moment=require(_0x93bf('0x2'));var BPromise=require('bluebird');var rs=require(_0x93bf('0x3'));var fs=require('fs');var Redis=require(_0x93bf('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x93bf('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x93bf('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x93bf('0x7')][_0x93bf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f49f0,_0xa74ee0,_0x587eb3){return new BPromise(function(_0x1b72d7,_0x1c2bf8){return client[_0x93bf('0x9')](_0x4f49f0,_0x587eb3)['then'](function(_0x2b85a5){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0xa74ee0,_0x93bf('0xa'));logger['debug'](_0x93bf('0xb'),_0xa74ee0,_0x93bf('0xa'),JSON['stringify'](_0x2b85a5));if(_0x2b85a5[_0x93bf('0xc')]){if(_0x2b85a5[_0x93bf('0xc')][_0x93bf('0xd')]===0x1f4){logger[_0x93bf('0xc')](_0x93bf('0xe'),_0xa74ee0,_0x2b85a5[_0x93bf('0xc')][_0x93bf('0xf')]);return _0x1c2bf8(_0x2b85a5[_0x93bf('0xc')][_0x93bf('0xf')]);}logger[_0x93bf('0xc')](_0x93bf('0xe'),_0xa74ee0,_0x2b85a5[_0x93bf('0xc')][_0x93bf('0xf')]);return _0x1b72d7(_0x2b85a5[_0x93bf('0xc')][_0x93bf('0xf')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0xa74ee0,_0x93bf('0xa'));_0x1b72d7(_0x2b85a5[_0x93bf('0x10')]['message']);}})[_0x93bf('0x11')](function(_0x299a1b){logger[_0x93bf('0xc')](_0x93bf('0xe'),_0xa74ee0,_0x299a1b);_0x1c2bf8(_0x299a1b);});});}exports[_0x93bf('0x12')]=function(_0x55bd15){var _0x5511cd=this;return new Promise(function(_0x2f1b06,_0x380cf0){return db['ChatQueueReport'][_0x93bf('0x13')](_0x55bd15['body'],{'raw':_0x55bd15[_0x93bf('0x14')]?_0x55bd15[_0x93bf('0x14')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4e20b3){logger[_0x93bf('0x15')](_0x93bf('0x12'),_0x55bd15);logger[_0x93bf('0x16')](_0x93bf('0x12'),_0x55bd15,JSON[_0x93bf('0x17')](_0x4e20b3));_0x2f1b06(_0x4e20b3);})[_0x93bf('0x11')](function(_0x25913f){logger[_0x93bf('0xc')](_0x93bf('0x12'),_0x25913f[_0x93bf('0xf')],_0x55bd15);_0x380cf0(_0x5511cd[_0x93bf('0xc')](0x1f4,_0x25913f[_0x93bf('0xf')]));});});};exports[_0x93bf('0x18')]=function(_0x5ad7a9){var _0xd0ab97=this;return new Promise(function(_0x5bee06,_0x489ccf){return db['ChatQueueReport']['update'](_0x5ad7a9[_0x93bf('0x19')],{'raw':_0x5ad7a9[_0x93bf('0x14')]?_0x5ad7a9[_0x93bf('0x14')][_0x93bf('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ad7a9[_0x93bf('0x14')]?_0x5ad7a9[_0x93bf('0x14')][_0x93bf('0x1b')]||null:null,'attributes':_0x5ad7a9[_0x93bf('0x14')]?_0x5ad7a9[_0x93bf('0x14')][_0x93bf('0x1c')]||null:null,'limit':_0x5ad7a9[_0x93bf('0x14')]?_0x5ad7a9['options'][_0x93bf('0x1d')]||null:null})[_0x93bf('0x1e')](function(_0x3e56fa){logger[_0x93bf('0x15')](_0x93bf('0x18'),_0x5ad7a9);logger['debug']('UpdateChatQueueReport',_0x5ad7a9,JSON['stringify'](_0x3e56fa));_0x5bee06(_0x3e56fa);})[_0x93bf('0x11')](function(_0x5a823a){logger[_0x93bf('0xc')](_0x93bf('0x18'),_0x5a823a[_0x93bf('0xf')],_0x5ad7a9);_0x489ccf(_0xd0ab97['error'](0x1f4,_0x5a823a['message']));});});}; \ No newline at end of file +var _0xb734=['UpdateChatQueueReport','update','where','attributes','limit','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','CreateChatQueueReport','ChatQueueReport','create','body','options','raw'];(function(_0x4de5bc,_0x50fa9f){var _0x1d498c=function(_0x2dff1b){while(--_0x2dff1b){_0x4de5bc['push'](_0x4de5bc['shift']());}};_0x1d498c(++_0x50fa9f);}(_0xb734,0x126));var _0x4b73=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0xb734[_0x5eef05];return _0x56d4b8;};'use strict';var _=require(_0x4b73('0x0'));var util=require(_0x4b73('0x1'));var moment=require('moment');var BPromise=require(_0x4b73('0x2'));var rs=require(_0x4b73('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b73('0x4'))['db'];var utils=require(_0x4b73('0x5'));var logger=require('../../config/logger')(_0x4b73('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4b73('0x7')][_0x4b73('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5c9bb7,_0xf20b38,_0x4271dc){return new BPromise(function(_0x1ae1de,_0x23ad40){return client[_0x4b73('0x9')](_0x5c9bb7,_0x4271dc)[_0x4b73('0xa')](function(_0x58253c){logger[_0x4b73('0xb')](_0x4b73('0xc'),_0xf20b38,'request\x20sent');logger[_0x4b73('0xd')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0xf20b38,_0x4b73('0xe'),JSON[_0x4b73('0xf')](_0x58253c));if(_0x58253c['error']){if(_0x58253c[_0x4b73('0x10')][_0x4b73('0x11')]===0x1f4){logger['error'](_0x4b73('0xc'),_0xf20b38,_0x58253c[_0x4b73('0x10')]['message']);return _0x23ad40(_0x58253c[_0x4b73('0x10')][_0x4b73('0x12')]);}logger[_0x4b73('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0xf20b38,_0x58253c['error']['message']);return _0x1ae1de(_0x58253c['error'][_0x4b73('0x12')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0xf20b38,_0x4b73('0xe'));_0x1ae1de(_0x58253c[_0x4b73('0x13')][_0x4b73('0x12')]);}})['catch'](function(_0xde2c1c){logger['error'](_0x4b73('0xc'),_0xf20b38,_0xde2c1c);_0x23ad40(_0xde2c1c);});});}exports[_0x4b73('0x14')]=function(_0x2d6baf){var _0x1a9fa7=this;return new Promise(function(_0x307163,_0x36f89c){return db[_0x4b73('0x15')][_0x4b73('0x16')](_0x2d6baf[_0x4b73('0x17')],{'raw':_0x2d6baf[_0x4b73('0x18')]?_0x2d6baf[_0x4b73('0x18')][_0x4b73('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x30aa32){logger['info']('CreateChatQueueReport',_0x2d6baf);logger[_0x4b73('0xd')](_0x4b73('0x14'),_0x2d6baf,JSON[_0x4b73('0xf')](_0x30aa32));_0x307163(_0x30aa32);})['catch'](function(_0x2845bb){logger[_0x4b73('0x10')]('CreateChatQueueReport',_0x2845bb['message'],_0x2d6baf);_0x36f89c(_0x1a9fa7['error'](0x1f4,_0x2845bb['message']));});});};exports[_0x4b73('0x1a')]=function(_0x45f2b0){var _0xedb466=this;return new Promise(function(_0x3d5658,_0x3d5d34){return db[_0x4b73('0x15')][_0x4b73('0x1b')](_0x45f2b0[_0x4b73('0x17')],{'raw':_0x45f2b0['options']?_0x45f2b0[_0x4b73('0x18')][_0x4b73('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45f2b0[_0x4b73('0x18')]?_0x45f2b0[_0x4b73('0x18')][_0x4b73('0x1c')]||null:null,'attributes':_0x45f2b0[_0x4b73('0x18')]?_0x45f2b0[_0x4b73('0x18')][_0x4b73('0x1d')]||null:null,'limit':_0x45f2b0[_0x4b73('0x18')]?_0x45f2b0[_0x4b73('0x18')][_0x4b73('0x1e')]||null:null})['then'](function(_0x258218){logger['info']('UpdateChatQueueReport',_0x45f2b0);logger[_0x4b73('0xd')]('UpdateChatQueueReport',_0x45f2b0,JSON['stringify'](_0x258218));_0x3d5658(_0x258218);})[_0x4b73('0x1f')](function(_0x5d1a93){logger[_0x4b73('0x10')](_0x4b73('0x1a'),_0x5d1a93[_0x4b73('0x12')],_0x45f2b0);_0x3d5d34(_0xedb466['error'](0x1f4,_0x5d1a93[_0x4b73('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 00b2252..9d75a2f 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 _0x772b=['create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','post'];(function(_0x48255e,_0x29659b){var _0x197284=function(_0x14c5a2){while(--_0x14c5a2){_0x48255e['push'](_0x48255e['shift']());}};_0x197284(++_0x29659b);}(_0x772b,0x1ab));var _0xb772=function(_0x36b5d5,_0x3f25a3){_0x36b5d5=_0x36b5d5-0x0;var _0x44ab04=_0x772b[_0x36b5d5];return _0x44ab04;};'use strict';var multer=require(_0xb772('0x0'));var util=require(_0xb772('0x1'));var path=require(_0xb772('0x2'));var timeout=require(_0xb772('0x3'));var express=require(_0xb772('0x4'));var router=express[_0xb772('0x5')]();var auth=require(_0xb772('0x6'));var interaction=require(_0xb772('0x7'));var config=require(_0xb772('0x8'));var controller=require('./chatQueueReport.controller');router[_0xb772('0x9')]('/',auth[_0xb772('0xa')](),controller[_0xb772('0xb')]);router[_0xb772('0x9')](_0xb772('0xc'),auth[_0xb772('0xa')](),controller['describe']);router[_0xb772('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb772('0xd')]('/',auth['isAuthenticated'](),controller[_0xb772('0xe')]);router[_0xb772('0xf')](_0xb772('0x10'),auth[_0xb772('0xa')](),controller[_0xb772('0x11')]);router[_0xb772('0x12')](_0xb772('0x10'),auth[_0xb772('0xa')](),controller[_0xb772('0x13')]);module[_0xb772('0x14')]=router; \ No newline at end of file +var _0x2b1d=['delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','./chatQueueReport.controller','index','get','/describe','isAuthenticated','describe','show','create','put','/:id','update'];(function(_0x22ca6f,_0x1b9f59){var _0x535c9b=function(_0x732f42){while(--_0x732f42){_0x22ca6f['push'](_0x22ca6f['shift']());}};_0x535c9b(++_0x1b9f59);}(_0x2b1d,0x1ca));var _0xd2b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2b1d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd2b1('0x0'));var util=require(_0xd2b1('0x1'));var path=require(_0xd2b1('0x2'));var timeout=require(_0xd2b1('0x3'));var express=require('express');var router=express[_0xd2b1('0x4')]();var auth=require(_0xd2b1('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd2b1('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xd2b1('0x7')]);router[_0xd2b1('0x8')](_0xd2b1('0x9'),auth[_0xd2b1('0xa')](),controller[_0xd2b1('0xb')]);router[_0xd2b1('0x8')]('/:id',auth[_0xd2b1('0xa')](),controller[_0xd2b1('0xc')]);router['post']('/',auth[_0xd2b1('0xa')](),controller[_0xd2b1('0xd')]);router[_0xd2b1('0xe')](_0xd2b1('0xf'),auth[_0xd2b1('0xa')](),controller[_0xd2b1('0x10')]);router[_0xd2b1('0x11')](_0xd2b1('0xf'),auth[_0xd2b1('0xa')](),controller[_0xd2b1('0x12')]);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 f168efd..df2c90c 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 _0x1a3a=['STRING','ENUM','account','agent','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x1a3a,0xf7));var _0xa1a3=function(_0x5d3891,_0x57fdac){_0x5d3891=_0x5d3891-0x0;var _0x3da005=_0x1a3a[_0x5d3891];return _0x3da005;};'use strict';var moment=require(_0xa1a3('0x0'));var Sequelize=require(_0xa1a3('0x1'));module[_0xa1a3('0x2')]={'uniqueid':{'type':Sequelize[_0xa1a3('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xa1a3('0x4')](_0xa1a3('0x5'),_0xa1a3('0x6'),'queue'),'allowNull':![],'defaultValue':_0xa1a3('0x7')},'transferredAt':{'type':Sequelize[_0xa1a3('0x8')],'allowNull':![],'defaultValue':Sequelize[_0xa1a3('0x9')]}}; \ No newline at end of file +var _0x79df=['exports','ENUM','account','agent','queue','DATE','NOW','moment'];(function(_0x35805b,_0x5aa51b){var _0x1a8d55=function(_0x19f933){while(--_0x19f933){_0x35805b['push'](_0x35805b['shift']());}};_0x1a8d55(++_0x5aa51b);}(_0x79df,0x1d7));var _0xf79d=function(_0x222662,_0x1cb394){_0x222662=_0x222662-0x0;var _0x1422e7=_0x79df[_0x222662];return _0x1422e7;};'use strict';var moment=require(_0xf79d('0x0'));var Sequelize=require('sequelize');module[_0xf79d('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf79d('0x2')](_0xf79d('0x3'),_0xf79d('0x4'),_0xf79d('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xf79d('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xf79d('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 26854d2..8a049fb 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 _0x9ac8=['catch','params','keys','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','ejs','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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','index','ChatTransferReport','rawAttributes','key','map','query','filters','model','attributes','fields','length','nolimit','order','sort','where','filter','type','options','includeAll','include','findAll','rows'];(function(_0x2460c6,_0x404331){var _0x45969b=function(_0xf78fae){while(--_0xf78fae){_0x2460c6['push'](_0x2460c6['shift']());}};_0x45969b(++_0x404331);}(_0x9ac8,0x1b7));var _0x89ac=function(_0x45e3a6,_0x4168d6){_0x45e3a6=_0x45e3a6-0x0;var _0x38a04a=_0x9ac8[_0x45e3a6];return _0x38a04a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x89ac('0x0'));var rimraf=require(_0x89ac('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x89ac('0x2'));var rp=require('request-promise');var moment=require(_0x89ac('0x3'));var BPromise=require(_0x89ac('0x4'));var Mustache=require(_0x89ac('0x5'));var util=require('util');var path=require(_0x89ac('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x89ac('0x7'));var fs=require('fs');var _=require(_0x89ac('0x8'));var squel=require(_0x89ac('0x9'));var crypto=require(_0x89ac('0xa'));var jsforce=require(_0x89ac('0xb'));var deskjs=require(_0x89ac('0xc'));var toCsv=require(_0x89ac('0xd'));var querystring=require(_0x89ac('0xe'));var Papa=require(_0x89ac('0xf'));var Redis=require(_0x89ac('0x10'));var authService=require(_0x89ac('0x11'));var qs=require(_0x89ac('0x12'));var as=require(_0x89ac('0x13'));var hardwareService=require(_0x89ac('0x14'));var logger=require(_0x89ac('0x15'))(_0x89ac('0x16'));var utils=require(_0x89ac('0x17'));var config=require(_0x89ac('0x18'));var licenseUtil=require(_0x89ac('0x19'));var db=require(_0x89ac('0x1a'))['db'];function respondWithStatusCode(_0x3d9a6a,_0x30eced){_0x30eced=_0x30eced||0xcc;return function(_0x4fa79a){if(_0x4fa79a){return _0x3d9a6a[_0x89ac('0x1b')](_0x30eced);}return _0x3d9a6a[_0x89ac('0x1c')](_0x30eced)[_0x89ac('0x1d')]();};}function respondWithResult(_0x5d1354,_0x13a2cb){_0x13a2cb=_0x13a2cb||0xc8;return function(_0x189c4f){if(_0x189c4f){return _0x5d1354[_0x89ac('0x1c')](_0x13a2cb)[_0x89ac('0x1e')](_0x189c4f);}};}function respondWithFilteredResult(_0x40b17e,_0x5c84c7){return function(_0x21418c){if(_0x21418c){var _0x55e449=_0x21418c[_0x89ac('0x1f')],_0x5de032=_0x5c84c7[_0x89ac('0x20')],_0x134bf6=_0x5c84c7[_0x89ac('0x20')]+_0x5c84c7[_0x89ac('0x21')],_0x27abf7;if(_0x134bf6>=_0x55e449){_0x134bf6=_0x55e449;_0x27abf7=0xc8;}else{_0x27abf7=0xce;}_0x40b17e[_0x89ac('0x1c')](_0x27abf7);return _0x40b17e['set'](_0x89ac('0x22'),_0x5de032+'-'+_0x134bf6+'/'+_0x55e449)[_0x89ac('0x1e')](_0x21418c);}return null;};}function patchUpdates(_0x24e515){return function(_0x113647){try{jsonpatch['apply'](_0x113647,_0x24e515,!![]);}catch(_0x3bdedb){return BPromise[_0x89ac('0x23')](_0x3bdedb);}return _0x113647[_0x89ac('0x24')]();};}function saveUpdates(_0x51bd55,_0x5c4c09){return function(_0x343a5c){if(_0x343a5c){return _0x343a5c[_0x89ac('0x25')](_0x51bd55)[_0x89ac('0x26')](function(_0x5267a8){return _0x5267a8;});}return null;};}function removeEntity(_0x2f28e3,_0x30c831){return function(_0x60be9d){if(_0x60be9d){return _0x60be9d[_0x89ac('0x27')]()[_0x89ac('0x26')](function(){_0x2f28e3[_0x89ac('0x1c')](0xcc)[_0x89ac('0x1d')]();});}};}function handleEntityNotFound(_0x33280d,_0x3683e5){return function(_0x277b7f){if(!_0x277b7f){_0x33280d[_0x89ac('0x1b')](0x194);}return _0x277b7f;};}function handleError(_0x3e0e64,_0x398fe5){_0x398fe5=_0x398fe5||0x1f4;return function(_0x5d95e1){logger[_0x89ac('0x28')](_0x5d95e1[_0x89ac('0x29')]);if(_0x5d95e1[_0x89ac('0x2a')]){delete _0x5d95e1[_0x89ac('0x2a')];}_0x3e0e64[_0x89ac('0x1c')](_0x398fe5)['send'](_0x5d95e1);};}exports[_0x89ac('0x2b')]=function(_0x2f88bd,_0x17353c){var _0x27d9eb={},_0x49cc75={},_0x9bdf78={'count':0x0,'rows':[]};var _0x39dd93=_['map'](db[_0x89ac('0x2c')][_0x89ac('0x2d')],function(_0x3d2e83){return{'name':_0x3d2e83['fieldName'],'type':_0x3d2e83['type'][_0x89ac('0x2e')]};});_0x49cc75['model']=_[_0x89ac('0x2f')](_0x39dd93,_0x89ac('0x2a'));_0x49cc75[_0x89ac('0x30')]=_['keys'](_0x2f88bd['query']);_0x49cc75[_0x89ac('0x31')]=_['intersection'](_0x49cc75[_0x89ac('0x32')],_0x49cc75['query']);_0x27d9eb[_0x89ac('0x33')]=_['intersection'](_0x49cc75[_0x89ac('0x32')],qs[_0x89ac('0x34')](_0x2f88bd[_0x89ac('0x30')][_0x89ac('0x34')]));_0x27d9eb[_0x89ac('0x33')]=_0x27d9eb[_0x89ac('0x33')][_0x89ac('0x35')]?_0x27d9eb[_0x89ac('0x33')]:_0x49cc75[_0x89ac('0x32')];if(!_0x2f88bd[_0x89ac('0x30')]['hasOwnProperty'](_0x89ac('0x36'))){_0x27d9eb[_0x89ac('0x21')]=qs[_0x89ac('0x21')](_0x2f88bd[_0x89ac('0x30')][_0x89ac('0x21')]);_0x27d9eb[_0x89ac('0x20')]=qs['offset'](_0x2f88bd[_0x89ac('0x30')][_0x89ac('0x20')]);}_0x27d9eb[_0x89ac('0x37')]=qs[_0x89ac('0x38')](_0x2f88bd[_0x89ac('0x30')][_0x89ac('0x38')]);_0x27d9eb[_0x89ac('0x39')]=qs[_0x89ac('0x31')](_['pick'](_0x2f88bd[_0x89ac('0x30')],_0x49cc75['filters']),_0x39dd93);if(_0x2f88bd[_0x89ac('0x30')][_0x89ac('0x3a')]){_0x27d9eb[_0x89ac('0x39')]=_['merge'](_0x27d9eb[_0x89ac('0x39')],{'$or':_[_0x89ac('0x2f')](_0x39dd93,function(_0x2f594b){if(_0x2f594b[_0x89ac('0x3b')]!=='VIRTUAL'){var _0x42924b={};_0x42924b[_0x2f594b[_0x89ac('0x2a')]]={'$like':'%'+_0x2f88bd[_0x89ac('0x30')][_0x89ac('0x3a')]+'%'};return _0x42924b;}})});}_0x27d9eb=_['merge']({},_0x27d9eb,_0x2f88bd[_0x89ac('0x3c')]);var _0x47b9ac={'where':_0x27d9eb[_0x89ac('0x39')]};return db[_0x89ac('0x2c')][_0x89ac('0x1f')](_0x47b9ac)['then'](function(_0x4cd5c9){_0x9bdf78[_0x89ac('0x1f')]=_0x4cd5c9;if(_0x2f88bd[_0x89ac('0x30')][_0x89ac('0x3d')]){_0x27d9eb[_0x89ac('0x3e')]=[{'all':!![]}];}return db[_0x89ac('0x2c')][_0x89ac('0x3f')](_0x27d9eb);})['then'](function(_0x469637){_0x9bdf78[_0x89ac('0x40')]=_0x469637;return _0x9bdf78;})[_0x89ac('0x26')](respondWithFilteredResult(_0x17353c,_0x27d9eb))[_0x89ac('0x41')](handleError(_0x17353c,null));};exports['show']=function(_0x4dc848,_0x30b235){var _0x156b3d={'raw':!![],'where':{'id':_0x4dc848[_0x89ac('0x42')]['id']}},_0x5aac6d={};_0x5aac6d[_0x89ac('0x32')]=_[_0x89ac('0x43')](db[_0x89ac('0x2c')][_0x89ac('0x2d')]);_0x5aac6d[_0x89ac('0x30')]=_[_0x89ac('0x43')](_0x4dc848[_0x89ac('0x30')]);_0x5aac6d[_0x89ac('0x31')]=_['intersection'](_0x5aac6d[_0x89ac('0x32')],_0x5aac6d[_0x89ac('0x30')]);_0x156b3d[_0x89ac('0x33')]=_['intersection'](_0x5aac6d[_0x89ac('0x32')],qs[_0x89ac('0x34')](_0x4dc848['query'][_0x89ac('0x34')]));_0x156b3d[_0x89ac('0x33')]=_0x156b3d[_0x89ac('0x33')][_0x89ac('0x35')]?_0x156b3d[_0x89ac('0x33')]:_0x5aac6d[_0x89ac('0x32')];if(_0x4dc848[_0x89ac('0x30')]['includeAll']){_0x156b3d['include']=[{'all':!![]}];}_0x156b3d=_['merge']({},_0x156b3d,_0x4dc848[_0x89ac('0x3c')]);return db[_0x89ac('0x2c')][_0x89ac('0x44')](_0x156b3d)[_0x89ac('0x26')](handleEntityNotFound(_0x30b235,null))['then'](respondWithResult(_0x30b235,null))[_0x89ac('0x41')](handleError(_0x30b235,null));};exports[_0x89ac('0x45')]=function(_0x20ed39,_0x211a87){return db[_0x89ac('0x2c')][_0x89ac('0x45')](_0x20ed39[_0x89ac('0x46')],{})['then'](respondWithResult(_0x211a87,0xc9))[_0x89ac('0x41')](handleError(_0x211a87,null));};exports['update']=function(_0x4d80a8,_0x1b038c){if(_0x4d80a8[_0x89ac('0x46')]['id']){delete _0x4d80a8['body']['id'];}return db[_0x89ac('0x2c')][_0x89ac('0x44')]({'where':{'id':_0x4d80a8[_0x89ac('0x42')]['id']}})[_0x89ac('0x26')](handleEntityNotFound(_0x1b038c,null))[_0x89ac('0x26')](saveUpdates(_0x4d80a8[_0x89ac('0x46')],null))[_0x89ac('0x26')](respondWithResult(_0x1b038c,null))[_0x89ac('0x41')](handleError(_0x1b038c,null));};exports[_0x89ac('0x27')]=function(_0x300993,_0x1fc640){return db[_0x89ac('0x2c')][_0x89ac('0x44')]({'where':{'id':_0x300993[_0x89ac('0x42')]['id']}})[_0x89ac('0x26')](handleEntityNotFound(_0x1fc640,null))[_0x89ac('0x26')](removeEntity(_0x1fc640,null))[_0x89ac('0x41')](handleError(_0x1fc640,null));};exports[_0x89ac('0x47')]=function(_0x2705dd,_0x5d1c9e){return db[_0x89ac('0x2c')][_0x89ac('0x47')]()[_0x89ac('0x26')](respondWithResult(_0x5d1c9e,null))[_0x89ac('0x41')](handleError(_0x5d1c9e,null));}; \ No newline at end of file +var _0x7562=['stack','name','index','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','count','includeAll','ChatTransferReport','rows','catch','show','params','include','find','create','body','update','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','then','error'];(function(_0xa9edc1,_0x260339){var _0x227118=function(_0x2249a3){while(--_0x2249a3){_0xa9edc1['push'](_0xa9edc1['shift']());}};_0x227118(++_0x260339);}(_0x7562,0x1a3));var _0x2756=function(_0x292eb0,_0x2c5d08){_0x292eb0=_0x292eb0-0x0;var _0x2016a1=_0x7562[_0x292eb0];return _0x2016a1;};'use strict';var pdf=require(_0x2756('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2756('0x1'));var zipdir=require(_0x2756('0x2'));var jsonpatch=require(_0x2756('0x3'));var rp=require(_0x2756('0x4'));var moment=require(_0x2756('0x5'));var BPromise=require(_0x2756('0x6'));var Mustache=require(_0x2756('0x7'));var util=require(_0x2756('0x8'));var path=require(_0x2756('0x9'));var sox=require(_0x2756('0xa'));var csv=require(_0x2756('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2756('0xc'));var squel=require(_0x2756('0xd'));var crypto=require(_0x2756('0xe'));var jsforce=require(_0x2756('0xf'));var deskjs=require(_0x2756('0x10'));var toCsv=require(_0x2756('0xb'));var querystring=require(_0x2756('0x11'));var Papa=require(_0x2756('0x12'));var Redis=require(_0x2756('0x13'));var authService=require(_0x2756('0x14'));var qs=require(_0x2756('0x15'));var as=require(_0x2756('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2756('0x17'));var utils=require(_0x2756('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2756('0x19'))['db'];function respondWithStatusCode(_0x3ba775,_0x3b2282){_0x3b2282=_0x3b2282||0xcc;return function(_0x43d8c6){if(_0x43d8c6){return _0x3ba775[_0x2756('0x1a')](_0x3b2282);}return _0x3ba775[_0x2756('0x1b')](_0x3b2282)[_0x2756('0x1c')]();};}function respondWithResult(_0x891993,_0x5d69db){_0x5d69db=_0x5d69db||0xc8;return function(_0x424ca0){if(_0x424ca0){return _0x891993[_0x2756('0x1b')](_0x5d69db)[_0x2756('0x1d')](_0x424ca0);}};}function respondWithFilteredResult(_0x3728e1,_0x28d6c2){return function(_0x2b7b93){if(_0x2b7b93){var _0x4d6f8d=_0x2b7b93['count'],_0x3cf448=_0x28d6c2[_0x2756('0x1e')],_0x416a6b=_0x28d6c2[_0x2756('0x1e')]+_0x28d6c2[_0x2756('0x1f')],_0x611004;if(_0x416a6b>=_0x4d6f8d){_0x416a6b=_0x4d6f8d;_0x611004=0xc8;}else{_0x611004=0xce;}_0x3728e1[_0x2756('0x1b')](_0x611004);return _0x3728e1[_0x2756('0x20')](_0x2756('0x21'),_0x3cf448+'-'+_0x416a6b+'/'+_0x4d6f8d)['json'](_0x2b7b93);}return null;};}function patchUpdates(_0x59803a){return function(_0x3e0854){try{jsonpatch[_0x2756('0x22')](_0x3e0854,_0x59803a,!![]);}catch(_0x1e0881){return BPromise['reject'](_0x1e0881);}return _0x3e0854['save']();};}function saveUpdates(_0x5f4b02,_0x5c6923){return function(_0x49aa10){if(_0x49aa10){return _0x49aa10['update'](_0x5f4b02)[_0x2756('0x23')](function(_0x34f6b1){return _0x34f6b1;});}return null;};}function removeEntity(_0x53adc1,_0xfb297c){return function(_0x48a75a){if(_0x48a75a){return _0x48a75a['destroy']()[_0x2756('0x23')](function(){_0x53adc1[_0x2756('0x1b')](0xcc)[_0x2756('0x1c')]();});}};}function handleEntityNotFound(_0x2aa2df,_0x473c96){return function(_0x40585d){if(!_0x40585d){_0x2aa2df[_0x2756('0x1a')](0x194);}return _0x40585d;};}function handleError(_0x1687f4,_0x2063c2){_0x2063c2=_0x2063c2||0x1f4;return function(_0xd5aa47){logger[_0x2756('0x24')](_0xd5aa47[_0x2756('0x25')]);if(_0xd5aa47[_0x2756('0x26')]){delete _0xd5aa47[_0x2756('0x26')];}_0x1687f4[_0x2756('0x1b')](_0x2063c2)['send'](_0xd5aa47);};}exports[_0x2756('0x27')]=function(_0x4bab8a,_0xb7da83){var _0xf1559={},_0x56f9af={},_0x330b15={'count':0x0,'rows':[]};var _0x2048fc=_['map'](db['ChatTransferReport'][_0x2756('0x28')],function(_0x5b3068){return{'name':_0x5b3068['fieldName'],'type':_0x5b3068[_0x2756('0x29')][_0x2756('0x2a')]};});_0x56f9af[_0x2756('0x2b')]=_['map'](_0x2048fc,_0x2756('0x26'));_0x56f9af[_0x2756('0x2c')]=_[_0x2756('0x2d')](_0x4bab8a[_0x2756('0x2c')]);_0x56f9af['filters']=_[_0x2756('0x2e')](_0x56f9af[_0x2756('0x2b')],_0x56f9af['query']);_0xf1559[_0x2756('0x2f')]=_['intersection'](_0x56f9af[_0x2756('0x2b')],qs[_0x2756('0x30')](_0x4bab8a[_0x2756('0x2c')][_0x2756('0x30')]));_0xf1559[_0x2756('0x2f')]=_0xf1559[_0x2756('0x2f')][_0x2756('0x31')]?_0xf1559[_0x2756('0x2f')]:_0x56f9af[_0x2756('0x2b')];if(!_0x4bab8a[_0x2756('0x2c')][_0x2756('0x32')](_0x2756('0x33'))){_0xf1559[_0x2756('0x1f')]=qs[_0x2756('0x1f')](_0x4bab8a[_0x2756('0x2c')][_0x2756('0x1f')]);_0xf1559[_0x2756('0x1e')]=qs[_0x2756('0x1e')](_0x4bab8a[_0x2756('0x2c')]['offset']);}_0xf1559[_0x2756('0x34')]=qs[_0x2756('0x35')](_0x4bab8a[_0x2756('0x2c')][_0x2756('0x35')]);_0xf1559[_0x2756('0x36')]=qs[_0x2756('0x37')](_[_0x2756('0x38')](_0x4bab8a['query'],_0x56f9af[_0x2756('0x37')]),_0x2048fc);if(_0x4bab8a['query'][_0x2756('0x39')]){_0xf1559[_0x2756('0x36')]=_[_0x2756('0x3a')](_0xf1559['where'],{'$or':_[_0x2756('0x3b')](_0x2048fc,function(_0x161c92){if(_0x161c92[_0x2756('0x29')]!==_0x2756('0x3c')){var _0x36fa53={};_0x36fa53[_0x161c92[_0x2756('0x26')]]={'$like':'%'+_0x4bab8a['query'][_0x2756('0x39')]+'%'};return _0x36fa53;}})});}_0xf1559=_[_0x2756('0x3a')]({},_0xf1559,_0x4bab8a[_0x2756('0x3d')]);var _0x4f2d68={'where':_0xf1559[_0x2756('0x36')]};return db['ChatTransferReport'][_0x2756('0x3e')](_0x4f2d68)[_0x2756('0x23')](function(_0x3e7c52){_0x330b15[_0x2756('0x3e')]=_0x3e7c52;if(_0x4bab8a[_0x2756('0x2c')][_0x2756('0x3f')]){_0xf1559['include']=[{'all':!![]}];}return db[_0x2756('0x40')]['findAll'](_0xf1559);})[_0x2756('0x23')](function(_0x3ad624){_0x330b15[_0x2756('0x41')]=_0x3ad624;return _0x330b15;})[_0x2756('0x23')](respondWithFilteredResult(_0xb7da83,_0xf1559))[_0x2756('0x42')](handleError(_0xb7da83,null));};exports[_0x2756('0x43')]=function(_0x3d9785,_0xbd7803){var _0xf7e6d9={'raw':!![],'where':{'id':_0x3d9785[_0x2756('0x44')]['id']}},_0x480275={};_0x480275[_0x2756('0x2b')]=_[_0x2756('0x2d')](db['ChatTransferReport'][_0x2756('0x28')]);_0x480275[_0x2756('0x2c')]=_[_0x2756('0x2d')](_0x3d9785[_0x2756('0x2c')]);_0x480275[_0x2756('0x37')]=_[_0x2756('0x2e')](_0x480275[_0x2756('0x2b')],_0x480275[_0x2756('0x2c')]);_0xf7e6d9['attributes']=_['intersection'](_0x480275[_0x2756('0x2b')],qs[_0x2756('0x30')](_0x3d9785['query']['fields']));_0xf7e6d9[_0x2756('0x2f')]=_0xf7e6d9['attributes'][_0x2756('0x31')]?_0xf7e6d9[_0x2756('0x2f')]:_0x480275[_0x2756('0x2b')];if(_0x3d9785[_0x2756('0x2c')][_0x2756('0x3f')]){_0xf7e6d9[_0x2756('0x45')]=[{'all':!![]}];}_0xf7e6d9=_[_0x2756('0x3a')]({},_0xf7e6d9,_0x3d9785[_0x2756('0x3d')]);return db[_0x2756('0x40')][_0x2756('0x46')](_0xf7e6d9)[_0x2756('0x23')](handleEntityNotFound(_0xbd7803,null))[_0x2756('0x23')](respondWithResult(_0xbd7803,null))[_0x2756('0x42')](handleError(_0xbd7803,null));};exports[_0x2756('0x47')]=function(_0x2232a2,_0x1469f9){return db['ChatTransferReport'][_0x2756('0x47')](_0x2232a2[_0x2756('0x48')],{})[_0x2756('0x23')](respondWithResult(_0x1469f9,0xc9))[_0x2756('0x42')](handleError(_0x1469f9,null));};exports[_0x2756('0x49')]=function(_0xc92c3e,_0x2faa93){if(_0xc92c3e[_0x2756('0x48')]['id']){delete _0xc92c3e[_0x2756('0x48')]['id'];}return db['ChatTransferReport'][_0x2756('0x46')]({'where':{'id':_0xc92c3e['params']['id']}})['then'](handleEntityNotFound(_0x2faa93,null))['then'](saveUpdates(_0xc92c3e['body'],null))[_0x2756('0x23')](respondWithResult(_0x2faa93,null))[_0x2756('0x42')](handleError(_0x2faa93,null));};exports[_0x2756('0x4a')]=function(_0xd39ea6,_0x178395){return db['ChatTransferReport']['find']({'where':{'id':_0xd39ea6[_0x2756('0x44')]['id']}})[_0x2756('0x23')](handleEntityNotFound(_0x178395,null))[_0x2756('0x23')](removeEntity(_0x178395,null))[_0x2756('0x42')](handleError(_0x178395,null));};exports['describe']=function(_0x3a9a95,_0x262060){return db['ChatTransferReport'][_0x2756('0x4b')]()[_0x2756('0x23')](respondWithResult(_0x262060,null))['catch'](handleError(_0x262060,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 1b1f1aa..797a454 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 _0x23cc=['lodash','util','../../config/logger','bluebird','path','./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid'];(function(_0x5d340a,_0x2441da){var _0x435564=function(_0x16f6d4){while(--_0x16f6d4){_0x5d340a['push'](_0x5d340a['shift']());}};_0x435564(++_0x2441da);}(_0x23cc,0x15e));var _0xc23c=function(_0xd1cd6f,_0x52e6e1){_0xd1cd6f=_0xd1cd6f-0x0;var _0x45f75a=_0x23cc[_0xd1cd6f];return _0x45f75a;};'use strict';var _=require(_0xc23c('0x0'));var util=require(_0xc23c('0x1'));var logger=require(_0xc23c('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc23c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc23c('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc23c('0x5'));module[_0xc23c('0x6')]=function(_0x40b26e,_0x51cea8){return _0x40b26e[_0xc23c('0x7')](_0xc23c('0x8'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xc23c('0x9'),'fields':[_0xc23c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x11cd=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util'];(function(_0x257a0,_0x42d2b4){var _0x8a44ed=function(_0x51b193){while(--_0x51b193){_0x257a0['push'](_0x257a0['shift']());}};_0x8a44ed(++_0x42d2b4);}(_0x11cd,0x1c0));var _0xd11c=function(_0x38e6ef,_0x55cb89){_0x38e6ef=_0x38e6ef-0x0;var _0x55034c=_0x11cd[_0x38e6ef];return _0x55034c;};'use strict';var _=require(_0xd11c('0x0'));var util=require(_0xd11c('0x1'));var logger=require(_0xd11c('0x2'))(_0xd11c('0x3'));var moment=require(_0xd11c('0x4'));var BPromise=require('bluebird');var rp=require(_0xd11c('0x5'));var fs=require('fs');var path=require(_0xd11c('0x6'));var rimraf=require(_0xd11c('0x7'));var config=require(_0xd11c('0x8'));var attributes=require(_0xd11c('0x9'));module[_0xd11c('0xa')]=function(_0x4e7b8f,_0x795b6f){return _0x4e7b8f[_0xd11c('0xb')](_0xd11c('0xc'),attributes,{'tableName':_0xd11c('0xd'),'paranoid':![],'indexes':[{'name':_0xd11c('0xe'),'fields':[_0xd11c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 18caa71..f7f91ec 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 _0x9715=['stringify','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x29ce14,_0x334166){var _0x48f289=function(_0x288d11){while(--_0x288d11){_0x29ce14['push'](_0x29ce14['shift']());}};_0x48f289(++_0x334166);}(_0x9715,0xf6));var _0x5971=function(_0x97def9,_0x320c56){_0x97def9=_0x97def9-0x0;var _0x53c5ad=_0x9715[_0x97def9];return _0x53c5ad;};'use strict';var _=require(_0x5971('0x0'));var util=require(_0x5971('0x1'));var moment=require('moment');var BPromise=require(_0x5971('0x2'));var rs=require(_0x5971('0x3'));var fs=require('fs');var Redis=require(_0x5971('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5971('0x5'))(_0x5971('0x6'));var config=require(_0x5971('0x7'));var jayson=require(_0x5971('0x8'));var client=jayson['client'][_0x5971('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d350c,_0x25b21b,_0x18f885){return new BPromise(function(_0x38c112,_0x18e3f3){return client['request'](_0x2d350c,_0x18f885)['then'](function(_0x35a49c){logger[_0x5971('0xa')]('ChatTransferReport,\x20%s,\x20%s',_0x25b21b,_0x5971('0xb'));logger[_0x5971('0xc')](_0x5971('0xd'),_0x25b21b,'request\x20sent',JSON[_0x5971('0xe')](_0x35a49c));if(_0x35a49c[_0x5971('0xf')]){if(_0x35a49c[_0x5971('0xf')][_0x5971('0x10')]===0x1f4){logger['error'](_0x5971('0x11'),_0x25b21b,_0x35a49c['error'][_0x5971('0x12')]);return _0x18e3f3(_0x35a49c[_0x5971('0xf')][_0x5971('0x12')]);}logger[_0x5971('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x25b21b,_0x35a49c['error'][_0x5971('0x12')]);return _0x38c112(_0x35a49c['error'][_0x5971('0x12')]);}else{logger[_0x5971('0xa')](_0x5971('0x11'),_0x25b21b,_0x5971('0xb'));_0x38c112(_0x35a49c[_0x5971('0x13')][_0x5971('0x12')]);}})['catch'](function(_0x3baeef){logger[_0x5971('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x25b21b,_0x3baeef);_0x18e3f3(_0x3baeef);});});} \ No newline at end of file +var _0x0a17=['info','ChatTransferReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x1daec1,_0x28ade4){var _0xca1c74=function(_0x239267){while(--_0x239267){_0x1daec1['push'](_0x1daec1['shift']());}};_0xca1c74(++_0x28ade4);}(_0x0a17,0x130));var _0x70a1=function(_0x1867e7,_0x1770d3){_0x1867e7=_0x1867e7-0x0;var _0x28a6d6=_0x0a17[_0x1867e7];return _0x28a6d6;};'use strict';var _=require('lodash');var util=require(_0x70a1('0x0'));var moment=require(_0x70a1('0x1'));var BPromise=require('bluebird');var rs=require(_0x70a1('0x2'));var fs=require('fs');var Redis=require(_0x70a1('0x3'));var db=require(_0x70a1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x70a1('0x5'))(_0x70a1('0x6'));var config=require(_0x70a1('0x7'));var jayson=require(_0x70a1('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3fe00b,_0x35dd87,_0x1f2362){return new BPromise(function(_0x110a5e,_0x161755){return client[_0x70a1('0x9')](_0x3fe00b,_0x1f2362)[_0x70a1('0xa')](function(_0xfb00f9){logger[_0x70a1('0xb')](_0x70a1('0xc'),_0x35dd87,'request\x20sent');logger[_0x70a1('0xd')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x35dd87,'request\x20sent',JSON[_0x70a1('0xe')](_0xfb00f9));if(_0xfb00f9[_0x70a1('0xf')]){if(_0xfb00f9[_0x70a1('0xf')][_0x70a1('0x10')]===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x35dd87,_0xfb00f9[_0x70a1('0xf')][_0x70a1('0x11')]);return _0x161755(_0xfb00f9['error'][_0x70a1('0x11')]);}logger[_0x70a1('0xf')](_0x70a1('0xc'),_0x35dd87,_0xfb00f9['error']['message']);return _0x110a5e(_0xfb00f9[_0x70a1('0xf')][_0x70a1('0x11')]);}else{logger['info'](_0x70a1('0xc'),_0x35dd87,_0x70a1('0x12'));_0x110a5e(_0xfb00f9[_0x70a1('0x13')][_0x70a1('0x11')]);}})[_0x70a1('0x14')](function(_0x1a6642){logger[_0x70a1('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x35dd87,_0x1a6642);_0x161755(_0x1a6642);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index a71c33b..e5ff07b 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 _0xb10b=['../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x3b8774,_0x301a46){var _0x5bcfcc=function(_0x5d9d2f){while(--_0x5d9d2f){_0x3b8774['push'](_0x3b8774['shift']());}};_0x5bcfcc(++_0x301a46);}(_0xb10b,0x12a));var _0xbb10=function(_0x50a51e,_0x56e813){_0x50a51e=_0x50a51e-0x0;var _0x8a736e=_0xb10b[_0x50a51e];return _0x8a736e;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0xe')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0xf')]);router['put']('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router[_0xbb10('0x11')]('/:id',auth[_0xbb10('0x9')](),controller['destroy']);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x191154,_0x56f74c){var _0x3dcd73=function(_0x51c321){while(--_0x51c321){_0x191154['push'](_0x191154['shift']());}};_0x3dcd73(++_0x56f74c);}(_0xb10b,0x12a));var _0xbb10=function(_0x57d6c3,_0x5ac8b8){_0x57d6c3=_0x57d6c3-0x0;var _0x4c101c=_0xb10b[_0x57d6c3];return _0x4c101c;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0xe')]('/',auth[_0xbb10('0x9')](),controller[_0xbb10('0xf')]);router['put']('/:id',auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router[_0xbb10('0x11')]('/:id',auth[_0xbb10('0x9')](),controller['destroy']);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index a56eddd..971c940 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 _0xe222=['rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','thumb','input','name','text','getDataValue','parse','onlineForm','setDataValue','stringify','Comments','Leave\x20your\x20comments','offlineForm','generate','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.','website_alias','bottom_right','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN'];(function(_0x2344e2,_0x23dc54){var _0x3bc43e=function(_0x38ad01){while(--_0x38ad01){_0x2344e2['push'](_0x2344e2['shift']());}};_0x3bc43e(++_0x23dc54);}(_0xe222,0x18e));var _0x2e22=function(_0x2a4fe2,_0x3ec53a){_0x2a4fe2=_0x2a4fe2-0x0;var _0x225c4a=_0xe222[_0x2a4fe2];return _0x225c4a;};'use strict';var Sequelize=require(_0x2e22('0x0'));var rs=require('randomstring');module[_0x2e22('0x1')]={'name':{'type':Sequelize[_0x2e22('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x2e22('0x2')],'allowNull':![],'unique':_0x2e22('0x3')},'description':{'type':Sequelize[_0x2e22('0x2')]},'mapKey':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x4')},'mapKeyOffline':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x4')},'key':{'type':Sequelize[_0x2e22('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x5')},'customerAlias':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x2e22('0x2')],'allowNull':![],'defaultValue':_0x2e22('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x2e22('0x2')],'allowNull':![],'defaultValue':_0x2e22('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2e22('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x2e22('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x2e22('0x2')]},'animation':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x2e22('0xa'),_0x2e22('0xb')),'defaultValue':_0x2e22('0xa')},'header_online':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0xc')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x2e22('0xd')},'offline_chat_button':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0xe')},'header_offline':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0xf')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x2e22('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x2e22('0x11')]},'closingQuestion':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x14')},'noteTitle':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x15')},'closingMessage':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x16')},'closingMessageButton':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x17')},'conditionAgreement':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x18')},'ratingType':{'type':Sequelize[_0x2e22('0x19')]('star',_0x2e22('0x1a')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x2e22('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x2e22('0x11')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x2e22('0x1b'),'variable':null,'config':{'placeholder':_0x2e22('0x1c'),'type':_0x2e22('0x1d'),'required':!![]},'props':{'title':_0x2e22('0x1c'),'helpText':''}},{'type':_0x2e22('0x1b'),'props':{'title':_0x2e22('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x2e22('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x2e22('0x1e')]('onlineForm')?JSON[_0x2e22('0x1f')](this[_0x2e22('0x1e')](_0x2e22('0x20'))):{};},'set':function(_0x27f94b){return this[_0x2e22('0x21')](_0x2e22('0x20'),JSON['stringify'](_0x27f94b));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x2e22('0x22')]({'items':[{'type':_0x2e22('0x1b'),'props':{'title':_0x2e22('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x2e22('0x4'),'type':_0x2e22('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0x2e22('0x23')},'props':{'title':_0x2e22('0x23'),'helpText':_0x2e22('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0x2e22('0x1e')](_0x2e22('0x25'))?JSON[_0x2e22('0x1f')](this['getDataValue']('offlineForm')):{};},'set':function(_0x598bbf){return this[_0x2e22('0x21')](_0x2e22('0x25'),JSON[_0x2e22('0x22')](_0x598bbf));}},'token':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':function(){return rs[_0x2e22('0x26')]();}},'autoclose':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x2e22('0x2')]},'forwardOffline':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x2e22('0x2')]},'waitingTitle':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x27')},'offlineMessageSubject':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x28')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x2e22('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x2a')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x2e22('0x17')},'sendUnmanaged':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x2e22('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x2e22('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x2c')},'verticalAlignment':{'type':Sequelize[_0x2e22('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':_0x2e22('0x2d')},'defaultTitle':{'type':Sequelize[_0x2e22('0x2')]},'customerAvatar':{'type':Sequelize[_0x2e22('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x2e22('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x2e22('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2e22('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2e22('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x2e22('0x2e')},'systemAvatar':{'type':Sequelize[_0x2e22('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2e22('0x8')],'comment':_0x2e22('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![],'comment':_0x2e22('0x30'),'set':function(_0x48d4bb){if(!_0x48d4bb)this[_0x2e22('0x21')](_0x2e22('0x31'),null);this[_0x2e22('0x21')](_0x2e22('0x32'),_0x48d4bb);}},'vidaooEscalation':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x2e22('0x2')],'defaultValue':![]},'openNewInteraction':{'type':Sequelize[_0x2e22('0x9')],'defaultValue':![],'allowNull':!![]}}; \ No newline at end of file +var _0x2a2f=['Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','TEXT','stringify','input','text','name','getDataValue','onlineForm','parse','setDataValue','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','bottom_right','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','squared','We\x20are\x20here!','Send','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error'];(function(_0x1854b4,_0xf15fec){var _0x15854b=function(_0x2cad96){while(--_0x2cad96){_0x1854b4['push'](_0x1854b4['shift']());}};_0x15854b(++_0xf15fec);}(_0x2a2f,0x83));var _0xf2a2=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x2a2f[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xf2a2('0x0'));module[_0xf2a2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xf2a2('0x2')],'allowNull':![],'unique':_0xf2a2('0x3')},'description':{'type':Sequelize[_0xf2a2('0x2')]},'mapKey':{'type':Sequelize[_0xf2a2('0x2')],'defaultValue':_0xf2a2('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xf2a2('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xf2a2('0x2')],'defaultValue':_0xf2a2('0x5')},'customerAlias':{'type':Sequelize[_0xf2a2('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xf2a2('0x2')],'allowNull':![],'defaultValue':_0xf2a2('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xf2a2('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xf2a2('0x2')],'allowNull':![],'defaultValue':_0xf2a2('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xf2a2('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xf2a2('0x2')]},'animation':{'type':Sequelize[_0xf2a2('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xf2a2('0xa')]('rounded',_0xf2a2('0xb')),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xf2a2('0xc')},'start_chat_button':{'type':Sequelize[_0xf2a2('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xf2a2('0x2')],'defaultValue':_0xf2a2('0xd')},'header_offline':{'type':Sequelize[_0xf2a2('0x2')],'defaultValue':_0xf2a2('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xf2a2('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xf2a2('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xf2a2('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xf2a2('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xf2a2('0x2')],'defaultValue':_0xf2a2('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xf2a2('0x2')],'defaultValue':_0xf2a2('0x12')},'noteTitle':{'type':Sequelize[_0xf2a2('0x2')],'defaultValue':_0xf2a2('0x13')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xf2a2('0x14')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xf2a2('0x15')},'closingMessageButton':{'type':Sequelize[_0xf2a2('0x2')],'defaultValue':_0xf2a2('0xd')},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xf2a2('0x16')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xf2a2('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xf2a2('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xf2a2('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xf2a2('0x2')],'defaultValue':_0xf2a2('0x17')},'ratingType':{'type':Sequelize['ENUM'](_0xf2a2('0x18'),_0xf2a2('0x19')),'defaultValue':_0xf2a2('0x18')},'ratingStarsNumber':{'type':Sequelize[_0xf2a2('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xf2a2('0x1a')],'defaultValue':function(){return JSON[_0xf2a2('0x1b')]({'items':[{'type':_0xf2a2('0x1c'),'variable':null,'config':{'placeholder':'name','type':_0xf2a2('0x1d'),'required':!![]},'props':{'title':_0xf2a2('0x1e'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xf2a2('0x4'),'type':_0xf2a2('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xf2a2('0x1f')](_0xf2a2('0x20'))?JSON[_0xf2a2('0x21')](this[_0xf2a2('0x1f')](_0xf2a2('0x20'))):{};},'set':function(_0x34c03c){return this[_0xf2a2('0x22')]('onlineForm',JSON[_0xf2a2('0x1b')](_0x34c03c));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xf2a2('0x1b')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xf2a2('0x4'),'type':_0xf2a2('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0xf2a2('0x23')},'props':{'title':_0xf2a2('0x23'),'helpText':_0xf2a2('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0xf2a2('0x1f')](_0xf2a2('0x25'))?JSON[_0xf2a2('0x21')](this[_0xf2a2('0x1f')](_0xf2a2('0x25'))):{};},'set':function(_0x9a3f1b){return this['setDataValue'](_0xf2a2('0x25'),JSON[_0xf2a2('0x1b')](_0x9a3f1b));}},'token':{'type':Sequelize[_0xf2a2('0x2')],'defaultValue':function(){return rs[_0xf2a2('0x26')]();}},'autoclose':{'type':Sequelize[_0xf2a2('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf2a2('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xf2a2('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xf2a2('0x2')]},'forwardOffline':{'type':Sequelize[_0xf2a2('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xf2a2('0x2')],'defaultValue':_0xf2a2('0x27')},'waitingMessage':{'type':Sequelize[_0xf2a2('0x2')],'defaultValue':_0xf2a2('0x28')},'offlineMessageSubject':{'type':Sequelize[_0xf2a2('0x2')],'defaultValue':_0xf2a2('0x29')},'offlineMessageBody':{'type':Sequelize[_0xf2a2('0x2')],'defaultValue':_0xf2a2('0x2a')},'enableUnmanagedNote':{'type':Sequelize[_0xf2a2('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xf2a2('0x2')],'defaultValue':_0xf2a2('0x2b')},'skipUnmanaged':{'type':Sequelize[_0xf2a2('0x2')],'defaultValue':_0xf2a2('0x16')},'sendUnmanaged':{'type':Sequelize[_0xf2a2('0x2')],'defaultValue':_0xf2a2('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xf2a2('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xf2a2('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xf2a2('0x1a')]},'showAgentAvatar':{'type':Sequelize[_0xf2a2('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xf2a2('0x2')]},'notificationTemplate':{'type':Sequelize[_0xf2a2('0x1a')],'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':![]},'hideWhenOffline':{'type':Sequelize[_0xf2a2('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xf2a2('0x2')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xf2a2('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xf2a2('0x2c')},'verticalAlignment':{'type':Sequelize[_0xf2a2('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xf2a2('0x2')],'defaultValue':_0xf2a2('0x2d')},'defaultTitle':{'type':Sequelize[_0xf2a2('0x2')]},'customerAvatar':{'type':Sequelize[_0xf2a2('0x1a')]},'showCustomerAvatar':{'type':Sequelize[_0xf2a2('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xf2a2('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xf2a2('0x2')],'allowNull':![],'defaultValue':_0xf2a2('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf2a2('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf2a2('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xf2a2('0x2')],'defaultValue':_0xf2a2('0x2f')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xf2a2('0x9')],'defaultValue':![],'comment':_0xf2a2('0x30'),'set':function(_0x18d67e){if(!_0x18d67e)this[_0xf2a2('0x22')](_0xf2a2('0x31'),null);this[_0xf2a2('0x22')]('mandatoryDisposition',_0x18d67e);}},'vidaooEscalation':{'type':Sequelize[_0xf2a2('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xf2a2('0x2')],'defaultValue':![]},'openNewInteraction':{'type':Sequelize[_0xf2a2('0x9')],'defaultValue':![],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index e1fd530..00bcd30 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 _0x2c22=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','findOne','removeDispositions','ids','addAnswer','CannedAnswer','findAll','removeAnswers','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','systemAvatar','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','join','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','headers','user-agent','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','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','from','CmList','List','Contacts','DESC','ChatApplication','Applications','applications','asc','account','contact','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','browser','%s\x20%s','unknown','version','device','vendor','format','%s\x20%s\x20%s','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','messageId','created','push','*,*,*,*','ChatMessage','AttachmentId','User','UserId','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','notify','offline','from\x20is\x20mandatory','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','\x22%s\x22\x20<%s>','offlineMessageSubject','openNewInteraction','MailAccountId','email','Chat','NotifyMailAccount','addInteraction','omit','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','virtual','increment','chatLicenseExceeded','all','x-real-ip','remoteAddress','referer','replace','alignment','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','rimraf'];(function(_0x2215d0,_0x31abd5){var _0x3a0419=function(_0x5793dd){while(--_0x5793dd){_0x2215d0['push'](_0x2215d0['shift']());}};_0x3a0419(++_0x31abd5);}(_0x2c22,0x11b));var _0x22c2=function(_0x5f31fb,_0x5858e1){_0x5f31fb=_0x5f31fb-0x0;var _0x443e34=_0x2c22[_0x5f31fb];return _0x443e34;};'use strict';var pdf=require(_0x22c2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x22c2('0x1'));var zipdir=require(_0x22c2('0x2'));var jsonpatch=require(_0x22c2('0x3'));var rp=require(_0x22c2('0x4'));var moment=require(_0x22c2('0x5'));var BPromise=require(_0x22c2('0x6'));var Mustache=require(_0x22c2('0x7'));var util=require('util');var path=require(_0x22c2('0x8'));var sox=require(_0x22c2('0x9'));var csv=require(_0x22c2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x22c2('0xb'));var squel=require(_0x22c2('0xc'));var crypto=require(_0x22c2('0xd'));var jsforce=require(_0x22c2('0xe'));var deskjs=require(_0x22c2('0xf'));var toCsv=require(_0x22c2('0xa'));var querystring=require(_0x22c2('0x10'));var Papa=require('papaparse');var Redis=require(_0x22c2('0x11'));var authService=require(_0x22c2('0x12'));var qs=require(_0x22c2('0x13'));var as=require(_0x22c2('0x14'));var hardwareService=require(_0x22c2('0x15'));var logger=require(_0x22c2('0x16'))(_0x22c2('0x17'));var utils=require(_0x22c2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x22c2('0x19'));var db=require(_0x22c2('0x1a'))['db'];config[_0x22c2('0x1b')]=_[_0x22c2('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x22c2('0x1d'))(new Redis(config[_0x22c2('0x1b')]));require('./chatWebsite.socket')['register'](socket);var jayson=require(_0x22c2('0x1e'));var client=jayson[_0x22c2('0x1f')][_0x22c2('0x20')]({'port':0x232c});var client9002=jayson[_0x22c2('0x1f')][_0x22c2('0x20')]({'port':0x232a});var client9003=jayson[_0x22c2('0x1f')]['http']({'port':0x232b});var client9001=jayson[_0x22c2('0x1f')][_0x22c2('0x20')]({'port':0x2329});function respondWithRpcPromise(_0x3e80d0,_0x50f96e,_0x4b3b42,_0x39d23e){return new BPromise(function(_0x1f9093,_0x5830c5){var _0x2765b7=_0x39d23e||client;return _0x2765b7[_0x22c2('0x21')](_0x3e80d0,_0x4b3b42)['then'](function(_0x13bfca){logger[_0x22c2('0x22')](_0x22c2('0x23'),_0x50f96e,_0x22c2('0x24'));logger['debug'](_0x22c2('0x25'),_0x50f96e,'request\x20sent',JSON[_0x22c2('0x26')](_0x13bfca));if(_0x13bfca[_0x22c2('0x27')]){if(_0x13bfca[_0x22c2('0x27')]['code']===0x1f4){logger[_0x22c2('0x27')](_0x22c2('0x23'),_0x50f96e,_0x13bfca[_0x22c2('0x27')][_0x22c2('0x28')]);return _0x5830c5(_0x13bfca[_0x22c2('0x27')][_0x22c2('0x28')]);}logger[_0x22c2('0x27')](_0x22c2('0x23'),_0x50f96e,_0x13bfca[_0x22c2('0x27')][_0x22c2('0x28')]);return _0x1f9093(_0x13bfca[_0x22c2('0x27')][_0x22c2('0x28')]);}else{logger['info'](_0x22c2('0x23'),_0x50f96e,_0x22c2('0x24'));_0x1f9093(_0x13bfca[_0x22c2('0x29')][_0x22c2('0x28')]);}})[_0x22c2('0x2a')](function(_0x28af36){logger['error'](_0x22c2('0x23'),_0x50f96e,_0x28af36);_0x5830c5(_0x28af36);});});}function respondWithStatusCode(_0x332269,_0x446b89){_0x446b89=_0x446b89||0xcc;return function(_0x519f72){if(_0x519f72){return _0x332269[_0x22c2('0x2b')](_0x446b89);}return _0x332269[_0x22c2('0x2c')](_0x446b89)[_0x22c2('0x2d')]();};}function respondWithResult(_0x5b8a45,_0x4582aa){_0x4582aa=_0x4582aa||0xc8;return function(_0x2b0f2c){if(_0x2b0f2c){return _0x5b8a45[_0x22c2('0x2c')](_0x4582aa)[_0x22c2('0x2e')](_0x2b0f2c);}};}function respondWithFilteredResult(_0x224acf,_0x1b80f0){return function(_0x359633){if(_0x359633){var _0xda214=_0x359633[_0x22c2('0x2f')],_0x231918=_0x1b80f0[_0x22c2('0x30')],_0x44c40a=_0x1b80f0[_0x22c2('0x30')]+_0x1b80f0[_0x22c2('0x31')],_0x1627b6;if(_0x44c40a>=_0xda214){_0x44c40a=_0xda214;_0x1627b6=0xc8;}else{_0x1627b6=0xce;}_0x224acf[_0x22c2('0x2c')](_0x1627b6);return _0x224acf[_0x22c2('0x32')](_0x22c2('0x33'),_0x231918+'-'+_0x44c40a+'/'+_0xda214)[_0x22c2('0x2e')](_0x359633);}return null;};}function patchUpdates(_0x50825f){return function(_0x427f43){try{jsonpatch[_0x22c2('0x34')](_0x427f43,_0x50825f,!![]);}catch(_0x5af52f){return BPromise[_0x22c2('0x35')](_0x5af52f);}return _0x427f43[_0x22c2('0x36')]();};}function saveUpdates(_0x28782f,_0x55083c){return function(_0x2a5141){if(_0x2a5141){return _0x2a5141[_0x22c2('0x37')](_0x28782f)[_0x22c2('0x38')](function(_0x491e73){return _0x491e73;});}return null;};}function removeEntity(_0x4fcbc4,_0x230db3){return function(_0x1dc59d){if(_0x1dc59d){return _0x1dc59d[_0x22c2('0x39')]()[_0x22c2('0x38')](function(){var _0x58eaeb=_0x1dc59d[_0x22c2('0x3a')]({'plain':!![]});var _0x5158ca='ChatWebsites';return db[_0x22c2('0x3b')][_0x22c2('0x39')]({'where':{'type':_0x5158ca,'resourceId':_0x58eaeb['id']}})[_0x22c2('0x38')](function(){return _0x1dc59d;});})[_0x22c2('0x38')](function(){_0x4fcbc4[_0x22c2('0x2c')](0xcc)[_0x22c2('0x2d')]();});}};}function handleEntityNotFound(_0xc6b3fb,_0x45f32d){return function(_0x3e8fde){if(!_0x3e8fde){_0xc6b3fb['sendStatus'](0x194);}return _0x3e8fde;};}function handleError(_0x237275,_0x1eab30){_0x1eab30=_0x1eab30||0x1f4;return function(_0xe21254){logger[_0x22c2('0x27')](_0xe21254[_0x22c2('0x3c')]);if(_0xe21254[_0x22c2('0x3d')]){delete _0xe21254[_0x22c2('0x3d')];}_0x237275[_0x22c2('0x2c')](_0x1eab30)[_0x22c2('0x3e')](_0xe21254);};}exports[_0x22c2('0x3f')]=function(_0x2bd39a,_0x2b92f9){var _0xe6005d={'include':[{'model':db[_0x22c2('0x40')],'as':_0x22c2('0x41')}]},_0x5e2d85={},_0x409bd3={'count':0x0,'rows':[]};var _0x48af90=_[_0x22c2('0x42')](db[_0x22c2('0x43')][_0x22c2('0x44')],function(_0x5e2779){return{'name':_0x5e2779[_0x22c2('0x45')],'type':_0x5e2779[_0x22c2('0x46')]['key']};});_0x5e2d85[_0x22c2('0x47')]=_['map'](_0x48af90,'name');_0x5e2d85[_0x22c2('0x48')]=_[_0x22c2('0x49')](_0x2bd39a[_0x22c2('0x48')]);_0x5e2d85[_0x22c2('0x4a')]=_[_0x22c2('0x4b')](_0x5e2d85[_0x22c2('0x47')],_0x5e2d85[_0x22c2('0x48')]);_0xe6005d[_0x22c2('0x4c')]=_['intersection'](_0x5e2d85['model'],qs['fields'](_0x2bd39a[_0x22c2('0x48')][_0x22c2('0x4d')]));_0xe6005d[_0x22c2('0x4c')]=_0xe6005d[_0x22c2('0x4c')][_0x22c2('0x4e')]?_0xe6005d[_0x22c2('0x4c')]:_0x5e2d85[_0x22c2('0x47')];if(!_0x2bd39a[_0x22c2('0x48')][_0x22c2('0x4f')](_0x22c2('0x50'))){_0xe6005d['limit']=qs[_0x22c2('0x31')](_0x2bd39a[_0x22c2('0x48')][_0x22c2('0x31')]);_0xe6005d[_0x22c2('0x30')]=qs[_0x22c2('0x30')](_0x2bd39a[_0x22c2('0x48')][_0x22c2('0x30')]);}_0xe6005d[_0x22c2('0x51')]=qs['sort'](_0x2bd39a['query'][_0x22c2('0x52')]);_0xe6005d[_0x22c2('0x53')]=qs[_0x22c2('0x4a')](_[_0x22c2('0x54')](_0x2bd39a[_0x22c2('0x48')],_0x5e2d85[_0x22c2('0x4a')]),_0x48af90);if(_0x2bd39a['query'][_0x22c2('0x55')]){_0xe6005d[_0x22c2('0x53')]=_[_0x22c2('0x56')](_0xe6005d[_0x22c2('0x53')],{'$or':_[_0x22c2('0x42')](_0x48af90,function(_0xcb55c3){if(_0xcb55c3[_0x22c2('0x46')]!=='VIRTUAL'){var _0x39dcbe={};_0x39dcbe[_0xcb55c3['name']]={'$like':'%'+_0x2bd39a[_0x22c2('0x48')][_0x22c2('0x55')]+'%'};return _0x39dcbe;}})});}_0xe6005d=_[_0x22c2('0x56')]({},_0xe6005d,_0x2bd39a[_0x22c2('0x57')]);var _0x4d7d83={'where':_0xe6005d['where']};return db['ChatWebsite'][_0x22c2('0x2f')](_0x4d7d83)[_0x22c2('0x38')](function(_0x4e508d){_0x409bd3[_0x22c2('0x2f')]=_0x4e508d;if(_0x2bd39a[_0x22c2('0x48')][_0x22c2('0x58')]){_0xe6005d[_0x22c2('0x59')]=[{'all':!![]}];}return db[_0x22c2('0x43')]['findAll'](_0xe6005d);})[_0x22c2('0x38')](function(_0x7cd7b6){_0x409bd3[_0x22c2('0x5a')]=_0x7cd7b6;return _0x409bd3;})[_0x22c2('0x38')](respondWithFilteredResult(_0x2b92f9,_0xe6005d))[_0x22c2('0x2a')](handleError(_0x2b92f9,null));};exports['show']=function(_0x43980c,_0x409562){var _0x39f290={'raw':![],'where':{'id':_0x43980c[_0x22c2('0x5b')]['id']},'include':[{'model':db[_0x22c2('0x40')],'as':_0x22c2('0x41')}]},_0x58f440={};_0x58f440[_0x22c2('0x47')]=_[_0x22c2('0x49')](db[_0x22c2('0x43')][_0x22c2('0x44')]);_0x58f440[_0x22c2('0x48')]=_[_0x22c2('0x49')](_0x43980c['query']);_0x58f440[_0x22c2('0x4a')]=_[_0x22c2('0x4b')](_0x58f440[_0x22c2('0x47')],_0x58f440[_0x22c2('0x48')]);_0x39f290['attributes']=_[_0x22c2('0x4b')](_0x58f440[_0x22c2('0x47')],qs[_0x22c2('0x4d')](_0x43980c[_0x22c2('0x48')][_0x22c2('0x4d')]));_0x39f290['attributes']=_0x39f290[_0x22c2('0x4c')]['length']?_0x39f290[_0x22c2('0x4c')]:_0x58f440[_0x22c2('0x47')];if(_0x43980c['query'][_0x22c2('0x58')]){_0x39f290['include']=[{'all':!![]}];}_0x39f290=_[_0x22c2('0x56')]({},_0x39f290,_0x43980c[_0x22c2('0x57')]);return db[_0x22c2('0x43')][_0x22c2('0x5c')](_0x39f290)[_0x22c2('0x38')](handleEntityNotFound(_0x409562,null))[_0x22c2('0x38')](respondWithResult(_0x409562,null))[_0x22c2('0x2a')](handleError(_0x409562,null));};exports[_0x22c2('0x5d')]=function(_0x2b62e1,_0x568983){return db['ChatWebsite'][_0x22c2('0x5d')](_0x2b62e1[_0x22c2('0x5e')],{})[_0x22c2('0x38')](function(_0x177155){var _0x4a7261=_0x2b62e1[_0x22c2('0x5f')][_0x22c2('0x3a')]({'plain':!![]});if(!_0x4a7261)throw new Error(_0x22c2('0x60'));if(_0x4a7261[_0x22c2('0x61')]===_0x22c2('0x5f')){var _0x324449=_0x177155[_0x22c2('0x3a')]({'plain':!![]});var _0x392994=_0x22c2('0x62');return db[_0x22c2('0x63')]['find']({'where':{'name':_0x392994,'userProfileId':_0x4a7261['userProfileId']},'raw':!![]})[_0x22c2('0x38')](function(_0x418589){if(_0x418589&&_0x418589['autoAssociation']===0x0){return db[_0x22c2('0x3b')][_0x22c2('0x5d')]({'name':_0x324449['name'],'resourceId':_0x324449['id'],'type':_0x418589['name'],'sectionId':_0x418589['id']},{})[_0x22c2('0x38')](function(){return _0x177155;});}else{return _0x177155;}})[_0x22c2('0x2a')](function(_0x3f115f){logger[_0x22c2('0x27')](_0x22c2('0x64'),_0x3f115f);throw _0x3f115f;});}return _0x177155;})[_0x22c2('0x38')](respondWithResult(_0x568983,0xc9))[_0x22c2('0x2a')](handleError(_0x568983,null));};exports['update']=function(_0x53bd77,_0x3580ed){if(_0x53bd77['body']['id']){delete _0x53bd77['body']['id'];}return db[_0x22c2('0x43')]['find']({'where':{'id':_0x53bd77['params']['id']},'include':[{'model':db[_0x22c2('0x40')],'as':_0x22c2('0x41')}]})['then'](handleEntityNotFound(_0x3580ed,null))[_0x22c2('0x38')](saveUpdates(_0x53bd77['body'],null))[_0x22c2('0x38')](respondWithResult(_0x3580ed,null))[_0x22c2('0x2a')](handleError(_0x3580ed,null));};exports['destroy']=function(_0x57b321,_0x16bfa1){return db[_0x22c2('0x43')][_0x22c2('0x5c')]({'where':{'id':_0x57b321['params']['id']}})['then'](handleEntityNotFound(_0x16bfa1,null))[_0x22c2('0x38')](removeEntity(_0x16bfa1,null))['catch'](handleError(_0x16bfa1,null));};exports[_0x22c2('0x65')]=function(_0x1a91a7,_0x6ee5c4){return db[_0x22c2('0x43')][_0x22c2('0x65')]()[_0x22c2('0x38')](respondWithResult(_0x6ee5c4,null))[_0x22c2('0x2a')](handleError(_0x6ee5c4,null));};exports[_0x22c2('0x66')]=function(_0x465f47,_0x174509,_0x4edbd0){if(_0x465f47[_0x22c2('0x5e')]['id']){delete _0x465f47[_0x22c2('0x5e')]['id'];}return db[_0x22c2('0x43')][_0x22c2('0x5c')]({'where':{'id':_0x465f47[_0x22c2('0x5b')]['id']}})[_0x22c2('0x38')](handleEntityNotFound(_0x174509,null))[_0x22c2('0x38')](function(_0x4d6182){if(_0x4d6182){_0x465f47[_0x22c2('0x5e')][_0x22c2('0x67')]=_0x4d6182['id'];return db[_0x22c2('0x68')]['create'](_0x465f47[_0x22c2('0x5e')]);}})[_0x22c2('0x38')](respondWithResult(_0x174509,null))['catch'](handleError(_0x174509,null));};exports['getDispositions']=function(_0x222f59,_0x52592b,_0xd7f029){var _0x1e4076={'raw':![],'where':{}};var _0x5b5a0d={};var _0x3db567={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x22c2('0x69')]({'where':{'id':_0x222f59[_0x22c2('0x5b')]['id']}})['then'](handleEntityNotFound(_0x52592b,null))[_0x22c2('0x38')](function(_0xa85c6a){if(_0xa85c6a){_0x5b5a0d[_0x22c2('0x47')]=_[_0x22c2('0x49')](db[_0x22c2('0x68')][_0x22c2('0x44')]);_0x5b5a0d[_0x22c2('0x48')]=_[_0x22c2('0x49')](_0x222f59[_0x22c2('0x48')]);_0x5b5a0d[_0x22c2('0x4a')]=_['intersection'](_0x5b5a0d['model'],_0x5b5a0d[_0x22c2('0x48')]);_0x1e4076[_0x22c2('0x4c')]=_[_0x22c2('0x4b')](_0x5b5a0d[_0x22c2('0x47')],qs[_0x22c2('0x4d')](_0x222f59['query'][_0x22c2('0x4d')]));_0x1e4076[_0x22c2('0x4c')]=_0x1e4076[_0x22c2('0x4c')]['length']?_0x1e4076[_0x22c2('0x4c')]:_0x5b5a0d[_0x22c2('0x47')];if(!_0x222f59[_0x22c2('0x48')][_0x22c2('0x4f')](_0x22c2('0x50'))){_0x1e4076[_0x22c2('0x31')]=qs[_0x22c2('0x31')](_0x222f59[_0x22c2('0x48')][_0x22c2('0x31')]);_0x1e4076[_0x22c2('0x30')]=qs[_0x22c2('0x30')](_0x222f59[_0x22c2('0x48')]['offset']);}_0x1e4076[_0x22c2('0x51')]=qs[_0x22c2('0x52')](_0x222f59[_0x22c2('0x48')][_0x22c2('0x52')]);_0x1e4076['where']=qs[_0x22c2('0x4a')](_[_0x22c2('0x54')](_0x222f59[_0x22c2('0x48')],_0x5b5a0d[_0x22c2('0x4a')]));_0x1e4076[_0x22c2('0x53')][_0x22c2('0x67')]=_0xa85c6a['id'];if(_0x222f59[_0x22c2('0x48')]['filter']){_0x1e4076[_0x22c2('0x53')]=_['merge'](_0x1e4076[_0x22c2('0x53')],{'$or':_['map'](_0x1e4076[_0x22c2('0x4c')],function(_0x1b3e52){var _0x59478f={};_0x59478f[_0x1b3e52]={'$like':'%'+_0x222f59[_0x22c2('0x48')][_0x22c2('0x55')]+'%'};return _0x59478f;})});}_0x1e4076=_[_0x22c2('0x56')]({},_0x1e4076,_0x222f59['options']);return db[_0x22c2('0x68')][_0x22c2('0x2f')]({'where':_0x1e4076[_0x22c2('0x53')]})[_0x22c2('0x38')](function(_0x21c2d3){_0x3db567[_0x22c2('0x2f')]=_0x21c2d3;if(_0x222f59[_0x22c2('0x48')][_0x22c2('0x58')]){_0x1e4076[_0x22c2('0x59')]=[{'all':!![]}];}return db[_0x22c2('0x68')]['findAll'](_0x1e4076);})[_0x22c2('0x38')](function(_0x15a6b6){_0x3db567[_0x22c2('0x5a')]=_0x15a6b6;return _0x3db567;});}})[_0x22c2('0x38')](respondWithFilteredResult(_0x52592b,_0x1e4076))[_0x22c2('0x2a')](handleError(_0x52592b,null));};exports[_0x22c2('0x6a')]=function(_0x58223d,_0x49eb65,_0x3c77f5){return db['ChatWebsite'][_0x22c2('0x5c')]({'where':{'id':_0x58223d[_0x22c2('0x5b')]['id']}})[_0x22c2('0x38')](handleEntityNotFound(_0x49eb65,null))[_0x22c2('0x38')](function(_0x44930e){if(_0x44930e){return _0x44930e['removeDispositions'](_0x58223d[_0x22c2('0x48')][_0x22c2('0x6b')]);}})[_0x22c2('0x38')](respondWithStatusCode(_0x49eb65,null))[_0x22c2('0x2a')](handleError(_0x49eb65,null));};exports[_0x22c2('0x6c')]=function(_0x329bde,_0x9b6622,_0x863a42){if(_0x329bde['body']['id']){delete _0x329bde[_0x22c2('0x5e')]['id'];}return db[_0x22c2('0x43')]['find']({'where':{'id':_0x329bde[_0x22c2('0x5b')]['id']}})[_0x22c2('0x38')](handleEntityNotFound(_0x9b6622,null))[_0x22c2('0x38')](function(_0x4dcbcf){if(_0x4dcbcf){_0x329bde[_0x22c2('0x5e')][_0x22c2('0x67')]=_0x4dcbcf['id'];return db[_0x22c2('0x6d')][_0x22c2('0x5d')](_0x329bde[_0x22c2('0x5e')]);}})['then'](respondWithResult(_0x9b6622,null))[_0x22c2('0x2a')](handleError(_0x9b6622,null));};exports['getAnswers']=function(_0xfbdfda,_0x2f3323,_0x4cd4db){var _0x456e46={'raw':![],'where':{}};var _0x3eb34f={};var _0x757ea4={'count':0x0,'rows':[]};return db[_0x22c2('0x43')][_0x22c2('0x69')]({'where':{'id':_0xfbdfda[_0x22c2('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2f3323,null))[_0x22c2('0x38')](function(_0x3383e5){if(_0x3383e5){_0x3eb34f['model']=_['keys'](db[_0x22c2('0x6d')]['rawAttributes']);_0x3eb34f[_0x22c2('0x48')]=_[_0x22c2('0x49')](_0xfbdfda[_0x22c2('0x48')]);_0x3eb34f[_0x22c2('0x4a')]=_[_0x22c2('0x4b')](_0x3eb34f[_0x22c2('0x47')],_0x3eb34f['query']);_0x456e46[_0x22c2('0x4c')]=_[_0x22c2('0x4b')](_0x3eb34f[_0x22c2('0x47')],qs[_0x22c2('0x4d')](_0xfbdfda[_0x22c2('0x48')][_0x22c2('0x4d')]));_0x456e46[_0x22c2('0x4c')]=_0x456e46[_0x22c2('0x4c')][_0x22c2('0x4e')]?_0x456e46['attributes']:_0x3eb34f[_0x22c2('0x47')];if(!_0xfbdfda['query'][_0x22c2('0x4f')](_0x22c2('0x50'))){_0x456e46[_0x22c2('0x31')]=qs['limit'](_0xfbdfda[_0x22c2('0x48')][_0x22c2('0x31')]);_0x456e46[_0x22c2('0x30')]=qs[_0x22c2('0x30')](_0xfbdfda[_0x22c2('0x48')][_0x22c2('0x30')]);}_0x456e46[_0x22c2('0x51')]=qs[_0x22c2('0x52')](_0xfbdfda[_0x22c2('0x48')][_0x22c2('0x52')]);_0x456e46['where']=qs[_0x22c2('0x4a')](_[_0x22c2('0x54')](_0xfbdfda[_0x22c2('0x48')],_0x3eb34f['filters']));_0x456e46[_0x22c2('0x53')][_0x22c2('0x67')]=_0x3383e5['id'];if(_0xfbdfda['query'][_0x22c2('0x55')]){_0x456e46['where']=_[_0x22c2('0x56')](_0x456e46[_0x22c2('0x53')],{'$or':_[_0x22c2('0x42')](_0x456e46[_0x22c2('0x4c')],function(_0x3731b1){var _0x6e82a7={};_0x6e82a7[_0x3731b1]={'$like':'%'+_0xfbdfda['query'][_0x22c2('0x55')]+'%'};return _0x6e82a7;})});}_0x456e46=_[_0x22c2('0x56')]({},_0x456e46,_0xfbdfda[_0x22c2('0x57')]);return db[_0x22c2('0x6d')][_0x22c2('0x2f')]({'where':_0x456e46[_0x22c2('0x53')]})[_0x22c2('0x38')](function(_0x293f40){_0x757ea4[_0x22c2('0x2f')]=_0x293f40;if(_0xfbdfda[_0x22c2('0x48')][_0x22c2('0x58')]){_0x456e46[_0x22c2('0x59')]=[{'all':!![]}];}return db['CannedAnswer'][_0x22c2('0x6e')](_0x456e46);})[_0x22c2('0x38')](function(_0x4bc4a4){_0x757ea4[_0x22c2('0x5a')]=_0x4bc4a4;return _0x757ea4;});}})['then'](respondWithFilteredResult(_0x2f3323,_0x456e46))[_0x22c2('0x2a')](handleError(_0x2f3323,null));};exports[_0x22c2('0x6f')]=function(_0x15182c,_0x47b300,_0xf1e6ea){return db[_0x22c2('0x43')][_0x22c2('0x5c')]({'where':{'id':_0x15182c['params']['id']}})[_0x22c2('0x38')](handleEntityNotFound(_0x47b300,null))[_0x22c2('0x38')](function(_0x20da68){if(_0x20da68){return _0x20da68[_0x22c2('0x6f')](_0x15182c['query'][_0x22c2('0x6b')]);}})[_0x22c2('0x38')](respondWithStatusCode(_0x47b300,null))[_0x22c2('0x2a')](handleError(_0x47b300,null));};exports['addLogo']=function(_0xcff1e1,_0x3b50e5,_0x322d01){_0xcff1e1[_0x22c2('0x5e')][_0x22c2('0x70')]=_0xcff1e1['file'][_0x22c2('0x71')];return db[_0x22c2('0x43')]['find']({'where':{'id':_0xcff1e1['params']['id']}})['then'](handleEntityNotFound(_0x3b50e5,null))[_0x22c2('0x38')](saveUpdates(_0xcff1e1[_0x22c2('0x5e')],null))[_0x22c2('0x38')](respondWithResult(_0x3b50e5,null))[_0x22c2('0x2a')](handleError(_0x3b50e5,null));};exports[_0x22c2('0x72')]=function(_0x549a37,_0x8c4a98,_0x3ac7d5){_0x549a37[_0x22c2('0x5e')][_0x22c2('0x73')]=_0x549a37[_0x22c2('0x74')][_0x22c2('0x71')];return db['ChatWebsite'][_0x22c2('0x5c')]({'where':{'id':_0x549a37[_0x22c2('0x5b')]['id']}})[_0x22c2('0x38')](handleEntityNotFound(_0x8c4a98,null))['then'](saveUpdates(_0x549a37[_0x22c2('0x5e')],null))[_0x22c2('0x38')](respondWithResult(_0x8c4a98,null))['catch'](handleError(_0x8c4a98,null));};exports[_0x22c2('0x75')]=function(_0x2d2d6f,_0x390889,_0x5d24ab){_0x2d2d6f[_0x22c2('0x5e')]['customerAvatar']=_0x2d2d6f['file'][_0x22c2('0x71')];return db[_0x22c2('0x43')][_0x22c2('0x5c')]({'where':{'id':_0x2d2d6f['params']['id']}})['then'](handleEntityNotFound(_0x390889,null))[_0x22c2('0x38')](saveUpdates(_0x2d2d6f[_0x22c2('0x5e')],null))[_0x22c2('0x38')](respondWithResult(_0x390889,null))[_0x22c2('0x2a')](handleError(_0x390889,null));};exports['addSystemAvatar']=function(_0x477aae,_0x2b04be,_0x5e32cc){_0x477aae[_0x22c2('0x5e')][_0x22c2('0x76')]=_0x477aae['file'][_0x22c2('0x71')];return db['ChatWebsite'][_0x22c2('0x5c')]({'where':{'id':_0x477aae['params']['id']}})['then'](handleEntityNotFound(_0x2b04be,null))[_0x22c2('0x38')](saveUpdates(_0x477aae['body'],null))[_0x22c2('0x38')](respondWithResult(_0x2b04be,null))[_0x22c2('0x2a')](handleError(_0x2b04be,null));};exports['getLogo']=function(_0x520a8f,_0x494822,_0x1b9227){var _0x19bac6=path['join'](config[_0x22c2('0x77')],_0x22c2('0x78'));var _0x3447ef={'where':{'id':_0x520a8f[_0x22c2('0x5b')]['id']},'attributes':['id',_0x22c2('0x70')],'raw':!![]};var _0x5465d6=![];return require(_0x22c2('0x19'))[_0x22c2('0x79')]()[_0x22c2('0x38')](function(_0x941e8d){if(_0x941e8d){_0x5465d6=_0x941e8d[_0x22c2('0x7a')];}})[_0x22c2('0x38')](function(){return db['ChatWebsite'][_0x22c2('0x5c')](_0x3447ef);})[_0x22c2('0x38')](handleEntityNotFound(_0x494822,null))[_0x22c2('0x38')](function(_0x3384ab){if(_0x3384ab){if(!_[_0x22c2('0x7b')](_0x3384ab[_0x22c2('0x70')])){if(fs['existsSync'](path[_0x22c2('0x7c')](config[_0x22c2('0x77')],_0x22c2('0x7d'),_0x3384ab[_0x22c2('0x70')]))&&_0x5465d6){_0x19bac6=path['join'](config['root'],_0x22c2('0x7d'),_0x3384ab[_0x22c2('0x70')]);}}return _0x494822[_0x22c2('0x7e')](_0x19bac6);}})[_0x22c2('0x2a')](handleError(_0x494822,null));};exports[_0x22c2('0x7f')]=function(_0x258044,_0x5a44e4,_0x374c5f){var _0x5f3938=path[_0x22c2('0x7c')](config['root'],_0x22c2('0x80'));var _0x2ddacc={'where':{'id':_0x258044[_0x22c2('0x5b')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x22c2('0x43')][_0x22c2('0x5c')](_0x2ddacc)['then'](handleEntityNotFound(_0x5a44e4,null))[_0x22c2('0x38')](function(_0x4412bd){if(_0x4412bd){if(!_[_0x22c2('0x7b')](_0x4412bd[_0x22c2('0x73')])){if(fs[_0x22c2('0x81')](path[_0x22c2('0x7c')](config[_0x22c2('0x77')],_0x22c2('0x82'),_0x4412bd[_0x22c2('0x73')]))){_0x5f3938=path[_0x22c2('0x7c')](config[_0x22c2('0x77')],'server/files/images/avatars/',_0x4412bd[_0x22c2('0x73')]);}}return _0x5a44e4[_0x22c2('0x7e')](_0x5f3938);}})[_0x22c2('0x2a')](handleError(_0x5a44e4,null));};exports[_0x22c2('0x83')]=function(_0x2024e7,_0x56e16b,_0x330d22){var _0x2bf9c0=path[_0x22c2('0x7c')](config[_0x22c2('0x77')],_0x22c2('0x84'));var _0x525371={'where':{'id':_0x2024e7[_0x22c2('0x5b')]['id']},'attributes':['id',_0x22c2('0x85'),_0x22c2('0x86')],'raw':!![]};return db['ChatWebsite']['find'](_0x525371)['then'](handleEntityNotFound(_0x56e16b,null))[_0x22c2('0x38')](function(_0xf357b6){if(_0xf357b6){if(!_[_0x22c2('0x7b')](_0xf357b6[_0x22c2('0x85')])){if(fs[_0x22c2('0x81')](path[_0x22c2('0x7c')](config['root'],_0x22c2('0x82'),_0xf357b6[_0x22c2('0x85')]))&&_0xf357b6['showCustomerAvatar']){_0x2bf9c0=path[_0x22c2('0x7c')](config[_0x22c2('0x77')],_0x22c2('0x82'),_0xf357b6[_0x22c2('0x85')]);}}return _0x56e16b[_0x22c2('0x7e')](_0x2bf9c0);}})[_0x22c2('0x2a')](handleError(_0x56e16b,null));};exports['getSystemAvatar']=function(_0x1d8fec,_0xef9a81,_0x29b81d){var _0x118e70=path[_0x22c2('0x7c')](config[_0x22c2('0x77')],_0x22c2('0x87'));var _0x57d5c6={'where':{'id':_0x1d8fec[_0x22c2('0x5b')]['id']},'attributes':['id',_0x22c2('0x76')],'raw':!![]};return db[_0x22c2('0x43')][_0x22c2('0x5c')](_0x57d5c6)[_0x22c2('0x38')](handleEntityNotFound(_0xef9a81,null))['then'](function(_0xcff25a){if(_0xcff25a){if(!_[_0x22c2('0x7b')](_0xcff25a[_0x22c2('0x76')])){if(fs[_0x22c2('0x81')](path[_0x22c2('0x7c')](config[_0x22c2('0x77')],_0x22c2('0x82'),_0xcff25a['systemAvatar']))){_0x118e70=path[_0x22c2('0x7c')](config['root'],_0x22c2('0x82'),_0xcff25a[_0x22c2('0x76')]);}}return _0xef9a81[_0x22c2('0x7e')](_0x118e70);}})[_0x22c2('0x2a')](handleError(_0xef9a81,null));};exports['notify']=function(_0x45a8c0,_0x456ce3,_0x29f9b7){var _0x5c8569=require('user-agent-parser');var _0x3e0ad8=new _0x5c8569();var _0x3bfcf6=_0x3e0ad8['setUA'](_0x45a8c0[_0x22c2('0x88')][_0x22c2('0x89')])['getResult']();var _0x327a65={'body':_0x45a8c0['body'],'channel':_0x22c2('0x8a')};var _0x54a918=[];var _0x30d7eb=[];var _0x266b36={};var _0xfb17c2=![];return db[_0x22c2('0x8b')][_0x22c2('0x65')]()[_0x22c2('0x38')](function(_0x4ba223){if(!_0x4ba223){throw new db[(_0x22c2('0x8c'))][(_0x22c2('0x8d'))](_0x22c2('0x8e'));}_0x54a918=_[_0x22c2('0x8f')](_[_0x22c2('0x49')](_0x4ba223),['createdAt','updatedAt']);_0x30d7eb=_['difference'](_[_0x22c2('0x49')](_0x4ba223),[_0x22c2('0x90'),_0x22c2('0x91'),_0x22c2('0x92'),_0x22c2('0x93')]);if(_0x45a8c0[_0x22c2('0x5e')]['id']){delete _0x45a8c0[_0x22c2('0x5e')]['id'];}if(_['isNil'](_0x45a8c0[_0x22c2('0x5e')]['from'])){throw new db['Sequelize'][(_0x22c2('0x8d'))]('from\x20is\x20mandatory');}if(_[_0x22c2('0x7b')](_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0x5e')])||_0x45a8c0['body'][_0x22c2('0x5e')]===''){throw new db[(_0x22c2('0x8c'))][(_0x22c2('0x8d'))](_0x22c2('0x94'));}if(_['isNil'](_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0x95')])){throw new db[(_0x22c2('0x8c'))][(_0x22c2('0x8d'))](_0x22c2('0x96')+_0x30d7eb);}if(!_[_0x22c2('0x97')](_0x30d7eb,_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0x95')])){throw new db[(_0x22c2('0x8c'))][(_0x22c2('0x8d'))](_0x22c2('0x98')+_0x30d7eb);}_0x266b36[_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0x95')]]=_0x45a8c0['body'][_0x22c2('0x99')];})['then'](function(){return db[_0x22c2('0x43')][_0x22c2('0x5c')]({'where':{'id':_0x45a8c0['params']['id']},'include':[{'model':db[_0x22c2('0x9a')],'as':_0x22c2('0x9b'),'include':[{'model':db[_0x22c2('0x8b')],'as':_0x22c2('0x9c'),'where':_0x266b36,'limit':0x1,'order':[[_0x22c2('0x91'),_0x22c2('0x9d')]]}]},{'model':db[_0x22c2('0x9e')],'as':_0x22c2('0x9f')}]});})[_0x22c2('0x38')](handleEntityNotFound(_0x456ce3,null))['then'](function(_0x2318a6){if(_0x2318a6&&_0x2318a6['List']){_0x327a65['account']=_0x2318a6;_0x327a65['applications']=_0x2318a6[_0x22c2('0x9f')];_0x327a65['list']=_0x2318a6[_0x22c2('0x9b')];_0x327a65['applications']=_['orderBy'](_0x327a65[_0x22c2('0xa0')],['priority'],[_0x22c2('0xa1')]);if(_0x327a65[_0x22c2('0xa2')][_0x22c2('0x9f')]){delete _0x327a65[_0x22c2('0xa2')][_0x22c2('0x9f')];}if(_0x327a65[_0x22c2('0xa2')][_0x22c2('0x9b')]&&_0x327a65['account'][_0x22c2('0x9b')][_0x22c2('0x9c')][_0x22c2('0x4e')]){return _0x327a65[_0x22c2('0xa2')][_0x22c2('0x9b')][_0x22c2('0x9c')][0x0];}var _0x3b4f9e=_[_0x22c2('0x1c')](_0x45a8c0['body'],{'firstName':_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0x99')],'ListId':_0x2318a6[_0x22c2('0x93')]});_0x3b4f9e[_0x45a8c0['body'][_0x22c2('0x95')]]=_0x45a8c0[_0x22c2('0x5e')]['from'];return db[_0x22c2('0x8b')][_0x22c2('0x5d')](_0x3b4f9e,{'fields':_0x54a918,'raw':!![]});}})[_0x22c2('0x38')](handleEntityNotFound(_0x456ce3,null))[_0x22c2('0x38')](function(_0x28685f){_0x327a65[_0x22c2('0xa3')]=_0x28685f;var _0x297389=_0x45a8c0[_0x22c2('0x5e')]['customerIp'];if(_0x45a8c0['headers']['cf-connecting-ip']){_0x297389=_0x45a8c0[_0x22c2('0x88')][_0x22c2('0xa4')];}else if(_0x45a8c0[_0x22c2('0x88')][_0x22c2('0xa5')]){_0x297389=_['first'](_0x45a8c0[_0x22c2('0x88')]['x-forwarded-for'][_0x22c2('0xa6')](','));}if(_0x28685f){var _0x435428={'ContactId':_0x28685f['id'],'ChatWebsiteId':_0x45a8c0['params']['id'],'from':(_0x28685f[_0x22c2('0xa7')]||'')+'\x20'+(_0x28685f[_0x22c2('0xa8')]||''),'customerIp':_0x297389,'customerPort':_0x45a8c0[_0x22c2('0x88')][_0x22c2('0xa9')]?_0x45a8c0[_0x22c2('0x88')][_0x22c2('0xa9')]:null,'referer':_0x45a8c0[_0x22c2('0x5e')]['referer'],'browserName':_0x3bfcf6[_0x22c2('0xaa')][_0x22c2('0x3d')]&&_0x3bfcf6[_0x22c2('0xaa')]['version']?util['format'](_0x22c2('0xab'),_0x3bfcf6[_0x22c2('0xaa')]['name'],_0x3bfcf6[_0x22c2('0xaa')]['version']):_0x22c2('0xac'),'browserVersion':_0x3bfcf6['browser'][_0x22c2('0xad')]||'unknown','osName':util['format']('%s\x20%s',_0x3bfcf6['os'][_0x22c2('0x3d')],_0x3bfcf6['os']['version']),'osVersion':_0x3bfcf6['os'][_0x22c2('0xad')],'deviceModel':_0x3bfcf6[_0x22c2('0xae')]['model']&&_0x3bfcf6['device'][_0x22c2('0xaf')]?util[_0x22c2('0xb0')](_0x22c2('0xb1'),_0x3bfcf6['device'][_0x22c2('0x47')],_0x3bfcf6[_0x22c2('0xae')][_0x22c2('0xaf')],_0x3bfcf6[_0x22c2('0xae')]['type']):null,'deviceVendor':_0x3bfcf6[_0x22c2('0xae')][_0x22c2('0xaf')],'deviceType':_0x3bfcf6[_0x22c2('0xae')][_0x22c2('0x46')],'formData':JSON[_0x22c2('0x26')](_0x45a8c0[_0x22c2('0x5e')])};var _0x5e6897={'ChatWebsiteId':_0x45a8c0['params']['id'],'closed':![]};if(_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0xb2')]){_0x5e6897[_0x22c2('0xb2')]=_0x45a8c0['body'][_0x22c2('0xb2')];return db['ChatInteraction'][_0x22c2('0x5c')]({'where':_0x5e6897})[_0x22c2('0x38')](function(_0x4a816c){if(_0x4a816c){return[_0x4a816c,![]];}_0x435428[_0x22c2('0xb2')]=_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0xb2')];_0x435428[_0x22c2('0xb3')]=_0x45a8c0['body'][_0x22c2('0xb3')];return db[_0x22c2('0xb4')][_0x22c2('0x5d')](_0x435428)[_0x22c2('0x38')](function(_0x3f3347){return[_0x3f3347,!![]];});});}_0x5e6897[_0x22c2('0xb5')]=_0x28685f['id'];if(_0x45a8c0['body']['interaction']&&_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0xb6')]['id']){_0x5e6897['id']=_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0xb6')]['id'];return db[_0x22c2('0xb4')][_0x22c2('0x5c')]({'where':_0x5e6897})[_0x22c2('0x38')](function(_0xe0aa4a){if(_0xe0aa4a){return[_0xe0aa4a,![]];}return db['ChatInteraction']['create'](_0x435428)['then'](function(_0x5bb079){return[_0x5bb079,!![]];});});}return db['ChatInteraction']['create'](_0x435428)[_0x22c2('0x38')](function(_0x46daa3){return[_0x46daa3,!![]];});}})[_0x22c2('0xb7')](function(_0x310f7c,_0x30663b){if(_0x310f7c){_0xfb17c2=_0x30663b;if(!_0x30663b){var _0x551189={'from':(_0x327a65[_0x22c2('0xa3')][_0x22c2('0xa7')]||'')+'\x20'+(_0x327a65[_0x22c2('0xa3')]['lastName']||'')};if(_0x45a8c0['body'][_0x22c2('0xb2')]&&_0x45a8c0[_0x22c2('0x5e')]['messageId']&&_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0xb2')]!=_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0xb8')]){_0x551189[_0x22c2('0xb2')]=_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0xb8')];}return _0x310f7c[_0x22c2('0x37')](_0x551189);}else{return _0x310f7c;}}})[_0x22c2('0x38')](function(_0x14b024){_0x327a65[_0x22c2('0xb6')]=_0x14b024['get']({'plain':!![]});_0x327a65[_0x22c2('0xb6')][_0x22c2('0xb9')]=_0xfb17c2;if(_0x327a65[_0x22c2('0xb6')][_0x22c2('0xb9')]){if(_0x327a65[_0x22c2('0xa2')]['autoclose']){_0x327a65[_0x22c2('0xa0')][_0x22c2('0xba')]({'id':0x0,'priority':_0x327a65['applications'][_0x22c2('0x4e')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x22c2('0xbb')});}}return db[_0x22c2('0xbc')][_0x22c2('0x5d')]({'body':_0x45a8c0[_0x22c2('0x5e')]['body'],'ChatWebsiteId':_0x45a8c0['params']['id'],'ChatInteractionId':_0x14b024['id'],'direction':'in','ContactId':_0x327a65[_0x22c2('0xa3')]['id'],'AttachmentId':_0x45a8c0[_0x22c2('0x5e')][_0x22c2('0xbd')]});})[_0x22c2('0x38')](function(_0x164533){_0x327a65[_0x22c2('0x28')]=_0x164533;if(_0x327a65[_0x22c2('0xb6')]['UserId']){return db[_0x22c2('0xbe')][_0x22c2('0x5c')]({'attributes':['id',_0x22c2('0x3d')],'where':{'id':_0x327a65[_0x22c2('0xb6')][_0x22c2('0xbf')]}})[_0x22c2('0x38')](function(_0x42655d){if(_0x42655d){_0x327a65[_0x22c2('0xa0')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x42655d[_0x22c2('0x3d')]+','+(_0x327a65[_0x22c2('0xa2')][_0x22c2('0xc0')]||0xa),'interval':_0x22c2('0xbb')});_0x327a65[_0x22c2('0xc1')]=!![];}return respondWithRpcPromise('Start',_0x22c2('0xc2'),_0x327a65);});}return respondWithRpcPromise(_0x22c2('0xc3'),_0x22c2('0xc2'),_0x327a65);})[_0x22c2('0x38')](function(_0x32b1b0){respondWithRpcPromise(_0x22c2('0xc4'),'EventManager',{'event':_0x22c2('0xc5'),'message':_0x32b1b0},client9002);return _0x32b1b0;})[_0x22c2('0x38')](respondWithResult(_0x456ce3,null))[_0x22c2('0x2a')](handleError(_0x456ce3,null));};exports[_0x22c2('0xc6')]=function(_0x42d662,_0x5ae98c,_0x2dd21e){var _0x4d7937,_0x2d941e,_0x5d384b;var _0x45609=[];var _0x270a17=[];var _0x4ff0b7={};return db[_0x22c2('0x8b')]['describe']()[_0x22c2('0x38')](function(_0x2bf348){if(!_0x2bf348){throw new db[(_0x22c2('0x8c'))][(_0x22c2('0x8d'))](_0x22c2('0x8e'));}_0x270a17=_['difference'](_[_0x22c2('0x49')](_0x2bf348),['createdAt',_0x22c2('0x91')]);_0x45609=_[_0x22c2('0x8f')](_[_0x22c2('0x49')](_0x2bf348),[_0x22c2('0x90'),_0x22c2('0x91'),_0x22c2('0x92'),_0x22c2('0x93')]);if(_0x42d662[_0x22c2('0x5e')]['id']){delete _0x42d662[_0x22c2('0x5e')]['id'];}if(_[_0x22c2('0x7b')](_0x42d662['body']['from'])){throw _0x5ae98c['status'](0x1f4)[_0x22c2('0x3e')](new db[(_0x22c2('0x8c'))][(_0x22c2('0x8d'))](_0x22c2('0xc7')));}if(_[_0x22c2('0x7b')](_0x42d662[_0x22c2('0x5e')][_0x22c2('0x5e')])||_0x42d662[_0x22c2('0x5e')][_0x22c2('0x5e')]===''){throw _0x5ae98c['status'](0x1f4)[_0x22c2('0x3e')](new db[(_0x22c2('0x8c'))][(_0x22c2('0x8d'))](_0x22c2('0x94')));}if(_['isNil'](_0x42d662[_0x22c2('0x5e')]['mapKeyOffline'])){throw _0x5ae98c[_0x22c2('0x2c')](0x1f4)['send'](new db['Sequelize'][(_0x22c2('0x8d'))](_0x22c2('0xc8')+_0x45609));}if(!_['includes'](_0x45609,_0x42d662[_0x22c2('0x5e')][_0x22c2('0xc9')])){throw _0x5ae98c[_0x22c2('0x2c')](0x1f4)[_0x22c2('0x3e')](new db[(_0x22c2('0x8c'))][(_0x22c2('0x8d'))](_0x22c2('0xca')+_0x45609));}_0x4ff0b7[_0x42d662[_0x22c2('0x5e')]['mapKeyOffline']]=_0x42d662['body'][_0x22c2('0x99')];})[_0x22c2('0x38')](function(){return db[_0x22c2('0x43')][_0x22c2('0x5c')]({'where':{'id':_0x42d662[_0x22c2('0x5b')]['id']},'include':[{'model':db[_0x22c2('0x9a')],'as':_0x22c2('0x9b')},{'model':db[_0x22c2('0xcb')],'as':_0x22c2('0xcb')}]});})[_0x22c2('0x38')](handleEntityNotFound(_0x5ae98c,null))[_0x22c2('0x38')](function(_0xe28210){if(_0xe28210&&_0xe28210[_0x22c2('0x9b')]){_0x2d941e=_0xe28210;var _0x4a1213=_[_0x22c2('0x1c')](_0x42d662[_0x22c2('0x5e')],{'firstName':_0x42d662['body']['from'],'phone':_0x42d662[_0x22c2('0x5e')][_0x22c2('0x99')],'ListId':_0xe28210[_0x22c2('0x93')]});_0x4a1213[_0x42d662['body'][_0x22c2('0xc9')]]=_0x42d662[_0x22c2('0x5e')][_0x22c2('0x99')];return db[_0x22c2('0x8b')][_0x22c2('0xcc')]({'where':_0x4ff0b7,'defaults':_0x4a1213});}})['spread'](function(_0x5445db){if(_0x5445db){_0x5d384b=_0x5445db;var _0x5e67af=fs[_0x22c2('0xcd')](path[_0x22c2('0x7c')](config['root'],_0x22c2('0xce')),_0x22c2('0xcf'));var _0x30ca82=ejs[_0x22c2('0xd0')](_0x5e67af,{'body':_['toPairs'](_0x42d662[_0x22c2('0x5e')][_0x22c2('0x5e')]),'bodyTitle':_0x2d941e[_0x22c2('0xd1')]});return db['ChatOfflineMessage'][_0x22c2('0x5d')]({'body':_0x30ca82,'ContactId':_0x5445db['id'],'ChatWebsiteId':_0x2d941e['id']});}})['then'](function(_0x410b6d){if(_0x410b6d){_0x4d7937=_0x410b6d;return db[_0x22c2('0xcb')][_0x22c2('0x69')]({'where':{'service':!![]},'include':[{'model':db[_0x22c2('0xd2')],'as':_0x22c2('0xd3'),'raw':!![]}]});}})[_0x22c2('0x38')](function(_0x1d39d9){if(_0x1d39d9&&_0x1d39d9[_0x22c2('0xd3')]&&_0x2d941e['forwardOffline']&&_0x2d941e[_0x22c2('0xd4')]){var _0x3370e9={'tls':{'rejectUnauthorized':![]}};if(_0x1d39d9[_0x22c2('0xd3')][_0x22c2('0xd5')]){_0x3370e9[_0x22c2('0xd5')]=_0x1d39d9[_0x22c2('0xd3')][_0x22c2('0xd5')];}else{_0x3370e9['host']=_0x1d39d9['Smtp'][_0x22c2('0xd6')];_0x3370e9[_0x22c2('0xd7')]=_0x1d39d9[_0x22c2('0xd3')][_0x22c2('0xd7')];_0x3370e9[_0x22c2('0xd8')]=_0x1d39d9[_0x22c2('0xd3')][_0x22c2('0xd8')];}if(_0x1d39d9[_0x22c2('0xd3')][_0x22c2('0xd9')]){_0x3370e9[_0x22c2('0xda')]={'user':_0x1d39d9[_0x22c2('0xd3')]['user'],'pass':_0x1d39d9[_0x22c2('0xd3')][_0x22c2('0xdb')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x3370e9,'message':{'from':util['format'](_0x22c2('0xdc'),_0x1d39d9[_0x22c2('0x3d')],_0x1d39d9['email']||_0x1d39d9[_0x22c2('0xd3')][_0x22c2('0x5f')]),'to':_0x2d941e[_0x22c2('0xd4')],'subject':_0x2d941e[_0x22c2('0xdd')],'text':_0x4d7937[_0x22c2('0x5e')]}},client9003)[_0x22c2('0x38')](function(){return _0x4d7937;})[_0x22c2('0x2a')](function(_0x10fdd7){console['error'](_0x10fdd7);});}})[_0x22c2('0x38')](function(){if(_0x2d941e&&_0x2d941e[_0x22c2('0xde')]&&_0x2d941e[_0x22c2('0xdf')]){var _0x1987c9={'from':_0x5d384b[_0x22c2('0xe0')],'firstName':_0x5d384b['firstName'],'lastName':_0x5d384b[_0x22c2('0xa8')],'mapKey':_0x22c2('0xe0'),'message':{'from':_0x5d384b[_0x22c2('0xe0')],'to':_0x2d941e['MailAccount'][_0x22c2('0xe0')],'cc':'','subject':_0x2d941e['offlineMessageSubject'],'messageId':'','sentAt':new Date(),'attach':![],'attachments':[],'originChannel':_0x22c2('0xe1'),'ChatWebsiteId':_0x2d941e['id'],'ChatOfflineMessageId':_0x4d7937['id'],'originTo':_0x2d941e[_0x22c2('0xcb')][_0x22c2('0xe0')]},'body':_0x4d7937['body']};var _0x48a6dd={'account':{'id':_0x2d941e[_0x22c2('0xdf')]},'body':_0x1987c9,'log':_0x22c2('0xe2')};return respondWithRpcPromise(_0x22c2('0xe2'),'notifyMail',_0x48a6dd,client9001)[_0x22c2('0x38')](function(){return _0x4d7937;})[_0x22c2('0x2a')](function(_0x3c22f9){console[_0x22c2('0x27')](_0x3c22f9);});}return;})[_0x22c2('0x38')](function(){if(_0x4d7937){return _0x4d7937;}})[_0x22c2('0x38')](respondWithResult(_0x5ae98c,null))[_0x22c2('0x2a')](handleError(_0x5ae98c,null));};exports[_0x22c2('0xe3')]=function(_0x2c78c1,_0x3e0f9e,_0x99a895){return db[_0x22c2('0xb4')][_0x22c2('0x5c')]({'where':{'id':_0x2c78c1['params']['id']}})[_0x22c2('0x38')](handleEntityNotFound(_0x3e0f9e,null))[_0x22c2('0x38')](function(_0x8bdda){if(_0x8bdda){return _0x8bdda[_0x22c2('0xe3')](_0x2c78c1[_0x22c2('0x5e')][_0x22c2('0x6b')],_[_0x22c2('0xe4')](_0x2c78c1[_0x22c2('0x5e')],['ids','id'])||{});}})['then'](respondWithResult(_0x3e0f9e,null))['catch'](handleError(_0x3e0f9e,null));};exports[_0x22c2('0xe5')]=function(_0x4e20a4,_0xae121,_0x6cd174){var _0x14a2d1={'raw':![],'where':{}};var _0x47a6c5={};var _0x18b456={'count':0x0,'rows':[]};return db[_0x22c2('0x43')]['findOne']({'where':{'id':_0x4e20a4['params']['id']}})['then'](handleEntityNotFound(_0xae121,null))[_0x22c2('0x38')](function(_0x3d132b){if(_0x3d132b){_0x47a6c5[_0x22c2('0x47')]=_[_0x22c2('0x49')](db[_0x22c2('0xb4')][_0x22c2('0x44')]);_0x47a6c5['query']=_[_0x22c2('0x49')](_0x4e20a4[_0x22c2('0x48')]);_0x47a6c5['filters']=_[_0x22c2('0x4b')](_0x47a6c5[_0x22c2('0x47')],_0x47a6c5[_0x22c2('0x48')]);_0x14a2d1[_0x22c2('0x4c')]=_[_0x22c2('0x4b')](_0x47a6c5[_0x22c2('0x47')],qs[_0x22c2('0x4d')](_0x4e20a4[_0x22c2('0x48')]['fields']));_0x14a2d1[_0x22c2('0x4c')]=_0x14a2d1[_0x22c2('0x4c')]['length']?_0x14a2d1[_0x22c2('0x4c')]:_0x47a6c5[_0x22c2('0x47')];if(!_0x4e20a4['query'][_0x22c2('0x4f')]('nolimit')){_0x14a2d1['limit']=qs[_0x22c2('0x31')](_0x4e20a4['query'][_0x22c2('0x31')]);_0x14a2d1[_0x22c2('0x30')]=qs['offset'](_0x4e20a4[_0x22c2('0x48')]['offset']);}_0x14a2d1[_0x22c2('0x51')]=qs[_0x22c2('0x52')](_0x4e20a4[_0x22c2('0x48')]['sort']);_0x14a2d1[_0x22c2('0x53')]=qs['filters'](_[_0x22c2('0x54')](_0x4e20a4['query'],_0x47a6c5['filters']));_0x14a2d1[_0x22c2('0x53')]['ChatWebsiteId']=_0x3d132b['id'];if(_0x4e20a4[_0x22c2('0x48')][_0x22c2('0x55')]){_0x14a2d1[_0x22c2('0x53')]=_[_0x22c2('0x56')](_0x14a2d1['where'],{'$or':_[_0x22c2('0x42')](_0x14a2d1[_0x22c2('0x4c')],function(_0x4ac7c8){var _0x32b86e={};_0x32b86e[_0x4ac7c8]={'$like':'%'+_0x4e20a4[_0x22c2('0x48')][_0x22c2('0x55')]+'%'};return _0x32b86e;})});}_0x14a2d1=_[_0x22c2('0x56')]({},_0x14a2d1,_0x4e20a4[_0x22c2('0x57')]);return db['ChatInteraction'][_0x22c2('0x2f')]({'where':_0x14a2d1['where']})[_0x22c2('0x38')](function(_0x3958cc){_0x18b456[_0x22c2('0x2f')]=_0x3958cc;if(_0x4e20a4[_0x22c2('0x48')][_0x22c2('0x58')]){_0x14a2d1[_0x22c2('0x59')]=[{'model':db[_0x22c2('0x8b')],'as':_0x22c2('0xe6'),'required':![]},{'model':db[_0x22c2('0xbe')],'as':_0x22c2('0xe7'),'attributes':[_0x22c2('0x3d'),'fullname',_0x22c2('0xe8')],'required':![]},{'model':db[_0x22c2('0xe9')],'as':_0x22c2('0xea'),'attributes':['id',_0x22c2('0x3d'),_0x22c2('0xeb')],'where':_0x4e20a4[_0x22c2('0x48')][_0x22c2('0xec')]?{'id':_0x4e20a4[_0x22c2('0x48')]['tag']}:undefined,'required':_0x4e20a4['query']['tag']?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x14a2d1);})['then'](function(_0x136cb4){_0x18b456[_0x22c2('0x5a')]=_0x136cb4;return _0x18b456;});}})[_0x22c2('0x38')](respondWithFilteredResult(_0xae121,_0x14a2d1))[_0x22c2('0x2a')](handleError(_0xae121,null));};function iftimePromise(_0x29fb19,_0x4a327d){return respondWithRpcPromise(_0x22c2('0xed'),_0x22c2('0xee'),{'command':_0x4a327d[_0x22c2('0xef')]?util[_0x22c2('0xb0')]('iftime\x20%s,%s',_0x29fb19[_0x22c2('0xf0')],_0x4a327d[_0x22c2('0xef')]):util[_0x22c2('0xb0')]('iftime\x20%s',_0x29fb19[_0x22c2('0xf0')])},client9002)[_0x22c2('0x38')](function(_0x142f39){var _0x3737fd=_0x142f39&&_0x142f39[_0x22c2('0xf1')](_0x22c2('0xf2'))>=0x0?!![]:![];logger[_0x22c2('0x22')](_0x22c2('0xf3'),_0x4a327d['id'],_0x29fb19['id'],_0x29fb19[_0x22c2('0xf0')],_0x3737fd?_0x22c2('0xf4'):_0x22c2('0xf5'),_0x4a327d[_0x22c2('0xef')]?_0x4a327d[_0x22c2('0xef')]:_0x22c2('0xf6'));return _0x3737fd;})[_0x22c2('0x2a')](function(_0x2076b3){logger[_0x22c2('0x27')](_0x22c2('0xf3'),_0x4a327d['id'],_0x29fb19['id'],_0x29fb19['interval'],util[_0x22c2('0xf7')](_0x2076b3,{'showHidden':![],'depth':null}),_0x4a327d[_0x22c2('0xef')]?_0x4a327d[_0x22c2('0xef')]:'No\x20timezone');return![];});}exports[_0x22c2('0xee')]=function(_0x5b7857,_0x5c4112,_0x3e7218){var _0x49cdf2=0x0;var _0x21f2c9=0x0;var _0x926b04=![];var _0x34a488;var _0x53cf39;return db[_0x22c2('0x43')]['find']({'where':{'id':_0x5b7857[_0x22c2('0x5b')]['id']},'include':[{'model':db[_0x22c2('0xf8')],'as':'Interval','include':[{'model':db[_0x22c2('0xf8')],'as':_0x22c2('0xf9'),'attributes':['id',_0x22c2('0xf0')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x5c4112,null))[_0x22c2('0x38')](function(_0x1718cf){if(_0x1718cf){_0x34a488=_0x1718cf;return _0x1718cf['getProactiveActions']({'raw':!![]});}})[_0x22c2('0x38')](function(_0x2ecf3e){if(_0x34a488){if(_0x2ecf3e){_0x53cf39=_0x2ecf3e;}}return require(_0x22c2('0x19'))[_0x22c2('0x79')]();})[_0x22c2('0x38')](function(_0x20c6d0){if(_0x20c6d0){_0x21f2c9=_0x20c6d0[_0x22c2('0xfa')];_0x926b04=_0x20c6d0[_0x22c2('0x7a')];}})[_0x22c2('0x38')](function(){return db[_0x22c2('0xb4')][_0x22c2('0x2f')]({'where':{'closed':![]}});})[_0x22c2('0x38')](function(_0x27a2a6){_0x49cdf2=_0x27a2a6;if(_0x21f2c9&&_0x27a2a6>_0x21f2c9){return db['License'][_0x22c2('0x69')]({'where':{'id':0x1}})[_0x22c2('0x38')](function(_0x4a7970){if(_0x4a7970){_0x4a7970[_0x22c2('0xfb')](_0x22c2('0xfc'));}});}})[_0x22c2('0x38')](function(){if(_0x34a488[_0x22c2('0xf8')]&&_0x34a488[_0x22c2('0xf8')][_0x22c2('0xf9')]){var _0x1cc6f8=[];for(var _0x197fe7=0x0;_0x197fe7<_0x34a488['Interval'][_0x22c2('0xf9')][_0x22c2('0x4e')];_0x197fe7++){var _0x199b80=_0x34a488[_0x22c2('0xf8')][_0x22c2('0xf9')][_0x197fe7][_0x22c2('0x3a')]({'plain':!![]});_0x1cc6f8[_0x22c2('0xba')](iftimePromise(_0x199b80,_0x34a488));}return BPromise[_0x22c2('0xfd')](_0x1cc6f8)[_0x22c2('0x38')](function(_0x29b3e5){return _['some'](_0x29b3e5);});}else{return!![];}})['then'](function(_0x57047f){var _0x293f0f=fs['readFileSync'](path[_0x22c2('0x7c')](config['root'],'server/files/chat/iframe.js'),_0x22c2('0xcf'));var _0x26eb76={'remote':_0x34a488['remote'],'query':querystring[_0x22c2('0x26')](_[_0x22c2('0x56')](_0x34a488[_0x22c2('0x3a')]({'plain':!![]}),{'customerIp':_0x5b7857['headers'][_0x22c2('0xa5')]||_0x5b7857['headers'][_0x22c2('0xfe')]||_0x5b7857['connection'][_0x22c2('0xff')]||_0x5b7857['ip'],'referer':_0x5b7857[_0x22c2('0x88')][_0x22c2('0x100')],'openedInteractions':_0x49cdf2,'maxInteractions':_0x21f2c9,'virtual':_0x926b04[_0x22c2('0xfa')],'online':_0x57047f,'custom':_0x926b04}))[_0x22c2('0x101')](/'/g,'\x5c\x27')};_0x5c4112[_0x22c2('0x3e')](ejs[_0x22c2('0xd0')](Mustache[_0x22c2('0xd0')](_0x293f0f,_0x26eb76),{'proactiveActions':_0x53cf39,'alignment':_0x34a488[_0x22c2('0x102')],'verticalAlignment':_0x34a488['verticalAlignment'],'div_color':_0x34a488[_0x22c2('0xeb')],'text_color':_0x34a488['textColor']}));})[_0x22c2('0x2a')](handleError(_0x5c4112,null));};exports[_0x22c2('0x103')]=function(_0x1665ed,_0x55ba93,_0x2cbbc0){return db[_0x22c2('0x43')][_0x22c2('0x69')]({'where':{'id':_0x1665ed['params']['id']}})[_0x22c2('0x38')](handleEntityNotFound(_0x55ba93,null))[_0x22c2('0x38')](function(_0x2b647b){if(_0x2b647b){return db[_0x22c2('0x104')][_0x22c2('0x105')](function(_0x45af77){return db[_0x22c2('0x9e')][_0x22c2('0x39')]({'where':{'ChatWebsiteId':_0x1665ed['params']['id']},'transaction':_0x45af77})[_0x22c2('0x38')](function(_0x9f816e){var _0x5e8239=_[_0x22c2('0x42')](_0x1665ed['body'],function(_0x4af954){_0x4af954[_0x22c2('0x67')]=_0x1665ed[_0x22c2('0x5b')]['id'];return _0x4af954;});return db[_0x22c2('0x9e')][_0x22c2('0x106')](_0x5e8239,{'transaction':_0x45af77});});})[_0x22c2('0x38')](function(){return db[_0x22c2('0x9e')][_0x22c2('0x107')]({'where':{'ChatWebsiteId':_0x1665ed[_0x22c2('0x5b')]['id']},'order':_0x22c2('0x108')});});}})[_0x22c2('0x38')](respondWithResult(_0x55ba93,null))[_0x22c2('0x2a')](handleError(_0x55ba93,null));};exports['getApplications']=function(_0x5857e0,_0x3143ab,_0x68a643){var _0x4e98ca={};var _0x3d65d6={};var _0x1440fd;var _0x1f6535;return db[_0x22c2('0x43')][_0x22c2('0x69')]({'where':{'id':_0x5857e0[_0x22c2('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3143ab,null))[_0x22c2('0x38')](function(_0x38aa7b){if(_0x38aa7b){_0x1440fd=_0x38aa7b;_0x3d65d6[_0x22c2('0x47')]=_[_0x22c2('0x49')](db[_0x22c2('0x9e')][_0x22c2('0x44')]);_0x3d65d6[_0x22c2('0x48')]=_['keys'](_0x5857e0[_0x22c2('0x48')]);_0x3d65d6[_0x22c2('0x4a')]=_[_0x22c2('0x4b')](_0x3d65d6[_0x22c2('0x47')],_0x3d65d6[_0x22c2('0x48')]);_0x4e98ca[_0x22c2('0x4c')]=_[_0x22c2('0x4b')](_0x3d65d6[_0x22c2('0x47')],qs[_0x22c2('0x4d')](_0x5857e0[_0x22c2('0x48')][_0x22c2('0x4d')]));_0x4e98ca[_0x22c2('0x4c')]=_0x4e98ca[_0x22c2('0x4c')][_0x22c2('0x4e')]?_0x4e98ca[_0x22c2('0x4c')]:_0x3d65d6[_0x22c2('0x47')];_0x4e98ca['order']=qs[_0x22c2('0x52')](_0x5857e0[_0x22c2('0x48')][_0x22c2('0x52')]);_0x4e98ca[_0x22c2('0x53')]=qs[_0x22c2('0x4a')](_[_0x22c2('0x54')](_0x5857e0['query'],_0x3d65d6['filters']));if(_0x5857e0[_0x22c2('0x48')][_0x22c2('0x55')]){_0x4e98ca['where']=_[_0x22c2('0x56')](_0x4e98ca[_0x22c2('0x53')],{'$or':_['map'](_0x4e98ca[_0x22c2('0x4c')],function(_0x39b58a){var _0x2be230={};_0x2be230[_0x39b58a]={'$like':'%'+_0x5857e0[_0x22c2('0x48')][_0x22c2('0x55')]+'%'};return _0x2be230;})});}_0x4e98ca=_['merge']({},_0x4e98ca,_0x5857e0[_0x22c2('0x57')]);return _0x1440fd[_0x22c2('0x109')](_0x4e98ca);}})[_0x22c2('0x38')](function(_0xf598a0){if(_0xf598a0){_0x1f6535=_0xf598a0[_0x22c2('0x4e')];if(!_0x5857e0[_0x22c2('0x48')][_0x22c2('0x4f')](_0x22c2('0x50'))){_0x4e98ca[_0x22c2('0x31')]=qs[_0x22c2('0x31')](_0x5857e0[_0x22c2('0x48')]['limit']);_0x4e98ca[_0x22c2('0x30')]=qs[_0x22c2('0x30')](_0x5857e0['query'][_0x22c2('0x30')]);}return _0x1440fd['getApplications'](_0x4e98ca);}})['then'](function(_0x1e922d){if(_0x1e922d){return _0x1e922d?{'count':_0x1f6535,'rows':_0x1e922d}:null;}})[_0x22c2('0x38')](respondWithResult(_0x3143ab,null))[_0x22c2('0x2a')](handleError(_0x3143ab,null));};exports[_0x22c2('0x10a')]=function(_0x3a9c28,_0x127ea9,_0x4b121c){return db[_0x22c2('0x10b')]['find']({'where':{'id':_0x3a9c28[_0x22c2('0x5b')]['id']}})['then'](handleEntityNotFound(_0x127ea9,null))[_0x22c2('0x38')](function(_0x4de5f6){if(_0x4de5f6){return _0x4de5f6[_0x22c2('0x10a')](_0x3a9c28[_0x22c2('0x5e')][_0x22c2('0x6b')],_[_0x22c2('0xe4')](_0x3a9c28['body'],[_0x22c2('0x6b'),'id'])||{});}})['then'](respondWithResult(_0x127ea9,null))[_0x22c2('0x2a')](handleError(_0x127ea9,null));};exports[_0x22c2('0x10c')]=function(_0x5de2d5,_0x282d03,_0x2f77f0){var _0x5b11ce={};var _0xffe093={};var _0x36f7a6;var _0x3664a0;return db[_0x22c2('0x43')][_0x22c2('0x69')]({'where':{'id':_0x5de2d5['params']['id']}})['then'](handleEntityNotFound(_0x282d03,null))[_0x22c2('0x38')](function(_0x4e1374){if(_0x4e1374){_0x36f7a6=_0x4e1374;_0xffe093[_0x22c2('0x47')]=_[_0x22c2('0x49')](db[_0x22c2('0x10d')][_0x22c2('0x44')]);_0xffe093[_0x22c2('0x48')]=_['keys'](_0x5de2d5[_0x22c2('0x48')]);_0xffe093['filters']=_[_0x22c2('0x4b')](_0xffe093['model'],_0xffe093[_0x22c2('0x48')]);_0x5b11ce[_0x22c2('0x4c')]=_[_0x22c2('0x4b')](_0xffe093[_0x22c2('0x47')],qs[_0x22c2('0x4d')](_0x5de2d5[_0x22c2('0x48')][_0x22c2('0x4d')]));_0x5b11ce[_0x22c2('0x4c')]=_0x5b11ce[_0x22c2('0x4c')][_0x22c2('0x4e')]?_0x5b11ce[_0x22c2('0x4c')]:_0xffe093['model'];_0x5b11ce[_0x22c2('0x51')]=qs[_0x22c2('0x52')](_0x5de2d5[_0x22c2('0x48')][_0x22c2('0x52')]);_0x5b11ce[_0x22c2('0x53')]=qs[_0x22c2('0x4a')](_[_0x22c2('0x54')](_0x5de2d5[_0x22c2('0x48')],_0xffe093[_0x22c2('0x4a')]));if(_0x5de2d5[_0x22c2('0x48')][_0x22c2('0x55')]){_0x5b11ce[_0x22c2('0x53')]=_[_0x22c2('0x56')](_0x5b11ce[_0x22c2('0x53')],{'$or':_[_0x22c2('0x42')](_0x5b11ce['attributes'],function(_0x45466d){var _0x4a682c={};_0x4a682c[_0x45466d]={'$like':'%'+_0x5de2d5[_0x22c2('0x48')]['filter']+'%'};return _0x4a682c;})});}_0x5b11ce=_[_0x22c2('0x56')]({},_0x5b11ce,_0x5de2d5[_0x22c2('0x57')]);return _0x36f7a6['getProactiveActions'](_0x5b11ce);}})[_0x22c2('0x38')](function(_0x24da51){if(_0x24da51){_0x3664a0=_0x24da51['length'];if(!_0x5de2d5[_0x22c2('0x48')][_0x22c2('0x4f')](_0x22c2('0x50'))){_0x5b11ce[_0x22c2('0x31')]=qs[_0x22c2('0x31')](_0x5de2d5['query'][_0x22c2('0x31')]);_0x5b11ce['offset']=qs['offset'](_0x5de2d5['query']['offset']);}return _0x36f7a6[_0x22c2('0x10c')](_0x5b11ce);}})[_0x22c2('0x38')](function(_0x1a7aa5){if(_0x1a7aa5){return _0x1a7aa5?{'count':_0x3664a0,'rows':_0x1a7aa5}:null;}})[_0x22c2('0x38')](respondWithResult(_0x282d03,null))[_0x22c2('0x2a')](handleError(_0x282d03,null));};exports[_0x22c2('0x10e')]=function(_0x15cd2f,_0x229fe6,_0xd918e5){var _0x1d58fd=_0x15cd2f[_0x22c2('0x48')][_0x22c2('0x10f')]===_0x22c2('0x110')?_0x22c2('0x111'):_0x22c2('0x112');return db['ChatWebsite'][_0x22c2('0x5c')]({'attributes':['id',_0x1d58fd],'where':{'id':_0x15cd2f[_0x22c2('0x5b')]['id']}})['then'](handleEntityNotFound(_0x229fe6,null))[_0x22c2('0x38')](function(_0x5b7c39){if(_0x5b7c39){var _0x1a5938=_0x5b7c39[_0x1d58fd];var _0x1b4f77=_0x1a5938&&_0x1a5938[_0x22c2('0x113')]?_0x1a5938[_0x22c2('0x113')]:[];_0x229fe6[_0x22c2('0x3e')]({'fromKey':_[_0x22c2('0x7b')](_0x1a5938[_0x22c2('0x114')])?undefined:_0x1a5938[_0x22c2('0x114')],'count':_0x1b4f77['length'],'rows':_0x1b4f77});}})[_0x22c2('0x2a')](handleError(_0x229fe6,null));};exports[_0x22c2('0x115')]=function(_0x5690fa,_0x330505,_0x3c3bf2){var _0x3a91b3={'raw':![],'where':{}};var _0x27279b={};var _0x59f493={'count':0x0,'rows':[]};return db[_0x22c2('0x43')][_0x22c2('0x69')]({'where':{'id':_0x5690fa[_0x22c2('0x5b')]['id']}})['then'](handleEntityNotFound(_0x330505,null))['then'](function(_0x4ab795){if(_0x4ab795){_0x27279b[_0x22c2('0x47')]=_[_0x22c2('0x49')](db[_0x22c2('0x116')][_0x22c2('0x44')]);_0x27279b[_0x22c2('0x48')]=_[_0x22c2('0x49')](_0x5690fa[_0x22c2('0x48')]);_0x27279b[_0x22c2('0x4a')]=_[_0x22c2('0x4b')](_0x27279b[_0x22c2('0x47')],_0x27279b[_0x22c2('0x48')]);_0x3a91b3['attributes']=_[_0x22c2('0x4b')](_0x27279b['model'],qs[_0x22c2('0x4d')](_0x5690fa[_0x22c2('0x48')][_0x22c2('0x4d')]));_0x3a91b3[_0x22c2('0x4c')]=_0x3a91b3[_0x22c2('0x4c')][_0x22c2('0x4e')]?_0x3a91b3[_0x22c2('0x4c')]:_0x27279b[_0x22c2('0x47')];if(!_0x5690fa[_0x22c2('0x48')][_0x22c2('0x4f')](_0x22c2('0x50'))){_0x3a91b3[_0x22c2('0x31')]=qs[_0x22c2('0x31')](_0x5690fa[_0x22c2('0x48')][_0x22c2('0x31')]);_0x3a91b3['offset']=qs['offset'](_0x5690fa[_0x22c2('0x48')][_0x22c2('0x30')]);}_0x3a91b3[_0x22c2('0x51')]=qs[_0x22c2('0x52')](_0x5690fa['query'][_0x22c2('0x52')]);_0x3a91b3['where']=qs[_0x22c2('0x4a')](_['pick'](_0x5690fa[_0x22c2('0x48')],_0x27279b[_0x22c2('0x4a')]));_0x3a91b3[_0x22c2('0x53')][_0x22c2('0x67')]=_0x4ab795['id'];if(_0x5690fa[_0x22c2('0x48')][_0x22c2('0x55')]){_0x3a91b3[_0x22c2('0x53')]=_[_0x22c2('0x56')](_0x3a91b3[_0x22c2('0x53')],{'$or':_[_0x22c2('0x42')](_0x3a91b3[_0x22c2('0x4c')],function(_0x7801b3){var _0x46d353={};_0x46d353[_0x7801b3]={'$like':'%'+_0x5690fa['query'][_0x22c2('0x55')]+'%'};return _0x46d353;})});}_0x3a91b3=_['merge']({},_0x3a91b3,_0x5690fa[_0x22c2('0x57')]);return db['ChatOfflineMessage'][_0x22c2('0x2f')]({'where':_0x3a91b3[_0x22c2('0x53')]})[_0x22c2('0x38')](function(_0x177807){_0x59f493[_0x22c2('0x2f')]=_0x177807;if(_0x5690fa['query'][_0x22c2('0x58')]){_0x3a91b3['include']=[{'all':!![]}];}else{_0x3a91b3[_0x22c2('0x59')]=[{'model':db[_0x22c2('0x8b')],'as':_0x22c2('0xe6'),'required':![]}];}return db[_0x22c2('0x116')]['findAll'](_0x3a91b3);})[_0x22c2('0x38')](function(_0x3ec43f){_0x59f493['rows']=_0x3ec43f;return _0x59f493;});}})[_0x22c2('0x38')](respondWithFilteredResult(_0x330505,_0x3a91b3))[_0x22c2('0x2a')](handleError(_0x330505,null));};exports[_0x22c2('0x117')]=function(_0x517694,_0x1049e2,_0x4eb694){return db[_0x22c2('0x43')][_0x22c2('0x5c')]({'where':{'id':_0x517694[_0x22c2('0x5b')]['id']}})[_0x22c2('0x38')](handleEntityNotFound(_0x1049e2,null))[_0x22c2('0x38')](function(_0x2c1f93){if(_0x2c1f93){return _0x2c1f93[_0x22c2('0x117')](_0x517694[_0x22c2('0x5e')][_0x22c2('0x6b')],_[_0x22c2('0xe4')](_0x517694[_0x22c2('0x5e')],[_0x22c2('0x6b'),'id'])||{})['spread'](function(_0x4de7cc){for(var _0x149114=0x0;_0x149114<_0x517694['body'][_0x22c2('0x6b')][_0x22c2('0x4e')];_0x149114+=0x1){socket[_0x22c2('0x118')]('userChatWebsite:save',{'UserId':_0x517694['body'][_0x22c2('0x6b')][_0x149114],'ChatWebsiteId':_0x517694[_0x22c2('0x5b')]['id']});}return _0x4de7cc;});}})[_0x22c2('0x38')](respondWithResult(_0x1049e2,null))[_0x22c2('0x2a')](handleError(_0x1049e2,null));};exports[_0x22c2('0x119')]=function(_0x396779,_0x4f3f77,_0x2c1421){return db['ChatWebsite'][_0x22c2('0x5c')]({'where':{'id':_0x396779[_0x22c2('0x5b')]['id']}})[_0x22c2('0x38')](handleEntityNotFound(_0x4f3f77,null))['then'](function(_0x266e4a){if(_0x266e4a){return _0x266e4a[_0x22c2('0x119')](_0x396779['query'][_0x22c2('0x6b')])['then'](function(){if(_[_0x22c2('0x11a')](_0x396779[_0x22c2('0x48')][_0x22c2('0x6b')])){for(var _0x4cddc1=0x0;_0x4cddc1<_0x396779[_0x22c2('0x48')][_0x22c2('0x6b')][_0x22c2('0x4e')];_0x4cddc1+=0x1){socket[_0x22c2('0x118')](_0x22c2('0x11b'),{'UserId':Number(_0x396779[_0x22c2('0x48')][_0x22c2('0x6b')][_0x4cddc1]),'ChatWebsiteId':Number(_0x396779[_0x22c2('0x5b')]['id'])});}}else{socket[_0x22c2('0x118')](_0x22c2('0x11b'),{'UserId':Number(_0x396779[_0x22c2('0x48')][_0x22c2('0x6b')]),'ChatWebsiteId':Number(_0x396779['params']['id'])});}});}})[_0x22c2('0x38')](respondWithStatusCode(_0x4f3f77,null))[_0x22c2('0x2a')](handleError(_0x4f3f77,null));};exports[_0x22c2('0x11c')]=function(_0x2cc5ca,_0x188ea1,_0x486660){var _0x2008d3={};var _0x154a53={};var _0x4832cf;var _0x351464;return db[_0x22c2('0x43')][_0x22c2('0x69')]({'where':{'id':_0x2cc5ca[_0x22c2('0x5b')]['id']}})[_0x22c2('0x38')](handleEntityNotFound(_0x188ea1,null))[_0x22c2('0x38')](function(_0x16b52e){if(_0x16b52e){_0x4832cf=_0x16b52e;_0x154a53[_0x22c2('0x47')]=_[_0x22c2('0x49')](db[_0x22c2('0xbe')][_0x22c2('0x44')]);_0x154a53[_0x22c2('0x48')]=_[_0x22c2('0x49')](_0x2cc5ca[_0x22c2('0x48')]);_0x154a53[_0x22c2('0x4a')]=_[_0x22c2('0x4b')](_0x154a53[_0x22c2('0x47')],_0x154a53[_0x22c2('0x48')]);_0x2008d3['attributes']=_[_0x22c2('0x4b')](_0x154a53[_0x22c2('0x47')],qs[_0x22c2('0x4d')](_0x2cc5ca[_0x22c2('0x48')][_0x22c2('0x4d')]));_0x2008d3['attributes']=_0x2008d3[_0x22c2('0x4c')]['length']?_0x2008d3[_0x22c2('0x4c')]:_0x154a53[_0x22c2('0x47')];_0x2008d3['order']=qs[_0x22c2('0x52')](_0x2cc5ca['query'][_0x22c2('0x52')]);_0x2008d3[_0x22c2('0x53')]=qs[_0x22c2('0x4a')](_[_0x22c2('0x54')](_0x2cc5ca[_0x22c2('0x48')],_0x154a53[_0x22c2('0x4a')]));if(_0x2cc5ca[_0x22c2('0x48')][_0x22c2('0x55')]){_0x2008d3[_0x22c2('0x53')]=_['merge'](_0x2008d3[_0x22c2('0x53')],{'$or':_['map'](_0x2008d3[_0x22c2('0x4c')],function(_0x1c993e){var _0x3d10b1={};_0x3d10b1[_0x1c993e]={'$like':'%'+_0x2cc5ca[_0x22c2('0x48')][_0x22c2('0x55')]+'%'};return _0x3d10b1;})});}_0x2008d3=_[_0x22c2('0x56')]({},_0x2008d3,_0x2cc5ca[_0x22c2('0x57')]);return _0x4832cf[_0x22c2('0x11c')](_0x2008d3);}})[_0x22c2('0x38')](function(_0x10ffbf){if(_0x10ffbf){_0x351464=_0x10ffbf[_0x22c2('0x4e')];if(!_0x2cc5ca[_0x22c2('0x48')][_0x22c2('0x4f')](_0x22c2('0x50'))){_0x2008d3[_0x22c2('0x31')]=qs[_0x22c2('0x31')](_0x2cc5ca[_0x22c2('0x48')][_0x22c2('0x31')]);_0x2008d3[_0x22c2('0x30')]=qs[_0x22c2('0x30')](_0x2cc5ca[_0x22c2('0x48')]['offset']);}return _0x4832cf[_0x22c2('0x11c')](_0x2008d3);}})['then'](function(_0x39dd0e){if(_0x39dd0e){return _0x39dd0e?{'count':_0x351464,'rows':_0x39dd0e}:null;}})[_0x22c2('0x38')](respondWithResult(_0x188ea1,null))['catch'](handleError(_0x188ea1,null));}; \ No newline at end of file +var _0x6d4d=['includes','mapKey','CmList','List','Contacts','DESC','Applications','account','list','applications','priority','asc','CmContact','contact','customerIp','cf-connecting-ip','first','split','firstName','lastName','x-real-port','referer','browser','version','format','unknown','device','vendor','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','EventManager','offline','difference','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','toPairs','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','auth','pass','\x22%s\x22\x20<%s>','email','MailAccountId','Chat','NotifyMailAccount','notifyMail','addInteraction','Contact','Owner','fullname','internal','Tags','color','tag','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','getProactiveActions','getLicense','virtual','increment','chatLicenseExceeded','push','all','some','remote','x-forwarded-for','x-real-ip','connection','render','verticalAlignment','textColor','addApplications','ChatApplication','bulkCreate','findAndCountAll','getApplications','chatProactiveAction','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../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','./chatWebsite.socket','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','ChatWebsite','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addLogo','sitepic','file','filename','addAvatar','customerAvatar','addSystemAvatar','systemAvatar','root','server/files/images/logos/default_logo.svg','custom','join','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','agentAvatar','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','isNil','getSystemAvatar','notify','setUA','headers','user-agent','getResult','ValidationError','no\x20available\x20attributes','updatedAt','createdAt','CompanyId','ListId','from','Sequelize','from\x20is\x20mandatory'];(function(_0x5f2098,_0x47308b){var _0x18af32=function(_0xa53c8e){while(--_0xa53c8e){_0x5f2098['push'](_0x5f2098['shift']());}};_0x18af32(++_0x47308b);}(_0x6d4d,0x1a5));var _0xd6d4=function(_0x1b95a1,_0x529852){_0x1b95a1=_0x1b95a1-0x0;var _0x57aef1=_0x6d4d[_0x1b95a1];return _0x57aef1;};'use strict';var pdf=require(_0xd6d4('0x0'));var emlformat=require(_0xd6d4('0x1'));var rimraf=require(_0xd6d4('0x2'));var zipdir=require(_0xd6d4('0x3'));var jsonpatch=require(_0xd6d4('0x4'));var rp=require(_0xd6d4('0x5'));var moment=require('moment');var BPromise=require(_0xd6d4('0x6'));var Mustache=require(_0xd6d4('0x7'));var util=require(_0xd6d4('0x8'));var path=require(_0xd6d4('0x9'));var sox=require(_0xd6d4('0xa'));var csv=require(_0xd6d4('0xb'));var ejs=require(_0xd6d4('0xc'));var fs=require('fs');var _=require(_0xd6d4('0xd'));var squel=require(_0xd6d4('0xe'));var crypto=require('crypto');var jsforce=require(_0xd6d4('0xf'));var deskjs=require(_0xd6d4('0x10'));var toCsv=require(_0xd6d4('0xb'));var querystring=require(_0xd6d4('0x11'));var Papa=require(_0xd6d4('0x12'));var Redis=require('ioredis');var authService=require(_0xd6d4('0x13'));var qs=require(_0xd6d4('0x14'));var as=require(_0xd6d4('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd6d4('0x16'))(_0xd6d4('0x17'));var utils=require(_0xd6d4('0x18'));var config=require(_0xd6d4('0x19'));var licenseUtil=require(_0xd6d4('0x1a'));var db=require(_0xd6d4('0x1b'))['db'];config[_0xd6d4('0x1c')]=_[_0xd6d4('0x1d')](config[_0xd6d4('0x1c')],{'host':_0xd6d4('0x1e'),'port':0x18eb});var socket=require(_0xd6d4('0x1f'))(new Redis(config[_0xd6d4('0x1c')]));require(_0xd6d4('0x20'))['register'](socket);var jayson=require(_0xd6d4('0x21'));var client=jayson[_0xd6d4('0x22')]['http']({'port':0x232c});var client9002=jayson[_0xd6d4('0x22')][_0xd6d4('0x23')]({'port':0x232a});var client9003=jayson[_0xd6d4('0x22')][_0xd6d4('0x23')]({'port':0x232b});var client9001=jayson[_0xd6d4('0x22')][_0xd6d4('0x23')]({'port':0x2329});function respondWithRpcPromise(_0x42392e,_0x2e52ca,_0x18fca4,_0x414f7c){return new BPromise(function(_0x2c2e00,_0x21c119){var _0xc2958f=_0x414f7c||client;return _0xc2958f[_0xd6d4('0x24')](_0x42392e,_0x18fca4)[_0xd6d4('0x25')](function(_0x4ac247){logger[_0xd6d4('0x26')](_0xd6d4('0x27'),_0x2e52ca,_0xd6d4('0x28'));logger['debug'](_0xd6d4('0x29'),_0x2e52ca,'request\x20sent',JSON['stringify'](_0x4ac247));if(_0x4ac247['error']){if(_0x4ac247[_0xd6d4('0x2a')][_0xd6d4('0x2b')]===0x1f4){logger[_0xd6d4('0x2a')](_0xd6d4('0x27'),_0x2e52ca,_0x4ac247[_0xd6d4('0x2a')][_0xd6d4('0x2c')]);return _0x21c119(_0x4ac247[_0xd6d4('0x2a')][_0xd6d4('0x2c')]);}logger[_0xd6d4('0x2a')](_0xd6d4('0x27'),_0x2e52ca,_0x4ac247['error'][_0xd6d4('0x2c')]);return _0x2c2e00(_0x4ac247[_0xd6d4('0x2a')][_0xd6d4('0x2c')]);}else{logger[_0xd6d4('0x26')]('ChatWebsite,\x20%s,\x20%s',_0x2e52ca,'request\x20sent');_0x2c2e00(_0x4ac247[_0xd6d4('0x2d')][_0xd6d4('0x2c')]);}})[_0xd6d4('0x2e')](function(_0x18350a){logger[_0xd6d4('0x2a')](_0xd6d4('0x27'),_0x2e52ca,_0x18350a);_0x21c119(_0x18350a);});});}function respondWithStatusCode(_0x1ffbe2,_0x41578f){_0x41578f=_0x41578f||0xcc;return function(_0x23dc9a){if(_0x23dc9a){return _0x1ffbe2[_0xd6d4('0x2f')](_0x41578f);}return _0x1ffbe2[_0xd6d4('0x30')](_0x41578f)[_0xd6d4('0x31')]();};}function respondWithResult(_0x111575,_0x5d1750){_0x5d1750=_0x5d1750||0xc8;return function(_0x1c148a){if(_0x1c148a){return _0x111575[_0xd6d4('0x30')](_0x5d1750)[_0xd6d4('0x32')](_0x1c148a);}};}function respondWithFilteredResult(_0x2cf2aa,_0x173da7){return function(_0x429110){if(_0x429110){var _0xfc60e9=_0x429110[_0xd6d4('0x33')],_0x57de8e=_0x173da7[_0xd6d4('0x34')],_0x2630af=_0x173da7[_0xd6d4('0x34')]+_0x173da7[_0xd6d4('0x35')],_0x4bf836;if(_0x2630af>=_0xfc60e9){_0x2630af=_0xfc60e9;_0x4bf836=0xc8;}else{_0x4bf836=0xce;}_0x2cf2aa['status'](_0x4bf836);return _0x2cf2aa[_0xd6d4('0x36')](_0xd6d4('0x37'),_0x57de8e+'-'+_0x2630af+'/'+_0xfc60e9)[_0xd6d4('0x32')](_0x429110);}return null;};}function patchUpdates(_0x484614){return function(_0x1a6041){try{jsonpatch[_0xd6d4('0x38')](_0x1a6041,_0x484614,!![]);}catch(_0x344743){return BPromise['reject'](_0x344743);}return _0x1a6041[_0xd6d4('0x39')]();};}function saveUpdates(_0x217dbc,_0x22ae34){return function(_0x514310){if(_0x514310){return _0x514310['update'](_0x217dbc)[_0xd6d4('0x25')](function(_0x4fe209){return _0x4fe209;});}return null;};}function removeEntity(_0x473d43,_0x3a3a71){return function(_0x1435de){if(_0x1435de){return _0x1435de[_0xd6d4('0x3a')]()[_0xd6d4('0x25')](function(){var _0x3d0d37=_0x1435de[_0xd6d4('0x3b')]({'plain':!![]});var _0x233b73='ChatWebsites';return db[_0xd6d4('0x3c')][_0xd6d4('0x3a')]({'where':{'type':_0x233b73,'resourceId':_0x3d0d37['id']}})[_0xd6d4('0x25')](function(){return _0x1435de;});})[_0xd6d4('0x25')](function(){_0x473d43['status'](0xcc)[_0xd6d4('0x31')]();});}};}function handleEntityNotFound(_0x4b6af9,_0x1bea70){return function(_0x38fd8b){if(!_0x38fd8b){_0x4b6af9[_0xd6d4('0x2f')](0x194);}return _0x38fd8b;};}function handleError(_0x25afe9,_0x4aca38){_0x4aca38=_0x4aca38||0x1f4;return function(_0x4b62b8){logger[_0xd6d4('0x2a')](_0x4b62b8[_0xd6d4('0x3d')]);if(_0x4b62b8['name']){delete _0x4b62b8[_0xd6d4('0x3e')];}_0x25afe9[_0xd6d4('0x30')](_0x4aca38)[_0xd6d4('0x3f')](_0x4b62b8);};}exports[_0xd6d4('0x40')]=function(_0x3bcc92,_0x30dd2f){var _0x1dcebc={'include':[{'model':db[_0xd6d4('0x41')],'as':_0xd6d4('0x42')}]},_0x54481f={},_0x1dba16={'count':0x0,'rows':[]};var _0x126060=_['map'](db[_0xd6d4('0x43')]['rawAttributes'],function(_0x1edded){return{'name':_0x1edded[_0xd6d4('0x44')],'type':_0x1edded[_0xd6d4('0x45')][_0xd6d4('0x46')]};});_0x54481f['model']=_['map'](_0x126060,'name');_0x54481f['query']=_['keys'](_0x3bcc92[_0xd6d4('0x47')]);_0x54481f[_0xd6d4('0x48')]=_[_0xd6d4('0x49')](_0x54481f[_0xd6d4('0x4a')],_0x54481f[_0xd6d4('0x47')]);_0x1dcebc[_0xd6d4('0x4b')]=_['intersection'](_0x54481f[_0xd6d4('0x4a')],qs['fields'](_0x3bcc92['query'][_0xd6d4('0x4c')]));_0x1dcebc[_0xd6d4('0x4b')]=_0x1dcebc[_0xd6d4('0x4b')][_0xd6d4('0x4d')]?_0x1dcebc[_0xd6d4('0x4b')]:_0x54481f['model'];if(!_0x3bcc92[_0xd6d4('0x47')][_0xd6d4('0x4e')](_0xd6d4('0x4f'))){_0x1dcebc['limit']=qs[_0xd6d4('0x35')](_0x3bcc92[_0xd6d4('0x47')][_0xd6d4('0x35')]);_0x1dcebc[_0xd6d4('0x34')]=qs[_0xd6d4('0x34')](_0x3bcc92['query'][_0xd6d4('0x34')]);}_0x1dcebc[_0xd6d4('0x50')]=qs[_0xd6d4('0x51')](_0x3bcc92['query'][_0xd6d4('0x51')]);_0x1dcebc[_0xd6d4('0x52')]=qs[_0xd6d4('0x48')](_[_0xd6d4('0x53')](_0x3bcc92[_0xd6d4('0x47')],_0x54481f['filters']),_0x126060);if(_0x3bcc92[_0xd6d4('0x47')][_0xd6d4('0x54')]){_0x1dcebc['where']=_[_0xd6d4('0x55')](_0x1dcebc[_0xd6d4('0x52')],{'$or':_[_0xd6d4('0x56')](_0x126060,function(_0x2c4ea1){if(_0x2c4ea1['type']!==_0xd6d4('0x57')){var _0x3ec5e9={};_0x3ec5e9[_0x2c4ea1[_0xd6d4('0x3e')]]={'$like':'%'+_0x3bcc92['query'][_0xd6d4('0x54')]+'%'};return _0x3ec5e9;}})});}_0x1dcebc=_['merge']({},_0x1dcebc,_0x3bcc92[_0xd6d4('0x58')]);var _0x222947={'where':_0x1dcebc['where']};return db['ChatWebsite'][_0xd6d4('0x33')](_0x222947)[_0xd6d4('0x25')](function(_0x49bc94){_0x1dba16[_0xd6d4('0x33')]=_0x49bc94;if(_0x3bcc92[_0xd6d4('0x47')][_0xd6d4('0x59')]){_0x1dcebc[_0xd6d4('0x5a')]=[{'all':!![]}];}return db[_0xd6d4('0x43')][_0xd6d4('0x5b')](_0x1dcebc);})['then'](function(_0x22bd9c){_0x1dba16[_0xd6d4('0x5c')]=_0x22bd9c;return _0x1dba16;})[_0xd6d4('0x25')](respondWithFilteredResult(_0x30dd2f,_0x1dcebc))[_0xd6d4('0x2e')](handleError(_0x30dd2f,null));};exports[_0xd6d4('0x5d')]=function(_0x51a25a,_0x31ebdc){var _0x23196c={'raw':![],'where':{'id':_0x51a25a[_0xd6d4('0x5e')]['id']},'include':[{'model':db['Pause'],'as':_0xd6d4('0x42')}]},_0x5bfd85={};_0x5bfd85[_0xd6d4('0x4a')]=_[_0xd6d4('0x5f')](db[_0xd6d4('0x43')][_0xd6d4('0x60')]);_0x5bfd85[_0xd6d4('0x47')]=_[_0xd6d4('0x5f')](_0x51a25a[_0xd6d4('0x47')]);_0x5bfd85['filters']=_[_0xd6d4('0x49')](_0x5bfd85['model'],_0x5bfd85[_0xd6d4('0x47')]);_0x23196c['attributes']=_[_0xd6d4('0x49')](_0x5bfd85[_0xd6d4('0x4a')],qs[_0xd6d4('0x4c')](_0x51a25a[_0xd6d4('0x47')][_0xd6d4('0x4c')]));_0x23196c[_0xd6d4('0x4b')]=_0x23196c[_0xd6d4('0x4b')][_0xd6d4('0x4d')]?_0x23196c[_0xd6d4('0x4b')]:_0x5bfd85['model'];if(_0x51a25a['query'][_0xd6d4('0x59')]){_0x23196c[_0xd6d4('0x5a')]=[{'all':!![]}];}_0x23196c=_[_0xd6d4('0x55')]({},_0x23196c,_0x51a25a[_0xd6d4('0x58')]);return db[_0xd6d4('0x43')]['find'](_0x23196c)[_0xd6d4('0x25')](handleEntityNotFound(_0x31ebdc,null))[_0xd6d4('0x25')](respondWithResult(_0x31ebdc,null))[_0xd6d4('0x2e')](handleError(_0x31ebdc,null));};exports['create']=function(_0x2f2d0d,_0xf57a70){return db[_0xd6d4('0x43')][_0xd6d4('0x61')](_0x2f2d0d[_0xd6d4('0x62')],{})['then'](function(_0x44732e){var _0x3216a2=_0x2f2d0d['user']['get']({'plain':!![]});if(!_0x3216a2)throw new Error(_0xd6d4('0x63'));if(_0x3216a2[_0xd6d4('0x64')]===_0xd6d4('0x65')){var _0x4db23e=_0x44732e['get']({'plain':!![]});var _0x5f51e1='ChatWebsites';return db[_0xd6d4('0x66')][_0xd6d4('0x67')]({'where':{'name':_0x5f51e1,'userProfileId':_0x3216a2[_0xd6d4('0x68')]},'raw':!![]})['then'](function(_0x3bf418){if(_0x3bf418&&_0x3bf418[_0xd6d4('0x69')]===0x0){return db['UserProfileResource']['create']({'name':_0x4db23e[_0xd6d4('0x3e')],'resourceId':_0x4db23e['id'],'type':_0x3bf418[_0xd6d4('0x3e')],'sectionId':_0x3bf418['id']},{})[_0xd6d4('0x25')](function(){return _0x44732e;});}else{return _0x44732e;}})[_0xd6d4('0x2e')](function(_0x267aaf){logger[_0xd6d4('0x2a')](_0xd6d4('0x6a'),_0x267aaf);throw _0x267aaf;});}return _0x44732e;})[_0xd6d4('0x25')](respondWithResult(_0xf57a70,0xc9))[_0xd6d4('0x2e')](handleError(_0xf57a70,null));};exports[_0xd6d4('0x6b')]=function(_0x28383c,_0xca70da){if(_0x28383c[_0xd6d4('0x62')]['id']){delete _0x28383c[_0xd6d4('0x62')]['id'];}return db['ChatWebsite'][_0xd6d4('0x67')]({'where':{'id':_0x28383c[_0xd6d4('0x5e')]['id']},'include':[{'model':db[_0xd6d4('0x41')],'as':_0xd6d4('0x42')}]})[_0xd6d4('0x25')](handleEntityNotFound(_0xca70da,null))[_0xd6d4('0x25')](saveUpdates(_0x28383c[_0xd6d4('0x62')],null))[_0xd6d4('0x25')](respondWithResult(_0xca70da,null))[_0xd6d4('0x2e')](handleError(_0xca70da,null));};exports['destroy']=function(_0x1179a7,_0x225982){return db[_0xd6d4('0x43')][_0xd6d4('0x67')]({'where':{'id':_0x1179a7[_0xd6d4('0x5e')]['id']}})[_0xd6d4('0x25')](handleEntityNotFound(_0x225982,null))['then'](removeEntity(_0x225982,null))[_0xd6d4('0x2e')](handleError(_0x225982,null));};exports[_0xd6d4('0x6c')]=function(_0xffdf1d,_0xb0fb54){return db[_0xd6d4('0x43')][_0xd6d4('0x6c')]()[_0xd6d4('0x25')](respondWithResult(_0xb0fb54,null))['catch'](handleError(_0xb0fb54,null));};exports[_0xd6d4('0x6d')]=function(_0x526429,_0x3062e9,_0x474a4b){if(_0x526429[_0xd6d4('0x62')]['id']){delete _0x526429[_0xd6d4('0x62')]['id'];}return db[_0xd6d4('0x43')][_0xd6d4('0x67')]({'where':{'id':_0x526429[_0xd6d4('0x5e')]['id']}})[_0xd6d4('0x25')](handleEntityNotFound(_0x3062e9,null))[_0xd6d4('0x25')](function(_0x497942){if(_0x497942){_0x526429['body'][_0xd6d4('0x6e')]=_0x497942['id'];return db[_0xd6d4('0x6f')]['create'](_0x526429['body']);}})[_0xd6d4('0x25')](respondWithResult(_0x3062e9,null))[_0xd6d4('0x2e')](handleError(_0x3062e9,null));};exports[_0xd6d4('0x70')]=function(_0xa3ada5,_0xeac045,_0x117d6a){var _0x734921={'raw':![],'where':{}};var _0xc6675={};var _0x39543e={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd6d4('0x71')]({'where':{'id':_0xa3ada5[_0xd6d4('0x5e')]['id']}})[_0xd6d4('0x25')](handleEntityNotFound(_0xeac045,null))[_0xd6d4('0x25')](function(_0x1ab3dd){if(_0x1ab3dd){_0xc6675[_0xd6d4('0x4a')]=_['keys'](db['Disposition'][_0xd6d4('0x60')]);_0xc6675[_0xd6d4('0x47')]=_['keys'](_0xa3ada5['query']);_0xc6675['filters']=_['intersection'](_0xc6675[_0xd6d4('0x4a')],_0xc6675[_0xd6d4('0x47')]);_0x734921[_0xd6d4('0x4b')]=_[_0xd6d4('0x49')](_0xc6675['model'],qs[_0xd6d4('0x4c')](_0xa3ada5[_0xd6d4('0x47')][_0xd6d4('0x4c')]));_0x734921[_0xd6d4('0x4b')]=_0x734921[_0xd6d4('0x4b')][_0xd6d4('0x4d')]?_0x734921['attributes']:_0xc6675[_0xd6d4('0x4a')];if(!_0xa3ada5[_0xd6d4('0x47')]['hasOwnProperty'](_0xd6d4('0x4f'))){_0x734921[_0xd6d4('0x35')]=qs['limit'](_0xa3ada5['query']['limit']);_0x734921[_0xd6d4('0x34')]=qs[_0xd6d4('0x34')](_0xa3ada5['query']['offset']);}_0x734921[_0xd6d4('0x50')]=qs['sort'](_0xa3ada5[_0xd6d4('0x47')][_0xd6d4('0x51')]);_0x734921['where']=qs['filters'](_['pick'](_0xa3ada5[_0xd6d4('0x47')],_0xc6675[_0xd6d4('0x48')]));_0x734921[_0xd6d4('0x52')][_0xd6d4('0x6e')]=_0x1ab3dd['id'];if(_0xa3ada5[_0xd6d4('0x47')][_0xd6d4('0x54')]){_0x734921[_0xd6d4('0x52')]=_[_0xd6d4('0x55')](_0x734921['where'],{'$or':_[_0xd6d4('0x56')](_0x734921[_0xd6d4('0x4b')],function(_0x2fd2c9){var _0x118129={};_0x118129[_0x2fd2c9]={'$like':'%'+_0xa3ada5['query'][_0xd6d4('0x54')]+'%'};return _0x118129;})});}_0x734921=_[_0xd6d4('0x55')]({},_0x734921,_0xa3ada5[_0xd6d4('0x58')]);return db['Disposition'][_0xd6d4('0x33')]({'where':_0x734921['where']})[_0xd6d4('0x25')](function(_0xcb54bd){_0x39543e[_0xd6d4('0x33')]=_0xcb54bd;if(_0xa3ada5['query'][_0xd6d4('0x59')]){_0x734921['include']=[{'all':!![]}];}return db[_0xd6d4('0x6f')][_0xd6d4('0x5b')](_0x734921);})[_0xd6d4('0x25')](function(_0x357b31){_0x39543e[_0xd6d4('0x5c')]=_0x357b31;return _0x39543e;});}})['then'](respondWithFilteredResult(_0xeac045,_0x734921))['catch'](handleError(_0xeac045,null));};exports[_0xd6d4('0x72')]=function(_0x3d2096,_0x3410c9,_0x2e7c08){return db[_0xd6d4('0x43')][_0xd6d4('0x67')]({'where':{'id':_0x3d2096['params']['id']}})['then'](handleEntityNotFound(_0x3410c9,null))[_0xd6d4('0x25')](function(_0x57ab44){if(_0x57ab44){return _0x57ab44['removeDispositions'](_0x3d2096['query']['ids']);}})[_0xd6d4('0x25')](respondWithStatusCode(_0x3410c9,null))[_0xd6d4('0x2e')](handleError(_0x3410c9,null));};exports[_0xd6d4('0x73')]=function(_0x2c35d8,_0x469ebb,_0x53a738){if(_0x2c35d8[_0xd6d4('0x62')]['id']){delete _0x2c35d8[_0xd6d4('0x62')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x2c35d8[_0xd6d4('0x5e')]['id']}})['then'](handleEntityNotFound(_0x469ebb,null))[_0xd6d4('0x25')](function(_0x1f383a){if(_0x1f383a){_0x2c35d8[_0xd6d4('0x62')][_0xd6d4('0x6e')]=_0x1f383a['id'];return db[_0xd6d4('0x74')][_0xd6d4('0x61')](_0x2c35d8[_0xd6d4('0x62')]);}})[_0xd6d4('0x25')](respondWithResult(_0x469ebb,null))['catch'](handleError(_0x469ebb,null));};exports[_0xd6d4('0x75')]=function(_0x27d11d,_0x5369d2,_0x21d43e){var _0x3c9e83={'raw':![],'where':{}};var _0xd09074={};var _0x1b904a={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xd6d4('0x71')]({'where':{'id':_0x27d11d['params']['id']}})[_0xd6d4('0x25')](handleEntityNotFound(_0x5369d2,null))[_0xd6d4('0x25')](function(_0x4bb597){if(_0x4bb597){_0xd09074[_0xd6d4('0x4a')]=_[_0xd6d4('0x5f')](db[_0xd6d4('0x74')][_0xd6d4('0x60')]);_0xd09074['query']=_[_0xd6d4('0x5f')](_0x27d11d['query']);_0xd09074[_0xd6d4('0x48')]=_[_0xd6d4('0x49')](_0xd09074['model'],_0xd09074[_0xd6d4('0x47')]);_0x3c9e83[_0xd6d4('0x4b')]=_[_0xd6d4('0x49')](_0xd09074[_0xd6d4('0x4a')],qs[_0xd6d4('0x4c')](_0x27d11d[_0xd6d4('0x47')][_0xd6d4('0x4c')]));_0x3c9e83[_0xd6d4('0x4b')]=_0x3c9e83[_0xd6d4('0x4b')][_0xd6d4('0x4d')]?_0x3c9e83[_0xd6d4('0x4b')]:_0xd09074['model'];if(!_0x27d11d['query']['hasOwnProperty']('nolimit')){_0x3c9e83[_0xd6d4('0x35')]=qs[_0xd6d4('0x35')](_0x27d11d[_0xd6d4('0x47')][_0xd6d4('0x35')]);_0x3c9e83[_0xd6d4('0x34')]=qs['offset'](_0x27d11d[_0xd6d4('0x47')][_0xd6d4('0x34')]);}_0x3c9e83['order']=qs[_0xd6d4('0x51')](_0x27d11d[_0xd6d4('0x47')][_0xd6d4('0x51')]);_0x3c9e83[_0xd6d4('0x52')]=qs['filters'](_[_0xd6d4('0x53')](_0x27d11d[_0xd6d4('0x47')],_0xd09074[_0xd6d4('0x48')]));_0x3c9e83[_0xd6d4('0x52')][_0xd6d4('0x6e')]=_0x4bb597['id'];if(_0x27d11d[_0xd6d4('0x47')][_0xd6d4('0x54')]){_0x3c9e83['where']=_[_0xd6d4('0x55')](_0x3c9e83[_0xd6d4('0x52')],{'$or':_['map'](_0x3c9e83['attributes'],function(_0x23e94c){var _0x43c9c1={};_0x43c9c1[_0x23e94c]={'$like':'%'+_0x27d11d['query'][_0xd6d4('0x54')]+'%'};return _0x43c9c1;})});}_0x3c9e83=_[_0xd6d4('0x55')]({},_0x3c9e83,_0x27d11d[_0xd6d4('0x58')]);return db['CannedAnswer'][_0xd6d4('0x33')]({'where':_0x3c9e83[_0xd6d4('0x52')]})[_0xd6d4('0x25')](function(_0x34032f){_0x1b904a[_0xd6d4('0x33')]=_0x34032f;if(_0x27d11d[_0xd6d4('0x47')][_0xd6d4('0x59')]){_0x3c9e83['include']=[{'all':!![]}];}return db[_0xd6d4('0x74')]['findAll'](_0x3c9e83);})[_0xd6d4('0x25')](function(_0x14905a){_0x1b904a[_0xd6d4('0x5c')]=_0x14905a;return _0x1b904a;});}})[_0xd6d4('0x25')](respondWithFilteredResult(_0x5369d2,_0x3c9e83))['catch'](handleError(_0x5369d2,null));};exports[_0xd6d4('0x76')]=function(_0x5f08ac,_0x117b2f,_0x1cc03a){return db[_0xd6d4('0x43')]['find']({'where':{'id':_0x5f08ac[_0xd6d4('0x5e')]['id']}})[_0xd6d4('0x25')](handleEntityNotFound(_0x117b2f,null))['then'](function(_0x32a1a8){if(_0x32a1a8){return _0x32a1a8[_0xd6d4('0x76')](_0x5f08ac[_0xd6d4('0x47')][_0xd6d4('0x77')]);}})[_0xd6d4('0x25')](respondWithStatusCode(_0x117b2f,null))[_0xd6d4('0x2e')](handleError(_0x117b2f,null));};exports[_0xd6d4('0x78')]=function(_0x3d6b68,_0xe79895,_0x46063a){_0x3d6b68[_0xd6d4('0x62')][_0xd6d4('0x79')]=_0x3d6b68[_0xd6d4('0x7a')][_0xd6d4('0x7b')];return db[_0xd6d4('0x43')][_0xd6d4('0x67')]({'where':{'id':_0x3d6b68[_0xd6d4('0x5e')]['id']}})[_0xd6d4('0x25')](handleEntityNotFound(_0xe79895,null))[_0xd6d4('0x25')](saveUpdates(_0x3d6b68[_0xd6d4('0x62')],null))[_0xd6d4('0x25')](respondWithResult(_0xe79895,null))[_0xd6d4('0x2e')](handleError(_0xe79895,null));};exports[_0xd6d4('0x7c')]=function(_0x1b424f,_0x2ad0ca,_0x477028){_0x1b424f[_0xd6d4('0x62')]['agentAvatar']=_0x1b424f['file'][_0xd6d4('0x7b')];return db['ChatWebsite'][_0xd6d4('0x67')]({'where':{'id':_0x1b424f[_0xd6d4('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2ad0ca,null))['then'](saveUpdates(_0x1b424f[_0xd6d4('0x62')],null))['then'](respondWithResult(_0x2ad0ca,null))[_0xd6d4('0x2e')](handleError(_0x2ad0ca,null));};exports['addCustomerAvatar']=function(_0x2f9b0a,_0x8373ea,_0x40a8b1){_0x2f9b0a[_0xd6d4('0x62')][_0xd6d4('0x7d')]=_0x2f9b0a['file']['filename'];return db[_0xd6d4('0x43')][_0xd6d4('0x67')]({'where':{'id':_0x2f9b0a[_0xd6d4('0x5e')]['id']}})['then'](handleEntityNotFound(_0x8373ea,null))[_0xd6d4('0x25')](saveUpdates(_0x2f9b0a[_0xd6d4('0x62')],null))[_0xd6d4('0x25')](respondWithResult(_0x8373ea,null))[_0xd6d4('0x2e')](handleError(_0x8373ea,null));};exports[_0xd6d4('0x7e')]=function(_0x29b15c,_0x21af70,_0x42ec81){_0x29b15c[_0xd6d4('0x62')][_0xd6d4('0x7f')]=_0x29b15c[_0xd6d4('0x7a')]['filename'];return db[_0xd6d4('0x43')]['find']({'where':{'id':_0x29b15c[_0xd6d4('0x5e')]['id']}})['then'](handleEntityNotFound(_0x21af70,null))['then'](saveUpdates(_0x29b15c[_0xd6d4('0x62')],null))[_0xd6d4('0x25')](respondWithResult(_0x21af70,null))[_0xd6d4('0x2e')](handleError(_0x21af70,null));};exports['getLogo']=function(_0x427d8a,_0xc8de53,_0x55c2cc){var _0x35f6ac=path['join'](config[_0xd6d4('0x80')],_0xd6d4('0x81'));var _0x29303a={'where':{'id':_0x427d8a[_0xd6d4('0x5e')]['id']},'attributes':['id',_0xd6d4('0x79')],'raw':!![]};var _0xe31a4b=![];return require('../../config/license/util')['getLicense']()[_0xd6d4('0x25')](function(_0x56c041){if(_0x56c041){_0xe31a4b=_0x56c041[_0xd6d4('0x82')];}})['then'](function(){return db[_0xd6d4('0x43')][_0xd6d4('0x67')](_0x29303a);})[_0xd6d4('0x25')](handleEntityNotFound(_0xc8de53,null))[_0xd6d4('0x25')](function(_0x3545f8){if(_0x3545f8){if(!_['isNil'](_0x3545f8[_0xd6d4('0x79')])){if(fs['existsSync'](path['join'](config[_0xd6d4('0x80')],'server/files/images/logos/',_0x3545f8[_0xd6d4('0x79')]))&&_0xe31a4b){_0x35f6ac=path[_0xd6d4('0x83')](config['root'],_0xd6d4('0x84'),_0x3545f8[_0xd6d4('0x79')]);}}return _0xc8de53[_0xd6d4('0x85')](_0x35f6ac);}})[_0xd6d4('0x2e')](handleError(_0xc8de53,null));};exports['getAvatar']=function(_0x2223c3,_0x3f39a4,_0x425a7c){var _0x34af8c=path[_0xd6d4('0x83')](config['root'],_0xd6d4('0x86'));var _0x2479e9={'where':{'id':_0x2223c3[_0xd6d4('0x5e')]['id']},'attributes':['id',_0xd6d4('0x87')],'raw':!![]};return db[_0xd6d4('0x43')][_0xd6d4('0x67')](_0x2479e9)[_0xd6d4('0x25')](handleEntityNotFound(_0x3f39a4,null))['then'](function(_0x18c207){if(_0x18c207){if(!_['isNil'](_0x18c207[_0xd6d4('0x87')])){if(fs[_0xd6d4('0x88')](path[_0xd6d4('0x83')](config[_0xd6d4('0x80')],_0xd6d4('0x89'),_0x18c207[_0xd6d4('0x87')]))){_0x34af8c=path[_0xd6d4('0x83')](config[_0xd6d4('0x80')],_0xd6d4('0x89'),_0x18c207['agentAvatar']);}}return _0x3f39a4[_0xd6d4('0x85')](_0x34af8c);}})['catch'](handleError(_0x3f39a4,null));};exports[_0xd6d4('0x8a')]=function(_0x46f6ff,_0x4931b1,_0x4d277a){var _0x3fe848=path['join'](config[_0xd6d4('0x80')],_0xd6d4('0x8b'));var _0x1680fd={'where':{'id':_0x46f6ff[_0xd6d4('0x5e')]['id']},'attributes':['id',_0xd6d4('0x7d'),_0xd6d4('0x8c')],'raw':!![]};return db[_0xd6d4('0x43')]['find'](_0x1680fd)[_0xd6d4('0x25')](handleEntityNotFound(_0x4931b1,null))['then'](function(_0x104b5f){if(_0x104b5f){if(!_[_0xd6d4('0x8d')](_0x104b5f[_0xd6d4('0x7d')])){if(fs[_0xd6d4('0x88')](path[_0xd6d4('0x83')](config[_0xd6d4('0x80')],'server/files/images/avatars/',_0x104b5f[_0xd6d4('0x7d')]))&&_0x104b5f['showCustomerAvatar']){_0x3fe848=path[_0xd6d4('0x83')](config[_0xd6d4('0x80')],'server/files/images/avatars/',_0x104b5f[_0xd6d4('0x7d')]);}}return _0x4931b1[_0xd6d4('0x85')](_0x3fe848);}})[_0xd6d4('0x2e')](handleError(_0x4931b1,null));};exports[_0xd6d4('0x8e')]=function(_0x58a1aa,_0x44ad90,_0x3dc07d){var _0xe16230=path[_0xd6d4('0x83')](config['root'],'server/files/images/avatars/system_avatar.png');var _0x4dd272={'where':{'id':_0x58a1aa['params']['id']},'attributes':['id',_0xd6d4('0x7f')],'raw':!![]};return db['ChatWebsite'][_0xd6d4('0x67')](_0x4dd272)[_0xd6d4('0x25')](handleEntityNotFound(_0x44ad90,null))[_0xd6d4('0x25')](function(_0x56d5f4){if(_0x56d5f4){if(!_[_0xd6d4('0x8d')](_0x56d5f4['systemAvatar'])){if(fs[_0xd6d4('0x88')](path['join'](config[_0xd6d4('0x80')],_0xd6d4('0x89'),_0x56d5f4['systemAvatar']))){_0xe16230=path[_0xd6d4('0x83')](config[_0xd6d4('0x80')],_0xd6d4('0x89'),_0x56d5f4[_0xd6d4('0x7f')]);}}return _0x44ad90[_0xd6d4('0x85')](_0xe16230);}})[_0xd6d4('0x2e')](handleError(_0x44ad90,null));};exports[_0xd6d4('0x8f')]=function(_0x360698,_0x24cb81,_0x447b7e){var _0x121782=require('user-agent-parser');var _0x416730=new _0x121782();var _0x29f5fb=_0x416730[_0xd6d4('0x90')](_0x360698[_0xd6d4('0x91')][_0xd6d4('0x92')])[_0xd6d4('0x93')]();var _0x116ede={'body':_0x360698[_0xd6d4('0x62')],'channel':'chat'};var _0x2e9318=[];var _0x47ce=[];var _0x499fb7={};var _0x26add1=![];return db['CmContact']['describe']()['then'](function(_0xb4d70b){if(!_0xb4d70b){throw new db['Sequelize'][(_0xd6d4('0x94'))](_0xd6d4('0x95'));}_0x2e9318=_['difference'](_[_0xd6d4('0x5f')](_0xb4d70b),['createdAt',_0xd6d4('0x96')]);_0x47ce=_['difference'](_[_0xd6d4('0x5f')](_0xb4d70b),[_0xd6d4('0x97'),'updatedAt',_0xd6d4('0x98'),_0xd6d4('0x99')]);if(_0x360698[_0xd6d4('0x62')]['id']){delete _0x360698[_0xd6d4('0x62')]['id'];}if(_['isNil'](_0x360698[_0xd6d4('0x62')][_0xd6d4('0x9a')])){throw new db[(_0xd6d4('0x9b'))][(_0xd6d4('0x94'))](_0xd6d4('0x9c'));}if(_['isNil'](_0x360698[_0xd6d4('0x62')]['body'])||_0x360698[_0xd6d4('0x62')][_0xd6d4('0x62')]===''){throw new db[(_0xd6d4('0x9b'))][(_0xd6d4('0x94'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x360698[_0xd6d4('0x62')]['mapKey'])){throw new db[(_0xd6d4('0x9b'))][(_0xd6d4('0x94'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x47ce);}if(!_[_0xd6d4('0x9d')](_0x47ce,_0x360698[_0xd6d4('0x62')][_0xd6d4('0x9e')])){throw new db['Sequelize'][(_0xd6d4('0x94'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x47ce);}_0x499fb7[_0x360698[_0xd6d4('0x62')][_0xd6d4('0x9e')]]=_0x360698[_0xd6d4('0x62')][_0xd6d4('0x9a')];})['then'](function(){return db[_0xd6d4('0x43')]['find']({'where':{'id':_0x360698[_0xd6d4('0x5e')]['id']},'include':[{'model':db[_0xd6d4('0x9f')],'as':_0xd6d4('0xa0'),'include':[{'model':db['CmContact'],'as':_0xd6d4('0xa1'),'where':_0x499fb7,'limit':0x1,'order':[[_0xd6d4('0x96'),_0xd6d4('0xa2')]]}]},{'model':db['ChatApplication'],'as':_0xd6d4('0xa3')}]});})[_0xd6d4('0x25')](handleEntityNotFound(_0x24cb81,null))[_0xd6d4('0x25')](function(_0x5cd96c){if(_0x5cd96c&&_0x5cd96c[_0xd6d4('0xa0')]){_0x116ede[_0xd6d4('0xa4')]=_0x5cd96c;_0x116ede['applications']=_0x5cd96c[_0xd6d4('0xa3')];_0x116ede[_0xd6d4('0xa5')]=_0x5cd96c[_0xd6d4('0xa0')];_0x116ede[_0xd6d4('0xa6')]=_['orderBy'](_0x116ede[_0xd6d4('0xa6')],[_0xd6d4('0xa7')],[_0xd6d4('0xa8')]);if(_0x116ede[_0xd6d4('0xa4')][_0xd6d4('0xa3')]){delete _0x116ede[_0xd6d4('0xa4')][_0xd6d4('0xa3')];}if(_0x116ede[_0xd6d4('0xa4')]['List']&&_0x116ede[_0xd6d4('0xa4')][_0xd6d4('0xa0')][_0xd6d4('0xa1')]['length']){return _0x116ede[_0xd6d4('0xa4')][_0xd6d4('0xa0')][_0xd6d4('0xa1')][0x0];}var _0x2b2144=_[_0xd6d4('0x1d')](_0x360698[_0xd6d4('0x62')],{'firstName':_0x360698['body'][_0xd6d4('0x9a')],'ListId':_0x5cd96c['ListId']});_0x2b2144[_0x360698[_0xd6d4('0x62')][_0xd6d4('0x9e')]]=_0x360698[_0xd6d4('0x62')][_0xd6d4('0x9a')];return db[_0xd6d4('0xa9')][_0xd6d4('0x61')](_0x2b2144,{'fields':_0x2e9318,'raw':!![]});}})[_0xd6d4('0x25')](handleEntityNotFound(_0x24cb81,null))['then'](function(_0x49d68f){_0x116ede[_0xd6d4('0xaa')]=_0x49d68f;var _0x4c186c=_0x360698['body'][_0xd6d4('0xab')];if(_0x360698[_0xd6d4('0x91')]['cf-connecting-ip']){_0x4c186c=_0x360698[_0xd6d4('0x91')][_0xd6d4('0xac')];}else if(_0x360698[_0xd6d4('0x91')]['x-forwarded-for']){_0x4c186c=_[_0xd6d4('0xad')](_0x360698[_0xd6d4('0x91')]['x-forwarded-for'][_0xd6d4('0xae')](','));}if(_0x49d68f){var _0x407668={'ContactId':_0x49d68f['id'],'ChatWebsiteId':_0x360698[_0xd6d4('0x5e')]['id'],'from':(_0x49d68f[_0xd6d4('0xaf')]||'')+'\x20'+(_0x49d68f[_0xd6d4('0xb0')]||''),'customerIp':_0x4c186c,'customerPort':_0x360698[_0xd6d4('0x91')][_0xd6d4('0xb1')]?_0x360698[_0xd6d4('0x91')][_0xd6d4('0xb1')]:null,'referer':_0x360698['body'][_0xd6d4('0xb2')],'browserName':_0x29f5fb['browser'][_0xd6d4('0x3e')]&&_0x29f5fb[_0xd6d4('0xb3')][_0xd6d4('0xb4')]?util[_0xd6d4('0xb5')]('%s\x20%s',_0x29f5fb[_0xd6d4('0xb3')]['name'],_0x29f5fb[_0xd6d4('0xb3')][_0xd6d4('0xb4')]):_0xd6d4('0xb6'),'browserVersion':_0x29f5fb['browser'][_0xd6d4('0xb4')]||'unknown','osName':util[_0xd6d4('0xb5')]('%s\x20%s',_0x29f5fb['os'][_0xd6d4('0x3e')],_0x29f5fb['os'][_0xd6d4('0xb4')]),'osVersion':_0x29f5fb['os']['version'],'deviceModel':_0x29f5fb[_0xd6d4('0xb7')]['model']&&_0x29f5fb[_0xd6d4('0xb7')][_0xd6d4('0xb8')]?util[_0xd6d4('0xb5')]('%s\x20%s\x20%s',_0x29f5fb[_0xd6d4('0xb7')]['model'],_0x29f5fb[_0xd6d4('0xb7')]['vendor'],_0x29f5fb['device'][_0xd6d4('0x45')]):null,'deviceVendor':_0x29f5fb[_0xd6d4('0xb7')][_0xd6d4('0xb8')],'deviceType':_0x29f5fb[_0xd6d4('0xb7')][_0xd6d4('0x45')],'formData':JSON[_0xd6d4('0xb9')](_0x360698['body'])};var _0x1270d6={'ChatWebsiteId':_0x360698['params']['id'],'closed':![]};if(_0x360698[_0xd6d4('0x62')][_0xd6d4('0xba')]){_0x1270d6[_0xd6d4('0xba')]=_0x360698[_0xd6d4('0x62')]['threadId'];return db[_0xd6d4('0xbb')][_0xd6d4('0x67')]({'where':_0x1270d6})[_0xd6d4('0x25')](function(_0xc1b92b){if(_0xc1b92b){return[_0xc1b92b,![]];}_0x407668[_0xd6d4('0xba')]=_0x360698[_0xd6d4('0x62')][_0xd6d4('0xba')];_0x407668['externalUrl']=_0x360698['body'][_0xd6d4('0xbc')];return db['ChatInteraction']['create'](_0x407668)[_0xd6d4('0x25')](function(_0x47a2d4){return[_0x47a2d4,!![]];});});}_0x1270d6[_0xd6d4('0xbd')]=_0x49d68f['id'];if(_0x360698[_0xd6d4('0x62')][_0xd6d4('0xbe')]&&_0x360698[_0xd6d4('0x62')][_0xd6d4('0xbe')]['id']){_0x1270d6['id']=_0x360698[_0xd6d4('0x62')][_0xd6d4('0xbe')]['id'];return db['ChatInteraction']['find']({'where':_0x1270d6})[_0xd6d4('0x25')](function(_0x499008){if(_0x499008){return[_0x499008,![]];}return db[_0xd6d4('0xbb')][_0xd6d4('0x61')](_0x407668)[_0xd6d4('0x25')](function(_0x546451){return[_0x546451,!![]];});});}return db[_0xd6d4('0xbb')][_0xd6d4('0x61')](_0x407668)[_0xd6d4('0x25')](function(_0x22e078){return[_0x22e078,!![]];});}})[_0xd6d4('0xbf')](function(_0x5d74b0,_0x4f5ff9){if(_0x5d74b0){_0x26add1=_0x4f5ff9;if(!_0x4f5ff9){var _0x416b8a={'from':(_0x116ede['contact'][_0xd6d4('0xaf')]||'')+'\x20'+(_0x116ede[_0xd6d4('0xaa')][_0xd6d4('0xb0')]||'')};if(_0x360698[_0xd6d4('0x62')][_0xd6d4('0xba')]&&_0x360698[_0xd6d4('0x62')][_0xd6d4('0xc0')]&&_0x360698[_0xd6d4('0x62')][_0xd6d4('0xba')]!=_0x360698['body'][_0xd6d4('0xc0')]){_0x416b8a[_0xd6d4('0xba')]=_0x360698[_0xd6d4('0x62')][_0xd6d4('0xc0')];}return _0x5d74b0[_0xd6d4('0x6b')](_0x416b8a);}else{return _0x5d74b0;}}})[_0xd6d4('0x25')](function(_0x444cdc){_0x116ede[_0xd6d4('0xbe')]=_0x444cdc['get']({'plain':!![]});_0x116ede['interaction'][_0xd6d4('0xc1')]=_0x26add1;if(_0x116ede[_0xd6d4('0xbe')][_0xd6d4('0xc1')]){if(_0x116ede[_0xd6d4('0xa4')][_0xd6d4('0xc2')]){_0x116ede['applications']['push']({'id':0x0,'priority':_0x116ede[_0xd6d4('0xa6')][_0xd6d4('0x4d')]+0x1,'app':'close','appdata':_0xd6d4('0xc3'),'interval':'*,*,*,*'});}}return db[_0xd6d4('0xc4')][_0xd6d4('0x61')]({'body':_0x360698[_0xd6d4('0x62')][_0xd6d4('0x62')],'ChatWebsiteId':_0x360698[_0xd6d4('0x5e')]['id'],'ChatInteractionId':_0x444cdc['id'],'direction':'in','ContactId':_0x116ede[_0xd6d4('0xaa')]['id'],'AttachmentId':_0x360698[_0xd6d4('0x62')][_0xd6d4('0xc5')]});})[_0xd6d4('0x25')](function(_0x3471e8){_0x116ede[_0xd6d4('0x2c')]=_0x3471e8;if(_0x116ede['interaction'][_0xd6d4('0xc6')]){return db[_0xd6d4('0xc7')]['find']({'attributes':['id',_0xd6d4('0x3e')],'where':{'id':_0x116ede[_0xd6d4('0xbe')][_0xd6d4('0xc6')]}})[_0xd6d4('0x25')](function(_0x936402){if(_0x936402){_0x116ede[_0xd6d4('0xa6')][_0xd6d4('0xc8')]({'id':0x0,'priority':0x0,'app':_0xd6d4('0xc9'),'appdata':_0x936402['name']+','+(_0x116ede['account'][_0xd6d4('0xca')]||0xa),'interval':_0xd6d4('0xcb')});_0x116ede['forcedOwnership']=!![];}return respondWithRpcPromise(_0xd6d4('0xcc'),_0xd6d4('0xcd'),_0x116ede);});}return respondWithRpcPromise(_0xd6d4('0xcc'),_0xd6d4('0xcd'),_0x116ede);})[_0xd6d4('0x25')](function(_0x110aad){respondWithRpcPromise(_0xd6d4('0xce'),_0xd6d4('0xce'),{'event':_0xd6d4('0x8f'),'message':_0x110aad},client9002);return _0x110aad;})[_0xd6d4('0x25')](respondWithResult(_0x24cb81,null))['catch'](handleError(_0x24cb81,null));};exports[_0xd6d4('0xcf')]=function(_0x253f6c,_0x2945e7,_0x541894){var _0x1998bc,_0x161aa0,_0x5d747d;var _0x2a7d77=[];var _0x1de831=[];var _0x15d8b5={};return db[_0xd6d4('0xa9')][_0xd6d4('0x6c')]()[_0xd6d4('0x25')](function(_0x2c68c3){if(!_0x2c68c3){throw new db['Sequelize'][(_0xd6d4('0x94'))](_0xd6d4('0x95'));}_0x1de831=_[_0xd6d4('0xd0')](_[_0xd6d4('0x5f')](_0x2c68c3),['createdAt',_0xd6d4('0x96')]);_0x2a7d77=_[_0xd6d4('0xd0')](_['keys'](_0x2c68c3),[_0xd6d4('0x97'),_0xd6d4('0x96'),_0xd6d4('0x98'),_0xd6d4('0x99')]);if(_0x253f6c[_0xd6d4('0x62')]['id']){delete _0x253f6c['body']['id'];}if(_[_0xd6d4('0x8d')](_0x253f6c[_0xd6d4('0x62')][_0xd6d4('0x9a')])){throw _0x2945e7[_0xd6d4('0x30')](0x1f4)[_0xd6d4('0x3f')](new db[(_0xd6d4('0x9b'))][(_0xd6d4('0x94'))](_0xd6d4('0x9c')));}if(_[_0xd6d4('0x8d')](_0x253f6c[_0xd6d4('0x62')]['body'])||_0x253f6c['body'][_0xd6d4('0x62')]===''){throw _0x2945e7[_0xd6d4('0x30')](0x1f4)[_0xd6d4('0x3f')](new db[(_0xd6d4('0x9b'))][(_0xd6d4('0x94'))](_0xd6d4('0xd1')));}if(_[_0xd6d4('0x8d')](_0x253f6c['body']['mapKeyOffline'])){throw _0x2945e7[_0xd6d4('0x30')](0x1f4)[_0xd6d4('0x3f')](new db[(_0xd6d4('0x9b'))][(_0xd6d4('0x94'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2a7d77));}if(!_[_0xd6d4('0x9d')](_0x2a7d77,_0x253f6c[_0xd6d4('0x62')]['mapKeyOffline'])){throw _0x2945e7[_0xd6d4('0x30')](0x1f4)[_0xd6d4('0x3f')](new db[(_0xd6d4('0x9b'))][(_0xd6d4('0x94'))](_0xd6d4('0xd2')+_0x2a7d77));}_0x15d8b5[_0x253f6c['body'][_0xd6d4('0xd3')]]=_0x253f6c[_0xd6d4('0x62')][_0xd6d4('0x9a')];})[_0xd6d4('0x25')](function(){return db[_0xd6d4('0x43')]['find']({'where':{'id':_0x253f6c[_0xd6d4('0x5e')]['id']},'include':[{'model':db[_0xd6d4('0x9f')],'as':'List'},{'model':db[_0xd6d4('0xd4')],'as':'MailAccount'}]});})[_0xd6d4('0x25')](handleEntityNotFound(_0x2945e7,null))[_0xd6d4('0x25')](function(_0x3e5f11){if(_0x3e5f11&&_0x3e5f11[_0xd6d4('0xa0')]){_0x161aa0=_0x3e5f11;var _0x3af93c=_[_0xd6d4('0x1d')](_0x253f6c[_0xd6d4('0x62')],{'firstName':_0x253f6c[_0xd6d4('0x62')][_0xd6d4('0x9a')],'phone':_0x253f6c['body'][_0xd6d4('0x9a')],'ListId':_0x3e5f11[_0xd6d4('0x99')]});_0x3af93c[_0x253f6c[_0xd6d4('0x62')][_0xd6d4('0xd3')]]=_0x253f6c[_0xd6d4('0x62')][_0xd6d4('0x9a')];return db[_0xd6d4('0xa9')]['findOrCreate']({'where':_0x15d8b5,'defaults':_0x3af93c});}})['spread'](function(_0x91825a){if(_0x91825a){_0x5d747d=_0x91825a;var _0x1b1a31=fs[_0xd6d4('0xd5')](path[_0xd6d4('0x83')](config[_0xd6d4('0x80')],_0xd6d4('0xd6')),'utf8');var _0x537253=ejs['render'](_0x1b1a31,{'body':_[_0xd6d4('0xd7')](_0x253f6c[_0xd6d4('0x62')][_0xd6d4('0x62')]),'bodyTitle':_0x161aa0['offlineMessageBody']});return db['ChatOfflineMessage']['create']({'body':_0x537253,'ContactId':_0x91825a['id'],'ChatWebsiteId':_0x161aa0['id']});}})[_0xd6d4('0x25')](function(_0x285803){if(_0x285803){_0x1998bc=_0x285803;return db[_0xd6d4('0xd4')][_0xd6d4('0x71')]({'where':{'service':!![]},'include':[{'model':db[_0xd6d4('0xd8')],'as':_0xd6d4('0xd9'),'raw':!![]}]});}})[_0xd6d4('0x25')](function(_0x3b0bf2){if(_0x3b0bf2&&_0x3b0bf2[_0xd6d4('0xd9')]&&_0x161aa0[_0xd6d4('0xda')]&&_0x161aa0[_0xd6d4('0xdb')]){var _0x4eb5b0={'tls':{'rejectUnauthorized':![]}};if(_0x3b0bf2[_0xd6d4('0xd9')]['service']){_0x4eb5b0['service']=_0x3b0bf2[_0xd6d4('0xd9')][_0xd6d4('0xdc')];}else{_0x4eb5b0['host']=_0x3b0bf2['Smtp'][_0xd6d4('0xdd')];_0x4eb5b0[_0xd6d4('0xde')]=_0x3b0bf2[_0xd6d4('0xd9')][_0xd6d4('0xde')];_0x4eb5b0[_0xd6d4('0xdf')]=_0x3b0bf2['Smtp']['secure'];}if(_0x3b0bf2['Smtp']['authentication']){_0x4eb5b0[_0xd6d4('0xe0')]={'user':_0x3b0bf2['Smtp'][_0xd6d4('0x65')],'pass':_0x3b0bf2['Smtp'][_0xd6d4('0xe1')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x4eb5b0,'message':{'from':util['format'](_0xd6d4('0xe2'),_0x3b0bf2['name'],_0x3b0bf2[_0xd6d4('0xe3')]||_0x3b0bf2['Smtp'][_0xd6d4('0x65')]),'to':_0x161aa0['forwardOfflineAddress'],'subject':_0x161aa0['offlineMessageSubject'],'text':_0x1998bc['body']}},client9003)[_0xd6d4('0x25')](function(){return _0x1998bc;})[_0xd6d4('0x2e')](function(_0x54aa3d){console[_0xd6d4('0x2a')](_0x54aa3d);});}})['then'](function(){if(_0x161aa0&&_0x161aa0['openNewInteraction']&&_0x161aa0[_0xd6d4('0xe4')]){var _0x2b9ad2={'from':_0x5d747d['email'],'firstName':_0x5d747d[_0xd6d4('0xaf')],'lastName':_0x5d747d[_0xd6d4('0xb0')],'mapKey':_0xd6d4('0xe3'),'message':{'from':_0x5d747d[_0xd6d4('0xe3')],'to':_0x161aa0[_0xd6d4('0xd4')]['email'],'cc':'','subject':_0x161aa0['offlineMessageSubject'],'messageId':'','sentAt':new Date(),'attach':![],'attachments':[],'originChannel':_0xd6d4('0xe5'),'ChatWebsiteId':_0x161aa0['id'],'ChatOfflineMessageId':_0x1998bc['id'],'originTo':_0x161aa0['MailAccount'][_0xd6d4('0xe3')]},'body':_0x1998bc['body']};var _0x278915={'account':{'id':_0x161aa0['MailAccountId']},'body':_0x2b9ad2,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xd6d4('0xe6'),_0xd6d4('0xe7'),_0x278915,client9001)['then'](function(){return _0x1998bc;})[_0xd6d4('0x2e')](function(_0x353275){console['error'](_0x353275);});}return;})[_0xd6d4('0x25')](function(){if(_0x1998bc){return _0x1998bc;}})[_0xd6d4('0x25')](respondWithResult(_0x2945e7,null))[_0xd6d4('0x2e')](handleError(_0x2945e7,null));};exports[_0xd6d4('0xe8')]=function(_0x5798c9,_0x15b967,_0x8d3e15){return db['ChatInteraction']['find']({'where':{'id':_0x5798c9[_0xd6d4('0x5e')]['id']}})[_0xd6d4('0x25')](handleEntityNotFound(_0x15b967,null))[_0xd6d4('0x25')](function(_0x5d7fda){if(_0x5d7fda){return _0x5d7fda[_0xd6d4('0xe8')](_0x5798c9['body']['ids'],_['omit'](_0x5798c9['body'],[_0xd6d4('0x77'),'id'])||{});}})['then'](respondWithResult(_0x15b967,null))[_0xd6d4('0x2e')](handleError(_0x15b967,null));};exports['getInteractions']=function(_0x4e42d6,_0x159519,_0xad7cc2){var _0x273473={'raw':![],'where':{}};var _0xaecb14={};var _0x5f3921={'count':0x0,'rows':[]};return db[_0xd6d4('0x43')][_0xd6d4('0x71')]({'where':{'id':_0x4e42d6[_0xd6d4('0x5e')]['id']}})['then'](handleEntityNotFound(_0x159519,null))['then'](function(_0x328146){if(_0x328146){_0xaecb14[_0xd6d4('0x4a')]=_[_0xd6d4('0x5f')](db[_0xd6d4('0xbb')][_0xd6d4('0x60')]);_0xaecb14[_0xd6d4('0x47')]=_[_0xd6d4('0x5f')](_0x4e42d6[_0xd6d4('0x47')]);_0xaecb14['filters']=_[_0xd6d4('0x49')](_0xaecb14[_0xd6d4('0x4a')],_0xaecb14[_0xd6d4('0x47')]);_0x273473['attributes']=_[_0xd6d4('0x49')](_0xaecb14['model'],qs[_0xd6d4('0x4c')](_0x4e42d6[_0xd6d4('0x47')]['fields']));_0x273473[_0xd6d4('0x4b')]=_0x273473[_0xd6d4('0x4b')][_0xd6d4('0x4d')]?_0x273473['attributes']:_0xaecb14[_0xd6d4('0x4a')];if(!_0x4e42d6[_0xd6d4('0x47')]['hasOwnProperty']('nolimit')){_0x273473['limit']=qs['limit'](_0x4e42d6[_0xd6d4('0x47')]['limit']);_0x273473[_0xd6d4('0x34')]=qs[_0xd6d4('0x34')](_0x4e42d6[_0xd6d4('0x47')][_0xd6d4('0x34')]);}_0x273473[_0xd6d4('0x50')]=qs[_0xd6d4('0x51')](_0x4e42d6[_0xd6d4('0x47')][_0xd6d4('0x51')]);_0x273473[_0xd6d4('0x52')]=qs[_0xd6d4('0x48')](_[_0xd6d4('0x53')](_0x4e42d6[_0xd6d4('0x47')],_0xaecb14[_0xd6d4('0x48')]));_0x273473[_0xd6d4('0x52')][_0xd6d4('0x6e')]=_0x328146['id'];if(_0x4e42d6[_0xd6d4('0x47')][_0xd6d4('0x54')]){_0x273473[_0xd6d4('0x52')]=_['merge'](_0x273473[_0xd6d4('0x52')],{'$or':_[_0xd6d4('0x56')](_0x273473[_0xd6d4('0x4b')],function(_0x4065bc){var _0x2c14d8={};_0x2c14d8[_0x4065bc]={'$like':'%'+_0x4e42d6[_0xd6d4('0x47')][_0xd6d4('0x54')]+'%'};return _0x2c14d8;})});}_0x273473=_[_0xd6d4('0x55')]({},_0x273473,_0x4e42d6[_0xd6d4('0x58')]);return db[_0xd6d4('0xbb')][_0xd6d4('0x33')]({'where':_0x273473[_0xd6d4('0x52')]})[_0xd6d4('0x25')](function(_0x4beba3){_0x5f3921[_0xd6d4('0x33')]=_0x4beba3;if(_0x4e42d6[_0xd6d4('0x47')]['includeAll']){_0x273473['include']=[{'model':db['CmContact'],'as':_0xd6d4('0xe9'),'required':![]},{'model':db['User'],'as':_0xd6d4('0xea'),'attributes':['name',_0xd6d4('0xeb'),_0xd6d4('0xec')],'required':![]},{'model':db['Tag'],'as':_0xd6d4('0xed'),'attributes':['id',_0xd6d4('0x3e'),_0xd6d4('0xee')],'where':_0x4e42d6[_0xd6d4('0x47')][_0xd6d4('0xef')]?{'id':_0x4e42d6[_0xd6d4('0x47')][_0xd6d4('0xef')]}:undefined,'required':_0x4e42d6[_0xd6d4('0x47')][_0xd6d4('0xef')]?!![]:![]}];}return db[_0xd6d4('0xbb')][_0xd6d4('0x5b')](_0x273473);})[_0xd6d4('0x25')](function(_0x5b5b15){_0x5f3921['rows']=_0x5b5b15;return _0x5f3921;});}})[_0xd6d4('0x25')](respondWithFilteredResult(_0x159519,_0x273473))[_0xd6d4('0x2e')](handleError(_0x159519,null));};function iftimePromise(_0x5985e4,_0x112ca0){return respondWithRpcPromise('Command',_0xd6d4('0xf0'),{'command':_0x112ca0[_0xd6d4('0xf1')]?util[_0xd6d4('0xb5')](_0xd6d4('0xf2'),_0x5985e4[_0xd6d4('0xf3')],_0x112ca0[_0xd6d4('0xf1')]):util[_0xd6d4('0xb5')](_0xd6d4('0xf4'),_0x5985e4[_0xd6d4('0xf3')])},client9002)[_0xd6d4('0x25')](function(_0x5927bb){var _0x3d70aa=_0x5927bb&&_0x5927bb[_0xd6d4('0xf5')](_0xd6d4('0xf6'))>=0x0?!![]:![];logger[_0xd6d4('0x26')](_0xd6d4('0xf7'),_0x112ca0['id'],_0x5985e4['id'],_0x5985e4[_0xd6d4('0xf3')],_0x3d70aa?_0xd6d4('0xf8'):'OFFLINE',_0x112ca0[_0xd6d4('0xf1')]?_0x112ca0[_0xd6d4('0xf1')]:_0xd6d4('0xf9'));return _0x3d70aa;})[_0xd6d4('0x2e')](function(_0x76b751){logger[_0xd6d4('0x2a')](_0xd6d4('0xf7'),_0x112ca0['id'],_0x5985e4['id'],_0x5985e4[_0xd6d4('0xf3')],util[_0xd6d4('0xfa')](_0x76b751,{'showHidden':![],'depth':null}),_0x112ca0['timezone']?_0x112ca0[_0xd6d4('0xf1')]:_0xd6d4('0xf9'));return![];});}exports[_0xd6d4('0xf0')]=function(_0x34b0b5,_0x5e0f60,_0x564296){var _0x17ff65=0x0;var _0x2eb056=0x0;var _0x57436d=![];var _0x5f0e50;var _0x326e96;return db[_0xd6d4('0x43')][_0xd6d4('0x67')]({'where':{'id':_0x34b0b5['params']['id']},'include':[{'model':db[_0xd6d4('0xfb')],'as':_0xd6d4('0xfb'),'include':[{'model':db['Interval'],'as':_0xd6d4('0xfc'),'attributes':['id','interval'],'raw':!![]}]}]})[_0xd6d4('0x25')](handleEntityNotFound(_0x5e0f60,null))['then'](function(_0x2eb34c){if(_0x2eb34c){_0x5f0e50=_0x2eb34c;return _0x2eb34c[_0xd6d4('0xfd')]({'raw':!![]});}})['then'](function(_0x37b0eb){if(_0x5f0e50){if(_0x37b0eb){_0x326e96=_0x37b0eb;}}return require(_0xd6d4('0x1a'))[_0xd6d4('0xfe')]();})[_0xd6d4('0x25')](function(_0x1078f8){if(_0x1078f8){_0x2eb056=_0x1078f8[_0xd6d4('0xff')];_0x57436d=_0x1078f8['custom'];}})[_0xd6d4('0x25')](function(){return db[_0xd6d4('0xbb')][_0xd6d4('0x33')]({'where':{'closed':![]}});})[_0xd6d4('0x25')](function(_0x1e059a){_0x17ff65=_0x1e059a;if(_0x2eb056&&_0x1e059a>_0x2eb056){return db['License'][_0xd6d4('0x71')]({'where':{'id':0x1}})['then'](function(_0x11167f){if(_0x11167f){_0x11167f[_0xd6d4('0x100')](_0xd6d4('0x101'));}});}})[_0xd6d4('0x25')](function(){if(_0x5f0e50[_0xd6d4('0xfb')]&&_0x5f0e50[_0xd6d4('0xfb')][_0xd6d4('0xfc')]){var _0xcb56cc=[];for(var _0x297221=0x0;_0x297221<_0x5f0e50[_0xd6d4('0xfb')][_0xd6d4('0xfc')][_0xd6d4('0x4d')];_0x297221++){var _0x4730ad=_0x5f0e50[_0xd6d4('0xfb')]['Intervals'][_0x297221]['get']({'plain':!![]});_0xcb56cc[_0xd6d4('0x102')](iftimePromise(_0x4730ad,_0x5f0e50));}return BPromise[_0xd6d4('0x103')](_0xcb56cc)[_0xd6d4('0x25')](function(_0x142c85){return _[_0xd6d4('0x104')](_0x142c85);});}else{return!![];}})[_0xd6d4('0x25')](function(_0x26331e){var _0x329b4c=fs[_0xd6d4('0xd5')](path[_0xd6d4('0x83')](config[_0xd6d4('0x80')],'server/files/chat/iframe.js'),'utf8');var _0x228f6d={'remote':_0x5f0e50[_0xd6d4('0x105')],'query':querystring[_0xd6d4('0xb9')](_['merge'](_0x5f0e50[_0xd6d4('0x3b')]({'plain':!![]}),{'customerIp':_0x34b0b5[_0xd6d4('0x91')][_0xd6d4('0x106')]||_0x34b0b5['headers'][_0xd6d4('0x107')]||_0x34b0b5[_0xd6d4('0x108')]['remoteAddress']||_0x34b0b5['ip'],'referer':_0x34b0b5[_0xd6d4('0x91')][_0xd6d4('0xb2')],'openedInteractions':_0x17ff65,'maxInteractions':_0x2eb056,'virtual':_0x57436d[_0xd6d4('0xff')],'online':_0x26331e,'custom':_0x57436d}))['replace'](/'/g,'\x5c\x27')};_0x5e0f60[_0xd6d4('0x3f')](ejs[_0xd6d4('0x109')](Mustache[_0xd6d4('0x109')](_0x329b4c,_0x228f6d),{'proactiveActions':_0x326e96,'alignment':_0x5f0e50['alignment'],'verticalAlignment':_0x5f0e50[_0xd6d4('0x10a')],'div_color':_0x5f0e50[_0xd6d4('0xee')],'text_color':_0x5f0e50[_0xd6d4('0x10b')]}));})[_0xd6d4('0x2e')](handleError(_0x5e0f60,null));};exports[_0xd6d4('0x10c')]=function(_0x488868,_0x3cc013,_0x34b33e){return db[_0xd6d4('0x43')]['findOne']({'where':{'id':_0x488868[_0xd6d4('0x5e')]['id']}})[_0xd6d4('0x25')](handleEntityNotFound(_0x3cc013,null))[_0xd6d4('0x25')](function(_0x432985){if(_0x432985){return db['sequelize']['transaction'](function(_0x5bac2e){return db[_0xd6d4('0x10d')]['destroy']({'where':{'ChatWebsiteId':_0x488868['params']['id']},'transaction':_0x5bac2e})[_0xd6d4('0x25')](function(_0x5c3925){var _0x1570ca=_[_0xd6d4('0x56')](_0x488868[_0xd6d4('0x62')],function(_0x831572){_0x831572['ChatWebsiteId']=_0x488868[_0xd6d4('0x5e')]['id'];return _0x831572;});return db[_0xd6d4('0x10d')][_0xd6d4('0x10e')](_0x1570ca,{'transaction':_0x5bac2e});});})[_0xd6d4('0x25')](function(){return db[_0xd6d4('0x10d')][_0xd6d4('0x10f')]({'where':{'ChatWebsiteId':_0x488868['params']['id']},'order':'priority'});});}})[_0xd6d4('0x25')](respondWithResult(_0x3cc013,null))[_0xd6d4('0x2e')](handleError(_0x3cc013,null));};exports['getApplications']=function(_0x13a689,_0x510c2f,_0x4a9c45){var _0xb6c1fc={};var _0x103326={};var _0x55a7c3;var _0x5a741e;return db[_0xd6d4('0x43')]['findOne']({'where':{'id':_0x13a689[_0xd6d4('0x5e')]['id']}})[_0xd6d4('0x25')](handleEntityNotFound(_0x510c2f,null))['then'](function(_0x45146c){if(_0x45146c){_0x55a7c3=_0x45146c;_0x103326['model']=_[_0xd6d4('0x5f')](db[_0xd6d4('0x10d')][_0xd6d4('0x60')]);_0x103326[_0xd6d4('0x47')]=_[_0xd6d4('0x5f')](_0x13a689[_0xd6d4('0x47')]);_0x103326[_0xd6d4('0x48')]=_['intersection'](_0x103326[_0xd6d4('0x4a')],_0x103326['query']);_0xb6c1fc[_0xd6d4('0x4b')]=_['intersection'](_0x103326[_0xd6d4('0x4a')],qs['fields'](_0x13a689['query']['fields']));_0xb6c1fc['attributes']=_0xb6c1fc[_0xd6d4('0x4b')][_0xd6d4('0x4d')]?_0xb6c1fc[_0xd6d4('0x4b')]:_0x103326[_0xd6d4('0x4a')];_0xb6c1fc[_0xd6d4('0x50')]=qs[_0xd6d4('0x51')](_0x13a689[_0xd6d4('0x47')][_0xd6d4('0x51')]);_0xb6c1fc[_0xd6d4('0x52')]=qs[_0xd6d4('0x48')](_[_0xd6d4('0x53')](_0x13a689[_0xd6d4('0x47')],_0x103326[_0xd6d4('0x48')]));if(_0x13a689[_0xd6d4('0x47')][_0xd6d4('0x54')]){_0xb6c1fc[_0xd6d4('0x52')]=_['merge'](_0xb6c1fc[_0xd6d4('0x52')],{'$or':_[_0xd6d4('0x56')](_0xb6c1fc[_0xd6d4('0x4b')],function(_0x1a75b0){var _0x4906d8={};_0x4906d8[_0x1a75b0]={'$like':'%'+_0x13a689[_0xd6d4('0x47')][_0xd6d4('0x54')]+'%'};return _0x4906d8;})});}_0xb6c1fc=_[_0xd6d4('0x55')]({},_0xb6c1fc,_0x13a689[_0xd6d4('0x58')]);return _0x55a7c3[_0xd6d4('0x110')](_0xb6c1fc);}})[_0xd6d4('0x25')](function(_0x1f55a2){if(_0x1f55a2){_0x5a741e=_0x1f55a2[_0xd6d4('0x4d')];if(!_0x13a689[_0xd6d4('0x47')][_0xd6d4('0x4e')](_0xd6d4('0x4f'))){_0xb6c1fc['limit']=qs[_0xd6d4('0x35')](_0x13a689[_0xd6d4('0x47')][_0xd6d4('0x35')]);_0xb6c1fc[_0xd6d4('0x34')]=qs['offset'](_0x13a689[_0xd6d4('0x47')][_0xd6d4('0x34')]);}return _0x55a7c3[_0xd6d4('0x110')](_0xb6c1fc);}})['then'](function(_0xb7de97){if(_0xb7de97){return _0xb7de97?{'count':_0x5a741e,'rows':_0xb7de97}:null;}})[_0xd6d4('0x25')](respondWithResult(_0x510c2f,null))[_0xd6d4('0x2e')](handleError(_0x510c2f,null));};exports['addProactiveActions']=function(_0x20e1ac,_0xdf096,_0x1aab85){return db[_0xd6d4('0x111')]['find']({'where':{'id':_0x20e1ac[_0xd6d4('0x5e')]['id']}})['then'](handleEntityNotFound(_0xdf096,null))[_0xd6d4('0x25')](function(_0x1abfbb){if(_0x1abfbb){return _0x1abfbb['addProactiveActions'](_0x20e1ac['body'][_0xd6d4('0x77')],_['omit'](_0x20e1ac['body'],[_0xd6d4('0x77'),'id'])||{});}})[_0xd6d4('0x25')](respondWithResult(_0xdf096,null))[_0xd6d4('0x2e')](handleError(_0xdf096,null));};exports[_0xd6d4('0xfd')]=function(_0x88ca3,_0x56511c,_0x3d4c82){var _0x37097f={};var _0x36aa31={};var _0x166663;var _0xa85fd;return db[_0xd6d4('0x43')][_0xd6d4('0x71')]({'where':{'id':_0x88ca3[_0xd6d4('0x5e')]['id']}})[_0xd6d4('0x25')](handleEntityNotFound(_0x56511c,null))['then'](function(_0x522df0){if(_0x522df0){_0x166663=_0x522df0;_0x36aa31[_0xd6d4('0x4a')]=_[_0xd6d4('0x5f')](db[_0xd6d4('0x112')]['rawAttributes']);_0x36aa31[_0xd6d4('0x47')]=_[_0xd6d4('0x5f')](_0x88ca3[_0xd6d4('0x47')]);_0x36aa31[_0xd6d4('0x48')]=_['intersection'](_0x36aa31['model'],_0x36aa31['query']);_0x37097f[_0xd6d4('0x4b')]=_[_0xd6d4('0x49')](_0x36aa31[_0xd6d4('0x4a')],qs[_0xd6d4('0x4c')](_0x88ca3[_0xd6d4('0x47')]['fields']));_0x37097f[_0xd6d4('0x4b')]=_0x37097f[_0xd6d4('0x4b')][_0xd6d4('0x4d')]?_0x37097f[_0xd6d4('0x4b')]:_0x36aa31[_0xd6d4('0x4a')];_0x37097f[_0xd6d4('0x50')]=qs[_0xd6d4('0x51')](_0x88ca3[_0xd6d4('0x47')][_0xd6d4('0x51')]);_0x37097f[_0xd6d4('0x52')]=qs[_0xd6d4('0x48')](_[_0xd6d4('0x53')](_0x88ca3[_0xd6d4('0x47')],_0x36aa31[_0xd6d4('0x48')]));if(_0x88ca3['query'][_0xd6d4('0x54')]){_0x37097f[_0xd6d4('0x52')]=_[_0xd6d4('0x55')](_0x37097f[_0xd6d4('0x52')],{'$or':_[_0xd6d4('0x56')](_0x37097f[_0xd6d4('0x4b')],function(_0x45adbb){var _0x107fc5={};_0x107fc5[_0x45adbb]={'$like':'%'+_0x88ca3['query'][_0xd6d4('0x54')]+'%'};return _0x107fc5;})});}_0x37097f=_[_0xd6d4('0x55')]({},_0x37097f,_0x88ca3[_0xd6d4('0x58')]);return _0x166663[_0xd6d4('0xfd')](_0x37097f);}})['then'](function(_0x385441){if(_0x385441){_0xa85fd=_0x385441['length'];if(!_0x88ca3[_0xd6d4('0x47')]['hasOwnProperty'](_0xd6d4('0x4f'))){_0x37097f[_0xd6d4('0x35')]=qs['limit'](_0x88ca3[_0xd6d4('0x47')]['limit']);_0x37097f[_0xd6d4('0x34')]=qs['offset'](_0x88ca3[_0xd6d4('0x47')][_0xd6d4('0x34')]);}return _0x166663[_0xd6d4('0xfd')](_0x37097f);}})[_0xd6d4('0x25')](function(_0x3ea8be){if(_0x3ea8be){return _0x3ea8be?{'count':_0xa85fd,'rows':_0x3ea8be}:null;}})[_0xd6d4('0x25')](respondWithResult(_0x56511c,null))[_0xd6d4('0x2e')](handleError(_0x56511c,null));};exports[_0xd6d4('0x113')]=function(_0x282ec6,_0x15aed9,_0x42fd9f){var _0x596789=_0x282ec6[_0xd6d4('0x47')]['online']===_0xd6d4('0x114')?_0xd6d4('0x115'):_0xd6d4('0x116');return db[_0xd6d4('0x43')][_0xd6d4('0x67')]({'attributes':['id',_0x596789],'where':{'id':_0x282ec6['params']['id']}})[_0xd6d4('0x25')](handleEntityNotFound(_0x15aed9,null))[_0xd6d4('0x25')](function(_0xdfad36){if(_0xdfad36){var _0x3fd475=_0xdfad36[_0x596789];var _0x2bfedc=_0x3fd475&&_0x3fd475[_0xd6d4('0x117')]?_0x3fd475[_0xd6d4('0x117')]:[];_0x15aed9[_0xd6d4('0x3f')]({'fromKey':_[_0xd6d4('0x8d')](_0x3fd475[_0xd6d4('0x118')])?undefined:_0x3fd475[_0xd6d4('0x118')],'count':_0x2bfedc[_0xd6d4('0x4d')],'rows':_0x2bfedc});}})['catch'](handleError(_0x15aed9,null));};exports[_0xd6d4('0x119')]=function(_0x497033,_0x2c7ed3,_0x10fca7){var _0x2ce11f={'raw':![],'where':{}};var _0x4966ee={};var _0x3978e1={'count':0x0,'rows':[]};return db[_0xd6d4('0x43')][_0xd6d4('0x71')]({'where':{'id':_0x497033[_0xd6d4('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2c7ed3,null))['then'](function(_0x518e0e){if(_0x518e0e){_0x4966ee[_0xd6d4('0x4a')]=_[_0xd6d4('0x5f')](db[_0xd6d4('0x11a')][_0xd6d4('0x60')]);_0x4966ee[_0xd6d4('0x47')]=_[_0xd6d4('0x5f')](_0x497033[_0xd6d4('0x47')]);_0x4966ee[_0xd6d4('0x48')]=_['intersection'](_0x4966ee[_0xd6d4('0x4a')],_0x4966ee[_0xd6d4('0x47')]);_0x2ce11f[_0xd6d4('0x4b')]=_['intersection'](_0x4966ee['model'],qs['fields'](_0x497033[_0xd6d4('0x47')]['fields']));_0x2ce11f[_0xd6d4('0x4b')]=_0x2ce11f[_0xd6d4('0x4b')][_0xd6d4('0x4d')]?_0x2ce11f[_0xd6d4('0x4b')]:_0x4966ee[_0xd6d4('0x4a')];if(!_0x497033['query'][_0xd6d4('0x4e')]('nolimit')){_0x2ce11f['limit']=qs[_0xd6d4('0x35')](_0x497033[_0xd6d4('0x47')][_0xd6d4('0x35')]);_0x2ce11f[_0xd6d4('0x34')]=qs[_0xd6d4('0x34')](_0x497033[_0xd6d4('0x47')][_0xd6d4('0x34')]);}_0x2ce11f['order']=qs[_0xd6d4('0x51')](_0x497033[_0xd6d4('0x47')][_0xd6d4('0x51')]);_0x2ce11f['where']=qs[_0xd6d4('0x48')](_[_0xd6d4('0x53')](_0x497033['query'],_0x4966ee[_0xd6d4('0x48')]));_0x2ce11f[_0xd6d4('0x52')][_0xd6d4('0x6e')]=_0x518e0e['id'];if(_0x497033[_0xd6d4('0x47')][_0xd6d4('0x54')]){_0x2ce11f['where']=_[_0xd6d4('0x55')](_0x2ce11f['where'],{'$or':_[_0xd6d4('0x56')](_0x2ce11f['attributes'],function(_0x21c482){var _0x4d6c82={};_0x4d6c82[_0x21c482]={'$like':'%'+_0x497033['query'][_0xd6d4('0x54')]+'%'};return _0x4d6c82;})});}_0x2ce11f=_[_0xd6d4('0x55')]({},_0x2ce11f,_0x497033[_0xd6d4('0x58')]);return db[_0xd6d4('0x11a')]['count']({'where':_0x2ce11f[_0xd6d4('0x52')]})[_0xd6d4('0x25')](function(_0x23e0a4){_0x3978e1['count']=_0x23e0a4;if(_0x497033[_0xd6d4('0x47')][_0xd6d4('0x59')]){_0x2ce11f[_0xd6d4('0x5a')]=[{'all':!![]}];}else{_0x2ce11f[_0xd6d4('0x5a')]=[{'model':db['CmContact'],'as':'Contact','required':![]}];}return db[_0xd6d4('0x11a')][_0xd6d4('0x5b')](_0x2ce11f);})[_0xd6d4('0x25')](function(_0x5c539c){_0x3978e1[_0xd6d4('0x5c')]=_0x5c539c;return _0x3978e1;});}})['then'](respondWithFilteredResult(_0x2c7ed3,_0x2ce11f))[_0xd6d4('0x2e')](handleError(_0x2c7ed3,null));};exports['addAgents']=function(_0x20eca9,_0x4fab48,_0x42654d){return db['ChatWebsite']['find']({'where':{'id':_0x20eca9[_0xd6d4('0x5e')]['id']}})[_0xd6d4('0x25')](handleEntityNotFound(_0x4fab48,null))[_0xd6d4('0x25')](function(_0x2cc70d){if(_0x2cc70d){return _0x2cc70d['addAgents'](_0x20eca9['body']['ids'],_['omit'](_0x20eca9[_0xd6d4('0x62')],[_0xd6d4('0x77'),'id'])||{})[_0xd6d4('0xbf')](function(_0x4f51d3){for(var _0x494c66=0x0;_0x494c66<_0x20eca9['body'][_0xd6d4('0x77')][_0xd6d4('0x4d')];_0x494c66+=0x1){socket[_0xd6d4('0x11b')](_0xd6d4('0x11c'),{'UserId':_0x20eca9[_0xd6d4('0x62')][_0xd6d4('0x77')][_0x494c66],'ChatWebsiteId':_0x20eca9[_0xd6d4('0x5e')]['id']});}return _0x4f51d3;});}})[_0xd6d4('0x25')](respondWithResult(_0x4fab48,null))[_0xd6d4('0x2e')](handleError(_0x4fab48,null));};exports['removeAgents']=function(_0x4c3e4a,_0x16853e,_0x1dd511){return db[_0xd6d4('0x43')][_0xd6d4('0x67')]({'where':{'id':_0x4c3e4a[_0xd6d4('0x5e')]['id']}})[_0xd6d4('0x25')](handleEntityNotFound(_0x16853e,null))[_0xd6d4('0x25')](function(_0x504c20){if(_0x504c20){return _0x504c20[_0xd6d4('0x11d')](_0x4c3e4a['query'][_0xd6d4('0x77')])['then'](function(){if(_[_0xd6d4('0x11e')](_0x4c3e4a['query'][_0xd6d4('0x77')])){for(var _0x102669=0x0;_0x102669<_0x4c3e4a[_0xd6d4('0x47')]['ids'][_0xd6d4('0x4d')];_0x102669+=0x1){socket[_0xd6d4('0x11b')](_0xd6d4('0x11f'),{'UserId':Number(_0x4c3e4a['query'][_0xd6d4('0x77')][_0x102669]),'ChatWebsiteId':Number(_0x4c3e4a[_0xd6d4('0x5e')]['id'])});}}else{socket[_0xd6d4('0x11b')]('userChatWebsite:remove',{'UserId':Number(_0x4c3e4a['query']['ids']),'ChatWebsiteId':Number(_0x4c3e4a[_0xd6d4('0x5e')]['id'])});}});}})[_0xd6d4('0x25')](respondWithStatusCode(_0x16853e,null))[_0xd6d4('0x2e')](handleError(_0x16853e,null));};exports[_0xd6d4('0x120')]=function(_0x5a2ea3,_0x69b2b8,_0x525f42){var _0x4580cf={};var _0x27008f={};var _0x47da73;var _0x5b5426;return db[_0xd6d4('0x43')][_0xd6d4('0x71')]({'where':{'id':_0x5a2ea3[_0xd6d4('0x5e')]['id']}})[_0xd6d4('0x25')](handleEntityNotFound(_0x69b2b8,null))[_0xd6d4('0x25')](function(_0x170ef8){if(_0x170ef8){_0x47da73=_0x170ef8;_0x27008f['model']=_[_0xd6d4('0x5f')](db[_0xd6d4('0xc7')][_0xd6d4('0x60')]);_0x27008f[_0xd6d4('0x47')]=_[_0xd6d4('0x5f')](_0x5a2ea3['query']);_0x27008f[_0xd6d4('0x48')]=_['intersection'](_0x27008f[_0xd6d4('0x4a')],_0x27008f[_0xd6d4('0x47')]);_0x4580cf[_0xd6d4('0x4b')]=_[_0xd6d4('0x49')](_0x27008f['model'],qs[_0xd6d4('0x4c')](_0x5a2ea3[_0xd6d4('0x47')][_0xd6d4('0x4c')]));_0x4580cf[_0xd6d4('0x4b')]=_0x4580cf[_0xd6d4('0x4b')]['length']?_0x4580cf[_0xd6d4('0x4b')]:_0x27008f['model'];_0x4580cf[_0xd6d4('0x50')]=qs['sort'](_0x5a2ea3['query'][_0xd6d4('0x51')]);_0x4580cf[_0xd6d4('0x52')]=qs['filters'](_[_0xd6d4('0x53')](_0x5a2ea3[_0xd6d4('0x47')],_0x27008f[_0xd6d4('0x48')]));if(_0x5a2ea3['query']['filter']){_0x4580cf['where']=_['merge'](_0x4580cf['where'],{'$or':_[_0xd6d4('0x56')](_0x4580cf[_0xd6d4('0x4b')],function(_0x1a580e){var _0xee57c9={};_0xee57c9[_0x1a580e]={'$like':'%'+_0x5a2ea3['query'][_0xd6d4('0x54')]+'%'};return _0xee57c9;})});}_0x4580cf=_[_0xd6d4('0x55')]({},_0x4580cf,_0x5a2ea3[_0xd6d4('0x58')]);return _0x47da73[_0xd6d4('0x120')](_0x4580cf);}})[_0xd6d4('0x25')](function(_0xbba6ae){if(_0xbba6ae){_0x5b5426=_0xbba6ae[_0xd6d4('0x4d')];if(!_0x5a2ea3[_0xd6d4('0x47')]['hasOwnProperty']('nolimit')){_0x4580cf[_0xd6d4('0x35')]=qs[_0xd6d4('0x35')](_0x5a2ea3[_0xd6d4('0x47')][_0xd6d4('0x35')]);_0x4580cf[_0xd6d4('0x34')]=qs[_0xd6d4('0x34')](_0x5a2ea3[_0xd6d4('0x47')][_0xd6d4('0x34')]);}return _0x47da73[_0xd6d4('0x120')](_0x4580cf);}})[_0xd6d4('0x25')](function(_0x5cbdd8){if(_0x5cbdd8){return _0x5cbdd8?{'count':_0x5b5426,'rows':_0x5cbdd8}:null;}})['then'](respondWithResult(_0x69b2b8,null))['catch'](handleError(_0x69b2b8,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 868e62d..4e49fc2 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 _0x2caf=['exports','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x86ba06,_0x2e50d9){var _0xafb44a=function(_0x1dd5cd){while(--_0x1dd5cd){_0x86ba06['push'](_0x86ba06['shift']());}};_0xafb44a(++_0x2e50d9);}(_0x2caf,0x6a));var _0xf2ca=function(_0x53d709,_0x1906f6){_0x53d709=_0x53d709-0x0;var _0xc1f741=_0x2caf[_0x53d709];return _0xc1f741;};'use strict';var EventEmitter=require('events');var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xf2ca('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf2ca('0x1'),'afterDestroy':_0xf2ca('0x2')};function emitEvent(_0x43b96c){return function(_0x375e8b,_0x137501,_0x27fb1b){ChatWebsiteEvents[_0xf2ca('0x3')](_0x43b96c+':'+_0x375e8b['id'],_0x375e8b);ChatWebsiteEvents['emit'](_0x43b96c,_0x375e8b);_0x27fb1b(null);};}for(var e in events){if(events[_0xf2ca('0x4')](e)){var event=events[e];ChatWebsite[_0xf2ca('0x5')](e,emitEvent(event));}}module[_0xf2ca('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0x4c3c=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','remove','emit'];(function(_0x2c6754,_0x3cae36){var _0x17c154=function(_0x1ce45c){while(--_0x1ce45c){_0x2c6754['push'](_0x2c6754['shift']());}};_0x17c154(++_0x3cae36);}(_0x4c3c,0x1e3));var _0xc4c3=function(_0x331e28,_0x163e3c){_0x331e28=_0x331e28-0x0;var _0x42abb8=_0x4c3c[_0x331e28];return _0x42abb8;};'use strict';var EventEmitter=require(_0xc4c3('0x0'));var ChatWebsite=require(_0xc4c3('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xc4c3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xc4c3('0x3')};function emitEvent(_0x4c8e86){return function(_0x4da755,_0x4b9976,_0x1d62d9){ChatWebsiteEvents[_0xc4c3('0x4')](_0x4c8e86+':'+_0x4da755['id'],_0x4da755);ChatWebsiteEvents[_0xc4c3('0x4')](_0x4c8e86,_0x4da755);_0x1d62d9(null);};}for(var e in events){if(events[_0xc4c3('0x5')](e)){var event=events[e];ChatWebsite[_0xc4c3('0x6')](e,emitEvent(event));}}module[_0xc4c3('0x7')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index b7d1c16..5a4970e 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 _0xa0bc=['request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','util','../../config/logger','moment','bluebird'];(function(_0x3b18d1,_0x18efa0){var _0x401044=function(_0xa9a5ed){while(--_0xa9a5ed){_0x3b18d1['push'](_0x3b18d1['shift']());}};_0x401044(++_0x18efa0);}(_0xa0bc,0x1b6));var _0xca0b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa0bc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xca0b('0x0'));var logger=require(_0xca0b('0x1'))('api');var moment=require(_0xca0b('0x2'));var BPromise=require(_0xca0b('0x3'));var rp=require(_0xca0b('0x4'));var fs=require('fs');var path=require(_0xca0b('0x5'));var rimraf=require(_0xca0b('0x6'));var config=require(_0xca0b('0x7'));var attributes=require(_0xca0b('0x8'));module[_0xca0b('0x9')]=function(_0x3cb084,_0x1aac00){return _0x3cb084[_0xca0b('0xa')](_0xca0b('0xb'),attributes,{'tableName':_0xca0b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c81=['moment','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','lodash','util','api'];(function(_0x2f77c4,_0x445262){var _0x179ae6=function(_0xa9caf1){while(--_0xa9caf1){_0x2f77c4['push'](_0x2f77c4['shift']());}};_0x179ae6(++_0x445262);}(_0x3c81,0x102));var _0x13c8=function(_0x471c46,_0x2d13e6){_0x471c46=_0x471c46-0x0;var _0xab246e=_0x3c81[_0x471c46];return _0xab246e;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var logger=require('../../config/logger')(_0x13c8('0x2'));var moment=require(_0x13c8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x13c8('0x4'));var attributes=require(_0x13c8('0x5'));module[_0x13c8('0x6')]=function(_0x1c16f1,_0x2a4d66){return _0x1c16f1[_0x13c8('0x7')](_0x13c8('0x8'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 7c7fcdd..3ce7d0b 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 _0xd943=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','localhost','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x35f9e4,_0x519505){var _0x5985a7=function(_0x5581cb){while(--_0x5581cb){_0x35f9e4['push'](_0x35f9e4['shift']());}};_0x5985a7(++_0x519505);}(_0xd943,0x15d));var _0x3d94=function(_0x5aa14a,_0x1f3a3e){_0x5aa14a=_0x5aa14a-0x0;var _0x1324eb=_0xd943[_0x5aa14a];return _0x1324eb;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x3d94('0xa')],{'host':_0x3d94('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3d94('0xc'))[_0x3d94('0xd')](socket);function respondWithRpcPromise(_0x1cc58c,_0x5908a7,_0x182066){return new BPromise(function(_0x4ac968,_0x39e2fa){return client[_0x3d94('0xe')](_0x1cc58c,_0x182066)['then'](function(_0x1897de){logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));logger[_0x3d94('0x12')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5908a7,_0x3d94('0x11'),JSON[_0x3d94('0x13')](_0x1897de));if(_0x1897de[_0x3d94('0x14')]){if(_0x1897de['error'][_0x3d94('0x15')]===0x1f4){logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de['error'][_0x3d94('0x16')]);return _0x39e2fa(_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);}logger[_0x3d94('0x14')](_0x3d94('0x10'),_0x5908a7,_0x1897de[_0x3d94('0x14')][_0x3d94('0x16')]);return _0x4ac968(_0x1897de[_0x3d94('0x14')]['message']);}else{logger[_0x3d94('0xf')](_0x3d94('0x10'),_0x5908a7,_0x3d94('0x11'));_0x4ac968(_0x1897de[_0x3d94('0x17')][_0x3d94('0x16')]);}})[_0x3d94('0x18')](function(_0xef8b3){logger['error'](_0x3d94('0x10'),_0x5908a7,_0xef8b3);_0x39e2fa(_0xef8b3);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','lodash','util','moment'];(function(_0x3e531a,_0x28a82a){var _0x3c2574=function(_0x4a0c98){while(--_0x4a0c98){_0x3e531a['push'](_0x3e531a['shift']());}};_0x3c2574(++_0x28a82a);}(_0x2ef3,0xba));var _0x32ef=function(_0xe7fbf8,_0x675871){_0xe7fbf8=_0xe7fbf8-0x0;var _0x407797=_0x2ef3[_0xe7fbf8];return _0x407797;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x32ef('0xa')]=_[_0x32ef('0xb')](config[_0x32ef('0xa')],{'host':_0x32ef('0xc'),'port':0x18eb});var socket=require(_0x32ef('0xd'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xe'))[_0x32ef('0xf')](socket);function respondWithRpcPromise(_0x28275c,_0x77df79,_0x56eb42){return new BPromise(function(_0x5780e9,_0x401d0b){return client[_0x32ef('0x10')](_0x28275c,_0x56eb42)[_0x32ef('0x11')](function(_0x1499c2){logger['info'](_0x32ef('0x12'),_0x77df79,'request\x20sent');logger[_0x32ef('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x77df79,_0x32ef('0x14'),JSON[_0x32ef('0x15')](_0x1499c2));if(_0x1499c2['error']){if(_0x1499c2['error'][_0x32ef('0x16')]===0x1f4){logger['error'](_0x32ef('0x12'),_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x401d0b(_0x1499c2[_0x32ef('0x17')]['message']);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x77df79,_0x1499c2[_0x32ef('0x17')][_0x32ef('0x18')]);return _0x5780e9(_0x1499c2[_0x32ef('0x17')]['message']);}else{logger['info'](_0x32ef('0x12'),_0x77df79,_0x32ef('0x14'));_0x5780e9(_0x1499c2[_0x32ef('0x19')]['message']);}})[_0x32ef('0x1a')](function(_0x33e230){logger['error'](_0x32ef('0x12'),_0x77df79,_0x33e230);_0x401d0b(_0x33e230);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 1a73586..257f565 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 _0x7a54=['remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x2379ee,_0x3ac35a){var _0x485e76=function(_0x8ef4b){while(--_0x8ef4b){_0x2379ee['push'](_0x2379ee['shift']());}};_0x485e76(++_0x3ac35a);}(_0x7a54,0x106));var _0x47a5=function(_0x4d3ad6,_0x331a2d){_0x4d3ad6=_0x4d3ad6-0x0;var _0x138205=_0x7a54[_0x4d3ad6];return _0x138205;};'use strict';var ChatWebsiteEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){ChatWebsiteEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);ChatWebsiteEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x427cce,_0x718314){var _0x283078=function(_0x5ebae4){while(--_0x5ebae4){_0x427cce['push'](_0x427cce['shift']());}};_0x283078(++_0x718314);}(_0x5f2f,0x73));var _0xf5f2=function(_0x17d381,_0xea1707){_0x17d381=_0x17d381-0x0;var _0x17995e=_0x5f2f[_0x17d381];return _0x17995e;};'use strict';var ChatWebsiteEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatWebsiteEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatWebsiteEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 7e5350f..f51f034 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 _0x0b0e=['/:id/notify','notify','/:id/offline','addInteraction','addApplications','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','diskStorage','join','server/files/images/logos/','format','now','originalname','single','file','root','server/files/images/avatars/','%s-%s','addAvatar','addCustomerAvatar','addSystemAvatar'];(function(_0x20b7f0,_0x25a0ae){var _0x1432fe=function(_0x1406bd){while(--_0x1406bd){_0x20b7f0['push'](_0x20b7f0['shift']());}};_0x1432fe(++_0x25a0ae);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4991d6,_0x348deb){_0x4991d6=_0x4991d6-0x0;var _0x50faf7=_0x0b0e[_0x4991d6];return _0x50faf7;};'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 auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['get'](_0xe0b0('0xe'),auth[_0xe0b0('0x9')](),controller['getDispositions']);router[_0xe0b0('0x8')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x8')](_0xe0b0('0x11'),controller['getLogo']);router[_0xe0b0('0x8')](_0xe0b0('0x12'),controller[_0xe0b0('0x13')]);router[_0xe0b0('0x8')](_0xe0b0('0x14'),controller['getCustomerAvatar']);router[_0xe0b0('0x8')](_0xe0b0('0x15'),controller[_0xe0b0('0x16')]);router[_0xe0b0('0x8')](_0xe0b0('0x17'),auth['isAuthenticated'](),controller[_0xe0b0('0x18')]);router['get'](_0xe0b0('0x19'),controller[_0xe0b0('0x1a')]);router['get'](_0xe0b0('0x1b'),auth['isAuthenticated'](),controller[_0xe0b0('0x1c')]);router[_0xe0b0('0x8')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0xe0b0('0x1d')]);router['get']('/:id/fields',controller['getFields']);router[_0xe0b0('0x8')]('/:id/offline_messages',auth['isAuthenticated'](),controller[_0xe0b0('0x1e')]);router['get'](_0xe0b0('0x1f'),auth['isAuthenticated'](),controller[_0xe0b0('0x20')]);router[_0xe0b0('0x21')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x22')]);router[_0xe0b0('0x21')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xe0b0('0x23')]);router['post'](_0xe0b0('0xf'),auth[_0xe0b0('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer[_0xe0b0('0x24')]({'destination':function(_0x503883,_0x2208d0,_0x49a727){_0x49a727(null,path[_0xe0b0('0x25')](config['root'],_0xe0b0('0x26')));},'filename':function(_0x4de537,_0x4700cc,_0x4aafbe){_0x4aafbe(null,util[_0xe0b0('0x27')]('%s-%s',Date[_0xe0b0('0x28')](),_0x4700cc[_0xe0b0('0x29')]));}})});router[_0xe0b0('0x21')](_0xe0b0('0x11'),upload[_0xe0b0('0x2a')](_0xe0b0('0x2b')),controller['addLogo']);var upload=multer({'storage':multer[_0xe0b0('0x24')]({'destination':function(_0x1b8aa8,_0x5b7a64,_0x15e13b){_0x15e13b(null,path[_0xe0b0('0x25')](config[_0xe0b0('0x2c')],_0xe0b0('0x2d')));},'filename':function(_0x3cdbd5,_0x254cad,_0x136bd4){_0x136bd4(null,util['format'](_0xe0b0('0x2e'),Date[_0xe0b0('0x28')](),_0x254cad['originalname']));}})});router['post'](_0xe0b0('0x12'),upload[_0xe0b0('0x2a')](_0xe0b0('0x2b')),controller[_0xe0b0('0x2f')]);var upload=multer({'storage':multer[_0xe0b0('0x24')]({'destination':function(_0x5866e5,_0x32acfe,_0x3231fc){_0x3231fc(null,path[_0xe0b0('0x25')](config[_0xe0b0('0x2c')],_0xe0b0('0x2d')));},'filename':function(_0x4fe835,_0x3ebf2a,_0x208945){_0x208945(null,util[_0xe0b0('0x27')](_0xe0b0('0x2e'),Date[_0xe0b0('0x28')](),_0x3ebf2a[_0xe0b0('0x29')]));}})});router[_0xe0b0('0x21')](_0xe0b0('0x14'),upload[_0xe0b0('0x2a')](_0xe0b0('0x2b')),controller[_0xe0b0('0x30')]);var upload=multer({'storage':multer[_0xe0b0('0x24')]({'destination':function(_0x1d35bc,_0x2a1c44,_0xca25d){_0xca25d(null,path['join'](config[_0xe0b0('0x2c')],_0xe0b0('0x2d')));},'filename':function(_0xace58a,_0x1eb3f9,_0x1a2d24){_0x1a2d24(null,util[_0xe0b0('0x27')](_0xe0b0('0x2e'),Date['now'](),_0x1eb3f9['originalname']));}})});router['post']('/:id/system_avatar',upload[_0xe0b0('0x2a')](_0xe0b0('0x2b')),controller[_0xe0b0('0x31')]);router['post'](_0xe0b0('0x32'),controller[_0xe0b0('0x33')]);router[_0xe0b0('0x21')](_0xe0b0('0x34'),controller['offline']);router[_0xe0b0('0x21')](_0xe0b0('0x17'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x35')]);router[_0xe0b0('0x21')](_0xe0b0('0x1b'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x36')]);router[_0xe0b0('0x21')]('/:id/proactive_actions',auth[_0xe0b0('0x9')](),controller['addProactiveActions']);router[_0xe0b0('0x21')](_0xe0b0('0x1f'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x37')]);router['put'](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x38')]);router[_0xe0b0('0x39')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x3a')]);router[_0xe0b0('0x39')]('/:id/dispositions',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x3b')]);router['delete']('/:id/canned_answers',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x3c')]);router['delete'](_0xe0b0('0x1f'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x3d')]);module[_0xe0b0('0x3e')]=router; \ No newline at end of file +var _0x3423=['removeAgents','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getAnswers','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','getAgents','create','/:id/dispositions','addDisposition','post','/:id/canned_answers','addAnswer','diskStorage','join','format','now','single','file','addLogo','server/files/images/avatars/','%s-%s','root','originalname','addSystemAvatar','/:id/notify','notify','/:id/offline','addInteraction','/:id/applications','addProactiveActions','addAgents','update','delete','destroy','removeDispositions','/:id/users'];(function(_0x3b89c2,_0x38d8fd){var _0x6baa24=function(_0x5904cf){while(--_0x5904cf){_0x3b89c2['push'](_0x3b89c2['shift']());}};_0x6baa24(++_0x38d8fd);}(_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 auth=require(_0x3342('0x4'));var interaction=require(_0x3342('0x5'));var config=require(_0x3342('0x6'));var controller=require(_0x3342('0x7'));router[_0x3342('0x8')]('/',auth[_0x3342('0x9')](),controller[_0x3342('0xa')]);router[_0x3342('0x8')](_0x3342('0xb'),auth[_0x3342('0x9')](),controller[_0x3342('0xc')]);router[_0x3342('0x8')](_0x3342('0xd'),auth[_0x3342('0x9')](),controller[_0x3342('0xe')]);router['get']('/:id/dispositions',auth[_0x3342('0x9')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x3342('0xf')]);router[_0x3342('0x8')]('/:id/logo',controller[_0x3342('0x10')]);router['get'](_0x3342('0x11'),controller[_0x3342('0x12')]);router['get'](_0x3342('0x13'),controller[_0x3342('0x14')]);router[_0x3342('0x8')](_0x3342('0x15'),controller[_0x3342('0x16')]);router[_0x3342('0x8')](_0x3342('0x17'),auth['isAuthenticated'](),controller[_0x3342('0x18')]);router[_0x3342('0x8')]('/:id/snippet',controller[_0x3342('0x19')]);router[_0x3342('0x8')]('/:id/applications',auth['isAuthenticated'](),controller[_0x3342('0x1a')]);router[_0x3342('0x8')](_0x3342('0x1b'),auth[_0x3342('0x9')](),controller[_0x3342('0x1c')]);router[_0x3342('0x8')](_0x3342('0x1d'),controller[_0x3342('0x1e')]);router[_0x3342('0x8')]('/:id/offline_messages',auth[_0x3342('0x9')](),controller[_0x3342('0x1f')]);router[_0x3342('0x8')]('/:id/users',auth[_0x3342('0x9')](),controller[_0x3342('0x20')]);router['post']('/',auth[_0x3342('0x9')](),controller[_0x3342('0x21')]);router['post'](_0x3342('0x22'),auth['isAuthenticated'](),controller[_0x3342('0x23')]);router[_0x3342('0x24')](_0x3342('0x25'),auth[_0x3342('0x9')](),controller[_0x3342('0x26')]);var upload=multer({'storage':multer[_0x3342('0x27')]({'destination':function(_0x26eb87,_0x2d8622,_0x5d4f14){_0x5d4f14(null,path[_0x3342('0x28')](config['root'],'server/files/images/logos/'));},'filename':function(_0x986ab0,_0x52ba65,_0x5d2f0b){_0x5d2f0b(null,util[_0x3342('0x29')]('%s-%s',Date[_0x3342('0x2a')](),_0x52ba65['originalname']));}})});router['post']('/:id/logo',upload[_0x3342('0x2b')](_0x3342('0x2c')),controller[_0x3342('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xc275a1,_0x1275e2,_0x1cc542){_0x1cc542(null,path[_0x3342('0x28')](config['root'],_0x3342('0x2e')));},'filename':function(_0x3d6810,_0x387ba2,_0x301114){_0x301114(null,util[_0x3342('0x29')](_0x3342('0x2f'),Date[_0x3342('0x2a')](),_0x387ba2['originalname']));}})});router[_0x3342('0x24')]('/:id/avatar',upload[_0x3342('0x2b')](_0x3342('0x2c')),controller['addAvatar']);var upload=multer({'storage':multer[_0x3342('0x27')]({'destination':function(_0x1cc42d,_0x347d52,_0x4e7410){_0x4e7410(null,path['join'](config[_0x3342('0x30')],_0x3342('0x2e')));},'filename':function(_0x311cfe,_0x948535,_0x3156b5){_0x3156b5(null,util[_0x3342('0x29')](_0x3342('0x2f'),Date[_0x3342('0x2a')](),_0x948535[_0x3342('0x31')]));}})});router[_0x3342('0x24')](_0x3342('0x13'),upload[_0x3342('0x2b')]('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x3342('0x27')]({'destination':function(_0x58157e,_0x400019,_0x464650){_0x464650(null,path[_0x3342('0x28')](config[_0x3342('0x30')],_0x3342('0x2e')));},'filename':function(_0xd0256d,_0x956cde,_0x5d460c){_0x5d460c(null,util[_0x3342('0x29')](_0x3342('0x2f'),Date[_0x3342('0x2a')](),_0x956cde[_0x3342('0x31')]));}})});router[_0x3342('0x24')]('/:id/system_avatar',upload[_0x3342('0x2b')]('file'),controller[_0x3342('0x32')]);router[_0x3342('0x24')](_0x3342('0x33'),controller[_0x3342('0x34')]);router['post'](_0x3342('0x35'),controller['offline']);router[_0x3342('0x24')](_0x3342('0x17'),auth[_0x3342('0x9')](),controller[_0x3342('0x36')]);router[_0x3342('0x24')](_0x3342('0x37'),auth[_0x3342('0x9')](),controller['addApplications']);router[_0x3342('0x24')](_0x3342('0x1b'),auth['isAuthenticated'](),controller[_0x3342('0x38')]);router[_0x3342('0x24')]('/:id/users',auth[_0x3342('0x9')](),controller[_0x3342('0x39')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3342('0x3a')]);router[_0x3342('0x3b')]('/:id',auth[_0x3342('0x9')](),controller[_0x3342('0x3c')]);router[_0x3342('0x3b')](_0x3342('0x22'),auth[_0x3342('0x9')](),controller[_0x3342('0x3d')]);router[_0x3342('0x3b')](_0x3342('0x25'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x3342('0x3b')](_0x3342('0x3e'),auth[_0x3342('0x9')](),controller[_0x3342('0x3f')]);module[_0x3342('0x40')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 3ced7ab..0d4f435 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 _0x3d49=['AmazonAWS','exports','STRING','ENUM'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x3d49,0x151));var _0x93d4=function(_0x565d0a,_0x4927cc){_0x565d0a=_0x565d0a-0x0;var _0x24c211=_0x3d49[_0x565d0a];return _0x24c211;};'use strict';var Sequelize=require('sequelize');module[_0x93d4('0x0')]={'name':{'type':Sequelize[_0x93d4('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x93d4('0x2')](_0x93d4('0x3'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x93d4('0x1')]},'data2':{'type':Sequelize[_0x93d4('0x1')]}}; \ No newline at end of file +var _0x1ffe=['ENUM','AmazonAWS','Google','sequelize','exports','STRING'];(function(_0x3e3df9,_0x4cecec){var _0x513481=function(_0x111b0c){while(--_0x111b0c){_0x3e3df9['push'](_0x3e3df9['shift']());}};_0x513481(++_0x4cecec);}(_0x1ffe,0xa5));var _0xe1ff=function(_0x301924,_0x379152){_0x301924=_0x301924-0x0;var _0x323b6b=_0x1ffe[_0x301924];return _0x323b6b;};'use strict';var Sequelize=require(_0xe1ff('0x0'));module[_0xe1ff('0x1')]={'name':{'type':Sequelize[_0xe1ff('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xe1ff('0x3')](_0xe1ff('0x4'),_0xe1ff('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0xe1ff('0x2')]},'data2':{'type':Sequelize[_0xe1ff('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index d517561..456a400 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 _0xcc55=['type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','includeAll','rows','catch','show','params','include','find','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','update','then','destroy','error','name','index','map','CloudProvider','rawAttributes'];(function(_0x9bb8a6,_0x3a6235){var _0x2d3076=function(_0x25a71b){while(--_0x25a71b){_0x9bb8a6['push'](_0x9bb8a6['shift']());}};_0x2d3076(++_0x3a6235);}(_0xcc55,0x173));var _0x5cc5=function(_0x10821a,_0x35fd5f){_0x10821a=_0x10821a-0x0;var _0x1a9105=_0xcc55[_0x10821a];return _0x1a9105;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5cc5('0x0'));var rimraf=require(_0x5cc5('0x1'));var zipdir=require(_0x5cc5('0x2'));var jsonpatch=require(_0x5cc5('0x3'));var rp=require('request-promise');var moment=require(_0x5cc5('0x4'));var BPromise=require(_0x5cc5('0x5'));var Mustache=require('mustache');var util=require(_0x5cc5('0x6'));var path=require(_0x5cc5('0x7'));var sox=require(_0x5cc5('0x8'));var csv=require(_0x5cc5('0x9'));var ejs=require(_0x5cc5('0xa'));var fs=require('fs');var _=require(_0x5cc5('0xb'));var squel=require(_0x5cc5('0xc'));var crypto=require(_0x5cc5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5cc5('0xe'));var toCsv=require(_0x5cc5('0x9'));var querystring=require('querystring');var Papa=require(_0x5cc5('0xf'));var Redis=require('ioredis');var authService=require(_0x5cc5('0x10'));var qs=require(_0x5cc5('0x11'));var as=require(_0x5cc5('0x12'));var hardwareService=require(_0x5cc5('0x13'));var logger=require(_0x5cc5('0x14'))('api');var utils=require(_0x5cc5('0x15'));var config=require(_0x5cc5('0x16'));var licenseUtil=require(_0x5cc5('0x17'));var db=require(_0x5cc5('0x18'))['db'];function respondWithStatusCode(_0x3a0303,_0x1c2e7f){_0x1c2e7f=_0x1c2e7f||0xcc;return function(_0x3d877d){if(_0x3d877d){return _0x3a0303[_0x5cc5('0x19')](_0x1c2e7f);}return _0x3a0303[_0x5cc5('0x1a')](_0x1c2e7f)[_0x5cc5('0x1b')]();};}function respondWithResult(_0x14c1c8,_0x154970){_0x154970=_0x154970||0xc8;return function(_0x1b5a44){if(_0x1b5a44){return _0x14c1c8[_0x5cc5('0x1a')](_0x154970)[_0x5cc5('0x1c')](_0x1b5a44);}};}function respondWithFilteredResult(_0x28b540,_0x5933ae){return function(_0x104bcc){if(_0x104bcc){var _0x454b6f=_0x104bcc[_0x5cc5('0x1d')],_0x28b517=_0x5933ae[_0x5cc5('0x1e')],_0x585c9c=_0x5933ae[_0x5cc5('0x1e')]+_0x5933ae[_0x5cc5('0x1f')],_0x26cd2d;if(_0x585c9c>=_0x454b6f){_0x585c9c=_0x454b6f;_0x26cd2d=0xc8;}else{_0x26cd2d=0xce;}_0x28b540[_0x5cc5('0x1a')](_0x26cd2d);return _0x28b540[_0x5cc5('0x20')]('Content-Range',_0x28b517+'-'+_0x585c9c+'/'+_0x454b6f)['json'](_0x104bcc);}return null;};}function patchUpdates(_0x41af00){return function(_0x3c55c5){try{jsonpatch['apply'](_0x3c55c5,_0x41af00,!![]);}catch(_0x1517b3){return BPromise[_0x5cc5('0x21')](_0x1517b3);}return _0x3c55c5['save']();};}function saveUpdates(_0x533a87,_0x39bd3b){return function(_0x3e7cca){if(_0x3e7cca){return _0x3e7cca[_0x5cc5('0x22')](_0x533a87)[_0x5cc5('0x23')](function(_0x38fe19){return _0x38fe19;});}return null;};}function removeEntity(_0x1adeb2,_0x21b8bc){return function(_0x45df89){if(_0x45df89){return _0x45df89[_0x5cc5('0x24')]()[_0x5cc5('0x23')](function(){_0x1adeb2[_0x5cc5('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1323f3,_0x3fd1d8){return function(_0x1e63d2){if(!_0x1e63d2){_0x1323f3[_0x5cc5('0x19')](0x194);}return _0x1e63d2;};}function handleError(_0x1b4f01,_0x3cfc47){_0x3cfc47=_0x3cfc47||0x1f4;return function(_0x1d55f4){logger[_0x5cc5('0x25')](_0x1d55f4['stack']);if(_0x1d55f4['name']){delete _0x1d55f4[_0x5cc5('0x26')];}_0x1b4f01[_0x5cc5('0x1a')](_0x3cfc47)['send'](_0x1d55f4);};}exports[_0x5cc5('0x27')]=function(_0x4707de,_0x351481){var _0x31b1b6={},_0x22a86b={},_0x5ae1c4={'count':0x0,'rows':[]};var _0x41c4f1=_[_0x5cc5('0x28')](db[_0x5cc5('0x29')][_0x5cc5('0x2a')],function(_0x5ab823){return{'name':_0x5ab823['fieldName'],'type':_0x5ab823[_0x5cc5('0x2b')][_0x5cc5('0x2c')]};});_0x22a86b[_0x5cc5('0x2d')]=_['map'](_0x41c4f1,_0x5cc5('0x26'));_0x22a86b[_0x5cc5('0x2e')]=_[_0x5cc5('0x2f')](_0x4707de['query']);_0x22a86b[_0x5cc5('0x30')]=_[_0x5cc5('0x31')](_0x22a86b['model'],_0x22a86b[_0x5cc5('0x2e')]);_0x31b1b6[_0x5cc5('0x32')]=_['intersection'](_0x22a86b[_0x5cc5('0x2d')],qs['fields'](_0x4707de['query'][_0x5cc5('0x33')]));_0x31b1b6[_0x5cc5('0x32')]=_0x31b1b6['attributes']['length']?_0x31b1b6[_0x5cc5('0x32')]:_0x22a86b[_0x5cc5('0x2d')];if(!_0x4707de[_0x5cc5('0x2e')][_0x5cc5('0x34')](_0x5cc5('0x35'))){_0x31b1b6['limit']=qs[_0x5cc5('0x1f')](_0x4707de['query'][_0x5cc5('0x1f')]);_0x31b1b6[_0x5cc5('0x1e')]=qs[_0x5cc5('0x1e')](_0x4707de[_0x5cc5('0x2e')][_0x5cc5('0x1e')]);}_0x31b1b6[_0x5cc5('0x36')]=qs[_0x5cc5('0x37')](_0x4707de[_0x5cc5('0x2e')][_0x5cc5('0x37')]);_0x31b1b6['where']=qs[_0x5cc5('0x30')](_['pick'](_0x4707de[_0x5cc5('0x2e')],_0x22a86b[_0x5cc5('0x30')]),_0x41c4f1);if(_0x4707de[_0x5cc5('0x2e')][_0x5cc5('0x38')]){_0x31b1b6[_0x5cc5('0x39')]=_['merge'](_0x31b1b6['where'],{'$or':_[_0x5cc5('0x28')](_0x41c4f1,function(_0x508365){if(_0x508365[_0x5cc5('0x2b')]!==_0x5cc5('0x3a')){var _0x35da6c={};_0x35da6c[_0x508365[_0x5cc5('0x26')]]={'$like':'%'+_0x4707de[_0x5cc5('0x2e')][_0x5cc5('0x38')]+'%'};return _0x35da6c;}})});}_0x31b1b6=_[_0x5cc5('0x3b')]({},_0x31b1b6,_0x4707de[_0x5cc5('0x3c')]);var _0x55cf85={'where':_0x31b1b6[_0x5cc5('0x39')]};return db[_0x5cc5('0x29')][_0x5cc5('0x1d')](_0x55cf85)[_0x5cc5('0x23')](function(_0xcad360){_0x5ae1c4[_0x5cc5('0x1d')]=_0xcad360;if(_0x4707de[_0x5cc5('0x2e')][_0x5cc5('0x3d')]){_0x31b1b6['include']=[{'all':!![]}];}return db[_0x5cc5('0x29')]['findAll'](_0x31b1b6);})[_0x5cc5('0x23')](function(_0x239e2d){_0x5ae1c4[_0x5cc5('0x3e')]=_0x239e2d;return _0x5ae1c4;})[_0x5cc5('0x23')](respondWithFilteredResult(_0x351481,_0x31b1b6))[_0x5cc5('0x3f')](handleError(_0x351481,null));};exports[_0x5cc5('0x40')]=function(_0x23ccbf,_0x16e594){var _0x1801d1={'raw':!![],'where':{'id':_0x23ccbf[_0x5cc5('0x41')]['id']}},_0x213b96={};_0x213b96[_0x5cc5('0x2d')]=_[_0x5cc5('0x2f')](db[_0x5cc5('0x29')]['rawAttributes']);_0x213b96[_0x5cc5('0x2e')]=_[_0x5cc5('0x2f')](_0x23ccbf['query']);_0x213b96[_0x5cc5('0x30')]=_[_0x5cc5('0x31')](_0x213b96[_0x5cc5('0x2d')],_0x213b96[_0x5cc5('0x2e')]);_0x1801d1[_0x5cc5('0x32')]=_[_0x5cc5('0x31')](_0x213b96[_0x5cc5('0x2d')],qs[_0x5cc5('0x33')](_0x23ccbf[_0x5cc5('0x2e')][_0x5cc5('0x33')]));_0x1801d1[_0x5cc5('0x32')]=_0x1801d1['attributes']['length']?_0x1801d1[_0x5cc5('0x32')]:_0x213b96[_0x5cc5('0x2d')];if(_0x23ccbf['query'][_0x5cc5('0x3d')]){_0x1801d1[_0x5cc5('0x42')]=[{'all':!![]}];}_0x1801d1=_['merge']({},_0x1801d1,_0x23ccbf['options']);return db[_0x5cc5('0x29')][_0x5cc5('0x43')](_0x1801d1)[_0x5cc5('0x23')](handleEntityNotFound(_0x16e594,null))[_0x5cc5('0x23')](respondWithResult(_0x16e594,null))[_0x5cc5('0x3f')](handleError(_0x16e594,null));};exports['create']=function(_0x3b9f0f,_0x2c93f1){return db['CloudProvider']['create'](_0x3b9f0f[_0x5cc5('0x44')],{})['then'](respondWithResult(_0x2c93f1,0xc9))[_0x5cc5('0x3f')](handleError(_0x2c93f1,null));};exports[_0x5cc5('0x22')]=function(_0x38402a,_0x410872){if(_0x38402a[_0x5cc5('0x44')]['id']){delete _0x38402a['body']['id'];}return db[_0x5cc5('0x29')][_0x5cc5('0x43')]({'where':{'id':_0x38402a[_0x5cc5('0x41')]['id']}})['then'](handleEntityNotFound(_0x410872,null))['then'](saveUpdates(_0x38402a[_0x5cc5('0x44')],null))['then'](respondWithResult(_0x410872,null))[_0x5cc5('0x3f')](handleError(_0x410872,null));};exports[_0x5cc5('0x24')]=function(_0x148e28,_0x49b287){return db['CloudProvider']['find']({'where':{'id':_0x148e28[_0x5cc5('0x41')]['id']}})['then'](handleEntityNotFound(_0x49b287,null))[_0x5cc5('0x23')](removeEntity(_0x49b287,null))['catch'](handleError(_0x49b287,null));}; \ No newline at end of file +var _0x7eb9=['rows','catch','show','params','find','body','destroy','html-pdf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','index','CloudProvider','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x13cb33,_0x1eb1dc){var _0x471938=function(_0x24684a){while(--_0x24684a){_0x13cb33['push'](_0x13cb33['shift']());}};_0x471938(++_0x1eb1dc);}(_0x7eb9,0xd9));var _0x97eb=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7eb9[_0x17d9e3];return _0x14192d;};'use strict';var pdf=require(_0x97eb('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x97eb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97eb('0x2'));var moment=require(_0x97eb('0x3'));var BPromise=require(_0x97eb('0x4'));var Mustache=require(_0x97eb('0x5'));var util=require('util');var path=require(_0x97eb('0x6'));var sox=require('sox');var csv=require(_0x97eb('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x97eb('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x97eb('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x97eb('0x7'));var querystring=require(_0x97eb('0xa'));var Papa=require(_0x97eb('0xb'));var Redis=require(_0x97eb('0xc'));var authService=require(_0x97eb('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97eb('0xe'));var logger=require(_0x97eb('0xf'))(_0x97eb('0x10'));var utils=require(_0x97eb('0x11'));var config=require(_0x97eb('0x12'));var licenseUtil=require(_0x97eb('0x13'));var db=require(_0x97eb('0x14'))['db'];function respondWithStatusCode(_0x3ec39d,_0x1205d4){_0x1205d4=_0x1205d4||0xcc;return function(_0x37e165){if(_0x37e165){return _0x3ec39d[_0x97eb('0x15')](_0x1205d4);}return _0x3ec39d[_0x97eb('0x16')](_0x1205d4)[_0x97eb('0x17')]();};}function respondWithResult(_0x469bed,_0x55c44a){_0x55c44a=_0x55c44a||0xc8;return function(_0x226a95){if(_0x226a95){return _0x469bed[_0x97eb('0x16')](_0x55c44a)[_0x97eb('0x18')](_0x226a95);}};}function respondWithFilteredResult(_0x53bb82,_0x17801c){return function(_0x19477a){if(_0x19477a){var _0x823d10=_0x19477a[_0x97eb('0x19')],_0x4b8962=_0x17801c[_0x97eb('0x1a')],_0x551749=_0x17801c[_0x97eb('0x1a')]+_0x17801c[_0x97eb('0x1b')],_0x42efe3;if(_0x551749>=_0x823d10){_0x551749=_0x823d10;_0x42efe3=0xc8;}else{_0x42efe3=0xce;}_0x53bb82[_0x97eb('0x16')](_0x42efe3);return _0x53bb82['set'](_0x97eb('0x1c'),_0x4b8962+'-'+_0x551749+'/'+_0x823d10)['json'](_0x19477a);}return null;};}function patchUpdates(_0x4c9f9e){return function(_0x5349d3){try{jsonpatch[_0x97eb('0x1d')](_0x5349d3,_0x4c9f9e,!![]);}catch(_0x19f9c8){return BPromise[_0x97eb('0x1e')](_0x19f9c8);}return _0x5349d3[_0x97eb('0x1f')]();};}function saveUpdates(_0x4b25d2,_0xc3c93e){return function(_0x242bff){if(_0x242bff){return _0x242bff[_0x97eb('0x20')](_0x4b25d2)[_0x97eb('0x21')](function(_0x5c0ac1){return _0x5c0ac1;});}return null;};}function removeEntity(_0x3c238d,_0x4d5fe5){return function(_0x6c6277){if(_0x6c6277){return _0x6c6277['destroy']()[_0x97eb('0x21')](function(){_0x3c238d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d59b9,_0x978b54){return function(_0x508f3f){if(!_0x508f3f){_0x4d59b9[_0x97eb('0x15')](0x194);}return _0x508f3f;};}function handleError(_0x3bfe84,_0x3d323a){_0x3d323a=_0x3d323a||0x1f4;return function(_0x19822a){logger[_0x97eb('0x22')](_0x19822a[_0x97eb('0x23')]);if(_0x19822a[_0x97eb('0x24')]){delete _0x19822a[_0x97eb('0x24')];}_0x3bfe84[_0x97eb('0x16')](_0x3d323a)['send'](_0x19822a);};}exports[_0x97eb('0x25')]=function(_0x59aab8,_0x4be14e){var _0x2be576={},_0x450a1c={},_0xf29d0c={'count':0x0,'rows':[]};var _0x473db0=_['map'](db[_0x97eb('0x26')][_0x97eb('0x27')],function(_0x480e3a){return{'name':_0x480e3a['fieldName'],'type':_0x480e3a[_0x97eb('0x28')]['key']};});_0x450a1c[_0x97eb('0x29')]=_[_0x97eb('0x2a')](_0x473db0,_0x97eb('0x24'));_0x450a1c[_0x97eb('0x2b')]=_[_0x97eb('0x2c')](_0x59aab8['query']);_0x450a1c[_0x97eb('0x2d')]=_[_0x97eb('0x2e')](_0x450a1c[_0x97eb('0x29')],_0x450a1c[_0x97eb('0x2b')]);_0x2be576[_0x97eb('0x2f')]=_[_0x97eb('0x2e')](_0x450a1c['model'],qs['fields'](_0x59aab8['query'][_0x97eb('0x30')]));_0x2be576[_0x97eb('0x2f')]=_0x2be576['attributes'][_0x97eb('0x31')]?_0x2be576['attributes']:_0x450a1c['model'];if(!_0x59aab8[_0x97eb('0x2b')][_0x97eb('0x32')](_0x97eb('0x33'))){_0x2be576['limit']=qs[_0x97eb('0x1b')](_0x59aab8[_0x97eb('0x2b')][_0x97eb('0x1b')]);_0x2be576[_0x97eb('0x1a')]=qs['offset'](_0x59aab8[_0x97eb('0x2b')][_0x97eb('0x1a')]);}_0x2be576[_0x97eb('0x34')]=qs[_0x97eb('0x35')](_0x59aab8[_0x97eb('0x2b')]['sort']);_0x2be576[_0x97eb('0x36')]=qs[_0x97eb('0x2d')](_[_0x97eb('0x37')](_0x59aab8[_0x97eb('0x2b')],_0x450a1c[_0x97eb('0x2d')]),_0x473db0);if(_0x59aab8['query'][_0x97eb('0x38')]){_0x2be576[_0x97eb('0x36')]=_[_0x97eb('0x39')](_0x2be576[_0x97eb('0x36')],{'$or':_['map'](_0x473db0,function(_0x581dd0){if(_0x581dd0[_0x97eb('0x28')]!==_0x97eb('0x3a')){var _0x5ed9d5={};_0x5ed9d5[_0x581dd0[_0x97eb('0x24')]]={'$like':'%'+_0x59aab8[_0x97eb('0x2b')][_0x97eb('0x38')]+'%'};return _0x5ed9d5;}})});}_0x2be576=_[_0x97eb('0x39')]({},_0x2be576,_0x59aab8[_0x97eb('0x3b')]);var _0x40257e={'where':_0x2be576[_0x97eb('0x36')]};return db[_0x97eb('0x26')][_0x97eb('0x19')](_0x40257e)[_0x97eb('0x21')](function(_0x4e58dc){_0xf29d0c['count']=_0x4e58dc;if(_0x59aab8[_0x97eb('0x2b')][_0x97eb('0x3c')]){_0x2be576[_0x97eb('0x3d')]=[{'all':!![]}];}return db['CloudProvider'][_0x97eb('0x3e')](_0x2be576);})[_0x97eb('0x21')](function(_0x56add0){_0xf29d0c[_0x97eb('0x3f')]=_0x56add0;return _0xf29d0c;})[_0x97eb('0x21')](respondWithFilteredResult(_0x4be14e,_0x2be576))[_0x97eb('0x40')](handleError(_0x4be14e,null));};exports[_0x97eb('0x41')]=function(_0x7428f6,_0x40c59b){var _0x298637={'raw':!![],'where':{'id':_0x7428f6[_0x97eb('0x42')]['id']}},_0x3081fa={};_0x3081fa[_0x97eb('0x29')]=_['keys'](db[_0x97eb('0x26')][_0x97eb('0x27')]);_0x3081fa[_0x97eb('0x2b')]=_[_0x97eb('0x2c')](_0x7428f6['query']);_0x3081fa['filters']=_[_0x97eb('0x2e')](_0x3081fa[_0x97eb('0x29')],_0x3081fa[_0x97eb('0x2b')]);_0x298637[_0x97eb('0x2f')]=_[_0x97eb('0x2e')](_0x3081fa['model'],qs[_0x97eb('0x30')](_0x7428f6['query']['fields']));_0x298637[_0x97eb('0x2f')]=_0x298637[_0x97eb('0x2f')][_0x97eb('0x31')]?_0x298637[_0x97eb('0x2f')]:_0x3081fa[_0x97eb('0x29')];if(_0x7428f6[_0x97eb('0x2b')][_0x97eb('0x3c')]){_0x298637[_0x97eb('0x3d')]=[{'all':!![]}];}_0x298637=_[_0x97eb('0x39')]({},_0x298637,_0x7428f6[_0x97eb('0x3b')]);return db['CloudProvider'][_0x97eb('0x43')](_0x298637)[_0x97eb('0x21')](handleEntityNotFound(_0x40c59b,null))[_0x97eb('0x21')](respondWithResult(_0x40c59b,null))[_0x97eb('0x40')](handleError(_0x40c59b,null));};exports['create']=function(_0x2cbe3a,_0x4d1b8b){return db[_0x97eb('0x26')]['create'](_0x2cbe3a[_0x97eb('0x44')],{})['then'](respondWithResult(_0x4d1b8b,0xc9))[_0x97eb('0x40')](handleError(_0x4d1b8b,null));};exports['update']=function(_0x9b8bec,_0x2c237e){if(_0x9b8bec[_0x97eb('0x44')]['id']){delete _0x9b8bec[_0x97eb('0x44')]['id'];}return db[_0x97eb('0x26')]['find']({'where':{'id':_0x9b8bec['params']['id']}})[_0x97eb('0x21')](handleEntityNotFound(_0x2c237e,null))['then'](saveUpdates(_0x9b8bec[_0x97eb('0x44')],null))[_0x97eb('0x21')](respondWithResult(_0x2c237e,null))[_0x97eb('0x40')](handleError(_0x2c237e,null));};exports[_0x97eb('0x45')]=function(_0x5bfc22,_0x5204ac){return db[_0x97eb('0x26')][_0x97eb('0x43')]({'where':{'id':_0x5bfc22['params']['id']}})[_0x97eb('0x21')](handleEntityNotFound(_0x5204ac,null))[_0x97eb('0x21')](removeEntity(_0x5204ac,null))['catch'](handleError(_0x5204ac,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index f9d9654..4cd7b02 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 _0xacb6=['util','moment','bluebird','../../config/environment','./cloudProvider.attributes','exports','CloudProvider','cloud_providers','lodash'];(function(_0x16d369,_0xbbaa52){var _0x53c1ca=function(_0x49908d){while(--_0x49908d){_0x16d369['push'](_0x16d369['shift']());}};_0x53c1ca(++_0xbbaa52);}(_0xacb6,0xaa));var _0x6acb=function(_0xea147e,_0x364f3c){_0xea147e=_0xea147e-0x0;var _0x568031=_0xacb6[_0xea147e];return _0x568031;};'use strict';var _=require(_0x6acb('0x0'));var util=require(_0x6acb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6acb('0x2'));var BPromise=require(_0x6acb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6acb('0x4'));var attributes=require(_0x6acb('0x5'));module[_0x6acb('0x6')]=function(_0x56d5a0,_0x6f5260){return _0x56d5a0['define'](_0x6acb('0x7'),attributes,{'tableName':_0x6acb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e4f=['CloudProvider','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./cloudProvider.attributes'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0x3e4f,0xfb));var _0xf3e4=function(_0x78b453,_0x27972b){_0x78b453=_0x78b453-0x0;var _0x3fb909=_0x3e4f[_0x78b453];return _0x3fb909;};'use strict';var _=require(_0xf3e4('0x0'));var util=require(_0xf3e4('0x1'));var logger=require(_0xf3e4('0x2'))(_0xf3e4('0x3'));var moment=require(_0xf3e4('0x4'));var BPromise=require(_0xf3e4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf3e4('0x6'));var rimraf=require('rimraf');var config=require(_0xf3e4('0x7'));var attributes=require(_0xf3e4('0x8'));module['exports']=function(_0x2fc882,_0x116736){return _0x2fc882['define'](_0xf3e4('0x9'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 33c6f04..7c31e41 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 _0x4bd3=['http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xf74a50,_0x293979){var _0x3b8b71=function(_0x4147f3){while(--_0x4147f3){_0xf74a50['push'](_0xf74a50['shift']());}};_0x3b8b71(++_0x293979);}(_0x4bd3,0xee));var _0x34bd=function(_0x6f8058,_0x591872){_0x6f8058=_0x6f8058-0x0;var _0xc1e401=_0x4bd3[_0x6f8058];return _0xc1e401;};'use strict';var _=require(_0x34bd('0x0'));var util=require(_0x34bd('0x1'));var moment=require(_0x34bd('0x2'));var BPromise=require('bluebird');var rs=require(_0x34bd('0x3'));var fs=require('fs');var Redis=require(_0x34bd('0x4'));var db=require(_0x34bd('0x5'))['db'];var utils=require(_0x34bd('0x6'));var logger=require(_0x34bd('0x7'))(_0x34bd('0x8'));var config=require(_0x34bd('0x9'));var jayson=require(_0x34bd('0xa'));var client=jayson[_0x34bd('0xb')][_0x34bd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b8a4b,_0x8ce95f,_0xa552ba){return new BPromise(function(_0x23c7e1,_0x3f1ad8){return client['request'](_0x3b8a4b,_0xa552ba)[_0x34bd('0xd')](function(_0x240817){logger[_0x34bd('0xe')](_0x34bd('0xf'),_0x8ce95f,_0x34bd('0x10'));logger[_0x34bd('0x11')](_0x34bd('0x12'),_0x8ce95f,'request\x20sent',JSON[_0x34bd('0x13')](_0x240817));if(_0x240817[_0x34bd('0x14')]){if(_0x240817['error'][_0x34bd('0x15')]===0x1f4){logger[_0x34bd('0x14')](_0x34bd('0xf'),_0x8ce95f,_0x240817[_0x34bd('0x14')][_0x34bd('0x16')]);return _0x3f1ad8(_0x240817['error'][_0x34bd('0x16')]);}logger[_0x34bd('0x14')]('CloudProvider,\x20%s,\x20%s',_0x8ce95f,_0x240817[_0x34bd('0x14')][_0x34bd('0x16')]);return _0x23c7e1(_0x240817['error']['message']);}else{logger['info'](_0x34bd('0xf'),_0x8ce95f,'request\x20sent');_0x23c7e1(_0x240817[_0x34bd('0x17')][_0x34bd('0x16')]);}})[_0x34bd('0x18')](function(_0x5ac9b6){logger[_0x34bd('0x14')]('CloudProvider,\x20%s,\x20%s',_0x8ce95f,_0x5ac9b6);_0x3f1ad8(_0x5ac9b6);});});} \ No newline at end of file +var _0xc877=['request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc877,0x11c));var _0x7c87=function(_0x1dc2bf,_0x1546c1){_0x1dc2bf=_0x1dc2bf-0x0;var _0x3925bf=_0xc877[_0x1dc2bf];return _0x3925bf;};'use strict';var _=require('lodash');var util=require(_0x7c87('0x0'));var moment=require(_0x7c87('0x1'));var BPromise=require('bluebird');var rs=require(_0x7c87('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c87('0x3'))['db'];var utils=require(_0x7c87('0x4'));var logger=require(_0x7c87('0x5'))(_0x7c87('0x6'));var config=require(_0x7c87('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7c87('0x8')][_0x7c87('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43eb27,_0x5b54ea,_0x263de8){return new BPromise(function(_0x1f96f9,_0x50aeb3){return client[_0x7c87('0xa')](_0x43eb27,_0x263de8)[_0x7c87('0xb')](function(_0x451534){logger[_0x7c87('0xc')](_0x7c87('0xd'),_0x5b54ea,_0x7c87('0xe'));logger[_0x7c87('0xf')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x5b54ea,_0x7c87('0xe'),JSON[_0x7c87('0x10')](_0x451534));if(_0x451534[_0x7c87('0x11')]){if(_0x451534[_0x7c87('0x11')]['code']===0x1f4){logger['error'](_0x7c87('0xd'),_0x5b54ea,_0x451534['error'][_0x7c87('0x12')]);return _0x50aeb3(_0x451534[_0x7c87('0x11')][_0x7c87('0x12')]);}logger['error'](_0x7c87('0xd'),_0x5b54ea,_0x451534[_0x7c87('0x11')][_0x7c87('0x12')]);return _0x1f96f9(_0x451534[_0x7c87('0x11')][_0x7c87('0x12')]);}else{logger[_0x7c87('0xc')]('CloudProvider,\x20%s,\x20%s',_0x5b54ea,_0x7c87('0xe'));_0x1f96f9(_0x451534[_0x7c87('0x13')][_0x7c87('0x12')]);}})[_0x7c87('0x14')](function(_0x375488){logger['error'](_0x7c87('0xd'),_0x5b54ea,_0x375488);_0x50aeb3(_0x375488);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 06b4577..dc714fd 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 _0x372d=['exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x372d,0x145));var _0xd372=function(_0x6968b9,_0x28e182){_0x6968b9=_0x6968b9-0x0;var _0x40dd4c=_0x372d[_0x6968b9];return _0x40dd4c;};'use strict';var multer=require(_0xd372('0x0'));var util=require(_0xd372('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd372('0x2'));var router=express[_0xd372('0x3')]();var auth=require(_0xd372('0x4'));var interaction=require(_0xd372('0x5'));var config=require(_0xd372('0x6'));var controller=require('./cloudProvider.controller');router[_0xd372('0x7')]('/',auth[_0xd372('0x8')](),controller[_0xd372('0x9')]);router[_0xd372('0x7')](_0xd372('0xa'),auth['isAuthenticated'](),controller[_0xd372('0xb')]);router[_0xd372('0xc')]('/',auth[_0xd372('0x8')](),controller['create']);router[_0xd372('0xd')](_0xd372('0xa'),auth['isAuthenticated'](),controller[_0xd372('0xe')]);router[_0xd372('0xf')]('/:id',auth[_0xd372('0x8')](),controller[_0xd372('0x10')]);module[_0xd372('0x11')]=router; \ No newline at end of file +var _0xac14=['destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','get','isAuthenticated','index','show','post','put','/:id','update'];(function(_0x421093,_0x1aa87a){var _0x4d5060=function(_0x37df31){while(--_0x37df31){_0x421093['push'](_0x421093['shift']());}};_0x4d5060(++_0x1aa87a);}(_0xac14,0xb2));var _0x4ac1=function(_0x16fe9b,_0x1e2330){_0x16fe9b=_0x16fe9b-0x0;var _0x2fbc3c=_0xac14[_0x16fe9b];return _0x2fbc3c;};'use strict';var multer=require(_0x4ac1('0x0'));var util=require(_0x4ac1('0x1'));var path=require(_0x4ac1('0x2'));var timeout=require(_0x4ac1('0x3'));var express=require(_0x4ac1('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4ac1('0x5'));var config=require('../../config/environment');var controller=require('./cloudProvider.controller');router[_0x4ac1('0x6')]('/',auth[_0x4ac1('0x7')](),controller[_0x4ac1('0x8')]);router[_0x4ac1('0x6')]('/:id',auth[_0x4ac1('0x7')](),controller[_0x4ac1('0x9')]);router[_0x4ac1('0xa')]('/',auth[_0x4ac1('0x7')](),controller['create']);router[_0x4ac1('0xb')](_0x4ac1('0xc'),auth[_0x4ac1('0x7')](),controller[_0x4ac1('0xd')]);router['delete']('/:id',auth[_0x4ac1('0x7')](),controller[_0x4ac1('0xe')]);module[_0x4ac1('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 43127ba..1306bad 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 _0xc663=['STRING','sequelize','exports'];(function(_0x405508,_0xf386a){var _0x4af83c=function(_0x52ba5c){while(--_0x52ba5c){_0x405508['push'](_0x405508['shift']());}};_0x4af83c(++_0xf386a);}(_0xc663,0x139));var _0x3c66=function(_0x4a973e,_0x29034b){_0x4a973e=_0x4a973e-0x0;var _0x36b56e=_0xc663[_0x4a973e];return _0x36b56e;};'use strict';var Sequelize=require(_0x3c66('0x0'));module[_0x3c66('0x1')]={'name':{'type':Sequelize[_0x3c66('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x3c66('0x2')]},'companyId':{'type':Sequelize[_0x3c66('0x2')]},'website':{'type':Sequelize[_0x3c66('0x2')]},'phone':{'type':Sequelize[_0x3c66('0x2')]},'fax':{'type':Sequelize[_0x3c66('0x2')]},'type':{'type':Sequelize[_0x3c66('0x2')]},'street':{'type':Sequelize[_0x3c66('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x3c66('0x2')]},'country':{'type':Sequelize[_0x3c66('0x2')]},'email':{'type':Sequelize[_0x3c66('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x3c66('0x2')]},'sStreet':{'type':Sequelize[_0x3c66('0x2')]},'sPostalCode':{'type':Sequelize[_0x3c66('0x2')]},'sCity':{'type':Sequelize[_0x3c66('0x2')]},'sCountry':{'type':Sequelize[_0x3c66('0x2')]},'description':{'type':Sequelize[_0x3c66('0x2')]}}; \ No newline at end of file +var _0xcb46=['STRING','name','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcb46,0x9e));var _0x6cb4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcb46[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x6cb4('0x0')]={'name':{'type':Sequelize[_0x6cb4('0x1')],'unique':_0x6cb4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x6cb4('0x1')]},'companyId':{'type':Sequelize[_0x6cb4('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x6cb4('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x6cb4('0x1')]},'postalCode':{'type':Sequelize[_0x6cb4('0x1')]},'city':{'type':Sequelize[_0x6cb4('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x6cb4('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x6cb4('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x6cb4('0x1')]},'sCity':{'type':Sequelize[_0x6cb4('0x1')]},'sCountry':{'type':Sequelize[_0x6cb4('0x1')]},'description':{'type':Sequelize[_0x6cb4('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index bf2620f..eecf285 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 _0x400a=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Companies','error','name','send','index','describe','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','CmCompany','includeAll','findAll','catch','show','params','rawAttributes','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addContacts','ids','getContacts','findOne','CmContact','map','options','hasOwnProperty','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x214266,_0x1f6f52){var _0x568f75=function(_0x541904){while(--_0x541904){_0x214266['push'](_0x214266['shift']());}};_0x568f75(++_0x1f6f52);}(_0x400a,0x18b));var _0xa400=function(_0x2711fb,_0x525b00){_0x2711fb=_0x2711fb-0x0;var _0x2312dd=_0x400a[_0x2711fb];return _0x2312dd;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa400('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa400('0x1'));var jsonpatch=require(_0xa400('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa400('0x3'));var util=require(_0xa400('0x4'));var path=require(_0xa400('0x5'));var sox=require(_0xa400('0x6'));var csv=require(_0xa400('0x7'));var ejs=require(_0xa400('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa400('0x9'));var crypto=require(_0xa400('0xa'));var jsforce=require(_0xa400('0xb'));var deskjs=require(_0xa400('0xc'));var toCsv=require(_0xa400('0x7'));var querystring=require(_0xa400('0xd'));var Papa=require(_0xa400('0xe'));var Redis=require(_0xa400('0xf'));var authService=require(_0xa400('0x10'));var qs=require(_0xa400('0x11'));var as=require(_0xa400('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa400('0x13'))(_0xa400('0x14'));var utils=require(_0xa400('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa400('0x16'));var db=require(_0xa400('0x17'))['db'];function respondWithStatusCode(_0x1301f5,_0x1a2edf){_0x1a2edf=_0x1a2edf||0xcc;return function(_0x29a5ea){if(_0x29a5ea){return _0x1301f5[_0xa400('0x18')](_0x1a2edf);}return _0x1301f5[_0xa400('0x19')](_0x1a2edf)[_0xa400('0x1a')]();};}function respondWithResult(_0x40a358,_0x46a949){_0x46a949=_0x46a949||0xc8;return function(_0x1ef7c1){if(_0x1ef7c1){return _0x40a358[_0xa400('0x19')](_0x46a949)[_0xa400('0x1b')](_0x1ef7c1);}};}function respondWithFilteredResult(_0x3f6f86,_0x297458){return function(_0x3c8740){if(_0x3c8740){var _0x172828=_0x3c8740[_0xa400('0x1c')],_0x1b0fa1=_0x297458[_0xa400('0x1d')],_0x361da3=_0x297458[_0xa400('0x1d')]+_0x297458[_0xa400('0x1e')],_0x19e2af;if(_0x361da3>=_0x172828){_0x361da3=_0x172828;_0x19e2af=0xc8;}else{_0x19e2af=0xce;}_0x3f6f86[_0xa400('0x19')](_0x19e2af);return _0x3f6f86[_0xa400('0x1f')](_0xa400('0x20'),_0x1b0fa1+'-'+_0x361da3+'/'+_0x172828)[_0xa400('0x1b')](_0x3c8740);}return null;};}function patchUpdates(_0x5d6df5){return function(_0x59d808){try{jsonpatch[_0xa400('0x21')](_0x59d808,_0x5d6df5,!![]);}catch(_0xbcece9){return BPromise[_0xa400('0x22')](_0xbcece9);}return _0x59d808[_0xa400('0x23')]();};}function saveUpdates(_0x58be72,_0x53a36d){return function(_0x2b6a6d){if(_0x2b6a6d){return _0x2b6a6d[_0xa400('0x24')](_0x58be72)[_0xa400('0x25')](function(_0x3ad169){return _0x3ad169;});}return null;};}function removeEntity(_0x43e981,_0x5be389){return function(_0x42154d){if(_0x42154d){return _0x42154d[_0xa400('0x26')]()['then'](function(){var _0x2a2993=_0x42154d[_0xa400('0x27')]({'plain':!![]});var _0x4a0569=_0xa400('0x28');return db['UserProfileResource'][_0xa400('0x26')]({'where':{'type':_0x4a0569,'resourceId':_0x2a2993['id']}})[_0xa400('0x25')](function(){return _0x42154d;});})[_0xa400('0x25')](function(){_0x43e981[_0xa400('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51b7ac,_0x259b42){return function(_0x43324c){if(!_0x43324c){_0x51b7ac['sendStatus'](0x194);}return _0x43324c;};}function handleError(_0x90f22c,_0x418dd2){_0x418dd2=_0x418dd2||0x1f4;return function(_0x1d3f57){logger[_0xa400('0x29')](_0x1d3f57['stack']);if(_0x1d3f57[_0xa400('0x2a')]){delete _0x1d3f57['name'];}_0x90f22c['status'](_0x418dd2)[_0xa400('0x2b')](_0x1d3f57);};}exports[_0xa400('0x2c')]=function(_0x1bf9ff,_0x22cee5){var _0xb22f9={},_0x472a55={},_0x185cdc={'count':0x0,'rows':[]};return db['CmCompany'][_0xa400('0x2d')]()['then'](function(_0x1b8bf8){_0x472a55[_0xa400('0x2e')]=_['keys'](_0x1b8bf8);_0x472a55[_0xa400('0x2f')]=_[_0xa400('0x30')](_0x1bf9ff[_0xa400('0x2f')]);_0x472a55[_0xa400('0x31')]=_['intersection'](_0x472a55[_0xa400('0x2e')],_0x472a55[_0xa400('0x2f')]);_0xb22f9['attributes']=_[_0xa400('0x32')](_0x472a55['model'],qs[_0xa400('0x33')](_0x1bf9ff['query'][_0xa400('0x33')]));_0xb22f9[_0xa400('0x34')]=_0xb22f9[_0xa400('0x34')][_0xa400('0x35')]?_0xb22f9[_0xa400('0x34')]:_0x472a55['model'];if(!_0x1bf9ff[_0xa400('0x2f')]['hasOwnProperty'](_0xa400('0x36'))){_0xb22f9['limit']=qs[_0xa400('0x1e')](_0x1bf9ff[_0xa400('0x2f')][_0xa400('0x1e')]);_0xb22f9[_0xa400('0x1d')]=qs['offset'](_0x1bf9ff['query'][_0xa400('0x1d')]);}_0xb22f9[_0xa400('0x37')]=qs['sort'](_0x1bf9ff[_0xa400('0x2f')][_0xa400('0x38')]);_0xb22f9[_0xa400('0x39')]=qs['filters'](_[_0xa400('0x3a')](_0x1bf9ff[_0xa400('0x2f')],_0x472a55[_0xa400('0x31')]),_0x1b8bf8);if(_0x1bf9ff[_0xa400('0x2f')]['filter']){_0xb22f9[_0xa400('0x39')]=_['merge'](_0xb22f9[_0xa400('0x39')],{'$or':_['map'](_0xb22f9[_0xa400('0x34')],function(_0xc89893){var _0xeb9987={};_0xeb9987[_0xc89893]={'$like':'%'+_0x1bf9ff[_0xa400('0x2f')][_0xa400('0x3b')]+'%'};return _0xeb9987;})});}_0xb22f9=_['merge']({},_0xb22f9,_0x1bf9ff['options']);var _0x8ceae2={'where':_0xb22f9[_0xa400('0x39')]};return db[_0xa400('0x3c')][_0xa400('0x1c')](_0x8ceae2)[_0xa400('0x25')](function(_0x28704c){_0x185cdc[_0xa400('0x1c')]=_0x28704c;if(_0x1bf9ff[_0xa400('0x2f')][_0xa400('0x3d')]){_0xb22f9['include']=[{'all':!![]}];}return db[_0xa400('0x3c')][_0xa400('0x3e')](_0xb22f9);})[_0xa400('0x25')](function(_0x5e53a2){_0x185cdc['rows']=_0x5e53a2;return _0x185cdc;})[_0xa400('0x25')](respondWithFilteredResult(_0x22cee5,_0xb22f9))[_0xa400('0x3f')](handleError(_0x22cee5,null));})['catch'](handleError(_0x22cee5,null));};exports[_0xa400('0x40')]=function(_0x104326,_0x1eb3a6){var _0x48c412={'raw':![],'where':{'id':_0x104326[_0xa400('0x41')]['id']}},_0xc4508={};_0xc4508[_0xa400('0x2e')]=_['keys'](db['CmCompany'][_0xa400('0x42')]);_0xc4508[_0xa400('0x2f')]=_['keys'](_0x104326[_0xa400('0x2f')]);_0xc4508['filters']=_[_0xa400('0x32')](_0xc4508[_0xa400('0x2e')],_0xc4508[_0xa400('0x2f')]);_0x48c412[_0xa400('0x34')]=_['intersection'](_0xc4508['model'],qs[_0xa400('0x33')](_0x104326['query']['fields']));_0x48c412[_0xa400('0x34')]=_0x48c412['attributes'][_0xa400('0x35')]?_0x48c412[_0xa400('0x34')]:_0xc4508[_0xa400('0x2e')];if(_0x104326[_0xa400('0x2f')][_0xa400('0x3d')]){_0x48c412['include']=[{'all':!![]}];}_0x48c412=_[_0xa400('0x43')]({},_0x48c412,_0x104326['options']);return db[_0xa400('0x3c')][_0xa400('0x44')](_0x48c412)['then'](handleEntityNotFound(_0x1eb3a6,null))[_0xa400('0x25')](respondWithResult(_0x1eb3a6,null))[_0xa400('0x3f')](handleError(_0x1eb3a6,null));};exports[_0xa400('0x45')]=function(_0x2cd72b,_0x2ecc36){return db[_0xa400('0x3c')][_0xa400('0x45')](_0x2cd72b['body'],{})[_0xa400('0x25')](function(_0x2da653){var _0x2f3b86=_0x2cd72b[_0xa400('0x46')][_0xa400('0x27')]({'plain':!![]});if(!_0x2f3b86)throw new Error(_0xa400('0x47'));if(_0x2f3b86['role']===_0xa400('0x46')){var _0x4038df=_0x2da653[_0xa400('0x27')]({'plain':!![]});var _0x164f04=_0xa400('0x28');return db['UserProfileSection'][_0xa400('0x44')]({'where':{'name':_0x164f04,'userProfileId':_0x2f3b86['userProfileId']},'raw':!![]})[_0xa400('0x25')](function(_0x34b74a){if(_0x34b74a&&_0x34b74a['autoAssociation']===0x0){return db[_0xa400('0x48')][_0xa400('0x45')]({'name':_0x4038df[_0xa400('0x2a')],'resourceId':_0x4038df['id'],'type':_0x34b74a['name'],'sectionId':_0x34b74a['id']},{})['then'](function(){return _0x2da653;});}else{return _0x2da653;}})[_0xa400('0x3f')](function(_0x3a6caa){logger[_0xa400('0x29')](_0xa400('0x49'),_0x3a6caa);throw _0x3a6caa;});}return _0x2da653;})[_0xa400('0x25')](respondWithResult(_0x2ecc36,0xc9))['catch'](handleError(_0x2ecc36,null));};exports[_0xa400('0x24')]=function(_0x553a9b,_0x48f8f2){if(_0x553a9b['body']['id']){delete _0x553a9b[_0xa400('0x4a')]['id'];}return db[_0xa400('0x3c')][_0xa400('0x44')]({'where':{'id':_0x553a9b['params']['id']}})[_0xa400('0x25')](handleEntityNotFound(_0x48f8f2,null))[_0xa400('0x25')](saveUpdates(_0x553a9b['body'],null))[_0xa400('0x25')](respondWithResult(_0x48f8f2,null))[_0xa400('0x3f')](handleError(_0x48f8f2,null));};exports['destroy']=function(_0x4501f3,_0xd35bb6){return db[_0xa400('0x3c')]['find']({'where':{'id':_0x4501f3[_0xa400('0x41')]['id']}})[_0xa400('0x25')](handleEntityNotFound(_0xd35bb6,null))[_0xa400('0x25')](removeEntity(_0xd35bb6,null))[_0xa400('0x3f')](handleError(_0xd35bb6,null));};exports[_0xa400('0x2d')]=function(_0x3c7c60,_0x18beb5){return db['CmCompany'][_0xa400('0x2d')]()['then'](respondWithResult(_0x18beb5,null))[_0xa400('0x3f')](handleError(_0x18beb5,null));};exports[_0xa400('0x4b')]=function(_0x3605a5,_0x2b65ee,_0x224754){return db['CmContact']['find']({'where':{'id':_0x3605a5['params']['id']}})[_0xa400('0x25')](handleEntityNotFound(_0x2b65ee,null))[_0xa400('0x25')](function(_0x576bf0){if(_0x576bf0){return _0x576bf0['addContacts'](_0x3605a5[_0xa400('0x4a')][_0xa400('0x4c')],_['omit'](_0x3605a5[_0xa400('0x4a')],['ids','id'])||{});}})['then'](respondWithResult(_0x2b65ee,null))['catch'](handleError(_0x2b65ee,null));};exports[_0xa400('0x4d')]=function(_0x49fe63,_0x4b8b1c,_0x70ed02){var _0x2e19f6={};var _0x4feaf7={};var _0x28c647;var _0x1a0c25;return db[_0xa400('0x3c')][_0xa400('0x4e')]({'where':{'id':_0x49fe63[_0xa400('0x41')]['id']}})[_0xa400('0x25')](handleEntityNotFound(_0x4b8b1c,null))[_0xa400('0x25')](function(_0x454961){if(_0x454961){_0x28c647=_0x454961;_0x4feaf7['model']=_['keys'](db[_0xa400('0x4f')][_0xa400('0x42')]);_0x4feaf7[_0xa400('0x2f')]=_[_0xa400('0x30')](_0x49fe63[_0xa400('0x2f')]);_0x4feaf7[_0xa400('0x31')]=_['intersection'](_0x4feaf7[_0xa400('0x2e')],_0x4feaf7[_0xa400('0x2f')]);_0x2e19f6[_0xa400('0x34')]=_[_0xa400('0x32')](_0x4feaf7['model'],qs[_0xa400('0x33')](_0x49fe63[_0xa400('0x2f')][_0xa400('0x33')]));_0x2e19f6[_0xa400('0x34')]=_0x2e19f6[_0xa400('0x34')][_0xa400('0x35')]?_0x2e19f6[_0xa400('0x34')]:_0x4feaf7[_0xa400('0x2e')];_0x2e19f6[_0xa400('0x37')]=qs['sort'](_0x49fe63[_0xa400('0x2f')][_0xa400('0x38')]);_0x2e19f6[_0xa400('0x39')]=qs[_0xa400('0x31')](_[_0xa400('0x3a')](_0x49fe63[_0xa400('0x2f')],_0x4feaf7[_0xa400('0x31')]));if(_0x49fe63['query'][_0xa400('0x3b')]){_0x2e19f6[_0xa400('0x39')]=_['merge'](_0x2e19f6[_0xa400('0x39')],{'$or':_[_0xa400('0x50')](_0x2e19f6[_0xa400('0x34')],function(_0x26c579){var _0x79121d={};_0x79121d[_0x26c579]={'$like':'%'+_0x49fe63[_0xa400('0x2f')][_0xa400('0x3b')]+'%'};return _0x79121d;})});}_0x2e19f6=_[_0xa400('0x43')]({},_0x2e19f6,_0x49fe63[_0xa400('0x51')]);return _0x28c647[_0xa400('0x4d')](_0x2e19f6);}})[_0xa400('0x25')](function(_0x4b5962){if(_0x4b5962){_0x1a0c25=_0x4b5962[_0xa400('0x35')];if(!_0x49fe63[_0xa400('0x2f')][_0xa400('0x52')](_0xa400('0x36'))){_0x2e19f6['limit']=qs[_0xa400('0x1e')](_0x49fe63[_0xa400('0x2f')][_0xa400('0x1e')]);_0x2e19f6[_0xa400('0x1d')]=qs[_0xa400('0x1d')](_0x49fe63[_0xa400('0x2f')][_0xa400('0x1d')]);}return _0x28c647[_0xa400('0x4d')](_0x2e19f6);}})[_0xa400('0x25')](function(_0xf1f8e8){if(_0xf1f8e8){return _0xf1f8e8?{'count':_0x1a0c25,'rows':_0xf1f8e8}:null;}})[_0xa400('0x25')](respondWithResult(_0x4b8b1c,null))[_0xa400('0x3f')](handleError(_0x4b8b1c,null));}; \ No newline at end of file +var _0xa92c=['getContacts','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','set','Content-Range','json','apply','save','update','then','get','Companies','UserProfileResource','destroy','sendStatus','stack','name','send','index','CmCompany','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','map','options','count','includeAll','include','findAll','catch','show','params','rawAttributes','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addContacts','ids','omit','findOne','CmContact','length','order'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa92c,0x1c3));var _0xca92=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xa92c[_0x4b369d];return _0x571a98;};'use strict';var pdf=require(_0xca92('0x0'));var emlformat=require(_0xca92('0x1'));var rimraf=require(_0xca92('0x2'));var zipdir=require(_0xca92('0x3'));var jsonpatch=require(_0xca92('0x4'));var rp=require(_0xca92('0x5'));var moment=require(_0xca92('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xca92('0x7'));var util=require(_0xca92('0x8'));var path=require(_0xca92('0x9'));var sox=require(_0xca92('0xa'));var csv=require(_0xca92('0xb'));var ejs=require(_0xca92('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xca92('0xd'));var crypto=require('crypto');var jsforce=require(_0xca92('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xca92('0xf'));var Redis=require(_0xca92('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xca92('0x11'));var as=require(_0xca92('0x12'));var hardwareService=require(_0xca92('0x13'));var logger=require('../../config/logger')(_0xca92('0x14'));var utils=require(_0xca92('0x15'));var config=require(_0xca92('0x16'));var licenseUtil=require(_0xca92('0x17'));var db=require(_0xca92('0x18'))['db'];function respondWithStatusCode(_0xf0b9d5,_0x189374){_0x189374=_0x189374||0xcc;return function(_0x57125e){if(_0x57125e){return _0xf0b9d5['sendStatus'](_0x189374);}return _0xf0b9d5[_0xca92('0x19')](_0x189374)[_0xca92('0x1a')]();};}function respondWithResult(_0x5e6631,_0x487975){_0x487975=_0x487975||0xc8;return function(_0x73c1e9){if(_0x73c1e9){return _0x5e6631[_0xca92('0x19')](_0x487975)['json'](_0x73c1e9);}};}function respondWithFilteredResult(_0x30a2fb,_0x18e53d){return function(_0x520622){if(_0x520622){var _0x311f4d=_0x520622['count'],_0x583479=_0x18e53d[_0xca92('0x1b')],_0x363a29=_0x18e53d[_0xca92('0x1b')]+_0x18e53d[_0xca92('0x1c')],_0x91cf52;if(_0x363a29>=_0x311f4d){_0x363a29=_0x311f4d;_0x91cf52=0xc8;}else{_0x91cf52=0xce;}_0x30a2fb[_0xca92('0x19')](_0x91cf52);return _0x30a2fb[_0xca92('0x1d')](_0xca92('0x1e'),_0x583479+'-'+_0x363a29+'/'+_0x311f4d)[_0xca92('0x1f')](_0x520622);}return null;};}function patchUpdates(_0x2972ef){return function(_0x1fece2){try{jsonpatch[_0xca92('0x20')](_0x1fece2,_0x2972ef,!![]);}catch(_0x5076ab){return BPromise['reject'](_0x5076ab);}return _0x1fece2[_0xca92('0x21')]();};}function saveUpdates(_0x3dd294,_0xe577bd){return function(_0x35c976){if(_0x35c976){return _0x35c976[_0xca92('0x22')](_0x3dd294)['then'](function(_0x3dde15){return _0x3dde15;});}return null;};}function removeEntity(_0x3089a6,_0x4af1ce){return function(_0x54cbf6){if(_0x54cbf6){return _0x54cbf6['destroy']()[_0xca92('0x23')](function(){var _0x54dd49=_0x54cbf6[_0xca92('0x24')]({'plain':!![]});var _0x26dc14=_0xca92('0x25');return db[_0xca92('0x26')][_0xca92('0x27')]({'where':{'type':_0x26dc14,'resourceId':_0x54dd49['id']}})[_0xca92('0x23')](function(){return _0x54cbf6;});})['then'](function(){_0x3089a6['status'](0xcc)[_0xca92('0x1a')]();});}};}function handleEntityNotFound(_0x536d45,_0x1efc24){return function(_0x36366e){if(!_0x36366e){_0x536d45[_0xca92('0x28')](0x194);}return _0x36366e;};}function handleError(_0x372f6e,_0x167cc4){_0x167cc4=_0x167cc4||0x1f4;return function(_0x1248f3){logger['error'](_0x1248f3[_0xca92('0x29')]);if(_0x1248f3[_0xca92('0x2a')]){delete _0x1248f3[_0xca92('0x2a')];}_0x372f6e['status'](_0x167cc4)[_0xca92('0x2b')](_0x1248f3);};}exports[_0xca92('0x2c')]=function(_0x2dd4cd,_0x590d9a){var _0x2a3e50={},_0x3e7dbf={},_0xaf5f41={'count':0x0,'rows':[]};return db[_0xca92('0x2d')]['describe']()[_0xca92('0x23')](function(_0x5ab920){_0x3e7dbf[_0xca92('0x2e')]=_['keys'](_0x5ab920);_0x3e7dbf[_0xca92('0x2f')]=_[_0xca92('0x30')](_0x2dd4cd[_0xca92('0x2f')]);_0x3e7dbf['filters']=_[_0xca92('0x31')](_0x3e7dbf[_0xca92('0x2e')],_0x3e7dbf[_0xca92('0x2f')]);_0x2a3e50['attributes']=_[_0xca92('0x31')](_0x3e7dbf[_0xca92('0x2e')],qs[_0xca92('0x32')](_0x2dd4cd[_0xca92('0x2f')][_0xca92('0x32')]));_0x2a3e50[_0xca92('0x33')]=_0x2a3e50['attributes']['length']?_0x2a3e50['attributes']:_0x3e7dbf[_0xca92('0x2e')];if(!_0x2dd4cd[_0xca92('0x2f')][_0xca92('0x34')](_0xca92('0x35'))){_0x2a3e50[_0xca92('0x1c')]=qs[_0xca92('0x1c')](_0x2dd4cd[_0xca92('0x2f')][_0xca92('0x1c')]);_0x2a3e50[_0xca92('0x1b')]=qs[_0xca92('0x1b')](_0x2dd4cd[_0xca92('0x2f')][_0xca92('0x1b')]);}_0x2a3e50['order']=qs['sort'](_0x2dd4cd['query'][_0xca92('0x36')]);_0x2a3e50[_0xca92('0x37')]=qs[_0xca92('0x38')](_[_0xca92('0x39')](_0x2dd4cd[_0xca92('0x2f')],_0x3e7dbf[_0xca92('0x38')]),_0x5ab920);if(_0x2dd4cd['query'][_0xca92('0x3a')]){_0x2a3e50[_0xca92('0x37')]=_[_0xca92('0x3b')](_0x2a3e50[_0xca92('0x37')],{'$or':_[_0xca92('0x3c')](_0x2a3e50[_0xca92('0x33')],function(_0x21ecf6){var _0xc7f941={};_0xc7f941[_0x21ecf6]={'$like':'%'+_0x2dd4cd[_0xca92('0x2f')][_0xca92('0x3a')]+'%'};return _0xc7f941;})});}_0x2a3e50=_[_0xca92('0x3b')]({},_0x2a3e50,_0x2dd4cd[_0xca92('0x3d')]);var _0x4cbd52={'where':_0x2a3e50[_0xca92('0x37')]};return db[_0xca92('0x2d')][_0xca92('0x3e')](_0x4cbd52)[_0xca92('0x23')](function(_0xa9b44d){_0xaf5f41[_0xca92('0x3e')]=_0xa9b44d;if(_0x2dd4cd['query'][_0xca92('0x3f')]){_0x2a3e50[_0xca92('0x40')]=[{'all':!![]}];}return db[_0xca92('0x2d')][_0xca92('0x41')](_0x2a3e50);})[_0xca92('0x23')](function(_0x174647){_0xaf5f41['rows']=_0x174647;return _0xaf5f41;})['then'](respondWithFilteredResult(_0x590d9a,_0x2a3e50))[_0xca92('0x42')](handleError(_0x590d9a,null));})['catch'](handleError(_0x590d9a,null));};exports[_0xca92('0x43')]=function(_0xdab691,_0x1b3014){var _0x5bb24a={'raw':![],'where':{'id':_0xdab691[_0xca92('0x44')]['id']}},_0x1e66c6={};_0x1e66c6[_0xca92('0x2e')]=_[_0xca92('0x30')](db[_0xca92('0x2d')][_0xca92('0x45')]);_0x1e66c6['query']=_[_0xca92('0x30')](_0xdab691['query']);_0x1e66c6[_0xca92('0x38')]=_[_0xca92('0x31')](_0x1e66c6[_0xca92('0x2e')],_0x1e66c6['query']);_0x5bb24a[_0xca92('0x33')]=_[_0xca92('0x31')](_0x1e66c6['model'],qs['fields'](_0xdab691['query'][_0xca92('0x32')]));_0x5bb24a[_0xca92('0x33')]=_0x5bb24a[_0xca92('0x33')]['length']?_0x5bb24a['attributes']:_0x1e66c6[_0xca92('0x2e')];if(_0xdab691[_0xca92('0x2f')][_0xca92('0x3f')]){_0x5bb24a[_0xca92('0x40')]=[{'all':!![]}];}_0x5bb24a=_['merge']({},_0x5bb24a,_0xdab691[_0xca92('0x3d')]);return db[_0xca92('0x2d')][_0xca92('0x46')](_0x5bb24a)['then'](handleEntityNotFound(_0x1b3014,null))[_0xca92('0x23')](respondWithResult(_0x1b3014,null))[_0xca92('0x42')](handleError(_0x1b3014,null));};exports['create']=function(_0x5e39f7,_0x42dba7){return db['CmCompany']['create'](_0x5e39f7[_0xca92('0x47')],{})[_0xca92('0x23')](function(_0x4f1c33){var _0x157f64=_0x5e39f7['user'][_0xca92('0x24')]({'plain':!![]});if(!_0x157f64)throw new Error(_0xca92('0x48'));if(_0x157f64[_0xca92('0x49')]===_0xca92('0x4a')){var _0x38f057=_0x4f1c33['get']({'plain':!![]});var _0x344984=_0xca92('0x25');return db[_0xca92('0x4b')][_0xca92('0x46')]({'where':{'name':_0x344984,'userProfileId':_0x157f64[_0xca92('0x4c')]},'raw':!![]})[_0xca92('0x23')](function(_0x452f2b){if(_0x452f2b&&_0x452f2b[_0xca92('0x4d')]===0x0){return db[_0xca92('0x26')][_0xca92('0x4e')]({'name':_0x38f057[_0xca92('0x2a')],'resourceId':_0x38f057['id'],'type':_0x452f2b[_0xca92('0x2a')],'sectionId':_0x452f2b['id']},{})[_0xca92('0x23')](function(){return _0x4f1c33;});}else{return _0x4f1c33;}})[_0xca92('0x42')](function(_0x4ffa6b){logger[_0xca92('0x4f')](_0xca92('0x50'),_0x4ffa6b);throw _0x4ffa6b;});}return _0x4f1c33;})[_0xca92('0x23')](respondWithResult(_0x42dba7,0xc9))[_0xca92('0x42')](handleError(_0x42dba7,null));};exports[_0xca92('0x22')]=function(_0x5a7511,_0x4d2f14){if(_0x5a7511['body']['id']){delete _0x5a7511['body']['id'];}return db[_0xca92('0x2d')][_0xca92('0x46')]({'where':{'id':_0x5a7511[_0xca92('0x44')]['id']}})[_0xca92('0x23')](handleEntityNotFound(_0x4d2f14,null))[_0xca92('0x23')](saveUpdates(_0x5a7511[_0xca92('0x47')],null))[_0xca92('0x23')](respondWithResult(_0x4d2f14,null))[_0xca92('0x42')](handleError(_0x4d2f14,null));};exports['destroy']=function(_0x2406db,_0x56aa0d){return db[_0xca92('0x2d')][_0xca92('0x46')]({'where':{'id':_0x2406db[_0xca92('0x44')]['id']}})['then'](handleEntityNotFound(_0x56aa0d,null))[_0xca92('0x23')](removeEntity(_0x56aa0d,null))['catch'](handleError(_0x56aa0d,null));};exports[_0xca92('0x51')]=function(_0x34e9b9,_0x2a0878){return db[_0xca92('0x2d')][_0xca92('0x51')]()['then'](respondWithResult(_0x2a0878,null))[_0xca92('0x42')](handleError(_0x2a0878,null));};exports[_0xca92('0x52')]=function(_0x1c69ed,_0x1d39b7,_0x58204b){return db['CmContact'][_0xca92('0x46')]({'where':{'id':_0x1c69ed[_0xca92('0x44')]['id']}})['then'](handleEntityNotFound(_0x1d39b7,null))[_0xca92('0x23')](function(_0x4f9f9b){if(_0x4f9f9b){return _0x4f9f9b[_0xca92('0x52')](_0x1c69ed[_0xca92('0x47')][_0xca92('0x53')],_[_0xca92('0x54')](_0x1c69ed['body'],[_0xca92('0x53'),'id'])||{});}})[_0xca92('0x23')](respondWithResult(_0x1d39b7,null))[_0xca92('0x42')](handleError(_0x1d39b7,null));};exports['getContacts']=function(_0x1d85a7,_0x5762db,_0x15e121){var _0x310ab5={};var _0x39eee7={};var _0x58cdc6;var _0x576853;return db['CmCompany'][_0xca92('0x55')]({'where':{'id':_0x1d85a7[_0xca92('0x44')]['id']}})[_0xca92('0x23')](handleEntityNotFound(_0x5762db,null))[_0xca92('0x23')](function(_0x3a427a){if(_0x3a427a){_0x58cdc6=_0x3a427a;_0x39eee7['model']=_[_0xca92('0x30')](db[_0xca92('0x56')][_0xca92('0x45')]);_0x39eee7[_0xca92('0x2f')]=_[_0xca92('0x30')](_0x1d85a7[_0xca92('0x2f')]);_0x39eee7[_0xca92('0x38')]=_['intersection'](_0x39eee7[_0xca92('0x2e')],_0x39eee7[_0xca92('0x2f')]);_0x310ab5[_0xca92('0x33')]=_[_0xca92('0x31')](_0x39eee7[_0xca92('0x2e')],qs[_0xca92('0x32')](_0x1d85a7[_0xca92('0x2f')][_0xca92('0x32')]));_0x310ab5[_0xca92('0x33')]=_0x310ab5[_0xca92('0x33')][_0xca92('0x57')]?_0x310ab5[_0xca92('0x33')]:_0x39eee7[_0xca92('0x2e')];_0x310ab5[_0xca92('0x58')]=qs['sort'](_0x1d85a7[_0xca92('0x2f')][_0xca92('0x36')]);_0x310ab5[_0xca92('0x37')]=qs[_0xca92('0x38')](_[_0xca92('0x39')](_0x1d85a7[_0xca92('0x2f')],_0x39eee7['filters']));if(_0x1d85a7['query'][_0xca92('0x3a')]){_0x310ab5[_0xca92('0x37')]=_[_0xca92('0x3b')](_0x310ab5[_0xca92('0x37')],{'$or':_[_0xca92('0x3c')](_0x310ab5[_0xca92('0x33')],function(_0x33917f){var _0x321a50={};_0x321a50[_0x33917f]={'$like':'%'+_0x1d85a7['query']['filter']+'%'};return _0x321a50;})});}_0x310ab5=_[_0xca92('0x3b')]({},_0x310ab5,_0x1d85a7[_0xca92('0x3d')]);return _0x58cdc6[_0xca92('0x59')](_0x310ab5);}})['then'](function(_0xbfbb1f){if(_0xbfbb1f){_0x576853=_0xbfbb1f[_0xca92('0x57')];if(!_0x1d85a7[_0xca92('0x2f')][_0xca92('0x34')](_0xca92('0x35'))){_0x310ab5[_0xca92('0x1c')]=qs['limit'](_0x1d85a7[_0xca92('0x2f')][_0xca92('0x1c')]);_0x310ab5[_0xca92('0x1b')]=qs[_0xca92('0x1b')](_0x1d85a7[_0xca92('0x2f')][_0xca92('0x1b')]);}return _0x58cdc6[_0xca92('0x59')](_0x310ab5);}})[_0xca92('0x23')](function(_0x3cbf7d){if(_0x3cbf7d){return _0x3cbf7d?{'count':_0x576853,'rows':_0x3cbf7d}:null;}})['then'](respondWithResult(_0x5762db,null))[_0xca92('0x42')](handleError(_0x5762db,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 1889d04..bb2aca2 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 _0x80d9=['api','moment','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','cm_companies','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x80d9,0x15c));var _0x980d=function(_0x1dd5b7,_0x4046d5){_0x1dd5b7=_0x1dd5b7-0x0;var _0x1bb9a6=_0x80d9[_0x1dd5b7];return _0x1bb9a6;};'use strict';var _=require(_0x980d('0x0'));var util=require('util');var logger=require(_0x980d('0x1'))(_0x980d('0x2'));var moment=require(_0x980d('0x3'));var BPromise=require('bluebird');var rp=require(_0x980d('0x4'));var fs=require('fs');var path=require(_0x980d('0x5'));var rimraf=require(_0x980d('0x6'));var config=require(_0x980d('0x7'));var attributes=require(_0x980d('0x8'));module['exports']=function(_0x4c3533,_0x2fd4b9){return _0x4c3533['define']('CmCompany',attributes,{'tableName':_0x980d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe198=['define','CmCompany','cm_companies','lodash','util','moment','bluebird','request-promise','path','rimraf','./cmCompany.attributes','exports'];(function(_0x456fc1,_0x5e289d){var _0x35587a=function(_0x753883){while(--_0x753883){_0x456fc1['push'](_0x456fc1['shift']());}};_0x35587a(++_0x5e289d);}(_0xe198,0x6f));var _0x8e19=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xe198[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0x8e19('0x0'));var util=require(_0x8e19('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8e19('0x2'));var BPromise=require(_0x8e19('0x3'));var rp=require(_0x8e19('0x4'));var fs=require('fs');var path=require(_0x8e19('0x5'));var rimraf=require(_0x8e19('0x6'));var config=require('../../config/environment');var attributes=require(_0x8e19('0x7'));module[_0x8e19('0x8')]=function(_0x2fb138,_0x188ce0){return _0x2fb138[_0x8e19('0x9')](_0x8e19('0xa'),attributes,{'tableName':_0x8e19('0xb'),'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 92326ab..ebabd6d 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 _0x8f1c=['CmCompany,\x20%s,\x20%s','message','info','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xc7f12b,_0x2069ae){var _0x5bccf1=function(_0xca8a5f){while(--_0xca8a5f){_0xc7f12b['push'](_0xc7f12b['shift']());}};_0x5bccf1(++_0x2069ae);}(_0x8f1c,0x10d));var _0xc8f1=function(_0x525cf8,_0x180f72){_0x525cf8=_0x525cf8-0x0;var _0x2c6c30=_0x8f1c[_0x525cf8];return _0x2c6c30;};'use strict';var _=require('lodash');var util=require(_0xc8f1('0x0'));var moment=require('moment');var BPromise=require(_0xc8f1('0x1'));var rs=require(_0xc8f1('0x2'));var fs=require('fs');var Redis=require(_0xc8f1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc8f1('0x4'));var logger=require(_0xc8f1('0x5'))(_0xc8f1('0x6'));var config=require(_0xc8f1('0x7'));var jayson=require(_0xc8f1('0x8'));var client=jayson[_0xc8f1('0x9')][_0xc8f1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bffcc,_0x2e175e,_0x30d845){return new BPromise(function(_0x30e982,_0x52bdcf){return client['request'](_0x5bffcc,_0x30d845)[_0xc8f1('0xb')](function(_0x11acc3){logger['info']('CmCompany,\x20%s,\x20%s',_0x2e175e,'request\x20sent');logger[_0xc8f1('0xc')](_0xc8f1('0xd'),_0x2e175e,_0xc8f1('0xe'),JSON[_0xc8f1('0xf')](_0x11acc3));if(_0x11acc3[_0xc8f1('0x10')]){if(_0x11acc3['error']['code']===0x1f4){logger[_0xc8f1('0x10')](_0xc8f1('0x11'),_0x2e175e,_0x11acc3[_0xc8f1('0x10')]['message']);return _0x52bdcf(_0x11acc3[_0xc8f1('0x10')][_0xc8f1('0x12')]);}logger[_0xc8f1('0x10')](_0xc8f1('0x11'),_0x2e175e,_0x11acc3[_0xc8f1('0x10')]['message']);return _0x30e982(_0x11acc3[_0xc8f1('0x10')][_0xc8f1('0x12')]);}else{logger[_0xc8f1('0x13')](_0xc8f1('0x11'),_0x2e175e,_0xc8f1('0xe'));_0x30e982(_0x11acc3[_0xc8f1('0x14')][_0xc8f1('0x12')]);}})[_0xc8f1('0x15')](function(_0xe442df){logger[_0xc8f1('0x10')](_0xc8f1('0x11'),_0x2e175e,_0xe442df);_0x52bdcf(_0xe442df);});});} \ No newline at end of file +var _0x1ebd=['then','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request'];(function(_0x34dace,_0x1bceb6){var _0x1e56c6=function(_0x3d78a0){while(--_0x3d78a0){_0x34dace['push'](_0x34dace['shift']());}};_0x1e56c6(++_0x1bceb6);}(_0x1ebd,0x136));var _0xd1eb=function(_0x114a27,_0x578f08){_0x114a27=_0x114a27-0x0;var _0x56b66b=_0x1ebd[_0x114a27];return _0x56b66b;};'use strict';var _=require(_0xd1eb('0x0'));var util=require(_0xd1eb('0x1'));var moment=require(_0xd1eb('0x2'));var BPromise=require(_0xd1eb('0x3'));var rs=require(_0xd1eb('0x4'));var fs=require('fs');var Redis=require(_0xd1eb('0x5'));var db=require(_0xd1eb('0x6'))['db'];var utils=require(_0xd1eb('0x7'));var logger=require(_0xd1eb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd1eb('0x9'));var client=jayson['client'][_0xd1eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2454d2,_0x4f4a2c,_0x24cee9){return new BPromise(function(_0x37ef1a,_0x3e4a64){return client[_0xd1eb('0xb')](_0x2454d2,_0x24cee9)[_0xd1eb('0xc')](function(_0x5f5d72){logger[_0xd1eb('0xd')](_0xd1eb('0xe'),_0x4f4a2c,'request\x20sent');logger[_0xd1eb('0xf')](_0xd1eb('0x10'),_0x4f4a2c,_0xd1eb('0x11'),JSON['stringify'](_0x5f5d72));if(_0x5f5d72[_0xd1eb('0x12')]){if(_0x5f5d72[_0xd1eb('0x12')][_0xd1eb('0x13')]===0x1f4){logger[_0xd1eb('0x12')](_0xd1eb('0xe'),_0x4f4a2c,_0x5f5d72[_0xd1eb('0x12')]['message']);return _0x3e4a64(_0x5f5d72['error'][_0xd1eb('0x14')]);}logger['error'](_0xd1eb('0xe'),_0x4f4a2c,_0x5f5d72[_0xd1eb('0x12')]['message']);return _0x37ef1a(_0x5f5d72[_0xd1eb('0x12')][_0xd1eb('0x14')]);}else{logger[_0xd1eb('0xd')]('CmCompany,\x20%s,\x20%s',_0x4f4a2c,_0xd1eb('0x11'));_0x37ef1a(_0x5f5d72[_0xd1eb('0x15')]['message']);}})[_0xd1eb('0x16')](function(_0x273c82){logger['error']('CmCompany,\x20%s,\x20%s',_0x4f4a2c,_0x273c82);_0x3e4a64(_0x273c82);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 20610ee..4d128f0 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 _0xe3da=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','/:id','/:id/contacts','getContacts','post','addContacts'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xe3da,0x1cd));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var auth=require(_0xae3d('0x6'));var interaction=require(_0xae3d('0x7'));var config=require(_0xae3d('0x8'));var controller=require(_0xae3d('0x9'));router[_0xae3d('0xa')]('/',auth[_0xae3d('0xb')](),controller[_0xae3d('0xc')]);router[_0xae3d('0xa')](_0xae3d('0xd'),auth[_0xae3d('0xb')](),controller['describe']);router[_0xae3d('0xa')](_0xae3d('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xae3d('0xa')](_0xae3d('0xf'),auth[_0xae3d('0xb')](),controller[_0xae3d('0x10')]);router[_0xae3d('0x11')]('/',auth[_0xae3d('0xb')](),controller['create']);router[_0xae3d('0x11')]('/:id/contacts',auth[_0xae3d('0xb')](),controller[_0xae3d('0x12')]);router[_0xae3d('0x13')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0x14')]);router[_0xae3d('0x15')](_0xae3d('0xe'),auth[_0xae3d('0xb')](),controller[_0xae3d('0x16')]);module[_0xae3d('0x17')]=router; \ No newline at end of file +var _0x8ace=['post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','describe','/:id/contacts','getContacts'];(function(_0x169c01,_0x59f28d){var _0x2c3be4=function(_0x14032f){while(--_0x14032f){_0x169c01['push'](_0x169c01['shift']());}};_0x2c3be4(++_0x59f28d);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x942eca,_0x1d0181){_0x942eca=_0x942eca-0x0;var _0x589c16=_0x8ace[_0x942eca];return _0x589c16;};'use strict';var multer=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var path=require(_0xe8ac('0x2'));var timeout=require(_0xe8ac('0x3'));var express=require(_0xe8ac('0x4'));var router=express[_0xe8ac('0x5')]();var auth=require(_0xe8ac('0x6'));var interaction=require(_0xe8ac('0x7'));var config=require(_0xe8ac('0x8'));var controller=require(_0xe8ac('0x9'));router[_0xe8ac('0xa')]('/',auth[_0xe8ac('0xb')](),controller[_0xe8ac('0xc')]);router[_0xe8ac('0xa')]('/describe',auth[_0xe8ac('0xb')](),controller[_0xe8ac('0xd')]);router['get']('/:id',auth[_0xe8ac('0xb')](),controller['show']);router[_0xe8ac('0xa')](_0xe8ac('0xe'),auth[_0xe8ac('0xb')](),controller[_0xe8ac('0xf')]);router[_0xe8ac('0x10')]('/',auth[_0xe8ac('0xb')](),controller['create']);router[_0xe8ac('0x10')](_0xe8ac('0xe'),auth[_0xe8ac('0xb')](),controller['addContacts']);router[_0xe8ac('0x11')](_0xe8ac('0x12'),auth['isAuthenticated'](),controller[_0xe8ac('0x13')]);router[_0xe8ac('0x14')](_0xe8ac('0x12'),auth[_0xe8ac('0xb')](),controller[_0xe8ac('0x15')]);module[_0xe8ac('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 40c9821..fe18e10 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 _0xb358=['STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize'];(function(_0x4d883d,_0x4586df){var _0x5df5fd=function(_0x576986){while(--_0x576986){_0x4d883d['push'](_0x4d883d['shift']());}};_0x5df5fd(++_0x4586df);}(_0xb358,0x19e));var _0x8b35=function(_0x1e19ba,_0x473839){_0x1e19ba=_0x1e19ba-0x0;var _0x3f0e5e=_0xb358[_0x1e19ba];return _0x3f0e5e;};'use strict';var _=require(_0x8b35('0x0'));var Sequelize=require(_0x8b35('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x8b35('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x8b35('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x8b35('0x2')]},'city':{'type':Sequelize[_0x8b35('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x8b35('0x2')]},'description':{'type':Sequelize[_0x8b35('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x8b35('0x2')]},'fax':{'type':Sequelize[_0x8b35('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x8b35('0x2')]},'facebook':{'type':Sequelize[_0x8b35('0x2')]},'fb_data':{'type':Sequelize[_0x8b35('0x2')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x8b35('0x2')]},'teams':{'type':Sequelize[_0x8b35('0x2')]},'viber':{'type':Sequelize[_0x8b35('0x2')]},'line':{'type':Sequelize[_0x8b35('0x2')]},'wechat':{'type':Sequelize[_0x8b35('0x2')]},'telegram':{'type':Sequelize[_0x8b35('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x8b35('0x4')](0x2)[_0x8b35('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x8b35('0x6')],'defaultValue':Sequelize[_0x8b35('0x7')]}}; \ No newline at end of file +var _0x4037=['exports','STRING','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x4037,0x148));var _0x7403=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4037[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7403('0x0'));var Sequelize=require('sequelize');module[_0x7403('0x1')]={'firstName':{'type':Sequelize[_0x7403('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x7403('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x7403('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x7403('0x2')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x7403('0x2')]},'facebook':{'type':Sequelize[_0x7403('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x7403('0x2')]},'skype':{'type':Sequelize[_0x7403('0x2')]},'teams':{'type':Sequelize[_0x7403('0x2')]},'viber':{'type':Sequelize[_0x7403('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x7403('0x2')]},'telegram':{'type':Sequelize[_0x7403('0x2')]},'UserId':{'type':Sequelize[_0x7403('0x3')]},'priority':{'type':Sequelize[_0x7403('0x3')](0x2)[_0x7403('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x7403('0x5')],'defaultValue':Sequelize[_0x7403('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index f143aaa..6755c3c 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 _0x91a7=['hasOwnProperty','nolimit','order','sort','where','filters','pick','field','color','from','tools_tags','cm_contacts','left_join','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','conditions','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','and','uc.UserId\x20=\x20?','dateOfBirth','castTo','DATE','buildExpression','start','Contact','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','isArray','tag','filter','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','DESC','isEmpty','having','t.id\x20IN\x20?','agent','some','user','getLists','c.ListId\x20IS\x20NULL','role','sequelize','toString','count','c.lastName','c.phone','c.fax','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','params','tags','displayName','columnName','alias','values','merge','body','findAll','get','mergeWith','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelMessage','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappQueueReport','create','describe','join','bulkCreate','each','duplicates','$or','findOrCreate','spread','error','show','find','Tag','$and','omit','cf_%d','pickBy','format','table','setFields','id\x20=\x20?','toParam','text','phone','getTags','rawAttributes','options','setTags','ids','getHoppers','ContactId','include','includeAll','getHopperFinals','CmHopperFinal','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','child_process','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','meta','binding','fork','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','getJourney','mail','sms','openchannel','whatsapp','voice','-createdAt','resolve','channel','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','uniqueid','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','fullname','startCase','chat','Website','Account','closed','closedAt','secondDisposition','thirdDisposition','UserId','key','Owner','browserName','deviceModel','osName','ratingMessage','referer','externalUrl','threadId','Interaction','findAndCountAll','all','flatten','sortBy','reverse','slice','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./cmContact.socket','sendStatus','end','json','offset','limit','status','Content-Range','reject','save','update','then','destroy','stack','name','send','index','CmContact','keys','length','startsWith','push','CmCustomField','findOne','trimStart','cf_','fieldType','type','intersection','model','query','attributes','fields'];(function(_0x8e6eb,_0x40b670){var _0xbded8d=function(_0x315481){while(--_0x315481){_0x8e6eb['push'](_0x8e6eb['shift']());}};_0xbded8d(++_0x40b670);}(_0x91a7,0xe7));var _0x791a=function(_0x19157f,_0x18bb14){_0x19157f=_0x19157f-0x0;var _0x56eaf8=_0x91a7[_0x19157f];return _0x56eaf8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x791a('0x0'));var rimraf=require(_0x791a('0x1'));var zipdir=require(_0x791a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x791a('0x3'));var moment=require('moment');var BPromise=require(_0x791a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x791a('0x5'));var sox=require(_0x791a('0x6'));var csv=require('to-csv');var ejs=require(_0x791a('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x791a('0x8'));var crypto=require(_0x791a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x791a('0xa'));var toCsv=require(_0x791a('0xb'));var querystring=require(_0x791a('0xc'));var Papa=require(_0x791a('0xd'));var Redis=require(_0x791a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x791a('0xf'));var as=require(_0x791a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x791a('0x11'))(_0x791a('0x12'));var utils=require(_0x791a('0x13'));var config=require(_0x791a('0x14'));var licenseUtil=require(_0x791a('0x15'));var db=require(_0x791a('0x16'))['db'];config['redis']=_['defaults'](config[_0x791a('0x17')],{'host':_0x791a('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x791a('0x17')]));require(_0x791a('0x19'))['register'](socket);function respondWithStatusCode(_0x2887f0,_0x31b86d){_0x31b86d=_0x31b86d||0xcc;return function(_0x2ef5c5){if(_0x2ef5c5){return _0x2887f0[_0x791a('0x1a')](_0x31b86d);}return _0x2887f0['status'](_0x31b86d)[_0x791a('0x1b')]();};}function respondWithResult(_0x575d11,_0x43dea6){_0x43dea6=_0x43dea6||0xc8;return function(_0x355155){if(_0x355155){return _0x575d11['status'](_0x43dea6)[_0x791a('0x1c')](_0x355155);}};}function respondWithFilteredResult(_0x5bea2e,_0x35fe48){return function(_0x52941d){if(_0x52941d){var _0x4a84ee=_0x52941d['count'],_0x588d00=_0x35fe48[_0x791a('0x1d')],_0x40f0d3=_0x35fe48[_0x791a('0x1d')]+_0x35fe48[_0x791a('0x1e')],_0x52fa43;if(_0x40f0d3>=_0x4a84ee){_0x40f0d3=_0x4a84ee;_0x52fa43=0xc8;}else{_0x52fa43=0xce;}_0x5bea2e[_0x791a('0x1f')](_0x52fa43);return _0x5bea2e['set'](_0x791a('0x20'),_0x588d00+'-'+_0x40f0d3+'/'+_0x4a84ee)[_0x791a('0x1c')](_0x52941d);}return null;};}function patchUpdates(_0x234514){return function(_0x280f1e){try{jsonpatch['apply'](_0x280f1e,_0x234514,!![]);}catch(_0x448085){return BPromise[_0x791a('0x21')](_0x448085);}return _0x280f1e[_0x791a('0x22')]();};}function saveUpdates(_0x9e17b5,_0x3200dd){return function(_0x1091af){if(_0x1091af){return _0x1091af[_0x791a('0x23')](_0x9e17b5)[_0x791a('0x24')](function(_0x323c6a){return _0x323c6a;});}return null;};}function removeEntity(_0xe8e452,_0x137992){return function(_0x5e03a3){if(_0x5e03a3){return _0x5e03a3[_0x791a('0x25')]()[_0x791a('0x24')](function(){_0xe8e452[_0x791a('0x1f')](0xcc)[_0x791a('0x1b')]();});}};}function handleEntityNotFound(_0x4d748a,_0x456480){return function(_0x2db3f7){if(!_0x2db3f7){_0x4d748a['sendStatus'](0x194);}return _0x2db3f7;};}function handleError(_0xdfa84f,_0x1785f5){_0x1785f5=_0x1785f5||0x1f4;return function(_0x16dbaf){logger['error'](_0x16dbaf[_0x791a('0x26')]);if(_0x16dbaf[_0x791a('0x27')]){delete _0x16dbaf[_0x791a('0x27')];}_0xdfa84f[_0x791a('0x1f')](_0x1785f5)[_0x791a('0x28')](_0x16dbaf);};}exports[_0x791a('0x29')]=function(_0x628816,_0x889534){var _0x58bbc0={},_0xbc3436={},_0x9e9332={'count':0x0,'rows':[]};return db[_0x791a('0x2a')]['describe']()[_0x791a('0x24')](function(_0x5df656){var _0xc59f5e=[];for(var _0x2e4ec8=0x0;_0x2e4ec80x1){_0x24633a['or'](_0x791a('0x66'),qs[_0x791a('0x67')](_0x2d671f),null);}else{if(qs[_0x791a('0x68')](_0x2d671f)){_0x24633a['or'](_0x791a('0x69'),_0x2d671f+'%');_0x24633a['or'](_0x791a('0x6a'),_0x2d671f+'%');_0x24633a['or'](_0x791a('0x6b'),_0x2d671f+'%');_0x24633a['or'](_0x791a('0x6c'),_0x2d671f+'%');}else if(qs[_0x791a('0x6d')](_0x2d671f)){_0x24633a['or'](_0x791a('0x6e'),_0x2d671f+'%');}else{_0x24633a['or'](_0x791a('0x6f'),'%'+_0x2d671f+'%');_0x24633a['or'](_0x791a('0x70'),'%'+_0x2d671f+'%');_0x24633a['or'](_0x791a('0x6e'),'%'+_0x2d671f+'%');}}}}_0x50d442[_0x791a('0x3e')](_0x24633a);_0x50d442[_0x791a('0x71')](_0x791a('0x72'));var _0xe7fbf0={'type':db[_0x791a('0x73')][_0x791a('0x74')][_0x791a('0x75')],'raw':!![]};var _0x3cf4c7=_0x50d442['clone']()[_0x791a('0x41')](_0x791a('0x72'));if(_0x58bbc0[_0x791a('0x3c')]){_0x58bbc0[_0x791a('0x3c')][_0x791a('0x52')](function(_0x5ad4e0){_0x50d442[_0x791a('0x3c')]('c.'+_0x5ad4e0[0x0],_0x5ad4e0[0x1]===_0x791a('0x76')?![]:!![]);});}if(!_[_0x791a('0x77')](_0x860d36)){_0x50d442[_0x791a('0x78')](_0x51ea1c);_0x3cf4c7['where'](_0x791a('0x79'),_0x860d36);}BPromise['resolve']()['then'](function(){if(!_0x430ee9)return;if(_0x628816['user']['role']!==_0x791a('0x7a'))return;if(!_[_0x791a('0x7b')](_0x430ee9[_0x791a('0x4e')],[_0x791a('0x41'),_0x791a('0x55')])){return _0x628816[_0x791a('0x7c')][_0x791a('0x7d')]({'attributes':['id'],'raw':!![]})['then'](function(_0x522cb8){if(_[_0x791a('0x77')](_0x522cb8)){_0x3cf4c7[_0x791a('0x3e')]('c.ListId\x20IS\x20NULL');_0x50d442['where'](_0x791a('0x7e'));}else{_0x3cf4c7[_0x791a('0x3e')]('c.ListId\x20IN\x20?',_[_0x791a('0x51')](_0x522cb8,'id'));_0x50d442[_0x791a('0x3e')](_0x791a('0x5f'),_[_0x791a('0x51')](_0x522cb8,'id'));}});}})['then'](function(){if(_0x628816['user'][_0x791a('0x7f')]===_0x791a('0x7a')&&!_0x430ee9&&!_0x628816['query'][_0x791a('0x5e')])return[];return db[_0x791a('0x80')][_0x791a('0x37')](_0x3cf4c7[_0x791a('0x81')](),_0xe7fbf0);})['then'](function(_0x24efc2){_0x9e9332[_0x791a('0x82')]=_0x24efc2[_0x791a('0x2c')];if(_0x9e9332[_0x791a('0x82')]===0x0)return[];return db[_0x791a('0x80')][_0x791a('0x37')](_0x5bad7d[_0x791a('0x81')](),_0xe7fbf0)[_0x791a('0x24')](function(_0x5567d3){_0x5678a3=_['keyBy'](_0x5567d3,'id');_0xe7fbf0=_['merge'](_0xe7fbf0,{'model':db[_0x791a('0x2a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x628816[_0x791a('0x37')][_0x791a('0x39')]){_0x58bbc0[_0x791a('0x38')][_0x791a('0x52')](function(_0x1026be){_0x50d442[_0x791a('0x41')]('c.'+_0x1026be);});}else{_0x50d442[_0x791a('0x41')](_0x791a('0x72'));_0x50d442[_0x791a('0x41')]('c.firstName');_0x50d442[_0x791a('0x41')](_0x791a('0x83'));_0x50d442['field'](_0x791a('0x84'));_0x50d442[_0x791a('0x41')]('c.mobile');_0x50d442['field'](_0x791a('0x85'));_0x50d442[_0x791a('0x41')]('c.email');_0x50d442['field'](_0x791a('0x86'));_0x50d442[_0x791a('0x41')](_0x791a('0x87'));_0x50d442['field'](_0x791a('0x88'));_0x50d442['field'](_0x791a('0x89'));_0x50d442[_0x791a('0x41')](_0x791a('0x8a'),_0x791a('0x8b'));}if(_0x58bbc0[_0x791a('0x1e')])_0x50d442[_0x791a('0x1e')](_0x58bbc0['limit']);if(_0x58bbc0[_0x791a('0x1d')])_0x50d442[_0x791a('0x1d')](_0x58bbc0[_0x791a('0x1d')]);return db[_0x791a('0x80')][_0x791a('0x37')](_0x50d442[_0x791a('0x81')](),_0xe7fbf0);});})[_0x791a('0x24')](function(_0x2d2097){_0x2d2097[_0x791a('0x52')](function(_0x203fc5){if(_0x203fc5[_0x791a('0x8b')]){_0x203fc5[_0x791a('0x8c')]=[];_0x203fc5[_0x791a('0x8b')][_0x791a('0x50')](',')[_0x791a('0x52')](function(_0x1f5ec6){_0x203fc5[_0x791a('0x8c')][_0x791a('0x2e')](_0x5678a3[_0x1f5ec6]);});}delete _0x203fc5['TagIds'];});_0x9e9332[_0x791a('0x8d')]=_0x2d2097;return _0x9e9332;})[_0x791a('0x24')](respondWithFilteredResult(_0x889534,_0x58bbc0));})[_0x791a('0x8e')](handleError(_0x889534,null));};exports[_0x791a('0x25')]=function(_0x70fcdd,_0x5ab894){return db[_0x791a('0x2a')]['find']({'where':{'id':_0x70fcdd[_0x791a('0x8f')]['id']}})['then'](handleEntityNotFound(_0x5ab894,null))[_0x791a('0x24')](removeEntity(_0x5ab894,null))[_0x791a('0x8e')](handleError(_0x5ab894,null));};exports['describe']=function(_0x449a6d,_0x235bff){return db[_0x791a('0x2a')]['describe']()[_0x791a('0x24')](function(_0x57b1b8){delete _0x57b1b8[_0x791a('0x90')];for(var _0x5d8660=0x0;_0x5d8660=_0x36ef10){_0x2f4a06=_0x36ef10;_0x2ed6fb=0xc8;}else{_0x2ed6fb=0xce;}_0x2bad86[_0x055e('0x1e')](_0x2ed6fb);return _0x2bad86[_0x055e('0x22')](_0x055e('0x23'),_0x2cf3de+'-'+_0x2f4a06+'/'+_0x36ef10)[_0x055e('0x20')](_0x4c85dd);}return null;};}function patchUpdates(_0x4280cf){return function(_0x4675ff){try{jsonpatch['apply'](_0x4675ff,_0x4280cf,!![]);}catch(_0x31c355){return BPromise[_0x055e('0x24')](_0x31c355);}return _0x4675ff[_0x055e('0x25')]();};}function saveUpdates(_0x5930ff,_0x3f444a){return function(_0x2da6b){if(_0x2da6b){return _0x2da6b[_0x055e('0x26')](_0x5930ff)[_0x055e('0x27')](function(_0x51df23){return _0x51df23;});}return null;};}function removeEntity(_0x71a6e1,_0x56c372){return function(_0x33ffdf){if(_0x33ffdf){return _0x33ffdf[_0x055e('0x28')]()[_0x055e('0x27')](function(){_0x71a6e1[_0x055e('0x1e')](0xcc)[_0x055e('0x1f')]();});}};}function handleEntityNotFound(_0x4c653c,_0x58caf9){return function(_0x2fb49b){if(!_0x2fb49b){_0x4c653c[_0x055e('0x29')](0x194);}return _0x2fb49b;};}function handleError(_0x2a82f8,_0x4b5891){_0x4b5891=_0x4b5891||0x1f4;return function(_0x408e38){logger[_0x055e('0x2a')](_0x408e38[_0x055e('0x2b')]);if(_0x408e38[_0x055e('0x2c')]){delete _0x408e38['name'];}_0x2a82f8[_0x055e('0x1e')](_0x4b5891)['send'](_0x408e38);};}exports[_0x055e('0x2d')]=function(_0x35def0,_0x23a506){var _0x7822db={},_0x1610f1={},_0x5c0e76={'count':0x0,'rows':[]};return db[_0x055e('0x2e')][_0x055e('0x2f')]()[_0x055e('0x27')](function(_0x1499e1){var _0x36abb2=[];for(var _0x225c88=0x0;_0x225c880x1){_0x414884['or'](_0x055e('0x6f'),qs[_0x055e('0x70')](_0x334a72),null);}else{if(qs[_0x055e('0x71')](_0x334a72)){_0x414884['or'](_0x055e('0x72'),_0x334a72+'%');_0x414884['or']('c.phone\x20LIKE\x20?',_0x334a72+'%');_0x414884['or'](_0x055e('0x73'),_0x334a72+'%');_0x414884['or'](_0x055e('0x74'),_0x334a72+'%');}else if(qs['isEmail'](_0x334a72)){_0x414884['or'](_0x055e('0x75'),_0x334a72+'%');}else{_0x414884['or'](_0x055e('0x76'),'%'+_0x334a72+'%');_0x414884['or'](_0x055e('0x77'),'%'+_0x334a72+'%');_0x414884['or'](_0x055e('0x75'),'%'+_0x334a72+'%');}}}}_0x554435['where'](_0x414884);_0x554435[_0x055e('0x78')](_0x055e('0x79'));var _0xb4f2fe={'type':db['Sequelize'][_0x055e('0x7a')][_0x055e('0x7b')],'raw':!![]};var _0xf2c62d=_0x554435[_0x055e('0x7c')]()[_0x055e('0x47')]('c.id');if(_0x7822db[_0x055e('0x7d')]){_0x7822db[_0x055e('0x7d')][_0x055e('0x57')](function(_0x2934bf){_0x554435[_0x055e('0x7d')]('c.'+_0x2934bf[0x0],_0x2934bf[0x1]==='DESC'?![]:!![]);});}if(!_[_0x055e('0x67')](_0x4b1b3e)){_0x554435[_0x055e('0x7e')](_0x5ec131);_0xf2c62d[_0x055e('0x44')]('t.id\x20IN\x20?',_0x4b1b3e);}BPromise[_0x055e('0x7f')]()[_0x055e('0x27')](function(){if(!_0x1d4be3)return;if(_0x35def0[_0x055e('0x80')][_0x055e('0x81')]!==_0x055e('0x82'))return;if(!_['some'](_0x1d4be3[_0x055e('0x53')],['field',_0x055e('0x5a')])){return _0x35def0[_0x055e('0x80')]['getLists']({'attributes':['id'],'raw':!![]})[_0x055e('0x27')](function(_0x1954a3){if(_[_0x055e('0x67')](_0x1954a3)){_0xf2c62d[_0x055e('0x44')]('c.ListId\x20IS\x20NULL');_0x554435['where'](_0x055e('0x83'));}else{_0xf2c62d['where'](_0x055e('0x68'),_[_0x055e('0x64')](_0x1954a3,'id'));_0x554435[_0x055e('0x44')](_0x055e('0x68'),_[_0x055e('0x64')](_0x1954a3,'id'));}});}})[_0x055e('0x27')](function(){if(_0x35def0[_0x055e('0x80')][_0x055e('0x81')]===_0x055e('0x82')&&!_0x1d4be3&&!_0x35def0[_0x055e('0x3c')]['ListId'])return[];return db['sequelize'][_0x055e('0x3c')](_0xf2c62d[_0x055e('0x84')](),_0xb4f2fe);})['then'](function(_0x2a4df8){_0x5c0e76['count']=_0x2a4df8[_0x055e('0x31')];if(_0x5c0e76[_0x055e('0x85')]===0x0)return[];return db[_0x055e('0x86')][_0x055e('0x3c')](_0x574ea0[_0x055e('0x84')](),_0xb4f2fe)[_0x055e('0x27')](function(_0x992681){_0x1dd07b=_[_0x055e('0x87')](_0x992681,'id');_0xb4f2fe=_['merge'](_0xb4f2fe,{'model':db[_0x055e('0x2e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x35def0[_0x055e('0x3c')][_0x055e('0x40')]){_0x7822db[_0x055e('0x3f')][_0x055e('0x57')](function(_0x44804a){_0x554435[_0x055e('0x47')]('c.'+_0x44804a);});}else{_0x554435[_0x055e('0x47')](_0x055e('0x79'));_0x554435['field'](_0x055e('0x88'));_0x554435[_0x055e('0x47')]('c.lastName');_0x554435[_0x055e('0x47')](_0x055e('0x89'));_0x554435[_0x055e('0x47')](_0x055e('0x8a'));_0x554435['field'](_0x055e('0x8b'));_0x554435[_0x055e('0x47')](_0x055e('0x8c'));_0x554435[_0x055e('0x47')](_0x055e('0x8d'));_0x554435['field'](_0x055e('0x8e'));_0x554435[_0x055e('0x47')](_0x055e('0x8f'));_0x554435[_0x055e('0x47')]('c.CompanyId');_0x554435[_0x055e('0x47')](_0x055e('0x90'),_0x055e('0x91'));}if(_0x7822db[_0x055e('0x42')])_0x554435[_0x055e('0x42')](_0x7822db['limit']);if(_0x7822db[_0x055e('0x21')])_0x554435[_0x055e('0x21')](_0x7822db[_0x055e('0x21')]);return db[_0x055e('0x86')]['query'](_0x554435[_0x055e('0x84')](),_0xb4f2fe);});})[_0x055e('0x27')](function(_0x6722f){_0x6722f[_0x055e('0x57')](function(_0x53e4fc){if(_0x53e4fc[_0x055e('0x91')]){_0x53e4fc[_0x055e('0x92')]=[];_0x53e4fc[_0x055e('0x91')][_0x055e('0x56')](',')[_0x055e('0x57')](function(_0x4f6386){_0x53e4fc[_0x055e('0x92')][_0x055e('0x33')](_0x1dd07b[_0x4f6386]);});}delete _0x53e4fc[_0x055e('0x91')];});_0x5c0e76['rows']=_0x6722f;return _0x5c0e76;})['then'](respondWithFilteredResult(_0x23a506,_0x7822db));})[_0x055e('0x93')](handleError(_0x23a506,null));};exports['destroy']=function(_0x242edf,_0x18d734){return db['CmContact'][_0x055e('0x54')]({'where':{'id':_0x242edf[_0x055e('0x94')]['id']}})[_0x055e('0x27')](handleEntityNotFound(_0x18d734,null))[_0x055e('0x27')](removeEntity(_0x18d734,null))[_0x055e('0x93')](handleError(_0x18d734,null));};exports[_0x055e('0x2f')]=function(_0x1ad730,_0x2b670c){return db[_0x055e('0x2e')][_0x055e('0x2f')]()[_0x055e('0x27')](function(_0x3b05e1){delete _0x3b05e1[_0x055e('0x95')];for(var _0x1804df=0x0;_0x1804df{}\s\\|]/g,'-');_0x1ec1b4(null,util[_0x1cd3('0x21')](_0x1cd3('0x22'),path['basename'](_0x26b59a['originalname'],path[_0x1cd3('0x23')](_0x26b59a[_0x1cd3('0x1f')])),Date['now'](),path['extname'](_0x26b59a[_0x1cd3('0x1f')])));}})});router[_0x1cd3('0x18')]('/csv',upload['single'](_0x1cd3('0x24')),controller[_0x1cd3('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5635f9,_0x1c86f6,_0xc311a9){_0xc311a9(null,path[_0x1cd3('0x26')](config['root'],'server/files/tmp'));},'filename':function(_0x334ce2,_0x58b563,_0x173f0d){_0x58b563[_0x1cd3('0x1f')]=_0x58b563[_0x1cd3('0x1f')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x173f0d(null,util[_0x1cd3('0x21')]('%s-%s%s',path[_0x1cd3('0x27')](_0x58b563[_0x1cd3('0x1f')],path[_0x1cd3('0x23')](_0x58b563['originalname'])),Date[_0x1cd3('0x28')](),path[_0x1cd3('0x23')](_0x58b563[_0x1cd3('0x1f')])));}})});router[_0x1cd3('0x18')](_0x1cd3('0x29'),upload['single'](_0x1cd3('0x24')),controller[_0x1cd3('0x2a')]);router[_0x1cd3('0x18')](_0x1cd3('0x2b'),auth[_0x1cd3('0xf')](),controller[_0x1cd3('0x2c')]);router['put'](_0x1cd3('0xc'),auth[_0x1cd3('0xf')](),controller['update']);router['delete'](_0x1cd3('0xc'),auth[_0x1cd3('0xf')](),controller[_0x1cd3('0x2d')]);module[_0x1cd3('0x2e')]=router; \ No newline at end of file +var _0xffaa=['/:id/tags','diskStorage','join','root','server/files/tmp','originalname','replace','basename','now','extname','/csv','file','uploadCsv','format','/upload','upload','/upload/:id','import','put','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','isAuthenticated','index','/describe','describe','/:id','getTags','getHopperHistories','getJscriptySessions','/:id/journey','getJourney','post','/merge','merge','create','/create_many','bulkCreate'];(function(_0x50dcd8,_0x7c96d1){var _0x2bdc68=function(_0x175198){while(--_0x175198){_0x50dcd8['push'](_0x50dcd8['shift']());}};_0x2bdc68(++_0x7c96d1);}(_0xffaa,0x130));var _0xaffa=function(_0x48381f,_0x520f2b){_0x48381f=_0x48381f-0x0;var _0x298793=_0xffaa[_0x48381f];return _0x298793;};'use strict';var multer=require(_0xaffa('0x0'));var util=require(_0xaffa('0x1'));var path=require(_0xaffa('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaffa('0x3')]();var auth=require(_0xaffa('0x4'));var interaction=require(_0xaffa('0x5'));var config=require(_0xaffa('0x6'));var controller=require(_0xaffa('0x7'));router[_0xaffa('0x8')]('/',auth[_0xaffa('0x9')](),controller[_0xaffa('0xa')]);router[_0xaffa('0x8')](_0xaffa('0xb'),auth['isAuthenticated'](),controller[_0xaffa('0xc')]);router[_0xaffa('0x8')](_0xaffa('0xd'),auth[_0xaffa('0x9')](),controller['show']);router[_0xaffa('0x8')]('/:id/tags',auth[_0xaffa('0x9')](),controller[_0xaffa('0xe')]);router[_0xaffa('0x8')]('/:id/hoppers',auth[_0xaffa('0x9')](),controller['getHoppers']);router['get']('/:id/hopper_histories',auth[_0xaffa('0x9')](),controller[_0xaffa('0xf')]);router[_0xaffa('0x8')]('/:id/hopper_finals',auth[_0xaffa('0x9')](),controller['getHopperFinals']);router[_0xaffa('0x8')]('/:id/jscripty_sessions',auth[_0xaffa('0x9')](),controller[_0xaffa('0x10')]);router[_0xaffa('0x8')](_0xaffa('0x11'),auth[_0xaffa('0x9')](),controller[_0xaffa('0x12')]);router[_0xaffa('0x13')](_0xaffa('0x14'),auth['isAuthenticated'](),controller[_0xaffa('0x15')]);router[_0xaffa('0x13')]('/',auth['isAuthenticated'](),controller[_0xaffa('0x16')]);router['post'](_0xaffa('0x17'),auth[_0xaffa('0x9')](),controller[_0xaffa('0x18')]);router[_0xaffa('0x13')](_0xaffa('0x19'),auth[_0xaffa('0x9')](),controller['setTags']);var upload=multer({'storage':multer[_0xaffa('0x1a')]({'destination':function(_0x2b2040,_0x210179,_0x315cbd){_0x315cbd(null,path[_0xaffa('0x1b')](config[_0xaffa('0x1c')],_0xaffa('0x1d')));},'filename':function(_0x538663,_0x520d62,_0x2008c8){_0x520d62[_0xaffa('0x1e')]=_0x520d62[_0xaffa('0x1e')][_0xaffa('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2008c8(null,util['format']('%s-%s%s',path[_0xaffa('0x20')](_0x520d62[_0xaffa('0x1e')],path['extname'](_0x520d62[_0xaffa('0x1e')])),Date[_0xaffa('0x21')](),path[_0xaffa('0x22')](_0x520d62[_0xaffa('0x1e')])));}})});router[_0xaffa('0x13')](_0xaffa('0x23'),upload['single'](_0xaffa('0x24')),controller[_0xaffa('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5b733a,_0x3f0d5a,_0x46ac99){_0x46ac99(null,path[_0xaffa('0x1b')](config[_0xaffa('0x1c')],_0xaffa('0x1d')));},'filename':function(_0x411448,_0x2faf48,_0x42808b){_0x2faf48[_0xaffa('0x1e')]=_0x2faf48[_0xaffa('0x1e')][_0xaffa('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x42808b(null,util[_0xaffa('0x26')]('%s-%s%s',path['basename'](_0x2faf48[_0xaffa('0x1e')],path[_0xaffa('0x22')](_0x2faf48['originalname'])),Date['now'](),path['extname'](_0x2faf48[_0xaffa('0x1e')])));}})});router[_0xaffa('0x13')](_0xaffa('0x27'),upload['single'](_0xaffa('0x24')),controller[_0xaffa('0x28')]);router[_0xaffa('0x13')](_0xaffa('0x29'),auth[_0xaffa('0x9')](),controller[_0xaffa('0x2a')]);router[_0xaffa('0x2b')](_0xaffa('0xd'),auth[_0xaffa('0x9')](),controller[_0xaffa('0x2c')]);router['delete'](_0xaffa('0xd'),auth[_0xaffa('0x9')](),controller[_0xaffa('0x2d')]);module[_0xaffa('0x2e')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index f308a11..30003cd 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 _0xac9d=['TEXT','long','select','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name'];(function(_0x167eab,_0x43e1e2){var _0x2fc4d1=function(_0x2bae07){while(--_0x2bae07){_0x167eab['push'](_0x167eab['shift']());}};_0x2fc4d1(++_0x43e1e2);}(_0xac9d,0x14d));var _0xdac9=function(_0xbc1a4b,_0x4dfbe4){_0xbc1a4b=_0xbc1a4b-0x0;var _0x108b87=_0xac9d[_0xbc1a4b];return _0x108b87;};'use strict';var Sequelize=require(_0xdac9('0x0'));var _=require(_0xdac9('0x1'));module[_0xdac9('0x2')]={'name':{'type':Sequelize[_0xdac9('0x3')],'get':function(_0x12390c){return this[_0xdac9('0x4')](_0xdac9('0x5'));}},'alias':{'type':Sequelize[_0xdac9('0x6')],'allowNull':![],'set':function(_0x51a5d7){this[_0xdac9('0x7')]('alias',_0x51a5d7?_0x51a5d7:this[_0xdac9('0x4')](_0xdac9('0x8')));}},'type':{'type':Sequelize[_0xdac9('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xdac9('0x9')](_0xdac9('0xa')),'get':function(){if(this[_0xdac9('0x4')]('type')===_0xdac9('0xb')){return JSON['parse'](this[_0xdac9('0x4')](_0xdac9('0xc')));}else{return this[_0xdac9('0x4')](_0xdac9('0xc'));}},'set':function(_0x23ec14){if(Array[_0xdac9('0xd')](_0x23ec14)){this[_0xdac9('0x7')](_0xdac9('0xc'),JSON[_0xdac9('0xe')](_0x23ec14));}else{this['setDataValue'](_0xdac9('0xc'),_0x23ec14);}}},'required':{'type':Sequelize[_0xdac9('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xdac9('0x10')](_0xdac9('0x11'))}}; \ No newline at end of file +var _0x3e25=['STRING','TEXT','long','type','select','parse','values','isArray','BOOLEAN','ENUM','voice','sequelize','lodash','exports','alias','setDataValue','getDataValue','name'];(function(_0x4c9200,_0x1e8330){var _0x10a162=function(_0x244c0b){while(--_0x244c0b){_0x4c9200['push'](_0x4c9200['shift']());}};_0x10a162(++_0x1e8330);}(_0x3e25,0x14f));var _0x53e2=function(_0x22bd55,_0x5c0c56){_0x22bd55=_0x22bd55-0x0;var _0x257e45=_0x3e25[_0x22bd55];return _0x257e45;};'use strict';var Sequelize=require(_0x53e2('0x0'));var _=require(_0x53e2('0x1'));module[_0x53e2('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x7d9aaf){return this['getDataValue'](_0x53e2('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x36545f){this[_0x53e2('0x4')](_0x53e2('0x3'),_0x36545f?_0x36545f:this[_0x53e2('0x5')](_0x53e2('0x6')));}},'type':{'type':Sequelize[_0x53e2('0x7')],'allowNull':![]},'values':{'type':Sequelize[_0x53e2('0x8')](_0x53e2('0x9')),'get':function(){if(this[_0x53e2('0x5')](_0x53e2('0xa'))===_0x53e2('0xb')){return JSON[_0x53e2('0xc')](this[_0x53e2('0x5')](_0x53e2('0xd')));}else{return this[_0x53e2('0x5')](_0x53e2('0xd'));}},'set':function(_0x237ad4){if(Array[_0x53e2('0xe')](_0x237ad4)){this['setDataValue'](_0x53e2('0xd'),JSON['stringify'](_0x237ad4));}else{this['setDataValue']('values',_0x237ad4);}}},'required':{'type':Sequelize[_0x53e2('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x53e2('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x53e2('0x10')](_0x53e2('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 9205f6a..fd0f3b3 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 _0xeb00=['../../config/environment','../../mysqldb','end','json','count','offset','limit','status','set','Content-Range','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','CmCustomField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','include','find','body','sequelize','transaction','create','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xeb00,0x198));var _0x0eb0=function(_0xd538ab,_0x29f604){_0xd538ab=_0xd538ab-0x0;var _0x2b6944=_0xeb00[_0xd538ab];return _0x2b6944;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0eb0('0x0'));var rimraf=require(_0x0eb0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0eb0('0x2'));var rp=require('request-promise');var moment=require(_0x0eb0('0x3'));var BPromise=require(_0x0eb0('0x4'));var Mustache=require(_0x0eb0('0x5'));var util=require(_0x0eb0('0x6'));var path=require(_0x0eb0('0x7'));var sox=require('sox');var csv=require(_0x0eb0('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0eb0('0x9'));var squel=require(_0x0eb0('0xa'));var crypto=require('crypto');var jsforce=require(_0x0eb0('0xb'));var deskjs=require(_0x0eb0('0xc'));var toCsv=require(_0x0eb0('0x8'));var querystring=require(_0x0eb0('0xd'));var Papa=require(_0x0eb0('0xe'));var Redis=require('ioredis');var authService=require(_0x0eb0('0xf'));var qs=require(_0x0eb0('0x10'));var as=require(_0x0eb0('0x11'));var hardwareService=require(_0x0eb0('0x12'));var logger=require(_0x0eb0('0x13'))(_0x0eb0('0x14'));var utils=require(_0x0eb0('0x15'));var config=require(_0x0eb0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0eb0('0x17'))['db'];function respondWithStatusCode(_0x1230f8,_0x44e01c){_0x44e01c=_0x44e01c||0xcc;return function(_0xfd3fa){if(_0xfd3fa){return _0x1230f8['sendStatus'](_0x44e01c);}return _0x1230f8['status'](_0x44e01c)[_0x0eb0('0x18')]();};}function respondWithResult(_0x456893,_0x54885c){_0x54885c=_0x54885c||0xc8;return function(_0x482573){if(_0x482573){return _0x456893['status'](_0x54885c)[_0x0eb0('0x19')](_0x482573);}};}function respondWithFilteredResult(_0x21b393,_0x11463b){return function(_0x3aad24){if(_0x3aad24){var _0x1473bf=_0x3aad24[_0x0eb0('0x1a')],_0x5e9f40=_0x11463b['offset'],_0x167eb7=_0x11463b[_0x0eb0('0x1b')]+_0x11463b[_0x0eb0('0x1c')],_0x58d3ed;if(_0x167eb7>=_0x1473bf){_0x167eb7=_0x1473bf;_0x58d3ed=0xc8;}else{_0x58d3ed=0xce;}_0x21b393[_0x0eb0('0x1d')](_0x58d3ed);return _0x21b393[_0x0eb0('0x1e')](_0x0eb0('0x1f'),_0x5e9f40+'-'+_0x167eb7+'/'+_0x1473bf)[_0x0eb0('0x19')](_0x3aad24);}return null;};}function patchUpdates(_0x390a80){return function(_0x1c0ed7){try{jsonpatch['apply'](_0x1c0ed7,_0x390a80,!![]);}catch(_0x49c6bc){return BPromise['reject'](_0x49c6bc);}return _0x1c0ed7[_0x0eb0('0x20')]();};}function saveUpdates(_0x409a04,_0xd31ecd){return function(_0x3e50fd){if(_0x3e50fd){return _0x3e50fd[_0x0eb0('0x21')](_0x409a04)['then'](function(_0x58459b){return _0x58459b;});}return null;};}function removeEntity(_0x160350,_0x29e1d0){return function(_0x5bb617){if(_0x5bb617){return _0x5bb617[_0x0eb0('0x22')]()[_0x0eb0('0x23')](function(){_0x160350[_0x0eb0('0x1d')](0xcc)[_0x0eb0('0x18')]();});}};}function handleEntityNotFound(_0x441162,_0x38b834){return function(_0x131aea){if(!_0x131aea){_0x441162[_0x0eb0('0x24')](0x194);}return _0x131aea;};}function handleError(_0x7ac14a,_0x42a8f0){_0x42a8f0=_0x42a8f0||0x1f4;return function(_0x321e92){logger[_0x0eb0('0x25')](_0x321e92[_0x0eb0('0x26')]);if(_0x321e92[_0x0eb0('0x27')]){delete _0x321e92['name'];}_0x7ac14a['status'](_0x42a8f0)[_0x0eb0('0x28')](_0x321e92);};}exports[_0x0eb0('0x29')]=function(_0x461680,_0x5bd6a7){var _0x4b5f6a={},_0x336684={},_0x582697={'count':0x0,'rows':[]};var _0x1fdca9=_[_0x0eb0('0x2a')](db[_0x0eb0('0x2b')][_0x0eb0('0x2c')],function(_0x13981a){return{'name':_0x13981a['fieldName'],'type':_0x13981a[_0x0eb0('0x2d')][_0x0eb0('0x2e')]};});_0x336684[_0x0eb0('0x2f')]=_['differenceBy'](_[_0x0eb0('0x2a')](_0x1fdca9,_0x0eb0('0x27')),[_0x0eb0('0x27')]);_0x336684[_0x0eb0('0x30')]=_[_0x0eb0('0x31')](_0x461680['query']);_0x336684[_0x0eb0('0x32')]=_[_0x0eb0('0x33')](_0x336684['model'],_0x336684[_0x0eb0('0x30')]);_0x4b5f6a['attributes']=_[_0x0eb0('0x33')](_0x336684['model'],qs[_0x0eb0('0x34')](_0x461680[_0x0eb0('0x30')]['fields']));_0x4b5f6a['attributes']=_0x4b5f6a[_0x0eb0('0x35')][_0x0eb0('0x36')]?_0x4b5f6a[_0x0eb0('0x35')]:_0x336684[_0x0eb0('0x2f')];if(!_0x461680['query'][_0x0eb0('0x37')](_0x0eb0('0x38'))){_0x4b5f6a[_0x0eb0('0x1c')]=qs['limit'](_0x461680[_0x0eb0('0x30')]['limit']);_0x4b5f6a['offset']=qs[_0x0eb0('0x1b')](_0x461680['query'][_0x0eb0('0x1b')]);}_0x4b5f6a[_0x0eb0('0x39')]=qs[_0x0eb0('0x3a')](_0x461680[_0x0eb0('0x30')][_0x0eb0('0x3a')]);_0x4b5f6a['where']=qs[_0x0eb0('0x32')](_['pick'](_0x461680[_0x0eb0('0x30')],_0x336684['filters']),_0x1fdca9);if(_0x461680[_0x0eb0('0x30')]['filter']){_0x4b5f6a[_0x0eb0('0x3b')]=_[_0x0eb0('0x3c')](_0x4b5f6a['where'],{'$or':_['map'](_0x1fdca9,function(_0x4895b1){if(_0x4895b1[_0x0eb0('0x2d')]!==_0x0eb0('0x3d')){var _0x4aa2bd={};_0x4aa2bd[_0x4895b1['name']]={'$like':'%'+_0x461680[_0x0eb0('0x30')][_0x0eb0('0x3e')]+'%'};return _0x4aa2bd;}})});}_0x4b5f6a=_['merge']({},_0x4b5f6a,_0x461680[_0x0eb0('0x3f')]);var _0x12b381={'where':_0x4b5f6a['where']};return db[_0x0eb0('0x2b')][_0x0eb0('0x1a')](_0x12b381)[_0x0eb0('0x23')](function(_0x1faeb7){_0x582697[_0x0eb0('0x1a')]=_0x1faeb7;if(_0x461680[_0x0eb0('0x30')][_0x0eb0('0x40')]){_0x4b5f6a['include']=[{'all':!![]}];}return db['CmCustomField'][_0x0eb0('0x41')](_0x4b5f6a);})[_0x0eb0('0x23')](function(_0x4ee0c3){_0x582697[_0x0eb0('0x42')]=_0x4ee0c3;return _0x582697;})[_0x0eb0('0x23')](respondWithFilteredResult(_0x5bd6a7,_0x4b5f6a))[_0x0eb0('0x43')](handleError(_0x5bd6a7,null));};exports[_0x0eb0('0x44')]=function(_0xa428a3,_0x4600f8){var _0x116f09={'raw':!![],'where':{'id':_0xa428a3[_0x0eb0('0x45')]['id']}},_0x392dda={};_0x392dda[_0x0eb0('0x2f')]=_[_0x0eb0('0x31')](db['CmCustomField'][_0x0eb0('0x2c')]);_0x392dda['query']=_[_0x0eb0('0x31')](_0xa428a3[_0x0eb0('0x30')]);_0x392dda[_0x0eb0('0x32')]=_[_0x0eb0('0x33')](_0x392dda[_0x0eb0('0x2f')],_0x392dda[_0x0eb0('0x30')]);_0x116f09[_0x0eb0('0x35')]=_[_0x0eb0('0x33')](_0x392dda[_0x0eb0('0x2f')],qs[_0x0eb0('0x34')](_0xa428a3['query']['fields']));_0x116f09[_0x0eb0('0x35')]=_0x116f09[_0x0eb0('0x35')][_0x0eb0('0x36')]?_0x116f09[_0x0eb0('0x35')]:_0x392dda[_0x0eb0('0x2f')];if(_0xa428a3[_0x0eb0('0x30')][_0x0eb0('0x40')]){_0x116f09[_0x0eb0('0x46')]=[{'all':!![]}];}_0x116f09=_[_0x0eb0('0x3c')]({},_0x116f09,_0xa428a3[_0x0eb0('0x3f')]);return db[_0x0eb0('0x2b')][_0x0eb0('0x47')](_0x116f09)[_0x0eb0('0x23')](handleEntityNotFound(_0x4600f8,null))['then'](respondWithResult(_0x4600f8,null))['catch'](handleError(_0x4600f8,null));};exports[_0x0eb0('0x21')]=function(_0x5ddc3e,_0x50579a){if(_0x5ddc3e['body']['id']){delete _0x5ddc3e[_0x0eb0('0x48')]['id'];}return db[_0x0eb0('0x2b')][_0x0eb0('0x47')]({'where':{'id':_0x5ddc3e[_0x0eb0('0x45')]['id']}})['then'](handleEntityNotFound(_0x50579a,null))[_0x0eb0('0x23')](saveUpdates(_0x5ddc3e['body'],null))['then'](respondWithResult(_0x50579a,null))[_0x0eb0('0x43')](handleError(_0x50579a,null));};exports[_0x0eb0('0x22')]=function(_0x34d212,_0xdcfcd3){return db['CmCustomField'][_0x0eb0('0x47')]({'where':{'id':_0x34d212[_0x0eb0('0x45')]['id']}})['then'](handleEntityNotFound(_0xdcfcd3,null))[_0x0eb0('0x23')](removeEntity(_0xdcfcd3,null))[_0x0eb0('0x43')](handleError(_0xdcfcd3,null));};exports['create']=function(_0x326093,_0x287141){var _0x4c65b4;return db[_0x0eb0('0x49')][_0x0eb0('0x4a')](function(_0x325231){return db[_0x0eb0('0x2b')][_0x0eb0('0x4b')](_0x326093[_0x0eb0('0x48')],{'transaction':_0x325231})[_0x0eb0('0x23')](function(_0x565a1e){_0x4c65b4=_0x565a1e;var _0x520822={'type':db[_0x0eb0('0x4c')]['TEXT'],'transaction':_0x325231};switch(_0x326093['body'][_0x0eb0('0x2d')]){case'text':_0x520822['type']=db[_0x0eb0('0x4c')]['TEXT'];break;case _0x0eb0('0x4d'):_0x520822[_0x0eb0('0x2d')]=db['Sequelize'][_0x0eb0('0x4e')];break;case _0x0eb0('0x4f'):_0x520822[_0x0eb0('0x2d')]=db[_0x0eb0('0x4c')][_0x0eb0('0x50')];_0x520822[_0x0eb0('0x51')]=![];break;default:}return db[_0x0eb0('0x49')][_0x0eb0('0x52')][_0x0eb0('0x53')]('cm_contacts',util[_0x0eb0('0x54')](_0x0eb0('0x55'),_0x4c65b4['id']),_0x520822);})[_0x0eb0('0x23')](function(){return _0x4c65b4;});})['then'](respondWithResult(_0x287141,0xc9))[_0x0eb0('0x43')](handleError(_0x287141,null));}; \ No newline at end of file +var _0x5e17=['name','send','index','rawAttributes','fieldName','type','key','differenceBy','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','CmCustomField','options','find','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','defaultValue','cf_%d','html-pdf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','status','set','reject','save','update','then','error','stack'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x5e17,0x17a));var _0x75e1=function(_0x25d7bf,_0x564e77){_0x25d7bf=_0x25d7bf-0x0;var _0x565d3a=_0x5e17[_0x25d7bf];return _0x565d3a;};'use strict';var pdf=require(_0x75e1('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x75e1('0x1'));var BPromise=require(_0x75e1('0x2'));var Mustache=require(_0x75e1('0x3'));var util=require(_0x75e1('0x4'));var path=require(_0x75e1('0x5'));var sox=require(_0x75e1('0x6'));var csv=require(_0x75e1('0x7'));var ejs=require(_0x75e1('0x8'));var fs=require('fs');var _=require(_0x75e1('0x9'));var squel=require(_0x75e1('0xa'));var crypto=require(_0x75e1('0xb'));var jsforce=require(_0x75e1('0xc'));var deskjs=require(_0x75e1('0xd'));var toCsv=require(_0x75e1('0x7'));var querystring=require(_0x75e1('0xe'));var Papa=require('papaparse');var Redis=require(_0x75e1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75e1('0x10'));var hardwareService=require(_0x75e1('0x11'));var logger=require(_0x75e1('0x12'))(_0x75e1('0x13'));var utils=require(_0x75e1('0x14'));var config=require(_0x75e1('0x15'));var licenseUtil=require(_0x75e1('0x16'));var db=require(_0x75e1('0x17'))['db'];function respondWithStatusCode(_0x4eb893,_0x3a4e57){_0x3a4e57=_0x3a4e57||0xcc;return function(_0x39b1a1){if(_0x39b1a1){return _0x4eb893[_0x75e1('0x18')](_0x3a4e57);}return _0x4eb893['status'](_0x3a4e57)[_0x75e1('0x19')]();};}function respondWithResult(_0x403bd9,_0x677339){_0x677339=_0x677339||0xc8;return function(_0x260f06){if(_0x260f06){return _0x403bd9['status'](_0x677339)[_0x75e1('0x1a')](_0x260f06);}};}function respondWithFilteredResult(_0x262ac4,_0xdd134a){return function(_0x37e351){if(_0x37e351){var _0x3b50fe=_0x37e351[_0x75e1('0x1b')],_0x125932=_0xdd134a[_0x75e1('0x1c')],_0x2fcad5=_0xdd134a[_0x75e1('0x1c')]+_0xdd134a['limit'],_0x56c741;if(_0x2fcad5>=_0x3b50fe){_0x2fcad5=_0x3b50fe;_0x56c741=0xc8;}else{_0x56c741=0xce;}_0x262ac4[_0x75e1('0x1d')](_0x56c741);return _0x262ac4[_0x75e1('0x1e')]('Content-Range',_0x125932+'-'+_0x2fcad5+'/'+_0x3b50fe)[_0x75e1('0x1a')](_0x37e351);}return null;};}function patchUpdates(_0x1581a7){return function(_0x3bbe34){try{jsonpatch['apply'](_0x3bbe34,_0x1581a7,!![]);}catch(_0x384553){return BPromise[_0x75e1('0x1f')](_0x384553);}return _0x3bbe34[_0x75e1('0x20')]();};}function saveUpdates(_0x180b61,_0x1ae04e){return function(_0x546806){if(_0x546806){return _0x546806[_0x75e1('0x21')](_0x180b61)['then'](function(_0x3597ef){return _0x3597ef;});}return null;};}function removeEntity(_0x2a473a,_0x2ba733){return function(_0x50cdc1){if(_0x50cdc1){return _0x50cdc1['destroy']()[_0x75e1('0x22')](function(){_0x2a473a[_0x75e1('0x1d')](0xcc)[_0x75e1('0x19')]();});}};}function handleEntityNotFound(_0x2a6547,_0x1f81e6){return function(_0x1d7c2e){if(!_0x1d7c2e){_0x2a6547[_0x75e1('0x18')](0x194);}return _0x1d7c2e;};}function handleError(_0x562c87,_0x372837){_0x372837=_0x372837||0x1f4;return function(_0x23c9d0){logger[_0x75e1('0x23')](_0x23c9d0[_0x75e1('0x24')]);if(_0x23c9d0[_0x75e1('0x25')]){delete _0x23c9d0[_0x75e1('0x25')];}_0x562c87[_0x75e1('0x1d')](_0x372837)[_0x75e1('0x26')](_0x23c9d0);};}exports[_0x75e1('0x27')]=function(_0x51f300,_0x3ecd50){var _0x262a55={},_0x288c9c={},_0x4da785={'count':0x0,'rows':[]};var _0x24ab1e=_['map'](db['CmCustomField'][_0x75e1('0x28')],function(_0x39064b){return{'name':_0x39064b[_0x75e1('0x29')],'type':_0x39064b[_0x75e1('0x2a')][_0x75e1('0x2b')]};});_0x288c9c['model']=_[_0x75e1('0x2c')](_[_0x75e1('0x2d')](_0x24ab1e,_0x75e1('0x25')),['name']);_0x288c9c[_0x75e1('0x2e')]=_[_0x75e1('0x2f')](_0x51f300['query']);_0x288c9c[_0x75e1('0x30')]=_[_0x75e1('0x31')](_0x288c9c[_0x75e1('0x32')],_0x288c9c[_0x75e1('0x2e')]);_0x262a55[_0x75e1('0x33')]=_['intersection'](_0x288c9c[_0x75e1('0x32')],qs[_0x75e1('0x34')](_0x51f300['query'][_0x75e1('0x34')]));_0x262a55[_0x75e1('0x33')]=_0x262a55[_0x75e1('0x33')][_0x75e1('0x35')]?_0x262a55[_0x75e1('0x33')]:_0x288c9c[_0x75e1('0x32')];if(!_0x51f300['query'][_0x75e1('0x36')]('nolimit')){_0x262a55['limit']=qs[_0x75e1('0x37')](_0x51f300[_0x75e1('0x2e')][_0x75e1('0x37')]);_0x262a55[_0x75e1('0x1c')]=qs[_0x75e1('0x1c')](_0x51f300[_0x75e1('0x2e')][_0x75e1('0x1c')]);}_0x262a55[_0x75e1('0x38')]=qs[_0x75e1('0x39')](_0x51f300[_0x75e1('0x2e')][_0x75e1('0x39')]);_0x262a55[_0x75e1('0x3a')]=qs[_0x75e1('0x30')](_['pick'](_0x51f300[_0x75e1('0x2e')],_0x288c9c[_0x75e1('0x30')]),_0x24ab1e);if(_0x51f300[_0x75e1('0x2e')][_0x75e1('0x3b')]){_0x262a55[_0x75e1('0x3a')]=_[_0x75e1('0x3c')](_0x262a55['where'],{'$or':_[_0x75e1('0x2d')](_0x24ab1e,function(_0x28219c){if(_0x28219c[_0x75e1('0x2a')]!==_0x75e1('0x3d')){var _0x1de4e6={};_0x1de4e6[_0x28219c[_0x75e1('0x25')]]={'$like':'%'+_0x51f300['query'][_0x75e1('0x3b')]+'%'};return _0x1de4e6;}})});}_0x262a55=_[_0x75e1('0x3c')]({},_0x262a55,_0x51f300['options']);var _0x15ddf8={'where':_0x262a55[_0x75e1('0x3a')]};return db['CmCustomField'][_0x75e1('0x1b')](_0x15ddf8)[_0x75e1('0x22')](function(_0x190371){_0x4da785[_0x75e1('0x1b')]=_0x190371;if(_0x51f300[_0x75e1('0x2e')][_0x75e1('0x3e')]){_0x262a55[_0x75e1('0x3f')]=[{'all':!![]}];}return db['CmCustomField'][_0x75e1('0x40')](_0x262a55);})[_0x75e1('0x22')](function(_0x5dc1de){_0x4da785[_0x75e1('0x41')]=_0x5dc1de;return _0x4da785;})['then'](respondWithFilteredResult(_0x3ecd50,_0x262a55))[_0x75e1('0x42')](handleError(_0x3ecd50,null));};exports[_0x75e1('0x43')]=function(_0x5c3d3f,_0x4ffc45){var _0x270148={'raw':!![],'where':{'id':_0x5c3d3f[_0x75e1('0x44')]['id']}},_0x5dd6cd={};_0x5dd6cd[_0x75e1('0x32')]=_[_0x75e1('0x2f')](db[_0x75e1('0x45')]['rawAttributes']);_0x5dd6cd[_0x75e1('0x2e')]=_[_0x75e1('0x2f')](_0x5c3d3f[_0x75e1('0x2e')]);_0x5dd6cd[_0x75e1('0x30')]=_[_0x75e1('0x31')](_0x5dd6cd['model'],_0x5dd6cd[_0x75e1('0x2e')]);_0x270148[_0x75e1('0x33')]=_[_0x75e1('0x31')](_0x5dd6cd[_0x75e1('0x32')],qs[_0x75e1('0x34')](_0x5c3d3f[_0x75e1('0x2e')][_0x75e1('0x34')]));_0x270148['attributes']=_0x270148[_0x75e1('0x33')]['length']?_0x270148[_0x75e1('0x33')]:_0x5dd6cd[_0x75e1('0x32')];if(_0x5c3d3f[_0x75e1('0x2e')]['includeAll']){_0x270148[_0x75e1('0x3f')]=[{'all':!![]}];}_0x270148=_['merge']({},_0x270148,_0x5c3d3f[_0x75e1('0x46')]);return db[_0x75e1('0x45')][_0x75e1('0x47')](_0x270148)[_0x75e1('0x22')](handleEntityNotFound(_0x4ffc45,null))['then'](respondWithResult(_0x4ffc45,null))[_0x75e1('0x42')](handleError(_0x4ffc45,null));};exports[_0x75e1('0x21')]=function(_0x42f263,_0x199be6){if(_0x42f263[_0x75e1('0x48')]['id']){delete _0x42f263[_0x75e1('0x48')]['id'];}return db[_0x75e1('0x45')][_0x75e1('0x47')]({'where':{'id':_0x42f263[_0x75e1('0x44')]['id']}})[_0x75e1('0x22')](handleEntityNotFound(_0x199be6,null))[_0x75e1('0x22')](saveUpdates(_0x42f263[_0x75e1('0x48')],null))[_0x75e1('0x22')](respondWithResult(_0x199be6,null))[_0x75e1('0x42')](handleError(_0x199be6,null));};exports['destroy']=function(_0x19bee2,_0x20179d){return db[_0x75e1('0x45')][_0x75e1('0x47')]({'where':{'id':_0x19bee2['params']['id']}})['then'](handleEntityNotFound(_0x20179d,null))['then'](removeEntity(_0x20179d,null))[_0x75e1('0x42')](handleError(_0x20179d,null));};exports[_0x75e1('0x49')]=function(_0x2c4faa,_0x4973b5){var _0x49de84;return db[_0x75e1('0x4a')][_0x75e1('0x4b')](function(_0x30816a){return db[_0x75e1('0x45')][_0x75e1('0x49')](_0x2c4faa[_0x75e1('0x48')],{'transaction':_0x30816a})[_0x75e1('0x22')](function(_0x12f13b){_0x49de84=_0x12f13b;var _0x572a9a={'type':db[_0x75e1('0x4c')][_0x75e1('0x4d')],'transaction':_0x30816a};switch(_0x2c4faa['body']['type']){case _0x75e1('0x4e'):_0x572a9a[_0x75e1('0x2a')]=db[_0x75e1('0x4c')][_0x75e1('0x4d')];break;case _0x75e1('0x4f'):_0x572a9a[_0x75e1('0x2a')]=db[_0x75e1('0x4c')][_0x75e1('0x50')];break;case'switch':_0x572a9a['type']=db['Sequelize']['BOOLEAN'];_0x572a9a[_0x75e1('0x51')]=![];break;default:}return db[_0x75e1('0x4a')]['queryInterface']['addColumn']('cm_contacts',util['format'](_0x75e1('0x52'),_0x49de84['id']),_0x572a9a);})[_0x75e1('0x22')](function(){return _0x49de84;});})[_0x75e1('0x22')](respondWithResult(_0x4973b5,0xc9))[_0x75e1('0x42')](handleError(_0x4973b5,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 2b458e6..da8a821 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 _0x3067=['../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2ac7c2,_0x4d51b2){var _0x37834e=function(_0xa91fb8){while(--_0xa91fb8){_0x2ac7c2['push'](_0x2ac7c2['shift']());}};_0x37834e(++_0x4d51b2);}(_0x3067,0x7e));var _0x7306=function(_0x174fce,_0x7f5aa6){_0x174fce=_0x174fce-0x0;var _0x37a41c=_0x3067[_0x174fce];return _0x37a41c;};'use strict';var _=require(_0x7306('0x0'));var util=require(_0x7306('0x1'));var logger=require(_0x7306('0x2'))(_0x7306('0x3'));var moment=require(_0x7306('0x4'));var BPromise=require(_0x7306('0x5'));var rp=require(_0x7306('0x6'));var fs=require('fs');var path=require(_0x7306('0x7'));var rimraf=require(_0x7306('0x8'));var config=require(_0x7306('0x9'));var attributes=require(_0x7306('0xa'));module[_0x7306('0xb')]=function(_0x16f4ec,_0x3ecef7){return _0x16f4ec[_0x7306('0xc')](_0x7306('0xd'),attributes,{'tableName':_0x7306('0xe'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f74=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./cmCustomField.attributes','define','CmCustomField','cm_custom_fields'];(function(_0x55e4c7,_0x54a18d){var _0x250684=function(_0x3ba931){while(--_0x3ba931){_0x55e4c7['push'](_0x55e4c7['shift']());}};_0x250684(++_0x54a18d);}(_0x2f74,0xf0));var _0x42f7=function(_0x49873f,_0xebd2b8){_0x49873f=_0x49873f-0x0;var _0x518b6d=_0x2f74[_0x49873f];return _0x518b6d;};'use strict';var _=require(_0x42f7('0x0'));var util=require(_0x42f7('0x1'));var logger=require(_0x42f7('0x2'))(_0x42f7('0x3'));var moment=require(_0x42f7('0x4'));var BPromise=require(_0x42f7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x42f7('0x6'));var rimraf=require('rimraf');var config=require(_0x42f7('0x7'));var attributes=require(_0x42f7('0x8'));module['exports']=function(_0x48be47,_0x5b2761){return _0x48be47[_0x42f7('0x9')](_0x42f7('0xa'),attributes,{'tableName':_0x42f7('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 6f9ff92..2af4957 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 _0x80d9=['http','request','then','info','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3e8bd9,_0x2cf342){var _0x47e80e=function(_0x142ef3){while(--_0x142ef3){_0x3e8bd9['push'](_0x3e8bd9['shift']());}};_0x47e80e(++_0x2cf342);}(_0x80d9,0x15c));var _0x980d=function(_0xcce94e,_0x57e9f3){_0xcce94e=_0xcce94e-0x0;var _0x1da23a=_0x80d9[_0xcce94e];return _0x1da23a;};'use strict';var _=require(_0x980d('0x0'));var util=require('util');var moment=require(_0x980d('0x1'));var BPromise=require(_0x980d('0x2'));var rs=require(_0x980d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x980d('0x4'))['db'];var utils=require(_0x980d('0x5'));var logger=require(_0x980d('0x6'))(_0x980d('0x7'));var config=require(_0x980d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x980d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50854e,_0x5d9eb0,_0x7e96f7){return new BPromise(function(_0x758fc3,_0x2b8e2c){return client[_0x980d('0xa')](_0x50854e,_0x7e96f7)[_0x980d('0xb')](function(_0xef5778){logger[_0x980d('0xc')]('CmCustomField,\x20%s,\x20%s',_0x5d9eb0,'request\x20sent');logger['debug'](_0x980d('0xd'),_0x5d9eb0,_0x980d('0xe'),JSON['stringify'](_0xef5778));if(_0xef5778[_0x980d('0xf')]){if(_0xef5778['error'][_0x980d('0x10')]===0x1f4){logger['error'](_0x980d('0x11'),_0x5d9eb0,_0xef5778[_0x980d('0xf')][_0x980d('0x12')]);return _0x2b8e2c(_0xef5778[_0x980d('0xf')][_0x980d('0x12')]);}logger[_0x980d('0xf')](_0x980d('0x11'),_0x5d9eb0,_0xef5778[_0x980d('0xf')]['message']);return _0x758fc3(_0xef5778[_0x980d('0xf')][_0x980d('0x12')]);}else{logger[_0x980d('0xc')](_0x980d('0x11'),_0x5d9eb0,_0x980d('0xe'));_0x758fc3(_0xef5778[_0x980d('0x13')]['message']);}})[_0x980d('0x14')](function(_0x393ae2){logger['error'](_0x980d('0x11'),_0x5d9eb0,_0x393ae2);_0x2b8e2c(_0x393ae2);});});} \ No newline at end of file +var _0xc368=['client','request','then','request\x20sent','debug','stringify','error','code','CmCustomField,\x20%s,\x20%s','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x25c9fc,_0x3cc5a4){var _0x50b116=function(_0x2c91a3){while(--_0x2c91a3){_0x25c9fc['push'](_0x25c9fc['shift']());}};_0x50b116(++_0x3cc5a4);}(_0xc368,0x7b));var _0x8c36=function(_0x47b82e,_0x27451b){_0x47b82e=_0x47b82e-0x0;var _0x3f1ffa=_0xc368[_0x47b82e];return _0x3f1ffa;};'use strict';var _=require('lodash');var util=require(_0x8c36('0x0'));var moment=require('moment');var BPromise=require(_0x8c36('0x1'));var rs=require(_0x8c36('0x2'));var fs=require('fs');var Redis=require(_0x8c36('0x3'));var db=require(_0x8c36('0x4'))['db'];var utils=require(_0x8c36('0x5'));var logger=require('../../config/logger')(_0x8c36('0x6'));var config=require(_0x8c36('0x7'));var jayson=require(_0x8c36('0x8'));var client=jayson[_0x8c36('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x554022,_0x8ed437,_0x384867){return new BPromise(function(_0x3e76be,_0x26bad1){return client[_0x8c36('0xa')](_0x554022,_0x384867)[_0x8c36('0xb')](function(_0x569f29){logger['info']('CmCustomField,\x20%s,\x20%s',_0x8ed437,_0x8c36('0xc'));logger[_0x8c36('0xd')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x8ed437,_0x8c36('0xc'),JSON[_0x8c36('0xe')](_0x569f29));if(_0x569f29[_0x8c36('0xf')]){if(_0x569f29[_0x8c36('0xf')][_0x8c36('0x10')]===0x1f4){logger[_0x8c36('0xf')](_0x8c36('0x11'),_0x8ed437,_0x569f29[_0x8c36('0xf')][_0x8c36('0x12')]);return _0x26bad1(_0x569f29[_0x8c36('0xf')][_0x8c36('0x12')]);}logger[_0x8c36('0xf')](_0x8c36('0x11'),_0x8ed437,_0x569f29[_0x8c36('0xf')]['message']);return _0x3e76be(_0x569f29[_0x8c36('0xf')]['message']);}else{logger[_0x8c36('0x13')](_0x8c36('0x11'),_0x8ed437,_0x8c36('0xc'));_0x3e76be(_0x569f29[_0x8c36('0x14')][_0x8c36('0x12')]);}})[_0x8c36('0x15')](function(_0x3c10eb){logger[_0x8c36('0xf')](_0x8c36('0x11'),_0x8ed437,_0x3c10eb);_0x26bad1(_0x3c10eb);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 30650f4..7504aa3 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 _0x6645=['util','path','connect-timeout','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','multer'];(function(_0x525886,_0x5af525){var _0x3a0ea9=function(_0x99946d){while(--_0x99946d){_0x525886['push'](_0x525886['shift']());}};_0x3a0ea9(++_0x5af525);}(_0x6645,0xcb));var _0x5664=function(_0x264693,_0xfc65fb){_0x264693=_0x264693-0x0;var _0x27b74b=_0x6645[_0x264693];return _0x27b74b;};'use strict';var multer=require(_0x5664('0x0'));var util=require(_0x5664('0x1'));var path=require(_0x5664('0x2'));var timeout=require(_0x5664('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x5664('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5664('0x5'));var controller=require(_0x5664('0x6'));router[_0x5664('0x7')]('/',auth[_0x5664('0x8')](),controller[_0x5664('0x9')]);router[_0x5664('0x7')](_0x5664('0xa'),auth[_0x5664('0x8')](),controller[_0x5664('0xb')]);router[_0x5664('0xc')]('/',auth[_0x5664('0x8')](),controller['create']);router['put'](_0x5664('0xa'),auth[_0x5664('0x8')](),controller[_0x5664('0xd')]);router[_0x5664('0xe')](_0x5664('0xa'),auth['isAuthenticated'](),controller[_0x5664('0xf')]);module[_0x5664('0x10')]=router; \ No newline at end of file +var _0x6d07=['destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','put','delete'];(function(_0x4becb8,_0x4ad3d3){var _0x5c8a37=function(_0x3d52da){while(--_0x3d52da){_0x4becb8['push'](_0x4becb8['shift']());}};_0x5c8a37(++_0x4ad3d3);}(_0x6d07,0x134));var _0x76d0=function(_0x15e636,_0x2264f4){_0x15e636=_0x15e636-0x0;var _0x5e76b0=_0x6d07[_0x15e636];return _0x5e76b0;};'use strict';var multer=require('multer');var util=require(_0x76d0('0x0'));var path=require(_0x76d0('0x1'));var timeout=require(_0x76d0('0x2'));var express=require(_0x76d0('0x3'));var router=express[_0x76d0('0x4')]();var auth=require(_0x76d0('0x5'));var interaction=require(_0x76d0('0x6'));var config=require(_0x76d0('0x7'));var controller=require('./cmCustomField.controller');router[_0x76d0('0x8')]('/',auth[_0x76d0('0x9')](),controller[_0x76d0('0xa')]);router[_0x76d0('0x8')](_0x76d0('0xb'),auth['isAuthenticated'](),controller[_0x76d0('0xc')]);router['post']('/',auth[_0x76d0('0x9')](),controller['create']);router[_0x76d0('0xd')]('/:id',auth[_0x76d0('0x9')](),controller['update']);router[_0x76d0('0xe')](_0x76d0('0xb'),auth[_0x76d0('0x9')](),controller[_0x76d0('0xf')]);module[_0x76d0('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 3691e9e..2a38de0 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 _0xdbf5=['sequelize','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','UNSIGNED','contactListQueue'];(function(_0x46de01,_0x41a5c6){var _0x12a8cb=function(_0x5d50ad){while(--_0x5d50ad){_0x46de01['push'](_0x46de01['shift']());}};_0x12a8cb(++_0x41a5c6);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x5d5427,_0x1459da){_0x5d5427=_0x5d5427-0x0;var _0x99fef6=_0xdbf5[_0x5d5427];return _0x99fef6;};'use strict';var moment=require('moment');var Sequelize=require(_0x5dbf('0x0'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x5dbf('0x1')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x5dbf('0x2')],'defaultValue':moment()[_0x5dbf('0x3')](_0x5dbf('0x4'))},'countbusyretry':{'type':Sequelize[_0x5dbf('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5dbf('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x5dbf('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x5dbf('0x1')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5dbf('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5dbf('0x2')]},'priority':{'type':Sequelize[_0x5dbf('0x5')](0x2)[_0x5dbf('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x5dbf('0x1')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x5dbf('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x5dbf('0x8')},'UserId':{'type':Sequelize[_0x5dbf('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x5dbf('0x5')],'unique':_0x5dbf('0x8')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0x5dbf('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x5dbf('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xca9e=['UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xca9e,0x136));var _0xeca9=function(_0x5e0326,_0x4edfc3){_0x5e0326=_0x5e0326-0x0;var _0x17400d=_0xca9e[_0x5e0326];return _0x17400d;};'use strict';var moment=require(_0xeca9('0x0'));var Sequelize=require(_0xeca9('0x1'));module[_0xeca9('0x2')]={'phone':{'type':Sequelize[_0xeca9('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xeca9('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xeca9('0x5')],'defaultValue':moment()[_0xeca9('0x6')](_0xeca9('0x7'))},'countbusyretry':{'type':Sequelize[_0xeca9('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xeca9('0x8')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xeca9('0x8')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xeca9('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xeca9('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xeca9('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xeca9('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xeca9('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xeca9('0x8')],'unique':_0xeca9('0xa')},'UserId':{'type':Sequelize[_0xeca9('0x8')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xeca9('0xa')},'CampaignId':{'type':Sequelize[_0xeca9('0x8')]},'countnosuchnumberretry':{'type':Sequelize[_0xeca9('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xeca9('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xeca9('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xeca9('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index ea866a2..3075509 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 _0xa788=['sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','type','key','query','keys','filters','intersection','model','concat','$and','$or','$gte','$lte','$ne','$eq','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','campaign','user','UserId','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','direction','hopperIds','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','CmCompany','Company','CmList','List','VoiceQueue','Queue','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','ejs','lodash','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','status','end','json','count','offset','limit','set','Content-Range','apply','save','then'];(function(_0x4715d0,_0x3369ef){var _0x4c2687=function(_0x305a63){while(--_0x305a63){_0x4715d0['push'](_0x4715d0['shift']());}};_0x4c2687(++_0x3369ef);}(_0xa788,0x70));var _0x8a78=function(_0x22a8d9,_0x3dc837){_0x22a8d9=_0x22a8d9-0x0;var _0x1a8a22=_0xa788[_0x22a8d9];return _0x1a8a22;};'use strict';var pdf=require(_0x8a78('0x0'));var emlformat=require(_0x8a78('0x1'));var rimraf=require(_0x8a78('0x2'));var zipdir=require(_0x8a78('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8a78('0x4'));var moment=require(_0x8a78('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8a78('0x6'));var util=require(_0x8a78('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8a78('0x8'));var fs=require('fs');var _=require(_0x8a78('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8a78('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8a78('0xb'));var Papa=require(_0x8a78('0xc'));var Redis=require('ioredis');var authService=require(_0x8a78('0xd'));var qs=require(_0x8a78('0xe'));var as=require(_0x8a78('0xf'));var hardwareService=require(_0x8a78('0x10'));var logger=require(_0x8a78('0x11'))(_0x8a78('0x12'));var utils=require(_0x8a78('0x13'));var config=require(_0x8a78('0x14'));var licenseUtil=require(_0x8a78('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x299461,_0x294b34){_0x294b34=_0x294b34||0xcc;return function(_0x31b77e){if(_0x31b77e){return _0x299461['sendStatus'](_0x294b34);}return _0x299461[_0x8a78('0x16')](_0x294b34)[_0x8a78('0x17')]();};}function respondWithResult(_0x18c057,_0x4b073b){_0x4b073b=_0x4b073b||0xc8;return function(_0x423787){if(_0x423787){return _0x18c057['status'](_0x4b073b)[_0x8a78('0x18')](_0x423787);}};}function respondWithFilteredResult(_0x53001e,_0x429b2c){return function(_0x586d47){if(_0x586d47){var _0x57212b=_0x586d47[_0x8a78('0x19')],_0x580cf9=_0x429b2c[_0x8a78('0x1a')],_0x118d34=_0x429b2c[_0x8a78('0x1a')]+_0x429b2c[_0x8a78('0x1b')],_0x27822b;if(_0x118d34>=_0x57212b){_0x118d34=_0x57212b;_0x27822b=0xc8;}else{_0x27822b=0xce;}_0x53001e[_0x8a78('0x16')](_0x27822b);return _0x53001e[_0x8a78('0x1c')](_0x8a78('0x1d'),_0x580cf9+'-'+_0x118d34+'/'+_0x57212b)[_0x8a78('0x18')](_0x586d47);}return null;};}function patchUpdates(_0xf8b886){return function(_0x3de1ac){try{jsonpatch[_0x8a78('0x1e')](_0x3de1ac,_0xf8b886,!![]);}catch(_0x31e946){return BPromise['reject'](_0x31e946);}return _0x3de1ac[_0x8a78('0x1f')]();};}function saveUpdates(_0x557e98,_0xa6f4b8){return function(_0x1dd032){if(_0x1dd032){return _0x1dd032['update'](_0x557e98)[_0x8a78('0x20')](function(_0x28e5da){return _0x28e5da;});}return null;};}function removeEntity(_0x2ceb56,_0x43b3b8){return function(_0x2d7d03){if(_0x2d7d03){return _0x2d7d03['destroy']()[_0x8a78('0x20')](function(){_0x2ceb56['status'](0xcc)[_0x8a78('0x17')]();});}};}function handleEntityNotFound(_0x43305f,_0x118357){return function(_0x381795){if(!_0x381795){_0x43305f[_0x8a78('0x21')](0x194);}return _0x381795;};}function handleError(_0x326add,_0x4a89a1){_0x4a89a1=_0x4a89a1||0x1f4;return function(_0x5c2115){logger[_0x8a78('0x22')](_0x5c2115[_0x8a78('0x23')]);if(_0x5c2115[_0x8a78('0x24')]){delete _0x5c2115['name'];}_0x326add[_0x8a78('0x16')](_0x4a89a1)[_0x8a78('0x25')](_0x5c2115);};}exports[_0x8a78('0x26')]=function(_0x494d78,_0x33b157){var _0x38b27d={},_0x14be2b={},_0x503b4e={'count':0x0,'rows':[]};var _0x4872fd=_[_0x8a78('0x27')](db[_0x8a78('0x28')][_0x8a78('0x29')],function(_0x19c208){return{'name':_0x19c208['fieldName'],'type':_0x19c208[_0x8a78('0x2a')][_0x8a78('0x2b')]};});_0x14be2b['model']=_[_0x8a78('0x27')](_0x4872fd,_0x8a78('0x24'));_0x14be2b[_0x8a78('0x2c')]=_[_0x8a78('0x2d')](_0x494d78[_0x8a78('0x2c')]);_0x14be2b[_0x8a78('0x2e')]=_[_0x8a78('0x2f')](_0x14be2b[_0x8a78('0x30')],_0x14be2b[_0x8a78('0x2c')]);_0x14be2b[_0x8a78('0x2e')]=_[_0x8a78('0x31')](_0x14be2b['filters'],[_0x8a78('0x32'),_0x8a78('0x33'),'$gt',_0x8a78('0x34'),'$lt',_0x8a78('0x35'),_0x8a78('0x36'),_0x8a78('0x37'),'$not','$between',_0x8a78('0x38'),'$in',_0x8a78('0x39'),_0x8a78('0x3a'),_0x8a78('0x3b'),_0x8a78('0x3c'),_0x8a78('0x3d'),'$like',_0x8a78('0x3e'),_0x8a78('0x3f'),_0x8a78('0x40'),_0x8a78('0x41')]);_0x38b27d[_0x8a78('0x42')]=_['intersection'](_0x14be2b[_0x8a78('0x30')],qs[_0x8a78('0x43')](_0x494d78[_0x8a78('0x2c')]['fields']));_0x38b27d[_0x8a78('0x42')]=_0x38b27d[_0x8a78('0x42')][_0x8a78('0x44')]?_0x38b27d['attributes']:_0x14be2b['model'];if(!_0x494d78['query']['hasOwnProperty'](_0x8a78('0x45'))){_0x38b27d[_0x8a78('0x1b')]=qs[_0x8a78('0x1b')](_0x494d78[_0x8a78('0x2c')][_0x8a78('0x1b')]);_0x38b27d[_0x8a78('0x1a')]=qs[_0x8a78('0x1a')](_0x494d78['query'][_0x8a78('0x1a')]);}_0x38b27d[_0x8a78('0x46')]=qs['sort'](_0x494d78[_0x8a78('0x2c')][_0x8a78('0x47')]);_0x38b27d[_0x8a78('0x48')]=qs[_0x8a78('0x2e')](_[_0x8a78('0x49')](_0x494d78[_0x8a78('0x2c')],_0x14be2b[_0x8a78('0x2e')]),_0x4872fd);if(_0x494d78[_0x8a78('0x2c')][_0x8a78('0x4a')]){_0x38b27d[_0x8a78('0x48')]=_[_0x8a78('0x4b')](_0x38b27d[_0x8a78('0x48')],{'$or':_[_0x8a78('0x27')](_0x4872fd,function(_0xda9a6d){if(_0xda9a6d[_0x8a78('0x2a')]!==_0x8a78('0x4c')){var _0x217fb1={};_0x217fb1[_0xda9a6d[_0x8a78('0x24')]]={'$like':'%'+_0x494d78[_0x8a78('0x2c')][_0x8a78('0x4a')]+'%'};return _0x217fb1;}})});}_0x38b27d=_[_0x8a78('0x4b')]({},_0x38b27d,_0x494d78['options']);var _0x5b894c={'where':_0x38b27d[_0x8a78('0x48')]};return db[_0x8a78('0x28')][_0x8a78('0x19')](_0x5b894c)[_0x8a78('0x20')](function(_0x3f5993){_0x503b4e[_0x8a78('0x19')]=_0x3f5993;if(_0x494d78['query'][_0x8a78('0x4d')]){_0x38b27d[_0x8a78('0x4e')]=[{'all':!![]}];}return db[_0x8a78('0x28')][_0x8a78('0x4f')](_0x38b27d);})[_0x8a78('0x20')](function(_0x25f7bc){_0x503b4e[_0x8a78('0x50')]=_0x25f7bc;return _0x503b4e;})[_0x8a78('0x20')](respondWithFilteredResult(_0x33b157,_0x38b27d))[_0x8a78('0x51')](handleError(_0x33b157,null));};exports[_0x8a78('0x52')]=function(_0x40d922,_0x11d4e3){var _0xfa5882={'raw':!![],'where':{'id':_0x40d922[_0x8a78('0x53')]['id']}},_0x2f4974={};_0x2f4974[_0x8a78('0x30')]=_[_0x8a78('0x2d')](db[_0x8a78('0x28')][_0x8a78('0x29')]);_0x2f4974[_0x8a78('0x2c')]=_['keys'](_0x40d922[_0x8a78('0x2c')]);_0x2f4974[_0x8a78('0x2e')]=_[_0x8a78('0x2f')](_0x2f4974['model'],_0x2f4974[_0x8a78('0x2c')]);_0xfa5882[_0x8a78('0x42')]=_[_0x8a78('0x2f')](_0x2f4974[_0x8a78('0x30')],qs[_0x8a78('0x43')](_0x40d922[_0x8a78('0x2c')][_0x8a78('0x43')]));_0xfa5882['attributes']=_0xfa5882[_0x8a78('0x42')]['length']?_0xfa5882[_0x8a78('0x42')]:_0x2f4974['model'];if(_0x40d922['query']['includeAll']){_0xfa5882[_0x8a78('0x4e')]=[{'all':!![]}];}_0xfa5882=_[_0x8a78('0x4b')]({},_0xfa5882,_0x40d922[_0x8a78('0x54')]);return db[_0x8a78('0x28')][_0x8a78('0x55')](_0xfa5882)[_0x8a78('0x20')](handleEntityNotFound(_0x11d4e3,null))['then'](respondWithResult(_0x11d4e3,null))['catch'](handleError(_0x11d4e3,null));};exports[_0x8a78('0x56')]=function(_0x497a36,_0x5c9369){return db[_0x8a78('0x28')][_0x8a78('0x56')](_0x497a36[_0x8a78('0x57')],{})[_0x8a78('0x20')](respondWithResult(_0x5c9369,0xc9))[_0x8a78('0x51')](handleError(_0x5c9369,null));};exports[_0x8a78('0x58')]=function(_0x4890ad,_0x3c445c){if(_0x4890ad[_0x8a78('0x57')]['id']){delete _0x4890ad[_0x8a78('0x57')]['id'];}return db[_0x8a78('0x28')][_0x8a78('0x55')]({'where':{'id':_0x4890ad[_0x8a78('0x53')]['id']}})[_0x8a78('0x20')](handleEntityNotFound(_0x3c445c,null))[_0x8a78('0x20')](saveUpdates(_0x4890ad[_0x8a78('0x57')],null))['then'](respondWithResult(_0x3c445c,null))[_0x8a78('0x51')](handleError(_0x3c445c,null));};exports[_0x8a78('0x59')]=function(_0x137f86,_0x5b45ec){return db['CmHopper'][_0x8a78('0x59')]()['then'](respondWithResult(_0x5b45ec,null))[_0x8a78('0x51')](handleError(_0x5b45ec,null));};exports[_0x8a78('0x5a')]=function(_0x55abf7,_0x111029){var _0x188f6b;return db['CmHopper'][_0x8a78('0x55')]({'where':{'id':_0x55abf7[_0x8a78('0x53')]['id']}})[_0x8a78('0x20')](handleEntityNotFound(_0x111029,null))[_0x8a78('0x20')](function(_0x177a42){if(_0x177a42){return _0x177a42[_0x8a78('0x5a')]()[_0x8a78('0x20')](function(_0x254349){return _0x254349;});}})[_0x8a78('0x20')](function(_0x2e3aff){_0x188f6b=_0x2e3aff;if(_0x2e3aff){if(_0x2e3aff[_0x8a78('0x5b')]||_0x2e3aff[_0x8a78('0x5c')]){return db[_0x2e3aff[_0x8a78('0x5b')]?'VoiceQueue':_0x8a78('0x5d')][_0x8a78('0x55')]({'where':{'id':_0x2e3aff[_0x8a78('0x5b')]?_0x2e3aff[_0x8a78('0x5b')]:_0x2e3aff[_0x8a78('0x5c')]},'attributes':['id',_0x8a78('0x24')],'raw':!![]});}}})[_0x8a78('0x20')](function(_0x30f749){var _0x444c34={};if(_0x30f749){_[_0x8a78('0x4b')](_0x444c34,_[_0x8a78('0x5e')](_0x188f6b[_0x8a78('0x5f')],[_0x8a78('0x60'),_0x8a78('0x61'),'id']));_0x444c34[_0x8a78('0x62')]=0x15;_0x444c34[_0x8a78('0x63')]='deleted';_0x444c34[_0x8a78('0x64')]=_0x30f749[_0x8a78('0x24')];_0x444c34['membername']=_0x55abf7[_0x8a78('0x65')][_0x8a78('0x24')];_0x444c34[_0x8a78('0x66')]=_0x55abf7['user']['id'];_0x444c34[_0x8a78('0x67')]=!![];_0x444c34[_0x8a78('0x68')]=moment()[_0x8a78('0x69')](_0x8a78('0x6a'));_0x444c34['calleridnum']=_0x188f6b[_0x8a78('0x6b')];_0x444c34[_0x8a78('0x6c')]=_0x188f6b[_0x8a78('0x5b')]?_0x8a78('0x6d'):_0x8a78('0x6e');return db[_0x8a78('0x6f')][_0x8a78('0x55')]({'where':{'id':_0x444c34[_0x8a78('0x70')]},'attributes':['firstName',_0x8a78('0x71')]})[_0x8a78('0x20')](function(_0x524785){if(!_['isNil'](_0x111029)&&!_[_0x8a78('0x72')](_0x524785[_0x8a78('0x73')])){_0x444c34[_0x8a78('0x74')]=_0x524785[_0x8a78('0x73')];if(!_[_0x8a78('0x72')](_0x524785[_0x8a78('0x71')])){_0x444c34[_0x8a78('0x74')]+='\x20'+_0x524785[_0x8a78('0x71')];}}})[_0x8a78('0x75')](function(){return db['CmHopperFinal']['create'](_0x444c34);});}})['then'](function(){return _0x111029[_0x8a78('0x16')](0xcc)[_0x8a78('0x17')]();})['catch'](handleError(_0x111029,null));};exports[_0x8a78('0x76')]=function(_0x1488ce,_0xdca73,_0x204c3e){var _0x4f0d22=[];return db[_0x8a78('0x6f')]['describe']()[_0x8a78('0x20')](function(_0x3e8c6f){_0x4f0d22=_[_0x8a78('0x2d')](_0x3e8c6f);return _0x1488ce['user'][_0x8a78('0x77')]({'where':{'type':_0x8a78('0x78'),'dialActive':!![],'dialMethod':_0x8a78('0x79')},'attributes':['id',_0x8a78('0x7a')],'raw':!![]});})[_0x8a78('0x20')](function(_0x2e3627){if(_0x2e3627&&_0x2e3627[_0x8a78('0x44')]){return db[_0x8a78('0x7b')]['transaction'](function(_0x334f9c){var _0x126ef2={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x8a78('0x6a'))},'VoiceQueueId':{'$in':_[_0x8a78('0x27')](_0x2e3627,'id')},'$or':[{'UserId':null},{'UserId':_0x1488ce[_0x8a78('0x65')]['id']}]};var _0x4850ac=[];if(_0x1488ce[_0x8a78('0x57')]['direction']&&_0x1488ce[_0x8a78('0x57')][_0x8a78('0x7c')]==='prev'){if(!_['isEmpty'](_0x1488ce['body'][_0x8a78('0x7d')])){_0x126ef2['id']={'$in':_0x1488ce['body']['hopperIds']};}_0x4850ac=[['priority',_0x8a78('0x7e')],[_0x8a78('0x7f'),_0x2e3627[0x0][_0x8a78('0x7a')]===_0x8a78('0x7e')?_0x8a78('0x80'):_0x8a78('0x7e')],db[_0x8a78('0x7b')][_0x8a78('0x81')](_0x8a78('0x82')),['id',_0x8a78('0x80')]];}else{if(!_['isEmpty'](_0x1488ce[_0x8a78('0x57')][_0x8a78('0x7d')])){_0x126ef2['id']={'$notIn':_0x1488ce[_0x8a78('0x57')][_0x8a78('0x7d')]};}_0x4850ac=[[_0x8a78('0x83'),_0x8a78('0x80')],[_0x8a78('0x7f'),_0x2e3627[0x0][_0x8a78('0x7a')]],db[_0x8a78('0x7b')][_0x8a78('0x81')](_0x8a78('0x84')),['id',_0x8a78('0x7e')]];}return db[_0x8a78('0x28')][_0x8a78('0x85')]({'attributes':['id',_0x8a78('0x86')],'where':_0x126ef2,'order':_0x4850ac,'transaction':_0x334f9c,'lock':_0x334f9c['LOCK']['UPDATE'],'include':[{'model':db[_0x8a78('0x6f')],'as':'Contact','attributes':_0x4f0d22,'include':[{'model':db[_0x8a78('0x87')],'as':_0x8a78('0x88'),'attributes':['id',_0x8a78('0x24')]}]},{'model':db[_0x8a78('0x89')],'as':_0x8a78('0x8a'),'attributes':['id',_0x8a78('0x24')]},{'model':db[_0x8a78('0x8b')],'as':_0x8a78('0x8c'),'attributes':['id',_0x8a78('0x24'),'dialActive']}]})[_0x8a78('0x20')](function(_0x40fe95){if(_0x40fe95){return _0x40fe95[_0x8a78('0x58')]({'UserId':_0x1488ce[_0x8a78('0x65')]['id']},{'transaction':_0x334f9c});}});});}})['then'](handleEntityNotFound(_0xdca73,null))[_0x8a78('0x20')](respondWithResult(_0xdca73,null))[_0x8a78('0x51')](handleError(_0xdca73,null));};exports[_0x8a78('0x8d')]=function(_0xa711a9,_0x94899e,_0x1f85fb){return _0xa711a9[_0x8a78('0x65')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x8a78('0x20')](function(_0x5f5496){if(_0x5f5496&&_0x5f5496[_0x8a78('0x44')]){return db[_0x8a78('0x28')][_0x8a78('0x19')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x8a78('0x6a'))},'VoiceQueueId':{'$in':_['map'](_0x5f5496,'id')},'$or':[{'UserId':null},{'UserId':_0xa711a9[_0x8a78('0x65')]['id']}]}});}return 0x0;})['then'](function(_0x2f07ba){if(!_[_0x8a78('0x72')](_0x2f07ba)&&_[_0x8a78('0x8e')](_0x2f07ba)){return _0x94899e[_0x8a78('0x16')](0xc8)[_0x8a78('0x18')]({'contacts':_0x2f07ba});}else{logger['error'](_0x8a78('0x8f'),_0x8a78('0x8d'),0x194,_0x8a78('0x90'));_0x94899e[_0x8a78('0x21')](0x194);}})['catch'](handleError(_0x94899e,null));}; \ No newline at end of file +var _0xcabe=['includeAll','find','catch','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','getPreview','getVoiceQueues','dialOrderByScheduledAt','transaction','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','dialActive','getOpenContacts','preview','isNumber','entity\x20not\x20found','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','destroy','then','error','name','send','map','CmHopper','fieldName','type','key','model','query','filters','intersection','concat','$and','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$contained','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','rows','show','params','rawAttributes','keys'];(function(_0x4c5869,_0x6887b){var _0x27d5b0=function(_0x213633){while(--_0x213633){_0x4c5869['push'](_0x4c5869['shift']());}};_0x27d5b0(++_0x6887b);}(_0xcabe,0x1ef));var _0xecab=function(_0x585226,_0xc412cb){_0x585226=_0x585226-0x0;var _0x2ec134=_0xcabe[_0x585226];return _0x2ec134;};'use strict';var pdf=require(_0xecab('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xecab('0x1'));var zipdir=require(_0xecab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xecab('0x3'));var moment=require(_0xecab('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xecab('0x5'));var util=require(_0xecab('0x6'));var path=require(_0xecab('0x7'));var sox=require('sox');var csv=require(_0xecab('0x8'));var ejs=require(_0xecab('0x9'));var fs=require('fs');var _=require(_0xecab('0xa'));var squel=require(_0xecab('0xb'));var crypto=require(_0xecab('0xc'));var jsforce=require(_0xecab('0xd'));var deskjs=require(_0xecab('0xe'));var toCsv=require(_0xecab('0x8'));var querystring=require(_0xecab('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xecab('0x10'));var qs=require(_0xecab('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xecab('0x12'));var logger=require(_0xecab('0x13'))(_0xecab('0x14'));var utils=require(_0xecab('0x15'));var config=require(_0xecab('0x16'));var licenseUtil=require(_0xecab('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d161e,_0x24cf0c){_0x24cf0c=_0x24cf0c||0xcc;return function(_0x1d04c1){if(_0x1d04c1){return _0x3d161e[_0xecab('0x18')](_0x24cf0c);}return _0x3d161e[_0xecab('0x19')](_0x24cf0c)[_0xecab('0x1a')]();};}function respondWithResult(_0x56a6db,_0x1a9aab){_0x1a9aab=_0x1a9aab||0xc8;return function(_0x56a614){if(_0x56a614){return _0x56a6db['status'](_0x1a9aab)[_0xecab('0x1b')](_0x56a614);}};}function respondWithFilteredResult(_0x3af1a6,_0x356c4e){return function(_0x1c019f){if(_0x1c019f){var _0x5bdb81=_0x1c019f[_0xecab('0x1c')],_0x35feb8=_0x356c4e[_0xecab('0x1d')],_0x1c5871=_0x356c4e['offset']+_0x356c4e[_0xecab('0x1e')],_0x260a09;if(_0x1c5871>=_0x5bdb81){_0x1c5871=_0x5bdb81;_0x260a09=0xc8;}else{_0x260a09=0xce;}_0x3af1a6[_0xecab('0x19')](_0x260a09);return _0x3af1a6['set'](_0xecab('0x1f'),_0x35feb8+'-'+_0x1c5871+'/'+_0x5bdb81)[_0xecab('0x1b')](_0x1c019f);}return null;};}function patchUpdates(_0x157606){return function(_0xa22814){try{jsonpatch[_0xecab('0x20')](_0xa22814,_0x157606,!![]);}catch(_0xbafd2){return BPromise['reject'](_0xbafd2);}return _0xa22814[_0xecab('0x21')]();};}function saveUpdates(_0x2ec6fb,_0x1fdd1d){return function(_0x50eb82){if(_0x50eb82){return _0x50eb82[_0xecab('0x22')](_0x2ec6fb)['then'](function(_0x187620){return _0x187620;});}return null;};}function removeEntity(_0x5e31aa,_0x184dbc){return function(_0x94d9c2){if(_0x94d9c2){return _0x94d9c2[_0xecab('0x23')]()[_0xecab('0x24')](function(){_0x5e31aa[_0xecab('0x19')](0xcc)[_0xecab('0x1a')]();});}};}function handleEntityNotFound(_0x44ba86,_0x2991a3){return function(_0x3c701e){if(!_0x3c701e){_0x44ba86[_0xecab('0x18')](0x194);}return _0x3c701e;};}function handleError(_0x30191f,_0x270946){_0x270946=_0x270946||0x1f4;return function(_0x492a09){logger[_0xecab('0x25')](_0x492a09['stack']);if(_0x492a09[_0xecab('0x26')]){delete _0x492a09[_0xecab('0x26')];}_0x30191f['status'](_0x270946)[_0xecab('0x27')](_0x492a09);};}exports['index']=function(_0x56c98e,_0x2d6a57){var _0xe97566={},_0x974659={},_0x3f1666={'count':0x0,'rows':[]};var _0x34ded8=_[_0xecab('0x28')](db[_0xecab('0x29')]['rawAttributes'],function(_0x59b07b){return{'name':_0x59b07b[_0xecab('0x2a')],'type':_0x59b07b[_0xecab('0x2b')][_0xecab('0x2c')]};});_0x974659[_0xecab('0x2d')]=_[_0xecab('0x28')](_0x34ded8,_0xecab('0x26'));_0x974659['query']=_['keys'](_0x56c98e[_0xecab('0x2e')]);_0x974659[_0xecab('0x2f')]=_[_0xecab('0x30')](_0x974659[_0xecab('0x2d')],_0x974659[_0xecab('0x2e')]);_0x974659[_0xecab('0x2f')]=_[_0xecab('0x31')](_0x974659[_0xecab('0x2f')],[_0xecab('0x32'),'$or','$gt','$gte','$lt','$lte',_0xecab('0x33'),_0xecab('0x34'),_0xecab('0x35'),_0xecab('0x36'),_0xecab('0x37'),_0xecab('0x38'),_0xecab('0x39'),_0xecab('0x3a'),_0xecab('0x3b'),_0xecab('0x3c'),'$notILike',_0xecab('0x3a'),'$overlap','$contains',_0xecab('0x3d'),'$any']);_0xe97566[_0xecab('0x3e')]=_[_0xecab('0x30')](_0x974659['model'],qs[_0xecab('0x3f')](_0x56c98e[_0xecab('0x2e')][_0xecab('0x3f')]));_0xe97566[_0xecab('0x3e')]=_0xe97566['attributes'][_0xecab('0x40')]?_0xe97566[_0xecab('0x3e')]:_0x974659[_0xecab('0x2d')];if(!_0x56c98e['query'][_0xecab('0x41')](_0xecab('0x42'))){_0xe97566['limit']=qs[_0xecab('0x1e')](_0x56c98e[_0xecab('0x2e')][_0xecab('0x1e')]);_0xe97566['offset']=qs['offset'](_0x56c98e['query'][_0xecab('0x1d')]);}_0xe97566[_0xecab('0x43')]=qs[_0xecab('0x44')](_0x56c98e[_0xecab('0x2e')][_0xecab('0x44')]);_0xe97566[_0xecab('0x45')]=qs[_0xecab('0x2f')](_[_0xecab('0x46')](_0x56c98e['query'],_0x974659[_0xecab('0x2f')]),_0x34ded8);if(_0x56c98e['query']['filter']){_0xe97566['where']=_['merge'](_0xe97566[_0xecab('0x45')],{'$or':_[_0xecab('0x28')](_0x34ded8,function(_0x5e32bf){if(_0x5e32bf[_0xecab('0x2b')]!==_0xecab('0x47')){var _0x46eb8d={};_0x46eb8d[_0x5e32bf[_0xecab('0x26')]]={'$like':'%'+_0x56c98e[_0xecab('0x2e')][_0xecab('0x48')]+'%'};return _0x46eb8d;}})});}_0xe97566=_[_0xecab('0x49')]({},_0xe97566,_0x56c98e[_0xecab('0x4a')]);var _0x54cfcf={'where':_0xe97566[_0xecab('0x45')]};return db[_0xecab('0x29')][_0xecab('0x1c')](_0x54cfcf)[_0xecab('0x24')](function(_0x3df1dd){_0x3f1666[_0xecab('0x1c')]=_0x3df1dd;if(_0x56c98e['query']['includeAll']){_0xe97566[_0xecab('0x4b')]=[{'all':!![]}];}return db[_0xecab('0x29')]['findAll'](_0xe97566);})['then'](function(_0x3f1f99){_0x3f1666[_0xecab('0x4c')]=_0x3f1f99;return _0x3f1666;})[_0xecab('0x24')](respondWithFilteredResult(_0x2d6a57,_0xe97566))['catch'](handleError(_0x2d6a57,null));};exports[_0xecab('0x4d')]=function(_0x769b7e,_0x3989ca){var _0x514179={'raw':!![],'where':{'id':_0x769b7e[_0xecab('0x4e')]['id']}},_0x42dddb={};_0x42dddb[_0xecab('0x2d')]=_['keys'](db[_0xecab('0x29')][_0xecab('0x4f')]);_0x42dddb[_0xecab('0x2e')]=_[_0xecab('0x50')](_0x769b7e[_0xecab('0x2e')]);_0x42dddb[_0xecab('0x2f')]=_[_0xecab('0x30')](_0x42dddb[_0xecab('0x2d')],_0x42dddb['query']);_0x514179[_0xecab('0x3e')]=_[_0xecab('0x30')](_0x42dddb[_0xecab('0x2d')],qs[_0xecab('0x3f')](_0x769b7e['query']['fields']));_0x514179['attributes']=_0x514179[_0xecab('0x3e')][_0xecab('0x40')]?_0x514179[_0xecab('0x3e')]:_0x42dddb[_0xecab('0x2d')];if(_0x769b7e[_0xecab('0x2e')][_0xecab('0x51')]){_0x514179['include']=[{'all':!![]}];}_0x514179=_[_0xecab('0x49')]({},_0x514179,_0x769b7e[_0xecab('0x4a')]);return db[_0xecab('0x29')][_0xecab('0x52')](_0x514179)[_0xecab('0x24')](handleEntityNotFound(_0x3989ca,null))[_0xecab('0x24')](respondWithResult(_0x3989ca,null))[_0xecab('0x53')](handleError(_0x3989ca,null));};exports[_0xecab('0x54')]=function(_0x538059,_0x425a4e){return db[_0xecab('0x29')][_0xecab('0x54')](_0x538059[_0xecab('0x55')],{})['then'](respondWithResult(_0x425a4e,0xc9))[_0xecab('0x53')](handleError(_0x425a4e,null));};exports[_0xecab('0x22')]=function(_0x439b9a,_0x3d048e){if(_0x439b9a['body']['id']){delete _0x439b9a[_0xecab('0x55')]['id'];}return db[_0xecab('0x29')][_0xecab('0x52')]({'where':{'id':_0x439b9a[_0xecab('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3d048e,null))[_0xecab('0x24')](saveUpdates(_0x439b9a[_0xecab('0x55')],null))[_0xecab('0x24')](respondWithResult(_0x3d048e,null))['catch'](handleError(_0x3d048e,null));};exports['describe']=function(_0x27b81f,_0x5e7d6f){return db['CmHopper'][_0xecab('0x56')]()[_0xecab('0x24')](respondWithResult(_0x5e7d6f,null))[_0xecab('0x53')](handleError(_0x5e7d6f,null));};exports[_0xecab('0x23')]=function(_0x3dce74,_0x2799a0){var _0x3aaee9;return db['CmHopper'][_0xecab('0x52')]({'where':{'id':_0x3dce74[_0xecab('0x4e')]['id']}})[_0xecab('0x24')](handleEntityNotFound(_0x2799a0,null))['then'](function(_0x8f4d7c){if(_0x8f4d7c){return _0x8f4d7c[_0xecab('0x23')]()[_0xecab('0x24')](function(_0x28d250){return _0x28d250;});}})[_0xecab('0x24')](function(_0x37d027){_0x3aaee9=_0x37d027;if(_0x37d027){if(_0x37d027[_0xecab('0x57')]||_0x37d027[_0xecab('0x58')]){return db[_0x37d027[_0xecab('0x57')]?_0xecab('0x59'):'Campaign'][_0xecab('0x52')]({'where':{'id':_0x37d027[_0xecab('0x57')]?_0x37d027[_0xecab('0x57')]:_0x37d027['CampaignId']},'attributes':['id',_0xecab('0x26')],'raw':!![]});}}})[_0xecab('0x24')](function(_0x3a9b7f){var _0x331552={};if(_0x3a9b7f){_[_0xecab('0x49')](_0x331552,_[_0xecab('0x5a')](_0x3aaee9[_0xecab('0x5b')],[_0xecab('0x5c'),_0xecab('0x5d'),'id']));_0x331552[_0xecab('0x5e')]=0x15;_0x331552[_0xecab('0x5f')]=_0xecab('0x60');_0x331552['campaign']=_0x3a9b7f[_0xecab('0x26')];_0x331552[_0xecab('0x61')]=_0x3dce74[_0xecab('0x62')]['name'];_0x331552[_0xecab('0x63')]=_0x3dce74['user']['id'];_0x331552[_0xecab('0x60')]=!![];_0x331552[_0xecab('0x64')]=moment()[_0xecab('0x65')](_0xecab('0x66'));_0x331552[_0xecab('0x67')]=_0x3aaee9[_0xecab('0x68')];_0x331552[_0xecab('0x69')]=_0x3aaee9[_0xecab('0x57')]?_0xecab('0x6a'):_0xecab('0x6b');return db[_0xecab('0x6c')][_0xecab('0x52')]({'where':{'id':_0x331552[_0xecab('0x6d')]},'attributes':[_0xecab('0x6e'),_0xecab('0x6f')]})[_0xecab('0x24')](function(_0x2ed907){if(!_[_0xecab('0x70')](_0x2799a0)&&!_[_0xecab('0x70')](_0x2ed907['firstName'])){_0x331552['calleridname']=_0x2ed907[_0xecab('0x6e')];if(!_[_0xecab('0x70')](_0x2ed907[_0xecab('0x6f')])){_0x331552[_0xecab('0x71')]+='\x20'+_0x2ed907['lastName'];}}})['finally'](function(){return db[_0xecab('0x72')][_0xecab('0x54')](_0x331552);});}})[_0xecab('0x24')](function(){return _0x2799a0['status'](0xcc)['end']();})[_0xecab('0x53')](handleError(_0x2799a0,null));};exports[_0xecab('0x73')]=function(_0x43ff98,_0x486c31,_0x168450){var _0x76923c=[];return db[_0xecab('0x6c')][_0xecab('0x56')]()[_0xecab('0x24')](function(_0x584379){_0x76923c=_[_0xecab('0x50')](_0x584379);return _0x43ff98[_0xecab('0x62')][_0xecab('0x74')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xecab('0x75')],'raw':!![]});})['then'](function(_0x33cabe){if(_0x33cabe&&_0x33cabe[_0xecab('0x40')]){return db['sequelize'][_0xecab('0x76')](function(_0x220ebf){var _0x47c115={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xecab('0x65')](_0xecab('0x66'))},'VoiceQueueId':{'$in':_[_0xecab('0x28')](_0x33cabe,'id')},'$or':[{'UserId':null},{'UserId':_0x43ff98[_0xecab('0x62')]['id']}]};var _0x48e791=[];if(_0x43ff98[_0xecab('0x55')][_0xecab('0x77')]&&_0x43ff98[_0xecab('0x55')]['direction']===_0xecab('0x78')){if(!_[_0xecab('0x79')](_0x43ff98[_0xecab('0x55')][_0xecab('0x7a')])){_0x47c115['id']={'$in':_0x43ff98[_0xecab('0x55')][_0xecab('0x7a')]};}_0x48e791=[[_0xecab('0x7b'),_0xecab('0x7c')],[_0xecab('0x7d'),_0x33cabe[0x0][_0xecab('0x75')]===_0xecab('0x7c')?_0xecab('0x7e'):_0xecab('0x7c')],db[_0xecab('0x7f')][_0xecab('0x80')](_0xecab('0x81')),['id',_0xecab('0x7e')]];}else{if(!_[_0xecab('0x79')](_0x43ff98[_0xecab('0x55')][_0xecab('0x7a')])){_0x47c115['id']={'$notIn':_0x43ff98[_0xecab('0x55')][_0xecab('0x7a')]};}_0x48e791=[['priority',_0xecab('0x7e')],[_0xecab('0x7d'),_0x33cabe[0x0][_0xecab('0x75')]],db['sequelize'][_0xecab('0x80')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xecab('0x7c')]];}return db['CmHopper'][_0xecab('0x82')]({'attributes':['id',_0xecab('0x83')],'where':_0x47c115,'order':_0x48e791,'transaction':_0x220ebf,'lock':_0x220ebf[_0xecab('0x84')][_0xecab('0x85')],'include':[{'model':db[_0xecab('0x6c')],'as':_0xecab('0x86'),'attributes':_0x76923c,'include':[{'model':db[_0xecab('0x87')],'as':_0xecab('0x88'),'attributes':['id',_0xecab('0x26')]}]},{'model':db[_0xecab('0x89')],'as':_0xecab('0x8a'),'attributes':['id',_0xecab('0x26')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0xecab('0x26'),_0xecab('0x8b')]}]})[_0xecab('0x24')](function(_0xd95f26){if(_0xd95f26){return _0xd95f26[_0xecab('0x22')]({'UserId':_0x43ff98[_0xecab('0x62')]['id']},{'transaction':_0x220ebf});}});});}})[_0xecab('0x24')](handleEntityNotFound(_0x486c31,null))[_0xecab('0x24')](respondWithResult(_0x486c31,null))['catch'](handleError(_0x486c31,null));};exports[_0xecab('0x8c')]=function(_0x1b8e6f,_0x29d0c5,_0x207edd){return _0x1b8e6f[_0xecab('0x62')][_0xecab('0x74')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xecab('0x8d')},'attributes':['id'],'raw':!![]})['then'](function(_0x3cd938){if(_0x3cd938&&_0x3cd938[_0xecab('0x40')]){return db[_0xecab('0x29')][_0xecab('0x1c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xecab('0x65')](_0xecab('0x66'))},'VoiceQueueId':{'$in':_['map'](_0x3cd938,'id')},'$or':[{'UserId':null},{'UserId':_0x1b8e6f['user']['id']}]}});}return 0x0;})[_0xecab('0x24')](function(_0x22eddd){if(!_[_0xecab('0x70')](_0x22eddd)&&_[_0xecab('0x8e')](_0x22eddd)){return _0x29d0c5[_0xecab('0x19')](0xc8)[_0xecab('0x1b')]({'contacts':_0x22eddd});}else{logger[_0xecab('0x25')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xecab('0x8c'),0x194,_0xecab('0x8f'));_0x29d0c5[_0xecab('0x18')](0x194);}})[_0xecab('0x53')](handleError(_0x29d0c5,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 8091d2e..701e0f5 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 _0x5d99=['exports','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes'];(function(_0x4443e7,_0x3504b0){var _0xaeead2=function(_0x192e14){while(--_0x192e14){_0x4443e7['push'](_0x4443e7['shift']());}};_0xaeead2(++_0x3504b0);}(_0x5d99,0x1f4));var _0x95d9=function(_0x868b7c,_0xfa438b){_0x868b7c=_0x868b7c-0x0;var _0x21683c=_0x5d99[_0x868b7c];return _0x21683c;};'use strict';var _=require(_0x95d9('0x0'));var util=require(_0x95d9('0x1'));var logger=require(_0x95d9('0x2'))(_0x95d9('0x3'));var moment=require(_0x95d9('0x4'));var BPromise=require('bluebird');var rp=require(_0x95d9('0x5'));var fs=require('fs');var path=require(_0x95d9('0x6'));var rimraf=require(_0x95d9('0x7'));var config=require(_0x95d9('0x8'));var attributes=require(_0x95d9('0x9'));module[_0x95d9('0xa')]=function(_0x3c489b,_0x5eb321){return _0x3c489b['define'](_0x95d9('0xb'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x95d9('0xc'),'fields':[_0x95d9('0xc')]},{'name':_0x95d9('0xd'),'fields':[_0x95d9('0xd')]},{'name':_0x95d9('0xe'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xde61=['path','rimraf','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x417f40,_0x545b25){var _0x959e44=function(_0x3d714c){while(--_0x3d714c){_0x417f40['push'](_0x417f40['shift']());}};_0x959e44(++_0x545b25);}(_0xde61,0x119));var _0x1de6=function(_0x319f71,_0x459f06){_0x319f71=_0x319f71-0x0;var _0x8a05a9=_0xde61[_0x319f71];return _0x8a05a9;};'use strict';var _=require(_0x1de6('0x0'));var util=require(_0x1de6('0x1'));var logger=require(_0x1de6('0x2'))(_0x1de6('0x3'));var moment=require(_0x1de6('0x4'));var BPromise=require(_0x1de6('0x5'));var rp=require(_0x1de6('0x6'));var fs=require('fs');var path=require(_0x1de6('0x7'));var rimraf=require(_0x1de6('0x8'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module[_0x1de6('0x9')]=function(_0x146a0e,_0x2488ca){return _0x146a0e[_0x1de6('0xa')](_0x1de6('0xb'),attributes,{'tableName':_0x1de6('0xc'),'paranoid':![],'indexes':[{'name':_0x1de6('0xd'),'fields':['scheduledat']},{'name':_0x1de6('0xe'),'fields':[_0x1de6('0xe')]},{'name':_0x1de6('0xf'),'fields':[_0x1de6('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index d23511e..74eb459 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 _0x5cbb=['error','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','map','include','model','ShowCmHopper','find','CreateCmHopper','body','limit','UpdateCmHopper','DestroyCmHopper','CmContact','describe','sequelize','order','LOCK','UPDATE','Contact','keys','Agent','voicePause','length','includes','UserId','push','update','all','GetContactDialer','CmHopperFinal','create','destroy','MoveContactManagedDialer','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','transaction','GetCmHopperPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','CmHopper,\x20%s,\x20%s','debug','CmHopper,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code'];(function(_0x3bb884,_0x111976){var _0x414715=function(_0x1cb354){while(--_0x1cb354){_0x3bb884['push'](_0x3bb884['shift']());}};_0x414715(++_0x111976);}(_0x5cbb,0xc4));var _0xb5cb=function(_0x3f8e2f,_0x149266){_0x3f8e2f=_0x3f8e2f-0x0;var _0x44c46a=_0x5cbb[_0x3f8e2f];return _0x44c46a;};'use strict';var _=require(_0xb5cb('0x0'));var util=require(_0xb5cb('0x1'));var moment=require(_0xb5cb('0x2'));var BPromise=require(_0xb5cb('0x3'));var rs=require(_0xb5cb('0x4'));var fs=require('fs');var Redis=require(_0xb5cb('0x5'));var db=require(_0xb5cb('0x6'))['db'];var utils=require(_0xb5cb('0x7'));var logger=require('../../config/logger')(_0xb5cb('0x8'));var config=require(_0xb5cb('0x9'));var jayson=require(_0xb5cb('0xa'));var client=jayson[_0xb5cb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x418848,_0x43e327,_0x59a570){return new BPromise(function(_0x39924a,_0x38d711){return client['request'](_0x418848,_0x59a570)[_0xb5cb('0xc')](function(_0x5778e7){logger[_0xb5cb('0xd')](_0xb5cb('0xe'),_0x43e327,'request\x20sent');logger[_0xb5cb('0xf')](_0xb5cb('0x10'),_0x43e327,_0xb5cb('0x11'),JSON[_0xb5cb('0x12')](_0x5778e7));if(_0x5778e7['error']){if(_0x5778e7['error'][_0xb5cb('0x13')]===0x1f4){logger[_0xb5cb('0x14')](_0xb5cb('0xe'),_0x43e327,_0x5778e7['error'][_0xb5cb('0x15')]);return _0x38d711(_0x5778e7[_0xb5cb('0x14')][_0xb5cb('0x15')]);}logger[_0xb5cb('0x14')]('CmHopper,\x20%s,\x20%s',_0x43e327,_0x5778e7[_0xb5cb('0x14')][_0xb5cb('0x15')]);return _0x39924a(_0x5778e7[_0xb5cb('0x14')]['message']);}else{logger['info'](_0xb5cb('0xe'),_0x43e327,_0xb5cb('0x11'));_0x39924a(_0x5778e7[_0xb5cb('0x16')][_0xb5cb('0x15')]);}})[_0xb5cb('0x17')](function(_0x21ec58){logger[_0xb5cb('0x14')]('CmHopper,\x20%s,\x20%s',_0x43e327,_0x21ec58);_0x38d711(_0x21ec58);});});}exports[_0xb5cb('0x18')]=function(_0x56f056){var _0x5356ac=this;return new Promise(function(_0x506dd7,_0x17c7ac){return db[_0xb5cb('0x19')][_0xb5cb('0x1a')]({'raw':_0x56f056[_0xb5cb('0x1b')]?_0x56f056[_0xb5cb('0x1b')][_0xb5cb('0x1c')]===undefined?!![]:![]:!![],'where':_0x56f056[_0xb5cb('0x1b')]?_0x56f056['options'][_0xb5cb('0x1d')]||null:null,'attributes':_0x56f056[_0xb5cb('0x1b')]?_0x56f056[_0xb5cb('0x1b')][_0xb5cb('0x1e')]||null:null,'limit':_0x56f056[_0xb5cb('0x1b')]?_0x56f056['options']['limit']||null:null,'include':_0x56f056[_0xb5cb('0x1b')]?_0x56f056[_0xb5cb('0x1b')]['include']?_[_0xb5cb('0x1f')](_0x56f056['options'][_0xb5cb('0x20')],function(_0x41a92c){return{'model':db[_0x41a92c[_0xb5cb('0x21')]],'as':_0x41a92c['as'],'attributes':_0x41a92c['attributes'],'include':_0x41a92c[_0xb5cb('0x20')]?_[_0xb5cb('0x1f')](_0x41a92c[_0xb5cb('0x20')],function(_0x1b1c9c){return{'model':db[_0x1b1c9c[_0xb5cb('0x21')]],'as':_0x1b1c9c['as'],'attributes':_0x1b1c9c[_0xb5cb('0x1e')],'include':_0x1b1c9c[_0xb5cb('0x20')]?_['map'](_0x1b1c9c[_0xb5cb('0x20')],function(_0x467b06){return{'model':db[_0x467b06[_0xb5cb('0x21')]],'as':_0x467b06['as'],'attributes':_0x467b06[_0xb5cb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb5cb('0xc')](function(_0x19700e){logger[_0xb5cb('0xd')](_0xb5cb('0x18'),_0x56f056);logger[_0xb5cb('0xf')](_0xb5cb('0x18'),_0x56f056,JSON[_0xb5cb('0x12')](_0x19700e));_0x506dd7(_0x19700e);})[_0xb5cb('0x17')](function(_0x484600){logger[_0xb5cb('0x14')](_0xb5cb('0x18'),_0x484600[_0xb5cb('0x15')],_0x56f056);_0x17c7ac(_0x5356ac[_0xb5cb('0x14')](0x1f4,_0x484600[_0xb5cb('0x15')]));});});};exports[_0xb5cb('0x22')]=function(_0xd19db5){var _0x49f206=this;return new Promise(function(_0x4b1834,_0x128885){return db['CmHopper'][_0xb5cb('0x23')]({'raw':_0xd19db5[_0xb5cb('0x1b')]?_0xd19db5[_0xb5cb('0x1b')][_0xb5cb('0x1c')]===undefined?!![]:![]:!![],'where':_0xd19db5[_0xb5cb('0x1b')]?_0xd19db5[_0xb5cb('0x1b')][_0xb5cb('0x1d')]||null:null,'attributes':_0xd19db5['options']?_0xd19db5[_0xb5cb('0x1b')][_0xb5cb('0x1e')]||null:null,'include':_0xd19db5[_0xb5cb('0x1b')]?_0xd19db5['options'][_0xb5cb('0x20')]?_['map'](_0xd19db5['options'][_0xb5cb('0x20')],function(_0x1950c3){return{'model':db[_0x1950c3[_0xb5cb('0x21')]],'as':_0x1950c3['as'],'attributes':_0x1950c3[_0xb5cb('0x1e')],'include':_0x1950c3[_0xb5cb('0x20')]?_[_0xb5cb('0x1f')](_0x1950c3[_0xb5cb('0x20')],function(_0xc416e0){return{'model':db[_0xc416e0[_0xb5cb('0x21')]],'as':_0xc416e0['as'],'attributes':_0xc416e0[_0xb5cb('0x1e')],'include':_0xc416e0[_0xb5cb('0x20')]?_[_0xb5cb('0x1f')](_0xc416e0[_0xb5cb('0x20')],function(_0x18a3bc){return{'model':db[_0x18a3bc[_0xb5cb('0x21')]],'as':_0x18a3bc['as'],'attributes':_0x18a3bc[_0xb5cb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb5cb('0xc')](function(_0x35c7ed){logger[_0xb5cb('0xd')]('ShowCmHopper',_0xd19db5);logger[_0xb5cb('0xf')](_0xb5cb('0x22'),_0xd19db5,JSON[_0xb5cb('0x12')](_0x35c7ed));_0x4b1834(_0x35c7ed);})[_0xb5cb('0x17')](function(_0x3700a2){logger[_0xb5cb('0x14')](_0xb5cb('0x22'),_0x3700a2[_0xb5cb('0x15')],_0xd19db5);_0x128885(_0x49f206[_0xb5cb('0x14')](0x1f4,_0x3700a2['message']));});});};exports[_0xb5cb('0x24')]=function(_0x37fcc4){var _0x1d2e6e=this;return new Promise(function(_0x19f408,_0x1a8cc8){return db[_0xb5cb('0x19')]['create'](_0x37fcc4['body'],{'raw':_0x37fcc4[_0xb5cb('0x1b')]?_0x37fcc4[_0xb5cb('0x1b')][_0xb5cb('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x560440){logger['info'](_0xb5cb('0x24'),_0x37fcc4);logger[_0xb5cb('0xf')](_0xb5cb('0x24'),_0x37fcc4,JSON[_0xb5cb('0x12')](_0x560440));_0x19f408(_0x560440);})['catch'](function(_0x28b1ff){logger[_0xb5cb('0x14')](_0xb5cb('0x24'),_0x28b1ff[_0xb5cb('0x15')],_0x37fcc4);_0x1a8cc8(_0x1d2e6e[_0xb5cb('0x14')](0x1f4,_0x28b1ff[_0xb5cb('0x15')]));});});};exports['UpdateCmHopper']=function(_0x503b0a){var _0x5b3bd6=this;return new Promise(function(_0x325b55,_0x26d5be){return db[_0xb5cb('0x19')]['update'](_0x503b0a[_0xb5cb('0x25')],{'raw':_0x503b0a[_0xb5cb('0x1b')]?_0x503b0a[_0xb5cb('0x1b')][_0xb5cb('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x503b0a[_0xb5cb('0x1b')]?_0x503b0a['options'][_0xb5cb('0x1d')]||null:null,'attributes':_0x503b0a[_0xb5cb('0x1b')]?_0x503b0a['options'][_0xb5cb('0x1e')]||null:null,'limit':_0x503b0a[_0xb5cb('0x1b')]?_0x503b0a[_0xb5cb('0x1b')][_0xb5cb('0x26')]||null:null})[_0xb5cb('0xc')](function(_0x52c724){logger[_0xb5cb('0xd')](_0xb5cb('0x27'),_0x503b0a);logger[_0xb5cb('0xf')]('UpdateCmHopper',_0x503b0a,JSON[_0xb5cb('0x12')](_0x52c724));_0x325b55(_0x52c724);})[_0xb5cb('0x17')](function(_0x38c096){logger[_0xb5cb('0x14')](_0xb5cb('0x27'),_0x38c096[_0xb5cb('0x15')],_0x503b0a);_0x26d5be(_0x5b3bd6[_0xb5cb('0x14')](0x1f4,_0x38c096[_0xb5cb('0x15')]));});});};exports[_0xb5cb('0x28')]=function(_0x4292d5){var _0x37b222=this;return new Promise(function(_0x32bcdd,_0xb1f65d){return db[_0xb5cb('0x19')]['destroy']({'where':_0x4292d5[_0xb5cb('0x1b')]?_0x4292d5[_0xb5cb('0x1b')][_0xb5cb('0x1d')]||null:null})[_0xb5cb('0xc')](function(_0x88d4df){logger[_0xb5cb('0xd')]('DestroyCmHopper',_0x4292d5);logger[_0xb5cb('0xf')](_0xb5cb('0x28'),_0x4292d5,JSON[_0xb5cb('0x12')](_0x88d4df));_0x32bcdd(_0x88d4df);})[_0xb5cb('0x17')](function(_0x44c9cf){logger['error']('DestroyCmHopper',_0x44c9cf[_0xb5cb('0x15')],_0x4292d5);_0xb1f65d(_0x37b222[_0xb5cb('0x14')](0x1f4,_0x44c9cf[_0xb5cb('0x15')]));});});};exports['GetContactDialer']=function(_0x14eb11){var _0x2d8339=this;return new Promise(function(_0x351d13,_0x118163){return db[_0xb5cb('0x29')][_0xb5cb('0x2a')]()[_0xb5cb('0xc')](function(_0x32b706){return db[_0xb5cb('0x2b')]['transaction'](function(_0x1a01ec){return db['CmHopper'][_0xb5cb('0x1a')]({'where':_0x14eb11['options']?_0x14eb11[_0xb5cb('0x1b')]['where']||null:null,'attributes':_0x14eb11[_0xb5cb('0x1b')]?_0x14eb11['options'][_0xb5cb('0x1e')]||null:null,'limit':_0x14eb11[_0xb5cb('0x1b')]?_0x14eb11['options'][_0xb5cb('0x26')]||null:null,'order':_0x14eb11['options']?_0x14eb11['options'][_0xb5cb('0x2c')]||null:null,'transaction':_0x1a01ec,'lock':_0x1a01ec[_0xb5cb('0x2d')][_0xb5cb('0x2e')],'include':[{'model':db[_0xb5cb('0x29')],'as':_0xb5cb('0x2f'),'attributes':_[_0xb5cb('0x30')](_0x32b706)},{'model':db['User'],'as':_0xb5cb('0x31'),'attributes':['id','name',_0xb5cb('0x32')]}]})[_0xb5cb('0xc')](function(_0x2629f0){var _0xce7b30=[];var _0x1dbe21=[];for(var _0x1f9acf=0x0;_0x1f9acf<_0x2629f0[_0xb5cb('0x33')];_0x1f9acf+=0x1){if(!_0x1dbe21[_0xb5cb('0x34')](_0x2629f0[_0x1f9acf][_0xb5cb('0x35')])){_0x1dbe21[_0xb5cb('0x36')](_0x2629f0[_0x1f9acf][_0xb5cb('0x35')]);_0xce7b30['push'](_0x2629f0[_0x1f9acf][_0xb5cb('0x37')](_0x14eb11[_0xb5cb('0x25')],{'transaction':_0x1a01ec}));}}return BPromise[_0xb5cb('0x38')](_0xce7b30);});})[_0xb5cb('0xc')](function(_0x1e7b95){logger[_0xb5cb('0xd')]('GetContactDialer',_0x14eb11);logger['debug'](_0xb5cb('0x39'),_0x14eb11,JSON[_0xb5cb('0x12')](_0x1e7b95));_0x351d13(_0x1e7b95);})['catch'](function(_0x498773){logger[_0xb5cb('0x14')](_0xb5cb('0x39'),_0x498773[_0xb5cb('0x15')],_0x14eb11);_0x118163(_0x2d8339['error'](0x1f4,_0x498773[_0xb5cb('0x15')]));});});});};exports['MoveContactManagedDialer']=function(_0x4f85ef){var _0x6a823e=this;return new Promise(function(_0x15062c,_0x2bf415){return db[_0xb5cb('0x2b')]['transaction'](function(_0x1f02d7){return db[_0xb5cb('0x3a')][_0xb5cb('0x3b')](_0x4f85ef[_0xb5cb('0x25')],{'raw':_0x4f85ef[_0xb5cb('0x1b')]?_0x4f85ef[_0xb5cb('0x1b')]['raw']===undefined?!![]:![]:!![],'transaction':_0x1f02d7})[_0xb5cb('0xc')](function(){return db[_0xb5cb('0x19')][_0xb5cb('0x3c')]({'where':_0x4f85ef[_0xb5cb('0x1b')]?_0x4f85ef['options'][_0xb5cb('0x1d')]||null:null,'transaction':_0x1f02d7});});})['then'](function(_0x152759){logger[_0xb5cb('0xd')]('MoveContactManagedDialer',_0x4f85ef);logger['debug']('MoveContactManagedDialer',_0x4f85ef,JSON[_0xb5cb('0x12')](_0x152759));_0x15062c(_0x152759);})[_0xb5cb('0x17')](function(_0x150348){logger[_0xb5cb('0x14')](_0xb5cb('0x3d'),_0x150348['message'],_0x4f85ef);_0x2bf415(_0x6a823e[_0xb5cb('0x14')](0x1f4,_0x150348[_0xb5cb('0x15')]));});});};exports[_0xb5cb('0x3e')]=function(_0x2e632d){var _0x23c4f1=this;return new Promise(function(_0x38f79d,_0x57f252){return db['CmHopper'][_0xb5cb('0x1a')]({'raw':_0x2e632d['options']?_0x2e632d[_0xb5cb('0x1b')][_0xb5cb('0x1c')]===undefined?!![]:![]:!![],'where':_0x2e632d[_0xb5cb('0x1b')]?_0x2e632d[_0xb5cb('0x1b')][_0xb5cb('0x1d')]||null:null,'attributes':[[db[_0xb5cb('0x2b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb5cb('0x2b')][_0xb5cb('0x3f')](_0xb5cb('0x40')+util[_0xb5cb('0x41')](_0xb5cb('0x42'),moment()[_0xb5cb('0x41')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xb5cb('0x43')))),_0xb5cb('0x44')]]})[_0xb5cb('0xc')](function(_0x29cd88){logger[_0xb5cb('0xd')](_0xb5cb('0x3e'),_0x2e632d);logger[_0xb5cb('0xf')](_0xb5cb('0x3e'),_0x2e632d,JSON[_0xb5cb('0x12')](_0x29cd88));_0x38f79d(_0x29cd88);})[_0xb5cb('0x17')](function(_0x206728){logger[_0xb5cb('0x14')](_0xb5cb('0x3e'),_0x206728[_0xb5cb('0x15')],_0x2e632d);_0x57f252(_0x23c4f1['error'](0x1f4,_0x206728['message']));});});};exports[_0xb5cb('0x45')]=function(_0x156cd6){var _0x3d44a7=this;return new Promise(function(_0x2e440a,_0x776213){return db[_0xb5cb('0x29')][_0xb5cb('0x2a')]()[_0xb5cb('0xc')](function(_0x3003b2){return db[_0xb5cb('0x2b')][_0xb5cb('0x46')](function(_0x3a2299){return db['CmHopper'][_0xb5cb('0x1a')]({'where':_0x156cd6[_0xb5cb('0x1b')]?_0x156cd6['options'][_0xb5cb('0x1d')]||null:null,'attributes':_0x156cd6[_0xb5cb('0x1b')]?_0x156cd6['options'][_0xb5cb('0x1e')]||null:null,'limit':0x1,'order':_0x156cd6[_0xb5cb('0x1b')]?_0x156cd6[_0xb5cb('0x1b')]['order']||null:null,'group':db['CmHopper'][_0xb5cb('0x35')],'transaction':_0x3a2299,'lock':_0x3a2299['LOCK'][_0xb5cb('0x2e')],'include':_0x156cd6[_0xb5cb('0x1b')]?_0x156cd6[_0xb5cb('0x1b')][_0xb5cb('0x20')]?_[_0xb5cb('0x1f')](_0x156cd6[_0xb5cb('0x1b')][_0xb5cb('0x20')],function(_0x3a2872){return{'model':db[_0x3a2872['model']],'as':_0x3a2872['as'],'attributes':_0x3a2872[_0xb5cb('0x1e')],'include':_0x3a2872[_0xb5cb('0x20')]?_[_0xb5cb('0x1f')](_0x3a2872[_0xb5cb('0x20')],function(_0x459183){return{'model':db[_0x459183[_0xb5cb('0x21')]],'as':_0x459183['as'],'attributes':_0x459183[_0xb5cb('0x1e')],'include':_0x459183['include']?_[_0xb5cb('0x1f')](_0x459183[_0xb5cb('0x20')],function(_0x36f002){return{'model':db[_0x36f002['model']],'as':_0x36f002['as'],'attributes':_0x36f002[_0xb5cb('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29e6e3){var _0x1db312=[];for(var _0x38696c=0x0;_0x38696c<_0x29e6e3[_0xb5cb('0x33')];_0x38696c+=0x1){_0x1db312[_0xb5cb('0x36')](_0x29e6e3[_0x38696c][_0xb5cb('0x37')](_0x156cd6[_0xb5cb('0x25')],{'transaction':_0x3a2299}));}return BPromise[_0xb5cb('0x38')](_0x1db312);});})[_0xb5cb('0xc')](function(_0x23d106){logger[_0xb5cb('0xd')](_0xb5cb('0x45'),_0x156cd6);logger['debug'](_0xb5cb('0x45'),_0x156cd6,JSON[_0xb5cb('0x12')](_0x23d106));_0x2e440a(_0x23d106);})[_0xb5cb('0x17')](function(_0x55c7f2){logger['error']('GetContactRecallMe',_0x55c7f2[_0xb5cb('0x15')],_0x156cd6);_0x776213(_0x3d44a7[_0xb5cb('0x14')](0x1f4,_0x55c7f2['message']));});});});};exports[_0xb5cb('0x47')]=function(_0x41364e){var _0xe9c0e7=this;return new Promise(function(_0x1eb834,_0x124428){db[_0xb5cb('0x29')][_0xb5cb('0x2a')]()[_0xb5cb('0xc')](function(_0x50cdf8){return db[_0xb5cb('0x19')][_0xb5cb('0x1a')]({'raw':_0x41364e[_0xb5cb('0x1b')]?_0x41364e[_0xb5cb('0x1b')][_0xb5cb('0x1c')]===undefined?!![]:![]:!![],'where':_0x41364e['options']?_0x41364e[_0xb5cb('0x1b')][_0xb5cb('0x1d')]||null:null,'attributes':_0x41364e[_0xb5cb('0x1b')]?_0x41364e['options'][_0xb5cb('0x1e')]||null:null,'limit':_0x41364e[_0xb5cb('0x1b')]?_0x41364e[_0xb5cb('0x1b')]['limit']||null:null,'include':_0x41364e[_0xb5cb('0x1b')]?_0x41364e[_0xb5cb('0x1b')][_0xb5cb('0x20')]?_[_0xb5cb('0x1f')](_0x41364e[_0xb5cb('0x1b')][_0xb5cb('0x20')],function(_0x166541){return{'model':db[_0x166541['model']],'as':_0x166541['as'],'attributes':_0x166541['as']===_0xb5cb('0x2f')?_[_0xb5cb('0x30')](_0x50cdf8):_0x166541[_0xb5cb('0x1e')],'include':_0x166541[_0xb5cb('0x20')]?_[_0xb5cb('0x1f')](_0x166541['include'],function(_0x5d83c6){return{'model':db[_0x5d83c6[_0xb5cb('0x21')]],'as':_0x5d83c6['as'],'attributes':_0x5d83c6['attributes'],'include':_0x5d83c6[_0xb5cb('0x20')]?_[_0xb5cb('0x1f')](_0x5d83c6[_0xb5cb('0x20')],function(_0x331dc6){return{'model':db[_0x331dc6[_0xb5cb('0x21')]],'as':_0x331dc6['as'],'attributes':_0x331dc6[_0xb5cb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb5cb('0xc')](function(_0x3fb051){logger[_0xb5cb('0xd')]('GetCmHopper',_0x41364e);logger[_0xb5cb('0xf')](_0xb5cb('0x18'),_0x41364e,JSON['stringify'](_0x3fb051));_0x1eb834(_0x3fb051);})[_0xb5cb('0x17')](function(_0x58880a){logger['error'](_0xb5cb('0x18'),_0x58880a[_0xb5cb('0x15')],_0x41364e);_0x124428(_0xe9c0e7[_0xb5cb('0x14')](0x1f4,_0x58880a[_0xb5cb('0x15')]));});});});}; \ No newline at end of file +var _0x84af=['Contact','keys','User','Agent','includes','UserId','push','all','MoveContactManagedDialer','CmHopperFinal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','CountReScheduled','GetContactRecallMe','length','GetCmHopperPreview','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CmHopper','findAll','options','raw','limit','include','model','attributes','map','GetCmHopper','ShowCmHopper','find','where','CreateCmHopper','create','body','UpdateCmHopper','update','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE'];(function(_0x42b24b,_0x48e943){var _0x72af83=function(_0xed72c9){while(--_0xed72c9){_0x42b24b['push'](_0x42b24b['shift']());}};_0x72af83(++_0x48e943);}(_0x84af,0x1aa));var _0xf84a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x84af[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xf84a('0x0'));var util=require(_0xf84a('0x1'));var moment=require('moment');var BPromise=require(_0xf84a('0x2'));var rs=require(_0xf84a('0x3'));var fs=require('fs');var Redis=require(_0xf84a('0x4'));var db=require(_0xf84a('0x5'))['db'];var utils=require(_0xf84a('0x6'));var logger=require(_0xf84a('0x7'))('rpc');var config=require(_0xf84a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf84a('0x9')][_0xf84a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e1a3b,_0x167fee,_0x591be3){return new BPromise(function(_0x63e58b,_0x4952aa){return client[_0xf84a('0xb')](_0x5e1a3b,_0x591be3)[_0xf84a('0xc')](function(_0x59e494){logger[_0xf84a('0xd')](_0xf84a('0xe'),_0x167fee,_0xf84a('0xf'));logger[_0xf84a('0x10')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x167fee,'request\x20sent',JSON[_0xf84a('0x11')](_0x59e494));if(_0x59e494[_0xf84a('0x12')]){if(_0x59e494[_0xf84a('0x12')]['code']===0x1f4){logger[_0xf84a('0x12')](_0xf84a('0xe'),_0x167fee,_0x59e494['error']['message']);return _0x4952aa(_0x59e494[_0xf84a('0x12')]['message']);}logger[_0xf84a('0x12')](_0xf84a('0xe'),_0x167fee,_0x59e494[_0xf84a('0x12')]['message']);return _0x63e58b(_0x59e494[_0xf84a('0x12')][_0xf84a('0x13')]);}else{logger['info'](_0xf84a('0xe'),_0x167fee,_0xf84a('0xf'));_0x63e58b(_0x59e494[_0xf84a('0x14')][_0xf84a('0x13')]);}})[_0xf84a('0x15')](function(_0x179569){logger[_0xf84a('0x12')](_0xf84a('0xe'),_0x167fee,_0x179569);_0x4952aa(_0x179569);});});}exports['GetCmHopper']=function(_0x1cbff7){var _0x399127=this;return new Promise(function(_0x1a97f7,_0x1b48a9){return db[_0xf84a('0x16')][_0xf84a('0x17')]({'raw':_0x1cbff7[_0xf84a('0x18')]?_0x1cbff7[_0xf84a('0x18')][_0xf84a('0x19')]===undefined?!![]:![]:!![],'where':_0x1cbff7[_0xf84a('0x18')]?_0x1cbff7[_0xf84a('0x18')]['where']||null:null,'attributes':_0x1cbff7['options']?_0x1cbff7['options']['attributes']||null:null,'limit':_0x1cbff7[_0xf84a('0x18')]?_0x1cbff7['options'][_0xf84a('0x1a')]||null:null,'include':_0x1cbff7[_0xf84a('0x18')]?_0x1cbff7[_0xf84a('0x18')][_0xf84a('0x1b')]?_['map'](_0x1cbff7[_0xf84a('0x18')]['include'],function(_0x2d13ed){return{'model':db[_0x2d13ed[_0xf84a('0x1c')]],'as':_0x2d13ed['as'],'attributes':_0x2d13ed[_0xf84a('0x1d')],'include':_0x2d13ed[_0xf84a('0x1b')]?_[_0xf84a('0x1e')](_0x2d13ed['include'],function(_0x3e1aff){return{'model':db[_0x3e1aff['model']],'as':_0x3e1aff['as'],'attributes':_0x3e1aff[_0xf84a('0x1d')],'include':_0x3e1aff['include']?_['map'](_0x3e1aff[_0xf84a('0x1b')],function(_0x4a15c7){return{'model':db[_0x4a15c7[_0xf84a('0x1c')]],'as':_0x4a15c7['as'],'attributes':_0x4a15c7[_0xf84a('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c483){logger[_0xf84a('0xd')](_0xf84a('0x1f'),_0x1cbff7);logger[_0xf84a('0x10')](_0xf84a('0x1f'),_0x1cbff7,JSON[_0xf84a('0x11')](_0x1c483));_0x1a97f7(_0x1c483);})[_0xf84a('0x15')](function(_0x17fa1c){logger[_0xf84a('0x12')](_0xf84a('0x1f'),_0x17fa1c[_0xf84a('0x13')],_0x1cbff7);_0x1b48a9(_0x399127[_0xf84a('0x12')](0x1f4,_0x17fa1c[_0xf84a('0x13')]));});});};exports[_0xf84a('0x20')]=function(_0x2ddd98){var _0x480474=this;return new Promise(function(_0x525d00,_0x5e7858){return db[_0xf84a('0x16')][_0xf84a('0x21')]({'raw':_0x2ddd98['options']?_0x2ddd98[_0xf84a('0x18')][_0xf84a('0x19')]===undefined?!![]:![]:!![],'where':_0x2ddd98[_0xf84a('0x18')]?_0x2ddd98[_0xf84a('0x18')][_0xf84a('0x22')]||null:null,'attributes':_0x2ddd98[_0xf84a('0x18')]?_0x2ddd98[_0xf84a('0x18')][_0xf84a('0x1d')]||null:null,'include':_0x2ddd98[_0xf84a('0x18')]?_0x2ddd98[_0xf84a('0x18')][_0xf84a('0x1b')]?_['map'](_0x2ddd98['options'][_0xf84a('0x1b')],function(_0x50d815){return{'model':db[_0x50d815[_0xf84a('0x1c')]],'as':_0x50d815['as'],'attributes':_0x50d815[_0xf84a('0x1d')],'include':_0x50d815[_0xf84a('0x1b')]?_[_0xf84a('0x1e')](_0x50d815[_0xf84a('0x1b')],function(_0x258645){return{'model':db[_0x258645[_0xf84a('0x1c')]],'as':_0x258645['as'],'attributes':_0x258645[_0xf84a('0x1d')],'include':_0x258645[_0xf84a('0x1b')]?_['map'](_0x258645['include'],function(_0x4e285b){return{'model':db[_0x4e285b[_0xf84a('0x1c')]],'as':_0x4e285b['as'],'attributes':_0x4e285b['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c1513){logger[_0xf84a('0xd')]('ShowCmHopper',_0x2ddd98);logger['debug'](_0xf84a('0x20'),_0x2ddd98,JSON[_0xf84a('0x11')](_0x3c1513));_0x525d00(_0x3c1513);})[_0xf84a('0x15')](function(_0x9978f7){logger[_0xf84a('0x12')](_0xf84a('0x20'),_0x9978f7[_0xf84a('0x13')],_0x2ddd98);_0x5e7858(_0x480474[_0xf84a('0x12')](0x1f4,_0x9978f7[_0xf84a('0x13')]));});});};exports[_0xf84a('0x23')]=function(_0x1e26e9){var _0x187356=this;return new Promise(function(_0x2104c3,_0x21c362){return db[_0xf84a('0x16')][_0xf84a('0x24')](_0x1e26e9[_0xf84a('0x25')],{'raw':_0x1e26e9[_0xf84a('0x18')]?_0x1e26e9['options'][_0xf84a('0x19')]===undefined?!![]:![]:!![]})[_0xf84a('0xc')](function(_0x46b22b){logger['info'](_0xf84a('0x23'),_0x1e26e9);logger[_0xf84a('0x10')]('CreateCmHopper',_0x1e26e9,JSON[_0xf84a('0x11')](_0x46b22b));_0x2104c3(_0x46b22b);})[_0xf84a('0x15')](function(_0x114645){logger[_0xf84a('0x12')](_0xf84a('0x23'),_0x114645[_0xf84a('0x13')],_0x1e26e9);_0x21c362(_0x187356[_0xf84a('0x12')](0x1f4,_0x114645['message']));});});};exports[_0xf84a('0x26')]=function(_0x2dd9ab){var _0x4beeee=this;return new Promise(function(_0x241ba9,_0x218683){return db[_0xf84a('0x16')][_0xf84a('0x27')](_0x2dd9ab['body'],{'raw':_0x2dd9ab[_0xf84a('0x18')]?_0x2dd9ab['options'][_0xf84a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2dd9ab[_0xf84a('0x18')]?_0x2dd9ab[_0xf84a('0x18')][_0xf84a('0x22')]||null:null,'attributes':_0x2dd9ab['options']?_0x2dd9ab[_0xf84a('0x18')]['attributes']||null:null,'limit':_0x2dd9ab[_0xf84a('0x18')]?_0x2dd9ab[_0xf84a('0x18')][_0xf84a('0x1a')]||null:null})[_0xf84a('0xc')](function(_0x153f7e){logger[_0xf84a('0xd')](_0xf84a('0x26'),_0x2dd9ab);logger['debug'](_0xf84a('0x26'),_0x2dd9ab,JSON[_0xf84a('0x11')](_0x153f7e));_0x241ba9(_0x153f7e);})[_0xf84a('0x15')](function(_0x5b04c3){logger[_0xf84a('0x12')](_0xf84a('0x26'),_0x5b04c3[_0xf84a('0x13')],_0x2dd9ab);_0x218683(_0x4beeee[_0xf84a('0x12')](0x1f4,_0x5b04c3[_0xf84a('0x13')]));});});};exports['DestroyCmHopper']=function(_0x488afc){var _0x276204=this;return new Promise(function(_0x14a9ae,_0x4ae2da){return db[_0xf84a('0x16')][_0xf84a('0x28')]({'where':_0x488afc[_0xf84a('0x18')]?_0x488afc[_0xf84a('0x18')]['where']||null:null})[_0xf84a('0xc')](function(_0x1a3024){logger[_0xf84a('0xd')](_0xf84a('0x29'),_0x488afc);logger[_0xf84a('0x10')]('DestroyCmHopper',_0x488afc,JSON[_0xf84a('0x11')](_0x1a3024));_0x14a9ae(_0x1a3024);})[_0xf84a('0x15')](function(_0x19d58e){logger[_0xf84a('0x12')](_0xf84a('0x29'),_0x19d58e['message'],_0x488afc);_0x4ae2da(_0x276204[_0xf84a('0x12')](0x1f4,_0x19d58e[_0xf84a('0x13')]));});});};exports[_0xf84a('0x2a')]=function(_0x22606f){var _0x5674a6=this;return new Promise(function(_0x1e651c,_0x2a1b04){return db[_0xf84a('0x2b')][_0xf84a('0x2c')]()[_0xf84a('0xc')](function(_0x432d2a){return db[_0xf84a('0x2d')][_0xf84a('0x2e')](function(_0x23a626){return db[_0xf84a('0x16')][_0xf84a('0x17')]({'where':_0x22606f[_0xf84a('0x18')]?_0x22606f[_0xf84a('0x18')]['where']||null:null,'attributes':_0x22606f[_0xf84a('0x18')]?_0x22606f[_0xf84a('0x18')][_0xf84a('0x1d')]||null:null,'limit':_0x22606f[_0xf84a('0x18')]?_0x22606f[_0xf84a('0x18')][_0xf84a('0x1a')]||null:null,'order':_0x22606f[_0xf84a('0x18')]?_0x22606f[_0xf84a('0x18')][_0xf84a('0x2f')]||null:null,'transaction':_0x23a626,'lock':_0x23a626[_0xf84a('0x30')][_0xf84a('0x31')],'include':[{'model':db[_0xf84a('0x2b')],'as':_0xf84a('0x32'),'attributes':_[_0xf84a('0x33')](_0x432d2a)},{'model':db[_0xf84a('0x34')],'as':_0xf84a('0x35'),'attributes':['id','name','voicePause']}]})[_0xf84a('0xc')](function(_0x425621){var _0x3f91fa=[];var _0x88a56c=[];for(var _0x5c7fab=0x0;_0x5c7fab<_0x425621['length'];_0x5c7fab+=0x1){if(!_0x88a56c[_0xf84a('0x36')](_0x425621[_0x5c7fab][_0xf84a('0x37')])){_0x88a56c[_0xf84a('0x38')](_0x425621[_0x5c7fab]['UserId']);_0x3f91fa[_0xf84a('0x38')](_0x425621[_0x5c7fab]['update'](_0x22606f[_0xf84a('0x25')],{'transaction':_0x23a626}));}}return BPromise[_0xf84a('0x39')](_0x3f91fa);});})[_0xf84a('0xc')](function(_0xb4df50){logger[_0xf84a('0xd')](_0xf84a('0x2a'),_0x22606f);logger['debug']('GetContactDialer',_0x22606f,JSON[_0xf84a('0x11')](_0xb4df50));_0x1e651c(_0xb4df50);})[_0xf84a('0x15')](function(_0x2b8355){logger['error']('GetContactDialer',_0x2b8355[_0xf84a('0x13')],_0x22606f);_0x2a1b04(_0x5674a6[_0xf84a('0x12')](0x1f4,_0x2b8355[_0xf84a('0x13')]));});});});};exports[_0xf84a('0x3a')]=function(_0x84c6d9){var _0x3225d6=this;return new Promise(function(_0x520bbe,_0x4c4399){return db[_0xf84a('0x2d')][_0xf84a('0x2e')](function(_0x49b720){return db[_0xf84a('0x3b')][_0xf84a('0x24')](_0x84c6d9['body'],{'raw':_0x84c6d9[_0xf84a('0x18')]?_0x84c6d9[_0xf84a('0x18')][_0xf84a('0x19')]===undefined?!![]:![]:!![],'transaction':_0x49b720})['then'](function(){return db[_0xf84a('0x16')][_0xf84a('0x28')]({'where':_0x84c6d9[_0xf84a('0x18')]?_0x84c6d9[_0xf84a('0x18')][_0xf84a('0x22')]||null:null,'transaction':_0x49b720});});})['then'](function(_0x13df3c){logger[_0xf84a('0xd')]('MoveContactManagedDialer',_0x84c6d9);logger[_0xf84a('0x10')](_0xf84a('0x3a'),_0x84c6d9,JSON[_0xf84a('0x11')](_0x13df3c));_0x520bbe(_0x13df3c);})[_0xf84a('0x15')](function(_0x242c4b){logger[_0xf84a('0x12')](_0xf84a('0x3a'),_0x242c4b[_0xf84a('0x13')],_0x84c6d9);_0x4c4399(_0x3225d6[_0xf84a('0x12')](0x1f4,_0x242c4b['message']));});});};exports['CountReScheduled']=function(_0x4bb0a3){var _0x1c5bb3=this;return new Promise(function(_0x374341,_0x56e4d0){return db[_0xf84a('0x16')][_0xf84a('0x17')]({'raw':_0x4bb0a3[_0xf84a('0x18')]?_0x4bb0a3[_0xf84a('0x18')][_0xf84a('0x19')]===undefined?!![]:![]:!![],'where':_0x4bb0a3[_0xf84a('0x18')]?_0x4bb0a3['options'][_0xf84a('0x22')]||null:null,'attributes':[[db[_0xf84a('0x2d')]['fn']('COUNT',db[_0xf84a('0x2d')]['fn']('IF',db[_0xf84a('0x2d')]['literal'](_0xf84a('0x3c')+util[_0xf84a('0x3d')](_0xf84a('0x3e'),moment()['format'](_0xf84a('0x3f')))+'\x20,\x201,\x20null'))),'contactsRescheduled']]})['then'](function(_0x229b19){logger[_0xf84a('0xd')](_0xf84a('0x40'),_0x4bb0a3);logger['debug'](_0xf84a('0x40'),_0x4bb0a3,JSON['stringify'](_0x229b19));_0x374341(_0x229b19);})[_0xf84a('0x15')](function(_0x525739){logger[_0xf84a('0x12')](_0xf84a('0x40'),_0x525739[_0xf84a('0x13')],_0x4bb0a3);_0x56e4d0(_0x1c5bb3['error'](0x1f4,_0x525739[_0xf84a('0x13')]));});});};exports[_0xf84a('0x41')]=function(_0x5cd38d){var _0x1e68ac=this;return new Promise(function(_0xa56651,_0xe8bc6d){return db['CmContact'][_0xf84a('0x2c')]()[_0xf84a('0xc')](function(_0x1955bf){return db['sequelize'][_0xf84a('0x2e')](function(_0x34263e){return db['CmHopper'][_0xf84a('0x17')]({'where':_0x5cd38d[_0xf84a('0x18')]?_0x5cd38d[_0xf84a('0x18')][_0xf84a('0x22')]||null:null,'attributes':_0x5cd38d[_0xf84a('0x18')]?_0x5cd38d[_0xf84a('0x18')]['attributes']||null:null,'limit':0x1,'order':_0x5cd38d[_0xf84a('0x18')]?_0x5cd38d[_0xf84a('0x18')]['order']||null:null,'group':db['CmHopper'][_0xf84a('0x37')],'transaction':_0x34263e,'lock':_0x34263e['LOCK'][_0xf84a('0x31')],'include':_0x5cd38d[_0xf84a('0x18')]?_0x5cd38d[_0xf84a('0x18')][_0xf84a('0x1b')]?_[_0xf84a('0x1e')](_0x5cd38d[_0xf84a('0x18')]['include'],function(_0x33ec9c){return{'model':db[_0x33ec9c[_0xf84a('0x1c')]],'as':_0x33ec9c['as'],'attributes':_0x33ec9c['attributes'],'include':_0x33ec9c[_0xf84a('0x1b')]?_[_0xf84a('0x1e')](_0x33ec9c[_0xf84a('0x1b')],function(_0xc2b180){return{'model':db[_0xc2b180[_0xf84a('0x1c')]],'as':_0xc2b180['as'],'attributes':_0xc2b180[_0xf84a('0x1d')],'include':_0xc2b180[_0xf84a('0x1b')]?_[_0xf84a('0x1e')](_0xc2b180[_0xf84a('0x1b')],function(_0x39f8de){return{'model':db[_0x39f8de['model']],'as':_0x39f8de['as'],'attributes':_0x39f8de[_0xf84a('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x572ba8){var _0x3fc6f4=[];for(var _0x3f7f98=0x0;_0x3f7f98<_0x572ba8[_0xf84a('0x42')];_0x3f7f98+=0x1){_0x3fc6f4[_0xf84a('0x38')](_0x572ba8[_0x3f7f98]['update'](_0x5cd38d['body'],{'transaction':_0x34263e}));}return BPromise[_0xf84a('0x39')](_0x3fc6f4);});})[_0xf84a('0xc')](function(_0xbdd42a){logger[_0xf84a('0xd')](_0xf84a('0x41'),_0x5cd38d);logger[_0xf84a('0x10')](_0xf84a('0x41'),_0x5cd38d,JSON[_0xf84a('0x11')](_0xbdd42a));_0xa56651(_0xbdd42a);})['catch'](function(_0xb014d6){logger[_0xf84a('0x12')](_0xf84a('0x41'),_0xb014d6[_0xf84a('0x13')],_0x5cd38d);_0xe8bc6d(_0x1e68ac[_0xf84a('0x12')](0x1f4,_0xb014d6[_0xf84a('0x13')]));});});});};exports[_0xf84a('0x43')]=function(_0x33d564){var _0xd3db02=this;return new Promise(function(_0x304df6,_0x8b74f7){db[_0xf84a('0x2b')]['describe']()['then'](function(_0x22512b){return db['CmHopper'][_0xf84a('0x17')]({'raw':_0x33d564[_0xf84a('0x18')]?_0x33d564[_0xf84a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x33d564[_0xf84a('0x18')]?_0x33d564[_0xf84a('0x18')][_0xf84a('0x22')]||null:null,'attributes':_0x33d564[_0xf84a('0x18')]?_0x33d564[_0xf84a('0x18')][_0xf84a('0x1d')]||null:null,'limit':_0x33d564[_0xf84a('0x18')]?_0x33d564['options'][_0xf84a('0x1a')]||null:null,'include':_0x33d564[_0xf84a('0x18')]?_0x33d564[_0xf84a('0x18')][_0xf84a('0x1b')]?_[_0xf84a('0x1e')](_0x33d564[_0xf84a('0x18')][_0xf84a('0x1b')],function(_0xd4a01b){return{'model':db[_0xd4a01b[_0xf84a('0x1c')]],'as':_0xd4a01b['as'],'attributes':_0xd4a01b['as']===_0xf84a('0x32')?_[_0xf84a('0x33')](_0x22512b):_0xd4a01b[_0xf84a('0x1d')],'include':_0xd4a01b['include']?_[_0xf84a('0x1e')](_0xd4a01b[_0xf84a('0x1b')],function(_0x4951d4){return{'model':db[_0x4951d4[_0xf84a('0x1c')]],'as':_0x4951d4['as'],'attributes':_0x4951d4[_0xf84a('0x1d')],'include':_0x4951d4[_0xf84a('0x1b')]?_[_0xf84a('0x1e')](_0x4951d4[_0xf84a('0x1b')],function(_0x142697){return{'model':db[_0x142697[_0xf84a('0x1c')]],'as':_0x142697['as'],'attributes':_0x142697[_0xf84a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf84a('0xc')](function(_0x634338){logger[_0xf84a('0xd')](_0xf84a('0x1f'),_0x33d564);logger[_0xf84a('0x10')](_0xf84a('0x1f'),_0x33d564,JSON[_0xf84a('0x11')](_0x634338));_0x304df6(_0x634338);})['catch'](function(_0x3d164e){logger[_0xf84a('0x12')](_0xf84a('0x1f'),_0x3d164e[_0xf84a('0x13')],_0x33d564);_0x8b74f7(_0xd3db02[_0xf84a('0x12')](0x1f4,_0x3d164e[_0xf84a('0x13')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 529b216..f8974c6 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 _0x79a3=['multer','path','connect-timeout','Router','./cmHopper.controller','get','isAuthenticated','index','/opencontacts','getOpenContacts','/:id','/preview','getPreview','put','delete','destroy'];(function(_0x38b27e,_0x845bfc){var _0x4d9258=function(_0x21daed){while(--_0x21daed){_0x38b27e['push'](_0x38b27e['shift']());}};_0x4d9258(++_0x845bfc);}(_0x79a3,0x80));var _0x379a=function(_0x2c1583,_0x206c27){_0x2c1583=_0x2c1583-0x0;var _0x2f5beb=_0x79a3[_0x2c1583];return _0x2f5beb;};'use strict';var multer=require(_0x379a('0x0'));var util=require('util');var path=require(_0x379a('0x1'));var timeout=require(_0x379a('0x2'));var express=require('express');var router=express[_0x379a('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x379a('0x4'));router[_0x379a('0x5')]('/',auth[_0x379a('0x6')](),controller[_0x379a('0x7')]);router[_0x379a('0x5')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x379a('0x5')](_0x379a('0x8'),auth[_0x379a('0x6')](),controller[_0x379a('0x9')]);router[_0x379a('0x5')](_0x379a('0xa'),auth[_0x379a('0x6')](),controller['show']);router['post']('/',auth[_0x379a('0x6')](),controller['create']);router['post'](_0x379a('0xb'),auth[_0x379a('0x6')](),controller[_0x379a('0xc')]);router[_0x379a('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x379a('0xe')](_0x379a('0xa'),auth[_0x379a('0x6')](),controller[_0x379a('0xf')]);module['exports']=router; \ No newline at end of file +var _0x23bb=['exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','/:id','show','post','create','/preview','getPreview','put','update','delete','destroy'];(function(_0x5a4d03,_0x1aed54){var _0x5ac8b7=function(_0x4f64bf){while(--_0x4f64bf){_0x5a4d03['push'](_0x5a4d03['shift']());}};_0x5ac8b7(++_0x1aed54);}(_0x23bb,0x79));var _0xb23b=function(_0x5f49a2,_0x54b7ed){_0x5f49a2=_0x5f49a2-0x0;var _0x2e49ac=_0x23bb[_0x5f49a2];return _0x2e49ac;};'use strict';var multer=require(_0xb23b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb23b('0x1'));var express=require(_0xb23b('0x2'));var router=express[_0xb23b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb23b('0x4'));var config=require(_0xb23b('0x5'));var controller=require(_0xb23b('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb23b('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xb23b('0x7')]('/opencontacts',auth[_0xb23b('0x8')](),controller['getOpenContacts']);router[_0xb23b('0x7')](_0xb23b('0x9'),auth['isAuthenticated'](),controller[_0xb23b('0xa')]);router[_0xb23b('0xb')]('/',auth['isAuthenticated'](),controller[_0xb23b('0xc')]);router[_0xb23b('0xb')](_0xb23b('0xd'),auth['isAuthenticated'](),controller[_0xb23b('0xe')]);router[_0xb23b('0xf')](_0xb23b('0x9'),auth[_0xb23b('0x8')](),controller[_0xb23b('0x10')]);router[_0xb23b('0x11')](_0xb23b('0x9'),auth[_0xb23b('0x8')](),controller[_0xb23b('0x12')]);module[_0xb23b('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 f51f990..ab46169 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 _0x47e9=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0x39e3b7,_0x14e80d){var _0xf02968=function(_0x55e353){while(--_0x55e353){_0x39e3b7['push'](_0x39e3b7['shift']());}};_0xf02968(++_0x14e80d);}(_0x47e9,0x12d));var _0x947e=function(_0x20abd1,_0x185022){_0x20abd1=_0x20abd1-0x0;var _0x43e325=_0x47e9[_0x20abd1];return _0x43e325;};'use strict';var moment=require(_0x947e('0x0'));var Sequelize=require(_0x947e('0x1'));module[_0x947e('0x2')]={'phone':{'type':Sequelize[_0x947e('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x947e('0x4')],'unique':_0x947e('0x5')},'ListId':{'type':Sequelize[_0x947e('0x4')],'unique':_0x947e('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x947e('0x5')}}; \ No newline at end of file +var _0x261b=['sequelize','INTEGER','contactListQueue','moment'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x261b,0x15b));var _0xb261=function(_0x5db06f,_0x31f46e){_0x5db06f=_0x5db06f-0x0;var _0x917030=_0x261b[_0x5db06f];return _0x917030;};'use strict';var moment=require(_0xb261('0x0'));var Sequelize=require(_0xb261('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xb261('0x2')],'unique':_0xb261('0x3')},'ListId':{'type':Sequelize[_0xb261('0x2')],'unique':_0xb261('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 1849e19..8e89ac7 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 _0xe341=['sort','where','filter','merge','CmHopperBlack','includeAll','include','findAll','catch','params','options','find','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','count','offset','limit','status','Content-Range','json','apply','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xe341,0x1ca));var _0x1e34=function(_0xe0420f,_0x17a314){_0xe0420f=_0xe0420f-0x0;var _0x3907d5=_0xe341[_0xe0420f];return _0x3907d5;};'use strict';var pdf=require(_0x1e34('0x0'));var emlformat=require(_0x1e34('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x1e34('0x2'));var jsonpatch=require(_0x1e34('0x3'));var rp=require(_0x1e34('0x4'));var moment=require(_0x1e34('0x5'));var BPromise=require(_0x1e34('0x6'));var Mustache=require('mustache');var util=require(_0x1e34('0x7'));var path=require(_0x1e34('0x8'));var sox=require('sox');var csv=require(_0x1e34('0x9'));var ejs=require(_0x1e34('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1e34('0xb'));var crypto=require(_0x1e34('0xc'));var jsforce=require(_0x1e34('0xd'));var deskjs=require(_0x1e34('0xe'));var toCsv=require(_0x1e34('0x9'));var querystring=require(_0x1e34('0xf'));var Papa=require(_0x1e34('0x10'));var Redis=require(_0x1e34('0x11'));var authService=require(_0x1e34('0x12'));var qs=require(_0x1e34('0x13'));var as=require(_0x1e34('0x14'));var hardwareService=require(_0x1e34('0x15'));var logger=require(_0x1e34('0x16'))(_0x1e34('0x17'));var utils=require('../../config/utils');var config=require(_0x1e34('0x18'));var licenseUtil=require(_0x1e34('0x19'));var db=require(_0x1e34('0x1a'))['db'];function respondWithStatusCode(_0x38cead,_0x27ff97){_0x27ff97=_0x27ff97||0xcc;return function(_0x249a81){if(_0x249a81){return _0x38cead[_0x1e34('0x1b')](_0x27ff97);}return _0x38cead['status'](_0x27ff97)[_0x1e34('0x1c')]();};}function respondWithResult(_0x1ffd31,_0x126ec9){_0x126ec9=_0x126ec9||0xc8;return function(_0x16b5a0){if(_0x16b5a0){return _0x1ffd31['status'](_0x126ec9)['json'](_0x16b5a0);}};}function respondWithFilteredResult(_0x30c9c2,_0x1fc7a5){return function(_0x97bb89){if(_0x97bb89){var _0x13ff58=_0x97bb89[_0x1e34('0x1d')],_0x2b9490=_0x1fc7a5[_0x1e34('0x1e')],_0x3a5efa=_0x1fc7a5['offset']+_0x1fc7a5[_0x1e34('0x1f')],_0x49a5ba;if(_0x3a5efa>=_0x13ff58){_0x3a5efa=_0x13ff58;_0x49a5ba=0xc8;}else{_0x49a5ba=0xce;}_0x30c9c2[_0x1e34('0x20')](_0x49a5ba);return _0x30c9c2['set'](_0x1e34('0x21'),_0x2b9490+'-'+_0x3a5efa+'/'+_0x13ff58)[_0x1e34('0x22')](_0x97bb89);}return null;};}function patchUpdates(_0x4f3e10){return function(_0x45d7de){try{jsonpatch[_0x1e34('0x23')](_0x45d7de,_0x4f3e10,!![]);}catch(_0x5b75e1){return BPromise['reject'](_0x5b75e1);}return _0x45d7de[_0x1e34('0x24')]();};}function saveUpdates(_0x5b94c8,_0xa1b841){return function(_0x2a309c){if(_0x2a309c){return _0x2a309c[_0x1e34('0x25')](_0x5b94c8)[_0x1e34('0x26')](function(_0x101c1c){return _0x101c1c;});}return null;};}function removeEntity(_0x8ed6b7,_0x428537){return function(_0x347b24){if(_0x347b24){return _0x347b24[_0x1e34('0x27')]()[_0x1e34('0x26')](function(){_0x8ed6b7[_0x1e34('0x20')](0xcc)[_0x1e34('0x1c')]();});}};}function handleEntityNotFound(_0x35aa41,_0xc33d44){return function(_0x37a2d1){if(!_0x37a2d1){_0x35aa41['sendStatus'](0x194);}return _0x37a2d1;};}function handleError(_0x503506,_0x325eab){_0x325eab=_0x325eab||0x1f4;return function(_0x5746ed){logger[_0x1e34('0x28')](_0x5746ed[_0x1e34('0x29')]);if(_0x5746ed[_0x1e34('0x2a')]){delete _0x5746ed[_0x1e34('0x2a')];}_0x503506['status'](_0x325eab)['send'](_0x5746ed);};}exports[_0x1e34('0x2b')]=function(_0x20907a,_0x51ba69){var _0x36f6ad={},_0x32a5e9={},_0x41561e={'count':0x0,'rows':[]};var _0xeb62ac=_[_0x1e34('0x2c')](db['CmHopperBlack'][_0x1e34('0x2d')],function(_0x102f65){return{'name':_0x102f65[_0x1e34('0x2e')],'type':_0x102f65[_0x1e34('0x2f')][_0x1e34('0x30')]};});_0x32a5e9[_0x1e34('0x31')]=_[_0x1e34('0x2c')](_0xeb62ac,_0x1e34('0x2a'));_0x32a5e9[_0x1e34('0x32')]=_[_0x1e34('0x33')](_0x20907a[_0x1e34('0x32')]);_0x32a5e9[_0x1e34('0x34')]=_[_0x1e34('0x35')](_0x32a5e9[_0x1e34('0x31')],_0x32a5e9[_0x1e34('0x32')]);_0x36f6ad[_0x1e34('0x36')]=_['intersection'](_0x32a5e9[_0x1e34('0x31')],qs[_0x1e34('0x37')](_0x20907a['query'][_0x1e34('0x37')]));_0x36f6ad[_0x1e34('0x36')]=_0x36f6ad[_0x1e34('0x36')][_0x1e34('0x38')]?_0x36f6ad['attributes']:_0x32a5e9[_0x1e34('0x31')];if(!_0x20907a[_0x1e34('0x32')][_0x1e34('0x39')](_0x1e34('0x3a'))){_0x36f6ad[_0x1e34('0x1f')]=qs[_0x1e34('0x1f')](_0x20907a[_0x1e34('0x32')][_0x1e34('0x1f')]);_0x36f6ad[_0x1e34('0x1e')]=qs['offset'](_0x20907a['query']['offset']);}_0x36f6ad[_0x1e34('0x3b')]=qs[_0x1e34('0x3c')](_0x20907a[_0x1e34('0x32')][_0x1e34('0x3c')]);_0x36f6ad[_0x1e34('0x3d')]=qs['filters'](_['pick'](_0x20907a['query'],_0x32a5e9[_0x1e34('0x34')]),_0xeb62ac);if(_0x20907a[_0x1e34('0x32')][_0x1e34('0x3e')]){_0x36f6ad[_0x1e34('0x3d')]=_[_0x1e34('0x3f')](_0x36f6ad[_0x1e34('0x3d')],{'$or':_['map'](_0xeb62ac,function(_0x350938){if(_0x350938[_0x1e34('0x2f')]!=='VIRTUAL'){var _0x461907={};_0x461907[_0x350938['name']]={'$like':'%'+_0x20907a[_0x1e34('0x32')][_0x1e34('0x3e')]+'%'};return _0x461907;}})});}_0x36f6ad=_[_0x1e34('0x3f')]({},_0x36f6ad,_0x20907a['options']);var _0x255266={'where':_0x36f6ad[_0x1e34('0x3d')]};return db[_0x1e34('0x40')][_0x1e34('0x1d')](_0x255266)[_0x1e34('0x26')](function(_0x246546){_0x41561e[_0x1e34('0x1d')]=_0x246546;if(_0x20907a['query'][_0x1e34('0x41')]){_0x36f6ad[_0x1e34('0x42')]=[{'all':!![]}];}return db[_0x1e34('0x40')][_0x1e34('0x43')](_0x36f6ad);})[_0x1e34('0x26')](function(_0x578f1e){_0x41561e['rows']=_0x578f1e;return _0x41561e;})['then'](respondWithFilteredResult(_0x51ba69,_0x36f6ad))[_0x1e34('0x44')](handleError(_0x51ba69,null));};exports['show']=function(_0x425d4c,_0x51e55c){var _0x2698bc={'raw':!![],'where':{'id':_0x425d4c[_0x1e34('0x45')]['id']}},_0x166151={};_0x166151[_0x1e34('0x31')]=_[_0x1e34('0x33')](db[_0x1e34('0x40')][_0x1e34('0x2d')]);_0x166151['query']=_[_0x1e34('0x33')](_0x425d4c[_0x1e34('0x32')]);_0x166151[_0x1e34('0x34')]=_['intersection'](_0x166151['model'],_0x166151[_0x1e34('0x32')]);_0x2698bc[_0x1e34('0x36')]=_[_0x1e34('0x35')](_0x166151[_0x1e34('0x31')],qs[_0x1e34('0x37')](_0x425d4c[_0x1e34('0x32')]['fields']));_0x2698bc['attributes']=_0x2698bc['attributes']['length']?_0x2698bc['attributes']:_0x166151[_0x1e34('0x31')];if(_0x425d4c[_0x1e34('0x32')][_0x1e34('0x41')]){_0x2698bc[_0x1e34('0x42')]=[{'all':!![]}];}_0x2698bc=_['merge']({},_0x2698bc,_0x425d4c[_0x1e34('0x46')]);return db[_0x1e34('0x40')][_0x1e34('0x47')](_0x2698bc)[_0x1e34('0x26')](handleEntityNotFound(_0x51e55c,null))[_0x1e34('0x26')](respondWithResult(_0x51e55c,null))[_0x1e34('0x44')](handleError(_0x51e55c,null));};exports[_0x1e34('0x25')]=function(_0x469840,_0xd79bf8){if(_0x469840[_0x1e34('0x48')]['id']){delete _0x469840[_0x1e34('0x48')]['id'];}return db['CmHopperBlack'][_0x1e34('0x47')]({'where':{'id':_0x469840[_0x1e34('0x45')]['id']}})[_0x1e34('0x26')](handleEntityNotFound(_0xd79bf8,null))[_0x1e34('0x26')](saveUpdates(_0x469840[_0x1e34('0x48')],null))[_0x1e34('0x26')](respondWithResult(_0xd79bf8,null))[_0x1e34('0x44')](handleError(_0xd79bf8,null));};exports[_0x1e34('0x27')]=function(_0x4e3260,_0x9d2930){return db['CmHopperBlack']['find']({'where':{'id':_0x4e3260[_0x1e34('0x45')]['id']}})[_0x1e34('0x26')](handleEntityNotFound(_0x9d2930,null))[_0x1e34('0x26')](removeEntity(_0x9d2930,null))[_0x1e34('0x44')](handleError(_0x9d2930,null));};exports[_0x1e34('0x49')]=function(_0x40c363,_0x26aaa6){return db[_0x1e34('0x40')]['describe']()[_0x1e34('0x26')](respondWithResult(_0x26aaa6,null))[_0x1e34('0x44')](handleError(_0x26aaa6,null));}; \ No newline at end of file +var _0x0151=['status','end','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','send','index','CmHopperBlack','rawAttributes','type','key','model','map','name','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','keys','find','body','params','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x45e346,_0x2de6cf){var _0x2663db=function(_0x2f73f7){while(--_0x2f73f7){_0x45e346['push'](_0x45e346['shift']());}};_0x2663db(++_0x2de6cf);}(_0x0151,0x7d));var _0x1015=function(_0x1dc591,_0x22643a){_0x1dc591=_0x1dc591-0x0;var _0x2d107b=_0x0151[_0x1dc591];return _0x2d107b;};'use strict';var pdf=require(_0x1015('0x0'));var emlformat=require(_0x1015('0x1'));var rimraf=require(_0x1015('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1015('0x3'));var moment=require(_0x1015('0x4'));var BPromise=require(_0x1015('0x5'));var Mustache=require(_0x1015('0x6'));var util=require(_0x1015('0x7'));var path=require('path');var sox=require(_0x1015('0x8'));var csv=require('to-csv');var ejs=require(_0x1015('0x9'));var fs=require('fs');var _=require(_0x1015('0xa'));var squel=require(_0x1015('0xb'));var crypto=require(_0x1015('0xc'));var jsforce=require(_0x1015('0xd'));var deskjs=require(_0x1015('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1015('0xf'));var Papa=require(_0x1015('0x10'));var Redis=require(_0x1015('0x11'));var authService=require(_0x1015('0x12'));var qs=require(_0x1015('0x13'));var as=require(_0x1015('0x14'));var hardwareService=require(_0x1015('0x15'));var logger=require('../../config/logger')(_0x1015('0x16'));var utils=require(_0x1015('0x17'));var config=require(_0x1015('0x18'));var licenseUtil=require(_0x1015('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1caf43,_0x4a33fd){_0x4a33fd=_0x4a33fd||0xcc;return function(_0x50be47){if(_0x50be47){return _0x1caf43[_0x1015('0x1a')](_0x4a33fd);}return _0x1caf43[_0x1015('0x1b')](_0x4a33fd)[_0x1015('0x1c')]();};}function respondWithResult(_0x54d834,_0x4214fc){_0x4214fc=_0x4214fc||0xc8;return function(_0x2e1a4c){if(_0x2e1a4c){return _0x54d834['status'](_0x4214fc)['json'](_0x2e1a4c);}};}function respondWithFilteredResult(_0x144423,_0x3bf7a9){return function(_0x1e6c0e){if(_0x1e6c0e){var _0x18a827=_0x1e6c0e['count'],_0x18ecf6=_0x3bf7a9[_0x1015('0x1d')],_0x20c36d=_0x3bf7a9['offset']+_0x3bf7a9[_0x1015('0x1e')],_0x2aaa4;if(_0x20c36d>=_0x18a827){_0x20c36d=_0x18a827;_0x2aaa4=0xc8;}else{_0x2aaa4=0xce;}_0x144423['status'](_0x2aaa4);return _0x144423[_0x1015('0x1f')](_0x1015('0x20'),_0x18ecf6+'-'+_0x20c36d+'/'+_0x18a827)[_0x1015('0x21')](_0x1e6c0e);}return null;};}function patchUpdates(_0x59cdfa){return function(_0x2dba1e){try{jsonpatch[_0x1015('0x22')](_0x2dba1e,_0x59cdfa,!![]);}catch(_0x250ef0){return BPromise[_0x1015('0x23')](_0x250ef0);}return _0x2dba1e[_0x1015('0x24')]();};}function saveUpdates(_0x587da5,_0x22a732){return function(_0xc3c1b6){if(_0xc3c1b6){return _0xc3c1b6[_0x1015('0x25')](_0x587da5)[_0x1015('0x26')](function(_0x6ef420){return _0x6ef420;});}return null;};}function removeEntity(_0x172f2e,_0x3e7977){return function(_0x2e90c8){if(_0x2e90c8){return _0x2e90c8[_0x1015('0x27')]()[_0x1015('0x26')](function(){_0x172f2e[_0x1015('0x1b')](0xcc)[_0x1015('0x1c')]();});}};}function handleEntityNotFound(_0x5ccf6b,_0x3aa107){return function(_0x114c6e){if(!_0x114c6e){_0x5ccf6b[_0x1015('0x1a')](0x194);}return _0x114c6e;};}function handleError(_0x39da46,_0x2656b6){_0x2656b6=_0x2656b6||0x1f4;return function(_0x43e99b){logger[_0x1015('0x28')](_0x43e99b[_0x1015('0x29')]);if(_0x43e99b['name']){delete _0x43e99b['name'];}_0x39da46[_0x1015('0x1b')](_0x2656b6)[_0x1015('0x2a')](_0x43e99b);};}exports[_0x1015('0x2b')]=function(_0x4cfa63,_0x2e3d4f){var _0x130d6e={},_0x5b27f0={},_0x152c9c={'count':0x0,'rows':[]};var _0x2d756e=_['map'](db[_0x1015('0x2c')][_0x1015('0x2d')],function(_0x28bc52){return{'name':_0x28bc52['fieldName'],'type':_0x28bc52[_0x1015('0x2e')][_0x1015('0x2f')]};});_0x5b27f0[_0x1015('0x30')]=_[_0x1015('0x31')](_0x2d756e,_0x1015('0x32'));_0x5b27f0[_0x1015('0x33')]=_['keys'](_0x4cfa63['query']);_0x5b27f0[_0x1015('0x34')]=_['intersection'](_0x5b27f0[_0x1015('0x30')],_0x5b27f0['query']);_0x130d6e[_0x1015('0x35')]=_[_0x1015('0x36')](_0x5b27f0[_0x1015('0x30')],qs[_0x1015('0x37')](_0x4cfa63[_0x1015('0x33')]['fields']));_0x130d6e[_0x1015('0x35')]=_0x130d6e['attributes'][_0x1015('0x38')]?_0x130d6e[_0x1015('0x35')]:_0x5b27f0['model'];if(!_0x4cfa63[_0x1015('0x33')][_0x1015('0x39')](_0x1015('0x3a'))){_0x130d6e[_0x1015('0x1e')]=qs[_0x1015('0x1e')](_0x4cfa63[_0x1015('0x33')][_0x1015('0x1e')]);_0x130d6e['offset']=qs[_0x1015('0x1d')](_0x4cfa63['query'][_0x1015('0x1d')]);}_0x130d6e['order']=qs[_0x1015('0x3b')](_0x4cfa63[_0x1015('0x33')]['sort']);_0x130d6e['where']=qs['filters'](_['pick'](_0x4cfa63[_0x1015('0x33')],_0x5b27f0[_0x1015('0x34')]),_0x2d756e);if(_0x4cfa63[_0x1015('0x33')][_0x1015('0x3c')]){_0x130d6e[_0x1015('0x3d')]=_[_0x1015('0x3e')](_0x130d6e[_0x1015('0x3d')],{'$or':_['map'](_0x2d756e,function(_0x1a8048){if(_0x1a8048[_0x1015('0x2e')]!==_0x1015('0x3f')){var _0xcd16d7={};_0xcd16d7[_0x1a8048[_0x1015('0x32')]]={'$like':'%'+_0x4cfa63[_0x1015('0x33')]['filter']+'%'};return _0xcd16d7;}})});}_0x130d6e=_['merge']({},_0x130d6e,_0x4cfa63[_0x1015('0x40')]);var _0x5d3bb9={'where':_0x130d6e[_0x1015('0x3d')]};return db[_0x1015('0x2c')]['count'](_0x5d3bb9)[_0x1015('0x26')](function(_0x46fb2d){_0x152c9c[_0x1015('0x41')]=_0x46fb2d;if(_0x4cfa63[_0x1015('0x33')][_0x1015('0x42')]){_0x130d6e[_0x1015('0x43')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x1015('0x44')](_0x130d6e);})[_0x1015('0x26')](function(_0x3a1b98){_0x152c9c['rows']=_0x3a1b98;return _0x152c9c;})[_0x1015('0x26')](respondWithFilteredResult(_0x2e3d4f,_0x130d6e))[_0x1015('0x45')](handleError(_0x2e3d4f,null));};exports[_0x1015('0x46')]=function(_0xc0a035,_0x59c8c9){var _0x35809f={'raw':!![],'where':{'id':_0xc0a035['params']['id']}},_0x308212={};_0x308212[_0x1015('0x30')]=_[_0x1015('0x47')](db[_0x1015('0x2c')][_0x1015('0x2d')]);_0x308212[_0x1015('0x33')]=_[_0x1015('0x47')](_0xc0a035[_0x1015('0x33')]);_0x308212['filters']=_[_0x1015('0x36')](_0x308212['model'],_0x308212['query']);_0x35809f['attributes']=_[_0x1015('0x36')](_0x308212[_0x1015('0x30')],qs[_0x1015('0x37')](_0xc0a035[_0x1015('0x33')][_0x1015('0x37')]));_0x35809f['attributes']=_0x35809f[_0x1015('0x35')][_0x1015('0x38')]?_0x35809f[_0x1015('0x35')]:_0x308212[_0x1015('0x30')];if(_0xc0a035[_0x1015('0x33')][_0x1015('0x42')]){_0x35809f[_0x1015('0x43')]=[{'all':!![]}];}_0x35809f=_[_0x1015('0x3e')]({},_0x35809f,_0xc0a035[_0x1015('0x40')]);return db[_0x1015('0x2c')][_0x1015('0x48')](_0x35809f)[_0x1015('0x26')](handleEntityNotFound(_0x59c8c9,null))[_0x1015('0x26')](respondWithResult(_0x59c8c9,null))[_0x1015('0x45')](handleError(_0x59c8c9,null));};exports['update']=function(_0x1b72c9,_0x313125){if(_0x1b72c9[_0x1015('0x49')]['id']){delete _0x1b72c9[_0x1015('0x49')]['id'];}return db[_0x1015('0x2c')][_0x1015('0x48')]({'where':{'id':_0x1b72c9[_0x1015('0x4a')]['id']}})[_0x1015('0x26')](handleEntityNotFound(_0x313125,null))['then'](saveUpdates(_0x1b72c9['body'],null))[_0x1015('0x26')](respondWithResult(_0x313125,null))[_0x1015('0x45')](handleError(_0x313125,null));};exports[_0x1015('0x27')]=function(_0x2acf01,_0x1af030){return db[_0x1015('0x2c')][_0x1015('0x48')]({'where':{'id':_0x2acf01['params']['id']}})['then'](handleEntityNotFound(_0x1af030,null))[_0x1015('0x26')](removeEntity(_0x1af030,null))[_0x1015('0x45')](handleError(_0x1af030,null));};exports[_0x1015('0x4b')]=function(_0x2c988e,_0x2672d1){return db[_0x1015('0x2c')][_0x1015('0x4b')]()[_0x1015('0x26')](respondWithResult(_0x2672d1,null))['catch'](handleError(_0x2672d1,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index e4ffc55..6698402 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 _0x4cd6=['path','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5dcb56,_0x3c31d7){var _0x45dcc9=function(_0x3313d1){while(--_0x3313d1){_0x5dcb56['push'](_0x5dcb56['shift']());}};_0x45dcc9(++_0x3c31d7);}(_0x4cd6,0xa3));var _0x64cd=function(_0x4ef88f,_0x5a3ccf){_0x4ef88f=_0x4ef88f-0x0;var _0x2547cc=_0x4cd6[_0x4ef88f];return _0x2547cc;};'use strict';var _=require(_0x64cd('0x0'));var util=require('util');var logger=require(_0x64cd('0x1'))(_0x64cd('0x2'));var moment=require(_0x64cd('0x3'));var BPromise=require(_0x64cd('0x4'));var rp=require(_0x64cd('0x5'));var fs=require('fs');var path=require(_0x64cd('0x6'));var rimraf=require(_0x64cd('0x7'));var config=require('../../config/environment');var attributes=require(_0x64cd('0x8'));module[_0x64cd('0x9')]=function(_0x37ca02,_0x33e106){return _0x37ca02[_0x64cd('0xa')](_0x64cd('0xb'),attributes,{'tableName':_0x64cd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf919=['../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x1a14ef,_0x2000f1){var _0x498e06=function(_0x40f68c){while(--_0x40f68c){_0x1a14ef['push'](_0x1a14ef['shift']());}};_0x498e06(++_0x2000f1);}(_0xf919,0x164));var _0x9f91=function(_0x58d5ac,_0x11c4bc){_0x58d5ac=_0x58d5ac-0x0;var _0x37985c=_0xf919[_0x58d5ac];return _0x37985c;};'use strict';var _=require(_0x9f91('0x0'));var util=require(_0x9f91('0x1'));var logger=require(_0x9f91('0x2'))(_0x9f91('0x3'));var moment=require('moment');var BPromise=require(_0x9f91('0x4'));var rp=require(_0x9f91('0x5'));var fs=require('fs');var path=require(_0x9f91('0x6'));var rimraf=require(_0x9f91('0x7'));var config=require(_0x9f91('0x8'));var attributes=require(_0x9f91('0x9'));module[_0x9f91('0xa')]=function(_0x4f0c83,_0x1cfd6a){return _0x4f0c83[_0x9f91('0xb')](_0x9f91('0xc'),attributes,{'tableName':_0x9f91('0xd'),'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 84f467e..11d314b 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 _0x93b2=['CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopperBlack','findAll','options','raw','where','attributes','include','map','model','then','GetCmHopperBlack','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x93b2,0x146));var _0x293b=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x93b2[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0x293b('0x0'));var util=require(_0x293b('0x1'));var moment=require(_0x293b('0x2'));var BPromise=require(_0x293b('0x3'));var rs=require(_0x293b('0x4'));var fs=require('fs');var Redis=require(_0x293b('0x5'));var db=require(_0x293b('0x6'))['db'];var utils=require(_0x293b('0x7'));var logger=require(_0x293b('0x8'))('rpc');var config=require(_0x293b('0x9'));var jayson=require(_0x293b('0xa'));var client=jayson['client'][_0x293b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbb07bc,_0x2ec759,_0x1bc318){return new BPromise(function(_0x527076,_0x3688a0){return client['request'](_0xbb07bc,_0x1bc318)['then'](function(_0x596a8b){logger[_0x293b('0xc')](_0x293b('0xd'),_0x2ec759,_0x293b('0xe'));logger[_0x293b('0xf')](_0x293b('0x10'),_0x2ec759,'request\x20sent',JSON[_0x293b('0x11')](_0x596a8b));if(_0x596a8b[_0x293b('0x12')]){if(_0x596a8b[_0x293b('0x12')][_0x293b('0x13')]===0x1f4){logger[_0x293b('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x2ec759,_0x596a8b[_0x293b('0x12')][_0x293b('0x14')]);return _0x3688a0(_0x596a8b[_0x293b('0x12')][_0x293b('0x14')]);}logger[_0x293b('0x12')](_0x293b('0xd'),_0x2ec759,_0x596a8b[_0x293b('0x12')]['message']);return _0x527076(_0x596a8b[_0x293b('0x12')][_0x293b('0x14')]);}else{logger[_0x293b('0xc')](_0x293b('0xd'),_0x2ec759,_0x293b('0xe'));_0x527076(_0x596a8b[_0x293b('0x15')][_0x293b('0x14')]);}})[_0x293b('0x16')](function(_0x272987){logger[_0x293b('0x12')](_0x293b('0xd'),_0x2ec759,_0x272987);_0x3688a0(_0x272987);});});}exports['GetCmHopperBlack']=function(_0x54bf27){var _0x118477=this;return new Promise(function(_0x6e7bb3,_0x20a7fa){return db[_0x293b('0x17')][_0x293b('0x18')]({'raw':_0x54bf27['options']?_0x54bf27[_0x293b('0x19')][_0x293b('0x1a')]===undefined?!![]:![]:!![],'where':_0x54bf27['options']?_0x54bf27[_0x293b('0x19')][_0x293b('0x1b')]||null:null,'attributes':_0x54bf27[_0x293b('0x19')]?_0x54bf27[_0x293b('0x19')][_0x293b('0x1c')]||null:null,'limit':_0x54bf27[_0x293b('0x19')]?_0x54bf27[_0x293b('0x19')]['limit']||null:null,'include':_0x54bf27[_0x293b('0x19')]?_0x54bf27['options'][_0x293b('0x1d')]?_[_0x293b('0x1e')](_0x54bf27['options'][_0x293b('0x1d')],function(_0x3519cb){return{'model':db[_0x3519cb['model']],'as':_0x3519cb['as'],'attributes':_0x3519cb[_0x293b('0x1c')],'include':_0x3519cb['include']?_[_0x293b('0x1e')](_0x3519cb[_0x293b('0x1d')],function(_0x24bd07){return{'model':db[_0x24bd07[_0x293b('0x1f')]],'as':_0x24bd07['as'],'attributes':_0x24bd07['attributes'],'include':_0x24bd07[_0x293b('0x1d')]?_['map'](_0x24bd07[_0x293b('0x1d')],function(_0x5f4673){return{'model':db[_0x5f4673[_0x293b('0x1f')]],'as':_0x5f4673['as'],'attributes':_0x5f4673[_0x293b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x293b('0x20')](function(_0x2abaa2){logger[_0x293b('0xc')](_0x293b('0x21'),_0x54bf27);logger[_0x293b('0xf')](_0x293b('0x21'),_0x54bf27,JSON[_0x293b('0x11')](_0x2abaa2));_0x6e7bb3(_0x2abaa2);})[_0x293b('0x16')](function(_0xf6070a){logger[_0x293b('0x12')](_0x293b('0x21'),_0xf6070a['message'],_0x54bf27);_0x20a7fa(_0x118477[_0x293b('0x12')](0x1f4,_0xf6070a['message']));});});};exports['UpdateCmHopperBlack']=function(_0x55e224){var _0x4f591f=this;return new Promise(function(_0x3b8c05,_0x52e11a){return db['CmHopperBlack']['update'](_0x55e224[_0x293b('0x22')],{'raw':_0x55e224[_0x293b('0x19')]?_0x55e224[_0x293b('0x19')][_0x293b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55e224['options']?_0x55e224[_0x293b('0x19')][_0x293b('0x1b')]||null:null,'attributes':_0x55e224[_0x293b('0x19')]?_0x55e224[_0x293b('0x19')]['attributes']||null:null,'limit':_0x55e224[_0x293b('0x19')]?_0x55e224[_0x293b('0x19')]['limit']||null:null})['then'](function(_0xedcf47){logger[_0x293b('0xc')]('UpdateCmHopperBlack',_0x55e224);logger['debug'](_0x293b('0x23'),_0x55e224,JSON[_0x293b('0x11')](_0xedcf47));_0x3b8c05(_0xedcf47);})[_0x293b('0x16')](function(_0x4ffa34){logger[_0x293b('0x12')](_0x293b('0x23'),_0x4ffa34[_0x293b('0x14')],_0x55e224);_0x52e11a(_0x4f591f[_0x293b('0x12')](0x1f4,_0x4ffa34[_0x293b('0x14')]));});});};exports[_0x293b('0x24')]=function(_0x258322){var _0x40f183=this;return new Promise(function(_0x19368d,_0x295607){return db[_0x293b('0x17')][_0x293b('0x25')]({'where':_0x258322['options']?_0x258322['options'][_0x293b('0x1b')]||null:null})[_0x293b('0x20')](function(_0x2d868){logger[_0x293b('0xc')](_0x293b('0x24'),_0x258322);logger[_0x293b('0xf')](_0x293b('0x24'),_0x258322,JSON[_0x293b('0x11')](_0x2d868));_0x19368d(_0x2d868);})[_0x293b('0x16')](function(_0x4f36ab){logger[_0x293b('0x12')](_0x293b('0x24'),_0x4f36ab[_0x293b('0x14')],_0x258322);_0x295607(_0x40f183[_0x293b('0x12')](0x1f4,_0x4f36ab[_0x293b('0x14')]));});});}; \ No newline at end of file +var _0x8c6f=['jayson/promise','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','raw','options','where','attributes','include','map','model','UpdateCmHopperBlack','body','limit','DestroyCmHopperBlack','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4eaf00,_0x220db0){var _0xb6dd31=function(_0x4f4d73){while(--_0x4f4d73){_0x4eaf00['push'](_0x4eaf00['shift']());}};_0xb6dd31(++_0x220db0);}(_0x8c6f,0xd5));var _0xf8c6=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x8c6f[_0x1deb03];return _0x189fe7;};'use strict';var _=require(_0xf8c6('0x0'));var util=require(_0xf8c6('0x1'));var moment=require('moment');var BPromise=require(_0xf8c6('0x2'));var rs=require(_0xf8c6('0x3'));var fs=require('fs');var Redis=require(_0xf8c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf8c6('0x5'));var logger=require(_0xf8c6('0x6'))(_0xf8c6('0x7'));var config=require(_0xf8c6('0x8'));var jayson=require(_0xf8c6('0x9'));var client=jayson['client'][_0xf8c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a95eb,_0x8b52f1,_0x183577){return new BPromise(function(_0x3192e7,_0x571af5){return client[_0xf8c6('0xb')](_0x4a95eb,_0x183577)[_0xf8c6('0xc')](function(_0x17a199){logger['info'](_0xf8c6('0xd'),_0x8b52f1,_0xf8c6('0xe'));logger[_0xf8c6('0xf')](_0xf8c6('0x10'),_0x8b52f1,_0xf8c6('0xe'),JSON[_0xf8c6('0x11')](_0x17a199));if(_0x17a199[_0xf8c6('0x12')]){if(_0x17a199[_0xf8c6('0x12')][_0xf8c6('0x13')]===0x1f4){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x8b52f1,_0x17a199[_0xf8c6('0x12')][_0xf8c6('0x14')]);return _0x571af5(_0x17a199[_0xf8c6('0x12')]['message']);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x8b52f1,_0x17a199[_0xf8c6('0x12')][_0xf8c6('0x14')]);return _0x3192e7(_0x17a199[_0xf8c6('0x12')][_0xf8c6('0x14')]);}else{logger[_0xf8c6('0x15')](_0xf8c6('0xd'),_0x8b52f1,'request\x20sent');_0x3192e7(_0x17a199[_0xf8c6('0x16')][_0xf8c6('0x14')]);}})[_0xf8c6('0x17')](function(_0x40f577){logger['error'](_0xf8c6('0xd'),_0x8b52f1,_0x40f577);_0x571af5(_0x40f577);});});}exports[_0xf8c6('0x18')]=function(_0x5c0ff1){var _0x4a7e20=this;return new Promise(function(_0x4c68e6,_0x4938de){return db[_0xf8c6('0x19')]['findAll']({'raw':_0x5c0ff1['options']?_0x5c0ff1['options'][_0xf8c6('0x1a')]===undefined?!![]:![]:!![],'where':_0x5c0ff1[_0xf8c6('0x1b')]?_0x5c0ff1[_0xf8c6('0x1b')][_0xf8c6('0x1c')]||null:null,'attributes':_0x5c0ff1[_0xf8c6('0x1b')]?_0x5c0ff1[_0xf8c6('0x1b')][_0xf8c6('0x1d')]||null:null,'limit':_0x5c0ff1[_0xf8c6('0x1b')]?_0x5c0ff1['options']['limit']||null:null,'include':_0x5c0ff1['options']?_0x5c0ff1[_0xf8c6('0x1b')][_0xf8c6('0x1e')]?_['map'](_0x5c0ff1[_0xf8c6('0x1b')][_0xf8c6('0x1e')],function(_0x52afec){return{'model':db[_0x52afec['model']],'as':_0x52afec['as'],'attributes':_0x52afec['attributes'],'include':_0x52afec['include']?_[_0xf8c6('0x1f')](_0x52afec[_0xf8c6('0x1e')],function(_0x584922){return{'model':db[_0x584922[_0xf8c6('0x20')]],'as':_0x584922['as'],'attributes':_0x584922[_0xf8c6('0x1d')],'include':_0x584922[_0xf8c6('0x1e')]?_['map'](_0x584922[_0xf8c6('0x1e')],function(_0x4b7e59){return{'model':db[_0x4b7e59[_0xf8c6('0x20')]],'as':_0x4b7e59['as'],'attributes':_0x4b7e59[_0xf8c6('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a7ec8){logger[_0xf8c6('0x15')](_0xf8c6('0x18'),_0x5c0ff1);logger[_0xf8c6('0xf')](_0xf8c6('0x18'),_0x5c0ff1,JSON[_0xf8c6('0x11')](_0x5a7ec8));_0x4c68e6(_0x5a7ec8);})[_0xf8c6('0x17')](function(_0x33af9f){logger[_0xf8c6('0x12')](_0xf8c6('0x18'),_0x33af9f['message'],_0x5c0ff1);_0x4938de(_0x4a7e20[_0xf8c6('0x12')](0x1f4,_0x33af9f[_0xf8c6('0x14')]));});});};exports[_0xf8c6('0x21')]=function(_0x43680e){var _0x4d2c56=this;return new Promise(function(_0x94974d,_0x367673){return db['CmHopperBlack']['update'](_0x43680e[_0xf8c6('0x22')],{'raw':_0x43680e[_0xf8c6('0x1b')]?_0x43680e[_0xf8c6('0x1b')][_0xf8c6('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43680e[_0xf8c6('0x1b')]?_0x43680e['options'][_0xf8c6('0x1c')]||null:null,'attributes':_0x43680e[_0xf8c6('0x1b')]?_0x43680e[_0xf8c6('0x1b')][_0xf8c6('0x1d')]||null:null,'limit':_0x43680e[_0xf8c6('0x1b')]?_0x43680e[_0xf8c6('0x1b')][_0xf8c6('0x23')]||null:null})['then'](function(_0x39952b){logger[_0xf8c6('0x15')](_0xf8c6('0x21'),_0x43680e);logger[_0xf8c6('0xf')](_0xf8c6('0x21'),_0x43680e,JSON[_0xf8c6('0x11')](_0x39952b));_0x94974d(_0x39952b);})['catch'](function(_0xc93a5){logger[_0xf8c6('0x12')](_0xf8c6('0x21'),_0xc93a5['message'],_0x43680e);_0x367673(_0x4d2c56[_0xf8c6('0x12')](0x1f4,_0xc93a5[_0xf8c6('0x14')]));});});};exports['DestroyCmHopperBlack']=function(_0x4bf015){var _0x12a593=this;return new Promise(function(_0x477b54,_0x396921){return db[_0xf8c6('0x19')]['destroy']({'where':_0x4bf015[_0xf8c6('0x1b')]?_0x4bf015[_0xf8c6('0x1b')]['where']||null:null})[_0xf8c6('0xc')](function(_0x444025){logger[_0xf8c6('0x15')](_0xf8c6('0x24'),_0x4bf015);logger[_0xf8c6('0xf')]('DestroyCmHopperBlack',_0x4bf015,JSON['stringify'](_0x444025));_0x477b54(_0x444025);})[_0xf8c6('0x17')](function(_0x7db090){logger[_0xf8c6('0x12')](_0xf8c6('0x24'),_0x7db090[_0xf8c6('0x14')],_0x4bf015);_0x396921(_0x12a593[_0xf8c6('0x12')](0x1f4,_0x7db090['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index af03fd6..1648f7c 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 _0x2d17=['update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cmHopperBlack.controller','isAuthenticated','get','/describe','describe','/:id','show','put'];(function(_0x580ef7,_0x35becd){var _0x669b8=function(_0x44aba6){while(--_0x44aba6){_0x580ef7['push'](_0x580ef7['shift']());}};_0x669b8(++_0x35becd);}(_0x2d17,0x17e));var _0x72d1=function(_0x5a13ab,_0x207e64){_0x5a13ab=_0x5a13ab-0x0;var _0x35bb0a=_0x2d17[_0x5a13ab];return _0x35bb0a;};'use strict';var multer=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var path=require('path');var timeout=require(_0x72d1('0x2'));var express=require(_0x72d1('0x3'));var router=express['Router']();var auth=require(_0x72d1('0x4'));var interaction=require(_0x72d1('0x5'));var config=require('../../config/environment');var controller=require(_0x72d1('0x6'));router['get']('/',auth[_0x72d1('0x7')](),controller['index']);router[_0x72d1('0x8')](_0x72d1('0x9'),auth['isAuthenticated'](),controller[_0x72d1('0xa')]);router[_0x72d1('0x8')](_0x72d1('0xb'),auth['isAuthenticated'](),controller[_0x72d1('0xc')]);router[_0x72d1('0xd')](_0x72d1('0xb'),auth['isAuthenticated'](),controller[_0x72d1('0xe')]);router[_0x72d1('0xf')](_0x72d1('0xb'),auth[_0x72d1('0x7')](),controller[_0x72d1('0x10')]);module[_0x72d1('0x11')]=router; \ No newline at end of file +var _0x9957=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./cmHopperBlack.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['describe']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')](_0x7995('0xc'),auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);module[_0x7995('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 0ab46f8..4f062f1 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 _0x3827=['BOOLEAN','sequelize','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','seconds','dispositionat'];(function(_0x745136,_0x54641a){var _0x299399=function(_0x24ea2e){while(--_0x24ea2e){_0x745136['push'](_0x745136['shift']());}};_0x299399(++_0x54641a);}(_0x3827,0x1c4));var _0x7382=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x3827[_0x9cd4c3];return _0x4c9025;};'use strict';var Sequelize=require(_0x7382('0x0'));var moment=require('moment');module['exports']={'state':{'type':Sequelize[_0x7382('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x7382('0x2')]},'scheduledat':{'type':Sequelize[_0x7382('0x3')]},'countbusyretry':{'type':Sequelize[_0x7382('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7382('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x7382('0x2')]},'originatecalleridname':{'type':Sequelize[_0x7382('0x2')]},'calleridnum':{'type':Sequelize[_0x7382('0x2')]},'calleridname':{'type':Sequelize[_0x7382('0x2')]},'starttime':{'type':Sequelize[_0x7382('0x3')]},'responsetime':{'type':Sequelize[_0x7382('0x3')]},'answertime':{'type':Sequelize[_0x7382('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x7382('0x3')]},'ringtime':{'type':Sequelize[_0x7382('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7382('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x7382('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7382('0x2')]},'campaign':{'type':Sequelize[_0x7382('0x2')]},'campaigntype':{'type':Sequelize[_0x7382('0x2')]},'membername':{'type':Sequelize[_0x7382('0x2')]},'reason':{'type':Sequelize[_0x7382('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x7382('0x2')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x271d4b){var _0x16f53d=this[_0x7382('0x4')](_0x7382('0x5'));if(_0x16f53d&&_0x271d4b){this[_0x7382('0x6')](_0x7382('0x7'),moment(_0x271d4b)['diff'](moment(_0x16f53d),_0x7382('0x8')));}return this['setDataValue'](_0x7382('0x9'),_0x271d4b);}},'amd':{'type':Sequelize[_0x7382('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x7382('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x7382('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x7382('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x7382('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7382('0x3')]},'deleted':{'type':Sequelize[_0x7382('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x7382('0x3')]},'recallme':{'type':Sequelize[_0x7382('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x7382('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7382('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7382('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x99d6=['seconds','dispositionat','BOOLEAN','sequelize','STRING','DATE','INTEGER','getDataValue','setDataValue','diff'];(function(_0x527f53,_0x26ee13){var _0x3373ad=function(_0x8b5e6){while(--_0x8b5e6){_0x527f53['push'](_0x527f53['shift']());}};_0x3373ad(++_0x26ee13);}(_0x99d6,0x193));var _0x699d=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x99d6[_0x2df507];return _0x1f7167;};'use strict';var Sequelize=require(_0x699d('0x0'));var moment=require('moment');module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x699d('0x1')]},'scheduledat':{'type':Sequelize[_0x699d('0x2')]},'countbusyretry':{'type':Sequelize[_0x699d('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x699d('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x699d('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x699d('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x699d('0x1')]},'originatecalleridnum':{'type':Sequelize[_0x699d('0x1')]},'originatecalleridname':{'type':Sequelize[_0x699d('0x1')]},'calleridnum':{'type':Sequelize[_0x699d('0x1')]},'calleridname':{'type':Sequelize[_0x699d('0x1')]},'starttime':{'type':Sequelize[_0x699d('0x2')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x699d('0x2')]},'endtime':{'type':Sequelize[_0x699d('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x699d('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x699d('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x699d('0x1')]},'campaign':{'type':Sequelize[_0x699d('0x1')]},'campaigntype':{'type':Sequelize[_0x699d('0x1')]},'membername':{'type':Sequelize[_0x699d('0x1')]},'reason':{'type':Sequelize[_0x699d('0x1')]},'disposition':{'type':Sequelize[_0x699d('0x1')]},'secondDisposition':{'type':Sequelize[_0x699d('0x1')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x699d('0x2')],'set':function(_0x356aa8){var _0x247c6e=this[_0x699d('0x4')]('endtime');if(_0x247c6e&&_0x356aa8){this[_0x699d('0x5')]('followuptime',moment(_0x356aa8)[_0x699d('0x6')](moment(_0x247c6e),_0x699d('0x7')));}return this['setDataValue'](_0x699d('0x8'),_0x356aa8);}},'amd':{'type':Sequelize[_0x699d('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x699d('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x699d('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x699d('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x699d('0x2')]},'callback':{'type':Sequelize[_0x699d('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x699d('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x699d('0x1')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x699d('0x2')]},'recallme':{'type':Sequelize[_0x699d('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x699d('0x2')]},'countnosuchnumberretry':{'type':Sequelize[_0x699d('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x699d('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x699d('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x699d('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 9c40a32..49eb900 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 _0x9335=['countContactsIvrCampaignHopperFinal','noAnswerContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','find','insert','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','phone','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','group','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','count','offset','set','json','reject','save','update','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','length','hasOwnProperty','limit','where','filters','filter','merge','type','VIRTUAL','options','then','includeAll','include','catch','show','fields','describe','body','uniqueid','params','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','abandonedContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine'];(function(_0x3a07c1,_0x34d57f){var _0x2bbe15=function(_0x5a02fb){while(--_0x5a02fb){_0x3a07c1['push'](_0x3a07c1['shift']());}};_0x2bbe15(++_0x34d57f);}(_0x9335,0xab));var _0x5933=function(_0x230c7b,_0x482487){_0x230c7b=_0x230c7b-0x0;var _0x41eabb=_0x9335[_0x230c7b];return _0x41eabb;};'use strict';var pdf=require(_0x5933('0x0'));var emlformat=require(_0x5933('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5933('0x2'));var jsonpatch=require(_0x5933('0x3'));var rp=require(_0x5933('0x4'));var moment=require(_0x5933('0x5'));var BPromise=require(_0x5933('0x6'));var Mustache=require(_0x5933('0x7'));var util=require(_0x5933('0x8'));var path=require('path');var sox=require(_0x5933('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5933('0xa'));var squel=require(_0x5933('0xb'));var crypto=require(_0x5933('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5933('0xd'));var toCsv=require(_0x5933('0xe'));var querystring=require(_0x5933('0xf'));var Papa=require(_0x5933('0x10'));var Redis=require(_0x5933('0x11'));var authService=require(_0x5933('0x12'));var qs=require(_0x5933('0x13'));var as=require(_0x5933('0x14'));var hardwareService=require(_0x5933('0x15'));var logger=require(_0x5933('0x16'))(_0x5933('0x17'));var utils=require(_0x5933('0x18'));var config=require(_0x5933('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x5933('0x1a'))['db'];function respondWithStatusCode(_0x5af679,_0x8b6bad){_0x8b6bad=_0x8b6bad||0xcc;return function(_0x1b4428){if(_0x1b4428){return _0x5af679[_0x5933('0x1b')](_0x8b6bad);}return _0x5af679['status'](_0x8b6bad)[_0x5933('0x1c')]();};}function respondWithResult(_0x542448,_0x1ab3d0){_0x1ab3d0=_0x1ab3d0||0xc8;return function(_0x4fc51d){if(_0x4fc51d){return _0x542448[_0x5933('0x1d')](_0x1ab3d0)['json'](_0x4fc51d);}};}function respondWithFilteredResult(_0xf6321f,_0x5e91da){return function(_0x404555){if(_0x404555){var _0x34c035=_0x404555[_0x5933('0x1e')],_0x236c9a=_0x5e91da[_0x5933('0x1f')],_0x556270=_0x5e91da[_0x5933('0x1f')]+_0x5e91da['limit'],_0x48dc5b;if(_0x556270>=_0x34c035){_0x556270=_0x34c035;_0x48dc5b=0xc8;}else{_0x48dc5b=0xce;}_0xf6321f['status'](_0x48dc5b);return _0xf6321f[_0x5933('0x20')]('Content-Range',_0x236c9a+'-'+_0x556270+'/'+_0x34c035)[_0x5933('0x21')](_0x404555);}return null;};}function patchUpdates(_0x41946a){return function(_0x21b1d7){try{jsonpatch['apply'](_0x21b1d7,_0x41946a,!![]);}catch(_0x41acb9){return BPromise[_0x5933('0x22')](_0x41acb9);}return _0x21b1d7[_0x5933('0x23')]();};}function saveUpdates(_0x4d661c,_0x59a2cd){return function(_0x49c67f){if(_0x49c67f){return _0x49c67f[_0x5933('0x24')](_0x4d661c)['then'](function(_0x1343b4){return _0x1343b4;});}return null;};}function removeEntity(_0x4a5252,_0x2d0fb7){return function(_0x50026f){if(_0x50026f){return _0x50026f['destroy']()['then'](function(){_0x4a5252['status'](0xcc)[_0x5933('0x1c')]();});}};}function handleEntityNotFound(_0x5639c7,_0x1a2f5d){return function(_0x544f23){if(!_0x544f23){_0x5639c7['sendStatus'](0x194);}return _0x544f23;};}function handleError(_0x457894,_0x3c605b){_0x3c605b=_0x3c605b||0x1f4;return function(_0x297b15){logger['error'](_0x297b15[_0x5933('0x25')]);if(_0x297b15[_0x5933('0x26')]){delete _0x297b15[_0x5933('0x26')];}_0x457894['status'](_0x3c605b)[_0x5933('0x27')](_0x297b15);};}exports[_0x5933('0x28')]=function(_0x49c49c,_0x107d87){var _0x148020={},_0x5bbeea={},_0x253ff1={'count':0x0,'rows':[]};var _0x4bc02e=_[_0x5933('0x29')](db[_0x5933('0x2a')][_0x5933('0x2b')],function(_0x4adb80){return{'name':_0x4adb80[_0x5933('0x2c')],'type':_0x4adb80['type'][_0x5933('0x2d')]};});_0x5bbeea[_0x5933('0x2e')]=_['map'](_0x4bc02e,'name');_0x5bbeea['query']=_[_0x5933('0x2f')](_0x49c49c[_0x5933('0x30')]);_0x5bbeea['filters']=_[_0x5933('0x31')](_0x5bbeea[_0x5933('0x2e')],_0x5bbeea[_0x5933('0x30')]);_0x148020[_0x5933('0x32')]=_['intersection'](_0x5bbeea[_0x5933('0x2e')],qs['fields'](_0x49c49c[_0x5933('0x30')]['fields']));_0x148020[_0x5933('0x32')]=_0x148020[_0x5933('0x32')][_0x5933('0x33')]?_0x148020[_0x5933('0x32')]:_0x5bbeea['model'];if(!_0x49c49c[_0x5933('0x30')][_0x5933('0x34')]('nolimit')){_0x148020['limit']=qs[_0x5933('0x35')](_0x49c49c['query']['limit']);_0x148020[_0x5933('0x1f')]=qs[_0x5933('0x1f')](_0x49c49c[_0x5933('0x30')][_0x5933('0x1f')]);}_0x148020['order']=qs['sort'](_0x49c49c['query']['sort']);_0x148020[_0x5933('0x36')]=qs['filters'](_['pick'](_0x49c49c['query'],_0x5bbeea[_0x5933('0x37')]),_0x4bc02e);if(_0x49c49c[_0x5933('0x30')][_0x5933('0x38')]){_0x148020[_0x5933('0x36')]=_[_0x5933('0x39')](_0x148020[_0x5933('0x36')],{'$or':_[_0x5933('0x29')](_0x4bc02e,function(_0xbd088d){if(_0xbd088d[_0x5933('0x3a')]!==_0x5933('0x3b')){var _0x5374d9={};_0x5374d9[_0xbd088d[_0x5933('0x26')]]={'$like':'%'+_0x49c49c[_0x5933('0x30')][_0x5933('0x38')]+'%'};return _0x5374d9;}})});}_0x148020=_[_0x5933('0x39')]({},_0x148020,_0x49c49c[_0x5933('0x3c')]);var _0x2c1484={'where':_0x148020[_0x5933('0x36')]};return db[_0x5933('0x2a')][_0x5933('0x1e')](_0x2c1484)[_0x5933('0x3d')](function(_0x51e82b){_0x253ff1['count']=_0x51e82b;if(_0x49c49c[_0x5933('0x30')][_0x5933('0x3e')]){_0x148020[_0x5933('0x3f')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x148020);})[_0x5933('0x3d')](function(_0x162865){_0x253ff1['rows']=_0x162865;return _0x253ff1;})[_0x5933('0x3d')](respondWithFilteredResult(_0x107d87,_0x148020))[_0x5933('0x40')](handleError(_0x107d87,null));};exports[_0x5933('0x41')]=function(_0x107f4f,_0x192576){var _0x1f1d56={'raw':!![],'where':{'id':_0x107f4f['params']['id']}},_0x5721fb={};_0x5721fb[_0x5933('0x2e')]=_[_0x5933('0x2f')](db[_0x5933('0x2a')][_0x5933('0x2b')]);_0x5721fb[_0x5933('0x30')]=_[_0x5933('0x2f')](_0x107f4f['query']);_0x5721fb[_0x5933('0x37')]=_[_0x5933('0x31')](_0x5721fb[_0x5933('0x2e')],_0x5721fb['query']);_0x1f1d56[_0x5933('0x32')]=_[_0x5933('0x31')](_0x5721fb[_0x5933('0x2e')],qs[_0x5933('0x42')](_0x107f4f[_0x5933('0x30')][_0x5933('0x42')]));_0x1f1d56[_0x5933('0x32')]=_0x1f1d56[_0x5933('0x32')][_0x5933('0x33')]?_0x1f1d56[_0x5933('0x32')]:_0x5721fb['model'];if(_0x107f4f[_0x5933('0x30')]['includeAll']){_0x1f1d56['include']=[{'all':!![]}];}_0x1f1d56=_['merge']({},_0x1f1d56,_0x107f4f[_0x5933('0x3c')]);return db['CmHopperFinal']['find'](_0x1f1d56)[_0x5933('0x3d')](handleEntityNotFound(_0x192576,null))[_0x5933('0x3d')](respondWithResult(_0x192576,null))['catch'](handleError(_0x192576,null));};exports[_0x5933('0x43')]=function(_0x54a77f,_0x2559e9){return db[_0x5933('0x2a')]['describe']()['then'](respondWithResult(_0x2559e9,null))[_0x5933('0x40')](handleError(_0x2559e9,null));};exports[_0x5933('0x24')]=function(_0x38e713,_0x10148d){if(_0x38e713[_0x5933('0x44')]['uniqueid']){delete _0x38e713[_0x5933('0x44')][_0x5933('0x45')];}return db[_0x5933('0x2a')]['find']({'where':{'uniqueid':_0x38e713[_0x5933('0x46')]['id']}})[_0x5933('0x3d')](handleEntityNotFound(_0x10148d,null))[_0x5933('0x3d')](saveUpdates(_0x38e713[_0x5933('0x44')],null))['then'](respondWithResult(_0x10148d,null))[_0x5933('0x40')](handleError(_0x10148d,null));};exports[_0x5933('0x47')]=function(_0x19fc7c,_0x36633b,_0x56a748){return db[_0x5933('0x2a')][_0x5933('0x48')]({'raw':![],'where':{'VoiceQueueId':_0x19fc7c[_0x5933('0x46')]['id']},'attributes':[[db[_0x5933('0x49')]['fn'](_0x5933('0x4a'),db[_0x5933('0x49')]['fn']('IF',db[_0x5933('0x49')][_0x5933('0x4b')](_0x5933('0x4c')))),_0x5933('0x4d')],[db['sequelize']['fn'](_0x5933('0x4a'),db['sequelize']['fn']('IF',db[_0x5933('0x49')]['literal'](_0x5933('0x4e')))),'noAnswerContacts'],[db[_0x5933('0x49')]['fn'](_0x5933('0x4a'),db['sequelize']['fn']('IF',db[_0x5933('0x49')]['literal'](_0x5933('0x4f')))),_0x5933('0x50')],[db[_0x5933('0x49')]['fn'](_0x5933('0x4a'),db[_0x5933('0x49')]['fn']('IF',db[_0x5933('0x49')]['literal'](_0x5933('0x51')))),_0x5933('0x52')],[db[_0x5933('0x49')]['fn']('COUNT',db[_0x5933('0x49')]['fn']('IF',db['sequelize'][_0x5933('0x4b')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5933('0x53')],[db[_0x5933('0x49')]['fn'](_0x5933('0x4a'),db[_0x5933('0x49')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x5933('0x54')],[db[_0x5933('0x49')]['fn'](_0x5933('0x4a'),db[_0x5933('0x49')]['fn']('IF',db[_0x5933('0x49')][_0x5933('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x5933('0x49')]['fn'](_0x5933('0x4a'),db[_0x5933('0x49')]['fn']('IF',db['sequelize'][_0x5933('0x4b')](_0x5933('0x55')))),_0x5933('0x56')]]})[_0x5933('0x3d')](handleEntityNotFound(_0x36633b,null))[_0x5933('0x3d')](respondWithResult(_0x36633b,null))[_0x5933('0x40')](handleError(_0x36633b,null));};exports[_0x5933('0x57')]=function(_0x377d24,_0x67a14a,_0xb53ee6){return db[_0x5933('0x2a')][_0x5933('0x48')]({'raw':![],'where':{'CampaignId':_0x377d24[_0x5933('0x46')]['id']},'attributes':[[db['sequelize']['fn'](_0x5933('0x4a'),db[_0x5933('0x49')]['fn']('IF',db[_0x5933('0x49')][_0x5933('0x4b')](_0x5933('0x4c')))),_0x5933('0x4d')],[db[_0x5933('0x49')]['fn'](_0x5933('0x4a'),db[_0x5933('0x49')]['fn']('IF',db[_0x5933('0x49')][_0x5933('0x4b')](_0x5933('0x4e')))),_0x5933('0x58')],[db[_0x5933('0x49')]['fn'](_0x5933('0x4a'),db[_0x5933('0x49')]['fn']('IF',db['sequelize']['literal'](_0x5933('0x4f')))),_0x5933('0x50')],[db[_0x5933('0x49')]['fn'](_0x5933('0x4a'),db[_0x5933('0x49')]['fn']('IF',db[_0x5933('0x49')][_0x5933('0x4b')](_0x5933('0x51')))),_0x5933('0x52')],[db['sequelize']['fn']('COUNT',db[_0x5933('0x49')]['fn']('IF',db['sequelize'][_0x5933('0x4b')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db[_0x5933('0x49')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5933('0x49')][_0x5933('0x4b')](_0x5933('0x59')))),_0x5933('0x54')],[db[_0x5933('0x49')]['fn']('COUNT',db[_0x5933('0x49')]['fn']('IF',db['sequelize'][_0x5933('0x4b')](_0x5933('0x5a')))),_0x5933('0x5b')],[db[_0x5933('0x49')]['fn'](_0x5933('0x4a'),db[_0x5933('0x49')]['fn']('IF',db[_0x5933('0x49')][_0x5933('0x4b')](_0x5933('0x55')))),_0x5933('0x56')]]})[_0x5933('0x3d')](handleEntityNotFound(_0x67a14a,null))[_0x5933('0x3d')](respondWithResult(_0x67a14a,null))['catch'](handleError(_0x67a14a,null));};exports[_0x5933('0x5c')]=function(_0x1a2f2b,_0x332aaa,_0x5f02cd){return db['VoiceQueue'][_0x5933('0x5d')]({'where':{'id':_0x1a2f2b[_0x5933('0x46')]['id']}})[_0x5933('0x3d')](handleEntityNotFound(_0x332aaa,null))[_0x5933('0x3d')](function(_0x14532e){var _0x3abf1e;if(_0x14532e){_0x3abf1e=squel[_0x5933('0x5e')]()['into'](_0x5933('0x5f'))[_0x5933('0x60')](['phone',_0x5933('0x61'),_0x5933('0x62'),_0x5933('0x63'),_0x5933('0x64'),_0x5933('0x65'),_0x5933('0x66')],squel[_0x5933('0x67')]()[_0x5933('0x68')](_0x5933('0x69'),'phone')['field']('NOW()','scheduledAt')[_0x5933('0x68')](_0x5933('0x6a'),'ContactId')['field'](_0x5933('0x6b'),'ListId')[_0x5933('0x68')](_0x5933('0x6c'),_0x5933('0x64'))['field'](_0x5933('0x6d'),'createdAt')[_0x5933('0x68')](_0x5933('0x6d'),'updatedAt')[_0x5933('0x6e')](_0x5933('0x6f'))[_0x5933('0x36')](_0x5933('0x70'),_0x1a2f2b['params']['id'][_0x5933('0x71')]())[_0x5933('0x36')]('state\x20=\x20?',_0x1a2f2b[_0x5933('0x44')][_0x5933('0x72')]['toString']())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x5933('0x36')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5933('0x67')]()['field'](_0x5933('0x73'))[_0x5933('0x6e')](_0x5933('0x5f'))[_0x5933('0x36')]('VoiceQueueId\x20=\x20?',_0x1a2f2b[_0x5933('0x46')]['id'][_0x5933('0x71')]()))[_0x5933('0x36')](_0x5933('0x74'),squel[_0x5933('0x67')]()[_0x5933('0x68')]('calleridnum')[_0x5933('0x6e')]('cm_hopper_final')[_0x5933('0x36')](_0x5933('0x70'),_0x1a2f2b[_0x5933('0x46')]['id'][_0x5933('0x71')]())[_0x5933('0x36')](_0x5933('0x75')))['group'](_0x5933('0x62')))[_0x5933('0x71')]();return db[_0x5933('0x49')][_0x5933('0x30')](_0x3abf1e);}return[];})[_0x5933('0x3d')](respondWithResult(_0x332aaa,null))[_0x5933('0x40')](handleError(_0x332aaa,null));};exports[_0x5933('0x76')]=function(_0x1a8df9,_0x119ee8,_0x242b61){return db[_0x5933('0x77')][_0x5933('0x5d')]({'where':{'id':_0x1a8df9[_0x5933('0x46')]['id']}})[_0x5933('0x3d')](handleEntityNotFound(_0x119ee8,null))[_0x5933('0x3d')](function(_0x2419d7){var _0x22d503;if(_0x2419d7){_0x22d503=squel[_0x5933('0x5e')]()[_0x5933('0x78')]('cm_hopper')['fromQuery']([_0x5933('0x73'),_0x5933('0x61'),_0x5933('0x62'),_0x5933('0x63'),_0x5933('0x79'),_0x5933('0x65'),_0x5933('0x66')],squel[_0x5933('0x67')]()['field']('ANY_VALUE(calleridnum)','phone')['field'](_0x5933('0x6d'),_0x5933('0x61'))[_0x5933('0x68')](_0x5933('0x6a'),_0x5933('0x62'))[_0x5933('0x68')](_0x5933('0x6b'),_0x5933('0x63'))[_0x5933('0x68')](_0x5933('0x7a'),_0x5933('0x79'))[_0x5933('0x68')]('NOW()','createdAt')['field'](_0x5933('0x6d'),_0x5933('0x66'))[_0x5933('0x6e')](_0x5933('0x6f'))['where'](_0x5933('0x7b'),_0x1a8df9[_0x5933('0x46')]['id'][_0x5933('0x71')]())[_0x5933('0x36')](_0x5933('0x7c'),_0x1a8df9[_0x5933('0x44')][_0x5933('0x72')][_0x5933('0x71')]())[_0x5933('0x36')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x5933('0x36')](_0x5933('0x74'),squel[_0x5933('0x67')]()[_0x5933('0x68')](_0x5933('0x73'))[_0x5933('0x6e')]('cm_hopper')[_0x5933('0x36')]('CampaignId\x20=\x20?',_0x1a8df9[_0x5933('0x46')]['id'][_0x5933('0x71')]()))['where'](_0x5933('0x74'),squel[_0x5933('0x67')]()[_0x5933('0x68')]('calleridnum')['from'](_0x5933('0x6f'))[_0x5933('0x36')](_0x5933('0x7b'),_0x1a8df9['params']['id'][_0x5933('0x71')]())['where']('state\x20=\x204'))[_0x5933('0x7d')](_0x5933('0x62')))[_0x5933('0x71')]();return db[_0x5933('0x49')][_0x5933('0x30')](_0x22d503);}return[];})[_0x5933('0x3d')](respondWithResult(_0x119ee8,null))['catch'](handleError(_0x119ee8,null));};exports[_0x5933('0x7e')]=function(_0x3f00cd,_0xc4ea87,_0x168ef7){return db[_0x5933('0x7f')][_0x5933('0x80')]({'where':{'VoiceQueueId':_0x3f00cd[_0x5933('0x44')][_0x5933('0x64')],'CampaignId':_0x3f00cd['body'][_0x5933('0x79')],'ContactId':_0x3f00cd['body'][_0x5933('0x62')]}})[_0x5933('0x3d')](handleEntityNotFound(_0xc4ea87,null))[_0x5933('0x3d')](function(_0xf7c625){if(_0xf7c625){return _0xf7c625;}return null;})[_0x5933('0x3d')](respondWithResult(_0xc4ea87,null))[_0x5933('0x40')](handleError(_0xc4ea87,null));}; \ No newline at end of file +var _0x4fdb=['NOW()','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','phone','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','updatedAt','ANY_VALUE(calleridnum)','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','end','error','stack','send','CmHopperFinal','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','type','merge','options','includeAll','findAll','rows','show','params','include','find','describe','catch','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','abandonedContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','select','field','ANY_VALUE(VoiceQueueId)','VoiceQueueId'];(function(_0x4b4f37,_0x383068){var _0x4fd442=function(_0x5a060e){while(--_0x5a060e){_0x4b4f37['push'](_0x4b4f37['shift']());}};_0x4fd442(++_0x383068);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x1d26c8,_0x48abbe){_0x1d26c8=_0x1d26c8-0x0;var _0x4f545e=_0x4fdb[_0x1d26c8];return _0x4f545e;};'use strict';var pdf=require(_0xb4fd('0x0'));var emlformat=require(_0xb4fd('0x1'));var rimraf=require(_0xb4fd('0x2'));var zipdir=require(_0xb4fd('0x3'));var jsonpatch=require(_0xb4fd('0x4'));var rp=require(_0xb4fd('0x5'));var moment=require(_0xb4fd('0x6'));var BPromise=require(_0xb4fd('0x7'));var Mustache=require(_0xb4fd('0x8'));var util=require('util');var path=require(_0xb4fd('0x9'));var sox=require('sox');var csv=require(_0xb4fd('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb4fd('0xb'));var crypto=require(_0xb4fd('0xc'));var jsforce=require(_0xb4fd('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb4fd('0xe'));var Papa=require(_0xb4fd('0xf'));var Redis=require(_0xb4fd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb4fd('0x11'));var as=require(_0xb4fd('0x12'));var hardwareService=require(_0xb4fd('0x13'));var logger=require(_0xb4fd('0x14'))(_0xb4fd('0x15'));var utils=require('../../config/utils');var config=require(_0xb4fd('0x16'));var licenseUtil=require(_0xb4fd('0x17'));var db=require(_0xb4fd('0x18'))['db'];function respondWithStatusCode(_0x120c2e,_0x5ba7e1){_0x5ba7e1=_0x5ba7e1||0xcc;return function(_0x38173d){if(_0x38173d){return _0x120c2e[_0xb4fd('0x19')](_0x5ba7e1);}return _0x120c2e[_0xb4fd('0x1a')](_0x5ba7e1)['end']();};}function respondWithResult(_0x399756,_0x1234d7){_0x1234d7=_0x1234d7||0xc8;return function(_0xc35d8d){if(_0xc35d8d){return _0x399756[_0xb4fd('0x1a')](_0x1234d7)[_0xb4fd('0x1b')](_0xc35d8d);}};}function respondWithFilteredResult(_0x37801f,_0x3a0872){return function(_0x47e288){if(_0x47e288){var _0x2076d5=_0x47e288[_0xb4fd('0x1c')],_0x12401d=_0x3a0872[_0xb4fd('0x1d')],_0x2e92b5=_0x3a0872[_0xb4fd('0x1d')]+_0x3a0872[_0xb4fd('0x1e')],_0x2d4701;if(_0x2e92b5>=_0x2076d5){_0x2e92b5=_0x2076d5;_0x2d4701=0xc8;}else{_0x2d4701=0xce;}_0x37801f[_0xb4fd('0x1a')](_0x2d4701);return _0x37801f[_0xb4fd('0x1f')](_0xb4fd('0x20'),_0x12401d+'-'+_0x2e92b5+'/'+_0x2076d5)['json'](_0x47e288);}return null;};}function patchUpdates(_0x560eaf){return function(_0x504e80){try{jsonpatch['apply'](_0x504e80,_0x560eaf,!![]);}catch(_0x278726){return BPromise[_0xb4fd('0x21')](_0x278726);}return _0x504e80[_0xb4fd('0x22')]();};}function saveUpdates(_0x1392c4,_0x458133){return function(_0x2adfbd){if(_0x2adfbd){return _0x2adfbd[_0xb4fd('0x23')](_0x1392c4)['then'](function(_0x51ac94){return _0x51ac94;});}return null;};}function removeEntity(_0x216307,_0x25bb7d){return function(_0x157fc2){if(_0x157fc2){return _0x157fc2['destroy']()[_0xb4fd('0x24')](function(){_0x216307['status'](0xcc)[_0xb4fd('0x25')]();});}};}function handleEntityNotFound(_0x4f5032,_0x2a9c8c){return function(_0x2c2d8d){if(!_0x2c2d8d){_0x4f5032[_0xb4fd('0x19')](0x194);}return _0x2c2d8d;};}function handleError(_0x261eda,_0xc00019){_0xc00019=_0xc00019||0x1f4;return function(_0x456f35){logger[_0xb4fd('0x26')](_0x456f35[_0xb4fd('0x27')]);if(_0x456f35['name']){delete _0x456f35['name'];}_0x261eda['status'](_0xc00019)[_0xb4fd('0x28')](_0x456f35);};}exports['index']=function(_0x3617b2,_0x5e9d2b){var _0x5738c2={},_0x282fe4={},_0x7c5313={'count':0x0,'rows':[]};var _0xda5ea8=_['map'](db[_0xb4fd('0x29')][_0xb4fd('0x2a')],function(_0x68776){return{'name':_0x68776[_0xb4fd('0x2b')],'type':_0x68776['type'][_0xb4fd('0x2c')]};});_0x282fe4[_0xb4fd('0x2d')]=_['map'](_0xda5ea8,_0xb4fd('0x2e'));_0x282fe4[_0xb4fd('0x2f')]=_[_0xb4fd('0x30')](_0x3617b2['query']);_0x282fe4[_0xb4fd('0x31')]=_[_0xb4fd('0x32')](_0x282fe4[_0xb4fd('0x2d')],_0x282fe4['query']);_0x5738c2['attributes']=_['intersection'](_0x282fe4['model'],qs[_0xb4fd('0x33')](_0x3617b2[_0xb4fd('0x2f')][_0xb4fd('0x33')]));_0x5738c2[_0xb4fd('0x34')]=_0x5738c2[_0xb4fd('0x34')][_0xb4fd('0x35')]?_0x5738c2[_0xb4fd('0x34')]:_0x282fe4[_0xb4fd('0x2d')];if(!_0x3617b2[_0xb4fd('0x2f')][_0xb4fd('0x36')](_0xb4fd('0x37'))){_0x5738c2[_0xb4fd('0x1e')]=qs[_0xb4fd('0x1e')](_0x3617b2[_0xb4fd('0x2f')][_0xb4fd('0x1e')]);_0x5738c2[_0xb4fd('0x1d')]=qs[_0xb4fd('0x1d')](_0x3617b2[_0xb4fd('0x2f')]['offset']);}_0x5738c2['order']=qs[_0xb4fd('0x38')](_0x3617b2[_0xb4fd('0x2f')][_0xb4fd('0x38')]);_0x5738c2[_0xb4fd('0x39')]=qs[_0xb4fd('0x31')](_['pick'](_0x3617b2[_0xb4fd('0x2f')],_0x282fe4[_0xb4fd('0x31')]),_0xda5ea8);if(_0x3617b2[_0xb4fd('0x2f')][_0xb4fd('0x3a')]){_0x5738c2[_0xb4fd('0x39')]=_['merge'](_0x5738c2[_0xb4fd('0x39')],{'$or':_['map'](_0xda5ea8,function(_0xcda359){if(_0xcda359[_0xb4fd('0x3b')]!=='VIRTUAL'){var _0x54ebf2={};_0x54ebf2[_0xcda359[_0xb4fd('0x2e')]]={'$like':'%'+_0x3617b2[_0xb4fd('0x2f')][_0xb4fd('0x3a')]+'%'};return _0x54ebf2;}})});}_0x5738c2=_[_0xb4fd('0x3c')]({},_0x5738c2,_0x3617b2[_0xb4fd('0x3d')]);var _0x2718a0={'where':_0x5738c2['where']};return db[_0xb4fd('0x29')][_0xb4fd('0x1c')](_0x2718a0)['then'](function(_0x16d848){_0x7c5313[_0xb4fd('0x1c')]=_0x16d848;if(_0x3617b2[_0xb4fd('0x2f')][_0xb4fd('0x3e')]){_0x5738c2['include']=[{'all':!![]}];}return db[_0xb4fd('0x29')][_0xb4fd('0x3f')](_0x5738c2);})[_0xb4fd('0x24')](function(_0x2ab6bd){_0x7c5313[_0xb4fd('0x40')]=_0x2ab6bd;return _0x7c5313;})[_0xb4fd('0x24')](respondWithFilteredResult(_0x5e9d2b,_0x5738c2))['catch'](handleError(_0x5e9d2b,null));};exports[_0xb4fd('0x41')]=function(_0x2c042d,_0x5e11c0){var _0x2120fa={'raw':!![],'where':{'id':_0x2c042d[_0xb4fd('0x42')]['id']}},_0x24dab1={};_0x24dab1[_0xb4fd('0x2d')]=_[_0xb4fd('0x30')](db['CmHopperFinal'][_0xb4fd('0x2a')]);_0x24dab1[_0xb4fd('0x2f')]=_[_0xb4fd('0x30')](_0x2c042d['query']);_0x24dab1[_0xb4fd('0x31')]=_['intersection'](_0x24dab1[_0xb4fd('0x2d')],_0x24dab1[_0xb4fd('0x2f')]);_0x2120fa['attributes']=_[_0xb4fd('0x32')](_0x24dab1['model'],qs[_0xb4fd('0x33')](_0x2c042d[_0xb4fd('0x2f')][_0xb4fd('0x33')]));_0x2120fa['attributes']=_0x2120fa[_0xb4fd('0x34')][_0xb4fd('0x35')]?_0x2120fa[_0xb4fd('0x34')]:_0x24dab1[_0xb4fd('0x2d')];if(_0x2c042d[_0xb4fd('0x2f')][_0xb4fd('0x3e')]){_0x2120fa[_0xb4fd('0x43')]=[{'all':!![]}];}_0x2120fa=_['merge']({},_0x2120fa,_0x2c042d['options']);return db[_0xb4fd('0x29')][_0xb4fd('0x44')](_0x2120fa)[_0xb4fd('0x24')](handleEntityNotFound(_0x5e11c0,null))[_0xb4fd('0x24')](respondWithResult(_0x5e11c0,null))['catch'](handleError(_0x5e11c0,null));};exports[_0xb4fd('0x45')]=function(_0x548952,_0x4d5d04){return db[_0xb4fd('0x29')][_0xb4fd('0x45')]()['then'](respondWithResult(_0x4d5d04,null))[_0xb4fd('0x46')](handleError(_0x4d5d04,null));};exports[_0xb4fd('0x23')]=function(_0x4b7fa0,_0xea231f){if(_0x4b7fa0[_0xb4fd('0x47')][_0xb4fd('0x48')]){delete _0x4b7fa0['body']['uniqueid'];}return db[_0xb4fd('0x29')][_0xb4fd('0x44')]({'where':{'uniqueid':_0x4b7fa0[_0xb4fd('0x42')]['id']}})[_0xb4fd('0x24')](handleEntityNotFound(_0xea231f,null))['then'](saveUpdates(_0x4b7fa0[_0xb4fd('0x47')],null))[_0xb4fd('0x24')](respondWithResult(_0xea231f,null))['catch'](handleError(_0xea231f,null));};exports[_0xb4fd('0x49')]=function(_0x24c7d4,_0x38a530,_0x4bc6b2){return db[_0xb4fd('0x29')][_0xb4fd('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x24c7d4['params']['id']},'attributes':[[db[_0xb4fd('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb4fd('0x4a')][_0xb4fd('0x4b')](_0xb4fd('0x4c')))),_0xb4fd('0x4d')],[db[_0xb4fd('0x4a')]['fn'](_0xb4fd('0x4e'),db[_0xb4fd('0x4a')]['fn']('IF',db[_0xb4fd('0x4a')][_0xb4fd('0x4b')](_0xb4fd('0x4f')))),_0xb4fd('0x50')],[db[_0xb4fd('0x4a')]['fn'](_0xb4fd('0x4e'),db[_0xb4fd('0x4a')]['fn']('IF',db[_0xb4fd('0x4a')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0xb4fd('0x51')],[db[_0xb4fd('0x4a')]['fn'](_0xb4fd('0x4e'),db[_0xb4fd('0x4a')]['fn']('IF',db[_0xb4fd('0x4a')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xb4fd('0x52')],[db[_0xb4fd('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xb4fd('0x4b')](_0xb4fd('0x53')))),_0xb4fd('0x54')],[db[_0xb4fd('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xb4fd('0x4a')][_0xb4fd('0x4b')](_0xb4fd('0x55')))),'abandonedContacts'],[db[_0xb4fd('0x4a')]['fn'](_0xb4fd('0x4e'),db[_0xb4fd('0x4a')]['fn']('IF',db[_0xb4fd('0x4a')]['literal'](_0xb4fd('0x56')))),_0xb4fd('0x57')],[db['sequelize']['fn'](_0xb4fd('0x4e'),db['sequelize']['fn']('IF',db[_0xb4fd('0x4a')]['literal'](_0xb4fd('0x58')))),_0xb4fd('0x59')]]})[_0xb4fd('0x24')](handleEntityNotFound(_0x38a530,null))[_0xb4fd('0x24')](respondWithResult(_0x38a530,null))[_0xb4fd('0x46')](handleError(_0x38a530,null));};exports[_0xb4fd('0x5a')]=function(_0x2cef70,_0x303148,_0x7021cf){return db[_0xb4fd('0x29')][_0xb4fd('0x3f')]({'raw':![],'where':{'CampaignId':_0x2cef70[_0xb4fd('0x42')]['id']},'attributes':[[db[_0xb4fd('0x4a')]['fn'](_0xb4fd('0x4e'),db['sequelize']['fn']('IF',db[_0xb4fd('0x4a')]['literal'](_0xb4fd('0x4c')))),'noSuchContacts'],[db[_0xb4fd('0x4a')]['fn'](_0xb4fd('0x4e'),db[_0xb4fd('0x4a')]['fn']('IF',db[_0xb4fd('0x4a')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0xb4fd('0x50')],[db['sequelize']['fn'](_0xb4fd('0x4e'),db[_0xb4fd('0x4a')]['fn']('IF',db[_0xb4fd('0x4a')]['literal'](_0xb4fd('0x5b')))),'busyContacts'],[db[_0xb4fd('0x4a')]['fn'](_0xb4fd('0x4e'),db[_0xb4fd('0x4a')]['fn']('IF',db[_0xb4fd('0x4a')]['literal'](_0xb4fd('0x5c')))),'congestionContacts'],[db[_0xb4fd('0x4a')]['fn'](_0xb4fd('0x4e'),db[_0xb4fd('0x4a')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xb4fd('0x54')],[db['sequelize']['fn'](_0xb4fd('0x4e'),db['sequelize']['fn']('IF',db[_0xb4fd('0x4a')][_0xb4fd('0x4b')](_0xb4fd('0x55')))),_0xb4fd('0x5d')],[db['sequelize']['fn'](_0xb4fd('0x4e'),db[_0xb4fd('0x4a')]['fn']('IF',db[_0xb4fd('0x4a')][_0xb4fd('0x4b')](_0xb4fd('0x56')))),'reCallContacts'],[db[_0xb4fd('0x4a')]['fn'](_0xb4fd('0x4e'),db['sequelize']['fn']('IF',db[_0xb4fd('0x4a')][_0xb4fd('0x4b')](_0xb4fd('0x58')))),_0xb4fd('0x59')]]})[_0xb4fd('0x24')](handleEntityNotFound(_0x303148,null))[_0xb4fd('0x24')](respondWithResult(_0x303148,null))['catch'](handleError(_0x303148,null));};exports[_0xb4fd('0x5e')]=function(_0x2dc0f0,_0x2b93e3,_0xb0c444){return db[_0xb4fd('0x5f')][_0xb4fd('0x44')]({'where':{'id':_0x2dc0f0[_0xb4fd('0x42')]['id']}})[_0xb4fd('0x24')](handleEntityNotFound(_0x2b93e3,null))[_0xb4fd('0x24')](function(_0xce491e){var _0x3f9380;if(_0xce491e){_0x3f9380=squel[_0xb4fd('0x60')]()[_0xb4fd('0x61')](_0xb4fd('0x62'))[_0xb4fd('0x63')](['phone',_0xb4fd('0x64'),_0xb4fd('0x65'),_0xb4fd('0x66'),'VoiceQueueId',_0xb4fd('0x67'),'updatedAt'],squel[_0xb4fd('0x68')]()['field']('ANY_VALUE(calleridnum)','phone')[_0xb4fd('0x69')]('NOW()','scheduledAt')[_0xb4fd('0x69')]('ANY_VALUE(ContactId)','ContactId')[_0xb4fd('0x69')]('ANY_VALUE(ListId)',_0xb4fd('0x66'))[_0xb4fd('0x69')](_0xb4fd('0x6a'),_0xb4fd('0x6b'))[_0xb4fd('0x69')]('NOW()','createdAt')[_0xb4fd('0x69')](_0xb4fd('0x6c'),'updatedAt')[_0xb4fd('0x6d')](_0xb4fd('0x6e'))[_0xb4fd('0x39')](_0xb4fd('0x6f'),_0x2dc0f0['params']['id'][_0xb4fd('0x70')]())[_0xb4fd('0x39')](_0xb4fd('0x71'),_0x2dc0f0['body'][_0xb4fd('0x72')][_0xb4fd('0x70')]())['where'](_0xb4fd('0x73'))[_0xb4fd('0x39')](_0xb4fd('0x74'),squel[_0xb4fd('0x68')]()[_0xb4fd('0x69')](_0xb4fd('0x75'))[_0xb4fd('0x6d')](_0xb4fd('0x62'))[_0xb4fd('0x39')](_0xb4fd('0x6f'),_0x2dc0f0['params']['id'][_0xb4fd('0x70')]()))['where'](_0xb4fd('0x74'),squel[_0xb4fd('0x68')]()[_0xb4fd('0x69')](_0xb4fd('0x76'))[_0xb4fd('0x6d')](_0xb4fd('0x6e'))[_0xb4fd('0x39')](_0xb4fd('0x6f'),_0x2dc0f0[_0xb4fd('0x42')]['id'][_0xb4fd('0x70')]())[_0xb4fd('0x39')](_0xb4fd('0x77')))[_0xb4fd('0x78')](_0xb4fd('0x65')))['toString']();return db[_0xb4fd('0x4a')]['query'](_0x3f9380);}return[];})[_0xb4fd('0x24')](respondWithResult(_0x2b93e3,null))['catch'](handleError(_0x2b93e3,null));};exports[_0xb4fd('0x79')]=function(_0x5ba1b1,_0x409858,_0x57deab){return db[_0xb4fd('0x7a')][_0xb4fd('0x44')]({'where':{'id':_0x5ba1b1['params']['id']}})[_0xb4fd('0x24')](handleEntityNotFound(_0x409858,null))[_0xb4fd('0x24')](function(_0x4012e3){var _0x4586e3;if(_0x4012e3){_0x4586e3=squel[_0xb4fd('0x60')]()[_0xb4fd('0x61')](_0xb4fd('0x62'))[_0xb4fd('0x63')]([_0xb4fd('0x75'),_0xb4fd('0x64'),'ContactId',_0xb4fd('0x66'),_0xb4fd('0x7b'),_0xb4fd('0x67'),_0xb4fd('0x7c')],squel['select']()[_0xb4fd('0x69')](_0xb4fd('0x7d'),_0xb4fd('0x75'))['field']('NOW()','scheduledAt')['field'](_0xb4fd('0x7e'),_0xb4fd('0x65'))['field'](_0xb4fd('0x7f'),_0xb4fd('0x66'))[_0xb4fd('0x69')]('ANY_VALUE(CampaignId)',_0xb4fd('0x7b'))[_0xb4fd('0x69')](_0xb4fd('0x6c'),_0xb4fd('0x67'))[_0xb4fd('0x69')](_0xb4fd('0x6c'),'updatedAt')[_0xb4fd('0x6d')](_0xb4fd('0x6e'))[_0xb4fd('0x39')](_0xb4fd('0x80'),_0x5ba1b1['params']['id'][_0xb4fd('0x70')]())[_0xb4fd('0x39')](_0xb4fd('0x71'),_0x5ba1b1[_0xb4fd('0x47')][_0xb4fd('0x72')][_0xb4fd('0x70')]())[_0xb4fd('0x39')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xb4fd('0x39')](_0xb4fd('0x74'),squel[_0xb4fd('0x68')]()[_0xb4fd('0x69')](_0xb4fd('0x75'))[_0xb4fd('0x6d')](_0xb4fd('0x62'))[_0xb4fd('0x39')](_0xb4fd('0x80'),_0x5ba1b1['params']['id'][_0xb4fd('0x70')]()))[_0xb4fd('0x39')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xb4fd('0x68')]()['field'](_0xb4fd('0x76'))[_0xb4fd('0x6d')]('cm_hopper_final')[_0xb4fd('0x39')]('CampaignId\x20=\x20?',_0x5ba1b1['params']['id'][_0xb4fd('0x70')]())['where'](_0xb4fd('0x77')))[_0xb4fd('0x78')](_0xb4fd('0x65')))[_0xb4fd('0x70')]();return db[_0xb4fd('0x4a')][_0xb4fd('0x2f')](_0x4586e3);}return[];})[_0xb4fd('0x24')](respondWithResult(_0x409858,null))['catch'](handleError(_0x409858,null));};exports[_0xb4fd('0x81')]=function(_0x3a452d,_0x1dfdce,_0x4b9a61){return db[_0xb4fd('0x82')][_0xb4fd('0x83')]({'where':{'VoiceQueueId':_0x3a452d[_0xb4fd('0x47')][_0xb4fd('0x6b')],'CampaignId':_0x3a452d['body']['CampaignId'],'ContactId':_0x3a452d[_0xb4fd('0x47')]['ContactId']}})[_0xb4fd('0x24')](handleEntityNotFound(_0x1dfdce,null))[_0xb4fd('0x24')](function(_0x5ec92c){if(_0x5ec92c){return _0x5ec92c;}return null;})[_0xb4fd('0x24')](respondWithResult(_0x1dfdce,null))[_0xb4fd('0x46')](handleError(_0x1dfdce,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index dc7025a..7045f36 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 _0x1df2=['calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperFinal.attributes','define'];(function(_0x4569b0,_0x36617d){var _0x5d4b75=function(_0x5f1a94){while(--_0x5f1a94){_0x4569b0['push'](_0x4569b0['shift']());}};_0x5d4b75(++_0x36617d);}(_0x1df2,0x77));var _0x21df=function(_0x797987,_0x456665){_0x797987=_0x797987-0x0;var _0x4bf3bf=_0x1df2[_0x797987];return _0x4bf3bf;};'use strict';var _=require(_0x21df('0x0'));var util=require(_0x21df('0x1'));var logger=require(_0x21df('0x2'))(_0x21df('0x3'));var moment=require(_0x21df('0x4'));var BPromise=require(_0x21df('0x5'));var rp=require(_0x21df('0x6'));var fs=require('fs');var path=require(_0x21df('0x7'));var rimraf=require('rimraf');var config=require(_0x21df('0x8'));var attributes=require(_0x21df('0x9'));module['exports']=function(_0x150c87,_0x132ce5){return _0x150c87[_0x21df('0xa')]('CmHopperFinal',attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x21df('0xb'),'fields':[_0x21df('0xb')]},{'name':_0x21df('0xc'),'fields':[_0x21df('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x62ca=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','CmHopperFinal','calleridnum'];(function(_0x354ed2,_0xacb643){var _0x535329=function(_0x500deb){while(--_0x500deb){_0x354ed2['push'](_0x354ed2['shift']());}};_0x535329(++_0xacb643);}(_0x62ca,0xfd));var _0xa62c=function(_0x2fac00,_0x182456){_0x2fac00=_0x2fac00-0x0;var _0x10f666=_0x62ca[_0x2fac00];return _0x10f666;};'use strict';var _=require(_0xa62c('0x0'));var util=require(_0xa62c('0x1'));var logger=require(_0xa62c('0x2'))(_0xa62c('0x3'));var moment=require(_0xa62c('0x4'));var BPromise=require(_0xa62c('0x5'));var rp=require(_0xa62c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa62c('0x7'));var config=require(_0xa62c('0x8'));var attributes=require('./cmHopperFinal.attributes');module[_0xa62c('0x9')]=function(_0x3bc3c8,_0x2a59c3){return _0x3bc3c8[_0xa62c('0xa')](_0xa62c('0xb'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xa62c('0xc')]},{'name':_0xa62c('0xd'),'fields':[_0xa62c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index cd02820..cd2106d 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 _0x5f5b=['result','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x22d6e9,_0xb9e9cd){var _0x43d279=function(_0x42f569){while(--_0x42f569){_0x22d6e9['push'](_0x22d6e9['shift']());}};_0x43d279(++_0xb9e9cd);}(_0x5f5b,0x10c));var _0xb5f5=function(_0x3a05be,_0x4f912d){_0x3a05be=_0x3a05be-0x0;var _0x22f440=_0x5f5b[_0x3a05be];return _0x22f440;};'use strict';var _=require(_0xb5f5('0x0'));var util=require(_0xb5f5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb5f5('0x2'));var fs=require('fs');var Redis=require(_0xb5f5('0x3'));var db=require(_0xb5f5('0x4'))['db'];var utils=require(_0xb5f5('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb5f5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb5f5('0x7')][_0xb5f5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x592b11,_0x46bd7e,_0x5b8183){return new BPromise(function(_0x124dc9,_0x4b1caa){return client[_0xb5f5('0x9')](_0x592b11,_0x5b8183)['then'](function(_0x86919b){logger[_0xb5f5('0xa')](_0xb5f5('0xb'),_0x46bd7e,_0xb5f5('0xc'));logger[_0xb5f5('0xd')](_0xb5f5('0xe'),_0x46bd7e,_0xb5f5('0xc'),JSON['stringify'](_0x86919b));if(_0x86919b[_0xb5f5('0xf')]){if(_0x86919b[_0xb5f5('0xf')][_0xb5f5('0x10')]===0x1f4){logger[_0xb5f5('0xf')](_0xb5f5('0xb'),_0x46bd7e,_0x86919b[_0xb5f5('0xf')][_0xb5f5('0x11')]);return _0x4b1caa(_0x86919b['error'][_0xb5f5('0x11')]);}logger[_0xb5f5('0xf')](_0xb5f5('0xb'),_0x46bd7e,_0x86919b['error']['message']);return _0x124dc9(_0x86919b[_0xb5f5('0xf')]['message']);}else{logger[_0xb5f5('0xa')](_0xb5f5('0xb'),_0x46bd7e,_0xb5f5('0xc'));_0x124dc9(_0x86919b[_0xb5f5('0x12')][_0xb5f5('0x11')]);}})[_0xb5f5('0x13')](function(_0xdaa4d9){logger['error']('CmHopperFinal,\x20%s,\x20%s',_0x46bd7e,_0xdaa4d9);_0x4b1caa(_0xdaa4d9);});});}exports[_0xb5f5('0x14')]=function(_0x1e0d48){var _0x4c75ba=this;return new Promise(function(_0xebe293,_0x5d9d6d){return db[_0xb5f5('0x15')][_0xb5f5('0x16')](_0x1e0d48[_0xb5f5('0x17')],{'raw':_0x1e0d48[_0xb5f5('0x18')]?_0x1e0d48['options'][_0xb5f5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x41058b){logger[_0xb5f5('0xa')](_0xb5f5('0x14'),_0x1e0d48);logger[_0xb5f5('0xd')](_0xb5f5('0x14'),_0x1e0d48,JSON['stringify'](_0x41058b));_0xebe293(_0x41058b);})[_0xb5f5('0x13')](function(_0x5a0fe6){logger['error'](_0xb5f5('0x14'),_0x5a0fe6['message'],_0x1e0d48);_0x5d9d6d(_0x4c75ba[_0xb5f5('0xf')](0x1f4,_0x5a0fe6[_0xb5f5('0x11')]));});});}; \ No newline at end of file +var _0x258a=['result','CreateCmHopperFinal','options','stringify','catch','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperFinal,\x20%s,\x20%s','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x24a207,_0x2fb85e){var _0x5b3829=function(_0x1f6e3e){while(--_0x1f6e3e){_0x24a207['push'](_0x24a207['shift']());}};_0x5b3829(++_0x2fb85e);}(_0x258a,0x1cd));var _0xa258=function(_0x103b7a,_0x3814d3){_0x103b7a=_0x103b7a-0x0;var _0x311fb3=_0x258a[_0x103b7a];return _0x311fb3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa258('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa258('0x1'));var db=require(_0xa258('0x2'))['db'];var utils=require(_0xa258('0x3'));var logger=require(_0xa258('0x4'))(_0xa258('0x5'));var config=require(_0xa258('0x6'));var jayson=require(_0xa258('0x7'));var client=jayson[_0xa258('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x105426,_0x2f1f66,_0xe50bed){return new BPromise(function(_0xaecb98,_0x54764a){return client[_0xa258('0x9')](_0x105426,_0xe50bed)[_0xa258('0xa')](function(_0x1459ec){logger[_0xa258('0xb')](_0xa258('0xc'),_0x2f1f66,'request\x20sent');logger[_0xa258('0xd')](_0xa258('0xe'),_0x2f1f66,_0xa258('0xf'),JSON['stringify'](_0x1459ec));if(_0x1459ec[_0xa258('0x10')]){if(_0x1459ec[_0xa258('0x10')][_0xa258('0x11')]===0x1f4){logger[_0xa258('0x10')](_0xa258('0xc'),_0x2f1f66,_0x1459ec['error']['message']);return _0x54764a(_0x1459ec['error'][_0xa258('0x12')]);}logger['error'](_0xa258('0xc'),_0x2f1f66,_0x1459ec[_0xa258('0x10')][_0xa258('0x12')]);return _0xaecb98(_0x1459ec[_0xa258('0x10')][_0xa258('0x12')]);}else{logger[_0xa258('0xb')](_0xa258('0xc'),_0x2f1f66,_0xa258('0xf'));_0xaecb98(_0x1459ec[_0xa258('0x13')][_0xa258('0x12')]);}})['catch'](function(_0x147f14){logger[_0xa258('0x10')](_0xa258('0xc'),_0x2f1f66,_0x147f14);_0x54764a(_0x147f14);});});}exports[_0xa258('0x14')]=function(_0x4ed18a){var _0x592866=this;return new Promise(function(_0xf56f41,_0x40dadb){return db['CmHopperFinal']['create'](_0x4ed18a['body'],{'raw':_0x4ed18a[_0xa258('0x15')]?_0x4ed18a[_0xa258('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xa258('0xa')](function(_0x394ed1){logger['info'](_0xa258('0x14'),_0x4ed18a);logger['debug'](_0xa258('0x14'),_0x4ed18a,JSON[_0xa258('0x16')](_0x394ed1));_0xf56f41(_0x394ed1);})[_0xa258('0x17')](function(_0x14662b){logger[_0xa258('0x10')](_0xa258('0x14'),_0x14662b[_0xa258('0x12')],_0x4ed18a);_0x40dadb(_0x592866[_0xa258('0x10')](0x1f4,_0x14662b['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 75e47d4..4e6bd10 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 _0x4cde=['/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','describe','get','/:id'];(function(_0x590838,_0x1bc41f){var _0x3c006b=function(_0x5889fc){while(--_0x5889fc){_0x590838['push'](_0x590838['shift']());}};_0x3c006b(++_0x1bc41f);}(_0x4cde,0x15c));var _0xe4cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4cde[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe4cd('0x0'));var util=require('util');var path=require(_0xe4cd('0x1'));var timeout=require(_0xe4cd('0x2'));var express=require(_0xe4cd('0x3'));var router=express[_0xe4cd('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe4cd('0x5'));var config=require(_0xe4cd('0x6'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth[_0xe4cd('0x7')](),controller[_0xe4cd('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xe4cd('0x9')]);router[_0xe4cd('0xa')](_0xe4cd('0xb'),auth[_0xe4cd('0x7')](),controller['show']);router[_0xe4cd('0xa')](_0xe4cd('0xc'),auth[_0xe4cd('0x7')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0xe4cd('0xd'),auth[_0xe4cd('0x7')](),controller[_0xe4cd('0xe')]);router['post'](_0xe4cd('0xf'),auth[_0xe4cd('0x7')](),controller[_0xe4cd('0x10')]);router[_0xe4cd('0x11')](_0xe4cd('0x12'),auth[_0xe4cd('0x7')](),controller[_0xe4cd('0x13')]);router[_0xe4cd('0x11')]('/checkContactHopper',auth[_0xe4cd('0x7')](),controller[_0xe4cd('0x14')]);router[_0xe4cd('0x15')](_0xe4cd('0xb'),auth['isAuthenticated'](),controller[_0xe4cd('0x16')]);module[_0xe4cd('0x17')]=router; \ No newline at end of file +var _0x72d9=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','index','describe','/:id','isAuthenticated','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','exports'];(function(_0x24e5c9,_0x127db1){var _0x1d0a5f=function(_0x5022ec){while(--_0x5022ec){_0x24e5c9['push'](_0x24e5c9['shift']());}};_0x1d0a5f(++_0x127db1);}(_0x72d9,0x68));var _0x972d=function(_0x1443eb,_0x203408){_0x1443eb=_0x1443eb-0x0;var _0x2b8810=_0x72d9[_0x1443eb];return _0x2b8810;};'use strict';var multer=require(_0x972d('0x0'));var util=require(_0x972d('0x1'));var path=require(_0x972d('0x2'));var timeout=require('connect-timeout');var express=require(_0x972d('0x3'));var router=express[_0x972d('0x4')]();var auth=require(_0x972d('0x5'));var interaction=require(_0x972d('0x6'));var config=require(_0x972d('0x7'));var controller=require(_0x972d('0x8'));router[_0x972d('0x9')]('/',auth['isAuthenticated'](),controller[_0x972d('0xa')]);router[_0x972d('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x972d('0xb')]);router[_0x972d('0x9')](_0x972d('0xc'),auth[_0x972d('0xd')](),controller['show']);router[_0x972d('0x9')](_0x972d('0xe'),auth[_0x972d('0xd')](),controller[_0x972d('0xf')]);router[_0x972d('0x9')](_0x972d('0x10'),auth['isAuthenticated'](),controller[_0x972d('0x11')]);router[_0x972d('0x12')](_0x972d('0x13'),auth[_0x972d('0xd')](),controller[_0x972d('0x14')]);router[_0x972d('0x12')](_0x972d('0x15'),auth[_0x972d('0xd')](),controller[_0x972d('0x16')]);router['post'](_0x972d('0x17'),auth['isAuthenticated'](),controller[_0x972d('0x18')]);router['put'](_0x972d('0xc'),auth['isAuthenticated'](),controller['update']);module[_0x972d('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 0525daf..4059730 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 _0x6058=['DATE','STRING','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x364450,_0xd81db8){var _0x3d9c5e=function(_0x447374){while(--_0x447374){_0x364450['push'](_0x364450['shift']());}};_0x3d9c5e(++_0xd81db8);}(_0x6058,0x123));var _0x8605=function(_0x24b477,_0x30393b){_0x24b477=_0x24b477-0x0;var _0x4041a6=_0x6058[_0x24b477];return _0x4041a6;};'use strict';var Sequelize=require(_0x8605('0x0'));module[_0x8605('0x1')]={'state':{'type':Sequelize[_0x8605('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x8605('0x3')]},'countbusyretry':{'type':Sequelize[_0x8605('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8605('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8605('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8605('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x8605('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x8605('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x8605('0x3')]},'responsetime':{'type':Sequelize[_0x8605('0x3')]},'answertime':{'type':Sequelize[_0x8605('0x3')]},'droptime':{'type':Sequelize[_0x8605('0x3')]},'endtime':{'type':Sequelize[_0x8605('0x3')]},'ringtime':{'type':Sequelize[_0x8605('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8605('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8605('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x8605('0x4')]},'campaigntype':{'type':Sequelize[_0x8605('0x4')]},'membername':{'type':Sequelize[_0x8605('0x4')]},'reason':{'type':Sequelize[_0x8605('0x4')]},'amd':{'type':Sequelize[_0x8605('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8605('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x8605('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x8605('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8605('0x3')]},'edited':{'type':Sequelize[_0x8605('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x8605('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8605('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8605('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8605('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8605('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdf1e=['sequelize','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x1d17af,_0x17f742){var _0x41e76c=function(_0x8d2603){while(--_0x8d2603){_0x1d17af['push'](_0x1d17af['shift']());}};_0x41e76c(++_0x17f742);}(_0xdf1e,0x11d));var _0xedf1=function(_0x19361b,_0x236b26){_0x19361b=_0x19361b-0x0;var _0x4fc7d6=_0xdf1e[_0x19361b];return _0x4fc7d6;};'use strict';var Sequelize=require(_0xedf1('0x0'));module['exports']={'state':{'type':Sequelize[_0xedf1('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xedf1('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xedf1('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xedf1('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xedf1('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xedf1('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xedf1('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xedf1('0x2')]},'starttime':{'type':Sequelize[_0xedf1('0x3')]},'responsetime':{'type':Sequelize[_0xedf1('0x3')]},'answertime':{'type':Sequelize[_0xedf1('0x3')]},'droptime':{'type':Sequelize[_0xedf1('0x3')]},'endtime':{'type':Sequelize[_0xedf1('0x3')]},'ringtime':{'type':Sequelize[_0xedf1('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xedf1('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xedf1('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xedf1('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xedf1('0x2')]},'campaigntype':{'type':Sequelize[_0xedf1('0x2')]},'membername':{'type':Sequelize[_0xedf1('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xedf1('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xedf1('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0xedf1('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xedf1('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xedf1('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xedf1('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 3613183..05ea41c 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 _0xe323=['querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','destroy','stack','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','merge','VIRTUAL','count','then','findAll','rows','catch','show','params','include','find','create','describe','uniqueid','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x507965,_0x4944f4){var _0x3608fc=function(_0x14c8d0){while(--_0x14c8d0){_0x507965['push'](_0x507965['shift']());}};_0x3608fc(++_0x4944f4);}(_0xe323,0xd2));var _0x3e32=function(_0x55c40e,_0x44cad8){_0x55c40e=_0x55c40e-0x0;var _0x75171b=_0xe323[_0x55c40e];return _0x75171b;};'use strict';var pdf=require(_0x3e32('0x0'));var emlformat=require(_0x3e32('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3e32('0x2'));var jsonpatch=require(_0x3e32('0x3'));var rp=require(_0x3e32('0x4'));var moment=require(_0x3e32('0x5'));var BPromise=require(_0x3e32('0x6'));var Mustache=require(_0x3e32('0x7'));var util=require(_0x3e32('0x8'));var path=require(_0x3e32('0x9'));var sox=require(_0x3e32('0xa'));var csv=require(_0x3e32('0xb'));var ejs=require(_0x3e32('0xc'));var fs=require('fs');var _=require(_0x3e32('0xd'));var squel=require(_0x3e32('0xe'));var crypto=require(_0x3e32('0xf'));var jsforce=require(_0x3e32('0x10'));var deskjs=require(_0x3e32('0x11'));var toCsv=require(_0x3e32('0xb'));var querystring=require(_0x3e32('0x12'));var Papa=require(_0x3e32('0x13'));var Redis=require(_0x3e32('0x14'));var authService=require(_0x3e32('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3e32('0x16'));var logger=require(_0x3e32('0x17'))(_0x3e32('0x18'));var utils=require('../../config/utils');var config=require(_0x3e32('0x19'));var licenseUtil=require(_0x3e32('0x1a'));var db=require(_0x3e32('0x1b'))['db'];function respondWithStatusCode(_0x12e87e,_0x364a83){_0x364a83=_0x364a83||0xcc;return function(_0x17b2f9){if(_0x17b2f9){return _0x12e87e[_0x3e32('0x1c')](_0x364a83);}return _0x12e87e[_0x3e32('0x1d')](_0x364a83)[_0x3e32('0x1e')]();};}function respondWithResult(_0x565b3e,_0x1916fa){_0x1916fa=_0x1916fa||0xc8;return function(_0x201f78){if(_0x201f78){return _0x565b3e[_0x3e32('0x1d')](_0x1916fa)[_0x3e32('0x1f')](_0x201f78);}};}function respondWithFilteredResult(_0x138fc0,_0x3651b0){return function(_0x4a695f){if(_0x4a695f){var _0x4c985b=_0x4a695f['count'],_0x3ec854=_0x3651b0[_0x3e32('0x20')],_0x3069e3=_0x3651b0[_0x3e32('0x20')]+_0x3651b0['limit'],_0xe3582e;if(_0x3069e3>=_0x4c985b){_0x3069e3=_0x4c985b;_0xe3582e=0xc8;}else{_0xe3582e=0xce;}_0x138fc0[_0x3e32('0x1d')](_0xe3582e);return _0x138fc0[_0x3e32('0x21')](_0x3e32('0x22'),_0x3ec854+'-'+_0x3069e3+'/'+_0x4c985b)[_0x3e32('0x1f')](_0x4a695f);}return null;};}function patchUpdates(_0x5b7bd4){return function(_0x3f29ea){try{jsonpatch[_0x3e32('0x23')](_0x3f29ea,_0x5b7bd4,!![]);}catch(_0x99ec4){return BPromise[_0x3e32('0x24')](_0x99ec4);}return _0x3f29ea['save']();};}function saveUpdates(_0x14354b,_0x51ff47){return function(_0x7fd378){if(_0x7fd378){return _0x7fd378[_0x3e32('0x25')](_0x14354b)['then'](function(_0x3e1e7c){return _0x3e1e7c;});}return null;};}function removeEntity(_0x3ab655,_0x4a0621){return function(_0x2c90f1){if(_0x2c90f1){return _0x2c90f1[_0x3e32('0x26')]()['then'](function(){_0x3ab655['status'](0xcc)[_0x3e32('0x1e')]();});}};}function handleEntityNotFound(_0x2ea3c5,_0x168a64){return function(_0x1a377b){if(!_0x1a377b){_0x2ea3c5[_0x3e32('0x1c')](0x194);}return _0x1a377b;};}function handleError(_0x589da7,_0x5e5eec){_0x5e5eec=_0x5e5eec||0x1f4;return function(_0x2ac658){logger['error'](_0x2ac658[_0x3e32('0x27')]);if(_0x2ac658['name']){delete _0x2ac658[_0x3e32('0x28')];}_0x589da7[_0x3e32('0x1d')](_0x5e5eec)['send'](_0x2ac658);};}exports[_0x3e32('0x29')]=function(_0x1f14bd,_0x4ee117){var _0x31424a={},_0x401562={},_0x18c0ca={'count':0x0,'rows':[]};var _0x5b7698=_[_0x3e32('0x2a')](db[_0x3e32('0x2b')][_0x3e32('0x2c')],function(_0x90c987){return{'name':_0x90c987[_0x3e32('0x2d')],'type':_0x90c987[_0x3e32('0x2e')][_0x3e32('0x2f')]};});_0x401562[_0x3e32('0x30')]=_[_0x3e32('0x2a')](_0x5b7698,_0x3e32('0x28'));_0x401562[_0x3e32('0x31')]=_[_0x3e32('0x32')](_0x1f14bd[_0x3e32('0x31')]);_0x401562[_0x3e32('0x33')]=_[_0x3e32('0x34')](_0x401562[_0x3e32('0x30')],_0x401562[_0x3e32('0x31')]);_0x31424a[_0x3e32('0x35')]=_[_0x3e32('0x34')](_0x401562[_0x3e32('0x30')],qs[_0x3e32('0x36')](_0x1f14bd['query'][_0x3e32('0x36')]));_0x31424a['attributes']=_0x31424a['attributes'][_0x3e32('0x37')]?_0x31424a[_0x3e32('0x35')]:_0x401562['model'];if(!_0x1f14bd[_0x3e32('0x31')]['hasOwnProperty'](_0x3e32('0x38'))){_0x31424a[_0x3e32('0x39')]=qs['limit'](_0x1f14bd[_0x3e32('0x31')][_0x3e32('0x39')]);_0x31424a['offset']=qs[_0x3e32('0x20')](_0x1f14bd[_0x3e32('0x31')][_0x3e32('0x20')]);}_0x31424a[_0x3e32('0x3a')]=qs[_0x3e32('0x3b')](_0x1f14bd[_0x3e32('0x31')][_0x3e32('0x3b')]);_0x31424a[_0x3e32('0x3c')]=qs[_0x3e32('0x33')](_['pick'](_0x1f14bd[_0x3e32('0x31')],_0x401562['filters']),_0x5b7698);if(_0x1f14bd[_0x3e32('0x31')]['filter']){_0x31424a[_0x3e32('0x3c')]=_[_0x3e32('0x3d')](_0x31424a[_0x3e32('0x3c')],{'$or':_[_0x3e32('0x2a')](_0x5b7698,function(_0xf96d54){if(_0xf96d54[_0x3e32('0x2e')]!==_0x3e32('0x3e')){var _0x29507b={};_0x29507b[_0xf96d54['name']]={'$like':'%'+_0x1f14bd[_0x3e32('0x31')]['filter']+'%'};return _0x29507b;}})});}_0x31424a=_[_0x3e32('0x3d')]({},_0x31424a,_0x1f14bd['options']);var _0xbd42de={'where':_0x31424a['where']};return db['CmHopperHistory'][_0x3e32('0x3f')](_0xbd42de)[_0x3e32('0x40')](function(_0x5d753f){_0x18c0ca[_0x3e32('0x3f')]=_0x5d753f;if(_0x1f14bd[_0x3e32('0x31')]['includeAll']){_0x31424a['include']=[{'all':!![]}];}return db[_0x3e32('0x2b')][_0x3e32('0x41')](_0x31424a);})[_0x3e32('0x40')](function(_0x1855a3){_0x18c0ca[_0x3e32('0x42')]=_0x1855a3;return _0x18c0ca;})['then'](respondWithFilteredResult(_0x4ee117,_0x31424a))[_0x3e32('0x43')](handleError(_0x4ee117,null));};exports[_0x3e32('0x44')]=function(_0x499571,_0x4022cc){var _0x1f7692={'raw':!![],'where':{'id':_0x499571[_0x3e32('0x45')]['id']}},_0x1a5b2e={};_0x1a5b2e[_0x3e32('0x30')]=_['keys'](db['CmHopperHistory'][_0x3e32('0x2c')]);_0x1a5b2e[_0x3e32('0x31')]=_[_0x3e32('0x32')](_0x499571[_0x3e32('0x31')]);_0x1a5b2e['filters']=_['intersection'](_0x1a5b2e[_0x3e32('0x30')],_0x1a5b2e[_0x3e32('0x31')]);_0x1f7692[_0x3e32('0x35')]=_[_0x3e32('0x34')](_0x1a5b2e[_0x3e32('0x30')],qs[_0x3e32('0x36')](_0x499571[_0x3e32('0x31')][_0x3e32('0x36')]));_0x1f7692[_0x3e32('0x35')]=_0x1f7692['attributes'][_0x3e32('0x37')]?_0x1f7692[_0x3e32('0x35')]:_0x1a5b2e[_0x3e32('0x30')];if(_0x499571[_0x3e32('0x31')]['includeAll']){_0x1f7692[_0x3e32('0x46')]=[{'all':!![]}];}_0x1f7692=_['merge']({},_0x1f7692,_0x499571['options']);return db[_0x3e32('0x2b')][_0x3e32('0x47')](_0x1f7692)[_0x3e32('0x40')](handleEntityNotFound(_0x4022cc,null))[_0x3e32('0x40')](respondWithResult(_0x4022cc,null))[_0x3e32('0x43')](handleError(_0x4022cc,null));};exports[_0x3e32('0x48')]=function(_0x223384,_0x4da9ee){return db['CmHopperHistory'][_0x3e32('0x48')](_0x223384['body'],{})[_0x3e32('0x40')](respondWithResult(_0x4da9ee,0xc9))[_0x3e32('0x43')](handleError(_0x4da9ee,null));};exports[_0x3e32('0x49')]=function(_0x2e5dd1,_0x79e513){return db[_0x3e32('0x2b')][_0x3e32('0x49')]()['then'](respondWithResult(_0x79e513,null))['catch'](handleError(_0x79e513,null));};exports[_0x3e32('0x25')]=function(_0x48e558,_0x51e39a){if(_0x48e558['body'][_0x3e32('0x4a')]){delete _0x48e558['body'][_0x3e32('0x4a')];}return db[_0x3e32('0x2b')][_0x3e32('0x47')]({'where':{'uniqueid':_0x48e558['params']['id']}})[_0x3e32('0x40')](handleEntityNotFound(_0x51e39a,null))[_0x3e32('0x40')](saveUpdates(_0x48e558[_0x3e32('0x4b')],null))[_0x3e32('0x40')](respondWithResult(_0x51e39a,null))[_0x3e32('0x43')](handleError(_0x51e39a,null));}; \ No newline at end of file +var _0x9a98=['includeAll','options','create','describe','uniqueid','body','find','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','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','../../config/license/util','sendStatus','status','json','count','offset','limit','set','reject','save','update','then','destroy','end','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','findAll','rows','catch','show','keys'];(function(_0x36d132,_0x5a267a){var _0x831446=function(_0x24130a){while(--_0x24130a){_0x36d132['push'](_0x36d132['shift']());}};_0x831446(++_0x5a267a);}(_0x9a98,0x1dc));var _0x89a9=function(_0x23f76b,_0x7b54af){_0x23f76b=_0x23f76b-0x0;var _0x5ab9ef=_0x9a98[_0x23f76b];return _0x5ab9ef;};'use strict';var pdf=require(_0x89a9('0x0'));var emlformat=require(_0x89a9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x89a9('0x2'));var jsonpatch=require(_0x89a9('0x3'));var rp=require(_0x89a9('0x4'));var moment=require(_0x89a9('0x5'));var BPromise=require(_0x89a9('0x6'));var Mustache=require('mustache');var util=require(_0x89a9('0x7'));var path=require('path');var sox=require(_0x89a9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x89a9('0x9'));var squel=require(_0x89a9('0xa'));var crypto=require(_0x89a9('0xb'));var jsforce=require(_0x89a9('0xc'));var deskjs=require(_0x89a9('0xd'));var toCsv=require(_0x89a9('0xe'));var querystring=require(_0x89a9('0xf'));var Papa=require(_0x89a9('0x10'));var Redis=require(_0x89a9('0x11'));var authService=require(_0x89a9('0x12'));var qs=require(_0x89a9('0x13'));var as=require(_0x89a9('0x14'));var hardwareService=require(_0x89a9('0x15'));var logger=require(_0x89a9('0x16'))(_0x89a9('0x17'));var utils=require(_0x89a9('0x18'));var config=require(_0x89a9('0x19'));var licenseUtil=require(_0x89a9('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x24742d,_0x4c2a57){_0x4c2a57=_0x4c2a57||0xcc;return function(_0x56d409){if(_0x56d409){return _0x24742d[_0x89a9('0x1b')](_0x4c2a57);}return _0x24742d[_0x89a9('0x1c')](_0x4c2a57)['end']();};}function respondWithResult(_0x4c2cbe,_0x250bf5){_0x250bf5=_0x250bf5||0xc8;return function(_0x599191){if(_0x599191){return _0x4c2cbe['status'](_0x250bf5)[_0x89a9('0x1d')](_0x599191);}};}function respondWithFilteredResult(_0x41462c,_0x58c0e4){return function(_0x174388){if(_0x174388){var _0x399b65=_0x174388[_0x89a9('0x1e')],_0x1f3d35=_0x58c0e4['offset'],_0x266e06=_0x58c0e4[_0x89a9('0x1f')]+_0x58c0e4[_0x89a9('0x20')],_0x5a12e2;if(_0x266e06>=_0x399b65){_0x266e06=_0x399b65;_0x5a12e2=0xc8;}else{_0x5a12e2=0xce;}_0x41462c[_0x89a9('0x1c')](_0x5a12e2);return _0x41462c[_0x89a9('0x21')]('Content-Range',_0x1f3d35+'-'+_0x266e06+'/'+_0x399b65)[_0x89a9('0x1d')](_0x174388);}return null;};}function patchUpdates(_0x2862f7){return function(_0x4ea7f7){try{jsonpatch['apply'](_0x4ea7f7,_0x2862f7,!![]);}catch(_0x1dcec6){return BPromise[_0x89a9('0x22')](_0x1dcec6);}return _0x4ea7f7[_0x89a9('0x23')]();};}function saveUpdates(_0xfe958b,_0x548aa1){return function(_0x5d27e5){if(_0x5d27e5){return _0x5d27e5[_0x89a9('0x24')](_0xfe958b)[_0x89a9('0x25')](function(_0x4aa96c){return _0x4aa96c;});}return null;};}function removeEntity(_0x1bc9c2,_0x2301ca){return function(_0x2d00d5){if(_0x2d00d5){return _0x2d00d5[_0x89a9('0x26')]()[_0x89a9('0x25')](function(){_0x1bc9c2[_0x89a9('0x1c')](0xcc)[_0x89a9('0x27')]();});}};}function handleEntityNotFound(_0x4ab867,_0x4918b0){return function(_0x193f98){if(!_0x193f98){_0x4ab867['sendStatus'](0x194);}return _0x193f98;};}function handleError(_0x4daf75,_0x292485){_0x292485=_0x292485||0x1f4;return function(_0x88a1f2){logger[_0x89a9('0x28')](_0x88a1f2[_0x89a9('0x29')]);if(_0x88a1f2[_0x89a9('0x2a')]){delete _0x88a1f2[_0x89a9('0x2a')];}_0x4daf75['status'](_0x292485)[_0x89a9('0x2b')](_0x88a1f2);};}exports[_0x89a9('0x2c')]=function(_0x85acf4,_0x4a929e){var _0x1095f6={},_0x49010e={},_0x10d40f={'count':0x0,'rows':[]};var _0x9397f2=_[_0x89a9('0x2d')](db[_0x89a9('0x2e')][_0x89a9('0x2f')],function(_0x22441d){return{'name':_0x22441d[_0x89a9('0x30')],'type':_0x22441d[_0x89a9('0x31')][_0x89a9('0x32')]};});_0x49010e[_0x89a9('0x33')]=_[_0x89a9('0x2d')](_0x9397f2,_0x89a9('0x2a'));_0x49010e['query']=_['keys'](_0x85acf4[_0x89a9('0x34')]);_0x49010e[_0x89a9('0x35')]=_['intersection'](_0x49010e[_0x89a9('0x33')],_0x49010e[_0x89a9('0x34')]);_0x1095f6[_0x89a9('0x36')]=_[_0x89a9('0x37')](_0x49010e[_0x89a9('0x33')],qs[_0x89a9('0x38')](_0x85acf4[_0x89a9('0x34')][_0x89a9('0x38')]));_0x1095f6['attributes']=_0x1095f6['attributes'][_0x89a9('0x39')]?_0x1095f6[_0x89a9('0x36')]:_0x49010e[_0x89a9('0x33')];if(!_0x85acf4[_0x89a9('0x34')][_0x89a9('0x3a')]('nolimit')){_0x1095f6[_0x89a9('0x20')]=qs[_0x89a9('0x20')](_0x85acf4[_0x89a9('0x34')][_0x89a9('0x20')]);_0x1095f6['offset']=qs[_0x89a9('0x1f')](_0x85acf4['query']['offset']);}_0x1095f6[_0x89a9('0x3b')]=qs[_0x89a9('0x3c')](_0x85acf4['query']['sort']);_0x1095f6[_0x89a9('0x3d')]=qs[_0x89a9('0x35')](_['pick'](_0x85acf4[_0x89a9('0x34')],_0x49010e[_0x89a9('0x35')]),_0x9397f2);if(_0x85acf4[_0x89a9('0x34')][_0x89a9('0x3e')]){_0x1095f6[_0x89a9('0x3d')]=_[_0x89a9('0x3f')](_0x1095f6['where'],{'$or':_['map'](_0x9397f2,function(_0x13c1f6){if(_0x13c1f6[_0x89a9('0x31')]!==_0x89a9('0x40')){var _0x1ed10c={};_0x1ed10c[_0x13c1f6['name']]={'$like':'%'+_0x85acf4[_0x89a9('0x34')][_0x89a9('0x3e')]+'%'};return _0x1ed10c;}})});}_0x1095f6=_[_0x89a9('0x3f')]({},_0x1095f6,_0x85acf4['options']);var _0x5e6dc0={'where':_0x1095f6[_0x89a9('0x3d')]};return db['CmHopperHistory'][_0x89a9('0x1e')](_0x5e6dc0)[_0x89a9('0x25')](function(_0x50034f){_0x10d40f[_0x89a9('0x1e')]=_0x50034f;if(_0x85acf4[_0x89a9('0x34')]['includeAll']){_0x1095f6['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x89a9('0x41')](_0x1095f6);})[_0x89a9('0x25')](function(_0x1d082e){_0x10d40f[_0x89a9('0x42')]=_0x1d082e;return _0x10d40f;})['then'](respondWithFilteredResult(_0x4a929e,_0x1095f6))[_0x89a9('0x43')](handleError(_0x4a929e,null));};exports[_0x89a9('0x44')]=function(_0x2d071d,_0x46b323){var _0x294881={'raw':!![],'where':{'id':_0x2d071d['params']['id']}},_0x40bf0a={};_0x40bf0a['model']=_['keys'](db[_0x89a9('0x2e')][_0x89a9('0x2f')]);_0x40bf0a['query']=_[_0x89a9('0x45')](_0x2d071d[_0x89a9('0x34')]);_0x40bf0a[_0x89a9('0x35')]=_[_0x89a9('0x37')](_0x40bf0a[_0x89a9('0x33')],_0x40bf0a[_0x89a9('0x34')]);_0x294881['attributes']=_[_0x89a9('0x37')](_0x40bf0a['model'],qs[_0x89a9('0x38')](_0x2d071d['query']['fields']));_0x294881[_0x89a9('0x36')]=_0x294881[_0x89a9('0x36')]['length']?_0x294881[_0x89a9('0x36')]:_0x40bf0a[_0x89a9('0x33')];if(_0x2d071d['query'][_0x89a9('0x46')]){_0x294881['include']=[{'all':!![]}];}_0x294881=_[_0x89a9('0x3f')]({},_0x294881,_0x2d071d[_0x89a9('0x47')]);return db[_0x89a9('0x2e')]['find'](_0x294881)[_0x89a9('0x25')](handleEntityNotFound(_0x46b323,null))['then'](respondWithResult(_0x46b323,null))['catch'](handleError(_0x46b323,null));};exports['create']=function(_0x30c479,_0x858d63){return db[_0x89a9('0x2e')][_0x89a9('0x48')](_0x30c479['body'],{})['then'](respondWithResult(_0x858d63,0xc9))[_0x89a9('0x43')](handleError(_0x858d63,null));};exports[_0x89a9('0x49')]=function(_0x1b86fa,_0x2762e2){return db[_0x89a9('0x2e')][_0x89a9('0x49')]()[_0x89a9('0x25')](respondWithResult(_0x2762e2,null))[_0x89a9('0x43')](handleError(_0x2762e2,null));};exports['update']=function(_0x5681e9,_0x1978f8){if(_0x5681e9['body'][_0x89a9('0x4a')]){delete _0x5681e9[_0x89a9('0x4b')]['uniqueid'];}return db['CmHopperHistory'][_0x89a9('0x4c')]({'where':{'uniqueid':_0x5681e9[_0x89a9('0x4d')]['id']}})[_0x89a9('0x25')](handleEntityNotFound(_0x1978f8,null))['then'](saveUpdates(_0x5681e9[_0x89a9('0x4b')],null))[_0x89a9('0x25')](respondWithResult(_0x1978f8,null))[_0x89a9('0x43')](handleError(_0x1978f8,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index d435305..e967527 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 _0xb106=['define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb106,0x198));var _0x6b10=function(_0x49a982,_0x129a07){_0x49a982=_0x49a982-0x0;var _0x2a0bc9=_0xb106[_0x49a982];return _0x2a0bc9;};'use strict';var _=require(_0x6b10('0x0'));var util=require(_0x6b10('0x1'));var logger=require(_0x6b10('0x2'))(_0x6b10('0x3'));var moment=require(_0x6b10('0x4'));var BPromise=require('bluebird');var rp=require(_0x6b10('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6b10('0x6'));var attributes=require('./cmHopperHistory.attributes');module[_0x6b10('0x7')]=function(_0x2e127c,_0x29964d){return _0x2e127c[_0x6b10('0x8')](_0x6b10('0x9'),attributes,{'tableName':_0x6b10('0xa'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x6b10('0xb')]},{'name':_0x6b10('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x70f4=['api','moment','bluebird','request-promise','../../config/environment','./cmHopperHistory.attributes','exports','define','endtime','uniqueid','lodash'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x70f4,0x133));var _0x470f=function(_0x13cf7a,_0x479809){_0x13cf7a=_0x13cf7a-0x0;var _0x5cb678=_0x70f4[_0x13cf7a];return _0x5cb678;};'use strict';var _=require(_0x470f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x470f('0x1'));var moment=require(_0x470f('0x2'));var BPromise=require(_0x470f('0x3'));var rp=require(_0x470f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x470f('0x5'));var attributes=require(_0x470f('0x6'));module[_0x470f('0x7')]=function(_0x2b4ed3,_0x25c141){return _0x2b4ed3[_0x470f('0x8')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0x470f('0x9')]},{'name':_0x470f('0xa'),'fields':[_0x470f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 2c68deb..9266ba5 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 _0x2d1a=['outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','create','body','options','raw','then','CreateCmHopperHistory','stringify','CmHopperHistory','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','findAll','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null'];(function(_0xe6b689,_0x3557fd){var _0x3c21df=function(_0x12f616){while(--_0x12f616){_0xe6b689['push'](_0xe6b689['shift']());}};_0x3c21df(++_0x3557fd);}(_0x2d1a,0x178));var _0xa2d1=function(_0x20cb20,_0x256051){_0x20cb20=_0x20cb20-0x0;var _0x2fcf4b=_0x2d1a[_0x20cb20];return _0x2fcf4b;};'use strict';var _=require('lodash');var util=require(_0xa2d1('0x0'));var moment=require(_0xa2d1('0x1'));var BPromise=require(_0xa2d1('0x2'));var rs=require(_0xa2d1('0x3'));var fs=require('fs');var Redis=require(_0xa2d1('0x4'));var db=require(_0xa2d1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa2d1('0x6'))(_0xa2d1('0x7'));var config=require(_0xa2d1('0x8'));var jayson=require(_0xa2d1('0x9'));var client=jayson[_0xa2d1('0xa')][_0xa2d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe76512,_0xb931ac,_0x524c3e){return new BPromise(function(_0x18250d,_0xc86d46){return client[_0xa2d1('0xc')](_0xe76512,_0x524c3e)['then'](function(_0x4232cb){logger[_0xa2d1('0xd')](_0xa2d1('0xe'),_0xb931ac,_0xa2d1('0xf'));logger[_0xa2d1('0x10')](_0xa2d1('0x11'),_0xb931ac,_0xa2d1('0xf'),JSON['stringify'](_0x4232cb));if(_0x4232cb[_0xa2d1('0x12')]){if(_0x4232cb[_0xa2d1('0x12')][_0xa2d1('0x13')]===0x1f4){logger[_0xa2d1('0x12')](_0xa2d1('0xe'),_0xb931ac,_0x4232cb[_0xa2d1('0x12')][_0xa2d1('0x14')]);return _0xc86d46(_0x4232cb['error'][_0xa2d1('0x14')]);}logger[_0xa2d1('0x12')](_0xa2d1('0xe'),_0xb931ac,_0x4232cb[_0xa2d1('0x12')][_0xa2d1('0x14')]);return _0x18250d(_0x4232cb['error'][_0xa2d1('0x14')]);}else{logger[_0xa2d1('0xd')](_0xa2d1('0xe'),_0xb931ac,_0xa2d1('0xf'));_0x18250d(_0x4232cb[_0xa2d1('0x15')]['message']);}})[_0xa2d1('0x16')](function(_0x2d0cd4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0xb931ac,_0x2d0cd4);_0xc86d46(_0x2d0cd4);});});}exports['CreateCmHopperHistory']=function(_0x213646){var _0x4008fb=this;return new Promise(function(_0x334ce1,_0x4a9ba7){return db['CmHopperHistory'][_0xa2d1('0x17')](_0x213646[_0xa2d1('0x18')],{'raw':_0x213646[_0xa2d1('0x19')]?_0x213646[_0xa2d1('0x19')][_0xa2d1('0x1a')]===undefined?!![]:![]:!![]})[_0xa2d1('0x1b')](function(_0x14b34d){logger[_0xa2d1('0xd')](_0xa2d1('0x1c'),_0x213646);logger['debug'](_0xa2d1('0x1c'),_0x213646,JSON[_0xa2d1('0x1d')](_0x14b34d));_0x334ce1(_0x14b34d);})['catch'](function(_0x4b69c5){logger[_0xa2d1('0x12')](_0xa2d1('0x1c'),_0x4b69c5[_0xa2d1('0x14')],_0x213646);_0x4a9ba7(_0x4008fb[_0xa2d1('0x12')](0x1f4,_0x4b69c5[_0xa2d1('0x14')]));});});};exports['AvgHandleTime']=function(_0x136961){var _0x1a9029=this;return new Promise(function(_0x522c3e,_0x57b187){return db[_0xa2d1('0x1e')]['findAll']({'raw':_0x136961[_0xa2d1('0x19')]?_0x136961[_0xa2d1('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x136961['options']?_0x136961[_0xa2d1('0x19')][_0xa2d1('0x1f')]||null:null,'attributes':[[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x21'),db[_0xa2d1('0x20')][_0xa2d1('0x22')]('id')),_0xa2d1('0x23')],[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0xa2d1('0x24')]('`state`\x20=\x204,\x201,\x20null'))),_0xa2d1('0x25')],[db['sequelize']['fn'](_0xa2d1('0x21'),db['sequelize']['fn']('IF',db[_0xa2d1('0x20')][_0xa2d1('0x24')](_0xa2d1('0x26')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn']('COUNT',db[_0xa2d1('0x20')]['fn']('IF',db[_0xa2d1('0x20')][_0xa2d1('0x24')]('`state`\x20=\x2011,\x201,\x20null'))),_0xa2d1('0x27')],[db[_0xa2d1('0x20')]['fn']('AVG',db[_0xa2d1('0x20')]['fn']('IF',db[_0xa2d1('0x20')][_0xa2d1('0x24')](_0xa2d1('0x28')))),_0xa2d1('0x29')],[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x2a'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xa2d1('0x2b')))),_0xa2d1('0x2c')]]})[_0xa2d1('0x1b')](function(_0x5d5b68){logger[_0xa2d1('0xd')](_0xa2d1('0x2d'),_0x136961);logger[_0xa2d1('0x10')]('AvgHandleTime',_0x136961,JSON[_0xa2d1('0x1d')](_0x5d5b68));_0x522c3e(_0x5d5b68);})[_0xa2d1('0x16')](function(_0x418a8f){logger[_0xa2d1('0x12')](_0xa2d1('0x2d'),_0x418a8f['message'],_0x136961);_0x57b187(_0x1a9029[_0xa2d1('0x12')](0x1f4,_0x418a8f[_0xa2d1('0x14')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x32b14c){var _0x399da3=this;return new Promise(function(_0x32b8c8,_0x1e2bd9){return db[_0xa2d1('0x1e')][_0xa2d1('0x2e')]({'raw':_0x32b14c['options']?_0x32b14c[_0xa2d1('0x19')][_0xa2d1('0x1a')]===undefined?!![]:![]:!![],'where':_0x32b14c[_0xa2d1('0x19')]?_0x32b14c[_0xa2d1('0x19')][_0xa2d1('0x1f')]||null:null,'attributes':[[_0xa2d1('0x2f'),_0xa2d1('0x30')],[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x21'),db[_0xa2d1('0x20')]['fn']('IF',db[_0xa2d1('0x20')]['literal'](_0xa2d1('0x31')))),_0xa2d1('0x32')],[db['sequelize']['fn']('COUNT',db[_0xa2d1('0x20')]['fn']('IF',db[_0xa2d1('0x20')][_0xa2d1('0x24')](_0xa2d1('0x33')))),_0xa2d1('0x34')],[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x21'),db['sequelize']['fn']('IF',db[_0xa2d1('0x20')][_0xa2d1('0x24')](_0xa2d1('0x35')))),'outboundAnswerCallsDay'],[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x21'),db[_0xa2d1('0x20')]['fn']('IF',db[_0xa2d1('0x20')][_0xa2d1('0x24')](_0xa2d1('0x36')))),_0xa2d1('0x37')],[db[_0xa2d1('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xa2d1('0x24')]('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db['sequelize']['fn'](_0xa2d1('0x21'),db[_0xa2d1('0x20')]['fn']('IF',db[_0xa2d1('0x20')][_0xa2d1('0x24')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xa2d1('0x38')],[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x21'),db[_0xa2d1('0x20')]['fn']('IF',db[_0xa2d1('0x20')][_0xa2d1('0x24')](_0xa2d1('0x39')))),_0xa2d1('0x3a')],[db['sequelize']['fn']('COUNT',db[_0xa2d1('0x20')]['fn']('IF',db[_0xa2d1('0x20')][_0xa2d1('0x24')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0xa2d1('0x21'),db[_0xa2d1('0x20')]['fn']('IF',db['sequelize']['literal'](_0xa2d1('0x3b')))),_0xa2d1('0x3c')],[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x21'),db[_0xa2d1('0x20')]['fn']('IF',db['sequelize'][_0xa2d1('0x24')](_0xa2d1('0x3d')))),_0xa2d1('0x3e')],[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x21'),db[_0xa2d1('0x20')]['fn']('IF',db['sequelize'][_0xa2d1('0x24')](_0xa2d1('0x3f')))),_0xa2d1('0x40')],[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x21'),db['sequelize']['fn']('IF',db[_0xa2d1('0x20')]['literal'](_0xa2d1('0x41')))),'outboundAnswerAgiCallsDay'],[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x21'),db[_0xa2d1('0x20')]['fn']('IF',db[_0xa2d1('0x20')]['literal'](_0xa2d1('0x42')))),'outboundRejectCallsDay'],[db[_0xa2d1('0x20')]['fn']('COUNT',db[_0xa2d1('0x20')]['fn']('IF',db['sequelize'][_0xa2d1('0x24')](_0xa2d1('0x43')))),_0xa2d1('0x44')]],'group':['campaign']})[_0xa2d1('0x1b')](function(_0x5d672f){logger[_0xa2d1('0xd')](_0xa2d1('0x45'),_0x32b14c);logger[_0xa2d1('0x10')](_0xa2d1('0x45'),_0x32b14c,JSON[_0xa2d1('0x1d')](_0x5d672f));_0x32b8c8(_0x5d672f);})[_0xa2d1('0x16')](function(_0x5a8386){logger[_0xa2d1('0x12')](_0xa2d1('0x45'),_0x5a8386[_0xa2d1('0x14')],_0x32b14c);_0x1e2bd9(_0x399da3[_0xa2d1('0x12')](0x1f4,_0x5a8386[_0xa2d1('0x14')]));});});};exports[_0xa2d1('0x46')]=function(_0x441a2e){var _0x4f26f7=this;return new Promise(function(_0x3cb0ed,_0x5378d2){return db[_0xa2d1('0x1e')]['findAll']({'raw':_0x441a2e['options']?_0x441a2e[_0xa2d1('0x19')][_0xa2d1('0x1a')]===undefined?!![]:![]:!![],'where':_0x441a2e[_0xa2d1('0x19')]?_0x441a2e[_0xa2d1('0x19')]['where']||null:null,'attributes':[[_0xa2d1('0x2f'),'name'],[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x21'),db[_0xa2d1('0x20')][_0xa2d1('0x22')]('id')),_0xa2d1('0x47')],[db[_0xa2d1('0x20')]['fn'](_0xa2d1('0x21'),db[_0xa2d1('0x20')]['fn']('IF',db['sequelize'][_0xa2d1('0x24')]('`state`\x20=\x204,\x201,\x20null'))),_0xa2d1('0x48')]],'group':['campaign']})[_0xa2d1('0x1b')](function(_0x4599d8){logger['info'](_0xa2d1('0x46'),_0x441a2e);logger[_0xa2d1('0x10')](_0xa2d1('0x46'),_0x441a2e,JSON[_0xa2d1('0x1d')](_0x4599d8));_0x3cb0ed(_0x4599d8);})[_0xa2d1('0x16')](function(_0x327658){logger['error'](_0xa2d1('0x46'),_0x327658[_0xa2d1('0x14')],_0x441a2e);_0x5378d2(_0x4f26f7[_0xa2d1('0x12')](0x1f4,_0x327658[_0xa2d1('0x14')]));});});}; \ No newline at end of file +var _0xb7fd=['../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','CreateCmHopperHistory','CmHopperHistory','options','raw','catch','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x41de6b,_0x46060c){var _0x8d343c=function(_0x56d057){while(--_0x56d057){_0x41de6b['push'](_0x41de6b['shift']());}};_0x8d343c(++_0x46060c);}(_0xb7fd,0x10d));var _0xdb7f=function(_0xc77d00,_0x1eb17b){_0xc77d00=_0xc77d00-0x0;var _0x42050f=_0xb7fd[_0xc77d00];return _0x42050f;};'use strict';var _=require('lodash');var util=require(_0xdb7f('0x0'));var moment=require(_0xdb7f('0x1'));var BPromise=require(_0xdb7f('0x2'));var rs=require(_0xdb7f('0x3'));var fs=require('fs');var Redis=require(_0xdb7f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdb7f('0x5'));var logger=require(_0xdb7f('0x6'))('rpc');var config=require(_0xdb7f('0x7'));var jayson=require(_0xdb7f('0x8'));var client=jayson[_0xdb7f('0x9')][_0xdb7f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x525975,_0x5d0bf0,_0x2edb94){return new BPromise(function(_0x4b5eeb,_0x1c88a8){return client[_0xdb7f('0xb')](_0x525975,_0x2edb94)[_0xdb7f('0xc')](function(_0x4da661){logger[_0xdb7f('0xd')](_0xdb7f('0xe'),_0x5d0bf0,_0xdb7f('0xf'));logger[_0xdb7f('0x10')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x5d0bf0,_0xdb7f('0xf'),JSON[_0xdb7f('0x11')](_0x4da661));if(_0x4da661[_0xdb7f('0x12')]){if(_0x4da661[_0xdb7f('0x12')][_0xdb7f('0x13')]===0x1f4){logger[_0xdb7f('0x12')](_0xdb7f('0xe'),_0x5d0bf0,_0x4da661['error']['message']);return _0x1c88a8(_0x4da661['error'][_0xdb7f('0x14')]);}logger[_0xdb7f('0x12')](_0xdb7f('0xe'),_0x5d0bf0,_0x4da661[_0xdb7f('0x12')]['message']);return _0x4b5eeb(_0x4da661[_0xdb7f('0x12')][_0xdb7f('0x14')]);}else{logger[_0xdb7f('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x5d0bf0,'request\x20sent');_0x4b5eeb(_0x4da661['result'][_0xdb7f('0x14')]);}})['catch'](function(_0x133dc2){logger[_0xdb7f('0x12')](_0xdb7f('0xe'),_0x5d0bf0,_0x133dc2);_0x1c88a8(_0x133dc2);});});}exports[_0xdb7f('0x15')]=function(_0x3895cf){var _0x53c2a5=this;return new Promise(function(_0x3614ed,_0x27b9be){return db[_0xdb7f('0x16')]['create'](_0x3895cf['body'],{'raw':_0x3895cf[_0xdb7f('0x17')]?_0x3895cf[_0xdb7f('0x17')][_0xdb7f('0x18')]===undefined?!![]:![]:!![]})[_0xdb7f('0xc')](function(_0x5cb433){logger['info'](_0xdb7f('0x15'),_0x3895cf);logger[_0xdb7f('0x10')](_0xdb7f('0x15'),_0x3895cf,JSON['stringify'](_0x5cb433));_0x3614ed(_0x5cb433);})[_0xdb7f('0x19')](function(_0x284d5f){logger[_0xdb7f('0x12')](_0xdb7f('0x15'),_0x284d5f['message'],_0x3895cf);_0x27b9be(_0x53c2a5[_0xdb7f('0x12')](0x1f4,_0x284d5f[_0xdb7f('0x14')]));});});};exports[_0xdb7f('0x1a')]=function(_0xdb7be){var _0x4edd05=this;return new Promise(function(_0x49d7d7,_0x3026cb){return db[_0xdb7f('0x16')][_0xdb7f('0x1b')]({'raw':_0xdb7be['options']?_0xdb7be[_0xdb7f('0x17')][_0xdb7f('0x18')]===undefined?!![]:![]:!![],'where':_0xdb7be['options']?_0xdb7be[_0xdb7f('0x17')][_0xdb7f('0x1c')]||null:null,'attributes':[[db[_0xdb7f('0x1d')]['fn'](_0xdb7f('0x1e'),db['sequelize'][_0xdb7f('0x1f')]('id')),_0xdb7f('0x20')],[db[_0xdb7f('0x1d')]['fn'](_0xdb7f('0x1e'),db[_0xdb7f('0x1d')]['fn']('IF',db['sequelize'][_0xdb7f('0x21')](_0xdb7f('0x22')))),_0xdb7f('0x23')],[db[_0xdb7f('0x1d')]['fn']('COUNT',db[_0xdb7f('0x1d')]['fn']('IF',db[_0xdb7f('0x1d')][_0xdb7f('0x21')](_0xdb7f('0x24')))),_0xdb7f('0x25')],[db[_0xdb7f('0x1d')]['fn']('COUNT',db[_0xdb7f('0x1d')]['fn']('IF',db[_0xdb7f('0x1d')][_0xdb7f('0x21')]('`state`\x20=\x2011,\x201,\x20null'))),_0xdb7f('0x26')],[db['sequelize']['fn'](_0xdb7f('0x27'),db[_0xdb7f('0x1d')]['fn']('IF',db[_0xdb7f('0x1d')]['literal'](_0xdb7f('0x28')))),_0xdb7f('0x29')],[db['sequelize']['fn'](_0xdb7f('0x27'),db[_0xdb7f('0x1d')]['fn']('IF',db[_0xdb7f('0x1d')][_0xdb7f('0x21')](_0xdb7f('0x2a')))),_0xdb7f('0x2b')]]})[_0xdb7f('0xc')](function(_0x38cfb0){logger[_0xdb7f('0xd')](_0xdb7f('0x1a'),_0xdb7be);logger[_0xdb7f('0x10')](_0xdb7f('0x1a'),_0xdb7be,JSON[_0xdb7f('0x11')](_0x38cfb0));_0x49d7d7(_0x38cfb0);})['catch'](function(_0x50b0b1){logger['error'](_0xdb7f('0x1a'),_0x50b0b1['message'],_0xdb7be);_0x3026cb(_0x4edd05[_0xdb7f('0x12')](0x1f4,_0x50b0b1['message']));});});};exports[_0xdb7f('0x2c')]=function(_0x18e576){var _0x19b863=this;return new Promise(function(_0x42f7e6,_0x1af6f5){return db[_0xdb7f('0x16')][_0xdb7f('0x1b')]({'raw':_0x18e576[_0xdb7f('0x17')]?_0x18e576[_0xdb7f('0x17')][_0xdb7f('0x18')]===undefined?!![]:![]:!![],'where':_0x18e576[_0xdb7f('0x17')]?_0x18e576['options'][_0xdb7f('0x1c')]||null:null,'attributes':[[_0xdb7f('0x2d'),_0xdb7f('0x2e')],[db[_0xdb7f('0x1d')]['fn'](_0xdb7f('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0xdb7f('0x21')]('`state`\x20=\x200,\x201,\x20null'))),_0xdb7f('0x2f')],[db['sequelize']['fn'](_0xdb7f('0x1e'),db[_0xdb7f('0x1d')]['fn']('IF',db[_0xdb7f('0x1d')][_0xdb7f('0x21')]('`state`\x20=\x203,\x201,\x20null'))),_0xdb7f('0x30')],[db[_0xdb7f('0x1d')]['fn'](_0xdb7f('0x1e'),db[_0xdb7f('0x1d')]['fn']('IF',db['sequelize'][_0xdb7f('0x21')](_0xdb7f('0x22')))),_0xdb7f('0x31')],[db[_0xdb7f('0x1d')]['fn'](_0xdb7f('0x1e'),db[_0xdb7f('0x1d')]['fn']('IF',db['sequelize'][_0xdb7f('0x21')](_0xdb7f('0x32')))),_0xdb7f('0x33')],[db['sequelize']['fn'](_0xdb7f('0x1e'),db[_0xdb7f('0x1d')]['fn']('IF',db[_0xdb7f('0x1d')][_0xdb7f('0x21')]('`state`\x20=\x208,\x201,\x20null'))),'outboundCongestionCallsDay'],[db[_0xdb7f('0x1d')]['fn'](_0xdb7f('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0xdb7f('0x21')](_0xdb7f('0x34')))),_0xdb7f('0x35')],[db[_0xdb7f('0x1d')]['fn'](_0xdb7f('0x1e'),db[_0xdb7f('0x1d')]['fn']('IF',db[_0xdb7f('0x1d')][_0xdb7f('0x21')](_0xdb7f('0x36')))),_0xdb7f('0x37')],[db[_0xdb7f('0x1d')]['fn'](_0xdb7f('0x1e'),db['sequelize']['fn']('IF',db[_0xdb7f('0x1d')]['literal'](_0xdb7f('0x38')))),_0xdb7f('0x39')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xdb7f('0x1d')][_0xdb7f('0x21')]('`state`\x20=\x2013,\x201,\x20null'))),_0xdb7f('0x3a')],[db[_0xdb7f('0x1d')]['fn'](_0xdb7f('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0xdb7f('0x21')]('`state`\x20=\x2014,\x201,\x20null'))),_0xdb7f('0x3b')],[db[_0xdb7f('0x1d')]['fn'](_0xdb7f('0x1e'),db[_0xdb7f('0x1d')]['fn']('IF',db[_0xdb7f('0x1d')][_0xdb7f('0x21')](_0xdb7f('0x3c')))),_0xdb7f('0x3d')],[db['sequelize']['fn'](_0xdb7f('0x1e'),db['sequelize']['fn']('IF',db[_0xdb7f('0x1d')]['literal'](_0xdb7f('0x3e')))),_0xdb7f('0x3f')],[db[_0xdb7f('0x1d')]['fn'](_0xdb7f('0x1e'),db[_0xdb7f('0x1d')]['fn']('IF',db[_0xdb7f('0x1d')]['literal'](_0xdb7f('0x40')))),'outboundRejectCallsDay'],[db[_0xdb7f('0x1d')]['fn'](_0xdb7f('0x1e'),db[_0xdb7f('0x1d')]['fn']('IF',db[_0xdb7f('0x1d')][_0xdb7f('0x21')](_0xdb7f('0x41')))),_0xdb7f('0x42')]],'group':[_0xdb7f('0x2d')]})[_0xdb7f('0xc')](function(_0x375352){logger[_0xdb7f('0xd')]('GetVoiceQueueHopperHistory',_0x18e576);logger[_0xdb7f('0x10')](_0xdb7f('0x2c'),_0x18e576,JSON[_0xdb7f('0x11')](_0x375352));_0x42f7e6(_0x375352);})['catch'](function(_0x3fb035){logger[_0xdb7f('0x12')]('GetVoiceQueueHopperHistory',_0x3fb035['message'],_0x18e576);_0x1af6f5(_0x19b863['error'](0x1f4,_0x3fb035[_0xdb7f('0x14')]));});});};exports[_0xdb7f('0x43')]=function(_0x161532){var _0x199e7e=this;return new Promise(function(_0x52bd9a,_0x14537e){return db[_0xdb7f('0x16')]['findAll']({'raw':_0x161532[_0xdb7f('0x17')]?_0x161532['options'][_0xdb7f('0x18')]===undefined?!![]:![]:!![],'where':_0x161532[_0xdb7f('0x17')]?_0x161532[_0xdb7f('0x17')][_0xdb7f('0x1c')]||null:null,'attributes':[[_0xdb7f('0x2d'),_0xdb7f('0x2e')],[db['sequelize']['fn'](_0xdb7f('0x1e'),db[_0xdb7f('0x1d')][_0xdb7f('0x1f')]('id')),_0xdb7f('0x44')],[db[_0xdb7f('0x1d')]['fn']('COUNT',db[_0xdb7f('0x1d')]['fn']('IF',db[_0xdb7f('0x1d')][_0xdb7f('0x21')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0xdb7f('0x2d')]})[_0xdb7f('0xc')](function(_0x418406){logger[_0xdb7f('0xd')](_0xdb7f('0x43'),_0x161532);logger[_0xdb7f('0x10')](_0xdb7f('0x43'),_0x161532,JSON[_0xdb7f('0x11')](_0x418406));_0x52bd9a(_0x418406);})[_0xdb7f('0x19')](function(_0x11a7c1){logger['error']('GetCampaignHopperHistory',_0x11a7c1[_0xdb7f('0x14')],_0x161532);_0x14537e(_0x199e7e['error'](0x1f4,_0x11a7c1['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 71ed661..b8568e7 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 _0xfea2=['index','describe','/:id','show','post','isAuthenticated','put','update','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0xfea2,0x117));var _0x2fea=function(_0x2ac2de,_0x109a1e){_0x2ac2de=_0x2ac2de-0x0;var _0xf453a1=_0xfea2[_0x2ac2de];return _0xf453a1;};'use strict';var multer=require('multer');var util=require(_0x2fea('0x0'));var path=require(_0x2fea('0x1'));var timeout=require(_0x2fea('0x2'));var express=require('express');var router=express[_0x2fea('0x3')]();var auth=require(_0x2fea('0x4'));var interaction=require(_0x2fea('0x5'));var config=require(_0x2fea('0x6'));var controller=require(_0x2fea('0x7'));router[_0x2fea('0x8')]('/',auth['isAuthenticated'](),controller[_0x2fea('0x9')]);router[_0x2fea('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x2fea('0xa')]);router[_0x2fea('0x8')](_0x2fea('0xb'),auth['isAuthenticated'](),controller[_0x2fea('0xc')]);router[_0x2fea('0xd')]('/',auth[_0x2fea('0xe')](),controller['create']);router[_0x2fea('0xf')](_0x2fea('0xb'),auth[_0x2fea('0xe')](),controller[_0x2fea('0x10')]);module[_0x2fea('0x11')]=router; \ No newline at end of file +var _0x8e29=['put','update','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','get','/describe','/:id','post','create'];(function(_0x412376,_0x482fc2){var _0xae59bf=function(_0x6e8d7e){while(--_0x6e8d7e){_0x412376['push'](_0x412376['shift']());}};_0xae59bf(++_0x482fc2);}(_0x8e29,0xbe));var _0x98e2=function(_0x5a2349,_0x9194aa){_0x5a2349=_0x5a2349-0x0;var _0x2b7d6e=_0x8e29[_0x5a2349];return _0x2b7d6e;};'use strict';var multer=require('multer');var util=require(_0x98e2('0x0'));var path=require(_0x98e2('0x1'));var timeout=require(_0x98e2('0x2'));var express=require('express');var router=express[_0x98e2('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x98e2('0x4'));var config=require(_0x98e2('0x5'));var controller=require(_0x98e2('0x6'));router['get']('/',auth[_0x98e2('0x7')](),controller[_0x98e2('0x8')]);router[_0x98e2('0x9')](_0x98e2('0xa'),auth[_0x98e2('0x7')](),controller['describe']);router[_0x98e2('0x9')](_0x98e2('0xb'),auth[_0x98e2('0x7')](),controller['show']);router[_0x98e2('0xc')]('/',auth[_0x98e2('0x7')](),controller[_0x98e2('0xd')]);router[_0x98e2('0xe')](_0x98e2('0xb'),auth[_0x98e2('0x7')](),controller[_0x98e2('0xf')]);module[_0x98e2('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 4653c98..2f4e74f 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 _0xe806=['name','sequelize','STRING'];(function(_0x220552,_0x292ad4){var _0xa04a85=function(_0x3336e1){while(--_0x3336e1){_0x220552['push'](_0x220552['shift']());}};_0xa04a85(++_0x292ad4);}(_0xe806,0x8b));var _0x6e80=function(_0x3cf59d,_0xc155ed){_0x3cf59d=_0x3cf59d-0x0;var _0x3bb59a=_0xe806[_0x3cf59d];return _0x3bb59a;};'use strict';var Sequelize=require(_0x6e80('0x0'));module['exports']={'name':{'type':Sequelize[_0x6e80('0x1')],'unique':_0x6e80('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd3a2=['exports','STRING','name','sequelize'];(function(_0x39ff5c,_0x3de001){var _0x1eba54=function(_0x1fcfaa){while(--_0x1fcfaa){_0x39ff5c['push'](_0x39ff5c['shift']());}};_0x1eba54(++_0x3de001);}(_0xd3a2,0x1d7));var _0x2d3a=function(_0x10ccb6,_0x49bded){_0x10ccb6=_0x10ccb6-0x0;var _0x17ceae=_0xd3a2[_0x10ccb6];return _0x17ceae;};'use strict';var Sequelize=require(_0x2d3a('0x0'));module[_0x2d3a('0x1')]={'name':{'type':Sequelize[_0x2d3a('0x2')],'unique':_0x2d3a('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x2d3a('0x2')]},'dialPrefix':{'type':Sequelize[_0x2d3a('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 9244546..9f167d6 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 _0xa9e0=['number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','getCustomFields','addAgents','spread','removeAgents','emit','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','addDisposition','Disposition','getDispositions','findOne','ListId','ids','CmContact','describe','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','hasOwnProperty','raw','getContactsCsv','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT'];(function(_0x19c7e8,_0x1b1f1d){var _0x36c64f=function(_0x1deccf){while(--_0x1deccf){_0x19c7e8['push'](_0x19c7e8['shift']());}};_0x36c64f(++_0x1b1f1d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x16b1ca=_0x4d00e6['get']({'plain':!![]});var _0x59181e=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0x59181e,'resourceId':_0x16b1ca['id']}})[_0x0a9e('0x22')](function(){return _0x4d00e6;});})['then'](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a1e7,_0x5bfb33){return function(_0x1dc186){if(!_0x1dc186){_0x45a1e7[_0x0a9e('0x25')](0x194);}return _0x1dc186;};}function handleError(_0x25fba9,_0x14433c){_0x14433c=_0x14433c||0x1f4;return function(_0x140511){logger[_0x0a9e('0x26')](_0x140511[_0x0a9e('0x27')]);if(_0x140511[_0x0a9e('0x28')]){delete _0x140511['name'];}_0x25fba9[_0x0a9e('0x1a')](_0x14433c)[_0x0a9e('0x29')](_0x140511);};}exports[_0x0a9e('0x2a')]=function(_0x2ec755,_0x5c877d){var _0x15b200={},_0x40e7a3={},_0x1843b2={'count':0x0,'rows':[]};var _0x824a4f=_[_0x0a9e('0x2b')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')],function(_0x2e8759){return{'name':_0x2e8759[_0x0a9e('0x2e')],'type':_0x2e8759['type'][_0x0a9e('0x2f')]};});_0x40e7a3['model']=_[_0x0a9e('0x2b')](_0x824a4f,_0x0a9e('0x28'));_0x40e7a3[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2ec755[_0x0a9e('0x30')]);_0x40e7a3['filters']=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],_0x40e7a3[_0x0a9e('0x30')]);_0x15b200[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x2ec755[_0x0a9e('0x30')]['fields']));_0x15b200[_0x0a9e('0x34')]=_0x15b200['attributes'][_0x0a9e('0x36')]?_0x15b200[_0x0a9e('0x34')]:_0x40e7a3[_0x0a9e('0x33')];if(!_0x2ec755[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x15b200[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2ec755[_0x0a9e('0x30')]['limit']);_0x15b200['offset']=qs[_0x0a9e('0x1c')](_0x2ec755['query'][_0x0a9e('0x1c')]);}_0x15b200[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x2ec755[_0x0a9e('0x30')]['sort']);_0x15b200[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x2ec755['query'],_0x40e7a3[_0x0a9e('0x3b')]),_0x824a4f);if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x15b200['where']=_['merge'](_0x15b200[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x824a4f,function(_0x5adda1){if(_0x5adda1[_0x0a9e('0x3e')]!==_0x0a9e('0x3f')){var _0x2e1b3a={};_0x2e1b3a[_0x5adda1[_0x0a9e('0x28')]]={'$like':'%'+_0x2ec755['query']['filter']+'%'};return _0x2e1b3a;}})});}_0x15b200=_[_0x0a9e('0x40')]({},_0x15b200,_0x2ec755[_0x0a9e('0x41')]);var _0x53f3ee={'where':_0x15b200[_0x0a9e('0x3a')]};return db[_0x0a9e('0x2c')][_0x0a9e('0x1b')](_0x53f3ee)['then'](function(_0x316c8f){_0x1843b2[_0x0a9e('0x1b')]=_0x316c8f;if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x15b200[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x2c')][_0x0a9e('0x44')](_0x15b200);})[_0x0a9e('0x22')](function(_0x23b089){_0x1843b2[_0x0a9e('0x45')]=_0x23b089;return _0x1843b2;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5c877d,_0x15b200))[_0x0a9e('0x46')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x47')]=function(_0x11ca30,_0x37f6cc){var _0x4d04c8={'raw':![],'where':{'id':_0x11ca30[_0x0a9e('0x48')]['id']}},_0x52628e={};_0x52628e[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')]);_0x52628e[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x11ca30[_0x0a9e('0x30')]);_0x52628e[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],_0x52628e[_0x0a9e('0x30')]);_0x4d04c8['attributes']=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x11ca30[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x4d04c8[_0x0a9e('0x34')]=_0x4d04c8[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4d04c8['attributes']:_0x52628e[_0x0a9e('0x33')];if(_0x11ca30['query'][_0x0a9e('0x42')]){_0x4d04c8[_0x0a9e('0x43')]=[{'all':!![]}];}_0x4d04c8=_[_0x0a9e('0x40')]({},_0x4d04c8,_0x11ca30['options']);return db[_0x0a9e('0x2c')][_0x0a9e('0x49')](_0x4d04c8)[_0x0a9e('0x22')](handleEntityNotFound(_0x37f6cc,null))[_0x0a9e('0x22')](respondWithResult(_0x37f6cc,null))[_0x0a9e('0x46')](handleError(_0x37f6cc,null));};exports[_0x0a9e('0x4a')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x2c')][_0x0a9e('0x4a')](_0x45bf7f[_0x0a9e('0x4b')],{})[_0x0a9e('0x22')](function(_0x409789){var _0x992c77=_0x45bf7f[_0x0a9e('0x4c')][_0x0a9e('0x4d')]({'plain':!![]});if(!_0x992c77)throw new Error(_0x0a9e('0x4e'));if(_0x992c77['role']===_0x0a9e('0x4c')){var _0x3fe430=_0x409789['get']({'plain':!![]});var _0x4ae14b='Lists';return db[_0x0a9e('0x4f')][_0x0a9e('0x49')]({'where':{'name':_0x4ae14b,'userProfileId':_0x992c77[_0x0a9e('0x50')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x61bb17){if(_0x61bb17&&_0x61bb17[_0x0a9e('0x51')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x4a')]({'name':_0x3fe430['name'],'resourceId':_0x3fe430['id'],'type':_0x61bb17['name'],'sectionId':_0x61bb17['id']},{})['then'](function(){return _0x409789;});}else{return _0x409789;}})[_0x0a9e('0x46')](function(_0x204173){logger[_0x0a9e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x204173);throw _0x204173;});}return _0x409789;})[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,0xc9))[_0x0a9e('0x46')](handleError(_0x5bbcde,null));};exports['update']=function(_0x5a88da,_0x2ef381){if(_0x5a88da['body']['id']){delete _0x5a88da[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x5a88da[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x2ef381,null))['then'](saveUpdates(_0x5a88da[_0x0a9e('0x4b')],null))[_0x0a9e('0x22')](respondWithResult(_0x2ef381,null))['catch'](handleError(_0x2ef381,null));};exports['destroy']=function(_0x128aa6,_0x3aedd0){return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x128aa6['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3aedd0,null))['then'](removeEntity(_0x3aedd0,null))[_0x0a9e('0x46')](handleError(_0x3aedd0,null));};exports['describe']=function(_0x5da27d,_0x5df0ad){return db[_0x0a9e('0x2c')]['describe']()[_0x0a9e('0x22')](respondWithResult(_0x5df0ad,null))[_0x0a9e('0x46')](handleError(_0x5df0ad,null));};exports[_0x0a9e('0x52')]=function(_0x19b4df,_0x232830,_0x272738){if(_0x19b4df[_0x0a9e('0x4b')]['id']){delete _0x19b4df[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x19b4df[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x232830,null))[_0x0a9e('0x22')](function(_0xb83dfd){if(_0xb83dfd){_0x19b4df[_0x0a9e('0x4b')]['ListId']=_0xb83dfd['id'];return db[_0x0a9e('0x53')][_0x0a9e('0x4a')](_0x19b4df['body']);}})[_0x0a9e('0x22')](respondWithResult(_0x232830,null))['catch'](handleError(_0x232830,null));};exports[_0x0a9e('0x54')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'raw':![],'where':{}};var _0x49d231={};var _0x2244d6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4b3c1a,null))[_0x0a9e('0x22')](function(_0x49eed0){if(_0x49eed0){_0x49d231[_0x0a9e('0x33')]=_['keys'](db[_0x0a9e('0x53')][_0x0a9e('0x2d')]);_0x49d231[_0x0a9e('0x30')]=_['keys'](_0x5ba1f9[_0x0a9e('0x30')]);_0x49d231[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x49d231[_0x0a9e('0x33')],_0x49d231['query']);_0x273cb5[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x49d231['model'],qs[_0x0a9e('0x35')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x273cb5[_0x0a9e('0x34')]=_0x273cb5[_0x0a9e('0x34')]['length']?_0x273cb5[_0x0a9e('0x34')]:_0x49d231[_0x0a9e('0x33')];if(!_0x5ba1f9[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x273cb5['limit']=qs['limit'](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x273cb5[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x273cb5[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x273cb5[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x5ba1f9[_0x0a9e('0x30')],_0x49d231[_0x0a9e('0x3b')]));_0x273cb5[_0x0a9e('0x3a')][_0x0a9e('0x56')]=_0x49eed0['id'];if(_0x5ba1f9[_0x0a9e('0x30')]['filter']){_0x273cb5[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x273cb5[_0x0a9e('0x3a')],{'$or':_['map'](_0x273cb5[_0x0a9e('0x34')],function(_0x30944e){var _0x4b341d={};_0x4b341d[_0x30944e]={'$like':'%'+_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x4b341d;})});}_0x273cb5=_[_0x0a9e('0x40')]({},_0x273cb5,_0x5ba1f9[_0x0a9e('0x41')]);return db[_0x0a9e('0x53')]['count']({'where':_0x273cb5['where']})['then'](function(_0x40fb85){_0x2244d6[_0x0a9e('0x1b')]=_0x40fb85;if(_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x273cb5[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x53')][_0x0a9e('0x44')](_0x273cb5);})[_0x0a9e('0x22')](function(_0x5512d1){_0x2244d6[_0x0a9e('0x45')]=_0x5512d1;return _0x2244d6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4b3c1a,_0x273cb5))[_0x0a9e('0x46')](handleError(_0x4b3c1a,null));};exports['removeDispositions']=function(_0x2bdc44,_0x583b2e,_0x4437ff){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x2bdc44[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x583b2e,null))[_0x0a9e('0x22')](function(_0x317c0c){if(_0x317c0c){return _0x317c0c['removeDispositions'](_0x2bdc44[_0x0a9e('0x30')][_0x0a9e('0x57')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x583b2e,null))[_0x0a9e('0x46')](handleError(_0x583b2e,null));};exports['addContacts']=function(_0x109ccb,_0x3d91db,_0x2d5506){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x109ccb[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3d91db,null))[_0x0a9e('0x22')](function(_0xf410e5){if(_0xf410e5){var _0x332367=[];var _0xdb98ca={'success':[],'errors':[]};return db[_0x0a9e('0x58')][_0x0a9e('0x59')]()[_0x0a9e('0x22')](function(_0x336dc3){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]&&_[_0x0a9e('0x5b')](_0x109ccb[_0x0a9e('0x4b')]['tags'])){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x36')]){_0x109ccb['body'][_0x0a9e('0x5a')]=_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x5c')](';')+';';}else{_0x109ccb['body']['tags']=null;}}else{_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]=null;}if(_0x109ccb['body']&&_[_0x0a9e('0x5b')](_0x109ccb['body'])){for(var _0x260f4b=0x0;_0x260f4b<_0x109ccb[_0x0a9e('0x4b')]['length'];_0x260f4b+=0x1){_0x109ccb[_0x0a9e('0x4b')][_0x260f4b][_0x0a9e('0x56')]=_0x109ccb[_0x0a9e('0x48')]['id'];_0x332367[_0x0a9e('0x5d')](_0x109ccb[_0x0a9e('0x4b')][_0x260f4b]);}return BPromise[_0x0a9e('0x5e')](_0x332367,function(_0x444f1f){return db['CmContact'][_0x0a9e('0x4a')](_[_0x0a9e('0x5f')](_0x444f1f,[_0x0a9e('0x57'),'id'])||{},{'fields':_[_0x0a9e('0x31')](_0x336dc3),'raw':!![]})['then'](function(_0xf51744){_0xdb98ca[_0x0a9e('0x60')]['push'](_0xf51744[_0x0a9e('0x61')]);})['catch'](function(_0x163710){_0xdb98ca[_0x0a9e('0x62')][_0x0a9e('0x5d')]({'data':_0x444f1f,'error':_0x163710[_0x0a9e('0x63')]});});})['then'](function(_0x51ccd7){return _0xdb98ca;})[_0x0a9e('0x46')](function(_0x2b9c01){return _0x2b9c01;});}else{_0x3d91db[_0x0a9e('0x1a')](0x190)['json']({'message':_0x0a9e('0x64')});}});}})[_0x0a9e('0x22')](respondWithResult(_0x3d91db,null))['catch'](handleError(_0x3d91db,null));};exports['getContacts']=function(_0xf0a802,_0x56acca,_0x5ea541){var _0x4dc6b3;return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0xf0a802[_0x0a9e('0x48')]['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x56acca,null))['then'](function(_0x5fd5db){if(_0x5fd5db){_0x4dc6b3=_0x5fd5db;return db['CmContact'][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x18ad56){if(_0x18ad56){var _0x4566b0={};var _0x50f8d7={};_0x50f8d7[_0x0a9e('0x33')]=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x18ad56),_['map'](_0x4dc6b3[_0x0a9e('0x66')],function(_0x21e592){return util[_0x0a9e('0x68')](_0x0a9e('0x69'),_0x21e592['id']);}));_0x50f8d7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0xf0a802[_0x0a9e('0x30')]);_0x50f8d7[_0x0a9e('0x3b')]=_['intersection'](_0x50f8d7[_0x0a9e('0x33')],_0x50f8d7[_0x0a9e('0x30')]);_0x4566b0['attributes']=_[_0x0a9e('0x32')](_0x50f8d7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0xf0a802['query'][_0x0a9e('0x35')]));_0x4566b0['attributes']=_0x4566b0[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4566b0[_0x0a9e('0x34')]:_0x50f8d7[_0x0a9e('0x33')];if(!_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x4566b0[_0x0a9e('0x1d')]=qs['limit'](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x4566b0[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x4566b0[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x4566b0[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0xf0a802['query'],_0x50f8d7[_0x0a9e('0x3b')]));_0x4566b0[_0x0a9e('0x6b')]=!![];if(_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x4566b0[_0x0a9e('0x3a')]=_['merge'](_0x4566b0[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x4566b0['attributes'],function(_0x23b447){var _0x5e725e={};_0x5e725e[_0x23b447]={'$like':'%'+_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x5e725e;})});}_0x4566b0=_[_0x0a9e('0x40')]({},_0x4566b0,_0xf0a802[_0x0a9e('0x41')]);return _0x4dc6b3['getContacts'](_0x4566b0);}})[_0x0a9e('0x22')](respondWithResult(_0x56acca,null))['catch'](handleError(_0x56acca,null));};exports[_0x0a9e('0x6c')]=function(_0x3d0a77,_0x5e5b89,_0x231c6a){var _0x63c9f7;return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x3d0a77['params']['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x5e5b89,null))[_0x0a9e('0x22')](function(_0x3f2f40){if(_0x3f2f40){_0x63c9f7=_0x3f2f40;return db[_0x0a9e('0x58')][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x3f8124){if(_0x3f8124){var _0x586510={};var _0x3156c7={};_0x3156c7['model']=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x3f8124),_[_0x0a9e('0x2b')](_0x63c9f7[_0x0a9e('0x66')],function(_0x1b61d5){return util['format'](_0x0a9e('0x69'),_0x1b61d5['id']);}));_0x3156c7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x3d0a77[_0x0a9e('0x30')]);_0x3156c7[_0x0a9e('0x3b')]=_['intersection'](_0x3156c7['model'],_0x3156c7[_0x0a9e('0x30')]);_0x586510['attributes']=_[_0x0a9e('0x32')](_0x3156c7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x586510[_0x0a9e('0x34')]=_0x586510['attributes']['length']?_0x586510[_0x0a9e('0x34')]:_0x3156c7['model'];if(!_0x3d0a77[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x586510['limit']=qs['limit'](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x586510['offset']=qs[_0x0a9e('0x1c')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x586510[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x3d0a77['query']['sort']);_0x586510[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x3d0a77[_0x0a9e('0x30')],_0x3156c7[_0x0a9e('0x3b')]));_0x586510['raw']=!![];if(_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x586510['where']=_[_0x0a9e('0x40')](_0x586510[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x586510[_0x0a9e('0x34')],function(_0x23b25b){var _0x23b39e={};_0x23b39e[_0x23b25b]={'$like':'%'+_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x23b39e;})});}_0x586510=_[_0x0a9e('0x40')]({},_0x586510,_0x3d0a77[_0x0a9e('0x41')]);return _0x63c9f7['getContacts'](_0x586510);}})[_0x0a9e('0x22')](function(_0x301047){if(!_[_0x0a9e('0x6d')](_0x301047)){var _0x1c4232=toCsv(_0x301047);var _0x1d0b02=Date['now']();fs['writeFileSync'](util[_0x0a9e('0x68')](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02),_0x1c4232);_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x70'),_0x0a9e('0x71')+util['format'](_0x0a9e('0x72'),_0x63c9f7['id'],_0x1d0b02));_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x73'),'text/csv');return _0x5e5b89[_0x0a9e('0x74')](util['format'](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02));}else{return _0x5e5b89['sendStatus'](0xcc);}})[_0x0a9e('0x46')](handleError(_0x5e5b89,null));};exports[_0x0a9e('0x75')]=function(_0xe339b1,_0x5c500c,_0xc9529d){var _0x5ed560;delete _0xe339b1[_0x0a9e('0x4b')]['id'];return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0xe339b1[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5c500c,null))[_0x0a9e('0x22')](function(_0x4014c7){if(_0x4014c7){return db[_0x0a9e('0x76')][_0x0a9e('0x77')](function(_0x27d1f5){return db[_0x0a9e('0x65')][_0x0a9e('0x4a')](_0xe339b1[_0x0a9e('0x4b')],{'transaction':_0x27d1f5})[_0x0a9e('0x22')](function(_0x98c62c){_0x5ed560=_0x98c62c;return _0x4014c7[_0x0a9e('0x78')](_0x98c62c,{'transaction':_0x27d1f5});})['then'](function(){var _0x556443={'type':db[_0x0a9e('0x79')]['TEXT'],'transaction':_0x27d1f5};switch(_0xe339b1[_0x0a9e('0x4b')][_0x0a9e('0x3e')]){case'text':_0x556443[_0x0a9e('0x3e')]=db[_0x0a9e('0x79')][_0x0a9e('0x7a')];break;case _0x0a9e('0x7b'):_0x556443['type']=db[_0x0a9e('0x79')][_0x0a9e('0x7c')];break;case _0x0a9e('0x7d'):_0x556443[_0x0a9e('0x3e')]=db['Sequelize'][_0x0a9e('0x7e')];_0x556443[_0x0a9e('0x7f')]=![];break;default:}return db[_0x0a9e('0x76')]['queryInterface'][_0x0a9e('0x80')](_0x0a9e('0x81'),util[_0x0a9e('0x68')]('cf_%s',_0x5ed560['id']),_0x556443);})[_0x0a9e('0x22')](function(){return _0x5ed560;});});}})[_0x0a9e('0x22')](respondWithResult(_0x5c500c,null))[_0x0a9e('0x46')](handleError(_0x5c500c,null));};exports[_0x0a9e('0x82')]=function(_0x2394d3,_0x555780,_0x3211d2){var _0x289e65={};var _0x4795ae={};var _0x3bab3e;var _0x1fcfe6;return db[_0x0a9e('0x2c')]['findOne']({'where':{'id':_0x2394d3['params']['id']}})['then'](handleEntityNotFound(_0x555780,null))[_0x0a9e('0x22')](function(_0x4a70ce){if(_0x4a70ce){_0x3bab3e=_0x4a70ce;_0x4795ae['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x65')][_0x0a9e('0x2d')]);_0x4795ae['query']=_[_0x0a9e('0x31')](_0x2394d3[_0x0a9e('0x30')]);_0x4795ae[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],_0x4795ae[_0x0a9e('0x30')]);_0x289e65[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],qs['fields'](_0x2394d3[_0x0a9e('0x30')]['fields']));_0x289e65[_0x0a9e('0x34')]=_0x289e65[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x289e65[_0x0a9e('0x34')]:_0x4795ae[_0x0a9e('0x33')];_0x289e65[_0x0a9e('0x38')]=qs['sort'](_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x289e65[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x2394d3[_0x0a9e('0x30')],_0x4795ae[_0x0a9e('0x3b')]));_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':[{'ListId':_0x4a70ce['id']},{'ListId':null}]});if(_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':_['map'](_0x289e65[_0x0a9e('0x34')],function(_0x88b25f){var _0x2ff265={};_0x2ff265[_0x88b25f]={'$like':'%'+_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x2ff265;})});}_0x289e65=_[_0x0a9e('0x40')]({},_0x289e65,_0x2394d3[_0x0a9e('0x41')]);return db[_0x0a9e('0x65')]['findAndCountAll'](_0x289e65);}})[_0x0a9e('0x22')](respondWithResult(_0x555780,null))[_0x0a9e('0x46')](handleError(_0x555780,null));};exports[_0x0a9e('0x83')]=function(_0x5c65fc,_0x1402c7,_0x41e446){return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0x5c65fc[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1402c7,null))[_0x0a9e('0x22')](function(_0x336a19){if(_0x336a19){return _0x336a19[_0x0a9e('0x83')](_0x5c65fc[_0x0a9e('0x4b')]['ids'],_[_0x0a9e('0x5f')](_0x5c65fc[_0x0a9e('0x4b')],[_0x0a9e('0x57'),'id'])||{})[_0x0a9e('0x84')](function(_0x2b624e){for(var _0x3942fd=0x0;_0x3942fd<_0x5c65fc['body'][_0x0a9e('0x57')]['length'];_0x3942fd+=0x1){socket['emit']('userCmList:save',{'UserId':_0x5c65fc[_0x0a9e('0x4b')][_0x0a9e('0x57')][_0x3942fd],'CmListId':_0x5c65fc[_0x0a9e('0x48')]['id']});}return _0x2b624e;});}})[_0x0a9e('0x22')](respondWithResult(_0x1402c7,null))['catch'](handleError(_0x1402c7,null));};exports[_0x0a9e('0x85')]=function(_0x309fa9,_0x3ddbc7,_0x1fdb10){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x309fa9['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3ddbc7,null))[_0x0a9e('0x22')](function(_0x2a293f){if(_0x2a293f){return _0x2a293f['removeAgents'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])[_0x0a9e('0x22')](function(){if(_['isArray'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])){for(var _0x15ba6b=0x0;_0x15ba6b<_0x309fa9['query'][_0x0a9e('0x57')][_0x0a9e('0x36')];_0x15ba6b+=0x1){socket[_0x0a9e('0x86')]('userCmList:remove',{'UserId':Number(_0x309fa9['query']['ids'][_0x15ba6b]),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}}else{socket[_0x0a9e('0x86')](_0x0a9e('0x87'),{'UserId':Number(_0x309fa9[_0x0a9e('0x30')]['ids']),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ddbc7,null))[_0x0a9e('0x46')](handleError(_0x3ddbc7,null));};exports[_0x0a9e('0x88')]=function(_0x242f23,_0x57f673,_0x33b4b3){var _0x33a26c={};var _0xb8a476={};var _0x580dd6;var _0x40eb5d;return db['CmList'][_0x0a9e('0x55')]({'where':{'id':_0x242f23['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x57f673,null))['then'](function(_0xb14971){if(_0xb14971){_0x580dd6=_0xb14971;_0xb8a476[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x89')][_0x0a9e('0x2d')]);_0xb8a476[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x242f23['query']);_0xb8a476[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0xb8a476['model'],_0xb8a476[_0x0a9e('0x30')]);_0x33a26c[_0x0a9e('0x34')]=_['intersection'](_0xb8a476[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x242f23[_0x0a9e('0x30')]['fields']));_0x33a26c[_0x0a9e('0x34')]=_0x33a26c[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x33a26c[_0x0a9e('0x34')]:_0xb8a476[_0x0a9e('0x33')];_0x33a26c[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x33a26c[_0x0a9e('0x3a')]=qs['filters'](_[_0x0a9e('0x3c')](_0x242f23['query'],_0xb8a476[_0x0a9e('0x3b')]));if(_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x33a26c[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x33a26c[_0x0a9e('0x3a')],{'$or':_['map'](_0x33a26c[_0x0a9e('0x34')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x242f23['query'][_0x0a9e('0x3d')]+'%'};return _0x2977a7;})});}_0x33a26c=_[_0x0a9e('0x40')]({},_0x33a26c,_0x242f23[_0x0a9e('0x41')]);return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1d0a78){if(_0x1d0a78){_0x40eb5d=_0x1d0a78[_0x0a9e('0x36')];if(!_0x242f23['query'][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x33a26c[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x33a26c[_0x0a9e('0x1c')]=qs['offset'](_0x242f23['query'][_0x0a9e('0x1c')]);}return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1bf692){if(_0x1bf692){return _0x1bf692?{'count':_0x40eb5d,'rows':_0x1bf692}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x57f673,null))[_0x0a9e('0x46')](handleError(_0x57f673,null));}; \ No newline at end of file +var _0xa9e0=['number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','getCustomFields','addAgents','spread','removeAgents','emit','userCmList:remove','getAgents','User','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','Lists','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','addDisposition','Disposition','getDispositions','findOne','ListId','ids','CmContact','describe','tags','isArray','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','hasOwnProperty','raw','getContactsCsv','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT'];(function(_0x19ef90,_0x26f77b){var _0x825ce7=function(_0x3c0b67){while(--_0x3c0b67){_0x19ef90['push'](_0x19ef90['shift']());}};_0x825ce7(++_0x26f77b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){var _0x16b1ca=_0x4d00e6['get']({'plain':!![]});var _0x59181e=_0x0a9e('0x23');return db[_0x0a9e('0x24')][_0x0a9e('0x21')]({'where':{'type':_0x59181e,'resourceId':_0x16b1ca['id']}})[_0x0a9e('0x22')](function(){return _0x4d00e6;});})['then'](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a1e7,_0x5bfb33){return function(_0x1dc186){if(!_0x1dc186){_0x45a1e7[_0x0a9e('0x25')](0x194);}return _0x1dc186;};}function handleError(_0x25fba9,_0x14433c){_0x14433c=_0x14433c||0x1f4;return function(_0x140511){logger[_0x0a9e('0x26')](_0x140511[_0x0a9e('0x27')]);if(_0x140511[_0x0a9e('0x28')]){delete _0x140511['name'];}_0x25fba9[_0x0a9e('0x1a')](_0x14433c)[_0x0a9e('0x29')](_0x140511);};}exports[_0x0a9e('0x2a')]=function(_0x2ec755,_0x5c877d){var _0x15b200={},_0x40e7a3={},_0x1843b2={'count':0x0,'rows':[]};var _0x824a4f=_[_0x0a9e('0x2b')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')],function(_0x2e8759){return{'name':_0x2e8759[_0x0a9e('0x2e')],'type':_0x2e8759['type'][_0x0a9e('0x2f')]};});_0x40e7a3['model']=_[_0x0a9e('0x2b')](_0x824a4f,_0x0a9e('0x28'));_0x40e7a3[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x2ec755[_0x0a9e('0x30')]);_0x40e7a3['filters']=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],_0x40e7a3[_0x0a9e('0x30')]);_0x15b200[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x40e7a3[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x2ec755[_0x0a9e('0x30')]['fields']));_0x15b200[_0x0a9e('0x34')]=_0x15b200['attributes'][_0x0a9e('0x36')]?_0x15b200[_0x0a9e('0x34')]:_0x40e7a3[_0x0a9e('0x33')];if(!_0x2ec755[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x15b200[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x2ec755[_0x0a9e('0x30')]['limit']);_0x15b200['offset']=qs[_0x0a9e('0x1c')](_0x2ec755['query'][_0x0a9e('0x1c')]);}_0x15b200[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x2ec755[_0x0a9e('0x30')]['sort']);_0x15b200[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x2ec755['query'],_0x40e7a3[_0x0a9e('0x3b')]),_0x824a4f);if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x15b200['where']=_['merge'](_0x15b200[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x824a4f,function(_0x5adda1){if(_0x5adda1[_0x0a9e('0x3e')]!==_0x0a9e('0x3f')){var _0x2e1b3a={};_0x2e1b3a[_0x5adda1[_0x0a9e('0x28')]]={'$like':'%'+_0x2ec755['query']['filter']+'%'};return _0x2e1b3a;}})});}_0x15b200=_[_0x0a9e('0x40')]({},_0x15b200,_0x2ec755[_0x0a9e('0x41')]);var _0x53f3ee={'where':_0x15b200[_0x0a9e('0x3a')]};return db[_0x0a9e('0x2c')][_0x0a9e('0x1b')](_0x53f3ee)['then'](function(_0x316c8f){_0x1843b2[_0x0a9e('0x1b')]=_0x316c8f;if(_0x2ec755[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x15b200[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x2c')][_0x0a9e('0x44')](_0x15b200);})[_0x0a9e('0x22')](function(_0x23b089){_0x1843b2[_0x0a9e('0x45')]=_0x23b089;return _0x1843b2;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x5c877d,_0x15b200))[_0x0a9e('0x46')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x47')]=function(_0x11ca30,_0x37f6cc){var _0x4d04c8={'raw':![],'where':{'id':_0x11ca30[_0x0a9e('0x48')]['id']}},_0x52628e={};_0x52628e[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')]);_0x52628e[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x11ca30[_0x0a9e('0x30')]);_0x52628e[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],_0x52628e[_0x0a9e('0x30')]);_0x4d04c8['attributes']=_[_0x0a9e('0x32')](_0x52628e[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x11ca30[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x4d04c8[_0x0a9e('0x34')]=_0x4d04c8[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4d04c8['attributes']:_0x52628e[_0x0a9e('0x33')];if(_0x11ca30['query'][_0x0a9e('0x42')]){_0x4d04c8[_0x0a9e('0x43')]=[{'all':!![]}];}_0x4d04c8=_[_0x0a9e('0x40')]({},_0x4d04c8,_0x11ca30['options']);return db[_0x0a9e('0x2c')][_0x0a9e('0x49')](_0x4d04c8)[_0x0a9e('0x22')](handleEntityNotFound(_0x37f6cc,null))[_0x0a9e('0x22')](respondWithResult(_0x37f6cc,null))[_0x0a9e('0x46')](handleError(_0x37f6cc,null));};exports[_0x0a9e('0x4a')]=function(_0x45bf7f,_0x5bbcde){return db[_0x0a9e('0x2c')][_0x0a9e('0x4a')](_0x45bf7f[_0x0a9e('0x4b')],{})[_0x0a9e('0x22')](function(_0x409789){var _0x992c77=_0x45bf7f[_0x0a9e('0x4c')][_0x0a9e('0x4d')]({'plain':!![]});if(!_0x992c77)throw new Error(_0x0a9e('0x4e'));if(_0x992c77['role']===_0x0a9e('0x4c')){var _0x3fe430=_0x409789['get']({'plain':!![]});var _0x4ae14b='Lists';return db[_0x0a9e('0x4f')][_0x0a9e('0x49')]({'where':{'name':_0x4ae14b,'userProfileId':_0x992c77[_0x0a9e('0x50')]},'raw':!![]})[_0x0a9e('0x22')](function(_0x61bb17){if(_0x61bb17&&_0x61bb17[_0x0a9e('0x51')]===0x0){return db[_0x0a9e('0x24')][_0x0a9e('0x4a')]({'name':_0x3fe430['name'],'resourceId':_0x3fe430['id'],'type':_0x61bb17['name'],'sectionId':_0x61bb17['id']},{})['then'](function(){return _0x409789;});}else{return _0x409789;}})[_0x0a9e('0x46')](function(_0x204173){logger[_0x0a9e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x204173);throw _0x204173;});}return _0x409789;})[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,0xc9))[_0x0a9e('0x46')](handleError(_0x5bbcde,null));};exports['update']=function(_0x5a88da,_0x2ef381){if(_0x5a88da['body']['id']){delete _0x5a88da[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x5a88da[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x2ef381,null))['then'](saveUpdates(_0x5a88da[_0x0a9e('0x4b')],null))[_0x0a9e('0x22')](respondWithResult(_0x2ef381,null))['catch'](handleError(_0x2ef381,null));};exports['destroy']=function(_0x128aa6,_0x3aedd0){return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x128aa6['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3aedd0,null))['then'](removeEntity(_0x3aedd0,null))[_0x0a9e('0x46')](handleError(_0x3aedd0,null));};exports['describe']=function(_0x5da27d,_0x5df0ad){return db[_0x0a9e('0x2c')]['describe']()[_0x0a9e('0x22')](respondWithResult(_0x5df0ad,null))[_0x0a9e('0x46')](handleError(_0x5df0ad,null));};exports[_0x0a9e('0x52')]=function(_0x19b4df,_0x232830,_0x272738){if(_0x19b4df[_0x0a9e('0x4b')]['id']){delete _0x19b4df[_0x0a9e('0x4b')]['id'];}return db['CmList'][_0x0a9e('0x49')]({'where':{'id':_0x19b4df[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x232830,null))[_0x0a9e('0x22')](function(_0xb83dfd){if(_0xb83dfd){_0x19b4df[_0x0a9e('0x4b')]['ListId']=_0xb83dfd['id'];return db[_0x0a9e('0x53')][_0x0a9e('0x4a')](_0x19b4df['body']);}})[_0x0a9e('0x22')](respondWithResult(_0x232830,null))['catch'](handleError(_0x232830,null));};exports[_0x0a9e('0x54')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'raw':![],'where':{}};var _0x49d231={};var _0x2244d6={'count':0x0,'rows':[]};return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4b3c1a,null))[_0x0a9e('0x22')](function(_0x49eed0){if(_0x49eed0){_0x49d231[_0x0a9e('0x33')]=_['keys'](db[_0x0a9e('0x53')][_0x0a9e('0x2d')]);_0x49d231[_0x0a9e('0x30')]=_['keys'](_0x5ba1f9[_0x0a9e('0x30')]);_0x49d231[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x49d231[_0x0a9e('0x33')],_0x49d231['query']);_0x273cb5[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x49d231['model'],qs[_0x0a9e('0x35')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x273cb5[_0x0a9e('0x34')]=_0x273cb5[_0x0a9e('0x34')]['length']?_0x273cb5[_0x0a9e('0x34')]:_0x49d231[_0x0a9e('0x33')];if(!_0x5ba1f9[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x273cb5['limit']=qs['limit'](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x273cb5[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x273cb5[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x273cb5[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x5ba1f9[_0x0a9e('0x30')],_0x49d231[_0x0a9e('0x3b')]));_0x273cb5[_0x0a9e('0x3a')][_0x0a9e('0x56')]=_0x49eed0['id'];if(_0x5ba1f9[_0x0a9e('0x30')]['filter']){_0x273cb5[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x273cb5[_0x0a9e('0x3a')],{'$or':_['map'](_0x273cb5[_0x0a9e('0x34')],function(_0x30944e){var _0x4b341d={};_0x4b341d[_0x30944e]={'$like':'%'+_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x4b341d;})});}_0x273cb5=_[_0x0a9e('0x40')]({},_0x273cb5,_0x5ba1f9[_0x0a9e('0x41')]);return db[_0x0a9e('0x53')]['count']({'where':_0x273cb5['where']})['then'](function(_0x40fb85){_0x2244d6[_0x0a9e('0x1b')]=_0x40fb85;if(_0x5ba1f9[_0x0a9e('0x30')][_0x0a9e('0x42')]){_0x273cb5[_0x0a9e('0x43')]=[{'all':!![]}];}return db[_0x0a9e('0x53')][_0x0a9e('0x44')](_0x273cb5);})[_0x0a9e('0x22')](function(_0x5512d1){_0x2244d6[_0x0a9e('0x45')]=_0x5512d1;return _0x2244d6;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4b3c1a,_0x273cb5))[_0x0a9e('0x46')](handleError(_0x4b3c1a,null));};exports['removeDispositions']=function(_0x2bdc44,_0x583b2e,_0x4437ff){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x2bdc44[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x583b2e,null))[_0x0a9e('0x22')](function(_0x317c0c){if(_0x317c0c){return _0x317c0c['removeDispositions'](_0x2bdc44[_0x0a9e('0x30')][_0x0a9e('0x57')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x583b2e,null))[_0x0a9e('0x46')](handleError(_0x583b2e,null));};exports['addContacts']=function(_0x109ccb,_0x3d91db,_0x2d5506){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x109ccb[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3d91db,null))[_0x0a9e('0x22')](function(_0xf410e5){if(_0xf410e5){var _0x332367=[];var _0xdb98ca={'success':[],'errors':[]};return db[_0x0a9e('0x58')][_0x0a9e('0x59')]()[_0x0a9e('0x22')](function(_0x336dc3){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]&&_[_0x0a9e('0x5b')](_0x109ccb[_0x0a9e('0x4b')]['tags'])){if(_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x36')]){_0x109ccb['body'][_0x0a9e('0x5a')]=_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')][_0x0a9e('0x5c')](';')+';';}else{_0x109ccb['body']['tags']=null;}}else{_0x109ccb[_0x0a9e('0x4b')][_0x0a9e('0x5a')]=null;}if(_0x109ccb['body']&&_[_0x0a9e('0x5b')](_0x109ccb['body'])){for(var _0x260f4b=0x0;_0x260f4b<_0x109ccb[_0x0a9e('0x4b')]['length'];_0x260f4b+=0x1){_0x109ccb[_0x0a9e('0x4b')][_0x260f4b][_0x0a9e('0x56')]=_0x109ccb[_0x0a9e('0x48')]['id'];_0x332367[_0x0a9e('0x5d')](_0x109ccb[_0x0a9e('0x4b')][_0x260f4b]);}return BPromise[_0x0a9e('0x5e')](_0x332367,function(_0x444f1f){return db['CmContact'][_0x0a9e('0x4a')](_[_0x0a9e('0x5f')](_0x444f1f,[_0x0a9e('0x57'),'id'])||{},{'fields':_[_0x0a9e('0x31')](_0x336dc3),'raw':!![]})['then'](function(_0xf51744){_0xdb98ca[_0x0a9e('0x60')]['push'](_0xf51744[_0x0a9e('0x61')]);})['catch'](function(_0x163710){_0xdb98ca[_0x0a9e('0x62')][_0x0a9e('0x5d')]({'data':_0x444f1f,'error':_0x163710[_0x0a9e('0x63')]});});})['then'](function(_0x51ccd7){return _0xdb98ca;})[_0x0a9e('0x46')](function(_0x2b9c01){return _0x2b9c01;});}else{_0x3d91db[_0x0a9e('0x1a')](0x190)['json']({'message':_0x0a9e('0x64')});}});}})[_0x0a9e('0x22')](respondWithResult(_0x3d91db,null))['catch'](handleError(_0x3d91db,null));};exports['getContacts']=function(_0xf0a802,_0x56acca,_0x5ea541){var _0x4dc6b3;return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0xf0a802[_0x0a9e('0x48')]['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x56acca,null))['then'](function(_0x5fd5db){if(_0x5fd5db){_0x4dc6b3=_0x5fd5db;return db['CmContact'][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x18ad56){if(_0x18ad56){var _0x4566b0={};var _0x50f8d7={};_0x50f8d7[_0x0a9e('0x33')]=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x18ad56),_['map'](_0x4dc6b3[_0x0a9e('0x66')],function(_0x21e592){return util[_0x0a9e('0x68')](_0x0a9e('0x69'),_0x21e592['id']);}));_0x50f8d7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0xf0a802[_0x0a9e('0x30')]);_0x50f8d7[_0x0a9e('0x3b')]=_['intersection'](_0x50f8d7[_0x0a9e('0x33')],_0x50f8d7[_0x0a9e('0x30')]);_0x4566b0['attributes']=_[_0x0a9e('0x32')](_0x50f8d7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0xf0a802['query'][_0x0a9e('0x35')]));_0x4566b0['attributes']=_0x4566b0[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x4566b0[_0x0a9e('0x34')]:_0x50f8d7[_0x0a9e('0x33')];if(!_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x4566b0[_0x0a9e('0x1d')]=qs['limit'](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x4566b0[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x4566b0[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x4566b0[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0xf0a802['query'],_0x50f8d7[_0x0a9e('0x3b')]));_0x4566b0[_0x0a9e('0x6b')]=!![];if(_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x4566b0[_0x0a9e('0x3a')]=_['merge'](_0x4566b0[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x4566b0['attributes'],function(_0x23b447){var _0x5e725e={};_0x5e725e[_0x23b447]={'$like':'%'+_0xf0a802[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x5e725e;})});}_0x4566b0=_[_0x0a9e('0x40')]({},_0x4566b0,_0xf0a802[_0x0a9e('0x41')]);return _0x4dc6b3['getContacts'](_0x4566b0);}})[_0x0a9e('0x22')](respondWithResult(_0x56acca,null))['catch'](handleError(_0x56acca,null));};exports[_0x0a9e('0x6c')]=function(_0x3d0a77,_0x5e5b89,_0x231c6a){var _0x63c9f7;return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x3d0a77['params']['id']},'include':[{'model':db[_0x0a9e('0x65')],'as':_0x0a9e('0x66')}]})[_0x0a9e('0x22')](handleEntityNotFound(_0x5e5b89,null))[_0x0a9e('0x22')](function(_0x3f2f40){if(_0x3f2f40){_0x63c9f7=_0x3f2f40;return db[_0x0a9e('0x58')][_0x0a9e('0x2d')];}})[_0x0a9e('0x22')](function(_0x3f8124){if(_0x3f8124){var _0x586510={};var _0x3156c7={};_0x3156c7['model']=_[_0x0a9e('0x67')](_[_0x0a9e('0x31')](_0x3f8124),_[_0x0a9e('0x2b')](_0x63c9f7[_0x0a9e('0x66')],function(_0x1b61d5){return util['format'](_0x0a9e('0x69'),_0x1b61d5['id']);}));_0x3156c7[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x3d0a77[_0x0a9e('0x30')]);_0x3156c7[_0x0a9e('0x3b')]=_['intersection'](_0x3156c7['model'],_0x3156c7[_0x0a9e('0x30')]);_0x586510['attributes']=_[_0x0a9e('0x32')](_0x3156c7[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x586510[_0x0a9e('0x34')]=_0x586510['attributes']['length']?_0x586510[_0x0a9e('0x34')]:_0x3156c7['model'];if(!_0x3d0a77[_0x0a9e('0x30')]['hasOwnProperty'](_0x0a9e('0x37'))){_0x586510['limit']=qs['limit'](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x586510['offset']=qs[_0x0a9e('0x1c')](_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x1c')]);}_0x586510[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x3d0a77['query']['sort']);_0x586510[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x3c')](_0x3d0a77[_0x0a9e('0x30')],_0x3156c7[_0x0a9e('0x3b')]));_0x586510['raw']=!![];if(_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x586510['where']=_[_0x0a9e('0x40')](_0x586510[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x2b')](_0x586510[_0x0a9e('0x34')],function(_0x23b25b){var _0x23b39e={};_0x23b39e[_0x23b25b]={'$like':'%'+_0x3d0a77[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x23b39e;})});}_0x586510=_[_0x0a9e('0x40')]({},_0x586510,_0x3d0a77[_0x0a9e('0x41')]);return _0x63c9f7['getContacts'](_0x586510);}})[_0x0a9e('0x22')](function(_0x301047){if(!_[_0x0a9e('0x6d')](_0x301047)){var _0x1c4232=toCsv(_0x301047);var _0x1d0b02=Date['now']();fs['writeFileSync'](util[_0x0a9e('0x68')](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02),_0x1c4232);_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x70'),_0x0a9e('0x71')+util['format'](_0x0a9e('0x72'),_0x63c9f7['id'],_0x1d0b02));_0x5e5b89[_0x0a9e('0x6f')](_0x0a9e('0x73'),'text/csv');return _0x5e5b89[_0x0a9e('0x74')](util['format'](_0x0a9e('0x6e'),_0x63c9f7['id'],_0x1d0b02));}else{return _0x5e5b89['sendStatus'](0xcc);}})[_0x0a9e('0x46')](handleError(_0x5e5b89,null));};exports[_0x0a9e('0x75')]=function(_0xe339b1,_0x5c500c,_0xc9529d){var _0x5ed560;delete _0xe339b1[_0x0a9e('0x4b')]['id'];return db[_0x0a9e('0x2c')][_0x0a9e('0x55')]({'where':{'id':_0xe339b1[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5c500c,null))[_0x0a9e('0x22')](function(_0x4014c7){if(_0x4014c7){return db[_0x0a9e('0x76')][_0x0a9e('0x77')](function(_0x27d1f5){return db[_0x0a9e('0x65')][_0x0a9e('0x4a')](_0xe339b1[_0x0a9e('0x4b')],{'transaction':_0x27d1f5})[_0x0a9e('0x22')](function(_0x98c62c){_0x5ed560=_0x98c62c;return _0x4014c7[_0x0a9e('0x78')](_0x98c62c,{'transaction':_0x27d1f5});})['then'](function(){var _0x556443={'type':db[_0x0a9e('0x79')]['TEXT'],'transaction':_0x27d1f5};switch(_0xe339b1[_0x0a9e('0x4b')][_0x0a9e('0x3e')]){case'text':_0x556443[_0x0a9e('0x3e')]=db[_0x0a9e('0x79')][_0x0a9e('0x7a')];break;case _0x0a9e('0x7b'):_0x556443['type']=db[_0x0a9e('0x79')][_0x0a9e('0x7c')];break;case _0x0a9e('0x7d'):_0x556443[_0x0a9e('0x3e')]=db['Sequelize'][_0x0a9e('0x7e')];_0x556443[_0x0a9e('0x7f')]=![];break;default:}return db[_0x0a9e('0x76')]['queryInterface'][_0x0a9e('0x80')](_0x0a9e('0x81'),util[_0x0a9e('0x68')]('cf_%s',_0x5ed560['id']),_0x556443);})[_0x0a9e('0x22')](function(){return _0x5ed560;});});}})[_0x0a9e('0x22')](respondWithResult(_0x5c500c,null))[_0x0a9e('0x46')](handleError(_0x5c500c,null));};exports[_0x0a9e('0x82')]=function(_0x2394d3,_0x555780,_0x3211d2){var _0x289e65={};var _0x4795ae={};var _0x3bab3e;var _0x1fcfe6;return db[_0x0a9e('0x2c')]['findOne']({'where':{'id':_0x2394d3['params']['id']}})['then'](handleEntityNotFound(_0x555780,null))[_0x0a9e('0x22')](function(_0x4a70ce){if(_0x4a70ce){_0x3bab3e=_0x4a70ce;_0x4795ae['model']=_[_0x0a9e('0x31')](db[_0x0a9e('0x65')][_0x0a9e('0x2d')]);_0x4795ae['query']=_[_0x0a9e('0x31')](_0x2394d3[_0x0a9e('0x30')]);_0x4795ae[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],_0x4795ae[_0x0a9e('0x30')]);_0x289e65[_0x0a9e('0x34')]=_[_0x0a9e('0x32')](_0x4795ae[_0x0a9e('0x33')],qs['fields'](_0x2394d3[_0x0a9e('0x30')]['fields']));_0x289e65[_0x0a9e('0x34')]=_0x289e65[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x289e65[_0x0a9e('0x34')]:_0x4795ae[_0x0a9e('0x33')];_0x289e65[_0x0a9e('0x38')]=qs['sort'](_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x289e65[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x2394d3[_0x0a9e('0x30')],_0x4795ae[_0x0a9e('0x3b')]));_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':[{'ListId':_0x4a70ce['id']},{'ListId':null}]});if(_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x289e65[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x289e65[_0x0a9e('0x3a')],{'$or':_['map'](_0x289e65[_0x0a9e('0x34')],function(_0x88b25f){var _0x2ff265={};_0x2ff265[_0x88b25f]={'$like':'%'+_0x2394d3[_0x0a9e('0x30')][_0x0a9e('0x3d')]+'%'};return _0x2ff265;})});}_0x289e65=_[_0x0a9e('0x40')]({},_0x289e65,_0x2394d3[_0x0a9e('0x41')]);return db[_0x0a9e('0x65')]['findAndCountAll'](_0x289e65);}})[_0x0a9e('0x22')](respondWithResult(_0x555780,null))[_0x0a9e('0x46')](handleError(_0x555780,null));};exports[_0x0a9e('0x83')]=function(_0x5c65fc,_0x1402c7,_0x41e446){return db[_0x0a9e('0x2c')][_0x0a9e('0x49')]({'where':{'id':_0x5c65fc[_0x0a9e('0x48')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1402c7,null))[_0x0a9e('0x22')](function(_0x336a19){if(_0x336a19){return _0x336a19[_0x0a9e('0x83')](_0x5c65fc[_0x0a9e('0x4b')]['ids'],_[_0x0a9e('0x5f')](_0x5c65fc[_0x0a9e('0x4b')],[_0x0a9e('0x57'),'id'])||{})[_0x0a9e('0x84')](function(_0x2b624e){for(var _0x3942fd=0x0;_0x3942fd<_0x5c65fc['body'][_0x0a9e('0x57')]['length'];_0x3942fd+=0x1){socket['emit']('userCmList:save',{'UserId':_0x5c65fc[_0x0a9e('0x4b')][_0x0a9e('0x57')][_0x3942fd],'CmListId':_0x5c65fc[_0x0a9e('0x48')]['id']});}return _0x2b624e;});}})[_0x0a9e('0x22')](respondWithResult(_0x1402c7,null))['catch'](handleError(_0x1402c7,null));};exports[_0x0a9e('0x85')]=function(_0x309fa9,_0x3ddbc7,_0x1fdb10){return db[_0x0a9e('0x2c')]['find']({'where':{'id':_0x309fa9['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x3ddbc7,null))[_0x0a9e('0x22')](function(_0x2a293f){if(_0x2a293f){return _0x2a293f['removeAgents'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])[_0x0a9e('0x22')](function(){if(_['isArray'](_0x309fa9[_0x0a9e('0x30')][_0x0a9e('0x57')])){for(var _0x15ba6b=0x0;_0x15ba6b<_0x309fa9['query'][_0x0a9e('0x57')][_0x0a9e('0x36')];_0x15ba6b+=0x1){socket[_0x0a9e('0x86')]('userCmList:remove',{'UserId':Number(_0x309fa9['query']['ids'][_0x15ba6b]),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}}else{socket[_0x0a9e('0x86')](_0x0a9e('0x87'),{'UserId':Number(_0x309fa9[_0x0a9e('0x30')]['ids']),'CmListId':Number(_0x309fa9[_0x0a9e('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ddbc7,null))[_0x0a9e('0x46')](handleError(_0x3ddbc7,null));};exports[_0x0a9e('0x88')]=function(_0x242f23,_0x57f673,_0x33b4b3){var _0x33a26c={};var _0xb8a476={};var _0x580dd6;var _0x40eb5d;return db['CmList'][_0x0a9e('0x55')]({'where':{'id':_0x242f23['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x57f673,null))['then'](function(_0xb14971){if(_0xb14971){_0x580dd6=_0xb14971;_0xb8a476[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](db[_0x0a9e('0x89')][_0x0a9e('0x2d')]);_0xb8a476[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x242f23['query']);_0xb8a476[_0x0a9e('0x3b')]=_[_0x0a9e('0x32')](_0xb8a476['model'],_0xb8a476[_0x0a9e('0x30')]);_0x33a26c[_0x0a9e('0x34')]=_['intersection'](_0xb8a476[_0x0a9e('0x33')],qs[_0x0a9e('0x35')](_0x242f23[_0x0a9e('0x30')]['fields']));_0x33a26c[_0x0a9e('0x34')]=_0x33a26c[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x33a26c[_0x0a9e('0x34')]:_0xb8a476[_0x0a9e('0x33')];_0x33a26c[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x33a26c[_0x0a9e('0x3a')]=qs['filters'](_[_0x0a9e('0x3c')](_0x242f23['query'],_0xb8a476[_0x0a9e('0x3b')]));if(_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x3d')]){_0x33a26c[_0x0a9e('0x3a')]=_[_0x0a9e('0x40')](_0x33a26c[_0x0a9e('0x3a')],{'$or':_['map'](_0x33a26c[_0x0a9e('0x34')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x242f23['query'][_0x0a9e('0x3d')]+'%'};return _0x2977a7;})});}_0x33a26c=_[_0x0a9e('0x40')]({},_0x33a26c,_0x242f23[_0x0a9e('0x41')]);return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1d0a78){if(_0x1d0a78){_0x40eb5d=_0x1d0a78[_0x0a9e('0x36')];if(!_0x242f23['query'][_0x0a9e('0x6a')](_0x0a9e('0x37'))){_0x33a26c[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x242f23[_0x0a9e('0x30')][_0x0a9e('0x1d')]);_0x33a26c[_0x0a9e('0x1c')]=qs['offset'](_0x242f23['query'][_0x0a9e('0x1c')]);}return _0x580dd6[_0x0a9e('0x88')](_0x33a26c);}})[_0x0a9e('0x22')](function(_0x1bf692){if(_0x1bf692){return _0x1bf692?{'count':_0x40eb5d,'rows':_0x1bf692}:null;}})[_0x0a9e('0x22')](respondWithResult(_0x57f673,null))[_0x0a9e('0x46')](handleError(_0x57f673,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index dba7ca1..e8d4a59 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 _0xf49c=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf49c,0x98));var _0xcf49=function(_0x3687b7,_0x1e2618){_0x3687b7=_0x3687b7-0x0;var _0x1a0bc7=_0xf49c[_0x3687b7];return _0x1a0bc7;};'use strict';var EventEmitter=require('events');var CmList=require(_0xcf49('0x0'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xcf49('0x1')](0x0);var events={'afterCreate':_0xcf49('0x2'),'afterUpdate':_0xcf49('0x3'),'afterDestroy':_0xcf49('0x4')};function emitEvent(_0x1038f1){return function(_0x18338f,_0x230978,_0x1dc4f3){CmListEvents[_0xcf49('0x5')](_0x1038f1+':'+_0x18338f['id'],_0x18338f);CmListEvents[_0xcf49('0x5')](_0x1038f1,_0x18338f);_0x1dc4f3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xcf49('0x6')](e,emitEvent(event));}}module[_0xcf49('0x7')]=CmListEvents; \ No newline at end of file +var _0xc7b2=['remove','emit','hasOwnProperty','hook','exports','events','CmList','save','update'];(function(_0x44144d,_0x312bf5){var _0x414889=function(_0x5708fb){while(--_0x5708fb){_0x44144d['push'](_0x44144d['shift']());}};_0x414889(++_0x312bf5);}(_0xc7b2,0x1a3));var _0x2c7b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7b2[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x2c7b('0x0'));var CmList=require('../../mysqldb')['db'][_0x2c7b('0x1')];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2c7b('0x2'),'afterUpdate':_0x2c7b('0x3'),'afterDestroy':_0x2c7b('0x4')};function emitEvent(_0x396400){return function(_0x17ff56,_0x3bd63e,_0x34d50b){CmListEvents['emit'](_0x396400+':'+_0x17ff56['id'],_0x17ff56);CmListEvents[_0x2c7b('0x5')](_0x396400,_0x17ff56);_0x34d50b(null);};}for(var e in events){if(events[_0x2c7b('0x6')](e)){var event=events[e];CmList[_0x2c7b('0x7')](e,emitEvent(event));}}module[_0x2c7b('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index c396625..a7f7c1d 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 _0xf83d=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util'];(function(_0xe4bb3d,_0x21e87e){var _0xd9e51=function(_0x1f732b){while(--_0x1f732b){_0xe4bb3d['push'](_0xe4bb3d['shift']());}};_0xd9e51(++_0x21e87e);}(_0xf83d,0x140));var _0xdf83=function(_0xcaa660,_0x116e0a){_0xcaa660=_0xcaa660-0x0;var _0x346c79=_0xf83d[_0xcaa660];return _0x346c79;};'use strict';var _=require(_0xdf83('0x0'));var util=require(_0xdf83('0x1'));var logger=require(_0xdf83('0x2'))(_0xdf83('0x3'));var moment=require(_0xdf83('0x4'));var BPromise=require('bluebird');var rp=require(_0xdf83('0x5'));var fs=require('fs');var path=require(_0xdf83('0x6'));var rimraf=require(_0xdf83('0x7'));var config=require(_0xdf83('0x8'));var attributes=require(_0xdf83('0x9'));module[_0xdf83('0xa')]=function(_0x10604c,_0x128aa1){return _0x10604c[_0xdf83('0xb')](_0xdf83('0xc'),attributes,{'tableName':_0xdf83('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2f2=['./cmList.attributes','exports','define','CmList','cm_lists','util','../../config/logger','moment','bluebird','rimraf','../../config/environment'];(function(_0x51b80a,_0x355fe3){var _0x22fdf0=function(_0x152b3e){while(--_0x152b3e){_0x51b80a['push'](_0x51b80a['shift']());}};_0x22fdf0(++_0x355fe3);}(_0xa2f2,0x1d3));var _0x2a2f=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa2f2[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0x2a2f('0x0'));var logger=require(_0x2a2f('0x1'))('api');var moment=require(_0x2a2f('0x2'));var BPromise=require(_0x2a2f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2a2f('0x4'));var config=require(_0x2a2f('0x5'));var attributes=require(_0x2a2f('0x6'));module[_0x2a2f('0x7')]=function(_0x575287,_0x38aa7d){return _0x575287[_0x2a2f('0x8')](_0x2a2f('0x9'),attributes,{'tableName':_0x2a2f('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 dd2eef4..a83892c 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 _0xdc1f=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','then','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x3e1ccd,_0x3d3880){var _0x3e02ed=function(_0x45edb0){while(--_0x45edb0){_0x3e1ccd['push'](_0x3e1ccd['shift']());}};_0x3e02ed(++_0x3d3880);}(_0xdc1f,0x8a));var _0xfdc1=function(_0x59e348,_0x5c5f00){_0x59e348=_0x59e348-0x0;var _0x2478b8=_0xdc1f[_0x59e348];return _0x2478b8;};'use strict';var _=require(_0xfdc1('0x0'));var util=require(_0xfdc1('0x1'));var moment=require(_0xfdc1('0x2'));var BPromise=require(_0xfdc1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfdc1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfdc1('0x5'));var logger=require(_0xfdc1('0x6'))(_0xfdc1('0x7'));var config=require(_0xfdc1('0x8'));var jayson=require(_0xfdc1('0x9'));var client=jayson[_0xfdc1('0xa')][_0xfdc1('0xb')]({'port':0x232a});config[_0xfdc1('0xc')]=_[_0xfdc1('0xd')](config[_0xfdc1('0xc')],{'host':_0xfdc1('0xe'),'port':0x18eb});var socket=require(_0xfdc1('0xf'))(new Redis(config['redis']));require(_0xfdc1('0x10'))['register'](socket);function respondWithRpcPromise(_0x9303fd,_0x1a64d4,_0x3881e1){return new BPromise(function(_0x29b5a5,_0x4d60ce){return client['request'](_0x9303fd,_0x3881e1)[_0xfdc1('0x11')](function(_0x3078a1){logger['info'](_0xfdc1('0x12'),_0x1a64d4,'request\x20sent');logger[_0xfdc1('0x13')](_0xfdc1('0x14'),_0x1a64d4,'request\x20sent',JSON[_0xfdc1('0x15')](_0x3078a1));if(_0x3078a1[_0xfdc1('0x16')]){if(_0x3078a1[_0xfdc1('0x16')][_0xfdc1('0x17')]===0x1f4){logger['error'](_0xfdc1('0x12'),_0x1a64d4,_0x3078a1[_0xfdc1('0x16')][_0xfdc1('0x18')]);return _0x4d60ce(_0x3078a1[_0xfdc1('0x16')]['message']);}logger[_0xfdc1('0x16')](_0xfdc1('0x12'),_0x1a64d4,_0x3078a1['error'][_0xfdc1('0x18')]);return _0x29b5a5(_0x3078a1[_0xfdc1('0x16')][_0xfdc1('0x18')]);}else{logger[_0xfdc1('0x19')](_0xfdc1('0x12'),_0x1a64d4,_0xfdc1('0x1a'));_0x29b5a5(_0x3078a1[_0xfdc1('0x1b')]['message']);}})[_0xfdc1('0x1c')](function(_0x5f1176){logger['error'](_0xfdc1('0x12'),_0x1a64d4,_0x5f1176);_0x4d60ce(_0x5f1176);});});} \ No newline at end of file +var _0x7976=['localhost','socket.io-emitter','register','then','info','request\x20sent','debug','error','code','CmList,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults'];(function(_0x498fed,_0x45fa9a){var _0x3f354c=function(_0x179b0c){while(--_0x179b0c){_0x498fed['push'](_0x498fed['shift']());}};_0x3f354c(++_0x45fa9a);}(_0x7976,0x1ce));var _0x6797=function(_0x39a8a6,_0x153e1b){_0x39a8a6=_0x39a8a6-0x0;var _0x25fe51=_0x7976[_0x39a8a6];return _0x25fe51;};'use strict';var _=require(_0x6797('0x0'));var util=require(_0x6797('0x1'));var moment=require(_0x6797('0x2'));var BPromise=require(_0x6797('0x3'));var rs=require(_0x6797('0x4'));var fs=require('fs');var Redis=require(_0x6797('0x5'));var db=require(_0x6797('0x6'))['db'];var utils=require(_0x6797('0x7'));var logger=require(_0x6797('0x8'))(_0x6797('0x9'));var config=require(_0x6797('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x6797('0xb')]=_[_0x6797('0xc')](config[_0x6797('0xb')],{'host':_0x6797('0xd'),'port':0x18eb});var socket=require(_0x6797('0xe'))(new Redis(config['redis']));require('./cmList.socket')[_0x6797('0xf')](socket);function respondWithRpcPromise(_0x290b0b,_0x158b03,_0x373eef){return new BPromise(function(_0x5f16cf,_0x4baa19){return client['request'](_0x290b0b,_0x373eef)[_0x6797('0x10')](function(_0x85c275){logger[_0x6797('0x11')]('CmList,\x20%s,\x20%s',_0x158b03,_0x6797('0x12'));logger[_0x6797('0x13')]('CmList,\x20%s,\x20%s,\x20%s',_0x158b03,_0x6797('0x12'),JSON['stringify'](_0x85c275));if(_0x85c275[_0x6797('0x14')]){if(_0x85c275[_0x6797('0x14')][_0x6797('0x15')]===0x1f4){logger[_0x6797('0x14')](_0x6797('0x16'),_0x158b03,_0x85c275[_0x6797('0x14')][_0x6797('0x17')]);return _0x4baa19(_0x85c275[_0x6797('0x14')][_0x6797('0x17')]);}logger[_0x6797('0x14')](_0x6797('0x16'),_0x158b03,_0x85c275[_0x6797('0x14')][_0x6797('0x17')]);return _0x5f16cf(_0x85c275[_0x6797('0x14')][_0x6797('0x17')]);}else{logger['info']('CmList,\x20%s,\x20%s',_0x158b03,_0x6797('0x12'));_0x5f16cf(_0x85c275['result'][_0x6797('0x17')]);}})[_0x6797('0x18')](function(_0x352467){logger[_0x6797('0x14')](_0x6797('0x16'),_0x158b03,_0x352467);_0x4baa19(_0x352467);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 767ccd4..5cb12dd 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 _0x8efc=['removeListener','length','cmList:','remove','emit'];(function(_0x24b6e0,_0x5caecf){var _0x25b48a=function(_0xbc0374){while(--_0xbc0374){_0x24b6e0['push'](_0x24b6e0['shift']());}};_0x25b48a(++_0x5caecf);}(_0x8efc,0x8f));var _0xc8ef=function(_0x5e944a,_0x2847b4){_0x5e944a=_0x5e944a-0x0;var _0x38f07b=_0x8efc[_0x5e944a];return _0x38f07b;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0xc8ef('0x0'),'update'];function createListener(_0x35d82e,_0x48fc28){return function(_0x16d145){_0x48fc28[_0xc8ef('0x1')](_0x35d82e,_0x16d145);};}function removeListener(_0x4dbf24,_0x4ee0cc){return function(){CmListEvents[_0xc8ef('0x2')](_0x4dbf24,_0x4ee0cc);};}exports['register']=function(_0x1d65c1){for(var _0x1b4901=0x0,_0x1648ac=events[_0xc8ef('0x3')];_0x1b4901<_0x1648ac;_0x1b4901++){var _0x819e70=events[_0x1b4901];var _0x522d75=createListener(_0xc8ef('0x4')+_0x819e70,_0x1d65c1);CmListEvents['on'](_0x819e70,_0x522d75);}}; \ No newline at end of file +var _0x5292=['length','cmList:','./cmList.events','save','update','emit','removeListener'];(function(_0x335737,_0x3d3d3e){var _0x7c0278=function(_0x6d234b){while(--_0x6d234b){_0x335737['push'](_0x335737['shift']());}};_0x7c0278(++_0x3d3d3e);}(_0x5292,0xf7));var _0x2529=function(_0x26659f,_0x32f426){_0x26659f=_0x26659f-0x0;var _0x42667f=_0x5292[_0x26659f];return _0x42667f;};'use strict';var CmListEvents=require(_0x2529('0x0'));var events=[_0x2529('0x1'),'remove',_0x2529('0x2')];function createListener(_0x522ab4,_0x1540a9){return function(_0x2b088){_0x1540a9[_0x2529('0x3')](_0x522ab4,_0x2b088);};}function removeListener(_0x228165,_0x5d25dc){return function(){CmListEvents[_0x2529('0x4')](_0x228165,_0x5d25dc);};}exports['register']=function(_0x4c9b4c){for(var _0x4e7a9e=0x0,_0x407277=events[_0x2529('0x5')];_0x4e7a9e<_0x407277;_0x4e7a9e++){var _0x5bb8a1=events[_0x4e7a9e];var _0x5c3355=createListener(_0x2529('0x6')+_0x5bb8a1,_0x4c9b4c);CmListEvents['on'](_0x5bb8a1,_0x5c3355);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 9980fa8..361788f 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 _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file +var _0xa9e0=['/describe','/:id','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addCustomField','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x7')](_0x0a9e('0xd'),auth['isAuthenticated'](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x7')](_0x0a9e('0xf'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router['get'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x14')]);router['post'](_0x0a9e('0xb'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post'](_0x0a9e('0xd'),auth[_0x0a9e('0x8')](),controller['addContacts']);router[_0x0a9e('0x13')]('/:id/fields',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x16')]);router[_0x0a9e('0x13')](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x1a')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x1a')]('/:id/dispositions',auth[_0x0a9e('0x8')](),controller['removeDispositions']);router['delete'](_0x0a9e('0x11'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x1c')]);module[_0x0a9e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index d276ce5..178e2ba 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 _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0xc18351,_0x3561ef){var _0x580528=function(_0xe9363a){while(--_0xe9363a){_0xc18351['push'](_0xc18351['shift']());}};_0x580528(++_0x3561ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x54f06d,_0x4ec25e){var _0x88a6a6=function(_0x4126b4){while(--_0x4126b4){_0x54f06d['push'](_0x54f06d['shift']());}};_0x88a6a6(++_0x4ec25e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index fb25364..01067b1 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 _0x2757=['util','path','sox','to-csv','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','end','name','send','body','Condition','find','params','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache'];(function(_0x26667e,_0x4c2d96){var _0x53aa2f=function(_0x580b17){while(--_0x580b17){_0x26667e['push'](_0x26667e['shift']());}};_0x53aa2f(++_0x4c2d96);}(_0x2757,0x107));var _0x7275=function(_0x342c6f,_0x57040b){_0x342c6f=_0x342c6f-0x0;var _0x1e5f31=_0x2757[_0x342c6f];return _0x1e5f31;};'use strict';var pdf=require(_0x7275('0x0'));var emlformat=require(_0x7275('0x1'));var rimraf=require(_0x7275('0x2'));var zipdir=require(_0x7275('0x3'));var jsonpatch=require(_0x7275('0x4'));var rp=require('request-promise');var moment=require(_0x7275('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7275('0x6'));var util=require(_0x7275('0x7'));var path=require(_0x7275('0x8'));var sox=require(_0x7275('0x9'));var csv=require(_0x7275('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7275('0xb'));var squel=require(_0x7275('0xc'));var crypto=require(_0x7275('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7275('0xe'));var toCsv=require(_0x7275('0xa'));var querystring=require('querystring');var Papa=require(_0x7275('0xf'));var Redis=require('ioredis');var authService=require(_0x7275('0x10'));var qs=require(_0x7275('0x11'));var as=require(_0x7275('0x12'));var hardwareService=require(_0x7275('0x13'));var logger=require(_0x7275('0x14'))(_0x7275('0x15'));var utils=require(_0x7275('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7275('0x17'));var db=require(_0x7275('0x18'))['db'];function respondWithStatusCode(_0x48cd40,_0x3308ad){_0x3308ad=_0x3308ad||0xcc;return function(_0x482f5d){if(_0x482f5d){return _0x48cd40[_0x7275('0x19')](_0x3308ad);}return _0x48cd40[_0x7275('0x1a')](_0x3308ad)['end']();};}function respondWithResult(_0x56e01e,_0x4f6f6d){_0x4f6f6d=_0x4f6f6d||0xc8;return function(_0x18373e){if(_0x18373e){return _0x56e01e['status'](_0x4f6f6d)[_0x7275('0x1b')](_0x18373e);}};}function respondWithFilteredResult(_0x2c5c46,_0x23167d){return function(_0xc02490){if(_0xc02490){var _0x10f6b4=_0xc02490[_0x7275('0x1c')],_0x569acd=_0x23167d[_0x7275('0x1d')],_0x416854=_0x23167d[_0x7275('0x1d')]+_0x23167d[_0x7275('0x1e')],_0x3ced9b;if(_0x416854>=_0x10f6b4){_0x416854=_0x10f6b4;_0x3ced9b=0xc8;}else{_0x3ced9b=0xce;}_0x2c5c46[_0x7275('0x1a')](_0x3ced9b);return _0x2c5c46['set'](_0x7275('0x1f'),_0x569acd+'-'+_0x416854+'/'+_0x10f6b4)[_0x7275('0x1b')](_0xc02490);}return null;};}function patchUpdates(_0x2b9137){return function(_0x295775){try{jsonpatch[_0x7275('0x20')](_0x295775,_0x2b9137,!![]);}catch(_0x3cc639){return BPromise[_0x7275('0x21')](_0x3cc639);}return _0x295775[_0x7275('0x22')]();};}function saveUpdates(_0x133791,_0x315be3){return function(_0x5674bd){if(_0x5674bd){return _0x5674bd['update'](_0x133791)[_0x7275('0x23')](function(_0x357c74){return _0x357c74;});}return null;};}function removeEntity(_0x4b4825,_0x408e4d){return function(_0x391185){if(_0x391185){return _0x391185[_0x7275('0x24')]()[_0x7275('0x23')](function(){_0x4b4825[_0x7275('0x1a')](0xcc)[_0x7275('0x25')]();});}};}function handleEntityNotFound(_0x50ee7b,_0x2cf12d){return function(_0x5b2370){if(!_0x5b2370){_0x50ee7b[_0x7275('0x19')](0x194);}return _0x5b2370;};}function handleError(_0x1d16ff,_0x181f66){_0x181f66=_0x181f66||0x1f4;return function(_0xb849f3){logger['error'](_0xb849f3['stack']);if(_0xb849f3[_0x7275('0x26')]){delete _0xb849f3[_0x7275('0x26')];}_0x1d16ff['status'](_0x181f66)[_0x7275('0x27')](_0xb849f3);};}exports['update']=function(_0x2fcdb2,_0x1c4d19){if(_0x2fcdb2[_0x7275('0x28')]['id']){delete _0x2fcdb2[_0x7275('0x28')]['id'];}return db[_0x7275('0x29')][_0x7275('0x2a')]({'where':{'id':_0x2fcdb2[_0x7275('0x2b')]['id']}})['then'](handleEntityNotFound(_0x1c4d19,null))[_0x7275('0x23')](saveUpdates(_0x2fcdb2[_0x7275('0x28')],null))[_0x7275('0x23')](respondWithResult(_0x1c4d19,null))['catch'](handleError(_0x1c4d19,null));};exports[_0x7275('0x24')]=function(_0x1dc071,_0x2b64f8){return db['Condition'][_0x7275('0x2a')]({'where':{'id':_0x1dc071[_0x7275('0x2b')]['id']}})[_0x7275('0x23')](handleEntityNotFound(_0x2b64f8,null))['then'](removeEntity(_0x2b64f8,null))[_0x7275('0x2c')](handleError(_0x2b64f8,null));}; \ No newline at end of file +var _0x565e=['send','body','Condition','find','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','end','json','offset','limit','status','set','Content-Range','save','update','then','destroy','sendStatus','error','name'];(function(_0x1cea0d,_0x4fdfc4){var _0x5eb6b4=function(_0x24f431){while(--_0x24f431){_0x1cea0d['push'](_0x1cea0d['shift']());}};_0x5eb6b4(++_0x4fdfc4);}(_0x565e,0x139));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xe565('0x0'));var emlformat=require(_0xe565('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe565('0x2'));var jsonpatch=require(_0xe565('0x3'));var rp=require(_0xe565('0x4'));var moment=require(_0xe565('0x5'));var BPromise=require(_0xe565('0x6'));var Mustache=require(_0xe565('0x7'));var util=require('util');var path=require('path');var sox=require(_0xe565('0x8'));var csv=require(_0xe565('0x9'));var ejs=require(_0xe565('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe565('0xb'));var crypto=require(_0xe565('0xc'));var jsforce=require(_0xe565('0xd'));var deskjs=require(_0xe565('0xe'));var toCsv=require(_0xe565('0x9'));var querystring=require(_0xe565('0xf'));var Papa=require(_0xe565('0x10'));var Redis=require(_0xe565('0x11'));var authService=require(_0xe565('0x12'));var qs=require(_0xe565('0x13'));var as=require(_0xe565('0x14'));var hardwareService=require(_0xe565('0x15'));var logger=require(_0xe565('0x16'))(_0xe565('0x17'));var utils=require('../../config/utils');var config=require(_0xe565('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ecf8f,_0x54e0dc){_0x54e0dc=_0x54e0dc||0xcc;return function(_0x2afc13){if(_0x2afc13){return _0x1ecf8f['sendStatus'](_0x54e0dc);}return _0x1ecf8f['status'](_0x54e0dc)[_0xe565('0x19')]();};}function respondWithResult(_0x52274f,_0x451983){_0x451983=_0x451983||0xc8;return function(_0x119c34){if(_0x119c34){return _0x52274f['status'](_0x451983)[_0xe565('0x1a')](_0x119c34);}};}function respondWithFilteredResult(_0x6a32c1,_0x51f775){return function(_0x29333c){if(_0x29333c){var _0x326b54=_0x29333c['count'],_0x42d96a=_0x51f775[_0xe565('0x1b')],_0x1092c8=_0x51f775[_0xe565('0x1b')]+_0x51f775[_0xe565('0x1c')],_0x4212e4;if(_0x1092c8>=_0x326b54){_0x1092c8=_0x326b54;_0x4212e4=0xc8;}else{_0x4212e4=0xce;}_0x6a32c1[_0xe565('0x1d')](_0x4212e4);return _0x6a32c1[_0xe565('0x1e')](_0xe565('0x1f'),_0x42d96a+'-'+_0x1092c8+'/'+_0x326b54)['json'](_0x29333c);}return null;};}function patchUpdates(_0x33ae4f){return function(_0x96905f){try{jsonpatch['apply'](_0x96905f,_0x33ae4f,!![]);}catch(_0x39ec40){return BPromise['reject'](_0x39ec40);}return _0x96905f[_0xe565('0x20')]();};}function saveUpdates(_0x4fb1b5,_0x21f29f){return function(_0x51fb04){if(_0x51fb04){return _0x51fb04[_0xe565('0x21')](_0x4fb1b5)[_0xe565('0x22')](function(_0x6fdbdf){return _0x6fdbdf;});}return null;};}function removeEntity(_0x2794a7,_0x1bc32a){return function(_0x17b921){if(_0x17b921){return _0x17b921[_0xe565('0x23')]()['then'](function(){_0x2794a7[_0xe565('0x1d')](0xcc)[_0xe565('0x19')]();});}};}function handleEntityNotFound(_0x1a7dd8,_0xb56889){return function(_0x3c030d){if(!_0x3c030d){_0x1a7dd8[_0xe565('0x24')](0x194);}return _0x3c030d;};}function handleError(_0x3ea0fc,_0x42357b){_0x42357b=_0x42357b||0x1f4;return function(_0x2e688f){logger[_0xe565('0x25')](_0x2e688f['stack']);if(_0x2e688f['name']){delete _0x2e688f[_0xe565('0x26')];}_0x3ea0fc[_0xe565('0x1d')](_0x42357b)[_0xe565('0x27')](_0x2e688f);};}exports['update']=function(_0x3458d6,_0x255822){if(_0x3458d6['body']['id']){delete _0x3458d6[_0xe565('0x28')]['id'];}return db[_0xe565('0x29')][_0xe565('0x2a')]({'where':{'id':_0x3458d6['params']['id']}})[_0xe565('0x22')](handleEntityNotFound(_0x255822,null))['then'](saveUpdates(_0x3458d6[_0xe565('0x28')],null))[_0xe565('0x22')](respondWithResult(_0x255822,null))['catch'](handleError(_0x255822,null));};exports[_0xe565('0x23')]=function(_0xe9553e,_0xab219){return db['Condition'][_0xe565('0x2a')]({'where':{'id':_0xe9553e[_0xe565('0x2b')]['id']}})[_0xe565('0x22')](handleEntityNotFound(_0xab219,null))[_0xe565('0x22')](removeEntity(_0xab219,null))['catch'](handleError(_0xab219,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 716b9b3..b7746bd 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 _0x2b76=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','define','Condition','tools_conditions','lodash','util'];(function(_0x5c3581,_0x4f3df2){var _0xb85a10=function(_0x3474f9){while(--_0x3474f9){_0x5c3581['push'](_0x5c3581['shift']());}};_0xb85a10(++_0x4f3df2);}(_0x2b76,0x14e));var _0x62b7=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2b76[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x62b7('0x0'));var util=require(_0x62b7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x62b7('0x2'));var BPromise=require(_0x62b7('0x3'));var rp=require(_0x62b7('0x4'));var fs=require('fs');var path=require(_0x62b7('0x5'));var rimraf=require(_0x62b7('0x6'));var config=require(_0x62b7('0x7'));var attributes=require(_0x62b7('0x8'));module['exports']=function(_0x52abea,_0xa19cb7){return _0x52abea[_0x62b7('0x9')](_0x62b7('0xa'),attributes,{'tableName':_0x62b7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x664b=['define','Condition','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports'];(function(_0x22074d,_0x33df85){var _0x3a24ce=function(_0x1dfb83){while(--_0x1dfb83){_0x22074d['push'](_0x22074d['shift']());}};_0x3a24ce(++_0x33df85);}(_0x664b,0x9c));var _0xb664=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x664b[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xb664('0x0'));var util=require(_0xb664('0x1'));var logger=require(_0xb664('0x2'))(_0xb664('0x3'));var moment=require(_0xb664('0x4'));var BPromise=require(_0xb664('0x5'));var rp=require(_0xb664('0x6'));var fs=require('fs');var path=require(_0xb664('0x7'));var rimraf=require(_0xb664('0x8'));var config=require(_0xb664('0x9'));var attributes=require(_0xb664('0xa'));module[_0xb664('0xb')]=function(_0x553df8,_0x42fb15){return _0x553df8[_0xb664('0xc')](_0xb664('0xd'),attributes,{'tableName':'tools_conditions','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 debf827..4450776 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 _0x3d02=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','Condition,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','lodash'];(function(_0x35f762,_0xc1ce5a){var _0x83ef0a=function(_0x36973b){while(--_0x36973b){_0x35f762['push'](_0x35f762['shift']());}};_0x83ef0a(++_0xc1ce5a);}(_0x3d02,0x99));var _0x23d0=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x3d02[_0x500419];return _0x241c1a;};'use strict';var _=require(_0x23d0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x23d0('0x1'));var rs=require(_0x23d0('0x2'));var fs=require('fs');var Redis=require(_0x23d0('0x3'));var db=require(_0x23d0('0x4'))['db'];var utils=require(_0x23d0('0x5'));var logger=require(_0x23d0('0x6'))(_0x23d0('0x7'));var config=require('../../config/environment');var jayson=require(_0x23d0('0x8'));var client=jayson[_0x23d0('0x9')][_0x23d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55a769,_0x370ca9,_0x5d9504){return new BPromise(function(_0x397ef0,_0x22dafa){return client['request'](_0x55a769,_0x5d9504)[_0x23d0('0xb')](function(_0x3f9e2b){logger['info'](_0x23d0('0xc'),_0x370ca9,'request\x20sent');logger[_0x23d0('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0x370ca9,_0x23d0('0xe'),JSON[_0x23d0('0xf')](_0x3f9e2b));if(_0x3f9e2b[_0x23d0('0x10')]){if(_0x3f9e2b[_0x23d0('0x10')][_0x23d0('0x11')]===0x1f4){logger[_0x23d0('0x10')](_0x23d0('0xc'),_0x370ca9,_0x3f9e2b['error']['message']);return _0x22dafa(_0x3f9e2b[_0x23d0('0x10')]['message']);}logger['error'](_0x23d0('0xc'),_0x370ca9,_0x3f9e2b[_0x23d0('0x10')][_0x23d0('0x12')]);return _0x397ef0(_0x3f9e2b[_0x23d0('0x10')][_0x23d0('0x12')]);}else{logger[_0x23d0('0x13')](_0x23d0('0xc'),_0x370ca9,_0x23d0('0xe'));_0x397ef0(_0x3f9e2b[_0x23d0('0x14')]['message']);}})[_0x23d0('0x15')](function(_0x4c5a10){logger['error']('Condition,\x20%s,\x20%s',_0x370ca9,_0x4c5a10);_0x22dafa(_0x4c5a10);});});} \ No newline at end of file +var _0x2981=['result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','code','message','Condition,\x20%s,\x20%s','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2981,0x11a));var _0x1298=function(_0x356619,_0x4a60af){_0x356619=_0x356619-0x0;var _0x352c23=_0x2981[_0x356619];return _0x352c23;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1298('0x0'));var BPromise=require(_0x1298('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1298('0x2'));var db=require(_0x1298('0x3'))['db'];var utils=require(_0x1298('0x4'));var logger=require('../../config/logger')(_0x1298('0x5'));var config=require(_0x1298('0x6'));var jayson=require(_0x1298('0x7'));var client=jayson[_0x1298('0x8')][_0x1298('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a74ae,_0x113704,_0x2a1eb3){return new BPromise(function(_0x23ef73,_0x2e34fc){return client['request'](_0x2a74ae,_0x2a1eb3)['then'](function(_0x4fa07f){logger['info']('Condition,\x20%s,\x20%s',_0x113704,_0x1298('0xa'));logger[_0x1298('0xb')](_0x1298('0xc'),_0x113704,'request\x20sent',JSON['stringify'](_0x4fa07f));if(_0x4fa07f[_0x1298('0xd')]){if(_0x4fa07f[_0x1298('0xd')][_0x1298('0xe')]===0x1f4){logger[_0x1298('0xd')]('Condition,\x20%s,\x20%s',_0x113704,_0x4fa07f[_0x1298('0xd')][_0x1298('0xf')]);return _0x2e34fc(_0x4fa07f['error'][_0x1298('0xf')]);}logger[_0x1298('0xd')](_0x1298('0x10'),_0x113704,_0x4fa07f[_0x1298('0xd')][_0x1298('0xf')]);return _0x23ef73(_0x4fa07f[_0x1298('0xd')][_0x1298('0xf')]);}else{logger[_0x1298('0x11')]('Condition,\x20%s,\x20%s',_0x113704,_0x1298('0xa'));_0x23ef73(_0x4fa07f[_0x1298('0x12')]['message']);}})[_0x1298('0x13')](function(_0x13ac96){logger[_0x1298('0xd')](_0x1298('0x10'),_0x113704,_0x13ac96);_0x2e34fc(_0x13ac96);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 21ed6c3..1516369 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 _0xf57c=['isAuthenticated','update','delete','/:id','destroy','util','Router','../../components/auth/service','../../components/interaction/service','./condition.controller','put'];(function(_0x48f58f,_0x3a9b8c){var _0x307523=function(_0x39b455){while(--_0x39b455){_0x48f58f['push'](_0x48f58f['shift']());}};_0x307523(++_0x3a9b8c);}(_0xf57c,0x1bd));var _0xcf57=function(_0x46d6ba,_0x1e22aa){_0x46d6ba=_0x46d6ba-0x0;var _0x1cb642=_0xf57c[_0x46d6ba];return _0x1cb642;};'use strict';var multer=require('multer');var util=require(_0xcf57('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcf57('0x1')]();var auth=require(_0xcf57('0x2'));var interaction=require(_0xcf57('0x3'));var config=require('../../config/environment');var controller=require(_0xcf57('0x4'));router[_0xcf57('0x5')]('/:id',auth[_0xcf57('0x6')](),controller[_0xcf57('0x7')]);router[_0xcf57('0x8')](_0xcf57('0x9'),auth[_0xcf57('0x6')](),controller[_0xcf57('0xa')]);module['exports']=router; \ No newline at end of file +var _0x18a7=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','/:id','isAuthenticated','update','destroy','exports'];(function(_0x33a140,_0x477198){var _0x47157e=function(_0x4b1210){while(--_0x4b1210){_0x33a140['push'](_0x33a140['shift']());}};_0x47157e(++_0x477198);}(_0x18a7,0x1dc));var _0x718a=function(_0x5bca2f,_0xfff009){_0x5bca2f=_0x5bca2f-0x0;var _0x176871=_0x18a7[_0x5bca2f];return _0x176871;};'use strict';var multer=require('multer');var util=require(_0x718a('0x0'));var path=require(_0x718a('0x1'));var timeout=require(_0x718a('0x2'));var express=require(_0x718a('0x3'));var router=express[_0x718a('0x4')]();var auth=require(_0x718a('0x5'));var interaction=require(_0x718a('0x6'));var config=require(_0x718a('0x7'));var controller=require(_0x718a('0x8'));router['put'](_0x718a('0x9'),auth[_0x718a('0xa')](),controller[_0x718a('0xb')]);router['delete'](_0x718a('0x9'),auth[_0x718a('0xa')](),controller[_0x718a('0xc')]);module[_0x718a('0xd')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 7adc264..b6357fc 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 _0xac9d=['name','sequelize','exports','STRING'];(function(_0x3aa3b9,_0x5717c7){var _0x4e3abb=function(_0x6bd424){while(--_0x6bd424){_0x3aa3b9['push'](_0x3aa3b9['shift']());}};_0x4e3abb(++_0x5717c7);}(_0xac9d,0x14d));var _0xdac9=function(_0x4e13b0,_0x1ca561){_0x4e13b0=_0x4e13b0-0x0;var _0x5c2a63=_0xac9d[_0x4e13b0];return _0x5c2a63;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'name':{'type':Sequelize[_0xdac9('0x2')],'allowNull':![],'unique':_0xdac9('0x3')},'description':{'type':Sequelize[_0xdac9('0x2')]}}; \ No newline at end of file +var _0x0aee=['STRING','sequelize'];(function(_0x363b81,_0x81e6ca){var _0x1d92fb=function(_0x129644){while(--_0x129644){_0x363b81['push'](_0x363b81['shift']());}};_0x1d92fb(++_0x81e6ca);}(_0x0aee,0x1a3));var _0xe0ae=function(_0x56cc19,_0x2fd3a3){_0x56cc19=_0x56cc19-0x0;var _0x19cf03=_0x0aee[_0x56cc19];return _0x19cf03;};'use strict';var Sequelize=require(_0xe0ae('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0ae('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0xe0ae('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 8a65703..08e93da 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 _0xa8a0=['html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','get','UserProfileResource','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','filter','options','Dashboard','includeAll','include','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CustomDashboards','omit','updatedAt','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','DashboardId','DashboardItem','getItems','findOne','nolimit'];(function(_0x52b133,_0x4bee59){var _0x2618a7=function(_0x1274f7){while(--_0x1274f7){_0x52b133['push'](_0x52b133['shift']());}};_0x2618a7(++_0x4bee59);}(_0xa8a0,0x168));var _0x0a8a=function(_0x26a3a9,_0x1ccf9d){_0x26a3a9=_0x26a3a9-0x0;var _0x4c19e8=_0xa8a0[_0x26a3a9];return _0x4c19e8;};'use strict';var pdf=require(_0x0a8a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0a8a('0x1'));var zipdir=require(_0x0a8a('0x2'));var jsonpatch=require(_0x0a8a('0x3'));var rp=require(_0x0a8a('0x4'));var moment=require('moment');var BPromise=require(_0x0a8a('0x5'));var Mustache=require(_0x0a8a('0x6'));var util=require(_0x0a8a('0x7'));var path=require(_0x0a8a('0x8'));var sox=require(_0x0a8a('0x9'));var csv=require(_0x0a8a('0xa'));var ejs=require(_0x0a8a('0xb'));var fs=require('fs');var _=require(_0x0a8a('0xc'));var squel=require(_0x0a8a('0xd'));var crypto=require(_0x0a8a('0xe'));var jsforce=require(_0x0a8a('0xf'));var deskjs=require(_0x0a8a('0x10'));var toCsv=require(_0x0a8a('0xa'));var querystring=require(_0x0a8a('0x11'));var Papa=require(_0x0a8a('0x12'));var Redis=require(_0x0a8a('0x13'));var authService=require(_0x0a8a('0x14'));var qs=require(_0x0a8a('0x15'));var as=require(_0x0a8a('0x16'));var hardwareService=require(_0x0a8a('0x17'));var logger=require(_0x0a8a('0x18'))(_0x0a8a('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a8a('0x1a'));var db=require(_0x0a8a('0x1b'))['db'];config[_0x0a8a('0x1c')]=_[_0x0a8a('0x1d')](config[_0x0a8a('0x1c')],{'host':_0x0a8a('0x1e'),'port':0x18eb});var socket=require(_0x0a8a('0x1f'))(new Redis(config[_0x0a8a('0x1c')]));require(_0x0a8a('0x20'))[_0x0a8a('0x21')](socket);function respondWithStatusCode(_0x20ec33,_0x2feef2){_0x2feef2=_0x2feef2||0xcc;return function(_0x30b187){if(_0x30b187){return _0x20ec33[_0x0a8a('0x22')](_0x2feef2);}return _0x20ec33[_0x0a8a('0x23')](_0x2feef2)[_0x0a8a('0x24')]();};}function respondWithResult(_0x1ab410,_0x4930bd){_0x4930bd=_0x4930bd||0xc8;return function(_0x51a521){if(_0x51a521){return _0x1ab410[_0x0a8a('0x23')](_0x4930bd)[_0x0a8a('0x25')](_0x51a521);}};}function respondWithFilteredResult(_0x58975b,_0x13e605){return function(_0x3112de){if(_0x3112de){var _0x5f1004=_0x3112de[_0x0a8a('0x26')],_0xcfdf8=_0x13e605['offset'],_0x51e76b=_0x13e605[_0x0a8a('0x27')]+_0x13e605[_0x0a8a('0x28')],_0x30697c;if(_0x51e76b>=_0x5f1004){_0x51e76b=_0x5f1004;_0x30697c=0xc8;}else{_0x30697c=0xce;}_0x58975b[_0x0a8a('0x23')](_0x30697c);return _0x58975b[_0x0a8a('0x29')](_0x0a8a('0x2a'),_0xcfdf8+'-'+_0x51e76b+'/'+_0x5f1004)['json'](_0x3112de);}return null;};}function patchUpdates(_0x38b08e){return function(_0x23a19f){try{jsonpatch[_0x0a8a('0x2b')](_0x23a19f,_0x38b08e,!![]);}catch(_0x1cccea){return BPromise['reject'](_0x1cccea);}return _0x23a19f[_0x0a8a('0x2c')]();};}function saveUpdates(_0x2694d0,_0x42fa37){return function(_0x449cae){if(_0x449cae){return _0x449cae[_0x0a8a('0x2d')](_0x2694d0)['then'](function(_0x625a11){return _0x625a11;});}return null;};}function removeEntity(_0x5dcb5d,_0x17e13c){return function(_0x1dfcae){if(_0x1dfcae){return _0x1dfcae['destroy']()[_0x0a8a('0x2e')](function(){var _0x3b4840=_0x1dfcae[_0x0a8a('0x2f')]({'plain':!![]});var _0x49facd='CustomDashboards';return db[_0x0a8a('0x30')]['destroy']({'where':{'type':_0x49facd,'resourceId':_0x3b4840['id']}})[_0x0a8a('0x2e')](function(){return _0x1dfcae;});})[_0x0a8a('0x2e')](function(){_0x5dcb5d[_0x0a8a('0x23')](0xcc)[_0x0a8a('0x24')]();});}};}function handleEntityNotFound(_0x4f0209,_0x486cfd){return function(_0x3139f9){if(!_0x3139f9){_0x4f0209[_0x0a8a('0x22')](0x194);}return _0x3139f9;};}function handleError(_0x3c4a3c,_0x5dfb75){_0x5dfb75=_0x5dfb75||0x1f4;return function(_0x31c27f){logger[_0x0a8a('0x31')](_0x31c27f['stack']);if(_0x31c27f[_0x0a8a('0x32')]){delete _0x31c27f[_0x0a8a('0x32')];}_0x3c4a3c[_0x0a8a('0x23')](_0x5dfb75)[_0x0a8a('0x33')](_0x31c27f);};}exports[_0x0a8a('0x34')]=function(_0x548451,_0x5e35f9){var _0x534e22={},_0x1ba406={},_0x45005d={'count':0x0,'rows':[]};var _0x383f47=_[_0x0a8a('0x35')](db['Dashboard'][_0x0a8a('0x36')],function(_0x425cfb){return{'name':_0x425cfb['fieldName'],'type':_0x425cfb[_0x0a8a('0x37')][_0x0a8a('0x38')]};});_0x1ba406[_0x0a8a('0x39')]=_['map'](_0x383f47,'name');_0x1ba406[_0x0a8a('0x3a')]=_[_0x0a8a('0x3b')](_0x548451[_0x0a8a('0x3a')]);_0x1ba406[_0x0a8a('0x3c')]=_[_0x0a8a('0x3d')](_0x1ba406[_0x0a8a('0x39')],_0x1ba406[_0x0a8a('0x3a')]);_0x534e22[_0x0a8a('0x3e')]=_[_0x0a8a('0x3d')](_0x1ba406[_0x0a8a('0x39')],qs[_0x0a8a('0x3f')](_0x548451[_0x0a8a('0x3a')]['fields']));_0x534e22['attributes']=_0x534e22[_0x0a8a('0x3e')]['length']?_0x534e22[_0x0a8a('0x3e')]:_0x1ba406[_0x0a8a('0x39')];if(!_0x548451[_0x0a8a('0x3a')][_0x0a8a('0x40')]('nolimit')){_0x534e22[_0x0a8a('0x28')]=qs[_0x0a8a('0x28')](_0x548451['query'][_0x0a8a('0x28')]);_0x534e22[_0x0a8a('0x27')]=qs[_0x0a8a('0x27')](_0x548451[_0x0a8a('0x3a')][_0x0a8a('0x27')]);}_0x534e22[_0x0a8a('0x41')]=qs[_0x0a8a('0x42')](_0x548451[_0x0a8a('0x3a')][_0x0a8a('0x42')]);_0x534e22[_0x0a8a('0x43')]=qs['filters'](_[_0x0a8a('0x44')](_0x548451['query'],_0x1ba406[_0x0a8a('0x3c')]),_0x383f47);if(_0x548451[_0x0a8a('0x3a')]['filter']){_0x534e22[_0x0a8a('0x43')]=_[_0x0a8a('0x45')](_0x534e22['where'],{'$or':_[_0x0a8a('0x35')](_0x383f47,function(_0x268617){if(_0x268617[_0x0a8a('0x37')]!=='VIRTUAL'){var _0x284724={};_0x284724[_0x268617[_0x0a8a('0x32')]]={'$like':'%'+_0x548451['query'][_0x0a8a('0x46')]+'%'};return _0x284724;}})});}_0x534e22=_[_0x0a8a('0x45')]({},_0x534e22,_0x548451[_0x0a8a('0x47')]);var _0x44b1ab={'where':_0x534e22['where']};return db[_0x0a8a('0x48')][_0x0a8a('0x26')](_0x44b1ab)[_0x0a8a('0x2e')](function(_0x50e6cb){_0x45005d[_0x0a8a('0x26')]=_0x50e6cb;if(_0x548451[_0x0a8a('0x3a')][_0x0a8a('0x49')]){_0x534e22[_0x0a8a('0x4a')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x534e22);})[_0x0a8a('0x2e')](function(_0x3567fa){_0x45005d[_0x0a8a('0x4b')]=_0x3567fa;return _0x45005d;})[_0x0a8a('0x2e')](respondWithFilteredResult(_0x5e35f9,_0x534e22))[_0x0a8a('0x4c')](handleError(_0x5e35f9,null));};exports[_0x0a8a('0x4d')]=function(_0x5e68a5,_0x33ab63){var _0x1a1163={'raw':![],'where':{'id':_0x5e68a5[_0x0a8a('0x4e')]['id']}},_0x3941c2={};_0x3941c2[_0x0a8a('0x39')]=_[_0x0a8a('0x3b')](db[_0x0a8a('0x48')][_0x0a8a('0x36')]);_0x3941c2['query']=_['keys'](_0x5e68a5[_0x0a8a('0x3a')]);_0x3941c2[_0x0a8a('0x3c')]=_[_0x0a8a('0x3d')](_0x3941c2[_0x0a8a('0x39')],_0x3941c2[_0x0a8a('0x3a')]);_0x1a1163[_0x0a8a('0x3e')]=_[_0x0a8a('0x3d')](_0x3941c2['model'],qs[_0x0a8a('0x3f')](_0x5e68a5['query'][_0x0a8a('0x3f')]));_0x1a1163[_0x0a8a('0x3e')]=_0x1a1163[_0x0a8a('0x3e')][_0x0a8a('0x4f')]?_0x1a1163[_0x0a8a('0x3e')]:_0x3941c2[_0x0a8a('0x39')];if(_0x5e68a5[_0x0a8a('0x3a')][_0x0a8a('0x49')]){_0x1a1163[_0x0a8a('0x4a')]=[{'all':!![]}];}_0x1a1163=_[_0x0a8a('0x45')]({},_0x1a1163,_0x5e68a5[_0x0a8a('0x47')]);return db[_0x0a8a('0x48')][_0x0a8a('0x50')](_0x1a1163)[_0x0a8a('0x2e')](handleEntityNotFound(_0x33ab63,null))[_0x0a8a('0x2e')](respondWithResult(_0x33ab63,null))[_0x0a8a('0x4c')](handleError(_0x33ab63,null));};exports[_0x0a8a('0x51')]=function(_0x921a91,_0x4350f7){return db[_0x0a8a('0x48')][_0x0a8a('0x51')](_0x921a91[_0x0a8a('0x52')],{})[_0x0a8a('0x2e')](function(_0x442a6e){var _0xc370b=_0x921a91[_0x0a8a('0x53')][_0x0a8a('0x2f')]({'plain':!![]});if(!_0xc370b)throw new Error(_0x0a8a('0x54'));if(_0xc370b[_0x0a8a('0x55')]===_0x0a8a('0x53')){var _0x56fd40=_0x442a6e['get']({'plain':!![]});var _0x4b30cb=_0x0a8a('0x56');return db['UserProfileSection']['find']({'where':{'name':_0x4b30cb,'userProfileId':_0xc370b['userProfileId']},'raw':!![]})[_0x0a8a('0x2e')](function(_0x306f9c){if(_0x306f9c&&_0x306f9c['autoAssociation']===0x0){return db[_0x0a8a('0x30')][_0x0a8a('0x51')]({'name':_0x56fd40[_0x0a8a('0x32')],'resourceId':_0x56fd40['id'],'type':_0x306f9c[_0x0a8a('0x32')],'sectionId':_0x306f9c['id']},{})[_0x0a8a('0x2e')](function(){return _0x442a6e;});}else{return _0x442a6e;}})[_0x0a8a('0x4c')](function(_0x59a41b){logger[_0x0a8a('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59a41b);throw _0x59a41b;});}return _0x442a6e;})[_0x0a8a('0x2e')](respondWithResult(_0x4350f7,0xc9))[_0x0a8a('0x4c')](handleError(_0x4350f7,null));};exports['clone']=function(_0x2739c9,_0x5eebd2){var _0x3c4918={'where':{'id':_0x2739c9[_0x0a8a('0x4e')]['id']}},_0x346629={};_0x346629[_0x0a8a('0x39')]=_['keys'](db[_0x0a8a('0x48')][_0x0a8a('0x36')]);_0x3c4918['attributes']=_['intersection'](_0x346629[_0x0a8a('0x39')],qs[_0x0a8a('0x3f')](_0x2739c9[_0x0a8a('0x3a')][_0x0a8a('0x3f')]));_0x3c4918[_0x0a8a('0x3e')]=_0x3c4918[_0x0a8a('0x3e')][_0x0a8a('0x4f')]?_0x3c4918['attributes']:_0x346629[_0x0a8a('0x39')];if(_0x2739c9['query'][_0x0a8a('0x49')]){_0x3c4918[_0x0a8a('0x4a')]=[{'all':!![]}];}_0x3c4918=_['merge']({},_0x3c4918,_0x2739c9['options']);return db[_0x0a8a('0x48')][_0x0a8a('0x50')](_0x3c4918)[_0x0a8a('0x2e')](handleEntityNotFound(_0x5eebd2,null))[_0x0a8a('0x2e')](function(_0x47f04f){if(_0x47f04f){var _0x68fa39=_0x47f04f[_0x0a8a('0x2f')]({'plain':!![]});_0x68fa39=qs[_0x0a8a('0x57')](_0x68fa39,['id','createdAt',_0x0a8a('0x58')]);_0x2739c9[_0x0a8a('0x52')]=_['omit'](_0x2739c9[_0x0a8a('0x52')],['id','createdAt','updatedAt']);return db[_0x0a8a('0x48')][_0x0a8a('0x51')](_[_0x0a8a('0x45')](_0x68fa39,_0x2739c9[_0x0a8a('0x52')]),{'include':_0x2739c9['query']['includeAll']?[{'all':!![]}]:undefined})[_0x0a8a('0x2e')](function(_0x1f5cdd){var _0x2c2bd0=_0x2739c9[_0x0a8a('0x53')][_0x0a8a('0x2f')]({'plain':!![]});if(!_0x2c2bd0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c2bd0[_0x0a8a('0x55')]===_0x0a8a('0x53')){var _0x563c2e=_0x1f5cdd[_0x0a8a('0x2f')]({'plain':!![]});var _0x4c07f8=_0x0a8a('0x56');return db[_0x0a8a('0x59')][_0x0a8a('0x50')]({'where':{'name':_0x4c07f8,'userProfileId':_0x2c2bd0['userProfileId']},'raw':!![]})[_0x0a8a('0x2e')](function(_0x5babd6){if(_0x5babd6&&_0x5babd6[_0x0a8a('0x5a')]===0x0){return db[_0x0a8a('0x30')]['create']({'name':_0x563c2e['name'],'resourceId':_0x563c2e['id'],'type':_0x5babd6[_0x0a8a('0x32')],'sectionId':_0x5babd6['id']},{})[_0x0a8a('0x2e')](function(){return _0x1f5cdd;});}else{return _0x1f5cdd;}})[_0x0a8a('0x4c')](function(_0xe66e68){logger[_0x0a8a('0x31')](_0x0a8a('0x5b'),_0xe66e68);throw _0xe66e68;});}return _0x1f5cdd;});}})['then'](respondWithResult(_0x5eebd2,0xc9))['catch'](handleError(_0x5eebd2,null));};exports[_0x0a8a('0x2d')]=function(_0x1f652e,_0x1dff94){if(_0x1f652e[_0x0a8a('0x52')]['id']){delete _0x1f652e['body']['id'];}return db[_0x0a8a('0x48')][_0x0a8a('0x50')]({'where':{'id':_0x1f652e['params']['id']}})[_0x0a8a('0x2e')](handleEntityNotFound(_0x1dff94,null))[_0x0a8a('0x2e')](saveUpdates(_0x1f652e['body'],null))[_0x0a8a('0x2e')](respondWithResult(_0x1dff94,null))[_0x0a8a('0x4c')](handleError(_0x1dff94,null));};exports[_0x0a8a('0x5c')]=function(_0x2ab07f,_0x217684){return db[_0x0a8a('0x48')][_0x0a8a('0x50')]({'where':{'id':_0x2ab07f[_0x0a8a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x217684,null))[_0x0a8a('0x2e')](removeEntity(_0x217684,null))[_0x0a8a('0x4c')](handleError(_0x217684,null));};function widgetAttributes(_0xc57b30){try{switch(_0xc57b30[_0x0a8a('0x37')]){case _0x0a8a('0x5d'):return[{'name':'attrUrl','value':_0xc57b30[_0x0a8a('0x5e')]||(_0xc57b30[_0x0a8a('0x5f')]&&_0xc57b30[_0x0a8a('0x5f')][0x0]?_0xc57b30[_0x0a8a('0x5f')][0x0][_0x0a8a('0x60')]:undefined)||'https://'}];case'custom':return[{'name':_0x0a8a('0x61'),'value':_0xc57b30[_0x0a8a('0x61')]||(_0xc57b30['attrs']&&_0xc57b30[_0x0a8a('0x5f')][0x0]?_0xc57b30[_0x0a8a('0x5f')][0x0][_0x0a8a('0x60')]:undefined)||''}];case _0x0a8a('0x62'):return[{'name':_0x0a8a('0x63'),'value':_0xc57b30[_0x0a8a('0x63')]||(_0xc57b30[_0x0a8a('0x5f')]&&_0xc57b30[_0x0a8a('0x5f')][0x0]?_0xc57b30['attrs'][0x0][_0x0a8a('0x60')]:undefined)||_0x0a8a('0x64')},{'name':'attrTimezone','value':_0xc57b30['attrTimezone']||(_0xc57b30['attrs']&&_0xc57b30[_0x0a8a('0x5f')][0x1]?_0xc57b30[_0x0a8a('0x5f')][0x1][_0x0a8a('0x60')]:undefined)||_0x0a8a('0x65')},{'name':_0x0a8a('0x66'),'value':_0xc57b30[_0x0a8a('0x66')]||(_0xc57b30[_0x0a8a('0x5f')]&&_0xc57b30[_0x0a8a('0x5f')][0x2]?_0xc57b30[_0x0a8a('0x5f')][0x2][_0x0a8a('0x60')]:undefined)||0xc}];case _0x0a8a('0x67'):return[{'name':'attrMetric','value':_0xc57b30[_0x0a8a('0x68')]||(_0xc57b30[_0x0a8a('0x5f')]&&_0xc57b30[_0x0a8a('0x5f')][0x0]?_0xc57b30['attrs'][0x0][_0x0a8a('0x60')]:undefined)||_0x0a8a('0x69')},{'name':_0x0a8a('0x6a'),'value':_0xc57b30['attrVoiceQueues']||(_0xc57b30[_0x0a8a('0x5f')]&&_0xc57b30['attrs'][0x1]?_0xc57b30[_0x0a8a('0x5f')][0x1][_0x0a8a('0x60')]:undefined)||[]},{'name':_0x0a8a('0x66'),'value':_0xc57b30[_0x0a8a('0x66')]||(_0xc57b30[_0x0a8a('0x5f')]&&_0xc57b30[_0x0a8a('0x5f')][0x2]?_0xc57b30['attrs'][0x2][_0x0a8a('0x60')]:undefined)||0x14}];case _0x0a8a('0x6b'):case _0x0a8a('0x6c'):return[{'name':_0x0a8a('0x6d'),'value':_0xc57b30['attrSerie1']||(_0xc57b30['attrs']&&_0xc57b30[_0x0a8a('0x5f')][0x0]?_0xc57b30[_0x0a8a('0x5f')][0x0][_0x0a8a('0x60')]:undefined)||_0x0a8a('0x69')},{'name':'attrSerie2','value':_0xc57b30['attrSerie2']||(_0xc57b30[_0x0a8a('0x5f')]&&_0xc57b30[_0x0a8a('0x5f')][0x1]?_0xc57b30[_0x0a8a('0x5f')][0x1][_0x0a8a('0x60')]:undefined)||null},{'name':_0x0a8a('0x6e'),'value':_0xc57b30[_0x0a8a('0x6e')]||(_0xc57b30[_0x0a8a('0x5f')]&&_0xc57b30[_0x0a8a('0x5f')][0x2]?_0xc57b30[_0x0a8a('0x5f')][0x2]['value']:undefined)||null},{'name':_0x0a8a('0x6a'),'value':_0xc57b30['attrVoiceQueues']||(_0xc57b30[_0x0a8a('0x5f')]&&_0xc57b30[_0x0a8a('0x5f')][0x3]?_0xc57b30[_0x0a8a('0x5f')][0x3][_0x0a8a('0x60')]:undefined)||[]}];case _0x0a8a('0x6f'):return[{'name':_0x0a8a('0x70'),'type':_0xc57b30['reportType']||(_0xc57b30['attrs']&&_0xc57b30['attrs'][0x0]?_0xc57b30[_0x0a8a('0x5f')][0x0]['type']:undefined)||null,'value':_0xc57b30[_0x0a8a('0x70')]||(_0xc57b30['attrs']&&_0xc57b30[_0x0a8a('0x5f')][0x0]?_0xc57b30[_0x0a8a('0x5f')][0x0][_0x0a8a('0x60')]:undefined)||null},{'name':'attrRefresh','value':_0xc57b30[_0x0a8a('0x71')]||(_0xc57b30[_0x0a8a('0x5f')]&&_0xc57b30['attrs'][0x1]?_0xc57b30[_0x0a8a('0x5f')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4b5827){logger[_0x0a8a('0x31')](_0x0a8a('0x72'),JSON['stringify'](_0x4b5827));return[];}}exports['addItem']=function(_0x46b04a,_0x2d1c35,_0xf26d0){if(_0x46b04a[_0x0a8a('0x52')]['id']){delete _0x46b04a['body']['id'];}return db[_0x0a8a('0x48')][_0x0a8a('0x50')]({'where':{'id':_0x46b04a[_0x0a8a('0x4e')]['id']}})[_0x0a8a('0x2e')](handleEntityNotFound(_0x2d1c35,null))['then'](function(_0x598fda){if(_0x598fda){_0x46b04a[_0x0a8a('0x52')][_0x0a8a('0x73')]=_0x598fda['id'];_0x46b04a['body']['attrs']=widgetAttributes(_0x46b04a[_0x0a8a('0x52')]);return db[_0x0a8a('0x74')][_0x0a8a('0x51')](_0x46b04a[_0x0a8a('0x52')]);}})['then'](respondWithResult(_0x2d1c35,null))[_0x0a8a('0x4c')](handleError(_0x2d1c35,null));};exports[_0x0a8a('0x75')]=function(_0x3031aa,_0x5cabf8,_0x13aacf){var _0x2a3079={};var _0x695d63={};var _0xa1da8;var _0x4bcc36;return db[_0x0a8a('0x48')][_0x0a8a('0x76')]({'where':{'id':_0x3031aa['params']['id']}})[_0x0a8a('0x2e')](handleEntityNotFound(_0x5cabf8,null))[_0x0a8a('0x2e')](function(_0x55327){if(_0x55327){_0xa1da8=_0x55327;_0x695d63[_0x0a8a('0x39')]=_['keys'](db[_0x0a8a('0x74')][_0x0a8a('0x36')]);_0x695d63[_0x0a8a('0x3a')]=_[_0x0a8a('0x3b')](_0x3031aa[_0x0a8a('0x3a')]);_0x695d63[_0x0a8a('0x3c')]=_[_0x0a8a('0x3d')](_0x695d63[_0x0a8a('0x39')],_0x695d63[_0x0a8a('0x3a')]);_0x2a3079[_0x0a8a('0x3e')]=_['intersection'](_0x695d63[_0x0a8a('0x39')],qs['fields'](_0x3031aa[_0x0a8a('0x3a')][_0x0a8a('0x3f')]));_0x2a3079[_0x0a8a('0x3e')]=_0x2a3079[_0x0a8a('0x3e')]['length']?_0x2a3079[_0x0a8a('0x3e')]:_0x695d63['model'];_0x2a3079[_0x0a8a('0x41')]=qs['sort'](_0x3031aa['query'][_0x0a8a('0x42')]);_0x2a3079[_0x0a8a('0x43')]=qs[_0x0a8a('0x3c')](_[_0x0a8a('0x44')](_0x3031aa[_0x0a8a('0x3a')],_0x695d63[_0x0a8a('0x3c')]));if(_0x3031aa[_0x0a8a('0x3a')][_0x0a8a('0x46')]){_0x2a3079['where']=_[_0x0a8a('0x45')](_0x2a3079[_0x0a8a('0x43')],{'$or':_[_0x0a8a('0x35')](_0x2a3079[_0x0a8a('0x3e')],function(_0x8f34df){var _0x5d8644={};_0x5d8644[_0x8f34df]={'$like':'%'+_0x3031aa['query'][_0x0a8a('0x46')]+'%'};return _0x5d8644;})});}_0x2a3079=_[_0x0a8a('0x45')]({},_0x2a3079,_0x3031aa[_0x0a8a('0x47')]);return _0xa1da8[_0x0a8a('0x75')](_0x2a3079);}})[_0x0a8a('0x2e')](function(_0x1db04e){if(_0x1db04e){_0x4bcc36=_0x1db04e[_0x0a8a('0x4f')];if(!_0x3031aa[_0x0a8a('0x3a')]['hasOwnProperty'](_0x0a8a('0x77'))){_0x2a3079[_0x0a8a('0x28')]=qs[_0x0a8a('0x28')](_0x3031aa[_0x0a8a('0x3a')][_0x0a8a('0x28')]);_0x2a3079[_0x0a8a('0x27')]=qs[_0x0a8a('0x27')](_0x3031aa['query'][_0x0a8a('0x27')]);}return _0xa1da8[_0x0a8a('0x75')](_0x2a3079);}})['then'](function(_0x30920d){if(_0x30920d){return _0x30920d?{'count':_0x4bcc36,'rows':_0x30920d}:null;}})[_0x0a8a('0x2e')](respondWithResult(_0x5cabf8,null))[_0x0a8a('0x4c')](handleError(_0x5cabf8,null));}; \ No newline at end of file +var _0x97dc=['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','sendStatus','status','json','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','Dashboard','findAll','rows','show','params','includeAll','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','CustomDashboards','autoAssociation','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','getItems','findOne','nolimit','html-pdf','eml-format','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','desk.js'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x97dc,0xdf));var _0xc97d=function(_0xf1ed4c,_0x1dc080){_0xf1ed4c=_0xf1ed4c-0x0;var _0x529b6e=_0x97dc[_0xf1ed4c];return _0x529b6e;};'use strict';var pdf=require(_0xc97d('0x0'));var emlformat=require(_0xc97d('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc97d('0x2'));var moment=require(_0xc97d('0x3'));var BPromise=require(_0xc97d('0x4'));var Mustache=require(_0xc97d('0x5'));var util=require('util');var path=require(_0xc97d('0x6'));var sox=require(_0xc97d('0x7'));var csv=require('to-csv');var ejs=require(_0xc97d('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc97d('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc97d('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc97d('0xb'));var authService=require(_0xc97d('0xc'));var qs=require(_0xc97d('0xd'));var as=require(_0xc97d('0xe'));var hardwareService=require(_0xc97d('0xf'));var logger=require(_0xc97d('0x10'))(_0xc97d('0x11'));var utils=require(_0xc97d('0x12'));var config=require(_0xc97d('0x13'));var licenseUtil=require(_0xc97d('0x14'));var db=require(_0xc97d('0x15'))['db'];config[_0xc97d('0x16')]=_['defaults'](config[_0xc97d('0x16')],{'host':_0xc97d('0x17'),'port':0x18eb});var socket=require(_0xc97d('0x18'))(new Redis(config['redis']));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x11ae2d,_0x2067e6){_0x2067e6=_0x2067e6||0xcc;return function(_0x27a24e){if(_0x27a24e){return _0x11ae2d[_0xc97d('0x19')](_0x2067e6);}return _0x11ae2d['status'](_0x2067e6)['end']();};}function respondWithResult(_0x56ee8d,_0x3a5571){_0x3a5571=_0x3a5571||0xc8;return function(_0x23e473){if(_0x23e473){return _0x56ee8d[_0xc97d('0x1a')](_0x3a5571)[_0xc97d('0x1b')](_0x23e473);}};}function respondWithFilteredResult(_0x3c8f0f,_0x204663){return function(_0x4217e8){if(_0x4217e8){var _0x222dae=_0x4217e8[_0xc97d('0x1c')],_0x1c45eb=_0x204663['offset'],_0x483d7a=_0x204663['offset']+_0x204663[_0xc97d('0x1d')],_0x5c1509;if(_0x483d7a>=_0x222dae){_0x483d7a=_0x222dae;_0x5c1509=0xc8;}else{_0x5c1509=0xce;}_0x3c8f0f[_0xc97d('0x1a')](_0x5c1509);return _0x3c8f0f['set'](_0xc97d('0x1e'),_0x1c45eb+'-'+_0x483d7a+'/'+_0x222dae)[_0xc97d('0x1b')](_0x4217e8);}return null;};}function patchUpdates(_0x535bc4){return function(_0x490cf9){try{jsonpatch[_0xc97d('0x1f')](_0x490cf9,_0x535bc4,!![]);}catch(_0x5dd501){return BPromise[_0xc97d('0x20')](_0x5dd501);}return _0x490cf9[_0xc97d('0x21')]();};}function saveUpdates(_0x293da6,_0x506ec8){return function(_0x130a0f){if(_0x130a0f){return _0x130a0f[_0xc97d('0x22')](_0x293da6)[_0xc97d('0x23')](function(_0x1a57e8){return _0x1a57e8;});}return null;};}function removeEntity(_0x34c319,_0xd2f932){return function(_0x275eb7){if(_0x275eb7){return _0x275eb7[_0xc97d('0x24')]()[_0xc97d('0x23')](function(){var _0x5009d5=_0x275eb7[_0xc97d('0x25')]({'plain':!![]});var _0x1caa96='CustomDashboards';return db[_0xc97d('0x26')][_0xc97d('0x24')]({'where':{'type':_0x1caa96,'resourceId':_0x5009d5['id']}})[_0xc97d('0x23')](function(){return _0x275eb7;});})[_0xc97d('0x23')](function(){_0x34c319[_0xc97d('0x1a')](0xcc)[_0xc97d('0x27')]();});}};}function handleEntityNotFound(_0x4c8481,_0x306f93){return function(_0xe3a9d0){if(!_0xe3a9d0){_0x4c8481[_0xc97d('0x19')](0x194);}return _0xe3a9d0;};}function handleError(_0x165254,_0x293b30){_0x293b30=_0x293b30||0x1f4;return function(_0x3386fa){logger[_0xc97d('0x28')](_0x3386fa[_0xc97d('0x29')]);if(_0x3386fa[_0xc97d('0x2a')]){delete _0x3386fa['name'];}_0x165254['status'](_0x293b30)[_0xc97d('0x2b')](_0x3386fa);};}exports[_0xc97d('0x2c')]=function(_0xab9be2,_0x40cc8d){var _0x17dc20={},_0x5d6713={},_0xce9d97={'count':0x0,'rows':[]};var _0x5dff0f=_['map'](db['Dashboard'][_0xc97d('0x2d')],function(_0x4e9f9b){return{'name':_0x4e9f9b[_0xc97d('0x2e')],'type':_0x4e9f9b[_0xc97d('0x2f')][_0xc97d('0x30')]};});_0x5d6713[_0xc97d('0x31')]=_[_0xc97d('0x32')](_0x5dff0f,_0xc97d('0x2a'));_0x5d6713['query']=_[_0xc97d('0x33')](_0xab9be2[_0xc97d('0x34')]);_0x5d6713[_0xc97d('0x35')]=_[_0xc97d('0x36')](_0x5d6713['model'],_0x5d6713[_0xc97d('0x34')]);_0x17dc20[_0xc97d('0x37')]=_[_0xc97d('0x36')](_0x5d6713[_0xc97d('0x31')],qs[_0xc97d('0x38')](_0xab9be2[_0xc97d('0x34')][_0xc97d('0x38')]));_0x17dc20[_0xc97d('0x37')]=_0x17dc20[_0xc97d('0x37')][_0xc97d('0x39')]?_0x17dc20[_0xc97d('0x37')]:_0x5d6713['model'];if(!_0xab9be2[_0xc97d('0x34')][_0xc97d('0x3a')]('nolimit')){_0x17dc20['limit']=qs[_0xc97d('0x1d')](_0xab9be2[_0xc97d('0x34')][_0xc97d('0x1d')]);_0x17dc20['offset']=qs[_0xc97d('0x3b')](_0xab9be2[_0xc97d('0x34')][_0xc97d('0x3b')]);}_0x17dc20[_0xc97d('0x3c')]=qs['sort'](_0xab9be2[_0xc97d('0x34')][_0xc97d('0x3d')]);_0x17dc20[_0xc97d('0x3e')]=qs['filters'](_[_0xc97d('0x3f')](_0xab9be2[_0xc97d('0x34')],_0x5d6713[_0xc97d('0x35')]),_0x5dff0f);if(_0xab9be2[_0xc97d('0x34')][_0xc97d('0x40')]){_0x17dc20[_0xc97d('0x3e')]=_[_0xc97d('0x41')](_0x17dc20['where'],{'$or':_[_0xc97d('0x32')](_0x5dff0f,function(_0x3c2e2b){if(_0x3c2e2b[_0xc97d('0x2f')]!==_0xc97d('0x42')){var _0x24c1e6={};_0x24c1e6[_0x3c2e2b[_0xc97d('0x2a')]]={'$like':'%'+_0xab9be2[_0xc97d('0x34')][_0xc97d('0x40')]+'%'};return _0x24c1e6;}})});}_0x17dc20=_[_0xc97d('0x41')]({},_0x17dc20,_0xab9be2[_0xc97d('0x43')]);var _0x3e84e2={'where':_0x17dc20[_0xc97d('0x3e')]};return db[_0xc97d('0x44')][_0xc97d('0x1c')](_0x3e84e2)[_0xc97d('0x23')](function(_0x41fd5e){_0xce9d97[_0xc97d('0x1c')]=_0x41fd5e;if(_0xab9be2[_0xc97d('0x34')]['includeAll']){_0x17dc20['include']=[{'all':!![]}];}return db[_0xc97d('0x44')][_0xc97d('0x45')](_0x17dc20);})[_0xc97d('0x23')](function(_0x534ddd){_0xce9d97[_0xc97d('0x46')]=_0x534ddd;return _0xce9d97;})[_0xc97d('0x23')](respondWithFilteredResult(_0x40cc8d,_0x17dc20))['catch'](handleError(_0x40cc8d,null));};exports[_0xc97d('0x47')]=function(_0x40b030,_0x181464){var _0x48b2ce={'raw':![],'where':{'id':_0x40b030[_0xc97d('0x48')]['id']}},_0x17139b={};_0x17139b[_0xc97d('0x31')]=_['keys'](db[_0xc97d('0x44')]['rawAttributes']);_0x17139b[_0xc97d('0x34')]=_[_0xc97d('0x33')](_0x40b030['query']);_0x17139b[_0xc97d('0x35')]=_[_0xc97d('0x36')](_0x17139b[_0xc97d('0x31')],_0x17139b[_0xc97d('0x34')]);_0x48b2ce[_0xc97d('0x37')]=_[_0xc97d('0x36')](_0x17139b[_0xc97d('0x31')],qs['fields'](_0x40b030[_0xc97d('0x34')][_0xc97d('0x38')]));_0x48b2ce[_0xc97d('0x37')]=_0x48b2ce[_0xc97d('0x37')][_0xc97d('0x39')]?_0x48b2ce[_0xc97d('0x37')]:_0x17139b[_0xc97d('0x31')];if(_0x40b030[_0xc97d('0x34')][_0xc97d('0x49')]){_0x48b2ce[_0xc97d('0x4a')]=[{'all':!![]}];}_0x48b2ce=_[_0xc97d('0x41')]({},_0x48b2ce,_0x40b030[_0xc97d('0x43')]);return db[_0xc97d('0x44')][_0xc97d('0x4b')](_0x48b2ce)['then'](handleEntityNotFound(_0x181464,null))[_0xc97d('0x23')](respondWithResult(_0x181464,null))[_0xc97d('0x4c')](handleError(_0x181464,null));};exports['create']=function(_0x3a3203,_0x3b45f1){return db[_0xc97d('0x44')][_0xc97d('0x4d')](_0x3a3203[_0xc97d('0x4e')],{})[_0xc97d('0x23')](function(_0x587d87){var _0x57acff=_0x3a3203['user']['get']({'plain':!![]});if(!_0x57acff)throw new Error(_0xc97d('0x4f'));if(_0x57acff[_0xc97d('0x50')]===_0xc97d('0x51')){var _0xacfd35=_0x587d87[_0xc97d('0x25')]({'plain':!![]});var _0x199d54='CustomDashboards';return db[_0xc97d('0x52')][_0xc97d('0x4b')]({'where':{'name':_0x199d54,'userProfileId':_0x57acff[_0xc97d('0x53')]},'raw':!![]})[_0xc97d('0x23')](function(_0x359e8f){if(_0x359e8f&&_0x359e8f['autoAssociation']===0x0){return db[_0xc97d('0x26')]['create']({'name':_0xacfd35[_0xc97d('0x2a')],'resourceId':_0xacfd35['id'],'type':_0x359e8f[_0xc97d('0x2a')],'sectionId':_0x359e8f['id']},{})[_0xc97d('0x23')](function(){return _0x587d87;});}else{return _0x587d87;}})['catch'](function(_0x47d99d){logger[_0xc97d('0x28')](_0xc97d('0x54'),_0x47d99d);throw _0x47d99d;});}return _0x587d87;})[_0xc97d('0x23')](respondWithResult(_0x3b45f1,0xc9))[_0xc97d('0x4c')](handleError(_0x3b45f1,null));};exports[_0xc97d('0x55')]=function(_0x43490e,_0x19e152){var _0xd3bd36={'where':{'id':_0x43490e['params']['id']}},_0x259a92={};_0x259a92[_0xc97d('0x31')]=_[_0xc97d('0x33')](db[_0xc97d('0x44')][_0xc97d('0x2d')]);_0xd3bd36['attributes']=_[_0xc97d('0x36')](_0x259a92['model'],qs[_0xc97d('0x38')](_0x43490e['query'][_0xc97d('0x38')]));_0xd3bd36[_0xc97d('0x37')]=_0xd3bd36['attributes']['length']?_0xd3bd36[_0xc97d('0x37')]:_0x259a92[_0xc97d('0x31')];if(_0x43490e['query'][_0xc97d('0x49')]){_0xd3bd36[_0xc97d('0x4a')]=[{'all':!![]}];}_0xd3bd36=_[_0xc97d('0x41')]({},_0xd3bd36,_0x43490e[_0xc97d('0x43')]);return db[_0xc97d('0x44')][_0xc97d('0x4b')](_0xd3bd36)[_0xc97d('0x23')](handleEntityNotFound(_0x19e152,null))[_0xc97d('0x23')](function(_0x3e6b1e){if(_0x3e6b1e){var _0x59550d=_0x3e6b1e[_0xc97d('0x25')]({'plain':!![]});_0x59550d=qs[_0xc97d('0x56')](_0x59550d,['id',_0xc97d('0x57'),'updatedAt']);_0x43490e[_0xc97d('0x4e')]=_[_0xc97d('0x56')](_0x43490e[_0xc97d('0x4e')],['id','createdAt','updatedAt']);return db[_0xc97d('0x44')][_0xc97d('0x4d')](_[_0xc97d('0x41')](_0x59550d,_0x43490e[_0xc97d('0x4e')]),{'include':_0x43490e[_0xc97d('0x34')][_0xc97d('0x49')]?[{'all':!![]}]:undefined})[_0xc97d('0x23')](function(_0x36fca1){var _0x333fa6=_0x43490e[_0xc97d('0x51')]['get']({'plain':!![]});if(!_0x333fa6)throw new Error(_0xc97d('0x4f'));if(_0x333fa6[_0xc97d('0x50')]==='user'){var _0x1f15f2=_0x36fca1[_0xc97d('0x25')]({'plain':!![]});var _0x5d8e3f=_0xc97d('0x58');return db[_0xc97d('0x52')][_0xc97d('0x4b')]({'where':{'name':_0x5d8e3f,'userProfileId':_0x333fa6[_0xc97d('0x53')]},'raw':!![]})['then'](function(_0x1ec66d){if(_0x1ec66d&&_0x1ec66d[_0xc97d('0x59')]===0x0){return db['UserProfileResource'][_0xc97d('0x4d')]({'name':_0x1f15f2['name'],'resourceId':_0x1f15f2['id'],'type':_0x1ec66d[_0xc97d('0x2a')],'sectionId':_0x1ec66d['id']},{})[_0xc97d('0x23')](function(){return _0x36fca1;});}else{return _0x36fca1;}})['catch'](function(_0x5f157f){logger['error'](_0xc97d('0x54'),_0x5f157f);throw _0x5f157f;});}return _0x36fca1;});}})[_0xc97d('0x23')](respondWithResult(_0x19e152,0xc9))['catch'](handleError(_0x19e152,null));};exports[_0xc97d('0x22')]=function(_0x298e3e,_0x22c83d){if(_0x298e3e[_0xc97d('0x4e')]['id']){delete _0x298e3e[_0xc97d('0x4e')]['id'];}return db[_0xc97d('0x44')]['find']({'where':{'id':_0x298e3e[_0xc97d('0x48')]['id']}})['then'](handleEntityNotFound(_0x22c83d,null))[_0xc97d('0x23')](saveUpdates(_0x298e3e['body'],null))[_0xc97d('0x23')](respondWithResult(_0x22c83d,null))[_0xc97d('0x4c')](handleError(_0x22c83d,null));};exports['destroy']=function(_0x41f9ad,_0x35d35d){return db[_0xc97d('0x44')][_0xc97d('0x4b')]({'where':{'id':_0x41f9ad[_0xc97d('0x48')]['id']}})[_0xc97d('0x23')](handleEntityNotFound(_0x35d35d,null))[_0xc97d('0x23')](removeEntity(_0x35d35d,null))[_0xc97d('0x4c')](handleError(_0x35d35d,null));};function widgetAttributes(_0x35db76){try{switch(_0x35db76[_0xc97d('0x2f')]){case _0xc97d('0x5a'):return[{'name':_0xc97d('0x5b'),'value':_0x35db76[_0xc97d('0x5b')]||(_0x35db76[_0xc97d('0x5c')]&&_0x35db76[_0xc97d('0x5c')][0x0]?_0x35db76[_0xc97d('0x5c')][0x0][_0xc97d('0x5d')]:undefined)||'https://'}];case _0xc97d('0x5e'):return[{'name':_0xc97d('0x5f'),'value':_0x35db76[_0xc97d('0x5f')]||(_0x35db76[_0xc97d('0x5c')]&&_0x35db76[_0xc97d('0x5c')][0x0]?_0x35db76[_0xc97d('0x5c')][0x0][_0xc97d('0x5d')]:undefined)||''}];case _0xc97d('0x60'):return[{'name':_0xc97d('0x61'),'value':_0x35db76[_0xc97d('0x61')]||(_0x35db76[_0xc97d('0x5c')]&&_0x35db76[_0xc97d('0x5c')][0x0]?_0x35db76[_0xc97d('0x5c')][0x0][_0xc97d('0x5d')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x35db76['attrTimezone']||(_0x35db76['attrs']&&_0x35db76['attrs'][0x1]?_0x35db76['attrs'][0x1][_0xc97d('0x5d')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x35db76[_0xc97d('0x62')]||(_0x35db76['attrs']&&_0x35db76[_0xc97d('0x5c')][0x2]?_0x35db76[_0xc97d('0x5c')][0x2][_0xc97d('0x5d')]:undefined)||0xc}];case _0xc97d('0x63'):return[{'name':_0xc97d('0x64'),'value':_0x35db76[_0xc97d('0x64')]||(_0x35db76['attrs']&&_0x35db76[_0xc97d('0x5c')][0x0]?_0x35db76[_0xc97d('0x5c')][0x0]['value']:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x35db76[_0xc97d('0x65')]||(_0x35db76[_0xc97d('0x5c')]&&_0x35db76[_0xc97d('0x5c')][0x1]?_0x35db76[_0xc97d('0x5c')][0x1]['value']:undefined)||[]},{'name':_0xc97d('0x62'),'value':_0x35db76[_0xc97d('0x62')]||(_0x35db76['attrs']&&_0x35db76[_0xc97d('0x5c')][0x2]?_0x35db76[_0xc97d('0x5c')][0x2][_0xc97d('0x5d')]:undefined)||0x14}];case _0xc97d('0x66'):case'pie-chart':return[{'name':_0xc97d('0x67'),'value':_0x35db76[_0xc97d('0x67')]||(_0x35db76[_0xc97d('0x5c')]&&_0x35db76['attrs'][0x0]?_0x35db76['attrs'][0x0]['value']:undefined)||_0xc97d('0x68')},{'name':_0xc97d('0x69'),'value':_0x35db76[_0xc97d('0x69')]||(_0x35db76['attrs']&&_0x35db76['attrs'][0x1]?_0x35db76[_0xc97d('0x5c')][0x1][_0xc97d('0x5d')]:undefined)||null},{'name':_0xc97d('0x6a'),'value':_0x35db76[_0xc97d('0x6a')]||(_0x35db76[_0xc97d('0x5c')]&&_0x35db76[_0xc97d('0x5c')][0x2]?_0x35db76[_0xc97d('0x5c')][0x2][_0xc97d('0x5d')]:undefined)||null},{'name':_0xc97d('0x65'),'value':_0x35db76[_0xc97d('0x65')]||(_0x35db76[_0xc97d('0x5c')]&&_0x35db76[_0xc97d('0x5c')][0x3]?_0x35db76[_0xc97d('0x5c')][0x3]['value']:undefined)||[]}];case _0xc97d('0x6b'):return[{'name':_0xc97d('0x6c'),'type':_0x35db76['reportType']||(_0x35db76[_0xc97d('0x5c')]&&_0x35db76[_0xc97d('0x5c')][0x0]?_0x35db76['attrs'][0x0][_0xc97d('0x2f')]:undefined)||null,'value':_0x35db76[_0xc97d('0x6c')]||(_0x35db76[_0xc97d('0x5c')]&&_0x35db76[_0xc97d('0x5c')][0x0]?_0x35db76[_0xc97d('0x5c')][0x0][_0xc97d('0x5d')]:undefined)||null},{'name':_0xc97d('0x6d'),'value':_0x35db76[_0xc97d('0x6d')]||(_0x35db76[_0xc97d('0x5c')]&&_0x35db76[_0xc97d('0x5c')][0x1]?_0x35db76[_0xc97d('0x5c')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x5b40d4){logger[_0xc97d('0x28')](_0xc97d('0x6e'),JSON[_0xc97d('0x6f')](_0x5b40d4));return[];}}exports[_0xc97d('0x70')]=function(_0x478892,_0x5cd5f0,_0x32668a){if(_0x478892['body']['id']){delete _0x478892['body']['id'];}return db[_0xc97d('0x44')]['find']({'where':{'id':_0x478892[_0xc97d('0x48')]['id']}})[_0xc97d('0x23')](handleEntityNotFound(_0x5cd5f0,null))[_0xc97d('0x23')](function(_0x227505){if(_0x227505){_0x478892[_0xc97d('0x4e')][_0xc97d('0x71')]=_0x227505['id'];_0x478892[_0xc97d('0x4e')][_0xc97d('0x5c')]=widgetAttributes(_0x478892[_0xc97d('0x4e')]);return db['DashboardItem'][_0xc97d('0x4d')](_0x478892['body']);}})[_0xc97d('0x23')](respondWithResult(_0x5cd5f0,null))[_0xc97d('0x4c')](handleError(_0x5cd5f0,null));};exports[_0xc97d('0x72')]=function(_0x4cfdb2,_0x267766,_0x4267b2){var _0x4c478e={};var _0xff63a3={};var _0x12babf;var _0x5a4da7;return db['Dashboard'][_0xc97d('0x73')]({'where':{'id':_0x4cfdb2['params']['id']}})[_0xc97d('0x23')](handleEntityNotFound(_0x267766,null))['then'](function(_0x236bf8){if(_0x236bf8){_0x12babf=_0x236bf8;_0xff63a3[_0xc97d('0x31')]=_[_0xc97d('0x33')](db['DashboardItem']['rawAttributes']);_0xff63a3[_0xc97d('0x34')]=_[_0xc97d('0x33')](_0x4cfdb2[_0xc97d('0x34')]);_0xff63a3[_0xc97d('0x35')]=_[_0xc97d('0x36')](_0xff63a3['model'],_0xff63a3['query']);_0x4c478e[_0xc97d('0x37')]=_[_0xc97d('0x36')](_0xff63a3[_0xc97d('0x31')],qs[_0xc97d('0x38')](_0x4cfdb2[_0xc97d('0x34')][_0xc97d('0x38')]));_0x4c478e['attributes']=_0x4c478e['attributes'][_0xc97d('0x39')]?_0x4c478e['attributes']:_0xff63a3[_0xc97d('0x31')];_0x4c478e[_0xc97d('0x3c')]=qs[_0xc97d('0x3d')](_0x4cfdb2[_0xc97d('0x34')][_0xc97d('0x3d')]);_0x4c478e['where']=qs[_0xc97d('0x35')](_[_0xc97d('0x3f')](_0x4cfdb2[_0xc97d('0x34')],_0xff63a3[_0xc97d('0x35')]));if(_0x4cfdb2['query'][_0xc97d('0x40')]){_0x4c478e[_0xc97d('0x3e')]=_[_0xc97d('0x41')](_0x4c478e[_0xc97d('0x3e')],{'$or':_[_0xc97d('0x32')](_0x4c478e[_0xc97d('0x37')],function(_0x263c74){var _0x3b58c4={};_0x3b58c4[_0x263c74]={'$like':'%'+_0x4cfdb2[_0xc97d('0x34')][_0xc97d('0x40')]+'%'};return _0x3b58c4;})});}_0x4c478e=_[_0xc97d('0x41')]({},_0x4c478e,_0x4cfdb2[_0xc97d('0x43')]);return _0x12babf['getItems'](_0x4c478e);}})[_0xc97d('0x23')](function(_0x4e8a0d){if(_0x4e8a0d){_0x5a4da7=_0x4e8a0d[_0xc97d('0x39')];if(!_0x4cfdb2[_0xc97d('0x34')][_0xc97d('0x3a')](_0xc97d('0x74'))){_0x4c478e[_0xc97d('0x1d')]=qs['limit'](_0x4cfdb2[_0xc97d('0x34')][_0xc97d('0x1d')]);_0x4c478e[_0xc97d('0x3b')]=qs[_0xc97d('0x3b')](_0x4cfdb2['query'][_0xc97d('0x3b')]);}return _0x12babf[_0xc97d('0x72')](_0x4c478e);}})[_0xc97d('0x23')](function(_0x118bae){if(_0x118bae){return _0x118bae?{'count':_0x5a4da7,'rows':_0x118bae}:null;}})[_0xc97d('0x23')](respondWithResult(_0x267766,null))[_0xc97d('0x4c')](handleError(_0x267766,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index ac5973f..f532b40 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 _0xbbdb=['hook','events','Dashboard','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4180c6,_0x642cf3){var _0xe0e5aa=function(_0x37f4e8){while(--_0x37f4e8){_0x4180c6['push'](_0x4180c6['shift']());}};_0xe0e5aa(++_0x642cf3);}(_0xbbdb,0x118));var _0xbbbd=function(_0x1dc24d,_0x541fa4){_0x1dc24d=_0x1dc24d-0x0;var _0x5d7fb2=_0xbbdb[_0x1dc24d];return _0x5d7fb2;};'use strict';var EventEmitter=require(_0xbbbd('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xbbbd('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xbbbd('0x2')](0x0);var events={'afterCreate':_0xbbbd('0x3'),'afterUpdate':_0xbbbd('0x4'),'afterDestroy':_0xbbbd('0x5')};function emitEvent(_0x35c7e3){return function(_0x135627,_0x1b4a95,_0x3c51c6){DashboardEvents[_0xbbbd('0x6')](_0x35c7e3+':'+_0x135627['id'],_0x135627);DashboardEvents['emit'](_0x35c7e3,_0x135627);_0x3c51c6(null);};}for(var e in events){if(events[_0xbbbd('0x7')](e)){var event=events[e];Dashboard[_0xbbbd('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x8999=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save'];(function(_0x43048a,_0x47d90e){var _0x36faa1=function(_0x4b7bf5){while(--_0x4b7bf5){_0x43048a['push'](_0x43048a['shift']());}};_0x36faa1(++_0x47d90e);}(_0x8999,0x1a3));var _0x9899=function(_0x103994,_0x341732){_0x103994=_0x103994-0x0;var _0x4c4988=_0x8999[_0x103994];return _0x4c4988;};'use strict';var EventEmitter=require(_0x9899('0x0'));var Dashboard=require(_0x9899('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x9899('0x2')](0x0);var events={'afterCreate':_0x9899('0x3'),'afterUpdate':_0x9899('0x4'),'afterDestroy':_0x9899('0x5')};function emitEvent(_0x912100){return function(_0x51bfa9,_0x25c959,_0x4698f9){DashboardEvents['emit'](_0x912100+':'+_0x51bfa9['id'],_0x51bfa9);DashboardEvents[_0x9899('0x6')](_0x912100,_0x51bfa9);_0x4698f9(null);};}for(var e in events){if(events[_0x9899('0x7')](e)){var event=events[e];Dashboard[_0x9899('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 c056180..3cbfb98 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 _0x1aaa=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','lodash'];(function(_0x4277b0,_0x1fc0ae){var _0x342cd6=function(_0x2f00fe){while(--_0x2f00fe){_0x4277b0['push'](_0x4277b0['shift']());}};_0x342cd6(++_0x1fc0ae);}(_0x1aaa,0x144));var _0xa1aa=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0x1aaa[_0x19159a];return _0xa677f4;};'use strict';var _=require(_0xa1aa('0x0'));var util=require(_0xa1aa('0x1'));var logger=require(_0xa1aa('0x2'))(_0xa1aa('0x3'));var moment=require('moment');var BPromise=require(_0xa1aa('0x4'));var rp=require(_0xa1aa('0x5'));var fs=require('fs');var path=require(_0xa1aa('0x6'));var rimraf=require(_0xa1aa('0x7'));var config=require(_0xa1aa('0x8'));var attributes=require(_0xa1aa('0x9'));module[_0xa1aa('0xa')]=function(_0x482dad,_0x25deb3){return _0x482dad[_0xa1aa('0xb')](_0xa1aa('0xc'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e5f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x33f15d,_0x46d3a1){var _0x5b3121=function(_0xa53c51){while(--_0xa53c51){_0x33f15d['push'](_0x33f15d['shift']());}};_0x5b3121(++_0x46d3a1);}(_0x9e5f,0x72));var _0xf9e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9e5f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf9e5('0x0'));var util=require(_0xf9e5('0x1'));var logger=require(_0xf9e5('0x2'))(_0xf9e5('0x3'));var moment=require(_0xf9e5('0x4'));var BPromise=require(_0xf9e5('0x5'));var rp=require(_0xf9e5('0x6'));var fs=require('fs');var path=require(_0xf9e5('0x7'));var rimraf=require(_0xf9e5('0x8'));var config=require(_0xf9e5('0x9'));var attributes=require(_0xf9e5('0xa'));module[_0xf9e5('0xb')]=function(_0x352122,_0x324c89){return _0x352122[_0xf9e5('0xc')]('Dashboard',attributes,{'tableName':'dashboards','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 e754eb2..6364707 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 _0xac26=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result'];(function(_0x4bf96c,_0x4d24fd){var _0x281d09=function(_0x56538e){while(--_0x56538e){_0x4bf96c['push'](_0x4bf96c['shift']());}};_0x281d09(++_0x4d24fd);}(_0xac26,0x1ee));var _0x6ac2=function(_0x3dcbfd,_0x12c1e5){_0x3dcbfd=_0x3dcbfd-0x0;var _0x1ce1d1=_0xac26[_0x3dcbfd];return _0x1ce1d1;};'use strict';var _=require(_0x6ac2('0x0'));var util=require(_0x6ac2('0x1'));var moment=require(_0x6ac2('0x2'));var BPromise=require(_0x6ac2('0x3'));var rs=require(_0x6ac2('0x4'));var fs=require('fs');var Redis=require(_0x6ac2('0x5'));var db=require(_0x6ac2('0x6'))['db'];var utils=require(_0x6ac2('0x7'));var logger=require(_0x6ac2('0x8'))(_0x6ac2('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6ac2('0xa')][_0x6ac2('0xb')]({'port':0x232a});config[_0x6ac2('0xc')]=_[_0x6ac2('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6ac2('0xe'))(new Redis(config[_0x6ac2('0xc')]));require(_0x6ac2('0xf'))[_0x6ac2('0x10')](socket);function respondWithRpcPromise(_0x17ff73,_0x3d3f4f,_0x2407c4){return new BPromise(function(_0x50f790,_0x1aaace){return client[_0x6ac2('0x11')](_0x17ff73,_0x2407c4)[_0x6ac2('0x12')](function(_0x10e05b){logger[_0x6ac2('0x13')](_0x6ac2('0x14'),_0x3d3f4f,_0x6ac2('0x15'));logger['debug'](_0x6ac2('0x16'),_0x3d3f4f,'request\x20sent',JSON[_0x6ac2('0x17')](_0x10e05b));if(_0x10e05b['error']){if(_0x10e05b['error'][_0x6ac2('0x18')]===0x1f4){logger[_0x6ac2('0x19')](_0x6ac2('0x14'),_0x3d3f4f,_0x10e05b['error'][_0x6ac2('0x1a')]);return _0x1aaace(_0x10e05b[_0x6ac2('0x19')][_0x6ac2('0x1a')]);}logger['error'](_0x6ac2('0x14'),_0x3d3f4f,_0x10e05b[_0x6ac2('0x19')][_0x6ac2('0x1a')]);return _0x50f790(_0x10e05b[_0x6ac2('0x19')][_0x6ac2('0x1a')]);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x3d3f4f,_0x6ac2('0x15'));_0x50f790(_0x10e05b[_0x6ac2('0x1b')]['message']);}})[_0x6ac2('0x1c')](function(_0x2441f9){logger[_0x6ac2('0x19')]('Dashboard,\x20%s,\x20%s',_0x3d3f4f,_0x2441f9);_0x1aaace(_0x2441f9);});});} \ No newline at end of file +var _0xd38f=['client','http','redis','socket.io-emitter','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x8339f5,_0x5de2c2){var _0xb11cb=function(_0x3bf28b){while(--_0x3bf28b){_0x8339f5['push'](_0x8339f5['shift']());}};_0xb11cb(++_0x5de2c2);}(_0xd38f,0x10c));var _0xfd38=function(_0x1cc350,_0x31970a){_0x1cc350=_0x1cc350-0x0;var _0x1b639d=_0xd38f[_0x1cc350];return _0x1b639d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xfd38('0x0'));var rs=require(_0xfd38('0x1'));var fs=require('fs');var Redis=require(_0xfd38('0x2'));var db=require(_0xfd38('0x3'))['db'];var utils=require(_0xfd38('0x4'));var logger=require(_0xfd38('0x5'))(_0xfd38('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfd38('0x7')][_0xfd38('0x8')]({'port':0x232a});config[_0xfd38('0x9')]=_['defaults'](config[_0xfd38('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xfd38('0xa'))(new Redis(config[_0xfd38('0x9')]));require(_0xfd38('0xb'))[_0xfd38('0xc')](socket);function respondWithRpcPromise(_0x1f394c,_0x105c1d,_0x5a0c52){return new BPromise(function(_0x4ad003,_0x2b1bea){return client[_0xfd38('0xd')](_0x1f394c,_0x5a0c52)[_0xfd38('0xe')](function(_0x147fcb){logger[_0xfd38('0xf')](_0xfd38('0x10'),_0x105c1d,_0xfd38('0x11'));logger[_0xfd38('0x12')](_0xfd38('0x13'),_0x105c1d,'request\x20sent',JSON['stringify'](_0x147fcb));if(_0x147fcb[_0xfd38('0x14')]){if(_0x147fcb[_0xfd38('0x14')][_0xfd38('0x15')]===0x1f4){logger[_0xfd38('0x14')](_0xfd38('0x10'),_0x105c1d,_0x147fcb['error']['message']);return _0x2b1bea(_0x147fcb[_0xfd38('0x14')]['message']);}logger[_0xfd38('0x14')](_0xfd38('0x10'),_0x105c1d,_0x147fcb[_0xfd38('0x14')][_0xfd38('0x16')]);return _0x4ad003(_0x147fcb[_0xfd38('0x14')]['message']);}else{logger[_0xfd38('0xf')]('Dashboard,\x20%s,\x20%s',_0x105c1d,_0xfd38('0x11'));_0x4ad003(_0x147fcb[_0xfd38('0x17')][_0xfd38('0x16')]);}})[_0xfd38('0x18')](function(_0x399347){logger['error'](_0xfd38('0x10'),_0x105c1d,_0x399347);_0x2b1bea(_0x399347);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index ae7e9cd..a073633 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 _0x735d=['save','remove','emit','removeListener','register','length','dashboard:','./dashboard.events'];(function(_0x82d9e9,_0x381055){var _0x30d4a2=function(_0x176fa7){while(--_0x176fa7){_0x82d9e9['push'](_0x82d9e9['shift']());}};_0x30d4a2(++_0x381055);}(_0x735d,0x13f));var _0xd735=function(_0x5dfc2a,_0x1a953f){_0x5dfc2a=_0x5dfc2a-0x0;var _0x3f1a71=_0x735d[_0x5dfc2a];return _0x3f1a71;};'use strict';var DashboardEvents=require(_0xd735('0x0'));var events=[_0xd735('0x1'),_0xd735('0x2'),'update'];function createListener(_0x430c7e,_0x1d6d02){return function(_0x34d14b){_0x1d6d02[_0xd735('0x3')](_0x430c7e,_0x34d14b);};}function removeListener(_0x4935bd,_0x25ed99){return function(){DashboardEvents[_0xd735('0x4')](_0x4935bd,_0x25ed99);};}exports[_0xd735('0x5')]=function(_0x331e24){for(var _0xf4574=0x0,_0x4e1ff0=events[_0xd735('0x6')];_0xf4574<_0x4e1ff0;_0xf4574++){var _0x1abbfa=events[_0xf4574];var _0x263c52=createListener(_0xd735('0x7')+_0x1abbfa,_0x331e24);DashboardEvents['on'](_0x1abbfa,_0x263c52);}}; \ No newline at end of file +var _0x9cad=['./dashboard.events','save','remove','update','emit','register','length','dashboard:'];(function(_0x3dbb64,_0x4a75c1){var _0x1be5c7=function(_0xf1c6a0){while(--_0xf1c6a0){_0x3dbb64['push'](_0x3dbb64['shift']());}};_0x1be5c7(++_0x4a75c1);}(_0x9cad,0x128));var _0xd9ca=function(_0x163cd0,_0x461c03){_0x163cd0=_0x163cd0-0x0;var _0x166213=_0x9cad[_0x163cd0];return _0x166213;};'use strict';var DashboardEvents=require(_0xd9ca('0x0'));var events=[_0xd9ca('0x1'),_0xd9ca('0x2'),_0xd9ca('0x3')];function createListener(_0x454415,_0x442382){return function(_0x42e417){_0x442382[_0xd9ca('0x4')](_0x454415,_0x42e417);};}function removeListener(_0x1212ba,_0x4aaa28){return function(){DashboardEvents['removeListener'](_0x1212ba,_0x4aaa28);};}exports[_0xd9ca('0x5')]=function(_0x131070){for(var _0x3ffbbf=0x0,_0x2287e8=events[_0xd9ca('0x6')];_0x3ffbbf<_0x2287e8;_0x3ffbbf++){var _0x459014=events[_0x3ffbbf];var _0x3e632c=createListener(_0xd9ca('0x7')+_0x459014,_0x131070);DashboardEvents['on'](_0x459014,_0x3e632c);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index cc0f355..4407a1a 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 _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','create','post','/:id/clone','addItem','put','update'];(function(_0x3f020f,_0xdc7e7){var _0x520707=function(_0x36039a){while(--_0x36039a){_0x3f020f['push'](_0x3f020f['shift']());}};_0x520707(++_0xdc7e7);}(_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 auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['post']('/',auth[_0x3071('0x8')](),controller[_0x3071('0xe')]);router[_0x3071('0xf')](_0x3071('0x10'),auth[_0x3071('0x8')](),controller['clone']);router[_0x3071('0xf')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0x11')]);router[_0x3071('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['delete'](_0x3071('0xa'),auth[_0x3071('0x8')](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file +var _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','create','post','/:id/clone','addItem','put','update'];(function(_0x2b28bc,_0x1e448a){var _0x509b92=function(_0x46ca5b){while(--_0x46ca5b){_0x2b28bc['push'](_0x2b28bc['shift']());}};_0x509b92(++_0x1e448a);}(_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 auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['post']('/',auth[_0x3071('0x8')](),controller[_0x3071('0xe')]);router[_0x3071('0xf')](_0x3071('0x10'),auth[_0x3071('0x8')](),controller['clone']);router[_0x3071('0xf')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0x11')]);router[_0x3071('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x3071('0x13')]);router['delete'](_0x3071('0xa'),auth[_0x3071('0x8')](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 3aa87cd..e115dc6 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 _0xc62c=['long','parse','getDataValue','attrs','stringify','INTEGER','#ffffff','#2196f3','squel','lodash','exports','STRING'];(function(_0x123b63,_0x590b9e){var _0xf2c644=function(_0x30070f){while(--_0x30070f){_0x123b63['push'](_0x123b63['shift']());}};_0xf2c644(++_0x590b9e);}(_0xc62c,0x1e8));var _0xcc62=function(_0x3d857b,_0x11cb3e){_0x3d857b=_0x3d857b-0x0;var _0x371589=_0xc62c[_0x3d857b];return _0x371589;};'use strict';var Sequelize=require('sequelize');var squel=require(_0xcc62('0x0'));var _=require(_0xcc62('0x1'));module[_0xcc62('0x2')]={'title':{'type':Sequelize[_0xcc62('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xcc62('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xcc62('0x4')),'get':function(){try{return JSON[_0xcc62('0x5')](this[_0xcc62('0x6')](_0xcc62('0x7')));}catch(_0x1650bb){return[];}},'set':function(_0x5b6f44){try{this['setDataValue'](_0xcc62('0x7'),JSON[_0xcc62('0x8')](_0x5b6f44));}catch(_0x10e2ca){this['setDataValue'](_0xcc62('0x7'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xcc62('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xcc62('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0xcc62('0x9')]},'background':{'type':Sequelize[_0xcc62('0x3')],'allowNull':![],'defaultValue':_0xcc62('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xcc62('0x3')],'allowNull':![],'defaultValue':_0xcc62('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x48fe=['STRING','#ffffff','sequelize','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER'];(function(_0x2b373e,_0x4c5da6){var _0x1a1b71=function(_0x310cf1){while(--_0x310cf1){_0x2b373e['push'](_0x2b373e['shift']());}};_0x1a1b71(++_0x4c5da6);}(_0x48fe,0x138));var _0xe48f=function(_0x324486,_0x1c8072){_0x324486=_0x324486-0x0;var _0x273008=_0x48fe[_0x324486];return _0x273008;};'use strict';var Sequelize=require(_0xe48f('0x0'));var squel=require('squel');var _=require('lodash');module['exports']={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xe48f('0x1')),'get':function(){try{return JSON[_0xe48f('0x2')](this[_0xe48f('0x3')](_0xe48f('0x4')));}catch(_0x1b40a0){return[];}},'set':function(_0x2bf584){try{this[_0xe48f('0x5')]('attrs',JSON[_0xe48f('0x6')](_0x2bf584));}catch(_0x14f264){this[_0xe48f('0x5')](_0xe48f('0x4'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xe48f('0x7')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xe48f('0x7')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xe48f('0x7')]},'col':{'type':Sequelize[_0xe48f('0x7')]},'background':{'type':Sequelize[_0xe48f('0x8')],'allowNull':![],'defaultValue':_0xe48f('0x9'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xe48f('0x8')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xe48f('0x8')]},'titleFontSize':{'type':Sequelize[_0xe48f('0x7')],'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 c6a2f89..38049a6 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 _0xc440=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','count','limit','set','apply','reject','save','then','stack','name','send','show','params','model','DashboardItem','rawAttributes','query','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','destroy','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','error','create','body','update','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','crypto','querystring','papaparse','../../components/parsers/qs'];(function(_0x1ef727,_0x228cc5){var _0x3c4426=function(_0x3a1cec){while(--_0x3a1cec){_0x1ef727['push'](_0x1ef727['shift']());}};_0x3c4426(++_0x228cc5);}(_0xc440,0xf1));var _0x0c44=function(_0x320243,_0x55038d){_0x320243=_0x320243-0x0;var _0x1c9c6a=_0xc440[_0x320243];return _0x1c9c6a;};'use strict';var pdf=require(_0x0c44('0x0'));var emlformat=require(_0x0c44('0x1'));var rimraf=require(_0x0c44('0x2'));var zipdir=require(_0x0c44('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0c44('0x4'));var moment=require(_0x0c44('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0c44('0x6'));var path=require(_0x0c44('0x7'));var sox=require(_0x0c44('0x8'));var csv=require(_0x0c44('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0c44('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0c44('0x9'));var querystring=require(_0x0c44('0xb'));var Papa=require(_0x0c44('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0c44('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0c44('0xe'));var logger=require('../../config/logger')(_0x0c44('0xf'));var utils=require(_0x0c44('0x10'));var config=require(_0x0c44('0x11'));var licenseUtil=require(_0x0c44('0x12'));var db=require(_0x0c44('0x13'))['db'];config[_0x0c44('0x14')]=_[_0x0c44('0x15')](config[_0x0c44('0x14')],{'host':_0x0c44('0x16'),'port':0x18eb});var socket=require(_0x0c44('0x17'))(new Redis(config[_0x0c44('0x14')]));require(_0x0c44('0x18'))[_0x0c44('0x19')](socket);function respondWithStatusCode(_0x3a88fd,_0x48b4a9){_0x48b4a9=_0x48b4a9||0xcc;return function(_0x40aaa5){if(_0x40aaa5){return _0x3a88fd[_0x0c44('0x1a')](_0x48b4a9);}return _0x3a88fd[_0x0c44('0x1b')](_0x48b4a9)[_0x0c44('0x1c')]();};}function respondWithResult(_0x45d8ba,_0x251434){_0x251434=_0x251434||0xc8;return function(_0x512e6b){if(_0x512e6b){return _0x45d8ba[_0x0c44('0x1b')](_0x251434)[_0x0c44('0x1d')](_0x512e6b);}};}function respondWithFilteredResult(_0x3d9aad,_0x4fee28){return function(_0x528c0b){if(_0x528c0b){var _0x8f8bc1=_0x528c0b[_0x0c44('0x1e')],_0x501ced=_0x4fee28['offset'],_0x3f34c8=_0x4fee28['offset']+_0x4fee28[_0x0c44('0x1f')],_0x4a9158;if(_0x3f34c8>=_0x8f8bc1){_0x3f34c8=_0x8f8bc1;_0x4a9158=0xc8;}else{_0x4a9158=0xce;}_0x3d9aad[_0x0c44('0x1b')](_0x4a9158);return _0x3d9aad[_0x0c44('0x20')]('Content-Range',_0x501ced+'-'+_0x3f34c8+'/'+_0x8f8bc1)['json'](_0x528c0b);}return null;};}function patchUpdates(_0x54525f){return function(_0x17e51a){try{jsonpatch[_0x0c44('0x21')](_0x17e51a,_0x54525f,!![]);}catch(_0x14f400){return BPromise[_0x0c44('0x22')](_0x14f400);}return _0x17e51a[_0x0c44('0x23')]();};}function saveUpdates(_0x160cf9,_0x55f964){return function(_0x50d500){if(_0x50d500){return _0x50d500['update'](_0x160cf9)[_0x0c44('0x24')](function(_0x1448e8){return _0x1448e8;});}return null;};}function removeEntity(_0xc652b0,_0x30d121){return function(_0x44e939){if(_0x44e939){return _0x44e939['destroy']()[_0x0c44('0x24')](function(){_0xc652b0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dbf9f,_0x52770f){return function(_0x4698c0){if(!_0x4698c0){_0x1dbf9f[_0x0c44('0x1a')](0x194);}return _0x4698c0;};}function handleError(_0x1a2235,_0x1428f6){_0x1428f6=_0x1428f6||0x1f4;return function(_0x5891bb){logger['error'](_0x5891bb[_0x0c44('0x25')]);if(_0x5891bb[_0x0c44('0x26')]){delete _0x5891bb[_0x0c44('0x26')];}_0x1a2235[_0x0c44('0x1b')](_0x1428f6)[_0x0c44('0x27')](_0x5891bb);};}exports[_0x0c44('0x28')]=function(_0x3afc44,_0x239d04){var _0x5984fc={'raw':![],'where':{'id':_0x3afc44[_0x0c44('0x29')]['id']}},_0x4c8d0d={};_0x4c8d0d[_0x0c44('0x2a')]=_['keys'](db[_0x0c44('0x2b')][_0x0c44('0x2c')]);_0x4c8d0d[_0x0c44('0x2d')]=_[_0x0c44('0x2e')](_0x3afc44[_0x0c44('0x2d')]);_0x4c8d0d[_0x0c44('0x2f')]=_[_0x0c44('0x30')](_0x4c8d0d[_0x0c44('0x2a')],_0x4c8d0d[_0x0c44('0x2d')]);_0x5984fc[_0x0c44('0x31')]=_['intersection'](_0x4c8d0d['model'],qs[_0x0c44('0x32')](_0x3afc44[_0x0c44('0x2d')]['fields']));_0x5984fc['attributes']=_0x5984fc[_0x0c44('0x31')][_0x0c44('0x33')]?_0x5984fc[_0x0c44('0x31')]:_0x4c8d0d[_0x0c44('0x2a')];if(_0x3afc44[_0x0c44('0x2d')][_0x0c44('0x34')]){_0x5984fc[_0x0c44('0x35')]=[{'all':!![]}];}_0x5984fc=_[_0x0c44('0x36')]({},_0x5984fc,_0x3afc44[_0x0c44('0x37')]);return db[_0x0c44('0x2b')][_0x0c44('0x38')](_0x5984fc)['then'](handleEntityNotFound(_0x239d04,null))['then'](respondWithResult(_0x239d04,null))['catch'](handleError(_0x239d04,null));};exports[_0x0c44('0x39')]=function(_0x101737,_0x21470a){return db['DashboardItem']['find']({'where':{'id':_0x101737['params']['id']}})['then'](handleEntityNotFound(_0x21470a,null))['then'](removeEntity(_0x21470a,null))[_0x0c44('0x3a')](handleError(_0x21470a,null));};function widgetAttributes(_0x320591){try{switch(_0x320591[_0x0c44('0x3b')]){case _0x0c44('0x3c'):return[{'name':_0x0c44('0x3d'),'value':_0x320591[_0x0c44('0x3d')]||(_0x320591[_0x0c44('0x3e')]&&_0x320591[_0x0c44('0x3e')][0x0]?_0x320591[_0x0c44('0x3e')][0x0][_0x0c44('0x3f')]:undefined)||_0x0c44('0x40')}];case _0x0c44('0x41'):return[{'name':_0x0c44('0x42'),'value':_0x320591[_0x0c44('0x42')]||(_0x320591[_0x0c44('0x3e')]&&_0x320591[_0x0c44('0x3e')][0x0]?_0x320591[_0x0c44('0x3e')][0x0][_0x0c44('0x3f')]:undefined)||''}];case _0x0c44('0x43'):return[{'name':_0x0c44('0x44'),'value':_0x320591[_0x0c44('0x44')]||(_0x320591[_0x0c44('0x3e')]&&_0x320591[_0x0c44('0x3e')][0x0]?_0x320591[_0x0c44('0x3e')][0x0][_0x0c44('0x3f')]:undefined)||_0x0c44('0x45')},{'name':_0x0c44('0x46'),'value':_0x320591[_0x0c44('0x46')]||(_0x320591[_0x0c44('0x3e')]&&_0x320591[_0x0c44('0x3e')][0x1]?_0x320591[_0x0c44('0x3e')][0x1][_0x0c44('0x3f')]:undefined)||'0.00'},{'name':_0x0c44('0x47'),'value':_0x320591[_0x0c44('0x47')]||(_0x320591[_0x0c44('0x3e')]&&_0x320591[_0x0c44('0x3e')][0x2]?_0x320591[_0x0c44('0x3e')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x0c44('0x48'),'value':_0x320591[_0x0c44('0x48')]||(_0x320591[_0x0c44('0x3e')]&&_0x320591[_0x0c44('0x3e')][0x0]?_0x320591[_0x0c44('0x3e')][0x0][_0x0c44('0x3f')]:undefined)||'total'},{'name':_0x0c44('0x49'),'value':_0x320591['attrVoiceQueues']||(_0x320591[_0x0c44('0x3e')]&&_0x320591[_0x0c44('0x3e')][0x1]?_0x320591[_0x0c44('0x3e')][0x1][_0x0c44('0x3f')]:undefined)||[]},{'name':_0x0c44('0x47'),'value':_0x320591[_0x0c44('0x47')]||(_0x320591[_0x0c44('0x3e')]&&_0x320591[_0x0c44('0x3e')][0x2]?_0x320591['attrs'][0x2][_0x0c44('0x3f')]:undefined)||0x14}];case _0x0c44('0x4a'):case'pie-chart':return[{'name':_0x0c44('0x4b'),'value':_0x320591[_0x0c44('0x4b')]||(_0x320591[_0x0c44('0x3e')]&&_0x320591[_0x0c44('0x3e')][0x0]?_0x320591[_0x0c44('0x3e')][0x0][_0x0c44('0x3f')]:undefined)||'total'},{'name':_0x0c44('0x4c'),'value':_0x320591[_0x0c44('0x4c')]||(_0x320591[_0x0c44('0x3e')]&&_0x320591['attrs'][0x1]?_0x320591[_0x0c44('0x3e')][0x1][_0x0c44('0x3f')]:undefined)||null},{'name':_0x0c44('0x4d'),'value':_0x320591[_0x0c44('0x4d')]||(_0x320591[_0x0c44('0x3e')]&&_0x320591[_0x0c44('0x3e')][0x2]?_0x320591['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x320591['attrVoiceQueues']||(_0x320591['attrs']&&_0x320591[_0x0c44('0x3e')][0x3]?_0x320591[_0x0c44('0x3e')][0x3][_0x0c44('0x3f')]:undefined)||[]}];case _0x0c44('0x4e'):return[{'name':_0x0c44('0x4f'),'type':_0x320591['reportType']||(_0x320591[_0x0c44('0x3e')]&&_0x320591[_0x0c44('0x3e')][0x0]?_0x320591[_0x0c44('0x3e')][0x0][_0x0c44('0x3b')]:undefined)||null,'value':_0x320591[_0x0c44('0x4f')]||(_0x320591[_0x0c44('0x3e')]&&_0x320591['attrs'][0x0]?_0x320591['attrs'][0x0]['value']:undefined)||null},{'name':_0x0c44('0x50'),'value':_0x320591['attrRefresh']||(_0x320591[_0x0c44('0x3e')]&&_0x320591[_0x0c44('0x3e')][0x1]?_0x320591[_0x0c44('0x3e')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x57b991){logger[_0x0c44('0x51')]('widgetAttributes:\x20%s',JSON['stringify'](_0x57b991));return[];}}exports[_0x0c44('0x52')]=function(_0x33d45d,_0x35d742){if(_0x33d45d[_0x0c44('0x53')]){_0x33d45d[_0x0c44('0x53')]['attrs']=widgetAttributes(_0x33d45d[_0x0c44('0x53')]);}return db[_0x0c44('0x2b')][_0x0c44('0x52')](_0x33d45d['body'],{})[_0x0c44('0x24')](respondWithResult(_0x35d742,0xc9))[_0x0c44('0x3a')](handleError(_0x35d742,null));};exports[_0x0c44('0x54')]=function(_0x4e7fbf,_0x3227ca){if(_0x4e7fbf['body']['id']){delete _0x4e7fbf['body']['id'];}_0x4e7fbf[_0x0c44('0x53')][_0x0c44('0x3e')]=widgetAttributes(_0x4e7fbf[_0x0c44('0x53')]);return db[_0x0c44('0x2b')][_0x0c44('0x38')]({'where':{'id':_0x4e7fbf['params']['id']}})[_0x0c44('0x24')](handleEntityNotFound(_0x3227ca,null))[_0x0c44('0x24')](saveUpdates(_0x4e7fbf[_0x0c44('0x53')],null))[_0x0c44('0x24')](respondWithResult(_0x3227ca,null))[_0x0c44('0x3a')](handleError(_0x3227ca,null));}; \ No newline at end of file +var _0x1b84=['fields','length','include','options','find','catch','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','html-pdf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes'];(function(_0x40e41e,_0x3d30e7){var _0x18b70c=function(_0x2b4b66){while(--_0x2b4b66){_0x40e41e['push'](_0x40e41e['shift']());}};_0x18b70c(++_0x3d30e7);}(_0x1b84,0x12e));var _0x41b8=function(_0x44b089,_0x5c35f0){_0x44b089=_0x44b089-0x0;var _0x20cbd2=_0x1b84[_0x44b089];return _0x20cbd2;};'use strict';var pdf=require(_0x41b8('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x41b8('0x1'));var BPromise=require(_0x41b8('0x2'));var Mustache=require(_0x41b8('0x3'));var util=require(_0x41b8('0x4'));var path=require(_0x41b8('0x5'));var sox=require(_0x41b8('0x6'));var csv=require(_0x41b8('0x7'));var ejs=require(_0x41b8('0x8'));var fs=require('fs');var _=require(_0x41b8('0x9'));var squel=require(_0x41b8('0xa'));var crypto=require(_0x41b8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x41b8('0xc'));var toCsv=require(_0x41b8('0x7'));var querystring=require(_0x41b8('0xd'));var Papa=require(_0x41b8('0xe'));var Redis=require(_0x41b8('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x41b8('0x10'));var hardwareService=require(_0x41b8('0x11'));var logger=require(_0x41b8('0x12'))(_0x41b8('0x13'));var utils=require(_0x41b8('0x14'));var config=require(_0x41b8('0x15'));var licenseUtil=require(_0x41b8('0x16'));var db=require('../../mysqldb')['db'];config[_0x41b8('0x17')]=_[_0x41b8('0x18')](config['redis'],{'host':_0x41b8('0x19'),'port':0x18eb});var socket=require(_0x41b8('0x1a'))(new Redis(config[_0x41b8('0x17')]));require(_0x41b8('0x1b'))[_0x41b8('0x1c')](socket);function respondWithStatusCode(_0x120d1f,_0x2386b7){_0x2386b7=_0x2386b7||0xcc;return function(_0x197ba8){if(_0x197ba8){return _0x120d1f[_0x41b8('0x1d')](_0x2386b7);}return _0x120d1f['status'](_0x2386b7)['end']();};}function respondWithResult(_0x57c4ab,_0x59c546){_0x59c546=_0x59c546||0xc8;return function(_0x3aa25f){if(_0x3aa25f){return _0x57c4ab[_0x41b8('0x1e')](_0x59c546)[_0x41b8('0x1f')](_0x3aa25f);}};}function respondWithFilteredResult(_0x264db5,_0x3096cb){return function(_0x41cac1){if(_0x41cac1){var _0x357b23=_0x41cac1['count'],_0x36d615=_0x3096cb[_0x41b8('0x20')],_0x92aa1=_0x3096cb[_0x41b8('0x20')]+_0x3096cb[_0x41b8('0x21')],_0x403a06;if(_0x92aa1>=_0x357b23){_0x92aa1=_0x357b23;_0x403a06=0xc8;}else{_0x403a06=0xce;}_0x264db5['status'](_0x403a06);return _0x264db5[_0x41b8('0x22')](_0x41b8('0x23'),_0x36d615+'-'+_0x92aa1+'/'+_0x357b23)[_0x41b8('0x1f')](_0x41cac1);}return null;};}function patchUpdates(_0x5b2726){return function(_0x2c85cf){try{jsonpatch[_0x41b8('0x24')](_0x2c85cf,_0x5b2726,!![]);}catch(_0x473df6){return BPromise[_0x41b8('0x25')](_0x473df6);}return _0x2c85cf[_0x41b8('0x26')]();};}function saveUpdates(_0x20fde2,_0x5f20e5){return function(_0x4be13c){if(_0x4be13c){return _0x4be13c['update'](_0x20fde2)[_0x41b8('0x27')](function(_0x589cde){return _0x589cde;});}return null;};}function removeEntity(_0xbf3fe8,_0x2dee97){return function(_0x355165){if(_0x355165){return _0x355165[_0x41b8('0x28')]()[_0x41b8('0x27')](function(){_0xbf3fe8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3df3da,_0x13bb6e){return function(_0x4845f2){if(!_0x4845f2){_0x3df3da[_0x41b8('0x1d')](0x194);}return _0x4845f2;};}function handleError(_0x446c7d,_0x2913ed){_0x2913ed=_0x2913ed||0x1f4;return function(_0x1f1a7f){logger[_0x41b8('0x29')](_0x1f1a7f[_0x41b8('0x2a')]);if(_0x1f1a7f[_0x41b8('0x2b')]){delete _0x1f1a7f[_0x41b8('0x2b')];}_0x446c7d[_0x41b8('0x1e')](_0x2913ed)[_0x41b8('0x2c')](_0x1f1a7f);};}exports['show']=function(_0x4fdd9b,_0x36c04a){var _0x3d540f={'raw':![],'where':{'id':_0x4fdd9b[_0x41b8('0x2d')]['id']}},_0x2f3a3e={};_0x2f3a3e[_0x41b8('0x2e')]=_[_0x41b8('0x2f')](db[_0x41b8('0x30')][_0x41b8('0x31')]);_0x2f3a3e[_0x41b8('0x32')]=_[_0x41b8('0x2f')](_0x4fdd9b[_0x41b8('0x32')]);_0x2f3a3e[_0x41b8('0x33')]=_[_0x41b8('0x34')](_0x2f3a3e[_0x41b8('0x2e')],_0x2f3a3e[_0x41b8('0x32')]);_0x3d540f[_0x41b8('0x35')]=_[_0x41b8('0x34')](_0x2f3a3e[_0x41b8('0x2e')],qs[_0x41b8('0x36')](_0x4fdd9b[_0x41b8('0x32')]['fields']));_0x3d540f[_0x41b8('0x35')]=_0x3d540f[_0x41b8('0x35')][_0x41b8('0x37')]?_0x3d540f[_0x41b8('0x35')]:_0x2f3a3e[_0x41b8('0x2e')];if(_0x4fdd9b['query']['includeAll']){_0x3d540f[_0x41b8('0x38')]=[{'all':!![]}];}_0x3d540f=_['merge']({},_0x3d540f,_0x4fdd9b[_0x41b8('0x39')]);return db['DashboardItem'][_0x41b8('0x3a')](_0x3d540f)[_0x41b8('0x27')](handleEntityNotFound(_0x36c04a,null))[_0x41b8('0x27')](respondWithResult(_0x36c04a,null))[_0x41b8('0x3b')](handleError(_0x36c04a,null));};exports[_0x41b8('0x28')]=function(_0x1f16cb,_0x4c7f77){return db[_0x41b8('0x30')]['find']({'where':{'id':_0x1f16cb['params']['id']}})[_0x41b8('0x27')](handleEntityNotFound(_0x4c7f77,null))[_0x41b8('0x27')](removeEntity(_0x4c7f77,null))['catch'](handleError(_0x4c7f77,null));};function widgetAttributes(_0x1ee34c){try{switch(_0x1ee34c[_0x41b8('0x3c')]){case _0x41b8('0x3d'):return[{'name':_0x41b8('0x3e'),'value':_0x1ee34c['attrUrl']||(_0x1ee34c[_0x41b8('0x3f')]&&_0x1ee34c[_0x41b8('0x3f')][0x0]?_0x1ee34c[_0x41b8('0x3f')][0x0][_0x41b8('0x40')]:undefined)||_0x41b8('0x41')}];case'custom':return[{'name':_0x41b8('0x42'),'value':_0x1ee34c['attrPath']||(_0x1ee34c['attrs']&&_0x1ee34c['attrs'][0x0]?_0x1ee34c[_0x41b8('0x3f')][0x0][_0x41b8('0x40')]:undefined)||''}];case _0x41b8('0x43'):return[{'name':_0x41b8('0x44'),'value':_0x1ee34c[_0x41b8('0x44')]||(_0x1ee34c[_0x41b8('0x3f')]&&_0x1ee34c[_0x41b8('0x3f')][0x0]?_0x1ee34c[_0x41b8('0x3f')][0x0][_0x41b8('0x40')]:undefined)||_0x41b8('0x45')},{'name':_0x41b8('0x46'),'value':_0x1ee34c[_0x41b8('0x46')]||(_0x1ee34c[_0x41b8('0x3f')]&&_0x1ee34c[_0x41b8('0x3f')][0x1]?_0x1ee34c[_0x41b8('0x3f')][0x1][_0x41b8('0x40')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x1ee34c[_0x41b8('0x47')]||(_0x1ee34c[_0x41b8('0x3f')]&&_0x1ee34c['attrs'][0x2]?_0x1ee34c[_0x41b8('0x3f')][0x2][_0x41b8('0x40')]:undefined)||0xc}];case _0x41b8('0x48'):return[{'name':_0x41b8('0x49'),'value':_0x1ee34c[_0x41b8('0x49')]||(_0x1ee34c[_0x41b8('0x3f')]&&_0x1ee34c[_0x41b8('0x3f')][0x0]?_0x1ee34c[_0x41b8('0x3f')][0x0][_0x41b8('0x40')]:undefined)||_0x41b8('0x4a')},{'name':_0x41b8('0x4b'),'value':_0x1ee34c['attrVoiceQueues']||(_0x1ee34c[_0x41b8('0x3f')]&&_0x1ee34c[_0x41b8('0x3f')][0x1]?_0x1ee34c['attrs'][0x1][_0x41b8('0x40')]:undefined)||[]},{'name':_0x41b8('0x47'),'value':_0x1ee34c[_0x41b8('0x47')]||(_0x1ee34c['attrs']&&_0x1ee34c[_0x41b8('0x3f')][0x2]?_0x1ee34c[_0x41b8('0x3f')][0x2]['value']:undefined)||0x14}];case _0x41b8('0x4c'):case _0x41b8('0x4d'):return[{'name':'attrSerie1','value':_0x1ee34c[_0x41b8('0x4e')]||(_0x1ee34c[_0x41b8('0x3f')]&&_0x1ee34c[_0x41b8('0x3f')][0x0]?_0x1ee34c[_0x41b8('0x3f')][0x0][_0x41b8('0x40')]:undefined)||'total'},{'name':_0x41b8('0x4f'),'value':_0x1ee34c['attrSerie2']||(_0x1ee34c[_0x41b8('0x3f')]&&_0x1ee34c[_0x41b8('0x3f')][0x1]?_0x1ee34c[_0x41b8('0x3f')][0x1][_0x41b8('0x40')]:undefined)||null},{'name':_0x41b8('0x50'),'value':_0x1ee34c['attrSerie3']||(_0x1ee34c[_0x41b8('0x3f')]&&_0x1ee34c[_0x41b8('0x3f')][0x2]?_0x1ee34c[_0x41b8('0x3f')][0x2][_0x41b8('0x40')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x1ee34c[_0x41b8('0x4b')]||(_0x1ee34c['attrs']&&_0x1ee34c[_0x41b8('0x3f')][0x3]?_0x1ee34c[_0x41b8('0x3f')][0x3][_0x41b8('0x40')]:undefined)||[]}];case _0x41b8('0x51'):return[{'name':'attrReport','type':_0x1ee34c[_0x41b8('0x52')]||(_0x1ee34c['attrs']&&_0x1ee34c[_0x41b8('0x3f')][0x0]?_0x1ee34c[_0x41b8('0x3f')][0x0][_0x41b8('0x3c')]:undefined)||null,'value':_0x1ee34c[_0x41b8('0x53')]||(_0x1ee34c[_0x41b8('0x3f')]&&_0x1ee34c[_0x41b8('0x3f')][0x0]?_0x1ee34c[_0x41b8('0x3f')][0x0]['value']:undefined)||null},{'name':_0x41b8('0x54'),'value':_0x1ee34c[_0x41b8('0x54')]||(_0x1ee34c[_0x41b8('0x3f')]&&_0x1ee34c[_0x41b8('0x3f')][0x1]?_0x1ee34c[_0x41b8('0x3f')][0x1][_0x41b8('0x40')]:undefined)||0x0}];default:return[];}}catch(_0xf8423e){logger['error'](_0x41b8('0x55'),JSON[_0x41b8('0x56')](_0xf8423e));return[];}}exports[_0x41b8('0x57')]=function(_0x5146f9,_0x2a8030){if(_0x5146f9[_0x41b8('0x58')]){_0x5146f9[_0x41b8('0x58')][_0x41b8('0x3f')]=widgetAttributes(_0x5146f9[_0x41b8('0x58')]);}return db['DashboardItem'][_0x41b8('0x57')](_0x5146f9[_0x41b8('0x58')],{})[_0x41b8('0x27')](respondWithResult(_0x2a8030,0xc9))[_0x41b8('0x3b')](handleError(_0x2a8030,null));};exports['update']=function(_0x47367b,_0x11cd77){if(_0x47367b[_0x41b8('0x58')]['id']){delete _0x47367b[_0x41b8('0x58')]['id'];}_0x47367b[_0x41b8('0x58')][_0x41b8('0x3f')]=widgetAttributes(_0x47367b[_0x41b8('0x58')]);return db[_0x41b8('0x30')][_0x41b8('0x3a')]({'where':{'id':_0x47367b[_0x41b8('0x2d')]['id']}})[_0x41b8('0x27')](handleEntityNotFound(_0x11cd77,null))['then'](saveUpdates(_0x47367b[_0x41b8('0x58')],null))['then'](respondWithResult(_0x11cd77,null))['catch'](handleError(_0x11cd77,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 9e9923c..f29301c 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 _0x7768=['events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x7dfe3b,_0x5a9772){var _0x4b4a9b=function(_0x1f1ba6){while(--_0x1f1ba6){_0x7dfe3b['push'](_0x7dfe3b['shift']());}};_0x4b4a9b(++_0x5a9772);}(_0x7768,0x1ea));var _0x8776=function(_0x1e0990,_0x3f60ac){_0x1e0990=_0x1e0990-0x0;var _0x125b95=_0x7768[_0x1e0990];return _0x125b95;};'use strict';var EventEmitter=require(_0x8776('0x0'));var DashboardItem=require(_0x8776('0x1'))['db'][_0x8776('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x8776('0x3')](0x0);var events={'afterCreate':_0x8776('0x4'),'afterUpdate':_0x8776('0x5'),'afterDestroy':_0x8776('0x6')};function emitEvent(_0x44eb4c){return function(_0x5b7042,_0x154dd0,_0x26b93a){DashboardItemEvents[_0x8776('0x7')](_0x44eb4c+':'+_0x5b7042['id'],_0x5b7042);DashboardItemEvents[_0x8776('0x7')](_0x44eb4c,_0x5b7042);_0x26b93a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x8776('0x8')](e,emitEvent(event));}}module[_0x8776('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0x8375=['../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1a1e1d,_0x329ea8){var _0x363b91=function(_0x41a912){while(--_0x41a912){_0x1a1e1d['push'](_0x1a1e1d['shift']());}};_0x363b91(++_0x329ea8);}(_0x8375,0x132));var _0x5837=function(_0x337e76,_0x326e70){_0x337e76=_0x337e76-0x0;var _0x2dcc27=_0x8375[_0x337e76];return _0x2dcc27;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x5837('0x0'))['db'][_0x5837('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x5837('0x2')](0x0);var events={'afterCreate':_0x5837('0x3'),'afterUpdate':_0x5837('0x4'),'afterDestroy':_0x5837('0x5')};function emitEvent(_0x5b8647){return function(_0x2ddfc1,_0x110a7d,_0x5a4701){DashboardItemEvents[_0x5837('0x6')](_0x5b8647+':'+_0x2ddfc1['id'],_0x2ddfc1);DashboardItemEvents[_0x5837('0x6')](_0x5b8647,_0x2ddfc1);_0x5a4701(null);};}for(var e in events){if(events[_0x5837('0x7')](e)){var event=events[e];DashboardItem[_0x5837('0x8')](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 5bf0eaf..ce9d3bf 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 _0x0bfd=['util','../../config/logger','api','moment','bluebird','path','define','DashboardItem','dashboard_items','lodash'];(function(_0x190fc6,_0x134f6a){var _0x4d4d3a=function(_0x140e66){while(--_0x140e66){_0x190fc6['push'](_0x190fc6['shift']());}};_0x4d4d3a(++_0x134f6a);}(_0x0bfd,0x153));var _0xd0bf=function(_0xb17dc3,_0x356492){_0xb17dc3=_0xb17dc3-0x0;var _0x3054fa=_0x0bfd[_0xb17dc3];return _0x3054fa;};'use strict';var _=require(_0xd0bf('0x0'));var util=require(_0xd0bf('0x1'));var logger=require(_0xd0bf('0x2'))(_0xd0bf('0x3'));var moment=require(_0xd0bf('0x4'));var BPromise=require(_0xd0bf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd0bf('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x5b62df,_0x156b98){return _0x5b62df[_0xd0bf('0x7')](_0xd0bf('0x8'),attributes,{'tableName':_0xd0bf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2731=['../../config/environment','exports','define','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5ba34c,_0x321f6c){var _0x1cc672=function(_0xe971bf){while(--_0xe971bf){_0x5ba34c['push'](_0x5ba34c['shift']());}};_0x1cc672(++_0x321f6c);}(_0x2731,0xdc));var _0x1273=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2731[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1273('0x0'));var util=require(_0x1273('0x1'));var logger=require(_0x1273('0x2'))(_0x1273('0x3'));var moment=require(_0x1273('0x4'));var BPromise=require(_0x1273('0x5'));var rp=require(_0x1273('0x6'));var fs=require('fs');var path=require(_0x1273('0x7'));var rimraf=require('rimraf');var config=require(_0x1273('0x8'));var attributes=require('./dashboardItem.attributes');module[_0x1273('0x9')]=function(_0x44fc79,_0x3172b9){return _0x44fc79[_0x1273('0xa')]('DashboardItem',attributes,{'tableName':_0x1273('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 333e95c..615ae0e 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 _0x571a=['redis','defaults','localhost','socket.io-emitter','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x224f65,_0x4750bf){var _0x3f921c=function(_0x1b5f64){while(--_0x1b5f64){_0x224f65['push'](_0x224f65['shift']());}};_0x3f921c(++_0x4750bf);}(_0x571a,0xdb));var _0xa571=function(_0x4394d1,_0x1f5644){_0x4394d1=_0x4394d1-0x0;var _0x4b8b72=_0x571a[_0x4394d1];return _0x4b8b72;};'use strict';var _=require(_0xa571('0x0'));var util=require(_0xa571('0x1'));var moment=require(_0xa571('0x2'));var BPromise=require(_0xa571('0x3'));var rs=require(_0xa571('0x4'));var fs=require('fs');var Redis=require(_0xa571('0x5'));var db=require(_0xa571('0x6'))['db'];var utils=require(_0xa571('0x7'));var logger=require(_0xa571('0x8'))('rpc');var config=require(_0xa571('0x9'));var jayson=require(_0xa571('0xa'));var client=jayson[_0xa571('0xb')][_0xa571('0xc')]({'port':0x232a});config[_0xa571('0xd')]=_[_0xa571('0xe')](config[_0xa571('0xd')],{'host':_0xa571('0xf'),'port':0x18eb});var socket=require(_0xa571('0x10'))(new Redis(config['redis']));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x259d3f,_0x13d8d1,_0x27324d){return new BPromise(function(_0x280151,_0x5449b3){return client[_0xa571('0x11')](_0x259d3f,_0x27324d)[_0xa571('0x12')](function(_0x51d94f){logger[_0xa571('0x13')](_0xa571('0x14'),_0x13d8d1,_0xa571('0x15'));logger[_0xa571('0x16')](_0xa571('0x17'),_0x13d8d1,'request\x20sent',JSON[_0xa571('0x18')](_0x51d94f));if(_0x51d94f[_0xa571('0x19')]){if(_0x51d94f[_0xa571('0x19')]['code']===0x1f4){logger['error'](_0xa571('0x14'),_0x13d8d1,_0x51d94f[_0xa571('0x19')]['message']);return _0x5449b3(_0x51d94f['error'][_0xa571('0x1a')]);}logger[_0xa571('0x19')](_0xa571('0x14'),_0x13d8d1,_0x51d94f['error'][_0xa571('0x1a')]);return _0x280151(_0x51d94f['error'][_0xa571('0x1a')]);}else{logger[_0xa571('0x13')](_0xa571('0x14'),_0x13d8d1,'request\x20sent');_0x280151(_0x51d94f[_0xa571('0x1b')][_0xa571('0x1a')]);}})[_0xa571('0x1c')](function(_0x26ba20){logger[_0xa571('0x19')](_0xa571('0x14'),_0x13d8d1,_0x26ba20);_0x5449b3(_0x26ba20);});});} \ No newline at end of file +var _0xd297=['rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','request\x20sent','error','message','DashboardItem,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger'];(function(_0x5163ba,_0x5e841e){var _0x562e78=function(_0x2f3139){while(--_0x2f3139){_0x5163ba['push'](_0x5163ba['shift']());}};_0x562e78(++_0x5e841e);}(_0xd297,0x158));var _0x7d29=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xd297[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x7d29('0x0'));var util=require(_0x7d29('0x1'));var moment=require(_0x7d29('0x2'));var BPromise=require('bluebird');var rs=require(_0x7d29('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7d29('0x4'));var logger=require(_0x7d29('0x5'))(_0x7d29('0x6'));var config=require(_0x7d29('0x7'));var jayson=require(_0x7d29('0x8'));var client=jayson[_0x7d29('0x9')]['http']({'port':0x232a});config[_0x7d29('0xa')]=_[_0x7d29('0xb')](config[_0x7d29('0xa')],{'host':_0x7d29('0xc'),'port':0x18eb});var socket=require(_0x7d29('0xd'))(new Redis(config[_0x7d29('0xa')]));require(_0x7d29('0xe'))[_0x7d29('0xf')](socket);function respondWithRpcPromise(_0x437b4a,_0x105ae0,_0x45e741){return new BPromise(function(_0x2ce5dc,_0x5c3b20){return client[_0x7d29('0x10')](_0x437b4a,_0x45e741)[_0x7d29('0x11')](function(_0x22b7ee){logger[_0x7d29('0x12')]('DashboardItem,\x20%s,\x20%s',_0x105ae0,'request\x20sent');logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x105ae0,_0x7d29('0x13'),JSON['stringify'](_0x22b7ee));if(_0x22b7ee[_0x7d29('0x14')]){if(_0x22b7ee[_0x7d29('0x14')]['code']===0x1f4){logger[_0x7d29('0x14')]('DashboardItem,\x20%s,\x20%s',_0x105ae0,_0x22b7ee[_0x7d29('0x14')]['message']);return _0x5c3b20(_0x22b7ee[_0x7d29('0x14')][_0x7d29('0x15')]);}logger[_0x7d29('0x14')](_0x7d29('0x16'),_0x105ae0,_0x22b7ee['error'][_0x7d29('0x15')]);return _0x2ce5dc(_0x22b7ee[_0x7d29('0x14')][_0x7d29('0x15')]);}else{logger[_0x7d29('0x12')]('DashboardItem,\x20%s,\x20%s',_0x105ae0,_0x7d29('0x13'));_0x2ce5dc(_0x22b7ee[_0x7d29('0x17')][_0x7d29('0x15')]);}})[_0x7d29('0x18')](function(_0x57ac3d){logger[_0x7d29('0x14')](_0x7d29('0x16'),_0x105ae0,_0x57ac3d);_0x5c3b20(_0x57ac3d);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index d9db2d4..6e9f585 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 _0x7b0c=['length','dashboardItem:','./dashboardItem.events','save','remove','update','emit','removeListener','register'];(function(_0x302e65,_0xe9995c){var _0x5c154e=function(_0x1948fd){while(--_0x1948fd){_0x302e65['push'](_0x302e65['shift']());}};_0x5c154e(++_0xe9995c);}(_0x7b0c,0x158));var _0xc7b0=function(_0x4a5dec,_0x54b6e3){_0x4a5dec=_0x4a5dec-0x0;var _0xfc96aa=_0x7b0c[_0x4a5dec];return _0xfc96aa;};'use strict';var DashboardItemEvents=require(_0xc7b0('0x0'));var events=[_0xc7b0('0x1'),_0xc7b0('0x2'),_0xc7b0('0x3')];function createListener(_0x109e70,_0x1e108b){return function(_0x562329){_0x1e108b[_0xc7b0('0x4')](_0x109e70,_0x562329);};}function removeListener(_0x315ebb,_0x56c5b3){return function(){DashboardItemEvents[_0xc7b0('0x5')](_0x315ebb,_0x56c5b3);};}exports[_0xc7b0('0x6')]=function(_0x287eb2){for(var _0x3f0157=0x0,_0x44b242=events[_0xc7b0('0x7')];_0x3f0157<_0x44b242;_0x3f0157++){var _0x4bc876=events[_0x3f0157];var _0x25c093=createListener(_0xc7b0('0x8')+_0x4bc876,_0x287eb2);DashboardItemEvents['on'](_0x4bc876,_0x25c093);}}; \ No newline at end of file +var _0x1ff9=['save','update','emit','length','dashboardItem:','./dashboardItem.events'];(function(_0x3231e8,_0x41df58){var _0x13a897=function(_0x5c01b5){while(--_0x5c01b5){_0x3231e8['push'](_0x3231e8['shift']());}};_0x13a897(++_0x41df58);}(_0x1ff9,0x1df));var _0x91ff=function(_0x2ce6c4,_0x1493e0){_0x2ce6c4=_0x2ce6c4-0x0;var _0x3fa5ef=_0x1ff9[_0x2ce6c4];return _0x3fa5ef;};'use strict';var DashboardItemEvents=require(_0x91ff('0x0'));var events=[_0x91ff('0x1'),'remove',_0x91ff('0x2')];function createListener(_0x450842,_0x4164ba){return function(_0xd91770){_0x4164ba[_0x91ff('0x3')](_0x450842,_0xd91770);};}function removeListener(_0x3fc4a4,_0x3ff97e){return function(){DashboardItemEvents['removeListener'](_0x3fc4a4,_0x3ff97e);};}exports['register']=function(_0x2da2d9){for(var _0x447b27=0x0,_0x3a26c9=events[_0x91ff('0x4')];_0x447b27<_0x3a26c9;_0x447b27++){var _0x4deec6=events[_0x447b27];var _0xf3dd1=createListener(_0x91ff('0x5')+_0x4deec6,_0x2da2d9);DashboardItemEvents['on'](_0x4deec6,_0xf3dd1);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 9282674..9826602 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 _0xdc97=['../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service'];(function(_0x8ec8eb,_0x409190){var _0x3eb5b8=function(_0x2604bf){while(--_0x2604bf){_0x8ec8eb['push'](_0x8ec8eb['shift']());}};_0x3eb5b8(++_0x409190);}(_0xdc97,0x13b));var _0x7dc9=function(_0x693fd7,_0x1be63f){_0x693fd7=_0x693fd7-0x0;var _0x2760f9=_0xdc97[_0x693fd7];return _0x2760f9;};'use strict';var multer=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var path=require(_0x7dc9('0x2'));var timeout=require('connect-timeout');var express=require(_0x7dc9('0x3'));var router=express['Router']();var auth=require(_0x7dc9('0x4'));var interaction=require(_0x7dc9('0x5'));var config=require('../../config/environment');var controller=require(_0x7dc9('0x6'));router[_0x7dc9('0x7')](_0x7dc9('0x8'),auth[_0x7dc9('0x9')](),controller['show']);router[_0x7dc9('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7dc9('0xb')](_0x7dc9('0x8'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xc')]);router[_0x7dc9('0xd')]('/:id',auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xe')]);module[_0x7dc9('0xf')]=router; \ No newline at end of file +var _0x326f=['create','put','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','post'];(function(_0x5283f0,_0x481769){var _0x753fd4=function(_0x4adbf6){while(--_0x4adbf6){_0x5283f0['push'](_0x5283f0['shift']());}};_0x753fd4(++_0x481769);}(_0x326f,0xd1));var _0xf326=function(_0x395926,_0x312dc5){_0x395926=_0x395926-0x0;var _0x59877b=_0x326f[_0x395926];return _0x59877b;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var auth=require(_0xf326('0x4'));var interaction=require(_0xf326('0x5'));var config=require(_0xf326('0x6'));var controller=require(_0xf326('0x7'));router[_0xf326('0x8')](_0xf326('0x9'),auth[_0xf326('0xa')](),controller['show']);router[_0xf326('0xb')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xf326('0xe')](_0xf326('0x9'),auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);module[_0xf326('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 888c9d7..b4424eb 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 _0xbc1f=['third','sequelize','exports','STRING','first','second'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xbc1f,0x1e1));var _0xfbc1=function(_0x4103af,_0x33d1aa){_0x4103af=_0x4103af-0x0;var _0x12cedd=_0xbc1f[_0x4103af];return _0x12cedd;};'use strict';var Sequelize=require(_0xfbc1('0x0'));module[_0xfbc1('0x1')]={'name':{'type':Sequelize[_0xfbc1('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xfbc1('0x3'),_0xfbc1('0x4'),_0xfbc1('0x5')),'allowNull':![],'defaultValue':_0xfbc1('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf37a=['ENUM','second','third','first','sequelize','exports','STRING'];(function(_0x5524e4,_0x4104f4){var _0x17c444=function(_0x29cfa9){while(--_0x29cfa9){_0x5524e4['push'](_0x5524e4['shift']());}};_0x17c444(++_0x4104f4);}(_0xf37a,0x82));var _0xaf37=function(_0x1fff84,_0x3432fe){_0x1fff84=_0x1fff84-0x0;var _0x4c9c8c=_0xf37a[_0x1fff84];return _0x4c9c8c;};'use strict';var Sequelize=require(_0xaf37('0x0'));module[_0xaf37('0x1')]={'name':{'type':Sequelize[_0xaf37('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xaf37('0x3')]('first',_0xaf37('0x4'),_0xaf37('0x5')),'allowNull':![],'defaultValue':_0xaf37('0x6')},'description':{'type':Sequelize[_0xaf37('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 394531a..b2337cd 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 _0x7f37=['ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','destroy','then','get','Dispositions','UserProfileResource','error','stack','name','index','map','Disposition','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x2bdf5d,_0x4ff6fb){var _0x2125b8=function(_0x441707){while(--_0x441707){_0x2bdf5d['push'](_0x2bdf5d['shift']());}};_0x2125b8(++_0x4ff6fb);}(_0x7f37,0x190));var _0x77f3=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x7f37[_0x8c43de];return _0xa6591b;};'use strict';var pdf=require(_0x77f3('0x0'));var emlformat=require(_0x77f3('0x1'));var rimraf=require(_0x77f3('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x77f3('0x3'));var rp=require('request-promise');var moment=require(_0x77f3('0x4'));var BPromise=require(_0x77f3('0x5'));var Mustache=require(_0x77f3('0x6'));var util=require(_0x77f3('0x7'));var path=require(_0x77f3('0x8'));var sox=require(_0x77f3('0x9'));var csv=require('to-csv');var ejs=require(_0x77f3('0xa'));var fs=require('fs');var _=require(_0x77f3('0xb'));var squel=require(_0x77f3('0xc'));var crypto=require(_0x77f3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x77f3('0xe'));var toCsv=require(_0x77f3('0xf'));var querystring=require(_0x77f3('0x10'));var Papa=require('papaparse');var Redis=require(_0x77f3('0x11'));var authService=require(_0x77f3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x77f3('0x13'));var hardwareService=require(_0x77f3('0x14'));var logger=require(_0x77f3('0x15'))(_0x77f3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x77f3('0x17'));var db=require(_0x77f3('0x18'))['db'];function respondWithStatusCode(_0x220810,_0x398ab5){_0x398ab5=_0x398ab5||0xcc;return function(_0x21336c){if(_0x21336c){return _0x220810[_0x77f3('0x19')](_0x398ab5);}return _0x220810[_0x77f3('0x1a')](_0x398ab5)[_0x77f3('0x1b')]();};}function respondWithResult(_0x36f4c1,_0x252311){_0x252311=_0x252311||0xc8;return function(_0x11b028){if(_0x11b028){return _0x36f4c1[_0x77f3('0x1a')](_0x252311)[_0x77f3('0x1c')](_0x11b028);}};}function respondWithFilteredResult(_0x45388b,_0x5e4141){return function(_0x1515ab){if(_0x1515ab){var _0xf3ae34=_0x1515ab[_0x77f3('0x1d')],_0x4656a9=_0x5e4141[_0x77f3('0x1e')],_0x5b6550=_0x5e4141['offset']+_0x5e4141['limit'],_0x58b250;if(_0x5b6550>=_0xf3ae34){_0x5b6550=_0xf3ae34;_0x58b250=0xc8;}else{_0x58b250=0xce;}_0x45388b['status'](_0x58b250);return _0x45388b[_0x77f3('0x1f')](_0x77f3('0x20'),_0x4656a9+'-'+_0x5b6550+'/'+_0xf3ae34)[_0x77f3('0x1c')](_0x1515ab);}return null;};}function patchUpdates(_0x4a648a){return function(_0x16e6ab){try{jsonpatch['apply'](_0x16e6ab,_0x4a648a,!![]);}catch(_0x92011d){return BPromise['reject'](_0x92011d);}return _0x16e6ab[_0x77f3('0x21')]();};}function saveUpdates(_0x246a25,_0x469198){return function(_0x2b1fd5){if(_0x2b1fd5){return _0x2b1fd5[_0x77f3('0x22')](_0x246a25)['then'](function(_0x51707b){return _0x51707b;});}return null;};}function removeEntity(_0x4649dc,_0x4b1425){return function(_0x5de491){if(_0x5de491){return _0x5de491[_0x77f3('0x23')]()[_0x77f3('0x24')](function(){var _0x3e4609=_0x5de491[_0x77f3('0x25')]({'plain':!![]});var _0x4455e7=_0x77f3('0x26');return db[_0x77f3('0x27')][_0x77f3('0x23')]({'where':{'type':_0x4455e7,'resourceId':_0x3e4609['id']}})[_0x77f3('0x24')](function(){return _0x5de491;});})['then'](function(){_0x4649dc['status'](0xcc)[_0x77f3('0x1b')]();});}};}function handleEntityNotFound(_0x287f6a,_0x162b99){return function(_0x31deea){if(!_0x31deea){_0x287f6a[_0x77f3('0x19')](0x194);}return _0x31deea;};}function handleError(_0x5f1a53,_0x314ed0){_0x314ed0=_0x314ed0||0x1f4;return function(_0x19b6ea){logger[_0x77f3('0x28')](_0x19b6ea[_0x77f3('0x29')]);if(_0x19b6ea[_0x77f3('0x2a')]){delete _0x19b6ea[_0x77f3('0x2a')];}_0x5f1a53[_0x77f3('0x1a')](_0x314ed0)['send'](_0x19b6ea);};}exports[_0x77f3('0x2b')]=function(_0x4b4210,_0x54d6dc){var _0x2c3444={},_0x5d5f81={},_0x444faa={'count':0x0,'rows':[]};var _0xfdaf7d=_[_0x77f3('0x2c')](db[_0x77f3('0x2d')]['rawAttributes'],function(_0x1c0067){return{'name':_0x1c0067[_0x77f3('0x2e')],'type':_0x1c0067[_0x77f3('0x2f')][_0x77f3('0x30')]};});_0x5d5f81[_0x77f3('0x31')]=_['map'](_0xfdaf7d,_0x77f3('0x2a'));_0x5d5f81[_0x77f3('0x32')]=_[_0x77f3('0x33')](_0x4b4210['query']);_0x5d5f81[_0x77f3('0x34')]=_[_0x77f3('0x35')](_0x5d5f81['model'],_0x5d5f81[_0x77f3('0x32')]);_0x2c3444['attributes']=_[_0x77f3('0x35')](_0x5d5f81['model'],qs['fields'](_0x4b4210[_0x77f3('0x32')][_0x77f3('0x36')]));_0x2c3444[_0x77f3('0x37')]=_0x2c3444[_0x77f3('0x37')][_0x77f3('0x38')]?_0x2c3444[_0x77f3('0x37')]:_0x5d5f81[_0x77f3('0x31')];if(!_0x4b4210[_0x77f3('0x32')][_0x77f3('0x39')](_0x77f3('0x3a'))){_0x2c3444[_0x77f3('0x3b')]=qs[_0x77f3('0x3b')](_0x4b4210[_0x77f3('0x32')][_0x77f3('0x3b')]);_0x2c3444[_0x77f3('0x1e')]=qs[_0x77f3('0x1e')](_0x4b4210[_0x77f3('0x32')][_0x77f3('0x1e')]);}_0x2c3444[_0x77f3('0x3c')]=qs[_0x77f3('0x3d')](_0x4b4210[_0x77f3('0x32')]['sort']);_0x2c3444[_0x77f3('0x3e')]=qs['filters'](_['pick'](_0x4b4210[_0x77f3('0x32')],_0x5d5f81[_0x77f3('0x34')]),_0xfdaf7d);if(_0x4b4210[_0x77f3('0x32')][_0x77f3('0x3f')]){_0x2c3444[_0x77f3('0x3e')]=_['merge'](_0x2c3444[_0x77f3('0x3e')],{'$or':_['map'](_0xfdaf7d,function(_0x3112ea){if(_0x3112ea[_0x77f3('0x2f')]!==_0x77f3('0x40')){var _0xa93896={};_0xa93896[_0x3112ea[_0x77f3('0x2a')]]={'$like':'%'+_0x4b4210[_0x77f3('0x32')][_0x77f3('0x3f')]+'%'};return _0xa93896;}})});}_0x2c3444=_[_0x77f3('0x41')]({},_0x2c3444,_0x4b4210['options']);var _0x49aeb5={'where':_0x2c3444[_0x77f3('0x3e')]};return db[_0x77f3('0x2d')][_0x77f3('0x1d')](_0x49aeb5)[_0x77f3('0x24')](function(_0x968cb8){_0x444faa['count']=_0x968cb8;if(_0x4b4210[_0x77f3('0x32')][_0x77f3('0x42')]){_0x2c3444[_0x77f3('0x43')]=[{'all':!![]}];}return db[_0x77f3('0x2d')][_0x77f3('0x44')](_0x2c3444);})[_0x77f3('0x24')](function(_0x55c81b){_0x444faa['rows']=_0x55c81b;return _0x444faa;})[_0x77f3('0x24')](respondWithFilteredResult(_0x54d6dc,_0x2c3444))[_0x77f3('0x45')](handleError(_0x54d6dc,null));};exports[_0x77f3('0x46')]=function(_0x114431,_0x592122){var _0x1e4fa9={'raw':!![],'where':{'id':_0x114431[_0x77f3('0x47')]['id']}},_0x4c56f6={};_0x4c56f6[_0x77f3('0x31')]=_[_0x77f3('0x33')](db[_0x77f3('0x2d')]['rawAttributes']);_0x4c56f6['query']=_[_0x77f3('0x33')](_0x114431[_0x77f3('0x32')]);_0x4c56f6[_0x77f3('0x34')]=_[_0x77f3('0x35')](_0x4c56f6['model'],_0x4c56f6[_0x77f3('0x32')]);_0x1e4fa9[_0x77f3('0x37')]=_[_0x77f3('0x35')](_0x4c56f6['model'],qs[_0x77f3('0x36')](_0x114431[_0x77f3('0x32')]['fields']));_0x1e4fa9[_0x77f3('0x37')]=_0x1e4fa9[_0x77f3('0x37')][_0x77f3('0x38')]?_0x1e4fa9[_0x77f3('0x37')]:_0x4c56f6[_0x77f3('0x31')];if(_0x114431[_0x77f3('0x32')][_0x77f3('0x42')]){_0x1e4fa9[_0x77f3('0x43')]=[{'all':!![]}];}_0x1e4fa9=_[_0x77f3('0x41')]({},_0x1e4fa9,_0x114431[_0x77f3('0x48')]);return db['Disposition'][_0x77f3('0x49')](_0x1e4fa9)[_0x77f3('0x24')](handleEntityNotFound(_0x592122,null))[_0x77f3('0x24')](respondWithResult(_0x592122,null))[_0x77f3('0x45')](handleError(_0x592122,null));};exports[_0x77f3('0x4a')]=function(_0x42f88c,_0x1d0367){return db['Disposition']['create'](_0x42f88c['body'],{})[_0x77f3('0x24')](function(_0x134b8d){var _0x1d0ce0=_0x42f88c['user'][_0x77f3('0x25')]({'plain':!![]});if(!_0x1d0ce0)throw new Error(_0x77f3('0x4b'));if(_0x1d0ce0[_0x77f3('0x4c')]===_0x77f3('0x4d')){var _0x5da907=_0x134b8d[_0x77f3('0x25')]({'plain':!![]});var _0x215ca6=_0x77f3('0x26');return db['UserProfileSection'][_0x77f3('0x49')]({'where':{'name':_0x215ca6,'userProfileId':_0x1d0ce0[_0x77f3('0x4e')]},'raw':!![]})[_0x77f3('0x24')](function(_0x2e9b5c){if(_0x2e9b5c&&_0x2e9b5c[_0x77f3('0x4f')]===0x0){return db['UserProfileResource'][_0x77f3('0x4a')]({'name':_0x5da907[_0x77f3('0x2a')],'resourceId':_0x5da907['id'],'type':_0x2e9b5c[_0x77f3('0x2a')],'sectionId':_0x2e9b5c['id']},{})[_0x77f3('0x24')](function(){return _0x134b8d;});}else{return _0x134b8d;}})[_0x77f3('0x45')](function(_0x1659e4){logger[_0x77f3('0x28')](_0x77f3('0x50'),_0x1659e4);throw _0x1659e4;});}return _0x134b8d;})[_0x77f3('0x24')](respondWithResult(_0x1d0367,0xc9))['catch'](handleError(_0x1d0367,null));};exports[_0x77f3('0x22')]=function(_0x3e2c1d,_0x108764){if(_0x3e2c1d[_0x77f3('0x51')]['id']){delete _0x3e2c1d[_0x77f3('0x51')]['id'];}return db[_0x77f3('0x2d')][_0x77f3('0x49')]({'where':{'id':_0x3e2c1d['params']['id']}})[_0x77f3('0x24')](handleEntityNotFound(_0x108764,null))['then'](saveUpdates(_0x3e2c1d['body'],null))[_0x77f3('0x24')](respondWithResult(_0x108764,null))[_0x77f3('0x45')](handleError(_0x108764,null));};exports[_0x77f3('0x23')]=function(_0x52f3fa,_0x444bea){return db[_0x77f3('0x2d')][_0x77f3('0x49')]({'where':{'id':_0x52f3fa[_0x77f3('0x47')]['id']}})[_0x77f3('0x24')](handleEntityNotFound(_0x444bea,null))[_0x77f3('0x24')](removeEntity(_0x444bea,null))[_0x77f3('0x45')](handleError(_0x444bea,null));}; \ No newline at end of file +var _0x91b3=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','Content-Range','apply','reject','then','destroy','Dispositions','UserProfileResource','end','sendStatus','error','stack','name','index','map','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','Disposition','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x91b3,0xe6));var _0x391b=function(_0x3cb55f,_0x1620e1){_0x3cb55f=_0x3cb55f-0x0;var _0x1b8850=_0x91b3[_0x3cb55f];return _0x1b8850;};'use strict';var pdf=require(_0x391b('0x0'));var emlformat=require(_0x391b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x391b('0x2'));var jsonpatch=require(_0x391b('0x3'));var rp=require(_0x391b('0x4'));var moment=require(_0x391b('0x5'));var BPromise=require(_0x391b('0x6'));var Mustache=require(_0x391b('0x7'));var util=require(_0x391b('0x8'));var path=require(_0x391b('0x9'));var sox=require(_0x391b('0xa'));var csv=require(_0x391b('0xb'));var ejs=require(_0x391b('0xc'));var fs=require('fs');var _=require(_0x391b('0xd'));var squel=require('squel');var crypto=require(_0x391b('0xe'));var jsforce=require(_0x391b('0xf'));var deskjs=require(_0x391b('0x10'));var toCsv=require(_0x391b('0xb'));var querystring=require(_0x391b('0x11'));var Papa=require('papaparse');var Redis=require(_0x391b('0x12'));var authService=require(_0x391b('0x13'));var qs=require(_0x391b('0x14'));var as=require(_0x391b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x391b('0x16'))(_0x391b('0x17'));var utils=require('../../config/utils');var config=require(_0x391b('0x18'));var licenseUtil=require(_0x391b('0x19'));var db=require(_0x391b('0x1a'))['db'];function respondWithStatusCode(_0x478d40,_0x4b6adb){_0x4b6adb=_0x4b6adb||0xcc;return function(_0x5d5d82){if(_0x5d5d82){return _0x478d40['sendStatus'](_0x4b6adb);}return _0x478d40[_0x391b('0x1b')](_0x4b6adb)['end']();};}function respondWithResult(_0x5ddf6f,_0x2767b2){_0x2767b2=_0x2767b2||0xc8;return function(_0x3b3202){if(_0x3b3202){return _0x5ddf6f['status'](_0x2767b2)[_0x391b('0x1c')](_0x3b3202);}};}function respondWithFilteredResult(_0x1a02bf,_0x4f01f4){return function(_0x3a7f4f){if(_0x3a7f4f){var _0x171284=_0x3a7f4f[_0x391b('0x1d')],_0x1f96b3=_0x4f01f4[_0x391b('0x1e')],_0x536b72=_0x4f01f4[_0x391b('0x1e')]+_0x4f01f4[_0x391b('0x1f')],_0x3b858b;if(_0x536b72>=_0x171284){_0x536b72=_0x171284;_0x3b858b=0xc8;}else{_0x3b858b=0xce;}_0x1a02bf[_0x391b('0x1b')](_0x3b858b);return _0x1a02bf['set'](_0x391b('0x20'),_0x1f96b3+'-'+_0x536b72+'/'+_0x171284)[_0x391b('0x1c')](_0x3a7f4f);}return null;};}function patchUpdates(_0x3ed71d){return function(_0x30ed7b){try{jsonpatch[_0x391b('0x21')](_0x30ed7b,_0x3ed71d,!![]);}catch(_0x3fdfe6){return BPromise[_0x391b('0x22')](_0x3fdfe6);}return _0x30ed7b['save']();};}function saveUpdates(_0x144eb2,_0x5377d6){return function(_0x25f907){if(_0x25f907){return _0x25f907['update'](_0x144eb2)[_0x391b('0x23')](function(_0x533c75){return _0x533c75;});}return null;};}function removeEntity(_0x6b2ee0,_0x4bd729){return function(_0x3e35e0){if(_0x3e35e0){return _0x3e35e0[_0x391b('0x24')]()[_0x391b('0x23')](function(){var _0x442e9e=_0x3e35e0['get']({'plain':!![]});var _0x14b6a1=_0x391b('0x25');return db[_0x391b('0x26')][_0x391b('0x24')]({'where':{'type':_0x14b6a1,'resourceId':_0x442e9e['id']}})[_0x391b('0x23')](function(){return _0x3e35e0;});})[_0x391b('0x23')](function(){_0x6b2ee0[_0x391b('0x1b')](0xcc)[_0x391b('0x27')]();});}};}function handleEntityNotFound(_0x2e612f,_0x3f7c39){return function(_0x1fc191){if(!_0x1fc191){_0x2e612f[_0x391b('0x28')](0x194);}return _0x1fc191;};}function handleError(_0x5435e9,_0x190549){_0x190549=_0x190549||0x1f4;return function(_0x15f8b3){logger[_0x391b('0x29')](_0x15f8b3[_0x391b('0x2a')]);if(_0x15f8b3[_0x391b('0x2b')]){delete _0x15f8b3[_0x391b('0x2b')];}_0x5435e9['status'](_0x190549)['send'](_0x15f8b3);};}exports[_0x391b('0x2c')]=function(_0x46fb19,_0x28c879){var _0x1318c8={},_0x22990e={},_0x66497={'count':0x0,'rows':[]};var _0xc115bd=_[_0x391b('0x2d')](db['Disposition']['rawAttributes'],function(_0x59bfc0){return{'name':_0x59bfc0['fieldName'],'type':_0x59bfc0[_0x391b('0x2e')][_0x391b('0x2f')]};});_0x22990e['model']=_[_0x391b('0x2d')](_0xc115bd,_0x391b('0x2b'));_0x22990e['query']=_[_0x391b('0x30')](_0x46fb19[_0x391b('0x31')]);_0x22990e['filters']=_[_0x391b('0x32')](_0x22990e[_0x391b('0x33')],_0x22990e[_0x391b('0x31')]);_0x1318c8[_0x391b('0x34')]=_[_0x391b('0x32')](_0x22990e[_0x391b('0x33')],qs['fields'](_0x46fb19['query'][_0x391b('0x35')]));_0x1318c8[_0x391b('0x34')]=_0x1318c8['attributes'][_0x391b('0x36')]?_0x1318c8[_0x391b('0x34')]:_0x22990e['model'];if(!_0x46fb19['query'][_0x391b('0x37')]('nolimit')){_0x1318c8[_0x391b('0x1f')]=qs[_0x391b('0x1f')](_0x46fb19[_0x391b('0x31')][_0x391b('0x1f')]);_0x1318c8['offset']=qs[_0x391b('0x1e')](_0x46fb19['query'][_0x391b('0x1e')]);}_0x1318c8[_0x391b('0x38')]=qs[_0x391b('0x39')](_0x46fb19[_0x391b('0x31')][_0x391b('0x39')]);_0x1318c8[_0x391b('0x3a')]=qs[_0x391b('0x3b')](_[_0x391b('0x3c')](_0x46fb19['query'],_0x22990e['filters']),_0xc115bd);if(_0x46fb19[_0x391b('0x31')][_0x391b('0x3d')]){_0x1318c8['where']=_['merge'](_0x1318c8[_0x391b('0x3a')],{'$or':_[_0x391b('0x2d')](_0xc115bd,function(_0xdddc10){if(_0xdddc10[_0x391b('0x2e')]!==_0x391b('0x3e')){var _0x2778e9={};_0x2778e9[_0xdddc10['name']]={'$like':'%'+_0x46fb19['query'][_0x391b('0x3d')]+'%'};return _0x2778e9;}})});}_0x1318c8=_[_0x391b('0x3f')]({},_0x1318c8,_0x46fb19[_0x391b('0x40')]);var _0x484487={'where':_0x1318c8[_0x391b('0x3a')]};return db[_0x391b('0x41')][_0x391b('0x1d')](_0x484487)[_0x391b('0x23')](function(_0x5e6da6){_0x66497[_0x391b('0x1d')]=_0x5e6da6;if(_0x46fb19[_0x391b('0x31')][_0x391b('0x42')]){_0x1318c8[_0x391b('0x43')]=[{'all':!![]}];}return db['Disposition'][_0x391b('0x44')](_0x1318c8);})[_0x391b('0x23')](function(_0x42fe82){_0x66497[_0x391b('0x45')]=_0x42fe82;return _0x66497;})['then'](respondWithFilteredResult(_0x28c879,_0x1318c8))[_0x391b('0x46')](handleError(_0x28c879,null));};exports['show']=function(_0x541b1c,_0x5062bc){var _0x58f4fe={'raw':!![],'where':{'id':_0x541b1c['params']['id']}},_0x10997f={};_0x10997f[_0x391b('0x33')]=_['keys'](db[_0x391b('0x41')][_0x391b('0x47')]);_0x10997f['query']=_[_0x391b('0x30')](_0x541b1c[_0x391b('0x31')]);_0x10997f[_0x391b('0x3b')]=_[_0x391b('0x32')](_0x10997f[_0x391b('0x33')],_0x10997f[_0x391b('0x31')]);_0x58f4fe[_0x391b('0x34')]=_[_0x391b('0x32')](_0x10997f['model'],qs[_0x391b('0x35')](_0x541b1c[_0x391b('0x31')]['fields']));_0x58f4fe[_0x391b('0x34')]=_0x58f4fe['attributes'][_0x391b('0x36')]?_0x58f4fe['attributes']:_0x10997f[_0x391b('0x33')];if(_0x541b1c[_0x391b('0x31')][_0x391b('0x42')]){_0x58f4fe[_0x391b('0x43')]=[{'all':!![]}];}_0x58f4fe=_['merge']({},_0x58f4fe,_0x541b1c['options']);return db[_0x391b('0x41')][_0x391b('0x48')](_0x58f4fe)['then'](handleEntityNotFound(_0x5062bc,null))[_0x391b('0x23')](respondWithResult(_0x5062bc,null))[_0x391b('0x46')](handleError(_0x5062bc,null));};exports[_0x391b('0x49')]=function(_0x5c715b,_0x1c52b1){return db['Disposition']['create'](_0x5c715b[_0x391b('0x4a')],{})[_0x391b('0x23')](function(_0x11d2e1){var _0x70cfc2=_0x5c715b[_0x391b('0x4b')][_0x391b('0x4c')]({'plain':!![]});if(!_0x70cfc2)throw new Error(_0x391b('0x4d'));if(_0x70cfc2['role']===_0x391b('0x4b')){var _0x3e02d9=_0x11d2e1['get']({'plain':!![]});var _0x234a9a=_0x391b('0x25');return db[_0x391b('0x4e')][_0x391b('0x48')]({'where':{'name':_0x234a9a,'userProfileId':_0x70cfc2['userProfileId']},'raw':!![]})['then'](function(_0x6b5e73){if(_0x6b5e73&&_0x6b5e73[_0x391b('0x4f')]===0x0){return db['UserProfileResource'][_0x391b('0x49')]({'name':_0x3e02d9['name'],'resourceId':_0x3e02d9['id'],'type':_0x6b5e73[_0x391b('0x2b')],'sectionId':_0x6b5e73['id']},{})[_0x391b('0x23')](function(){return _0x11d2e1;});}else{return _0x11d2e1;}})[_0x391b('0x46')](function(_0x191736){logger[_0x391b('0x29')](_0x391b('0x50'),_0x191736);throw _0x191736;});}return _0x11d2e1;})[_0x391b('0x23')](respondWithResult(_0x1c52b1,0xc9))['catch'](handleError(_0x1c52b1,null));};exports[_0x391b('0x51')]=function(_0x5ed0cc,_0x4033c7){if(_0x5ed0cc['body']['id']){delete _0x5ed0cc['body']['id'];}return db[_0x391b('0x41')][_0x391b('0x48')]({'where':{'id':_0x5ed0cc[_0x391b('0x52')]['id']}})['then'](handleEntityNotFound(_0x4033c7,null))['then'](saveUpdates(_0x5ed0cc['body'],null))[_0x391b('0x23')](respondWithResult(_0x4033c7,null))['catch'](handleError(_0x4033c7,null));};exports[_0x391b('0x24')]=function(_0x48f67c,_0x2897e1){return db[_0x391b('0x41')]['find']({'where':{'id':_0x48f67c[_0x391b('0x52')]['id']}})[_0x391b('0x23')](handleEntityNotFound(_0x2897e1,null))[_0x391b('0x23')](removeEntity(_0x2897e1,null))['catch'](handleError(_0x2897e1,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index b0e7679..e67e1de 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 _0xed1f=['ListId','name_chat','name','name_mail','name_sms','FaxAccountId','name_whatsapp','WhatsappAccountId','lodash','util','moment','request-promise','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice'];(function(_0x51fea2,_0x206d41){var _0x53dc54=function(_0xd33a84){while(--_0xd33a84){_0x51fea2['push'](_0x51fea2['shift']());}};_0x53dc54(++_0x206d41);}(_0xed1f,0x170));var _0xfed1=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xed1f[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfed1('0x2'));var BPromise=require('bluebird');var rp=require(_0xfed1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfed1('0x4'));var config=require(_0xfed1('0x5'));var attributes=require(_0xfed1('0x6'));module[_0xfed1('0x7')]=function(_0x465671,_0x1f2391){return _0x465671[_0xfed1('0x8')](_0xfed1('0x9'),attributes,{'tableName':_0xfed1('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xfed1('0xb'),'fields':['name',_0xfed1('0xc')]},{'unique':!![],'name':_0xfed1('0xd'),'fields':[_0xfed1('0xe'),'ChatWebsiteId']},{'unique':!![],'name':_0xfed1('0xf'),'fields':['name','MailAccountId']},{'unique':!![],'name':_0xfed1('0x10'),'fields':[_0xfed1('0xe'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':[_0xfed1('0xe'),_0xfed1('0x11')]},{'unique':!![],'name':'name_openchannel','fields':[_0xfed1('0xe'),'OpenchannelAccountId']},{'unique':!![],'name':_0xfed1('0x12'),'fields':[_0xfed1('0xe'),_0xfed1('0x13')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a0b=['./disposition.attributes','exports','Disposition','name','ListId','name_chat','name_mail','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2c7a1a,_0x537deb){var _0x20e011=function(_0x1adf1a){while(--_0x1adf1a){_0x2c7a1a['push'](_0x2c7a1a['shift']());}};_0x20e011(++_0x537deb);}(_0x1a0b,0x18f));var _0xb1a0=function(_0x4dd18d,_0x132073){_0x4dd18d=_0x4dd18d-0x0;var _0x486b5d=_0x1a0b[_0x4dd18d];return _0x486b5d;};'use strict';var _=require(_0xb1a0('0x0'));var util=require('util');var logger=require(_0xb1a0('0x1'))(_0xb1a0('0x2'));var moment=require(_0xb1a0('0x3'));var BPromise=require(_0xb1a0('0x4'));var rp=require(_0xb1a0('0x5'));var fs=require('fs');var path=require(_0xb1a0('0x6'));var rimraf=require(_0xb1a0('0x7'));var config=require(_0xb1a0('0x8'));var attributes=require(_0xb1a0('0x9'));module[_0xb1a0('0xa')]=function(_0x2467a5,_0x598ff3){return _0x2467a5['define'](_0xb1a0('0xb'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xb1a0('0xc'),_0xb1a0('0xd')]},{'unique':!![],'name':_0xb1a0('0xe'),'fields':['name','ChatWebsiteId']},{'unique':!![],'name':_0xb1a0('0xf'),'fields':[_0xb1a0('0xc'),_0xb1a0('0x10')]},{'unique':!![],'name':_0xb1a0('0x11'),'fields':[_0xb1a0('0xc'),_0xb1a0('0x12')]},{'unique':!![],'name':'name_fax','fields':[_0xb1a0('0xc'),_0xb1a0('0x13')]},{'unique':!![],'name':_0xb1a0('0x14'),'fields':['name',_0xb1a0('0x15')]},{'unique':!![],'name':_0xb1a0('0x16'),'fields':[_0xb1a0('0xc'),_0xb1a0('0x17')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index eb2b7f3..111d19b 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 _0x8ce2=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','randomstring','ioredis'];(function(_0x274ecf,_0xc38609){var _0x301d07=function(_0x24e4d4){while(--_0x24e4d4){_0x274ecf['push'](_0x274ecf['shift']());}};_0x301d07(++_0xc38609);}(_0x8ce2,0x129));var _0x28ce=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x8ce2[_0x54d4a8];return _0x3b321b;};'use strict';var _=require(_0x28ce('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x28ce('0x1'));var fs=require('fs');var Redis=require(_0x28ce('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x28ce('0x3'));var logger=require(_0x28ce('0x4'))(_0x28ce('0x5'));var config=require(_0x28ce('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x28ce('0x7')][_0x28ce('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x209d00,_0xec9127,_0x3e48fc){return new BPromise(function(_0x2d7a4,_0xb064d8){return client[_0x28ce('0x9')](_0x209d00,_0x3e48fc)[_0x28ce('0xa')](function(_0x16a590){logger[_0x28ce('0xb')](_0x28ce('0xc'),_0xec9127,_0x28ce('0xd'));logger[_0x28ce('0xe')](_0x28ce('0xf'),_0xec9127,'request\x20sent',JSON[_0x28ce('0x10')](_0x16a590));if(_0x16a590[_0x28ce('0x11')]){if(_0x16a590[_0x28ce('0x11')]['code']===0x1f4){logger[_0x28ce('0x11')]('Disposition,\x20%s,\x20%s',_0xec9127,_0x16a590[_0x28ce('0x11')][_0x28ce('0x12')]);return _0xb064d8(_0x16a590[_0x28ce('0x11')]['message']);}logger['error'](_0x28ce('0xc'),_0xec9127,_0x16a590['error'][_0x28ce('0x12')]);return _0x2d7a4(_0x16a590[_0x28ce('0x11')][_0x28ce('0x12')]);}else{logger[_0x28ce('0xb')](_0x28ce('0xc'),_0xec9127,_0x28ce('0xd'));_0x2d7a4(_0x16a590[_0x28ce('0x13')]['message']);}})['catch'](function(_0x5b724b){logger['error'](_0x28ce('0xc'),_0xec9127,_0x5b724b);_0xb064d8(_0x5b724b);});});} \ No newline at end of file +var _0xcdeb=['info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x44a59b,_0x18f8a5){var _0x5382c5=function(_0x453223){while(--_0x453223){_0x44a59b['push'](_0x44a59b['shift']());}};_0x5382c5(++_0x18f8a5);}(_0xcdeb,0x184));var _0xbcde=function(_0x8d4c9e,_0xee90cf){_0x8d4c9e=_0x8d4c9e-0x0;var _0xf74b46=_0xcdeb[_0x8d4c9e];return _0xf74b46;};'use strict';var _=require(_0xbcde('0x0'));var util=require(_0xbcde('0x1'));var moment=require(_0xbcde('0x2'));var BPromise=require(_0xbcde('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbcde('0x4'))['db'];var utils=require(_0xbcde('0x5'));var logger=require('../../config/logger')(_0xbcde('0x6'));var config=require(_0xbcde('0x7'));var jayson=require(_0xbcde('0x8'));var client=jayson['client'][_0xbcde('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x437db7,_0x1a3036,_0x4ac1ef){return new BPromise(function(_0x665c81,_0x4d7819){return client[_0xbcde('0xa')](_0x437db7,_0x4ac1ef)['then'](function(_0x14cf27){logger[_0xbcde('0xb')](_0xbcde('0xc'),_0x1a3036,_0xbcde('0xd'));logger[_0xbcde('0xe')](_0xbcde('0xf'),_0x1a3036,_0xbcde('0xd'),JSON['stringify'](_0x14cf27));if(_0x14cf27[_0xbcde('0x10')]){if(_0x14cf27[_0xbcde('0x10')][_0xbcde('0x11')]===0x1f4){logger[_0xbcde('0x10')](_0xbcde('0xc'),_0x1a3036,_0x14cf27[_0xbcde('0x10')][_0xbcde('0x12')]);return _0x4d7819(_0x14cf27['error'][_0xbcde('0x12')]);}logger[_0xbcde('0x10')](_0xbcde('0xc'),_0x1a3036,_0x14cf27[_0xbcde('0x10')]['message']);return _0x665c81(_0x14cf27[_0xbcde('0x10')][_0xbcde('0x12')]);}else{logger[_0xbcde('0xb')]('Disposition,\x20%s,\x20%s',_0x1a3036,_0xbcde('0xd'));_0x665c81(_0x14cf27[_0xbcde('0x13')][_0xbcde('0x12')]);}})[_0xbcde('0x14')](function(_0x3c9a16){logger[_0xbcde('0x10')]('Disposition,\x20%s,\x20%s',_0x1a3036,_0x3c9a16);_0x4d7819(_0x3c9a16);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 5f307ea..eb17025 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 _0x2401=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','exports','multer','util','path','express'];(function(_0x5eaba3,_0x25533f){var _0x31019e=function(_0x17e01e){while(--_0x17e01e){_0x5eaba3['push'](_0x5eaba3['shift']());}};_0x31019e(++_0x25533f);}(_0x2401,0x119));var _0x1240=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2401[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1240('0x0'));var util=require(_0x1240('0x1'));var path=require(_0x1240('0x2'));var timeout=require('connect-timeout');var express=require(_0x1240('0x3'));var router=express[_0x1240('0x4')]();var auth=require(_0x1240('0x5'));var interaction=require(_0x1240('0x6'));var config=require(_0x1240('0x7'));var controller=require('./disposition.controller');router[_0x1240('0x8')]('/',auth[_0x1240('0x9')](),controller[_0x1240('0xa')]);router['get']('/:id',auth[_0x1240('0x9')](),controller[_0x1240('0xb')]);router[_0x1240('0xc')]('/',auth[_0x1240('0x9')](),controller[_0x1240('0xd')]);router[_0x1240('0xe')](_0x1240('0xf'),auth[_0x1240('0x9')](),controller[_0x1240('0x10')]);router[_0x1240('0x11')](_0x1240('0xf'),auth[_0x1240('0x9')](),controller['destroy']);module[_0x1240('0x12')]=router; \ No newline at end of file +var _0xc3d8=['../../components/auth/service','../../components/interaction/service','./disposition.controller','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5eff70,_0x2b26b9){var _0x216a4c=function(_0x1ef4e9){while(--_0x1ef4e9){_0x5eff70['push'](_0x5eff70['shift']());}};_0x216a4c(++_0x2b26b9);}(_0xc3d8,0x12e));var _0x8c3d=function(_0x1ed43e,_0x318741){_0x1ed43e=_0x1ed43e-0x0;var _0x4d5b73=_0xc3d8[_0x1ed43e];return _0x4d5b73;};'use strict';var multer=require(_0x8c3d('0x0'));var util=require(_0x8c3d('0x1'));var path=require(_0x8c3d('0x2'));var timeout=require(_0x8c3d('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x8c3d('0x4'));var interaction=require(_0x8c3d('0x5'));var config=require('../../config/environment');var controller=require(_0x8c3d('0x6'));router[_0x8c3d('0x7')]('/',auth[_0x8c3d('0x8')](),controller[_0x8c3d('0x9')]);router[_0x8c3d('0x7')](_0x8c3d('0xa'),auth[_0x8c3d('0x8')](),controller['show']);router[_0x8c3d('0xb')]('/',auth[_0x8c3d('0x8')](),controller[_0x8c3d('0xc')]);router['put'](_0x8c3d('0xa'),auth[_0x8c3d('0x8')](),controller[_0x8c3d('0xd')]);router[_0x8c3d('0xe')](_0x8c3d('0xa'),auth[_0x8c3d('0x8')](),controller[_0x8c3d('0xf')]);module[_0x8c3d('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 c8e5f92..58d24bc 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 _0x2d12=['INTEGER','SIP','IAX','KHOMP','TEXT','BOOLEAN','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','9600','12000','2400','7200','14400','v17,v27,v29'];(function(_0x475fd5,_0x261e69){var _0x414446=function(_0x3cb7c4){while(--_0x3cb7c4){_0x475fd5['push'](_0x475fd5['shift']());}};_0x414446(++_0x261e69);}(_0x2d12,0xe5));var _0x22d1=function(_0x5ae9d9,_0x45f388){_0x5ae9d9=_0x5ae9d9-0x0;var _0x1df272=_0x2d12[_0x5ae9d9];return _0x1df272;};'use strict';var Sequelize=require('sequelize');module[_0x22d1('0x0')]={'name':{'type':Sequelize[_0x22d1('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x22d1('0x2')](_0x22d1('0x3'),'no'),'defaultValue':_0x22d1('0x3')},'headerinfo':{'type':Sequelize[_0x22d1('0x1')],'defaultValue':_0x22d1('0x4')},'localstationid':{'type':Sequelize[_0x22d1('0x1')],'unique':_0x22d1('0x5')},'minrate':{'type':Sequelize[_0x22d1('0x2')]('2400',_0x22d1('0x6'),'7200',_0x22d1('0x7'),_0x22d1('0x8'),'14400'),'defaultValue':_0x22d1('0x6')},'maxrate':{'type':Sequelize[_0x22d1('0x2')](_0x22d1('0x9'),'4800',_0x22d1('0xa'),_0x22d1('0x7'),_0x22d1('0x8'),'14400'),'defaultValue':_0x22d1('0xb')},'modem':{'type':Sequelize[_0x22d1('0x1')],'defaultValue':_0x22d1('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x22d1('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x22d1('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x22d1('0x2')](_0x22d1('0xe'),_0x22d1('0xf'),'DADHI',_0x22d1('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x22d1('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x22d1('0x11')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x22d1('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x22d1('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x22d1('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x22d1('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x22d1('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x22d1('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x22d1('0x12')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4e91e8){if(!_0x4e91e8)this[_0x22d1('0x13')](_0x22d1('0x14'),null);this[_0x22d1('0x13')](_0x22d1('0x15'),_0x4e91e8);}}}; \ No newline at end of file +var _0x11d1=['2400','4800','7200','9600','12000','14400','v17,v27,v29','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','ENUM'];(function(_0x2b2c53,_0x4bcf9b){var _0x311ec2=function(_0x4a8e72){while(--_0x4a8e72){_0x2b2c53['push'](_0x2b2c53['shift']());}};_0x311ec2(++_0x4bcf9b);}(_0x11d1,0xf5));var _0x111d=function(_0x31765a,_0x216701){_0x31765a=_0x31765a-0x0;var _0x103b08=_0x11d1[_0x31765a];return _0x103b08;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x111d('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM'](_0x111d('0x1'),'no'),'defaultValue':_0x111d('0x1')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x111d('0x2')},'localstationid':{'type':Sequelize[_0x111d('0x0')],'unique':_0x111d('0x3')},'minrate':{'type':Sequelize[_0x111d('0x4')](_0x111d('0x5'),_0x111d('0x6'),_0x111d('0x7'),_0x111d('0x8'),_0x111d('0x9'),_0x111d('0xa')),'defaultValue':_0x111d('0x6')},'maxrate':{'type':Sequelize['ENUM'](_0x111d('0x5'),_0x111d('0x6'),_0x111d('0x7'),_0x111d('0x8'),'12000',_0x111d('0xa')),'defaultValue':_0x111d('0xa')},'modem':{'type':Sequelize[_0x111d('0x0')],'defaultValue':_0x111d('0xb')},'gateway':{'type':Sequelize[_0x111d('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x111d('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x111d('0xc'),_0x111d('0xd'),_0x111d('0xe'),_0x111d('0xf')),'defaultValue':_0x111d('0xc')},'key':{'type':Sequelize[_0x111d('0x0')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x111d('0x10')],'defaultValue':function(){return _0x111d('0x11');}},'notificationSound':{'type':Sequelize[_0x111d('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x111d('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x111d('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x111d('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x111d('0x13')],'allowNull':!![],'defaultValue':null,'comment':_0x111d('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x111d('0x12')],'defaultValue':![],'comment':_0x111d('0x15'),'set':function(_0x1e908d){if(!_0x1e908d)this[_0x111d('0x16')](_0x111d('0x17'),null);this['setDataValue'](_0x111d('0x18'),_0x1e908d);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 605ca9f..f219a65 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 _0x17ba=['../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','end','status','json','count','offset','set','Content-Range','apply','reject','update','destroy','get','UserProfileResource','stack','name','send','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','show','Pause','fields','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','Disposition','getDispositions','findOne','FaxAccountId','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','FaxApplication','bulkCreate','priority','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','Set','ecm','gateway','faxdetect','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','sequelize','VoiceExtension','updateAccountApplications','tech','createdAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','CmList','List','Contacts','updatedAt','DESC','attachments','join','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','defaults','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util'];(function(_0x2a2cc8,_0xa53460){var _0x591e4f=function(_0x19042a){while(--_0x19042a){_0x2a2cc8['push'](_0x2a2cc8['shift']());}};_0x591e4f(++_0xa53460);}(_0x17ba,0xab));var _0xa17b=function(_0x3dfbe4,_0x3607ab){_0x3dfbe4=_0x3dfbe4-0x0;var _0x3108c5=_0x17ba[_0x3dfbe4];return _0x3108c5;};'use strict';var pdf=require(_0xa17b('0x0'));var emlformat=require(_0xa17b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa17b('0x2'));var jsonpatch=require(_0xa17b('0x3'));var rp=require(_0xa17b('0x4'));var moment=require(_0xa17b('0x5'));var BPromise=require(_0xa17b('0x6'));var Mustache=require(_0xa17b('0x7'));var util=require(_0xa17b('0x8'));var path=require(_0xa17b('0x9'));var sox=require(_0xa17b('0xa'));var csv=require(_0xa17b('0xb'));var ejs=require(_0xa17b('0xc'));var fs=require('fs');var _=require(_0xa17b('0xd'));var squel=require(_0xa17b('0xe'));var crypto=require(_0xa17b('0xf'));var jsforce=require(_0xa17b('0x10'));var deskjs=require(_0xa17b('0x11'));var toCsv=require(_0xa17b('0xb'));var querystring=require(_0xa17b('0x12'));var Papa=require(_0xa17b('0x13'));var Redis=require('ioredis');var authService=require(_0xa17b('0x14'));var qs=require(_0xa17b('0x15'));var as=require(_0xa17b('0x16'));var hardwareService=require(_0xa17b('0x17'));var logger=require(_0xa17b('0x18'))(_0xa17b('0x19'));var utils=require(_0xa17b('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xa17b('0x1b'));var db=require(_0xa17b('0x1c'))['db'];config[_0xa17b('0x1d')]=_['defaults'](config[_0xa17b('0x1d')],{'host':_0xa17b('0x1e'),'port':0x18eb});var socket=require(_0xa17b('0x1f'))(new Redis(config[_0xa17b('0x1d')]));require('./faxAccount.socket')[_0xa17b('0x20')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa17b('0x21')][_0xa17b('0x22')]({'port':0x232c});var client9002=jayson['client'][_0xa17b('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x3c63e3,_0x1c0578,_0x1f8141,_0x4870fb){return new BPromise(function(_0x98a295,_0x5e21c2){var _0x4d5592=_0x4870fb||client;return _0x4d5592['request'](_0x3c63e3,_0x1f8141)[_0xa17b('0x23')](function(_0x197237){logger['info'](_0xa17b('0x24'),_0x1c0578,_0xa17b('0x25'));logger[_0xa17b('0x26')](_0xa17b('0x27'),_0x1c0578,_0xa17b('0x25'),JSON[_0xa17b('0x28')](_0x197237));if(_0x197237[_0xa17b('0x29')]){if(_0x197237['error'][_0xa17b('0x2a')]===0x1f4){logger[_0xa17b('0x29')](_0xa17b('0x24'),_0x1c0578,_0x197237['error'][_0xa17b('0x2b')]);return _0x5e21c2(_0x197237[_0xa17b('0x29')][_0xa17b('0x2b')]);}logger[_0xa17b('0x29')](_0xa17b('0x24'),_0x1c0578,_0x197237[_0xa17b('0x29')]['message']);return _0x98a295(_0x197237[_0xa17b('0x29')]['message']);}else{logger[_0xa17b('0x2c')](_0xa17b('0x24'),_0x1c0578,'request\x20sent');_0x98a295(_0x197237['result'][_0xa17b('0x2b')]);}})[_0xa17b('0x2d')](function(_0x4216ca){logger[_0xa17b('0x29')](_0xa17b('0x24'),_0x1c0578,_0x4216ca);_0x5e21c2(_0x4216ca);});});}function respondWithStatusCode(_0x3a64f5,_0x4cd38e){_0x4cd38e=_0x4cd38e||0xcc;return function(_0x47aff8){if(_0x47aff8){return _0x3a64f5['sendStatus'](_0x4cd38e);}return _0x3a64f5['status'](_0x4cd38e)[_0xa17b('0x2e')]();};}function respondWithResult(_0x5ef356,_0x295e67){_0x295e67=_0x295e67||0xc8;return function(_0x4ff3f8){if(_0x4ff3f8){return _0x5ef356[_0xa17b('0x2f')](_0x295e67)[_0xa17b('0x30')](_0x4ff3f8);}};}function respondWithFilteredResult(_0x32cad9,_0x28e6b8){return function(_0x346cc2){if(_0x346cc2){var _0x3ccdb8=_0x346cc2[_0xa17b('0x31')],_0x2fbbe8=_0x28e6b8[_0xa17b('0x32')],_0x366b47=_0x28e6b8['offset']+_0x28e6b8['limit'],_0x43b1f5;if(_0x366b47>=_0x3ccdb8){_0x366b47=_0x3ccdb8;_0x43b1f5=0xc8;}else{_0x43b1f5=0xce;}_0x32cad9['status'](_0x43b1f5);return _0x32cad9[_0xa17b('0x33')](_0xa17b('0x34'),_0x2fbbe8+'-'+_0x366b47+'/'+_0x3ccdb8)[_0xa17b('0x30')](_0x346cc2);}return null;};}function patchUpdates(_0x2888b8){return function(_0x16dd1f){try{jsonpatch[_0xa17b('0x35')](_0x16dd1f,_0x2888b8,!![]);}catch(_0x312ac3){return BPromise[_0xa17b('0x36')](_0x312ac3);}return _0x16dd1f['save']();};}function saveUpdates(_0x1e33bf,_0x4da126){return function(_0x34f901){if(_0x34f901){return _0x34f901[_0xa17b('0x37')](_0x1e33bf)[_0xa17b('0x23')](function(_0x3bde6d){return _0x3bde6d;});}return null;};}function removeEntity(_0x4ec38d,_0x243876){return function(_0x596d48){if(_0x596d48){return _0x596d48[_0xa17b('0x38')]()[_0xa17b('0x23')](function(){var _0x323e0e=_0x596d48[_0xa17b('0x39')]({'plain':!![]});var _0x146fc3='FaxAccounts';return db[_0xa17b('0x3a')]['destroy']({'where':{'type':_0x146fc3,'resourceId':_0x323e0e['id']}})[_0xa17b('0x23')](function(){return _0x596d48;});})['then'](function(){_0x4ec38d[_0xa17b('0x2f')](0xcc)[_0xa17b('0x2e')]();});}};}function handleEntityNotFound(_0x4d5b1a,_0x36d952){return function(_0x31b399){if(!_0x31b399){_0x4d5b1a['sendStatus'](0x194);}return _0x31b399;};}function handleError(_0x2fb380,_0x107584){_0x107584=_0x107584||0x1f4;return function(_0x3d4cf3){logger[_0xa17b('0x29')](_0x3d4cf3[_0xa17b('0x3b')]);if(_0x3d4cf3['name']){delete _0x3d4cf3[_0xa17b('0x3c')];}_0x2fb380['status'](_0x107584)[_0xa17b('0x3d')](_0x3d4cf3);};}exports['index']=function(_0x118ad9,_0x4d31f2){var _0x1e457e={'include':[{'model':db['Pause'],'as':_0xa17b('0x3e')}]},_0x5b8ef6={},_0x110183={'count':0x0,'rows':[]};var _0x44be7d=_[_0xa17b('0x3f')](db[_0xa17b('0x40')][_0xa17b('0x41')],function(_0xdd429f){return{'name':_0xdd429f[_0xa17b('0x42')],'type':_0xdd429f[_0xa17b('0x43')]['key']};});_0x5b8ef6[_0xa17b('0x44')]=_[_0xa17b('0x3f')](_0x44be7d,'name');_0x5b8ef6[_0xa17b('0x45')]=_[_0xa17b('0x46')](_0x118ad9[_0xa17b('0x45')]);_0x5b8ef6[_0xa17b('0x47')]=_[_0xa17b('0x48')](_0x5b8ef6[_0xa17b('0x44')],_0x5b8ef6['query']);_0x1e457e[_0xa17b('0x49')]=_[_0xa17b('0x48')](_0x5b8ef6[_0xa17b('0x44')],qs['fields'](_0x118ad9['query']['fields']));_0x1e457e[_0xa17b('0x49')]=_0x1e457e[_0xa17b('0x49')][_0xa17b('0x4a')]?_0x1e457e[_0xa17b('0x49')]:_0x5b8ef6[_0xa17b('0x44')];if(!_0x118ad9[_0xa17b('0x45')][_0xa17b('0x4b')](_0xa17b('0x4c'))){_0x1e457e[_0xa17b('0x4d')]=qs[_0xa17b('0x4d')](_0x118ad9[_0xa17b('0x45')][_0xa17b('0x4d')]);_0x1e457e['offset']=qs[_0xa17b('0x32')](_0x118ad9[_0xa17b('0x45')][_0xa17b('0x32')]);}_0x1e457e[_0xa17b('0x4e')]=qs[_0xa17b('0x4f')](_0x118ad9[_0xa17b('0x45')]['sort']);_0x1e457e[_0xa17b('0x50')]=qs[_0xa17b('0x47')](_[_0xa17b('0x51')](_0x118ad9[_0xa17b('0x45')],_0x5b8ef6[_0xa17b('0x47')]),_0x44be7d);if(_0x118ad9['query'][_0xa17b('0x52')]){_0x1e457e[_0xa17b('0x50')]=_[_0xa17b('0x53')](_0x1e457e[_0xa17b('0x50')],{'$or':_['map'](_0x44be7d,function(_0x37a020){if(_0x37a020[_0xa17b('0x43')]!==_0xa17b('0x54')){var _0x2906fd={};_0x2906fd[_0x37a020[_0xa17b('0x3c')]]={'$like':'%'+_0x118ad9[_0xa17b('0x45')][_0xa17b('0x52')]+'%'};return _0x2906fd;}})});}_0x1e457e=_['merge']({},_0x1e457e,_0x118ad9[_0xa17b('0x55')]);var _0x27b6cf={'where':_0x1e457e['where']};return db[_0xa17b('0x40')][_0xa17b('0x31')](_0x27b6cf)[_0xa17b('0x23')](function(_0x5d381a){_0x110183[_0xa17b('0x31')]=_0x5d381a;if(_0x118ad9[_0xa17b('0x45')]['includeAll']){_0x1e457e[_0xa17b('0x56')]=[{'all':!![]}];}return db[_0xa17b('0x40')]['findAll'](_0x1e457e);})[_0xa17b('0x23')](function(_0x347436){_0x110183['rows']=_0x347436;return _0x110183;})[_0xa17b('0x23')](respondWithFilteredResult(_0x4d31f2,_0x1e457e))[_0xa17b('0x2d')](handleError(_0x4d31f2,null));};exports[_0xa17b('0x57')]=function(_0x55aa4b,_0x2f4a2c){var _0x133823={'raw':![],'where':{'id':_0x55aa4b['params']['id']},'include':[{'model':db[_0xa17b('0x58')],'as':_0xa17b('0x3e')}]},_0x32e7ce={};_0x32e7ce[_0xa17b('0x44')]=_[_0xa17b('0x46')](db[_0xa17b('0x40')][_0xa17b('0x41')]);_0x32e7ce[_0xa17b('0x45')]=_[_0xa17b('0x46')](_0x55aa4b[_0xa17b('0x45')]);_0x32e7ce[_0xa17b('0x47')]=_[_0xa17b('0x48')](_0x32e7ce[_0xa17b('0x44')],_0x32e7ce[_0xa17b('0x45')]);_0x133823['attributes']=_[_0xa17b('0x48')](_0x32e7ce[_0xa17b('0x44')],qs[_0xa17b('0x59')](_0x55aa4b[_0xa17b('0x45')][_0xa17b('0x59')]));_0x133823[_0xa17b('0x49')]=_0x133823[_0xa17b('0x49')][_0xa17b('0x4a')]?_0x133823[_0xa17b('0x49')]:_0x32e7ce['model'];if(_0x55aa4b['query'][_0xa17b('0x5a')]){_0x133823[_0xa17b('0x56')]=[{'all':!![]}];}_0x133823=_['merge']({},_0x133823,_0x55aa4b['options']);return db['FaxAccount'][_0xa17b('0x5b')](_0x133823)[_0xa17b('0x23')](handleEntityNotFound(_0x2f4a2c,null))[_0xa17b('0x23')](respondWithResult(_0x2f4a2c,null))[_0xa17b('0x2d')](handleError(_0x2f4a2c,null));};exports[_0xa17b('0x5c')]=function(_0x15a897,_0x5f2400){return db['FaxAccount']['create'](_0x15a897['body'],{})['then'](function(_0x2a62e4){var _0x172479=_0x15a897[_0xa17b('0x5d')][_0xa17b('0x39')]({'plain':!![]});if(!_0x172479)throw new Error(_0xa17b('0x5e'));if(_0x172479[_0xa17b('0x5f')]===_0xa17b('0x5d')){var _0x55b98a=_0x2a62e4[_0xa17b('0x39')]({'plain':!![]});var _0x2417d9=_0xa17b('0x60');return db[_0xa17b('0x61')][_0xa17b('0x5b')]({'where':{'name':_0x2417d9,'userProfileId':_0x172479[_0xa17b('0x62')]},'raw':!![]})[_0xa17b('0x23')](function(_0x307727){if(_0x307727&&_0x307727[_0xa17b('0x63')]===0x0){return db[_0xa17b('0x3a')][_0xa17b('0x5c')]({'name':_0x55b98a[_0xa17b('0x3c')],'resourceId':_0x55b98a['id'],'type':_0x307727['name'],'sectionId':_0x307727['id']},{})[_0xa17b('0x23')](function(){return _0x2a62e4;});}else{return _0x2a62e4;}})['catch'](function(_0x3de0d8){logger[_0xa17b('0x29')](_0xa17b('0x64'),_0x3de0d8);throw _0x3de0d8;});}return _0x2a62e4;})[_0xa17b('0x23')](respondWithResult(_0x5f2400,0xc9))['catch'](handleError(_0x5f2400,null));};exports[_0xa17b('0x37')]=function(_0x57a1d9,_0x146a37){if(_0x57a1d9['body']['id']){delete _0x57a1d9['body']['id'];}return db[_0xa17b('0x40')][_0xa17b('0x5b')]({'where':{'id':_0x57a1d9['params']['id']},'include':[{'model':db[_0xa17b('0x58')],'as':_0xa17b('0x3e')}]})['then'](handleEntityNotFound(_0x146a37,null))['then'](saveUpdates(_0x57a1d9[_0xa17b('0x65')],null))[_0xa17b('0x23')](respondWithResult(_0x146a37,null))['catch'](handleError(_0x146a37,null));};exports[_0xa17b('0x38')]=function(_0x16d6e3,_0x495384){return db[_0xa17b('0x40')][_0xa17b('0x5b')]({'where':{'id':_0x16d6e3[_0xa17b('0x66')]['id']}})[_0xa17b('0x23')](handleEntityNotFound(_0x495384,null))[_0xa17b('0x23')](removeEntity(_0x495384,null))['catch'](handleError(_0x495384,null));};exports[_0xa17b('0x67')]=function(_0x3d4e6a,_0x1367c5){return db[_0xa17b('0x40')][_0xa17b('0x67')]()[_0xa17b('0x23')](respondWithResult(_0x1367c5,null))[_0xa17b('0x2d')](handleError(_0x1367c5,null));};exports[_0xa17b('0x68')]=function(_0x3fb393,_0x3b6676,_0x4e263d){if(_0x3fb393[_0xa17b('0x65')]['id']){delete _0x3fb393[_0xa17b('0x65')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x3fb393[_0xa17b('0x66')]['id']}})[_0xa17b('0x23')](handleEntityNotFound(_0x3b6676,null))[_0xa17b('0x23')](function(_0x1b5f10){if(_0x1b5f10){_0x3fb393[_0xa17b('0x65')]['FaxAccountId']=_0x1b5f10['id'];return db[_0xa17b('0x69')][_0xa17b('0x5c')](_0x3fb393[_0xa17b('0x65')]);}})[_0xa17b('0x23')](respondWithResult(_0x3b6676,null))['catch'](handleError(_0x3b6676,null));};exports[_0xa17b('0x6a')]=function(_0x4b7980,_0x652d41,_0x95ee49){var _0x3c9ea6={'raw':![],'where':{}};var _0x3b1ccf={};var _0x3ab285={'count':0x0,'rows':[]};return db['FaxAccount'][_0xa17b('0x6b')]({'where':{'id':_0x4b7980[_0xa17b('0x66')]['id']}})[_0xa17b('0x23')](handleEntityNotFound(_0x652d41,null))[_0xa17b('0x23')](function(_0x3bec94){if(_0x3bec94){_0x3b1ccf['model']=_[_0xa17b('0x46')](db[_0xa17b('0x69')]['rawAttributes']);_0x3b1ccf[_0xa17b('0x45')]=_[_0xa17b('0x46')](_0x4b7980['query']);_0x3b1ccf['filters']=_[_0xa17b('0x48')](_0x3b1ccf[_0xa17b('0x44')],_0x3b1ccf[_0xa17b('0x45')]);_0x3c9ea6['attributes']=_['intersection'](_0x3b1ccf['model'],qs[_0xa17b('0x59')](_0x4b7980['query'][_0xa17b('0x59')]));_0x3c9ea6[_0xa17b('0x49')]=_0x3c9ea6[_0xa17b('0x49')][_0xa17b('0x4a')]?_0x3c9ea6['attributes']:_0x3b1ccf['model'];if(!_0x4b7980['query'][_0xa17b('0x4b')](_0xa17b('0x4c'))){_0x3c9ea6[_0xa17b('0x4d')]=qs[_0xa17b('0x4d')](_0x4b7980[_0xa17b('0x45')][_0xa17b('0x4d')]);_0x3c9ea6[_0xa17b('0x32')]=qs[_0xa17b('0x32')](_0x4b7980[_0xa17b('0x45')]['offset']);}_0x3c9ea6[_0xa17b('0x4e')]=qs['sort'](_0x4b7980[_0xa17b('0x45')]['sort']);_0x3c9ea6[_0xa17b('0x50')]=qs[_0xa17b('0x47')](_[_0xa17b('0x51')](_0x4b7980['query'],_0x3b1ccf[_0xa17b('0x47')]));_0x3c9ea6['where'][_0xa17b('0x6c')]=_0x3bec94['id'];if(_0x4b7980[_0xa17b('0x45')][_0xa17b('0x52')]){_0x3c9ea6['where']=_[_0xa17b('0x53')](_0x3c9ea6[_0xa17b('0x50')],{'$or':_[_0xa17b('0x3f')](_0x3c9ea6[_0xa17b('0x49')],function(_0x330476){var _0x576e36={};_0x576e36[_0x330476]={'$like':'%'+_0x4b7980[_0xa17b('0x45')][_0xa17b('0x52')]+'%'};return _0x576e36;})});}_0x3c9ea6=_[_0xa17b('0x53')]({},_0x3c9ea6,_0x4b7980[_0xa17b('0x55')]);return db[_0xa17b('0x69')]['count']({'where':_0x3c9ea6[_0xa17b('0x50')]})[_0xa17b('0x23')](function(_0x1c5d9c){_0x3ab285['count']=_0x1c5d9c;if(_0x4b7980[_0xa17b('0x45')][_0xa17b('0x5a')]){_0x3c9ea6[_0xa17b('0x56')]=[{'all':!![]}];}return db[_0xa17b('0x69')][_0xa17b('0x6d')](_0x3c9ea6);})[_0xa17b('0x23')](function(_0x11fe9f){_0x3ab285[_0xa17b('0x6e')]=_0x11fe9f;return _0x3ab285;});}})[_0xa17b('0x23')](respondWithFilteredResult(_0x652d41,_0x3c9ea6))[_0xa17b('0x2d')](handleError(_0x652d41,null));};exports['removeDispositions']=function(_0x144583,_0x5b5bd3,_0x5b7037){return db[_0xa17b('0x40')][_0xa17b('0x5b')]({'where':{'id':_0x144583[_0xa17b('0x66')]['id']}})['then'](handleEntityNotFound(_0x5b5bd3,null))[_0xa17b('0x23')](function(_0x41aa4b){if(_0x41aa4b){return _0x41aa4b[_0xa17b('0x6f')](_0x144583[_0xa17b('0x45')][_0xa17b('0x70')]);}})[_0xa17b('0x23')](respondWithStatusCode(_0x5b5bd3,null))[_0xa17b('0x2d')](handleError(_0x5b5bd3,null));};exports[_0xa17b('0x71')]=function(_0x4e6a1a,_0x4a6813,_0x353c2d){if(_0x4e6a1a['body']['id']){delete _0x4e6a1a[_0xa17b('0x65')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x4e6a1a[_0xa17b('0x66')]['id']}})['then'](handleEntityNotFound(_0x4a6813,null))[_0xa17b('0x23')](function(_0x442e16){if(_0x442e16){_0x4e6a1a[_0xa17b('0x65')][_0xa17b('0x6c')]=_0x442e16['id'];return db[_0xa17b('0x72')][_0xa17b('0x5c')](_0x4e6a1a[_0xa17b('0x65')]);}})[_0xa17b('0x23')](respondWithResult(_0x4a6813,null))[_0xa17b('0x2d')](handleError(_0x4a6813,null));};exports[_0xa17b('0x73')]=function(_0x30d570,_0xeb1b4e,_0x1f3c29){var _0x259433={'raw':![],'where':{}};var _0x3789a5={};var _0x46d65a={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x30d570['params']['id']}})[_0xa17b('0x23')](handleEntityNotFound(_0xeb1b4e,null))['then'](function(_0x25850f){if(_0x25850f){_0x3789a5[_0xa17b('0x44')]=_['keys'](db[_0xa17b('0x72')]['rawAttributes']);_0x3789a5[_0xa17b('0x45')]=_[_0xa17b('0x46')](_0x30d570[_0xa17b('0x45')]);_0x3789a5[_0xa17b('0x47')]=_[_0xa17b('0x48')](_0x3789a5['model'],_0x3789a5['query']);_0x259433[_0xa17b('0x49')]=_[_0xa17b('0x48')](_0x3789a5[_0xa17b('0x44')],qs[_0xa17b('0x59')](_0x30d570[_0xa17b('0x45')][_0xa17b('0x59')]));_0x259433[_0xa17b('0x49')]=_0x259433[_0xa17b('0x49')][_0xa17b('0x4a')]?_0x259433[_0xa17b('0x49')]:_0x3789a5['model'];if(!_0x30d570[_0xa17b('0x45')][_0xa17b('0x4b')](_0xa17b('0x4c'))){_0x259433['limit']=qs[_0xa17b('0x4d')](_0x30d570[_0xa17b('0x45')]['limit']);_0x259433[_0xa17b('0x32')]=qs[_0xa17b('0x32')](_0x30d570[_0xa17b('0x45')][_0xa17b('0x32')]);}_0x259433[_0xa17b('0x4e')]=qs[_0xa17b('0x4f')](_0x30d570['query'][_0xa17b('0x4f')]);_0x259433[_0xa17b('0x50')]=qs['filters'](_[_0xa17b('0x51')](_0x30d570[_0xa17b('0x45')],_0x3789a5[_0xa17b('0x47')]));_0x259433[_0xa17b('0x50')][_0xa17b('0x6c')]=_0x25850f['id'];if(_0x30d570[_0xa17b('0x45')][_0xa17b('0x52')]){_0x259433['where']=_[_0xa17b('0x53')](_0x259433[_0xa17b('0x50')],{'$or':_[_0xa17b('0x3f')](_0x259433['attributes'],function(_0x54604d){var _0x40bb16={};_0x40bb16[_0x54604d]={'$like':'%'+_0x30d570['query']['filter']+'%'};return _0x40bb16;})});}_0x259433=_['merge']({},_0x259433,_0x30d570[_0xa17b('0x55')]);return db[_0xa17b('0x72')][_0xa17b('0x31')]({'where':_0x259433[_0xa17b('0x50')]})[_0xa17b('0x23')](function(_0x5e4197){_0x46d65a[_0xa17b('0x31')]=_0x5e4197;if(_0x30d570[_0xa17b('0x45')][_0xa17b('0x5a')]){_0x259433[_0xa17b('0x56')]=[{'all':!![]}];}return db['CannedAnswer'][_0xa17b('0x6d')](_0x259433);})['then'](function(_0x582edd){_0x46d65a['rows']=_0x582edd;return _0x46d65a;});}})[_0xa17b('0x23')](respondWithFilteredResult(_0xeb1b4e,_0x259433))['catch'](handleError(_0xeb1b4e,null));};exports[_0xa17b('0x74')]=function(_0x29a578,_0x5aad28,_0x109794){return db[_0xa17b('0x40')]['find']({'where':{'id':_0x29a578[_0xa17b('0x66')]['id']}})['then'](handleEntityNotFound(_0x5aad28,null))[_0xa17b('0x23')](function(_0x42c4fa){if(_0x42c4fa){return _0x42c4fa[_0xa17b('0x74')](_0x29a578[_0xa17b('0x45')]['ids']);}})[_0xa17b('0x23')](respondWithStatusCode(_0x5aad28,null))[_0xa17b('0x2d')](handleError(_0x5aad28,null));};exports[_0xa17b('0x75')]=function(_0x123c9c,_0x4f4c0d,_0x16f573){return db[_0xa17b('0x76')]['find']({'where':{'id':_0x123c9c[_0xa17b('0x66')]['id']}})[_0xa17b('0x23')](handleEntityNotFound(_0x4f4c0d,null))[_0xa17b('0x23')](function(_0x102082){if(_0x102082){return _0x102082['addInteraction'](_0x123c9c[_0xa17b('0x65')]['ids'],_[_0xa17b('0x77')](_0x123c9c[_0xa17b('0x65')],[_0xa17b('0x70'),'id'])||{});}})['then'](respondWithResult(_0x4f4c0d,null))[_0xa17b('0x2d')](handleError(_0x4f4c0d,null));};exports[_0xa17b('0x78')]=function(_0x7689a9,_0xb8bfbe,_0x31896f){var _0x3b6920={'raw':![],'where':{}};var _0x2c3e60={};var _0x354cf4={'count':0x0,'rows':[]};return db[_0xa17b('0x40')]['findOne']({'where':{'id':_0x7689a9[_0xa17b('0x66')]['id']}})[_0xa17b('0x23')](handleEntityNotFound(_0xb8bfbe,null))[_0xa17b('0x23')](function(_0xee38c2){if(_0xee38c2){_0x2c3e60['model']=_['keys'](db['FaxInteraction'][_0xa17b('0x41')]);_0x2c3e60['query']=_[_0xa17b('0x46')](_0x7689a9[_0xa17b('0x45')]);_0x2c3e60['filters']=_[_0xa17b('0x48')](_0x2c3e60[_0xa17b('0x44')],_0x2c3e60[_0xa17b('0x45')]);_0x3b6920['attributes']=_[_0xa17b('0x48')](_0x2c3e60['model'],qs['fields'](_0x7689a9[_0xa17b('0x45')][_0xa17b('0x59')]));_0x3b6920[_0xa17b('0x49')]=_0x3b6920['attributes'][_0xa17b('0x4a')]?_0x3b6920[_0xa17b('0x49')]:_0x2c3e60[_0xa17b('0x44')];if(!_0x7689a9[_0xa17b('0x45')][_0xa17b('0x4b')](_0xa17b('0x4c'))){_0x3b6920[_0xa17b('0x4d')]=qs[_0xa17b('0x4d')](_0x7689a9['query']['limit']);_0x3b6920['offset']=qs['offset'](_0x7689a9['query'][_0xa17b('0x32')]);}_0x3b6920[_0xa17b('0x4e')]=qs['sort'](_0x7689a9[_0xa17b('0x45')][_0xa17b('0x4f')]);_0x3b6920[_0xa17b('0x50')]=qs[_0xa17b('0x47')](_[_0xa17b('0x51')](_0x7689a9[_0xa17b('0x45')],_0x2c3e60[_0xa17b('0x47')]));_0x3b6920[_0xa17b('0x50')][_0xa17b('0x6c')]=_0xee38c2['id'];if(_0x7689a9['query']['filter']){_0x3b6920[_0xa17b('0x50')]=_[_0xa17b('0x53')](_0x3b6920[_0xa17b('0x50')],{'$or':_[_0xa17b('0x3f')](_0x3b6920[_0xa17b('0x49')],function(_0x32b4ba){var _0x3698b8={};_0x3698b8[_0x32b4ba]={'$like':'%'+_0x7689a9[_0xa17b('0x45')][_0xa17b('0x52')]+'%'};return _0x3698b8;})});}_0x3b6920=_[_0xa17b('0x53')]({},_0x3b6920,_0x7689a9[_0xa17b('0x55')]);return db['FaxInteraction']['count']({'where':_0x3b6920['where']})[_0xa17b('0x23')](function(_0x4175f8){_0x354cf4[_0xa17b('0x31')]=_0x4175f8;if(_0x7689a9[_0xa17b('0x45')]['includeAll']){_0x3b6920[_0xa17b('0x56')]=[{'model':db[_0xa17b('0x79')],'as':'Contact','required':![]},{'model':db[_0xa17b('0x7a')],'as':_0xa17b('0x7b'),'attributes':[_0xa17b('0x3c'),_0xa17b('0x7c'),_0xa17b('0x7d')],'required':![]},{'model':db[_0xa17b('0x7e')],'as':_0xa17b('0x7f'),'attributes':['id',_0xa17b('0x3c'),_0xa17b('0x80')],'where':_0x7689a9[_0xa17b('0x45')][_0xa17b('0x81')]?{'id':_0x7689a9[_0xa17b('0x45')][_0xa17b('0x81')]}:undefined,'required':_0x7689a9['query']['tag']?!![]:![]}];}return db[_0xa17b('0x76')][_0xa17b('0x6d')](_0x3b6920);})[_0xa17b('0x23')](function(_0x19f49b){_0x354cf4[_0xa17b('0x6e')]=_0x19f49b;return _0x354cf4;});}})[_0xa17b('0x23')](respondWithFilteredResult(_0xb8bfbe,_0x3b6920))[_0xa17b('0x2d')](handleError(_0xb8bfbe,null));};exports[_0xa17b('0x82')]=function(_0x9a07c9,_0x470a05,_0x5f0c6f){return db[_0xa17b('0x40')][_0xa17b('0x6b')]({'where':{'id':_0x9a07c9['params']['id']}})['then'](handleEntityNotFound(_0x470a05,null))[_0xa17b('0x23')](function(_0x160d7e){if(_0x160d7e){return db['sequelize'][_0xa17b('0x83')](function(_0x5cb8c0){return db[_0xa17b('0x84')][_0xa17b('0x38')]({'where':{'FaxAccountId':_0x9a07c9[_0xa17b('0x66')]['id']},'transaction':_0x5cb8c0})['then'](function(_0x2a7202){var _0xf42ee5=_[_0xa17b('0x3f')](_0x9a07c9[_0xa17b('0x65')],function(_0x54df54){_0x54df54[_0xa17b('0x6c')]=_0x9a07c9[_0xa17b('0x66')]['id'];return _0x54df54;});return db[_0xa17b('0x84')][_0xa17b('0x85')](_0xf42ee5,{'transaction':_0x5cb8c0});});})[_0xa17b('0x23')](function(){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x9a07c9[_0xa17b('0x66')]['id']},'order':_0xa17b('0x86')});});}})[_0xa17b('0x23')](respondWithResult(_0x470a05,null))['catch'](handleError(_0x470a05,null));};exports[_0xa17b('0x87')]=function(_0x498c25,_0x59bd8d,_0xc4ec32){var _0x43dc1d={};var _0x424d19={};var _0x188f98;var _0x3c78b6;return db['FaxAccount'][_0xa17b('0x6b')]({'where':{'id':_0x498c25['params']['id']}})[_0xa17b('0x23')](handleEntityNotFound(_0x59bd8d,null))[_0xa17b('0x23')](function(_0x5c5b9d){if(_0x5c5b9d){_0x188f98=_0x5c5b9d;_0x424d19['model']=_[_0xa17b('0x46')](db[_0xa17b('0x84')]['rawAttributes']);_0x424d19[_0xa17b('0x45')]=_[_0xa17b('0x46')](_0x498c25[_0xa17b('0x45')]);_0x424d19['filters']=_[_0xa17b('0x48')](_0x424d19[_0xa17b('0x44')],_0x424d19[_0xa17b('0x45')]);_0x43dc1d[_0xa17b('0x49')]=_['intersection'](_0x424d19[_0xa17b('0x44')],qs['fields'](_0x498c25[_0xa17b('0x45')][_0xa17b('0x59')]));_0x43dc1d[_0xa17b('0x49')]=_0x43dc1d[_0xa17b('0x49')][_0xa17b('0x4a')]?_0x43dc1d[_0xa17b('0x49')]:_0x424d19['model'];_0x43dc1d[_0xa17b('0x4e')]=qs[_0xa17b('0x4f')](_0x498c25[_0xa17b('0x45')][_0xa17b('0x4f')]);_0x43dc1d[_0xa17b('0x50')]=qs[_0xa17b('0x47')](_[_0xa17b('0x51')](_0x498c25[_0xa17b('0x45')],_0x424d19['filters']));if(_0x498c25[_0xa17b('0x45')][_0xa17b('0x52')]){_0x43dc1d[_0xa17b('0x50')]=_[_0xa17b('0x53')](_0x43dc1d[_0xa17b('0x50')],{'$or':_[_0xa17b('0x3f')](_0x43dc1d[_0xa17b('0x49')],function(_0x40b306){var _0x595e87={};_0x595e87[_0x40b306]={'$like':'%'+_0x498c25[_0xa17b('0x45')][_0xa17b('0x52')]+'%'};return _0x595e87;})});}_0x43dc1d=_[_0xa17b('0x53')]({},_0x43dc1d,_0x498c25['options']);return _0x188f98[_0xa17b('0x87')](_0x43dc1d);}})[_0xa17b('0x23')](function(_0xef59ce){if(_0xef59ce){_0x3c78b6=_0xef59ce['length'];if(!_0x498c25[_0xa17b('0x45')][_0xa17b('0x4b')](_0xa17b('0x4c'))){_0x43dc1d[_0xa17b('0x4d')]=qs[_0xa17b('0x4d')](_0x498c25[_0xa17b('0x45')]['limit']);_0x43dc1d[_0xa17b('0x32')]=qs['offset'](_0x498c25[_0xa17b('0x45')]['offset']);}return _0x188f98[_0xa17b('0x87')](_0x43dc1d);}})[_0xa17b('0x23')](function(_0x1ae041){if(_0x1ae041){return _0x1ae041?{'count':_0x3c78b6,'rows':_0x1ae041}:null;}})[_0xa17b('0x23')](respondWithResult(_0x59bd8d,null))[_0xa17b('0x2d')](handleError(_0x59bd8d,null));};function Extension(_0x2eafeb,_0x5bf29e,_0x2e848f,_0x54ec9f){this[_0xa17b('0x88')]=_0xa17b('0x89');this[_0xa17b('0x8a')]=_0x2eafeb[_0xa17b('0x8b')];this[_0xa17b('0x8c')]=_0x54ec9f;this[_0xa17b('0x43')]=_0xa17b('0x8d');this[_0xa17b('0x8e')]=_0xa17b('0x8f');this[_0xa17b('0x6c')]=_0x2eafeb['id'];this[_0xa17b('0x86')]=_0x5bf29e;this[_0xa17b('0x90')]=_0x2e848f;}function createExtensionsReciveFax(_0x4b78b4){var _0x3db576=0x1;var _0x352d20=[];_0x352d20[_0xa17b('0x91')](new Extension(_0x4b78b4,_0x3db576,'',_0xa17b('0x92')));_0x3db576+=0x1;_0x352d20[_0xa17b('0x91')](new Extension(_0x4b78b4,_0x3db576,'CDR(type)=inbound-fax',_0xa17b('0x93')));_0x3db576+=0x1;for(var _0x41f253 in _0x4b78b4){if(_0x4b78b4[_0xa17b('0x4b')](_0x41f253)&&(_0x41f253===_0xa17b('0x94')||_0x41f253===_0xa17b('0x8b')||_0x41f253===_0xa17b('0x95')||_0x41f253===_0xa17b('0x96')||_0x41f253==='headerinfo'||_0x41f253==='maxrate'||_0x41f253==='minrate'||_0x41f253==='modem'||_0x41f253===_0xa17b('0x97'))){_0x352d20['push'](new Extension(_0x4b78b4,_0x3db576,_0xa17b('0x98')+_0x41f253+')='+_0x4b78b4[_0x41f253],_0xa17b('0x93')));_0x3db576+=0x1;}}_0x352d20[_0xa17b('0x91')](new Extension(_0x4b78b4,_0x3db576,'6',_0xa17b('0x99')));_0x3db576+=0x1;_0x352d20[_0xa17b('0x91')](new Extension(_0x4b78b4,_0x3db576,_0xa17b('0x9a'),_0xa17b('0x9b')));_0x3db576=0x0;return _0x352d20;}exports[_0xa17b('0x9c')]=function(_0x427191,_0x5f14b3,_0x191a6d){var _0x47084c;return db[_0xa17b('0x9d')][_0xa17b('0x83')](function(_0x3dcdc2){return db[_0xa17b('0x40')]['create'](_0x427191[_0xa17b('0x65')],{'transaction':_0x3dcdc2})['then'](function(_0x12b061){_0x47084c=_0x12b061[_0xa17b('0x39')]({'plain':!![]});return db[_0xa17b('0x9e')][_0xa17b('0x85')](createExtensionsReciveFax(_0x47084c),{'transaction':_0x3dcdc2});});})[_0xa17b('0x23')](function(){return _0x47084c;})['then'](respondWithResult(_0x5f14b3,null))[_0xa17b('0x2d')](handleError(_0x5f14b3,null));};exports[_0xa17b('0x9f')]=function(_0x3e4ab1,_0x3ab43f,_0x39772c){var _0x36a083;return db[_0xa17b('0x9d')][_0xa17b('0x83')](function(_0x1a6e82){return db['FaxAccount'][_0xa17b('0x37')](_0x3e4ab1['body'],{'where':{'id':_0x3e4ab1[_0xa17b('0x65')]['id']},'transaction':_0x1a6e82})[_0xa17b('0x23')](function(_0xca8c2b){return db['VoiceExtension'][_0xa17b('0x38')]({'where':{'FaxAccountId':_0x3e4ab1[_0xa17b('0x65')]['id']},'transaction':_0x1a6e82})[_0xa17b('0x23')](function(_0x2b824c){return db[_0xa17b('0x9e')][_0xa17b('0x85')](createExtensionsReciveFax(_[_0xa17b('0x77')](_0x3e4ab1[_0xa17b('0x65')],[_0xa17b('0xa0'),'key',_0xa17b('0xa1'),'updatedAt',_0xa17b('0xa2'),_0xa17b('0xa3')])),{'transaction':_0x1a6e82});});});})[_0xa17b('0x23')](function(){return db[_0xa17b('0x40')][_0xa17b('0xa4')](_0x3e4ab1[_0xa17b('0x65')]['id']);})[_0xa17b('0x23')](respondWithResult(_0x3ab43f,null))[_0xa17b('0x2d')](handleError(_0x3ab43f,null));};exports[_0xa17b('0xa5')]=function(_0x1556de,_0x5812a2,_0x2bca15){var _0x5b187e={'raw':!![],'where':{}};var _0x4c1bfe={};var _0x20ae0f={'count':0x0,'rows':[]};return db[_0xa17b('0x40')][_0xa17b('0x6b')]({'where':{'id':_0x1556de[_0xa17b('0x66')]['id']}})[_0xa17b('0x23')](handleEntityNotFound(_0x5812a2,null))[_0xa17b('0x23')](function(_0x50007d){if(_0x50007d){_0x4c1bfe['model']=_['keys'](db[_0xa17b('0xa6')]['rawAttributes']);_0x4c1bfe[_0xa17b('0x45')]=_[_0xa17b('0x46')](_0x1556de[_0xa17b('0x45')]);_0x4c1bfe[_0xa17b('0x47')]=_[_0xa17b('0x48')](_0x4c1bfe[_0xa17b('0x44')],_0x4c1bfe[_0xa17b('0x45')]);_0x5b187e[_0xa17b('0x49')]=_['intersection'](_0x4c1bfe['model'],qs[_0xa17b('0x59')](_0x1556de['query'][_0xa17b('0x59')]));_0x5b187e[_0xa17b('0x49')]=_0x5b187e[_0xa17b('0x49')][_0xa17b('0x4a')]?_0x5b187e[_0xa17b('0x49')]:_0x4c1bfe[_0xa17b('0x44')];if(!_0x1556de['query'][_0xa17b('0x4b')](_0xa17b('0x4c'))){_0x5b187e['limit']=qs['limit'](_0x1556de[_0xa17b('0x45')][_0xa17b('0x4d')]);_0x5b187e[_0xa17b('0x32')]=qs[_0xa17b('0x32')](_0x1556de[_0xa17b('0x45')][_0xa17b('0x32')]);}_0x5b187e[_0xa17b('0x4e')]=qs['sort'](_0x1556de[_0xa17b('0x45')]['sort']);_0x5b187e['where']=qs[_0xa17b('0x47')](_[_0xa17b('0x51')](_0x1556de[_0xa17b('0x45')],_0x4c1bfe[_0xa17b('0x47')]));_0x5b187e[_0xa17b('0x50')][_0xa17b('0x6c')]=_0x50007d['id'];if(_0x1556de['query'][_0xa17b('0x52')]){_0x5b187e[_0xa17b('0x50')]=_[_0xa17b('0x53')](_0x5b187e[_0xa17b('0x50')],{'$or':_['map'](_0x5b187e['attributes'],function(_0x495c97){var _0x8e56cb={};_0x8e56cb[_0x495c97]={'$like':'%'+_0x1556de['query']['filter']+'%'};return _0x8e56cb;})});}if(_0x1556de[_0xa17b('0x45')]['$gte']){var _0x56a5a7=_0x1556de[_0xa17b('0x45')][_0xa17b('0xa7')][_0xa17b('0xa8')](',');var _0x13ff0f={};_0x13ff0f[_0x56a5a7[0x0]]={'$gte':moment(_0x56a5a7[0x1])[_0xa17b('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5b187e[_0xa17b('0x50')]=_[_0xa17b('0x53')](_0x5b187e[_0xa17b('0x50')],_0x13ff0f);}_0x5b187e=_[_0xa17b('0x53')]({},_0x5b187e,_0x1556de[_0xa17b('0x55')]);return db[_0xa17b('0xa6')][_0xa17b('0x31')]({'where':_0x5b187e[_0xa17b('0x50')]})[_0xa17b('0x23')](function(_0x2d8cd3){_0x20ae0f[_0xa17b('0x31')]=_0x2d8cd3;if(_0x1556de[_0xa17b('0x45')]['includeAll']){_0x5b187e[_0xa17b('0x56')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x5b187e);})[_0xa17b('0x23')](function(_0x311eff){_0x20ae0f[_0xa17b('0x6e')]=_0x311eff;return _0x20ae0f;});}})[_0xa17b('0x23')](respondWithFilteredResult(_0x5812a2,_0x5b187e))[_0xa17b('0x2d')](handleError(_0x5812a2,null));};exports[_0xa17b('0x3d')]=function(_0x17e44c,_0x1010ba,_0x2fd8ef){var _0x4f2289,_0x5a859f={},_0x31e87e;if(_0x17e44c[_0xa17b('0x65')]['to']){_0x31e87e=_0x17e44c['body']['to'][0x0];}return db[_0xa17b('0x40')][_0xa17b('0x5b')]({'where':{'id':_0x17e44c[_0xa17b('0x66')]['id']},'include':[{'model':db[_0xa17b('0xaa')],'as':_0xa17b('0xab'),'include':[{'model':db[_0xa17b('0x79')],'as':_0xa17b('0xac'),'where':{'fax':_0x31e87e},'limit':0x1,'order':[[_0xa17b('0xad'),_0xa17b('0xae')]]}]}]})[_0xa17b('0x23')](handleEntityNotFound(_0x1010ba,null))['then'](function(_0x672e34){_0x4f2289=_0x672e34;if(_0x17e44c[_0xa17b('0x65')][_0xa17b('0xaf')]&&_0x17e44c[_0xa17b('0x65')][_0xa17b('0xaf')]['length']){for(var _0x20152f=0x0;_0x20152f<_0x17e44c[_0xa17b('0x65')][_0xa17b('0xaf')][_0xa17b('0x4a')];_0x20152f+=0x1){_0x17e44c[_0xa17b('0x65')][_0xa17b('0xaf')][_0x20152f]={'filename':_0x17e44c[_0xa17b('0x65')][_0xa17b('0xaf')][_0x20152f][_0xa17b('0x3c')],'id':_0x17e44c[_0xa17b('0x65')][_0xa17b('0xaf')][_0x20152f]['id'],'path':path[_0xa17b('0xb0')](config['root'],'server/files/attachments',_0x17e44c[_0xa17b('0x65')]['attachments'][_0x20152f][_0xa17b('0xb1')])};}}return respondWithRpcPromise(_0xa17b('0xb2'),_0xa17b('0xb2'),{'FaxAccountId':_['isNil'](_0x17e44c[_0xa17b('0x66')]['id'])?undefined:_0x17e44c['params']['id'],'path':_[_0xa17b('0xb3')](_0x17e44c[_0xa17b('0x65')]['attachments'][0x0][_0xa17b('0x9')])?undefined:_0x17e44c['body'][_0xa17b('0xaf')][0x0][_0xa17b('0x9')],'fax':_[_0xa17b('0xb3')](_0x17e44c['body']['to'][0x0])?undefined:_0x17e44c['body']['to'][0x0]},client9002);})[_0xa17b('0x23')](function(){if(_0x4f2289){if(_[_0xa17b('0xb3')](_0x17e44c[_0xa17b('0x65')][_0xa17b('0xb4')])){_0x17e44c[_0xa17b('0x65')]['from']=util[_0xa17b('0xa9')](_0xa17b('0xb5'),_0x4f2289[_0xa17b('0x3c')],_0x4f2289['fax']);}if(_0x4f2289['List']){if(_0x4f2289[_0xa17b('0xab')][_0xa17b('0xac')][_0xa17b('0x4a')]){return _0x4f2289[_0xa17b('0xab')][_0xa17b('0xac')][0x0];}else{return db['CmContact'][_0xa17b('0x5c')](_[_0xa17b('0xb6')](_0x17e44c[_0xa17b('0x65')],{'firstName':_0x17e44c[_0xa17b('0x65')]['to'][0x0],'phone':_0x17e44c[_0xa17b('0x65')]['to'][0x0],'fax':_0x17e44c[_0xa17b('0x65')]['to'][0x0],'ListId':_0x4f2289['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xa17b('0xb7'));}})['then'](function(_0x103fc8){if(_0x103fc8){return db[_0xa17b('0x76')]['find']({'where':{'ContactId':_0x103fc8['id'],'closed':![],'FaxAccountId':_0x4f2289['id']}})[_0xa17b('0x23')](function(_0x4e74f3){if(_0x4e74f3){return[_0x4e74f3,![]];}return db[_0xa17b('0x76')][_0xa17b('0x5c')]({'UserId':_0x17e44c[_0xa17b('0x5d')]['id'],'ContactId':_0x103fc8['id'],'FaxAccountId':_0x4f2289['id'],'fax':_0x17e44c[_0xa17b('0x65')]['to'][0x0],'firstMsgDirection':_0xa17b('0xb8'),'Messages':[_[_0xa17b('0x53')](_0x17e44c[_0xa17b('0x65')],{'read':![],'body':_0x17e44c[_0xa17b('0x65')][_0xa17b('0xaf')][0x0][_0xa17b('0xb9')],'FaxAccountId':_0x4f2289['id'],'UserId':_0x17e44c[_0xa17b('0x5d')]['id'],'ContactId':_0x103fc8['id'],'AttachmentId':_0x17e44c[_0xa17b('0x65')][_0xa17b('0xaf')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xa17b('0xba')}]})[_0xa17b('0x23')](function(_0x18e068){return[_0x18e068,!![]];});});}else{throw new Error(_0xa17b('0xbb'));}})[_0xa17b('0xbc')](function(_0x5a3786,_0x264928){if(_0x264928){return _0x5a3786;}return db['FaxMessage'][_0xa17b('0x5c')]({'direction':_0xa17b('0xb8'),'read':![],'body':_0x17e44c[_0xa17b('0x65')][_0xa17b('0xaf')][0x0][_0xa17b('0xb9')],'FaxAccountId':_0x4f2289['id'],'FaxInteractionId':_0x5a3786['id'],'UserId':_0x17e44c[_0xa17b('0x5d')]['id'],'ContactId':_0x5a3786[_0xa17b('0xbd')],'AttachmentId':_0x17e44c[_0xa17b('0x65')][_0xa17b('0xaf')][0x0]['id']})[_0xa17b('0x23')](function(_0x1fed32){_0x5a3786[_0xa17b('0xbe')][_0xa17b('0xba')]=[];_0x5a3786[_0xa17b('0xbe')][_0xa17b('0xba')][_0xa17b('0x91')](_0x1fed32[_0xa17b('0xbe')]);return _0x5a3786;});})[_0xa17b('0x23')](function(_0x4e6391){respondWithRpcPromise(_0xa17b('0xbf'),'SendFax',{'FaxAccountId':_['isNil'](_0x17e44c[_0xa17b('0x66')]['id'])?undefined:_0x17e44c['params']['id'],'path':_[_0xa17b('0xb3')](_0x17e44c[_0xa17b('0x65')][_0xa17b('0xaf')][0x0][_0xa17b('0x9')])?undefined:_0x17e44c['body']['attachments'][0x0]['path'],'fax':_[_0xa17b('0xb3')](_0x17e44c[_0xa17b('0x65')]['to'][0x0])?undefined:_0x17e44c[_0xa17b('0x65')]['to'][0x0],'AttachmentId':_0x17e44c[_0xa17b('0x65')]['attachments'][0x0]['id']},client9002)[_0xa17b('0x23')](function(_0x3976b1){logger[_0xa17b('0x2c')]('SendFaxRpc,\x20%s',_0x3976b1);})[_0xa17b('0x2d')](function(_0x2a2c4a){logger['info'](_0xa17b('0xc0'),_0x2a2c4a);});return _0x4e6391;})[_0xa17b('0x23')](respondWithResult(_0x1010ba,null))[_0xa17b('0x2d')](handleError(_0x1010ba,null));};exports['addAgents']=function(_0x4e89da,_0x488af2,_0x15c139){return db['FaxAccount']['find']({'where':{'id':_0x4e89da[_0xa17b('0x66')]['id']}})[_0xa17b('0x23')](handleEntityNotFound(_0x488af2,null))[_0xa17b('0x23')](function(_0xa049c5){if(_0xa049c5){return _0xa049c5[_0xa17b('0xc1')](_0x4e89da['body'][_0xa17b('0x70')],_[_0xa17b('0x77')](_0x4e89da[_0xa17b('0x65')],['ids','id'])||{})['spread'](function(_0x2e8b1b){for(var _0x3f180d=0x0;_0x3f180d<_0x4e89da[_0xa17b('0x65')][_0xa17b('0x70')][_0xa17b('0x4a')];_0x3f180d+=0x1){socket[_0xa17b('0xc2')]('userFaxAccount:save',{'UserId':_0x4e89da[_0xa17b('0x65')]['ids'][_0x3f180d],'FaxAccountId':_0x4e89da['params']['id']});}return _0x2e8b1b;});}})[_0xa17b('0x23')](respondWithResult(_0x488af2,null))['catch'](handleError(_0x488af2,null));};exports[_0xa17b('0xc3')]=function(_0x51a4b1,_0x2383d3,_0x33c4d7){return db[_0xa17b('0x40')][_0xa17b('0x5b')]({'where':{'id':_0x51a4b1[_0xa17b('0x66')]['id']}})[_0xa17b('0x23')](handleEntityNotFound(_0x2383d3,null))[_0xa17b('0x23')](function(_0x38f48e){if(_0x38f48e){return _0x38f48e[_0xa17b('0xc3')](_0x51a4b1['query'][_0xa17b('0x70')])['then'](function(){if(_[_0xa17b('0xc4')](_0x51a4b1['query']['ids'])){for(var _0x2bec31=0x0;_0x2bec31<_0x51a4b1[_0xa17b('0x45')][_0xa17b('0x70')][_0xa17b('0x4a')];_0x2bec31+=0x1){socket[_0xa17b('0xc2')](_0xa17b('0xc5'),{'UserId':Number(_0x51a4b1[_0xa17b('0x45')][_0xa17b('0x70')][_0x2bec31]),'FaxAccountId':Number(_0x51a4b1[_0xa17b('0x66')]['id'])});}}else{socket[_0xa17b('0xc2')](_0xa17b('0xc5'),{'UserId':Number(_0x51a4b1[_0xa17b('0x45')][_0xa17b('0x70')]),'FaxAccountId':Number(_0x51a4b1[_0xa17b('0x66')]['id'])});}});}})['then'](respondWithStatusCode(_0x2383d3,null))['catch'](handleError(_0x2383d3,null));};exports[_0xa17b('0xc6')]=function(_0xf40098,_0x2137c2,_0x38c204){var _0x8cc1b2={};var _0x119ed2={};var _0x1c7956;var _0x4430ee;return db['FaxAccount'][_0xa17b('0x6b')]({'where':{'id':_0xf40098['params']['id']}})['then'](handleEntityNotFound(_0x2137c2,null))[_0xa17b('0x23')](function(_0x4c272f){if(_0x4c272f){_0x1c7956=_0x4c272f;_0x119ed2[_0xa17b('0x44')]=_[_0xa17b('0x46')](db[_0xa17b('0x7a')][_0xa17b('0x41')]);_0x119ed2[_0xa17b('0x45')]=_[_0xa17b('0x46')](_0xf40098[_0xa17b('0x45')]);_0x119ed2[_0xa17b('0x47')]=_[_0xa17b('0x48')](_0x119ed2[_0xa17b('0x44')],_0x119ed2['query']);_0x8cc1b2[_0xa17b('0x49')]=_[_0xa17b('0x48')](_0x119ed2['model'],qs['fields'](_0xf40098[_0xa17b('0x45')][_0xa17b('0x59')]));_0x8cc1b2[_0xa17b('0x49')]=_0x8cc1b2[_0xa17b('0x49')]['length']?_0x8cc1b2['attributes']:_0x119ed2[_0xa17b('0x44')];_0x8cc1b2[_0xa17b('0x4e')]=qs['sort'](_0xf40098[_0xa17b('0x45')][_0xa17b('0x4f')]);_0x8cc1b2['where']=qs[_0xa17b('0x47')](_[_0xa17b('0x51')](_0xf40098['query'],_0x119ed2[_0xa17b('0x47')]));if(_0xf40098[_0xa17b('0x45')][_0xa17b('0x52')]){_0x8cc1b2[_0xa17b('0x50')]=_['merge'](_0x8cc1b2[_0xa17b('0x50')],{'$or':_['map'](_0x8cc1b2['attributes'],function(_0x5159a0){var _0x4c33fa={};_0x4c33fa[_0x5159a0]={'$like':'%'+_0xf40098['query'][_0xa17b('0x52')]+'%'};return _0x4c33fa;})});}_0x8cc1b2=_[_0xa17b('0x53')]({},_0x8cc1b2,_0xf40098['options']);return _0x1c7956[_0xa17b('0xc6')](_0x8cc1b2);}})[_0xa17b('0x23')](function(_0x570bb6){if(_0x570bb6){_0x4430ee=_0x570bb6[_0xa17b('0x4a')];if(!_0xf40098[_0xa17b('0x45')][_0xa17b('0x4b')]('nolimit')){_0x8cc1b2[_0xa17b('0x4d')]=qs[_0xa17b('0x4d')](_0xf40098[_0xa17b('0x45')][_0xa17b('0x4d')]);_0x8cc1b2['offset']=qs[_0xa17b('0x32')](_0xf40098[_0xa17b('0x45')][_0xa17b('0x32')]);}return _0x1c7956[_0xa17b('0xc6')](_0x8cc1b2);}})[_0xa17b('0x23')](function(_0x81996a){if(_0x81996a){return _0x81996a?{'count':_0x4430ee,'rows':_0x81996a}:null;}})[_0xa17b('0x23')](respondWithResult(_0x2137c2,null))[_0xa17b('0x2d')](handleError(_0x2137c2,null));}; \ No newline at end of file +var _0xac95=['socket.io-emitter','./faxAccount.socket','register','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','limit','sort','filters','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','FaxAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','FaxAccountId','Disposition','findOne','order','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','priority','push','Answer','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','maxrate','minrate','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','addAccountApplications','updateAccountApplications','transaction','VoiceExtension','tech','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0xf59eb7,_0x2dcd83){var _0x3d869b=function(_0xae2ff9){while(--_0xae2ff9){_0xf59eb7['push'](_0xf59eb7['shift']());}};_0x3d869b(++_0x2dcd83);}(_0xac95,0xa8));var _0x5ac9=function(_0x2ce19f,_0x28558f){_0x2ce19f=_0x2ce19f-0x0;var _0x1e5010=_0xac95[_0x2ce19f];return _0x1e5010;};'use strict';var pdf=require(_0x5ac9('0x0'));var emlformat=require(_0x5ac9('0x1'));var rimraf=require(_0x5ac9('0x2'));var zipdir=require(_0x5ac9('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5ac9('0x4'));var BPromise=require(_0x5ac9('0x5'));var Mustache=require('mustache');var util=require(_0x5ac9('0x6'));var path=require(_0x5ac9('0x7'));var sox=require('sox');var csv=require(_0x5ac9('0x8'));var ejs=require(_0x5ac9('0x9'));var fs=require('fs');var _=require(_0x5ac9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5ac9('0xb'));var deskjs=require(_0x5ac9('0xc'));var toCsv=require(_0x5ac9('0x8'));var querystring=require(_0x5ac9('0xd'));var Papa=require(_0x5ac9('0xe'));var Redis=require(_0x5ac9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5ac9('0x10'));var as=require(_0x5ac9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ac9('0x12'))('api');var utils=require(_0x5ac9('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5ac9('0x14'));var db=require(_0x5ac9('0x15'))['db'];config[_0x5ac9('0x16')]=_[_0x5ac9('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5ac9('0x18'))(new Redis(config['redis']));require(_0x5ac9('0x19'))[_0x5ac9('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x5ac9('0x1b')][_0x5ac9('0x1c')]({'port':0x232c});var client9002=jayson[_0x5ac9('0x1b')][_0x5ac9('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x456ed9,_0x2fe47e,_0x44a5b1,_0x19b3a4){return new BPromise(function(_0x460fd7,_0x53163b){var _0x53a8db=_0x19b3a4||client;return _0x53a8db[_0x5ac9('0x1d')](_0x456ed9,_0x44a5b1)[_0x5ac9('0x1e')](function(_0x102c85){logger[_0x5ac9('0x1f')](_0x5ac9('0x20'),_0x2fe47e,_0x5ac9('0x21'));logger[_0x5ac9('0x22')](_0x5ac9('0x23'),_0x2fe47e,_0x5ac9('0x21'),JSON[_0x5ac9('0x24')](_0x102c85));if(_0x102c85[_0x5ac9('0x25')]){if(_0x102c85[_0x5ac9('0x25')][_0x5ac9('0x26')]===0x1f4){logger['error'](_0x5ac9('0x20'),_0x2fe47e,_0x102c85[_0x5ac9('0x25')][_0x5ac9('0x27')]);return _0x53163b(_0x102c85[_0x5ac9('0x25')][_0x5ac9('0x27')]);}logger['error'](_0x5ac9('0x20'),_0x2fe47e,_0x102c85[_0x5ac9('0x25')]['message']);return _0x460fd7(_0x102c85['error']['message']);}else{logger[_0x5ac9('0x1f')](_0x5ac9('0x20'),_0x2fe47e,'request\x20sent');_0x460fd7(_0x102c85['result'][_0x5ac9('0x27')]);}})['catch'](function(_0x49352f){logger[_0x5ac9('0x25')]('FaxAccount,\x20%s,\x20%s',_0x2fe47e,_0x49352f);_0x53163b(_0x49352f);});});}function respondWithStatusCode(_0x12f725,_0x3b77be){_0x3b77be=_0x3b77be||0xcc;return function(_0x770c48){if(_0x770c48){return _0x12f725[_0x5ac9('0x28')](_0x3b77be);}return _0x12f725[_0x5ac9('0x29')](_0x3b77be)[_0x5ac9('0x2a')]();};}function respondWithResult(_0x13aaa7,_0x2dc7fa){_0x2dc7fa=_0x2dc7fa||0xc8;return function(_0x203d19){if(_0x203d19){return _0x13aaa7['status'](_0x2dc7fa)[_0x5ac9('0x2b')](_0x203d19);}};}function respondWithFilteredResult(_0x14a7fe,_0x2a7db9){return function(_0x3a536c){if(_0x3a536c){var _0x3d51ab=_0x3a536c[_0x5ac9('0x2c')],_0x58c9be=_0x2a7db9['offset'],_0x47f6ad=_0x2a7db9[_0x5ac9('0x2d')]+_0x2a7db9['limit'],_0x2e5b69;if(_0x47f6ad>=_0x3d51ab){_0x47f6ad=_0x3d51ab;_0x2e5b69=0xc8;}else{_0x2e5b69=0xce;}_0x14a7fe[_0x5ac9('0x29')](_0x2e5b69);return _0x14a7fe[_0x5ac9('0x2e')](_0x5ac9('0x2f'),_0x58c9be+'-'+_0x47f6ad+'/'+_0x3d51ab)['json'](_0x3a536c);}return null;};}function patchUpdates(_0x2e6ad1){return function(_0x128866){try{jsonpatch[_0x5ac9('0x30')](_0x128866,_0x2e6ad1,!![]);}catch(_0x30fb2b){return BPromise[_0x5ac9('0x31')](_0x30fb2b);}return _0x128866[_0x5ac9('0x32')]();};}function saveUpdates(_0x4e7aee,_0x48d9bc){return function(_0x31ed52){if(_0x31ed52){return _0x31ed52['update'](_0x4e7aee)['then'](function(_0x17bd7e){return _0x17bd7e;});}return null;};}function removeEntity(_0x148d0b,_0x3e12be){return function(_0x2f2fb4){if(_0x2f2fb4){return _0x2f2fb4[_0x5ac9('0x33')]()[_0x5ac9('0x1e')](function(){var _0x6225c5=_0x2f2fb4[_0x5ac9('0x34')]({'plain':!![]});var _0x45cc32='FaxAccounts';return db[_0x5ac9('0x35')][_0x5ac9('0x33')]({'where':{'type':_0x45cc32,'resourceId':_0x6225c5['id']}})['then'](function(){return _0x2f2fb4;});})['then'](function(){_0x148d0b[_0x5ac9('0x29')](0xcc)[_0x5ac9('0x2a')]();});}};}function handleEntityNotFound(_0x386fc3,_0x378367){return function(_0x5be935){if(!_0x5be935){_0x386fc3[_0x5ac9('0x28')](0x194);}return _0x5be935;};}function handleError(_0x5b55c9,_0x3c540f){_0x3c540f=_0x3c540f||0x1f4;return function(_0x4600d8){logger[_0x5ac9('0x25')](_0x4600d8[_0x5ac9('0x36')]);if(_0x4600d8[_0x5ac9('0x37')]){delete _0x4600d8[_0x5ac9('0x37')];}_0x5b55c9[_0x5ac9('0x29')](_0x3c540f)[_0x5ac9('0x38')](_0x4600d8);};}exports[_0x5ac9('0x39')]=function(_0x427d86,_0x8049d0){var _0x1c11eb={'include':[{'model':db[_0x5ac9('0x3a')],'as':_0x5ac9('0x3b')}]},_0x5eacda={},_0x5d57ff={'count':0x0,'rows':[]};var _0x3003f6=_[_0x5ac9('0x3c')](db[_0x5ac9('0x3d')][_0x5ac9('0x3e')],function(_0x49bddc){return{'name':_0x49bddc[_0x5ac9('0x3f')],'type':_0x49bddc[_0x5ac9('0x40')]['key']};});_0x5eacda['model']=_['map'](_0x3003f6,_0x5ac9('0x37'));_0x5eacda[_0x5ac9('0x41')]=_[_0x5ac9('0x42')](_0x427d86[_0x5ac9('0x41')]);_0x5eacda['filters']=_[_0x5ac9('0x43')](_0x5eacda['model'],_0x5eacda['query']);_0x1c11eb[_0x5ac9('0x44')]=_[_0x5ac9('0x43')](_0x5eacda['model'],qs[_0x5ac9('0x45')](_0x427d86[_0x5ac9('0x41')]['fields']));_0x1c11eb[_0x5ac9('0x44')]=_0x1c11eb[_0x5ac9('0x44')][_0x5ac9('0x46')]?_0x1c11eb[_0x5ac9('0x44')]:_0x5eacda[_0x5ac9('0x47')];if(!_0x427d86[_0x5ac9('0x41')][_0x5ac9('0x48')](_0x5ac9('0x49'))){_0x1c11eb[_0x5ac9('0x4a')]=qs[_0x5ac9('0x4a')](_0x427d86[_0x5ac9('0x41')][_0x5ac9('0x4a')]);_0x1c11eb['offset']=qs[_0x5ac9('0x2d')](_0x427d86[_0x5ac9('0x41')][_0x5ac9('0x2d')]);}_0x1c11eb['order']=qs[_0x5ac9('0x4b')](_0x427d86[_0x5ac9('0x41')][_0x5ac9('0x4b')]);_0x1c11eb['where']=qs[_0x5ac9('0x4c')](_[_0x5ac9('0x4d')](_0x427d86[_0x5ac9('0x41')],_0x5eacda[_0x5ac9('0x4c')]),_0x3003f6);if(_0x427d86[_0x5ac9('0x41')][_0x5ac9('0x4e')]){_0x1c11eb['where']=_['merge'](_0x1c11eb[_0x5ac9('0x4f')],{'$or':_['map'](_0x3003f6,function(_0x448330){if(_0x448330['type']!==_0x5ac9('0x50')){var _0x51076b={};_0x51076b[_0x448330[_0x5ac9('0x37')]]={'$like':'%'+_0x427d86[_0x5ac9('0x41')][_0x5ac9('0x4e')]+'%'};return _0x51076b;}})});}_0x1c11eb=_[_0x5ac9('0x51')]({},_0x1c11eb,_0x427d86[_0x5ac9('0x52')]);var _0x20b55b={'where':_0x1c11eb[_0x5ac9('0x4f')]};return db[_0x5ac9('0x3d')][_0x5ac9('0x2c')](_0x20b55b)['then'](function(_0x3978c0){_0x5d57ff[_0x5ac9('0x2c')]=_0x3978c0;if(_0x427d86['query']['includeAll']){_0x1c11eb[_0x5ac9('0x53')]=[{'all':!![]}];}return db[_0x5ac9('0x3d')][_0x5ac9('0x54')](_0x1c11eb);})['then'](function(_0x33446e){_0x5d57ff[_0x5ac9('0x55')]=_0x33446e;return _0x5d57ff;})[_0x5ac9('0x1e')](respondWithFilteredResult(_0x8049d0,_0x1c11eb))[_0x5ac9('0x56')](handleError(_0x8049d0,null));};exports[_0x5ac9('0x57')]=function(_0x1be1e2,_0x499fd3){var _0x47a7b8={'raw':![],'where':{'id':_0x1be1e2[_0x5ac9('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x5ac9('0x3b')}]},_0xcc5418={};_0xcc5418[_0x5ac9('0x47')]=_[_0x5ac9('0x42')](db[_0x5ac9('0x3d')][_0x5ac9('0x3e')]);_0xcc5418['query']=_[_0x5ac9('0x42')](_0x1be1e2[_0x5ac9('0x41')]);_0xcc5418[_0x5ac9('0x4c')]=_['intersection'](_0xcc5418[_0x5ac9('0x47')],_0xcc5418[_0x5ac9('0x41')]);_0x47a7b8[_0x5ac9('0x44')]=_[_0x5ac9('0x43')](_0xcc5418[_0x5ac9('0x47')],qs['fields'](_0x1be1e2['query'][_0x5ac9('0x45')]));_0x47a7b8['attributes']=_0x47a7b8[_0x5ac9('0x44')]['length']?_0x47a7b8[_0x5ac9('0x44')]:_0xcc5418['model'];if(_0x1be1e2[_0x5ac9('0x41')][_0x5ac9('0x59')]){_0x47a7b8['include']=[{'all':!![]}];}_0x47a7b8=_['merge']({},_0x47a7b8,_0x1be1e2[_0x5ac9('0x52')]);return db[_0x5ac9('0x3d')][_0x5ac9('0x5a')](_0x47a7b8)[_0x5ac9('0x1e')](handleEntityNotFound(_0x499fd3,null))[_0x5ac9('0x1e')](respondWithResult(_0x499fd3,null))[_0x5ac9('0x56')](handleError(_0x499fd3,null));};exports[_0x5ac9('0x5b')]=function(_0xc731a3,_0x569b22){return db[_0x5ac9('0x3d')]['create'](_0xc731a3[_0x5ac9('0x5c')],{})[_0x5ac9('0x1e')](function(_0x4aee72){var _0xa478b5=_0xc731a3['user'][_0x5ac9('0x34')]({'plain':!![]});if(!_0xa478b5)throw new Error(_0x5ac9('0x5d'));if(_0xa478b5[_0x5ac9('0x5e')]===_0x5ac9('0x5f')){var _0x43b245=_0x4aee72['get']({'plain':!![]});var _0x1cc0b4=_0x5ac9('0x60');return db[_0x5ac9('0x61')]['find']({'where':{'name':_0x1cc0b4,'userProfileId':_0xa478b5[_0x5ac9('0x62')]},'raw':!![]})[_0x5ac9('0x1e')](function(_0x3c45c8){if(_0x3c45c8&&_0x3c45c8['autoAssociation']===0x0){return db[_0x5ac9('0x35')]['create']({'name':_0x43b245[_0x5ac9('0x37')],'resourceId':_0x43b245['id'],'type':_0x3c45c8[_0x5ac9('0x37')],'sectionId':_0x3c45c8['id']},{})['then'](function(){return _0x4aee72;});}else{return _0x4aee72;}})['catch'](function(_0x2497da){logger[_0x5ac9('0x25')](_0x5ac9('0x63'),_0x2497da);throw _0x2497da;});}return _0x4aee72;})[_0x5ac9('0x1e')](respondWithResult(_0x569b22,0xc9))[_0x5ac9('0x56')](handleError(_0x569b22,null));};exports[_0x5ac9('0x64')]=function(_0x403732,_0x1118e8){if(_0x403732['body']['id']){delete _0x403732[_0x5ac9('0x5c')]['id'];}return db[_0x5ac9('0x3d')]['find']({'where':{'id':_0x403732['params']['id']},'include':[{'model':db[_0x5ac9('0x3a')],'as':_0x5ac9('0x3b')}]})['then'](handleEntityNotFound(_0x1118e8,null))[_0x5ac9('0x1e')](saveUpdates(_0x403732[_0x5ac9('0x5c')],null))[_0x5ac9('0x1e')](respondWithResult(_0x1118e8,null))[_0x5ac9('0x56')](handleError(_0x1118e8,null));};exports[_0x5ac9('0x33')]=function(_0x24dbd5,_0x2e6777){return db[_0x5ac9('0x3d')][_0x5ac9('0x5a')]({'where':{'id':_0x24dbd5[_0x5ac9('0x58')]['id']}})[_0x5ac9('0x1e')](handleEntityNotFound(_0x2e6777,null))[_0x5ac9('0x1e')](removeEntity(_0x2e6777,null))[_0x5ac9('0x56')](handleError(_0x2e6777,null));};exports[_0x5ac9('0x65')]=function(_0x3b5233,_0x57e62b){return db[_0x5ac9('0x3d')]['describe']()[_0x5ac9('0x1e')](respondWithResult(_0x57e62b,null))[_0x5ac9('0x56')](handleError(_0x57e62b,null));};exports[_0x5ac9('0x66')]=function(_0x55fc39,_0x59354e,_0x7eb14b){if(_0x55fc39[_0x5ac9('0x5c')]['id']){delete _0x55fc39[_0x5ac9('0x5c')]['id'];}return db['FaxAccount'][_0x5ac9('0x5a')]({'where':{'id':_0x55fc39[_0x5ac9('0x58')]['id']}})['then'](handleEntityNotFound(_0x59354e,null))['then'](function(_0x25025e){if(_0x25025e){_0x55fc39['body'][_0x5ac9('0x67')]=_0x25025e['id'];return db[_0x5ac9('0x68')][_0x5ac9('0x5b')](_0x55fc39['body']);}})[_0x5ac9('0x1e')](respondWithResult(_0x59354e,null))[_0x5ac9('0x56')](handleError(_0x59354e,null));};exports['getDispositions']=function(_0x4265b3,_0x3af258,_0x598aff){var _0x3c2ab0={'raw':![],'where':{}};var _0x12e4a2={};var _0x5655bd={'count':0x0,'rows':[]};return db[_0x5ac9('0x3d')][_0x5ac9('0x69')]({'where':{'id':_0x4265b3['params']['id']}})[_0x5ac9('0x1e')](handleEntityNotFound(_0x3af258,null))[_0x5ac9('0x1e')](function(_0x200faa){if(_0x200faa){_0x12e4a2['model']=_[_0x5ac9('0x42')](db[_0x5ac9('0x68')][_0x5ac9('0x3e')]);_0x12e4a2[_0x5ac9('0x41')]=_[_0x5ac9('0x42')](_0x4265b3[_0x5ac9('0x41')]);_0x12e4a2[_0x5ac9('0x4c')]=_[_0x5ac9('0x43')](_0x12e4a2['model'],_0x12e4a2[_0x5ac9('0x41')]);_0x3c2ab0[_0x5ac9('0x44')]=_[_0x5ac9('0x43')](_0x12e4a2[_0x5ac9('0x47')],qs['fields'](_0x4265b3[_0x5ac9('0x41')]['fields']));_0x3c2ab0[_0x5ac9('0x44')]=_0x3c2ab0[_0x5ac9('0x44')][_0x5ac9('0x46')]?_0x3c2ab0[_0x5ac9('0x44')]:_0x12e4a2[_0x5ac9('0x47')];if(!_0x4265b3['query']['hasOwnProperty'](_0x5ac9('0x49'))){_0x3c2ab0['limit']=qs[_0x5ac9('0x4a')](_0x4265b3[_0x5ac9('0x41')][_0x5ac9('0x4a')]);_0x3c2ab0[_0x5ac9('0x2d')]=qs['offset'](_0x4265b3[_0x5ac9('0x41')]['offset']);}_0x3c2ab0[_0x5ac9('0x6a')]=qs[_0x5ac9('0x4b')](_0x4265b3[_0x5ac9('0x41')][_0x5ac9('0x4b')]);_0x3c2ab0[_0x5ac9('0x4f')]=qs[_0x5ac9('0x4c')](_[_0x5ac9('0x4d')](_0x4265b3['query'],_0x12e4a2[_0x5ac9('0x4c')]));_0x3c2ab0['where'][_0x5ac9('0x67')]=_0x200faa['id'];if(_0x4265b3[_0x5ac9('0x41')][_0x5ac9('0x4e')]){_0x3c2ab0[_0x5ac9('0x4f')]=_[_0x5ac9('0x51')](_0x3c2ab0['where'],{'$or':_[_0x5ac9('0x3c')](_0x3c2ab0[_0x5ac9('0x44')],function(_0x3dd13f){var _0x5d53b5={};_0x5d53b5[_0x3dd13f]={'$like':'%'+_0x4265b3[_0x5ac9('0x41')]['filter']+'%'};return _0x5d53b5;})});}_0x3c2ab0=_['merge']({},_0x3c2ab0,_0x4265b3[_0x5ac9('0x52')]);return db[_0x5ac9('0x68')][_0x5ac9('0x2c')]({'where':_0x3c2ab0[_0x5ac9('0x4f')]})['then'](function(_0x3f4a10){_0x5655bd[_0x5ac9('0x2c')]=_0x3f4a10;if(_0x4265b3[_0x5ac9('0x41')][_0x5ac9('0x59')]){_0x3c2ab0[_0x5ac9('0x53')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x3c2ab0);})[_0x5ac9('0x1e')](function(_0x4279d2){_0x5655bd[_0x5ac9('0x55')]=_0x4279d2;return _0x5655bd;});}})['then'](respondWithFilteredResult(_0x3af258,_0x3c2ab0))[_0x5ac9('0x56')](handleError(_0x3af258,null));};exports['removeDispositions']=function(_0x588c6e,_0x37a557,_0x5d61d6){return db[_0x5ac9('0x3d')][_0x5ac9('0x5a')]({'where':{'id':_0x588c6e['params']['id']}})[_0x5ac9('0x1e')](handleEntityNotFound(_0x37a557,null))[_0x5ac9('0x1e')](function(_0x213e84){if(_0x213e84){return _0x213e84['removeDispositions'](_0x588c6e[_0x5ac9('0x41')][_0x5ac9('0x6b')]);}})[_0x5ac9('0x1e')](respondWithStatusCode(_0x37a557,null))[_0x5ac9('0x56')](handleError(_0x37a557,null));};exports[_0x5ac9('0x6c')]=function(_0x3c34ee,_0x2965a4,_0x3be6a9){if(_0x3c34ee[_0x5ac9('0x5c')]['id']){delete _0x3c34ee['body']['id'];}return db[_0x5ac9('0x3d')][_0x5ac9('0x5a')]({'where':{'id':_0x3c34ee[_0x5ac9('0x58')]['id']}})[_0x5ac9('0x1e')](handleEntityNotFound(_0x2965a4,null))['then'](function(_0x4497d9){if(_0x4497d9){_0x3c34ee[_0x5ac9('0x5c')][_0x5ac9('0x67')]=_0x4497d9['id'];return db[_0x5ac9('0x6d')][_0x5ac9('0x5b')](_0x3c34ee[_0x5ac9('0x5c')]);}})[_0x5ac9('0x1e')](respondWithResult(_0x2965a4,null))[_0x5ac9('0x56')](handleError(_0x2965a4,null));};exports[_0x5ac9('0x6e')]=function(_0x3b599f,_0x411327,_0x52a612){var _0x30ff13={'raw':![],'where':{}};var _0x443cc8={};var _0x375d38={'count':0x0,'rows':[]};return db[_0x5ac9('0x3d')][_0x5ac9('0x69')]({'where':{'id':_0x3b599f[_0x5ac9('0x58')]['id']}})['then'](handleEntityNotFound(_0x411327,null))[_0x5ac9('0x1e')](function(_0x297a78){if(_0x297a78){_0x443cc8[_0x5ac9('0x47')]=_[_0x5ac9('0x42')](db['CannedAnswer'][_0x5ac9('0x3e')]);_0x443cc8[_0x5ac9('0x41')]=_[_0x5ac9('0x42')](_0x3b599f[_0x5ac9('0x41')]);_0x443cc8[_0x5ac9('0x4c')]=_[_0x5ac9('0x43')](_0x443cc8[_0x5ac9('0x47')],_0x443cc8[_0x5ac9('0x41')]);_0x30ff13[_0x5ac9('0x44')]=_[_0x5ac9('0x43')](_0x443cc8['model'],qs['fields'](_0x3b599f['query'][_0x5ac9('0x45')]));_0x30ff13['attributes']=_0x30ff13[_0x5ac9('0x44')][_0x5ac9('0x46')]?_0x30ff13[_0x5ac9('0x44')]:_0x443cc8[_0x5ac9('0x47')];if(!_0x3b599f[_0x5ac9('0x41')][_0x5ac9('0x48')](_0x5ac9('0x49'))){_0x30ff13[_0x5ac9('0x4a')]=qs[_0x5ac9('0x4a')](_0x3b599f['query'][_0x5ac9('0x4a')]);_0x30ff13['offset']=qs[_0x5ac9('0x2d')](_0x3b599f['query']['offset']);}_0x30ff13[_0x5ac9('0x6a')]=qs[_0x5ac9('0x4b')](_0x3b599f['query'][_0x5ac9('0x4b')]);_0x30ff13[_0x5ac9('0x4f')]=qs[_0x5ac9('0x4c')](_[_0x5ac9('0x4d')](_0x3b599f[_0x5ac9('0x41')],_0x443cc8[_0x5ac9('0x4c')]));_0x30ff13[_0x5ac9('0x4f')][_0x5ac9('0x67')]=_0x297a78['id'];if(_0x3b599f[_0x5ac9('0x41')][_0x5ac9('0x4e')]){_0x30ff13['where']=_[_0x5ac9('0x51')](_0x30ff13[_0x5ac9('0x4f')],{'$or':_[_0x5ac9('0x3c')](_0x30ff13[_0x5ac9('0x44')],function(_0x3cc74b){var _0x12a8f2={};_0x12a8f2[_0x3cc74b]={'$like':'%'+_0x3b599f[_0x5ac9('0x41')]['filter']+'%'};return _0x12a8f2;})});}_0x30ff13=_[_0x5ac9('0x51')]({},_0x30ff13,_0x3b599f[_0x5ac9('0x52')]);return db[_0x5ac9('0x6d')]['count']({'where':_0x30ff13[_0x5ac9('0x4f')]})[_0x5ac9('0x1e')](function(_0x225613){_0x375d38[_0x5ac9('0x2c')]=_0x225613;if(_0x3b599f[_0x5ac9('0x41')][_0x5ac9('0x59')]){_0x30ff13[_0x5ac9('0x53')]=[{'all':!![]}];}return db[_0x5ac9('0x6d')][_0x5ac9('0x54')](_0x30ff13);})[_0x5ac9('0x1e')](function(_0x5aa2be){_0x375d38['rows']=_0x5aa2be;return _0x375d38;});}})[_0x5ac9('0x1e')](respondWithFilteredResult(_0x411327,_0x30ff13))['catch'](handleError(_0x411327,null));};exports[_0x5ac9('0x6f')]=function(_0x36550c,_0x2da3bd,_0x5732ef){return db['FaxAccount'][_0x5ac9('0x5a')]({'where':{'id':_0x36550c[_0x5ac9('0x58')]['id']}})[_0x5ac9('0x1e')](handleEntityNotFound(_0x2da3bd,null))[_0x5ac9('0x1e')](function(_0x106b38){if(_0x106b38){return _0x106b38[_0x5ac9('0x6f')](_0x36550c[_0x5ac9('0x41')][_0x5ac9('0x6b')]);}})[_0x5ac9('0x1e')](respondWithStatusCode(_0x2da3bd,null))['catch'](handleError(_0x2da3bd,null));};exports[_0x5ac9('0x70')]=function(_0x19d14f,_0x41976a,_0x152d60){return db[_0x5ac9('0x71')][_0x5ac9('0x5a')]({'where':{'id':_0x19d14f[_0x5ac9('0x58')]['id']}})[_0x5ac9('0x1e')](handleEntityNotFound(_0x41976a,null))[_0x5ac9('0x1e')](function(_0x8d3789){if(_0x8d3789){return _0x8d3789[_0x5ac9('0x70')](_0x19d14f[_0x5ac9('0x5c')][_0x5ac9('0x6b')],_[_0x5ac9('0x72')](_0x19d14f['body'],[_0x5ac9('0x6b'),'id'])||{});}})[_0x5ac9('0x1e')](respondWithResult(_0x41976a,null))['catch'](handleError(_0x41976a,null));};exports['getInteractions']=function(_0x500079,_0x1bfdbc,_0x4aa68e){var _0x3b5e48={'raw':![],'where':{}};var _0x23a603={};var _0x2c9365={'count':0x0,'rows':[]};return db['FaxAccount'][_0x5ac9('0x69')]({'where':{'id':_0x500079[_0x5ac9('0x58')]['id']}})[_0x5ac9('0x1e')](handleEntityNotFound(_0x1bfdbc,null))[_0x5ac9('0x1e')](function(_0xb5efcc){if(_0xb5efcc){_0x23a603[_0x5ac9('0x47')]=_[_0x5ac9('0x42')](db[_0x5ac9('0x71')]['rawAttributes']);_0x23a603[_0x5ac9('0x41')]=_[_0x5ac9('0x42')](_0x500079[_0x5ac9('0x41')]);_0x23a603[_0x5ac9('0x4c')]=_['intersection'](_0x23a603[_0x5ac9('0x47')],_0x23a603[_0x5ac9('0x41')]);_0x3b5e48[_0x5ac9('0x44')]=_['intersection'](_0x23a603[_0x5ac9('0x47')],qs['fields'](_0x500079['query'][_0x5ac9('0x45')]));_0x3b5e48['attributes']=_0x3b5e48[_0x5ac9('0x44')][_0x5ac9('0x46')]?_0x3b5e48[_0x5ac9('0x44')]:_0x23a603['model'];if(!_0x500079['query'][_0x5ac9('0x48')](_0x5ac9('0x49'))){_0x3b5e48[_0x5ac9('0x4a')]=qs[_0x5ac9('0x4a')](_0x500079[_0x5ac9('0x41')][_0x5ac9('0x4a')]);_0x3b5e48[_0x5ac9('0x2d')]=qs[_0x5ac9('0x2d')](_0x500079[_0x5ac9('0x41')][_0x5ac9('0x2d')]);}_0x3b5e48[_0x5ac9('0x6a')]=qs[_0x5ac9('0x4b')](_0x500079[_0x5ac9('0x41')]['sort']);_0x3b5e48[_0x5ac9('0x4f')]=qs[_0x5ac9('0x4c')](_[_0x5ac9('0x4d')](_0x500079[_0x5ac9('0x41')],_0x23a603['filters']));_0x3b5e48['where'][_0x5ac9('0x67')]=_0xb5efcc['id'];if(_0x500079[_0x5ac9('0x41')][_0x5ac9('0x4e')]){_0x3b5e48['where']=_[_0x5ac9('0x51')](_0x3b5e48[_0x5ac9('0x4f')],{'$or':_[_0x5ac9('0x3c')](_0x3b5e48[_0x5ac9('0x44')],function(_0x4f3bba){var _0x8998c1={};_0x8998c1[_0x4f3bba]={'$like':'%'+_0x500079[_0x5ac9('0x41')][_0x5ac9('0x4e')]+'%'};return _0x8998c1;})});}_0x3b5e48=_[_0x5ac9('0x51')]({},_0x3b5e48,_0x500079[_0x5ac9('0x52')]);return db[_0x5ac9('0x71')][_0x5ac9('0x2c')]({'where':_0x3b5e48[_0x5ac9('0x4f')]})[_0x5ac9('0x1e')](function(_0x5ece2d){_0x2c9365[_0x5ac9('0x2c')]=_0x5ece2d;if(_0x500079['query']['includeAll']){_0x3b5e48[_0x5ac9('0x53')]=[{'model':db[_0x5ac9('0x73')],'as':_0x5ac9('0x74'),'required':![]},{'model':db[_0x5ac9('0x75')],'as':_0x5ac9('0x76'),'attributes':[_0x5ac9('0x37'),_0x5ac9('0x77'),_0x5ac9('0x78')],'required':![]},{'model':db[_0x5ac9('0x79')],'as':'Tags','attributes':['id',_0x5ac9('0x37'),_0x5ac9('0x7a')],'where':_0x500079[_0x5ac9('0x41')]['tag']?{'id':_0x500079['query'][_0x5ac9('0x7b')]}:undefined,'required':_0x500079[_0x5ac9('0x41')][_0x5ac9('0x7b')]?!![]:![]}];}return db['FaxInteraction'][_0x5ac9('0x54')](_0x3b5e48);})[_0x5ac9('0x1e')](function(_0x53d4aa){_0x2c9365[_0x5ac9('0x55')]=_0x53d4aa;return _0x2c9365;});}})[_0x5ac9('0x1e')](respondWithFilteredResult(_0x1bfdbc,_0x3b5e48))[_0x5ac9('0x56')](handleError(_0x1bfdbc,null));};exports[_0x5ac9('0x7c')]=function(_0x374327,_0x449dcb,_0xba6796){return db['FaxAccount']['findOne']({'where':{'id':_0x374327[_0x5ac9('0x58')]['id']}})[_0x5ac9('0x1e')](handleEntityNotFound(_0x449dcb,null))['then'](function(_0x575e2f){if(_0x575e2f){return db[_0x5ac9('0x7d')]['transaction'](function(_0x3b8db1){return db[_0x5ac9('0x7e')][_0x5ac9('0x33')]({'where':{'FaxAccountId':_0x374327[_0x5ac9('0x58')]['id']},'transaction':_0x3b8db1})[_0x5ac9('0x1e')](function(_0x4cf619){var _0x4353b6=_[_0x5ac9('0x3c')](_0x374327[_0x5ac9('0x5c')],function(_0x1494d2){_0x1494d2[_0x5ac9('0x67')]=_0x374327[_0x5ac9('0x58')]['id'];return _0x1494d2;});return db['FaxApplication'][_0x5ac9('0x7f')](_0x4353b6,{'transaction':_0x3b8db1});});})['then'](function(){return db['FaxApplication'][_0x5ac9('0x80')]({'where':{'FaxAccountId':_0x374327['params']['id']},'order':'priority'});});}})[_0x5ac9('0x1e')](respondWithResult(_0x449dcb,null))['catch'](handleError(_0x449dcb,null));};exports[_0x5ac9('0x81')]=function(_0x3406fc,_0x523064,_0x26f4dc){var _0x514ae3={};var _0x53a337={};var _0x289e4e;var _0x4106a6;return db[_0x5ac9('0x3d')]['findOne']({'where':{'id':_0x3406fc[_0x5ac9('0x58')]['id']}})['then'](handleEntityNotFound(_0x523064,null))['then'](function(_0x31d328){if(_0x31d328){_0x289e4e=_0x31d328;_0x53a337[_0x5ac9('0x47')]=_[_0x5ac9('0x42')](db['FaxApplication']['rawAttributes']);_0x53a337['query']=_['keys'](_0x3406fc[_0x5ac9('0x41')]);_0x53a337[_0x5ac9('0x4c')]=_[_0x5ac9('0x43')](_0x53a337[_0x5ac9('0x47')],_0x53a337[_0x5ac9('0x41')]);_0x514ae3[_0x5ac9('0x44')]=_['intersection'](_0x53a337[_0x5ac9('0x47')],qs[_0x5ac9('0x45')](_0x3406fc['query']['fields']));_0x514ae3['attributes']=_0x514ae3[_0x5ac9('0x44')][_0x5ac9('0x46')]?_0x514ae3[_0x5ac9('0x44')]:_0x53a337[_0x5ac9('0x47')];_0x514ae3[_0x5ac9('0x6a')]=qs[_0x5ac9('0x4b')](_0x3406fc[_0x5ac9('0x41')]['sort']);_0x514ae3[_0x5ac9('0x4f')]=qs[_0x5ac9('0x4c')](_[_0x5ac9('0x4d')](_0x3406fc[_0x5ac9('0x41')],_0x53a337[_0x5ac9('0x4c')]));if(_0x3406fc[_0x5ac9('0x41')]['filter']){_0x514ae3[_0x5ac9('0x4f')]=_['merge'](_0x514ae3[_0x5ac9('0x4f')],{'$or':_['map'](_0x514ae3[_0x5ac9('0x44')],function(_0x41cb56){var _0x2f2d32={};_0x2f2d32[_0x41cb56]={'$like':'%'+_0x3406fc['query'][_0x5ac9('0x4e')]+'%'};return _0x2f2d32;})});}_0x514ae3=_[_0x5ac9('0x51')]({},_0x514ae3,_0x3406fc[_0x5ac9('0x52')]);return _0x289e4e[_0x5ac9('0x81')](_0x514ae3);}})['then'](function(_0x28acd0){if(_0x28acd0){_0x4106a6=_0x28acd0[_0x5ac9('0x46')];if(!_0x3406fc['query']['hasOwnProperty'](_0x5ac9('0x49'))){_0x514ae3[_0x5ac9('0x4a')]=qs[_0x5ac9('0x4a')](_0x3406fc[_0x5ac9('0x41')][_0x5ac9('0x4a')]);_0x514ae3[_0x5ac9('0x2d')]=qs[_0x5ac9('0x2d')](_0x3406fc[_0x5ac9('0x41')][_0x5ac9('0x2d')]);}return _0x289e4e[_0x5ac9('0x81')](_0x514ae3);}})[_0x5ac9('0x1e')](function(_0x13bdab){if(_0x13bdab){return _0x13bdab?{'count':_0x4106a6,'rows':_0x13bdab}:null;}})[_0x5ac9('0x1e')](respondWithResult(_0x523064,null))[_0x5ac9('0x56')](handleError(_0x523064,null));};function Extension(_0x479b93,_0x1bb4ac,_0xb3a8ab,_0x5a63f1){this[_0x5ac9('0x82')]=_0x5ac9('0x83');this[_0x5ac9('0x84')]=_0x479b93[_0x5ac9('0x85')];this[_0x5ac9('0x86')]=_0x5a63f1;this[_0x5ac9('0x40')]=_0x5ac9('0x87');this[_0x5ac9('0x88')]=_0x5ac9('0x89');this['FaxAccountId']=_0x479b93['id'];this[_0x5ac9('0x8a')]=_0x1bb4ac;this['appdata']=_0xb3a8ab;}function createExtensionsReciveFax(_0x4fff47){var _0x3c6af2=0x1;var _0x405085=[];_0x405085[_0x5ac9('0x8b')](new Extension(_0x4fff47,_0x3c6af2,'',_0x5ac9('0x8c')));_0x3c6af2+=0x1;_0x405085[_0x5ac9('0x8b')](new Extension(_0x4fff47,_0x3c6af2,_0x5ac9('0x8d'),_0x5ac9('0x8e')));_0x3c6af2+=0x1;for(var _0x59c17f in _0x4fff47){if(_0x4fff47[_0x5ac9('0x48')](_0x59c17f)&&(_0x59c17f==='ecm'||_0x59c17f===_0x5ac9('0x85')||_0x59c17f===_0x5ac9('0x8f')||_0x59c17f===_0x5ac9('0x90')||_0x59c17f===_0x5ac9('0x91')||_0x59c17f===_0x5ac9('0x92')||_0x59c17f===_0x5ac9('0x93')||_0x59c17f==='modem'||_0x59c17f==='t38timeout')){_0x405085['push'](new Extension(_0x4fff47,_0x3c6af2,_0x5ac9('0x94')+_0x59c17f+')='+_0x4fff47[_0x59c17f],_0x5ac9('0x8e')));_0x3c6af2+=0x1;}}_0x405085[_0x5ac9('0x8b')](new Extension(_0x4fff47,_0x3c6af2,'6',_0x5ac9('0x95')));_0x3c6af2+=0x1;_0x405085[_0x5ac9('0x8b')](new Extension(_0x4fff47,_0x3c6af2,_0x5ac9('0x96'),'ReceiveFax'));_0x3c6af2=0x0;return _0x405085;}exports[_0x5ac9('0x97')]=function(_0x1d9edf,_0x17c934,_0x5a0021){var _0x32c9ca;return db[_0x5ac9('0x7d')]['transaction'](function(_0x445c07){return db[_0x5ac9('0x3d')][_0x5ac9('0x5b')](_0x1d9edf['body'],{'transaction':_0x445c07})[_0x5ac9('0x1e')](function(_0x3aa9fc){_0x32c9ca=_0x3aa9fc['get']({'plain':!![]});return db['VoiceExtension'][_0x5ac9('0x7f')](createExtensionsReciveFax(_0x32c9ca),{'transaction':_0x445c07});});})[_0x5ac9('0x1e')](function(){return _0x32c9ca;})[_0x5ac9('0x1e')](respondWithResult(_0x17c934,null))[_0x5ac9('0x56')](handleError(_0x17c934,null));};exports[_0x5ac9('0x98')]=function(_0x4e4001,_0x2ebc35,_0x27d359){var _0x4d8351;return db['sequelize'][_0x5ac9('0x99')](function(_0x23f0aa){return db[_0x5ac9('0x3d')]['update'](_0x4e4001['body'],{'where':{'id':_0x4e4001[_0x5ac9('0x5c')]['id']},'transaction':_0x23f0aa})[_0x5ac9('0x1e')](function(_0xc07d46){return db[_0x5ac9('0x9a')][_0x5ac9('0x33')]({'where':{'FaxAccountId':_0x4e4001[_0x5ac9('0x5c')]['id']},'transaction':_0x23f0aa})[_0x5ac9('0x1e')](function(_0x47ec49){return db[_0x5ac9('0x9a')]['bulkCreate'](createExtensionsReciveFax(_[_0x5ac9('0x72')](_0x4e4001[_0x5ac9('0x5c')],[_0x5ac9('0x9b'),'key',_0x5ac9('0x9c'),_0x5ac9('0x9d'),_0x5ac9('0x9e'),'ListId'])),{'transaction':_0x23f0aa});});});})[_0x5ac9('0x1e')](function(){return db['FaxAccount'][_0x5ac9('0x9f')](_0x4e4001[_0x5ac9('0x5c')]['id']);})['then'](respondWithResult(_0x2ebc35,null))['catch'](handleError(_0x2ebc35,null));};exports[_0x5ac9('0xa0')]=function(_0x3e944a,_0x1666d2,_0x4e6658){var _0xf99267={'raw':!![],'where':{}};var _0x23616a={};var _0x192048={'count':0x0,'rows':[]};return db['FaxAccount'][_0x5ac9('0x69')]({'where':{'id':_0x3e944a[_0x5ac9('0x58')]['id']}})[_0x5ac9('0x1e')](handleEntityNotFound(_0x1666d2,null))[_0x5ac9('0x1e')](function(_0xcc00e5){if(_0xcc00e5){_0x23616a[_0x5ac9('0x47')]=_[_0x5ac9('0x42')](db[_0x5ac9('0xa1')][_0x5ac9('0x3e')]);_0x23616a[_0x5ac9('0x41')]=_[_0x5ac9('0x42')](_0x3e944a['query']);_0x23616a[_0x5ac9('0x4c')]=_[_0x5ac9('0x43')](_0x23616a[_0x5ac9('0x47')],_0x23616a[_0x5ac9('0x41')]);_0xf99267['attributes']=_[_0x5ac9('0x43')](_0x23616a['model'],qs['fields'](_0x3e944a[_0x5ac9('0x41')][_0x5ac9('0x45')]));_0xf99267['attributes']=_0xf99267['attributes'][_0x5ac9('0x46')]?_0xf99267['attributes']:_0x23616a[_0x5ac9('0x47')];if(!_0x3e944a[_0x5ac9('0x41')]['hasOwnProperty'](_0x5ac9('0x49'))){_0xf99267[_0x5ac9('0x4a')]=qs['limit'](_0x3e944a['query'][_0x5ac9('0x4a')]);_0xf99267[_0x5ac9('0x2d')]=qs[_0x5ac9('0x2d')](_0x3e944a['query'][_0x5ac9('0x2d')]);}_0xf99267[_0x5ac9('0x6a')]=qs[_0x5ac9('0x4b')](_0x3e944a[_0x5ac9('0x41')][_0x5ac9('0x4b')]);_0xf99267[_0x5ac9('0x4f')]=qs[_0x5ac9('0x4c')](_['pick'](_0x3e944a[_0x5ac9('0x41')],_0x23616a[_0x5ac9('0x4c')]));_0xf99267['where'][_0x5ac9('0x67')]=_0xcc00e5['id'];if(_0x3e944a['query'][_0x5ac9('0x4e')]){_0xf99267[_0x5ac9('0x4f')]=_[_0x5ac9('0x51')](_0xf99267['where'],{'$or':_[_0x5ac9('0x3c')](_0xf99267[_0x5ac9('0x44')],function(_0x48e08c){var _0x1c9b40={};_0x1c9b40[_0x48e08c]={'$like':'%'+_0x3e944a[_0x5ac9('0x41')][_0x5ac9('0x4e')]+'%'};return _0x1c9b40;})});}if(_0x3e944a[_0x5ac9('0x41')][_0x5ac9('0xa2')]){var _0x416143=_0x3e944a[_0x5ac9('0x41')]['$gte'][_0x5ac9('0xa3')](',');var _0x155da2={};_0x155da2[_0x416143[0x0]]={'$gte':moment(_0x416143[0x1])[_0x5ac9('0xa4')](_0x5ac9('0xa5'))};_0xf99267[_0x5ac9('0x4f')]=_['merge'](_0xf99267[_0x5ac9('0x4f')],_0x155da2);}_0xf99267=_[_0x5ac9('0x51')]({},_0xf99267,_0x3e944a[_0x5ac9('0x52')]);return db[_0x5ac9('0xa1')][_0x5ac9('0x2c')]({'where':_0xf99267[_0x5ac9('0x4f')]})['then'](function(_0x4bf10e){_0x192048['count']=_0x4bf10e;if(_0x3e944a[_0x5ac9('0x41')][_0x5ac9('0x59')]){_0xf99267[_0x5ac9('0x53')]=[{'all':!![]}];}return db[_0x5ac9('0xa1')]['findAll'](_0xf99267);})['then'](function(_0x533bb5){_0x192048['rows']=_0x533bb5;return _0x192048;});}})[_0x5ac9('0x1e')](respondWithFilteredResult(_0x1666d2,_0xf99267))['catch'](handleError(_0x1666d2,null));};exports[_0x5ac9('0x38')]=function(_0x13d9c5,_0x392bfa,_0x219f6c){var _0xb34d75,_0x3fc0a1={},_0x1cbfce;if(_0x13d9c5['body']['to']){_0x1cbfce=_0x13d9c5[_0x5ac9('0x5c')]['to'][0x0];}return db[_0x5ac9('0x3d')]['find']({'where':{'id':_0x13d9c5[_0x5ac9('0x58')]['id']},'include':[{'model':db[_0x5ac9('0xa6')],'as':_0x5ac9('0xa7'),'include':[{'model':db[_0x5ac9('0x73')],'as':_0x5ac9('0xa8'),'where':{'fax':_0x1cbfce},'limit':0x1,'order':[['updatedAt',_0x5ac9('0xa9')]]}]}]})[_0x5ac9('0x1e')](handleEntityNotFound(_0x392bfa,null))[_0x5ac9('0x1e')](function(_0x5f1e40){_0xb34d75=_0x5f1e40;if(_0x13d9c5[_0x5ac9('0x5c')][_0x5ac9('0xaa')]&&_0x13d9c5[_0x5ac9('0x5c')][_0x5ac9('0xaa')][_0x5ac9('0x46')]){for(var _0x5b24eb=0x0;_0x5b24eb<_0x13d9c5[_0x5ac9('0x5c')][_0x5ac9('0xaa')][_0x5ac9('0x46')];_0x5b24eb+=0x1){_0x13d9c5['body']['attachments'][_0x5b24eb]={'filename':_0x13d9c5[_0x5ac9('0x5c')][_0x5ac9('0xaa')][_0x5b24eb][_0x5ac9('0x37')],'id':_0x13d9c5[_0x5ac9('0x5c')][_0x5ac9('0xaa')][_0x5b24eb]['id'],'path':path[_0x5ac9('0xab')](config[_0x5ac9('0xac')],_0x5ac9('0xad'),_0x13d9c5['body'][_0x5ac9('0xaa')][_0x5b24eb]['basename'])};}}return respondWithRpcPromise(_0x5ac9('0xae'),_0x5ac9('0xae'),{'FaxAccountId':_[_0x5ac9('0xaf')](_0x13d9c5[_0x5ac9('0x58')]['id'])?undefined:_0x13d9c5['params']['id'],'path':_[_0x5ac9('0xaf')](_0x13d9c5['body'][_0x5ac9('0xaa')][0x0][_0x5ac9('0x7')])?undefined:_0x13d9c5['body'][_0x5ac9('0xaa')][0x0][_0x5ac9('0x7')],'fax':_[_0x5ac9('0xaf')](_0x13d9c5[_0x5ac9('0x5c')]['to'][0x0])?undefined:_0x13d9c5[_0x5ac9('0x5c')]['to'][0x0]},client9002);})[_0x5ac9('0x1e')](function(){if(_0xb34d75){if(_[_0x5ac9('0xaf')](_0x13d9c5[_0x5ac9('0x5c')][_0x5ac9('0xb0')])){_0x13d9c5[_0x5ac9('0x5c')]['from']=util[_0x5ac9('0xa4')](_0x5ac9('0xb1'),_0xb34d75[_0x5ac9('0x37')],_0xb34d75['fax']);}if(_0xb34d75[_0x5ac9('0xa7')]){if(_0xb34d75[_0x5ac9('0xa7')]['Contacts'][_0x5ac9('0x46')]){return _0xb34d75[_0x5ac9('0xa7')][_0x5ac9('0xa8')][0x0];}else{return db[_0x5ac9('0x73')][_0x5ac9('0x5b')](_[_0x5ac9('0x17')](_0x13d9c5[_0x5ac9('0x5c')],{'firstName':_0x13d9c5[_0x5ac9('0x5c')]['to'][0x0],'phone':_0x13d9c5['body']['to'][0x0],'fax':_0x13d9c5[_0x5ac9('0x5c')]['to'][0x0],'ListId':_0xb34d75['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error('Send\x20Fax\x20failed');}})[_0x5ac9('0x1e')](function(_0x35cfc4){if(_0x35cfc4){return db[_0x5ac9('0x71')][_0x5ac9('0x5a')]({'where':{'ContactId':_0x35cfc4['id'],'closed':![],'FaxAccountId':_0xb34d75['id']}})['then'](function(_0x4dc02a){if(_0x4dc02a){return[_0x4dc02a,![]];}return db[_0x5ac9('0x71')][_0x5ac9('0x5b')]({'UserId':_0x13d9c5['user']['id'],'ContactId':_0x35cfc4['id'],'FaxAccountId':_0xb34d75['id'],'fax':_0x13d9c5[_0x5ac9('0x5c')]['to'][0x0],'firstMsgDirection':_0x5ac9('0xb2'),'Messages':[_[_0x5ac9('0x51')](_0x13d9c5[_0x5ac9('0x5c')],{'read':![],'body':_0x13d9c5[_0x5ac9('0x5c')][_0x5ac9('0xaa')][0x0][_0x5ac9('0xb3')],'FaxAccountId':_0xb34d75['id'],'UserId':_0x13d9c5[_0x5ac9('0x5f')]['id'],'ContactId':_0x35cfc4['id'],'AttachmentId':_0x13d9c5[_0x5ac9('0x5c')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x5ac9('0xa1')],'as':_0x5ac9('0xb4')}]})[_0x5ac9('0x1e')](function(_0x49e071){return[_0x49e071,!![]];});});}else{throw new Error(_0x5ac9('0xb5'));}})[_0x5ac9('0xb6')](function(_0x2da489,_0x152b61){if(_0x152b61){return _0x2da489;}return db[_0x5ac9('0xa1')][_0x5ac9('0x5b')]({'direction':_0x5ac9('0xb2'),'read':![],'body':_0x13d9c5[_0x5ac9('0x5c')]['attachments'][0x0]['filename'],'FaxAccountId':_0xb34d75['id'],'FaxInteractionId':_0x2da489['id'],'UserId':_0x13d9c5[_0x5ac9('0x5f')]['id'],'ContactId':_0x2da489['ContactId'],'AttachmentId':_0x13d9c5[_0x5ac9('0x5c')][_0x5ac9('0xaa')][0x0]['id']})[_0x5ac9('0x1e')](function(_0x3136a8){_0x2da489[_0x5ac9('0xb7')][_0x5ac9('0xb4')]=[];_0x2da489[_0x5ac9('0xb7')][_0x5ac9('0xb4')]['push'](_0x3136a8['dataValues']);return _0x2da489;});})['then'](function(_0x10824b){respondWithRpcPromise(_0x5ac9('0xb8'),_0x5ac9('0xb8'),{'FaxAccountId':_['isNil'](_0x13d9c5[_0x5ac9('0x58')]['id'])?undefined:_0x13d9c5[_0x5ac9('0x58')]['id'],'path':_['isNil'](_0x13d9c5[_0x5ac9('0x5c')][_0x5ac9('0xaa')][0x0][_0x5ac9('0x7')])?undefined:_0x13d9c5['body'][_0x5ac9('0xaa')][0x0][_0x5ac9('0x7')],'fax':_[_0x5ac9('0xaf')](_0x13d9c5['body']['to'][0x0])?undefined:_0x13d9c5[_0x5ac9('0x5c')]['to'][0x0],'AttachmentId':_0x13d9c5[_0x5ac9('0x5c')][_0x5ac9('0xaa')][0x0]['id']},client9002)[_0x5ac9('0x1e')](function(_0xcf2b18){logger[_0x5ac9('0x1f')]('SendFaxRpc,\x20%s',_0xcf2b18);})[_0x5ac9('0x56')](function(_0x2b5c0b){logger[_0x5ac9('0x1f')]('SendFaxRpc,\x20%s',_0x2b5c0b);});return _0x10824b;})[_0x5ac9('0x1e')](respondWithResult(_0x392bfa,null))[_0x5ac9('0x56')](handleError(_0x392bfa,null));};exports[_0x5ac9('0xb9')]=function(_0x105dde,_0x16906a,_0x4b570a){return db[_0x5ac9('0x3d')]['find']({'where':{'id':_0x105dde['params']['id']}})[_0x5ac9('0x1e')](handleEntityNotFound(_0x16906a,null))['then'](function(_0x3858e7){if(_0x3858e7){return _0x3858e7[_0x5ac9('0xb9')](_0x105dde[_0x5ac9('0x5c')][_0x5ac9('0x6b')],_['omit'](_0x105dde[_0x5ac9('0x5c')],['ids','id'])||{})['spread'](function(_0x5b29e6){for(var _0x55d06e=0x0;_0x55d06e<_0x105dde['body']['ids'][_0x5ac9('0x46')];_0x55d06e+=0x1){socket['emit'](_0x5ac9('0xba'),{'UserId':_0x105dde[_0x5ac9('0x5c')][_0x5ac9('0x6b')][_0x55d06e],'FaxAccountId':_0x105dde['params']['id']});}return _0x5b29e6;});}})[_0x5ac9('0x1e')](respondWithResult(_0x16906a,null))['catch'](handleError(_0x16906a,null));};exports['removeAgents']=function(_0x3e9d18,_0x2bd830,_0x1e0761){return db[_0x5ac9('0x3d')][_0x5ac9('0x5a')]({'where':{'id':_0x3e9d18[_0x5ac9('0x58')]['id']}})['then'](handleEntityNotFound(_0x2bd830,null))[_0x5ac9('0x1e')](function(_0xdabe01){if(_0xdabe01){return _0xdabe01[_0x5ac9('0xbb')](_0x3e9d18[_0x5ac9('0x41')][_0x5ac9('0x6b')])[_0x5ac9('0x1e')](function(){if(_[_0x5ac9('0xbc')](_0x3e9d18[_0x5ac9('0x41')][_0x5ac9('0x6b')])){for(var _0x78c78=0x0;_0x78c78<_0x3e9d18[_0x5ac9('0x41')][_0x5ac9('0x6b')][_0x5ac9('0x46')];_0x78c78+=0x1){socket[_0x5ac9('0xbd')](_0x5ac9('0xbe'),{'UserId':Number(_0x3e9d18[_0x5ac9('0x41')][_0x5ac9('0x6b')][_0x78c78]),'FaxAccountId':Number(_0x3e9d18[_0x5ac9('0x58')]['id'])});}}else{socket[_0x5ac9('0xbd')]('userFaxAccount:remove',{'UserId':Number(_0x3e9d18[_0x5ac9('0x41')]['ids']),'FaxAccountId':Number(_0x3e9d18[_0x5ac9('0x58')]['id'])});}});}})[_0x5ac9('0x1e')](respondWithStatusCode(_0x2bd830,null))['catch'](handleError(_0x2bd830,null));};exports[_0x5ac9('0xbf')]=function(_0x39c4c0,_0x2afd11,_0x432f0f){var _0x772a2c={};var _0x59762b={};var _0x571b4b;var _0x516a5a;return db[_0x5ac9('0x3d')][_0x5ac9('0x69')]({'where':{'id':_0x39c4c0[_0x5ac9('0x58')]['id']}})[_0x5ac9('0x1e')](handleEntityNotFound(_0x2afd11,null))[_0x5ac9('0x1e')](function(_0x513ecc){if(_0x513ecc){_0x571b4b=_0x513ecc;_0x59762b[_0x5ac9('0x47')]=_[_0x5ac9('0x42')](db[_0x5ac9('0x75')][_0x5ac9('0x3e')]);_0x59762b[_0x5ac9('0x41')]=_[_0x5ac9('0x42')](_0x39c4c0['query']);_0x59762b[_0x5ac9('0x4c')]=_[_0x5ac9('0x43')](_0x59762b[_0x5ac9('0x47')],_0x59762b['query']);_0x772a2c[_0x5ac9('0x44')]=_[_0x5ac9('0x43')](_0x59762b[_0x5ac9('0x47')],qs[_0x5ac9('0x45')](_0x39c4c0[_0x5ac9('0x41')]['fields']));_0x772a2c[_0x5ac9('0x44')]=_0x772a2c[_0x5ac9('0x44')]['length']?_0x772a2c[_0x5ac9('0x44')]:_0x59762b[_0x5ac9('0x47')];_0x772a2c[_0x5ac9('0x6a')]=qs['sort'](_0x39c4c0[_0x5ac9('0x41')][_0x5ac9('0x4b')]);_0x772a2c[_0x5ac9('0x4f')]=qs[_0x5ac9('0x4c')](_[_0x5ac9('0x4d')](_0x39c4c0[_0x5ac9('0x41')],_0x59762b[_0x5ac9('0x4c')]));if(_0x39c4c0[_0x5ac9('0x41')]['filter']){_0x772a2c[_0x5ac9('0x4f')]=_[_0x5ac9('0x51')](_0x772a2c['where'],{'$or':_['map'](_0x772a2c['attributes'],function(_0x413ada){var _0xecbb0a={};_0xecbb0a[_0x413ada]={'$like':'%'+_0x39c4c0[_0x5ac9('0x41')][_0x5ac9('0x4e')]+'%'};return _0xecbb0a;})});}_0x772a2c=_[_0x5ac9('0x51')]({},_0x772a2c,_0x39c4c0[_0x5ac9('0x52')]);return _0x571b4b[_0x5ac9('0xbf')](_0x772a2c);}})[_0x5ac9('0x1e')](function(_0x4b02cd){if(_0x4b02cd){_0x516a5a=_0x4b02cd[_0x5ac9('0x46')];if(!_0x39c4c0[_0x5ac9('0x41')][_0x5ac9('0x48')](_0x5ac9('0x49'))){_0x772a2c['limit']=qs[_0x5ac9('0x4a')](_0x39c4c0[_0x5ac9('0x41')][_0x5ac9('0x4a')]);_0x772a2c[_0x5ac9('0x2d')]=qs[_0x5ac9('0x2d')](_0x39c4c0[_0x5ac9('0x41')][_0x5ac9('0x2d')]);}return _0x571b4b['getAgents'](_0x772a2c);}})[_0x5ac9('0x1e')](function(_0x33e4c9){if(_0x33e4c9){return _0x33e4c9?{'count':_0x516a5a,'rows':_0x33e4c9}:null;}})[_0x5ac9('0x1e')](respondWithResult(_0x2afd11,null))['catch'](handleError(_0x2afd11,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index ad8d77f..9a6137d 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 _0xc50a=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x50a8b5,_0x4ec57f){var _0x55a34d=function(_0x133adb){while(--_0x133adb){_0x50a8b5['push'](_0x50a8b5['shift']());}};_0x55a34d(++_0x4ec57f);}(_0xc50a,0x1ce));var _0xac50=function(_0x59396d,_0xb75b8a){_0x59396d=_0x59396d-0x0;var _0x44466c=_0xc50a[_0x59396d];return _0x44466c;};'use strict';var EventEmitter=require(_0xac50('0x0'));var FaxAccount=require(_0xac50('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xac50('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xac50('0x3'),'afterDestroy':_0xac50('0x4')};function emitEvent(_0x9e0f9){return function(_0x491506,_0x1a560e,_0x1c0838){FaxAccountEvents[_0xac50('0x5')](_0x9e0f9+':'+_0x491506['id'],_0x491506);FaxAccountEvents[_0xac50('0x5')](_0x9e0f9,_0x491506);_0x1c0838(null);};}for(var e in events){if(events[_0xac50('0x6')](e)){var event=events[e];FaxAccount[_0xac50('0x7')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xa12b=['hook','exports','FaxAccount','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x1e4444,_0x9345c9){var _0x58d0e2=function(_0x23ff03){while(--_0x23ff03){_0x1e4444['push'](_0x1e4444['shift']());}};_0x58d0e2(++_0x9345c9);}(_0xa12b,0x1ea));var _0xba12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa12b[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db'][_0xba12('0x0')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xba12('0x1')](0x0);var events={'afterCreate':_0xba12('0x2'),'afterUpdate':_0xba12('0x3'),'afterDestroy':'remove'};function emitEvent(_0x380f81){return function(_0x3c7641,_0x1e6288,_0x37cb58){FaxAccountEvents[_0xba12('0x4')](_0x380f81+':'+_0x3c7641['id'],_0x3c7641);FaxAccountEvents[_0xba12('0x4')](_0x380f81,_0x3c7641);_0x37cb58(null);};}for(var e in events){if(events[_0xba12('0x5')](e)){var event=events[e];FaxAccount[_0xba12('0x6')](e,emitEvent(event));}}module[_0xba12('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index bda67d3..823a205 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 _0xf863=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts'];(function(_0x1a4a06,_0x36a5c2){var _0x49ec08=function(_0x497f24){while(--_0x497f24){_0x1a4a06['push'](_0x1a4a06['shift']());}};_0x49ec08(++_0x36a5c2);}(_0xf863,0xe0));var _0x3f86=function(_0x687203,_0x36c373){_0x687203=_0x687203-0x0;var _0x348d96=_0xf863[_0x687203];return _0x348d96;};'use strict';var _=require(_0x3f86('0x0'));var util=require(_0x3f86('0x1'));var logger=require(_0x3f86('0x2'))(_0x3f86('0x3'));var moment=require(_0x3f86('0x4'));var BPromise=require(_0x3f86('0x5'));var rp=require(_0x3f86('0x6'));var fs=require('fs');var path=require(_0x3f86('0x7'));var rimraf=require('rimraf');var config=require(_0x3f86('0x8'));var attributes=require(_0x3f86('0x9'));module[_0x3f86('0xa')]=function(_0x40ecf4,_0x29fc5d){return _0x40ecf4[_0x3f86('0xb')](_0x3f86('0xc'),attributes,{'tableName':_0x3f86('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1033=['api','request-promise','path','rimraf','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash'];(function(_0x590b63,_0x14debb){var _0x3c9380=function(_0x58fc67){while(--_0x58fc67){_0x590b63['push'](_0x590b63['shift']());}};_0x3c9380(++_0x14debb);}(_0x1033,0x77));var _0x3103=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0x1033[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0x3103('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3103('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3103('0x2'));var fs=require('fs');var path=require(_0x3103('0x3'));var rimraf=require(_0x3103('0x4'));var config=require('../../config/environment');var attributes=require(_0x3103('0x5'));module[_0x3103('0x6')]=function(_0xeb0ba9,_0x23be5e){return _0xeb0ba9[_0x3103('0x7')](_0x3103('0x8'),attributes,{'tableName':_0x3103('0x9'),'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 c826683..17eb16e 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 _0xe0ad=['User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./faxAccount.socket','then','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','result','catch','GetFaxAccount','findAll','options','raw','limit','include','map','model','attributes','stringify','NotifyFaxAccount','describe','ValidationError','difference','createdAt','updatedAt','keys','CompanyId','ListId','body','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','List','Contacts','DESC','FaxApplication','get','account','applications','Applications','list','orderBy','length','CmContact','fax','FaxInteraction','create','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId'];(function(_0x470f63,_0x48d80b){var _0x4f09e2=function(_0x3aa3a4){while(--_0x3aa3a4){_0x470f63['push'](_0x470f63['shift']());}};_0x4f09e2(++_0x48d80b);}(_0xe0ad,0x10b));var _0xde0a=function(_0x359a69,_0x1acd37){_0x359a69=_0x359a69-0x0;var _0x1547d8=_0xe0ad[_0x359a69];return _0x1547d8;};'use strict';var _=require(_0xde0a('0x0'));var util=require(_0xde0a('0x1'));var moment=require('moment');var BPromise=require(_0xde0a('0x2'));var rs=require(_0xde0a('0x3'));var fs=require('fs');var Redis=require(_0xde0a('0x4'));var db=require(_0xde0a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xde0a('0x6'));var config=require(_0xde0a('0x7'));var jayson=require(_0xde0a('0x8'));var client=jayson[_0xde0a('0x9')][_0xde0a('0xa')]({'port':0x232c});config[_0xde0a('0xb')]=_[_0xde0a('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xde0a('0xb')]));require(_0xde0a('0xd'))['register'](socket);function respondWithRpcPromise(_0x1b8a51,_0x16df01,_0x4f88b4){return new BPromise(function(_0x892380,_0x1d61a4){return client['request'](_0x1b8a51,_0x4f88b4)[_0xde0a('0xe')](function(_0x1afb1e){logger['info'](_0xde0a('0xf'),_0x16df01,'request\x20sent');logger[_0xde0a('0x10')](_0xde0a('0x11'),_0x16df01,'request\x20sent',JSON['stringify'](_0x1afb1e));if(_0x1afb1e['error']){if(_0x1afb1e['error']['code']===0x1f4){logger['error'](_0xde0a('0xf'),_0x16df01,_0x1afb1e[_0xde0a('0x12')][_0xde0a('0x13')]);return _0x1d61a4(_0x1afb1e[_0xde0a('0x12')][_0xde0a('0x13')]);}logger[_0xde0a('0x12')](_0xde0a('0xf'),_0x16df01,_0x1afb1e[_0xde0a('0x12')][_0xde0a('0x13')]);return _0x892380(_0x1afb1e[_0xde0a('0x12')][_0xde0a('0x13')]);}else{logger[_0xde0a('0x14')]('FaxAccount,\x20%s,\x20%s',_0x16df01,_0xde0a('0x15'));_0x892380(_0x1afb1e[_0xde0a('0x16')][_0xde0a('0x13')]);}})[_0xde0a('0x17')](function(_0x4759c3){logger['error'](_0xde0a('0xf'),_0x16df01,_0x4759c3);_0x1d61a4(_0x4759c3);});});}exports[_0xde0a('0x18')]=function(_0x39781d){var _0x21d789=this;return new Promise(function(_0x1c5cc7,_0x2013e2){return db['FaxAccount'][_0xde0a('0x19')]({'raw':_0x39781d[_0xde0a('0x1a')]?_0x39781d['options'][_0xde0a('0x1b')]===undefined?!![]:![]:!![],'where':_0x39781d['options']?_0x39781d[_0xde0a('0x1a')]['where']||null:null,'attributes':_0x39781d[_0xde0a('0x1a')]?_0x39781d[_0xde0a('0x1a')]['attributes']||null:null,'limit':_0x39781d[_0xde0a('0x1a')]?_0x39781d[_0xde0a('0x1a')][_0xde0a('0x1c')]||null:null,'include':_0x39781d[_0xde0a('0x1a')]?_0x39781d[_0xde0a('0x1a')][_0xde0a('0x1d')]?_[_0xde0a('0x1e')](_0x39781d[_0xde0a('0x1a')][_0xde0a('0x1d')],function(_0x3b66fc){return{'model':db[_0x3b66fc[_0xde0a('0x1f')]],'as':_0x3b66fc['as'],'attributes':_0x3b66fc[_0xde0a('0x20')],'include':_0x3b66fc['include']?_['map'](_0x3b66fc[_0xde0a('0x1d')],function(_0xa3be12){return{'model':db[_0xa3be12['model']],'as':_0xa3be12['as'],'attributes':_0xa3be12['attributes'],'include':_0xa3be12['include']?_[_0xde0a('0x1e')](_0xa3be12[_0xde0a('0x1d')],function(_0x56f7b4){return{'model':db[_0x56f7b4['model']],'as':_0x56f7b4['as'],'attributes':_0x56f7b4['attributes']};}):[]};}):[]};}):[]:[]})[_0xde0a('0xe')](function(_0x2fb5e7){logger['info'](_0xde0a('0x18'),_0x39781d);logger[_0xde0a('0x10')]('GetFaxAccount',_0x39781d,JSON[_0xde0a('0x21')](_0x2fb5e7));_0x1c5cc7(_0x2fb5e7);})[_0xde0a('0x17')](function(_0x39cf12){logger[_0xde0a('0x12')](_0xde0a('0x18'),_0x39cf12[_0xde0a('0x13')],_0x39781d);_0x2013e2(_0x21d789[_0xde0a('0x12')](0x1f4,_0x39cf12['message']));});});};exports[_0xde0a('0x22')]=function(_0x39b552,_0x26f3c5,_0x5416b4){var _0x14c6a2=this;return new Promise(function(_0x2edece,_0x5ae627){var _0x1f5b45={'body':_0x39b552['body'],'channel':'fax'};var _0x3e573d=[];var _0xa2dabf=[];var _0x994f49={};return db['CmContact'][_0xde0a('0x23')]()['then'](function(_0x1db304){if(!_0x1db304){throw new db['Sequelize'][(_0xde0a('0x24'))]('no\x20available\x20attributes');}_0x3e573d=_[_0xde0a('0x25')](_['keys'](_0x1db304),[_0xde0a('0x26'),_0xde0a('0x27')]);_0xa2dabf=_['difference'](_[_0xde0a('0x28')](_0x1db304),[_0xde0a('0x26'),_0xde0a('0x27'),_0xde0a('0x29'),_0xde0a('0x2a')]);if(_0x39b552[_0xde0a('0x2b')]['id']){delete _0x39b552[_0xde0a('0x2b')]['id'];}if(_[_0xde0a('0x2c')](_0x39b552[_0xde0a('0x2b')][_0xde0a('0x2d')])){throw new db[(_0xde0a('0x2e'))]['ValidationError'](_0xde0a('0x2f'));}if(_[_0xde0a('0x2c')](_0x39b552['body'][_0xde0a('0x2b')])||_0x39b552[_0xde0a('0x2b')][_0xde0a('0x2b')]===''){throw new db[(_0xde0a('0x2e'))][(_0xde0a('0x24'))](_0xde0a('0x30'));}if(_[_0xde0a('0x2c')](_0x39b552[_0xde0a('0x2b')]['mapKey'])){throw new db[(_0xde0a('0x2e'))]['ValidationError'](_0xde0a('0x31')+_0xa2dabf);}if(!_[_0xde0a('0x32')](_0xa2dabf,_0x39b552[_0xde0a('0x2b')][_0xde0a('0x33')])){throw new db['Sequelize'][(_0xde0a('0x24'))](_0xde0a('0x34')+_0xa2dabf);}_0x994f49[_0x39b552[_0xde0a('0x2b')][_0xde0a('0x33')]]=_0x39b552['body'][_0xde0a('0x2d')];})[_0xde0a('0xe')](function(){return db[_0xde0a('0x35')]['find']({'where':{'id':_0x39b552['account']['id']},'include':[{'model':db['CmList'],'as':_0xde0a('0x36'),'include':[{'model':db['CmContact'],'as':_0xde0a('0x37'),'where':_0x994f49,'limit':0x1,'order':[['updatedAt',_0xde0a('0x38')]]}]},{'model':db[_0xde0a('0x39')],'as':'Applications'}]});})[_0xde0a('0xe')](function(_0x256d45){if(_0x256d45&&_0x256d45[_0xde0a('0x36')]){var _0x366a08=_0x256d45[_0xde0a('0x3a')]({'plain':!![]});_0x1f5b45[_0xde0a('0x3b')]=_0x366a08;_0x1f5b45[_0xde0a('0x3c')]=_0x366a08[_0xde0a('0x3d')];_0x1f5b45[_0xde0a('0x3e')]=_0x366a08[_0xde0a('0x36')];_0x1f5b45[_0xde0a('0x3c')]=_[_0xde0a('0x3f')](_0x1f5b45[_0xde0a('0x3c')],['priority'],['asc']);if(_0x1f5b45[_0xde0a('0x3b')][_0xde0a('0x3d')]){delete _0x1f5b45[_0xde0a('0x3b')][_0xde0a('0x3d')];}if(_0x1f5b45[_0xde0a('0x3b')][_0xde0a('0x36')]&&_0x1f5b45[_0xde0a('0x3b')][_0xde0a('0x36')][_0xde0a('0x37')][_0xde0a('0x40')]){return _0x1f5b45['account'][_0xde0a('0x36')][_0xde0a('0x37')][0x0];}var _0x477dbc=_[_0xde0a('0xc')](_0x39b552['body'],{'firstName':_0x39b552['body'][_0xde0a('0x2d')],'ListId':_0x366a08[_0xde0a('0x2a')]});_0x477dbc[_0x39b552['body'][_0xde0a('0x33')]]=_0x39b552[_0xde0a('0x2b')][_0xde0a('0x2d')];return db[_0xde0a('0x41')]['create'](_0x477dbc,{'fields':_0x3e573d,'raw':!![]});}})[_0xde0a('0xe')](function(_0x2b370b){_0x1f5b45['contact']=_0x2b370b;if(_0x2b370b){var _0x46e837={'ContactId':_0x2b370b['id'],'FaxAccountId':_0x39b552[_0xde0a('0x3b')]['id'],'fax':_0x2b370b[_0xde0a('0x42')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x2b370b['id'],'closed':![],'FaxAccountId':_0x39b552[_0xde0a('0x3b')]['id']}})[_0xde0a('0xe')](function(_0x1e107d){if(_0x1e107d){return[_0x1e107d,![]];}return db[_0xde0a('0x43')][_0xde0a('0x44')](_0x46e837)[_0xde0a('0xe')](function(_0x40134c){return[_0x40134c,!![]];});});}else{throw new Error(_0xde0a('0x45'));}})[_0xde0a('0x46')](function(_0x5cd8ee,_0x153954){var _0xc7c02f=_0x5cd8ee[_0xde0a('0x3a')]({'plain':!![]});if(_0x153954){if(_0x1f5b45['account'][_0xde0a('0x47')]){_0x1f5b45['applications'][_0xde0a('0x48')]({'id':0x0,'priority':_0x1f5b45['applications'][_0xde0a('0x40')]+0x1,'app':_0xde0a('0x49'),'appdata':_0xde0a('0x4a'),'interval':_0xde0a('0x4b')});}_0xc7c02f[_0xde0a('0x4c')]=!![];}else{_0xc7c02f[_0xde0a('0x4c')]=![];}_0x1f5b45[_0xde0a('0x4d')]=_0xc7c02f;return db['FaxMessage'][_0xde0a('0x44')]({'body':_0x39b552['body']['body'],'FaxAccountId':_0x39b552['account']['id'],'FaxInteractionId':_0x5cd8ee['id'],'direction':'in','ContactId':_0x5cd8ee[_0xde0a('0x4e')],'AttachmentId':_0x39b552[_0xde0a('0x2b')][_0xde0a('0x4f')]});})['then'](function(_0x596c3b){_0x1f5b45['message']=_0x596c3b;if(_0x1f5b45[_0xde0a('0x4d')][_0xde0a('0x50')]){return db[_0xde0a('0x51')]['find']({'attributes':['id',_0xde0a('0x52')],'where':{'id':_0x1f5b45[_0xde0a('0x4d')][_0xde0a('0x50')]}})[_0xde0a('0xe')](function(_0x563052){if(_0x563052){_0x1f5b45[_0xde0a('0x3c')]['unshift']({'id':0x0,'priority':0x0,'app':_0xde0a('0x53'),'appdata':_0x563052[_0xde0a('0x52')]+','+(_0x1f5b45[_0xde0a('0x3b')][_0xde0a('0x54')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xde0a('0x55'),_0xde0a('0x56'),_0x1f5b45);});}return respondWithRpcPromise('Start',_0xde0a('0x56'),_0x1f5b45);})[_0xde0a('0xe')](function(_0x415642){_0x2edece(_0x415642);})[_0xde0a('0x17')](function(_0x3f9596){_0x5ae627(_0x14c6a2[_0xde0a('0x12')](0x1f4,_0x3f9596['message']));});});}; \ No newline at end of file +var _0x5b37=['CmList','List','Contacts','FaxApplication','Applications','applications','list','orderBy','asc','create','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','length','close','unmanaged','*,*,*,*','created','interaction','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','from','find','account'];(function(_0x17999b,_0x1620ba){var _0x2bdcfc=function(_0x580637){while(--_0x580637){_0x17999b['push'](_0x17999b['shift']());}};_0x2bdcfc(++_0x1620ba);}(_0x5b37,0x1cb));var _0x75b3=function(_0x6aaa69,_0x4457b5){_0x6aaa69=_0x6aaa69-0x0;var _0x25359f=_0x5b37[_0x6aaa69];return _0x25359f;};'use strict';var _=require(_0x75b3('0x0'));var util=require('util');var moment=require(_0x75b3('0x1'));var BPromise=require(_0x75b3('0x2'));var rs=require(_0x75b3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x75b3('0x4'))['db'];var utils=require(_0x75b3('0x5'));var logger=require(_0x75b3('0x6'))('rpc');var config=require(_0x75b3('0x7'));var jayson=require(_0x75b3('0x8'));var client=jayson[_0x75b3('0x9')][_0x75b3('0xa')]({'port':0x232c});config[_0x75b3('0xb')]=_[_0x75b3('0xc')](config[_0x75b3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x75b3('0xd'))(new Redis(config['redis']));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x522d6d,_0x4a19ee,_0xb1b7d6){return new BPromise(function(_0x5a26ba,_0x3eca58){return client[_0x75b3('0xe')](_0x522d6d,_0xb1b7d6)[_0x75b3('0xf')](function(_0x3fde3f){logger['info'](_0x75b3('0x10'),_0x4a19ee,_0x75b3('0x11'));logger[_0x75b3('0x12')](_0x75b3('0x13'),_0x4a19ee,_0x75b3('0x11'),JSON[_0x75b3('0x14')](_0x3fde3f));if(_0x3fde3f[_0x75b3('0x15')]){if(_0x3fde3f[_0x75b3('0x15')]['code']===0x1f4){logger[_0x75b3('0x15')](_0x75b3('0x10'),_0x4a19ee,_0x3fde3f[_0x75b3('0x15')][_0x75b3('0x16')]);return _0x3eca58(_0x3fde3f[_0x75b3('0x15')][_0x75b3('0x16')]);}logger[_0x75b3('0x15')](_0x75b3('0x10'),_0x4a19ee,_0x3fde3f[_0x75b3('0x15')][_0x75b3('0x16')]);return _0x5a26ba(_0x3fde3f['error'][_0x75b3('0x16')]);}else{logger[_0x75b3('0x17')](_0x75b3('0x10'),_0x4a19ee,_0x75b3('0x11'));_0x5a26ba(_0x3fde3f['result']['message']);}})[_0x75b3('0x18')](function(_0x367ac4){logger[_0x75b3('0x15')]('FaxAccount,\x20%s,\x20%s',_0x4a19ee,_0x367ac4);_0x3eca58(_0x367ac4);});});}exports[_0x75b3('0x19')]=function(_0x3476b3){var _0x1e37bb=this;return new Promise(function(_0x2f234c,_0x1e0f87){return db[_0x75b3('0x1a')][_0x75b3('0x1b')]({'raw':_0x3476b3[_0x75b3('0x1c')]?_0x3476b3[_0x75b3('0x1c')][_0x75b3('0x1d')]===undefined?!![]:![]:!![],'where':_0x3476b3[_0x75b3('0x1c')]?_0x3476b3['options'][_0x75b3('0x1e')]||null:null,'attributes':_0x3476b3['options']?_0x3476b3[_0x75b3('0x1c')][_0x75b3('0x1f')]||null:null,'limit':_0x3476b3['options']?_0x3476b3[_0x75b3('0x1c')][_0x75b3('0x20')]||null:null,'include':_0x3476b3[_0x75b3('0x1c')]?_0x3476b3[_0x75b3('0x1c')][_0x75b3('0x21')]?_[_0x75b3('0x22')](_0x3476b3[_0x75b3('0x1c')][_0x75b3('0x21')],function(_0x1f6056){return{'model':db[_0x1f6056[_0x75b3('0x23')]],'as':_0x1f6056['as'],'attributes':_0x1f6056['attributes'],'include':_0x1f6056[_0x75b3('0x21')]?_[_0x75b3('0x22')](_0x1f6056[_0x75b3('0x21')],function(_0x5c268a){return{'model':db[_0x5c268a[_0x75b3('0x23')]],'as':_0x5c268a['as'],'attributes':_0x5c268a[_0x75b3('0x1f')],'include':_0x5c268a[_0x75b3('0x21')]?_[_0x75b3('0x22')](_0x5c268a[_0x75b3('0x21')],function(_0x2f22cc){return{'model':db[_0x2f22cc[_0x75b3('0x23')]],'as':_0x2f22cc['as'],'attributes':_0x2f22cc['attributes']};}):[]};}):[]};}):[]:[]})[_0x75b3('0xf')](function(_0x19712c){logger['info'](_0x75b3('0x19'),_0x3476b3);logger[_0x75b3('0x12')](_0x75b3('0x19'),_0x3476b3,JSON[_0x75b3('0x14')](_0x19712c));_0x2f234c(_0x19712c);})[_0x75b3('0x18')](function(_0x3404dc){logger[_0x75b3('0x15')](_0x75b3('0x19'),_0x3404dc[_0x75b3('0x16')],_0x3476b3);_0x1e0f87(_0x1e37bb[_0x75b3('0x15')](0x1f4,_0x3404dc[_0x75b3('0x16')]));});});};exports[_0x75b3('0x24')]=function(_0x1562a3,_0x16493e,_0x67afe5){var _0x586f36=this;return new Promise(function(_0x1002f2,_0xb0379b){var _0x49417e={'body':_0x1562a3[_0x75b3('0x25')],'channel':_0x75b3('0x26')};var _0x3c16af=[];var _0x516fec=[];var _0x2ffe82={};return db[_0x75b3('0x27')][_0x75b3('0x28')]()[_0x75b3('0xf')](function(_0x2347b6){if(!_0x2347b6){throw new db[(_0x75b3('0x29'))][(_0x75b3('0x2a'))]('no\x20available\x20attributes');}_0x3c16af=_[_0x75b3('0x2b')](_[_0x75b3('0x2c')](_0x2347b6),[_0x75b3('0x2d'),_0x75b3('0x2e')]);_0x516fec=_[_0x75b3('0x2b')](_[_0x75b3('0x2c')](_0x2347b6),[_0x75b3('0x2d'),_0x75b3('0x2e'),_0x75b3('0x2f'),_0x75b3('0x30')]);if(_0x1562a3[_0x75b3('0x25')]['id']){delete _0x1562a3['body']['id'];}if(_['isNil'](_0x1562a3['body']['from'])){throw new db[(_0x75b3('0x29'))][(_0x75b3('0x2a'))](_0x75b3('0x31'));}if(_[_0x75b3('0x32')](_0x1562a3[_0x75b3('0x25')][_0x75b3('0x25')])||_0x1562a3[_0x75b3('0x25')][_0x75b3('0x25')]===''){throw new db[(_0x75b3('0x29'))][(_0x75b3('0x2a'))](_0x75b3('0x33'));}if(_['isNil'](_0x1562a3[_0x75b3('0x25')][_0x75b3('0x34')])){throw new db['Sequelize'][(_0x75b3('0x2a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x516fec);}if(!_[_0x75b3('0x35')](_0x516fec,_0x1562a3[_0x75b3('0x25')][_0x75b3('0x34')])){throw new db[(_0x75b3('0x29'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x516fec);}_0x2ffe82[_0x1562a3[_0x75b3('0x25')][_0x75b3('0x34')]]=_0x1562a3[_0x75b3('0x25')][_0x75b3('0x36')];})[_0x75b3('0xf')](function(){return db['FaxAccount'][_0x75b3('0x37')]({'where':{'id':_0x1562a3[_0x75b3('0x38')]['id']},'include':[{'model':db[_0x75b3('0x39')],'as':_0x75b3('0x3a'),'include':[{'model':db[_0x75b3('0x27')],'as':_0x75b3('0x3b'),'where':_0x2ffe82,'limit':0x1,'order':[[_0x75b3('0x2e'),'DESC']]}]},{'model':db[_0x75b3('0x3c')],'as':_0x75b3('0x3d')}]});})[_0x75b3('0xf')](function(_0x31c126){if(_0x31c126&&_0x31c126[_0x75b3('0x3a')]){var _0x789678=_0x31c126['get']({'plain':!![]});_0x49417e[_0x75b3('0x38')]=_0x789678;_0x49417e[_0x75b3('0x3e')]=_0x789678['Applications'];_0x49417e[_0x75b3('0x3f')]=_0x789678[_0x75b3('0x3a')];_0x49417e[_0x75b3('0x3e')]=_[_0x75b3('0x40')](_0x49417e[_0x75b3('0x3e')],['priority'],[_0x75b3('0x41')]);if(_0x49417e[_0x75b3('0x38')]['Applications']){delete _0x49417e['account'][_0x75b3('0x3d')];}if(_0x49417e[_0x75b3('0x38')]['List']&&_0x49417e[_0x75b3('0x38')][_0x75b3('0x3a')][_0x75b3('0x3b')]['length']){return _0x49417e['account'][_0x75b3('0x3a')][_0x75b3('0x3b')][0x0];}var _0x53bbb5=_[_0x75b3('0xc')](_0x1562a3[_0x75b3('0x25')],{'firstName':_0x1562a3[_0x75b3('0x25')][_0x75b3('0x36')],'ListId':_0x789678[_0x75b3('0x30')]});_0x53bbb5[_0x1562a3[_0x75b3('0x25')][_0x75b3('0x34')]]=_0x1562a3[_0x75b3('0x25')]['from'];return db['CmContact'][_0x75b3('0x42')](_0x53bbb5,{'fields':_0x3c16af,'raw':!![]});}})['then'](function(_0x4b9886){_0x49417e['contact']=_0x4b9886;if(_0x4b9886){var _0x1cdf54={'ContactId':_0x4b9886['id'],'FaxAccountId':_0x1562a3[_0x75b3('0x38')]['id'],'fax':_0x4b9886[_0x75b3('0x26')]};return db[_0x75b3('0x43')]['find']({'where':{'ContactId':_0x4b9886['id'],'closed':![],'FaxAccountId':_0x1562a3[_0x75b3('0x38')]['id']}})[_0x75b3('0xf')](function(_0x2173f2){if(_0x2173f2){return[_0x2173f2,![]];}return db[_0x75b3('0x43')][_0x75b3('0x42')](_0x1cdf54)[_0x75b3('0xf')](function(_0x1ba400){return[_0x1ba400,!![]];});});}else{throw new Error(_0x75b3('0x44'));}})[_0x75b3('0x45')](function(_0x36eabb,_0x309b8c){var _0x2a5140=_0x36eabb[_0x75b3('0x46')]({'plain':!![]});if(_0x309b8c){if(_0x49417e['account'][_0x75b3('0x47')]){_0x49417e[_0x75b3('0x3e')]['push']({'id':0x0,'priority':_0x49417e['applications'][_0x75b3('0x48')]+0x1,'app':_0x75b3('0x49'),'appdata':_0x75b3('0x4a'),'interval':_0x75b3('0x4b')});}_0x2a5140[_0x75b3('0x4c')]=!![];}else{_0x2a5140[_0x75b3('0x4c')]=![];}_0x49417e['interaction']=_0x2a5140;return db['FaxMessage']['create']({'body':_0x1562a3['body'][_0x75b3('0x25')],'FaxAccountId':_0x1562a3[_0x75b3('0x38')]['id'],'FaxInteractionId':_0x36eabb['id'],'direction':'in','ContactId':_0x36eabb['ContactId'],'AttachmentId':_0x1562a3[_0x75b3('0x25')]['AttachmentId']});})[_0x75b3('0xf')](function(_0x425bc7){_0x49417e[_0x75b3('0x16')]=_0x425bc7;if(_0x49417e[_0x75b3('0x4d')][_0x75b3('0x4e')]){return db[_0x75b3('0x4f')]['find']({'attributes':['id',_0x75b3('0x50')],'where':{'id':_0x49417e[_0x75b3('0x4d')]['UserId']}})['then'](function(_0x531882){if(_0x531882){_0x49417e[_0x75b3('0x3e')][_0x75b3('0x51')]({'id':0x0,'priority':0x0,'app':_0x75b3('0x52'),'appdata':_0x531882[_0x75b3('0x50')]+','+(_0x49417e[_0x75b3('0x38')][_0x75b3('0x53')]||0xa),'interval':_0x75b3('0x4b')});}return respondWithRpcPromise(_0x75b3('0x54'),_0x75b3('0x55'),_0x49417e);});}return respondWithRpcPromise('Start',_0x75b3('0x55'),_0x49417e);})['then'](function(_0x35a13b){_0x1002f2(_0x35a13b);})[_0x75b3('0x18')](function(_0xc8dfb){_0xb0379b(_0x586f36[_0x75b3('0x15')](0x1f4,_0xc8dfb[_0x75b3('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 044456f..db663ba 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 _0xc2c7=['register','faxAccount:','save','remove','update','emit'];(function(_0x48ba50,_0x4f4082){var _0x56a915=function(_0x5e32c4){while(--_0x5e32c4){_0x48ba50['push'](_0x48ba50['shift']());}};_0x56a915(++_0x4f4082);}(_0xc2c7,0x134));var _0x7c2c=function(_0x2af7c0,_0x14f017){_0x2af7c0=_0x2af7c0-0x0;var _0x313950=_0xc2c7[_0x2af7c0];return _0x313950;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x7c2c('0x0'),_0x7c2c('0x1'),_0x7c2c('0x2')];function createListener(_0x330870,_0x380d13){return function(_0x237e4d){_0x380d13[_0x7c2c('0x3')](_0x330870,_0x237e4d);};}function removeListener(_0x116f8a,_0x4bbc14){return function(){FaxAccountEvents['removeListener'](_0x116f8a,_0x4bbc14);};}exports[_0x7c2c('0x4')]=function(_0x42ecc9){for(var _0x23c038=0x0,_0x54f027=events['length'];_0x23c038<_0x54f027;_0x23c038++){var _0x5a1027=events[_0x23c038];var _0x2274cd=createListener(_0x7c2c('0x5')+_0x5a1027,_0x42ecc9);FaxAccountEvents['on'](_0x5a1027,_0x2274cd);}}; \ No newline at end of file +var _0x6d11=['register','length','./faxAccount.events','save','remove','emit','removeListener'];(function(_0x198fc6,_0x5eaee9){var _0x4376bb=function(_0x4b3241){while(--_0x4b3241){_0x198fc6['push'](_0x198fc6['shift']());}};_0x4376bb(++_0x5eaee9);}(_0x6d11,0xbf));var _0x16d1=function(_0x4af82a,_0x324b56){_0x4af82a=_0x4af82a-0x0;var _0x31a7f6=_0x6d11[_0x4af82a];return _0x31a7f6;};'use strict';var FaxAccountEvents=require(_0x16d1('0x0'));var events=[_0x16d1('0x1'),_0x16d1('0x2'),'update'];function createListener(_0x14fc8e,_0x57a8f9){return function(_0x364469){_0x57a8f9[_0x16d1('0x3')](_0x14fc8e,_0x364469);};}function removeListener(_0x4bce83,_0x48754e){return function(){FaxAccountEvents[_0x16d1('0x4')](_0x4bce83,_0x48754e);};}exports[_0x16d1('0x5')]=function(_0x3eb9e2){for(var _0x38626d=0x0,_0x1009dc=events[_0x16d1('0x6')];_0x38626d<_0x1009dc;_0x38626d++){var _0x19390d=events[_0x38626d];var _0x5d0e3f=createListener('faxAccount:'+_0x19390d,_0x3eb9e2);FaxAccountEvents['on'](_0x19390d,_0x5d0e3f);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 42f584c..8deaed4 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 _0x032f=['describe','show','/:id/canned_answers','getAnswers','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/interactions','addInteraction','/addaccountapplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','update','/:id','destroy','removeDispositions','delete','exports','path','connect-timeout','Router','./faxAccount.controller','get','isAuthenticated','index','/describe'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0x032f,0x18f));var _0xf032=function(_0x5b6ba6,_0x5c5700){_0x5b6ba6=_0x5b6ba6-0x0;var _0x555b90=_0x032f[_0x5b6ba6];return _0x555b90;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf032('0x0'));var timeout=require(_0xf032('0x1'));var express=require('express');var router=express[_0xf032('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf032('0x3'));router[_0xf032('0x4')]('/',auth[_0xf032('0x5')](),controller[_0xf032('0x6')]);router['get'](_0xf032('0x7'),auth[_0xf032('0x5')](),controller[_0xf032('0x8')]);router[_0xf032('0x4')]('/:id',auth[_0xf032('0x5')](),controller[_0xf032('0x9')]);router[_0xf032('0x4')]('/:id/dispositions',auth[_0xf032('0x5')](),controller['getDispositions']);router[_0xf032('0x4')](_0xf032('0xa'),auth[_0xf032('0x5')](),controller[_0xf032('0xb')]);router['get']('/:id/interactions',auth[_0xf032('0x5')](),controller['getInteractions']);router[_0xf032('0x4')](_0xf032('0xc'),auth['isAuthenticated'](),controller['getApplications']);router['get'](_0xf032('0xd'),auth[_0xf032('0x5')](),controller[_0xf032('0xe')]);router['get'](_0xf032('0xf'),auth['isAuthenticated'](),controller[_0xf032('0x10')]);router[_0xf032('0x11')]('/',auth[_0xf032('0x5')](),controller[_0xf032('0x12')]);router[_0xf032('0x11')](_0xf032('0x13'),auth[_0xf032('0x5')](),controller[_0xf032('0x14')]);router[_0xf032('0x11')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xf032('0x15')]);router['post'](_0xf032('0x16'),auth[_0xf032('0x5')](),controller[_0xf032('0x17')]);router[_0xf032('0x11')](_0xf032('0xc'),auth[_0xf032('0x5')](),controller['addApplications']);router[_0xf032('0x11')](_0xf032('0x18'),auth[_0xf032('0x5')](),controller[_0xf032('0x19')]);router[_0xf032('0x11')](_0xf032('0x1a'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0xf032('0x11')](_0xf032('0x1b'),auth[_0xf032('0x5')](),controller[_0xf032('0x1c')]);router['post'](_0xf032('0xf'),auth[_0xf032('0x5')](),controller[_0xf032('0x1d')]);router[_0xf032('0x1e')]('/:id',auth[_0xf032('0x5')](),controller[_0xf032('0x1f')]);router['delete'](_0xf032('0x20'),auth[_0xf032('0x5')](),controller[_0xf032('0x21')]);router['delete'](_0xf032('0x13'),auth[_0xf032('0x5')](),controller[_0xf032('0x22')]);router['delete'](_0xf032('0xa'),auth[_0xf032('0x5')](),controller['removeAnswers']);router[_0xf032('0x23')]('/:id/users',auth[_0xf032('0x5')](),controller['removeAgents']);module[_0xf032('0x24')]=router; \ No newline at end of file +var _0xa8d5=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/users','post','addDisposition','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','addAgents','/:id','update','delete','destroy','removeDispositions','removeAgents','exports'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xa8d5,0x186));var _0x5a8d=function(_0x461a12,_0x23e80b){_0x461a12=_0x461a12-0x0;var _0x2d4f50=_0xa8d5[_0x461a12];return _0x2d4f50;};'use strict';var multer=require(_0x5a8d('0x0'));var util=require(_0x5a8d('0x1'));var path=require('path');var timeout=require(_0x5a8d('0x2'));var express=require(_0x5a8d('0x3'));var router=express[_0x5a8d('0x4')]();var auth=require(_0x5a8d('0x5'));var interaction=require(_0x5a8d('0x6'));var config=require('../../config/environment');var controller=require(_0x5a8d('0x7'));router[_0x5a8d('0x8')]('/',auth[_0x5a8d('0x9')](),controller[_0x5a8d('0xa')]);router[_0x5a8d('0x8')](_0x5a8d('0xb'),auth[_0x5a8d('0x9')](),controller['describe']);router[_0x5a8d('0x8')]('/:id',auth[_0x5a8d('0x9')](),controller[_0x5a8d('0xc')]);router[_0x5a8d('0x8')](_0x5a8d('0xd'),auth[_0x5a8d('0x9')](),controller[_0x5a8d('0xe')]);router[_0x5a8d('0x8')](_0x5a8d('0xf'),auth[_0x5a8d('0x9')](),controller[_0x5a8d('0x10')]);router[_0x5a8d('0x8')](_0x5a8d('0x11'),auth[_0x5a8d('0x9')](),controller[_0x5a8d('0x12')]);router[_0x5a8d('0x8')](_0x5a8d('0x13'),auth[_0x5a8d('0x9')](),controller[_0x5a8d('0x14')]);router[_0x5a8d('0x8')]('/:id/messages',auth[_0x5a8d('0x9')](),controller['getMessages']);router[_0x5a8d('0x8')](_0x5a8d('0x15'),auth[_0x5a8d('0x9')](),controller['getAgents']);router[_0x5a8d('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5a8d('0x16')]('/:id/dispositions',auth[_0x5a8d('0x9')](),controller[_0x5a8d('0x17')]);router[_0x5a8d('0x16')]('/:id/canned_answers',auth[_0x5a8d('0x9')](),controller['addAnswer']);router[_0x5a8d('0x16')](_0x5a8d('0x11'),auth[_0x5a8d('0x9')](),controller[_0x5a8d('0x18')]);router[_0x5a8d('0x16')]('/:id/applications',auth[_0x5a8d('0x9')](),controller[_0x5a8d('0x19')]);router[_0x5a8d('0x16')]('/addaccountapplications',auth[_0x5a8d('0x9')](),controller[_0x5a8d('0x1a')]);router[_0x5a8d('0x16')](_0x5a8d('0x1b'),auth[_0x5a8d('0x9')](),controller[_0x5a8d('0x1c')]);router['post'](_0x5a8d('0x1d'),auth[_0x5a8d('0x9')](),controller[_0x5a8d('0x1e')]);router[_0x5a8d('0x16')](_0x5a8d('0x15'),auth[_0x5a8d('0x9')](),controller[_0x5a8d('0x1f')]);router['put'](_0x5a8d('0x20'),auth['isAuthenticated'](),controller[_0x5a8d('0x21')]);router[_0x5a8d('0x22')](_0x5a8d('0x20'),auth[_0x5a8d('0x9')](),controller[_0x5a8d('0x23')]);router[_0x5a8d('0x22')](_0x5a8d('0xd'),auth[_0x5a8d('0x9')](),controller[_0x5a8d('0x24')]);router['delete'](_0x5a8d('0xf'),auth[_0x5a8d('0x9')](),controller['removeAnswers']);router['delete'](_0x5a8d('0x15'),auth[_0x5a8d('0x9')](),controller[_0x5a8d('0x25')]);module[_0x5a8d('0x26')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 7e2d357..ba1d277 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 _0xbd0e=['*,*,*,*','exports','STRING','noop','TEXT'];(function(_0x19085d,_0x5d8bc0){var _0xdb3f69=function(_0x3009c8){while(--_0x3009c8){_0x19085d['push'](_0x19085d['shift']());}};_0xdb3f69(++_0x5d8bc0);}(_0xbd0e,0x187));var _0xebd0=function(_0x15c23e,_0x162305){_0x15c23e=_0x15c23e-0x0;var _0x4ed7d1=_0xbd0e[_0x15c23e];return _0x4ed7d1;};'use strict';var Sequelize=require('sequelize');module[_0xebd0('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xebd0('0x1')],'allowNull':![],'defaultValue':_0xebd0('0x2')},'appdata':{'type':Sequelize[_0xebd0('0x3')]()},'description':{'type':Sequelize[_0xebd0('0x1')]},'interval':{'type':Sequelize[_0xebd0('0x1')],'defaultValue':_0xebd0('0x4')}}; \ No newline at end of file +var _0xf11e=['INTEGER','STRING','noop','sequelize'];(function(_0x254abd,_0x1ab7f0){var _0x31bf1b=function(_0x447fd8){while(--_0x447fd8){_0x254abd['push'](_0x254abd['shift']());}};_0x31bf1b(++_0x1ab7f0);}(_0xf11e,0x11b));var _0xef11=function(_0x4d9293,_0x5e1b3c){_0x4d9293=_0x4d9293-0x0;var _0x5a5c4e=_0xf11e[_0x4d9293];return _0x5a5c4e;};'use strict';var Sequelize=require(_0xef11('0x0'));module['exports']={'priority':{'type':Sequelize[_0xef11('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xef11('0x2')],'allowNull':![],'defaultValue':_0xef11('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xef11('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 1cd73f7..873f224 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 _0xf513=['moment','mustache','util','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','index','map','FaxApplication','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','merge','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3e14ba,_0x1a3e9d){var _0x1ac0be=function(_0x58c79d){while(--_0x58c79d){_0x3e14ba['push'](_0x3e14ba['shift']());}};_0x1ac0be(++_0x1a3e9d);}(_0xf513,0x89));var _0x3f51=function(_0x468c6c,_0x24710){_0x468c6c=_0x468c6c-0x0;var _0x45a1ce=_0xf513[_0x468c6c];return _0x45a1ce;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x3f51('0x0'));var rimraf=require(_0x3f51('0x1'));var zipdir=require(_0x3f51('0x2'));var jsonpatch=require(_0x3f51('0x3'));var rp=require(_0x3f51('0x4'));var moment=require(_0x3f51('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3f51('0x6'));var util=require(_0x3f51('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x3f51('0x8'));var squel=require(_0x3f51('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3f51('0xa'));var toCsv=require(_0x3f51('0xb'));var querystring=require(_0x3f51('0xc'));var Papa=require(_0x3f51('0xd'));var Redis=require(_0x3f51('0xe'));var authService=require(_0x3f51('0xf'));var qs=require(_0x3f51('0x10'));var as=require(_0x3f51('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f51('0x12'))(_0x3f51('0x13'));var utils=require(_0x3f51('0x14'));var config=require(_0x3f51('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1672d3,_0x30a43d){_0x30a43d=_0x30a43d||0xcc;return function(_0x26be30){if(_0x26be30){return _0x1672d3[_0x3f51('0x16')](_0x30a43d);}return _0x1672d3[_0x3f51('0x17')](_0x30a43d)[_0x3f51('0x18')]();};}function respondWithResult(_0x30243a,_0x36ca45){_0x36ca45=_0x36ca45||0xc8;return function(_0x5b3c20){if(_0x5b3c20){return _0x30243a[_0x3f51('0x17')](_0x36ca45)['json'](_0x5b3c20);}};}function respondWithFilteredResult(_0x10c319,_0x85d598){return function(_0x30ee1f){if(_0x30ee1f){var _0x589ac4=_0x30ee1f[_0x3f51('0x19')],_0x247f32=_0x85d598[_0x3f51('0x1a')],_0x66bfbc=_0x85d598[_0x3f51('0x1a')]+_0x85d598[_0x3f51('0x1b')],_0x46180a;if(_0x66bfbc>=_0x589ac4){_0x66bfbc=_0x589ac4;_0x46180a=0xc8;}else{_0x46180a=0xce;}_0x10c319['status'](_0x46180a);return _0x10c319[_0x3f51('0x1c')](_0x3f51('0x1d'),_0x247f32+'-'+_0x66bfbc+'/'+_0x589ac4)[_0x3f51('0x1e')](_0x30ee1f);}return null;};}function patchUpdates(_0x22544e){return function(_0x406915){try{jsonpatch[_0x3f51('0x1f')](_0x406915,_0x22544e,!![]);}catch(_0x52c2ab){return BPromise[_0x3f51('0x20')](_0x52c2ab);}return _0x406915[_0x3f51('0x21')]();};}function saveUpdates(_0x1a4514,_0x2b0279){return function(_0x523e7c){if(_0x523e7c){return _0x523e7c[_0x3f51('0x22')](_0x1a4514)[_0x3f51('0x23')](function(_0x4d722b){return _0x4d722b;});}return null;};}function removeEntity(_0x1b6088,_0x487bad){return function(_0x587f28){if(_0x587f28){return _0x587f28[_0x3f51('0x24')]()[_0x3f51('0x23')](function(){_0x1b6088[_0x3f51('0x17')](0xcc)[_0x3f51('0x18')]();});}};}function handleEntityNotFound(_0x52dc70,_0x166c91){return function(_0x62a5c4){if(!_0x62a5c4){_0x52dc70[_0x3f51('0x16')](0x194);}return _0x62a5c4;};}function handleError(_0x516968,_0x31c1a0){_0x31c1a0=_0x31c1a0||0x1f4;return function(_0x145797){logger[_0x3f51('0x25')](_0x145797['stack']);if(_0x145797[_0x3f51('0x26')]){delete _0x145797[_0x3f51('0x26')];}_0x516968[_0x3f51('0x17')](_0x31c1a0)['send'](_0x145797);};}exports[_0x3f51('0x27')]=function(_0xcc17b2,_0x7f18f7){var _0x598937={},_0x272c56={},_0x4e4a85={'count':0x0,'rows':[]};var _0x435131=_[_0x3f51('0x28')](db[_0x3f51('0x29')][_0x3f51('0x2a')],function(_0x4442d0){return{'name':_0x4442d0[_0x3f51('0x2b')],'type':_0x4442d0['type']['key']};});_0x272c56[_0x3f51('0x2c')]=_[_0x3f51('0x28')](_0x435131,_0x3f51('0x26'));_0x272c56[_0x3f51('0x2d')]=_[_0x3f51('0x2e')](_0xcc17b2[_0x3f51('0x2d')]);_0x272c56['filters']=_[_0x3f51('0x2f')](_0x272c56['model'],_0x272c56[_0x3f51('0x2d')]);_0x598937[_0x3f51('0x30')]=_[_0x3f51('0x2f')](_0x272c56[_0x3f51('0x2c')],qs[_0x3f51('0x31')](_0xcc17b2[_0x3f51('0x2d')][_0x3f51('0x31')]));_0x598937[_0x3f51('0x30')]=_0x598937[_0x3f51('0x30')]['length']?_0x598937[_0x3f51('0x30')]:_0x272c56[_0x3f51('0x2c')];if(!_0xcc17b2['query'][_0x3f51('0x32')](_0x3f51('0x33'))){_0x598937[_0x3f51('0x1b')]=qs['limit'](_0xcc17b2[_0x3f51('0x2d')][_0x3f51('0x1b')]);_0x598937[_0x3f51('0x1a')]=qs['offset'](_0xcc17b2['query'][_0x3f51('0x1a')]);}_0x598937['order']=qs[_0x3f51('0x34')](_0xcc17b2['query'][_0x3f51('0x34')]);_0x598937[_0x3f51('0x35')]=qs[_0x3f51('0x36')](_[_0x3f51('0x37')](_0xcc17b2[_0x3f51('0x2d')],_0x272c56[_0x3f51('0x36')]),_0x435131);if(_0xcc17b2[_0x3f51('0x2d')][_0x3f51('0x38')]){_0x598937[_0x3f51('0x35')]=_['merge'](_0x598937[_0x3f51('0x35')],{'$or':_[_0x3f51('0x28')](_0x435131,function(_0x44e7c0){if(_0x44e7c0[_0x3f51('0x39')]!==_0x3f51('0x3a')){var _0x28d118={};_0x28d118[_0x44e7c0[_0x3f51('0x26')]]={'$like':'%'+_0xcc17b2[_0x3f51('0x2d')][_0x3f51('0x38')]+'%'};return _0x28d118;}})});}_0x598937=_['merge']({},_0x598937,_0xcc17b2[_0x3f51('0x3b')]);var _0x474dd9={'where':_0x598937[_0x3f51('0x35')]};return db[_0x3f51('0x29')][_0x3f51('0x19')](_0x474dd9)[_0x3f51('0x23')](function(_0x3f3e89){_0x4e4a85['count']=_0x3f3e89;if(_0xcc17b2[_0x3f51('0x2d')][_0x3f51('0x3c')]){_0x598937[_0x3f51('0x3d')]=[{'all':!![]}];}return db[_0x3f51('0x29')][_0x3f51('0x3e')](_0x598937);})[_0x3f51('0x23')](function(_0x4b771c){_0x4e4a85[_0x3f51('0x3f')]=_0x4b771c;return _0x4e4a85;})[_0x3f51('0x23')](respondWithFilteredResult(_0x7f18f7,_0x598937))['catch'](handleError(_0x7f18f7,null));};exports[_0x3f51('0x40')]=function(_0x34828f,_0x554f7f){var _0x216a7={'raw':!![],'where':{'id':_0x34828f[_0x3f51('0x41')]['id']}},_0x10ebc6={};_0x10ebc6[_0x3f51('0x2c')]=_[_0x3f51('0x2e')](db['FaxApplication'][_0x3f51('0x2a')]);_0x10ebc6['query']=_[_0x3f51('0x2e')](_0x34828f['query']);_0x10ebc6[_0x3f51('0x36')]=_[_0x3f51('0x2f')](_0x10ebc6['model'],_0x10ebc6[_0x3f51('0x2d')]);_0x216a7[_0x3f51('0x30')]=_[_0x3f51('0x2f')](_0x10ebc6[_0x3f51('0x2c')],qs['fields'](_0x34828f['query'][_0x3f51('0x31')]));_0x216a7[_0x3f51('0x30')]=_0x216a7['attributes']['length']?_0x216a7['attributes']:_0x10ebc6[_0x3f51('0x2c')];if(_0x34828f[_0x3f51('0x2d')][_0x3f51('0x3c')]){_0x216a7[_0x3f51('0x3d')]=[{'all':!![]}];}_0x216a7=_[_0x3f51('0x42')]({},_0x216a7,_0x34828f[_0x3f51('0x3b')]);return db['FaxApplication'][_0x3f51('0x43')](_0x216a7)['then'](handleEntityNotFound(_0x554f7f,null))[_0x3f51('0x23')](respondWithResult(_0x554f7f,null))['catch'](handleError(_0x554f7f,null));};exports['create']=function(_0x43622f,_0x36e09a){return db['FaxApplication'][_0x3f51('0x44')](_0x43622f[_0x3f51('0x45')],{})[_0x3f51('0x23')](respondWithResult(_0x36e09a,0xc9))[_0x3f51('0x46')](handleError(_0x36e09a,null));};exports[_0x3f51('0x22')]=function(_0x5061d2,_0x430054){if(_0x5061d2[_0x3f51('0x45')]['id']){delete _0x5061d2['body']['id'];}return db[_0x3f51('0x29')][_0x3f51('0x43')]({'where':{'id':_0x5061d2['params']['id']}})[_0x3f51('0x23')](handleEntityNotFound(_0x430054,null))[_0x3f51('0x23')](saveUpdates(_0x5061d2['body'],null))[_0x3f51('0x23')](respondWithResult(_0x430054,null))[_0x3f51('0x46')](handleError(_0x430054,null));};exports[_0x3f51('0x24')]=function(_0x4349b1,_0x3f7b3b){return db['FaxApplication'][_0x3f51('0x43')]({'where':{'id':_0x4349b1[_0x3f51('0x41')]['id']}})[_0x3f51('0x23')](handleEntityNotFound(_0x3f7b3b,null))['then'](removeEntity(_0x3f7b3b,null))[_0x3f51('0x46')](handleError(_0x3f7b3b,null));}; \ No newline at end of file +var _0x2af8=['nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','FaxApplication','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','destroy','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','update','then','error','stack','name','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x316efa,_0x20a1e1){var _0x4d96cc=function(_0x4a0648){while(--_0x4a0648){_0x316efa['push'](_0x316efa['shift']());}};_0x4d96cc(++_0x20a1e1);}(_0x2af8,0xf6));var _0x82af=function(_0x5161fc,_0x37c5f6){_0x5161fc=_0x5161fc-0x0;var _0x38490b=_0x2af8[_0x5161fc];return _0x38490b;};'use strict';var pdf=require(_0x82af('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x82af('0x1'));var zipdir=require(_0x82af('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x82af('0x3'));var moment=require(_0x82af('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x82af('0x5'));var util=require('util');var path=require(_0x82af('0x6'));var sox=require(_0x82af('0x7'));var csv=require('to-csv');var ejs=require(_0x82af('0x8'));var fs=require('fs');var _=require(_0x82af('0x9'));var squel=require('squel');var crypto=require(_0x82af('0xa'));var jsforce=require(_0x82af('0xb'));var deskjs=require(_0x82af('0xc'));var toCsv=require(_0x82af('0xd'));var querystring=require(_0x82af('0xe'));var Papa=require(_0x82af('0xf'));var Redis=require(_0x82af('0x10'));var authService=require(_0x82af('0x11'));var qs=require(_0x82af('0x12'));var as=require(_0x82af('0x13'));var hardwareService=require(_0x82af('0x14'));var logger=require(_0x82af('0x15'))(_0x82af('0x16'));var utils=require(_0x82af('0x17'));var config=require(_0x82af('0x18'));var licenseUtil=require(_0x82af('0x19'));var db=require(_0x82af('0x1a'))['db'];function respondWithStatusCode(_0x211d71,_0x56a38b){_0x56a38b=_0x56a38b||0xcc;return function(_0x5e3332){if(_0x5e3332){return _0x211d71[_0x82af('0x1b')](_0x56a38b);}return _0x211d71[_0x82af('0x1c')](_0x56a38b)[_0x82af('0x1d')]();};}function respondWithResult(_0x4cf822,_0x2ed907){_0x2ed907=_0x2ed907||0xc8;return function(_0x18332f){if(_0x18332f){return _0x4cf822[_0x82af('0x1c')](_0x2ed907)[_0x82af('0x1e')](_0x18332f);}};}function respondWithFilteredResult(_0x5941f3,_0x190cad){return function(_0x3a9077){if(_0x3a9077){var _0x25b822=_0x3a9077[_0x82af('0x1f')],_0x23e035=_0x190cad[_0x82af('0x20')],_0x216527=_0x190cad[_0x82af('0x20')]+_0x190cad[_0x82af('0x21')],_0x407c78;if(_0x216527>=_0x25b822){_0x216527=_0x25b822;_0x407c78=0xc8;}else{_0x407c78=0xce;}_0x5941f3[_0x82af('0x1c')](_0x407c78);return _0x5941f3[_0x82af('0x22')](_0x82af('0x23'),_0x23e035+'-'+_0x216527+'/'+_0x25b822)['json'](_0x3a9077);}return null;};}function patchUpdates(_0x3821cc){return function(_0x2139f8){try{jsonpatch[_0x82af('0x24')](_0x2139f8,_0x3821cc,!![]);}catch(_0x20cc9e){return BPromise['reject'](_0x20cc9e);}return _0x2139f8['save']();};}function saveUpdates(_0x31ffbe,_0x4be3b2){return function(_0x2a2a15){if(_0x2a2a15){return _0x2a2a15[_0x82af('0x25')](_0x31ffbe)[_0x82af('0x26')](function(_0x25894c){return _0x25894c;});}return null;};}function removeEntity(_0x3174f6,_0x276b04){return function(_0x6e416b){if(_0x6e416b){return _0x6e416b['destroy']()[_0x82af('0x26')](function(){_0x3174f6['status'](0xcc)[_0x82af('0x1d')]();});}};}function handleEntityNotFound(_0x4cd163,_0x5ed461){return function(_0x74853c){if(!_0x74853c){_0x4cd163['sendStatus'](0x194);}return _0x74853c;};}function handleError(_0x7d204e,_0x244235){_0x244235=_0x244235||0x1f4;return function(_0x158a9a){logger[_0x82af('0x27')](_0x158a9a[_0x82af('0x28')]);if(_0x158a9a[_0x82af('0x29')]){delete _0x158a9a[_0x82af('0x29')];}_0x7d204e[_0x82af('0x1c')](_0x244235)['send'](_0x158a9a);};}exports['index']=function(_0x122825,_0x37cf2b){var _0x5c0a33={},_0x1e42e3={},_0x2e6753={'count':0x0,'rows':[]};var _0x428c5e=_[_0x82af('0x2a')](db['FaxApplication']['rawAttributes'],function(_0x3394a5){return{'name':_0x3394a5[_0x82af('0x2b')],'type':_0x3394a5[_0x82af('0x2c')][_0x82af('0x2d')]};});_0x1e42e3[_0x82af('0x2e')]=_[_0x82af('0x2a')](_0x428c5e,_0x82af('0x29'));_0x1e42e3[_0x82af('0x2f')]=_[_0x82af('0x30')](_0x122825[_0x82af('0x2f')]);_0x1e42e3['filters']=_['intersection'](_0x1e42e3[_0x82af('0x2e')],_0x1e42e3['query']);_0x5c0a33['attributes']=_[_0x82af('0x31')](_0x1e42e3[_0x82af('0x2e')],qs['fields'](_0x122825['query'][_0x82af('0x32')]));_0x5c0a33[_0x82af('0x33')]=_0x5c0a33[_0x82af('0x33')][_0x82af('0x34')]?_0x5c0a33['attributes']:_0x1e42e3[_0x82af('0x2e')];if(!_0x122825[_0x82af('0x2f')][_0x82af('0x35')](_0x82af('0x36'))){_0x5c0a33[_0x82af('0x21')]=qs['limit'](_0x122825[_0x82af('0x2f')][_0x82af('0x21')]);_0x5c0a33[_0x82af('0x20')]=qs[_0x82af('0x20')](_0x122825[_0x82af('0x2f')][_0x82af('0x20')]);}_0x5c0a33['order']=qs[_0x82af('0x37')](_0x122825[_0x82af('0x2f')][_0x82af('0x37')]);_0x5c0a33[_0x82af('0x38')]=qs[_0x82af('0x39')](_[_0x82af('0x3a')](_0x122825['query'],_0x1e42e3[_0x82af('0x39')]),_0x428c5e);if(_0x122825[_0x82af('0x2f')][_0x82af('0x3b')]){_0x5c0a33[_0x82af('0x38')]=_[_0x82af('0x3c')](_0x5c0a33[_0x82af('0x38')],{'$or':_['map'](_0x428c5e,function(_0x45c006){if(_0x45c006[_0x82af('0x2c')]!==_0x82af('0x3d')){var _0x36657f={};_0x36657f[_0x45c006['name']]={'$like':'%'+_0x122825[_0x82af('0x2f')][_0x82af('0x3b')]+'%'};return _0x36657f;}})});}_0x5c0a33=_['merge']({},_0x5c0a33,_0x122825[_0x82af('0x3e')]);var _0x14592e={'where':_0x5c0a33[_0x82af('0x38')]};return db[_0x82af('0x3f')][_0x82af('0x1f')](_0x14592e)[_0x82af('0x26')](function(_0x5d50a1){_0x2e6753[_0x82af('0x1f')]=_0x5d50a1;if(_0x122825['query'][_0x82af('0x40')]){_0x5c0a33[_0x82af('0x41')]=[{'all':!![]}];}return db[_0x82af('0x3f')]['findAll'](_0x5c0a33);})[_0x82af('0x26')](function(_0x39fc2d){_0x2e6753[_0x82af('0x42')]=_0x39fc2d;return _0x2e6753;})[_0x82af('0x26')](respondWithFilteredResult(_0x37cf2b,_0x5c0a33))[_0x82af('0x43')](handleError(_0x37cf2b,null));};exports[_0x82af('0x44')]=function(_0x301135,_0x24aa8a){var _0x3946ae={'raw':!![],'where':{'id':_0x301135[_0x82af('0x45')]['id']}},_0x4c9d00={};_0x4c9d00['model']=_[_0x82af('0x30')](db[_0x82af('0x3f')][_0x82af('0x46')]);_0x4c9d00['query']=_[_0x82af('0x30')](_0x301135[_0x82af('0x2f')]);_0x4c9d00[_0x82af('0x39')]=_[_0x82af('0x31')](_0x4c9d00[_0x82af('0x2e')],_0x4c9d00['query']);_0x3946ae[_0x82af('0x33')]=_[_0x82af('0x31')](_0x4c9d00['model'],qs['fields'](_0x301135[_0x82af('0x2f')][_0x82af('0x32')]));_0x3946ae[_0x82af('0x33')]=_0x3946ae['attributes'][_0x82af('0x34')]?_0x3946ae[_0x82af('0x33')]:_0x4c9d00[_0x82af('0x2e')];if(_0x301135[_0x82af('0x2f')]['includeAll']){_0x3946ae[_0x82af('0x41')]=[{'all':!![]}];}_0x3946ae=_[_0x82af('0x3c')]({},_0x3946ae,_0x301135[_0x82af('0x3e')]);return db[_0x82af('0x3f')][_0x82af('0x47')](_0x3946ae)[_0x82af('0x26')](handleEntityNotFound(_0x24aa8a,null))['then'](respondWithResult(_0x24aa8a,null))['catch'](handleError(_0x24aa8a,null));};exports[_0x82af('0x48')]=function(_0x5882e6,_0x538f81){return db[_0x82af('0x3f')][_0x82af('0x48')](_0x5882e6[_0x82af('0x49')],{})[_0x82af('0x26')](respondWithResult(_0x538f81,0xc9))[_0x82af('0x43')](handleError(_0x538f81,null));};exports['update']=function(_0x7676a9,_0x6e6294){if(_0x7676a9['body']['id']){delete _0x7676a9[_0x82af('0x49')]['id'];}return db[_0x82af('0x3f')][_0x82af('0x47')]({'where':{'id':_0x7676a9[_0x82af('0x45')]['id']}})[_0x82af('0x26')](handleEntityNotFound(_0x6e6294,null))[_0x82af('0x26')](saveUpdates(_0x7676a9[_0x82af('0x49')],null))[_0x82af('0x26')](respondWithResult(_0x6e6294,null))['catch'](handleError(_0x6e6294,null));};exports[_0x82af('0x4a')]=function(_0x154d45,_0x559175){return db[_0x82af('0x3f')]['find']({'where':{'id':_0x154d45[_0x82af('0x45')]['id']}})[_0x82af('0x26')](handleEntityNotFound(_0x559175,null))[_0x82af('0x26')](removeEntity(_0x559175,null))[_0x82af('0x43')](handleError(_0x559175,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 7d2f2a3..15a47a7 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 _0xb65d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x1097ab,_0x37fce2){var _0x416667=function(_0x3ff972){while(--_0x3ff972){_0x1097ab['push'](_0x1097ab['shift']());}};_0x416667(++_0x37fce2);}(_0xb65d,0xef));var _0xdb65=function(_0x296554,_0x546b51){_0x296554=_0x296554-0x0;var _0x83774b=_0xb65d[_0x296554];return _0x83774b;};'use strict';var _=require(_0xdb65('0x0'));var util=require(_0xdb65('0x1'));var logger=require(_0xdb65('0x2'))(_0xdb65('0x3'));var moment=require(_0xdb65('0x4'));var BPromise=require(_0xdb65('0x5'));var rp=require(_0xdb65('0x6'));var fs=require('fs');var path=require(_0xdb65('0x7'));var rimraf=require(_0xdb65('0x8'));var config=require('../../config/environment');var attributes=require(_0xdb65('0x9'));module[_0xdb65('0xa')]=function(_0x48d663,_0x9891c8){return _0x48d663[_0xdb65('0xb')](_0xdb65('0xc'),attributes,{'tableName':_0xdb65('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdb65('0xe'),'collate':_0xdb65('0xf')});}; \ No newline at end of file +var _0xcc40=['bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x2a44d7,_0x4340b1){var _0x160a81=function(_0x555d2e){while(--_0x555d2e){_0x2a44d7['push'](_0x2a44d7['shift']());}};_0x160a81(++_0x4340b1);}(_0xcc40,0x12f));var _0x0cc4=function(_0x4504a7,_0x563a15){_0x4504a7=_0x4504a7-0x0;var _0x1b3b76=_0xcc40[_0x4504a7];return _0x1b3b76;};'use strict';var _=require(_0x0cc4('0x0'));var util=require(_0x0cc4('0x1'));var logger=require(_0x0cc4('0x2'))(_0x0cc4('0x3'));var moment=require(_0x0cc4('0x4'));var BPromise=require(_0x0cc4('0x5'));var rp=require(_0x0cc4('0x6'));var fs=require('fs');var path=require(_0x0cc4('0x7'));var rimraf=require('rimraf');var config=require(_0x0cc4('0x8'));var attributes=require(_0x0cc4('0x9'));module['exports']=function(_0x138fe6,_0x11189b){return _0x138fe6[_0x0cc4('0xa')](_0x0cc4('0xb'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0cc4('0xc'),'collate':_0x0cc4('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 30d6665..42b0258 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 _0xf374=['options','raw','attributes','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FaxApplication,\x20%s,\x20%s','UpdateFaxApplication','body'];(function(_0xc8db6b,_0x320abd){var _0x12cb81=function(_0x417540){while(--_0x417540){_0xc8db6b['push'](_0xc8db6b['shift']());}};_0x12cb81(++_0x320abd);}(_0xf374,0x199));var _0x4f37=function(_0x3cbf59,_0x4617dc){_0x3cbf59=_0x3cbf59-0x0;var _0x25f158=_0xf374[_0x3cbf59];return _0x25f158;};'use strict';var _=require(_0x4f37('0x0'));var util=require(_0x4f37('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4f37('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f37('0x3'))['db'];var utils=require(_0x4f37('0x4'));var logger=require(_0x4f37('0x5'))(_0x4f37('0x6'));var config=require(_0x4f37('0x7'));var jayson=require(_0x4f37('0x8'));var client=jayson[_0x4f37('0x9')][_0x4f37('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5df54f,_0x784ae0,_0x51bd34){return new BPromise(function(_0x4d1101,_0x294b33){return client[_0x4f37('0xb')](_0x5df54f,_0x51bd34)[_0x4f37('0xc')](function(_0x4a8fad){logger[_0x4f37('0xd')]('FaxApplication,\x20%s,\x20%s',_0x784ae0,'request\x20sent');logger[_0x4f37('0xe')](_0x4f37('0xf'),_0x784ae0,_0x4f37('0x10'),JSON[_0x4f37('0x11')](_0x4a8fad));if(_0x4a8fad[_0x4f37('0x12')]){if(_0x4a8fad[_0x4f37('0x12')][_0x4f37('0x13')]===0x1f4){logger[_0x4f37('0x12')]('FaxApplication,\x20%s,\x20%s',_0x784ae0,_0x4a8fad[_0x4f37('0x12')][_0x4f37('0x14')]);return _0x294b33(_0x4a8fad[_0x4f37('0x12')]['message']);}logger[_0x4f37('0x12')]('FaxApplication,\x20%s,\x20%s',_0x784ae0,_0x4a8fad[_0x4f37('0x12')][_0x4f37('0x14')]);return _0x4d1101(_0x4a8fad['error']['message']);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0x784ae0,_0x4f37('0x10'));_0x4d1101(_0x4a8fad[_0x4f37('0x15')]['message']);}})[_0x4f37('0x16')](function(_0x43000b){logger['error'](_0x4f37('0x17'),_0x784ae0,_0x43000b);_0x294b33(_0x43000b);});});}exports[_0x4f37('0x18')]=function(_0x132326){var _0x2cb16f=this;return new Promise(function(_0x1a3abf,_0x4e68d3){return db['FaxApplication']['update'](_0x132326[_0x4f37('0x19')],{'raw':_0x132326[_0x4f37('0x1a')]?_0x132326['options'][_0x4f37('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x132326[_0x4f37('0x1a')]?_0x132326[_0x4f37('0x1a')]['where']||null:null,'attributes':_0x132326[_0x4f37('0x1a')]?_0x132326[_0x4f37('0x1a')][_0x4f37('0x1c')]||null:null,'limit':_0x132326[_0x4f37('0x1a')]?_0x132326['options']['limit']||null:null})['then'](function(_0x48e599){logger[_0x4f37('0xd')](_0x4f37('0x18'),_0x132326);logger['debug'](_0x4f37('0x18'),_0x132326,JSON['stringify'](_0x48e599));_0x1a3abf(_0x48e599);})[_0x4f37('0x16')](function(_0x3a3663){logger['error']('UpdateFaxApplication',_0x3a3663[_0x4f37('0x14')],_0x132326);_0x4e68d3(_0x2cb16f[_0x4f37('0x12')](0x1f4,_0x3a3663[_0x4f37('0x14')]));});});}; \ No newline at end of file +var _0x5191=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','body','options','attributes','lodash','util','bluebird'];(function(_0x3a7e01,_0x51204c){var _0x5b8398=function(_0x4dcfab){while(--_0x4dcfab){_0x3a7e01['push'](_0x3a7e01['shift']());}};_0x5b8398(++_0x51204c);}(_0x5191,0x89));var _0x1519=function(_0x4bad6c,_0x29ec89){_0x4bad6c=_0x4bad6c-0x0;var _0x46ac3b=_0x5191[_0x4bad6c];return _0x46ac3b;};'use strict';var _=require(_0x1519('0x0'));var util=require(_0x1519('0x1'));var moment=require('moment');var BPromise=require(_0x1519('0x2'));var rs=require(_0x1519('0x3'));var fs=require('fs');var Redis=require(_0x1519('0x4'));var db=require(_0x1519('0x5'))['db'];var utils=require(_0x1519('0x6'));var logger=require('../../config/logger')(_0x1519('0x7'));var config=require(_0x1519('0x8'));var jayson=require(_0x1519('0x9'));var client=jayson[_0x1519('0xa')][_0x1519('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bbe6e,_0x528987,_0x336a21){return new BPromise(function(_0x47675c,_0x8370b1){return client[_0x1519('0xc')](_0x5bbe6e,_0x336a21)[_0x1519('0xd')](function(_0x1f5be9){logger[_0x1519('0xe')]('FaxApplication,\x20%s,\x20%s',_0x528987,'request\x20sent');logger[_0x1519('0xf')](_0x1519('0x10'),_0x528987,_0x1519('0x11'),JSON['stringify'](_0x1f5be9));if(_0x1f5be9[_0x1519('0x12')]){if(_0x1f5be9[_0x1519('0x12')]['code']===0x1f4){logger[_0x1519('0x12')](_0x1519('0x13'),_0x528987,_0x1f5be9[_0x1519('0x12')][_0x1519('0x14')]);return _0x8370b1(_0x1f5be9[_0x1519('0x12')][_0x1519('0x14')]);}logger['error'](_0x1519('0x13'),_0x528987,_0x1f5be9[_0x1519('0x12')]['message']);return _0x47675c(_0x1f5be9[_0x1519('0x12')][_0x1519('0x14')]);}else{logger[_0x1519('0xe')](_0x1519('0x13'),_0x528987,_0x1519('0x11'));_0x47675c(_0x1f5be9[_0x1519('0x15')]['message']);}})[_0x1519('0x16')](function(_0x4413b8){logger[_0x1519('0x12')](_0x1519('0x13'),_0x528987,_0x4413b8);_0x8370b1(_0x4413b8);});});}exports[_0x1519('0x17')]=function(_0x3380fa){var _0x34089f=this;return new Promise(function(_0x334170,_0x12d94a){return db[_0x1519('0x18')]['update'](_0x3380fa[_0x1519('0x19')],{'raw':_0x3380fa[_0x1519('0x1a')]?_0x3380fa['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3380fa[_0x1519('0x1a')]?_0x3380fa['options']['where']||null:null,'attributes':_0x3380fa['options']?_0x3380fa['options'][_0x1519('0x1b')]||null:null,'limit':_0x3380fa['options']?_0x3380fa[_0x1519('0x1a')]['limit']||null:null})[_0x1519('0xd')](function(_0x878d35){logger[_0x1519('0xe')](_0x1519('0x17'),_0x3380fa);logger[_0x1519('0xf')]('UpdateFaxApplication',_0x3380fa,JSON['stringify'](_0x878d35));_0x334170(_0x878d35);})[_0x1519('0x16')](function(_0xe08151){logger[_0x1519('0x12')](_0x1519('0x17'),_0xe08151[_0x1519('0x14')],_0x3380fa);_0x12d94a(_0x34089f['error'](0x1f4,_0xe08151[_0x1519('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 790f307..75695be 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 _0x98a8=['express','Router','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x4851da,_0x1d6697){var _0x2b5b1a=function(_0x336620){while(--_0x336620){_0x4851da['push'](_0x4851da['shift']());}};_0x2b5b1a(++_0x1d6697);}(_0x98a8,0x12c));var _0x898a=function(_0x14d48b,_0x2b97c1){_0x14d48b=_0x14d48b-0x0;var _0x412f6b=_0x98a8[_0x14d48b];return _0x412f6b;};'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 auth=require(_0x898a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x898a('0x7'));var controller=require(_0x898a('0x8'));router[_0x898a('0x9')]('/',auth[_0x898a('0xa')](),controller[_0x898a('0xb')]);router['get'](_0x898a('0xc'),auth['isAuthenticated'](),controller[_0x898a('0xd')]);router['post']('/',auth[_0x898a('0xa')](),controller[_0x898a('0xe')]);router[_0x898a('0xf')](_0x898a('0xc'),auth[_0x898a('0xa')](),controller[_0x898a('0x10')]);router[_0x898a('0x11')](_0x898a('0xc'),auth[_0x898a('0xa')](),controller['destroy']);module[_0x898a('0x12')]=router; \ No newline at end of file +var _0xbd51=['put','update','delete','destroy','multer','path','connect-timeout','express','Router','get','isAuthenticated','index','/:id','show','post'];(function(_0x24d28d,_0x333f54){var _0x4c528c=function(_0x2d4266){while(--_0x2d4266){_0x24d28d['push'](_0x24d28d['shift']());}};_0x4c528c(++_0x333f54);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x337c3a,_0x5674da){_0x337c3a=_0x337c3a-0x0;var _0x270073=_0xbd51[_0x337c3a];return _0x270073;};'use strict';var multer=require(_0x1bd5('0x0'));var util=require('util');var path=require(_0x1bd5('0x1'));var timeout=require(_0x1bd5('0x2'));var express=require(_0x1bd5('0x3'));var router=express[_0x1bd5('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxApplication.controller');router[_0x1bd5('0x5')]('/',auth[_0x1bd5('0x6')](),controller[_0x1bd5('0x7')]);router['get'](_0x1bd5('0x8'),auth[_0x1bd5('0x6')](),controller[_0x1bd5('0x9')]);router[_0x1bd5('0xa')]('/',auth[_0x1bd5('0x6')](),controller['create']);router[_0x1bd5('0xb')]('/:id',auth[_0x1bd5('0x6')](),controller[_0x1bd5('0xc')]);router[_0x1bd5('0xd')](_0x1bd5('0x8'),auth[_0x1bd5('0x6')](),controller[_0x1bd5('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index df09f0b..f71dc5d 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 _0x56e7=['DATE','ENUM','out','exports','BOOLEAN','STRING'];(function(_0x6ab30c,_0x2c713b){var _0x36e953=function(_0x1aea9a){while(--_0x1aea9a){_0x6ab30c['push'](_0x6ab30c['shift']());}};_0x36e953(++_0x2c713b);}(_0x56e7,0x7b));var _0x756e=function(_0xf2faa3,_0x4a77a7){_0xf2faa3=_0xf2faa3-0x0;var _0x34b2fe=_0x56e7[_0xf2faa3];return _0x34b2fe;};'use strict';var Sequelize=require('sequelize');module[_0x756e('0x0')]={'closed':{'type':Sequelize[_0x756e('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x756e('0x2')]},'secondDisposition':{'type':Sequelize[_0x756e('0x2')]},'thirdDisposition':{'type':Sequelize[_0x756e('0x2')]},'note':{'type':Sequelize[_0x756e('0x2')]},'read1stAt':{'type':Sequelize[_0x756e('0x3')]},'fax':{'type':Sequelize[_0x756e('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x756e('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x756e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x756e('0x4')]('in',_0x756e('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x6108=['out','ENUM','sequelize','BOOLEAN','DATE','STRING'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x6108,0xbc));var _0x8610=function(_0x232c9a,_0x379ee0){_0x232c9a=_0x232c9a-0x0;var _0x153282=_0x6108[_0x232c9a];return _0x153282;};'use strict';var Sequelize=require(_0x8610('0x0'));module['exports']={'closed':{'type':Sequelize[_0x8610('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8610('0x2')]},'disposition':{'type':Sequelize[_0x8610('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8610('0x3')]},'read1stAt':{'type':Sequelize[_0x8610('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x8610('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8610('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x8610('0x5')]('in',_0x8610('0x4')),'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 5c879a2..f8f9a45 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 _0x06b6=['\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','sequelize','toString','count','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','rows','show','params','rawAttributes','intersection','includeAll','create','describe','addMessage','FaxMessage','ids','getMessages','findOne','sort','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','addTags','setTags','omit','faxInteractionTags:save','removeTags','join','root','server','files','tmp','transcript-%d-%s.zip','Attachment','Messages','mkdirSync','basename','existsSync','createReadStream','pipe','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','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','redis','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','update','destroy','then','stack','name','send','Users','map','fullname','TagIds','Tags','forEach','push','catch','index','FaxInteraction','fieldName','type','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','fax_interactions','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20>\x200','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','ContactId','buildExpression','text','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','find','UserId','start','body','some','compact','isEmpty','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null'];(function(_0x503306,_0x356f2f){var _0x44a99d=function(_0x1a6ec4){while(--_0x1a6ec4){_0x503306['push'](_0x503306['shift']());}};_0x44a99d(++_0x356f2f);}(_0x06b6,0x12f));var _0x606b=function(_0x6ea62c,_0x27bd26){_0x6ea62c=_0x6ea62c-0x0;var _0x48ec5d=_0x06b6[_0x6ea62c];return _0x48ec5d;};'use strict';var pdf=require(_0x606b('0x0'));var emlformat=require(_0x606b('0x1'));var rimraf=require(_0x606b('0x2'));var zipdir=require(_0x606b('0x3'));var jsonpatch=require(_0x606b('0x4'));var rp=require(_0x606b('0x5'));var moment=require(_0x606b('0x6'));var BPromise=require(_0x606b('0x7'));var Mustache=require(_0x606b('0x8'));var util=require(_0x606b('0x9'));var path=require(_0x606b('0xa'));var sox=require(_0x606b('0xb'));var csv=require(_0x606b('0xc'));var ejs=require(_0x606b('0xd'));var fs=require('fs');var _=require(_0x606b('0xe'));var squel=require(_0x606b('0xf'));var crypto=require(_0x606b('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x606b('0x11'));var toCsv=require(_0x606b('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x606b('0x12'));var qs=require(_0x606b('0x13'));var as=require(_0x606b('0x14'));var hardwareService=require(_0x606b('0x15'));var logger=require(_0x606b('0x16'))(_0x606b('0x17'));var utils=require(_0x606b('0x18'));var config=require(_0x606b('0x19'));var licenseUtil=require(_0x606b('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x606b('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x606b('0x1c'))(new Redis(config[_0x606b('0x1b')]));require(_0x606b('0x1d'))[_0x606b('0x1e')](socket);function respondWithStatusCode(_0x5ae54d,_0xc1ba8e){_0xc1ba8e=_0xc1ba8e||0xcc;return function(_0x5af9c7){if(_0x5af9c7){return _0x5ae54d[_0x606b('0x1f')](_0xc1ba8e);}return _0x5ae54d[_0x606b('0x20')](_0xc1ba8e)[_0x606b('0x21')]();};}function respondWithResult(_0x4f77a7,_0x3f9865){_0x3f9865=_0x3f9865||0xc8;return function(_0x59a447){if(_0x59a447){return _0x4f77a7['status'](_0x3f9865)[_0x606b('0x22')](_0x59a447);}};}function respondWithFilteredResult(_0xf7a218,_0x57fad8){return function(_0x19b9cd){if(_0x19b9cd){var _0x2587e8=_0x19b9cd['count'],_0x1181a6=_0x57fad8[_0x606b('0x23')],_0x3bdd33=_0x57fad8[_0x606b('0x23')]+_0x57fad8[_0x606b('0x24')],_0x549975;if(_0x3bdd33>=_0x2587e8){_0x3bdd33=_0x2587e8;_0x549975=0xc8;}else{_0x549975=0xce;}_0xf7a218[_0x606b('0x20')](_0x549975);return _0xf7a218[_0x606b('0x25')](_0x606b('0x26'),_0x1181a6+'-'+_0x3bdd33+'/'+_0x2587e8)[_0x606b('0x22')](_0x19b9cd);}return null;};}function patchUpdates(_0x5d42a3){return function(_0x4a6642){try{jsonpatch['apply'](_0x4a6642,_0x5d42a3,!![]);}catch(_0x469686){return BPromise[_0x606b('0x27')](_0x469686);}return _0x4a6642[_0x606b('0x28')]();};}function saveUpdates(_0x22dd9e,_0x4c8737){return function(_0x566f01){if(_0x566f01){return _0x566f01[_0x606b('0x29')](_0x22dd9e)['then'](function(_0x158c26){return _0x158c26;});}return null;};}function removeEntity(_0x3f756f,_0xf87c68){return function(_0x566adb){if(_0x566adb){return _0x566adb[_0x606b('0x2a')]()[_0x606b('0x2b')](function(){_0x3f756f[_0x606b('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd1914,_0x203384){return function(_0x377158){if(!_0x377158){_0xd1914[_0x606b('0x1f')](0x194);}return _0x377158;};}function handleError(_0x32c717,_0x1f68b0){_0x1f68b0=_0x1f68b0||0x1f4;return function(_0x54d5bb){logger['error'](_0x54d5bb[_0x606b('0x2c')]);if(_0x54d5bb[_0x606b('0x2d')]){delete _0x54d5bb[_0x606b('0x2d')];}_0x32c717[_0x606b('0x20')](_0x1f68b0)[_0x606b('0x2e')](_0x54d5bb);};}function getInteractionUsers(_0x43d352,_0x5183b4){return new BPromise(function(_0x28b46a,_0x5e7da6){try{if(_0x5183b4[_0x43d352['id']]){_0x43d352[_0x606b('0x2f')]=_[_0x606b('0x30')](_0x5183b4[_0x43d352['id']],function(_0xb8ca04){return{'id':_0xb8ca04['id'],'fullname':_0xb8ca04[_0x606b('0x31')]};});}}catch(_0x3cc796){_0x5e7da6(_0x3cc796);}_0x28b46a(_0x43d352);});}function getInteractionTags(_0x542757,_0x3da16e){return new BPromise(function(_0x5ab64a,_0x1c222c){try{if(_0x542757[_0x606b('0x32')]){_0x542757[_0x606b('0x33')]=[];_0x542757[_0x606b('0x32')]['split'](',')[_0x606b('0x34')](function(_0x2db0d7){_0x542757[_0x606b('0x33')][_0x606b('0x35')](_0x3da16e[_0x2db0d7]);});}delete _0x542757[_0x606b('0x32')];}catch(_0x49c4dc){_0x1c222c(_0x49c4dc);}_0x5ab64a(_0x542757);});}function updateFaxInteraction(_0x3d77ec,_0x379d6d,_0x5a5048){return new BPromise(function(_0x3c03b9,_0x170e2a){return getInteractionUsers(_0x3d77ec,_0x5a5048)[_0x606b('0x2b')](function(_0x1d059a){return getInteractionTags(_0x1d059a,_0x379d6d);})[_0x606b('0x2b')](function(_0x681c64){_0x3c03b9(_0x681c64);})[_0x606b('0x36')](function(_0x238a55){_0x170e2a(_0x238a55);});});}exports[_0x606b('0x37')]=function(_0x588c6f,_0x470a90){var _0x684d77={},_0x2f9f4f={},_0x735e0={'count':0x0,'rows':[]};var _0x2ec130=_[_0x606b('0x30')](db[_0x606b('0x38')]['rawAttributes'],function(_0x550a21){return{'name':_0x550a21[_0x606b('0x39')],'type':_0x550a21[_0x606b('0x3a')][_0x606b('0x3b')]};});_0x2f9f4f[_0x606b('0x3c')]=_[_0x606b('0x30')](_0x2ec130,_0x606b('0x2d'));_0x2f9f4f['query']=_[_0x606b('0x3d')](_0x588c6f[_0x606b('0x3e')]);_0x2f9f4f[_0x606b('0x3f')]=_['intersection'](_0x2f9f4f[_0x606b('0x3c')],_0x2f9f4f['query']);_0x684d77['attributes']=_['intersection'](_0x2f9f4f[_0x606b('0x3c')],qs[_0x606b('0x40')](_0x588c6f['query'][_0x606b('0x40')]));_0x684d77['attributes']=_0x684d77[_0x606b('0x41')][_0x606b('0x42')]?_0x684d77[_0x606b('0x41')]:_0x2f9f4f[_0x606b('0x3c')];if(!_0x588c6f[_0x606b('0x3e')][_0x606b('0x43')](_0x606b('0x44'))){_0x684d77[_0x606b('0x24')]=qs[_0x606b('0x24')](_0x588c6f[_0x606b('0x3e')][_0x606b('0x24')]);_0x684d77[_0x606b('0x23')]=qs[_0x606b('0x23')](_0x588c6f[_0x606b('0x3e')][_0x606b('0x23')]);}_0x684d77[_0x606b('0x45')]=qs['sort'](_0x588c6f[_0x606b('0x3e')]['sort']);_0x684d77[_0x606b('0x46')]=qs[_0x606b('0x3f')](_[_0x606b('0x47')](_0x588c6f['query'],_0x2f9f4f[_0x606b('0x3f')]),_0x2ec130);var _0xd74506=[];var _0x584579=squel[_0x606b('0x48')]()[_0x606b('0x49')]('id')[_0x606b('0x49')](_0x606b('0x2d'))['field'](_0x606b('0x4a'))[_0x606b('0x4b')](_0x606b('0x4c'));var _0x2844cc=squel[_0x606b('0x48')]()[_0x606b('0x49')](_0x606b('0x4d'))[_0x606b('0x49')](_0x606b('0x4e'))['field'](_0x606b('0x4f'))['from'](_0x606b('0x50'),'ui')[_0x606b('0x51')](_0x606b('0x52'),'u','u.id\x20=\x20ui.UserId');var _0x207d32=squel[_0x606b('0x48')]()['from'](_0x606b('0x53'),'i')[_0x606b('0x51')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x606b('0x51')](_0x606b('0x52'),'o',_0x606b('0x54'))[_0x606b('0x51')](_0x606b('0x55'),'a',_0x606b('0x56'))[_0x606b('0x51')](_0x606b('0x57'),'me',_0x606b('0x58'))[_0x606b('0x51')](_0x606b('0x59'),'it',_0x606b('0x5a'))[_0x606b('0x51')](_0x606b('0x4c'),'t','t.id\x20=\x20it.TagId');var _0x2acf3a=squel[_0x606b('0x5b')]();var _0x1057f5=[];var _0x2cdfd4=squel[_0x606b('0x5b')]();var _0x3190d4;if(_0x588c6f[_0x606b('0x3e')][_0x606b('0x5c')]){_0x3190d4=as['parseSearch'](_0x588c6f['query'][_0x606b('0x5c')]);var _0x368faa=_0x3190d4[_0x606b('0x5d')];for(var _0x4591b8=0x0;_0x4591b8<_0x3190d4[_0x606b('0x5e')][_0x606b('0x42')];_0x4591b8++){var _0x5eb39e=_0x3190d4[_0x606b('0x5e')][_0x4591b8];var _0x176b26='i';var _0x5b79b9=_['find'](_0x2ec130,[_0x606b('0x2d'),_0x5eb39e[_0x606b('0x49')]]);if(!_0x5b79b9){switch(_0x5eb39e[_0x606b('0x49')]){case _0x606b('0x5f'):if(_0x5eb39e[_0x606b('0x60')]==0x1){_0x207d32['having']('`'+_0x5eb39e[_0x606b('0x49')]+'`\x20=\x200');}else{_0x207d32[_0x606b('0x61')]('`'+_0x5eb39e[_0x606b('0x49')]+_0x606b('0x62'));}break;case'Contact':if(_0x5eb39e[_0x606b('0x63')]==='$substring'){if(_0x5eb39e['value']['split']('\x20')[_0x606b('0x42')]>0x1){_0x2acf3a[_0x368faa](_0x606b('0x64'),qs['getFullTextValue'](_0x5eb39e[_0x606b('0x60')]),null);}else{var _0x589ab9='%'+_0x5eb39e[_0x606b('0x60')]+'%';_0x2acf3a[_0x368faa]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x589ab9,_0x589ab9,_0x589ab9);}}else{_0x5b79b9=_['find'](_0x2ec130,[_0x606b('0x2d'),_0x606b('0x65')]);_0x5eb39e[_0x606b('0x49')]=_0x606b('0x65');_0x3895b1=as[_0x606b('0x66')](_0x176b26,_0x5b79b9[_0x606b('0x3a')],_0x5eb39e);_0x2acf3a[_0x368faa](_0x3895b1[_0x606b('0x67')],_0x3895b1[_0x606b('0x60')]['start'],_0x3895b1[_0x606b('0x60')][_0x606b('0x21')]);}break;case _0x606b('0x68'):var _0x56b53d=_0x5eb39e[_0x606b('0x60')][_0x606b('0x69')](',')['map'](function(_0x56f601){return Number(_0x56f601);});_0x56b53d[_0x606b('0x34')](function(_0x28f82f){_0x2cdfd4['or'](_0x606b('0x6a'),'%,'+_0x28f82f+',%');});_0x1057f5=_[_0x606b('0x6b')](_0x1057f5,_0x56b53d);break;case _0x606b('0x6c'):if(_0x5eb39e[_0x606b('0x63')]==='$substring'){_0x2acf3a[_0x368faa]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5eb39e['value']+'%',null);}else{_0x5b79b9=_[_0x606b('0x6d')](_0x2ec130,['name',_0x606b('0x6e')]);_0x5eb39e[_0x606b('0x49')]='UserId';_0x3895b1=as['buildExpression'](_0x176b26,_0x5b79b9[_0x606b('0x3a')],_0x5eb39e);_0x2acf3a[_0x368faa](_0x3895b1[_0x606b('0x67')],_0x3895b1[_0x606b('0x60')][_0x606b('0x6f')],_0x3895b1[_0x606b('0x60')][_0x606b('0x21')]);}break;case _0x606b('0x70'):_0x3895b1=as[_0x606b('0x66')]('me',null,_0x5eb39e);_0x2acf3a[_0x368faa](_0x3895b1[_0x606b('0x67')],_0x3895b1[_0x606b('0x60')]['start'],_0x3895b1[_0x606b('0x60')][_0x606b('0x21')]);break;}}else{var _0x3895b1=as[_0x606b('0x66')](_0x176b26,_0x5b79b9[_0x606b('0x3a')],_0x5eb39e);_0x2acf3a[_0x368faa](_0x3895b1[_0x606b('0x67')],_0x3895b1[_0x606b('0x60')][_0x606b('0x6f')],_0x3895b1[_0x606b('0x60')][_0x606b('0x21')]);}}}else{var _0x12ed90=_(_0x588c6f[_0x606b('0x3e')])['keys']()[_0x606b('0x30')](function(_0x5b6bd1){return _[_0x606b('0x71')](_0x2ec130,[_0x606b('0x2d'),_0x5b6bd1])?_0x5b6bd1:undefined;})[_0x606b('0x72')]()[_0x606b('0x60')]();if(!_[_0x606b('0x73')](_0x12ed90)){_0x12ed90[_0x606b('0x34')](function(_0x4490cc){if(_0x4490cc==='FaxAccountId'){_0x207d32['where'](_0x606b('0x74'),[][_0x606b('0x75')](_0x588c6f[_0x606b('0x3e')][_0x4490cc]));}else if(_0x4490cc===_0x606b('0x76')){var _0x5387d7=JSON[_0x606b('0x77')](_0x588c6f[_0x606b('0x3e')][_0x4490cc])[_0x606b('0x78')];var _0x4d5f06=JSON['parse'](_0x588c6f[_0x606b('0x3e')][_0x4490cc])[_0x606b('0x79')];_0x207d32[_0x606b('0x46')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5387d7,_0x4d5f06);}else{if(_0x588c6f[_0x606b('0x3e')][_0x4490cc]===_0x606b('0x7a')){_0x207d32['where']('i.'+_0x4490cc+_0x606b('0x7b'));}else{_0x207d32['where']('i.'+_0x4490cc+_0x606b('0x7c'),_0x588c6f[_0x606b('0x3e')][_0x4490cc]);}}});}if(_0x588c6f[_0x606b('0x3e')][_0x606b('0x7d')]){if(_0x588c6f[_0x606b('0x3e')]['read']==0x1){_0x207d32[_0x606b('0x61')](_0x606b('0x7e'));}else{_0x207d32[_0x606b('0x61')](_0x606b('0x7f'));}}if(_0x588c6f[_0x606b('0x3e')][_0x606b('0x80')]){_0x1057f5=_['isArray'](_0x588c6f[_0x606b('0x3e')][_0x606b('0x80')])?_0x588c6f[_0x606b('0x3e')][_0x606b('0x80')]:new Array(_0x588c6f[_0x606b('0x3e')][_0x606b('0x80')]);_0x1057f5[_0x606b('0x34')](function(_0x47564c){_0x2cdfd4['or'](_0x606b('0x6a'),'%,'+_0x47564c+',%');});}if(_0x588c6f['query'][_0x606b('0x81')]){var _0x91cd76=_0x588c6f['query'][_0x606b('0x81')]['replace']('\x5c','\x5c\x5c')[_0x606b('0x82')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x91cd76)){_0x2acf3a['or'](_0x606b('0x83'),_0x91cd76+'%')['or'](_0x606b('0x84'),_0x91cd76+'%');}_0x2acf3a['or'](_0x606b('0x85'),_0x91cd76+'%');}}_0x207d32[_0x606b('0x46')](_0x2acf3a);_0x207d32['group'](_0x606b('0x86'));var _0x4334da={'type':db[_0x606b('0x87')][_0x606b('0x88')][_0x606b('0x89')],'raw':!![]};var _0x5326c2=_0x207d32[_0x606b('0x8a')]();_0x5326c2[_0x606b('0x49')](_0x606b('0x86'));_0x5326c2[_0x606b('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x606b('0x5f'));if(_0x684d77[_0x606b('0x45')]){_0x684d77['order'][_0x606b('0x34')](function(_0x40774d){var _0xf0ae3a=_0x40774d[0x0]===_0x606b('0x8b')?_0x40774d[0x0]:'i.'+_0x40774d[0x0];_0x207d32[_0x606b('0x45')](_0xf0ae3a,_0x40774d[0x1]===_0x606b('0x8c')?![]:!![]);});}if(!_[_0x606b('0x73')](_0x1057f5)){_0x207d32[_0x606b('0x61')](_0x2cdfd4);_0x5326c2[_0x606b('0x46')]('t.id\x20IN\x20?',_0x1057f5);}BPromise[_0x606b('0x8d')]()[_0x606b('0x2b')](function(){if(!_0x3190d4){if(_0x588c6f[_0x606b('0x3e')][_0x606b('0x8e')])return;_0x5326c2[_0x606b('0x46')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x207d32['where'](_0x606b('0x8f'));return;}if(_0x588c6f[_0x606b('0x90')][_0x606b('0x91')]!==_0x606b('0x92'))return;return _0x588c6f[_0x606b('0x90')][_0x606b('0x93')]({'attributes':['id'],'raw':!![]})[_0x606b('0x2b')](function(_0x5dbd57){if(_[_0x606b('0x73')](_0x5dbd57)){_0x5326c2[_0x606b('0x46')]('i.FaxAccountId\x20IS\x20NULL');_0x207d32['where']('i.FaxAccountId\x20IS\x20NULL');}else{_0x5326c2[_0x606b('0x46')](_0x606b('0x74'),_[_0x606b('0x30')](_0x5dbd57,'id'));_0x207d32['where'](_0x606b('0x74'),_[_0x606b('0x30')](_0x5dbd57,'id'));}});})[_0x606b('0x2b')](function(){if(_0x588c6f[_0x606b('0x90')][_0x606b('0x91')]==='agent'&&!_0x3190d4&&!_0x588c6f[_0x606b('0x3e')]['FaxAccountId'])return[];return db[_0x606b('0x94')][_0x606b('0x3e')](_0x5326c2[_0x606b('0x95')](),_0x4334da);})[_0x606b('0x2b')](function(_0x7684da){_0x735e0[_0x606b('0x96')]=_0x7684da['length'];if(_0x735e0['count']===0x0)return[];return db[_0x606b('0x94')][_0x606b('0x3e')](_0x584579[_0x606b('0x95')](),_0x4334da)[_0x606b('0x2b')](function(_0x4a412b){_0xd74506=_['keyBy'](_0x4a412b,'id');_0x4334da=_[_0x606b('0x97')](_0x4334da,{'model':db[_0x606b('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x588c6f[_0x606b('0x3e')]['fields']){_0x684d77[_0x606b('0x41')]['forEach'](function(_0x25086b){_0x207d32[_0x606b('0x49')]('i.'+_0x25086b);});}else{_0x207d32[_0x606b('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x207d32[_0x606b('0x49')](_0x606b('0x98'),_0x606b('0x99'));_0x207d32[_0x606b('0x49')](_0x606b('0x9a'),_0x606b('0x9b'));_0x207d32[_0x606b('0x49')](_0x606b('0x9c'),_0x606b('0x8b'));_0x207d32[_0x606b('0x49')]('i.*');_0x207d32[_0x606b('0x49')]('c.firstName','Contact.firstName');_0x207d32[_0x606b('0x49')](_0x606b('0x9d'),_0x606b('0x9e'));_0x207d32[_0x606b('0x49')](_0x606b('0x9f'),'Contact.email');_0x207d32['field'](_0x606b('0xa0'),_0x606b('0xa1'));_0x207d32[_0x606b('0x49')](_0x606b('0xa2'),'Contact.mobile');_0x207d32[_0x606b('0x49')](_0x606b('0xa3'),_0x606b('0xa4'));_0x207d32[_0x606b('0x49')](_0x606b('0xa5'),'Owner.fullname');_0x207d32[_0x606b('0x49')](_0x606b('0xa6'),_0x606b('0xa7'));_0x207d32[_0x606b('0x49')](_0x606b('0xa8'),_0x606b('0x32'));}if(_0x684d77[_0x606b('0x24')])_0x207d32['limit'](_0x684d77[_0x606b('0x24')]);if(_0x684d77[_0x606b('0x23')])_0x207d32[_0x606b('0x23')](_0x684d77[_0x606b('0x23')]);return db['sequelize'][_0x606b('0x3e')](_0x207d32['toString'](),_0x4334da);})[_0x606b('0x2b')](function(_0x52f24f){_0x2844cc['where'](_0x606b('0xa9'),_['map'](_0x52f24f,'id'));return db['sequelize']['query'](_0x2844cc[_0x606b('0x95')](),_0x4334da)[_0x606b('0x2b')](function(_0x581155){var _0x1d8eb5=_[_0x606b('0xaa')](_0x581155,_0x606b('0xab'));var _0x4d6bd6=[];_0x52f24f[_0x606b('0x34')](function(_0x3b117f){_0x4d6bd6['push'](updateFaxInteraction(_0x3b117f,_0xd74506,_0x1d8eb5));});return BPromise[_0x606b('0xac')](_0x4d6bd6);});});})[_0x606b('0x2b')](function(_0x5f2460){_0x735e0[_0x606b('0xad')]=_0x5f2460;return _0x735e0;})['then'](respondWithFilteredResult(_0x470a90,_0x684d77))[_0x606b('0x36')](handleError(_0x470a90,null));};exports[_0x606b('0xae')]=function(_0xb24665,_0x2dc0df){var _0x18bbf6={'raw':![],'where':{'id':_0xb24665[_0x606b('0xaf')]['id']}},_0x21f123={};_0x21f123['model']=_['keys'](db[_0x606b('0x38')][_0x606b('0xb0')]);_0x21f123[_0x606b('0x3e')]=_['keys'](_0xb24665[_0x606b('0x3e')]);_0x21f123[_0x606b('0x3f')]=_[_0x606b('0xb1')](_0x21f123[_0x606b('0x3c')],_0x21f123[_0x606b('0x3e')]);_0x18bbf6[_0x606b('0x41')]=_[_0x606b('0xb1')](_0x21f123['model'],qs['fields'](_0xb24665['query']['fields']));_0x18bbf6[_0x606b('0x41')]=_0x18bbf6[_0x606b('0x41')][_0x606b('0x42')]?_0x18bbf6[_0x606b('0x41')]:_0x21f123[_0x606b('0x3c')];if(_0xb24665[_0x606b('0x3e')][_0x606b('0xb2')]){_0x18bbf6['include']=[{'all':!![]}];}_0x18bbf6=_[_0x606b('0x97')]({},_0x18bbf6,_0xb24665['options']);return db[_0x606b('0x38')][_0x606b('0x6d')](_0x18bbf6)[_0x606b('0x2b')](handleEntityNotFound(_0x2dc0df,null))[_0x606b('0x2b')](respondWithResult(_0x2dc0df,null))[_0x606b('0x36')](handleError(_0x2dc0df,null));};exports['create']=function(_0x39e55e,_0x2ec5e7){return db[_0x606b('0x38')][_0x606b('0xb3')](_0x39e55e[_0x606b('0x70')],{})[_0x606b('0x2b')](respondWithResult(_0x2ec5e7,0xc9))[_0x606b('0x36')](handleError(_0x2ec5e7,null));};exports[_0x606b('0x29')]=function(_0x1a9911,_0x4b1fd2){if(_0x1a9911[_0x606b('0x70')]['id']){delete _0x1a9911['body']['id'];}return db[_0x606b('0x38')][_0x606b('0x6d')]({'where':{'id':_0x1a9911[_0x606b('0xaf')]['id']}})['then'](handleEntityNotFound(_0x4b1fd2,null))[_0x606b('0x2b')](saveUpdates(_0x1a9911[_0x606b('0x70')],null))['then'](respondWithResult(_0x4b1fd2,null))[_0x606b('0x36')](handleError(_0x4b1fd2,null));};exports['destroy']=function(_0x324252,_0x31bc44){return db[_0x606b('0x38')][_0x606b('0x6d')]({'where':{'id':_0x324252[_0x606b('0xaf')]['id']}})['then'](handleEntityNotFound(_0x31bc44,null))[_0x606b('0x2b')](removeEntity(_0x31bc44,null))['catch'](handleError(_0x31bc44,null));};exports[_0x606b('0xb4')]=function(_0x43cffb,_0x3e7b6e){return db[_0x606b('0x38')][_0x606b('0xb4')]()['then'](respondWithResult(_0x3e7b6e,null))[_0x606b('0x36')](handleError(_0x3e7b6e,null));};exports[_0x606b('0xb5')]=function(_0x16ec24,_0x2efe30,_0x482c09){return db[_0x606b('0xb6')]['find']({'where':{'id':_0x16ec24['params']['id']}})['then'](handleEntityNotFound(_0x2efe30,null))[_0x606b('0x2b')](function(_0x5d15de){if(_0x5d15de){return _0x5d15de[_0x606b('0xb5')](_0x16ec24[_0x606b('0x70')][_0x606b('0xb7')],_['omit'](_0x16ec24[_0x606b('0x70')],['ids','id'])||{});}})['then'](respondWithResult(_0x2efe30,null))[_0x606b('0x36')](handleError(_0x2efe30,null));};exports[_0x606b('0xb8')]=function(_0xea1609,_0x1214c5,_0x5f0ebe){var _0x4495e5={'raw':![],'where':{}};var _0x5afd39={};var _0x497691={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x606b('0xb9')]({'where':{'id':_0xea1609[_0x606b('0xaf')]['id']}})[_0x606b('0x2b')](handleEntityNotFound(_0x1214c5,null))[_0x606b('0x2b')](function(_0x2f2d9b){if(_0x2f2d9b){_0x5afd39['model']=_[_0x606b('0x3d')](db[_0x606b('0xb6')][_0x606b('0xb0')]);_0x5afd39['query']=_[_0x606b('0x3d')](_0xea1609[_0x606b('0x3e')]);_0x5afd39[_0x606b('0x3f')]=_[_0x606b('0xb1')](_0x5afd39['model'],_0x5afd39['query']);_0x4495e5[_0x606b('0x41')]=_[_0x606b('0xb1')](_0x5afd39[_0x606b('0x3c')],qs['fields'](_0xea1609[_0x606b('0x3e')][_0x606b('0x40')]));_0x4495e5[_0x606b('0x41')]=_0x4495e5[_0x606b('0x41')][_0x606b('0x42')]?_0x4495e5[_0x606b('0x41')]:_0x5afd39['model'];if(!_0xea1609[_0x606b('0x3e')][_0x606b('0x43')]('nolimit')){_0x4495e5[_0x606b('0x24')]=qs[_0x606b('0x24')](_0xea1609[_0x606b('0x3e')]['limit']);_0x4495e5[_0x606b('0x23')]=qs[_0x606b('0x23')](_0xea1609[_0x606b('0x3e')]['offset']);}_0x4495e5[_0x606b('0x45')]=qs['sort'](_0xea1609['query'][_0x606b('0xba')]);_0x4495e5[_0x606b('0x46')]=qs[_0x606b('0x3f')](_['pick'](_0xea1609['query'],_0x5afd39['filters']));_0x4495e5[_0x606b('0x46')][_0x606b('0xab')]=_0x2f2d9b['id'];if(_0xea1609[_0x606b('0x3e')]['filter']){_0x4495e5[_0x606b('0x46')]=_['merge'](_0x4495e5[_0x606b('0x46')],{'$or':_[_0x606b('0x30')](_0x4495e5['attributes'],function(_0x1fcc40){var _0x227eb2={};_0x227eb2[_0x1fcc40]={'$like':'%'+_0xea1609[_0x606b('0x3e')][_0x606b('0x81')]+'%'};return _0x227eb2;})});}if(_0xea1609['query'][_0x606b('0x78')]){var _0x463c20=_0xea1609[_0x606b('0x3e')]['$gte'][_0x606b('0x69')](',');var _0x4e096b={};_0x4e096b[_0x463c20[0x0]]={'$gte':moment(_0x463c20[0x1])[_0x606b('0xbb')](_0x606b('0xbc'))};_0x4495e5['where']=_[_0x606b('0x97')](_0x4495e5[_0x606b('0x46')],_0x4e096b);}_0x4495e5=_[_0x606b('0x97')]({},_0x4495e5,_0xea1609[_0x606b('0xbd')]);return db[_0x606b('0xb6')][_0x606b('0x96')]({'where':_0x4495e5[_0x606b('0x46')]})[_0x606b('0x2b')](function(_0x593e0e){_0x497691[_0x606b('0x96')]=_0x593e0e;if(_0xea1609['query'][_0x606b('0xb2')]){_0x4495e5['include']=[{'all':!![]}];}return db[_0x606b('0xb6')][_0x606b('0xbe')](_0x4495e5);})[_0x606b('0x2b')](function(_0xf9b321){_0x497691[_0x606b('0xad')]=_0xf9b321;return _0x497691;});}})[_0x606b('0x2b')](respondWithFilteredResult(_0x1214c5,_0x4495e5))['catch'](handleError(_0x1214c5,null));};exports[_0x606b('0xbf')]=function(_0x47cd4b,_0x2ed2dc,_0x4e0e60){return db[_0x606b('0x38')][_0x606b('0x6d')]({'where':{'id':_0x47cd4b[_0x606b('0xaf')]['id']}})[_0x606b('0x2b')](handleEntityNotFound(_0x2ed2dc,null))[_0x606b('0x2b')](function(_0x5d4564){if(_0x5d4564){return _0x5d4564[_0x606b('0xc0')](_0x47cd4b['body']['ids'],_[_0x606b('0xc1')](_0x47cd4b[_0x606b('0x70')],['ids','id'])||{})['spread'](function(){return db[_0x606b('0x68')]['findAll']({'attributes':['id',_0x606b('0x2d'),_0x606b('0x4a')],'where':{'id':_0x47cd4b[_0x606b('0x70')][_0x606b('0xb7')]}});})[_0x606b('0x2b')](function(_0x3ff09b){socket['emit'](_0x606b('0xc2'),{'id':Number(_0x47cd4b[_0x606b('0xaf')]['id']),'tags':_0x3ff09b||[]});return{'id':Number(_0x47cd4b[_0x606b('0xaf')]['id']),'tags':_0x3ff09b||[]};});}})[_0x606b('0x2b')](respondWithResult(_0x2ed2dc,null))[_0x606b('0x36')](handleError(_0x2ed2dc,null));};exports[_0x606b('0xc3')]=function(_0x9e333c,_0x90b5c4,_0x14fe09){return db[_0x606b('0x38')][_0x606b('0x6d')]({'where':{'id':_0x9e333c[_0x606b('0xaf')]['id']}})[_0x606b('0x2b')](handleEntityNotFound(_0x90b5c4,null))[_0x606b('0x2b')](function(_0x26cbb8){if(_0x26cbb8){return _0x26cbb8[_0x606b('0xc3')](_0x9e333c[_0x606b('0x3e')][_0x606b('0xb7')]);}})[_0x606b('0x2b')](respondWithStatusCode(_0x90b5c4,null))[_0x606b('0x36')](handleError(_0x90b5c4,null));};exports['download']=function(_0x14fb4c,_0x4eaff1){var _0x2d165d=moment()['unix']()[_0x606b('0x95')]();var _0x458d63=path[_0x606b('0xc4')](config[_0x606b('0xc5')],_0x606b('0xc6'),_0x606b('0xc7'),_0x606b('0xc8'));var _0x2a961c=path['join'](config[_0x606b('0xc5')],'server',_0x606b('0xc7'),'attachments');var _0x379ced=path['join'](_0x458d63,_0x2d165d);var _0x4ad5dc=util[_0x606b('0xbb')](_0x606b('0xc9'),_0x14fb4c['params']['id'],_0x2d165d);var _0x4d0818=path[_0x606b('0xc4')](_0x458d63,_0x4ad5dc);var _0x18efea=[];_0x18efea[_0x606b('0x35')]({'model':db[_0x606b('0xca')],'as':_0x606b('0xca'),'raw':!![]});var _0x27fd04=[{'model':db['FaxMessage'],'as':_0x606b('0xcb'),'attributes':['id','body',_0x606b('0x76')],'include':_0x18efea}];return db[_0x606b('0x38')][_0x606b('0x6d')]({'where':{'id':_0x14fb4c[_0x606b('0xaf')]['id']},'include':_0x27fd04})[_0x606b('0x2b')](handleEntityNotFound(_0x4eaff1,null))[_0x606b('0x2b')](function(_0x4c1ef8){if(_0x4c1ef8&&_0x4c1ef8[_0x606b('0xcb')]){var _0x391c83=_0x4c1ef8['get']({'plain':!![]});fs[_0x606b('0xcc')](_0x379ced);for(var _0x32a1ae=0x0;_0x32a1ae<_0x391c83['Messages'][_0x606b('0x42')];_0x32a1ae++){var _0x36af56=_0x391c83[_0x606b('0xcb')][_0x32a1ae][_0x606b('0xca')];if(_0x36af56){var _0x2a95d6=path[_0x606b('0xc4')](_0x2a961c,_0x36af56[_0x606b('0xcd')]);if(fs[_0x606b('0xce')](_0x2a95d6)){fs[_0x606b('0xcf')](_0x2a95d6)[_0x606b('0xd0')](fs['createWriteStream'](path['join'](_0x379ced,_0x36af56['basename'])));}}}return BPromise[_0x606b('0x8d')]()[_0x606b('0x2b')](function(){return new BPromise(function(_0x47b8c8,_0x1f3dd5){zipdir(_0x379ced,{'saveTo':_0x4d0818},function(_0x3d2aff,_0x11d79e){if(_0x3d2aff)return _0x1f3dd5(_0x3d2aff);return _0x47b8c8(_0x11d79e);});})[_0x606b('0x2b')](function(){return new BPromise(function(_0x767afe,_0x54835d){rimraf(_0x379ced,function(_0xa65d){if(_0xa65d)_0x54835d(_0xa65d);return _0x767afe();});});})[_0x606b('0x2b')](function(){return _0x4eaff1[_0x606b('0xd1')](_0x4d0818,_0x4ad5dc,function(_0x3e04a6){if(_0x3e04a6){console[_0x606b('0xd2')](_0x606b('0xd3'),_0x3e04a6);}else{fs[_0x606b('0xd4')](_0x4d0818);}});});});}else{return _0x4eaff1['sendStatus'](0xc8);}})['catch'](handleError(_0x4eaff1,null));}; \ No newline at end of file +var _0x6767=['field','ui.FaxInteractionId','left_join','users','u.id\x20=\x20ui.UserId','from','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20>\x200','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','agent','user','i.FaxAccountId\x20IS\x20NULL','role','toString','count','sequelize','keyBy','merge','FaxInteraction','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','show','params','include','options','create','describe','addMessage','ids','omit','getMessages','FaxMessage','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','addTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','Attachment','get','mkdirSync','Messages','basename','existsSync','pipe','log','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','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','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','Users','map','fullname','TagIds','split','forEach','Tags','push','catch','index','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','color','tools_tags','u.id'];(function(_0x20ee01,_0x317412){var _0x213a63=function(_0xcbac38){while(--_0xcbac38){_0x20ee01['push'](_0x20ee01['shift']());}};_0x213a63(++_0x317412);}(_0x6767,0x8f));var _0x7676=function(_0x1a6e0b,_0x33001f){_0x1a6e0b=_0x1a6e0b-0x0;var _0xb04ebf=_0x6767[_0x1a6e0b];return _0xb04ebf;};'use strict';var pdf=require(_0x7676('0x0'));var emlformat=require(_0x7676('0x1'));var rimraf=require(_0x7676('0x2'));var zipdir=require(_0x7676('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7676('0x4'));var moment=require(_0x7676('0x5'));var BPromise=require(_0x7676('0x6'));var Mustache=require(_0x7676('0x7'));var util=require(_0x7676('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x7676('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7676('0xa'));var squel=require(_0x7676('0xb'));var crypto=require(_0x7676('0xc'));var jsforce=require(_0x7676('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7676('0x9'));var querystring=require('querystring');var Papa=require(_0x7676('0xe'));var Redis=require(_0x7676('0xf'));var authService=require(_0x7676('0x10'));var qs=require(_0x7676('0x11'));var as=require(_0x7676('0x12'));var hardwareService=require(_0x7676('0x13'));var logger=require(_0x7676('0x14'))(_0x7676('0x15'));var utils=require(_0x7676('0x16'));var config=require(_0x7676('0x17'));var licenseUtil=require(_0x7676('0x18'));var db=require(_0x7676('0x19'))['db'];config['redis']=_[_0x7676('0x1a')](config[_0x7676('0x1b')],{'host':_0x7676('0x1c'),'port':0x18eb});var socket=require(_0x7676('0x1d'))(new Redis(config[_0x7676('0x1b')]));require(_0x7676('0x1e'))[_0x7676('0x1f')](socket);function respondWithStatusCode(_0x13116e,_0x56e822){_0x56e822=_0x56e822||0xcc;return function(_0x3f16ec){if(_0x3f16ec){return _0x13116e[_0x7676('0x20')](_0x56e822);}return _0x13116e[_0x7676('0x21')](_0x56e822)[_0x7676('0x22')]();};}function respondWithResult(_0x2ce158,_0x3c3d2f){_0x3c3d2f=_0x3c3d2f||0xc8;return function(_0x4fe597){if(_0x4fe597){return _0x2ce158[_0x7676('0x21')](_0x3c3d2f)[_0x7676('0x23')](_0x4fe597);}};}function respondWithFilteredResult(_0x25c604,_0x3f737d){return function(_0x35527d){if(_0x35527d){var _0x369de5=_0x35527d['count'],_0x345c92=_0x3f737d[_0x7676('0x24')],_0x29bb8d=_0x3f737d['offset']+_0x3f737d[_0x7676('0x25')],_0x289824;if(_0x29bb8d>=_0x369de5){_0x29bb8d=_0x369de5;_0x289824=0xc8;}else{_0x289824=0xce;}_0x25c604[_0x7676('0x21')](_0x289824);return _0x25c604[_0x7676('0x26')](_0x7676('0x27'),_0x345c92+'-'+_0x29bb8d+'/'+_0x369de5)[_0x7676('0x23')](_0x35527d);}return null;};}function patchUpdates(_0x4ebb10){return function(_0x362a63){try{jsonpatch[_0x7676('0x28')](_0x362a63,_0x4ebb10,!![]);}catch(_0x26550b){return BPromise[_0x7676('0x29')](_0x26550b);}return _0x362a63[_0x7676('0x2a')]();};}function saveUpdates(_0x39dcd2,_0x4e4fa7){return function(_0x5408c9){if(_0x5408c9){return _0x5408c9['update'](_0x39dcd2)[_0x7676('0x2b')](function(_0xf4ef8c){return _0xf4ef8c;});}return null;};}function removeEntity(_0x41259c,_0x137e7d){return function(_0x5cee63){if(_0x5cee63){return _0x5cee63[_0x7676('0x2c')]()[_0x7676('0x2b')](function(){_0x41259c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2462b4,_0x492c0d){return function(_0x2c4507){if(!_0x2c4507){_0x2462b4[_0x7676('0x20')](0x194);}return _0x2c4507;};}function handleError(_0x4d669f,_0x8ce7f6){_0x8ce7f6=_0x8ce7f6||0x1f4;return function(_0x314cb3){logger[_0x7676('0x2d')](_0x314cb3['stack']);if(_0x314cb3[_0x7676('0x2e')]){delete _0x314cb3['name'];}_0x4d669f[_0x7676('0x21')](_0x8ce7f6)['send'](_0x314cb3);};}function getInteractionUsers(_0x11ed98,_0x4f5dbb){return new BPromise(function(_0x12d621,_0xc24fea){try{if(_0x4f5dbb[_0x11ed98['id']]){_0x11ed98[_0x7676('0x2f')]=_[_0x7676('0x30')](_0x4f5dbb[_0x11ed98['id']],function(_0x3f3dcb){return{'id':_0x3f3dcb['id'],'fullname':_0x3f3dcb[_0x7676('0x31')]};});}}catch(_0x30752f){_0xc24fea(_0x30752f);}_0x12d621(_0x11ed98);});}function getInteractionTags(_0x541cfc,_0x212a27){return new BPromise(function(_0x53e3be,_0x1ada94){try{if(_0x541cfc[_0x7676('0x32')]){_0x541cfc['Tags']=[];_0x541cfc['TagIds'][_0x7676('0x33')](',')[_0x7676('0x34')](function(_0x33d11b){_0x541cfc[_0x7676('0x35')][_0x7676('0x36')](_0x212a27[_0x33d11b]);});}delete _0x541cfc[_0x7676('0x32')];}catch(_0x5a5091){_0x1ada94(_0x5a5091);}_0x53e3be(_0x541cfc);});}function updateFaxInteraction(_0x5b4e33,_0x1f3524,_0x4a5c47){return new BPromise(function(_0x1e9343,_0x549ec2){return getInteractionUsers(_0x5b4e33,_0x4a5c47)['then'](function(_0x425361){return getInteractionTags(_0x425361,_0x1f3524);})['then'](function(_0x1e1993){_0x1e9343(_0x1e1993);})[_0x7676('0x37')](function(_0x17d5a8){_0x549ec2(_0x17d5a8);});});}exports[_0x7676('0x38')]=function(_0x2bde6e,_0x5588f0){var _0x40d6a2={},_0x478ba0={},_0x5c3bd3={'count':0x0,'rows':[]};var _0xf7af1f=_[_0x7676('0x30')](db['FaxInteraction'][_0x7676('0x39')],function(_0x4a0d26){return{'name':_0x4a0d26['fieldName'],'type':_0x4a0d26['type'][_0x7676('0x3a')]};});_0x478ba0[_0x7676('0x3b')]=_['map'](_0xf7af1f,_0x7676('0x2e'));_0x478ba0[_0x7676('0x3c')]=_['keys'](_0x2bde6e[_0x7676('0x3c')]);_0x478ba0[_0x7676('0x3d')]=_[_0x7676('0x3e')](_0x478ba0[_0x7676('0x3b')],_0x478ba0[_0x7676('0x3c')]);_0x40d6a2['attributes']=_[_0x7676('0x3e')](_0x478ba0[_0x7676('0x3b')],qs['fields'](_0x2bde6e[_0x7676('0x3c')][_0x7676('0x3f')]));_0x40d6a2[_0x7676('0x40')]=_0x40d6a2['attributes'][_0x7676('0x41')]?_0x40d6a2[_0x7676('0x40')]:_0x478ba0['model'];if(!_0x2bde6e[_0x7676('0x3c')][_0x7676('0x42')](_0x7676('0x43'))){_0x40d6a2[_0x7676('0x25')]=qs[_0x7676('0x25')](_0x2bde6e['query'][_0x7676('0x25')]);_0x40d6a2[_0x7676('0x24')]=qs[_0x7676('0x24')](_0x2bde6e['query']['offset']);}_0x40d6a2[_0x7676('0x44')]=qs['sort'](_0x2bde6e[_0x7676('0x3c')][_0x7676('0x45')]);_0x40d6a2[_0x7676('0x46')]=qs[_0x7676('0x3d')](_[_0x7676('0x47')](_0x2bde6e['query'],_0x478ba0[_0x7676('0x3d')]),_0xf7af1f);var _0x5f173e=[];var _0x27f275=squel[_0x7676('0x48')]()['field']('id')['field'](_0x7676('0x2e'))['field'](_0x7676('0x49'))['from'](_0x7676('0x4a'));var _0x414a36=squel[_0x7676('0x48')]()['field'](_0x7676('0x4b'))[_0x7676('0x4c')]('u.fullname')[_0x7676('0x4c')](_0x7676('0x4d'))['from']('user_has_fax_interactions','ui')[_0x7676('0x4e')](_0x7676('0x4f'),'u',_0x7676('0x50'));var _0x25d8d6=squel[_0x7676('0x48')]()[_0x7676('0x51')](_0x7676('0x52'),'i')[_0x7676('0x4e')](_0x7676('0x53'),'c',_0x7676('0x54'))[_0x7676('0x4e')](_0x7676('0x4f'),'o',_0x7676('0x55'))[_0x7676('0x4e')](_0x7676('0x56'),'a',_0x7676('0x57'))[_0x7676('0x4e')]('fax_messages','me','me.FaxInteractionId\x20=\x20i.id')[_0x7676('0x4e')](_0x7676('0x58'),'it',_0x7676('0x59'))['left_join'](_0x7676('0x4a'),'t',_0x7676('0x5a'));var _0x23e26f=squel[_0x7676('0x5b')]();var _0x5f2abc=[];var _0x56b74c=squel[_0x7676('0x5b')]();var _0x5d0d3;if(_0x2bde6e['query'][_0x7676('0x5c')]){_0x5d0d3=as[_0x7676('0x5d')](_0x2bde6e[_0x7676('0x3c')][_0x7676('0x5c')]);var _0x56268c=_0x5d0d3[_0x7676('0x5e')];for(var _0x252b7c=0x0;_0x252b7c<_0x5d0d3[_0x7676('0x5f')]['length'];_0x252b7c++){var _0xaca8c0=_0x5d0d3[_0x7676('0x5f')][_0x252b7c];var _0x23b5f3='i';var _0x879fa9=_[_0x7676('0x60')](_0xf7af1f,[_0x7676('0x2e'),_0xaca8c0[_0x7676('0x4c')]]);if(!_0x879fa9){switch(_0xaca8c0[_0x7676('0x4c')]){case _0x7676('0x61'):if(_0xaca8c0[_0x7676('0x62')]==0x1){_0x25d8d6[_0x7676('0x63')]('`'+_0xaca8c0[_0x7676('0x4c')]+_0x7676('0x64'));}else{_0x25d8d6['having']('`'+_0xaca8c0['field']+_0x7676('0x65'));}break;case _0x7676('0x66'):if(_0xaca8c0[_0x7676('0x67')]===_0x7676('0x68')){if(_0xaca8c0[_0x7676('0x62')][_0x7676('0x33')]('\x20')['length']>0x1){_0x23e26f[_0x56268c](_0x7676('0x69'),qs['getFullTextValue'](_0xaca8c0[_0x7676('0x62')]),null);}else{var _0x372e44='%'+_0xaca8c0[_0x7676('0x62')]+'%';_0x23e26f[_0x56268c](_0x7676('0x6a'),_0x372e44,_0x372e44,_0x372e44);}}else{_0x879fa9=_['find'](_0xf7af1f,[_0x7676('0x2e'),_0x7676('0x6b')]);_0xaca8c0[_0x7676('0x4c')]=_0x7676('0x6b');_0x487979=as[_0x7676('0x6c')](_0x23b5f3,_0x879fa9[_0x7676('0x6d')],_0xaca8c0);_0x23e26f[_0x56268c](_0x487979[_0x7676('0x6e')],_0x487979[_0x7676('0x62')][_0x7676('0x6f')],_0x487979['value'][_0x7676('0x22')]);}break;case _0x7676('0x70'):var _0x3621b7=_0xaca8c0[_0x7676('0x62')][_0x7676('0x33')](',')[_0x7676('0x30')](function(_0x14bfc3){return Number(_0x14bfc3);});_0x3621b7[_0x7676('0x34')](function(_0x548ad9){_0x56b74c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x548ad9+',%');});_0x5f2abc=_[_0x7676('0x71')](_0x5f2abc,_0x3621b7);break;case _0x7676('0x72'):if(_0xaca8c0[_0x7676('0x67')]===_0x7676('0x68')){_0x23e26f[_0x56268c](_0x7676('0x73'),'%'+_0xaca8c0[_0x7676('0x62')]+'%',null);}else{_0x879fa9=_['find'](_0xf7af1f,[_0x7676('0x2e'),_0x7676('0x74')]);_0xaca8c0['field']='UserId';_0x487979=as[_0x7676('0x6c')](_0x23b5f3,_0x879fa9[_0x7676('0x6d')],_0xaca8c0);_0x23e26f[_0x56268c](_0x487979[_0x7676('0x6e')],_0x487979[_0x7676('0x62')][_0x7676('0x6f')],_0x487979[_0x7676('0x62')][_0x7676('0x22')]);}break;case _0x7676('0x75'):_0x487979=as[_0x7676('0x6c')]('me',null,_0xaca8c0);_0x23e26f[_0x56268c](_0x487979[_0x7676('0x6e')],_0x487979[_0x7676('0x62')][_0x7676('0x6f')],_0x487979['value'][_0x7676('0x22')]);break;}}else{var _0x487979=as[_0x7676('0x6c')](_0x23b5f3,_0x879fa9[_0x7676('0x6d')],_0xaca8c0);_0x23e26f[_0x56268c](_0x487979['text'],_0x487979[_0x7676('0x62')]['start'],_0x487979[_0x7676('0x62')][_0x7676('0x22')]);}}}else{var _0x1cd974=_(_0x2bde6e[_0x7676('0x3c')])[_0x7676('0x76')]()['map'](function(_0x50664b){return _['some'](_0xf7af1f,[_0x7676('0x2e'),_0x50664b])?_0x50664b:undefined;})[_0x7676('0x77')]()[_0x7676('0x62')]();if(!_[_0x7676('0x78')](_0x1cd974)){_0x1cd974[_0x7676('0x34')](function(_0x5ac3b9){if(_0x5ac3b9===_0x7676('0x79')){_0x25d8d6[_0x7676('0x46')](_0x7676('0x7a'),[]['concat'](_0x2bde6e[_0x7676('0x3c')][_0x5ac3b9]));}else if(_0x5ac3b9===_0x7676('0x7b')){var _0x3b42a4=JSON[_0x7676('0x7c')](_0x2bde6e[_0x7676('0x3c')][_0x5ac3b9])[_0x7676('0x7d')];var _0x2e76a7=JSON[_0x7676('0x7c')](_0x2bde6e[_0x7676('0x3c')][_0x5ac3b9])[_0x7676('0x7e')];_0x25d8d6[_0x7676('0x46')](_0x7676('0x7f'),_0x3b42a4,_0x2e76a7);}else{if(_0x2bde6e[_0x7676('0x3c')][_0x5ac3b9]===_0x7676('0x80')){_0x25d8d6['where']('i.'+_0x5ac3b9+_0x7676('0x81'));}else{_0x25d8d6[_0x7676('0x46')]('i.'+_0x5ac3b9+_0x7676('0x82'),_0x2bde6e[_0x7676('0x3c')][_0x5ac3b9]);}}});}if(_0x2bde6e[_0x7676('0x3c')]['read']){if(_0x2bde6e[_0x7676('0x3c')]['read']==0x1){_0x25d8d6[_0x7676('0x63')]('`unreadMessages`\x20=\x200');}else{_0x25d8d6['having'](_0x7676('0x83'));}}if(_0x2bde6e['query']['tag']){_0x5f2abc=_['isArray'](_0x2bde6e[_0x7676('0x3c')][_0x7676('0x84')])?_0x2bde6e[_0x7676('0x3c')][_0x7676('0x84')]:new Array(_0x2bde6e[_0x7676('0x3c')][_0x7676('0x84')]);_0x5f2abc[_0x7676('0x34')](function(_0x1f47fa){_0x56b74c['or'](_0x7676('0x85'),'%,'+_0x1f47fa+',%');});}if(_0x2bde6e[_0x7676('0x3c')][_0x7676('0x86')]){var _0x56b45a=_0x2bde6e[_0x7676('0x3c')][_0x7676('0x86')][_0x7676('0x87')]('\x5c','\x5c\x5c')[_0x7676('0x87')](/'/g,'\x27\x27');if(qs[_0x7676('0x88')](_0x56b45a)){_0x23e26f['or'](_0x7676('0x89'),_0x56b45a+'%')['or'](_0x7676('0x8a'),_0x56b45a+'%');}_0x23e26f['or'](_0x7676('0x8b'),_0x56b45a+'%');}}_0x25d8d6['where'](_0x23e26f);_0x25d8d6['group'](_0x7676('0x8c'));var _0x5c60fd={'type':db['Sequelize'][_0x7676('0x8d')][_0x7676('0x8e')],'raw':!![]};var _0x1ec4b9=_0x25d8d6[_0x7676('0x8f')]();_0x1ec4b9[_0x7676('0x4c')](_0x7676('0x8c'));_0x1ec4b9[_0x7676('0x4c')](_0x7676('0x90'),_0x7676('0x61'));if(_0x40d6a2[_0x7676('0x44')]){_0x40d6a2[_0x7676('0x44')][_0x7676('0x34')](function(_0x5e3e6e){var _0x236fca=_0x5e3e6e[0x0]===_0x7676('0x91')?_0x5e3e6e[0x0]:'i.'+_0x5e3e6e[0x0];_0x25d8d6[_0x7676('0x44')](_0x236fca,_0x5e3e6e[0x1]==='DESC'?![]:!![]);});}if(!_[_0x7676('0x78')](_0x5f2abc)){_0x25d8d6[_0x7676('0x63')](_0x56b74c);_0x1ec4b9['where'](_0x7676('0x92'),_0x5f2abc);}BPromise[_0x7676('0x93')]()[_0x7676('0x2b')](function(){if(!_0x5d0d3){if(_0x2bde6e[_0x7676('0x3c')][_0x7676('0x79')])return;_0x1ec4b9[_0x7676('0x46')](_0x7676('0x94'));_0x25d8d6['where'](_0x7676('0x94'));return;}if(_0x2bde6e['user']['role']!==_0x7676('0x95'))return;return _0x2bde6e[_0x7676('0x96')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x7676('0x2b')](function(_0x5605d9){if(_[_0x7676('0x78')](_0x5605d9)){_0x1ec4b9[_0x7676('0x46')](_0x7676('0x97'));_0x25d8d6[_0x7676('0x46')](_0x7676('0x97'));}else{_0x1ec4b9[_0x7676('0x46')](_0x7676('0x7a'),_[_0x7676('0x30')](_0x5605d9,'id'));_0x25d8d6[_0x7676('0x46')](_0x7676('0x7a'),_['map'](_0x5605d9,'id'));}});})[_0x7676('0x2b')](function(){if(_0x2bde6e['user'][_0x7676('0x98')]===_0x7676('0x95')&&!_0x5d0d3&&!_0x2bde6e['query']['FaxAccountId'])return[];return db['sequelize'][_0x7676('0x3c')](_0x1ec4b9[_0x7676('0x99')](),_0x5c60fd);})[_0x7676('0x2b')](function(_0x517a74){_0x5c3bd3['count']=_0x517a74[_0x7676('0x41')];if(_0x5c3bd3[_0x7676('0x9a')]===0x0)return[];return db[_0x7676('0x9b')]['query'](_0x27f275[_0x7676('0x99')](),_0x5c60fd)[_0x7676('0x2b')](function(_0x3dcbdc){_0x5f173e=_[_0x7676('0x9c')](_0x3dcbdc,'id');_0x5c60fd=_[_0x7676('0x9d')](_0x5c60fd,{'model':db[_0x7676('0x9e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2bde6e[_0x7676('0x3c')][_0x7676('0x3f')]){_0x40d6a2[_0x7676('0x40')][_0x7676('0x34')](function(_0x126ba9){_0x25d8d6['field']('i.'+_0x126ba9);});}else{_0x25d8d6[_0x7676('0x4c')](_0x7676('0x90'),_0x7676('0x61'));_0x25d8d6[_0x7676('0x4c')](_0x7676('0x9f'),'Account.key');_0x25d8d6['field'](_0x7676('0xa0'),_0x7676('0xa1'));_0x25d8d6[_0x7676('0x4c')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x7676('0x91'));_0x25d8d6['field'](_0x7676('0xa2'));_0x25d8d6[_0x7676('0x4c')](_0x7676('0xa3'),'Contact.firstName');_0x25d8d6[_0x7676('0x4c')]('c.lastName',_0x7676('0xa4'));_0x25d8d6[_0x7676('0x4c')](_0x7676('0xa5'),_0x7676('0xa6'));_0x25d8d6['field'](_0x7676('0xa7'),_0x7676('0xa8'));_0x25d8d6[_0x7676('0x4c')](_0x7676('0xa9'),'Contact.mobile');_0x25d8d6[_0x7676('0x4c')](_0x7676('0xaa'),_0x7676('0xab'));_0x25d8d6[_0x7676('0x4c')](_0x7676('0xac'),_0x7676('0xad'));_0x25d8d6[_0x7676('0x4c')](_0x7676('0xae'),_0x7676('0xaf'));_0x25d8d6[_0x7676('0x4c')](_0x7676('0xb0'),'TagIds');}if(_0x40d6a2['limit'])_0x25d8d6[_0x7676('0x25')](_0x40d6a2['limit']);if(_0x40d6a2[_0x7676('0x24')])_0x25d8d6[_0x7676('0x24')](_0x40d6a2[_0x7676('0x24')]);return db[_0x7676('0x9b')][_0x7676('0x3c')](_0x25d8d6[_0x7676('0x99')](),_0x5c60fd);})[_0x7676('0x2b')](function(_0x502377){_0x414a36[_0x7676('0x46')](_0x7676('0xb1'),_['map'](_0x502377,'id'));return db[_0x7676('0x9b')]['query'](_0x414a36[_0x7676('0x99')](),_0x5c60fd)[_0x7676('0x2b')](function(_0x3158e7){var _0x1ec5c4=_[_0x7676('0xb2')](_0x3158e7,_0x7676('0xb3'));var _0x3afc37=[];_0x502377['forEach'](function(_0x446128){_0x3afc37['push'](updateFaxInteraction(_0x446128,_0x5f173e,_0x1ec5c4));});return BPromise[_0x7676('0xb4')](_0x3afc37);});});})[_0x7676('0x2b')](function(_0x2154e8){_0x5c3bd3['rows']=_0x2154e8;return _0x5c3bd3;})[_0x7676('0x2b')](respondWithFilteredResult(_0x5588f0,_0x40d6a2))[_0x7676('0x37')](handleError(_0x5588f0,null));};exports[_0x7676('0xb5')]=function(_0x37e7b0,_0x1f80b1){var _0x1c4b53={'raw':![],'where':{'id':_0x37e7b0[_0x7676('0xb6')]['id']}},_0x4624e6={};_0x4624e6['model']=_['keys'](db[_0x7676('0x9e')][_0x7676('0x39')]);_0x4624e6[_0x7676('0x3c')]=_[_0x7676('0x76')](_0x37e7b0[_0x7676('0x3c')]);_0x4624e6[_0x7676('0x3d')]=_['intersection'](_0x4624e6['model'],_0x4624e6[_0x7676('0x3c')]);_0x1c4b53[_0x7676('0x40')]=_[_0x7676('0x3e')](_0x4624e6[_0x7676('0x3b')],qs['fields'](_0x37e7b0['query'][_0x7676('0x3f')]));_0x1c4b53['attributes']=_0x1c4b53[_0x7676('0x40')][_0x7676('0x41')]?_0x1c4b53[_0x7676('0x40')]:_0x4624e6[_0x7676('0x3b')];if(_0x37e7b0['query']['includeAll']){_0x1c4b53[_0x7676('0xb7')]=[{'all':!![]}];}_0x1c4b53=_[_0x7676('0x9d')]({},_0x1c4b53,_0x37e7b0[_0x7676('0xb8')]);return db['FaxInteraction']['find'](_0x1c4b53)[_0x7676('0x2b')](handleEntityNotFound(_0x1f80b1,null))[_0x7676('0x2b')](respondWithResult(_0x1f80b1,null))[_0x7676('0x37')](handleError(_0x1f80b1,null));};exports[_0x7676('0xb9')]=function(_0x2903e4,_0x4d5f2b){return db[_0x7676('0x9e')]['create'](_0x2903e4['body'],{})[_0x7676('0x2b')](respondWithResult(_0x4d5f2b,0xc9))[_0x7676('0x37')](handleError(_0x4d5f2b,null));};exports['update']=function(_0x4aed3e,_0x5a1c9c){if(_0x4aed3e[_0x7676('0x75')]['id']){delete _0x4aed3e[_0x7676('0x75')]['id'];}return db[_0x7676('0x9e')][_0x7676('0x60')]({'where':{'id':_0x4aed3e[_0x7676('0xb6')]['id']}})[_0x7676('0x2b')](handleEntityNotFound(_0x5a1c9c,null))[_0x7676('0x2b')](saveUpdates(_0x4aed3e[_0x7676('0x75')],null))[_0x7676('0x2b')](respondWithResult(_0x5a1c9c,null))[_0x7676('0x37')](handleError(_0x5a1c9c,null));};exports[_0x7676('0x2c')]=function(_0x202cea,_0xe3ef82){return db['FaxInteraction'][_0x7676('0x60')]({'where':{'id':_0x202cea[_0x7676('0xb6')]['id']}})[_0x7676('0x2b')](handleEntityNotFound(_0xe3ef82,null))[_0x7676('0x2b')](removeEntity(_0xe3ef82,null))[_0x7676('0x37')](handleError(_0xe3ef82,null));};exports[_0x7676('0xba')]=function(_0x2edf01,_0x3e74ca){return db[_0x7676('0x9e')]['describe']()[_0x7676('0x2b')](respondWithResult(_0x3e74ca,null))[_0x7676('0x37')](handleError(_0x3e74ca,null));};exports['addMessage']=function(_0x532fa7,_0x3ec818,_0x24179c){return db['FaxMessage'][_0x7676('0x60')]({'where':{'id':_0x532fa7['params']['id']}})['then'](handleEntityNotFound(_0x3ec818,null))[_0x7676('0x2b')](function(_0x2d013b){if(_0x2d013b){return _0x2d013b[_0x7676('0xbb')](_0x532fa7[_0x7676('0x75')][_0x7676('0xbc')],_[_0x7676('0xbd')](_0x532fa7[_0x7676('0x75')],['ids','id'])||{});}})[_0x7676('0x2b')](respondWithResult(_0x3ec818,null))[_0x7676('0x37')](handleError(_0x3ec818,null));};exports[_0x7676('0xbe')]=function(_0x400ac1,_0x5b3c87,_0x3662e6){var _0x570eae={'raw':![],'where':{}};var _0x1f4151={};var _0x42f6f6={'count':0x0,'rows':[]};return db[_0x7676('0x9e')]['findOne']({'where':{'id':_0x400ac1[_0x7676('0xb6')]['id']}})['then'](handleEntityNotFound(_0x5b3c87,null))[_0x7676('0x2b')](function(_0x31a558){if(_0x31a558){_0x1f4151[_0x7676('0x3b')]=_[_0x7676('0x76')](db[_0x7676('0xbf')][_0x7676('0x39')]);_0x1f4151[_0x7676('0x3c')]=_['keys'](_0x400ac1[_0x7676('0x3c')]);_0x1f4151[_0x7676('0x3d')]=_['intersection'](_0x1f4151[_0x7676('0x3b')],_0x1f4151[_0x7676('0x3c')]);_0x570eae[_0x7676('0x40')]=_[_0x7676('0x3e')](_0x1f4151[_0x7676('0x3b')],qs[_0x7676('0x3f')](_0x400ac1[_0x7676('0x3c')][_0x7676('0x3f')]));_0x570eae['attributes']=_0x570eae[_0x7676('0x40')][_0x7676('0x41')]?_0x570eae[_0x7676('0x40')]:_0x1f4151[_0x7676('0x3b')];if(!_0x400ac1[_0x7676('0x3c')][_0x7676('0x42')](_0x7676('0x43'))){_0x570eae['limit']=qs[_0x7676('0x25')](_0x400ac1[_0x7676('0x3c')][_0x7676('0x25')]);_0x570eae[_0x7676('0x24')]=qs['offset'](_0x400ac1[_0x7676('0x3c')]['offset']);}_0x570eae[_0x7676('0x44')]=qs[_0x7676('0x45')](_0x400ac1['query']['sort']);_0x570eae['where']=qs[_0x7676('0x3d')](_[_0x7676('0x47')](_0x400ac1[_0x7676('0x3c')],_0x1f4151[_0x7676('0x3d')]));_0x570eae[_0x7676('0x46')][_0x7676('0xb3')]=_0x31a558['id'];if(_0x400ac1[_0x7676('0x3c')][_0x7676('0x86')]){_0x570eae[_0x7676('0x46')]=_['merge'](_0x570eae[_0x7676('0x46')],{'$or':_[_0x7676('0x30')](_0x570eae['attributes'],function(_0x2d4bbd){var _0x4d1da8={};_0x4d1da8[_0x2d4bbd]={'$like':'%'+_0x400ac1[_0x7676('0x3c')][_0x7676('0x86')]+'%'};return _0x4d1da8;})});}if(_0x400ac1[_0x7676('0x3c')][_0x7676('0x7d')]){var _0x31d7e8=_0x400ac1['query'][_0x7676('0x7d')][_0x7676('0x33')](',');var _0x18d5eb={};_0x18d5eb[_0x31d7e8[0x0]]={'$gte':moment(_0x31d7e8[0x1])[_0x7676('0xc0')](_0x7676('0xc1'))};_0x570eae['where']=_[_0x7676('0x9d')](_0x570eae[_0x7676('0x46')],_0x18d5eb);}_0x570eae=_[_0x7676('0x9d')]({},_0x570eae,_0x400ac1['options']);return db[_0x7676('0xbf')]['count']({'where':_0x570eae[_0x7676('0x46')]})[_0x7676('0x2b')](function(_0x151e60){_0x42f6f6[_0x7676('0x9a')]=_0x151e60;if(_0x400ac1[_0x7676('0x3c')][_0x7676('0xc2')]){_0x570eae[_0x7676('0xb7')]=[{'all':!![]}];}return db['FaxMessage'][_0x7676('0xc3')](_0x570eae);})[_0x7676('0x2b')](function(_0x106f81){_0x42f6f6[_0x7676('0xc4')]=_0x106f81;return _0x42f6f6;});}})[_0x7676('0x2b')](respondWithFilteredResult(_0x5b3c87,_0x570eae))['catch'](handleError(_0x5b3c87,null));};exports[_0x7676('0xc5')]=function(_0x2e5629,_0x22e8f9,_0x46f7d7){return db[_0x7676('0x9e')][_0x7676('0x60')]({'where':{'id':_0x2e5629[_0x7676('0xb6')]['id']}})['then'](handleEntityNotFound(_0x22e8f9,null))[_0x7676('0x2b')](function(_0x467cb6){if(_0x467cb6){return _0x467cb6['setTags'](_0x2e5629[_0x7676('0x75')][_0x7676('0xbc')],_[_0x7676('0xbd')](_0x2e5629[_0x7676('0x75')],[_0x7676('0xbc'),'id'])||{})[_0x7676('0xc6')](function(){return db[_0x7676('0x70')][_0x7676('0xc3')]({'attributes':['id',_0x7676('0x2e'),_0x7676('0x49')],'where':{'id':_0x2e5629[_0x7676('0x75')]['ids']}});})[_0x7676('0x2b')](function(_0x21d3e0){socket[_0x7676('0xc7')](_0x7676('0xc8'),{'id':Number(_0x2e5629[_0x7676('0xb6')]['id']),'tags':_0x21d3e0||[]});return{'id':Number(_0x2e5629['params']['id']),'tags':_0x21d3e0||[]};});}})[_0x7676('0x2b')](respondWithResult(_0x22e8f9,null))['catch'](handleError(_0x22e8f9,null));};exports[_0x7676('0xc9')]=function(_0x5122eb,_0x29b50d,_0x1407c4){return db[_0x7676('0x9e')][_0x7676('0x60')]({'where':{'id':_0x5122eb['params']['id']}})['then'](handleEntityNotFound(_0x29b50d,null))[_0x7676('0x2b')](function(_0x375674){if(_0x375674){return _0x375674[_0x7676('0xc9')](_0x5122eb[_0x7676('0x3c')][_0x7676('0xbc')]);}})['then'](respondWithStatusCode(_0x29b50d,null))['catch'](handleError(_0x29b50d,null));};exports[_0x7676('0xca')]=function(_0x3ed9b9,_0x39f177){var _0x4273d1=moment()[_0x7676('0xcb')]()[_0x7676('0x99')]();var _0x34e3cc=path[_0x7676('0xcc')](config[_0x7676('0xcd')],_0x7676('0xce'),_0x7676('0xcf'),_0x7676('0xd0'));var _0x51a8a3=path[_0x7676('0xcc')](config[_0x7676('0xcd')],'server','files','attachments');var _0x3e531e=path[_0x7676('0xcc')](_0x34e3cc,_0x4273d1);var _0x24d324=util[_0x7676('0xc0')](_0x7676('0xd1'),_0x3ed9b9['params']['id'],_0x4273d1);var _0x1a32f6=path[_0x7676('0xcc')](_0x34e3cc,_0x24d324);var _0x3b093f=[];_0x3b093f['push']({'model':db[_0x7676('0xd2')],'as':_0x7676('0xd2'),'raw':!![]});var _0x2aad4b=[{'model':db[_0x7676('0xbf')],'as':'Messages','attributes':['id',_0x7676('0x75'),'createdAt'],'include':_0x3b093f}];return db[_0x7676('0x9e')][_0x7676('0x60')]({'where':{'id':_0x3ed9b9[_0x7676('0xb6')]['id']},'include':_0x2aad4b})[_0x7676('0x2b')](handleEntityNotFound(_0x39f177,null))['then'](function(_0x5f13d9){if(_0x5f13d9&&_0x5f13d9['Messages']){var _0x8e3904=_0x5f13d9[_0x7676('0xd3')]({'plain':!![]});fs[_0x7676('0xd4')](_0x3e531e);for(var _0x5d989d=0x0;_0x5d989d<_0x8e3904[_0x7676('0xd5')]['length'];_0x5d989d++){var _0x1e1e09=_0x8e3904[_0x7676('0xd5')][_0x5d989d][_0x7676('0xd2')];if(_0x1e1e09){var _0xab0f1a=path[_0x7676('0xcc')](_0x51a8a3,_0x1e1e09[_0x7676('0xd6')]);if(fs[_0x7676('0xd7')](_0xab0f1a)){fs['createReadStream'](_0xab0f1a)[_0x7676('0xd8')](fs['createWriteStream'](path[_0x7676('0xcc')](_0x3e531e,_0x1e1e09[_0x7676('0xd6')])));}}}return BPromise[_0x7676('0x93')]()[_0x7676('0x2b')](function(){return new BPromise(function(_0x421db4,_0x58a53e){zipdir(_0x3e531e,{'saveTo':_0x1a32f6},function(_0xaf402d,_0x2ae403){if(_0xaf402d)return _0x58a53e(_0xaf402d);return _0x421db4(_0x2ae403);});})[_0x7676('0x2b')](function(){return new BPromise(function(_0x2f4b3f,_0x5220a4){rimraf(_0x3e531e,function(_0x223b50){if(_0x223b50)_0x5220a4(_0x223b50);return _0x2f4b3f();});});})[_0x7676('0x2b')](function(){return _0x39f177[_0x7676('0xca')](_0x1a32f6,_0x24d324,function(_0xd4f87){if(_0xd4f87){console[_0x7676('0xd9')]('err',_0xd4f87);}else{fs[_0x7676('0xda')](_0x1a32f6);}});});});}else{return _0x39f177[_0x7676('0x20')](0xc8);}})[_0x7676('0x37')](handleError(_0x39f177,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 4b22638..da6fafe 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 _0xadb5=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','FaxMessage','setMaxListeners'];(function(_0x40b8ce,_0x5d16d9){var _0x399970=function(_0xd02861){while(--_0xd02861){_0x40b8ce['push'](_0x40b8ce['shift']());}};_0x399970(++_0x5d16d9);}(_0xadb5,0xad));var _0x5adb=function(_0x3c5f3c,_0x35884e){_0x3c5f3c=_0x3c5f3c-0x0;var _0x50fc52=_0xadb5[_0x3c5f3c];return _0x50fc52;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x5adb('0x0'))['db']['FaxInteraction'];var FaxMessage=require(_0x5adb('0x0'))['db'][_0x5adb('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x5adb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5adb('0x3'),'afterDestroy':_0x5adb('0x4')};function emitEvent(_0x2e3ef4){return function(_0x4cb1d1,_0x35a5d3,_0x168d89){_0x4cb1d1[_0x5adb('0x5')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x6')](function(_0xdf3776){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0x8'),_0xdf3776[_0x5adb('0x9')](function(_0x41261c){return{'id':_0x41261c['id']};}));return FaxMessage[_0x5adb('0xa')]({'where':{'FaxInteractionId':_0x4cb1d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5adb('0x6')](function(_0x336bad){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0xb'),_0x336bad['length']);FaxInteractionEvents['emit'](_0x2e3ef4+':'+_0x4cb1d1['id'],_0x4cb1d1);FaxInteractionEvents[_0x5adb('0xc')](_0x2e3ef4,_0x4cb1d1);_0x168d89(null);})[_0x5adb('0xd')](_0x168d89(null));};}for(var e in events){if(events[_0x5adb('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x5adb('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0x7a54=['setDataValue','map','length','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers'];(function(_0xdc47ce,_0x578137){var _0x2c20fa=function(_0x30757e){while(--_0x30757e){_0xdc47ce['push'](_0xdc47ce['shift']());}};_0x2c20fa(++_0x578137);}(_0x7a54,0x106));var _0x47a5=function(_0x46f5e0,_0x33d50a){_0x46f5e0=_0x46f5e0-0x0;var _0x45e23c=_0x7a54[_0x46f5e0];return _0x45e23c;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var FaxInteraction=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x47a5('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x47a5('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x47a5('0x5'),'afterDestroy':_0x47a5('0x6')};function emitEvent(_0x2a1a7e){return function(_0x3717e1,_0xfdf934,_0x545a97){_0x3717e1[_0x47a5('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x343372){_0x3717e1[_0x47a5('0x8')]('Users',_0x343372[_0x47a5('0x9')](function(_0x5077f3){return{'id':_0x5077f3['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x3717e1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2a0e98){_0x3717e1[_0x47a5('0x8')]('unreadMessages',_0x2a0e98[_0x47a5('0xa')]);FaxInteractionEvents['emit'](_0x2a1a7e+':'+_0x3717e1['id'],_0x3717e1);FaxInteractionEvents['emit'](_0x2a1a7e,_0x3717e1);_0x545a97(null);})[_0x47a5('0xb')](_0x545a97(null));};}for(var e in events){if(events[_0x47a5('0xc')](e)){var event=events[e];FaxInteraction[_0x47a5('0xd')](e,emitEvent(event));}}module[_0x47a5('0xe')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index e4be3c7..8f95e70 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 _0xca79=['FaxInteraction','changed','format','YYYY-MM-DD\x20HH:mm:ss','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x47d606,_0x4fa6b6){var _0x1520be=function(_0x4b92fc){while(--_0x4b92fc){_0x47d606['push'](_0x47d606['shift']());}};_0x1520be(++_0x4fa6b6);}(_0xca79,0xfb));var _0x9ca7=function(_0x1fa571,_0x147b60){_0x1fa571=_0x1fa571-0x0;var _0x5374ba=_0xca79[_0x1fa571];return _0x5374ba;};'use strict';var _=require('lodash');var util=require(_0x9ca7('0x0'));var logger=require('../../config/logger')(_0x9ca7('0x1'));var moment=require('moment');var BPromise=require(_0x9ca7('0x2'));var rp=require(_0x9ca7('0x3'));var fs=require('fs');var path=require(_0x9ca7('0x4'));var rimraf=require(_0x9ca7('0x5'));var config=require(_0x9ca7('0x6'));var attributes=require('./faxInteraction.attributes');module[_0x9ca7('0x7')]=function(_0x2759d0,_0x1ca110){return _0x2759d0[_0x9ca7('0x8')](_0x9ca7('0x9'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2d514b,_0x337b26,_0x381414){if(_0x2d514b[_0x9ca7('0xa')]('closed')){_0x2d514b['closedAt']=moment()[_0x9ca7('0xb')](_0x9ca7('0xc'));}_0x381414(null,_0x2d514b);}}});}; \ No newline at end of file +var _0x56bd=['changed','closed','closedAt','format','util','../../config/logger','api','moment','bluebird','rimraf','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions'];(function(_0x4cd3e1,_0x3e9470){var _0x5095be=function(_0x264e05){while(--_0x264e05){_0x4cd3e1['push'](_0x4cd3e1['shift']());}};_0x5095be(++_0x3e9470);}(_0x56bd,0x121));var _0xd56b=function(_0x11ba0e,_0x344e19){_0x11ba0e=_0x11ba0e-0x0;var _0x51ae49=_0x56bd[_0x11ba0e];return _0x51ae49;};'use strict';var _=require('lodash');var util=require(_0xd56b('0x0'));var logger=require(_0xd56b('0x1'))(_0xd56b('0x2'));var moment=require(_0xd56b('0x3'));var BPromise=require(_0xd56b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd56b('0x5'));var config=require('../../config/environment');var attributes=require(_0xd56b('0x6'));module[_0xd56b('0x7')]=function(_0x4846f5,_0x5c3b3c){return _0x4846f5[_0xd56b('0x8')](_0xd56b('0x9'),attributes,{'tableName':_0xd56b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x212b35,_0x3f4b3a,_0x570f95){if(_0x212b35[_0xd56b('0xb')](_0xd56b('0xc'))){_0x212b35[_0xd56b('0xd')]=moment()[_0xd56b('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x570f95(null,_0x212b35);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index f3c1552..2b3601b 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 _0xd36e=['limit','debug','AddTagsToFaxInteraction','find','where','addTags','ids','omit','body','spread','AddTags','util','moment','bluebird','randomstring','rpc','client','http','redis','defaults','socket.io-emitter','./faxInteraction.socket','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','attributes'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd36e,0x14b));var _0xed36=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd36e[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xed36('0x0'));var moment=require(_0xed36('0x1'));var BPromise=require(_0xed36('0x2'));var rs=require(_0xed36('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xed36('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xed36('0x5')][_0xed36('0x6')]({'port':0x232a});config[_0xed36('0x7')]=_[_0xed36('0x8')](config[_0xed36('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xed36('0x9'))(new Redis(config[_0xed36('0x7')]));require(_0xed36('0xa'))['register'](socket);function respondWithRpcPromise(_0x43f04d,_0x17408b,_0x2f509e){return new BPromise(function(_0x5bc435,_0xeb9ad9){return client[_0xed36('0xb')](_0x43f04d,_0x2f509e)[_0xed36('0xc')](function(_0x570c05){logger[_0xed36('0xd')](_0xed36('0xe'),_0x17408b,_0xed36('0xf'));logger['debug'](_0xed36('0x10'),_0x17408b,_0xed36('0xf'),JSON[_0xed36('0x11')](_0x570c05));if(_0x570c05[_0xed36('0x12')]){if(_0x570c05['error'][_0xed36('0x13')]===0x1f4){logger[_0xed36('0x12')](_0xed36('0xe'),_0x17408b,_0x570c05['error'][_0xed36('0x14')]);return _0xeb9ad9(_0x570c05[_0xed36('0x12')][_0xed36('0x14')]);}logger['error'](_0xed36('0xe'),_0x17408b,_0x570c05[_0xed36('0x12')][_0xed36('0x14')]);return _0x5bc435(_0x570c05[_0xed36('0x12')][_0xed36('0x14')]);}else{logger['info'](_0xed36('0xe'),_0x17408b,'request\x20sent');_0x5bc435(_0x570c05[_0xed36('0x15')][_0xed36('0x14')]);}})[_0xed36('0x16')](function(_0x1db9fb){logger['error'](_0xed36('0xe'),_0x17408b,_0x1db9fb);_0xeb9ad9(_0x1db9fb);});});}exports[_0xed36('0x17')]=function(_0x7657f6){var _0x3ba55f=this;return new Promise(function(_0x3dfbd3,_0x3ad10b){return db[_0xed36('0x18')][_0xed36('0x19')](_0x7657f6['body'],{'raw':_0x7657f6[_0xed36('0x1a')]?_0x7657f6['options'][_0xed36('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7657f6[_0xed36('0x1a')]?_0x7657f6[_0xed36('0x1a')]['where']||null:null,'attributes':_0x7657f6[_0xed36('0x1a')]?_0x7657f6[_0xed36('0x1a')][_0xed36('0x1c')]||null:null,'limit':_0x7657f6[_0xed36('0x1a')]?_0x7657f6[_0xed36('0x1a')][_0xed36('0x1d')]||null:null})[_0xed36('0xc')](function(_0x6958af){logger[_0xed36('0xd')](_0xed36('0x17'),_0x7657f6);logger[_0xed36('0x1e')](_0xed36('0x17'),_0x7657f6,JSON[_0xed36('0x11')](_0x6958af));_0x3dfbd3(_0x6958af);})[_0xed36('0x16')](function(_0xd1486f){logger[_0xed36('0x12')](_0xed36('0x17'),_0xd1486f[_0xed36('0x14')],_0x7657f6);_0x3ad10b(_0x3ba55f['error'](0x1f4,_0xd1486f['message']));});});};exports[_0xed36('0x1f')]=function(_0x336928){return new Promise(function(_0x5e8e70,_0x45e720){return db[_0xed36('0x18')][_0xed36('0x20')]({'where':_0x336928['options']?_0x336928[_0xed36('0x1a')][_0xed36('0x21')]||null:null})[_0xed36('0xc')](function(_0x4814dc){if(_0x4814dc){return _0x4814dc[_0xed36('0x22')](_0x336928['body'][_0xed36('0x23')],_[_0xed36('0x24')](_0x336928[_0xed36('0x25')],[_0xed36('0x23'),'id'])||{});}})[_0xed36('0x26')](function(_0x2944fb){logger[_0xed36('0xd')](_0xed36('0x27'),_0x336928);logger[_0xed36('0x1e')](_0xed36('0x27'),_0x336928,JSON[_0xed36('0x11')](_0x2944fb));_0x5e8e70(_0x2944fb);})[_0xed36('0x16')](function(_0x58790e){logger[_0xed36('0x12')](_0xed36('0x27'),_0x58790e[_0xed36('0x14')],_0x336928);_0x45e720(_this[_0xed36('0x12')](0x1f4,_0x58790e['message']));});});}; \ No newline at end of file +var _0xa74a=['rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','UpdateFaxInteraction','update','body','options','where','attributes','limit','then','AddTagsToFaxInteraction','FaxInteraction','find','omit','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3742d9,_0xec7e07){var _0x3f6809=function(_0x3cd03c){while(--_0x3cd03c){_0x3742d9['push'](_0x3742d9['shift']());}};_0x3f6809(++_0xec7e07);}(_0xa74a,0x189));var _0xaa74=function(_0x5551f6,_0x4c5acb){_0x5551f6=_0x5551f6-0x0;var _0xc1519f=_0xa74a[_0x5551f6];return _0xc1519f;};'use strict';var _=require(_0xaa74('0x0'));var util=require(_0xaa74('0x1'));var moment=require(_0xaa74('0x2'));var BPromise=require(_0xaa74('0x3'));var rs=require(_0xaa74('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa74('0x5'))['db'];var utils=require(_0xaa74('0x6'));var logger=require('../../config/logger')(_0xaa74('0x7'));var config=require(_0xaa74('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaa74('0x9')]['http']({'port':0x232a});config[_0xaa74('0xa')]=_[_0xaa74('0xb')](config[_0xaa74('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa74('0xc'))(new Redis(config[_0xaa74('0xa')]));require(_0xaa74('0xd'))[_0xaa74('0xe')](socket);function respondWithRpcPromise(_0x4843a0,_0x38c4b1,_0x71bac0){return new BPromise(function(_0x2da6e5,_0x23a3ea){return client[_0xaa74('0xf')](_0x4843a0,_0x71bac0)['then'](function(_0x315fcd){logger[_0xaa74('0x10')](_0xaa74('0x11'),_0x38c4b1,_0xaa74('0x12'));logger[_0xaa74('0x13')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x38c4b1,_0xaa74('0x12'),JSON[_0xaa74('0x14')](_0x315fcd));if(_0x315fcd[_0xaa74('0x15')]){if(_0x315fcd['error'][_0xaa74('0x16')]===0x1f4){logger[_0xaa74('0x15')](_0xaa74('0x11'),_0x38c4b1,_0x315fcd[_0xaa74('0x15')][_0xaa74('0x17')]);return _0x23a3ea(_0x315fcd[_0xaa74('0x15')][_0xaa74('0x17')]);}logger[_0xaa74('0x15')](_0xaa74('0x11'),_0x38c4b1,_0x315fcd['error']['message']);return _0x2da6e5(_0x315fcd[_0xaa74('0x15')][_0xaa74('0x17')]);}else{logger['info'](_0xaa74('0x11'),_0x38c4b1,'request\x20sent');_0x2da6e5(_0x315fcd['result'][_0xaa74('0x17')]);}})[_0xaa74('0x18')](function(_0x39120a){logger['error'](_0xaa74('0x11'),_0x38c4b1,_0x39120a);_0x23a3ea(_0x39120a);});});}exports[_0xaa74('0x19')]=function(_0x5627ab){var _0x5017a3=this;return new Promise(function(_0x456e49,_0x505906){return db['FaxInteraction'][_0xaa74('0x1a')](_0x5627ab[_0xaa74('0x1b')],{'raw':_0x5627ab[_0xaa74('0x1c')]?_0x5627ab[_0xaa74('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5627ab[_0xaa74('0x1c')]?_0x5627ab['options'][_0xaa74('0x1d')]||null:null,'attributes':_0x5627ab[_0xaa74('0x1c')]?_0x5627ab[_0xaa74('0x1c')][_0xaa74('0x1e')]||null:null,'limit':_0x5627ab['options']?_0x5627ab[_0xaa74('0x1c')][_0xaa74('0x1f')]||null:null})[_0xaa74('0x20')](function(_0x33964a){logger[_0xaa74('0x10')](_0xaa74('0x19'),_0x5627ab);logger[_0xaa74('0x13')]('UpdateFaxInteraction',_0x5627ab,JSON['stringify'](_0x33964a));_0x456e49(_0x33964a);})[_0xaa74('0x18')](function(_0x107359){logger[_0xaa74('0x15')]('UpdateFaxInteraction',_0x107359[_0xaa74('0x17')],_0x5627ab);_0x505906(_0x5017a3[_0xaa74('0x15')](0x1f4,_0x107359[_0xaa74('0x17')]));});});};exports[_0xaa74('0x21')]=function(_0x41590d){return new Promise(function(_0x43de0d,_0x70fe2e){return db[_0xaa74('0x22')][_0xaa74('0x23')]({'where':_0x41590d[_0xaa74('0x1c')]?_0x41590d[_0xaa74('0x1c')][_0xaa74('0x1d')]||null:null})['then'](function(_0x37b22b){if(_0x37b22b){return _0x37b22b['addTags'](_0x41590d['body']['ids'],_[_0xaa74('0x24')](_0x41590d['body'],[_0xaa74('0x25'),'id'])||{});}})[_0xaa74('0x26')](function(_0x4a781f){logger[_0xaa74('0x10')](_0xaa74('0x27'),_0x41590d);logger[_0xaa74('0x13')](_0xaa74('0x27'),_0x41590d,JSON[_0xaa74('0x14')](_0x4a781f));_0x43de0d(_0x4a781f);})['catch'](function(_0x39d91b){logger[_0xaa74('0x15')](_0xaa74('0x27'),_0x39d91b[_0xaa74('0x17')],_0x41590d);_0x70fe2e(_this[_0xaa74('0x15')](0x1f4,_0x39d91b[_0xaa74('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 3b13c89..5dcbc9d 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 _0xdd2f=['update','removeListener','register','length','faxInteraction:','remove'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xdd2f,0xa7));var _0xfdd2=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xdd2f[_0x15bc81];return _0x59440e;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0xfdd2('0x0'),_0xfdd2('0x1')];function createListener(_0x923124,_0x3f52e2){return function(_0x24cefb){_0x3f52e2['emit'](_0x923124,_0x24cefb);};}function removeListener(_0x2296ae,_0x2c69f7){return function(){FaxInteractionEvents[_0xfdd2('0x2')](_0x2296ae,_0x2c69f7);};}exports[_0xfdd2('0x3')]=function(_0x233576){for(var _0x509148=0x0,_0x33eea2=events[_0xfdd2('0x4')];_0x509148<_0x33eea2;_0x509148++){var _0x2187d6=events[_0x509148];var _0x358a3c=createListener(_0xfdd2('0x5')+_0x2187d6,_0x233576);FaxInteractionEvents['on'](_0x2187d6,_0x358a3c);}}; \ No newline at end of file +var _0xcee7=['register','faxInteraction:','./faxInteraction.events','save','remove','update'];(function(_0x50bf97,_0x2691d7){var _0x46edaf=function(_0x3ae83e){while(--_0x3ae83e){_0x50bf97['push'](_0x50bf97['shift']());}};_0x46edaf(++_0x2691d7);}(_0xcee7,0xe0));var _0x7cee=function(_0x10bfd8,_0x5e808f){_0x10bfd8=_0x10bfd8-0x0;var _0x17cacc=_0xcee7[_0x10bfd8];return _0x17cacc;};'use strict';var FaxInteractionEvents=require(_0x7cee('0x0'));var events=[_0x7cee('0x1'),_0x7cee('0x2'),_0x7cee('0x3')];function createListener(_0x30ccb9,_0x1fd8b5){return function(_0x4538fb){_0x1fd8b5['emit'](_0x30ccb9,_0x4538fb);};}function removeListener(_0xc34e6b,_0x3b2ad1){return function(){FaxInteractionEvents['removeListener'](_0xc34e6b,_0x3b2ad1);};}exports[_0x7cee('0x4')]=function(_0x1b80e1){for(var _0x3eef15=0x0,_0x14b76a=events['length'];_0x3eef15<_0x14b76a;_0x3eef15++){var _0x2f8481=events[_0x3eef15];var _0x4a229e=createListener(_0x7cee('0x5')+_0x2f8481,_0x1b80e1);FaxInteractionEvents['on'](_0x2f8481,_0x4a229e);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 5930949..6bfee0f 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 _0xe706=['destroy','removeTags','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','create','post','addMessage','/:id/tags','faxinteraction:addtags','fax','update','delete','tracked','faxinteraction:destroy'];(function(_0x4500c5,_0x3326b8){var _0x302094=function(_0x484d1c){while(--_0x484d1c){_0x4500c5['push'](_0x4500c5['shift']());}};_0x302094(++_0x3326b8);}(_0xe706,0xa3));var _0x6e70=function(_0x50f382,_0x32473c){_0x50f382=_0x50f382-0x0;var _0x16afda=_0xe706[_0x50f382];return _0x16afda;};'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 auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x9')](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x9')](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x9')](_0x6e70('0x12'),auth[_0x6e70('0xa')](),controller['download']);router['post']('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);router[_0x6e70('0x14')](_0x6e70('0x10'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x15')]);router[_0x6e70('0x14')](_0x6e70('0x16'),auth['isAuthenticated'](),interaction['tracked']('fax',_0x6e70('0x17')),controller['addTags']);router['put'](_0x6e70('0xe'),auth[_0x6e70('0xa')](),interaction['tracked'](_0x6e70('0x18'),'faxinteraction:update'),controller[_0x6e70('0x19')]);router[_0x6e70('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x6e70('0x1b')]('fax',_0x6e70('0x1c')),controller[_0x6e70('0x1d')]);router['delete']('/:id/tags',auth[_0x6e70('0xa')](),controller[_0x6e70('0x1e')]);module[_0x6e70('0x1f')]=router; \ No newline at end of file +var _0x4024=['addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','/:id','faxinteraction:update','update','delete','removeTags','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./faxInteraction.controller','index','get','/describe','describe','isAuthenticated','/:id/messages','getMessages','/:id/download','download','post','create'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4024,0x89));var _0x4402=function(_0x94ab23,_0x3a4204){_0x94ab23=_0x94ab23-0x0;var _0x528e18=_0x4024[_0x94ab23];return _0x528e18;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var auth=require(_0x4402('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4402('0x5'));var controller=require(_0x4402('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x4402('0x7')]);router[_0x4402('0x8')](_0x4402('0x9'),auth['isAuthenticated'](),controller[_0x4402('0xa')]);router['get']('/:id',auth[_0x4402('0xb')](),controller['show']);router['get'](_0x4402('0xc'),auth['isAuthenticated'](),controller[_0x4402('0xd')]);router['get'](_0x4402('0xe'),auth['isAuthenticated'](),controller[_0x4402('0xf')]);router[_0x4402('0x10')]('/',auth['isAuthenticated'](),controller[_0x4402('0x11')]);router[_0x4402('0x10')](_0x4402('0xc'),auth['isAuthenticated'](),controller[_0x4402('0x12')]);router[_0x4402('0x10')](_0x4402('0x13'),auth[_0x4402('0xb')](),interaction[_0x4402('0x14')](_0x4402('0x15'),_0x4402('0x16')),controller[_0x4402('0x17')]);router[_0x4402('0x18')](_0x4402('0x19'),auth[_0x4402('0xb')](),interaction[_0x4402('0x14')](_0x4402('0x15'),_0x4402('0x1a')),controller[_0x4402('0x1b')]);router[_0x4402('0x1c')](_0x4402('0x19'),auth[_0x4402('0xb')](),interaction[_0x4402('0x14')](_0x4402('0x15'),'faxinteraction:destroy'),controller['destroy']);router[_0x4402('0x1c')](_0x4402('0x13'),auth['isAuthenticated'](),controller[_0x4402('0x1d')]);module[_0x4402('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index c43d8b3..107dabe 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 _0x2b99=['sequelize','TEXT','out','DATE'];(function(_0x3a5648,_0x58054e){var _0x34126d=function(_0x3a6476){while(--_0x3a6476){_0x3a5648['push'](_0x3a5648['shift']());}};_0x34126d(++_0x58054e);}(_0x2b99,0x12c));var _0x92b9=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x2b99[_0x341e0f];return _0x59555a;};'use strict';var Sequelize=require(_0x92b9('0x0'));module['exports']={'body':{'type':Sequelize[_0x92b9('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x92b9('0x2')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x92b9('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x92b9('0x3')]}}; \ No newline at end of file +var _0xc37e=['sequelize','exports','TEXT','medium','out','DATE'];(function(_0x3e4d9a,_0x449a9f){var _0x4124d3=function(_0x3dd192){while(--_0x3dd192){_0x3e4d9a['push'](_0x3e4d9a['shift']());}};_0x4124d3(++_0x449a9f);}(_0xc37e,0x162));var _0xec37=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc37e[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0xec37('0x0'));module[_0xec37('0x1')]={'body':{'type':Sequelize[_0xec37('0x2')](_0xec37('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xec37('0x4')),'defaultValue':_0xec37('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xec37('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xec37('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index f45c8c4..ea05d66 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 _0xb62e=['message','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','body','describe','fax-interactions','accept','fax','format','UserId','user','agent','CmContact','Contact','get','FaxInteraction','FaxInteractionId','update','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectmessage','create','findOne','Attachment','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','root','server','files','attachments','join','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','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','redis','defaults','localhost','./faxMessage.socket','register','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2ac4af,_0x288c53){var _0x3a36df=function(_0x271b11){while(--_0x271b11){_0x2ac4af['push'](_0x2ac4af['shift']());}};_0x3a36df(++_0x288c53);}(_0xb62e,0x1de));var _0xeb62=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xb62e[_0x3b380d];return _0x54502b;};'use strict';var pdf=require(_0xeb62('0x0'));var emlformat=require(_0xeb62('0x1'));var rimraf=require(_0xeb62('0x2'));var zipdir=require(_0xeb62('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb62('0x4'));var moment=require(_0xeb62('0x5'));var BPromise=require(_0xeb62('0x6'));var Mustache=require(_0xeb62('0x7'));var util=require(_0xeb62('0x8'));var path=require(_0xeb62('0x9'));var sox=require('sox');var csv=require(_0xeb62('0xa'));var ejs=require(_0xeb62('0xb'));var fs=require('fs');var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x10'));var authService=require(_0xeb62('0x11'));var qs=require(_0xeb62('0x12'));var as=require(_0xeb62('0x13'));var hardwareService=require(_0xeb62('0x14'));var logger=require(_0xeb62('0x15'))(_0xeb62('0x16'));var utils=require(_0xeb62('0x17'));var config=require(_0xeb62('0x18'));var licenseUtil=require(_0xeb62('0x19'));var db=require('../../mysqldb')['db'];config[_0xeb62('0x1a')]=_[_0xeb62('0x1b')](config[_0xeb62('0x1a')],{'host':_0xeb62('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb62('0x1a')]));require(_0xeb62('0x1d'))[_0xeb62('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xeb62('0x1f')][_0xeb62('0x20')]({'port':0x232c});var client9002=jayson[_0xeb62('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f6a1f,_0x15b3e8,_0x184106,_0x353e2c){return new BPromise(function(_0x3fb280,_0x370474){var _0x1fb460=_0x353e2c||client;return _0x1fb460[_0xeb62('0x21')](_0x1f6a1f,_0x184106)[_0xeb62('0x22')](function(_0x27fd84){logger[_0xeb62('0x23')](_0xeb62('0x24'),_0x15b3e8,_0xeb62('0x25'));logger['debug'](_0xeb62('0x26'),_0x15b3e8,_0xeb62('0x25'),JSON[_0xeb62('0x27')](_0x27fd84));if(_0x27fd84[_0xeb62('0x28')]){if(_0x27fd84[_0xeb62('0x28')][_0xeb62('0x29')]===0x1f4){logger[_0xeb62('0x28')]('FaxMessage,\x20%s,\x20%s',_0x15b3e8,_0x27fd84['error'][_0xeb62('0x2a')]);return _0x370474(_0x27fd84[_0xeb62('0x28')][_0xeb62('0x2a')]);}logger[_0xeb62('0x28')](_0xeb62('0x24'),_0x15b3e8,_0x27fd84['error']['message']);return _0x3fb280(_0x27fd84[_0xeb62('0x28')][_0xeb62('0x2a')]);}else{logger[_0xeb62('0x23')](_0xeb62('0x24'),_0x15b3e8,'request\x20sent');_0x3fb280(_0x27fd84['result'][_0xeb62('0x2a')]);}})['catch'](function(_0x448327){logger['error'](_0xeb62('0x24'),_0x15b3e8,_0x448327);_0x370474(_0x448327);});});}function respondWithStatusCode(_0x516a72,_0x3ac28c){_0x3ac28c=_0x3ac28c||0xcc;return function(_0x6bfbbc){if(_0x6bfbbc){return _0x516a72[_0xeb62('0x2b')](_0x3ac28c);}return _0x516a72['status'](_0x3ac28c)[_0xeb62('0x2c')]();};}function respondWithResult(_0x3ae031,_0x5222f4){_0x5222f4=_0x5222f4||0xc8;return function(_0xe8872c){if(_0xe8872c){return _0x3ae031[_0xeb62('0x2d')](_0x5222f4)[_0xeb62('0x2e')](_0xe8872c);}};}function respondWithFilteredResult(_0x511202,_0x192517){return function(_0x1616ee){if(_0x1616ee){var _0x57169a=_0x1616ee[_0xeb62('0x2f')],_0x157474=_0x192517[_0xeb62('0x30')],_0x2b51b2=_0x192517['offset']+_0x192517['limit'],_0x2c967c;if(_0x2b51b2>=_0x57169a){_0x2b51b2=_0x57169a;_0x2c967c=0xc8;}else{_0x2c967c=0xce;}_0x511202[_0xeb62('0x2d')](_0x2c967c);return _0x511202[_0xeb62('0x31')](_0xeb62('0x32'),_0x157474+'-'+_0x2b51b2+'/'+_0x57169a)[_0xeb62('0x2e')](_0x1616ee);}return null;};}function patchUpdates(_0x42b197){return function(_0x2ad3ec){try{jsonpatch[_0xeb62('0x33')](_0x2ad3ec,_0x42b197,!![]);}catch(_0x4be25d){return BPromise[_0xeb62('0x34')](_0x4be25d);}return _0x2ad3ec['save']();};}function saveUpdates(_0x555db1,_0x4030e1){return function(_0x286455){if(_0x286455){return _0x286455['update'](_0x555db1)[_0xeb62('0x22')](function(_0x4bcfce){return _0x4bcfce;});}return null;};}function removeEntity(_0x1c2195,_0xc0d2e4){return function(_0x530587){if(_0x530587){return _0x530587[_0xeb62('0x35')]()[_0xeb62('0x22')](function(){_0x1c2195['status'](0xcc)[_0xeb62('0x2c')]();});}};}function handleEntityNotFound(_0x2a8087,_0x38b116){return function(_0x2203cb){if(!_0x2203cb){_0x2a8087['sendStatus'](0x194);}return _0x2203cb;};}function handleError(_0x4863fe,_0x43685b){_0x43685b=_0x43685b||0x1f4;return function(_0x4cf6b0){logger['error'](_0x4cf6b0[_0xeb62('0x36')]);if(_0x4cf6b0[_0xeb62('0x37')]){delete _0x4cf6b0['name'];}_0x4863fe[_0xeb62('0x2d')](_0x43685b)[_0xeb62('0x38')](_0x4cf6b0);};}exports[_0xeb62('0x39')]=function(_0x1f839a,_0x21f604){var _0x15387a={},_0x40106b={},_0x4b22c8={'count':0x0,'rows':[]};var _0x54ea4b=_[_0xeb62('0x3a')](db[_0xeb62('0x3b')][_0xeb62('0x3c')],function(_0xa66e8f){return{'name':_0xa66e8f['fieldName'],'type':_0xa66e8f[_0xeb62('0x3d')]['key']};});_0x40106b[_0xeb62('0x3e')]=_[_0xeb62('0x3a')](_0x54ea4b,_0xeb62('0x37'));_0x40106b[_0xeb62('0x3f')]=_[_0xeb62('0x40')](_0x1f839a[_0xeb62('0x3f')]);_0x40106b[_0xeb62('0x41')]=_[_0xeb62('0x42')](_0x40106b['model'],_0x40106b[_0xeb62('0x3f')]);_0x15387a[_0xeb62('0x43')]=_[_0xeb62('0x42')](_0x40106b[_0xeb62('0x3e')],qs['fields'](_0x1f839a['query'][_0xeb62('0x44')]));_0x15387a[_0xeb62('0x43')]=_0x15387a['attributes'][_0xeb62('0x45')]?_0x15387a[_0xeb62('0x43')]:_0x40106b['model'];if(!_0x1f839a[_0xeb62('0x3f')]['hasOwnProperty'](_0xeb62('0x46'))){_0x15387a['limit']=qs[_0xeb62('0x47')](_0x1f839a['query'][_0xeb62('0x47')]);_0x15387a[_0xeb62('0x30')]=qs[_0xeb62('0x30')](_0x1f839a['query']['offset']);}_0x15387a[_0xeb62('0x48')]=qs[_0xeb62('0x49')](_0x1f839a[_0xeb62('0x3f')][_0xeb62('0x49')]);_0x15387a[_0xeb62('0x4a')]=qs['filters'](_[_0xeb62('0x4b')](_0x1f839a['query'],_0x40106b[_0xeb62('0x41')]),_0x54ea4b);if(_0x1f839a['query'][_0xeb62('0x4c')]){_0x15387a['where']=_[_0xeb62('0x4d')](_0x15387a['where'],{'$or':_[_0xeb62('0x3a')](_0x54ea4b,function(_0x4624e7){if(_0x4624e7[_0xeb62('0x3d')]!==_0xeb62('0x4e')){var _0x293e6f={};_0x293e6f[_0x4624e7[_0xeb62('0x37')]]={'$like':'%'+_0x1f839a['query'][_0xeb62('0x4c')]+'%'};return _0x293e6f;}})});}_0x15387a=_[_0xeb62('0x4d')]({},_0x15387a,_0x1f839a['options']);var _0x4a43ad={'where':_0x15387a['where']};return db['FaxMessage'][_0xeb62('0x2f')](_0x4a43ad)[_0xeb62('0x22')](function(_0x53a06b){_0x4b22c8[_0xeb62('0x2f')]=_0x53a06b;if(_0x1f839a[_0xeb62('0x3f')][_0xeb62('0x4f')]){_0x15387a[_0xeb62('0x50')]=[{'all':!![]}];}return db[_0xeb62('0x3b')]['findAll'](_0x15387a);})[_0xeb62('0x22')](function(_0x5f47cf){_0x4b22c8[_0xeb62('0x51')]=_0x5f47cf;return _0x4b22c8;})[_0xeb62('0x22')](respondWithFilteredResult(_0x21f604,_0x15387a))[_0xeb62('0x52')](handleError(_0x21f604,null));};exports[_0xeb62('0x53')]=function(_0x1f2d87,_0x2736d4){var _0x321e55={'raw':!![],'where':{'id':_0x1f2d87[_0xeb62('0x54')]['id']}},_0x184c01={};_0x184c01[_0xeb62('0x3e')]=_[_0xeb62('0x40')](db[_0xeb62('0x3b')]['rawAttributes']);_0x184c01[_0xeb62('0x3f')]=_['keys'](_0x1f2d87['query']);_0x184c01[_0xeb62('0x41')]=_[_0xeb62('0x42')](_0x184c01['model'],_0x184c01[_0xeb62('0x3f')]);_0x321e55[_0xeb62('0x43')]=_['intersection'](_0x184c01[_0xeb62('0x3e')],qs[_0xeb62('0x44')](_0x1f2d87[_0xeb62('0x3f')][_0xeb62('0x44')]));_0x321e55[_0xeb62('0x43')]=_0x321e55[_0xeb62('0x43')][_0xeb62('0x45')]?_0x321e55[_0xeb62('0x43')]:_0x184c01['model'];if(_0x1f2d87[_0xeb62('0x3f')]['includeAll']){_0x321e55[_0xeb62('0x50')]=[{'all':!![]}];}_0x321e55=_[_0xeb62('0x4d')]({},_0x321e55,_0x1f2d87[_0xeb62('0x55')]);return db[_0xeb62('0x3b')][_0xeb62('0x56')](_0x321e55)[_0xeb62('0x22')](handleEntityNotFound(_0x2736d4,null))[_0xeb62('0x22')](respondWithResult(_0x2736d4,null))[_0xeb62('0x52')](handleError(_0x2736d4,null));};exports['update']=function(_0x4d31a1,_0x50ed53){if(_0x4d31a1['body']['id']){delete _0x4d31a1[_0xeb62('0x57')]['id'];}return db['FaxMessage'][_0xeb62('0x56')]({'where':{'id':_0x4d31a1['params']['id']}})[_0xeb62('0x22')](handleEntityNotFound(_0x50ed53,null))[_0xeb62('0x22')](saveUpdates(_0x4d31a1[_0xeb62('0x57')],null))['then'](respondWithResult(_0x50ed53,null))[_0xeb62('0x52')](handleError(_0x50ed53,null));};exports[_0xeb62('0x35')]=function(_0x518dd4,_0x35982a){return db[_0xeb62('0x3b')][_0xeb62('0x56')]({'where':{'id':_0x518dd4[_0xeb62('0x54')]['id']}})['then'](handleEntityNotFound(_0x35982a,null))[_0xeb62('0x22')](removeEntity(_0x35982a,null))[_0xeb62('0x52')](handleError(_0x35982a,null));};exports['describe']=function(_0x2eba52,_0x5d1415){return db[_0xeb62('0x3b')][_0xeb62('0x58')]()[_0xeb62('0x22')](respondWithResult(_0x5d1415,null))[_0xeb62('0x52')](handleError(_0x5d1415,null));};var interaction_log=require(_0xeb62('0x15'))(_0xeb62('0x59'));exports[_0xeb62('0x5a')]=function(_0x1db841,_0x130153,_0x15c93f){var _0x200b43={'agent':{},'channel':_0xeb62('0x5b')};if(_0x1db841[_0xeb62('0x57')]['id']){delete _0x1db841[_0xeb62('0x57')]['id'];}_0x1db841['body']['read']=!![];_0x1db841['body']['readAt']=moment()[_0xeb62('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x1db841[_0xeb62('0x57')][_0xeb62('0x5d')]=_0x1db841[_0xeb62('0x57')][_0xeb62('0x5d')]||_0x1db841[_0xeb62('0x5e')]['id'];_0x200b43[_0xeb62('0x5f')]['id']=_0x1db841[_0xeb62('0x57')][_0xeb62('0x5d')];return db[_0xeb62('0x3b')][_0xeb62('0x56')]({'where':{'id':_0x1db841['params']['id'],'UserId':null},'include':[{'model':db[_0xeb62('0x60')],'as':_0xeb62('0x61')}]})[_0xeb62('0x22')](handleEntityNotFound(_0x130153,null))[_0xeb62('0x22')](saveUpdates(_0x1db841['body'],null))[_0xeb62('0x22')](function(_0x2e5456){if(_0x2e5456){_0x200b43[_0xeb62('0x2a')]=_0x2e5456[_0xeb62('0x62')]({'plain':!![]});return db[_0xeb62('0x63')][_0xeb62('0x56')]({'where':{'id':_0x2e5456[_0xeb62('0x64')]}});}return null;})[_0xeb62('0x22')](handleEntityNotFound(_0x130153,null))[_0xeb62('0x22')](function(_0x2b788e){if(_0x2b788e){return _0x2b788e[_0xeb62('0x65')]({'UserId':_0x1db841['body'][_0xeb62('0x5d')],'read1stAt':_[_0xeb62('0x66')](_0x2b788e[_0xeb62('0x67')])?moment()[_0xeb62('0x5c')](_0xeb62('0x68')):undefined});}return null;})[_0xeb62('0x22')](function(_0x388b31){if(_0x388b31){_0x200b43[_0xeb62('0x69')]=_0x388b31[_0xeb62('0x62')]({'plain':!![]});interaction_log[_0xeb62('0x23')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1db841[_0xeb62('0x5e')]['id'],_0x1db841[_0xeb62('0x5e')][_0xeb62('0x37')],_0x1db841[_0xeb62('0x5e')]['role'],_0x200b43[_0xeb62('0x69')]['id'],_0x1db841[_0xeb62('0x57')]?JSON[_0xeb62('0x27')](_0x1db841[_0xeb62('0x57')]):_0xeb62('0x6a'));return respondWithRpcPromise(_0xeb62('0x6b'),'acceptMessage',_0x200b43);}return null;})[_0xeb62('0x22')](function(_0x1b56cf){if(_0x1b56cf){if(_0x1db841[_0xeb62('0x57')][_0xeb62('0x6c')]){_0x200b43[_0xeb62('0x2a')][_0xeb62('0x6d')]=util[_0xeb62('0x5c')](_0xeb62('0x6e'),_0x1db841[_0xeb62('0x5e')][_0xeb62('0x37')]);_0x200b43[_0xeb62('0x2a')][_0xeb62('0x6f')]=_0x200b43[_0xeb62('0x6f')];_0x200b43[_0xeb62('0x2a')][_0xeb62('0x70')]=_0xeb62('0x5a');return respondWithRpcPromise('EventManager',_0xeb62('0x71'),{'event':'acceptmessage','message':_0x200b43[_0xeb62('0x2a')]},client9002)[_0xeb62('0x22')](function(){return _0x200b43;});}return _0x200b43;}return null;})['then'](respondWithResult(_0x130153,null))[_0xeb62('0x52')](handleError(_0x130153,null));};var interaction_log=require(_0xeb62('0x15'))(_0xeb62('0x59'));exports[_0xeb62('0x34')]=function(_0x206e77,_0x7a12cd,_0x385cc5){var _0x449582={'agent':{},'channel':_0xeb62('0x5b')};if(_0x206e77[_0xeb62('0x57')]['id']){delete _0x206e77[_0xeb62('0x57')]['id'];}_0x206e77[_0xeb62('0x57')][_0xeb62('0x5d')]=_0x206e77['body'][_0xeb62('0x5d')]||_0x206e77[_0xeb62('0x5e')]['id'];_0x449582['agent']['id']=_0x206e77[_0xeb62('0x57')]['UserId'];return db[_0xeb62('0x3b')][_0xeb62('0x56')]({'where':{'id':_0x206e77[_0xeb62('0x54')]['id'],'UserId':null}})[_0xeb62('0x22')](handleEntityNotFound(_0x7a12cd,null))[_0xeb62('0x22')](function(_0x33fbda){if(_0x33fbda){_0x449582['message']=_0x33fbda[_0xeb62('0x62')]({'plain':!![]});return db['FaxInteraction'][_0xeb62('0x56')]({'where':{'id':_0x33fbda[_0xeb62('0x64')]}});}return null;})[_0xeb62('0x22')](handleEntityNotFound(_0x7a12cd,null))[_0xeb62('0x22')](function(_0x1dcd96){if(_0x1dcd96){_0x449582['interaction']=_0x1dcd96[_0xeb62('0x62')]({'plain':!![]});interaction_log[_0xeb62('0x23')](_0xeb62('0x72'),_0x206e77['user']['id'],_0x206e77[_0xeb62('0x5e')][_0xeb62('0x37')],_0x206e77[_0xeb62('0x5e')][_0xeb62('0x73')],_0x449582[_0xeb62('0x69')]['id'],_0x206e77[_0xeb62('0x57')]?JSON['stringify'](_0x206e77['body']):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x449582);}return null;})[_0xeb62('0x22')](function(_0x231362){if(_0x231362){_0x231362[_0xeb62('0x2a')][_0xeb62('0x6d')]=util[_0xeb62('0x5c')](_0xeb62('0x6e'),_0x206e77[_0xeb62('0x5e')][_0xeb62('0x37')]);_0x231362[_0xeb62('0x2a')][_0xeb62('0x6f')]=_0x449582[_0xeb62('0x6f')];_0x231362[_0xeb62('0x2a')]['event']=_0xeb62('0x34');respondWithRpcPromise(_0xeb62('0x71'),_0xeb62('0x71'),{'event':_0xeb62('0x74'),'message':_0x231362[_0xeb62('0x2a')]},client9002);return _0x449582;}return null;})[_0xeb62('0x22')](respondWithResult(_0x7a12cd,null))[_0xeb62('0x52')](handleError(_0x7a12cd,null));};exports[_0xeb62('0x75')]=function(_0x1bb222,_0x33b16b){var _0x124847;return db[_0xeb62('0x3b')][_0xeb62('0x75')](_0x1bb222[_0xeb62('0x57')],{})[_0xeb62('0x22')](function(_0x1cbfab){_0x124847=_0x1cbfab;return db[_0xeb62('0x60')][_0xeb62('0x76')]({'where':{'id':_0x124847['ContactId']}});})[_0xeb62('0x22')](function(_0x544b2e){if(_[_0xeb62('0x66')](_0x544b2e)){return;}else{_0x124847[_0xeb62('0x5b')]=_0x544b2e['fax'];return db[_0xeb62('0x77')]['findOne']({'where':{'id':_0x124847['AttachmentId']}});}})[_0xeb62('0x22')](function(_0x218139){return respondWithRpcPromise(_0xeb62('0x78'),_0xeb62('0x78'),{'FaxAccountId':_['isNil'](_0x1bb222[_0xeb62('0x57')])?undefined:_0x1bb222[_0xeb62('0x57')]['FaxAccountId'],'path':_[_0xeb62('0x66')](_0x218139)?undefined:util[_0xeb62('0x5c')](_0xeb62('0x79'),_0x218139[_0xeb62('0x7a')]),'fax':_[_0xeb62('0x66')](_0x124847[_0xeb62('0x5b')])?undefined:_0x124847[_0xeb62('0x5b')],'AttachmentId':_0x124847[_0xeb62('0x7b')]},client9002);})['then'](respondWithResult(_0x33b16b,0xc9))[_0xeb62('0x52')](handleError(_0x33b16b,null));};exports[_0xeb62('0x7c')]=function(_0x5b1bfc,_0x3c6de8){var _0x5c83b8=path['join'](config[_0xeb62('0x7d')],_0xeb62('0x7e'),_0xeb62('0x7f'),_0xeb62('0x80'));return db[_0xeb62('0x3b')]['find']({'where':{'id':_0x5b1bfc[_0xeb62('0x54')]['id']},'include':[{'model':db[_0xeb62('0x77')],'as':_0xeb62('0x77')}]})[_0xeb62('0x22')](handleEntityNotFound(_0x3c6de8,null))[_0xeb62('0x22')](function(_0x948c7f){if(_0x948c7f){return _0x3c6de8[_0xeb62('0x7c')](path[_0xeb62('0x81')](_0x5c83b8,_0x948c7f['Attachment']['basename']));}})[_0xeb62('0x52')](handleError(_0x3c6de8,null));}; \ No newline at end of file +var _0xe5b5=['FaxInteractionId','read1stAt','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','manual','interface','channel','EventManager','agent','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SIP/%s','event','rejectmessage','create','findOne','isNil','fax','AttachmentId','SendFax','FaxAccountId','basename','download','join','Attachment','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','jayson/promise','client','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','set','apply','reject','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','find','body','describe','fax-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact'];(function(_0x1c2731,_0x4c3d82){var _0x4543a8=function(_0x79829a){while(--_0x79829a){_0x1c2731['push'](_0x1c2731['shift']());}};_0x4543a8(++_0x4c3d82);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x1fcf1b,_0x214549){_0x1fcf1b=_0x1fcf1b-0x0;var _0x5d2952=_0xe5b5[_0x1fcf1b];return _0x5d2952;};'use strict';var pdf=require(_0x5e5b('0x0'));var emlformat=require(_0x5e5b('0x1'));var rimraf=require(_0x5e5b('0x2'));var zipdir=require(_0x5e5b('0x3'));var jsonpatch=require(_0x5e5b('0x4'));var rp=require(_0x5e5b('0x5'));var moment=require(_0x5e5b('0x6'));var BPromise=require(_0x5e5b('0x7'));var Mustache=require(_0x5e5b('0x8'));var util=require(_0x5e5b('0x9'));var path=require(_0x5e5b('0xa'));var sox=require(_0x5e5b('0xb'));var csv=require(_0x5e5b('0xc'));var ejs=require(_0x5e5b('0xd'));var fs=require('fs');var _=require(_0x5e5b('0xe'));var squel=require(_0x5e5b('0xf'));var crypto=require(_0x5e5b('0x10'));var jsforce=require(_0x5e5b('0x11'));var deskjs=require(_0x5e5b('0x12'));var toCsv=require(_0x5e5b('0xc'));var querystring=require(_0x5e5b('0x13'));var Papa=require(_0x5e5b('0x14'));var Redis=require(_0x5e5b('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x5e5b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e5b('0x17'));var logger=require(_0x5e5b('0x18'))(_0x5e5b('0x19'));var utils=require(_0x5e5b('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x5e5b('0x1b')]=_[_0x5e5b('0x1c')](config[_0x5e5b('0x1b')],{'host':_0x5e5b('0x1d'),'port':0x18eb});var socket=require(_0x5e5b('0x1e'))(new Redis(config[_0x5e5b('0x1b')]));require(_0x5e5b('0x1f'))['register'](socket);var jayson=require(_0x5e5b('0x20'));var client=jayson[_0x5e5b('0x21')]['http']({'port':0x232c});var client9002=jayson[_0x5e5b('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e9509,_0x13a1cb,_0x444435,_0xaf9ace){return new BPromise(function(_0x5c7148,_0x38fdcc){var _0x4d490c=_0xaf9ace||client;return _0x4d490c[_0x5e5b('0x22')](_0x4e9509,_0x444435)[_0x5e5b('0x23')](function(_0x4c5f9a){logger[_0x5e5b('0x24')](_0x5e5b('0x25'),_0x13a1cb,_0x5e5b('0x26'));logger['debug'](_0x5e5b('0x27'),_0x13a1cb,_0x5e5b('0x26'),JSON['stringify'](_0x4c5f9a));if(_0x4c5f9a[_0x5e5b('0x28')]){if(_0x4c5f9a[_0x5e5b('0x28')][_0x5e5b('0x29')]===0x1f4){logger[_0x5e5b('0x28')](_0x5e5b('0x25'),_0x13a1cb,_0x4c5f9a[_0x5e5b('0x28')][_0x5e5b('0x2a')]);return _0x38fdcc(_0x4c5f9a[_0x5e5b('0x28')]['message']);}logger['error'](_0x5e5b('0x25'),_0x13a1cb,_0x4c5f9a[_0x5e5b('0x28')][_0x5e5b('0x2a')]);return _0x5c7148(_0x4c5f9a[_0x5e5b('0x28')][_0x5e5b('0x2a')]);}else{logger[_0x5e5b('0x24')](_0x5e5b('0x25'),_0x13a1cb,_0x5e5b('0x26'));_0x5c7148(_0x4c5f9a[_0x5e5b('0x2b')][_0x5e5b('0x2a')]);}})[_0x5e5b('0x2c')](function(_0x4da321){logger[_0x5e5b('0x28')](_0x5e5b('0x25'),_0x13a1cb,_0x4da321);_0x38fdcc(_0x4da321);});});}function respondWithStatusCode(_0x3527a8,_0x5a2ba8){_0x5a2ba8=_0x5a2ba8||0xcc;return function(_0x988e5d){if(_0x988e5d){return _0x3527a8[_0x5e5b('0x2d')](_0x5a2ba8);}return _0x3527a8['status'](_0x5a2ba8)[_0x5e5b('0x2e')]();};}function respondWithResult(_0x21c74b,_0x39ce16){_0x39ce16=_0x39ce16||0xc8;return function(_0x36b595){if(_0x36b595){return _0x21c74b[_0x5e5b('0x2f')](_0x39ce16)[_0x5e5b('0x30')](_0x36b595);}};}function respondWithFilteredResult(_0x2cb695,_0x2b4351){return function(_0x3f6b25){if(_0x3f6b25){var _0x42da3b=_0x3f6b25['count'],_0xcb272c=_0x2b4351[_0x5e5b('0x31')],_0x28157a=_0x2b4351[_0x5e5b('0x31')]+_0x2b4351[_0x5e5b('0x32')],_0x4ed688;if(_0x28157a>=_0x42da3b){_0x28157a=_0x42da3b;_0x4ed688=0xc8;}else{_0x4ed688=0xce;}_0x2cb695[_0x5e5b('0x2f')](_0x4ed688);return _0x2cb695[_0x5e5b('0x33')]('Content-Range',_0xcb272c+'-'+_0x28157a+'/'+_0x42da3b)[_0x5e5b('0x30')](_0x3f6b25);}return null;};}function patchUpdates(_0x56f5a9){return function(_0x3f1041){try{jsonpatch[_0x5e5b('0x34')](_0x3f1041,_0x56f5a9,!![]);}catch(_0x11fa95){return BPromise[_0x5e5b('0x35')](_0x11fa95);}return _0x3f1041['save']();};}function saveUpdates(_0x22e906,_0x1bc636){return function(_0x524f74){if(_0x524f74){return _0x524f74[_0x5e5b('0x36')](_0x22e906)[_0x5e5b('0x23')](function(_0x34debb){return _0x34debb;});}return null;};}function removeEntity(_0x356db0,_0x14845d){return function(_0x2296dd){if(_0x2296dd){return _0x2296dd[_0x5e5b('0x37')]()[_0x5e5b('0x23')](function(){_0x356db0['status'](0xcc)[_0x5e5b('0x2e')]();});}};}function handleEntityNotFound(_0x37b5be,_0x1aef4a){return function(_0x34396f){if(!_0x34396f){_0x37b5be[_0x5e5b('0x2d')](0x194);}return _0x34396f;};}function handleError(_0x46cafc,_0x4fec9e){_0x4fec9e=_0x4fec9e||0x1f4;return function(_0x5b2ba5){logger[_0x5e5b('0x28')](_0x5b2ba5[_0x5e5b('0x38')]);if(_0x5b2ba5[_0x5e5b('0x39')]){delete _0x5b2ba5['name'];}_0x46cafc[_0x5e5b('0x2f')](_0x4fec9e)[_0x5e5b('0x3a')](_0x5b2ba5);};}exports[_0x5e5b('0x3b')]=function(_0x470b45,_0x54320f){var _0x5b3e0d={},_0x44c6d2={},_0x4f5b67={'count':0x0,'rows':[]};var _0x5ad9a6=_[_0x5e5b('0x3c')](db[_0x5e5b('0x3d')][_0x5e5b('0x3e')],function(_0x550faf){return{'name':_0x550faf[_0x5e5b('0x3f')],'type':_0x550faf['type']['key']};});_0x44c6d2[_0x5e5b('0x40')]=_[_0x5e5b('0x3c')](_0x5ad9a6,_0x5e5b('0x39'));_0x44c6d2[_0x5e5b('0x41')]=_[_0x5e5b('0x42')](_0x470b45[_0x5e5b('0x41')]);_0x44c6d2[_0x5e5b('0x43')]=_[_0x5e5b('0x44')](_0x44c6d2[_0x5e5b('0x40')],_0x44c6d2['query']);_0x5b3e0d[_0x5e5b('0x45')]=_[_0x5e5b('0x44')](_0x44c6d2['model'],qs[_0x5e5b('0x46')](_0x470b45['query'][_0x5e5b('0x46')]));_0x5b3e0d[_0x5e5b('0x45')]=_0x5b3e0d[_0x5e5b('0x45')][_0x5e5b('0x47')]?_0x5b3e0d[_0x5e5b('0x45')]:_0x44c6d2[_0x5e5b('0x40')];if(!_0x470b45[_0x5e5b('0x41')][_0x5e5b('0x48')](_0x5e5b('0x49'))){_0x5b3e0d[_0x5e5b('0x32')]=qs[_0x5e5b('0x32')](_0x470b45['query'][_0x5e5b('0x32')]);_0x5b3e0d[_0x5e5b('0x31')]=qs[_0x5e5b('0x31')](_0x470b45['query'][_0x5e5b('0x31')]);}_0x5b3e0d[_0x5e5b('0x4a')]=qs['sort'](_0x470b45[_0x5e5b('0x41')][_0x5e5b('0x4b')]);_0x5b3e0d['where']=qs[_0x5e5b('0x43')](_['pick'](_0x470b45['query'],_0x44c6d2['filters']),_0x5ad9a6);if(_0x470b45[_0x5e5b('0x41')]['filter']){_0x5b3e0d[_0x5e5b('0x4c')]=_['merge'](_0x5b3e0d[_0x5e5b('0x4c')],{'$or':_[_0x5e5b('0x3c')](_0x5ad9a6,function(_0x2bc089){if(_0x2bc089[_0x5e5b('0x4d')]!==_0x5e5b('0x4e')){var _0x425531={};_0x425531[_0x2bc089[_0x5e5b('0x39')]]={'$like':'%'+_0x470b45['query']['filter']+'%'};return _0x425531;}})});}_0x5b3e0d=_[_0x5e5b('0x4f')]({},_0x5b3e0d,_0x470b45['options']);var _0x54729b={'where':_0x5b3e0d['where']};return db[_0x5e5b('0x3d')]['count'](_0x54729b)[_0x5e5b('0x23')](function(_0x414dbd){_0x4f5b67[_0x5e5b('0x50')]=_0x414dbd;if(_0x470b45[_0x5e5b('0x41')][_0x5e5b('0x51')]){_0x5b3e0d[_0x5e5b('0x52')]=[{'all':!![]}];}return db['FaxMessage'][_0x5e5b('0x53')](_0x5b3e0d);})[_0x5e5b('0x23')](function(_0x4f110f){_0x4f5b67[_0x5e5b('0x54')]=_0x4f110f;return _0x4f5b67;})['then'](respondWithFilteredResult(_0x54320f,_0x5b3e0d))[_0x5e5b('0x2c')](handleError(_0x54320f,null));};exports[_0x5e5b('0x55')]=function(_0x42ebaf,_0x30de85){var _0x4b2ef6={'raw':!![],'where':{'id':_0x42ebaf[_0x5e5b('0x56')]['id']}},_0x1ae9e4={};_0x1ae9e4['model']=_[_0x5e5b('0x42')](db[_0x5e5b('0x3d')][_0x5e5b('0x3e')]);_0x1ae9e4[_0x5e5b('0x41')]=_[_0x5e5b('0x42')](_0x42ebaf[_0x5e5b('0x41')]);_0x1ae9e4['filters']=_[_0x5e5b('0x44')](_0x1ae9e4[_0x5e5b('0x40')],_0x1ae9e4['query']);_0x4b2ef6[_0x5e5b('0x45')]=_[_0x5e5b('0x44')](_0x1ae9e4[_0x5e5b('0x40')],qs['fields'](_0x42ebaf[_0x5e5b('0x41')][_0x5e5b('0x46')]));_0x4b2ef6[_0x5e5b('0x45')]=_0x4b2ef6['attributes'][_0x5e5b('0x47')]?_0x4b2ef6[_0x5e5b('0x45')]:_0x1ae9e4[_0x5e5b('0x40')];if(_0x42ebaf['query']['includeAll']){_0x4b2ef6[_0x5e5b('0x52')]=[{'all':!![]}];}_0x4b2ef6=_['merge']({},_0x4b2ef6,_0x42ebaf['options']);return db[_0x5e5b('0x3d')][_0x5e5b('0x57')](_0x4b2ef6)[_0x5e5b('0x23')](handleEntityNotFound(_0x30de85,null))['then'](respondWithResult(_0x30de85,null))[_0x5e5b('0x2c')](handleError(_0x30de85,null));};exports[_0x5e5b('0x36')]=function(_0x148032,_0x3c518a){if(_0x148032[_0x5e5b('0x58')]['id']){delete _0x148032[_0x5e5b('0x58')]['id'];}return db['FaxMessage']['find']({'where':{'id':_0x148032[_0x5e5b('0x56')]['id']}})[_0x5e5b('0x23')](handleEntityNotFound(_0x3c518a,null))[_0x5e5b('0x23')](saveUpdates(_0x148032[_0x5e5b('0x58')],null))['then'](respondWithResult(_0x3c518a,null))[_0x5e5b('0x2c')](handleError(_0x3c518a,null));};exports['destroy']=function(_0x325f87,_0x2fdeb5){return db[_0x5e5b('0x3d')][_0x5e5b('0x57')]({'where':{'id':_0x325f87[_0x5e5b('0x56')]['id']}})[_0x5e5b('0x23')](handleEntityNotFound(_0x2fdeb5,null))[_0x5e5b('0x23')](removeEntity(_0x2fdeb5,null))[_0x5e5b('0x2c')](handleError(_0x2fdeb5,null));};exports['describe']=function(_0x3963eb,_0x21b1d5){return db[_0x5e5b('0x3d')][_0x5e5b('0x59')]()[_0x5e5b('0x23')](respondWithResult(_0x21b1d5,null))['catch'](handleError(_0x21b1d5,null));};var interaction_log=require(_0x5e5b('0x18'))(_0x5e5b('0x5a'));exports[_0x5e5b('0x5b')]=function(_0x3fc9b5,_0x27d775,_0x5207e0){var _0x13fb51={'agent':{},'channel':'fax'};if(_0x3fc9b5[_0x5e5b('0x58')]['id']){delete _0x3fc9b5['body']['id'];}_0x3fc9b5[_0x5e5b('0x58')][_0x5e5b('0x5c')]=!![];_0x3fc9b5[_0x5e5b('0x58')][_0x5e5b('0x5d')]=moment()[_0x5e5b('0x5e')](_0x5e5b('0x5f'));_0x3fc9b5['body'][_0x5e5b('0x60')]=_0x3fc9b5[_0x5e5b('0x58')][_0x5e5b('0x60')]||_0x3fc9b5[_0x5e5b('0x61')]['id'];_0x13fb51['agent']['id']=_0x3fc9b5['body'][_0x5e5b('0x60')];return db[_0x5e5b('0x3d')]['find']({'where':{'id':_0x3fc9b5[_0x5e5b('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x5e5b('0x62')],'as':_0x5e5b('0x63')}]})[_0x5e5b('0x23')](handleEntityNotFound(_0x27d775,null))[_0x5e5b('0x23')](saveUpdates(_0x3fc9b5['body'],null))[_0x5e5b('0x23')](function(_0x61faf2){if(_0x61faf2){_0x13fb51['message']=_0x61faf2['get']({'plain':!![]});return db['FaxInteraction'][_0x5e5b('0x57')]({'where':{'id':_0x61faf2[_0x5e5b('0x64')]}});}return null;})[_0x5e5b('0x23')](handleEntityNotFound(_0x27d775,null))[_0x5e5b('0x23')](function(_0xe8327e){if(_0xe8327e){return _0xe8327e['update']({'UserId':_0x3fc9b5[_0x5e5b('0x58')][_0x5e5b('0x60')],'read1stAt':_['isNil'](_0xe8327e[_0x5e5b('0x65')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x5e5b('0x23')](function(_0x4fa0db){if(_0x4fa0db){_0x13fb51[_0x5e5b('0x66')]=_0x4fa0db[_0x5e5b('0x67')]({'plain':!![]});interaction_log[_0x5e5b('0x24')](_0x5e5b('0x68'),_0x3fc9b5[_0x5e5b('0x61')]['id'],_0x3fc9b5['user'][_0x5e5b('0x39')],_0x3fc9b5[_0x5e5b('0x61')][_0x5e5b('0x69')],_0x13fb51[_0x5e5b('0x66')]['id'],_0x3fc9b5[_0x5e5b('0x58')]?JSON[_0x5e5b('0x6a')](_0x3fc9b5[_0x5e5b('0x58')]):_0x5e5b('0x6b'));return respondWithRpcPromise(_0x5e5b('0x6c'),_0x5e5b('0x6d'),_0x13fb51);}return null;})[_0x5e5b('0x23')](function(_0x526e25){if(_0x526e25){if(_0x3fc9b5[_0x5e5b('0x58')][_0x5e5b('0x6e')]){_0x13fb51[_0x5e5b('0x2a')][_0x5e5b('0x6f')]=util[_0x5e5b('0x5e')]('SIP/%s',_0x3fc9b5[_0x5e5b('0x61')][_0x5e5b('0x39')]);_0x13fb51[_0x5e5b('0x2a')][_0x5e5b('0x70')]=_0x13fb51[_0x5e5b('0x70')];_0x13fb51[_0x5e5b('0x2a')]['event']=_0x5e5b('0x5b');return respondWithRpcPromise(_0x5e5b('0x71'),_0x5e5b('0x71'),{'event':'acceptmessage','message':_0x13fb51[_0x5e5b('0x2a')]},client9002)[_0x5e5b('0x23')](function(){return _0x13fb51;});}return _0x13fb51;}return null;})[_0x5e5b('0x23')](respondWithResult(_0x27d775,null))[_0x5e5b('0x2c')](handleError(_0x27d775,null));};var interaction_log=require(_0x5e5b('0x18'))(_0x5e5b('0x5a'));exports[_0x5e5b('0x35')]=function(_0x19b457,_0x387a44,_0x4fe5fb){var _0x19035d={'agent':{},'channel':'fax'};if(_0x19b457[_0x5e5b('0x58')]['id']){delete _0x19b457[_0x5e5b('0x58')]['id'];}_0x19b457['body']['UserId']=_0x19b457[_0x5e5b('0x58')][_0x5e5b('0x60')]||_0x19b457['user']['id'];_0x19035d[_0x5e5b('0x72')]['id']=_0x19b457['body']['UserId'];return db[_0x5e5b('0x3d')]['find']({'where':{'id':_0x19b457[_0x5e5b('0x56')]['id'],'UserId':null}})[_0x5e5b('0x23')](handleEntityNotFound(_0x387a44,null))[_0x5e5b('0x23')](function(_0x4ff92a){if(_0x4ff92a){_0x19035d[_0x5e5b('0x2a')]=_0x4ff92a[_0x5e5b('0x67')]({'plain':!![]});return db[_0x5e5b('0x73')]['find']({'where':{'id':_0x4ff92a[_0x5e5b('0x64')]}});}return null;})[_0x5e5b('0x23')](handleEntityNotFound(_0x387a44,null))['then'](function(_0x388dbe){if(_0x388dbe){_0x19035d['interaction']=_0x388dbe['get']({'plain':!![]});interaction_log[_0x5e5b('0x24')](_0x5e5b('0x74'),_0x19b457[_0x5e5b('0x61')]['id'],_0x19b457[_0x5e5b('0x61')][_0x5e5b('0x39')],_0x19b457['user'][_0x5e5b('0x69')],_0x19035d[_0x5e5b('0x66')]['id'],_0x19b457['body']?JSON['stringify'](_0x19b457[_0x5e5b('0x58')]):_0x5e5b('0x6b'));return respondWithRpcPromise(_0x5e5b('0x75'),_0x5e5b('0x76'),_0x19035d);}return null;})[_0x5e5b('0x23')](function(_0x1ad8a9){if(_0x1ad8a9){_0x1ad8a9['message'][_0x5e5b('0x6f')]=util[_0x5e5b('0x5e')](_0x5e5b('0x77'),_0x19b457['user']['name']);_0x1ad8a9[_0x5e5b('0x2a')][_0x5e5b('0x70')]=_0x19035d[_0x5e5b('0x70')];_0x1ad8a9['message'][_0x5e5b('0x78')]=_0x5e5b('0x35');respondWithRpcPromise(_0x5e5b('0x71'),'EventManager',{'event':_0x5e5b('0x79'),'message':_0x1ad8a9[_0x5e5b('0x2a')]},client9002);return _0x19035d;}return null;})[_0x5e5b('0x23')](respondWithResult(_0x387a44,null))['catch'](handleError(_0x387a44,null));};exports[_0x5e5b('0x7a')]=function(_0x9574d3,_0x3052d0){var _0x1dc878;return db[_0x5e5b('0x3d')][_0x5e5b('0x7a')](_0x9574d3['body'],{})[_0x5e5b('0x23')](function(_0x2468d5){_0x1dc878=_0x2468d5;return db['CmContact'][_0x5e5b('0x7b')]({'where':{'id':_0x1dc878['ContactId']}});})[_0x5e5b('0x23')](function(_0x263c07){if(_[_0x5e5b('0x7c')](_0x263c07)){return;}else{_0x1dc878[_0x5e5b('0x7d')]=_0x263c07[_0x5e5b('0x7d')];return db['Attachment'][_0x5e5b('0x7b')]({'where':{'id':_0x1dc878[_0x5e5b('0x7e')]}});}})[_0x5e5b('0x23')](function(_0x48d14){return respondWithRpcPromise(_0x5e5b('0x7f'),_0x5e5b('0x7f'),{'FaxAccountId':_['isNil'](_0x9574d3[_0x5e5b('0x58')])?undefined:_0x9574d3['body'][_0x5e5b('0x80')],'path':_[_0x5e5b('0x7c')](_0x48d14)?undefined:util['format']('/var/opt/motion2/server/files/attachments/%s',_0x48d14[_0x5e5b('0x81')]),'fax':_[_0x5e5b('0x7c')](_0x1dc878[_0x5e5b('0x7d')])?undefined:_0x1dc878[_0x5e5b('0x7d')],'AttachmentId':_0x1dc878[_0x5e5b('0x7e')]},client9002);})[_0x5e5b('0x23')](respondWithResult(_0x3052d0,0xc9))[_0x5e5b('0x2c')](handleError(_0x3052d0,null));};exports[_0x5e5b('0x82')]=function(_0xb0bc7,_0x231eff){var _0x4cfdcc=path[_0x5e5b('0x83')](config['root'],'server','files','attachments');return db[_0x5e5b('0x3d')][_0x5e5b('0x57')]({'where':{'id':_0xb0bc7[_0x5e5b('0x56')]['id']},'include':[{'model':db[_0x5e5b('0x84')],'as':_0x5e5b('0x84')}]})['then'](handleEntityNotFound(_0x231eff,null))[_0x5e5b('0x23')](function(_0x41f47c){if(_0x41f47c){return _0x231eff['download'](path[_0x5e5b('0x83')](_0x4cfdcc,_0x41f47c[_0x5e5b('0x84')][_0x5e5b('0x81')]));}})[_0x5e5b('0x2c')](handleError(_0x231eff,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 182d182..09a0792 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 _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe14b,0x93));var _0xbe14=function(_0x34f9d2,_0x56d403){_0x34f9d2=_0x34f9d2-0x0;var _0x2afe73=_0xe14b[_0x34f9d2];return _0x2afe73;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var FaxMessage=require(_0xbe14('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){FaxMessageEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);FaxMessageEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];FaxMessage[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','FaxMessage','setMaxListeners','update','remove'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x34e8,0x12c));var _0x834e=function(_0x444e65,_0x4fadde){_0x444e65=_0x444e65-0x0;var _0x1c1790=_0x34e8[_0x444e65];return _0x1c1790;};'use strict';var EventEmitter=require(_0x834e('0x0'));var FaxMessage=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){FaxMessageEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);FaxMessageEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 475b85c..69c6488 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 _0xdcfd=['secret','isNil','FaxInteraction','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','FULLTEXT','models','get','direction','toLowerCase','out'];(function(_0x48f683,_0xec583){var _0x13acce=function(_0x26bf13){while(--_0x26bf13){_0x48f683['push'](_0x48f683['shift']());}};_0x13acce(++_0xec583);}(_0xdcfd,0x1c4));var _0xddcf=function(_0x2e249d,_0x41b7e7){_0x2e249d=_0x2e249d-0x0;var _0x1faa37=_0xdcfd[_0x2e249d];return _0x1faa37;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xddcf('0x0'))('api');var moment=require(_0xddcf('0x1'));var BPromise=require('bluebird');var rp=require(_0xddcf('0x2'));var fs=require('fs');var path=require(_0xddcf('0x3'));var rimraf=require(_0xddcf('0x4'));var config=require(_0xddcf('0x5'));var attributes=require(_0xddcf('0x6'));module['exports']=function(_0x34419e,_0x253669){return _0x34419e[_0xddcf('0x7')](_0xddcf('0x8'),attributes,{'tableName':_0xddcf('0x9'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0xddcf('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5234a8,_0x4e6145,_0x30a820){var _0x2387b0=_0x34419e[_0xddcf('0xb')];var _0x2f1a28=_0x5234a8[_0xddcf('0xc')]({'plain':!![]});if(_0x2f1a28[_0xddcf('0xd')][_0xddcf('0xe')]()==='in'||_0x2f1a28[_0xddcf('0xd')]['toLowerCase']()===_0xddcf('0xf')&&!_0x2f1a28[_0xddcf('0x10')]&&!_[_0xddcf('0x11')](_0x2f1a28['UserId'])){_0x2387b0[_0xddcf('0x12')]['findOne']({'where':{'id':_0x2f1a28['FaxInteractionId']}})[_0xddcf('0x13')](function(_0x126079){if(_0x126079){_0x126079[_0xddcf('0x14')]({'lastMsgAt':_0x2f1a28[_0xddcf('0x15')],'lastMsgDirection':_0x2f1a28[_0xddcf('0xd')]['toLowerCase']()});}})[_0xddcf('0x16')](function(_0x1d661c){console[_0xddcf('0x17')](_0x1d661c);});}_0x30a820();}},'charset':_0xddcf('0x18'),'collate':_0xddcf('0x19')});}; \ No newline at end of file +var _0x982b=['fax_messages','fti_fax_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','isNil','UserId','FaxInteraction','FaxInteractionId','update','createdAt','catch','error','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','FaxMessage'];(function(_0x38828e,_0x421c1c){var _0x175d58=function(_0x278e85){while(--_0x278e85){_0x38828e['push'](_0x38828e['shift']());}};_0x175d58(++_0x421c1c);}(_0x982b,0x1e5));var _0xb982=function(_0x353b4a,_0x4efd0a){_0x353b4a=_0x353b4a-0x0;var _0xd97525=_0x982b[_0x353b4a];return _0xd97525;};'use strict';var _=require(_0xb982('0x0'));var util=require('util');var logger=require(_0xb982('0x1'))(_0xb982('0x2'));var moment=require(_0xb982('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb982('0x4'));var rimraf=require(_0xb982('0x5'));var config=require(_0xb982('0x6'));var attributes=require('./faxMessage.attributes');module[_0xb982('0x7')]=function(_0x2267b9,_0x2c2b9){return _0x2267b9['define'](_0xb982('0x8'),attributes,{'tableName':_0xb982('0x9'),'paranoid':![],'indexes':[{'name':_0xb982('0xa'),'fields':[_0xb982('0xb')],'type':_0xb982('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x23d288,_0xbf12e1,_0x18a014){var _0x12a8e2=_0x2267b9[_0xb982('0xd')];var _0x3e500b=_0x23d288[_0xb982('0xe')]({'plain':!![]});if(_0x3e500b['direction'][_0xb982('0xf')]()==='in'||_0x3e500b[_0xb982('0x10')][_0xb982('0xf')]()===_0xb982('0x11')&&!_0x3e500b['secret']&&!_[_0xb982('0x12')](_0x3e500b[_0xb982('0x13')])){_0x12a8e2[_0xb982('0x14')]['findOne']({'where':{'id':_0x3e500b[_0xb982('0x15')]}})['then'](function(_0x3c0f89){if(_0x3c0f89){_0x3c0f89[_0xb982('0x16')]({'lastMsgAt':_0x3e500b[_0xb982('0x17')],'lastMsgDirection':_0x3e500b[_0xb982('0x10')][_0xb982('0xf')]()});}})[_0xb982('0x18')](function(_0x555c01){console[_0xb982('0x19')](_0x555c01);});}_0x18a014();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 38e9361..16c5cc5 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 _0x4b93=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateFaxMessage','FaxMessage','create','body','options','catch','UpdateFaxMessage','update','attributes','limit','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x351f31,_0x16b676){var _0x4f5776=function(_0xc30d2f){while(--_0xc30d2f){_0x351f31['push'](_0x351f31['shift']());}};_0x4f5776(++_0x16b676);}(_0x4b93,0x192));var _0x34b9=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x4b93[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x34b9('0x0'));var util=require('util');var moment=require(_0x34b9('0x1'));var BPromise=require(_0x34b9('0x2'));var rs=require(_0x34b9('0x3'));var fs=require('fs');var Redis=require(_0x34b9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34b9('0x5'));var logger=require(_0x34b9('0x6'))(_0x34b9('0x7'));var config=require(_0x34b9('0x8'));var jayson=require(_0x34b9('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x34b9('0xa')]=_['defaults'](config[_0x34b9('0xa')],{'host':_0x34b9('0xb'),'port':0x18eb});var socket=require(_0x34b9('0xc'))(new Redis(config[_0x34b9('0xa')]));require(_0x34b9('0xd'))[_0x34b9('0xe')](socket);function respondWithRpcPromise(_0x4e190d,_0x34bde5,_0x4f2b44){return new BPromise(function(_0x15e719,_0x2501f2){return client[_0x34b9('0xf')](_0x4e190d,_0x4f2b44)[_0x34b9('0x10')](function(_0x40fa0e){logger[_0x34b9('0x11')](_0x34b9('0x12'),_0x34bde5,_0x34b9('0x13'));logger[_0x34b9('0x14')](_0x34b9('0x15'),_0x34bde5,_0x34b9('0x13'),JSON[_0x34b9('0x16')](_0x40fa0e));if(_0x40fa0e['error']){if(_0x40fa0e[_0x34b9('0x17')][_0x34b9('0x18')]===0x1f4){logger[_0x34b9('0x17')](_0x34b9('0x12'),_0x34bde5,_0x40fa0e[_0x34b9('0x17')]['message']);return _0x2501f2(_0x40fa0e[_0x34b9('0x17')][_0x34b9('0x19')]);}logger['error'](_0x34b9('0x12'),_0x34bde5,_0x40fa0e[_0x34b9('0x17')][_0x34b9('0x19')]);return _0x15e719(_0x40fa0e['error'][_0x34b9('0x19')]);}else{logger[_0x34b9('0x11')](_0x34b9('0x12'),_0x34bde5,_0x34b9('0x13'));_0x15e719(_0x40fa0e[_0x34b9('0x1a')][_0x34b9('0x19')]);}})['catch'](function(_0x20125e){logger[_0x34b9('0x17')](_0x34b9('0x12'),_0x34bde5,_0x20125e);_0x2501f2(_0x20125e);});});}exports[_0x34b9('0x1b')]=function(_0x3a45d7){var _0x225d79=this;return new Promise(function(_0x263fe2,_0x4c8576){return db[_0x34b9('0x1c')][_0x34b9('0x1d')](_0x3a45d7[_0x34b9('0x1e')],{'raw':_0x3a45d7[_0x34b9('0x1f')]?_0x3a45d7[_0x34b9('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x484445){logger[_0x34b9('0x11')](_0x34b9('0x1b'),_0x3a45d7);logger[_0x34b9('0x14')](_0x34b9('0x1b'),_0x3a45d7,JSON[_0x34b9('0x16')](_0x484445));_0x263fe2(_0x484445);})[_0x34b9('0x20')](function(_0x505584){logger[_0x34b9('0x17')]('CreateFaxMessage',_0x505584[_0x34b9('0x19')],_0x3a45d7);_0x4c8576(_0x225d79[_0x34b9('0x17')](0x1f4,_0x505584[_0x34b9('0x19')]));});});};exports[_0x34b9('0x21')]=function(_0x322d5b){var _0x428fea=this;return new Promise(function(_0x19a044,_0x45296f){return db[_0x34b9('0x1c')][_0x34b9('0x22')](_0x322d5b[_0x34b9('0x1e')],{'raw':_0x322d5b['options']?_0x322d5b[_0x34b9('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x322d5b['options']?_0x322d5b['options']['where']||null:null,'attributes':_0x322d5b[_0x34b9('0x1f')]?_0x322d5b[_0x34b9('0x1f')][_0x34b9('0x23')]||null:null,'limit':_0x322d5b[_0x34b9('0x1f')]?_0x322d5b[_0x34b9('0x1f')][_0x34b9('0x24')]||null:null})[_0x34b9('0x10')](function(_0x3ed0e2){logger[_0x34b9('0x11')](_0x34b9('0x21'),_0x322d5b);logger[_0x34b9('0x14')]('UpdateFaxMessage',_0x322d5b,JSON[_0x34b9('0x16')](_0x3ed0e2));_0x19a044(_0x3ed0e2);})[_0x34b9('0x20')](function(_0x44f617){logger[_0x34b9('0x17')](_0x34b9('0x21'),_0x44f617['message'],_0x322d5b);_0x45296f(_0x428fea[_0x34b9('0x17')](0x1f4,_0x44f617[_0x34b9('0x19')]));});});}; \ No newline at end of file +var _0xe3d3=['UpdateFaxMessage','update','body','where','attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./faxMessage.socket','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','info','catch','CreateFaxMessage','FaxMessage','create','options','raw'];(function(_0x118038,_0x408d60){var _0x32f8b2=function(_0xbbe5b8){while(--_0xbbe5b8){_0x118038['push'](_0x118038['shift']());}};_0x32f8b2(++_0x408d60);}(_0xe3d3,0x118));var _0x3e3d=function(_0x1a5e8b,_0xf396bd){_0x1a5e8b=_0x1a5e8b-0x0;var _0x15a1ae=_0xe3d3[_0x1a5e8b];return _0x15a1ae;};'use strict';var _=require(_0x3e3d('0x0'));var util=require(_0x3e3d('0x1'));var moment=require(_0x3e3d('0x2'));var BPromise=require(_0x3e3d('0x3'));var rs=require(_0x3e3d('0x4'));var fs=require('fs');var Redis=require(_0x3e3d('0x5'));var db=require(_0x3e3d('0x6'))['db'];var utils=require(_0x3e3d('0x7'));var logger=require(_0x3e3d('0x8'))(_0x3e3d('0x9'));var config=require(_0x3e3d('0xa'));var jayson=require(_0x3e3d('0xb'));var client=jayson[_0x3e3d('0xc')]['http']({'port':0x232a});config['redis']=_[_0x3e3d('0xd')](config[_0x3e3d('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x3e3d('0xf'))(new Redis(config[_0x3e3d('0xe')]));require(_0x3e3d('0x10'))['register'](socket);function respondWithRpcPromise(_0x164be7,_0x31dc01,_0x48770b){return new BPromise(function(_0x30a34c,_0x45d0bd){return client[_0x3e3d('0x11')](_0x164be7,_0x48770b)[_0x3e3d('0x12')](function(_0x1dd18b){logger['info'](_0x3e3d('0x13'),_0x31dc01,_0x3e3d('0x14'));logger[_0x3e3d('0x15')](_0x3e3d('0x16'),_0x31dc01,_0x3e3d('0x14'),JSON['stringify'](_0x1dd18b));if(_0x1dd18b[_0x3e3d('0x17')]){if(_0x1dd18b[_0x3e3d('0x17')]['code']===0x1f4){logger['error'](_0x3e3d('0x13'),_0x31dc01,_0x1dd18b['error']['message']);return _0x45d0bd(_0x1dd18b['error'][_0x3e3d('0x18')]);}logger['error'](_0x3e3d('0x13'),_0x31dc01,_0x1dd18b[_0x3e3d('0x17')][_0x3e3d('0x18')]);return _0x30a34c(_0x1dd18b['error'][_0x3e3d('0x18')]);}else{logger[_0x3e3d('0x19')]('FaxMessage,\x20%s,\x20%s',_0x31dc01,'request\x20sent');_0x30a34c(_0x1dd18b['result'][_0x3e3d('0x18')]);}})[_0x3e3d('0x1a')](function(_0x1da716){logger['error'](_0x3e3d('0x13'),_0x31dc01,_0x1da716);_0x45d0bd(_0x1da716);});});}exports[_0x3e3d('0x1b')]=function(_0x14caff){var _0x517130=this;return new Promise(function(_0x235a74,_0x2b2e17){return db[_0x3e3d('0x1c')][_0x3e3d('0x1d')](_0x14caff['body'],{'raw':_0x14caff['options']?_0x14caff[_0x3e3d('0x1e')][_0x3e3d('0x1f')]===undefined?!![]:![]:!![]})[_0x3e3d('0x12')](function(_0x2e2b34){logger['info'](_0x3e3d('0x1b'),_0x14caff);logger[_0x3e3d('0x15')](_0x3e3d('0x1b'),_0x14caff,JSON['stringify'](_0x2e2b34));_0x235a74(_0x2e2b34);})[_0x3e3d('0x1a')](function(_0x26f584){logger['error'](_0x3e3d('0x1b'),_0x26f584[_0x3e3d('0x18')],_0x14caff);_0x2b2e17(_0x517130[_0x3e3d('0x17')](0x1f4,_0x26f584['message']));});});};exports[_0x3e3d('0x20')]=function(_0xe95100){var _0x880a74=this;return new Promise(function(_0x580102,_0x540fae){return db[_0x3e3d('0x1c')][_0x3e3d('0x21')](_0xe95100[_0x3e3d('0x22')],{'raw':_0xe95100[_0x3e3d('0x1e')]?_0xe95100[_0x3e3d('0x1e')][_0x3e3d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe95100[_0x3e3d('0x1e')]?_0xe95100[_0x3e3d('0x1e')][_0x3e3d('0x23')]||null:null,'attributes':_0xe95100[_0x3e3d('0x1e')]?_0xe95100[_0x3e3d('0x1e')][_0x3e3d('0x24')]||null:null,'limit':_0xe95100[_0x3e3d('0x1e')]?_0xe95100[_0x3e3d('0x1e')][_0x3e3d('0x25')]||null:null})[_0x3e3d('0x12')](function(_0xcf899e){logger[_0x3e3d('0x19')](_0x3e3d('0x20'),_0xe95100);logger['debug']('UpdateFaxMessage',_0xe95100,JSON[_0x3e3d('0x26')](_0xcf899e));_0x580102(_0xcf899e);})[_0x3e3d('0x1a')](function(_0x1a0c51){logger[_0x3e3d('0x17')](_0x3e3d('0x20'),_0x1a0c51[_0x3e3d('0x18')],_0xe95100);_0x540fae(_0x880a74[_0x3e3d('0x17')](0x1f4,_0x1a0c51[_0x3e3d('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index d3feb4f..a3244f4 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 _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x4cee4b,_0x1dfff3){var _0x4d891d=function(_0x3722ba){while(--_0x3722ba){_0x4cee4b['push'](_0x4cee4b['shift']());}};_0x4d891d(++_0x1dfff3);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file +var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x5d61b4,_0x4f7b91){var _0x183fc5=function(_0x5ecf92){while(--_0x5ecf92){_0x5d61b4['push'](_0x5d61b4['shift']());}};_0x183fc5(++_0x4f7b91);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 7eb706f..ecfd7ca 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 _0xb6da=['/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','download','faxmessage:create','create','put','update'];(function(_0x557364,_0x1d1d24){var _0x5acf3d=function(_0x203e86){while(--_0x203e86){_0x557364['push'](_0x557364['shift']());}};_0x5acf3d(++_0x1d1d24);}(_0xb6da,0x8e));var _0xab6d=function(_0x1df000,_0x432396){_0x1df000=_0x1df000-0x0;var _0x4d9485=_0xb6da[_0x1df000];return _0x4d9485;};'use strict';var multer=require(_0xab6d('0x0'));var util=require('util');var path=require(_0xab6d('0x1'));var timeout=require(_0xab6d('0x2'));var express=require(_0xab6d('0x3'));var router=express[_0xab6d('0x4')]();var auth=require(_0xab6d('0x5'));var interaction=require(_0xab6d('0x6'));var config=require(_0xab6d('0x7'));var controller=require('./faxMessage.controller');router['get']('/',auth[_0xab6d('0x8')](),controller[_0xab6d('0x9')]);router[_0xab6d('0xa')](_0xab6d('0xb'),auth[_0xab6d('0x8')](),controller[_0xab6d('0xc')]);router['get'](_0xab6d('0xd'),auth['isAuthenticated'](),controller[_0xab6d('0xe')]);router['get']('/:id/download',auth[_0xab6d('0x8')](),controller[_0xab6d('0xf')]);router['post']('/',auth[_0xab6d('0x8')](),interaction['tracked']('fax',_0xab6d('0x10')),controller[_0xab6d('0x11')]);router[_0xab6d('0x12')](_0xab6d('0xd'),auth[_0xab6d('0x8')](),controller[_0xab6d('0x13')]);router[_0xab6d('0x12')](_0xab6d('0x14'),auth['isAuthenticated'](),controller[_0xab6d('0x15')]);router[_0xab6d('0x12')](_0xab6d('0x16'),auth[_0xab6d('0x8')](),controller[_0xab6d('0x17')]);router[_0xab6d('0x18')]('/:id',auth[_0xab6d('0x8')](),controller[_0xab6d('0x19')]);module[_0xab6d('0x1a')]=router; \ No newline at end of file +var _0x8616=['index','/describe','describe','/:id','show','get','post','tracked','fax','faxmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','./faxMessage.controller','isAuthenticated'];(function(_0x1e9726,_0x11088f){var _0x2322eb=function(_0x2a202d){while(--_0x2a202d){_0x1e9726['push'](_0x1e9726['shift']());}};_0x2322eb(++_0x11088f);}(_0x8616,0xc1));var _0x6861=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0x8616[_0x37a7c6];return _0x539905;};'use strict';var multer=require('multer');var util=require(_0x6861('0x0'));var path=require(_0x6861('0x1'));var timeout=require(_0x6861('0x2'));var express=require('express');var router=express[_0x6861('0x3')]();var auth=require(_0x6861('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6861('0x5'));router['get']('/',auth[_0x6861('0x6')](),controller[_0x6861('0x7')]);router['get'](_0x6861('0x8'),auth['isAuthenticated'](),controller[_0x6861('0x9')]);router['get'](_0x6861('0xa'),auth['isAuthenticated'](),controller[_0x6861('0xb')]);router[_0x6861('0xc')]('/:id/download',auth[_0x6861('0x6')](),controller['download']);router[_0x6861('0xd')]('/',auth['isAuthenticated'](),interaction[_0x6861('0xe')](_0x6861('0xf'),_0x6861('0x10')),controller['create']);router[_0x6861('0x11')](_0x6861('0xa'),auth[_0x6861('0x6')](),controller[_0x6861('0x12')]);router[_0x6861('0x11')](_0x6861('0x13'),auth[_0x6861('0x6')](),controller[_0x6861('0x14')]);router[_0x6861('0x11')](_0x6861('0x15'),auth[_0x6861('0x6')](),controller[_0x6861('0x16')]);router[_0x6861('0x17')](_0x6861('0xa'),auth[_0x6861('0x6')](),controller[_0x6861('0x18')]);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 9eb12f3..e85ce45 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 _0xfc87=['STRING','name','INTEGER','ENUM','beepall','roundrobin','sequelize','exports'];(function(_0xf858e,_0x51b0f1){var _0x5344d8=function(_0x5219d6){while(--_0x5219d6){_0xf858e['push'](_0xf858e['shift']());}};_0x5344d8(++_0x51b0f1);}(_0xfc87,0x1ce));var _0x7fc8=function(_0x5b4dca,_0x40dc56){_0x5b4dca=_0x5b4dca-0x0;var _0x5b38bf=_0xfc87[_0x5b4dca];return _0x5b38bf;};'use strict';var Sequelize=require(_0x7fc8('0x0'));module[_0x7fc8('0x1')]={'name':{'type':Sequelize[_0x7fc8('0x2')],'unique':_0x7fc8('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7fc8('0x2')]},'timeout':{'type':Sequelize[_0x7fc8('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7fc8('0x5')]('rrmemory',_0x7fc8('0x6'),_0x7fc8('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x7fc8('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4b96=['roundrobin','sequelize','exports','STRING','INTEGER','rrmemory','beepall'];(function(_0x243e47,_0x5d2311){var _0xf46891=function(_0x27d667){while(--_0x27d667){_0x243e47['push'](_0x243e47['shift']());}};_0xf46891(++_0x5d2311);}(_0x4b96,0x12e));var _0x64b9=function(_0x36e074,_0x4a5be0){_0x36e074=_0x36e074-0x0;var _0x5ed3cc=_0x4b96[_0x36e074];return _0x5ed3cc;};'use strict';var Sequelize=require(_0x64b9('0x0'));module[_0x64b9('0x1')]={'name':{'type':Sequelize[_0x64b9('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x64b9('0x2')]},'timeout':{'type':Sequelize[_0x64b9('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x64b9('0x4'),_0x64b9('0x5'),_0x64b9('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'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 f11d76c..1f0fae9 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 _0x65f4=['removeAgents','getAgents','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./faxQueue.socket','register','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','end','error','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','count','includeAll','include','FaxQueue','findAll','rows','catch','show','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','userProfileId','UserProfileResource','describe','findOne','UserFaxQueue','FaxQueueId','User','findAndCountAll','faxPause','updatedAt','createdAt','format','%s/%s','SIP','addTeams','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','userFaxQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','isEmpty','userFaxQueue:remove','addAgents','omit','spread','emit'];(function(_0xe390f5,_0x4f0c7e){var _0x4f5244=function(_0x2456ed){while(--_0x2456ed){_0xe390f5['push'](_0xe390f5['shift']());}};_0x4f5244(++_0x4f0c7e);}(_0x65f4,0x19a));var _0x465f=function(_0x30e045,_0x47c751){_0x30e045=_0x30e045-0x0;var _0x284ac2=_0x65f4[_0x30e045];return _0x284ac2;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x465f('0x0'));var zipdir=require(_0x465f('0x1'));var jsonpatch=require(_0x465f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x465f('0x3'));var Mustache=require(_0x465f('0x4'));var util=require(_0x465f('0x5'));var path=require('path');var sox=require(_0x465f('0x6'));var csv=require(_0x465f('0x7'));var ejs=require(_0x465f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x465f('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x465f('0xa'));var toCsv=require(_0x465f('0x7'));var querystring=require(_0x465f('0xb'));var Papa=require(_0x465f('0xc'));var Redis=require(_0x465f('0xd'));var authService=require(_0x465f('0xe'));var qs=require(_0x465f('0xf'));var as=require(_0x465f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x465f('0x11'))(_0x465f('0x12'));var utils=require(_0x465f('0x13'));var config=require(_0x465f('0x14'));var licenseUtil=require(_0x465f('0x15'));var db=require(_0x465f('0x16'))['db'];config[_0x465f('0x17')]=_[_0x465f('0x18')](config[_0x465f('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x465f('0x17')]));require(_0x465f('0x19'))[_0x465f('0x1a')](socket);function respondWithStatusCode(_0x3a6c49,_0x532e49){_0x532e49=_0x532e49||0xcc;return function(_0x265569){if(_0x265569){return _0x3a6c49[_0x465f('0x1b')](_0x532e49);}return _0x3a6c49['status'](_0x532e49)['end']();};}function respondWithResult(_0x20beae,_0x211ee2){_0x211ee2=_0x211ee2||0xc8;return function(_0x3c5ad9){if(_0x3c5ad9){return _0x20beae[_0x465f('0x1c')](_0x211ee2)[_0x465f('0x1d')](_0x3c5ad9);}};}function respondWithFilteredResult(_0x5e9726,_0x2daf5b){return function(_0x99845e){if(_0x99845e){var _0x331e45=_0x99845e['count'],_0x5d469c=_0x2daf5b[_0x465f('0x1e')],_0x119227=_0x2daf5b['offset']+_0x2daf5b[_0x465f('0x1f')],_0x1b6530;if(_0x119227>=_0x331e45){_0x119227=_0x331e45;_0x1b6530=0xc8;}else{_0x1b6530=0xce;}_0x5e9726[_0x465f('0x1c')](_0x1b6530);return _0x5e9726[_0x465f('0x20')](_0x465f('0x21'),_0x5d469c+'-'+_0x119227+'/'+_0x331e45)[_0x465f('0x1d')](_0x99845e);}return null;};}function patchUpdates(_0x15d843){return function(_0x2cd76d){try{jsonpatch[_0x465f('0x22')](_0x2cd76d,_0x15d843,!![]);}catch(_0x13650f){return BPromise[_0x465f('0x23')](_0x13650f);}return _0x2cd76d[_0x465f('0x24')]();};}function saveUpdates(_0x4aa4a8,_0x41e279){return function(_0x1d4575){if(_0x1d4575){return _0x1d4575[_0x465f('0x25')](_0x4aa4a8)[_0x465f('0x26')](function(_0x1d6677){return _0x1d6677;});}return null;};}function removeEntity(_0x2566e3,_0x944e42){return function(_0xc0a7f6){if(_0xc0a7f6){return _0xc0a7f6[_0x465f('0x27')]()[_0x465f('0x26')](function(){var _0x59ace5=_0xc0a7f6[_0x465f('0x28')]({'plain':!![]});var _0x329007='FaxQueues';return db['UserProfileResource'][_0x465f('0x27')]({'where':{'type':_0x329007,'resourceId':_0x59ace5['id']}})[_0x465f('0x26')](function(){return _0xc0a7f6;});})[_0x465f('0x26')](function(){_0x2566e3[_0x465f('0x1c')](0xcc)[_0x465f('0x29')]();});}};}function handleEntityNotFound(_0x191ada,_0x1e1ad6){return function(_0x9d9ca9){if(!_0x9d9ca9){_0x191ada[_0x465f('0x1b')](0x194);}return _0x9d9ca9;};}function handleError(_0x190506,_0x5299c4){_0x5299c4=_0x5299c4||0x1f4;return function(_0x222240){logger[_0x465f('0x2a')](_0x222240['stack']);if(_0x222240[_0x465f('0x2b')]){delete _0x222240['name'];}_0x190506[_0x465f('0x1c')](_0x5299c4)['send'](_0x222240);};}exports[_0x465f('0x2c')]=function(_0x205327,_0x1817d0){var _0x25d2d7={},_0x4c63db={},_0x462462={'count':0x0,'rows':[]};var _0x43afe0=_[_0x465f('0x2d')](db['FaxQueue'][_0x465f('0x2e')],function(_0x44884b){return{'name':_0x44884b[_0x465f('0x2f')],'type':_0x44884b['type'][_0x465f('0x30')]};});_0x4c63db[_0x465f('0x31')]=_[_0x465f('0x2d')](_0x43afe0,_0x465f('0x2b'));_0x4c63db[_0x465f('0x32')]=_['keys'](_0x205327['query']);_0x4c63db[_0x465f('0x33')]=_[_0x465f('0x34')](_0x4c63db[_0x465f('0x31')],_0x4c63db['query']);_0x25d2d7[_0x465f('0x35')]=_['intersection'](_0x4c63db[_0x465f('0x31')],qs[_0x465f('0x36')](_0x205327[_0x465f('0x32')][_0x465f('0x36')]));_0x25d2d7[_0x465f('0x35')]=_0x25d2d7[_0x465f('0x35')]['length']?_0x25d2d7['attributes']:_0x4c63db[_0x465f('0x31')];if(!_0x205327[_0x465f('0x32')][_0x465f('0x37')](_0x465f('0x38'))){_0x25d2d7[_0x465f('0x1f')]=qs['limit'](_0x205327[_0x465f('0x32')][_0x465f('0x1f')]);_0x25d2d7[_0x465f('0x1e')]=qs[_0x465f('0x1e')](_0x205327['query']['offset']);}_0x25d2d7[_0x465f('0x39')]=qs['sort'](_0x205327[_0x465f('0x32')][_0x465f('0x3a')]);_0x25d2d7[_0x465f('0x3b')]=qs[_0x465f('0x33')](_[_0x465f('0x3c')](_0x205327['query'],_0x4c63db[_0x465f('0x33')]),_0x43afe0);if(_0x205327[_0x465f('0x32')][_0x465f('0x3d')]){_0x25d2d7[_0x465f('0x3b')]=_['merge'](_0x25d2d7[_0x465f('0x3b')],{'$or':_[_0x465f('0x2d')](_0x43afe0,function(_0x4b7289){if(_0x4b7289[_0x465f('0x3e')]!=='VIRTUAL'){var _0xc0f949={};_0xc0f949[_0x4b7289['name']]={'$like':'%'+_0x205327['query'][_0x465f('0x3d')]+'%'};return _0xc0f949;}})});}_0x25d2d7=_[_0x465f('0x3f')]({},_0x25d2d7,_0x205327[_0x465f('0x40')]);var _0x134408={'where':_0x25d2d7[_0x465f('0x3b')]};return db['FaxQueue'][_0x465f('0x41')](_0x134408)[_0x465f('0x26')](function(_0x362f6e){_0x462462[_0x465f('0x41')]=_0x362f6e;if(_0x205327[_0x465f('0x32')][_0x465f('0x42')]){_0x25d2d7[_0x465f('0x43')]=[{'all':!![]}];}return db[_0x465f('0x44')][_0x465f('0x45')](_0x25d2d7);})['then'](function(_0x278d16){_0x462462[_0x465f('0x46')]=_0x278d16;return _0x462462;})[_0x465f('0x26')](respondWithFilteredResult(_0x1817d0,_0x25d2d7))[_0x465f('0x47')](handleError(_0x1817d0,null));};exports[_0x465f('0x48')]=function(_0x3541c8,_0x3cde3b){var _0x11d46c={'raw':!![],'where':{'id':_0x3541c8[_0x465f('0x49')]['id']}},_0x18cb1a={};_0x18cb1a[_0x465f('0x31')]=_[_0x465f('0x4a')](db[_0x465f('0x44')][_0x465f('0x2e')]);_0x18cb1a[_0x465f('0x32')]=_[_0x465f('0x4a')](_0x3541c8[_0x465f('0x32')]);_0x18cb1a[_0x465f('0x33')]=_[_0x465f('0x34')](_0x18cb1a[_0x465f('0x31')],_0x18cb1a[_0x465f('0x32')]);_0x11d46c[_0x465f('0x35')]=_[_0x465f('0x34')](_0x18cb1a[_0x465f('0x31')],qs[_0x465f('0x36')](_0x3541c8[_0x465f('0x32')]['fields']));_0x11d46c[_0x465f('0x35')]=_0x11d46c[_0x465f('0x35')][_0x465f('0x4b')]?_0x11d46c[_0x465f('0x35')]:_0x18cb1a[_0x465f('0x31')];if(_0x3541c8[_0x465f('0x32')][_0x465f('0x42')]){_0x11d46c[_0x465f('0x43')]=[{'all':!![]}];}_0x11d46c=_[_0x465f('0x3f')]({},_0x11d46c,_0x3541c8[_0x465f('0x40')]);return db[_0x465f('0x44')][_0x465f('0x4c')](_0x11d46c)['then'](handleEntityNotFound(_0x3cde3b,null))[_0x465f('0x26')](respondWithResult(_0x3cde3b,null))[_0x465f('0x47')](handleError(_0x3cde3b,null));};exports[_0x465f('0x4d')]=function(_0x3d7c25,_0x42d3aa){return db[_0x465f('0x44')][_0x465f('0x4d')](_0x3d7c25[_0x465f('0x4e')],{})[_0x465f('0x26')](function(_0x1fb8c8){var _0xe4a23=_0x3d7c25[_0x465f('0x4f')][_0x465f('0x28')]({'plain':!![]});if(!_0xe4a23)throw new Error(_0x465f('0x50'));if(_0xe4a23[_0x465f('0x51')]===_0x465f('0x4f')){var _0x594d11=_0x1fb8c8['get']({'plain':!![]});var _0x381272=_0x465f('0x52');return db['UserProfileSection']['find']({'where':{'name':_0x381272,'userProfileId':_0xe4a23[_0x465f('0x53')]},'raw':!![]})[_0x465f('0x26')](function(_0x3c06ac){if(_0x3c06ac&&_0x3c06ac['autoAssociation']===0x0){return db[_0x465f('0x54')][_0x465f('0x4d')]({'name':_0x594d11[_0x465f('0x2b')],'resourceId':_0x594d11['id'],'type':_0x3c06ac[_0x465f('0x2b')],'sectionId':_0x3c06ac['id']},{})[_0x465f('0x26')](function(){return _0x1fb8c8;});}else{return _0x1fb8c8;}})[_0x465f('0x47')](function(_0x2c6a90){logger[_0x465f('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c6a90);throw _0x2c6a90;});}return _0x1fb8c8;})[_0x465f('0x26')](respondWithResult(_0x42d3aa,0xc9))[_0x465f('0x47')](handleError(_0x42d3aa,null));};exports[_0x465f('0x25')]=function(_0x425894,_0x551adf){if(_0x425894['body']['id']){delete _0x425894['body']['id'];}return db[_0x465f('0x44')][_0x465f('0x4c')]({'where':{'id':_0x425894[_0x465f('0x49')]['id']}})[_0x465f('0x26')](handleEntityNotFound(_0x551adf,null))['then'](saveUpdates(_0x425894[_0x465f('0x4e')],null))[_0x465f('0x26')](respondWithResult(_0x551adf,null))['catch'](handleError(_0x551adf,null));};exports[_0x465f('0x27')]=function(_0x15e947,_0x3f8400){return db['FaxQueue'][_0x465f('0x4c')]({'where':{'id':_0x15e947[_0x465f('0x49')]['id']}})[_0x465f('0x26')](handleEntityNotFound(_0x3f8400,null))[_0x465f('0x26')](removeEntity(_0x3f8400,null))[_0x465f('0x47')](handleError(_0x3f8400,null));};exports['describe']=function(_0x388eba,_0x51cfb5){return db[_0x465f('0x44')][_0x465f('0x55')]()[_0x465f('0x26')](respondWithResult(_0x51cfb5,null))[_0x465f('0x47')](handleError(_0x51cfb5,null));};exports['getMembers']=function(_0x3c21c7,_0x3f5e1e,_0x57b211){var _0x199cbd={'raw':!![],'where':{}},_0xa314ef={},_0x263a9e;return db[_0x465f('0x44')][_0x465f('0x56')]({'where':{'id':_0x3c21c7[_0x465f('0x49')]['id']}})[_0x465f('0x26')](handleEntityNotFound(_0x3f5e1e,null))[_0x465f('0x26')](function(_0x56c83e){if(_0x56c83e){_0x263a9e=_0x56c83e['get']({'plain':!![]});_0xa314ef[_0x465f('0x31')]=_[_0x465f('0x4a')](db[_0x465f('0x57')][_0x465f('0x2e')]);_0xa314ef[_0x465f('0x32')]=_[_0x465f('0x4a')](_0x3c21c7[_0x465f('0x32')]);_0xa314ef[_0x465f('0x33')]=_[_0x465f('0x34')](_0xa314ef[_0x465f('0x31')],_0xa314ef[_0x465f('0x32')]);_0x199cbd[_0x465f('0x35')]=_[_0x465f('0x34')](_0xa314ef[_0x465f('0x31')],qs[_0x465f('0x36')](_0x3c21c7[_0x465f('0x32')][_0x465f('0x36')]));_0x199cbd[_0x465f('0x35')]=_0x199cbd[_0x465f('0x35')][_0x465f('0x4b')]?_0x199cbd[_0x465f('0x35')]:_0xa314ef['model'];if(!_0x3c21c7['query'][_0x465f('0x37')](_0x465f('0x38'))){_0x199cbd[_0x465f('0x1f')]=qs[_0x465f('0x1f')](_0x3c21c7['query'][_0x465f('0x1f')]);_0x199cbd['offset']=qs['offset'](_0x3c21c7[_0x465f('0x32')][_0x465f('0x1e')]);}_0x199cbd[_0x465f('0x39')]=qs[_0x465f('0x3a')](_0x3c21c7[_0x465f('0x32')][_0x465f('0x3a')]);_0x199cbd[_0x465f('0x3b')]=qs[_0x465f('0x33')](_[_0x465f('0x3c')](_0x3c21c7['query'],_0xa314ef['filters']));_0x199cbd[_0x465f('0x3b')][_0x465f('0x58')]=_0x56c83e['id'];if(_0x3c21c7[_0x465f('0x32')][_0x465f('0x3d')]){_0x199cbd[_0x465f('0x3b')]=_[_0x465f('0x3f')](_0x199cbd[_0x465f('0x3b')],{'$or':_[_0x465f('0x2d')](_0x199cbd[_0x465f('0x35')],function(_0x1f8568){var _0x45e761={};_0x45e761[_0x1f8568]={'$like':'%'+_0x3c21c7[_0x465f('0x32')][_0x465f('0x3d')]+'%'};return _0x45e761;})});}_0x199cbd=_['merge']({},_0x199cbd,_0x3c21c7[_0x465f('0x40')]);return db[_0x465f('0x57')][_0x465f('0x45')](_0x199cbd);}})[_0x465f('0x26')](function(_0x12de31){if(_0x12de31){return db[_0x465f('0x59')][_0x465f('0x5a')]({'where':{'id':_['map'](_0x12de31,'UserId'),'role':'agent'},'attributes':['id',_0x465f('0x2b'),_0x465f('0x5b'),_0x465f('0x5c'),_0x465f('0x5d')]});}})[_0x465f('0x26')](function(_0x5d51c2){if(_0x5d51c2){return{'count':_0x5d51c2[_0x465f('0x41')],'rows':_['map'](_0x5d51c2[_0x465f('0x46')],function(_0x5be8f4){return{'membername':_0x5be8f4[_0x465f('0x2b')],'UserId':_0x5be8f4['id'],'queue_name':_0x263a9e[_0x465f('0x2b')],'FaxQueueId':_0x263a9e['id'],'interface':util[_0x465f('0x5e')](_0x465f('0x5f'),_0x465f('0x60'),_0x5be8f4[_0x465f('0x2b')]),'penalty':0x0,'paused':_0x5be8f4[_0x465f('0x5b')],'createdAt':_0x5be8f4[_0x465f('0x5d')],'updatedAt':_0x5be8f4[_0x465f('0x5c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3f5e1e,_0x199cbd))[_0x465f('0x47')](handleError(_0x3f5e1e,null));};exports['getTeams']=function(_0x24f6a9,_0x12ebbf,_0x378c41){var _0x114e94={};var _0x585d01={};var _0x1fa4d3;var _0x8e992a;return db['FaxQueue'][_0x465f('0x56')]({'where':{'id':_0x24f6a9[_0x465f('0x49')]['id']}})['then'](handleEntityNotFound(_0x12ebbf,null))[_0x465f('0x26')](function(_0x1e7714){if(_0x1e7714){_0x1fa4d3=_0x1e7714;_0x585d01[_0x465f('0x31')]=_[_0x465f('0x4a')](db['Team'][_0x465f('0x2e')]);_0x585d01[_0x465f('0x32')]=_[_0x465f('0x4a')](_0x24f6a9[_0x465f('0x32')]);_0x585d01['filters']=_[_0x465f('0x34')](_0x585d01[_0x465f('0x31')],_0x585d01[_0x465f('0x32')]);_0x114e94[_0x465f('0x35')]=_[_0x465f('0x34')](_0x585d01[_0x465f('0x31')],qs[_0x465f('0x36')](_0x24f6a9[_0x465f('0x32')][_0x465f('0x36')]));_0x114e94['attributes']=_0x114e94[_0x465f('0x35')][_0x465f('0x4b')]?_0x114e94['attributes']:_0x585d01[_0x465f('0x31')];_0x114e94[_0x465f('0x39')]=qs[_0x465f('0x3a')](_0x24f6a9[_0x465f('0x32')][_0x465f('0x3a')]);_0x114e94[_0x465f('0x3b')]=qs[_0x465f('0x33')](_[_0x465f('0x3c')](_0x24f6a9[_0x465f('0x32')],_0x585d01[_0x465f('0x33')]));if(_0x24f6a9[_0x465f('0x32')][_0x465f('0x3d')]){_0x114e94['where']=_[_0x465f('0x3f')](_0x114e94[_0x465f('0x3b')],{'$or':_[_0x465f('0x2d')](_0x114e94[_0x465f('0x35')],function(_0x306a06){var _0x1ea7a0={};_0x1ea7a0[_0x306a06]={'$like':'%'+_0x24f6a9[_0x465f('0x32')][_0x465f('0x3d')]+'%'};return _0x1ea7a0;})});}_0x114e94=_[_0x465f('0x3f')]({},_0x114e94,_0x24f6a9['options']);return _0x1fa4d3['getTeams'](_0x114e94);}})[_0x465f('0x26')](function(_0x1cdb9){if(_0x1cdb9){_0x8e992a=_0x1cdb9[_0x465f('0x4b')];if(!_0x24f6a9['query']['hasOwnProperty'](_0x465f('0x38'))){_0x114e94[_0x465f('0x1f')]=qs['limit'](_0x24f6a9[_0x465f('0x32')][_0x465f('0x1f')]);_0x114e94['offset']=qs['offset'](_0x24f6a9[_0x465f('0x32')]['offset']);}return _0x1fa4d3['getTeams'](_0x114e94);}})[_0x465f('0x26')](function(_0x2cd8d6){if(_0x2cd8d6){return _0x2cd8d6?{'count':_0x8e992a,'rows':_0x2cd8d6}:null;}})[_0x465f('0x26')](respondWithResult(_0x12ebbf,null))[_0x465f('0x47')](handleError(_0x12ebbf,null));};exports[_0x465f('0x61')]=function(_0x963beb,_0x32cfee,_0x2bc079){var _0x342520=_0x963beb[_0x465f('0x4e')]['ids'];return db['Team'][_0x465f('0x45')]({'where':{'id':_0x342520},'attributes':['id'],'include':[{'model':db[_0x465f('0x59')],'as':_0x465f('0x62'),'attributes':['id',_0x465f('0x2b'),_0x465f('0x63'),_0x465f('0x64'),_0x465f('0x65')],'raw':!![]}]})['then'](function(_0x58061d){if(_0x58061d){var _0x16f75c=_[_0x465f('0x66')](_0x58061d,function(_0x3f4766){var _0x1fc967=_0x3f4766['get']({'plain':!![]});return _0x1fc967[_0x465f('0x62')];});return db['FaxQueue']['find']({'where':{'id':_0x963beb['params']['id']}})['then'](function(_0x53e07b){return db['sequelize'][_0x465f('0x67')](function(_0xf17956){return _0x53e07b[_0x465f('0x61')](_0x342520,{'transaction':_0xf17956})[_0x465f('0x26')](function(){return BPromise[_0x465f('0x68')](_0x16f75c,function(_0x4f53e4){return db[_0x465f('0x57')][_0x465f('0x69')]({'where':{'UserId':_0x4f53e4['id'],'FaxQueueId':_0x963beb[_0x465f('0x49')]['id']},'transaction':_0xf17956});});})['then'](function(){_0x16f75c[_0x465f('0x6a')](function(_0x2f1799){socket['emit'](_0x465f('0x6b'),{'UserId':_0x2f1799['id'],'FaxQueueId':_0x53e07b['id']});});});});});}})['then'](respondWithStatusCode(_0x32cfee,null))[_0x465f('0x47')](handleError(_0x32cfee,null));};exports[_0x465f('0x6c')]=function(_0x47a8fa,_0x527c27,_0x436ae0){return db['Team'][_0x465f('0x45')]({'where':{'id':_0x47a8fa[_0x465f('0x32')][_0x465f('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x465f('0x59')],'as':_0x465f('0x62'),'attributes':['id'],'raw':!![]}]})[_0x465f('0x26')](handleEntityNotFound(_0x527c27,null))[_0x465f('0x26')](function(_0x548f2d){var _0x18218f=_['map'](_0x548f2d,'id');var _0x159620=[];var _0x50375c=[];var _0x36ca05=squel[_0x465f('0x6e')]();_0x36ca05[_0x465f('0x6f')](_0x465f('0x70'))[_0x465f('0x71')](_0x465f('0x72'),'tq')['join'](_0x465f('0x73'),'ut',_0x465f('0x74'))[_0x465f('0x3b')](_0x465f('0x75'),_0x47a8fa[_0x465f('0x49')]['id']);for(var _0x186e05=0x0;_0x186e05<_0x548f2d[_0x465f('0x4b')];_0x186e05+=0x1){let _0xa0a9e4=_0x548f2d[_0x186e05];for(var _0x27701c=0x0;_0x27701c<_0xa0a9e4[_0x465f('0x62')][_0x465f('0x4b')];_0x27701c+=0x1){let _0x4b71b5=_0xa0a9e4['Agents'][_0x27701c];var _0x34369c=_0x36ca05['clone']();_0x34369c[_0x465f('0x3b')]('ut.UserId\x20=\x20?',_0x4b71b5['id']);_0x50375c[_0x465f('0x76')](db['sequelize'][_0x465f('0x32')](_0x34369c[_0x465f('0x77')](),{'type':db[_0x465f('0x78')][_0x465f('0x79')][_0x465f('0x7a')]})[_0x465f('0x26')](function(_0x5ef799){if(_0x5ef799['length']===0x1){return _0x4b71b5['id'];}else{var _0x3d6ea2=_[_0x465f('0x7b')](_['map'](_0x5ef799,_0x465f('0x7c')),function(_0xf714cf){return _[_0x465f('0x7d')](_0x18218f,_0xf714cf);});if(_0x3d6ea2){return _0x4b71b5['id'];}}}));}}return BPromise[_0x465f('0x7e')](_0x50375c)[_0x465f('0x26')](function(_0x188a5d){_0x159620=_(_0x159620)[_0x465f('0x7f')](_0x188a5d)['compact']()['value']();return db[_0x465f('0x44')]['find']({'where':{'id':_0x47a8fa[_0x465f('0x49')]['id']}})[_0x465f('0x26')](function(_0x1de813){return db[_0x465f('0x78')][_0x465f('0x67')](function(_0x1eed86){return _0x1de813[_0x465f('0x6c')](_0x47a8fa[_0x465f('0x32')]['ids'],{'transaction':_0x1eed86})[_0x465f('0x26')](function(){if(!_[_0x465f('0x80')](_0x159620)){return _0x1de813['removeAgents'](_0x159620,{'transaction':_0x1eed86});}})[_0x465f('0x26')](function(){_0x159620['forEach'](function(_0x314848){socket['emit'](_0x465f('0x81'),{'UserId':_0x314848,'FaxQueueId':_0x1de813['id']});});});});});});})[_0x465f('0x26')](respondWithStatusCode(_0x527c27,null))[_0x465f('0x47')](handleError(_0x527c27,null));};exports[_0x465f('0x82')]=function(_0x1bcdd2,_0x44e3e1,_0x133142){return db[_0x465f('0x44')][_0x465f('0x4c')]({'where':{'id':_0x1bcdd2[_0x465f('0x49')]['id']}})[_0x465f('0x26')](handleEntityNotFound(_0x44e3e1,null))[_0x465f('0x26')](function(_0x599954){if(_0x599954){return _0x599954[_0x465f('0x82')](_0x1bcdd2['body']['ids'],_[_0x465f('0x83')](_0x1bcdd2[_0x465f('0x4e')],[_0x465f('0x6d'),'id'])||{})[_0x465f('0x84')](function(_0x433086){for(var _0x271dd9=0x0;_0x271dd9<_0x1bcdd2[_0x465f('0x4e')][_0x465f('0x6d')][_0x465f('0x4b')];_0x271dd9+=0x1){socket[_0x465f('0x85')](_0x465f('0x6b'),{'UserId':_0x1bcdd2[_0x465f('0x4e')][_0x465f('0x6d')][_0x271dd9],'FaxQueueId':_0x1bcdd2[_0x465f('0x49')]['id']});}return _0x433086;});}})[_0x465f('0x26')](respondWithResult(_0x44e3e1,null))[_0x465f('0x47')](handleError(_0x44e3e1,null));};exports[_0x465f('0x86')]=function(_0x2aca85,_0x49f52d,_0x162e28){return db[_0x465f('0x44')][_0x465f('0x4c')]({'where':{'id':_0x2aca85['params']['id']}})[_0x465f('0x26')](handleEntityNotFound(_0x49f52d,null))['then'](function(_0x13718f){if(_0x13718f){return _0x13718f[_0x465f('0x86')](_0x2aca85[_0x465f('0x32')][_0x465f('0x6d')])['then'](function(){if(_['isArray'](_0x2aca85[_0x465f('0x32')]['ids'])){for(var _0x4df965=0x0;_0x4df965<_0x2aca85[_0x465f('0x32')][_0x465f('0x6d')][_0x465f('0x4b')];_0x4df965+=0x1){socket[_0x465f('0x85')]('userFaxQueue:remove',{'UserId':Number(_0x2aca85['query'][_0x465f('0x6d')][_0x4df965]),'FaxQueueId':Number(_0x2aca85[_0x465f('0x49')]['id'])});}}else{socket['emit'](_0x465f('0x81'),{'UserId':Number(_0x2aca85['query'][_0x465f('0x6d')]),'FaxQueueId':Number(_0x2aca85[_0x465f('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x49f52d,null))[_0x465f('0x47')](handleError(_0x49f52d,null));};exports[_0x465f('0x87')]=function(_0x5ad3d4,_0x4daf0c,_0x59b9ab){var _0x3061e1={};var _0x3b45ac={};var _0x1a7e72;var _0x1a17ac;return db[_0x465f('0x44')][_0x465f('0x56')]({'where':{'id':_0x5ad3d4[_0x465f('0x49')]['id']}})[_0x465f('0x26')](handleEntityNotFound(_0x4daf0c,null))[_0x465f('0x26')](function(_0x329420){if(_0x329420){_0x1a7e72=_0x329420;_0x3b45ac[_0x465f('0x31')]=_[_0x465f('0x4a')](db[_0x465f('0x59')][_0x465f('0x2e')]);_0x3b45ac[_0x465f('0x32')]=_[_0x465f('0x4a')](_0x5ad3d4[_0x465f('0x32')]);_0x3b45ac[_0x465f('0x33')]=_[_0x465f('0x34')](_0x3b45ac['model'],_0x3b45ac[_0x465f('0x32')]);_0x3061e1[_0x465f('0x35')]=_['intersection'](_0x3b45ac[_0x465f('0x31')],qs[_0x465f('0x36')](_0x5ad3d4[_0x465f('0x32')][_0x465f('0x36')]));_0x3061e1[_0x465f('0x35')]=_0x3061e1['attributes']['length']?_0x3061e1[_0x465f('0x35')]:_0x3b45ac[_0x465f('0x31')];_0x3061e1[_0x465f('0x39')]=qs[_0x465f('0x3a')](_0x5ad3d4[_0x465f('0x32')][_0x465f('0x3a')]);_0x3061e1[_0x465f('0x3b')]=qs['filters'](_[_0x465f('0x3c')](_0x5ad3d4['query'],_0x3b45ac['filters']));if(_0x5ad3d4[_0x465f('0x32')][_0x465f('0x3d')]){_0x3061e1[_0x465f('0x3b')]=_[_0x465f('0x3f')](_0x3061e1[_0x465f('0x3b')],{'$or':_['map'](_0x3061e1[_0x465f('0x35')],function(_0x258b25){var _0x39d889={};_0x39d889[_0x258b25]={'$like':'%'+_0x5ad3d4['query'][_0x465f('0x3d')]+'%'};return _0x39d889;})});}_0x3061e1=_[_0x465f('0x3f')]({},_0x3061e1,_0x5ad3d4['options']);return _0x1a7e72[_0x465f('0x87')](_0x3061e1);}})['then'](function(_0x34537e){if(_0x34537e){_0x1a17ac=_0x34537e[_0x465f('0x4b')];if(!_0x5ad3d4['query'][_0x465f('0x37')]('nolimit')){_0x3061e1[_0x465f('0x1f')]=qs[_0x465f('0x1f')](_0x5ad3d4[_0x465f('0x32')][_0x465f('0x1f')]);_0x3061e1[_0x465f('0x1e')]=qs[_0x465f('0x1e')](_0x5ad3d4[_0x465f('0x32')][_0x465f('0x1e')]);}return _0x1a7e72[_0x465f('0x87')](_0x3061e1);}})[_0x465f('0x26')](function(_0x284a74){if(_0x284a74){return _0x284a74?{'count':_0x1a17ac,'rows':_0x284a74}:null;}})[_0x465f('0x26')](respondWithResult(_0x4daf0c,null))[_0x465f('0x47')](handleError(_0x4daf0c,null));}; \ No newline at end of file +var _0x5129=['flatMap','Agents','sequelize','transaction','addTeams','findOrCreate','forEach','emit','removeTeams','ids','select','field','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','addAgents','omit','spread','userFaxQueue:save','isArray','userFaxQueue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','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','findOne','UserFaxQueue','FaxQueueId','findAll','User','findAndCountAll','agent','faxPause','createdAt','format','%s/%s','SIP','updatedAt','Team','order','getTeams','online','voicePause','interface'];(function(_0xb25c71,_0x184611){var _0x4ad3a4=function(_0x1bf446){while(--_0x1bf446){_0xb25c71['push'](_0xb25c71['shift']());}};_0x4ad3a4(++_0x184611);}(_0x5129,0xb5));var _0x9512=function(_0x5d7783,_0x4219f7){_0x5d7783=_0x5d7783-0x0;var _0x5bae1e=_0x5129[_0x5d7783];return _0x5bae1e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9512('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9512('0x1'));var jsonpatch=require(_0x9512('0x2'));var rp=require(_0x9512('0x3'));var moment=require(_0x9512('0x4'));var BPromise=require(_0x9512('0x5'));var Mustache=require(_0x9512('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9512('0x7'));var ejs=require(_0x9512('0x8'));var fs=require('fs');var _=require(_0x9512('0x9'));var squel=require(_0x9512('0xa'));var crypto=require(_0x9512('0xb'));var jsforce=require(_0x9512('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9512('0xd'));var Papa=require(_0x9512('0xe'));var Redis=require(_0x9512('0xf'));var authService=require(_0x9512('0x10'));var qs=require(_0x9512('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9512('0x12'));var logger=require(_0x9512('0x13'))(_0x9512('0x14'));var utils=require(_0x9512('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9512('0x16'))['db'];config[_0x9512('0x17')]=_[_0x9512('0x18')](config[_0x9512('0x17')],{'host':_0x9512('0x19'),'port':0x18eb});var socket=require(_0x9512('0x1a'))(new Redis(config[_0x9512('0x17')]));require(_0x9512('0x1b'))[_0x9512('0x1c')](socket);function respondWithStatusCode(_0x1dda33,_0x2de9b9){_0x2de9b9=_0x2de9b9||0xcc;return function(_0x1696a8){if(_0x1696a8){return _0x1dda33[_0x9512('0x1d')](_0x2de9b9);}return _0x1dda33[_0x9512('0x1e')](_0x2de9b9)[_0x9512('0x1f')]();};}function respondWithResult(_0x1ef1bc,_0x4a50d7){_0x4a50d7=_0x4a50d7||0xc8;return function(_0x5c91b9){if(_0x5c91b9){return _0x1ef1bc[_0x9512('0x1e')](_0x4a50d7)[_0x9512('0x20')](_0x5c91b9);}};}function respondWithFilteredResult(_0x131168,_0x54efc0){return function(_0x403ec2){if(_0x403ec2){var _0x3379e7=_0x403ec2[_0x9512('0x21')],_0x1b8bc5=_0x54efc0[_0x9512('0x22')],_0x359391=_0x54efc0[_0x9512('0x22')]+_0x54efc0[_0x9512('0x23')],_0x18f71a;if(_0x359391>=_0x3379e7){_0x359391=_0x3379e7;_0x18f71a=0xc8;}else{_0x18f71a=0xce;}_0x131168[_0x9512('0x1e')](_0x18f71a);return _0x131168[_0x9512('0x24')](_0x9512('0x25'),_0x1b8bc5+'-'+_0x359391+'/'+_0x3379e7)[_0x9512('0x20')](_0x403ec2);}return null;};}function patchUpdates(_0x4a21e1){return function(_0x3a5d43){try{jsonpatch[_0x9512('0x26')](_0x3a5d43,_0x4a21e1,!![]);}catch(_0x1985a5){return BPromise[_0x9512('0x27')](_0x1985a5);}return _0x3a5d43[_0x9512('0x28')]();};}function saveUpdates(_0x384078,_0x8544a0){return function(_0x444a01){if(_0x444a01){return _0x444a01[_0x9512('0x29')](_0x384078)[_0x9512('0x2a')](function(_0x4eb067){return _0x4eb067;});}return null;};}function removeEntity(_0xb1b3ac,_0x3a1e14){return function(_0xd396f){if(_0xd396f){return _0xd396f[_0x9512('0x2b')]()[_0x9512('0x2a')](function(){var _0xa00943=_0xd396f[_0x9512('0x2c')]({'plain':!![]});var _0x19aad9=_0x9512('0x2d');return db[_0x9512('0x2e')]['destroy']({'where':{'type':_0x19aad9,'resourceId':_0xa00943['id']}})[_0x9512('0x2a')](function(){return _0xd396f;});})['then'](function(){_0xb1b3ac[_0x9512('0x1e')](0xcc)[_0x9512('0x1f')]();});}};}function handleEntityNotFound(_0x160ef1,_0x2cd4b8){return function(_0x3d983d){if(!_0x3d983d){_0x160ef1[_0x9512('0x1d')](0x194);}return _0x3d983d;};}function handleError(_0x252e0,_0x2f1cda){_0x2f1cda=_0x2f1cda||0x1f4;return function(_0x1ec7ce){logger[_0x9512('0x2f')](_0x1ec7ce[_0x9512('0x30')]);if(_0x1ec7ce[_0x9512('0x31')]){delete _0x1ec7ce[_0x9512('0x31')];}_0x252e0[_0x9512('0x1e')](_0x2f1cda)[_0x9512('0x32')](_0x1ec7ce);};}exports[_0x9512('0x33')]=function(_0x3f83f0,_0x5e96b2){var _0x4bf8b7={},_0x5b3486={},_0x112c98={'count':0x0,'rows':[]};var _0x3a9ac2=_[_0x9512('0x34')](db[_0x9512('0x35')][_0x9512('0x36')],function(_0x51310a){return{'name':_0x51310a[_0x9512('0x37')],'type':_0x51310a['type'][_0x9512('0x38')]};});_0x5b3486[_0x9512('0x39')]=_[_0x9512('0x34')](_0x3a9ac2,_0x9512('0x31'));_0x5b3486[_0x9512('0x3a')]=_[_0x9512('0x3b')](_0x3f83f0['query']);_0x5b3486[_0x9512('0x3c')]=_[_0x9512('0x3d')](_0x5b3486[_0x9512('0x39')],_0x5b3486['query']);_0x4bf8b7[_0x9512('0x3e')]=_[_0x9512('0x3d')](_0x5b3486[_0x9512('0x39')],qs[_0x9512('0x3f')](_0x3f83f0[_0x9512('0x3a')][_0x9512('0x3f')]));_0x4bf8b7[_0x9512('0x3e')]=_0x4bf8b7[_0x9512('0x3e')][_0x9512('0x40')]?_0x4bf8b7['attributes']:_0x5b3486[_0x9512('0x39')];if(!_0x3f83f0[_0x9512('0x3a')][_0x9512('0x41')](_0x9512('0x42'))){_0x4bf8b7[_0x9512('0x23')]=qs[_0x9512('0x23')](_0x3f83f0['query'][_0x9512('0x23')]);_0x4bf8b7[_0x9512('0x22')]=qs['offset'](_0x3f83f0[_0x9512('0x3a')][_0x9512('0x22')]);}_0x4bf8b7['order']=qs[_0x9512('0x43')](_0x3f83f0[_0x9512('0x3a')][_0x9512('0x43')]);_0x4bf8b7[_0x9512('0x44')]=qs[_0x9512('0x3c')](_[_0x9512('0x45')](_0x3f83f0[_0x9512('0x3a')],_0x5b3486[_0x9512('0x3c')]),_0x3a9ac2);if(_0x3f83f0[_0x9512('0x3a')][_0x9512('0x46')]){_0x4bf8b7[_0x9512('0x44')]=_[_0x9512('0x47')](_0x4bf8b7[_0x9512('0x44')],{'$or':_['map'](_0x3a9ac2,function(_0x48f5b6){if(_0x48f5b6[_0x9512('0x48')]!==_0x9512('0x49')){var _0x29ad9d={};_0x29ad9d[_0x48f5b6[_0x9512('0x31')]]={'$like':'%'+_0x3f83f0[_0x9512('0x3a')][_0x9512('0x46')]+'%'};return _0x29ad9d;}})});}_0x4bf8b7=_['merge']({},_0x4bf8b7,_0x3f83f0[_0x9512('0x4a')]);var _0x3b5c00={'where':_0x4bf8b7[_0x9512('0x44')]};return db['FaxQueue']['count'](_0x3b5c00)[_0x9512('0x2a')](function(_0x40548b){_0x112c98[_0x9512('0x21')]=_0x40548b;if(_0x3f83f0[_0x9512('0x3a')][_0x9512('0x4b')]){_0x4bf8b7[_0x9512('0x4c')]=[{'all':!![]}];}return db[_0x9512('0x35')]['findAll'](_0x4bf8b7);})[_0x9512('0x2a')](function(_0x560145){_0x112c98[_0x9512('0x4d')]=_0x560145;return _0x112c98;})[_0x9512('0x2a')](respondWithFilteredResult(_0x5e96b2,_0x4bf8b7))[_0x9512('0x4e')](handleError(_0x5e96b2,null));};exports[_0x9512('0x4f')]=function(_0x37ff8c,_0x3a7947){var _0x17ccf6={'raw':!![],'where':{'id':_0x37ff8c[_0x9512('0x50')]['id']}},_0x489c17={};_0x489c17[_0x9512('0x39')]=_[_0x9512('0x3b')](db[_0x9512('0x35')]['rawAttributes']);_0x489c17[_0x9512('0x3a')]=_[_0x9512('0x3b')](_0x37ff8c[_0x9512('0x3a')]);_0x489c17[_0x9512('0x3c')]=_[_0x9512('0x3d')](_0x489c17[_0x9512('0x39')],_0x489c17[_0x9512('0x3a')]);_0x17ccf6[_0x9512('0x3e')]=_[_0x9512('0x3d')](_0x489c17['model'],qs['fields'](_0x37ff8c[_0x9512('0x3a')][_0x9512('0x3f')]));_0x17ccf6[_0x9512('0x3e')]=_0x17ccf6[_0x9512('0x3e')][_0x9512('0x40')]?_0x17ccf6['attributes']:_0x489c17[_0x9512('0x39')];if(_0x37ff8c[_0x9512('0x3a')]['includeAll']){_0x17ccf6[_0x9512('0x4c')]=[{'all':!![]}];}_0x17ccf6=_[_0x9512('0x47')]({},_0x17ccf6,_0x37ff8c['options']);return db[_0x9512('0x35')][_0x9512('0x51')](_0x17ccf6)[_0x9512('0x2a')](handleEntityNotFound(_0x3a7947,null))[_0x9512('0x2a')](respondWithResult(_0x3a7947,null))[_0x9512('0x4e')](handleError(_0x3a7947,null));};exports[_0x9512('0x52')]=function(_0x4fe5cc,_0x8181b1){return db['FaxQueue'][_0x9512('0x52')](_0x4fe5cc[_0x9512('0x53')],{})[_0x9512('0x2a')](function(_0x561065){var _0xa46cb3=_0x4fe5cc[_0x9512('0x54')][_0x9512('0x2c')]({'plain':!![]});if(!_0xa46cb3)throw new Error(_0x9512('0x55'));if(_0xa46cb3[_0x9512('0x56')]==='user'){var _0x2dbd22=_0x561065[_0x9512('0x2c')]({'plain':!![]});var _0x2fd7cd='FaxQueues';return db[_0x9512('0x57')][_0x9512('0x51')]({'where':{'name':_0x2fd7cd,'userProfileId':_0xa46cb3[_0x9512('0x58')]},'raw':!![]})[_0x9512('0x2a')](function(_0x3d5d0a){if(_0x3d5d0a&&_0x3d5d0a[_0x9512('0x59')]===0x0){return db['UserProfileResource'][_0x9512('0x52')]({'name':_0x2dbd22[_0x9512('0x31')],'resourceId':_0x2dbd22['id'],'type':_0x3d5d0a[_0x9512('0x31')],'sectionId':_0x3d5d0a['id']},{})['then'](function(){return _0x561065;});}else{return _0x561065;}})[_0x9512('0x4e')](function(_0x563c11){logger['error'](_0x9512('0x5a'),_0x563c11);throw _0x563c11;});}return _0x561065;})['then'](respondWithResult(_0x8181b1,0xc9))[_0x9512('0x4e')](handleError(_0x8181b1,null));};exports[_0x9512('0x29')]=function(_0x163e64,_0x214e90){if(_0x163e64[_0x9512('0x53')]['id']){delete _0x163e64[_0x9512('0x53')]['id'];}return db[_0x9512('0x35')][_0x9512('0x51')]({'where':{'id':_0x163e64['params']['id']}})['then'](handleEntityNotFound(_0x214e90,null))[_0x9512('0x2a')](saveUpdates(_0x163e64['body'],null))[_0x9512('0x2a')](respondWithResult(_0x214e90,null))['catch'](handleError(_0x214e90,null));};exports[_0x9512('0x2b')]=function(_0x2cec56,_0x1c46e1){return db[_0x9512('0x35')][_0x9512('0x51')]({'where':{'id':_0x2cec56[_0x9512('0x50')]['id']}})['then'](handleEntityNotFound(_0x1c46e1,null))[_0x9512('0x2a')](removeEntity(_0x1c46e1,null))[_0x9512('0x4e')](handleError(_0x1c46e1,null));};exports[_0x9512('0x5b')]=function(_0x16b68d,_0x4cdb55){return db[_0x9512('0x35')][_0x9512('0x5b')]()[_0x9512('0x2a')](respondWithResult(_0x4cdb55,null))[_0x9512('0x4e')](handleError(_0x4cdb55,null));};exports['getMembers']=function(_0xbed765,_0x5a23ad,_0x47d61b){var _0x3844f8={'raw':!![],'where':{}},_0x53d9e8={},_0x4a7cef;return db[_0x9512('0x35')][_0x9512('0x5c')]({'where':{'id':_0xbed765[_0x9512('0x50')]['id']}})[_0x9512('0x2a')](handleEntityNotFound(_0x5a23ad,null))['then'](function(_0x17e96d){if(_0x17e96d){_0x4a7cef=_0x17e96d[_0x9512('0x2c')]({'plain':!![]});_0x53d9e8[_0x9512('0x39')]=_['keys'](db[_0x9512('0x5d')][_0x9512('0x36')]);_0x53d9e8['query']=_[_0x9512('0x3b')](_0xbed765[_0x9512('0x3a')]);_0x53d9e8[_0x9512('0x3c')]=_[_0x9512('0x3d')](_0x53d9e8[_0x9512('0x39')],_0x53d9e8[_0x9512('0x3a')]);_0x3844f8['attributes']=_[_0x9512('0x3d')](_0x53d9e8[_0x9512('0x39')],qs['fields'](_0xbed765['query']['fields']));_0x3844f8['attributes']=_0x3844f8[_0x9512('0x3e')][_0x9512('0x40')]?_0x3844f8[_0x9512('0x3e')]:_0x53d9e8[_0x9512('0x39')];if(!_0xbed765[_0x9512('0x3a')][_0x9512('0x41')](_0x9512('0x42'))){_0x3844f8[_0x9512('0x23')]=qs[_0x9512('0x23')](_0xbed765[_0x9512('0x3a')][_0x9512('0x23')]);_0x3844f8[_0x9512('0x22')]=qs[_0x9512('0x22')](_0xbed765[_0x9512('0x3a')][_0x9512('0x22')]);}_0x3844f8['order']=qs[_0x9512('0x43')](_0xbed765['query']['sort']);_0x3844f8[_0x9512('0x44')]=qs['filters'](_['pick'](_0xbed765['query'],_0x53d9e8[_0x9512('0x3c')]));_0x3844f8[_0x9512('0x44')][_0x9512('0x5e')]=_0x17e96d['id'];if(_0xbed765[_0x9512('0x3a')][_0x9512('0x46')]){_0x3844f8['where']=_[_0x9512('0x47')](_0x3844f8[_0x9512('0x44')],{'$or':_[_0x9512('0x34')](_0x3844f8['attributes'],function(_0x429c82){var _0x1a6279={};_0x1a6279[_0x429c82]={'$like':'%'+_0xbed765[_0x9512('0x3a')]['filter']+'%'};return _0x1a6279;})});}_0x3844f8=_['merge']({},_0x3844f8,_0xbed765[_0x9512('0x4a')]);return db['UserFaxQueue'][_0x9512('0x5f')](_0x3844f8);}})[_0x9512('0x2a')](function(_0x3c3cc4){if(_0x3c3cc4){return db[_0x9512('0x60')][_0x9512('0x61')]({'where':{'id':_[_0x9512('0x34')](_0x3c3cc4,'UserId'),'role':_0x9512('0x62')},'attributes':['id','name',_0x9512('0x63'),'updatedAt',_0x9512('0x64')]});}})['then'](function(_0x14934a){if(_0x14934a){return{'count':_0x14934a['count'],'rows':_[_0x9512('0x34')](_0x14934a[_0x9512('0x4d')],function(_0x5b0ed9){return{'membername':_0x5b0ed9[_0x9512('0x31')],'UserId':_0x5b0ed9['id'],'queue_name':_0x4a7cef['name'],'FaxQueueId':_0x4a7cef['id'],'interface':util[_0x9512('0x65')](_0x9512('0x66'),_0x9512('0x67'),_0x5b0ed9[_0x9512('0x31')]),'penalty':0x0,'paused':_0x5b0ed9[_0x9512('0x63')],'createdAt':_0x5b0ed9[_0x9512('0x64')],'updatedAt':_0x5b0ed9[_0x9512('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9512('0x2a')](respondWithFilteredResult(_0x5a23ad,_0x3844f8))[_0x9512('0x4e')](handleError(_0x5a23ad,null));};exports['getTeams']=function(_0x5d346d,_0x5440a1,_0x1f7eb3){var _0x176f54={};var _0x1005e7={};var _0x91006c;var _0x33839c;return db[_0x9512('0x35')][_0x9512('0x5c')]({'where':{'id':_0x5d346d[_0x9512('0x50')]['id']}})['then'](handleEntityNotFound(_0x5440a1,null))[_0x9512('0x2a')](function(_0x333d73){if(_0x333d73){_0x91006c=_0x333d73;_0x1005e7[_0x9512('0x39')]=_['keys'](db[_0x9512('0x69')][_0x9512('0x36')]);_0x1005e7[_0x9512('0x3a')]=_[_0x9512('0x3b')](_0x5d346d[_0x9512('0x3a')]);_0x1005e7[_0x9512('0x3c')]=_['intersection'](_0x1005e7[_0x9512('0x39')],_0x1005e7['query']);_0x176f54['attributes']=_[_0x9512('0x3d')](_0x1005e7[_0x9512('0x39')],qs[_0x9512('0x3f')](_0x5d346d[_0x9512('0x3a')]['fields']));_0x176f54[_0x9512('0x3e')]=_0x176f54[_0x9512('0x3e')][_0x9512('0x40')]?_0x176f54[_0x9512('0x3e')]:_0x1005e7[_0x9512('0x39')];_0x176f54[_0x9512('0x6a')]=qs[_0x9512('0x43')](_0x5d346d['query'][_0x9512('0x43')]);_0x176f54['where']=qs[_0x9512('0x3c')](_[_0x9512('0x45')](_0x5d346d['query'],_0x1005e7[_0x9512('0x3c')]));if(_0x5d346d[_0x9512('0x3a')][_0x9512('0x46')]){_0x176f54['where']=_['merge'](_0x176f54[_0x9512('0x44')],{'$or':_[_0x9512('0x34')](_0x176f54['attributes'],function(_0x232dc5){var _0x119aaf={};_0x119aaf[_0x232dc5]={'$like':'%'+_0x5d346d[_0x9512('0x3a')][_0x9512('0x46')]+'%'};return _0x119aaf;})});}_0x176f54=_[_0x9512('0x47')]({},_0x176f54,_0x5d346d[_0x9512('0x4a')]);return _0x91006c[_0x9512('0x6b')](_0x176f54);}})[_0x9512('0x2a')](function(_0x156814){if(_0x156814){_0x33839c=_0x156814[_0x9512('0x40')];if(!_0x5d346d[_0x9512('0x3a')][_0x9512('0x41')](_0x9512('0x42'))){_0x176f54[_0x9512('0x23')]=qs[_0x9512('0x23')](_0x5d346d[_0x9512('0x3a')][_0x9512('0x23')]);_0x176f54[_0x9512('0x22')]=qs['offset'](_0x5d346d[_0x9512('0x3a')]['offset']);}return _0x91006c['getTeams'](_0x176f54);}})['then'](function(_0x45484e){if(_0x45484e){return _0x45484e?{'count':_0x33839c,'rows':_0x45484e}:null;}})['then'](respondWithResult(_0x5440a1,null))[_0x9512('0x4e')](handleError(_0x5440a1,null));};exports['addTeams']=function(_0x494d20,_0x2d12a4,_0x4bce11){var _0x1364f6=_0x494d20[_0x9512('0x53')]['ids'];return db[_0x9512('0x69')]['findAll']({'where':{'id':_0x1364f6},'attributes':['id'],'include':[{'model':db[_0x9512('0x60')],'as':'Agents','attributes':['id',_0x9512('0x31'),_0x9512('0x6c'),_0x9512('0x6d'),_0x9512('0x6e')],'raw':!![]}]})['then'](function(_0x49849d){if(_0x49849d){var _0xa6e014=_[_0x9512('0x6f')](_0x49849d,function(_0x45d887){var _0x3f7d7c=_0x45d887['get']({'plain':!![]});return _0x3f7d7c[_0x9512('0x70')];});return db[_0x9512('0x35')][_0x9512('0x51')]({'where':{'id':_0x494d20[_0x9512('0x50')]['id']}})[_0x9512('0x2a')](function(_0x22cb6c){return db[_0x9512('0x71')][_0x9512('0x72')](function(_0xb3b8ea){return _0x22cb6c[_0x9512('0x73')](_0x1364f6,{'transaction':_0xb3b8ea})['then'](function(){return BPromise['each'](_0xa6e014,function(_0x29ec2c){return db[_0x9512('0x5d')][_0x9512('0x74')]({'where':{'UserId':_0x29ec2c['id'],'FaxQueueId':_0x494d20[_0x9512('0x50')]['id']},'transaction':_0xb3b8ea});});})['then'](function(){_0xa6e014[_0x9512('0x75')](function(_0xd0521e){socket[_0x9512('0x76')]('userFaxQueue:save',{'UserId':_0xd0521e['id'],'FaxQueueId':_0x22cb6c['id']});});});});});}})[_0x9512('0x2a')](respondWithStatusCode(_0x2d12a4,null))[_0x9512('0x4e')](handleError(_0x2d12a4,null));};exports[_0x9512('0x77')]=function(_0x253ef4,_0x3ad7bd,_0x32914f){return db[_0x9512('0x69')][_0x9512('0x5f')]({'where':{'id':_0x253ef4[_0x9512('0x3a')][_0x9512('0x78')]},'attributes':['id'],'include':[{'model':db[_0x9512('0x60')],'as':_0x9512('0x70'),'attributes':['id'],'raw':!![]}]})[_0x9512('0x2a')](handleEntityNotFound(_0x3ad7bd,null))[_0x9512('0x2a')](function(_0x1f18e9){var _0x3dabc3=_[_0x9512('0x34')](_0x1f18e9,'id');var _0x211e3b=[];var _0xc23e41=[];var _0x19ca14=squel[_0x9512('0x79')]();_0x19ca14[_0x9512('0x7a')]('tq.TeamId')['from'](_0x9512('0x7b'),'tq')[_0x9512('0x7c')]('user_has_teams','ut',_0x9512('0x7d'))[_0x9512('0x44')](_0x9512('0x7e'),_0x253ef4[_0x9512('0x50')]['id']);for(var _0x223269=0x0;_0x223269<_0x1f18e9['length'];_0x223269+=0x1){let _0x4552ad=_0x1f18e9[_0x223269];for(var _0x41661b=0x0;_0x41661b<_0x4552ad['Agents'][_0x9512('0x40')];_0x41661b+=0x1){let _0x3e9d19=_0x4552ad[_0x9512('0x70')][_0x41661b];var _0x58add5=_0x19ca14[_0x9512('0x7f')]();_0x58add5[_0x9512('0x44')]('ut.UserId\x20=\x20?',_0x3e9d19['id']);_0xc23e41[_0x9512('0x80')](db[_0x9512('0x71')][_0x9512('0x3a')](_0x58add5['toString'](),{'type':db['sequelize'][_0x9512('0x81')][_0x9512('0x82')]})['then'](function(_0x5ea319){if(_0x5ea319[_0x9512('0x40')]===0x1){return _0x3e9d19['id'];}else{var _0x278c0b=_[_0x9512('0x83')](_[_0x9512('0x34')](_0x5ea319,_0x9512('0x84')),function(_0x35c1e5){return _[_0x9512('0x85')](_0x3dabc3,_0x35c1e5);});if(_0x278c0b){return _0x3e9d19['id'];}}}));}}return BPromise[_0x9512('0x86')](_0xc23e41)['then'](function(_0x347e14){_0x211e3b=_(_0x211e3b)[_0x9512('0x87')](_0x347e14)[_0x9512('0x88')]()[_0x9512('0x89')]();return db[_0x9512('0x35')][_0x9512('0x51')]({'where':{'id':_0x253ef4['params']['id']}})[_0x9512('0x2a')](function(_0x340dc7){return db[_0x9512('0x71')][_0x9512('0x72')](function(_0x1cb53a){return _0x340dc7[_0x9512('0x77')](_0x253ef4['query']['ids'],{'transaction':_0x1cb53a})[_0x9512('0x2a')](function(){if(!_[_0x9512('0x8a')](_0x211e3b)){return _0x340dc7['removeAgents'](_0x211e3b,{'transaction':_0x1cb53a});}})['then'](function(){_0x211e3b['forEach'](function(_0x105242){socket['emit']('userFaxQueue:remove',{'UserId':_0x105242,'FaxQueueId':_0x340dc7['id']});});});});});});})['then'](respondWithStatusCode(_0x3ad7bd,null))[_0x9512('0x4e')](handleError(_0x3ad7bd,null));};exports[_0x9512('0x8b')]=function(_0x3aae73,_0x32f4bf,_0xb0ea16){return db[_0x9512('0x35')]['find']({'where':{'id':_0x3aae73[_0x9512('0x50')]['id']}})[_0x9512('0x2a')](handleEntityNotFound(_0x32f4bf,null))[_0x9512('0x2a')](function(_0x5236c0){if(_0x5236c0){return _0x5236c0[_0x9512('0x8b')](_0x3aae73[_0x9512('0x53')][_0x9512('0x78')],_[_0x9512('0x8c')](_0x3aae73[_0x9512('0x53')],['ids','id'])||{})[_0x9512('0x8d')](function(_0x1bea99){for(var _0x3a2ecd=0x0;_0x3a2ecd<_0x3aae73[_0x9512('0x53')]['ids'][_0x9512('0x40')];_0x3a2ecd+=0x1){socket[_0x9512('0x76')](_0x9512('0x8e'),{'UserId':_0x3aae73['body']['ids'][_0x3a2ecd],'FaxQueueId':_0x3aae73[_0x9512('0x50')]['id']});}return _0x1bea99;});}})['then'](respondWithResult(_0x32f4bf,null))[_0x9512('0x4e')](handleError(_0x32f4bf,null));};exports['removeAgents']=function(_0x15dcf5,_0x564c88,_0x4c36b1){return db['FaxQueue']['find']({'where':{'id':_0x15dcf5[_0x9512('0x50')]['id']}})['then'](handleEntityNotFound(_0x564c88,null))[_0x9512('0x2a')](function(_0xd9ee95){if(_0xd9ee95){return _0xd9ee95['removeAgents'](_0x15dcf5[_0x9512('0x3a')][_0x9512('0x78')])[_0x9512('0x2a')](function(){if(_[_0x9512('0x8f')](_0x15dcf5[_0x9512('0x3a')][_0x9512('0x78')])){for(var _0xaf8e6c=0x0;_0xaf8e6c<_0x15dcf5['query'][_0x9512('0x78')]['length'];_0xaf8e6c+=0x1){socket['emit'](_0x9512('0x90'),{'UserId':Number(_0x15dcf5['query']['ids'][_0xaf8e6c]),'FaxQueueId':Number(_0x15dcf5[_0x9512('0x50')]['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x15dcf5[_0x9512('0x3a')][_0x9512('0x78')]),'FaxQueueId':Number(_0x15dcf5[_0x9512('0x50')]['id'])});}});}})['then'](respondWithStatusCode(_0x564c88,null))[_0x9512('0x4e')](handleError(_0x564c88,null));};exports[_0x9512('0x91')]=function(_0x1ff7c8,_0x2912fc,_0x268abd){var _0x79928d={};var _0x8c4ed4={};var _0x4e94d7;var _0x580172;return db[_0x9512('0x35')][_0x9512('0x5c')]({'where':{'id':_0x1ff7c8[_0x9512('0x50')]['id']}})['then'](handleEntityNotFound(_0x2912fc,null))[_0x9512('0x2a')](function(_0x10c5cb){if(_0x10c5cb){_0x4e94d7=_0x10c5cb;_0x8c4ed4['model']=_['keys'](db[_0x9512('0x60')][_0x9512('0x36')]);_0x8c4ed4[_0x9512('0x3a')]=_['keys'](_0x1ff7c8[_0x9512('0x3a')]);_0x8c4ed4[_0x9512('0x3c')]=_[_0x9512('0x3d')](_0x8c4ed4[_0x9512('0x39')],_0x8c4ed4[_0x9512('0x3a')]);_0x79928d['attributes']=_[_0x9512('0x3d')](_0x8c4ed4['model'],qs[_0x9512('0x3f')](_0x1ff7c8['query']['fields']));_0x79928d[_0x9512('0x3e')]=_0x79928d['attributes'][_0x9512('0x40')]?_0x79928d[_0x9512('0x3e')]:_0x8c4ed4['model'];_0x79928d[_0x9512('0x6a')]=qs[_0x9512('0x43')](_0x1ff7c8['query'][_0x9512('0x43')]);_0x79928d[_0x9512('0x44')]=qs[_0x9512('0x3c')](_['pick'](_0x1ff7c8[_0x9512('0x3a')],_0x8c4ed4[_0x9512('0x3c')]));if(_0x1ff7c8[_0x9512('0x3a')][_0x9512('0x46')]){_0x79928d['where']=_['merge'](_0x79928d[_0x9512('0x44')],{'$or':_[_0x9512('0x34')](_0x79928d[_0x9512('0x3e')],function(_0x2cba22){var _0x56db40={};_0x56db40[_0x2cba22]={'$like':'%'+_0x1ff7c8[_0x9512('0x3a')][_0x9512('0x46')]+'%'};return _0x56db40;})});}_0x79928d=_[_0x9512('0x47')]({},_0x79928d,_0x1ff7c8[_0x9512('0x4a')]);return _0x4e94d7['getAgents'](_0x79928d);}})[_0x9512('0x2a')](function(_0xd3c756){if(_0xd3c756){_0x580172=_0xd3c756[_0x9512('0x40')];if(!_0x1ff7c8[_0x9512('0x3a')]['hasOwnProperty'](_0x9512('0x42'))){_0x79928d[_0x9512('0x23')]=qs[_0x9512('0x23')](_0x1ff7c8[_0x9512('0x3a')][_0x9512('0x23')]);_0x79928d[_0x9512('0x22')]=qs[_0x9512('0x22')](_0x1ff7c8[_0x9512('0x3a')][_0x9512('0x22')]);}return _0x4e94d7[_0x9512('0x91')](_0x79928d);}})[_0x9512('0x2a')](function(_0x22429e){if(_0x22429e){return _0x22429e?{'count':_0x580172,'rows':_0x22429e}:null;}})[_0x9512('0x2a')](respondWithResult(_0x2912fc,null))[_0x9512('0x4e')](handleError(_0x2912fc,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index a049e43..d8b0468 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 _0x8faf=['../../mysqldb','FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x12253b,_0x1e6065){var _0xf87a27=function(_0x52e2fe){while(--_0x52e2fe){_0x12253b['push'](_0x12253b['shift']());}};_0xf87a27(++_0x1e6065);}(_0x8faf,0x1e3));var _0xf8fa=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x8faf[_0xefd519];return _0x4bb882;};'use strict';var EventEmitter=require(_0xf8fa('0x0'));var FaxQueue=require(_0xf8fa('0x1'))['db'][_0xf8fa('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xf8fa('0x3')](0x0);var events={'afterCreate':_0xf8fa('0x4'),'afterUpdate':_0xf8fa('0x5'),'afterDestroy':_0xf8fa('0x6')};function emitEvent(_0x5a83fa){return function(_0x3db434,_0x597fe5,_0x164d95){FaxQueueEvents[_0xf8fa('0x7')](_0x5a83fa+':'+_0x3db434['id'],_0x3db434);FaxQueueEvents[_0xf8fa('0x7')](_0x5a83fa,_0x3db434);_0x164d95(null);};}for(var e in events){if(events[_0xf8fa('0x8')](e)){var event=events[e];FaxQueue[_0xf8fa('0x9')](e,emitEvent(event));}}module[_0xf8fa('0xa')]=FaxQueueEvents; \ No newline at end of file +var _0x0b3b=['hook','events','../../mysqldb','FaxQueue','setMaxListeners','save','remove','emit'];(function(_0x3e8aee,_0x56f123){var _0x59a16c=function(_0x4092c9){while(--_0x4092c9){_0x3e8aee['push'](_0x3e8aee['shift']());}};_0x59a16c(++_0x56f123);}(_0x0b3b,0x69));var _0xb0b3=function(_0x5cdaed,_0x19b211){_0x5cdaed=_0x5cdaed-0x0;var _0x37f678=_0x0b3b[_0x5cdaed];return _0x37f678;};'use strict';var EventEmitter=require(_0xb0b3('0x0'));var FaxQueue=require(_0xb0b3('0x1'))['db'][_0xb0b3('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xb0b3('0x3')](0x0);var events={'afterCreate':_0xb0b3('0x4'),'afterUpdate':'update','afterDestroy':_0xb0b3('0x5')};function emitEvent(_0xb313a6){return function(_0x46806d,_0x49674b,_0x386e41){FaxQueueEvents[_0xb0b3('0x6')](_0xb313a6+':'+_0x46806d['id'],_0x46806d);FaxQueueEvents[_0xb0b3('0x6')](_0xb313a6,_0x46806d);_0x386e41(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0xb0b3('0x7')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 1897b82..c791776 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 _0x0bb8=['moment','bluebird','path','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util'];(function(_0x5485d5,_0x54beea){var _0x239028=function(_0x22e2c2){while(--_0x22e2c2){_0x5485d5['push'](_0x5485d5['shift']());}};_0x239028(++_0x54beea);}(_0x0bb8,0x153));var _0x80bb=function(_0x250d31,_0x2c2f2b){_0x250d31=_0x250d31-0x0;var _0x5239c7=_0x0bb8[_0x250d31];return _0x5239c7;};'use strict';var _=require(_0x80bb('0x0'));var util=require(_0x80bb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x80bb('0x2'));var BPromise=require(_0x80bb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x80bb('0x4'));var rimraf=require('rimraf');var config=require(_0x80bb('0x5'));var attributes=require(_0x80bb('0x6'));module[_0x80bb('0x7')]=function(_0x5c0254,_0x2acee6){return _0x5c0254[_0x80bb('0x8')](_0x80bb('0x9'),attributes,{'tableName':_0x80bb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd13f=['util','api','bluebird','request-promise','path','rimraf','./faxQueue.attributes','exports','define','FaxQueue','lodash'];(function(_0x3d4e02,_0x1c1a0e){var _0x32ebc3=function(_0x54bfcf){while(--_0x54bfcf){_0x3d4e02['push'](_0x3d4e02['shift']());}};_0x32ebc3(++_0x1c1a0e);}(_0xd13f,0x1d8));var _0xfd13=function(_0x33bdc7,_0x16929c){_0x33bdc7=_0x33bdc7-0x0;var _0x25c8a2=_0xd13f[_0x33bdc7];return _0x25c8a2;};'use strict';var _=require(_0xfd13('0x0'));var util=require(_0xfd13('0x1'));var logger=require('../../config/logger')(_0xfd13('0x2'));var moment=require('moment');var BPromise=require(_0xfd13('0x3'));var rp=require(_0xfd13('0x4'));var fs=require('fs');var path=require(_0xfd13('0x5'));var rimraf=require(_0xfd13('0x6'));var config=require('../../config/environment');var attributes=require(_0xfd13('0x7'));module[_0xfd13('0x8')]=function(_0x5c1963,_0x58fa4a){return _0x5c1963[_0xfd13('0x9')](_0xfd13('0xa'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index bc089f7..5d4dbcb 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 _0x8086=['localhost','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','find','info','ShowFaxQueue','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','defaults','redis'];(function(_0xdfd552,_0x5f39a0){var _0x598335=function(_0x1dc924){while(--_0x1dc924){_0xdfd552['push'](_0xdfd552['shift']());}};_0x598335(++_0x5f39a0);}(_0x8086,0x68));var _0x6808=function(_0xb1ca05,_0xfa7f33){_0xb1ca05=_0xb1ca05-0x0;var _0xc1043d=_0x8086[_0xb1ca05];return _0xc1043d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6808('0x0'));var BPromise=require('bluebird');var rs=require(_0x6808('0x1'));var fs=require('fs');var Redis=require(_0x6808('0x2'));var db=require(_0x6808('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6808('0x4'))(_0x6808('0x5'));var config=require('../../config/environment');var jayson=require(_0x6808('0x6'));var client=jayson['client'][_0x6808('0x7')]({'port':0x232a});config['redis']=_[_0x6808('0x8')](config[_0x6808('0x9')],{'host':_0x6808('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6808('0xb'))[_0x6808('0xc')](socket);function respondWithRpcPromise(_0xf73dc9,_0x28ff5a,_0x435e4){return new BPromise(function(_0x341e7c,_0x2f1258){return client[_0x6808('0xd')](_0xf73dc9,_0x435e4)[_0x6808('0xe')](function(_0x5ca956){logger['info'](_0x6808('0xf'),_0x28ff5a,_0x6808('0x10'));logger[_0x6808('0x11')](_0x6808('0x12'),_0x28ff5a,'request\x20sent',JSON[_0x6808('0x13')](_0x5ca956));if(_0x5ca956[_0x6808('0x14')]){if(_0x5ca956[_0x6808('0x14')][_0x6808('0x15')]===0x1f4){logger[_0x6808('0x14')](_0x6808('0xf'),_0x28ff5a,_0x5ca956['error'][_0x6808('0x16')]);return _0x2f1258(_0x5ca956[_0x6808('0x14')][_0x6808('0x16')]);}logger[_0x6808('0x14')](_0x6808('0xf'),_0x28ff5a,_0x5ca956[_0x6808('0x14')][_0x6808('0x16')]);return _0x341e7c(_0x5ca956[_0x6808('0x14')]['message']);}else{logger['info'](_0x6808('0xf'),_0x28ff5a,'request\x20sent');_0x341e7c(_0x5ca956['result'][_0x6808('0x16')]);}})[_0x6808('0x17')](function(_0x1f4efd){logger[_0x6808('0x14')](_0x6808('0xf'),_0x28ff5a,_0x1f4efd);_0x2f1258(_0x1f4efd);});});}exports[_0x6808('0x18')]=function(_0x5e0eb4){var _0x1efd96=this;return new Promise(function(_0x41bb7c,_0x4d8fcd){return db[_0x6808('0x19')][_0x6808('0x1a')]({'raw':_0x5e0eb4[_0x6808('0x1b')]?_0x5e0eb4[_0x6808('0x1b')][_0x6808('0x1c')]===undefined?!![]:![]:!![],'where':_0x5e0eb4[_0x6808('0x1b')]?_0x5e0eb4[_0x6808('0x1b')][_0x6808('0x1d')]||null:null,'attributes':_0x5e0eb4[_0x6808('0x1b')]?_0x5e0eb4[_0x6808('0x1b')][_0x6808('0x1e')]||null:null,'limit':_0x5e0eb4[_0x6808('0x1b')]?_0x5e0eb4[_0x6808('0x1b')][_0x6808('0x1f')]||null:null,'include':_0x5e0eb4[_0x6808('0x1b')]?_0x5e0eb4[_0x6808('0x1b')][_0x6808('0x20')]?_[_0x6808('0x21')](_0x5e0eb4[_0x6808('0x1b')][_0x6808('0x20')],function(_0x1494ec){return{'model':db[_0x1494ec[_0x6808('0x22')]],'as':_0x1494ec['as'],'attributes':_0x1494ec[_0x6808('0x1e')],'include':_0x1494ec['include']?_[_0x6808('0x21')](_0x1494ec[_0x6808('0x20')],function(_0x26236f){return{'model':db[_0x26236f[_0x6808('0x22')]],'as':_0x26236f['as'],'attributes':_0x26236f[_0x6808('0x1e')],'include':_0x26236f[_0x6808('0x20')]?_[_0x6808('0x21')](_0x26236f[_0x6808('0x20')],function(_0x5ade54){return{'model':db[_0x5ade54['model']],'as':_0x5ade54['as'],'attributes':_0x5ade54[_0x6808('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6808('0xe')](function(_0x446e18){logger['info'](_0x6808('0x18'),_0x5e0eb4);logger[_0x6808('0x11')](_0x6808('0x18'),_0x5e0eb4,JSON['stringify'](_0x446e18));_0x41bb7c(_0x446e18);})[_0x6808('0x17')](function(_0x344552){logger['error'](_0x6808('0x18'),_0x344552['message'],_0x5e0eb4);_0x4d8fcd(_0x1efd96[_0x6808('0x14')](0x1f4,_0x344552[_0x6808('0x16')]));});});};exports['ShowFaxQueue']=function(_0x46ebcc){var _0xb9bca9=this;return new Promise(function(_0x20a8de,_0xca5a4b){return db[_0x6808('0x19')][_0x6808('0x23')]({'raw':_0x46ebcc[_0x6808('0x1b')]?_0x46ebcc[_0x6808('0x1b')][_0x6808('0x1c')]===undefined?!![]:![]:!![],'where':_0x46ebcc[_0x6808('0x1b')]?_0x46ebcc[_0x6808('0x1b')][_0x6808('0x1d')]||null:null,'attributes':_0x46ebcc[_0x6808('0x1b')]?_0x46ebcc[_0x6808('0x1b')]['attributes']||null:null,'include':_0x46ebcc[_0x6808('0x1b')]?_0x46ebcc['options']['include']?_['map'](_0x46ebcc[_0x6808('0x1b')][_0x6808('0x20')],function(_0x4cbf97){return{'model':db[_0x4cbf97[_0x6808('0x22')]],'as':_0x4cbf97['as'],'attributes':_0x4cbf97['attributes'],'include':_0x4cbf97[_0x6808('0x20')]?_[_0x6808('0x21')](_0x4cbf97[_0x6808('0x20')],function(_0x3acda7){return{'model':db[_0x3acda7[_0x6808('0x22')]],'as':_0x3acda7['as'],'attributes':_0x3acda7[_0x6808('0x1e')],'include':_0x3acda7[_0x6808('0x20')]?_[_0x6808('0x21')](_0x3acda7[_0x6808('0x20')],function(_0x5b1251){return{'model':db[_0x5b1251[_0x6808('0x22')]],'as':_0x5b1251['as'],'attributes':_0x5b1251['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdded){logger[_0x6808('0x24')]('ShowFaxQueue',_0x46ebcc);logger[_0x6808('0x11')](_0x6808('0x25'),_0x46ebcc,JSON[_0x6808('0x13')](_0x2fdded));_0x20a8de(_0x2fdded);})[_0x6808('0x17')](function(_0x1886cd){logger[_0x6808('0x14')](_0x6808('0x25'),_0x1886cd[_0x6808('0x16')],_0x46ebcc);_0xca5a4b(_0xb9bca9[_0x6808('0x14')](0x1f4,_0x1886cd[_0x6808('0x16')]));});});}; \ No newline at end of file +var _0x0d00=['GetFaxQueue','stringify','catch','ShowFaxQueue','FaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','then','info','FaxQueue,\x20%s,\x20%s','debug','request\x20sent','error','message','result','findAll','options','raw','where','attributes','include','map','model'];(function(_0x310196,_0x2e76d7){var _0x35aa0a=function(_0x468dfc){while(--_0x468dfc){_0x310196['push'](_0x310196['shift']());}};_0x35aa0a(++_0x2e76d7);}(_0x0d00,0x72));var _0x00d0=function(_0x3d61c6,_0x4571e6){_0x3d61c6=_0x3d61c6-0x0;var _0x47e0df=_0x0d00[_0x3d61c6];return _0x47e0df;};'use strict';var _=require(_0x00d0('0x0'));var util=require(_0x00d0('0x1'));var moment=require(_0x00d0('0x2'));var BPromise=require(_0x00d0('0x3'));var rs=require(_0x00d0('0x4'));var fs=require('fs');var Redis=require(_0x00d0('0x5'));var db=require(_0x00d0('0x6'))['db'];var utils=require(_0x00d0('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x00d0('0x8'));var jayson=require(_0x00d0('0x9'));var client=jayson[_0x00d0('0xa')][_0x00d0('0xb')]({'port':0x232a});config['redis']=_[_0x00d0('0xc')](config[_0x00d0('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x00d0('0xd')]));require('./faxQueue.socket')['register'](socket);function respondWithRpcPromise(_0x3200d2,_0x58843d,_0x2fe4f3){return new BPromise(function(_0x3a34df,_0x4017ae){return client['request'](_0x3200d2,_0x2fe4f3)[_0x00d0('0xe')](function(_0x4dff74){logger[_0x00d0('0xf')](_0x00d0('0x10'),_0x58843d,'request\x20sent');logger[_0x00d0('0x11')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x58843d,_0x00d0('0x12'),JSON['stringify'](_0x4dff74));if(_0x4dff74['error']){if(_0x4dff74[_0x00d0('0x13')]['code']===0x1f4){logger[_0x00d0('0x13')](_0x00d0('0x10'),_0x58843d,_0x4dff74['error'][_0x00d0('0x14')]);return _0x4017ae(_0x4dff74[_0x00d0('0x13')][_0x00d0('0x14')]);}logger[_0x00d0('0x13')](_0x00d0('0x10'),_0x58843d,_0x4dff74[_0x00d0('0x13')][_0x00d0('0x14')]);return _0x3a34df(_0x4dff74[_0x00d0('0x13')]['message']);}else{logger['info'](_0x00d0('0x10'),_0x58843d,_0x00d0('0x12'));_0x3a34df(_0x4dff74[_0x00d0('0x15')]['message']);}})['catch'](function(_0x3f1233){logger[_0x00d0('0x13')]('FaxQueue,\x20%s,\x20%s',_0x58843d,_0x3f1233);_0x4017ae(_0x3f1233);});});}exports['GetFaxQueue']=function(_0x244636){var _0x3426c3=this;return new Promise(function(_0x448ac1,_0x53679b){return db['FaxQueue'][_0x00d0('0x16')]({'raw':_0x244636[_0x00d0('0x17')]?_0x244636[_0x00d0('0x17')][_0x00d0('0x18')]===undefined?!![]:![]:!![],'where':_0x244636['options']?_0x244636['options'][_0x00d0('0x19')]||null:null,'attributes':_0x244636['options']?_0x244636['options'][_0x00d0('0x1a')]||null:null,'limit':_0x244636[_0x00d0('0x17')]?_0x244636[_0x00d0('0x17')]['limit']||null:null,'include':_0x244636['options']?_0x244636[_0x00d0('0x17')][_0x00d0('0x1b')]?_[_0x00d0('0x1c')](_0x244636[_0x00d0('0x17')][_0x00d0('0x1b')],function(_0x5e4f16){return{'model':db[_0x5e4f16[_0x00d0('0x1d')]],'as':_0x5e4f16['as'],'attributes':_0x5e4f16[_0x00d0('0x1a')],'include':_0x5e4f16['include']?_['map'](_0x5e4f16[_0x00d0('0x1b')],function(_0x47751d){return{'model':db[_0x47751d[_0x00d0('0x1d')]],'as':_0x47751d['as'],'attributes':_0x47751d[_0x00d0('0x1a')],'include':_0x47751d['include']?_[_0x00d0('0x1c')](_0x47751d[_0x00d0('0x1b')],function(_0x3c0c52){return{'model':db[_0x3c0c52[_0x00d0('0x1d')]],'as':_0x3c0c52['as'],'attributes':_0x3c0c52[_0x00d0('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x166cd0){logger[_0x00d0('0xf')](_0x00d0('0x1e'),_0x244636);logger['debug'](_0x00d0('0x1e'),_0x244636,JSON[_0x00d0('0x1f')](_0x166cd0));_0x448ac1(_0x166cd0);})[_0x00d0('0x20')](function(_0x5ace3d){logger['error'](_0x00d0('0x1e'),_0x5ace3d[_0x00d0('0x14')],_0x244636);_0x53679b(_0x3426c3[_0x00d0('0x13')](0x1f4,_0x5ace3d[_0x00d0('0x14')]));});});};exports[_0x00d0('0x21')]=function(_0x563a28){var _0x2ea731=this;return new Promise(function(_0x1e8086,_0x25dcf7){return db[_0x00d0('0x22')][_0x00d0('0x23')]({'raw':_0x563a28[_0x00d0('0x17')]?_0x563a28[_0x00d0('0x17')][_0x00d0('0x18')]===undefined?!![]:![]:!![],'where':_0x563a28[_0x00d0('0x17')]?_0x563a28[_0x00d0('0x17')][_0x00d0('0x19')]||null:null,'attributes':_0x563a28[_0x00d0('0x17')]?_0x563a28[_0x00d0('0x17')][_0x00d0('0x1a')]||null:null,'include':_0x563a28[_0x00d0('0x17')]?_0x563a28[_0x00d0('0x17')][_0x00d0('0x1b')]?_[_0x00d0('0x1c')](_0x563a28[_0x00d0('0x17')][_0x00d0('0x1b')],function(_0xc93c6){return{'model':db[_0xc93c6[_0x00d0('0x1d')]],'as':_0xc93c6['as'],'attributes':_0xc93c6[_0x00d0('0x1a')],'include':_0xc93c6[_0x00d0('0x1b')]?_['map'](_0xc93c6[_0x00d0('0x1b')],function(_0x38ca38){return{'model':db[_0x38ca38['model']],'as':_0x38ca38['as'],'attributes':_0x38ca38['attributes'],'include':_0x38ca38[_0x00d0('0x1b')]?_['map'](_0x38ca38[_0x00d0('0x1b')],function(_0x488e58){return{'model':db[_0x488e58['model']],'as':_0x488e58['as'],'attributes':_0x488e58[_0x00d0('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x00d0('0xe')](function(_0x325c14){logger[_0x00d0('0xf')](_0x00d0('0x21'),_0x563a28);logger[_0x00d0('0x11')](_0x00d0('0x21'),_0x563a28,JSON[_0x00d0('0x1f')](_0x325c14));_0x1e8086(_0x325c14);})['catch'](function(_0x2b3682){logger[_0x00d0('0x13')](_0x00d0('0x21'),_0x2b3682[_0x00d0('0x14')],_0x563a28);_0x25dcf7(_0x2ea731[_0x00d0('0x13')](0x1f4,_0x2b3682[_0x00d0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 0f1dabb..e510996 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 _0x28de=['length','faxQueue:','./faxQueue.events','update','emit','removeListener'];(function(_0x488a30,_0x196dd2){var _0x299108=function(_0x34b5d1){while(--_0x34b5d1){_0x488a30['push'](_0x488a30['shift']());}};_0x299108(++_0x196dd2);}(_0x28de,0x170));var _0xe28d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x28de[_0x321bb2];return _0x9c12ed;};'use strict';var FaxQueueEvents=require(_0xe28d('0x0'));var events=['save','remove',_0xe28d('0x1')];function createListener(_0x18dde8,_0x919cf3){return function(_0x24fb27){_0x919cf3[_0xe28d('0x2')](_0x18dde8,_0x24fb27);};}function removeListener(_0x2cea7c,_0x3ee495){return function(){FaxQueueEvents[_0xe28d('0x3')](_0x2cea7c,_0x3ee495);};}exports['register']=function(_0x131604){for(var _0x12a2cb=0x0,_0x539dbb=events[_0xe28d('0x4')];_0x12a2cb<_0x539dbb;_0x12a2cb++){var _0x4fb0a8=events[_0x12a2cb];var _0x11d73f=createListener(_0xe28d('0x5')+_0x4fb0a8,_0x131604);FaxQueueEvents['on'](_0x4fb0a8,_0x11d73f);}}; \ No newline at end of file +var _0xc1aa=['removeListener','register','length','faxQueue:','./faxQueue.events','save','remove','update','emit'];(function(_0x4a1874,_0x52dc6d){var _0x5e5771=function(_0x2cf6ad){while(--_0x2cf6ad){_0x4a1874['push'](_0x4a1874['shift']());}};_0x5e5771(++_0x52dc6d);}(_0xc1aa,0xe5));var _0xac1a=function(_0x6d4715,_0x395d0c){_0x6d4715=_0x6d4715-0x0;var _0x4e76db=_0xc1aa[_0x6d4715];return _0x4e76db;};'use strict';var FaxQueueEvents=require(_0xac1a('0x0'));var events=[_0xac1a('0x1'),_0xac1a('0x2'),_0xac1a('0x3')];function createListener(_0x25f903,_0x17c069){return function(_0x426326){_0x17c069[_0xac1a('0x4')](_0x25f903,_0x426326);};}function removeListener(_0x5327d7,_0x12710f){return function(){FaxQueueEvents[_0xac1a('0x5')](_0x5327d7,_0x12710f);};}exports[_0xac1a('0x6')]=function(_0x4fce2b){for(var _0x4b2ce8=0x0,_0x33799a=events[_0xac1a('0x7')];_0x4b2ce8<_0x33799a;_0x4b2ce8++){var _0x470b0a=events[_0x4b2ce8];var _0x566ebf=createListener(_0xac1a('0x8')+_0x470b0a,_0x4fce2b);FaxQueueEvents['on'](_0x470b0a,_0x566ebf);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index d708d9c..371b376 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 _0xd8b0=['util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','index','get','/describe','describe','isAuthenticated','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','/:id','update','delete','destroy','removeTeams','exports','multer'];(function(_0xae11d3,_0x13b6a0){var _0x47acc1=function(_0x101536){while(--_0x101536){_0xae11d3['push'](_0xae11d3['shift']());}};_0x47acc1(++_0x13b6a0);}(_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 auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0x8')](_0x0d8b('0xd'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0x8')](_0x0d8b('0xf'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['get'](_0x0d8b('0x11'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')]('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x13')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x15')]);router[_0x0d8b('0x13')](_0x0d8b('0x11'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x16')]);router['put'](_0x0d8b('0x17'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x18')]);router[_0x0d8b('0x19')](_0x0d8b('0x17'),auth['isAuthenticated'](),controller[_0x0d8b('0x1a')]);router[_0x0d8b('0x19')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x1b')]);router[_0x0d8b('0x19')](_0x0d8b('0x11'),auth[_0x0d8b('0xb')](),controller['removeAgents']);module[_0x0d8b('0x1c')]=router; \ No newline at end of file +var _0x5f2f=['removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','/:id/members','getTeams','getAgents','post','create','addTeams','/:id/users','put','update','delete','destroy','/:id/teams'];(function(_0x3627e8,_0x4aa5d7){var _0x136fdf=function(_0x496a92){while(--_0x496a92){_0x3627e8['push'](_0x3627e8['shift']());}};_0x136fdf(++_0x4aa5d7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x42acd0,_0x1ac887){_0x42acd0=_0x42acd0-0x0;var _0x2fed2e=_0x5f2f[_0x42acd0];return _0x2fed2e;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['getMembers']);router[_0xf5f2('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x8')]('/:id/users',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x11')]);router[_0xf5f2('0x10')]('/:id/teams',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x10')](_0xf5f2('0x13'),auth[_0xf5f2('0x9')](),controller['addAgents']);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x15')]);router[_0xf5f2('0x16')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x17')]);router[_0xf5f2('0x16')](_0xf5f2('0x18'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x19')]);router[_0xf5f2('0x16')](_0xf5f2('0x13'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x1a')]);module[_0xf5f2('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index c641816..1af5aa8 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 _0x0c88=['DATE','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0c88,0x121));var _0x80c8=function(_0x43a6cd,_0x503d1a){_0x43a6cd=_0x43a6cd-0x0;var _0x5acb36=_0x0c88[_0x43a6cd];return _0x5acb36;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x80c8('0x0')]={'uniqueid':{'type':Sequelize[_0x80c8('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x80c8('0x1')]},'joinAt':{'type':Sequelize[_0x80c8('0x2')]},'leaveAt':{'type':Sequelize[_0x80c8('0x2')]},'acceptAt':{'type':Sequelize[_0x80c8('0x2')]},'exitAt':{'type':Sequelize[_0x80c8('0x2')]},'reason':{'type':Sequelize[_0x80c8('0x1')]}}; \ No newline at end of file +var _0xfecd=['STRING','DATE','moment','sequelize','exports'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0xfecd,0x124));var _0xdfec=function(_0x1cd0ad,_0x48b2a4){_0x1cd0ad=_0x1cd0ad-0x0;var _0x3656c4=_0xfecd[_0x1cd0ad];return _0x3656c4;};'use strict';var moment=require(_0xdfec('0x0'));var Sequelize=require(_0xdfec('0x1'));module[_0xdfec('0x2')]={'uniqueid':{'type':Sequelize[_0xdfec('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xdfec('0x4')]},'leaveAt':{'type':Sequelize[_0xdfec('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xdfec('0x4')]},'reason':{'type':Sequelize[_0xdfec('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index eee17c0..6557d1a 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 _0x89d4=['rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','FaxQueueReport','count','includeAll','findAll','catch','show','keys','include','options','find','create','body','update','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','set','Content-Range','json','apply','then','sendStatus','error','stack','name','send','index','map'];(function(_0x42e3fe,_0x1d631b){var _0x185d33=function(_0x492544){while(--_0x492544){_0x42e3fe['push'](_0x42e3fe['shift']());}};_0x185d33(++_0x1d631b);}(_0x89d4,0x107));var _0x489d=function(_0x5be795,_0x1cb1b8){_0x5be795=_0x5be795-0x0;var _0x4e8a3b=_0x89d4[_0x5be795];return _0x4e8a3b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x489d('0x0'));var rimraf=require(_0x489d('0x1'));var zipdir=require(_0x489d('0x2'));var jsonpatch=require(_0x489d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x489d('0x4'));var util=require(_0x489d('0x5'));var path=require(_0x489d('0x6'));var sox=require(_0x489d('0x7'));var csv=require(_0x489d('0x8'));var ejs=require(_0x489d('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x489d('0xa'));var jsforce=require(_0x489d('0xb'));var deskjs=require(_0x489d('0xc'));var toCsv=require(_0x489d('0x8'));var querystring=require(_0x489d('0xd'));var Papa=require(_0x489d('0xe'));var Redis=require(_0x489d('0xf'));var authService=require(_0x489d('0x10'));var qs=require(_0x489d('0x11'));var as=require(_0x489d('0x12'));var hardwareService=require(_0x489d('0x13'));var logger=require(_0x489d('0x14'))('api');var utils=require(_0x489d('0x15'));var config=require(_0x489d('0x16'));var licenseUtil=require(_0x489d('0x17'));var db=require(_0x489d('0x18'))['db'];function respondWithStatusCode(_0x526248,_0x227d42){_0x227d42=_0x227d42||0xcc;return function(_0x3a72d7){if(_0x3a72d7){return _0x526248['sendStatus'](_0x227d42);}return _0x526248[_0x489d('0x19')](_0x227d42)[_0x489d('0x1a')]();};}function respondWithResult(_0x38189a,_0x153586){_0x153586=_0x153586||0xc8;return function(_0x515203){if(_0x515203){return _0x38189a[_0x489d('0x19')](_0x153586)['json'](_0x515203);}};}function respondWithFilteredResult(_0x57979b,_0x54bb8a){return function(_0xb3878c){if(_0xb3878c){var _0x5dd242=_0xb3878c['count'],_0x10a3c5=_0x54bb8a[_0x489d('0x1b')],_0x4b0754=_0x54bb8a[_0x489d('0x1b')]+_0x54bb8a[_0x489d('0x1c')],_0x341677;if(_0x4b0754>=_0x5dd242){_0x4b0754=_0x5dd242;_0x341677=0xc8;}else{_0x341677=0xce;}_0x57979b['status'](_0x341677);return _0x57979b[_0x489d('0x1d')](_0x489d('0x1e'),_0x10a3c5+'-'+_0x4b0754+'/'+_0x5dd242)[_0x489d('0x1f')](_0xb3878c);}return null;};}function patchUpdates(_0x4892c1){return function(_0x20f288){try{jsonpatch[_0x489d('0x20')](_0x20f288,_0x4892c1,!![]);}catch(_0x1d52e0){return BPromise['reject'](_0x1d52e0);}return _0x20f288['save']();};}function saveUpdates(_0x399dca,_0x24ff05){return function(_0x8c2fa2){if(_0x8c2fa2){return _0x8c2fa2['update'](_0x399dca)[_0x489d('0x21')](function(_0x504324){return _0x504324;});}return null;};}function removeEntity(_0x4c0223,_0x5f198d){return function(_0x18a014){if(_0x18a014){return _0x18a014['destroy']()[_0x489d('0x21')](function(){_0x4c0223['status'](0xcc)[_0x489d('0x1a')]();});}};}function handleEntityNotFound(_0x6c3361,_0x1dfc78){return function(_0x1610ba){if(!_0x1610ba){_0x6c3361[_0x489d('0x22')](0x194);}return _0x1610ba;};}function handleError(_0x258f25,_0x48742f){_0x48742f=_0x48742f||0x1f4;return function(_0x2a267f){logger[_0x489d('0x23')](_0x2a267f[_0x489d('0x24')]);if(_0x2a267f[_0x489d('0x25')]){delete _0x2a267f[_0x489d('0x25')];}_0x258f25[_0x489d('0x19')](_0x48742f)[_0x489d('0x26')](_0x2a267f);};}exports[_0x489d('0x27')]=function(_0x5e6398,_0x464142){var _0x4825f7={},_0xd9f275={},_0x36dfb9={'count':0x0,'rows':[]};var _0x56e6d7=_[_0x489d('0x28')](db['FaxQueueReport'][_0x489d('0x29')],function(_0xe37bb2){return{'name':_0xe37bb2[_0x489d('0x2a')],'type':_0xe37bb2[_0x489d('0x2b')][_0x489d('0x2c')]};});_0xd9f275[_0x489d('0x2d')]=_[_0x489d('0x28')](_0x56e6d7,_0x489d('0x25'));_0xd9f275[_0x489d('0x2e')]=_['keys'](_0x5e6398[_0x489d('0x2e')]);_0xd9f275[_0x489d('0x2f')]=_[_0x489d('0x30')](_0xd9f275[_0x489d('0x2d')],_0xd9f275[_0x489d('0x2e')]);_0x4825f7[_0x489d('0x31')]=_[_0x489d('0x30')](_0xd9f275[_0x489d('0x2d')],qs[_0x489d('0x32')](_0x5e6398['query'][_0x489d('0x32')]));_0x4825f7[_0x489d('0x31')]=_0x4825f7[_0x489d('0x31')][_0x489d('0x33')]?_0x4825f7[_0x489d('0x31')]:_0xd9f275[_0x489d('0x2d')];if(!_0x5e6398[_0x489d('0x2e')][_0x489d('0x34')](_0x489d('0x35'))){_0x4825f7['limit']=qs['limit'](_0x5e6398[_0x489d('0x2e')][_0x489d('0x1c')]);_0x4825f7[_0x489d('0x1b')]=qs[_0x489d('0x1b')](_0x5e6398[_0x489d('0x2e')]['offset']);}_0x4825f7[_0x489d('0x36')]=qs[_0x489d('0x37')](_0x5e6398[_0x489d('0x2e')][_0x489d('0x37')]);_0x4825f7[_0x489d('0x38')]=qs[_0x489d('0x2f')](_['pick'](_0x5e6398[_0x489d('0x2e')],_0xd9f275['filters']),_0x56e6d7);if(_0x5e6398[_0x489d('0x2e')][_0x489d('0x39')]){_0x4825f7[_0x489d('0x38')]=_[_0x489d('0x3a')](_0x4825f7[_0x489d('0x38')],{'$or':_[_0x489d('0x28')](_0x56e6d7,function(_0x336892){if(_0x336892['type']!==_0x489d('0x3b')){var _0x2bd0a5={};_0x2bd0a5[_0x336892[_0x489d('0x25')]]={'$like':'%'+_0x5e6398['query']['filter']+'%'};return _0x2bd0a5;}})});}_0x4825f7=_[_0x489d('0x3a')]({},_0x4825f7,_0x5e6398['options']);var _0x171bb7={'where':_0x4825f7['where']};return db[_0x489d('0x3c')][_0x489d('0x3d')](_0x171bb7)[_0x489d('0x21')](function(_0x1c852d){_0x36dfb9[_0x489d('0x3d')]=_0x1c852d;if(_0x5e6398[_0x489d('0x2e')][_0x489d('0x3e')]){_0x4825f7['include']=[{'all':!![]}];}return db[_0x489d('0x3c')][_0x489d('0x3f')](_0x4825f7);})['then'](function(_0x2c2c1a){_0x36dfb9['rows']=_0x2c2c1a;return _0x36dfb9;})['then'](respondWithFilteredResult(_0x464142,_0x4825f7))[_0x489d('0x40')](handleError(_0x464142,null));};exports[_0x489d('0x41')]=function(_0x5c47db,_0x9ee3b8){var _0x237cdd={'raw':!![],'where':{'id':_0x5c47db['params']['id']}},_0x465ffa={};_0x465ffa[_0x489d('0x2d')]=_[_0x489d('0x42')](db[_0x489d('0x3c')]['rawAttributes']);_0x465ffa[_0x489d('0x2e')]=_['keys'](_0x5c47db['query']);_0x465ffa[_0x489d('0x2f')]=_[_0x489d('0x30')](_0x465ffa['model'],_0x465ffa[_0x489d('0x2e')]);_0x237cdd['attributes']=_[_0x489d('0x30')](_0x465ffa[_0x489d('0x2d')],qs[_0x489d('0x32')](_0x5c47db['query'][_0x489d('0x32')]));_0x237cdd[_0x489d('0x31')]=_0x237cdd['attributes'][_0x489d('0x33')]?_0x237cdd[_0x489d('0x31')]:_0x465ffa['model'];if(_0x5c47db['query'][_0x489d('0x3e')]){_0x237cdd[_0x489d('0x43')]=[{'all':!![]}];}_0x237cdd=_[_0x489d('0x3a')]({},_0x237cdd,_0x5c47db[_0x489d('0x44')]);return db[_0x489d('0x3c')][_0x489d('0x45')](_0x237cdd)[_0x489d('0x21')](handleEntityNotFound(_0x9ee3b8,null))[_0x489d('0x21')](respondWithResult(_0x9ee3b8,null))[_0x489d('0x40')](handleError(_0x9ee3b8,null));};exports[_0x489d('0x46')]=function(_0x6f8dc2,_0x24e9a6){return db[_0x489d('0x3c')]['create'](_0x6f8dc2[_0x489d('0x47')],{})[_0x489d('0x21')](respondWithResult(_0x24e9a6,0xc9))[_0x489d('0x40')](handleError(_0x24e9a6,null));};exports[_0x489d('0x48')]=function(_0x1458f2,_0x26a9fa){if(_0x1458f2[_0x489d('0x47')]['id']){delete _0x1458f2[_0x489d('0x47')]['id'];}return db[_0x489d('0x3c')][_0x489d('0x45')]({'where':{'id':_0x1458f2[_0x489d('0x49')]['id']}})['then'](handleEntityNotFound(_0x26a9fa,null))[_0x489d('0x21')](saveUpdates(_0x1458f2[_0x489d('0x47')],null))[_0x489d('0x21')](respondWithResult(_0x26a9fa,null))[_0x489d('0x40')](handleError(_0x26a9fa,null));};exports[_0x489d('0x4a')]=function(_0x1dfc76,_0x170b38){return db[_0x489d('0x3c')][_0x489d('0x45')]({'where':{'id':_0x1dfc76[_0x489d('0x49')]['id']}})[_0x489d('0x21')](handleEntityNotFound(_0x170b38,null))[_0x489d('0x21')](removeEntity(_0x170b38,null))[_0x489d('0x40')](handleError(_0x170b38,null));};exports[_0x489d('0x4b')]=function(_0x1c47a8,_0x1a3df6){return db[_0x489d('0x3c')][_0x489d('0x4b')]()[_0x489d('0x21')](respondWithResult(_0x1a3df6,null))[_0x489d('0x40')](handleError(_0x1a3df6,null));}; \ No newline at end of file +var _0x9f3a=['intersection','attributes','fields','length','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','FaxQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters'];(function(_0x471448,_0x1c0e9e){var _0x38190b=function(_0x41dd2f){while(--_0x41dd2f){_0x471448['push'](_0x471448['shift']());}};_0x38190b(++_0x1c0e9e);}(_0x9f3a,0x192));var _0xa9f3=function(_0x2c7b86,_0x59ef3c){_0x2c7b86=_0x2c7b86-0x0;var _0x256735=_0x9f3a[_0x2c7b86];return _0x256735;};'use strict';var pdf=require(_0xa9f3('0x0'));var emlformat=require(_0xa9f3('0x1'));var rimraf=require(_0xa9f3('0x2'));var zipdir=require(_0xa9f3('0x3'));var jsonpatch=require(_0xa9f3('0x4'));var rp=require('request-promise');var moment=require(_0xa9f3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa9f3('0x6'));var util=require(_0xa9f3('0x7'));var path=require(_0xa9f3('0x8'));var sox=require(_0xa9f3('0x9'));var csv=require(_0xa9f3('0xa'));var ejs=require(_0xa9f3('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa9f3('0xc'));var crypto=require(_0xa9f3('0xd'));var jsforce=require(_0xa9f3('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa9f3('0xf'));var Papa=require(_0xa9f3('0x10'));var Redis=require('ioredis');var authService=require(_0xa9f3('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa9f3('0x12'));var logger=require(_0xa9f3('0x13'))(_0xa9f3('0x14'));var utils=require(_0xa9f3('0x15'));var config=require(_0xa9f3('0x16'));var licenseUtil=require(_0xa9f3('0x17'));var db=require(_0xa9f3('0x18'))['db'];function respondWithStatusCode(_0x33e564,_0x59c297){_0x59c297=_0x59c297||0xcc;return function(_0x1069e6){if(_0x1069e6){return _0x33e564['sendStatus'](_0x59c297);}return _0x33e564[_0xa9f3('0x19')](_0x59c297)['end']();};}function respondWithResult(_0xcfe710,_0x1f0468){_0x1f0468=_0x1f0468||0xc8;return function(_0x44498c){if(_0x44498c){return _0xcfe710['status'](_0x1f0468)[_0xa9f3('0x1a')](_0x44498c);}};}function respondWithFilteredResult(_0x391331,_0x58d452){return function(_0x3303c9){if(_0x3303c9){var _0x36fbca=_0x3303c9[_0xa9f3('0x1b')],_0x3cee42=_0x58d452[_0xa9f3('0x1c')],_0x3d5fa4=_0x58d452[_0xa9f3('0x1c')]+_0x58d452[_0xa9f3('0x1d')],_0x2fbb63;if(_0x3d5fa4>=_0x36fbca){_0x3d5fa4=_0x36fbca;_0x2fbb63=0xc8;}else{_0x2fbb63=0xce;}_0x391331[_0xa9f3('0x19')](_0x2fbb63);return _0x391331[_0xa9f3('0x1e')](_0xa9f3('0x1f'),_0x3cee42+'-'+_0x3d5fa4+'/'+_0x36fbca)['json'](_0x3303c9);}return null;};}function patchUpdates(_0x298c6f){return function(_0x44d114){try{jsonpatch[_0xa9f3('0x20')](_0x44d114,_0x298c6f,!![]);}catch(_0x42deee){return BPromise['reject'](_0x42deee);}return _0x44d114[_0xa9f3('0x21')]();};}function saveUpdates(_0x10bb15,_0x5efd82){return function(_0x4ba9fc){if(_0x4ba9fc){return _0x4ba9fc[_0xa9f3('0x22')](_0x10bb15)[_0xa9f3('0x23')](function(_0x3aebcd){return _0x3aebcd;});}return null;};}function removeEntity(_0x176c73,_0x447e58){return function(_0x4b1b40){if(_0x4b1b40){return _0x4b1b40[_0xa9f3('0x24')]()[_0xa9f3('0x23')](function(){_0x176c73[_0xa9f3('0x19')](0xcc)[_0xa9f3('0x25')]();});}};}function handleEntityNotFound(_0x208adb,_0x4906d8){return function(_0x3c5dae){if(!_0x3c5dae){_0x208adb[_0xa9f3('0x26')](0x194);}return _0x3c5dae;};}function handleError(_0x126d08,_0x1a5f71){_0x1a5f71=_0x1a5f71||0x1f4;return function(_0x51c065){logger[_0xa9f3('0x27')](_0x51c065[_0xa9f3('0x28')]);if(_0x51c065[_0xa9f3('0x29')]){delete _0x51c065[_0xa9f3('0x29')];}_0x126d08[_0xa9f3('0x19')](_0x1a5f71)[_0xa9f3('0x2a')](_0x51c065);};}exports[_0xa9f3('0x2b')]=function(_0xc05118,_0x1e71cb){var _0xd65ffe={},_0xb90b8c={},_0x58a3c5={'count':0x0,'rows':[]};var _0x11d92d=_['map'](db[_0xa9f3('0x2c')][_0xa9f3('0x2d')],function(_0x297442){return{'name':_0x297442[_0xa9f3('0x2e')],'type':_0x297442[_0xa9f3('0x2f')][_0xa9f3('0x30')]};});_0xb90b8c[_0xa9f3('0x31')]=_[_0xa9f3('0x32')](_0x11d92d,_0xa9f3('0x29'));_0xb90b8c[_0xa9f3('0x33')]=_[_0xa9f3('0x34')](_0xc05118['query']);_0xb90b8c[_0xa9f3('0x35')]=_[_0xa9f3('0x36')](_0xb90b8c['model'],_0xb90b8c[_0xa9f3('0x33')]);_0xd65ffe[_0xa9f3('0x37')]=_[_0xa9f3('0x36')](_0xb90b8c[_0xa9f3('0x31')],qs[_0xa9f3('0x38')](_0xc05118[_0xa9f3('0x33')][_0xa9f3('0x38')]));_0xd65ffe[_0xa9f3('0x37')]=_0xd65ffe[_0xa9f3('0x37')][_0xa9f3('0x39')]?_0xd65ffe[_0xa9f3('0x37')]:_0xb90b8c[_0xa9f3('0x31')];if(!_0xc05118[_0xa9f3('0x33')]['hasOwnProperty']('nolimit')){_0xd65ffe['limit']=qs[_0xa9f3('0x1d')](_0xc05118[_0xa9f3('0x33')][_0xa9f3('0x1d')]);_0xd65ffe['offset']=qs[_0xa9f3('0x1c')](_0xc05118['query']['offset']);}_0xd65ffe[_0xa9f3('0x3a')]=qs[_0xa9f3('0x3b')](_0xc05118[_0xa9f3('0x33')]['sort']);_0xd65ffe['where']=qs[_0xa9f3('0x35')](_[_0xa9f3('0x3c')](_0xc05118[_0xa9f3('0x33')],_0xb90b8c['filters']),_0x11d92d);if(_0xc05118[_0xa9f3('0x33')][_0xa9f3('0x3d')]){_0xd65ffe[_0xa9f3('0x3e')]=_[_0xa9f3('0x3f')](_0xd65ffe[_0xa9f3('0x3e')],{'$or':_['map'](_0x11d92d,function(_0x2dce30){if(_0x2dce30[_0xa9f3('0x2f')]!==_0xa9f3('0x40')){var _0x17985e={};_0x17985e[_0x2dce30[_0xa9f3('0x29')]]={'$like':'%'+_0xc05118['query'][_0xa9f3('0x3d')]+'%'};return _0x17985e;}})});}_0xd65ffe=_[_0xa9f3('0x3f')]({},_0xd65ffe,_0xc05118[_0xa9f3('0x41')]);var _0x5ccbe2={'where':_0xd65ffe[_0xa9f3('0x3e')]};return db[_0xa9f3('0x2c')][_0xa9f3('0x1b')](_0x5ccbe2)[_0xa9f3('0x23')](function(_0x4b13d3){_0x58a3c5[_0xa9f3('0x1b')]=_0x4b13d3;if(_0xc05118[_0xa9f3('0x33')][_0xa9f3('0x42')]){_0xd65ffe[_0xa9f3('0x43')]=[{'all':!![]}];}return db[_0xa9f3('0x2c')]['findAll'](_0xd65ffe);})[_0xa9f3('0x23')](function(_0x10296d){_0x58a3c5[_0xa9f3('0x44')]=_0x10296d;return _0x58a3c5;})[_0xa9f3('0x23')](respondWithFilteredResult(_0x1e71cb,_0xd65ffe))[_0xa9f3('0x45')](handleError(_0x1e71cb,null));};exports[_0xa9f3('0x46')]=function(_0x4ee2b8,_0x9cca35){var _0x5bfcdb={'raw':!![],'where':{'id':_0x4ee2b8['params']['id']}},_0x21b009={};_0x21b009['model']=_['keys'](db['FaxQueueReport'][_0xa9f3('0x2d')]);_0x21b009[_0xa9f3('0x33')]=_[_0xa9f3('0x34')](_0x4ee2b8['query']);_0x21b009[_0xa9f3('0x35')]=_['intersection'](_0x21b009[_0xa9f3('0x31')],_0x21b009[_0xa9f3('0x33')]);_0x5bfcdb[_0xa9f3('0x37')]=_[_0xa9f3('0x36')](_0x21b009[_0xa9f3('0x31')],qs['fields'](_0x4ee2b8['query'][_0xa9f3('0x38')]));_0x5bfcdb[_0xa9f3('0x37')]=_0x5bfcdb[_0xa9f3('0x37')][_0xa9f3('0x39')]?_0x5bfcdb[_0xa9f3('0x37')]:_0x21b009[_0xa9f3('0x31')];if(_0x4ee2b8[_0xa9f3('0x33')][_0xa9f3('0x42')]){_0x5bfcdb[_0xa9f3('0x43')]=[{'all':!![]}];}_0x5bfcdb=_[_0xa9f3('0x3f')]({},_0x5bfcdb,_0x4ee2b8[_0xa9f3('0x41')]);return db['FaxQueueReport'][_0xa9f3('0x47')](_0x5bfcdb)['then'](handleEntityNotFound(_0x9cca35,null))[_0xa9f3('0x23')](respondWithResult(_0x9cca35,null))[_0xa9f3('0x45')](handleError(_0x9cca35,null));};exports[_0xa9f3('0x48')]=function(_0x59fedb,_0x2719e5){return db[_0xa9f3('0x2c')][_0xa9f3('0x48')](_0x59fedb['body'],{})['then'](respondWithResult(_0x2719e5,0xc9))[_0xa9f3('0x45')](handleError(_0x2719e5,null));};exports[_0xa9f3('0x22')]=function(_0x1800d5,_0x5c3adb){if(_0x1800d5['body']['id']){delete _0x1800d5[_0xa9f3('0x49')]['id'];}return db[_0xa9f3('0x2c')]['find']({'where':{'id':_0x1800d5[_0xa9f3('0x4a')]['id']}})[_0xa9f3('0x23')](handleEntityNotFound(_0x5c3adb,null))[_0xa9f3('0x23')](saveUpdates(_0x1800d5[_0xa9f3('0x49')],null))[_0xa9f3('0x23')](respondWithResult(_0x5c3adb,null))[_0xa9f3('0x45')](handleError(_0x5c3adb,null));};exports['destroy']=function(_0x4707e7,_0x35222c){return db['FaxQueueReport']['find']({'where':{'id':_0x4707e7[_0xa9f3('0x4a')]['id']}})[_0xa9f3('0x23')](handleEntityNotFound(_0x35222c,null))['then'](removeEntity(_0x35222c,null))['catch'](handleError(_0x35222c,null));};exports['describe']=function(_0x141398,_0x43fee4){return db[_0xa9f3('0x2c')][_0xa9f3('0x4b')]()[_0xa9f3('0x23')](respondWithResult(_0x43fee4,null))[_0xa9f3('0x45')](handleError(_0x43fee4,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index cc1ad27..c9c5bff 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 _0x8d30=['report_fax_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport'];(function(_0x45a945,_0x2e8b66){var _0x403af5=function(_0x3a1c80){while(--_0x3a1c80){_0x45a945['push'](_0x45a945['shift']());}};_0x403af5(++_0x2e8b66);}(_0x8d30,0x89));var _0x08d3=function(_0x1fd4d7,_0x2feafd){_0x1fd4d7=_0x1fd4d7-0x0;var _0x7efe8a=_0x8d30[_0x1fd4d7];return _0x7efe8a;};'use strict';var _=require(_0x08d3('0x0'));var util=require(_0x08d3('0x1'));var logger=require(_0x08d3('0x2'))(_0x08d3('0x3'));var moment=require(_0x08d3('0x4'));var BPromise=require('bluebird');var rp=require(_0x08d3('0x5'));var fs=require('fs');var path=require(_0x08d3('0x6'));var rimraf=require(_0x08d3('0x7'));var config=require(_0x08d3('0x8'));var attributes=require(_0x08d3('0x9'));module[_0x08d3('0xa')]=function(_0x53d52a,_0xea8e0e){return _0x53d52a[_0x08d3('0xb')](_0x08d3('0xc'),attributes,{'tableName':_0x08d3('0xd'),'paranoid':![],'indexes':[{'name':_0x08d3('0xe'),'fields':[_0x08d3('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1dae=['exports','define','FaxQueueReport','report_fax_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x402731,_0x43c115){var _0x111736=function(_0x5a7044){while(--_0x5a7044){_0x402731['push'](_0x402731['shift']());}};_0x111736(++_0x43c115);}(_0x1dae,0xae));var _0xe1da=function(_0x5a9f67,_0x16608a){_0x5a9f67=_0x5a9f67-0x0;var _0x1e094e=_0x1dae[_0x5a9f67];return _0x1e094e;};'use strict';var _=require('lodash');var util=require(_0xe1da('0x0'));var logger=require(_0xe1da('0x1'))(_0xe1da('0x2'));var moment=require(_0xe1da('0x3'));var BPromise=require(_0xe1da('0x4'));var rp=require(_0xe1da('0x5'));var fs=require('fs');var path=require(_0xe1da('0x6'));var rimraf=require(_0xe1da('0x7'));var config=require('../../config/environment');var attributes=require('./faxQueueReport.attributes');module[_0xe1da('0x8')]=function(_0x1724b9,_0x9647e9){return _0x1724b9[_0xe1da('0x9')](_0xe1da('0xa'),attributes,{'tableName':_0xe1da('0xb'),'paranoid':![],'indexes':[{'name':_0xe1da('0xc'),'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 3c98fcb..3dc2a3a 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 _0x4b52=['then','UpdateFaxQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','body','options','update','raw','where','attributes','limit'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x4b52,0xf0));var _0x24b5=function(_0x225716,_0x545874){_0x225716=_0x225716-0x0;var _0x32c960=_0x4b52[_0x225716];return _0x32c960;};'use strict';var _=require(_0x24b5('0x0'));var util=require(_0x24b5('0x1'));var moment=require(_0x24b5('0x2'));var BPromise=require('bluebird');var rs=require(_0x24b5('0x3'));var fs=require('fs');var Redis=require(_0x24b5('0x4'));var db=require(_0x24b5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x24b5('0x6'))(_0x24b5('0x7'));var config=require('../../config/environment');var jayson=require(_0x24b5('0x8'));var client=jayson[_0x24b5('0x9')][_0x24b5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2af0a7,_0x3498b0,_0x1ab17a){return new BPromise(function(_0x526ee3,_0x7d3693){return client[_0x24b5('0xb')](_0x2af0a7,_0x1ab17a)['then'](function(_0x1469b0){logger[_0x24b5('0xc')]('FaxQueueReport,\x20%s,\x20%s',_0x3498b0,_0x24b5('0xd'));logger[_0x24b5('0xe')](_0x24b5('0xf'),_0x3498b0,_0x24b5('0xd'),JSON[_0x24b5('0x10')](_0x1469b0));if(_0x1469b0[_0x24b5('0x11')]){if(_0x1469b0[_0x24b5('0x11')][_0x24b5('0x12')]===0x1f4){logger[_0x24b5('0x11')](_0x24b5('0x13'),_0x3498b0,_0x1469b0[_0x24b5('0x11')]['message']);return _0x7d3693(_0x1469b0[_0x24b5('0x11')][_0x24b5('0x14')]);}logger[_0x24b5('0x11')](_0x24b5('0x13'),_0x3498b0,_0x1469b0[_0x24b5('0x11')][_0x24b5('0x14')]);return _0x526ee3(_0x1469b0[_0x24b5('0x11')][_0x24b5('0x14')]);}else{logger[_0x24b5('0xc')](_0x24b5('0x13'),_0x3498b0,'request\x20sent');_0x526ee3(_0x1469b0[_0x24b5('0x15')][_0x24b5('0x14')]);}})[_0x24b5('0x16')](function(_0x555bbb){logger[_0x24b5('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x3498b0,_0x555bbb);_0x7d3693(_0x555bbb);});});}exports[_0x24b5('0x17')]=function(_0x1f8634){var _0x392ece=this;return new Promise(function(_0x2c62fe,_0x1c1356){return db[_0x24b5('0x18')]['create'](_0x1f8634[_0x24b5('0x19')],{'raw':_0x1f8634[_0x24b5('0x1a')]?_0x1f8634[_0x24b5('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2b2b2c){logger[_0x24b5('0xc')](_0x24b5('0x17'),_0x1f8634);logger['debug'](_0x24b5('0x17'),_0x1f8634,JSON[_0x24b5('0x10')](_0x2b2b2c));_0x2c62fe(_0x2b2b2c);})['catch'](function(_0x1204c2){logger[_0x24b5('0x11')](_0x24b5('0x17'),_0x1204c2[_0x24b5('0x14')],_0x1f8634);_0x1c1356(_0x392ece[_0x24b5('0x11')](0x1f4,_0x1204c2[_0x24b5('0x14')]));});});};exports['UpdateFaxQueueReport']=function(_0x383b0a){var _0xfcd0f3=this;return new Promise(function(_0x28a92d,_0x168cba){return db['FaxQueueReport'][_0x24b5('0x1b')](_0x383b0a[_0x24b5('0x19')],{'raw':_0x383b0a[_0x24b5('0x1a')]?_0x383b0a[_0x24b5('0x1a')][_0x24b5('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x383b0a[_0x24b5('0x1a')]?_0x383b0a['options'][_0x24b5('0x1d')]||null:null,'attributes':_0x383b0a['options']?_0x383b0a[_0x24b5('0x1a')][_0x24b5('0x1e')]||null:null,'limit':_0x383b0a[_0x24b5('0x1a')]?_0x383b0a[_0x24b5('0x1a')][_0x24b5('0x1f')]||null:null})[_0x24b5('0x20')](function(_0x4652d3){logger[_0x24b5('0xc')]('UpdateFaxQueueReport',_0x383b0a);logger[_0x24b5('0xe')](_0x24b5('0x21'),_0x383b0a,JSON['stringify'](_0x4652d3));_0x28a92d(_0x4652d3);})[_0x24b5('0x16')](function(_0x1c124e){logger['error'](_0x24b5('0x21'),_0x1c124e[_0x24b5('0x14')],_0x383b0a);_0x168cba(_0xfcd0f3['error'](0x1f4,_0x1c124e[_0x24b5('0x14')]));});});}; \ No newline at end of file +var _0xc77b=['FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateFaxQueueReport','FaxQueueReport','create','options','debug','catch','UpdateFaxQueueReport','update','raw','where','attributes','limit','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x59a591,_0xc9132b){var _0x325ff9=function(_0x1e06f5){while(--_0x1e06f5){_0x59a591['push'](_0x59a591['shift']());}};_0x325ff9(++_0xc9132b);}(_0xc77b,0x1df));var _0xbc77=function(_0x4827e5,_0x75a2d2){_0x4827e5=_0x4827e5-0x0;var _0x3ed52a=_0xc77b[_0x4827e5];return _0x3ed52a;};'use strict';var _=require(_0xbc77('0x0'));var util=require('util');var moment=require(_0xbc77('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbc77('0x2'));var db=require(_0xbc77('0x3'))['db'];var utils=require(_0xbc77('0x4'));var logger=require(_0xbc77('0x5'))(_0xbc77('0x6'));var config=require(_0xbc77('0x7'));var jayson=require(_0xbc77('0x8'));var client=jayson[_0xbc77('0x9')][_0xbc77('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b77ff,_0x12d3b8,_0x2a0530){return new BPromise(function(_0x230939,_0x1e8b70){return client[_0xbc77('0xb')](_0x3b77ff,_0x2a0530)[_0xbc77('0xc')](function(_0x82f993){logger[_0xbc77('0xd')](_0xbc77('0xe'),_0x12d3b8,_0xbc77('0xf'));logger['debug'](_0xbc77('0x10'),_0x12d3b8,_0xbc77('0xf'),JSON[_0xbc77('0x11')](_0x82f993));if(_0x82f993[_0xbc77('0x12')]){if(_0x82f993['error'][_0xbc77('0x13')]===0x1f4){logger['error'](_0xbc77('0xe'),_0x12d3b8,_0x82f993[_0xbc77('0x12')]['message']);return _0x1e8b70(_0x82f993['error'][_0xbc77('0x14')]);}logger[_0xbc77('0x12')](_0xbc77('0xe'),_0x12d3b8,_0x82f993[_0xbc77('0x12')][_0xbc77('0x14')]);return _0x230939(_0x82f993[_0xbc77('0x12')][_0xbc77('0x14')]);}else{logger[_0xbc77('0xd')](_0xbc77('0xe'),_0x12d3b8,_0xbc77('0xf'));_0x230939(_0x82f993['result'][_0xbc77('0x14')]);}})['catch'](function(_0x64a72c){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x12d3b8,_0x64a72c);_0x1e8b70(_0x64a72c);});});}exports[_0xbc77('0x15')]=function(_0x4ab589){var _0x365fb9=this;return new Promise(function(_0x48ae87,_0x255ecb){return db[_0xbc77('0x16')][_0xbc77('0x17')](_0x4ab589['body'],{'raw':_0x4ab589[_0xbc77('0x18')]?_0x4ab589[_0xbc77('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xbc77('0xc')](function(_0xa95015){logger[_0xbc77('0xd')](_0xbc77('0x15'),_0x4ab589);logger[_0xbc77('0x19')](_0xbc77('0x15'),_0x4ab589,JSON[_0xbc77('0x11')](_0xa95015));_0x48ae87(_0xa95015);})[_0xbc77('0x1a')](function(_0x22c076){logger[_0xbc77('0x12')](_0xbc77('0x15'),_0x22c076[_0xbc77('0x14')],_0x4ab589);_0x255ecb(_0x365fb9[_0xbc77('0x12')](0x1f4,_0x22c076[_0xbc77('0x14')]));});});};exports[_0xbc77('0x1b')]=function(_0x5e9f41){var _0xc0f03b=this;return new Promise(function(_0x5b306a,_0x670aed){return db[_0xbc77('0x16')][_0xbc77('0x1c')](_0x5e9f41['body'],{'raw':_0x5e9f41[_0xbc77('0x18')]?_0x5e9f41[_0xbc77('0x18')][_0xbc77('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e9f41[_0xbc77('0x18')]?_0x5e9f41['options'][_0xbc77('0x1e')]||null:null,'attributes':_0x5e9f41[_0xbc77('0x18')]?_0x5e9f41[_0xbc77('0x18')][_0xbc77('0x1f')]||null:null,'limit':_0x5e9f41['options']?_0x5e9f41['options'][_0xbc77('0x20')]||null:null})[_0xbc77('0xc')](function(_0xe8354e){logger[_0xbc77('0xd')](_0xbc77('0x1b'),_0x5e9f41);logger[_0xbc77('0x19')](_0xbc77('0x1b'),_0x5e9f41,JSON[_0xbc77('0x11')](_0xe8354e));_0x5b306a(_0xe8354e);})[_0xbc77('0x1a')](function(_0xb0c2b8){logger[_0xbc77('0x12')]('UpdateFaxQueueReport',_0xb0c2b8[_0xbc77('0x14')],_0x5e9f41);_0x670aed(_0xc0f03b['error'](0x1f4,_0xb0c2b8[_0xbc77('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 2ab3266..65fc522 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 _0x0885=['express','Router','../../components/auth/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','multer','path','connect-timeout'];(function(_0x6dfbaa,_0x31eede){var _0xfbe02=function(_0x4adcaf){while(--_0x4adcaf){_0x6dfbaa['push'](_0x6dfbaa['shift']());}};_0xfbe02(++_0x31eede);}(_0x0885,0x69));var _0x5088=function(_0x177e72,_0x28bf32){_0x177e72=_0x177e72-0x0;var _0x392698=_0x0885[_0x177e72];return _0x392698;};'use strict';var multer=require(_0x5088('0x0'));var util=require('util');var path=require(_0x5088('0x1'));var timeout=require(_0x5088('0x2'));var express=require(_0x5088('0x3'));var router=express[_0x5088('0x4')]();var auth=require(_0x5088('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5088('0x6'));router[_0x5088('0x7')]('/',auth[_0x5088('0x8')](),controller[_0x5088('0x9')]);router[_0x5088('0x7')](_0x5088('0xa'),auth[_0x5088('0x8')](),controller[_0x5088('0xb')]);router['get'](_0x5088('0xc'),auth[_0x5088('0x8')](),controller[_0x5088('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5088('0xe')]);router[_0x5088('0xf')](_0x5088('0xc'),auth[_0x5088('0x8')](),controller['update']);router[_0x5088('0x10')](_0x5088('0xc'),auth[_0x5088('0x8')](),controller[_0x5088('0x11')]);module['exports']=router; \ No newline at end of file +var _0xd674=['/:id','show','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x4fe923,_0x216633){var _0x2bc871=function(_0xce4ac0){while(--_0xce4ac0){_0x4fe923['push'](_0x4fe923['shift']());}};_0x2bc871(++_0x216633);}(_0xd674,0x12f));var _0x4d67=function(_0x7d5ac7,_0x29f59d){_0x7d5ac7=_0x7d5ac7-0x0;var _0x417cf9=_0xd674[_0x7d5ac7];return _0x417cf9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4d67('0x0'));var timeout=require(_0x4d67('0x1'));var express=require(_0x4d67('0x2'));var router=express[_0x4d67('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4d67('0x4'));var config=require(_0x4d67('0x5'));var controller=require(_0x4d67('0x6'));router[_0x4d67('0x7')]('/',auth[_0x4d67('0x8')](),controller[_0x4d67('0x9')]);router[_0x4d67('0x7')](_0x4d67('0xa'),auth[_0x4d67('0x8')](),controller[_0x4d67('0xb')]);router[_0x4d67('0x7')](_0x4d67('0xc'),auth[_0x4d67('0x8')](),controller[_0x4d67('0xd')]);router[_0x4d67('0xe')]('/',auth[_0x4d67('0x8')](),controller[_0x4d67('0xf')]);router[_0x4d67('0x10')]('/:id',auth[_0x4d67('0x8')](),controller[_0x4d67('0x11')]);router[_0x4d67('0x12')](_0x4d67('0xc'),auth[_0x4d67('0x8')](),controller[_0x4d67('0x13')]);module[_0x4d67('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index d2423bd..29aad1a 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 _0xff30=['NOW','moment','sequelize','exports','ENUM','account','agent','queue'];(function(_0x146dd7,_0x4d877d){var _0x2af0bb=function(_0x2327bc){while(--_0x2327bc){_0x146dd7['push'](_0x146dd7['shift']());}};_0x2af0bb(++_0x4d877d);}(_0xff30,0x1a1));var _0x0ff3=function(_0x450e9d,_0x46538a){_0x450e9d=_0x450e9d-0x0;var _0x6672cf=_0xff30[_0x450e9d];return _0x6672cf;};'use strict';var moment=require(_0x0ff3('0x0'));var Sequelize=require(_0x0ff3('0x1'));module[_0x0ff3('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0ff3('0x3')](_0x0ff3('0x4'),_0x0ff3('0x5'),_0x0ff3('0x6')),'allowNull':![],'defaultValue':_0x0ff3('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x0ff3('0x7')]}}; \ No newline at end of file +var _0xabf1=['agent','queue','DATE','NOW','sequelize','exports','STRING','ENUM','account'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xabf1,0xee));var _0x1abf=function(_0x4009c4,_0x3f7222){_0x4009c4=_0x4009c4-0x0;var _0x4e8ef7=_0xabf1[_0x4009c4];return _0x4e8ef7;};'use strict';var moment=require('moment');var Sequelize=require(_0x1abf('0x0'));module[_0x1abf('0x1')]={'uniqueid':{'type':Sequelize[_0x1abf('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x1abf('0x3')](_0x1abf('0x4'),_0x1abf('0x5'),_0x1abf('0x6')),'allowNull':![],'defaultValue':_0x1abf('0x6')},'transferredAt':{'type':Sequelize[_0x1abf('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x1abf('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index eb16450..5cb3b8a 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 _0x5419=['create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','count','offset','limit','json','reject','save','update','then','destroy','sendStatus','stack','name','index','map','FaxTransferReport','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','rawAttributes','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5419,0x175));var _0x9541=function(_0xd6aad,_0x3fd78e){_0xd6aad=_0xd6aad-0x0;var _0x1109e6=_0x5419[_0xd6aad];return _0x1109e6;};'use strict';var pdf=require(_0x9541('0x0'));var emlformat=require(_0x9541('0x1'));var rimraf=require(_0x9541('0x2'));var zipdir=require(_0x9541('0x3'));var jsonpatch=require(_0x9541('0x4'));var rp=require(_0x9541('0x5'));var moment=require(_0x9541('0x6'));var BPromise=require(_0x9541('0x7'));var Mustache=require(_0x9541('0x8'));var util=require(_0x9541('0x9'));var path=require('path');var sox=require(_0x9541('0xa'));var csv=require(_0x9541('0xb'));var ejs=require(_0x9541('0xc'));var fs=require('fs');var _=require(_0x9541('0xd'));var squel=require(_0x9541('0xe'));var crypto=require(_0x9541('0xf'));var jsforce=require(_0x9541('0x10'));var deskjs=require(_0x9541('0x11'));var toCsv=require('to-csv');var querystring=require(_0x9541('0x12'));var Papa=require('papaparse');var Redis=require(_0x9541('0x13'));var authService=require(_0x9541('0x14'));var qs=require(_0x9541('0x15'));var as=require(_0x9541('0x16'));var hardwareService=require(_0x9541('0x17'));var logger=require(_0x9541('0x18'))(_0x9541('0x19'));var utils=require('../../config/utils');var config=require(_0x9541('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x75669e,_0x4f97a9){_0x4f97a9=_0x4f97a9||0xcc;return function(_0x40cc60){if(_0x40cc60){return _0x75669e['sendStatus'](_0x4f97a9);}return _0x75669e[_0x9541('0x1b')](_0x4f97a9)[_0x9541('0x1c')]();};}function respondWithResult(_0x1ffa34,_0x38ab15){_0x38ab15=_0x38ab15||0xc8;return function(_0x28316e){if(_0x28316e){return _0x1ffa34[_0x9541('0x1b')](_0x38ab15)['json'](_0x28316e);}};}function respondWithFilteredResult(_0x37a48e,_0x548cdc){return function(_0x64b64a){if(_0x64b64a){var _0x569b6d=_0x64b64a[_0x9541('0x1d')],_0x421985=_0x548cdc[_0x9541('0x1e')],_0x5ad2f5=_0x548cdc[_0x9541('0x1e')]+_0x548cdc[_0x9541('0x1f')],_0x92ca2f;if(_0x5ad2f5>=_0x569b6d){_0x5ad2f5=_0x569b6d;_0x92ca2f=0xc8;}else{_0x92ca2f=0xce;}_0x37a48e[_0x9541('0x1b')](_0x92ca2f);return _0x37a48e['set']('Content-Range',_0x421985+'-'+_0x5ad2f5+'/'+_0x569b6d)[_0x9541('0x20')](_0x64b64a);}return null;};}function patchUpdates(_0x24eaac){return function(_0x594ba4){try{jsonpatch['apply'](_0x594ba4,_0x24eaac,!![]);}catch(_0x2aafdb){return BPromise[_0x9541('0x21')](_0x2aafdb);}return _0x594ba4[_0x9541('0x22')]();};}function saveUpdates(_0xc6683a,_0xfbcffc){return function(_0x1a9f55){if(_0x1a9f55){return _0x1a9f55[_0x9541('0x23')](_0xc6683a)[_0x9541('0x24')](function(_0x30f965){return _0x30f965;});}return null;};}function removeEntity(_0x1f2d91,_0x43bb4c){return function(_0x54a827){if(_0x54a827){return _0x54a827[_0x9541('0x25')]()[_0x9541('0x24')](function(){_0x1f2d91[_0x9541('0x1b')](0xcc)[_0x9541('0x1c')]();});}};}function handleEntityNotFound(_0x101374,_0x2f6b0a){return function(_0x1b5adb){if(!_0x1b5adb){_0x101374[_0x9541('0x26')](0x194);}return _0x1b5adb;};}function handleError(_0x152361,_0x53100a){_0x53100a=_0x53100a||0x1f4;return function(_0x35ec2c){logger['error'](_0x35ec2c[_0x9541('0x27')]);if(_0x35ec2c[_0x9541('0x28')]){delete _0x35ec2c[_0x9541('0x28')];}_0x152361[_0x9541('0x1b')](_0x53100a)['send'](_0x35ec2c);};}exports[_0x9541('0x29')]=function(_0x46ea7e,_0x4f5602){var _0x3750f6={},_0x51b328={},_0x125d52={'count':0x0,'rows':[]};var _0x56645d=_[_0x9541('0x2a')](db[_0x9541('0x2b')]['rawAttributes'],function(_0xf82d59){return{'name':_0xf82d59[_0x9541('0x2c')],'type':_0xf82d59['type'][_0x9541('0x2d')]};});_0x51b328[_0x9541('0x2e')]=_['map'](_0x56645d,_0x9541('0x28'));_0x51b328['query']=_[_0x9541('0x2f')](_0x46ea7e[_0x9541('0x30')]);_0x51b328[_0x9541('0x31')]=_[_0x9541('0x32')](_0x51b328[_0x9541('0x2e')],_0x51b328[_0x9541('0x30')]);_0x3750f6[_0x9541('0x33')]=_['intersection'](_0x51b328[_0x9541('0x2e')],qs[_0x9541('0x34')](_0x46ea7e[_0x9541('0x30')][_0x9541('0x34')]));_0x3750f6[_0x9541('0x33')]=_0x3750f6[_0x9541('0x33')][_0x9541('0x35')]?_0x3750f6[_0x9541('0x33')]:_0x51b328[_0x9541('0x2e')];if(!_0x46ea7e[_0x9541('0x30')][_0x9541('0x36')](_0x9541('0x37'))){_0x3750f6[_0x9541('0x1f')]=qs[_0x9541('0x1f')](_0x46ea7e[_0x9541('0x30')][_0x9541('0x1f')]);_0x3750f6[_0x9541('0x1e')]=qs[_0x9541('0x1e')](_0x46ea7e[_0x9541('0x30')][_0x9541('0x1e')]);}_0x3750f6['order']=qs[_0x9541('0x38')](_0x46ea7e['query']['sort']);_0x3750f6['where']=qs['filters'](_[_0x9541('0x39')](_0x46ea7e[_0x9541('0x30')],_0x51b328[_0x9541('0x31')]),_0x56645d);if(_0x46ea7e['query'][_0x9541('0x3a')]){_0x3750f6[_0x9541('0x3b')]=_['merge'](_0x3750f6[_0x9541('0x3b')],{'$or':_[_0x9541('0x2a')](_0x56645d,function(_0xfdca53){if(_0xfdca53[_0x9541('0x3c')]!==_0x9541('0x3d')){var _0x2da830={};_0x2da830[_0xfdca53[_0x9541('0x28')]]={'$like':'%'+_0x46ea7e[_0x9541('0x30')][_0x9541('0x3a')]+'%'};return _0x2da830;}})});}_0x3750f6=_[_0x9541('0x3e')]({},_0x3750f6,_0x46ea7e['options']);var _0x4d48c0={'where':_0x3750f6[_0x9541('0x3b')]};return db[_0x9541('0x2b')][_0x9541('0x1d')](_0x4d48c0)[_0x9541('0x24')](function(_0x15eeee){_0x125d52[_0x9541('0x1d')]=_0x15eeee;if(_0x46ea7e[_0x9541('0x30')][_0x9541('0x3f')]){_0x3750f6[_0x9541('0x40')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x9541('0x41')](_0x3750f6);})['then'](function(_0x9af222){_0x125d52[_0x9541('0x42')]=_0x9af222;return _0x125d52;})[_0x9541('0x24')](respondWithFilteredResult(_0x4f5602,_0x3750f6))[_0x9541('0x43')](handleError(_0x4f5602,null));};exports['show']=function(_0x3c6868,_0x2b4b85){var _0x431865={'raw':!![],'where':{'id':_0x3c6868[_0x9541('0x44')]['id']}},_0x1f8d40={};_0x1f8d40[_0x9541('0x2e')]=_[_0x9541('0x2f')](db[_0x9541('0x2b')][_0x9541('0x45')]);_0x1f8d40['query']=_['keys'](_0x3c6868[_0x9541('0x30')]);_0x1f8d40[_0x9541('0x31')]=_[_0x9541('0x32')](_0x1f8d40['model'],_0x1f8d40[_0x9541('0x30')]);_0x431865['attributes']=_[_0x9541('0x32')](_0x1f8d40['model'],qs[_0x9541('0x34')](_0x3c6868[_0x9541('0x30')][_0x9541('0x34')]));_0x431865[_0x9541('0x33')]=_0x431865['attributes'][_0x9541('0x35')]?_0x431865[_0x9541('0x33')]:_0x1f8d40[_0x9541('0x2e')];if(_0x3c6868['query'][_0x9541('0x3f')]){_0x431865[_0x9541('0x40')]=[{'all':!![]}];}_0x431865=_[_0x9541('0x3e')]({},_0x431865,_0x3c6868[_0x9541('0x46')]);return db['FaxTransferReport']['find'](_0x431865)['then'](handleEntityNotFound(_0x2b4b85,null))['then'](respondWithResult(_0x2b4b85,null))[_0x9541('0x43')](handleError(_0x2b4b85,null));};exports[_0x9541('0x47')]=function(_0x3681b9,_0x38d9fa){return db[_0x9541('0x2b')]['create'](_0x3681b9[_0x9541('0x48')],{})[_0x9541('0x24')](respondWithResult(_0x38d9fa,0xc9))[_0x9541('0x43')](handleError(_0x38d9fa,null));};exports['update']=function(_0x4f892f,_0xa8051c){if(_0x4f892f[_0x9541('0x48')]['id']){delete _0x4f892f[_0x9541('0x48')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x4f892f[_0x9541('0x44')]['id']}})[_0x9541('0x24')](handleEntityNotFound(_0xa8051c,null))[_0x9541('0x24')](saveUpdates(_0x4f892f[_0x9541('0x48')],null))[_0x9541('0x24')](respondWithResult(_0xa8051c,null))[_0x9541('0x43')](handleError(_0xa8051c,null));};exports[_0x9541('0x25')]=function(_0x4e5266,_0x278a07){return db[_0x9541('0x2b')]['find']({'where':{'id':_0x4e5266['params']['id']}})[_0x9541('0x24')](handleEntityNotFound(_0x278a07,null))[_0x9541('0x24')](removeEntity(_0x278a07,null))[_0x9541('0x43')](handleError(_0x278a07,null));};exports[_0x9541('0x49')]=function(_0x2569b5,_0x164724){return db[_0x9541('0x2b')]['describe']()['then'](respondWithResult(_0x164724,null))[_0x9541('0x43')](handleError(_0x164724,null));}; \ No newline at end of file +var _0xe292=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','create','body','find','params','describe','rimraf','zip-dir','moment','bluebird','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x249463,_0xd88c2e){var _0x5d9ec1=function(_0x3c57a3){while(--_0x3c57a3){_0x249463['push'](_0x249463['shift']());}};_0x5d9ec1(++_0xd88c2e);}(_0xe292,0x19e));var _0x2e29=function(_0x21ad06,_0x1e015c){_0x21ad06=_0x21ad06-0x0;var _0x3d82e9=_0xe292[_0x21ad06];return _0x3d82e9;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x2e29('0x0'));var zipdir=require(_0x2e29('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2e29('0x2'));var BPromise=require(_0x2e29('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2e29('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2e29('0x5'));var fs=require('fs');var _=require(_0x2e29('0x6'));var squel=require(_0x2e29('0x7'));var crypto=require(_0x2e29('0x8'));var jsforce=require(_0x2e29('0x9'));var deskjs=require(_0x2e29('0xa'));var toCsv=require(_0x2e29('0xb'));var querystring=require(_0x2e29('0xc'));var Papa=require(_0x2e29('0xd'));var Redis=require(_0x2e29('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2e29('0xf'));var as=require(_0x2e29('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2e29('0x11'))(_0x2e29('0x12'));var utils=require(_0x2e29('0x13'));var config=require(_0x2e29('0x14'));var licenseUtil=require(_0x2e29('0x15'));var db=require(_0x2e29('0x16'))['db'];function respondWithStatusCode(_0x5aef56,_0x91d02){_0x91d02=_0x91d02||0xcc;return function(_0x3e1257){if(_0x3e1257){return _0x5aef56[_0x2e29('0x17')](_0x91d02);}return _0x5aef56[_0x2e29('0x18')](_0x91d02)[_0x2e29('0x19')]();};}function respondWithResult(_0x4f92c5,_0x4b79ad){_0x4b79ad=_0x4b79ad||0xc8;return function(_0x32344b){if(_0x32344b){return _0x4f92c5[_0x2e29('0x18')](_0x4b79ad)[_0x2e29('0x1a')](_0x32344b);}};}function respondWithFilteredResult(_0x615f4d,_0x22a196){return function(_0x5dbc41){if(_0x5dbc41){var _0x5e57c2=_0x5dbc41[_0x2e29('0x1b')],_0x231434=_0x22a196[_0x2e29('0x1c')],_0x4e6f42=_0x22a196[_0x2e29('0x1c')]+_0x22a196[_0x2e29('0x1d')],_0x4d249d;if(_0x4e6f42>=_0x5e57c2){_0x4e6f42=_0x5e57c2;_0x4d249d=0xc8;}else{_0x4d249d=0xce;}_0x615f4d[_0x2e29('0x18')](_0x4d249d);return _0x615f4d[_0x2e29('0x1e')](_0x2e29('0x1f'),_0x231434+'-'+_0x4e6f42+'/'+_0x5e57c2)['json'](_0x5dbc41);}return null;};}function patchUpdates(_0x5cdef4){return function(_0x3fb2a6){try{jsonpatch['apply'](_0x3fb2a6,_0x5cdef4,!![]);}catch(_0x125b95){return BPromise[_0x2e29('0x20')](_0x125b95);}return _0x3fb2a6[_0x2e29('0x21')]();};}function saveUpdates(_0x4c31d4,_0x5c4d4c){return function(_0x436ef0){if(_0x436ef0){return _0x436ef0[_0x2e29('0x22')](_0x4c31d4)[_0x2e29('0x23')](function(_0xc2314b){return _0xc2314b;});}return null;};}function removeEntity(_0x5c73c3,_0x16a485){return function(_0x1c3da0){if(_0x1c3da0){return _0x1c3da0[_0x2e29('0x24')]()[_0x2e29('0x23')](function(){_0x5c73c3[_0x2e29('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xee5a46,_0x47617c){return function(_0x234580){if(!_0x234580){_0xee5a46[_0x2e29('0x17')](0x194);}return _0x234580;};}function handleError(_0x32edc5,_0x367ddd){_0x367ddd=_0x367ddd||0x1f4;return function(_0x3a2713){logger[_0x2e29('0x25')](_0x3a2713[_0x2e29('0x26')]);if(_0x3a2713[_0x2e29('0x27')]){delete _0x3a2713[_0x2e29('0x27')];}_0x32edc5['status'](_0x367ddd)[_0x2e29('0x28')](_0x3a2713);};}exports[_0x2e29('0x29')]=function(_0x367dae,_0x2b49b2){var _0x22ec51={},_0x476e17={},_0x45a6dd={'count':0x0,'rows':[]};var _0x487e7a=_[_0x2e29('0x2a')](db[_0x2e29('0x2b')][_0x2e29('0x2c')],function(_0x21f812){return{'name':_0x21f812[_0x2e29('0x2d')],'type':_0x21f812[_0x2e29('0x2e')]['key']};});_0x476e17[_0x2e29('0x2f')]=_[_0x2e29('0x2a')](_0x487e7a,'name');_0x476e17[_0x2e29('0x30')]=_[_0x2e29('0x31')](_0x367dae['query']);_0x476e17[_0x2e29('0x32')]=_[_0x2e29('0x33')](_0x476e17[_0x2e29('0x2f')],_0x476e17[_0x2e29('0x30')]);_0x22ec51[_0x2e29('0x34')]=_['intersection'](_0x476e17[_0x2e29('0x2f')],qs[_0x2e29('0x35')](_0x367dae[_0x2e29('0x30')][_0x2e29('0x35')]));_0x22ec51[_0x2e29('0x34')]=_0x22ec51['attributes'][_0x2e29('0x36')]?_0x22ec51[_0x2e29('0x34')]:_0x476e17[_0x2e29('0x2f')];if(!_0x367dae[_0x2e29('0x30')][_0x2e29('0x37')]('nolimit')){_0x22ec51[_0x2e29('0x1d')]=qs[_0x2e29('0x1d')](_0x367dae['query'][_0x2e29('0x1d')]);_0x22ec51['offset']=qs[_0x2e29('0x1c')](_0x367dae['query'][_0x2e29('0x1c')]);}_0x22ec51['order']=qs['sort'](_0x367dae['query'][_0x2e29('0x38')]);_0x22ec51[_0x2e29('0x39')]=qs[_0x2e29('0x32')](_[_0x2e29('0x3a')](_0x367dae[_0x2e29('0x30')],_0x476e17[_0x2e29('0x32')]),_0x487e7a);if(_0x367dae[_0x2e29('0x30')][_0x2e29('0x3b')]){_0x22ec51[_0x2e29('0x39')]=_[_0x2e29('0x3c')](_0x22ec51[_0x2e29('0x39')],{'$or':_[_0x2e29('0x2a')](_0x487e7a,function(_0x463180){if(_0x463180[_0x2e29('0x2e')]!==_0x2e29('0x3d')){var _0x4cd20d={};_0x4cd20d[_0x463180[_0x2e29('0x27')]]={'$like':'%'+_0x367dae['query'][_0x2e29('0x3b')]+'%'};return _0x4cd20d;}})});}_0x22ec51=_['merge']({},_0x22ec51,_0x367dae[_0x2e29('0x3e')]);var _0x2d54dd={'where':_0x22ec51[_0x2e29('0x39')]};return db['FaxTransferReport'][_0x2e29('0x1b')](_0x2d54dd)[_0x2e29('0x23')](function(_0x61d31b){_0x45a6dd['count']=_0x61d31b;if(_0x367dae[_0x2e29('0x30')][_0x2e29('0x3f')]){_0x22ec51[_0x2e29('0x40')]=[{'all':!![]}];}return db[_0x2e29('0x2b')][_0x2e29('0x41')](_0x22ec51);})[_0x2e29('0x23')](function(_0x434b8b){_0x45a6dd['rows']=_0x434b8b;return _0x45a6dd;})[_0x2e29('0x23')](respondWithFilteredResult(_0x2b49b2,_0x22ec51))[_0x2e29('0x42')](handleError(_0x2b49b2,null));};exports['show']=function(_0x667cb1,_0x3951a5){var _0x4dc58d={'raw':!![],'where':{'id':_0x667cb1['params']['id']}},_0x7cd689={};_0x7cd689[_0x2e29('0x2f')]=_[_0x2e29('0x31')](db[_0x2e29('0x2b')][_0x2e29('0x2c')]);_0x7cd689[_0x2e29('0x30')]=_['keys'](_0x667cb1[_0x2e29('0x30')]);_0x7cd689[_0x2e29('0x32')]=_[_0x2e29('0x33')](_0x7cd689['model'],_0x7cd689[_0x2e29('0x30')]);_0x4dc58d[_0x2e29('0x34')]=_[_0x2e29('0x33')](_0x7cd689[_0x2e29('0x2f')],qs[_0x2e29('0x35')](_0x667cb1[_0x2e29('0x30')][_0x2e29('0x35')]));_0x4dc58d['attributes']=_0x4dc58d[_0x2e29('0x34')][_0x2e29('0x36')]?_0x4dc58d['attributes']:_0x7cd689[_0x2e29('0x2f')];if(_0x667cb1[_0x2e29('0x30')]['includeAll']){_0x4dc58d['include']=[{'all':!![]}];}_0x4dc58d=_[_0x2e29('0x3c')]({},_0x4dc58d,_0x667cb1[_0x2e29('0x3e')]);return db[_0x2e29('0x2b')]['find'](_0x4dc58d)[_0x2e29('0x23')](handleEntityNotFound(_0x3951a5,null))['then'](respondWithResult(_0x3951a5,null))['catch'](handleError(_0x3951a5,null));};exports[_0x2e29('0x43')]=function(_0x86a6e4,_0x3cde54){return db[_0x2e29('0x2b')][_0x2e29('0x43')](_0x86a6e4['body'],{})[_0x2e29('0x23')](respondWithResult(_0x3cde54,0xc9))[_0x2e29('0x42')](handleError(_0x3cde54,null));};exports[_0x2e29('0x22')]=function(_0x8db8b9,_0x280e3c){if(_0x8db8b9[_0x2e29('0x44')]['id']){delete _0x8db8b9[_0x2e29('0x44')]['id'];}return db[_0x2e29('0x2b')][_0x2e29('0x45')]({'where':{'id':_0x8db8b9[_0x2e29('0x46')]['id']}})[_0x2e29('0x23')](handleEntityNotFound(_0x280e3c,null))[_0x2e29('0x23')](saveUpdates(_0x8db8b9[_0x2e29('0x44')],null))[_0x2e29('0x23')](respondWithResult(_0x280e3c,null))['catch'](handleError(_0x280e3c,null));};exports[_0x2e29('0x24')]=function(_0x4084fe,_0x14d3fe){return db[_0x2e29('0x2b')][_0x2e29('0x45')]({'where':{'id':_0x4084fe[_0x2e29('0x46')]['id']}})['then'](handleEntityNotFound(_0x14d3fe,null))[_0x2e29('0x23')](removeEntity(_0x14d3fe,null))[_0x2e29('0x42')](handleError(_0x14d3fe,null));};exports[_0x2e29('0x47')]=function(_0xef9255,_0x4e32eb){return db['FaxTransferReport'][_0x2e29('0x47')]()[_0x2e29('0x23')](respondWithResult(_0x4e32eb,null))[_0x2e29('0x42')](handleError(_0x4e32eb,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 5f5ecd2..ca30565 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 _0xd742=['rimraf','../../config/environment','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','../../config/logger','bluebird','request-promise','path'];(function(_0x4ebf38,_0x574b87){var _0x38ff67=function(_0x381283){while(--_0x381283){_0x4ebf38['push'](_0x4ebf38['shift']());}};_0x38ff67(++_0x574b87);}(_0xd742,0x80));var _0x2d74=function(_0x38b24b,_0x5cd9be){_0x38b24b=_0x38b24b-0x0;var _0x4b1707=_0xd742[_0x38b24b];return _0x4b1707;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2d74('0x0'))('api');var moment=require('moment');var BPromise=require(_0x2d74('0x1'));var rp=require(_0x2d74('0x2'));var fs=require('fs');var path=require(_0x2d74('0x3'));var rimraf=require(_0x2d74('0x4'));var config=require(_0x2d74('0x5'));var attributes=require('./faxTransferReport.attributes');module[_0x2d74('0x6')]=function(_0x319ce4,_0x2ca047){return _0x319ce4[_0x2d74('0x7')](_0x2d74('0x8'),attributes,{'tableName':_0x2d74('0x9'),'paranoid':![],'indexes':[{'name':_0x2d74('0xa'),'fields':[_0x2d74('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x21f3=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x19d117,_0x23c786){var _0x4b4933=function(_0x1f289c){while(--_0x1f289c){_0x19d117['push'](_0x19d117['shift']());}};_0x4b4933(++_0x23c786);}(_0x21f3,0xfc));var _0x321f=function(_0x5214a8,_0x4edc9f){_0x5214a8=_0x5214a8-0x0;var _0x237724=_0x21f3[_0x5214a8];return _0x237724;};'use strict';var _=require(_0x321f('0x0'));var util=require(_0x321f('0x1'));var logger=require(_0x321f('0x2'))('api');var moment=require(_0x321f('0x3'));var BPromise=require(_0x321f('0x4'));var rp=require(_0x321f('0x5'));var fs=require('fs');var path=require(_0x321f('0x6'));var rimraf=require(_0x321f('0x7'));var config=require('../../config/environment');var attributes=require(_0x321f('0x8'));module[_0x321f('0x9')]=function(_0x6b63cf,_0x4caf62){return _0x6b63cf[_0x321f('0xa')](_0x321f('0xb'),attributes,{'tableName':_0x321f('0xc'),'paranoid':![],'indexes':[{'name':_0x321f('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 7dc1d88..3ce9eb6 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 _0xdde6=['error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x19eb43,_0x10c355){var _0x57598c=function(_0x1d32c6){while(--_0x1d32c6){_0x19eb43['push'](_0x19eb43['shift']());}};_0x57598c(++_0x10c355);}(_0xdde6,0xab));var _0x6dde=function(_0x29fc9a,_0x4d0670){_0x29fc9a=_0x29fc9a-0x0;var _0x34d338=_0xdde6[_0x29fc9a];return _0x34d338;};'use strict';var _=require(_0x6dde('0x0'));var util=require(_0x6dde('0x1'));var moment=require(_0x6dde('0x2'));var BPromise=require(_0x6dde('0x3'));var rs=require(_0x6dde('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6dde('0x5'))['db'];var utils=require(_0x6dde('0x6'));var logger=require(_0x6dde('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6dde('0x8'));var client=jayson['client'][_0x6dde('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1987a,_0x5937e0,_0x3a2588){return new BPromise(function(_0x3c86eb,_0xcd27f8){return client[_0x6dde('0xa')](_0x1987a,_0x3a2588)[_0x6dde('0xb')](function(_0x2377c8){logger[_0x6dde('0xc')](_0x6dde('0xd'),_0x5937e0,_0x6dde('0xe'));logger[_0x6dde('0xf')](_0x6dde('0x10'),_0x5937e0,'request\x20sent',JSON[_0x6dde('0x11')](_0x2377c8));if(_0x2377c8[_0x6dde('0x12')]){if(_0x2377c8['error'][_0x6dde('0x13')]===0x1f4){logger[_0x6dde('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x5937e0,_0x2377c8[_0x6dde('0x12')][_0x6dde('0x14')]);return _0xcd27f8(_0x2377c8[_0x6dde('0x12')][_0x6dde('0x14')]);}logger['error'](_0x6dde('0xd'),_0x5937e0,_0x2377c8[_0x6dde('0x12')]['message']);return _0x3c86eb(_0x2377c8[_0x6dde('0x12')]['message']);}else{logger['info'](_0x6dde('0xd'),_0x5937e0,'request\x20sent');_0x3c86eb(_0x2377c8['result'][_0x6dde('0x14')]);}})['catch'](function(_0xda5b5b){logger[_0x6dde('0x12')](_0x6dde('0xd'),_0x5937e0,_0xda5b5b);_0xcd27f8(_0xda5b5b);});});} \ No newline at end of file +var _0xebe7=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','../../config/utils'];(function(_0x2953aa,_0x2d3ba1){var _0x556ec5=function(_0x4294a5){while(--_0x4294a5){_0x2953aa['push'](_0x2953aa['shift']());}};_0x556ec5(++_0x2d3ba1);}(_0xebe7,0x65));var _0x7ebe=function(_0x47616e,_0x4c968c){_0x47616e=_0x47616e-0x0;var _0x4b0bf9=_0xebe7[_0x47616e];return _0x4b0bf9;};'use strict';var _=require(_0x7ebe('0x0'));var util=require('util');var moment=require(_0x7ebe('0x1'));var BPromise=require(_0x7ebe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7ebe('0x3'));var logger=require(_0x7ebe('0x4'))('rpc');var config=require(_0x7ebe('0x5'));var jayson=require(_0x7ebe('0x6'));var client=jayson[_0x7ebe('0x7')][_0x7ebe('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14135d,_0x31808e,_0xf8fe6c){return new BPromise(function(_0x38cbbf,_0x51acac){return client[_0x7ebe('0x9')](_0x14135d,_0xf8fe6c)[_0x7ebe('0xa')](function(_0x269d10){logger[_0x7ebe('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x31808e,_0x7ebe('0xc'));logger[_0x7ebe('0xd')](_0x7ebe('0xe'),_0x31808e,_0x7ebe('0xc'),JSON['stringify'](_0x269d10));if(_0x269d10[_0x7ebe('0xf')]){if(_0x269d10[_0x7ebe('0xf')][_0x7ebe('0x10')]===0x1f4){logger[_0x7ebe('0xf')](_0x7ebe('0x11'),_0x31808e,_0x269d10['error'][_0x7ebe('0x12')]);return _0x51acac(_0x269d10[_0x7ebe('0xf')][_0x7ebe('0x12')]);}logger['error'](_0x7ebe('0x11'),_0x31808e,_0x269d10[_0x7ebe('0xf')][_0x7ebe('0x12')]);return _0x38cbbf(_0x269d10[_0x7ebe('0xf')][_0x7ebe('0x12')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x31808e,'request\x20sent');_0x38cbbf(_0x269d10[_0x7ebe('0x13')][_0x7ebe('0x12')]);}})[_0x7ebe('0x14')](function(_0x29f540){logger[_0x7ebe('0xf')](_0x7ebe('0x11'),_0x31808e,_0x29f540);_0x51acac(_0x29f540);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index a6ce45a..af4c3cc 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 _0xa289=['../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','describe','/:id','isAuthenticated','create','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x1098db,_0x39ba6b){var _0x14f090=function(_0x473ffe){while(--_0x473ffe){_0x1098db['push'](_0x1098db['shift']());}};_0x14f090(++_0x39ba6b);}(_0xa289,0x8a));var _0x9a28=function(_0x192217,_0x307c1d){_0x192217=_0x192217-0x0;var _0x21d529=_0xa289[_0x192217];return _0x21d529;};'use strict';var multer=require(_0x9a28('0x0'));var util=require(_0x9a28('0x1'));var path=require(_0x9a28('0x2'));var timeout=require(_0x9a28('0x3'));var express=require('express');var router=express[_0x9a28('0x4')]();var auth=require(_0x9a28('0x5'));var interaction=require(_0x9a28('0x6'));var config=require(_0x9a28('0x7'));var controller=require(_0x9a28('0x8'));router[_0x9a28('0x9')]('/',auth['isAuthenticated'](),controller[_0x9a28('0xa')]);router[_0x9a28('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x9a28('0xb')]);router[_0x9a28('0x9')](_0x9a28('0xc'),auth[_0x9a28('0xd')](),controller['show']);router['post']('/',auth[_0x9a28('0xd')](),controller[_0x9a28('0xe')]);router['put'](_0x9a28('0xc'),auth[_0x9a28('0xd')](),controller[_0x9a28('0xf')]);router[_0x9a28('0x10')](_0x9a28('0xc'),auth[_0x9a28('0xd')](),controller[_0x9a28('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6481=['show','post','create','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6481,0xa6));var _0x1648=function(_0x4b7150,_0x5c23df){_0x4b7150=_0x4b7150-0x0;var _0x298641=_0x6481[_0x4b7150];return _0x298641;};'use strict';var multer=require(_0x1648('0x0'));var util=require(_0x1648('0x1'));var path=require('path');var timeout=require(_0x1648('0x2'));var express=require(_0x1648('0x3'));var router=express[_0x1648('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1648('0x5'));var config=require(_0x1648('0x6'));var controller=require(_0x1648('0x7'));router[_0x1648('0x8')]('/',auth[_0x1648('0x9')](),controller[_0x1648('0xa')]);router[_0x1648('0x8')](_0x1648('0xb'),auth[_0x1648('0x9')](),controller[_0x1648('0xc')]);router[_0x1648('0x8')](_0x1648('0xd'),auth[_0x1648('0x9')](),controller[_0x1648('0xe')]);router[_0x1648('0xf')]('/',auth[_0x1648('0x9')](),controller[_0x1648('0x10')]);router['put']('/:id',auth[_0x1648('0x9')](),controller[_0x1648('0x11')]);router[_0x1648('0x12')](_0x1648('0xd'),auth[_0x1648('0x9')](),controller[_0x1648('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index c7ad776..6dd06ba 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 _0x934b=['multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','delete','destroy'];(function(_0x31a7a0,_0x1118b0){var _0x5674ed=function(_0x427271){while(--_0x427271){_0x31a7a0['push'](_0x31a7a0['shift']());}};_0x5674ed(++_0x1118b0);}(_0x934b,0x140));var _0xb934=function(_0x23e3b0,_0x5f2901){_0x23e3b0=_0x23e3b0-0x0;var _0x13c675=_0x934b[_0x23e3b0];return _0x13c675;};'use strict';var multer=require(_0xb934('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb934('0x1'));var express=require(_0xb934('0x2'));var router=express[_0xb934('0x3')]();var auth=require(_0xb934('0x4'));var interaction=require(_0xb934('0x5'));var config=require('../../config/environment');var controller=require(_0xb934('0x6'));router[_0xb934('0x7')]('/',auth[_0xb934('0x8')](),controller['index']);router[_0xb934('0x7')](_0xb934('0x9'),auth[_0xb934('0x8')](),controller[_0xb934('0xa')]);router[_0xb934('0x7')](_0xb934('0xb'),auth['isAuthenticated'](),controller[_0xb934('0xc')]);router[_0xb934('0x7')]('/:id/fields',auth[_0xb934('0x8')](),controller[_0xb934('0xd')]);router[_0xb934('0xe')]('/',auth[_0xb934('0x8')](),controller[_0xb934('0xf')]);router[_0xb934('0xe')]('/:id/configurations',auth[_0xb934('0x8')](),controller[_0xb934('0x10')]);router[_0xb934('0x11')]('/:id',auth[_0xb934('0x8')](),controller['update']);router[_0xb934('0x12')](_0xb934('0x9'),auth[_0xb934('0x8')](),controller[_0xb934('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf1cf=['getConfigurations','/:id/fields','getFields','post','create','put','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x2b1644,_0x1595f5){var _0x206fa1=function(_0x4262e9){while(--_0x4262e9){_0x2b1644['push'](_0x2b1644['shift']());}};_0x206fa1(++_0x1595f5);}(_0xf1cf,0x16d));var _0xff1c=function(_0x3849ff,_0x2be8dc){_0x3849ff=_0x3849ff-0x0;var _0x497340=_0xf1cf[_0x3849ff];return _0x497340;};'use strict';var multer=require(_0xff1c('0x0'));var util=require(_0xff1c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xff1c('0x2')]();var auth=require(_0xff1c('0x3'));var interaction=require(_0xff1c('0x4'));var config=require(_0xff1c('0x5'));var controller=require(_0xff1c('0x6'));router[_0xff1c('0x7')]('/',auth[_0xff1c('0x8')](),controller[_0xff1c('0x9')]);router[_0xff1c('0x7')](_0xff1c('0xa'),auth['isAuthenticated'](),controller[_0xff1c('0xb')]);router['get'](_0xff1c('0xc'),auth[_0xff1c('0x8')](),controller[_0xff1c('0xd')]);router[_0xff1c('0x7')](_0xff1c('0xe'),auth[_0xff1c('0x8')](),controller[_0xff1c('0xf')]);router[_0xff1c('0x10')]('/',auth[_0xff1c('0x8')](),controller[_0xff1c('0x11')]);router[_0xff1c('0x10')](_0xff1c('0xc'),auth[_0xff1c('0x8')](),controller['addConfiguration']);router[_0xff1c('0x12')](_0xff1c('0xa'),auth[_0xff1c('0x8')](),controller['update']);router['delete'](_0xff1c('0xa'),auth[_0xff1c('0x8')](),controller[_0xff1c('0x13')]);module[_0xff1c('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index ceaa11f..d01763f 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 _0xb299=['integrationTab','sequelize','STRING','ENUM','basic'];(function(_0x20621e,_0x520d54){var _0x843dde=function(_0x393703){while(--_0x393703){_0x20621e['push'](_0x20621e['shift']());}};_0x843dde(++_0x520d54);}(_0xb299,0x19b));var _0x9b29=function(_0x39f96b,_0xa6fd4d){_0x39f96b=_0x39f96b-0x0;var _0x24aa95=_0xb299[_0x39f96b];return _0x24aa95;};'use strict';var Sequelize=require(_0x9b29('0x0'));module['exports']={'name':{'type':Sequelize[_0x9b29('0x1')]},'description':{'type':Sequelize[_0x9b29('0x1')]},'username':{'type':Sequelize[_0x9b29('0x1')]},'remoteUri':{'type':Sequelize[_0x9b29('0x1')]},'authType':{'type':Sequelize[_0x9b29('0x2')](_0x9b29('0x3')),'defaultValue':_0x9b29('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x9b29('0x1')]},'consumerSecret':{'type':Sequelize[_0x9b29('0x1')]},'token':{'type':Sequelize[_0x9b29('0x1')]},'tokenSecret':{'type':Sequelize[_0x9b29('0x1')]},'serverUrl':{'type':Sequelize[_0x9b29('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x9b29('0x2')](_0x9b29('0x4'),'newTab'),'defaultValue':_0x9b29('0x4')}}; \ No newline at end of file +var _0x5a13=['integrationTab','newTab','exports','STRING','ENUM','basic'];(function(_0x16e874,_0x154da0){var _0x5460d4=function(_0x464262){while(--_0x464262){_0x16e874['push'](_0x16e874['shift']());}};_0x5460d4(++_0x154da0);}(_0x5a13,0x92));var _0x35a1=function(_0xabf905,_0x1fa06d){_0xabf905=_0xabf905-0x0;var _0x3ea606=_0x5a13[_0xabf905];return _0x3ea606;};'use strict';var Sequelize=require('sequelize');module[_0x35a1('0x0')]={'name':{'type':Sequelize[_0x35a1('0x1')]},'description':{'type':Sequelize[_0x35a1('0x1')]},'username':{'type':Sequelize[_0x35a1('0x1')]},'remoteUri':{'type':Sequelize[_0x35a1('0x1')]},'authType':{'type':Sequelize[_0x35a1('0x2')]('basic'),'defaultValue':_0x35a1('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x35a1('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x35a1('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x35a1('0x2')](_0x35a1('0x4'),_0x35a1('0x5')),'defaultValue':_0x35a1('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index f0fd401..da706d6 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 _0xa591=['rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','limit','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','fields','length','find','create','body','getConfigurations','findOne','params','order','pick','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','substring','lastIndexOf','format','%s/custom_fields','application/json','basic','headers','Authorization','%s:%s','toString','base64','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','DeskAccount'];(function(_0x59a1c9,_0x436f29){var _0x3cf1de=function(_0x1729f2){while(--_0x1729f2){_0x59a1c9['push'](_0x59a1c9['shift']());}};_0x3cf1de(++_0x436f29);}(_0xa591,0x141));var _0x1a59=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xa591[_0x2e4e19];return _0x9ba20b;};'use strict';var pdf=require(_0x1a59('0x0'));var emlformat=require(_0x1a59('0x1'));var rimraf=require(_0x1a59('0x2'));var zipdir=require(_0x1a59('0x3'));var jsonpatch=require(_0x1a59('0x4'));var rp=require(_0x1a59('0x5'));var moment=require(_0x1a59('0x6'));var BPromise=require(_0x1a59('0x7'));var Mustache=require(_0x1a59('0x8'));var util=require(_0x1a59('0x9'));var path=require(_0x1a59('0xa'));var sox=require('sox');var csv=require(_0x1a59('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1a59('0xc'));var jsforce=require(_0x1a59('0xd'));var deskjs=require(_0x1a59('0xe'));var toCsv=require(_0x1a59('0xb'));var querystring=require(_0x1a59('0xf'));var Papa=require(_0x1a59('0x10'));var Redis=require('ioredis');var authService=require(_0x1a59('0x11'));var qs=require(_0x1a59('0x12'));var as=require(_0x1a59('0x13'));var hardwareService=require(_0x1a59('0x14'));var logger=require(_0x1a59('0x15'))(_0x1a59('0x16'));var utils=require(_0x1a59('0x17'));var config=require(_0x1a59('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1a59('0x19'))['db'];var integrations=require(_0x1a59('0x1a'));var jayson=require(_0x1a59('0x1b'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2a60de,_0x42d727,_0x275f05,_0x135e7d){return new BPromise(function(_0x280912,_0x477d8b){var _0x109a76=_0x135e7d||client;return _0x109a76[_0x1a59('0x1c')](_0x2a60de,_0x275f05)[_0x1a59('0x1d')](function(_0x2383a1){logger[_0x1a59('0x1e')](_0x1a59('0x1f'),_0x42d727,_0x1a59('0x20'));logger['debug'](_0x1a59('0x21'),_0x42d727,'request\x20sent',JSON['stringify'](_0x2383a1));if(_0x2383a1[_0x1a59('0x22')]){if(_0x2383a1[_0x1a59('0x22')]['code']===0x1f4){logger[_0x1a59('0x22')]('DeskAccount,\x20%s,\x20%s',_0x42d727,_0x2383a1[_0x1a59('0x22')][_0x1a59('0x23')]);return _0x477d8b(_0x2383a1[_0x1a59('0x22')][_0x1a59('0x23')]);}logger[_0x1a59('0x22')](_0x1a59('0x1f'),_0x42d727,_0x2383a1[_0x1a59('0x22')][_0x1a59('0x23')]);return _0x280912(_0x2383a1[_0x1a59('0x22')]['message']);}else{logger['info'](_0x1a59('0x1f'),_0x42d727,_0x1a59('0x20'));_0x280912(_0x2383a1[_0x1a59('0x24')][_0x1a59('0x23')]);}})[_0x1a59('0x25')](function(_0x4970bf){logger[_0x1a59('0x22')](_0x1a59('0x1f'),_0x42d727,_0x4970bf);_0x477d8b(_0x4970bf);});});}function respondWithStatusCode(_0x50fbc3,_0x5255bc){_0x5255bc=_0x5255bc||0xcc;return function(_0x5d6652){if(_0x5d6652){return _0x50fbc3[_0x1a59('0x26')](_0x5255bc);}return _0x50fbc3[_0x1a59('0x27')](_0x5255bc)['end']();};}function respondWithResult(_0x15c1eb,_0x393493){_0x393493=_0x393493||0xc8;return function(_0x447b21){if(_0x447b21){return _0x15c1eb[_0x1a59('0x27')](_0x393493)[_0x1a59('0x28')](_0x447b21);}};}function respondWithFilteredResult(_0x267b5b,_0x4f34ad){return function(_0x33cd2d){if(_0x33cd2d){var _0x143113=_0x33cd2d[_0x1a59('0x29')],_0x4ac0b5=_0x4f34ad['offset'],_0x1abcbe=_0x4f34ad[_0x1a59('0x2a')]+_0x4f34ad['limit'],_0x22e375;if(_0x1abcbe>=_0x143113){_0x1abcbe=_0x143113;_0x22e375=0xc8;}else{_0x22e375=0xce;}_0x267b5b[_0x1a59('0x27')](_0x22e375);return _0x267b5b[_0x1a59('0x2b')](_0x1a59('0x2c'),_0x4ac0b5+'-'+_0x1abcbe+'/'+_0x143113)[_0x1a59('0x28')](_0x33cd2d);}return null;};}function patchUpdates(_0x149132){return function(_0xc6af59){try{jsonpatch[_0x1a59('0x2d')](_0xc6af59,_0x149132,!![]);}catch(_0x33b61b){return BPromise[_0x1a59('0x2e')](_0x33b61b);}return _0xc6af59[_0x1a59('0x2f')]();};}function saveUpdates(_0x2ec0c1,_0x4699b0){return function(_0x2941b2){if(_0x2941b2){return _0x2941b2[_0x1a59('0x30')](_0x2ec0c1)['then'](function(_0x48f5c3){return _0x48f5c3;});}return null;};}function removeEntity(_0x1cba68,_0x19768f){return function(_0x30a469){if(_0x30a469){return _0x30a469[_0x1a59('0x31')]()[_0x1a59('0x1d')](function(){_0x1cba68[_0x1a59('0x27')](0xcc)[_0x1a59('0x32')]();});}};}function handleEntityNotFound(_0x35c926,_0x272100){return function(_0x8d2472){if(!_0x8d2472){_0x35c926[_0x1a59('0x26')](0x194);}return _0x8d2472;};}function handleError(_0x41bc35,_0x2d8de5){_0x2d8de5=_0x2d8de5||0x1f4;return function(_0xb03b34){logger['error'](_0xb03b34[_0x1a59('0x33')]);if(_0xb03b34[_0x1a59('0x34')]){delete _0xb03b34[_0x1a59('0x34')];}_0x41bc35[_0x1a59('0x27')](_0x2d8de5)[_0x1a59('0x35')](_0xb03b34);};}exports[_0x1a59('0x36')]=function(_0x4275af,_0x3b1293){var _0x486d2c={},_0x1d9e94={},_0x2ec435={'count':0x0,'rows':[]};var _0x363f18=_[_0x1a59('0x37')](db[_0x1a59('0x38')][_0x1a59('0x39')],function(_0x1cccae){return{'name':_0x1cccae[_0x1a59('0x3a')],'type':_0x1cccae[_0x1a59('0x3b')][_0x1a59('0x3c')]};});_0x1d9e94[_0x1a59('0x3d')]=_['map'](_0x363f18,_0x1a59('0x34'));_0x1d9e94['query']=_[_0x1a59('0x3e')](_0x4275af[_0x1a59('0x3f')]);_0x1d9e94[_0x1a59('0x40')]=_[_0x1a59('0x41')](_0x1d9e94['model'],_0x1d9e94[_0x1a59('0x3f')]);_0x486d2c[_0x1a59('0x42')]=_[_0x1a59('0x41')](_0x1d9e94[_0x1a59('0x3d')],qs['fields'](_0x4275af[_0x1a59('0x3f')]['fields']));_0x486d2c['attributes']=_0x486d2c['attributes']['length']?_0x486d2c[_0x1a59('0x42')]:_0x1d9e94['model'];if(!_0x4275af['query'][_0x1a59('0x43')](_0x1a59('0x44'))){_0x486d2c[_0x1a59('0x45')]=qs['limit'](_0x4275af[_0x1a59('0x3f')]['limit']);_0x486d2c[_0x1a59('0x2a')]=qs['offset'](_0x4275af['query'][_0x1a59('0x2a')]);}_0x486d2c['order']=qs[_0x1a59('0x46')](_0x4275af['query'][_0x1a59('0x46')]);_0x486d2c[_0x1a59('0x47')]=qs['filters'](_['pick'](_0x4275af[_0x1a59('0x3f')],_0x1d9e94[_0x1a59('0x40')]),_0x363f18);if(_0x4275af[_0x1a59('0x3f')]['filter']){_0x486d2c[_0x1a59('0x47')]=_[_0x1a59('0x48')](_0x486d2c[_0x1a59('0x47')],{'$or':_[_0x1a59('0x37')](_0x363f18,function(_0x725732){if(_0x725732[_0x1a59('0x3b')]!==_0x1a59('0x49')){var _0x2aa6b0={};_0x2aa6b0[_0x725732['name']]={'$like':'%'+_0x4275af[_0x1a59('0x3f')][_0x1a59('0x4a')]+'%'};return _0x2aa6b0;}})});}_0x486d2c=_[_0x1a59('0x48')]({},_0x486d2c,_0x4275af[_0x1a59('0x4b')]);var _0x2624b6={'where':_0x486d2c[_0x1a59('0x47')]};return db[_0x1a59('0x38')][_0x1a59('0x29')](_0x2624b6)[_0x1a59('0x1d')](function(_0x8cf2e){_0x2ec435['count']=_0x8cf2e;if(_0x4275af[_0x1a59('0x3f')][_0x1a59('0x4c')]){_0x486d2c[_0x1a59('0x4d')]=[{'all':!![]}];}return db[_0x1a59('0x38')][_0x1a59('0x4e')](_0x486d2c);})[_0x1a59('0x1d')](function(_0x1536eb){_0x2ec435[_0x1a59('0x4f')]=_0x1536eb;return _0x2ec435;})[_0x1a59('0x1d')](respondWithFilteredResult(_0x3b1293,_0x486d2c))[_0x1a59('0x25')](handleError(_0x3b1293,null));};exports[_0x1a59('0x50')]=function(_0x2e15fd,_0x519132){var _0x157cf7={'raw':![],'where':{'id':_0x2e15fd['params']['id']}},_0x2b1961={};_0x2b1961[_0x1a59('0x3d')]=_[_0x1a59('0x3e')](db[_0x1a59('0x38')][_0x1a59('0x39')]);_0x2b1961[_0x1a59('0x3f')]=_[_0x1a59('0x3e')](_0x2e15fd[_0x1a59('0x3f')]);_0x2b1961[_0x1a59('0x40')]=_['intersection'](_0x2b1961[_0x1a59('0x3d')],_0x2b1961[_0x1a59('0x3f')]);_0x157cf7[_0x1a59('0x42')]=_['intersection'](_0x2b1961['model'],qs[_0x1a59('0x51')](_0x2e15fd[_0x1a59('0x3f')][_0x1a59('0x51')]));_0x157cf7[_0x1a59('0x42')]=_0x157cf7[_0x1a59('0x42')][_0x1a59('0x52')]?_0x157cf7[_0x1a59('0x42')]:_0x2b1961[_0x1a59('0x3d')];if(_0x2e15fd[_0x1a59('0x3f')][_0x1a59('0x4c')]){_0x157cf7[_0x1a59('0x4d')]=[{'all':!![]}];}_0x157cf7=_[_0x1a59('0x48')]({},_0x157cf7,_0x2e15fd[_0x1a59('0x4b')]);return db['DeskAccount'][_0x1a59('0x53')](_0x157cf7)[_0x1a59('0x1d')](handleEntityNotFound(_0x519132,null))['then'](respondWithResult(_0x519132,null))[_0x1a59('0x25')](handleError(_0x519132,null));};exports['create']=function(_0x3b79b4,_0x1cf969){return db[_0x1a59('0x38')][_0x1a59('0x54')](_0x3b79b4['body'],{})[_0x1a59('0x1d')](respondWithResult(_0x1cf969,0xc9))['catch'](handleError(_0x1cf969,null));};exports[_0x1a59('0x30')]=function(_0x1fe6b6,_0x5e775d){if(_0x1fe6b6['body']['id']){delete _0x1fe6b6[_0x1a59('0x55')]['id'];}return db[_0x1a59('0x38')]['find']({'where':{'id':_0x1fe6b6['params']['id']}})[_0x1a59('0x1d')](handleEntityNotFound(_0x5e775d,null))['then'](saveUpdates(_0x1fe6b6[_0x1a59('0x55')],null))[_0x1a59('0x1d')](respondWithResult(_0x5e775d,null))['catch'](handleError(_0x5e775d,null));};exports[_0x1a59('0x31')]=function(_0x64787c,_0x7f45c1){return db[_0x1a59('0x38')][_0x1a59('0x53')]({'where':{'id':_0x64787c['params']['id']}})['then'](handleEntityNotFound(_0x7f45c1,null))['then'](removeEntity(_0x7f45c1,null))[_0x1a59('0x25')](handleError(_0x7f45c1,null));};exports[_0x1a59('0x56')]=function(_0x18bccb,_0x4aeeb5,_0x231c61){var _0x369b76={};var _0x5001c0={};var _0x976901;var _0x2d917f;return db[_0x1a59('0x38')][_0x1a59('0x57')]({'where':{'id':_0x18bccb[_0x1a59('0x58')]['id']}})['then'](handleEntityNotFound(_0x4aeeb5,null))[_0x1a59('0x1d')](function(_0x5ed719){if(_0x5ed719){_0x976901=_0x5ed719;_0x5001c0[_0x1a59('0x3d')]=_['keys'](db['DeskConfiguration'][_0x1a59('0x39')]);_0x5001c0[_0x1a59('0x3f')]=_['keys'](_0x18bccb[_0x1a59('0x3f')]);_0x5001c0[_0x1a59('0x40')]=_[_0x1a59('0x41')](_0x5001c0['model'],_0x5001c0[_0x1a59('0x3f')]);_0x369b76[_0x1a59('0x42')]=_[_0x1a59('0x41')](_0x5001c0[_0x1a59('0x3d')],qs['fields'](_0x18bccb[_0x1a59('0x3f')]['fields']));_0x369b76['attributes']=_0x369b76[_0x1a59('0x42')][_0x1a59('0x52')]?_0x369b76[_0x1a59('0x42')]:_0x5001c0[_0x1a59('0x3d')];_0x369b76[_0x1a59('0x59')]=qs[_0x1a59('0x46')](_0x18bccb[_0x1a59('0x3f')][_0x1a59('0x46')]);_0x369b76[_0x1a59('0x47')]=qs[_0x1a59('0x40')](_[_0x1a59('0x5a')](_0x18bccb[_0x1a59('0x3f')],_0x5001c0[_0x1a59('0x40')]));if(_0x18bccb[_0x1a59('0x3f')][_0x1a59('0x4a')]){_0x369b76['where']=_[_0x1a59('0x48')](_0x369b76['where'],{'$or':_[_0x1a59('0x37')](_0x369b76['attributes'],function(_0xf5c3f){var _0x3681ef={};_0x3681ef[_0xf5c3f]={'$like':'%'+_0x18bccb['query']['filter']+'%'};return _0x3681ef;})});}_0x369b76=_[_0x1a59('0x48')]({},_0x369b76,_0x18bccb['options']);return _0x976901[_0x1a59('0x56')](_0x369b76);}})[_0x1a59('0x1d')](function(_0x5253dc){if(_0x5253dc){_0x2d917f=_0x5253dc['length'];if(!_0x18bccb['query'][_0x1a59('0x43')](_0x1a59('0x44'))){_0x369b76['limit']=qs[_0x1a59('0x45')](_0x18bccb['query'][_0x1a59('0x45')]);_0x369b76[_0x1a59('0x2a')]=qs['offset'](_0x18bccb[_0x1a59('0x3f')]['offset']);}return _0x976901['getConfigurations'](_0x369b76);}})['then'](function(_0xcdc26c){if(_0xcdc26c){return _0xcdc26c?{'count':_0x2d917f,'rows':_0xcdc26c}:null;}})['then'](respondWithResult(_0x4aeeb5,null))[_0x1a59('0x25')](handleError(_0x4aeeb5,null));};exports['addConfiguration']=function(_0x509c50,_0x5c2a06,_0x29b401){if(_0x509c50[_0x1a59('0x55')]['id']){delete _0x509c50[_0x1a59('0x55')]['id'];}return db[_0x1a59('0x38')][_0x1a59('0x57')]({'where':{'id':_0x509c50['params']['id']}})[_0x1a59('0x1d')](handleEntityNotFound(_0x5c2a06,null))['then'](function(_0x443eaa){if(_0x443eaa){_0x509c50[_0x1a59('0x55')][_0x1a59('0x5b')]=_0x443eaa['id'];_0x509c50[_0x1a59('0x55')][_0x1a59('0x5c')]=integrations[_0x1a59('0x5d')](_0x509c50[_0x1a59('0x55')][_0x1a59('0x5e')],_0x509c50[_0x1a59('0x55')]['type']);_0x509c50[_0x1a59('0x55')][_0x1a59('0x5f')]=integrations[_0x1a59('0x60')](_0x509c50[_0x1a59('0x55')][_0x1a59('0x5e')],_0x509c50[_0x1a59('0x55')][_0x1a59('0x3b')]);return db['DeskConfiguration'][_0x1a59('0x54')](_0x509c50[_0x1a59('0x55')],{'include':[{'model':db[_0x1a59('0x61')],'as':_0x1a59('0x5c')},{'model':db['DeskField'],'as':_0x1a59('0x5f')}]});}return null;})[_0x1a59('0x1d')](respondWithResult(_0x5c2a06,null))['catch'](handleError(_0x5c2a06,null));};exports['getFields']=function(_0x486884,_0xef81ae,_0x516026){var _0x1a678b=[{'name':_0x1a59('0x62'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x112d9e='';return db[_0x1a59('0x38')]['findOne']({'where':{'id':_0x486884[_0x1a59('0x58')]['id']},'attributes':['id',_0x1a59('0x63'),_0x1a59('0x64'),_0x1a59('0x65'),_0x1a59('0x66'),_0x1a59('0x67'),_0x1a59('0x68'),'token','tokenSecret']})['then'](handleEntityNotFound(_0xef81ae,null))[_0x1a59('0x1d')](function(_0x518ad2){if(_0x518ad2){_0x112d9e=_0x518ad2[_0x1a59('0x63')];var _0x14101b=_0x112d9e['slice'](-0x1);if(_0x14101b==='/'){_0x112d9e=_0x112d9e[_0x1a59('0x69')](0x0,_0x112d9e[_0x1a59('0x6a')](_0x14101b));}var _0x56e528={'method':'GET','uri':util[_0x1a59('0x6b')](_0x1a59('0x6c'),_0x112d9e),'headers':{'Content-Type':_0x1a59('0x6d'),'Accept':_0x1a59('0x6d')},'json':!![]};if(_0x518ad2['authType']===_0x1a59('0x6e')){_0x56e528[_0x1a59('0x6f')][_0x1a59('0x70')]=util[_0x1a59('0x6b')]('Basic\x20%s',new Buffer(util['format'](_0x1a59('0x71'),_0x518ad2['username'],_0x518ad2[_0x1a59('0x66')]))[_0x1a59('0x72')](_0x1a59('0x73')));}return rp(_0x56e528)[_0x1a59('0x1d')](function(_0x59820b){return _0x1a678b['concat'](_[_0x1a59('0x37')](_0x59820b[_0x1a59('0x74')][_0x1a59('0x75')],function(_0x5cdf8c){return{'id':_0x5cdf8c[_0x1a59('0x34')],'name':_0x5cdf8c[_0x1a59('0x34')],'type':_0x5cdf8c['type'],'active':_0x5cdf8c[_0x1a59('0x76')],'label':_0x5cdf8c[_0x1a59('0x77')],'custom':!![]};}));});}})[_0x1a59('0x1d')](function(_0x17b975){return{'count':_0x17b975[_0x1a59('0x52')],'rows':_0x17b975};})[_0x1a59('0x1d')](respondWithResult(_0xef81ae,null))[_0x1a59('0x25')](function(_0xadea7d){var _0x32ffdb=_0x486884[_0x1a59('0x3f')][_0x1a59('0x78')]?0x1f4:_0xadea7d[_0x1a59('0x79')]||0x1f4;logger[_0x1a59('0x22')](_0x1a59('0x7a'),_0x1a59('0x7b'),_0x32ffdb,JSON[_0x1a59('0x7c')](_0xadea7d));delete _0xadea7d[_0x1a59('0x34')];if(_0x32ffdb===0x191){_0x32ffdb=0x190;}_0xef81ae[_0x1a59('0x27')](_0x32ffdb)['send'](_0x486884[_0x1a59('0x3f')]['test']?{'message':_0x1a59('0x7d'),'statusCode':_0xadea7d[_0x1a59('0x79')]}:_0xadea7d);});}; \ No newline at end of file +var _0x55ec=['findOne','DeskConfiguration','sort','addConfiguration','AccountId','Subjects','channel','Descriptions','DeskField','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','base64','_embedded','active','label','test','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','../../components/integrations/configuration','http','request','then','info','DeskAccount,\x20%s,\x20%s','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','end','count','offset','limit','status','set','Content-Range','reject','save','update','destroy','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','filters','pick','filter','where','VIRTUAL','merge','options','DeskAccount','includeAll','include','findAll','rows','show','params','find','create','body','getConfigurations'];(function(_0x43e83d,_0x40b307){var _0x3f71c3=function(_0xf523bb){while(--_0xf523bb){_0x43e83d['push'](_0x43e83d['shift']());}};_0x3f71c3(++_0x40b307);}(_0x55ec,0x10c));var _0xc55e=function(_0x51ac09,_0x383098){_0x51ac09=_0x51ac09-0x0;var _0x3f827d=_0x55ec[_0x51ac09];return _0x3f827d;};'use strict';var pdf=require(_0xc55e('0x0'));var emlformat=require(_0xc55e('0x1'));var rimraf=require(_0xc55e('0x2'));var zipdir=require(_0xc55e('0x3'));var jsonpatch=require(_0xc55e('0x4'));var rp=require(_0xc55e('0x5'));var moment=require('moment');var BPromise=require(_0xc55e('0x6'));var Mustache=require(_0xc55e('0x7'));var util=require('util');var path=require(_0xc55e('0x8'));var sox=require('sox');var csv=require(_0xc55e('0x9'));var ejs=require(_0xc55e('0xa'));var fs=require('fs');var _=require(_0xc55e('0xb'));var squel=require(_0xc55e('0xc'));var crypto=require(_0xc55e('0xd'));var jsforce=require(_0xc55e('0xe'));var deskjs=require(_0xc55e('0xf'));var toCsv=require(_0xc55e('0x9'));var querystring=require(_0xc55e('0x10'));var Papa=require(_0xc55e('0x11'));var Redis=require(_0xc55e('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc55e('0x13'));var hardwareService=require(_0xc55e('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc55e('0x15'))['db'];var integrations=require(_0xc55e('0x16'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc55e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x1f5167,_0x5d0d57,_0x55d827,_0x2ea1cc){return new BPromise(function(_0x333a65,_0x5c3b5d){var _0x396467=_0x2ea1cc||client;return _0x396467[_0xc55e('0x18')](_0x1f5167,_0x55d827)[_0xc55e('0x19')](function(_0x7444a5){logger[_0xc55e('0x1a')](_0xc55e('0x1b'),_0x5d0d57,'request\x20sent');logger['debug'](_0xc55e('0x1c'),_0x5d0d57,_0xc55e('0x1d'),JSON['stringify'](_0x7444a5));if(_0x7444a5[_0xc55e('0x1e')]){if(_0x7444a5['error'][_0xc55e('0x1f')]===0x1f4){logger[_0xc55e('0x1e')](_0xc55e('0x1b'),_0x5d0d57,_0x7444a5['error'][_0xc55e('0x20')]);return _0x5c3b5d(_0x7444a5[_0xc55e('0x1e')][_0xc55e('0x20')]);}logger[_0xc55e('0x1e')](_0xc55e('0x1b'),_0x5d0d57,_0x7444a5[_0xc55e('0x1e')][_0xc55e('0x20')]);return _0x333a65(_0x7444a5['error'][_0xc55e('0x20')]);}else{logger[_0xc55e('0x1a')](_0xc55e('0x1b'),_0x5d0d57,_0xc55e('0x1d'));_0x333a65(_0x7444a5[_0xc55e('0x21')][_0xc55e('0x20')]);}})[_0xc55e('0x22')](function(_0x38b8e7){logger['error'](_0xc55e('0x1b'),_0x5d0d57,_0x38b8e7);_0x5c3b5d(_0x38b8e7);});});}function respondWithStatusCode(_0x324cc5,_0x24ba23){_0x24ba23=_0x24ba23||0xcc;return function(_0x4b0be1){if(_0x4b0be1){return _0x324cc5[_0xc55e('0x23')](_0x24ba23);}return _0x324cc5['status'](_0x24ba23)[_0xc55e('0x24')]();};}function respondWithResult(_0x1185d9,_0x2c146e){_0x2c146e=_0x2c146e||0xc8;return function(_0x36c4c7){if(_0x36c4c7){return _0x1185d9['status'](_0x2c146e)['json'](_0x36c4c7);}};}function respondWithFilteredResult(_0x2510d0,_0x10fc3a){return function(_0x25e758){if(_0x25e758){var _0x142d0b=_0x25e758[_0xc55e('0x25')],_0x4915a0=_0x10fc3a[_0xc55e('0x26')],_0x2dd946=_0x10fc3a[_0xc55e('0x26')]+_0x10fc3a[_0xc55e('0x27')],_0x36ac09;if(_0x2dd946>=_0x142d0b){_0x2dd946=_0x142d0b;_0x36ac09=0xc8;}else{_0x36ac09=0xce;}_0x2510d0[_0xc55e('0x28')](_0x36ac09);return _0x2510d0[_0xc55e('0x29')](_0xc55e('0x2a'),_0x4915a0+'-'+_0x2dd946+'/'+_0x142d0b)['json'](_0x25e758);}return null;};}function patchUpdates(_0x5d19e8){return function(_0x4e8ee8){try{jsonpatch['apply'](_0x4e8ee8,_0x5d19e8,!![]);}catch(_0x53918b){return BPromise[_0xc55e('0x2b')](_0x53918b);}return _0x4e8ee8[_0xc55e('0x2c')]();};}function saveUpdates(_0x3bc780,_0x3188fc){return function(_0xbffc19){if(_0xbffc19){return _0xbffc19[_0xc55e('0x2d')](_0x3bc780)[_0xc55e('0x19')](function(_0x143a49){return _0x143a49;});}return null;};}function removeEntity(_0x121f6f,_0x564b29){return function(_0x47065e){if(_0x47065e){return _0x47065e[_0xc55e('0x2e')]()[_0xc55e('0x19')](function(){_0x121f6f[_0xc55e('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6a47db,_0x3a7f47){return function(_0xd53d12){if(!_0xd53d12){_0x6a47db[_0xc55e('0x23')](0x194);}return _0xd53d12;};}function handleError(_0x1b7a7e,_0x4e6742){_0x4e6742=_0x4e6742||0x1f4;return function(_0x1200d9){logger[_0xc55e('0x1e')](_0x1200d9[_0xc55e('0x2f')]);if(_0x1200d9[_0xc55e('0x30')]){delete _0x1200d9[_0xc55e('0x30')];}_0x1b7a7e[_0xc55e('0x28')](_0x4e6742)[_0xc55e('0x31')](_0x1200d9);};}exports[_0xc55e('0x32')]=function(_0x12c238,_0xdaf864){var _0x280744={},_0x1ca333={},_0x5ab489={'count':0x0,'rows':[]};var _0x2e2d5b=_['map'](db['DeskAccount'][_0xc55e('0x33')],function(_0x4cd7eb){return{'name':_0x4cd7eb['fieldName'],'type':_0x4cd7eb[_0xc55e('0x34')][_0xc55e('0x35')]};});_0x1ca333[_0xc55e('0x36')]=_[_0xc55e('0x37')](_0x2e2d5b,_0xc55e('0x30'));_0x1ca333[_0xc55e('0x38')]=_[_0xc55e('0x39')](_0x12c238[_0xc55e('0x38')]);_0x1ca333['filters']=_[_0xc55e('0x3a')](_0x1ca333[_0xc55e('0x36')],_0x1ca333[_0xc55e('0x38')]);_0x280744['attributes']=_[_0xc55e('0x3a')](_0x1ca333[_0xc55e('0x36')],qs[_0xc55e('0x3b')](_0x12c238[_0xc55e('0x38')]['fields']));_0x280744[_0xc55e('0x3c')]=_0x280744[_0xc55e('0x3c')][_0xc55e('0x3d')]?_0x280744[_0xc55e('0x3c')]:_0x1ca333['model'];if(!_0x12c238['query'][_0xc55e('0x3e')](_0xc55e('0x3f'))){_0x280744[_0xc55e('0x27')]=qs[_0xc55e('0x27')](_0x12c238[_0xc55e('0x38')][_0xc55e('0x27')]);_0x280744[_0xc55e('0x26')]=qs[_0xc55e('0x26')](_0x12c238[_0xc55e('0x38')]['offset']);}_0x280744[_0xc55e('0x40')]=qs['sort'](_0x12c238[_0xc55e('0x38')]['sort']);_0x280744['where']=qs[_0xc55e('0x41')](_[_0xc55e('0x42')](_0x12c238[_0xc55e('0x38')],_0x1ca333['filters']),_0x2e2d5b);if(_0x12c238[_0xc55e('0x38')][_0xc55e('0x43')]){_0x280744[_0xc55e('0x44')]=_['merge'](_0x280744['where'],{'$or':_[_0xc55e('0x37')](_0x2e2d5b,function(_0xe680d1){if(_0xe680d1['type']!==_0xc55e('0x45')){var _0x369552={};_0x369552[_0xe680d1[_0xc55e('0x30')]]={'$like':'%'+_0x12c238[_0xc55e('0x38')][_0xc55e('0x43')]+'%'};return _0x369552;}})});}_0x280744=_[_0xc55e('0x46')]({},_0x280744,_0x12c238[_0xc55e('0x47')]);var _0x40a851={'where':_0x280744[_0xc55e('0x44')]};return db[_0xc55e('0x48')][_0xc55e('0x25')](_0x40a851)['then'](function(_0x40eb4b){_0x5ab489[_0xc55e('0x25')]=_0x40eb4b;if(_0x12c238[_0xc55e('0x38')][_0xc55e('0x49')]){_0x280744[_0xc55e('0x4a')]=[{'all':!![]}];}return db[_0xc55e('0x48')][_0xc55e('0x4b')](_0x280744);})[_0xc55e('0x19')](function(_0x2a9d59){_0x5ab489[_0xc55e('0x4c')]=_0x2a9d59;return _0x5ab489;})['then'](respondWithFilteredResult(_0xdaf864,_0x280744))['catch'](handleError(_0xdaf864,null));};exports[_0xc55e('0x4d')]=function(_0x4fd892,_0x41a396){var _0x455bd4={'raw':![],'where':{'id':_0x4fd892[_0xc55e('0x4e')]['id']}},_0xb603ac={};_0xb603ac['model']=_[_0xc55e('0x39')](db[_0xc55e('0x48')][_0xc55e('0x33')]);_0xb603ac[_0xc55e('0x38')]=_['keys'](_0x4fd892[_0xc55e('0x38')]);_0xb603ac['filters']=_[_0xc55e('0x3a')](_0xb603ac['model'],_0xb603ac[_0xc55e('0x38')]);_0x455bd4[_0xc55e('0x3c')]=_[_0xc55e('0x3a')](_0xb603ac['model'],qs['fields'](_0x4fd892[_0xc55e('0x38')][_0xc55e('0x3b')]));_0x455bd4['attributes']=_0x455bd4[_0xc55e('0x3c')]['length']?_0x455bd4[_0xc55e('0x3c')]:_0xb603ac[_0xc55e('0x36')];if(_0x4fd892['query'][_0xc55e('0x49')]){_0x455bd4[_0xc55e('0x4a')]=[{'all':!![]}];}_0x455bd4=_[_0xc55e('0x46')]({},_0x455bd4,_0x4fd892['options']);return db[_0xc55e('0x48')][_0xc55e('0x4f')](_0x455bd4)[_0xc55e('0x19')](handleEntityNotFound(_0x41a396,null))[_0xc55e('0x19')](respondWithResult(_0x41a396,null))['catch'](handleError(_0x41a396,null));};exports[_0xc55e('0x50')]=function(_0x57eaa2,_0x298ef3){return db[_0xc55e('0x48')][_0xc55e('0x50')](_0x57eaa2[_0xc55e('0x51')],{})[_0xc55e('0x19')](respondWithResult(_0x298ef3,0xc9))[_0xc55e('0x22')](handleError(_0x298ef3,null));};exports[_0xc55e('0x2d')]=function(_0x37fd42,_0x1065fd){if(_0x37fd42['body']['id']){delete _0x37fd42[_0xc55e('0x51')]['id'];}return db[_0xc55e('0x48')][_0xc55e('0x4f')]({'where':{'id':_0x37fd42[_0xc55e('0x4e')]['id']}})[_0xc55e('0x19')](handleEntityNotFound(_0x1065fd,null))['then'](saveUpdates(_0x37fd42[_0xc55e('0x51')],null))['then'](respondWithResult(_0x1065fd,null))[_0xc55e('0x22')](handleError(_0x1065fd,null));};exports['destroy']=function(_0x362360,_0x52941b){return db[_0xc55e('0x48')][_0xc55e('0x4f')]({'where':{'id':_0x362360[_0xc55e('0x4e')]['id']}})[_0xc55e('0x19')](handleEntityNotFound(_0x52941b,null))['then'](removeEntity(_0x52941b,null))[_0xc55e('0x22')](handleError(_0x52941b,null));};exports[_0xc55e('0x52')]=function(_0x38742a,_0x11cb52,_0x4c1994){var _0xd487bc={};var _0x2da295={};var _0x30fe91;var _0x28ec52;return db[_0xc55e('0x48')][_0xc55e('0x53')]({'where':{'id':_0x38742a[_0xc55e('0x4e')]['id']}})[_0xc55e('0x19')](handleEntityNotFound(_0x11cb52,null))[_0xc55e('0x19')](function(_0x577314){if(_0x577314){_0x30fe91=_0x577314;_0x2da295[_0xc55e('0x36')]=_[_0xc55e('0x39')](db[_0xc55e('0x54')][_0xc55e('0x33')]);_0x2da295[_0xc55e('0x38')]=_['keys'](_0x38742a[_0xc55e('0x38')]);_0x2da295['filters']=_[_0xc55e('0x3a')](_0x2da295[_0xc55e('0x36')],_0x2da295['query']);_0xd487bc[_0xc55e('0x3c')]=_['intersection'](_0x2da295[_0xc55e('0x36')],qs[_0xc55e('0x3b')](_0x38742a[_0xc55e('0x38')][_0xc55e('0x3b')]));_0xd487bc['attributes']=_0xd487bc[_0xc55e('0x3c')]['length']?_0xd487bc[_0xc55e('0x3c')]:_0x2da295[_0xc55e('0x36')];_0xd487bc['order']=qs[_0xc55e('0x55')](_0x38742a[_0xc55e('0x38')][_0xc55e('0x55')]);_0xd487bc['where']=qs['filters'](_[_0xc55e('0x42')](_0x38742a[_0xc55e('0x38')],_0x2da295[_0xc55e('0x41')]));if(_0x38742a[_0xc55e('0x38')][_0xc55e('0x43')]){_0xd487bc['where']=_[_0xc55e('0x46')](_0xd487bc[_0xc55e('0x44')],{'$or':_[_0xc55e('0x37')](_0xd487bc[_0xc55e('0x3c')],function(_0xd2a7a6){var _0x31980e={};_0x31980e[_0xd2a7a6]={'$like':'%'+_0x38742a[_0xc55e('0x38')][_0xc55e('0x43')]+'%'};return _0x31980e;})});}_0xd487bc=_[_0xc55e('0x46')]({},_0xd487bc,_0x38742a[_0xc55e('0x47')]);return _0x30fe91['getConfigurations'](_0xd487bc);}})[_0xc55e('0x19')](function(_0x3736ea){if(_0x3736ea){_0x28ec52=_0x3736ea[_0xc55e('0x3d')];if(!_0x38742a[_0xc55e('0x38')][_0xc55e('0x3e')](_0xc55e('0x3f'))){_0xd487bc[_0xc55e('0x27')]=qs[_0xc55e('0x27')](_0x38742a[_0xc55e('0x38')][_0xc55e('0x27')]);_0xd487bc['offset']=qs['offset'](_0x38742a[_0xc55e('0x38')][_0xc55e('0x26')]);}return _0x30fe91[_0xc55e('0x52')](_0xd487bc);}})['then'](function(_0x30967b){if(_0x30967b){return _0x30967b?{'count':_0x28ec52,'rows':_0x30967b}:null;}})[_0xc55e('0x19')](respondWithResult(_0x11cb52,null))[_0xc55e('0x22')](handleError(_0x11cb52,null));};exports[_0xc55e('0x56')]=function(_0x3f172b,_0x2d23a7,_0x2d8840){if(_0x3f172b[_0xc55e('0x51')]['id']){delete _0x3f172b[_0xc55e('0x51')]['id'];}return db[_0xc55e('0x48')][_0xc55e('0x53')]({'where':{'id':_0x3f172b[_0xc55e('0x4e')]['id']}})[_0xc55e('0x19')](handleEntityNotFound(_0x2d23a7,null))['then'](function(_0x170b94){if(_0x170b94){_0x3f172b[_0xc55e('0x51')][_0xc55e('0x57')]=_0x170b94['id'];_0x3f172b[_0xc55e('0x51')][_0xc55e('0x58')]=integrations['getSubjects'](_0x3f172b[_0xc55e('0x51')][_0xc55e('0x59')],_0x3f172b['body'][_0xc55e('0x34')]);_0x3f172b['body'][_0xc55e('0x5a')]=integrations['getDescriptions'](_0x3f172b['body'][_0xc55e('0x59')],_0x3f172b[_0xc55e('0x51')][_0xc55e('0x34')]);return db[_0xc55e('0x54')][_0xc55e('0x50')](_0x3f172b[_0xc55e('0x51')],{'include':[{'model':db[_0xc55e('0x5b')],'as':'Subjects'},{'model':db[_0xc55e('0x5b')],'as':_0xc55e('0x5a')}]});}return null;})['then'](respondWithResult(_0x2d23a7,null))[_0xc55e('0x22')](handleError(_0x2d23a7,null));};exports['getFields']=function(_0x5cc8e0,_0x173857,_0x4d7a40){var _0x5e7215=[{'name':_0xc55e('0x5c'),'label':_0xc55e('0x5c'),'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 _0x5851bf='';return db[_0xc55e('0x48')][_0xc55e('0x53')]({'where':{'id':_0x5cc8e0[_0xc55e('0x4e')]['id']},'attributes':['id',_0xc55e('0x5d'),_0xc55e('0x5e'),_0xc55e('0x5f'),_0xc55e('0x60'),_0xc55e('0x61'),_0xc55e('0x62'),_0xc55e('0x63'),_0xc55e('0x64')]})['then'](handleEntityNotFound(_0x173857,null))[_0xc55e('0x19')](function(_0x58859d){if(_0x58859d){_0x5851bf=_0x58859d[_0xc55e('0x5d')];var _0x38cbae=_0x5851bf[_0xc55e('0x65')](-0x1);if(_0x38cbae==='/'){_0x5851bf=_0x5851bf[_0xc55e('0x66')](0x0,_0x5851bf[_0xc55e('0x67')](_0x38cbae));}var _0x21352a={'method':_0xc55e('0x68'),'uri':util[_0xc55e('0x69')](_0xc55e('0x6a'),_0x5851bf),'headers':{'Content-Type':_0xc55e('0x6b'),'Accept':_0xc55e('0x6b')},'json':!![]};if(_0x58859d[_0xc55e('0x5e')]==='basic'){_0x21352a[_0xc55e('0x6c')][_0xc55e('0x6d')]=util[_0xc55e('0x69')](_0xc55e('0x6e'),new Buffer(util[_0xc55e('0x69')]('%s:%s',_0x58859d[_0xc55e('0x5f')],_0x58859d[_0xc55e('0x60')]))['toString'](_0xc55e('0x6f')));}return rp(_0x21352a)['then'](function(_0x319928){return _0x5e7215['concat'](_[_0xc55e('0x37')](_0x319928[_0xc55e('0x70')]['entries'],function(_0x16437c){return{'id':_0x16437c[_0xc55e('0x30')],'name':_0x16437c['name'],'type':_0x16437c['type'],'active':_0x16437c[_0xc55e('0x71')],'label':_0x16437c[_0xc55e('0x72')],'custom':!![]};}));});}})[_0xc55e('0x19')](function(_0x561067){return{'count':_0x561067[_0xc55e('0x3d')],'rows':_0x561067};})[_0xc55e('0x19')](respondWithResult(_0x173857,null))[_0xc55e('0x22')](function(_0x30f789){var _0x564711=_0x5cc8e0[_0xc55e('0x38')][_0xc55e('0x73')]?0x1f4:_0x30f789['statusCode']||0x1f4;logger[_0xc55e('0x1e')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x564711,JSON['stringify'](_0x30f789));delete _0x30f789[_0xc55e('0x30')];if(_0x564711===0x191){_0x564711=0x190;}_0x173857[_0xc55e('0x28')](_0x564711)[_0xc55e('0x31')](_0x5cc8e0[_0xc55e('0x38')][_0xc55e('0x73')]?{'message':_0xc55e('0x74'),'statusCode':_0x30f789['statusCode']}:_0x30f789);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 5834ebc..76cf710 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 _0xc097=['int_desk_accounts','util','../../config/logger','moment','request-promise','path','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc097,0x166));var _0x7c09=function(_0x3f8179,_0x26a221){_0x3f8179=_0x3f8179-0x0;var _0x2023b4=_0xc097[_0x3f8179];return _0x2023b4;};'use strict';var _=require('lodash');var util=require(_0x7c09('0x0'));var logger=require(_0x7c09('0x1'))('api');var moment=require(_0x7c09('0x2'));var BPromise=require('bluebird');var rp=require(_0x7c09('0x3'));var fs=require('fs');var path=require(_0x7c09('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x59bf17,_0x1066e2){return _0x59bf17[_0x7c09('0x5')]('DeskAccount',attributes,{'tableName':_0x7c09('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a7d=['define','DeskAccount','int_desk_accounts','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intDeskAccount.attributes','../../components/integrations/configuration'];(function(_0x3517e5,_0x1a0928){var _0x203ce0=function(_0x2ac7e2){while(--_0x2ac7e2){_0x3517e5['push'](_0x3517e5['shift']());}};_0x203ce0(++_0x1a0928);}(_0x3a7d,0x1ef));var _0xd3a7=function(_0x15c4e7,_0x5d4c60){_0x15c4e7=_0x15c4e7-0x0;var _0x66bf26=_0x3a7d[_0x15c4e7];return _0x66bf26;};'use strict';var _=require('lodash');var util=require(_0xd3a7('0x0'));var logger=require(_0xd3a7('0x1'))('api');var moment=require(_0xd3a7('0x2'));var BPromise=require(_0xd3a7('0x3'));var rp=require(_0xd3a7('0x4'));var fs=require('fs');var path=require(_0xd3a7('0x5'));var rimraf=require(_0xd3a7('0x6'));var config=require('../../config/environment');var attributes=require(_0xd3a7('0x7'));var integrations=require(_0xd3a7('0x8'));module['exports']=function(_0x575443,_0x13142a){return _0x575443[_0xd3a7('0x9')](_0xd3a7('0xa'),attributes,{'tableName':_0xd3a7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 8e68fe8..3ab966f 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 _0xf4b3=['DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDeskAccount','options','where','attributes','limit','include','map','model','debug','ShowDeskAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x201526,_0x4bcf5c){var _0x3dcb9f=function(_0x5a793f){while(--_0x5a793f){_0x201526['push'](_0x201526['shift']());}};_0x3dcb9f(++_0x4bcf5c);}(_0xf4b3,0x1b6));var _0x3f4b=function(_0x1301e8,_0x146769){_0x1301e8=_0x1301e8-0x0;var _0x17a97e=_0xf4b3[_0x1301e8];return _0x17a97e;};'use strict';var _=require(_0x3f4b('0x0'));var util=require(_0x3f4b('0x1'));var moment=require(_0x3f4b('0x2'));var BPromise=require(_0x3f4b('0x3'));var rs=require(_0x3f4b('0x4'));var fs=require('fs');var Redis=require(_0x3f4b('0x5'));var db=require(_0x3f4b('0x6'))['db'];var utils=require(_0x3f4b('0x7'));var logger=require(_0x3f4b('0x8'))('rpc');var config=require(_0x3f4b('0x9'));var jayson=require(_0x3f4b('0xa'));var client=jayson[_0x3f4b('0xb')][_0x3f4b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x369658,_0x16eac5,_0x520dd4){return new BPromise(function(_0x367379,_0x1bffed){return client['request'](_0x369658,_0x520dd4)[_0x3f4b('0xd')](function(_0x57e9fa){logger[_0x3f4b('0xe')](_0x3f4b('0xf'),_0x16eac5,_0x3f4b('0x10'));logger['debug'](_0x3f4b('0x11'),_0x16eac5,_0x3f4b('0x10'),JSON[_0x3f4b('0x12')](_0x57e9fa));if(_0x57e9fa[_0x3f4b('0x13')]){if(_0x57e9fa[_0x3f4b('0x13')][_0x3f4b('0x14')]===0x1f4){logger['error'](_0x3f4b('0xf'),_0x16eac5,_0x57e9fa[_0x3f4b('0x13')]['message']);return _0x1bffed(_0x57e9fa[_0x3f4b('0x13')][_0x3f4b('0x15')]);}logger[_0x3f4b('0x13')](_0x3f4b('0xf'),_0x16eac5,_0x57e9fa[_0x3f4b('0x13')]['message']);return _0x367379(_0x57e9fa[_0x3f4b('0x13')][_0x3f4b('0x15')]);}else{logger[_0x3f4b('0xe')](_0x3f4b('0xf'),_0x16eac5,_0x3f4b('0x10'));_0x367379(_0x57e9fa['result'][_0x3f4b('0x15')]);}})[_0x3f4b('0x16')](function(_0x55d288){logger[_0x3f4b('0x13')](_0x3f4b('0xf'),_0x16eac5,_0x55d288);_0x1bffed(_0x55d288);});});}exports[_0x3f4b('0x17')]=function(_0x5b62d7){var _0x36bc42=this;return new Promise(function(_0x5b7f1f,_0x1a19e3){return db['DeskAccount']['findAll']({'raw':_0x5b62d7[_0x3f4b('0x18')]?_0x5b62d7[_0x3f4b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5b62d7[_0x3f4b('0x18')]?_0x5b62d7[_0x3f4b('0x18')][_0x3f4b('0x19')]||null:null,'attributes':_0x5b62d7['options']?_0x5b62d7[_0x3f4b('0x18')][_0x3f4b('0x1a')]||null:null,'limit':_0x5b62d7[_0x3f4b('0x18')]?_0x5b62d7['options'][_0x3f4b('0x1b')]||null:null,'include':_0x5b62d7[_0x3f4b('0x18')]?_0x5b62d7[_0x3f4b('0x18')][_0x3f4b('0x1c')]?_[_0x3f4b('0x1d')](_0x5b62d7[_0x3f4b('0x18')][_0x3f4b('0x1c')],function(_0x15e6af){return{'model':db[_0x15e6af[_0x3f4b('0x1e')]],'as':_0x15e6af['as'],'attributes':_0x15e6af[_0x3f4b('0x1a')],'include':_0x15e6af[_0x3f4b('0x1c')]?_['map'](_0x15e6af[_0x3f4b('0x1c')],function(_0xba99b6){return{'model':db[_0xba99b6['model']],'as':_0xba99b6['as'],'attributes':_0xba99b6[_0x3f4b('0x1a')],'include':_0xba99b6[_0x3f4b('0x1c')]?_['map'](_0xba99b6[_0x3f4b('0x1c')],function(_0x2ceb55){return{'model':db[_0x2ceb55[_0x3f4b('0x1e')]],'as':_0x2ceb55['as'],'attributes':_0x2ceb55[_0x3f4b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5592ed){logger[_0x3f4b('0xe')]('GetDeskAccount',_0x5b62d7);logger[_0x3f4b('0x1f')](_0x3f4b('0x17'),_0x5b62d7,JSON['stringify'](_0x5592ed));_0x5b7f1f(_0x5592ed);})[_0x3f4b('0x16')](function(_0x4ae526){logger['error'](_0x3f4b('0x17'),_0x4ae526['message'],_0x5b62d7);_0x1a19e3(_0x36bc42[_0x3f4b('0x13')](0x1f4,_0x4ae526[_0x3f4b('0x15')]));});});};exports[_0x3f4b('0x20')]=function(_0x2c794d){var _0x209b70=this;return new Promise(function(_0x10b654,_0x355f7e){return db['DeskAccount'][_0x3f4b('0x21')]({'raw':_0x2c794d['options']?_0x2c794d[_0x3f4b('0x18')][_0x3f4b('0x22')]===undefined?!![]:![]:!![],'where':_0x2c794d['options']?_0x2c794d[_0x3f4b('0x18')][_0x3f4b('0x19')]||null:null,'attributes':_0x2c794d['options']?_0x2c794d['options']['attributes']||null:null,'include':_0x2c794d[_0x3f4b('0x18')]?_0x2c794d[_0x3f4b('0x18')][_0x3f4b('0x1c')]?_[_0x3f4b('0x1d')](_0x2c794d[_0x3f4b('0x18')][_0x3f4b('0x1c')],function(_0x129133){return{'model':db[_0x129133[_0x3f4b('0x1e')]],'as':_0x129133['as'],'attributes':_0x129133[_0x3f4b('0x1a')],'include':_0x129133[_0x3f4b('0x1c')]?_[_0x3f4b('0x1d')](_0x129133['include'],function(_0x32f66d){return{'model':db[_0x32f66d['model']],'as':_0x32f66d['as'],'attributes':_0x32f66d[_0x3f4b('0x1a')],'include':_0x32f66d[_0x3f4b('0x1c')]?_[_0x3f4b('0x1d')](_0x32f66d['include'],function(_0x462490){return{'model':db[_0x462490[_0x3f4b('0x1e')]],'as':_0x462490['as'],'attributes':_0x462490[_0x3f4b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3f4b('0xd')](function(_0x28323a){logger[_0x3f4b('0xe')]('ShowDeskAccount',_0x2c794d);logger[_0x3f4b('0x1f')]('ShowDeskAccount',_0x2c794d,JSON[_0x3f4b('0x12')](_0x28323a));_0x10b654(_0x28323a);})['catch'](function(_0x4d01df){logger['error'](_0x3f4b('0x20'),_0x4d01df[_0x3f4b('0x15')],_0x2c794d);_0x355f7e(_0x209b70[_0x3f4b('0x13')](0x1f4,_0x4d01df[_0x3f4b('0x15')]));});});}; \ No newline at end of file +var _0x3262=['DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','where','limit','attributes','include','map','model','stringify','ShowDeskAccount','find','raw','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xe2a843,_0x2a2f58){var _0x2215c5=function(_0x576c93){while(--_0x576c93){_0xe2a843['push'](_0xe2a843['shift']());}};_0x2215c5(++_0x2a2f58);}(_0x3262,0xfb));var _0x2326=function(_0x39b7d8,_0xa44989){_0x39b7d8=_0x39b7d8-0x0;var _0x42d6dd=_0x3262[_0x39b7d8];return _0x42d6dd;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2326('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2326('0x1'))['db'];var utils=require(_0x2326('0x2'));var logger=require('../../config/logger')(_0x2326('0x3'));var config=require(_0x2326('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x2326('0x5')][_0x2326('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3fb606,_0x8535a3,_0x50f6c1){return new BPromise(function(_0x11dfbe,_0x44bc09){return client[_0x2326('0x7')](_0x3fb606,_0x50f6c1)[_0x2326('0x8')](function(_0x5db7fe){logger[_0x2326('0x9')](_0x2326('0xa'),_0x8535a3,_0x2326('0xb'));logger[_0x2326('0xc')](_0x2326('0xd'),_0x8535a3,'request\x20sent',JSON['stringify'](_0x5db7fe));if(_0x5db7fe[_0x2326('0xe')]){if(_0x5db7fe[_0x2326('0xe')][_0x2326('0xf')]===0x1f4){logger['error'](_0x2326('0xa'),_0x8535a3,_0x5db7fe[_0x2326('0xe')][_0x2326('0x10')]);return _0x44bc09(_0x5db7fe['error'][_0x2326('0x10')]);}logger[_0x2326('0xe')](_0x2326('0xa'),_0x8535a3,_0x5db7fe[_0x2326('0xe')][_0x2326('0x10')]);return _0x11dfbe(_0x5db7fe[_0x2326('0xe')][_0x2326('0x10')]);}else{logger[_0x2326('0x9')](_0x2326('0xa'),_0x8535a3,_0x2326('0xb'));_0x11dfbe(_0x5db7fe[_0x2326('0x11')][_0x2326('0x10')]);}})[_0x2326('0x12')](function(_0x2eee61){logger[_0x2326('0xe')](_0x2326('0xa'),_0x8535a3,_0x2eee61);_0x44bc09(_0x2eee61);});});}exports[_0x2326('0x13')]=function(_0xd27b21){var _0x2f8471=this;return new Promise(function(_0x3e63c7,_0x27ea54){return db[_0x2326('0x14')][_0x2326('0x15')]({'raw':_0xd27b21[_0x2326('0x16')]?_0xd27b21[_0x2326('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xd27b21[_0x2326('0x16')]?_0xd27b21['options'][_0x2326('0x17')]||null:null,'attributes':_0xd27b21[_0x2326('0x16')]?_0xd27b21['options']['attributes']||null:null,'limit':_0xd27b21[_0x2326('0x16')]?_0xd27b21[_0x2326('0x16')][_0x2326('0x18')]||null:null,'include':_0xd27b21[_0x2326('0x16')]?_0xd27b21['options']['include']?_['map'](_0xd27b21[_0x2326('0x16')]['include'],function(_0x54ccc8){return{'model':db[_0x54ccc8['model']],'as':_0x54ccc8['as'],'attributes':_0x54ccc8[_0x2326('0x19')],'include':_0x54ccc8[_0x2326('0x1a')]?_[_0x2326('0x1b')](_0x54ccc8['include'],function(_0x513dc5){return{'model':db[_0x513dc5[_0x2326('0x1c')]],'as':_0x513dc5['as'],'attributes':_0x513dc5['attributes'],'include':_0x513dc5[_0x2326('0x1a')]?_[_0x2326('0x1b')](_0x513dc5[_0x2326('0x1a')],function(_0x3ccb7d){return{'model':db[_0x3ccb7d[_0x2326('0x1c')]],'as':_0x3ccb7d['as'],'attributes':_0x3ccb7d[_0x2326('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2326('0x8')](function(_0x693659){logger[_0x2326('0x9')](_0x2326('0x13'),_0xd27b21);logger['debug']('GetDeskAccount',_0xd27b21,JSON[_0x2326('0x1d')](_0x693659));_0x3e63c7(_0x693659);})['catch'](function(_0x3df5f2){logger[_0x2326('0xe')]('GetDeskAccount',_0x3df5f2[_0x2326('0x10')],_0xd27b21);_0x27ea54(_0x2f8471[_0x2326('0xe')](0x1f4,_0x3df5f2[_0x2326('0x10')]));});});};exports[_0x2326('0x1e')]=function(_0x3fc476){var _0x3987eb=this;return new Promise(function(_0x15b187,_0x4cb4b9){return db['DeskAccount'][_0x2326('0x1f')]({'raw':_0x3fc476[_0x2326('0x16')]?_0x3fc476[_0x2326('0x16')][_0x2326('0x20')]===undefined?!![]:![]:!![],'where':_0x3fc476[_0x2326('0x16')]?_0x3fc476[_0x2326('0x16')][_0x2326('0x17')]||null:null,'attributes':_0x3fc476[_0x2326('0x16')]?_0x3fc476[_0x2326('0x16')]['attributes']||null:null,'include':_0x3fc476[_0x2326('0x16')]?_0x3fc476[_0x2326('0x16')][_0x2326('0x1a')]?_[_0x2326('0x1b')](_0x3fc476[_0x2326('0x16')][_0x2326('0x1a')],function(_0x44624d){return{'model':db[_0x44624d['model']],'as':_0x44624d['as'],'attributes':_0x44624d[_0x2326('0x19')],'include':_0x44624d['include']?_[_0x2326('0x1b')](_0x44624d[_0x2326('0x1a')],function(_0x3058b1){return{'model':db[_0x3058b1[_0x2326('0x1c')]],'as':_0x3058b1['as'],'attributes':_0x3058b1['attributes'],'include':_0x3058b1[_0x2326('0x1a')]?_[_0x2326('0x1b')](_0x3058b1[_0x2326('0x1a')],function(_0x320d6c){return{'model':db[_0x320d6c[_0x2326('0x1c')]],'as':_0x320d6c['as'],'attributes':_0x320d6c[_0x2326('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2326('0x8')](function(_0x1982b1){logger[_0x2326('0x9')](_0x2326('0x1e'),_0x3fc476);logger[_0x2326('0xc')](_0x2326('0x1e'),_0x3fc476,JSON[_0x2326('0x1d')](_0x1982b1));_0x15b187(_0x1982b1);})[_0x2326('0x12')](function(_0x1149af){logger[_0x2326('0xe')](_0x2326('0x1e'),_0x1149af[_0x2326('0x10')],_0x3fc476);_0x4cb4b9(_0x3987eb[_0x2326('0xe')](0x1f4,_0x1149af[_0x2326('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 9bd7bbf..00586a7 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 _0x90b1=['get','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x90b1,0x1bb));var _0x190b=function(_0x3b37d0,_0x5e3d41){_0x3b37d0=_0x3b37d0-0x0;var _0x4987b6=_0x90b1[_0x3b37d0];return _0x4987b6;};'use strict';var multer=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var path=require(_0x190b('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x190b('0x3')]();var auth=require(_0x190b('0x4'));var interaction=require(_0x190b('0x5'));var config=require(_0x190b('0x6'));var controller=require('./intDeskConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x190b('0x7')](_0x190b('0x8'),auth[_0x190b('0x9')](),controller[_0x190b('0xa')]);router[_0x190b('0x7')](_0x190b('0xb'),auth[_0x190b('0x9')](),controller['getFields']);router[_0x190b('0x7')](_0x190b('0xc'),auth[_0x190b('0x9')](),controller[_0x190b('0xd')]);router[_0x190b('0x7')](_0x190b('0xe'),auth[_0x190b('0x9')](),controller[_0x190b('0xf')]);router['get'](_0x190b('0x10'),auth[_0x190b('0x9')](),controller['getTags']);router[_0x190b('0x11')]('/',auth[_0x190b('0x9')](),controller[_0x190b('0x12')]);router[_0x190b('0x11')](_0x190b('0x10'),auth[_0x190b('0x9')](),controller[_0x190b('0x13')]);router[_0x190b('0x14')](_0x190b('0x8'),auth[_0x190b('0x9')](),controller[_0x190b('0x15')]);router[_0x190b('0x16')](_0x190b('0x8'),auth[_0x190b('0x9')](),controller[_0x190b('0x17')]);module[_0x190b('0x18')]=router; \ No newline at end of file +var _0xf55c=['getDescriptions','getTags','post','create','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x5dfa40,_0x5b97bd){var _0x4defd3=function(_0x585404){while(--_0x585404){_0x5dfa40['push'](_0x5dfa40['shift']());}};_0x4defd3(++_0x5b97bd);}(_0xf55c,0x1e7));var _0xcf55=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xf55c[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0xcf55('0x0'));var util=require('util');var path=require(_0xcf55('0x1'));var timeout=require(_0xcf55('0x2'));var express=require(_0xcf55('0x3'));var router=express[_0xcf55('0x4')]();var auth=require(_0xcf55('0x5'));var interaction=require(_0xcf55('0x6'));var config=require(_0xcf55('0x7'));var controller=require('./intDeskConfiguration.controller');router[_0xcf55('0x8')]('/',auth[_0xcf55('0x9')](),controller[_0xcf55('0xa')]);router[_0xcf55('0x8')]('/:id',auth[_0xcf55('0x9')](),controller[_0xcf55('0xb')]);router[_0xcf55('0x8')](_0xcf55('0xc'),auth['isAuthenticated'](),controller[_0xcf55('0xd')]);router[_0xcf55('0x8')](_0xcf55('0xe'),auth[_0xcf55('0x9')](),controller[_0xcf55('0xf')]);router[_0xcf55('0x8')](_0xcf55('0x10'),auth['isAuthenticated'](),controller[_0xcf55('0x11')]);router[_0xcf55('0x8')]('/:id/tags',auth['isAuthenticated'](),controller[_0xcf55('0x12')]);router[_0xcf55('0x13')]('/',auth[_0xcf55('0x9')](),controller[_0xcf55('0x14')]);router[_0xcf55('0x13')](_0xcf55('0x15'),auth[_0xcf55('0x9')](),controller[_0xcf55('0x16')]);router[_0xcf55('0x17')](_0xcf55('0x18'),auth[_0xcf55('0x9')](),controller[_0xcf55('0x19')]);router['delete'](_0xcf55('0x18'),auth[_0xcf55('0x9')](),controller[_0xcf55('0x1a')]);module[_0xcf55('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 69aa578..588ddda 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 _0x28c2=['exports','STRING','sequelize'];(function(_0x113982,_0x597be2){var _0x13ff92=function(_0x344be9){while(--_0x344be9){_0x113982['push'](_0x113982['shift']());}};_0x13ff92(++_0x597be2);}(_0x28c2,0x1cd));var _0x228c=function(_0x56dd9e,_0x54d1c5){_0x56dd9e=_0x56dd9e-0x0;var _0x16d79b=_0x28c2[_0x56dd9e];return _0x16d79b;};'use strict';var Sequelize=require(_0x228c('0x0'));module[_0x228c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x228c('0x2')]}}; \ No newline at end of file +var _0xcdd0=['STRING','exports'];(function(_0x559d5d,_0x5f1c68){var _0x596416=function(_0x30affd){while(--_0x30affd){_0x559d5d['push'](_0x559d5d['shift']());}};_0x596416(++_0x5f1c68);}(_0xcdd0,0xf1));var _0x0cdd=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xcdd0[_0x334841];return _0x5beb4b;};'use strict';var Sequelize=require('sequelize');module[_0x0cdd('0x0')]={'name':{'type':Sequelize[_0x0cdd('0x1')]},'description':{'type':Sequelize[_0x0cdd('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 2f97a01..64e1321 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 _0x7177=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','Content-Range','apply','reject','update','sendStatus','name','send','index','DeskConfiguration','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','rawAttributes','find','create','body','params','getFields','findOne','DeskField','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','html-pdf','eml-format','zip-dir','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0x7177,0x110));var _0x7717=function(_0x36103d,_0x3453b9){_0x36103d=_0x36103d-0x0;var _0x4edadd=_0x7177[_0x36103d];return _0x4edadd;};'use strict';var pdf=require(_0x7717('0x0'));var emlformat=require(_0x7717('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7717('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7717('0x3'));var BPromise=require(_0x7717('0x4'));var Mustache=require(_0x7717('0x5'));var util=require(_0x7717('0x6'));var path=require(_0x7717('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7717('0x8'));var fs=require('fs');var _=require(_0x7717('0x9'));var squel=require(_0x7717('0xa'));var crypto=require(_0x7717('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7717('0xc'));var toCsv=require(_0x7717('0xd'));var querystring=require(_0x7717('0xe'));var Papa=require(_0x7717('0xf'));var Redis=require(_0x7717('0x10'));var authService=require(_0x7717('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7717('0x12'));var hardwareService=require(_0x7717('0x13'));var logger=require(_0x7717('0x14'))(_0x7717('0x15'));var utils=require(_0x7717('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7717('0x17'))['db'];var jayson=require(_0x7717('0x18'));var client=jayson[_0x7717('0x19')][_0x7717('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x26907d,_0x4f7729,_0x49d5c5,_0x112970){return new BPromise(function(_0x1d1d67,_0x2f8caf){var _0x3e2b89=_0x112970||client;return _0x3e2b89[_0x7717('0x1b')](_0x26907d,_0x49d5c5)[_0x7717('0x1c')](function(_0x294dbe){logger[_0x7717('0x1d')](_0x7717('0x1e'),_0x4f7729,_0x7717('0x1f'));logger[_0x7717('0x20')](_0x7717('0x21'),_0x4f7729,_0x7717('0x1f'),JSON[_0x7717('0x22')](_0x294dbe));if(_0x294dbe['error']){if(_0x294dbe[_0x7717('0x23')][_0x7717('0x24')]===0x1f4){logger[_0x7717('0x23')](_0x7717('0x1e'),_0x4f7729,_0x294dbe[_0x7717('0x23')][_0x7717('0x25')]);return _0x2f8caf(_0x294dbe[_0x7717('0x23')][_0x7717('0x25')]);}logger[_0x7717('0x23')]('DeskConfiguration,\x20%s,\x20%s',_0x4f7729,_0x294dbe['error'][_0x7717('0x25')]);return _0x1d1d67(_0x294dbe[_0x7717('0x23')][_0x7717('0x25')]);}else{logger[_0x7717('0x1d')](_0x7717('0x1e'),_0x4f7729,_0x7717('0x1f'));_0x1d1d67(_0x294dbe[_0x7717('0x26')][_0x7717('0x25')]);}})[_0x7717('0x27')](function(_0x32dd68){logger[_0x7717('0x23')]('DeskConfiguration,\x20%s,\x20%s',_0x4f7729,_0x32dd68);_0x2f8caf(_0x32dd68);});});}function respondWithStatusCode(_0x3dfe2b,_0x523ca6){_0x523ca6=_0x523ca6||0xcc;return function(_0x1bca47){if(_0x1bca47){return _0x3dfe2b['sendStatus'](_0x523ca6);}return _0x3dfe2b[_0x7717('0x28')](_0x523ca6)[_0x7717('0x29')]();};}function respondWithResult(_0x16861c,_0x4d9362){_0x4d9362=_0x4d9362||0xc8;return function(_0x4177be){if(_0x4177be){return _0x16861c[_0x7717('0x28')](_0x4d9362)[_0x7717('0x2a')](_0x4177be);}};}function respondWithFilteredResult(_0x163fff,_0x139936){return function(_0x55a0bb){if(_0x55a0bb){var _0x41515e=_0x55a0bb[_0x7717('0x2b')],_0x1e8350=_0x139936[_0x7717('0x2c')],_0x3e8c71=_0x139936['offset']+_0x139936[_0x7717('0x2d')],_0x48d995;if(_0x3e8c71>=_0x41515e){_0x3e8c71=_0x41515e;_0x48d995=0xc8;}else{_0x48d995=0xce;}_0x163fff['status'](_0x48d995);return _0x163fff['set'](_0x7717('0x2e'),_0x1e8350+'-'+_0x3e8c71+'/'+_0x41515e)[_0x7717('0x2a')](_0x55a0bb);}return null;};}function patchUpdates(_0x4cfdeb){return function(_0x284c57){try{jsonpatch[_0x7717('0x2f')](_0x284c57,_0x4cfdeb,!![]);}catch(_0x10f014){return BPromise[_0x7717('0x30')](_0x10f014);}return _0x284c57['save']();};}function saveUpdates(_0x5c774b,_0x4a66d5){return function(_0x44c3de){if(_0x44c3de){return _0x44c3de[_0x7717('0x31')](_0x5c774b)['then'](function(_0x364647){return _0x364647;});}return null;};}function removeEntity(_0x4f8fb2,_0x2729d6){return function(_0x4a4948){if(_0x4a4948){return _0x4a4948['destroy']()['then'](function(){_0x4f8fb2['status'](0xcc)[_0x7717('0x29')]();});}};}function handleEntityNotFound(_0x399d3e,_0x31fda4){return function(_0x1b2e6f){if(!_0x1b2e6f){_0x399d3e[_0x7717('0x32')](0x194);}return _0x1b2e6f;};}function handleError(_0x144c75,_0x51ba6f){_0x51ba6f=_0x51ba6f||0x1f4;return function(_0x9fa110){logger[_0x7717('0x23')](_0x9fa110['stack']);if(_0x9fa110['name']){delete _0x9fa110[_0x7717('0x33')];}_0x144c75[_0x7717('0x28')](_0x51ba6f)[_0x7717('0x34')](_0x9fa110);};}exports[_0x7717('0x35')]=function(_0x53c2e3,_0x5d7e8f){var _0xb1bd75={},_0x9545ed={},_0x3e50fc={'count':0x0,'rows':[]};var _0x41c8c5=_['map'](db[_0x7717('0x36')]['rawAttributes'],function(_0x300544){return{'name':_0x300544[_0x7717('0x37')],'type':_0x300544[_0x7717('0x38')][_0x7717('0x39')]};});_0x9545ed['model']=_[_0x7717('0x3a')](_0x41c8c5,'name');_0x9545ed[_0x7717('0x3b')]=_[_0x7717('0x3c')](_0x53c2e3[_0x7717('0x3b')]);_0x9545ed[_0x7717('0x3d')]=_[_0x7717('0x3e')](_0x9545ed['model'],_0x9545ed[_0x7717('0x3b')]);_0xb1bd75[_0x7717('0x3f')]=_[_0x7717('0x3e')](_0x9545ed[_0x7717('0x40')],qs[_0x7717('0x41')](_0x53c2e3[_0x7717('0x3b')][_0x7717('0x41')]));_0xb1bd75[_0x7717('0x3f')]=_0xb1bd75['attributes'][_0x7717('0x42')]?_0xb1bd75[_0x7717('0x3f')]:_0x9545ed[_0x7717('0x40')];if(!_0x53c2e3[_0x7717('0x3b')][_0x7717('0x43')](_0x7717('0x44'))){_0xb1bd75[_0x7717('0x2d')]=qs[_0x7717('0x2d')](_0x53c2e3['query']['limit']);_0xb1bd75[_0x7717('0x2c')]=qs['offset'](_0x53c2e3[_0x7717('0x3b')][_0x7717('0x2c')]);}_0xb1bd75[_0x7717('0x45')]=qs[_0x7717('0x46')](_0x53c2e3['query'][_0x7717('0x46')]);_0xb1bd75[_0x7717('0x47')]=qs[_0x7717('0x3d')](_['pick'](_0x53c2e3[_0x7717('0x3b')],_0x9545ed[_0x7717('0x3d')]),_0x41c8c5);if(_0x53c2e3[_0x7717('0x3b')][_0x7717('0x48')]){_0xb1bd75[_0x7717('0x47')]=_[_0x7717('0x49')](_0xb1bd75['where'],{'$or':_[_0x7717('0x3a')](_0x41c8c5,function(_0x28ac34){if(_0x28ac34['type']!==_0x7717('0x4a')){var _0x46556d={};_0x46556d[_0x28ac34['name']]={'$like':'%'+_0x53c2e3[_0x7717('0x3b')][_0x7717('0x48')]+'%'};return _0x46556d;}})});}_0xb1bd75=_[_0x7717('0x49')]({},_0xb1bd75,_0x53c2e3[_0x7717('0x4b')]);var _0xdab222={'where':_0xb1bd75[_0x7717('0x47')]};return db[_0x7717('0x36')][_0x7717('0x2b')](_0xdab222)[_0x7717('0x1c')](function(_0x57f49c){_0x3e50fc[_0x7717('0x2b')]=_0x57f49c;if(_0x53c2e3[_0x7717('0x3b')][_0x7717('0x4c')]){_0xb1bd75[_0x7717('0x4d')]=[{'all':!![]}];}return db[_0x7717('0x36')][_0x7717('0x4e')](_0xb1bd75);})[_0x7717('0x1c')](function(_0x4b4acb){_0x3e50fc['rows']=_0x4b4acb;return _0x3e50fc;})[_0x7717('0x1c')](respondWithFilteredResult(_0x5d7e8f,_0xb1bd75))[_0x7717('0x27')](handleError(_0x5d7e8f,null));};exports[_0x7717('0x4f')]=function(_0x1a5ca3,_0x2a5f50){var _0x4f28d4={'raw':![],'where':{'id':_0x1a5ca3['params']['id']}},_0x52ceac={};_0x52ceac['model']=_[_0x7717('0x3c')](db[_0x7717('0x36')][_0x7717('0x50')]);_0x52ceac['query']=_[_0x7717('0x3c')](_0x1a5ca3[_0x7717('0x3b')]);_0x52ceac[_0x7717('0x3d')]=_[_0x7717('0x3e')](_0x52ceac['model'],_0x52ceac[_0x7717('0x3b')]);_0x4f28d4[_0x7717('0x3f')]=_[_0x7717('0x3e')](_0x52ceac[_0x7717('0x40')],qs[_0x7717('0x41')](_0x1a5ca3[_0x7717('0x3b')]['fields']));_0x4f28d4[_0x7717('0x3f')]=_0x4f28d4[_0x7717('0x3f')][_0x7717('0x42')]?_0x4f28d4['attributes']:_0x52ceac['model'];if(_0x1a5ca3[_0x7717('0x3b')][_0x7717('0x4c')]){_0x4f28d4[_0x7717('0x4d')]=[{'all':!![]}];}_0x4f28d4=_[_0x7717('0x49')]({},_0x4f28d4,_0x1a5ca3[_0x7717('0x4b')]);return db[_0x7717('0x36')][_0x7717('0x51')](_0x4f28d4)[_0x7717('0x1c')](handleEntityNotFound(_0x2a5f50,null))['then'](respondWithResult(_0x2a5f50,null))['catch'](handleError(_0x2a5f50,null));};exports[_0x7717('0x52')]=function(_0x5490fb,_0x5996c2){return db['DeskConfiguration'][_0x7717('0x52')](_0x5490fb['body'],{})[_0x7717('0x1c')](respondWithResult(_0x5996c2,0xc9))[_0x7717('0x27')](handleError(_0x5996c2,null));};exports[_0x7717('0x31')]=function(_0x970396,_0x324d76){if(_0x970396['body']['id']){delete _0x970396[_0x7717('0x53')]['id'];}return db[_0x7717('0x36')][_0x7717('0x51')]({'where':{'id':_0x970396[_0x7717('0x54')]['id']}})[_0x7717('0x1c')](handleEntityNotFound(_0x324d76,null))[_0x7717('0x1c')](saveUpdates(_0x970396[_0x7717('0x53')],null))[_0x7717('0x1c')](respondWithResult(_0x324d76,null))['catch'](handleError(_0x324d76,null));};exports['destroy']=function(_0x4b0b90,_0x48b456){return db[_0x7717('0x36')][_0x7717('0x51')]({'where':{'id':_0x4b0b90[_0x7717('0x54')]['id']}})[_0x7717('0x1c')](handleEntityNotFound(_0x48b456,null))[_0x7717('0x1c')](removeEntity(_0x48b456,null))['catch'](handleError(_0x48b456,null));};exports[_0x7717('0x55')]=function(_0x4011cd,_0x1e8efa,_0x3f54f3){var _0x38bfe={};var _0x3cf21a={};var _0x39d152;var _0x3f0263;return db['DeskConfiguration'][_0x7717('0x56')]({'where':{'id':_0x4011cd['params']['id']}})[_0x7717('0x1c')](handleEntityNotFound(_0x1e8efa,null))[_0x7717('0x1c')](function(_0x1eb607){if(_0x1eb607){_0x39d152=_0x1eb607;_0x3cf21a[_0x7717('0x40')]=_['keys'](db[_0x7717('0x57')][_0x7717('0x50')]);_0x3cf21a[_0x7717('0x3b')]=_[_0x7717('0x3c')](_0x4011cd[_0x7717('0x3b')]);_0x3cf21a[_0x7717('0x3d')]=_[_0x7717('0x3e')](_0x3cf21a['model'],_0x3cf21a['query']);_0x38bfe[_0x7717('0x3f')]=_[_0x7717('0x3e')](_0x3cf21a[_0x7717('0x40')],qs[_0x7717('0x41')](_0x4011cd[_0x7717('0x3b')]['fields']));_0x38bfe[_0x7717('0x3f')]=_0x38bfe[_0x7717('0x3f')][_0x7717('0x42')]?_0x38bfe['attributes']:_0x3cf21a[_0x7717('0x40')];_0x38bfe[_0x7717('0x45')]=qs['sort'](_0x4011cd[_0x7717('0x3b')][_0x7717('0x46')]);_0x38bfe['where']=qs[_0x7717('0x3d')](_[_0x7717('0x58')](_0x4011cd[_0x7717('0x3b')],_0x3cf21a[_0x7717('0x3d')]));if(_0x4011cd[_0x7717('0x3b')]['filter']){_0x38bfe['where']=_['merge'](_0x38bfe[_0x7717('0x47')],{'$or':_[_0x7717('0x3a')](_0x38bfe[_0x7717('0x3f')],function(_0x31a59b){var _0x258616={};_0x258616[_0x31a59b]={'$like':'%'+_0x4011cd['query'][_0x7717('0x48')]+'%'};return _0x258616;})});}_0x38bfe=_['merge']({},_0x38bfe,_0x4011cd[_0x7717('0x4b')]);return _0x39d152[_0x7717('0x55')](_0x38bfe);}})[_0x7717('0x1c')](function(_0x404818){if(_0x404818){_0x3f0263=_0x404818['length'];if(!_0x4011cd[_0x7717('0x3b')][_0x7717('0x43')](_0x7717('0x44'))){_0x38bfe['limit']=qs[_0x7717('0x2d')](_0x4011cd['query'][_0x7717('0x2d')]);_0x38bfe[_0x7717('0x2c')]=qs[_0x7717('0x2c')](_0x4011cd[_0x7717('0x3b')][_0x7717('0x2c')]);}return _0x39d152[_0x7717('0x55')](_0x38bfe);}})[_0x7717('0x1c')](function(_0x350d9f){if(_0x350d9f){return _0x350d9f?{'count':_0x3f0263,'rows':_0x350d9f}:null;}})[_0x7717('0x1c')](respondWithResult(_0x1e8efa,null))['catch'](handleError(_0x1e8efa,null));};exports[_0x7717('0x59')]=function(_0x3cf94d,_0x277c20,_0x12d44a){var _0x16fd9d={};var _0x1b7fb6={};var _0x10b0b3;var _0xcd1bd4;return db[_0x7717('0x36')]['findOne']({'where':{'id':_0x3cf94d[_0x7717('0x54')]['id']}})['then'](handleEntityNotFound(_0x277c20,null))[_0x7717('0x1c')](function(_0x1b257b){if(_0x1b257b){_0x10b0b3=_0x1b257b;_0x1b7fb6['model']=_[_0x7717('0x3c')](db[_0x7717('0x57')]['rawAttributes']);_0x1b7fb6[_0x7717('0x3b')]=_[_0x7717('0x3c')](_0x3cf94d[_0x7717('0x3b')]);_0x1b7fb6[_0x7717('0x3d')]=_[_0x7717('0x3e')](_0x1b7fb6['model'],_0x1b7fb6[_0x7717('0x3b')]);_0x16fd9d[_0x7717('0x3f')]=_['intersection'](_0x1b7fb6[_0x7717('0x40')],qs[_0x7717('0x41')](_0x3cf94d['query'][_0x7717('0x41')]));_0x16fd9d[_0x7717('0x3f')]=_0x16fd9d[_0x7717('0x3f')][_0x7717('0x42')]?_0x16fd9d[_0x7717('0x3f')]:_0x1b7fb6[_0x7717('0x40')];_0x16fd9d[_0x7717('0x45')]=qs[_0x7717('0x46')](_0x3cf94d['query']['sort']);_0x16fd9d[_0x7717('0x47')]=qs[_0x7717('0x3d')](_['pick'](_0x3cf94d[_0x7717('0x3b')],_0x1b7fb6[_0x7717('0x3d')]));if(_0x3cf94d['query'][_0x7717('0x48')]){_0x16fd9d[_0x7717('0x47')]=_[_0x7717('0x49')](_0x16fd9d[_0x7717('0x47')],{'$or':_[_0x7717('0x3a')](_0x16fd9d[_0x7717('0x3f')],function(_0x1812fb){var _0x4b0209={};_0x4b0209[_0x1812fb]={'$like':'%'+_0x3cf94d[_0x7717('0x3b')][_0x7717('0x48')]+'%'};return _0x4b0209;})});}_0x16fd9d=_['merge']({},_0x16fd9d,_0x3cf94d[_0x7717('0x4b')]);return _0x10b0b3[_0x7717('0x59')](_0x16fd9d);}})[_0x7717('0x1c')](function(_0xc5ff07){if(_0xc5ff07){_0xcd1bd4=_0xc5ff07[_0x7717('0x42')];if(!_0x3cf94d['query']['hasOwnProperty'](_0x7717('0x44'))){_0x16fd9d[_0x7717('0x2d')]=qs[_0x7717('0x2d')](_0x3cf94d[_0x7717('0x3b')][_0x7717('0x2d')]);_0x16fd9d[_0x7717('0x2c')]=qs[_0x7717('0x2c')](_0x3cf94d[_0x7717('0x3b')][_0x7717('0x2c')]);}return _0x10b0b3[_0x7717('0x59')](_0x16fd9d);}})['then'](function(_0x4b5558){if(_0x4b5558){return _0x4b5558?{'count':_0xcd1bd4,'rows':_0x4b5558}:null;}})[_0x7717('0x1c')](respondWithResult(_0x277c20,null))[_0x7717('0x27')](handleError(_0x277c20,null));};exports[_0x7717('0x5a')]=function(_0x11fa2f,_0x178943,_0x3a3722){var _0x3dec08={};var _0x2e7a57={};var _0x4362cf;var _0x38e3d5;return db[_0x7717('0x36')][_0x7717('0x56')]({'where':{'id':_0x11fa2f[_0x7717('0x54')]['id']}})[_0x7717('0x1c')](handleEntityNotFound(_0x178943,null))[_0x7717('0x1c')](function(_0x469322){if(_0x469322){_0x4362cf=_0x469322;_0x2e7a57['model']=_[_0x7717('0x3c')](db['DeskField'][_0x7717('0x50')]);_0x2e7a57['query']=_[_0x7717('0x3c')](_0x11fa2f[_0x7717('0x3b')]);_0x2e7a57[_0x7717('0x3d')]=_[_0x7717('0x3e')](_0x2e7a57[_0x7717('0x40')],_0x2e7a57[_0x7717('0x3b')]);_0x3dec08[_0x7717('0x3f')]=_['intersection'](_0x2e7a57[_0x7717('0x40')],qs[_0x7717('0x41')](_0x11fa2f[_0x7717('0x3b')][_0x7717('0x41')]));_0x3dec08[_0x7717('0x3f')]=_0x3dec08[_0x7717('0x3f')][_0x7717('0x42')]?_0x3dec08[_0x7717('0x3f')]:_0x2e7a57[_0x7717('0x40')];_0x3dec08['order']=qs[_0x7717('0x46')](_0x11fa2f['query']['sort']);_0x3dec08['where']=qs[_0x7717('0x3d')](_[_0x7717('0x58')](_0x11fa2f[_0x7717('0x3b')],_0x2e7a57['filters']));if(_0x11fa2f[_0x7717('0x3b')][_0x7717('0x48')]){_0x3dec08[_0x7717('0x47')]=_[_0x7717('0x49')](_0x3dec08[_0x7717('0x47')],{'$or':_[_0x7717('0x3a')](_0x3dec08[_0x7717('0x3f')],function(_0x2d041c){var _0x232525={};_0x232525[_0x2d041c]={'$like':'%'+_0x11fa2f[_0x7717('0x3b')][_0x7717('0x48')]+'%'};return _0x232525;})});}_0x3dec08=_['merge']({},_0x3dec08,_0x11fa2f[_0x7717('0x4b')]);return _0x4362cf['getDescriptions'](_0x3dec08);}})[_0x7717('0x1c')](function(_0x37fddc){if(_0x37fddc){_0x38e3d5=_0x37fddc[_0x7717('0x42')];if(!_0x11fa2f[_0x7717('0x3b')][_0x7717('0x43')](_0x7717('0x44'))){_0x3dec08['limit']=qs[_0x7717('0x2d')](_0x11fa2f['query'][_0x7717('0x2d')]);_0x3dec08['offset']=qs['offset'](_0x11fa2f['query'][_0x7717('0x2c')]);}return _0x4362cf[_0x7717('0x5a')](_0x3dec08);}})[_0x7717('0x1c')](function(_0x401850){if(_0x401850){return _0x401850?{'count':_0x38e3d5,'rows':_0x401850}:null;}})[_0x7717('0x1c')](respondWithResult(_0x178943,null))[_0x7717('0x27')](handleError(_0x178943,null));};exports[_0x7717('0x5b')]=function(_0x18b331,_0x3b2015,_0x3b3000){var _0x4898da={};var _0x20929b={};var _0x4d13de;var _0xabb919;return db['DeskConfiguration'][_0x7717('0x56')]({'where':{'id':_0x18b331[_0x7717('0x54')]['id']}})[_0x7717('0x1c')](handleEntityNotFound(_0x3b2015,null))['then'](function(_0x200760){if(_0x200760){_0x4d13de=_0x200760;_0x20929b[_0x7717('0x40')]=_[_0x7717('0x3c')](db[_0x7717('0x5c')][_0x7717('0x50')]);_0x20929b['query']=_['keys'](_0x18b331[_0x7717('0x3b')]);_0x20929b['filters']=_['intersection'](_0x20929b[_0x7717('0x40')],_0x20929b['query']);_0x4898da['attributes']=_[_0x7717('0x3e')](_0x20929b[_0x7717('0x40')],qs[_0x7717('0x41')](_0x18b331[_0x7717('0x3b')][_0x7717('0x41')]));_0x4898da['attributes']=_0x4898da['attributes']['length']?_0x4898da['attributes']:_0x20929b[_0x7717('0x40')];_0x4898da[_0x7717('0x45')]=qs[_0x7717('0x46')](_0x18b331[_0x7717('0x3b')][_0x7717('0x46')]);_0x4898da[_0x7717('0x47')]=qs['filters'](_['pick'](_0x18b331[_0x7717('0x3b')],_0x20929b[_0x7717('0x3d')]));if(_0x18b331[_0x7717('0x3b')][_0x7717('0x48')]){_0x4898da[_0x7717('0x47')]=_[_0x7717('0x49')](_0x4898da[_0x7717('0x47')],{'$or':_[_0x7717('0x3a')](_0x4898da['attributes'],function(_0x2f1788){var _0x9733b9={};_0x9733b9[_0x2f1788]={'$like':'%'+_0x18b331[_0x7717('0x3b')][_0x7717('0x48')]+'%'};return _0x9733b9;})});}_0x4898da=_[_0x7717('0x49')]({},_0x4898da,_0x18b331[_0x7717('0x4b')]);return _0x4d13de[_0x7717('0x5b')](_0x4898da);}})[_0x7717('0x1c')](function(_0x13bd74){if(_0x13bd74){_0xabb919=_0x13bd74['length'];if(!_0x18b331[_0x7717('0x3b')][_0x7717('0x43')](_0x7717('0x44'))){_0x4898da[_0x7717('0x2d')]=qs[_0x7717('0x2d')](_0x18b331['query']['limit']);_0x4898da[_0x7717('0x2c')]=qs[_0x7717('0x2c')](_0x18b331['query'][_0x7717('0x2c')]);}return _0x4d13de[_0x7717('0x5b')](_0x4898da);}})['then'](function(_0x583094){if(_0x583094){return _0x583094?{'count':_0xabb919,'rows':_0x583094}:null;}})['then'](respondWithResult(_0x3b2015,null))[_0x7717('0x27')](handleError(_0x3b2015,null));};exports[_0x7717('0x5d')]=function(_0x5b8055,_0x451091,_0x21ead4){if(_0x5b8055['body']['id']){delete _0x5b8055['body']['id'];}return db[_0x7717('0x36')][_0x7717('0x56')]({'where':{'id':_0x5b8055[_0x7717('0x54')]['id']}})['then'](handleEntityNotFound(_0x451091,null))['then'](function(_0x36dbb1){if(_0x36dbb1){return _0x36dbb1[_0x7717('0x5d')](_0x5b8055[_0x7717('0x53')][_0x7717('0x5e')]||[]);}return null;})[_0x7717('0x1c')](respondWithResult(_0x451091,null))[_0x7717('0x27')](handleError(_0x451091,null));}; \ No newline at end of file +var _0x584f=['set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','DeskConfiguration','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','length','include','find','create','body','findOne','getFields','hasOwnProperty','getSubjects','DeskField','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x584f,0x1aa));var _0xf584=function(_0x10a19a,_0x1a45ec){_0x10a19a=_0x10a19a-0x0;var _0x3f7183=_0x584f[_0x10a19a];return _0x3f7183;};'use strict';var pdf=require(_0xf584('0x0'));var emlformat=require(_0xf584('0x1'));var rimraf=require(_0xf584('0x2'));var zipdir=require(_0xf584('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf584('0x4'));var moment=require(_0xf584('0x5'));var BPromise=require(_0xf584('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf584('0x7'));var sox=require(_0xf584('0x8'));var csv=require(_0xf584('0x9'));var ejs=require(_0xf584('0xa'));var fs=require('fs');var _=require(_0xf584('0xb'));var squel=require('squel');var crypto=require(_0xf584('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf584('0xd'));var toCsv=require(_0xf584('0x9'));var querystring=require(_0xf584('0xe'));var Papa=require(_0xf584('0xf'));var Redis=require(_0xf584('0x10'));var authService=require(_0xf584('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf584('0x12'));var hardwareService=require(_0xf584('0x13'));var logger=require(_0xf584('0x14'))(_0xf584('0x15'));var utils=require(_0xf584('0x16'));var config=require(_0xf584('0x17'));var licenseUtil=require(_0xf584('0x18'));var db=require(_0xf584('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xf584('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5d9f2d,_0x18de19,_0x1e4a87,_0x4815d4){return new BPromise(function(_0x5a04d9,_0x22d915){var _0x1bbf1c=_0x4815d4||client;return _0x1bbf1c[_0xf584('0x1b')](_0x5d9f2d,_0x1e4a87)[_0xf584('0x1c')](function(_0x201319){logger[_0xf584('0x1d')](_0xf584('0x1e'),_0x18de19,_0xf584('0x1f'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x18de19,_0xf584('0x1f'),JSON[_0xf584('0x20')](_0x201319));if(_0x201319['error']){if(_0x201319['error']['code']===0x1f4){logger[_0xf584('0x21')](_0xf584('0x1e'),_0x18de19,_0x201319['error'][_0xf584('0x22')]);return _0x22d915(_0x201319[_0xf584('0x21')][_0xf584('0x22')]);}logger[_0xf584('0x21')](_0xf584('0x1e'),_0x18de19,_0x201319[_0xf584('0x21')][_0xf584('0x22')]);return _0x5a04d9(_0x201319[_0xf584('0x21')][_0xf584('0x22')]);}else{logger[_0xf584('0x1d')](_0xf584('0x1e'),_0x18de19,'request\x20sent');_0x5a04d9(_0x201319[_0xf584('0x23')][_0xf584('0x22')]);}})[_0xf584('0x24')](function(_0x1f3858){logger[_0xf584('0x21')](_0xf584('0x1e'),_0x18de19,_0x1f3858);_0x22d915(_0x1f3858);});});}function respondWithStatusCode(_0x1fb237,_0x3bd5a0){_0x3bd5a0=_0x3bd5a0||0xcc;return function(_0x4ec5fa){if(_0x4ec5fa){return _0x1fb237[_0xf584('0x25')](_0x3bd5a0);}return _0x1fb237[_0xf584('0x26')](_0x3bd5a0)[_0xf584('0x27')]();};}function respondWithResult(_0x5c9876,_0x285db2){_0x285db2=_0x285db2||0xc8;return function(_0x37f0a3){if(_0x37f0a3){return _0x5c9876['status'](_0x285db2)[_0xf584('0x28')](_0x37f0a3);}};}function respondWithFilteredResult(_0x386306,_0x3074b3){return function(_0x457d10){if(_0x457d10){var _0x59935d=_0x457d10[_0xf584('0x29')],_0x4e3a2b=_0x3074b3[_0xf584('0x2a')],_0x5e1726=_0x3074b3[_0xf584('0x2a')]+_0x3074b3[_0xf584('0x2b')],_0x223abf;if(_0x5e1726>=_0x59935d){_0x5e1726=_0x59935d;_0x223abf=0xc8;}else{_0x223abf=0xce;}_0x386306[_0xf584('0x26')](_0x223abf);return _0x386306[_0xf584('0x2c')](_0xf584('0x2d'),_0x4e3a2b+'-'+_0x5e1726+'/'+_0x59935d)[_0xf584('0x28')](_0x457d10);}return null;};}function patchUpdates(_0x1c5de3){return function(_0x5cc140){try{jsonpatch[_0xf584('0x2e')](_0x5cc140,_0x1c5de3,!![]);}catch(_0x1c4234){return BPromise[_0xf584('0x2f')](_0x1c4234);}return _0x5cc140[_0xf584('0x30')]();};}function saveUpdates(_0x231bea,_0x428222){return function(_0x34e444){if(_0x34e444){return _0x34e444[_0xf584('0x31')](_0x231bea)[_0xf584('0x1c')](function(_0x172884){return _0x172884;});}return null;};}function removeEntity(_0x3e52bd,_0x4f41c8){return function(_0x243221){if(_0x243221){return _0x243221[_0xf584('0x32')]()[_0xf584('0x1c')](function(){_0x3e52bd['status'](0xcc)[_0xf584('0x27')]();});}};}function handleEntityNotFound(_0x380657,_0x15048c){return function(_0x34f084){if(!_0x34f084){_0x380657[_0xf584('0x25')](0x194);}return _0x34f084;};}function handleError(_0x4bfc03,_0x58a8f2){_0x58a8f2=_0x58a8f2||0x1f4;return function(_0x42e0fe){logger['error'](_0x42e0fe['stack']);if(_0x42e0fe[_0xf584('0x33')]){delete _0x42e0fe[_0xf584('0x33')];}_0x4bfc03[_0xf584('0x26')](_0x58a8f2)[_0xf584('0x34')](_0x42e0fe);};}exports[_0xf584('0x35')]=function(_0x39ddec,_0x21e564){var _0x25dc5f={},_0x45d33a={},_0x17999f={'count':0x0,'rows':[]};var _0x52ce4a=_[_0xf584('0x36')](db[_0xf584('0x37')][_0xf584('0x38')],function(_0x211bb6){return{'name':_0x211bb6['fieldName'],'type':_0x211bb6[_0xf584('0x39')][_0xf584('0x3a')]};});_0x45d33a[_0xf584('0x3b')]=_[_0xf584('0x36')](_0x52ce4a,_0xf584('0x33'));_0x45d33a['query']=_['keys'](_0x39ddec[_0xf584('0x3c')]);_0x45d33a[_0xf584('0x3d')]=_[_0xf584('0x3e')](_0x45d33a[_0xf584('0x3b')],_0x45d33a['query']);_0x25dc5f['attributes']=_[_0xf584('0x3e')](_0x45d33a[_0xf584('0x3b')],qs[_0xf584('0x3f')](_0x39ddec['query'][_0xf584('0x3f')]));_0x25dc5f[_0xf584('0x40')]=_0x25dc5f[_0xf584('0x40')]['length']?_0x25dc5f['attributes']:_0x45d33a[_0xf584('0x3b')];if(!_0x39ddec[_0xf584('0x3c')]['hasOwnProperty'](_0xf584('0x41'))){_0x25dc5f[_0xf584('0x2b')]=qs[_0xf584('0x2b')](_0x39ddec[_0xf584('0x3c')]['limit']);_0x25dc5f['offset']=qs[_0xf584('0x2a')](_0x39ddec[_0xf584('0x3c')][_0xf584('0x2a')]);}_0x25dc5f[_0xf584('0x42')]=qs[_0xf584('0x43')](_0x39ddec[_0xf584('0x3c')][_0xf584('0x43')]);_0x25dc5f['where']=qs['filters'](_[_0xf584('0x44')](_0x39ddec[_0xf584('0x3c')],_0x45d33a[_0xf584('0x3d')]),_0x52ce4a);if(_0x39ddec[_0xf584('0x3c')][_0xf584('0x45')]){_0x25dc5f[_0xf584('0x46')]=_[_0xf584('0x47')](_0x25dc5f[_0xf584('0x46')],{'$or':_[_0xf584('0x36')](_0x52ce4a,function(_0x13e5bf){if(_0x13e5bf[_0xf584('0x39')]!==_0xf584('0x48')){var _0x2dbbdb={};_0x2dbbdb[_0x13e5bf[_0xf584('0x33')]]={'$like':'%'+_0x39ddec[_0xf584('0x3c')]['filter']+'%'};return _0x2dbbdb;}})});}_0x25dc5f=_[_0xf584('0x47')]({},_0x25dc5f,_0x39ddec[_0xf584('0x49')]);var _0x4edfcc={'where':_0x25dc5f[_0xf584('0x46')]};return db[_0xf584('0x37')][_0xf584('0x29')](_0x4edfcc)[_0xf584('0x1c')](function(_0x4a3bb3){_0x17999f[_0xf584('0x29')]=_0x4a3bb3;if(_0x39ddec['query'][_0xf584('0x4a')]){_0x25dc5f['include']=[{'all':!![]}];}return db[_0xf584('0x37')][_0xf584('0x4b')](_0x25dc5f);})['then'](function(_0x4643e9){_0x17999f[_0xf584('0x4c')]=_0x4643e9;return _0x17999f;})['then'](respondWithFilteredResult(_0x21e564,_0x25dc5f))[_0xf584('0x24')](handleError(_0x21e564,null));};exports[_0xf584('0x4d')]=function(_0xefa8b,_0x5470f0){var _0x20b55a={'raw':![],'where':{'id':_0xefa8b[_0xf584('0x4e')]['id']}},_0x23e0a0={};_0x23e0a0['model']=_[_0xf584('0x4f')](db[_0xf584('0x37')]['rawAttributes']);_0x23e0a0[_0xf584('0x3c')]=_['keys'](_0xefa8b[_0xf584('0x3c')]);_0x23e0a0[_0xf584('0x3d')]=_[_0xf584('0x3e')](_0x23e0a0[_0xf584('0x3b')],_0x23e0a0[_0xf584('0x3c')]);_0x20b55a[_0xf584('0x40')]=_[_0xf584('0x3e')](_0x23e0a0[_0xf584('0x3b')],qs[_0xf584('0x3f')](_0xefa8b[_0xf584('0x3c')]['fields']));_0x20b55a[_0xf584('0x40')]=_0x20b55a[_0xf584('0x40')][_0xf584('0x50')]?_0x20b55a[_0xf584('0x40')]:_0x23e0a0['model'];if(_0xefa8b['query']['includeAll']){_0x20b55a[_0xf584('0x51')]=[{'all':!![]}];}_0x20b55a=_[_0xf584('0x47')]({},_0x20b55a,_0xefa8b[_0xf584('0x49')]);return db[_0xf584('0x37')][_0xf584('0x52')](_0x20b55a)['then'](handleEntityNotFound(_0x5470f0,null))[_0xf584('0x1c')](respondWithResult(_0x5470f0,null))[_0xf584('0x24')](handleError(_0x5470f0,null));};exports[_0xf584('0x53')]=function(_0x275095,_0x32736a){return db[_0xf584('0x37')]['create'](_0x275095['body'],{})[_0xf584('0x1c')](respondWithResult(_0x32736a,0xc9))['catch'](handleError(_0x32736a,null));};exports[_0xf584('0x31')]=function(_0x3df112,_0x3b2977){if(_0x3df112[_0xf584('0x54')]['id']){delete _0x3df112['body']['id'];}return db[_0xf584('0x37')][_0xf584('0x52')]({'where':{'id':_0x3df112[_0xf584('0x4e')]['id']}})[_0xf584('0x1c')](handleEntityNotFound(_0x3b2977,null))[_0xf584('0x1c')](saveUpdates(_0x3df112[_0xf584('0x54')],null))[_0xf584('0x1c')](respondWithResult(_0x3b2977,null))[_0xf584('0x24')](handleError(_0x3b2977,null));};exports[_0xf584('0x32')]=function(_0x15225b,_0x2e1168){return db[_0xf584('0x37')][_0xf584('0x52')]({'where':{'id':_0x15225b['params']['id']}})[_0xf584('0x1c')](handleEntityNotFound(_0x2e1168,null))['then'](removeEntity(_0x2e1168,null))[_0xf584('0x24')](handleError(_0x2e1168,null));};exports['getFields']=function(_0x6d83e0,_0x11121d,_0x35d52e){var _0x47bbc6={};var _0x132b7e={};var _0x579552;var _0x249ccf;return db['DeskConfiguration'][_0xf584('0x55')]({'where':{'id':_0x6d83e0[_0xf584('0x4e')]['id']}})[_0xf584('0x1c')](handleEntityNotFound(_0x11121d,null))[_0xf584('0x1c')](function(_0x3257bc){if(_0x3257bc){_0x579552=_0x3257bc;_0x132b7e['model']=_[_0xf584('0x4f')](db['DeskField'][_0xf584('0x38')]);_0x132b7e['query']=_[_0xf584('0x4f')](_0x6d83e0[_0xf584('0x3c')]);_0x132b7e[_0xf584('0x3d')]=_[_0xf584('0x3e')](_0x132b7e['model'],_0x132b7e[_0xf584('0x3c')]);_0x47bbc6[_0xf584('0x40')]=_[_0xf584('0x3e')](_0x132b7e[_0xf584('0x3b')],qs['fields'](_0x6d83e0['query'][_0xf584('0x3f')]));_0x47bbc6[_0xf584('0x40')]=_0x47bbc6[_0xf584('0x40')][_0xf584('0x50')]?_0x47bbc6[_0xf584('0x40')]:_0x132b7e[_0xf584('0x3b')];_0x47bbc6[_0xf584('0x42')]=qs[_0xf584('0x43')](_0x6d83e0[_0xf584('0x3c')][_0xf584('0x43')]);_0x47bbc6[_0xf584('0x46')]=qs[_0xf584('0x3d')](_[_0xf584('0x44')](_0x6d83e0['query'],_0x132b7e['filters']));if(_0x6d83e0[_0xf584('0x3c')]['filter']){_0x47bbc6[_0xf584('0x46')]=_['merge'](_0x47bbc6[_0xf584('0x46')],{'$or':_[_0xf584('0x36')](_0x47bbc6[_0xf584('0x40')],function(_0x4dc897){var _0x1b1281={};_0x1b1281[_0x4dc897]={'$like':'%'+_0x6d83e0['query']['filter']+'%'};return _0x1b1281;})});}_0x47bbc6=_[_0xf584('0x47')]({},_0x47bbc6,_0x6d83e0['options']);return _0x579552[_0xf584('0x56')](_0x47bbc6);}})['then'](function(_0x41066f){if(_0x41066f){_0x249ccf=_0x41066f[_0xf584('0x50')];if(!_0x6d83e0['query'][_0xf584('0x57')](_0xf584('0x41'))){_0x47bbc6['limit']=qs[_0xf584('0x2b')](_0x6d83e0[_0xf584('0x3c')]['limit']);_0x47bbc6[_0xf584('0x2a')]=qs[_0xf584('0x2a')](_0x6d83e0[_0xf584('0x3c')][_0xf584('0x2a')]);}return _0x579552['getFields'](_0x47bbc6);}})['then'](function(_0x1ea2c7){if(_0x1ea2c7){return _0x1ea2c7?{'count':_0x249ccf,'rows':_0x1ea2c7}:null;}})['then'](respondWithResult(_0x11121d,null))[_0xf584('0x24')](handleError(_0x11121d,null));};exports[_0xf584('0x58')]=function(_0x222d3f,_0x58ab6a,_0x3506dd){var _0x197a49={};var _0x204557={};var _0x34a3ad;var _0x2e3c31;return db[_0xf584('0x37')][_0xf584('0x55')]({'where':{'id':_0x222d3f[_0xf584('0x4e')]['id']}})['then'](handleEntityNotFound(_0x58ab6a,null))[_0xf584('0x1c')](function(_0x5a2f78){if(_0x5a2f78){_0x34a3ad=_0x5a2f78;_0x204557[_0xf584('0x3b')]=_[_0xf584('0x4f')](db[_0xf584('0x59')][_0xf584('0x38')]);_0x204557[_0xf584('0x3c')]=_['keys'](_0x222d3f['query']);_0x204557['filters']=_[_0xf584('0x3e')](_0x204557[_0xf584('0x3b')],_0x204557[_0xf584('0x3c')]);_0x197a49[_0xf584('0x40')]=_[_0xf584('0x3e')](_0x204557[_0xf584('0x3b')],qs['fields'](_0x222d3f['query'][_0xf584('0x3f')]));_0x197a49['attributes']=_0x197a49[_0xf584('0x40')][_0xf584('0x50')]?_0x197a49[_0xf584('0x40')]:_0x204557[_0xf584('0x3b')];_0x197a49[_0xf584('0x42')]=qs[_0xf584('0x43')](_0x222d3f[_0xf584('0x3c')][_0xf584('0x43')]);_0x197a49['where']=qs[_0xf584('0x3d')](_[_0xf584('0x44')](_0x222d3f[_0xf584('0x3c')],_0x204557[_0xf584('0x3d')]));if(_0x222d3f[_0xf584('0x3c')][_0xf584('0x45')]){_0x197a49[_0xf584('0x46')]=_['merge'](_0x197a49[_0xf584('0x46')],{'$or':_[_0xf584('0x36')](_0x197a49[_0xf584('0x40')],function(_0x1e982e){var _0xe8b784={};_0xe8b784[_0x1e982e]={'$like':'%'+_0x222d3f[_0xf584('0x3c')][_0xf584('0x45')]+'%'};return _0xe8b784;})});}_0x197a49=_[_0xf584('0x47')]({},_0x197a49,_0x222d3f[_0xf584('0x49')]);return _0x34a3ad[_0xf584('0x58')](_0x197a49);}})['then'](function(_0x3baf64){if(_0x3baf64){_0x2e3c31=_0x3baf64[_0xf584('0x50')];if(!_0x222d3f[_0xf584('0x3c')][_0xf584('0x57')](_0xf584('0x41'))){_0x197a49[_0xf584('0x2b')]=qs[_0xf584('0x2b')](_0x222d3f[_0xf584('0x3c')][_0xf584('0x2b')]);_0x197a49[_0xf584('0x2a')]=qs[_0xf584('0x2a')](_0x222d3f[_0xf584('0x3c')][_0xf584('0x2a')]);}return _0x34a3ad[_0xf584('0x58')](_0x197a49);}})['then'](function(_0x3b6b06){if(_0x3b6b06){return _0x3b6b06?{'count':_0x2e3c31,'rows':_0x3b6b06}:null;}})[_0xf584('0x1c')](respondWithResult(_0x58ab6a,null))[_0xf584('0x24')](handleError(_0x58ab6a,null));};exports[_0xf584('0x5a')]=function(_0x34c725,_0x164c44,_0x2f9af8){var _0x119e59={};var _0x264ece={};var _0x1bf4de;var _0x230039;return db[_0xf584('0x37')][_0xf584('0x55')]({'where':{'id':_0x34c725[_0xf584('0x4e')]['id']}})[_0xf584('0x1c')](handleEntityNotFound(_0x164c44,null))[_0xf584('0x1c')](function(_0x3757da){if(_0x3757da){_0x1bf4de=_0x3757da;_0x264ece['model']=_[_0xf584('0x4f')](db[_0xf584('0x59')][_0xf584('0x38')]);_0x264ece[_0xf584('0x3c')]=_[_0xf584('0x4f')](_0x34c725[_0xf584('0x3c')]);_0x264ece[_0xf584('0x3d')]=_[_0xf584('0x3e')](_0x264ece[_0xf584('0x3b')],_0x264ece[_0xf584('0x3c')]);_0x119e59[_0xf584('0x40')]=_[_0xf584('0x3e')](_0x264ece[_0xf584('0x3b')],qs[_0xf584('0x3f')](_0x34c725['query'][_0xf584('0x3f')]));_0x119e59[_0xf584('0x40')]=_0x119e59[_0xf584('0x40')][_0xf584('0x50')]?_0x119e59['attributes']:_0x264ece['model'];_0x119e59[_0xf584('0x42')]=qs['sort'](_0x34c725[_0xf584('0x3c')][_0xf584('0x43')]);_0x119e59[_0xf584('0x46')]=qs[_0xf584('0x3d')](_[_0xf584('0x44')](_0x34c725['query'],_0x264ece[_0xf584('0x3d')]));if(_0x34c725[_0xf584('0x3c')][_0xf584('0x45')]){_0x119e59['where']=_[_0xf584('0x47')](_0x119e59['where'],{'$or':_[_0xf584('0x36')](_0x119e59['attributes'],function(_0x317bc1){var _0x468828={};_0x468828[_0x317bc1]={'$like':'%'+_0x34c725[_0xf584('0x3c')][_0xf584('0x45')]+'%'};return _0x468828;})});}_0x119e59=_[_0xf584('0x47')]({},_0x119e59,_0x34c725[_0xf584('0x49')]);return _0x1bf4de[_0xf584('0x5a')](_0x119e59);}})[_0xf584('0x1c')](function(_0xbe31d9){if(_0xbe31d9){_0x230039=_0xbe31d9[_0xf584('0x50')];if(!_0x34c725['query'][_0xf584('0x57')](_0xf584('0x41'))){_0x119e59[_0xf584('0x2b')]=qs[_0xf584('0x2b')](_0x34c725[_0xf584('0x3c')]['limit']);_0x119e59[_0xf584('0x2a')]=qs[_0xf584('0x2a')](_0x34c725['query'][_0xf584('0x2a')]);}return _0x1bf4de[_0xf584('0x5a')](_0x119e59);}})['then'](function(_0x226d2c){if(_0x226d2c){return _0x226d2c?{'count':_0x230039,'rows':_0x226d2c}:null;}})['then'](respondWithResult(_0x164c44,null))[_0xf584('0x24')](handleError(_0x164c44,null));};exports[_0xf584('0x5b')]=function(_0xe553d3,_0x29dbfc,_0x427c01){var _0x3d9263={};var _0x3dd519={};var _0x3c95f5;var _0x507daa;return db[_0xf584('0x37')][_0xf584('0x55')]({'where':{'id':_0xe553d3[_0xf584('0x4e')]['id']}})[_0xf584('0x1c')](handleEntityNotFound(_0x29dbfc,null))['then'](function(_0x399a46){if(_0x399a46){_0x3c95f5=_0x399a46;_0x3dd519[_0xf584('0x3b')]=_['keys'](db['Tag']['rawAttributes']);_0x3dd519[_0xf584('0x3c')]=_[_0xf584('0x4f')](_0xe553d3[_0xf584('0x3c')]);_0x3dd519[_0xf584('0x3d')]=_['intersection'](_0x3dd519[_0xf584('0x3b')],_0x3dd519[_0xf584('0x3c')]);_0x3d9263[_0xf584('0x40')]=_[_0xf584('0x3e')](_0x3dd519[_0xf584('0x3b')],qs['fields'](_0xe553d3['query']['fields']));_0x3d9263['attributes']=_0x3d9263['attributes'][_0xf584('0x50')]?_0x3d9263[_0xf584('0x40')]:_0x3dd519[_0xf584('0x3b')];_0x3d9263['order']=qs['sort'](_0xe553d3['query'][_0xf584('0x43')]);_0x3d9263[_0xf584('0x46')]=qs[_0xf584('0x3d')](_[_0xf584('0x44')](_0xe553d3['query'],_0x3dd519[_0xf584('0x3d')]));if(_0xe553d3[_0xf584('0x3c')]['filter']){_0x3d9263[_0xf584('0x46')]=_[_0xf584('0x47')](_0x3d9263[_0xf584('0x46')],{'$or':_[_0xf584('0x36')](_0x3d9263[_0xf584('0x40')],function(_0x44de19){var _0x1bc915={};_0x1bc915[_0x44de19]={'$like':'%'+_0xe553d3['query'][_0xf584('0x45')]+'%'};return _0x1bc915;})});}_0x3d9263=_['merge']({},_0x3d9263,_0xe553d3[_0xf584('0x49')]);return _0x3c95f5[_0xf584('0x5b')](_0x3d9263);}})[_0xf584('0x1c')](function(_0xb62bee){if(_0xb62bee){_0x507daa=_0xb62bee[_0xf584('0x50')];if(!_0xe553d3[_0xf584('0x3c')][_0xf584('0x57')](_0xf584('0x41'))){_0x3d9263['limit']=qs[_0xf584('0x2b')](_0xe553d3[_0xf584('0x3c')][_0xf584('0x2b')]);_0x3d9263[_0xf584('0x2a')]=qs[_0xf584('0x2a')](_0xe553d3[_0xf584('0x3c')][_0xf584('0x2a')]);}return _0x3c95f5[_0xf584('0x5b')](_0x3d9263);}})[_0xf584('0x1c')](function(_0x613573){if(_0x613573){return _0x613573?{'count':_0x507daa,'rows':_0x613573}:null;}})[_0xf584('0x1c')](respondWithResult(_0x29dbfc,null))[_0xf584('0x24')](handleError(_0x29dbfc,null));};exports[_0xf584('0x5c')]=function(_0x4baafb,_0xe805b7,_0x2c333b){if(_0x4baafb[_0xf584('0x54')]['id']){delete _0x4baafb[_0xf584('0x54')]['id'];}return db[_0xf584('0x37')][_0xf584('0x55')]({'where':{'id':_0x4baafb[_0xf584('0x4e')]['id']}})[_0xf584('0x1c')](handleEntityNotFound(_0xe805b7,null))[_0xf584('0x1c')](function(_0x1d25de){if(_0x1d25de){return _0x1d25de[_0xf584('0x5c')](_0x4baafb[_0xf584('0x54')][_0xf584('0x5d')]||[]);}return null;})[_0xf584('0x1c')](respondWithResult(_0xe805b7,null))['catch'](handleError(_0xe805b7,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index e68eaf4..22204e4 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 _0x92e7=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x92e7,0x188));var _0x792e=function(_0x4261c0,_0xac76d5){_0x4261c0=_0x4261c0-0x0;var _0x138b52=_0x92e7[_0x4261c0];return _0x138b52;};'use strict';var _=require('lodash');var util=require(_0x792e('0x0'));var logger=require(_0x792e('0x1'))(_0x792e('0x2'));var moment=require(_0x792e('0x3'));var BPromise=require(_0x792e('0x4'));var rp=require(_0x792e('0x5'));var fs=require('fs');var path=require(_0x792e('0x6'));var rimraf=require(_0x792e('0x7'));var config=require(_0x792e('0x8'));var attributes=require(_0x792e('0x9'));module[_0x792e('0xa')]=function(_0x56390e,_0x215bfa){return _0x56390e[_0x792e('0xb')](_0x792e('0xc'),attributes,{'tableName':_0x792e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7045=['bluebird','request-promise','path','../../config/environment','exports','DeskConfiguration','lodash','../../config/logger','api','moment'];(function(_0x14b60e,_0x5bcdad){var _0xb7c345=function(_0x3fb27d){while(--_0x3fb27d){_0x14b60e['push'](_0x14b60e['shift']());}};_0xb7c345(++_0x5bcdad);}(_0x7045,0x150));var _0x5704=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7045[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5704('0x0'));var util=require('util');var logger=require(_0x5704('0x1'))(_0x5704('0x2'));var moment=require(_0x5704('0x3'));var BPromise=require(_0x5704('0x4'));var rp=require(_0x5704('0x5'));var fs=require('fs');var path=require(_0x5704('0x6'));var rimraf=require('rimraf');var config=require(_0x5704('0x7'));var attributes=require('./intDeskConfiguration.attributes');module[_0x5704('0x8')]=function(_0x7463ed,_0xbfd825){return _0x7463ed['define'](_0x5704('0x9'),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 437a7bc..092bc26 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 _0x4ef1=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x543df9,_0x1fc049){var _0x2dac9d=function(_0x3ede26){while(--_0x3ede26){_0x543df9['push'](_0x543df9['shift']());}};_0x2dac9d(++_0x1fc049);}(_0x4ef1,0xeb));var _0x14ef=function(_0x5764d9,_0x2bb4c6){_0x5764d9=_0x5764d9-0x0;var _0x1edfcf=_0x4ef1[_0x5764d9];return _0x1edfcf;};'use strict';var _=require(_0x14ef('0x0'));var util=require(_0x14ef('0x1'));var moment=require('moment');var BPromise=require(_0x14ef('0x2'));var rs=require(_0x14ef('0x3'));var fs=require('fs');var Redis=require(_0x14ef('0x4'));var db=require(_0x14ef('0x5'))['db'];var utils=require(_0x14ef('0x6'));var logger=require(_0x14ef('0x7'))(_0x14ef('0x8'));var config=require(_0x14ef('0x9'));var jayson=require(_0x14ef('0xa'));var client=jayson[_0x14ef('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x261fa2,_0x2dc335,_0x5b75ad){return new BPromise(function(_0x4175e7,_0x2ab217){return client[_0x14ef('0xc')](_0x261fa2,_0x5b75ad)[_0x14ef('0xd')](function(_0x17acc1){logger['info'](_0x14ef('0xe'),_0x2dc335,'request\x20sent');logger[_0x14ef('0xf')](_0x14ef('0x10'),_0x2dc335,_0x14ef('0x11'),JSON[_0x14ef('0x12')](_0x17acc1));if(_0x17acc1['error']){if(_0x17acc1['error'][_0x14ef('0x13')]===0x1f4){logger[_0x14ef('0x14')]('DeskConfiguration,\x20%s,\x20%s',_0x2dc335,_0x17acc1[_0x14ef('0x14')][_0x14ef('0x15')]);return _0x2ab217(_0x17acc1[_0x14ef('0x14')]['message']);}logger[_0x14ef('0x14')](_0x14ef('0xe'),_0x2dc335,_0x17acc1[_0x14ef('0x14')][_0x14ef('0x15')]);return _0x4175e7(_0x17acc1['error'][_0x14ef('0x15')]);}else{logger[_0x14ef('0x16')](_0x14ef('0xe'),_0x2dc335,_0x14ef('0x11'));_0x4175e7(_0x17acc1['result'][_0x14ef('0x15')]);}})[_0x14ef('0x17')](function(_0x24556b){logger[_0x14ef('0x14')](_0x14ef('0xe'),_0x2dc335,_0x24556b);_0x2ab217(_0x24556b);});});} \ No newline at end of file +var _0x5bc5=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x5bc5,0xb2));var _0x55bc=function(_0x59ee41,_0xaf7db8){_0x59ee41=_0x59ee41-0x0;var _0x3ecd3e=_0x5bc5[_0x59ee41];return _0x3ecd3e;};'use strict';var _=require(_0x55bc('0x0'));var util=require(_0x55bc('0x1'));var moment=require(_0x55bc('0x2'));var BPromise=require(_0x55bc('0x3'));var rs=require(_0x55bc('0x4'));var fs=require('fs');var Redis=require(_0x55bc('0x5'));var db=require(_0x55bc('0x6'))['db'];var utils=require(_0x55bc('0x7'));var logger=require(_0x55bc('0x8'))(_0x55bc('0x9'));var config=require(_0x55bc('0xa'));var jayson=require(_0x55bc('0xb'));var client=jayson[_0x55bc('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d78d6,_0x5719c9,_0x2a612b){return new BPromise(function(_0x38839e,_0x4d0610){return client[_0x55bc('0xd')](_0x4d78d6,_0x2a612b)[_0x55bc('0xe')](function(_0xc535ac){logger[_0x55bc('0xf')](_0x55bc('0x10'),_0x5719c9,_0x55bc('0x11'));logger[_0x55bc('0x12')](_0x55bc('0x13'),_0x5719c9,'request\x20sent',JSON[_0x55bc('0x14')](_0xc535ac));if(_0xc535ac[_0x55bc('0x15')]){if(_0xc535ac[_0x55bc('0x15')]['code']===0x1f4){logger[_0x55bc('0x15')]('DeskConfiguration,\x20%s,\x20%s',_0x5719c9,_0xc535ac[_0x55bc('0x15')][_0x55bc('0x16')]);return _0x4d0610(_0xc535ac[_0x55bc('0x15')]['message']);}logger[_0x55bc('0x15')]('DeskConfiguration,\x20%s,\x20%s',_0x5719c9,_0xc535ac[_0x55bc('0x15')][_0x55bc('0x16')]);return _0x38839e(_0xc535ac[_0x55bc('0x15')]['message']);}else{logger[_0x55bc('0xf')](_0x55bc('0x10'),_0x5719c9,'request\x20sent');_0x38839e(_0xc535ac['result'][_0x55bc('0x16')]);}})['catch'](function(_0x482eea){logger[_0x55bc('0x15')](_0x55bc('0x10'),_0x5719c9,_0x482eea);_0x4d0610(_0x482eea);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index e78a63d..dcaac69 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 _0x46c1=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','index'];(function(_0x50e929,_0x290da5){var _0x126e47=function(_0x5a8a89){while(--_0x5a8a89){_0x50e929['push'](_0x50e929['shift']());}};_0x126e47(++_0x290da5);}(_0x46c1,0xa1));var _0x146c=function(_0x49835f,_0x193226){_0x49835f=_0x49835f-0x0;var _0x3afc8f=_0x46c1[_0x49835f];return _0x3afc8f;};'use strict';var multer=require(_0x146c('0x0'));var util=require(_0x146c('0x1'));var path=require(_0x146c('0x2'));var timeout=require(_0x146c('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x146c('0x4'));var interaction=require(_0x146c('0x5'));var config=require(_0x146c('0x6'));var controller=require(_0x146c('0x7'));router['get']('/',auth[_0x146c('0x8')](),controller[_0x146c('0x9')]);router['get'](_0x146c('0xa'),auth[_0x146c('0x8')](),controller[_0x146c('0xb')]);router[_0x146c('0xc')]('/',auth[_0x146c('0x8')](),controller[_0x146c('0xd')]);router[_0x146c('0xe')]('/:id',auth[_0x146c('0x8')](),controller[_0x146c('0xf')]);router[_0x146c('0x10')](_0x146c('0xa'),auth[_0x146c('0x8')](),controller[_0x146c('0x11')]);module[_0x146c('0x12')]=router; \ No newline at end of file +var _0xcfb6=['./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','util','path','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x5710ad,_0x1fd431){var _0x4a4b4=function(_0x3bd3c2){while(--_0x3bd3c2){_0x5710ad['push'](_0x5710ad['shift']());}};_0x4a4b4(++_0x1fd431);}(_0xcfb6,0x71));var _0x6cfb=function(_0x375492,_0x4ed149){_0x375492=_0x375492-0x0;var _0x18ba5b=_0xcfb6[_0x375492];return _0x18ba5b;};'use strict';var multer=require('multer');var util=require(_0x6cfb('0x0'));var path=require(_0x6cfb('0x1'));var timeout=require('connect-timeout');var express=require(_0x6cfb('0x2'));var router=express[_0x6cfb('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6cfb('0x4'));var config=require(_0x6cfb('0x5'));var controller=require(_0x6cfb('0x6'));router[_0x6cfb('0x7')]('/',auth[_0x6cfb('0x8')](),controller[_0x6cfb('0x9')]);router['get'](_0x6cfb('0xa'),auth[_0x6cfb('0x8')](),controller[_0x6cfb('0xb')]);router[_0x6cfb('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6cfb('0xd')](_0x6cfb('0xa'),auth[_0x6cfb('0x8')](),controller['update']);router[_0x6cfb('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x6cfb('0xf')]);module[_0x6cfb('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index b60fcf1..513316b 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 _0x05e9=['ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x322159,_0x53dc75){var _0x34623a=function(_0x36f208){while(--_0x36f208){_0x322159['push'](_0x322159['shift']());}};_0x34623a(++_0x53dc75);}(_0x05e9,0x66));var _0x905e=function(_0x51993c,_0x4296c8){_0x51993c=_0x51993c-0x0;var _0x2ddc57=_0x05e9[_0x51993c];return _0x2ddc57;};'use strict';var Sequelize=require(_0x905e('0x0'));module[_0x905e('0x1')]={'type':{'type':Sequelize['ENUM'](_0x905e('0x2'),_0x905e('0x3'),_0x905e('0x4'),_0x905e('0x5'),_0x905e('0x6')),'defaultValue':_0x905e('0x2')},'content':{'type':Sequelize[_0x905e('0x7')]},'key':{'type':Sequelize[_0x905e('0x7')]},'keyType':{'type':Sequelize[_0x905e('0x8')](_0x905e('0x2'),'variable',_0x905e('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x905e('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x905e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x905e('0x7')]}}; \ No newline at end of file +var _0x3e35=['ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports'];(function(_0x36fe46,_0x40010c){var _0x4d2e9c=function(_0x2dfa20){while(--_0x2dfa20){_0x36fe46['push'](_0x36fe46['shift']());}};_0x4d2e9c(++_0x40010c);}(_0x3e35,0x198));var _0x53e3=function(_0x195577,_0x5de53a){_0x195577=_0x195577-0x0;var _0x13c367=_0x3e35[_0x195577];return _0x13c367;};'use strict';var Sequelize=require(_0x53e3('0x0'));module[_0x53e3('0x1')]={'type':{'type':Sequelize[_0x53e3('0x2')]('string',_0x53e3('0x3'),_0x53e3('0x4'),_0x53e3('0x5'),_0x53e3('0x6')),'defaultValue':_0x53e3('0x7')},'content':{'type':Sequelize[_0x53e3('0x8')]},'key':{'type':Sequelize[_0x53e3('0x8')]},'keyType':{'type':Sequelize[_0x53e3('0x2')]('string',_0x53e3('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x53e3('0x8')]},'nameField':{'type':Sequelize[_0x53e3('0x8')]},'customField':{'type':Sequelize[_0x53e3('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 804de29..7c0ff09 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 _0x0ea9=['model','map','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','DeskField','rawAttributes','type','key'];(function(_0x440f3a,_0x639689){var _0x457152=function(_0x25dbb6){while(--_0x25dbb6){_0x440f3a['push'](_0x440f3a['shift']());}};_0x457152(++_0x639689);}(_0x0ea9,0xa3));var _0x90ea=function(_0x1db8fb,_0x33dd0c){_0x1db8fb=_0x1db8fb-0x0;var _0x30090a=_0x0ea9[_0x1db8fb];return _0x30090a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x90ea('0x0'));var zipdir=require(_0x90ea('0x1'));var jsonpatch=require(_0x90ea('0x2'));var rp=require(_0x90ea('0x3'));var moment=require(_0x90ea('0x4'));var BPromise=require(_0x90ea('0x5'));var Mustache=require(_0x90ea('0x6'));var util=require('util');var path=require(_0x90ea('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x90ea('0x8'));var fs=require('fs');var _=require(_0x90ea('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x90ea('0xa'));var toCsv=require(_0x90ea('0xb'));var querystring=require(_0x90ea('0xc'));var Papa=require(_0x90ea('0xd'));var Redis=require('ioredis');var authService=require(_0x90ea('0xe'));var qs=require(_0x90ea('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x90ea('0x10'));var logger=require(_0x90ea('0x11'))(_0x90ea('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x90ea('0x13'));var db=require(_0x90ea('0x14'))['db'];function respondWithStatusCode(_0x4bd017,_0x505bf5){_0x505bf5=_0x505bf5||0xcc;return function(_0x3843f8){if(_0x3843f8){return _0x4bd017[_0x90ea('0x15')](_0x505bf5);}return _0x4bd017[_0x90ea('0x16')](_0x505bf5)[_0x90ea('0x17')]();};}function respondWithResult(_0x44521b,_0x45ebc){_0x45ebc=_0x45ebc||0xc8;return function(_0x3068ff){if(_0x3068ff){return _0x44521b[_0x90ea('0x16')](_0x45ebc)[_0x90ea('0x18')](_0x3068ff);}};}function respondWithFilteredResult(_0x1fb846,_0x16381a){return function(_0x1e22bf){if(_0x1e22bf){var _0x4025d5=_0x1e22bf[_0x90ea('0x19')],_0x4c5f09=_0x16381a[_0x90ea('0x1a')],_0x5bc7cc=_0x16381a[_0x90ea('0x1a')]+_0x16381a[_0x90ea('0x1b')],_0x3cec73;if(_0x5bc7cc>=_0x4025d5){_0x5bc7cc=_0x4025d5;_0x3cec73=0xc8;}else{_0x3cec73=0xce;}_0x1fb846[_0x90ea('0x16')](_0x3cec73);return _0x1fb846[_0x90ea('0x1c')](_0x90ea('0x1d'),_0x4c5f09+'-'+_0x5bc7cc+'/'+_0x4025d5)['json'](_0x1e22bf);}return null;};}function patchUpdates(_0x2d8466){return function(_0x3b8d44){try{jsonpatch[_0x90ea('0x1e')](_0x3b8d44,_0x2d8466,!![]);}catch(_0x579e24){return BPromise[_0x90ea('0x1f')](_0x579e24);}return _0x3b8d44[_0x90ea('0x20')]();};}function saveUpdates(_0x1aeed2,_0x373592){return function(_0xfbab4){if(_0xfbab4){return _0xfbab4[_0x90ea('0x21')](_0x1aeed2)[_0x90ea('0x22')](function(_0x19d7d1){return _0x19d7d1;});}return null;};}function removeEntity(_0x45b923,_0x37ae9b){return function(_0x3efb70){if(_0x3efb70){return _0x3efb70[_0x90ea('0x23')]()[_0x90ea('0x22')](function(){_0x45b923['status'](0xcc)[_0x90ea('0x17')]();});}};}function handleEntityNotFound(_0x6bb6bc,_0x4a32dd){return function(_0x38a2d8){if(!_0x38a2d8){_0x6bb6bc['sendStatus'](0x194);}return _0x38a2d8;};}function handleError(_0x27250b,_0x5967e8){_0x5967e8=_0x5967e8||0x1f4;return function(_0x21568f){logger['error'](_0x21568f[_0x90ea('0x24')]);if(_0x21568f[_0x90ea('0x25')]){delete _0x21568f['name'];}_0x27250b[_0x90ea('0x16')](_0x5967e8)[_0x90ea('0x26')](_0x21568f);};}exports[_0x90ea('0x27')]=function(_0x16ed85,_0x1c74ef){var _0x16fcfe={},_0x1f4903={},_0x192d53={'count':0x0,'rows':[]};var _0x5b3557=_['map'](db[_0x90ea('0x28')][_0x90ea('0x29')],function(_0x1a24c2){return{'name':_0x1a24c2['fieldName'],'type':_0x1a24c2[_0x90ea('0x2a')][_0x90ea('0x2b')]};});_0x1f4903[_0x90ea('0x2c')]=_[_0x90ea('0x2d')](_0x5b3557,_0x90ea('0x25'));_0x1f4903['query']=_[_0x90ea('0x2e')](_0x16ed85[_0x90ea('0x2f')]);_0x1f4903[_0x90ea('0x30')]=_['intersection'](_0x1f4903[_0x90ea('0x2c')],_0x1f4903[_0x90ea('0x2f')]);_0x16fcfe[_0x90ea('0x31')]=_[_0x90ea('0x32')](_0x1f4903[_0x90ea('0x2c')],qs['fields'](_0x16ed85[_0x90ea('0x2f')][_0x90ea('0x33')]));_0x16fcfe['attributes']=_0x16fcfe['attributes'][_0x90ea('0x34')]?_0x16fcfe[_0x90ea('0x31')]:_0x1f4903['model'];if(!_0x16ed85[_0x90ea('0x2f')]['hasOwnProperty'](_0x90ea('0x35'))){_0x16fcfe['limit']=qs[_0x90ea('0x1b')](_0x16ed85[_0x90ea('0x2f')][_0x90ea('0x1b')]);_0x16fcfe[_0x90ea('0x1a')]=qs[_0x90ea('0x1a')](_0x16ed85['query']['offset']);}_0x16fcfe[_0x90ea('0x36')]=qs[_0x90ea('0x37')](_0x16ed85[_0x90ea('0x2f')][_0x90ea('0x37')]);_0x16fcfe['where']=qs['filters'](_['pick'](_0x16ed85[_0x90ea('0x2f')],_0x1f4903['filters']),_0x5b3557);if(_0x16ed85[_0x90ea('0x2f')][_0x90ea('0x38')]){_0x16fcfe[_0x90ea('0x39')]=_[_0x90ea('0x3a')](_0x16fcfe['where'],{'$or':_[_0x90ea('0x2d')](_0x5b3557,function(_0x1c1584){if(_0x1c1584[_0x90ea('0x2a')]!=='VIRTUAL'){var _0x5ac5d4={};_0x5ac5d4[_0x1c1584['name']]={'$like':'%'+_0x16ed85[_0x90ea('0x2f')]['filter']+'%'};return _0x5ac5d4;}})});}_0x16fcfe=_[_0x90ea('0x3a')]({},_0x16fcfe,_0x16ed85[_0x90ea('0x3b')]);var _0x898914={'where':_0x16fcfe['where']};return db['DeskField'][_0x90ea('0x19')](_0x898914)['then'](function(_0x114b11){_0x192d53[_0x90ea('0x19')]=_0x114b11;if(_0x16ed85[_0x90ea('0x2f')][_0x90ea('0x3c')]){_0x16fcfe[_0x90ea('0x3d')]=[{'all':!![]}];}return db['DeskField'][_0x90ea('0x3e')](_0x16fcfe);})[_0x90ea('0x22')](function(_0x520a05){_0x192d53[_0x90ea('0x3f')]=_0x520a05;return _0x192d53;})[_0x90ea('0x22')](respondWithFilteredResult(_0x1c74ef,_0x16fcfe))[_0x90ea('0x40')](handleError(_0x1c74ef,null));};exports['show']=function(_0x416d34,_0x57413f){var _0x1e8846={'raw':!![],'where':{'id':_0x416d34[_0x90ea('0x41')]['id']}},_0x1e8628={};_0x1e8628[_0x90ea('0x2c')]=_['keys'](db[_0x90ea('0x28')][_0x90ea('0x29')]);_0x1e8628['query']=_[_0x90ea('0x2e')](_0x416d34[_0x90ea('0x2f')]);_0x1e8628[_0x90ea('0x30')]=_[_0x90ea('0x32')](_0x1e8628[_0x90ea('0x2c')],_0x1e8628[_0x90ea('0x2f')]);_0x1e8846[_0x90ea('0x31')]=_[_0x90ea('0x32')](_0x1e8628[_0x90ea('0x2c')],qs[_0x90ea('0x33')](_0x416d34[_0x90ea('0x2f')][_0x90ea('0x33')]));_0x1e8846[_0x90ea('0x31')]=_0x1e8846[_0x90ea('0x31')][_0x90ea('0x34')]?_0x1e8846[_0x90ea('0x31')]:_0x1e8628[_0x90ea('0x2c')];if(_0x416d34['query'][_0x90ea('0x3c')]){_0x1e8846[_0x90ea('0x3d')]=[{'all':!![]}];}_0x1e8846=_[_0x90ea('0x3a')]({},_0x1e8846,_0x416d34['options']);return db[_0x90ea('0x28')][_0x90ea('0x42')](_0x1e8846)['then'](handleEntityNotFound(_0x57413f,null))[_0x90ea('0x22')](respondWithResult(_0x57413f,null))[_0x90ea('0x40')](handleError(_0x57413f,null));};exports[_0x90ea('0x43')]=function(_0x3f2a1a,_0x2eff88){return db[_0x90ea('0x28')][_0x90ea('0x43')](_0x3f2a1a[_0x90ea('0x44')],{})[_0x90ea('0x22')](respondWithResult(_0x2eff88,0xc9))[_0x90ea('0x40')](handleError(_0x2eff88,null));};exports['update']=function(_0xfa5822,_0x2b1992){if(_0xfa5822[_0x90ea('0x44')]['id']){delete _0xfa5822[_0x90ea('0x44')]['id'];}return db[_0x90ea('0x28')]['find']({'where':{'id':_0xfa5822[_0x90ea('0x41')]['id']}})['then'](handleEntityNotFound(_0x2b1992,null))[_0x90ea('0x22')](saveUpdates(_0xfa5822['body'],null))[_0x90ea('0x22')](respondWithResult(_0x2b1992,null))[_0x90ea('0x40')](handleError(_0x2b1992,null));};exports['destroy']=function(_0x53860f,_0x21a7df){return db[_0x90ea('0x28')][_0x90ea('0x42')]({'where':{'id':_0x53860f[_0x90ea('0x41')]['id']}})[_0x90ea('0x22')](handleEntityNotFound(_0x21a7df,null))[_0x90ea('0x22')](removeEntity(_0x21a7df,null))[_0x90ea('0x40')](handleError(_0x21a7df,null));}; \ No newline at end of file +var _0x41c2=['path','sox','to-csv','ejs','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','set','update','then','sendStatus','error','stack','name','index','map','DeskField','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','length','includeAll','create','body','catch','find','destroy','eml-format','zip-dir','request-promise','moment','mustache'];(function(_0x308793,_0x24c815){var _0x15b58d=function(_0x311a43){while(--_0x311a43){_0x308793['push'](_0x308793['shift']());}};_0x15b58d(++_0x24c815);}(_0x41c2,0x1e5));var _0x241c=function(_0x1fc328,_0x146b63){_0x1fc328=_0x1fc328-0x0;var _0x31acdc=_0x41c2[_0x1fc328];return _0x31acdc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x241c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x241c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x241c('0x2'));var moment=require(_0x241c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x241c('0x4'));var util=require('util');var path=require(_0x241c('0x5'));var sox=require(_0x241c('0x6'));var csv=require(_0x241c('0x7'));var ejs=require(_0x241c('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x241c('0x9'));var crypto=require('crypto');var jsforce=require(_0x241c('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x241c('0x7'));var querystring=require(_0x241c('0xb'));var Papa=require('papaparse');var Redis=require(_0x241c('0xc'));var authService=require(_0x241c('0xd'));var qs=require(_0x241c('0xe'));var as=require(_0x241c('0xf'));var hardwareService=require(_0x241c('0x10'));var logger=require(_0x241c('0x11'))(_0x241c('0x12'));var utils=require(_0x241c('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x241c('0x14'));var db=require(_0x241c('0x15'))['db'];function respondWithStatusCode(_0x231e26,_0x37dc2e){_0x37dc2e=_0x37dc2e||0xcc;return function(_0x4ba243){if(_0x4ba243){return _0x231e26['sendStatus'](_0x37dc2e);}return _0x231e26[_0x241c('0x16')](_0x37dc2e)[_0x241c('0x17')]();};}function respondWithResult(_0x372009,_0x598f78){_0x598f78=_0x598f78||0xc8;return function(_0x3d9846){if(_0x3d9846){return _0x372009[_0x241c('0x16')](_0x598f78)[_0x241c('0x18')](_0x3d9846);}};}function respondWithFilteredResult(_0x4ddfec,_0x127afd){return function(_0x318a37){if(_0x318a37){var _0x38bef0=_0x318a37[_0x241c('0x19')],_0x2b2d2b=_0x127afd['offset'],_0x5de68c=_0x127afd['offset']+_0x127afd['limit'],_0x4dd383;if(_0x5de68c>=_0x38bef0){_0x5de68c=_0x38bef0;_0x4dd383=0xc8;}else{_0x4dd383=0xce;}_0x4ddfec[_0x241c('0x16')](_0x4dd383);return _0x4ddfec[_0x241c('0x1a')]('Content-Range',_0x2b2d2b+'-'+_0x5de68c+'/'+_0x38bef0)[_0x241c('0x18')](_0x318a37);}return null;};}function patchUpdates(_0x272f65){return function(_0x492c0c){try{jsonpatch['apply'](_0x492c0c,_0x272f65,!![]);}catch(_0xb9f60e){return BPromise['reject'](_0xb9f60e);}return _0x492c0c['save']();};}function saveUpdates(_0x1e1d73,_0xe24200){return function(_0x2ff6ba){if(_0x2ff6ba){return _0x2ff6ba[_0x241c('0x1b')](_0x1e1d73)[_0x241c('0x1c')](function(_0x15d6be){return _0x15d6be;});}return null;};}function removeEntity(_0x5f1f67,_0x53445e){return function(_0x2cc40d){if(_0x2cc40d){return _0x2cc40d['destroy']()[_0x241c('0x1c')](function(){_0x5f1f67[_0x241c('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x332146,_0x4e89aa){return function(_0x3bf515){if(!_0x3bf515){_0x332146[_0x241c('0x1d')](0x194);}return _0x3bf515;};}function handleError(_0x2cc835,_0x54c636){_0x54c636=_0x54c636||0x1f4;return function(_0xd0797c){logger[_0x241c('0x1e')](_0xd0797c[_0x241c('0x1f')]);if(_0xd0797c['name']){delete _0xd0797c[_0x241c('0x20')];}_0x2cc835[_0x241c('0x16')](_0x54c636)['send'](_0xd0797c);};}exports[_0x241c('0x21')]=function(_0xefec14,_0x3fa348){var _0x561055={},_0x593742={},_0x4b1522={'count':0x0,'rows':[]};var _0x5c7d0a=_[_0x241c('0x22')](db[_0x241c('0x23')]['rawAttributes'],function(_0x4684d1){return{'name':_0x4684d1[_0x241c('0x24')],'type':_0x4684d1['type'][_0x241c('0x25')]};});_0x593742[_0x241c('0x26')]=_['map'](_0x5c7d0a,_0x241c('0x20'));_0x593742[_0x241c('0x27')]=_[_0x241c('0x28')](_0xefec14[_0x241c('0x27')]);_0x593742[_0x241c('0x29')]=_['intersection'](_0x593742[_0x241c('0x26')],_0x593742[_0x241c('0x27')]);_0x561055[_0x241c('0x2a')]=_[_0x241c('0x2b')](_0x593742[_0x241c('0x26')],qs['fields'](_0xefec14[_0x241c('0x27')][_0x241c('0x2c')]));_0x561055[_0x241c('0x2a')]=_0x561055[_0x241c('0x2a')]['length']?_0x561055[_0x241c('0x2a')]:_0x593742[_0x241c('0x26')];if(!_0xefec14[_0x241c('0x27')][_0x241c('0x2d')](_0x241c('0x2e'))){_0x561055['limit']=qs[_0x241c('0x2f')](_0xefec14[_0x241c('0x27')][_0x241c('0x2f')]);_0x561055[_0x241c('0x30')]=qs[_0x241c('0x30')](_0xefec14[_0x241c('0x27')][_0x241c('0x30')]);}_0x561055[_0x241c('0x31')]=qs['sort'](_0xefec14['query']['sort']);_0x561055['where']=qs[_0x241c('0x29')](_[_0x241c('0x32')](_0xefec14[_0x241c('0x27')],_0x593742['filters']),_0x5c7d0a);if(_0xefec14[_0x241c('0x27')][_0x241c('0x33')]){_0x561055[_0x241c('0x34')]=_[_0x241c('0x35')](_0x561055[_0x241c('0x34')],{'$or':_['map'](_0x5c7d0a,function(_0x46fe0e){if(_0x46fe0e[_0x241c('0x36')]!==_0x241c('0x37')){var _0x58007f={};_0x58007f[_0x46fe0e[_0x241c('0x20')]]={'$like':'%'+_0xefec14[_0x241c('0x27')]['filter']+'%'};return _0x58007f;}})});}_0x561055=_['merge']({},_0x561055,_0xefec14[_0x241c('0x38')]);var _0xe20a74={'where':_0x561055[_0x241c('0x34')]};return db[_0x241c('0x23')][_0x241c('0x19')](_0xe20a74)[_0x241c('0x1c')](function(_0xb853f2){_0x4b1522[_0x241c('0x19')]=_0xb853f2;if(_0xefec14[_0x241c('0x27')]['includeAll']){_0x561055[_0x241c('0x39')]=[{'all':!![]}];}return db['DeskField'][_0x241c('0x3a')](_0x561055);})[_0x241c('0x1c')](function(_0x328f2d){_0x4b1522[_0x241c('0x3b')]=_0x328f2d;return _0x4b1522;})[_0x241c('0x1c')](respondWithFilteredResult(_0x3fa348,_0x561055))['catch'](handleError(_0x3fa348,null));};exports[_0x241c('0x3c')]=function(_0x2ff7a2,_0x2fa473){var _0x55e9e2={'raw':!![],'where':{'id':_0x2ff7a2[_0x241c('0x3d')]['id']}},_0x5b0372={};_0x5b0372[_0x241c('0x26')]=_[_0x241c('0x28')](db[_0x241c('0x23')][_0x241c('0x3e')]);_0x5b0372['query']=_[_0x241c('0x28')](_0x2ff7a2[_0x241c('0x27')]);_0x5b0372[_0x241c('0x29')]=_[_0x241c('0x2b')](_0x5b0372[_0x241c('0x26')],_0x5b0372[_0x241c('0x27')]);_0x55e9e2[_0x241c('0x2a')]=_[_0x241c('0x2b')](_0x5b0372[_0x241c('0x26')],qs[_0x241c('0x2c')](_0x2ff7a2['query']['fields']));_0x55e9e2[_0x241c('0x2a')]=_0x55e9e2[_0x241c('0x2a')][_0x241c('0x3f')]?_0x55e9e2[_0x241c('0x2a')]:_0x5b0372[_0x241c('0x26')];if(_0x2ff7a2[_0x241c('0x27')][_0x241c('0x40')]){_0x55e9e2[_0x241c('0x39')]=[{'all':!![]}];}_0x55e9e2=_[_0x241c('0x35')]({},_0x55e9e2,_0x2ff7a2[_0x241c('0x38')]);return db[_0x241c('0x23')]['find'](_0x55e9e2)['then'](handleEntityNotFound(_0x2fa473,null))[_0x241c('0x1c')](respondWithResult(_0x2fa473,null))['catch'](handleError(_0x2fa473,null));};exports[_0x241c('0x41')]=function(_0x54cd69,_0x31d39a){return db[_0x241c('0x23')][_0x241c('0x41')](_0x54cd69[_0x241c('0x42')],{})['then'](respondWithResult(_0x31d39a,0xc9))[_0x241c('0x43')](handleError(_0x31d39a,null));};exports[_0x241c('0x1b')]=function(_0x2e68c3,_0x3f1b9c){if(_0x2e68c3['body']['id']){delete _0x2e68c3[_0x241c('0x42')]['id'];}return db['DeskField'][_0x241c('0x44')]({'where':{'id':_0x2e68c3['params']['id']}})[_0x241c('0x1c')](handleEntityNotFound(_0x3f1b9c,null))[_0x241c('0x1c')](saveUpdates(_0x2e68c3[_0x241c('0x42')],null))['then'](respondWithResult(_0x3f1b9c,null))['catch'](handleError(_0x3f1b9c,null));};exports[_0x241c('0x45')]=function(_0x46f609,_0x3f838c){return db['DeskField'][_0x241c('0x44')]({'where':{'id':_0x46f609[_0x241c('0x3d')]['id']}})[_0x241c('0x1c')](handleEntityNotFound(_0x3f838c,null))[_0x241c('0x1c')](removeEntity(_0x3f838c,null))['catch'](handleError(_0x3f838c,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 7d34ca1..82de2d7 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 _0x28d3=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDeskField.attributes','exports','define','desk_unique_index','FieldId'];(function(_0x3df223,_0x1740fc){var _0x562d11=function(_0x343009){while(--_0x343009){_0x3df223['push'](_0x3df223['shift']());}};_0x562d11(++_0x1740fc);}(_0x28d3,0xe0));var _0x328d=function(_0x431af9,_0x3d81d1){_0x431af9=_0x431af9-0x0;var _0x54e95a=_0x28d3[_0x431af9];return _0x54e95a;};'use strict';var _=require(_0x328d('0x0'));var util=require(_0x328d('0x1'));var logger=require(_0x328d('0x2'))(_0x328d('0x3'));var moment=require(_0x328d('0x4'));var BPromise=require(_0x328d('0x5'));var rp=require(_0x328d('0x6'));var fs=require('fs');var path=require(_0x328d('0x7'));var rimraf=require('rimraf');var config=require(_0x328d('0x8'));var attributes=require(_0x328d('0x9'));module[_0x328d('0xa')]=function(_0x22cbcd,_0xe8c557){return _0x22cbcd[_0x328d('0xb')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x328d('0xc'),'fields':['idField',_0x328d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3886=['FieldId','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','define','DeskField','int_desk_fields','desk_unique_index','idField'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3886,0x1d2));var _0x6388=function(_0x124c75,_0x1c3abe){_0x124c75=_0x124c75-0x0;var _0x1a0159=_0x3886[_0x124c75];return _0x1a0159;};'use strict';var _=require('lodash');var util=require(_0x6388('0x0'));var logger=require('../../config/logger')(_0x6388('0x1'));var moment=require(_0x6388('0x2'));var BPromise=require(_0x6388('0x3'));var rp=require(_0x6388('0x4'));var fs=require('fs');var path=require(_0x6388('0x5'));var rimraf=require(_0x6388('0x6'));var config=require(_0x6388('0x7'));var attributes=require(_0x6388('0x8'));module['exports']=function(_0x192f1a,_0x595d66){return _0x192f1a[_0x6388('0x9')](_0x6388('0xa'),attributes,{'tableName':_0x6388('0xb'),'paranoid':![],'indexes':[{'name':_0x6388('0xc'),'fields':[_0x6388('0xd'),_0x6388('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 3aa9ce4..5303103 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 _0x0173=['code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0xdd16ac,_0x4bf108){var _0x570fa2=function(_0x1f1288){while(--_0x1f1288){_0xdd16ac['push'](_0xdd16ac['shift']());}};_0x570fa2(++_0x4bf108);}(_0x0173,0x71));var _0x3017=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0173[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3017('0x0'));var util=require(_0x3017('0x1'));var moment=require(_0x3017('0x2'));var BPromise=require(_0x3017('0x3'));var rs=require(_0x3017('0x4'));var fs=require('fs');var Redis=require(_0x3017('0x5'));var db=require(_0x3017('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3017('0x7'));var config=require(_0x3017('0x8'));var jayson=require(_0x3017('0x9'));var client=jayson[_0x3017('0xa')][_0x3017('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54567c,_0x144151,_0x2c3629){return new BPromise(function(_0x36397d,_0x5c02b6){return client['request'](_0x54567c,_0x2c3629)[_0x3017('0xc')](function(_0x190c74){logger[_0x3017('0xd')](_0x3017('0xe'),_0x144151,_0x3017('0xf'));logger[_0x3017('0x10')]('DeskField,\x20%s,\x20%s,\x20%s',_0x144151,_0x3017('0xf'),JSON[_0x3017('0x11')](_0x190c74));if(_0x190c74[_0x3017('0x12')]){if(_0x190c74[_0x3017('0x12')][_0x3017('0x13')]===0x1f4){logger[_0x3017('0x12')](_0x3017('0xe'),_0x144151,_0x190c74[_0x3017('0x12')][_0x3017('0x14')]);return _0x5c02b6(_0x190c74[_0x3017('0x12')][_0x3017('0x14')]);}logger[_0x3017('0x12')](_0x3017('0xe'),_0x144151,_0x190c74[_0x3017('0x12')]['message']);return _0x36397d(_0x190c74[_0x3017('0x12')][_0x3017('0x14')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x144151,_0x3017('0xf'));_0x36397d(_0x190c74[_0x3017('0x15')][_0x3017('0x14')]);}})['catch'](function(_0x10c971){logger[_0x3017('0x12')]('DeskField,\x20%s,\x20%s',_0x144151,_0x10c971);_0x5c02b6(_0x10c971);});});} \ No newline at end of file +var _0x125c=['message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','error','DeskField,\x20%s,\x20%s'];(function(_0x25d3f4,_0x212287){var _0x389eec=function(_0x32610a){while(--_0x32610a){_0x25d3f4['push'](_0x25d3f4['shift']());}};_0x389eec(++_0x212287);}(_0x125c,0x142));var _0xc125=function(_0x3375b5,_0x7d6b14){_0x3375b5=_0x3375b5-0x0;var _0x3eef0e=_0x125c[_0x3375b5];return _0x3eef0e;};'use strict';var _=require(_0xc125('0x0'));var util=require('util');var moment=require(_0xc125('0x1'));var BPromise=require(_0xc125('0x2'));var rs=require(_0xc125('0x3'));var fs=require('fs');var Redis=require(_0xc125('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc125('0x5'));var logger=require(_0xc125('0x6'))(_0xc125('0x7'));var config=require(_0xc125('0x8'));var jayson=require(_0xc125('0x9'));var client=jayson[_0xc125('0xa')][_0xc125('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e27ef,_0x22c5d4,_0x55e3a2){return new BPromise(function(_0x39332a,_0xfed544){return client[_0xc125('0xc')](_0x1e27ef,_0x55e3a2)['then'](function(_0x3f1bfa){logger[_0xc125('0xd')]('DeskField,\x20%s,\x20%s',_0x22c5d4,_0xc125('0xe'));logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x22c5d4,_0xc125('0xe'),JSON[_0xc125('0xf')](_0x3f1bfa));if(_0x3f1bfa[_0xc125('0x10')]){if(_0x3f1bfa['error']['code']===0x1f4){logger['error'](_0xc125('0x11'),_0x22c5d4,_0x3f1bfa[_0xc125('0x10')][_0xc125('0x12')]);return _0xfed544(_0x3f1bfa[_0xc125('0x10')][_0xc125('0x12')]);}logger['error'](_0xc125('0x11'),_0x22c5d4,_0x3f1bfa['error'][_0xc125('0x12')]);return _0x39332a(_0x3f1bfa[_0xc125('0x10')][_0xc125('0x12')]);}else{logger[_0xc125('0xd')](_0xc125('0x11'),_0x22c5d4,_0xc125('0xe'));_0x39332a(_0x3f1bfa[_0xc125('0x13')][_0xc125('0x12')]);}})['catch'](function(_0x484f65){logger[_0xc125('0x10')]('DeskField,\x20%s,\x20%s',_0x22c5d4,_0x484f65);_0xfed544(_0x484f65);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 42f47d5..a37cd68 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 _0xda2d=['connect-timeout','express','Router','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','update','delete','destroy','exports','util','path'];(function(_0x36bfda,_0x1670d8){var _0x7b866c=function(_0x15db0b){while(--_0x15db0b){_0x36bfda['push'](_0x36bfda['shift']());}};_0x7b866c(++_0x1670d8);}(_0xda2d,0x102));var _0xdda2=function(_0x1fe7ef,_0x159c73){_0x1fe7ef=_0x1fe7ef-0x0;var _0x886d0c=_0xda2d[_0x1fe7ef];return _0x886d0c;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdda2('0x5'));router[_0xdda2('0x6')]('/',auth[_0xdda2('0x7')](),controller[_0xdda2('0x8')]);router[_0xdda2('0x6')](_0xdda2('0x9'),auth[_0xdda2('0x7')](),controller[_0xdda2('0xa')]);router[_0xdda2('0x6')](_0xdda2('0xb'),auth['isAuthenticated'](),controller[_0xdda2('0xc')]);router[_0xdda2('0x6')]('/:id/fields',auth[_0xdda2('0x7')](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/',auth[_0xdda2('0x7')](),controller[_0xdda2('0xf')]);router[_0xdda2('0xe')](_0xdda2('0xb'),auth[_0xdda2('0x7')](),controller['addConfiguration']);router['put']('/:id',auth[_0xdda2('0x7')](),controller[_0xdda2('0x10')]);router[_0xdda2('0x11')](_0xdda2('0x9'),auth[_0xdda2('0x7')](),controller[_0xdda2('0x12')]);module[_0xdda2('0x13')]=router; \ No newline at end of file +var _0x57ca=['index','/:id','show','/:id/fields','getFields','create','/:id/configurations','addConfiguration','put','update','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x47e925,_0x438e2a){var _0x5247e2=function(_0x3ba6ae){while(--_0x3ba6ae){_0x47e925['push'](_0x47e925['shift']());}};_0x5247e2(++_0x438e2a);}(_0x57ca,0x108));var _0xa57c=function(_0x111df1,_0x4c0a32){_0x111df1=_0x111df1-0x0;var _0x837386=_0x57ca[_0x111df1];return _0x837386;};'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 auth=require(_0xa57c('0x4'));var interaction=require(_0xa57c('0x5'));var config=require(_0xa57c('0x6'));var controller=require('./intDynamics365Account.controller');router[_0xa57c('0x7')]('/',auth[_0xa57c('0x8')](),controller[_0xa57c('0x9')]);router[_0xa57c('0x7')](_0xa57c('0xa'),auth[_0xa57c('0x8')](),controller[_0xa57c('0xb')]);router[_0xa57c('0x7')]('/:id/configurations',auth[_0xa57c('0x8')](),controller['getConfigurations']);router[_0xa57c('0x7')](_0xa57c('0xc'),auth['isAuthenticated'](),controller[_0xa57c('0xd')]);router['post']('/',auth[_0xa57c('0x8')](),controller[_0xa57c('0xe')]);router['post'](_0xa57c('0xf'),auth['isAuthenticated'](),controller[_0xa57c('0x10')]);router[_0xa57c('0x11')](_0xa57c('0xa'),auth[_0xa57c('0x8')](),controller[_0xa57c('0x12')]);router['delete'](_0xa57c('0xa'),auth['isAuthenticated'](),controller[_0xa57c('0x13')]);module[_0xa57c('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 6b236b4..801fd9a 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 _0x034f=['exports','STRING'];(function(_0x4cc492,_0x162c85){var _0x1f36b9=function(_0xce4b2){while(--_0xce4b2){_0x4cc492['push'](_0x4cc492['shift']());}};_0x1f36b9(++_0x162c85);}(_0x034f,0x13a));var _0xf034=function(_0x78a5a9,_0x5bea56){_0x78a5a9=_0x78a5a9-0x0;var _0x1e6131=_0x034f[_0x78a5a9];return _0x1e6131;};'use strict';var Sequelize=require('sequelize');module[_0xf034('0x0')]={'name':{'type':Sequelize[_0xf034('0x1')]},'username':{'type':Sequelize[_0xf034('0x1')]},'password':{'type':Sequelize[_0xf034('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xf034('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xf034('0x1')]},'serverUrl':{'type':Sequelize[_0xf034('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf034('0x1')]}}; \ No newline at end of file +var _0x6469=['exports','STRING','sequelize'];(function(_0x5f49c9,_0x447c8d){var _0x263adc=function(_0x5de898){while(--_0x5de898){_0x5f49c9['push'](_0x5f49c9['shift']());}};_0x263adc(++_0x447c8d);}(_0x6469,0x92));var _0x9646=function(_0x2f9baa,_0x39ebda){_0x2f9baa=_0x2f9baa-0x0;var _0x1bb553=_0x6469[_0x2f9baa];return _0x1bb553;};'use strict';var Sequelize=require(_0x9646('0x0'));module[_0x9646('0x1')]={'name':{'type':Sequelize[_0x9646('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x9646('0x2')]},'remoteUri':{'type':Sequelize[_0x9646('0x2')]},'tenantId':{'type':Sequelize[_0x9646('0x2')]},'clientId':{'type':Sequelize[_0x9646('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x9646('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9646('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 34e1ff6..25191fd 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 _0x5496=['nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','show','params','find','create','body','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','channel','Dynamics365Field','Descriptions','getFields','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','/oauth2/token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','forEach','@odata.type','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','concat','send','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName','true','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','code','error','message','Dynamics365Account,\x20%s,\x20%s','result','catch','sendStatus','status','json','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','map','Dynamics365Account','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x489404,_0x3c8325){var _0x5d7d76=function(_0x60b3e9){while(--_0x60b3e9){_0x489404['push'](_0x489404['shift']());}};_0x5d7d76(++_0x3c8325);}(_0x5496,0x175));var _0x6549=function(_0x5548a1,_0x308628){_0x5548a1=_0x5548a1-0x0;var _0x227237=_0x5496[_0x5548a1];return _0x227237;};'use strict';var pdf=require(_0x6549('0x0'));var emlformat=require(_0x6549('0x1'));var rimraf=require(_0x6549('0x2'));var zipdir=require(_0x6549('0x3'));var jsonpatch=require(_0x6549('0x4'));var rp=require('request-promise');var moment=require(_0x6549('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6549('0x6'));var util=require(_0x6549('0x7'));var path=require(_0x6549('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6549('0x9'));var fs=require('fs');var _=require(_0x6549('0xa'));var squel=require('squel');var crypto=require(_0x6549('0xb'));var jsforce=require(_0x6549('0xc'));var deskjs=require(_0x6549('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xe'));var Papa=require(_0x6549('0xf'));var Redis=require(_0x6549('0x10'));var authService=require(_0x6549('0x11'));var qs=require(_0x6549('0x12'));var as=require(_0x6549('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6549('0x14'));var utils=require(_0x6549('0x15'));var config=require(_0x6549('0x16'));var licenseUtil=require(_0x6549('0x17'));var db=require(_0x6549('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0x6549('0x19')][_0x6549('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x57a149,_0x200ff1,_0x150fc8,_0x195d25){return new BPromise(function(_0x12b068,_0xc0e859){var _0x86ae9d=_0x195d25||client;return _0x86ae9d['request'](_0x57a149,_0x150fc8)['then'](function(_0x384f75){logger[_0x6549('0x1b')]('Dynamics365Account,\x20%s,\x20%s',_0x200ff1,_0x6549('0x1c'));logger[_0x6549('0x1d')](_0x6549('0x1e'),_0x200ff1,_0x6549('0x1c'),JSON[_0x6549('0x1f')](_0x384f75));if(_0x384f75['error']){if(_0x384f75['error'][_0x6549('0x20')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x200ff1,_0x384f75[_0x6549('0x21')][_0x6549('0x22')]);return _0xc0e859(_0x384f75[_0x6549('0x21')][_0x6549('0x22')]);}logger[_0x6549('0x21')]('Dynamics365Account,\x20%s,\x20%s',_0x200ff1,_0x384f75[_0x6549('0x21')]['message']);return _0x12b068(_0x384f75[_0x6549('0x21')][_0x6549('0x22')]);}else{logger[_0x6549('0x1b')](_0x6549('0x23'),_0x200ff1,_0x6549('0x1c'));_0x12b068(_0x384f75[_0x6549('0x24')][_0x6549('0x22')]);}})[_0x6549('0x25')](function(_0x2be467){logger[_0x6549('0x21')](_0x6549('0x23'),_0x200ff1,_0x2be467);_0xc0e859(_0x2be467);});});}function respondWithStatusCode(_0x1fbfa4,_0x23c0ba){_0x23c0ba=_0x23c0ba||0xcc;return function(_0x5eeacd){if(_0x5eeacd){return _0x1fbfa4[_0x6549('0x26')](_0x23c0ba);}return _0x1fbfa4[_0x6549('0x27')](_0x23c0ba)['end']();};}function respondWithResult(_0x126967,_0x29f89e){_0x29f89e=_0x29f89e||0xc8;return function(_0x3768cb){if(_0x3768cb){return _0x126967['status'](_0x29f89e)[_0x6549('0x28')](_0x3768cb);}};}function respondWithFilteredResult(_0xfb51a1,_0x14de1f){return function(_0x2900cd){if(_0x2900cd){var _0x442862=_0x2900cd['count'],_0x3edf02=_0x14de1f[_0x6549('0x29')],_0x2f58f7=_0x14de1f[_0x6549('0x29')]+_0x14de1f[_0x6549('0x2a')],_0xa6c718;if(_0x2f58f7>=_0x442862){_0x2f58f7=_0x442862;_0xa6c718=0xc8;}else{_0xa6c718=0xce;}_0xfb51a1['status'](_0xa6c718);return _0xfb51a1[_0x6549('0x2b')]('Content-Range',_0x3edf02+'-'+_0x2f58f7+'/'+_0x442862)['json'](_0x2900cd);}return null;};}function patchUpdates(_0x5aa3a6){return function(_0x36454b){try{jsonpatch[_0x6549('0x2c')](_0x36454b,_0x5aa3a6,!![]);}catch(_0x4f3069){return BPromise[_0x6549('0x2d')](_0x4f3069);}return _0x36454b[_0x6549('0x2e')]();};}function saveUpdates(_0x2e481f,_0x102a21){return function(_0x2aec2c){if(_0x2aec2c){return _0x2aec2c[_0x6549('0x2f')](_0x2e481f)[_0x6549('0x30')](function(_0x504c42){return _0x504c42;});}return null;};}function removeEntity(_0x1b453c,_0x3ebea6){return function(_0x2d52fe){if(_0x2d52fe){return _0x2d52fe[_0x6549('0x31')]()[_0x6549('0x30')](function(){_0x1b453c[_0x6549('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6b9840,_0x5bb783){return function(_0x302694){if(!_0x302694){_0x6b9840['sendStatus'](0x194);}return _0x302694;};}function handleError(_0x3bc70f,_0x16a7ba){_0x16a7ba=_0x16a7ba||0x1f4;return function(_0x3d9e9e){logger['error'](_0x3d9e9e[_0x6549('0x32')]);if(_0x3d9e9e[_0x6549('0x33')]){delete _0x3d9e9e[_0x6549('0x33')];}_0x3bc70f[_0x6549('0x27')](_0x16a7ba)['send'](_0x3d9e9e);};}exports['index']=function(_0x4fb441,_0x9d88fa){var _0xccba54={},_0x4a1d09={},_0x43220f={'count':0x0,'rows':[]};var _0x35a3db=_[_0x6549('0x34')](db[_0x6549('0x35')][_0x6549('0x36')],function(_0x4d3050){return{'name':_0x4d3050['fieldName'],'type':_0x4d3050[_0x6549('0x37')][_0x6549('0x38')]};});_0x4a1d09[_0x6549('0x39')]=_[_0x6549('0x34')](_0x35a3db,_0x6549('0x33'));_0x4a1d09[_0x6549('0x3a')]=_[_0x6549('0x3b')](_0x4fb441[_0x6549('0x3a')]);_0x4a1d09[_0x6549('0x3c')]=_[_0x6549('0x3d')](_0x4a1d09['model'],_0x4a1d09[_0x6549('0x3a')]);_0xccba54[_0x6549('0x3e')]=_[_0x6549('0x3d')](_0x4a1d09[_0x6549('0x39')],qs[_0x6549('0x3f')](_0x4fb441['query']['fields']));_0xccba54['attributes']=_0xccba54[_0x6549('0x3e')][_0x6549('0x40')]?_0xccba54[_0x6549('0x3e')]:_0x4a1d09[_0x6549('0x39')];if(!_0x4fb441['query']['hasOwnProperty'](_0x6549('0x41'))){_0xccba54[_0x6549('0x2a')]=qs[_0x6549('0x2a')](_0x4fb441['query'][_0x6549('0x2a')]);_0xccba54['offset']=qs[_0x6549('0x29')](_0x4fb441[_0x6549('0x3a')][_0x6549('0x29')]);}_0xccba54[_0x6549('0x42')]=qs[_0x6549('0x43')](_0x4fb441[_0x6549('0x3a')][_0x6549('0x43')]);_0xccba54['where']=qs[_0x6549('0x3c')](_[_0x6549('0x44')](_0x4fb441[_0x6549('0x3a')],_0x4a1d09[_0x6549('0x3c')]),_0x35a3db);if(_0x4fb441[_0x6549('0x3a')][_0x6549('0x45')]){_0xccba54[_0x6549('0x46')]=_[_0x6549('0x47')](_0xccba54[_0x6549('0x46')],{'$or':_[_0x6549('0x34')](_0x35a3db,function(_0x2b7b6a){if(_0x2b7b6a[_0x6549('0x37')]!==_0x6549('0x48')){var _0x283cfe={};_0x283cfe[_0x2b7b6a[_0x6549('0x33')]]={'$like':'%'+_0x4fb441[_0x6549('0x3a')]['filter']+'%'};return _0x283cfe;}})});}_0xccba54=_[_0x6549('0x47')]({},_0xccba54,_0x4fb441[_0x6549('0x49')]);var _0x5b1789={'where':_0xccba54[_0x6549('0x46')]};return db['Dynamics365Account'][_0x6549('0x4a')](_0x5b1789)['then'](function(_0x14c90a){_0x43220f[_0x6549('0x4a')]=_0x14c90a;if(_0x4fb441['query'][_0x6549('0x4b')]){_0xccba54[_0x6549('0x4c')]=[{'all':!![]}];}return db[_0x6549('0x35')][_0x6549('0x4d')](_0xccba54);})[_0x6549('0x30')](function(_0x595679){_0x43220f['rows']=_0x595679;return _0x43220f;})[_0x6549('0x30')](respondWithFilteredResult(_0x9d88fa,_0xccba54))[_0x6549('0x25')](handleError(_0x9d88fa,null));};exports[_0x6549('0x4e')]=function(_0x1712f3,_0x1e562b){var _0x49a4d7={'raw':![],'where':{'id':_0x1712f3[_0x6549('0x4f')]['id']}},_0x22370d={};_0x22370d[_0x6549('0x39')]=_[_0x6549('0x3b')](db[_0x6549('0x35')][_0x6549('0x36')]);_0x22370d[_0x6549('0x3a')]=_[_0x6549('0x3b')](_0x1712f3['query']);_0x22370d[_0x6549('0x3c')]=_['intersection'](_0x22370d[_0x6549('0x39')],_0x22370d[_0x6549('0x3a')]);_0x49a4d7[_0x6549('0x3e')]=_['intersection'](_0x22370d[_0x6549('0x39')],qs[_0x6549('0x3f')](_0x1712f3[_0x6549('0x3a')]['fields']));_0x49a4d7[_0x6549('0x3e')]=_0x49a4d7[_0x6549('0x3e')][_0x6549('0x40')]?_0x49a4d7[_0x6549('0x3e')]:_0x22370d[_0x6549('0x39')];if(_0x1712f3[_0x6549('0x3a')]['includeAll']){_0x49a4d7[_0x6549('0x4c')]=[{'all':!![]}];}_0x49a4d7=_['merge']({},_0x49a4d7,_0x1712f3[_0x6549('0x49')]);return db[_0x6549('0x35')][_0x6549('0x50')](_0x49a4d7)[_0x6549('0x30')](handleEntityNotFound(_0x1e562b,null))[_0x6549('0x30')](respondWithResult(_0x1e562b,null))[_0x6549('0x25')](handleError(_0x1e562b,null));};exports[_0x6549('0x51')]=function(_0x2e59ad,_0x1ff699){return db[_0x6549('0x35')][_0x6549('0x51')](_0x2e59ad[_0x6549('0x52')],{})['then'](respondWithResult(_0x1ff699,0xc9))[_0x6549('0x25')](handleError(_0x1ff699,null));};exports[_0x6549('0x2f')]=function(_0x325c0a,_0x1eaa0f){if(_0x325c0a[_0x6549('0x52')]['id']){delete _0x325c0a[_0x6549('0x52')]['id'];}return db[_0x6549('0x35')][_0x6549('0x50')]({'where':{'id':_0x325c0a['params']['id']}})[_0x6549('0x30')](handleEntityNotFound(_0x1eaa0f,null))[_0x6549('0x30')](saveUpdates(_0x325c0a[_0x6549('0x52')],null))[_0x6549('0x30')](respondWithResult(_0x1eaa0f,null))[_0x6549('0x25')](handleError(_0x1eaa0f,null));};exports[_0x6549('0x31')]=function(_0x2eb30c,_0x1898eb){return db['Dynamics365Account'][_0x6549('0x50')]({'where':{'id':_0x2eb30c[_0x6549('0x4f')]['id']}})[_0x6549('0x30')](handleEntityNotFound(_0x1898eb,null))[_0x6549('0x30')](removeEntity(_0x1898eb,null))[_0x6549('0x25')](handleError(_0x1898eb,null));};exports[_0x6549('0x53')]=function(_0x570c81,_0x2ca517,_0xe0a696){var _0x4bf996={};var _0x38bce4={};var _0x36a162;var _0x2efad1;return db['Dynamics365Account'][_0x6549('0x54')]({'where':{'id':_0x570c81[_0x6549('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2ca517,null))[_0x6549('0x30')](function(_0x509f69){if(_0x509f69){_0x36a162=_0x509f69;_0x38bce4[_0x6549('0x39')]=_['keys'](db[_0x6549('0x55')][_0x6549('0x36')]);_0x38bce4[_0x6549('0x3a')]=_[_0x6549('0x3b')](_0x570c81[_0x6549('0x3a')]);_0x38bce4[_0x6549('0x3c')]=_[_0x6549('0x3d')](_0x38bce4[_0x6549('0x39')],_0x38bce4[_0x6549('0x3a')]);_0x4bf996[_0x6549('0x3e')]=_[_0x6549('0x3d')](_0x38bce4[_0x6549('0x39')],qs[_0x6549('0x3f')](_0x570c81[_0x6549('0x3a')]['fields']));_0x4bf996[_0x6549('0x3e')]=_0x4bf996[_0x6549('0x3e')]['length']?_0x4bf996[_0x6549('0x3e')]:_0x38bce4[_0x6549('0x39')];_0x4bf996[_0x6549('0x42')]=qs[_0x6549('0x43')](_0x570c81['query'][_0x6549('0x43')]);_0x4bf996[_0x6549('0x46')]=qs[_0x6549('0x3c')](_[_0x6549('0x44')](_0x570c81['query'],_0x38bce4[_0x6549('0x3c')]));if(_0x570c81['query'][_0x6549('0x45')]){_0x4bf996[_0x6549('0x46')]=_[_0x6549('0x47')](_0x4bf996[_0x6549('0x46')],{'$or':_[_0x6549('0x34')](_0x4bf996[_0x6549('0x3e')],function(_0x426c09){var _0x131e58={};_0x131e58[_0x426c09]={'$like':'%'+_0x570c81[_0x6549('0x3a')][_0x6549('0x45')]+'%'};return _0x131e58;})});}_0x4bf996=_['merge']({},_0x4bf996,_0x570c81[_0x6549('0x49')]);return _0x36a162[_0x6549('0x53')](_0x4bf996);}})[_0x6549('0x30')](function(_0x2b4f16){if(_0x2b4f16){_0x2efad1=_0x2b4f16[_0x6549('0x40')];if(!_0x570c81[_0x6549('0x3a')]['hasOwnProperty']('nolimit')){_0x4bf996[_0x6549('0x2a')]=qs[_0x6549('0x2a')](_0x570c81[_0x6549('0x3a')]['limit']);_0x4bf996[_0x6549('0x29')]=qs[_0x6549('0x29')](_0x570c81['query'][_0x6549('0x29')]);}return _0x36a162[_0x6549('0x53')](_0x4bf996);}})[_0x6549('0x30')](function(_0x29604b){if(_0x29604b){return _0x29604b?{'count':_0x2efad1,'rows':_0x29604b}:null;}})[_0x6549('0x30')](respondWithResult(_0x2ca517,null))[_0x6549('0x25')](handleError(_0x2ca517,null));};exports[_0x6549('0x56')]=function(_0x402c26,_0x503935,_0x43c667){if(_0x402c26['body']['id']){delete _0x402c26[_0x6549('0x52')]['id'];}return db[_0x6549('0x35')]['findOne']({'where':{'id':_0x402c26[_0x6549('0x4f')]['id']}})[_0x6549('0x30')](handleEntityNotFound(_0x503935,null))[_0x6549('0x30')](function(_0x5f3873){if(_0x5f3873){_0x402c26[_0x6549('0x52')][_0x6549('0x57')]=_0x5f3873['id'];_0x402c26[_0x6549('0x52')][_0x6549('0x58')]=integrations[_0x6549('0x59')](_0x402c26[_0x6549('0x52')]['channel'],_0x402c26[_0x6549('0x52')][_0x6549('0x37')]);_0x402c26[_0x6549('0x52')]['Descriptions']=integrations['getDescriptions'](_0x402c26['body'][_0x6549('0x5a')],_0x402c26[_0x6549('0x52')][_0x6549('0x37')]);return db['Dynamics365Configuration']['create'](_0x402c26[_0x6549('0x52')],{'include':[{'model':db['Dynamics365Field'],'as':_0x6549('0x58')},{'model':db[_0x6549('0x5b')],'as':_0x6549('0x5c')}]});}return null;})[_0x6549('0x30')](respondWithResult(_0x503935,null))[_0x6549('0x25')](handleError(_0x503935,null));};exports[_0x6549('0x5d')]=function(_0x33c6ab,_0x5dcc26,_0x2f8c3a){var _0x38b330=_0x33c6ab[_0x6549('0x3a')]['ticketType'];var _0x22f06e=_0x38b330===_0x6549('0x5e')?_0x6549('0x5f'):_0x6549('0x60');var _0x3e8252='';var _0xf6b6da='';var _0x17258b='';var _0x47b135='';var _0x10eff1='';var _0x53483c='';var _0x328ff5='';var _0x476b0d='';var _0x20a273=[_0x6549('0x61'),_0x6549('0x62'),_0x6549('0x63'),_0x6549('0x64'),_0x6549('0x65'),'subject',_0x6549('0x66'),_0x6549('0x67'),_0x6549('0x68'),_0x6549('0x69')];var _0x1fa3a4=[_0x6549('0x6a'),_0x6549('0x6b'),_0x6549('0x6c'),_0x6549('0x6d'),_0x6549('0x6e'),'contactidyominame',_0x6549('0x6f'),_0x6549('0x70'),_0x6549('0x71'),_0x6549('0x72'),_0x6549('0x73'),_0x6549('0x74'),_0x6549('0x75'),_0x6549('0x76'),_0x6549('0x77'),_0x6549('0x78'),_0x6549('0x79'),_0x6549('0x7a'),_0x6549('0x7b'),_0x6549('0x7c'),_0x6549('0x7d'),_0x6549('0x7e'),_0x6549('0x7f'),_0x6549('0x80'),'firstresponsebykpiidname',_0x6549('0x81'),_0x6549('0x82'),_0x6549('0x83'),_0x6549('0x84'),_0x6549('0x85'),_0x6549('0x86'),_0x6549('0x87'),_0x6549('0x88'),_0x6549('0x89'),_0x6549('0x8a'),_0x6549('0x8b'),_0x6549('0x8c'),_0x6549('0x8d'),_0x6549('0x8e'),_0x6549('0x8f'),_0x6549('0x90'),_0x6549('0x91'),'overriddencreatedon',_0x6549('0x92'),_0x6549('0x93'),_0x6549('0x94'),_0x6549('0x95'),_0x6549('0x96'),_0x6549('0x97'),_0x6549('0x98'),'productidname',_0x6549('0x99'),'resolveby','resolvebykpiidname',_0x6549('0x9a'),'responsiblecontactidname',_0x6549('0x9b'),_0x6549('0x9c'),_0x6549('0x9d'),_0x6549('0x9e'),_0x6549('0x9f'),'statecode',_0x6549('0xa0'),'subjectidname',_0x6549('0xa1'),_0x6549('0xa2'),_0x6549('0xa3'),'traversedpath',_0x6549('0xa4'),_0x6549('0xa5')];var _0x5976ca=_0x20a273['concat'](_0x1fa3a4);return db[_0x6549('0x35')][_0x6549('0x54')]({'where':{'id':_0x33c6ab[_0x6549('0x4f')]['id']},'attributes':['id',_0x6549('0xa6'),_0x6549('0xa7'),_0x6549('0xa8'),_0x6549('0xa9'),_0x6549('0xaa'),_0x6549('0xab')]})[_0x6549('0x30')](handleEntityNotFound(_0x5dcc26,null))[_0x6549('0x30')](function(_0x24fbe8){if(_0x24fbe8){_0x476b0d=_0x24fbe8[_0x6549('0xa8')];var _0x4746bb=_0x476b0d[_0x6549('0xac')](-0x1);if(_0x4746bb==='/'){_0x476b0d=_0x476b0d[_0x6549('0xad')](0x0,_0x476b0d[_0x6549('0xae')](_0x4746bb));}_0x328ff5=util[_0x6549('0xaf')](_0x6549('0xb0'),_0x476b0d);var _0x5285ea={'method':'POST','uri':_0x6549('0xb1')+_0x24fbe8[_0x6549('0xa9')]+_0x6549('0xb2'),'form':{'client_id':_0x24fbe8[_0x6549('0xaa')],'resource':_0x476b0d,'username':_0x24fbe8[_0x6549('0xa6')],'password':_0x24fbe8[_0x6549('0xa7')],'grant_type':_0x6549('0xa7'),'client_secret':_0x24fbe8[_0x6549('0xab')]},'json':!![]};return rp(_0x5285ea);}})[_0x6549('0x30')](function(_0x263803){_0x53483c=_0x263803['access_token'];var _0x582217={'method':'GET','uri':encodeURI(_0x328ff5+_0x6549('0xb3')+_0x22f06e+'\x27'),'headers':{'Authorization':_0x6549('0xb4')+_0x53483c,'If-None-Match':null,'OData-Version':_0x6549('0xb5')},'json':!![]};return rp(_0x582217);})[_0x6549('0x30')](function(_0x7a1c77){var _0x570f56=_0x7a1c77[_0x6549('0xb6')][0x0];var _0x295fe1=_0x570f56[_0x6549('0xb7')];var _0x12382d={'method':_0x6549('0xb8'),'uri':_0x328ff5+_0x6549('0xb9')+_0x295fe1+_0x6549('0xba'),'headers':{'Authorization':_0x6549('0xb4')+_0x53483c,'If-None-Match':null,'OData-Version':_0x6549('0xb5')},'json':!![]};return rp(_0x12382d);})[_0x6549('0x30')](function(_0x31e41a){_0x3e8252=_0x31e41a;_0xf6b6da=_0x3e8252['Attributes'];_0xf6b6da=_[_0x6549('0xbb')](_0xf6b6da,function(_0x43708a){return!_0x5976ca[_0x6549('0xbc')](_0x43708a[_0x6549('0xbd')]);});var _0x585cad=[];var _0x158c92=[];_0xf6b6da[_0x6549('0xbe')](function(_0x1dbcc4){if(_0x1dbcc4[_0x6549('0xbf')]){var _0x1d27b4=_0x1dbcc4[_0x6549('0xbf')][_0x6549('0xad')](_0x1dbcc4[_0x6549('0xbf')][_0x6549('0xae')]('.')+0x1);if(_0x1d27b4==='PicklistAttributeMetadata'){_0x585cad[_0x6549('0xc0')](getSelectList(_0x328ff5,_0x38b330,_0x158c92,_0x3e8252[_0x6549('0xb7')],_0x1dbcc4[_0x6549('0xb7')],_0x53483c));}}});return Promise[_0x6549('0xc1')](_0x585cad);})['then'](function(_0x5a86d1){_0x17258b=_0x5a86d1[0x0];var _0x50b47f=[];var _0x144ff9=[];_0xf6b6da['forEach'](function(_0x576915){if(!_[_0x6549('0xc2')](_0x576915['@odata.type'])){var _0x2f607a=_0x576915[_0x6549('0xbf')][_0x6549('0xad')](_0x576915[_0x6549('0xbf')]['lastIndexOf']('.')+0x1);if(_0x2f607a===_0x6549('0xc3')){_0x50b47f[_0x6549('0xc0')](getBooleanList(_0x328ff5,_0x38b330,_0x144ff9,_0x3e8252[_0x6549('0xb7')],_0x576915[_0x6549('0xb7')],_0x53483c));}}});return Promise[_0x6549('0xc1')](_0x50b47f);})[_0x6549('0x30')](function(_0x1e6407){_0x47b135=_0x1e6407[0x0];var _0x29b0a3=[];var _0x295222=[];_0xf6b6da['forEach'](function(_0x31676d){if(_0x31676d[_0x6549('0xbf')]){var _0xc354a7=_0x31676d[_0x6549('0xbf')]['substring'](_0x31676d['@odata.type'][_0x6549('0xae')]('.')+0x1);if(_0xc354a7===_0x6549('0xc4')||_0xc354a7===_0x6549('0xc5')||_0xc354a7==='BigIntAttributeMetadata'||_0xc354a7===_0x6549('0xc6')||_0xc354a7===_0x6549('0xc7')||_0xc354a7==='DateTimeAttributeMetadata'||_0xc354a7===_0x6549('0xc8')||_0xc354a7==='EntityNameAttributeMetadata'||_0xc354a7===_0x6549('0xc9')||_0xc354a7==='DecimalAttributeMetadata'){_0x29b0a3[_0x6549('0xc0')](getInputList(_0x328ff5,_0x38b330,_0xc354a7,_0x295222,_0x3e8252['MetadataId'],_0x31676d[_0x6549('0xb7')],_0x53483c));}}});return Promise['all'](_0x29b0a3);})[_0x6549('0x30')](function(_0x3ee610){_0x10eff1=_0x3ee610[0x0];var _0x4150f4=_0x17258b[_0x6549('0xca')](_0x47b135)[_0x6549('0xca')](_0x10eff1);var _0x4cf1dd={'count':_0x4150f4[_0x6549('0x40')],'rows':_0x4150f4};return _0x4cf1dd;})['then'](respondWithResult(_0x5dcc26,null))[_0x6549('0x25')](function(_0x3592dc){var _0x3cab5c=_0x33c6ab[_0x6549('0x3a')]['test']?0x1f4:_0x3592dc['statusCode']||0x1f4;logger['error'](_0x3592dc[_0x6549('0x32')]);delete _0x3592dc[_0x6549('0x33')];if(_0x3cab5c===0x191){_0x3cab5c=0x190;}_0x5dcc26['status'](_0x3cab5c)[_0x6549('0xcb')](_0x33c6ab[_0x6549('0x3a')]['test']?{'message':_0x6549('0xcc'),'statusCode':_0x3592dc[_0x6549('0xcd')]}:_0x3592dc);});};function getSelectList(_0x2cc709,_0x30dc57,_0x4f068d,_0x556394,_0x51fd41,_0x6ed426){var _0x2eaa28={'method':_0x6549('0xb8'),'uri':_0x2cc709+_0x6549('0xb9')+_0x556394+_0x6549('0xce')+_0x51fd41+_0x6549('0xcf')+_0x6549('0xd0'),'headers':{'Authorization':_0x6549('0xb4')+_0x6ed426,'If-None-Match':null,'OData-Version':_0x6549('0xb5')},'json':!![]};return rp(_0x2eaa28)['then'](function(_0x1055a2){var _0x2ef9ba=[];var _0x323d3f=_0x1055a2[_0x6549('0xd1')][_0x6549('0xd2')];_0x323d3f[_0x6549('0xbe')](function(_0x33cbbf){_0x2ef9ba[_0x6549('0xc0')]({'name':_0x33cbbf[_0x6549('0xd3')][_0x6549('0xd4')]['Label'],'value':String(_0x33cbbf[_0x6549('0xd5')])});});var _0x3c24a7={'id':_0x30dc57+'_'+_0x1055a2['LogicalName'],'name':_0x1055a2[_0x6549('0xd6')][_0x6549('0xd4')][_0x6549('0xd3')],'custom':![],'options':_0x2ef9ba};_0x4f068d[_0x6549('0xc0')](_0x3c24a7);return _0x4f068d;});}function getBooleanList(_0x2f7998,_0x356c8c,_0x5b1d36,_0x24e598,_0xe2903f,_0x2598b7){var _0x23e516={'method':_0x6549('0xb8'),'uri':_0x2f7998+_0x6549('0xb9')+_0x24e598+_0x6549('0xce')+_0xe2903f+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':'Bearer\x20'+_0x2598b7,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x23e516)['then'](function(_0x1b8ead){var _0x1bbb8e=[];_0x1bbb8e['push']({'name':_0x1b8ead[_0x6549('0xd1')]['TrueOption'][_0x6549('0xd3')][_0x6549('0xd4')][_0x6549('0xd3')],'value':_0x6549('0xd7')},{'name':_0x1b8ead[_0x6549('0xd1')]['FalseOption'][_0x6549('0xd3')][_0x6549('0xd4')]['Label'],'value':_0x6549('0xd8')});var _0x3817ac={'id':_0x356c8c+'_'+_0x1b8ead['LogicalName'],'name':_0x1b8ead[_0x6549('0xd6')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x1bbb8e};_0x5b1d36[_0x6549('0xc0')](_0x3817ac);return _0x5b1d36;});}function getInputList(_0x30ff73,_0x5cc1b3,_0x53c5e2,_0x4f28a4,_0x3e0e65,_0x186c43,_0xff0074){var _0x99d8f0={'method':_0x6549('0xb8'),'uri':_0x30ff73+_0x6549('0xb9')+_0x3e0e65+_0x6549('0xce')+_0x186c43+_0x6549('0xd9')+_0x53c5e2+_0x6549('0xda'),'headers':{'Authorization':'Bearer\x20'+_0xff0074,'If-None-Match':null,'OData-Version':_0x6549('0xb5')},'json':!![]};return rp(_0x99d8f0)[_0x6549('0x30')](function(_0x582fa6){var _0x280b4c={'id':_0x5cc1b3+'_'+_0x582fa6[_0x6549('0xbd')],'name':_0x582fa6[_0x6549('0xd6')]['UserLocalizedLabel']?_0x582fa6[_0x6549('0xd6')][_0x6549('0xd4')][_0x6549('0xd3')]:_0x582fa6[_0x6549('0xbd')],'custom':![],'options':[]};_0x4f28a4[_0x6549('0xc0')](_0x280b4c);return _0x4f28a4;});} \ No newline at end of file +var _0x4c60=['querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','sendStatus','status','end','json','offset','set','Content-Range','apply','update','stack','name','index','fieldName','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','VIRTUAL','filter','merge','options','Dynamics365Account','count','includeAll','catch','show','params','include','find','create','body','getConfigurations','findOne','Dynamics365Configuration','rawAttributes','addConfiguration','Subjects','getSubjects','type','Descriptions','getDescriptions','channel','Dynamics365Field','getFields','ticketType','incident','PhoneCall','title','customerid','ownerid','subject','regardingobjectid','directioncode','accountidname','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','lastonholdtime','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidyominame','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','clientId','clientSecret','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','tenantId','access_token','GET','value','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','4.0','Attributes','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','send','Wrong\x20credentials','EntityDefinitions(','Options','Value','Label',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','FalseOption','UserLocalizedLabel','false','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','html-pdf','eml-format','rimraf','zip-dir','request-promise','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x4c60,0xc1));var _0x04c6=function(_0x55213c,_0x276eed){_0x55213c=_0x55213c-0x0;var _0xd0de4a=_0x4c60[_0x55213c];return _0xd0de4a;};'use strict';var pdf=require(_0x04c6('0x0'));var emlformat=require(_0x04c6('0x1'));var rimraf=require(_0x04c6('0x2'));var zipdir=require(_0x04c6('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x04c6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x04c6('0x5'));var sox=require(_0x04c6('0x6'));var csv=require(_0x04c6('0x7'));var ejs=require(_0x04c6('0x8'));var fs=require('fs');var _=require(_0x04c6('0x9'));var squel=require(_0x04c6('0xa'));var crypto=require(_0x04c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x04c6('0xc'));var toCsv=require(_0x04c6('0x7'));var querystring=require(_0x04c6('0xd'));var Papa=require(_0x04c6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x04c6('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04c6('0x10'))(_0x04c6('0x11'));var utils=require('../../config/utils');var config=require(_0x04c6('0x12'));var licenseUtil=require(_0x04c6('0x13'));var db=require(_0x04c6('0x14'))['db'];var integrations=require(_0x04c6('0x15'));var jayson=require('jayson/promise');var client=jayson[_0x04c6('0x16')][_0x04c6('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x4384ad,_0x56422a,_0x12d1c5,_0x15cbe0){return new BPromise(function(_0x28632e,_0x3e80a6){var _0x4760f8=_0x15cbe0||client;return _0x4760f8[_0x04c6('0x18')](_0x4384ad,_0x12d1c5)[_0x04c6('0x19')](function(_0x3d46a9){logger['info'](_0x04c6('0x1a'),_0x56422a,_0x04c6('0x1b'));logger[_0x04c6('0x1c')](_0x04c6('0x1d'),_0x56422a,_0x04c6('0x1b'),JSON[_0x04c6('0x1e')](_0x3d46a9));if(_0x3d46a9[_0x04c6('0x1f')]){if(_0x3d46a9[_0x04c6('0x1f')]['code']===0x1f4){logger[_0x04c6('0x1f')](_0x04c6('0x1a'),_0x56422a,_0x3d46a9[_0x04c6('0x1f')]['message']);return _0x3e80a6(_0x3d46a9['error']['message']);}logger[_0x04c6('0x1f')](_0x04c6('0x1a'),_0x56422a,_0x3d46a9['error']['message']);return _0x28632e(_0x3d46a9[_0x04c6('0x1f')][_0x04c6('0x20')]);}else{logger[_0x04c6('0x21')]('Dynamics365Account,\x20%s,\x20%s',_0x56422a,_0x04c6('0x1b'));_0x28632e(_0x3d46a9[_0x04c6('0x22')][_0x04c6('0x20')]);}})['catch'](function(_0x2d3277){logger[_0x04c6('0x1f')]('Dynamics365Account,\x20%s,\x20%s',_0x56422a,_0x2d3277);_0x3e80a6(_0x2d3277);});});}function respondWithStatusCode(_0x54a8b0,_0x4c8d72){_0x4c8d72=_0x4c8d72||0xcc;return function(_0x348ea3){if(_0x348ea3){return _0x54a8b0[_0x04c6('0x23')](_0x4c8d72);}return _0x54a8b0[_0x04c6('0x24')](_0x4c8d72)[_0x04c6('0x25')]();};}function respondWithResult(_0x3e1328,_0x52e5f5){_0x52e5f5=_0x52e5f5||0xc8;return function(_0x562952){if(_0x562952){return _0x3e1328[_0x04c6('0x24')](_0x52e5f5)[_0x04c6('0x26')](_0x562952);}};}function respondWithFilteredResult(_0x9acfa,_0x3233d7){return function(_0x4f256f){if(_0x4f256f){var _0x1f5aaf=_0x4f256f['count'],_0x47c69a=_0x3233d7[_0x04c6('0x27')],_0x1d0d3f=_0x3233d7[_0x04c6('0x27')]+_0x3233d7['limit'],_0x165cb5;if(_0x1d0d3f>=_0x1f5aaf){_0x1d0d3f=_0x1f5aaf;_0x165cb5=0xc8;}else{_0x165cb5=0xce;}_0x9acfa['status'](_0x165cb5);return _0x9acfa[_0x04c6('0x28')](_0x04c6('0x29'),_0x47c69a+'-'+_0x1d0d3f+'/'+_0x1f5aaf)[_0x04c6('0x26')](_0x4f256f);}return null;};}function patchUpdates(_0xbb9e81){return function(_0x23c500){try{jsonpatch[_0x04c6('0x2a')](_0x23c500,_0xbb9e81,!![]);}catch(_0x49c4ed){return BPromise['reject'](_0x49c4ed);}return _0x23c500['save']();};}function saveUpdates(_0x375a03,_0x5241b5){return function(_0x1e76e2){if(_0x1e76e2){return _0x1e76e2[_0x04c6('0x2b')](_0x375a03)['then'](function(_0x437bfc){return _0x437bfc;});}return null;};}function removeEntity(_0x36f2af,_0x6e43fb){return function(_0x14b6f6){if(_0x14b6f6){return _0x14b6f6['destroy']()[_0x04c6('0x19')](function(){_0x36f2af[_0x04c6('0x24')](0xcc)[_0x04c6('0x25')]();});}};}function handleEntityNotFound(_0x69b908,_0x3762af){return function(_0x902e66){if(!_0x902e66){_0x69b908[_0x04c6('0x23')](0x194);}return _0x902e66;};}function handleError(_0x46380e,_0x19a05b){_0x19a05b=_0x19a05b||0x1f4;return function(_0xca0b8f){logger[_0x04c6('0x1f')](_0xca0b8f[_0x04c6('0x2c')]);if(_0xca0b8f[_0x04c6('0x2d')]){delete _0xca0b8f[_0x04c6('0x2d')];}_0x46380e[_0x04c6('0x24')](_0x19a05b)['send'](_0xca0b8f);};}exports[_0x04c6('0x2e')]=function(_0x1639a1,_0x332811){var _0x206e32={},_0x5a2e6a={},_0x181736={'count':0x0,'rows':[]};var _0x31de0f=_['map'](db['Dynamics365Account']['rawAttributes'],function(_0x4f0600){return{'name':_0x4f0600[_0x04c6('0x2f')],'type':_0x4f0600['type'][_0x04c6('0x30')]};});_0x5a2e6a['model']=_[_0x04c6('0x31')](_0x31de0f,_0x04c6('0x2d'));_0x5a2e6a[_0x04c6('0x32')]=_[_0x04c6('0x33')](_0x1639a1['query']);_0x5a2e6a['filters']=_[_0x04c6('0x34')](_0x5a2e6a[_0x04c6('0x35')],_0x5a2e6a['query']);_0x206e32[_0x04c6('0x36')]=_['intersection'](_0x5a2e6a['model'],qs[_0x04c6('0x37')](_0x1639a1['query'][_0x04c6('0x37')]));_0x206e32[_0x04c6('0x36')]=_0x206e32['attributes'][_0x04c6('0x38')]?_0x206e32['attributes']:_0x5a2e6a[_0x04c6('0x35')];if(!_0x1639a1[_0x04c6('0x32')][_0x04c6('0x39')](_0x04c6('0x3a'))){_0x206e32[_0x04c6('0x3b')]=qs['limit'](_0x1639a1[_0x04c6('0x32')]['limit']);_0x206e32[_0x04c6('0x27')]=qs['offset'](_0x1639a1[_0x04c6('0x32')][_0x04c6('0x27')]);}_0x206e32[_0x04c6('0x3c')]=qs[_0x04c6('0x3d')](_0x1639a1[_0x04c6('0x32')][_0x04c6('0x3d')]);_0x206e32[_0x04c6('0x3e')]=qs['filters'](_[_0x04c6('0x3f')](_0x1639a1['query'],_0x5a2e6a[_0x04c6('0x40')]),_0x31de0f);if(_0x1639a1['query']['filter']){_0x206e32[_0x04c6('0x3e')]=_['merge'](_0x206e32[_0x04c6('0x3e')],{'$or':_[_0x04c6('0x31')](_0x31de0f,function(_0x15995b){if(_0x15995b['type']!==_0x04c6('0x41')){var _0x19654={};_0x19654[_0x15995b[_0x04c6('0x2d')]]={'$like':'%'+_0x1639a1[_0x04c6('0x32')][_0x04c6('0x42')]+'%'};return _0x19654;}})});}_0x206e32=_[_0x04c6('0x43')]({},_0x206e32,_0x1639a1[_0x04c6('0x44')]);var _0x5a2d24={'where':_0x206e32['where']};return db[_0x04c6('0x45')][_0x04c6('0x46')](_0x5a2d24)[_0x04c6('0x19')](function(_0x5d6726){_0x181736[_0x04c6('0x46')]=_0x5d6726;if(_0x1639a1[_0x04c6('0x32')][_0x04c6('0x47')]){_0x206e32['include']=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x206e32);})[_0x04c6('0x19')](function(_0x25c185){_0x181736['rows']=_0x25c185;return _0x181736;})[_0x04c6('0x19')](respondWithFilteredResult(_0x332811,_0x206e32))[_0x04c6('0x48')](handleError(_0x332811,null));};exports[_0x04c6('0x49')]=function(_0x4ef366,_0x392983){var _0xec7279={'raw':![],'where':{'id':_0x4ef366[_0x04c6('0x4a')]['id']}},_0x5e68e0={};_0x5e68e0[_0x04c6('0x35')]=_[_0x04c6('0x33')](db[_0x04c6('0x45')]['rawAttributes']);_0x5e68e0[_0x04c6('0x32')]=_[_0x04c6('0x33')](_0x4ef366[_0x04c6('0x32')]);_0x5e68e0[_0x04c6('0x40')]=_['intersection'](_0x5e68e0[_0x04c6('0x35')],_0x5e68e0[_0x04c6('0x32')]);_0xec7279[_0x04c6('0x36')]=_[_0x04c6('0x34')](_0x5e68e0['model'],qs[_0x04c6('0x37')](_0x4ef366[_0x04c6('0x32')][_0x04c6('0x37')]));_0xec7279['attributes']=_0xec7279[_0x04c6('0x36')][_0x04c6('0x38')]?_0xec7279[_0x04c6('0x36')]:_0x5e68e0[_0x04c6('0x35')];if(_0x4ef366[_0x04c6('0x32')][_0x04c6('0x47')]){_0xec7279[_0x04c6('0x4b')]=[{'all':!![]}];}_0xec7279=_[_0x04c6('0x43')]({},_0xec7279,_0x4ef366[_0x04c6('0x44')]);return db[_0x04c6('0x45')][_0x04c6('0x4c')](_0xec7279)[_0x04c6('0x19')](handleEntityNotFound(_0x392983,null))[_0x04c6('0x19')](respondWithResult(_0x392983,null))['catch'](handleError(_0x392983,null));};exports[_0x04c6('0x4d')]=function(_0x394237,_0x5ce521){return db[_0x04c6('0x45')][_0x04c6('0x4d')](_0x394237['body'],{})[_0x04c6('0x19')](respondWithResult(_0x5ce521,0xc9))[_0x04c6('0x48')](handleError(_0x5ce521,null));};exports[_0x04c6('0x2b')]=function(_0x32d5e8,_0x28dfd0){if(_0x32d5e8[_0x04c6('0x4e')]['id']){delete _0x32d5e8[_0x04c6('0x4e')]['id'];}return db[_0x04c6('0x45')][_0x04c6('0x4c')]({'where':{'id':_0x32d5e8[_0x04c6('0x4a')]['id']}})['then'](handleEntityNotFound(_0x28dfd0,null))['then'](saveUpdates(_0x32d5e8['body'],null))['then'](respondWithResult(_0x28dfd0,null))[_0x04c6('0x48')](handleError(_0x28dfd0,null));};exports['destroy']=function(_0x32547e,_0x570e25){return db[_0x04c6('0x45')][_0x04c6('0x4c')]({'where':{'id':_0x32547e['params']['id']}})['then'](handleEntityNotFound(_0x570e25,null))[_0x04c6('0x19')](removeEntity(_0x570e25,null))[_0x04c6('0x48')](handleError(_0x570e25,null));};exports[_0x04c6('0x4f')]=function(_0x2e54e5,_0x583b3c,_0x2fb324){var _0xf4e9d6={};var _0x216cb0={};var _0x18b51d;var _0x24c5be;return db[_0x04c6('0x45')][_0x04c6('0x50')]({'where':{'id':_0x2e54e5['params']['id']}})[_0x04c6('0x19')](handleEntityNotFound(_0x583b3c,null))['then'](function(_0x4336a3){if(_0x4336a3){_0x18b51d=_0x4336a3;_0x216cb0[_0x04c6('0x35')]=_['keys'](db[_0x04c6('0x51')][_0x04c6('0x52')]);_0x216cb0[_0x04c6('0x32')]=_[_0x04c6('0x33')](_0x2e54e5[_0x04c6('0x32')]);_0x216cb0[_0x04c6('0x40')]=_[_0x04c6('0x34')](_0x216cb0[_0x04c6('0x35')],_0x216cb0['query']);_0xf4e9d6[_0x04c6('0x36')]=_['intersection'](_0x216cb0[_0x04c6('0x35')],qs[_0x04c6('0x37')](_0x2e54e5['query']['fields']));_0xf4e9d6[_0x04c6('0x36')]=_0xf4e9d6['attributes'][_0x04c6('0x38')]?_0xf4e9d6[_0x04c6('0x36')]:_0x216cb0['model'];_0xf4e9d6[_0x04c6('0x3c')]=qs[_0x04c6('0x3d')](_0x2e54e5[_0x04c6('0x32')][_0x04c6('0x3d')]);_0xf4e9d6[_0x04c6('0x3e')]=qs[_0x04c6('0x40')](_[_0x04c6('0x3f')](_0x2e54e5[_0x04c6('0x32')],_0x216cb0[_0x04c6('0x40')]));if(_0x2e54e5[_0x04c6('0x32')][_0x04c6('0x42')]){_0xf4e9d6['where']=_[_0x04c6('0x43')](_0xf4e9d6[_0x04c6('0x3e')],{'$or':_[_0x04c6('0x31')](_0xf4e9d6[_0x04c6('0x36')],function(_0x492aa1){var _0x1598f0={};_0x1598f0[_0x492aa1]={'$like':'%'+_0x2e54e5[_0x04c6('0x32')][_0x04c6('0x42')]+'%'};return _0x1598f0;})});}_0xf4e9d6=_['merge']({},_0xf4e9d6,_0x2e54e5['options']);return _0x18b51d[_0x04c6('0x4f')](_0xf4e9d6);}})[_0x04c6('0x19')](function(_0x2e8631){if(_0x2e8631){_0x24c5be=_0x2e8631[_0x04c6('0x38')];if(!_0x2e54e5[_0x04c6('0x32')][_0x04c6('0x39')]('nolimit')){_0xf4e9d6[_0x04c6('0x3b')]=qs[_0x04c6('0x3b')](_0x2e54e5[_0x04c6('0x32')]['limit']);_0xf4e9d6['offset']=qs[_0x04c6('0x27')](_0x2e54e5[_0x04c6('0x32')][_0x04c6('0x27')]);}return _0x18b51d[_0x04c6('0x4f')](_0xf4e9d6);}})['then'](function(_0x13111c){if(_0x13111c){return _0x13111c?{'count':_0x24c5be,'rows':_0x13111c}:null;}})['then'](respondWithResult(_0x583b3c,null))['catch'](handleError(_0x583b3c,null));};exports[_0x04c6('0x53')]=function(_0xe178dd,_0x2e75f5,_0x1904d4){if(_0xe178dd[_0x04c6('0x4e')]['id']){delete _0xe178dd[_0x04c6('0x4e')]['id'];}return db[_0x04c6('0x45')]['findOne']({'where':{'id':_0xe178dd[_0x04c6('0x4a')]['id']}})[_0x04c6('0x19')](handleEntityNotFound(_0x2e75f5,null))[_0x04c6('0x19')](function(_0x329c82){if(_0x329c82){_0xe178dd[_0x04c6('0x4e')]['AccountId']=_0x329c82['id'];_0xe178dd['body'][_0x04c6('0x54')]=integrations[_0x04c6('0x55')](_0xe178dd[_0x04c6('0x4e')]['channel'],_0xe178dd[_0x04c6('0x4e')][_0x04c6('0x56')]);_0xe178dd['body'][_0x04c6('0x57')]=integrations[_0x04c6('0x58')](_0xe178dd[_0x04c6('0x4e')][_0x04c6('0x59')],_0xe178dd[_0x04c6('0x4e')][_0x04c6('0x56')]);return db[_0x04c6('0x51')][_0x04c6('0x4d')](_0xe178dd[_0x04c6('0x4e')],{'include':[{'model':db[_0x04c6('0x5a')],'as':_0x04c6('0x54')},{'model':db[_0x04c6('0x5a')],'as':_0x04c6('0x57')}]});}return null;})['then'](respondWithResult(_0x2e75f5,null))[_0x04c6('0x48')](handleError(_0x2e75f5,null));};exports[_0x04c6('0x5b')]=function(_0x4f4136,_0xf1e91d,_0x285dd1){var _0xd57626=_0x4f4136[_0x04c6('0x32')][_0x04c6('0x5c')];var _0x4e8d22=_0xd57626===_0x04c6('0x5d')?'Incident':_0x04c6('0x5e');var _0x4e72cd='';var _0xee50b4='';var _0x1110f2='';var _0x199de2='';var _0x23ce75='';var _0x12bb0c='';var _0x150639='';var _0x34f7a6='';var _0x242bff=[_0x04c6('0x5f'),'description',_0x04c6('0x60'),_0x04c6('0x61'),'caseorigincode',_0x04c6('0x62'),'phonenumber',_0x04c6('0x63'),_0x04c6('0x64'),'phonecall_activity_parties'];var _0xd01b0d=[_0x04c6('0x65'),'accountidyominame',_0x04c6('0x66'),_0x04c6('0x67'),'contactidname',_0x04c6('0x68'),_0x04c6('0x69'),'contractidname',_0x04c6('0x6a'),_0x04c6('0x6b'),'createdbyname','createdbyyominame','createdon',_0x04c6('0x6c'),_0x04c6('0x6d'),_0x04c6('0x6e'),_0x04c6('0x6f'),_0x04c6('0x70'),'emailaddress',_0x04c6('0x71'),_0x04c6('0x72'),_0x04c6('0x73'),_0x04c6('0x74'),_0x04c6('0x75'),_0x04c6('0x76'),_0x04c6('0x77'),'importsequencenumber',_0x04c6('0x78'),'kbarticleidname',_0x04c6('0x79'),'masteridname','modifiedbyexternalpartyname',_0x04c6('0x7a'),'modifiedbyname',_0x04c6('0x7b'),_0x04c6('0x7c'),_0x04c6('0x7d'),_0x04c6('0x7e'),_0x04c6('0x7f'),'msdyn_iotalertname','numberofchildincidents',_0x04c6('0x80'),_0x04c6('0x81'),_0x04c6('0x82'),_0x04c6('0x83'),_0x04c6('0x84'),_0x04c6('0x85'),'primarycontactidname',_0x04c6('0x86'),'prioritycodename','productidname',_0x04c6('0x87'),_0x04c6('0x88'),_0x04c6('0x89'),_0x04c6('0x8a'),_0x04c6('0x8b'),_0x04c6('0x8c'),_0x04c6('0x8d'),_0x04c6('0x8e'),_0x04c6('0x8f'),_0x04c6('0x90'),_0x04c6('0x91'),'statuscode',_0x04c6('0x92'),'ticketnumber','timezoneruleversionnumber',_0x04c6('0x93'),_0x04c6('0x94'),_0x04c6('0x95'),_0x04c6('0x96')];var _0xcb0dc2=_0x242bff[_0x04c6('0x97')](_0xd01b0d);return db[_0x04c6('0x45')][_0x04c6('0x50')]({'where':{'id':_0x4f4136[_0x04c6('0x4a')]['id']},'attributes':['id',_0x04c6('0x98'),_0x04c6('0x99'),'remoteUri','tenantId',_0x04c6('0x9a'),_0x04c6('0x9b')]})['then'](handleEntityNotFound(_0xf1e91d,null))[_0x04c6('0x19')](function(_0x3addb1){if(_0x3addb1){_0x34f7a6=_0x3addb1['remoteUri'];var _0x4504fc=_0x34f7a6[_0x04c6('0x9c')](-0x1);if(_0x4504fc==='/'){_0x34f7a6=_0x34f7a6[_0x04c6('0x9d')](0x0,_0x34f7a6[_0x04c6('0x9e')](_0x4504fc));}_0x150639=util[_0x04c6('0x9f')](_0x04c6('0xa0'),_0x34f7a6);var _0x21bde2={'method':_0x04c6('0xa1'),'uri':'https://login.microsoftonline.com/'+_0x3addb1[_0x04c6('0xa2')]+'/oauth2/token','form':{'client_id':_0x3addb1[_0x04c6('0x9a')],'resource':_0x34f7a6,'username':_0x3addb1[_0x04c6('0x98')],'password':_0x3addb1[_0x04c6('0x99')],'grant_type':_0x04c6('0x99'),'client_secret':_0x3addb1[_0x04c6('0x9b')]},'json':!![]};return rp(_0x21bde2);}})[_0x04c6('0x19')](function(_0x4aca4e){_0x12bb0c=_0x4aca4e[_0x04c6('0xa3')];var _0x1b7cec={'method':_0x04c6('0xa4'),'uri':encodeURI(_0x150639+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x4e8d22+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x12bb0c,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1b7cec);})[_0x04c6('0x19')](function(_0x181268){var _0x47f933=_0x181268[_0x04c6('0xa5')][0x0];var _0x29461e=_0x47f933[_0x04c6('0xa6')];var _0x5c47a4={'method':_0x04c6('0xa4'),'uri':_0x150639+'EntityDefinitions('+_0x29461e+_0x04c6('0xa7'),'headers':{'Authorization':_0x04c6('0xa8')+_0x12bb0c,'If-None-Match':null,'OData-Version':_0x04c6('0xa9')},'json':!![]};return rp(_0x5c47a4);})['then'](function(_0x534d1f){_0x4e72cd=_0x534d1f;_0xee50b4=_0x4e72cd[_0x04c6('0xaa')];_0xee50b4=_[_0x04c6('0xab')](_0xee50b4,function(_0x2e92d5){return!_0xcb0dc2[_0x04c6('0xac')](_0x2e92d5['LogicalName']);});var _0x58c790=[];var _0x3e12a4=[];_0xee50b4[_0x04c6('0xad')](function(_0x91f883){if(_0x91f883['@odata.type']){var _0x2c1536=_0x91f883[_0x04c6('0xae')][_0x04c6('0x9d')](_0x91f883[_0x04c6('0xae')][_0x04c6('0x9e')]('.')+0x1);if(_0x2c1536===_0x04c6('0xaf')){_0x58c790[_0x04c6('0xb0')](getSelectList(_0x150639,_0xd57626,_0x3e12a4,_0x4e72cd[_0x04c6('0xa6')],_0x91f883[_0x04c6('0xa6')],_0x12bb0c));}}});return Promise[_0x04c6('0xb1')](_0x58c790);})['then'](function(_0x14ce9e){_0x1110f2=_0x14ce9e[0x0];var _0x388811=[];var _0x117e5d=[];_0xee50b4[_0x04c6('0xad')](function(_0x28b75e){if(!_[_0x04c6('0xb2')](_0x28b75e[_0x04c6('0xae')])){var _0x4a5853=_0x28b75e[_0x04c6('0xae')][_0x04c6('0x9d')](_0x28b75e[_0x04c6('0xae')][_0x04c6('0x9e')]('.')+0x1);if(_0x4a5853===_0x04c6('0xb3')){_0x388811[_0x04c6('0xb0')](getBooleanList(_0x150639,_0xd57626,_0x117e5d,_0x4e72cd[_0x04c6('0xa6')],_0x28b75e[_0x04c6('0xa6')],_0x12bb0c));}}});return Promise['all'](_0x388811);})[_0x04c6('0x19')](function(_0x724e96){_0x199de2=_0x724e96[0x0];var _0x5ce5fa=[];var _0x337c1e=[];_0xee50b4[_0x04c6('0xad')](function(_0x23de34){if(_0x23de34[_0x04c6('0xae')]){var _0x29b5f2=_0x23de34['@odata.type']['substring'](_0x23de34[_0x04c6('0xae')][_0x04c6('0x9e')]('.')+0x1);if(_0x29b5f2===_0x04c6('0xb4')||_0x29b5f2==='DoubleAttributeMetadata'||_0x29b5f2===_0x04c6('0xb5')||_0x29b5f2===_0x04c6('0xb6')||_0x29b5f2==='MemoAttributeMetadata'||_0x29b5f2==='DateTimeAttributeMetadata'||_0x29b5f2===_0x04c6('0xb7')||_0x29b5f2===_0x04c6('0xb8')||_0x29b5f2==='StateAttributeMetadata'||_0x29b5f2===_0x04c6('0xb9')){_0x5ce5fa[_0x04c6('0xb0')](getInputList(_0x150639,_0xd57626,_0x29b5f2,_0x337c1e,_0x4e72cd[_0x04c6('0xa6')],_0x23de34[_0x04c6('0xa6')],_0x12bb0c));}}});return Promise['all'](_0x5ce5fa);})[_0x04c6('0x19')](function(_0x41bd1f){_0x23ce75=_0x41bd1f[0x0];var _0x395aa9=_0x1110f2[_0x04c6('0x97')](_0x199de2)[_0x04c6('0x97')](_0x23ce75);var _0x30204b={'count':_0x395aa9['length'],'rows':_0x395aa9};return _0x30204b;})[_0x04c6('0x19')](respondWithResult(_0xf1e91d,null))[_0x04c6('0x48')](function(_0x42b3ed){var _0x3a9695=_0x4f4136[_0x04c6('0x32')][_0x04c6('0xba')]?0x1f4:_0x42b3ed[_0x04c6('0xbb')]||0x1f4;logger[_0x04c6('0x1f')](_0x42b3ed['stack']);delete _0x42b3ed['name'];if(_0x3a9695===0x191){_0x3a9695=0x190;}_0xf1e91d[_0x04c6('0x24')](_0x3a9695)[_0x04c6('0xbc')](_0x4f4136[_0x04c6('0x32')]['test']?{'message':_0x04c6('0xbd'),'statusCode':_0x42b3ed[_0x04c6('0xbb')]}:_0x42b3ed);});};function getSelectList(_0x2980ea,_0x57895c,_0x58017b,_0xa28069,_0x32c577,_0x295cc4){var _0x414e80={'method':_0x04c6('0xa4'),'uri':_0x2980ea+_0x04c6('0xbe')+_0xa28069+')/Attributes('+_0x32c577+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x04c6('0xa8')+_0x295cc4,'If-None-Match':null,'OData-Version':_0x04c6('0xa9')},'json':!![]};return rp(_0x414e80)['then'](function(_0x3a1763){var _0x35a56e=[];var _0x15a74a=_0x3a1763['OptionSet'][_0x04c6('0xbf')];_0x15a74a[_0x04c6('0xad')](function(_0x1ee1fa){_0x35a56e[_0x04c6('0xb0')]({'name':_0x1ee1fa['Label']['UserLocalizedLabel']['Label'],'value':String(_0x1ee1fa[_0x04c6('0xc0')])});});var _0xeda6fc={'id':_0x57895c+'_'+_0x3a1763['LogicalName'],'name':_0x3a1763['DisplayName']['UserLocalizedLabel'][_0x04c6('0xc1')],'custom':![],'options':_0x35a56e};_0x58017b['push'](_0xeda6fc);return _0x58017b;});}function getBooleanList(_0x37682a,_0x1d4068,_0x4203a7,_0x386c62,_0x3906b2,_0x410bc2){var _0x59a97f={'method':_0x04c6('0xa4'),'uri':_0x37682a+_0x04c6('0xbe')+_0x386c62+_0x04c6('0xc2')+_0x3906b2+_0x04c6('0xc3'),'headers':{'Authorization':_0x04c6('0xa8')+_0x410bc2,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x59a97f)[_0x04c6('0x19')](function(_0x472d9d){var _0x1d5eea=[];_0x1d5eea['push']({'name':_0x472d9d[_0x04c6('0xc4')][_0x04c6('0xc5')][_0x04c6('0xc1')]['UserLocalizedLabel'][_0x04c6('0xc1')],'value':_0x04c6('0xc6')},{'name':_0x472d9d[_0x04c6('0xc4')][_0x04c6('0xc7')][_0x04c6('0xc1')][_0x04c6('0xc8')][_0x04c6('0xc1')],'value':_0x04c6('0xc9')});var _0x4f437f={'id':_0x1d4068+'_'+_0x472d9d[_0x04c6('0xca')],'name':_0x472d9d[_0x04c6('0xcb')][_0x04c6('0xc8')]['Label'],'custom':![],'options':_0x1d5eea};_0x4203a7['push'](_0x4f437f);return _0x4203a7;});}function getInputList(_0x4dfaa4,_0x10d4d1,_0x2f96f4,_0x243dc8,_0x579168,_0x1d83a3,_0x767a84){var _0x2e3fd6={'method':_0x04c6('0xa4'),'uri':_0x4dfaa4+'EntityDefinitions('+_0x579168+_0x04c6('0xc2')+_0x1d83a3+_0x04c6('0xcc')+_0x2f96f4+_0x04c6('0xcd'),'headers':{'Authorization':_0x04c6('0xa8')+_0x767a84,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2e3fd6)[_0x04c6('0x19')](function(_0x554ce3){var _0x256f89={'id':_0x10d4d1+'_'+_0x554ce3[_0x04c6('0xca')],'name':_0x554ce3['DisplayName'][_0x04c6('0xc8')]?_0x554ce3[_0x04c6('0xcb')][_0x04c6('0xc8')]['Label']:_0x554ce3[_0x04c6('0xca')],'custom':![],'options':[]};_0x243dc8[_0x04c6('0xb0')](_0x256f89);return _0x243dc8;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index fa96582..cdf2948 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 _0xc2ec=['exports','define','Dynamics365Account','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x3d2429,_0x1fe070){var _0x251882=function(_0x3bddfc){while(--_0x3bddfc){_0x3d2429['push'](_0x3d2429['shift']());}};_0x251882(++_0x1fe070);}(_0xc2ec,0x177));var _0xcc2e=function(_0x7452a5,_0xbddb1f){_0x7452a5=_0x7452a5-0x0;var _0x12f5ac=_0xc2ec[_0x7452a5];return _0x12f5ac;};'use strict';var _=require(_0xcc2e('0x0'));var util=require('util');var logger=require(_0xcc2e('0x1'))(_0xcc2e('0x2'));var moment=require('moment');var BPromise=require(_0xcc2e('0x3'));var rp=require(_0xcc2e('0x4'));var fs=require('fs');var path=require(_0xcc2e('0x5'));var rimraf=require(_0xcc2e('0x6'));var config=require(_0xcc2e('0x7'));var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0xcc2e('0x8'));module[_0xcc2e('0x9')]=function(_0x190696,_0xb51dce){return _0x190696[_0xcc2e('0xa')](_0xcc2e('0xb'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1047=['request-promise','path','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','lodash','util','api','moment','bluebird'];(function(_0x2d259e,_0x486591){var _0x44f676=function(_0x4aac1a){while(--_0x4aac1a){_0x2d259e['push'](_0x2d259e['shift']());}};_0x44f676(++_0x486591);}(_0x1047,0xbe));var _0x7104=function(_0x395fd2,_0x4f15ce){_0x395fd2=_0x395fd2-0x0;var _0x486828=_0x1047[_0x395fd2];return _0x486828;};'use strict';var _=require(_0x7104('0x0'));var util=require(_0x7104('0x1'));var logger=require('../../config/logger')(_0x7104('0x2'));var moment=require(_0x7104('0x3'));var BPromise=require(_0x7104('0x4'));var rp=require(_0x7104('0x5'));var fs=require('fs');var path=require(_0x7104('0x6'));var rimraf=require('rimraf');var config=require(_0x7104('0x7'));var attributes=require(_0x7104('0x8'));var integrations=require(_0x7104('0x9'));module[_0x7104('0xa')]=function(_0x2a9cc3,_0x15c30d){return _0x2a9cc3[_0x7104('0xb')](_0x7104('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index b1447be..f9e38f8 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 _0x9505=['message','result','catch','GetDynamics365Account','options','raw','where','limit','map','include','model','attributes','debug','stringify','ShowDynamics365Account','Dynamics365Account','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x30506e,_0x129be8){var _0x5d388c=function(_0x4c7802){while(--_0x4c7802){_0x30506e['push'](_0x30506e['shift']());}};_0x5d388c(++_0x129be8);}(_0x9505,0x1e5));var _0x5950=function(_0x5cc5b0,_0xe5177f){_0x5cc5b0=_0x5cc5b0-0x0;var _0x35c527=_0x9505[_0x5cc5b0];return _0x35c527;};'use strict';var _=require(_0x5950('0x0'));var util=require(_0x5950('0x1'));var moment=require('moment');var BPromise=require(_0x5950('0x2'));var rs=require(_0x5950('0x3'));var fs=require('fs');var Redis=require(_0x5950('0x4'));var db=require(_0x5950('0x5'))['db'];var utils=require(_0x5950('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5950('0x7'));var jayson=require(_0x5950('0x8'));var client=jayson[_0x5950('0x9')][_0x5950('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4aa518,_0x4b9478,_0x425d17){return new BPromise(function(_0x362f04,_0x3986aa){return client[_0x5950('0xb')](_0x4aa518,_0x425d17)[_0x5950('0xc')](function(_0x1df039){logger[_0x5950('0xd')](_0x5950('0xe'),_0x4b9478,_0x5950('0xf'));logger['debug'](_0x5950('0x10'),_0x4b9478,_0x5950('0xf'),JSON['stringify'](_0x1df039));if(_0x1df039['error']){if(_0x1df039[_0x5950('0x11')][_0x5950('0x12')]===0x1f4){logger[_0x5950('0x11')](_0x5950('0xe'),_0x4b9478,_0x1df039[_0x5950('0x11')][_0x5950('0x13')]);return _0x3986aa(_0x1df039[_0x5950('0x11')][_0x5950('0x13')]);}logger[_0x5950('0x11')](_0x5950('0xe'),_0x4b9478,_0x1df039[_0x5950('0x11')][_0x5950('0x13')]);return _0x362f04(_0x1df039[_0x5950('0x11')][_0x5950('0x13')]);}else{logger[_0x5950('0xd')](_0x5950('0xe'),_0x4b9478,_0x5950('0xf'));_0x362f04(_0x1df039[_0x5950('0x14')][_0x5950('0x13')]);}})[_0x5950('0x15')](function(_0xface83){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x4b9478,_0xface83);_0x3986aa(_0xface83);});});}exports[_0x5950('0x16')]=function(_0x40f50c){var _0x3a7821=this;return new Promise(function(_0x5a9530,_0x3e0032){return db['Dynamics365Account']['findAll']({'raw':_0x40f50c[_0x5950('0x17')]?_0x40f50c[_0x5950('0x17')][_0x5950('0x18')]===undefined?!![]:![]:!![],'where':_0x40f50c['options']?_0x40f50c[_0x5950('0x17')][_0x5950('0x19')]||null:null,'attributes':_0x40f50c['options']?_0x40f50c['options']['attributes']||null:null,'limit':_0x40f50c['options']?_0x40f50c[_0x5950('0x17')][_0x5950('0x1a')]||null:null,'include':_0x40f50c[_0x5950('0x17')]?_0x40f50c[_0x5950('0x17')]['include']?_[_0x5950('0x1b')](_0x40f50c[_0x5950('0x17')][_0x5950('0x1c')],function(_0x1bd0ad){return{'model':db[_0x1bd0ad[_0x5950('0x1d')]],'as':_0x1bd0ad['as'],'attributes':_0x1bd0ad[_0x5950('0x1e')],'include':_0x1bd0ad[_0x5950('0x1c')]?_['map'](_0x1bd0ad['include'],function(_0x1b2265){return{'model':db[_0x1b2265[_0x5950('0x1d')]],'as':_0x1b2265['as'],'attributes':_0x1b2265[_0x5950('0x1e')],'include':_0x1b2265[_0x5950('0x1c')]?_[_0x5950('0x1b')](_0x1b2265['include'],function(_0x4a7b22){return{'model':db[_0x4a7b22['model']],'as':_0x4a7b22['as'],'attributes':_0x4a7b22[_0x5950('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5950('0xc')](function(_0xfc543b){logger[_0x5950('0xd')](_0x5950('0x16'),_0x40f50c);logger[_0x5950('0x1f')](_0x5950('0x16'),_0x40f50c,JSON[_0x5950('0x20')](_0xfc543b));_0x5a9530(_0xfc543b);})[_0x5950('0x15')](function(_0x3a3cc0){logger[_0x5950('0x11')](_0x5950('0x16'),_0x3a3cc0[_0x5950('0x13')],_0x40f50c);_0x3e0032(_0x3a7821[_0x5950('0x11')](0x1f4,_0x3a3cc0[_0x5950('0x13')]));});});};exports[_0x5950('0x21')]=function(_0x10f4d4){var _0x18a8ca=this;return new Promise(function(_0x33aa23,_0x625135){return db[_0x5950('0x22')][_0x5950('0x23')]({'raw':_0x10f4d4[_0x5950('0x17')]?_0x10f4d4[_0x5950('0x17')][_0x5950('0x18')]===undefined?!![]:![]:!![],'where':_0x10f4d4[_0x5950('0x17')]?_0x10f4d4[_0x5950('0x17')][_0x5950('0x19')]||null:null,'attributes':_0x10f4d4['options']?_0x10f4d4[_0x5950('0x17')][_0x5950('0x1e')]||null:null,'include':_0x10f4d4[_0x5950('0x17')]?_0x10f4d4[_0x5950('0x17')][_0x5950('0x1c')]?_['map'](_0x10f4d4['options'][_0x5950('0x1c')],function(_0x3c44fa){return{'model':db[_0x3c44fa['model']],'as':_0x3c44fa['as'],'attributes':_0x3c44fa[_0x5950('0x1e')],'include':_0x3c44fa['include']?_[_0x5950('0x1b')](_0x3c44fa[_0x5950('0x1c')],function(_0x376d9f){return{'model':db[_0x376d9f['model']],'as':_0x376d9f['as'],'attributes':_0x376d9f[_0x5950('0x1e')],'include':_0x376d9f['include']?_[_0x5950('0x1b')](_0x376d9f[_0x5950('0x1c')],function(_0x858e48){return{'model':db[_0x858e48[_0x5950('0x1d')]],'as':_0x858e48['as'],'attributes':_0x858e48['attributes']};}):[]};}):[]};}):[]:[]})[_0x5950('0xc')](function(_0x2d8766){logger[_0x5950('0xd')]('ShowDynamics365Account',_0x10f4d4);logger[_0x5950('0x1f')](_0x5950('0x21'),_0x10f4d4,JSON['stringify'](_0x2d8766));_0x33aa23(_0x2d8766);})['catch'](function(_0x57c990){logger[_0x5950('0x11')](_0x5950('0x21'),_0x57c990[_0x5950('0x13')],_0x10f4d4);_0x625135(_0x18a8ca[_0x5950('0x11')](0x1f4,_0x57c990[_0x5950('0x13')]));});});}; \ No newline at end of file +var _0xb2ad=['find','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetDynamics365Account','options','raw','attributes','limit','map','include','model','info','debug','ShowDynamics365Account','Dynamics365Account'];(function(_0x50f6e5,_0x151ccb){var _0x5988c5=function(_0x490a93){while(--_0x490a93){_0x50f6e5['push'](_0x50f6e5['shift']());}};_0x5988c5(++_0x151ccb);}(_0xb2ad,0x16d));var _0xdb2a=function(_0x5dcb11,_0x450be5){_0x5dcb11=_0x5dcb11-0x0;var _0x4803c0=_0xb2ad[_0x5dcb11];return _0x4803c0;};'use strict';var _=require('lodash');var util=require(_0xdb2a('0x0'));var moment=require('moment');var BPromise=require(_0xdb2a('0x1'));var rs=require(_0xdb2a('0x2'));var fs=require('fs');var Redis=require(_0xdb2a('0x3'));var db=require(_0xdb2a('0x4'))['db'];var utils=require(_0xdb2a('0x5'));var logger=require('../../config/logger')(_0xdb2a('0x6'));var config=require(_0xdb2a('0x7'));var jayson=require(_0xdb2a('0x8'));var client=jayson[_0xdb2a('0x9')][_0xdb2a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e6649,_0x4f8127,_0x2ed71e){return new BPromise(function(_0xc23925,_0x78ee){return client['request'](_0x4e6649,_0x2ed71e)[_0xdb2a('0xb')](function(_0x29f542){logger['info'](_0xdb2a('0xc'),_0x4f8127,_0xdb2a('0xd'));logger['debug']('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x4f8127,_0xdb2a('0xd'),JSON[_0xdb2a('0xe')](_0x29f542));if(_0x29f542[_0xdb2a('0xf')]){if(_0x29f542['error'][_0xdb2a('0x10')]===0x1f4){logger[_0xdb2a('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x4f8127,_0x29f542['error']['message']);return _0x78ee(_0x29f542[_0xdb2a('0xf')]['message']);}logger[_0xdb2a('0xf')](_0xdb2a('0xc'),_0x4f8127,_0x29f542['error'][_0xdb2a('0x11')]);return _0xc23925(_0x29f542['error']['message']);}else{logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x4f8127,_0xdb2a('0xd'));_0xc23925(_0x29f542[_0xdb2a('0x12')]['message']);}})['catch'](function(_0x21cb82){logger[_0xdb2a('0xf')](_0xdb2a('0xc'),_0x4f8127,_0x21cb82);_0x78ee(_0x21cb82);});});}exports[_0xdb2a('0x13')]=function(_0x52508d){var _0x2bc67d=this;return new Promise(function(_0x2de4cf,_0x1f6111){return db['Dynamics365Account']['findAll']({'raw':_0x52508d[_0xdb2a('0x14')]?_0x52508d[_0xdb2a('0x14')][_0xdb2a('0x15')]===undefined?!![]:![]:!![],'where':_0x52508d[_0xdb2a('0x14')]?_0x52508d[_0xdb2a('0x14')]['where']||null:null,'attributes':_0x52508d[_0xdb2a('0x14')]?_0x52508d['options'][_0xdb2a('0x16')]||null:null,'limit':_0x52508d['options']?_0x52508d['options'][_0xdb2a('0x17')]||null:null,'include':_0x52508d[_0xdb2a('0x14')]?_0x52508d[_0xdb2a('0x14')]['include']?_[_0xdb2a('0x18')](_0x52508d[_0xdb2a('0x14')][_0xdb2a('0x19')],function(_0x391378){return{'model':db[_0x391378[_0xdb2a('0x1a')]],'as':_0x391378['as'],'attributes':_0x391378[_0xdb2a('0x16')],'include':_0x391378['include']?_[_0xdb2a('0x18')](_0x391378[_0xdb2a('0x19')],function(_0x5f00fb){return{'model':db[_0x5f00fb[_0xdb2a('0x1a')]],'as':_0x5f00fb['as'],'attributes':_0x5f00fb[_0xdb2a('0x16')],'include':_0x5f00fb[_0xdb2a('0x19')]?_[_0xdb2a('0x18')](_0x5f00fb['include'],function(_0xc50c3d){return{'model':db[_0xc50c3d[_0xdb2a('0x1a')]],'as':_0xc50c3d['as'],'attributes':_0xc50c3d[_0xdb2a('0x16')]};}):[]};}):[]};}):[]:[]})[_0xdb2a('0xb')](function(_0x4ed637){logger[_0xdb2a('0x1b')](_0xdb2a('0x13'),_0x52508d);logger[_0xdb2a('0x1c')](_0xdb2a('0x13'),_0x52508d,JSON[_0xdb2a('0xe')](_0x4ed637));_0x2de4cf(_0x4ed637);})['catch'](function(_0x852103){logger[_0xdb2a('0xf')](_0xdb2a('0x13'),_0x852103[_0xdb2a('0x11')],_0x52508d);_0x1f6111(_0x2bc67d[_0xdb2a('0xf')](0x1f4,_0x852103[_0xdb2a('0x11')]));});});};exports[_0xdb2a('0x1d')]=function(_0x2b01e5){var _0x3c55cc=this;return new Promise(function(_0x24b30a,_0x39c5cc){return db[_0xdb2a('0x1e')][_0xdb2a('0x1f')]({'raw':_0x2b01e5[_0xdb2a('0x14')]?_0x2b01e5[_0xdb2a('0x14')][_0xdb2a('0x15')]===undefined?!![]:![]:!![],'where':_0x2b01e5[_0xdb2a('0x14')]?_0x2b01e5[_0xdb2a('0x14')][_0xdb2a('0x20')]||null:null,'attributes':_0x2b01e5[_0xdb2a('0x14')]?_0x2b01e5['options'][_0xdb2a('0x16')]||null:null,'include':_0x2b01e5[_0xdb2a('0x14')]?_0x2b01e5[_0xdb2a('0x14')]['include']?_[_0xdb2a('0x18')](_0x2b01e5[_0xdb2a('0x14')][_0xdb2a('0x19')],function(_0xac01e9){return{'model':db[_0xac01e9[_0xdb2a('0x1a')]],'as':_0xac01e9['as'],'attributes':_0xac01e9[_0xdb2a('0x16')],'include':_0xac01e9[_0xdb2a('0x19')]?_[_0xdb2a('0x18')](_0xac01e9[_0xdb2a('0x19')],function(_0x185297){return{'model':db[_0x185297[_0xdb2a('0x1a')]],'as':_0x185297['as'],'attributes':_0x185297[_0xdb2a('0x16')],'include':_0x185297[_0xdb2a('0x19')]?_[_0xdb2a('0x18')](_0x185297[_0xdb2a('0x19')],function(_0x4b333f){return{'model':db[_0x4b333f[_0xdb2a('0x1a')]],'as':_0x4b333f['as'],'attributes':_0x4b333f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x250fb8){logger[_0xdb2a('0x1b')](_0xdb2a('0x1d'),_0x2b01e5);logger[_0xdb2a('0x1c')](_0xdb2a('0x1d'),_0x2b01e5,JSON['stringify'](_0x250fb8));_0x24b30a(_0x250fb8);})['catch'](function(_0x472170){logger['error']('ShowDynamics365Account',_0x472170[_0xdb2a('0x11')],_0x2b01e5);_0x39c5cc(_0x3c55cc[_0xdb2a('0xf')](0x1f4,_0x472170[_0xdb2a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 6ad1ca7..d1fef26 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 _0xc552=['put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index','get','/:id/fields','getFields','/:id/subjects','/:id/descriptions','post','create'];(function(_0x44cca6,_0x5e9271){var _0x175d04=function(_0x26d9e4){while(--_0x26d9e4){_0x44cca6['push'](_0x44cca6['shift']());}};_0x175d04(++_0x5e9271);}(_0xc552,0x15f));var _0x2c55=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0xc552[_0x2272b5];return _0x110156;};'use strict';var multer=require('multer');var util=require(_0x2c55('0x0'));var path=require(_0x2c55('0x1'));var timeout=require(_0x2c55('0x2'));var express=require(_0x2c55('0x3'));var router=express['Router']();var auth=require(_0x2c55('0x4'));var interaction=require(_0x2c55('0x5'));var config=require(_0x2c55('0x6'));var controller=require(_0x2c55('0x7'));router['get']('/',auth[_0x2c55('0x8')](),controller[_0x2c55('0x9')]);router[_0x2c55('0xa')]('/:id',auth[_0x2c55('0x8')](),controller['show']);router[_0x2c55('0xa')](_0x2c55('0xb'),auth[_0x2c55('0x8')](),controller[_0x2c55('0xc')]);router[_0x2c55('0xa')](_0x2c55('0xd'),auth[_0x2c55('0x8')](),controller['getSubjects']);router[_0x2c55('0xa')](_0x2c55('0xe'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x2c55('0xf')]('/',auth['isAuthenticated'](),controller[_0x2c55('0x10')]);router[_0x2c55('0x11')](_0x2c55('0x12'),auth[_0x2c55('0x8')](),controller[_0x2c55('0x13')]);router[_0x2c55('0x14')](_0x2c55('0x12'),auth[_0x2c55('0x8')](),controller[_0x2c55('0x15')]);module[_0x2c55('0x16')]=router; \ No newline at end of file +var _0x3060=['/:id/fields','isAuthenticated','getFields','get','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','update','delete','destroy','util','connect-timeout','express','Router','../../components/interaction/service','./intDynamics365Configuration.controller','index','/:id','show'];(function(_0x505eb2,_0x20e200){var _0x6f0136=function(_0x53f302){while(--_0x53f302){_0x505eb2['push'](_0x505eb2['shift']());}};_0x6f0136(++_0x20e200);}(_0x3060,0x147));var _0x0306=function(_0x345c86,_0x2b12e0){_0x345c86=_0x345c86-0x0;var _0x41e895=_0x3060[_0x345c86];return _0x41e895;};'use strict';var multer=require('multer');var util=require(_0x0306('0x0'));var path=require('path');var timeout=require(_0x0306('0x1'));var express=require(_0x0306('0x2'));var router=express[_0x0306('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0306('0x4'));var config=require('../../config/environment');var controller=require(_0x0306('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x0306('0x6')]);router['get'](_0x0306('0x7'),auth['isAuthenticated'](),controller[_0x0306('0x8')]);router['get'](_0x0306('0x9'),auth[_0x0306('0xa')](),controller[_0x0306('0xb')]);router[_0x0306('0xc')](_0x0306('0xd'),auth[_0x0306('0xa')](),controller[_0x0306('0xe')]);router['get'](_0x0306('0xf'),auth[_0x0306('0xa')](),controller[_0x0306('0x10')]);router['post']('/',auth[_0x0306('0xa')](),controller[_0x0306('0x11')]);router['put'](_0x0306('0x7'),auth[_0x0306('0xa')](),controller[_0x0306('0x12')]);router[_0x0306('0x13')](_0x0306('0x7'),auth[_0x0306('0xa')](),controller[_0x0306('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index e401118..543a89c 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 _0xb108=['sequelize','exports','STRING','ENUM','incident'];(function(_0x334966,_0x3c9e39){var _0x457e8d=function(_0x46acb1){while(--_0x46acb1){_0x334966['push'](_0x334966['shift']());}};_0x457e8d(++_0x3c9e39);}(_0xb108,0x9b));var _0x8b10=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xb108[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x8b10('0x0'));module[_0x8b10('0x1')]={'name':{'type':Sequelize[_0x8b10('0x2')]},'description':{'type':Sequelize[_0x8b10('0x2')]},'ticketType':{'type':Sequelize[_0x8b10('0x3')](_0x8b10('0x4'),'phonecall'),'defaultValue':_0x8b10('0x4')}}; \ No newline at end of file +var _0x6d1a=['ENUM','incident','sequelize','STRING'];(function(_0x2eb762,_0x1a0398){var _0x330800=function(_0x487517){while(--_0x487517){_0x2eb762['push'](_0x2eb762['shift']());}};_0x330800(++_0x1a0398);}(_0x6d1a,0x19a));var _0xa6d1=function(_0x30d5cd,_0x558100){_0x30d5cd=_0x30d5cd-0x0;var _0x9a4d3f=_0x6d1a[_0x30d5cd];return _0x9a4d3f;};'use strict';var Sequelize=require(_0xa6d1('0x0'));module['exports']={'name':{'type':Sequelize[_0xa6d1('0x1')]},'description':{'type':Sequelize[_0xa6d1('0x1')]},'ticketType':{'type':Sequelize[_0xa6d1('0x2')](_0xa6d1('0x3'),'phonecall'),'defaultValue':_0xa6d1('0x3')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 935ad65..5c5f4ec 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 _0x79cc=['stack','name','send','index','map','Dynamics365Configuration','rawAttributes','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','merge','options','includeAll','include','findAll','params','keys','find','create','body','Dynamics365Field','filter','getFields','getSubjects','findOne','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','client','info','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','end','json','count','offset','limit','status','set','Content-Range','reject','save','update','then','sendStatus'];(function(_0xb67a8d,_0x5efcf6){var _0x333afb=function(_0x15772e){while(--_0x15772e){_0xb67a8d['push'](_0xb67a8d['shift']());}};_0x333afb(++_0x5efcf6);}(_0x79cc,0xd3));var _0xc79c=function(_0x4a6877,_0x64fb62){_0x4a6877=_0x4a6877-0x0;var _0x22d9a9=_0x79cc[_0x4a6877];return _0x22d9a9;};'use strict';var pdf=require(_0xc79c('0x0'));var emlformat=require(_0xc79c('0x1'));var rimraf=require(_0xc79c('0x2'));var zipdir=require(_0xc79c('0x3'));var jsonpatch=require(_0xc79c('0x4'));var rp=require(_0xc79c('0x5'));var moment=require(_0xc79c('0x6'));var BPromise=require(_0xc79c('0x7'));var Mustache=require(_0xc79c('0x8'));var util=require(_0xc79c('0x9'));var path=require('path');var sox=require('sox');var csv=require(_0xc79c('0xa'));var ejs=require(_0xc79c('0xb'));var fs=require('fs');var _=require(_0xc79c('0xc'));var squel=require(_0xc79c('0xd'));var crypto=require(_0xc79c('0xe'));var jsforce=require(_0xc79c('0xf'));var deskjs=require(_0xc79c('0x10'));var toCsv=require(_0xc79c('0xa'));var querystring=require(_0xc79c('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc79c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc79c('0x13'));var logger=require(_0xc79c('0x14'))(_0xc79c('0x15'));var utils=require('../../config/utils');var config=require(_0xc79c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc79c('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xc79c('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20fb99,_0x47a20e,_0xe6bc26,_0x166fcc){return new BPromise(function(_0x350951,_0x3b9c54){var _0x2c429a=_0x166fcc||client;return _0x2c429a['request'](_0x20fb99,_0xe6bc26)['then'](function(_0x4b21b3){logger[_0xc79c('0x19')]('Dynamics365Configuration,\x20%s,\x20%s',_0x47a20e,'request\x20sent');logger[_0xc79c('0x1a')](_0xc79c('0x1b'),_0x47a20e,'request\x20sent',JSON[_0xc79c('0x1c')](_0x4b21b3));if(_0x4b21b3[_0xc79c('0x1d')]){if(_0x4b21b3[_0xc79c('0x1d')]['code']===0x1f4){logger[_0xc79c('0x1d')](_0xc79c('0x1e'),_0x47a20e,_0x4b21b3[_0xc79c('0x1d')][_0xc79c('0x1f')]);return _0x3b9c54(_0x4b21b3[_0xc79c('0x1d')][_0xc79c('0x1f')]);}logger[_0xc79c('0x1d')]('Dynamics365Configuration,\x20%s,\x20%s',_0x47a20e,_0x4b21b3[_0xc79c('0x1d')][_0xc79c('0x1f')]);return _0x350951(_0x4b21b3[_0xc79c('0x1d')][_0xc79c('0x1f')]);}else{logger[_0xc79c('0x19')](_0xc79c('0x1e'),_0x47a20e,'request\x20sent');_0x350951(_0x4b21b3[_0xc79c('0x20')][_0xc79c('0x1f')]);}})[_0xc79c('0x21')](function(_0x5f1d2b){logger[_0xc79c('0x1d')](_0xc79c('0x1e'),_0x47a20e,_0x5f1d2b);_0x3b9c54(_0x5f1d2b);});});}function respondWithStatusCode(_0x1efbd1,_0xc5f898){_0xc5f898=_0xc5f898||0xcc;return function(_0x5a81b0){if(_0x5a81b0){return _0x1efbd1['sendStatus'](_0xc5f898);}return _0x1efbd1['status'](_0xc5f898)[_0xc79c('0x22')]();};}function respondWithResult(_0x250d67,_0x593dbd){_0x593dbd=_0x593dbd||0xc8;return function(_0x28eb25){if(_0x28eb25){return _0x250d67['status'](_0x593dbd)[_0xc79c('0x23')](_0x28eb25);}};}function respondWithFilteredResult(_0x1d3fb7,_0x16b480){return function(_0x18fef9){if(_0x18fef9){var _0x12ddf3=_0x18fef9[_0xc79c('0x24')],_0x49fe3f=_0x16b480[_0xc79c('0x25')],_0x10067b=_0x16b480[_0xc79c('0x25')]+_0x16b480[_0xc79c('0x26')],_0x1f88d2;if(_0x10067b>=_0x12ddf3){_0x10067b=_0x12ddf3;_0x1f88d2=0xc8;}else{_0x1f88d2=0xce;}_0x1d3fb7[_0xc79c('0x27')](_0x1f88d2);return _0x1d3fb7[_0xc79c('0x28')](_0xc79c('0x29'),_0x49fe3f+'-'+_0x10067b+'/'+_0x12ddf3)[_0xc79c('0x23')](_0x18fef9);}return null;};}function patchUpdates(_0x314267){return function(_0x348f8a){try{jsonpatch['apply'](_0x348f8a,_0x314267,!![]);}catch(_0x4f0c72){return BPromise[_0xc79c('0x2a')](_0x4f0c72);}return _0x348f8a[_0xc79c('0x2b')]();};}function saveUpdates(_0x49ffcb,_0x386359){return function(_0x1285ef){if(_0x1285ef){return _0x1285ef[_0xc79c('0x2c')](_0x49ffcb)[_0xc79c('0x2d')](function(_0x455817){return _0x455817;});}return null;};}function removeEntity(_0x225879,_0x22a97d){return function(_0x13da7){if(_0x13da7){return _0x13da7['destroy']()[_0xc79c('0x2d')](function(){_0x225879[_0xc79c('0x27')](0xcc)[_0xc79c('0x22')]();});}};}function handleEntityNotFound(_0x5433bc,_0x2d5754){return function(_0x3fad6d){if(!_0x3fad6d){_0x5433bc[_0xc79c('0x2e')](0x194);}return _0x3fad6d;};}function handleError(_0x347683,_0x196a74){_0x196a74=_0x196a74||0x1f4;return function(_0x43abf4){logger[_0xc79c('0x1d')](_0x43abf4[_0xc79c('0x2f')]);if(_0x43abf4[_0xc79c('0x30')]){delete _0x43abf4['name'];}_0x347683['status'](_0x196a74)[_0xc79c('0x31')](_0x43abf4);};}exports[_0xc79c('0x32')]=function(_0x2d4b50,_0xde54fa){var _0x149063={},_0xf1a618={},_0x29d73f={'count':0x0,'rows':[]};var _0x3d99d8=_[_0xc79c('0x33')](db[_0xc79c('0x34')][_0xc79c('0x35')],function(_0x317622){return{'name':_0x317622['fieldName'],'type':_0x317622['type'][_0xc79c('0x36')]};});_0xf1a618[_0xc79c('0x37')]=_[_0xc79c('0x33')](_0x3d99d8,_0xc79c('0x30'));_0xf1a618[_0xc79c('0x38')]=_['keys'](_0x2d4b50[_0xc79c('0x38')]);_0xf1a618[_0xc79c('0x39')]=_['intersection'](_0xf1a618['model'],_0xf1a618['query']);_0x149063[_0xc79c('0x3a')]=_[_0xc79c('0x3b')](_0xf1a618[_0xc79c('0x37')],qs[_0xc79c('0x3c')](_0x2d4b50[_0xc79c('0x38')][_0xc79c('0x3c')]));_0x149063[_0xc79c('0x3a')]=_0x149063[_0xc79c('0x3a')][_0xc79c('0x3d')]?_0x149063[_0xc79c('0x3a')]:_0xf1a618['model'];if(!_0x2d4b50[_0xc79c('0x38')][_0xc79c('0x3e')](_0xc79c('0x3f'))){_0x149063[_0xc79c('0x26')]=qs[_0xc79c('0x26')](_0x2d4b50['query'][_0xc79c('0x26')]);_0x149063[_0xc79c('0x25')]=qs['offset'](_0x2d4b50[_0xc79c('0x38')][_0xc79c('0x25')]);}_0x149063[_0xc79c('0x40')]=qs[_0xc79c('0x41')](_0x2d4b50['query'][_0xc79c('0x41')]);_0x149063[_0xc79c('0x42')]=qs[_0xc79c('0x39')](_[_0xc79c('0x43')](_0x2d4b50[_0xc79c('0x38')],_0xf1a618[_0xc79c('0x39')]),_0x3d99d8);if(_0x2d4b50[_0xc79c('0x38')]['filter']){_0x149063[_0xc79c('0x42')]=_['merge'](_0x149063['where'],{'$or':_[_0xc79c('0x33')](_0x3d99d8,function(_0xf4b314){if(_0xf4b314[_0xc79c('0x44')]!==_0xc79c('0x45')){var _0x275952={};_0x275952[_0xf4b314[_0xc79c('0x30')]]={'$like':'%'+_0x2d4b50[_0xc79c('0x38')]['filter']+'%'};return _0x275952;}})});}_0x149063=_[_0xc79c('0x46')]({},_0x149063,_0x2d4b50[_0xc79c('0x47')]);var _0x5b2654={'where':_0x149063[_0xc79c('0x42')]};return db[_0xc79c('0x34')][_0xc79c('0x24')](_0x5b2654)['then'](function(_0x40d1f1){_0x29d73f[_0xc79c('0x24')]=_0x40d1f1;if(_0x2d4b50[_0xc79c('0x38')][_0xc79c('0x48')]){_0x149063[_0xc79c('0x49')]=[{'all':!![]}];}return db[_0xc79c('0x34')][_0xc79c('0x4a')](_0x149063);})[_0xc79c('0x2d')](function(_0x554f7c){_0x29d73f['rows']=_0x554f7c;return _0x29d73f;})[_0xc79c('0x2d')](respondWithFilteredResult(_0xde54fa,_0x149063))[_0xc79c('0x21')](handleError(_0xde54fa,null));};exports['show']=function(_0xaf79ee,_0x52a315){var _0x16d06c={'raw':![],'where':{'id':_0xaf79ee[_0xc79c('0x4b')]['id']}},_0x4bf9f6={};_0x4bf9f6[_0xc79c('0x37')]=_[_0xc79c('0x4c')](db['Dynamics365Configuration'][_0xc79c('0x35')]);_0x4bf9f6['query']=_[_0xc79c('0x4c')](_0xaf79ee[_0xc79c('0x38')]);_0x4bf9f6[_0xc79c('0x39')]=_[_0xc79c('0x3b')](_0x4bf9f6[_0xc79c('0x37')],_0x4bf9f6[_0xc79c('0x38')]);_0x16d06c[_0xc79c('0x3a')]=_[_0xc79c('0x3b')](_0x4bf9f6[_0xc79c('0x37')],qs[_0xc79c('0x3c')](_0xaf79ee[_0xc79c('0x38')]['fields']));_0x16d06c[_0xc79c('0x3a')]=_0x16d06c[_0xc79c('0x3a')]['length']?_0x16d06c[_0xc79c('0x3a')]:_0x4bf9f6[_0xc79c('0x37')];if(_0xaf79ee[_0xc79c('0x38')][_0xc79c('0x48')]){_0x16d06c[_0xc79c('0x49')]=[{'all':!![]}];}_0x16d06c=_[_0xc79c('0x46')]({},_0x16d06c,_0xaf79ee[_0xc79c('0x47')]);return db[_0xc79c('0x34')][_0xc79c('0x4d')](_0x16d06c)[_0xc79c('0x2d')](handleEntityNotFound(_0x52a315,null))['then'](respondWithResult(_0x52a315,null))[_0xc79c('0x21')](handleError(_0x52a315,null));};exports[_0xc79c('0x4e')]=function(_0x20b943,_0x4c0157){return db['Dynamics365Configuration'][_0xc79c('0x4e')](_0x20b943['body'],{})['then'](respondWithResult(_0x4c0157,0xc9))[_0xc79c('0x21')](handleError(_0x4c0157,null));};exports[_0xc79c('0x2c')]=function(_0x5e3a76,_0x309119){if(_0x5e3a76[_0xc79c('0x4f')]['id']){delete _0x5e3a76['body']['id'];}return db[_0xc79c('0x34')]['find']({'where':{'id':_0x5e3a76[_0xc79c('0x4b')]['id']}})[_0xc79c('0x2d')](handleEntityNotFound(_0x309119,null))[_0xc79c('0x2d')](saveUpdates(_0x5e3a76[_0xc79c('0x4f')],null))[_0xc79c('0x2d')](respondWithResult(_0x309119,null))['catch'](handleError(_0x309119,null));};exports['destroy']=function(_0x72b313,_0x147335){return db[_0xc79c('0x34')][_0xc79c('0x4d')]({'where':{'id':_0x72b313[_0xc79c('0x4b')]['id']}})[_0xc79c('0x2d')](handleEntityNotFound(_0x147335,null))[_0xc79c('0x2d')](removeEntity(_0x147335,null))['catch'](handleError(_0x147335,null));};exports['getFields']=function(_0x3b528d,_0x3e184f,_0x45ebe1){var _0x2b5724={};var _0x3fdd8e={};var _0x46bca6;var _0x4dfc1a;return db[_0xc79c('0x34')]['findOne']({'where':{'id':_0x3b528d['params']['id']}})['then'](handleEntityNotFound(_0x3e184f,null))['then'](function(_0x1d3210){if(_0x1d3210){_0x46bca6=_0x1d3210;_0x3fdd8e[_0xc79c('0x37')]=_[_0xc79c('0x4c')](db[_0xc79c('0x50')]['rawAttributes']);_0x3fdd8e[_0xc79c('0x38')]=_['keys'](_0x3b528d[_0xc79c('0x38')]);_0x3fdd8e[_0xc79c('0x39')]=_[_0xc79c('0x3b')](_0x3fdd8e[_0xc79c('0x37')],_0x3fdd8e[_0xc79c('0x38')]);_0x2b5724[_0xc79c('0x3a')]=_['intersection'](_0x3fdd8e[_0xc79c('0x37')],qs[_0xc79c('0x3c')](_0x3b528d[_0xc79c('0x38')][_0xc79c('0x3c')]));_0x2b5724[_0xc79c('0x3a')]=_0x2b5724[_0xc79c('0x3a')][_0xc79c('0x3d')]?_0x2b5724[_0xc79c('0x3a')]:_0x3fdd8e['model'];_0x2b5724['order']=qs[_0xc79c('0x41')](_0x3b528d[_0xc79c('0x38')][_0xc79c('0x41')]);_0x2b5724[_0xc79c('0x42')]=qs['filters'](_['pick'](_0x3b528d[_0xc79c('0x38')],_0x3fdd8e['filters']));if(_0x3b528d['query'][_0xc79c('0x51')]){_0x2b5724[_0xc79c('0x42')]=_['merge'](_0x2b5724[_0xc79c('0x42')],{'$or':_[_0xc79c('0x33')](_0x2b5724[_0xc79c('0x3a')],function(_0x57f2d1){var _0x3e2ead={};_0x3e2ead[_0x57f2d1]={'$like':'%'+_0x3b528d[_0xc79c('0x38')]['filter']+'%'};return _0x3e2ead;})});}_0x2b5724=_[_0xc79c('0x46')]({},_0x2b5724,_0x3b528d[_0xc79c('0x47')]);return _0x46bca6['getFields'](_0x2b5724);}})[_0xc79c('0x2d')](function(_0x257079){if(_0x257079){_0x4dfc1a=_0x257079['length'];if(!_0x3b528d['query'][_0xc79c('0x3e')](_0xc79c('0x3f'))){_0x2b5724[_0xc79c('0x26')]=qs[_0xc79c('0x26')](_0x3b528d[_0xc79c('0x38')][_0xc79c('0x26')]);_0x2b5724[_0xc79c('0x25')]=qs[_0xc79c('0x25')](_0x3b528d[_0xc79c('0x38')][_0xc79c('0x25')]);}return _0x46bca6[_0xc79c('0x52')](_0x2b5724);}})[_0xc79c('0x2d')](function(_0x2b8c64){if(_0x2b8c64){return _0x2b8c64?{'count':_0x4dfc1a,'rows':_0x2b8c64}:null;}})[_0xc79c('0x2d')](respondWithResult(_0x3e184f,null))[_0xc79c('0x21')](handleError(_0x3e184f,null));};exports[_0xc79c('0x53')]=function(_0x14c2c9,_0x4698ef,_0x24ab36){var _0x40032d={};var _0x5be414={};var _0x590cd0;var _0x90bd03;return db[_0xc79c('0x34')][_0xc79c('0x54')]({'where':{'id':_0x14c2c9[_0xc79c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4698ef,null))[_0xc79c('0x2d')](function(_0x26f79b){if(_0x26f79b){_0x590cd0=_0x26f79b;_0x5be414[_0xc79c('0x37')]=_[_0xc79c('0x4c')](db[_0xc79c('0x50')][_0xc79c('0x35')]);_0x5be414[_0xc79c('0x38')]=_[_0xc79c('0x4c')](_0x14c2c9[_0xc79c('0x38')]);_0x5be414[_0xc79c('0x39')]=_[_0xc79c('0x3b')](_0x5be414[_0xc79c('0x37')],_0x5be414['query']);_0x40032d[_0xc79c('0x3a')]=_[_0xc79c('0x3b')](_0x5be414[_0xc79c('0x37')],qs[_0xc79c('0x3c')](_0x14c2c9['query']['fields']));_0x40032d[_0xc79c('0x3a')]=_0x40032d[_0xc79c('0x3a')][_0xc79c('0x3d')]?_0x40032d[_0xc79c('0x3a')]:_0x5be414[_0xc79c('0x37')];_0x40032d['order']=qs[_0xc79c('0x41')](_0x14c2c9[_0xc79c('0x38')]['sort']);_0x40032d['where']=qs[_0xc79c('0x39')](_['pick'](_0x14c2c9[_0xc79c('0x38')],_0x5be414['filters']));if(_0x14c2c9[_0xc79c('0x38')]['filter']){_0x40032d['where']=_['merge'](_0x40032d[_0xc79c('0x42')],{'$or':_['map'](_0x40032d['attributes'],function(_0x5d2df4){var _0x1fc9a3={};_0x1fc9a3[_0x5d2df4]={'$like':'%'+_0x14c2c9['query']['filter']+'%'};return _0x1fc9a3;})});}_0x40032d=_[_0xc79c('0x46')]({},_0x40032d,_0x14c2c9[_0xc79c('0x47')]);return _0x590cd0[_0xc79c('0x53')](_0x40032d);}})[_0xc79c('0x2d')](function(_0x117b5d){if(_0x117b5d){_0x90bd03=_0x117b5d[_0xc79c('0x3d')];if(!_0x14c2c9[_0xc79c('0x38')][_0xc79c('0x3e')](_0xc79c('0x3f'))){_0x40032d[_0xc79c('0x26')]=qs[_0xc79c('0x26')](_0x14c2c9[_0xc79c('0x38')][_0xc79c('0x26')]);_0x40032d[_0xc79c('0x25')]=qs[_0xc79c('0x25')](_0x14c2c9[_0xc79c('0x38')][_0xc79c('0x25')]);}return _0x590cd0[_0xc79c('0x53')](_0x40032d);}})[_0xc79c('0x2d')](function(_0x471753){if(_0x471753){return _0x471753?{'count':_0x90bd03,'rows':_0x471753}:null;}})[_0xc79c('0x2d')](respondWithResult(_0x4698ef,null))[_0xc79c('0x21')](handleError(_0x4698ef,null));};exports[_0xc79c('0x55')]=function(_0x122eaa,_0x3ed140,_0x3adcaf){var _0x5b4e21={};var _0x4d42fb={};var _0x16d5ac;var _0x45228d;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x122eaa[_0xc79c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3ed140,null))[_0xc79c('0x2d')](function(_0x51613e){if(_0x51613e){_0x16d5ac=_0x51613e;_0x4d42fb[_0xc79c('0x37')]=_[_0xc79c('0x4c')](db[_0xc79c('0x50')][_0xc79c('0x35')]);_0x4d42fb[_0xc79c('0x38')]=_[_0xc79c('0x4c')](_0x122eaa[_0xc79c('0x38')]);_0x4d42fb[_0xc79c('0x39')]=_[_0xc79c('0x3b')](_0x4d42fb[_0xc79c('0x37')],_0x4d42fb[_0xc79c('0x38')]);_0x5b4e21[_0xc79c('0x3a')]=_[_0xc79c('0x3b')](_0x4d42fb[_0xc79c('0x37')],qs[_0xc79c('0x3c')](_0x122eaa['query'][_0xc79c('0x3c')]));_0x5b4e21[_0xc79c('0x3a')]=_0x5b4e21['attributes'][_0xc79c('0x3d')]?_0x5b4e21[_0xc79c('0x3a')]:_0x4d42fb[_0xc79c('0x37')];_0x5b4e21[_0xc79c('0x40')]=qs[_0xc79c('0x41')](_0x122eaa[_0xc79c('0x38')][_0xc79c('0x41')]);_0x5b4e21[_0xc79c('0x42')]=qs[_0xc79c('0x39')](_[_0xc79c('0x43')](_0x122eaa[_0xc79c('0x38')],_0x4d42fb[_0xc79c('0x39')]));if(_0x122eaa[_0xc79c('0x38')]['filter']){_0x5b4e21[_0xc79c('0x42')]=_['merge'](_0x5b4e21[_0xc79c('0x42')],{'$or':_['map'](_0x5b4e21['attributes'],function(_0x4eee51){var _0x1b3ca6={};_0x1b3ca6[_0x4eee51]={'$like':'%'+_0x122eaa[_0xc79c('0x38')][_0xc79c('0x51')]+'%'};return _0x1b3ca6;})});}_0x5b4e21=_[_0xc79c('0x46')]({},_0x5b4e21,_0x122eaa[_0xc79c('0x47')]);return _0x16d5ac[_0xc79c('0x55')](_0x5b4e21);}})['then'](function(_0x48964a){if(_0x48964a){_0x45228d=_0x48964a[_0xc79c('0x3d')];if(!_0x122eaa['query'][_0xc79c('0x3e')](_0xc79c('0x3f'))){_0x5b4e21[_0xc79c('0x26')]=qs[_0xc79c('0x26')](_0x122eaa[_0xc79c('0x38')]['limit']);_0x5b4e21['offset']=qs[_0xc79c('0x25')](_0x122eaa[_0xc79c('0x38')][_0xc79c('0x25')]);}return _0x16d5ac[_0xc79c('0x55')](_0x5b4e21);}})[_0xc79c('0x2d')](function(_0x3832ad){if(_0x3832ad){return _0x3832ad?{'count':_0x45228d,'rows':_0x3832ad}:null;}})[_0xc79c('0x2d')](respondWithResult(_0x3ed140,null))[_0xc79c('0x21')](handleError(_0x3ed140,null));}; \ No newline at end of file +var _0x0131=['api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','destroy','stack','send','index','map','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','Dynamics365Configuration','includeAll','findAll','show','params','length','include','find','create','body','Dynamics365Field','getFields','nolimit','getSubjects','findOne','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0131,0xa8));var _0x1013=function(_0x29ce14,_0x334166){_0x29ce14=_0x29ce14-0x0;var _0x48f289=_0x0131[_0x29ce14];return _0x48f289;};'use strict';var pdf=require(_0x1013('0x0'));var emlformat=require(_0x1013('0x1'));var rimraf=require(_0x1013('0x2'));var zipdir=require(_0x1013('0x3'));var jsonpatch=require(_0x1013('0x4'));var rp=require(_0x1013('0x5'));var moment=require(_0x1013('0x6'));var BPromise=require(_0x1013('0x7'));var Mustache=require(_0x1013('0x8'));var util=require(_0x1013('0x9'));var path=require(_0x1013('0xa'));var sox=require(_0x1013('0xb'));var csv=require(_0x1013('0xc'));var ejs=require(_0x1013('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1013('0xe'));var crypto=require(_0x1013('0xf'));var jsforce=require(_0x1013('0x10'));var deskjs=require(_0x1013('0x11'));var toCsv=require(_0x1013('0xc'));var querystring=require(_0x1013('0x12'));var Papa=require(_0x1013('0x13'));var Redis=require(_0x1013('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1013('0x15'));var hardwareService=require(_0x1013('0x16'));var logger=require(_0x1013('0x17'))(_0x1013('0x18'));var utils=require(_0x1013('0x19'));var config=require(_0x1013('0x1a'));var licenseUtil=require(_0x1013('0x1b'));var db=require('../../mysqldb')['db'];var jayson=require(_0x1013('0x1c'));var client=jayson[_0x1013('0x1d')][_0x1013('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x172171,_0x4b5b58,_0x20f6e3,_0x5d3351){return new BPromise(function(_0x45146e,_0x21125d){var _0x267eb8=_0x5d3351||client;return _0x267eb8[_0x1013('0x1f')](_0x172171,_0x20f6e3)[_0x1013('0x20')](function(_0x3fc1ee){logger[_0x1013('0x21')](_0x1013('0x22'),_0x4b5b58,_0x1013('0x23'));logger['debug']('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x4b5b58,_0x1013('0x23'),JSON[_0x1013('0x24')](_0x3fc1ee));if(_0x3fc1ee[_0x1013('0x25')]){if(_0x3fc1ee[_0x1013('0x25')][_0x1013('0x26')]===0x1f4){logger[_0x1013('0x25')](_0x1013('0x22'),_0x4b5b58,_0x3fc1ee[_0x1013('0x25')]['message']);return _0x21125d(_0x3fc1ee['error'][_0x1013('0x27')]);}logger[_0x1013('0x25')](_0x1013('0x22'),_0x4b5b58,_0x3fc1ee[_0x1013('0x25')][_0x1013('0x27')]);return _0x45146e(_0x3fc1ee[_0x1013('0x25')][_0x1013('0x27')]);}else{logger[_0x1013('0x21')](_0x1013('0x22'),_0x4b5b58,_0x1013('0x23'));_0x45146e(_0x3fc1ee[_0x1013('0x28')][_0x1013('0x27')]);}})[_0x1013('0x29')](function(_0x1e544f){logger[_0x1013('0x25')](_0x1013('0x22'),_0x4b5b58,_0x1e544f);_0x21125d(_0x1e544f);});});}function respondWithStatusCode(_0x55435d,_0x335924){_0x335924=_0x335924||0xcc;return function(_0x3cf317){if(_0x3cf317){return _0x55435d[_0x1013('0x2a')](_0x335924);}return _0x55435d[_0x1013('0x2b')](_0x335924)[_0x1013('0x2c')]();};}function respondWithResult(_0x2200fd,_0x345ddf){_0x345ddf=_0x345ddf||0xc8;return function(_0x11158a){if(_0x11158a){return _0x2200fd[_0x1013('0x2b')](_0x345ddf)[_0x1013('0x2d')](_0x11158a);}};}function respondWithFilteredResult(_0x4e828a,_0x228c7a){return function(_0x3bc72b){if(_0x3bc72b){var _0x1384d0=_0x3bc72b[_0x1013('0x2e')],_0x14aca8=_0x228c7a[_0x1013('0x2f')],_0x433622=_0x228c7a[_0x1013('0x2f')]+_0x228c7a['limit'],_0x1c2e35;if(_0x433622>=_0x1384d0){_0x433622=_0x1384d0;_0x1c2e35=0xc8;}else{_0x1c2e35=0xce;}_0x4e828a[_0x1013('0x2b')](_0x1c2e35);return _0x4e828a[_0x1013('0x30')](_0x1013('0x31'),_0x14aca8+'-'+_0x433622+'/'+_0x1384d0)['json'](_0x3bc72b);}return null;};}function patchUpdates(_0x16e7f1){return function(_0x1146d2){try{jsonpatch[_0x1013('0x32')](_0x1146d2,_0x16e7f1,!![]);}catch(_0x5e147d){return BPromise['reject'](_0x5e147d);}return _0x1146d2[_0x1013('0x33')]();};}function saveUpdates(_0x3729b6,_0x58677e){return function(_0xda7f){if(_0xda7f){return _0xda7f[_0x1013('0x34')](_0x3729b6)['then'](function(_0x2fc4cb){return _0x2fc4cb;});}return null;};}function removeEntity(_0x22cc39,_0x4250b2){return function(_0x57ca2a){if(_0x57ca2a){return _0x57ca2a[_0x1013('0x35')]()[_0x1013('0x20')](function(){_0x22cc39[_0x1013('0x2b')](0xcc)[_0x1013('0x2c')]();});}};}function handleEntityNotFound(_0x29ce75,_0x23d41a){return function(_0x26d728){if(!_0x26d728){_0x29ce75['sendStatus'](0x194);}return _0x26d728;};}function handleError(_0x1472c1,_0x39294a){_0x39294a=_0x39294a||0x1f4;return function(_0xe36e7e){logger[_0x1013('0x25')](_0xe36e7e[_0x1013('0x36')]);if(_0xe36e7e['name']){delete _0xe36e7e['name'];}_0x1472c1[_0x1013('0x2b')](_0x39294a)[_0x1013('0x37')](_0xe36e7e);};}exports[_0x1013('0x38')]=function(_0x213325,_0x438292){var _0x47475a={},_0x51fa87={},_0x313e2d={'count':0x0,'rows':[]};var _0x40c06d=_[_0x1013('0x39')](db['Dynamics365Configuration'][_0x1013('0x3a')],function(_0x2248a2){return{'name':_0x2248a2[_0x1013('0x3b')],'type':_0x2248a2['type'][_0x1013('0x3c')]};});_0x51fa87[_0x1013('0x3d')]=_[_0x1013('0x39')](_0x40c06d,_0x1013('0x3e'));_0x51fa87[_0x1013('0x3f')]=_[_0x1013('0x40')](_0x213325[_0x1013('0x3f')]);_0x51fa87[_0x1013('0x41')]=_[_0x1013('0x42')](_0x51fa87[_0x1013('0x3d')],_0x51fa87[_0x1013('0x3f')]);_0x47475a['attributes']=_[_0x1013('0x42')](_0x51fa87[_0x1013('0x3d')],qs[_0x1013('0x43')](_0x213325['query'][_0x1013('0x43')]));_0x47475a['attributes']=_0x47475a[_0x1013('0x44')]['length']?_0x47475a[_0x1013('0x44')]:_0x51fa87[_0x1013('0x3d')];if(!_0x213325[_0x1013('0x3f')][_0x1013('0x45')]('nolimit')){_0x47475a[_0x1013('0x46')]=qs[_0x1013('0x46')](_0x213325['query'][_0x1013('0x46')]);_0x47475a['offset']=qs[_0x1013('0x2f')](_0x213325[_0x1013('0x3f')]['offset']);}_0x47475a[_0x1013('0x47')]=qs[_0x1013('0x48')](_0x213325[_0x1013('0x3f')]['sort']);_0x47475a[_0x1013('0x49')]=qs[_0x1013('0x41')](_[_0x1013('0x4a')](_0x213325['query'],_0x51fa87['filters']),_0x40c06d);if(_0x213325['query'][_0x1013('0x4b')]){_0x47475a['where']=_['merge'](_0x47475a[_0x1013('0x49')],{'$or':_[_0x1013('0x39')](_0x40c06d,function(_0x558550){if(_0x558550[_0x1013('0x4c')]!==_0x1013('0x4d')){var _0x44aa30={};_0x44aa30[_0x558550[_0x1013('0x3e')]]={'$like':'%'+_0x213325['query'][_0x1013('0x4b')]+'%'};return _0x44aa30;}})});}_0x47475a=_[_0x1013('0x4e')]({},_0x47475a,_0x213325[_0x1013('0x4f')]);var _0x167517={'where':_0x47475a[_0x1013('0x49')]};return db[_0x1013('0x50')][_0x1013('0x2e')](_0x167517)[_0x1013('0x20')](function(_0x3b3989){_0x313e2d[_0x1013('0x2e')]=_0x3b3989;if(_0x213325['query'][_0x1013('0x51')]){_0x47475a['include']=[{'all':!![]}];}return db[_0x1013('0x50')][_0x1013('0x52')](_0x47475a);})[_0x1013('0x20')](function(_0x17bb60){_0x313e2d['rows']=_0x17bb60;return _0x313e2d;})[_0x1013('0x20')](respondWithFilteredResult(_0x438292,_0x47475a))[_0x1013('0x29')](handleError(_0x438292,null));};exports[_0x1013('0x53')]=function(_0x2223cf,_0x8748fa){var _0x2144df={'raw':![],'where':{'id':_0x2223cf[_0x1013('0x54')]['id']}},_0x44ffcb={};_0x44ffcb[_0x1013('0x3d')]=_[_0x1013('0x40')](db['Dynamics365Configuration'][_0x1013('0x3a')]);_0x44ffcb[_0x1013('0x3f')]=_['keys'](_0x2223cf[_0x1013('0x3f')]);_0x44ffcb['filters']=_[_0x1013('0x42')](_0x44ffcb[_0x1013('0x3d')],_0x44ffcb[_0x1013('0x3f')]);_0x2144df[_0x1013('0x44')]=_[_0x1013('0x42')](_0x44ffcb['model'],qs[_0x1013('0x43')](_0x2223cf['query'][_0x1013('0x43')]));_0x2144df[_0x1013('0x44')]=_0x2144df[_0x1013('0x44')][_0x1013('0x55')]?_0x2144df[_0x1013('0x44')]:_0x44ffcb['model'];if(_0x2223cf['query']['includeAll']){_0x2144df[_0x1013('0x56')]=[{'all':!![]}];}_0x2144df=_[_0x1013('0x4e')]({},_0x2144df,_0x2223cf[_0x1013('0x4f')]);return db['Dynamics365Configuration'][_0x1013('0x57')](_0x2144df)[_0x1013('0x20')](handleEntityNotFound(_0x8748fa,null))[_0x1013('0x20')](respondWithResult(_0x8748fa,null))[_0x1013('0x29')](handleError(_0x8748fa,null));};exports[_0x1013('0x58')]=function(_0x2c8356,_0x2687c6){return db[_0x1013('0x50')]['create'](_0x2c8356['body'],{})[_0x1013('0x20')](respondWithResult(_0x2687c6,0xc9))[_0x1013('0x29')](handleError(_0x2687c6,null));};exports[_0x1013('0x34')]=function(_0x50e7e0,_0x1c6cdf){if(_0x50e7e0[_0x1013('0x59')]['id']){delete _0x50e7e0['body']['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x50e7e0[_0x1013('0x54')]['id']}})['then'](handleEntityNotFound(_0x1c6cdf,null))[_0x1013('0x20')](saveUpdates(_0x50e7e0[_0x1013('0x59')],null))[_0x1013('0x20')](respondWithResult(_0x1c6cdf,null))[_0x1013('0x29')](handleError(_0x1c6cdf,null));};exports[_0x1013('0x35')]=function(_0x3dbd61,_0x1fce48){return db[_0x1013('0x50')][_0x1013('0x57')]({'where':{'id':_0x3dbd61[_0x1013('0x54')]['id']}})[_0x1013('0x20')](handleEntityNotFound(_0x1fce48,null))[_0x1013('0x20')](removeEntity(_0x1fce48,null))[_0x1013('0x29')](handleError(_0x1fce48,null));};exports['getFields']=function(_0x5e95b6,_0x3e3b6a,_0x1c13d7){var _0x107551={};var _0x2f0cde={};var _0x527eab;var _0x5c2ad9;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x5e95b6[_0x1013('0x54')]['id']}})[_0x1013('0x20')](handleEntityNotFound(_0x3e3b6a,null))[_0x1013('0x20')](function(_0x3c482e){if(_0x3c482e){_0x527eab=_0x3c482e;_0x2f0cde[_0x1013('0x3d')]=_[_0x1013('0x40')](db[_0x1013('0x5a')]['rawAttributes']);_0x2f0cde['query']=_[_0x1013('0x40')](_0x5e95b6[_0x1013('0x3f')]);_0x2f0cde[_0x1013('0x41')]=_[_0x1013('0x42')](_0x2f0cde[_0x1013('0x3d')],_0x2f0cde[_0x1013('0x3f')]);_0x107551[_0x1013('0x44')]=_['intersection'](_0x2f0cde[_0x1013('0x3d')],qs[_0x1013('0x43')](_0x5e95b6[_0x1013('0x3f')][_0x1013('0x43')]));_0x107551[_0x1013('0x44')]=_0x107551[_0x1013('0x44')][_0x1013('0x55')]?_0x107551[_0x1013('0x44')]:_0x2f0cde[_0x1013('0x3d')];_0x107551[_0x1013('0x47')]=qs[_0x1013('0x48')](_0x5e95b6[_0x1013('0x3f')]['sort']);_0x107551[_0x1013('0x49')]=qs[_0x1013('0x41')](_['pick'](_0x5e95b6[_0x1013('0x3f')],_0x2f0cde[_0x1013('0x41')]));if(_0x5e95b6[_0x1013('0x3f')][_0x1013('0x4b')]){_0x107551['where']=_[_0x1013('0x4e')](_0x107551[_0x1013('0x49')],{'$or':_[_0x1013('0x39')](_0x107551[_0x1013('0x44')],function(_0x2fd5af){var _0x417dee={};_0x417dee[_0x2fd5af]={'$like':'%'+_0x5e95b6['query'][_0x1013('0x4b')]+'%'};return _0x417dee;})});}_0x107551=_['merge']({},_0x107551,_0x5e95b6['options']);return _0x527eab[_0x1013('0x5b')](_0x107551);}})[_0x1013('0x20')](function(_0x45de4a){if(_0x45de4a){_0x5c2ad9=_0x45de4a[_0x1013('0x55')];if(!_0x5e95b6[_0x1013('0x3f')]['hasOwnProperty'](_0x1013('0x5c'))){_0x107551[_0x1013('0x46')]=qs['limit'](_0x5e95b6['query']['limit']);_0x107551['offset']=qs[_0x1013('0x2f')](_0x5e95b6['query']['offset']);}return _0x527eab['getFields'](_0x107551);}})[_0x1013('0x20')](function(_0x4964e4){if(_0x4964e4){return _0x4964e4?{'count':_0x5c2ad9,'rows':_0x4964e4}:null;}})[_0x1013('0x20')](respondWithResult(_0x3e3b6a,null))[_0x1013('0x29')](handleError(_0x3e3b6a,null));};exports[_0x1013('0x5d')]=function(_0x18d237,_0x44f909,_0x19bd22){var _0x5f2e5f={};var _0xd2aea6={};var _0x58b36c;var _0x27d532;return db[_0x1013('0x50')][_0x1013('0x5e')]({'where':{'id':_0x18d237['params']['id']}})[_0x1013('0x20')](handleEntityNotFound(_0x44f909,null))[_0x1013('0x20')](function(_0x58c076){if(_0x58c076){_0x58b36c=_0x58c076;_0xd2aea6['model']=_['keys'](db[_0x1013('0x5a')][_0x1013('0x3a')]);_0xd2aea6[_0x1013('0x3f')]=_[_0x1013('0x40')](_0x18d237['query']);_0xd2aea6[_0x1013('0x41')]=_[_0x1013('0x42')](_0xd2aea6['model'],_0xd2aea6['query']);_0x5f2e5f['attributes']=_[_0x1013('0x42')](_0xd2aea6['model'],qs[_0x1013('0x43')](_0x18d237[_0x1013('0x3f')][_0x1013('0x43')]));_0x5f2e5f[_0x1013('0x44')]=_0x5f2e5f[_0x1013('0x44')][_0x1013('0x55')]?_0x5f2e5f[_0x1013('0x44')]:_0xd2aea6['model'];_0x5f2e5f[_0x1013('0x47')]=qs[_0x1013('0x48')](_0x18d237['query'][_0x1013('0x48')]);_0x5f2e5f[_0x1013('0x49')]=qs[_0x1013('0x41')](_[_0x1013('0x4a')](_0x18d237[_0x1013('0x3f')],_0xd2aea6[_0x1013('0x41')]));if(_0x18d237['query'][_0x1013('0x4b')]){_0x5f2e5f[_0x1013('0x49')]=_['merge'](_0x5f2e5f[_0x1013('0x49')],{'$or':_[_0x1013('0x39')](_0x5f2e5f['attributes'],function(_0x23e709){var _0x10f067={};_0x10f067[_0x23e709]={'$like':'%'+_0x18d237[_0x1013('0x3f')][_0x1013('0x4b')]+'%'};return _0x10f067;})});}_0x5f2e5f=_[_0x1013('0x4e')]({},_0x5f2e5f,_0x18d237[_0x1013('0x4f')]);return _0x58b36c[_0x1013('0x5d')](_0x5f2e5f);}})[_0x1013('0x20')](function(_0x4ba997){if(_0x4ba997){_0x27d532=_0x4ba997[_0x1013('0x55')];if(!_0x18d237[_0x1013('0x3f')][_0x1013('0x45')](_0x1013('0x5c'))){_0x5f2e5f['limit']=qs[_0x1013('0x46')](_0x18d237[_0x1013('0x3f')][_0x1013('0x46')]);_0x5f2e5f[_0x1013('0x2f')]=qs[_0x1013('0x2f')](_0x18d237[_0x1013('0x3f')]['offset']);}return _0x58b36c[_0x1013('0x5d')](_0x5f2e5f);}})['then'](function(_0x1fc3f1){if(_0x1fc3f1){return _0x1fc3f1?{'count':_0x27d532,'rows':_0x1fc3f1}:null;}})[_0x1013('0x20')](respondWithResult(_0x44f909,null))['catch'](handleError(_0x44f909,null));};exports[_0x1013('0x5f')]=function(_0x4aca06,_0x1a1a2b,_0x2631fe){var _0x5e5bdd={};var _0x31854d={};var _0x2b4223;var _0x40d716;return db[_0x1013('0x50')][_0x1013('0x5e')]({'where':{'id':_0x4aca06[_0x1013('0x54')]['id']}})[_0x1013('0x20')](handleEntityNotFound(_0x1a1a2b,null))[_0x1013('0x20')](function(_0x21830b){if(_0x21830b){_0x2b4223=_0x21830b;_0x31854d[_0x1013('0x3d')]=_[_0x1013('0x40')](db[_0x1013('0x5a')]['rawAttributes']);_0x31854d['query']=_[_0x1013('0x40')](_0x4aca06[_0x1013('0x3f')]);_0x31854d[_0x1013('0x41')]=_[_0x1013('0x42')](_0x31854d[_0x1013('0x3d')],_0x31854d[_0x1013('0x3f')]);_0x5e5bdd[_0x1013('0x44')]=_[_0x1013('0x42')](_0x31854d['model'],qs['fields'](_0x4aca06[_0x1013('0x3f')]['fields']));_0x5e5bdd['attributes']=_0x5e5bdd[_0x1013('0x44')]['length']?_0x5e5bdd[_0x1013('0x44')]:_0x31854d[_0x1013('0x3d')];_0x5e5bdd[_0x1013('0x47')]=qs[_0x1013('0x48')](_0x4aca06[_0x1013('0x3f')][_0x1013('0x48')]);_0x5e5bdd[_0x1013('0x49')]=qs[_0x1013('0x41')](_['pick'](_0x4aca06[_0x1013('0x3f')],_0x31854d[_0x1013('0x41')]));if(_0x4aca06[_0x1013('0x3f')][_0x1013('0x4b')]){_0x5e5bdd['where']=_['merge'](_0x5e5bdd['where'],{'$or':_[_0x1013('0x39')](_0x5e5bdd[_0x1013('0x44')],function(_0xd8b088){var _0x38fcca={};_0x38fcca[_0xd8b088]={'$like':'%'+_0x4aca06[_0x1013('0x3f')][_0x1013('0x4b')]+'%'};return _0x38fcca;})});}_0x5e5bdd=_[_0x1013('0x4e')]({},_0x5e5bdd,_0x4aca06['options']);return _0x2b4223[_0x1013('0x5f')](_0x5e5bdd);}})[_0x1013('0x20')](function(_0x4a3588){if(_0x4a3588){_0x40d716=_0x4a3588[_0x1013('0x55')];if(!_0x4aca06[_0x1013('0x3f')][_0x1013('0x45')](_0x1013('0x5c'))){_0x5e5bdd[_0x1013('0x46')]=qs[_0x1013('0x46')](_0x4aca06[_0x1013('0x3f')][_0x1013('0x46')]);_0x5e5bdd[_0x1013('0x2f')]=qs[_0x1013('0x2f')](_0x4aca06[_0x1013('0x3f')][_0x1013('0x2f')]);}return _0x2b4223['getDescriptions'](_0x5e5bdd);}})[_0x1013('0x20')](function(_0x56bdad){if(_0x56bdad){return _0x56bdad?{'count':_0x40d716,'rows':_0x56bdad}:null;}})[_0x1013('0x20')](respondWithResult(_0x1a1a2b,null))[_0x1013('0x29')](handleError(_0x1a1a2b,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 0e57ec0..876ed86 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 _0xcbf7=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Dynamics365Configuration','lodash','util','moment'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xcbf7,0x8c));var _0x7cbf=function(_0x5074e3,_0x2d41d5){_0x5074e3=_0x5074e3-0x0;var _0x2d0772=_0xcbf7[_0x5074e3];return _0x2d0772;};'use strict';var _=require(_0x7cbf('0x0'));var util=require(_0x7cbf('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7cbf('0x2'));var BPromise=require(_0x7cbf('0x3'));var rp=require(_0x7cbf('0x4'));var fs=require('fs');var path=require(_0x7cbf('0x5'));var rimraf=require(_0x7cbf('0x6'));var config=require(_0x7cbf('0x7'));var attributes=require('./intDynamics365Configuration.attributes');module[_0x7cbf('0x8')]=function(_0x3302b7,_0xdc82ca){return _0x3302b7[_0x7cbf('0x9')](_0x7cbf('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38a4=['api','moment','bluebird','request-promise','path','rimraf','exports','define','int_dynamics365_configurations','util','../../config/logger'];(function(_0x386e47,_0x32b11b){var _0x131829=function(_0x2f2637){while(--_0x2f2637){_0x386e47['push'](_0x386e47['shift']());}};_0x131829(++_0x32b11b);}(_0x38a4,0x1cc));var _0x438a=function(_0x5d475a,_0x6ebbde){_0x5d475a=_0x5d475a-0x0;var _0x2f4137=_0x38a4[_0x5d475a];return _0x2f4137;};'use strict';var _=require('lodash');var util=require(_0x438a('0x0'));var logger=require(_0x438a('0x1'))(_0x438a('0x2'));var moment=require(_0x438a('0x3'));var BPromise=require(_0x438a('0x4'));var rp=require(_0x438a('0x5'));var fs=require('fs');var path=require(_0x438a('0x6'));var rimraf=require(_0x438a('0x7'));var config=require('../../config/environment');var attributes=require('./intDynamics365Configuration.attributes');module[_0x438a('0x8')]=function(_0x574e86,_0x39543c){return _0x574e86[_0x438a('0x9')]('Dynamics365Configuration',attributes,{'tableName':_0x438a('0xa'),'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 4c4b280..6d9a291 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 _0x108b=['rpc','../../config/environment','jayson/promise','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','../../config/logger'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x108b,0x105));var _0xb108=function(_0x4a9fb7,_0x4cbfd7){_0x4a9fb7=_0x4a9fb7-0x0;var _0x40b90e=_0x108b[_0x4a9fb7];return _0x40b90e;};'use strict';var _=require(_0xb108('0x0'));var util=require(_0xb108('0x1'));var moment=require('moment');var BPromise=require(_0xb108('0x2'));var rs=require(_0xb108('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb108('0x4'))(_0xb108('0x5'));var config=require(_0xb108('0x6'));var jayson=require(_0xb108('0x7'));var client=jayson['client'][_0xb108('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xffe586,_0x1b2967,_0x45777c){return new BPromise(function(_0x749221,_0x230fbb){return client[_0xb108('0x9')](_0xffe586,_0x45777c)['then'](function(_0x124900){logger[_0xb108('0xa')](_0xb108('0xb'),_0x1b2967,_0xb108('0xc'));logger['debug'](_0xb108('0xd'),_0x1b2967,'request\x20sent',JSON[_0xb108('0xe')](_0x124900));if(_0x124900[_0xb108('0xf')]){if(_0x124900[_0xb108('0xf')]['code']===0x1f4){logger[_0xb108('0xf')](_0xb108('0xb'),_0x1b2967,_0x124900[_0xb108('0xf')][_0xb108('0x10')]);return _0x230fbb(_0x124900[_0xb108('0xf')][_0xb108('0x10')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x1b2967,_0x124900['error'][_0xb108('0x10')]);return _0x749221(_0x124900[_0xb108('0xf')][_0xb108('0x10')]);}else{logger[_0xb108('0xa')](_0xb108('0xb'),_0x1b2967,_0xb108('0xc'));_0x749221(_0x124900[_0xb108('0x11')][_0xb108('0x10')]);}})[_0xb108('0x12')](function(_0x237b03){logger[_0xb108('0xf')](_0xb108('0xb'),_0x1b2967,_0x237b03);_0x230fbb(_0x237b03);});});} \ No newline at end of file +var _0x99ec=['debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x20b28c,_0x9bd2ef){var _0x39e452=function(_0x234fbd){while(--_0x234fbd){_0x20b28c['push'](_0x20b28c['shift']());}};_0x39e452(++_0x9bd2ef);}(_0x99ec,0x1dc));var _0xc99e=function(_0x23724f,_0x19e182){_0x23724f=_0x23724f-0x0;var _0x17c793=_0x99ec[_0x23724f];return _0x17c793;};'use strict';var _=require(_0xc99e('0x0'));var util=require(_0xc99e('0x1'));var moment=require(_0xc99e('0x2'));var BPromise=require(_0xc99e('0x3'));var rs=require(_0xc99e('0x4'));var fs=require('fs');var Redis=require(_0xc99e('0x5'));var db=require(_0xc99e('0x6'))['db'];var utils=require(_0xc99e('0x7'));var logger=require(_0xc99e('0x8'))(_0xc99e('0x9'));var config=require(_0xc99e('0xa'));var jayson=require(_0xc99e('0xb'));var client=jayson[_0xc99e('0xc')][_0xc99e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4f0e1d,_0x58fef0,_0x5ea4ee){return new BPromise(function(_0x5d0cd1,_0x1e10b1){return client[_0xc99e('0xe')](_0x4f0e1d,_0x5ea4ee)[_0xc99e('0xf')](function(_0x2e4fb5){logger[_0xc99e('0x10')](_0xc99e('0x11'),_0x58fef0,'request\x20sent');logger[_0xc99e('0x12')](_0xc99e('0x13'),_0x58fef0,_0xc99e('0x14'),JSON[_0xc99e('0x15')](_0x2e4fb5));if(_0x2e4fb5[_0xc99e('0x16')]){if(_0x2e4fb5['error'][_0xc99e('0x17')]===0x1f4){logger[_0xc99e('0x16')]('Dynamics365Configuration,\x20%s,\x20%s',_0x58fef0,_0x2e4fb5[_0xc99e('0x16')][_0xc99e('0x18')]);return _0x1e10b1(_0x2e4fb5[_0xc99e('0x16')]['message']);}logger[_0xc99e('0x16')]('Dynamics365Configuration,\x20%s,\x20%s',_0x58fef0,_0x2e4fb5[_0xc99e('0x16')][_0xc99e('0x18')]);return _0x5d0cd1(_0x2e4fb5[_0xc99e('0x16')][_0xc99e('0x18')]);}else{logger[_0xc99e('0x10')](_0xc99e('0x11'),_0x58fef0,_0xc99e('0x14'));_0x5d0cd1(_0x2e4fb5['result'][_0xc99e('0x18')]);}})[_0xc99e('0x19')](function(_0x495692){logger[_0xc99e('0x16')]('Dynamics365Configuration,\x20%s,\x20%s',_0x58fef0,_0x495692);_0x1e10b1(_0x495692);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 8117e43..c5d2176 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 _0x1fa6=['/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index'];(function(_0x5b9876,_0x293130){var _0x58538b=function(_0x54912d){while(--_0x54912d){_0x5b9876['push'](_0x5b9876['shift']());}};_0x58538b(++_0x293130);}(_0x1fa6,0x10b));var _0x61fa=function(_0x47fb8b,_0x39ed31){_0x47fb8b=_0x47fb8b-0x0;var _0x12d064=_0x1fa6[_0x47fb8b];return _0x12d064;};'use strict';var multer=require(_0x61fa('0x0'));var util=require(_0x61fa('0x1'));var path=require(_0x61fa('0x2'));var timeout=require(_0x61fa('0x3'));var express=require(_0x61fa('0x4'));var router=express[_0x61fa('0x5')]();var auth=require(_0x61fa('0x6'));var interaction=require(_0x61fa('0x7'));var config=require(_0x61fa('0x8'));var controller=require(_0x61fa('0x9'));router[_0x61fa('0xa')]('/',auth[_0x61fa('0xb')](),controller[_0x61fa('0xc')]);router[_0x61fa('0xa')](_0x61fa('0xd'),auth[_0x61fa('0xb')](),controller[_0x61fa('0xe')]);router[_0x61fa('0xf')]('/',auth[_0x61fa('0xb')](),controller['create']);router[_0x61fa('0x10')](_0x61fa('0xd'),auth[_0x61fa('0xb')](),controller['update']);router[_0x61fa('0x11')]('/:id',auth[_0x61fa('0xb')](),controller[_0x61fa('0x12')]);module[_0x61fa('0x13')]=router; \ No newline at end of file +var _0xf899=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','exports','multer','util','path','connect-timeout','Router'];(function(_0x479789,_0x4b97b9){var _0x10038b=function(_0x1af48c){while(--_0x1af48c){_0x479789['push'](_0x479789['shift']());}};_0x10038b(++_0x4b97b9);}(_0xf899,0xa6));var _0x9f89=function(_0xebaa08,_0x1ff9e7){_0xebaa08=_0xebaa08-0x0;var _0x4680be=_0xf899[_0xebaa08];return _0x4680be;};'use strict';var multer=require(_0x9f89('0x0'));var util=require(_0x9f89('0x1'));var path=require(_0x9f89('0x2'));var timeout=require(_0x9f89('0x3'));var express=require('express');var router=express[_0x9f89('0x4')]();var auth=require(_0x9f89('0x5'));var interaction=require(_0x9f89('0x6'));var config=require(_0x9f89('0x7'));var controller=require(_0x9f89('0x8'));router['get']('/',auth[_0x9f89('0x9')](),controller[_0x9f89('0xa')]);router[_0x9f89('0xb')](_0x9f89('0xc'),auth[_0x9f89('0x9')](),controller[_0x9f89('0xd')]);router[_0x9f89('0xe')]('/',auth[_0x9f89('0x9')](),controller[_0x9f89('0xf')]);router[_0x9f89('0x10')](_0x9f89('0xc'),auth['isAuthenticated'](),controller[_0x9f89('0x11')]);router['delete']('/:id',auth[_0x9f89('0x9')](),controller['destroy']);module[_0x9f89('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 4ae9282..34565d3 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 _0x7217=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x1bb75c,_0x26e25f){var _0x2acc7b=function(_0x9ec32b){while(--_0x9ec32b){_0x1bb75c['push'](_0x1bb75c['shift']());}};_0x2acc7b(++_0x26e25f);}(_0x7217,0x19e));var _0x7721=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x7217[_0x3899d1];return _0xeb4a7d;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'type':{'type':Sequelize[_0x7721('0x1')](_0x7721('0x2'),_0x7721('0x3'),_0x7721('0x4'),_0x7721('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x7721('0x6')]},'key':{'type':Sequelize[_0x7721('0x6')]},'keyType':{'type':Sequelize[_0x7721('0x1')](_0x7721('0x2'),_0x7721('0x3'),_0x7721('0x4'))},'keyContent':{'type':Sequelize[_0x7721('0x6')]},'idField':{'type':Sequelize[_0x7721('0x6')]},'nameField':{'type':Sequelize[_0x7721('0x6')]},'customField':{'type':Sequelize[_0x7721('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7721('0x6')]}}; \ No newline at end of file +var _0x9fd4=['keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x5d343d,_0x2098ed){var _0x1c1343=function(_0x50e771){while(--_0x50e771){_0x5d343d['push'](_0x5d343d['shift']());}};_0x1c1343(++_0x2098ed);}(_0x9fd4,0x16c));var _0x49fd=function(_0x366e75,_0x533d1d){_0x366e75=_0x366e75-0x0;var _0x3b167b=_0x9fd4[_0x366e75];return _0x3b167b;};'use strict';var Sequelize=require(_0x49fd('0x0'));module[_0x49fd('0x1')]={'type':{'type':Sequelize[_0x49fd('0x2')](_0x49fd('0x3'),_0x49fd('0x4'),_0x49fd('0x5'),_0x49fd('0x6'),_0x49fd('0x7')),'defaultValue':_0x49fd('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x49fd('0x2')](_0x49fd('0x3'),_0x49fd('0x4'),_0x49fd('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x49fd('0x8')]},'nameField':{'type':Sequelize[_0x49fd('0x8')]},'customField':{'type':Sequelize[_0x49fd('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x49fd('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 76b3040..243ee4c 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 _0x0acc=['lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','index','Dynamics365Field','model','map','query','keys','filters','attributes','intersection','length','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','name','options','includeAll','include','rows','catch','show','params','rawAttributes','fields','find','create','body','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs'];(function(_0x2e81c5,_0xf014b0){var _0x45993e=function(_0x48cdf0){while(--_0x48cdf0){_0x2e81c5['push'](_0x2e81c5['shift']());}};_0x45993e(++_0xf014b0);}(_0x0acc,0x1d3));var _0xc0ac=function(_0xcdc1e2,_0xe7a35b){_0xcdc1e2=_0xcdc1e2-0x0;var _0x21e4da=_0x0acc[_0xcdc1e2];return _0x21e4da;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc0ac('0x0'));var zipdir=require(_0xc0ac('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc0ac('0x2'));var moment=require(_0xc0ac('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc0ac('0x4'));var util=require('util');var path=require(_0xc0ac('0x5'));var sox=require(_0xc0ac('0x6'));var csv=require(_0xc0ac('0x7'));var ejs=require(_0xc0ac('0x8'));var fs=require('fs');var _=require(_0xc0ac('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc0ac('0xa'));var deskjs=require(_0xc0ac('0xb'));var toCsv=require(_0xc0ac('0x7'));var querystring=require('querystring');var Papa=require(_0xc0ac('0xc'));var Redis=require('ioredis');var authService=require(_0xc0ac('0xd'));var qs=require(_0xc0ac('0xe'));var as=require(_0xc0ac('0xf'));var hardwareService=require(_0xc0ac('0x10'));var logger=require(_0xc0ac('0x11'))(_0xc0ac('0x12'));var utils=require(_0xc0ac('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x508ab7,_0xbef875){_0xbef875=_0xbef875||0xcc;return function(_0x3c80c0){if(_0x3c80c0){return _0x508ab7['sendStatus'](_0xbef875);}return _0x508ab7[_0xc0ac('0x14')](_0xbef875)['end']();};}function respondWithResult(_0x548c2f,_0x57ba9e){_0x57ba9e=_0x57ba9e||0xc8;return function(_0x13cb7d){if(_0x13cb7d){return _0x548c2f['status'](_0x57ba9e)[_0xc0ac('0x15')](_0x13cb7d);}};}function respondWithFilteredResult(_0x7bd1fd,_0x13581f){return function(_0x38d809){if(_0x38d809){var _0x24b894=_0x38d809[_0xc0ac('0x16')],_0x465033=_0x13581f[_0xc0ac('0x17')],_0x28cedc=_0x13581f[_0xc0ac('0x17')]+_0x13581f[_0xc0ac('0x18')],_0x2ab1e7;if(_0x28cedc>=_0x24b894){_0x28cedc=_0x24b894;_0x2ab1e7=0xc8;}else{_0x2ab1e7=0xce;}_0x7bd1fd['status'](_0x2ab1e7);return _0x7bd1fd[_0xc0ac('0x19')](_0xc0ac('0x1a'),_0x465033+'-'+_0x28cedc+'/'+_0x24b894)[_0xc0ac('0x15')](_0x38d809);}return null;};}function patchUpdates(_0xab3c6a){return function(_0x5b8f8e){try{jsonpatch[_0xc0ac('0x1b')](_0x5b8f8e,_0xab3c6a,!![]);}catch(_0x47fbbf){return BPromise[_0xc0ac('0x1c')](_0x47fbbf);}return _0x5b8f8e[_0xc0ac('0x1d')]();};}function saveUpdates(_0x8efc26,_0x295647){return function(_0x50eba7){if(_0x50eba7){return _0x50eba7[_0xc0ac('0x1e')](_0x8efc26)[_0xc0ac('0x1f')](function(_0x591c61){return _0x591c61;});}return null;};}function removeEntity(_0x4be5fc,_0x2b6612){return function(_0x16e1f2){if(_0x16e1f2){return _0x16e1f2[_0xc0ac('0x20')]()['then'](function(){_0x4be5fc['status'](0xcc)[_0xc0ac('0x21')]();});}};}function handleEntityNotFound(_0xf5b7b8,_0x14fa55){return function(_0x548e4c){if(!_0x548e4c){_0xf5b7b8[_0xc0ac('0x22')](0x194);}return _0x548e4c;};}function handleError(_0x3caa4a,_0x2a239c){_0x2a239c=_0x2a239c||0x1f4;return function(_0x65b23){logger[_0xc0ac('0x23')](_0x65b23[_0xc0ac('0x24')]);if(_0x65b23['name']){delete _0x65b23['name'];}_0x3caa4a[_0xc0ac('0x14')](_0x2a239c)['send'](_0x65b23);};}exports[_0xc0ac('0x25')]=function(_0xf74afd,_0x1a44d5){var _0x38a9bd={},_0x29154b={},_0x4928c7={'count':0x0,'rows':[]};var _0x5e9bf7=_['map'](db[_0xc0ac('0x26')]['rawAttributes'],function(_0x2d3610){return{'name':_0x2d3610['fieldName'],'type':_0x2d3610['type']['key']};});_0x29154b[_0xc0ac('0x27')]=_[_0xc0ac('0x28')](_0x5e9bf7,'name');_0x29154b[_0xc0ac('0x29')]=_[_0xc0ac('0x2a')](_0xf74afd['query']);_0x29154b[_0xc0ac('0x2b')]=_['intersection'](_0x29154b[_0xc0ac('0x27')],_0x29154b[_0xc0ac('0x29')]);_0x38a9bd[_0xc0ac('0x2c')]=_[_0xc0ac('0x2d')](_0x29154b[_0xc0ac('0x27')],qs['fields'](_0xf74afd['query']['fields']));_0x38a9bd['attributes']=_0x38a9bd[_0xc0ac('0x2c')][_0xc0ac('0x2e')]?_0x38a9bd[_0xc0ac('0x2c')]:_0x29154b[_0xc0ac('0x27')];if(!_0xf74afd[_0xc0ac('0x29')][_0xc0ac('0x2f')]('nolimit')){_0x38a9bd[_0xc0ac('0x18')]=qs[_0xc0ac('0x18')](_0xf74afd[_0xc0ac('0x29')][_0xc0ac('0x18')]);_0x38a9bd[_0xc0ac('0x17')]=qs['offset'](_0xf74afd[_0xc0ac('0x29')][_0xc0ac('0x17')]);}_0x38a9bd[_0xc0ac('0x30')]=qs['sort'](_0xf74afd[_0xc0ac('0x29')]['sort']);_0x38a9bd[_0xc0ac('0x31')]=qs[_0xc0ac('0x2b')](_[_0xc0ac('0x32')](_0xf74afd['query'],_0x29154b[_0xc0ac('0x2b')]),_0x5e9bf7);if(_0xf74afd['query'][_0xc0ac('0x33')]){_0x38a9bd[_0xc0ac('0x31')]=_[_0xc0ac('0x34')](_0x38a9bd[_0xc0ac('0x31')],{'$or':_[_0xc0ac('0x28')](_0x5e9bf7,function(_0x35cffb){if(_0x35cffb[_0xc0ac('0x35')]!==_0xc0ac('0x36')){var _0x2a92c2={};_0x2a92c2[_0x35cffb[_0xc0ac('0x37')]]={'$like':'%'+_0xf74afd[_0xc0ac('0x29')][_0xc0ac('0x33')]+'%'};return _0x2a92c2;}})});}_0x38a9bd=_['merge']({},_0x38a9bd,_0xf74afd[_0xc0ac('0x38')]);var _0x42e34d={'where':_0x38a9bd[_0xc0ac('0x31')]};return db[_0xc0ac('0x26')]['count'](_0x42e34d)[_0xc0ac('0x1f')](function(_0x3a7438){_0x4928c7['count']=_0x3a7438;if(_0xf74afd['query'][_0xc0ac('0x39')]){_0x38a9bd[_0xc0ac('0x3a')]=[{'all':!![]}];}return db[_0xc0ac('0x26')]['findAll'](_0x38a9bd);})['then'](function(_0x43e7ec){_0x4928c7[_0xc0ac('0x3b')]=_0x43e7ec;return _0x4928c7;})[_0xc0ac('0x1f')](respondWithFilteredResult(_0x1a44d5,_0x38a9bd))[_0xc0ac('0x3c')](handleError(_0x1a44d5,null));};exports[_0xc0ac('0x3d')]=function(_0x35cfd5,_0x55624c){var _0x18370c={'raw':!![],'where':{'id':_0x35cfd5[_0xc0ac('0x3e')]['id']}},_0x4cbb3a={};_0x4cbb3a[_0xc0ac('0x27')]=_[_0xc0ac('0x2a')](db[_0xc0ac('0x26')][_0xc0ac('0x3f')]);_0x4cbb3a[_0xc0ac('0x29')]=_[_0xc0ac('0x2a')](_0x35cfd5['query']);_0x4cbb3a[_0xc0ac('0x2b')]=_[_0xc0ac('0x2d')](_0x4cbb3a[_0xc0ac('0x27')],_0x4cbb3a['query']);_0x18370c[_0xc0ac('0x2c')]=_[_0xc0ac('0x2d')](_0x4cbb3a[_0xc0ac('0x27')],qs[_0xc0ac('0x40')](_0x35cfd5[_0xc0ac('0x29')]['fields']));_0x18370c[_0xc0ac('0x2c')]=_0x18370c['attributes'][_0xc0ac('0x2e')]?_0x18370c[_0xc0ac('0x2c')]:_0x4cbb3a[_0xc0ac('0x27')];if(_0x35cfd5['query'][_0xc0ac('0x39')]){_0x18370c[_0xc0ac('0x3a')]=[{'all':!![]}];}_0x18370c=_['merge']({},_0x18370c,_0x35cfd5['options']);return db[_0xc0ac('0x26')][_0xc0ac('0x41')](_0x18370c)[_0xc0ac('0x1f')](handleEntityNotFound(_0x55624c,null))['then'](respondWithResult(_0x55624c,null))[_0xc0ac('0x3c')](handleError(_0x55624c,null));};exports[_0xc0ac('0x42')]=function(_0x2b8d03,_0x28c8e4){return db['Dynamics365Field'][_0xc0ac('0x42')](_0x2b8d03[_0xc0ac('0x43')],{})['then'](respondWithResult(_0x28c8e4,0xc9))[_0xc0ac('0x3c')](handleError(_0x28c8e4,null));};exports[_0xc0ac('0x1e')]=function(_0x32e8a3,_0x1c9e9f){if(_0x32e8a3[_0xc0ac('0x43')]['id']){delete _0x32e8a3['body']['id'];}return db['Dynamics365Field'][_0xc0ac('0x41')]({'where':{'id':_0x32e8a3[_0xc0ac('0x3e')]['id']}})[_0xc0ac('0x1f')](handleEntityNotFound(_0x1c9e9f,null))['then'](saveUpdates(_0x32e8a3['body'],null))[_0xc0ac('0x1f')](respondWithResult(_0x1c9e9f,null))[_0xc0ac('0x3c')](handleError(_0x1c9e9f,null));};exports[_0xc0ac('0x20')]=function(_0x28bd23,_0x4dd9d6){return db[_0xc0ac('0x26')][_0xc0ac('0x41')]({'where':{'id':_0x28bd23['params']['id']}})['then'](handleEntityNotFound(_0x4dd9d6,null))['then'](removeEntity(_0x4dd9d6,null))[_0xc0ac('0x3c')](handleError(_0x4dd9d6,null));}; \ No newline at end of file +var _0x0441=['merge','VIRTUAL','options','includeAll','include','Dynamics365Field','findAll','rows','catch','show','keys','fields','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','intersection','model','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter'];(function(_0x320b86,_0x364ce8){var _0x5f5050=function(_0x1bdf6f){while(--_0x1bdf6f){_0x320b86['push'](_0x320b86['shift']());}};_0x5f5050(++_0x364ce8);}(_0x0441,0x1a5));var _0x1044=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x0441[_0x5c9307];return _0x373e29;};'use strict';var pdf=require(_0x1044('0x0'));var emlformat=require(_0x1044('0x1'));var rimraf=require(_0x1044('0x2'));var zipdir=require(_0x1044('0x3'));var jsonpatch=require(_0x1044('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1044('0x5'));var util=require(_0x1044('0x6'));var path=require(_0x1044('0x7'));var sox=require('sox');var csv=require(_0x1044('0x8'));var ejs=require(_0x1044('0x9'));var fs=require('fs');var _=require(_0x1044('0xa'));var squel=require(_0x1044('0xb'));var crypto=require(_0x1044('0xc'));var jsforce=require(_0x1044('0xd'));var deskjs=require(_0x1044('0xe'));var toCsv=require(_0x1044('0x8'));var querystring=require(_0x1044('0xf'));var Papa=require(_0x1044('0x10'));var Redis=require(_0x1044('0x11'));var authService=require(_0x1044('0x12'));var qs=require(_0x1044('0x13'));var as=require(_0x1044('0x14'));var hardwareService=require(_0x1044('0x15'));var logger=require(_0x1044('0x16'))(_0x1044('0x17'));var utils=require('../../config/utils');var config=require(_0x1044('0x18'));var licenseUtil=require(_0x1044('0x19'));var db=require(_0x1044('0x1a'))['db'];function respondWithStatusCode(_0x3e58da,_0x26b158){_0x26b158=_0x26b158||0xcc;return function(_0x7b372){if(_0x7b372){return _0x3e58da[_0x1044('0x1b')](_0x26b158);}return _0x3e58da[_0x1044('0x1c')](_0x26b158)['end']();};}function respondWithResult(_0xb0542a,_0x42ef99){_0x42ef99=_0x42ef99||0xc8;return function(_0x2765e1){if(_0x2765e1){return _0xb0542a[_0x1044('0x1c')](_0x42ef99)['json'](_0x2765e1);}};}function respondWithFilteredResult(_0x4b6ea8,_0x3dc3cc){return function(_0x4051ca){if(_0x4051ca){var _0xfbf6f2=_0x4051ca[_0x1044('0x1d')],_0x3d4b22=_0x3dc3cc[_0x1044('0x1e')],_0x38b168=_0x3dc3cc['offset']+_0x3dc3cc['limit'],_0x319526;if(_0x38b168>=_0xfbf6f2){_0x38b168=_0xfbf6f2;_0x319526=0xc8;}else{_0x319526=0xce;}_0x4b6ea8[_0x1044('0x1c')](_0x319526);return _0x4b6ea8[_0x1044('0x1f')](_0x1044('0x20'),_0x3d4b22+'-'+_0x38b168+'/'+_0xfbf6f2)[_0x1044('0x21')](_0x4051ca);}return null;};}function patchUpdates(_0x32a71b){return function(_0x4ff4fe){try{jsonpatch[_0x1044('0x22')](_0x4ff4fe,_0x32a71b,!![]);}catch(_0x2c715c){return BPromise[_0x1044('0x23')](_0x2c715c);}return _0x4ff4fe[_0x1044('0x24')]();};}function saveUpdates(_0x55ac59,_0x4f3729){return function(_0x891ad){if(_0x891ad){return _0x891ad[_0x1044('0x25')](_0x55ac59)['then'](function(_0x1a305a){return _0x1a305a;});}return null;};}function removeEntity(_0x54c1e0,_0x3a22c0){return function(_0x29c85b){if(_0x29c85b){return _0x29c85b[_0x1044('0x26')]()[_0x1044('0x27')](function(){_0x54c1e0[_0x1044('0x1c')](0xcc)[_0x1044('0x28')]();});}};}function handleEntityNotFound(_0x326802,_0x1f70d8){return function(_0x1d1f9f){if(!_0x1d1f9f){_0x326802[_0x1044('0x1b')](0x194);}return _0x1d1f9f;};}function handleError(_0x3d8795,_0x28a8ca){_0x28a8ca=_0x28a8ca||0x1f4;return function(_0x39da61){logger[_0x1044('0x29')](_0x39da61[_0x1044('0x2a')]);if(_0x39da61[_0x1044('0x2b')]){delete _0x39da61[_0x1044('0x2b')];}_0x3d8795[_0x1044('0x1c')](_0x28a8ca)[_0x1044('0x2c')](_0x39da61);};}exports[_0x1044('0x2d')]=function(_0x422ac0,_0x2c66a2){var _0x37e00e={},_0x3ba13c={},_0x13e9fd={'count':0x0,'rows':[]};var _0x580ca5=_[_0x1044('0x2e')](db['Dynamics365Field'][_0x1044('0x2f')],function(_0x305f27){return{'name':_0x305f27[_0x1044('0x30')],'type':_0x305f27[_0x1044('0x31')][_0x1044('0x32')]};});_0x3ba13c['model']=_[_0x1044('0x2e')](_0x580ca5,_0x1044('0x2b'));_0x3ba13c[_0x1044('0x33')]=_['keys'](_0x422ac0[_0x1044('0x33')]);_0x3ba13c['filters']=_[_0x1044('0x34')](_0x3ba13c[_0x1044('0x35')],_0x3ba13c['query']);_0x37e00e[_0x1044('0x36')]=_[_0x1044('0x34')](_0x3ba13c[_0x1044('0x35')],qs['fields'](_0x422ac0['query']['fields']));_0x37e00e[_0x1044('0x36')]=_0x37e00e[_0x1044('0x36')][_0x1044('0x37')]?_0x37e00e[_0x1044('0x36')]:_0x3ba13c[_0x1044('0x35')];if(!_0x422ac0[_0x1044('0x33')][_0x1044('0x38')](_0x1044('0x39'))){_0x37e00e[_0x1044('0x3a')]=qs[_0x1044('0x3a')](_0x422ac0['query'][_0x1044('0x3a')]);_0x37e00e[_0x1044('0x1e')]=qs[_0x1044('0x1e')](_0x422ac0[_0x1044('0x33')][_0x1044('0x1e')]);}_0x37e00e[_0x1044('0x3b')]=qs[_0x1044('0x3c')](_0x422ac0[_0x1044('0x33')][_0x1044('0x3c')]);_0x37e00e[_0x1044('0x3d')]=qs['filters'](_[_0x1044('0x3e')](_0x422ac0['query'],_0x3ba13c[_0x1044('0x3f')]),_0x580ca5);if(_0x422ac0['query'][_0x1044('0x40')]){_0x37e00e['where']=_[_0x1044('0x41')](_0x37e00e[_0x1044('0x3d')],{'$or':_['map'](_0x580ca5,function(_0x3e7003){if(_0x3e7003[_0x1044('0x31')]!==_0x1044('0x42')){var _0x310183={};_0x310183[_0x3e7003[_0x1044('0x2b')]]={'$like':'%'+_0x422ac0['query'][_0x1044('0x40')]+'%'};return _0x310183;}})});}_0x37e00e=_['merge']({},_0x37e00e,_0x422ac0[_0x1044('0x43')]);var _0x14c45d={'where':_0x37e00e[_0x1044('0x3d')]};return db['Dynamics365Field'][_0x1044('0x1d')](_0x14c45d)[_0x1044('0x27')](function(_0x27667f){_0x13e9fd[_0x1044('0x1d')]=_0x27667f;if(_0x422ac0[_0x1044('0x33')][_0x1044('0x44')]){_0x37e00e[_0x1044('0x45')]=[{'all':!![]}];}return db[_0x1044('0x46')][_0x1044('0x47')](_0x37e00e);})[_0x1044('0x27')](function(_0x19f937){_0x13e9fd[_0x1044('0x48')]=_0x19f937;return _0x13e9fd;})['then'](respondWithFilteredResult(_0x2c66a2,_0x37e00e))[_0x1044('0x49')](handleError(_0x2c66a2,null));};exports[_0x1044('0x4a')]=function(_0x4c5798,_0x575f60){var _0x10e23d={'raw':!![],'where':{'id':_0x4c5798['params']['id']}},_0x2a3dc={};_0x2a3dc['model']=_['keys'](db['Dynamics365Field']['rawAttributes']);_0x2a3dc[_0x1044('0x33')]=_[_0x1044('0x4b')](_0x4c5798['query']);_0x2a3dc[_0x1044('0x3f')]=_['intersection'](_0x2a3dc[_0x1044('0x35')],_0x2a3dc[_0x1044('0x33')]);_0x10e23d[_0x1044('0x36')]=_[_0x1044('0x34')](_0x2a3dc['model'],qs['fields'](_0x4c5798[_0x1044('0x33')][_0x1044('0x4c')]));_0x10e23d[_0x1044('0x36')]=_0x10e23d['attributes'][_0x1044('0x37')]?_0x10e23d[_0x1044('0x36')]:_0x2a3dc[_0x1044('0x35')];if(_0x4c5798[_0x1044('0x33')][_0x1044('0x44')]){_0x10e23d[_0x1044('0x45')]=[{'all':!![]}];}_0x10e23d=_['merge']({},_0x10e23d,_0x4c5798[_0x1044('0x43')]);return db[_0x1044('0x46')][_0x1044('0x4d')](_0x10e23d)[_0x1044('0x27')](handleEntityNotFound(_0x575f60,null))[_0x1044('0x27')](respondWithResult(_0x575f60,null))[_0x1044('0x49')](handleError(_0x575f60,null));};exports[_0x1044('0x4e')]=function(_0x6f8a15,_0x24a0f1){return db['Dynamics365Field'][_0x1044('0x4e')](_0x6f8a15[_0x1044('0x4f')],{})[_0x1044('0x27')](respondWithResult(_0x24a0f1,0xc9))[_0x1044('0x49')](handleError(_0x24a0f1,null));};exports[_0x1044('0x25')]=function(_0x37a21c,_0x2d8828){if(_0x37a21c[_0x1044('0x4f')]['id']){delete _0x37a21c['body']['id'];}return db[_0x1044('0x46')]['find']({'where':{'id':_0x37a21c[_0x1044('0x50')]['id']}})['then'](handleEntityNotFound(_0x2d8828,null))[_0x1044('0x27')](saveUpdates(_0x37a21c['body'],null))['then'](respondWithResult(_0x2d8828,null))['catch'](handleError(_0x2d8828,null));};exports[_0x1044('0x26')]=function(_0x1ec933,_0x59c8bc){return db[_0x1044('0x46')]['find']({'where':{'id':_0x1ec933[_0x1044('0x50')]['id']}})[_0x1044('0x27')](handleEntityNotFound(_0x59c8bc,null))[_0x1044('0x27')](removeEntity(_0x59c8bc,null))['catch'](handleError(_0x59c8bc,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index b215d72..ecafd08 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 _0xa7b0=['idField','FieldId','lodash','../../config/logger','api','moment','bluebird','path','../../config/environment','int_dynamics365_fields','dynamics365_unique_index'];(function(_0x25fea8,_0x3d17f8){var _0x21c883=function(_0xaec32f){while(--_0xaec32f){_0x25fea8['push'](_0x25fea8['shift']());}};_0x21c883(++_0x3d17f8);}(_0xa7b0,0xc8));var _0x0a7b=function(_0x57a53b,_0x11494e){_0x57a53b=_0x57a53b-0x0;var _0x29e81c=_0xa7b0[_0x57a53b];return _0x29e81c;};'use strict';var _=require(_0x0a7b('0x0'));var util=require('util');var logger=require(_0x0a7b('0x1'))(_0x0a7b('0x2'));var moment=require(_0x0a7b('0x3'));var BPromise=require(_0x0a7b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a7b('0x5'));var rimraf=require('rimraf');var config=require(_0x0a7b('0x6'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x173ad2,_0x55c23c){return _0x173ad2['define']('Dynamics365Field',attributes,{'tableName':_0x0a7b('0x7'),'paranoid':![],'indexes':[{'name':_0x0a7b('0x8'),'fields':[_0x0a7b('0x9'),_0x0a7b('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1b48=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash'];(function(_0x2b26e0,_0x3f888d){var _0x553b39=function(_0x3b20b2){while(--_0x3b20b2){_0x2b26e0['push'](_0x2b26e0['shift']());}};_0x553b39(++_0x3f888d);}(_0x1b48,0x1b2));var _0x81b4=function(_0x315c3d,_0x4251e8){_0x315c3d=_0x315c3d-0x0;var _0x108998=_0x1b48[_0x315c3d];return _0x108998;};'use strict';var _=require(_0x81b4('0x0'));var util=require('util');var logger=require(_0x81b4('0x1'))(_0x81b4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x81b4('0x3'));var fs=require('fs');var path=require(_0x81b4('0x4'));var rimraf=require(_0x81b4('0x5'));var config=require(_0x81b4('0x6'));var attributes=require(_0x81b4('0x7'));module[_0x81b4('0x8')]=function(_0x12a3bf,_0x1ddbfe){return _0x12a3bf[_0x81b4('0x9')](_0x81b4('0xa'),attributes,{'tableName':_0x81b4('0xb'),'paranoid':![],'indexes':[{'name':_0x81b4('0xc'),'fields':[_0x81b4('0xd'),_0x81b4('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 cd69ef2..7a57609 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 _0x4148=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4148,0xc6));var _0x8414=function(_0x45b900,_0x2d7019){_0x45b900=_0x45b900-0x0;var _0x40233d=_0x4148[_0x45b900];return _0x40233d;};'use strict';var _=require(_0x8414('0x0'));var util=require(_0x8414('0x1'));var moment=require(_0x8414('0x2'));var BPromise=require(_0x8414('0x3'));var rs=require(_0x8414('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8414('0x5'))['db'];var utils=require(_0x8414('0x6'));var logger=require(_0x8414('0x7'))(_0x8414('0x8'));var config=require('../../config/environment');var jayson=require(_0x8414('0x9'));var client=jayson['client'][_0x8414('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x507e0b,_0x51ab01,_0x131b88){return new BPromise(function(_0x2444b7,_0x1623c3){return client[_0x8414('0xb')](_0x507e0b,_0x131b88)[_0x8414('0xc')](function(_0xd625a7){logger[_0x8414('0xd')](_0x8414('0xe'),_0x51ab01,_0x8414('0xf'));logger[_0x8414('0x10')](_0x8414('0x11'),_0x51ab01,'request\x20sent',JSON[_0x8414('0x12')](_0xd625a7));if(_0xd625a7['error']){if(_0xd625a7[_0x8414('0x13')][_0x8414('0x14')]===0x1f4){logger[_0x8414('0x13')](_0x8414('0xe'),_0x51ab01,_0xd625a7['error'][_0x8414('0x15')]);return _0x1623c3(_0xd625a7['error'][_0x8414('0x15')]);}logger[_0x8414('0x13')](_0x8414('0xe'),_0x51ab01,_0xd625a7['error'][_0x8414('0x15')]);return _0x2444b7(_0xd625a7[_0x8414('0x13')][_0x8414('0x15')]);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x51ab01,_0x8414('0xf'));_0x2444b7(_0xd625a7[_0x8414('0x16')][_0x8414('0x15')]);}})[_0x8414('0x17')](function(_0x5b92aa){logger[_0x8414('0x13')](_0x8414('0xe'),_0x51ab01,_0x5b92aa);_0x1623c3(_0x5b92aa);});});} \ No newline at end of file +var _0x2e65=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','Dynamics365Field,\x20%s,\x20%s','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5706a8,_0x3a6d43){var _0x1e266c=function(_0x11f362){while(--_0x11f362){_0x5706a8['push'](_0x5706a8['shift']());}};_0x1e266c(++_0x3a6d43);}(_0x2e65,0x193));var _0x52e6=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x2e65[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x52e6('0x0'));var util=require(_0x52e6('0x1'));var moment=require(_0x52e6('0x2'));var BPromise=require(_0x52e6('0x3'));var rs=require(_0x52e6('0x4'));var fs=require('fs');var Redis=require(_0x52e6('0x5'));var db=require(_0x52e6('0x6'))['db'];var utils=require(_0x52e6('0x7'));var logger=require('../../config/logger')(_0x52e6('0x8'));var config=require(_0x52e6('0x9'));var jayson=require(_0x52e6('0xa'));var client=jayson[_0x52e6('0xb')][_0x52e6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x116651,_0x15e4af,_0x1401a3){return new BPromise(function(_0x27f270,_0x2ab17e){return client['request'](_0x116651,_0x1401a3)[_0x52e6('0xd')](function(_0x1db169){logger['info'](_0x52e6('0xe'),_0x15e4af,'request\x20sent');logger['debug'](_0x52e6('0xf'),_0x15e4af,_0x52e6('0x10'),JSON[_0x52e6('0x11')](_0x1db169));if(_0x1db169[_0x52e6('0x12')]){if(_0x1db169[_0x52e6('0x12')][_0x52e6('0x13')]===0x1f4){logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x15e4af,_0x1db169[_0x52e6('0x12')][_0x52e6('0x14')]);return _0x2ab17e(_0x1db169['error'][_0x52e6('0x14')]);}logger[_0x52e6('0x12')](_0x52e6('0xe'),_0x15e4af,_0x1db169[_0x52e6('0x12')][_0x52e6('0x14')]);return _0x27f270(_0x1db169[_0x52e6('0x12')][_0x52e6('0x14')]);}else{logger[_0x52e6('0x15')](_0x52e6('0xe'),_0x15e4af,_0x52e6('0x10'));_0x27f270(_0x1db169[_0x52e6('0x16')][_0x52e6('0x14')]);}})[_0x52e6('0x17')](function(_0x5c275c){logger['error'](_0x52e6('0xe'),_0x15e4af,_0x5c275c);_0x2ab17e(_0x5c275c);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index afb5cc0..93d55bd 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 _0x13c2=['/:id/fields','getFields','post','addConfiguration','put','/:id','update','delete','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x13c2,0xd1));var _0x213c=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x13c2[_0x6c993a];return _0x27f547;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x213c('0x0'));var timeout=require(_0x213c('0x1'));var express=require('express');var router=express[_0x213c('0x2')]();var auth=require(_0x213c('0x3'));var interaction=require(_0x213c('0x4'));var config=require(_0x213c('0x5'));var controller=require('./intFreshdeskAccount.controller');router[_0x213c('0x6')]('/',auth[_0x213c('0x7')](),controller[_0x213c('0x8')]);router[_0x213c('0x6')]('/:id',auth[_0x213c('0x7')](),controller[_0x213c('0x9')]);router['get'](_0x213c('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x213c('0x6')](_0x213c('0xb'),auth[_0x213c('0x7')](),controller[_0x213c('0xc')]);router[_0x213c('0xd')]('/',auth[_0x213c('0x7')](),controller['create']);router['post'](_0x213c('0xa'),auth[_0x213c('0x7')](),controller[_0x213c('0xe')]);router[_0x213c('0xf')](_0x213c('0x10'),auth[_0x213c('0x7')](),controller[_0x213c('0x11')]);router[_0x213c('0x12')](_0x213c('0x10'),auth[_0x213c('0x7')](),controller['destroy']);module[_0x213c('0x13')]=router; \ No newline at end of file +var _0x1896=['getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x4b0948,_0x7dd5c2){var _0x2e240a=function(_0x59c742){while(--_0x59c742){_0x4b0948['push'](_0x4b0948['shift']());}};_0x2e240a(++_0x7dd5c2);}(_0x1896,0x191));var _0x6189=function(_0x440116,_0x537028){_0x440116=_0x440116-0x0;var _0xcae5cf=_0x1896[_0x440116];return _0xcae5cf;};'use strict';var multer=require(_0x6189('0x0'));var util=require('util');var path=require(_0x6189('0x1'));var timeout=require(_0x6189('0x2'));var express=require(_0x6189('0x3'));var router=express[_0x6189('0x4')]();var auth=require(_0x6189('0x5'));var interaction=require(_0x6189('0x6'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0x6189('0x7')]('/',auth[_0x6189('0x8')](),controller[_0x6189('0x9')]);router[_0x6189('0x7')](_0x6189('0xa'),auth[_0x6189('0x8')](),controller[_0x6189('0xb')]);router[_0x6189('0x7')](_0x6189('0xc'),auth[_0x6189('0x8')](),controller[_0x6189('0xd')]);router[_0x6189('0x7')](_0x6189('0xe'),auth[_0x6189('0x8')](),controller[_0x6189('0xf')]);router[_0x6189('0x10')]('/',auth[_0x6189('0x8')](),controller[_0x6189('0x11')]);router[_0x6189('0x10')](_0x6189('0xc'),auth[_0x6189('0x8')](),controller[_0x6189('0x12')]);router[_0x6189('0x13')](_0x6189('0xa'),auth[_0x6189('0x8')](),controller['update']);router[_0x6189('0x14')]('/:id',auth[_0x6189('0x8')](),controller[_0x6189('0x15')]);module[_0x6189('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index e4f9b15..9afc837 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 _0x159d=['username','sequelize','STRING'];(function(_0x560f8e,_0x2c5cc4){var _0xbc3ed3=function(_0x9d5906){while(--_0x9d5906){_0x560f8e['push'](_0x560f8e['shift']());}};_0xbc3ed3(++_0x2c5cc4);}(_0x159d,0x1e1));var _0xd159=function(_0x2f0943,_0x4cfd45){_0x2f0943=_0x2f0943-0x0;var _0x4966f4=_0x159d[_0x2f0943];return _0x4966f4;};'use strict';var Sequelize=require(_0xd159('0x0'));module['exports']={'name':{'type':Sequelize[_0xd159('0x1')]},'description':{'type':Sequelize[_0xd159('0x1')]},'username':{'type':Sequelize[_0xd159('0x1')],'unique':_0xd159('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd159('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xf305=['sequelize','STRING','username','remoteUri'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xf305,0x16c));var _0x5f30=function(_0x1945a5,_0x50de54){_0x1945a5=_0x1945a5-0x0;var _0x5817a5=_0xf305[_0x1945a5];return _0x5817a5;};'use strict';var Sequelize=require(_0x5f30('0x0'));module['exports']={'name':{'type':Sequelize[_0x5f30('0x1')]},'description':{'type':Sequelize[_0x5f30('0x1')]},'username':{'type':Sequelize[_0x5f30('0x1')],'unique':_0x5f30('0x2')},'apiKey':{'type':Sequelize[_0x5f30('0x1')]},'remoteUri':{'type':Sequelize[_0x5f30('0x1')],'unique':_0x5f30('0x3')},'serverUrl':{'type':Sequelize[_0x5f30('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index f162ac6..06eea22 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 _0xd1de=['priority','group','source','ticket_type','company','remove','includes','default','custom_dropdown','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','html-pdf','eml-format','rimraf','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','count','offset','limit','set','json','apply','save','then','end','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','length','includeAll','create','body','find','getConfigurations','hasOwnProperty','AccountId','getSubjects','channel','getDescriptions','FreshdeskConfiguration','FreshdeskField','Subjects','Descriptions','getFields','findOne','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','requester','subject','description'];(function(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0xd1de,0x110));var _0xed1d=function(_0x4a17ab,_0x13e2c0){_0x4a17ab=_0x4a17ab-0x0;var _0x15330b=_0xd1de[_0x4a17ab];return _0x15330b;};'use strict';var pdf=require(_0xed1d('0x0'));var emlformat=require(_0xed1d('0x1'));var rimraf=require(_0xed1d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xed1d('0x3'));var BPromise=require(_0xed1d('0x4'));var Mustache=require(_0xed1d('0x5'));var util=require(_0xed1d('0x6'));var path=require('path');var sox=require(_0xed1d('0x7'));var csv=require(_0xed1d('0x8'));var ejs=require(_0xed1d('0x9'));var fs=require('fs');var _=require(_0xed1d('0xa'));var squel=require(_0xed1d('0xb'));var crypto=require(_0xed1d('0xc'));var jsforce=require(_0xed1d('0xd'));var deskjs=require(_0xed1d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xed1d('0xf'));var Papa=require(_0xed1d('0x10'));var Redis=require(_0xed1d('0x11'));var authService=require(_0xed1d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xed1d('0x13'));var hardwareService=require(_0xed1d('0x14'));var logger=require(_0xed1d('0x15'))('api');var utils=require(_0xed1d('0x16'));var config=require(_0xed1d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xed1d('0x18'))['db'];var integrations=require(_0xed1d('0x19'));var jayson=require('jayson/promise');var client=jayson['client'][_0xed1d('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x218df8,_0x2b60e1,_0x2efc59,_0x8b5d29){return new BPromise(function(_0x3c451d,_0x5e407e){var _0x47b936=_0x8b5d29||client;return _0x47b936[_0xed1d('0x1b')](_0x218df8,_0x2efc59)['then'](function(_0x431242){logger[_0xed1d('0x1c')](_0xed1d('0x1d'),_0x2b60e1,_0xed1d('0x1e'));logger[_0xed1d('0x1f')](_0xed1d('0x20'),_0x2b60e1,_0xed1d('0x1e'),JSON['stringify'](_0x431242));if(_0x431242['error']){if(_0x431242[_0xed1d('0x21')][_0xed1d('0x22')]===0x1f4){logger[_0xed1d('0x21')]('FreshdeskAccount,\x20%s,\x20%s',_0x2b60e1,_0x431242[_0xed1d('0x21')][_0xed1d('0x23')]);return _0x5e407e(_0x431242['error'][_0xed1d('0x23')]);}logger[_0xed1d('0x21')](_0xed1d('0x1d'),_0x2b60e1,_0x431242[_0xed1d('0x21')][_0xed1d('0x23')]);return _0x3c451d(_0x431242[_0xed1d('0x21')][_0xed1d('0x23')]);}else{logger[_0xed1d('0x1c')]('FreshdeskAccount,\x20%s,\x20%s',_0x2b60e1,_0xed1d('0x1e'));_0x3c451d(_0x431242[_0xed1d('0x24')][_0xed1d('0x23')]);}})[_0xed1d('0x25')](function(_0x3b5867){logger[_0xed1d('0x21')](_0xed1d('0x1d'),_0x2b60e1,_0x3b5867);_0x5e407e(_0x3b5867);});});}function respondWithStatusCode(_0x2401a6,_0x2c9a1c){_0x2c9a1c=_0x2c9a1c||0xcc;return function(_0x4266bb){if(_0x4266bb){return _0x2401a6[_0xed1d('0x26')](_0x2c9a1c);}return _0x2401a6[_0xed1d('0x27')](_0x2c9a1c)['end']();};}function respondWithResult(_0x5c9107,_0x11d617){_0x11d617=_0x11d617||0xc8;return function(_0x4b9683){if(_0x4b9683){return _0x5c9107['status'](_0x11d617)['json'](_0x4b9683);}};}function respondWithFilteredResult(_0x420a6c,_0x1aff0a){return function(_0x457a9e){if(_0x457a9e){var _0x53c155=_0x457a9e[_0xed1d('0x28')],_0x3cd514=_0x1aff0a[_0xed1d('0x29')],_0x5a524f=_0x1aff0a[_0xed1d('0x29')]+_0x1aff0a[_0xed1d('0x2a')],_0x10239d;if(_0x5a524f>=_0x53c155){_0x5a524f=_0x53c155;_0x10239d=0xc8;}else{_0x10239d=0xce;}_0x420a6c[_0xed1d('0x27')](_0x10239d);return _0x420a6c[_0xed1d('0x2b')]('Content-Range',_0x3cd514+'-'+_0x5a524f+'/'+_0x53c155)[_0xed1d('0x2c')](_0x457a9e);}return null;};}function patchUpdates(_0x26bd38){return function(_0x6d84cc){try{jsonpatch[_0xed1d('0x2d')](_0x6d84cc,_0x26bd38,!![]);}catch(_0x484a08){return BPromise['reject'](_0x484a08);}return _0x6d84cc[_0xed1d('0x2e')]();};}function saveUpdates(_0x58a568,_0x565e72){return function(_0x789417){if(_0x789417){return _0x789417['update'](_0x58a568)['then'](function(_0x13f85d){return _0x13f85d;});}return null;};}function removeEntity(_0x592c86,_0x28dc11){return function(_0x46615b){if(_0x46615b){return _0x46615b['destroy']()[_0xed1d('0x2f')](function(){_0x592c86[_0xed1d('0x27')](0xcc)[_0xed1d('0x30')]();});}};}function handleEntityNotFound(_0x151132,_0x1af590){return function(_0x97f096){if(!_0x97f096){_0x151132[_0xed1d('0x26')](0x194);}return _0x97f096;};}function handleError(_0x4e5343,_0x21e8e9){_0x21e8e9=_0x21e8e9||0x1f4;return function(_0xdd5fc){logger[_0xed1d('0x21')](_0xdd5fc[_0xed1d('0x31')]);if(_0xdd5fc[_0xed1d('0x32')]){delete _0xdd5fc[_0xed1d('0x32')];}_0x4e5343[_0xed1d('0x27')](_0x21e8e9)[_0xed1d('0x33')](_0xdd5fc);};}exports[_0xed1d('0x34')]=function(_0x3d52eb,_0x23e69f){var _0x14c37a={},_0x104976={},_0x44cf2c={'count':0x0,'rows':[]};var _0x4c1eff=_[_0xed1d('0x35')](db[_0xed1d('0x36')][_0xed1d('0x37')],function(_0xdbf529){return{'name':_0xdbf529[_0xed1d('0x38')],'type':_0xdbf529[_0xed1d('0x39')][_0xed1d('0x3a')]};});_0x104976[_0xed1d('0x3b')]=_['map'](_0x4c1eff,'name');_0x104976[_0xed1d('0x3c')]=_[_0xed1d('0x3d')](_0x3d52eb[_0xed1d('0x3c')]);_0x104976[_0xed1d('0x3e')]=_[_0xed1d('0x3f')](_0x104976['model'],_0x104976[_0xed1d('0x3c')]);_0x14c37a[_0xed1d('0x40')]=_[_0xed1d('0x3f')](_0x104976['model'],qs[_0xed1d('0x41')](_0x3d52eb[_0xed1d('0x3c')][_0xed1d('0x41')]));_0x14c37a[_0xed1d('0x40')]=_0x14c37a[_0xed1d('0x40')]['length']?_0x14c37a['attributes']:_0x104976[_0xed1d('0x3b')];if(!_0x3d52eb['query']['hasOwnProperty'](_0xed1d('0x42'))){_0x14c37a[_0xed1d('0x2a')]=qs[_0xed1d('0x2a')](_0x3d52eb[_0xed1d('0x3c')]['limit']);_0x14c37a[_0xed1d('0x29')]=qs[_0xed1d('0x29')](_0x3d52eb[_0xed1d('0x3c')][_0xed1d('0x29')]);}_0x14c37a[_0xed1d('0x43')]=qs[_0xed1d('0x44')](_0x3d52eb[_0xed1d('0x3c')][_0xed1d('0x44')]);_0x14c37a[_0xed1d('0x45')]=qs['filters'](_[_0xed1d('0x46')](_0x3d52eb[_0xed1d('0x3c')],_0x104976[_0xed1d('0x3e')]),_0x4c1eff);if(_0x3d52eb[_0xed1d('0x3c')]['filter']){_0x14c37a[_0xed1d('0x45')]=_[_0xed1d('0x47')](_0x14c37a['where'],{'$or':_[_0xed1d('0x35')](_0x4c1eff,function(_0xca2609){if(_0xca2609[_0xed1d('0x39')]!==_0xed1d('0x48')){var _0x260db2={};_0x260db2[_0xca2609[_0xed1d('0x32')]]={'$like':'%'+_0x3d52eb[_0xed1d('0x3c')][_0xed1d('0x49')]+'%'};return _0x260db2;}})});}_0x14c37a=_['merge']({},_0x14c37a,_0x3d52eb[_0xed1d('0x4a')]);var _0x39c6c2={'where':_0x14c37a[_0xed1d('0x45')]};return db[_0xed1d('0x36')][_0xed1d('0x28')](_0x39c6c2)[_0xed1d('0x2f')](function(_0x3e2b78){_0x44cf2c[_0xed1d('0x28')]=_0x3e2b78;if(_0x3d52eb[_0xed1d('0x3c')]['includeAll']){_0x14c37a[_0xed1d('0x4b')]=[{'all':!![]}];}return db[_0xed1d('0x36')][_0xed1d('0x4c')](_0x14c37a);})[_0xed1d('0x2f')](function(_0x17f0dd){_0x44cf2c[_0xed1d('0x4d')]=_0x17f0dd;return _0x44cf2c;})[_0xed1d('0x2f')](respondWithFilteredResult(_0x23e69f,_0x14c37a))[_0xed1d('0x25')](handleError(_0x23e69f,null));};exports[_0xed1d('0x4e')]=function(_0x4069b4,_0x1f2355){var _0x5b4c70={'raw':![],'where':{'id':_0x4069b4[_0xed1d('0x4f')]['id']}},_0xc5f7={};_0xc5f7[_0xed1d('0x3b')]=_[_0xed1d('0x3d')](db[_0xed1d('0x36')][_0xed1d('0x37')]);_0xc5f7['query']=_[_0xed1d('0x3d')](_0x4069b4[_0xed1d('0x3c')]);_0xc5f7[_0xed1d('0x3e')]=_[_0xed1d('0x3f')](_0xc5f7[_0xed1d('0x3b')],_0xc5f7[_0xed1d('0x3c')]);_0x5b4c70['attributes']=_['intersection'](_0xc5f7[_0xed1d('0x3b')],qs['fields'](_0x4069b4['query'][_0xed1d('0x41')]));_0x5b4c70[_0xed1d('0x40')]=_0x5b4c70['attributes'][_0xed1d('0x50')]?_0x5b4c70[_0xed1d('0x40')]:_0xc5f7[_0xed1d('0x3b')];if(_0x4069b4[_0xed1d('0x3c')][_0xed1d('0x51')]){_0x5b4c70[_0xed1d('0x4b')]=[{'all':!![]}];}_0x5b4c70=_[_0xed1d('0x47')]({},_0x5b4c70,_0x4069b4[_0xed1d('0x4a')]);return db['FreshdeskAccount']['find'](_0x5b4c70)[_0xed1d('0x2f')](handleEntityNotFound(_0x1f2355,null))[_0xed1d('0x2f')](respondWithResult(_0x1f2355,null))[_0xed1d('0x25')](handleError(_0x1f2355,null));};exports[_0xed1d('0x52')]=function(_0x513515,_0x4b77e1){return db['FreshdeskAccount'][_0xed1d('0x52')](_0x513515[_0xed1d('0x53')],{})[_0xed1d('0x2f')](respondWithResult(_0x4b77e1,0xc9))[_0xed1d('0x25')](handleError(_0x4b77e1,null));};exports['update']=function(_0x19b75a,_0x513bb0){if(_0x19b75a[_0xed1d('0x53')]['id']){delete _0x19b75a[_0xed1d('0x53')]['id'];}return db[_0xed1d('0x36')][_0xed1d('0x54')]({'where':{'id':_0x19b75a[_0xed1d('0x4f')]['id']}})[_0xed1d('0x2f')](handleEntityNotFound(_0x513bb0,null))[_0xed1d('0x2f')](saveUpdates(_0x19b75a[_0xed1d('0x53')],null))[_0xed1d('0x2f')](respondWithResult(_0x513bb0,null))[_0xed1d('0x25')](handleError(_0x513bb0,null));};exports['destroy']=function(_0xa9ba0c,_0x473e23){return db[_0xed1d('0x36')][_0xed1d('0x54')]({'where':{'id':_0xa9ba0c[_0xed1d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x473e23,null))['then'](removeEntity(_0x473e23,null))['catch'](handleError(_0x473e23,null));};exports['getConfigurations']=function(_0x3353bf,_0xd9055b,_0xa8c466){var _0x10651c={};var _0x22f0a3={};var _0x5c2eb9;var _0x10573c;return db[_0xed1d('0x36')]['findOne']({'where':{'id':_0x3353bf[_0xed1d('0x4f')]['id']}})[_0xed1d('0x2f')](handleEntityNotFound(_0xd9055b,null))['then'](function(_0x401fb7){if(_0x401fb7){_0x5c2eb9=_0x401fb7;_0x22f0a3[_0xed1d('0x3b')]=_['keys'](db['FreshdeskConfiguration']['rawAttributes']);_0x22f0a3[_0xed1d('0x3c')]=_[_0xed1d('0x3d')](_0x3353bf[_0xed1d('0x3c')]);_0x22f0a3[_0xed1d('0x3e')]=_[_0xed1d('0x3f')](_0x22f0a3[_0xed1d('0x3b')],_0x22f0a3['query']);_0x10651c[_0xed1d('0x40')]=_[_0xed1d('0x3f')](_0x22f0a3['model'],qs[_0xed1d('0x41')](_0x3353bf[_0xed1d('0x3c')]['fields']));_0x10651c['attributes']=_0x10651c['attributes'][_0xed1d('0x50')]?_0x10651c['attributes']:_0x22f0a3[_0xed1d('0x3b')];_0x10651c[_0xed1d('0x43')]=qs[_0xed1d('0x44')](_0x3353bf[_0xed1d('0x3c')][_0xed1d('0x44')]);_0x10651c['where']=qs[_0xed1d('0x3e')](_[_0xed1d('0x46')](_0x3353bf['query'],_0x22f0a3['filters']));if(_0x3353bf['query']['filter']){_0x10651c['where']=_['merge'](_0x10651c['where'],{'$or':_[_0xed1d('0x35')](_0x10651c[_0xed1d('0x40')],function(_0x5026a9){var _0x50da9b={};_0x50da9b[_0x5026a9]={'$like':'%'+_0x3353bf[_0xed1d('0x3c')][_0xed1d('0x49')]+'%'};return _0x50da9b;})});}_0x10651c=_[_0xed1d('0x47')]({},_0x10651c,_0x3353bf[_0xed1d('0x4a')]);return _0x5c2eb9[_0xed1d('0x55')](_0x10651c);}})[_0xed1d('0x2f')](function(_0x592e6e){if(_0x592e6e){_0x10573c=_0x592e6e[_0xed1d('0x50')];if(!_0x3353bf['query'][_0xed1d('0x56')](_0xed1d('0x42'))){_0x10651c[_0xed1d('0x2a')]=qs['limit'](_0x3353bf[_0xed1d('0x3c')][_0xed1d('0x2a')]);_0x10651c[_0xed1d('0x29')]=qs[_0xed1d('0x29')](_0x3353bf[_0xed1d('0x3c')][_0xed1d('0x29')]);}return _0x5c2eb9[_0xed1d('0x55')](_0x10651c);}})['then'](function(_0x2b1ebe){if(_0x2b1ebe){return _0x2b1ebe?{'count':_0x10573c,'rows':_0x2b1ebe}:null;}})[_0xed1d('0x2f')](respondWithResult(_0xd9055b,null))[_0xed1d('0x25')](handleError(_0xd9055b,null));};exports['addConfiguration']=function(_0x49a14d,_0x213048,_0x454cff){if(_0x49a14d['body']['id']){delete _0x49a14d[_0xed1d('0x53')]['id'];}return db[_0xed1d('0x36')]['findOne']({'where':{'id':_0x49a14d[_0xed1d('0x4f')]['id']}})[_0xed1d('0x2f')](handleEntityNotFound(_0x213048,null))[_0xed1d('0x2f')](function(_0x5109fe){if(_0x5109fe){_0x49a14d[_0xed1d('0x53')][_0xed1d('0x57')]=_0x5109fe['id'];_0x49a14d[_0xed1d('0x53')]['Subjects']=integrations[_0xed1d('0x58')](_0x49a14d[_0xed1d('0x53')][_0xed1d('0x59')],_0x49a14d[_0xed1d('0x53')][_0xed1d('0x39')]);_0x49a14d['body']['Descriptions']=integrations[_0xed1d('0x5a')](_0x49a14d[_0xed1d('0x53')][_0xed1d('0x59')],_0x49a14d[_0xed1d('0x53')][_0xed1d('0x39')]);return db[_0xed1d('0x5b')][_0xed1d('0x52')](_0x49a14d[_0xed1d('0x53')],{'include':[{'model':db[_0xed1d('0x5c')],'as':_0xed1d('0x5d')},{'model':db[_0xed1d('0x5c')],'as':_0xed1d('0x5e')}]});}return null;})[_0xed1d('0x2f')](respondWithResult(_0x213048,null))[_0xed1d('0x25')](handleError(_0x213048,null));};exports[_0xed1d('0x5f')]=function(_0x152e0d,_0x31c068,_0x437c19){var _0x90e3ac='';return db['FreshdeskAccount'][_0xed1d('0x60')]({'where':{'id':_0x152e0d[_0xed1d('0x4f')]['id']},'attributes':['id','remoteUri',_0xed1d('0x61')]})[_0xed1d('0x2f')](handleEntityNotFound(_0x31c068,null))[_0xed1d('0x2f')](function(_0x26fabf){if(_0x26fabf){_0x90e3ac=_0x26fabf[_0xed1d('0x62')];var _0x44b942=_0x90e3ac[_0xed1d('0x63')](-0x1);if(_0x44b942==='/'){_0x90e3ac=_0x90e3ac[_0xed1d('0x64')](0x0,_0x90e3ac[_0xed1d('0x65')](_0x44b942));}return rp({'method':_0xed1d('0x66'),'uri':util[_0xed1d('0x67')](_0xed1d('0x68'),_0x90e3ac,_0xed1d('0x69')),'headers':{'Authorization':util[_0xed1d('0x67')](_0xed1d('0x6a'),new Buffer(util[_0xed1d('0x67')](_0xed1d('0x6b'),_0x26fabf[_0xed1d('0x61')]))[_0xed1d('0x6c')]('base64'))},'json':!![]});}})[_0xed1d('0x2f')](function(_0x3790af){if(_0x3790af){var _0x54a262=[_0xed1d('0x6d'),_0xed1d('0x6e'),'agent',_0xed1d('0x6f'),_0xed1d('0x27'),_0xed1d('0x70'),_0xed1d('0x71'),_0xed1d('0x72'),_0xed1d('0x73'),_0xed1d('0x71'),_0xed1d('0x74')];_[_0xed1d('0x75')](_0x3790af,function(_0x437dbb){return _0x54a262[_0xed1d('0x76')](_0x437dbb[_0xed1d('0x32')])||!_0x437dbb[_0xed1d('0x77')]&&_0x437dbb[_0xed1d('0x39')]!=='custom_text'&&_0x437dbb[_0xed1d('0x39')]!==_0xed1d('0x78');});return{'count':_0x3790af['length'],'rows':_['map'](_0x3790af,function(_0x34aa55){return{'id':_0x34aa55['name'],'name':_0x34aa55[_0xed1d('0x79')],'custom':!_0x34aa55[_0xed1d('0x77')],'options':_0x34aa55[_0xed1d('0x7a')]?_[_0xed1d('0x35')](_0x34aa55[_0xed1d('0x7a')],function(_0x272f0a){return{'name':_[_0xed1d('0x7b')](_0x272f0a),'value':_0x272f0a};}):[]};})};}})['then'](respondWithResult(_0x31c068,null))['catch'](function(_0x2ae71c){var _0x48518c=_0x152e0d['query']['test']?0x1f4:_0x2ae71c[_0xed1d('0x7c')]||0x1f4;logger['error'](_0xed1d('0x7d'),_0xed1d('0x5f'),_0x48518c,JSON[_0xed1d('0x7e')](_0x2ae71c));delete _0x2ae71c[_0xed1d('0x32')];if(_0x48518c===0x191){_0x48518c=0x190;}_0x31c068[_0xed1d('0x27')](_0x48518c)[_0xed1d('0x33')](_0x152e0d[_0xed1d('0x3c')][_0xed1d('0x7f')]?{'message':'Wrong\x20credentials','statusCode':_0x2ae71c[_0xed1d('0x7c')]}:_0x2ae71c);});}; \ No newline at end of file +var _0x11aa=['include','findAll','catch','show','rawAttributes','create','body','params','find','getConfigurations','findOne','pick','addConfiguration','AccountId','Subjects','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','group','source','company','remove','includes','custom_text','custom_dropdown','label','default','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','status','json','offset','Content-Range','update','end','name','send','FreshdeskAccount','fieldName','key','model','map','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','count','includeAll'];(function(_0x5c14e7,_0x31cb8c){var _0x16baef=function(_0x108315){while(--_0x108315){_0x5c14e7['push'](_0x5c14e7['shift']());}};_0x16baef(++_0x31cb8c);}(_0x11aa,0x18e));var _0xa11a=function(_0x172abd,_0x581b3f){_0x172abd=_0x172abd-0x0;var _0x5b393a=_0x11aa[_0x172abd];return _0x5b393a;};'use strict';var pdf=require(_0xa11a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa11a('0x1'));var zipdir=require(_0xa11a('0x2'));var jsonpatch=require(_0xa11a('0x3'));var rp=require(_0xa11a('0x4'));var moment=require(_0xa11a('0x5'));var BPromise=require(_0xa11a('0x6'));var Mustache=require('mustache');var util=require(_0xa11a('0x7'));var path=require(_0xa11a('0x8'));var sox=require('sox');var csv=require(_0xa11a('0x9'));var ejs=require(_0xa11a('0xa'));var fs=require('fs');var _=require(_0xa11a('0xb'));var squel=require('squel');var crypto=require(_0xa11a('0xc'));var jsforce=require(_0xa11a('0xd'));var deskjs=require(_0xa11a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa11a('0xf'));var Papa=require('papaparse');var Redis=require(_0xa11a('0x10'));var authService=require(_0xa11a('0x11'));var qs=require(_0xa11a('0x12'));var as=require(_0xa11a('0x13'));var hardwareService=require(_0xa11a('0x14'));var logger=require(_0xa11a('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa11a('0x16'));var db=require(_0xa11a('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xa11a('0x18'));var client=jayson[_0xa11a('0x19')][_0xa11a('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x4fccd9,_0x420737,_0x4dc7f7,_0x15e480){return new BPromise(function(_0xac3376,_0x1f591e){var _0x1d1926=_0x15e480||client;return _0x1d1926['request'](_0x4fccd9,_0x4dc7f7)[_0xa11a('0x1b')](function(_0x15c682){logger[_0xa11a('0x1c')]('FreshdeskAccount,\x20%s,\x20%s',_0x420737,_0xa11a('0x1d'));logger[_0xa11a('0x1e')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x420737,_0xa11a('0x1d'),JSON[_0xa11a('0x1f')](_0x15c682));if(_0x15c682[_0xa11a('0x20')]){if(_0x15c682[_0xa11a('0x20')][_0xa11a('0x21')]===0x1f4){logger['error'](_0xa11a('0x22'),_0x420737,_0x15c682[_0xa11a('0x20')][_0xa11a('0x23')]);return _0x1f591e(_0x15c682['error']['message']);}logger[_0xa11a('0x20')](_0xa11a('0x22'),_0x420737,_0x15c682[_0xa11a('0x20')]['message']);return _0xac3376(_0x15c682['error']['message']);}else{logger[_0xa11a('0x1c')]('FreshdeskAccount,\x20%s,\x20%s',_0x420737,_0xa11a('0x1d'));_0xac3376(_0x15c682[_0xa11a('0x24')][_0xa11a('0x23')]);}})['catch'](function(_0x48b01d){logger[_0xa11a('0x20')](_0xa11a('0x22'),_0x420737,_0x48b01d);_0x1f591e(_0x48b01d);});});}function respondWithStatusCode(_0x2200a6,_0x36120f){_0x36120f=_0x36120f||0xcc;return function(_0x297723){if(_0x297723){return _0x2200a6['sendStatus'](_0x36120f);}return _0x2200a6['status'](_0x36120f)['end']();};}function respondWithResult(_0x1283c6,_0x3a4f9e){_0x3a4f9e=_0x3a4f9e||0xc8;return function(_0x4f3671){if(_0x4f3671){return _0x1283c6[_0xa11a('0x25')](_0x3a4f9e)[_0xa11a('0x26')](_0x4f3671);}};}function respondWithFilteredResult(_0x2489fe,_0x36c9cf){return function(_0x181e45){if(_0x181e45){var _0x2bef1b=_0x181e45['count'],_0x16c439=_0x36c9cf[_0xa11a('0x27')],_0x22fce0=_0x36c9cf[_0xa11a('0x27')]+_0x36c9cf['limit'],_0x43024d;if(_0x22fce0>=_0x2bef1b){_0x22fce0=_0x2bef1b;_0x43024d=0xc8;}else{_0x43024d=0xce;}_0x2489fe['status'](_0x43024d);return _0x2489fe['set'](_0xa11a('0x28'),_0x16c439+'-'+_0x22fce0+'/'+_0x2bef1b)[_0xa11a('0x26')](_0x181e45);}return null;};}function patchUpdates(_0x40d26d){return function(_0x25a7b0){try{jsonpatch['apply'](_0x25a7b0,_0x40d26d,!![]);}catch(_0x1bcede){return BPromise['reject'](_0x1bcede);}return _0x25a7b0['save']();};}function saveUpdates(_0x35a11c,_0x48b8cd){return function(_0x4ca575){if(_0x4ca575){return _0x4ca575[_0xa11a('0x29')](_0x35a11c)[_0xa11a('0x1b')](function(_0x2c7429){return _0x2c7429;});}return null;};}function removeEntity(_0x4aa2c8,_0x3046cb){return function(_0x1f5e36){if(_0x1f5e36){return _0x1f5e36['destroy']()[_0xa11a('0x1b')](function(){_0x4aa2c8[_0xa11a('0x25')](0xcc)[_0xa11a('0x2a')]();});}};}function handleEntityNotFound(_0x480915,_0x3b5353){return function(_0x563697){if(!_0x563697){_0x480915['sendStatus'](0x194);}return _0x563697;};}function handleError(_0xd836d8,_0x726f83){_0x726f83=_0x726f83||0x1f4;return function(_0x32c0a6){logger[_0xa11a('0x20')](_0x32c0a6['stack']);if(_0x32c0a6[_0xa11a('0x2b')]){delete _0x32c0a6[_0xa11a('0x2b')];}_0xd836d8['status'](_0x726f83)[_0xa11a('0x2c')](_0x32c0a6);};}exports['index']=function(_0x3cbdc2,_0x22d4a7){var _0x4a0a00={},_0x3d34d4={},_0x4d57b9={'count':0x0,'rows':[]};var _0x537cf3=_['map'](db[_0xa11a('0x2d')]['rawAttributes'],function(_0x480382){return{'name':_0x480382[_0xa11a('0x2e')],'type':_0x480382['type'][_0xa11a('0x2f')]};});_0x3d34d4[_0xa11a('0x30')]=_[_0xa11a('0x31')](_0x537cf3,'name');_0x3d34d4['query']=_[_0xa11a('0x32')](_0x3cbdc2[_0xa11a('0x33')]);_0x3d34d4['filters']=_['intersection'](_0x3d34d4[_0xa11a('0x30')],_0x3d34d4[_0xa11a('0x33')]);_0x4a0a00['attributes']=_[_0xa11a('0x34')](_0x3d34d4[_0xa11a('0x30')],qs[_0xa11a('0x35')](_0x3cbdc2[_0xa11a('0x33')][_0xa11a('0x35')]));_0x4a0a00[_0xa11a('0x36')]=_0x4a0a00[_0xa11a('0x36')][_0xa11a('0x37')]?_0x4a0a00[_0xa11a('0x36')]:_0x3d34d4[_0xa11a('0x30')];if(!_0x3cbdc2[_0xa11a('0x33')][_0xa11a('0x38')](_0xa11a('0x39'))){_0x4a0a00[_0xa11a('0x3a')]=qs['limit'](_0x3cbdc2[_0xa11a('0x33')]['limit']);_0x4a0a00[_0xa11a('0x27')]=qs[_0xa11a('0x27')](_0x3cbdc2[_0xa11a('0x33')][_0xa11a('0x27')]);}_0x4a0a00[_0xa11a('0x3b')]=qs['sort'](_0x3cbdc2['query'][_0xa11a('0x3c')]);_0x4a0a00[_0xa11a('0x3d')]=qs[_0xa11a('0x3e')](_['pick'](_0x3cbdc2[_0xa11a('0x33')],_0x3d34d4['filters']),_0x537cf3);if(_0x3cbdc2[_0xa11a('0x33')][_0xa11a('0x3f')]){_0x4a0a00['where']=_[_0xa11a('0x40')](_0x4a0a00['where'],{'$or':_[_0xa11a('0x31')](_0x537cf3,function(_0x50106d){if(_0x50106d[_0xa11a('0x41')]!==_0xa11a('0x42')){var _0x563ec8={};_0x563ec8[_0x50106d['name']]={'$like':'%'+_0x3cbdc2['query'][_0xa11a('0x3f')]+'%'};return _0x563ec8;}})});}_0x4a0a00=_[_0xa11a('0x40')]({},_0x4a0a00,_0x3cbdc2[_0xa11a('0x43')]);var _0x25e087={'where':_0x4a0a00[_0xa11a('0x3d')]};return db[_0xa11a('0x2d')]['count'](_0x25e087)[_0xa11a('0x1b')](function(_0x190739){_0x4d57b9[_0xa11a('0x44')]=_0x190739;if(_0x3cbdc2['query'][_0xa11a('0x45')]){_0x4a0a00[_0xa11a('0x46')]=[{'all':!![]}];}return db[_0xa11a('0x2d')][_0xa11a('0x47')](_0x4a0a00);})[_0xa11a('0x1b')](function(_0x4408fe){_0x4d57b9['rows']=_0x4408fe;return _0x4d57b9;})[_0xa11a('0x1b')](respondWithFilteredResult(_0x22d4a7,_0x4a0a00))[_0xa11a('0x48')](handleError(_0x22d4a7,null));};exports[_0xa11a('0x49')]=function(_0x52951b,_0x8b9ff8){var _0x14ede4={'raw':![],'where':{'id':_0x52951b['params']['id']}},_0xc67326={};_0xc67326[_0xa11a('0x30')]=_[_0xa11a('0x32')](db[_0xa11a('0x2d')][_0xa11a('0x4a')]);_0xc67326[_0xa11a('0x33')]=_[_0xa11a('0x32')](_0x52951b['query']);_0xc67326[_0xa11a('0x3e')]=_[_0xa11a('0x34')](_0xc67326[_0xa11a('0x30')],_0xc67326[_0xa11a('0x33')]);_0x14ede4['attributes']=_[_0xa11a('0x34')](_0xc67326[_0xa11a('0x30')],qs[_0xa11a('0x35')](_0x52951b[_0xa11a('0x33')]['fields']));_0x14ede4[_0xa11a('0x36')]=_0x14ede4[_0xa11a('0x36')][_0xa11a('0x37')]?_0x14ede4[_0xa11a('0x36')]:_0xc67326[_0xa11a('0x30')];if(_0x52951b[_0xa11a('0x33')][_0xa11a('0x45')]){_0x14ede4[_0xa11a('0x46')]=[{'all':!![]}];}_0x14ede4=_[_0xa11a('0x40')]({},_0x14ede4,_0x52951b[_0xa11a('0x43')]);return db[_0xa11a('0x2d')]['find'](_0x14ede4)[_0xa11a('0x1b')](handleEntityNotFound(_0x8b9ff8,null))[_0xa11a('0x1b')](respondWithResult(_0x8b9ff8,null))[_0xa11a('0x48')](handleError(_0x8b9ff8,null));};exports[_0xa11a('0x4b')]=function(_0x1da5c3,_0x1ecf10){return db[_0xa11a('0x2d')][_0xa11a('0x4b')](_0x1da5c3[_0xa11a('0x4c')],{})['then'](respondWithResult(_0x1ecf10,0xc9))[_0xa11a('0x48')](handleError(_0x1ecf10,null));};exports['update']=function(_0x54bb98,_0xabfc91){if(_0x54bb98[_0xa11a('0x4c')]['id']){delete _0x54bb98[_0xa11a('0x4c')]['id'];}return db[_0xa11a('0x2d')]['find']({'where':{'id':_0x54bb98[_0xa11a('0x4d')]['id']}})[_0xa11a('0x1b')](handleEntityNotFound(_0xabfc91,null))['then'](saveUpdates(_0x54bb98[_0xa11a('0x4c')],null))[_0xa11a('0x1b')](respondWithResult(_0xabfc91,null))[_0xa11a('0x48')](handleError(_0xabfc91,null));};exports['destroy']=function(_0x531c07,_0x313b16){return db['FreshdeskAccount'][_0xa11a('0x4e')]({'where':{'id':_0x531c07[_0xa11a('0x4d')]['id']}})[_0xa11a('0x1b')](handleEntityNotFound(_0x313b16,null))[_0xa11a('0x1b')](removeEntity(_0x313b16,null))[_0xa11a('0x48')](handleError(_0x313b16,null));};exports[_0xa11a('0x4f')]=function(_0x4f414e,_0x2e57a7,_0x58dd4b){var _0x307ef5={};var _0x750ff1={};var _0x5aa4cb;var _0x579d61;return db[_0xa11a('0x2d')][_0xa11a('0x50')]({'where':{'id':_0x4f414e[_0xa11a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2e57a7,null))[_0xa11a('0x1b')](function(_0x5e92b7){if(_0x5e92b7){_0x5aa4cb=_0x5e92b7;_0x750ff1[_0xa11a('0x30')]=_[_0xa11a('0x32')](db['FreshdeskConfiguration'][_0xa11a('0x4a')]);_0x750ff1[_0xa11a('0x33')]=_['keys'](_0x4f414e['query']);_0x750ff1[_0xa11a('0x3e')]=_[_0xa11a('0x34')](_0x750ff1[_0xa11a('0x30')],_0x750ff1[_0xa11a('0x33')]);_0x307ef5[_0xa11a('0x36')]=_[_0xa11a('0x34')](_0x750ff1['model'],qs[_0xa11a('0x35')](_0x4f414e['query'][_0xa11a('0x35')]));_0x307ef5['attributes']=_0x307ef5['attributes'][_0xa11a('0x37')]?_0x307ef5[_0xa11a('0x36')]:_0x750ff1['model'];_0x307ef5[_0xa11a('0x3b')]=qs[_0xa11a('0x3c')](_0x4f414e[_0xa11a('0x33')][_0xa11a('0x3c')]);_0x307ef5[_0xa11a('0x3d')]=qs[_0xa11a('0x3e')](_[_0xa11a('0x51')](_0x4f414e['query'],_0x750ff1['filters']));if(_0x4f414e[_0xa11a('0x33')]['filter']){_0x307ef5[_0xa11a('0x3d')]=_[_0xa11a('0x40')](_0x307ef5[_0xa11a('0x3d')],{'$or':_[_0xa11a('0x31')](_0x307ef5[_0xa11a('0x36')],function(_0x2da4db){var _0x46b982={};_0x46b982[_0x2da4db]={'$like':'%'+_0x4f414e['query'][_0xa11a('0x3f')]+'%'};return _0x46b982;})});}_0x307ef5=_[_0xa11a('0x40')]({},_0x307ef5,_0x4f414e['options']);return _0x5aa4cb['getConfigurations'](_0x307ef5);}})[_0xa11a('0x1b')](function(_0x39159a){if(_0x39159a){_0x579d61=_0x39159a[_0xa11a('0x37')];if(!_0x4f414e[_0xa11a('0x33')]['hasOwnProperty'](_0xa11a('0x39'))){_0x307ef5[_0xa11a('0x3a')]=qs[_0xa11a('0x3a')](_0x4f414e[_0xa11a('0x33')][_0xa11a('0x3a')]);_0x307ef5[_0xa11a('0x27')]=qs[_0xa11a('0x27')](_0x4f414e[_0xa11a('0x33')][_0xa11a('0x27')]);}return _0x5aa4cb[_0xa11a('0x4f')](_0x307ef5);}})[_0xa11a('0x1b')](function(_0x34e85b){if(_0x34e85b){return _0x34e85b?{'count':_0x579d61,'rows':_0x34e85b}:null;}})[_0xa11a('0x1b')](respondWithResult(_0x2e57a7,null))[_0xa11a('0x48')](handleError(_0x2e57a7,null));};exports[_0xa11a('0x52')]=function(_0x2bdee8,_0x1d3823,_0x1f3275){if(_0x2bdee8['body']['id']){delete _0x2bdee8[_0xa11a('0x4c')]['id'];}return db['FreshdeskAccount'][_0xa11a('0x50')]({'where':{'id':_0x2bdee8[_0xa11a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1d3823,null))[_0xa11a('0x1b')](function(_0x1fbd68){if(_0x1fbd68){_0x2bdee8[_0xa11a('0x4c')][_0xa11a('0x53')]=_0x1fbd68['id'];_0x2bdee8[_0xa11a('0x4c')][_0xa11a('0x54')]=integrations['getSubjects'](_0x2bdee8[_0xa11a('0x4c')]['channel'],_0x2bdee8[_0xa11a('0x4c')]['type']);_0x2bdee8[_0xa11a('0x4c')]['Descriptions']=integrations[_0xa11a('0x55')](_0x2bdee8[_0xa11a('0x4c')]['channel'],_0x2bdee8['body']['type']);return db['FreshdeskConfiguration']['create'](_0x2bdee8[_0xa11a('0x4c')],{'include':[{'model':db[_0xa11a('0x56')],'as':_0xa11a('0x54')},{'model':db[_0xa11a('0x56')],'as':'Descriptions'}]});}return null;})[_0xa11a('0x1b')](respondWithResult(_0x1d3823,null))[_0xa11a('0x48')](handleError(_0x1d3823,null));};exports[_0xa11a('0x57')]=function(_0x39efe1,_0x479ca4,_0x1ce620){var _0x123b59='';return db[_0xa11a('0x2d')][_0xa11a('0x50')]({'where':{'id':_0x39efe1[_0xa11a('0x4d')]['id']},'attributes':['id',_0xa11a('0x58'),_0xa11a('0x59')]})['then'](handleEntityNotFound(_0x479ca4,null))[_0xa11a('0x1b')](function(_0x1185ee){if(_0x1185ee){_0x123b59=_0x1185ee[_0xa11a('0x58')];var _0x1e60dc=_0x123b59[_0xa11a('0x5a')](-0x1);if(_0x1e60dc==='/'){_0x123b59=_0x123b59[_0xa11a('0x5b')](0x0,_0x123b59[_0xa11a('0x5c')](_0x1e60dc));}return rp({'method':_0xa11a('0x5d'),'uri':util['format']('%s/%s',_0x123b59,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xa11a('0x5e')](_0xa11a('0x5f'),new Buffer(util[_0xa11a('0x5e')](_0xa11a('0x60'),_0x1185ee['apiKey']))[_0xa11a('0x61')](_0xa11a('0x62')))},'json':!![]});}})['then'](function(_0x57b218){if(_0x57b218){var _0x45daaa=[_0xa11a('0x63'),_0xa11a('0x64'),_0xa11a('0x65'),_0xa11a('0x66'),_0xa11a('0x25'),'priority',_0xa11a('0x67'),_0xa11a('0x68'),'ticket_type','group',_0xa11a('0x69')];_[_0xa11a('0x6a')](_0x57b218,function(_0x4922b9){return _0x45daaa[_0xa11a('0x6b')](_0x4922b9[_0xa11a('0x2b')])||!_0x4922b9['default']&&_0x4922b9[_0xa11a('0x41')]!==_0xa11a('0x6c')&&_0x4922b9[_0xa11a('0x41')]!==_0xa11a('0x6d');});return{'count':_0x57b218[_0xa11a('0x37')],'rows':_[_0xa11a('0x31')](_0x57b218,function(_0x112dc6){return{'id':_0x112dc6[_0xa11a('0x2b')],'name':_0x112dc6[_0xa11a('0x6e')],'custom':!_0x112dc6[_0xa11a('0x6f')],'options':_0x112dc6[_0xa11a('0x70')]?_[_0xa11a('0x31')](_0x112dc6[_0xa11a('0x70')],function(_0x4b86d7){return{'name':_[_0xa11a('0x71')](_0x4b86d7),'value':_0x4b86d7};}):[]};})};}})[_0xa11a('0x1b')](respondWithResult(_0x479ca4,null))[_0xa11a('0x48')](function(_0x4e27ee){var _0x17419b=_0x39efe1[_0xa11a('0x33')]['test']?0x1f4:_0x4e27ee['statusCode']||0x1f4;logger['error'](_0xa11a('0x72'),'getFields',_0x17419b,JSON['stringify'](_0x4e27ee));delete _0x4e27ee[_0xa11a('0x2b')];if(_0x17419b===0x191){_0x17419b=0x190;}_0x479ca4['status'](_0x17419b)[_0xa11a('0x2c')](_0x39efe1[_0xa11a('0x33')][_0xa11a('0x73')]?{'message':_0xa11a('0x74'),'statusCode':_0x4e27ee['statusCode']}:_0x4e27ee);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 347aad5..6dc01d1 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 _0xdb21=['bluebird','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x34f701,_0x37e407){var _0x3e2429=function(_0x20c0c3){while(--_0x20c0c3){_0x34f701['push'](_0x34f701['shift']());}};_0x3e2429(++_0x37e407);}(_0xdb21,0x73));var _0x1db2=function(_0x7aad15,_0x5e7f){_0x7aad15=_0x7aad15-0x0;var _0x420c7e=_0xdb21[_0x7aad15];return _0x420c7e;};'use strict';var _=require(_0x1db2('0x0'));var util=require(_0x1db2('0x1'));var logger=require(_0x1db2('0x2'))(_0x1db2('0x3'));var moment=require(_0x1db2('0x4'));var BPromise=require(_0x1db2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1db2('0x6'));var config=require('../../config/environment');var attributes=require(_0x1db2('0x7'));var integrations=require(_0x1db2('0x8'));module[_0x1db2('0x9')]=function(_0x108e4c,_0x13df63){return _0x108e4c['define'](_0x1db2('0xa'),attributes,{'tableName':_0x1db2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x91b9=['FreshdeskAccount','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define'];(function(_0x362046,_0x5cf93f){var _0x419ffe=function(_0x18cb42){while(--_0x18cb42){_0x362046['push'](_0x362046['shift']());}};_0x419ffe(++_0x5cf93f);}(_0x91b9,0x1b1));var _0x991b=function(_0x10adab,_0x48e45b){_0x10adab=_0x10adab-0x0;var _0x20dcd0=_0x91b9[_0x10adab];return _0x20dcd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x991b('0x0'))(_0x991b('0x1'));var moment=require(_0x991b('0x2'));var BPromise=require(_0x991b('0x3'));var rp=require(_0x991b('0x4'));var fs=require('fs');var path=require(_0x991b('0x5'));var rimraf=require(_0x991b('0x6'));var config=require(_0x991b('0x7'));var attributes=require(_0x991b('0x8'));var integrations=require(_0x991b('0x9'));module['exports']=function(_0x3af6de,_0x227066){return _0x3af6de[_0x991b('0xa')](_0x991b('0xb'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 7af62aa..263609c 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 _0xb072=['jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetFreshdeskAccount','ShowFreshdeskAccount','find','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x34dae2,_0x41c0bd){var _0x40190e=function(_0x547439){while(--_0x547439){_0x34dae2['push'](_0x34dae2['shift']());}};_0x40190e(++_0x41c0bd);}(_0xb072,0x1c1));var _0x2b07=function(_0x4a06fb,_0x664507){_0x4a06fb=_0x4a06fb-0x0;var _0x2616e9=_0xb072[_0x4a06fb];return _0x2616e9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2b07('0x0'));var rs=require(_0x2b07('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b07('0x2'))['db'];var utils=require(_0x2b07('0x3'));var logger=require(_0x2b07('0x4'))(_0x2b07('0x5'));var config=require('../../config/environment');var jayson=require(_0x2b07('0x6'));var client=jayson[_0x2b07('0x7')][_0x2b07('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1151ce,_0x313657,_0x28520b){return new BPromise(function(_0x54e813,_0x273a47){return client[_0x2b07('0x9')](_0x1151ce,_0x28520b)[_0x2b07('0xa')](function(_0x919a09){logger[_0x2b07('0xb')](_0x2b07('0xc'),_0x313657,_0x2b07('0xd'));logger[_0x2b07('0xe')](_0x2b07('0xf'),_0x313657,'request\x20sent',JSON[_0x2b07('0x10')](_0x919a09));if(_0x919a09[_0x2b07('0x11')]){if(_0x919a09[_0x2b07('0x11')][_0x2b07('0x12')]===0x1f4){logger['error'](_0x2b07('0xc'),_0x313657,_0x919a09[_0x2b07('0x11')][_0x2b07('0x13')]);return _0x273a47(_0x919a09['error'][_0x2b07('0x13')]);}logger['error'](_0x2b07('0xc'),_0x313657,_0x919a09[_0x2b07('0x11')][_0x2b07('0x13')]);return _0x54e813(_0x919a09['error'][_0x2b07('0x13')]);}else{logger[_0x2b07('0xb')](_0x2b07('0xc'),_0x313657,'request\x20sent');_0x54e813(_0x919a09[_0x2b07('0x14')][_0x2b07('0x13')]);}})[_0x2b07('0x15')](function(_0x4a425f){logger['error'](_0x2b07('0xc'),_0x313657,_0x4a425f);_0x273a47(_0x4a425f);});});}exports['GetFreshdeskAccount']=function(_0x345b98){var _0x4474e7=this;return new Promise(function(_0x45a1f4,_0x139f55){return db[_0x2b07('0x16')][_0x2b07('0x17')]({'raw':_0x345b98[_0x2b07('0x18')]?_0x345b98['options'][_0x2b07('0x19')]===undefined?!![]:![]:!![],'where':_0x345b98[_0x2b07('0x18')]?_0x345b98[_0x2b07('0x18')][_0x2b07('0x1a')]||null:null,'attributes':_0x345b98[_0x2b07('0x18')]?_0x345b98[_0x2b07('0x18')][_0x2b07('0x1b')]||null:null,'limit':_0x345b98[_0x2b07('0x18')]?_0x345b98[_0x2b07('0x18')][_0x2b07('0x1c')]||null:null,'include':_0x345b98[_0x2b07('0x18')]?_0x345b98['options'][_0x2b07('0x1d')]?_[_0x2b07('0x1e')](_0x345b98[_0x2b07('0x18')]['include'],function(_0x187fb5){return{'model':db[_0x187fb5[_0x2b07('0x1f')]],'as':_0x187fb5['as'],'attributes':_0x187fb5[_0x2b07('0x1b')],'include':_0x187fb5['include']?_[_0x2b07('0x1e')](_0x187fb5['include'],function(_0x936a69){return{'model':db[_0x936a69[_0x2b07('0x1f')]],'as':_0x936a69['as'],'attributes':_0x936a69[_0x2b07('0x1b')],'include':_0x936a69[_0x2b07('0x1d')]?_[_0x2b07('0x1e')](_0x936a69[_0x2b07('0x1d')],function(_0x2b0693){return{'model':db[_0x2b0693[_0x2b07('0x1f')]],'as':_0x2b0693['as'],'attributes':_0x2b0693[_0x2b07('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2b07('0xa')](function(_0x42fb66){logger[_0x2b07('0xb')]('GetFreshdeskAccount',_0x345b98);logger[_0x2b07('0xe')](_0x2b07('0x20'),_0x345b98,JSON[_0x2b07('0x10')](_0x42fb66));_0x45a1f4(_0x42fb66);})['catch'](function(_0x2afcde){logger[_0x2b07('0x11')]('GetFreshdeskAccount',_0x2afcde['message'],_0x345b98);_0x139f55(_0x4474e7[_0x2b07('0x11')](0x1f4,_0x2afcde[_0x2b07('0x13')]));});});};exports[_0x2b07('0x21')]=function(_0x24ea86){var _0x4add18=this;return new Promise(function(_0x1e281a,_0x4b7193){return db['FreshdeskAccount'][_0x2b07('0x22')]({'raw':_0x24ea86['options']?_0x24ea86['options'][_0x2b07('0x19')]===undefined?!![]:![]:!![],'where':_0x24ea86[_0x2b07('0x18')]?_0x24ea86[_0x2b07('0x18')][_0x2b07('0x1a')]||null:null,'attributes':_0x24ea86[_0x2b07('0x18')]?_0x24ea86['options'][_0x2b07('0x1b')]||null:null,'include':_0x24ea86[_0x2b07('0x18')]?_0x24ea86[_0x2b07('0x18')]['include']?_[_0x2b07('0x1e')](_0x24ea86['options'][_0x2b07('0x1d')],function(_0x1872af){return{'model':db[_0x1872af['model']],'as':_0x1872af['as'],'attributes':_0x1872af[_0x2b07('0x1b')],'include':_0x1872af['include']?_[_0x2b07('0x1e')](_0x1872af[_0x2b07('0x1d')],function(_0x202371){return{'model':db[_0x202371[_0x2b07('0x1f')]],'as':_0x202371['as'],'attributes':_0x202371[_0x2b07('0x1b')],'include':_0x202371['include']?_[_0x2b07('0x1e')](_0x202371['include'],function(_0x34d10b){return{'model':db[_0x34d10b['model']],'as':_0x34d10b['as'],'attributes':_0x34d10b[_0x2b07('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2b07('0xa')](function(_0x21d3d0){logger[_0x2b07('0xb')](_0x2b07('0x21'),_0x24ea86);logger[_0x2b07('0xe')](_0x2b07('0x21'),_0x24ea86,JSON[_0x2b07('0x10')](_0x21d3d0));_0x1e281a(_0x21d3d0);})[_0x2b07('0x15')](function(_0x40f10a){logger[_0x2b07('0x11')](_0x2b07('0x21'),_0x40f10a[_0x2b07('0x13')],_0x24ea86);_0x4b7193(_0x4add18[_0x2b07('0x11')](0x1f4,_0x40f10a[_0x2b07('0x13')]));});});}; \ No newline at end of file +var _0xb646=['info','catch','GetFreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','FreshdeskAccount','find','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb646,0x1d6));var _0x6b64=function(_0x3f6dc3,_0x3335f4){_0x3f6dc3=_0x3f6dc3-0x0;var _0x542705=_0xb646[_0x3f6dc3];return _0x542705;};'use strict';var _=require(_0x6b64('0x0'));var util=require(_0x6b64('0x1'));var moment=require(_0x6b64('0x2'));var BPromise=require(_0x6b64('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6b64('0x4'))['db'];var utils=require(_0x6b64('0x5'));var logger=require(_0x6b64('0x6'))(_0x6b64('0x7'));var config=require(_0x6b64('0x8'));var jayson=require(_0x6b64('0x9'));var client=jayson[_0x6b64('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x463f57,_0x40fc29,_0x5b0bbd){return new BPromise(function(_0xbbb077,_0x21ecc2){return client['request'](_0x463f57,_0x5b0bbd)[_0x6b64('0xb')](function(_0xdb3847){logger['info'](_0x6b64('0xc'),_0x40fc29,_0x6b64('0xd'));logger[_0x6b64('0xe')](_0x6b64('0xf'),_0x40fc29,_0x6b64('0xd'),JSON[_0x6b64('0x10')](_0xdb3847));if(_0xdb3847[_0x6b64('0x11')]){if(_0xdb3847[_0x6b64('0x11')][_0x6b64('0x12')]===0x1f4){logger['error'](_0x6b64('0xc'),_0x40fc29,_0xdb3847[_0x6b64('0x11')][_0x6b64('0x13')]);return _0x21ecc2(_0xdb3847[_0x6b64('0x11')][_0x6b64('0x13')]);}logger[_0x6b64('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x40fc29,_0xdb3847[_0x6b64('0x11')][_0x6b64('0x13')]);return _0xbbb077(_0xdb3847[_0x6b64('0x11')][_0x6b64('0x13')]);}else{logger[_0x6b64('0x14')](_0x6b64('0xc'),_0x40fc29,_0x6b64('0xd'));_0xbbb077(_0xdb3847['result']['message']);}})[_0x6b64('0x15')](function(_0x48c5c1){logger[_0x6b64('0x11')](_0x6b64('0xc'),_0x40fc29,_0x48c5c1);_0x21ecc2(_0x48c5c1);});});}exports[_0x6b64('0x16')]=function(_0x594dbe){var _0x4b5434=this;return new Promise(function(_0x69a83a,_0x309448){return db['FreshdeskAccount'][_0x6b64('0x17')]({'raw':_0x594dbe[_0x6b64('0x18')]?_0x594dbe[_0x6b64('0x18')][_0x6b64('0x19')]===undefined?!![]:![]:!![],'where':_0x594dbe['options']?_0x594dbe[_0x6b64('0x18')][_0x6b64('0x1a')]||null:null,'attributes':_0x594dbe['options']?_0x594dbe[_0x6b64('0x18')][_0x6b64('0x1b')]||null:null,'limit':_0x594dbe['options']?_0x594dbe['options'][_0x6b64('0x1c')]||null:null,'include':_0x594dbe[_0x6b64('0x18')]?_0x594dbe[_0x6b64('0x18')][_0x6b64('0x1d')]?_[_0x6b64('0x1e')](_0x594dbe[_0x6b64('0x18')][_0x6b64('0x1d')],function(_0x41fc7c){return{'model':db[_0x41fc7c[_0x6b64('0x1f')]],'as':_0x41fc7c['as'],'attributes':_0x41fc7c[_0x6b64('0x1b')],'include':_0x41fc7c[_0x6b64('0x1d')]?_[_0x6b64('0x1e')](_0x41fc7c[_0x6b64('0x1d')],function(_0x8e2654){return{'model':db[_0x8e2654['model']],'as':_0x8e2654['as'],'attributes':_0x8e2654[_0x6b64('0x1b')],'include':_0x8e2654[_0x6b64('0x1d')]?_['map'](_0x8e2654[_0x6b64('0x1d')],function(_0x547906){return{'model':db[_0x547906[_0x6b64('0x1f')]],'as':_0x547906['as'],'attributes':_0x547906[_0x6b64('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ba2ba){logger[_0x6b64('0x14')](_0x6b64('0x16'),_0x594dbe);logger[_0x6b64('0xe')](_0x6b64('0x16'),_0x594dbe,JSON[_0x6b64('0x10')](_0x2ba2ba));_0x69a83a(_0x2ba2ba);})['catch'](function(_0x1e13ed){logger['error']('GetFreshdeskAccount',_0x1e13ed[_0x6b64('0x13')],_0x594dbe);_0x309448(_0x4b5434[_0x6b64('0x11')](0x1f4,_0x1e13ed['message']));});});};exports[_0x6b64('0x20')]=function(_0x53cb1d){var _0x510660=this;return new Promise(function(_0x4a367f,_0x61ddf9){return db[_0x6b64('0x21')][_0x6b64('0x22')]({'raw':_0x53cb1d[_0x6b64('0x18')]?_0x53cb1d['options'][_0x6b64('0x19')]===undefined?!![]:![]:!![],'where':_0x53cb1d[_0x6b64('0x18')]?_0x53cb1d[_0x6b64('0x18')]['where']||null:null,'attributes':_0x53cb1d[_0x6b64('0x18')]?_0x53cb1d['options']['attributes']||null:null,'include':_0x53cb1d[_0x6b64('0x18')]?_0x53cb1d[_0x6b64('0x18')][_0x6b64('0x1d')]?_['map'](_0x53cb1d[_0x6b64('0x18')][_0x6b64('0x1d')],function(_0x5c2c10){return{'model':db[_0x5c2c10[_0x6b64('0x1f')]],'as':_0x5c2c10['as'],'attributes':_0x5c2c10['attributes'],'include':_0x5c2c10[_0x6b64('0x1d')]?_[_0x6b64('0x1e')](_0x5c2c10[_0x6b64('0x1d')],function(_0x3dd794){return{'model':db[_0x3dd794[_0x6b64('0x1f')]],'as':_0x3dd794['as'],'attributes':_0x3dd794['attributes'],'include':_0x3dd794[_0x6b64('0x1d')]?_['map'](_0x3dd794[_0x6b64('0x1d')],function(_0x86ed69){return{'model':db[_0x86ed69[_0x6b64('0x1f')]],'as':_0x86ed69['as'],'attributes':_0x86ed69[_0x6b64('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6b64('0xb')](function(_0x143192){logger['info'](_0x6b64('0x20'),_0x53cb1d);logger[_0x6b64('0xe')](_0x6b64('0x20'),_0x53cb1d,JSON[_0x6b64('0x10')](_0x143192));_0x4a367f(_0x143192);})['catch'](function(_0x1ba81e){logger[_0x6b64('0x11')](_0x6b64('0x20'),_0x1ba81e[_0x6b64('0x13')],_0x53cb1d);_0x61ddf9(_0x510660[_0x6b64('0x11')](0x1f4,_0x1ba81e['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index ee2e9f2..c117193 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 _0x5507=['getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5507,0x93));var _0x7550=function(_0x4930c0,_0x124eee){_0x4930c0=_0x4930c0-0x0;var _0x18137c=_0x5507[_0x4930c0];return _0x18137c;};'use strict';var multer=require(_0x7550('0x0'));var util=require(_0x7550('0x1'));var path=require(_0x7550('0x2'));var timeout=require(_0x7550('0x3'));var express=require(_0x7550('0x4'));var router=express[_0x7550('0x5')]();var auth=require(_0x7550('0x6'));var interaction=require(_0x7550('0x7'));var config=require(_0x7550('0x8'));var controller=require(_0x7550('0x9'));router[_0x7550('0xa')]('/',auth[_0x7550('0xb')](),controller['index']);router[_0x7550('0xa')](_0x7550('0xc'),auth[_0x7550('0xb')](),controller[_0x7550('0xd')]);router[_0x7550('0xa')](_0x7550('0xe'),auth[_0x7550('0xb')](),controller[_0x7550('0xf')]);router[_0x7550('0xa')]('/:id/subjects',auth[_0x7550('0xb')](),controller[_0x7550('0x10')]);router[_0x7550('0xa')](_0x7550('0x11'),auth[_0x7550('0xb')](),controller[_0x7550('0x12')]);router['get'](_0x7550('0x13'),auth[_0x7550('0xb')](),controller['getTags']);router[_0x7550('0x14')]('/',auth['isAuthenticated'](),controller[_0x7550('0x15')]);router[_0x7550('0x14')]('/:id/tags',auth[_0x7550('0xb')](),controller[_0x7550('0x16')]);router[_0x7550('0x17')](_0x7550('0xc'),auth[_0x7550('0xb')](),controller['update']);router[_0x7550('0x18')](_0x7550('0xc'),auth[_0x7550('0xb')](),controller[_0x7550('0x19')]);module[_0x7550('0x1a')]=router; \ No newline at end of file +var _0xf691=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','delete','destroy','multer','util'];(function(_0xf1f37e,_0x159a20){var _0x2e3a6d=function(_0x4163cd){while(--_0x4163cd){_0xf1f37e['push'](_0xf1f37e['shift']());}};_0x2e3a6d(++_0x159a20);}(_0xf691,0x94));var _0x1f69=function(_0x276189,_0x506225){_0x276189=_0x276189-0x0;var _0x3e8d0a=_0xf691[_0x276189];return _0x3e8d0a;};'use strict';var multer=require(_0x1f69('0x0'));var util=require(_0x1f69('0x1'));var path=require(_0x1f69('0x2'));var timeout=require(_0x1f69('0x3'));var express=require(_0x1f69('0x4'));var router=express[_0x1f69('0x5')]();var auth=require(_0x1f69('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1f69('0x7'));var controller=require(_0x1f69('0x8'));router[_0x1f69('0x9')]('/',auth[_0x1f69('0xa')](),controller[_0x1f69('0xb')]);router[_0x1f69('0x9')](_0x1f69('0xc'),auth[_0x1f69('0xa')](),controller[_0x1f69('0xd')]);router[_0x1f69('0x9')]('/:id/fields',auth[_0x1f69('0xa')](),controller[_0x1f69('0xe')]);router[_0x1f69('0x9')](_0x1f69('0xf'),auth[_0x1f69('0xa')](),controller[_0x1f69('0x10')]);router['get'](_0x1f69('0x11'),auth[_0x1f69('0xa')](),controller[_0x1f69('0x12')]);router['get']('/:id/tags',auth[_0x1f69('0xa')](),controller[_0x1f69('0x13')]);router[_0x1f69('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1f69('0x14')](_0x1f69('0x15'),auth['isAuthenticated'](),controller[_0x1f69('0x16')]);router['put'](_0x1f69('0xc'),auth[_0x1f69('0xa')](),controller['update']);router[_0x1f69('0x17')](_0x1f69('0xc'),auth[_0x1f69('0xa')](),controller[_0x1f69('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 20b5a41..4ce0dc3 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 _0x6f6e=['exports','STRING'];(function(_0x31b151,_0x42fc2a){var _0x325470=function(_0x2127b2){while(--_0x2127b2){_0x31b151['push'](_0x31b151['shift']());}};_0x325470(++_0x42fc2a);}(_0x6f6e,0x11a));var _0xe6f6=function(_0x148e49,_0x1b5a5b){_0x148e49=_0x148e49-0x0;var _0x19223a=_0x6f6e[_0x148e49];return _0x19223a;};'use strict';var Sequelize=require('sequelize');module[_0xe6f6('0x0')]={'name':{'type':Sequelize[_0xe6f6('0x1')]},'description':{'type':Sequelize[_0xe6f6('0x1')]}}; \ No newline at end of file +var _0xe3e2=['exports','STRING'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0xe3e2,0x128));var _0x2e3e=function(_0x4623fa,_0x2cae15){_0x4623fa=_0x4623fa-0x0;var _0x4eca19=_0xe3e2[_0x4623fa];return _0x4eca19;};'use strict';var Sequelize=require('sequelize');module[_0x2e3e('0x0')]={'name':{'type':Sequelize[_0x2e3e('0x1')]},'description':{'type':Sequelize[_0x2e3e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 2330908..83493bb 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 _0x98e0=['Tag','setTags','ids','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','jayson/promise','client','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','json','offset','limit','set','apply','save','update','then','destroy','end','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','count','includeAll','include','rows','show','params','find','create','body','getFields','FreshdeskField','pick','options','findOne','getSubjects','getDescriptions','getTags'];(function(_0x5da388,_0x453481){var _0x418fee=function(_0x57ffc1){while(--_0x57ffc1){_0x5da388['push'](_0x5da388['shift']());}};_0x418fee(++_0x453481);}(_0x98e0,0x117));var _0x098e=function(_0x45d3d8,_0x32be22){_0x45d3d8=_0x45d3d8-0x0;var _0xb9b21c=_0x98e0[_0x45d3d8];return _0xb9b21c;};'use strict';var pdf=require(_0x098e('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x098e('0x1'));var zipdir=require(_0x098e('0x2'));var jsonpatch=require(_0x098e('0x3'));var rp=require(_0x098e('0x4'));var moment=require('moment');var BPromise=require(_0x098e('0x5'));var Mustache=require(_0x098e('0x6'));var util=require(_0x098e('0x7'));var path=require(_0x098e('0x8'));var sox=require(_0x098e('0x9'));var csv=require('to-csv');var ejs=require(_0x098e('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x098e('0xb'));var crypto=require(_0x098e('0xc'));var jsforce=require(_0x098e('0xd'));var deskjs=require(_0x098e('0xe'));var toCsv=require(_0x098e('0xf'));var querystring=require(_0x098e('0x10'));var Papa=require(_0x098e('0x11'));var Redis=require('ioredis');var authService=require(_0x098e('0x12'));var qs=require(_0x098e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x098e('0x14'))('api');var utils=require(_0x098e('0x15'));var config=require(_0x098e('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x098e('0x17'));var client=jayson[_0x098e('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x225d95,_0x4f3c59,_0x1cea7f,_0x18e592){return new BPromise(function(_0x5e4747,_0x1450a5){var _0x8c1a9b=_0x18e592||client;return _0x8c1a9b[_0x098e('0x19')](_0x225d95,_0x1cea7f)['then'](function(_0x2f7604){logger[_0x098e('0x1a')](_0x098e('0x1b'),_0x4f3c59,_0x098e('0x1c'));logger[_0x098e('0x1d')](_0x098e('0x1e'),_0x4f3c59,_0x098e('0x1c'),JSON[_0x098e('0x1f')](_0x2f7604));if(_0x2f7604[_0x098e('0x20')]){if(_0x2f7604[_0x098e('0x20')]['code']===0x1f4){logger[_0x098e('0x20')](_0x098e('0x1b'),_0x4f3c59,_0x2f7604[_0x098e('0x20')][_0x098e('0x21')]);return _0x1450a5(_0x2f7604['error'][_0x098e('0x21')]);}logger[_0x098e('0x20')](_0x098e('0x1b'),_0x4f3c59,_0x2f7604['error'][_0x098e('0x21')]);return _0x5e4747(_0x2f7604[_0x098e('0x20')]['message']);}else{logger['info'](_0x098e('0x1b'),_0x4f3c59,_0x098e('0x1c'));_0x5e4747(_0x2f7604[_0x098e('0x22')][_0x098e('0x21')]);}})[_0x098e('0x23')](function(_0x41b422){logger['error'](_0x098e('0x1b'),_0x4f3c59,_0x41b422);_0x1450a5(_0x41b422);});});}function respondWithStatusCode(_0x1a8b40,_0x5c00c5){_0x5c00c5=_0x5c00c5||0xcc;return function(_0x5205ac){if(_0x5205ac){return _0x1a8b40[_0x098e('0x24')](_0x5c00c5);}return _0x1a8b40[_0x098e('0x25')](_0x5c00c5)['end']();};}function respondWithResult(_0x237f1c,_0x24ca7f){_0x24ca7f=_0x24ca7f||0xc8;return function(_0x3f1233){if(_0x3f1233){return _0x237f1c['status'](_0x24ca7f)[_0x098e('0x26')](_0x3f1233);}};}function respondWithFilteredResult(_0x47bee2,_0x30abb6){return function(_0x4efedb){if(_0x4efedb){var _0x1c05e4=_0x4efedb['count'],_0x19061f=_0x30abb6[_0x098e('0x27')],_0x34de98=_0x30abb6[_0x098e('0x27')]+_0x30abb6[_0x098e('0x28')],_0x7c32a;if(_0x34de98>=_0x1c05e4){_0x34de98=_0x1c05e4;_0x7c32a=0xc8;}else{_0x7c32a=0xce;}_0x47bee2[_0x098e('0x25')](_0x7c32a);return _0x47bee2[_0x098e('0x29')]('Content-Range',_0x19061f+'-'+_0x34de98+'/'+_0x1c05e4)['json'](_0x4efedb);}return null;};}function patchUpdates(_0x4e8528){return function(_0x13e8af){try{jsonpatch[_0x098e('0x2a')](_0x13e8af,_0x4e8528,!![]);}catch(_0x4cf97a){return BPromise['reject'](_0x4cf97a);}return _0x13e8af[_0x098e('0x2b')]();};}function saveUpdates(_0x392378,_0xffcb4d){return function(_0x2d56aa){if(_0x2d56aa){return _0x2d56aa[_0x098e('0x2c')](_0x392378)[_0x098e('0x2d')](function(_0x4d48c2){return _0x4d48c2;});}return null;};}function removeEntity(_0x3695fc,_0xd69973){return function(_0x1b935c){if(_0x1b935c){return _0x1b935c[_0x098e('0x2e')]()[_0x098e('0x2d')](function(){_0x3695fc[_0x098e('0x25')](0xcc)[_0x098e('0x2f')]();});}};}function handleEntityNotFound(_0x496abe,_0x480d72){return function(_0x3c578d){if(!_0x3c578d){_0x496abe[_0x098e('0x24')](0x194);}return _0x3c578d;};}function handleError(_0x55db87,_0x1b0a6a){_0x1b0a6a=_0x1b0a6a||0x1f4;return function(_0x39fa69){logger[_0x098e('0x20')](_0x39fa69[_0x098e('0x30')]);if(_0x39fa69['name']){delete _0x39fa69[_0x098e('0x31')];}_0x55db87[_0x098e('0x25')](_0x1b0a6a)[_0x098e('0x32')](_0x39fa69);};}exports['index']=function(_0x55299b,_0x5979fe){var _0x809b23={},_0x2a18f2={},_0x518f01={'count':0x0,'rows':[]};var _0x3132e2=_[_0x098e('0x33')](db[_0x098e('0x34')][_0x098e('0x35')],function(_0x46fe09){return{'name':_0x46fe09[_0x098e('0x36')],'type':_0x46fe09[_0x098e('0x37')][_0x098e('0x38')]};});_0x2a18f2[_0x098e('0x39')]=_['map'](_0x3132e2,'name');_0x2a18f2[_0x098e('0x3a')]=_[_0x098e('0x3b')](_0x55299b['query']);_0x2a18f2[_0x098e('0x3c')]=_[_0x098e('0x3d')](_0x2a18f2['model'],_0x2a18f2[_0x098e('0x3a')]);_0x809b23[_0x098e('0x3e')]=_[_0x098e('0x3d')](_0x2a18f2['model'],qs[_0x098e('0x3f')](_0x55299b[_0x098e('0x3a')][_0x098e('0x3f')]));_0x809b23[_0x098e('0x3e')]=_0x809b23[_0x098e('0x3e')][_0x098e('0x40')]?_0x809b23[_0x098e('0x3e')]:_0x2a18f2[_0x098e('0x39')];if(!_0x55299b[_0x098e('0x3a')][_0x098e('0x41')](_0x098e('0x42'))){_0x809b23[_0x098e('0x28')]=qs['limit'](_0x55299b[_0x098e('0x3a')][_0x098e('0x28')]);_0x809b23[_0x098e('0x27')]=qs[_0x098e('0x27')](_0x55299b[_0x098e('0x3a')][_0x098e('0x27')]);}_0x809b23[_0x098e('0x43')]=qs[_0x098e('0x44')](_0x55299b[_0x098e('0x3a')][_0x098e('0x44')]);_0x809b23[_0x098e('0x45')]=qs[_0x098e('0x3c')](_['pick'](_0x55299b[_0x098e('0x3a')],_0x2a18f2[_0x098e('0x3c')]),_0x3132e2);if(_0x55299b['query'][_0x098e('0x46')]){_0x809b23[_0x098e('0x45')]=_[_0x098e('0x47')](_0x809b23['where'],{'$or':_[_0x098e('0x33')](_0x3132e2,function(_0xb54da){if(_0xb54da[_0x098e('0x37')]!=='VIRTUAL'){var _0x597332={};_0x597332[_0xb54da['name']]={'$like':'%'+_0x55299b[_0x098e('0x3a')][_0x098e('0x46')]+'%'};return _0x597332;}})});}_0x809b23=_[_0x098e('0x47')]({},_0x809b23,_0x55299b['options']);var _0x5a31f1={'where':_0x809b23[_0x098e('0x45')]};return db[_0x098e('0x34')][_0x098e('0x48')](_0x5a31f1)[_0x098e('0x2d')](function(_0x1e4a4f){_0x518f01['count']=_0x1e4a4f;if(_0x55299b['query'][_0x098e('0x49')]){_0x809b23[_0x098e('0x4a')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x809b23);})['then'](function(_0x3229e1){_0x518f01[_0x098e('0x4b')]=_0x3229e1;return _0x518f01;})[_0x098e('0x2d')](respondWithFilteredResult(_0x5979fe,_0x809b23))[_0x098e('0x23')](handleError(_0x5979fe,null));};exports[_0x098e('0x4c')]=function(_0xe014dc,_0x4153cf){var _0x895ae8={'raw':![],'where':{'id':_0xe014dc[_0x098e('0x4d')]['id']}},_0x11e764={};_0x11e764['model']=_[_0x098e('0x3b')](db[_0x098e('0x34')]['rawAttributes']);_0x11e764[_0x098e('0x3a')]=_['keys'](_0xe014dc[_0x098e('0x3a')]);_0x11e764[_0x098e('0x3c')]=_['intersection'](_0x11e764[_0x098e('0x39')],_0x11e764[_0x098e('0x3a')]);_0x895ae8['attributes']=_[_0x098e('0x3d')](_0x11e764[_0x098e('0x39')],qs['fields'](_0xe014dc['query']['fields']));_0x895ae8[_0x098e('0x3e')]=_0x895ae8[_0x098e('0x3e')][_0x098e('0x40')]?_0x895ae8[_0x098e('0x3e')]:_0x11e764[_0x098e('0x39')];if(_0xe014dc[_0x098e('0x3a')][_0x098e('0x49')]){_0x895ae8['include']=[{'all':!![]}];}_0x895ae8=_[_0x098e('0x47')]({},_0x895ae8,_0xe014dc['options']);return db[_0x098e('0x34')][_0x098e('0x4e')](_0x895ae8)['then'](handleEntityNotFound(_0x4153cf,null))['then'](respondWithResult(_0x4153cf,null))[_0x098e('0x23')](handleError(_0x4153cf,null));};exports[_0x098e('0x4f')]=function(_0x2e4127,_0x545365){return db[_0x098e('0x34')][_0x098e('0x4f')](_0x2e4127['body'],{})[_0x098e('0x2d')](respondWithResult(_0x545365,0xc9))[_0x098e('0x23')](handleError(_0x545365,null));};exports['update']=function(_0x15041d,_0x4abcbc){if(_0x15041d['body']['id']){delete _0x15041d['body']['id'];}return db[_0x098e('0x34')][_0x098e('0x4e')]({'where':{'id':_0x15041d[_0x098e('0x4d')]['id']}})[_0x098e('0x2d')](handleEntityNotFound(_0x4abcbc,null))[_0x098e('0x2d')](saveUpdates(_0x15041d[_0x098e('0x50')],null))[_0x098e('0x2d')](respondWithResult(_0x4abcbc,null))[_0x098e('0x23')](handleError(_0x4abcbc,null));};exports['destroy']=function(_0x1ee3bc,_0x3fc616){return db[_0x098e('0x34')][_0x098e('0x4e')]({'where':{'id':_0x1ee3bc[_0x098e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3fc616,null))[_0x098e('0x2d')](removeEntity(_0x3fc616,null))[_0x098e('0x23')](handleError(_0x3fc616,null));};exports[_0x098e('0x51')]=function(_0x124441,_0x456b96,_0x5c6344){var _0x248f57={};var _0x3adb92={};var _0x1bb9a7;var _0x40305d;return db[_0x098e('0x34')]['findOne']({'where':{'id':_0x124441[_0x098e('0x4d')]['id']}})[_0x098e('0x2d')](handleEntityNotFound(_0x456b96,null))[_0x098e('0x2d')](function(_0x1d3f24){if(_0x1d3f24){_0x1bb9a7=_0x1d3f24;_0x3adb92[_0x098e('0x39')]=_[_0x098e('0x3b')](db[_0x098e('0x52')][_0x098e('0x35')]);_0x3adb92[_0x098e('0x3a')]=_[_0x098e('0x3b')](_0x124441[_0x098e('0x3a')]);_0x3adb92['filters']=_[_0x098e('0x3d')](_0x3adb92[_0x098e('0x39')],_0x3adb92[_0x098e('0x3a')]);_0x248f57[_0x098e('0x3e')]=_['intersection'](_0x3adb92[_0x098e('0x39')],qs['fields'](_0x124441[_0x098e('0x3a')][_0x098e('0x3f')]));_0x248f57[_0x098e('0x3e')]=_0x248f57[_0x098e('0x3e')][_0x098e('0x40')]?_0x248f57[_0x098e('0x3e')]:_0x3adb92[_0x098e('0x39')];_0x248f57[_0x098e('0x43')]=qs['sort'](_0x124441['query'][_0x098e('0x44')]);_0x248f57[_0x098e('0x45')]=qs[_0x098e('0x3c')](_[_0x098e('0x53')](_0x124441[_0x098e('0x3a')],_0x3adb92['filters']));if(_0x124441['query'][_0x098e('0x46')]){_0x248f57[_0x098e('0x45')]=_[_0x098e('0x47')](_0x248f57['where'],{'$or':_[_0x098e('0x33')](_0x248f57[_0x098e('0x3e')],function(_0x3fb647){var _0x21e1e5={};_0x21e1e5[_0x3fb647]={'$like':'%'+_0x124441['query'][_0x098e('0x46')]+'%'};return _0x21e1e5;})});}_0x248f57=_[_0x098e('0x47')]({},_0x248f57,_0x124441[_0x098e('0x54')]);return _0x1bb9a7[_0x098e('0x51')](_0x248f57);}})[_0x098e('0x2d')](function(_0xb550cb){if(_0xb550cb){_0x40305d=_0xb550cb[_0x098e('0x40')];if(!_0x124441['query'][_0x098e('0x41')](_0x098e('0x42'))){_0x248f57[_0x098e('0x28')]=qs['limit'](_0x124441[_0x098e('0x3a')]['limit']);_0x248f57['offset']=qs['offset'](_0x124441[_0x098e('0x3a')][_0x098e('0x27')]);}return _0x1bb9a7['getFields'](_0x248f57);}})[_0x098e('0x2d')](function(_0x525c1a){if(_0x525c1a){return _0x525c1a?{'count':_0x40305d,'rows':_0x525c1a}:null;}})[_0x098e('0x2d')](respondWithResult(_0x456b96,null))['catch'](handleError(_0x456b96,null));};exports['getSubjects']=function(_0x15fe91,_0x5d7bf8,_0x3c103e){var _0x5c8a82={};var _0x57b4f1={};var _0x30ef0d;var _0x31493a;return db['FreshdeskConfiguration'][_0x098e('0x55')]({'where':{'id':_0x15fe91['params']['id']}})[_0x098e('0x2d')](handleEntityNotFound(_0x5d7bf8,null))[_0x098e('0x2d')](function(_0x17fddb){if(_0x17fddb){_0x30ef0d=_0x17fddb;_0x57b4f1[_0x098e('0x39')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x57b4f1[_0x098e('0x3a')]=_[_0x098e('0x3b')](_0x15fe91[_0x098e('0x3a')]);_0x57b4f1[_0x098e('0x3c')]=_[_0x098e('0x3d')](_0x57b4f1[_0x098e('0x39')],_0x57b4f1[_0x098e('0x3a')]);_0x5c8a82[_0x098e('0x3e')]=_[_0x098e('0x3d')](_0x57b4f1[_0x098e('0x39')],qs[_0x098e('0x3f')](_0x15fe91['query'][_0x098e('0x3f')]));_0x5c8a82['attributes']=_0x5c8a82[_0x098e('0x3e')][_0x098e('0x40')]?_0x5c8a82[_0x098e('0x3e')]:_0x57b4f1[_0x098e('0x39')];_0x5c8a82['order']=qs[_0x098e('0x44')](_0x15fe91[_0x098e('0x3a')][_0x098e('0x44')]);_0x5c8a82[_0x098e('0x45')]=qs['filters'](_[_0x098e('0x53')](_0x15fe91[_0x098e('0x3a')],_0x57b4f1[_0x098e('0x3c')]));if(_0x15fe91[_0x098e('0x3a')][_0x098e('0x46')]){_0x5c8a82['where']=_[_0x098e('0x47')](_0x5c8a82[_0x098e('0x45')],{'$or':_[_0x098e('0x33')](_0x5c8a82['attributes'],function(_0x53adb5){var _0x10bd36={};_0x10bd36[_0x53adb5]={'$like':'%'+_0x15fe91[_0x098e('0x3a')][_0x098e('0x46')]+'%'};return _0x10bd36;})});}_0x5c8a82=_['merge']({},_0x5c8a82,_0x15fe91[_0x098e('0x54')]);return _0x30ef0d[_0x098e('0x56')](_0x5c8a82);}})[_0x098e('0x2d')](function(_0x31b456){if(_0x31b456){_0x31493a=_0x31b456['length'];if(!_0x15fe91[_0x098e('0x3a')][_0x098e('0x41')](_0x098e('0x42'))){_0x5c8a82[_0x098e('0x28')]=qs[_0x098e('0x28')](_0x15fe91[_0x098e('0x3a')][_0x098e('0x28')]);_0x5c8a82[_0x098e('0x27')]=qs[_0x098e('0x27')](_0x15fe91[_0x098e('0x3a')][_0x098e('0x27')]);}return _0x30ef0d[_0x098e('0x56')](_0x5c8a82);}})[_0x098e('0x2d')](function(_0x57ce71){if(_0x57ce71){return _0x57ce71?{'count':_0x31493a,'rows':_0x57ce71}:null;}})[_0x098e('0x2d')](respondWithResult(_0x5d7bf8,null))[_0x098e('0x23')](handleError(_0x5d7bf8,null));};exports[_0x098e('0x57')]=function(_0x177381,_0x25adf5,_0x5b18bb){var _0x4af3b3={};var _0x86fa96={};var _0x4dd025;var _0x4a6693;return db[_0x098e('0x34')]['findOne']({'where':{'id':_0x177381['params']['id']}})['then'](handleEntityNotFound(_0x25adf5,null))[_0x098e('0x2d')](function(_0x4a3a25){if(_0x4a3a25){_0x4dd025=_0x4a3a25;_0x86fa96[_0x098e('0x39')]=_[_0x098e('0x3b')](db['FreshdeskField']['rawAttributes']);_0x86fa96[_0x098e('0x3a')]=_['keys'](_0x177381[_0x098e('0x3a')]);_0x86fa96[_0x098e('0x3c')]=_[_0x098e('0x3d')](_0x86fa96['model'],_0x86fa96['query']);_0x4af3b3[_0x098e('0x3e')]=_[_0x098e('0x3d')](_0x86fa96[_0x098e('0x39')],qs['fields'](_0x177381[_0x098e('0x3a')][_0x098e('0x3f')]));_0x4af3b3[_0x098e('0x3e')]=_0x4af3b3[_0x098e('0x3e')][_0x098e('0x40')]?_0x4af3b3[_0x098e('0x3e')]:_0x86fa96[_0x098e('0x39')];_0x4af3b3['order']=qs['sort'](_0x177381[_0x098e('0x3a')][_0x098e('0x44')]);_0x4af3b3[_0x098e('0x45')]=qs['filters'](_['pick'](_0x177381[_0x098e('0x3a')],_0x86fa96['filters']));if(_0x177381[_0x098e('0x3a')][_0x098e('0x46')]){_0x4af3b3[_0x098e('0x45')]=_[_0x098e('0x47')](_0x4af3b3[_0x098e('0x45')],{'$or':_[_0x098e('0x33')](_0x4af3b3[_0x098e('0x3e')],function(_0x4c89e8){var _0x3f11f4={};_0x3f11f4[_0x4c89e8]={'$like':'%'+_0x177381['query'][_0x098e('0x46')]+'%'};return _0x3f11f4;})});}_0x4af3b3=_[_0x098e('0x47')]({},_0x4af3b3,_0x177381['options']);return _0x4dd025[_0x098e('0x57')](_0x4af3b3);}})[_0x098e('0x2d')](function(_0x117884){if(_0x117884){_0x4a6693=_0x117884['length'];if(!_0x177381['query'][_0x098e('0x41')]('nolimit')){_0x4af3b3[_0x098e('0x28')]=qs[_0x098e('0x28')](_0x177381[_0x098e('0x3a')][_0x098e('0x28')]);_0x4af3b3[_0x098e('0x27')]=qs[_0x098e('0x27')](_0x177381[_0x098e('0x3a')][_0x098e('0x27')]);}return _0x4dd025[_0x098e('0x57')](_0x4af3b3);}})['then'](function(_0x34504f){if(_0x34504f){return _0x34504f?{'count':_0x4a6693,'rows':_0x34504f}:null;}})[_0x098e('0x2d')](respondWithResult(_0x25adf5,null))[_0x098e('0x23')](handleError(_0x25adf5,null));};exports[_0x098e('0x58')]=function(_0x3477e1,_0x5bcfcf,_0xc2382e){var _0x3c9f76={};var _0x2a0cc7={};var _0x60ff2d;var _0x16501e;return db[_0x098e('0x34')][_0x098e('0x55')]({'where':{'id':_0x3477e1['params']['id']}})[_0x098e('0x2d')](handleEntityNotFound(_0x5bcfcf,null))['then'](function(_0x31a4b1){if(_0x31a4b1){_0x60ff2d=_0x31a4b1;_0x2a0cc7[_0x098e('0x39')]=_[_0x098e('0x3b')](db[_0x098e('0x59')][_0x098e('0x35')]);_0x2a0cc7[_0x098e('0x3a')]=_[_0x098e('0x3b')](_0x3477e1['query']);_0x2a0cc7[_0x098e('0x3c')]=_[_0x098e('0x3d')](_0x2a0cc7[_0x098e('0x39')],_0x2a0cc7['query']);_0x3c9f76[_0x098e('0x3e')]=_[_0x098e('0x3d')](_0x2a0cc7[_0x098e('0x39')],qs[_0x098e('0x3f')](_0x3477e1[_0x098e('0x3a')][_0x098e('0x3f')]));_0x3c9f76[_0x098e('0x3e')]=_0x3c9f76[_0x098e('0x3e')][_0x098e('0x40')]?_0x3c9f76['attributes']:_0x2a0cc7[_0x098e('0x39')];_0x3c9f76[_0x098e('0x43')]=qs['sort'](_0x3477e1[_0x098e('0x3a')][_0x098e('0x44')]);_0x3c9f76[_0x098e('0x45')]=qs['filters'](_[_0x098e('0x53')](_0x3477e1[_0x098e('0x3a')],_0x2a0cc7['filters']));if(_0x3477e1[_0x098e('0x3a')][_0x098e('0x46')]){_0x3c9f76[_0x098e('0x45')]=_[_0x098e('0x47')](_0x3c9f76['where'],{'$or':_['map'](_0x3c9f76[_0x098e('0x3e')],function(_0x199835){var _0xb8782e={};_0xb8782e[_0x199835]={'$like':'%'+_0x3477e1[_0x098e('0x3a')][_0x098e('0x46')]+'%'};return _0xb8782e;})});}_0x3c9f76=_[_0x098e('0x47')]({},_0x3c9f76,_0x3477e1['options']);return _0x60ff2d[_0x098e('0x58')](_0x3c9f76);}})['then'](function(_0x3156f2){if(_0x3156f2){_0x16501e=_0x3156f2[_0x098e('0x40')];if(!_0x3477e1['query']['hasOwnProperty']('nolimit')){_0x3c9f76[_0x098e('0x28')]=qs['limit'](_0x3477e1[_0x098e('0x3a')][_0x098e('0x28')]);_0x3c9f76[_0x098e('0x27')]=qs[_0x098e('0x27')](_0x3477e1[_0x098e('0x3a')][_0x098e('0x27')]);}return _0x60ff2d[_0x098e('0x58')](_0x3c9f76);}})[_0x098e('0x2d')](function(_0x3724f7){if(_0x3724f7){return _0x3724f7?{'count':_0x16501e,'rows':_0x3724f7}:null;}})[_0x098e('0x2d')](respondWithResult(_0x5bcfcf,null))[_0x098e('0x23')](handleError(_0x5bcfcf,null));};exports[_0x098e('0x5a')]=function(_0x5d488c,_0x1cd419,_0x41c30d){if(_0x5d488c['body']['id']){delete _0x5d488c[_0x098e('0x50')]['id'];}return db[_0x098e('0x34')][_0x098e('0x55')]({'where':{'id':_0x5d488c[_0x098e('0x4d')]['id']}})[_0x098e('0x2d')](handleEntityNotFound(_0x1cd419,null))['then'](function(_0x337e89){if(_0x337e89){return _0x337e89[_0x098e('0x5a')](_0x5d488c['body'][_0x098e('0x5b')]||[]);}return null;})[_0x098e('0x2d')](respondWithResult(_0x1cd419,null))[_0x098e('0x23')](handleError(_0x1cd419,null));}; \ No newline at end of file +var _0xae4f=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','sendStatus','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','include','findAll','rows','show','create','body','find','params','getFields','findOne','FreshdeskField','sort','getSubjects','getDescriptions','setTags','ids','html-pdf','eml-format'];(function(_0x5f5eb2,_0x3868f5){var _0x58df87=function(_0x91d228){while(--_0x91d228){_0x5f5eb2['push'](_0x5f5eb2['shift']());}};_0x58df87(++_0x3868f5);}(_0xae4f,0x121));var _0xfae4=function(_0x536dd0,_0x598975){_0x536dd0=_0x536dd0-0x0;var _0x31e979=_0xae4f[_0x536dd0];return _0x31e979;};'use strict';var pdf=require(_0xfae4('0x0'));var emlformat=require(_0xfae4('0x1'));var rimraf=require(_0xfae4('0x2'));var zipdir=require(_0xfae4('0x3'));var jsonpatch=require(_0xfae4('0x4'));var rp=require(_0xfae4('0x5'));var moment=require(_0xfae4('0x6'));var BPromise=require(_0xfae4('0x7'));var Mustache=require(_0xfae4('0x8'));var util=require(_0xfae4('0x9'));var path=require(_0xfae4('0xa'));var sox=require(_0xfae4('0xb'));var csv=require(_0xfae4('0xc'));var ejs=require(_0xfae4('0xd'));var fs=require('fs');var _=require(_0xfae4('0xe'));var squel=require(_0xfae4('0xf'));var crypto=require(_0xfae4('0x10'));var jsforce=require(_0xfae4('0x11'));var deskjs=require(_0xfae4('0x12'));var toCsv=require(_0xfae4('0xc'));var querystring=require(_0xfae4('0x13'));var Papa=require(_0xfae4('0x14'));var Redis=require(_0xfae4('0x15'));var authService=require(_0xfae4('0x16'));var qs=require('../../components/parsers/qs');var as=require(_0xfae4('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfae4('0x18'))(_0xfae4('0x19'));var utils=require(_0xfae4('0x1a'));var config=require(_0xfae4('0x1b'));var licenseUtil=require(_0xfae4('0x1c'));var db=require('../../mysqldb')['db'];var jayson=require(_0xfae4('0x1d'));var client=jayson[_0xfae4('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ce03d,_0x45fb1a,_0x932d82,_0x5a31f8){return new BPromise(function(_0x25ab36,_0x1afea6){var _0x2ba761=_0x5a31f8||client;return _0x2ba761[_0xfae4('0x1f')](_0x4ce03d,_0x932d82)[_0xfae4('0x20')](function(_0x28a341){logger[_0xfae4('0x21')](_0xfae4('0x22'),_0x45fb1a,_0xfae4('0x23'));logger[_0xfae4('0x24')](_0xfae4('0x25'),_0x45fb1a,_0xfae4('0x23'),JSON[_0xfae4('0x26')](_0x28a341));if(_0x28a341[_0xfae4('0x27')]){if(_0x28a341[_0xfae4('0x27')][_0xfae4('0x28')]===0x1f4){logger['error'](_0xfae4('0x22'),_0x45fb1a,_0x28a341[_0xfae4('0x27')]['message']);return _0x1afea6(_0x28a341['error']['message']);}logger[_0xfae4('0x27')](_0xfae4('0x22'),_0x45fb1a,_0x28a341[_0xfae4('0x27')][_0xfae4('0x29')]);return _0x25ab36(_0x28a341['error'][_0xfae4('0x29')]);}else{logger[_0xfae4('0x21')](_0xfae4('0x22'),_0x45fb1a,_0xfae4('0x23'));_0x25ab36(_0x28a341['result'][_0xfae4('0x29')]);}})[_0xfae4('0x2a')](function(_0x20e660){logger['error'](_0xfae4('0x22'),_0x45fb1a,_0x20e660);_0x1afea6(_0x20e660);});});}function respondWithStatusCode(_0x5d6d7f,_0x14c797){_0x14c797=_0x14c797||0xcc;return function(_0x227f95){if(_0x227f95){return _0x5d6d7f['sendStatus'](_0x14c797);}return _0x5d6d7f[_0xfae4('0x2b')](_0x14c797)[_0xfae4('0x2c')]();};}function respondWithResult(_0x35bc47,_0x538125){_0x538125=_0x538125||0xc8;return function(_0x1631a0){if(_0x1631a0){return _0x35bc47[_0xfae4('0x2b')](_0x538125)[_0xfae4('0x2d')](_0x1631a0);}};}function respondWithFilteredResult(_0x135e79,_0x2d375c){return function(_0x2bf156){if(_0x2bf156){var _0x5586f9=_0x2bf156[_0xfae4('0x2e')],_0x5c8fa1=_0x2d375c['offset'],_0x3e6757=_0x2d375c[_0xfae4('0x2f')]+_0x2d375c[_0xfae4('0x30')],_0xfa11a6;if(_0x3e6757>=_0x5586f9){_0x3e6757=_0x5586f9;_0xfa11a6=0xc8;}else{_0xfa11a6=0xce;}_0x135e79['status'](_0xfa11a6);return _0x135e79[_0xfae4('0x31')](_0xfae4('0x32'),_0x5c8fa1+'-'+_0x3e6757+'/'+_0x5586f9)[_0xfae4('0x2d')](_0x2bf156);}return null;};}function patchUpdates(_0xa32a11){return function(_0x4485aa){try{jsonpatch['apply'](_0x4485aa,_0xa32a11,!![]);}catch(_0x2b53a1){return BPromise[_0xfae4('0x33')](_0x2b53a1);}return _0x4485aa[_0xfae4('0x34')]();};}function saveUpdates(_0xc55dc7,_0x59bd68){return function(_0x5d97c2){if(_0x5d97c2){return _0x5d97c2[_0xfae4('0x35')](_0xc55dc7)[_0xfae4('0x20')](function(_0x338cb2){return _0x338cb2;});}return null;};}function removeEntity(_0x4bacd5,_0x122416){return function(_0x5d05d4){if(_0x5d05d4){return _0x5d05d4[_0xfae4('0x36')]()[_0xfae4('0x20')](function(){_0x4bacd5[_0xfae4('0x2b')](0xcc)[_0xfae4('0x2c')]();});}};}function handleEntityNotFound(_0x3f1036,_0x3fe7eb){return function(_0x4ebf86){if(!_0x4ebf86){_0x3f1036[_0xfae4('0x37')](0x194);}return _0x4ebf86;};}function handleError(_0x7701b9,_0x5819a9){_0x5819a9=_0x5819a9||0x1f4;return function(_0x464c09){logger[_0xfae4('0x27')](_0x464c09[_0xfae4('0x38')]);if(_0x464c09[_0xfae4('0x39')]){delete _0x464c09['name'];}_0x7701b9['status'](_0x5819a9)[_0xfae4('0x3a')](_0x464c09);};}exports[_0xfae4('0x3b')]=function(_0x5d8d0b,_0x25b80b){var _0x1962ed={},_0xa55475={},_0x277833={'count':0x0,'rows':[]};var _0x488a2e=_[_0xfae4('0x3c')](db[_0xfae4('0x3d')][_0xfae4('0x3e')],function(_0x4e3942){return{'name':_0x4e3942['fieldName'],'type':_0x4e3942[_0xfae4('0x3f')][_0xfae4('0x40')]};});_0xa55475['model']=_[_0xfae4('0x3c')](_0x488a2e,_0xfae4('0x39'));_0xa55475['query']=_[_0xfae4('0x41')](_0x5d8d0b[_0xfae4('0x42')]);_0xa55475[_0xfae4('0x43')]=_[_0xfae4('0x44')](_0xa55475[_0xfae4('0x45')],_0xa55475[_0xfae4('0x42')]);_0x1962ed['attributes']=_[_0xfae4('0x44')](_0xa55475[_0xfae4('0x45')],qs[_0xfae4('0x46')](_0x5d8d0b[_0xfae4('0x42')][_0xfae4('0x46')]));_0x1962ed[_0xfae4('0x47')]=_0x1962ed[_0xfae4('0x47')][_0xfae4('0x48')]?_0x1962ed['attributes']:_0xa55475['model'];if(!_0x5d8d0b[_0xfae4('0x42')][_0xfae4('0x49')](_0xfae4('0x4a'))){_0x1962ed['limit']=qs[_0xfae4('0x30')](_0x5d8d0b['query']['limit']);_0x1962ed[_0xfae4('0x2f')]=qs[_0xfae4('0x2f')](_0x5d8d0b[_0xfae4('0x42')][_0xfae4('0x2f')]);}_0x1962ed[_0xfae4('0x4b')]=qs['sort'](_0x5d8d0b[_0xfae4('0x42')]['sort']);_0x1962ed[_0xfae4('0x4c')]=qs['filters'](_[_0xfae4('0x4d')](_0x5d8d0b[_0xfae4('0x42')],_0xa55475[_0xfae4('0x43')]),_0x488a2e);if(_0x5d8d0b[_0xfae4('0x42')][_0xfae4('0x4e')]){_0x1962ed['where']=_['merge'](_0x1962ed['where'],{'$or':_[_0xfae4('0x3c')](_0x488a2e,function(_0x587850){if(_0x587850[_0xfae4('0x3f')]!=='VIRTUAL'){var _0x444391={};_0x444391[_0x587850[_0xfae4('0x39')]]={'$like':'%'+_0x5d8d0b[_0xfae4('0x42')][_0xfae4('0x4e')]+'%'};return _0x444391;}})});}_0x1962ed=_[_0xfae4('0x4f')]({},_0x1962ed,_0x5d8d0b[_0xfae4('0x50')]);var _0x59aad9={'where':_0x1962ed[_0xfae4('0x4c')]};return db[_0xfae4('0x3d')][_0xfae4('0x2e')](_0x59aad9)[_0xfae4('0x20')](function(_0x2792a0){_0x277833[_0xfae4('0x2e')]=_0x2792a0;if(_0x5d8d0b[_0xfae4('0x42')]['includeAll']){_0x1962ed[_0xfae4('0x51')]=[{'all':!![]}];}return db[_0xfae4('0x3d')][_0xfae4('0x52')](_0x1962ed);})[_0xfae4('0x20')](function(_0x47dbbd){_0x277833[_0xfae4('0x53')]=_0x47dbbd;return _0x277833;})['then'](respondWithFilteredResult(_0x25b80b,_0x1962ed))[_0xfae4('0x2a')](handleError(_0x25b80b,null));};exports[_0xfae4('0x54')]=function(_0x4d1749,_0x192ccf){var _0x3d0677={'raw':![],'where':{'id':_0x4d1749['params']['id']}},_0x54545d={};_0x54545d[_0xfae4('0x45')]=_['keys'](db[_0xfae4('0x3d')][_0xfae4('0x3e')]);_0x54545d[_0xfae4('0x42')]=_['keys'](_0x4d1749[_0xfae4('0x42')]);_0x54545d[_0xfae4('0x43')]=_['intersection'](_0x54545d[_0xfae4('0x45')],_0x54545d[_0xfae4('0x42')]);_0x3d0677[_0xfae4('0x47')]=_[_0xfae4('0x44')](_0x54545d[_0xfae4('0x45')],qs['fields'](_0x4d1749['query'][_0xfae4('0x46')]));_0x3d0677[_0xfae4('0x47')]=_0x3d0677['attributes'][_0xfae4('0x48')]?_0x3d0677[_0xfae4('0x47')]:_0x54545d[_0xfae4('0x45')];if(_0x4d1749[_0xfae4('0x42')]['includeAll']){_0x3d0677[_0xfae4('0x51')]=[{'all':!![]}];}_0x3d0677=_[_0xfae4('0x4f')]({},_0x3d0677,_0x4d1749['options']);return db[_0xfae4('0x3d')]['find'](_0x3d0677)[_0xfae4('0x20')](handleEntityNotFound(_0x192ccf,null))[_0xfae4('0x20')](respondWithResult(_0x192ccf,null))[_0xfae4('0x2a')](handleError(_0x192ccf,null));};exports[_0xfae4('0x55')]=function(_0x42f58d,_0x4a7aea){return db[_0xfae4('0x3d')][_0xfae4('0x55')](_0x42f58d[_0xfae4('0x56')],{})[_0xfae4('0x20')](respondWithResult(_0x4a7aea,0xc9))[_0xfae4('0x2a')](handleError(_0x4a7aea,null));};exports[_0xfae4('0x35')]=function(_0x34ffce,_0x573df2){if(_0x34ffce['body']['id']){delete _0x34ffce[_0xfae4('0x56')]['id'];}return db[_0xfae4('0x3d')][_0xfae4('0x57')]({'where':{'id':_0x34ffce[_0xfae4('0x58')]['id']}})['then'](handleEntityNotFound(_0x573df2,null))['then'](saveUpdates(_0x34ffce[_0xfae4('0x56')],null))[_0xfae4('0x20')](respondWithResult(_0x573df2,null))[_0xfae4('0x2a')](handleError(_0x573df2,null));};exports[_0xfae4('0x36')]=function(_0x2c6c88,_0xb3db3f){return db[_0xfae4('0x3d')]['find']({'where':{'id':_0x2c6c88['params']['id']}})[_0xfae4('0x20')](handleEntityNotFound(_0xb3db3f,null))['then'](removeEntity(_0xb3db3f,null))[_0xfae4('0x2a')](handleError(_0xb3db3f,null));};exports[_0xfae4('0x59')]=function(_0x37309e,_0x2b504e,_0xaa78f6){var _0x1cd969={};var _0x5c7d27={};var _0x85f96;var _0x5b4431;return db[_0xfae4('0x3d')][_0xfae4('0x5a')]({'where':{'id':_0x37309e['params']['id']}})[_0xfae4('0x20')](handleEntityNotFound(_0x2b504e,null))[_0xfae4('0x20')](function(_0x55a1eb){if(_0x55a1eb){_0x85f96=_0x55a1eb;_0x5c7d27[_0xfae4('0x45')]=_[_0xfae4('0x41')](db[_0xfae4('0x5b')][_0xfae4('0x3e')]);_0x5c7d27[_0xfae4('0x42')]=_['keys'](_0x37309e[_0xfae4('0x42')]);_0x5c7d27[_0xfae4('0x43')]=_[_0xfae4('0x44')](_0x5c7d27[_0xfae4('0x45')],_0x5c7d27[_0xfae4('0x42')]);_0x1cd969[_0xfae4('0x47')]=_['intersection'](_0x5c7d27[_0xfae4('0x45')],qs['fields'](_0x37309e[_0xfae4('0x42')][_0xfae4('0x46')]));_0x1cd969[_0xfae4('0x47')]=_0x1cd969[_0xfae4('0x47')]['length']?_0x1cd969[_0xfae4('0x47')]:_0x5c7d27[_0xfae4('0x45')];_0x1cd969[_0xfae4('0x4b')]=qs['sort'](_0x37309e[_0xfae4('0x42')][_0xfae4('0x5c')]);_0x1cd969['where']=qs['filters'](_[_0xfae4('0x4d')](_0x37309e[_0xfae4('0x42')],_0x5c7d27[_0xfae4('0x43')]));if(_0x37309e['query']['filter']){_0x1cd969['where']=_[_0xfae4('0x4f')](_0x1cd969[_0xfae4('0x4c')],{'$or':_[_0xfae4('0x3c')](_0x1cd969['attributes'],function(_0x4a9d3b){var _0x2a43c8={};_0x2a43c8[_0x4a9d3b]={'$like':'%'+_0x37309e['query'][_0xfae4('0x4e')]+'%'};return _0x2a43c8;})});}_0x1cd969=_[_0xfae4('0x4f')]({},_0x1cd969,_0x37309e[_0xfae4('0x50')]);return _0x85f96[_0xfae4('0x59')](_0x1cd969);}})[_0xfae4('0x20')](function(_0x487614){if(_0x487614){_0x5b4431=_0x487614[_0xfae4('0x48')];if(!_0x37309e['query'][_0xfae4('0x49')]('nolimit')){_0x1cd969[_0xfae4('0x30')]=qs[_0xfae4('0x30')](_0x37309e[_0xfae4('0x42')]['limit']);_0x1cd969['offset']=qs[_0xfae4('0x2f')](_0x37309e['query']['offset']);}return _0x85f96['getFields'](_0x1cd969);}})[_0xfae4('0x20')](function(_0x483e1e){if(_0x483e1e){return _0x483e1e?{'count':_0x5b4431,'rows':_0x483e1e}:null;}})[_0xfae4('0x20')](respondWithResult(_0x2b504e,null))[_0xfae4('0x2a')](handleError(_0x2b504e,null));};exports[_0xfae4('0x5d')]=function(_0x339f84,_0x40ce7d,_0x3088f0){var _0x15443b={};var _0x5e24a8={};var _0x45230d;var _0x4681d5;return db[_0xfae4('0x3d')]['findOne']({'where':{'id':_0x339f84[_0xfae4('0x58')]['id']}})[_0xfae4('0x20')](handleEntityNotFound(_0x40ce7d,null))[_0xfae4('0x20')](function(_0x319c51){if(_0x319c51){_0x45230d=_0x319c51;_0x5e24a8['model']=_[_0xfae4('0x41')](db[_0xfae4('0x5b')][_0xfae4('0x3e')]);_0x5e24a8['query']=_[_0xfae4('0x41')](_0x339f84[_0xfae4('0x42')]);_0x5e24a8['filters']=_['intersection'](_0x5e24a8[_0xfae4('0x45')],_0x5e24a8[_0xfae4('0x42')]);_0x15443b[_0xfae4('0x47')]=_[_0xfae4('0x44')](_0x5e24a8[_0xfae4('0x45')],qs[_0xfae4('0x46')](_0x339f84[_0xfae4('0x42')][_0xfae4('0x46')]));_0x15443b[_0xfae4('0x47')]=_0x15443b[_0xfae4('0x47')]['length']?_0x15443b[_0xfae4('0x47')]:_0x5e24a8[_0xfae4('0x45')];_0x15443b[_0xfae4('0x4b')]=qs[_0xfae4('0x5c')](_0x339f84[_0xfae4('0x42')]['sort']);_0x15443b[_0xfae4('0x4c')]=qs['filters'](_[_0xfae4('0x4d')](_0x339f84['query'],_0x5e24a8[_0xfae4('0x43')]));if(_0x339f84[_0xfae4('0x42')][_0xfae4('0x4e')]){_0x15443b[_0xfae4('0x4c')]=_[_0xfae4('0x4f')](_0x15443b[_0xfae4('0x4c')],{'$or':_[_0xfae4('0x3c')](_0x15443b['attributes'],function(_0x35938a){var _0x44244a={};_0x44244a[_0x35938a]={'$like':'%'+_0x339f84[_0xfae4('0x42')][_0xfae4('0x4e')]+'%'};return _0x44244a;})});}_0x15443b=_[_0xfae4('0x4f')]({},_0x15443b,_0x339f84[_0xfae4('0x50')]);return _0x45230d['getSubjects'](_0x15443b);}})[_0xfae4('0x20')](function(_0x5bd1b7){if(_0x5bd1b7){_0x4681d5=_0x5bd1b7[_0xfae4('0x48')];if(!_0x339f84[_0xfae4('0x42')]['hasOwnProperty']('nolimit')){_0x15443b[_0xfae4('0x30')]=qs[_0xfae4('0x30')](_0x339f84['query'][_0xfae4('0x30')]);_0x15443b['offset']=qs['offset'](_0x339f84[_0xfae4('0x42')][_0xfae4('0x2f')]);}return _0x45230d[_0xfae4('0x5d')](_0x15443b);}})['then'](function(_0x1265a8){if(_0x1265a8){return _0x1265a8?{'count':_0x4681d5,'rows':_0x1265a8}:null;}})['then'](respondWithResult(_0x40ce7d,null))[_0xfae4('0x2a')](handleError(_0x40ce7d,null));};exports['getDescriptions']=function(_0x2f826c,_0x37f597,_0x2f61c1){var _0x1222aa={};var _0x529868={};var _0x4243da;var _0x27b589;return db[_0xfae4('0x3d')][_0xfae4('0x5a')]({'where':{'id':_0x2f826c[_0xfae4('0x58')]['id']}})['then'](handleEntityNotFound(_0x37f597,null))[_0xfae4('0x20')](function(_0x107856){if(_0x107856){_0x4243da=_0x107856;_0x529868[_0xfae4('0x45')]=_[_0xfae4('0x41')](db[_0xfae4('0x5b')][_0xfae4('0x3e')]);_0x529868[_0xfae4('0x42')]=_[_0xfae4('0x41')](_0x2f826c['query']);_0x529868[_0xfae4('0x43')]=_['intersection'](_0x529868['model'],_0x529868[_0xfae4('0x42')]);_0x1222aa[_0xfae4('0x47')]=_[_0xfae4('0x44')](_0x529868['model'],qs[_0xfae4('0x46')](_0x2f826c['query'][_0xfae4('0x46')]));_0x1222aa['attributes']=_0x1222aa[_0xfae4('0x47')][_0xfae4('0x48')]?_0x1222aa[_0xfae4('0x47')]:_0x529868['model'];_0x1222aa[_0xfae4('0x4b')]=qs[_0xfae4('0x5c')](_0x2f826c['query'][_0xfae4('0x5c')]);_0x1222aa['where']=qs[_0xfae4('0x43')](_[_0xfae4('0x4d')](_0x2f826c[_0xfae4('0x42')],_0x529868['filters']));if(_0x2f826c[_0xfae4('0x42')][_0xfae4('0x4e')]){_0x1222aa[_0xfae4('0x4c')]=_['merge'](_0x1222aa[_0xfae4('0x4c')],{'$or':_['map'](_0x1222aa[_0xfae4('0x47')],function(_0xb4a0e9){var _0x204064={};_0x204064[_0xb4a0e9]={'$like':'%'+_0x2f826c[_0xfae4('0x42')][_0xfae4('0x4e')]+'%'};return _0x204064;})});}_0x1222aa=_[_0xfae4('0x4f')]({},_0x1222aa,_0x2f826c[_0xfae4('0x50')]);return _0x4243da[_0xfae4('0x5e')](_0x1222aa);}})[_0xfae4('0x20')](function(_0x403d8b){if(_0x403d8b){_0x27b589=_0x403d8b[_0xfae4('0x48')];if(!_0x2f826c[_0xfae4('0x42')][_0xfae4('0x49')](_0xfae4('0x4a'))){_0x1222aa[_0xfae4('0x30')]=qs[_0xfae4('0x30')](_0x2f826c[_0xfae4('0x42')][_0xfae4('0x30')]);_0x1222aa[_0xfae4('0x2f')]=qs[_0xfae4('0x2f')](_0x2f826c[_0xfae4('0x42')][_0xfae4('0x2f')]);}return _0x4243da['getDescriptions'](_0x1222aa);}})[_0xfae4('0x20')](function(_0x7b2186){if(_0x7b2186){return _0x7b2186?{'count':_0x27b589,'rows':_0x7b2186}:null;}})[_0xfae4('0x20')](respondWithResult(_0x37f597,null))[_0xfae4('0x2a')](handleError(_0x37f597,null));};exports['getTags']=function(_0x4fe36e,_0xe9343f,_0x28f454){var _0x8d2f88={};var _0x21cd22={};var _0x4ebf10;var _0xb8614f;return db[_0xfae4('0x3d')]['findOne']({'where':{'id':_0x4fe36e[_0xfae4('0x58')]['id']}})[_0xfae4('0x20')](handleEntityNotFound(_0xe9343f,null))['then'](function(_0x1d9367){if(_0x1d9367){_0x4ebf10=_0x1d9367;_0x21cd22[_0xfae4('0x45')]=_[_0xfae4('0x41')](db['Tag']['rawAttributes']);_0x21cd22[_0xfae4('0x42')]=_[_0xfae4('0x41')](_0x4fe36e[_0xfae4('0x42')]);_0x21cd22[_0xfae4('0x43')]=_[_0xfae4('0x44')](_0x21cd22[_0xfae4('0x45')],_0x21cd22[_0xfae4('0x42')]);_0x8d2f88[_0xfae4('0x47')]=_['intersection'](_0x21cd22[_0xfae4('0x45')],qs['fields'](_0x4fe36e[_0xfae4('0x42')][_0xfae4('0x46')]));_0x8d2f88[_0xfae4('0x47')]=_0x8d2f88[_0xfae4('0x47')]['length']?_0x8d2f88['attributes']:_0x21cd22[_0xfae4('0x45')];_0x8d2f88[_0xfae4('0x4b')]=qs['sort'](_0x4fe36e[_0xfae4('0x42')][_0xfae4('0x5c')]);_0x8d2f88['where']=qs[_0xfae4('0x43')](_[_0xfae4('0x4d')](_0x4fe36e[_0xfae4('0x42')],_0x21cd22[_0xfae4('0x43')]));if(_0x4fe36e[_0xfae4('0x42')][_0xfae4('0x4e')]){_0x8d2f88['where']=_[_0xfae4('0x4f')](_0x8d2f88['where'],{'$or':_[_0xfae4('0x3c')](_0x8d2f88[_0xfae4('0x47')],function(_0x417f43){var _0x131214={};_0x131214[_0x417f43]={'$like':'%'+_0x4fe36e['query'][_0xfae4('0x4e')]+'%'};return _0x131214;})});}_0x8d2f88=_[_0xfae4('0x4f')]({},_0x8d2f88,_0x4fe36e['options']);return _0x4ebf10['getTags'](_0x8d2f88);}})[_0xfae4('0x20')](function(_0x2d9384){if(_0x2d9384){_0xb8614f=_0x2d9384[_0xfae4('0x48')];if(!_0x4fe36e[_0xfae4('0x42')][_0xfae4('0x49')](_0xfae4('0x4a'))){_0x8d2f88[_0xfae4('0x30')]=qs['limit'](_0x4fe36e['query'][_0xfae4('0x30')]);_0x8d2f88['offset']=qs[_0xfae4('0x2f')](_0x4fe36e[_0xfae4('0x42')]['offset']);}return _0x4ebf10['getTags'](_0x8d2f88);}})['then'](function(_0xed1ea0){if(_0xed1ea0){return _0xed1ea0?{'count':_0xb8614f,'rows':_0xed1ea0}:null;}})[_0xfae4('0x20')](respondWithResult(_0xe9343f,null))[_0xfae4('0x2a')](handleError(_0xe9343f,null));};exports[_0xfae4('0x5f')]=function(_0x4032a7,_0x2ba4ff,_0x27551c){if(_0x4032a7[_0xfae4('0x56')]['id']){delete _0x4032a7['body']['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x4032a7[_0xfae4('0x58')]['id']}})[_0xfae4('0x20')](handleEntityNotFound(_0x2ba4ff,null))['then'](function(_0x2a3da2){if(_0x2a3da2){return _0x2a3da2[_0xfae4('0x5f')](_0x4032a7[_0xfae4('0x56')][_0xfae4('0x60')]||[]);}return null;})[_0xfae4('0x20')](respondWithResult(_0x2ba4ff,null))['catch'](handleError(_0x2ba4ff,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index a9984ff..618230f 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 _0x95ad=['request-promise','rimraf','../../config/environment','exports','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x5a7dd0,_0x309acb){var _0x111378=function(_0x5bbb07){while(--_0x5bbb07){_0x5a7dd0['push'](_0x5a7dd0['shift']());}};_0x111378(++_0x309acb);}(_0x95ad,0x195));var _0xd95a=function(_0x583cbd,_0x4fcaa6){_0x583cbd=_0x583cbd-0x0;var _0x178819=_0x95ad[_0x583cbd];return _0x178819;};'use strict';var _=require(_0xd95a('0x0'));var util=require(_0xd95a('0x1'));var logger=require(_0xd95a('0x2'))(_0xd95a('0x3'));var moment=require(_0xd95a('0x4'));var BPromise=require('bluebird');var rp=require(_0xd95a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd95a('0x6'));var config=require(_0xd95a('0x7'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xd95a('0x8')]=function(_0x36845a,_0x415637){return _0x36845a['define']('FreshdeskConfiguration',attributes,{'tableName':_0xd95a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56fb=['FreshdeskConfiguration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define'];(function(_0xa32cff,_0x274139){var _0x12c215=function(_0x53eeec){while(--_0x53eeec){_0xa32cff['push'](_0xa32cff['shift']());}};_0x12c215(++_0x274139);}(_0x56fb,0xf8));var _0xb56f=function(_0x565eae,_0x176003){_0x565eae=_0x565eae-0x0;var _0x38744d=_0x56fb[_0x565eae];return _0x38744d;};'use strict';var _=require(_0xb56f('0x0'));var util=require('util');var logger=require(_0xb56f('0x1'))(_0xb56f('0x2'));var moment=require(_0xb56f('0x3'));var BPromise=require(_0xb56f('0x4'));var rp=require(_0xb56f('0x5'));var fs=require('fs');var path=require(_0xb56f('0x6'));var rimraf=require(_0xb56f('0x7'));var config=require(_0xb56f('0x8'));var attributes=require(_0xb56f('0x9'));module[_0xb56f('0xa')]=function(_0x3a1965,_0x23b299){return _0x3a1965[_0xb56f('0xb')](_0xb56f('0xc'),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 d2d9832..949616b 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 _0xc205=['stringify','error','code','message','catch','lodash','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xc205,0x1a7));var _0x5c20=function(_0x57e47a,_0x5257f8){_0x57e47a=_0x57e47a-0x0;var _0x56a66f=_0xc205[_0x57e47a];return _0x56a66f;};'use strict';var _=require(_0x5c20('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5c20('0x1'));var rs=require(_0x5c20('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5c20('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5c20('0x4'));var config=require(_0x5c20('0x5'));var jayson=require(_0x5c20('0x6'));var client=jayson[_0x5c20('0x7')][_0x5c20('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5585f0,_0x242bf7,_0x222b1d){return new BPromise(function(_0x28e7b9,_0x1e203a){return client['request'](_0x5585f0,_0x222b1d)[_0x5c20('0x9')](function(_0x1a1977){logger[_0x5c20('0xa')](_0x5c20('0xb'),_0x242bf7,'request\x20sent');logger['debug'](_0x5c20('0xc'),_0x242bf7,_0x5c20('0xd'),JSON[_0x5c20('0xe')](_0x1a1977));if(_0x1a1977[_0x5c20('0xf')]){if(_0x1a1977['error'][_0x5c20('0x10')]===0x1f4){logger[_0x5c20('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x242bf7,_0x1a1977[_0x5c20('0xf')][_0x5c20('0x11')]);return _0x1e203a(_0x1a1977['error'][_0x5c20('0x11')]);}logger[_0x5c20('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x242bf7,_0x1a1977[_0x5c20('0xf')][_0x5c20('0x11')]);return _0x28e7b9(_0x1a1977[_0x5c20('0xf')][_0x5c20('0x11')]);}else{logger[_0x5c20('0xa')](_0x5c20('0xb'),_0x242bf7,_0x5c20('0xd'));_0x28e7b9(_0x1a1977['result']['message']);}})[_0x5c20('0x12')](function(_0x45f1fd){logger['error'](_0x5c20('0xb'),_0x242bf7,_0x45f1fd);_0x1e203a(_0x45f1fd);});});} \ No newline at end of file +var _0x536c=['FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x137931,_0x3c250c){var _0x1b7190=function(_0xe5df9f){while(--_0xe5df9f){_0x137931['push'](_0x137931['shift']());}};_0x1b7190(++_0x3c250c);}(_0x536c,0x1a1));var _0xc536=function(_0x49d35,_0xec36a0){_0x49d35=_0x49d35-0x0;var _0x52959f=_0x536c[_0x49d35];return _0x52959f;};'use strict';var _=require(_0xc536('0x0'));var util=require(_0xc536('0x1'));var moment=require(_0xc536('0x2'));var BPromise=require('bluebird');var rs=require(_0xc536('0x3'));var fs=require('fs');var Redis=require(_0xc536('0x4'));var db=require(_0xc536('0x5'))['db'];var utils=require(_0xc536('0x6'));var logger=require(_0xc536('0x7'))(_0xc536('0x8'));var config=require(_0xc536('0x9'));var jayson=require(_0xc536('0xa'));var client=jayson[_0xc536('0xb')][_0xc536('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21dcfc,_0x12751a,_0x4843a1){return new BPromise(function(_0x46082e,_0x50ec61){return client[_0xc536('0xd')](_0x21dcfc,_0x4843a1)[_0xc536('0xe')](function(_0x3cc9ca){logger['info'](_0xc536('0xf'),_0x12751a,_0xc536('0x10'));logger['debug'](_0xc536('0x11'),_0x12751a,_0xc536('0x10'),JSON[_0xc536('0x12')](_0x3cc9ca));if(_0x3cc9ca[_0xc536('0x13')]){if(_0x3cc9ca[_0xc536('0x13')][_0xc536('0x14')]===0x1f4){logger[_0xc536('0x13')](_0xc536('0xf'),_0x12751a,_0x3cc9ca[_0xc536('0x13')][_0xc536('0x15')]);return _0x50ec61(_0x3cc9ca[_0xc536('0x13')][_0xc536('0x15')]);}logger[_0xc536('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x12751a,_0x3cc9ca[_0xc536('0x13')][_0xc536('0x15')]);return _0x46082e(_0x3cc9ca[_0xc536('0x13')]['message']);}else{logger[_0xc536('0x16')](_0xc536('0xf'),_0x12751a,_0xc536('0x10'));_0x46082e(_0x3cc9ca['result']['message']);}})[_0xc536('0x17')](function(_0x44aa67){logger['error'](_0xc536('0xf'),_0x12751a,_0x44aa67);_0x50ec61(_0x44aa67);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 67f8fc0..42fd872 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 _0x0b2b=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','index','/:id','isAuthenticated','show','post','update','delete','destroy'];(function(_0x7abef8,_0x5ecac8){var _0x187f9d=function(_0x16e615){while(--_0x16e615){_0x7abef8['push'](_0x7abef8['shift']());}};_0x187f9d(++_0x5ecac8);}(_0x0b2b,0x10b));var _0xb0b2=function(_0x55871d,_0x40ff74){_0x55871d=_0x55871d-0x0;var _0x59aed8=_0x0b2b[_0x55871d];return _0x59aed8;};'use strict';var multer=require(_0xb0b2('0x0'));var util=require(_0xb0b2('0x1'));var path=require(_0xb0b2('0x2'));var timeout=require(_0xb0b2('0x3'));var express=require(_0xb0b2('0x4'));var router=express[_0xb0b2('0x5')]();var auth=require(_0xb0b2('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb0b2('0x7'));var controller=require(_0xb0b2('0x8'));router[_0xb0b2('0x9')]('/',auth['isAuthenticated'](),controller[_0xb0b2('0xa')]);router['get'](_0xb0b2('0xb'),auth[_0xb0b2('0xc')](),controller[_0xb0b2('0xd')]);router[_0xb0b2('0xe')]('/',auth[_0xb0b2('0xc')](),controller['create']);router['put']('/:id',auth[_0xb0b2('0xc')](),controller[_0xb0b2('0xf')]);router[_0xb0b2('0x10')](_0xb0b2('0xb'),auth[_0xb0b2('0xc')](),controller[_0xb0b2('0x11')]);module[_0xb0b2('0x12')]=router; \ No newline at end of file +var _0xa848=['get','index','/:id','show','isAuthenticated','create','put','update','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa848,0x119));var _0x8a84=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa848[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x8a84('0x0'));var util=require(_0x8a84('0x1'));var path=require(_0x8a84('0x2'));var timeout=require('connect-timeout');var express=require(_0x8a84('0x3'));var router=express['Router']();var auth=require(_0x8a84('0x4'));var interaction=require(_0x8a84('0x5'));var config=require(_0x8a84('0x6'));var controller=require('./intFreshdeskField.controller');router[_0x8a84('0x7')]('/',auth['isAuthenticated'](),controller[_0x8a84('0x8')]);router[_0x8a84('0x7')](_0x8a84('0x9'),auth['isAuthenticated'](),controller[_0x8a84('0xa')]);router['post']('/',auth[_0x8a84('0xb')](),controller[_0x8a84('0xc')]);router[_0x8a84('0xd')](_0x8a84('0x9'),auth[_0x8a84('0xb')](),controller[_0x8a84('0xe')]);router['delete'](_0x8a84('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x8a84('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index d5ff5d8..f46c7dd 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 _0xc818=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc818,0x1e3));var _0x8c81=function(_0x48ebdb,_0x5b0054){_0x48ebdb=_0x48ebdb-0x0;var _0x5c1eaf=_0xc818[_0x48ebdb];return _0x5c1eaf;};'use strict';var Sequelize=require(_0x8c81('0x0'));module[_0x8c81('0x1')]={'type':{'type':Sequelize[_0x8c81('0x2')](_0x8c81('0x3'),'variable',_0x8c81('0x4'),_0x8c81('0x5'),_0x8c81('0x6')),'defaultValue':_0x8c81('0x3')},'content':{'type':Sequelize[_0x8c81('0x7')]},'key':{'type':Sequelize[_0x8c81('0x7')]},'keyType':{'type':Sequelize[_0x8c81('0x2')]('string',_0x8c81('0x8'),_0x8c81('0x4'))},'keyContent':{'type':Sequelize[_0x8c81('0x7')]},'idField':{'type':Sequelize[_0x8c81('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8c81('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8c81('0x7')]}}; \ No newline at end of file +var _0xb717=['keyValue','string','STRING','BOOLEAN','sequelize','ENUM','variable','customVariable'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb717,0x1b4));var _0x7b71=function(_0x14dd6d,_0x28bac5){_0x14dd6d=_0x14dd6d-0x0;var _0x121470=_0xb717[_0x14dd6d];return _0x121470;};'use strict';var Sequelize=require(_0x7b71('0x0'));module['exports']={'type':{'type':Sequelize[_0x7b71('0x1')]('string',_0x7b71('0x2'),_0x7b71('0x3'),_0x7b71('0x4'),'picklist'),'defaultValue':_0x7b71('0x5')},'content':{'type':Sequelize[_0x7b71('0x6')]},'key':{'type':Sequelize[_0x7b71('0x6')]},'keyType':{'type':Sequelize[_0x7b71('0x1')](_0x7b71('0x5'),'variable',_0x7b71('0x3'))},'keyContent':{'type':Sequelize[_0x7b71('0x6')]},'idField':{'type':Sequelize[_0x7b71('0x6')]},'nameField':{'type':Sequelize[_0x7b71('0x6')]},'customField':{'type':Sequelize[_0x7b71('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index b27eb7a..0df0a8b 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 _0x090e=['then','destroy','error','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','include','rows','catch','show','params','keys','includeAll','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','lodash','squel','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update'];(function(_0x4758b0,_0x50386f){var _0x2b00d9=function(_0x341e4b){while(--_0x341e4b){_0x4758b0['push'](_0x4758b0['shift']());}};_0x2b00d9(++_0x50386f);}(_0x090e,0x104));var _0xe090=function(_0xab2afb,_0x546bfb){_0xab2afb=_0xab2afb-0x0;var _0x25262b=_0x090e[_0xab2afb];return _0x25262b;};'use strict';var pdf=require(_0xe090('0x0'));var emlformat=require(_0xe090('0x1'));var rimraf=require(_0xe090('0x2'));var zipdir=require(_0xe090('0x3'));var jsonpatch=require(_0xe090('0x4'));var rp=require(_0xe090('0x5'));var moment=require(_0xe090('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe090('0x7'));var path=require('path');var sox=require(_0xe090('0x8'));var csv=require('to-csv');var ejs=require(_0xe090('0x9'));var fs=require('fs');var _=require(_0xe090('0xa'));var squel=require(_0xe090('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe090('0xc'));var querystring=require('querystring');var Papa=require(_0xe090('0xd'));var Redis=require(_0xe090('0xe'));var authService=require(_0xe090('0xf'));var qs=require(_0xe090('0x10'));var as=require(_0xe090('0x11'));var hardwareService=require(_0xe090('0x12'));var logger=require(_0xe090('0x13'))(_0xe090('0x14'));var utils=require(_0xe090('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe090('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xeda9d7,_0x49e35d){_0x49e35d=_0x49e35d||0xcc;return function(_0x2a952b){if(_0x2a952b){return _0xeda9d7[_0xe090('0x17')](_0x49e35d);}return _0xeda9d7['status'](_0x49e35d)[_0xe090('0x18')]();};}function respondWithResult(_0x985247,_0xdcd4ee){_0xdcd4ee=_0xdcd4ee||0xc8;return function(_0x3f8bb3){if(_0x3f8bb3){return _0x985247[_0xe090('0x19')](_0xdcd4ee)[_0xe090('0x1a')](_0x3f8bb3);}};}function respondWithFilteredResult(_0x1d388d,_0x280c0a){return function(_0xf8788){if(_0xf8788){var _0x4700b6=_0xf8788[_0xe090('0x1b')],_0x3020ee=_0x280c0a[_0xe090('0x1c')],_0x7a5680=_0x280c0a[_0xe090('0x1c')]+_0x280c0a[_0xe090('0x1d')],_0x1ae0d4;if(_0x7a5680>=_0x4700b6){_0x7a5680=_0x4700b6;_0x1ae0d4=0xc8;}else{_0x1ae0d4=0xce;}_0x1d388d[_0xe090('0x19')](_0x1ae0d4);return _0x1d388d[_0xe090('0x1e')](_0xe090('0x1f'),_0x3020ee+'-'+_0x7a5680+'/'+_0x4700b6)['json'](_0xf8788);}return null;};}function patchUpdates(_0x21143c){return function(_0x397775){try{jsonpatch[_0xe090('0x20')](_0x397775,_0x21143c,!![]);}catch(_0x5f7127){return BPromise[_0xe090('0x21')](_0x5f7127);}return _0x397775[_0xe090('0x22')]();};}function saveUpdates(_0x4118d1,_0xffd04a){return function(_0x464a3b){if(_0x464a3b){return _0x464a3b[_0xe090('0x23')](_0x4118d1)[_0xe090('0x24')](function(_0x69c3ca){return _0x69c3ca;});}return null;};}function removeEntity(_0xc2abc1,_0x46b075){return function(_0x298d45){if(_0x298d45){return _0x298d45[_0xe090('0x25')]()['then'](function(){_0xc2abc1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26e39e,_0x38fd43){return function(_0x3e96e4){if(!_0x3e96e4){_0x26e39e[_0xe090('0x17')](0x194);}return _0x3e96e4;};}function handleError(_0x578c11,_0x260a91){_0x260a91=_0x260a91||0x1f4;return function(_0x7182eb){logger[_0xe090('0x26')](_0x7182eb[_0xe090('0x27')]);if(_0x7182eb['name']){delete _0x7182eb[_0xe090('0x28')];}_0x578c11['status'](_0x260a91)[_0xe090('0x29')](_0x7182eb);};}exports[_0xe090('0x2a')]=function(_0x3f9124,_0x34462b){var _0x157359={},_0x344d70={},_0x225ea7={'count':0x0,'rows':[]};var _0x428423=_[_0xe090('0x2b')](db[_0xe090('0x2c')][_0xe090('0x2d')],function(_0x3a35f3){return{'name':_0x3a35f3[_0xe090('0x2e')],'type':_0x3a35f3[_0xe090('0x2f')][_0xe090('0x30')]};});_0x344d70['model']=_[_0xe090('0x2b')](_0x428423,'name');_0x344d70[_0xe090('0x31')]=_['keys'](_0x3f9124[_0xe090('0x31')]);_0x344d70[_0xe090('0x32')]=_[_0xe090('0x33')](_0x344d70[_0xe090('0x34')],_0x344d70['query']);_0x157359['attributes']=_[_0xe090('0x33')](_0x344d70['model'],qs[_0xe090('0x35')](_0x3f9124[_0xe090('0x31')][_0xe090('0x35')]));_0x157359[_0xe090('0x36')]=_0x157359[_0xe090('0x36')][_0xe090('0x37')]?_0x157359[_0xe090('0x36')]:_0x344d70[_0xe090('0x34')];if(!_0x3f9124['query'][_0xe090('0x38')](_0xe090('0x39'))){_0x157359['limit']=qs[_0xe090('0x1d')](_0x3f9124['query']['limit']);_0x157359[_0xe090('0x1c')]=qs['offset'](_0x3f9124['query'][_0xe090('0x1c')]);}_0x157359[_0xe090('0x3a')]=qs['sort'](_0x3f9124[_0xe090('0x31')][_0xe090('0x3b')]);_0x157359['where']=qs[_0xe090('0x32')](_['pick'](_0x3f9124[_0xe090('0x31')],_0x344d70[_0xe090('0x32')]),_0x428423);if(_0x3f9124[_0xe090('0x31')][_0xe090('0x3c')]){_0x157359[_0xe090('0x3d')]=_['merge'](_0x157359[_0xe090('0x3d')],{'$or':_[_0xe090('0x2b')](_0x428423,function(_0x320e92){if(_0x320e92[_0xe090('0x2f')]!=='VIRTUAL'){var _0x3e6426={};_0x3e6426[_0x320e92[_0xe090('0x28')]]={'$like':'%'+_0x3f9124[_0xe090('0x31')][_0xe090('0x3c')]+'%'};return _0x3e6426;}})});}_0x157359=_[_0xe090('0x3e')]({},_0x157359,_0x3f9124[_0xe090('0x3f')]);var _0x58af02={'where':_0x157359[_0xe090('0x3d')]};return db['FreshdeskField'][_0xe090('0x1b')](_0x58af02)[_0xe090('0x24')](function(_0x2d2c95){_0x225ea7['count']=_0x2d2c95;if(_0x3f9124['query']['includeAll']){_0x157359[_0xe090('0x40')]=[{'all':!![]}];}return db[_0xe090('0x2c')]['findAll'](_0x157359);})['then'](function(_0xe4b07c){_0x225ea7[_0xe090('0x41')]=_0xe4b07c;return _0x225ea7;})['then'](respondWithFilteredResult(_0x34462b,_0x157359))[_0xe090('0x42')](handleError(_0x34462b,null));};exports[_0xe090('0x43')]=function(_0x2a8769,_0x72058a){var _0x47e531={'raw':!![],'where':{'id':_0x2a8769[_0xe090('0x44')]['id']}},_0x51ca72={};_0x51ca72[_0xe090('0x34')]=_[_0xe090('0x45')](db[_0xe090('0x2c')][_0xe090('0x2d')]);_0x51ca72[_0xe090('0x31')]=_[_0xe090('0x45')](_0x2a8769[_0xe090('0x31')]);_0x51ca72[_0xe090('0x32')]=_['intersection'](_0x51ca72[_0xe090('0x34')],_0x51ca72[_0xe090('0x31')]);_0x47e531[_0xe090('0x36')]=_[_0xe090('0x33')](_0x51ca72[_0xe090('0x34')],qs[_0xe090('0x35')](_0x2a8769[_0xe090('0x31')]['fields']));_0x47e531[_0xe090('0x36')]=_0x47e531[_0xe090('0x36')][_0xe090('0x37')]?_0x47e531[_0xe090('0x36')]:_0x51ca72[_0xe090('0x34')];if(_0x2a8769['query'][_0xe090('0x46')]){_0x47e531[_0xe090('0x40')]=[{'all':!![]}];}_0x47e531=_[_0xe090('0x3e')]({},_0x47e531,_0x2a8769[_0xe090('0x3f')]);return db['FreshdeskField'][_0xe090('0x47')](_0x47e531)[_0xe090('0x24')](handleEntityNotFound(_0x72058a,null))[_0xe090('0x24')](respondWithResult(_0x72058a,null))[_0xe090('0x42')](handleError(_0x72058a,null));};exports[_0xe090('0x48')]=function(_0x1f9d3c,_0x5b0547){return db[_0xe090('0x2c')][_0xe090('0x48')](_0x1f9d3c[_0xe090('0x49')],{})[_0xe090('0x24')](respondWithResult(_0x5b0547,0xc9))['catch'](handleError(_0x5b0547,null));};exports[_0xe090('0x23')]=function(_0x535515,_0x373749){if(_0x535515[_0xe090('0x49')]['id']){delete _0x535515[_0xe090('0x49')]['id'];}return db[_0xe090('0x2c')]['find']({'where':{'id':_0x535515[_0xe090('0x44')]['id']}})['then'](handleEntityNotFound(_0x373749,null))[_0xe090('0x24')](saveUpdates(_0x535515[_0xe090('0x49')],null))[_0xe090('0x24')](respondWithResult(_0x373749,null))[_0xe090('0x42')](handleError(_0x373749,null));};exports[_0xe090('0x25')]=function(_0x53e27b,_0x4ab25a){return db['FreshdeskField'][_0xe090('0x47')]({'where':{'id':_0x53e27b['params']['id']}})[_0xe090('0x24')](handleEntityNotFound(_0x4ab25a,null))['then'](removeEntity(_0x4ab25a,null))[_0xe090('0x42')](handleError(_0x4ab25a,null));}; \ No newline at end of file +var _0x2159=['sort','pick','filter','where','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','merge','create','body','update','find','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','then','destroy','stack','name','send','index','map','FreshdeskField','rawAttributes','fieldName','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order'];(function(_0x3557f3,_0x2acf66){var _0x45aa79=function(_0x354fcd){while(--_0x354fcd){_0x3557f3['push'](_0x3557f3['shift']());}};_0x45aa79(++_0x2acf66);}(_0x2159,0x17f));var _0x9215=function(_0x28833b,_0x79f1c7){_0x28833b=_0x28833b-0x0;var _0xe350d7=_0x2159[_0x28833b];return _0xe350d7;};'use strict';var pdf=require(_0x9215('0x0'));var emlformat=require(_0x9215('0x1'));var rimraf=require(_0x9215('0x2'));var zipdir=require(_0x9215('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9215('0x4'));var moment=require('moment');var BPromise=require(_0x9215('0x5'));var Mustache=require(_0x9215('0x6'));var util=require(_0x9215('0x7'));var path=require(_0x9215('0x8'));var sox=require(_0x9215('0x9'));var csv=require(_0x9215('0xa'));var ejs=require(_0x9215('0xb'));var fs=require('fs');var _=require(_0x9215('0xc'));var squel=require('squel');var crypto=require(_0x9215('0xd'));var jsforce=require(_0x9215('0xe'));var deskjs=require(_0x9215('0xf'));var toCsv=require(_0x9215('0xa'));var querystring=require(_0x9215('0x10'));var Papa=require('papaparse');var Redis=require(_0x9215('0x11'));var authService=require(_0x9215('0x12'));var qs=require(_0x9215('0x13'));var as=require(_0x9215('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9215('0x15'))(_0x9215('0x16'));var utils=require('../../config/utils');var config=require(_0x9215('0x17'));var licenseUtil=require(_0x9215('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43b660,_0x10b08f){_0x10b08f=_0x10b08f||0xcc;return function(_0x56c546){if(_0x56c546){return _0x43b660[_0x9215('0x19')](_0x10b08f);}return _0x43b660['status'](_0x10b08f)[_0x9215('0x1a')]();};}function respondWithResult(_0x5124b9,_0x1d65f4){_0x1d65f4=_0x1d65f4||0xc8;return function(_0x2d62dd){if(_0x2d62dd){return _0x5124b9[_0x9215('0x1b')](_0x1d65f4)[_0x9215('0x1c')](_0x2d62dd);}};}function respondWithFilteredResult(_0x4826bb,_0x3f44d3){return function(_0x40b41f){if(_0x40b41f){var _0x4c5ab5=_0x40b41f[_0x9215('0x1d')],_0x309818=_0x3f44d3[_0x9215('0x1e')],_0x1cfb1e=_0x3f44d3[_0x9215('0x1e')]+_0x3f44d3[_0x9215('0x1f')],_0x389dd8;if(_0x1cfb1e>=_0x4c5ab5){_0x1cfb1e=_0x4c5ab5;_0x389dd8=0xc8;}else{_0x389dd8=0xce;}_0x4826bb['status'](_0x389dd8);return _0x4826bb[_0x9215('0x20')](_0x9215('0x21'),_0x309818+'-'+_0x1cfb1e+'/'+_0x4c5ab5)[_0x9215('0x1c')](_0x40b41f);}return null;};}function patchUpdates(_0x18565e){return function(_0x1aee05){try{jsonpatch[_0x9215('0x22')](_0x1aee05,_0x18565e,!![]);}catch(_0x315320){return BPromise['reject'](_0x315320);}return _0x1aee05['save']();};}function saveUpdates(_0x5bc65b,_0x2fd6dd){return function(_0x3c68a5){if(_0x3c68a5){return _0x3c68a5['update'](_0x5bc65b)[_0x9215('0x23')](function(_0x223383){return _0x223383;});}return null;};}function removeEntity(_0xa58f48,_0x311cfb){return function(_0x518c52){if(_0x518c52){return _0x518c52[_0x9215('0x24')]()[_0x9215('0x23')](function(){_0xa58f48[_0x9215('0x1b')](0xcc)[_0x9215('0x1a')]();});}};}function handleEntityNotFound(_0x355cfe,_0x19c276){return function(_0x889028){if(!_0x889028){_0x355cfe[_0x9215('0x19')](0x194);}return _0x889028;};}function handleError(_0x10f51c,_0x126085){_0x126085=_0x126085||0x1f4;return function(_0x2725d4){logger['error'](_0x2725d4[_0x9215('0x25')]);if(_0x2725d4[_0x9215('0x26')]){delete _0x2725d4[_0x9215('0x26')];}_0x10f51c['status'](_0x126085)[_0x9215('0x27')](_0x2725d4);};}exports[_0x9215('0x28')]=function(_0x4159a3,_0x896e9){var _0x10fa42={},_0x808a92={},_0x57a761={'count':0x0,'rows':[]};var _0xc51dcf=_[_0x9215('0x29')](db[_0x9215('0x2a')][_0x9215('0x2b')],function(_0x4bf140){return{'name':_0x4bf140[_0x9215('0x2c')],'type':_0x4bf140['type'][_0x9215('0x2d')]};});_0x808a92['model']=_[_0x9215('0x29')](_0xc51dcf,'name');_0x808a92[_0x9215('0x2e')]=_['keys'](_0x4159a3['query']);_0x808a92[_0x9215('0x2f')]=_[_0x9215('0x30')](_0x808a92['model'],_0x808a92['query']);_0x10fa42[_0x9215('0x31')]=_[_0x9215('0x30')](_0x808a92[_0x9215('0x32')],qs[_0x9215('0x33')](_0x4159a3['query']['fields']));_0x10fa42[_0x9215('0x31')]=_0x10fa42[_0x9215('0x31')][_0x9215('0x34')]?_0x10fa42[_0x9215('0x31')]:_0x808a92[_0x9215('0x32')];if(!_0x4159a3[_0x9215('0x2e')][_0x9215('0x35')]('nolimit')){_0x10fa42['limit']=qs[_0x9215('0x1f')](_0x4159a3[_0x9215('0x2e')][_0x9215('0x1f')]);_0x10fa42['offset']=qs[_0x9215('0x1e')](_0x4159a3[_0x9215('0x2e')]['offset']);}_0x10fa42[_0x9215('0x36')]=qs[_0x9215('0x37')](_0x4159a3[_0x9215('0x2e')][_0x9215('0x37')]);_0x10fa42['where']=qs['filters'](_[_0x9215('0x38')](_0x4159a3[_0x9215('0x2e')],_0x808a92['filters']),_0xc51dcf);if(_0x4159a3['query'][_0x9215('0x39')]){_0x10fa42['where']=_['merge'](_0x10fa42[_0x9215('0x3a')],{'$or':_[_0x9215('0x29')](_0xc51dcf,function(_0x24da34){if(_0x24da34[_0x9215('0x3b')]!==_0x9215('0x3c')){var _0x3d0018={};_0x3d0018[_0x24da34[_0x9215('0x26')]]={'$like':'%'+_0x4159a3[_0x9215('0x2e')][_0x9215('0x39')]+'%'};return _0x3d0018;}})});}_0x10fa42=_['merge']({},_0x10fa42,_0x4159a3[_0x9215('0x3d')]);var _0x4d48e0={'where':_0x10fa42[_0x9215('0x3a')]};return db[_0x9215('0x2a')]['count'](_0x4d48e0)[_0x9215('0x23')](function(_0x5bc497){_0x57a761[_0x9215('0x1d')]=_0x5bc497;if(_0x4159a3[_0x9215('0x2e')][_0x9215('0x3e')]){_0x10fa42[_0x9215('0x3f')]=[{'all':!![]}];}return db['FreshdeskField']['findAll'](_0x10fa42);})['then'](function(_0x224f07){_0x57a761[_0x9215('0x40')]=_0x224f07;return _0x57a761;})[_0x9215('0x23')](respondWithFilteredResult(_0x896e9,_0x10fa42))[_0x9215('0x41')](handleError(_0x896e9,null));};exports[_0x9215('0x42')]=function(_0xf9c36a,_0x159804){var _0x206123={'raw':!![],'where':{'id':_0xf9c36a[_0x9215('0x43')]['id']}},_0x97c5c7={};_0x97c5c7[_0x9215('0x32')]=_['keys'](db[_0x9215('0x2a')][_0x9215('0x2b')]);_0x97c5c7[_0x9215('0x2e')]=_['keys'](_0xf9c36a[_0x9215('0x2e')]);_0x97c5c7[_0x9215('0x2f')]=_['intersection'](_0x97c5c7['model'],_0x97c5c7[_0x9215('0x2e')]);_0x206123['attributes']=_[_0x9215('0x30')](_0x97c5c7[_0x9215('0x32')],qs[_0x9215('0x33')](_0xf9c36a[_0x9215('0x2e')]['fields']));_0x206123[_0x9215('0x31')]=_0x206123['attributes']['length']?_0x206123[_0x9215('0x31')]:_0x97c5c7[_0x9215('0x32')];if(_0xf9c36a[_0x9215('0x2e')]['includeAll']){_0x206123[_0x9215('0x3f')]=[{'all':!![]}];}_0x206123=_[_0x9215('0x44')]({},_0x206123,_0xf9c36a['options']);return db[_0x9215('0x2a')]['find'](_0x206123)[_0x9215('0x23')](handleEntityNotFound(_0x159804,null))[_0x9215('0x23')](respondWithResult(_0x159804,null))['catch'](handleError(_0x159804,null));};exports['create']=function(_0x2b7cf8,_0x49351a){return db[_0x9215('0x2a')][_0x9215('0x45')](_0x2b7cf8[_0x9215('0x46')],{})['then'](respondWithResult(_0x49351a,0xc9))[_0x9215('0x41')](handleError(_0x49351a,null));};exports[_0x9215('0x47')]=function(_0x430cb4,_0x19b0a9){if(_0x430cb4[_0x9215('0x46')]['id']){delete _0x430cb4[_0x9215('0x46')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x430cb4[_0x9215('0x43')]['id']}})[_0x9215('0x23')](handleEntityNotFound(_0x19b0a9,null))['then'](saveUpdates(_0x430cb4[_0x9215('0x46')],null))['then'](respondWithResult(_0x19b0a9,null))[_0x9215('0x41')](handleError(_0x19b0a9,null));};exports['destroy']=function(_0x34b852,_0x24234d){return db['FreshdeskField'][_0x9215('0x48')]({'where':{'id':_0x34b852[_0x9215('0x43')]['id']}})[_0x9215('0x23')](handleEntityNotFound(_0x24234d,null))[_0x9215('0x23')](removeEntity(_0x24234d,null))[_0x9215('0x41')](handleError(_0x24234d,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 830547b..7957ab5 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 _0x8247=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','int_freshdesk_fields','freshdesk_unique_index','idField'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x8247,0x1dc));var _0x7824=function(_0x2e3dfc,_0x454d6c){_0x2e3dfc=_0x2e3dfc-0x0;var _0x4b1245=_0x8247[_0x2e3dfc];return _0x4b1245;};'use strict';var _=require(_0x7824('0x0'));var util=require(_0x7824('0x1'));var logger=require(_0x7824('0x2'))(_0x7824('0x3'));var moment=require(_0x7824('0x4'));var BPromise=require(_0x7824('0x5'));var rp=require(_0x7824('0x6'));var fs=require('fs');var path=require(_0x7824('0x7'));var rimraf=require(_0x7824('0x8'));var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module[_0x7824('0x9')]=function(_0x408255,_0x4f3a58){return _0x408255[_0x7824('0xa')]('FreshdeskField',attributes,{'tableName':_0x7824('0xb'),'paranoid':![],'indexes':[{'name':_0x7824('0xc'),'fields':[_0x7824('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1d84=['exports','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','lodash','../../config/logger','moment','bluebird','path','./intFreshdeskField.attributes'];(function(_0x2a58a,_0x5433fa){var _0x3936c4=function(_0x2213e3){while(--_0x2213e3){_0x2a58a['push'](_0x2a58a['shift']());}};_0x3936c4(++_0x5433fa);}(_0x1d84,0x15a));var _0x41d8=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x1d84[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x41d8('0x0'));var util=require('util');var logger=require(_0x41d8('0x1'))('api');var moment=require(_0x41d8('0x2'));var BPromise=require(_0x41d8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x41d8('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x41d8('0x5'));module[_0x41d8('0x6')]=function(_0x5ef25a,_0x4f106d){return _0x5ef25a['define'](_0x41d8('0x7'),attributes,{'tableName':_0x41d8('0x8'),'paranoid':![],'indexes':[{'name':_0x41d8('0x9'),'fields':[_0x41d8('0xa'),'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 a2ed3a9..0d5b902 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 _0x7a54=['info','FreshdeskField,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x297b59,_0x27b53a){_0x297b59=_0x297b59-0x0;var _0x570a68=_0x7a54[_0x297b59];return _0x570a68;};'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')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2a76bd,_0x3a1680){var _0x539027=function(_0x2104e3){while(--_0x2104e3){_0x2a76bd['push'](_0x2a76bd['shift']());}};_0x539027(++_0x3a1680);}(_0xb10b,0x12a));var _0xbb10=function(_0x55de81,_0x1ebe60){_0x55de81=_0x55de81-0x0;var _0x21d6e6=_0xb10b[_0x55de81];return _0x21d6e6;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 412eb9d..6049de5 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 _0x326d=['update','destroy','exports','util','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put'];(function(_0xbf59b0,_0x2a7597){var _0x3342b1=function(_0xfb798d){while(--_0xfb798d){_0xbf59b0['push'](_0xbf59b0['shift']());}};_0x3342b1(++_0x2a7597);}(_0x326d,0xa3));var _0xd326=function(_0x141df3,_0x38c7c8){_0x141df3=_0x141df3-0x0;var _0x43947e=_0x326d[_0x141df3];return _0x43947e;};'use strict';var multer=require('multer');var util=require(_0xd326('0x0'));var path=require('path');var timeout=require(_0xd326('0x1'));var express=require(_0xd326('0x2'));var router=express[_0xd326('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd326('0x4'));var controller=require('./intFreshsalesAccount.controller');router[_0xd326('0x5')]('/',auth[_0xd326('0x6')](),controller[_0xd326('0x7')]);router[_0xd326('0x5')](_0xd326('0x8'),auth[_0xd326('0x6')](),controller[_0xd326('0x9')]);router[_0xd326('0x5')](_0xd326('0xa'),auth[_0xd326('0x6')](),controller[_0xd326('0xb')]);router[_0xd326('0x5')](_0xd326('0xc'),auth[_0xd326('0x6')](),controller[_0xd326('0xd')]);router[_0xd326('0xe')]('/',auth[_0xd326('0x6')](),controller[_0xd326('0xf')]);router[_0xd326('0xe')](_0xd326('0xa'),auth[_0xd326('0x6')](),controller['addConfiguration']);router[_0xd326('0x10')](_0xd326('0x8'),auth[_0xd326('0x6')](),controller[_0xd326('0x11')]);router['delete'](_0xd326('0x8'),auth[_0xd326('0x6')](),controller[_0xd326('0x12')]);module[_0xd326('0x13')]=router; \ No newline at end of file +var _0x95d6=['create','destroy','exports','multer','util','path','Router','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','post'];(function(_0x541afa,_0x5d50bc){var _0x439b41=function(_0x5237dd){while(--_0x5237dd){_0x541afa['push'](_0x541afa['shift']());}};_0x439b41(++_0x5d50bc);}(_0x95d6,0x7a));var _0x695d=function(_0x28ea2a,_0x541ac1){_0x28ea2a=_0x28ea2a-0x0;var _0x250601=_0x95d6[_0x28ea2a];return _0x250601;};'use strict';var multer=require(_0x695d('0x0'));var util=require(_0x695d('0x1'));var path=require(_0x695d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x695d('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x695d('0x4'));var config=require('../../config/environment');var controller=require(_0x695d('0x5'));router[_0x695d('0x6')]('/',auth[_0x695d('0x7')](),controller[_0x695d('0x8')]);router['get'](_0x695d('0x9'),auth[_0x695d('0x7')](),controller[_0x695d('0xa')]);router[_0x695d('0x6')](_0x695d('0xb'),auth[_0x695d('0x7')](),controller['getConfigurations']);router[_0x695d('0x6')](_0x695d('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x695d('0xd')]('/',auth[_0x695d('0x7')](),controller[_0x695d('0xe')]);router[_0x695d('0xd')]('/:id/configurations',auth[_0x695d('0x7')](),controller['addConfiguration']);router['put'](_0x695d('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x695d('0x9'),auth[_0x695d('0x7')](),controller[_0x695d('0xf')]);module[_0x695d('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index ef44c25..bf1f0e1 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 _0xfa60=['username','remoteUri','sequelize','exports','STRING'];(function(_0x2e9afa,_0x59d433){var _0x3fc2f1=function(_0x242217){while(--_0x242217){_0x2e9afa['push'](_0x2e9afa['shift']());}};_0x3fc2f1(++_0x59d433);}(_0xfa60,0x9d));var _0x0fa6=function(_0x216e07,_0x39338c){_0x216e07=_0x216e07-0x0;var _0x41c376=_0xfa60[_0x216e07];return _0x41c376;};'use strict';var Sequelize=require(_0x0fa6('0x0'));module[_0x0fa6('0x1')]={'name':{'type':Sequelize[_0x0fa6('0x2')]},'description':{'type':Sequelize[_0x0fa6('0x2')]},'username':{'type':Sequelize[_0x0fa6('0x2')],'unique':_0x0fa6('0x3')},'apiKey':{'type':Sequelize[_0x0fa6('0x2')]},'remoteUri':{'type':Sequelize[_0x0fa6('0x2')],'unique':_0x0fa6('0x4')},'serverUrl':{'type':Sequelize[_0x0fa6('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x64d3=['sequelize','STRING'];(function(_0xff9e82,_0x577667){var _0xc071b=function(_0x4afd75){while(--_0x4afd75){_0xff9e82['push'](_0xff9e82['shift']());}};_0xc071b(++_0x577667);}(_0x64d3,0x122));var _0x364d=function(_0x494860,_0xf5e554){_0x494860=_0x494860-0x0;var _0x146088=_0x64d3[_0x494860];return _0x146088;};'use strict';var Sequelize=require(_0x364d('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x364d('0x1')]},'username':{'type':Sequelize[_0x364d('0x1')],'unique':'username'},'apiKey':{'type':Sequelize[_0x364d('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x364d('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 3c192a5..6249d31 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 _0xfe57=['end','status','json','count','offset','set','Content-Range','reject','update','destroy','stack','name','send','FreshsalesAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','map','VIRTUAL','merge','options','includeAll','findAll','rows','params','include','create','body','find','getConfigurations','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','getDescriptions','FreshsalesConfiguration','FreshsalesField','Subjects','findOne','apiKey','username','remoteUri','slice','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus'];(function(_0x1d3f54,_0x7f2085){var _0x285290=function(_0x243895){while(--_0x243895){_0x1d3f54['push'](_0x1d3f54['shift']());}};_0x285290(++_0x7f2085);}(_0xfe57,0x195));var _0x7fe5=function(_0x548d7d,_0x2d41fc){_0x548d7d=_0x548d7d-0x0;var _0xb1c878=_0xfe57[_0x548d7d];return _0xb1c878;};'use strict';var pdf=require(_0x7fe5('0x0'));var emlformat=require(_0x7fe5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7fe5('0x2'));var rp=require(_0x7fe5('0x3'));var moment=require(_0x7fe5('0x4'));var BPromise=require(_0x7fe5('0x5'));var Mustache=require(_0x7fe5('0x6'));var util=require(_0x7fe5('0x7'));var path=require(_0x7fe5('0x8'));var sox=require(_0x7fe5('0x9'));var csv=require(_0x7fe5('0xa'));var ejs=require(_0x7fe5('0xb'));var fs=require('fs');var _=require(_0x7fe5('0xc'));var squel=require(_0x7fe5('0xd'));var crypto=require(_0x7fe5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7fe5('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7fe5('0x10'));var Papa=require(_0x7fe5('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7fe5('0x12'));var as=require(_0x7fe5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fe5('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7fe5('0x15'));var licenseUtil=require(_0x7fe5('0x16'));var db=require(_0x7fe5('0x17'))['db'];var integrations=require(_0x7fe5('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x7fe5('0x19')][_0x7fe5('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x579fd3,_0x59285b,_0x54cfb2,_0x1f84b5){return new BPromise(function(_0x2d297b,_0x4e8ea0){var _0x1ce051=_0x1f84b5||client;return _0x1ce051['request'](_0x579fd3,_0x54cfb2)[_0x7fe5('0x1b')](function(_0x221ab2){logger[_0x7fe5('0x1c')](_0x7fe5('0x1d'),_0x59285b,_0x7fe5('0x1e'));logger[_0x7fe5('0x1f')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x59285b,_0x7fe5('0x1e'),JSON[_0x7fe5('0x20')](_0x221ab2));if(_0x221ab2[_0x7fe5('0x21')]){if(_0x221ab2[_0x7fe5('0x21')][_0x7fe5('0x22')]===0x1f4){logger[_0x7fe5('0x21')](_0x7fe5('0x1d'),_0x59285b,_0x221ab2[_0x7fe5('0x21')][_0x7fe5('0x23')]);return _0x4e8ea0(_0x221ab2[_0x7fe5('0x21')]['message']);}logger['error'](_0x7fe5('0x1d'),_0x59285b,_0x221ab2[_0x7fe5('0x21')][_0x7fe5('0x23')]);return _0x2d297b(_0x221ab2[_0x7fe5('0x21')][_0x7fe5('0x23')]);}else{logger[_0x7fe5('0x1c')](_0x7fe5('0x1d'),_0x59285b,_0x7fe5('0x1e'));_0x2d297b(_0x221ab2[_0x7fe5('0x24')][_0x7fe5('0x23')]);}})[_0x7fe5('0x25')](function(_0x204f09){logger['error'](_0x7fe5('0x1d'),_0x59285b,_0x204f09);_0x4e8ea0(_0x204f09);});});}function respondWithStatusCode(_0x2f39e0,_0x43e547){_0x43e547=_0x43e547||0xcc;return function(_0x508826){if(_0x508826){return _0x2f39e0[_0x7fe5('0x26')](_0x43e547);}return _0x2f39e0['status'](_0x43e547)[_0x7fe5('0x27')]();};}function respondWithResult(_0x53f522,_0x5c3b37){_0x5c3b37=_0x5c3b37||0xc8;return function(_0x190355){if(_0x190355){return _0x53f522[_0x7fe5('0x28')](_0x5c3b37)[_0x7fe5('0x29')](_0x190355);}};}function respondWithFilteredResult(_0x399c55,_0x4393c3){return function(_0x5bfe23){if(_0x5bfe23){var _0x5f2d25=_0x5bfe23[_0x7fe5('0x2a')],_0x417a56=_0x4393c3['offset'],_0x450759=_0x4393c3[_0x7fe5('0x2b')]+_0x4393c3['limit'],_0x27b66d;if(_0x450759>=_0x5f2d25){_0x450759=_0x5f2d25;_0x27b66d=0xc8;}else{_0x27b66d=0xce;}_0x399c55[_0x7fe5('0x28')](_0x27b66d);return _0x399c55[_0x7fe5('0x2c')](_0x7fe5('0x2d'),_0x417a56+'-'+_0x450759+'/'+_0x5f2d25)[_0x7fe5('0x29')](_0x5bfe23);}return null;};}function patchUpdates(_0x1f8572){return function(_0x45b32b){try{jsonpatch['apply'](_0x45b32b,_0x1f8572,!![]);}catch(_0xe521c6){return BPromise[_0x7fe5('0x2e')](_0xe521c6);}return _0x45b32b['save']();};}function saveUpdates(_0xfc1189,_0x246b70){return function(_0x360f6f){if(_0x360f6f){return _0x360f6f[_0x7fe5('0x2f')](_0xfc1189)[_0x7fe5('0x1b')](function(_0x53ef16){return _0x53ef16;});}return null;};}function removeEntity(_0x55577c,_0x13623e){return function(_0x25a4c3){if(_0x25a4c3){return _0x25a4c3[_0x7fe5('0x30')]()[_0x7fe5('0x1b')](function(){_0x55577c['status'](0xcc)[_0x7fe5('0x27')]();});}};}function handleEntityNotFound(_0x368e4a,_0x396f8d){return function(_0x4227b7){if(!_0x4227b7){_0x368e4a[_0x7fe5('0x26')](0x194);}return _0x4227b7;};}function handleError(_0x30decb,_0x4ecbba){_0x4ecbba=_0x4ecbba||0x1f4;return function(_0x1f87d7){logger[_0x7fe5('0x21')](_0x1f87d7[_0x7fe5('0x31')]);if(_0x1f87d7[_0x7fe5('0x32')]){delete _0x1f87d7['name'];}_0x30decb['status'](_0x4ecbba)[_0x7fe5('0x33')](_0x1f87d7);};}exports['index']=function(_0x19ab99,_0x513680){var _0x462839={},_0x59d694={},_0x491308={'count':0x0,'rows':[]};var _0x539573=_['map'](db[_0x7fe5('0x34')][_0x7fe5('0x35')],function(_0x4bbf54){return{'name':_0x4bbf54[_0x7fe5('0x36')],'type':_0x4bbf54[_0x7fe5('0x37')]['key']};});_0x59d694[_0x7fe5('0x38')]=_['map'](_0x539573,'name');_0x59d694[_0x7fe5('0x39')]=_[_0x7fe5('0x3a')](_0x19ab99[_0x7fe5('0x39')]);_0x59d694[_0x7fe5('0x3b')]=_[_0x7fe5('0x3c')](_0x59d694['model'],_0x59d694[_0x7fe5('0x39')]);_0x462839[_0x7fe5('0x3d')]=_['intersection'](_0x59d694[_0x7fe5('0x38')],qs[_0x7fe5('0x3e')](_0x19ab99[_0x7fe5('0x39')][_0x7fe5('0x3e')]));_0x462839[_0x7fe5('0x3d')]=_0x462839[_0x7fe5('0x3d')][_0x7fe5('0x3f')]?_0x462839['attributes']:_0x59d694['model'];if(!_0x19ab99[_0x7fe5('0x39')]['hasOwnProperty'](_0x7fe5('0x40'))){_0x462839[_0x7fe5('0x41')]=qs['limit'](_0x19ab99[_0x7fe5('0x39')][_0x7fe5('0x41')]);_0x462839[_0x7fe5('0x2b')]=qs[_0x7fe5('0x2b')](_0x19ab99[_0x7fe5('0x39')][_0x7fe5('0x2b')]);}_0x462839[_0x7fe5('0x42')]=qs['sort'](_0x19ab99['query'][_0x7fe5('0x43')]);_0x462839['where']=qs[_0x7fe5('0x3b')](_[_0x7fe5('0x44')](_0x19ab99[_0x7fe5('0x39')],_0x59d694[_0x7fe5('0x3b')]),_0x539573);if(_0x19ab99['query'][_0x7fe5('0x45')]){_0x462839['where']=_['merge'](_0x462839[_0x7fe5('0x46')],{'$or':_[_0x7fe5('0x47')](_0x539573,function(_0x4f4c38){if(_0x4f4c38[_0x7fe5('0x37')]!==_0x7fe5('0x48')){var _0x46826f={};_0x46826f[_0x4f4c38[_0x7fe5('0x32')]]={'$like':'%'+_0x19ab99[_0x7fe5('0x39')]['filter']+'%'};return _0x46826f;}})});}_0x462839=_[_0x7fe5('0x49')]({},_0x462839,_0x19ab99[_0x7fe5('0x4a')]);var _0x5c749b={'where':_0x462839[_0x7fe5('0x46')]};return db[_0x7fe5('0x34')][_0x7fe5('0x2a')](_0x5c749b)[_0x7fe5('0x1b')](function(_0x4f71df){_0x491308[_0x7fe5('0x2a')]=_0x4f71df;if(_0x19ab99[_0x7fe5('0x39')][_0x7fe5('0x4b')]){_0x462839['include']=[{'all':!![]}];}return db[_0x7fe5('0x34')][_0x7fe5('0x4c')](_0x462839);})[_0x7fe5('0x1b')](function(_0x4bf44a){_0x491308[_0x7fe5('0x4d')]=_0x4bf44a;return _0x491308;})[_0x7fe5('0x1b')](respondWithFilteredResult(_0x513680,_0x462839))[_0x7fe5('0x25')](handleError(_0x513680,null));};exports['show']=function(_0x19c4a6,_0x211933){var _0x1ac93a={'raw':![],'where':{'id':_0x19c4a6[_0x7fe5('0x4e')]['id']}},_0x4610b6={};_0x4610b6[_0x7fe5('0x38')]=_[_0x7fe5('0x3a')](db[_0x7fe5('0x34')][_0x7fe5('0x35')]);_0x4610b6[_0x7fe5('0x39')]=_[_0x7fe5('0x3a')](_0x19c4a6['query']);_0x4610b6['filters']=_['intersection'](_0x4610b6['model'],_0x4610b6[_0x7fe5('0x39')]);_0x1ac93a['attributes']=_[_0x7fe5('0x3c')](_0x4610b6[_0x7fe5('0x38')],qs[_0x7fe5('0x3e')](_0x19c4a6[_0x7fe5('0x39')][_0x7fe5('0x3e')]));_0x1ac93a['attributes']=_0x1ac93a[_0x7fe5('0x3d')][_0x7fe5('0x3f')]?_0x1ac93a[_0x7fe5('0x3d')]:_0x4610b6[_0x7fe5('0x38')];if(_0x19c4a6[_0x7fe5('0x39')][_0x7fe5('0x4b')]){_0x1ac93a[_0x7fe5('0x4f')]=[{'all':!![]}];}_0x1ac93a=_[_0x7fe5('0x49')]({},_0x1ac93a,_0x19c4a6[_0x7fe5('0x4a')]);return db[_0x7fe5('0x34')]['find'](_0x1ac93a)[_0x7fe5('0x1b')](handleEntityNotFound(_0x211933,null))[_0x7fe5('0x1b')](respondWithResult(_0x211933,null))[_0x7fe5('0x25')](handleError(_0x211933,null));};exports[_0x7fe5('0x50')]=function(_0x18b041,_0x3d425a){return db['FreshsalesAccount'][_0x7fe5('0x50')](_0x18b041[_0x7fe5('0x51')],{})[_0x7fe5('0x1b')](respondWithResult(_0x3d425a,0xc9))[_0x7fe5('0x25')](handleError(_0x3d425a,null));};exports[_0x7fe5('0x2f')]=function(_0x2bdece,_0xb44f47){if(_0x2bdece['body']['id']){delete _0x2bdece[_0x7fe5('0x51')]['id'];}return db[_0x7fe5('0x34')][_0x7fe5('0x52')]({'where':{'id':_0x2bdece[_0x7fe5('0x4e')]['id']}})[_0x7fe5('0x1b')](handleEntityNotFound(_0xb44f47,null))['then'](saveUpdates(_0x2bdece[_0x7fe5('0x51')],null))[_0x7fe5('0x1b')](respondWithResult(_0xb44f47,null))[_0x7fe5('0x25')](handleError(_0xb44f47,null));};exports[_0x7fe5('0x30')]=function(_0x4d3035,_0x20317e){return db[_0x7fe5('0x34')][_0x7fe5('0x52')]({'where':{'id':_0x4d3035[_0x7fe5('0x4e')]['id']}})[_0x7fe5('0x1b')](handleEntityNotFound(_0x20317e,null))[_0x7fe5('0x1b')](removeEntity(_0x20317e,null))[_0x7fe5('0x25')](handleError(_0x20317e,null));};exports[_0x7fe5('0x53')]=function(_0x25a965,_0x3b66a9,_0xe5b5cf){var _0x59bd7c={};var _0x44015c={};var _0x1ce47c;var _0x356d8e;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x25a965[_0x7fe5('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3b66a9,null))[_0x7fe5('0x1b')](function(_0x46e8f5){if(_0x46e8f5){_0x1ce47c=_0x46e8f5;_0x44015c['model']=_[_0x7fe5('0x3a')](db['FreshsalesConfiguration'][_0x7fe5('0x35')]);_0x44015c[_0x7fe5('0x39')]=_[_0x7fe5('0x3a')](_0x25a965[_0x7fe5('0x39')]);_0x44015c[_0x7fe5('0x3b')]=_[_0x7fe5('0x3c')](_0x44015c['model'],_0x44015c['query']);_0x59bd7c[_0x7fe5('0x3d')]=_[_0x7fe5('0x3c')](_0x44015c[_0x7fe5('0x38')],qs[_0x7fe5('0x3e')](_0x25a965[_0x7fe5('0x39')]['fields']));_0x59bd7c[_0x7fe5('0x3d')]=_0x59bd7c[_0x7fe5('0x3d')][_0x7fe5('0x3f')]?_0x59bd7c[_0x7fe5('0x3d')]:_0x44015c[_0x7fe5('0x38')];_0x59bd7c['order']=qs[_0x7fe5('0x43')](_0x25a965[_0x7fe5('0x39')][_0x7fe5('0x43')]);_0x59bd7c[_0x7fe5('0x46')]=qs[_0x7fe5('0x3b')](_[_0x7fe5('0x44')](_0x25a965[_0x7fe5('0x39')],_0x44015c['filters']));if(_0x25a965[_0x7fe5('0x39')][_0x7fe5('0x45')]){_0x59bd7c[_0x7fe5('0x46')]=_[_0x7fe5('0x49')](_0x59bd7c[_0x7fe5('0x46')],{'$or':_[_0x7fe5('0x47')](_0x59bd7c[_0x7fe5('0x3d')],function(_0x52e990){var _0x4e2104={};_0x4e2104[_0x52e990]={'$like':'%'+_0x25a965[_0x7fe5('0x39')]['filter']+'%'};return _0x4e2104;})});}_0x59bd7c=_[_0x7fe5('0x49')]({},_0x59bd7c,_0x25a965['options']);return _0x1ce47c[_0x7fe5('0x53')](_0x59bd7c);}})[_0x7fe5('0x1b')](function(_0xce6647){if(_0xce6647){_0x356d8e=_0xce6647[_0x7fe5('0x3f')];if(!_0x25a965[_0x7fe5('0x39')][_0x7fe5('0x54')](_0x7fe5('0x40'))){_0x59bd7c[_0x7fe5('0x41')]=qs['limit'](_0x25a965[_0x7fe5('0x39')]['limit']);_0x59bd7c[_0x7fe5('0x2b')]=qs[_0x7fe5('0x2b')](_0x25a965[_0x7fe5('0x39')]['offset']);}return _0x1ce47c[_0x7fe5('0x53')](_0x59bd7c);}})[_0x7fe5('0x1b')](function(_0x339581){if(_0x339581){return _0x339581?{'count':_0x356d8e,'rows':_0x339581}:null;}})[_0x7fe5('0x1b')](respondWithResult(_0x3b66a9,null))[_0x7fe5('0x25')](handleError(_0x3b66a9,null));};exports[_0x7fe5('0x55')]=function(_0x5b8b03,_0x2bf9ed,_0x46d509){if(_0x5b8b03['body']['id']){delete _0x5b8b03[_0x7fe5('0x51')]['id'];}return db[_0x7fe5('0x34')]['findOne']({'where':{'id':_0x5b8b03[_0x7fe5('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2bf9ed,null))[_0x7fe5('0x1b')](function(_0x3577be){if(_0x3577be){_0x5b8b03[_0x7fe5('0x51')][_0x7fe5('0x56')]=_0x3577be['id'];_0x5b8b03[_0x7fe5('0x51')]['Subjects']=integrations[_0x7fe5('0x57')](_0x5b8b03['body'][_0x7fe5('0x58')],_0x5b8b03[_0x7fe5('0x51')][_0x7fe5('0x37')]);_0x5b8b03[_0x7fe5('0x51')]['Descriptions']=integrations[_0x7fe5('0x59')](_0x5b8b03['body'][_0x7fe5('0x58')],_0x5b8b03[_0x7fe5('0x51')]['type']);return db[_0x7fe5('0x5a')][_0x7fe5('0x50')](_0x5b8b03['body'],{'include':[{'model':db[_0x7fe5('0x5b')],'as':_0x7fe5('0x5c')},{'model':db[_0x7fe5('0x5b')],'as':'Descriptions'}]});}return null;})[_0x7fe5('0x1b')](respondWithResult(_0x2bf9ed,null))[_0x7fe5('0x25')](handleError(_0x2bf9ed,null));};exports['getFields']=function(_0xc5ad82,_0x3d2779,_0x5e9adc){var _0x3f1459='';var _0x5da5b6='';return db['FreshsalesAccount'][_0x7fe5('0x5d')]({'where':{'id':_0xc5ad82[_0x7fe5('0x4e')]['id']},'attributes':['id','username','remoteUri',_0x7fe5('0x5e')]})['then'](handleEntityNotFound(_0x3d2779,null))[_0x7fe5('0x1b')](function(_0x55d3b5){if(_0x55d3b5){_0x5da5b6=_0x55d3b5[_0x7fe5('0x5f')];_0x3f1459=_0x55d3b5[_0x7fe5('0x60')];var _0xba6830=_0x55d3b5[_0x7fe5('0x60')][_0x7fe5('0x61')](-0x1);if(_0xba6830==='/'){_0x3f1459=_0x3f1459['substring'](0x0,_0x3f1459[_0x7fe5('0x62')](_0xba6830));}return rp({'method':_0x7fe5('0x63'),'uri':util[_0x7fe5('0x64')](_0x7fe5('0x65'),_0x3f1459,_0x7fe5('0x66')),'headers':{'Authorization':_0x7fe5('0x67')+_0x55d3b5[_0x7fe5('0x5e')]},'json':!![]});}})[_0x7fe5('0x1b')](function(_0x26b4c9){if(_0x26b4c9){var _0x438a71=_0x26b4c9['users'];var _0x24b5f7=![];var _0x19f87b=null;for(_0x19f87b=0x0;_0x19f87b<_0x438a71[_0x7fe5('0x3f')];_0x19f87b++){if(_0x438a71[_0x19f87b][_0x7fe5('0x68')]===_0x5da5b6){_0x24b5f7=!![];}}if(_0x24b5f7){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x7fe5('0x69')});}}})['then'](respondWithResult(_0x3d2779,null))[_0x7fe5('0x25')](function(_0x23f2c9){var _0x453cd7=_0xc5ad82[_0x7fe5('0x39')][_0x7fe5('0x6a')]?0x1f4:_0x23f2c9[_0x7fe5('0x6b')]||0x1f4;logger[_0x7fe5('0x21')](_0x7fe5('0x6c'),_0x7fe5('0x6d'),_0x453cd7,JSON[_0x7fe5('0x20')](_0x23f2c9));delete _0x23f2c9[_0x7fe5('0x32')];if(_0x453cd7===0x191){_0x453cd7=0x190;}_0x3d2779['status'](_0x453cd7)[_0x7fe5('0x33')](_0xc5ad82[_0x7fe5('0x39')][_0x7fe5('0x6a')]?{'message':_0x7fe5('0x6e'),'statusCode':_0x23f2c9[_0x7fe5('0x6b')]}:_0x23f2c9);});}; \ No newline at end of file +var _0xe706=['keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','includeAll','include','findAll','show','params','length','create','body','update','find','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','apiKey','slice','GET','format','%s%s','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','FreshsalesAccount,\x20%s,\x20%s','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','destroy','sendStatus','stack','name','send','map','FreshsalesAccount','rawAttributes','fieldName','type','key','query'];(function(_0x512f81,_0x4a7986){var _0xa15099=function(_0x1f7371){while(--_0x1f7371){_0x512f81['push'](_0x512f81['shift']());}};_0xa15099(++_0x4a7986);}(_0xe706,0xa3));var _0x6e70=function(_0x1e41ba,_0x455a21){_0x1e41ba=_0x1e41ba-0x0;var _0x201d61=_0xe706[_0x1e41ba];return _0x201d61;};'use strict';var pdf=require(_0x6e70('0x0'));var emlformat=require(_0x6e70('0x1'));var rimraf=require(_0x6e70('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6e70('0x3'));var rp=require(_0x6e70('0x4'));var moment=require(_0x6e70('0x5'));var BPromise=require(_0x6e70('0x6'));var Mustache=require(_0x6e70('0x7'));var util=require(_0x6e70('0x8'));var path=require(_0x6e70('0x9'));var sox=require(_0x6e70('0xa'));var csv=require(_0x6e70('0xb'));var ejs=require(_0x6e70('0xc'));var fs=require('fs');var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xb'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];var integrations=require(_0x6e70('0x1d'));var jayson=require(_0x6e70('0x1e'));var client=jayson[_0x6e70('0x1f')][_0x6e70('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x181005,_0x5dfbaa,_0x52737e,_0x48bc72){return new BPromise(function(_0x257e81,_0x5a37a6){var _0x53aed0=_0x48bc72||client;return _0x53aed0[_0x6e70('0x21')](_0x181005,_0x52737e)[_0x6e70('0x22')](function(_0x5d9263){logger[_0x6e70('0x23')]('FreshsalesAccount,\x20%s,\x20%s',_0x5dfbaa,_0x6e70('0x24'));logger[_0x6e70('0x25')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5dfbaa,'request\x20sent',JSON[_0x6e70('0x26')](_0x5d9263));if(_0x5d9263['error']){if(_0x5d9263[_0x6e70('0x27')][_0x6e70('0x28')]===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x5dfbaa,_0x5d9263[_0x6e70('0x27')][_0x6e70('0x29')]);return _0x5a37a6(_0x5d9263[_0x6e70('0x27')][_0x6e70('0x29')]);}logger[_0x6e70('0x27')](_0x6e70('0x2a'),_0x5dfbaa,_0x5d9263[_0x6e70('0x27')][_0x6e70('0x29')]);return _0x257e81(_0x5d9263[_0x6e70('0x27')][_0x6e70('0x29')]);}else{logger['info'](_0x6e70('0x2a'),_0x5dfbaa,_0x6e70('0x24'));_0x257e81(_0x5d9263[_0x6e70('0x2b')]['message']);}})[_0x6e70('0x2c')](function(_0xa5d49){logger[_0x6e70('0x27')]('FreshsalesAccount,\x20%s,\x20%s',_0x5dfbaa,_0xa5d49);_0x5a37a6(_0xa5d49);});});}function respondWithStatusCode(_0x10fc91,_0x538b9c){_0x538b9c=_0x538b9c||0xcc;return function(_0x50aec2){if(_0x50aec2){return _0x10fc91['sendStatus'](_0x538b9c);}return _0x10fc91[_0x6e70('0x2d')](_0x538b9c)[_0x6e70('0x2e')]();};}function respondWithResult(_0x51d292,_0x3ecdf1){_0x3ecdf1=_0x3ecdf1||0xc8;return function(_0x1196ed){if(_0x1196ed){return _0x51d292['status'](_0x3ecdf1)[_0x6e70('0x2f')](_0x1196ed);}};}function respondWithFilteredResult(_0x67fb43,_0x2bb231){return function(_0x4a67ac){if(_0x4a67ac){var _0x54a5fe=_0x4a67ac[_0x6e70('0x30')],_0x2c4d37=_0x2bb231[_0x6e70('0x31')],_0x3af17f=_0x2bb231['offset']+_0x2bb231[_0x6e70('0x32')],_0x83c836;if(_0x3af17f>=_0x54a5fe){_0x3af17f=_0x54a5fe;_0x83c836=0xc8;}else{_0x83c836=0xce;}_0x67fb43[_0x6e70('0x2d')](_0x83c836);return _0x67fb43[_0x6e70('0x33')](_0x6e70('0x34'),_0x2c4d37+'-'+_0x3af17f+'/'+_0x54a5fe)[_0x6e70('0x2f')](_0x4a67ac);}return null;};}function patchUpdates(_0x20a225){return function(_0x3f78d2){try{jsonpatch[_0x6e70('0x35')](_0x3f78d2,_0x20a225,!![]);}catch(_0x3a0821){return BPromise[_0x6e70('0x36')](_0x3a0821);}return _0x3f78d2['save']();};}function saveUpdates(_0x1b27d8,_0x50d60b){return function(_0x259486){if(_0x259486){return _0x259486['update'](_0x1b27d8)[_0x6e70('0x22')](function(_0x2722e8){return _0x2722e8;});}return null;};}function removeEntity(_0x30fa0b,_0x56f6f7){return function(_0x38c40d){if(_0x38c40d){return _0x38c40d[_0x6e70('0x37')]()['then'](function(){_0x30fa0b[_0x6e70('0x2d')](0xcc)[_0x6e70('0x2e')]();});}};}function handleEntityNotFound(_0x52b457,_0x10d8f6){return function(_0x3665a1){if(!_0x3665a1){_0x52b457[_0x6e70('0x38')](0x194);}return _0x3665a1;};}function handleError(_0x2723d7,_0x3b4a13){_0x3b4a13=_0x3b4a13||0x1f4;return function(_0x1e3e76){logger[_0x6e70('0x27')](_0x1e3e76[_0x6e70('0x39')]);if(_0x1e3e76[_0x6e70('0x3a')]){delete _0x1e3e76[_0x6e70('0x3a')];}_0x2723d7['status'](_0x3b4a13)[_0x6e70('0x3b')](_0x1e3e76);};}exports['index']=function(_0x23cd1a,_0x3222a2){var _0x98c683={},_0x32d12d={},_0x233a83={'count':0x0,'rows':[]};var _0x989b80=_[_0x6e70('0x3c')](db[_0x6e70('0x3d')][_0x6e70('0x3e')],function(_0x198dd1){return{'name':_0x198dd1[_0x6e70('0x3f')],'type':_0x198dd1[_0x6e70('0x40')][_0x6e70('0x41')]};});_0x32d12d['model']=_['map'](_0x989b80,'name');_0x32d12d[_0x6e70('0x42')]=_[_0x6e70('0x43')](_0x23cd1a[_0x6e70('0x42')]);_0x32d12d[_0x6e70('0x44')]=_[_0x6e70('0x45')](_0x32d12d[_0x6e70('0x46')],_0x32d12d['query']);_0x98c683[_0x6e70('0x47')]=_[_0x6e70('0x45')](_0x32d12d[_0x6e70('0x46')],qs[_0x6e70('0x48')](_0x23cd1a[_0x6e70('0x42')][_0x6e70('0x48')]));_0x98c683[_0x6e70('0x47')]=_0x98c683[_0x6e70('0x47')]['length']?_0x98c683[_0x6e70('0x47')]:_0x32d12d[_0x6e70('0x46')];if(!_0x23cd1a[_0x6e70('0x42')][_0x6e70('0x49')](_0x6e70('0x4a'))){_0x98c683[_0x6e70('0x32')]=qs[_0x6e70('0x32')](_0x23cd1a['query']['limit']);_0x98c683['offset']=qs[_0x6e70('0x31')](_0x23cd1a[_0x6e70('0x42')][_0x6e70('0x31')]);}_0x98c683[_0x6e70('0x4b')]=qs[_0x6e70('0x4c')](_0x23cd1a['query'][_0x6e70('0x4c')]);_0x98c683[_0x6e70('0x4d')]=qs[_0x6e70('0x44')](_['pick'](_0x23cd1a['query'],_0x32d12d['filters']),_0x989b80);if(_0x23cd1a[_0x6e70('0x42')]['filter']){_0x98c683[_0x6e70('0x4d')]=_[_0x6e70('0x4e')](_0x98c683[_0x6e70('0x4d')],{'$or':_[_0x6e70('0x3c')](_0x989b80,function(_0x59c87d){if(_0x59c87d[_0x6e70('0x40')]!=='VIRTUAL'){var _0x9f5b94={};_0x9f5b94[_0x59c87d[_0x6e70('0x3a')]]={'$like':'%'+_0x23cd1a[_0x6e70('0x42')][_0x6e70('0x4f')]+'%'};return _0x9f5b94;}})});}_0x98c683=_['merge']({},_0x98c683,_0x23cd1a[_0x6e70('0x50')]);var _0x44b637={'where':_0x98c683[_0x6e70('0x4d')]};return db[_0x6e70('0x3d')][_0x6e70('0x30')](_0x44b637)[_0x6e70('0x22')](function(_0x3d9c5){_0x233a83['count']=_0x3d9c5;if(_0x23cd1a[_0x6e70('0x42')][_0x6e70('0x51')]){_0x98c683[_0x6e70('0x52')]=[{'all':!![]}];}return db[_0x6e70('0x3d')][_0x6e70('0x53')](_0x98c683);})[_0x6e70('0x22')](function(_0x1e2095){_0x233a83['rows']=_0x1e2095;return _0x233a83;})[_0x6e70('0x22')](respondWithFilteredResult(_0x3222a2,_0x98c683))['catch'](handleError(_0x3222a2,null));};exports[_0x6e70('0x54')]=function(_0x3836e4,_0x4b351e){var _0x53efc3={'raw':![],'where':{'id':_0x3836e4[_0x6e70('0x55')]['id']}},_0x333abd={};_0x333abd[_0x6e70('0x46')]=_['keys'](db['FreshsalesAccount'][_0x6e70('0x3e')]);_0x333abd[_0x6e70('0x42')]=_[_0x6e70('0x43')](_0x3836e4[_0x6e70('0x42')]);_0x333abd[_0x6e70('0x44')]=_[_0x6e70('0x45')](_0x333abd['model'],_0x333abd[_0x6e70('0x42')]);_0x53efc3[_0x6e70('0x47')]=_[_0x6e70('0x45')](_0x333abd[_0x6e70('0x46')],qs[_0x6e70('0x48')](_0x3836e4['query']['fields']));_0x53efc3[_0x6e70('0x47')]=_0x53efc3[_0x6e70('0x47')][_0x6e70('0x56')]?_0x53efc3[_0x6e70('0x47')]:_0x333abd[_0x6e70('0x46')];if(_0x3836e4['query'][_0x6e70('0x51')]){_0x53efc3[_0x6e70('0x52')]=[{'all':!![]}];}_0x53efc3=_[_0x6e70('0x4e')]({},_0x53efc3,_0x3836e4[_0x6e70('0x50')]);return db[_0x6e70('0x3d')]['find'](_0x53efc3)[_0x6e70('0x22')](handleEntityNotFound(_0x4b351e,null))[_0x6e70('0x22')](respondWithResult(_0x4b351e,null))[_0x6e70('0x2c')](handleError(_0x4b351e,null));};exports[_0x6e70('0x57')]=function(_0x8ef4f7,_0x3fd03d){return db['FreshsalesAccount'][_0x6e70('0x57')](_0x8ef4f7[_0x6e70('0x58')],{})['then'](respondWithResult(_0x3fd03d,0xc9))[_0x6e70('0x2c')](handleError(_0x3fd03d,null));};exports[_0x6e70('0x59')]=function(_0x54efdf,_0x3cfaa9){if(_0x54efdf[_0x6e70('0x58')]['id']){delete _0x54efdf[_0x6e70('0x58')]['id'];}return db[_0x6e70('0x3d')][_0x6e70('0x5a')]({'where':{'id':_0x54efdf['params']['id']}})[_0x6e70('0x22')](handleEntityNotFound(_0x3cfaa9,null))[_0x6e70('0x22')](saveUpdates(_0x54efdf[_0x6e70('0x58')],null))[_0x6e70('0x22')](respondWithResult(_0x3cfaa9,null))[_0x6e70('0x2c')](handleError(_0x3cfaa9,null));};exports[_0x6e70('0x37')]=function(_0x14643b,_0x2e2587){return db[_0x6e70('0x3d')][_0x6e70('0x5a')]({'where':{'id':_0x14643b[_0x6e70('0x55')]['id']}})[_0x6e70('0x22')](handleEntityNotFound(_0x2e2587,null))[_0x6e70('0x22')](removeEntity(_0x2e2587,null))[_0x6e70('0x2c')](handleError(_0x2e2587,null));};exports[_0x6e70('0x5b')]=function(_0x2240a1,_0x324fa6,_0x4329a6){var _0x2a8627={};var _0x1c7dca={};var _0x4c6aab;var _0x28898a;return db[_0x6e70('0x3d')][_0x6e70('0x5c')]({'where':{'id':_0x2240a1[_0x6e70('0x55')]['id']}})[_0x6e70('0x22')](handleEntityNotFound(_0x324fa6,null))[_0x6e70('0x22')](function(_0x5b4d5d){if(_0x5b4d5d){_0x4c6aab=_0x5b4d5d;_0x1c7dca[_0x6e70('0x46')]=_[_0x6e70('0x43')](db['FreshsalesConfiguration'][_0x6e70('0x3e')]);_0x1c7dca[_0x6e70('0x42')]=_[_0x6e70('0x43')](_0x2240a1['query']);_0x1c7dca['filters']=_[_0x6e70('0x45')](_0x1c7dca[_0x6e70('0x46')],_0x1c7dca[_0x6e70('0x42')]);_0x2a8627[_0x6e70('0x47')]=_[_0x6e70('0x45')](_0x1c7dca[_0x6e70('0x46')],qs[_0x6e70('0x48')](_0x2240a1['query']['fields']));_0x2a8627[_0x6e70('0x47')]=_0x2a8627[_0x6e70('0x47')][_0x6e70('0x56')]?_0x2a8627[_0x6e70('0x47')]:_0x1c7dca['model'];_0x2a8627['order']=qs[_0x6e70('0x4c')](_0x2240a1[_0x6e70('0x42')]['sort']);_0x2a8627['where']=qs[_0x6e70('0x44')](_['pick'](_0x2240a1[_0x6e70('0x42')],_0x1c7dca[_0x6e70('0x44')]));if(_0x2240a1[_0x6e70('0x42')][_0x6e70('0x4f')]){_0x2a8627[_0x6e70('0x4d')]=_[_0x6e70('0x4e')](_0x2a8627[_0x6e70('0x4d')],{'$or':_[_0x6e70('0x3c')](_0x2a8627['attributes'],function(_0x2ed223){var _0x6a560f={};_0x6a560f[_0x2ed223]={'$like':'%'+_0x2240a1[_0x6e70('0x42')][_0x6e70('0x4f')]+'%'};return _0x6a560f;})});}_0x2a8627=_[_0x6e70('0x4e')]({},_0x2a8627,_0x2240a1['options']);return _0x4c6aab['getConfigurations'](_0x2a8627);}})['then'](function(_0x1bb338){if(_0x1bb338){_0x28898a=_0x1bb338[_0x6e70('0x56')];if(!_0x2240a1[_0x6e70('0x42')]['hasOwnProperty']('nolimit')){_0x2a8627[_0x6e70('0x32')]=qs[_0x6e70('0x32')](_0x2240a1[_0x6e70('0x42')][_0x6e70('0x32')]);_0x2a8627[_0x6e70('0x31')]=qs[_0x6e70('0x31')](_0x2240a1['query'][_0x6e70('0x31')]);}return _0x4c6aab[_0x6e70('0x5b')](_0x2a8627);}})[_0x6e70('0x22')](function(_0x82a9a){if(_0x82a9a){return _0x82a9a?{'count':_0x28898a,'rows':_0x82a9a}:null;}})['then'](respondWithResult(_0x324fa6,null))[_0x6e70('0x2c')](handleError(_0x324fa6,null));};exports['addConfiguration']=function(_0x5b4046,_0x30487b,_0x3249a5){if(_0x5b4046[_0x6e70('0x58')]['id']){delete _0x5b4046[_0x6e70('0x58')]['id'];}return db[_0x6e70('0x3d')][_0x6e70('0x5c')]({'where':{'id':_0x5b4046['params']['id']}})[_0x6e70('0x22')](handleEntityNotFound(_0x30487b,null))[_0x6e70('0x22')](function(_0x186550){if(_0x186550){_0x5b4046[_0x6e70('0x58')][_0x6e70('0x5d')]=_0x186550['id'];_0x5b4046[_0x6e70('0x58')][_0x6e70('0x5e')]=integrations[_0x6e70('0x5f')](_0x5b4046[_0x6e70('0x58')][_0x6e70('0x60')],_0x5b4046['body'][_0x6e70('0x40')]);_0x5b4046[_0x6e70('0x58')][_0x6e70('0x61')]=integrations['getDescriptions'](_0x5b4046['body'][_0x6e70('0x60')],_0x5b4046[_0x6e70('0x58')][_0x6e70('0x40')]);return db[_0x6e70('0x62')][_0x6e70('0x57')](_0x5b4046['body'],{'include':[{'model':db['FreshsalesField'],'as':_0x6e70('0x5e')},{'model':db[_0x6e70('0x63')],'as':'Descriptions'}]});}return null;})[_0x6e70('0x22')](respondWithResult(_0x30487b,null))[_0x6e70('0x2c')](handleError(_0x30487b,null));};exports[_0x6e70('0x64')]=function(_0x3280ea,_0x3b01c9,_0x44bf96){var _0x46ba13='';var _0x150e57='';return db[_0x6e70('0x3d')][_0x6e70('0x5c')]({'where':{'id':_0x3280ea[_0x6e70('0x55')]['id']},'attributes':['id',_0x6e70('0x65'),_0x6e70('0x66'),_0x6e70('0x67')]})['then'](handleEntityNotFound(_0x3b01c9,null))['then'](function(_0x39ed95){if(_0x39ed95){_0x150e57=_0x39ed95['username'];_0x46ba13=_0x39ed95[_0x6e70('0x66')];var _0x4b2d40=_0x39ed95['remoteUri'][_0x6e70('0x68')](-0x1);if(_0x4b2d40==='/'){_0x46ba13=_0x46ba13['substring'](0x0,_0x46ba13['lastIndexOf'](_0x4b2d40));}return rp({'method':_0x6e70('0x69'),'uri':util[_0x6e70('0x6a')](_0x6e70('0x6b'),_0x46ba13,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x39ed95['apiKey']},'json':!![]});}})[_0x6e70('0x22')](function(_0x512b0a){if(_0x512b0a){var _0x2e8ed3=_0x512b0a[_0x6e70('0x6c')];var _0xb1b480=![];var _0x3fe93d=null;for(_0x3fe93d=0x0;_0x3fe93d<_0x2e8ed3[_0x6e70('0x56')];_0x3fe93d++){if(_0x2e8ed3[_0x3fe93d][_0x6e70('0x6d')]===_0x150e57){_0xb1b480=!![];}}if(_0xb1b480){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x6e70('0x6e')});}}})['then'](respondWithResult(_0x3b01c9,null))[_0x6e70('0x2c')](function(_0x2493b0){var _0xb649a6=_0x3280ea['query'][_0x6e70('0x6f')]?0x1f4:_0x2493b0[_0x6e70('0x70')]||0x1f4;logger[_0x6e70('0x27')](_0x6e70('0x71'),_0x6e70('0x64'),_0xb649a6,JSON[_0x6e70('0x26')](_0x2493b0));delete _0x2493b0[_0x6e70('0x3a')];if(_0xb649a6===0x191){_0xb649a6=0x190;}_0x3b01c9[_0x6e70('0x2d')](_0xb649a6)[_0x6e70('0x3b')](_0x3280ea['query'][_0x6e70('0x6f')]?{'message':_0x6e70('0x72'),'statusCode':_0x2493b0['statusCode']}:_0x2493b0);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 6cdb623..f67df0e 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 _0xb749=['../../components/integrations/configuration','exports','FreshsalesAccount','int_freshsales_accounts','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes'];(function(_0x161106,_0x37ef28){var _0x2fa2ac=function(_0xee9ef9){while(--_0xee9ef9){_0x161106['push'](_0x161106['shift']());}};_0x2fa2ac(++_0x37ef28);}(_0xb749,0xac));var _0x9b74=function(_0x3adf53,_0x22f84d){_0x3adf53=_0x3adf53-0x0;var _0x3cd7c8=_0xb749[_0x3adf53];return _0x3cd7c8;};'use strict';var _=require(_0x9b74('0x0'));var util=require('util');var logger=require(_0x9b74('0x1'))(_0x9b74('0x2'));var moment=require('moment');var BPromise=require(_0x9b74('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b74('0x4'));var rimraf=require(_0x9b74('0x5'));var config=require(_0x9b74('0x6'));var attributes=require(_0x9b74('0x7'));var integrations=require(_0x9b74('0x8'));module[_0x9b74('0x9')]=function(_0x4923c3,_0x24da1a){return _0x4923c3['define'](_0x9b74('0xa'),attributes,{'tableName':_0x9b74('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd78=['exports','lodash','util','api','moment','bluebird','request-promise','./intFreshsalesAccount.attributes'];(function(_0x5b81a0,_0x1963a3){var _0x296231=function(_0x1fe245){while(--_0x1fe245){_0x5b81a0['push'](_0x5b81a0['shift']());}};_0x296231(++_0x1963a3);}(_0xcd78,0xa9));var _0x8cd7=function(_0x390657,_0x158f6d){_0x390657=_0x390657-0x0;var _0x25c86f=_0xcd78[_0x390657];return _0x25c86f;};'use strict';var _=require(_0x8cd7('0x0'));var util=require(_0x8cd7('0x1'));var logger=require('../../config/logger')(_0x8cd7('0x2'));var moment=require(_0x8cd7('0x3'));var BPromise=require(_0x8cd7('0x4'));var rp=require(_0x8cd7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8cd7('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x8cd7('0x7')]=function(_0x1b590b,_0x458157){return _0x1b590b['define']('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','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 8bf02f2..c1b9fcf 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 _0xbb61=['client','request','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','limit','include','map','find','model','ShowFreshsalesAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x46be2c,_0x3a2e90){var _0x55f457=function(_0x1199f5){while(--_0x1199f5){_0x46be2c['push'](_0x46be2c['shift']());}};_0x55f457(++_0x3a2e90);}(_0xbb61,0x131));var _0x1bb6=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xbb61[_0xd09668];return _0x68726;};'use strict';var _=require(_0x1bb6('0x0'));var util=require('util');var moment=require(_0x1bb6('0x1'));var BPromise=require(_0x1bb6('0x2'));var rs=require(_0x1bb6('0x3'));var fs=require('fs');var Redis=require(_0x1bb6('0x4'));var db=require(_0x1bb6('0x5'))['db'];var utils=require(_0x1bb6('0x6'));var logger=require(_0x1bb6('0x7'))('rpc');var config=require(_0x1bb6('0x8'));var jayson=require(_0x1bb6('0x9'));var client=jayson[_0x1bb6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x362383,_0x4629d0,_0x24d6b9){return new BPromise(function(_0x59a152,_0x13e2da){return client[_0x1bb6('0xb')](_0x362383,_0x24d6b9)[_0x1bb6('0xc')](function(_0xe56199){logger[_0x1bb6('0xd')](_0x1bb6('0xe'),_0x4629d0,'request\x20sent');logger[_0x1bb6('0xf')](_0x1bb6('0x10'),_0x4629d0,'request\x20sent',JSON[_0x1bb6('0x11')](_0xe56199));if(_0xe56199['error']){if(_0xe56199['error']['code']===0x1f4){logger['error'](_0x1bb6('0xe'),_0x4629d0,_0xe56199[_0x1bb6('0x12')]['message']);return _0x13e2da(_0xe56199['error'][_0x1bb6('0x13')]);}logger[_0x1bb6('0x12')](_0x1bb6('0xe'),_0x4629d0,_0xe56199[_0x1bb6('0x12')][_0x1bb6('0x13')]);return _0x59a152(_0xe56199[_0x1bb6('0x12')][_0x1bb6('0x13')]);}else{logger[_0x1bb6('0xd')]('FreshsalesAccount,\x20%s,\x20%s',_0x4629d0,_0x1bb6('0x14'));_0x59a152(_0xe56199[_0x1bb6('0x15')][_0x1bb6('0x13')]);}})[_0x1bb6('0x16')](function(_0x583711){logger['error'](_0x1bb6('0xe'),_0x4629d0,_0x583711);_0x13e2da(_0x583711);});});}exports[_0x1bb6('0x17')]=function(_0x9e046a){var _0x5015bf=this;return new Promise(function(_0x2233a3,_0x50efc8){return db[_0x1bb6('0x18')]['findAll']({'raw':_0x9e046a[_0x1bb6('0x19')]?_0x9e046a[_0x1bb6('0x19')][_0x1bb6('0x1a')]===undefined?!![]:![]:!![],'where':_0x9e046a[_0x1bb6('0x19')]?_0x9e046a[_0x1bb6('0x19')][_0x1bb6('0x1b')]||null:null,'attributes':_0x9e046a[_0x1bb6('0x19')]?_0x9e046a[_0x1bb6('0x19')][_0x1bb6('0x1c')]||null:null,'limit':_0x9e046a['options']?_0x9e046a[_0x1bb6('0x19')][_0x1bb6('0x1d')]||null:null,'include':_0x9e046a['options']?_0x9e046a[_0x1bb6('0x19')][_0x1bb6('0x1e')]?_[_0x1bb6('0x1f')](_0x9e046a[_0x1bb6('0x19')]['include'],function(_0x4b5be5){return{'model':db[_0x4b5be5['model']],'as':_0x4b5be5['as'],'attributes':_0x4b5be5['attributes'],'include':_0x4b5be5['include']?_[_0x1bb6('0x1f')](_0x4b5be5[_0x1bb6('0x1e')],function(_0x104bf5){return{'model':db[_0x104bf5['model']],'as':_0x104bf5['as'],'attributes':_0x104bf5[_0x1bb6('0x1c')],'include':_0x104bf5[_0x1bb6('0x1e')]?_[_0x1bb6('0x1f')](_0x104bf5[_0x1bb6('0x1e')],function(_0x276be9){return{'model':db[_0x276be9['model']],'as':_0x276be9['as'],'attributes':_0x276be9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x736c70){logger['info']('GetFreshsalesAccount',_0x9e046a);logger[_0x1bb6('0xf')]('GetFreshsalesAccount',_0x9e046a,JSON['stringify'](_0x736c70));_0x2233a3(_0x736c70);})[_0x1bb6('0x16')](function(_0xf42d9){logger[_0x1bb6('0x12')](_0x1bb6('0x17'),_0xf42d9['message'],_0x9e046a);_0x50efc8(_0x5015bf[_0x1bb6('0x12')](0x1f4,_0xf42d9[_0x1bb6('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0x38a385){var _0x17bdf8=this;return new Promise(function(_0x47fc5d,_0x5edd9e){return db[_0x1bb6('0x18')][_0x1bb6('0x20')]({'raw':_0x38a385[_0x1bb6('0x19')]?_0x38a385[_0x1bb6('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x38a385[_0x1bb6('0x19')]?_0x38a385[_0x1bb6('0x19')]['where']||null:null,'attributes':_0x38a385[_0x1bb6('0x19')]?_0x38a385[_0x1bb6('0x19')][_0x1bb6('0x1c')]||null:null,'include':_0x38a385['options']?_0x38a385[_0x1bb6('0x19')][_0x1bb6('0x1e')]?_[_0x1bb6('0x1f')](_0x38a385['options']['include'],function(_0x18eb00){return{'model':db[_0x18eb00[_0x1bb6('0x21')]],'as':_0x18eb00['as'],'attributes':_0x18eb00['attributes'],'include':_0x18eb00[_0x1bb6('0x1e')]?_['map'](_0x18eb00[_0x1bb6('0x1e')],function(_0x32f4f1){return{'model':db[_0x32f4f1[_0x1bb6('0x21')]],'as':_0x32f4f1['as'],'attributes':_0x32f4f1[_0x1bb6('0x1c')],'include':_0x32f4f1[_0x1bb6('0x1e')]?_[_0x1bb6('0x1f')](_0x32f4f1[_0x1bb6('0x1e')],function(_0x5ed22d){return{'model':db[_0x5ed22d[_0x1bb6('0x21')]],'as':_0x5ed22d['as'],'attributes':_0x5ed22d[_0x1bb6('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18c989){logger[_0x1bb6('0xd')](_0x1bb6('0x22'),_0x38a385);logger[_0x1bb6('0xf')](_0x1bb6('0x22'),_0x38a385,JSON[_0x1bb6('0x11')](_0x18c989));_0x47fc5d(_0x18c989);})[_0x1bb6('0x16')](function(_0xd30f83){logger['error'](_0x1bb6('0x22'),_0xd30f83[_0x1bb6('0x13')],_0x38a385);_0x5edd9e(_0x17bdf8['error'](0x1f4,_0xd30f83[_0x1bb6('0x13')]));});});}; \ No newline at end of file +var _0xe635=['catch','GetFreshsalesAccount','findAll','raw','options','where','attributes','limit','include','model','map','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1c3238,_0x59db54){var _0x1b77d6=function(_0x1bf1d2){while(--_0x1bf1d2){_0x1c3238['push'](_0x1c3238['shift']());}};_0x1b77d6(++_0x59db54);}(_0xe635,0x1be));var _0x5e63=function(_0x302bd3,_0x79bc79){_0x302bd3=_0x302bd3-0x0;var _0x2d4fb8=_0xe635[_0x302bd3];return _0x2d4fb8;};'use strict';var _=require(_0x5e63('0x0'));var util=require(_0x5e63('0x1'));var moment=require(_0x5e63('0x2'));var BPromise=require(_0x5e63('0x3'));var rs=require(_0x5e63('0x4'));var fs=require('fs');var Redis=require(_0x5e63('0x5'));var db=require(_0x5e63('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5e63('0x7'));var config=require(_0x5e63('0x8'));var jayson=require(_0x5e63('0x9'));var client=jayson[_0x5e63('0xa')][_0x5e63('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d15fb,_0x1ba31c,_0xa99472){return new BPromise(function(_0xaac91f,_0x3d444e){return client['request'](_0x2d15fb,_0xa99472)[_0x5e63('0xc')](function(_0x13501d){logger[_0x5e63('0xd')](_0x5e63('0xe'),_0x1ba31c,'request\x20sent');logger[_0x5e63('0xf')](_0x5e63('0x10'),_0x1ba31c,'request\x20sent',JSON[_0x5e63('0x11')](_0x13501d));if(_0x13501d[_0x5e63('0x12')]){if(_0x13501d['error'][_0x5e63('0x13')]===0x1f4){logger['error'](_0x5e63('0xe'),_0x1ba31c,_0x13501d[_0x5e63('0x12')][_0x5e63('0x14')]);return _0x3d444e(_0x13501d[_0x5e63('0x12')]['message']);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x1ba31c,_0x13501d[_0x5e63('0x12')][_0x5e63('0x14')]);return _0xaac91f(_0x13501d['error'][_0x5e63('0x14')]);}else{logger[_0x5e63('0xd')](_0x5e63('0xe'),_0x1ba31c,'request\x20sent');_0xaac91f(_0x13501d[_0x5e63('0x15')][_0x5e63('0x14')]);}})[_0x5e63('0x16')](function(_0x357f40){logger[_0x5e63('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x1ba31c,_0x357f40);_0x3d444e(_0x357f40);});});}exports[_0x5e63('0x17')]=function(_0x42b370){var _0x264aca=this;return new Promise(function(_0xbdcef0,_0xdf5019){return db['FreshsalesAccount'][_0x5e63('0x18')]({'raw':_0x42b370['options']?_0x42b370['options'][_0x5e63('0x19')]===undefined?!![]:![]:!![],'where':_0x42b370[_0x5e63('0x1a')]?_0x42b370[_0x5e63('0x1a')][_0x5e63('0x1b')]||null:null,'attributes':_0x42b370[_0x5e63('0x1a')]?_0x42b370[_0x5e63('0x1a')][_0x5e63('0x1c')]||null:null,'limit':_0x42b370[_0x5e63('0x1a')]?_0x42b370[_0x5e63('0x1a')][_0x5e63('0x1d')]||null:null,'include':_0x42b370['options']?_0x42b370[_0x5e63('0x1a')]['include']?_['map'](_0x42b370[_0x5e63('0x1a')][_0x5e63('0x1e')],function(_0x2d9387){return{'model':db[_0x2d9387[_0x5e63('0x1f')]],'as':_0x2d9387['as'],'attributes':_0x2d9387[_0x5e63('0x1c')],'include':_0x2d9387[_0x5e63('0x1e')]?_[_0x5e63('0x20')](_0x2d9387['include'],function(_0x275715){return{'model':db[_0x275715['model']],'as':_0x275715['as'],'attributes':_0x275715[_0x5e63('0x1c')],'include':_0x275715[_0x5e63('0x1e')]?_['map'](_0x275715[_0x5e63('0x1e')],function(_0x4fe1b3){return{'model':db[_0x4fe1b3[_0x5e63('0x1f')]],'as':_0x4fe1b3['as'],'attributes':_0x4fe1b3[_0x5e63('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e0a86){logger[_0x5e63('0xd')](_0x5e63('0x17'),_0x42b370);logger[_0x5e63('0xf')](_0x5e63('0x17'),_0x42b370,JSON[_0x5e63('0x11')](_0x4e0a86));_0xbdcef0(_0x4e0a86);})[_0x5e63('0x16')](function(_0x4b3e42){logger[_0x5e63('0x12')]('GetFreshsalesAccount',_0x4b3e42[_0x5e63('0x14')],_0x42b370);_0xdf5019(_0x264aca[_0x5e63('0x12')](0x1f4,_0x4b3e42[_0x5e63('0x14')]));});});};exports[_0x5e63('0x21')]=function(_0xfc4a65){var _0x12c804=this;return new Promise(function(_0x5db415,_0x672239){return db[_0x5e63('0x22')][_0x5e63('0x23')]({'raw':_0xfc4a65['options']?_0xfc4a65[_0x5e63('0x1a')][_0x5e63('0x19')]===undefined?!![]:![]:!![],'where':_0xfc4a65[_0x5e63('0x1a')]?_0xfc4a65[_0x5e63('0x1a')]['where']||null:null,'attributes':_0xfc4a65['options']?_0xfc4a65['options']['attributes']||null:null,'include':_0xfc4a65[_0x5e63('0x1a')]?_0xfc4a65[_0x5e63('0x1a')][_0x5e63('0x1e')]?_['map'](_0xfc4a65[_0x5e63('0x1a')][_0x5e63('0x1e')],function(_0x4a264f){return{'model':db[_0x4a264f[_0x5e63('0x1f')]],'as':_0x4a264f['as'],'attributes':_0x4a264f[_0x5e63('0x1c')],'include':_0x4a264f[_0x5e63('0x1e')]?_[_0x5e63('0x20')](_0x4a264f['include'],function(_0x265565){return{'model':db[_0x265565['model']],'as':_0x265565['as'],'attributes':_0x265565['attributes'],'include':_0x265565[_0x5e63('0x1e')]?_[_0x5e63('0x20')](_0x265565[_0x5e63('0x1e')],function(_0x2f5664){return{'model':db[_0x2f5664['model']],'as':_0x2f5664['as'],'attributes':_0x2f5664[_0x5e63('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5e63('0xc')](function(_0x54b7c0){logger[_0x5e63('0xd')](_0x5e63('0x21'),_0xfc4a65);logger[_0x5e63('0xf')](_0x5e63('0x21'),_0xfc4a65,JSON[_0x5e63('0x11')](_0x54b7c0));_0x5db415(_0x54b7c0);})['catch'](function(_0x1929d5){logger['error'](_0x5e63('0x21'),_0x1929d5['message'],_0xfc4a65);_0x672239(_0x12c804[_0x5e63('0x12')](0x1f4,_0x1929d5[_0x5e63('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index e063083..5a31713 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 _0x46ee=['update','delete','multer','util','connect-timeout','express','Router','../../components/auth/service','get','/:id','isAuthenticated','show','/:id/subjects','getDescriptions','/:id/fields','getFields','post','create','put'];(function(_0x44ceee,_0x2a5e28){var _0x1a065c=function(_0x24ec16){while(--_0x24ec16){_0x44ceee['push'](_0x44ceee['shift']());}};_0x1a065c(++_0x2a5e28);}(_0x46ee,0x10c));var _0xe46e=function(_0x12c061,_0x412c23){_0x12c061=_0x12c061-0x0;var _0x8984f6=_0x46ee[_0x12c061];return _0x8984f6;};'use strict';var multer=require(_0xe46e('0x0'));var util=require(_0xe46e('0x1'));var path=require('path');var timeout=require(_0xe46e('0x2'));var express=require(_0xe46e('0x3'));var router=express[_0xe46e('0x4')]();var auth=require(_0xe46e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshsalesConfiguration.controller');router[_0xe46e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xe46e('0x7'),auth[_0xe46e('0x8')](),controller[_0xe46e('0x9')]);router[_0xe46e('0x6')](_0xe46e('0xa'),auth[_0xe46e('0x8')](),controller['getSubjects']);router[_0xe46e('0x6')]('/:id/descriptions',auth[_0xe46e('0x8')](),controller[_0xe46e('0xb')]);router['get'](_0xe46e('0xc'),auth[_0xe46e('0x8')](),controller[_0xe46e('0xd')]);router[_0xe46e('0xe')]('/',auth['isAuthenticated'](),controller[_0xe46e('0xf')]);router[_0xe46e('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xe46e('0x11')]);router[_0xe46e('0x12')](_0xe46e('0x7'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf9d2=['destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','getFields','post','create','put','update','delete'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0xf9d2,0x169));var _0x2f9d=function(_0x953880,_0x3b53d8){_0x953880=_0x953880-0x0;var _0xb989c7=_0xf9d2[_0x953880];return _0xb989c7;};'use strict';var multer=require('multer');var util=require(_0x2f9d('0x0'));var path=require(_0x2f9d('0x1'));var timeout=require(_0x2f9d('0x2'));var express=require(_0x2f9d('0x3'));var router=express[_0x2f9d('0x4')]();var auth=require(_0x2f9d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2f9d('0x6'));var controller=require(_0x2f9d('0x7'));router[_0x2f9d('0x8')]('/',auth[_0x2f9d('0x9')](),controller[_0x2f9d('0xa')]);router[_0x2f9d('0x8')](_0x2f9d('0xb'),auth[_0x2f9d('0x9')](),controller[_0x2f9d('0xc')]);router['get'](_0x2f9d('0xd'),auth['isAuthenticated'](),controller[_0x2f9d('0xe')]);router[_0x2f9d('0x8')](_0x2f9d('0xf'),auth[_0x2f9d('0x9')](),controller['getDescriptions']);router['get'](_0x2f9d('0x10'),auth[_0x2f9d('0x9')](),controller[_0x2f9d('0x11')]);router[_0x2f9d('0x12')]('/',auth[_0x2f9d('0x9')](),controller[_0x2f9d('0x13')]);router[_0x2f9d('0x14')](_0x2f9d('0xb'),auth['isAuthenticated'](),controller[_0x2f9d('0x15')]);router[_0x2f9d('0x16')]('/:id',auth[_0x2f9d('0x9')](),controller[_0x2f9d('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 0bddb16..b143b7c 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 _0x4f1e=['sequelize','exports','STRING'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x4f1e,0x150));var _0xe4f1=function(_0x591bc9,_0x11d251){_0x591bc9=_0x591bc9-0x0;var _0x5c6376=_0x4f1e[_0x591bc9];return _0x5c6376;};'use strict';var Sequelize=require(_0xe4f1('0x0'));module[_0xe4f1('0x1')]={'name':{'type':Sequelize[_0xe4f1('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x77dd=['exports','STRING','sequelize'];(function(_0x4a450a,_0x54d42f){var _0x28baf9=function(_0x5cb70a){while(--_0x5cb70a){_0x4a450a['push'](_0x4a450a['shift']());}};_0x28baf9(++_0x54d42f);}(_0x77dd,0x10d));var _0xd77d=function(_0xfb42e6,_0x5f5d4b){_0xfb42e6=_0xfb42e6-0x0;var _0x27265b=_0x77dd[_0xfb42e6];return _0x27265b;};'use strict';var Sequelize=require(_0xd77d('0x0'));module[_0xd77d('0x1')]={'name':{'type':Sequelize[_0xd77d('0x2')]},'description':{'type':Sequelize[_0xd77d('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index f30cda9..f51bcbd 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 _0x53ec=['rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','order','sort','filters','pick','where','type','VIRTUAL','filter','FreshsalesConfiguration','count','includeAll','include','rows','catch','show','length','options','find','create','body','params','getSubjects','FreshsalesField','merge','hasOwnProperty','nolimit','getDescriptions','findOne','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','end','status','json','offset','limit','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','index','map'];(function(_0x389238,_0x26a94d){var _0xf2ee3c=function(_0x1b2a28){while(--_0x1b2a28){_0x389238['push'](_0x389238['shift']());}};_0xf2ee3c(++_0x26a94d);}(_0x53ec,0x192));var _0xc53e=function(_0x572165,_0x6a45cc){_0x572165=_0x572165-0x0;var _0x8c8709=_0x53ec[_0x572165];return _0x8c8709;};'use strict';var pdf=require(_0xc53e('0x0'));var emlformat=require(_0xc53e('0x1'));var rimraf=require(_0xc53e('0x2'));var zipdir=require(_0xc53e('0x3'));var jsonpatch=require(_0xc53e('0x4'));var rp=require(_0xc53e('0x5'));var moment=require('moment');var BPromise=require(_0xc53e('0x6'));var Mustache=require('mustache');var util=require(_0xc53e('0x7'));var path=require(_0xc53e('0x8'));var sox=require('sox');var csv=require(_0xc53e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0x9'));var querystring=require(_0xc53e('0xe'));var Papa=require(_0xc53e('0xf'));var Redis=require(_0xc53e('0x10'));var authService=require(_0xc53e('0x11'));var qs=require(_0xc53e('0x12'));var as=require(_0xc53e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x15'));var db=require(_0xc53e('0x16'))['db'];var jayson=require(_0xc53e('0x17'));var client=jayson[_0xc53e('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e74c9,_0x1c06cd,_0x19a772,_0x7cd798){return new BPromise(function(_0x3d2e17,_0x358ef3){var _0x382e87=_0x7cd798||client;return _0x382e87[_0xc53e('0x19')](_0x4e74c9,_0x19a772)[_0xc53e('0x1a')](function(_0x455e4d){logger[_0xc53e('0x1b')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1c06cd,_0xc53e('0x1c'));logger[_0xc53e('0x1d')](_0xc53e('0x1e'),_0x1c06cd,_0xc53e('0x1c'),JSON[_0xc53e('0x1f')](_0x455e4d));if(_0x455e4d[_0xc53e('0x20')]){if(_0x455e4d[_0xc53e('0x20')][_0xc53e('0x21')]===0x1f4){logger[_0xc53e('0x20')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1c06cd,_0x455e4d['error'][_0xc53e('0x22')]);return _0x358ef3(_0x455e4d[_0xc53e('0x20')][_0xc53e('0x22')]);}logger[_0xc53e('0x20')](_0xc53e('0x23'),_0x1c06cd,_0x455e4d[_0xc53e('0x20')][_0xc53e('0x22')]);return _0x3d2e17(_0x455e4d[_0xc53e('0x20')][_0xc53e('0x22')]);}else{logger[_0xc53e('0x1b')](_0xc53e('0x23'),_0x1c06cd,_0xc53e('0x1c'));_0x3d2e17(_0x455e4d[_0xc53e('0x24')]['message']);}})['catch'](function(_0x531ede){logger[_0xc53e('0x20')](_0xc53e('0x23'),_0x1c06cd,_0x531ede);_0x358ef3(_0x531ede);});});}function respondWithStatusCode(_0x7591c1,_0x4015c8){_0x4015c8=_0x4015c8||0xcc;return function(_0x180811){if(_0x180811){return _0x7591c1['sendStatus'](_0x4015c8);}return _0x7591c1['status'](_0x4015c8)[_0xc53e('0x25')]();};}function respondWithResult(_0x496167,_0x1ae55e){_0x1ae55e=_0x1ae55e||0xc8;return function(_0x3a5ce8){if(_0x3a5ce8){return _0x496167[_0xc53e('0x26')](_0x1ae55e)[_0xc53e('0x27')](_0x3a5ce8);}};}function respondWithFilteredResult(_0x63c5dc,_0x4df8cf){return function(_0x398e7a){if(_0x398e7a){var _0x4b9f6a=_0x398e7a['count'],_0x4d9a68=_0x4df8cf[_0xc53e('0x28')],_0x5c65d3=_0x4df8cf['offset']+_0x4df8cf[_0xc53e('0x29')],_0x3c5056;if(_0x5c65d3>=_0x4b9f6a){_0x5c65d3=_0x4b9f6a;_0x3c5056=0xc8;}else{_0x3c5056=0xce;}_0x63c5dc['status'](_0x3c5056);return _0x63c5dc['set'](_0xc53e('0x2a'),_0x4d9a68+'-'+_0x5c65d3+'/'+_0x4b9f6a)[_0xc53e('0x27')](_0x398e7a);}return null;};}function patchUpdates(_0x42dec1){return function(_0x2fa20b){try{jsonpatch[_0xc53e('0x2b')](_0x2fa20b,_0x42dec1,!![]);}catch(_0xf97d78){return BPromise[_0xc53e('0x2c')](_0xf97d78);}return _0x2fa20b[_0xc53e('0x2d')]();};}function saveUpdates(_0x4ace0b,_0x437893){return function(_0x311835){if(_0x311835){return _0x311835[_0xc53e('0x2e')](_0x4ace0b)['then'](function(_0x4057f9){return _0x4057f9;});}return null;};}function removeEntity(_0x495756,_0x4572e){return function(_0x2467f4){if(_0x2467f4){return _0x2467f4['destroy']()['then'](function(){_0x495756[_0xc53e('0x26')](0xcc)[_0xc53e('0x25')]();});}};}function handleEntityNotFound(_0x3f4547,_0x30d037){return function(_0x1b95c2){if(!_0x1b95c2){_0x3f4547[_0xc53e('0x2f')](0x194);}return _0x1b95c2;};}function handleError(_0x40a8db,_0x168d25){_0x168d25=_0x168d25||0x1f4;return function(_0x4ffddc){logger[_0xc53e('0x20')](_0x4ffddc[_0xc53e('0x30')]);if(_0x4ffddc[_0xc53e('0x31')]){delete _0x4ffddc[_0xc53e('0x31')];}_0x40a8db[_0xc53e('0x26')](_0x168d25)[_0xc53e('0x32')](_0x4ffddc);};}exports[_0xc53e('0x33')]=function(_0x16942c,_0x215abe){var _0x595efb={},_0x3e395c={},_0x48d7d0={'count':0x0,'rows':[]};var _0x1059f3=_[_0xc53e('0x34')](db['FreshsalesConfiguration'][_0xc53e('0x35')],function(_0x154f8b){return{'name':_0x154f8b[_0xc53e('0x36')],'type':_0x154f8b['type'][_0xc53e('0x37')]};});_0x3e395c[_0xc53e('0x38')]=_[_0xc53e('0x34')](_0x1059f3,_0xc53e('0x31'));_0x3e395c[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x16942c[_0xc53e('0x39')]);_0x3e395c['filters']=_[_0xc53e('0x3b')](_0x3e395c[_0xc53e('0x38')],_0x3e395c[_0xc53e('0x39')]);_0x595efb['attributes']=_[_0xc53e('0x3b')](_0x3e395c['model'],qs[_0xc53e('0x3c')](_0x16942c[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x595efb[_0xc53e('0x3d')]=_0x595efb[_0xc53e('0x3d')]['length']?_0x595efb[_0xc53e('0x3d')]:_0x3e395c[_0xc53e('0x38')];if(!_0x16942c['query']['hasOwnProperty']('nolimit')){_0x595efb['limit']=qs[_0xc53e('0x29')](_0x16942c[_0xc53e('0x39')]['limit']);_0x595efb[_0xc53e('0x28')]=qs['offset'](_0x16942c['query']['offset']);}_0x595efb[_0xc53e('0x3e')]=qs['sort'](_0x16942c['query'][_0xc53e('0x3f')]);_0x595efb['where']=qs[_0xc53e('0x40')](_[_0xc53e('0x41')](_0x16942c['query'],_0x3e395c[_0xc53e('0x40')]),_0x1059f3);if(_0x16942c[_0xc53e('0x39')]['filter']){_0x595efb[_0xc53e('0x42')]=_['merge'](_0x595efb['where'],{'$or':_['map'](_0x1059f3,function(_0x4efee5){if(_0x4efee5[_0xc53e('0x43')]!==_0xc53e('0x44')){var _0x3b2834={};_0x3b2834[_0x4efee5['name']]={'$like':'%'+_0x16942c[_0xc53e('0x39')][_0xc53e('0x45')]+'%'};return _0x3b2834;}})});}_0x595efb=_['merge']({},_0x595efb,_0x16942c['options']);var _0x3ea11a={'where':_0x595efb[_0xc53e('0x42')]};return db[_0xc53e('0x46')]['count'](_0x3ea11a)[_0xc53e('0x1a')](function(_0x1fb82c){_0x48d7d0[_0xc53e('0x47')]=_0x1fb82c;if(_0x16942c[_0xc53e('0x39')][_0xc53e('0x48')]){_0x595efb[_0xc53e('0x49')]=[{'all':!![]}];}return db[_0xc53e('0x46')]['findAll'](_0x595efb);})[_0xc53e('0x1a')](function(_0x39c467){_0x48d7d0[_0xc53e('0x4a')]=_0x39c467;return _0x48d7d0;})['then'](respondWithFilteredResult(_0x215abe,_0x595efb))[_0xc53e('0x4b')](handleError(_0x215abe,null));};exports[_0xc53e('0x4c')]=function(_0x4458c8,_0x15e744){var _0xa7d256={'raw':![],'where':{'id':_0x4458c8['params']['id']}},_0x17cea5={};_0x17cea5[_0xc53e('0x38')]=_[_0xc53e('0x3a')](db[_0xc53e('0x46')]['rawAttributes']);_0x17cea5[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x4458c8[_0xc53e('0x39')]);_0x17cea5[_0xc53e('0x40')]=_[_0xc53e('0x3b')](_0x17cea5[_0xc53e('0x38')],_0x17cea5[_0xc53e('0x39')]);_0xa7d256[_0xc53e('0x3d')]=_[_0xc53e('0x3b')](_0x17cea5[_0xc53e('0x38')],qs['fields'](_0x4458c8[_0xc53e('0x39')][_0xc53e('0x3c')]));_0xa7d256[_0xc53e('0x3d')]=_0xa7d256[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0xa7d256['attributes']:_0x17cea5['model'];if(_0x4458c8[_0xc53e('0x39')]['includeAll']){_0xa7d256[_0xc53e('0x49')]=[{'all':!![]}];}_0xa7d256=_['merge']({},_0xa7d256,_0x4458c8[_0xc53e('0x4e')]);return db[_0xc53e('0x46')][_0xc53e('0x4f')](_0xa7d256)['then'](handleEntityNotFound(_0x15e744,null))[_0xc53e('0x1a')](respondWithResult(_0x15e744,null))[_0xc53e('0x4b')](handleError(_0x15e744,null));};exports[_0xc53e('0x50')]=function(_0x4843ce,_0x2f7df2){return db['FreshsalesConfiguration'][_0xc53e('0x50')](_0x4843ce[_0xc53e('0x51')],{})['then'](respondWithResult(_0x2f7df2,0xc9))[_0xc53e('0x4b')](handleError(_0x2f7df2,null));};exports[_0xc53e('0x2e')]=function(_0x5bba72,_0x44f7cc){if(_0x5bba72[_0xc53e('0x51')]['id']){delete _0x5bba72[_0xc53e('0x51')]['id'];}return db[_0xc53e('0x46')][_0xc53e('0x4f')]({'where':{'id':_0x5bba72[_0xc53e('0x52')]['id']}})[_0xc53e('0x1a')](handleEntityNotFound(_0x44f7cc,null))[_0xc53e('0x1a')](saveUpdates(_0x5bba72[_0xc53e('0x51')],null))[_0xc53e('0x1a')](respondWithResult(_0x44f7cc,null))[_0xc53e('0x4b')](handleError(_0x44f7cc,null));};exports['destroy']=function(_0x8364f6,_0x4a2543){return db[_0xc53e('0x46')]['find']({'where':{'id':_0x8364f6[_0xc53e('0x52')]['id']}})[_0xc53e('0x1a')](handleEntityNotFound(_0x4a2543,null))['then'](removeEntity(_0x4a2543,null))[_0xc53e('0x4b')](handleError(_0x4a2543,null));};exports[_0xc53e('0x53')]=function(_0x9c0112,_0x432a91,_0x53083b){var _0x41c46c={};var _0x335427={};var _0x4ae0d4;var _0x5ea1da;return db[_0xc53e('0x46')]['findOne']({'where':{'id':_0x9c0112['params']['id']}})['then'](handleEntityNotFound(_0x432a91,null))[_0xc53e('0x1a')](function(_0x5f5dad){if(_0x5f5dad){_0x4ae0d4=_0x5f5dad;_0x335427[_0xc53e('0x38')]=_['keys'](db[_0xc53e('0x54')][_0xc53e('0x35')]);_0x335427[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x9c0112[_0xc53e('0x39')]);_0x335427['filters']=_['intersection'](_0x335427[_0xc53e('0x38')],_0x335427[_0xc53e('0x39')]);_0x41c46c[_0xc53e('0x3d')]=_[_0xc53e('0x3b')](_0x335427[_0xc53e('0x38')],qs[_0xc53e('0x3c')](_0x9c0112[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x41c46c[_0xc53e('0x3d')]=_0x41c46c[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0x41c46c[_0xc53e('0x3d')]:_0x335427[_0xc53e('0x38')];_0x41c46c['order']=qs[_0xc53e('0x3f')](_0x9c0112['query'][_0xc53e('0x3f')]);_0x41c46c[_0xc53e('0x42')]=qs[_0xc53e('0x40')](_[_0xc53e('0x41')](_0x9c0112[_0xc53e('0x39')],_0x335427[_0xc53e('0x40')]));if(_0x9c0112[_0xc53e('0x39')][_0xc53e('0x45')]){_0x41c46c['where']=_['merge'](_0x41c46c['where'],{'$or':_[_0xc53e('0x34')](_0x41c46c[_0xc53e('0x3d')],function(_0x37ac78){var _0x25e4b6={};_0x25e4b6[_0x37ac78]={'$like':'%'+_0x9c0112[_0xc53e('0x39')][_0xc53e('0x45')]+'%'};return _0x25e4b6;})});}_0x41c46c=_[_0xc53e('0x55')]({},_0x41c46c,_0x9c0112['options']);return _0x4ae0d4['getSubjects'](_0x41c46c);}})['then'](function(_0x40c8ba){if(_0x40c8ba){_0x5ea1da=_0x40c8ba[_0xc53e('0x4d')];if(!_0x9c0112['query'][_0xc53e('0x56')](_0xc53e('0x57'))){_0x41c46c[_0xc53e('0x29')]=qs[_0xc53e('0x29')](_0x9c0112[_0xc53e('0x39')][_0xc53e('0x29')]);_0x41c46c['offset']=qs['offset'](_0x9c0112[_0xc53e('0x39')][_0xc53e('0x28')]);}return _0x4ae0d4[_0xc53e('0x53')](_0x41c46c);}})[_0xc53e('0x1a')](function(_0x29ee08){if(_0x29ee08){return _0x29ee08?{'count':_0x5ea1da,'rows':_0x29ee08}:null;}})[_0xc53e('0x1a')](respondWithResult(_0x432a91,null))['catch'](handleError(_0x432a91,null));};exports[_0xc53e('0x58')]=function(_0x15f6cb,_0x1c15a3,_0x3f3dc2){var _0x4d2609={};var _0xdd851e={};var _0xef9095;var _0x26e3ba;return db[_0xc53e('0x46')][_0xc53e('0x59')]({'where':{'id':_0x15f6cb[_0xc53e('0x52')]['id']}})['then'](handleEntityNotFound(_0x1c15a3,null))[_0xc53e('0x1a')](function(_0x134018){if(_0x134018){_0xef9095=_0x134018;_0xdd851e[_0xc53e('0x38')]=_[_0xc53e('0x3a')](db['FreshsalesField']['rawAttributes']);_0xdd851e[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x15f6cb[_0xc53e('0x39')]);_0xdd851e[_0xc53e('0x40')]=_['intersection'](_0xdd851e[_0xc53e('0x38')],_0xdd851e['query']);_0x4d2609[_0xc53e('0x3d')]=_['intersection'](_0xdd851e[_0xc53e('0x38')],qs['fields'](_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x4d2609['attributes']=_0x4d2609[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0x4d2609['attributes']:_0xdd851e['model'];_0x4d2609[_0xc53e('0x3e')]=qs[_0xc53e('0x3f')](_0x15f6cb['query']['sort']);_0x4d2609[_0xc53e('0x42')]=qs['filters'](_[_0xc53e('0x41')](_0x15f6cb['query'],_0xdd851e[_0xc53e('0x40')]));if(_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x45')]){_0x4d2609[_0xc53e('0x42')]=_[_0xc53e('0x55')](_0x4d2609[_0xc53e('0x42')],{'$or':_[_0xc53e('0x34')](_0x4d2609[_0xc53e('0x3d')],function(_0x258be8){var _0x2cd553={};_0x2cd553[_0x258be8]={'$like':'%'+_0x15f6cb['query'][_0xc53e('0x45')]+'%'};return _0x2cd553;})});}_0x4d2609=_['merge']({},_0x4d2609,_0x15f6cb[_0xc53e('0x4e')]);return _0xef9095[_0xc53e('0x58')](_0x4d2609);}})[_0xc53e('0x1a')](function(_0x2c027c){if(_0x2c027c){_0x26e3ba=_0x2c027c[_0xc53e('0x4d')];if(!_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x56')](_0xc53e('0x57'))){_0x4d2609[_0xc53e('0x29')]=qs[_0xc53e('0x29')](_0x15f6cb['query'][_0xc53e('0x29')]);_0x4d2609['offset']=qs[_0xc53e('0x28')](_0x15f6cb[_0xc53e('0x39')][_0xc53e('0x28')]);}return _0xef9095['getDescriptions'](_0x4d2609);}})[_0xc53e('0x1a')](function(_0x340db2){if(_0x340db2){return _0x340db2?{'count':_0x26e3ba,'rows':_0x340db2}:null;}})[_0xc53e('0x1a')](respondWithResult(_0x1c15a3,null))[_0xc53e('0x4b')](handleError(_0x1c15a3,null));};exports[_0xc53e('0x5a')]=function(_0x508671,_0x2601ba,_0x48e337){var _0x56c66f={};var _0x42b53b={};var _0xe1a82c;var _0x25469e;return db['FreshsalesConfiguration'][_0xc53e('0x59')]({'where':{'id':_0x508671[_0xc53e('0x52')]['id']}})['then'](handleEntityNotFound(_0x2601ba,null))[_0xc53e('0x1a')](function(_0x4699b7){if(_0x4699b7){_0xe1a82c=_0x4699b7;_0x42b53b['model']=_['keys'](db[_0xc53e('0x54')]['rawAttributes']);_0x42b53b[_0xc53e('0x39')]=_[_0xc53e('0x3a')](_0x508671[_0xc53e('0x39')]);_0x42b53b['filters']=_[_0xc53e('0x3b')](_0x42b53b[_0xc53e('0x38')],_0x42b53b[_0xc53e('0x39')]);_0x56c66f['attributes']=_[_0xc53e('0x3b')](_0x42b53b[_0xc53e('0x38')],qs[_0xc53e('0x3c')](_0x508671[_0xc53e('0x39')][_0xc53e('0x3c')]));_0x56c66f['attributes']=_0x56c66f[_0xc53e('0x3d')][_0xc53e('0x4d')]?_0x56c66f[_0xc53e('0x3d')]:_0x42b53b[_0xc53e('0x38')];_0x56c66f[_0xc53e('0x3e')]=qs[_0xc53e('0x3f')](_0x508671[_0xc53e('0x39')][_0xc53e('0x3f')]);_0x56c66f[_0xc53e('0x42')]=qs['filters'](_[_0xc53e('0x41')](_0x508671[_0xc53e('0x39')],_0x42b53b[_0xc53e('0x40')]));if(_0x508671[_0xc53e('0x39')][_0xc53e('0x45')]){_0x56c66f[_0xc53e('0x42')]=_[_0xc53e('0x55')](_0x56c66f[_0xc53e('0x42')],{'$or':_[_0xc53e('0x34')](_0x56c66f['attributes'],function(_0x3a54ef){var _0x190509={};_0x190509[_0x3a54ef]={'$like':'%'+_0x508671[_0xc53e('0x39')][_0xc53e('0x45')]+'%'};return _0x190509;})});}_0x56c66f=_['merge']({},_0x56c66f,_0x508671[_0xc53e('0x4e')]);return _0xe1a82c[_0xc53e('0x5a')](_0x56c66f);}})[_0xc53e('0x1a')](function(_0x92c9bc){if(_0x92c9bc){_0x25469e=_0x92c9bc['length'];if(!_0x508671[_0xc53e('0x39')][_0xc53e('0x56')](_0xc53e('0x57'))){_0x56c66f[_0xc53e('0x29')]=qs[_0xc53e('0x29')](_0x508671[_0xc53e('0x39')][_0xc53e('0x29')]);_0x56c66f['offset']=qs[_0xc53e('0x28')](_0x508671['query'][_0xc53e('0x28')]);}return _0xe1a82c[_0xc53e('0x5a')](_0x56c66f);}})[_0xc53e('0x1a')](function(_0x4c6ddc){if(_0x4c6ddc){return _0x4c6ddc?{'count':_0x25469e,'rows':_0x4c6ddc}:null;}})[_0xc53e('0x1a')](respondWithResult(_0x2601ba,null))[_0xc53e('0x4b')](handleError(_0x2601ba,null));}; \ No newline at end of file +var _0x9957=['status','end','json','count','offset','Content-Range','reject','save','update','destroy','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','merge','VIRTUAL','options','includeAll','include','FreshsalesConfiguration','findAll','rows','show','find','create','body','params','getSubjects','FreshsalesField','filter','getDescriptions','findOne','pick','getFields','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus'];(function(_0xb1648f,_0xa4fa40){var _0x467f6d=function(_0x5310e4){while(--_0x5310e4){_0xb1648f['push'](_0xb1648f['shift']());}};_0x467f6d(++_0xa4fa40);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');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'];var jayson=require(_0x7995('0x1b'));var client=jayson[_0x7995('0x1c')][_0x7995('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x23999f,_0x2bbe7a,_0x4cc004,_0x58f5ad){return new BPromise(function(_0x2b4e94,_0x2233dd){var _0x24b5bb=_0x58f5ad||client;return _0x24b5bb[_0x7995('0x1e')](_0x23999f,_0x4cc004)[_0x7995('0x1f')](function(_0x1a5310){logger[_0x7995('0x20')](_0x7995('0x21'),_0x2bbe7a,'request\x20sent');logger[_0x7995('0x22')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x2bbe7a,_0x7995('0x23'),JSON[_0x7995('0x24')](_0x1a5310));if(_0x1a5310[_0x7995('0x25')]){if(_0x1a5310[_0x7995('0x25')][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x25')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x2bbe7a,_0x1a5310['error'][_0x7995('0x27')]);return _0x2233dd(_0x1a5310['error']['message']);}logger[_0x7995('0x25')](_0x7995('0x21'),_0x2bbe7a,_0x1a5310['error'][_0x7995('0x27')]);return _0x2b4e94(_0x1a5310['error']['message']);}else{logger[_0x7995('0x20')](_0x7995('0x21'),_0x2bbe7a,_0x7995('0x23'));_0x2b4e94(_0x1a5310[_0x7995('0x28')][_0x7995('0x27')]);}})[_0x7995('0x29')](function(_0x5d40ae){logger[_0x7995('0x25')](_0x7995('0x21'),_0x2bbe7a,_0x5d40ae);_0x2233dd(_0x5d40ae);});});}function respondWithStatusCode(_0x204507,_0x285437){_0x285437=_0x285437||0xcc;return function(_0x563799){if(_0x563799){return _0x204507[_0x7995('0x2a')](_0x285437);}return _0x204507[_0x7995('0x2b')](_0x285437)[_0x7995('0x2c')]();};}function respondWithResult(_0x59405a,_0x39df42){_0x39df42=_0x39df42||0xc8;return function(_0x34e70c){if(_0x34e70c){return _0x59405a[_0x7995('0x2b')](_0x39df42)[_0x7995('0x2d')](_0x34e70c);}};}function respondWithFilteredResult(_0x3a3fcf,_0x2a307e){return function(_0x56691a){if(_0x56691a){var _0x47625f=_0x56691a[_0x7995('0x2e')],_0x5911c3=_0x2a307e[_0x7995('0x2f')],_0x229742=_0x2a307e[_0x7995('0x2f')]+_0x2a307e['limit'],_0x49bc7e;if(_0x229742>=_0x47625f){_0x229742=_0x47625f;_0x49bc7e=0xc8;}else{_0x49bc7e=0xce;}_0x3a3fcf[_0x7995('0x2b')](_0x49bc7e);return _0x3a3fcf['set'](_0x7995('0x30'),_0x5911c3+'-'+_0x229742+'/'+_0x47625f)[_0x7995('0x2d')](_0x56691a);}return null;};}function patchUpdates(_0x4253e5){return function(_0x574574){try{jsonpatch['apply'](_0x574574,_0x4253e5,!![]);}catch(_0x48e573){return BPromise[_0x7995('0x31')](_0x48e573);}return _0x574574[_0x7995('0x32')]();};}function saveUpdates(_0x327a81,_0x2b874d){return function(_0x2e3493){if(_0x2e3493){return _0x2e3493[_0x7995('0x33')](_0x327a81)['then'](function(_0x481c74){return _0x481c74;});}return null;};}function removeEntity(_0xfa8f15,_0x5524af){return function(_0x553671){if(_0x553671){return _0x553671[_0x7995('0x34')]()[_0x7995('0x1f')](function(){_0xfa8f15[_0x7995('0x2b')](0xcc)[_0x7995('0x2c')]();});}};}function handleEntityNotFound(_0x510841,_0x44309d){return function(_0x33e24e){if(!_0x33e24e){_0x510841['sendStatus'](0x194);}return _0x33e24e;};}function handleError(_0x48db25,_0x577412){_0x577412=_0x577412||0x1f4;return function(_0x45bc5e){logger[_0x7995('0x25')](_0x45bc5e['stack']);if(_0x45bc5e[_0x7995('0x35')]){delete _0x45bc5e['name'];}_0x48db25[_0x7995('0x2b')](_0x577412)[_0x7995('0x36')](_0x45bc5e);};}exports[_0x7995('0x37')]=function(_0x5014d2,_0x52d76d){var _0x36d057={},_0x5e67fe={},_0x5d2428={'count':0x0,'rows':[]};var _0x3e99cd=_[_0x7995('0x38')](db['FreshsalesConfiguration'][_0x7995('0x39')],function(_0x1922b4){return{'name':_0x1922b4[_0x7995('0x3a')],'type':_0x1922b4[_0x7995('0x3b')][_0x7995('0x3c')]};});_0x5e67fe['model']=_[_0x7995('0x38')](_0x3e99cd,_0x7995('0x35'));_0x5e67fe[_0x7995('0x3d')]=_[_0x7995('0x3e')](_0x5014d2['query']);_0x5e67fe[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x5e67fe[_0x7995('0x41')],_0x5e67fe[_0x7995('0x3d')]);_0x36d057[_0x7995('0x42')]=_[_0x7995('0x40')](_0x5e67fe['model'],qs[_0x7995('0x43')](_0x5014d2[_0x7995('0x3d')][_0x7995('0x43')]));_0x36d057[_0x7995('0x42')]=_0x36d057[_0x7995('0x42')][_0x7995('0x44')]?_0x36d057[_0x7995('0x42')]:_0x5e67fe[_0x7995('0x41')];if(!_0x5014d2[_0x7995('0x3d')][_0x7995('0x45')](_0x7995('0x46'))){_0x36d057[_0x7995('0x47')]=qs[_0x7995('0x47')](_0x5014d2['query']['limit']);_0x36d057[_0x7995('0x2f')]=qs[_0x7995('0x2f')](_0x5014d2['query']['offset']);}_0x36d057[_0x7995('0x48')]=qs['sort'](_0x5014d2['query'][_0x7995('0x49')]);_0x36d057[_0x7995('0x4a')]=qs[_0x7995('0x3f')](_['pick'](_0x5014d2[_0x7995('0x3d')],_0x5e67fe['filters']),_0x3e99cd);if(_0x5014d2[_0x7995('0x3d')]['filter']){_0x36d057['where']=_[_0x7995('0x4b')](_0x36d057[_0x7995('0x4a')],{'$or':_[_0x7995('0x38')](_0x3e99cd,function(_0x3f1c35){if(_0x3f1c35['type']!==_0x7995('0x4c')){var _0x40fc68={};_0x40fc68[_0x3f1c35[_0x7995('0x35')]]={'$like':'%'+_0x5014d2[_0x7995('0x3d')]['filter']+'%'};return _0x40fc68;}})});}_0x36d057=_['merge']({},_0x36d057,_0x5014d2[_0x7995('0x4d')]);var _0x55791b={'where':_0x36d057[_0x7995('0x4a')]};return db['FreshsalesConfiguration'][_0x7995('0x2e')](_0x55791b)['then'](function(_0x1e795e){_0x5d2428[_0x7995('0x2e')]=_0x1e795e;if(_0x5014d2['query'][_0x7995('0x4e')]){_0x36d057[_0x7995('0x4f')]=[{'all':!![]}];}return db[_0x7995('0x50')][_0x7995('0x51')](_0x36d057);})['then'](function(_0x2458cb){_0x5d2428[_0x7995('0x52')]=_0x2458cb;return _0x5d2428;})[_0x7995('0x1f')](respondWithFilteredResult(_0x52d76d,_0x36d057))['catch'](handleError(_0x52d76d,null));};exports[_0x7995('0x53')]=function(_0x44f516,_0x511567){var _0x3d8ae3={'raw':![],'where':{'id':_0x44f516['params']['id']}},_0x255313={};_0x255313[_0x7995('0x41')]=_[_0x7995('0x3e')](db['FreshsalesConfiguration'][_0x7995('0x39')]);_0x255313['query']=_[_0x7995('0x3e')](_0x44f516[_0x7995('0x3d')]);_0x255313[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x255313[_0x7995('0x41')],_0x255313[_0x7995('0x3d')]);_0x3d8ae3[_0x7995('0x42')]=_['intersection'](_0x255313[_0x7995('0x41')],qs[_0x7995('0x43')](_0x44f516[_0x7995('0x3d')]['fields']));_0x3d8ae3[_0x7995('0x42')]=_0x3d8ae3[_0x7995('0x42')][_0x7995('0x44')]?_0x3d8ae3['attributes']:_0x255313['model'];if(_0x44f516['query'][_0x7995('0x4e')]){_0x3d8ae3[_0x7995('0x4f')]=[{'all':!![]}];}_0x3d8ae3=_['merge']({},_0x3d8ae3,_0x44f516[_0x7995('0x4d')]);return db[_0x7995('0x50')][_0x7995('0x54')](_0x3d8ae3)[_0x7995('0x1f')](handleEntityNotFound(_0x511567,null))[_0x7995('0x1f')](respondWithResult(_0x511567,null))['catch'](handleError(_0x511567,null));};exports[_0x7995('0x55')]=function(_0x4ab09f,_0x14fe7f){return db[_0x7995('0x50')][_0x7995('0x55')](_0x4ab09f['body'],{})['then'](respondWithResult(_0x14fe7f,0xc9))['catch'](handleError(_0x14fe7f,null));};exports['update']=function(_0x2e13b0,_0x3709de){if(_0x2e13b0[_0x7995('0x56')]['id']){delete _0x2e13b0[_0x7995('0x56')]['id'];}return db[_0x7995('0x50')][_0x7995('0x54')]({'where':{'id':_0x2e13b0[_0x7995('0x57')]['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0x3709de,null))[_0x7995('0x1f')](saveUpdates(_0x2e13b0[_0x7995('0x56')],null))[_0x7995('0x1f')](respondWithResult(_0x3709de,null))[_0x7995('0x29')](handleError(_0x3709de,null));};exports[_0x7995('0x34')]=function(_0x35bea3,_0x1ea1dc){return db[_0x7995('0x50')][_0x7995('0x54')]({'where':{'id':_0x35bea3[_0x7995('0x57')]['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0x1ea1dc,null))['then'](removeEntity(_0x1ea1dc,null))[_0x7995('0x29')](handleError(_0x1ea1dc,null));};exports[_0x7995('0x58')]=function(_0x3b8a54,_0x32c0d3,_0x5d160d){var _0x53125a={};var _0x402fa0={};var _0x197b52;var _0x5b9467;return db[_0x7995('0x50')]['findOne']({'where':{'id':_0x3b8a54[_0x7995('0x57')]['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0x32c0d3,null))[_0x7995('0x1f')](function(_0x33c49c){if(_0x33c49c){_0x197b52=_0x33c49c;_0x402fa0['model']=_['keys'](db[_0x7995('0x59')][_0x7995('0x39')]);_0x402fa0[_0x7995('0x3d')]=_[_0x7995('0x3e')](_0x3b8a54[_0x7995('0x3d')]);_0x402fa0[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x402fa0[_0x7995('0x41')],_0x402fa0[_0x7995('0x3d')]);_0x53125a['attributes']=_[_0x7995('0x40')](_0x402fa0[_0x7995('0x41')],qs[_0x7995('0x43')](_0x3b8a54[_0x7995('0x3d')]['fields']));_0x53125a['attributes']=_0x53125a[_0x7995('0x42')][_0x7995('0x44')]?_0x53125a['attributes']:_0x402fa0[_0x7995('0x41')];_0x53125a[_0x7995('0x48')]=qs[_0x7995('0x49')](_0x3b8a54[_0x7995('0x3d')][_0x7995('0x49')]);_0x53125a['where']=qs[_0x7995('0x3f')](_['pick'](_0x3b8a54[_0x7995('0x3d')],_0x402fa0[_0x7995('0x3f')]));if(_0x3b8a54[_0x7995('0x3d')][_0x7995('0x5a')]){_0x53125a[_0x7995('0x4a')]=_[_0x7995('0x4b')](_0x53125a[_0x7995('0x4a')],{'$or':_[_0x7995('0x38')](_0x53125a[_0x7995('0x42')],function(_0x3f2bde){var _0x2618c4={};_0x2618c4[_0x3f2bde]={'$like':'%'+_0x3b8a54[_0x7995('0x3d')]['filter']+'%'};return _0x2618c4;})});}_0x53125a=_[_0x7995('0x4b')]({},_0x53125a,_0x3b8a54[_0x7995('0x4d')]);return _0x197b52[_0x7995('0x58')](_0x53125a);}})[_0x7995('0x1f')](function(_0x2c6548){if(_0x2c6548){_0x5b9467=_0x2c6548['length'];if(!_0x3b8a54['query'][_0x7995('0x45')](_0x7995('0x46'))){_0x53125a[_0x7995('0x47')]=qs[_0x7995('0x47')](_0x3b8a54['query'][_0x7995('0x47')]);_0x53125a['offset']=qs['offset'](_0x3b8a54[_0x7995('0x3d')][_0x7995('0x2f')]);}return _0x197b52[_0x7995('0x58')](_0x53125a);}})[_0x7995('0x1f')](function(_0x290eae){if(_0x290eae){return _0x290eae?{'count':_0x5b9467,'rows':_0x290eae}:null;}})[_0x7995('0x1f')](respondWithResult(_0x32c0d3,null))[_0x7995('0x29')](handleError(_0x32c0d3,null));};exports[_0x7995('0x5b')]=function(_0x3fde86,_0x2466df,_0x560b0a){var _0x2dc1f7={};var _0x8908cd={};var _0x3c5802;var _0x4cc247;return db[_0x7995('0x50')][_0x7995('0x5c')]({'where':{'id':_0x3fde86[_0x7995('0x57')]['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0x2466df,null))[_0x7995('0x1f')](function(_0x51ab1e){if(_0x51ab1e){_0x3c5802=_0x51ab1e;_0x8908cd[_0x7995('0x41')]=_[_0x7995('0x3e')](db[_0x7995('0x59')][_0x7995('0x39')]);_0x8908cd[_0x7995('0x3d')]=_['keys'](_0x3fde86['query']);_0x8908cd[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x8908cd[_0x7995('0x41')],_0x8908cd[_0x7995('0x3d')]);_0x2dc1f7['attributes']=_[_0x7995('0x40')](_0x8908cd[_0x7995('0x41')],qs['fields'](_0x3fde86['query'][_0x7995('0x43')]));_0x2dc1f7[_0x7995('0x42')]=_0x2dc1f7['attributes'][_0x7995('0x44')]?_0x2dc1f7['attributes']:_0x8908cd[_0x7995('0x41')];_0x2dc1f7[_0x7995('0x48')]=qs['sort'](_0x3fde86['query'][_0x7995('0x49')]);_0x2dc1f7['where']=qs[_0x7995('0x3f')](_[_0x7995('0x5d')](_0x3fde86[_0x7995('0x3d')],_0x8908cd[_0x7995('0x3f')]));if(_0x3fde86[_0x7995('0x3d')][_0x7995('0x5a')]){_0x2dc1f7[_0x7995('0x4a')]=_[_0x7995('0x4b')](_0x2dc1f7[_0x7995('0x4a')],{'$or':_[_0x7995('0x38')](_0x2dc1f7[_0x7995('0x42')],function(_0x16108c){var _0x10a2f5={};_0x10a2f5[_0x16108c]={'$like':'%'+_0x3fde86[_0x7995('0x3d')][_0x7995('0x5a')]+'%'};return _0x10a2f5;})});}_0x2dc1f7=_[_0x7995('0x4b')]({},_0x2dc1f7,_0x3fde86[_0x7995('0x4d')]);return _0x3c5802[_0x7995('0x5b')](_0x2dc1f7);}})[_0x7995('0x1f')](function(_0xa2fc8e){if(_0xa2fc8e){_0x4cc247=_0xa2fc8e[_0x7995('0x44')];if(!_0x3fde86[_0x7995('0x3d')][_0x7995('0x45')](_0x7995('0x46'))){_0x2dc1f7[_0x7995('0x47')]=qs[_0x7995('0x47')](_0x3fde86[_0x7995('0x3d')][_0x7995('0x47')]);_0x2dc1f7['offset']=qs[_0x7995('0x2f')](_0x3fde86[_0x7995('0x3d')]['offset']);}return _0x3c5802['getDescriptions'](_0x2dc1f7);}})[_0x7995('0x1f')](function(_0x3fe8fc){if(_0x3fe8fc){return _0x3fe8fc?{'count':_0x4cc247,'rows':_0x3fe8fc}:null;}})[_0x7995('0x1f')](respondWithResult(_0x2466df,null))[_0x7995('0x29')](handleError(_0x2466df,null));};exports[_0x7995('0x5e')]=function(_0x2491fe,_0x5507a0,_0x2f8a2d){var _0xb68962={};var _0x3fea6a={};var _0x77b03f;var _0x7d9c6e;return db[_0x7995('0x50')][_0x7995('0x5c')]({'where':{'id':_0x2491fe[_0x7995('0x57')]['id']}})['then'](handleEntityNotFound(_0x5507a0,null))[_0x7995('0x1f')](function(_0x2b8217){if(_0x2b8217){_0x77b03f=_0x2b8217;_0x3fea6a['model']=_['keys'](db[_0x7995('0x59')][_0x7995('0x39')]);_0x3fea6a[_0x7995('0x3d')]=_[_0x7995('0x3e')](_0x2491fe[_0x7995('0x3d')]);_0x3fea6a['filters']=_[_0x7995('0x40')](_0x3fea6a[_0x7995('0x41')],_0x3fea6a['query']);_0xb68962[_0x7995('0x42')]=_[_0x7995('0x40')](_0x3fea6a['model'],qs[_0x7995('0x43')](_0x2491fe['query'][_0x7995('0x43')]));_0xb68962[_0x7995('0x42')]=_0xb68962[_0x7995('0x42')][_0x7995('0x44')]?_0xb68962[_0x7995('0x42')]:_0x3fea6a['model'];_0xb68962[_0x7995('0x48')]=qs[_0x7995('0x49')](_0x2491fe[_0x7995('0x3d')]['sort']);_0xb68962[_0x7995('0x4a')]=qs[_0x7995('0x3f')](_[_0x7995('0x5d')](_0x2491fe[_0x7995('0x3d')],_0x3fea6a['filters']));if(_0x2491fe[_0x7995('0x3d')][_0x7995('0x5a')]){_0xb68962[_0x7995('0x4a')]=_['merge'](_0xb68962['where'],{'$or':_[_0x7995('0x38')](_0xb68962[_0x7995('0x42')],function(_0x4800a8){var _0x590373={};_0x590373[_0x4800a8]={'$like':'%'+_0x2491fe[_0x7995('0x3d')][_0x7995('0x5a')]+'%'};return _0x590373;})});}_0xb68962=_[_0x7995('0x4b')]({},_0xb68962,_0x2491fe[_0x7995('0x4d')]);return _0x77b03f[_0x7995('0x5e')](_0xb68962);}})['then'](function(_0x56003d){if(_0x56003d){_0x7d9c6e=_0x56003d[_0x7995('0x44')];if(!_0x2491fe['query']['hasOwnProperty'](_0x7995('0x46'))){_0xb68962[_0x7995('0x47')]=qs[_0x7995('0x47')](_0x2491fe['query'][_0x7995('0x47')]);_0xb68962[_0x7995('0x2f')]=qs[_0x7995('0x2f')](_0x2491fe[_0x7995('0x3d')][_0x7995('0x2f')]);}return _0x77b03f['getFields'](_0xb68962);}})[_0x7995('0x1f')](function(_0x41d9d1){if(_0x41d9d1){return _0x41d9d1?{'count':_0x7d9c6e,'rows':_0x41d9d1}:null;}})[_0x7995('0x1f')](respondWithResult(_0x5507a0,null))[_0x7995('0x29')](handleError(_0x5507a0,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 723a8b6..0ff89ae 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 _0x8db0=['FreshsalesConfiguration','int_freshsales_configurations','lodash','util','api','moment','bluebird','path','exports'];(function(_0x52684f,_0xff73fc){var _0x4a55f0=function(_0x8ce37c){while(--_0x8ce37c){_0x52684f['push'](_0x52684f['shift']());}};_0x4a55f0(++_0xff73fc);}(_0x8db0,0x65));var _0x08db=function(_0x158a58,_0x28e8e7){_0x158a58=_0x158a58-0x0;var _0x4935d9=_0x8db0[_0x158a58];return _0x4935d9;};'use strict';var _=require(_0x08db('0x0'));var util=require(_0x08db('0x1'));var logger=require('../../config/logger')(_0x08db('0x2'));var moment=require(_0x08db('0x3'));var BPromise=require(_0x08db('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x08db('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x08db('0x6')]=function(_0x55af6b,_0x14b0e6){return _0x55af6b['define'](_0x08db('0x7'),attributes,{'tableName':_0x08db('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7860=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','int_freshsales_configurations','../../config/logger','api'];(function(_0x4a96ca,_0x13754e){var _0x2aed48=function(_0x361330){while(--_0x361330){_0x4a96ca['push'](_0x4a96ca['shift']());}};_0x2aed48(++_0x13754e);}(_0x7860,0xe4));var _0x0786=function(_0x4b16c9,_0x1406bb){_0x4b16c9=_0x4b16c9-0x0;var _0x47e386=_0x7860[_0x4b16c9];return _0x47e386;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0786('0x0'))(_0x0786('0x1'));var moment=require('moment');var BPromise=require(_0x0786('0x2'));var rp=require(_0x0786('0x3'));var fs=require('fs');var path=require(_0x0786('0x4'));var rimraf=require(_0x0786('0x5'));var config=require(_0x0786('0x6'));var attributes=require(_0x0786('0x7'));module['exports']=function(_0x98d045,_0x57a757){return _0x98d045[_0x0786('0x8')]('FreshsalesConfiguration',attributes,{'tableName':_0x0786('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 733560f..cfa3cf2 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 _0xde1e=['client','request','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x26c5de,_0xc19855){var _0x10fb04=function(_0x4f99e0){while(--_0x4f99e0){_0x26c5de['push'](_0x26c5de['shift']());}};_0x10fb04(++_0xc19855);}(_0xde1e,0x9d));var _0xede1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xde1e[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xede1('0x0'));var util=require(_0xede1('0x1'));var moment=require(_0xede1('0x2'));var BPromise=require(_0xede1('0x3'));var rs=require(_0xede1('0x4'));var fs=require('fs');var Redis=require(_0xede1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xede1('0x6'));var logger=require(_0xede1('0x7'))(_0xede1('0x8'));var config=require(_0xede1('0x9'));var jayson=require(_0xede1('0xa'));var client=jayson[_0xede1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a4671,_0xeeec58,_0x1722c9){return new BPromise(function(_0x452e74,_0x29fe67){return client[_0xede1('0xc')](_0x3a4671,_0x1722c9)['then'](function(_0xa1641){logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0xeeec58,_0xede1('0xd'));logger[_0xede1('0xe')](_0xede1('0xf'),_0xeeec58,_0xede1('0xd'),JSON[_0xede1('0x10')](_0xa1641));if(_0xa1641[_0xede1('0x11')]){if(_0xa1641['error'][_0xede1('0x12')]===0x1f4){logger[_0xede1('0x11')](_0xede1('0x13'),_0xeeec58,_0xa1641['error']['message']);return _0x29fe67(_0xa1641[_0xede1('0x11')][_0xede1('0x14')]);}logger[_0xede1('0x11')](_0xede1('0x13'),_0xeeec58,_0xa1641[_0xede1('0x11')]['message']);return _0x452e74(_0xa1641[_0xede1('0x11')][_0xede1('0x14')]);}else{logger[_0xede1('0x15')](_0xede1('0x13'),_0xeeec58,_0xede1('0xd'));_0x452e74(_0xa1641[_0xede1('0x16')][_0xede1('0x14')]);}})[_0xede1('0x17')](function(_0x5648fb){logger[_0xede1('0x11')](_0xede1('0x13'),_0xeeec58,_0x5648fb);_0x29fe67(_0x5648fb);});});} \ No newline at end of file +var _0x3c0d=['request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0x283a9e,_0x5e0643){var _0x1ba760=function(_0x4fd110){while(--_0x4fd110){_0x283a9e['push'](_0x283a9e['shift']());}};_0x1ba760(++_0x5e0643);}(_0x3c0d,0xf6));var _0xd3c0=function(_0x576f7c,_0x256416){_0x576f7c=_0x576f7c-0x0;var _0x551d1d=_0x3c0d[_0x576f7c];return _0x551d1d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd3c0('0x0'));var rs=require(_0xd3c0('0x1'));var fs=require('fs');var Redis=require(_0xd3c0('0x2'));var db=require(_0xd3c0('0x3'))['db'];var utils=require(_0xd3c0('0x4'));var logger=require(_0xd3c0('0x5'))(_0xd3c0('0x6'));var config=require(_0xd3c0('0x7'));var jayson=require(_0xd3c0('0x8'));var client=jayson['client'][_0xd3c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x47fa5f,_0x6308e2,_0x10f804){return new BPromise(function(_0x2c37b8,_0x2d11d5){return client[_0xd3c0('0xa')](_0x47fa5f,_0x10f804)[_0xd3c0('0xb')](function(_0x2be3c0){logger[_0xd3c0('0xc')](_0xd3c0('0xd'),_0x6308e2,_0xd3c0('0xe'));logger['debug'](_0xd3c0('0xf'),_0x6308e2,_0xd3c0('0xe'),JSON['stringify'](_0x2be3c0));if(_0x2be3c0['error']){if(_0x2be3c0[_0xd3c0('0x10')][_0xd3c0('0x11')]===0x1f4){logger[_0xd3c0('0x10')](_0xd3c0('0xd'),_0x6308e2,_0x2be3c0['error'][_0xd3c0('0x12')]);return _0x2d11d5(_0x2be3c0[_0xd3c0('0x10')][_0xd3c0('0x12')]);}logger['error'](_0xd3c0('0xd'),_0x6308e2,_0x2be3c0[_0xd3c0('0x10')][_0xd3c0('0x12')]);return _0x2c37b8(_0x2be3c0[_0xd3c0('0x10')][_0xd3c0('0x12')]);}else{logger[_0xd3c0('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x6308e2,'request\x20sent');_0x2c37b8(_0x2be3c0[_0xd3c0('0x13')][_0xd3c0('0x12')]);}})['catch'](function(_0x3e9b6b){logger[_0xd3c0('0x10')](_0xd3c0('0xd'),_0x6308e2,_0x3e9b6b);_0x2d11d5(_0x3e9b6b);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 2138d78..7589b28 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 _0xf713=['exports','path','Router','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy'];(function(_0x217e5b,_0x53776f){var _0x38f156=function(_0x24a68e){while(--_0x24a68e){_0x217e5b['push'](_0x217e5b['shift']());}};_0x38f156(++_0x53776f);}(_0xf713,0x1b1));var _0x3f71=function(_0x228641,_0x25d636){_0x228641=_0x228641-0x0;var _0x5d5d78=_0xf713[_0x228641];return _0x5d5d78;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3f71('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3f71('0x1')]();var auth=require(_0x3f71('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x3f71('0x3'));var controller=require(_0x3f71('0x4'));router[_0x3f71('0x5')]('/',auth[_0x3f71('0x6')](),controller[_0x3f71('0x7')]);router['get'](_0x3f71('0x8'),auth[_0x3f71('0x6')](),controller['show']);router[_0x3f71('0x9')]('/',auth[_0x3f71('0x6')](),controller[_0x3f71('0xa')]);router[_0x3f71('0xb')](_0x3f71('0x8'),auth[_0x3f71('0x6')](),controller[_0x3f71('0xc')]);router[_0x3f71('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x3f71('0xe')]);module[_0x3f71('0xf')]=router; \ No newline at end of file +var _0x3157=['Router','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','express'];(function(_0x200ced,_0x503efa){var _0x28e175=function(_0x450010){while(--_0x450010){_0x200ced['push'](_0x200ced['shift']());}};_0x28e175(++_0x503efa);}(_0x3157,0x1bf));var _0x7315=function(_0x10ac60,_0x5d1557){_0x10ac60=_0x10ac60-0x0;var _0x4add1d=_0x3157[_0x10ac60];return _0x4add1d;};'use strict';var multer=require(_0x7315('0x0'));var util=require(_0x7315('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7315('0x2'));var router=express[_0x7315('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7315('0x4'));var config=require(_0x7315('0x5'));var controller=require(_0x7315('0x6'));router[_0x7315('0x7')]('/',auth['isAuthenticated'](),controller[_0x7315('0x8')]);router[_0x7315('0x7')](_0x7315('0x9'),auth[_0x7315('0xa')](),controller[_0x7315('0xb')]);router[_0x7315('0xc')]('/',auth[_0x7315('0xa')](),controller['create']);router[_0x7315('0xd')](_0x7315('0x9'),auth[_0x7315('0xa')](),controller[_0x7315('0xe')]);router[_0x7315('0xf')](_0x7315('0x9'),auth[_0x7315('0xa')](),controller[_0x7315('0x10')]);module[_0x7315('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 38d353d..3c0da84 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 _0x24ca=['picklist','STRING','ENUM','BOOLEAN','sequelize','string','customVariable','keyValue'];(function(_0x281e5e,_0xf320e2){var _0x5a22d2=function(_0x405ff9){while(--_0x405ff9){_0x281e5e['push'](_0x281e5e['shift']());}};_0x5a22d2(++_0xf320e2);}(_0x24ca,0x8c));var _0xa24c=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0x24ca[_0x1e6db3];return _0x1de886;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xa24c('0x1'),'variable',_0xa24c('0x2'),_0xa24c('0x3'),_0xa24c('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xa24c('0x5')]},'key':{'type':Sequelize[_0xa24c('0x5')]},'keyType':{'type':Sequelize[_0xa24c('0x6')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xa24c('0x5')]},'idField':{'type':Sequelize[_0xa24c('0x5')]},'nameField':{'type':Sequelize[_0xa24c('0x5')]},'customField':{'type':Sequelize[_0xa24c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa24c('0x5')]}}; \ No newline at end of file +var _0xc7a3=['exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x56085e,_0x5c69e9){var _0x4de130=function(_0x120b34){while(--_0x120b34){_0x56085e['push'](_0x56085e['shift']());}};_0x4de130(++_0x5c69e9);}(_0xc7a3,0xbd));var _0x3c7a=function(_0xf96c0a,_0x28d535){_0xf96c0a=_0xf96c0a-0x0;var _0x1cd6a7=_0xc7a3[_0xf96c0a];return _0x1cd6a7;};'use strict';var Sequelize=require('sequelize');module[_0x3c7a('0x0')]={'type':{'type':Sequelize[_0x3c7a('0x1')](_0x3c7a('0x2'),_0x3c7a('0x3'),_0x3c7a('0x4'),_0x3c7a('0x5'),'picklist'),'defaultValue':_0x3c7a('0x2')},'content':{'type':Sequelize[_0x3c7a('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3c7a('0x1')](_0x3c7a('0x2'),_0x3c7a('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x3c7a('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3c7a('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3c7a('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 5d139b9..67829e4 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 _0x3c2d=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','fields','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','util','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x3c2d,0x1e9));var _0xd3c2=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x3c2d[_0x4e676e];return _0x336a3c;};'use strict';var pdf=require(_0xd3c2('0x0'));var emlformat=require(_0xd3c2('0x1'));var rimraf=require(_0xd3c2('0x2'));var zipdir=require(_0xd3c2('0x3'));var jsonpatch=require(_0xd3c2('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd3c2('0x5'));var path=require('path');var sox=require(_0xd3c2('0x6'));var csv=require('to-csv');var ejs=require(_0xd3c2('0x7'));var fs=require('fs');var _=require(_0xd3c2('0x8'));var squel=require(_0xd3c2('0x9'));var crypto=require('crypto');var jsforce=require(_0xd3c2('0xa'));var deskjs=require(_0xd3c2('0xb'));var toCsv=require('to-csv');var querystring=require(_0xd3c2('0xc'));var Papa=require(_0xd3c2('0xd'));var Redis=require(_0xd3c2('0xe'));var authService=require(_0xd3c2('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd3c2('0x10'));var hardwareService=require(_0xd3c2('0x11'));var logger=require(_0xd3c2('0x12'))(_0xd3c2('0x13'));var utils=require(_0xd3c2('0x14'));var config=require(_0xd3c2('0x15'));var licenseUtil=require(_0xd3c2('0x16'));var db=require(_0xd3c2('0x17'))['db'];function respondWithStatusCode(_0x4ad8e2,_0x2ccdbf){_0x2ccdbf=_0x2ccdbf||0xcc;return function(_0x39781c){if(_0x39781c){return _0x4ad8e2[_0xd3c2('0x18')](_0x2ccdbf);}return _0x4ad8e2[_0xd3c2('0x19')](_0x2ccdbf)[_0xd3c2('0x1a')]();};}function respondWithResult(_0x52b2f0,_0x54ced2){_0x54ced2=_0x54ced2||0xc8;return function(_0x1956f6){if(_0x1956f6){return _0x52b2f0[_0xd3c2('0x19')](_0x54ced2)[_0xd3c2('0x1b')](_0x1956f6);}};}function respondWithFilteredResult(_0x4f0c79,_0x39fab0){return function(_0x39954c){if(_0x39954c){var _0x1dbfec=_0x39954c[_0xd3c2('0x1c')],_0x314b82=_0x39fab0[_0xd3c2('0x1d')],_0x4c0821=_0x39fab0[_0xd3c2('0x1d')]+_0x39fab0[_0xd3c2('0x1e')],_0x16dd1b;if(_0x4c0821>=_0x1dbfec){_0x4c0821=_0x1dbfec;_0x16dd1b=0xc8;}else{_0x16dd1b=0xce;}_0x4f0c79[_0xd3c2('0x19')](_0x16dd1b);return _0x4f0c79[_0xd3c2('0x1f')](_0xd3c2('0x20'),_0x314b82+'-'+_0x4c0821+'/'+_0x1dbfec)[_0xd3c2('0x1b')](_0x39954c);}return null;};}function patchUpdates(_0x505180){return function(_0x20cbfa){try{jsonpatch[_0xd3c2('0x21')](_0x20cbfa,_0x505180,!![]);}catch(_0x43b3c7){return BPromise[_0xd3c2('0x22')](_0x43b3c7);}return _0x20cbfa['save']();};}function saveUpdates(_0x1ba5bf,_0x201e53){return function(_0x1134a0){if(_0x1134a0){return _0x1134a0[_0xd3c2('0x23')](_0x1ba5bf)[_0xd3c2('0x24')](function(_0x8ea82e){return _0x8ea82e;});}return null;};}function removeEntity(_0x1196b5,_0x16875e){return function(_0x2b7f60){if(_0x2b7f60){return _0x2b7f60[_0xd3c2('0x25')]()[_0xd3c2('0x24')](function(){_0x1196b5[_0xd3c2('0x19')](0xcc)[_0xd3c2('0x1a')]();});}};}function handleEntityNotFound(_0x19ddf7,_0x1d7909){return function(_0x5aca5c){if(!_0x5aca5c){_0x19ddf7[_0xd3c2('0x18')](0x194);}return _0x5aca5c;};}function handleError(_0x4fd29e,_0x5ae51d){_0x5ae51d=_0x5ae51d||0x1f4;return function(_0xfc64c8){logger[_0xd3c2('0x26')](_0xfc64c8['stack']);if(_0xfc64c8[_0xd3c2('0x27')]){delete _0xfc64c8[_0xd3c2('0x27')];}_0x4fd29e[_0xd3c2('0x19')](_0x5ae51d)[_0xd3c2('0x28')](_0xfc64c8);};}exports[_0xd3c2('0x29')]=function(_0x4026fa,_0x4985cc){var _0x2674c9={},_0x47d72a={},_0x1c0c42={'count':0x0,'rows':[]};var _0x1bbf43=_[_0xd3c2('0x2a')](db[_0xd3c2('0x2b')][_0xd3c2('0x2c')],function(_0x24e40b){return{'name':_0x24e40b[_0xd3c2('0x2d')],'type':_0x24e40b[_0xd3c2('0x2e')]['key']};});_0x47d72a['model']=_[_0xd3c2('0x2a')](_0x1bbf43,_0xd3c2('0x27'));_0x47d72a[_0xd3c2('0x2f')]=_[_0xd3c2('0x30')](_0x4026fa[_0xd3c2('0x2f')]);_0x47d72a['filters']=_[_0xd3c2('0x31')](_0x47d72a[_0xd3c2('0x32')],_0x47d72a[_0xd3c2('0x2f')]);_0x2674c9[_0xd3c2('0x33')]=_['intersection'](_0x47d72a[_0xd3c2('0x32')],qs['fields'](_0x4026fa[_0xd3c2('0x2f')]['fields']));_0x2674c9[_0xd3c2('0x33')]=_0x2674c9[_0xd3c2('0x33')]['length']?_0x2674c9[_0xd3c2('0x33')]:_0x47d72a['model'];if(!_0x4026fa[_0xd3c2('0x2f')][_0xd3c2('0x34')](_0xd3c2('0x35'))){_0x2674c9['limit']=qs[_0xd3c2('0x1e')](_0x4026fa[_0xd3c2('0x2f')]['limit']);_0x2674c9['offset']=qs[_0xd3c2('0x1d')](_0x4026fa['query'][_0xd3c2('0x1d')]);}_0x2674c9[_0xd3c2('0x36')]=qs['sort'](_0x4026fa['query'][_0xd3c2('0x37')]);_0x2674c9['where']=qs[_0xd3c2('0x38')](_[_0xd3c2('0x39')](_0x4026fa[_0xd3c2('0x2f')],_0x47d72a[_0xd3c2('0x38')]),_0x1bbf43);if(_0x4026fa[_0xd3c2('0x2f')][_0xd3c2('0x3a')]){_0x2674c9[_0xd3c2('0x3b')]=_[_0xd3c2('0x3c')](_0x2674c9[_0xd3c2('0x3b')],{'$or':_[_0xd3c2('0x2a')](_0x1bbf43,function(_0x5f2b8d){if(_0x5f2b8d[_0xd3c2('0x2e')]!==_0xd3c2('0x3d')){var _0x10da22={};_0x10da22[_0x5f2b8d['name']]={'$like':'%'+_0x4026fa['query'][_0xd3c2('0x3a')]+'%'};return _0x10da22;}})});}_0x2674c9=_['merge']({},_0x2674c9,_0x4026fa[_0xd3c2('0x3e')]);var _0x19c69c={'where':_0x2674c9[_0xd3c2('0x3b')]};return db[_0xd3c2('0x2b')][_0xd3c2('0x1c')](_0x19c69c)[_0xd3c2('0x24')](function(_0x15911f){_0x1c0c42[_0xd3c2('0x1c')]=_0x15911f;if(_0x4026fa[_0xd3c2('0x2f')][_0xd3c2('0x3f')]){_0x2674c9[_0xd3c2('0x40')]=[{'all':!![]}];}return db['FreshsalesField']['findAll'](_0x2674c9);})[_0xd3c2('0x24')](function(_0x412244){_0x1c0c42[_0xd3c2('0x41')]=_0x412244;return _0x1c0c42;})['then'](respondWithFilteredResult(_0x4985cc,_0x2674c9))[_0xd3c2('0x42')](handleError(_0x4985cc,null));};exports[_0xd3c2('0x43')]=function(_0x463e03,_0x160fdf){var _0x4b9ef5={'raw':!![],'where':{'id':_0x463e03['params']['id']}},_0x53303f={};_0x53303f[_0xd3c2('0x32')]=_['keys'](db[_0xd3c2('0x2b')]['rawAttributes']);_0x53303f[_0xd3c2('0x2f')]=_[_0xd3c2('0x30')](_0x463e03[_0xd3c2('0x2f')]);_0x53303f[_0xd3c2('0x38')]=_[_0xd3c2('0x31')](_0x53303f[_0xd3c2('0x32')],_0x53303f[_0xd3c2('0x2f')]);_0x4b9ef5[_0xd3c2('0x33')]=_[_0xd3c2('0x31')](_0x53303f['model'],qs[_0xd3c2('0x44')](_0x463e03[_0xd3c2('0x2f')][_0xd3c2('0x44')]));_0x4b9ef5[_0xd3c2('0x33')]=_0x4b9ef5[_0xd3c2('0x33')]['length']?_0x4b9ef5['attributes']:_0x53303f[_0xd3c2('0x32')];if(_0x463e03[_0xd3c2('0x2f')]['includeAll']){_0x4b9ef5[_0xd3c2('0x40')]=[{'all':!![]}];}_0x4b9ef5=_[_0xd3c2('0x3c')]({},_0x4b9ef5,_0x463e03[_0xd3c2('0x3e')]);return db['FreshsalesField'][_0xd3c2('0x45')](_0x4b9ef5)[_0xd3c2('0x24')](handleEntityNotFound(_0x160fdf,null))[_0xd3c2('0x24')](respondWithResult(_0x160fdf,null))[_0xd3c2('0x42')](handleError(_0x160fdf,null));};exports[_0xd3c2('0x46')]=function(_0x4a7494,_0x7e6198){return db[_0xd3c2('0x2b')]['create'](_0x4a7494[_0xd3c2('0x47')],{})[_0xd3c2('0x24')](respondWithResult(_0x7e6198,0xc9))[_0xd3c2('0x42')](handleError(_0x7e6198,null));};exports['update']=function(_0x34adbb,_0x254442){if(_0x34adbb[_0xd3c2('0x47')]['id']){delete _0x34adbb[_0xd3c2('0x47')]['id'];}return db[_0xd3c2('0x2b')][_0xd3c2('0x45')]({'where':{'id':_0x34adbb[_0xd3c2('0x48')]['id']}})[_0xd3c2('0x24')](handleEntityNotFound(_0x254442,null))[_0xd3c2('0x24')](saveUpdates(_0x34adbb[_0xd3c2('0x47')],null))[_0xd3c2('0x24')](respondWithResult(_0x254442,null))[_0xd3c2('0x42')](handleError(_0x254442,null));};exports['destroy']=function(_0x2d670c,_0xabfaf0){return db['FreshsalesField']['find']({'where':{'id':_0x2d670c[_0xd3c2('0x48')]['id']}})['then'](handleEntityNotFound(_0xabfaf0,null))[_0xd3c2('0x24')](removeEntity(_0xabfaf0,null))[_0xd3c2('0x42')](handleError(_0xabfaf0,null));}; \ No newline at end of file +var _0xf650=['sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','include','options','find','catch','create','body','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','count','offset','status','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','FreshsalesField','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf650,0x169));var _0x0f65=function(_0x416776,_0x443f18){_0x416776=_0x416776-0x0;var _0x289baf=_0xf650[_0x416776];return _0x289baf;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x0f65('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0f65('0x1'));var rp=require('request-promise');var moment=require(_0x0f65('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0f65('0x3'));var util=require(_0x0f65('0x4'));var path=require(_0x0f65('0x5'));var sox=require(_0x0f65('0x6'));var csv=require(_0x0f65('0x7'));var ejs=require(_0x0f65('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0f65('0x9'));var jsforce=require(_0x0f65('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0f65('0xb'));var Papa=require(_0x0f65('0xc'));var Redis=require(_0x0f65('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x0f65('0xe'));var as=require(_0x0f65('0xf'));var hardwareService=require(_0x0f65('0x10'));var logger=require(_0x0f65('0x11'))('api');var utils=require(_0x0f65('0x12'));var config=require(_0x0f65('0x13'));var licenseUtil=require(_0x0f65('0x14'));var db=require(_0x0f65('0x15'))['db'];function respondWithStatusCode(_0x124524,_0x80e949){_0x80e949=_0x80e949||0xcc;return function(_0x540f25){if(_0x540f25){return _0x124524[_0x0f65('0x16')](_0x80e949);}return _0x124524['status'](_0x80e949)[_0x0f65('0x17')]();};}function respondWithResult(_0x2494f7,_0x241ecc){_0x241ecc=_0x241ecc||0xc8;return function(_0x2a2660){if(_0x2a2660){return _0x2494f7['status'](_0x241ecc)[_0x0f65('0x18')](_0x2a2660);}};}function respondWithFilteredResult(_0x5e3097,_0x3d66ac){return function(_0x2ba813){if(_0x2ba813){var _0x127cdf=_0x2ba813[_0x0f65('0x19')],_0x10e421=_0x3d66ac['offset'],_0x14ab97=_0x3d66ac[_0x0f65('0x1a')]+_0x3d66ac['limit'],_0x5ed4ab;if(_0x14ab97>=_0x127cdf){_0x14ab97=_0x127cdf;_0x5ed4ab=0xc8;}else{_0x5ed4ab=0xce;}_0x5e3097[_0x0f65('0x1b')](_0x5ed4ab);return _0x5e3097['set'](_0x0f65('0x1c'),_0x10e421+'-'+_0x14ab97+'/'+_0x127cdf)[_0x0f65('0x18')](_0x2ba813);}return null;};}function patchUpdates(_0x57541c){return function(_0x3aa0aa){try{jsonpatch[_0x0f65('0x1d')](_0x3aa0aa,_0x57541c,!![]);}catch(_0x5ee61b){return BPromise['reject'](_0x5ee61b);}return _0x3aa0aa[_0x0f65('0x1e')]();};}function saveUpdates(_0x3d4daa,_0x46febf){return function(_0x469a2a){if(_0x469a2a){return _0x469a2a[_0x0f65('0x1f')](_0x3d4daa)[_0x0f65('0x20')](function(_0x2256e0){return _0x2256e0;});}return null;};}function removeEntity(_0x22d057,_0x5774b3){return function(_0x1e1301){if(_0x1e1301){return _0x1e1301[_0x0f65('0x21')]()['then'](function(){_0x22d057['status'](0xcc)[_0x0f65('0x17')]();});}};}function handleEntityNotFound(_0x26c7ef,_0x480bc7){return function(_0x24fe12){if(!_0x24fe12){_0x26c7ef[_0x0f65('0x16')](0x194);}return _0x24fe12;};}function handleError(_0x7c86b5,_0x12342d){_0x12342d=_0x12342d||0x1f4;return function(_0x38d3b7){logger[_0x0f65('0x22')](_0x38d3b7[_0x0f65('0x23')]);if(_0x38d3b7['name']){delete _0x38d3b7[_0x0f65('0x24')];}_0x7c86b5[_0x0f65('0x1b')](_0x12342d)[_0x0f65('0x25')](_0x38d3b7);};}exports['index']=function(_0x184818,_0x2b10f2){var _0x3b32b9={},_0x4337ce={},_0x3bd333={'count':0x0,'rows':[]};var _0x2dc495=_[_0x0f65('0x26')](db[_0x0f65('0x27')][_0x0f65('0x28')],function(_0x5acf8b){return{'name':_0x5acf8b['fieldName'],'type':_0x5acf8b[_0x0f65('0x29')]['key']};});_0x4337ce['model']=_[_0x0f65('0x26')](_0x2dc495,_0x0f65('0x24'));_0x4337ce[_0x0f65('0x2a')]=_[_0x0f65('0x2b')](_0x184818[_0x0f65('0x2a')]);_0x4337ce[_0x0f65('0x2c')]=_[_0x0f65('0x2d')](_0x4337ce[_0x0f65('0x2e')],_0x4337ce['query']);_0x3b32b9[_0x0f65('0x2f')]=_[_0x0f65('0x2d')](_0x4337ce['model'],qs[_0x0f65('0x30')](_0x184818['query'][_0x0f65('0x30')]));_0x3b32b9[_0x0f65('0x2f')]=_0x3b32b9['attributes'][_0x0f65('0x31')]?_0x3b32b9[_0x0f65('0x2f')]:_0x4337ce[_0x0f65('0x2e')];if(!_0x184818[_0x0f65('0x2a')][_0x0f65('0x32')]('nolimit')){_0x3b32b9['limit']=qs[_0x0f65('0x33')](_0x184818['query'][_0x0f65('0x33')]);_0x3b32b9['offset']=qs[_0x0f65('0x1a')](_0x184818[_0x0f65('0x2a')][_0x0f65('0x1a')]);}_0x3b32b9[_0x0f65('0x34')]=qs[_0x0f65('0x35')](_0x184818[_0x0f65('0x2a')][_0x0f65('0x35')]);_0x3b32b9[_0x0f65('0x36')]=qs[_0x0f65('0x2c')](_['pick'](_0x184818[_0x0f65('0x2a')],_0x4337ce[_0x0f65('0x2c')]),_0x2dc495);if(_0x184818[_0x0f65('0x2a')][_0x0f65('0x37')]){_0x3b32b9['where']=_[_0x0f65('0x38')](_0x3b32b9[_0x0f65('0x36')],{'$or':_['map'](_0x2dc495,function(_0x33da67){if(_0x33da67[_0x0f65('0x29')]!==_0x0f65('0x39')){var _0xbff8f1={};_0xbff8f1[_0x33da67[_0x0f65('0x24')]]={'$like':'%'+_0x184818[_0x0f65('0x2a')][_0x0f65('0x37')]+'%'};return _0xbff8f1;}})});}_0x3b32b9=_[_0x0f65('0x38')]({},_0x3b32b9,_0x184818['options']);var _0x394f4f={'where':_0x3b32b9['where']};return db[_0x0f65('0x27')][_0x0f65('0x19')](_0x394f4f)[_0x0f65('0x20')](function(_0xecb913){_0x3bd333[_0x0f65('0x19')]=_0xecb913;if(_0x184818[_0x0f65('0x2a')][_0x0f65('0x3a')]){_0x3b32b9['include']=[{'all':!![]}];}return db[_0x0f65('0x27')][_0x0f65('0x3b')](_0x3b32b9);})[_0x0f65('0x20')](function(_0x33a04b){_0x3bd333[_0x0f65('0x3c')]=_0x33a04b;return _0x3bd333;})[_0x0f65('0x20')](respondWithFilteredResult(_0x2b10f2,_0x3b32b9))['catch'](handleError(_0x2b10f2,null));};exports[_0x0f65('0x3d')]=function(_0x5bfd10,_0x368c32){var _0x57270f={'raw':!![],'where':{'id':_0x5bfd10[_0x0f65('0x3e')]['id']}},_0x5be915={};_0x5be915[_0x0f65('0x2e')]=_['keys'](db[_0x0f65('0x27')][_0x0f65('0x28')]);_0x5be915['query']=_['keys'](_0x5bfd10[_0x0f65('0x2a')]);_0x5be915['filters']=_['intersection'](_0x5be915['model'],_0x5be915['query']);_0x57270f['attributes']=_[_0x0f65('0x2d')](_0x5be915['model'],qs['fields'](_0x5bfd10[_0x0f65('0x2a')]['fields']));_0x57270f['attributes']=_0x57270f[_0x0f65('0x2f')][_0x0f65('0x31')]?_0x57270f['attributes']:_0x5be915[_0x0f65('0x2e')];if(_0x5bfd10[_0x0f65('0x2a')][_0x0f65('0x3a')]){_0x57270f[_0x0f65('0x3f')]=[{'all':!![]}];}_0x57270f=_[_0x0f65('0x38')]({},_0x57270f,_0x5bfd10[_0x0f65('0x40')]);return db[_0x0f65('0x27')][_0x0f65('0x41')](_0x57270f)[_0x0f65('0x20')](handleEntityNotFound(_0x368c32,null))[_0x0f65('0x20')](respondWithResult(_0x368c32,null))[_0x0f65('0x42')](handleError(_0x368c32,null));};exports[_0x0f65('0x43')]=function(_0x250a7d,_0x12ea36){return db[_0x0f65('0x27')][_0x0f65('0x43')](_0x250a7d[_0x0f65('0x44')],{})[_0x0f65('0x20')](respondWithResult(_0x12ea36,0xc9))['catch'](handleError(_0x12ea36,null));};exports[_0x0f65('0x1f')]=function(_0x343287,_0x460d33){if(_0x343287[_0x0f65('0x44')]['id']){delete _0x343287[_0x0f65('0x44')]['id'];}return db[_0x0f65('0x27')][_0x0f65('0x41')]({'where':{'id':_0x343287[_0x0f65('0x3e')]['id']}})['then'](handleEntityNotFound(_0x460d33,null))[_0x0f65('0x20')](saveUpdates(_0x343287[_0x0f65('0x44')],null))[_0x0f65('0x20')](respondWithResult(_0x460d33,null))[_0x0f65('0x42')](handleError(_0x460d33,null));};exports[_0x0f65('0x21')]=function(_0x511af9,_0x27ba7f){return db[_0x0f65('0x27')][_0x0f65('0x41')]({'where':{'id':_0x511af9['params']['id']}})['then'](handleEntityNotFound(_0x27ba7f,null))[_0x0f65('0x20')](removeEntity(_0x27ba7f,null))[_0x0f65('0x42')](handleError(_0x27ba7f,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index ba91fcd..1cfae4e 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 _0x2b14=['rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','api','moment','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2b14,0x1db));var _0x42b1=function(_0x16bc58,_0x3ec58c){_0x16bc58=_0x16bc58-0x0;var _0x2bcfda=_0x2b14[_0x16bc58];return _0x2bcfda;};'use strict';var _=require(_0x42b1('0x0'));var util=require(_0x42b1('0x1'));var logger=require('../../config/logger')(_0x42b1('0x2'));var moment=require(_0x42b1('0x3'));var BPromise=require(_0x42b1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x42b1('0x5'));var config=require(_0x42b1('0x6'));var attributes=require(_0x42b1('0x7'));module[_0x42b1('0x8')]=function(_0x1ba87a,_0x51524a){return _0x1ba87a[_0x42b1('0x9')](_0x42b1('0xa'),attributes,{'tableName':_0x42b1('0xb'),'paranoid':![],'indexes':[{'name':_0x42b1('0xc'),'fields':[_0x42b1('0xd'),_0x42b1('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdfe9=['FieldId','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField'];(function(_0x51eadb,_0x2d3d03){var _0x320ef9=function(_0x30cb52){while(--_0x30cb52){_0x51eadb['push'](_0x51eadb['shift']());}};_0x320ef9(++_0x2d3d03);}(_0xdfe9,0x6a));var _0x9dfe=function(_0x267719,_0x80755d){_0x267719=_0x267719-0x0;var _0x5d1344=_0xdfe9[_0x267719];return _0x5d1344;};'use strict';var _=require(_0x9dfe('0x0'));var util=require('util');var logger=require(_0x9dfe('0x1'))(_0x9dfe('0x2'));var moment=require(_0x9dfe('0x3'));var BPromise=require(_0x9dfe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9dfe('0x5'));var rimraf=require(_0x9dfe('0x6'));var config=require(_0x9dfe('0x7'));var attributes=require(_0x9dfe('0x8'));module[_0x9dfe('0x9')]=function(_0x23fa00,_0x2130ac){return _0x23fa00['define'](_0x9dfe('0xa'),attributes,{'tableName':_0x9dfe('0xb'),'paranoid':![],'indexes':[{'name':_0x9dfe('0xc'),'fields':[_0x9dfe('0xd'),_0x9dfe('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 9b7d4d7..398d834 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 _0x69bf=['lodash','util','moment','ioredis','../../config/utils','rpc','jayson/promise','http','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x33f2c3,_0x1380cf){var _0x33d96b=function(_0x3ca855){while(--_0x3ca855){_0x33f2c3['push'](_0x33f2c3['shift']());}};_0x33d96b(++_0x1380cf);}(_0x69bf,0x1cb));var _0xf69b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x69bf[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf69b('0x0'));var util=require(_0xf69b('0x1'));var moment=require(_0xf69b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf69b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf69b('0x4'));var logger=require('../../config/logger')(_0xf69b('0x5'));var config=require('../../config/environment');var jayson=require(_0xf69b('0x6'));var client=jayson['client'][_0xf69b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x382046,_0x44f23d,_0x4e7d96){return new BPromise(function(_0x5b3914,_0x4570d1){return client['request'](_0x382046,_0x4e7d96)[_0xf69b('0x8')](function(_0x1f90e6){logger['info'](_0xf69b('0x9'),_0x44f23d,_0xf69b('0xa'));logger[_0xf69b('0xb')](_0xf69b('0xc'),_0x44f23d,'request\x20sent',JSON[_0xf69b('0xd')](_0x1f90e6));if(_0x1f90e6['error']){if(_0x1f90e6[_0xf69b('0xe')]['code']===0x1f4){logger[_0xf69b('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x44f23d,_0x1f90e6[_0xf69b('0xe')][_0xf69b('0xf')]);return _0x4570d1(_0x1f90e6[_0xf69b('0xe')]['message']);}logger[_0xf69b('0xe')](_0xf69b('0x9'),_0x44f23d,_0x1f90e6[_0xf69b('0xe')][_0xf69b('0xf')]);return _0x5b3914(_0x1f90e6[_0xf69b('0xe')]['message']);}else{logger['info'](_0xf69b('0x9'),_0x44f23d,_0xf69b('0xa'));_0x5b3914(_0x1f90e6['result'][_0xf69b('0xf')]);}})[_0xf69b('0x10')](function(_0x3a1430){logger['error'](_0xf69b('0x9'),_0x44f23d,_0x3a1430);_0x4570d1(_0x3a1430);});});} \ No newline at end of file +var _0x5324=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x5324,0x154));var _0x4532=function(_0x3c06c0,_0x2a4267){_0x3c06c0=_0x3c06c0-0x0;var _0x530981=_0x5324[_0x3c06c0];return _0x530981;};'use strict';var _=require(_0x4532('0x0'));var util=require(_0x4532('0x1'));var moment=require(_0x4532('0x2'));var BPromise=require(_0x4532('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4532('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4532('0x5'));var logger=require(_0x4532('0x6'))(_0x4532('0x7'));var config=require(_0x4532('0x8'));var jayson=require(_0x4532('0x9'));var client=jayson[_0x4532('0xa')][_0x4532('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x352b6a,_0x58e28c,_0x3b9865){return new BPromise(function(_0x455819,_0x138aac){return client[_0x4532('0xc')](_0x352b6a,_0x3b9865)[_0x4532('0xd')](function(_0x4340a7){logger[_0x4532('0xe')](_0x4532('0xf'),_0x58e28c,_0x4532('0x10'));logger[_0x4532('0x11')](_0x4532('0x12'),_0x58e28c,_0x4532('0x10'),JSON['stringify'](_0x4340a7));if(_0x4340a7['error']){if(_0x4340a7[_0x4532('0x13')]['code']===0x1f4){logger[_0x4532('0x13')](_0x4532('0xf'),_0x58e28c,_0x4340a7[_0x4532('0x13')][_0x4532('0x14')]);return _0x138aac(_0x4340a7['error'][_0x4532('0x14')]);}logger[_0x4532('0x13')](_0x4532('0xf'),_0x58e28c,_0x4340a7[_0x4532('0x13')][_0x4532('0x14')]);return _0x455819(_0x4340a7['error']['message']);}else{logger['info'](_0x4532('0xf'),_0x58e28c,_0x4532('0x10'));_0x455819(_0x4340a7[_0x4532('0x15')][_0x4532('0x14')]);}})[_0x4532('0x16')](function(_0x20abbd){logger[_0x4532('0x13')](_0x4532('0xf'),_0x58e28c,_0x20abbd);_0x138aac(_0x20abbd);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 313f9c7..2fe7aba 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 _0x3249=['delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','get','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update'];(function(_0x329437,_0x1de73a){var _0x3789d9=function(_0x37832e){while(--_0x37832e){_0x329437['push'](_0x329437['shift']());}};_0x3789d9(++_0x1de73a);}(_0x3249,0x17e));var _0x9324=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x3249[_0x565ed7];return _0x183ad7;};'use strict';var multer=require('multer');var util=require(_0x9324('0x0'));var path=require(_0x9324('0x1'));var timeout=require(_0x9324('0x2'));var express=require(_0x9324('0x3'));var router=express[_0x9324('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9324('0x5'));var config=require(_0x9324('0x6'));var controller=require('./intSalesforceAccount.controller');router['get']('/',auth[_0x9324('0x7')](),controller[_0x9324('0x8')]);router['get'](_0x9324('0x9'),auth[_0x9324('0x7')](),controller['show']);router[_0x9324('0xa')](_0x9324('0xb'),auth['isAuthenticated'](),controller[_0x9324('0xc')]);router['get']('/:id/fields',auth[_0x9324('0x7')](),controller[_0x9324('0xd')]);router[_0x9324('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x9324('0xb'),auth['isAuthenticated'](),controller[_0x9324('0xf')]);router[_0x9324('0x10')](_0x9324('0x9'),auth['isAuthenticated'](),controller[_0x9324('0x11')]);router[_0x9324('0x12')](_0x9324('0x9'),auth[_0x9324('0x7')](),controller['destroy']);module[_0x9324('0x13')]=router; \ No newline at end of file +var _0xeace=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','post','create','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0xeace,0x1b3));var _0xeeac=function(_0x319c05,_0xfbf2f2){_0x319c05=_0x319c05-0x0;var _0x1a3e56=_0xeace[_0x319c05];return _0x1a3e56;};'use strict';var multer=require(_0xeeac('0x0'));var util=require(_0xeeac('0x1'));var path=require(_0xeeac('0x2'));var timeout=require(_0xeeac('0x3'));var express=require(_0xeeac('0x4'));var router=express['Router']();var auth=require(_0xeeac('0x5'));var interaction=require(_0xeeac('0x6'));var config=require(_0xeeac('0x7'));var controller=require('./intSalesforceAccount.controller');router['get']('/',auth[_0xeeac('0x8')](),controller[_0xeeac('0x9')]);router[_0xeeac('0xa')](_0xeeac('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xeeac('0xa')](_0xeeac('0xc'),auth[_0xeeac('0x8')](),controller[_0xeeac('0xd')]);router[_0xeeac('0xa')]('/:id/fields',auth[_0xeeac('0x8')](),controller['getFields']);router[_0xeeac('0xe')]('/',auth[_0xeeac('0x8')](),controller[_0xeeac('0xf')]);router[_0xeeac('0xe')](_0xeeac('0xc'),auth['isAuthenticated'](),controller[_0xeeac('0x10')]);router[_0xeeac('0x11')](_0xeeac('0xb'),auth[_0xeeac('0x8')](),controller['update']);router[_0xeeac('0x12')](_0xeeac('0xb'),auth[_0xeeac('0x8')](),controller[_0xeeac('0x13')]);module[_0xeeac('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 3c0050e..906bca7 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 _0xeed7=['username','integrationTab','newTab','STRING'];(function(_0x23a4bc,_0x32deba){var _0x2a450e=function(_0x7ac12b){while(--_0x7ac12b){_0x23a4bc['push'](_0x23a4bc['shift']());}};_0x2a450e(++_0x32deba);}(_0xeed7,0xdf));var _0x7eed=function(_0x254a59,_0x135207){_0x254a59=_0x254a59-0x0;var _0x58eb5a=_0xeed7[_0x254a59];return _0x58eb5a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7eed('0x0')]},'description':{'type':Sequelize[_0x7eed('0x0')]},'username':{'type':Sequelize['STRING'],'unique':_0x7eed('0x1')},'remoteUri':{'type':Sequelize[_0x7eed('0x0')]},'password':{'type':Sequelize[_0x7eed('0x0')]},'clientId':{'type':Sequelize[_0x7eed('0x0')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x7eed('0x0')]},'serverUrl':{'type':Sequelize[_0x7eed('0x0')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7eed('0x2'),_0x7eed('0x3')),'defaultValue':_0x7eed('0x2')}}; \ No newline at end of file +var _0x491d=['STRING','username','newTab','integrationTab','exports'];(function(_0xcce73,_0x15b46e){var _0x28fcc6=function(_0x594649){while(--_0x594649){_0xcce73['push'](_0xcce73['shift']());}};_0x28fcc6(++_0x15b46e);}(_0x491d,0x18a));var _0xd491=function(_0x2a6726,_0x3774cb){_0x2a6726=_0x2a6726-0x0;var _0x2ebb76=_0x491d[_0x2a6726];return _0x2ebb76;};'use strict';var Sequelize=require('sequelize');module[_0xd491('0x0')]={'name':{'type':Sequelize[_0xd491('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd491('0x1')],'unique':_0xd491('0x2')},'remoteUri':{'type':Sequelize[_0xd491('0x1')]},'password':{'type':Sequelize[_0xd491('0x1')]},'clientId':{'type':Sequelize[_0xd491('0x1')]},'clientSecret':{'type':Sequelize[_0xd491('0x1')]},'securityToken':{'type':Sequelize[_0xd491('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0xd491('0x3')),'defaultValue':_0xd491('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index b8c8bbd..efb8409 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 _0xfac9=['length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','count','includeAll','include','rows','find','create','body','params','destroy','getConfigurations','findOne','SalesforceConfiguration','filter','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','securityToken','slice','substring','lastIndexOf','Connection','password','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','int','boolean','email','phone','includes','label','custom','picklistValues','value','True','true','False','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','stack','name','send','SalesforceAccount','fieldName','type','model','map','keys','filters','intersection','query','attributes','fields'];(function(_0x1b4f25,_0x387b6c){var _0x3491f2=function(_0xbc1629){while(--_0xbc1629){_0x1b4f25['push'](_0x1b4f25['shift']());}};_0x3491f2(++_0x387b6c);}(_0xfac9,0x1d0));var _0x9fac=function(_0x20eb70,_0x2415fc){_0x20eb70=_0x20eb70-0x0;var _0x98ba1b=_0xfac9[_0x20eb70];return _0x98ba1b;};'use strict';var pdf=require(_0x9fac('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9fac('0x1'));var zipdir=require(_0x9fac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9fac('0x3'));var moment=require(_0x9fac('0x4'));var BPromise=require(_0x9fac('0x5'));var Mustache=require(_0x9fac('0x6'));var util=require(_0x9fac('0x7'));var path=require(_0x9fac('0x8'));var sox=require(_0x9fac('0x9'));var csv=require(_0x9fac('0xa'));var ejs=require(_0x9fac('0xb'));var fs=require('fs');var _=require(_0x9fac('0xc'));var squel=require(_0x9fac('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9fac('0xa'));var querystring=require(_0x9fac('0xe'));var Papa=require(_0x9fac('0xf'));var Redis=require(_0x9fac('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9fac('0x11'));var as=require(_0x9fac('0x12'));var hardwareService=require(_0x9fac('0x13'));var logger=require(_0x9fac('0x14'))(_0x9fac('0x15'));var utils=require('../../config/utils');var config=require(_0x9fac('0x16'));var licenseUtil=require(_0x9fac('0x17'));var db=require(_0x9fac('0x18'))['db'];var integrations=require(_0x9fac('0x19'));var jayson=require(_0x9fac('0x1a'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x63aee6,_0x1126f9,_0x3c533f,_0x4f194e){return new BPromise(function(_0x56eb73,_0x36b58b){var _0x528242=_0x4f194e||client;return _0x528242['request'](_0x63aee6,_0x3c533f)[_0x9fac('0x1b')](function(_0x44d24e){logger[_0x9fac('0x1c')](_0x9fac('0x1d'),_0x1126f9,'request\x20sent');logger[_0x9fac('0x1e')](_0x9fac('0x1f'),_0x1126f9,'request\x20sent',JSON[_0x9fac('0x20')](_0x44d24e));if(_0x44d24e[_0x9fac('0x21')]){if(_0x44d24e[_0x9fac('0x21')][_0x9fac('0x22')]===0x1f4){logger[_0x9fac('0x21')]('SalesforceAccount,\x20%s,\x20%s',_0x1126f9,_0x44d24e[_0x9fac('0x21')][_0x9fac('0x23')]);return _0x36b58b(_0x44d24e[_0x9fac('0x21')][_0x9fac('0x23')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x1126f9,_0x44d24e[_0x9fac('0x21')][_0x9fac('0x23')]);return _0x56eb73(_0x44d24e[_0x9fac('0x21')][_0x9fac('0x23')]);}else{logger[_0x9fac('0x1c')]('SalesforceAccount,\x20%s,\x20%s',_0x1126f9,_0x9fac('0x24'));_0x56eb73(_0x44d24e[_0x9fac('0x25')][_0x9fac('0x23')]);}})[_0x9fac('0x26')](function(_0x57d235){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x1126f9,_0x57d235);_0x36b58b(_0x57d235);});});}function respondWithStatusCode(_0x59d61f,_0x3cec7c){_0x3cec7c=_0x3cec7c||0xcc;return function(_0x20245c){if(_0x20245c){return _0x59d61f[_0x9fac('0x27')](_0x3cec7c);}return _0x59d61f[_0x9fac('0x28')](_0x3cec7c)[_0x9fac('0x29')]();};}function respondWithResult(_0xfbf32e,_0x86f345){_0x86f345=_0x86f345||0xc8;return function(_0xe5443d){if(_0xe5443d){return _0xfbf32e[_0x9fac('0x28')](_0x86f345)[_0x9fac('0x2a')](_0xe5443d);}};}function respondWithFilteredResult(_0x2d98a2,_0x4a0630){return function(_0xcfed02){if(_0xcfed02){var _0x470fe9=_0xcfed02['count'],_0x3f04ab=_0x4a0630[_0x9fac('0x2b')],_0x2c1385=_0x4a0630[_0x9fac('0x2b')]+_0x4a0630[_0x9fac('0x2c')],_0x42cec4;if(_0x2c1385>=_0x470fe9){_0x2c1385=_0x470fe9;_0x42cec4=0xc8;}else{_0x42cec4=0xce;}_0x2d98a2[_0x9fac('0x28')](_0x42cec4);return _0x2d98a2['set'](_0x9fac('0x2d'),_0x3f04ab+'-'+_0x2c1385+'/'+_0x470fe9)[_0x9fac('0x2a')](_0xcfed02);}return null;};}function patchUpdates(_0x3259d3){return function(_0x41156b){try{jsonpatch[_0x9fac('0x2e')](_0x41156b,_0x3259d3,!![]);}catch(_0x371f21){return BPromise[_0x9fac('0x2f')](_0x371f21);}return _0x41156b[_0x9fac('0x30')]();};}function saveUpdates(_0x7f25c7,_0x166625){return function(_0xf423dd){if(_0xf423dd){return _0xf423dd[_0x9fac('0x31')](_0x7f25c7)[_0x9fac('0x1b')](function(_0x51bb6d){return _0x51bb6d;});}return null;};}function removeEntity(_0x3eb912,_0xbd7272){return function(_0x4a7a54){if(_0x4a7a54){return _0x4a7a54['destroy']()[_0x9fac('0x1b')](function(){_0x3eb912['status'](0xcc)[_0x9fac('0x29')]();});}};}function handleEntityNotFound(_0x594f7a,_0x509487){return function(_0x902d49){if(!_0x902d49){_0x594f7a[_0x9fac('0x27')](0x194);}return _0x902d49;};}function handleError(_0x19d56e,_0xc3b2ca){_0xc3b2ca=_0xc3b2ca||0x1f4;return function(_0x34aa00){logger[_0x9fac('0x21')](_0x34aa00[_0x9fac('0x32')]);if(_0x34aa00[_0x9fac('0x33')]){delete _0x34aa00['name'];}_0x19d56e[_0x9fac('0x28')](_0xc3b2ca)[_0x9fac('0x34')](_0x34aa00);};}exports['index']=function(_0x9b393f,_0x819428){var _0x35ff9b={},_0x3a255e={},_0x3ef8dd={'count':0x0,'rows':[]};var _0xf22c37=_['map'](db[_0x9fac('0x35')]['rawAttributes'],function(_0x54b626){return{'name':_0x54b626[_0x9fac('0x36')],'type':_0x54b626[_0x9fac('0x37')]['key']};});_0x3a255e[_0x9fac('0x38')]=_[_0x9fac('0x39')](_0xf22c37,_0x9fac('0x33'));_0x3a255e['query']=_[_0x9fac('0x3a')](_0x9b393f['query']);_0x3a255e[_0x9fac('0x3b')]=_[_0x9fac('0x3c')](_0x3a255e[_0x9fac('0x38')],_0x3a255e[_0x9fac('0x3d')]);_0x35ff9b[_0x9fac('0x3e')]=_['intersection'](_0x3a255e['model'],qs[_0x9fac('0x3f')](_0x9b393f[_0x9fac('0x3d')]['fields']));_0x35ff9b[_0x9fac('0x3e')]=_0x35ff9b[_0x9fac('0x3e')][_0x9fac('0x40')]?_0x35ff9b['attributes']:_0x3a255e[_0x9fac('0x38')];if(!_0x9b393f[_0x9fac('0x3d')][_0x9fac('0x41')](_0x9fac('0x42'))){_0x35ff9b[_0x9fac('0x2c')]=qs[_0x9fac('0x2c')](_0x9b393f[_0x9fac('0x3d')][_0x9fac('0x2c')]);_0x35ff9b[_0x9fac('0x2b')]=qs[_0x9fac('0x2b')](_0x9b393f[_0x9fac('0x3d')][_0x9fac('0x2b')]);}_0x35ff9b[_0x9fac('0x43')]=qs[_0x9fac('0x44')](_0x9b393f[_0x9fac('0x3d')][_0x9fac('0x44')]);_0x35ff9b[_0x9fac('0x45')]=qs['filters'](_[_0x9fac('0x46')](_0x9b393f['query'],_0x3a255e[_0x9fac('0x3b')]),_0xf22c37);if(_0x9b393f['query']['filter']){_0x35ff9b[_0x9fac('0x45')]=_['merge'](_0x35ff9b['where'],{'$or':_[_0x9fac('0x39')](_0xf22c37,function(_0x1596a6){if(_0x1596a6['type']!==_0x9fac('0x47')){var _0x3f5763={};_0x3f5763[_0x1596a6[_0x9fac('0x33')]]={'$like':'%'+_0x9b393f[_0x9fac('0x3d')]['filter']+'%'};return _0x3f5763;}})});}_0x35ff9b=_[_0x9fac('0x48')]({},_0x35ff9b,_0x9b393f[_0x9fac('0x49')]);var _0x5acbc5={'where':_0x35ff9b['where']};return db[_0x9fac('0x35')][_0x9fac('0x4a')](_0x5acbc5)['then'](function(_0x1da75f){_0x3ef8dd['count']=_0x1da75f;if(_0x9b393f['query'][_0x9fac('0x4b')]){_0x35ff9b[_0x9fac('0x4c')]=[{'all':!![]}];}return db[_0x9fac('0x35')]['findAll'](_0x35ff9b);})[_0x9fac('0x1b')](function(_0x1de1c2){_0x3ef8dd[_0x9fac('0x4d')]=_0x1de1c2;return _0x3ef8dd;})[_0x9fac('0x1b')](respondWithFilteredResult(_0x819428,_0x35ff9b))[_0x9fac('0x26')](handleError(_0x819428,null));};exports['show']=function(_0x39a60e,_0x3e33de){var _0x15bd0={'raw':![],'where':{'id':_0x39a60e['params']['id']}},_0x45048f={};_0x45048f[_0x9fac('0x38')]=_[_0x9fac('0x3a')](db[_0x9fac('0x35')]['rawAttributes']);_0x45048f[_0x9fac('0x3d')]=_[_0x9fac('0x3a')](_0x39a60e[_0x9fac('0x3d')]);_0x45048f['filters']=_[_0x9fac('0x3c')](_0x45048f[_0x9fac('0x38')],_0x45048f[_0x9fac('0x3d')]);_0x15bd0['attributes']=_['intersection'](_0x45048f[_0x9fac('0x38')],qs[_0x9fac('0x3f')](_0x39a60e[_0x9fac('0x3d')][_0x9fac('0x3f')]));_0x15bd0['attributes']=_0x15bd0[_0x9fac('0x3e')][_0x9fac('0x40')]?_0x15bd0[_0x9fac('0x3e')]:_0x45048f['model'];if(_0x39a60e[_0x9fac('0x3d')][_0x9fac('0x4b')]){_0x15bd0[_0x9fac('0x4c')]=[{'all':!![]}];}_0x15bd0=_[_0x9fac('0x48')]({},_0x15bd0,_0x39a60e[_0x9fac('0x49')]);return db['SalesforceAccount'][_0x9fac('0x4e')](_0x15bd0)[_0x9fac('0x1b')](handleEntityNotFound(_0x3e33de,null))[_0x9fac('0x1b')](respondWithResult(_0x3e33de,null))[_0x9fac('0x26')](handleError(_0x3e33de,null));};exports[_0x9fac('0x4f')]=function(_0x468771,_0x1e1987){return db['SalesforceAccount'][_0x9fac('0x4f')](_0x468771[_0x9fac('0x50')],{})[_0x9fac('0x1b')](respondWithResult(_0x1e1987,0xc9))[_0x9fac('0x26')](handleError(_0x1e1987,null));};exports[_0x9fac('0x31')]=function(_0x3eb642,_0x55f58c){if(_0x3eb642[_0x9fac('0x50')]['id']){delete _0x3eb642[_0x9fac('0x50')]['id'];}return db['SalesforceAccount']['find']({'where':{'id':_0x3eb642[_0x9fac('0x51')]['id']}})[_0x9fac('0x1b')](handleEntityNotFound(_0x55f58c,null))[_0x9fac('0x1b')](saveUpdates(_0x3eb642[_0x9fac('0x50')],null))['then'](respondWithResult(_0x55f58c,null))['catch'](handleError(_0x55f58c,null));};exports[_0x9fac('0x52')]=function(_0x10ba0f,_0x3dbb25){return db[_0x9fac('0x35')][_0x9fac('0x4e')]({'where':{'id':_0x10ba0f[_0x9fac('0x51')]['id']}})[_0x9fac('0x1b')](handleEntityNotFound(_0x3dbb25,null))[_0x9fac('0x1b')](removeEntity(_0x3dbb25,null))['catch'](handleError(_0x3dbb25,null));};exports[_0x9fac('0x53')]=function(_0x3a6710,_0x35389f,_0x33ee5e){var _0xc26fdd={};var _0x6af521={};var _0x101dfc;var _0xd2197a;return db[_0x9fac('0x35')][_0x9fac('0x54')]({'where':{'id':_0x3a6710['params']['id']}})[_0x9fac('0x1b')](handleEntityNotFound(_0x35389f,null))[_0x9fac('0x1b')](function(_0xcb499f){if(_0xcb499f){_0x101dfc=_0xcb499f;_0x6af521[_0x9fac('0x38')]=_[_0x9fac('0x3a')](db[_0x9fac('0x55')]['rawAttributes']);_0x6af521[_0x9fac('0x3d')]=_['keys'](_0x3a6710[_0x9fac('0x3d')]);_0x6af521[_0x9fac('0x3b')]=_[_0x9fac('0x3c')](_0x6af521['model'],_0x6af521['query']);_0xc26fdd[_0x9fac('0x3e')]=_[_0x9fac('0x3c')](_0x6af521[_0x9fac('0x38')],qs[_0x9fac('0x3f')](_0x3a6710[_0x9fac('0x3d')][_0x9fac('0x3f')]));_0xc26fdd['attributes']=_0xc26fdd[_0x9fac('0x3e')][_0x9fac('0x40')]?_0xc26fdd[_0x9fac('0x3e')]:_0x6af521[_0x9fac('0x38')];_0xc26fdd[_0x9fac('0x43')]=qs[_0x9fac('0x44')](_0x3a6710[_0x9fac('0x3d')][_0x9fac('0x44')]);_0xc26fdd[_0x9fac('0x45')]=qs[_0x9fac('0x3b')](_[_0x9fac('0x46')](_0x3a6710[_0x9fac('0x3d')],_0x6af521['filters']));if(_0x3a6710[_0x9fac('0x3d')][_0x9fac('0x56')]){_0xc26fdd[_0x9fac('0x45')]=_[_0x9fac('0x48')](_0xc26fdd[_0x9fac('0x45')],{'$or':_[_0x9fac('0x39')](_0xc26fdd['attributes'],function(_0x27b745){var _0x474043={};_0x474043[_0x27b745]={'$like':'%'+_0x3a6710[_0x9fac('0x3d')][_0x9fac('0x56')]+'%'};return _0x474043;})});}_0xc26fdd=_[_0x9fac('0x48')]({},_0xc26fdd,_0x3a6710[_0x9fac('0x49')]);return _0x101dfc['getConfigurations'](_0xc26fdd);}})[_0x9fac('0x1b')](function(_0x2eb45b){if(_0x2eb45b){_0xd2197a=_0x2eb45b[_0x9fac('0x40')];if(!_0x3a6710[_0x9fac('0x3d')][_0x9fac('0x41')](_0x9fac('0x42'))){_0xc26fdd[_0x9fac('0x2c')]=qs[_0x9fac('0x2c')](_0x3a6710[_0x9fac('0x3d')][_0x9fac('0x2c')]);_0xc26fdd[_0x9fac('0x2b')]=qs['offset'](_0x3a6710[_0x9fac('0x3d')][_0x9fac('0x2b')]);}return _0x101dfc[_0x9fac('0x53')](_0xc26fdd);}})[_0x9fac('0x1b')](function(_0x5cb523){if(_0x5cb523){return _0x5cb523?{'count':_0xd2197a,'rows':_0x5cb523}:null;}})['then'](respondWithResult(_0x35389f,null))['catch'](handleError(_0x35389f,null));};exports[_0x9fac('0x57')]=function(_0x37e380,_0x126af8,_0x5a9773){if(_0x37e380[_0x9fac('0x50')]['id']){delete _0x37e380['body']['id'];}return db['SalesforceAccount'][_0x9fac('0x54')]({'where':{'id':_0x37e380[_0x9fac('0x51')]['id']}})[_0x9fac('0x1b')](handleEntityNotFound(_0x126af8,null))[_0x9fac('0x1b')](function(_0x36e0c3){if(_0x36e0c3){_0x37e380[_0x9fac('0x50')][_0x9fac('0x58')]=_0x36e0c3['id'];_0x37e380[_0x9fac('0x50')]['Subjects']=integrations[_0x9fac('0x59')](_0x37e380[_0x9fac('0x50')][_0x9fac('0x5a')],_0x37e380[_0x9fac('0x50')]['type']);_0x37e380['body'][_0x9fac('0x5b')]=integrations[_0x9fac('0x5c')](_0x37e380[_0x9fac('0x50')]['channel'],_0x37e380[_0x9fac('0x50')][_0x9fac('0x37')]);return db['SalesforceConfiguration'][_0x9fac('0x4f')](_0x37e380[_0x9fac('0x50')],{'include':[{'model':db[_0x9fac('0x5d')],'as':'Subjects'},{'model':db[_0x9fac('0x5d')],'as':_0x9fac('0x5b')}]});}return null;})[_0x9fac('0x1b')](respondWithResult(_0x126af8,null))['catch'](handleError(_0x126af8,null));};exports[_0x9fac('0x5e')]=function(_0x1935bb,_0x40bf1c,_0x33ad0d){var _0x134847;var _0x1486ca='';var _0x569b46=_0x9fac('0x5f');return db['SalesforceAccount'][_0x9fac('0x54')]({'where':{'id':_0x1935bb[_0x9fac('0x51')]['id']},'attributes':['id',_0x9fac('0x60'),_0x9fac('0x61'),_0x9fac('0x62'),_0x9fac('0x63'),'password',_0x9fac('0x64')]})[_0x9fac('0x1b')](handleEntityNotFound(_0x40bf1c,null))[_0x9fac('0x1b')](function(_0x2de3f5){if(_0x2de3f5){_0x1486ca=_0x2de3f5[_0x9fac('0x60')];var _0x43bd55=_0x1486ca[_0x9fac('0x65')](-0x1);if(_0x43bd55==='/'){_0x1486ca=_0x1486ca[_0x9fac('0x66')](0x0,_0x1486ca[_0x9fac('0x67')](_0x43bd55));}_0x134847=new jsforce[(_0x9fac('0x68'))]({'oauth2':{'loginUrl':_0x1486ca,'clientId':_0x2de3f5[_0x9fac('0x61')],'clientSecret':_0x2de3f5[_0x9fac('0x62')]}});return _0x134847['login'](_0x2de3f5['username'],_0x2de3f5[_0x9fac('0x69')][_0x9fac('0x6a')](_0x2de3f5[_0x9fac('0x64')]));}})[_0x9fac('0x1b')](function(_0x179391){if(_0x179391){if(!_[_0x9fac('0x6b')](_0x1935bb[_0x9fac('0x3d')][_0x9fac('0x6c')])){_0x569b46=_0x1935bb[_0x9fac('0x3d')][_0x9fac('0x6c')];}return _0x134847[_0x9fac('0x6d')](_0x569b46)[_0x9fac('0x6e')]();}})[_0x9fac('0x1b')](function(_0x59e9c1){var _0x50355f=[_0x9fac('0x6f'),_0x9fac('0x70'),_0x9fac('0x71'),_0x9fac('0x72'),_0x9fac('0x73'),'Description'];var _0x3d0e87=['string',_0x9fac('0x74'),'picklist',_0x9fac('0x75'),_0x9fac('0x76'),'textarea',_0x9fac('0x77')];if(_0x59e9c1){_['remove'](_0x59e9c1[_0x9fac('0x3f')],function(_0x391a8e){return _0x50355f[_0x9fac('0x78')](_0x391a8e[_0x9fac('0x33')])||!_0x3d0e87[_0x9fac('0x78')](_0x391a8e[_0x9fac('0x37')]);});return{'count':_0x59e9c1['fields'][_0x9fac('0x40')],'rows':_[_0x9fac('0x39')](_0x59e9c1[_0x9fac('0x3f')],function(_0x2ac515){return{'id':_0x2ac515[_0x9fac('0x33')],'name':_0x2ac515[_0x9fac('0x79')],'custom':_0x2ac515[_0x9fac('0x7a')],'options':_0x2ac515[_0x9fac('0x7b')][_0x9fac('0x40')]>0x0?_['map'](_0x2ac515[_0x9fac('0x7b')],function(_0x52fa79){return{'name':_0x52fa79[_0x9fac('0x79')],'value':_0x52fa79[_0x9fac('0x7c')]};}):_0x2ac515[_0x9fac('0x37')]==_0x9fac('0x75')?[{'name':_0x9fac('0x7d'),'value':_0x9fac('0x7e')},{'name':_0x9fac('0x7f'),'value':'false'}]:[]};})};}})['then'](respondWithResult(_0x40bf1c,null))[_0x9fac('0x26')](function(_0x44a252){var _0x28b95d=_0x1935bb[_0x9fac('0x3d')][_0x9fac('0x80')]?0x1f4:_0x44a252['statusCode']||0x1f4;logger[_0x9fac('0x21')](_0x9fac('0x81'),_0x9fac('0x5e'),_0x28b95d,JSON['stringify'](_0x44a252));delete _0x44a252[_0x9fac('0x33')];if(_0x28b95d===0x191){_0x28b95d=0x190;}_0x40bf1c['status'](_0x28b95d)[_0x9fac('0x34')](_0x1935bb[_0x9fac('0x3d')][_0x9fac('0x80')]?{'message':_0x9fac('0x82'),'statusCode':_0x44a252[_0x9fac('0x83')]}:_0x44a252);});}; \ No newline at end of file +var _0xf6c3=['count','offset','limit','set','Content-Range','apply','save','destroy','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','rows','show','params','length','include','find','create','body','update','getConfigurations','findOne','SalesforceConfiguration','keys','order','filters','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','clientId','clientSecret','username','securityToken','remoteUri','slice','lastIndexOf','Connection','login','password','concat','isNil','ticketType','OwnerId','ActivityDate','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','custom','label','True','true','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json'];(function(_0x3f5fd6,_0x4d3bc1){var _0x1398d6=function(_0x52170d){while(--_0x52170d){_0x3f5fd6['push'](_0x3f5fd6['shift']());}};_0x1398d6(++_0x4d3bc1);}(_0xf6c3,0x16a));var _0x3f6c=function(_0x50b081,_0x356c8a){_0x50b081=_0x50b081-0x0;var _0x1b0918=_0xf6c3[_0x50b081];return _0x1b0918;};'use strict';var pdf=require(_0x3f6c('0x0'));var emlformat=require(_0x3f6c('0x1'));var rimraf=require(_0x3f6c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f6c('0x3'));var rp=require(_0x3f6c('0x4'));var moment=require(_0x3f6c('0x5'));var BPromise=require(_0x3f6c('0x6'));var Mustache=require('mustache');var util=require(_0x3f6c('0x7'));var path=require('path');var sox=require(_0x3f6c('0x8'));var csv=require('to-csv');var ejs=require(_0x3f6c('0x9'));var fs=require('fs');var _=require(_0x3f6c('0xa'));var squel=require(_0x3f6c('0xb'));var crypto=require(_0x3f6c('0xc'));var jsforce=require(_0x3f6c('0xd'));var deskjs=require(_0x3f6c('0xe'));var toCsv=require(_0x3f6c('0xf'));var querystring=require('querystring');var Papa=require(_0x3f6c('0x10'));var Redis=require(_0x3f6c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3f6c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3f6c('0x13'));var logger=require(_0x3f6c('0x14'))('api');var utils=require(_0x3f6c('0x15'));var config=require(_0x3f6c('0x16'));var licenseUtil=require(_0x3f6c('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x3f6c('0x18'));var jayson=require('jayson/promise');var client=jayson[_0x3f6c('0x19')][_0x3f6c('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xe1def1,_0x119b2e,_0x32b324,_0x1ccafe){return new BPromise(function(_0x31067d,_0x2365da){var _0x1c8b29=_0x1ccafe||client;return _0x1c8b29[_0x3f6c('0x1b')](_0xe1def1,_0x32b324)[_0x3f6c('0x1c')](function(_0x3b5a1c){logger[_0x3f6c('0x1d')](_0x3f6c('0x1e'),_0x119b2e,'request\x20sent');logger[_0x3f6c('0x1f')](_0x3f6c('0x20'),_0x119b2e,_0x3f6c('0x21'),JSON['stringify'](_0x3b5a1c));if(_0x3b5a1c[_0x3f6c('0x22')]){if(_0x3b5a1c['error'][_0x3f6c('0x23')]===0x1f4){logger[_0x3f6c('0x22')](_0x3f6c('0x1e'),_0x119b2e,_0x3b5a1c[_0x3f6c('0x22')][_0x3f6c('0x24')]);return _0x2365da(_0x3b5a1c[_0x3f6c('0x22')][_0x3f6c('0x24')]);}logger[_0x3f6c('0x22')](_0x3f6c('0x1e'),_0x119b2e,_0x3b5a1c[_0x3f6c('0x22')][_0x3f6c('0x24')]);return _0x31067d(_0x3b5a1c['error']['message']);}else{logger[_0x3f6c('0x1d')](_0x3f6c('0x1e'),_0x119b2e,'request\x20sent');_0x31067d(_0x3b5a1c[_0x3f6c('0x25')][_0x3f6c('0x24')]);}})[_0x3f6c('0x26')](function(_0xc971e8){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x119b2e,_0xc971e8);_0x2365da(_0xc971e8);});});}function respondWithStatusCode(_0x2316cf,_0x183f2e){_0x183f2e=_0x183f2e||0xcc;return function(_0x2e24ee){if(_0x2e24ee){return _0x2316cf[_0x3f6c('0x27')](_0x183f2e);}return _0x2316cf[_0x3f6c('0x28')](_0x183f2e)[_0x3f6c('0x29')]();};}function respondWithResult(_0x8ecd6f,_0x247a05){_0x247a05=_0x247a05||0xc8;return function(_0x467dc4){if(_0x467dc4){return _0x8ecd6f[_0x3f6c('0x28')](_0x247a05)[_0x3f6c('0x2a')](_0x467dc4);}};}function respondWithFilteredResult(_0x58f771,_0x3c2bbb){return function(_0x39f58d){if(_0x39f58d){var _0x3969c2=_0x39f58d[_0x3f6c('0x2b')],_0x27bfe8=_0x3c2bbb[_0x3f6c('0x2c')],_0x5e94b7=_0x3c2bbb['offset']+_0x3c2bbb[_0x3f6c('0x2d')],_0x3b1ff9;if(_0x5e94b7>=_0x3969c2){_0x5e94b7=_0x3969c2;_0x3b1ff9=0xc8;}else{_0x3b1ff9=0xce;}_0x58f771[_0x3f6c('0x28')](_0x3b1ff9);return _0x58f771[_0x3f6c('0x2e')](_0x3f6c('0x2f'),_0x27bfe8+'-'+_0x5e94b7+'/'+_0x3969c2)['json'](_0x39f58d);}return null;};}function patchUpdates(_0x37f210){return function(_0x56aaaa){try{jsonpatch[_0x3f6c('0x30')](_0x56aaaa,_0x37f210,!![]);}catch(_0x5643be){return BPromise['reject'](_0x5643be);}return _0x56aaaa[_0x3f6c('0x31')]();};}function saveUpdates(_0x2f56d1,_0x42ec50){return function(_0x5b6c29){if(_0x5b6c29){return _0x5b6c29['update'](_0x2f56d1)[_0x3f6c('0x1c')](function(_0x401154){return _0x401154;});}return null;};}function removeEntity(_0x181a1c,_0x179c57){return function(_0x405668){if(_0x405668){return _0x405668[_0x3f6c('0x32')]()[_0x3f6c('0x1c')](function(){_0x181a1c[_0x3f6c('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdfbb0e,_0x49be1d){return function(_0x27f131){if(!_0x27f131){_0xdfbb0e['sendStatus'](0x194);}return _0x27f131;};}function handleError(_0x45c0bf,_0x33bf20){_0x33bf20=_0x33bf20||0x1f4;return function(_0x28d275){logger[_0x3f6c('0x22')](_0x28d275[_0x3f6c('0x33')]);if(_0x28d275[_0x3f6c('0x34')]){delete _0x28d275['name'];}_0x45c0bf[_0x3f6c('0x28')](_0x33bf20)[_0x3f6c('0x35')](_0x28d275);};}exports[_0x3f6c('0x36')]=function(_0x2d6620,_0x24b448){var _0x3de3d1={},_0x5eddda={},_0x470677={'count':0x0,'rows':[]};var _0x574231=_[_0x3f6c('0x37')](db[_0x3f6c('0x38')][_0x3f6c('0x39')],function(_0x4d0fac){return{'name':_0x4d0fac[_0x3f6c('0x3a')],'type':_0x4d0fac['type'][_0x3f6c('0x3b')]};});_0x5eddda[_0x3f6c('0x3c')]=_[_0x3f6c('0x37')](_0x574231,_0x3f6c('0x34'));_0x5eddda[_0x3f6c('0x3d')]=_['keys'](_0x2d6620['query']);_0x5eddda['filters']=_['intersection'](_0x5eddda[_0x3f6c('0x3c')],_0x5eddda[_0x3f6c('0x3d')]);_0x3de3d1[_0x3f6c('0x3e')]=_[_0x3f6c('0x3f')](_0x5eddda['model'],qs[_0x3f6c('0x40')](_0x2d6620[_0x3f6c('0x3d')][_0x3f6c('0x40')]));_0x3de3d1[_0x3f6c('0x3e')]=_0x3de3d1['attributes']['length']?_0x3de3d1[_0x3f6c('0x3e')]:_0x5eddda[_0x3f6c('0x3c')];if(!_0x2d6620[_0x3f6c('0x3d')][_0x3f6c('0x41')](_0x3f6c('0x42'))){_0x3de3d1[_0x3f6c('0x2d')]=qs['limit'](_0x2d6620[_0x3f6c('0x3d')][_0x3f6c('0x2d')]);_0x3de3d1[_0x3f6c('0x2c')]=qs[_0x3f6c('0x2c')](_0x2d6620[_0x3f6c('0x3d')][_0x3f6c('0x2c')]);}_0x3de3d1['order']=qs[_0x3f6c('0x43')](_0x2d6620['query'][_0x3f6c('0x43')]);_0x3de3d1[_0x3f6c('0x44')]=qs['filters'](_['pick'](_0x2d6620['query'],_0x5eddda['filters']),_0x574231);if(_0x2d6620['query'][_0x3f6c('0x45')]){_0x3de3d1[_0x3f6c('0x44')]=_[_0x3f6c('0x46')](_0x3de3d1['where'],{'$or':_[_0x3f6c('0x37')](_0x574231,function(_0x58a02f){if(_0x58a02f[_0x3f6c('0x47')]!==_0x3f6c('0x48')){var _0x25bb2b={};_0x25bb2b[_0x58a02f['name']]={'$like':'%'+_0x2d6620[_0x3f6c('0x3d')][_0x3f6c('0x45')]+'%'};return _0x25bb2b;}})});}_0x3de3d1=_['merge']({},_0x3de3d1,_0x2d6620[_0x3f6c('0x49')]);var _0x1a4584={'where':_0x3de3d1[_0x3f6c('0x44')]};return db[_0x3f6c('0x38')]['count'](_0x1a4584)[_0x3f6c('0x1c')](function(_0x4217fa){_0x470677[_0x3f6c('0x2b')]=_0x4217fa;if(_0x2d6620['query'][_0x3f6c('0x4a')]){_0x3de3d1['include']=[{'all':!![]}];}return db[_0x3f6c('0x38')]['findAll'](_0x3de3d1);})[_0x3f6c('0x1c')](function(_0x5b3799){_0x470677[_0x3f6c('0x4b')]=_0x5b3799;return _0x470677;})[_0x3f6c('0x1c')](respondWithFilteredResult(_0x24b448,_0x3de3d1))[_0x3f6c('0x26')](handleError(_0x24b448,null));};exports[_0x3f6c('0x4c')]=function(_0x3c7c3e,_0x16d8f7){var _0x1ad771={'raw':![],'where':{'id':_0x3c7c3e[_0x3f6c('0x4d')]['id']}},_0x136ad7={};_0x136ad7[_0x3f6c('0x3c')]=_['keys'](db[_0x3f6c('0x38')][_0x3f6c('0x39')]);_0x136ad7[_0x3f6c('0x3d')]=_['keys'](_0x3c7c3e[_0x3f6c('0x3d')]);_0x136ad7['filters']=_[_0x3f6c('0x3f')](_0x136ad7['model'],_0x136ad7['query']);_0x1ad771[_0x3f6c('0x3e')]=_[_0x3f6c('0x3f')](_0x136ad7[_0x3f6c('0x3c')],qs['fields'](_0x3c7c3e['query'][_0x3f6c('0x40')]));_0x1ad771[_0x3f6c('0x3e')]=_0x1ad771[_0x3f6c('0x3e')][_0x3f6c('0x4e')]?_0x1ad771[_0x3f6c('0x3e')]:_0x136ad7[_0x3f6c('0x3c')];if(_0x3c7c3e['query'][_0x3f6c('0x4a')]){_0x1ad771[_0x3f6c('0x4f')]=[{'all':!![]}];}_0x1ad771=_[_0x3f6c('0x46')]({},_0x1ad771,_0x3c7c3e['options']);return db[_0x3f6c('0x38')][_0x3f6c('0x50')](_0x1ad771)[_0x3f6c('0x1c')](handleEntityNotFound(_0x16d8f7,null))[_0x3f6c('0x1c')](respondWithResult(_0x16d8f7,null))[_0x3f6c('0x26')](handleError(_0x16d8f7,null));};exports[_0x3f6c('0x51')]=function(_0x4e37c7,_0x4e177f){return db[_0x3f6c('0x38')]['create'](_0x4e37c7[_0x3f6c('0x52')],{})[_0x3f6c('0x1c')](respondWithResult(_0x4e177f,0xc9))['catch'](handleError(_0x4e177f,null));};exports[_0x3f6c('0x53')]=function(_0x297c2c,_0x255eda){if(_0x297c2c['body']['id']){delete _0x297c2c['body']['id'];}return db[_0x3f6c('0x38')][_0x3f6c('0x50')]({'where':{'id':_0x297c2c[_0x3f6c('0x4d')]['id']}})[_0x3f6c('0x1c')](handleEntityNotFound(_0x255eda,null))['then'](saveUpdates(_0x297c2c[_0x3f6c('0x52')],null))[_0x3f6c('0x1c')](respondWithResult(_0x255eda,null))[_0x3f6c('0x26')](handleError(_0x255eda,null));};exports[_0x3f6c('0x32')]=function(_0x540d6a,_0x3055a3){return db[_0x3f6c('0x38')]['find']({'where':{'id':_0x540d6a[_0x3f6c('0x4d')]['id']}})[_0x3f6c('0x1c')](handleEntityNotFound(_0x3055a3,null))['then'](removeEntity(_0x3055a3,null))[_0x3f6c('0x26')](handleError(_0x3055a3,null));};exports[_0x3f6c('0x54')]=function(_0x5bc166,_0x789522,_0x154819){var _0x253a9e={};var _0x43e8af={};var _0x463b55;var _0xab8992;return db[_0x3f6c('0x38')][_0x3f6c('0x55')]({'where':{'id':_0x5bc166[_0x3f6c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x789522,null))['then'](function(_0x23be3c){if(_0x23be3c){_0x463b55=_0x23be3c;_0x43e8af[_0x3f6c('0x3c')]=_['keys'](db[_0x3f6c('0x56')][_0x3f6c('0x39')]);_0x43e8af[_0x3f6c('0x3d')]=_[_0x3f6c('0x57')](_0x5bc166[_0x3f6c('0x3d')]);_0x43e8af['filters']=_[_0x3f6c('0x3f')](_0x43e8af[_0x3f6c('0x3c')],_0x43e8af[_0x3f6c('0x3d')]);_0x253a9e[_0x3f6c('0x3e')]=_[_0x3f6c('0x3f')](_0x43e8af[_0x3f6c('0x3c')],qs[_0x3f6c('0x40')](_0x5bc166[_0x3f6c('0x3d')][_0x3f6c('0x40')]));_0x253a9e[_0x3f6c('0x3e')]=_0x253a9e[_0x3f6c('0x3e')][_0x3f6c('0x4e')]?_0x253a9e[_0x3f6c('0x3e')]:_0x43e8af['model'];_0x253a9e[_0x3f6c('0x58')]=qs['sort'](_0x5bc166[_0x3f6c('0x3d')]['sort']);_0x253a9e['where']=qs[_0x3f6c('0x59')](_[_0x3f6c('0x5a')](_0x5bc166[_0x3f6c('0x3d')],_0x43e8af[_0x3f6c('0x59')]));if(_0x5bc166['query'][_0x3f6c('0x45')]){_0x253a9e[_0x3f6c('0x44')]=_[_0x3f6c('0x46')](_0x253a9e[_0x3f6c('0x44')],{'$or':_[_0x3f6c('0x37')](_0x253a9e['attributes'],function(_0x757fe1){var _0x4cf2d7={};_0x4cf2d7[_0x757fe1]={'$like':'%'+_0x5bc166[_0x3f6c('0x3d')]['filter']+'%'};return _0x4cf2d7;})});}_0x253a9e=_['merge']({},_0x253a9e,_0x5bc166['options']);return _0x463b55[_0x3f6c('0x54')](_0x253a9e);}})['then'](function(_0x4ac895){if(_0x4ac895){_0xab8992=_0x4ac895[_0x3f6c('0x4e')];if(!_0x5bc166[_0x3f6c('0x3d')][_0x3f6c('0x41')](_0x3f6c('0x42'))){_0x253a9e['limit']=qs[_0x3f6c('0x2d')](_0x5bc166[_0x3f6c('0x3d')]['limit']);_0x253a9e[_0x3f6c('0x2c')]=qs['offset'](_0x5bc166[_0x3f6c('0x3d')]['offset']);}return _0x463b55[_0x3f6c('0x54')](_0x253a9e);}})[_0x3f6c('0x1c')](function(_0x2ea18f){if(_0x2ea18f){return _0x2ea18f?{'count':_0xab8992,'rows':_0x2ea18f}:null;}})[_0x3f6c('0x1c')](respondWithResult(_0x789522,null))['catch'](handleError(_0x789522,null));};exports[_0x3f6c('0x5b')]=function(_0x19a824,_0x31b058,_0x26c3e0){if(_0x19a824[_0x3f6c('0x52')]['id']){delete _0x19a824[_0x3f6c('0x52')]['id'];}return db[_0x3f6c('0x38')][_0x3f6c('0x55')]({'where':{'id':_0x19a824[_0x3f6c('0x4d')]['id']}})[_0x3f6c('0x1c')](handleEntityNotFound(_0x31b058,null))[_0x3f6c('0x1c')](function(_0x4ac78c){if(_0x4ac78c){_0x19a824[_0x3f6c('0x52')][_0x3f6c('0x5c')]=_0x4ac78c['id'];_0x19a824[_0x3f6c('0x52')][_0x3f6c('0x5d')]=integrations[_0x3f6c('0x5e')](_0x19a824['body'][_0x3f6c('0x5f')],_0x19a824[_0x3f6c('0x52')][_0x3f6c('0x47')]);_0x19a824[_0x3f6c('0x52')][_0x3f6c('0x60')]=integrations[_0x3f6c('0x61')](_0x19a824[_0x3f6c('0x52')][_0x3f6c('0x5f')],_0x19a824['body'][_0x3f6c('0x47')]);return db[_0x3f6c('0x56')][_0x3f6c('0x51')](_0x19a824[_0x3f6c('0x52')],{'include':[{'model':db['SalesforceField'],'as':_0x3f6c('0x5d')},{'model':db['SalesforceField'],'as':_0x3f6c('0x60')}]});}return null;})[_0x3f6c('0x1c')](respondWithResult(_0x31b058,null))['catch'](handleError(_0x31b058,null));};exports[_0x3f6c('0x62')]=function(_0x1ad109,_0x47e4b2,_0x44e56e){var _0x1e3595;var _0x1b398d='';var _0xebafc5='Task';return db['SalesforceAccount'][_0x3f6c('0x55')]({'where':{'id':_0x1ad109[_0x3f6c('0x4d')]['id']},'attributes':['id','remoteUri',_0x3f6c('0x63'),_0x3f6c('0x64'),_0x3f6c('0x65'),'password',_0x3f6c('0x66')]})['then'](handleEntityNotFound(_0x47e4b2,null))[_0x3f6c('0x1c')](function(_0x351784){if(_0x351784){_0x1b398d=_0x351784[_0x3f6c('0x67')];var _0x29a7be=_0x1b398d[_0x3f6c('0x68')](-0x1);if(_0x29a7be==='/'){_0x1b398d=_0x1b398d['substring'](0x0,_0x1b398d[_0x3f6c('0x69')](_0x29a7be));}_0x1e3595=new jsforce[(_0x3f6c('0x6a'))]({'oauth2':{'loginUrl':_0x1b398d,'clientId':_0x351784['clientId'],'clientSecret':_0x351784[_0x3f6c('0x64')]}});return _0x1e3595[_0x3f6c('0x6b')](_0x351784[_0x3f6c('0x65')],_0x351784[_0x3f6c('0x6c')][_0x3f6c('0x6d')](_0x351784[_0x3f6c('0x66')]));}})[_0x3f6c('0x1c')](function(_0x11d787){if(_0x11d787){if(!_[_0x3f6c('0x6e')](_0x1ad109[_0x3f6c('0x3d')][_0x3f6c('0x6f')])){_0xebafc5=_0x1ad109[_0x3f6c('0x3d')]['ticketType'];}return _0x1e3595['sobject'](_0xebafc5)['describe']();}})[_0x3f6c('0x1c')](function(_0x480fdf){var _0x11695c=[_0x3f6c('0x70'),_0x3f6c('0x71'),'IsReminderSet',_0x3f6c('0x72'),_0x3f6c('0x73'),_0x3f6c('0x74')];var _0x1d7396=[_0x3f6c('0x75'),_0x3f6c('0x76'),_0x3f6c('0x77'),_0x3f6c('0x78'),_0x3f6c('0x79'),_0x3f6c('0x7a'),_0x3f6c('0x7b')];if(_0x480fdf){_[_0x3f6c('0x7c')](_0x480fdf[_0x3f6c('0x40')],function(_0x13c6e1){return _0x11695c[_0x3f6c('0x7d')](_0x13c6e1['name'])||!_0x1d7396[_0x3f6c('0x7d')](_0x13c6e1[_0x3f6c('0x47')]);});return{'count':_0x480fdf[_0x3f6c('0x40')][_0x3f6c('0x4e')],'rows':_[_0x3f6c('0x37')](_0x480fdf['fields'],function(_0x1ef11a){return{'id':_0x1ef11a['name'],'name':_0x1ef11a['label'],'custom':_0x1ef11a[_0x3f6c('0x7e')],'options':_0x1ef11a['picklistValues'][_0x3f6c('0x4e')]>0x0?_['map'](_0x1ef11a['picklistValues'],function(_0x695d2b){return{'name':_0x695d2b[_0x3f6c('0x7f')],'value':_0x695d2b['value']};}):_0x1ef11a[_0x3f6c('0x47')]==_0x3f6c('0x78')?[{'name':_0x3f6c('0x80'),'value':_0x3f6c('0x81')},{'name':'False','value':_0x3f6c('0x82')}]:[]};})};}})[_0x3f6c('0x1c')](respondWithResult(_0x47e4b2,null))[_0x3f6c('0x26')](function(_0x3f2e82){var _0x5f53f3=_0x1ad109[_0x3f6c('0x3d')][_0x3f6c('0x83')]?0x1f4:_0x3f2e82[_0x3f6c('0x84')]||0x1f4;logger['error'](_0x3f6c('0x85'),'getFields',_0x5f53f3,JSON[_0x3f6c('0x86')](_0x3f2e82));delete _0x3f2e82[_0x3f6c('0x34')];if(_0x5f53f3===0x191){_0x5f53f3=0x190;}_0x47e4b2[_0x3f6c('0x28')](_0x5f53f3)[_0x3f6c('0x35')](_0x1ad109[_0x3f6c('0x3d')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x3f2e82[_0x3f6c('0x84')]}:_0x3f2e82);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index a86923c..0e44b36 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 _0x422b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','lodash'];(function(_0x3f6cc3,_0x21c641){var _0x25a876=function(_0x15ddfe){while(--_0x15ddfe){_0x3f6cc3['push'](_0x3f6cc3['shift']());}};_0x25a876(++_0x21c641);}(_0x422b,0x1b9));var _0xb422=function(_0x186d80,_0x283224){_0x186d80=_0x186d80-0x0;var _0xcc2d55=_0x422b[_0x186d80];return _0xcc2d55;};'use strict';var _=require(_0xb422('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb422('0x1'));var moment=require(_0xb422('0x2'));var BPromise=require(_0xb422('0x3'));var rp=require(_0xb422('0x4'));var fs=require('fs');var path=require(_0xb422('0x5'));var rimraf=require(_0xb422('0x6'));var config=require(_0xb422('0x7'));var attributes=require(_0xb422('0x8'));var integrations=require(_0xb422('0x9'));module['exports']=function(_0x5a76b1,_0x22912a){return _0x5a76b1[_0xb422('0xa')](_0xb422('0xb'),attributes,{'tableName':_0xb422('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3acf=['../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','api','path','rimraf','../../config/environment','./intSalesforceAccount.attributes'];(function(_0x544eaf,_0x2f149f){var _0x5ba2cf=function(_0x31f4c5){while(--_0x31f4c5){_0x544eaf['push'](_0x544eaf['shift']());}};_0x5ba2cf(++_0x2f149f);}(_0x3acf,0x19d));var _0xf3ac=function(_0x446208,_0xb483fb){_0x446208=_0x446208-0x0;var _0xe49563=_0x3acf[_0x446208];return _0xe49563;};'use strict';var _=require('lodash');var util=require(_0xf3ac('0x0'));var logger=require(_0xf3ac('0x1'))(_0xf3ac('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf3ac('0x3'));var rimraf=require(_0xf3ac('0x4'));var config=require(_0xf3ac('0x5'));var attributes=require(_0xf3ac('0x6'));var integrations=require(_0xf3ac('0x7'));module[_0xf3ac('0x8')]=function(_0x3e5ed5,_0x242476){return _0x3e5ed5[_0xf3ac('0x9')](_0xf3ac('0xa'),attributes,{'tableName':_0xf3ac('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index e182450..17f830c 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 _0xa902=['include','map','model','ShowSalesforceAccount','SalesforceAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetSalesforceAccount','findAll','options','raw','where','attributes'];(function(_0x352e09,_0x37a7da){var _0x1b7094=function(_0x561074){while(--_0x561074){_0x352e09['push'](_0x352e09['shift']());}};_0x1b7094(++_0x37a7da);}(_0xa902,0x8d));var _0x2a90=function(_0x394e53,_0x367000){_0x394e53=_0x394e53-0x0;var _0x40d855=_0xa902[_0x394e53];return _0x40d855;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var moment=require(_0x2a90('0x2'));var BPromise=require(_0x2a90('0x3'));var rs=require(_0x2a90('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a90('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2a90('0x6'));var config=require(_0x2a90('0x7'));var jayson=require(_0x2a90('0x8'));var client=jayson[_0x2a90('0x9')][_0x2a90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25bcfc,_0x58369a,_0x4109e6){return new BPromise(function(_0x570659,_0x5ec2b9){return client[_0x2a90('0xb')](_0x25bcfc,_0x4109e6)[_0x2a90('0xc')](function(_0xe500bc){logger[_0x2a90('0xd')](_0x2a90('0xe'),_0x58369a,'request\x20sent');logger[_0x2a90('0xf')](_0x2a90('0x10'),_0x58369a,_0x2a90('0x11'),JSON[_0x2a90('0x12')](_0xe500bc));if(_0xe500bc['error']){if(_0xe500bc[_0x2a90('0x13')]['code']===0x1f4){logger[_0x2a90('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x58369a,_0xe500bc[_0x2a90('0x13')]['message']);return _0x5ec2b9(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}logger[_0x2a90('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x58369a,_0xe500bc['error']['message']);return _0x570659(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}else{logger['info'](_0x2a90('0xe'),_0x58369a,_0x2a90('0x11'));_0x570659(_0xe500bc[_0x2a90('0x15')][_0x2a90('0x14')]);}})[_0x2a90('0x16')](function(_0x37858e){logger[_0x2a90('0x13')](_0x2a90('0xe'),_0x58369a,_0x37858e);_0x5ec2b9(_0x37858e);});});}exports[_0x2a90('0x17')]=function(_0x5c3e4b){var _0x162f0b=this;return new Promise(function(_0x1d9a28,_0x4190ff){return db['SalesforceAccount'][_0x2a90('0x18')]({'raw':_0x5c3e4b[_0x2a90('0x19')]?_0x5c3e4b[_0x2a90('0x19')][_0x2a90('0x1a')]===undefined?!![]:![]:!![],'where':_0x5c3e4b[_0x2a90('0x19')]?_0x5c3e4b[_0x2a90('0x19')][_0x2a90('0x1b')]||null:null,'attributes':_0x5c3e4b[_0x2a90('0x19')]?_0x5c3e4b[_0x2a90('0x19')][_0x2a90('0x1c')]||null:null,'limit':_0x5c3e4b[_0x2a90('0x19')]?_0x5c3e4b[_0x2a90('0x19')]['limit']||null:null,'include':_0x5c3e4b[_0x2a90('0x19')]?_0x5c3e4b[_0x2a90('0x19')][_0x2a90('0x1d')]?_[_0x2a90('0x1e')](_0x5c3e4b['options'][_0x2a90('0x1d')],function(_0xd033d){return{'model':db[_0xd033d['model']],'as':_0xd033d['as'],'attributes':_0xd033d[_0x2a90('0x1c')],'include':_0xd033d[_0x2a90('0x1d')]?_[_0x2a90('0x1e')](_0xd033d[_0x2a90('0x1d')],function(_0x2a212c){return{'model':db[_0x2a212c[_0x2a90('0x1f')]],'as':_0x2a212c['as'],'attributes':_0x2a212c[_0x2a90('0x1c')],'include':_0x2a212c[_0x2a90('0x1d')]?_['map'](_0x2a212c[_0x2a90('0x1d')],function(_0x17f978){return{'model':db[_0x17f978[_0x2a90('0x1f')]],'as':_0x17f978['as'],'attributes':_0x17f978[_0x2a90('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2a90('0xc')](function(_0x5208d8){logger['info'](_0x2a90('0x17'),_0x5c3e4b);logger['debug']('GetSalesforceAccount',_0x5c3e4b,JSON['stringify'](_0x5208d8));_0x1d9a28(_0x5208d8);})[_0x2a90('0x16')](function(_0x3c78f5){logger['error']('GetSalesforceAccount',_0x3c78f5[_0x2a90('0x14')],_0x5c3e4b);_0x4190ff(_0x162f0b['error'](0x1f4,_0x3c78f5[_0x2a90('0x14')]));});});};exports[_0x2a90('0x20')]=function(_0x3b580f){var _0x27b6b6=this;return new Promise(function(_0xf18d11,_0x11586c){return db[_0x2a90('0x21')]['find']({'raw':_0x3b580f[_0x2a90('0x19')]?_0x3b580f[_0x2a90('0x19')][_0x2a90('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b580f['options']?_0x3b580f[_0x2a90('0x19')][_0x2a90('0x1b')]||null:null,'attributes':_0x3b580f[_0x2a90('0x19')]?_0x3b580f[_0x2a90('0x19')]['attributes']||null:null,'include':_0x3b580f[_0x2a90('0x19')]?_0x3b580f[_0x2a90('0x19')][_0x2a90('0x1d')]?_[_0x2a90('0x1e')](_0x3b580f[_0x2a90('0x19')][_0x2a90('0x1d')],function(_0x4d4149){return{'model':db[_0x4d4149[_0x2a90('0x1f')]],'as':_0x4d4149['as'],'attributes':_0x4d4149[_0x2a90('0x1c')],'include':_0x4d4149[_0x2a90('0x1d')]?_[_0x2a90('0x1e')](_0x4d4149['include'],function(_0x1bab1d){return{'model':db[_0x1bab1d[_0x2a90('0x1f')]],'as':_0x1bab1d['as'],'attributes':_0x1bab1d['attributes'],'include':_0x1bab1d[_0x2a90('0x1d')]?_[_0x2a90('0x1e')](_0x1bab1d['include'],function(_0x5073a4){return{'model':db[_0x5073a4[_0x2a90('0x1f')]],'as':_0x5073a4['as'],'attributes':_0x5073a4[_0x2a90('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2a90('0xc')](function(_0x4cd36c){logger[_0x2a90('0xd')]('ShowSalesforceAccount',_0x3b580f);logger[_0x2a90('0xf')]('ShowSalesforceAccount',_0x3b580f,JSON[_0x2a90('0x12')](_0x4cd36c));_0xf18d11(_0x4cd36c);})['catch'](function(_0x5322dc){logger[_0x2a90('0x13')]('ShowSalesforceAccount',_0x5322dc[_0x2a90('0x14')],_0x3b580f);_0x11586c(_0x27b6b6[_0x2a90('0x13')](0x1f4,_0x5322dc[_0x2a90('0x14')]));});});}; \ No newline at end of file +var _0xa902=['include','map','model','ShowSalesforceAccount','SalesforceAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetSalesforceAccount','findAll','options','raw','where','attributes'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xa902,0x8d));var _0x2a90=function(_0x31c88e,_0x12b24b){_0x31c88e=_0x31c88e-0x0;var _0x29ddd4=_0xa902[_0x31c88e];return _0x29ddd4;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var moment=require(_0x2a90('0x2'));var BPromise=require(_0x2a90('0x3'));var rs=require(_0x2a90('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a90('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2a90('0x6'));var config=require(_0x2a90('0x7'));var jayson=require(_0x2a90('0x8'));var client=jayson[_0x2a90('0x9')][_0x2a90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25bcfc,_0x58369a,_0x4109e6){return new BPromise(function(_0x570659,_0x5ec2b9){return client[_0x2a90('0xb')](_0x25bcfc,_0x4109e6)[_0x2a90('0xc')](function(_0xe500bc){logger[_0x2a90('0xd')](_0x2a90('0xe'),_0x58369a,'request\x20sent');logger[_0x2a90('0xf')](_0x2a90('0x10'),_0x58369a,_0x2a90('0x11'),JSON[_0x2a90('0x12')](_0xe500bc));if(_0xe500bc['error']){if(_0xe500bc[_0x2a90('0x13')]['code']===0x1f4){logger[_0x2a90('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x58369a,_0xe500bc[_0x2a90('0x13')]['message']);return _0x5ec2b9(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}logger[_0x2a90('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x58369a,_0xe500bc['error']['message']);return _0x570659(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}else{logger['info'](_0x2a90('0xe'),_0x58369a,_0x2a90('0x11'));_0x570659(_0xe500bc[_0x2a90('0x15')][_0x2a90('0x14')]);}})[_0x2a90('0x16')](function(_0x37858e){logger[_0x2a90('0x13')](_0x2a90('0xe'),_0x58369a,_0x37858e);_0x5ec2b9(_0x37858e);});});}exports[_0x2a90('0x17')]=function(_0x5c3e4b){var _0x162f0b=this;return new Promise(function(_0x1d9a28,_0x4190ff){return db['SalesforceAccount'][_0x2a90('0x18')]({'raw':_0x5c3e4b[_0x2a90('0x19')]?_0x5c3e4b[_0x2a90('0x19')][_0x2a90('0x1a')]===undefined?!![]:![]:!![],'where':_0x5c3e4b[_0x2a90('0x19')]?_0x5c3e4b[_0x2a90('0x19')][_0x2a90('0x1b')]||null:null,'attributes':_0x5c3e4b[_0x2a90('0x19')]?_0x5c3e4b[_0x2a90('0x19')][_0x2a90('0x1c')]||null:null,'limit':_0x5c3e4b[_0x2a90('0x19')]?_0x5c3e4b[_0x2a90('0x19')]['limit']||null:null,'include':_0x5c3e4b[_0x2a90('0x19')]?_0x5c3e4b[_0x2a90('0x19')][_0x2a90('0x1d')]?_[_0x2a90('0x1e')](_0x5c3e4b['options'][_0x2a90('0x1d')],function(_0xd033d){return{'model':db[_0xd033d['model']],'as':_0xd033d['as'],'attributes':_0xd033d[_0x2a90('0x1c')],'include':_0xd033d[_0x2a90('0x1d')]?_[_0x2a90('0x1e')](_0xd033d[_0x2a90('0x1d')],function(_0x2a212c){return{'model':db[_0x2a212c[_0x2a90('0x1f')]],'as':_0x2a212c['as'],'attributes':_0x2a212c[_0x2a90('0x1c')],'include':_0x2a212c[_0x2a90('0x1d')]?_['map'](_0x2a212c[_0x2a90('0x1d')],function(_0x17f978){return{'model':db[_0x17f978[_0x2a90('0x1f')]],'as':_0x17f978['as'],'attributes':_0x17f978[_0x2a90('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2a90('0xc')](function(_0x5208d8){logger['info'](_0x2a90('0x17'),_0x5c3e4b);logger['debug']('GetSalesforceAccount',_0x5c3e4b,JSON['stringify'](_0x5208d8));_0x1d9a28(_0x5208d8);})[_0x2a90('0x16')](function(_0x3c78f5){logger['error']('GetSalesforceAccount',_0x3c78f5[_0x2a90('0x14')],_0x5c3e4b);_0x4190ff(_0x162f0b['error'](0x1f4,_0x3c78f5[_0x2a90('0x14')]));});});};exports[_0x2a90('0x20')]=function(_0x3b580f){var _0x27b6b6=this;return new Promise(function(_0xf18d11,_0x11586c){return db[_0x2a90('0x21')]['find']({'raw':_0x3b580f[_0x2a90('0x19')]?_0x3b580f[_0x2a90('0x19')][_0x2a90('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b580f['options']?_0x3b580f[_0x2a90('0x19')][_0x2a90('0x1b')]||null:null,'attributes':_0x3b580f[_0x2a90('0x19')]?_0x3b580f[_0x2a90('0x19')]['attributes']||null:null,'include':_0x3b580f[_0x2a90('0x19')]?_0x3b580f[_0x2a90('0x19')][_0x2a90('0x1d')]?_[_0x2a90('0x1e')](_0x3b580f[_0x2a90('0x19')][_0x2a90('0x1d')],function(_0x4d4149){return{'model':db[_0x4d4149[_0x2a90('0x1f')]],'as':_0x4d4149['as'],'attributes':_0x4d4149[_0x2a90('0x1c')],'include':_0x4d4149[_0x2a90('0x1d')]?_[_0x2a90('0x1e')](_0x4d4149['include'],function(_0x1bab1d){return{'model':db[_0x1bab1d[_0x2a90('0x1f')]],'as':_0x1bab1d['as'],'attributes':_0x1bab1d['attributes'],'include':_0x1bab1d[_0x2a90('0x1d')]?_[_0x2a90('0x1e')](_0x1bab1d['include'],function(_0x5073a4){return{'model':db[_0x5073a4[_0x2a90('0x1f')]],'as':_0x5073a4['as'],'attributes':_0x5073a4[_0x2a90('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2a90('0xc')](function(_0x4cd36c){logger[_0x2a90('0xd')]('ShowSalesforceAccount',_0x3b580f);logger[_0x2a90('0xf')]('ShowSalesforceAccount',_0x3b580f,JSON[_0x2a90('0x12')](_0x4cd36c));_0xf18d11(_0x4cd36c);})['catch'](function(_0x5322dc){logger[_0x2a90('0x13')]('ShowSalesforceAccount',_0x5322dc[_0x2a90('0x14')],_0x3b580f);_0x11586c(_0x27b6b6[_0x2a90('0x13')](0x1f4,_0x5322dc[_0x2a90('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index b31ddc5..5066ad1 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 _0x0a64=['../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','/:id','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a64,0x152));var _0x40a6=function(_0x494022,_0xdc326c){_0x494022=_0x494022-0x0;var _0xfb72f0=_0x0a64[_0x494022];return _0xfb72f0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x40a6('0x0'));var timeout=require(_0x40a6('0x1'));var express=require('express');var router=express[_0x40a6('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x40a6('0x3'));var config=require(_0x40a6('0x4'));var controller=require(_0x40a6('0x5'));router[_0x40a6('0x6')]('/',auth[_0x40a6('0x7')](),controller['index']);router[_0x40a6('0x6')](_0x40a6('0x8'),auth[_0x40a6('0x7')](),controller['show']);router['get']('/:id/fields',auth[_0x40a6('0x7')](),controller[_0x40a6('0x9')]);router[_0x40a6('0x6')]('/:id/subjects',auth[_0x40a6('0x7')](),controller[_0x40a6('0xa')]);router['get'](_0x40a6('0xb'),auth[_0x40a6('0x7')](),controller[_0x40a6('0xc')]);router['post']('/',auth[_0x40a6('0x7')](),controller[_0x40a6('0xd')]);router[_0x40a6('0xe')](_0x40a6('0x8'),auth[_0x40a6('0x7')](),controller[_0x40a6('0xf')]);router[_0x40a6('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x40a6('0x11')]);module[_0x40a6('0x12')]=router; \ No newline at end of file +var _0xbd6b=['exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy'];(function(_0x561ff7,_0x85ccfa){var _0x42e110=function(_0x1fcac1){while(--_0x1fcac1){_0x561ff7['push'](_0x561ff7['shift']());}};_0x42e110(++_0x85ccfa);}(_0xbd6b,0x17b));var _0xbbd6=function(_0x2a1475,_0x598e50){_0x2a1475=_0x2a1475-0x0;var _0x100e17=_0xbd6b[_0x2a1475];return _0x100e17;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xbbd6('0x0'));var express=require(_0xbbd6('0x1'));var router=express[_0xbbd6('0x2')]();var auth=require(_0xbbd6('0x3'));var interaction=require(_0xbbd6('0x4'));var config=require(_0xbbd6('0x5'));var controller=require('./intSalesforceConfiguration.controller');router[_0xbbd6('0x6')]('/',auth[_0xbbd6('0x7')](),controller[_0xbbd6('0x8')]);router['get'](_0xbbd6('0x9'),auth[_0xbbd6('0x7')](),controller['show']);router[_0xbbd6('0x6')](_0xbbd6('0xa'),auth[_0xbbd6('0x7')](),controller[_0xbbd6('0xb')]);router[_0xbbd6('0x6')]('/:id/subjects',auth[_0xbbd6('0x7')](),controller[_0xbbd6('0xc')]);router[_0xbbd6('0x6')](_0xbbd6('0xd'),auth[_0xbbd6('0x7')](),controller[_0xbbd6('0xe')]);router[_0xbbd6('0xf')]('/',auth[_0xbbd6('0x7')](),controller['create']);router[_0xbbd6('0x10')](_0xbbd6('0x9'),auth[_0xbbd6('0x7')](),controller[_0xbbd6('0x11')]);router[_0xbbd6('0x12')](_0xbbd6('0x9'),auth[_0xbbd6('0x7')](),controller[_0xbbd6('0x13')]);module[_0xbbd6('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 6b00fee..1ae7284 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 _0x1394=['lead','nothing','sequelize','exports','STRING','ENUM','Case','Task','contact_lead','contact'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x1394,0x1d8));var _0x4139=function(_0x1101dc,_0x2ef97d){_0x1101dc=_0x1101dc-0x0;var _0x2bdfe1=_0x1394[_0x1101dc];return _0x2bdfe1;};'use strict';var Sequelize=require(_0x4139('0x0'));module[_0x4139('0x1')]={'name':{'type':Sequelize[_0x4139('0x2')]},'description':{'type':Sequelize[_0x4139('0x2')]},'ticketType':{'type':Sequelize[_0x4139('0x3')]('Task',_0x4139('0x4')),'defaultValue':_0x4139('0x5')},'moduleSearch':{'type':Sequelize[_0x4139('0x3')](_0x4139('0x6'),_0x4139('0x7'),_0x4139('0x8')),'defaultValue':_0x4139('0x6')},'moduleCreate':{'type':Sequelize['ENUM'](_0x4139('0x9'),_0x4139('0x7'),_0x4139('0x8')),'defaultValue':'lead'}}; \ No newline at end of file +var _0x4178=['Case','Task','contact_lead','contact','lead','nothing','sequelize','STRING','ENUM'];(function(_0x75d5b5,_0x4f69da){var _0x172bd5=function(_0x4f2d0f){while(--_0x4f2d0f){_0x75d5b5['push'](_0x75d5b5['shift']());}};_0x172bd5(++_0x4f69da);}(_0x4178,0x180));var _0x8417=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4178[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x8417('0x0'));module['exports']={'name':{'type':Sequelize[_0x8417('0x1')]},'description':{'type':Sequelize[_0x8417('0x1')]},'ticketType':{'type':Sequelize[_0x8417('0x2')]('Task',_0x8417('0x3')),'defaultValue':_0x8417('0x4')},'moduleSearch':{'type':Sequelize[_0x8417('0x2')](_0x8417('0x5'),_0x8417('0x6'),_0x8417('0x7')),'defaultValue':_0x8417('0x5')},'moduleCreate':{'type':Sequelize[_0x8417('0x2')](_0x8417('0x8'),'contact',_0x8417('0x7')),'defaultValue':'lead'}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index b54988c..4bdbc67 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 _0x18a1=['result','catch','sendStatus','status','end','json','count','offset','set','reject','update','destroy','name','send','SalesforceConfiguration','rawAttributes','type','key','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','where','merge','VIRTUAL','filter','options','findAll','rows','show','params','intersection','includeAll','create','body','find','getFields','findOne','getSubjects','SalesforceField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x1d1259,_0x448179){var _0x454e5d=function(_0x50d166){while(--_0x50d166){_0x1d1259['push'](_0x1d1259['shift']());}};_0x454e5d(++_0x448179);}(_0x18a1,0xe1));var _0x118a=function(_0x531b92,_0xed903d){_0x531b92=_0x531b92-0x0;var _0x2d29d6=_0x18a1[_0x531b92];return _0x2d29d6;};'use strict';var pdf=require(_0x118a('0x0'));var emlformat=require(_0x118a('0x1'));var rimraf=require(_0x118a('0x2'));var zipdir=require(_0x118a('0x3'));var jsonpatch=require(_0x118a('0x4'));var rp=require(_0x118a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x118a('0x6'));var util=require(_0x118a('0x7'));var path=require(_0x118a('0x8'));var sox=require(_0x118a('0x9'));var csv=require(_0x118a('0xa'));var ejs=require(_0x118a('0xb'));var fs=require('fs');var _=require(_0x118a('0xc'));var squel=require(_0x118a('0xd'));var crypto=require(_0x118a('0xe'));var jsforce=require(_0x118a('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x118a('0xa'));var querystring=require(_0x118a('0x10'));var Papa=require(_0x118a('0x11'));var Redis=require(_0x118a('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x118a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x118a('0x14'));var utils=require(_0x118a('0x15'));var config=require(_0x118a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x118a('0x17'))['db'];var jayson=require(_0x118a('0x18'));var client=jayson[_0x118a('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5376b5,_0x264fb0,_0xbea1bd,_0xc7c64f){return new BPromise(function(_0x496057,_0x29d6f8){var _0x228820=_0xc7c64f||client;return _0x228820['request'](_0x5376b5,_0xbea1bd)[_0x118a('0x1a')](function(_0x9ff605){logger['info'](_0x118a('0x1b'),_0x264fb0,_0x118a('0x1c'));logger[_0x118a('0x1d')](_0x118a('0x1e'),_0x264fb0,'request\x20sent',JSON[_0x118a('0x1f')](_0x9ff605));if(_0x9ff605[_0x118a('0x20')]){if(_0x9ff605[_0x118a('0x20')][_0x118a('0x21')]===0x1f4){logger[_0x118a('0x20')]('SalesforceConfiguration,\x20%s,\x20%s',_0x264fb0,_0x9ff605[_0x118a('0x20')][_0x118a('0x22')]);return _0x29d6f8(_0x9ff605[_0x118a('0x20')][_0x118a('0x22')]);}logger[_0x118a('0x20')](_0x118a('0x1b'),_0x264fb0,_0x9ff605[_0x118a('0x20')][_0x118a('0x22')]);return _0x496057(_0x9ff605['error'][_0x118a('0x22')]);}else{logger[_0x118a('0x23')]('SalesforceConfiguration,\x20%s,\x20%s',_0x264fb0,'request\x20sent');_0x496057(_0x9ff605[_0x118a('0x24')]['message']);}})[_0x118a('0x25')](function(_0x5da72c){logger[_0x118a('0x20')](_0x118a('0x1b'),_0x264fb0,_0x5da72c);_0x29d6f8(_0x5da72c);});});}function respondWithStatusCode(_0x33d164,_0x5ef383){_0x5ef383=_0x5ef383||0xcc;return function(_0x235e88){if(_0x235e88){return _0x33d164[_0x118a('0x26')](_0x5ef383);}return _0x33d164[_0x118a('0x27')](_0x5ef383)[_0x118a('0x28')]();};}function respondWithResult(_0x4ae1d4,_0x14dd7d){_0x14dd7d=_0x14dd7d||0xc8;return function(_0xeb2949){if(_0xeb2949){return _0x4ae1d4[_0x118a('0x27')](_0x14dd7d)[_0x118a('0x29')](_0xeb2949);}};}function respondWithFilteredResult(_0x2208af,_0x44eae3){return function(_0x523675){if(_0x523675){var _0x11c981=_0x523675[_0x118a('0x2a')],_0x520978=_0x44eae3[_0x118a('0x2b')],_0x3e3113=_0x44eae3[_0x118a('0x2b')]+_0x44eae3['limit'],_0x184b71;if(_0x3e3113>=_0x11c981){_0x3e3113=_0x11c981;_0x184b71=0xc8;}else{_0x184b71=0xce;}_0x2208af[_0x118a('0x27')](_0x184b71);return _0x2208af[_0x118a('0x2c')]('Content-Range',_0x520978+'-'+_0x3e3113+'/'+_0x11c981)[_0x118a('0x29')](_0x523675);}return null;};}function patchUpdates(_0x3de249){return function(_0x2b9cd7){try{jsonpatch['apply'](_0x2b9cd7,_0x3de249,!![]);}catch(_0x506569){return BPromise[_0x118a('0x2d')](_0x506569);}return _0x2b9cd7['save']();};}function saveUpdates(_0x2ef24d,_0x5dd19e){return function(_0x7236da){if(_0x7236da){return _0x7236da[_0x118a('0x2e')](_0x2ef24d)[_0x118a('0x1a')](function(_0x543344){return _0x543344;});}return null;};}function removeEntity(_0x4f16d6,_0x4c4249){return function(_0x5dc10d){if(_0x5dc10d){return _0x5dc10d[_0x118a('0x2f')]()[_0x118a('0x1a')](function(){_0x4f16d6[_0x118a('0x27')](0xcc)[_0x118a('0x28')]();});}};}function handleEntityNotFound(_0x59c48d,_0x22fb11){return function(_0x2902f9){if(!_0x2902f9){_0x59c48d['sendStatus'](0x194);}return _0x2902f9;};}function handleError(_0x254b02,_0xea5cd5){_0xea5cd5=_0xea5cd5||0x1f4;return function(_0xf3e82d){logger[_0x118a('0x20')](_0xf3e82d['stack']);if(_0xf3e82d[_0x118a('0x30')]){delete _0xf3e82d[_0x118a('0x30')];}_0x254b02[_0x118a('0x27')](_0xea5cd5)[_0x118a('0x31')](_0xf3e82d);};}exports['index']=function(_0xdf2f85,_0x509397){var _0x55c913={},_0x947939={},_0x400af2={'count':0x0,'rows':[]};var _0x53b424=_['map'](db[_0x118a('0x32')][_0x118a('0x33')],function(_0x51222b){return{'name':_0x51222b['fieldName'],'type':_0x51222b[_0x118a('0x34')][_0x118a('0x35')]};});_0x947939[_0x118a('0x36')]=_[_0x118a('0x37')](_0x53b424,_0x118a('0x30'));_0x947939['query']=_[_0x118a('0x38')](_0xdf2f85[_0x118a('0x39')]);_0x947939[_0x118a('0x3a')]=_['intersection'](_0x947939['model'],_0x947939[_0x118a('0x39')]);_0x55c913[_0x118a('0x3b')]=_['intersection'](_0x947939['model'],qs[_0x118a('0x3c')](_0xdf2f85[_0x118a('0x39')]['fields']));_0x55c913[_0x118a('0x3b')]=_0x55c913[_0x118a('0x3b')][_0x118a('0x3d')]?_0x55c913[_0x118a('0x3b')]:_0x947939[_0x118a('0x36')];if(!_0xdf2f85[_0x118a('0x39')][_0x118a('0x3e')](_0x118a('0x3f'))){_0x55c913[_0x118a('0x40')]=qs['limit'](_0xdf2f85[_0x118a('0x39')]['limit']);_0x55c913[_0x118a('0x2b')]=qs[_0x118a('0x2b')](_0xdf2f85['query'][_0x118a('0x2b')]);}_0x55c913[_0x118a('0x41')]=qs[_0x118a('0x42')](_0xdf2f85['query'][_0x118a('0x42')]);_0x55c913['where']=qs['filters'](_[_0x118a('0x43')](_0xdf2f85['query'],_0x947939[_0x118a('0x3a')]),_0x53b424);if(_0xdf2f85[_0x118a('0x39')]['filter']){_0x55c913[_0x118a('0x44')]=_[_0x118a('0x45')](_0x55c913['where'],{'$or':_['map'](_0x53b424,function(_0x50e2a6){if(_0x50e2a6[_0x118a('0x34')]!==_0x118a('0x46')){var _0x2be6f1={};_0x2be6f1[_0x50e2a6['name']]={'$like':'%'+_0xdf2f85[_0x118a('0x39')][_0x118a('0x47')]+'%'};return _0x2be6f1;}})});}_0x55c913=_[_0x118a('0x45')]({},_0x55c913,_0xdf2f85[_0x118a('0x48')]);var _0x5f08e4={'where':_0x55c913[_0x118a('0x44')]};return db[_0x118a('0x32')][_0x118a('0x2a')](_0x5f08e4)[_0x118a('0x1a')](function(_0x678151){_0x400af2[_0x118a('0x2a')]=_0x678151;if(_0xdf2f85['query']['includeAll']){_0x55c913['include']=[{'all':!![]}];}return db[_0x118a('0x32')][_0x118a('0x49')](_0x55c913);})['then'](function(_0x372bb0){_0x400af2[_0x118a('0x4a')]=_0x372bb0;return _0x400af2;})[_0x118a('0x1a')](respondWithFilteredResult(_0x509397,_0x55c913))['catch'](handleError(_0x509397,null));};exports[_0x118a('0x4b')]=function(_0x32d994,_0x10e4d3){var _0x2cada8={'raw':![],'where':{'id':_0x32d994[_0x118a('0x4c')]['id']}},_0x2cc41c={};_0x2cc41c[_0x118a('0x36')]=_[_0x118a('0x38')](db[_0x118a('0x32')][_0x118a('0x33')]);_0x2cc41c[_0x118a('0x39')]=_['keys'](_0x32d994[_0x118a('0x39')]);_0x2cc41c[_0x118a('0x3a')]=_[_0x118a('0x4d')](_0x2cc41c[_0x118a('0x36')],_0x2cc41c[_0x118a('0x39')]);_0x2cada8[_0x118a('0x3b')]=_[_0x118a('0x4d')](_0x2cc41c['model'],qs[_0x118a('0x3c')](_0x32d994[_0x118a('0x39')][_0x118a('0x3c')]));_0x2cada8[_0x118a('0x3b')]=_0x2cada8[_0x118a('0x3b')]['length']?_0x2cada8[_0x118a('0x3b')]:_0x2cc41c[_0x118a('0x36')];if(_0x32d994[_0x118a('0x39')][_0x118a('0x4e')]){_0x2cada8['include']=[{'all':!![]}];}_0x2cada8=_[_0x118a('0x45')]({},_0x2cada8,_0x32d994[_0x118a('0x48')]);return db[_0x118a('0x32')]['find'](_0x2cada8)[_0x118a('0x1a')](handleEntityNotFound(_0x10e4d3,null))[_0x118a('0x1a')](respondWithResult(_0x10e4d3,null))[_0x118a('0x25')](handleError(_0x10e4d3,null));};exports['create']=function(_0x44b75a,_0x85e9f5){return db['SalesforceConfiguration'][_0x118a('0x4f')](_0x44b75a[_0x118a('0x50')],{})[_0x118a('0x1a')](respondWithResult(_0x85e9f5,0xc9))[_0x118a('0x25')](handleError(_0x85e9f5,null));};exports[_0x118a('0x2e')]=function(_0x101401,_0x420d69){if(_0x101401[_0x118a('0x50')]['id']){delete _0x101401[_0x118a('0x50')]['id'];}return db[_0x118a('0x32')][_0x118a('0x51')]({'where':{'id':_0x101401['params']['id']}})['then'](handleEntityNotFound(_0x420d69,null))[_0x118a('0x1a')](saveUpdates(_0x101401[_0x118a('0x50')],null))[_0x118a('0x1a')](respondWithResult(_0x420d69,null))[_0x118a('0x25')](handleError(_0x420d69,null));};exports[_0x118a('0x2f')]=function(_0x55bc7a,_0x42babb){return db[_0x118a('0x32')][_0x118a('0x51')]({'where':{'id':_0x55bc7a[_0x118a('0x4c')]['id']}})[_0x118a('0x1a')](handleEntityNotFound(_0x42babb,null))[_0x118a('0x1a')](removeEntity(_0x42babb,null))[_0x118a('0x25')](handleError(_0x42babb,null));};exports[_0x118a('0x52')]=function(_0x2a7f18,_0xeab7ca,_0x40b611){var _0x41f3c8={};var _0x2acc17={};var _0x34922c;var _0xb3b085;return db['SalesforceConfiguration'][_0x118a('0x53')]({'where':{'id':_0x2a7f18['params']['id']}})[_0x118a('0x1a')](handleEntityNotFound(_0xeab7ca,null))[_0x118a('0x1a')](function(_0x410b75){if(_0x410b75){_0x34922c=_0x410b75;_0x2acc17[_0x118a('0x36')]=_['keys'](db['SalesforceField']['rawAttributes']);_0x2acc17[_0x118a('0x39')]=_[_0x118a('0x38')](_0x2a7f18[_0x118a('0x39')]);_0x2acc17[_0x118a('0x3a')]=_['intersection'](_0x2acc17[_0x118a('0x36')],_0x2acc17[_0x118a('0x39')]);_0x41f3c8['attributes']=_[_0x118a('0x4d')](_0x2acc17[_0x118a('0x36')],qs[_0x118a('0x3c')](_0x2a7f18[_0x118a('0x39')][_0x118a('0x3c')]));_0x41f3c8[_0x118a('0x3b')]=_0x41f3c8['attributes'][_0x118a('0x3d')]?_0x41f3c8['attributes']:_0x2acc17[_0x118a('0x36')];_0x41f3c8['order']=qs['sort'](_0x2a7f18[_0x118a('0x39')][_0x118a('0x42')]);_0x41f3c8[_0x118a('0x44')]=qs[_0x118a('0x3a')](_['pick'](_0x2a7f18[_0x118a('0x39')],_0x2acc17[_0x118a('0x3a')]));if(_0x2a7f18[_0x118a('0x39')][_0x118a('0x47')]){_0x41f3c8[_0x118a('0x44')]=_[_0x118a('0x45')](_0x41f3c8[_0x118a('0x44')],{'$or':_[_0x118a('0x37')](_0x41f3c8['attributes'],function(_0x5790ee){var _0x4f04cc={};_0x4f04cc[_0x5790ee]={'$like':'%'+_0x2a7f18[_0x118a('0x39')][_0x118a('0x47')]+'%'};return _0x4f04cc;})});}_0x41f3c8=_[_0x118a('0x45')]({},_0x41f3c8,_0x2a7f18[_0x118a('0x48')]);return _0x34922c[_0x118a('0x52')](_0x41f3c8);}})[_0x118a('0x1a')](function(_0x18b5b4){if(_0x18b5b4){_0xb3b085=_0x18b5b4[_0x118a('0x3d')];if(!_0x2a7f18[_0x118a('0x39')]['hasOwnProperty'](_0x118a('0x3f'))){_0x41f3c8['limit']=qs[_0x118a('0x40')](_0x2a7f18[_0x118a('0x39')][_0x118a('0x40')]);_0x41f3c8[_0x118a('0x2b')]=qs[_0x118a('0x2b')](_0x2a7f18[_0x118a('0x39')][_0x118a('0x2b')]);}return _0x34922c[_0x118a('0x52')](_0x41f3c8);}})[_0x118a('0x1a')](function(_0x563dcc){if(_0x563dcc){return _0x563dcc?{'count':_0xb3b085,'rows':_0x563dcc}:null;}})[_0x118a('0x1a')](respondWithResult(_0xeab7ca,null))[_0x118a('0x25')](handleError(_0xeab7ca,null));};exports[_0x118a('0x54')]=function(_0x128535,_0x5dc6b6,_0xe39666){var _0x404311={};var _0x58a5c4={};var _0x50081e;var _0x2f59cf;return db[_0x118a('0x32')][_0x118a('0x53')]({'where':{'id':_0x128535[_0x118a('0x4c')]['id']}})[_0x118a('0x1a')](handleEntityNotFound(_0x5dc6b6,null))[_0x118a('0x1a')](function(_0x51c592){if(_0x51c592){_0x50081e=_0x51c592;_0x58a5c4[_0x118a('0x36')]=_[_0x118a('0x38')](db[_0x118a('0x55')][_0x118a('0x33')]);_0x58a5c4['query']=_['keys'](_0x128535[_0x118a('0x39')]);_0x58a5c4[_0x118a('0x3a')]=_[_0x118a('0x4d')](_0x58a5c4[_0x118a('0x36')],_0x58a5c4['query']);_0x404311[_0x118a('0x3b')]=_[_0x118a('0x4d')](_0x58a5c4[_0x118a('0x36')],qs[_0x118a('0x3c')](_0x128535['query']['fields']));_0x404311[_0x118a('0x3b')]=_0x404311['attributes'][_0x118a('0x3d')]?_0x404311[_0x118a('0x3b')]:_0x58a5c4[_0x118a('0x36')];_0x404311['order']=qs[_0x118a('0x42')](_0x128535['query'][_0x118a('0x42')]);_0x404311['where']=qs[_0x118a('0x3a')](_['pick'](_0x128535[_0x118a('0x39')],_0x58a5c4['filters']));if(_0x128535['query'][_0x118a('0x47')]){_0x404311['where']=_[_0x118a('0x45')](_0x404311[_0x118a('0x44')],{'$or':_[_0x118a('0x37')](_0x404311[_0x118a('0x3b')],function(_0x310bfe){var _0x25590a={};_0x25590a[_0x310bfe]={'$like':'%'+_0x128535[_0x118a('0x39')][_0x118a('0x47')]+'%'};return _0x25590a;})});}_0x404311=_[_0x118a('0x45')]({},_0x404311,_0x128535['options']);return _0x50081e[_0x118a('0x54')](_0x404311);}})[_0x118a('0x1a')](function(_0x2133bf){if(_0x2133bf){_0x2f59cf=_0x2133bf[_0x118a('0x3d')];if(!_0x128535[_0x118a('0x39')][_0x118a('0x3e')](_0x118a('0x3f'))){_0x404311[_0x118a('0x40')]=qs[_0x118a('0x40')](_0x128535[_0x118a('0x39')][_0x118a('0x40')]);_0x404311[_0x118a('0x2b')]=qs['offset'](_0x128535['query'][_0x118a('0x2b')]);}return _0x50081e[_0x118a('0x54')](_0x404311);}})[_0x118a('0x1a')](function(_0x2b8bef){if(_0x2b8bef){return _0x2b8bef?{'count':_0x2f59cf,'rows':_0x2b8bef}:null;}})['then'](respondWithResult(_0x5dc6b6,null))['catch'](handleError(_0x5dc6b6,null));};exports['getDescriptions']=function(_0x2d0f15,_0x3221c4,_0xfd0f04){var _0x574a3a={};var _0x3721d4={};var _0x4d3640;var _0x4aebd3;return db['SalesforceConfiguration'][_0x118a('0x53')]({'where':{'id':_0x2d0f15[_0x118a('0x4c')]['id']}})[_0x118a('0x1a')](handleEntityNotFound(_0x3221c4,null))[_0x118a('0x1a')](function(_0x22284d){if(_0x22284d){_0x4d3640=_0x22284d;_0x3721d4[_0x118a('0x36')]=_[_0x118a('0x38')](db[_0x118a('0x55')][_0x118a('0x33')]);_0x3721d4[_0x118a('0x39')]=_[_0x118a('0x38')](_0x2d0f15[_0x118a('0x39')]);_0x3721d4[_0x118a('0x3a')]=_[_0x118a('0x4d')](_0x3721d4[_0x118a('0x36')],_0x3721d4[_0x118a('0x39')]);_0x574a3a[_0x118a('0x3b')]=_[_0x118a('0x4d')](_0x3721d4[_0x118a('0x36')],qs['fields'](_0x2d0f15[_0x118a('0x39')][_0x118a('0x3c')]));_0x574a3a[_0x118a('0x3b')]=_0x574a3a[_0x118a('0x3b')][_0x118a('0x3d')]?_0x574a3a[_0x118a('0x3b')]:_0x3721d4['model'];_0x574a3a[_0x118a('0x41')]=qs[_0x118a('0x42')](_0x2d0f15[_0x118a('0x39')][_0x118a('0x42')]);_0x574a3a[_0x118a('0x44')]=qs[_0x118a('0x3a')](_[_0x118a('0x43')](_0x2d0f15['query'],_0x3721d4[_0x118a('0x3a')]));if(_0x2d0f15[_0x118a('0x39')]['filter']){_0x574a3a[_0x118a('0x44')]=_[_0x118a('0x45')](_0x574a3a[_0x118a('0x44')],{'$or':_[_0x118a('0x37')](_0x574a3a[_0x118a('0x3b')],function(_0x5917ff){var _0x1e714d={};_0x1e714d[_0x5917ff]={'$like':'%'+_0x2d0f15[_0x118a('0x39')]['filter']+'%'};return _0x1e714d;})});}_0x574a3a=_[_0x118a('0x45')]({},_0x574a3a,_0x2d0f15[_0x118a('0x48')]);return _0x4d3640[_0x118a('0x56')](_0x574a3a);}})[_0x118a('0x1a')](function(_0x1ca6b2){if(_0x1ca6b2){_0x4aebd3=_0x1ca6b2[_0x118a('0x3d')];if(!_0x2d0f15[_0x118a('0x39')]['hasOwnProperty']('nolimit')){_0x574a3a[_0x118a('0x40')]=qs[_0x118a('0x40')](_0x2d0f15[_0x118a('0x39')][_0x118a('0x40')]);_0x574a3a['offset']=qs[_0x118a('0x2b')](_0x2d0f15[_0x118a('0x39')][_0x118a('0x2b')]);}return _0x4d3640[_0x118a('0x56')](_0x574a3a);}})[_0x118a('0x1a')](function(_0x408aba){if(_0x408aba){return _0x408aba?{'count':_0x4aebd3,'rows':_0x408aba}:null;}})['then'](respondWithResult(_0x3221c4,null))[_0x118a('0x25')](handleError(_0x3221c4,null));}; \ No newline at end of file +var _0x829d=['fields','nolimit','limit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','SalesforceConfiguration','count','includeAll','findAll','rows','show','rawAttributes','length','include','find','create','body','params','getFields','findOne','hasOwnProperty','getSubjects','SalesforceField','getDescriptions','html-pdf','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','sendStatus','end','status','json','offset','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x829d,0x183));var _0xd829=function(_0x354a60,_0x2b7c6e){_0x354a60=_0x354a60-0x0;var _0x470775=_0x829d[_0x354a60];return _0x470775;};'use strict';var pdf=require(_0xd829('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd829('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd829('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd829('0x3'));var Mustache=require(_0xd829('0x4'));var util=require(_0xd829('0x5'));var path=require(_0xd829('0x6'));var sox=require(_0xd829('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd829('0x8'));var crypto=require(_0xd829('0x9'));var jsforce=require(_0xd829('0xa'));var deskjs=require(_0xd829('0xb'));var toCsv=require(_0xd829('0xc'));var querystring=require(_0xd829('0xd'));var Papa=require(_0xd829('0xe'));var Redis=require('ioredis');var authService=require(_0xd829('0xf'));var qs=require(_0xd829('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd829('0x11'));var logger=require('../../config/logger')(_0xd829('0x12'));var utils=require(_0xd829('0x13'));var config=require(_0xd829('0x14'));var licenseUtil=require(_0xd829('0x15'));var db=require(_0xd829('0x16'))['db'];var jayson=require(_0xd829('0x17'));var client=jayson[_0xd829('0x18')][_0xd829('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x332eb5,_0x1bc50f,_0x29a389,_0xfe1bf2){return new BPromise(function(_0xe6964e,_0x45b941){var _0x3a1a71=_0xfe1bf2||client;return _0x3a1a71['request'](_0x332eb5,_0x29a389)[_0xd829('0x1a')](function(_0x3edfd6){logger['info'](_0xd829('0x1b'),_0x1bc50f,_0xd829('0x1c'));logger[_0xd829('0x1d')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x1bc50f,_0xd829('0x1c'),JSON['stringify'](_0x3edfd6));if(_0x3edfd6[_0xd829('0x1e')]){if(_0x3edfd6[_0xd829('0x1e')]['code']===0x1f4){logger[_0xd829('0x1e')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1bc50f,_0x3edfd6[_0xd829('0x1e')][_0xd829('0x1f')]);return _0x45b941(_0x3edfd6['error'][_0xd829('0x1f')]);}logger[_0xd829('0x1e')](_0xd829('0x1b'),_0x1bc50f,_0x3edfd6[_0xd829('0x1e')]['message']);return _0xe6964e(_0x3edfd6['error']['message']);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x1bc50f,_0xd829('0x1c'));_0xe6964e(_0x3edfd6[_0xd829('0x20')][_0xd829('0x1f')]);}})[_0xd829('0x21')](function(_0x58ae5d){logger['error'](_0xd829('0x1b'),_0x1bc50f,_0x58ae5d);_0x45b941(_0x58ae5d);});});}function respondWithStatusCode(_0x250283,_0x6e59b9){_0x6e59b9=_0x6e59b9||0xcc;return function(_0x10a060){if(_0x10a060){return _0x250283[_0xd829('0x22')](_0x6e59b9);}return _0x250283['status'](_0x6e59b9)[_0xd829('0x23')]();};}function respondWithResult(_0x56cdfc,_0x2e58d6){_0x2e58d6=_0x2e58d6||0xc8;return function(_0x329780){if(_0x329780){return _0x56cdfc[_0xd829('0x24')](_0x2e58d6)[_0xd829('0x25')](_0x329780);}};}function respondWithFilteredResult(_0x5a2c7a,_0x541140){return function(_0x3553f1){if(_0x3553f1){var _0x51112c=_0x3553f1['count'],_0x462b8a=_0x541140[_0xd829('0x26')],_0xe8d5fb=_0x541140[_0xd829('0x26')]+_0x541140['limit'],_0x4a28df;if(_0xe8d5fb>=_0x51112c){_0xe8d5fb=_0x51112c;_0x4a28df=0xc8;}else{_0x4a28df=0xce;}_0x5a2c7a[_0xd829('0x24')](_0x4a28df);return _0x5a2c7a[_0xd829('0x27')](_0xd829('0x28'),_0x462b8a+'-'+_0xe8d5fb+'/'+_0x51112c)[_0xd829('0x25')](_0x3553f1);}return null;};}function patchUpdates(_0x5e43c6){return function(_0x83ecfa){try{jsonpatch[_0xd829('0x29')](_0x83ecfa,_0x5e43c6,!![]);}catch(_0x4cf0ae){return BPromise[_0xd829('0x2a')](_0x4cf0ae);}return _0x83ecfa[_0xd829('0x2b')]();};}function saveUpdates(_0x3a6d0a,_0x56c17b){return function(_0x4a0614){if(_0x4a0614){return _0x4a0614[_0xd829('0x2c')](_0x3a6d0a)[_0xd829('0x1a')](function(_0x2731f8){return _0x2731f8;});}return null;};}function removeEntity(_0x1527a6,_0xf1d1d8){return function(_0x28b879){if(_0x28b879){return _0x28b879[_0xd829('0x2d')]()[_0xd829('0x1a')](function(){_0x1527a6['status'](0xcc)[_0xd829('0x23')]();});}};}function handleEntityNotFound(_0x324c87,_0x12efc9){return function(_0x2b8776){if(!_0x2b8776){_0x324c87[_0xd829('0x22')](0x194);}return _0x2b8776;};}function handleError(_0x3ad7f4,_0x384617){_0x384617=_0x384617||0x1f4;return function(_0x153e5e){logger['error'](_0x153e5e['stack']);if(_0x153e5e[_0xd829('0x2e')]){delete _0x153e5e['name'];}_0x3ad7f4[_0xd829('0x24')](_0x384617)[_0xd829('0x2f')](_0x153e5e);};}exports[_0xd829('0x30')]=function(_0x30bb8d,_0x2ebe04){var _0x34b31e={},_0x1f639c={},_0x3ba2ba={'count':0x0,'rows':[]};var _0x3cb8f2=_[_0xd829('0x31')](db['SalesforceConfiguration']['rawAttributes'],function(_0x2fa851){return{'name':_0x2fa851[_0xd829('0x32')],'type':_0x2fa851['type'][_0xd829('0x33')]};});_0x1f639c[_0xd829('0x34')]=_[_0xd829('0x31')](_0x3cb8f2,_0xd829('0x2e'));_0x1f639c[_0xd829('0x35')]=_[_0xd829('0x36')](_0x30bb8d['query']);_0x1f639c[_0xd829('0x37')]=_[_0xd829('0x38')](_0x1f639c[_0xd829('0x34')],_0x1f639c[_0xd829('0x35')]);_0x34b31e[_0xd829('0x39')]=_[_0xd829('0x38')](_0x1f639c[_0xd829('0x34')],qs[_0xd829('0x3a')](_0x30bb8d[_0xd829('0x35')]['fields']));_0x34b31e[_0xd829('0x39')]=_0x34b31e[_0xd829('0x39')]['length']?_0x34b31e[_0xd829('0x39')]:_0x1f639c['model'];if(!_0x30bb8d[_0xd829('0x35')]['hasOwnProperty'](_0xd829('0x3b'))){_0x34b31e['limit']=qs[_0xd829('0x3c')](_0x30bb8d[_0xd829('0x35')][_0xd829('0x3c')]);_0x34b31e[_0xd829('0x26')]=qs[_0xd829('0x26')](_0x30bb8d[_0xd829('0x35')][_0xd829('0x26')]);}_0x34b31e[_0xd829('0x3d')]=qs['sort'](_0x30bb8d['query'][_0xd829('0x3e')]);_0x34b31e['where']=qs[_0xd829('0x37')](_[_0xd829('0x3f')](_0x30bb8d[_0xd829('0x35')],_0x1f639c[_0xd829('0x37')]),_0x3cb8f2);if(_0x30bb8d[_0xd829('0x35')]['filter']){_0x34b31e[_0xd829('0x40')]=_[_0xd829('0x41')](_0x34b31e[_0xd829('0x40')],{'$or':_['map'](_0x3cb8f2,function(_0xf3693a){if(_0xf3693a[_0xd829('0x42')]!==_0xd829('0x43')){var _0x2e52ff={};_0x2e52ff[_0xf3693a[_0xd829('0x2e')]]={'$like':'%'+_0x30bb8d[_0xd829('0x35')][_0xd829('0x44')]+'%'};return _0x2e52ff;}})});}_0x34b31e=_[_0xd829('0x41')]({},_0x34b31e,_0x30bb8d[_0xd829('0x45')]);var _0x73ba00={'where':_0x34b31e[_0xd829('0x40')]};return db[_0xd829('0x46')][_0xd829('0x47')](_0x73ba00)[_0xd829('0x1a')](function(_0x2e6763){_0x3ba2ba[_0xd829('0x47')]=_0x2e6763;if(_0x30bb8d[_0xd829('0x35')][_0xd829('0x48')]){_0x34b31e['include']=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xd829('0x49')](_0x34b31e);})[_0xd829('0x1a')](function(_0x19236e){_0x3ba2ba[_0xd829('0x4a')]=_0x19236e;return _0x3ba2ba;})[_0xd829('0x1a')](respondWithFilteredResult(_0x2ebe04,_0x34b31e))[_0xd829('0x21')](handleError(_0x2ebe04,null));};exports[_0xd829('0x4b')]=function(_0x18e7a1,_0x350504){var _0x4d4011={'raw':![],'where':{'id':_0x18e7a1['params']['id']}},_0x26941b={};_0x26941b['model']=_[_0xd829('0x36')](db['SalesforceConfiguration'][_0xd829('0x4c')]);_0x26941b[_0xd829('0x35')]=_[_0xd829('0x36')](_0x18e7a1[_0xd829('0x35')]);_0x26941b[_0xd829('0x37')]=_[_0xd829('0x38')](_0x26941b['model'],_0x26941b[_0xd829('0x35')]);_0x4d4011[_0xd829('0x39')]=_[_0xd829('0x38')](_0x26941b['model'],qs['fields'](_0x18e7a1[_0xd829('0x35')][_0xd829('0x3a')]));_0x4d4011['attributes']=_0x4d4011[_0xd829('0x39')][_0xd829('0x4d')]?_0x4d4011['attributes']:_0x26941b[_0xd829('0x34')];if(_0x18e7a1[_0xd829('0x35')][_0xd829('0x48')]){_0x4d4011[_0xd829('0x4e')]=[{'all':!![]}];}_0x4d4011=_[_0xd829('0x41')]({},_0x4d4011,_0x18e7a1[_0xd829('0x45')]);return db[_0xd829('0x46')][_0xd829('0x4f')](_0x4d4011)[_0xd829('0x1a')](handleEntityNotFound(_0x350504,null))[_0xd829('0x1a')](respondWithResult(_0x350504,null))[_0xd829('0x21')](handleError(_0x350504,null));};exports['create']=function(_0x399946,_0x197755){return db[_0xd829('0x46')][_0xd829('0x50')](_0x399946[_0xd829('0x51')],{})[_0xd829('0x1a')](respondWithResult(_0x197755,0xc9))[_0xd829('0x21')](handleError(_0x197755,null));};exports[_0xd829('0x2c')]=function(_0x28605a,_0x982313){if(_0x28605a[_0xd829('0x51')]['id']){delete _0x28605a[_0xd829('0x51')]['id'];}return db[_0xd829('0x46')][_0xd829('0x4f')]({'where':{'id':_0x28605a[_0xd829('0x52')]['id']}})['then'](handleEntityNotFound(_0x982313,null))[_0xd829('0x1a')](saveUpdates(_0x28605a[_0xd829('0x51')],null))['then'](respondWithResult(_0x982313,null))['catch'](handleError(_0x982313,null));};exports[_0xd829('0x2d')]=function(_0x2c5239,_0x46ca74){return db[_0xd829('0x46')]['find']({'where':{'id':_0x2c5239[_0xd829('0x52')]['id']}})[_0xd829('0x1a')](handleEntityNotFound(_0x46ca74,null))[_0xd829('0x1a')](removeEntity(_0x46ca74,null))[_0xd829('0x21')](handleError(_0x46ca74,null));};exports[_0xd829('0x53')]=function(_0xba1031,_0x36aea8,_0x365f56){var _0x5b46de={};var _0x3599a1={};var _0x5655c9;var _0x4803c9;return db[_0xd829('0x46')][_0xd829('0x54')]({'where':{'id':_0xba1031['params']['id']}})['then'](handleEntityNotFound(_0x36aea8,null))['then'](function(_0x421124){if(_0x421124){_0x5655c9=_0x421124;_0x3599a1['model']=_['keys'](db['SalesforceField'][_0xd829('0x4c')]);_0x3599a1[_0xd829('0x35')]=_[_0xd829('0x36')](_0xba1031[_0xd829('0x35')]);_0x3599a1[_0xd829('0x37')]=_[_0xd829('0x38')](_0x3599a1[_0xd829('0x34')],_0x3599a1[_0xd829('0x35')]);_0x5b46de[_0xd829('0x39')]=_[_0xd829('0x38')](_0x3599a1[_0xd829('0x34')],qs[_0xd829('0x3a')](_0xba1031[_0xd829('0x35')][_0xd829('0x3a')]));_0x5b46de[_0xd829('0x39')]=_0x5b46de[_0xd829('0x39')][_0xd829('0x4d')]?_0x5b46de['attributes']:_0x3599a1['model'];_0x5b46de[_0xd829('0x3d')]=qs[_0xd829('0x3e')](_0xba1031['query'][_0xd829('0x3e')]);_0x5b46de[_0xd829('0x40')]=qs[_0xd829('0x37')](_['pick'](_0xba1031[_0xd829('0x35')],_0x3599a1[_0xd829('0x37')]));if(_0xba1031[_0xd829('0x35')][_0xd829('0x44')]){_0x5b46de[_0xd829('0x40')]=_['merge'](_0x5b46de['where'],{'$or':_['map'](_0x5b46de['attributes'],function(_0x1a827d){var _0x24cb45={};_0x24cb45[_0x1a827d]={'$like':'%'+_0xba1031[_0xd829('0x35')][_0xd829('0x44')]+'%'};return _0x24cb45;})});}_0x5b46de=_['merge']({},_0x5b46de,_0xba1031[_0xd829('0x45')]);return _0x5655c9[_0xd829('0x53')](_0x5b46de);}})[_0xd829('0x1a')](function(_0x3354d8){if(_0x3354d8){_0x4803c9=_0x3354d8[_0xd829('0x4d')];if(!_0xba1031[_0xd829('0x35')][_0xd829('0x55')](_0xd829('0x3b'))){_0x5b46de['limit']=qs['limit'](_0xba1031[_0xd829('0x35')][_0xd829('0x3c')]);_0x5b46de[_0xd829('0x26')]=qs[_0xd829('0x26')](_0xba1031[_0xd829('0x35')]['offset']);}return _0x5655c9[_0xd829('0x53')](_0x5b46de);}})[_0xd829('0x1a')](function(_0x416359){if(_0x416359){return _0x416359?{'count':_0x4803c9,'rows':_0x416359}:null;}})[_0xd829('0x1a')](respondWithResult(_0x36aea8,null))['catch'](handleError(_0x36aea8,null));};exports[_0xd829('0x56')]=function(_0x449a4d,_0x38b892,_0x423969){var _0x2a8133={};var _0x27abac={};var _0x448ab2;var _0x3ffb26;return db['SalesforceConfiguration'][_0xd829('0x54')]({'where':{'id':_0x449a4d[_0xd829('0x52')]['id']}})['then'](handleEntityNotFound(_0x38b892,null))[_0xd829('0x1a')](function(_0x259606){if(_0x259606){_0x448ab2=_0x259606;_0x27abac['model']=_['keys'](db[_0xd829('0x57')][_0xd829('0x4c')]);_0x27abac['query']=_[_0xd829('0x36')](_0x449a4d['query']);_0x27abac[_0xd829('0x37')]=_[_0xd829('0x38')](_0x27abac[_0xd829('0x34')],_0x27abac[_0xd829('0x35')]);_0x2a8133[_0xd829('0x39')]=_['intersection'](_0x27abac[_0xd829('0x34')],qs[_0xd829('0x3a')](_0x449a4d[_0xd829('0x35')][_0xd829('0x3a')]));_0x2a8133[_0xd829('0x39')]=_0x2a8133['attributes'][_0xd829('0x4d')]?_0x2a8133[_0xd829('0x39')]:_0x27abac[_0xd829('0x34')];_0x2a8133['order']=qs[_0xd829('0x3e')](_0x449a4d[_0xd829('0x35')][_0xd829('0x3e')]);_0x2a8133[_0xd829('0x40')]=qs[_0xd829('0x37')](_['pick'](_0x449a4d[_0xd829('0x35')],_0x27abac[_0xd829('0x37')]));if(_0x449a4d['query']['filter']){_0x2a8133[_0xd829('0x40')]=_['merge'](_0x2a8133[_0xd829('0x40')],{'$or':_[_0xd829('0x31')](_0x2a8133['attributes'],function(_0x2a6e09){var _0x8bc3d6={};_0x8bc3d6[_0x2a6e09]={'$like':'%'+_0x449a4d[_0xd829('0x35')]['filter']+'%'};return _0x8bc3d6;})});}_0x2a8133=_['merge']({},_0x2a8133,_0x449a4d[_0xd829('0x45')]);return _0x448ab2['getSubjects'](_0x2a8133);}})[_0xd829('0x1a')](function(_0x40c3a1){if(_0x40c3a1){_0x3ffb26=_0x40c3a1[_0xd829('0x4d')];if(!_0x449a4d[_0xd829('0x35')][_0xd829('0x55')]('nolimit')){_0x2a8133[_0xd829('0x3c')]=qs[_0xd829('0x3c')](_0x449a4d[_0xd829('0x35')][_0xd829('0x3c')]);_0x2a8133[_0xd829('0x26')]=qs['offset'](_0x449a4d[_0xd829('0x35')][_0xd829('0x26')]);}return _0x448ab2[_0xd829('0x56')](_0x2a8133);}})[_0xd829('0x1a')](function(_0x445d3e){if(_0x445d3e){return _0x445d3e?{'count':_0x3ffb26,'rows':_0x445d3e}:null;}})[_0xd829('0x1a')](respondWithResult(_0x38b892,null))[_0xd829('0x21')](handleError(_0x38b892,null));};exports[_0xd829('0x58')]=function(_0x5541ea,_0x40d317,_0x2f41bf){var _0x33161a={};var _0x2edb0f={};var _0x56bcf2;var _0x314cbf;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x5541ea[_0xd829('0x52')]['id']}})[_0xd829('0x1a')](handleEntityNotFound(_0x40d317,null))[_0xd829('0x1a')](function(_0x275531){if(_0x275531){_0x56bcf2=_0x275531;_0x2edb0f[_0xd829('0x34')]=_[_0xd829('0x36')](db[_0xd829('0x57')]['rawAttributes']);_0x2edb0f[_0xd829('0x35')]=_[_0xd829('0x36')](_0x5541ea['query']);_0x2edb0f[_0xd829('0x37')]=_['intersection'](_0x2edb0f[_0xd829('0x34')],_0x2edb0f['query']);_0x33161a[_0xd829('0x39')]=_[_0xd829('0x38')](_0x2edb0f[_0xd829('0x34')],qs['fields'](_0x5541ea[_0xd829('0x35')][_0xd829('0x3a')]));_0x33161a['attributes']=_0x33161a[_0xd829('0x39')][_0xd829('0x4d')]?_0x33161a[_0xd829('0x39')]:_0x2edb0f[_0xd829('0x34')];_0x33161a[_0xd829('0x3d')]=qs[_0xd829('0x3e')](_0x5541ea['query'][_0xd829('0x3e')]);_0x33161a[_0xd829('0x40')]=qs['filters'](_[_0xd829('0x3f')](_0x5541ea[_0xd829('0x35')],_0x2edb0f[_0xd829('0x37')]));if(_0x5541ea[_0xd829('0x35')][_0xd829('0x44')]){_0x33161a['where']=_['merge'](_0x33161a[_0xd829('0x40')],{'$or':_[_0xd829('0x31')](_0x33161a[_0xd829('0x39')],function(_0x3152b0){var _0x46aee1={};_0x46aee1[_0x3152b0]={'$like':'%'+_0x5541ea[_0xd829('0x35')][_0xd829('0x44')]+'%'};return _0x46aee1;})});}_0x33161a=_[_0xd829('0x41')]({},_0x33161a,_0x5541ea[_0xd829('0x45')]);return _0x56bcf2[_0xd829('0x58')](_0x33161a);}})[_0xd829('0x1a')](function(_0x5ce062){if(_0x5ce062){_0x314cbf=_0x5ce062['length'];if(!_0x5541ea['query'][_0xd829('0x55')](_0xd829('0x3b'))){_0x33161a['limit']=qs[_0xd829('0x3c')](_0x5541ea[_0xd829('0x35')][_0xd829('0x3c')]);_0x33161a[_0xd829('0x26')]=qs[_0xd829('0x26')](_0x5541ea[_0xd829('0x35')]['offset']);}return _0x56bcf2[_0xd829('0x58')](_0x33161a);}})[_0xd829('0x1a')](function(_0x22a83d){if(_0x22a83d){return _0x22a83d?{'count':_0x314cbf,'rows':_0x22a83d}:null;}})[_0xd829('0x1a')](respondWithResult(_0x40d317,null))['catch'](handleError(_0x40d317,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 23afffc..7249866 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 _0x48b1=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash'];(function(_0x4e4317,_0x5162c2){var _0x33f2f0=function(_0x357356){while(--_0x357356){_0x4e4317['push'](_0x4e4317['shift']());}};_0x33f2f0(++_0x5162c2);}(_0x48b1,0x1cd));var _0x148b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x48b1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x148b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x148b('0x1'));var moment=require(_0x148b('0x2'));var BPromise=require('bluebird');var rp=require(_0x148b('0x3'));var fs=require('fs');var path=require(_0x148b('0x4'));var rimraf=require(_0x148b('0x5'));var config=require(_0x148b('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x148b('0x7')]=function(_0x1de09c,_0x1352b1){return _0x1de09c[_0x148b('0x8')](_0x148b('0x9'),attributes,{'tableName':_0x148b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47b5=['define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x47b5,0x153));var _0x547b=function(_0x1b4f53,_0x2ac9e9){_0x1b4f53=_0x1b4f53-0x0;var _0x2acd9c=_0x47b5[_0x1b4f53];return _0x2acd9c;};'use strict';var _=require(_0x547b('0x0'));var util=require(_0x547b('0x1'));var logger=require(_0x547b('0x2'))(_0x547b('0x3'));var moment=require(_0x547b('0x4'));var BPromise=require('bluebird');var rp=require(_0x547b('0x5'));var fs=require('fs');var path=require(_0x547b('0x6'));var rimraf=require(_0x547b('0x7'));var config=require(_0x547b('0x8'));var attributes=require(_0x547b('0x9'));module[_0x547b('0xa')]=function(_0x446707,_0x14e574){return _0x446707[_0x547b('0xb')](_0x547b('0xc'),attributes,{'tableName':_0x547b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 7296db4..0ab0a96 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 _0x88fb=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird'];(function(_0x3d387a,_0x81c3ff){var _0xe3eebd=function(_0x3d90bf){while(--_0x3d90bf){_0x3d387a['push'](_0x3d387a['shift']());}};_0xe3eebd(++_0x81c3ff);}(_0x88fb,0xa4));var _0xb88f=function(_0x189f5e,_0x168d32){_0x189f5e=_0x189f5e-0x0;var _0x2a0809=_0x88fb[_0x189f5e];return _0x2a0809;};'use strict';var _=require(_0xb88f('0x0'));var util=require(_0xb88f('0x1'));var moment=require(_0xb88f('0x2'));var BPromise=require(_0xb88f('0x3'));var rs=require(_0xb88f('0x4'));var fs=require('fs');var Redis=require(_0xb88f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb88f('0x6'));var logger=require(_0xb88f('0x7'))('rpc');var config=require(_0xb88f('0x8'));var jayson=require(_0xb88f('0x9'));var client=jayson['client'][_0xb88f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ed8c2,_0xc72e7d,_0x5a607d){return new BPromise(function(_0x222952,_0x72664){return client[_0xb88f('0xb')](_0x3ed8c2,_0x5a607d)['then'](function(_0x2bee6f){logger[_0xb88f('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0xc72e7d,_0xb88f('0xd'));logger[_0xb88f('0xe')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0xc72e7d,'request\x20sent',JSON[_0xb88f('0xf')](_0x2bee6f));if(_0x2bee6f[_0xb88f('0x10')]){if(_0x2bee6f['error'][_0xb88f('0x11')]===0x1f4){logger['error'](_0xb88f('0x12'),_0xc72e7d,_0x2bee6f['error'][_0xb88f('0x13')]);return _0x72664(_0x2bee6f['error'][_0xb88f('0x13')]);}logger[_0xb88f('0x10')](_0xb88f('0x12'),_0xc72e7d,_0x2bee6f['error'][_0xb88f('0x13')]);return _0x222952(_0x2bee6f['error']['message']);}else{logger[_0xb88f('0xc')](_0xb88f('0x12'),_0xc72e7d,'request\x20sent');_0x222952(_0x2bee6f['result'][_0xb88f('0x13')]);}})[_0xb88f('0x14')](function(_0x4c9ca8){logger[_0xb88f('0x10')](_0xb88f('0x12'),_0xc72e7d,_0x4c9ca8);_0x72664(_0x4c9ca8);});});} \ No newline at end of file +var _0x06d4=['request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0x4d8b1d,_0x3c42bf){var _0x467bfb=function(_0x433e40){while(--_0x433e40){_0x4d8b1d['push'](_0x4d8b1d['shift']());}};_0x467bfb(++_0x3c42bf);}(_0x06d4,0x1d2));var _0x406d=function(_0x24749b,_0x16276d){_0x24749b=_0x24749b-0x0;var _0x1db781=_0x06d4[_0x24749b];return _0x1db781;};'use strict';var _=require('lodash');var util=require(_0x406d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x406d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x406d('0x2'))['db'];var utils=require(_0x406d('0x3'));var logger=require('../../config/logger')(_0x406d('0x4'));var config=require('../../config/environment');var jayson=require(_0x406d('0x5'));var client=jayson[_0x406d('0x6')][_0x406d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x64355c,_0x2453d4,_0x2142a6){return new BPromise(function(_0x4fd885,_0x2bf11e){return client['request'](_0x64355c,_0x2142a6)[_0x406d('0x8')](function(_0x18254f){logger['info'](_0x406d('0x9'),_0x2453d4,_0x406d('0xa'));logger['debug'](_0x406d('0xb'),_0x2453d4,_0x406d('0xa'),JSON[_0x406d('0xc')](_0x18254f));if(_0x18254f[_0x406d('0xd')]){if(_0x18254f[_0x406d('0xd')][_0x406d('0xe')]===0x1f4){logger[_0x406d('0xd')](_0x406d('0x9'),_0x2453d4,_0x18254f[_0x406d('0xd')][_0x406d('0xf')]);return _0x2bf11e(_0x18254f[_0x406d('0xd')][_0x406d('0xf')]);}logger[_0x406d('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x2453d4,_0x18254f[_0x406d('0xd')][_0x406d('0xf')]);return _0x4fd885(_0x18254f[_0x406d('0xd')]['message']);}else{logger['info'](_0x406d('0x9'),_0x2453d4,_0x406d('0xa'));_0x4fd885(_0x18254f['result'][_0x406d('0xf')]);}})[_0x406d('0x10')](function(_0x7bd887){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x2453d4,_0x7bd887);_0x2bf11e(_0x7bd887);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index a5a7ad3..642f214 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 _0xa80c=['delete','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','index','get','/:id','isAuthenticated','show','post','create','put'];(function(_0x282a1f,_0x49a6ef){var _0x296ea7=function(_0x4bac68){while(--_0x4bac68){_0x282a1f['push'](_0x282a1f['shift']());}};_0x296ea7(++_0x49a6ef);}(_0xa80c,0x151));var _0xca80=function(_0x479b6b,_0x267866){_0x479b6b=_0x479b6b-0x0;var _0x3ce2e1=_0xa80c[_0x479b6b];return _0x3ce2e1;};'use strict';var multer=require('multer');var util=require(_0xca80('0x0'));var path=require(_0xca80('0x1'));var timeout=require(_0xca80('0x2'));var express=require('express');var router=express[_0xca80('0x3')]();var auth=require(_0xca80('0x4'));var interaction=require(_0xca80('0x5'));var config=require('../../config/environment');var controller=require(_0xca80('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xca80('0x7')]);router[_0xca80('0x8')](_0xca80('0x9'),auth[_0xca80('0xa')](),controller[_0xca80('0xb')]);router[_0xca80('0xc')]('/',auth['isAuthenticated'](),controller[_0xca80('0xd')]);router[_0xca80('0xe')]('/:id',auth[_0xca80('0xa')](),controller['update']);router[_0xca80('0xf')]('/:id',auth[_0xca80('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x61bd=['delete','destroy','exports','multer','path','express','../../components/interaction/service','./intSalesforceField.controller','get','index','/:id','isAuthenticated','show','create','put'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x61bd,0x1d4));var _0xd61b=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x61bd[_0x4a747d];return _0x3a5b5c;};'use strict';var multer=require(_0xd61b('0x0'));var util=require('util');var path=require(_0xd61b('0x1'));var timeout=require('connect-timeout');var express=require(_0xd61b('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xd61b('0x3'));var config=require('../../config/environment');var controller=require(_0xd61b('0x4'));router[_0xd61b('0x5')]('/',auth['isAuthenticated'](),controller[_0xd61b('0x6')]);router[_0xd61b('0x5')](_0xd61b('0x7'),auth[_0xd61b('0x8')](),controller[_0xd61b('0x9')]);router['post']('/',auth[_0xd61b('0x8')](),controller[_0xd61b('0xa')]);router[_0xd61b('0xb')](_0xd61b('0x7'),auth[_0xd61b('0x8')](),controller['update']);router[_0xd61b('0xc')](_0xd61b('0x7'),auth[_0xd61b('0x8')](),controller[_0xd61b('0xd')]);module[_0xd61b('0xe')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 732a5db..31b1407 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 _0xcb91=['string','variable','customVariable','picklist','STRING','ENUM'];(function(_0x10d019,_0x5adb64){var _0x20a29a=function(_0x4cf95a){while(--_0x4cf95a){_0x10d019['push'](_0x10d019['shift']());}};_0x20a29a(++_0x5adb64);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x492af5,_0xd51471){_0x492af5=_0x492af5-0x0;var _0x59f529=_0xcb91[_0x492af5];return _0x59f529;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x1cb9('0x0')](_0x1cb9('0x1'),_0x1cb9('0x2'),_0x1cb9('0x3'),'keyValue',_0x1cb9('0x4')),'defaultValue':_0x1cb9('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1cb9('0x5')]},'keyType':{'type':Sequelize[_0x1cb9('0x0')]('string',_0x1cb9('0x2'),_0x1cb9('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1cb9('0x5')]},'variableName':{'type':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file +var _0x9c44=['variable','customVariable','keyValue','picklist','STRING','ENUM','string'];(function(_0x2defb5,_0x1cda14){var _0x229c53=function(_0x5dd408){while(--_0x5dd408){_0x2defb5['push'](_0x2defb5['shift']());}};_0x229c53(++_0x1cda14);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x49c4('0x0')](_0x49c4('0x1'),_0x49c4('0x2'),_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x49c4('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x49c4('0x1'),_0x49c4('0x2'),_0x49c4('0x3'))},'keyContent':{'type':Sequelize[_0x49c4('0x6')]},'idField':{'type':Sequelize[_0x49c4('0x6')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index cd016e1..49f4f6e 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 _0xc90c=['status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','SalesforceField','includeAll','findAll','rows','catch','show','params','length','include','options','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x13efa5,_0x2ceea9){var _0x3656ed=function(_0x8633d3){while(--_0x8633d3){_0x13efa5['push'](_0x13efa5['shift']());}};_0x3656ed(++_0x2ceea9);}(_0xc90c,0x78));var _0xcc90=function(_0x5cc525,_0x3e081c){_0x5cc525=_0x5cc525-0x0;var _0x2dcede=_0xc90c[_0x5cc525];return _0x2dcede;};'use strict';var pdf=require(_0xcc90('0x0'));var emlformat=require(_0xcc90('0x1'));var rimraf=require(_0xcc90('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcc90('0x3'));var rp=require('request-promise');var moment=require(_0xcc90('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcc90('0x5'));var util=require(_0xcc90('0x6'));var path=require(_0xcc90('0x7'));var sox=require(_0xcc90('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xcc90('0x9'));var squel=require(_0xcc90('0xa'));var crypto=require(_0xcc90('0xb'));var jsforce=require(_0xcc90('0xc'));var deskjs=require(_0xcc90('0xd'));var toCsv=require(_0xcc90('0xe'));var querystring=require(_0xcc90('0xf'));var Papa=require(_0xcc90('0x10'));var Redis=require(_0xcc90('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xcc90('0x12'));var as=require(_0xcc90('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc90('0x14'))(_0xcc90('0x15'));var utils=require(_0xcc90('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcc90('0x17'));var db=require(_0xcc90('0x18'))['db'];function respondWithStatusCode(_0x515992,_0x487c42){_0x487c42=_0x487c42||0xcc;return function(_0x12d394){if(_0x12d394){return _0x515992[_0xcc90('0x19')](_0x487c42);}return _0x515992[_0xcc90('0x1a')](_0x487c42)[_0xcc90('0x1b')]();};}function respondWithResult(_0x1b3e6a,_0x188427){_0x188427=_0x188427||0xc8;return function(_0x2e8c4d){if(_0x2e8c4d){return _0x1b3e6a['status'](_0x188427)[_0xcc90('0x1c')](_0x2e8c4d);}};}function respondWithFilteredResult(_0x493fb4,_0x2f5557){return function(_0x4f8b7a){if(_0x4f8b7a){var _0x3b9b05=_0x4f8b7a[_0xcc90('0x1d')],_0xd64473=_0x2f5557[_0xcc90('0x1e')],_0x49c0b2=_0x2f5557['offset']+_0x2f5557[_0xcc90('0x1f')],_0x408a47;if(_0x49c0b2>=_0x3b9b05){_0x49c0b2=_0x3b9b05;_0x408a47=0xc8;}else{_0x408a47=0xce;}_0x493fb4[_0xcc90('0x1a')](_0x408a47);return _0x493fb4['set'](_0xcc90('0x20'),_0xd64473+'-'+_0x49c0b2+'/'+_0x3b9b05)['json'](_0x4f8b7a);}return null;};}function patchUpdates(_0x4bbc61){return function(_0x1ab640){try{jsonpatch['apply'](_0x1ab640,_0x4bbc61,!![]);}catch(_0x2717e9){return BPromise[_0xcc90('0x21')](_0x2717e9);}return _0x1ab640[_0xcc90('0x22')]();};}function saveUpdates(_0x5b1aee,_0x1becca){return function(_0x63aeef){if(_0x63aeef){return _0x63aeef[_0xcc90('0x23')](_0x5b1aee)[_0xcc90('0x24')](function(_0x46d2c2){return _0x46d2c2;});}return null;};}function removeEntity(_0x4cf25b,_0x5cd68a){return function(_0xf6e233){if(_0xf6e233){return _0xf6e233[_0xcc90('0x25')]()[_0xcc90('0x24')](function(){_0x4cf25b['status'](0xcc)[_0xcc90('0x1b')]();});}};}function handleEntityNotFound(_0x3e5dc1,_0x4f2d62){return function(_0x394c21){if(!_0x394c21){_0x3e5dc1[_0xcc90('0x19')](0x194);}return _0x394c21;};}function handleError(_0x4538f2,_0x2fc870){_0x2fc870=_0x2fc870||0x1f4;return function(_0x187924){logger[_0xcc90('0x26')](_0x187924[_0xcc90('0x27')]);if(_0x187924[_0xcc90('0x28')]){delete _0x187924['name'];}_0x4538f2[_0xcc90('0x1a')](_0x2fc870)[_0xcc90('0x29')](_0x187924);};}exports['index']=function(_0xfc72a2,_0x391412){var _0x14d731={},_0x244ffb={},_0x45ff9c={'count':0x0,'rows':[]};var _0x4d4711=_[_0xcc90('0x2a')](db['SalesforceField'][_0xcc90('0x2b')],function(_0x5a3625){return{'name':_0x5a3625[_0xcc90('0x2c')],'type':_0x5a3625[_0xcc90('0x2d')][_0xcc90('0x2e')]};});_0x244ffb['model']=_[_0xcc90('0x2a')](_0x4d4711,_0xcc90('0x28'));_0x244ffb[_0xcc90('0x2f')]=_[_0xcc90('0x30')](_0xfc72a2[_0xcc90('0x2f')]);_0x244ffb['filters']=_['intersection'](_0x244ffb[_0xcc90('0x31')],_0x244ffb[_0xcc90('0x2f')]);_0x14d731[_0xcc90('0x32')]=_[_0xcc90('0x33')](_0x244ffb[_0xcc90('0x31')],qs['fields'](_0xfc72a2[_0xcc90('0x2f')][_0xcc90('0x34')]));_0x14d731['attributes']=_0x14d731[_0xcc90('0x32')]['length']?_0x14d731[_0xcc90('0x32')]:_0x244ffb[_0xcc90('0x31')];if(!_0xfc72a2[_0xcc90('0x2f')][_0xcc90('0x35')]('nolimit')){_0x14d731['limit']=qs[_0xcc90('0x1f')](_0xfc72a2['query'][_0xcc90('0x1f')]);_0x14d731[_0xcc90('0x1e')]=qs[_0xcc90('0x1e')](_0xfc72a2['query']['offset']);}_0x14d731['order']=qs[_0xcc90('0x36')](_0xfc72a2['query'][_0xcc90('0x36')]);_0x14d731[_0xcc90('0x37')]=qs[_0xcc90('0x38')](_[_0xcc90('0x39')](_0xfc72a2['query'],_0x244ffb['filters']),_0x4d4711);if(_0xfc72a2[_0xcc90('0x2f')]['filter']){_0x14d731[_0xcc90('0x37')]=_[_0xcc90('0x3a')](_0x14d731[_0xcc90('0x37')],{'$or':_['map'](_0x4d4711,function(_0x1585fa){if(_0x1585fa[_0xcc90('0x2d')]!==_0xcc90('0x3b')){var _0x39bc22={};_0x39bc22[_0x1585fa[_0xcc90('0x28')]]={'$like':'%'+_0xfc72a2[_0xcc90('0x2f')]['filter']+'%'};return _0x39bc22;}})});}_0x14d731=_[_0xcc90('0x3a')]({},_0x14d731,_0xfc72a2['options']);var _0xd86a3c={'where':_0x14d731[_0xcc90('0x37')]};return db[_0xcc90('0x3c')][_0xcc90('0x1d')](_0xd86a3c)[_0xcc90('0x24')](function(_0x2466bb){_0x45ff9c[_0xcc90('0x1d')]=_0x2466bb;if(_0xfc72a2[_0xcc90('0x2f')][_0xcc90('0x3d')]){_0x14d731['include']=[{'all':!![]}];}return db[_0xcc90('0x3c')][_0xcc90('0x3e')](_0x14d731);})[_0xcc90('0x24')](function(_0xd66061){_0x45ff9c[_0xcc90('0x3f')]=_0xd66061;return _0x45ff9c;})[_0xcc90('0x24')](respondWithFilteredResult(_0x391412,_0x14d731))[_0xcc90('0x40')](handleError(_0x391412,null));};exports[_0xcc90('0x41')]=function(_0x47ab8e,_0x81902){var _0x2c789d={'raw':!![],'where':{'id':_0x47ab8e[_0xcc90('0x42')]['id']}},_0x12ebd6={};_0x12ebd6['model']=_[_0xcc90('0x30')](db[_0xcc90('0x3c')]['rawAttributes']);_0x12ebd6['query']=_[_0xcc90('0x30')](_0x47ab8e['query']);_0x12ebd6[_0xcc90('0x38')]=_[_0xcc90('0x33')](_0x12ebd6[_0xcc90('0x31')],_0x12ebd6[_0xcc90('0x2f')]);_0x2c789d[_0xcc90('0x32')]=_[_0xcc90('0x33')](_0x12ebd6[_0xcc90('0x31')],qs[_0xcc90('0x34')](_0x47ab8e[_0xcc90('0x2f')][_0xcc90('0x34')]));_0x2c789d['attributes']=_0x2c789d[_0xcc90('0x32')][_0xcc90('0x43')]?_0x2c789d[_0xcc90('0x32')]:_0x12ebd6[_0xcc90('0x31')];if(_0x47ab8e[_0xcc90('0x2f')][_0xcc90('0x3d')]){_0x2c789d[_0xcc90('0x44')]=[{'all':!![]}];}_0x2c789d=_['merge']({},_0x2c789d,_0x47ab8e[_0xcc90('0x45')]);return db[_0xcc90('0x3c')]['find'](_0x2c789d)[_0xcc90('0x24')](handleEntityNotFound(_0x81902,null))[_0xcc90('0x24')](respondWithResult(_0x81902,null))[_0xcc90('0x40')](handleError(_0x81902,null));};exports[_0xcc90('0x46')]=function(_0x38a863,_0x58ffa8){return db[_0xcc90('0x3c')][_0xcc90('0x46')](_0x38a863['body'],{})[_0xcc90('0x24')](respondWithResult(_0x58ffa8,0xc9))[_0xcc90('0x40')](handleError(_0x58ffa8,null));};exports[_0xcc90('0x23')]=function(_0x3a73cb,_0x974775){if(_0x3a73cb[_0xcc90('0x47')]['id']){delete _0x3a73cb['body']['id'];}return db['SalesforceField'][_0xcc90('0x48')]({'where':{'id':_0x3a73cb[_0xcc90('0x42')]['id']}})[_0xcc90('0x24')](handleEntityNotFound(_0x974775,null))[_0xcc90('0x24')](saveUpdates(_0x3a73cb[_0xcc90('0x47')],null))[_0xcc90('0x24')](respondWithResult(_0x974775,null))['catch'](handleError(_0x974775,null));};exports[_0xcc90('0x25')]=function(_0x46ef3e,_0x95c3bd){return db[_0xcc90('0x3c')][_0xcc90('0x48')]({'where':{'id':_0x46ef3e[_0xcc90('0x42')]['id']}})[_0xcc90('0x24')](handleEntityNotFound(_0x95c3bd,null))[_0xcc90('0x24')](removeEntity(_0x95c3bd,null))[_0xcc90('0x40')](handleError(_0x95c3bd,null));}; \ No newline at end of file +var _0x726e=['bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','update','then','destroy','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','rows','include','options','find','catch','create','body','params','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x5eed94,_0xb407e9){var _0x59357d=function(_0x22822f){while(--_0x22822f){_0x5eed94['push'](_0x5eed94['shift']());}};_0x59357d(++_0xb407e9);}(_0x726e,0x116));var _0xe726=function(_0x28805b,_0x5ce8a4){_0x28805b=_0x28805b-0x0;var _0x5b7c8f=_0x726e[_0x28805b];return _0x5b7c8f;};'use strict';var pdf=require(_0xe726('0x0'));var emlformat=require(_0xe726('0x1'));var rimraf=require(_0xe726('0x2'));var zipdir=require(_0xe726('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe726('0x4'));var moment=require(_0xe726('0x5'));var BPromise=require(_0xe726('0x6'));var Mustache=require(_0xe726('0x7'));var util=require(_0xe726('0x8'));var path=require(_0xe726('0x9'));var sox=require(_0xe726('0xa'));var csv=require('to-csv');var ejs=require(_0xe726('0xb'));var fs=require('fs');var _=require(_0xe726('0xc'));var squel=require(_0xe726('0xd'));var crypto=require(_0xe726('0xe'));var jsforce=require(_0xe726('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe726('0x10'));var Papa=require('papaparse');var Redis=require(_0xe726('0x11'));var authService=require(_0xe726('0x12'));var qs=require(_0xe726('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe726('0x14'));var logger=require(_0xe726('0x15'))(_0xe726('0x16'));var utils=require(_0xe726('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe726('0x18'))['db'];function respondWithStatusCode(_0x271387,_0x981028){_0x981028=_0x981028||0xcc;return function(_0x1dc3e9){if(_0x1dc3e9){return _0x271387[_0xe726('0x19')](_0x981028);}return _0x271387[_0xe726('0x1a')](_0x981028)[_0xe726('0x1b')]();};}function respondWithResult(_0x3c9c24,_0x296722){_0x296722=_0x296722||0xc8;return function(_0x3d9862){if(_0x3d9862){return _0x3c9c24[_0xe726('0x1a')](_0x296722)[_0xe726('0x1c')](_0x3d9862);}};}function respondWithFilteredResult(_0x566453,_0x5b52de){return function(_0x58bb6d){if(_0x58bb6d){var _0x30ed30=_0x58bb6d[_0xe726('0x1d')],_0x2619ed=_0x5b52de[_0xe726('0x1e')],_0x27fe17=_0x5b52de[_0xe726('0x1e')]+_0x5b52de[_0xe726('0x1f')],_0x814bc0;if(_0x27fe17>=_0x30ed30){_0x27fe17=_0x30ed30;_0x814bc0=0xc8;}else{_0x814bc0=0xce;}_0x566453[_0xe726('0x1a')](_0x814bc0);return _0x566453[_0xe726('0x20')]('Content-Range',_0x2619ed+'-'+_0x27fe17+'/'+_0x30ed30)[_0xe726('0x1c')](_0x58bb6d);}return null;};}function patchUpdates(_0x19fb3c){return function(_0x3008c4){try{jsonpatch[_0xe726('0x21')](_0x3008c4,_0x19fb3c,!![]);}catch(_0x172ab3){return BPromise[_0xe726('0x22')](_0x172ab3);}return _0x3008c4['save']();};}function saveUpdates(_0x2e46c9,_0x23a964){return function(_0x450eeb){if(_0x450eeb){return _0x450eeb[_0xe726('0x23')](_0x2e46c9)[_0xe726('0x24')](function(_0x33a92a){return _0x33a92a;});}return null;};}function removeEntity(_0xedfbe6,_0x41dbe0){return function(_0xa69fa2){if(_0xa69fa2){return _0xa69fa2[_0xe726('0x25')]()[_0xe726('0x24')](function(){_0xedfbe6['status'](0xcc)[_0xe726('0x1b')]();});}};}function handleEntityNotFound(_0x4d1d59,_0x53bf4a){return function(_0x4449f9){if(!_0x4449f9){_0x4d1d59[_0xe726('0x19')](0x194);}return _0x4449f9;};}function handleError(_0x19db84,_0x151af3){_0x151af3=_0x151af3||0x1f4;return function(_0x17eb98){logger['error'](_0x17eb98[_0xe726('0x26')]);if(_0x17eb98[_0xe726('0x27')]){delete _0x17eb98[_0xe726('0x27')];}_0x19db84[_0xe726('0x1a')](_0x151af3)[_0xe726('0x28')](_0x17eb98);};}exports[_0xe726('0x29')]=function(_0x1005c4,_0x50db63){var _0x35e634={},_0x146eb6={},_0x206f7e={'count':0x0,'rows':[]};var _0x1caadf=_[_0xe726('0x2a')](db[_0xe726('0x2b')][_0xe726('0x2c')],function(_0x24e162){return{'name':_0x24e162[_0xe726('0x2d')],'type':_0x24e162[_0xe726('0x2e')][_0xe726('0x2f')]};});_0x146eb6[_0xe726('0x30')]=_[_0xe726('0x2a')](_0x1caadf,'name');_0x146eb6[_0xe726('0x31')]=_[_0xe726('0x32')](_0x1005c4['query']);_0x146eb6[_0xe726('0x33')]=_[_0xe726('0x34')](_0x146eb6['model'],_0x146eb6[_0xe726('0x31')]);_0x35e634[_0xe726('0x35')]=_[_0xe726('0x34')](_0x146eb6[_0xe726('0x30')],qs[_0xe726('0x36')](_0x1005c4[_0xe726('0x31')][_0xe726('0x36')]));_0x35e634[_0xe726('0x35')]=_0x35e634[_0xe726('0x35')]['length']?_0x35e634[_0xe726('0x35')]:_0x146eb6[_0xe726('0x30')];if(!_0x1005c4['query'][_0xe726('0x37')]('nolimit')){_0x35e634[_0xe726('0x1f')]=qs[_0xe726('0x1f')](_0x1005c4[_0xe726('0x31')]['limit']);_0x35e634[_0xe726('0x1e')]=qs[_0xe726('0x1e')](_0x1005c4[_0xe726('0x31')][_0xe726('0x1e')]);}_0x35e634[_0xe726('0x38')]=qs[_0xe726('0x39')](_0x1005c4[_0xe726('0x31')]['sort']);_0x35e634[_0xe726('0x3a')]=qs['filters'](_[_0xe726('0x3b')](_0x1005c4[_0xe726('0x31')],_0x146eb6['filters']),_0x1caadf);if(_0x1005c4[_0xe726('0x31')][_0xe726('0x3c')]){_0x35e634[_0xe726('0x3a')]=_[_0xe726('0x3d')](_0x35e634[_0xe726('0x3a')],{'$or':_['map'](_0x1caadf,function(_0x318e16){if(_0x318e16['type']!=='VIRTUAL'){var _0x36baf2={};_0x36baf2[_0x318e16['name']]={'$like':'%'+_0x1005c4[_0xe726('0x31')][_0xe726('0x3c')]+'%'};return _0x36baf2;}})});}_0x35e634=_['merge']({},_0x35e634,_0x1005c4['options']);var _0x4cbcf2={'where':_0x35e634[_0xe726('0x3a')]};return db[_0xe726('0x2b')]['count'](_0x4cbcf2)[_0xe726('0x24')](function(_0x2f58fd){_0x206f7e['count']=_0x2f58fd;if(_0x1005c4[_0xe726('0x31')][_0xe726('0x3e')]){_0x35e634['include']=[{'all':!![]}];}return db[_0xe726('0x2b')]['findAll'](_0x35e634);})[_0xe726('0x24')](function(_0x2b3e09){_0x206f7e[_0xe726('0x3f')]=_0x2b3e09;return _0x206f7e;})[_0xe726('0x24')](respondWithFilteredResult(_0x50db63,_0x35e634))['catch'](handleError(_0x50db63,null));};exports['show']=function(_0x54ff0d,_0x522dfc){var _0x3506b4={'raw':!![],'where':{'id':_0x54ff0d['params']['id']}},_0x3ac6d5={};_0x3ac6d5[_0xe726('0x30')]=_[_0xe726('0x32')](db[_0xe726('0x2b')][_0xe726('0x2c')]);_0x3ac6d5['query']=_[_0xe726('0x32')](_0x54ff0d[_0xe726('0x31')]);_0x3ac6d5[_0xe726('0x33')]=_[_0xe726('0x34')](_0x3ac6d5[_0xe726('0x30')],_0x3ac6d5[_0xe726('0x31')]);_0x3506b4['attributes']=_[_0xe726('0x34')](_0x3ac6d5[_0xe726('0x30')],qs[_0xe726('0x36')](_0x54ff0d[_0xe726('0x31')][_0xe726('0x36')]));_0x3506b4[_0xe726('0x35')]=_0x3506b4[_0xe726('0x35')]['length']?_0x3506b4[_0xe726('0x35')]:_0x3ac6d5[_0xe726('0x30')];if(_0x54ff0d[_0xe726('0x31')][_0xe726('0x3e')]){_0x3506b4[_0xe726('0x40')]=[{'all':!![]}];}_0x3506b4=_[_0xe726('0x3d')]({},_0x3506b4,_0x54ff0d[_0xe726('0x41')]);return db[_0xe726('0x2b')][_0xe726('0x42')](_0x3506b4)[_0xe726('0x24')](handleEntityNotFound(_0x522dfc,null))[_0xe726('0x24')](respondWithResult(_0x522dfc,null))[_0xe726('0x43')](handleError(_0x522dfc,null));};exports['create']=function(_0x4cfaa7,_0x150a66){return db['SalesforceField'][_0xe726('0x44')](_0x4cfaa7[_0xe726('0x45')],{})[_0xe726('0x24')](respondWithResult(_0x150a66,0xc9))['catch'](handleError(_0x150a66,null));};exports['update']=function(_0x43f666,_0x23d6b9){if(_0x43f666[_0xe726('0x45')]['id']){delete _0x43f666['body']['id'];}return db[_0xe726('0x2b')][_0xe726('0x42')]({'where':{'id':_0x43f666[_0xe726('0x46')]['id']}})[_0xe726('0x24')](handleEntityNotFound(_0x23d6b9,null))[_0xe726('0x24')](saveUpdates(_0x43f666[_0xe726('0x45')],null))['then'](respondWithResult(_0x23d6b9,null))['catch'](handleError(_0x23d6b9,null));};exports[_0xe726('0x25')]=function(_0x366305,_0x2e77f7){return db[_0xe726('0x2b')][_0xe726('0x42')]({'where':{'id':_0x366305[_0xe726('0x46')]['id']}})[_0xe726('0x24')](handleEntityNotFound(_0x2e77f7,null))[_0xe726('0x24')](removeEntity(_0x2e77f7,null))['catch'](handleError(_0x2e77f7,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 32b42eb..22647f2 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 _0x4832=['salesforce_unique_index','idField','FieldId','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','define','int_salesforce_fields'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x4832,0x183));var _0x2483=function(_0x95942,_0x85da80){_0x95942=_0x95942-0x0;var _0x6d7f81=_0x4832[_0x95942];return _0x6d7f81;};'use strict';var _=require(_0x2483('0x0'));var util=require('util');var logger=require(_0x2483('0x1'))(_0x2483('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2483('0x3'));var fs=require('fs');var path=require(_0x2483('0x4'));var rimraf=require(_0x2483('0x5'));var config=require(_0x2483('0x6'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x178e0a,_0x3685e0){return _0x178e0a[_0x2483('0x7')]('SalesforceField',attributes,{'tableName':_0x2483('0x8'),'paranoid':![],'indexes':[{'name':_0x2483('0x9'),'fields':[_0x2483('0xa'),_0x2483('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2933=['../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x41e6f5,_0x2a95ec){var _0x54f5c2=function(_0x316adb){while(--_0x316adb){_0x41e6f5['push'](_0x41e6f5['shift']());}};_0x54f5c2(++_0x2a95ec);}(_0x2933,0x148));var _0x3293=function(_0x58d12b,_0x1599f6){_0x58d12b=_0x58d12b-0x0;var _0x183b0f=_0x2933[_0x58d12b];return _0x183b0f;};'use strict';var _=require(_0x3293('0x0'));var util=require(_0x3293('0x1'));var logger=require(_0x3293('0x2'))(_0x3293('0x3'));var moment=require(_0x3293('0x4'));var BPromise=require(_0x3293('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3293('0x6'));var rimraf=require(_0x3293('0x7'));var config=require(_0x3293('0x8'));var attributes=require(_0x3293('0x9'));module[_0x3293('0xa')]=function(_0x2f276e,_0x351cbc){return _0x2f276e[_0x3293('0xb')](_0x3293('0xc'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x3293('0xd'),'fields':[_0x3293('0xe'),_0x3293('0xf')],'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 dfd3051..cea8f41 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 _0x4483=['stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x812319,_0x2e3508){var _0xeeb857=function(_0x1af992){while(--_0x1af992){_0x812319['push'](_0x812319['shift']());}};_0xeeb857(++_0x2e3508);}(_0x4483,0x1a3));var _0x3448=function(_0xf98854,_0x8abe4c){_0xf98854=_0xf98854-0x0;var _0x456f98=_0x4483[_0xf98854];return _0x456f98;};'use strict';var _=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var moment=require(_0x3448('0x2'));var BPromise=require('bluebird');var rs=require(_0x3448('0x3'));var fs=require('fs');var Redis=require(_0x3448('0x4'));var db=require(_0x3448('0x5'))['db'];var utils=require(_0x3448('0x6'));var logger=require(_0x3448('0x7'))('rpc');var config=require(_0x3448('0x8'));var jayson=require(_0x3448('0x9'));var client=jayson[_0x3448('0xa')][_0x3448('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bb7e5,_0x2caa81,_0x3cc81d){return new BPromise(function(_0x34b926,_0x5923ee){return client['request'](_0x1bb7e5,_0x3cc81d)[_0x3448('0xc')](function(_0x25c152){logger[_0x3448('0xd')](_0x3448('0xe'),_0x2caa81,_0x3448('0xf'));logger[_0x3448('0x10')](_0x3448('0x11'),_0x2caa81,_0x3448('0xf'),JSON[_0x3448('0x12')](_0x25c152));if(_0x25c152[_0x3448('0x13')]){if(_0x25c152[_0x3448('0x13')]['code']===0x1f4){logger['error'](_0x3448('0xe'),_0x2caa81,_0x25c152[_0x3448('0x13')]['message']);return _0x5923ee(_0x25c152[_0x3448('0x13')][_0x3448('0x14')]);}logger[_0x3448('0x13')]('SalesforceField,\x20%s,\x20%s',_0x2caa81,_0x25c152[_0x3448('0x13')][_0x3448('0x14')]);return _0x34b926(_0x25c152['error'][_0x3448('0x14')]);}else{logger[_0x3448('0xd')](_0x3448('0xe'),_0x2caa81,'request\x20sent');_0x34b926(_0x25c152[_0x3448('0x15')][_0x3448('0x14')]);}})[_0x3448('0x16')](function(_0x30f8dd){logger[_0x3448('0x13')](_0x3448('0xe'),_0x2caa81,_0x30f8dd);_0x5923ee(_0x30f8dd);});});} \ No newline at end of file +var _0x70e0=['code','SalesforceField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xd3607a,_0x5e71d6){var _0x1e23c0=function(_0x37ee85){while(--_0x37ee85){_0xd3607a['push'](_0xd3607a['shift']());}};_0x1e23c0(++_0x5e71d6);}(_0x70e0,0x17b));var _0x070e=function(_0x2e1431,_0xb49b7c){_0x2e1431=_0x2e1431-0x0;var _0xebb8b7=_0x70e0[_0x2e1431];return _0xebb8b7;};'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')]('SalesforceField,\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')]('SalesforceField,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index b77485a..68dc2f6 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 _0x8a2a=['getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x59a549,_0x2fe2bb){var _0x12adbe=function(_0x2ccd1e){while(--_0x2ccd1e){_0x59a549['push'](_0x59a549['shift']());}};_0x12adbe(++_0x2fe2bb);}(_0x8a2a,0x11f));var _0xa8a2=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8a2a[_0x19950b];return _0x3c6b41;};'use strict';var multer=require('multer');var util=require(_0xa8a2('0x0'));var path=require(_0xa8a2('0x1'));var timeout=require(_0xa8a2('0x2'));var express=require(_0xa8a2('0x3'));var router=express[_0xa8a2('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa8a2('0x5'));var config=require(_0xa8a2('0x6'));var controller=require(_0xa8a2('0x7'));router[_0xa8a2('0x8')]('/',auth[_0xa8a2('0x9')](),controller[_0xa8a2('0xa')]);router[_0xa8a2('0x8')](_0xa8a2('0xb'),auth['isAuthenticated'](),controller[_0xa8a2('0xc')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0xa8a2('0xd')]);router[_0xa8a2('0x8')](_0xa8a2('0xe'),auth['isAuthenticated'](),controller[_0xa8a2('0xf')]);router[_0xa8a2('0x10')]('/',auth[_0xa8a2('0x9')](),controller[_0xa8a2('0x11')]);router[_0xa8a2('0x10')](_0xa8a2('0x12'),auth['isAuthenticated'](),controller[_0xa8a2('0x13')]);router[_0xa8a2('0x14')](_0xa8a2('0xb'),auth['isAuthenticated'](),controller[_0xa8a2('0x15')]);router[_0xa8a2('0x16')](_0xa8a2('0xb'),auth[_0xa8a2('0x9')](),controller[_0xa8a2('0x17')]);module[_0xa8a2('0x18')]=router; \ No newline at end of file +var _0x0bd5=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','getFields','post','/:id/configurations','addConfiguration','update','destroy','exports','multer','util','path'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0bd5,0x189));var _0x50bd=function(_0x36f688,_0x136a34){_0x36f688=_0x36f688-0x0;var _0x5483e4=_0x0bd5[_0x36f688];return _0x5483e4;};'use strict';var multer=require(_0x50bd('0x0'));var util=require(_0x50bd('0x1'));var path=require(_0x50bd('0x2'));var timeout=require(_0x50bd('0x3'));var express=require(_0x50bd('0x4'));var router=express[_0x50bd('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x50bd('0x6'));var config=require(_0x50bd('0x7'));var controller=require(_0x50bd('0x8'));router[_0x50bd('0x9')]('/',auth[_0x50bd('0xa')](),controller[_0x50bd('0xb')]);router[_0x50bd('0x9')](_0x50bd('0xc'),auth[_0x50bd('0xa')](),controller[_0x50bd('0xd')]);router[_0x50bd('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x50bd('0xe')]);router[_0x50bd('0x9')]('/:id/fields',auth[_0x50bd('0xa')](),controller[_0x50bd('0xf')]);router['post']('/',auth[_0x50bd('0xa')](),controller['create']);router[_0x50bd('0x10')](_0x50bd('0x11'),auth[_0x50bd('0xa')](),controller[_0x50bd('0x12')]);router['put'](_0x50bd('0xc'),auth[_0x50bd('0xa')](),controller[_0x50bd('0x13')]);router['delete'](_0x50bd('0xc'),auth['isAuthenticated'](),controller[_0x50bd('0x14')]);module[_0x50bd('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index c8db9be..81b65ca 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 _0xb0f0=['exports','STRING','username','sequelize'];(function(_0x436854,_0x156c23){var _0x48cdaa=function(_0x37e80f){while(--_0x37e80f){_0x436854['push'](_0x436854['shift']());}};_0x48cdaa(++_0x156c23);}(_0xb0f0,0xbf));var _0x0b0f=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xb0f0[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0x0b0f('0x0'));module[_0x0b0f('0x1')]={'name':{'type':Sequelize[_0x0b0f('0x2')]},'description':{'type':Sequelize[_0x0b0f('0x2')]},'username':{'type':Sequelize[_0x0b0f('0x2')],'unique':_0x0b0f('0x3')},'password':{'type':Sequelize[_0x0b0f('0x2')]},'email':{'type':Sequelize[_0x0b0f('0x2')]},'remoteUri':{'type':Sequelize[_0x0b0f('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x0b0f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xf5ae=['exports','STRING','remoteUri','sequelize'];(function(_0x4c02a1,_0x4b816e){var _0xdaec12=function(_0x553bb6){while(--_0x553bb6){_0x4c02a1['push'](_0x4c02a1['shift']());}};_0xdaec12(++_0x4b816e);}(_0xf5ae,0xb3));var _0xef5a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf5ae[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xef5a('0x0'));module[_0xef5a('0x1')]={'name':{'type':Sequelize[_0xef5a('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xef5a('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xef5a('0x2')]},'email':{'type':Sequelize[_0xef5a('0x2')]},'remoteUri':{'type':Sequelize[_0xef5a('0x2')],'unique':_0xef5a('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 661402f..c10edb2 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 _0xa7d8=['sys_domain_path','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','calendar_duration','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','username','password','email','remoteUri','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','forEach','internalType','label','push','all','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','test','statusCode','send','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','request','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','apply','reject','save','destroy','end','name','index','map','ServicenowAccount','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','show','params','keys','rawAttributes','fields','find','create','body','update','ServicenowConfiguration','pick','getConfigurations','nolimit','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','knowledge','subcategory','notify','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','hold_reason','approval_history','number','resolved_by','opened_by','sys_created_on','sys_domain','calendar_stc','closed_at','impact','active','work_notes_list','business_service','priority'];(function(_0x49972d,_0x73b509){var _0x4d1b26=function(_0x45e1c3){while(--_0x45e1c3){_0x49972d['push'](_0x49972d['shift']());}};_0x4d1b26(++_0x73b509);}(_0xa7d8,0x1cb));var _0x8a7d=function(_0x57c666,_0x1e05d9){_0x57c666=_0x57c666-0x0;var _0x23ab11=_0xa7d8[_0x57c666];return _0x23ab11;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8a7d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8a7d('0x1'));var rp=require(_0x8a7d('0x2'));var moment=require('moment');var BPromise=require(_0x8a7d('0x3'));var Mustache=require(_0x8a7d('0x4'));var util=require('util');var path=require('path');var sox=require(_0x8a7d('0x5'));var csv=require(_0x8a7d('0x6'));var ejs=require(_0x8a7d('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8a7d('0x8'));var crypto=require(_0x8a7d('0x9'));var jsforce=require(_0x8a7d('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8a7d('0x6'));var querystring=require(_0x8a7d('0xb'));var Papa=require('papaparse');var Redis=require(_0x8a7d('0xc'));var authService=require(_0x8a7d('0xd'));var qs=require(_0x8a7d('0xe'));var as=require(_0x8a7d('0xf'));var hardwareService=require(_0x8a7d('0x10'));var logger=require('../../config/logger')(_0x8a7d('0x11'));var utils=require(_0x8a7d('0x12'));var config=require(_0x8a7d('0x13'));var licenseUtil=require(_0x8a7d('0x14'));var db=require(_0x8a7d('0x15'))['db'];var integrations=require(_0x8a7d('0x16'));var jayson=require(_0x8a7d('0x17'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3282b8,_0x50a7aa,_0x2f8baa,_0x584c6f){return new BPromise(function(_0x3abb7e,_0x34ed91){var _0x3278b4=_0x584c6f||client;return _0x3278b4[_0x8a7d('0x18')](_0x3282b8,_0x2f8baa)[_0x8a7d('0x19')](function(_0x6391bb){logger[_0x8a7d('0x1a')](_0x8a7d('0x1b'),_0x50a7aa,'request\x20sent');logger[_0x8a7d('0x1c')](_0x8a7d('0x1d'),_0x50a7aa,_0x8a7d('0x1e'),JSON[_0x8a7d('0x1f')](_0x6391bb));if(_0x6391bb[_0x8a7d('0x20')]){if(_0x6391bb[_0x8a7d('0x20')][_0x8a7d('0x21')]===0x1f4){logger[_0x8a7d('0x20')](_0x8a7d('0x1b'),_0x50a7aa,_0x6391bb[_0x8a7d('0x20')][_0x8a7d('0x22')]);return _0x34ed91(_0x6391bb[_0x8a7d('0x20')][_0x8a7d('0x22')]);}logger[_0x8a7d('0x20')]('ServicenowAccount,\x20%s,\x20%s',_0x50a7aa,_0x6391bb[_0x8a7d('0x20')][_0x8a7d('0x22')]);return _0x3abb7e(_0x6391bb['error'][_0x8a7d('0x22')]);}else{logger[_0x8a7d('0x1a')](_0x8a7d('0x1b'),_0x50a7aa,'request\x20sent');_0x3abb7e(_0x6391bb[_0x8a7d('0x23')][_0x8a7d('0x22')]);}})[_0x8a7d('0x24')](function(_0x20b737){logger[_0x8a7d('0x20')](_0x8a7d('0x1b'),_0x50a7aa,_0x20b737);_0x34ed91(_0x20b737);});});}function respondWithStatusCode(_0x194d57,_0x4c2cbc){_0x4c2cbc=_0x4c2cbc||0xcc;return function(_0xf69b82){if(_0xf69b82){return _0x194d57[_0x8a7d('0x25')](_0x4c2cbc);}return _0x194d57[_0x8a7d('0x26')](_0x4c2cbc)['end']();};}function respondWithResult(_0x5ed16a,_0x334a41){_0x334a41=_0x334a41||0xc8;return function(_0x35c79a){if(_0x35c79a){return _0x5ed16a[_0x8a7d('0x26')](_0x334a41)[_0x8a7d('0x27')](_0x35c79a);}};}function respondWithFilteredResult(_0x588892,_0x1b7f5e){return function(_0x153e62){if(_0x153e62){var _0x16ff4c=_0x153e62[_0x8a7d('0x28')],_0x1f700d=_0x1b7f5e[_0x8a7d('0x29')],_0x49b384=_0x1b7f5e[_0x8a7d('0x29')]+_0x1b7f5e[_0x8a7d('0x2a')],_0x5ad183;if(_0x49b384>=_0x16ff4c){_0x49b384=_0x16ff4c;_0x5ad183=0xc8;}else{_0x5ad183=0xce;}_0x588892[_0x8a7d('0x26')](_0x5ad183);return _0x588892['set']('Content-Range',_0x1f700d+'-'+_0x49b384+'/'+_0x16ff4c)[_0x8a7d('0x27')](_0x153e62);}return null;};}function patchUpdates(_0xc7fbb5){return function(_0x2cc6e6){try{jsonpatch[_0x8a7d('0x2b')](_0x2cc6e6,_0xc7fbb5,!![]);}catch(_0x522d16){return BPromise[_0x8a7d('0x2c')](_0x522d16);}return _0x2cc6e6[_0x8a7d('0x2d')]();};}function saveUpdates(_0x386002,_0x4791f6){return function(_0x32f606){if(_0x32f606){return _0x32f606['update'](_0x386002)[_0x8a7d('0x19')](function(_0x2fa6c5){return _0x2fa6c5;});}return null;};}function removeEntity(_0x1a7b75,_0x278f2a){return function(_0x5cfb0d){if(_0x5cfb0d){return _0x5cfb0d[_0x8a7d('0x2e')]()['then'](function(){_0x1a7b75[_0x8a7d('0x26')](0xcc)[_0x8a7d('0x2f')]();});}};}function handleEntityNotFound(_0x4038b1,_0x3671ff){return function(_0x34d0e8){if(!_0x34d0e8){_0x4038b1[_0x8a7d('0x25')](0x194);}return _0x34d0e8;};}function handleError(_0x57a563,_0x4b15d8){_0x4b15d8=_0x4b15d8||0x1f4;return function(_0x5b2b3d){logger[_0x8a7d('0x20')](_0x5b2b3d['stack']);if(_0x5b2b3d[_0x8a7d('0x30')]){delete _0x5b2b3d[_0x8a7d('0x30')];}_0x57a563[_0x8a7d('0x26')](_0x4b15d8)['send'](_0x5b2b3d);};}exports[_0x8a7d('0x31')]=function(_0xfa6aaf,_0x15e61e){var _0xb14358={},_0xe9f8fa={},_0x2bd47f={'count':0x0,'rows':[]};var _0x2ff23c=_[_0x8a7d('0x32')](db[_0x8a7d('0x33')]['rawAttributes'],function(_0x46d3ba){return{'name':_0x46d3ba[_0x8a7d('0x34')],'type':_0x46d3ba[_0x8a7d('0x35')][_0x8a7d('0x36')]};});_0xe9f8fa[_0x8a7d('0x37')]=_['map'](_0x2ff23c,_0x8a7d('0x30'));_0xe9f8fa['query']=_['keys'](_0xfa6aaf[_0x8a7d('0x38')]);_0xe9f8fa[_0x8a7d('0x39')]=_[_0x8a7d('0x3a')](_0xe9f8fa['model'],_0xe9f8fa['query']);_0xb14358[_0x8a7d('0x3b')]=_[_0x8a7d('0x3a')](_0xe9f8fa[_0x8a7d('0x37')],qs['fields'](_0xfa6aaf[_0x8a7d('0x38')]['fields']));_0xb14358['attributes']=_0xb14358['attributes'][_0x8a7d('0x3c')]?_0xb14358[_0x8a7d('0x3b')]:_0xe9f8fa[_0x8a7d('0x37')];if(!_0xfa6aaf['query'][_0x8a7d('0x3d')]('nolimit')){_0xb14358[_0x8a7d('0x2a')]=qs[_0x8a7d('0x2a')](_0xfa6aaf[_0x8a7d('0x38')]['limit']);_0xb14358[_0x8a7d('0x29')]=qs[_0x8a7d('0x29')](_0xfa6aaf[_0x8a7d('0x38')][_0x8a7d('0x29')]);}_0xb14358[_0x8a7d('0x3e')]=qs[_0x8a7d('0x3f')](_0xfa6aaf[_0x8a7d('0x38')][_0x8a7d('0x3f')]);_0xb14358[_0x8a7d('0x40')]=qs[_0x8a7d('0x39')](_['pick'](_0xfa6aaf[_0x8a7d('0x38')],_0xe9f8fa['filters']),_0x2ff23c);if(_0xfa6aaf[_0x8a7d('0x38')][_0x8a7d('0x41')]){_0xb14358[_0x8a7d('0x40')]=_[_0x8a7d('0x42')](_0xb14358['where'],{'$or':_[_0x8a7d('0x32')](_0x2ff23c,function(_0x485056){if(_0x485056[_0x8a7d('0x35')]!==_0x8a7d('0x43')){var _0x27e727={};_0x27e727[_0x485056[_0x8a7d('0x30')]]={'$like':'%'+_0xfa6aaf[_0x8a7d('0x38')]['filter']+'%'};return _0x27e727;}})});}_0xb14358=_[_0x8a7d('0x42')]({},_0xb14358,_0xfa6aaf[_0x8a7d('0x44')]);var _0x4989e2={'where':_0xb14358[_0x8a7d('0x40')]};return db['ServicenowAccount'][_0x8a7d('0x28')](_0x4989e2)[_0x8a7d('0x19')](function(_0x31e11f){_0x2bd47f[_0x8a7d('0x28')]=_0x31e11f;if(_0xfa6aaf[_0x8a7d('0x38')][_0x8a7d('0x45')]){_0xb14358[_0x8a7d('0x46')]=[{'all':!![]}];}return db[_0x8a7d('0x33')]['findAll'](_0xb14358);})[_0x8a7d('0x19')](function(_0x47ac31){_0x2bd47f['rows']=_0x47ac31;return _0x2bd47f;})['then'](respondWithFilteredResult(_0x15e61e,_0xb14358))['catch'](handleError(_0x15e61e,null));};exports[_0x8a7d('0x47')]=function(_0x1b86b3,_0x1c58fd){var _0x4cb573={'raw':![],'where':{'id':_0x1b86b3[_0x8a7d('0x48')]['id']}},_0x25718e={};_0x25718e[_0x8a7d('0x37')]=_[_0x8a7d('0x49')](db[_0x8a7d('0x33')][_0x8a7d('0x4a')]);_0x25718e[_0x8a7d('0x38')]=_[_0x8a7d('0x49')](_0x1b86b3[_0x8a7d('0x38')]);_0x25718e[_0x8a7d('0x39')]=_['intersection'](_0x25718e['model'],_0x25718e['query']);_0x4cb573[_0x8a7d('0x3b')]=_[_0x8a7d('0x3a')](_0x25718e['model'],qs[_0x8a7d('0x4b')](_0x1b86b3[_0x8a7d('0x38')][_0x8a7d('0x4b')]));_0x4cb573[_0x8a7d('0x3b')]=_0x4cb573['attributes']['length']?_0x4cb573[_0x8a7d('0x3b')]:_0x25718e[_0x8a7d('0x37')];if(_0x1b86b3[_0x8a7d('0x38')][_0x8a7d('0x45')]){_0x4cb573[_0x8a7d('0x46')]=[{'all':!![]}];}_0x4cb573=_[_0x8a7d('0x42')]({},_0x4cb573,_0x1b86b3[_0x8a7d('0x44')]);return db[_0x8a7d('0x33')][_0x8a7d('0x4c')](_0x4cb573)[_0x8a7d('0x19')](handleEntityNotFound(_0x1c58fd,null))[_0x8a7d('0x19')](respondWithResult(_0x1c58fd,null))[_0x8a7d('0x24')](handleError(_0x1c58fd,null));};exports[_0x8a7d('0x4d')]=function(_0x593ec1,_0x375750){return db[_0x8a7d('0x33')][_0x8a7d('0x4d')](_0x593ec1[_0x8a7d('0x4e')],{})['then'](respondWithResult(_0x375750,0xc9))[_0x8a7d('0x24')](handleError(_0x375750,null));};exports[_0x8a7d('0x4f')]=function(_0x3e476c,_0x325c0c){if(_0x3e476c[_0x8a7d('0x4e')]['id']){delete _0x3e476c[_0x8a7d('0x4e')]['id'];}return db[_0x8a7d('0x33')][_0x8a7d('0x4c')]({'where':{'id':_0x3e476c[_0x8a7d('0x48')]['id']}})[_0x8a7d('0x19')](handleEntityNotFound(_0x325c0c,null))[_0x8a7d('0x19')](saveUpdates(_0x3e476c[_0x8a7d('0x4e')],null))['then'](respondWithResult(_0x325c0c,null))[_0x8a7d('0x24')](handleError(_0x325c0c,null));};exports[_0x8a7d('0x2e')]=function(_0x5d9a67,_0x533129){return db[_0x8a7d('0x33')][_0x8a7d('0x4c')]({'where':{'id':_0x5d9a67[_0x8a7d('0x48')]['id']}})['then'](handleEntityNotFound(_0x533129,null))['then'](removeEntity(_0x533129,null))['catch'](handleError(_0x533129,null));};exports['getConfigurations']=function(_0x23e83f,_0xbe1793,_0x1a7fbf){var _0x78c081={};var _0x3349e6={};var _0x400ee4;var _0x5f4182;return db['ServicenowAccount']['findOne']({'where':{'id':_0x23e83f['params']['id']}})[_0x8a7d('0x19')](handleEntityNotFound(_0xbe1793,null))[_0x8a7d('0x19')](function(_0x3c142e){if(_0x3c142e){_0x400ee4=_0x3c142e;_0x3349e6[_0x8a7d('0x37')]=_[_0x8a7d('0x49')](db[_0x8a7d('0x50')][_0x8a7d('0x4a')]);_0x3349e6[_0x8a7d('0x38')]=_[_0x8a7d('0x49')](_0x23e83f['query']);_0x3349e6[_0x8a7d('0x39')]=_[_0x8a7d('0x3a')](_0x3349e6[_0x8a7d('0x37')],_0x3349e6['query']);_0x78c081[_0x8a7d('0x3b')]=_[_0x8a7d('0x3a')](_0x3349e6['model'],qs[_0x8a7d('0x4b')](_0x23e83f['query'][_0x8a7d('0x4b')]));_0x78c081[_0x8a7d('0x3b')]=_0x78c081['attributes'][_0x8a7d('0x3c')]?_0x78c081[_0x8a7d('0x3b')]:_0x3349e6[_0x8a7d('0x37')];_0x78c081[_0x8a7d('0x3e')]=qs[_0x8a7d('0x3f')](_0x23e83f[_0x8a7d('0x38')][_0x8a7d('0x3f')]);_0x78c081[_0x8a7d('0x40')]=qs['filters'](_[_0x8a7d('0x51')](_0x23e83f[_0x8a7d('0x38')],_0x3349e6['filters']));if(_0x23e83f[_0x8a7d('0x38')][_0x8a7d('0x41')]){_0x78c081['where']=_['merge'](_0x78c081[_0x8a7d('0x40')],{'$or':_[_0x8a7d('0x32')](_0x78c081[_0x8a7d('0x3b')],function(_0x50b672){var _0x3a4164={};_0x3a4164[_0x50b672]={'$like':'%'+_0x23e83f['query'][_0x8a7d('0x41')]+'%'};return _0x3a4164;})});}_0x78c081=_[_0x8a7d('0x42')]({},_0x78c081,_0x23e83f[_0x8a7d('0x44')]);return _0x400ee4[_0x8a7d('0x52')](_0x78c081);}})['then'](function(_0x5ce7cb){if(_0x5ce7cb){_0x5f4182=_0x5ce7cb['length'];if(!_0x23e83f[_0x8a7d('0x38')][_0x8a7d('0x3d')](_0x8a7d('0x53'))){_0x78c081[_0x8a7d('0x2a')]=qs[_0x8a7d('0x2a')](_0x23e83f[_0x8a7d('0x38')][_0x8a7d('0x2a')]);_0x78c081[_0x8a7d('0x29')]=qs[_0x8a7d('0x29')](_0x23e83f[_0x8a7d('0x38')]['offset']);}return _0x400ee4[_0x8a7d('0x52')](_0x78c081);}})['then'](function(_0x1ef93e){if(_0x1ef93e){return _0x1ef93e?{'count':_0x5f4182,'rows':_0x1ef93e}:null;}})[_0x8a7d('0x19')](respondWithResult(_0xbe1793,null))[_0x8a7d('0x24')](handleError(_0xbe1793,null));};exports[_0x8a7d('0x54')]=function(_0x49a6f4,_0x2e902a,_0x92ef73){if(_0x49a6f4[_0x8a7d('0x4e')]['id']){delete _0x49a6f4[_0x8a7d('0x4e')]['id'];}return db[_0x8a7d('0x33')][_0x8a7d('0x55')]({'where':{'id':_0x49a6f4[_0x8a7d('0x48')]['id']}})[_0x8a7d('0x19')](handleEntityNotFound(_0x2e902a,null))['then'](function(_0x220641){if(_0x220641){_0x49a6f4[_0x8a7d('0x4e')]['AccountId']=_0x220641['id'];_0x49a6f4[_0x8a7d('0x4e')][_0x8a7d('0x56')]=integrations[_0x8a7d('0x57')](_0x49a6f4[_0x8a7d('0x4e')][_0x8a7d('0x58')],_0x49a6f4[_0x8a7d('0x4e')]['type']);_0x49a6f4['body'][_0x8a7d('0x59')]=integrations[_0x8a7d('0x5a')](_0x49a6f4[_0x8a7d('0x4e')][_0x8a7d('0x58')],_0x49a6f4[_0x8a7d('0x4e')][_0x8a7d('0x35')]);return db[_0x8a7d('0x50')][_0x8a7d('0x4d')](_0x49a6f4['body'],{'include':[{'model':db[_0x8a7d('0x5b')],'as':'Subjects'},{'model':db[_0x8a7d('0x5b')],'as':'Descriptions'}]});}return null;})[_0x8a7d('0x19')](respondWithResult(_0x2e902a,null))['catch'](handleError(_0x2e902a,null));};exports[_0x8a7d('0x5c')]=function(_0x3390b2,_0x366abe,_0x225e6e){var _0x40e624=[_0x8a7d('0x5d'),'hold_reason',_0x8a7d('0x5e'),_0x8a7d('0x5f'),'close_code',_0x8a7d('0x60'),'incident_state',_0x8a7d('0x61'),'category'];var _0x445a64=[_0x8a7d('0x62'),_0x8a7d('0x5d'),_0x8a7d('0x63'),_0x8a7d('0x64'),_0x8a7d('0x65'),_0x8a7d('0x66'),'child_incidents',_0x8a7d('0x67'),_0x8a7d('0x68'),_0x8a7d('0x69'),_0x8a7d('0x6a'),'sys_updated_by',_0x8a7d('0x6b'),'user_input',_0x8a7d('0x6c'),_0x8a7d('0x6d'),'state','sys_created_by',_0x8a7d('0x5e'),_0x8a7d('0x3e'),_0x8a7d('0x6e'),_0x8a7d('0x6f'),'cmdb_ci','delivery_plan',_0x8a7d('0x70'),_0x8a7d('0x71'),_0x8a7d('0x72'),_0x8a7d('0x73'),_0x8a7d('0x74'),_0x8a7d('0x75'),'rfc',_0x8a7d('0x76'),'expected_start',_0x8a7d('0x77'),_0x8a7d('0x78'),_0x8a7d('0x79'),_0x8a7d('0x7a'),_0x8a7d('0x7b'),'resolved_at','caller_id',_0x8a7d('0x7c'),_0x8a7d('0x5f'),_0x8a7d('0x7d'),_0x8a7d('0x7e'),'close_code',_0x8a7d('0x7f'),_0x8a7d('0x80'),_0x8a7d('0x81'),_0x8a7d('0x82'),'business_stc',_0x8a7d('0x83'),_0x8a7d('0x84'),_0x8a7d('0x85'),_0x8a7d('0x60'),_0x8a7d('0x86'),'close_notes',_0x8a7d('0x87'),_0x8a7d('0x88'),_0x8a7d('0x89'),_0x8a7d('0x8a'),_0x8a7d('0x8b'),_0x8a7d('0x8c'),_0x8a7d('0x8d'),_0x8a7d('0x8e'),_0x8a7d('0x8f'),_0x8a7d('0x90'),_0x8a7d('0x91'),_0x8a7d('0x92'),_0x8a7d('0x93'),_0x8a7d('0x61'),_0x8a7d('0x94'),_0x8a7d('0x95'),_0x8a7d('0x96'),_0x8a7d('0x97'),_0x8a7d('0x98'),_0x8a7d('0x99'),_0x8a7d('0x9a'),_0x8a7d('0x9b'),_0x8a7d('0x9c'),'upon_approval',_0x8a7d('0x9d'),'location','category'];var _0x56e66b='';var _0x3cb01b='';var _0x467ce5=[];var _0x1facd1='';var _0x1a6abf='';var _0x42b8f6=[];var _0x36091c='';var _0x455788='';var _0x2cb17f={};var _0x5a61be='';return db[_0x8a7d('0x33')][_0x8a7d('0x55')]({'where':{'id':_0x3390b2[_0x8a7d('0x48')]['id']},'attributes':['id',_0x8a7d('0x9e'),_0x8a7d('0x9f'),_0x8a7d('0xa0'),_0x8a7d('0xa1'),'serverUrl']})[_0x8a7d('0x19')](handleEntityNotFound(_0x366abe,null))[_0x8a7d('0x19')](function(_0x3252a6){if(_0x3252a6){_0x5a61be=_0x3252a6['remoteUri'];var _0x205a4f=_0x5a61be[_0x8a7d('0xa2')](-0x1);if(_0x205a4f==='/'){_0x5a61be=_0x5a61be[_0x8a7d('0xa3')](0x0,_0x5a61be['lastIndexOf'](_0x205a4f));}_0x455788=util[_0x8a7d('0xa4')](_0x8a7d('0xa5'),_0x5a61be);_0x36091c=util[_0x8a7d('0xa4')](_0x8a7d('0xa6'),_0x5a61be);_0x2cb17f={'user':_0x3252a6[_0x8a7d('0x9e')],'pass':_0x3252a6[_0x8a7d('0x9f')]};var _0x220780={'method':_0x8a7d('0xa7'),'uri':_0x455788+_0x8a7d('0xa8'),'auth':_0x2cb17f,'json':!![]};return rp(_0x220780);}})['then'](function(_0x25cb4e){if(_0x25cb4e[_0x8a7d('0x23')][_0x8a7d('0x3c')]>0x0){_0x56e66b=_0x25cb4e[_0x8a7d('0x23')];}console[_0x8a7d('0xa9')](_0x8a7d('0xaa'),_0x56e66b);_0x42b8f6=[];_0x3cb01b=Object[_0x8a7d('0xab')]([],_0x56e66b);_[_0x8a7d('0xac')](_0x3cb01b,function(_0x1fcd98){return!_0x40e624['includes'](_0x1fcd98[_0x8a7d('0x30')]);});_0x3cb01b[_0x8a7d('0xad')](function(_0x41238c){var _0x4a4846=createFieldObject(_0x36091c,_0x2cb17f,_0x41238c[_0x8a7d('0xae')],_0x41238c[_0x8a7d('0x30')],_0x41238c[_0x8a7d('0xaf')],![]);_0x42b8f6[_0x8a7d('0xb0')](_0x4a4846);});return Promise[_0x8a7d('0xb1')](_0x42b8f6);})['then'](function(_0x477c33){_0x467ce5=_0x477c33;_0x1facd1=Object[_0x8a7d('0xab')]([],_0x56e66b);console[_0x8a7d('0xa9')](_0x8a7d('0xb2'),_0x56e66b);_[_0x8a7d('0xac')](_0x1facd1,function(_0x2dc939){return _0x445a64[_0x8a7d('0xb3')](_0x2dc939[_0x8a7d('0x30')]);});console[_0x8a7d('0xa9')](_0x8a7d('0xb4'),_0x1facd1);_0x42b8f6=[];_0x1facd1[_0x8a7d('0xad')](function(_0x508833){var _0x46792e=createFieldObject(_0x36091c,_0x2cb17f,_0x508833['internalType'],_0x508833[_0x8a7d('0x30')],_0x508833[_0x8a7d('0xaf')],!![]);_0x42b8f6[_0x8a7d('0xb0')](_0x46792e);});return Promise['all'](_0x42b8f6);})[_0x8a7d('0x19')](function(_0x365865){_0x1a6abf=_0x365865;var _0x435df3=_0x467ce5[_0x8a7d('0xb5')](_0x1a6abf);return{'count':_0x435df3[_0x8a7d('0x3c')],'rows':_0x435df3};})[_0x8a7d('0x19')](respondWithResult(_0x366abe,null))[_0x8a7d('0x24')](function(_0x502a73){console[_0x8a7d('0xa9')]('ServiceNow\x20error:\x20'+_0x502a73);var _0x88e002=_0x3390b2['query'][_0x8a7d('0xb6')]?0x1f4:_0x502a73[_0x8a7d('0xb7')]||0x1f4;logger[_0x8a7d('0x20')](_0x502a73['stack']);delete _0x502a73[_0x8a7d('0x30')];if(_0x88e002===0x191){_0x88e002=0x190;}_0x366abe[_0x8a7d('0x26')](_0x88e002)[_0x8a7d('0xb8')](_0x3390b2[_0x8a7d('0x38')][_0x8a7d('0xb6')]?{'message':'Wrong\x20credentials','statusCode':_0x502a73[_0x8a7d('0xb7')]}:_0x502a73);});};function createFieldObject(_0x5b5920,_0x3c3af5,_0x18848a,_0x3a7189,_0x44bd5b,_0x5d902a){return new Promise(function(_0x1e269c,_0x1254ec){var _0xdd69d0={'id':_0x3a7189,'name':_0x44bd5b,'custom':_0x5d902a};if(_0x18848a===_0x8a7d('0xb9')){_0xdd69d0[_0x8a7d('0x44')]=[{'name':_0x8a7d('0xba'),'value':'true'},{'name':_0x8a7d('0xbb'),'value':_0x8a7d('0xbc')}];_0x1e269c(_0xdd69d0);}else{var _0x405ceb={'method':_0x8a7d('0xa7'),'uri':_0x5b5920+_0x8a7d('0xbd')+_0x3a7189,'auth':_0x3c3af5,'json':!![]};return rp(_0x405ceb)['then'](function(_0x24c79b){var _0xcb2e4b=[];if(_0x24c79b['result'][_0x8a7d('0x3c')]>0x0){_0x24c79b[_0x8a7d('0x23')]['forEach'](function(_0x4ec9e4){if(_0x4ec9e4[_0x8a7d('0xbe')]===_0x8a7d('0xbc')){var _0x4b29bd={'name':_0x4ec9e4[_0x8a7d('0xaf')],'value':_0x4ec9e4[_0x8a7d('0xbf')]};_0xcb2e4b[_0x8a7d('0xb0')](_0x4b29bd);}});}_0xdd69d0[_0x8a7d('0x44')]=_0xcb2e4b;if(_0xdd69d0[_0x8a7d('0x44')][_0x8a7d('0x3c')]>0x0){_0x1e269c(_0xdd69d0);}else{if(_0x5d902a==![]){_0x1e269c();}else{_0x1e269c(_0xdd69d0);}}});}});} \ No newline at end of file +var _0xe790=['rows','show','params','rawAttributes','create','body','update','find','getConfigurations','findOne','ServicenowConfiguration','filters','nolimit','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','Subjects','getFields','made_sla','hold_reason','knowledge','subcategory','incident_state','severity','caused_by','upon_reject','sys_updated_on','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','calendar_stc','cmdb_ci','delivery_plan','impact','active','work_notes_list','sys_domain_path','time_worked','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','close_code','correlation_display','delivery_task','work_start','assignment_group','business_stc','description','notify','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','urgency','problem_id','company','activity_due','assigned_to','comments','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','upon_approval','correlation_id','category','username','password','email','remoteUri','serverUrl','slice','substring','%s/api/now/doc/table/schema/','format','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','all','TCL:\x20_object','push','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','True','true','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','then','info','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','ServicenowAccount,\x20%s,\x20%s','result','catch','end','status','count','offset','limit','Content-Range','json','destroy','sendStatus','stack','name','send','index','ServicenowAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll'];(function(_0x1935f0,_0x295e1c){var _0x1598c3=function(_0x343b05){while(--_0x343b05){_0x1935f0['push'](_0x1935f0['shift']());}};_0x1598c3(++_0x295e1c);}(_0xe790,0x77));var _0x0e79=function(_0x577d01,_0x1ec928){_0x577d01=_0x577d01-0x0;var _0x58fcc2=_0xe790[_0x577d01];return _0x58fcc2;};'use strict';var pdf=require(_0x0e79('0x0'));var emlformat=require(_0x0e79('0x1'));var rimraf=require(_0x0e79('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e79('0x3'));var rp=require(_0x0e79('0x4'));var moment=require(_0x0e79('0x5'));var BPromise=require(_0x0e79('0x6'));var Mustache=require('mustache');var util=require(_0x0e79('0x7'));var path=require(_0x0e79('0x8'));var sox=require(_0x0e79('0x9'));var csv=require(_0x0e79('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0e79('0xb'));var squel=require(_0x0e79('0xc'));var crypto=require(_0x0e79('0xd'));var jsforce=require(_0x0e79('0xe'));var deskjs=require(_0x0e79('0xf'));var toCsv=require(_0x0e79('0xa'));var querystring=require('querystring');var Papa=require(_0x0e79('0x10'));var Redis=require(_0x0e79('0x11'));var authService=require(_0x0e79('0x12'));var qs=require(_0x0e79('0x13'));var as=require(_0x0e79('0x14'));var hardwareService=require(_0x0e79('0x15'));var logger=require(_0x0e79('0x16'))(_0x0e79('0x17'));var utils=require(_0x0e79('0x18'));var config=require(_0x0e79('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x0e79('0x1a'))['db'];var integrations=require(_0x0e79('0x1b'));var jayson=require(_0x0e79('0x1c'));var client=jayson[_0x0e79('0x1d')][_0x0e79('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x58ba7b,_0x41fca3,_0x491463,_0x4bc087){return new BPromise(function(_0xc18fb,_0x25415b){var _0x59b8aa=_0x4bc087||client;return _0x59b8aa['request'](_0x58ba7b,_0x491463)[_0x0e79('0x1f')](function(_0x48a1d3){logger[_0x0e79('0x20')]('ServicenowAccount,\x20%s,\x20%s',_0x41fca3,_0x0e79('0x21'));logger['debug'](_0x0e79('0x22'),_0x41fca3,_0x0e79('0x21'),JSON['stringify'](_0x48a1d3));if(_0x48a1d3[_0x0e79('0x23')]){if(_0x48a1d3[_0x0e79('0x23')][_0x0e79('0x24')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x41fca3,_0x48a1d3[_0x0e79('0x23')][_0x0e79('0x25')]);return _0x25415b(_0x48a1d3[_0x0e79('0x23')][_0x0e79('0x25')]);}logger[_0x0e79('0x23')](_0x0e79('0x26'),_0x41fca3,_0x48a1d3[_0x0e79('0x23')][_0x0e79('0x25')]);return _0xc18fb(_0x48a1d3[_0x0e79('0x23')]['message']);}else{logger[_0x0e79('0x20')](_0x0e79('0x26'),_0x41fca3,_0x0e79('0x21'));_0xc18fb(_0x48a1d3[_0x0e79('0x27')]['message']);}})[_0x0e79('0x28')](function(_0x4bba3d){logger['error'](_0x0e79('0x26'),_0x41fca3,_0x4bba3d);_0x25415b(_0x4bba3d);});});}function respondWithStatusCode(_0xf801eb,_0x498029){_0x498029=_0x498029||0xcc;return function(_0x1458c7){if(_0x1458c7){return _0xf801eb['sendStatus'](_0x498029);}return _0xf801eb['status'](_0x498029)[_0x0e79('0x29')]();};}function respondWithResult(_0x99d68f,_0x510e25){_0x510e25=_0x510e25||0xc8;return function(_0x18ea6c){if(_0x18ea6c){return _0x99d68f[_0x0e79('0x2a')](_0x510e25)['json'](_0x18ea6c);}};}function respondWithFilteredResult(_0x1d324f,_0x50e846){return function(_0x1ad87c){if(_0x1ad87c){var _0x5ce71b=_0x1ad87c[_0x0e79('0x2b')],_0x3c64aa=_0x50e846[_0x0e79('0x2c')],_0x50ff58=_0x50e846['offset']+_0x50e846[_0x0e79('0x2d')],_0x3e7f90;if(_0x50ff58>=_0x5ce71b){_0x50ff58=_0x5ce71b;_0x3e7f90=0xc8;}else{_0x3e7f90=0xce;}_0x1d324f['status'](_0x3e7f90);return _0x1d324f['set'](_0x0e79('0x2e'),_0x3c64aa+'-'+_0x50ff58+'/'+_0x5ce71b)[_0x0e79('0x2f')](_0x1ad87c);}return null;};}function patchUpdates(_0x1b919a){return function(_0x351d09){try{jsonpatch['apply'](_0x351d09,_0x1b919a,!![]);}catch(_0x154a97){return BPromise['reject'](_0x154a97);}return _0x351d09['save']();};}function saveUpdates(_0x20de80,_0x3052a6){return function(_0x2314bf){if(_0x2314bf){return _0x2314bf['update'](_0x20de80)[_0x0e79('0x1f')](function(_0x55e005){return _0x55e005;});}return null;};}function removeEntity(_0x18b4ec,_0x472cdd){return function(_0x2a274b){if(_0x2a274b){return _0x2a274b[_0x0e79('0x30')]()['then'](function(){_0x18b4ec[_0x0e79('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c2376,_0x24f1a8){return function(_0x10b246){if(!_0x10b246){_0x3c2376[_0x0e79('0x31')](0x194);}return _0x10b246;};}function handleError(_0x3c942d,_0x3f41d8){_0x3f41d8=_0x3f41d8||0x1f4;return function(_0x14b7c3){logger[_0x0e79('0x23')](_0x14b7c3[_0x0e79('0x32')]);if(_0x14b7c3[_0x0e79('0x33')]){delete _0x14b7c3[_0x0e79('0x33')];}_0x3c942d[_0x0e79('0x2a')](_0x3f41d8)[_0x0e79('0x34')](_0x14b7c3);};}exports[_0x0e79('0x35')]=function(_0x3d07ea,_0xe4f289){var _0x46a84b={},_0x59d2c8={},_0x3b8467={'count':0x0,'rows':[]};var _0x5a3fdc=_['map'](db[_0x0e79('0x36')]['rawAttributes'],function(_0x44bbc6){return{'name':_0x44bbc6[_0x0e79('0x37')],'type':_0x44bbc6[_0x0e79('0x38')][_0x0e79('0x39')]};});_0x59d2c8[_0x0e79('0x3a')]=_['map'](_0x5a3fdc,'name');_0x59d2c8[_0x0e79('0x3b')]=_[_0x0e79('0x3c')](_0x3d07ea[_0x0e79('0x3b')]);_0x59d2c8['filters']=_[_0x0e79('0x3d')](_0x59d2c8['model'],_0x59d2c8['query']);_0x46a84b[_0x0e79('0x3e')]=_['intersection'](_0x59d2c8[_0x0e79('0x3a')],qs[_0x0e79('0x3f')](_0x3d07ea[_0x0e79('0x3b')]['fields']));_0x46a84b['attributes']=_0x46a84b[_0x0e79('0x3e')][_0x0e79('0x40')]?_0x46a84b[_0x0e79('0x3e')]:_0x59d2c8[_0x0e79('0x3a')];if(!_0x3d07ea['query'][_0x0e79('0x41')]('nolimit')){_0x46a84b[_0x0e79('0x2d')]=qs[_0x0e79('0x2d')](_0x3d07ea[_0x0e79('0x3b')][_0x0e79('0x2d')]);_0x46a84b[_0x0e79('0x2c')]=qs[_0x0e79('0x2c')](_0x3d07ea[_0x0e79('0x3b')][_0x0e79('0x2c')]);}_0x46a84b[_0x0e79('0x42')]=qs['sort'](_0x3d07ea[_0x0e79('0x3b')][_0x0e79('0x43')]);_0x46a84b[_0x0e79('0x44')]=qs['filters'](_[_0x0e79('0x45')](_0x3d07ea['query'],_0x59d2c8['filters']),_0x5a3fdc);if(_0x3d07ea[_0x0e79('0x3b')][_0x0e79('0x46')]){_0x46a84b[_0x0e79('0x44')]=_[_0x0e79('0x47')](_0x46a84b[_0x0e79('0x44')],{'$or':_[_0x0e79('0x48')](_0x5a3fdc,function(_0x19926e){if(_0x19926e['type']!=='VIRTUAL'){var _0x35fbc9={};_0x35fbc9[_0x19926e[_0x0e79('0x33')]]={'$like':'%'+_0x3d07ea[_0x0e79('0x3b')][_0x0e79('0x46')]+'%'};return _0x35fbc9;}})});}_0x46a84b=_[_0x0e79('0x47')]({},_0x46a84b,_0x3d07ea[_0x0e79('0x49')]);var _0x875ca8={'where':_0x46a84b[_0x0e79('0x44')]};return db['ServicenowAccount']['count'](_0x875ca8)['then'](function(_0x4ccda9){_0x3b8467[_0x0e79('0x2b')]=_0x4ccda9;if(_0x3d07ea[_0x0e79('0x3b')][_0x0e79('0x4a')]){_0x46a84b[_0x0e79('0x4b')]=[{'all':!![]}];}return db[_0x0e79('0x36')][_0x0e79('0x4c')](_0x46a84b);})[_0x0e79('0x1f')](function(_0x361738){_0x3b8467[_0x0e79('0x4d')]=_0x361738;return _0x3b8467;})[_0x0e79('0x1f')](respondWithFilteredResult(_0xe4f289,_0x46a84b))[_0x0e79('0x28')](handleError(_0xe4f289,null));};exports[_0x0e79('0x4e')]=function(_0x15fdac,_0x11a451){var _0x4dce5b={'raw':![],'where':{'id':_0x15fdac[_0x0e79('0x4f')]['id']}},_0x38c68c={};_0x38c68c[_0x0e79('0x3a')]=_[_0x0e79('0x3c')](db[_0x0e79('0x36')][_0x0e79('0x50')]);_0x38c68c[_0x0e79('0x3b')]=_[_0x0e79('0x3c')](_0x15fdac['query']);_0x38c68c['filters']=_[_0x0e79('0x3d')](_0x38c68c['model'],_0x38c68c['query']);_0x4dce5b[_0x0e79('0x3e')]=_[_0x0e79('0x3d')](_0x38c68c[_0x0e79('0x3a')],qs['fields'](_0x15fdac['query'][_0x0e79('0x3f')]));_0x4dce5b['attributes']=_0x4dce5b['attributes'][_0x0e79('0x40')]?_0x4dce5b[_0x0e79('0x3e')]:_0x38c68c[_0x0e79('0x3a')];if(_0x15fdac[_0x0e79('0x3b')][_0x0e79('0x4a')]){_0x4dce5b[_0x0e79('0x4b')]=[{'all':!![]}];}_0x4dce5b=_['merge']({},_0x4dce5b,_0x15fdac[_0x0e79('0x49')]);return db[_0x0e79('0x36')]['find'](_0x4dce5b)[_0x0e79('0x1f')](handleEntityNotFound(_0x11a451,null))[_0x0e79('0x1f')](respondWithResult(_0x11a451,null))[_0x0e79('0x28')](handleError(_0x11a451,null));};exports[_0x0e79('0x51')]=function(_0x2bd433,_0x48dd69){return db[_0x0e79('0x36')][_0x0e79('0x51')](_0x2bd433[_0x0e79('0x52')],{})[_0x0e79('0x1f')](respondWithResult(_0x48dd69,0xc9))[_0x0e79('0x28')](handleError(_0x48dd69,null));};exports[_0x0e79('0x53')]=function(_0x1a9d87,_0x3e1c4a){if(_0x1a9d87[_0x0e79('0x52')]['id']){delete _0x1a9d87[_0x0e79('0x52')]['id'];}return db[_0x0e79('0x36')][_0x0e79('0x54')]({'where':{'id':_0x1a9d87[_0x0e79('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3e1c4a,null))[_0x0e79('0x1f')](saveUpdates(_0x1a9d87[_0x0e79('0x52')],null))[_0x0e79('0x1f')](respondWithResult(_0x3e1c4a,null))['catch'](handleError(_0x3e1c4a,null));};exports[_0x0e79('0x30')]=function(_0x271f13,_0x28bd38){return db[_0x0e79('0x36')]['find']({'where':{'id':_0x271f13[_0x0e79('0x4f')]['id']}})[_0x0e79('0x1f')](handleEntityNotFound(_0x28bd38,null))['then'](removeEntity(_0x28bd38,null))[_0x0e79('0x28')](handleError(_0x28bd38,null));};exports[_0x0e79('0x55')]=function(_0x516861,_0x17d9cc,_0x395b05){var _0x28a057={};var _0x52ccdf={};var _0x7a8037;var _0x393854;return db['ServicenowAccount'][_0x0e79('0x56')]({'where':{'id':_0x516861[_0x0e79('0x4f')]['id']}})[_0x0e79('0x1f')](handleEntityNotFound(_0x17d9cc,null))[_0x0e79('0x1f')](function(_0x9b9146){if(_0x9b9146){_0x7a8037=_0x9b9146;_0x52ccdf[_0x0e79('0x3a')]=_['keys'](db[_0x0e79('0x57')][_0x0e79('0x50')]);_0x52ccdf[_0x0e79('0x3b')]=_[_0x0e79('0x3c')](_0x516861[_0x0e79('0x3b')]);_0x52ccdf[_0x0e79('0x58')]=_[_0x0e79('0x3d')](_0x52ccdf[_0x0e79('0x3a')],_0x52ccdf['query']);_0x28a057['attributes']=_[_0x0e79('0x3d')](_0x52ccdf['model'],qs[_0x0e79('0x3f')](_0x516861[_0x0e79('0x3b')][_0x0e79('0x3f')]));_0x28a057[_0x0e79('0x3e')]=_0x28a057[_0x0e79('0x3e')][_0x0e79('0x40')]?_0x28a057[_0x0e79('0x3e')]:_0x52ccdf[_0x0e79('0x3a')];_0x28a057[_0x0e79('0x42')]=qs['sort'](_0x516861[_0x0e79('0x3b')][_0x0e79('0x43')]);_0x28a057[_0x0e79('0x44')]=qs['filters'](_[_0x0e79('0x45')](_0x516861[_0x0e79('0x3b')],_0x52ccdf[_0x0e79('0x58')]));if(_0x516861[_0x0e79('0x3b')][_0x0e79('0x46')]){_0x28a057['where']=_['merge'](_0x28a057[_0x0e79('0x44')],{'$or':_[_0x0e79('0x48')](_0x28a057[_0x0e79('0x3e')],function(_0xfce0b){var _0x4e1f8b={};_0x4e1f8b[_0xfce0b]={'$like':'%'+_0x516861[_0x0e79('0x3b')][_0x0e79('0x46')]+'%'};return _0x4e1f8b;})});}_0x28a057=_[_0x0e79('0x47')]({},_0x28a057,_0x516861[_0x0e79('0x49')]);return _0x7a8037[_0x0e79('0x55')](_0x28a057);}})[_0x0e79('0x1f')](function(_0xe5d02c){if(_0xe5d02c){_0x393854=_0xe5d02c['length'];if(!_0x516861['query'][_0x0e79('0x41')](_0x0e79('0x59'))){_0x28a057[_0x0e79('0x2d')]=qs[_0x0e79('0x2d')](_0x516861['query'][_0x0e79('0x2d')]);_0x28a057[_0x0e79('0x2c')]=qs[_0x0e79('0x2c')](_0x516861[_0x0e79('0x3b')][_0x0e79('0x2c')]);}return _0x7a8037[_0x0e79('0x55')](_0x28a057);}})[_0x0e79('0x1f')](function(_0x344dba){if(_0x344dba){return _0x344dba?{'count':_0x393854,'rows':_0x344dba}:null;}})[_0x0e79('0x1f')](respondWithResult(_0x17d9cc,null))[_0x0e79('0x28')](handleError(_0x17d9cc,null));};exports['addConfiguration']=function(_0x2bf835,_0x16cf64,_0x7eed4){if(_0x2bf835[_0x0e79('0x52')]['id']){delete _0x2bf835[_0x0e79('0x52')]['id'];}return db[_0x0e79('0x36')]['findOne']({'where':{'id':_0x2bf835[_0x0e79('0x4f')]['id']}})['then'](handleEntityNotFound(_0x16cf64,null))[_0x0e79('0x1f')](function(_0x3cc545){if(_0x3cc545){_0x2bf835[_0x0e79('0x52')][_0x0e79('0x5a')]=_0x3cc545['id'];_0x2bf835['body']['Subjects']=integrations[_0x0e79('0x5b')](_0x2bf835[_0x0e79('0x52')][_0x0e79('0x5c')],_0x2bf835[_0x0e79('0x52')][_0x0e79('0x38')]);_0x2bf835[_0x0e79('0x52')][_0x0e79('0x5d')]=integrations[_0x0e79('0x5e')](_0x2bf835[_0x0e79('0x52')][_0x0e79('0x5c')],_0x2bf835[_0x0e79('0x52')][_0x0e79('0x38')]);return db[_0x0e79('0x57')][_0x0e79('0x51')](_0x2bf835['body'],{'include':[{'model':db[_0x0e79('0x5f')],'as':_0x0e79('0x60')},{'model':db[_0x0e79('0x5f')],'as':_0x0e79('0x5d')}]});}return null;})[_0x0e79('0x1f')](respondWithResult(_0x16cf64,null))['catch'](handleError(_0x16cf64,null));};exports[_0x0e79('0x61')]=function(_0x22684e,_0x219e0e,_0x3ec4ee){var _0x41441f=[_0x0e79('0x62'),_0x0e79('0x63'),_0x0e79('0x64'),_0x0e79('0x65'),'close_code','notify',_0x0e79('0x66'),_0x0e79('0x67'),'category'];var _0x5bf364=['parent','made_sla',_0x0e79('0x68'),'watch_list',_0x0e79('0x69'),_0x0e79('0x6a'),'child_incidents',_0x0e79('0x63'),_0x0e79('0x6b'),_0x0e79('0x6c'),_0x0e79('0x6d'),_0x0e79('0x6e'),_0x0e79('0x6f'),_0x0e79('0x70'),_0x0e79('0x71'),_0x0e79('0x72'),_0x0e79('0x73'),'sys_created_by',_0x0e79('0x64'),_0x0e79('0x42'),_0x0e79('0x74'),'closed_at',_0x0e79('0x75'),_0x0e79('0x76'),_0x0e79('0x77'),_0x0e79('0x78'),_0x0e79('0x79'),'business_service','priority',_0x0e79('0x7a'),'rfc',_0x0e79('0x7b'),'expected_start',_0x0e79('0x7c'),_0x0e79('0x7d'),_0x0e79('0x7e'),_0x0e79('0x7f'),_0x0e79('0x80'),_0x0e79('0x81'),_0x0e79('0x82'),_0x0e79('0x83'),'subcategory',_0x0e79('0x84'),_0x0e79('0x85'),_0x0e79('0x86'),_0x0e79('0x87'),_0x0e79('0x88'),_0x0e79('0x89'),_0x0e79('0x8a'),_0x0e79('0x8b'),'additional_assignee_list',_0x0e79('0x8c'),'calendar_duration',_0x0e79('0x8d'),_0x0e79('0x8e'),_0x0e79('0x8f'),_0x0e79('0x90'),_0x0e79('0x91'),'parent_incident',_0x0e79('0x92'),_0x0e79('0x93'),'reopened_by','incident_state',_0x0e79('0x94'),_0x0e79('0x95'),_0x0e79('0x96'),'reassignment_count',_0x0e79('0x97'),_0x0e79('0x98'),'severity',_0x0e79('0x99'),'sla_due','approval',_0x0e79('0x9a'),_0x0e79('0x9b'),_0x0e79('0x9c'),_0x0e79('0x9d'),'sys_tags',_0x0e79('0x9e'),_0x0e79('0x9f'),_0x0e79('0xa0'),'location',_0x0e79('0xa1')];var _0xc1f9ca='';var _0x3024ee='';var _0x2c642c=[];var _0x339fba='';var _0x1e4461='';var _0x116b1d=[];var _0xdd63f7='';var _0x43c959='';var _0x4547bd={};var _0x1c723f='';return db[_0x0e79('0x36')]['findOne']({'where':{'id':_0x22684e[_0x0e79('0x4f')]['id']},'attributes':['id',_0x0e79('0xa2'),_0x0e79('0xa3'),_0x0e79('0xa4'),_0x0e79('0xa5'),_0x0e79('0xa6')]})[_0x0e79('0x1f')](handleEntityNotFound(_0x219e0e,null))['then'](function(_0x9381a9){if(_0x9381a9){_0x1c723f=_0x9381a9[_0x0e79('0xa5')];var _0x3952a1=_0x1c723f[_0x0e79('0xa7')](-0x1);if(_0x3952a1==='/'){_0x1c723f=_0x1c723f[_0x0e79('0xa8')](0x0,_0x1c723f['lastIndexOf'](_0x3952a1));}_0x43c959=util['format'](_0x0e79('0xa9'),_0x1c723f);_0xdd63f7=util[_0x0e79('0xaa')]('%s/api/now/table/',_0x1c723f);_0x4547bd={'user':_0x9381a9[_0x0e79('0xa2')],'pass':_0x9381a9[_0x0e79('0xa3')]};var _0x1c7744={'method':'GET','uri':_0x43c959+_0x0e79('0xab'),'auth':_0x4547bd,'json':!![]};return rp(_0x1c7744);}})[_0x0e79('0x1f')](function(_0xaeb1b9){if(_0xaeb1b9[_0x0e79('0x27')][_0x0e79('0x40')]>0x0){_0xc1f9ca=_0xaeb1b9[_0x0e79('0x27')];}console[_0x0e79('0xac')](_0x0e79('0xad'),_0xc1f9ca);_0x116b1d=[];_0x3024ee=Object[_0x0e79('0xae')]([],_0xc1f9ca);_[_0x0e79('0xaf')](_0x3024ee,function(_0x7eba57){return!_0x41441f[_0x0e79('0xb0')](_0x7eba57['name']);});_0x3024ee[_0x0e79('0xb1')](function(_0x1963ac){var _0x5e1f4f=createFieldObject(_0xdd63f7,_0x4547bd,_0x1963ac[_0x0e79('0xb2')],_0x1963ac[_0x0e79('0x33')],_0x1963ac[_0x0e79('0xb3')],![]);_0x116b1d['push'](_0x5e1f4f);});return Promise[_0x0e79('0xb4')](_0x116b1d);})['then'](function(_0x2440c1){_0x2c642c=_0x2440c1;_0x339fba=Object[_0x0e79('0xae')]([],_0xc1f9ca);console['log'](_0x0e79('0xb5'),_0xc1f9ca);_[_0x0e79('0xaf')](_0x339fba,function(_0x177507){return _0x5bf364[_0x0e79('0xb0')](_0x177507[_0x0e79('0x33')]);});console[_0x0e79('0xac')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x339fba);_0x116b1d=[];_0x339fba[_0x0e79('0xb1')](function(_0x3ad3b9){var _0xb085c3=createFieldObject(_0xdd63f7,_0x4547bd,_0x3ad3b9['internalType'],_0x3ad3b9['name'],_0x3ad3b9[_0x0e79('0xb3')],!![]);_0x116b1d[_0x0e79('0xb6')](_0xb085c3);});return Promise[_0x0e79('0xb4')](_0x116b1d);})[_0x0e79('0x1f')](function(_0x14de88){_0x1e4461=_0x14de88;var _0x3f980a=_0x2c642c[_0x0e79('0xb7')](_0x1e4461);return{'count':_0x3f980a[_0x0e79('0x40')],'rows':_0x3f980a};})['then'](respondWithResult(_0x219e0e,null))[_0x0e79('0x28')](function(_0x49ee3f){console[_0x0e79('0xac')](_0x0e79('0xb8')+_0x49ee3f);var _0x225b4d=_0x22684e[_0x0e79('0x3b')][_0x0e79('0xb9')]?0x1f4:_0x49ee3f[_0x0e79('0xba')]||0x1f4;logger[_0x0e79('0x23')](_0x49ee3f[_0x0e79('0x32')]);delete _0x49ee3f[_0x0e79('0x33')];if(_0x225b4d===0x191){_0x225b4d=0x190;}_0x219e0e['status'](_0x225b4d)[_0x0e79('0x34')](_0x22684e['query'][_0x0e79('0xb9')]?{'message':_0x0e79('0xbb'),'statusCode':_0x49ee3f[_0x0e79('0xba')]}:_0x49ee3f);});};function createFieldObject(_0x4157ea,_0x641777,_0x116d85,_0x39d3f5,_0x2d3fdb,_0x1aee68){return new Promise(function(_0x4f43e2,_0x45a0da){var _0x59a33a={'id':_0x39d3f5,'name':_0x2d3fdb,'custom':_0x1aee68};if(_0x116d85==='boolean'){_0x59a33a[_0x0e79('0x49')]=[{'name':_0x0e79('0xbc'),'value':_0x0e79('0xbd')},{'name':_0x0e79('0xbe'),'value':_0x0e79('0xbf')}];_0x4f43e2(_0x59a33a);}else{var _0x354a3f={'method':_0x0e79('0xc0'),'uri':_0x4157ea+_0x0e79('0xc1')+_0x39d3f5,'auth':_0x641777,'json':!![]};return rp(_0x354a3f)[_0x0e79('0x1f')](function(_0x5bc0a4){var _0x508562=[];if(_0x5bc0a4[_0x0e79('0x27')][_0x0e79('0x40')]>0x0){_0x5bc0a4['result'][_0x0e79('0xb1')](function(_0x239875){if(_0x239875[_0x0e79('0xc2')]===_0x0e79('0xbf')){var _0x1a5357={'name':_0x239875[_0x0e79('0xb3')],'value':_0x239875[_0x0e79('0xc3')]};_0x508562['push'](_0x1a5357);}});}_0x59a33a[_0x0e79('0x49')]=_0x508562;if(_0x59a33a[_0x0e79('0x49')][_0x0e79('0x40')]>0x0){_0x4f43e2(_0x59a33a);}else{if(_0x1aee68==![]){_0x4f43e2();}else{_0x4f43e2(_0x59a33a);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index f642889..342885f 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 _0xf2ca=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util'];(function(_0x4c06a3,_0x1e6b6f){var _0x7ff53c=function(_0x559eff){while(--_0x559eff){_0x4c06a3['push'](_0x4c06a3['shift']());}};_0x7ff53c(++_0x1e6b6f);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x549278,_0x450754){_0x549278=_0x549278-0x0;var _0x1ea9a1=_0xf2ca[_0x549278];return _0x1ea9a1;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var logger=require(_0xaf2c('0x2'))('api');var moment=require(_0xaf2c('0x3'));var BPromise=require(_0xaf2c('0x4'));var rp=require(_0xaf2c('0x5'));var fs=require('fs');var path=require(_0xaf2c('0x6'));var rimraf=require(_0xaf2c('0x7'));var config=require(_0xaf2c('0x8'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xaf2c('0x9'));module[_0xaf2c('0xa')]=function(_0x297740,_0x1f9531){return _0x297740['define'](_0xaf2c('0xb'),attributes,{'tableName':_0xaf2c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e85=['define','ServicenowAccount','int_servicenow_accounts','lodash','util','api','moment','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x0e85,0x7c));var _0x50e8=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x0e85[_0x40a825];return _0x273a54;};'use strict';var _=require(_0x50e8('0x0'));var util=require(_0x50e8('0x1'));var logger=require('../../config/logger')(_0x50e8('0x2'));var moment=require(_0x50e8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x50e8('0x4'));var config=require('../../config/environment');var attributes=require(_0x50e8('0x5'));var integrations=require(_0x50e8('0x6'));module[_0x50e8('0x7')]=function(_0xfde42,_0x5e8b01){return _0xfde42[_0x50e8('0x8')](_0x50e8('0x9'),attributes,{'tableName':_0x50e8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index b34d4bb..1c2bf34 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 _0xfc52=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','GetServicenowAccount','findAll','options','raw','where','attributes','limit','map','include','model','catch','ShowServicenowAccount','find'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xfc52,0xee));var _0x2fc5=function(_0x5b8a39,_0x18eb9c){_0x5b8a39=_0x5b8a39-0x0;var _0x12394d=_0xfc52[_0x5b8a39];return _0x12394d;};'use strict';var _=require(_0x2fc5('0x0'));var util=require(_0x2fc5('0x1'));var moment=require('moment');var BPromise=require(_0x2fc5('0x2'));var rs=require(_0x2fc5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2fc5('0x4'))['db'];var utils=require(_0x2fc5('0x5'));var logger=require('../../config/logger')(_0x2fc5('0x6'));var config=require(_0x2fc5('0x7'));var jayson=require(_0x2fc5('0x8'));var client=jayson[_0x2fc5('0x9')][_0x2fc5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57a751,_0x379b24,_0x1de912){return new BPromise(function(_0x1bbcf7,_0x4361bf){return client[_0x2fc5('0xb')](_0x57a751,_0x1de912)[_0x2fc5('0xc')](function(_0x1cc861){logger[_0x2fc5('0xd')](_0x2fc5('0xe'),_0x379b24,_0x2fc5('0xf'));logger[_0x2fc5('0x10')](_0x2fc5('0x11'),_0x379b24,'request\x20sent',JSON[_0x2fc5('0x12')](_0x1cc861));if(_0x1cc861[_0x2fc5('0x13')]){if(_0x1cc861[_0x2fc5('0x13')]['code']===0x1f4){logger[_0x2fc5('0x13')](_0x2fc5('0xe'),_0x379b24,_0x1cc861[_0x2fc5('0x13')][_0x2fc5('0x14')]);return _0x4361bf(_0x1cc861['error'][_0x2fc5('0x14')]);}logger[_0x2fc5('0x13')](_0x2fc5('0xe'),_0x379b24,_0x1cc861[_0x2fc5('0x13')][_0x2fc5('0x14')]);return _0x1bbcf7(_0x1cc861['error'][_0x2fc5('0x14')]);}else{logger['info'](_0x2fc5('0xe'),_0x379b24,_0x2fc5('0xf'));_0x1bbcf7(_0x1cc861['result'][_0x2fc5('0x14')]);}})['catch'](function(_0x51f6a7){logger[_0x2fc5('0x13')](_0x2fc5('0xe'),_0x379b24,_0x51f6a7);_0x4361bf(_0x51f6a7);});});}exports[_0x2fc5('0x15')]=function(_0x230491){var _0x165b34=this;return new Promise(function(_0xe3847f,_0x42bcca){return db['ServicenowAccount'][_0x2fc5('0x16')]({'raw':_0x230491[_0x2fc5('0x17')]?_0x230491['options'][_0x2fc5('0x18')]===undefined?!![]:![]:!![],'where':_0x230491[_0x2fc5('0x17')]?_0x230491[_0x2fc5('0x17')][_0x2fc5('0x19')]||null:null,'attributes':_0x230491[_0x2fc5('0x17')]?_0x230491['options'][_0x2fc5('0x1a')]||null:null,'limit':_0x230491[_0x2fc5('0x17')]?_0x230491['options'][_0x2fc5('0x1b')]||null:null,'include':_0x230491[_0x2fc5('0x17')]?_0x230491['options']['include']?_[_0x2fc5('0x1c')](_0x230491['options']['include'],function(_0x2f9bd6){return{'model':db[_0x2f9bd6['model']],'as':_0x2f9bd6['as'],'attributes':_0x2f9bd6[_0x2fc5('0x1a')],'include':_0x2f9bd6[_0x2fc5('0x1d')]?_[_0x2fc5('0x1c')](_0x2f9bd6[_0x2fc5('0x1d')],function(_0x5e2526){return{'model':db[_0x5e2526[_0x2fc5('0x1e')]],'as':_0x5e2526['as'],'attributes':_0x5e2526[_0x2fc5('0x1a')],'include':_0x5e2526[_0x2fc5('0x1d')]?_[_0x2fc5('0x1c')](_0x5e2526['include'],function(_0x1ee62e){return{'model':db[_0x1ee62e[_0x2fc5('0x1e')]],'as':_0x1ee62e['as'],'attributes':_0x1ee62e[_0x2fc5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2fc5('0xc')](function(_0xa94fbb){logger[_0x2fc5('0xd')]('GetServicenowAccount',_0x230491);logger['debug'](_0x2fc5('0x15'),_0x230491,JSON[_0x2fc5('0x12')](_0xa94fbb));_0xe3847f(_0xa94fbb);})[_0x2fc5('0x1f')](function(_0x2df539){logger['error'](_0x2fc5('0x15'),_0x2df539['message'],_0x230491);_0x42bcca(_0x165b34[_0x2fc5('0x13')](0x1f4,_0x2df539[_0x2fc5('0x14')]));});});};exports[_0x2fc5('0x20')]=function(_0x4b0faf){var _0x23d5cb=this;return new Promise(function(_0xed8428,_0x119c14){return db['ServicenowAccount'][_0x2fc5('0x21')]({'raw':_0x4b0faf[_0x2fc5('0x17')]?_0x4b0faf[_0x2fc5('0x17')][_0x2fc5('0x18')]===undefined?!![]:![]:!![],'where':_0x4b0faf[_0x2fc5('0x17')]?_0x4b0faf[_0x2fc5('0x17')][_0x2fc5('0x19')]||null:null,'attributes':_0x4b0faf[_0x2fc5('0x17')]?_0x4b0faf[_0x2fc5('0x17')]['attributes']||null:null,'include':_0x4b0faf[_0x2fc5('0x17')]?_0x4b0faf[_0x2fc5('0x17')]['include']?_[_0x2fc5('0x1c')](_0x4b0faf[_0x2fc5('0x17')][_0x2fc5('0x1d')],function(_0x2d7eab){return{'model':db[_0x2d7eab[_0x2fc5('0x1e')]],'as':_0x2d7eab['as'],'attributes':_0x2d7eab[_0x2fc5('0x1a')],'include':_0x2d7eab['include']?_['map'](_0x2d7eab['include'],function(_0x4f6282){return{'model':db[_0x4f6282[_0x2fc5('0x1e')]],'as':_0x4f6282['as'],'attributes':_0x4f6282[_0x2fc5('0x1a')],'include':_0x4f6282[_0x2fc5('0x1d')]?_[_0x2fc5('0x1c')](_0x4f6282['include'],function(_0x248fae){return{'model':db[_0x248fae[_0x2fc5('0x1e')]],'as':_0x248fae['as'],'attributes':_0x248fae[_0x2fc5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2fc5('0xc')](function(_0x348347){logger[_0x2fc5('0xd')](_0x2fc5('0x20'),_0x4b0faf);logger[_0x2fc5('0x10')](_0x2fc5('0x20'),_0x4b0faf,JSON[_0x2fc5('0x12')](_0x348347));_0xed8428(_0x348347);})[_0x2fc5('0x1f')](function(_0x53f0ef){logger[_0x2fc5('0x13')](_0x2fc5('0x20'),_0x53f0ef[_0x2fc5('0x14')],_0x4b0faf);_0x119c14(_0x23d5cb[_0x2fc5('0x13')](0x1f4,_0x53f0ef[_0x2fc5('0x14')]));});});}; \ No newline at end of file +var _0xc143=['findAll','options','where','attributes','limit','include','map','model','ShowServicenowAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','catch','ServicenowAccount'];(function(_0xc83285,_0x3860f3){var _0x59ef36=function(_0x375eaf){while(--_0x375eaf){_0xc83285['push'](_0xc83285['shift']());}};_0x59ef36(++_0x3860f3);}(_0xc143,0xdc));var _0x3c14=function(_0x2e87db,_0x1f4766){_0x2e87db=_0x2e87db-0x0;var _0x5ef1a6=_0xc143[_0x2e87db];return _0x5ef1a6;};'use strict';var _=require(_0x3c14('0x0'));var util=require(_0x3c14('0x1'));var moment=require(_0x3c14('0x2'));var BPromise=require(_0x3c14('0x3'));var rs=require(_0x3c14('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c14('0x5'))['db'];var utils=require(_0x3c14('0x6'));var logger=require(_0x3c14('0x7'))('rpc');var config=require(_0x3c14('0x8'));var jayson=require(_0x3c14('0x9'));var client=jayson[_0x3c14('0xa')][_0x3c14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5686ab,_0x464faf,_0x311498){return new BPromise(function(_0x5a89e9,_0x5932e9){return client['request'](_0x5686ab,_0x311498)[_0x3c14('0xc')](function(_0x425804){logger[_0x3c14('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x464faf,_0x3c14('0xe'));logger[_0x3c14('0xf')](_0x3c14('0x10'),_0x464faf,'request\x20sent',JSON[_0x3c14('0x11')](_0x425804));if(_0x425804[_0x3c14('0x12')]){if(_0x425804[_0x3c14('0x12')][_0x3c14('0x13')]===0x1f4){logger['error'](_0x3c14('0x14'),_0x464faf,_0x425804[_0x3c14('0x12')][_0x3c14('0x15')]);return _0x5932e9(_0x425804[_0x3c14('0x12')]['message']);}logger[_0x3c14('0x12')](_0x3c14('0x14'),_0x464faf,_0x425804[_0x3c14('0x12')][_0x3c14('0x15')]);return _0x5a89e9(_0x425804[_0x3c14('0x12')][_0x3c14('0x15')]);}else{logger[_0x3c14('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x464faf,_0x3c14('0xe'));_0x5a89e9(_0x425804[_0x3c14('0x16')]['message']);}})[_0x3c14('0x17')](function(_0x1471f9){logger['error'](_0x3c14('0x14'),_0x464faf,_0x1471f9);_0x5932e9(_0x1471f9);});});}exports['GetServicenowAccount']=function(_0x44ea83){var _0x48bafd=this;return new Promise(function(_0x3a3b23,_0x1f5b45){return db[_0x3c14('0x18')][_0x3c14('0x19')]({'raw':_0x44ea83[_0x3c14('0x1a')]?_0x44ea83[_0x3c14('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x44ea83[_0x3c14('0x1a')]?_0x44ea83[_0x3c14('0x1a')][_0x3c14('0x1b')]||null:null,'attributes':_0x44ea83['options']?_0x44ea83[_0x3c14('0x1a')][_0x3c14('0x1c')]||null:null,'limit':_0x44ea83[_0x3c14('0x1a')]?_0x44ea83[_0x3c14('0x1a')][_0x3c14('0x1d')]||null:null,'include':_0x44ea83[_0x3c14('0x1a')]?_0x44ea83[_0x3c14('0x1a')][_0x3c14('0x1e')]?_[_0x3c14('0x1f')](_0x44ea83[_0x3c14('0x1a')]['include'],function(_0x16614d){return{'model':db[_0x16614d[_0x3c14('0x20')]],'as':_0x16614d['as'],'attributes':_0x16614d[_0x3c14('0x1c')],'include':_0x16614d['include']?_[_0x3c14('0x1f')](_0x16614d[_0x3c14('0x1e')],function(_0x350b63){return{'model':db[_0x350b63[_0x3c14('0x20')]],'as':_0x350b63['as'],'attributes':_0x350b63[_0x3c14('0x1c')],'include':_0x350b63[_0x3c14('0x1e')]?_['map'](_0x350b63[_0x3c14('0x1e')],function(_0x46391d){return{'model':db[_0x46391d[_0x3c14('0x20')]],'as':_0x46391d['as'],'attributes':_0x46391d['attributes']};}):[]};}):[]};}):[]:[]})[_0x3c14('0xc')](function(_0x49f5c8){logger[_0x3c14('0xd')]('GetServicenowAccount',_0x44ea83);logger[_0x3c14('0xf')]('GetServicenowAccount',_0x44ea83,JSON[_0x3c14('0x11')](_0x49f5c8));_0x3a3b23(_0x49f5c8);})['catch'](function(_0x20a476){logger[_0x3c14('0x12')]('GetServicenowAccount',_0x20a476[_0x3c14('0x15')],_0x44ea83);_0x1f5b45(_0x48bafd[_0x3c14('0x12')](0x1f4,_0x20a476['message']));});});};exports[_0x3c14('0x21')]=function(_0x1ff8f3){var _0x377d0a=this;return new Promise(function(_0x33c3ff,_0x21f1b5){return db[_0x3c14('0x18')][_0x3c14('0x22')]({'raw':_0x1ff8f3[_0x3c14('0x1a')]?_0x1ff8f3[_0x3c14('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1ff8f3['options']?_0x1ff8f3[_0x3c14('0x1a')][_0x3c14('0x1b')]||null:null,'attributes':_0x1ff8f3[_0x3c14('0x1a')]?_0x1ff8f3[_0x3c14('0x1a')][_0x3c14('0x1c')]||null:null,'include':_0x1ff8f3['options']?_0x1ff8f3[_0x3c14('0x1a')]['include']?_[_0x3c14('0x1f')](_0x1ff8f3[_0x3c14('0x1a')]['include'],function(_0x1a3af0){return{'model':db[_0x1a3af0[_0x3c14('0x20')]],'as':_0x1a3af0['as'],'attributes':_0x1a3af0[_0x3c14('0x1c')],'include':_0x1a3af0[_0x3c14('0x1e')]?_[_0x3c14('0x1f')](_0x1a3af0[_0x3c14('0x1e')],function(_0x57ef9c){return{'model':db[_0x57ef9c['model']],'as':_0x57ef9c['as'],'attributes':_0x57ef9c[_0x3c14('0x1c')],'include':_0x57ef9c['include']?_[_0x3c14('0x1f')](_0x57ef9c[_0x3c14('0x1e')],function(_0x2aa9cd){return{'model':db[_0x2aa9cd['model']],'as':_0x2aa9cd['as'],'attributes':_0x2aa9cd['attributes']};}):[]};}):[]};}):[]:[]})[_0x3c14('0xc')](function(_0x1d9366){logger[_0x3c14('0xd')](_0x3c14('0x21'),_0x1ff8f3);logger[_0x3c14('0xf')](_0x3c14('0x21'),_0x1ff8f3,JSON[_0x3c14('0x11')](_0x1d9366));_0x33c3ff(_0x1d9366);})['catch'](function(_0x557b06){logger['error']('ShowServicenowAccount',_0x557b06[_0x3c14('0x15')],_0x1ff8f3);_0x21f1b5(_0x377d0a[_0x3c14('0x12')](0x1f4,_0x557b06['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 05ff4e4..1f72ee5 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 _0x871d=['../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id/subjects','/:id/descriptions','getDescriptions','create','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2575eb,_0x456f3f){var _0x1c49da=function(_0x32dcb1){while(--_0x32dcb1){_0x2575eb['push'](_0x2575eb['shift']());}};_0x1c49da(++_0x456f3f);}(_0x871d,0x67));var _0xd871=function(_0x2eeae0,_0x469b4d){_0x2eeae0=_0x2eeae0-0x0;var _0x14185b=_0x871d[_0x2eeae0];return _0x14185b;};'use strict';var multer=require(_0xd871('0x0'));var util=require(_0xd871('0x1'));var path=require(_0xd871('0x2'));var timeout=require(_0xd871('0x3'));var express=require(_0xd871('0x4'));var router=express[_0xd871('0x5')]();var auth=require(_0xd871('0x6'));var interaction=require(_0xd871('0x7'));var config=require(_0xd871('0x8'));var controller=require(_0xd871('0x9'));router[_0xd871('0xa')]('/',auth[_0xd871('0xb')](),controller[_0xd871('0xc')]);router[_0xd871('0xa')]('/:id',auth[_0xd871('0xb')](),controller['show']);router[_0xd871('0xa')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xd871('0xa')](_0xd871('0xd'),auth[_0xd871('0xb')](),controller['getSubjects']);router[_0xd871('0xa')](_0xd871('0xe'),auth['isAuthenticated'](),controller[_0xd871('0xf')]);router['post']('/',auth[_0xd871('0xb')](),controller[_0xd871('0x10')]);router[_0xd871('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd871('0x12')]);router[_0xd871('0x13')](_0xd871('0x14'),auth[_0xd871('0xb')](),controller[_0xd871('0x15')]);module['exports']=router; \ No newline at end of file +var _0x30b6=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','exports','multer','util','connect-timeout','express','Router'];(function(_0x26d8ea,_0x2624e6){var _0x56cf66=function(_0x13760a){while(--_0x13760a){_0x26d8ea['push'](_0x26d8ea['shift']());}};_0x56cf66(++_0x2624e6);}(_0x30b6,0x171));var _0x630b=function(_0x47beea,_0x44b235){_0x47beea=_0x47beea-0x0;var _0x28e5c4=_0x30b6[_0x47beea];return _0x28e5c4;};'use strict';var multer=require(_0x630b('0x0'));var util=require(_0x630b('0x1'));var path=require('path');var timeout=require(_0x630b('0x2'));var express=require(_0x630b('0x3'));var router=express[_0x630b('0x4')]();var auth=require(_0x630b('0x5'));var interaction=require(_0x630b('0x6'));var config=require(_0x630b('0x7'));var controller=require(_0x630b('0x8'));router[_0x630b('0x9')]('/',auth[_0x630b('0xa')](),controller['index']);router[_0x630b('0x9')](_0x630b('0xb'),auth[_0x630b('0xa')](),controller['show']);router[_0x630b('0x9')](_0x630b('0xc'),auth[_0x630b('0xa')](),controller['getFields']);router[_0x630b('0x9')](_0x630b('0xd'),auth[_0x630b('0xa')](),controller[_0x630b('0xe')]);router[_0x630b('0x9')](_0x630b('0xf'),auth[_0x630b('0xa')](),controller[_0x630b('0x10')]);router[_0x630b('0x11')]('/',auth['isAuthenticated'](),controller[_0x630b('0x12')]);router['put'](_0x630b('0xb'),auth[_0x630b('0xa')](),controller[_0x630b('0x13')]);router[_0x630b('0x14')](_0x630b('0xb'),auth[_0x630b('0xa')](),controller['destroy']);module[_0x630b('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index d930a77..abc5ab4 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 _0x2c4d=['exports','sequelize'];(function(_0x246148,_0x1358ee){var _0x453d94=function(_0x59920e){while(--_0x59920e){_0x246148['push'](_0x246148['shift']());}};_0x453d94(++_0x1358ee);}(_0x2c4d,0x1ab));var _0xd2c4=function(_0x42e25e,_0x46cfd1){_0x42e25e=_0x42e25e-0x0;var _0x1ed3a6=_0x2c4d[_0x42e25e];return _0x1ed3a6;};'use strict';var Sequelize=require(_0xd2c4('0x0'));module[_0xd2c4('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4d50=['sequelize','STRING'];(function(_0x35659b,_0x17476e){var _0x266176=function(_0x1b92c9){while(--_0x1b92c9){_0x35659b['push'](_0x35659b['shift']());}};_0x266176(++_0x17476e);}(_0x4d50,0x1b6));var _0x04d5=function(_0x46244c,_0x5adc68){_0x46244c=_0x46244c-0x0;var _0x20259c=_0x4d50[_0x46244c];return _0x20259c;};'use strict';var Sequelize=require(_0x04d5('0x0'));module['exports']={'name':{'type':Sequelize[_0x04d5('0x1')]},'description':{'type':Sequelize[_0x04d5('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 94ff25f..879a44b 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 _0x148c=['api','../../config/utils','../../config/environment','../../config/license/util','client','http','request','then','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','count','offset','Content-Range','json','save','destroy','name','index','map','ServicenowConfiguration','rawAttributes','key','model','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','filters','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','show','params','keys','find','create','update','body','ServicenowField','pick','getFields','nolimit','getSubjects','findOne','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x195919,_0x177c79){var _0x2aa39d=function(_0x31841c){while(--_0x31841c){_0x195919['push'](_0x195919['shift']());}};_0x2aa39d(++_0x177c79);}(_0x148c,0x140));var _0xc148=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x148c[_0x278e3c];return _0x3e2d9b;};'use strict';var pdf=require(_0xc148('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc148('0x1'));var zipdir=require(_0xc148('0x2'));var jsonpatch=require(_0xc148('0x3'));var rp=require(_0xc148('0x4'));var moment=require(_0xc148('0x5'));var BPromise=require(_0xc148('0x6'));var Mustache=require(_0xc148('0x7'));var util=require('util');var path=require('path');var sox=require(_0xc148('0x8'));var csv=require(_0xc148('0x9'));var ejs=require(_0xc148('0xa'));var fs=require('fs');var _=require(_0xc148('0xb'));var squel=require(_0xc148('0xc'));var crypto=require(_0xc148('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc148('0xe'));var toCsv=require(_0xc148('0x9'));var querystring=require('querystring');var Papa=require(_0xc148('0xf'));var Redis=require('ioredis');var authService=require(_0xc148('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc148('0x11'));var hardwareService=require(_0xc148('0x12'));var logger=require(_0xc148('0x13'))(_0xc148('0x14'));var utils=require(_0xc148('0x15'));var config=require(_0xc148('0x16'));var licenseUtil=require(_0xc148('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xc148('0x18')][_0xc148('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x312bd1,_0xaf16f9,_0x5d7481,_0x1a7226){return new BPromise(function(_0x2255b6,_0xe1431f){var _0x11b55a=_0x1a7226||client;return _0x11b55a[_0xc148('0x1a')](_0x312bd1,_0x5d7481)[_0xc148('0x1b')](function(_0x7d6f08){logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0xaf16f9,_0xc148('0x1c'));logger[_0xc148('0x1d')](_0xc148('0x1e'),_0xaf16f9,_0xc148('0x1c'),JSON['stringify'](_0x7d6f08));if(_0x7d6f08['error']){if(_0x7d6f08[_0xc148('0x1f')]['code']===0x1f4){logger[_0xc148('0x1f')](_0xc148('0x20'),_0xaf16f9,_0x7d6f08[_0xc148('0x1f')][_0xc148('0x21')]);return _0xe1431f(_0x7d6f08[_0xc148('0x1f')]['message']);}logger[_0xc148('0x1f')]('ServicenowConfiguration,\x20%s,\x20%s',_0xaf16f9,_0x7d6f08[_0xc148('0x1f')][_0xc148('0x21')]);return _0x2255b6(_0x7d6f08[_0xc148('0x1f')][_0xc148('0x21')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0xaf16f9,'request\x20sent');_0x2255b6(_0x7d6f08[_0xc148('0x22')][_0xc148('0x21')]);}})[_0xc148('0x23')](function(_0x35432e){logger['error'](_0xc148('0x20'),_0xaf16f9,_0x35432e);_0xe1431f(_0x35432e);});});}function respondWithStatusCode(_0x30548b,_0x28054f){_0x28054f=_0x28054f||0xcc;return function(_0x3ac297){if(_0x3ac297){return _0x30548b[_0xc148('0x24')](_0x28054f);}return _0x30548b['status'](_0x28054f)[_0xc148('0x25')]();};}function respondWithResult(_0x48f6c9,_0x482b33){_0x482b33=_0x482b33||0xc8;return function(_0x28de61){if(_0x28de61){return _0x48f6c9[_0xc148('0x26')](_0x482b33)['json'](_0x28de61);}};}function respondWithFilteredResult(_0x2aa8f4,_0x464871){return function(_0x185128){if(_0x185128){var _0x1e6d07=_0x185128[_0xc148('0x27')],_0x1cb259=_0x464871[_0xc148('0x28')],_0x2da587=_0x464871[_0xc148('0x28')]+_0x464871['limit'],_0x253398;if(_0x2da587>=_0x1e6d07){_0x2da587=_0x1e6d07;_0x253398=0xc8;}else{_0x253398=0xce;}_0x2aa8f4['status'](_0x253398);return _0x2aa8f4['set'](_0xc148('0x29'),_0x1cb259+'-'+_0x2da587+'/'+_0x1e6d07)[_0xc148('0x2a')](_0x185128);}return null;};}function patchUpdates(_0x143936){return function(_0x26a6a2){try{jsonpatch['apply'](_0x26a6a2,_0x143936,!![]);}catch(_0x4e2bec){return BPromise['reject'](_0x4e2bec);}return _0x26a6a2[_0xc148('0x2b')]();};}function saveUpdates(_0x130afd,_0x1000ee){return function(_0x1afd9d){if(_0x1afd9d){return _0x1afd9d['update'](_0x130afd)[_0xc148('0x1b')](function(_0x359884){return _0x359884;});}return null;};}function removeEntity(_0x2babe6,_0x51c9c1){return function(_0x163fd7){if(_0x163fd7){return _0x163fd7[_0xc148('0x2c')]()[_0xc148('0x1b')](function(){_0x2babe6[_0xc148('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d0cc7,_0x36c66f){return function(_0x462e){if(!_0x462e){_0x3d0cc7[_0xc148('0x24')](0x194);}return _0x462e;};}function handleError(_0x2cc886,_0xdb6193){_0xdb6193=_0xdb6193||0x1f4;return function(_0x275d86){logger['error'](_0x275d86['stack']);if(_0x275d86[_0xc148('0x2d')]){delete _0x275d86[_0xc148('0x2d')];}_0x2cc886[_0xc148('0x26')](_0xdb6193)['send'](_0x275d86);};}exports[_0xc148('0x2e')]=function(_0xe3d762,_0x1e2add){var _0x325aff={},_0x36cb5f={},_0x3a0c92={'count':0x0,'rows':[]};var _0x2325ef=_[_0xc148('0x2f')](db[_0xc148('0x30')][_0xc148('0x31')],function(_0x33d11b){return{'name':_0x33d11b['fieldName'],'type':_0x33d11b['type'][_0xc148('0x32')]};});_0x36cb5f[_0xc148('0x33')]=_['map'](_0x2325ef,_0xc148('0x2d'));_0x36cb5f['query']=_['keys'](_0xe3d762[_0xc148('0x34')]);_0x36cb5f['filters']=_[_0xc148('0x35')](_0x36cb5f[_0xc148('0x33')],_0x36cb5f['query']);_0x325aff[_0xc148('0x36')]=_['intersection'](_0x36cb5f[_0xc148('0x33')],qs[_0xc148('0x37')](_0xe3d762['query'][_0xc148('0x37')]));_0x325aff[_0xc148('0x36')]=_0x325aff[_0xc148('0x36')][_0xc148('0x38')]?_0x325aff[_0xc148('0x36')]:_0x36cb5f[_0xc148('0x33')];if(!_0xe3d762[_0xc148('0x34')][_0xc148('0x39')]('nolimit')){_0x325aff[_0xc148('0x3a')]=qs[_0xc148('0x3a')](_0xe3d762[_0xc148('0x34')][_0xc148('0x3a')]);_0x325aff[_0xc148('0x28')]=qs[_0xc148('0x28')](_0xe3d762[_0xc148('0x34')][_0xc148('0x28')]);}_0x325aff[_0xc148('0x3b')]=qs['sort'](_0xe3d762[_0xc148('0x34')][_0xc148('0x3c')]);_0x325aff['where']=qs[_0xc148('0x3d')](_['pick'](_0xe3d762[_0xc148('0x34')],_0x36cb5f[_0xc148('0x3d')]),_0x2325ef);if(_0xe3d762[_0xc148('0x34')][_0xc148('0x3e')]){_0x325aff[_0xc148('0x3f')]=_['merge'](_0x325aff[_0xc148('0x3f')],{'$or':_[_0xc148('0x2f')](_0x2325ef,function(_0x69213a){if(_0x69213a[_0xc148('0x40')]!==_0xc148('0x41')){var _0x3702e6={};_0x3702e6[_0x69213a[_0xc148('0x2d')]]={'$like':'%'+_0xe3d762[_0xc148('0x34')][_0xc148('0x3e')]+'%'};return _0x3702e6;}})});}_0x325aff=_[_0xc148('0x42')]({},_0x325aff,_0xe3d762[_0xc148('0x43')]);var _0x36ac60={'where':_0x325aff[_0xc148('0x3f')]};return db[_0xc148('0x30')][_0xc148('0x27')](_0x36ac60)[_0xc148('0x1b')](function(_0x72fe19){_0x3a0c92[_0xc148('0x27')]=_0x72fe19;if(_0xe3d762[_0xc148('0x34')][_0xc148('0x44')]){_0x325aff[_0xc148('0x45')]=[{'all':!![]}];}return db[_0xc148('0x30')][_0xc148('0x46')](_0x325aff);})[_0xc148('0x1b')](function(_0x25040c){_0x3a0c92['rows']=_0x25040c;return _0x3a0c92;})[_0xc148('0x1b')](respondWithFilteredResult(_0x1e2add,_0x325aff))['catch'](handleError(_0x1e2add,null));};exports[_0xc148('0x47')]=function(_0x1d024e,_0x5eccf1){var _0x5897df={'raw':![],'where':{'id':_0x1d024e[_0xc148('0x48')]['id']}},_0x9f020f={};_0x9f020f[_0xc148('0x33')]=_[_0xc148('0x49')](db[_0xc148('0x30')][_0xc148('0x31')]);_0x9f020f['query']=_[_0xc148('0x49')](_0x1d024e['query']);_0x9f020f[_0xc148('0x3d')]=_[_0xc148('0x35')](_0x9f020f[_0xc148('0x33')],_0x9f020f[_0xc148('0x34')]);_0x5897df[_0xc148('0x36')]=_[_0xc148('0x35')](_0x9f020f[_0xc148('0x33')],qs[_0xc148('0x37')](_0x1d024e['query'][_0xc148('0x37')]));_0x5897df[_0xc148('0x36')]=_0x5897df[_0xc148('0x36')][_0xc148('0x38')]?_0x5897df[_0xc148('0x36')]:_0x9f020f[_0xc148('0x33')];if(_0x1d024e[_0xc148('0x34')][_0xc148('0x44')]){_0x5897df[_0xc148('0x45')]=[{'all':!![]}];}_0x5897df=_[_0xc148('0x42')]({},_0x5897df,_0x1d024e[_0xc148('0x43')]);return db[_0xc148('0x30')][_0xc148('0x4a')](_0x5897df)['then'](handleEntityNotFound(_0x5eccf1,null))[_0xc148('0x1b')](respondWithResult(_0x5eccf1,null))['catch'](handleError(_0x5eccf1,null));};exports[_0xc148('0x4b')]=function(_0x27e00a,_0x507997){return db[_0xc148('0x30')][_0xc148('0x4b')](_0x27e00a['body'],{})[_0xc148('0x1b')](respondWithResult(_0x507997,0xc9))[_0xc148('0x23')](handleError(_0x507997,null));};exports[_0xc148('0x4c')]=function(_0x5f0d49,_0x372a12){if(_0x5f0d49['body']['id']){delete _0x5f0d49[_0xc148('0x4d')]['id'];}return db[_0xc148('0x30')][_0xc148('0x4a')]({'where':{'id':_0x5f0d49[_0xc148('0x48')]['id']}})[_0xc148('0x1b')](handleEntityNotFound(_0x372a12,null))[_0xc148('0x1b')](saveUpdates(_0x5f0d49[_0xc148('0x4d')],null))[_0xc148('0x1b')](respondWithResult(_0x372a12,null))[_0xc148('0x23')](handleError(_0x372a12,null));};exports[_0xc148('0x2c')]=function(_0x4d38d7,_0x1fbc0a){return db[_0xc148('0x30')][_0xc148('0x4a')]({'where':{'id':_0x4d38d7[_0xc148('0x48')]['id']}})[_0xc148('0x1b')](handleEntityNotFound(_0x1fbc0a,null))[_0xc148('0x1b')](removeEntity(_0x1fbc0a,null))[_0xc148('0x23')](handleError(_0x1fbc0a,null));};exports['getFields']=function(_0x2494c3,_0x531bff,_0x322bef){var _0x34c3b8={};var _0x46aadc={};var _0x5e2d6c;var _0x2d2786;return db[_0xc148('0x30')]['findOne']({'where':{'id':_0x2494c3[_0xc148('0x48')]['id']}})[_0xc148('0x1b')](handleEntityNotFound(_0x531bff,null))[_0xc148('0x1b')](function(_0xbf8456){if(_0xbf8456){_0x5e2d6c=_0xbf8456;_0x46aadc[_0xc148('0x33')]=_[_0xc148('0x49')](db[_0xc148('0x4e')][_0xc148('0x31')]);_0x46aadc[_0xc148('0x34')]=_['keys'](_0x2494c3[_0xc148('0x34')]);_0x46aadc[_0xc148('0x3d')]=_['intersection'](_0x46aadc[_0xc148('0x33')],_0x46aadc['query']);_0x34c3b8['attributes']=_[_0xc148('0x35')](_0x46aadc[_0xc148('0x33')],qs[_0xc148('0x37')](_0x2494c3[_0xc148('0x34')][_0xc148('0x37')]));_0x34c3b8[_0xc148('0x36')]=_0x34c3b8[_0xc148('0x36')][_0xc148('0x38')]?_0x34c3b8[_0xc148('0x36')]:_0x46aadc['model'];_0x34c3b8[_0xc148('0x3b')]=qs[_0xc148('0x3c')](_0x2494c3[_0xc148('0x34')][_0xc148('0x3c')]);_0x34c3b8['where']=qs[_0xc148('0x3d')](_[_0xc148('0x4f')](_0x2494c3[_0xc148('0x34')],_0x46aadc[_0xc148('0x3d')]));if(_0x2494c3[_0xc148('0x34')][_0xc148('0x3e')]){_0x34c3b8[_0xc148('0x3f')]=_[_0xc148('0x42')](_0x34c3b8[_0xc148('0x3f')],{'$or':_[_0xc148('0x2f')](_0x34c3b8[_0xc148('0x36')],function(_0x375a2e){var _0x2776fd={};_0x2776fd[_0x375a2e]={'$like':'%'+_0x2494c3['query'][_0xc148('0x3e')]+'%'};return _0x2776fd;})});}_0x34c3b8=_[_0xc148('0x42')]({},_0x34c3b8,_0x2494c3[_0xc148('0x43')]);return _0x5e2d6c[_0xc148('0x50')](_0x34c3b8);}})[_0xc148('0x1b')](function(_0x2fdd43){if(_0x2fdd43){_0x2d2786=_0x2fdd43['length'];if(!_0x2494c3['query'][_0xc148('0x39')](_0xc148('0x51'))){_0x34c3b8[_0xc148('0x3a')]=qs[_0xc148('0x3a')](_0x2494c3[_0xc148('0x34')][_0xc148('0x3a')]);_0x34c3b8[_0xc148('0x28')]=qs['offset'](_0x2494c3[_0xc148('0x34')][_0xc148('0x28')]);}return _0x5e2d6c['getFields'](_0x34c3b8);}})[_0xc148('0x1b')](function(_0x45e398){if(_0x45e398){return _0x45e398?{'count':_0x2d2786,'rows':_0x45e398}:null;}})[_0xc148('0x1b')](respondWithResult(_0x531bff,null))['catch'](handleError(_0x531bff,null));};exports[_0xc148('0x52')]=function(_0xb0347f,_0x35f9ed,_0xab04df){var _0x4e1205={};var _0x2c859e={};var _0xf8f8cf;var _0x1fbc01;return db[_0xc148('0x30')][_0xc148('0x53')]({'where':{'id':_0xb0347f[_0xc148('0x48')]['id']}})[_0xc148('0x1b')](handleEntityNotFound(_0x35f9ed,null))['then'](function(_0x345e3d){if(_0x345e3d){_0xf8f8cf=_0x345e3d;_0x2c859e[_0xc148('0x33')]=_['keys'](db[_0xc148('0x4e')]['rawAttributes']);_0x2c859e[_0xc148('0x34')]=_[_0xc148('0x49')](_0xb0347f[_0xc148('0x34')]);_0x2c859e[_0xc148('0x3d')]=_[_0xc148('0x35')](_0x2c859e['model'],_0x2c859e[_0xc148('0x34')]);_0x4e1205[_0xc148('0x36')]=_['intersection'](_0x2c859e[_0xc148('0x33')],qs[_0xc148('0x37')](_0xb0347f['query'][_0xc148('0x37')]));_0x4e1205[_0xc148('0x36')]=_0x4e1205[_0xc148('0x36')][_0xc148('0x38')]?_0x4e1205['attributes']:_0x2c859e[_0xc148('0x33')];_0x4e1205[_0xc148('0x3b')]=qs[_0xc148('0x3c')](_0xb0347f[_0xc148('0x34')]['sort']);_0x4e1205['where']=qs['filters'](_[_0xc148('0x4f')](_0xb0347f[_0xc148('0x34')],_0x2c859e['filters']));if(_0xb0347f['query'][_0xc148('0x3e')]){_0x4e1205[_0xc148('0x3f')]=_['merge'](_0x4e1205[_0xc148('0x3f')],{'$or':_['map'](_0x4e1205['attributes'],function(_0x227573){var _0x16e39d={};_0x16e39d[_0x227573]={'$like':'%'+_0xb0347f[_0xc148('0x34')][_0xc148('0x3e')]+'%'};return _0x16e39d;})});}_0x4e1205=_['merge']({},_0x4e1205,_0xb0347f[_0xc148('0x43')]);return _0xf8f8cf['getSubjects'](_0x4e1205);}})['then'](function(_0x1e8891){if(_0x1e8891){_0x1fbc01=_0x1e8891[_0xc148('0x38')];if(!_0xb0347f['query']['hasOwnProperty']('nolimit')){_0x4e1205[_0xc148('0x3a')]=qs['limit'](_0xb0347f[_0xc148('0x34')][_0xc148('0x3a')]);_0x4e1205['offset']=qs[_0xc148('0x28')](_0xb0347f[_0xc148('0x34')][_0xc148('0x28')]);}return _0xf8f8cf[_0xc148('0x52')](_0x4e1205);}})[_0xc148('0x1b')](function(_0x3b2c03){if(_0x3b2c03){return _0x3b2c03?{'count':_0x1fbc01,'rows':_0x3b2c03}:null;}})['then'](respondWithResult(_0x35f9ed,null))[_0xc148('0x23')](handleError(_0x35f9ed,null));};exports[_0xc148('0x54')]=function(_0x2d82fb,_0x3c9bb5,_0x3911d5){var _0x1403f9={};var _0x4c738d={};var _0xf9a2c8;var _0x163b5e;return db[_0xc148('0x30')]['findOne']({'where':{'id':_0x2d82fb[_0xc148('0x48')]['id']}})[_0xc148('0x1b')](handleEntityNotFound(_0x3c9bb5,null))[_0xc148('0x1b')](function(_0x5ea3b3){if(_0x5ea3b3){_0xf9a2c8=_0x5ea3b3;_0x4c738d['model']=_[_0xc148('0x49')](db[_0xc148('0x4e')][_0xc148('0x31')]);_0x4c738d[_0xc148('0x34')]=_[_0xc148('0x49')](_0x2d82fb['query']);_0x4c738d[_0xc148('0x3d')]=_[_0xc148('0x35')](_0x4c738d[_0xc148('0x33')],_0x4c738d['query']);_0x1403f9[_0xc148('0x36')]=_[_0xc148('0x35')](_0x4c738d[_0xc148('0x33')],qs[_0xc148('0x37')](_0x2d82fb[_0xc148('0x34')][_0xc148('0x37')]));_0x1403f9[_0xc148('0x36')]=_0x1403f9[_0xc148('0x36')][_0xc148('0x38')]?_0x1403f9[_0xc148('0x36')]:_0x4c738d[_0xc148('0x33')];_0x1403f9['order']=qs[_0xc148('0x3c')](_0x2d82fb[_0xc148('0x34')][_0xc148('0x3c')]);_0x1403f9[_0xc148('0x3f')]=qs[_0xc148('0x3d')](_[_0xc148('0x4f')](_0x2d82fb[_0xc148('0x34')],_0x4c738d[_0xc148('0x3d')]));if(_0x2d82fb[_0xc148('0x34')][_0xc148('0x3e')]){_0x1403f9[_0xc148('0x3f')]=_[_0xc148('0x42')](_0x1403f9[_0xc148('0x3f')],{'$or':_[_0xc148('0x2f')](_0x1403f9['attributes'],function(_0x25ebe7){var _0x2a2761={};_0x2a2761[_0x25ebe7]={'$like':'%'+_0x2d82fb[_0xc148('0x34')][_0xc148('0x3e')]+'%'};return _0x2a2761;})});}_0x1403f9=_[_0xc148('0x42')]({},_0x1403f9,_0x2d82fb[_0xc148('0x43')]);return _0xf9a2c8[_0xc148('0x54')](_0x1403f9);}})[_0xc148('0x1b')](function(_0x1b6aa9){if(_0x1b6aa9){_0x163b5e=_0x1b6aa9['length'];if(!_0x2d82fb['query'][_0xc148('0x39')]('nolimit')){_0x1403f9[_0xc148('0x3a')]=qs[_0xc148('0x3a')](_0x2d82fb[_0xc148('0x34')][_0xc148('0x3a')]);_0x1403f9['offset']=qs['offset'](_0x2d82fb[_0xc148('0x34')][_0xc148('0x28')]);}return _0xf9a2c8[_0xc148('0x54')](_0x1403f9);}})[_0xc148('0x1b')](function(_0x365390){if(_0x365390){return _0x365390?{'count':_0x163b5e,'rows':_0x365390}:null;}})[_0xc148('0x1b')](respondWithResult(_0x3c9bb5,null))[_0xc148('0x23')](handleError(_0x3c9bb5,null));}; \ No newline at end of file +var _0x03b5=['options','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','request','then','info','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','status','end','count','offset','set','Content-Range','json','apply','reject','update','destroy','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','type','VIRTUAL','merge','findAll','rows','catch','show','keys','includeAll','include','find','create','body','params','getFields','findOne','ServicenowField','pick'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x03b5,0x173));var _0x503b=function(_0x4c1668,_0x2f72a0){_0x4c1668=_0x4c1668-0x0;var _0x3e0833=_0x03b5[_0x4c1668];return _0x3e0833;};'use strict';var pdf=require(_0x503b('0x0'));var emlformat=require(_0x503b('0x1'));var rimraf=require(_0x503b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x503b('0x3'));var rp=require('request-promise');var moment=require(_0x503b('0x4'));var BPromise=require(_0x503b('0x5'));var Mustache=require('mustache');var util=require(_0x503b('0x6'));var path=require(_0x503b('0x7'));var sox=require(_0x503b('0x8'));var csv=require(_0x503b('0x9'));var ejs=require(_0x503b('0xa'));var fs=require('fs');var _=require(_0x503b('0xb'));var squel=require('squel');var crypto=require(_0x503b('0xc'));var jsforce=require(_0x503b('0xd'));var deskjs=require(_0x503b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x503b('0xf'));var Papa=require(_0x503b('0x10'));var Redis=require(_0x503b('0x11'));var authService=require(_0x503b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x503b('0x13'));var hardwareService=require(_0x503b('0x14'));var logger=require(_0x503b('0x15'))(_0x503b('0x16'));var utils=require(_0x503b('0x17'));var config=require(_0x503b('0x18'));var licenseUtil=require(_0x503b('0x19'));var db=require(_0x503b('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x503b('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4546a5,_0x3432fe,_0xce714a,_0x5ad949){return new BPromise(function(_0x393d83,_0x45c544){var _0x5b1903=_0x5ad949||client;return _0x5b1903[_0x503b('0x1c')](_0x4546a5,_0xce714a)[_0x503b('0x1d')](function(_0x4810fc){logger[_0x503b('0x1e')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3432fe,_0x503b('0x1f'));logger['debug'](_0x503b('0x20'),_0x3432fe,_0x503b('0x1f'),JSON[_0x503b('0x21')](_0x4810fc));if(_0x4810fc[_0x503b('0x22')]){if(_0x4810fc[_0x503b('0x22')][_0x503b('0x23')]===0x1f4){logger['error'](_0x503b('0x24'),_0x3432fe,_0x4810fc[_0x503b('0x22')][_0x503b('0x25')]);return _0x45c544(_0x4810fc[_0x503b('0x22')][_0x503b('0x25')]);}logger[_0x503b('0x22')](_0x503b('0x24'),_0x3432fe,_0x4810fc[_0x503b('0x22')][_0x503b('0x25')]);return _0x393d83(_0x4810fc[_0x503b('0x22')][_0x503b('0x25')]);}else{logger[_0x503b('0x1e')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3432fe,_0x503b('0x1f'));_0x393d83(_0x4810fc['result']['message']);}})['catch'](function(_0x565f3f){logger[_0x503b('0x22')](_0x503b('0x24'),_0x3432fe,_0x565f3f);_0x45c544(_0x565f3f);});});}function respondWithStatusCode(_0x4dc1da,_0xee4553){_0xee4553=_0xee4553||0xcc;return function(_0x5bdda9){if(_0x5bdda9){return _0x4dc1da['sendStatus'](_0xee4553);}return _0x4dc1da[_0x503b('0x26')](_0xee4553)[_0x503b('0x27')]();};}function respondWithResult(_0x3a70c4,_0x4def77){_0x4def77=_0x4def77||0xc8;return function(_0x237346){if(_0x237346){return _0x3a70c4[_0x503b('0x26')](_0x4def77)['json'](_0x237346);}};}function respondWithFilteredResult(_0x41ab59,_0x5aa55a){return function(_0x5dc61b){if(_0x5dc61b){var _0x32afe0=_0x5dc61b[_0x503b('0x28')],_0x20269c=_0x5aa55a[_0x503b('0x29')],_0x3da87f=_0x5aa55a['offset']+_0x5aa55a['limit'],_0x3d4e76;if(_0x3da87f>=_0x32afe0){_0x3da87f=_0x32afe0;_0x3d4e76=0xc8;}else{_0x3d4e76=0xce;}_0x41ab59[_0x503b('0x26')](_0x3d4e76);return _0x41ab59[_0x503b('0x2a')](_0x503b('0x2b'),_0x20269c+'-'+_0x3da87f+'/'+_0x32afe0)[_0x503b('0x2c')](_0x5dc61b);}return null;};}function patchUpdates(_0x55fb34){return function(_0x4c3b5f){try{jsonpatch[_0x503b('0x2d')](_0x4c3b5f,_0x55fb34,!![]);}catch(_0x20f158){return BPromise[_0x503b('0x2e')](_0x20f158);}return _0x4c3b5f['save']();};}function saveUpdates(_0xb0a545,_0xf874c2){return function(_0x215550){if(_0x215550){return _0x215550[_0x503b('0x2f')](_0xb0a545)[_0x503b('0x1d')](function(_0xebffcb){return _0xebffcb;});}return null;};}function removeEntity(_0xe25118,_0x47c228){return function(_0x1100bf){if(_0x1100bf){return _0x1100bf[_0x503b('0x30')]()[_0x503b('0x1d')](function(){_0xe25118['status'](0xcc)[_0x503b('0x27')]();});}};}function handleEntityNotFound(_0x36fbe1,_0x2dc03f){return function(_0x5ef3c8){if(!_0x5ef3c8){_0x36fbe1['sendStatus'](0x194);}return _0x5ef3c8;};}function handleError(_0x38467c,_0x2c9095){_0x2c9095=_0x2c9095||0x1f4;return function(_0x231e16){logger[_0x503b('0x22')](_0x231e16['stack']);if(_0x231e16[_0x503b('0x31')]){delete _0x231e16[_0x503b('0x31')];}_0x38467c[_0x503b('0x26')](_0x2c9095)[_0x503b('0x32')](_0x231e16);};}exports[_0x503b('0x33')]=function(_0x37bf1b,_0x2b7be4){var _0x3b640b={},_0x2e362d={},_0x2ebbe4={'count':0x0,'rows':[]};var _0x5bcca9=_['map'](db[_0x503b('0x34')][_0x503b('0x35')],function(_0x2b5374){return{'name':_0x2b5374[_0x503b('0x36')],'type':_0x2b5374['type'][_0x503b('0x37')]};});_0x2e362d[_0x503b('0x38')]=_[_0x503b('0x39')](_0x5bcca9,_0x503b('0x31'));_0x2e362d[_0x503b('0x3a')]=_['keys'](_0x37bf1b[_0x503b('0x3a')]);_0x2e362d['filters']=_[_0x503b('0x3b')](_0x2e362d[_0x503b('0x38')],_0x2e362d['query']);_0x3b640b['attributes']=_[_0x503b('0x3b')](_0x2e362d[_0x503b('0x38')],qs[_0x503b('0x3c')](_0x37bf1b['query']['fields']));_0x3b640b[_0x503b('0x3d')]=_0x3b640b[_0x503b('0x3d')][_0x503b('0x3e')]?_0x3b640b[_0x503b('0x3d')]:_0x2e362d['model'];if(!_0x37bf1b[_0x503b('0x3a')][_0x503b('0x3f')](_0x503b('0x40'))){_0x3b640b[_0x503b('0x41')]=qs[_0x503b('0x41')](_0x37bf1b[_0x503b('0x3a')][_0x503b('0x41')]);_0x3b640b[_0x503b('0x29')]=qs[_0x503b('0x29')](_0x37bf1b[_0x503b('0x3a')][_0x503b('0x29')]);}_0x3b640b[_0x503b('0x42')]=qs[_0x503b('0x43')](_0x37bf1b['query'][_0x503b('0x43')]);_0x3b640b[_0x503b('0x44')]=qs[_0x503b('0x45')](_['pick'](_0x37bf1b['query'],_0x2e362d[_0x503b('0x45')]),_0x5bcca9);if(_0x37bf1b[_0x503b('0x3a')][_0x503b('0x46')]){_0x3b640b['where']=_['merge'](_0x3b640b[_0x503b('0x44')],{'$or':_[_0x503b('0x39')](_0x5bcca9,function(_0x22b63c){if(_0x22b63c[_0x503b('0x47')]!==_0x503b('0x48')){var _0x38e1d5={};_0x38e1d5[_0x22b63c[_0x503b('0x31')]]={'$like':'%'+_0x37bf1b['query'][_0x503b('0x46')]+'%'};return _0x38e1d5;}})});}_0x3b640b=_[_0x503b('0x49')]({},_0x3b640b,_0x37bf1b['options']);var _0x37ebb5={'where':_0x3b640b[_0x503b('0x44')]};return db[_0x503b('0x34')][_0x503b('0x28')](_0x37ebb5)[_0x503b('0x1d')](function(_0x184227){_0x2ebbe4[_0x503b('0x28')]=_0x184227;if(_0x37bf1b[_0x503b('0x3a')]['includeAll']){_0x3b640b['include']=[{'all':!![]}];}return db[_0x503b('0x34')][_0x503b('0x4a')](_0x3b640b);})[_0x503b('0x1d')](function(_0x2053a0){_0x2ebbe4[_0x503b('0x4b')]=_0x2053a0;return _0x2ebbe4;})[_0x503b('0x1d')](respondWithFilteredResult(_0x2b7be4,_0x3b640b))[_0x503b('0x4c')](handleError(_0x2b7be4,null));};exports[_0x503b('0x4d')]=function(_0x4dac8f,_0x3e3965){var _0x5ae9c8={'raw':![],'where':{'id':_0x4dac8f['params']['id']}},_0x39fc5a={};_0x39fc5a['model']=_[_0x503b('0x4e')](db['ServicenowConfiguration'][_0x503b('0x35')]);_0x39fc5a[_0x503b('0x3a')]=_[_0x503b('0x4e')](_0x4dac8f[_0x503b('0x3a')]);_0x39fc5a['filters']=_[_0x503b('0x3b')](_0x39fc5a[_0x503b('0x38')],_0x39fc5a['query']);_0x5ae9c8[_0x503b('0x3d')]=_[_0x503b('0x3b')](_0x39fc5a[_0x503b('0x38')],qs[_0x503b('0x3c')](_0x4dac8f[_0x503b('0x3a')][_0x503b('0x3c')]));_0x5ae9c8[_0x503b('0x3d')]=_0x5ae9c8[_0x503b('0x3d')][_0x503b('0x3e')]?_0x5ae9c8['attributes']:_0x39fc5a[_0x503b('0x38')];if(_0x4dac8f['query'][_0x503b('0x4f')]){_0x5ae9c8[_0x503b('0x50')]=[{'all':!![]}];}_0x5ae9c8=_[_0x503b('0x49')]({},_0x5ae9c8,_0x4dac8f['options']);return db[_0x503b('0x34')][_0x503b('0x51')](_0x5ae9c8)['then'](handleEntityNotFound(_0x3e3965,null))[_0x503b('0x1d')](respondWithResult(_0x3e3965,null))['catch'](handleError(_0x3e3965,null));};exports[_0x503b('0x52')]=function(_0x3b2d14,_0x3c356a){return db[_0x503b('0x34')][_0x503b('0x52')](_0x3b2d14[_0x503b('0x53')],{})['then'](respondWithResult(_0x3c356a,0xc9))[_0x503b('0x4c')](handleError(_0x3c356a,null));};exports[_0x503b('0x2f')]=function(_0x3ab2f3,_0x5f1647){if(_0x3ab2f3['body']['id']){delete _0x3ab2f3[_0x503b('0x53')]['id'];}return db['ServicenowConfiguration'][_0x503b('0x51')]({'where':{'id':_0x3ab2f3[_0x503b('0x54')]['id']}})[_0x503b('0x1d')](handleEntityNotFound(_0x5f1647,null))[_0x503b('0x1d')](saveUpdates(_0x3ab2f3[_0x503b('0x53')],null))[_0x503b('0x1d')](respondWithResult(_0x5f1647,null))[_0x503b('0x4c')](handleError(_0x5f1647,null));};exports['destroy']=function(_0x1c00f0,_0x509bba){return db[_0x503b('0x34')][_0x503b('0x51')]({'where':{'id':_0x1c00f0[_0x503b('0x54')]['id']}})[_0x503b('0x1d')](handleEntityNotFound(_0x509bba,null))['then'](removeEntity(_0x509bba,null))[_0x503b('0x4c')](handleError(_0x509bba,null));};exports[_0x503b('0x55')]=function(_0x5ab1fa,_0x1aefa5,_0x283c5c){var _0x2f6fa2={};var _0x443465={};var _0x5d6add;var _0x3447f0;return db[_0x503b('0x34')][_0x503b('0x56')]({'where':{'id':_0x5ab1fa[_0x503b('0x54')]['id']}})[_0x503b('0x1d')](handleEntityNotFound(_0x1aefa5,null))[_0x503b('0x1d')](function(_0x43b7d2){if(_0x43b7d2){_0x5d6add=_0x43b7d2;_0x443465[_0x503b('0x38')]=_['keys'](db[_0x503b('0x57')][_0x503b('0x35')]);_0x443465[_0x503b('0x3a')]=_['keys'](_0x5ab1fa[_0x503b('0x3a')]);_0x443465[_0x503b('0x45')]=_[_0x503b('0x3b')](_0x443465['model'],_0x443465[_0x503b('0x3a')]);_0x2f6fa2[_0x503b('0x3d')]=_[_0x503b('0x3b')](_0x443465['model'],qs[_0x503b('0x3c')](_0x5ab1fa[_0x503b('0x3a')]['fields']));_0x2f6fa2[_0x503b('0x3d')]=_0x2f6fa2[_0x503b('0x3d')]['length']?_0x2f6fa2['attributes']:_0x443465[_0x503b('0x38')];_0x2f6fa2['order']=qs[_0x503b('0x43')](_0x5ab1fa[_0x503b('0x3a')][_0x503b('0x43')]);_0x2f6fa2[_0x503b('0x44')]=qs[_0x503b('0x45')](_[_0x503b('0x58')](_0x5ab1fa[_0x503b('0x3a')],_0x443465['filters']));if(_0x5ab1fa[_0x503b('0x3a')][_0x503b('0x46')]){_0x2f6fa2[_0x503b('0x44')]=_['merge'](_0x2f6fa2[_0x503b('0x44')],{'$or':_[_0x503b('0x39')](_0x2f6fa2[_0x503b('0x3d')],function(_0x4ab0af){var _0xe13a60={};_0xe13a60[_0x4ab0af]={'$like':'%'+_0x5ab1fa[_0x503b('0x3a')][_0x503b('0x46')]+'%'};return _0xe13a60;})});}_0x2f6fa2=_['merge']({},_0x2f6fa2,_0x5ab1fa[_0x503b('0x59')]);return _0x5d6add[_0x503b('0x55')](_0x2f6fa2);}})[_0x503b('0x1d')](function(_0x540f53){if(_0x540f53){_0x3447f0=_0x540f53[_0x503b('0x3e')];if(!_0x5ab1fa[_0x503b('0x3a')][_0x503b('0x3f')](_0x503b('0x40'))){_0x2f6fa2[_0x503b('0x41')]=qs['limit'](_0x5ab1fa[_0x503b('0x3a')]['limit']);_0x2f6fa2[_0x503b('0x29')]=qs[_0x503b('0x29')](_0x5ab1fa[_0x503b('0x3a')][_0x503b('0x29')]);}return _0x5d6add[_0x503b('0x55')](_0x2f6fa2);}})[_0x503b('0x1d')](function(_0x348d37){if(_0x348d37){return _0x348d37?{'count':_0x3447f0,'rows':_0x348d37}:null;}})['then'](respondWithResult(_0x1aefa5,null))[_0x503b('0x4c')](handleError(_0x1aefa5,null));};exports[_0x503b('0x5a')]=function(_0x39c510,_0x44ae2c,_0x219842){var _0x369cf8={};var _0x213500={};var _0x157bdc;var _0x51a2d7;return db['ServicenowConfiguration'][_0x503b('0x56')]({'where':{'id':_0x39c510[_0x503b('0x54')]['id']}})['then'](handleEntityNotFound(_0x44ae2c,null))[_0x503b('0x1d')](function(_0x502202){if(_0x502202){_0x157bdc=_0x502202;_0x213500[_0x503b('0x38')]=_[_0x503b('0x4e')](db[_0x503b('0x57')]['rawAttributes']);_0x213500['query']=_[_0x503b('0x4e')](_0x39c510[_0x503b('0x3a')]);_0x213500['filters']=_[_0x503b('0x3b')](_0x213500[_0x503b('0x38')],_0x213500['query']);_0x369cf8[_0x503b('0x3d')]=_[_0x503b('0x3b')](_0x213500['model'],qs[_0x503b('0x3c')](_0x39c510[_0x503b('0x3a')][_0x503b('0x3c')]));_0x369cf8[_0x503b('0x3d')]=_0x369cf8[_0x503b('0x3d')]['length']?_0x369cf8[_0x503b('0x3d')]:_0x213500[_0x503b('0x38')];_0x369cf8[_0x503b('0x42')]=qs['sort'](_0x39c510[_0x503b('0x3a')][_0x503b('0x43')]);_0x369cf8[_0x503b('0x44')]=qs[_0x503b('0x45')](_['pick'](_0x39c510[_0x503b('0x3a')],_0x213500['filters']));if(_0x39c510[_0x503b('0x3a')][_0x503b('0x46')]){_0x369cf8[_0x503b('0x44')]=_[_0x503b('0x49')](_0x369cf8[_0x503b('0x44')],{'$or':_['map'](_0x369cf8['attributes'],function(_0x8583d3){var _0x15c8bb={};_0x15c8bb[_0x8583d3]={'$like':'%'+_0x39c510[_0x503b('0x3a')]['filter']+'%'};return _0x15c8bb;})});}_0x369cf8=_[_0x503b('0x49')]({},_0x369cf8,_0x39c510[_0x503b('0x59')]);return _0x157bdc[_0x503b('0x5a')](_0x369cf8);}})['then'](function(_0x249301){if(_0x249301){_0x51a2d7=_0x249301[_0x503b('0x3e')];if(!_0x39c510[_0x503b('0x3a')]['hasOwnProperty'](_0x503b('0x40'))){_0x369cf8[_0x503b('0x41')]=qs[_0x503b('0x41')](_0x39c510[_0x503b('0x3a')][_0x503b('0x41')]);_0x369cf8['offset']=qs['offset'](_0x39c510[_0x503b('0x3a')][_0x503b('0x29')]);}return _0x157bdc[_0x503b('0x5a')](_0x369cf8);}})[_0x503b('0x1d')](function(_0x4eea2d){if(_0x4eea2d){return _0x4eea2d?{'count':_0x51a2d7,'rows':_0x4eea2d}:null;}})[_0x503b('0x1d')](respondWithResult(_0x44ae2c,null))['catch'](handleError(_0x44ae2c,null));};exports[_0x503b('0x5b')]=function(_0x385b73,_0x58f772,_0x1054a1){var _0x3c3eda={};var _0x19616d={};var _0x3f3761;var _0x9dce36;return db[_0x503b('0x34')][_0x503b('0x56')]({'where':{'id':_0x385b73[_0x503b('0x54')]['id']}})[_0x503b('0x1d')](handleEntityNotFound(_0x58f772,null))[_0x503b('0x1d')](function(_0xfe4d47){if(_0xfe4d47){_0x3f3761=_0xfe4d47;_0x19616d[_0x503b('0x38')]=_[_0x503b('0x4e')](db[_0x503b('0x57')][_0x503b('0x35')]);_0x19616d[_0x503b('0x3a')]=_[_0x503b('0x4e')](_0x385b73[_0x503b('0x3a')]);_0x19616d['filters']=_[_0x503b('0x3b')](_0x19616d[_0x503b('0x38')],_0x19616d[_0x503b('0x3a')]);_0x3c3eda[_0x503b('0x3d')]=_['intersection'](_0x19616d[_0x503b('0x38')],qs[_0x503b('0x3c')](_0x385b73['query'][_0x503b('0x3c')]));_0x3c3eda[_0x503b('0x3d')]=_0x3c3eda[_0x503b('0x3d')][_0x503b('0x3e')]?_0x3c3eda[_0x503b('0x3d')]:_0x19616d[_0x503b('0x38')];_0x3c3eda[_0x503b('0x42')]=qs['sort'](_0x385b73[_0x503b('0x3a')][_0x503b('0x43')]);_0x3c3eda[_0x503b('0x44')]=qs[_0x503b('0x45')](_[_0x503b('0x58')](_0x385b73['query'],_0x19616d[_0x503b('0x45')]));if(_0x385b73[_0x503b('0x3a')][_0x503b('0x46')]){_0x3c3eda[_0x503b('0x44')]=_['merge'](_0x3c3eda[_0x503b('0x44')],{'$or':_['map'](_0x3c3eda[_0x503b('0x3d')],function(_0x3ae99c){var _0x13c4d8={};_0x13c4d8[_0x3ae99c]={'$like':'%'+_0x385b73[_0x503b('0x3a')][_0x503b('0x46')]+'%'};return _0x13c4d8;})});}_0x3c3eda=_[_0x503b('0x49')]({},_0x3c3eda,_0x385b73['options']);return _0x3f3761[_0x503b('0x5b')](_0x3c3eda);}})[_0x503b('0x1d')](function(_0x3287fc){if(_0x3287fc){_0x9dce36=_0x3287fc[_0x503b('0x3e')];if(!_0x385b73[_0x503b('0x3a')][_0x503b('0x3f')](_0x503b('0x40'))){_0x3c3eda[_0x503b('0x41')]=qs['limit'](_0x385b73[_0x503b('0x3a')][_0x503b('0x41')]);_0x3c3eda[_0x503b('0x29')]=qs['offset'](_0x385b73[_0x503b('0x3a')]['offset']);}return _0x3f3761['getDescriptions'](_0x3c3eda);}})[_0x503b('0x1d')](function(_0x32d11d){if(_0x32d11d){return _0x32d11d?{'count':_0x9dce36,'rows':_0x32d11d}:null;}})[_0x503b('0x1d')](respondWithResult(_0x58f772,null))[_0x503b('0x4c')](handleError(_0x58f772,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 11d078d..0bcb447 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 _0x87ea=['rimraf','exports','ServicenowConfiguration','util','../../config/logger','api','moment','request-promise','path'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x87ea,0x8a));var _0xa87e=function(_0x37b7b6,_0x165a5c){_0x37b7b6=_0x37b7b6-0x0;var _0x10c4c3=_0x87ea[_0x37b7b6];return _0x10c4c3;};'use strict';var _=require('lodash');var util=require(_0xa87e('0x0'));var logger=require(_0xa87e('0x1'))(_0xa87e('0x2'));var moment=require(_0xa87e('0x3'));var BPromise=require('bluebird');var rp=require(_0xa87e('0x4'));var fs=require('fs');var path=require(_0xa87e('0x5'));var rimraf=require(_0xa87e('0x6'));var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module[_0xa87e('0x7')]=function(_0x3bd7bb,_0x409ad0){return _0x3bd7bb['define'](_0xa87e('0x8'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9027=['../../config/logger','moment','request-promise','path','../../config/environment','./intServicenowConfiguration.attributes','define','int_servicenow_configurations'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x9027,0xe0));var _0x7902=function(_0x347611,_0x3dffff){_0x347611=_0x347611-0x0;var _0x257f22=_0x9027[_0x347611];return _0x257f22;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7902('0x0'))('api');var moment=require(_0x7902('0x1'));var BPromise=require('bluebird');var rp=require(_0x7902('0x2'));var fs=require('fs');var path=require(_0x7902('0x3'));var rimraf=require('rimraf');var config=require(_0x7902('0x4'));var attributes=require(_0x7902('0x5'));module['exports']=function(_0x36f2ef,_0xcac7e0){return _0x36f2ef[_0x7902('0x6')]('ServicenowConfiguration',attributes,{'tableName':_0x7902('0x7'),'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 65bc816..66f4206 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 _0x4617=['info','ServicenowConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x221054,_0x144661){var _0x2bb1e7=function(_0x54ae15){while(--_0x54ae15){_0x221054['push'](_0x221054['shift']());}};_0x2bb1e7(++_0x144661);}(_0x4617,0x163));var _0x7461=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x4617[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0x7461('0x0'));var util=require(_0x7461('0x1'));var moment=require(_0x7461('0x2'));var BPromise=require(_0x7461('0x3'));var rs=require(_0x7461('0x4'));var fs=require('fs');var Redis=require(_0x7461('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7461('0x6'));var logger=require(_0x7461('0x7'))(_0x7461('0x8'));var config=require(_0x7461('0x9'));var jayson=require(_0x7461('0xa'));var client=jayson[_0x7461('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d1d23,_0x2406ef,_0xe614f){return new BPromise(function(_0x2aafa6,_0x3e01da){return client[_0x7461('0xc')](_0x2d1d23,_0xe614f)['then'](function(_0x436ac5){logger[_0x7461('0xd')](_0x7461('0xe'),_0x2406ef,'request\x20sent');logger[_0x7461('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x2406ef,_0x7461('0x10'),JSON[_0x7461('0x11')](_0x436ac5));if(_0x436ac5['error']){if(_0x436ac5['error'][_0x7461('0x12')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x2406ef,_0x436ac5[_0x7461('0x13')][_0x7461('0x14')]);return _0x3e01da(_0x436ac5['error']['message']);}logger[_0x7461('0x13')]('ServicenowConfiguration,\x20%s,\x20%s',_0x2406ef,_0x436ac5[_0x7461('0x13')][_0x7461('0x14')]);return _0x2aafa6(_0x436ac5[_0x7461('0x13')]['message']);}else{logger[_0x7461('0xd')](_0x7461('0xe'),_0x2406ef,_0x7461('0x10'));_0x2aafa6(_0x436ac5[_0x7461('0x15')][_0x7461('0x14')]);}})[_0x7461('0x16')](function(_0x3a0fe){logger[_0x7461('0x13')](_0x7461('0xe'),_0x2406ef,_0x3a0fe);_0x3e01da(_0x3a0fe);});});} \ No newline at end of file +var _0xfaae=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x270323,_0x72160){var _0x48a027=function(_0x4cb12e){while(--_0x4cb12e){_0x270323['push'](_0x270323['shift']());}};_0x48a027(++_0x72160);}(_0xfaae,0x11b));var _0xefaa=function(_0x4e7c33,_0x4d8849){_0x4e7c33=_0x4e7c33-0x0;var _0x26778c=_0xfaae[_0x4e7c33];return _0x26778c;};'use strict';var _=require(_0xefaa('0x0'));var util=require(_0xefaa('0x1'));var moment=require(_0xefaa('0x2'));var BPromise=require(_0xefaa('0x3'));var rs=require(_0xefaa('0x4'));var fs=require('fs');var Redis=require(_0xefaa('0x5'));var db=require(_0xefaa('0x6'))['db'];var utils=require(_0xefaa('0x7'));var logger=require('../../config/logger')(_0xefaa('0x8'));var config=require(_0xefaa('0x9'));var jayson=require(_0xefaa('0xa'));var client=jayson[_0xefaa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a496b,_0x421b5b,_0x43aa7b){return new BPromise(function(_0x1ff128,_0x569ded){return client['request'](_0x5a496b,_0x43aa7b)[_0xefaa('0xc')](function(_0x5cd572){logger['info'](_0xefaa('0xd'),_0x421b5b,_0xefaa('0xe'));logger[_0xefaa('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x421b5b,_0xefaa('0xe'),JSON[_0xefaa('0x10')](_0x5cd572));if(_0x5cd572[_0xefaa('0x11')]){if(_0x5cd572[_0xefaa('0x11')][_0xefaa('0x12')]===0x1f4){logger[_0xefaa('0x11')](_0xefaa('0xd'),_0x421b5b,_0x5cd572[_0xefaa('0x11')][_0xefaa('0x13')]);return _0x569ded(_0x5cd572[_0xefaa('0x11')][_0xefaa('0x13')]);}logger[_0xefaa('0x11')](_0xefaa('0xd'),_0x421b5b,_0x5cd572[_0xefaa('0x11')][_0xefaa('0x13')]);return _0x1ff128(_0x5cd572[_0xefaa('0x11')][_0xefaa('0x13')]);}else{logger[_0xefaa('0x14')](_0xefaa('0xd'),_0x421b5b,_0xefaa('0xe'));_0x1ff128(_0x5cd572[_0xefaa('0x15')][_0xefaa('0x13')]);}})[_0xefaa('0x16')](function(_0x1a2e48){logger['error'](_0xefaa('0xd'),_0x421b5b,_0x1a2e48);_0x569ded(_0x1a2e48);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index aa9c6a9..74a9d0d 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 _0x6037=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports'];(function(_0xd98a91,_0x4f429f){var _0x20a2c7=function(_0x73b9b){while(--_0x73b9b){_0xd98a91['push'](_0xd98a91['shift']());}};_0x20a2c7(++_0x4f429f);}(_0x6037,0xea));var _0x7603=function(_0x1ca316,_0x1280be){_0x1ca316=_0x1ca316-0x0;var _0x29f476=_0x6037[_0x1ca316];return _0x29f476;};'use strict';var multer=require('multer');var util=require(_0x7603('0x0'));var path=require(_0x7603('0x1'));var timeout=require(_0x7603('0x2'));var express=require(_0x7603('0x3'));var router=express[_0x7603('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7603('0x5'));var config=require(_0x7603('0x6'));var controller=require('./intServicenowField.controller');router[_0x7603('0x7')]('/',auth['isAuthenticated'](),controller[_0x7603('0x8')]);router[_0x7603('0x7')](_0x7603('0x9'),auth[_0x7603('0xa')](),controller['show']);router[_0x7603('0xb')]('/',auth['isAuthenticated'](),controller[_0x7603('0xc')]);router[_0x7603('0xd')](_0x7603('0x9'),auth[_0x7603('0xa')](),controller[_0x7603('0xe')]);router[_0x7603('0xf')](_0x7603('0x9'),auth['isAuthenticated'](),controller[_0x7603('0x10')]);module[_0x7603('0x11')]=router; \ No newline at end of file +var _0xb7fe=['delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create'];(function(_0x511988,_0x1622f8){var _0x3cae6d=function(_0x408dc5){while(--_0x408dc5){_0x511988['push'](_0x511988['shift']());}};_0x3cae6d(++_0x1622f8);}(_0xb7fe,0x193));var _0xeb7f=function(_0x3ef844,_0x5a3e25){_0x3ef844=_0x3ef844-0x0;var _0x5858d4=_0xb7fe[_0x3ef844];return _0x5858d4;};'use strict';var multer=require(_0xeb7f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xeb7f('0x1'));var express=require(_0xeb7f('0x2'));var router=express[_0xeb7f('0x3')]();var auth=require(_0xeb7f('0x4'));var interaction=require(_0xeb7f('0x5'));var config=require(_0xeb7f('0x6'));var controller=require('./intServicenowField.controller');router[_0xeb7f('0x7')]('/',auth[_0xeb7f('0x8')](),controller[_0xeb7f('0x9')]);router[_0xeb7f('0x7')](_0xeb7f('0xa'),auth[_0xeb7f('0x8')](),controller['show']);router[_0xeb7f('0xb')]('/',auth[_0xeb7f('0x8')](),controller[_0xeb7f('0xc')]);router['put'](_0xeb7f('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xeb7f('0xd')](_0xeb7f('0xa'),auth[_0xeb7f('0x8')](),controller[_0xeb7f('0xe')]);module[_0xeb7f('0xf')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index f3a2968..563f084 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 _0x5fd1=['variable','picklist','STRING','customVariable','BOOLEAN','sequelize','ENUM','string'];(function(_0xcd389e,_0xaa53b4){var _0x3bef5c=function(_0x4b54fb){while(--_0x4b54fb){_0xcd389e['push'](_0xcd389e['shift']());}};_0x3bef5c(++_0xaa53b4);}(_0x5fd1,0x155));var _0x15fd=function(_0xfa4104,_0xaf200c){_0xfa4104=_0xfa4104-0x0;var _0x34e2e9=_0x5fd1[_0xfa4104];return _0x34e2e9;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'type':{'type':Sequelize[_0x15fd('0x1')](_0x15fd('0x2'),_0x15fd('0x3'),'customVariable','keyValue',_0x15fd('0x4')),'defaultValue':_0x15fd('0x2')},'content':{'type':Sequelize[_0x15fd('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x15fd('0x1')](_0x15fd('0x2'),_0x15fd('0x3'),_0x15fd('0x6'))},'keyContent':{'type':Sequelize[_0x15fd('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x15fd('0x5')]},'customField':{'type':Sequelize[_0x15fd('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x15fd('0x5')]}}; \ No newline at end of file +var _0x5162=['STRING','ENUM','BOOLEAN','sequelize','customVariable','keyValue','picklist','string'];(function(_0x1a463d,_0x26e5fa){var _0x1f6ab3=function(_0xbfd732){while(--_0xbfd732){_0x1a463d['push'](_0x1a463d['shift']());}};_0x1f6ab3(++_0x26e5fa);}(_0x5162,0x103));var _0x2516=function(_0x29d87d,_0x23dc31){_0x29d87d=_0x29d87d-0x0;var _0x1fd84b=_0x5162[_0x29d87d];return _0x1fd84b;};'use strict';var Sequelize=require(_0x2516('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0x2516('0x1'),_0x2516('0x2'),_0x2516('0x3')),'defaultValue':_0x2516('0x4')},'content':{'type':Sequelize[_0x2516('0x5')]},'key':{'type':Sequelize[_0x2516('0x5')]},'keyType':{'type':Sequelize[_0x2516('0x6')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x2516('0x5')]},'idField':{'type':Sequelize[_0x2516('0x5')]},'nameField':{'type':Sequelize[_0x2516('0x5')]},'customField':{'type':Sequelize[_0x2516('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2516('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index cdb0796..c1d19e1 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 _0x3eae=['stack','name','send','map','ServicenowField','rawAttributes','type','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','intersection','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0x2598b3,_0x1cc0a8){var _0x55607f=function(_0x3b37fd){while(--_0x3b37fd){_0x2598b3['push'](_0x2598b3['shift']());}};_0x55607f(++_0x1cc0a8);}(_0x3eae,0x66));var _0xe3ea=function(_0x575057,_0x14baf3){_0x575057=_0x575057-0x0;var _0x49dbc8=_0x3eae[_0x575057];return _0x49dbc8;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe3ea('0x0'));var zipdir=require(_0xe3ea('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe3ea('0x2'));var moment=require(_0xe3ea('0x3'));var BPromise=require(_0xe3ea('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe3ea('0x5'));var sox=require(_0xe3ea('0x6'));var csv=require('to-csv');var ejs=require(_0xe3ea('0x7'));var fs=require('fs');var _=require(_0xe3ea('0x8'));var squel=require('squel');var crypto=require(_0xe3ea('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xe3ea('0xa'));var toCsv=require(_0xe3ea('0xb'));var querystring=require(_0xe3ea('0xc'));var Papa=require('papaparse');var Redis=require(_0xe3ea('0xd'));var authService=require(_0xe3ea('0xe'));var qs=require(_0xe3ea('0xf'));var as=require(_0xe3ea('0x10'));var hardwareService=require(_0xe3ea('0x11'));var logger=require(_0xe3ea('0x12'))(_0xe3ea('0x13'));var utils=require(_0xe3ea('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe3ea('0x15'))['db'];function respondWithStatusCode(_0x6a9294,_0x36c2dd){_0x36c2dd=_0x36c2dd||0xcc;return function(_0x247139){if(_0x247139){return _0x6a9294[_0xe3ea('0x16')](_0x36c2dd);}return _0x6a9294[_0xe3ea('0x17')](_0x36c2dd)[_0xe3ea('0x18')]();};}function respondWithResult(_0x2b36ec,_0x31357a){_0x31357a=_0x31357a||0xc8;return function(_0x11f560){if(_0x11f560){return _0x2b36ec[_0xe3ea('0x17')](_0x31357a)[_0xe3ea('0x19')](_0x11f560);}};}function respondWithFilteredResult(_0x445775,_0x492c29){return function(_0x3c3700){if(_0x3c3700){var _0x2a086a=_0x3c3700[_0xe3ea('0x1a')],_0x1d686c=_0x492c29[_0xe3ea('0x1b')],_0x6f5ab2=_0x492c29[_0xe3ea('0x1b')]+_0x492c29[_0xe3ea('0x1c')],_0x3d12be;if(_0x6f5ab2>=_0x2a086a){_0x6f5ab2=_0x2a086a;_0x3d12be=0xc8;}else{_0x3d12be=0xce;}_0x445775[_0xe3ea('0x17')](_0x3d12be);return _0x445775[_0xe3ea('0x1d')](_0xe3ea('0x1e'),_0x1d686c+'-'+_0x6f5ab2+'/'+_0x2a086a)[_0xe3ea('0x19')](_0x3c3700);}return null;};}function patchUpdates(_0x2bc16c){return function(_0x2a397b){try{jsonpatch[_0xe3ea('0x1f')](_0x2a397b,_0x2bc16c,!![]);}catch(_0x1280be){return BPromise[_0xe3ea('0x20')](_0x1280be);}return _0x2a397b[_0xe3ea('0x21')]();};}function saveUpdates(_0x29e32e,_0xd61c1c){return function(_0x339d08){if(_0x339d08){return _0x339d08[_0xe3ea('0x22')](_0x29e32e)[_0xe3ea('0x23')](function(_0x2462c4){return _0x2462c4;});}return null;};}function removeEntity(_0x4a537d,_0x5ed42a){return function(_0x4f0e9e){if(_0x4f0e9e){return _0x4f0e9e[_0xe3ea('0x24')]()['then'](function(){_0x4a537d['status'](0xcc)[_0xe3ea('0x18')]();});}};}function handleEntityNotFound(_0x19dd53,_0x4cda82){return function(_0x3766eb){if(!_0x3766eb){_0x19dd53[_0xe3ea('0x16')](0x194);}return _0x3766eb;};}function handleError(_0x594ba1,_0xd023cc){_0xd023cc=_0xd023cc||0x1f4;return function(_0x4bb839){logger[_0xe3ea('0x25')](_0x4bb839[_0xe3ea('0x26')]);if(_0x4bb839[_0xe3ea('0x27')]){delete _0x4bb839['name'];}_0x594ba1[_0xe3ea('0x17')](_0xd023cc)[_0xe3ea('0x28')](_0x4bb839);};}exports['index']=function(_0x522a3f,_0x5518d3){var _0x5bd356={},_0x58e3ff={},_0x5f1eff={'count':0x0,'rows':[]};var _0x3accb1=_[_0xe3ea('0x29')](db[_0xe3ea('0x2a')][_0xe3ea('0x2b')],function(_0x5395fa){return{'name':_0x5395fa['fieldName'],'type':_0x5395fa[_0xe3ea('0x2c')]['key']};});_0x58e3ff[_0xe3ea('0x2d')]=_[_0xe3ea('0x29')](_0x3accb1,_0xe3ea('0x27'));_0x58e3ff['query']=_['keys'](_0x522a3f[_0xe3ea('0x2e')]);_0x58e3ff[_0xe3ea('0x2f')]=_['intersection'](_0x58e3ff[_0xe3ea('0x2d')],_0x58e3ff[_0xe3ea('0x2e')]);_0x5bd356[_0xe3ea('0x30')]=_['intersection'](_0x58e3ff[_0xe3ea('0x2d')],qs[_0xe3ea('0x31')](_0x522a3f['query'][_0xe3ea('0x31')]));_0x5bd356[_0xe3ea('0x30')]=_0x5bd356[_0xe3ea('0x30')][_0xe3ea('0x32')]?_0x5bd356[_0xe3ea('0x30')]:_0x58e3ff[_0xe3ea('0x2d')];if(!_0x522a3f[_0xe3ea('0x2e')][_0xe3ea('0x33')](_0xe3ea('0x34'))){_0x5bd356['limit']=qs['limit'](_0x522a3f[_0xe3ea('0x2e')][_0xe3ea('0x1c')]);_0x5bd356[_0xe3ea('0x1b')]=qs[_0xe3ea('0x1b')](_0x522a3f[_0xe3ea('0x2e')][_0xe3ea('0x1b')]);}_0x5bd356['order']=qs['sort'](_0x522a3f[_0xe3ea('0x2e')][_0xe3ea('0x35')]);_0x5bd356[_0xe3ea('0x36')]=qs[_0xe3ea('0x2f')](_[_0xe3ea('0x37')](_0x522a3f[_0xe3ea('0x2e')],_0x58e3ff[_0xe3ea('0x2f')]),_0x3accb1);if(_0x522a3f[_0xe3ea('0x2e')][_0xe3ea('0x38')]){_0x5bd356[_0xe3ea('0x36')]=_['merge'](_0x5bd356[_0xe3ea('0x36')],{'$or':_[_0xe3ea('0x29')](_0x3accb1,function(_0x24c06b){if(_0x24c06b['type']!=='VIRTUAL'){var _0x4f1300={};_0x4f1300[_0x24c06b[_0xe3ea('0x27')]]={'$like':'%'+_0x522a3f[_0xe3ea('0x2e')]['filter']+'%'};return _0x4f1300;}})});}_0x5bd356=_[_0xe3ea('0x39')]({},_0x5bd356,_0x522a3f[_0xe3ea('0x3a')]);var _0x1823d5={'where':_0x5bd356['where']};return db[_0xe3ea('0x2a')][_0xe3ea('0x1a')](_0x1823d5)[_0xe3ea('0x23')](function(_0x3a3b6c){_0x5f1eff['count']=_0x3a3b6c;if(_0x522a3f[_0xe3ea('0x2e')][_0xe3ea('0x3b')]){_0x5bd356[_0xe3ea('0x3c')]=[{'all':!![]}];}return db['ServicenowField'][_0xe3ea('0x3d')](_0x5bd356);})[_0xe3ea('0x23')](function(_0x16e150){_0x5f1eff[_0xe3ea('0x3e')]=_0x16e150;return _0x5f1eff;})[_0xe3ea('0x23')](respondWithFilteredResult(_0x5518d3,_0x5bd356))[_0xe3ea('0x3f')](handleError(_0x5518d3,null));};exports['show']=function(_0x420f56,_0x50bc87){var _0x90a15b={'raw':!![],'where':{'id':_0x420f56[_0xe3ea('0x40')]['id']}},_0x899be6={};_0x899be6['model']=_[_0xe3ea('0x41')](db['ServicenowField'][_0xe3ea('0x2b')]);_0x899be6[_0xe3ea('0x2e')]=_[_0xe3ea('0x41')](_0x420f56['query']);_0x899be6['filters']=_[_0xe3ea('0x42')](_0x899be6['model'],_0x899be6[_0xe3ea('0x2e')]);_0x90a15b['attributes']=_[_0xe3ea('0x42')](_0x899be6[_0xe3ea('0x2d')],qs[_0xe3ea('0x31')](_0x420f56[_0xe3ea('0x2e')][_0xe3ea('0x31')]));_0x90a15b[_0xe3ea('0x30')]=_0x90a15b['attributes'][_0xe3ea('0x32')]?_0x90a15b[_0xe3ea('0x30')]:_0x899be6[_0xe3ea('0x2d')];if(_0x420f56[_0xe3ea('0x2e')][_0xe3ea('0x3b')]){_0x90a15b['include']=[{'all':!![]}];}_0x90a15b=_[_0xe3ea('0x39')]({},_0x90a15b,_0x420f56[_0xe3ea('0x3a')]);return db[_0xe3ea('0x2a')][_0xe3ea('0x43')](_0x90a15b)[_0xe3ea('0x23')](handleEntityNotFound(_0x50bc87,null))['then'](respondWithResult(_0x50bc87,null))[_0xe3ea('0x3f')](handleError(_0x50bc87,null));};exports['create']=function(_0x150c67,_0x5c8ed6){return db[_0xe3ea('0x2a')][_0xe3ea('0x44')](_0x150c67['body'],{})['then'](respondWithResult(_0x5c8ed6,0xc9))[_0xe3ea('0x3f')](handleError(_0x5c8ed6,null));};exports['update']=function(_0x5806fd,_0x542996){if(_0x5806fd[_0xe3ea('0x45')]['id']){delete _0x5806fd[_0xe3ea('0x45')]['id'];}return db[_0xe3ea('0x2a')]['find']({'where':{'id':_0x5806fd[_0xe3ea('0x40')]['id']}})[_0xe3ea('0x23')](handleEntityNotFound(_0x542996,null))[_0xe3ea('0x23')](saveUpdates(_0x5806fd['body'],null))[_0xe3ea('0x23')](respondWithResult(_0x542996,null))['catch'](handleError(_0x542996,null));};exports[_0xe3ea('0x24')]=function(_0x39bfb9,_0x13871e){return db[_0xe3ea('0x2a')]['find']({'where':{'id':_0x39bfb9[_0xe3ea('0x40')]['id']}})[_0xe3ea('0x23')](handleEntityNotFound(_0x13871e,null))[_0xe3ea('0x23')](removeEntity(_0x13871e,null))[_0xe3ea('0x3f')](handleError(_0x13871e,null));}; \ No newline at end of file +var _0xa095=['set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','rows','show','params','catch','create','body','find','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','count','offset'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa095,0x7c));var _0x5a09=function(_0x52ece1,_0x425dc5){_0x52ece1=_0x52ece1-0x0;var _0x329205=_0xa095[_0x52ece1];return _0x329205;};'use strict';var pdf=require(_0x5a09('0x0'));var emlformat=require(_0x5a09('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5a09('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5a09('0x3'));var moment=require(_0x5a09('0x4'));var BPromise=require(_0x5a09('0x5'));var Mustache=require(_0x5a09('0x6'));var util=require('util');var path=require(_0x5a09('0x7'));var sox=require(_0x5a09('0x8'));var csv=require(_0x5a09('0x9'));var ejs=require(_0x5a09('0xa'));var fs=require('fs');var _=require(_0x5a09('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5a09('0xc'));var toCsv=require(_0x5a09('0x9'));var querystring=require(_0x5a09('0xd'));var Papa=require(_0x5a09('0xe'));var Redis=require(_0x5a09('0xf'));var authService=require(_0x5a09('0x10'));var qs=require(_0x5a09('0x11'));var as=require(_0x5a09('0x12'));var hardwareService=require(_0x5a09('0x13'));var logger=require(_0x5a09('0x14'))(_0x5a09('0x15'));var utils=require(_0x5a09('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5a09('0x17'));var db=require(_0x5a09('0x18'))['db'];function respondWithStatusCode(_0xec677d,_0x49045e){_0x49045e=_0x49045e||0xcc;return function(_0x4706c4){if(_0x4706c4){return _0xec677d['sendStatus'](_0x49045e);}return _0xec677d[_0x5a09('0x19')](_0x49045e)[_0x5a09('0x1a')]();};}function respondWithResult(_0x2f22df,_0x2bf0a5){_0x2bf0a5=_0x2bf0a5||0xc8;return function(_0x36045d){if(_0x36045d){return _0x2f22df['status'](_0x2bf0a5)[_0x5a09('0x1b')](_0x36045d);}};}function respondWithFilteredResult(_0x23d47c,_0x10e59d){return function(_0x1cb5c0){if(_0x1cb5c0){var _0x460d30=_0x1cb5c0[_0x5a09('0x1c')],_0x245af7=_0x10e59d['offset'],_0x2398c5=_0x10e59d[_0x5a09('0x1d')]+_0x10e59d['limit'],_0x477977;if(_0x2398c5>=_0x460d30){_0x2398c5=_0x460d30;_0x477977=0xc8;}else{_0x477977=0xce;}_0x23d47c[_0x5a09('0x19')](_0x477977);return _0x23d47c[_0x5a09('0x1e')](_0x5a09('0x1f'),_0x245af7+'-'+_0x2398c5+'/'+_0x460d30)[_0x5a09('0x1b')](_0x1cb5c0);}return null;};}function patchUpdates(_0x6ebf91){return function(_0x224618){try{jsonpatch[_0x5a09('0x20')](_0x224618,_0x6ebf91,!![]);}catch(_0xaf3bbe){return BPromise[_0x5a09('0x21')](_0xaf3bbe);}return _0x224618['save']();};}function saveUpdates(_0x4d9189,_0x5eb523){return function(_0x4d0767){if(_0x4d0767){return _0x4d0767[_0x5a09('0x22')](_0x4d9189)['then'](function(_0x58bd32){return _0x58bd32;});}return null;};}function removeEntity(_0x24f5ba,_0x4f6842){return function(_0x4784b1){if(_0x4784b1){return _0x4784b1[_0x5a09('0x23')]()[_0x5a09('0x24')](function(){_0x24f5ba[_0x5a09('0x19')](0xcc)[_0x5a09('0x1a')]();});}};}function handleEntityNotFound(_0x116ef0,_0x17e3f7){return function(_0x195435){if(!_0x195435){_0x116ef0[_0x5a09('0x25')](0x194);}return _0x195435;};}function handleError(_0x35c242,_0x437d9d){_0x437d9d=_0x437d9d||0x1f4;return function(_0x542d97){logger[_0x5a09('0x26')](_0x542d97[_0x5a09('0x27')]);if(_0x542d97[_0x5a09('0x28')]){delete _0x542d97['name'];}_0x35c242[_0x5a09('0x19')](_0x437d9d)['send'](_0x542d97);};}exports[_0x5a09('0x29')]=function(_0x2cc527,_0x3deeb2){var _0x1269f1={},_0x946242={},_0x19aa35={'count':0x0,'rows':[]};var _0x3dc78a=_[_0x5a09('0x2a')](db[_0x5a09('0x2b')][_0x5a09('0x2c')],function(_0x55d773){return{'name':_0x55d773[_0x5a09('0x2d')],'type':_0x55d773[_0x5a09('0x2e')][_0x5a09('0x2f')]};});_0x946242[_0x5a09('0x30')]=_[_0x5a09('0x2a')](_0x3dc78a,'name');_0x946242[_0x5a09('0x31')]=_[_0x5a09('0x32')](_0x2cc527[_0x5a09('0x31')]);_0x946242[_0x5a09('0x33')]=_[_0x5a09('0x34')](_0x946242['model'],_0x946242[_0x5a09('0x31')]);_0x1269f1[_0x5a09('0x35')]=_[_0x5a09('0x34')](_0x946242[_0x5a09('0x30')],qs[_0x5a09('0x36')](_0x2cc527[_0x5a09('0x31')][_0x5a09('0x36')]));_0x1269f1[_0x5a09('0x35')]=_0x1269f1['attributes'][_0x5a09('0x37')]?_0x1269f1['attributes']:_0x946242[_0x5a09('0x30')];if(!_0x2cc527['query'][_0x5a09('0x38')](_0x5a09('0x39'))){_0x1269f1['limit']=qs[_0x5a09('0x3a')](_0x2cc527[_0x5a09('0x31')]['limit']);_0x1269f1['offset']=qs['offset'](_0x2cc527[_0x5a09('0x31')][_0x5a09('0x1d')]);}_0x1269f1[_0x5a09('0x3b')]=qs[_0x5a09('0x3c')](_0x2cc527[_0x5a09('0x31')][_0x5a09('0x3c')]);_0x1269f1['where']=qs[_0x5a09('0x33')](_[_0x5a09('0x3d')](_0x2cc527[_0x5a09('0x31')],_0x946242['filters']),_0x3dc78a);if(_0x2cc527[_0x5a09('0x31')][_0x5a09('0x3e')]){_0x1269f1['where']=_[_0x5a09('0x3f')](_0x1269f1['where'],{'$or':_['map'](_0x3dc78a,function(_0x17e9c1){if(_0x17e9c1[_0x5a09('0x2e')]!==_0x5a09('0x40')){var _0x4c11ab={};_0x4c11ab[_0x17e9c1[_0x5a09('0x28')]]={'$like':'%'+_0x2cc527[_0x5a09('0x31')][_0x5a09('0x3e')]+'%'};return _0x4c11ab;}})});}_0x1269f1=_['merge']({},_0x1269f1,_0x2cc527[_0x5a09('0x41')]);var _0x441403={'where':_0x1269f1[_0x5a09('0x42')]};return db[_0x5a09('0x2b')][_0x5a09('0x1c')](_0x441403)['then'](function(_0x19d8c1){_0x19aa35['count']=_0x19d8c1;if(_0x2cc527[_0x5a09('0x31')][_0x5a09('0x43')]){_0x1269f1[_0x5a09('0x44')]=[{'all':!![]}];}return db[_0x5a09('0x2b')][_0x5a09('0x45')](_0x1269f1);})[_0x5a09('0x24')](function(_0x39061a){_0x19aa35[_0x5a09('0x46')]=_0x39061a;return _0x19aa35;})[_0x5a09('0x24')](respondWithFilteredResult(_0x3deeb2,_0x1269f1))['catch'](handleError(_0x3deeb2,null));};exports[_0x5a09('0x47')]=function(_0x4afbe8,_0x5603dc){var _0x22be66={'raw':!![],'where':{'id':_0x4afbe8[_0x5a09('0x48')]['id']}},_0x3f52c3={};_0x3f52c3['model']=_[_0x5a09('0x32')](db['ServicenowField'][_0x5a09('0x2c')]);_0x3f52c3['query']=_[_0x5a09('0x32')](_0x4afbe8[_0x5a09('0x31')]);_0x3f52c3[_0x5a09('0x33')]=_['intersection'](_0x3f52c3['model'],_0x3f52c3[_0x5a09('0x31')]);_0x22be66[_0x5a09('0x35')]=_['intersection'](_0x3f52c3['model'],qs[_0x5a09('0x36')](_0x4afbe8[_0x5a09('0x31')]['fields']));_0x22be66[_0x5a09('0x35')]=_0x22be66[_0x5a09('0x35')]['length']?_0x22be66[_0x5a09('0x35')]:_0x3f52c3[_0x5a09('0x30')];if(_0x4afbe8[_0x5a09('0x31')][_0x5a09('0x43')]){_0x22be66[_0x5a09('0x44')]=[{'all':!![]}];}_0x22be66=_[_0x5a09('0x3f')]({},_0x22be66,_0x4afbe8[_0x5a09('0x41')]);return db[_0x5a09('0x2b')]['find'](_0x22be66)[_0x5a09('0x24')](handleEntityNotFound(_0x5603dc,null))[_0x5a09('0x24')](respondWithResult(_0x5603dc,null))[_0x5a09('0x49')](handleError(_0x5603dc,null));};exports[_0x5a09('0x4a')]=function(_0x5a6ef2,_0x1a706b){return db[_0x5a09('0x2b')][_0x5a09('0x4a')](_0x5a6ef2['body'],{})[_0x5a09('0x24')](respondWithResult(_0x1a706b,0xc9))[_0x5a09('0x49')](handleError(_0x1a706b,null));};exports[_0x5a09('0x22')]=function(_0x52364a,_0x1b5cf4){if(_0x52364a[_0x5a09('0x4b')]['id']){delete _0x52364a[_0x5a09('0x4b')]['id'];}return db[_0x5a09('0x2b')][_0x5a09('0x4c')]({'where':{'id':_0x52364a[_0x5a09('0x48')]['id']}})[_0x5a09('0x24')](handleEntityNotFound(_0x1b5cf4,null))[_0x5a09('0x24')](saveUpdates(_0x52364a[_0x5a09('0x4b')],null))[_0x5a09('0x24')](respondWithResult(_0x1b5cf4,null))['catch'](handleError(_0x1b5cf4,null));};exports['destroy']=function(_0x3ada4a,_0x1f803f){return db['ServicenowField'][_0x5a09('0x4c')]({'where':{'id':_0x3ada4a[_0x5a09('0x48')]['id']}})['then'](handleEntityNotFound(_0x1f803f,null))[_0x5a09('0x24')](removeEntity(_0x1f803f,null))['catch'](handleError(_0x1f803f,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index c736ca0..1aa0033 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 _0x0958=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowField.attributes','int_servicenow_fields','servicenow_unique_index','FieldId','lodash'];(function(_0x1c12ba,_0x15bf45){var _0x2f9c6d=function(_0x568fe3){while(--_0x568fe3){_0x1c12ba['push'](_0x1c12ba['shift']());}};_0x2f9c6d(++_0x15bf45);}(_0x0958,0xcf));var _0x8095=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0958[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x8095('0x0'));var util=require(_0x8095('0x1'));var logger=require(_0x8095('0x2'))(_0x8095('0x3'));var moment=require(_0x8095('0x4'));var BPromise=require(_0x8095('0x5'));var rp=require(_0x8095('0x6'));var fs=require('fs');var path=require(_0x8095('0x7'));var rimraf=require('rimraf');var config=require(_0x8095('0x8'));var attributes=require(_0x8095('0x9'));module['exports']=function(_0x41b13f,_0x3665fa){return _0x41b13f['define']('ServicenowField',attributes,{'tableName':_0x8095('0xa'),'paranoid':![],'indexes':[{'name':_0x8095('0xb'),'fields':['idField',_0x8095('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x69e2=['define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','lodash','util','api','moment','bluebird','request-promise','path','./intServicenowField.attributes'];(function(_0x24aba3,_0xc99251){var _0x341477=function(_0x496d68){while(--_0x496d68){_0x24aba3['push'](_0x24aba3['shift']());}};_0x341477(++_0xc99251);}(_0x69e2,0x14a));var _0x269e=function(_0x526628,_0x447131){_0x526628=_0x526628-0x0;var _0x175e90=_0x69e2[_0x526628];return _0x175e90;};'use strict';var _=require(_0x269e('0x0'));var util=require(_0x269e('0x1'));var logger=require('../../config/logger')(_0x269e('0x2'));var moment=require(_0x269e('0x3'));var BPromise=require(_0x269e('0x4'));var rp=require(_0x269e('0x5'));var fs=require('fs');var path=require(_0x269e('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x269e('0x7'));module['exports']=function(_0x44e3e4,_0x3b8503){return _0x44e3e4[_0x269e('0x8')](_0x269e('0x9'),attributes,{'tableName':_0x269e('0xa'),'paranoid':![],'indexes':[{'name':_0x269e('0xb'),'fields':[_0x269e('0xc'),'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 3e65ea1..4b9e622 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 _0x7165=['message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowField,\x20%s,\x20%s'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0x7165,0x1b9));var _0x5716=function(_0x179ee8,_0x234a72){_0x179ee8=_0x179ee8-0x0;var _0xd35dc5=_0x7165[_0x179ee8];return _0xd35dc5;};'use strict';var _=require(_0x5716('0x0'));var util=require(_0x5716('0x1'));var moment=require('moment');var BPromise=require(_0x5716('0x2'));var rs=require(_0x5716('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5716('0x4'))['db'];var utils=require(_0x5716('0x5'));var logger=require(_0x5716('0x6'))('rpc');var config=require(_0x5716('0x7'));var jayson=require(_0x5716('0x8'));var client=jayson[_0x5716('0x9')][_0x5716('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f898c,_0x3b566b,_0x16abe0){return new BPromise(function(_0x4c20b7,_0x453946){return client[_0x5716('0xb')](_0x2f898c,_0x16abe0)[_0x5716('0xc')](function(_0x3fab10){logger['info']('ServicenowField,\x20%s,\x20%s',_0x3b566b,_0x5716('0xd'));logger['debug'](_0x5716('0xe'),_0x3b566b,_0x5716('0xd'),JSON[_0x5716('0xf')](_0x3fab10));if(_0x3fab10[_0x5716('0x10')]){if(_0x3fab10[_0x5716('0x10')][_0x5716('0x11')]===0x1f4){logger[_0x5716('0x10')](_0x5716('0x12'),_0x3b566b,_0x3fab10[_0x5716('0x10')][_0x5716('0x13')]);return _0x453946(_0x3fab10[_0x5716('0x10')][_0x5716('0x13')]);}logger[_0x5716('0x10')](_0x5716('0x12'),_0x3b566b,_0x3fab10[_0x5716('0x10')][_0x5716('0x13')]);return _0x4c20b7(_0x3fab10['error'][_0x5716('0x13')]);}else{logger[_0x5716('0x14')]('ServicenowField,\x20%s,\x20%s',_0x3b566b,_0x5716('0xd'));_0x4c20b7(_0x3fab10[_0x5716('0x15')][_0x5716('0x13')]);}})[_0x5716('0x16')](function(_0x6d9ac5){logger[_0x5716('0x10')](_0x5716('0x12'),_0x3b566b,_0x6d9ac5);_0x453946(_0x6d9ac5);});});} \ No newline at end of file +var _0xe9e6=['message','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2b6390,_0x69bdb4){var _0x32f9ca=function(_0x3a3c07){while(--_0x3a3c07){_0x2b6390['push'](_0x2b6390['shift']());}};_0x32f9ca(++_0x69bdb4);}(_0xe9e6,0x121));var _0x6e9e=function(_0xb68695,_0x1881a4){_0xb68695=_0xb68695-0x0;var _0x15a817=_0xe9e6[_0xb68695];return _0x15a817;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6e9e('0x0'));var BPromise=require(_0x6e9e('0x1'));var rs=require(_0x6e9e('0x2'));var fs=require('fs');var Redis=require(_0x6e9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6e9e('0x4'));var logger=require(_0x6e9e('0x5'))(_0x6e9e('0x6'));var config=require(_0x6e9e('0x7'));var jayson=require(_0x6e9e('0x8'));var client=jayson['client'][_0x6e9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46f060,_0x3a040d,_0x446f55){return new BPromise(function(_0x4cc244,_0x42ce68){return client['request'](_0x46f060,_0x446f55)['then'](function(_0x48b647){logger['info'](_0x6e9e('0xa'),_0x3a040d,_0x6e9e('0xb'));logger[_0x6e9e('0xc')](_0x6e9e('0xd'),_0x3a040d,_0x6e9e('0xb'),JSON[_0x6e9e('0xe')](_0x48b647));if(_0x48b647['error']){if(_0x48b647[_0x6e9e('0xf')][_0x6e9e('0x10')]===0x1f4){logger[_0x6e9e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x3a040d,_0x48b647['error'][_0x6e9e('0x11')]);return _0x42ce68(_0x48b647[_0x6e9e('0xf')][_0x6e9e('0x11')]);}logger[_0x6e9e('0xf')](_0x6e9e('0xa'),_0x3a040d,_0x48b647['error'][_0x6e9e('0x11')]);return _0x4cc244(_0x48b647[_0x6e9e('0xf')][_0x6e9e('0x11')]);}else{logger['info'](_0x6e9e('0xa'),_0x3a040d,_0x6e9e('0xb'));_0x4cc244(_0x48b647['result'][_0x6e9e('0x11')]);}})['catch'](function(_0x3bba4f){logger['error'](_0x6e9e('0xa'),_0x3a040d,_0x3bba4f);_0x42ce68(_0x3bba4f);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 2210c42..e4ce4a1 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 _0xab6a=['exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','isAuthenticated','update','delete','destroy'];(function(_0x40e83a,_0x507d0c){var _0x181e5b=function(_0x152bee){while(--_0x152bee){_0x40e83a['push'](_0x40e83a['shift']());}};_0x181e5b(++_0x507d0c);}(_0xab6a,0x177));var _0xaab6=function(_0x1077d3,_0x43ad46){_0x1077d3=_0x1077d3-0x0;var _0x44a6fa=_0xab6a[_0x1077d3];return _0x44a6fa;};'use strict';var multer=require(_0xaab6('0x0'));var util=require(_0xaab6('0x1'));var path=require(_0xaab6('0x2'));var timeout=require(_0xaab6('0x3'));var express=require('express');var router=express[_0xaab6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xaab6('0x5'));var config=require(_0xaab6('0x6'));var controller=require(_0xaab6('0x7'));router[_0xaab6('0x8')]('/',auth['isAuthenticated'](),controller[_0xaab6('0x9')]);router[_0xaab6('0x8')](_0xaab6('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xaab6('0x8')](_0xaab6('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0xaab6('0xc'),auth['isAuthenticated'](),controller[_0xaab6('0xd')]);router[_0xaab6('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xaab6('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xaab6('0xf')]);router[_0xaab6('0x10')]('/:id',auth[_0xaab6('0x11')](),controller[_0xaab6('0x12')]);router[_0xaab6('0x13')](_0xaab6('0xa'),auth[_0xaab6('0x11')](),controller[_0xaab6('0x14')]);module[_0xaab6('0x15')]=router; \ No newline at end of file +var _0x9874=['destroy','util','connect-timeout','express','../../components/auth/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete'];(function(_0xe5e5ae,_0x4cfc1a){var _0xcb1c95=function(_0x158615){while(--_0x158615){_0xe5e5ae['push'](_0xe5e5ae['shift']());}};_0xcb1c95(++_0x4cfc1a);}(_0x9874,0x155));var _0x4987=function(_0x3b0cd1,_0xcd546d){_0x3b0cd1=_0x3b0cd1-0x0;var _0x36ec54=_0x9874[_0x3b0cd1];return _0x36ec54;};'use strict';var multer=require('multer');var util=require(_0x4987('0x0'));var path=require('path');var timeout=require(_0x4987('0x1'));var express=require(_0x4987('0x2'));var router=express['Router']();var auth=require(_0x4987('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4987('0x4'));router[_0x4987('0x5')]('/',auth[_0x4987('0x6')](),controller[_0x4987('0x7')]);router[_0x4987('0x5')]('/:id',auth[_0x4987('0x6')](),controller[_0x4987('0x8')]);router['get'](_0x4987('0x9'),auth[_0x4987('0x6')](),controller['getConfigurations']);router['get'](_0x4987('0xa'),auth[_0x4987('0x6')](),controller[_0x4987('0xb')]);router[_0x4987('0xc')]('/',auth[_0x4987('0x6')](),controller[_0x4987('0xd')]);router[_0x4987('0xc')](_0x4987('0x9'),auth['isAuthenticated'](),controller[_0x4987('0xe')]);router[_0x4987('0xf')](_0x4987('0x10'),auth[_0x4987('0x6')](),controller[_0x4987('0x11')]);router[_0x4987('0x12')](_0x4987('0x10'),auth['isAuthenticated'](),controller[_0x4987('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 3e12966..4dd7db6 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 _0xda00=['remoteUri','sequelize','exports','STRING'];(function(_0x62088f,_0x13fdd6){var _0x1d637f=function(_0x10c44c){while(--_0x10c44c){_0x62088f['push'](_0x62088f['shift']());}};_0x1d637f(++_0x13fdd6);}(_0xda00,0xcd));var _0x0da0=function(_0x4eb797,_0x4101d4){_0x4eb797=_0x4eb797-0x0;var _0x1b0d40=_0xda00[_0x4eb797];return _0x1b0d40;};'use strict';var Sequelize=require(_0x0da0('0x0'));module[_0x0da0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x0da0('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x0da0('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x0da0('0x3')},'serverUrl':{'type':Sequelize[_0x0da0('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x008d=['sequelize','exports','STRING','username','remoteUri'];(function(_0x41a9e9,_0x46a740){var _0x20e12f=function(_0xf6ed6c){while(--_0xf6ed6c){_0x41a9e9['push'](_0x41a9e9['shift']());}};_0x20e12f(++_0x46a740);}(_0x008d,0x1db));var _0xd008=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x008d[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0xd008('0x0'));module[_0xd008('0x1')]={'name':{'type':Sequelize[_0xd008('0x2')]},'description':{'type':Sequelize[_0xd008('0x2')]},'username':{'type':Sequelize[_0xd008('0x2')],'unique':_0xd008('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd008('0x2')],'unique':_0xd008('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 0473fd8..505cc60 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 _0x49dd=['Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','SugarcrmAccount,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','sendStatus','end','status','count','offset','limit','Content-Range','apply','reject','save','destroy','stack','name','send','map','fieldName','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','type','VIRTUAL','merge','options','SugarcrmAccount','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','getConfigurations','findOne','SugarcrmConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','username','password','remoteUri','slice','substring','POST','format','%s%s','login','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','JSON','Calls','values','includes','label','endsWith','value','test','statusCode'];(function(_0x2ec9e1,_0x33de63){var _0x174908=function(_0x287443){while(--_0x287443){_0x2ec9e1['push'](_0x2ec9e1['shift']());}};_0x174908(++_0x33de63);}(_0x49dd,0xfb));var _0xd49d=function(_0x3582d7,_0x1d3c7e){_0x3582d7=_0x3582d7-0x0;var _0x51e6b2=_0x49dd[_0x3582d7];return _0x51e6b2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd49d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd49d('0x1'));var jsonpatch=require(_0xd49d('0x2'));var rp=require(_0xd49d('0x3'));var moment=require('moment');var BPromise=require(_0xd49d('0x4'));var Mustache=require(_0xd49d('0x5'));var util=require('util');var path=require(_0xd49d('0x6'));var sox=require(_0xd49d('0x7'));var csv=require(_0xd49d('0x8'));var ejs=require(_0xd49d('0x9'));var fs=require('fs');var _=require(_0xd49d('0xa'));var squel=require(_0xd49d('0xb'));var crypto=require(_0xd49d('0xc'));var jsforce=require(_0xd49d('0xd'));var deskjs=require(_0xd49d('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd49d('0xf'));var Papa=require('papaparse');var Redis=require(_0xd49d('0x10'));var authService=require(_0xd49d('0x11'));var qs=require(_0xd49d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd49d('0x13'));var logger=require('../../config/logger')(_0xd49d('0x14'));var utils=require(_0xd49d('0x15'));var config=require(_0xd49d('0x16'));var licenseUtil=require(_0xd49d('0x17'));var db=require(_0xd49d('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xd49d('0x19'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x21dd77,_0x264a6f,_0x1924ec,_0x40438e){return new BPromise(function(_0x51743f,_0x4a436a){var _0x56e6bd=_0x40438e||client;return _0x56e6bd[_0xd49d('0x1a')](_0x21dd77,_0x1924ec)[_0xd49d('0x1b')](function(_0x363e6e){logger[_0xd49d('0x1c')](_0xd49d('0x1d'),_0x264a6f,'request\x20sent');logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x264a6f,'request\x20sent',JSON[_0xd49d('0x1e')](_0x363e6e));if(_0x363e6e[_0xd49d('0x1f')]){if(_0x363e6e[_0xd49d('0x1f')]['code']===0x1f4){logger[_0xd49d('0x1f')](_0xd49d('0x1d'),_0x264a6f,_0x363e6e['error'][_0xd49d('0x20')]);return _0x4a436a(_0x363e6e['error'][_0xd49d('0x20')]);}logger[_0xd49d('0x1f')](_0xd49d('0x1d'),_0x264a6f,_0x363e6e[_0xd49d('0x1f')][_0xd49d('0x20')]);return _0x51743f(_0x363e6e[_0xd49d('0x1f')]['message']);}else{logger[_0xd49d('0x1c')](_0xd49d('0x1d'),_0x264a6f,_0xd49d('0x21'));_0x51743f(_0x363e6e[_0xd49d('0x22')][_0xd49d('0x20')]);}})['catch'](function(_0x39a5fc){logger[_0xd49d('0x1f')](_0xd49d('0x1d'),_0x264a6f,_0x39a5fc);_0x4a436a(_0x39a5fc);});});}function respondWithStatusCode(_0x4562ca,_0x4ad6ad){_0x4ad6ad=_0x4ad6ad||0xcc;return function(_0x1009e8){if(_0x1009e8){return _0x4562ca[_0xd49d('0x23')](_0x4ad6ad);}return _0x4562ca['status'](_0x4ad6ad)[_0xd49d('0x24')]();};}function respondWithResult(_0x117f17,_0x169c6a){_0x169c6a=_0x169c6a||0xc8;return function(_0x1a0149){if(_0x1a0149){return _0x117f17[_0xd49d('0x25')](_0x169c6a)['json'](_0x1a0149);}};}function respondWithFilteredResult(_0x403a17,_0x1c5cbd){return function(_0x3fd29e){if(_0x3fd29e){var _0x18c839=_0x3fd29e[_0xd49d('0x26')],_0x5e8902=_0x1c5cbd['offset'],_0x5c079a=_0x1c5cbd[_0xd49d('0x27')]+_0x1c5cbd[_0xd49d('0x28')],_0x329973;if(_0x5c079a>=_0x18c839){_0x5c079a=_0x18c839;_0x329973=0xc8;}else{_0x329973=0xce;}_0x403a17[_0xd49d('0x25')](_0x329973);return _0x403a17['set'](_0xd49d('0x29'),_0x5e8902+'-'+_0x5c079a+'/'+_0x18c839)['json'](_0x3fd29e);}return null;};}function patchUpdates(_0x3ed653){return function(_0x497533){try{jsonpatch[_0xd49d('0x2a')](_0x497533,_0x3ed653,!![]);}catch(_0x567482){return BPromise[_0xd49d('0x2b')](_0x567482);}return _0x497533[_0xd49d('0x2c')]();};}function saveUpdates(_0x59d088,_0x4fe242){return function(_0x470500){if(_0x470500){return _0x470500['update'](_0x59d088)[_0xd49d('0x1b')](function(_0x500526){return _0x500526;});}return null;};}function removeEntity(_0x441465,_0x597b55){return function(_0x34dc5f){if(_0x34dc5f){return _0x34dc5f[_0xd49d('0x2d')]()[_0xd49d('0x1b')](function(){_0x441465['status'](0xcc)[_0xd49d('0x24')]();});}};}function handleEntityNotFound(_0x4f82f,_0x79fb55){return function(_0x296ef2){if(!_0x296ef2){_0x4f82f[_0xd49d('0x23')](0x194);}return _0x296ef2;};}function handleError(_0x2376b9,_0x251f40){_0x251f40=_0x251f40||0x1f4;return function(_0x4181a0){logger[_0xd49d('0x1f')](_0x4181a0[_0xd49d('0x2e')]);if(_0x4181a0[_0xd49d('0x2f')]){delete _0x4181a0['name'];}_0x2376b9[_0xd49d('0x25')](_0x251f40)[_0xd49d('0x30')](_0x4181a0);};}exports['index']=function(_0x4444be,_0xa16049){var _0x32ae03={},_0x3dc3e4={},_0x49ca83={'count':0x0,'rows':[]};var _0xcfb674=_[_0xd49d('0x31')](db['SugarcrmAccount']['rawAttributes'],function(_0x4cf83b){return{'name':_0x4cf83b[_0xd49d('0x32')],'type':_0x4cf83b['type']['key']};});_0x3dc3e4[_0xd49d('0x33')]=_[_0xd49d('0x31')](_0xcfb674,_0xd49d('0x2f'));_0x3dc3e4[_0xd49d('0x34')]=_[_0xd49d('0x35')](_0x4444be['query']);_0x3dc3e4['filters']=_['intersection'](_0x3dc3e4['model'],_0x3dc3e4[_0xd49d('0x34')]);_0x32ae03[_0xd49d('0x36')]=_[_0xd49d('0x37')](_0x3dc3e4[_0xd49d('0x33')],qs[_0xd49d('0x38')](_0x4444be[_0xd49d('0x34')][_0xd49d('0x38')]));_0x32ae03[_0xd49d('0x36')]=_0x32ae03['attributes'][_0xd49d('0x39')]?_0x32ae03[_0xd49d('0x36')]:_0x3dc3e4['model'];if(!_0x4444be[_0xd49d('0x34')][_0xd49d('0x3a')](_0xd49d('0x3b'))){_0x32ae03['limit']=qs[_0xd49d('0x28')](_0x4444be[_0xd49d('0x34')][_0xd49d('0x28')]);_0x32ae03[_0xd49d('0x27')]=qs[_0xd49d('0x27')](_0x4444be[_0xd49d('0x34')][_0xd49d('0x27')]);}_0x32ae03[_0xd49d('0x3c')]=qs[_0xd49d('0x3d')](_0x4444be[_0xd49d('0x34')][_0xd49d('0x3d')]);_0x32ae03['where']=qs[_0xd49d('0x3e')](_['pick'](_0x4444be[_0xd49d('0x34')],_0x3dc3e4[_0xd49d('0x3e')]),_0xcfb674);if(_0x4444be[_0xd49d('0x34')][_0xd49d('0x3f')]){_0x32ae03[_0xd49d('0x40')]=_['merge'](_0x32ae03['where'],{'$or':_[_0xd49d('0x31')](_0xcfb674,function(_0x226edb){if(_0x226edb[_0xd49d('0x41')]!==_0xd49d('0x42')){var _0x520caf={};_0x520caf[_0x226edb[_0xd49d('0x2f')]]={'$like':'%'+_0x4444be[_0xd49d('0x34')][_0xd49d('0x3f')]+'%'};return _0x520caf;}})});}_0x32ae03=_[_0xd49d('0x43')]({},_0x32ae03,_0x4444be[_0xd49d('0x44')]);var _0x1ab882={'where':_0x32ae03[_0xd49d('0x40')]};return db[_0xd49d('0x45')][_0xd49d('0x26')](_0x1ab882)[_0xd49d('0x1b')](function(_0x2194f1){_0x49ca83[_0xd49d('0x26')]=_0x2194f1;if(_0x4444be[_0xd49d('0x34')][_0xd49d('0x46')]){_0x32ae03[_0xd49d('0x47')]=[{'all':!![]}];}return db[_0xd49d('0x45')][_0xd49d('0x48')](_0x32ae03);})[_0xd49d('0x1b')](function(_0x561ca0){_0x49ca83[_0xd49d('0x49')]=_0x561ca0;return _0x49ca83;})[_0xd49d('0x1b')](respondWithFilteredResult(_0xa16049,_0x32ae03))[_0xd49d('0x4a')](handleError(_0xa16049,null));};exports[_0xd49d('0x4b')]=function(_0x53f69f,_0x2edd7f){var _0x4663b1={'raw':![],'where':{'id':_0x53f69f[_0xd49d('0x4c')]['id']}},_0x33168f={};_0x33168f[_0xd49d('0x33')]=_[_0xd49d('0x35')](db[_0xd49d('0x45')][_0xd49d('0x4d')]);_0x33168f[_0xd49d('0x34')]=_[_0xd49d('0x35')](_0x53f69f[_0xd49d('0x34')]);_0x33168f[_0xd49d('0x3e')]=_[_0xd49d('0x37')](_0x33168f['model'],_0x33168f['query']);_0x4663b1['attributes']=_[_0xd49d('0x37')](_0x33168f[_0xd49d('0x33')],qs['fields'](_0x53f69f[_0xd49d('0x34')][_0xd49d('0x38')]));_0x4663b1[_0xd49d('0x36')]=_0x4663b1[_0xd49d('0x36')]['length']?_0x4663b1[_0xd49d('0x36')]:_0x33168f[_0xd49d('0x33')];if(_0x53f69f['query'][_0xd49d('0x46')]){_0x4663b1[_0xd49d('0x47')]=[{'all':!![]}];}_0x4663b1=_[_0xd49d('0x43')]({},_0x4663b1,_0x53f69f['options']);return db[_0xd49d('0x45')][_0xd49d('0x4e')](_0x4663b1)[_0xd49d('0x1b')](handleEntityNotFound(_0x2edd7f,null))[_0xd49d('0x1b')](respondWithResult(_0x2edd7f,null))[_0xd49d('0x4a')](handleError(_0x2edd7f,null));};exports[_0xd49d('0x4f')]=function(_0x562a62,_0x1b4296){return db['SugarcrmAccount']['create'](_0x562a62[_0xd49d('0x50')],{})['then'](respondWithResult(_0x1b4296,0xc9))[_0xd49d('0x4a')](handleError(_0x1b4296,null));};exports[_0xd49d('0x51')]=function(_0x2bbb7c,_0x20778e){if(_0x2bbb7c[_0xd49d('0x50')]['id']){delete _0x2bbb7c['body']['id'];}return db[_0xd49d('0x45')][_0xd49d('0x4e')]({'where':{'id':_0x2bbb7c[_0xd49d('0x4c')]['id']}})[_0xd49d('0x1b')](handleEntityNotFound(_0x20778e,null))['then'](saveUpdates(_0x2bbb7c[_0xd49d('0x50')],null))[_0xd49d('0x1b')](respondWithResult(_0x20778e,null))[_0xd49d('0x4a')](handleError(_0x20778e,null));};exports['destroy']=function(_0x378579,_0x43a60a){return db['SugarcrmAccount']['find']({'where':{'id':_0x378579[_0xd49d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x43a60a,null))[_0xd49d('0x1b')](removeEntity(_0x43a60a,null))[_0xd49d('0x4a')](handleError(_0x43a60a,null));};exports[_0xd49d('0x52')]=function(_0x401662,_0x718da7,_0x1d86b4){var _0x16ad5f={};var _0x4441bf={};var _0x5d3a0b;var _0x231555;return db['SugarcrmAccount'][_0xd49d('0x53')]({'where':{'id':_0x401662[_0xd49d('0x4c')]['id']}})[_0xd49d('0x1b')](handleEntityNotFound(_0x718da7,null))[_0xd49d('0x1b')](function(_0x3b867b){if(_0x3b867b){_0x5d3a0b=_0x3b867b;_0x4441bf[_0xd49d('0x33')]=_[_0xd49d('0x35')](db[_0xd49d('0x54')]['rawAttributes']);_0x4441bf[_0xd49d('0x34')]=_[_0xd49d('0x35')](_0x401662[_0xd49d('0x34')]);_0x4441bf[_0xd49d('0x3e')]=_[_0xd49d('0x37')](_0x4441bf[_0xd49d('0x33')],_0x4441bf[_0xd49d('0x34')]);_0x16ad5f[_0xd49d('0x36')]=_[_0xd49d('0x37')](_0x4441bf[_0xd49d('0x33')],qs[_0xd49d('0x38')](_0x401662[_0xd49d('0x34')][_0xd49d('0x38')]));_0x16ad5f[_0xd49d('0x36')]=_0x16ad5f[_0xd49d('0x36')][_0xd49d('0x39')]?_0x16ad5f['attributes']:_0x4441bf[_0xd49d('0x33')];_0x16ad5f['order']=qs[_0xd49d('0x3d')](_0x401662[_0xd49d('0x34')][_0xd49d('0x3d')]);_0x16ad5f['where']=qs[_0xd49d('0x3e')](_[_0xd49d('0x55')](_0x401662['query'],_0x4441bf['filters']));if(_0x401662[_0xd49d('0x34')]['filter']){_0x16ad5f[_0xd49d('0x40')]=_[_0xd49d('0x43')](_0x16ad5f['where'],{'$or':_[_0xd49d('0x31')](_0x16ad5f[_0xd49d('0x36')],function(_0x2d418e){var _0x20ce34={};_0x20ce34[_0x2d418e]={'$like':'%'+_0x401662['query']['filter']+'%'};return _0x20ce34;})});}_0x16ad5f=_[_0xd49d('0x43')]({},_0x16ad5f,_0x401662[_0xd49d('0x44')]);return _0x5d3a0b[_0xd49d('0x52')](_0x16ad5f);}})['then'](function(_0x1a3d4e){if(_0x1a3d4e){_0x231555=_0x1a3d4e[_0xd49d('0x39')];if(!_0x401662[_0xd49d('0x34')][_0xd49d('0x3a')](_0xd49d('0x3b'))){_0x16ad5f[_0xd49d('0x28')]=qs[_0xd49d('0x28')](_0x401662[_0xd49d('0x34')][_0xd49d('0x28')]);_0x16ad5f['offset']=qs['offset'](_0x401662[_0xd49d('0x34')][_0xd49d('0x27')]);}return _0x5d3a0b[_0xd49d('0x52')](_0x16ad5f);}})[_0xd49d('0x1b')](function(_0x2c3202){if(_0x2c3202){return _0x2c3202?{'count':_0x231555,'rows':_0x2c3202}:null;}})[_0xd49d('0x1b')](respondWithResult(_0x718da7,null))[_0xd49d('0x4a')](handleError(_0x718da7,null));};exports[_0xd49d('0x56')]=function(_0x34717f,_0x4c1024,_0x3cedb6){if(_0x34717f[_0xd49d('0x50')]['id']){delete _0x34717f['body']['id'];}return db[_0xd49d('0x45')][_0xd49d('0x53')]({'where':{'id':_0x34717f['params']['id']}})[_0xd49d('0x1b')](handleEntityNotFound(_0x4c1024,null))[_0xd49d('0x1b')](function(_0x2cdec0){if(_0x2cdec0){_0x34717f[_0xd49d('0x50')][_0xd49d('0x57')]=_0x2cdec0['id'];_0x34717f['body'][_0xd49d('0x58')]=integrations[_0xd49d('0x59')](_0x34717f['body'][_0xd49d('0x5a')],_0x34717f['body'][_0xd49d('0x41')]);_0x34717f['body']['Descriptions']=integrations[_0xd49d('0x5b')](_0x34717f[_0xd49d('0x50')][_0xd49d('0x5a')],_0x34717f['body']['type']);return db[_0xd49d('0x54')][_0xd49d('0x4f')](_0x34717f['body'],{'include':[{'model':db['SugarcrmField'],'as':_0xd49d('0x58')},{'model':db['SugarcrmField'],'as':'Descriptions'}]});}return null;})[_0xd49d('0x1b')](respondWithResult(_0x4c1024,null))['catch'](handleError(_0x4c1024,null));};exports[_0xd49d('0x5c')]=function(_0x33e29c,_0x528e60,_0x3e6c00){var _0x1a067c='';var _0x5baaba=['id',_0xd49d('0x2f'),_0xd49d('0x5d'),_0xd49d('0x5e'),_0xd49d('0x5f'),_0xd49d('0x60'),_0xd49d('0x61'),_0xd49d('0x62'),_0xd49d('0x63'),'parent_type',_0xd49d('0x64'),'direction'];return db[_0xd49d('0x45')][_0xd49d('0x53')]({'where':{'id':_0x33e29c[_0xd49d('0x4c')]['id']},'attributes':['id',_0xd49d('0x65'),_0xd49d('0x66'),'remoteUri']})[_0xd49d('0x1b')](handleEntityNotFound(_0x528e60,null))[_0xd49d('0x1b')](function(_0x2229a9){if(_0x2229a9){_0x1a067c=_0x2229a9[_0xd49d('0x67')];var _0x53ceda=_0x1a067c[_0xd49d('0x68')](-0x1);if(_0x53ceda==='/'){_0x1a067c=_0x1a067c[_0xd49d('0x69')](0x0,_0x1a067c['lastIndexOf'](_0x53ceda));}return rp({'method':_0xd49d('0x6a'),'uri':util[_0xd49d('0x6b')](_0xd49d('0x6c'),_0x1a067c,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xd49d('0x6d'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xd49d('0x1e')]({'user_auth':{'user_name':_0x2229a9[_0xd49d('0x65')],'password':_0x2229a9[_0xd49d('0x66')],'encryption':_0xd49d('0x6e')},'application':_0xd49d('0x6f')})}});}})[_0xd49d('0x1b')](function(_0x53b805){if(_0x53b805&&_0x53b805[_0xd49d('0x2f')]!=='Invalid\x20Login'&&_0x53b805[_0xd49d('0x2f')]!==_0xd49d('0x70')){return rp({'method':_0xd49d('0x6a'),'uri':util[_0xd49d('0x6b')](_0xd49d('0x6c'),_0x1a067c,_0xd49d('0x71')),'json':!![],'form':{'method':_0xd49d('0x72'),'input_type':_0xd49d('0x73'),'response_type':_0xd49d('0x73'),'rest_data':JSON[_0xd49d('0x1e')]({'session':_0x53b805['id'],'module_name':_0xd49d('0x74')})}})[_0xd49d('0x1b')](function(_0x1a38ee){if(_0x1a38ee){var _0x58503c=_[_0xd49d('0x75')](_0x1a38ee['module_fields']);_['remove'](_0x58503c,function(_0x158fcf){return _0x5baaba[_0xd49d('0x76')](_0x158fcf[_0xd49d('0x2f')]);});return{'count':_0x58503c[_0xd49d('0x39')],'rows':_[_0xd49d('0x31')](_0x58503c,function(_0x35c147){return{'id':_0x35c147[_0xd49d('0x2f')],'name':_0x35c147[_0xd49d('0x77')],'custom':_[_0xd49d('0x78')](_0x35c147[_0xd49d('0x2f')],'_c')?!![]:![],'options':_0x35c147[_0xd49d('0x44')]?_[_0xd49d('0x31')](_[_0xd49d('0x75')](_0x35c147[_0xd49d('0x44')]),function(_0x39cd62){return{'name':_0x39cd62[_0xd49d('0x79')],'value':_0x39cd62[_0xd49d('0x2f')]};}):[]};})};}})[_0xd49d('0x1b')](respondWithResult(_0x528e60,null))[_0xd49d('0x4a')](function(_0xbfb8ea){var _0x500795=_0x33e29c['query'][_0xd49d('0x7a')]?0x1f4:_0xbfb8ea[_0xd49d('0x7b')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xd49d('0x5c'),_0x500795,JSON['stringify'](_0xbfb8ea));delete _0xbfb8ea['name'];if(_0x500795===0x191){_0x500795=0x190;}_0x528e60['status'](_0x500795)['send'](_0x33e29c['query'][_0xd49d('0x7a')]?{'message':_0xd49d('0x7c'),'statusCode':_0xbfb8ea['statusCode']}:_0xbfb8ea);});}else{var _0x322721=0x1f4;_0x528e60['status'](_0x322721)[_0xd49d('0x30')]({'message':_0xd49d('0x7c'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x2158=['fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','rawAttributes','find','create','body','params','destroy','getConfigurations','findOne','SugarcrmConfiguration','merge','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','SugarcrmField','getFields','assigned_user_id','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','substring','lastIndexOf','POST','format','%s%s','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','includes','endsWith','value','test','Wrong\x20credentials','html-pdf','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','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','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','sendStatus','end','status','json','offset','limit','set','reject','save','stack','name','send','index','map','SugarcrmAccount'];(function(_0x57292b,_0x4a510e){var _0x21a8c0=function(_0x54c092){while(--_0x54c092){_0x57292b['push'](_0x57292b['shift']());}};_0x21a8c0(++_0x4a510e);}(_0x2158,0xc3));var _0x8215=function(_0x321838,_0x2c54b6){_0x321838=_0x321838-0x0;var _0x185970=_0x2158[_0x321838];return _0x185970;};'use strict';var pdf=require(_0x8215('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8215('0x1'));var zipdir=require(_0x8215('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8215('0x3'));var BPromise=require(_0x8215('0x4'));var Mustache=require(_0x8215('0x5'));var util=require(_0x8215('0x6'));var path=require(_0x8215('0x7'));var sox=require(_0x8215('0x8'));var csv=require(_0x8215('0x9'));var ejs=require(_0x8215('0xa'));var fs=require('fs');var _=require(_0x8215('0xb'));var squel=require(_0x8215('0xc'));var crypto=require(_0x8215('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8215('0xe'));var toCsv=require(_0x8215('0x9'));var querystring=require(_0x8215('0xf'));var Papa=require('papaparse');var Redis=require(_0x8215('0x10'));var authService=require(_0x8215('0x11'));var qs=require(_0x8215('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8215('0x13'));var logger=require(_0x8215('0x14'))(_0x8215('0x15'));var utils=require(_0x8215('0x16'));var config=require(_0x8215('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8215('0x18'))['db'];var integrations=require(_0x8215('0x19'));var jayson=require(_0x8215('0x1a'));var client=jayson['client'][_0x8215('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xa112e8,_0xafaa09,_0x258562,_0x193fa9){return new BPromise(function(_0xabfdb8,_0x4b4e4c){var _0x344035=_0x193fa9||client;return _0x344035[_0x8215('0x1c')](_0xa112e8,_0x258562)[_0x8215('0x1d')](function(_0x55cb04){logger[_0x8215('0x1e')](_0x8215('0x1f'),_0xafaa09,_0x8215('0x20'));logger[_0x8215('0x21')](_0x8215('0x22'),_0xafaa09,_0x8215('0x20'),JSON[_0x8215('0x23')](_0x55cb04));if(_0x55cb04['error']){if(_0x55cb04['error'][_0x8215('0x24')]===0x1f4){logger['error'](_0x8215('0x1f'),_0xafaa09,_0x55cb04[_0x8215('0x25')][_0x8215('0x26')]);return _0x4b4e4c(_0x55cb04[_0x8215('0x25')][_0x8215('0x26')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0xafaa09,_0x55cb04[_0x8215('0x25')][_0x8215('0x26')]);return _0xabfdb8(_0x55cb04[_0x8215('0x25')][_0x8215('0x26')]);}else{logger['info'](_0x8215('0x1f'),_0xafaa09,'request\x20sent');_0xabfdb8(_0x55cb04[_0x8215('0x27')][_0x8215('0x26')]);}})['catch'](function(_0x3881eb){logger[_0x8215('0x25')](_0x8215('0x1f'),_0xafaa09,_0x3881eb);_0x4b4e4c(_0x3881eb);});});}function respondWithStatusCode(_0xa2ca57,_0xa28d89){_0xa28d89=_0xa28d89||0xcc;return function(_0x2b7abc){if(_0x2b7abc){return _0xa2ca57[_0x8215('0x28')](_0xa28d89);}return _0xa2ca57['status'](_0xa28d89)[_0x8215('0x29')]();};}function respondWithResult(_0x39130d,_0xe7df2d){_0xe7df2d=_0xe7df2d||0xc8;return function(_0x2fb89b){if(_0x2fb89b){return _0x39130d[_0x8215('0x2a')](_0xe7df2d)[_0x8215('0x2b')](_0x2fb89b);}};}function respondWithFilteredResult(_0xf4c6fc,_0x283d55){return function(_0x29b3fb){if(_0x29b3fb){var _0x1eb718=_0x29b3fb['count'],_0x3abb2b=_0x283d55[_0x8215('0x2c')],_0x1a2328=_0x283d55[_0x8215('0x2c')]+_0x283d55[_0x8215('0x2d')],_0x505b59;if(_0x1a2328>=_0x1eb718){_0x1a2328=_0x1eb718;_0x505b59=0xc8;}else{_0x505b59=0xce;}_0xf4c6fc[_0x8215('0x2a')](_0x505b59);return _0xf4c6fc[_0x8215('0x2e')]('Content-Range',_0x3abb2b+'-'+_0x1a2328+'/'+_0x1eb718)[_0x8215('0x2b')](_0x29b3fb);}return null;};}function patchUpdates(_0x4a0072){return function(_0x767767){try{jsonpatch['apply'](_0x767767,_0x4a0072,!![]);}catch(_0x5dbccb){return BPromise[_0x8215('0x2f')](_0x5dbccb);}return _0x767767[_0x8215('0x30')]();};}function saveUpdates(_0xeaaf61,_0x1fd3a4){return function(_0x580b3b){if(_0x580b3b){return _0x580b3b['update'](_0xeaaf61)[_0x8215('0x1d')](function(_0x48bb2e){return _0x48bb2e;});}return null;};}function removeEntity(_0x1b2f93,_0x352ee6){return function(_0x53a1db){if(_0x53a1db){return _0x53a1db['destroy']()[_0x8215('0x1d')](function(){_0x1b2f93[_0x8215('0x2a')](0xcc)[_0x8215('0x29')]();});}};}function handleEntityNotFound(_0x3b5839,_0x33fa6a){return function(_0x4fbda2){if(!_0x4fbda2){_0x3b5839[_0x8215('0x28')](0x194);}return _0x4fbda2;};}function handleError(_0x5598f7,_0x4b8d3b){_0x4b8d3b=_0x4b8d3b||0x1f4;return function(_0x450aef){logger[_0x8215('0x25')](_0x450aef[_0x8215('0x31')]);if(_0x450aef[_0x8215('0x32')]){delete _0x450aef[_0x8215('0x32')];}_0x5598f7[_0x8215('0x2a')](_0x4b8d3b)[_0x8215('0x33')](_0x450aef);};}exports[_0x8215('0x34')]=function(_0x2d327c,_0x519d6d){var _0x645af8={},_0x1701f9={},_0xe50e9a={'count':0x0,'rows':[]};var _0x3719b2=_[_0x8215('0x35')](db[_0x8215('0x36')]['rawAttributes'],function(_0x644ea5){return{'name':_0x644ea5[_0x8215('0x37')],'type':_0x644ea5[_0x8215('0x38')][_0x8215('0x39')]};});_0x1701f9[_0x8215('0x3a')]=_['map'](_0x3719b2,_0x8215('0x32'));_0x1701f9['query']=_[_0x8215('0x3b')](_0x2d327c['query']);_0x1701f9[_0x8215('0x3c')]=_[_0x8215('0x3d')](_0x1701f9[_0x8215('0x3a')],_0x1701f9[_0x8215('0x3e')]);_0x645af8['attributes']=_[_0x8215('0x3d')](_0x1701f9[_0x8215('0x3a')],qs[_0x8215('0x3f')](_0x2d327c['query'][_0x8215('0x3f')]));_0x645af8[_0x8215('0x40')]=_0x645af8[_0x8215('0x40')][_0x8215('0x41')]?_0x645af8[_0x8215('0x40')]:_0x1701f9[_0x8215('0x3a')];if(!_0x2d327c['query'][_0x8215('0x42')]('nolimit')){_0x645af8[_0x8215('0x2d')]=qs[_0x8215('0x2d')](_0x2d327c[_0x8215('0x3e')]['limit']);_0x645af8[_0x8215('0x2c')]=qs['offset'](_0x2d327c[_0x8215('0x3e')][_0x8215('0x2c')]);}_0x645af8[_0x8215('0x43')]=qs[_0x8215('0x44')](_0x2d327c[_0x8215('0x3e')][_0x8215('0x44')]);_0x645af8['where']=qs[_0x8215('0x3c')](_[_0x8215('0x45')](_0x2d327c[_0x8215('0x3e')],_0x1701f9['filters']),_0x3719b2);if(_0x2d327c[_0x8215('0x3e')][_0x8215('0x46')]){_0x645af8['where']=_['merge'](_0x645af8[_0x8215('0x47')],{'$or':_[_0x8215('0x35')](_0x3719b2,function(_0xc0bf9b){if(_0xc0bf9b['type']!==_0x8215('0x48')){var _0x18c156={};_0x18c156[_0xc0bf9b['name']]={'$like':'%'+_0x2d327c['query'][_0x8215('0x46')]+'%'};return _0x18c156;}})});}_0x645af8=_['merge']({},_0x645af8,_0x2d327c[_0x8215('0x49')]);var _0x3978aa={'where':_0x645af8[_0x8215('0x47')]};return db[_0x8215('0x36')]['count'](_0x3978aa)[_0x8215('0x1d')](function(_0x1b513a){_0xe50e9a['count']=_0x1b513a;if(_0x2d327c[_0x8215('0x3e')][_0x8215('0x4a')]){_0x645af8[_0x8215('0x4b')]=[{'all':!![]}];}return db[_0x8215('0x36')][_0x8215('0x4c')](_0x645af8);})[_0x8215('0x1d')](function(_0x34353d){_0xe50e9a['rows']=_0x34353d;return _0xe50e9a;})['then'](respondWithFilteredResult(_0x519d6d,_0x645af8))[_0x8215('0x4d')](handleError(_0x519d6d,null));};exports['show']=function(_0x5c16e2,_0x1bd147){var _0x241da9={'raw':![],'where':{'id':_0x5c16e2['params']['id']}},_0x153edc={};_0x153edc[_0x8215('0x3a')]=_['keys'](db[_0x8215('0x36')][_0x8215('0x4e')]);_0x153edc[_0x8215('0x3e')]=_[_0x8215('0x3b')](_0x5c16e2[_0x8215('0x3e')]);_0x153edc[_0x8215('0x3c')]=_['intersection'](_0x153edc[_0x8215('0x3a')],_0x153edc[_0x8215('0x3e')]);_0x241da9['attributes']=_[_0x8215('0x3d')](_0x153edc['model'],qs[_0x8215('0x3f')](_0x5c16e2['query'][_0x8215('0x3f')]));_0x241da9['attributes']=_0x241da9[_0x8215('0x40')][_0x8215('0x41')]?_0x241da9['attributes']:_0x153edc[_0x8215('0x3a')];if(_0x5c16e2[_0x8215('0x3e')][_0x8215('0x4a')]){_0x241da9[_0x8215('0x4b')]=[{'all':!![]}];}_0x241da9=_['merge']({},_0x241da9,_0x5c16e2[_0x8215('0x49')]);return db['SugarcrmAccount'][_0x8215('0x4f')](_0x241da9)['then'](handleEntityNotFound(_0x1bd147,null))[_0x8215('0x1d')](respondWithResult(_0x1bd147,null))[_0x8215('0x4d')](handleError(_0x1bd147,null));};exports[_0x8215('0x50')]=function(_0x13c509,_0x3659f2){return db[_0x8215('0x36')][_0x8215('0x50')](_0x13c509['body'],{})[_0x8215('0x1d')](respondWithResult(_0x3659f2,0xc9))[_0x8215('0x4d')](handleError(_0x3659f2,null));};exports['update']=function(_0x58514f,_0x1a496f){if(_0x58514f[_0x8215('0x51')]['id']){delete _0x58514f[_0x8215('0x51')]['id'];}return db[_0x8215('0x36')]['find']({'where':{'id':_0x58514f[_0x8215('0x52')]['id']}})[_0x8215('0x1d')](handleEntityNotFound(_0x1a496f,null))['then'](saveUpdates(_0x58514f[_0x8215('0x51')],null))['then'](respondWithResult(_0x1a496f,null))['catch'](handleError(_0x1a496f,null));};exports[_0x8215('0x53')]=function(_0x3896ee,_0x4d5149){return db[_0x8215('0x36')]['find']({'where':{'id':_0x3896ee['params']['id']}})[_0x8215('0x1d')](handleEntityNotFound(_0x4d5149,null))['then'](removeEntity(_0x4d5149,null))['catch'](handleError(_0x4d5149,null));};exports[_0x8215('0x54')]=function(_0x5b9f03,_0x2c7079,_0x500673){var _0x214850={};var _0x4fe348={};var _0x3a8064;var _0x178fda;return db[_0x8215('0x36')][_0x8215('0x55')]({'where':{'id':_0x5b9f03[_0x8215('0x52')]['id']}})[_0x8215('0x1d')](handleEntityNotFound(_0x2c7079,null))[_0x8215('0x1d')](function(_0x44ee59){if(_0x44ee59){_0x3a8064=_0x44ee59;_0x4fe348['model']=_['keys'](db[_0x8215('0x56')]['rawAttributes']);_0x4fe348[_0x8215('0x3e')]=_[_0x8215('0x3b')](_0x5b9f03['query']);_0x4fe348[_0x8215('0x3c')]=_[_0x8215('0x3d')](_0x4fe348['model'],_0x4fe348[_0x8215('0x3e')]);_0x214850[_0x8215('0x40')]=_[_0x8215('0x3d')](_0x4fe348['model'],qs[_0x8215('0x3f')](_0x5b9f03[_0x8215('0x3e')][_0x8215('0x3f')]));_0x214850['attributes']=_0x214850[_0x8215('0x40')]['length']?_0x214850[_0x8215('0x40')]:_0x4fe348['model'];_0x214850[_0x8215('0x43')]=qs[_0x8215('0x44')](_0x5b9f03[_0x8215('0x3e')][_0x8215('0x44')]);_0x214850['where']=qs[_0x8215('0x3c')](_[_0x8215('0x45')](_0x5b9f03['query'],_0x4fe348[_0x8215('0x3c')]));if(_0x5b9f03['query'][_0x8215('0x46')]){_0x214850['where']=_[_0x8215('0x57')](_0x214850[_0x8215('0x47')],{'$or':_[_0x8215('0x35')](_0x214850[_0x8215('0x40')],function(_0x97330f){var _0x5e81e5={};_0x5e81e5[_0x97330f]={'$like':'%'+_0x5b9f03['query']['filter']+'%'};return _0x5e81e5;})});}_0x214850=_[_0x8215('0x57')]({},_0x214850,_0x5b9f03[_0x8215('0x49')]);return _0x3a8064[_0x8215('0x54')](_0x214850);}})[_0x8215('0x1d')](function(_0x35362e){if(_0x35362e){_0x178fda=_0x35362e[_0x8215('0x41')];if(!_0x5b9f03[_0x8215('0x3e')][_0x8215('0x42')](_0x8215('0x58'))){_0x214850['limit']=qs[_0x8215('0x2d')](_0x5b9f03['query'][_0x8215('0x2d')]);_0x214850[_0x8215('0x2c')]=qs[_0x8215('0x2c')](_0x5b9f03[_0x8215('0x3e')][_0x8215('0x2c')]);}return _0x3a8064[_0x8215('0x54')](_0x214850);}})['then'](function(_0x3d1f36){if(_0x3d1f36){return _0x3d1f36?{'count':_0x178fda,'rows':_0x3d1f36}:null;}})[_0x8215('0x1d')](respondWithResult(_0x2c7079,null))['catch'](handleError(_0x2c7079,null));};exports[_0x8215('0x59')]=function(_0x5d065c,_0x3a1019,_0x279315){if(_0x5d065c[_0x8215('0x51')]['id']){delete _0x5d065c['body']['id'];}return db[_0x8215('0x36')][_0x8215('0x55')]({'where':{'id':_0x5d065c[_0x8215('0x52')]['id']}})[_0x8215('0x1d')](handleEntityNotFound(_0x3a1019,null))[_0x8215('0x1d')](function(_0x3804f2){if(_0x3804f2){_0x5d065c['body']['AccountId']=_0x3804f2['id'];_0x5d065c['body'][_0x8215('0x5a')]=integrations[_0x8215('0x5b')](_0x5d065c[_0x8215('0x51')][_0x8215('0x5c')],_0x5d065c['body']['type']);_0x5d065c['body'][_0x8215('0x5d')]=integrations['getDescriptions'](_0x5d065c['body'][_0x8215('0x5c')],_0x5d065c[_0x8215('0x51')][_0x8215('0x38')]);return db[_0x8215('0x56')]['create'](_0x5d065c[_0x8215('0x51')],{'include':[{'model':db[_0x8215('0x5e')],'as':_0x8215('0x5a')},{'model':db[_0x8215('0x5e')],'as':_0x8215('0x5d')}]});}return null;})[_0x8215('0x1d')](respondWithResult(_0x3a1019,null))[_0x8215('0x4d')](handleError(_0x3a1019,null));};exports[_0x8215('0x5f')]=function(_0x2c6db4,_0x146b7b,_0x2fba82){var _0x783f09='';var _0x31cf8f=['id','name',_0x8215('0x60'),'created_by','description',_0x8215('0x61'),_0x8215('0x62'),_0x8215('0x63'),'parent_id',_0x8215('0x64'),_0x8215('0x65'),_0x8215('0x66')];return db[_0x8215('0x36')][_0x8215('0x55')]({'where':{'id':_0x2c6db4[_0x8215('0x52')]['id']},'attributes':['id',_0x8215('0x67'),_0x8215('0x68'),_0x8215('0x69')]})['then'](handleEntityNotFound(_0x146b7b,null))[_0x8215('0x1d')](function(_0x1ff152){if(_0x1ff152){_0x783f09=_0x1ff152[_0x8215('0x69')];var _0xa080b8=_0x783f09['slice'](-0x1);if(_0xa080b8==='/'){_0x783f09=_0x783f09[_0x8215('0x6a')](0x0,_0x783f09[_0x8215('0x6b')](_0xa080b8));}return rp({'method':_0x8215('0x6c'),'uri':util[_0x8215('0x6d')](_0x8215('0x6e'),_0x783f09,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x8215('0x6f'),'input_type':_0x8215('0x70'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x1ff152[_0x8215('0x67')],'password':_0x1ff152[_0x8215('0x68')],'encryption':_0x8215('0x71')},'application':_0x8215('0x72')})}});}})[_0x8215('0x1d')](function(_0x4fd30c){if(_0x4fd30c&&_0x4fd30c[_0x8215('0x32')]!==_0x8215('0x73')&&_0x4fd30c['name']!==_0x8215('0x74')){return rp({'method':_0x8215('0x6c'),'uri':util['format'](_0x8215('0x6e'),_0x783f09,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x8215('0x75'),'input_type':_0x8215('0x70'),'response_type':'JSON','rest_data':JSON[_0x8215('0x23')]({'session':_0x4fd30c['id'],'module_name':_0x8215('0x76')})}})['then'](function(_0x200ea4){if(_0x200ea4){var _0x1e6972=_[_0x8215('0x77')](_0x200ea4['module_fields']);_['remove'](_0x1e6972,function(_0x2be00d){return _0x31cf8f[_0x8215('0x78')](_0x2be00d['name']);});return{'count':_0x1e6972['length'],'rows':_['map'](_0x1e6972,function(_0x46d451){return{'id':_0x46d451[_0x8215('0x32')],'name':_0x46d451['label'],'custom':_[_0x8215('0x79')](_0x46d451[_0x8215('0x32')],'_c')?!![]:![],'options':_0x46d451[_0x8215('0x49')]?_['map'](_['values'](_0x46d451['options']),function(_0x42ad86){return{'name':_0x42ad86[_0x8215('0x7a')],'value':_0x42ad86[_0x8215('0x32')]};}):[]};})};}})[_0x8215('0x1d')](respondWithResult(_0x146b7b,null))['catch'](function(_0x29b827){var _0x33dbbc=_0x2c6db4['query'][_0x8215('0x7b')]?0x1f4:_0x29b827['statusCode']||0x1f4;logger[_0x8215('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x8215('0x5f'),_0x33dbbc,JSON['stringify'](_0x29b827));delete _0x29b827[_0x8215('0x32')];if(_0x33dbbc===0x191){_0x33dbbc=0x190;}_0x146b7b[_0x8215('0x2a')](_0x33dbbc)[_0x8215('0x33')](_0x2c6db4[_0x8215('0x3e')][_0x8215('0x7b')]?{'message':_0x8215('0x7c'),'statusCode':_0x29b827['statusCode']}:_0x29b827);});}else{var _0x1dfe58=0x1f4;_0x146b7b[_0x8215('0x2a')](_0x1dfe58)[_0x8215('0x33')]({'message':'Wrong\x20credentials','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 16ebfba..c24dbaf 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 _0xdb6a=['bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','util'];(function(_0x5d7227,_0x12aebe){var _0x15ac55=function(_0x58d13e){while(--_0x58d13e){_0x5d7227['push'](_0x5d7227['shift']());}};_0x15ac55(++_0x12aebe);}(_0xdb6a,0x102));var _0xadb6=function(_0x34d5d7,_0x22ea94){_0x34d5d7=_0x34d5d7-0x0;var _0x39d597=_0xdb6a[_0x34d5d7];return _0x39d597;};'use strict';var _=require(_0xadb6('0x0'));var util=require(_0xadb6('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xadb6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xadb6('0x3'));var rimraf=require(_0xadb6('0x4'));var config=require(_0xadb6('0x5'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xadb6('0x6'));module[_0xadb6('0x7')]=function(_0x5d4680,_0x5cd190){return _0x5d4680['define'](_0xadb6('0x8'),attributes,{'tableName':_0xadb6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00b4=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','int_sugarcrm_accounts'];(function(_0x46428c,_0x20ab75){var _0x16a677=function(_0x2b0817){while(--_0x2b0817){_0x46428c['push'](_0x46428c['shift']());}};_0x16a677(++_0x20ab75);}(_0x00b4,0x18c));var _0x400b=function(_0x3cdda2,_0x4d2094){_0x3cdda2=_0x3cdda2-0x0;var _0x5ae51d=_0x00b4[_0x3cdda2];return _0x5ae51d;};'use strict';var _=require('lodash');var util=require(_0x400b('0x0'));var logger=require(_0x400b('0x1'))(_0x400b('0x2'));var moment=require(_0x400b('0x3'));var BPromise=require(_0x400b('0x4'));var rp=require(_0x400b('0x5'));var fs=require('fs');var path=require(_0x400b('0x6'));var rimraf=require(_0x400b('0x7'));var config=require(_0x400b('0x8'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x400b('0x9'));module['exports']=function(_0xfecca6,_0x2fce24){return _0xfecca6['define']('SugarcrmAccount',attributes,{'tableName':_0x400b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 310c2f6..712406e 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 _0x6e88=['request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SugarcrmAccount','options','raw','where','attributes','limit','include','map','model','GetSugarcrmAccount','debug','ShowSugarcrmAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s'];(function(_0x546f97,_0x4a6ec5){var _0x2b1ed2=function(_0x91a22f){while(--_0x91a22f){_0x546f97['push'](_0x546f97['shift']());}};_0x2b1ed2(++_0x4a6ec5);}(_0x6e88,0xec));var _0x86e8=function(_0x35ab2d,_0x1c3c15){_0x35ab2d=_0x35ab2d-0x0;var _0x22baea=_0x6e88[_0x35ab2d];return _0x22baea;};'use strict';var _=require('lodash');var util=require(_0x86e8('0x0'));var moment=require(_0x86e8('0x1'));var BPromise=require(_0x86e8('0x2'));var rs=require(_0x86e8('0x3'));var fs=require('fs');var Redis=require(_0x86e8('0x4'));var db=require(_0x86e8('0x5'))['db'];var utils=require(_0x86e8('0x6'));var logger=require(_0x86e8('0x7'))(_0x86e8('0x8'));var config=require('../../config/environment');var jayson=require(_0x86e8('0x9'));var client=jayson[_0x86e8('0xa')][_0x86e8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c6610,_0x42dd0d,_0xba16a1){return new BPromise(function(_0xcadae6,_0x1a3192){return client[_0x86e8('0xc')](_0x5c6610,_0xba16a1)[_0x86e8('0xd')](function(_0xfc7921){logger[_0x86e8('0xe')](_0x86e8('0xf'),_0x42dd0d,_0x86e8('0x10'));logger['debug'](_0x86e8('0x11'),_0x42dd0d,_0x86e8('0x10'),JSON[_0x86e8('0x12')](_0xfc7921));if(_0xfc7921['error']){if(_0xfc7921[_0x86e8('0x13')][_0x86e8('0x14')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x42dd0d,_0xfc7921[_0x86e8('0x13')][_0x86e8('0x15')]);return _0x1a3192(_0xfc7921[_0x86e8('0x13')][_0x86e8('0x15')]);}logger[_0x86e8('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x42dd0d,_0xfc7921[_0x86e8('0x13')][_0x86e8('0x15')]);return _0xcadae6(_0xfc7921['error'][_0x86e8('0x15')]);}else{logger['info'](_0x86e8('0xf'),_0x42dd0d,_0x86e8('0x10'));_0xcadae6(_0xfc7921[_0x86e8('0x16')]['message']);}})[_0x86e8('0x17')](function(_0x233d85){logger['error'](_0x86e8('0xf'),_0x42dd0d,_0x233d85);_0x1a3192(_0x233d85);});});}exports['GetSugarcrmAccount']=function(_0x94ca45){var _0x2e70b8=this;return new Promise(function(_0x12077f,_0x2aba9c){return db[_0x86e8('0x18')]['findAll']({'raw':_0x94ca45[_0x86e8('0x19')]?_0x94ca45['options'][_0x86e8('0x1a')]===undefined?!![]:![]:!![],'where':_0x94ca45[_0x86e8('0x19')]?_0x94ca45['options'][_0x86e8('0x1b')]||null:null,'attributes':_0x94ca45[_0x86e8('0x19')]?_0x94ca45[_0x86e8('0x19')][_0x86e8('0x1c')]||null:null,'limit':_0x94ca45['options']?_0x94ca45[_0x86e8('0x19')][_0x86e8('0x1d')]||null:null,'include':_0x94ca45[_0x86e8('0x19')]?_0x94ca45['options'][_0x86e8('0x1e')]?_[_0x86e8('0x1f')](_0x94ca45['options'][_0x86e8('0x1e')],function(_0x4fe862){return{'model':db[_0x4fe862[_0x86e8('0x20')]],'as':_0x4fe862['as'],'attributes':_0x4fe862[_0x86e8('0x1c')],'include':_0x4fe862[_0x86e8('0x1e')]?_[_0x86e8('0x1f')](_0x4fe862[_0x86e8('0x1e')],function(_0x177800){return{'model':db[_0x177800[_0x86e8('0x20')]],'as':_0x177800['as'],'attributes':_0x177800[_0x86e8('0x1c')],'include':_0x177800[_0x86e8('0x1e')]?_['map'](_0x177800['include'],function(_0x3b72b5){return{'model':db[_0x3b72b5[_0x86e8('0x20')]],'as':_0x3b72b5['as'],'attributes':_0x3b72b5[_0x86e8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x86e8('0xd')](function(_0x3ef255){logger['info'](_0x86e8('0x21'),_0x94ca45);logger[_0x86e8('0x22')]('GetSugarcrmAccount',_0x94ca45,JSON[_0x86e8('0x12')](_0x3ef255));_0x12077f(_0x3ef255);})[_0x86e8('0x17')](function(_0x9437b9){logger[_0x86e8('0x13')](_0x86e8('0x21'),_0x9437b9[_0x86e8('0x15')],_0x94ca45);_0x2aba9c(_0x2e70b8[_0x86e8('0x13')](0x1f4,_0x9437b9[_0x86e8('0x15')]));});});};exports[_0x86e8('0x23')]=function(_0xe028a3){var _0x1420cf=this;return new Promise(function(_0x32f9e6,_0x31f2ea){return db['SugarcrmAccount']['find']({'raw':_0xe028a3[_0x86e8('0x19')]?_0xe028a3[_0x86e8('0x19')][_0x86e8('0x1a')]===undefined?!![]:![]:!![],'where':_0xe028a3['options']?_0xe028a3[_0x86e8('0x19')][_0x86e8('0x1b')]||null:null,'attributes':_0xe028a3[_0x86e8('0x19')]?_0xe028a3[_0x86e8('0x19')]['attributes']||null:null,'include':_0xe028a3[_0x86e8('0x19')]?_0xe028a3[_0x86e8('0x19')][_0x86e8('0x1e')]?_[_0x86e8('0x1f')](_0xe028a3[_0x86e8('0x19')]['include'],function(_0x9a7068){return{'model':db[_0x9a7068['model']],'as':_0x9a7068['as'],'attributes':_0x9a7068[_0x86e8('0x1c')],'include':_0x9a7068[_0x86e8('0x1e')]?_[_0x86e8('0x1f')](_0x9a7068['include'],function(_0xcc2528){return{'model':db[_0xcc2528[_0x86e8('0x20')]],'as':_0xcc2528['as'],'attributes':_0xcc2528[_0x86e8('0x1c')],'include':_0xcc2528[_0x86e8('0x1e')]?_[_0x86e8('0x1f')](_0xcc2528[_0x86e8('0x1e')],function(_0x3e559e){return{'model':db[_0x3e559e['model']],'as':_0x3e559e['as'],'attributes':_0x3e559e[_0x86e8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x86e8('0xd')](function(_0x1acc56){logger['info'](_0x86e8('0x23'),_0xe028a3);logger[_0x86e8('0x22')](_0x86e8('0x23'),_0xe028a3,JSON[_0x86e8('0x12')](_0x1acc56));_0x32f9e6(_0x1acc56);})['catch'](function(_0x39f238){logger[_0x86e8('0x13')](_0x86e8('0x23'),_0x39f238['message'],_0xe028a3);_0x31f2ea(_0x1420cf[_0x86e8('0x13')](0x1f4,_0x39f238[_0x86e8('0x15')]));});});}; \ No newline at end of file +var _0x4cee=['SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowSugarcrmAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount'];(function(_0x150c69,_0x46c27e){var _0x43eb15=function(_0x2849cf){while(--_0x2849cf){_0x150c69['push'](_0x150c69['shift']());}};_0x43eb15(++_0x46c27e);}(_0x4cee,0xcf));var _0xe4ce=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x4cee[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0xe4ce('0x0'));var util=require(_0xe4ce('0x1'));var moment=require(_0xe4ce('0x2'));var BPromise=require(_0xe4ce('0x3'));var rs=require(_0xe4ce('0x4'));var fs=require('fs');var Redis=require(_0xe4ce('0x5'));var db=require(_0xe4ce('0x6'))['db'];var utils=require(_0xe4ce('0x7'));var logger=require(_0xe4ce('0x8'))(_0xe4ce('0x9'));var config=require(_0xe4ce('0xa'));var jayson=require(_0xe4ce('0xb'));var client=jayson[_0xe4ce('0xc')][_0xe4ce('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x47864d,_0x219959,_0x2a42f8){return new BPromise(function(_0x1b1c17,_0xb3a5ae){return client['request'](_0x47864d,_0x2a42f8)[_0xe4ce('0xe')](function(_0x11e779){logger[_0xe4ce('0xf')](_0xe4ce('0x10'),_0x219959,_0xe4ce('0x11'));logger[_0xe4ce('0x12')](_0xe4ce('0x13'),_0x219959,_0xe4ce('0x11'),JSON[_0xe4ce('0x14')](_0x11e779));if(_0x11e779['error']){if(_0x11e779[_0xe4ce('0x15')][_0xe4ce('0x16')]===0x1f4){logger[_0xe4ce('0x15')](_0xe4ce('0x10'),_0x219959,_0x11e779[_0xe4ce('0x15')][_0xe4ce('0x17')]);return _0xb3a5ae(_0x11e779[_0xe4ce('0x15')][_0xe4ce('0x17')]);}logger[_0xe4ce('0x15')](_0xe4ce('0x10'),_0x219959,_0x11e779[_0xe4ce('0x15')]['message']);return _0x1b1c17(_0x11e779[_0xe4ce('0x15')][_0xe4ce('0x17')]);}else{logger[_0xe4ce('0xf')](_0xe4ce('0x10'),_0x219959,'request\x20sent');_0x1b1c17(_0x11e779[_0xe4ce('0x18')]['message']);}})[_0xe4ce('0x19')](function(_0x148af8){logger['error'](_0xe4ce('0x10'),_0x219959,_0x148af8);_0xb3a5ae(_0x148af8);});});}exports[_0xe4ce('0x1a')]=function(_0x1a8442){var _0x2731d5=this;return new Promise(function(_0x2b5cab,_0x198004){return db[_0xe4ce('0x1b')][_0xe4ce('0x1c')]({'raw':_0x1a8442[_0xe4ce('0x1d')]?_0x1a8442[_0xe4ce('0x1d')][_0xe4ce('0x1e')]===undefined?!![]:![]:!![],'where':_0x1a8442[_0xe4ce('0x1d')]?_0x1a8442[_0xe4ce('0x1d')][_0xe4ce('0x1f')]||null:null,'attributes':_0x1a8442[_0xe4ce('0x1d')]?_0x1a8442[_0xe4ce('0x1d')][_0xe4ce('0x20')]||null:null,'limit':_0x1a8442['options']?_0x1a8442[_0xe4ce('0x1d')][_0xe4ce('0x21')]||null:null,'include':_0x1a8442[_0xe4ce('0x1d')]?_0x1a8442[_0xe4ce('0x1d')][_0xe4ce('0x22')]?_[_0xe4ce('0x23')](_0x1a8442[_0xe4ce('0x1d')][_0xe4ce('0x22')],function(_0x26b343){return{'model':db[_0x26b343[_0xe4ce('0x24')]],'as':_0x26b343['as'],'attributes':_0x26b343[_0xe4ce('0x20')],'include':_0x26b343['include']?_[_0xe4ce('0x23')](_0x26b343[_0xe4ce('0x22')],function(_0x5af5c1){return{'model':db[_0x5af5c1[_0xe4ce('0x24')]],'as':_0x5af5c1['as'],'attributes':_0x5af5c1['attributes'],'include':_0x5af5c1[_0xe4ce('0x22')]?_[_0xe4ce('0x23')](_0x5af5c1['include'],function(_0x468ac7){return{'model':db[_0x468ac7['model']],'as':_0x468ac7['as'],'attributes':_0x468ac7[_0xe4ce('0x20')]};}):[]};}):[]};}):[]:[]})[_0xe4ce('0xe')](function(_0x31b276){logger['info'](_0xe4ce('0x1a'),_0x1a8442);logger[_0xe4ce('0x12')](_0xe4ce('0x1a'),_0x1a8442,JSON[_0xe4ce('0x14')](_0x31b276));_0x2b5cab(_0x31b276);})[_0xe4ce('0x19')](function(_0x320083){logger[_0xe4ce('0x15')](_0xe4ce('0x1a'),_0x320083[_0xe4ce('0x17')],_0x1a8442);_0x198004(_0x2731d5['error'](0x1f4,_0x320083[_0xe4ce('0x17')]));});});};exports[_0xe4ce('0x25')]=function(_0x3953a4){var _0x318960=this;return new Promise(function(_0x3e296f,_0x43dad1){return db[_0xe4ce('0x1b')][_0xe4ce('0x26')]({'raw':_0x3953a4['options']?_0x3953a4[_0xe4ce('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3953a4['options']?_0x3953a4[_0xe4ce('0x1d')]['where']||null:null,'attributes':_0x3953a4[_0xe4ce('0x1d')]?_0x3953a4[_0xe4ce('0x1d')][_0xe4ce('0x20')]||null:null,'include':_0x3953a4[_0xe4ce('0x1d')]?_0x3953a4[_0xe4ce('0x1d')][_0xe4ce('0x22')]?_['map'](_0x3953a4[_0xe4ce('0x1d')][_0xe4ce('0x22')],function(_0x1e774b){return{'model':db[_0x1e774b[_0xe4ce('0x24')]],'as':_0x1e774b['as'],'attributes':_0x1e774b['attributes'],'include':_0x1e774b['include']?_[_0xe4ce('0x23')](_0x1e774b[_0xe4ce('0x22')],function(_0x5951fa){return{'model':db[_0x5951fa[_0xe4ce('0x24')]],'as':_0x5951fa['as'],'attributes':_0x5951fa[_0xe4ce('0x20')],'include':_0x5951fa[_0xe4ce('0x22')]?_[_0xe4ce('0x23')](_0x5951fa[_0xe4ce('0x22')],function(_0x12e3a3){return{'model':db[_0x12e3a3[_0xe4ce('0x24')]],'as':_0x12e3a3['as'],'attributes':_0x12e3a3[_0xe4ce('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d4546){logger[_0xe4ce('0xf')](_0xe4ce('0x25'),_0x3953a4);logger['debug'](_0xe4ce('0x25'),_0x3953a4,JSON[_0xe4ce('0x14')](_0x2d4546));_0x3e296f(_0x2d4546);})['catch'](function(_0xfbc990){logger['error']('ShowSugarcrmAccount',_0xfbc990[_0xe4ce('0x17')],_0x3953a4);_0x43dad1(_0x318960[_0xe4ce('0x15')](0x1f4,_0xfbc990[_0xe4ce('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index f2dfa17..1327e2f 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 _0xd6e0=['index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated'];(function(_0x181c46,_0x3cc3a1){var _0x50e841=function(_0x2cd7de){while(--_0x2cd7de){_0x181c46['push'](_0x181c46['shift']());}};_0x50e841(++_0x3cc3a1);}(_0xd6e0,0x1ef));var _0x0d6e=function(_0x5756f8,_0x22b6d5){_0x5756f8=_0x5756f8-0x0;var _0x3bb749=_0xd6e0[_0x5756f8];return _0x3bb749;};'use strict';var multer=require(_0x0d6e('0x0'));var util=require(_0x0d6e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0d6e('0x2'));var router=express[_0x0d6e('0x3')]();var auth=require(_0x0d6e('0x4'));var interaction=require(_0x0d6e('0x5'));var config=require('../../config/environment');var controller=require(_0x0d6e('0x6'));router[_0x0d6e('0x7')]('/',auth[_0x0d6e('0x8')](),controller[_0x0d6e('0x9')]);router[_0x0d6e('0x7')](_0x0d6e('0xa'),auth[_0x0d6e('0x8')](),controller[_0x0d6e('0xb')]);router[_0x0d6e('0x7')](_0x0d6e('0xc'),auth[_0x0d6e('0x8')](),controller[_0x0d6e('0xd')]);router[_0x0d6e('0x7')](_0x0d6e('0xe'),auth[_0x0d6e('0x8')](),controller['getSubjects']);router[_0x0d6e('0x7')](_0x0d6e('0xf'),auth[_0x0d6e('0x8')](),controller[_0x0d6e('0x10')]);router[_0x0d6e('0x11')]('/',auth[_0x0d6e('0x8')](),controller[_0x0d6e('0x12')]);router['put'](_0x0d6e('0xa'),auth[_0x0d6e('0x8')](),controller['update']);router['delete'](_0x0d6e('0xa'),auth[_0x0d6e('0x8')](),controller[_0x0d6e('0x13')]);module[_0x0d6e('0x14')]=router; \ No newline at end of file +var _0x1476=['isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','destroy','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','get'];(function(_0x127183,_0x3f01b1){var _0x5a6f5a=function(_0x5f2a10){while(--_0x5f2a10){_0x127183['push'](_0x127183['shift']());}};_0x5a6f5a(++_0x3f01b1);}(_0x1476,0x15e));var _0x6147=function(_0x3711dd,_0x2e4d08){_0x3711dd=_0x3711dd-0x0;var _0x4a551d=_0x1476[_0x3711dd];return _0x4a551d;};'use strict';var multer=require(_0x6147('0x0'));var util=require(_0x6147('0x1'));var path=require('path');var timeout=require(_0x6147('0x2'));var express=require(_0x6147('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6147('0x4'));var config=require(_0x6147('0x5'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x6147('0x6')]('/',auth[_0x6147('0x7')](),controller[_0x6147('0x8')]);router[_0x6147('0x6')](_0x6147('0x9'),auth['isAuthenticated'](),controller[_0x6147('0xa')]);router[_0x6147('0x6')](_0x6147('0xb'),auth[_0x6147('0x7')](),controller[_0x6147('0xc')]);router['get'](_0x6147('0xd'),auth[_0x6147('0x7')](),controller[_0x6147('0xe')]);router['get'](_0x6147('0xf'),auth[_0x6147('0x7')](),controller[_0x6147('0x10')]);router[_0x6147('0x11')]('/',auth[_0x6147('0x7')](),controller['create']);router[_0x6147('0x12')](_0x6147('0x9'),auth[_0x6147('0x7')](),controller['update']);router['delete'](_0x6147('0x9'),auth[_0x6147('0x7')](),controller[_0x6147('0x13')]);module[_0x6147('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index f839d5c..90ed0a6 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 _0xb319=['STRING','sequelize'];(function(_0x22ce3a,_0xf4a6d4){var _0x4be173=function(_0x48acdf){while(--_0x48acdf){_0x22ce3a['push'](_0x22ce3a['shift']());}};_0x4be173(++_0xf4a6d4);}(_0xb319,0x18b));var _0x9b31=function(_0x190cc5,_0x3aa467){_0x190cc5=_0x190cc5-0x0;var _0x23b67c=_0xb319[_0x190cc5];return _0x23b67c;};'use strict';var Sequelize=require(_0x9b31('0x0'));module['exports']={'name':{'type':Sequelize[_0x9b31('0x1')]},'description':{'type':Sequelize[_0x9b31('0x1')]}}; \ No newline at end of file +var _0x2baa=['exports','STRING','sequelize'];(function(_0x5a518a,_0xd6234d){var _0x79acaa=function(_0x3e2093){while(--_0x3e2093){_0x5a518a['push'](_0x5a518a['shift']());}};_0x79acaa(++_0xd6234d);}(_0x2baa,0x19d));var _0xa2ba=function(_0x595de7,_0x19a2e8){_0x595de7=_0x595de7-0x0;var _0x39dab9=_0x2baa[_0x595de7];return _0x39dab9;};'use strict';var Sequelize=require(_0xa2ba('0x0'));module[_0xa2ba('0x1')]={'name':{'type':Sequelize[_0xa2ba('0x2')]},'description':{'type':Sequelize[_0xa2ba('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index d0cf897..12b61fd 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 _0x4186=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','apply','destroy','stack','name','index','SugarcrmConfiguration','rawAttributes','model','map','query','filters','attributes','fields','length','limit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','show','params','keys','intersection','find','create','body','getFields','findOne','hasOwnProperty','getSubjects','SugarcrmField','getDescriptions','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x193e28,_0x3dac1d){var _0x20ef59=function(_0x48047e){while(--_0x48047e){_0x193e28['push'](_0x193e28['shift']());}};_0x20ef59(++_0x3dac1d);}(_0x4186,0xfd));var _0x6418=function(_0x3a6e4b,_0x118cd9){_0x3a6e4b=_0x3a6e4b-0x0;var _0x36572d=_0x4186[_0x3a6e4b];return _0x36572d;};'use strict';var pdf=require(_0x6418('0x0'));var emlformat=require(_0x6418('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6418('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6418('0x3'));var moment=require(_0x6418('0x4'));var BPromise=require(_0x6418('0x5'));var Mustache=require(_0x6418('0x6'));var util=require(_0x6418('0x7'));var path=require(_0x6418('0x8'));var sox=require(_0x6418('0x9'));var csv=require(_0x6418('0xa'));var ejs=require(_0x6418('0xb'));var fs=require('fs');var _=require(_0x6418('0xc'));var squel=require(_0x6418('0xd'));var crypto=require(_0x6418('0xe'));var jsforce=require(_0x6418('0xf'));var deskjs=require(_0x6418('0x10'));var toCsv=require(_0x6418('0xa'));var querystring=require('querystring');var Papa=require(_0x6418('0x11'));var Redis=require(_0x6418('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6418('0x13'));var as=require(_0x6418('0x14'));var hardwareService=require(_0x6418('0x15'));var logger=require(_0x6418('0x16'))(_0x6418('0x17'));var utils=require(_0x6418('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x6418('0x19'));var db=require(_0x6418('0x1a'))['db'];var jayson=require(_0x6418('0x1b'));var client=jayson[_0x6418('0x1c')][_0x6418('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x339234,_0x42e68f,_0xecb9b,_0xb0c920){return new BPromise(function(_0x418f54,_0x3b6c79){var _0x2d6332=_0xb0c920||client;return _0x2d6332[_0x6418('0x1e')](_0x339234,_0xecb9b)[_0x6418('0x1f')](function(_0x2fcfcf){logger['info'](_0x6418('0x20'),_0x42e68f,_0x6418('0x21'));logger[_0x6418('0x22')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x42e68f,_0x6418('0x21'),JSON[_0x6418('0x23')](_0x2fcfcf));if(_0x2fcfcf[_0x6418('0x24')]){if(_0x2fcfcf[_0x6418('0x24')][_0x6418('0x25')]===0x1f4){logger[_0x6418('0x24')](_0x6418('0x20'),_0x42e68f,_0x2fcfcf[_0x6418('0x24')]['message']);return _0x3b6c79(_0x2fcfcf[_0x6418('0x24')][_0x6418('0x26')]);}logger['error'](_0x6418('0x20'),_0x42e68f,_0x2fcfcf['error'][_0x6418('0x26')]);return _0x418f54(_0x2fcfcf[_0x6418('0x24')]['message']);}else{logger[_0x6418('0x27')](_0x6418('0x20'),_0x42e68f,_0x6418('0x21'));_0x418f54(_0x2fcfcf[_0x6418('0x28')]['message']);}})[_0x6418('0x29')](function(_0x4697a9){logger[_0x6418('0x24')](_0x6418('0x20'),_0x42e68f,_0x4697a9);_0x3b6c79(_0x4697a9);});});}function respondWithStatusCode(_0xe34e05,_0x1528be){_0x1528be=_0x1528be||0xcc;return function(_0x156ac0){if(_0x156ac0){return _0xe34e05[_0x6418('0x2a')](_0x1528be);}return _0xe34e05[_0x6418('0x2b')](_0x1528be)[_0x6418('0x2c')]();};}function respondWithResult(_0x30e714,_0x2a944e){_0x2a944e=_0x2a944e||0xc8;return function(_0x45745a){if(_0x45745a){return _0x30e714[_0x6418('0x2b')](_0x2a944e)['json'](_0x45745a);}};}function respondWithFilteredResult(_0x2ddbdc,_0x27e567){return function(_0x3ff0f9){if(_0x3ff0f9){var _0xa31171=_0x3ff0f9[_0x6418('0x2d')],_0x40916e=_0x27e567[_0x6418('0x2e')],_0x7827fa=_0x27e567['offset']+_0x27e567['limit'],_0x1d1ca8;if(_0x7827fa>=_0xa31171){_0x7827fa=_0xa31171;_0x1d1ca8=0xc8;}else{_0x1d1ca8=0xce;}_0x2ddbdc[_0x6418('0x2b')](_0x1d1ca8);return _0x2ddbdc[_0x6418('0x2f')](_0x6418('0x30'),_0x40916e+'-'+_0x7827fa+'/'+_0xa31171)[_0x6418('0x31')](_0x3ff0f9);}return null;};}function patchUpdates(_0x11a46e){return function(_0xa945e9){try{jsonpatch[_0x6418('0x32')](_0xa945e9,_0x11a46e,!![]);}catch(_0x51f783){return BPromise['reject'](_0x51f783);}return _0xa945e9['save']();};}function saveUpdates(_0x10bbec,_0x1d422b){return function(_0x39d136){if(_0x39d136){return _0x39d136['update'](_0x10bbec)['then'](function(_0x4e7185){return _0x4e7185;});}return null;};}function removeEntity(_0x2951ac,_0x1bcc0f){return function(_0x1a4136){if(_0x1a4136){return _0x1a4136[_0x6418('0x33')]()['then'](function(){_0x2951ac[_0x6418('0x2b')](0xcc)[_0x6418('0x2c')]();});}};}function handleEntityNotFound(_0x20d1a7,_0x2f84b7){return function(_0xceaa59){if(!_0xceaa59){_0x20d1a7[_0x6418('0x2a')](0x194);}return _0xceaa59;};}function handleError(_0x483500,_0x1e6703){_0x1e6703=_0x1e6703||0x1f4;return function(_0x20430e){logger[_0x6418('0x24')](_0x20430e[_0x6418('0x34')]);if(_0x20430e[_0x6418('0x35')]){delete _0x20430e[_0x6418('0x35')];}_0x483500[_0x6418('0x2b')](_0x1e6703)['send'](_0x20430e);};}exports[_0x6418('0x36')]=function(_0x3659e9,_0x249a3d){var _0x3bdc5e={},_0x36beba={},_0x270ca6={'count':0x0,'rows':[]};var _0x17da3c=_['map'](db[_0x6418('0x37')][_0x6418('0x38')],function(_0x439f80){return{'name':_0x439f80['fieldName'],'type':_0x439f80['type']['key']};});_0x36beba[_0x6418('0x39')]=_[_0x6418('0x3a')](_0x17da3c,_0x6418('0x35'));_0x36beba[_0x6418('0x3b')]=_['keys'](_0x3659e9['query']);_0x36beba[_0x6418('0x3c')]=_['intersection'](_0x36beba['model'],_0x36beba['query']);_0x3bdc5e[_0x6418('0x3d')]=_['intersection'](_0x36beba[_0x6418('0x39')],qs[_0x6418('0x3e')](_0x3659e9[_0x6418('0x3b')][_0x6418('0x3e')]));_0x3bdc5e['attributes']=_0x3bdc5e[_0x6418('0x3d')][_0x6418('0x3f')]?_0x3bdc5e['attributes']:_0x36beba['model'];if(!_0x3659e9[_0x6418('0x3b')]['hasOwnProperty']('nolimit')){_0x3bdc5e[_0x6418('0x40')]=qs[_0x6418('0x40')](_0x3659e9[_0x6418('0x3b')]['limit']);_0x3bdc5e['offset']=qs[_0x6418('0x2e')](_0x3659e9['query'][_0x6418('0x2e')]);}_0x3bdc5e[_0x6418('0x41')]=qs['sort'](_0x3659e9[_0x6418('0x3b')][_0x6418('0x42')]);_0x3bdc5e[_0x6418('0x43')]=qs[_0x6418('0x3c')](_[_0x6418('0x44')](_0x3659e9[_0x6418('0x3b')],_0x36beba['filters']),_0x17da3c);if(_0x3659e9[_0x6418('0x3b')][_0x6418('0x45')]){_0x3bdc5e[_0x6418('0x43')]=_[_0x6418('0x46')](_0x3bdc5e['where'],{'$or':_[_0x6418('0x3a')](_0x17da3c,function(_0x2487d0){if(_0x2487d0[_0x6418('0x47')]!=='VIRTUAL'){var _0x5b9888={};_0x5b9888[_0x2487d0[_0x6418('0x35')]]={'$like':'%'+_0x3659e9[_0x6418('0x3b')][_0x6418('0x45')]+'%'};return _0x5b9888;}})});}_0x3bdc5e=_[_0x6418('0x46')]({},_0x3bdc5e,_0x3659e9[_0x6418('0x48')]);var _0x51f6fc={'where':_0x3bdc5e[_0x6418('0x43')]};return db[_0x6418('0x37')][_0x6418('0x2d')](_0x51f6fc)[_0x6418('0x1f')](function(_0x2809e){_0x270ca6['count']=_0x2809e;if(_0x3659e9[_0x6418('0x3b')][_0x6418('0x49')]){_0x3bdc5e[_0x6418('0x4a')]=[{'all':!![]}];}return db[_0x6418('0x37')][_0x6418('0x4b')](_0x3bdc5e);})[_0x6418('0x1f')](function(_0x2a8efc){_0x270ca6['rows']=_0x2a8efc;return _0x270ca6;})[_0x6418('0x1f')](respondWithFilteredResult(_0x249a3d,_0x3bdc5e))[_0x6418('0x29')](handleError(_0x249a3d,null));};exports[_0x6418('0x4c')]=function(_0x384e4c,_0x7c6ec4){var _0x51ae6b={'raw':![],'where':{'id':_0x384e4c[_0x6418('0x4d')]['id']}},_0x4174a1={};_0x4174a1[_0x6418('0x39')]=_[_0x6418('0x4e')](db['SugarcrmConfiguration'][_0x6418('0x38')]);_0x4174a1['query']=_['keys'](_0x384e4c[_0x6418('0x3b')]);_0x4174a1[_0x6418('0x3c')]=_[_0x6418('0x4f')](_0x4174a1[_0x6418('0x39')],_0x4174a1[_0x6418('0x3b')]);_0x51ae6b[_0x6418('0x3d')]=_[_0x6418('0x4f')](_0x4174a1[_0x6418('0x39')],qs[_0x6418('0x3e')](_0x384e4c[_0x6418('0x3b')]['fields']));_0x51ae6b[_0x6418('0x3d')]=_0x51ae6b['attributes'][_0x6418('0x3f')]?_0x51ae6b['attributes']:_0x4174a1['model'];if(_0x384e4c[_0x6418('0x3b')][_0x6418('0x49')]){_0x51ae6b['include']=[{'all':!![]}];}_0x51ae6b=_[_0x6418('0x46')]({},_0x51ae6b,_0x384e4c[_0x6418('0x48')]);return db[_0x6418('0x37')][_0x6418('0x50')](_0x51ae6b)[_0x6418('0x1f')](handleEntityNotFound(_0x7c6ec4,null))[_0x6418('0x1f')](respondWithResult(_0x7c6ec4,null))[_0x6418('0x29')](handleError(_0x7c6ec4,null));};exports[_0x6418('0x51')]=function(_0x23bb61,_0x13b5e8){return db['SugarcrmConfiguration'][_0x6418('0x51')](_0x23bb61[_0x6418('0x52')],{})['then'](respondWithResult(_0x13b5e8,0xc9))['catch'](handleError(_0x13b5e8,null));};exports['update']=function(_0x396e3f,_0x5db265){if(_0x396e3f[_0x6418('0x52')]['id']){delete _0x396e3f[_0x6418('0x52')]['id'];}return db['SugarcrmConfiguration'][_0x6418('0x50')]({'where':{'id':_0x396e3f[_0x6418('0x4d')]['id']}})[_0x6418('0x1f')](handleEntityNotFound(_0x5db265,null))[_0x6418('0x1f')](saveUpdates(_0x396e3f[_0x6418('0x52')],null))[_0x6418('0x1f')](respondWithResult(_0x5db265,null))[_0x6418('0x29')](handleError(_0x5db265,null));};exports[_0x6418('0x33')]=function(_0x489174,_0x1ec7ce){return db[_0x6418('0x37')][_0x6418('0x50')]({'where':{'id':_0x489174[_0x6418('0x4d')]['id']}})[_0x6418('0x1f')](handleEntityNotFound(_0x1ec7ce,null))['then'](removeEntity(_0x1ec7ce,null))[_0x6418('0x29')](handleError(_0x1ec7ce,null));};exports[_0x6418('0x53')]=function(_0x387763,_0x53ff49,_0x4b06da){var _0x48b683={};var _0x2d7786={};var _0x1d1d8f;var _0x397c0b;return db[_0x6418('0x37')][_0x6418('0x54')]({'where':{'id':_0x387763['params']['id']}})[_0x6418('0x1f')](handleEntityNotFound(_0x53ff49,null))[_0x6418('0x1f')](function(_0x162e21){if(_0x162e21){_0x1d1d8f=_0x162e21;_0x2d7786[_0x6418('0x39')]=_[_0x6418('0x4e')](db['SugarcrmField']['rawAttributes']);_0x2d7786['query']=_[_0x6418('0x4e')](_0x387763['query']);_0x2d7786[_0x6418('0x3c')]=_[_0x6418('0x4f')](_0x2d7786[_0x6418('0x39')],_0x2d7786[_0x6418('0x3b')]);_0x48b683[_0x6418('0x3d')]=_[_0x6418('0x4f')](_0x2d7786[_0x6418('0x39')],qs[_0x6418('0x3e')](_0x387763['query']['fields']));_0x48b683[_0x6418('0x3d')]=_0x48b683[_0x6418('0x3d')][_0x6418('0x3f')]?_0x48b683[_0x6418('0x3d')]:_0x2d7786[_0x6418('0x39')];_0x48b683[_0x6418('0x41')]=qs[_0x6418('0x42')](_0x387763[_0x6418('0x3b')][_0x6418('0x42')]);_0x48b683[_0x6418('0x43')]=qs[_0x6418('0x3c')](_[_0x6418('0x44')](_0x387763[_0x6418('0x3b')],_0x2d7786['filters']));if(_0x387763[_0x6418('0x3b')][_0x6418('0x45')]){_0x48b683[_0x6418('0x43')]=_['merge'](_0x48b683[_0x6418('0x43')],{'$or':_[_0x6418('0x3a')](_0x48b683[_0x6418('0x3d')],function(_0x1d174d){var _0x56c393={};_0x56c393[_0x1d174d]={'$like':'%'+_0x387763['query']['filter']+'%'};return _0x56c393;})});}_0x48b683=_['merge']({},_0x48b683,_0x387763[_0x6418('0x48')]);return _0x1d1d8f[_0x6418('0x53')](_0x48b683);}})[_0x6418('0x1f')](function(_0x4cdafc){if(_0x4cdafc){_0x397c0b=_0x4cdafc[_0x6418('0x3f')];if(!_0x387763['query'][_0x6418('0x55')]('nolimit')){_0x48b683['limit']=qs[_0x6418('0x40')](_0x387763[_0x6418('0x3b')][_0x6418('0x40')]);_0x48b683[_0x6418('0x2e')]=qs[_0x6418('0x2e')](_0x387763['query'][_0x6418('0x2e')]);}return _0x1d1d8f[_0x6418('0x53')](_0x48b683);}})[_0x6418('0x1f')](function(_0x1bf0a6){if(_0x1bf0a6){return _0x1bf0a6?{'count':_0x397c0b,'rows':_0x1bf0a6}:null;}})['then'](respondWithResult(_0x53ff49,null))[_0x6418('0x29')](handleError(_0x53ff49,null));};exports[_0x6418('0x56')]=function(_0x32544a,_0x5ccaf3,_0x5b9368){var _0xd6b31a={};var _0xab3f25={};var _0x11e55b;var _0x11a01c;return db[_0x6418('0x37')]['findOne']({'where':{'id':_0x32544a[_0x6418('0x4d')]['id']}})[_0x6418('0x1f')](handleEntityNotFound(_0x5ccaf3,null))[_0x6418('0x1f')](function(_0x1e9f62){if(_0x1e9f62){_0x11e55b=_0x1e9f62;_0xab3f25[_0x6418('0x39')]=_[_0x6418('0x4e')](db[_0x6418('0x57')][_0x6418('0x38')]);_0xab3f25[_0x6418('0x3b')]=_[_0x6418('0x4e')](_0x32544a[_0x6418('0x3b')]);_0xab3f25[_0x6418('0x3c')]=_['intersection'](_0xab3f25[_0x6418('0x39')],_0xab3f25['query']);_0xd6b31a[_0x6418('0x3d')]=_['intersection'](_0xab3f25['model'],qs[_0x6418('0x3e')](_0x32544a['query'][_0x6418('0x3e')]));_0xd6b31a['attributes']=_0xd6b31a[_0x6418('0x3d')][_0x6418('0x3f')]?_0xd6b31a[_0x6418('0x3d')]:_0xab3f25[_0x6418('0x39')];_0xd6b31a['order']=qs['sort'](_0x32544a[_0x6418('0x3b')][_0x6418('0x42')]);_0xd6b31a[_0x6418('0x43')]=qs['filters'](_[_0x6418('0x44')](_0x32544a[_0x6418('0x3b')],_0xab3f25[_0x6418('0x3c')]));if(_0x32544a[_0x6418('0x3b')][_0x6418('0x45')]){_0xd6b31a[_0x6418('0x43')]=_[_0x6418('0x46')](_0xd6b31a[_0x6418('0x43')],{'$or':_[_0x6418('0x3a')](_0xd6b31a[_0x6418('0x3d')],function(_0x3bf827){var _0xf74430={};_0xf74430[_0x3bf827]={'$like':'%'+_0x32544a[_0x6418('0x3b')][_0x6418('0x45')]+'%'};return _0xf74430;})});}_0xd6b31a=_[_0x6418('0x46')]({},_0xd6b31a,_0x32544a['options']);return _0x11e55b['getSubjects'](_0xd6b31a);}})[_0x6418('0x1f')](function(_0x3082d0){if(_0x3082d0){_0x11a01c=_0x3082d0[_0x6418('0x3f')];if(!_0x32544a[_0x6418('0x3b')][_0x6418('0x55')]('nolimit')){_0xd6b31a[_0x6418('0x40')]=qs[_0x6418('0x40')](_0x32544a[_0x6418('0x3b')][_0x6418('0x40')]);_0xd6b31a[_0x6418('0x2e')]=qs[_0x6418('0x2e')](_0x32544a[_0x6418('0x3b')][_0x6418('0x2e')]);}return _0x11e55b[_0x6418('0x56')](_0xd6b31a);}})['then'](function(_0x293a8b){if(_0x293a8b){return _0x293a8b?{'count':_0x11a01c,'rows':_0x293a8b}:null;}})[_0x6418('0x1f')](respondWithResult(_0x5ccaf3,null))[_0x6418('0x29')](handleError(_0x5ccaf3,null));};exports[_0x6418('0x58')]=function(_0x29f570,_0x3ad369,_0x361bcf){var _0x38d57a={};var _0x2fe85e={};var _0x2ca51a;var _0x4ac16e;return db[_0x6418('0x37')][_0x6418('0x54')]({'where':{'id':_0x29f570[_0x6418('0x4d')]['id']}})[_0x6418('0x1f')](handleEntityNotFound(_0x3ad369,null))[_0x6418('0x1f')](function(_0x127b88){if(_0x127b88){_0x2ca51a=_0x127b88;_0x2fe85e[_0x6418('0x39')]=_[_0x6418('0x4e')](db[_0x6418('0x57')][_0x6418('0x38')]);_0x2fe85e[_0x6418('0x3b')]=_[_0x6418('0x4e')](_0x29f570[_0x6418('0x3b')]);_0x2fe85e[_0x6418('0x3c')]=_[_0x6418('0x4f')](_0x2fe85e['model'],_0x2fe85e[_0x6418('0x3b')]);_0x38d57a[_0x6418('0x3d')]=_[_0x6418('0x4f')](_0x2fe85e[_0x6418('0x39')],qs[_0x6418('0x3e')](_0x29f570['query']['fields']));_0x38d57a[_0x6418('0x3d')]=_0x38d57a[_0x6418('0x3d')][_0x6418('0x3f')]?_0x38d57a['attributes']:_0x2fe85e['model'];_0x38d57a[_0x6418('0x41')]=qs[_0x6418('0x42')](_0x29f570['query'][_0x6418('0x42')]);_0x38d57a[_0x6418('0x43')]=qs['filters'](_[_0x6418('0x44')](_0x29f570[_0x6418('0x3b')],_0x2fe85e[_0x6418('0x3c')]));if(_0x29f570[_0x6418('0x3b')][_0x6418('0x45')]){_0x38d57a[_0x6418('0x43')]=_[_0x6418('0x46')](_0x38d57a[_0x6418('0x43')],{'$or':_[_0x6418('0x3a')](_0x38d57a[_0x6418('0x3d')],function(_0x4e6f41){var _0xb10970={};_0xb10970[_0x4e6f41]={'$like':'%'+_0x29f570[_0x6418('0x3b')]['filter']+'%'};return _0xb10970;})});}_0x38d57a=_[_0x6418('0x46')]({},_0x38d57a,_0x29f570['options']);return _0x2ca51a['getDescriptions'](_0x38d57a);}})[_0x6418('0x1f')](function(_0x3a3434){if(_0x3a3434){_0x4ac16e=_0x3a3434[_0x6418('0x3f')];if(!_0x29f570[_0x6418('0x3b')][_0x6418('0x55')]('nolimit')){_0x38d57a[_0x6418('0x40')]=qs[_0x6418('0x40')](_0x29f570['query'][_0x6418('0x40')]);_0x38d57a[_0x6418('0x2e')]=qs['offset'](_0x29f570['query'][_0x6418('0x2e')]);}return _0x2ca51a[_0x6418('0x58')](_0x38d57a);}})['then'](function(_0x44fe77){if(_0x44fe77){return _0x44fe77?{'count':_0x4ac16e,'rows':_0x44fe77}:null;}})[_0x6418('0x1f')](respondWithResult(_0x3ad369,null))['catch'](handleError(_0x3ad369,null));}; \ No newline at end of file +var _0x64fd=['save','update','map','SugarcrmConfiguration','rawAttributes','fieldName','type','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','then','includeAll','include','show','create','body','params','destroy','getFields','findOne','sort','getSubjects','SugarcrmField','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject'];(function(_0x280d14,_0x52a64d){var _0x31e13c=function(_0x10d6fd){while(--_0x10d6fd){_0x280d14['push'](_0x280d14['shift']());}};_0x31e13c(++_0x52a64d);}(_0x64fd,0xd4));var _0xd64f=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x64fd[_0x1f9f37];return _0x21c080;};'use strict';var pdf=require(_0xd64f('0x0'));var emlformat=require(_0xd64f('0x1'));var rimraf=require(_0xd64f('0x2'));var zipdir=require(_0xd64f('0x3'));var jsonpatch=require(_0xd64f('0x4'));var rp=require('request-promise');var moment=require(_0xd64f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd64f('0x6'));var util=require('util');var path=require(_0xd64f('0x7'));var sox=require(_0xd64f('0x8'));var csv=require('to-csv');var ejs=require(_0xd64f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd64f('0xa'));var crypto=require(_0xd64f('0xb'));var jsforce=require(_0xd64f('0xc'));var deskjs=require(_0xd64f('0xd'));var toCsv=require(_0xd64f('0xe'));var querystring=require('querystring');var Papa=require(_0xd64f('0xf'));var Redis=require(_0xd64f('0x10'));var authService=require(_0xd64f('0x11'));var qs=require(_0xd64f('0x12'));var as=require(_0xd64f('0x13'));var hardwareService=require(_0xd64f('0x14'));var logger=require(_0xd64f('0x15'))('api');var utils=require(_0xd64f('0x16'));var config=require(_0xd64f('0x17'));var licenseUtil=require(_0xd64f('0x18'));var db=require(_0xd64f('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xd64f('0x1a')][_0xd64f('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2b9bd,_0x30147e,_0x5e65d1,_0x25458f){return new BPromise(function(_0x3faef7,_0x26b76b){var _0x5bd928=_0x25458f||client;return _0x5bd928[_0xd64f('0x1c')](_0x2b9bd,_0x5e65d1)['then'](function(_0x1dfd8a){logger[_0xd64f('0x1d')](_0xd64f('0x1e'),_0x30147e,'request\x20sent');logger[_0xd64f('0x1f')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x30147e,_0xd64f('0x20'),JSON[_0xd64f('0x21')](_0x1dfd8a));if(_0x1dfd8a[_0xd64f('0x22')]){if(_0x1dfd8a[_0xd64f('0x22')][_0xd64f('0x23')]===0x1f4){logger[_0xd64f('0x22')](_0xd64f('0x1e'),_0x30147e,_0x1dfd8a[_0xd64f('0x22')][_0xd64f('0x24')]);return _0x26b76b(_0x1dfd8a['error'][_0xd64f('0x24')]);}logger['error'](_0xd64f('0x1e'),_0x30147e,_0x1dfd8a[_0xd64f('0x22')]['message']);return _0x3faef7(_0x1dfd8a['error'][_0xd64f('0x24')]);}else{logger[_0xd64f('0x1d')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x30147e,_0xd64f('0x20'));_0x3faef7(_0x1dfd8a[_0xd64f('0x25')][_0xd64f('0x24')]);}})[_0xd64f('0x26')](function(_0x184ef6){logger[_0xd64f('0x22')](_0xd64f('0x1e'),_0x30147e,_0x184ef6);_0x26b76b(_0x184ef6);});});}function respondWithStatusCode(_0x3839c5,_0x44a93a){_0x44a93a=_0x44a93a||0xcc;return function(_0x106a0c){if(_0x106a0c){return _0x3839c5[_0xd64f('0x27')](_0x44a93a);}return _0x3839c5['status'](_0x44a93a)[_0xd64f('0x28')]();};}function respondWithResult(_0x474d05,_0x2ab103){_0x2ab103=_0x2ab103||0xc8;return function(_0x2e5baa){if(_0x2e5baa){return _0x474d05[_0xd64f('0x29')](_0x2ab103)[_0xd64f('0x2a')](_0x2e5baa);}};}function respondWithFilteredResult(_0x5ec449,_0x5a2dc8){return function(_0x2bf5d9){if(_0x2bf5d9){var _0x54be0e=_0x2bf5d9[_0xd64f('0x2b')],_0x2be436=_0x5a2dc8[_0xd64f('0x2c')],_0x52bf85=_0x5a2dc8[_0xd64f('0x2c')]+_0x5a2dc8[_0xd64f('0x2d')],_0x54fb2d;if(_0x52bf85>=_0x54be0e){_0x52bf85=_0x54be0e;_0x54fb2d=0xc8;}else{_0x54fb2d=0xce;}_0x5ec449['status'](_0x54fb2d);return _0x5ec449[_0xd64f('0x2e')](_0xd64f('0x2f'),_0x2be436+'-'+_0x52bf85+'/'+_0x54be0e)[_0xd64f('0x2a')](_0x2bf5d9);}return null;};}function patchUpdates(_0x4989c8){return function(_0x2efd4f){try{jsonpatch['apply'](_0x2efd4f,_0x4989c8,!![]);}catch(_0x247b3c){return BPromise[_0xd64f('0x30')](_0x247b3c);}return _0x2efd4f[_0xd64f('0x31')]();};}function saveUpdates(_0xd4e967,_0x117b7d){return function(_0x38e495){if(_0x38e495){return _0x38e495[_0xd64f('0x32')](_0xd4e967)['then'](function(_0x355d1f){return _0x355d1f;});}return null;};}function removeEntity(_0x249ffb,_0x3e27fb){return function(_0x783ac6){if(_0x783ac6){return _0x783ac6['destroy']()['then'](function(){_0x249ffb[_0xd64f('0x29')](0xcc)[_0xd64f('0x28')]();});}};}function handleEntityNotFound(_0x5b74c6,_0x4cc0a8){return function(_0x61ee67){if(!_0x61ee67){_0x5b74c6[_0xd64f('0x27')](0x194);}return _0x61ee67;};}function handleError(_0x58fc3e,_0x88f838){_0x88f838=_0x88f838||0x1f4;return function(_0x41e7f7){logger[_0xd64f('0x22')](_0x41e7f7['stack']);if(_0x41e7f7['name']){delete _0x41e7f7['name'];}_0x58fc3e[_0xd64f('0x29')](_0x88f838)['send'](_0x41e7f7);};}exports['index']=function(_0x540276,_0x5e4986){var _0x2f29f7={},_0x2efb7b={},_0x897694={'count':0x0,'rows':[]};var _0x58f6f5=_[_0xd64f('0x33')](db[_0xd64f('0x34')][_0xd64f('0x35')],function(_0x27612f){return{'name':_0x27612f[_0xd64f('0x36')],'type':_0x27612f[_0xd64f('0x37')]['key']};});_0x2efb7b[_0xd64f('0x38')]=_['map'](_0x58f6f5,_0xd64f('0x39'));_0x2efb7b['query']=_[_0xd64f('0x3a')](_0x540276[_0xd64f('0x3b')]);_0x2efb7b[_0xd64f('0x3c')]=_[_0xd64f('0x3d')](_0x2efb7b[_0xd64f('0x38')],_0x2efb7b[_0xd64f('0x3b')]);_0x2f29f7[_0xd64f('0x3e')]=_[_0xd64f('0x3d')](_0x2efb7b['model'],qs['fields'](_0x540276[_0xd64f('0x3b')][_0xd64f('0x3f')]));_0x2f29f7[_0xd64f('0x3e')]=_0x2f29f7['attributes'][_0xd64f('0x40')]?_0x2f29f7[_0xd64f('0x3e')]:_0x2efb7b[_0xd64f('0x38')];if(!_0x540276[_0xd64f('0x3b')][_0xd64f('0x41')](_0xd64f('0x42'))){_0x2f29f7[_0xd64f('0x2d')]=qs[_0xd64f('0x2d')](_0x540276[_0xd64f('0x3b')][_0xd64f('0x2d')]);_0x2f29f7[_0xd64f('0x2c')]=qs[_0xd64f('0x2c')](_0x540276['query']['offset']);}_0x2f29f7[_0xd64f('0x43')]=qs['sort'](_0x540276[_0xd64f('0x3b')]['sort']);_0x2f29f7[_0xd64f('0x44')]=qs['filters'](_[_0xd64f('0x45')](_0x540276[_0xd64f('0x3b')],_0x2efb7b[_0xd64f('0x3c')]),_0x58f6f5);if(_0x540276['query'][_0xd64f('0x46')]){_0x2f29f7['where']=_[_0xd64f('0x47')](_0x2f29f7[_0xd64f('0x44')],{'$or':_[_0xd64f('0x33')](_0x58f6f5,function(_0x1dd375){if(_0x1dd375[_0xd64f('0x37')]!=='VIRTUAL'){var _0x1035e7={};_0x1035e7[_0x1dd375[_0xd64f('0x39')]]={'$like':'%'+_0x540276[_0xd64f('0x3b')][_0xd64f('0x46')]+'%'};return _0x1035e7;}})});}_0x2f29f7=_[_0xd64f('0x47')]({},_0x2f29f7,_0x540276[_0xd64f('0x48')]);var _0x210a31={'where':_0x2f29f7[_0xd64f('0x44')]};return db[_0xd64f('0x34')][_0xd64f('0x2b')](_0x210a31)[_0xd64f('0x49')](function(_0x32078a){_0x897694[_0xd64f('0x2b')]=_0x32078a;if(_0x540276[_0xd64f('0x3b')][_0xd64f('0x4a')]){_0x2f29f7[_0xd64f('0x4b')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x2f29f7);})['then'](function(_0x5b88f0){_0x897694['rows']=_0x5b88f0;return _0x897694;})[_0xd64f('0x49')](respondWithFilteredResult(_0x5e4986,_0x2f29f7))[_0xd64f('0x26')](handleError(_0x5e4986,null));};exports[_0xd64f('0x4c')]=function(_0x443665,_0x2fc183){var _0x14c319={'raw':![],'where':{'id':_0x443665['params']['id']}},_0x20ac3b={};_0x20ac3b[_0xd64f('0x38')]=_[_0xd64f('0x3a')](db['SugarcrmConfiguration']['rawAttributes']);_0x20ac3b['query']=_[_0xd64f('0x3a')](_0x443665['query']);_0x20ac3b[_0xd64f('0x3c')]=_[_0xd64f('0x3d')](_0x20ac3b['model'],_0x20ac3b[_0xd64f('0x3b')]);_0x14c319[_0xd64f('0x3e')]=_[_0xd64f('0x3d')](_0x20ac3b[_0xd64f('0x38')],qs['fields'](_0x443665[_0xd64f('0x3b')][_0xd64f('0x3f')]));_0x14c319[_0xd64f('0x3e')]=_0x14c319[_0xd64f('0x3e')][_0xd64f('0x40')]?_0x14c319['attributes']:_0x20ac3b[_0xd64f('0x38')];if(_0x443665[_0xd64f('0x3b')]['includeAll']){_0x14c319[_0xd64f('0x4b')]=[{'all':!![]}];}_0x14c319=_['merge']({},_0x14c319,_0x443665[_0xd64f('0x48')]);return db[_0xd64f('0x34')]['find'](_0x14c319)[_0xd64f('0x49')](handleEntityNotFound(_0x2fc183,null))[_0xd64f('0x49')](respondWithResult(_0x2fc183,null))[_0xd64f('0x26')](handleError(_0x2fc183,null));};exports['create']=function(_0x12ae43,_0x1b0ae3){return db[_0xd64f('0x34')][_0xd64f('0x4d')](_0x12ae43[_0xd64f('0x4e')],{})[_0xd64f('0x49')](respondWithResult(_0x1b0ae3,0xc9))[_0xd64f('0x26')](handleError(_0x1b0ae3,null));};exports['update']=function(_0x32f850,_0x178d6a){if(_0x32f850[_0xd64f('0x4e')]['id']){delete _0x32f850['body']['id'];}return db[_0xd64f('0x34')]['find']({'where':{'id':_0x32f850[_0xd64f('0x4f')]['id']}})[_0xd64f('0x49')](handleEntityNotFound(_0x178d6a,null))['then'](saveUpdates(_0x32f850[_0xd64f('0x4e')],null))[_0xd64f('0x49')](respondWithResult(_0x178d6a,null))['catch'](handleError(_0x178d6a,null));};exports[_0xd64f('0x50')]=function(_0x5617b6,_0x5dd37f){return db[_0xd64f('0x34')]['find']({'where':{'id':_0x5617b6[_0xd64f('0x4f')]['id']}})[_0xd64f('0x49')](handleEntityNotFound(_0x5dd37f,null))[_0xd64f('0x49')](removeEntity(_0x5dd37f,null))[_0xd64f('0x26')](handleError(_0x5dd37f,null));};exports[_0xd64f('0x51')]=function(_0x55587f,_0x20f897,_0x5465a3){var _0x3b2c15={};var _0x377e79={};var _0x18f6ad;var _0x185456;return db[_0xd64f('0x34')][_0xd64f('0x52')]({'where':{'id':_0x55587f['params']['id']}})[_0xd64f('0x49')](handleEntityNotFound(_0x20f897,null))[_0xd64f('0x49')](function(_0x217b29){if(_0x217b29){_0x18f6ad=_0x217b29;_0x377e79[_0xd64f('0x38')]=_['keys'](db['SugarcrmField'][_0xd64f('0x35')]);_0x377e79[_0xd64f('0x3b')]=_[_0xd64f('0x3a')](_0x55587f[_0xd64f('0x3b')]);_0x377e79[_0xd64f('0x3c')]=_[_0xd64f('0x3d')](_0x377e79[_0xd64f('0x38')],_0x377e79[_0xd64f('0x3b')]);_0x3b2c15['attributes']=_['intersection'](_0x377e79[_0xd64f('0x38')],qs[_0xd64f('0x3f')](_0x55587f[_0xd64f('0x3b')][_0xd64f('0x3f')]));_0x3b2c15[_0xd64f('0x3e')]=_0x3b2c15[_0xd64f('0x3e')]['length']?_0x3b2c15[_0xd64f('0x3e')]:_0x377e79[_0xd64f('0x38')];_0x3b2c15[_0xd64f('0x43')]=qs[_0xd64f('0x53')](_0x55587f[_0xd64f('0x3b')]['sort']);_0x3b2c15['where']=qs[_0xd64f('0x3c')](_[_0xd64f('0x45')](_0x55587f['query'],_0x377e79['filters']));if(_0x55587f[_0xd64f('0x3b')]['filter']){_0x3b2c15[_0xd64f('0x44')]=_[_0xd64f('0x47')](_0x3b2c15[_0xd64f('0x44')],{'$or':_['map'](_0x3b2c15['attributes'],function(_0x4b4d24){var _0x2f0b02={};_0x2f0b02[_0x4b4d24]={'$like':'%'+_0x55587f[_0xd64f('0x3b')][_0xd64f('0x46')]+'%'};return _0x2f0b02;})});}_0x3b2c15=_['merge']({},_0x3b2c15,_0x55587f['options']);return _0x18f6ad[_0xd64f('0x51')](_0x3b2c15);}})[_0xd64f('0x49')](function(_0x580d5c){if(_0x580d5c){_0x185456=_0x580d5c[_0xd64f('0x40')];if(!_0x55587f[_0xd64f('0x3b')][_0xd64f('0x41')](_0xd64f('0x42'))){_0x3b2c15[_0xd64f('0x2d')]=qs['limit'](_0x55587f[_0xd64f('0x3b')][_0xd64f('0x2d')]);_0x3b2c15['offset']=qs[_0xd64f('0x2c')](_0x55587f[_0xd64f('0x3b')][_0xd64f('0x2c')]);}return _0x18f6ad[_0xd64f('0x51')](_0x3b2c15);}})[_0xd64f('0x49')](function(_0x15b26d){if(_0x15b26d){return _0x15b26d?{'count':_0x185456,'rows':_0x15b26d}:null;}})['then'](respondWithResult(_0x20f897,null))[_0xd64f('0x26')](handleError(_0x20f897,null));};exports[_0xd64f('0x54')]=function(_0xd36a4f,_0x39bb6e,_0x6d1377){var _0x57341b={};var _0x520c96={};var _0xe88e14;var _0x110f76;return db['SugarcrmConfiguration'][_0xd64f('0x52')]({'where':{'id':_0xd36a4f[_0xd64f('0x4f')]['id']}})[_0xd64f('0x49')](handleEntityNotFound(_0x39bb6e,null))['then'](function(_0x58b4f7){if(_0x58b4f7){_0xe88e14=_0x58b4f7;_0x520c96[_0xd64f('0x38')]=_[_0xd64f('0x3a')](db[_0xd64f('0x55')]['rawAttributes']);_0x520c96[_0xd64f('0x3b')]=_[_0xd64f('0x3a')](_0xd36a4f[_0xd64f('0x3b')]);_0x520c96['filters']=_[_0xd64f('0x3d')](_0x520c96['model'],_0x520c96[_0xd64f('0x3b')]);_0x57341b['attributes']=_[_0xd64f('0x3d')](_0x520c96[_0xd64f('0x38')],qs[_0xd64f('0x3f')](_0xd36a4f[_0xd64f('0x3b')]['fields']));_0x57341b[_0xd64f('0x3e')]=_0x57341b[_0xd64f('0x3e')][_0xd64f('0x40')]?_0x57341b[_0xd64f('0x3e')]:_0x520c96[_0xd64f('0x38')];_0x57341b['order']=qs[_0xd64f('0x53')](_0xd36a4f[_0xd64f('0x3b')][_0xd64f('0x53')]);_0x57341b[_0xd64f('0x44')]=qs[_0xd64f('0x3c')](_[_0xd64f('0x45')](_0xd36a4f[_0xd64f('0x3b')],_0x520c96['filters']));if(_0xd36a4f['query'][_0xd64f('0x46')]){_0x57341b[_0xd64f('0x44')]=_[_0xd64f('0x47')](_0x57341b['where'],{'$or':_[_0xd64f('0x33')](_0x57341b[_0xd64f('0x3e')],function(_0x36d1a9){var _0x71030c={};_0x71030c[_0x36d1a9]={'$like':'%'+_0xd36a4f[_0xd64f('0x3b')]['filter']+'%'};return _0x71030c;})});}_0x57341b=_['merge']({},_0x57341b,_0xd36a4f[_0xd64f('0x48')]);return _0xe88e14[_0xd64f('0x54')](_0x57341b);}})[_0xd64f('0x49')](function(_0x31eda4){if(_0x31eda4){_0x110f76=_0x31eda4[_0xd64f('0x40')];if(!_0xd36a4f[_0xd64f('0x3b')][_0xd64f('0x41')](_0xd64f('0x42'))){_0x57341b[_0xd64f('0x2d')]=qs[_0xd64f('0x2d')](_0xd36a4f['query'][_0xd64f('0x2d')]);_0x57341b[_0xd64f('0x2c')]=qs[_0xd64f('0x2c')](_0xd36a4f['query'][_0xd64f('0x2c')]);}return _0xe88e14['getSubjects'](_0x57341b);}})['then'](function(_0x1c2c56){if(_0x1c2c56){return _0x1c2c56?{'count':_0x110f76,'rows':_0x1c2c56}:null;}})[_0xd64f('0x49')](respondWithResult(_0x39bb6e,null))['catch'](handleError(_0x39bb6e,null));};exports[_0xd64f('0x56')]=function(_0x18f3d2,_0x247250,_0x23832e){var _0x1c281c={};var _0x200c91={};var _0x219675;var _0x143100;return db[_0xd64f('0x34')][_0xd64f('0x52')]({'where':{'id':_0x18f3d2[_0xd64f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x247250,null))['then'](function(_0xb5b0c8){if(_0xb5b0c8){_0x219675=_0xb5b0c8;_0x200c91[_0xd64f('0x38')]=_[_0xd64f('0x3a')](db['SugarcrmField'][_0xd64f('0x35')]);_0x200c91[_0xd64f('0x3b')]=_[_0xd64f('0x3a')](_0x18f3d2['query']);_0x200c91[_0xd64f('0x3c')]=_[_0xd64f('0x3d')](_0x200c91[_0xd64f('0x38')],_0x200c91['query']);_0x1c281c['attributes']=_[_0xd64f('0x3d')](_0x200c91['model'],qs[_0xd64f('0x3f')](_0x18f3d2['query'][_0xd64f('0x3f')]));_0x1c281c[_0xd64f('0x3e')]=_0x1c281c['attributes']['length']?_0x1c281c[_0xd64f('0x3e')]:_0x200c91[_0xd64f('0x38')];_0x1c281c[_0xd64f('0x43')]=qs[_0xd64f('0x53')](_0x18f3d2['query'][_0xd64f('0x53')]);_0x1c281c[_0xd64f('0x44')]=qs[_0xd64f('0x3c')](_[_0xd64f('0x45')](_0x18f3d2['query'],_0x200c91[_0xd64f('0x3c')]));if(_0x18f3d2[_0xd64f('0x3b')]['filter']){_0x1c281c[_0xd64f('0x44')]=_[_0xd64f('0x47')](_0x1c281c[_0xd64f('0x44')],{'$or':_['map'](_0x1c281c[_0xd64f('0x3e')],function(_0x59ceca){var _0x476285={};_0x476285[_0x59ceca]={'$like':'%'+_0x18f3d2[_0xd64f('0x3b')][_0xd64f('0x46')]+'%'};return _0x476285;})});}_0x1c281c=_[_0xd64f('0x47')]({},_0x1c281c,_0x18f3d2[_0xd64f('0x48')]);return _0x219675[_0xd64f('0x56')](_0x1c281c);}})[_0xd64f('0x49')](function(_0xa63b3a){if(_0xa63b3a){_0x143100=_0xa63b3a[_0xd64f('0x40')];if(!_0x18f3d2[_0xd64f('0x3b')][_0xd64f('0x41')](_0xd64f('0x42'))){_0x1c281c['limit']=qs[_0xd64f('0x2d')](_0x18f3d2['query']['limit']);_0x1c281c[_0xd64f('0x2c')]=qs[_0xd64f('0x2c')](_0x18f3d2[_0xd64f('0x3b')][_0xd64f('0x2c')]);}return _0x219675[_0xd64f('0x56')](_0x1c281c);}})['then'](function(_0x453940){if(_0x453940){return _0x453940?{'count':_0x143100,'rows':_0x453940}:null;}})[_0xd64f('0x49')](respondWithResult(_0x247250,null))[_0xd64f('0x26')](handleError(_0x247250,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index ee03c73..5b24153 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 _0xcde1=['path','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','lodash','util','../../config/logger','api','moment'];(function(_0x2f7b33,_0x4dc65f){var _0x4db1cb=function(_0x10e931){while(--_0x10e931){_0x2f7b33['push'](_0x2f7b33['shift']());}};_0x4db1cb(++_0x4dc65f);}(_0xcde1,0x1db));var _0x1cde=function(_0xff456d,_0x16c7cb){_0xff456d=_0xff456d-0x0;var _0x38e493=_0xcde1[_0xff456d];return _0x38e493;};'use strict';var _=require(_0x1cde('0x0'));var util=require(_0x1cde('0x1'));var logger=require(_0x1cde('0x2'))(_0x1cde('0x3'));var moment=require(_0x1cde('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cde('0x5'));var rimraf=require('rimraf');var config=require(_0x1cde('0x6'));var attributes=require(_0x1cde('0x7'));module['exports']=function(_0xf0198b,_0x36087d){return _0xf0198b[_0x1cde('0x8')](_0x1cde('0x9'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90ec=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','define','int_sugarcrm_configurations'];(function(_0x48d6f0,_0x3d451d){var _0x3b48b0=function(_0x60e678){while(--_0x60e678){_0x48d6f0['push'](_0x48d6f0['shift']());}};_0x3b48b0(++_0x3d451d);}(_0x90ec,0x144));var _0xc90e=function(_0x46d07d,_0x280501){_0x46d07d=_0x46d07d-0x0;var _0x34aa7b=_0x90ec[_0x46d07d];return _0x34aa7b;};'use strict';var _=require(_0xc90e('0x0'));var util=require(_0xc90e('0x1'));var logger=require(_0xc90e('0x2'))(_0xc90e('0x3'));var moment=require(_0xc90e('0x4'));var BPromise=require(_0xc90e('0x5'));var rp=require(_0xc90e('0x6'));var fs=require('fs');var path=require(_0xc90e('0x7'));var rimraf=require(_0xc90e('0x8'));var config=require('../../config/environment');var attributes=require(_0xc90e('0x9'));module['exports']=function(_0x152531,_0x2ef770){return _0x152531[_0xc90e('0xa')]('SugarcrmConfiguration',attributes,{'tableName':_0xc90e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index 29aecc4..9efbe67 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 _0x0578=['code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','error'];(function(_0x557575,_0x33e4c6){var _0x4bba29=function(_0x44ed48){while(--_0x44ed48){_0x557575['push'](_0x557575['shift']());}};_0x4bba29(++_0x33e4c6);}(_0x0578,0xbf));var _0x8057=function(_0x2a84ef,_0x50ab86){_0x2a84ef=_0x2a84ef-0x0;var _0x540ccd=_0x0578[_0x2a84ef];return _0x540ccd;};'use strict';var _=require(_0x8057('0x0'));var util=require(_0x8057('0x1'));var moment=require('moment');var BPromise=require(_0x8057('0x2'));var rs=require(_0x8057('0x3'));var fs=require('fs');var Redis=require(_0x8057('0x4'));var db=require(_0x8057('0x5'))['db'];var utils=require(_0x8057('0x6'));var logger=require(_0x8057('0x7'))(_0x8057('0x8'));var config=require(_0x8057('0x9'));var jayson=require(_0x8057('0xa'));var client=jayson[_0x8057('0xb')][_0x8057('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f1b15,_0x402667,_0x402a03){return new BPromise(function(_0x1689ae,_0x1972d7){return client[_0x8057('0xd')](_0x5f1b15,_0x402a03)[_0x8057('0xe')](function(_0x5d14e3){logger[_0x8057('0xf')](_0x8057('0x10'),_0x402667,'request\x20sent');logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x402667,_0x8057('0x11'),JSON['stringify'](_0x5d14e3));if(_0x5d14e3[_0x8057('0x12')]){if(_0x5d14e3[_0x8057('0x12')][_0x8057('0x13')]===0x1f4){logger[_0x8057('0x12')](_0x8057('0x10'),_0x402667,_0x5d14e3['error'][_0x8057('0x14')]);return _0x1972d7(_0x5d14e3[_0x8057('0x12')]['message']);}logger['error'](_0x8057('0x10'),_0x402667,_0x5d14e3[_0x8057('0x12')][_0x8057('0x14')]);return _0x1689ae(_0x5d14e3[_0x8057('0x12')][_0x8057('0x14')]);}else{logger[_0x8057('0xf')](_0x8057('0x10'),_0x402667,_0x8057('0x11'));_0x1689ae(_0x5d14e3['result'][_0x8057('0x14')]);}})['catch'](function(_0x88c8c9){logger[_0x8057('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x402667,_0x88c8c9);_0x1972d7(_0x88c8c9);});});} \ No newline at end of file +var _0x3ab1=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x456560,_0x2467e4){var _0x3ea878=function(_0x17bb45){while(--_0x17bb45){_0x456560['push'](_0x456560['shift']());}};_0x3ea878(++_0x2467e4);}(_0x3ab1,0x103));var _0x13ab=function(_0x1dad50,_0x33c33a){_0x1dad50=_0x1dad50-0x0;var _0x28403b=_0x3ab1[_0x1dad50];return _0x28403b;};'use strict';var _=require(_0x13ab('0x0'));var util=require(_0x13ab('0x1'));var moment=require('moment');var BPromise=require(_0x13ab('0x2'));var rs=require(_0x13ab('0x3'));var fs=require('fs');var Redis=require(_0x13ab('0x4'));var db=require(_0x13ab('0x5'))['db'];var utils=require(_0x13ab('0x6'));var logger=require(_0x13ab('0x7'))(_0x13ab('0x8'));var config=require(_0x13ab('0x9'));var jayson=require(_0x13ab('0xa'));var client=jayson[_0x13ab('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f913a,_0xa1add1,_0x473a2a){return new BPromise(function(_0x1b49cf,_0x1cd948){return client[_0x13ab('0xc')](_0x1f913a,_0x473a2a)['then'](function(_0x287a2c){logger['info'](_0x13ab('0xd'),_0xa1add1,_0x13ab('0xe'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0xa1add1,'request\x20sent',JSON[_0x13ab('0xf')](_0x287a2c));if(_0x287a2c[_0x13ab('0x10')]){if(_0x287a2c[_0x13ab('0x10')][_0x13ab('0x11')]===0x1f4){logger[_0x13ab('0x10')](_0x13ab('0xd'),_0xa1add1,_0x287a2c['error']['message']);return _0x1cd948(_0x287a2c[_0x13ab('0x10')][_0x13ab('0x12')]);}logger[_0x13ab('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xa1add1,_0x287a2c[_0x13ab('0x10')]['message']);return _0x1b49cf(_0x287a2c[_0x13ab('0x10')][_0x13ab('0x12')]);}else{logger[_0x13ab('0x13')](_0x13ab('0xd'),_0xa1add1,_0x13ab('0xe'));_0x1b49cf(_0x287a2c[_0x13ab('0x14')][_0x13ab('0x12')]);}})[_0x13ab('0x15')](function(_0x17b9d6){logger[_0x13ab('0x10')](_0x13ab('0xd'),_0xa1add1,_0x17b9d6);_0x1cd948(_0x17b9d6);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 3592656..4ab841c 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 _0xa9e0=['/:id','update','delete','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated'];(function(_0x24aa6b,_0x5990e1){var _0x572266=function(_0x5ef779){while(--_0x5ef779){_0x24aa6b['push'](_0x24aa6b['shift']());}};_0x572266(++_0x5990e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['post']('/',auth[_0x0a9e('0x8')](),controller['create']);router['put'](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xa')]);router[_0x0a9e('0xb')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0713=['isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get'];(function(_0x5001ad,_0xeb981){var _0x5a0505=function(_0x27797d){while(--_0x27797d){_0x5001ad['push'](_0x5001ad['shift']());}};_0x5a0505(++_0xeb981);}(_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 auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0xc')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router[_0x3071('0xe')]('/:id',auth[_0x3071('0x8')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller['destroy']);module[_0x3071('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 1edbf43..43c2940 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 _0xedd9=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x18a72f,_0x3aacc9){var _0x3ef7e7=function(_0x371e73){while(--_0x371e73){_0x18a72f['push'](_0x18a72f['shift']());}};_0x3ef7e7(++_0x3aacc9);}(_0xedd9,0xfc));var _0x9edd=function(_0x85a68d,_0x2094e6){_0x85a68d=_0x85a68d-0x0;var _0x41212f=_0xedd9[_0x85a68d];return _0x41212f;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'type':{'type':Sequelize[_0x9edd('0x1')](_0x9edd('0x2'),_0x9edd('0x3'),_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'defaultValue':_0x9edd('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9edd('0x7')]},'keyType':{'type':Sequelize[_0x9edd('0x1')](_0x9edd('0x2'),_0x9edd('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x9edd('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x9edd('0x7')]},'customField':{'type':Sequelize[_0x9edd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0xb0b9=['picklist','STRING','ENUM','sequelize','string','variable','customVariable','keyValue'];(function(_0x500243,_0x261cdc){var _0x3791bc=function(_0x1a7e8a){while(--_0x1a7e8a){_0x500243['push'](_0x500243['shift']());}};_0x3791bc(++_0x261cdc);}(_0xb0b9,0x1f3));var _0x9b0b=function(_0x587529,_0x30f0aa){_0x587529=_0x587529-0x0;var _0x525a77=_0xb0b9[_0x587529];return _0x525a77;};'use strict';var Sequelize=require(_0x9b0b('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x9b0b('0x1'),_0x9b0b('0x2'),_0x9b0b('0x3'),_0x9b0b('0x4'),_0x9b0b('0x5')),'defaultValue':_0x9b0b('0x1')},'content':{'type':Sequelize[_0x9b0b('0x6')]},'key':{'type':Sequelize[_0x9b0b('0x6')]},'keyType':{'type':Sequelize[_0x9b0b('0x7')](_0x9b0b('0x1'),_0x9b0b('0x2'),_0x9b0b('0x3'))},'keyContent':{'type':Sequelize[_0x9b0b('0x6')]},'idField':{'type':Sequelize[_0x9b0b('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9b0b('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 439362d..84912ef 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 _0x814b=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','then','destroy','error','name','send','index','SugarcrmField','rawAttributes','type','key','map','query','filters','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','includeAll','findAll','rows','catch','show','params','keys','intersection','include','options','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x814b,0x1a2));var _0xb814=function(_0x4b6507,_0x5518b5){_0x4b6507=_0x4b6507-0x0;var _0x2001ec=_0x814b[_0x4b6507];return _0x2001ec;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=_0x3a71d6[_0xb814('0x1f')],_0x265a83=_0x303aca['offset'],_0x125ce2=_0x303aca[_0xb814('0x20')]+_0x303aca['limit'],_0x21b73f;if(_0x125ce2>=_0x45e0d0){_0x125ce2=_0x45e0d0;_0x21b73f=0xc8;}else{_0x21b73f=0xce;}_0x39bfcf[_0xb814('0x1c')](_0x21b73f);return _0x39bfcf[_0xb814('0x21')]('Content-Range',_0x265a83+'-'+_0x125ce2+'/'+_0x45e0d0)['json'](_0x3a71d6);}return null;};}function patchUpdates(_0x55d63c){return function(_0x399b43){try{jsonpatch['apply'](_0x399b43,_0x55d63c,!![]);}catch(_0x57c128){return BPromise[_0xb814('0x22')](_0x57c128);}return _0x399b43[_0xb814('0x23')]();};}function saveUpdates(_0x25b6b6,_0x4e139e){return function(_0xf5b8aa){if(_0xf5b8aa){return _0xf5b8aa['update'](_0x25b6b6)[_0xb814('0x24')](function(_0x1808a3){return _0x1808a3;});}return null;};}function removeEntity(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x25')]()[_0xb814('0x24')](function(){_0x3b267e['status'](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0x52b7a3,_0x3f81d0){return function(_0x457dac){if(!_0x457dac){_0x52b7a3[_0xb814('0x1b')](0x194);}return _0x457dac;};}function handleError(_0x208927,_0x1c8a2e){_0x1c8a2e=_0x1c8a2e||0x1f4;return function(_0xb9e57d){logger[_0xb814('0x26')](_0xb9e57d['stack']);if(_0xb9e57d[_0xb814('0x27')]){delete _0xb9e57d[_0xb814('0x27')];}_0x208927[_0xb814('0x1c')](_0x1c8a2e)[_0xb814('0x28')](_0xb9e57d);};}exports[_0xb814('0x29')]=function(_0x1d5965,_0x3f0150){var _0x1e4e89={},_0x5a6291={},_0x271aa8={'count':0x0,'rows':[]};var _0x328a08=_['map'](db[_0xb814('0x2a')][_0xb814('0x2b')],function(_0x530744){return{'name':_0x530744['fieldName'],'type':_0x530744[_0xb814('0x2c')][_0xb814('0x2d')]};});_0x5a6291['model']=_[_0xb814('0x2e')](_0x328a08,'name');_0x5a6291[_0xb814('0x2f')]=_['keys'](_0x1d5965['query']);_0x5a6291[_0xb814('0x30')]=_['intersection'](_0x5a6291[_0xb814('0x31')],_0x5a6291[_0xb814('0x2f')]);_0x1e4e89[_0xb814('0x32')]=_['intersection'](_0x5a6291['model'],qs[_0xb814('0x33')](_0x1d5965[_0xb814('0x2f')]['fields']));_0x1e4e89[_0xb814('0x32')]=_0x1e4e89[_0xb814('0x32')][_0xb814('0x34')]?_0x1e4e89[_0xb814('0x32')]:_0x5a6291[_0xb814('0x31')];if(!_0x1d5965[_0xb814('0x2f')][_0xb814('0x35')]('nolimit')){_0x1e4e89[_0xb814('0x36')]=qs[_0xb814('0x36')](_0x1d5965[_0xb814('0x2f')][_0xb814('0x36')]);_0x1e4e89[_0xb814('0x20')]=qs['offset'](_0x1d5965[_0xb814('0x2f')]['offset']);}_0x1e4e89[_0xb814('0x37')]=qs[_0xb814('0x38')](_0x1d5965[_0xb814('0x2f')]['sort']);_0x1e4e89[_0xb814('0x39')]=qs[_0xb814('0x30')](_['pick'](_0x1d5965[_0xb814('0x2f')],_0x5a6291[_0xb814('0x30')]),_0x328a08);if(_0x1d5965[_0xb814('0x2f')][_0xb814('0x3a')]){_0x1e4e89[_0xb814('0x39')]=_[_0xb814('0x3b')](_0x1e4e89['where'],{'$or':_[_0xb814('0x2e')](_0x328a08,function(_0x4e4684){if(_0x4e4684[_0xb814('0x2c')]!=='VIRTUAL'){var _0x4492ef={};_0x4492ef[_0x4e4684['name']]={'$like':'%'+_0x1d5965[_0xb814('0x2f')][_0xb814('0x3a')]+'%'};return _0x4492ef;}})});}_0x1e4e89=_['merge']({},_0x1e4e89,_0x1d5965['options']);var _0x5dd6bc={'where':_0x1e4e89['where']};return db[_0xb814('0x2a')][_0xb814('0x1f')](_0x5dd6bc)[_0xb814('0x24')](function(_0x42c2ed){_0x271aa8['count']=_0x42c2ed;if(_0x1d5965['query'][_0xb814('0x3c')]){_0x1e4e89['include']=[{'all':!![]}];}return db[_0xb814('0x2a')][_0xb814('0x3d')](_0x1e4e89);})[_0xb814('0x24')](function(_0x3063bf){_0x271aa8[_0xb814('0x3e')]=_0x3063bf;return _0x271aa8;})[_0xb814('0x24')](respondWithFilteredResult(_0x3f0150,_0x1e4e89))[_0xb814('0x3f')](handleError(_0x3f0150,null));};exports[_0xb814('0x40')]=function(_0x31989d,_0x4b6ff8){var _0x544d36={'raw':!![],'where':{'id':_0x31989d[_0xb814('0x41')]['id']}},_0x5d26be={};_0x5d26be['model']=_[_0xb814('0x42')](db['SugarcrmField'][_0xb814('0x2b')]);_0x5d26be[_0xb814('0x2f')]=_[_0xb814('0x42')](_0x31989d[_0xb814('0x2f')]);_0x5d26be['filters']=_[_0xb814('0x43')](_0x5d26be[_0xb814('0x31')],_0x5d26be[_0xb814('0x2f')]);_0x544d36[_0xb814('0x32')]=_[_0xb814('0x43')](_0x5d26be[_0xb814('0x31')],qs['fields'](_0x31989d[_0xb814('0x2f')][_0xb814('0x33')]));_0x544d36[_0xb814('0x32')]=_0x544d36[_0xb814('0x32')][_0xb814('0x34')]?_0x544d36[_0xb814('0x32')]:_0x5d26be[_0xb814('0x31')];if(_0x31989d['query']['includeAll']){_0x544d36[_0xb814('0x44')]=[{'all':!![]}];}_0x544d36=_[_0xb814('0x3b')]({},_0x544d36,_0x31989d[_0xb814('0x45')]);return db[_0xb814('0x2a')][_0xb814('0x46')](_0x544d36)[_0xb814('0x24')](handleEntityNotFound(_0x4b6ff8,null))[_0xb814('0x24')](respondWithResult(_0x4b6ff8,null))[_0xb814('0x3f')](handleError(_0x4b6ff8,null));};exports[_0xb814('0x47')]=function(_0x344198,_0xe73300){return db['SugarcrmField'][_0xb814('0x47')](_0x344198[_0xb814('0x48')],{})['then'](respondWithResult(_0xe73300,0xc9))[_0xb814('0x3f')](handleError(_0xe73300,null));};exports['update']=function(_0x2fb0f7,_0x37866f){if(_0x2fb0f7[_0xb814('0x48')]['id']){delete _0x2fb0f7[_0xb814('0x48')]['id'];}return db[_0xb814('0x2a')][_0xb814('0x46')]({'where':{'id':_0x2fb0f7[_0xb814('0x41')]['id']}})[_0xb814('0x24')](handleEntityNotFound(_0x37866f,null))[_0xb814('0x24')](saveUpdates(_0x2fb0f7[_0xb814('0x48')],null))['then'](respondWithResult(_0x37866f,null))['catch'](handleError(_0x37866f,null));};exports[_0xb814('0x25')]=function(_0x30f07b,_0x4156d8){return db[_0xb814('0x2a')][_0xb814('0x46')]({'where':{'id':_0x30f07b[_0xb814('0x41')]['id']}})[_0xb814('0x24')](handleEntityNotFound(_0x4156d8,null))['then'](removeEntity(_0x4156d8,null))[_0xb814('0x3f')](handleError(_0x4156d8,null));}; \ No newline at end of file +var _0xc949=['fields','include','options','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','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','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','map','SugarcrmField','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params'];(function(_0x4f2dc7,_0xdaf9ed){var _0x5f213b=function(_0x595e9d){while(--_0x595e9d){_0x4f2dc7['push'](_0x4f2dc7['shift']());}};_0x5f213b(++_0xdaf9ed);}(_0xc949,0x181));var _0x9c94=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xc949[_0x5447fd];return _0x15b28a;};'use strict';var pdf=require(_0x9c94('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9c94('0x1'));var zipdir=require(_0x9c94('0x2'));var jsonpatch=require(_0x9c94('0x3'));var rp=require(_0x9c94('0x4'));var moment=require('moment');var BPromise=require(_0x9c94('0x5'));var Mustache=require(_0x9c94('0x6'));var util=require('util');var path=require(_0x9c94('0x7'));var sox=require(_0x9c94('0x8'));var csv=require(_0x9c94('0x9'));var ejs=require(_0x9c94('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9c94('0xb'));var crypto=require(_0x9c94('0xc'));var jsforce=require(_0x9c94('0xd'));var deskjs=require(_0x9c94('0xe'));var toCsv=require(_0x9c94('0x9'));var querystring=require(_0x9c94('0xf'));var Papa=require(_0x9c94('0x10'));var Redis=require(_0x9c94('0x11'));var authService=require(_0x9c94('0x12'));var qs=require(_0x9c94('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c94('0x14'));var logger=require(_0x9c94('0x15'))(_0x9c94('0x16'));var utils=require(_0x9c94('0x17'));var config=require(_0x9c94('0x18'));var licenseUtil=require(_0x9c94('0x19'));var db=require(_0x9c94('0x1a'))['db'];function respondWithStatusCode(_0x423adb,_0x30f64e){_0x30f64e=_0x30f64e||0xcc;return function(_0x1e326f){if(_0x1e326f){return _0x423adb[_0x9c94('0x1b')](_0x30f64e);}return _0x423adb[_0x9c94('0x1c')](_0x30f64e)[_0x9c94('0x1d')]();};}function respondWithResult(_0x15c51c,_0x54d956){_0x54d956=_0x54d956||0xc8;return function(_0x9789bc){if(_0x9789bc){return _0x15c51c['status'](_0x54d956)[_0x9c94('0x1e')](_0x9789bc);}};}function respondWithFilteredResult(_0x26e629,_0x4f0013){return function(_0xe52641){if(_0xe52641){var _0x4d6308=_0xe52641[_0x9c94('0x1f')],_0x56e4e1=_0x4f0013[_0x9c94('0x20')],_0xf4054e=_0x4f0013['offset']+_0x4f0013[_0x9c94('0x21')],_0x48d121;if(_0xf4054e>=_0x4d6308){_0xf4054e=_0x4d6308;_0x48d121=0xc8;}else{_0x48d121=0xce;}_0x26e629[_0x9c94('0x1c')](_0x48d121);return _0x26e629[_0x9c94('0x22')](_0x9c94('0x23'),_0x56e4e1+'-'+_0xf4054e+'/'+_0x4d6308)[_0x9c94('0x1e')](_0xe52641);}return null;};}function patchUpdates(_0xfbcc7c){return function(_0x3e361c){try{jsonpatch['apply'](_0x3e361c,_0xfbcc7c,!![]);}catch(_0x2c9736){return BPromise[_0x9c94('0x24')](_0x2c9736);}return _0x3e361c['save']();};}function saveUpdates(_0x141801,_0x845304){return function(_0x3caab0){if(_0x3caab0){return _0x3caab0[_0x9c94('0x25')](_0x141801)[_0x9c94('0x26')](function(_0x3b1481){return _0x3b1481;});}return null;};}function removeEntity(_0xadab16,_0x23cdf5){return function(_0x8fe4fb){if(_0x8fe4fb){return _0x8fe4fb[_0x9c94('0x27')]()[_0x9c94('0x26')](function(){_0xadab16[_0x9c94('0x1c')](0xcc)[_0x9c94('0x1d')]();});}};}function handleEntityNotFound(_0x8c0b7f,_0x5b1020){return function(_0x1f3b14){if(!_0x1f3b14){_0x8c0b7f[_0x9c94('0x1b')](0x194);}return _0x1f3b14;};}function handleError(_0x5c2647,_0x102130){_0x102130=_0x102130||0x1f4;return function(_0x2c3d25){logger[_0x9c94('0x28')](_0x2c3d25[_0x9c94('0x29')]);if(_0x2c3d25[_0x9c94('0x2a')]){delete _0x2c3d25['name'];}_0x5c2647[_0x9c94('0x1c')](_0x102130)[_0x9c94('0x2b')](_0x2c3d25);};}exports['index']=function(_0x248280,_0x4cfb9c){var _0xa5df6f={},_0x14d41b={},_0x330bd4={'count':0x0,'rows':[]};var _0x4008e8=_[_0x9c94('0x2c')](db[_0x9c94('0x2d')][_0x9c94('0x2e')],function(_0x561fdc){return{'name':_0x561fdc['fieldName'],'type':_0x561fdc[_0x9c94('0x2f')][_0x9c94('0x30')]};});_0x14d41b[_0x9c94('0x31')]=_['map'](_0x4008e8,_0x9c94('0x2a'));_0x14d41b['query']=_[_0x9c94('0x32')](_0x248280[_0x9c94('0x33')]);_0x14d41b[_0x9c94('0x34')]=_['intersection'](_0x14d41b['model'],_0x14d41b[_0x9c94('0x33')]);_0xa5df6f[_0x9c94('0x35')]=_[_0x9c94('0x36')](_0x14d41b['model'],qs['fields'](_0x248280['query']['fields']));_0xa5df6f[_0x9c94('0x35')]=_0xa5df6f['attributes'][_0x9c94('0x37')]?_0xa5df6f[_0x9c94('0x35')]:_0x14d41b['model'];if(!_0x248280['query'][_0x9c94('0x38')](_0x9c94('0x39'))){_0xa5df6f[_0x9c94('0x21')]=qs[_0x9c94('0x21')](_0x248280[_0x9c94('0x33')][_0x9c94('0x21')]);_0xa5df6f[_0x9c94('0x20')]=qs[_0x9c94('0x20')](_0x248280[_0x9c94('0x33')][_0x9c94('0x20')]);}_0xa5df6f[_0x9c94('0x3a')]=qs[_0x9c94('0x3b')](_0x248280[_0x9c94('0x33')][_0x9c94('0x3b')]);_0xa5df6f[_0x9c94('0x3c')]=qs[_0x9c94('0x34')](_[_0x9c94('0x3d')](_0x248280[_0x9c94('0x33')],_0x14d41b['filters']),_0x4008e8);if(_0x248280[_0x9c94('0x33')][_0x9c94('0x3e')]){_0xa5df6f[_0x9c94('0x3c')]=_[_0x9c94('0x3f')](_0xa5df6f[_0x9c94('0x3c')],{'$or':_[_0x9c94('0x2c')](_0x4008e8,function(_0x13f94c){if(_0x13f94c['type']!==_0x9c94('0x40')){var _0x591011={};_0x591011[_0x13f94c[_0x9c94('0x2a')]]={'$like':'%'+_0x248280[_0x9c94('0x33')][_0x9c94('0x3e')]+'%'};return _0x591011;}})});}_0xa5df6f=_[_0x9c94('0x3f')]({},_0xa5df6f,_0x248280['options']);var _0x245278={'where':_0xa5df6f['where']};return db[_0x9c94('0x2d')][_0x9c94('0x1f')](_0x245278)[_0x9c94('0x26')](function(_0x5e3119){_0x330bd4[_0x9c94('0x1f')]=_0x5e3119;if(_0x248280['query'][_0x9c94('0x41')]){_0xa5df6f['include']=[{'all':!![]}];}return db['SugarcrmField'][_0x9c94('0x42')](_0xa5df6f);})[_0x9c94('0x26')](function(_0x11c1c0){_0x330bd4[_0x9c94('0x43')]=_0x11c1c0;return _0x330bd4;})['then'](respondWithFilteredResult(_0x4cfb9c,_0xa5df6f))[_0x9c94('0x44')](handleError(_0x4cfb9c,null));};exports[_0x9c94('0x45')]=function(_0x425778,_0x360960){var _0x57ab57={'raw':!![],'where':{'id':_0x425778[_0x9c94('0x46')]['id']}},_0x1039e8={};_0x1039e8['model']=_[_0x9c94('0x32')](db[_0x9c94('0x2d')][_0x9c94('0x2e')]);_0x1039e8['query']=_['keys'](_0x425778[_0x9c94('0x33')]);_0x1039e8[_0x9c94('0x34')]=_[_0x9c94('0x36')](_0x1039e8[_0x9c94('0x31')],_0x1039e8[_0x9c94('0x33')]);_0x57ab57[_0x9c94('0x35')]=_[_0x9c94('0x36')](_0x1039e8[_0x9c94('0x31')],qs[_0x9c94('0x47')](_0x425778[_0x9c94('0x33')][_0x9c94('0x47')]));_0x57ab57['attributes']=_0x57ab57[_0x9c94('0x35')]['length']?_0x57ab57[_0x9c94('0x35')]:_0x1039e8[_0x9c94('0x31')];if(_0x425778[_0x9c94('0x33')][_0x9c94('0x41')]){_0x57ab57[_0x9c94('0x48')]=[{'all':!![]}];}_0x57ab57=_[_0x9c94('0x3f')]({},_0x57ab57,_0x425778[_0x9c94('0x49')]);return db['SugarcrmField']['find'](_0x57ab57)[_0x9c94('0x26')](handleEntityNotFound(_0x360960,null))[_0x9c94('0x26')](respondWithResult(_0x360960,null))[_0x9c94('0x44')](handleError(_0x360960,null));};exports['create']=function(_0x3c507f,_0x3966fa){return db['SugarcrmField']['create'](_0x3c507f['body'],{})['then'](respondWithResult(_0x3966fa,0xc9))[_0x9c94('0x44')](handleError(_0x3966fa,null));};exports['update']=function(_0x5ccc46,_0x157df2){if(_0x5ccc46['body']['id']){delete _0x5ccc46[_0x9c94('0x4a')]['id'];}return db[_0x9c94('0x2d')][_0x9c94('0x4b')]({'where':{'id':_0x5ccc46[_0x9c94('0x46')]['id']}})[_0x9c94('0x26')](handleEntityNotFound(_0x157df2,null))['then'](saveUpdates(_0x5ccc46[_0x9c94('0x4a')],null))[_0x9c94('0x26')](respondWithResult(_0x157df2,null))[_0x9c94('0x44')](handleError(_0x157df2,null));};exports[_0x9c94('0x27')]=function(_0x41226a,_0x1c6634){return db['SugarcrmField'][_0x9c94('0x4b')]({'where':{'id':_0x41226a['params']['id']}})[_0x9c94('0x26')](handleEntityNotFound(_0x1c6634,null))[_0x9c94('0x26')](removeEntity(_0x1c6634,null))[_0x9c94('0x44')](handleError(_0x1c6634,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index cd6a1e6..b80301c 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 _0x719b=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','sugarcrm_unique_index','idField','FieldId'];(function(_0x150322,_0x2199fb){var _0x606a08=function(_0x22cace){while(--_0x22cace){_0x150322['push'](_0x150322['shift']());}};_0x606a08(++_0x2199fb);}(_0x719b,0x1a4));var _0xb719=function(_0x2c760e,_0x3ec654){_0x2c760e=_0x2c760e-0x0;var _0x167283=_0x719b[_0x2c760e];return _0x167283;};'use strict';var _=require(_0xb719('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb719('0x1'));var moment=require(_0xb719('0x2'));var BPromise=require(_0xb719('0x3'));var rp=require(_0xb719('0x4'));var fs=require('fs');var path=require(_0xb719('0x5'));var rimraf=require(_0xb719('0x6'));var config=require(_0xb719('0x7'));var attributes=require(_0xb719('0x8'));module[_0xb719('0x9')]=function(_0x547817,_0x35ae86){return _0x547817[_0xb719('0xa')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xb719('0xb'),'fields':[_0xb719('0xc'),_0xb719('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xabd8=['./intSugarcrmField.attributes','exports','define','SugarcrmField','FieldId','util','api','moment','path','../../config/environment'];(function(_0x167cdc,_0x964a38){var _0x276ef6=function(_0x4e422a){while(--_0x4e422a){_0x167cdc['push'](_0x167cdc['shift']());}};_0x276ef6(++_0x964a38);}(_0xabd8,0x18b));var _0x8abd=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0xabd8[_0x2f71f6];return _0x2b23ea;};'use strict';var _=require('lodash');var util=require(_0x8abd('0x0'));var logger=require('../../config/logger')(_0x8abd('0x1'));var moment=require(_0x8abd('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8abd('0x3'));var rimraf=require('rimraf');var config=require(_0x8abd('0x4'));var attributes=require(_0x8abd('0x5'));module[_0x8abd('0x6')]=function(_0x4fa2fb,_0x12a003){return _0x4fa2fb[_0x8abd('0x7')](_0x8abd('0x8'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0x8abd('0x9')],'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 5d3d5a8..cb5f672 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 _0x2032=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','util','moment','bluebird'];(function(_0x1190cb,_0x1df254){var _0x491082=function(_0x469be1){while(--_0x469be1){_0x1190cb['push'](_0x1190cb['shift']());}};_0x491082(++_0x1df254);}(_0x2032,0xd9));var _0x2203=function(_0x2eecfc,_0x129084){_0x2eecfc=_0x2eecfc-0x0;var _0x217bfc=_0x2032[_0x2eecfc];return _0x217bfc;};'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')]('SugarcrmField,\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')]('SugarcrmField,\x20%s,\x20%s',_0x2676aa,_0x10f055['error']['message']);return _0x2999ed(_0x10f055['error']['message']);}logger[_0x2203('0xe')]('SugarcrmField,\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);});});} \ No newline at end of file +var _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SugarcrmField,\x20%s,\x20%s','message','catch','lodash'];(function(_0x3a0842,_0x1ad6a6){var _0x547c02=function(_0x18b05b){while(--_0x18b05b){_0x3a0842['push'](_0x3a0842['shift']());}};_0x547c02(++_0x1ad6a6);}(_0x66fa,0x117));var _0xa66f=function(_0x56d366,_0x15f2d9){_0x56d366=_0x56d366-0x0;var _0x1275c4=_0x66fa[_0x56d366];return _0x1275c4;};'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')]('SugarcrmField,\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')]('SugarcrmField,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 0e4a8c5..c803f64 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 _0x906c=['Router','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','destroy','multer','util','connect-timeout','express'];(function(_0x809314,_0xaf27c0){var _0x1a94b6=function(_0x450f50){while(--_0x450f50){_0x809314['push'](_0x809314['shift']());}};_0x1a94b6(++_0xaf27c0);}(_0x906c,0xd8));var _0xc906=function(_0x293d87,_0x21aebb){_0x293d87=_0x293d87-0x0;var _0x24e136=_0x906c[_0x293d87];return _0x24e136;};'use strict';var multer=require(_0xc906('0x0'));var util=require(_0xc906('0x1'));var path=require('path');var timeout=require(_0xc906('0x2'));var express=require(_0xc906('0x3'));var router=express[_0xc906('0x4')]();var auth=require(_0xc906('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc906('0x6'));var controller=require(_0xc906('0x7'));router[_0xc906('0x8')]('/',auth[_0xc906('0x9')](),controller[_0xc906('0xa')]);router[_0xc906('0x8')](_0xc906('0xb'),auth[_0xc906('0x9')](),controller[_0xc906('0xc')]);router[_0xc906('0x8')](_0xc906('0xd'),auth['isAuthenticated'](),controller[_0xc906('0xe')]);router[_0xc906('0x8')]('/:id/fields',auth[_0xc906('0x9')](),controller[_0xc906('0xf')]);router[_0xc906('0x10')]('/',auth[_0xc906('0x9')](),controller[_0xc906('0x11')]);router[_0xc906('0x10')](_0xc906('0xd'),auth['isAuthenticated'](),controller[_0xc906('0x12')]);router[_0xc906('0x13')](_0xc906('0xb'),auth[_0xc906('0x9')](),controller[_0xc906('0x14')]);router['delete'](_0xc906('0xb'),auth[_0xc906('0x9')](),controller[_0xc906('0x15')]);module['exports']=router; \ No newline at end of file +var _0xb303=['addConfiguration','put','/:id','destroy','exports','util','path','connect-timeout','express','../../config/environment','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xb303,0xe9));var _0x3b30=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb303[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x3b30('0x0'));var path=require(_0x3b30('0x1'));var timeout=require(_0x3b30('0x2'));var express=require(_0x3b30('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3b30('0x4'));var controller=require('./intVtigerAccount.controller');router[_0x3b30('0x5')]('/',auth['isAuthenticated'](),controller[_0x3b30('0x6')]);router['get']('/:id',auth[_0x3b30('0x7')](),controller[_0x3b30('0x8')]);router[_0x3b30('0x5')](_0x3b30('0x9'),auth[_0x3b30('0x7')](),controller[_0x3b30('0xa')]);router['get'](_0x3b30('0xb'),auth[_0x3b30('0x7')](),controller[_0x3b30('0xc')]);router[_0x3b30('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3b30('0xd')](_0x3b30('0x9'),auth[_0x3b30('0x7')](),controller[_0x3b30('0xe')]);router[_0x3b30('0xf')](_0x3b30('0x10'),auth[_0x3b30('0x7')](),controller['update']);router['delete'](_0x3b30('0x10'),auth[_0x3b30('0x7')](),controller[_0x3b30('0x11')]);module[_0x3b30('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index a7e3596..4100351 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 _0x97ac=['exports','STRING','sequelize'];(function(_0x42d14b,_0x23d488){var _0x3dc288=function(_0x4ab344){while(--_0x4ab344){_0x42d14b['push'](_0x42d14b['shift']());}};_0x3dc288(++_0x23d488);}(_0x97ac,0xa1));var _0xc97a=function(_0x26f081,_0x4277f3){_0x26f081=_0x26f081-0x0;var _0x4bf032=_0x97ac[_0x26f081];return _0x4bf032;};'use strict';var Sequelize=require(_0xc97a('0x0'));module[_0xc97a('0x1')]={'name':{'type':Sequelize[_0xc97a('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc97a('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xc97a('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xc97a('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xc97a('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xc97a('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x73da=['STRING','HelpDesk','sequelize','exports'];(function(_0x112f8a,_0x12ea9f){var _0x3ad6ce=function(_0x4e1f24){while(--_0x4e1f24){_0x112f8a['push'](_0x112f8a['shift']());}};_0x3ad6ce(++_0x12ea9f);}(_0x73da,0x142));var _0xa73d=function(_0x5e7b6c,_0x4916d0){_0x5e7b6c=_0x5e7b6c-0x0;var _0x3afdbd=_0x73da[_0x5e7b6c];return _0x3afdbd;};'use strict';var Sequelize=require(_0xa73d('0x0'));module[_0xa73d('0x1')]={'name':{'type':Sequelize[_0xa73d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa73d('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xa73d('0x2')],'allowNull':![],'defaultValue':_0xa73d('0x3')},'remoteUri':{'type':Sequelize[_0xa73d('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xa73d('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xa73d('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 76419f6..fbe174f 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 _0x7b70=['VtigerAccount,\x20%s,\x20%s','debug','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','send','index','map','VtigerAccount','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','options','count','include','findAll','rows','show','params','keys','find','create','body','findOne','VtigerConfiguration','rawAttributes','filter','getConfigurations','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','VtigerField','md5','getFields','description','moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','lastIndexOf','GET','getchallenge','success','login','describe','sessionName','autogenerated','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','stringify','test','Wrong\x20credentials','statusCode','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','info'];(function(_0x30dd22,_0x29be4a){var _0x4099bc=function(_0x2452cc){while(--_0x2452cc){_0x30dd22['push'](_0x30dd22['shift']());}};_0x4099bc(++_0x29be4a);}(_0x7b70,0x1f3));var _0x07b7=function(_0x476bf4,_0x2a3755){_0x476bf4=_0x476bf4-0x0;var _0x788ffe=_0x7b70[_0x476bf4];return _0x788ffe;};'use strict';var pdf=require(_0x07b7('0x0'));var emlformat=require(_0x07b7('0x1'));var rimraf=require(_0x07b7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x07b7('0x3'));var rp=require(_0x07b7('0x4'));var moment=require(_0x07b7('0x5'));var BPromise=require(_0x07b7('0x6'));var Mustache=require(_0x07b7('0x7'));var util=require(_0x07b7('0x8'));var path=require(_0x07b7('0x9'));var sox=require(_0x07b7('0xa'));var csv=require(_0x07b7('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x07b7('0xc'));var squel=require('squel');var crypto=require(_0x07b7('0xd'));var jsforce=require(_0x07b7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x07b7('0xf'));var Redis=require(_0x07b7('0x10'));var authService=require(_0x07b7('0x11'));var qs=require(_0x07b7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x07b7('0x13'))('api');var utils=require(_0x07b7('0x14'));var config=require(_0x07b7('0x15'));var licenseUtil=require(_0x07b7('0x16'));var db=require(_0x07b7('0x17'))['db'];var integrations=require(_0x07b7('0x18'));var jayson=require(_0x07b7('0x19'));var client=jayson[_0x07b7('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ac31d,_0x21fa63,_0x3fb7eb,_0x1a6ab6){return new BPromise(function(_0x3878ba,_0x5c211a){var _0x552536=_0x1a6ab6||client;return _0x552536[_0x07b7('0x1b')](_0x2ac31d,_0x3fb7eb)['then'](function(_0xe61f76){logger[_0x07b7('0x1c')](_0x07b7('0x1d'),_0x21fa63,'request\x20sent');logger[_0x07b7('0x1e')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x21fa63,'request\x20sent',JSON['stringify'](_0xe61f76));if(_0xe61f76['error']){if(_0xe61f76[_0x07b7('0x1f')][_0x07b7('0x20')]===0x1f4){logger[_0x07b7('0x1f')](_0x07b7('0x1d'),_0x21fa63,_0xe61f76['error'][_0x07b7('0x21')]);return _0x5c211a(_0xe61f76[_0x07b7('0x1f')][_0x07b7('0x21')]);}logger[_0x07b7('0x1f')](_0x07b7('0x1d'),_0x21fa63,_0xe61f76['error'][_0x07b7('0x21')]);return _0x3878ba(_0xe61f76['error'][_0x07b7('0x21')]);}else{logger[_0x07b7('0x1c')](_0x07b7('0x1d'),_0x21fa63,_0x07b7('0x22'));_0x3878ba(_0xe61f76[_0x07b7('0x23')][_0x07b7('0x21')]);}})[_0x07b7('0x24')](function(_0x20c4e0){logger[_0x07b7('0x1f')](_0x07b7('0x1d'),_0x21fa63,_0x20c4e0);_0x5c211a(_0x20c4e0);});});}function respondWithStatusCode(_0x33f8db,_0x377342){_0x377342=_0x377342||0xcc;return function(_0x9758d0){if(_0x9758d0){return _0x33f8db[_0x07b7('0x25')](_0x377342);}return _0x33f8db[_0x07b7('0x26')](_0x377342)[_0x07b7('0x27')]();};}function respondWithResult(_0x5e1828,_0x4aea6b){_0x4aea6b=_0x4aea6b||0xc8;return function(_0x6c5a0f){if(_0x6c5a0f){return _0x5e1828[_0x07b7('0x26')](_0x4aea6b)[_0x07b7('0x28')](_0x6c5a0f);}};}function respondWithFilteredResult(_0x32cc3d,_0x320ef4){return function(_0x2bab1c){if(_0x2bab1c){var _0x25fbac=_0x2bab1c['count'],_0x55aa9d=_0x320ef4[_0x07b7('0x29')],_0x52bbbe=_0x320ef4[_0x07b7('0x29')]+_0x320ef4[_0x07b7('0x2a')],_0x18ea80;if(_0x52bbbe>=_0x25fbac){_0x52bbbe=_0x25fbac;_0x18ea80=0xc8;}else{_0x18ea80=0xce;}_0x32cc3d[_0x07b7('0x26')](_0x18ea80);return _0x32cc3d[_0x07b7('0x2b')](_0x07b7('0x2c'),_0x55aa9d+'-'+_0x52bbbe+'/'+_0x25fbac)['json'](_0x2bab1c);}return null;};}function patchUpdates(_0x3b2adf){return function(_0x19a76c){try{jsonpatch[_0x07b7('0x2d')](_0x19a76c,_0x3b2adf,!![]);}catch(_0x5bcce0){return BPromise[_0x07b7('0x2e')](_0x5bcce0);}return _0x19a76c[_0x07b7('0x2f')]();};}function saveUpdates(_0x474445,_0x8499fa){return function(_0x288820){if(_0x288820){return _0x288820[_0x07b7('0x30')](_0x474445)[_0x07b7('0x31')](function(_0x5ca091){return _0x5ca091;});}return null;};}function removeEntity(_0x2e83b7,_0xb8e320){return function(_0x20f9af){if(_0x20f9af){return _0x20f9af[_0x07b7('0x32')]()[_0x07b7('0x31')](function(){_0x2e83b7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5088a1,_0xea1d09){return function(_0x43ec5e){if(!_0x43ec5e){_0x5088a1['sendStatus'](0x194);}return _0x43ec5e;};}function handleError(_0x492eb9,_0x386599){_0x386599=_0x386599||0x1f4;return function(_0x1cd397){logger['error'](_0x1cd397[_0x07b7('0x33')]);if(_0x1cd397['name']){delete _0x1cd397['name'];}_0x492eb9[_0x07b7('0x26')](_0x386599)[_0x07b7('0x34')](_0x1cd397);};}exports[_0x07b7('0x35')]=function(_0x209572,_0x504da7){var _0x13c747={},_0x32b6c2={},_0x39b07e={'count':0x0,'rows':[]};var _0x522cd0=_[_0x07b7('0x36')](db[_0x07b7('0x37')]['rawAttributes'],function(_0x2fe974){return{'name':_0x2fe974[_0x07b7('0x38')],'type':_0x2fe974[_0x07b7('0x39')][_0x07b7('0x3a')]};});_0x32b6c2[_0x07b7('0x3b')]=_[_0x07b7('0x36')](_0x522cd0,_0x07b7('0x3c'));_0x32b6c2[_0x07b7('0x3d')]=_['keys'](_0x209572['query']);_0x32b6c2[_0x07b7('0x3e')]=_[_0x07b7('0x3f')](_0x32b6c2[_0x07b7('0x3b')],_0x32b6c2['query']);_0x13c747[_0x07b7('0x40')]=_[_0x07b7('0x3f')](_0x32b6c2[_0x07b7('0x3b')],qs[_0x07b7('0x41')](_0x209572['query'][_0x07b7('0x41')]));_0x13c747['attributes']=_0x13c747[_0x07b7('0x40')][_0x07b7('0x42')]?_0x13c747[_0x07b7('0x40')]:_0x32b6c2[_0x07b7('0x3b')];if(!_0x209572[_0x07b7('0x3d')][_0x07b7('0x43')](_0x07b7('0x44'))){_0x13c747[_0x07b7('0x2a')]=qs[_0x07b7('0x2a')](_0x209572[_0x07b7('0x3d')][_0x07b7('0x2a')]);_0x13c747[_0x07b7('0x29')]=qs[_0x07b7('0x29')](_0x209572[_0x07b7('0x3d')][_0x07b7('0x29')]);}_0x13c747[_0x07b7('0x45')]=qs[_0x07b7('0x46')](_0x209572[_0x07b7('0x3d')]['sort']);_0x13c747['where']=qs['filters'](_[_0x07b7('0x47')](_0x209572['query'],_0x32b6c2['filters']),_0x522cd0);if(_0x209572[_0x07b7('0x3d')]['filter']){_0x13c747['where']=_[_0x07b7('0x48')](_0x13c747[_0x07b7('0x49')],{'$or':_[_0x07b7('0x36')](_0x522cd0,function(_0x5277a6){if(_0x5277a6['type']!==_0x07b7('0x4a')){var _0x114899={};_0x114899[_0x5277a6['name']]={'$like':'%'+_0x209572[_0x07b7('0x3d')]['filter']+'%'};return _0x114899;}})});}_0x13c747=_[_0x07b7('0x48')]({},_0x13c747,_0x209572[_0x07b7('0x4b')]);var _0xc21fbc={'where':_0x13c747[_0x07b7('0x49')]};return db['VtigerAccount'][_0x07b7('0x4c')](_0xc21fbc)[_0x07b7('0x31')](function(_0x3b6f21){_0x39b07e[_0x07b7('0x4c')]=_0x3b6f21;if(_0x209572[_0x07b7('0x3d')]['includeAll']){_0x13c747[_0x07b7('0x4d')]=[{'all':!![]}];}return db[_0x07b7('0x37')][_0x07b7('0x4e')](_0x13c747);})[_0x07b7('0x31')](function(_0x42a8a0){_0x39b07e[_0x07b7('0x4f')]=_0x42a8a0;return _0x39b07e;})['then'](respondWithFilteredResult(_0x504da7,_0x13c747))[_0x07b7('0x24')](handleError(_0x504da7,null));};exports[_0x07b7('0x50')]=function(_0x2bd163,_0x4c5fc3){var _0x38f86f={'raw':![],'where':{'id':_0x2bd163[_0x07b7('0x51')]['id']}},_0x2c90a9={};_0x2c90a9[_0x07b7('0x3b')]=_['keys'](db[_0x07b7('0x37')]['rawAttributes']);_0x2c90a9[_0x07b7('0x3d')]=_[_0x07b7('0x52')](_0x2bd163[_0x07b7('0x3d')]);_0x2c90a9['filters']=_[_0x07b7('0x3f')](_0x2c90a9[_0x07b7('0x3b')],_0x2c90a9['query']);_0x38f86f[_0x07b7('0x40')]=_[_0x07b7('0x3f')](_0x2c90a9['model'],qs[_0x07b7('0x41')](_0x2bd163['query'][_0x07b7('0x41')]));_0x38f86f['attributes']=_0x38f86f[_0x07b7('0x40')]['length']?_0x38f86f[_0x07b7('0x40')]:_0x2c90a9[_0x07b7('0x3b')];if(_0x2bd163[_0x07b7('0x3d')]['includeAll']){_0x38f86f[_0x07b7('0x4d')]=[{'all':!![]}];}_0x38f86f=_['merge']({},_0x38f86f,_0x2bd163['options']);return db[_0x07b7('0x37')][_0x07b7('0x53')](_0x38f86f)[_0x07b7('0x31')](handleEntityNotFound(_0x4c5fc3,null))[_0x07b7('0x31')](respondWithResult(_0x4c5fc3,null))[_0x07b7('0x24')](handleError(_0x4c5fc3,null));};exports[_0x07b7('0x54')]=function(_0x2f77f9,_0x4c3faa){return db[_0x07b7('0x37')][_0x07b7('0x54')](_0x2f77f9[_0x07b7('0x55')],{})['then'](respondWithResult(_0x4c3faa,0xc9))[_0x07b7('0x24')](handleError(_0x4c3faa,null));};exports[_0x07b7('0x30')]=function(_0x3a76bc,_0x48f751){if(_0x3a76bc[_0x07b7('0x55')]['id']){delete _0x3a76bc[_0x07b7('0x55')]['id'];}return db[_0x07b7('0x37')]['find']({'where':{'id':_0x3a76bc[_0x07b7('0x51')]['id']}})[_0x07b7('0x31')](handleEntityNotFound(_0x48f751,null))[_0x07b7('0x31')](saveUpdates(_0x3a76bc[_0x07b7('0x55')],null))[_0x07b7('0x31')](respondWithResult(_0x48f751,null))[_0x07b7('0x24')](handleError(_0x48f751,null));};exports[_0x07b7('0x32')]=function(_0x29ba6f,_0x3d97cd){return db[_0x07b7('0x37')][_0x07b7('0x53')]({'where':{'id':_0x29ba6f[_0x07b7('0x51')]['id']}})[_0x07b7('0x31')](handleEntityNotFound(_0x3d97cd,null))[_0x07b7('0x31')](removeEntity(_0x3d97cd,null))[_0x07b7('0x24')](handleError(_0x3d97cd,null));};exports['getConfigurations']=function(_0x5c2d2b,_0x166630,_0x246a8b){var _0xd31971={};var _0x26238b={};var _0x234b61;var _0xd4c920;return db['VtigerAccount'][_0x07b7('0x56')]({'where':{'id':_0x5c2d2b[_0x07b7('0x51')]['id']}})[_0x07b7('0x31')](handleEntityNotFound(_0x166630,null))[_0x07b7('0x31')](function(_0x23a107){if(_0x23a107){_0x234b61=_0x23a107;_0x26238b[_0x07b7('0x3b')]=_[_0x07b7('0x52')](db[_0x07b7('0x57')][_0x07b7('0x58')]);_0x26238b['query']=_[_0x07b7('0x52')](_0x5c2d2b[_0x07b7('0x3d')]);_0x26238b[_0x07b7('0x3e')]=_[_0x07b7('0x3f')](_0x26238b['model'],_0x26238b[_0x07b7('0x3d')]);_0xd31971[_0x07b7('0x40')]=_[_0x07b7('0x3f')](_0x26238b['model'],qs[_0x07b7('0x41')](_0x5c2d2b[_0x07b7('0x3d')]['fields']));_0xd31971['attributes']=_0xd31971[_0x07b7('0x40')][_0x07b7('0x42')]?_0xd31971[_0x07b7('0x40')]:_0x26238b[_0x07b7('0x3b')];_0xd31971[_0x07b7('0x45')]=qs['sort'](_0x5c2d2b['query'][_0x07b7('0x46')]);_0xd31971['where']=qs[_0x07b7('0x3e')](_[_0x07b7('0x47')](_0x5c2d2b['query'],_0x26238b['filters']));if(_0x5c2d2b[_0x07b7('0x3d')][_0x07b7('0x59')]){_0xd31971['where']=_[_0x07b7('0x48')](_0xd31971[_0x07b7('0x49')],{'$or':_[_0x07b7('0x36')](_0xd31971[_0x07b7('0x40')],function(_0x20a20a){var _0x7c1d48={};_0x7c1d48[_0x20a20a]={'$like':'%'+_0x5c2d2b[_0x07b7('0x3d')][_0x07b7('0x59')]+'%'};return _0x7c1d48;})});}_0xd31971=_['merge']({},_0xd31971,_0x5c2d2b['options']);return _0x234b61[_0x07b7('0x5a')](_0xd31971);}})['then'](function(_0x1f5aab){if(_0x1f5aab){_0xd4c920=_0x1f5aab[_0x07b7('0x42')];if(!_0x5c2d2b[_0x07b7('0x3d')][_0x07b7('0x43')](_0x07b7('0x44'))){_0xd31971[_0x07b7('0x2a')]=qs['limit'](_0x5c2d2b['query'][_0x07b7('0x2a')]);_0xd31971[_0x07b7('0x29')]=qs[_0x07b7('0x29')](_0x5c2d2b['query'][_0x07b7('0x29')]);}return _0x234b61[_0x07b7('0x5a')](_0xd31971);}})[_0x07b7('0x31')](function(_0x5205b2){if(_0x5205b2){return _0x5205b2?{'count':_0xd4c920,'rows':_0x5205b2}:null;}})[_0x07b7('0x31')](respondWithResult(_0x166630,null))[_0x07b7('0x24')](handleError(_0x166630,null));};exports['addConfiguration']=function(_0x43a6b2,_0xb6e639,_0x3bb0ca){if(_0x43a6b2[_0x07b7('0x55')]['id']){delete _0x43a6b2[_0x07b7('0x55')]['id'];}return db[_0x07b7('0x37')][_0x07b7('0x56')]({'where':{'id':_0x43a6b2['params']['id']}})['then'](handleEntityNotFound(_0xb6e639,null))[_0x07b7('0x31')](function(_0x44215f){if(_0x44215f){_0x43a6b2['body'][_0x07b7('0x5b')]=_0x44215f['id'];_0x43a6b2[_0x07b7('0x55')][_0x07b7('0x5c')]=integrations[_0x07b7('0x5d')](_0x43a6b2['body']['channel'],_0x43a6b2['body'][_0x07b7('0x39')]);_0x43a6b2[_0x07b7('0x55')][_0x07b7('0x5e')]=integrations[_0x07b7('0x5f')](_0x43a6b2[_0x07b7('0x55')][_0x07b7('0x60')],_0x43a6b2[_0x07b7('0x55')]['type']);return db[_0x07b7('0x57')][_0x07b7('0x54')](_0x43a6b2[_0x07b7('0x55')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0x07b7('0x61')],'as':_0x07b7('0x5e')}]});}return null;})['then'](respondWithResult(_0xb6e639,null))[_0x07b7('0x24')](handleError(_0xb6e639,null));};var md5=require(_0x07b7('0x62'));exports[_0x07b7('0x63')]=function(_0x198b88,_0x1a7992,_0x2c4936){var _0x258940=null;var _0x1e7fea=null;var _0xac708a=null;var _0x36b6a2=null;var _0x372040='';return db[_0x07b7('0x37')]['findOne']({'where':{'id':_0x198b88[_0x07b7('0x51')]['id']},'attributes':['id',_0x07b7('0x3c'),'username',_0x07b7('0x64'),_0x07b7('0x65'),_0x07b7('0x66'),_0x07b7('0x67'),_0x07b7('0x68')]})['then'](handleEntityNotFound(_0x1a7992,null))['then'](function(_0x577eab){if(_0x577eab){_0x258940=_0x577eab[_0x07b7('0x69')];_0x1e7fea=_0x577eab[_0x07b7('0x68')];_0xac708a=_0x577eab[_0x07b7('0x65')];_0x372040=_0x577eab['remoteUri'];var _0x131a71=_0x372040[_0x07b7('0x6a')](-0x1);if(_0x131a71==='/'){_0x372040=_0x372040[_0x07b7('0x6b')](0x0,_0x372040[_0x07b7('0x6c')](_0x131a71));}_0x36b6a2=util['format']('%s/webservice.php',_0x372040);var _0x157ae1={'method':_0x07b7('0x6d'),'uri':_0x36b6a2,'qs':{'operation':_0x07b7('0x6e'),'username':_0x577eab[_0x07b7('0x69')]},'json':!![]};return rp(_0x157ae1);}})[_0x07b7('0x31')](function(_0x43a3c0){if(_0x43a3c0[_0x07b7('0x6f')]){var _0x11f9bd={'method':'POST','uri':_0x36b6a2,'form':{'operation':_0x07b7('0x70'),'username':_0x258940,'accessKey':md5(_0x43a3c0[_0x07b7('0x23')]['token']+_0x1e7fea)},'json':!![]};return rp(_0x11f9bd);}})[_0x07b7('0x31')](function(_0x5bb1b2){if(_0x5bb1b2[_0x07b7('0x6f')]){var _0x5d4e95={'method':_0x07b7('0x6d'),'uri':_0x36b6a2,'qs':{'operation':_0x07b7('0x71'),'username':_0x258940,'sessionName':_0x5bb1b2[_0x07b7('0x23')][_0x07b7('0x72')],'elementType':_0xac708a},'json':!![]};return rp(_0x5d4e95);}})[_0x07b7('0x31')](function(_0x14ee87){if(_0x14ee87[_0x07b7('0x6f')]){var _0x3594d6=[_0x07b7('0x73'),'reference',_0x07b7('0x74')];_[_0x07b7('0x75')](_0x14ee87[_0x07b7('0x23')][_0x07b7('0x41')],function(_0x390ed8){return _0x3594d6[_0x07b7('0x76')](_0x390ed8[_0x07b7('0x39')][_0x07b7('0x3c')]);});_[_0x07b7('0x75')](_0x14ee87[_0x07b7('0x23')][_0x07b7('0x41')],function(_0x1bf938){return _0x1bf938[_0x07b7('0x77')]===_0x07b7('0x78');});return{'count':_0x14ee87[_0x07b7('0x23')][_0x07b7('0x41')]['length'],'rows':_[_0x07b7('0x36')](_0x14ee87[_0x07b7('0x23')]['fields'],function(_0x519851){return{'id':_0x519851[_0x07b7('0x3c')],'name':_0x519851[_0x07b7('0x79')],'custom':_[_0x07b7('0x7a')](_0x519851[_0x07b7('0x3c')],_0x07b7('0x7b'))?!![]:![],'options':_0x519851[_0x07b7('0x39')][_0x07b7('0x3c')]===_0x07b7('0x7c')&&_0x519851[_0x07b7('0x39')][_0x07b7('0x7d')]['length']>0x0?_['map'](_0x519851[_0x07b7('0x39')][_0x07b7('0x7d')],function(_0x140f50){return{'name':_0x140f50[_0x07b7('0x79')],'value':_0x140f50['value']};}):[]};})};}})['then'](respondWithResult(_0x1a7992,null))[_0x07b7('0x24')](function(_0x2df2ce){console[_0x07b7('0x7e')](_0x07b7('0x7f')+_0x2df2ce);var _0x39886b=_0x198b88['query']['test']?0x1f4:_0x2df2ce['statusCode']||0x1f4;logger[_0x07b7('0x1f')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x39886b,JSON[_0x07b7('0x80')](_0x2df2ce));delete _0x2df2ce[_0x07b7('0x3c')];if(_0x39886b===0x191){_0x39886b=0x190;}_0x1a7992[_0x07b7('0x26')](_0x39886b)[_0x07b7('0x34')](_0x198b88[_0x07b7('0x3d')][_0x07b7('0x81')]?{'message':_0x07b7('0x82'),'statusCode':_0x2df2ce[_0x07b7('0x83')]}:_0x2df2ce);});}; \ No newline at end of file +var _0xd06a=['status','count','offset','limit','json','reject','save','update','destroy','stack','name','send','VtigerAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','fields','includeAll','include','find','create','body','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','getSubjects','channel','getDescriptions','Subjects','VtigerField','md5','username','description','moduleName','accessKey','remoteUri','slice','substring','format','%s/webservice.php','GET','getchallenge','POST','login','token','success','sessionName','owner','remove','false','label','startsWith','picklist','picklistValues','value','log','test','statusCode','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end'];(function(_0x29eeff,_0x365898){var _0x41eda1=function(_0x193bd6){while(--_0x193bd6){_0x29eeff['push'](_0x29eeff['shift']());}};_0x41eda1(++_0x365898);}(_0xd06a,0xd6));var _0xad06=function(_0x4e3a9f,_0x2d4593){_0x4e3a9f=_0x4e3a9f-0x0;var _0x3dcea3=_0xd06a[_0x4e3a9f];return _0x3dcea3;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xad06('0x0'));var rimraf=require(_0xad06('0x1'));var zipdir=require(_0xad06('0x2'));var jsonpatch=require(_0xad06('0x3'));var rp=require(_0xad06('0x4'));var moment=require(_0xad06('0x5'));var BPromise=require(_0xad06('0x6'));var Mustache=require(_0xad06('0x7'));var util=require(_0xad06('0x8'));var path=require(_0xad06('0x9'));var sox=require(_0xad06('0xa'));var csv=require(_0xad06('0xb'));var ejs=require(_0xad06('0xc'));var fs=require('fs');var _=require(_0xad06('0xd'));var squel=require('squel');var crypto=require(_0xad06('0xe'));var jsforce=require(_0xad06('0xf'));var deskjs=require(_0xad06('0x10'));var toCsv=require(_0xad06('0xb'));var querystring=require(_0xad06('0x11'));var Papa=require('papaparse');var Redis=require(_0xad06('0x12'));var authService=require(_0xad06('0x13'));var qs=require(_0xad06('0x14'));var as=require(_0xad06('0x15'));var hardwareService=require(_0xad06('0x16'));var logger=require('../../config/logger')(_0xad06('0x17'));var utils=require(_0xad06('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xad06('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xad06('0x1a'));var client=jayson[_0xad06('0x1b')][_0xad06('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2964a4,_0x2ea51c,_0x5889d8,_0x9b940f){return new BPromise(function(_0xc69b9e,_0xda8aec){var _0x9f58f0=_0x9b940f||client;return _0x9f58f0[_0xad06('0x1d')](_0x2964a4,_0x5889d8)[_0xad06('0x1e')](function(_0x3aebbf){logger[_0xad06('0x1f')](_0xad06('0x20'),_0x2ea51c,_0xad06('0x21'));logger[_0xad06('0x22')](_0xad06('0x23'),_0x2ea51c,_0xad06('0x21'),JSON[_0xad06('0x24')](_0x3aebbf));if(_0x3aebbf[_0xad06('0x25')]){if(_0x3aebbf['error'][_0xad06('0x26')]===0x1f4){logger[_0xad06('0x25')]('VtigerAccount,\x20%s,\x20%s',_0x2ea51c,_0x3aebbf['error']['message']);return _0xda8aec(_0x3aebbf[_0xad06('0x25')][_0xad06('0x27')]);}logger[_0xad06('0x25')]('VtigerAccount,\x20%s,\x20%s',_0x2ea51c,_0x3aebbf[_0xad06('0x25')][_0xad06('0x27')]);return _0xc69b9e(_0x3aebbf[_0xad06('0x25')]['message']);}else{logger[_0xad06('0x1f')](_0xad06('0x20'),_0x2ea51c,_0xad06('0x21'));_0xc69b9e(_0x3aebbf[_0xad06('0x28')][_0xad06('0x27')]);}})[_0xad06('0x29')](function(_0x26da13){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x2ea51c,_0x26da13);_0xda8aec(_0x26da13);});});}function respondWithStatusCode(_0x2e2b86,_0x1bdcb1){_0x1bdcb1=_0x1bdcb1||0xcc;return function(_0x1aa00f){if(_0x1aa00f){return _0x2e2b86[_0xad06('0x2a')](_0x1bdcb1);}return _0x2e2b86['status'](_0x1bdcb1)[_0xad06('0x2b')]();};}function respondWithResult(_0x21ab1b,_0x269f25){_0x269f25=_0x269f25||0xc8;return function(_0x2e2875){if(_0x2e2875){return _0x21ab1b[_0xad06('0x2c')](_0x269f25)['json'](_0x2e2875);}};}function respondWithFilteredResult(_0x3c0f55,_0x5a24e9){return function(_0x3a812b){if(_0x3a812b){var _0x4b789f=_0x3a812b[_0xad06('0x2d')],_0x468e11=_0x5a24e9[_0xad06('0x2e')],_0x4c73a8=_0x5a24e9[_0xad06('0x2e')]+_0x5a24e9[_0xad06('0x2f')],_0x5a4904;if(_0x4c73a8>=_0x4b789f){_0x4c73a8=_0x4b789f;_0x5a4904=0xc8;}else{_0x5a4904=0xce;}_0x3c0f55[_0xad06('0x2c')](_0x5a4904);return _0x3c0f55['set']('Content-Range',_0x468e11+'-'+_0x4c73a8+'/'+_0x4b789f)[_0xad06('0x30')](_0x3a812b);}return null;};}function patchUpdates(_0x5e4b19){return function(_0x55b5fd){try{jsonpatch['apply'](_0x55b5fd,_0x5e4b19,!![]);}catch(_0x38cf1c){return BPromise[_0xad06('0x31')](_0x38cf1c);}return _0x55b5fd[_0xad06('0x32')]();};}function saveUpdates(_0x2c9d19,_0x43bd41){return function(_0x575d25){if(_0x575d25){return _0x575d25[_0xad06('0x33')](_0x2c9d19)[_0xad06('0x1e')](function(_0x1588cc){return _0x1588cc;});}return null;};}function removeEntity(_0x2183e6,_0x5c788d){return function(_0x3fcd8c){if(_0x3fcd8c){return _0x3fcd8c[_0xad06('0x34')]()[_0xad06('0x1e')](function(){_0x2183e6[_0xad06('0x2c')](0xcc)[_0xad06('0x2b')]();});}};}function handleEntityNotFound(_0x592a4a,_0x4509e6){return function(_0x1bb43d){if(!_0x1bb43d){_0x592a4a['sendStatus'](0x194);}return _0x1bb43d;};}function handleError(_0xe4acbe,_0x384702){_0x384702=_0x384702||0x1f4;return function(_0x33d2eb){logger['error'](_0x33d2eb[_0xad06('0x35')]);if(_0x33d2eb['name']){delete _0x33d2eb[_0xad06('0x36')];}_0xe4acbe[_0xad06('0x2c')](_0x384702)[_0xad06('0x37')](_0x33d2eb);};}exports['index']=function(_0x4104e0,_0x5f8253){var _0x39e40d={},_0x4bea78={},_0x10d1a4={'count':0x0,'rows':[]};var _0x134c12=_['map'](db[_0xad06('0x38')][_0xad06('0x39')],function(_0x277f70){return{'name':_0x277f70[_0xad06('0x3a')],'type':_0x277f70[_0xad06('0x3b')][_0xad06('0x3c')]};});_0x4bea78['model']=_[_0xad06('0x3d')](_0x134c12,_0xad06('0x36'));_0x4bea78[_0xad06('0x3e')]=_[_0xad06('0x3f')](_0x4104e0['query']);_0x4bea78[_0xad06('0x40')]=_[_0xad06('0x41')](_0x4bea78[_0xad06('0x42')],_0x4bea78[_0xad06('0x3e')]);_0x39e40d[_0xad06('0x43')]=_[_0xad06('0x41')](_0x4bea78[_0xad06('0x42')],qs['fields'](_0x4104e0[_0xad06('0x3e')]['fields']));_0x39e40d[_0xad06('0x43')]=_0x39e40d[_0xad06('0x43')][_0xad06('0x44')]?_0x39e40d[_0xad06('0x43')]:_0x4bea78[_0xad06('0x42')];if(!_0x4104e0[_0xad06('0x3e')][_0xad06('0x45')](_0xad06('0x46'))){_0x39e40d['limit']=qs[_0xad06('0x2f')](_0x4104e0[_0xad06('0x3e')][_0xad06('0x2f')]);_0x39e40d['offset']=qs['offset'](_0x4104e0[_0xad06('0x3e')]['offset']);}_0x39e40d[_0xad06('0x47')]=qs[_0xad06('0x48')](_0x4104e0[_0xad06('0x3e')][_0xad06('0x48')]);_0x39e40d[_0xad06('0x49')]=qs[_0xad06('0x40')](_[_0xad06('0x4a')](_0x4104e0[_0xad06('0x3e')],_0x4bea78[_0xad06('0x40')]),_0x134c12);if(_0x4104e0['query'][_0xad06('0x4b')]){_0x39e40d[_0xad06('0x49')]=_[_0xad06('0x4c')](_0x39e40d[_0xad06('0x49')],{'$or':_[_0xad06('0x3d')](_0x134c12,function(_0x5c29be){if(_0x5c29be['type']!==_0xad06('0x4d')){var _0x179065={};_0x179065[_0x5c29be[_0xad06('0x36')]]={'$like':'%'+_0x4104e0[_0xad06('0x3e')][_0xad06('0x4b')]+'%'};return _0x179065;}})});}_0x39e40d=_['merge']({},_0x39e40d,_0x4104e0[_0xad06('0x4e')]);var _0x31d78e={'where':_0x39e40d[_0xad06('0x49')]};return db[_0xad06('0x38')][_0xad06('0x2d')](_0x31d78e)[_0xad06('0x1e')](function(_0xb7f636){_0x10d1a4[_0xad06('0x2d')]=_0xb7f636;if(_0x4104e0[_0xad06('0x3e')]['includeAll']){_0x39e40d['include']=[{'all':!![]}];}return db['VtigerAccount'][_0xad06('0x4f')](_0x39e40d);})['then'](function(_0x198558){_0x10d1a4[_0xad06('0x50')]=_0x198558;return _0x10d1a4;})[_0xad06('0x1e')](respondWithFilteredResult(_0x5f8253,_0x39e40d))[_0xad06('0x29')](handleError(_0x5f8253,null));};exports[_0xad06('0x51')]=function(_0x31b940,_0x349c1c){var _0x433416={'raw':![],'where':{'id':_0x31b940[_0xad06('0x52')]['id']}},_0x2b752e={};_0x2b752e['model']=_[_0xad06('0x3f')](db[_0xad06('0x38')][_0xad06('0x39')]);_0x2b752e['query']=_['keys'](_0x31b940[_0xad06('0x3e')]);_0x2b752e['filters']=_[_0xad06('0x41')](_0x2b752e['model'],_0x2b752e[_0xad06('0x3e')]);_0x433416[_0xad06('0x43')]=_[_0xad06('0x41')](_0x2b752e['model'],qs[_0xad06('0x53')](_0x31b940['query']['fields']));_0x433416[_0xad06('0x43')]=_0x433416[_0xad06('0x43')][_0xad06('0x44')]?_0x433416['attributes']:_0x2b752e[_0xad06('0x42')];if(_0x31b940[_0xad06('0x3e')][_0xad06('0x54')]){_0x433416[_0xad06('0x55')]=[{'all':!![]}];}_0x433416=_[_0xad06('0x4c')]({},_0x433416,_0x31b940[_0xad06('0x4e')]);return db[_0xad06('0x38')][_0xad06('0x56')](_0x433416)[_0xad06('0x1e')](handleEntityNotFound(_0x349c1c,null))[_0xad06('0x1e')](respondWithResult(_0x349c1c,null))[_0xad06('0x29')](handleError(_0x349c1c,null));};exports[_0xad06('0x57')]=function(_0x1fef8d,_0x2a271d){return db[_0xad06('0x38')][_0xad06('0x57')](_0x1fef8d[_0xad06('0x58')],{})[_0xad06('0x1e')](respondWithResult(_0x2a271d,0xc9))[_0xad06('0x29')](handleError(_0x2a271d,null));};exports[_0xad06('0x33')]=function(_0x4b297c,_0x582a24){if(_0x4b297c['body']['id']){delete _0x4b297c[_0xad06('0x58')]['id'];}return db['VtigerAccount'][_0xad06('0x56')]({'where':{'id':_0x4b297c[_0xad06('0x52')]['id']}})[_0xad06('0x1e')](handleEntityNotFound(_0x582a24,null))['then'](saveUpdates(_0x4b297c['body'],null))[_0xad06('0x1e')](respondWithResult(_0x582a24,null))['catch'](handleError(_0x582a24,null));};exports[_0xad06('0x34')]=function(_0x49e4e1,_0x135d5b){return db[_0xad06('0x38')][_0xad06('0x56')]({'where':{'id':_0x49e4e1[_0xad06('0x52')]['id']}})[_0xad06('0x1e')](handleEntityNotFound(_0x135d5b,null))[_0xad06('0x1e')](removeEntity(_0x135d5b,null))['catch'](handleError(_0x135d5b,null));};exports[_0xad06('0x59')]=function(_0x208e69,_0x4322a3,_0x42635b){var _0xe74e85={};var _0x1ea3df={};var _0x41121d;var _0x40b4dd;return db[_0xad06('0x38')][_0xad06('0x5a')]({'where':{'id':_0x208e69['params']['id']}})[_0xad06('0x1e')](handleEntityNotFound(_0x4322a3,null))[_0xad06('0x1e')](function(_0xb2bb62){if(_0xb2bb62){_0x41121d=_0xb2bb62;_0x1ea3df[_0xad06('0x42')]=_[_0xad06('0x3f')](db[_0xad06('0x5b')][_0xad06('0x39')]);_0x1ea3df[_0xad06('0x3e')]=_[_0xad06('0x3f')](_0x208e69['query']);_0x1ea3df[_0xad06('0x40')]=_[_0xad06('0x41')](_0x1ea3df[_0xad06('0x42')],_0x1ea3df[_0xad06('0x3e')]);_0xe74e85['attributes']=_['intersection'](_0x1ea3df['model'],qs[_0xad06('0x53')](_0x208e69[_0xad06('0x3e')]['fields']));_0xe74e85[_0xad06('0x43')]=_0xe74e85['attributes'][_0xad06('0x44')]?_0xe74e85['attributes']:_0x1ea3df[_0xad06('0x42')];_0xe74e85[_0xad06('0x47')]=qs[_0xad06('0x48')](_0x208e69[_0xad06('0x3e')][_0xad06('0x48')]);_0xe74e85['where']=qs[_0xad06('0x40')](_[_0xad06('0x4a')](_0x208e69[_0xad06('0x3e')],_0x1ea3df['filters']));if(_0x208e69[_0xad06('0x3e')][_0xad06('0x4b')]){_0xe74e85[_0xad06('0x49')]=_[_0xad06('0x4c')](_0xe74e85[_0xad06('0x49')],{'$or':_[_0xad06('0x3d')](_0xe74e85[_0xad06('0x43')],function(_0x53b24a){var _0x51b18f={};_0x51b18f[_0x53b24a]={'$like':'%'+_0x208e69[_0xad06('0x3e')][_0xad06('0x4b')]+'%'};return _0x51b18f;})});}_0xe74e85=_['merge']({},_0xe74e85,_0x208e69[_0xad06('0x4e')]);return _0x41121d['getConfigurations'](_0xe74e85);}})[_0xad06('0x1e')](function(_0x57faf9){if(_0x57faf9){_0x40b4dd=_0x57faf9['length'];if(!_0x208e69[_0xad06('0x3e')][_0xad06('0x45')](_0xad06('0x46'))){_0xe74e85[_0xad06('0x2f')]=qs[_0xad06('0x2f')](_0x208e69[_0xad06('0x3e')][_0xad06('0x2f')]);_0xe74e85[_0xad06('0x2e')]=qs[_0xad06('0x2e')](_0x208e69['query'][_0xad06('0x2e')]);}return _0x41121d[_0xad06('0x59')](_0xe74e85);}})[_0xad06('0x1e')](function(_0x42c833){if(_0x42c833){return _0x42c833?{'count':_0x40b4dd,'rows':_0x42c833}:null;}})[_0xad06('0x1e')](respondWithResult(_0x4322a3,null))[_0xad06('0x29')](handleError(_0x4322a3,null));};exports[_0xad06('0x5c')]=function(_0x9015f4,_0x1e8a17,_0x48ecf7){if(_0x9015f4[_0xad06('0x58')]['id']){delete _0x9015f4[_0xad06('0x58')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x9015f4['params']['id']}})[_0xad06('0x1e')](handleEntityNotFound(_0x1e8a17,null))[_0xad06('0x1e')](function(_0x23d608){if(_0x23d608){_0x9015f4[_0xad06('0x58')][_0xad06('0x5d')]=_0x23d608['id'];_0x9015f4[_0xad06('0x58')]['Subjects']=integrations[_0xad06('0x5e')](_0x9015f4[_0xad06('0x58')][_0xad06('0x5f')],_0x9015f4['body'][_0xad06('0x3b')]);_0x9015f4['body']['Descriptions']=integrations[_0xad06('0x60')](_0x9015f4[_0xad06('0x58')][_0xad06('0x5f')],_0x9015f4[_0xad06('0x58')][_0xad06('0x3b')]);return db[_0xad06('0x5b')]['create'](_0x9015f4[_0xad06('0x58')],{'include':[{'model':db['VtigerField'],'as':_0xad06('0x61')},{'model':db[_0xad06('0x62')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1e8a17,null))[_0xad06('0x29')](handleError(_0x1e8a17,null));};var md5=require(_0xad06('0x63'));exports['getFields']=function(_0x2b71b5,_0x1cd2f7,_0x18f24f){var _0x54dc7f=null;var _0x2fdaad=null;var _0x5ed241=null;var _0x4a81ab=null;var _0x52ff7d='';return db[_0xad06('0x38')]['findOne']({'where':{'id':_0x2b71b5[_0xad06('0x52')]['id']},'attributes':['id','name',_0xad06('0x64'),_0xad06('0x65'),_0xad06('0x66'),'remoteUri','serverUrl',_0xad06('0x67')]})[_0xad06('0x1e')](handleEntityNotFound(_0x1cd2f7,null))[_0xad06('0x1e')](function(_0x82675f){if(_0x82675f){_0x54dc7f=_0x82675f[_0xad06('0x64')];_0x2fdaad=_0x82675f[_0xad06('0x67')];_0x5ed241=_0x82675f[_0xad06('0x66')];_0x52ff7d=_0x82675f[_0xad06('0x68')];var _0x1b63ce=_0x52ff7d[_0xad06('0x69')](-0x1);if(_0x1b63ce==='/'){_0x52ff7d=_0x52ff7d[_0xad06('0x6a')](0x0,_0x52ff7d['lastIndexOf'](_0x1b63ce));}_0x4a81ab=util[_0xad06('0x6b')](_0xad06('0x6c'),_0x52ff7d);var _0x5410c6={'method':_0xad06('0x6d'),'uri':_0x4a81ab,'qs':{'operation':_0xad06('0x6e'),'username':_0x82675f[_0xad06('0x64')]},'json':!![]};return rp(_0x5410c6);}})['then'](function(_0xb270a4){if(_0xb270a4['success']){var _0x26c373={'method':_0xad06('0x6f'),'uri':_0x4a81ab,'form':{'operation':_0xad06('0x70'),'username':_0x54dc7f,'accessKey':md5(_0xb270a4[_0xad06('0x28')][_0xad06('0x71')]+_0x2fdaad)},'json':!![]};return rp(_0x26c373);}})['then'](function(_0x2a3506){if(_0x2a3506[_0xad06('0x72')]){var _0x3001ee={'method':_0xad06('0x6d'),'uri':_0x4a81ab,'qs':{'operation':'describe','username':_0x54dc7f,'sessionName':_0x2a3506[_0xad06('0x28')][_0xad06('0x73')],'elementType':_0x5ed241},'json':!![]};return rp(_0x3001ee);}})[_0xad06('0x1e')](function(_0x47bbf6){if(_0x47bbf6['success']){var _0x3e16d6=['autogenerated','reference',_0xad06('0x74')];_[_0xad06('0x75')](_0x47bbf6[_0xad06('0x28')][_0xad06('0x53')],function(_0x1d7c78){return _0x3e16d6['includes'](_0x1d7c78[_0xad06('0x3b')]['name']);});_[_0xad06('0x75')](_0x47bbf6[_0xad06('0x28')][_0xad06('0x53')],function(_0x4ba75d){return _0x4ba75d['editable']===_0xad06('0x76');});return{'count':_0x47bbf6[_0xad06('0x28')][_0xad06('0x53')][_0xad06('0x44')],'rows':_[_0xad06('0x3d')](_0x47bbf6[_0xad06('0x28')][_0xad06('0x53')],function(_0x5a8505){return{'id':_0x5a8505[_0xad06('0x36')],'name':_0x5a8505[_0xad06('0x77')],'custom':_[_0xad06('0x78')](_0x5a8505['name'],'cf_')?!![]:![],'options':_0x5a8505[_0xad06('0x3b')][_0xad06('0x36')]===_0xad06('0x79')&&_0x5a8505[_0xad06('0x3b')][_0xad06('0x7a')][_0xad06('0x44')]>0x0?_['map'](_0x5a8505[_0xad06('0x3b')][_0xad06('0x7a')],function(_0x2af04b){return{'name':_0x2af04b[_0xad06('0x77')],'value':_0x2af04b[_0xad06('0x7b')]};}):[]};})};}})[_0xad06('0x1e')](respondWithResult(_0x1cd2f7,null))[_0xad06('0x29')](function(_0x451ec2){console[_0xad06('0x7c')]('vTiger\x20error:\x20'+_0x451ec2);var _0x1245fd=_0x2b71b5[_0xad06('0x3e')][_0xad06('0x7d')]?0x1f4:_0x451ec2[_0xad06('0x7e')]||0x1f4;logger[_0xad06('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0xad06('0x7f'),_0x1245fd,JSON['stringify'](_0x451ec2));delete _0x451ec2[_0xad06('0x36')];if(_0x1245fd===0x191){_0x1245fd=0x190;}_0x1cd2f7[_0xad06('0x2c')](_0x1245fd)[_0xad06('0x37')](_0x2b71b5['query'][_0xad06('0x7d')]?{'message':_0xad06('0x80'),'statusCode':_0x451ec2[_0xad06('0x7e')]}:_0x451ec2);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index b676075..ecfb243 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 _0xf566=['rimraf','../../config/environment','./intVtigerAccount.attributes','define','../../config/logger','bluebird','path'];(function(_0x3c4f40,_0x302e0b){var _0x12032f=function(_0x159d92){while(--_0x159d92){_0x3c4f40['push'](_0x3c4f40['shift']());}};_0x12032f(++_0x302e0b);}(_0xf566,0x185));var _0x6f56=function(_0x4bea95,_0x2026cb){_0x4bea95=_0x4bea95-0x0;var _0x52aa29=_0xf566[_0x4bea95];return _0x52aa29;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6f56('0x0'))('api');var moment=require('moment');var BPromise=require(_0x6f56('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f56('0x2'));var rimraf=require(_0x6f56('0x3'));var config=require(_0x6f56('0x4'));var attributes=require(_0x6f56('0x5'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xbaf94b,_0xbb92df){return _0xbaf94b[_0x6f56('0x6')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb64e=['../../config/logger','api','bluebird','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','VtigerAccount','int_vtiger_accounts','util'];(function(_0x351bea,_0x332580){var _0x3aa9a1=function(_0x305aca){while(--_0x305aca){_0x351bea['push'](_0x351bea['shift']());}};_0x3aa9a1(++_0x332580);}(_0xb64e,0x116));var _0xeb64=function(_0x1241fc,_0x349344){_0x1241fc=_0x1241fc-0x0;var _0x121ab2=_0xb64e[_0x1241fc];return _0x121ab2;};'use strict';var _=require('lodash');var util=require(_0xeb64('0x0'));var logger=require(_0xeb64('0x1'))(_0xeb64('0x2'));var moment=require('moment');var BPromise=require(_0xeb64('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xeb64('0x4'));var attributes=require(_0xeb64('0x5'));var integrations=require(_0xeb64('0x6'));module['exports']=function(_0x3fc247,_0x2badd6){return _0x3fc247['define'](_0xeb64('0x7'),attributes,{'tableName':_0xeb64('0x8'),'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 1f23b5a..899d607 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 _0xdf19=['debug','stringify','catch','ShowVtigerAccount','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','VtigerAccount,\x20%s,\x20%s','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','then'];(function(_0x1ee04d,_0x4b9f61){var _0x46a06e=function(_0x515e3a){while(--_0x515e3a){_0x1ee04d['push'](_0x1ee04d['shift']());}};_0x46a06e(++_0x4b9f61);}(_0xdf19,0x181));var _0x9df1=function(_0x1cd3e3,_0xbeb106){_0x1cd3e3=_0x1cd3e3-0x0;var _0x4a3336=_0xdf19[_0x1cd3e3];return _0x4a3336;};'use strict';var _=require(_0x9df1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9df1('0x1'));var rs=require(_0x9df1('0x2'));var fs=require('fs');var Redis=require(_0x9df1('0x3'));var db=require(_0x9df1('0x4'))['db'];var utils=require(_0x9df1('0x5'));var logger=require(_0x9df1('0x6'))(_0x9df1('0x7'));var config=require(_0x9df1('0x8'));var jayson=require(_0x9df1('0x9'));var client=jayson[_0x9df1('0xa')][_0x9df1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x265ef0,_0x4e1708,_0x5d83cd){return new BPromise(function(_0x354382,_0x3d2464){return client[_0x9df1('0xc')](_0x265ef0,_0x5d83cd)['then'](function(_0x54f0ca){logger[_0x9df1('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x4e1708,_0x9df1('0xe'));logger['debug'](_0x9df1('0xf'),_0x4e1708,'request\x20sent',JSON['stringify'](_0x54f0ca));if(_0x54f0ca[_0x9df1('0x10')]){if(_0x54f0ca[_0x9df1('0x10')][_0x9df1('0x11')]===0x1f4){logger[_0x9df1('0x10')](_0x9df1('0x12'),_0x4e1708,_0x54f0ca[_0x9df1('0x10')][_0x9df1('0x13')]);return _0x3d2464(_0x54f0ca[_0x9df1('0x10')][_0x9df1('0x13')]);}logger['error'](_0x9df1('0x12'),_0x4e1708,_0x54f0ca[_0x9df1('0x10')][_0x9df1('0x13')]);return _0x354382(_0x54f0ca['error'][_0x9df1('0x13')]);}else{logger[_0x9df1('0xd')](_0x9df1('0x12'),_0x4e1708,_0x9df1('0xe'));_0x354382(_0x54f0ca[_0x9df1('0x14')][_0x9df1('0x13')]);}})['catch'](function(_0x297d21){logger['error'](_0x9df1('0x12'),_0x4e1708,_0x297d21);_0x3d2464(_0x297d21);});});}exports[_0x9df1('0x15')]=function(_0x1b1849){var _0x366014=this;return new Promise(function(_0x4726b4,_0x2d013e){return db[_0x9df1('0x16')][_0x9df1('0x17')]({'raw':_0x1b1849['options']?_0x1b1849[_0x9df1('0x18')][_0x9df1('0x19')]===undefined?!![]:![]:!![],'where':_0x1b1849[_0x9df1('0x18')]?_0x1b1849[_0x9df1('0x18')][_0x9df1('0x1a')]||null:null,'attributes':_0x1b1849[_0x9df1('0x18')]?_0x1b1849['options'][_0x9df1('0x1b')]||null:null,'limit':_0x1b1849[_0x9df1('0x18')]?_0x1b1849[_0x9df1('0x18')][_0x9df1('0x1c')]||null:null,'include':_0x1b1849[_0x9df1('0x18')]?_0x1b1849[_0x9df1('0x18')][_0x9df1('0x1d')]?_[_0x9df1('0x1e')](_0x1b1849[_0x9df1('0x18')][_0x9df1('0x1d')],function(_0x19fd1d){return{'model':db[_0x19fd1d[_0x9df1('0x1f')]],'as':_0x19fd1d['as'],'attributes':_0x19fd1d[_0x9df1('0x1b')],'include':_0x19fd1d['include']?_['map'](_0x19fd1d[_0x9df1('0x1d')],function(_0xc85669){return{'model':db[_0xc85669[_0x9df1('0x1f')]],'as':_0xc85669['as'],'attributes':_0xc85669[_0x9df1('0x1b')],'include':_0xc85669[_0x9df1('0x1d')]?_[_0x9df1('0x1e')](_0xc85669[_0x9df1('0x1d')],function(_0x52b9e5){return{'model':db[_0x52b9e5[_0x9df1('0x1f')]],'as':_0x52b9e5['as'],'attributes':_0x52b9e5['attributes']};}):[]};}):[]};}):[]:[]})[_0x9df1('0x20')](function(_0x33e1d5){logger[_0x9df1('0xd')](_0x9df1('0x15'),_0x1b1849);logger[_0x9df1('0x21')](_0x9df1('0x15'),_0x1b1849,JSON[_0x9df1('0x22')](_0x33e1d5));_0x4726b4(_0x33e1d5);})[_0x9df1('0x23')](function(_0x37bf7b){logger[_0x9df1('0x10')]('GetVtigerAccount',_0x37bf7b[_0x9df1('0x13')],_0x1b1849);_0x2d013e(_0x366014[_0x9df1('0x10')](0x1f4,_0x37bf7b[_0x9df1('0x13')]));});});};exports[_0x9df1('0x24')]=function(_0x4e2680){var _0x592027=this;return new Promise(function(_0x36a46b,_0x260abb){return db['VtigerAccount'][_0x9df1('0x25')]({'raw':_0x4e2680['options']?_0x4e2680['options'][_0x9df1('0x19')]===undefined?!![]:![]:!![],'where':_0x4e2680[_0x9df1('0x18')]?_0x4e2680[_0x9df1('0x18')][_0x9df1('0x1a')]||null:null,'attributes':_0x4e2680[_0x9df1('0x18')]?_0x4e2680['options'][_0x9df1('0x1b')]||null:null,'include':_0x4e2680[_0x9df1('0x18')]?_0x4e2680['options']['include']?_['map'](_0x4e2680[_0x9df1('0x18')][_0x9df1('0x1d')],function(_0x47f061){return{'model':db[_0x47f061[_0x9df1('0x1f')]],'as':_0x47f061['as'],'attributes':_0x47f061[_0x9df1('0x1b')],'include':_0x47f061[_0x9df1('0x1d')]?_[_0x9df1('0x1e')](_0x47f061[_0x9df1('0x1d')],function(_0x5c0d48){return{'model':db[_0x5c0d48['model']],'as':_0x5c0d48['as'],'attributes':_0x5c0d48[_0x9df1('0x1b')],'include':_0x5c0d48['include']?_[_0x9df1('0x1e')](_0x5c0d48[_0x9df1('0x1d')],function(_0x279e96){return{'model':db[_0x279e96[_0x9df1('0x1f')]],'as':_0x279e96['as'],'attributes':_0x279e96[_0x9df1('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9df1('0x20')](function(_0x5dfdfa){logger['info'](_0x9df1('0x24'),_0x4e2680);logger[_0x9df1('0x21')](_0x9df1('0x24'),_0x4e2680,JSON[_0x9df1('0x22')](_0x5dfdfa));_0x36a46b(_0x5dfdfa);})['catch'](function(_0x4d9697){logger['error'](_0x9df1('0x24'),_0x4d9697[_0x9df1('0x13')],_0x4e2680);_0x260abb(_0x592027['error'](0x1f4,_0x4d9697[_0x9df1('0x13')]));});});}; \ No newline at end of file +var _0xe24b=['then','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','attributes','include','map','model','find','where','ShowVtigerAccount','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','request'];(function(_0x505aa7,_0x5201a2){var _0x2918f0=function(_0x9665c6){while(--_0x9665c6){_0x505aa7['push'](_0x505aa7['shift']());}};_0x2918f0(++_0x5201a2);}(_0xe24b,0x11f));var _0xbe24=function(_0xeb67d8,_0x14a337){_0xeb67d8=_0xeb67d8-0x0;var _0x4138f9=_0xe24b[_0xeb67d8];return _0x4138f9;};'use strict';var _=require('lodash');var util=require(_0xbe24('0x0'));var moment=require(_0xbe24('0x1'));var BPromise=require(_0xbe24('0x2'));var rs=require(_0xbe24('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbe24('0x4'))['db'];var utils=require(_0xbe24('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xbe24('0x6'));var client=jayson[_0xbe24('0x7')][_0xbe24('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ba427,_0x5bc422,_0x32de84){return new BPromise(function(_0x498a13,_0x46ef1b){return client[_0xbe24('0x9')](_0x2ba427,_0x32de84)[_0xbe24('0xa')](function(_0x5c816f){logger['info'](_0xbe24('0xb'),_0x5bc422,_0xbe24('0xc'));logger[_0xbe24('0xd')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x5bc422,_0xbe24('0xc'),JSON[_0xbe24('0xe')](_0x5c816f));if(_0x5c816f['error']){if(_0x5c816f[_0xbe24('0xf')][_0xbe24('0x10')]===0x1f4){logger[_0xbe24('0xf')](_0xbe24('0xb'),_0x5bc422,_0x5c816f[_0xbe24('0xf')][_0xbe24('0x11')]);return _0x46ef1b(_0x5c816f[_0xbe24('0xf')][_0xbe24('0x11')]);}logger['error'](_0xbe24('0xb'),_0x5bc422,_0x5c816f['error'][_0xbe24('0x11')]);return _0x498a13(_0x5c816f[_0xbe24('0xf')][_0xbe24('0x11')]);}else{logger[_0xbe24('0x12')]('VtigerAccount,\x20%s,\x20%s',_0x5bc422,_0xbe24('0xc'));_0x498a13(_0x5c816f[_0xbe24('0x13')][_0xbe24('0x11')]);}})[_0xbe24('0x14')](function(_0x1a4ad3){logger[_0xbe24('0xf')](_0xbe24('0xb'),_0x5bc422,_0x1a4ad3);_0x46ef1b(_0x1a4ad3);});});}exports[_0xbe24('0x15')]=function(_0xfac772){var _0x5975a0=this;return new Promise(function(_0x41f30b,_0x45870d){return db[_0xbe24('0x16')][_0xbe24('0x17')]({'raw':_0xfac772[_0xbe24('0x18')]?_0xfac772['options'][_0xbe24('0x19')]===undefined?!![]:![]:!![],'where':_0xfac772['options']?_0xfac772[_0xbe24('0x18')]['where']||null:null,'attributes':_0xfac772[_0xbe24('0x18')]?_0xfac772['options'][_0xbe24('0x1a')]||null:null,'limit':_0xfac772[_0xbe24('0x18')]?_0xfac772[_0xbe24('0x18')]['limit']||null:null,'include':_0xfac772[_0xbe24('0x18')]?_0xfac772['options'][_0xbe24('0x1b')]?_[_0xbe24('0x1c')](_0xfac772['options'][_0xbe24('0x1b')],function(_0x56adba){return{'model':db[_0x56adba[_0xbe24('0x1d')]],'as':_0x56adba['as'],'attributes':_0x56adba[_0xbe24('0x1a')],'include':_0x56adba['include']?_['map'](_0x56adba['include'],function(_0x1ff14b){return{'model':db[_0x1ff14b[_0xbe24('0x1d')]],'as':_0x1ff14b['as'],'attributes':_0x1ff14b['attributes'],'include':_0x1ff14b[_0xbe24('0x1b')]?_[_0xbe24('0x1c')](_0x1ff14b[_0xbe24('0x1b')],function(_0x3c9ef0){return{'model':db[_0x3c9ef0['model']],'as':_0x3c9ef0['as'],'attributes':_0x3c9ef0[_0xbe24('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbe24('0xa')](function(_0x2f2d37){logger['info']('GetVtigerAccount',_0xfac772);logger[_0xbe24('0xd')](_0xbe24('0x15'),_0xfac772,JSON[_0xbe24('0xe')](_0x2f2d37));_0x41f30b(_0x2f2d37);})[_0xbe24('0x14')](function(_0xa2678d){logger[_0xbe24('0xf')](_0xbe24('0x15'),_0xa2678d['message'],_0xfac772);_0x45870d(_0x5975a0[_0xbe24('0xf')](0x1f4,_0xa2678d[_0xbe24('0x11')]));});});};exports['ShowVtigerAccount']=function(_0x4b7a5e){var _0x2c8fe1=this;return new Promise(function(_0x43a08c,_0x836df0){return db['VtigerAccount'][_0xbe24('0x1e')]({'raw':_0x4b7a5e[_0xbe24('0x18')]?_0x4b7a5e[_0xbe24('0x18')][_0xbe24('0x19')]===undefined?!![]:![]:!![],'where':_0x4b7a5e[_0xbe24('0x18')]?_0x4b7a5e[_0xbe24('0x18')][_0xbe24('0x1f')]||null:null,'attributes':_0x4b7a5e[_0xbe24('0x18')]?_0x4b7a5e[_0xbe24('0x18')][_0xbe24('0x1a')]||null:null,'include':_0x4b7a5e[_0xbe24('0x18')]?_0x4b7a5e[_0xbe24('0x18')][_0xbe24('0x1b')]?_[_0xbe24('0x1c')](_0x4b7a5e[_0xbe24('0x18')][_0xbe24('0x1b')],function(_0x1f0be3){return{'model':db[_0x1f0be3['model']],'as':_0x1f0be3['as'],'attributes':_0x1f0be3[_0xbe24('0x1a')],'include':_0x1f0be3[_0xbe24('0x1b')]?_[_0xbe24('0x1c')](_0x1f0be3['include'],function(_0x53ac6d){return{'model':db[_0x53ac6d[_0xbe24('0x1d')]],'as':_0x53ac6d['as'],'attributes':_0x53ac6d[_0xbe24('0x1a')],'include':_0x53ac6d[_0xbe24('0x1b')]?_[_0xbe24('0x1c')](_0x53ac6d['include'],function(_0x2918a2){return{'model':db[_0x2918a2[_0xbe24('0x1d')]],'as':_0x2918a2['as'],'attributes':_0x2918a2[_0xbe24('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b0160){logger[_0xbe24('0x12')](_0xbe24('0x20'),_0x4b7a5e);logger[_0xbe24('0xd')](_0xbe24('0x20'),_0x4b7a5e,JSON['stringify'](_0x4b0160));_0x43a08c(_0x4b0160);})[_0xbe24('0x14')](function(_0x14f190){logger[_0xbe24('0xf')]('ShowVtigerAccount',_0x14f190[_0xbe24('0x11')],_0x4b7a5e);_0x836df0(_0x2c8fe1[_0xbe24('0xf')](0x1f4,_0x14f190[_0xbe24('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 78e0869..b3aa32f 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 _0x5f2f=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getDescriptions','post','create'];(function(_0x4974e5,_0x563b0c){var _0x1a6ece=function(_0x338c13){while(--_0x338c13){_0x4974e5['push'](_0x4974e5['shift']());}};_0x1a6ece(++_0x563b0c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x44ebc2,_0x5986cf){_0x44ebc2=_0x44ebc2-0x0;var _0x22cdb5=_0x5f2f[_0x44ebc2];return _0x22cdb5;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./intVtigerConfiguration.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['getFields']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['getSubjects']);router[_0xf5f2('0x8')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0xf')]('/',auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router[_0xf5f2('0x11')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x13')]('/:id',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x14')]);module[_0xf5f2('0x15')]=router; \ No newline at end of file +var _0xb10b=['/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x1aa562,_0x14ef83){var _0x289314=function(_0x7bd815){while(--_0x7bd815){_0x1aa562['push'](_0x1aa562['shift']());}};_0x289314(++_0x14ef83);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d2c91,_0x2f965f){_0x3d2c91=_0x3d2c91-0x0;var _0x4ea4df=_0xb10b[_0x3d2c91];return _0x4ea4df;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var auth=require(_0xbb10('0x4'));var interaction=require(_0xbb10('0x5'));var config=require(_0xbb10('0x6'));var controller=require(_0xbb10('0x7'));router[_0xbb10('0x8')]('/',auth[_0xbb10('0x9')](),controller['index']);router[_0xbb10('0x8')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0xb')]);router[_0xbb10('0x8')](_0xbb10('0xc'),auth[_0xbb10('0x9')](),controller[_0xbb10('0xd')]);router[_0xbb10('0x8')](_0xbb10('0xe'),auth[_0xbb10('0x9')](),controller['getSubjects']);router['get'](_0xbb10('0xf'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x10')]);router['post']('/',auth[_0xbb10('0x9')](),controller['create']);router[_0xbb10('0x11')](_0xbb10('0xa'),auth[_0xbb10('0x9')](),controller[_0xbb10('0x12')]);router[_0xbb10('0x13')](_0xbb10('0xa'),auth['isAuthenticated'](),controller[_0xbb10('0x14')]);module[_0xbb10('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 9c78891..ffc8ef5 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 _0x626f=['STRING','sequelize','exports'];(function(_0x154c6c,_0x5d6c86){var _0x57249c=function(_0x2e56b3){while(--_0x2e56b3){_0x154c6c['push'](_0x154c6c['shift']());}};_0x57249c(++_0x5d6c86);}(_0x626f,0x7f));var _0xf626=function(_0x435dae,_0x4ee7f4){_0x435dae=_0x435dae-0x0;var _0x3f8370=_0x626f[_0x435dae];return _0x3f8370;};'use strict';var Sequelize=require(_0xf626('0x0'));module[_0xf626('0x1')]={'name':{'type':Sequelize[_0xf626('0x2')]},'description':{'type':Sequelize[_0xf626('0x2')]}}; \ No newline at end of file +var _0x92eb=['exports'];(function(_0x4cee4b,_0x1dfff3){var _0x4d891d=function(_0x3722ba){while(--_0x3722ba){_0x4cee4b['push'](_0x4cee4b['shift']());}};_0x4d891d(++_0x1dfff3);}(_0x92eb,0x1a3));var _0xb92e=function(_0x2f0d94,_0x2281d4){_0x2f0d94=_0x2f0d94-0x0;var _0x391508=_0x92eb[_0x2f0d94];return _0x391508;};'use strict';var Sequelize=require('sequelize');module[_0xb92e('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 7b75477..b00ed37 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 _0x587a=['fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','show','params','merge','find','create','body','getFields','findOne','VtigerField','order','getSubjects','getDescriptions','pick','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','count','offset','limit','set','apply','save','update','destroy','end','sendStatus','stack','name','send','map','VtigerConfiguration','rawAttributes','fieldName','type','model','query','keys','attributes','intersection'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x587a,0x18b));var _0xa587=function(_0x463f91,_0x26ec38){_0x463f91=_0x463f91-0x0;var _0x552e15=_0x587a[_0x463f91];return _0x552e15;};'use strict';var pdf=require(_0xa587('0x0'));var emlformat=require(_0xa587('0x1'));var rimraf=require(_0xa587('0x2'));var zipdir=require(_0xa587('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa587('0x4'));var BPromise=require(_0xa587('0x5'));var Mustache=require(_0xa587('0x6'));var util=require(_0xa587('0x7'));var path=require('path');var sox=require(_0xa587('0x8'));var csv=require(_0xa587('0x9'));var ejs=require(_0xa587('0xa'));var fs=require('fs');var _=require(_0xa587('0xb'));var squel=require(_0xa587('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa587('0xd'));var toCsv=require(_0xa587('0x9'));var querystring=require(_0xa587('0xe'));var Papa=require(_0xa587('0xf'));var Redis=require(_0xa587('0x10'));var authService=require(_0xa587('0x11'));var qs=require(_0xa587('0x12'));var as=require(_0xa587('0x13'));var hardwareService=require(_0xa587('0x14'));var logger=require(_0xa587('0x15'))('api');var utils=require(_0xa587('0x16'));var config=require(_0xa587('0x17'));var licenseUtil=require(_0xa587('0x18'));var db=require(_0xa587('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xa587('0x1a')][_0xa587('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x56c380,_0x4eb46b,_0x5cd0ec,_0x58fd50){return new BPromise(function(_0x22b5d2,_0x4780db){var _0x37b22c=_0x58fd50||client;return _0x37b22c[_0xa587('0x1c')](_0x56c380,_0x5cd0ec)[_0xa587('0x1d')](function(_0x54d3bc){logger[_0xa587('0x1e')](_0xa587('0x1f'),_0x4eb46b,_0xa587('0x20'));logger[_0xa587('0x21')](_0xa587('0x22'),_0x4eb46b,_0xa587('0x20'),JSON['stringify'](_0x54d3bc));if(_0x54d3bc[_0xa587('0x23')]){if(_0x54d3bc[_0xa587('0x23')][_0xa587('0x24')]===0x1f4){logger['error'](_0xa587('0x1f'),_0x4eb46b,_0x54d3bc[_0xa587('0x23')]['message']);return _0x4780db(_0x54d3bc[_0xa587('0x23')][_0xa587('0x25')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x4eb46b,_0x54d3bc[_0xa587('0x23')][_0xa587('0x25')]);return _0x22b5d2(_0x54d3bc['error'][_0xa587('0x25')]);}else{logger[_0xa587('0x1e')]('VtigerConfiguration,\x20%s,\x20%s',_0x4eb46b,_0xa587('0x20'));_0x22b5d2(_0x54d3bc[_0xa587('0x26')][_0xa587('0x25')]);}})[_0xa587('0x27')](function(_0x4db979){logger[_0xa587('0x23')](_0xa587('0x1f'),_0x4eb46b,_0x4db979);_0x4780db(_0x4db979);});});}function respondWithStatusCode(_0x4abca3,_0x18fef3){_0x18fef3=_0x18fef3||0xcc;return function(_0x40e4bc){if(_0x40e4bc){return _0x4abca3['sendStatus'](_0x18fef3);}return _0x4abca3[_0xa587('0x28')](_0x18fef3)['end']();};}function respondWithResult(_0xfe01d,_0x5e3a78){_0x5e3a78=_0x5e3a78||0xc8;return function(_0xfc03bd){if(_0xfc03bd){return _0xfe01d[_0xa587('0x28')](_0x5e3a78)[_0xa587('0x29')](_0xfc03bd);}};}function respondWithFilteredResult(_0x3e1eda,_0x1a3a1d){return function(_0x4b52d8){if(_0x4b52d8){var _0x27df76=_0x4b52d8[_0xa587('0x2a')],_0x3e4773=_0x1a3a1d['offset'],_0x556c3e=_0x1a3a1d[_0xa587('0x2b')]+_0x1a3a1d[_0xa587('0x2c')],_0x1e1ae8;if(_0x556c3e>=_0x27df76){_0x556c3e=_0x27df76;_0x1e1ae8=0xc8;}else{_0x1e1ae8=0xce;}_0x3e1eda['status'](_0x1e1ae8);return _0x3e1eda[_0xa587('0x2d')]('Content-Range',_0x3e4773+'-'+_0x556c3e+'/'+_0x27df76)['json'](_0x4b52d8);}return null;};}function patchUpdates(_0x42b370){return function(_0x794ee4){try{jsonpatch[_0xa587('0x2e')](_0x794ee4,_0x42b370,!![]);}catch(_0x2bad22){return BPromise['reject'](_0x2bad22);}return _0x794ee4[_0xa587('0x2f')]();};}function saveUpdates(_0x59c44e,_0x54d475){return function(_0x36d526){if(_0x36d526){return _0x36d526[_0xa587('0x30')](_0x59c44e)['then'](function(_0x12b5d0){return _0x12b5d0;});}return null;};}function removeEntity(_0x474197,_0x3749ba){return function(_0x21ee33){if(_0x21ee33){return _0x21ee33[_0xa587('0x31')]()['then'](function(){_0x474197['status'](0xcc)[_0xa587('0x32')]();});}};}function handleEntityNotFound(_0x2dc62d,_0x3e7218){return function(_0x3132f1){if(!_0x3132f1){_0x2dc62d[_0xa587('0x33')](0x194);}return _0x3132f1;};}function handleError(_0x4614eb,_0x2d5fc5){_0x2d5fc5=_0x2d5fc5||0x1f4;return function(_0x207108){logger['error'](_0x207108[_0xa587('0x34')]);if(_0x207108[_0xa587('0x35')]){delete _0x207108['name'];}_0x4614eb[_0xa587('0x28')](_0x2d5fc5)[_0xa587('0x36')](_0x207108);};}exports['index']=function(_0xdd6045,_0x32fc0d){var _0x3d9787={},_0xbe0111={},_0xf34573={'count':0x0,'rows':[]};var _0x2cff93=_[_0xa587('0x37')](db[_0xa587('0x38')][_0xa587('0x39')],function(_0x5a25a1){return{'name':_0x5a25a1[_0xa587('0x3a')],'type':_0x5a25a1[_0xa587('0x3b')]['key']};});_0xbe0111[_0xa587('0x3c')]=_[_0xa587('0x37')](_0x2cff93,'name');_0xbe0111[_0xa587('0x3d')]=_[_0xa587('0x3e')](_0xdd6045[_0xa587('0x3d')]);_0xbe0111['filters']=_['intersection'](_0xbe0111[_0xa587('0x3c')],_0xbe0111[_0xa587('0x3d')]);_0x3d9787[_0xa587('0x3f')]=_[_0xa587('0x40')](_0xbe0111[_0xa587('0x3c')],qs[_0xa587('0x41')](_0xdd6045[_0xa587('0x3d')][_0xa587('0x41')]));_0x3d9787['attributes']=_0x3d9787[_0xa587('0x3f')][_0xa587('0x42')]?_0x3d9787[_0xa587('0x3f')]:_0xbe0111[_0xa587('0x3c')];if(!_0xdd6045[_0xa587('0x3d')][_0xa587('0x43')](_0xa587('0x44'))){_0x3d9787['limit']=qs[_0xa587('0x2c')](_0xdd6045[_0xa587('0x3d')][_0xa587('0x2c')]);_0x3d9787[_0xa587('0x2b')]=qs[_0xa587('0x2b')](_0xdd6045[_0xa587('0x3d')][_0xa587('0x2b')]);}_0x3d9787['order']=qs[_0xa587('0x45')](_0xdd6045[_0xa587('0x3d')]['sort']);_0x3d9787['where']=qs[_0xa587('0x46')](_['pick'](_0xdd6045['query'],_0xbe0111[_0xa587('0x46')]),_0x2cff93);if(_0xdd6045[_0xa587('0x3d')][_0xa587('0x47')]){_0x3d9787['where']=_['merge'](_0x3d9787[_0xa587('0x48')],{'$or':_['map'](_0x2cff93,function(_0x83881f){if(_0x83881f[_0xa587('0x3b')]!==_0xa587('0x49')){var _0x15007f={};_0x15007f[_0x83881f[_0xa587('0x35')]]={'$like':'%'+_0xdd6045[_0xa587('0x3d')]['filter']+'%'};return _0x15007f;}})});}_0x3d9787=_['merge']({},_0x3d9787,_0xdd6045[_0xa587('0x4a')]);var _0x26ca4d={'where':_0x3d9787['where']};return db[_0xa587('0x38')][_0xa587('0x2a')](_0x26ca4d)[_0xa587('0x1d')](function(_0xb0847d){_0xf34573[_0xa587('0x2a')]=_0xb0847d;if(_0xdd6045[_0xa587('0x3d')][_0xa587('0x4b')]){_0x3d9787[_0xa587('0x4c')]=[{'all':!![]}];}return db[_0xa587('0x38')][_0xa587('0x4d')](_0x3d9787);})['then'](function(_0x20189f){_0xf34573[_0xa587('0x4e')]=_0x20189f;return _0xf34573;})[_0xa587('0x1d')](respondWithFilteredResult(_0x32fc0d,_0x3d9787))[_0xa587('0x27')](handleError(_0x32fc0d,null));};exports[_0xa587('0x4f')]=function(_0xdbe5a1,_0x451f33){var _0x1e1b18={'raw':![],'where':{'id':_0xdbe5a1[_0xa587('0x50')]['id']}},_0x4d1648={};_0x4d1648[_0xa587('0x3c')]=_[_0xa587('0x3e')](db['VtigerConfiguration'][_0xa587('0x39')]);_0x4d1648['query']=_[_0xa587('0x3e')](_0xdbe5a1[_0xa587('0x3d')]);_0x4d1648[_0xa587('0x46')]=_[_0xa587('0x40')](_0x4d1648['model'],_0x4d1648[_0xa587('0x3d')]);_0x1e1b18[_0xa587('0x3f')]=_['intersection'](_0x4d1648[_0xa587('0x3c')],qs[_0xa587('0x41')](_0xdbe5a1[_0xa587('0x3d')][_0xa587('0x41')]));_0x1e1b18['attributes']=_0x1e1b18[_0xa587('0x3f')][_0xa587('0x42')]?_0x1e1b18[_0xa587('0x3f')]:_0x4d1648[_0xa587('0x3c')];if(_0xdbe5a1[_0xa587('0x3d')][_0xa587('0x4b')]){_0x1e1b18['include']=[{'all':!![]}];}_0x1e1b18=_[_0xa587('0x51')]({},_0x1e1b18,_0xdbe5a1['options']);return db['VtigerConfiguration'][_0xa587('0x52')](_0x1e1b18)['then'](handleEntityNotFound(_0x451f33,null))[_0xa587('0x1d')](respondWithResult(_0x451f33,null))[_0xa587('0x27')](handleError(_0x451f33,null));};exports['create']=function(_0x357bcd,_0x4ab22f){return db[_0xa587('0x38')][_0xa587('0x53')](_0x357bcd[_0xa587('0x54')],{})[_0xa587('0x1d')](respondWithResult(_0x4ab22f,0xc9))['catch'](handleError(_0x4ab22f,null));};exports[_0xa587('0x30')]=function(_0x51feff,_0x11a946){if(_0x51feff['body']['id']){delete _0x51feff['body']['id'];}return db[_0xa587('0x38')]['find']({'where':{'id':_0x51feff[_0xa587('0x50')]['id']}})[_0xa587('0x1d')](handleEntityNotFound(_0x11a946,null))['then'](saveUpdates(_0x51feff[_0xa587('0x54')],null))[_0xa587('0x1d')](respondWithResult(_0x11a946,null))['catch'](handleError(_0x11a946,null));};exports['destroy']=function(_0x2942ef,_0x33c088){return db[_0xa587('0x38')][_0xa587('0x52')]({'where':{'id':_0x2942ef['params']['id']}})[_0xa587('0x1d')](handleEntityNotFound(_0x33c088,null))[_0xa587('0x1d')](removeEntity(_0x33c088,null))[_0xa587('0x27')](handleError(_0x33c088,null));};exports[_0xa587('0x55')]=function(_0x28f500,_0x31f1e2,_0x3d2c97){var _0x46aaf1={};var _0x3cb200={};var _0x407245;var _0x56d274;return db['VtigerConfiguration'][_0xa587('0x56')]({'where':{'id':_0x28f500['params']['id']}})[_0xa587('0x1d')](handleEntityNotFound(_0x31f1e2,null))[_0xa587('0x1d')](function(_0x5b8ac8){if(_0x5b8ac8){_0x407245=_0x5b8ac8;_0x3cb200['model']=_['keys'](db[_0xa587('0x57')][_0xa587('0x39')]);_0x3cb200[_0xa587('0x3d')]=_[_0xa587('0x3e')](_0x28f500[_0xa587('0x3d')]);_0x3cb200['filters']=_[_0xa587('0x40')](_0x3cb200[_0xa587('0x3c')],_0x3cb200[_0xa587('0x3d')]);_0x46aaf1['attributes']=_[_0xa587('0x40')](_0x3cb200[_0xa587('0x3c')],qs[_0xa587('0x41')](_0x28f500[_0xa587('0x3d')][_0xa587('0x41')]));_0x46aaf1[_0xa587('0x3f')]=_0x46aaf1[_0xa587('0x3f')][_0xa587('0x42')]?_0x46aaf1[_0xa587('0x3f')]:_0x3cb200[_0xa587('0x3c')];_0x46aaf1[_0xa587('0x58')]=qs[_0xa587('0x45')](_0x28f500['query'][_0xa587('0x45')]);_0x46aaf1[_0xa587('0x48')]=qs[_0xa587('0x46')](_['pick'](_0x28f500[_0xa587('0x3d')],_0x3cb200[_0xa587('0x46')]));if(_0x28f500[_0xa587('0x3d')][_0xa587('0x47')]){_0x46aaf1[_0xa587('0x48')]=_['merge'](_0x46aaf1['where'],{'$or':_['map'](_0x46aaf1[_0xa587('0x3f')],function(_0x31150a){var _0x4e1313={};_0x4e1313[_0x31150a]={'$like':'%'+_0x28f500[_0xa587('0x3d')][_0xa587('0x47')]+'%'};return _0x4e1313;})});}_0x46aaf1=_[_0xa587('0x51')]({},_0x46aaf1,_0x28f500[_0xa587('0x4a')]);return _0x407245[_0xa587('0x55')](_0x46aaf1);}})['then'](function(_0x48c66d){if(_0x48c66d){_0x56d274=_0x48c66d[_0xa587('0x42')];if(!_0x28f500['query']['hasOwnProperty'](_0xa587('0x44'))){_0x46aaf1['limit']=qs[_0xa587('0x2c')](_0x28f500[_0xa587('0x3d')][_0xa587('0x2c')]);_0x46aaf1['offset']=qs[_0xa587('0x2b')](_0x28f500['query'][_0xa587('0x2b')]);}return _0x407245[_0xa587('0x55')](_0x46aaf1);}})[_0xa587('0x1d')](function(_0x1b05ba){if(_0x1b05ba){return _0x1b05ba?{'count':_0x56d274,'rows':_0x1b05ba}:null;}})[_0xa587('0x1d')](respondWithResult(_0x31f1e2,null))[_0xa587('0x27')](handleError(_0x31f1e2,null));};exports['getSubjects']=function(_0x1f2ad6,_0x4959a4,_0x44965e){var _0x15c11d={};var _0x48c35f={};var _0x10f8d9;var _0x457786;return db[_0xa587('0x38')][_0xa587('0x56')]({'where':{'id':_0x1f2ad6[_0xa587('0x50')]['id']}})[_0xa587('0x1d')](handleEntityNotFound(_0x4959a4,null))[_0xa587('0x1d')](function(_0x196807){if(_0x196807){_0x10f8d9=_0x196807;_0x48c35f[_0xa587('0x3c')]=_[_0xa587('0x3e')](db[_0xa587('0x57')]['rawAttributes']);_0x48c35f[_0xa587('0x3d')]=_[_0xa587('0x3e')](_0x1f2ad6['query']);_0x48c35f['filters']=_[_0xa587('0x40')](_0x48c35f[_0xa587('0x3c')],_0x48c35f[_0xa587('0x3d')]);_0x15c11d['attributes']=_[_0xa587('0x40')](_0x48c35f[_0xa587('0x3c')],qs[_0xa587('0x41')](_0x1f2ad6[_0xa587('0x3d')][_0xa587('0x41')]));_0x15c11d[_0xa587('0x3f')]=_0x15c11d['attributes'][_0xa587('0x42')]?_0x15c11d[_0xa587('0x3f')]:_0x48c35f[_0xa587('0x3c')];_0x15c11d[_0xa587('0x58')]=qs[_0xa587('0x45')](_0x1f2ad6[_0xa587('0x3d')][_0xa587('0x45')]);_0x15c11d[_0xa587('0x48')]=qs['filters'](_['pick'](_0x1f2ad6[_0xa587('0x3d')],_0x48c35f[_0xa587('0x46')]));if(_0x1f2ad6[_0xa587('0x3d')][_0xa587('0x47')]){_0x15c11d['where']=_[_0xa587('0x51')](_0x15c11d['where'],{'$or':_[_0xa587('0x37')](_0x15c11d[_0xa587('0x3f')],function(_0x3abd7b){var _0x3add0a={};_0x3add0a[_0x3abd7b]={'$like':'%'+_0x1f2ad6[_0xa587('0x3d')][_0xa587('0x47')]+'%'};return _0x3add0a;})});}_0x15c11d=_[_0xa587('0x51')]({},_0x15c11d,_0x1f2ad6[_0xa587('0x4a')]);return _0x10f8d9[_0xa587('0x59')](_0x15c11d);}})[_0xa587('0x1d')](function(_0x41aa10){if(_0x41aa10){_0x457786=_0x41aa10[_0xa587('0x42')];if(!_0x1f2ad6['query'][_0xa587('0x43')](_0xa587('0x44'))){_0x15c11d[_0xa587('0x2c')]=qs[_0xa587('0x2c')](_0x1f2ad6[_0xa587('0x3d')][_0xa587('0x2c')]);_0x15c11d[_0xa587('0x2b')]=qs[_0xa587('0x2b')](_0x1f2ad6[_0xa587('0x3d')][_0xa587('0x2b')]);}return _0x10f8d9[_0xa587('0x59')](_0x15c11d);}})[_0xa587('0x1d')](function(_0x242fa7){if(_0x242fa7){return _0x242fa7?{'count':_0x457786,'rows':_0x242fa7}:null;}})[_0xa587('0x1d')](respondWithResult(_0x4959a4,null))[_0xa587('0x27')](handleError(_0x4959a4,null));};exports[_0xa587('0x5a')]=function(_0x399193,_0x315669,_0x426237){var _0x5b07a1={};var _0x465cb6={};var _0xddff1f;var _0x10bba5;return db[_0xa587('0x38')]['findOne']({'where':{'id':_0x399193['params']['id']}})[_0xa587('0x1d')](handleEntityNotFound(_0x315669,null))['then'](function(_0x13f918){if(_0x13f918){_0xddff1f=_0x13f918;_0x465cb6[_0xa587('0x3c')]=_[_0xa587('0x3e')](db['VtigerField'][_0xa587('0x39')]);_0x465cb6['query']=_[_0xa587('0x3e')](_0x399193[_0xa587('0x3d')]);_0x465cb6[_0xa587('0x46')]=_[_0xa587('0x40')](_0x465cb6[_0xa587('0x3c')],_0x465cb6[_0xa587('0x3d')]);_0x5b07a1[_0xa587('0x3f')]=_[_0xa587('0x40')](_0x465cb6[_0xa587('0x3c')],qs[_0xa587('0x41')](_0x399193[_0xa587('0x3d')]['fields']));_0x5b07a1[_0xa587('0x3f')]=_0x5b07a1[_0xa587('0x3f')][_0xa587('0x42')]?_0x5b07a1[_0xa587('0x3f')]:_0x465cb6[_0xa587('0x3c')];_0x5b07a1[_0xa587('0x58')]=qs[_0xa587('0x45')](_0x399193[_0xa587('0x3d')][_0xa587('0x45')]);_0x5b07a1[_0xa587('0x48')]=qs[_0xa587('0x46')](_[_0xa587('0x5b')](_0x399193[_0xa587('0x3d')],_0x465cb6[_0xa587('0x46')]));if(_0x399193[_0xa587('0x3d')]['filter']){_0x5b07a1[_0xa587('0x48')]=_['merge'](_0x5b07a1[_0xa587('0x48')],{'$or':_[_0xa587('0x37')](_0x5b07a1[_0xa587('0x3f')],function(_0x4c2cc6){var _0x43daa3={};_0x43daa3[_0x4c2cc6]={'$like':'%'+_0x399193[_0xa587('0x3d')][_0xa587('0x47')]+'%'};return _0x43daa3;})});}_0x5b07a1=_[_0xa587('0x51')]({},_0x5b07a1,_0x399193[_0xa587('0x4a')]);return _0xddff1f[_0xa587('0x5a')](_0x5b07a1);}})[_0xa587('0x1d')](function(_0xc00c8f){if(_0xc00c8f){_0x10bba5=_0xc00c8f[_0xa587('0x42')];if(!_0x399193[_0xa587('0x3d')][_0xa587('0x43')]('nolimit')){_0x5b07a1[_0xa587('0x2c')]=qs['limit'](_0x399193[_0xa587('0x3d')][_0xa587('0x2c')]);_0x5b07a1[_0xa587('0x2b')]=qs[_0xa587('0x2b')](_0x399193[_0xa587('0x3d')]['offset']);}return _0xddff1f[_0xa587('0x5a')](_0x5b07a1);}})['then'](function(_0x124f28){if(_0x124f28){return _0x124f28?{'count':_0x10bba5,'rows':_0x124f28}:null;}})[_0xa587('0x1d')](respondWithResult(_0x315669,null))[_0xa587('0x27')](handleError(_0x315669,null));}; \ No newline at end of file +var _0xeb4c=['count','offset','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','VtigerConfiguration','findAll','rows','catch','params','intersection','find','create','body','VtigerField','options','getFields','getSubjects','findOne','getDescriptions','html-pdf','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','json'];(function(_0xd575b8,_0x17e259){var _0x2c70d0=function(_0x468226){while(--_0x468226){_0xd575b8['push'](_0xd575b8['shift']());}};_0x2c70d0(++_0x17e259);}(_0xeb4c,0x93));var _0xceb4=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xeb4c[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require(_0xceb4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xceb4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xceb4('0x2'));var moment=require(_0xceb4('0x3'));var BPromise=require(_0xceb4('0x4'));var Mustache=require(_0xceb4('0x5'));var util=require(_0xceb4('0x6'));var path=require(_0xceb4('0x7'));var sox=require(_0xceb4('0x8'));var csv=require(_0xceb4('0x9'));var ejs=require(_0xceb4('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xceb4('0xb'));var crypto=require(_0xceb4('0xc'));var jsforce=require(_0xceb4('0xd'));var deskjs=require(_0xceb4('0xe'));var toCsv=require(_0xceb4('0x9'));var querystring=require('querystring');var Papa=require(_0xceb4('0xf'));var Redis=require(_0xceb4('0x10'));var authService=require(_0xceb4('0x11'));var qs=require(_0xceb4('0x12'));var as=require(_0xceb4('0x13'));var hardwareService=require(_0xceb4('0x14'));var logger=require(_0xceb4('0x15'))('api');var utils=require(_0xceb4('0x16'));var config=require(_0xceb4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xceb4('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xceb4('0x19')][_0xceb4('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x390302,_0x567df5,_0x4c1353,_0x1f913){return new BPromise(function(_0x14ebcb,_0x49f642){var _0x591ddb=_0x1f913||client;return _0x591ddb[_0xceb4('0x1b')](_0x390302,_0x4c1353)[_0xceb4('0x1c')](function(_0x12414e){logger[_0xceb4('0x1d')](_0xceb4('0x1e'),_0x567df5,_0xceb4('0x1f'));logger[_0xceb4('0x20')](_0xceb4('0x21'),_0x567df5,_0xceb4('0x1f'),JSON['stringify'](_0x12414e));if(_0x12414e[_0xceb4('0x22')]){if(_0x12414e['error'][_0xceb4('0x23')]===0x1f4){logger[_0xceb4('0x22')](_0xceb4('0x1e'),_0x567df5,_0x12414e[_0xceb4('0x22')][_0xceb4('0x24')]);return _0x49f642(_0x12414e[_0xceb4('0x22')][_0xceb4('0x24')]);}logger[_0xceb4('0x22')](_0xceb4('0x1e'),_0x567df5,_0x12414e['error'][_0xceb4('0x24')]);return _0x14ebcb(_0x12414e['error'][_0xceb4('0x24')]);}else{logger[_0xceb4('0x1d')](_0xceb4('0x1e'),_0x567df5,_0xceb4('0x1f'));_0x14ebcb(_0x12414e[_0xceb4('0x25')]['message']);}})['catch'](function(_0x3e256a){logger[_0xceb4('0x22')](_0xceb4('0x1e'),_0x567df5,_0x3e256a);_0x49f642(_0x3e256a);});});}function respondWithStatusCode(_0x4e8afd,_0x5b9682){_0x5b9682=_0x5b9682||0xcc;return function(_0x1f57bf){if(_0x1f57bf){return _0x4e8afd[_0xceb4('0x26')](_0x5b9682);}return _0x4e8afd[_0xceb4('0x27')](_0x5b9682)['end']();};}function respondWithResult(_0x3fe40e,_0xe24196){_0xe24196=_0xe24196||0xc8;return function(_0x409d95){if(_0x409d95){return _0x3fe40e['status'](_0xe24196)[_0xceb4('0x28')](_0x409d95);}};}function respondWithFilteredResult(_0xe4e13e,_0x34fe79){return function(_0x3d6768){if(_0x3d6768){var _0x4fb257=_0x3d6768[_0xceb4('0x29')],_0x35c76f=_0x34fe79[_0xceb4('0x2a')],_0x234fe0=_0x34fe79[_0xceb4('0x2a')]+_0x34fe79['limit'],_0x2ea213;if(_0x234fe0>=_0x4fb257){_0x234fe0=_0x4fb257;_0x2ea213=0xc8;}else{_0x2ea213=0xce;}_0xe4e13e['status'](_0x2ea213);return _0xe4e13e[_0xceb4('0x2b')](_0xceb4('0x2c'),_0x35c76f+'-'+_0x234fe0+'/'+_0x4fb257)[_0xceb4('0x28')](_0x3d6768);}return null;};}function patchUpdates(_0x1be8f7){return function(_0x3597b8){try{jsonpatch[_0xceb4('0x2d')](_0x3597b8,_0x1be8f7,!![]);}catch(_0x5222c0){return BPromise[_0xceb4('0x2e')](_0x5222c0);}return _0x3597b8[_0xceb4('0x2f')]();};}function saveUpdates(_0x21898d,_0x569554){return function(_0x54f71d){if(_0x54f71d){return _0x54f71d[_0xceb4('0x30')](_0x21898d)[_0xceb4('0x1c')](function(_0x526bd6){return _0x526bd6;});}return null;};}function removeEntity(_0x3159c0,_0xd7b072){return function(_0x5c48ce){if(_0x5c48ce){return _0x5c48ce[_0xceb4('0x31')]()[_0xceb4('0x1c')](function(){_0x3159c0['status'](0xcc)[_0xceb4('0x32')]();});}};}function handleEntityNotFound(_0x1adba1,_0x16a7b9){return function(_0x19f008){if(!_0x19f008){_0x1adba1[_0xceb4('0x26')](0x194);}return _0x19f008;};}function handleError(_0x32a5b7,_0x3cbe60){_0x3cbe60=_0x3cbe60||0x1f4;return function(_0x56094f){logger[_0xceb4('0x22')](_0x56094f[_0xceb4('0x33')]);if(_0x56094f[_0xceb4('0x34')]){delete _0x56094f[_0xceb4('0x34')];}_0x32a5b7['status'](_0x3cbe60)[_0xceb4('0x35')](_0x56094f);};}exports[_0xceb4('0x36')]=function(_0x3c7ad2,_0x522722){var _0x4042bf={},_0x5c4d71={},_0x2aad73={'count':0x0,'rows':[]};var _0x2b2b0a=_['map'](db['VtigerConfiguration'][_0xceb4('0x37')],function(_0x2f503c){return{'name':_0x2f503c[_0xceb4('0x38')],'type':_0x2f503c[_0xceb4('0x39')][_0xceb4('0x3a')]};});_0x5c4d71[_0xceb4('0x3b')]=_[_0xceb4('0x3c')](_0x2b2b0a,_0xceb4('0x34'));_0x5c4d71[_0xceb4('0x3d')]=_[_0xceb4('0x3e')](_0x3c7ad2[_0xceb4('0x3d')]);_0x5c4d71[_0xceb4('0x3f')]=_['intersection'](_0x5c4d71[_0xceb4('0x3b')],_0x5c4d71[_0xceb4('0x3d')]);_0x4042bf[_0xceb4('0x40')]=_['intersection'](_0x5c4d71[_0xceb4('0x3b')],qs[_0xceb4('0x41')](_0x3c7ad2[_0xceb4('0x3d')][_0xceb4('0x41')]));_0x4042bf[_0xceb4('0x40')]=_0x4042bf[_0xceb4('0x40')][_0xceb4('0x42')]?_0x4042bf[_0xceb4('0x40')]:_0x5c4d71[_0xceb4('0x3b')];if(!_0x3c7ad2[_0xceb4('0x3d')][_0xceb4('0x43')](_0xceb4('0x44'))){_0x4042bf[_0xceb4('0x45')]=qs[_0xceb4('0x45')](_0x3c7ad2[_0xceb4('0x3d')][_0xceb4('0x45')]);_0x4042bf[_0xceb4('0x2a')]=qs['offset'](_0x3c7ad2[_0xceb4('0x3d')][_0xceb4('0x2a')]);}_0x4042bf[_0xceb4('0x46')]=qs[_0xceb4('0x47')](_0x3c7ad2[_0xceb4('0x3d')]['sort']);_0x4042bf[_0xceb4('0x48')]=qs[_0xceb4('0x3f')](_[_0xceb4('0x49')](_0x3c7ad2[_0xceb4('0x3d')],_0x5c4d71[_0xceb4('0x3f')]),_0x2b2b0a);if(_0x3c7ad2[_0xceb4('0x3d')][_0xceb4('0x4a')]){_0x4042bf[_0xceb4('0x48')]=_[_0xceb4('0x4b')](_0x4042bf['where'],{'$or':_['map'](_0x2b2b0a,function(_0x26cb4e){if(_0x26cb4e[_0xceb4('0x39')]!==_0xceb4('0x4c')){var _0xc21712={};_0xc21712[_0x26cb4e[_0xceb4('0x34')]]={'$like':'%'+_0x3c7ad2[_0xceb4('0x3d')][_0xceb4('0x4a')]+'%'};return _0xc21712;}})});}_0x4042bf=_[_0xceb4('0x4b')]({},_0x4042bf,_0x3c7ad2['options']);var _0x165cca={'where':_0x4042bf['where']};return db['VtigerConfiguration'][_0xceb4('0x29')](_0x165cca)[_0xceb4('0x1c')](function(_0x215737){_0x2aad73[_0xceb4('0x29')]=_0x215737;if(_0x3c7ad2['query'][_0xceb4('0x4d')]){_0x4042bf[_0xceb4('0x4e')]=[{'all':!![]}];}return db[_0xceb4('0x4f')][_0xceb4('0x50')](_0x4042bf);})[_0xceb4('0x1c')](function(_0x3fd0ca){_0x2aad73[_0xceb4('0x51')]=_0x3fd0ca;return _0x2aad73;})[_0xceb4('0x1c')](respondWithFilteredResult(_0x522722,_0x4042bf))[_0xceb4('0x52')](handleError(_0x522722,null));};exports['show']=function(_0x4fa966,_0x10656f){var _0x1bca9d={'raw':![],'where':{'id':_0x4fa966[_0xceb4('0x53')]['id']}},_0x2ef855={};_0x2ef855['model']=_[_0xceb4('0x3e')](db[_0xceb4('0x4f')][_0xceb4('0x37')]);_0x2ef855[_0xceb4('0x3d')]=_[_0xceb4('0x3e')](_0x4fa966[_0xceb4('0x3d')]);_0x2ef855[_0xceb4('0x3f')]=_[_0xceb4('0x54')](_0x2ef855[_0xceb4('0x3b')],_0x2ef855[_0xceb4('0x3d')]);_0x1bca9d[_0xceb4('0x40')]=_[_0xceb4('0x54')](_0x2ef855['model'],qs[_0xceb4('0x41')](_0x4fa966[_0xceb4('0x3d')][_0xceb4('0x41')]));_0x1bca9d[_0xceb4('0x40')]=_0x1bca9d['attributes'][_0xceb4('0x42')]?_0x1bca9d[_0xceb4('0x40')]:_0x2ef855['model'];if(_0x4fa966['query'][_0xceb4('0x4d')]){_0x1bca9d[_0xceb4('0x4e')]=[{'all':!![]}];}_0x1bca9d=_[_0xceb4('0x4b')]({},_0x1bca9d,_0x4fa966['options']);return db[_0xceb4('0x4f')][_0xceb4('0x55')](_0x1bca9d)[_0xceb4('0x1c')](handleEntityNotFound(_0x10656f,null))[_0xceb4('0x1c')](respondWithResult(_0x10656f,null))[_0xceb4('0x52')](handleError(_0x10656f,null));};exports[_0xceb4('0x56')]=function(_0x30b73e,_0x2449ac){return db['VtigerConfiguration'][_0xceb4('0x56')](_0x30b73e[_0xceb4('0x57')],{})[_0xceb4('0x1c')](respondWithResult(_0x2449ac,0xc9))[_0xceb4('0x52')](handleError(_0x2449ac,null));};exports['update']=function(_0x51ebbc,_0x149b90){if(_0x51ebbc[_0xceb4('0x57')]['id']){delete _0x51ebbc['body']['id'];}return db[_0xceb4('0x4f')]['find']({'where':{'id':_0x51ebbc[_0xceb4('0x53')]['id']}})[_0xceb4('0x1c')](handleEntityNotFound(_0x149b90,null))[_0xceb4('0x1c')](saveUpdates(_0x51ebbc['body'],null))['then'](respondWithResult(_0x149b90,null))[_0xceb4('0x52')](handleError(_0x149b90,null));};exports[_0xceb4('0x31')]=function(_0x39c16b,_0x3afde9){return db[_0xceb4('0x4f')][_0xceb4('0x55')]({'where':{'id':_0x39c16b[_0xceb4('0x53')]['id']}})[_0xceb4('0x1c')](handleEntityNotFound(_0x3afde9,null))[_0xceb4('0x1c')](removeEntity(_0x3afde9,null))[_0xceb4('0x52')](handleError(_0x3afde9,null));};exports['getFields']=function(_0x1c0771,_0x13cd3f,_0x30db59){var _0x255cbe={};var _0x24bddc={};var _0x18cdcd;var _0x52616d;return db[_0xceb4('0x4f')]['findOne']({'where':{'id':_0x1c0771[_0xceb4('0x53')]['id']}})[_0xceb4('0x1c')](handleEntityNotFound(_0x13cd3f,null))[_0xceb4('0x1c')](function(_0x3323b0){if(_0x3323b0){_0x18cdcd=_0x3323b0;_0x24bddc[_0xceb4('0x3b')]=_['keys'](db[_0xceb4('0x58')][_0xceb4('0x37')]);_0x24bddc[_0xceb4('0x3d')]=_['keys'](_0x1c0771[_0xceb4('0x3d')]);_0x24bddc[_0xceb4('0x3f')]=_[_0xceb4('0x54')](_0x24bddc[_0xceb4('0x3b')],_0x24bddc[_0xceb4('0x3d')]);_0x255cbe[_0xceb4('0x40')]=_[_0xceb4('0x54')](_0x24bddc[_0xceb4('0x3b')],qs[_0xceb4('0x41')](_0x1c0771[_0xceb4('0x3d')][_0xceb4('0x41')]));_0x255cbe[_0xceb4('0x40')]=_0x255cbe[_0xceb4('0x40')][_0xceb4('0x42')]?_0x255cbe['attributes']:_0x24bddc['model'];_0x255cbe['order']=qs[_0xceb4('0x47')](_0x1c0771[_0xceb4('0x3d')][_0xceb4('0x47')]);_0x255cbe[_0xceb4('0x48')]=qs[_0xceb4('0x3f')](_[_0xceb4('0x49')](_0x1c0771['query'],_0x24bddc['filters']));if(_0x1c0771['query'][_0xceb4('0x4a')]){_0x255cbe['where']=_['merge'](_0x255cbe[_0xceb4('0x48')],{'$or':_[_0xceb4('0x3c')](_0x255cbe['attributes'],function(_0x55f386){var _0x34a753={};_0x34a753[_0x55f386]={'$like':'%'+_0x1c0771[_0xceb4('0x3d')][_0xceb4('0x4a')]+'%'};return _0x34a753;})});}_0x255cbe=_['merge']({},_0x255cbe,_0x1c0771[_0xceb4('0x59')]);return _0x18cdcd[_0xceb4('0x5a')](_0x255cbe);}})[_0xceb4('0x1c')](function(_0x1cc013){if(_0x1cc013){_0x52616d=_0x1cc013[_0xceb4('0x42')];if(!_0x1c0771['query'][_0xceb4('0x43')](_0xceb4('0x44'))){_0x255cbe[_0xceb4('0x45')]=qs[_0xceb4('0x45')](_0x1c0771[_0xceb4('0x3d')][_0xceb4('0x45')]);_0x255cbe[_0xceb4('0x2a')]=qs['offset'](_0x1c0771[_0xceb4('0x3d')]['offset']);}return _0x18cdcd[_0xceb4('0x5a')](_0x255cbe);}})['then'](function(_0x1124aa){if(_0x1124aa){return _0x1124aa?{'count':_0x52616d,'rows':_0x1124aa}:null;}})[_0xceb4('0x1c')](respondWithResult(_0x13cd3f,null))['catch'](handleError(_0x13cd3f,null));};exports[_0xceb4('0x5b')]=function(_0x16a481,_0x5d1302,_0x54b518){var _0x1e5ade={};var _0x5e4449={};var _0xa9d06;var _0x517ef3;return db[_0xceb4('0x4f')][_0xceb4('0x5c')]({'where':{'id':_0x16a481[_0xceb4('0x53')]['id']}})[_0xceb4('0x1c')](handleEntityNotFound(_0x5d1302,null))[_0xceb4('0x1c')](function(_0x1686f8){if(_0x1686f8){_0xa9d06=_0x1686f8;_0x5e4449[_0xceb4('0x3b')]=_[_0xceb4('0x3e')](db[_0xceb4('0x58')]['rawAttributes']);_0x5e4449[_0xceb4('0x3d')]=_[_0xceb4('0x3e')](_0x16a481[_0xceb4('0x3d')]);_0x5e4449['filters']=_[_0xceb4('0x54')](_0x5e4449[_0xceb4('0x3b')],_0x5e4449[_0xceb4('0x3d')]);_0x1e5ade[_0xceb4('0x40')]=_[_0xceb4('0x54')](_0x5e4449['model'],qs[_0xceb4('0x41')](_0x16a481['query'][_0xceb4('0x41')]));_0x1e5ade[_0xceb4('0x40')]=_0x1e5ade['attributes'][_0xceb4('0x42')]?_0x1e5ade['attributes']:_0x5e4449['model'];_0x1e5ade[_0xceb4('0x46')]=qs[_0xceb4('0x47')](_0x16a481[_0xceb4('0x3d')]['sort']);_0x1e5ade[_0xceb4('0x48')]=qs[_0xceb4('0x3f')](_[_0xceb4('0x49')](_0x16a481[_0xceb4('0x3d')],_0x5e4449[_0xceb4('0x3f')]));if(_0x16a481[_0xceb4('0x3d')]['filter']){_0x1e5ade[_0xceb4('0x48')]=_['merge'](_0x1e5ade[_0xceb4('0x48')],{'$or':_['map'](_0x1e5ade[_0xceb4('0x40')],function(_0x2df0b5){var _0x2acca5={};_0x2acca5[_0x2df0b5]={'$like':'%'+_0x16a481[_0xceb4('0x3d')][_0xceb4('0x4a')]+'%'};return _0x2acca5;})});}_0x1e5ade=_[_0xceb4('0x4b')]({},_0x1e5ade,_0x16a481[_0xceb4('0x59')]);return _0xa9d06[_0xceb4('0x5b')](_0x1e5ade);}})[_0xceb4('0x1c')](function(_0x5961ee){if(_0x5961ee){_0x517ef3=_0x5961ee[_0xceb4('0x42')];if(!_0x16a481[_0xceb4('0x3d')][_0xceb4('0x43')]('nolimit')){_0x1e5ade['limit']=qs[_0xceb4('0x45')](_0x16a481[_0xceb4('0x3d')][_0xceb4('0x45')]);_0x1e5ade[_0xceb4('0x2a')]=qs[_0xceb4('0x2a')](_0x16a481[_0xceb4('0x3d')]['offset']);}return _0xa9d06[_0xceb4('0x5b')](_0x1e5ade);}})['then'](function(_0x1c6bc0){if(_0x1c6bc0){return _0x1c6bc0?{'count':_0x517ef3,'rows':_0x1c6bc0}:null;}})[_0xceb4('0x1c')](respondWithResult(_0x5d1302,null))[_0xceb4('0x52')](handleError(_0x5d1302,null));};exports[_0xceb4('0x5d')]=function(_0x5b242b,_0x29eaf4,_0x2e7168){var _0x524f66={};var _0x4c80d9={};var _0x520a1b;var _0x4d0423;return db[_0xceb4('0x4f')][_0xceb4('0x5c')]({'where':{'id':_0x5b242b[_0xceb4('0x53')]['id']}})[_0xceb4('0x1c')](handleEntityNotFound(_0x29eaf4,null))[_0xceb4('0x1c')](function(_0x247d00){if(_0x247d00){_0x520a1b=_0x247d00;_0x4c80d9[_0xceb4('0x3b')]=_['keys'](db[_0xceb4('0x58')][_0xceb4('0x37')]);_0x4c80d9['query']=_[_0xceb4('0x3e')](_0x5b242b[_0xceb4('0x3d')]);_0x4c80d9[_0xceb4('0x3f')]=_[_0xceb4('0x54')](_0x4c80d9[_0xceb4('0x3b')],_0x4c80d9[_0xceb4('0x3d')]);_0x524f66[_0xceb4('0x40')]=_[_0xceb4('0x54')](_0x4c80d9['model'],qs[_0xceb4('0x41')](_0x5b242b['query'][_0xceb4('0x41')]));_0x524f66[_0xceb4('0x40')]=_0x524f66['attributes'][_0xceb4('0x42')]?_0x524f66[_0xceb4('0x40')]:_0x4c80d9[_0xceb4('0x3b')];_0x524f66[_0xceb4('0x46')]=qs[_0xceb4('0x47')](_0x5b242b[_0xceb4('0x3d')][_0xceb4('0x47')]);_0x524f66[_0xceb4('0x48')]=qs[_0xceb4('0x3f')](_['pick'](_0x5b242b['query'],_0x4c80d9[_0xceb4('0x3f')]));if(_0x5b242b[_0xceb4('0x3d')]['filter']){_0x524f66[_0xceb4('0x48')]=_[_0xceb4('0x4b')](_0x524f66[_0xceb4('0x48')],{'$or':_[_0xceb4('0x3c')](_0x524f66[_0xceb4('0x40')],function(_0x7caedd){var _0x3d1a89={};_0x3d1a89[_0x7caedd]={'$like':'%'+_0x5b242b['query'][_0xceb4('0x4a')]+'%'};return _0x3d1a89;})});}_0x524f66=_[_0xceb4('0x4b')]({},_0x524f66,_0x5b242b[_0xceb4('0x59')]);return _0x520a1b[_0xceb4('0x5d')](_0x524f66);}})[_0xceb4('0x1c')](function(_0x5ae335){if(_0x5ae335){_0x4d0423=_0x5ae335[_0xceb4('0x42')];if(!_0x5b242b[_0xceb4('0x3d')][_0xceb4('0x43')](_0xceb4('0x44'))){_0x524f66['limit']=qs[_0xceb4('0x45')](_0x5b242b['query'][_0xceb4('0x45')]);_0x524f66[_0xceb4('0x2a')]=qs[_0xceb4('0x2a')](_0x5b242b[_0xceb4('0x3d')][_0xceb4('0x2a')]);}return _0x520a1b[_0xceb4('0x5d')](_0x524f66);}})[_0xceb4('0x1c')](function(_0x5d6d2f){if(_0x5d6d2f){return _0x5d6d2f?{'count':_0x4d0423,'rows':_0x5d6d2f}:null;}})[_0xceb4('0x1c')](respondWithResult(_0x29eaf4,null))[_0xceb4('0x52')](handleError(_0x29eaf4,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 371220f..70b9407 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 _0xa1a9=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xa1a9,0x142));var _0x9a1a=function(_0xfcbd0a,_0x24cd30){_0xfcbd0a=_0xfcbd0a-0x0;var _0x3a06a5=_0xa1a9[_0xfcbd0a];return _0x3a06a5;};'use strict';var _=require(_0x9a1a('0x0'));var util=require(_0x9a1a('0x1'));var logger=require(_0x9a1a('0x2'))('api');var moment=require(_0x9a1a('0x3'));var BPromise=require(_0x9a1a('0x4'));var rp=require(_0x9a1a('0x5'));var fs=require('fs');var path=require(_0x9a1a('0x6'));var rimraf=require('rimraf');var config=require(_0x9a1a('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x9a1a('0x8')]=function(_0x562e11,_0x47bb08){return _0x562e11[_0x9a1a('0x9')](_0x9a1a('0xa'),attributes,{'tableName':_0x9a1a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f3b=['exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x2aec9,_0x1220aa){var _0x390c93=function(_0x5e9a30){while(--_0x5e9a30){_0x2aec9['push'](_0x2aec9['shift']());}};_0x390c93(++_0x1220aa);}(_0x6f3b,0xd6));var _0xb6f3=function(_0x50c7e5,_0x380f0f){_0x50c7e5=_0x50c7e5-0x0;var _0x108f56=_0x6f3b[_0x50c7e5];return _0x108f56;};'use strict';var _=require(_0xb6f3('0x0'));var util=require(_0xb6f3('0x1'));var logger=require(_0xb6f3('0x2'))(_0xb6f3('0x3'));var moment=require(_0xb6f3('0x4'));var BPromise=require(_0xb6f3('0x5'));var rp=require(_0xb6f3('0x6'));var fs=require('fs');var path=require(_0xb6f3('0x7'));var rimraf=require(_0xb6f3('0x8'));var config=require(_0xb6f3('0x9'));var attributes=require(_0xb6f3('0xa'));module[_0xb6f3('0xb')]=function(_0x2119af,_0xb4181e){return _0x2119af[_0xb6f3('0xc')](_0xb6f3('0xd'),attributes,{'tableName':_0xb6f3('0xe'),'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 ad60a53..515d360 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 _0xfb9b=['client','request','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xa59083,_0x246ac5){var _0x4e52f0=function(_0x8b13c3){while(--_0x8b13c3){_0xa59083['push'](_0xa59083['shift']());}};_0x4e52f0(++_0x246ac5);}(_0xfb9b,0x10d));var _0xbfb9=function(_0x562848,_0x41dff3){_0x562848=_0x562848-0x0;var _0x47391a=_0xfb9b[_0x562848];return _0x47391a;};'use strict';var _=require(_0xbfb9('0x0'));var util=require(_0xbfb9('0x1'));var moment=require(_0xbfb9('0x2'));var BPromise=require('bluebird');var rs=require(_0xbfb9('0x3'));var fs=require('fs');var Redis=require(_0xbfb9('0x4'));var db=require(_0xbfb9('0x5'))['db'];var utils=require(_0xbfb9('0x6'));var logger=require(_0xbfb9('0x7'))(_0xbfb9('0x8'));var config=require(_0xbfb9('0x9'));var jayson=require(_0xbfb9('0xa'));var client=jayson[_0xbfb9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x227b6a,_0x162c51,_0x460d6f){return new BPromise(function(_0x19e51c,_0x810b4c){return client[_0xbfb9('0xc')](_0x227b6a,_0x460d6f)['then'](function(_0x2eacf1){logger['info'](_0xbfb9('0xd'),_0x162c51,_0xbfb9('0xe'));logger['debug'](_0xbfb9('0xf'),_0x162c51,_0xbfb9('0xe'),JSON['stringify'](_0x2eacf1));if(_0x2eacf1[_0xbfb9('0x10')]){if(_0x2eacf1[_0xbfb9('0x10')]['code']===0x1f4){logger['error'](_0xbfb9('0xd'),_0x162c51,_0x2eacf1['error'][_0xbfb9('0x11')]);return _0x810b4c(_0x2eacf1['error'][_0xbfb9('0x11')]);}logger[_0xbfb9('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x162c51,_0x2eacf1[_0xbfb9('0x10')][_0xbfb9('0x11')]);return _0x19e51c(_0x2eacf1[_0xbfb9('0x10')][_0xbfb9('0x11')]);}else{logger[_0xbfb9('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x162c51,'request\x20sent');_0x19e51c(_0x2eacf1['result'][_0xbfb9('0x11')]);}})[_0xbfb9('0x13')](function(_0x3e545e){logger[_0xbfb9('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x162c51,_0x3e545e);_0x810b4c(_0x3e545e);});});} \ No newline at end of file +var _0x589d=['../../config/logger','rpc','jayson/promise','request','then','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','info','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x38ca87,_0x1a627a){var _0x5dd232=function(_0x5da357){while(--_0x5da357){_0x38ca87['push'](_0x38ca87['shift']());}};_0x5dd232(++_0x1a627a);}(_0x589d,0xcc));var _0xd589=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x589d[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xd589('0x0'));var util=require(_0xd589('0x1'));var moment=require('moment');var BPromise=require(_0xd589('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd589('0x3'));var db=require(_0xd589('0x4'))['db'];var utils=require(_0xd589('0x5'));var logger=require(_0xd589('0x6'))(_0xd589('0x7'));var config=require('../../config/environment');var jayson=require(_0xd589('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x180408,_0x364f29,_0x3c5faf){return new BPromise(function(_0x30d617,_0x3efc2c){return client[_0xd589('0x9')](_0x180408,_0x3c5faf)[_0xd589('0xa')](function(_0x5eb069){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x364f29,_0xd589('0xb'));logger[_0xd589('0xc')](_0xd589('0xd'),_0x364f29,_0xd589('0xb'),JSON[_0xd589('0xe')](_0x5eb069));if(_0x5eb069[_0xd589('0xf')]){if(_0x5eb069[_0xd589('0xf')][_0xd589('0x10')]===0x1f4){logger[_0xd589('0xf')](_0xd589('0x11'),_0x364f29,_0x5eb069['error'][_0xd589('0x12')]);return _0x3efc2c(_0x5eb069[_0xd589('0xf')][_0xd589('0x12')]);}logger[_0xd589('0xf')](_0xd589('0x11'),_0x364f29,_0x5eb069[_0xd589('0xf')][_0xd589('0x12')]);return _0x30d617(_0x5eb069['error']['message']);}else{logger[_0xd589('0x13')](_0xd589('0x11'),_0x364f29,_0xd589('0xb'));_0x30d617(_0x5eb069['result'][_0xd589('0x12')]);}})[_0xd589('0x14')](function(_0x3f3f63){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x364f29,_0x3f3f63);_0x3efc2c(_0x3f3f63);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 19725e9..17c822a 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 _0xc3bf=['post','create','put','delete','destroy','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','/:id','isAuthenticated','show'];(function(_0x308ecc,_0x462554){var _0x361bcb=function(_0x1f799b){while(--_0x1f799b){_0x308ecc['push'](_0x308ecc['shift']());}};_0x361bcb(++_0x462554);}(_0xc3bf,0x145));var _0xfc3b=function(_0x28386a,_0x523e52){_0x28386a=_0x28386a-0x0;var _0x1f3ff9=_0xc3bf[_0x28386a];return _0x1f3ff9;};'use strict';var multer=require(_0xfc3b('0x0'));var util=require('util');var path=require(_0xfc3b('0x1'));var timeout=require('connect-timeout');var express=require(_0xfc3b('0x2'));var router=express['Router']();var auth=require(_0xfc3b('0x3'));var interaction=require(_0xfc3b('0x4'));var config=require(_0xfc3b('0x5'));var controller=require(_0xfc3b('0x6'));router[_0xfc3b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfc3b('0x7')](_0xfc3b('0x8'),auth[_0xfc3b('0x9')](),controller[_0xfc3b('0xa')]);router[_0xfc3b('0xb')]('/',auth[_0xfc3b('0x9')](),controller[_0xfc3b('0xc')]);router[_0xfc3b('0xd')](_0xfc3b('0x8'),auth[_0xfc3b('0x9')](),controller['update']);router[_0xfc3b('0xe')](_0xfc3b('0x8'),auth['isAuthenticated'](),controller[_0xfc3b('0xf')]);module['exports']=router; \ No newline at end of file +var _0x19db=['../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x161b09,_0x3ac3d7){var _0x4653e7=function(_0x2364fe){while(--_0x2364fe){_0x161b09['push'](_0x161b09['shift']());}};_0x4653e7(++_0x3ac3d7);}(_0x19db,0xcb));var _0xb19d=function(_0x409c75,_0x50c9aa){_0x409c75=_0x409c75-0x0;var _0x38a7f3=_0x19db[_0x409c75];return _0x38a7f3;};'use strict';var multer=require('multer');var util=require(_0xb19d('0x0'));var path=require(_0xb19d('0x1'));var timeout=require(_0xb19d('0x2'));var express=require(_0xb19d('0x3'));var router=express[_0xb19d('0x4')]();var auth=require(_0xb19d('0x5'));var interaction=require(_0xb19d('0x6'));var config=require(_0xb19d('0x7'));var controller=require(_0xb19d('0x8'));router[_0xb19d('0x9')]('/',auth[_0xb19d('0xa')](),controller[_0xb19d('0xb')]);router[_0xb19d('0x9')](_0xb19d('0xc'),auth[_0xb19d('0xa')](),controller['show']);router['post']('/',auth[_0xb19d('0xa')](),controller[_0xb19d('0xd')]);router[_0xb19d('0xe')](_0xb19d('0xc'),auth[_0xb19d('0xa')](),controller[_0xb19d('0xf')]);router[_0xb19d('0x10')]('/:id',auth[_0xb19d('0xa')](),controller[_0xb19d('0x11')]);module[_0xb19d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 4c0ff24..cc48524 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 _0xd3d1=['sequelize','exports','variable','customVariable','keyValue','picklist','string','STRING','ENUM','BOOLEAN'];(function(_0x488b85,_0x10ec23){var _0x59d07d=function(_0x16838b){while(--_0x16838b){_0x488b85['push'](_0x488b85['shift']());}};_0x59d07d(++_0x10ec23);}(_0xd3d1,0x172));var _0x1d3d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd3d1[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x1d3d('0x0'));module[_0x1d3d('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x1d3d('0x2'),_0x1d3d('0x3'),_0x1d3d('0x4'),_0x1d3d('0x5')),'defaultValue':_0x1d3d('0x6')},'content':{'type':Sequelize[_0x1d3d('0x7')]},'key':{'type':Sequelize[_0x1d3d('0x7')]},'keyType':{'type':Sequelize[_0x1d3d('0x8')](_0x1d3d('0x6'),_0x1d3d('0x2'),_0x1d3d('0x3'))},'keyContent':{'type':Sequelize[_0x1d3d('0x7')]},'idField':{'type':Sequelize[_0x1d3d('0x7')]},'nameField':{'type':Sequelize[_0x1d3d('0x7')]},'customField':{'type':Sequelize[_0x1d3d('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1d3d('0x7')]}}; \ No newline at end of file +var _0x7341=['ENUM','variable','customVariable','picklist','string','STRING'];(function(_0x19a89b,_0x5c2c33){var _0x1cbf8d=function(_0x5c34e6){while(--_0x5c34e6){_0x19a89b['push'](_0x19a89b['shift']());}};_0x1cbf8d(++_0x5c2c33);}(_0x7341,0xe4));var _0x1734=function(_0x56a536,_0x4a9d79){_0x56a536=_0x56a536-0x0;var _0x57029b=_0x7341[_0x56a536];return _0x57029b;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x1734('0x0')]('string',_0x1734('0x1'),_0x1734('0x2'),'keyValue',_0x1734('0x3')),'defaultValue':_0x1734('0x4')},'content':{'type':Sequelize[_0x1734('0x5')]},'key':{'type':Sequelize[_0x1734('0x5')]},'keyType':{'type':Sequelize[_0x1734('0x0')](_0x1734('0x4'),_0x1734('0x1'),'customVariable')},'keyContent':{'type':Sequelize[_0x1734('0x5')]},'idField':{'type':Sequelize[_0x1734('0x5')]},'nameField':{'type':Sequelize[_0x1734('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1734('0x5')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 4d86260..0e47804 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 _0x444e=['stack','name','send','index','map','VtigerField','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','html-pdf','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','end','json','count','offset','limit','status','Content-Range','reject','save','update','then','destroy','sendStatus'];(function(_0x3c16b7,_0x8b65cf){var _0x4daed3=function(_0x51004f){while(--_0x51004f){_0x3c16b7['push'](_0x3c16b7['shift']());}};_0x4daed3(++_0x8b65cf);}(_0x444e,0xe8));var _0xe444=function(_0x3f557c,_0x3de1e1){_0x3f557c=_0x3f557c-0x0;var _0x16a71a=_0x444e[_0x3f557c];return _0x16a71a;};'use strict';var pdf=require(_0xe444('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe444('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe444('0x2'));var rp=require('request-promise');var moment=require(_0xe444('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe444('0x4'));var util=require(_0xe444('0x5'));var path=require(_0xe444('0x6'));var sox=require(_0xe444('0x7'));var csv=require(_0xe444('0x8'));var ejs=require(_0xe444('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe444('0xa'));var crypto=require('crypto');var jsforce=require(_0xe444('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe444('0x8'));var querystring=require(_0xe444('0xc'));var Papa=require(_0xe444('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe444('0xe'));var as=require(_0xe444('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe444('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xe444('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xe444('0x12'))['db'];function respondWithStatusCode(_0x2f9d12,_0x59792f){_0x59792f=_0x59792f||0xcc;return function(_0x28c3e4){if(_0x28c3e4){return _0x2f9d12['sendStatus'](_0x59792f);}return _0x2f9d12['status'](_0x59792f)[_0xe444('0x13')]();};}function respondWithResult(_0x3e3b9f,_0x5eb55c){_0x5eb55c=_0x5eb55c||0xc8;return function(_0x192c1a){if(_0x192c1a){return _0x3e3b9f['status'](_0x5eb55c)[_0xe444('0x14')](_0x192c1a);}};}function respondWithFilteredResult(_0x3acd97,_0x18f7cf){return function(_0x3af415){if(_0x3af415){var _0x363716=_0x3af415[_0xe444('0x15')],_0x2d44af=_0x18f7cf[_0xe444('0x16')],_0x16ab23=_0x18f7cf[_0xe444('0x16')]+_0x18f7cf[_0xe444('0x17')],_0x3e1b57;if(_0x16ab23>=_0x363716){_0x16ab23=_0x363716;_0x3e1b57=0xc8;}else{_0x3e1b57=0xce;}_0x3acd97[_0xe444('0x18')](_0x3e1b57);return _0x3acd97['set'](_0xe444('0x19'),_0x2d44af+'-'+_0x16ab23+'/'+_0x363716)[_0xe444('0x14')](_0x3af415);}return null;};}function patchUpdates(_0x12eb54){return function(_0x2f6a4a){try{jsonpatch['apply'](_0x2f6a4a,_0x12eb54,!![]);}catch(_0x306e05){return BPromise[_0xe444('0x1a')](_0x306e05);}return _0x2f6a4a[_0xe444('0x1b')]();};}function saveUpdates(_0xf213c0,_0x37c15e){return function(_0x582bad){if(_0x582bad){return _0x582bad[_0xe444('0x1c')](_0xf213c0)[_0xe444('0x1d')](function(_0x529336){return _0x529336;});}return null;};}function removeEntity(_0x2b52a6,_0x5ef1a4){return function(_0x13108c){if(_0x13108c){return _0x13108c[_0xe444('0x1e')]()[_0xe444('0x1d')](function(){_0x2b52a6[_0xe444('0x18')](0xcc)[_0xe444('0x13')]();});}};}function handleEntityNotFound(_0x481762,_0x527bf5){return function(_0x251efb){if(!_0x251efb){_0x481762[_0xe444('0x1f')](0x194);}return _0x251efb;};}function handleError(_0x1ac266,_0x1ff6d2){_0x1ff6d2=_0x1ff6d2||0x1f4;return function(_0x2a03a2){logger['error'](_0x2a03a2[_0xe444('0x20')]);if(_0x2a03a2[_0xe444('0x21')]){delete _0x2a03a2['name'];}_0x1ac266[_0xe444('0x18')](_0x1ff6d2)[_0xe444('0x22')](_0x2a03a2);};}exports[_0xe444('0x23')]=function(_0x26ca6f,_0x2619cf){var _0x23072c={},_0x16915c={},_0x5d29ba={'count':0x0,'rows':[]};var _0x3015c7=_[_0xe444('0x24')](db[_0xe444('0x25')][_0xe444('0x26')],function(_0x5bc063){return{'name':_0x5bc063['fieldName'],'type':_0x5bc063[_0xe444('0x27')][_0xe444('0x28')]};});_0x16915c[_0xe444('0x29')]=_[_0xe444('0x24')](_0x3015c7,'name');_0x16915c[_0xe444('0x2a')]=_[_0xe444('0x2b')](_0x26ca6f[_0xe444('0x2a')]);_0x16915c[_0xe444('0x2c')]=_['intersection'](_0x16915c['model'],_0x16915c['query']);_0x23072c[_0xe444('0x2d')]=_[_0xe444('0x2e')](_0x16915c[_0xe444('0x29')],qs[_0xe444('0x2f')](_0x26ca6f[_0xe444('0x2a')]['fields']));_0x23072c[_0xe444('0x2d')]=_0x23072c[_0xe444('0x2d')][_0xe444('0x30')]?_0x23072c['attributes']:_0x16915c[_0xe444('0x29')];if(!_0x26ca6f['query']['hasOwnProperty'](_0xe444('0x31'))){_0x23072c[_0xe444('0x17')]=qs['limit'](_0x26ca6f[_0xe444('0x2a')]['limit']);_0x23072c[_0xe444('0x16')]=qs['offset'](_0x26ca6f['query'][_0xe444('0x16')]);}_0x23072c['order']=qs[_0xe444('0x32')](_0x26ca6f[_0xe444('0x2a')][_0xe444('0x32')]);_0x23072c[_0xe444('0x33')]=qs['filters'](_[_0xe444('0x34')](_0x26ca6f[_0xe444('0x2a')],_0x16915c[_0xe444('0x2c')]),_0x3015c7);if(_0x26ca6f['query'][_0xe444('0x35')]){_0x23072c['where']=_[_0xe444('0x36')](_0x23072c[_0xe444('0x33')],{'$or':_[_0xe444('0x24')](_0x3015c7,function(_0x4dc4c9){if(_0x4dc4c9['type']!==_0xe444('0x37')){var _0x246da5={};_0x246da5[_0x4dc4c9[_0xe444('0x21')]]={'$like':'%'+_0x26ca6f[_0xe444('0x2a')][_0xe444('0x35')]+'%'};return _0x246da5;}})});}_0x23072c=_[_0xe444('0x36')]({},_0x23072c,_0x26ca6f[_0xe444('0x38')]);var _0x5c2ddf={'where':_0x23072c['where']};return db[_0xe444('0x25')]['count'](_0x5c2ddf)[_0xe444('0x1d')](function(_0x5cfdaa){_0x5d29ba[_0xe444('0x15')]=_0x5cfdaa;if(_0x26ca6f[_0xe444('0x2a')][_0xe444('0x39')]){_0x23072c[_0xe444('0x3a')]=[{'all':!![]}];}return db[_0xe444('0x25')][_0xe444('0x3b')](_0x23072c);})['then'](function(_0x1216c4){_0x5d29ba[_0xe444('0x3c')]=_0x1216c4;return _0x5d29ba;})[_0xe444('0x1d')](respondWithFilteredResult(_0x2619cf,_0x23072c))[_0xe444('0x3d')](handleError(_0x2619cf,null));};exports['show']=function(_0x442467,_0x19283c){var _0x2370cd={'raw':!![],'where':{'id':_0x442467[_0xe444('0x3e')]['id']}},_0x34d3e8={};_0x34d3e8[_0xe444('0x29')]=_[_0xe444('0x2b')](db[_0xe444('0x25')][_0xe444('0x26')]);_0x34d3e8['query']=_['keys'](_0x442467['query']);_0x34d3e8[_0xe444('0x2c')]=_[_0xe444('0x2e')](_0x34d3e8[_0xe444('0x29')],_0x34d3e8[_0xe444('0x2a')]);_0x2370cd[_0xe444('0x2d')]=_['intersection'](_0x34d3e8['model'],qs[_0xe444('0x2f')](_0x442467[_0xe444('0x2a')][_0xe444('0x2f')]));_0x2370cd['attributes']=_0x2370cd[_0xe444('0x2d')][_0xe444('0x30')]?_0x2370cd[_0xe444('0x2d')]:_0x34d3e8[_0xe444('0x29')];if(_0x442467[_0xe444('0x2a')][_0xe444('0x39')]){_0x2370cd['include']=[{'all':!![]}];}_0x2370cd=_['merge']({},_0x2370cd,_0x442467[_0xe444('0x38')]);return db[_0xe444('0x25')][_0xe444('0x3f')](_0x2370cd)[_0xe444('0x1d')](handleEntityNotFound(_0x19283c,null))['then'](respondWithResult(_0x19283c,null))[_0xe444('0x3d')](handleError(_0x19283c,null));};exports[_0xe444('0x40')]=function(_0x3549d0,_0x394665){return db[_0xe444('0x25')][_0xe444('0x40')](_0x3549d0[_0xe444('0x41')],{})[_0xe444('0x1d')](respondWithResult(_0x394665,0xc9))['catch'](handleError(_0x394665,null));};exports[_0xe444('0x1c')]=function(_0x1c584d,_0x5afcdb){if(_0x1c584d['body']['id']){delete _0x1c584d[_0xe444('0x41')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x1c584d['params']['id']}})[_0xe444('0x1d')](handleEntityNotFound(_0x5afcdb,null))[_0xe444('0x1d')](saveUpdates(_0x1c584d['body'],null))['then'](respondWithResult(_0x5afcdb,null))[_0xe444('0x3d')](handleError(_0x5afcdb,null));};exports[_0xe444('0x1e')]=function(_0x53bde2,_0xc82495){return db[_0xe444('0x25')][_0xe444('0x3f')]({'where':{'id':_0x53bde2['params']['id']}})[_0xe444('0x1d')](handleEntityNotFound(_0xc82495,null))['then'](removeEntity(_0xc82495,null))[_0xe444('0x3d')](handleError(_0xc82495,null));}; \ No newline at end of file +var _0x46ed=['merge','VIRTUAL','options','includeAll','catch','params','include','find','create','body','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','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/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','set','apply','reject','save','update','then','destroy','end','error','stack','name','send','VtigerField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','limit','sort','where','pick','filter'];(function(_0x1d9fa3,_0x3234ba){var _0x962597=function(_0x4726fd){while(--_0x4726fd){_0x1d9fa3['push'](_0x1d9fa3['shift']());}};_0x962597(++_0x3234ba);}(_0x46ed,0x168));var _0xd46e=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x46ed[_0x178e48];return _0x440d7e;};'use strict';var pdf=require(_0xd46e('0x0'));var emlformat=require(_0xd46e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd46e('0x2'));var jsonpatch=require(_0xd46e('0x3'));var rp=require(_0xd46e('0x4'));var moment=require('moment');var BPromise=require(_0xd46e('0x5'));var Mustache=require(_0xd46e('0x6'));var util=require('util');var path=require(_0xd46e('0x7'));var sox=require(_0xd46e('0x8'));var csv=require(_0xd46e('0x9'));var ejs=require(_0xd46e('0xa'));var fs=require('fs');var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x9'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];function respondWithStatusCode(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xcc;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0x1a')](_0x48550b);}return _0x5bc1da['status'](_0x48550b)['end']();};}function respondWithResult(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0xc8;return function(_0x1e9aae){if(_0x1e9aae){return _0xacd799[_0xd46e('0x1b')](_0x4688ae)['json'](_0x1e9aae);}};}function respondWithFilteredResult(_0x3b6d25,_0x44a620){return function(_0x417402){if(_0x417402){var _0x3d72ce=_0x417402[_0xd46e('0x1c')],_0x36a317=_0x44a620[_0xd46e('0x1d')],_0x47fa8f=_0x44a620['offset']+_0x44a620['limit'],_0x1d50a5;if(_0x47fa8f>=_0x3d72ce){_0x47fa8f=_0x3d72ce;_0x1d50a5=0xc8;}else{_0x1d50a5=0xce;}_0x3b6d25[_0xd46e('0x1b')](_0x1d50a5);return _0x3b6d25[_0xd46e('0x1e')]('Content-Range',_0x36a317+'-'+_0x47fa8f+'/'+_0x3d72ce)['json'](_0x417402);}return null;};}function patchUpdates(_0x2d6f2c){return function(_0x2f2571){try{jsonpatch[_0xd46e('0x1f')](_0x2f2571,_0x2d6f2c,!![]);}catch(_0x2273c5){return BPromise[_0xd46e('0x20')](_0x2273c5);}return _0x2f2571[_0xd46e('0x21')]();};}function saveUpdates(_0x3b5fa4,_0x327b7e){return function(_0xb4940){if(_0xb4940){return _0xb4940[_0xd46e('0x22')](_0x3b5fa4)[_0xd46e('0x23')](function(_0x5ba94d){return _0x5ba94d;});}return null;};}function removeEntity(_0x259072,_0x1c83fa){return function(_0x79aa51){if(_0x79aa51){return _0x79aa51[_0xd46e('0x24')]()[_0xd46e('0x23')](function(){_0x259072[_0xd46e('0x1b')](0xcc)[_0xd46e('0x25')]();});}};}function handleEntityNotFound(_0x8a1be,_0x62dea5){return function(_0x4cf899){if(!_0x4cf899){_0x8a1be[_0xd46e('0x1a')](0x194);}return _0x4cf899;};}function handleError(_0x5424e5,_0x4b8f6a){_0x4b8f6a=_0x4b8f6a||0x1f4;return function(_0x371054){logger[_0xd46e('0x26')](_0x371054[_0xd46e('0x27')]);if(_0x371054[_0xd46e('0x28')]){delete _0x371054[_0xd46e('0x28')];}_0x5424e5[_0xd46e('0x1b')](_0x4b8f6a)[_0xd46e('0x29')](_0x371054);};}exports['index']=function(_0x45d789,_0x3c301a){var _0xddbce9={},_0x17db79={},_0x96f15c={'count':0x0,'rows':[]};var _0x16e941=_['map'](db[_0xd46e('0x2a')][_0xd46e('0x2b')],function(_0x2d1afe){return{'name':_0x2d1afe[_0xd46e('0x2c')],'type':_0x2d1afe[_0xd46e('0x2d')][_0xd46e('0x2e')]};});_0x17db79[_0xd46e('0x2f')]=_[_0xd46e('0x30')](_0x16e941,_0xd46e('0x28'));_0x17db79[_0xd46e('0x31')]=_[_0xd46e('0x32')](_0x45d789[_0xd46e('0x31')]);_0x17db79[_0xd46e('0x33')]=_['intersection'](_0x17db79[_0xd46e('0x2f')],_0x17db79[_0xd46e('0x31')]);_0xddbce9[_0xd46e('0x34')]=_[_0xd46e('0x35')](_0x17db79['model'],qs[_0xd46e('0x36')](_0x45d789[_0xd46e('0x31')]['fields']));_0xddbce9[_0xd46e('0x34')]=_0xddbce9[_0xd46e('0x34')]['length']?_0xddbce9[_0xd46e('0x34')]:_0x17db79[_0xd46e('0x2f')];if(!_0x45d789[_0xd46e('0x31')]['hasOwnProperty']('nolimit')){_0xddbce9[_0xd46e('0x37')]=qs[_0xd46e('0x37')](_0x45d789[_0xd46e('0x31')][_0xd46e('0x37')]);_0xddbce9[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x45d789[_0xd46e('0x31')][_0xd46e('0x1d')]);}_0xddbce9['order']=qs[_0xd46e('0x38')](_0x45d789[_0xd46e('0x31')][_0xd46e('0x38')]);_0xddbce9[_0xd46e('0x39')]=qs[_0xd46e('0x33')](_[_0xd46e('0x3a')](_0x45d789[_0xd46e('0x31')],_0x17db79['filters']),_0x16e941);if(_0x45d789[_0xd46e('0x31')][_0xd46e('0x3b')]){_0xddbce9['where']=_[_0xd46e('0x3c')](_0xddbce9[_0xd46e('0x39')],{'$or':_[_0xd46e('0x30')](_0x16e941,function(_0x3b6e67){if(_0x3b6e67['type']!==_0xd46e('0x3d')){var _0x3ecf34={};_0x3ecf34[_0x3b6e67[_0xd46e('0x28')]]={'$like':'%'+_0x45d789[_0xd46e('0x31')][_0xd46e('0x3b')]+'%'};return _0x3ecf34;}})});}_0xddbce9=_[_0xd46e('0x3c')]({},_0xddbce9,_0x45d789[_0xd46e('0x3e')]);var _0x411318={'where':_0xddbce9['where']};return db[_0xd46e('0x2a')][_0xd46e('0x1c')](_0x411318)[_0xd46e('0x23')](function(_0x25657a){_0x96f15c[_0xd46e('0x1c')]=_0x25657a;if(_0x45d789['query'][_0xd46e('0x3f')]){_0xddbce9['include']=[{'all':!![]}];}return db['VtigerField']['findAll'](_0xddbce9);})['then'](function(_0x17c3d9){_0x96f15c['rows']=_0x17c3d9;return _0x96f15c;})[_0xd46e('0x23')](respondWithFilteredResult(_0x3c301a,_0xddbce9))[_0xd46e('0x40')](handleError(_0x3c301a,null));};exports['show']=function(_0x462477,_0x4114e6){var _0x3bd5e9={'raw':!![],'where':{'id':_0x462477[_0xd46e('0x41')]['id']}},_0x31ba12={};_0x31ba12[_0xd46e('0x2f')]=_[_0xd46e('0x32')](db[_0xd46e('0x2a')][_0xd46e('0x2b')]);_0x31ba12[_0xd46e('0x31')]=_[_0xd46e('0x32')](_0x462477['query']);_0x31ba12['filters']=_['intersection'](_0x31ba12[_0xd46e('0x2f')],_0x31ba12['query']);_0x3bd5e9[_0xd46e('0x34')]=_[_0xd46e('0x35')](_0x31ba12[_0xd46e('0x2f')],qs[_0xd46e('0x36')](_0x462477[_0xd46e('0x31')][_0xd46e('0x36')]));_0x3bd5e9[_0xd46e('0x34')]=_0x3bd5e9[_0xd46e('0x34')]['length']?_0x3bd5e9[_0xd46e('0x34')]:_0x31ba12['model'];if(_0x462477[_0xd46e('0x31')][_0xd46e('0x3f')]){_0x3bd5e9[_0xd46e('0x42')]=[{'all':!![]}];}_0x3bd5e9=_[_0xd46e('0x3c')]({},_0x3bd5e9,_0x462477[_0xd46e('0x3e')]);return db['VtigerField'][_0xd46e('0x43')](_0x3bd5e9)[_0xd46e('0x23')](handleEntityNotFound(_0x4114e6,null))[_0xd46e('0x23')](respondWithResult(_0x4114e6,null))[_0xd46e('0x40')](handleError(_0x4114e6,null));};exports[_0xd46e('0x44')]=function(_0x587784,_0x11fdda){return db[_0xd46e('0x2a')][_0xd46e('0x44')](_0x587784[_0xd46e('0x45')],{})[_0xd46e('0x23')](respondWithResult(_0x11fdda,0xc9))['catch'](handleError(_0x11fdda,null));};exports[_0xd46e('0x22')]=function(_0x3ea9e6,_0x45baf1){if(_0x3ea9e6[_0xd46e('0x45')]['id']){delete _0x3ea9e6[_0xd46e('0x45')]['id'];}return db[_0xd46e('0x2a')][_0xd46e('0x43')]({'where':{'id':_0x3ea9e6[_0xd46e('0x41')]['id']}})['then'](handleEntityNotFound(_0x45baf1,null))[_0xd46e('0x23')](saveUpdates(_0x3ea9e6[_0xd46e('0x45')],null))[_0xd46e('0x23')](respondWithResult(_0x45baf1,null))[_0xd46e('0x40')](handleError(_0x45baf1,null));};exports[_0xd46e('0x24')]=function(_0x4e84c8,_0x4ae314){return db[_0xd46e('0x2a')][_0xd46e('0x43')]({'where':{'id':_0x4e84c8[_0xd46e('0x41')]['id']}})['then'](handleEntityNotFound(_0x4ae314,null))['then'](removeEntity(_0x4ae314,null))[_0xd46e('0x40')](handleError(_0x4ae314,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 07ef6da..a839da8 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 _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 41d4ce1..f518fc5 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 _0xa321=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','http','request','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x1634b2,_0x24e67c){var _0x32a57b=function(_0x5470d2){while(--_0x5470d2){_0x1634b2['push'](_0x1634b2['shift']());}};_0x32a57b(++_0x24e67c);}(_0xa321,0x9d));var _0x1a32=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0xa321[_0xbb9dbf];return _0x30223c;};'use strict';var _=require(_0x1a32('0x0'));var util=require(_0x1a32('0x1'));var moment=require(_0x1a32('0x2'));var BPromise=require(_0x1a32('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a32('0x4'));var db=require(_0x1a32('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a32('0x6'))(_0x1a32('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1a32('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4859d6,_0x13b4d2,_0x1fa204){return new BPromise(function(_0xdfa9fe,_0x3f4723){return client[_0x1a32('0x9')](_0x4859d6,_0x1fa204)['then'](function(_0x343faf){logger[_0x1a32('0xa')]('VtigerField,\x20%s,\x20%s',_0x13b4d2,_0x1a32('0xb'));logger[_0x1a32('0xc')](_0x1a32('0xd'),_0x13b4d2,_0x1a32('0xb'),JSON[_0x1a32('0xe')](_0x343faf));if(_0x343faf[_0x1a32('0xf')]){if(_0x343faf['error'][_0x1a32('0x10')]===0x1f4){logger[_0x1a32('0xf')](_0x1a32('0x11'),_0x13b4d2,_0x343faf['error'][_0x1a32('0x12')]);return _0x3f4723(_0x343faf[_0x1a32('0xf')][_0x1a32('0x12')]);}logger[_0x1a32('0xf')](_0x1a32('0x11'),_0x13b4d2,_0x343faf['error'][_0x1a32('0x12')]);return _0xdfa9fe(_0x343faf[_0x1a32('0xf')][_0x1a32('0x12')]);}else{logger[_0x1a32('0xa')](_0x1a32('0x11'),_0x13b4d2,_0x1a32('0xb'));_0xdfa9fe(_0x343faf['result'][_0x1a32('0x12')]);}})[_0x1a32('0x13')](function(_0x47bb8e){logger[_0x1a32('0xf')](_0x1a32('0x11'),_0x13b4d2,_0x47bb8e);_0x3f4723(_0x47bb8e);});});} \ No newline at end of file +var _0x6e1c=['rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerField,\x20%s,\x20%s','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5353fc,_0x258bd6){var _0x1f7867=function(_0x62cd40){while(--_0x62cd40){_0x5353fc['push'](_0x5353fc['shift']());}};_0x1f7867(++_0x258bd6);}(_0x6e1c,0xb6));var _0xc6e1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6e1c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc6e1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc6e1('0x1'));var rs=require(_0xc6e1('0x2'));var fs=require('fs');var Redis=require(_0xc6e1('0x3'));var db=require(_0xc6e1('0x4'))['db'];var utils=require(_0xc6e1('0x5'));var logger=require(_0xc6e1('0x6'))(_0xc6e1('0x7'));var config=require(_0xc6e1('0x8'));var jayson=require(_0xc6e1('0x9'));var client=jayson[_0xc6e1('0xa')][_0xc6e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5247f1,_0x3ff10c,_0x1242d5){return new BPromise(function(_0x39000a,_0x2ffee0){return client[_0xc6e1('0xc')](_0x5247f1,_0x1242d5)['then'](function(_0xa29af9){logger[_0xc6e1('0xd')](_0xc6e1('0xe'),_0x3ff10c,'request\x20sent');logger['debug'](_0xc6e1('0xf'),_0x3ff10c,_0xc6e1('0x10'),JSON['stringify'](_0xa29af9));if(_0xa29af9[_0xc6e1('0x11')]){if(_0xa29af9[_0xc6e1('0x11')][_0xc6e1('0x12')]===0x1f4){logger[_0xc6e1('0x11')](_0xc6e1('0xe'),_0x3ff10c,_0xa29af9[_0xc6e1('0x11')]['message']);return _0x2ffee0(_0xa29af9[_0xc6e1('0x11')][_0xc6e1('0x13')]);}logger[_0xc6e1('0x11')](_0xc6e1('0xe'),_0x3ff10c,_0xa29af9[_0xc6e1('0x11')]['message']);return _0x39000a(_0xa29af9['error'][_0xc6e1('0x13')]);}else{logger[_0xc6e1('0xd')]('VtigerField,\x20%s,\x20%s',_0x3ff10c,_0xc6e1('0x10'));_0x39000a(_0xa29af9[_0xc6e1('0x14')][_0xc6e1('0x13')]);}})['catch'](function(_0x44ef6c){logger[_0xc6e1('0x11')](_0xc6e1('0xe'),_0x3ff10c,_0x44ef6c);_0x2ffee0(_0x44ef6c);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 069f6dc..cd9b454 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 _0xda1c=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x57714d,_0x4f5c05){var _0xaf2381=function(_0x8db42){while(--_0x8db42){_0x57714d['push'](_0x57714d['shift']());}};_0xaf2381(++_0x4f5c05);}(_0xda1c,0x68));var _0xcda1=function(_0x545473,_0x4c5bf9){_0x545473=_0x545473-0x0;var _0x56c683=_0xda1c[_0x545473];return _0x56c683;};'use strict';var multer=require(_0xcda1('0x0'));var util=require(_0xcda1('0x1'));var path=require(_0xcda1('0x2'));var timeout=require(_0xcda1('0x3'));var express=require(_0xcda1('0x4'));var router=express[_0xcda1('0x5')]();var auth=require(_0xcda1('0x6'));var interaction=require(_0xcda1('0x7'));var config=require(_0xcda1('0x8'));var controller=require(_0xcda1('0x9'));router[_0xcda1('0xa')]('/',auth['isAuthenticated'](),controller[_0xcda1('0xb')]);router[_0xcda1('0xa')](_0xcda1('0xc'),auth[_0xcda1('0xd')](),controller[_0xcda1('0xe')]);router[_0xcda1('0xa')]('/:id/configurations',auth[_0xcda1('0xd')](),controller[_0xcda1('0xf')]);router[_0xcda1('0xa')](_0xcda1('0x10'),auth[_0xcda1('0xd')](),controller[_0xcda1('0x11')]);router[_0xcda1('0x12')]('/',auth[_0xcda1('0xd')](),controller[_0xcda1('0x13')]);router[_0xcda1('0x12')]('/:id/configurations',auth[_0xcda1('0xd')](),controller[_0xcda1('0x14')]);router[_0xcda1('0x15')](_0xcda1('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xcda1('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xcda1('0x17')]);module[_0xcda1('0x18')]=router; \ No newline at end of file +var _0x4cbc=['/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','update','delete','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','get'];(function(_0x30b51c,_0x3877cd){var _0x4fddb3=function(_0x4c50c3){while(--_0x4c50c3){_0x30b51c['push'](_0x30b51c['shift']());}};_0x4fddb3(++_0x3877cd);}(_0x4cbc,0x127));var _0xc4cb=function(_0xd75b98,_0x15ad99){_0xd75b98=_0xd75b98-0x0;var _0xdd720e=_0x4cbc[_0xd75b98];return _0xdd720e;};'use strict';var multer=require('multer');var util=require(_0xc4cb('0x0'));var path=require('path');var timeout=require(_0xc4cb('0x1'));var express=require(_0xc4cb('0x2'));var router=express[_0xc4cb('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xc4cb('0x4'));var config=require(_0xc4cb('0x5'));var controller=require(_0xc4cb('0x6'));router['get']('/',auth[_0xc4cb('0x7')](),controller['index']);router[_0xc4cb('0x8')](_0xc4cb('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xc4cb('0x8')](_0xc4cb('0xa'),auth[_0xc4cb('0x7')](),controller[_0xc4cb('0xb')]);router[_0xc4cb('0x8')](_0xc4cb('0xc'),auth[_0xc4cb('0x7')](),controller['getFields']);router[_0xc4cb('0xd')]('/',auth['isAuthenticated'](),controller[_0xc4cb('0xe')]);router[_0xc4cb('0xd')](_0xc4cb('0xa'),auth[_0xc4cb('0x7')](),controller[_0xc4cb('0xf')]);router['put']('/:id',auth[_0xc4cb('0x7')](),controller[_0xc4cb('0x10')]);router[_0xc4cb('0x11')](_0xc4cb('0x9'),auth[_0xc4cb('0x7')](),controller['destroy']);module[_0xc4cb('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 0e6c452..37706bf 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 _0x78f1=['STRING','username','remoteUri','ENUM','password','newTab','integrationTab','sequelize','exports'];(function(_0x80f51a,_0x32e95e){var _0x327148=function(_0x16f788){while(--_0x16f788){_0x80f51a['push'](_0x80f51a['shift']());}};_0x327148(++_0x32e95e);}(_0x78f1,0x6a));var _0x178f=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x78f1[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0x178f('0x0'));module[_0x178f('0x1')]={'name':{'type':Sequelize[_0x178f('0x2')]},'description':{'type':Sequelize[_0x178f('0x2')]},'username':{'type':Sequelize[_0x178f('0x2')],'unique':_0x178f('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x178f('0x4')},'authType':{'type':Sequelize[_0x178f('0x5')](_0x178f('0x6'),'token'),'defaultValue':_0x178f('0x6')},'serverUrl':{'type':Sequelize[_0x178f('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x178f('0x7')),'defaultValue':_0x178f('0x8')}}; \ No newline at end of file +var _0xf699=['token','integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM','password'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf699,0x1b1));var _0x9f69=function(_0x4f3c7f,_0xfe5498){_0x4f3c7f=_0x4f3c7f-0x0;var _0x142671=_0xf699[_0x4f3c7f];return _0x142671;};'use strict';var Sequelize=require(_0x9f69('0x0'));module[_0x9f69('0x1')]={'name':{'type':Sequelize[_0x9f69('0x2')]},'description':{'type':Sequelize[_0x9f69('0x2')]},'username':{'type':Sequelize[_0x9f69('0x2')],'unique':_0x9f69('0x3')},'password':{'type':Sequelize[_0x9f69('0x2')]},'token':{'type':Sequelize[_0x9f69('0x2')]},'remoteUri':{'type':Sequelize[_0x9f69('0x2')],'unique':_0x9f69('0x4')},'authType':{'type':Sequelize[_0x9f69('0x5')](_0x9f69('0x6'),_0x9f69('0x7')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x9f69('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9f69('0x5')](_0x9f69('0x8'),_0x9f69('0x9')),'defaultValue':_0x9f69('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 9d4d2cb..a54bc9e 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 _0xa20a=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','count','offset','set','Content-Range','json','reject','update','destroy','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','limit','order','sort','where','pick','type','ZendeskAccount','includeAll','include','show','params','fields','merge','options','find','create','body','getConfigurations','ZendeskConfiguration','rawAttributes','filter','nolimit','addConfiguration','findOne','AccountId','getSubjects','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','username','password','token','authType','remoteUri','slice','substring','GET','format','%s/%s','ticket_fields','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','Sequelize','ValidationError','assignee','remove','includes','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel'];(function(_0x1035a3,_0x5f38ef){var _0x19c9f7=function(_0x13b063){while(--_0x13b063){_0x1035a3['push'](_0x1035a3['shift']());}};_0x19c9f7(++_0x5f38ef);}(_0xa20a,0x74));var _0xaa20=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xa20a[_0x5ddaac];return _0x2a9c58;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xaa20('0x0'));var zipdir=require(_0xaa20('0x1'));var jsonpatch=require(_0xaa20('0x2'));var rp=require(_0xaa20('0x3'));var moment=require('moment');var BPromise=require(_0xaa20('0x4'));var Mustache=require(_0xaa20('0x5'));var util=require(_0xaa20('0x6'));var path=require(_0xaa20('0x7'));var sox=require(_0xaa20('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xaa20('0x9'));var squel=require(_0xaa20('0xa'));var crypto=require(_0xaa20('0xb'));var jsforce=require(_0xaa20('0xc'));var deskjs=require(_0xaa20('0xd'));var toCsv=require(_0xaa20('0xe'));var querystring=require(_0xaa20('0xf'));var Papa=require(_0xaa20('0x10'));var Redis=require(_0xaa20('0x11'));var authService=require(_0xaa20('0x12'));var qs=require(_0xaa20('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa20('0x14'));var logger=require(_0xaa20('0x15'))('api');var utils=require(_0xaa20('0x16'));var config=require(_0xaa20('0x17'));var licenseUtil=require(_0xaa20('0x18'));var db=require(_0xaa20('0x19'))['db'];var integrations=require(_0xaa20('0x1a'));var jayson=require(_0xaa20('0x1b'));var client=jayson['client'][_0xaa20('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x163677,_0x476bb3,_0x364459,_0x179b55){return new BPromise(function(_0xd88a1c,_0x338ce0){var _0x133d1a=_0x179b55||client;return _0x133d1a[_0xaa20('0x1d')](_0x163677,_0x364459)[_0xaa20('0x1e')](function(_0x1e0cc8){logger[_0xaa20('0x1f')](_0xaa20('0x20'),_0x476bb3,_0xaa20('0x21'));logger[_0xaa20('0x22')](_0xaa20('0x23'),_0x476bb3,_0xaa20('0x21'),JSON['stringify'](_0x1e0cc8));if(_0x1e0cc8[_0xaa20('0x24')]){if(_0x1e0cc8['error'][_0xaa20('0x25')]===0x1f4){logger[_0xaa20('0x24')]('ZendeskAccount,\x20%s,\x20%s',_0x476bb3,_0x1e0cc8[_0xaa20('0x24')][_0xaa20('0x26')]);return _0x338ce0(_0x1e0cc8[_0xaa20('0x24')][_0xaa20('0x26')]);}logger[_0xaa20('0x24')]('ZendeskAccount,\x20%s,\x20%s',_0x476bb3,_0x1e0cc8['error']['message']);return _0xd88a1c(_0x1e0cc8['error']['message']);}else{logger[_0xaa20('0x1f')](_0xaa20('0x20'),_0x476bb3,_0xaa20('0x21'));_0xd88a1c(_0x1e0cc8[_0xaa20('0x27')][_0xaa20('0x26')]);}})[_0xaa20('0x28')](function(_0x63ccef){logger[_0xaa20('0x24')](_0xaa20('0x20'),_0x476bb3,_0x63ccef);_0x338ce0(_0x63ccef);});});}function respondWithStatusCode(_0x48aa88,_0x5a2905){_0x5a2905=_0x5a2905||0xcc;return function(_0xc4ba0b){if(_0xc4ba0b){return _0x48aa88[_0xaa20('0x29')](_0x5a2905);}return _0x48aa88['status'](_0x5a2905)[_0xaa20('0x2a')]();};}function respondWithResult(_0x1388dc,_0x5a722b){_0x5a722b=_0x5a722b||0xc8;return function(_0x193fb2){if(_0x193fb2){return _0x1388dc[_0xaa20('0x2b')](_0x5a722b)['json'](_0x193fb2);}};}function respondWithFilteredResult(_0x428c18,_0x5705dd){return function(_0x3fa53a){if(_0x3fa53a){var _0x7ffdf1=_0x3fa53a[_0xaa20('0x2c')],_0x213d4e=_0x5705dd['offset'],_0x3c166d=_0x5705dd[_0xaa20('0x2d')]+_0x5705dd['limit'],_0x24fc6f;if(_0x3c166d>=_0x7ffdf1){_0x3c166d=_0x7ffdf1;_0x24fc6f=0xc8;}else{_0x24fc6f=0xce;}_0x428c18['status'](_0x24fc6f);return _0x428c18[_0xaa20('0x2e')](_0xaa20('0x2f'),_0x213d4e+'-'+_0x3c166d+'/'+_0x7ffdf1)[_0xaa20('0x30')](_0x3fa53a);}return null;};}function patchUpdates(_0x45e2fa){return function(_0x49e704){try{jsonpatch['apply'](_0x49e704,_0x45e2fa,!![]);}catch(_0xe0a579){return BPromise[_0xaa20('0x31')](_0xe0a579);}return _0x49e704['save']();};}function saveUpdates(_0x40b5d9,_0x25b7b4){return function(_0x12974d){if(_0x12974d){return _0x12974d[_0xaa20('0x32')](_0x40b5d9)[_0xaa20('0x1e')](function(_0x1596b7){return _0x1596b7;});}return null;};}function removeEntity(_0x257932,_0x3da1f5){return function(_0x3e8539){if(_0x3e8539){return _0x3e8539[_0xaa20('0x33')]()['then'](function(){_0x257932[_0xaa20('0x2b')](0xcc)[_0xaa20('0x2a')]();});}};}function handleEntityNotFound(_0xe00f47,_0x36738e){return function(_0x57036c){if(!_0x57036c){_0xe00f47['sendStatus'](0x194);}return _0x57036c;};}function handleError(_0x3eb301,_0x190a4c){_0x190a4c=_0x190a4c||0x1f4;return function(_0x415cff){logger['error'](_0x415cff[_0xaa20('0x34')]);if(_0x415cff[_0xaa20('0x35')]){delete _0x415cff[_0xaa20('0x35')];}_0x3eb301['status'](_0x190a4c)[_0xaa20('0x36')](_0x415cff);};}exports[_0xaa20('0x37')]=function(_0x1730f3,_0x46f5e7){var _0x6f773c={},_0x101e6a={},_0x230937={'count':0x0,'rows':[]};var _0x5a41ca=_[_0xaa20('0x38')](db['ZendeskAccount']['rawAttributes'],function(_0x355fe5){return{'name':_0x355fe5[_0xaa20('0x39')],'type':_0x355fe5['type'][_0xaa20('0x3a')]};});_0x101e6a[_0xaa20('0x3b')]=_[_0xaa20('0x38')](_0x5a41ca,_0xaa20('0x35'));_0x101e6a[_0xaa20('0x3c')]=_[_0xaa20('0x3d')](_0x1730f3[_0xaa20('0x3c')]);_0x101e6a[_0xaa20('0x3e')]=_[_0xaa20('0x3f')](_0x101e6a[_0xaa20('0x3b')],_0x101e6a[_0xaa20('0x3c')]);_0x6f773c[_0xaa20('0x40')]=_[_0xaa20('0x3f')](_0x101e6a[_0xaa20('0x3b')],qs['fields'](_0x1730f3[_0xaa20('0x3c')]['fields']));_0x6f773c['attributes']=_0x6f773c['attributes'][_0xaa20('0x41')]?_0x6f773c['attributes']:_0x101e6a[_0xaa20('0x3b')];if(!_0x1730f3['query'][_0xaa20('0x42')]('nolimit')){_0x6f773c[_0xaa20('0x43')]=qs[_0xaa20('0x43')](_0x1730f3[_0xaa20('0x3c')]['limit']);_0x6f773c[_0xaa20('0x2d')]=qs[_0xaa20('0x2d')](_0x1730f3[_0xaa20('0x3c')][_0xaa20('0x2d')]);}_0x6f773c[_0xaa20('0x44')]=qs[_0xaa20('0x45')](_0x1730f3[_0xaa20('0x3c')][_0xaa20('0x45')]);_0x6f773c[_0xaa20('0x46')]=qs['filters'](_[_0xaa20('0x47')](_0x1730f3[_0xaa20('0x3c')],_0x101e6a[_0xaa20('0x3e')]),_0x5a41ca);if(_0x1730f3[_0xaa20('0x3c')]['filter']){_0x6f773c['where']=_['merge'](_0x6f773c['where'],{'$or':_['map'](_0x5a41ca,function(_0xb300b5){if(_0xb300b5[_0xaa20('0x48')]!=='VIRTUAL'){var _0x29f359={};_0x29f359[_0xb300b5[_0xaa20('0x35')]]={'$like':'%'+_0x1730f3[_0xaa20('0x3c')]['filter']+'%'};return _0x29f359;}})});}_0x6f773c=_['merge']({},_0x6f773c,_0x1730f3['options']);var _0x33dd49={'where':_0x6f773c['where']};return db[_0xaa20('0x49')]['count'](_0x33dd49)[_0xaa20('0x1e')](function(_0x1d74f8){_0x230937[_0xaa20('0x2c')]=_0x1d74f8;if(_0x1730f3[_0xaa20('0x3c')][_0xaa20('0x4a')]){_0x6f773c[_0xaa20('0x4b')]=[{'all':!![]}];}return db[_0xaa20('0x49')]['findAll'](_0x6f773c);})[_0xaa20('0x1e')](function(_0x573dcb){_0x230937['rows']=_0x573dcb;return _0x230937;})[_0xaa20('0x1e')](respondWithFilteredResult(_0x46f5e7,_0x6f773c))[_0xaa20('0x28')](handleError(_0x46f5e7,null));};exports[_0xaa20('0x4c')]=function(_0x73c7b6,_0x1e24d4){var _0x367b90={'raw':![],'where':{'id':_0x73c7b6[_0xaa20('0x4d')]['id']}},_0x3edbd7={};_0x3edbd7[_0xaa20('0x3b')]=_['keys'](db[_0xaa20('0x49')]['rawAttributes']);_0x3edbd7[_0xaa20('0x3c')]=_['keys'](_0x73c7b6[_0xaa20('0x3c')]);_0x3edbd7[_0xaa20('0x3e')]=_['intersection'](_0x3edbd7[_0xaa20('0x3b')],_0x3edbd7[_0xaa20('0x3c')]);_0x367b90[_0xaa20('0x40')]=_[_0xaa20('0x3f')](_0x3edbd7[_0xaa20('0x3b')],qs['fields'](_0x73c7b6[_0xaa20('0x3c')][_0xaa20('0x4e')]));_0x367b90[_0xaa20('0x40')]=_0x367b90[_0xaa20('0x40')][_0xaa20('0x41')]?_0x367b90[_0xaa20('0x40')]:_0x3edbd7[_0xaa20('0x3b')];if(_0x73c7b6[_0xaa20('0x3c')][_0xaa20('0x4a')]){_0x367b90['include']=[{'all':!![]}];}_0x367b90=_[_0xaa20('0x4f')]({},_0x367b90,_0x73c7b6[_0xaa20('0x50')]);return db['ZendeskAccount'][_0xaa20('0x51')](_0x367b90)['then'](handleEntityNotFound(_0x1e24d4,null))[_0xaa20('0x1e')](respondWithResult(_0x1e24d4,null))[_0xaa20('0x28')](handleError(_0x1e24d4,null));};exports[_0xaa20('0x52')]=function(_0x14e705,_0x46890c){return db[_0xaa20('0x49')][_0xaa20('0x52')](_0x14e705[_0xaa20('0x53')],{})[_0xaa20('0x1e')](respondWithResult(_0x46890c,0xc9))['catch'](handleError(_0x46890c,null));};exports[_0xaa20('0x32')]=function(_0x3eed96,_0x5e6bfa){if(_0x3eed96[_0xaa20('0x53')]['id']){delete _0x3eed96[_0xaa20('0x53')]['id'];}return db['ZendeskAccount'][_0xaa20('0x51')]({'where':{'id':_0x3eed96['params']['id']}})[_0xaa20('0x1e')](handleEntityNotFound(_0x5e6bfa,null))[_0xaa20('0x1e')](saveUpdates(_0x3eed96[_0xaa20('0x53')],null))[_0xaa20('0x1e')](respondWithResult(_0x5e6bfa,null))[_0xaa20('0x28')](handleError(_0x5e6bfa,null));};exports['destroy']=function(_0xda0b2b,_0x5e02ca){return db['ZendeskAccount'][_0xaa20('0x51')]({'where':{'id':_0xda0b2b[_0xaa20('0x4d')]['id']}})[_0xaa20('0x1e')](handleEntityNotFound(_0x5e02ca,null))[_0xaa20('0x1e')](removeEntity(_0x5e02ca,null))[_0xaa20('0x28')](handleError(_0x5e02ca,null));};exports[_0xaa20('0x54')]=function(_0x5a11cc,_0x5e0730,_0x49cd74){var _0x7bc548={};var _0x3f76ed={};var _0x4a5b65;var _0x3bb3fe;return db['ZendeskAccount']['findOne']({'where':{'id':_0x5a11cc['params']['id']}})['then'](handleEntityNotFound(_0x5e0730,null))[_0xaa20('0x1e')](function(_0x25059a){if(_0x25059a){_0x4a5b65=_0x25059a;_0x3f76ed['model']=_['keys'](db[_0xaa20('0x55')][_0xaa20('0x56')]);_0x3f76ed[_0xaa20('0x3c')]=_[_0xaa20('0x3d')](_0x5a11cc[_0xaa20('0x3c')]);_0x3f76ed[_0xaa20('0x3e')]=_['intersection'](_0x3f76ed[_0xaa20('0x3b')],_0x3f76ed[_0xaa20('0x3c')]);_0x7bc548['attributes']=_[_0xaa20('0x3f')](_0x3f76ed[_0xaa20('0x3b')],qs[_0xaa20('0x4e')](_0x5a11cc[_0xaa20('0x3c')]['fields']));_0x7bc548[_0xaa20('0x40')]=_0x7bc548[_0xaa20('0x40')][_0xaa20('0x41')]?_0x7bc548[_0xaa20('0x40')]:_0x3f76ed['model'];_0x7bc548[_0xaa20('0x44')]=qs[_0xaa20('0x45')](_0x5a11cc[_0xaa20('0x3c')][_0xaa20('0x45')]);_0x7bc548[_0xaa20('0x46')]=qs[_0xaa20('0x3e')](_[_0xaa20('0x47')](_0x5a11cc['query'],_0x3f76ed[_0xaa20('0x3e')]));if(_0x5a11cc[_0xaa20('0x3c')][_0xaa20('0x57')]){_0x7bc548[_0xaa20('0x46')]=_['merge'](_0x7bc548[_0xaa20('0x46')],{'$or':_[_0xaa20('0x38')](_0x7bc548['attributes'],function(_0x4c37a0){var _0x201ecb={};_0x201ecb[_0x4c37a0]={'$like':'%'+_0x5a11cc[_0xaa20('0x3c')]['filter']+'%'};return _0x201ecb;})});}_0x7bc548=_[_0xaa20('0x4f')]({},_0x7bc548,_0x5a11cc[_0xaa20('0x50')]);return _0x4a5b65['getConfigurations'](_0x7bc548);}})['then'](function(_0x1783a1){if(_0x1783a1){_0x3bb3fe=_0x1783a1[_0xaa20('0x41')];if(!_0x5a11cc[_0xaa20('0x3c')][_0xaa20('0x42')](_0xaa20('0x58'))){_0x7bc548[_0xaa20('0x43')]=qs['limit'](_0x5a11cc[_0xaa20('0x3c')][_0xaa20('0x43')]);_0x7bc548[_0xaa20('0x2d')]=qs[_0xaa20('0x2d')](_0x5a11cc[_0xaa20('0x3c')][_0xaa20('0x2d')]);}return _0x4a5b65[_0xaa20('0x54')](_0x7bc548);}})[_0xaa20('0x1e')](function(_0x3c294a){if(_0x3c294a){return _0x3c294a?{'count':_0x3bb3fe,'rows':_0x3c294a}:null;}})[_0xaa20('0x1e')](respondWithResult(_0x5e0730,null))[_0xaa20('0x28')](handleError(_0x5e0730,null));};exports[_0xaa20('0x59')]=function(_0x1bf25a,_0x34a94b,_0x34b63d){if(_0x1bf25a[_0xaa20('0x53')]['id']){delete _0x1bf25a[_0xaa20('0x53')]['id'];}return db[_0xaa20('0x49')][_0xaa20('0x5a')]({'where':{'id':_0x1bf25a[_0xaa20('0x4d')]['id']}})[_0xaa20('0x1e')](handleEntityNotFound(_0x34a94b,null))[_0xaa20('0x1e')](function(_0x202ac2){if(_0x202ac2){_0x1bf25a[_0xaa20('0x53')][_0xaa20('0x5b')]=_0x202ac2['id'];_0x1bf25a[_0xaa20('0x53')]['Subjects']=integrations[_0xaa20('0x5c')](_0x1bf25a['body']['channel'],_0x1bf25a[_0xaa20('0x53')][_0xaa20('0x48')]);_0x1bf25a[_0xaa20('0x53')][_0xaa20('0x5d')]=integrations[_0xaa20('0x5e')](_0x1bf25a[_0xaa20('0x53')]['channel'],_0x1bf25a['body']['type']);return db[_0xaa20('0x55')]['create'](_0x1bf25a['body'],{'include':[{'model':db[_0xaa20('0x5f')],'as':_0xaa20('0x60')},{'model':db['ZendeskField'],'as':_0xaa20('0x5d')}]});}return null;})[_0xaa20('0x1e')](respondWithResult(_0x34a94b,null))['catch'](handleError(_0x34a94b,null));};exports[_0xaa20('0x61')]=function(_0x23504c,_0x3d3ef3,_0x4c4b95){var _0xdc1913='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x23504c[_0xaa20('0x4d')]['id']},'attributes':['id',_0xaa20('0x62'),_0xaa20('0x63'),_0xaa20('0x64'),_0xaa20('0x65'),'remoteUri']})['then'](handleEntityNotFound(_0x3d3ef3,null))[_0xaa20('0x1e')](function(_0x2c9d0c){if(_0x2c9d0c){_0xdc1913=_0x2c9d0c[_0xaa20('0x66')];var _0x519ce3=_0xdc1913[_0xaa20('0x67')](-0x1);if(_0x519ce3==='/'){_0xdc1913=_0xdc1913[_0xaa20('0x68')](0x0,_0xdc1913['lastIndexOf'](_0x519ce3));}var _0x140a3f={'method':_0xaa20('0x69'),'uri':util[_0xaa20('0x6a')](_0xaa20('0x6b'),_0xdc1913,_0xaa20('0x6c')),'json':!![]};switch(_0x2c9d0c[_0xaa20('0x65')]){case _0xaa20('0x63'):_0x140a3f['headers']={'Authorization':util[_0xaa20('0x6a')](_0xaa20('0x6d'),new Buffer(util[_0xaa20('0x6a')](_0xaa20('0x6e'),_0x2c9d0c['username'],_0x2c9d0c['password']))[_0xaa20('0x6f')](_0xaa20('0x70')))};break;case _0xaa20('0x64'):_0x140a3f['headers']={'Authorization':util[_0xaa20('0x6a')](_0xaa20('0x6d'),new Buffer(util['format'](_0xaa20('0x71'),_0x2c9d0c[_0xaa20('0x62')],_0x2c9d0c['token']))[_0xaa20('0x6f')](_0xaa20('0x70')))};break;default:throw new db[(_0xaa20('0x72'))][(_0xaa20('0x73'))]('Unknown\x20authentication\x20type');}return rp(_0x140a3f);}})['then'](function(_0x3870af){if(_0x3870af){var _0x120d28=['subject','description','group',_0xaa20('0x74')];_[_0xaa20('0x75')](_0x3870af[_0xaa20('0x6c')],function(_0x38a090){return _0x120d28[_0xaa20('0x76')](_0x38a090['type']);});return{'count':_0x3870af[_0xaa20('0x6c')]['length'],'rows':_['map'](_0x3870af[_0xaa20('0x6c')],function(_0x3e49c8){return{'id':_0x3e49c8['id'],'name':_0x3e49c8['position']>0x7?_0x3e49c8[_0xaa20('0x77')]:_0x3e49c8[_0xaa20('0x48')],'custom':_0x3e49c8['position']>0x7?!![]:![],'options':_0x3e49c8[_0xaa20('0x78')]?_0x3e49c8[_0xaa20('0x78')]:_0x3e49c8[_0xaa20('0x79')]?_0x3e49c8[_0xaa20('0x79')]:[]};})};}})[_0xaa20('0x1e')](respondWithResult(_0x3d3ef3,null))['catch'](function(_0x21a1b6){var _0x1c8b2e=_0x23504c['query'][_0xaa20('0x7a')]?0x1f4:_0x21a1b6[_0xaa20('0x7b')]||0x1f4;logger[_0xaa20('0x24')](_0xaa20('0x7c'),_0xaa20('0x61'),_0x1c8b2e,JSON[_0xaa20('0x7d')](_0x21a1b6));delete _0x21a1b6[_0xaa20('0x35')];if(_0x1c8b2e===0x191){_0x1c8b2e=0x190;}_0x3d3ef3[_0xaa20('0x2b')](_0x1c8b2e)['send'](_0x23504c[_0xaa20('0x3c')][_0xaa20('0x7a')]?{'message':_0xaa20('0x7e'),'statusCode':_0x21a1b6[_0xaa20('0x7b')]}:_0x21a1b6);});}; \ No newline at end of file +var _0x18a9=['code','ZendeskAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','limit','reject','update','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','ZendeskAccount','includeAll','include','findAll','rows','show','params','keys','find','create','body','destroy','getConfigurations','ZendeskConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskField','getFields','username','password','authType','remoteUri','slice','substring','GET','format','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','%s/token:%s','token','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','system_field_options','custom_field_options','test','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5076e3,_0x500ef4){var _0x3c973c=function(_0x5ee0cf){while(--_0x5ee0cf){_0x5076e3['push'](_0x5076e3['shift']());}};_0x3c973c(++_0x500ef4);}(_0x18a9,0x15b));var _0x918a=function(_0x305cc6,_0x23b8fa){_0x305cc6=_0x305cc6-0x0;var _0x5362d6=_0x18a9[_0x305cc6];return _0x5362d6;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x918a('0x0'));var zipdir=require(_0x918a('0x1'));var jsonpatch=require(_0x918a('0x2'));var rp=require(_0x918a('0x3'));var moment=require(_0x918a('0x4'));var BPromise=require(_0x918a('0x5'));var Mustache=require(_0x918a('0x6'));var util=require(_0x918a('0x7'));var path=require(_0x918a('0x8'));var sox=require(_0x918a('0x9'));var csv=require(_0x918a('0xa'));var ejs=require(_0x918a('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x918a('0xc'));var crypto=require(_0x918a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x918a('0xe'));var toCsv=require(_0x918a('0xa'));var querystring=require(_0x918a('0xf'));var Papa=require(_0x918a('0x10'));var Redis=require(_0x918a('0x11'));var authService=require(_0x918a('0x12'));var qs=require(_0x918a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x918a('0x14'));var logger=require(_0x918a('0x15'))(_0x918a('0x16'));var utils=require(_0x918a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x918a('0x18'));var db=require(_0x918a('0x19'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x918a('0x1a'));var client=jayson[_0x918a('0x1b')][_0x918a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2ea084,_0x53cc4b,_0x162d88,_0x55c90e){return new BPromise(function(_0x19583e,_0x595920){var _0x5696a1=_0x55c90e||client;return _0x5696a1[_0x918a('0x1d')](_0x2ea084,_0x162d88)[_0x918a('0x1e')](function(_0x47ce2d){logger[_0x918a('0x1f')]('ZendeskAccount,\x20%s,\x20%s',_0x53cc4b,_0x918a('0x20'));logger[_0x918a('0x21')](_0x918a('0x22'),_0x53cc4b,'request\x20sent',JSON[_0x918a('0x23')](_0x47ce2d));if(_0x47ce2d['error']){if(_0x47ce2d[_0x918a('0x24')][_0x918a('0x25')]===0x1f4){logger[_0x918a('0x24')](_0x918a('0x26'),_0x53cc4b,_0x47ce2d['error'][_0x918a('0x27')]);return _0x595920(_0x47ce2d[_0x918a('0x24')][_0x918a('0x27')]);}logger[_0x918a('0x24')](_0x918a('0x26'),_0x53cc4b,_0x47ce2d[_0x918a('0x24')][_0x918a('0x27')]);return _0x19583e(_0x47ce2d['error'][_0x918a('0x27')]);}else{logger['info'](_0x918a('0x26'),_0x53cc4b,'request\x20sent');_0x19583e(_0x47ce2d['result']['message']);}})[_0x918a('0x28')](function(_0x4b03b5){logger[_0x918a('0x24')](_0x918a('0x26'),_0x53cc4b,_0x4b03b5);_0x595920(_0x4b03b5);});});}function respondWithStatusCode(_0xadd3bc,_0x2d8077){_0x2d8077=_0x2d8077||0xcc;return function(_0x2b43d1){if(_0x2b43d1){return _0xadd3bc[_0x918a('0x29')](_0x2d8077);}return _0xadd3bc[_0x918a('0x2a')](_0x2d8077)[_0x918a('0x2b')]();};}function respondWithResult(_0xfdad4a,_0xc10404){_0xc10404=_0xc10404||0xc8;return function(_0x5a6695){if(_0x5a6695){return _0xfdad4a[_0x918a('0x2a')](_0xc10404)[_0x918a('0x2c')](_0x5a6695);}};}function respondWithFilteredResult(_0x262d5c,_0x4a77c6){return function(_0x22653a){if(_0x22653a){var _0x36f103=_0x22653a[_0x918a('0x2d')],_0x2728f2=_0x4a77c6[_0x918a('0x2e')],_0x549cb4=_0x4a77c6[_0x918a('0x2e')]+_0x4a77c6[_0x918a('0x2f')],_0x315089;if(_0x549cb4>=_0x36f103){_0x549cb4=_0x36f103;_0x315089=0xc8;}else{_0x315089=0xce;}_0x262d5c[_0x918a('0x2a')](_0x315089);return _0x262d5c['set']('Content-Range',_0x2728f2+'-'+_0x549cb4+'/'+_0x36f103)['json'](_0x22653a);}return null;};}function patchUpdates(_0x89260f){return function(_0x2514ae){try{jsonpatch['apply'](_0x2514ae,_0x89260f,!![]);}catch(_0x1dd40a){return BPromise[_0x918a('0x30')](_0x1dd40a);}return _0x2514ae['save']();};}function saveUpdates(_0x5c7d95,_0x3eb065){return function(_0x511685){if(_0x511685){return _0x511685[_0x918a('0x31')](_0x5c7d95)[_0x918a('0x1e')](function(_0x17fdfc){return _0x17fdfc;});}return null;};}function removeEntity(_0x38d0b5,_0x3be800){return function(_0x2b2f8e){if(_0x2b2f8e){return _0x2b2f8e['destroy']()[_0x918a('0x1e')](function(){_0x38d0b5[_0x918a('0x2a')](0xcc)[_0x918a('0x2b')]();});}};}function handleEntityNotFound(_0x39cb5c,_0x9592b1){return function(_0x26cca5){if(!_0x26cca5){_0x39cb5c['sendStatus'](0x194);}return _0x26cca5;};}function handleError(_0x3a7cbf,_0x1dc1ad){_0x1dc1ad=_0x1dc1ad||0x1f4;return function(_0x5293c3){logger['error'](_0x5293c3[_0x918a('0x32')]);if(_0x5293c3['name']){delete _0x5293c3[_0x918a('0x33')];}_0x3a7cbf['status'](_0x1dc1ad)[_0x918a('0x34')](_0x5293c3);};}exports[_0x918a('0x35')]=function(_0x169e91,_0x136f40){var _0x131dd3={},_0x55e7d2={},_0x487dd8={'count':0x0,'rows':[]};var _0x2144d1=_[_0x918a('0x36')](db['ZendeskAccount'][_0x918a('0x37')],function(_0x2a9833){return{'name':_0x2a9833[_0x918a('0x38')],'type':_0x2a9833[_0x918a('0x39')][_0x918a('0x3a')]};});_0x55e7d2[_0x918a('0x3b')]=_[_0x918a('0x36')](_0x2144d1,'name');_0x55e7d2[_0x918a('0x3c')]=_['keys'](_0x169e91['query']);_0x55e7d2[_0x918a('0x3d')]=_[_0x918a('0x3e')](_0x55e7d2[_0x918a('0x3b')],_0x55e7d2[_0x918a('0x3c')]);_0x131dd3['attributes']=_[_0x918a('0x3e')](_0x55e7d2[_0x918a('0x3b')],qs[_0x918a('0x3f')](_0x169e91[_0x918a('0x3c')][_0x918a('0x3f')]));_0x131dd3['attributes']=_0x131dd3[_0x918a('0x40')][_0x918a('0x41')]?_0x131dd3[_0x918a('0x40')]:_0x55e7d2[_0x918a('0x3b')];if(!_0x169e91[_0x918a('0x3c')][_0x918a('0x42')](_0x918a('0x43'))){_0x131dd3[_0x918a('0x2f')]=qs[_0x918a('0x2f')](_0x169e91['query'][_0x918a('0x2f')]);_0x131dd3[_0x918a('0x2e')]=qs[_0x918a('0x2e')](_0x169e91[_0x918a('0x3c')][_0x918a('0x2e')]);}_0x131dd3[_0x918a('0x44')]=qs[_0x918a('0x45')](_0x169e91['query'][_0x918a('0x45')]);_0x131dd3[_0x918a('0x46')]=qs[_0x918a('0x3d')](_[_0x918a('0x47')](_0x169e91['query'],_0x55e7d2[_0x918a('0x3d')]),_0x2144d1);if(_0x169e91['query'][_0x918a('0x48')]){_0x131dd3[_0x918a('0x46')]=_['merge'](_0x131dd3['where'],{'$or':_[_0x918a('0x36')](_0x2144d1,function(_0x6651c3){if(_0x6651c3[_0x918a('0x39')]!==_0x918a('0x49')){var _0x59080c={};_0x59080c[_0x6651c3['name']]={'$like':'%'+_0x169e91[_0x918a('0x3c')][_0x918a('0x48')]+'%'};return _0x59080c;}})});}_0x131dd3=_[_0x918a('0x4a')]({},_0x131dd3,_0x169e91[_0x918a('0x4b')]);var _0x5215e1={'where':_0x131dd3['where']};return db[_0x918a('0x4c')]['count'](_0x5215e1)[_0x918a('0x1e')](function(_0x16b1e8){_0x487dd8[_0x918a('0x2d')]=_0x16b1e8;if(_0x169e91[_0x918a('0x3c')][_0x918a('0x4d')]){_0x131dd3[_0x918a('0x4e')]=[{'all':!![]}];}return db[_0x918a('0x4c')][_0x918a('0x4f')](_0x131dd3);})[_0x918a('0x1e')](function(_0x2ad764){_0x487dd8[_0x918a('0x50')]=_0x2ad764;return _0x487dd8;})[_0x918a('0x1e')](respondWithFilteredResult(_0x136f40,_0x131dd3))[_0x918a('0x28')](handleError(_0x136f40,null));};exports[_0x918a('0x51')]=function(_0x5048b8,_0x1552a1){var _0x4d3a00={'raw':![],'where':{'id':_0x5048b8[_0x918a('0x52')]['id']}},_0x56af76={};_0x56af76['model']=_[_0x918a('0x53')](db[_0x918a('0x4c')]['rawAttributes']);_0x56af76['query']=_[_0x918a('0x53')](_0x5048b8['query']);_0x56af76[_0x918a('0x3d')]=_[_0x918a('0x3e')](_0x56af76[_0x918a('0x3b')],_0x56af76[_0x918a('0x3c')]);_0x4d3a00[_0x918a('0x40')]=_['intersection'](_0x56af76[_0x918a('0x3b')],qs[_0x918a('0x3f')](_0x5048b8[_0x918a('0x3c')]['fields']));_0x4d3a00[_0x918a('0x40')]=_0x4d3a00['attributes'][_0x918a('0x41')]?_0x4d3a00[_0x918a('0x40')]:_0x56af76[_0x918a('0x3b')];if(_0x5048b8[_0x918a('0x3c')]['includeAll']){_0x4d3a00[_0x918a('0x4e')]=[{'all':!![]}];}_0x4d3a00=_[_0x918a('0x4a')]({},_0x4d3a00,_0x5048b8[_0x918a('0x4b')]);return db[_0x918a('0x4c')][_0x918a('0x54')](_0x4d3a00)['then'](handleEntityNotFound(_0x1552a1,null))[_0x918a('0x1e')](respondWithResult(_0x1552a1,null))[_0x918a('0x28')](handleError(_0x1552a1,null));};exports[_0x918a('0x55')]=function(_0x116148,_0x49a03f){return db[_0x918a('0x4c')][_0x918a('0x55')](_0x116148['body'],{})[_0x918a('0x1e')](respondWithResult(_0x49a03f,0xc9))[_0x918a('0x28')](handleError(_0x49a03f,null));};exports[_0x918a('0x31')]=function(_0x2e5d64,_0x5e0625){if(_0x2e5d64[_0x918a('0x56')]['id']){delete _0x2e5d64[_0x918a('0x56')]['id'];}return db[_0x918a('0x4c')][_0x918a('0x54')]({'where':{'id':_0x2e5d64[_0x918a('0x52')]['id']}})[_0x918a('0x1e')](handleEntityNotFound(_0x5e0625,null))[_0x918a('0x1e')](saveUpdates(_0x2e5d64[_0x918a('0x56')],null))[_0x918a('0x1e')](respondWithResult(_0x5e0625,null))[_0x918a('0x28')](handleError(_0x5e0625,null));};exports[_0x918a('0x57')]=function(_0x29c89c,_0x45f308){return db[_0x918a('0x4c')][_0x918a('0x54')]({'where':{'id':_0x29c89c['params']['id']}})['then'](handleEntityNotFound(_0x45f308,null))[_0x918a('0x1e')](removeEntity(_0x45f308,null))[_0x918a('0x28')](handleError(_0x45f308,null));};exports[_0x918a('0x58')]=function(_0x3a3d27,_0x10b61d,_0x30c3ca){var _0x1f8e78={};var _0x93270d={};var _0x5a9f4d;var _0x2c772b;return db[_0x918a('0x4c')]['findOne']({'where':{'id':_0x3a3d27[_0x918a('0x52')]['id']}})[_0x918a('0x1e')](handleEntityNotFound(_0x10b61d,null))[_0x918a('0x1e')](function(_0xfb7650){if(_0xfb7650){_0x5a9f4d=_0xfb7650;_0x93270d['model']=_[_0x918a('0x53')](db[_0x918a('0x59')]['rawAttributes']);_0x93270d[_0x918a('0x3c')]=_[_0x918a('0x53')](_0x3a3d27['query']);_0x93270d[_0x918a('0x3d')]=_['intersection'](_0x93270d[_0x918a('0x3b')],_0x93270d[_0x918a('0x3c')]);_0x1f8e78[_0x918a('0x40')]=_[_0x918a('0x3e')](_0x93270d['model'],qs[_0x918a('0x3f')](_0x3a3d27[_0x918a('0x3c')][_0x918a('0x3f')]));_0x1f8e78[_0x918a('0x40')]=_0x1f8e78[_0x918a('0x40')][_0x918a('0x41')]?_0x1f8e78[_0x918a('0x40')]:_0x93270d[_0x918a('0x3b')];_0x1f8e78[_0x918a('0x44')]=qs['sort'](_0x3a3d27[_0x918a('0x3c')][_0x918a('0x45')]);_0x1f8e78[_0x918a('0x46')]=qs['filters'](_['pick'](_0x3a3d27[_0x918a('0x3c')],_0x93270d[_0x918a('0x3d')]));if(_0x3a3d27[_0x918a('0x3c')][_0x918a('0x48')]){_0x1f8e78[_0x918a('0x46')]=_['merge'](_0x1f8e78['where'],{'$or':_[_0x918a('0x36')](_0x1f8e78[_0x918a('0x40')],function(_0x1facdc){var _0x1b1bfa={};_0x1b1bfa[_0x1facdc]={'$like':'%'+_0x3a3d27[_0x918a('0x3c')][_0x918a('0x48')]+'%'};return _0x1b1bfa;})});}_0x1f8e78=_[_0x918a('0x4a')]({},_0x1f8e78,_0x3a3d27[_0x918a('0x4b')]);return _0x5a9f4d['getConfigurations'](_0x1f8e78);}})[_0x918a('0x1e')](function(_0x1d0ed5){if(_0x1d0ed5){_0x2c772b=_0x1d0ed5[_0x918a('0x41')];if(!_0x3a3d27[_0x918a('0x3c')][_0x918a('0x42')]('nolimit')){_0x1f8e78[_0x918a('0x2f')]=qs[_0x918a('0x2f')](_0x3a3d27[_0x918a('0x3c')][_0x918a('0x2f')]);_0x1f8e78['offset']=qs[_0x918a('0x2e')](_0x3a3d27[_0x918a('0x3c')]['offset']);}return _0x5a9f4d['getConfigurations'](_0x1f8e78);}})[_0x918a('0x1e')](function(_0xe49baf){if(_0xe49baf){return _0xe49baf?{'count':_0x2c772b,'rows':_0xe49baf}:null;}})[_0x918a('0x1e')](respondWithResult(_0x10b61d,null))['catch'](handleError(_0x10b61d,null));};exports['addConfiguration']=function(_0x24dbd0,_0x2bd343,_0x2807ef){if(_0x24dbd0[_0x918a('0x56')]['id']){delete _0x24dbd0[_0x918a('0x56')]['id'];}return db['ZendeskAccount'][_0x918a('0x5a')]({'where':{'id':_0x24dbd0['params']['id']}})['then'](handleEntityNotFound(_0x2bd343,null))['then'](function(_0x53c348){if(_0x53c348){_0x24dbd0[_0x918a('0x56')][_0x918a('0x5b')]=_0x53c348['id'];_0x24dbd0[_0x918a('0x56')][_0x918a('0x5c')]=integrations[_0x918a('0x5d')](_0x24dbd0[_0x918a('0x56')]['channel'],_0x24dbd0['body'][_0x918a('0x39')]);_0x24dbd0[_0x918a('0x56')][_0x918a('0x5e')]=integrations[_0x918a('0x5f')](_0x24dbd0[_0x918a('0x56')][_0x918a('0x60')],_0x24dbd0[_0x918a('0x56')][_0x918a('0x39')]);return db[_0x918a('0x59')][_0x918a('0x55')](_0x24dbd0[_0x918a('0x56')],{'include':[{'model':db[_0x918a('0x61')],'as':'Subjects'},{'model':db[_0x918a('0x61')],'as':_0x918a('0x5e')}]});}return null;})['then'](respondWithResult(_0x2bd343,null))[_0x918a('0x28')](handleError(_0x2bd343,null));};exports[_0x918a('0x62')]=function(_0x1221c7,_0x15a702,_0x4cece0){var _0x541962='';return db[_0x918a('0x4c')][_0x918a('0x5a')]({'where':{'id':_0x1221c7[_0x918a('0x52')]['id']},'attributes':['id',_0x918a('0x63'),_0x918a('0x64'),'token',_0x918a('0x65'),_0x918a('0x66')]})[_0x918a('0x1e')](handleEntityNotFound(_0x15a702,null))['then'](function(_0x3f67ca){if(_0x3f67ca){_0x541962=_0x3f67ca['remoteUri'];var _0x1fba78=_0x541962[_0x918a('0x67')](-0x1);if(_0x1fba78==='/'){_0x541962=_0x541962[_0x918a('0x68')](0x0,_0x541962['lastIndexOf'](_0x1fba78));}var _0x4f088e={'method':_0x918a('0x69'),'uri':util[_0x918a('0x6a')]('%s/%s',_0x541962,_0x918a('0x6b')),'json':!![]};switch(_0x3f67ca[_0x918a('0x65')]){case'password':_0x4f088e[_0x918a('0x6c')]={'Authorization':util[_0x918a('0x6a')](_0x918a('0x6d'),new Buffer(util[_0x918a('0x6a')](_0x918a('0x6e'),_0x3f67ca[_0x918a('0x63')],_0x3f67ca[_0x918a('0x64')]))[_0x918a('0x6f')](_0x918a('0x70')))};break;case'token':_0x4f088e[_0x918a('0x6c')]={'Authorization':util[_0x918a('0x6a')](_0x918a('0x6d'),new Buffer(util[_0x918a('0x6a')](_0x918a('0x71'),_0x3f67ca['username'],_0x3f67ca[_0x918a('0x72')]))[_0x918a('0x6f')](_0x918a('0x70')))};break;default:throw new db['Sequelize'][(_0x918a('0x73'))](_0x918a('0x74'));}return rp(_0x4f088e);}})[_0x918a('0x1e')](function(_0x2957b3){if(_0x2957b3){var _0x22029d=[_0x918a('0x75'),_0x918a('0x76'),_0x918a('0x77'),_0x918a('0x78')];_[_0x918a('0x79')](_0x2957b3['ticket_fields'],function(_0x45c13b){return _0x22029d[_0x918a('0x7a')](_0x45c13b[_0x918a('0x39')]);});return{'count':_0x2957b3[_0x918a('0x6b')][_0x918a('0x41')],'rows':_['map'](_0x2957b3[_0x918a('0x6b')],function(_0x32327f){return{'id':_0x32327f['id'],'name':_0x32327f[_0x918a('0x7b')]>0x7?_0x32327f['title']:_0x32327f[_0x918a('0x39')],'custom':_0x32327f['position']>0x7?!![]:![],'options':_0x32327f['system_field_options']?_0x32327f[_0x918a('0x7c')]:_0x32327f['custom_field_options']?_0x32327f[_0x918a('0x7d')]:[]};})};}})[_0x918a('0x1e')](respondWithResult(_0x15a702,null))[_0x918a('0x28')](function(_0x39225a){var _0x277313=_0x1221c7[_0x918a('0x3c')][_0x918a('0x7e')]?0x1f4:_0x39225a[_0x918a('0x7f')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x277313,JSON[_0x918a('0x23')](_0x39225a));delete _0x39225a['name'];if(_0x277313===0x191){_0x277313=0x190;}_0x15a702[_0x918a('0x2a')](_0x277313)['send'](_0x1221c7[_0x918a('0x3c')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x39225a[_0x918a('0x7f')]}:_0x39225a);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 0d6c95e..48d38a3 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 _0xb91d=['api','moment','request-promise','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util'];(function(_0x467128,_0x525714){var _0x5a2df5=function(_0x17e0dc){while(--_0x17e0dc){_0x467128['push'](_0x467128['shift']());}};_0x5a2df5(++_0x525714);}(_0xb91d,0x19e));var _0xdb91=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0xb91d[_0x3f4891];return _0x54f2d8;};'use strict';var _=require(_0xdb91('0x0'));var util=require(_0xdb91('0x1'));var logger=require('../../config/logger')(_0xdb91('0x2'));var moment=require(_0xdb91('0x3'));var BPromise=require('bluebird');var rp=require(_0xdb91('0x4'));var fs=require('fs');var path=require(_0xdb91('0x5'));var rimraf=require(_0xdb91('0x6'));var config=require('../../config/environment');var attributes=require(_0xdb91('0x7'));var integrations=require(_0xdb91('0x8'));module[_0xdb91('0x9')]=function(_0x47925d,_0x96077b){return _0x47925d[_0xdb91('0xa')](_0xdb91('0xb'),attributes,{'tableName':_0xdb91('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x74d7=['moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ZendeskAccount','lodash','api'];(function(_0x139e74,_0x1aa29c){var _0x226a74=function(_0x40396f){while(--_0x40396f){_0x139e74['push'](_0x139e74['shift']());}};_0x226a74(++_0x1aa29c);}(_0x74d7,0x112));var _0x774d=function(_0x4d67b8,_0x565134){_0x4d67b8=_0x4d67b8-0x0;var _0x55af3b=_0x74d7[_0x4d67b8];return _0x55af3b;};'use strict';var _=require(_0x774d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x774d('0x1'));var moment=require(_0x774d('0x2'));var BPromise=require(_0x774d('0x3'));var rp=require(_0x774d('0x4'));var fs=require('fs');var path=require(_0x774d('0x5'));var rimraf=require(_0x774d('0x6'));var config=require(_0x774d('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x774d('0x8'));module[_0x774d('0x9')]=function(_0x2b5d6d,_0x10f4e4){return _0x2b5d6d[_0x774d('0xa')](_0x774d('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 568f388..bbd0ce7 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 _0xbaf0=['ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','model','map','ShowZendeskAccount','find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4a96ca,_0x13754e){var _0x2aed48=function(_0x361330){while(--_0x361330){_0x4a96ca['push'](_0x4a96ca['shift']());}};_0x2aed48(++_0x13754e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});}exports[_0x0baf('0x16')]=function(_0x53c338){var _0x63c820=this;return new Promise(function(_0xfbecec,_0x1ef0e5){return db[_0x0baf('0x17')][_0x0baf('0x18')]({'raw':_0x53c338[_0x0baf('0x19')]?_0x53c338['options']['raw']===undefined?!![]:![]:!![],'where':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'limit':_0x53c338[_0x0baf('0x19')]?_0x53c338[_0x0baf('0x19')][_0x0baf('0x1c')]||null:null,'include':_0x53c338[_0x0baf('0x19')]?_0x53c338['options'][_0x0baf('0x1d')]?_['map'](_0x53c338[_0x0baf('0x19')]['include'],function(_0x4de74c){return{'model':db[_0x4de74c[_0x0baf('0x1e')]],'as':_0x4de74c['as'],'attributes':_0x4de74c['attributes'],'include':_0x4de74c['include']?_[_0x0baf('0x1f')](_0x4de74c[_0x0baf('0x1d')],function(_0x34e264){return{'model':db[_0x34e264[_0x0baf('0x1e')]],'as':_0x34e264['as'],'attributes':_0x34e264[_0x0baf('0x1b')],'include':_0x34e264['include']?_[_0x0baf('0x1f')](_0x34e264[_0x0baf('0x1d')],function(_0x1ca35a){return{'model':db[_0x1ca35a[_0x0baf('0x1e')]],'as':_0x1ca35a['as'],'attributes':_0x1ca35a[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x453525){logger['info'](_0x0baf('0x16'),_0x53c338);logger[_0x0baf('0x10')](_0x0baf('0x16'),_0x53c338,JSON[_0x0baf('0x12')](_0x453525));_0xfbecec(_0x453525);})['catch'](function(_0x29dbdf){logger[_0x0baf('0x13')]('GetZendeskAccount',_0x29dbdf[_0x0baf('0x14')],_0x53c338);_0x1ef0e5(_0x63c820[_0x0baf('0x13')](0x1f4,_0x29dbdf[_0x0baf('0x14')]));});});};exports[_0x0baf('0x20')]=function(_0xd14f0f){var _0x366924=this;return new Promise(function(_0x213a6a,_0x57476f){return db[_0x0baf('0x17')][_0x0baf('0x21')]({'raw':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x22')]===undefined?!![]:![]:!![],'where':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1a')]||null:null,'attributes':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1b')]||null:null,'include':_0xd14f0f[_0x0baf('0x19')]?_0xd14f0f[_0x0baf('0x19')][_0x0baf('0x1d')]?_['map'](_0xd14f0f[_0x0baf('0x19')]['include'],function(_0x1aa474){return{'model':db[_0x1aa474[_0x0baf('0x1e')]],'as':_0x1aa474['as'],'attributes':_0x1aa474[_0x0baf('0x1b')],'include':_0x1aa474[_0x0baf('0x1d')]?_['map'](_0x1aa474[_0x0baf('0x1d')],function(_0x1d6575){return{'model':db[_0x1d6575['model']],'as':_0x1d6575['as'],'attributes':_0x1d6575[_0x0baf('0x1b')],'include':_0x1d6575[_0x0baf('0x1d')]?_[_0x0baf('0x1f')](_0x1d6575[_0x0baf('0x1d')],function(_0x1f60bd){return{'model':db[_0x1f60bd[_0x0baf('0x1e')]],'as':_0x1f60bd['as'],'attributes':_0x1f60bd[_0x0baf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0baf('0xc')](function(_0x4aa6ed){logger[_0x0baf('0xd')](_0x0baf('0x20'),_0xd14f0f);logger['debug'](_0x0baf('0x20'),_0xd14f0f,JSON['stringify'](_0x4aa6ed));_0x213a6a(_0x4aa6ed);})['catch'](function(_0x11bc49){logger[_0x0baf('0x13')]('ShowZendeskAccount',_0x11bc49['message'],_0xd14f0f);_0x57476f(_0x366924[_0x0baf('0x13')](0x1f4,_0x11bc49[_0x0baf('0x14')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','ZendeskAccount','findAll','options','raw','where','attributes','include','map','model','GetZendeskAccount','stringify','ShowZendeskAccount','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x3fe042,_0x1106f7){var _0x7d4a1f=function(_0x2df987){while(--_0x2df987){_0x3fe042['push'](_0x3fe042['shift']());}};_0x7d4a1f(++_0x1106f7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetZendeskAccount']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowZendeskAccount',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 511356c..5281ee5 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 _0xd360=['/:id/tags','setTags','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create'];(function(_0x128832,_0x480891){var _0x245228=function(_0x4e1641){while(--_0x4e1641){_0x128832['push'](_0x128832['shift']());}};_0x245228(++_0x480891);}(_0xd360,0xbe));var _0x0d36=function(_0x338706,_0x15e65d){_0x338706=_0x338706-0x0;var _0x278cb9=_0xd360[_0x338706];return _0x278cb9;};'use strict';var multer=require(_0x0d36('0x0'));var util=require('util');var path=require(_0x0d36('0x1'));var timeout=require(_0x0d36('0x2'));var express=require(_0x0d36('0x3'));var router=express[_0x0d36('0x4')]();var auth=require(_0x0d36('0x5'));var interaction=require(_0x0d36('0x6'));var config=require(_0x0d36('0x7'));var controller=require(_0x0d36('0x8'));router[_0x0d36('0x9')]('/',auth[_0x0d36('0xa')](),controller[_0x0d36('0xb')]);router['get']('/:id',auth[_0x0d36('0xa')](),controller['show']);router[_0x0d36('0x9')](_0x0d36('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x0d36('0x9')](_0x0d36('0xd'),auth[_0x0d36('0xa')](),controller[_0x0d36('0xe')]);router[_0x0d36('0x9')]('/:id/descriptions',auth[_0x0d36('0xa')](),controller[_0x0d36('0xf')]);router[_0x0d36('0x9')]('/:id/tags',auth['isAuthenticated'](),controller['getTags']);router[_0x0d36('0x10')]('/',auth['isAuthenticated'](),controller[_0x0d36('0x11')]);router[_0x0d36('0x10')](_0x0d36('0x12'),auth[_0x0d36('0xa')](),controller[_0x0d36('0x13')]);router[_0x0d36('0x14')](_0x0d36('0x15'),auth[_0x0d36('0xa')](),controller[_0x0d36('0x16')]);router[_0x0d36('0x17')](_0x0d36('0x15'),auth[_0x0d36('0xa')](),controller[_0x0d36('0x18')]);module[_0x0d36('0x19')]=router; \ No newline at end of file +var _0x0594=['getDescriptions','getTags','post','/:id/tags','setTags','put','update','delete','destroy','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','index','isAuthenticated','get','/:id/fields','/:id/subjects','/:id/descriptions'];(function(_0x51ec61,_0xf9d1e3){var _0x223200=function(_0x3bd510){while(--_0x3bd510){_0x51ec61['push'](_0x51ec61['shift']());}};_0x223200(++_0xf9d1e3);}(_0x0594,0x183));var _0x4059=function(_0x403a01,_0x1af69a){_0x403a01=_0x403a01-0x0;var _0x5ec65c=_0x0594[_0x403a01];return _0x5ec65c;};'use strict';var multer=require(_0x4059('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4059('0x1'));var express=require(_0x4059('0x2'));var router=express[_0x4059('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4059('0x4'));var config=require(_0x4059('0x5'));var controller=require('./intZendeskConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4059('0x6')]);router['get']('/:id',auth[_0x4059('0x7')](),controller['show']);router[_0x4059('0x8')](_0x4059('0x9'),auth[_0x4059('0x7')](),controller['getFields']);router['get'](_0x4059('0xa'),auth[_0x4059('0x7')](),controller['getSubjects']);router['get'](_0x4059('0xb'),auth[_0x4059('0x7')](),controller[_0x4059('0xc')]);router[_0x4059('0x8')]('/:id/tags',auth[_0x4059('0x7')](),controller[_0x4059('0xd')]);router[_0x4059('0xe')]('/',auth[_0x4059('0x7')](),controller['create']);router[_0x4059('0xe')](_0x4059('0xf'),auth[_0x4059('0x7')](),controller[_0x4059('0x10')]);router[_0x4059('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x4059('0x12')]);router[_0x4059('0x13')]('/:id',auth[_0x4059('0x7')](),controller[_0x4059('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 957e342..f0e5986 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 _0x7a2b=['exports','STRING','sequelize'];(function(_0xbd059a,_0x309bd9){var _0x5c3526=function(_0x1770e4){while(--_0x1770e4){_0xbd059a['push'](_0xbd059a['shift']());}};_0x5c3526(++_0x309bd9);}(_0x7a2b,0x17c));var _0xb7a2=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x7a2b[_0x5bd426];return _0x23a7eb;};'use strict';var Sequelize=require(_0xb7a2('0x0'));module[_0xb7a2('0x1')]={'name':{'type':Sequelize[_0xb7a2('0x2')]},'description':{'type':Sequelize[_0xb7a2('0x2')]}}; \ No newline at end of file +var _0xfda3=['sequelize','exports','STRING'];(function(_0x5c2092,_0x22f8d2){var _0x47e5bd=function(_0x34e655){while(--_0x34e655){_0x5c2092['push'](_0x5c2092['shift']());}};_0x47e5bd(++_0x22f8d2);}(_0xfda3,0x1dd));var _0x3fda=function(_0x3d86bf,_0x189cfa){_0x3d86bf=_0x3d86bf-0x0;var _0x40bfba=_0xfda3[_0x3d86bf];return _0x40bfba;};'use strict';var Sequelize=require(_0x3fda('0x0'));module[_0x3fda('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3fda('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 910e348..8aaa376 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 _0x87fa=['zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','count','offset','limit','apply','save','update','sendStatus','stack','name','send','index','ZendeskConfiguration','type','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','show','length','include','find','create','body','params','getFields','findOne','ZendeskField','rawAttributes','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf'];(function(_0x387311,_0x124f97){var _0x4c8d4e=function(_0x46b2f9){while(--_0x46b2f9){_0x387311['push'](_0x387311['shift']());}};_0x4c8d4e(++_0x124f97);}(_0x87fa,0x10c));var _0xa87f=function(_0x3474d0,_0x22d867){_0x3474d0=_0x3474d0-0x0;var _0xe202c4=_0x87fa[_0x3474d0];return _0xe202c4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa87f('0x0'));var rimraf=require(_0xa87f('0x1'));var zipdir=require(_0xa87f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa87f('0x3'));var moment=require(_0xa87f('0x4'));var BPromise=require(_0xa87f('0x5'));var Mustache=require(_0xa87f('0x6'));var util=require('util');var path=require(_0xa87f('0x7'));var sox=require(_0xa87f('0x8'));var csv=require(_0xa87f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa87f('0xa'));var squel=require(_0xa87f('0xb'));var crypto=require(_0xa87f('0xc'));var jsforce=require(_0xa87f('0xd'));var deskjs=require(_0xa87f('0xe'));var toCsv=require(_0xa87f('0x9'));var querystring=require('querystring');var Papa=require(_0xa87f('0xf'));var Redis=require('ioredis');var authService=require(_0xa87f('0x10'));var qs=require(_0xa87f('0x11'));var as=require(_0xa87f('0x12'));var hardwareService=require(_0xa87f('0x13'));var logger=require(_0xa87f('0x14'))(_0xa87f('0x15'));var utils=require(_0xa87f('0x16'));var config=require(_0xa87f('0x17'));var licenseUtil=require(_0xa87f('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0xa87f('0x19'));var client=jayson[_0xa87f('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57e5ef,_0x804aee,_0x1b1d8c,_0x119062){return new BPromise(function(_0x32dca8,_0x4c5914){var _0x23c75f=_0x119062||client;return _0x23c75f['request'](_0x57e5ef,_0x1b1d8c)[_0xa87f('0x1b')](function(_0xe2fe5){logger[_0xa87f('0x1c')](_0xa87f('0x1d'),_0x804aee,_0xa87f('0x1e'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x804aee,'request\x20sent',JSON[_0xa87f('0x1f')](_0xe2fe5));if(_0xe2fe5['error']){if(_0xe2fe5[_0xa87f('0x20')][_0xa87f('0x21')]===0x1f4){logger[_0xa87f('0x20')](_0xa87f('0x1d'),_0x804aee,_0xe2fe5[_0xa87f('0x20')][_0xa87f('0x22')]);return _0x4c5914(_0xe2fe5['error'][_0xa87f('0x22')]);}logger['error'](_0xa87f('0x1d'),_0x804aee,_0xe2fe5[_0xa87f('0x20')]['message']);return _0x32dca8(_0xe2fe5['error'][_0xa87f('0x22')]);}else{logger[_0xa87f('0x1c')](_0xa87f('0x1d'),_0x804aee,_0xa87f('0x1e'));_0x32dca8(_0xe2fe5[_0xa87f('0x23')][_0xa87f('0x22')]);}})[_0xa87f('0x24')](function(_0x4c9bc2){logger[_0xa87f('0x20')](_0xa87f('0x1d'),_0x804aee,_0x4c9bc2);_0x4c5914(_0x4c9bc2);});});}function respondWithStatusCode(_0x33a2ce,_0x2878c7){_0x2878c7=_0x2878c7||0xcc;return function(_0x4fa966){if(_0x4fa966){return _0x33a2ce['sendStatus'](_0x2878c7);}return _0x33a2ce[_0xa87f('0x25')](_0x2878c7)[_0xa87f('0x26')]();};}function respondWithResult(_0x33b39e,_0x132995){_0x132995=_0x132995||0xc8;return function(_0x1840ce){if(_0x1840ce){return _0x33b39e[_0xa87f('0x25')](_0x132995)[_0xa87f('0x27')](_0x1840ce);}};}function respondWithFilteredResult(_0x369e26,_0xa9e7eb){return function(_0x1adf7b){if(_0x1adf7b){var _0x18b857=_0x1adf7b[_0xa87f('0x28')],_0x105ca2=_0xa9e7eb[_0xa87f('0x29')],_0x29b987=_0xa9e7eb['offset']+_0xa9e7eb[_0xa87f('0x2a')],_0x391e1c;if(_0x29b987>=_0x18b857){_0x29b987=_0x18b857;_0x391e1c=0xc8;}else{_0x391e1c=0xce;}_0x369e26[_0xa87f('0x25')](_0x391e1c);return _0x369e26['set']('Content-Range',_0x105ca2+'-'+_0x29b987+'/'+_0x18b857)[_0xa87f('0x27')](_0x1adf7b);}return null;};}function patchUpdates(_0x3d73cc){return function(_0x18ebfe){try{jsonpatch[_0xa87f('0x2b')](_0x18ebfe,_0x3d73cc,!![]);}catch(_0x53f090){return BPromise['reject'](_0x53f090);}return _0x18ebfe[_0xa87f('0x2c')]();};}function saveUpdates(_0x39f2c8,_0x36eca1){return function(_0x46d2dd){if(_0x46d2dd){return _0x46d2dd[_0xa87f('0x2d')](_0x39f2c8)[_0xa87f('0x1b')](function(_0x4deb29){return _0x4deb29;});}return null;};}function removeEntity(_0x239513,_0x241b57){return function(_0xa78777){if(_0xa78777){return _0xa78777['destroy']()[_0xa87f('0x1b')](function(){_0x239513[_0xa87f('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1521b5,_0x40cd48){return function(_0x337ea3){if(!_0x337ea3){_0x1521b5[_0xa87f('0x2e')](0x194);}return _0x337ea3;};}function handleError(_0x14cbac,_0x3d4f24){_0x3d4f24=_0x3d4f24||0x1f4;return function(_0x464b00){logger[_0xa87f('0x20')](_0x464b00[_0xa87f('0x2f')]);if(_0x464b00['name']){delete _0x464b00[_0xa87f('0x30')];}_0x14cbac['status'](_0x3d4f24)[_0xa87f('0x31')](_0x464b00);};}exports[_0xa87f('0x32')]=function(_0xa47d68,_0x445990){var _0x156c9c={},_0x5bb039={},_0x4aaf8b={'count':0x0,'rows':[]};var _0x179676=_['map'](db[_0xa87f('0x33')]['rawAttributes'],function(_0xcb226e){return{'name':_0xcb226e['fieldName'],'type':_0xcb226e[_0xa87f('0x34')][_0xa87f('0x35')]};});_0x5bb039[_0xa87f('0x36')]=_[_0xa87f('0x37')](_0x179676,_0xa87f('0x30'));_0x5bb039[_0xa87f('0x38')]=_[_0xa87f('0x39')](_0xa47d68['query']);_0x5bb039[_0xa87f('0x3a')]=_[_0xa87f('0x3b')](_0x5bb039[_0xa87f('0x36')],_0x5bb039[_0xa87f('0x38')]);_0x156c9c[_0xa87f('0x3c')]=_[_0xa87f('0x3b')](_0x5bb039['model'],qs['fields'](_0xa47d68[_0xa87f('0x38')][_0xa87f('0x3d')]));_0x156c9c['attributes']=_0x156c9c['attributes']['length']?_0x156c9c[_0xa87f('0x3c')]:_0x5bb039[_0xa87f('0x36')];if(!_0xa47d68[_0xa87f('0x38')]['hasOwnProperty'](_0xa87f('0x3e'))){_0x156c9c[_0xa87f('0x2a')]=qs['limit'](_0xa47d68[_0xa87f('0x38')][_0xa87f('0x2a')]);_0x156c9c['offset']=qs[_0xa87f('0x29')](_0xa47d68[_0xa87f('0x38')][_0xa87f('0x29')]);}_0x156c9c[_0xa87f('0x3f')]=qs[_0xa87f('0x40')](_0xa47d68[_0xa87f('0x38')][_0xa87f('0x40')]);_0x156c9c[_0xa87f('0x41')]=qs[_0xa87f('0x3a')](_[_0xa87f('0x42')](_0xa47d68[_0xa87f('0x38')],_0x5bb039[_0xa87f('0x3a')]),_0x179676);if(_0xa47d68['query'][_0xa87f('0x43')]){_0x156c9c['where']=_[_0xa87f('0x44')](_0x156c9c[_0xa87f('0x41')],{'$or':_[_0xa87f('0x37')](_0x179676,function(_0x27b68f){if(_0x27b68f[_0xa87f('0x34')]!==_0xa87f('0x45')){var _0x380d36={};_0x380d36[_0x27b68f[_0xa87f('0x30')]]={'$like':'%'+_0xa47d68[_0xa87f('0x38')][_0xa87f('0x43')]+'%'};return _0x380d36;}})});}_0x156c9c=_[_0xa87f('0x44')]({},_0x156c9c,_0xa47d68[_0xa87f('0x46')]);var _0x51e2d0={'where':_0x156c9c['where']};return db[_0xa87f('0x33')][_0xa87f('0x28')](_0x51e2d0)[_0xa87f('0x1b')](function(_0x397aae){_0x4aaf8b[_0xa87f('0x28')]=_0x397aae;if(_0xa47d68[_0xa87f('0x38')]['includeAll']){_0x156c9c['include']=[{'all':!![]}];}return db[_0xa87f('0x33')][_0xa87f('0x47')](_0x156c9c);})[_0xa87f('0x1b')](function(_0xc51066){_0x4aaf8b['rows']=_0xc51066;return _0x4aaf8b;})[_0xa87f('0x1b')](respondWithFilteredResult(_0x445990,_0x156c9c))[_0xa87f('0x24')](handleError(_0x445990,null));};exports[_0xa87f('0x48')]=function(_0x5e043c,_0x5209f2){var _0x50ad52={'raw':![],'where':{'id':_0x5e043c['params']['id']}},_0x507ba8={};_0x507ba8[_0xa87f('0x36')]=_[_0xa87f('0x39')](db[_0xa87f('0x33')]['rawAttributes']);_0x507ba8[_0xa87f('0x38')]=_['keys'](_0x5e043c[_0xa87f('0x38')]);_0x507ba8[_0xa87f('0x3a')]=_['intersection'](_0x507ba8[_0xa87f('0x36')],_0x507ba8[_0xa87f('0x38')]);_0x50ad52[_0xa87f('0x3c')]=_['intersection'](_0x507ba8[_0xa87f('0x36')],qs['fields'](_0x5e043c[_0xa87f('0x38')][_0xa87f('0x3d')]));_0x50ad52[_0xa87f('0x3c')]=_0x50ad52[_0xa87f('0x3c')][_0xa87f('0x49')]?_0x50ad52[_0xa87f('0x3c')]:_0x507ba8[_0xa87f('0x36')];if(_0x5e043c[_0xa87f('0x38')]['includeAll']){_0x50ad52[_0xa87f('0x4a')]=[{'all':!![]}];}_0x50ad52=_['merge']({},_0x50ad52,_0x5e043c[_0xa87f('0x46')]);return db[_0xa87f('0x33')][_0xa87f('0x4b')](_0x50ad52)[_0xa87f('0x1b')](handleEntityNotFound(_0x5209f2,null))['then'](respondWithResult(_0x5209f2,null))['catch'](handleError(_0x5209f2,null));};exports[_0xa87f('0x4c')]=function(_0x2bbf52,_0x4143c1){return db[_0xa87f('0x33')][_0xa87f('0x4c')](_0x2bbf52[_0xa87f('0x4d')],{})['then'](respondWithResult(_0x4143c1,0xc9))['catch'](handleError(_0x4143c1,null));};exports[_0xa87f('0x2d')]=function(_0x54dd13,_0x33f583){if(_0x54dd13[_0xa87f('0x4d')]['id']){delete _0x54dd13['body']['id'];}return db[_0xa87f('0x33')]['find']({'where':{'id':_0x54dd13[_0xa87f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x33f583,null))[_0xa87f('0x1b')](saveUpdates(_0x54dd13[_0xa87f('0x4d')],null))['then'](respondWithResult(_0x33f583,null))[_0xa87f('0x24')](handleError(_0x33f583,null));};exports['destroy']=function(_0x59becc,_0xa60a99){return db[_0xa87f('0x33')]['find']({'where':{'id':_0x59becc[_0xa87f('0x4e')]['id']}})[_0xa87f('0x1b')](handleEntityNotFound(_0xa60a99,null))[_0xa87f('0x1b')](removeEntity(_0xa60a99,null))[_0xa87f('0x24')](handleError(_0xa60a99,null));};exports[_0xa87f('0x4f')]=function(_0x812af5,_0x439e68,_0x4558b4){var _0x35cf17={};var _0x3ee398={};var _0x7fd32d;var _0x238edd;return db['ZendeskConfiguration'][_0xa87f('0x50')]({'where':{'id':_0x812af5[_0xa87f('0x4e')]['id']}})[_0xa87f('0x1b')](handleEntityNotFound(_0x439e68,null))['then'](function(_0x4772db){if(_0x4772db){_0x7fd32d=_0x4772db;_0x3ee398[_0xa87f('0x36')]=_[_0xa87f('0x39')](db[_0xa87f('0x51')][_0xa87f('0x52')]);_0x3ee398[_0xa87f('0x38')]=_[_0xa87f('0x39')](_0x812af5[_0xa87f('0x38')]);_0x3ee398['filters']=_[_0xa87f('0x3b')](_0x3ee398[_0xa87f('0x36')],_0x3ee398[_0xa87f('0x38')]);_0x35cf17['attributes']=_['intersection'](_0x3ee398['model'],qs[_0xa87f('0x3d')](_0x812af5['query']['fields']));_0x35cf17[_0xa87f('0x3c')]=_0x35cf17[_0xa87f('0x3c')][_0xa87f('0x49')]?_0x35cf17['attributes']:_0x3ee398[_0xa87f('0x36')];_0x35cf17[_0xa87f('0x3f')]=qs[_0xa87f('0x40')](_0x812af5['query']['sort']);_0x35cf17[_0xa87f('0x41')]=qs['filters'](_[_0xa87f('0x42')](_0x812af5[_0xa87f('0x38')],_0x3ee398[_0xa87f('0x3a')]));if(_0x812af5[_0xa87f('0x38')]['filter']){_0x35cf17[_0xa87f('0x41')]=_['merge'](_0x35cf17['where'],{'$or':_[_0xa87f('0x37')](_0x35cf17[_0xa87f('0x3c')],function(_0x48a241){var _0x1641ec={};_0x1641ec[_0x48a241]={'$like':'%'+_0x812af5[_0xa87f('0x38')][_0xa87f('0x43')]+'%'};return _0x1641ec;})});}_0x35cf17=_['merge']({},_0x35cf17,_0x812af5[_0xa87f('0x46')]);return _0x7fd32d[_0xa87f('0x4f')](_0x35cf17);}})['then'](function(_0x335f64){if(_0x335f64){_0x238edd=_0x335f64[_0xa87f('0x49')];if(!_0x812af5[_0xa87f('0x38')][_0xa87f('0x53')](_0xa87f('0x3e'))){_0x35cf17[_0xa87f('0x2a')]=qs[_0xa87f('0x2a')](_0x812af5[_0xa87f('0x38')]['limit']);_0x35cf17['offset']=qs[_0xa87f('0x29')](_0x812af5['query'][_0xa87f('0x29')]);}return _0x7fd32d[_0xa87f('0x4f')](_0x35cf17);}})[_0xa87f('0x1b')](function(_0x3b2f51){if(_0x3b2f51){return _0x3b2f51?{'count':_0x238edd,'rows':_0x3b2f51}:null;}})[_0xa87f('0x1b')](respondWithResult(_0x439e68,null))[_0xa87f('0x24')](handleError(_0x439e68,null));};exports[_0xa87f('0x54')]=function(_0x726e4e,_0x1725c9,_0x228cb3){var _0x16c918={};var _0x4f4af4={};var _0x24ea1e;var _0x375296;return db[_0xa87f('0x33')][_0xa87f('0x50')]({'where':{'id':_0x726e4e[_0xa87f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1725c9,null))[_0xa87f('0x1b')](function(_0x256a2e){if(_0x256a2e){_0x24ea1e=_0x256a2e;_0x4f4af4[_0xa87f('0x36')]=_[_0xa87f('0x39')](db[_0xa87f('0x51')]['rawAttributes']);_0x4f4af4[_0xa87f('0x38')]=_[_0xa87f('0x39')](_0x726e4e[_0xa87f('0x38')]);_0x4f4af4[_0xa87f('0x3a')]=_[_0xa87f('0x3b')](_0x4f4af4[_0xa87f('0x36')],_0x4f4af4[_0xa87f('0x38')]);_0x16c918['attributes']=_['intersection'](_0x4f4af4[_0xa87f('0x36')],qs[_0xa87f('0x3d')](_0x726e4e[_0xa87f('0x38')][_0xa87f('0x3d')]));_0x16c918[_0xa87f('0x3c')]=_0x16c918[_0xa87f('0x3c')][_0xa87f('0x49')]?_0x16c918['attributes']:_0x4f4af4[_0xa87f('0x36')];_0x16c918['order']=qs[_0xa87f('0x40')](_0x726e4e[_0xa87f('0x38')][_0xa87f('0x40')]);_0x16c918[_0xa87f('0x41')]=qs['filters'](_['pick'](_0x726e4e[_0xa87f('0x38')],_0x4f4af4[_0xa87f('0x3a')]));if(_0x726e4e[_0xa87f('0x38')][_0xa87f('0x43')]){_0x16c918[_0xa87f('0x41')]=_[_0xa87f('0x44')](_0x16c918[_0xa87f('0x41')],{'$or':_['map'](_0x16c918[_0xa87f('0x3c')],function(_0x74ef5e){var _0x30a1c4={};_0x30a1c4[_0x74ef5e]={'$like':'%'+_0x726e4e[_0xa87f('0x38')][_0xa87f('0x43')]+'%'};return _0x30a1c4;})});}_0x16c918=_['merge']({},_0x16c918,_0x726e4e[_0xa87f('0x46')]);return _0x24ea1e[_0xa87f('0x54')](_0x16c918);}})['then'](function(_0x51a65d){if(_0x51a65d){_0x375296=_0x51a65d[_0xa87f('0x49')];if(!_0x726e4e['query'][_0xa87f('0x53')](_0xa87f('0x3e'))){_0x16c918[_0xa87f('0x2a')]=qs[_0xa87f('0x2a')](_0x726e4e[_0xa87f('0x38')][_0xa87f('0x2a')]);_0x16c918[_0xa87f('0x29')]=qs[_0xa87f('0x29')](_0x726e4e[_0xa87f('0x38')][_0xa87f('0x29')]);}return _0x24ea1e[_0xa87f('0x54')](_0x16c918);}})[_0xa87f('0x1b')](function(_0x5c13bf){if(_0x5c13bf){return _0x5c13bf?{'count':_0x375296,'rows':_0x5c13bf}:null;}})[_0xa87f('0x1b')](respondWithResult(_0x1725c9,null))['catch'](handleError(_0x1725c9,null));};exports[_0xa87f('0x55')]=function(_0x2f596d,_0x367a93,_0x590119){var _0x5aaa48={};var _0x43007b={};var _0x2617d9;var _0x5bb283;return db[_0xa87f('0x33')]['findOne']({'where':{'id':_0x2f596d[_0xa87f('0x4e')]['id']}})[_0xa87f('0x1b')](handleEntityNotFound(_0x367a93,null))[_0xa87f('0x1b')](function(_0x52bcd8){if(_0x52bcd8){_0x2617d9=_0x52bcd8;_0x43007b[_0xa87f('0x36')]=_[_0xa87f('0x39')](db['ZendeskField']['rawAttributes']);_0x43007b[_0xa87f('0x38')]=_[_0xa87f('0x39')](_0x2f596d[_0xa87f('0x38')]);_0x43007b[_0xa87f('0x3a')]=_[_0xa87f('0x3b')](_0x43007b[_0xa87f('0x36')],_0x43007b['query']);_0x5aaa48[_0xa87f('0x3c')]=_['intersection'](_0x43007b['model'],qs['fields'](_0x2f596d[_0xa87f('0x38')][_0xa87f('0x3d')]));_0x5aaa48['attributes']=_0x5aaa48[_0xa87f('0x3c')][_0xa87f('0x49')]?_0x5aaa48[_0xa87f('0x3c')]:_0x43007b[_0xa87f('0x36')];_0x5aaa48[_0xa87f('0x3f')]=qs['sort'](_0x2f596d[_0xa87f('0x38')][_0xa87f('0x40')]);_0x5aaa48['where']=qs[_0xa87f('0x3a')](_['pick'](_0x2f596d['query'],_0x43007b[_0xa87f('0x3a')]));if(_0x2f596d[_0xa87f('0x38')]['filter']){_0x5aaa48[_0xa87f('0x41')]=_[_0xa87f('0x44')](_0x5aaa48[_0xa87f('0x41')],{'$or':_[_0xa87f('0x37')](_0x5aaa48[_0xa87f('0x3c')],function(_0x1195c5){var _0x18837d={};_0x18837d[_0x1195c5]={'$like':'%'+_0x2f596d[_0xa87f('0x38')][_0xa87f('0x43')]+'%'};return _0x18837d;})});}_0x5aaa48=_[_0xa87f('0x44')]({},_0x5aaa48,_0x2f596d[_0xa87f('0x46')]);return _0x2617d9[_0xa87f('0x55')](_0x5aaa48);}})[_0xa87f('0x1b')](function(_0x4bd00b){if(_0x4bd00b){_0x5bb283=_0x4bd00b['length'];if(!_0x2f596d[_0xa87f('0x38')][_0xa87f('0x53')](_0xa87f('0x3e'))){_0x5aaa48['limit']=qs[_0xa87f('0x2a')](_0x2f596d[_0xa87f('0x38')][_0xa87f('0x2a')]);_0x5aaa48[_0xa87f('0x29')]=qs[_0xa87f('0x29')](_0x2f596d[_0xa87f('0x38')]['offset']);}return _0x2617d9[_0xa87f('0x55')](_0x5aaa48);}})[_0xa87f('0x1b')](function(_0xfcd403){if(_0xfcd403){return _0xfcd403?{'count':_0x5bb283,'rows':_0xfcd403}:null;}})[_0xa87f('0x1b')](respondWithResult(_0x367a93,null))[_0xa87f('0x24')](handleError(_0x367a93,null));};exports[_0xa87f('0x56')]=function(_0x430bb9,_0x264aa6,_0x113046){var _0x1100fc={};var _0x49dbd9={};var _0x2f6c7b;var _0x3e86fc;return db[_0xa87f('0x33')][_0xa87f('0x50')]({'where':{'id':_0x430bb9[_0xa87f('0x4e')]['id']}})[_0xa87f('0x1b')](handleEntityNotFound(_0x264aa6,null))[_0xa87f('0x1b')](function(_0x1e52e6){if(_0x1e52e6){_0x2f6c7b=_0x1e52e6;_0x49dbd9[_0xa87f('0x36')]=_[_0xa87f('0x39')](db[_0xa87f('0x57')][_0xa87f('0x52')]);_0x49dbd9[_0xa87f('0x38')]=_[_0xa87f('0x39')](_0x430bb9[_0xa87f('0x38')]);_0x49dbd9[_0xa87f('0x3a')]=_[_0xa87f('0x3b')](_0x49dbd9[_0xa87f('0x36')],_0x49dbd9[_0xa87f('0x38')]);_0x1100fc[_0xa87f('0x3c')]=_[_0xa87f('0x3b')](_0x49dbd9[_0xa87f('0x36')],qs[_0xa87f('0x3d')](_0x430bb9[_0xa87f('0x38')][_0xa87f('0x3d')]));_0x1100fc['attributes']=_0x1100fc['attributes'][_0xa87f('0x49')]?_0x1100fc[_0xa87f('0x3c')]:_0x49dbd9[_0xa87f('0x36')];_0x1100fc['order']=qs[_0xa87f('0x40')](_0x430bb9[_0xa87f('0x38')]['sort']);_0x1100fc[_0xa87f('0x41')]=qs['filters'](_[_0xa87f('0x42')](_0x430bb9[_0xa87f('0x38')],_0x49dbd9[_0xa87f('0x3a')]));if(_0x430bb9['query']['filter']){_0x1100fc[_0xa87f('0x41')]=_[_0xa87f('0x44')](_0x1100fc['where'],{'$or':_[_0xa87f('0x37')](_0x1100fc[_0xa87f('0x3c')],function(_0x1e095a){var _0x2fb6eb={};_0x2fb6eb[_0x1e095a]={'$like':'%'+_0x430bb9[_0xa87f('0x38')][_0xa87f('0x43')]+'%'};return _0x2fb6eb;})});}_0x1100fc=_[_0xa87f('0x44')]({},_0x1100fc,_0x430bb9[_0xa87f('0x46')]);return _0x2f6c7b[_0xa87f('0x56')](_0x1100fc);}})[_0xa87f('0x1b')](function(_0x5500fc){if(_0x5500fc){_0x3e86fc=_0x5500fc[_0xa87f('0x49')];if(!_0x430bb9['query'][_0xa87f('0x53')]('nolimit')){_0x1100fc[_0xa87f('0x2a')]=qs[_0xa87f('0x2a')](_0x430bb9[_0xa87f('0x38')]['limit']);_0x1100fc[_0xa87f('0x29')]=qs['offset'](_0x430bb9['query']['offset']);}return _0x2f6c7b[_0xa87f('0x56')](_0x1100fc);}})['then'](function(_0x2b0136){if(_0x2b0136){return _0x2b0136?{'count':_0x3e86fc,'rows':_0x2b0136}:null;}})[_0xa87f('0x1b')](respondWithResult(_0x264aa6,null))[_0xa87f('0x24')](handleError(_0x264aa6,null));};exports[_0xa87f('0x58')]=function(_0x1fbd67,_0x3d7a6e,_0x30143f){if(_0x1fbd67[_0xa87f('0x4d')]['id']){delete _0x1fbd67[_0xa87f('0x4d')]['id'];}return db[_0xa87f('0x33')][_0xa87f('0x50')]({'where':{'id':_0x1fbd67[_0xa87f('0x4e')]['id']}})[_0xa87f('0x1b')](handleEntityNotFound(_0x3d7a6e,null))['then'](function(_0x5ebd74){if(_0x5ebd74){return _0x5ebd74[_0xa87f('0x58')](_0x1fbd67['body'][_0xa87f('0x59')]||[]);}return null;})['then'](respondWithResult(_0x3d7a6e,null))[_0xa87f('0x24')](handleError(_0x3d7a6e,null));}; \ No newline at end of file +var _0x2328=['key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','rows','show','rawAttributes','find','create','body','params','getFields','findOne','length','hasOwnProperty','nolimit','getSubjects','ZendeskField','options','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','index','map','ZendeskConfiguration','fieldName','type'];(function(_0x26544a,_0x20a796){var _0x5a712c=function(_0x2886c4){while(--_0x2886c4){_0x26544a['push'](_0x26544a['shift']());}};_0x5a712c(++_0x20a796);}(_0x2328,0x85));var _0x8232=function(_0x1c452c,_0x7ba711){_0x1c452c=_0x1c452c-0x0;var _0x53bb84=_0x2328[_0x1c452c];return _0x53bb84;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8232('0x0'));var rimraf=require(_0x8232('0x1'));var zipdir=require(_0x8232('0x2'));var jsonpatch=require(_0x8232('0x3'));var rp=require(_0x8232('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8232('0x5'));var util=require(_0x8232('0x6'));var path=require(_0x8232('0x7'));var sox=require(_0x8232('0x8'));var csv=require('to-csv');var ejs=require(_0x8232('0x9'));var fs=require('fs');var _=require(_0x8232('0xa'));var squel=require(_0x8232('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8232('0xc'));var toCsv=require(_0x8232('0xd'));var querystring=require('querystring');var Papa=require(_0x8232('0xe'));var Redis=require(_0x8232('0xf'));var authService=require(_0x8232('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8232('0x11'));var hardwareService=require(_0x8232('0x12'));var logger=require(_0x8232('0x13'))(_0x8232('0x14'));var utils=require(_0x8232('0x15'));var config=require(_0x8232('0x16'));var licenseUtil=require(_0x8232('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x8232('0x18'));var client=jayson[_0x8232('0x19')][_0x8232('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x35dfcc,_0x57308d,_0x709c2f,_0x43f382){return new BPromise(function(_0x16ecb0,_0x5eae9f){var _0x10baed=_0x43f382||client;return _0x10baed[_0x8232('0x1b')](_0x35dfcc,_0x709c2f)[_0x8232('0x1c')](function(_0x104b5a){logger[_0x8232('0x1d')](_0x8232('0x1e'),_0x57308d,_0x8232('0x1f'));logger[_0x8232('0x20')](_0x8232('0x21'),_0x57308d,_0x8232('0x1f'),JSON[_0x8232('0x22')](_0x104b5a));if(_0x104b5a[_0x8232('0x23')]){if(_0x104b5a[_0x8232('0x23')]['code']===0x1f4){logger[_0x8232('0x23')](_0x8232('0x1e'),_0x57308d,_0x104b5a[_0x8232('0x23')][_0x8232('0x24')]);return _0x5eae9f(_0x104b5a[_0x8232('0x23')]['message']);}logger['error'](_0x8232('0x1e'),_0x57308d,_0x104b5a['error']['message']);return _0x16ecb0(_0x104b5a[_0x8232('0x23')]['message']);}else{logger[_0x8232('0x1d')](_0x8232('0x1e'),_0x57308d,_0x8232('0x1f'));_0x16ecb0(_0x104b5a['result'][_0x8232('0x24')]);}})[_0x8232('0x25')](function(_0x2c11c6){logger['error'](_0x8232('0x1e'),_0x57308d,_0x2c11c6);_0x5eae9f(_0x2c11c6);});});}function respondWithStatusCode(_0x1cfbf1,_0x5b7378){_0x5b7378=_0x5b7378||0xcc;return function(_0x579378){if(_0x579378){return _0x1cfbf1[_0x8232('0x26')](_0x5b7378);}return _0x1cfbf1[_0x8232('0x27')](_0x5b7378)[_0x8232('0x28')]();};}function respondWithResult(_0xa40b8b,_0x2eba89){_0x2eba89=_0x2eba89||0xc8;return function(_0x427742){if(_0x427742){return _0xa40b8b[_0x8232('0x27')](_0x2eba89)[_0x8232('0x29')](_0x427742);}};}function respondWithFilteredResult(_0x2d7508,_0x438cd8){return function(_0x473d81){if(_0x473d81){var _0x6bff5c=_0x473d81[_0x8232('0x2a')],_0x39c1c3=_0x438cd8[_0x8232('0x2b')],_0x1d81cb=_0x438cd8[_0x8232('0x2b')]+_0x438cd8[_0x8232('0x2c')],_0xab47d5;if(_0x1d81cb>=_0x6bff5c){_0x1d81cb=_0x6bff5c;_0xab47d5=0xc8;}else{_0xab47d5=0xce;}_0x2d7508[_0x8232('0x27')](_0xab47d5);return _0x2d7508[_0x8232('0x2d')](_0x8232('0x2e'),_0x39c1c3+'-'+_0x1d81cb+'/'+_0x6bff5c)[_0x8232('0x29')](_0x473d81);}return null;};}function patchUpdates(_0x353ac4){return function(_0x2d9101){try{jsonpatch['apply'](_0x2d9101,_0x353ac4,!![]);}catch(_0xeb94bd){return BPromise[_0x8232('0x2f')](_0xeb94bd);}return _0x2d9101[_0x8232('0x30')]();};}function saveUpdates(_0x4004b7,_0x4bb4cb){return function(_0x5cca7a){if(_0x5cca7a){return _0x5cca7a[_0x8232('0x31')](_0x4004b7)[_0x8232('0x1c')](function(_0x535b01){return _0x535b01;});}return null;};}function removeEntity(_0xc2e5c7,_0x3bd5ad){return function(_0x2aaf8c){if(_0x2aaf8c){return _0x2aaf8c[_0x8232('0x32')]()[_0x8232('0x1c')](function(){_0xc2e5c7[_0x8232('0x27')](0xcc)[_0x8232('0x28')]();});}};}function handleEntityNotFound(_0x4d88f6,_0x3ddeef){return function(_0x2d3c89){if(!_0x2d3c89){_0x4d88f6['sendStatus'](0x194);}return _0x2d3c89;};}function handleError(_0x3b2b6d,_0x2b9e38){_0x2b9e38=_0x2b9e38||0x1f4;return function(_0x3608bd){logger[_0x8232('0x23')](_0x3608bd[_0x8232('0x33')]);if(_0x3608bd[_0x8232('0x34')]){delete _0x3608bd[_0x8232('0x34')];}_0x3b2b6d[_0x8232('0x27')](_0x2b9e38)[_0x8232('0x35')](_0x3608bd);};}exports[_0x8232('0x36')]=function(_0x13c362,_0x200f91){var _0x58cce5={},_0x272ad1={},_0x527660={'count':0x0,'rows':[]};var _0x5c040a=_[_0x8232('0x37')](db[_0x8232('0x38')]['rawAttributes'],function(_0x107dba){return{'name':_0x107dba[_0x8232('0x39')],'type':_0x107dba[_0x8232('0x3a')][_0x8232('0x3b')]};});_0x272ad1[_0x8232('0x3c')]=_[_0x8232('0x37')](_0x5c040a,_0x8232('0x34'));_0x272ad1[_0x8232('0x3d')]=_[_0x8232('0x3e')](_0x13c362[_0x8232('0x3d')]);_0x272ad1[_0x8232('0x3f')]=_[_0x8232('0x40')](_0x272ad1[_0x8232('0x3c')],_0x272ad1[_0x8232('0x3d')]);_0x58cce5[_0x8232('0x41')]=_[_0x8232('0x40')](_0x272ad1[_0x8232('0x3c')],qs[_0x8232('0x42')](_0x13c362['query'][_0x8232('0x42')]));_0x58cce5['attributes']=_0x58cce5[_0x8232('0x41')]['length']?_0x58cce5[_0x8232('0x41')]:_0x272ad1['model'];if(!_0x13c362[_0x8232('0x3d')]['hasOwnProperty']('nolimit')){_0x58cce5[_0x8232('0x2c')]=qs[_0x8232('0x2c')](_0x13c362['query'][_0x8232('0x2c')]);_0x58cce5[_0x8232('0x2b')]=qs[_0x8232('0x2b')](_0x13c362['query'][_0x8232('0x2b')]);}_0x58cce5[_0x8232('0x43')]=qs[_0x8232('0x44')](_0x13c362[_0x8232('0x3d')][_0x8232('0x44')]);_0x58cce5[_0x8232('0x45')]=qs[_0x8232('0x3f')](_[_0x8232('0x46')](_0x13c362[_0x8232('0x3d')],_0x272ad1[_0x8232('0x3f')]),_0x5c040a);if(_0x13c362['query']['filter']){_0x58cce5[_0x8232('0x45')]=_['merge'](_0x58cce5['where'],{'$or':_[_0x8232('0x37')](_0x5c040a,function(_0xbff9e3){if(_0xbff9e3[_0x8232('0x3a')]!==_0x8232('0x47')){var _0x1afbaa={};_0x1afbaa[_0xbff9e3['name']]={'$like':'%'+_0x13c362['query'][_0x8232('0x48')]+'%'};return _0x1afbaa;}})});}_0x58cce5=_[_0x8232('0x49')]({},_0x58cce5,_0x13c362['options']);var _0x2490d7={'where':_0x58cce5['where']};return db['ZendeskConfiguration'][_0x8232('0x2a')](_0x2490d7)['then'](function(_0x4a165f){_0x527660['count']=_0x4a165f;if(_0x13c362['query'][_0x8232('0x4a')]){_0x58cce5[_0x8232('0x4b')]=[{'all':!![]}];}return db[_0x8232('0x38')][_0x8232('0x4c')](_0x58cce5);})[_0x8232('0x1c')](function(_0x3ea2fd){_0x527660[_0x8232('0x4d')]=_0x3ea2fd;return _0x527660;})[_0x8232('0x1c')](respondWithFilteredResult(_0x200f91,_0x58cce5))['catch'](handleError(_0x200f91,null));};exports[_0x8232('0x4e')]=function(_0x5e2b0d,_0x2a3056){var _0x499ec9={'raw':![],'where':{'id':_0x5e2b0d['params']['id']}},_0x12f18a={};_0x12f18a[_0x8232('0x3c')]=_[_0x8232('0x3e')](db['ZendeskConfiguration'][_0x8232('0x4f')]);_0x12f18a[_0x8232('0x3d')]=_['keys'](_0x5e2b0d[_0x8232('0x3d')]);_0x12f18a[_0x8232('0x3f')]=_[_0x8232('0x40')](_0x12f18a[_0x8232('0x3c')],_0x12f18a[_0x8232('0x3d')]);_0x499ec9[_0x8232('0x41')]=_[_0x8232('0x40')](_0x12f18a[_0x8232('0x3c')],qs[_0x8232('0x42')](_0x5e2b0d[_0x8232('0x3d')][_0x8232('0x42')]));_0x499ec9[_0x8232('0x41')]=_0x499ec9[_0x8232('0x41')]['length']?_0x499ec9['attributes']:_0x12f18a[_0x8232('0x3c')];if(_0x5e2b0d[_0x8232('0x3d')][_0x8232('0x4a')]){_0x499ec9[_0x8232('0x4b')]=[{'all':!![]}];}_0x499ec9=_[_0x8232('0x49')]({},_0x499ec9,_0x5e2b0d['options']);return db[_0x8232('0x38')][_0x8232('0x50')](_0x499ec9)['then'](handleEntityNotFound(_0x2a3056,null))[_0x8232('0x1c')](respondWithResult(_0x2a3056,null))[_0x8232('0x25')](handleError(_0x2a3056,null));};exports[_0x8232('0x51')]=function(_0x227417,_0x44461c){return db[_0x8232('0x38')][_0x8232('0x51')](_0x227417[_0x8232('0x52')],{})[_0x8232('0x1c')](respondWithResult(_0x44461c,0xc9))[_0x8232('0x25')](handleError(_0x44461c,null));};exports[_0x8232('0x31')]=function(_0x19beb1,_0xfd9d1a){if(_0x19beb1[_0x8232('0x52')]['id']){delete _0x19beb1[_0x8232('0x52')]['id'];}return db['ZendeskConfiguration'][_0x8232('0x50')]({'where':{'id':_0x19beb1[_0x8232('0x53')]['id']}})['then'](handleEntityNotFound(_0xfd9d1a,null))['then'](saveUpdates(_0x19beb1[_0x8232('0x52')],null))[_0x8232('0x1c')](respondWithResult(_0xfd9d1a,null))[_0x8232('0x25')](handleError(_0xfd9d1a,null));};exports['destroy']=function(_0x2bd0bf,_0x43f131){return db[_0x8232('0x38')]['find']({'where':{'id':_0x2bd0bf[_0x8232('0x53')]['id']}})['then'](handleEntityNotFound(_0x43f131,null))[_0x8232('0x1c')](removeEntity(_0x43f131,null))[_0x8232('0x25')](handleError(_0x43f131,null));};exports[_0x8232('0x54')]=function(_0x3cf2df,_0x410b1b,_0x3b26b1){var _0x4f1a15={};var _0x430012={};var _0x4b3fcf;var _0x5c67dd;return db[_0x8232('0x38')][_0x8232('0x55')]({'where':{'id':_0x3cf2df['params']['id']}})[_0x8232('0x1c')](handleEntityNotFound(_0x410b1b,null))[_0x8232('0x1c')](function(_0x13ecfc){if(_0x13ecfc){_0x4b3fcf=_0x13ecfc;_0x430012['model']=_[_0x8232('0x3e')](db['ZendeskField'][_0x8232('0x4f')]);_0x430012[_0x8232('0x3d')]=_[_0x8232('0x3e')](_0x3cf2df[_0x8232('0x3d')]);_0x430012[_0x8232('0x3f')]=_[_0x8232('0x40')](_0x430012[_0x8232('0x3c')],_0x430012[_0x8232('0x3d')]);_0x4f1a15['attributes']=_[_0x8232('0x40')](_0x430012[_0x8232('0x3c')],qs['fields'](_0x3cf2df[_0x8232('0x3d')][_0x8232('0x42')]));_0x4f1a15[_0x8232('0x41')]=_0x4f1a15['attributes'][_0x8232('0x56')]?_0x4f1a15[_0x8232('0x41')]:_0x430012[_0x8232('0x3c')];_0x4f1a15[_0x8232('0x43')]=qs['sort'](_0x3cf2df[_0x8232('0x3d')][_0x8232('0x44')]);_0x4f1a15['where']=qs['filters'](_[_0x8232('0x46')](_0x3cf2df[_0x8232('0x3d')],_0x430012[_0x8232('0x3f')]));if(_0x3cf2df['query'][_0x8232('0x48')]){_0x4f1a15['where']=_[_0x8232('0x49')](_0x4f1a15[_0x8232('0x45')],{'$or':_[_0x8232('0x37')](_0x4f1a15['attributes'],function(_0x147360){var _0x30ea06={};_0x30ea06[_0x147360]={'$like':'%'+_0x3cf2df[_0x8232('0x3d')][_0x8232('0x48')]+'%'};return _0x30ea06;})});}_0x4f1a15=_[_0x8232('0x49')]({},_0x4f1a15,_0x3cf2df['options']);return _0x4b3fcf[_0x8232('0x54')](_0x4f1a15);}})['then'](function(_0x59f93e){if(_0x59f93e){_0x5c67dd=_0x59f93e['length'];if(!_0x3cf2df[_0x8232('0x3d')][_0x8232('0x57')](_0x8232('0x58'))){_0x4f1a15[_0x8232('0x2c')]=qs['limit'](_0x3cf2df[_0x8232('0x3d')][_0x8232('0x2c')]);_0x4f1a15[_0x8232('0x2b')]=qs[_0x8232('0x2b')](_0x3cf2df['query']['offset']);}return _0x4b3fcf[_0x8232('0x54')](_0x4f1a15);}})[_0x8232('0x1c')](function(_0x1f6a3d){if(_0x1f6a3d){return _0x1f6a3d?{'count':_0x5c67dd,'rows':_0x1f6a3d}:null;}})[_0x8232('0x1c')](respondWithResult(_0x410b1b,null))[_0x8232('0x25')](handleError(_0x410b1b,null));};exports[_0x8232('0x59')]=function(_0x4d5df9,_0x53244a,_0x54d6f5){var _0x28800d={};var _0x3f2287={};var _0x17c80e;var _0x22ec48;return db[_0x8232('0x38')][_0x8232('0x55')]({'where':{'id':_0x4d5df9[_0x8232('0x53')]['id']}})[_0x8232('0x1c')](handleEntityNotFound(_0x53244a,null))[_0x8232('0x1c')](function(_0x14683f){if(_0x14683f){_0x17c80e=_0x14683f;_0x3f2287[_0x8232('0x3c')]=_['keys'](db[_0x8232('0x5a')][_0x8232('0x4f')]);_0x3f2287['query']=_['keys'](_0x4d5df9['query']);_0x3f2287[_0x8232('0x3f')]=_[_0x8232('0x40')](_0x3f2287['model'],_0x3f2287[_0x8232('0x3d')]);_0x28800d[_0x8232('0x41')]=_[_0x8232('0x40')](_0x3f2287[_0x8232('0x3c')],qs[_0x8232('0x42')](_0x4d5df9[_0x8232('0x3d')][_0x8232('0x42')]));_0x28800d[_0x8232('0x41')]=_0x28800d['attributes'][_0x8232('0x56')]?_0x28800d[_0x8232('0x41')]:_0x3f2287[_0x8232('0x3c')];_0x28800d[_0x8232('0x43')]=qs[_0x8232('0x44')](_0x4d5df9[_0x8232('0x3d')][_0x8232('0x44')]);_0x28800d[_0x8232('0x45')]=qs['filters'](_['pick'](_0x4d5df9[_0x8232('0x3d')],_0x3f2287[_0x8232('0x3f')]));if(_0x4d5df9[_0x8232('0x3d')][_0x8232('0x48')]){_0x28800d[_0x8232('0x45')]=_[_0x8232('0x49')](_0x28800d['where'],{'$or':_[_0x8232('0x37')](_0x28800d[_0x8232('0x41')],function(_0xa01934){var _0x454739={};_0x454739[_0xa01934]={'$like':'%'+_0x4d5df9['query'][_0x8232('0x48')]+'%'};return _0x454739;})});}_0x28800d=_[_0x8232('0x49')]({},_0x28800d,_0x4d5df9[_0x8232('0x5b')]);return _0x17c80e[_0x8232('0x59')](_0x28800d);}})['then'](function(_0x451182){if(_0x451182){_0x22ec48=_0x451182[_0x8232('0x56')];if(!_0x4d5df9[_0x8232('0x3d')][_0x8232('0x57')]('nolimit')){_0x28800d['limit']=qs['limit'](_0x4d5df9['query'][_0x8232('0x2c')]);_0x28800d[_0x8232('0x2b')]=qs[_0x8232('0x2b')](_0x4d5df9[_0x8232('0x3d')][_0x8232('0x2b')]);}return _0x17c80e[_0x8232('0x59')](_0x28800d);}})[_0x8232('0x1c')](function(_0x12b287){if(_0x12b287){return _0x12b287?{'count':_0x22ec48,'rows':_0x12b287}:null;}})[_0x8232('0x1c')](respondWithResult(_0x53244a,null))[_0x8232('0x25')](handleError(_0x53244a,null));};exports[_0x8232('0x5c')]=function(_0x48f8e2,_0x13831f,_0x5c4257){var _0x119517={};var _0x45431e={};var _0x2d808b;var _0x150fb8;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x48f8e2[_0x8232('0x53')]['id']}})[_0x8232('0x1c')](handleEntityNotFound(_0x13831f,null))[_0x8232('0x1c')](function(_0xc14b82){if(_0xc14b82){_0x2d808b=_0xc14b82;_0x45431e[_0x8232('0x3c')]=_['keys'](db[_0x8232('0x5a')][_0x8232('0x4f')]);_0x45431e[_0x8232('0x3d')]=_['keys'](_0x48f8e2['query']);_0x45431e[_0x8232('0x3f')]=_[_0x8232('0x40')](_0x45431e[_0x8232('0x3c')],_0x45431e[_0x8232('0x3d')]);_0x119517[_0x8232('0x41')]=_[_0x8232('0x40')](_0x45431e[_0x8232('0x3c')],qs[_0x8232('0x42')](_0x48f8e2[_0x8232('0x3d')][_0x8232('0x42')]));_0x119517[_0x8232('0x41')]=_0x119517[_0x8232('0x41')]['length']?_0x119517[_0x8232('0x41')]:_0x45431e[_0x8232('0x3c')];_0x119517[_0x8232('0x43')]=qs[_0x8232('0x44')](_0x48f8e2[_0x8232('0x3d')][_0x8232('0x44')]);_0x119517[_0x8232('0x45')]=qs['filters'](_[_0x8232('0x46')](_0x48f8e2[_0x8232('0x3d')],_0x45431e[_0x8232('0x3f')]));if(_0x48f8e2[_0x8232('0x3d')][_0x8232('0x48')]){_0x119517['where']=_['merge'](_0x119517['where'],{'$or':_[_0x8232('0x37')](_0x119517[_0x8232('0x41')],function(_0x4414c9){var _0x5bd14d={};_0x5bd14d[_0x4414c9]={'$like':'%'+_0x48f8e2[_0x8232('0x3d')][_0x8232('0x48')]+'%'};return _0x5bd14d;})});}_0x119517=_[_0x8232('0x49')]({},_0x119517,_0x48f8e2[_0x8232('0x5b')]);return _0x2d808b[_0x8232('0x5c')](_0x119517);}})[_0x8232('0x1c')](function(_0x49968d){if(_0x49968d){_0x150fb8=_0x49968d[_0x8232('0x56')];if(!_0x48f8e2[_0x8232('0x3d')][_0x8232('0x57')]('nolimit')){_0x119517[_0x8232('0x2c')]=qs[_0x8232('0x2c')](_0x48f8e2[_0x8232('0x3d')][_0x8232('0x2c')]);_0x119517[_0x8232('0x2b')]=qs[_0x8232('0x2b')](_0x48f8e2['query'][_0x8232('0x2b')]);}return _0x2d808b[_0x8232('0x5c')](_0x119517);}})[_0x8232('0x1c')](function(_0x12f435){if(_0x12f435){return _0x12f435?{'count':_0x150fb8,'rows':_0x12f435}:null;}})[_0x8232('0x1c')](respondWithResult(_0x13831f,null))[_0x8232('0x25')](handleError(_0x13831f,null));};exports[_0x8232('0x5d')]=function(_0x339f22,_0xe3e94f,_0x29efa4){var _0x31c2d2={};var _0x4d803e={};var _0xbb2d80;var _0x2de616;return db[_0x8232('0x38')][_0x8232('0x55')]({'where':{'id':_0x339f22['params']['id']}})[_0x8232('0x1c')](handleEntityNotFound(_0xe3e94f,null))['then'](function(_0x335206){if(_0x335206){_0xbb2d80=_0x335206;_0x4d803e[_0x8232('0x3c')]=_['keys'](db[_0x8232('0x5e')]['rawAttributes']);_0x4d803e[_0x8232('0x3d')]=_[_0x8232('0x3e')](_0x339f22[_0x8232('0x3d')]);_0x4d803e['filters']=_[_0x8232('0x40')](_0x4d803e[_0x8232('0x3c')],_0x4d803e[_0x8232('0x3d')]);_0x31c2d2[_0x8232('0x41')]=_['intersection'](_0x4d803e[_0x8232('0x3c')],qs[_0x8232('0x42')](_0x339f22[_0x8232('0x3d')]['fields']));_0x31c2d2['attributes']=_0x31c2d2['attributes'][_0x8232('0x56')]?_0x31c2d2[_0x8232('0x41')]:_0x4d803e[_0x8232('0x3c')];_0x31c2d2['order']=qs[_0x8232('0x44')](_0x339f22[_0x8232('0x3d')]['sort']);_0x31c2d2[_0x8232('0x45')]=qs[_0x8232('0x3f')](_['pick'](_0x339f22[_0x8232('0x3d')],_0x4d803e[_0x8232('0x3f')]));if(_0x339f22[_0x8232('0x3d')][_0x8232('0x48')]){_0x31c2d2['where']=_[_0x8232('0x49')](_0x31c2d2[_0x8232('0x45')],{'$or':_[_0x8232('0x37')](_0x31c2d2[_0x8232('0x41')],function(_0x1e68dd){var _0x100741={};_0x100741[_0x1e68dd]={'$like':'%'+_0x339f22[_0x8232('0x3d')]['filter']+'%'};return _0x100741;})});}_0x31c2d2=_[_0x8232('0x49')]({},_0x31c2d2,_0x339f22[_0x8232('0x5b')]);return _0xbb2d80[_0x8232('0x5d')](_0x31c2d2);}})['then'](function(_0x472c36){if(_0x472c36){_0x2de616=_0x472c36[_0x8232('0x56')];if(!_0x339f22[_0x8232('0x3d')][_0x8232('0x57')]('nolimit')){_0x31c2d2[_0x8232('0x2c')]=qs[_0x8232('0x2c')](_0x339f22['query'][_0x8232('0x2c')]);_0x31c2d2[_0x8232('0x2b')]=qs[_0x8232('0x2b')](_0x339f22[_0x8232('0x3d')][_0x8232('0x2b')]);}return _0xbb2d80[_0x8232('0x5d')](_0x31c2d2);}})[_0x8232('0x1c')](function(_0x104885){if(_0x104885){return _0x104885?{'count':_0x2de616,'rows':_0x104885}:null;}})[_0x8232('0x1c')](respondWithResult(_0xe3e94f,null))[_0x8232('0x25')](handleError(_0xe3e94f,null));};exports[_0x8232('0x5f')]=function(_0x26225f,_0x576cb6,_0x1e59fa){if(_0x26225f[_0x8232('0x52')]['id']){delete _0x26225f[_0x8232('0x52')]['id'];}return db[_0x8232('0x38')][_0x8232('0x55')]({'where':{'id':_0x26225f[_0x8232('0x53')]['id']}})['then'](handleEntityNotFound(_0x576cb6,null))[_0x8232('0x1c')](function(_0x1e5a56){if(_0x1e5a56){return _0x1e5a56[_0x8232('0x5f')](_0x26225f['body']['ids']||[]);}return null;})[_0x8232('0x1c')](respondWithResult(_0x576cb6,null))[_0x8232('0x25')](handleError(_0x576cb6,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 2151d8b..7901d7e 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 _0x2730=['bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','define','ZendeskConfiguration','lodash','../../config/logger','api'];(function(_0x1a00b8,_0x5363fb){var _0x664a54=function(_0xaadc0c){while(--_0xaadc0c){_0x1a00b8['push'](_0x1a00b8['shift']());}};_0x664a54(++_0x5363fb);}(_0x2730,0x1e1));var _0x0273=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2730[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x0273('0x0'));var util=require('util');var logger=require(_0x0273('0x1'))(_0x0273('0x2'));var moment=require('moment');var BPromise=require(_0x0273('0x3'));var rp=require(_0x0273('0x4'));var fs=require('fs');var path=require(_0x0273('0x5'));var rimraf=require(_0x0273('0x6'));var config=require(_0x0273('0x7'));var attributes=require(_0x0273('0x8'));module['exports']=function(_0x16ff08,_0x154feb){return _0x16ff08[_0x0273('0x9')](_0x0273('0xa'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x77f0=['bluebird','path','rimraf','../../config/environment','exports','define','ZendeskConfiguration','lodash','util'];(function(_0x1bdbc0,_0x47e15e){var _0x3ecbd9=function(_0x232b65){while(--_0x232b65){_0x1bdbc0['push'](_0x1bdbc0['shift']());}};_0x3ecbd9(++_0x47e15e);}(_0x77f0,0x142));var _0x077f=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x77f0[_0x50aa2e];return _0x5e07f0;};'use strict';var _=require(_0x077f('0x0'));var util=require(_0x077f('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x077f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x077f('0x3'));var rimraf=require(_0x077f('0x4'));var config=require(_0x077f('0x5'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x077f('0x6')]=function(_0xaeb40f,_0x571940){return _0xaeb40f[_0x077f('0x7')](_0x077f('0x8'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 78d6ef2..08811d9 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 _0xf77c=['stringify','error','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x2ae4b5,_0x2251e8){var _0x1fb3d3=function(_0x332919){while(--_0x332919){_0x2ae4b5['push'](_0x2ae4b5['shift']());}};_0x1fb3d3(++_0x2251e8);}(_0xf77c,0x16c));var _0xcf77=function(_0x28725b,_0x5f270a){_0x28725b=_0x28725b-0x0;var _0xc6c07c=_0xf77c[_0x28725b];return _0xc6c07c;};'use strict';var _=require(_0xcf77('0x0'));var util=require(_0xcf77('0x1'));var moment=require('moment');var BPromise=require(_0xcf77('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf77('0x3'));var db=require(_0xcf77('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcf77('0x5'));var config=require(_0xcf77('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xcf77('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50a88d,_0x30130f,_0x546f5d){return new BPromise(function(_0x45baa5,_0x32efbf){return client[_0xcf77('0x8')](_0x50a88d,_0x546f5d)[_0xcf77('0x9')](function(_0x360b77){logger[_0xcf77('0xa')](_0xcf77('0xb'),_0x30130f,_0xcf77('0xc'));logger['debug'](_0xcf77('0xd'),_0x30130f,'request\x20sent',JSON[_0xcf77('0xe')](_0x360b77));if(_0x360b77[_0xcf77('0xf')]){if(_0x360b77[_0xcf77('0xf')]['code']===0x1f4){logger['error'](_0xcf77('0xb'),_0x30130f,_0x360b77[_0xcf77('0xf')]['message']);return _0x32efbf(_0x360b77['error'][_0xcf77('0x10')]);}logger[_0xcf77('0xf')](_0xcf77('0xb'),_0x30130f,_0x360b77[_0xcf77('0xf')][_0xcf77('0x10')]);return _0x45baa5(_0x360b77[_0xcf77('0xf')][_0xcf77('0x10')]);}else{logger['info'](_0xcf77('0xb'),_0x30130f,_0xcf77('0xc'));_0x45baa5(_0x360b77['result']['message']);}})[_0xcf77('0x11')](function(_0x1830e6){logger[_0xcf77('0xf')](_0xcf77('0xb'),_0x30130f,_0x1830e6);_0x32efbf(_0x1830e6);});});} \ No newline at end of file +var _0x1678=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','ZendeskConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment'];(function(_0x63e2,_0x18c9ce){var _0x55a15d=function(_0x5388eb){while(--_0x5388eb){_0x63e2['push'](_0x63e2['shift']());}};_0x55a15d(++_0x18c9ce);}(_0x1678,0x1c5));var _0x8167=function(_0x540c31,_0x321b31){_0x540c31=_0x540c31-0x0;var _0x206c67=_0x1678[_0x540c31];return _0x206c67;};'use strict';var _=require(_0x8167('0x0'));var util=require(_0x8167('0x1'));var moment=require(_0x8167('0x2'));var BPromise=require('bluebird');var rs=require(_0x8167('0x3'));var fs=require('fs');var Redis=require(_0x8167('0x4'));var db=require(_0x8167('0x5'))['db'];var utils=require(_0x8167('0x6'));var logger=require('../../config/logger')(_0x8167('0x7'));var config=require(_0x8167('0x8'));var jayson=require(_0x8167('0x9'));var client=jayson[_0x8167('0xa')][_0x8167('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5837e5,_0x51b8b2,_0x2981fb){return new BPromise(function(_0x4be650,_0x2497a5){return client[_0x8167('0xc')](_0x5837e5,_0x2981fb)[_0x8167('0xd')](function(_0x4f24ac){logger[_0x8167('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x51b8b2,_0x8167('0xf'));logger[_0x8167('0x10')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x51b8b2,_0x8167('0xf'),JSON[_0x8167('0x11')](_0x4f24ac));if(_0x4f24ac[_0x8167('0x12')]){if(_0x4f24ac[_0x8167('0x12')][_0x8167('0x13')]===0x1f4){logger[_0x8167('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x51b8b2,_0x4f24ac[_0x8167('0x12')][_0x8167('0x14')]);return _0x2497a5(_0x4f24ac['error'][_0x8167('0x14')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x51b8b2,_0x4f24ac[_0x8167('0x12')][_0x8167('0x14')]);return _0x4be650(_0x4f24ac[_0x8167('0x12')][_0x8167('0x14')]);}else{logger[_0x8167('0xe')](_0x8167('0x15'),_0x51b8b2,_0x8167('0xf'));_0x4be650(_0x4f24ac[_0x8167('0x16')][_0x8167('0x14')]);}})[_0x8167('0x17')](function(_0x7e83e3){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x51b8b2,_0x7e83e3);_0x2497a5(_0x7e83e3);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index dd72b40..91d6a7f 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 _0x1bf8=['exports','multer','util','path','express','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1bf8,0x145));var _0x81bf=function(_0x43469f,_0x1476d8){_0x43469f=_0x43469f-0x0;var _0x18d4df=_0x1bf8[_0x43469f];return _0x18d4df;};'use strict';var multer=require(_0x81bf('0x0'));var util=require(_0x81bf('0x1'));var path=require(_0x81bf('0x2'));var timeout=require('connect-timeout');var express=require(_0x81bf('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x81bf('0x4'));var config=require(_0x81bf('0x5'));var controller=require(_0x81bf('0x6'));router[_0x81bf('0x7')]('/',auth[_0x81bf('0x8')](),controller[_0x81bf('0x9')]);router[_0x81bf('0x7')](_0x81bf('0xa'),auth[_0x81bf('0x8')](),controller[_0x81bf('0xb')]);router[_0x81bf('0xc')]('/',auth[_0x81bf('0x8')](),controller['create']);router[_0x81bf('0xd')]('/:id',auth[_0x81bf('0x8')](),controller[_0x81bf('0xe')]);router[_0x81bf('0xf')](_0x81bf('0xa'),auth[_0x81bf('0x8')](),controller[_0x81bf('0x10')]);module[_0x81bf('0x11')]=router; \ No newline at end of file +var _0x91b2=['/:id','isAuthenticated','post','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index'];(function(_0x3b56cc,_0x59c415){var _0x47229a=function(_0x661d92){while(--_0x661d92){_0x3b56cc['push'](_0x3b56cc['shift']());}};_0x47229a(++_0x59c415);}(_0x91b2,0x8e));var _0x291b=function(_0x2e3dfc,_0x454d6c){_0x2e3dfc=_0x2e3dfc-0x0;var _0x4b1245=_0x91b2[_0x2e3dfc];return _0x4b1245;};'use strict';var multer=require('multer');var util=require(_0x291b('0x0'));var path=require(_0x291b('0x1'));var timeout=require(_0x291b('0x2'));var express=require(_0x291b('0x3'));var router=express[_0x291b('0x4')]();var auth=require(_0x291b('0x5'));var interaction=require(_0x291b('0x6'));var config=require(_0x291b('0x7'));var controller=require(_0x291b('0x8'));router[_0x291b('0x9')]('/',auth['isAuthenticated'](),controller[_0x291b('0xa')]);router[_0x291b('0x9')](_0x291b('0xb'),auth[_0x291b('0xc')](),controller['show']);router[_0x291b('0xd')]('/',auth[_0x291b('0xc')](),controller['create']);router['put'](_0x291b('0xb'),auth[_0x291b('0xc')](),controller[_0x291b('0xe')]);router[_0x291b('0xf')](_0x291b('0xb'),auth[_0x291b('0xc')](),controller[_0x291b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index f9e610a..748554f 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 _0x79a8=['STRING','customVariable','sequelize','ENUM','string','variable','keyValue'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x79a8,0x1d0));var _0x879a=function(_0x4cce8,_0x22d1fe){_0x4cce8=_0x4cce8-0x0;var _0x458440=_0x79a8[_0x4cce8];return _0x458440;};'use strict';var Sequelize=require(_0x879a('0x0'));module['exports']={'type':{'type':Sequelize[_0x879a('0x1')](_0x879a('0x2'),_0x879a('0x3'),'customVariable',_0x879a('0x4'),'picklist'),'defaultValue':_0x879a('0x2')},'content':{'type':Sequelize[_0x879a('0x5')]},'key':{'type':Sequelize[_0x879a('0x5')]},'keyType':{'type':Sequelize[_0x879a('0x1')](_0x879a('0x2'),_0x879a('0x3'),_0x879a('0x6'))},'keyContent':{'type':Sequelize[_0x879a('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x879a('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x879a('0x5')]}}; \ No newline at end of file +var _0x01fe=['variable','customVariable','sequelize','ENUM','string','keyValue','picklist','STRING'];(function(_0x25701b,_0x2a6976){var _0x3a8a2c=function(_0x1a5e78){while(--_0x1a5e78){_0x25701b['push'](_0x25701b['shift']());}};_0x3a8a2c(++_0x2a6976);}(_0x01fe,0x102));var _0xe01f=function(_0x25194d,_0x409b96){_0x25194d=_0x25194d-0x0;var _0x47fa6a=_0x01fe[_0x25194d];return _0x47fa6a;};'use strict';var Sequelize=require(_0xe01f('0x0'));module['exports']={'type':{'type':Sequelize[_0xe01f('0x1')](_0xe01f('0x2'),'variable','customVariable',_0xe01f('0x3'),_0xe01f('0x4')),'defaultValue':_0xe01f('0x2')},'content':{'type':Sequelize[_0xe01f('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe01f('0x1')]('string',_0xe01f('0x6'),_0xe01f('0x7'))},'keyContent':{'type':Sequelize[_0xe01f('0x5')]},'idField':{'type':Sequelize[_0xe01f('0x5')]},'nameField':{'type':Sequelize[_0xe01f('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe01f('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 09e33c4..cb00655 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 _0xda2d=['send','index','map','rawAttributes','type','key','model','query','keys','filters','length','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','ZendeskField','findAll','show','params','intersection','fields','includeAll','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack'];(function(_0x4559c8,_0x12b545){var _0x4cd9d2=function(_0x3ba15a){while(--_0x3ba15a){_0x4559c8['push'](_0x4559c8['shift']());}};_0x4cd9d2(++_0x12b545);}(_0xda2d,0x102));var _0xdda2=function(_0x4d7fe5,_0x17155a){_0x4d7fe5=_0x4d7fe5-0x0;var _0x3e3ed2=_0xda2d[_0x4d7fe5];return _0x3e3ed2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdda2('0x0'));var rimraf=require(_0xdda2('0x1'));var zipdir=require(_0xdda2('0x2'));var jsonpatch=require(_0xdda2('0x3'));var rp=require(_0xdda2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdda2('0x5'));var path=require(_0xdda2('0x6'));var sox=require(_0xdda2('0x7'));var csv=require(_0xdda2('0x8'));var ejs=require(_0xdda2('0x9'));var fs=require('fs');var _=require(_0xdda2('0xa'));var squel=require(_0xdda2('0xb'));var crypto=require(_0xdda2('0xc'));var jsforce=require(_0xdda2('0xd'));var deskjs=require(_0xdda2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdda2('0xf'));var Papa=require(_0xdda2('0x10'));var Redis=require('ioredis');var authService=require(_0xdda2('0x11'));var qs=require(_0xdda2('0x12'));var as=require(_0xdda2('0x13'));var hardwareService=require(_0xdda2('0x14'));var logger=require(_0xdda2('0x15'))(_0xdda2('0x16'));var utils=require(_0xdda2('0x17'));var config=require(_0xdda2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56d25d,_0xa6446b){_0xa6446b=_0xa6446b||0xcc;return function(_0x320f73){if(_0x320f73){return _0x56d25d[_0xdda2('0x19')](_0xa6446b);}return _0x56d25d[_0xdda2('0x1a')](_0xa6446b)[_0xdda2('0x1b')]();};}function respondWithResult(_0x475222,_0x3490f1){_0x3490f1=_0x3490f1||0xc8;return function(_0x4df902){if(_0x4df902){return _0x475222[_0xdda2('0x1a')](_0x3490f1)['json'](_0x4df902);}};}function respondWithFilteredResult(_0xbef148,_0xb6b01e){return function(_0x3553d5){if(_0x3553d5){var _0x457764=_0x3553d5[_0xdda2('0x1c')],_0x1922b1=_0xb6b01e['offset'],_0x5d8a83=_0xb6b01e[_0xdda2('0x1d')]+_0xb6b01e[_0xdda2('0x1e')],_0x55d674;if(_0x5d8a83>=_0x457764){_0x5d8a83=_0x457764;_0x55d674=0xc8;}else{_0x55d674=0xce;}_0xbef148[_0xdda2('0x1a')](_0x55d674);return _0xbef148[_0xdda2('0x1f')](_0xdda2('0x20'),_0x1922b1+'-'+_0x5d8a83+'/'+_0x457764)[_0xdda2('0x21')](_0x3553d5);}return null;};}function patchUpdates(_0x3ca127){return function(_0x351151){try{jsonpatch[_0xdda2('0x22')](_0x351151,_0x3ca127,!![]);}catch(_0x337b0b){return BPromise[_0xdda2('0x23')](_0x337b0b);}return _0x351151[_0xdda2('0x24')]();};}function saveUpdates(_0x4eed30,_0x41fe7d){return function(_0x5dfce7){if(_0x5dfce7){return _0x5dfce7[_0xdda2('0x25')](_0x4eed30)[_0xdda2('0x26')](function(_0xf994dc){return _0xf994dc;});}return null;};}function removeEntity(_0x4c5226,_0x347ee6){return function(_0x5a9bb8){if(_0x5a9bb8){return _0x5a9bb8[_0xdda2('0x27')]()[_0xdda2('0x26')](function(){_0x4c5226['status'](0xcc)[_0xdda2('0x1b')]();});}};}function handleEntityNotFound(_0xfda248,_0x2528d7){return function(_0x13b0f3){if(!_0x13b0f3){_0xfda248[_0xdda2('0x19')](0x194);}return _0x13b0f3;};}function handleError(_0x5739ad,_0x38cdf){_0x38cdf=_0x38cdf||0x1f4;return function(_0x4be5ea){logger[_0xdda2('0x28')](_0x4be5ea[_0xdda2('0x29')]);if(_0x4be5ea['name']){delete _0x4be5ea['name'];}_0x5739ad[_0xdda2('0x1a')](_0x38cdf)[_0xdda2('0x2a')](_0x4be5ea);};}exports[_0xdda2('0x2b')]=function(_0x5e9e74,_0x90d919){var _0x5d26ae={},_0x2e755b={},_0xe53dee={'count':0x0,'rows':[]};var _0xe16ec7=_[_0xdda2('0x2c')](db['ZendeskField'][_0xdda2('0x2d')],function(_0x255bbc){return{'name':_0x255bbc['fieldName'],'type':_0x255bbc[_0xdda2('0x2e')][_0xdda2('0x2f')]};});_0x2e755b[_0xdda2('0x30')]=_[_0xdda2('0x2c')](_0xe16ec7,'name');_0x2e755b[_0xdda2('0x31')]=_[_0xdda2('0x32')](_0x5e9e74['query']);_0x2e755b[_0xdda2('0x33')]=_['intersection'](_0x2e755b[_0xdda2('0x30')],_0x2e755b['query']);_0x5d26ae['attributes']=_['intersection'](_0x2e755b[_0xdda2('0x30')],qs['fields'](_0x5e9e74[_0xdda2('0x31')]['fields']));_0x5d26ae['attributes']=_0x5d26ae['attributes'][_0xdda2('0x34')]?_0x5d26ae[_0xdda2('0x35')]:_0x2e755b[_0xdda2('0x30')];if(!_0x5e9e74[_0xdda2('0x31')][_0xdda2('0x36')](_0xdda2('0x37'))){_0x5d26ae[_0xdda2('0x1e')]=qs[_0xdda2('0x1e')](_0x5e9e74[_0xdda2('0x31')][_0xdda2('0x1e')]);_0x5d26ae['offset']=qs[_0xdda2('0x1d')](_0x5e9e74[_0xdda2('0x31')][_0xdda2('0x1d')]);}_0x5d26ae[_0xdda2('0x38')]=qs[_0xdda2('0x39')](_0x5e9e74[_0xdda2('0x31')][_0xdda2('0x39')]);_0x5d26ae['where']=qs['filters'](_[_0xdda2('0x3a')](_0x5e9e74[_0xdda2('0x31')],_0x2e755b[_0xdda2('0x33')]),_0xe16ec7);if(_0x5e9e74['query']['filter']){_0x5d26ae[_0xdda2('0x3b')]=_[_0xdda2('0x3c')](_0x5d26ae[_0xdda2('0x3b')],{'$or':_[_0xdda2('0x2c')](_0xe16ec7,function(_0x246001){if(_0x246001['type']!==_0xdda2('0x3d')){var _0x21fc6d={};_0x21fc6d[_0x246001['name']]={'$like':'%'+_0x5e9e74['query'][_0xdda2('0x3e')]+'%'};return _0x21fc6d;}})});}_0x5d26ae=_[_0xdda2('0x3c')]({},_0x5d26ae,_0x5e9e74[_0xdda2('0x3f')]);var _0x2708f4={'where':_0x5d26ae[_0xdda2('0x3b')]};return db['ZendeskField'][_0xdda2('0x1c')](_0x2708f4)[_0xdda2('0x26')](function(_0x7dac2c){_0xe53dee[_0xdda2('0x1c')]=_0x7dac2c;if(_0x5e9e74['query']['includeAll']){_0x5d26ae[_0xdda2('0x40')]=[{'all':!![]}];}return db[_0xdda2('0x41')][_0xdda2('0x42')](_0x5d26ae);})['then'](function(_0x1bb2a7){_0xe53dee['rows']=_0x1bb2a7;return _0xe53dee;})[_0xdda2('0x26')](respondWithFilteredResult(_0x90d919,_0x5d26ae))['catch'](handleError(_0x90d919,null));};exports[_0xdda2('0x43')]=function(_0x2bebab,_0x1db762){var _0x2eec64={'raw':!![],'where':{'id':_0x2bebab[_0xdda2('0x44')]['id']}},_0x57bd0e={};_0x57bd0e['model']=_[_0xdda2('0x32')](db['ZendeskField'][_0xdda2('0x2d')]);_0x57bd0e[_0xdda2('0x31')]=_[_0xdda2('0x32')](_0x2bebab[_0xdda2('0x31')]);_0x57bd0e[_0xdda2('0x33')]=_['intersection'](_0x57bd0e[_0xdda2('0x30')],_0x57bd0e[_0xdda2('0x31')]);_0x2eec64['attributes']=_[_0xdda2('0x45')](_0x57bd0e['model'],qs[_0xdda2('0x46')](_0x2bebab[_0xdda2('0x31')][_0xdda2('0x46')]));_0x2eec64[_0xdda2('0x35')]=_0x2eec64[_0xdda2('0x35')][_0xdda2('0x34')]?_0x2eec64[_0xdda2('0x35')]:_0x57bd0e[_0xdda2('0x30')];if(_0x2bebab[_0xdda2('0x31')][_0xdda2('0x47')]){_0x2eec64[_0xdda2('0x40')]=[{'all':!![]}];}_0x2eec64=_[_0xdda2('0x3c')]({},_0x2eec64,_0x2bebab[_0xdda2('0x3f')]);return db['ZendeskField']['find'](_0x2eec64)['then'](handleEntityNotFound(_0x1db762,null))[_0xdda2('0x26')](respondWithResult(_0x1db762,null))[_0xdda2('0x48')](handleError(_0x1db762,null));};exports['create']=function(_0x2c41dc,_0x18f229){return db[_0xdda2('0x41')]['create'](_0x2c41dc[_0xdda2('0x49')],{})[_0xdda2('0x26')](respondWithResult(_0x18f229,0xc9))['catch'](handleError(_0x18f229,null));};exports['update']=function(_0x37422b,_0x5efd20){if(_0x37422b[_0xdda2('0x49')]['id']){delete _0x37422b['body']['id'];}return db[_0xdda2('0x41')][_0xdda2('0x4a')]({'where':{'id':_0x37422b['params']['id']}})['then'](handleEntityNotFound(_0x5efd20,null))[_0xdda2('0x26')](saveUpdates(_0x37422b[_0xdda2('0x49')],null))[_0xdda2('0x26')](respondWithResult(_0x5efd20,null))[_0xdda2('0x48')](handleError(_0x5efd20,null));};exports['destroy']=function(_0x1edbc6,_0x3bba94){return db[_0xdda2('0x41')][_0xdda2('0x4a')]({'where':{'id':_0x1edbc6[_0xdda2('0x44')]['id']}})['then'](handleEntityNotFound(_0x3bba94,null))[_0xdda2('0x26')](removeEntity(_0x3bba94,null))[_0xdda2('0x48')](handleError(_0x3bba94,null));}; \ No newline at end of file +var _0xbff5=['html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','ZendeskField','findAll','rows','catch','show','rawAttributes','keys','find','create','body','params'];(function(_0x17d5c6,_0x1896b9){var _0x28092d=function(_0x12797b){while(--_0x12797b){_0x17d5c6['push'](_0x17d5c6['shift']());}};_0x28092d(++_0x1896b9);}(_0xbff5,0x1bc));var _0x5bff=function(_0x188886,_0x4e3640){_0x188886=_0x188886-0x0;var _0x14ba7c=_0xbff5[_0x188886];return _0x14ba7c;};'use strict';var pdf=require(_0x5bff('0x0'));var emlformat=require(_0x5bff('0x1'));var rimraf=require(_0x5bff('0x2'));var zipdir=require(_0x5bff('0x3'));var jsonpatch=require(_0x5bff('0x4'));var rp=require(_0x5bff('0x5'));var moment=require(_0x5bff('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x5bff('0x7'));var util=require('util');var path=require('path');var sox=require(_0x5bff('0x8'));var csv=require(_0x5bff('0x9'));var ejs=require(_0x5bff('0xa'));var fs=require('fs');var _=require(_0x5bff('0xb'));var squel=require(_0x5bff('0xc'));var crypto=require(_0x5bff('0xd'));var jsforce=require(_0x5bff('0xe'));var deskjs=require(_0x5bff('0xf'));var toCsv=require(_0x5bff('0x9'));var querystring=require('querystring');var Papa=require(_0x5bff('0x10'));var Redis=require('ioredis');var authService=require(_0x5bff('0x11'));var qs=require(_0x5bff('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bff('0x13'));var logger=require('../../config/logger')(_0x5bff('0x14'));var utils=require('../../config/utils');var config=require(_0x5bff('0x15'));var licenseUtil=require(_0x5bff('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x132dc9,_0x50e1e9){_0x50e1e9=_0x50e1e9||0xcc;return function(_0x335e78){if(_0x335e78){return _0x132dc9[_0x5bff('0x17')](_0x50e1e9);}return _0x132dc9['status'](_0x50e1e9)[_0x5bff('0x18')]();};}function respondWithResult(_0xa16a3f,_0x5b0d2d){_0x5b0d2d=_0x5b0d2d||0xc8;return function(_0x5f2a55){if(_0x5f2a55){return _0xa16a3f[_0x5bff('0x19')](_0x5b0d2d)[_0x5bff('0x1a')](_0x5f2a55);}};}function respondWithFilteredResult(_0x3a507c,_0x4d883e){return function(_0x2d22ab){if(_0x2d22ab){var _0x4612ec=_0x2d22ab[_0x5bff('0x1b')],_0xcb8995=_0x4d883e[_0x5bff('0x1c')],_0x56c7b2=_0x4d883e['offset']+_0x4d883e[_0x5bff('0x1d')],_0x3ffbbc;if(_0x56c7b2>=_0x4612ec){_0x56c7b2=_0x4612ec;_0x3ffbbc=0xc8;}else{_0x3ffbbc=0xce;}_0x3a507c[_0x5bff('0x19')](_0x3ffbbc);return _0x3a507c[_0x5bff('0x1e')](_0x5bff('0x1f'),_0xcb8995+'-'+_0x56c7b2+'/'+_0x4612ec)['json'](_0x2d22ab);}return null;};}function patchUpdates(_0x3065c1){return function(_0x5357d4){try{jsonpatch[_0x5bff('0x20')](_0x5357d4,_0x3065c1,!![]);}catch(_0x4d0111){return BPromise[_0x5bff('0x21')](_0x4d0111);}return _0x5357d4[_0x5bff('0x22')]();};}function saveUpdates(_0x2a83ce,_0x6cbfa){return function(_0x12d018){if(_0x12d018){return _0x12d018[_0x5bff('0x23')](_0x2a83ce)[_0x5bff('0x24')](function(_0x13ee8f){return _0x13ee8f;});}return null;};}function removeEntity(_0x155e16,_0x490bc1){return function(_0x5f2593){if(_0x5f2593){return _0x5f2593[_0x5bff('0x25')]()[_0x5bff('0x24')](function(){_0x155e16[_0x5bff('0x19')](0xcc)[_0x5bff('0x18')]();});}};}function handleEntityNotFound(_0x31d26b,_0x3913fd){return function(_0x1ea853){if(!_0x1ea853){_0x31d26b['sendStatus'](0x194);}return _0x1ea853;};}function handleError(_0x5741d9,_0x9a69de){_0x9a69de=_0x9a69de||0x1f4;return function(_0x53bd97){logger[_0x5bff('0x26')](_0x53bd97[_0x5bff('0x27')]);if(_0x53bd97[_0x5bff('0x28')]){delete _0x53bd97[_0x5bff('0x28')];}_0x5741d9[_0x5bff('0x19')](_0x9a69de)[_0x5bff('0x29')](_0x53bd97);};}exports[_0x5bff('0x2a')]=function(_0xedba9d,_0x5a4e82){var _0x4df57a={},_0x20d750={},_0x2dd52f={'count':0x0,'rows':[]};var _0x4d7640=_[_0x5bff('0x2b')](db['ZendeskField']['rawAttributes'],function(_0x3eda3a){return{'name':_0x3eda3a['fieldName'],'type':_0x3eda3a[_0x5bff('0x2c')][_0x5bff('0x2d')]};});_0x20d750[_0x5bff('0x2e')]=_[_0x5bff('0x2b')](_0x4d7640,'name');_0x20d750[_0x5bff('0x2f')]=_['keys'](_0xedba9d[_0x5bff('0x2f')]);_0x20d750['filters']=_[_0x5bff('0x30')](_0x20d750[_0x5bff('0x2e')],_0x20d750[_0x5bff('0x2f')]);_0x4df57a[_0x5bff('0x31')]=_[_0x5bff('0x30')](_0x20d750[_0x5bff('0x2e')],qs['fields'](_0xedba9d[_0x5bff('0x2f')][_0x5bff('0x32')]));_0x4df57a[_0x5bff('0x31')]=_0x4df57a[_0x5bff('0x31')][_0x5bff('0x33')]?_0x4df57a[_0x5bff('0x31')]:_0x20d750[_0x5bff('0x2e')];if(!_0xedba9d[_0x5bff('0x2f')]['hasOwnProperty'](_0x5bff('0x34'))){_0x4df57a[_0x5bff('0x1d')]=qs[_0x5bff('0x1d')](_0xedba9d[_0x5bff('0x2f')]['limit']);_0x4df57a[_0x5bff('0x1c')]=qs[_0x5bff('0x1c')](_0xedba9d['query'][_0x5bff('0x1c')]);}_0x4df57a[_0x5bff('0x35')]=qs[_0x5bff('0x36')](_0xedba9d[_0x5bff('0x2f')]['sort']);_0x4df57a[_0x5bff('0x37')]=qs[_0x5bff('0x38')](_[_0x5bff('0x39')](_0xedba9d['query'],_0x20d750[_0x5bff('0x38')]),_0x4d7640);if(_0xedba9d['query'][_0x5bff('0x3a')]){_0x4df57a[_0x5bff('0x37')]=_[_0x5bff('0x3b')](_0x4df57a['where'],{'$or':_[_0x5bff('0x2b')](_0x4d7640,function(_0x1ec079){if(_0x1ec079[_0x5bff('0x2c')]!=='VIRTUAL'){var _0x2e87b6={};_0x2e87b6[_0x1ec079[_0x5bff('0x28')]]={'$like':'%'+_0xedba9d['query'][_0x5bff('0x3a')]+'%'};return _0x2e87b6;}})});}_0x4df57a=_[_0x5bff('0x3b')]({},_0x4df57a,_0xedba9d[_0x5bff('0x3c')]);var _0x77a071={'where':_0x4df57a[_0x5bff('0x37')]};return db['ZendeskField'][_0x5bff('0x1b')](_0x77a071)['then'](function(_0x449c6a){_0x2dd52f[_0x5bff('0x1b')]=_0x449c6a;if(_0xedba9d[_0x5bff('0x2f')][_0x5bff('0x3d')]){_0x4df57a[_0x5bff('0x3e')]=[{'all':!![]}];}return db[_0x5bff('0x3f')][_0x5bff('0x40')](_0x4df57a);})['then'](function(_0x5c7f5f){_0x2dd52f[_0x5bff('0x41')]=_0x5c7f5f;return _0x2dd52f;})[_0x5bff('0x24')](respondWithFilteredResult(_0x5a4e82,_0x4df57a))[_0x5bff('0x42')](handleError(_0x5a4e82,null));};exports[_0x5bff('0x43')]=function(_0x25ef5f,_0xb7b82a){var _0x13de8a={'raw':!![],'where':{'id':_0x25ef5f['params']['id']}},_0x30949a={};_0x30949a[_0x5bff('0x2e')]=_['keys'](db[_0x5bff('0x3f')][_0x5bff('0x44')]);_0x30949a['query']=_[_0x5bff('0x45')](_0x25ef5f[_0x5bff('0x2f')]);_0x30949a['filters']=_[_0x5bff('0x30')](_0x30949a[_0x5bff('0x2e')],_0x30949a[_0x5bff('0x2f')]);_0x13de8a['attributes']=_[_0x5bff('0x30')](_0x30949a[_0x5bff('0x2e')],qs[_0x5bff('0x32')](_0x25ef5f['query'][_0x5bff('0x32')]));_0x13de8a[_0x5bff('0x31')]=_0x13de8a[_0x5bff('0x31')][_0x5bff('0x33')]?_0x13de8a['attributes']:_0x30949a[_0x5bff('0x2e')];if(_0x25ef5f['query']['includeAll']){_0x13de8a[_0x5bff('0x3e')]=[{'all':!![]}];}_0x13de8a=_[_0x5bff('0x3b')]({},_0x13de8a,_0x25ef5f['options']);return db[_0x5bff('0x3f')][_0x5bff('0x46')](_0x13de8a)['then'](handleEntityNotFound(_0xb7b82a,null))[_0x5bff('0x24')](respondWithResult(_0xb7b82a,null))[_0x5bff('0x42')](handleError(_0xb7b82a,null));};exports[_0x5bff('0x47')]=function(_0x39c90f,_0x4ccf4d){return db[_0x5bff('0x3f')][_0x5bff('0x47')](_0x39c90f[_0x5bff('0x48')],{})[_0x5bff('0x24')](respondWithResult(_0x4ccf4d,0xc9))[_0x5bff('0x42')](handleError(_0x4ccf4d,null));};exports[_0x5bff('0x23')]=function(_0x599163,_0x3237de){if(_0x599163[_0x5bff('0x48')]['id']){delete _0x599163['body']['id'];}return db[_0x5bff('0x3f')]['find']({'where':{'id':_0x599163['params']['id']}})['then'](handleEntityNotFound(_0x3237de,null))[_0x5bff('0x24')](saveUpdates(_0x599163[_0x5bff('0x48')],null))['then'](respondWithResult(_0x3237de,null))[_0x5bff('0x42')](handleError(_0x3237de,null));};exports[_0x5bff('0x25')]=function(_0x3360d8,_0x470dff){return db[_0x5bff('0x3f')]['find']({'where':{'id':_0x3360d8[_0x5bff('0x49')]['id']}})[_0x5bff('0x24')](handleEntityNotFound(_0x470dff,null))['then'](removeEntity(_0x470dff,null))[_0x5bff('0x42')](handleError(_0x470dff,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 1135e8b..2994de4 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 _0x83e1=['lodash','util','api','bluebird','rimraf','../../config/environment','define','ZendeskField','zendesk_unique_index','idField','FieldId'];(function(_0x535aab,_0x51fd70){var _0x22afdd=function(_0x4e113c){while(--_0x4e113c){_0x535aab['push'](_0x535aab['shift']());}};_0x22afdd(++_0x51fd70);}(_0x83e1,0x1ad));var _0x183e=function(_0x1fe28f,_0xc753e6){_0x1fe28f=_0x1fe28f-0x0;var _0x304463=_0x83e1[_0x1fe28f];return _0x304463;};'use strict';var _=require(_0x183e('0x0'));var util=require(_0x183e('0x1'));var logger=require('../../config/logger')(_0x183e('0x2'));var moment=require('moment');var BPromise=require(_0x183e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x183e('0x4'));var config=require(_0x183e('0x5'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x4d7710,_0x2e3bbd){return _0x4d7710[_0x183e('0x6')](_0x183e('0x7'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x183e('0x8'),'fields':[_0x183e('0x9'),_0x183e('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4746=['zendesk_unique_index','idField','FieldId','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ZendeskField','int_zendesk_fields'];(function(_0x3e8bfe,_0x4d05c9){var _0x5ba38c=function(_0x2f88fe){while(--_0x2f88fe){_0x3e8bfe['push'](_0x3e8bfe['shift']());}};_0x5ba38c(++_0x4d05c9);}(_0x4746,0xc6));var _0x6474=function(_0x2f8214,_0x36eb19){_0x2f8214=_0x2f8214-0x0;var _0x56e77f=_0x4746[_0x2f8214];return _0x56e77f;};'use strict';var _=require(_0x6474('0x0'));var util=require(_0x6474('0x1'));var logger=require('../../config/logger')(_0x6474('0x2'));var moment=require('moment');var BPromise=require(_0x6474('0x3'));var rp=require(_0x6474('0x4'));var fs=require('fs');var path=require(_0x6474('0x5'));var rimraf=require(_0x6474('0x6'));var config=require(_0x6474('0x7'));var attributes=require('./intZendeskField.attributes');module[_0x6474('0x8')]=function(_0x2bcf7c,_0x4cadd7){return _0x2bcf7c[_0x6474('0x9')](_0x6474('0xa'),attributes,{'tableName':_0x6474('0xb'),'paranoid':![],'indexes':[{'name':_0x6474('0xc'),'fields':[_0x6474('0xd'),_0x6474('0xe')],'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 11e52ba..519364b 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 _0xfd74=['jayson/promise','client','http','request','then','ZendeskField,\x20%s,\x20%s','debug','request\x20sent','error','code','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x12bcb6,_0xd613a8){var _0x4ee45b=function(_0x34d575){while(--_0x34d575){_0x12bcb6['push'](_0x12bcb6['shift']());}};_0x4ee45b(++_0xd613a8);}(_0xfd74,0xde));var _0x4fd7=function(_0x16dbfd,_0x2f9431){_0x16dbfd=_0x16dbfd-0x0;var _0x382254=_0xfd74[_0x16dbfd];return _0x382254;};'use strict';var _=require(_0x4fd7('0x0'));var util=require(_0x4fd7('0x1'));var moment=require(_0x4fd7('0x2'));var BPromise=require(_0x4fd7('0x3'));var rs=require(_0x4fd7('0x4'));var fs=require('fs');var Redis=require(_0x4fd7('0x5'));var db=require(_0x4fd7('0x6'))['db'];var utils=require(_0x4fd7('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x4fd7('0x8'));var jayson=require(_0x4fd7('0x9'));var client=jayson[_0x4fd7('0xa')][_0x4fd7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cc5f3,_0xe375ba,_0x3964e5){return new BPromise(function(_0x3f8806,_0x9dd00d){return client[_0x4fd7('0xc')](_0x1cc5f3,_0x3964e5)[_0x4fd7('0xd')](function(_0x13e9c9){logger['info'](_0x4fd7('0xe'),_0xe375ba,'request\x20sent');logger[_0x4fd7('0xf')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0xe375ba,_0x4fd7('0x10'),JSON['stringify'](_0x13e9c9));if(_0x13e9c9[_0x4fd7('0x11')]){if(_0x13e9c9[_0x4fd7('0x11')][_0x4fd7('0x12')]===0x1f4){logger[_0x4fd7('0x11')](_0x4fd7('0xe'),_0xe375ba,_0x13e9c9['error'][_0x4fd7('0x13')]);return _0x9dd00d(_0x13e9c9['error'][_0x4fd7('0x13')]);}logger[_0x4fd7('0x11')](_0x4fd7('0xe'),_0xe375ba,_0x13e9c9['error'][_0x4fd7('0x13')]);return _0x3f8806(_0x13e9c9['error'][_0x4fd7('0x13')]);}else{logger[_0x4fd7('0x14')](_0x4fd7('0xe'),_0xe375ba,_0x4fd7('0x10'));_0x3f8806(_0x13e9c9['result'][_0x4fd7('0x13')]);}})['catch'](function(_0x96f469){logger[_0x4fd7('0x11')](_0x4fd7('0xe'),_0xe375ba,_0x96f469);_0x9dd00d(_0x96f469);});});} \ No newline at end of file +var _0x0342=['message','info','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s'];(function(_0x2fe15c,_0x48713a){var _0x26ec58=function(_0x3e475a){while(--_0x3e475a){_0x2fe15c['push'](_0x2fe15c['shift']());}};_0x26ec58(++_0x48713a);}(_0x0342,0x143));var _0x2034=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0x0342[_0x56740a];return _0x257144;};'use strict';var _=require(_0x2034('0x0'));var util=require('util');var moment=require(_0x2034('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2034('0x2'));var db=require(_0x2034('0x3'))['db'];var utils=require(_0x2034('0x4'));var logger=require(_0x2034('0x5'))(_0x2034('0x6'));var config=require(_0x2034('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2034('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1a689e,_0x3c3839,_0x88b492){return new BPromise(function(_0x50b1bc,_0x6ab9b2){return client[_0x2034('0x9')](_0x1a689e,_0x88b492)['then'](function(_0x3403f4){logger['info']('ZendeskField,\x20%s,\x20%s',_0x3c3839,_0x2034('0xa'));logger[_0x2034('0xb')](_0x2034('0xc'),_0x3c3839,_0x2034('0xa'),JSON[_0x2034('0xd')](_0x3403f4));if(_0x3403f4[_0x2034('0xe')]){if(_0x3403f4[_0x2034('0xe')][_0x2034('0xf')]===0x1f4){logger[_0x2034('0xe')](_0x2034('0x10'),_0x3c3839,_0x3403f4['error'][_0x2034('0x11')]);return _0x6ab9b2(_0x3403f4[_0x2034('0xe')][_0x2034('0x11')]);}logger['error'](_0x2034('0x10'),_0x3c3839,_0x3403f4[_0x2034('0xe')][_0x2034('0x11')]);return _0x50b1bc(_0x3403f4[_0x2034('0xe')]['message']);}else{logger[_0x2034('0x12')](_0x2034('0x10'),_0x3c3839,_0x2034('0xa'));_0x50b1bc(_0x3403f4['result'][_0x2034('0x11')]);}})[_0x2034('0x13')](function(_0x2ea062){logger[_0x2034('0xe')]('ZendeskField,\x20%s,\x20%s',_0x3c3839,_0x2ea062);_0x6ab9b2(_0x2ea062);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index df32969..047b267 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 _0xa9e0=['/:id','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated'];(function(_0x2a80f1,_0x2bbfc0){var _0x388ef6=function(_0x305429){while(--_0x305429){_0x2a80f1['push'](_0x2a80f1['shift']());}};_0x388ef6(++_0x2bbfc0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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 auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file +var _0xa9e0=['/:id','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated'];(function(_0x44da17,_0x570b92){var _0xa49851=function(_0x1abd4f){while(--_0x1abd4f){_0x44da17['push'](_0x44da17['shift']());}};_0xa49851(++_0x570b92);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['show']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x0a9e('0x7')](_0x0a9e('0xb'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x8')](),controller['create']);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')]('/:id',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0x12')]);module[_0x0a9e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index f56e365..2579b13 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 _0xd5b6=['STRING'];(function(_0x381d3c,_0x4bc7d0){var _0x12542e=function(_0xc3e0c7){while(--_0xc3e0c7){_0x381d3c['push'](_0x381d3c['shift']());}};_0x12542e(++_0x4bc7d0);}(_0xd5b6,0x191));var _0x6d5b=function(_0x18acd1,_0xf9f53e){_0x18acd1=_0x18acd1-0x0;var _0x2c0015=_0xd5b6[_0x18acd1];return _0x2c0015;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6d5b('0x0')]},'host':{'type':Sequelize[_0x6d5b('0x0')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x6d5b('0x0')]},'clientSecret':{'type':Sequelize[_0x6d5b('0x0')]},'serverUrl':{'type':Sequelize[_0x6d5b('0x0')],'allowNull':![]},'code':{'type':Sequelize[_0x6d5b('0x0')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcb05=['exports','STRING','sequelize'];(function(_0x365e54,_0x44be74){var _0x13317a=function(_0x2d917f){while(--_0x2d917f){_0x365e54['push'](_0x365e54['shift']());}};_0x13317a(++_0x44be74);}(_0xcb05,0x86));var _0x5cb0=function(_0x2a0413,_0xf312a5){_0x2a0413=_0x2a0413-0x0;var _0x504245=_0xcb05[_0x2a0413];return _0x504245;};'use strict';var Sequelize=require(_0x5cb0('0x0'));module[_0x5cb0('0x1')]={'name':{'type':Sequelize[_0x5cb0('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x5cb0('0x2')]},'clientId':{'type':Sequelize[_0x5cb0('0x2')]},'clientSecret':{'type':Sequelize[_0x5cb0('0x2')]},'serverUrl':{'type':Sequelize[_0x5cb0('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x5cb0('0x2')]},'refreshToken':{'type':Sequelize[_0x5cb0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 957c922..559bb6c 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 _0x236c=['keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','ZohoAccount','includeAll','show','fields','include','find','create','body','params','getConfigurations','findOne','ZohoConfiguration','pick','options','addConfiguration','AccountId','Subjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','clientId','code','refreshToken','zoho.eu','serverUrl','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','system_mandatory','push','custom_field','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','test','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','count','offset','limit','Content-Range','json','reject','update','destroy','end','stack','name','index','map','rawAttributes','fieldName','type','key','model','query'];(function(_0x5206d4,_0x4cddaa){var _0x17e57f=function(_0x204674){while(--_0x204674){_0x5206d4['push'](_0x5206d4['shift']());}};_0x17e57f(++_0x4cddaa);}(_0x236c,0x155));var _0xc236=function(_0x16b981,_0x1838f6){_0x16b981=_0x16b981-0x0;var _0xf20218=_0x236c[_0x16b981];return _0xf20218;};'use strict';var pdf=require(_0xc236('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc236('0x1'));var zipdir=require(_0xc236('0x2'));var jsonpatch=require(_0xc236('0x3'));var rp=require(_0xc236('0x4'));var moment=require(_0xc236('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc236('0x6'));var util=require(_0xc236('0x7'));var path=require(_0xc236('0x8'));var sox=require(_0xc236('0x9'));var csv=require(_0xc236('0xa'));var ejs=require(_0xc236('0xb'));var fs=require('fs');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'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xc236('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x6db6b9,_0x442095,_0x2184c9,_0x71bce2){return new BPromise(function(_0x5052db,_0x13a42b){var _0x55b188=_0x71bce2||client;return _0x55b188['request'](_0x6db6b9,_0x2184c9)[_0xc236('0x19')](function(_0x32f2fd){logger[_0xc236('0x1a')](_0xc236('0x1b'),_0x442095,_0xc236('0x1c'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x442095,'request\x20sent',JSON[_0xc236('0x1d')](_0x32f2fd));if(_0x32f2fd[_0xc236('0x1e')]){if(_0x32f2fd[_0xc236('0x1e')]['code']===0x1f4){logger[_0xc236('0x1e')]('ZohoAccount,\x20%s,\x20%s',_0x442095,_0x32f2fd['error'][_0xc236('0x1f')]);return _0x13a42b(_0x32f2fd[_0xc236('0x1e')][_0xc236('0x1f')]);}logger[_0xc236('0x1e')](_0xc236('0x1b'),_0x442095,_0x32f2fd[_0xc236('0x1e')][_0xc236('0x1f')]);return _0x5052db(_0x32f2fd[_0xc236('0x1e')][_0xc236('0x1f')]);}else{logger[_0xc236('0x1a')](_0xc236('0x1b'),_0x442095,'request\x20sent');_0x5052db(_0x32f2fd[_0xc236('0x20')][_0xc236('0x1f')]);}})[_0xc236('0x21')](function(_0xd18bd0){logger[_0xc236('0x1e')](_0xc236('0x1b'),_0x442095,_0xd18bd0);_0x13a42b(_0xd18bd0);});});}function respondWithStatusCode(_0x3a315b,_0xf921e6){_0xf921e6=_0xf921e6||0xcc;return function(_0x1d65e2){if(_0x1d65e2){return _0x3a315b[_0xc236('0x22')](_0xf921e6);}return _0x3a315b[_0xc236('0x23')](_0xf921e6)['end']();};}function respondWithResult(_0x308cd6,_0x21d78f){_0x21d78f=_0x21d78f||0xc8;return function(_0x356042){if(_0x356042){return _0x308cd6[_0xc236('0x23')](_0x21d78f)['json'](_0x356042);}};}function respondWithFilteredResult(_0x42f248,_0x5da4b2){return function(_0x5351bc){if(_0x5351bc){var _0x15ead8=_0x5351bc[_0xc236('0x24')],_0x4eace8=_0x5da4b2['offset'],_0x36e578=_0x5da4b2[_0xc236('0x25')]+_0x5da4b2[_0xc236('0x26')],_0x4f753c;if(_0x36e578>=_0x15ead8){_0x36e578=_0x15ead8;_0x4f753c=0xc8;}else{_0x4f753c=0xce;}_0x42f248['status'](_0x4f753c);return _0x42f248['set'](_0xc236('0x27'),_0x4eace8+'-'+_0x36e578+'/'+_0x15ead8)[_0xc236('0x28')](_0x5351bc);}return null;};}function patchUpdates(_0x1f4995){return function(_0x6ad83f){try{jsonpatch['apply'](_0x6ad83f,_0x1f4995,!![]);}catch(_0x4e3262){return BPromise[_0xc236('0x29')](_0x4e3262);}return _0x6ad83f['save']();};}function saveUpdates(_0x2c756f,_0x4ddc87){return function(_0x1a3409){if(_0x1a3409){return _0x1a3409[_0xc236('0x2a')](_0x2c756f)['then'](function(_0x5a5ec3){return _0x5a5ec3;});}return null;};}function removeEntity(_0x2537f9,_0x3053a3){return function(_0xbda858){if(_0xbda858){return _0xbda858[_0xc236('0x2b')]()[_0xc236('0x19')](function(){_0x2537f9[_0xc236('0x23')](0xcc)[_0xc236('0x2c')]();});}};}function handleEntityNotFound(_0x22a2ca,_0x3f58a0){return function(_0x4942d7){if(!_0x4942d7){_0x22a2ca['sendStatus'](0x194);}return _0x4942d7;};}function handleError(_0x5c151a,_0x1b4fb2){_0x1b4fb2=_0x1b4fb2||0x1f4;return function(_0xfda1f9){logger[_0xc236('0x1e')](_0xfda1f9[_0xc236('0x2d')]);if(_0xfda1f9[_0xc236('0x2e')]){delete _0xfda1f9[_0xc236('0x2e')];}_0x5c151a[_0xc236('0x23')](_0x1b4fb2)['send'](_0xfda1f9);};}exports[_0xc236('0x2f')]=function(_0x3f9b1d,_0xc77281){var _0x5057ff={},_0x40de85={},_0x2a8f33={'count':0x0,'rows':[]};var _0x3740c9=_[_0xc236('0x30')](db['ZohoAccount'][_0xc236('0x31')],function(_0x40ec71){return{'name':_0x40ec71[_0xc236('0x32')],'type':_0x40ec71[_0xc236('0x33')][_0xc236('0x34')]};});_0x40de85[_0xc236('0x35')]=_[_0xc236('0x30')](_0x3740c9,_0xc236('0x2e'));_0x40de85[_0xc236('0x36')]=_[_0xc236('0x37')](_0x3f9b1d[_0xc236('0x36')]);_0x40de85[_0xc236('0x38')]=_[_0xc236('0x39')](_0x40de85[_0xc236('0x35')],_0x40de85[_0xc236('0x36')]);_0x5057ff[_0xc236('0x3a')]=_[_0xc236('0x39')](_0x40de85['model'],qs['fields'](_0x3f9b1d['query']['fields']));_0x5057ff[_0xc236('0x3a')]=_0x5057ff['attributes'][_0xc236('0x3b')]?_0x5057ff[_0xc236('0x3a')]:_0x40de85[_0xc236('0x35')];if(!_0x3f9b1d[_0xc236('0x36')][_0xc236('0x3c')](_0xc236('0x3d'))){_0x5057ff[_0xc236('0x26')]=qs[_0xc236('0x26')](_0x3f9b1d[_0xc236('0x36')][_0xc236('0x26')]);_0x5057ff[_0xc236('0x25')]=qs[_0xc236('0x25')](_0x3f9b1d[_0xc236('0x36')][_0xc236('0x25')]);}_0x5057ff[_0xc236('0x3e')]=qs['sort'](_0x3f9b1d[_0xc236('0x36')][_0xc236('0x3f')]);_0x5057ff['where']=qs[_0xc236('0x38')](_['pick'](_0x3f9b1d[_0xc236('0x36')],_0x40de85['filters']),_0x3740c9);if(_0x3f9b1d[_0xc236('0x36')][_0xc236('0x40')]){_0x5057ff[_0xc236('0x41')]=_['merge'](_0x5057ff[_0xc236('0x41')],{'$or':_[_0xc236('0x30')](_0x3740c9,function(_0x1b8480){if(_0x1b8480['type']!==_0xc236('0x42')){var _0x169aee={};_0x169aee[_0x1b8480[_0xc236('0x2e')]]={'$like':'%'+_0x3f9b1d[_0xc236('0x36')][_0xc236('0x40')]+'%'};return _0x169aee;}})});}_0x5057ff=_[_0xc236('0x43')]({},_0x5057ff,_0x3f9b1d['options']);var _0x359f21={'where':_0x5057ff['where']};return db[_0xc236('0x44')][_0xc236('0x24')](_0x359f21)[_0xc236('0x19')](function(_0x2bd744){_0x2a8f33[_0xc236('0x24')]=_0x2bd744;if(_0x3f9b1d[_0xc236('0x36')][_0xc236('0x45')]){_0x5057ff['include']=[{'all':!![]}];}return db[_0xc236('0x44')]['findAll'](_0x5057ff);})[_0xc236('0x19')](function(_0x2f52b9){_0x2a8f33['rows']=_0x2f52b9;return _0x2a8f33;})[_0xc236('0x19')](respondWithFilteredResult(_0xc77281,_0x5057ff))[_0xc236('0x21')](handleError(_0xc77281,null));};exports[_0xc236('0x46')]=function(_0x161890,_0x181dd6){var _0x3bac04={'raw':![],'where':{'id':_0x161890['params']['id']}},_0x37bf72={};_0x37bf72['model']=_[_0xc236('0x37')](db[_0xc236('0x44')]['rawAttributes']);_0x37bf72[_0xc236('0x36')]=_[_0xc236('0x37')](_0x161890[_0xc236('0x36')]);_0x37bf72[_0xc236('0x38')]=_[_0xc236('0x39')](_0x37bf72[_0xc236('0x35')],_0x37bf72[_0xc236('0x36')]);_0x3bac04[_0xc236('0x3a')]=_[_0xc236('0x39')](_0x37bf72['model'],qs[_0xc236('0x47')](_0x161890[_0xc236('0x36')][_0xc236('0x47')]));_0x3bac04[_0xc236('0x3a')]=_0x3bac04[_0xc236('0x3a')][_0xc236('0x3b')]?_0x3bac04[_0xc236('0x3a')]:_0x37bf72['model'];if(_0x161890[_0xc236('0x36')][_0xc236('0x45')]){_0x3bac04[_0xc236('0x48')]=[{'all':!![]}];}_0x3bac04=_[_0xc236('0x43')]({},_0x3bac04,_0x161890['options']);return db[_0xc236('0x44')][_0xc236('0x49')](_0x3bac04)[_0xc236('0x19')](handleEntityNotFound(_0x181dd6,null))[_0xc236('0x19')](respondWithResult(_0x181dd6,null))[_0xc236('0x21')](handleError(_0x181dd6,null));};exports['create']=function(_0x38d504,_0x4a1251){return db[_0xc236('0x44')][_0xc236('0x4a')](_0x38d504[_0xc236('0x4b')],{})[_0xc236('0x19')](respondWithResult(_0x4a1251,0xc9))[_0xc236('0x21')](handleError(_0x4a1251,null));};exports['update']=function(_0x5929ef,_0x3bee67){if(_0x5929ef[_0xc236('0x4b')]['id']){delete _0x5929ef[_0xc236('0x4b')]['id'];}return db[_0xc236('0x44')][_0xc236('0x49')]({'where':{'id':_0x5929ef[_0xc236('0x4c')]['id']}})[_0xc236('0x19')](handleEntityNotFound(_0x3bee67,null))[_0xc236('0x19')](saveUpdates(_0x5929ef[_0xc236('0x4b')],null))[_0xc236('0x19')](respondWithResult(_0x3bee67,null))['catch'](handleError(_0x3bee67,null));};exports['destroy']=function(_0xd3bdff,_0x3a84b1){return db[_0xc236('0x44')][_0xc236('0x49')]({'where':{'id':_0xd3bdff['params']['id']}})[_0xc236('0x19')](handleEntityNotFound(_0x3a84b1,null))[_0xc236('0x19')](removeEntity(_0x3a84b1,null))['catch'](handleError(_0x3a84b1,null));};exports[_0xc236('0x4d')]=function(_0x3adb81,_0x445f03,_0x182618){var _0x5801d6={};var _0x1558dd={};var _0xec00da;var _0x35955c;return db[_0xc236('0x44')][_0xc236('0x4e')]({'where':{'id':_0x3adb81[_0xc236('0x4c')]['id']}})[_0xc236('0x19')](handleEntityNotFound(_0x445f03,null))['then'](function(_0x490a69){if(_0x490a69){_0xec00da=_0x490a69;_0x1558dd['model']=_[_0xc236('0x37')](db[_0xc236('0x4f')][_0xc236('0x31')]);_0x1558dd[_0xc236('0x36')]=_['keys'](_0x3adb81[_0xc236('0x36')]);_0x1558dd[_0xc236('0x38')]=_[_0xc236('0x39')](_0x1558dd['model'],_0x1558dd[_0xc236('0x36')]);_0x5801d6[_0xc236('0x3a')]=_[_0xc236('0x39')](_0x1558dd[_0xc236('0x35')],qs[_0xc236('0x47')](_0x3adb81[_0xc236('0x36')]['fields']));_0x5801d6['attributes']=_0x5801d6[_0xc236('0x3a')][_0xc236('0x3b')]?_0x5801d6[_0xc236('0x3a')]:_0x1558dd[_0xc236('0x35')];_0x5801d6[_0xc236('0x3e')]=qs[_0xc236('0x3f')](_0x3adb81[_0xc236('0x36')]['sort']);_0x5801d6['where']=qs['filters'](_[_0xc236('0x50')](_0x3adb81[_0xc236('0x36')],_0x1558dd[_0xc236('0x38')]));if(_0x3adb81[_0xc236('0x36')]['filter']){_0x5801d6['where']=_['merge'](_0x5801d6['where'],{'$or':_[_0xc236('0x30')](_0x5801d6['attributes'],function(_0x20a1eb){var _0x519e48={};_0x519e48[_0x20a1eb]={'$like':'%'+_0x3adb81[_0xc236('0x36')][_0xc236('0x40')]+'%'};return _0x519e48;})});}_0x5801d6=_[_0xc236('0x43')]({},_0x5801d6,_0x3adb81[_0xc236('0x51')]);return _0xec00da[_0xc236('0x4d')](_0x5801d6);}})[_0xc236('0x19')](function(_0x1d019d){if(_0x1d019d){_0x35955c=_0x1d019d['length'];if(!_0x3adb81[_0xc236('0x36')]['hasOwnProperty'](_0xc236('0x3d'))){_0x5801d6[_0xc236('0x26')]=qs[_0xc236('0x26')](_0x3adb81[_0xc236('0x36')][_0xc236('0x26')]);_0x5801d6[_0xc236('0x25')]=qs['offset'](_0x3adb81[_0xc236('0x36')][_0xc236('0x25')]);}return _0xec00da['getConfigurations'](_0x5801d6);}})[_0xc236('0x19')](function(_0x5f33ec){if(_0x5f33ec){return _0x5f33ec?{'count':_0x35955c,'rows':_0x5f33ec}:null;}})[_0xc236('0x19')](respondWithResult(_0x445f03,null))['catch'](handleError(_0x445f03,null));};exports[_0xc236('0x52')]=function(_0x45fe5a,_0x5897a1,_0x2c8f89){if(_0x45fe5a[_0xc236('0x4b')]['id']){delete _0x45fe5a[_0xc236('0x4b')]['id'];}return db[_0xc236('0x44')][_0xc236('0x4e')]({'where':{'id':_0x45fe5a[_0xc236('0x4c')]['id']}})[_0xc236('0x19')](handleEntityNotFound(_0x5897a1,null))[_0xc236('0x19')](function(_0x3de937){if(_0x3de937){_0x45fe5a['body'][_0xc236('0x53')]=_0x3de937['id'];_0x45fe5a[_0xc236('0x4b')][_0xc236('0x54')]=integrations['getSubjects'](_0x45fe5a[_0xc236('0x4b')][_0xc236('0x55')],_0x45fe5a[_0xc236('0x4b')][_0xc236('0x33')]);_0x45fe5a['body'][_0xc236('0x56')]=integrations['getDescriptions'](_0x45fe5a[_0xc236('0x4b')]['channel'],_0x45fe5a[_0xc236('0x4b')][_0xc236('0x33')]);return db['ZohoConfiguration']['create'](_0x45fe5a['body'],{'include':[{'model':db[_0xc236('0x57')],'as':'Subjects'},{'model':db[_0xc236('0x57')],'as':_0xc236('0x56')}]});}return null;})['then'](respondWithResult(_0x5897a1,null))[_0xc236('0x21')](handleError(_0x5897a1,null));};function getAccessToken(_0x2e0009){return new Promise(function(_0x4d7e8d,_0xdbeea2){var _0x2181aa;switch(_0x2e0009[_0xc236('0x58')]){case'US':_0x2181aa=_0xc236('0x59');break;case'AU':_0x2181aa='https://accounts.zoho.com.au';break;case'EU':_0x2181aa=_0xc236('0x5a');break;case'IN':_0x2181aa=_0xc236('0x5b');break;case'CN':_0x2181aa=_0xc236('0x5c');break;default:_0x2181aa=_0xc236('0x5a');break;}var _0x93aa0f={'method':_0xc236('0x5d'),'uri':_0x2181aa+_0xc236('0x5e'),'qs':{'refresh_token':_0x2e0009['refreshToken'],'client_id':_0x2e0009['clientId'],'client_secret':_0x2e0009[_0xc236('0x5f')],'grant_type':_0xc236('0x60')},'json':!![]};return rp(_0x93aa0f)[_0xc236('0x19')](function(_0x41edb8){if(_0x41edb8[_0xc236('0x61')]){_0x4d7e8d(_0x41edb8[_0xc236('0x61')]);}else{_0xdbeea2(_0xc236('0x62'));}})[_0xc236('0x21')](function(_0x4df1a5){_0xdbeea2(_0x4df1a5);});});}exports['getFields']=function(_0x2c037a,_0x47cd85,_0x35e0d8){var _0x1c4835,_0x25d982,_0x598397,_0x15ffa6,_0x4b0345;return db[_0xc236('0x44')][_0xc236('0x4e')]({'where':{'id':_0x2c037a[_0xc236('0x4c')]['id']},'attributes':['id',_0xc236('0x63'),'zone',_0xc236('0x64'),_0xc236('0x5f'),'serverUrl',_0xc236('0x65'),_0xc236('0x66')]})[_0xc236('0x19')](handleEntityNotFound(_0x47cd85,null))[_0xc236('0x19')](function(_0x11684e){_0x4b0345=_0x11684e;_0x1c4835=_0x4b0345[_0xc236('0x63')];_0x25d982=_0x1c4835===_0xc236('0x67')?'eu':'com';_0x598397=_0x4b0345[_0xc236('0x68')];var _0x40350d=_0x598397[_0xc236('0x69')](-0x1);if(_0x40350d==='/'||_0x40350d==='\x5c'||_0x40350d===':'){_0x598397=_0x598397[_0xc236('0x6a')](0x0,_0x598397['lastIndexOf'](_0x40350d));}if(!_0x4b0345[_0xc236('0x66')]){throw new Error(_0xc236('0x6b'));}return getAccessToken(_0x4b0345);})['then'](function(_0x40fd6d){if(_0x40fd6d){return rp({'method':'GET','uri':util[_0xc236('0x6c')](_0xc236('0x6d'),_0x25d982),'qs':{'module':'Calls'},'headers':{'Authorization':_0xc236('0x6e')+_0x40fd6d},'json':!![]});}})[_0xc236('0x19')](function(_0x5dd792){if(_0x5dd792){if(_0x5dd792['response']&&_0x5dd792[_0xc236('0x6f')][_0xc236('0x1e')]){throw new Error(_0x5dd792[_0xc236('0x6f')][_0xc236('0x1e')][_0xc236('0x1f')]);}var _0x17ce2d=[];var _0x5ef38a=[];var _0x155308=[_0xc236('0x70'),_0xc236('0x71'),_0xc236('0x72'),'WhoId',_0xc236('0x73'),_0xc236('0x74'),_0xc236('0x75'),_0xc236('0x76')];_0x5ef38a=_[_0xc236('0x77')](_0x5dd792['fields'],function(_0x485261){return _0x155308[_0xc236('0x78')](_0x485261['api_name']);});for(var _0x143d2e=0x0;_0x143d2e<_0x5ef38a[_0xc236('0x3b')];_0x143d2e++){if(_0x5ef38a[_0x143d2e][_0xc236('0x79')]===![]){_0x17ce2d[_0xc236('0x7a')]({'id':_0x5ef38a[_0x143d2e]['id'],'name':_0x5ef38a[_0x143d2e]['display_label'],'custom':_0x5ef38a[_0x143d2e][_0xc236('0x7b')],'options':_0x5ef38a[_0x143d2e]['data_type']===_0xc236('0x7c')&&_0x5ef38a[_0x143d2e]['pick_list_values'][_0xc236('0x3b')]>-0x1?_[_0xc236('0x30')](_0x5ef38a[_0x143d2e][_0xc236('0x7d')],function(_0x461341){return{'name':_0x461341,'value':_0x461341};}):[]});}}return{'count':_0x17ce2d[_0xc236('0x3b')],'rows':_0x17ce2d};}else{return{'count':0x0,'rows':[]};}})[_0xc236('0x19')](respondWithResult(_0x47cd85,null))[_0xc236('0x21')](function(_0x1c9f87){var _0x21da06=_0x2c037a['query']['test']?0x1f4:_0x1c9f87[_0xc236('0x7e')]||0x1f4;logger[_0xc236('0x1e')](_0xc236('0x7f'),_0xc236('0x80'),_0x21da06,JSON[_0xc236('0x1d')](_0x1c9f87));delete _0x1c9f87[_0xc236('0x2e')];if(_0x21da06===0x191){_0x21da06=0x190;}_0x47cd85['status'](_0x21da06)[_0xc236('0x81')](_0x2c037a[_0xc236('0x36')][_0xc236('0x82')]?{'message':_0xc236('0x83'),'statusCode':_0x1c9f87[_0xc236('0x7e')]}:_0x1c9f87);});}; \ No newline at end of file +var _0x110e=['info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','sendStatus','status','end','count','offset','json','apply','save','update','stack','name','send','map','ZohoAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','body','destroy','getConfigurations','findOne','ZohoConfiguration','merge','addConfiguration','AccountId','channel','Descriptions','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','serverUrl','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','Calls','Zoho-oauthtoken\x20','response','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type','system_mandatory','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','then'];(function(_0x2c3921,_0x27daf0){var _0x4d9d98=function(_0x2c1c44){while(--_0x2c1c44){_0x2c3921['push'](_0x2c3921['shift']());}};_0x4d9d98(++_0x27daf0);}(_0x110e,0x68));var _0xe110=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x110e[_0x4792c8];return _0x35edb1;};'use strict';var pdf=require(_0xe110('0x0'));var emlformat=require(_0xe110('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe110('0x2'));var jsonpatch=require(_0xe110('0x3'));var rp=require(_0xe110('0x4'));var moment=require(_0xe110('0x5'));var BPromise=require(_0xe110('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe110('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe110('0x8'));var squel=require(_0xe110('0x9'));var crypto=require(_0xe110('0xa'));var jsforce=require(_0xe110('0xb'));var deskjs=require(_0xe110('0xc'));var toCsv=require(_0xe110('0x7'));var querystring=require(_0xe110('0xd'));var Papa=require(_0xe110('0xe'));var Redis=require(_0xe110('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe110('0x10'));var as=require(_0xe110('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe110('0x12'))(_0xe110('0x13'));var utils=require(_0xe110('0x14'));var config=require(_0xe110('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xe110('0x16'));var client=jayson[_0xe110('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4aef00,_0x482022,_0x3acdbb,_0x2719c0){return new BPromise(function(_0x4ffdfe,_0x596dcf){var _0x42afec=_0x2719c0||client;return _0x42afec['request'](_0x4aef00,_0x3acdbb)[_0xe110('0x18')](function(_0x32b1be){logger[_0xe110('0x19')](_0xe110('0x1a'),_0x482022,'request\x20sent');logger[_0xe110('0x1b')](_0xe110('0x1c'),_0x482022,'request\x20sent',JSON['stringify'](_0x32b1be));if(_0x32b1be[_0xe110('0x1d')]){if(_0x32b1be['error'][_0xe110('0x1e')]===0x1f4){logger[_0xe110('0x1d')]('ZohoAccount,\x20%s,\x20%s',_0x482022,_0x32b1be[_0xe110('0x1d')][_0xe110('0x1f')]);return _0x596dcf(_0x32b1be[_0xe110('0x1d')][_0xe110('0x1f')]);}logger[_0xe110('0x1d')]('ZohoAccount,\x20%s,\x20%s',_0x482022,_0x32b1be[_0xe110('0x1d')][_0xe110('0x1f')]);return _0x4ffdfe(_0x32b1be['error'][_0xe110('0x1f')]);}else{logger[_0xe110('0x19')](_0xe110('0x1a'),_0x482022,_0xe110('0x20'));_0x4ffdfe(_0x32b1be[_0xe110('0x21')][_0xe110('0x1f')]);}})[_0xe110('0x22')](function(_0x3de3df){logger[_0xe110('0x1d')](_0xe110('0x1a'),_0x482022,_0x3de3df);_0x596dcf(_0x3de3df);});});}function respondWithStatusCode(_0x2cef74,_0x4b08ff){_0x4b08ff=_0x4b08ff||0xcc;return function(_0x17ba7c){if(_0x17ba7c){return _0x2cef74[_0xe110('0x23')](_0x4b08ff);}return _0x2cef74[_0xe110('0x24')](_0x4b08ff)[_0xe110('0x25')]();};}function respondWithResult(_0x374ccf,_0x4dc77b){_0x4dc77b=_0x4dc77b||0xc8;return function(_0x5d37d1){if(_0x5d37d1){return _0x374ccf[_0xe110('0x24')](_0x4dc77b)['json'](_0x5d37d1);}};}function respondWithFilteredResult(_0x3a5362,_0x578464){return function(_0x51a530){if(_0x51a530){var _0x5a67cd=_0x51a530[_0xe110('0x26')],_0x55f8ae=_0x578464[_0xe110('0x27')],_0x3ec248=_0x578464['offset']+_0x578464['limit'],_0x4e9876;if(_0x3ec248>=_0x5a67cd){_0x3ec248=_0x5a67cd;_0x4e9876=0xc8;}else{_0x4e9876=0xce;}_0x3a5362['status'](_0x4e9876);return _0x3a5362['set']('Content-Range',_0x55f8ae+'-'+_0x3ec248+'/'+_0x5a67cd)[_0xe110('0x28')](_0x51a530);}return null;};}function patchUpdates(_0x2de4cd){return function(_0x1a2d75){try{jsonpatch[_0xe110('0x29')](_0x1a2d75,_0x2de4cd,!![]);}catch(_0x16aa7c){return BPromise['reject'](_0x16aa7c);}return _0x1a2d75[_0xe110('0x2a')]();};}function saveUpdates(_0x53e1d3,_0x1da4b4){return function(_0x127b28){if(_0x127b28){return _0x127b28[_0xe110('0x2b')](_0x53e1d3)['then'](function(_0x2e5af1){return _0x2e5af1;});}return null;};}function removeEntity(_0x20803b,_0x2e0ca0){return function(_0x5c188e){if(_0x5c188e){return _0x5c188e['destroy']()['then'](function(){_0x20803b[_0xe110('0x24')](0xcc)[_0xe110('0x25')]();});}};}function handleEntityNotFound(_0x34eedf,_0xe7207a){return function(_0x7fe226){if(!_0x7fe226){_0x34eedf[_0xe110('0x23')](0x194);}return _0x7fe226;};}function handleError(_0x27554a,_0x563a08){_0x563a08=_0x563a08||0x1f4;return function(_0x1b0ed8){logger['error'](_0x1b0ed8[_0xe110('0x2c')]);if(_0x1b0ed8['name']){delete _0x1b0ed8[_0xe110('0x2d')];}_0x27554a['status'](_0x563a08)[_0xe110('0x2e')](_0x1b0ed8);};}exports['index']=function(_0x577aae,_0x370c38){var _0xc45e0d={},_0x1786a2={},_0x57c8b3={'count':0x0,'rows':[]};var _0x59dcd5=_[_0xe110('0x2f')](db[_0xe110('0x30')]['rawAttributes'],function(_0x7ec614){return{'name':_0x7ec614[_0xe110('0x31')],'type':_0x7ec614[_0xe110('0x32')][_0xe110('0x33')]};});_0x1786a2[_0xe110('0x34')]=_[_0xe110('0x2f')](_0x59dcd5,_0xe110('0x2d'));_0x1786a2[_0xe110('0x35')]=_[_0xe110('0x36')](_0x577aae[_0xe110('0x35')]);_0x1786a2['filters']=_[_0xe110('0x37')](_0x1786a2[_0xe110('0x34')],_0x1786a2[_0xe110('0x35')]);_0xc45e0d[_0xe110('0x38')]=_[_0xe110('0x37')](_0x1786a2[_0xe110('0x34')],qs[_0xe110('0x39')](_0x577aae[_0xe110('0x35')][_0xe110('0x39')]));_0xc45e0d[_0xe110('0x38')]=_0xc45e0d[_0xe110('0x38')][_0xe110('0x3a')]?_0xc45e0d[_0xe110('0x38')]:_0x1786a2['model'];if(!_0x577aae[_0xe110('0x35')][_0xe110('0x3b')](_0xe110('0x3c'))){_0xc45e0d[_0xe110('0x3d')]=qs['limit'](_0x577aae[_0xe110('0x35')][_0xe110('0x3d')]);_0xc45e0d['offset']=qs['offset'](_0x577aae[_0xe110('0x35')]['offset']);}_0xc45e0d[_0xe110('0x3e')]=qs[_0xe110('0x3f')](_0x577aae[_0xe110('0x35')][_0xe110('0x3f')]);_0xc45e0d[_0xe110('0x40')]=qs['filters'](_[_0xe110('0x41')](_0x577aae[_0xe110('0x35')],_0x1786a2[_0xe110('0x42')]),_0x59dcd5);if(_0x577aae['query'][_0xe110('0x43')]){_0xc45e0d[_0xe110('0x40')]=_['merge'](_0xc45e0d[_0xe110('0x40')],{'$or':_[_0xe110('0x2f')](_0x59dcd5,function(_0x93a854){if(_0x93a854['type']!==_0xe110('0x44')){var _0x133222={};_0x133222[_0x93a854['name']]={'$like':'%'+_0x577aae[_0xe110('0x35')]['filter']+'%'};return _0x133222;}})});}_0xc45e0d=_['merge']({},_0xc45e0d,_0x577aae[_0xe110('0x45')]);var _0x538f43={'where':_0xc45e0d[_0xe110('0x40')]};return db['ZohoAccount']['count'](_0x538f43)[_0xe110('0x18')](function(_0x48196c){_0x57c8b3['count']=_0x48196c;if(_0x577aae['query'][_0xe110('0x46')]){_0xc45e0d[_0xe110('0x47')]=[{'all':!![]}];}return db[_0xe110('0x30')][_0xe110('0x48')](_0xc45e0d);})[_0xe110('0x18')](function(_0x58d75a){_0x57c8b3[_0xe110('0x49')]=_0x58d75a;return _0x57c8b3;})[_0xe110('0x18')](respondWithFilteredResult(_0x370c38,_0xc45e0d))['catch'](handleError(_0x370c38,null));};exports[_0xe110('0x4a')]=function(_0x4e67fc,_0x2de907){var _0x237cd8={'raw':![],'where':{'id':_0x4e67fc[_0xe110('0x4b')]['id']}},_0x4716ec={};_0x4716ec[_0xe110('0x34')]=_[_0xe110('0x36')](db[_0xe110('0x30')][_0xe110('0x4c')]);_0x4716ec[_0xe110('0x35')]=_[_0xe110('0x36')](_0x4e67fc['query']);_0x4716ec['filters']=_['intersection'](_0x4716ec[_0xe110('0x34')],_0x4716ec[_0xe110('0x35')]);_0x237cd8['attributes']=_['intersection'](_0x4716ec[_0xe110('0x34')],qs['fields'](_0x4e67fc[_0xe110('0x35')][_0xe110('0x39')]));_0x237cd8[_0xe110('0x38')]=_0x237cd8['attributes'][_0xe110('0x3a')]?_0x237cd8['attributes']:_0x4716ec['model'];if(_0x4e67fc[_0xe110('0x35')][_0xe110('0x46')]){_0x237cd8[_0xe110('0x47')]=[{'all':!![]}];}_0x237cd8=_['merge']({},_0x237cd8,_0x4e67fc[_0xe110('0x45')]);return db[_0xe110('0x30')][_0xe110('0x4d')](_0x237cd8)[_0xe110('0x18')](handleEntityNotFound(_0x2de907,null))['then'](respondWithResult(_0x2de907,null))[_0xe110('0x22')](handleError(_0x2de907,null));};exports['create']=function(_0x3a5ca3,_0x119dad){return db[_0xe110('0x30')][_0xe110('0x4e')](_0x3a5ca3[_0xe110('0x4f')],{})[_0xe110('0x18')](respondWithResult(_0x119dad,0xc9))[_0xe110('0x22')](handleError(_0x119dad,null));};exports['update']=function(_0x5288ce,_0x4b7119){if(_0x5288ce['body']['id']){delete _0x5288ce[_0xe110('0x4f')]['id'];}return db[_0xe110('0x30')]['find']({'where':{'id':_0x5288ce['params']['id']}})[_0xe110('0x18')](handleEntityNotFound(_0x4b7119,null))[_0xe110('0x18')](saveUpdates(_0x5288ce[_0xe110('0x4f')],null))[_0xe110('0x18')](respondWithResult(_0x4b7119,null))[_0xe110('0x22')](handleError(_0x4b7119,null));};exports[_0xe110('0x50')]=function(_0x2cd0db,_0x3dd3d0){return db[_0xe110('0x30')][_0xe110('0x4d')]({'where':{'id':_0x2cd0db[_0xe110('0x4b')]['id']}})[_0xe110('0x18')](handleEntityNotFound(_0x3dd3d0,null))[_0xe110('0x18')](removeEntity(_0x3dd3d0,null))['catch'](handleError(_0x3dd3d0,null));};exports[_0xe110('0x51')]=function(_0x566fa8,_0x22f874,_0x301678){var _0x594772={};var _0x4a270e={};var _0x1e03ca;var _0x596a64;return db[_0xe110('0x30')][_0xe110('0x52')]({'where':{'id':_0x566fa8['params']['id']}})['then'](handleEntityNotFound(_0x22f874,null))[_0xe110('0x18')](function(_0x5b5279){if(_0x5b5279){_0x1e03ca=_0x5b5279;_0x4a270e[_0xe110('0x34')]=_[_0xe110('0x36')](db[_0xe110('0x53')][_0xe110('0x4c')]);_0x4a270e[_0xe110('0x35')]=_[_0xe110('0x36')](_0x566fa8[_0xe110('0x35')]);_0x4a270e[_0xe110('0x42')]=_[_0xe110('0x37')](_0x4a270e['model'],_0x4a270e[_0xe110('0x35')]);_0x594772[_0xe110('0x38')]=_[_0xe110('0x37')](_0x4a270e[_0xe110('0x34')],qs['fields'](_0x566fa8['query'][_0xe110('0x39')]));_0x594772[_0xe110('0x38')]=_0x594772[_0xe110('0x38')]['length']?_0x594772[_0xe110('0x38')]:_0x4a270e[_0xe110('0x34')];_0x594772['order']=qs[_0xe110('0x3f')](_0x566fa8[_0xe110('0x35')]['sort']);_0x594772['where']=qs[_0xe110('0x42')](_['pick'](_0x566fa8[_0xe110('0x35')],_0x4a270e[_0xe110('0x42')]));if(_0x566fa8[_0xe110('0x35')][_0xe110('0x43')]){_0x594772[_0xe110('0x40')]=_[_0xe110('0x54')](_0x594772[_0xe110('0x40')],{'$or':_[_0xe110('0x2f')](_0x594772['attributes'],function(_0x3ded64){var _0x4c7dc9={};_0x4c7dc9[_0x3ded64]={'$like':'%'+_0x566fa8[_0xe110('0x35')]['filter']+'%'};return _0x4c7dc9;})});}_0x594772=_[_0xe110('0x54')]({},_0x594772,_0x566fa8['options']);return _0x1e03ca['getConfigurations'](_0x594772);}})[_0xe110('0x18')](function(_0x6897b4){if(_0x6897b4){_0x596a64=_0x6897b4[_0xe110('0x3a')];if(!_0x566fa8[_0xe110('0x35')][_0xe110('0x3b')]('nolimit')){_0x594772[_0xe110('0x3d')]=qs[_0xe110('0x3d')](_0x566fa8[_0xe110('0x35')]['limit']);_0x594772[_0xe110('0x27')]=qs[_0xe110('0x27')](_0x566fa8[_0xe110('0x35')][_0xe110('0x27')]);}return _0x1e03ca[_0xe110('0x51')](_0x594772);}})['then'](function(_0x3c1a48){if(_0x3c1a48){return _0x3c1a48?{'count':_0x596a64,'rows':_0x3c1a48}:null;}})[_0xe110('0x18')](respondWithResult(_0x22f874,null))[_0xe110('0x22')](handleError(_0x22f874,null));};exports[_0xe110('0x55')]=function(_0x2962eb,_0x5aa70d,_0x53d5e3){if(_0x2962eb[_0xe110('0x4f')]['id']){delete _0x2962eb[_0xe110('0x4f')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x2962eb['params']['id']}})[_0xe110('0x18')](handleEntityNotFound(_0x5aa70d,null))[_0xe110('0x18')](function(_0x3a494e){if(_0x3a494e){_0x2962eb[_0xe110('0x4f')][_0xe110('0x56')]=_0x3a494e['id'];_0x2962eb[_0xe110('0x4f')]['Subjects']=integrations['getSubjects'](_0x2962eb[_0xe110('0x4f')][_0xe110('0x57')],_0x2962eb[_0xe110('0x4f')][_0xe110('0x32')]);_0x2962eb[_0xe110('0x4f')][_0xe110('0x58')]=integrations['getDescriptions'](_0x2962eb[_0xe110('0x4f')][_0xe110('0x57')],_0x2962eb['body'][_0xe110('0x32')]);return db['ZohoConfiguration'][_0xe110('0x4e')](_0x2962eb[_0xe110('0x4f')],{'include':[{'model':db['ZohoField'],'as':_0xe110('0x59')},{'model':db['ZohoField'],'as':_0xe110('0x58')}]});}return null;})[_0xe110('0x18')](respondWithResult(_0x5aa70d,null))[_0xe110('0x22')](handleError(_0x5aa70d,null));};function getAccessToken(_0x2cf1d6){return new Promise(function(_0xc42cee,_0x15d0e7){var _0x4b2f71;switch(_0x2cf1d6[_0xe110('0x5a')]){case'US':_0x4b2f71=_0xe110('0x5b');break;case'AU':_0x4b2f71='https://accounts.zoho.com.au';break;case'EU':_0x4b2f71=_0xe110('0x5c');break;case'IN':_0x4b2f71=_0xe110('0x5d');break;case'CN':_0x4b2f71=_0xe110('0x5e');break;default:_0x4b2f71='https://accounts.zoho.eu';break;}var _0x23a15d={'method':'POST','uri':_0x4b2f71+_0xe110('0x5f'),'qs':{'refresh_token':_0x2cf1d6[_0xe110('0x60')],'client_id':_0x2cf1d6[_0xe110('0x61')],'client_secret':_0x2cf1d6[_0xe110('0x62')],'grant_type':_0xe110('0x63')},'json':!![]};return rp(_0x23a15d)['then'](function(_0x4ea464){if(_0x4ea464[_0xe110('0x64')]){_0xc42cee(_0x4ea464[_0xe110('0x64')]);}else{_0x15d0e7(_0xe110('0x65'));}})[_0xe110('0x22')](function(_0x95e111){_0x15d0e7(_0x95e111);});});}exports['getFields']=function(_0x17f546,_0x4a5456,_0x1c932b){var _0x37a686,_0x31cd4f,_0x33f56e,_0xb2dd49,_0x320fc7;return db[_0xe110('0x30')]['findOne']({'where':{'id':_0x17f546[_0xe110('0x4b')]['id']},'attributes':['id',_0xe110('0x66'),_0xe110('0x5a'),'clientId',_0xe110('0x62'),_0xe110('0x67'),_0xe110('0x1e'),_0xe110('0x60')]})[_0xe110('0x18')](handleEntityNotFound(_0x4a5456,null))[_0xe110('0x18')](function(_0x27d577){_0x320fc7=_0x27d577;_0x37a686=_0x320fc7[_0xe110('0x66')];_0x31cd4f=_0x37a686===_0xe110('0x68')?'eu':'com';_0x33f56e=_0x320fc7[_0xe110('0x67')];var _0x4ca1b4=_0x33f56e[_0xe110('0x69')](-0x1);if(_0x4ca1b4==='/'||_0x4ca1b4==='\x5c'||_0x4ca1b4===':'){_0x33f56e=_0x33f56e[_0xe110('0x6a')](0x0,_0x33f56e[_0xe110('0x6b')](_0x4ca1b4));}if(!_0x320fc7[_0xe110('0x60')]){throw new Error(_0xe110('0x6c'));}return getAccessToken(_0x320fc7);})[_0xe110('0x18')](function(_0x5d32d6){if(_0x5d32d6){return rp({'method':'GET','uri':util[_0xe110('0x6d')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x31cd4f),'qs':{'module':_0xe110('0x6e')},'headers':{'Authorization':_0xe110('0x6f')+_0x5d32d6},'json':!![]});}})['then'](function(_0x1ee4f6){if(_0x1ee4f6){if(_0x1ee4f6[_0xe110('0x70')]&&_0x1ee4f6['response'][_0xe110('0x1d')]){throw new Error(_0x1ee4f6[_0xe110('0x70')][_0xe110('0x1d')]['message']);}var _0x20c030=[];var _0x155054=[];var _0x9c02d4=['Owner',_0xe110('0x71'),_0xe110('0x72'),'WhoId',_0xe110('0x73'),_0xe110('0x74'),_0xe110('0x75'),_0xe110('0x76')];_0x155054=_['remove'](_0x1ee4f6[_0xe110('0x39')],function(_0x5dfbd9){return _0x9c02d4['includes'](_0x5dfbd9['api_name']);});for(var _0x1176f2=0x0;_0x1176f2<_0x155054[_0xe110('0x3a')];_0x1176f2++){if(_0x155054[_0x1176f2][_0xe110('0x77')]===![]){_0x20c030['push']({'id':_0x155054[_0x1176f2]['id'],'name':_0x155054[_0x1176f2]['display_label'],'custom':_0x155054[_0x1176f2][_0xe110('0x78')],'options':_0x155054[_0x1176f2][_0xe110('0x79')]===_0xe110('0x7a')&&_0x155054[_0x1176f2]['pick_list_values'][_0xe110('0x3a')]>-0x1?_[_0xe110('0x2f')](_0x155054[_0x1176f2][_0xe110('0x7b')],function(_0x15e97f){return{'name':_0x15e97f,'value':_0x15e97f};}):[]});}}return{'count':_0x20c030['length'],'rows':_0x20c030};}else{return{'count':0x0,'rows':[]};}})[_0xe110('0x18')](respondWithResult(_0x4a5456,null))['catch'](function(_0x58286d){var _0x4319fe=_0x17f546[_0xe110('0x35')][_0xe110('0x7c')]?0x1f4:_0x58286d[_0xe110('0x7d')]||0x1f4;logger[_0xe110('0x1d')](_0xe110('0x7e'),_0xe110('0x7f'),_0x4319fe,JSON[_0xe110('0x80')](_0x58286d));delete _0x58286d[_0xe110('0x2d')];if(_0x4319fe===0x191){_0x4319fe=0x190;}_0x4a5456[_0xe110('0x24')](_0x4319fe)[_0xe110('0x2e')](_0x17f546[_0xe110('0x35')][_0xe110('0x7c')]?{'message':'Wrong\x20credentials','statusCode':_0x58286d[_0xe110('0x7d')]}:_0x58286d);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 19fee71..22a369a 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 _0xd215=['https://accounts.zoho.com','https://accounts.zoho.in','POST','authorization_code','lodash','util','api','moment','request-promise','../../config/environment','./intZohoAccount.attributes','exports','define','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.eu','/oauth/v2/token','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','name','slice'];(function(_0xf3d379,_0x6ce552){var _0x4107a1=function(_0xf69bc5){while(--_0xf69bc5){_0xf3d379['push'](_0xf3d379['shift']());}};_0x4107a1(++_0x6ce552);}(_0xd215,0x18a));var _0x5d21=function(_0x162f05,_0x15898c){_0x162f05=_0x162f05-0x0;var _0x263946=_0xd215[_0x162f05];return _0x263946;};'use strict';var _=require(_0x5d21('0x0'));var util=require(_0x5d21('0x1'));var logger=require('../../config/logger')(_0x5d21('0x2'));var moment=require(_0x5d21('0x3'));var BPromise=require('bluebird');var rp=require(_0x5d21('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5d21('0x5'));var attributes=require(_0x5d21('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x5d21('0x7')]=function(_0x4ad003,_0x59a3ea){return _0x4ad003[_0x5d21('0x8')]('ZohoAccount',attributes,{'tableName':_0x5d21('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x15c8d8,_0x8530b0,_0x37600d){if(_0x15c8d8[_0x5d21('0xa')](_0x5d21('0xb'))||_0x15c8d8['changed'](_0x5d21('0xc'))||_0x15c8d8['changed'](_0x5d21('0xd'))||_0x15c8d8[_0x5d21('0xa')](_0x5d21('0xe'))||_0x15c8d8[_0x5d21('0xa')](_0x5d21('0xf'))||_0x15c8d8[_0x5d21('0xa')](_0x5d21('0x10'))){var _0x48f460,_0x2ffb60;_0x48f460=_0x15c8d8[_0x5d21('0xc')];var _0x46b287=_0x48f460['slice'](-0x1);if(_0x46b287==='/'||_0x46b287==='\x5c'||_0x46b287===':'){_0x48f460=_0x48f460[_0x5d21('0x11')](0x0,_0x48f460[_0x5d21('0x12')](_0x46b287));}switch(_0x15c8d8[_0x5d21('0xb')]){case'US':_0x2ffb60='https://accounts.zoho.com';break;case'AU':_0x2ffb60=_0x5d21('0x13');break;case'IN':_0x2ffb60='https://accounts.zoho.in';break;case'CN':_0x2ffb60='https://accounts.zoho.com.cn';break;default:_0x2ffb60=_0x5d21('0x14');break;}var _0x461b2c={'method':'POST','uri':_0x2ffb60+_0x5d21('0x15'),'form':{'grant_type':'authorization_code','client_id':_0x15c8d8[_0x5d21('0xd')],'client_secret':_0x15c8d8[_0x5d21('0xe')],'redirect_uri':_0x15c8d8[_0x5d21('0xc')],'code':_0x15c8d8[_0x5d21('0xf')]},'headers':{'Content-Type':_0x5d21('0x16')}};return rp(_0x461b2c)[_0x5d21('0x17')](function(_0x2eb9de){var _0x332da4=JSON[_0x5d21('0x18')](_0x2eb9de);if(_0x332da4[_0x5d21('0x19')]){_0x15c8d8[_0x5d21('0x1a')]=_0x332da4[_0x5d21('0x19')];logger[_0x5d21('0x1b')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x15c8d8['name'],_0x15c8d8['id']));}else{logger[_0x5d21('0x1c')](util[_0x5d21('0x1d')](_0x5d21('0x1e'),_0x15c8d8['name'],_0x15c8d8['id']),util[_0x5d21('0x1f')](_0x332da4,{'showHidden':![],'depth':null}));}return _0x37600d(null,_0x8530b0);})[_0x5d21('0x20')](function(_0x58baf4){logger[_0x5d21('0x1c')](util['format'](_0x5d21('0x1e'),_0x15c8d8[_0x5d21('0x21')],_0x15c8d8['id']),util[_0x5d21('0x1f')](parsedResult,{'showHidden':![],'depth':null}));return _0x37600d(_0x58baf4);});}else{return _0x37600d(null,_0x8530b0);}},'beforeUpdate':function(_0x58abf0,_0x417478,_0x3576fb){if(_0x58abf0[_0x5d21('0xa')](_0x5d21('0xb'))||_0x58abf0['changed']('serverUrl')||_0x58abf0['changed'](_0x5d21('0xd'))||_0x58abf0[_0x5d21('0xa')](_0x5d21('0xe'))||_0x58abf0[_0x5d21('0xa')]('code')||_0x58abf0['changed'](_0x5d21('0x10'))){var _0x404469,_0x409b19;_0x404469=_0x58abf0['serverUrl'];var _0x177c0c=_0x404469[_0x5d21('0x22')](-0x1);if(_0x177c0c==='/'||_0x177c0c==='\x5c'||_0x177c0c===':'){_0x404469=_0x404469['substring'](0x0,_0x404469[_0x5d21('0x12')](_0x177c0c));}switch(_0x58abf0[_0x5d21('0xb')]){case'US':_0x409b19=_0x5d21('0x23');break;case'AU':_0x409b19=_0x5d21('0x13');break;case'IN':_0x409b19=_0x5d21('0x24');break;case'CN':_0x409b19='https://accounts.zoho.com.cn';break;default:_0x409b19='https://accounts.zoho.eu';break;}var _0x3ad509={'method':_0x5d21('0x25'),'uri':_0x409b19+_0x5d21('0x15'),'form':{'grant_type':_0x5d21('0x26'),'client_id':_0x58abf0[_0x5d21('0xd')],'client_secret':_0x58abf0[_0x5d21('0xe')],'redirect_uri':_0x58abf0[_0x5d21('0xc')],'code':_0x58abf0[_0x5d21('0xf')]},'headers':{'Content-Type':_0x5d21('0x16')}};return rp(_0x3ad509)[_0x5d21('0x17')](function(_0x56c4b6){var _0x1097f9=JSON['parse'](_0x56c4b6);if(_0x1097f9[_0x5d21('0x19')]){_0x58abf0[_0x5d21('0x1a')]=_0x1097f9[_0x5d21('0x19')];logger[_0x5d21('0x1b')](util[_0x5d21('0x1d')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x58abf0[_0x5d21('0x21')],_0x58abf0['id']));}else{logger[_0x5d21('0x1c')](util[_0x5d21('0x1d')](_0x5d21('0x1e'),_0x58abf0[_0x5d21('0x21')],_0x58abf0['id']),util[_0x5d21('0x1f')](_0x1097f9,{'showHidden':![],'depth':null}));}return _0x3576fb(null,_0x417478);})['catch'](function(_0x2d6d94){logger[_0x5d21('0x1c')](util[_0x5d21('0x1d')](_0x5d21('0x1e'),_0x58abf0[_0x5d21('0x21')],_0x58abf0['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x3576fb(_0x2d6d94);});}else{return _0x3576fb(null,_0x417478);}}}});}; \ No newline at end of file +var _0xd972=['serverUrl','clientId','code','lastIndexOf','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','clientSecret','application/x-www-form-urlencoded','then','parse','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','slice','https://accounts.zoho.com','refresh_token','info','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','changed'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xd972,0x6c));var _0x2d97=function(_0x36dd9f,_0x2101e){_0x36dd9f=_0x36dd9f-0x0;var _0x25c43f=_0xd972[_0x36dd9f];return _0x25c43f;};'use strict';var _=require(_0x2d97('0x0'));var util=require(_0x2d97('0x1'));var logger=require(_0x2d97('0x2'))(_0x2d97('0x3'));var moment=require('moment');var BPromise=require(_0x2d97('0x4'));var rp=require(_0x2d97('0x5'));var fs=require('fs');var path=require(_0x2d97('0x6'));var rimraf=require(_0x2d97('0x7'));var config=require(_0x2d97('0x8'));var attributes=require(_0x2d97('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x2d97('0xa')]=function(_0x5e3b4f,_0x19c2b5){return _0x5e3b4f[_0x2d97('0xb')](_0x2d97('0xc'),attributes,{'tableName':_0x2d97('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x43ac70,_0xee909d,_0x3663e9){if(_0x43ac70[_0x2d97('0xe')]('zone')||_0x43ac70[_0x2d97('0xe')](_0x2d97('0xf'))||_0x43ac70[_0x2d97('0xe')](_0x2d97('0x10'))||_0x43ac70[_0x2d97('0xe')]('clientSecret')||_0x43ac70[_0x2d97('0xe')](_0x2d97('0x11'))||_0x43ac70[_0x2d97('0xe')]('host')){var _0x1ce08d,_0x1abc33;_0x1ce08d=_0x43ac70[_0x2d97('0xf')];var _0xfb2426=_0x1ce08d['slice'](-0x1);if(_0xfb2426==='/'||_0xfb2426==='\x5c'||_0xfb2426===':'){_0x1ce08d=_0x1ce08d['substring'](0x0,_0x1ce08d[_0x2d97('0x12')](_0xfb2426));}switch(_0x43ac70[_0x2d97('0x13')]){case'US':_0x1abc33='https://accounts.zoho.com';break;case'AU':_0x1abc33=_0x2d97('0x14');break;case'IN':_0x1abc33=_0x2d97('0x15');break;case'CN':_0x1abc33=_0x2d97('0x16');break;default:_0x1abc33=_0x2d97('0x17');break;}var _0x3a207a={'method':_0x2d97('0x18'),'uri':_0x1abc33+'/oauth/v2/token','form':{'grant_type':_0x2d97('0x19'),'client_id':_0x43ac70[_0x2d97('0x10')],'client_secret':_0x43ac70[_0x2d97('0x1a')],'redirect_uri':_0x43ac70[_0x2d97('0xf')],'code':_0x43ac70[_0x2d97('0x11')]},'headers':{'Content-Type':_0x2d97('0x1b')}};return rp(_0x3a207a)[_0x2d97('0x1c')](function(_0x373c4c){var _0x1b5772=JSON[_0x2d97('0x1d')](_0x373c4c);if(_0x1b5772['refresh_token']){_0x43ac70['refreshToken']=_0x1b5772['refresh_token'];logger['info'](util[_0x2d97('0x1e')](_0x2d97('0x1f'),_0x43ac70[_0x2d97('0x20')],_0x43ac70['id']));}else{logger[_0x2d97('0x21')](util[_0x2d97('0x1e')](_0x2d97('0x22'),_0x43ac70[_0x2d97('0x20')],_0x43ac70['id']),util[_0x2d97('0x23')](_0x1b5772,{'showHidden':![],'depth':null}));}return _0x3663e9(null,_0xee909d);})[_0x2d97('0x24')](function(_0x296f0b){logger[_0x2d97('0x21')](util[_0x2d97('0x1e')](_0x2d97('0x22'),_0x43ac70[_0x2d97('0x20')],_0x43ac70['id']),util[_0x2d97('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x3663e9(_0x296f0b);});}else{return _0x3663e9(null,_0xee909d);}},'beforeUpdate':function(_0x42a5cb,_0x479b56,_0xfa693d){if(_0x42a5cb[_0x2d97('0xe')](_0x2d97('0x13'))||_0x42a5cb[_0x2d97('0xe')]('serverUrl')||_0x42a5cb[_0x2d97('0xe')](_0x2d97('0x10'))||_0x42a5cb['changed'](_0x2d97('0x1a'))||_0x42a5cb[_0x2d97('0xe')](_0x2d97('0x11'))||_0x42a5cb[_0x2d97('0xe')]('host')){var _0x23c7b6,_0x2fbb09;_0x23c7b6=_0x42a5cb[_0x2d97('0xf')];var _0x5267d0=_0x23c7b6[_0x2d97('0x25')](-0x1);if(_0x5267d0==='/'||_0x5267d0==='\x5c'||_0x5267d0===':'){_0x23c7b6=_0x23c7b6['substring'](0x0,_0x23c7b6[_0x2d97('0x12')](_0x5267d0));}switch(_0x42a5cb['zone']){case'US':_0x2fbb09=_0x2d97('0x26');break;case'AU':_0x2fbb09=_0x2d97('0x14');break;case'IN':_0x2fbb09='https://accounts.zoho.in';break;case'CN':_0x2fbb09=_0x2d97('0x16');break;default:_0x2fbb09='https://accounts.zoho.eu';break;}var _0x36811f={'method':'POST','uri':_0x2fbb09+'/oauth/v2/token','form':{'grant_type':_0x2d97('0x19'),'client_id':_0x42a5cb[_0x2d97('0x10')],'client_secret':_0x42a5cb['clientSecret'],'redirect_uri':_0x42a5cb['serverUrl'],'code':_0x42a5cb[_0x2d97('0x11')]},'headers':{'Content-Type':_0x2d97('0x1b')}};return rp(_0x36811f)[_0x2d97('0x1c')](function(_0x500c9e){var _0x44e11e=JSON[_0x2d97('0x1d')](_0x500c9e);if(_0x44e11e[_0x2d97('0x27')]){_0x42a5cb['refreshToken']=_0x44e11e[_0x2d97('0x27')];logger[_0x2d97('0x28')](util['format'](_0x2d97('0x1f'),_0x42a5cb[_0x2d97('0x20')],_0x42a5cb['id']));}else{logger['error'](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x42a5cb[_0x2d97('0x20')],_0x42a5cb['id']),util[_0x2d97('0x23')](_0x44e11e,{'showHidden':![],'depth':null}));}return _0xfa693d(null,_0x479b56);})[_0x2d97('0x24')](function(_0x1884de){logger[_0x2d97('0x21')](util['format'](_0x2d97('0x22'),_0x42a5cb[_0x2d97('0x20')],_0x42a5cb['id']),util[_0x2d97('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0xfa693d(_0x1884de);});}else{return _0xfa693d(null,_0x479b56);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 4552b25..31b6533 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 _0x03e9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','GetZohoAccount','ZohoAccount','findAll','options','raw','where','include','map','model','attributes','debug','ShowZohoAccount','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x49b6b6,_0x54b0f0){var _0x188c67=function(_0x55644c){while(--_0x55644c){_0x49b6b6['push'](_0x49b6b6['shift']());}};_0x188c67(++_0x54b0f0);}(_0x03e9,0x13f));var _0x903e=function(_0x5c372d,_0x462038){_0x5c372d=_0x5c372d-0x0;var _0xa61c6e=_0x03e9[_0x5c372d];return _0xa61c6e;};'use strict';var _=require(_0x903e('0x0'));var util=require(_0x903e('0x1'));var moment=require('moment');var BPromise=require(_0x903e('0x2'));var rs=require(_0x903e('0x3'));var fs=require('fs');var Redis=require(_0x903e('0x4'));var db=require(_0x903e('0x5'))['db'];var utils=require(_0x903e('0x6'));var logger=require(_0x903e('0x7'))('rpc');var config=require(_0x903e('0x8'));var jayson=require(_0x903e('0x9'));var client=jayson[_0x903e('0xa')][_0x903e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36e697,_0x1b2754,_0x1937ca){return new BPromise(function(_0x471cdc,_0x47f79c){return client[_0x903e('0xc')](_0x36e697,_0x1937ca)[_0x903e('0xd')](function(_0x134020){logger[_0x903e('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x1b2754,_0x903e('0xf'));logger['debug'](_0x903e('0x10'),_0x1b2754,'request\x20sent',JSON[_0x903e('0x11')](_0x134020));if(_0x134020['error']){if(_0x134020[_0x903e('0x12')][_0x903e('0x13')]===0x1f4){logger['error'](_0x903e('0x14'),_0x1b2754,_0x134020[_0x903e('0x12')][_0x903e('0x15')]);return _0x47f79c(_0x134020[_0x903e('0x12')][_0x903e('0x15')]);}logger[_0x903e('0x12')](_0x903e('0x14'),_0x1b2754,_0x134020['error']['message']);return _0x471cdc(_0x134020['error'][_0x903e('0x15')]);}else{logger[_0x903e('0xe')](_0x903e('0x14'),_0x1b2754,_0x903e('0xf'));_0x471cdc(_0x134020[_0x903e('0x16')][_0x903e('0x15')]);}})['catch'](function(_0x4aeb1e){logger[_0x903e('0x12')](_0x903e('0x14'),_0x1b2754,_0x4aeb1e);_0x47f79c(_0x4aeb1e);});});}exports[_0x903e('0x17')]=function(_0x14b783){var _0x13f1a0=this;return new Promise(function(_0x8b8e36,_0x121d5a){return db[_0x903e('0x18')][_0x903e('0x19')]({'raw':_0x14b783['options']?_0x14b783[_0x903e('0x1a')][_0x903e('0x1b')]===undefined?!![]:![]:!![],'where':_0x14b783[_0x903e('0x1a')]?_0x14b783['options'][_0x903e('0x1c')]||null:null,'attributes':_0x14b783[_0x903e('0x1a')]?_0x14b783[_0x903e('0x1a')]['attributes']||null:null,'limit':_0x14b783[_0x903e('0x1a')]?_0x14b783['options']['limit']||null:null,'include':_0x14b783[_0x903e('0x1a')]?_0x14b783[_0x903e('0x1a')][_0x903e('0x1d')]?_[_0x903e('0x1e')](_0x14b783[_0x903e('0x1a')]['include'],function(_0x50277f){return{'model':db[_0x50277f[_0x903e('0x1f')]],'as':_0x50277f['as'],'attributes':_0x50277f[_0x903e('0x20')],'include':_0x50277f[_0x903e('0x1d')]?_['map'](_0x50277f['include'],function(_0x4a92e8){return{'model':db[_0x4a92e8[_0x903e('0x1f')]],'as':_0x4a92e8['as'],'attributes':_0x4a92e8[_0x903e('0x20')],'include':_0x4a92e8['include']?_[_0x903e('0x1e')](_0x4a92e8[_0x903e('0x1d')],function(_0x1643b9){return{'model':db[_0x1643b9[_0x903e('0x1f')]],'as':_0x1643b9['as'],'attributes':_0x1643b9['attributes']};}):[]};}):[]};}):[]:[]})[_0x903e('0xd')](function(_0x32bbdd){logger[_0x903e('0xe')]('GetZohoAccount',_0x14b783);logger[_0x903e('0x21')]('GetZohoAccount',_0x14b783,JSON[_0x903e('0x11')](_0x32bbdd));_0x8b8e36(_0x32bbdd);})['catch'](function(_0xb4e297){logger[_0x903e('0x12')](_0x903e('0x17'),_0xb4e297[_0x903e('0x15')],_0x14b783);_0x121d5a(_0x13f1a0[_0x903e('0x12')](0x1f4,_0xb4e297[_0x903e('0x15')]));});});};exports[_0x903e('0x22')]=function(_0x4744c5){var _0x39a226=this;return new Promise(function(_0x5d23d2,_0x4ba580){return db[_0x903e('0x18')]['find']({'raw':_0x4744c5[_0x903e('0x1a')]?_0x4744c5[_0x903e('0x1a')][_0x903e('0x1b')]===undefined?!![]:![]:!![],'where':_0x4744c5[_0x903e('0x1a')]?_0x4744c5[_0x903e('0x1a')][_0x903e('0x1c')]||null:null,'attributes':_0x4744c5[_0x903e('0x1a')]?_0x4744c5[_0x903e('0x1a')][_0x903e('0x20')]||null:null,'include':_0x4744c5[_0x903e('0x1a')]?_0x4744c5[_0x903e('0x1a')]['include']?_[_0x903e('0x1e')](_0x4744c5['options'][_0x903e('0x1d')],function(_0x1215af){return{'model':db[_0x1215af['model']],'as':_0x1215af['as'],'attributes':_0x1215af[_0x903e('0x20')],'include':_0x1215af['include']?_[_0x903e('0x1e')](_0x1215af['include'],function(_0x1a53a1){return{'model':db[_0x1a53a1[_0x903e('0x1f')]],'as':_0x1a53a1['as'],'attributes':_0x1a53a1['attributes'],'include':_0x1a53a1['include']?_[_0x903e('0x1e')](_0x1a53a1['include'],function(_0x2e280b){return{'model':db[_0x2e280b[_0x903e('0x1f')]],'as':_0x2e280b['as'],'attributes':_0x2e280b[_0x903e('0x20')]};}):[]};}):[]};}):[]:[]})[_0x903e('0xd')](function(_0x5ebf3c){logger[_0x903e('0xe')](_0x903e('0x22'),_0x4744c5);logger['debug'](_0x903e('0x22'),_0x4744c5,JSON[_0x903e('0x11')](_0x5ebf3c));_0x5d23d2(_0x5ebf3c);})[_0x903e('0x23')](function(_0x376bb4){logger[_0x903e('0x12')]('ShowZohoAccount',_0x376bb4[_0x903e('0x15')],_0x4744c5);_0x4ba580(_0x39a226[_0x903e('0x12')](0x1f4,_0x376bb4[_0x903e('0x15')]));});});}; \ No newline at end of file +var _0xb8c3=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ZohoAccount,\x20%s,\x20%s','catch','GetZohoAccount','findAll','options','raw','where','attributes','limit','map','include','model','ShowZohoAccount','ZohoAccount','find','lodash'];(function(_0x5389c6,_0x33b413){var _0x47cd79=function(_0x3a7d1e){while(--_0x3a7d1e){_0x5389c6['push'](_0x5389c6['shift']());}};_0x47cd79(++_0x33b413);}(_0xb8c3,0x127));var _0x3b8c=function(_0x4319b3,_0x343fec){_0x4319b3=_0x4319b3-0x0;var _0x4ce20c=_0xb8c3[_0x4319b3];return _0x4ce20c;};'use strict';var _=require(_0x3b8c('0x0'));var util=require(_0x3b8c('0x1'));var moment=require(_0x3b8c('0x2'));var BPromise=require(_0x3b8c('0x3'));var rs=require(_0x3b8c('0x4'));var fs=require('fs');var Redis=require(_0x3b8c('0x5'));var db=require(_0x3b8c('0x6'))['db'];var utils=require(_0x3b8c('0x7'));var logger=require(_0x3b8c('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3b8c('0x9'));var client=jayson[_0x3b8c('0xa')][_0x3b8c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5efb07,_0x237c83,_0x49b5ca){return new BPromise(function(_0x42fb67,_0x2d34ad){return client[_0x3b8c('0xc')](_0x5efb07,_0x49b5ca)[_0x3b8c('0xd')](function(_0x72d55c){logger[_0x3b8c('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x237c83,_0x3b8c('0xf'));logger[_0x3b8c('0x10')](_0x3b8c('0x11'),_0x237c83,_0x3b8c('0xf'),JSON[_0x3b8c('0x12')](_0x72d55c));if(_0x72d55c[_0x3b8c('0x13')]){if(_0x72d55c[_0x3b8c('0x13')][_0x3b8c('0x14')]===0x1f4){logger[_0x3b8c('0x13')]('ZohoAccount,\x20%s,\x20%s',_0x237c83,_0x72d55c[_0x3b8c('0x13')][_0x3b8c('0x15')]);return _0x2d34ad(_0x72d55c[_0x3b8c('0x13')][_0x3b8c('0x15')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x237c83,_0x72d55c[_0x3b8c('0x13')][_0x3b8c('0x15')]);return _0x42fb67(_0x72d55c['error'][_0x3b8c('0x15')]);}else{logger[_0x3b8c('0xe')](_0x3b8c('0x16'),_0x237c83,_0x3b8c('0xf'));_0x42fb67(_0x72d55c['result'][_0x3b8c('0x15')]);}})[_0x3b8c('0x17')](function(_0x1b4f00){logger[_0x3b8c('0x13')](_0x3b8c('0x16'),_0x237c83,_0x1b4f00);_0x2d34ad(_0x1b4f00);});});}exports[_0x3b8c('0x18')]=function(_0x61056c){var _0x1b09b0=this;return new Promise(function(_0x2e6a7f,_0x1bd0d9){return db['ZohoAccount'][_0x3b8c('0x19')]({'raw':_0x61056c[_0x3b8c('0x1a')]?_0x61056c['options'][_0x3b8c('0x1b')]===undefined?!![]:![]:!![],'where':_0x61056c['options']?_0x61056c[_0x3b8c('0x1a')][_0x3b8c('0x1c')]||null:null,'attributes':_0x61056c[_0x3b8c('0x1a')]?_0x61056c[_0x3b8c('0x1a')][_0x3b8c('0x1d')]||null:null,'limit':_0x61056c[_0x3b8c('0x1a')]?_0x61056c[_0x3b8c('0x1a')][_0x3b8c('0x1e')]||null:null,'include':_0x61056c['options']?_0x61056c['options']['include']?_[_0x3b8c('0x1f')](_0x61056c[_0x3b8c('0x1a')]['include'],function(_0x17d560){return{'model':db[_0x17d560['model']],'as':_0x17d560['as'],'attributes':_0x17d560['attributes'],'include':_0x17d560['include']?_['map'](_0x17d560['include'],function(_0x2b00ed){return{'model':db[_0x2b00ed['model']],'as':_0x2b00ed['as'],'attributes':_0x2b00ed[_0x3b8c('0x1d')],'include':_0x2b00ed[_0x3b8c('0x20')]?_['map'](_0x2b00ed[_0x3b8c('0x20')],function(_0x44a1d7){return{'model':db[_0x44a1d7[_0x3b8c('0x21')]],'as':_0x44a1d7['as'],'attributes':_0x44a1d7[_0x3b8c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3b8c('0xd')](function(_0xc5a189){logger['info'](_0x3b8c('0x18'),_0x61056c);logger[_0x3b8c('0x10')](_0x3b8c('0x18'),_0x61056c,JSON['stringify'](_0xc5a189));_0x2e6a7f(_0xc5a189);})['catch'](function(_0x363824){logger['error'](_0x3b8c('0x18'),_0x363824[_0x3b8c('0x15')],_0x61056c);_0x1bd0d9(_0x1b09b0[_0x3b8c('0x13')](0x1f4,_0x363824[_0x3b8c('0x15')]));});});};exports[_0x3b8c('0x22')]=function(_0x467f09){var _0x41f252=this;return new Promise(function(_0x2002db,_0x338eff){return db[_0x3b8c('0x23')][_0x3b8c('0x24')]({'raw':_0x467f09[_0x3b8c('0x1a')]?_0x467f09[_0x3b8c('0x1a')][_0x3b8c('0x1b')]===undefined?!![]:![]:!![],'where':_0x467f09[_0x3b8c('0x1a')]?_0x467f09[_0x3b8c('0x1a')]['where']||null:null,'attributes':_0x467f09['options']?_0x467f09[_0x3b8c('0x1a')][_0x3b8c('0x1d')]||null:null,'include':_0x467f09[_0x3b8c('0x1a')]?_0x467f09['options']['include']?_[_0x3b8c('0x1f')](_0x467f09[_0x3b8c('0x1a')]['include'],function(_0x164b9e){return{'model':db[_0x164b9e[_0x3b8c('0x21')]],'as':_0x164b9e['as'],'attributes':_0x164b9e[_0x3b8c('0x1d')],'include':_0x164b9e['include']?_[_0x3b8c('0x1f')](_0x164b9e['include'],function(_0x44c51d){return{'model':db[_0x44c51d[_0x3b8c('0x21')]],'as':_0x44c51d['as'],'attributes':_0x44c51d[_0x3b8c('0x1d')],'include':_0x44c51d[_0x3b8c('0x20')]?_[_0x3b8c('0x1f')](_0x44c51d[_0x3b8c('0x20')],function(_0x27d488){return{'model':db[_0x27d488[_0x3b8c('0x21')]],'as':_0x27d488['as'],'attributes':_0x27d488[_0x3b8c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3b8c('0xd')](function(_0x1e7322){logger[_0x3b8c('0xe')]('ShowZohoAccount',_0x467f09);logger[_0x3b8c('0x10')](_0x3b8c('0x22'),_0x467f09,JSON[_0x3b8c('0x12')](_0x1e7322));_0x2002db(_0x1e7322);})[_0x3b8c('0x17')](function(_0xf3e528){logger[_0x3b8c('0x13')]('ShowZohoAccount',_0xf3e528[_0x3b8c('0x15')],_0x467f09);_0x338eff(_0x41f252[_0x3b8c('0x13')](0x1f4,_0xf3e528[_0x3b8c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 420dd7d..d8a5bac 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 _0x407f=['../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post','create','update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service'];(function(_0x41720b,_0x2c6945){var _0xfad2bd=function(_0x3df7f7){while(--_0x3df7f7){_0x41720b['push'](_0x41720b['shift']());}};_0xfad2bd(++_0x2c6945);}(_0x407f,0xc2));var _0xf407=function(_0x8e9235,_0x552ac0){_0x8e9235=_0x8e9235-0x0;var _0x385465=_0x407f[_0x8e9235];return _0x385465;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf407('0x0'));var express=require(_0xf407('0x1'));var router=express[_0xf407('0x2')]();var auth=require(_0xf407('0x3'));var interaction=require(_0xf407('0x4'));var config=require(_0xf407('0x5'));var controller=require(_0xf407('0x6'));router[_0xf407('0x7')]('/',auth[_0xf407('0x8')](),controller[_0xf407('0x9')]);router[_0xf407('0x7')](_0xf407('0xa'),auth[_0xf407('0x8')](),controller[_0xf407('0xb')]);router[_0xf407('0x7')](_0xf407('0xc'),auth['isAuthenticated'](),controller[_0xf407('0xd')]);router[_0xf407('0x7')](_0xf407('0xe'),auth[_0xf407('0x8')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0xf407('0x8')](),controller[_0xf407('0xf')]);router[_0xf407('0x10')]('/',auth[_0xf407('0x8')](),controller[_0xf407('0x11')]);router['put'](_0xf407('0xa'),auth[_0xf407('0x8')](),controller[_0xf407('0x12')]);router[_0xf407('0x13')](_0xf407('0xa'),auth[_0xf407('0x8')](),controller[_0xf407('0x14')]);module[_0xf407('0x15')]=router; \ No newline at end of file +var _0x9e5e=['util','connect-timeout','express','Router','../../components/interaction/service','./intZohoConfiguration.controller','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','put','update','delete','destroy','exports','multer'];(function(_0x322246,_0x4e2ff2){var _0x279103=function(_0x28d7ce){while(--_0x28d7ce){_0x322246['push'](_0x322246['shift']());}};_0x279103(++_0x4e2ff2);}(_0x9e5e,0x1e2));var _0xe9e5=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x9e5e[_0x87b0ff];return _0x3bc0b2;};'use strict';var multer=require(_0xe9e5('0x0'));var util=require(_0xe9e5('0x1'));var path=require('path');var timeout=require(_0xe9e5('0x2'));var express=require(_0xe9e5('0x3'));var router=express[_0xe9e5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xe9e5('0x5'));var config=require('../../config/environment');var controller=require(_0xe9e5('0x6'));router[_0xe9e5('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9e5('0x7')](_0xe9e5('0x8'),auth['isAuthenticated'](),controller[_0xe9e5('0x9')]);router[_0xe9e5('0x7')](_0xe9e5('0xa'),auth[_0xe9e5('0xb')](),controller[_0xe9e5('0xc')]);router[_0xe9e5('0x7')](_0xe9e5('0xd'),auth[_0xe9e5('0xb')](),controller[_0xe9e5('0xe')]);router['get'](_0xe9e5('0xf'),auth[_0xe9e5('0xb')](),controller['getDescriptions']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xe9e5('0x10')](_0xe9e5('0x8'),auth[_0xe9e5('0xb')](),controller[_0xe9e5('0x11')]);router[_0xe9e5('0x12')](_0xe9e5('0x8'),auth[_0xe9e5('0xb')](),controller[_0xe9e5('0x13')]);module[_0xe9e5('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 6fd0065..2f6ad72 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 _0xca89=['ENUM','contact_lead','contact','sequelize','exports','STRING','lead','nothing'];(function(_0x6fc67a,_0x54d3b8){var _0x535543=function(_0x5778a4){while(--_0x5778a4){_0x6fc67a['push'](_0x6fc67a['shift']());}};_0x535543(++_0x54d3b8);}(_0xca89,0x6b));var _0x9ca8=function(_0x5ed4fb,_0x40dcaa){_0x5ed4fb=_0x5ed4fb-0x0;var _0x4d5ac0=_0xca89[_0x5ed4fb];return _0x4d5ac0;};'use strict';var Sequelize=require(_0x9ca8('0x0'));module[_0x9ca8('0x1')]={'name':{'type':Sequelize[_0x9ca8('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x9ca8('0x3'),'contact',_0x9ca8('0x4')),'defaultValue':_0x9ca8('0x3')},'moduleSearch':{'type':Sequelize[_0x9ca8('0x5')](_0x9ca8('0x6'),_0x9ca8('0x7'),'lead'),'defaultValue':_0x9ca8('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3925=['sequelize','exports','lead','contact','nothing','ENUM','contact_lead'];(function(_0x248447,_0x6917e){var _0x4680da=function(_0x5d8bf1){while(--_0x5d8bf1){_0x248447['push'](_0x248447['shift']());}};_0x4680da(++_0x6917e);}(_0x3925,0x19d));var _0x5392=function(_0x42f6d1,_0x52c740){_0x42f6d1=_0x42f6d1-0x0;var _0x50ae08=_0x3925[_0x42f6d1];return _0x50ae08;};'use strict';var Sequelize=require(_0x5392('0x0'));module[_0x5392('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM'](_0x5392('0x2'),_0x5392('0x3'),_0x5392('0x4')),'defaultValue':_0x5392('0x2')},'moduleSearch':{'type':Sequelize[_0x5392('0x5')](_0x5392('0x6'),_0x5392('0x3'),'lead'),'defaultValue':_0x5392('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index bfb284c..3dcd161 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 _0xa9e0=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ZohoConfiguration','count','includeAll','include','findAll','rows','params','intersection','find','body','findOne','ZohoField','order','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model'];(function(_0x17b0d4,_0x377add){var _0x2d02c7=function(_0x56e627){while(--_0x56e627){_0x17b0d4['push'](_0x17b0d4['shift']());}};_0x2d02c7(++_0x377add);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=_0x33161b['count'],_0x384319=_0x40c424[_0x0a9e('0x27')],_0x479bc4=_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')],_0x45a1e7;if(_0x479bc4>=_0x526cf3){_0x479bc4=_0x526cf3;_0x45a1e7=0xc8;}else{_0x45a1e7=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x45a1e7);return _0x3a8e58[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x384319+'-'+_0x479bc4+'/'+_0x526cf3)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x14de77){return function(_0x5a101a){try{jsonpatch[_0x0a9e('0x2b')](_0x5a101a,_0x14de77,!![]);}catch(_0x468813){return BPromise[_0x0a9e('0x2c')](_0x468813);}return _0x5a101a[_0x0a9e('0x2d')]();};}function saveUpdates(_0x5c877d,_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x2e')](_0x5c877d)[_0x0a9e('0x2f')](function(_0x58b06f){return _0x58b06f;});}return null;};}function removeEntity(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x30')]()['then'](function(){_0x563b45[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2407f9,_0x3ae878){return function(_0x1122db){if(!_0x1122db){_0x2407f9[_0x0a9e('0x23')](0x194);}return _0x1122db;};}function handleError(_0x25ce3a,_0x5180f1){_0x5180f1=_0x5180f1||0x1f4;return function(_0x66c1d2){logger[_0x0a9e('0x1d')](_0x66c1d2[_0x0a9e('0x31')]);if(_0x66c1d2[_0x0a9e('0x32')]){delete _0x66c1d2[_0x0a9e('0x32')];}_0x25ce3a[_0x0a9e('0x24')](_0x5180f1)[_0x0a9e('0x33')](_0x66c1d2);};}exports[_0x0a9e('0x34')]=function(_0x5583a4,_0x44295a){var _0x5e7238={},_0x2cc7a0={},_0x14b13f={'count':0x0,'rows':[]};var _0x2b7e7f=_[_0x0a9e('0x35')](db['ZohoConfiguration'][_0x0a9e('0x36')],function(_0xd1836d){return{'name':_0xd1836d[_0x0a9e('0x37')],'type':_0xd1836d[_0x0a9e('0x38')]['key']};});_0x2cc7a0['model']=_[_0x0a9e('0x35')](_0x2b7e7f,'name');_0x2cc7a0[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5583a4[_0x0a9e('0x39')]);_0x2cc7a0[_0x0a9e('0x3b')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],_0x2cc7a0[_0x0a9e('0x39')]);_0x5e7238[_0x0a9e('0x3d')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x5583a4[_0x0a9e('0x39')]['fields']));_0x5e7238['attributes']=_0x5e7238[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x5e7238['attributes']:_0x2cc7a0[_0x0a9e('0x3c')];if(!_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x5e7238['limit']=qs['limit'](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x5e7238['offset']=qs[_0x0a9e('0x27')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x27')]);}_0x5e7238['order']=qs[_0x0a9e('0x42')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x5e7238[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5583a4[_0x0a9e('0x39')],_0x2cc7a0[_0x0a9e('0x3b')]),_0x2b7e7f);if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x5e7238[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x5e7238[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2b7e7f,function(_0x37f6cc){if(_0x37f6cc['type']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x37f6cc[_0x0a9e('0x32')]]={'$like':'%'+_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x5e7238=_[_0x0a9e('0x46')]({},_0x5e7238,_0x5583a4[_0x0a9e('0x47')]);var _0x10b040={'where':_0x5e7238[_0x0a9e('0x43')]};return db[_0x0a9e('0x48')][_0x0a9e('0x49')](_0x10b040)[_0x0a9e('0x2f')](function(_0x35ed4a){_0x14b13f['count']=_0x35ed4a;if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x5e7238[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x48')][_0x0a9e('0x4c')](_0x5e7238);})[_0x0a9e('0x2f')](function(_0x21eb86){_0x14b13f[_0x0a9e('0x4d')]=_0x21eb86;return _0x14b13f;})['then'](respondWithFilteredResult(_0x44295a,_0x5e7238))[_0x0a9e('0x22')](handleError(_0x44295a,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':![],'where':{'id':_0x473dc8[_0x0a9e('0x4e')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x48')][_0x0a9e('0x36')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3d')]=_0x8d6dd1[_0x0a9e('0x3d')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x8d6dd1[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x47')]);return db[_0x0a9e('0x48')][_0x0a9e('0x50')](_0x8d6dd1)[_0x0a9e('0x2f')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x48')]['create'](_0x39d77d[_0x0a9e('0x51')],{})[_0x0a9e('0x2f')](respondWithResult(_0x204173,0xc9))['catch'](handleError(_0x204173,null));};exports['update']=function(_0x2ef381,_0x59c6ff){if(_0x2ef381[_0x0a9e('0x51')]['id']){delete _0x2ef381['body']['id'];}return db[_0x0a9e('0x48')][_0x0a9e('0x50')]({'where':{'id':_0x2ef381[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59c6ff,null))[_0x0a9e('0x2f')](saveUpdates(_0x2ef381[_0x0a9e('0x51')],null))['then'](respondWithResult(_0x59c6ff,null))['catch'](handleError(_0x59c6ff,null));};exports[_0x0a9e('0x30')]=function(_0x3aedd0,_0x49c095){return db[_0x0a9e('0x48')]['find']({'where':{'id':_0x3aedd0[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49c095,null))[_0x0a9e('0x2f')](removeEntity(_0x49c095,null))['catch'](handleError(_0x49c095,null));};exports['getFields']=function(_0x5df0ad,_0x2da03c,_0x47de4c){var _0x2f7092={};var _0x65432={};var _0x3cfd00;var _0x19b4df;return db[_0x0a9e('0x48')][_0x0a9e('0x52')]({'where':{'id':_0x5df0ad[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2da03c,null))['then'](function(_0x1c693e){if(_0x1c693e){_0x3cfd00=_0x1c693e;_0x65432[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x65432[_0x0a9e('0x39')]=_['keys'](_0x5df0ad[_0x0a9e('0x39')]);_0x65432[_0x0a9e('0x3b')]=_['intersection'](_0x65432[_0x0a9e('0x3c')],_0x65432['query']);_0x2f7092[_0x0a9e('0x3d')]=_['intersection'](_0x65432['model'],qs['fields'](_0x5df0ad[_0x0a9e('0x39')]['fields']));_0x2f7092[_0x0a9e('0x3d')]=_0x2f7092[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x2f7092[_0x0a9e('0x3d')]:_0x65432[_0x0a9e('0x3c')];_0x2f7092[_0x0a9e('0x54')]=qs['sort'](_0x5df0ad[_0x0a9e('0x39')]['sort']);_0x2f7092[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5df0ad['query'],_0x65432[_0x0a9e('0x3b')]));if(_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x2f7092[_0x0a9e('0x43')]=_['merge'](_0x2f7092[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2f7092['attributes'],function(_0x797b45){var _0x17e88c={};_0x17e88c[_0x797b45]={'$like':'%'+_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x17e88c;})});}_0x2f7092=_[_0x0a9e('0x46')]({},_0x2f7092,_0x5df0ad['options']);return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x281c7d){if(_0x281c7d){_0x19b4df=_0x281c7d['length'];if(!_0x5df0ad[_0x0a9e('0x39')]['hasOwnProperty']('nolimit')){_0x2f7092[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x2f7092[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x27')]);}return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x2e89b7){if(_0x2e89b7){return _0x2e89b7?{'count':_0x19b4df,'rows':_0x2e89b7}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2da03c,null))[_0x0a9e('0x22')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x56')]=function(_0x320898,_0x412a72,_0x2a28c0){var _0x4257c9={};var _0x5150a4={};var _0x1b0b98;var _0x295763;return db[_0x0a9e('0x48')]['findOne']({'where':{'id':_0x320898[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x412a72,null))['then'](function(_0x83f0b2){if(_0x83f0b2){_0x1b0b98=_0x83f0b2;_0x5150a4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x5150a4['query']=_['keys'](_0x320898['query']);_0x5150a4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],_0x5150a4[_0x0a9e('0x39')]);_0x4257c9[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x320898['query'][_0x0a9e('0x3e')]));_0x4257c9[_0x0a9e('0x3d')]=_0x4257c9[_0x0a9e('0x3d')]['length']?_0x4257c9[_0x0a9e('0x3d')]:_0x5150a4['model'];_0x4257c9[_0x0a9e('0x54')]=qs[_0x0a9e('0x42')](_0x320898['query'][_0x0a9e('0x42')]);_0x4257c9[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x320898['query'],_0x5150a4[_0x0a9e('0x3b')]));if(_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x4257c9[_0x0a9e('0x43')]=_['merge'](_0x4257c9[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x4257c9[_0x0a9e('0x3d')],function(_0x361b21){var _0x4abc8f={};_0x4abc8f[_0x361b21]={'$like':'%'+_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x4abc8f;})});}_0x4257c9=_[_0x0a9e('0x46')]({},_0x4257c9,_0x320898[_0x0a9e('0x47')]);return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x40fc56){if(_0x40fc56){_0x295763=_0x40fc56[_0x0a9e('0x3f')];if(!_0x320898[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x4257c9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x320898[_0x0a9e('0x39')]['limit']);_0x4257c9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x320898[_0x0a9e('0x39')]['offset']);}return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x8cea96){if(_0x8cea96){return _0x8cea96?{'count':_0x295763,'rows':_0x8cea96}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x412a72,null))['catch'](handleError(_0x412a72,null));};exports['getDescriptions']=function(_0x7ebea8,_0x2bbdb5,_0x4c54fa){var _0x45108c={};var _0x53a6a1={};var _0x260f4b;var _0x8ebf02;return db['ZohoConfiguration'][_0x0a9e('0x52')]({'where':{'id':_0x7ebea8[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x2f')](function(_0x3755fe){if(_0x3755fe){_0x260f4b=_0x3755fe;_0x53a6a1[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db['ZohoField'][_0x0a9e('0x36')]);_0x53a6a1[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x7ebea8[_0x0a9e('0x39')]);_0x53a6a1['filters']=_[_0x0a9e('0x4f')](_0x53a6a1[_0x0a9e('0x3c')],_0x53a6a1['query']);_0x45108c[_0x0a9e('0x3d')]=_['intersection'](_0x53a6a1[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x3e')]));_0x45108c['attributes']=_0x45108c['attributes'][_0x0a9e('0x3f')]?_0x45108c[_0x0a9e('0x3d')]:_0x53a6a1[_0x0a9e('0x3c')];_0x45108c['order']=qs[_0x0a9e('0x42')](_0x7ebea8[_0x0a9e('0x39')]['sort']);_0x45108c['where']=qs[_0x0a9e('0x3b')](_['pick'](_0x7ebea8['query'],_0x53a6a1['filters']));if(_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x45108c[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x45108c[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x45108c['attributes'],function(_0x5fd5db){var _0x5955f1={};_0x5955f1[_0x5fd5db]={'$like':'%'+_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x5955f1;})});}_0x45108c=_[_0x0a9e('0x46')]({},_0x45108c,_0x7ebea8[_0x0a9e('0x47')]);return _0x260f4b['getDescriptions'](_0x45108c);}})[_0x0a9e('0x2f')](function(_0x32f761){if(_0x32f761){_0x8ebf02=_0x32f761[_0x0a9e('0x3f')];if(!_0x7ebea8['query'][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x45108c[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x45108c[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x7ebea8['query'][_0x0a9e('0x27')]);}return _0x260f4b[_0x0a9e('0x57')](_0x45108c);}})['then'](function(_0x40e0f0){if(_0x40e0f0){return _0x40e0f0?{'count':_0x8ebf02,'rows':_0x40e0f0}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2bbdb5,null))[_0x0a9e('0x22')](handleError(_0x2bbdb5,null));}; \ No newline at end of file +var _0xa9e0=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','ZohoConfiguration','count','includeAll','include','findAll','rows','params','intersection','find','body','findOne','ZohoField','order','getFields','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','model'];(function(_0x380a3f,_0x202483){var _0x2b4eca=function(_0x1e99b2){while(--_0x1e99b2){_0x380a3f['push'](_0x380a3f['shift']());}};_0x2b4eca(++_0x202483);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];var jayson=require(_0x0a9e('0x15'));var client=jayson[_0x0a9e('0x16')][_0x0a9e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x69aeb7,_0x5db4b0,_0x4283ce,_0x239b12){return new BPromise(function(_0x2b4227,_0x281129){var _0x44dcfd=_0x239b12||client;return _0x44dcfd[_0x0a9e('0x18')](_0x69aeb7,_0x4283ce)['then'](function(_0x22dccb){logger['info'](_0x0a9e('0x19'),_0x5db4b0,'request\x20sent');logger[_0x0a9e('0x1a')](_0x0a9e('0x1b'),_0x5db4b0,'request\x20sent',JSON[_0x0a9e('0x1c')](_0x22dccb));if(_0x22dccb['error']){if(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1e')]===0x1f4){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x281129(_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);}logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x22dccb[_0x0a9e('0x1d')][_0x0a9e('0x1f')]);return _0x2b4227(_0x22dccb['error'][_0x0a9e('0x1f')]);}else{logger[_0x0a9e('0x20')]('ZohoConfiguration,\x20%s,\x20%s',_0x5db4b0,_0x0a9e('0x21'));_0x2b4227(_0x22dccb['result']['message']);}})[_0x0a9e('0x22')](function(_0x432e56){logger[_0x0a9e('0x1d')](_0x0a9e('0x19'),_0x5db4b0,_0x432e56);_0x281129(_0x432e56);});});}function respondWithStatusCode(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0xcc;return function(_0x2fb0e4){if(_0x2fb0e4){return _0x4abc77[_0x0a9e('0x23')](_0xfb6e48);}return _0x4abc77[_0x0a9e('0x24')](_0xfb6e48)[_0x0a9e('0x25')]();};}function respondWithResult(_0x42ac8f,_0x16b1ca){_0x16b1ca=_0x16b1ca||0xc8;return function(_0x5ea472){if(_0x5ea472){return _0x42ac8f['status'](_0x16b1ca)[_0x0a9e('0x26')](_0x5ea472);}};}function respondWithFilteredResult(_0x3a8e58,_0x40c424){return function(_0x33161b){if(_0x33161b){var _0x526cf3=_0x33161b['count'],_0x384319=_0x40c424[_0x0a9e('0x27')],_0x479bc4=_0x40c424[_0x0a9e('0x27')]+_0x40c424[_0x0a9e('0x28')],_0x45a1e7;if(_0x479bc4>=_0x526cf3){_0x479bc4=_0x526cf3;_0x45a1e7=0xc8;}else{_0x45a1e7=0xce;}_0x3a8e58[_0x0a9e('0x24')](_0x45a1e7);return _0x3a8e58[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x384319+'-'+_0x479bc4+'/'+_0x526cf3)[_0x0a9e('0x26')](_0x33161b);}return null;};}function patchUpdates(_0x14de77){return function(_0x5a101a){try{jsonpatch[_0x0a9e('0x2b')](_0x5a101a,_0x14de77,!![]);}catch(_0x468813){return BPromise[_0x0a9e('0x2c')](_0x468813);}return _0x5a101a[_0x0a9e('0x2d')]();};}function saveUpdates(_0x5c877d,_0x15b200){return function(_0x40e7a3){if(_0x40e7a3){return _0x40e7a3[_0x0a9e('0x2e')](_0x5c877d)[_0x0a9e('0x2f')](function(_0x58b06f){return _0x58b06f;});}return null;};}function removeEntity(_0x563b45,_0x296f41){return function(_0x2e8759){if(_0x2e8759){return _0x2e8759[_0x0a9e('0x30')]()['then'](function(){_0x563b45[_0x0a9e('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2407f9,_0x3ae878){return function(_0x1122db){if(!_0x1122db){_0x2407f9[_0x0a9e('0x23')](0x194);}return _0x1122db;};}function handleError(_0x25ce3a,_0x5180f1){_0x5180f1=_0x5180f1||0x1f4;return function(_0x66c1d2){logger[_0x0a9e('0x1d')](_0x66c1d2[_0x0a9e('0x31')]);if(_0x66c1d2[_0x0a9e('0x32')]){delete _0x66c1d2[_0x0a9e('0x32')];}_0x25ce3a[_0x0a9e('0x24')](_0x5180f1)[_0x0a9e('0x33')](_0x66c1d2);};}exports[_0x0a9e('0x34')]=function(_0x5583a4,_0x44295a){var _0x5e7238={},_0x2cc7a0={},_0x14b13f={'count':0x0,'rows':[]};var _0x2b7e7f=_[_0x0a9e('0x35')](db['ZohoConfiguration'][_0x0a9e('0x36')],function(_0xd1836d){return{'name':_0xd1836d[_0x0a9e('0x37')],'type':_0xd1836d[_0x0a9e('0x38')]['key']};});_0x2cc7a0['model']=_[_0x0a9e('0x35')](_0x2b7e7f,'name');_0x2cc7a0[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x5583a4[_0x0a9e('0x39')]);_0x2cc7a0[_0x0a9e('0x3b')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],_0x2cc7a0[_0x0a9e('0x39')]);_0x5e7238[_0x0a9e('0x3d')]=_['intersection'](_0x2cc7a0[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x5583a4[_0x0a9e('0x39')]['fields']));_0x5e7238['attributes']=_0x5e7238[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x5e7238['attributes']:_0x2cc7a0[_0x0a9e('0x3c')];if(!_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x5e7238['limit']=qs['limit'](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x5e7238['offset']=qs[_0x0a9e('0x27')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x27')]);}_0x5e7238['order']=qs[_0x0a9e('0x42')](_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x42')]);_0x5e7238[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5583a4[_0x0a9e('0x39')],_0x2cc7a0[_0x0a9e('0x3b')]),_0x2b7e7f);if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x5e7238[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x5e7238[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2b7e7f,function(_0x37f6cc){if(_0x37f6cc['type']!=='VIRTUAL'){var _0x473fdc={};_0x473fdc[_0x37f6cc[_0x0a9e('0x32')]]={'$like':'%'+_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x473fdc;}})});}_0x5e7238=_[_0x0a9e('0x46')]({},_0x5e7238,_0x5583a4[_0x0a9e('0x47')]);var _0x10b040={'where':_0x5e7238[_0x0a9e('0x43')]};return db[_0x0a9e('0x48')][_0x0a9e('0x49')](_0x10b040)[_0x0a9e('0x2f')](function(_0x35ed4a){_0x14b13f['count']=_0x35ed4a;if(_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x5e7238[_0x0a9e('0x4b')]=[{'all':!![]}];}return db[_0x0a9e('0x48')][_0x0a9e('0x4c')](_0x5e7238);})[_0x0a9e('0x2f')](function(_0x21eb86){_0x14b13f[_0x0a9e('0x4d')]=_0x21eb86;return _0x14b13f;})['then'](respondWithFilteredResult(_0x44295a,_0x5e7238))[_0x0a9e('0x22')](handleError(_0x44295a,null));};exports['show']=function(_0x473dc8,_0x476688){var _0x8d6dd1={'raw':![],'where':{'id':_0x473dc8[_0x0a9e('0x4e')]['id']}},_0x562fb4={};_0x562fb4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x48')][_0x0a9e('0x36')]);_0x562fb4[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x473dc8['query']);_0x562fb4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],_0x562fb4[_0x0a9e('0x39')]);_0x8d6dd1[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x562fb4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x473dc8[_0x0a9e('0x39')]['fields']));_0x8d6dd1[_0x0a9e('0x3d')]=_0x8d6dd1[_0x0a9e('0x3d')]['length']?_0x8d6dd1['attributes']:_0x562fb4['model'];if(_0x473dc8[_0x0a9e('0x39')][_0x0a9e('0x4a')]){_0x8d6dd1[_0x0a9e('0x4b')]=[{'all':!![]}];}_0x8d6dd1=_[_0x0a9e('0x46')]({},_0x8d6dd1,_0x473dc8[_0x0a9e('0x47')]);return db[_0x0a9e('0x48')][_0x0a9e('0x50')](_0x8d6dd1)[_0x0a9e('0x2f')](handleEntityNotFound(_0x476688,null))['then'](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports['create']=function(_0x39d77d,_0x204173){return db[_0x0a9e('0x48')]['create'](_0x39d77d[_0x0a9e('0x51')],{})[_0x0a9e('0x2f')](respondWithResult(_0x204173,0xc9))['catch'](handleError(_0x204173,null));};exports['update']=function(_0x2ef381,_0x59c6ff){if(_0x2ef381[_0x0a9e('0x51')]['id']){delete _0x2ef381['body']['id'];}return db[_0x0a9e('0x48')][_0x0a9e('0x50')]({'where':{'id':_0x2ef381[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x59c6ff,null))[_0x0a9e('0x2f')](saveUpdates(_0x2ef381[_0x0a9e('0x51')],null))['then'](respondWithResult(_0x59c6ff,null))['catch'](handleError(_0x59c6ff,null));};exports[_0x0a9e('0x30')]=function(_0x3aedd0,_0x49c095){return db[_0x0a9e('0x48')]['find']({'where':{'id':_0x3aedd0[_0x0a9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x49c095,null))[_0x0a9e('0x2f')](removeEntity(_0x49c095,null))['catch'](handleError(_0x49c095,null));};exports['getFields']=function(_0x5df0ad,_0x2da03c,_0x47de4c){var _0x2f7092={};var _0x65432={};var _0x3cfd00;var _0x19b4df;return db[_0x0a9e('0x48')][_0x0a9e('0x52')]({'where':{'id':_0x5df0ad[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2da03c,null))['then'](function(_0x1c693e){if(_0x1c693e){_0x3cfd00=_0x1c693e;_0x65432[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x65432[_0x0a9e('0x39')]=_['keys'](_0x5df0ad[_0x0a9e('0x39')]);_0x65432[_0x0a9e('0x3b')]=_['intersection'](_0x65432[_0x0a9e('0x3c')],_0x65432['query']);_0x2f7092[_0x0a9e('0x3d')]=_['intersection'](_0x65432['model'],qs['fields'](_0x5df0ad[_0x0a9e('0x39')]['fields']));_0x2f7092[_0x0a9e('0x3d')]=_0x2f7092[_0x0a9e('0x3d')][_0x0a9e('0x3f')]?_0x2f7092[_0x0a9e('0x3d')]:_0x65432[_0x0a9e('0x3c')];_0x2f7092[_0x0a9e('0x54')]=qs['sort'](_0x5df0ad[_0x0a9e('0x39')]['sort']);_0x2f7092[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x5df0ad['query'],_0x65432[_0x0a9e('0x3b')]));if(_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x2f7092[_0x0a9e('0x43')]=_['merge'](_0x2f7092[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x2f7092['attributes'],function(_0x797b45){var _0x17e88c={};_0x17e88c[_0x797b45]={'$like':'%'+_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x17e88c;})});}_0x2f7092=_[_0x0a9e('0x46')]({},_0x2f7092,_0x5df0ad['options']);return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x281c7d){if(_0x281c7d){_0x19b4df=_0x281c7d['length'];if(!_0x5df0ad[_0x0a9e('0x39')]['hasOwnProperty']('nolimit')){_0x2f7092[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x2f7092[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x5df0ad[_0x0a9e('0x39')][_0x0a9e('0x27')]);}return _0x3cfd00[_0x0a9e('0x55')](_0x2f7092);}})[_0x0a9e('0x2f')](function(_0x2e89b7){if(_0x2e89b7){return _0x2e89b7?{'count':_0x19b4df,'rows':_0x2e89b7}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2da03c,null))[_0x0a9e('0x22')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x56')]=function(_0x320898,_0x412a72,_0x2a28c0){var _0x4257c9={};var _0x5150a4={};var _0x1b0b98;var _0x295763;return db[_0x0a9e('0x48')]['findOne']({'where':{'id':_0x320898[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x412a72,null))['then'](function(_0x83f0b2){if(_0x83f0b2){_0x1b0b98=_0x83f0b2;_0x5150a4[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db[_0x0a9e('0x53')][_0x0a9e('0x36')]);_0x5150a4['query']=_['keys'](_0x320898['query']);_0x5150a4[_0x0a9e('0x3b')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],_0x5150a4[_0x0a9e('0x39')]);_0x4257c9[_0x0a9e('0x3d')]=_[_0x0a9e('0x4f')](_0x5150a4[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x320898['query'][_0x0a9e('0x3e')]));_0x4257c9[_0x0a9e('0x3d')]=_0x4257c9[_0x0a9e('0x3d')]['length']?_0x4257c9[_0x0a9e('0x3d')]:_0x5150a4['model'];_0x4257c9[_0x0a9e('0x54')]=qs[_0x0a9e('0x42')](_0x320898['query'][_0x0a9e('0x42')]);_0x4257c9[_0x0a9e('0x43')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x44')](_0x320898['query'],_0x5150a4[_0x0a9e('0x3b')]));if(_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x4257c9[_0x0a9e('0x43')]=_['merge'](_0x4257c9[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x4257c9[_0x0a9e('0x3d')],function(_0x361b21){var _0x4abc8f={};_0x4abc8f[_0x361b21]={'$like':'%'+_0x320898[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x4abc8f;})});}_0x4257c9=_[_0x0a9e('0x46')]({},_0x4257c9,_0x320898[_0x0a9e('0x47')]);return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x40fc56){if(_0x40fc56){_0x295763=_0x40fc56[_0x0a9e('0x3f')];if(!_0x320898[_0x0a9e('0x39')][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x4257c9[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x320898[_0x0a9e('0x39')]['limit']);_0x4257c9[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x320898[_0x0a9e('0x39')]['offset']);}return _0x1b0b98[_0x0a9e('0x56')](_0x4257c9);}})[_0x0a9e('0x2f')](function(_0x8cea96){if(_0x8cea96){return _0x8cea96?{'count':_0x295763,'rows':_0x8cea96}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x412a72,null))['catch'](handleError(_0x412a72,null));};exports['getDescriptions']=function(_0x7ebea8,_0x2bbdb5,_0x4c54fa){var _0x45108c={};var _0x53a6a1={};var _0x260f4b;var _0x8ebf02;return db['ZohoConfiguration'][_0x0a9e('0x52')]({'where':{'id':_0x7ebea8[_0x0a9e('0x4e')]['id']}})[_0x0a9e('0x2f')](handleEntityNotFound(_0x2bbdb5,null))[_0x0a9e('0x2f')](function(_0x3755fe){if(_0x3755fe){_0x260f4b=_0x3755fe;_0x53a6a1[_0x0a9e('0x3c')]=_[_0x0a9e('0x3a')](db['ZohoField'][_0x0a9e('0x36')]);_0x53a6a1[_0x0a9e('0x39')]=_[_0x0a9e('0x3a')](_0x7ebea8[_0x0a9e('0x39')]);_0x53a6a1['filters']=_[_0x0a9e('0x4f')](_0x53a6a1[_0x0a9e('0x3c')],_0x53a6a1['query']);_0x45108c[_0x0a9e('0x3d')]=_['intersection'](_0x53a6a1[_0x0a9e('0x3c')],qs[_0x0a9e('0x3e')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x3e')]));_0x45108c['attributes']=_0x45108c['attributes'][_0x0a9e('0x3f')]?_0x45108c[_0x0a9e('0x3d')]:_0x53a6a1[_0x0a9e('0x3c')];_0x45108c['order']=qs[_0x0a9e('0x42')](_0x7ebea8[_0x0a9e('0x39')]['sort']);_0x45108c['where']=qs[_0x0a9e('0x3b')](_['pick'](_0x7ebea8['query'],_0x53a6a1['filters']));if(_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]){_0x45108c[_0x0a9e('0x43')]=_[_0x0a9e('0x46')](_0x45108c[_0x0a9e('0x43')],{'$or':_[_0x0a9e('0x35')](_0x45108c['attributes'],function(_0x5fd5db){var _0x5955f1={};_0x5955f1[_0x5fd5db]={'$like':'%'+_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x45')]+'%'};return _0x5955f1;})});}_0x45108c=_[_0x0a9e('0x46')]({},_0x45108c,_0x7ebea8[_0x0a9e('0x47')]);return _0x260f4b['getDescriptions'](_0x45108c);}})[_0x0a9e('0x2f')](function(_0x32f761){if(_0x32f761){_0x8ebf02=_0x32f761[_0x0a9e('0x3f')];if(!_0x7ebea8['query'][_0x0a9e('0x40')](_0x0a9e('0x41'))){_0x45108c[_0x0a9e('0x28')]=qs[_0x0a9e('0x28')](_0x7ebea8[_0x0a9e('0x39')][_0x0a9e('0x28')]);_0x45108c[_0x0a9e('0x27')]=qs[_0x0a9e('0x27')](_0x7ebea8['query'][_0x0a9e('0x27')]);}return _0x260f4b[_0x0a9e('0x57')](_0x45108c);}})['then'](function(_0x40e0f0){if(_0x40e0f0){return _0x40e0f0?{'count':_0x8ebf02,'rows':_0x40e0f0}:null;}})[_0x0a9e('0x2f')](respondWithResult(_0x2bbdb5,null))[_0x0a9e('0x22')](handleError(_0x2bbdb5,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index fb7fb75..cba5cf9 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 _0xe071=['define','ZohoConfiguration','int_zoho_configurations','util','api','bluebird','path','rimraf','./intZohoConfiguration.attributes','exports'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xe071,0x7b));var _0x1e07=function(_0xddc012,_0x5cf07a){_0xddc012=_0xddc012-0x0;var _0x395581=_0xe071[_0xddc012];return _0x395581;};'use strict';var _=require('lodash');var util=require(_0x1e07('0x0'));var logger=require('../../config/logger')(_0x1e07('0x1'));var moment=require('moment');var BPromise=require(_0x1e07('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e07('0x3'));var rimraf=require(_0x1e07('0x4'));var config=require('../../config/environment');var attributes=require(_0x1e07('0x5'));module[_0x1e07('0x6')]=function(_0x2dc9cc,_0x22661c){return _0x2dc9cc[_0x1e07('0x7')](_0x1e07('0x8'),attributes,{'tableName':_0x1e07('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4bf=['lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','define','ZohoConfiguration'];(function(_0x3ec434,_0xedcb65){var _0x142951=function(_0x5c33b0){while(--_0x5c33b0){_0x3ec434['push'](_0x3ec434['shift']());}};_0x142951(++_0xedcb65);}(_0xc4bf,0xf0));var _0xfc4b=function(_0x292716,_0x96d32){_0x292716=_0x292716-0x0;var _0x34cb57=_0xc4bf[_0x292716];return _0x34cb57;};'use strict';var _=require(_0xfc4b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xfc4b('0x1'));var BPromise=require(_0xfc4b('0x2'));var rp=require(_0xfc4b('0x3'));var fs=require('fs');var path=require(_0xfc4b('0x4'));var rimraf=require(_0xfc4b('0x5'));var config=require(_0xfc4b('0x6'));var attributes=require(_0xfc4b('0x7'));module['exports']=function(_0x2a1b8b,_0x261132){return _0x2a1b8b[_0xfc4b('0x8')](_0xfc4b('0x9'),attributes,{'tableName':'int_zoho_configurations','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 d79042a..f516db9 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 _0x6fb9=['ioredis','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoConfiguration,\x20%s,\x20%s','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','randomstring'];(function(_0x4ad963,_0x17395f){var _0x169807=function(_0x5f312d){while(--_0x5f312d){_0x4ad963['push'](_0x4ad963['shift']());}};_0x169807(++_0x17395f);}(_0x6fb9,0x1b2));var _0x96fb=function(_0x58da8a,_0x1c0584){_0x58da8a=_0x58da8a-0x0;var _0x5ba3a3=_0x6fb9[_0x58da8a];return _0x5ba3a3;};'use strict';var _=require('lodash');var util=require(_0x96fb('0x0'));var moment=require(_0x96fb('0x1'));var BPromise=require('bluebird');var rs=require(_0x96fb('0x2'));var fs=require('fs');var Redis=require(_0x96fb('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x96fb('0x4'));var config=require(_0x96fb('0x5'));var jayson=require(_0x96fb('0x6'));var client=jayson[_0x96fb('0x7')][_0x96fb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36d5a5,_0x5c8caa,_0x4d2f78){return new BPromise(function(_0xdbcb1c,_0x459a8f){return client['request'](_0x36d5a5,_0x4d2f78)[_0x96fb('0x9')](function(_0x40de8b){logger[_0x96fb('0xa')](_0x96fb('0xb'),_0x5c8caa,'request\x20sent');logger['debug'](_0x96fb('0xc'),_0x5c8caa,_0x96fb('0xd'),JSON['stringify'](_0x40de8b));if(_0x40de8b[_0x96fb('0xe')]){if(_0x40de8b[_0x96fb('0xe')][_0x96fb('0xf')]===0x1f4){logger[_0x96fb('0xe')](_0x96fb('0xb'),_0x5c8caa,_0x40de8b[_0x96fb('0xe')][_0x96fb('0x10')]);return _0x459a8f(_0x40de8b[_0x96fb('0xe')][_0x96fb('0x10')]);}logger[_0x96fb('0xe')](_0x96fb('0xb'),_0x5c8caa,_0x40de8b[_0x96fb('0xe')]['message']);return _0xdbcb1c(_0x40de8b['error']['message']);}else{logger[_0x96fb('0xa')](_0x96fb('0xb'),_0x5c8caa,_0x96fb('0xd'));_0xdbcb1c(_0x40de8b[_0x96fb('0x11')][_0x96fb('0x10')]);}})[_0x96fb('0x12')](function(_0x1cb207){logger[_0x96fb('0xe')]('ZohoConfiguration,\x20%s,\x20%s',_0x5c8caa,_0x1cb207);_0x459a8f(_0x1cb207);});});} \ No newline at end of file +var _0x31c4=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','info','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2bc4f8,_0x94b4a6){var _0x2af19a=function(_0x150446){while(--_0x150446){_0x2bc4f8['push'](_0x2bc4f8['shift']());}};_0x2af19a(++_0x94b4a6);}(_0x31c4,0x125));var _0x431c=function(_0x263f36,_0x6eb893){_0x263f36=_0x263f36-0x0;var _0x1af2f7=_0x31c4[_0x263f36];return _0x1af2f7;};'use strict';var _=require(_0x431c('0x0'));var util=require(_0x431c('0x1'));var moment=require(_0x431c('0x2'));var BPromise=require(_0x431c('0x3'));var rs=require(_0x431c('0x4'));var fs=require('fs');var Redis=require(_0x431c('0x5'));var db=require(_0x431c('0x6'))['db'];var utils=require(_0x431c('0x7'));var logger=require('../../config/logger')(_0x431c('0x8'));var config=require(_0x431c('0x9'));var jayson=require(_0x431c('0xa'));var client=jayson[_0x431c('0xb')][_0x431c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f8c30,_0x1a7753,_0x58944b){return new BPromise(function(_0x49313e,_0x3849a1){return client[_0x431c('0xd')](_0x4f8c30,_0x58944b)[_0x431c('0xe')](function(_0x3c8a79){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x1a7753,_0x431c('0xf'));logger[_0x431c('0x10')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x1a7753,_0x431c('0xf'),JSON[_0x431c('0x11')](_0x3c8a79));if(_0x3c8a79[_0x431c('0x12')]){if(_0x3c8a79[_0x431c('0x12')][_0x431c('0x13')]===0x1f4){logger[_0x431c('0x12')](_0x431c('0x14'),_0x1a7753,_0x3c8a79[_0x431c('0x12')][_0x431c('0x15')]);return _0x3849a1(_0x3c8a79[_0x431c('0x12')]['message']);}logger[_0x431c('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x1a7753,_0x3c8a79[_0x431c('0x12')][_0x431c('0x15')]);return _0x49313e(_0x3c8a79[_0x431c('0x12')][_0x431c('0x15')]);}else{logger[_0x431c('0x16')]('ZohoConfiguration,\x20%s,\x20%s',_0x1a7753,_0x431c('0xf'));_0x49313e(_0x3c8a79['result'][_0x431c('0x15')]);}})['catch'](function(_0x58ee81){logger[_0x431c('0x12')](_0x431c('0x14'),_0x1a7753,_0x58ee81);_0x3849a1(_0x58ee81);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index efce3a4..df4edce 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 _0x2299=['../../components/interaction/service','./intZohoField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','Router'];(function(_0x2458f0,_0xf805c){var _0x2b4fd9=function(_0x57deeb){while(--_0x57deeb){_0x2458f0['push'](_0x2458f0['shift']());}};_0x2b4fd9(++_0xf805c);}(_0x2299,0x1be));var _0x9229=function(_0x57dcf5,_0x3c8953){_0x57dcf5=_0x57dcf5-0x0;var _0x27cdb7=_0x2299[_0x57dcf5];return _0x27cdb7;};'use strict';var multer=require(_0x9229('0x0'));var util=require(_0x9229('0x1'));var path=require(_0x9229('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9229('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x9229('0x4'));var config=require('../../config/environment');var controller=require(_0x9229('0x5'));router[_0x9229('0x6')]('/',auth[_0x9229('0x7')](),controller[_0x9229('0x8')]);router[_0x9229('0x6')]('/:id',auth[_0x9229('0x7')](),controller[_0x9229('0x9')]);router[_0x9229('0xa')]('/',auth['isAuthenticated'](),controller[_0x9229('0xb')]);router[_0x9229('0xc')](_0x9229('0xd'),auth[_0x9229('0x7')](),controller[_0x9229('0xe')]);router[_0x9229('0xf')](_0x9229('0xd'),auth[_0x9229('0x7')](),controller[_0x9229('0x10')]);module[_0x9229('0x11')]=router; \ No newline at end of file +var _0x6bff=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','util','path'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x6bff,0xd6));var _0xf6bf=function(_0x5d0a7a,_0x40043b){_0x5d0a7a=_0x5d0a7a-0x0;var _0xedeb8c=_0x6bff[_0x5d0a7a];return _0xedeb8c;};'use strict';var multer=require('multer');var util=require(_0xf6bf('0x0'));var path=require(_0xf6bf('0x1'));var timeout=require(_0xf6bf('0x2'));var express=require(_0xf6bf('0x3'));var router=express['Router']();var auth=require(_0xf6bf('0x4'));var interaction=require(_0xf6bf('0x5'));var config=require(_0xf6bf('0x6'));var controller=require(_0xf6bf('0x7'));router[_0xf6bf('0x8')]('/',auth[_0xf6bf('0x9')](),controller['index']);router[_0xf6bf('0x8')](_0xf6bf('0xa'),auth['isAuthenticated'](),controller[_0xf6bf('0xb')]);router[_0xf6bf('0xc')]('/',auth[_0xf6bf('0x9')](),controller[_0xf6bf('0xd')]);router['put']('/:id',auth[_0xf6bf('0x9')](),controller[_0xf6bf('0xe')]);router[_0xf6bf('0xf')](_0xf6bf('0xa'),auth[_0xf6bf('0x9')](),controller[_0xf6bf('0x10')]);module[_0xf6bf('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index b925898..2c6ce20 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 _0xa9e0=['STRING','variable','BOOLEAN','sequelize','exports','ENUM','customVariable','picklist','string'];(function(_0x1e90bf,_0x6e2b4a){var _0x964912=function(_0x2709ac){while(--_0x2709ac){_0x1e90bf['push'](_0x1e90bf['shift']());}};_0x964912(++_0x6e2b4a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('string','variable',_0x0a9e('0x3'),'keyValue',_0x0a9e('0x4')),'defaultValue':_0x0a9e('0x5')},'content':{'type':Sequelize[_0x0a9e('0x6')]},'key':{'type':Sequelize[_0x0a9e('0x6')]},'keyType':{'type':Sequelize[_0x0a9e('0x2')]('string',_0x0a9e('0x7'),_0x0a9e('0x3'))},'keyContent':{'type':Sequelize[_0x0a9e('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0a9e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x919e=['exports','ENUM','variable','picklist','string','STRING','BOOLEAN','sequelize'];(function(_0x48d307,_0x43d3b6){var _0x40496d=function(_0x3b2cda){while(--_0x3b2cda){_0x48d307['push'](_0x48d307['shift']());}};_0x40496d(++_0x43d3b6);}(_0x919e,0x1d7));var _0xe919=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x919e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe919('0x0'));module[_0xe919('0x1')]={'type':{'type':Sequelize[_0xe919('0x2')]('string',_0xe919('0x3'),'customVariable','keyValue',_0xe919('0x4')),'defaultValue':_0xe919('0x5')},'content':{'type':Sequelize[_0xe919('0x6')]},'key':{'type':Sequelize[_0xe919('0x6')]},'keyType':{'type':Sequelize[_0xe919('0x2')](_0xe919('0x5'),_0xe919('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xe919('0x6')]},'idField':{'type':Sequelize[_0xe919('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe919('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index fc1e982..2dd6889 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 _0x3b4d=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','name','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2e07e2,_0x4b0f3e){var _0x4bd158=function(_0x525bbf){while(--_0x525bbf){_0x2e07e2['push'](_0x2e07e2['shift']());}};_0x4bd158(++_0x4b0f3e);}(_0x3b4d,0x153));var _0xd3b4=function(_0x5a8323,_0x172f3f){_0x5a8323=_0x5a8323-0x0;var _0xbd7886=_0x3b4d[_0x5a8323];return _0xbd7886;};'use strict';var pdf=require(_0xd3b4('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd3b4('0x1'));var zipdir=require(_0xd3b4('0x2'));var jsonpatch=require(_0xd3b4('0x3'));var rp=require('request-promise');var moment=require(_0xd3b4('0x4'));var BPromise=require(_0xd3b4('0x5'));var Mustache=require(_0xd3b4('0x6'));var util=require('util');var path=require(_0xd3b4('0x7'));var sox=require(_0xd3b4('0x8'));var csv=require(_0xd3b4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd3b4('0xa'));var squel=require(_0xd3b4('0xb'));var crypto=require(_0xd3b4('0xc'));var jsforce=require(_0xd3b4('0xd'));var deskjs=require(_0xd3b4('0xe'));var toCsv=require(_0xd3b4('0x9'));var querystring=require('querystring');var Papa=require(_0xd3b4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd3b4('0x10'));var as=require(_0xd3b4('0x11'));var hardwareService=require(_0xd3b4('0x12'));var logger=require(_0xd3b4('0x13'))(_0xd3b4('0x14'));var utils=require(_0xd3b4('0x15'));var config=require(_0xd3b4('0x16'));var licenseUtil=require(_0xd3b4('0x17'));var db=require(_0xd3b4('0x18'))['db'];function respondWithStatusCode(_0x5ee9e9,_0x505604){_0x505604=_0x505604||0xcc;return function(_0x4d73a6){if(_0x4d73a6){return _0x5ee9e9[_0xd3b4('0x19')](_0x505604);}return _0x5ee9e9[_0xd3b4('0x1a')](_0x505604)['end']();};}function respondWithResult(_0x2313ba,_0x43702c){_0x43702c=_0x43702c||0xc8;return function(_0x1e4348){if(_0x1e4348){return _0x2313ba['status'](_0x43702c)['json'](_0x1e4348);}};}function respondWithFilteredResult(_0x46d9ff,_0x4d9be3){return function(_0xa61c02){if(_0xa61c02){var _0xc45918=_0xa61c02[_0xd3b4('0x1b')],_0xddff74=_0x4d9be3[_0xd3b4('0x1c')],_0x23e918=_0x4d9be3[_0xd3b4('0x1c')]+_0x4d9be3[_0xd3b4('0x1d')],_0x2b3e3b;if(_0x23e918>=_0xc45918){_0x23e918=_0xc45918;_0x2b3e3b=0xc8;}else{_0x2b3e3b=0xce;}_0x46d9ff[_0xd3b4('0x1a')](_0x2b3e3b);return _0x46d9ff[_0xd3b4('0x1e')](_0xd3b4('0x1f'),_0xddff74+'-'+_0x23e918+'/'+_0xc45918)['json'](_0xa61c02);}return null;};}function patchUpdates(_0x26602b){return function(_0x3e2af9){try{jsonpatch[_0xd3b4('0x20')](_0x3e2af9,_0x26602b,!![]);}catch(_0x5cbab0){return BPromise[_0xd3b4('0x21')](_0x5cbab0);}return _0x3e2af9[_0xd3b4('0x22')]();};}function saveUpdates(_0x103a3e,_0x5b50b3){return function(_0x251503){if(_0x251503){return _0x251503[_0xd3b4('0x23')](_0x103a3e)[_0xd3b4('0x24')](function(_0x34a268){return _0x34a268;});}return null;};}function removeEntity(_0x2184fb,_0x14fbb8){return function(_0x3e8c29){if(_0x3e8c29){return _0x3e8c29['destroy']()[_0xd3b4('0x24')](function(){_0x2184fb['status'](0xcc)[_0xd3b4('0x25')]();});}};}function handleEntityNotFound(_0x3ec198,_0x583b44){return function(_0x48d42e){if(!_0x48d42e){_0x3ec198[_0xd3b4('0x19')](0x194);}return _0x48d42e;};}function handleError(_0x46d5d6,_0x480b19){_0x480b19=_0x480b19||0x1f4;return function(_0x6cc0dd){logger['error'](_0x6cc0dd['stack']);if(_0x6cc0dd['name']){delete _0x6cc0dd[_0xd3b4('0x26')];}_0x46d5d6[_0xd3b4('0x1a')](_0x480b19)['send'](_0x6cc0dd);};}exports[_0xd3b4('0x27')]=function(_0x3b246b,_0x1ee071){var _0xff9983={},_0x38a6c7={},_0x43be5f={'count':0x0,'rows':[]};var _0x135c69=_[_0xd3b4('0x28')](db[_0xd3b4('0x29')][_0xd3b4('0x2a')],function(_0x48c219){return{'name':_0x48c219[_0xd3b4('0x2b')],'type':_0x48c219[_0xd3b4('0x2c')][_0xd3b4('0x2d')]};});_0x38a6c7[_0xd3b4('0x2e')]=_[_0xd3b4('0x28')](_0x135c69,_0xd3b4('0x26'));_0x38a6c7[_0xd3b4('0x2f')]=_[_0xd3b4('0x30')](_0x3b246b[_0xd3b4('0x2f')]);_0x38a6c7[_0xd3b4('0x31')]=_[_0xd3b4('0x32')](_0x38a6c7[_0xd3b4('0x2e')],_0x38a6c7['query']);_0xff9983[_0xd3b4('0x33')]=_[_0xd3b4('0x32')](_0x38a6c7['model'],qs[_0xd3b4('0x34')](_0x3b246b[_0xd3b4('0x2f')]['fields']));_0xff9983['attributes']=_0xff9983[_0xd3b4('0x33')]['length']?_0xff9983['attributes']:_0x38a6c7[_0xd3b4('0x2e')];if(!_0x3b246b[_0xd3b4('0x2f')][_0xd3b4('0x35')](_0xd3b4('0x36'))){_0xff9983[_0xd3b4('0x1d')]=qs[_0xd3b4('0x1d')](_0x3b246b[_0xd3b4('0x2f')][_0xd3b4('0x1d')]);_0xff9983['offset']=qs[_0xd3b4('0x1c')](_0x3b246b[_0xd3b4('0x2f')][_0xd3b4('0x1c')]);}_0xff9983[_0xd3b4('0x37')]=qs[_0xd3b4('0x38')](_0x3b246b[_0xd3b4('0x2f')]['sort']);_0xff9983['where']=qs['filters'](_['pick'](_0x3b246b[_0xd3b4('0x2f')],_0x38a6c7[_0xd3b4('0x31')]),_0x135c69);if(_0x3b246b[_0xd3b4('0x2f')][_0xd3b4('0x39')]){_0xff9983[_0xd3b4('0x3a')]=_[_0xd3b4('0x3b')](_0xff9983[_0xd3b4('0x3a')],{'$or':_[_0xd3b4('0x28')](_0x135c69,function(_0x19e8da){if(_0x19e8da[_0xd3b4('0x2c')]!==_0xd3b4('0x3c')){var _0xafa356={};_0xafa356[_0x19e8da[_0xd3b4('0x26')]]={'$like':'%'+_0x3b246b[_0xd3b4('0x2f')][_0xd3b4('0x39')]+'%'};return _0xafa356;}})});}_0xff9983=_[_0xd3b4('0x3b')]({},_0xff9983,_0x3b246b[_0xd3b4('0x3d')]);var _0x49478d={'where':_0xff9983['where']};return db[_0xd3b4('0x29')][_0xd3b4('0x1b')](_0x49478d)['then'](function(_0x4057f5){_0x43be5f[_0xd3b4('0x1b')]=_0x4057f5;if(_0x3b246b[_0xd3b4('0x2f')][_0xd3b4('0x3e')]){_0xff9983[_0xd3b4('0x3f')]=[{'all':!![]}];}return db[_0xd3b4('0x29')]['findAll'](_0xff9983);})['then'](function(_0x232b29){_0x43be5f[_0xd3b4('0x40')]=_0x232b29;return _0x43be5f;})[_0xd3b4('0x24')](respondWithFilteredResult(_0x1ee071,_0xff9983))[_0xd3b4('0x41')](handleError(_0x1ee071,null));};exports[_0xd3b4('0x42')]=function(_0xe0bbd7,_0x200730){var _0x41c190={'raw':!![],'where':{'id':_0xe0bbd7[_0xd3b4('0x43')]['id']}},_0x533263={};_0x533263[_0xd3b4('0x2e')]=_[_0xd3b4('0x30')](db['ZohoField'][_0xd3b4('0x2a')]);_0x533263[_0xd3b4('0x2f')]=_[_0xd3b4('0x30')](_0xe0bbd7[_0xd3b4('0x2f')]);_0x533263[_0xd3b4('0x31')]=_['intersection'](_0x533263[_0xd3b4('0x2e')],_0x533263[_0xd3b4('0x2f')]);_0x41c190['attributes']=_['intersection'](_0x533263['model'],qs[_0xd3b4('0x34')](_0xe0bbd7['query'][_0xd3b4('0x34')]));_0x41c190[_0xd3b4('0x33')]=_0x41c190[_0xd3b4('0x33')]['length']?_0x41c190['attributes']:_0x533263[_0xd3b4('0x2e')];if(_0xe0bbd7[_0xd3b4('0x2f')][_0xd3b4('0x3e')]){_0x41c190[_0xd3b4('0x3f')]=[{'all':!![]}];}_0x41c190=_['merge']({},_0x41c190,_0xe0bbd7[_0xd3b4('0x3d')]);return db[_0xd3b4('0x29')][_0xd3b4('0x44')](_0x41c190)[_0xd3b4('0x24')](handleEntityNotFound(_0x200730,null))[_0xd3b4('0x24')](respondWithResult(_0x200730,null))[_0xd3b4('0x41')](handleError(_0x200730,null));};exports[_0xd3b4('0x45')]=function(_0x3f798f,_0x5d21ee){return db[_0xd3b4('0x29')][_0xd3b4('0x45')](_0x3f798f[_0xd3b4('0x46')],{})[_0xd3b4('0x24')](respondWithResult(_0x5d21ee,0xc9))[_0xd3b4('0x41')](handleError(_0x5d21ee,null));};exports[_0xd3b4('0x23')]=function(_0x2647e6,_0xcba5){if(_0x2647e6[_0xd3b4('0x46')]['id']){delete _0x2647e6[_0xd3b4('0x46')]['id'];}return db[_0xd3b4('0x29')][_0xd3b4('0x44')]({'where':{'id':_0x2647e6['params']['id']}})[_0xd3b4('0x24')](handleEntityNotFound(_0xcba5,null))[_0xd3b4('0x24')](saveUpdates(_0x2647e6[_0xd3b4('0x46')],null))['then'](respondWithResult(_0xcba5,null))[_0xd3b4('0x41')](handleError(_0xcba5,null));};exports[_0xd3b4('0x47')]=function(_0x442db8,_0x2dc47e){return db[_0xd3b4('0x29')][_0xd3b4('0x44')]({'where':{'id':_0x442db8[_0xd3b4('0x43')]['id']}})[_0xd3b4('0x24')](handleEntityNotFound(_0x2dc47e,null))[_0xd3b4('0x24')](removeEntity(_0x2dc47e,null))[_0xd3b4('0x41')](handleError(_0x2dc47e,null));}; \ No newline at end of file +var _0x674c=['options','find','catch','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','ZohoField','includeAll','include','findAll','show'];(function(_0x305c1f,_0xf8de1c){var _0x3579b2=function(_0x45c85a){while(--_0x45c85a){_0x305c1f['push'](_0x305c1f['shift']());}};_0x3579b2(++_0xf8de1c);}(_0x674c,0x169));var _0xc674=function(_0x360e10,_0xfb05bf){_0x360e10=_0x360e10-0x0;var _0x4fddc9=_0x674c[_0x360e10];return _0x4fddc9;};'use strict';var pdf=require(_0xc674('0x0'));var emlformat=require(_0xc674('0x1'));var rimraf=require(_0xc674('0x2'));var zipdir=require(_0xc674('0x3'));var jsonpatch=require(_0xc674('0x4'));var rp=require(_0xc674('0x5'));var moment=require(_0xc674('0x6'));var BPromise=require(_0xc674('0x7'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc674('0x8'));var csv=require(_0xc674('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc674('0xa'));var squel=require(_0xc674('0xb'));var crypto=require('crypto');var jsforce=require(_0xc674('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc674('0xd'));var Papa=require('papaparse');var Redis=require(_0xc674('0xe'));var authService=require(_0xc674('0xf'));var qs=require(_0xc674('0x10'));var as=require(_0xc674('0x11'));var hardwareService=require(_0xc674('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0xc674('0x13'));var config=require(_0xc674('0x14'));var licenseUtil=require(_0xc674('0x15'));var db=require(_0xc674('0x16'))['db'];function respondWithStatusCode(_0x5ed435,_0x2060d9){_0x2060d9=_0x2060d9||0xcc;return function(_0x31a6a1){if(_0x31a6a1){return _0x5ed435['sendStatus'](_0x2060d9);}return _0x5ed435['status'](_0x2060d9)[_0xc674('0x17')]();};}function respondWithResult(_0x289dd7,_0x4b0711){_0x4b0711=_0x4b0711||0xc8;return function(_0x19afe0){if(_0x19afe0){return _0x289dd7[_0xc674('0x18')](_0x4b0711)[_0xc674('0x19')](_0x19afe0);}};}function respondWithFilteredResult(_0x52bebe,_0x36d330){return function(_0x173460){if(_0x173460){var _0x43e9ac=_0x173460[_0xc674('0x1a')],_0x2b39dc=_0x36d330[_0xc674('0x1b')],_0x42f50f=_0x36d330[_0xc674('0x1b')]+_0x36d330[_0xc674('0x1c')],_0x4f0fd6;if(_0x42f50f>=_0x43e9ac){_0x42f50f=_0x43e9ac;_0x4f0fd6=0xc8;}else{_0x4f0fd6=0xce;}_0x52bebe[_0xc674('0x18')](_0x4f0fd6);return _0x52bebe[_0xc674('0x1d')](_0xc674('0x1e'),_0x2b39dc+'-'+_0x42f50f+'/'+_0x43e9ac)[_0xc674('0x19')](_0x173460);}return null;};}function patchUpdates(_0x154c06){return function(_0x8bd443){try{jsonpatch['apply'](_0x8bd443,_0x154c06,!![]);}catch(_0x5bd09e){return BPromise[_0xc674('0x1f')](_0x5bd09e);}return _0x8bd443[_0xc674('0x20')]();};}function saveUpdates(_0xda46de,_0x21ad6f){return function(_0x334e33){if(_0x334e33){return _0x334e33[_0xc674('0x21')](_0xda46de)[_0xc674('0x22')](function(_0x106e21){return _0x106e21;});}return null;};}function removeEntity(_0x317599,_0x54f2c9){return function(_0x5911f4){if(_0x5911f4){return _0x5911f4[_0xc674('0x23')]()[_0xc674('0x22')](function(){_0x317599[_0xc674('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cf8c9,_0x206b20){return function(_0x586c02){if(!_0x586c02){_0x1cf8c9['sendStatus'](0x194);}return _0x586c02;};}function handleError(_0x512237,_0x3d4b98){_0x3d4b98=_0x3d4b98||0x1f4;return function(_0x29139b){logger[_0xc674('0x24')](_0x29139b[_0xc674('0x25')]);if(_0x29139b[_0xc674('0x26')]){delete _0x29139b['name'];}_0x512237[_0xc674('0x18')](_0x3d4b98)[_0xc674('0x27')](_0x29139b);};}exports[_0xc674('0x28')]=function(_0x2567e6,_0x3bd217){var _0x11b282={},_0x5116c0={},_0x3b4776={'count':0x0,'rows':[]};var _0xd6be88=_[_0xc674('0x29')](db['ZohoField'][_0xc674('0x2a')],function(_0xe65e5f){return{'name':_0xe65e5f['fieldName'],'type':_0xe65e5f['type'][_0xc674('0x2b')]};});_0x5116c0['model']=_[_0xc674('0x29')](_0xd6be88,_0xc674('0x26'));_0x5116c0[_0xc674('0x2c')]=_[_0xc674('0x2d')](_0x2567e6[_0xc674('0x2c')]);_0x5116c0[_0xc674('0x2e')]=_[_0xc674('0x2f')](_0x5116c0[_0xc674('0x30')],_0x5116c0[_0xc674('0x2c')]);_0x11b282[_0xc674('0x31')]=_['intersection'](_0x5116c0[_0xc674('0x30')],qs[_0xc674('0x32')](_0x2567e6[_0xc674('0x2c')][_0xc674('0x32')]));_0x11b282[_0xc674('0x31')]=_0x11b282[_0xc674('0x31')][_0xc674('0x33')]?_0x11b282[_0xc674('0x31')]:_0x5116c0[_0xc674('0x30')];if(!_0x2567e6[_0xc674('0x2c')]['hasOwnProperty'](_0xc674('0x34'))){_0x11b282[_0xc674('0x1c')]=qs[_0xc674('0x1c')](_0x2567e6[_0xc674('0x2c')]['limit']);_0x11b282[_0xc674('0x1b')]=qs[_0xc674('0x1b')](_0x2567e6[_0xc674('0x2c')]['offset']);}_0x11b282[_0xc674('0x35')]=qs[_0xc674('0x36')](_0x2567e6['query']['sort']);_0x11b282[_0xc674('0x37')]=qs['filters'](_[_0xc674('0x38')](_0x2567e6[_0xc674('0x2c')],_0x5116c0[_0xc674('0x2e')]),_0xd6be88);if(_0x2567e6[_0xc674('0x2c')][_0xc674('0x39')]){_0x11b282[_0xc674('0x37')]=_[_0xc674('0x3a')](_0x11b282[_0xc674('0x37')],{'$or':_[_0xc674('0x29')](_0xd6be88,function(_0x55c767){if(_0x55c767[_0xc674('0x3b')]!=='VIRTUAL'){var _0x2cee8f={};_0x2cee8f[_0x55c767[_0xc674('0x26')]]={'$like':'%'+_0x2567e6['query'][_0xc674('0x39')]+'%'};return _0x2cee8f;}})});}_0x11b282=_[_0xc674('0x3a')]({},_0x11b282,_0x2567e6['options']);var _0x4e4869={'where':_0x11b282['where']};return db[_0xc674('0x3c')][_0xc674('0x1a')](_0x4e4869)[_0xc674('0x22')](function(_0x219fe5){_0x3b4776[_0xc674('0x1a')]=_0x219fe5;if(_0x2567e6['query'][_0xc674('0x3d')]){_0x11b282[_0xc674('0x3e')]=[{'all':!![]}];}return db[_0xc674('0x3c')][_0xc674('0x3f')](_0x11b282);})[_0xc674('0x22')](function(_0x5093ff){_0x3b4776['rows']=_0x5093ff;return _0x3b4776;})[_0xc674('0x22')](respondWithFilteredResult(_0x3bd217,_0x11b282))['catch'](handleError(_0x3bd217,null));};exports[_0xc674('0x40')]=function(_0x325bb3,_0x540534){var _0x456a86={'raw':!![],'where':{'id':_0x325bb3['params']['id']}},_0x133de3={};_0x133de3[_0xc674('0x30')]=_[_0xc674('0x2d')](db[_0xc674('0x3c')][_0xc674('0x2a')]);_0x133de3[_0xc674('0x2c')]=_['keys'](_0x325bb3[_0xc674('0x2c')]);_0x133de3[_0xc674('0x2e')]=_[_0xc674('0x2f')](_0x133de3['model'],_0x133de3[_0xc674('0x2c')]);_0x456a86['attributes']=_[_0xc674('0x2f')](_0x133de3[_0xc674('0x30')],qs[_0xc674('0x32')](_0x325bb3[_0xc674('0x2c')][_0xc674('0x32')]));_0x456a86[_0xc674('0x31')]=_0x456a86[_0xc674('0x31')][_0xc674('0x33')]?_0x456a86[_0xc674('0x31')]:_0x133de3[_0xc674('0x30')];if(_0x325bb3['query']['includeAll']){_0x456a86[_0xc674('0x3e')]=[{'all':!![]}];}_0x456a86=_[_0xc674('0x3a')]({},_0x456a86,_0x325bb3[_0xc674('0x41')]);return db[_0xc674('0x3c')][_0xc674('0x42')](_0x456a86)[_0xc674('0x22')](handleEntityNotFound(_0x540534,null))[_0xc674('0x22')](respondWithResult(_0x540534,null))[_0xc674('0x43')](handleError(_0x540534,null));};exports['create']=function(_0x51b28c,_0x166ef1){return db[_0xc674('0x3c')][_0xc674('0x44')](_0x51b28c['body'],{})[_0xc674('0x22')](respondWithResult(_0x166ef1,0xc9))[_0xc674('0x43')](handleError(_0x166ef1,null));};exports[_0xc674('0x21')]=function(_0x1416b0,_0x470526){if(_0x1416b0[_0xc674('0x45')]['id']){delete _0x1416b0[_0xc674('0x45')]['id'];}return db[_0xc674('0x3c')]['find']({'where':{'id':_0x1416b0[_0xc674('0x46')]['id']}})[_0xc674('0x22')](handleEntityNotFound(_0x470526,null))[_0xc674('0x22')](saveUpdates(_0x1416b0[_0xc674('0x45')],null))['then'](respondWithResult(_0x470526,null))[_0xc674('0x43')](handleError(_0x470526,null));};exports[_0xc674('0x23')]=function(_0x5bf868,_0x5da164){return db[_0xc674('0x3c')][_0xc674('0x42')]({'where':{'id':_0x5bf868['params']['id']}})[_0xc674('0x22')](handleEntityNotFound(_0x5da164,null))[_0xc674('0x22')](removeEntity(_0x5da164,null))[_0xc674('0x43')](handleError(_0x5da164,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index c97ce5f..13cb026 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 _0x2e8d=['lodash','util','../../config/logger','api','bluebird','request-promise','path','exports','define','ZohoField','zoho_unique_index','idField','FieldId'];(function(_0x3a9b86,_0x3d5660){var _0x4a8e74=function(_0x429a15){while(--_0x429a15){_0x3a9b86['push'](_0x3a9b86['shift']());}};_0x4a8e74(++_0x3d5660);}(_0x2e8d,0x1ee));var _0xd2e8=function(_0x489ba5,_0xa1a03c){_0x489ba5=_0x489ba5-0x0;var _0x3727e9=_0x2e8d[_0x489ba5];return _0x3727e9;};'use strict';var _=require(_0xd2e8('0x0'));var util=require(_0xd2e8('0x1'));var logger=require(_0xd2e8('0x2'))(_0xd2e8('0x3'));var moment=require('moment');var BPromise=require(_0xd2e8('0x4'));var rp=require(_0xd2e8('0x5'));var fs=require('fs');var path=require(_0xd2e8('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0xd2e8('0x7')]=function(_0x597274,_0x2b07b2){return _0x597274[_0xd2e8('0x8')](_0xd2e8('0x9'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xd2e8('0xa'),'fields':[_0xd2e8('0xb'),_0xd2e8('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x38b0=['idField','lodash','util','../../config/logger','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','zoho_unique_index'];(function(_0x4dd1bc,_0x569a04){var _0x5827d6=function(_0x1390bd){while(--_0x1390bd){_0x4dd1bc['push'](_0x4dd1bc['shift']());}};_0x5827d6(++_0x569a04);}(_0x38b0,0x1bd));var _0x038b=function(_0xee2e7a,_0x58354d){_0xee2e7a=_0xee2e7a-0x0;var _0x319dd3=_0x38b0[_0xee2e7a];return _0x319dd3;};'use strict';var _=require(_0x038b('0x0'));var util=require(_0x038b('0x1'));var logger=require(_0x038b('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x038b('0x3'));var rimraf=require(_0x038b('0x4'));var config=require(_0x038b('0x5'));var attributes=require(_0x038b('0x6'));module[_0x038b('0x7')]=function(_0x32f9b0,_0x37a57c){return _0x32f9b0[_0x038b('0x8')](_0x038b('0x9'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x038b('0xa'),'fields':[_0x038b('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 9343d4a..3993f9f 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 _0x24ca=['request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s'];(function(_0x49d02a,_0xbb6876){var _0x1dc79d=function(_0x2bcf84){while(--_0x2bcf84){_0x49d02a['push'](_0x49d02a['shift']());}};_0x1dc79d(++_0xbb6876);}(_0x24ca,0x1bc));var _0xa24c=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x24ca[_0x255d5b];return _0x3e141a;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var moment=require(_0xa24c('0x1'));var BPromise=require(_0xa24c('0x2'));var rs=require(_0xa24c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa24c('0x4'))['db'];var utils=require(_0xa24c('0x5'));var logger=require(_0xa24c('0x6'))(_0xa24c('0x7'));var config=require(_0xa24c('0x8'));var jayson=require(_0xa24c('0x9'));var client=jayson[_0xa24c('0xa')][_0xa24c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dd348,_0x257264,_0x9a5013){return new BPromise(function(_0x481196,_0x42d89c){return client[_0xa24c('0xc')](_0x2dd348,_0x9a5013)[_0xa24c('0xd')](function(_0x5eac78){logger[_0xa24c('0xe')](_0xa24c('0xf'),_0x257264,_0xa24c('0x10'));logger[_0xa24c('0x11')](_0xa24c('0x12'),_0x257264,_0xa24c('0x10'),JSON[_0xa24c('0x13')](_0x5eac78));if(_0x5eac78[_0xa24c('0x14')]){if(_0x5eac78[_0xa24c('0x14')]['code']===0x1f4){logger[_0xa24c('0x14')](_0xa24c('0xf'),_0x257264,_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);return _0x42d89c(_0x5eac78['error'][_0xa24c('0x15')]);}logger[_0xa24c('0x14')](_0xa24c('0xf'),_0x257264,_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);return _0x481196(_0x5eac78[_0xa24c('0x14')][_0xa24c('0x15')]);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x257264,_0xa24c('0x10'));_0x481196(_0x5eac78[_0xa24c('0x16')]['message']);}})['catch'](function(_0x221d21){logger[_0xa24c('0x14')]('ZohoField,\x20%s,\x20%s',_0x257264,_0x221d21);_0x42d89c(_0x221d21);});});} \ No newline at end of file +var _0xb458=['ZohoField,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','ZohoField,\x20%s,\x20%s','debug'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xb458,0x103));var _0x8b45=function(_0x398ea5,_0x5f1165){_0x398ea5=_0x398ea5-0x0;var _0x571896=_0xb458[_0x398ea5];return _0x571896;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x3'));var db=require(_0x8b45('0x4'))['db'];var utils=require(_0x8b45('0x5'));var logger=require(_0x8b45('0x6'))('rpc');var config=require(_0x8b45('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b45('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12bd05,_0x2daa9a,_0x3a8ccb){return new BPromise(function(_0x32342f,_0x4d1718){return client[_0x8b45('0x9')](_0x12bd05,_0x3a8ccb)[_0x8b45('0xa')](function(_0x33f30e){logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,'request\x20sent');logger[_0x8b45('0xd')](_0x8b45('0xe'),_0x2daa9a,'request\x20sent',JSON['stringify'](_0x33f30e));if(_0x33f30e['error']){if(_0x33f30e['error'][_0x8b45('0xf')]===0x1f4){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e['error'][_0x8b45('0x11')]);return _0x4d1718(_0x33f30e[_0x8b45('0x10')][_0x8b45('0x11')]);}logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x33f30e[_0x8b45('0x10')]['message']);return _0x32342f(_0x33f30e['error'][_0x8b45('0x11')]);}else{logger[_0x8b45('0xb')](_0x8b45('0xc'),_0x2daa9a,_0x8b45('0x12'));_0x32342f(_0x33f30e[_0x8b45('0x13')][_0x8b45('0x11')]);}})[_0x8b45('0x14')](function(_0x147d6b){logger[_0x8b45('0x10')](_0x8b45('0xc'),_0x2daa9a,_0x147d6b);_0x4d1718(_0x147d6b);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 0fc3400..b09fe62 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 _0x1327=['../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x244f5d,_0x3c98c6){var _0x1a3886=function(_0x2bf049){while(--_0x2bf049){_0x244f5d['push'](_0x244f5d['shift']());}};_0x1a3886(++_0x3c98c6);}(_0x1327,0x192));var _0x7132=function(_0x4e72a5,_0x59d207){_0x4e72a5=_0x4e72a5-0x0;var _0x5c608f=_0x1327[_0x4e72a5];return _0x5c608f;};'use strict';var multer=require(_0x7132('0x0'));var util=require(_0x7132('0x1'));var path=require(_0x7132('0x2'));var timeout=require(_0x7132('0x3'));var express=require('express');var router=express[_0x7132('0x4')]();var auth=require(_0x7132('0x5'));var interaction=require(_0x7132('0x6'));var config=require(_0x7132('0x7'));module['exports']=router; \ No newline at end of file +var _0x03ec=['util','connect-timeout','express','../../components/auth/service','exports'];(function(_0x4b8332,_0x5f0f3c){var _0x163feb=function(_0x4f5eb3){while(--_0x4f5eb3){_0x4b8332['push'](_0x4b8332['shift']());}};_0x163feb(++_0x5f0f3c);}(_0x03ec,0x186));var _0xc03e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x03ec[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0xc03e('0x0'));var path=require('path');var timeout=require(_0xc03e('0x1'));var express=require(_0xc03e('0x2'));var router=express['Router']();var auth=require(_0xc03e('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0xc03e('0x4')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 733cfa6..b8c42f0 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 _0x09ab=['state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN'];(function(_0xaf524,_0x288431){var _0x4a5cf2=function(_0x5c1330){while(--_0x5c1330){_0xaf524['push'](_0xaf524['shift']());}};_0x4a5cf2(++_0x288431);}(_0x09ab,0x179));var _0xb09a=function(_0x561d9f,_0x447dea){_0x561d9f=_0x561d9f-0x0;var _0x4ecca0=_0x09ab[_0x561d9f];return _0x4ecca0;};'use strict';var Sequelize=require(_0xb09a('0x0'));module[_0xb09a('0x1')]={'name':{'type':Sequelize[_0xb09a('0x2')],'allowNull':![],'unique':_0xb09a('0x3')},'version':{'type':Sequelize[_0xb09a('0x2')],'allowNull':![],'unique':_0xb09a('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xb09a('0x4')},'filename':{'type':Sequelize[_0xb09a('0x2')]},'path':{'type':Sequelize[_0xb09a('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0xb09a('0x5')]},'active':{'type':Sequelize[_0xb09a('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xb09a('0x2')],'unique':_0xb09a('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xb09a('0x2')]},'link':{'type':Sequelize[_0xb09a('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x843e=['STRING','unique_name_and_version','INTEGER','BOOLEAN','sequelize'];(function(_0x211f8c,_0x455992){var _0x2b2f22=function(_0x2b9b77){while(--_0x2b9b77){_0x211f8c['push'](_0x211f8c['shift']());}};_0x2b2f22(++_0x455992);}(_0x843e,0x1c1));var _0xe843=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x843e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe843('0x0'));module['exports']={'name':{'type':Sequelize[_0xe843('0x1')],'allowNull':![],'unique':_0xe843('0x2')},'version':{'type':Sequelize[_0xe843('0x1')],'allowNull':![],'unique':_0xe843('0x2')},'main':{'type':Sequelize[_0xe843('0x1')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xe843('0x1')]},'path':{'type':Sequelize[_0xe843('0x1')]},'type':{'type':Sequelize[_0xe843('0x1')]},'size':{'type':Sequelize[_0xe843('0x3')]},'active':{'type':Sequelize[_0xe843('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0xe843('0x1')]},'logo':{'type':Sequelize[_0xe843('0x1')]},'state':{'type':Sequelize[_0xe843('0x1')],'unique':'state'},'description':{'type':Sequelize[_0xe843('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xe843('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 9162a14..c6d519e 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 _0x314e=['model','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','options','include','catch','show','params','length','includeAll','create','body','find','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','Integration','rawAttributes','fieldName','type','key','query','keys','filters'];(function(_0x103e59,_0x19e72a){var _0x17c311=function(_0x580e2d){while(--_0x580e2d){_0x103e59['push'](_0x103e59['shift']());}};_0x17c311(++_0x19e72a);}(_0x314e,0x173));var _0xe314=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x314e[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0xe314('0x0'));var emlformat=require(_0xe314('0x1'));var rimraf=require(_0xe314('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe314('0x3'));var rp=require('request-promise');var moment=require(_0xe314('0x4'));var BPromise=require(_0xe314('0x5'));var Mustache=require('mustache');var util=require(_0xe314('0x6'));var path=require('path');var sox=require(_0xe314('0x7'));var csv=require(_0xe314('0x8'));var ejs=require(_0xe314('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe314('0xa'));var jsforce=require(_0xe314('0xb'));var deskjs=require(_0xe314('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe314('0xd'));var Redis=require(_0xe314('0xe'));var authService=require(_0xe314('0xf'));var qs=require(_0xe314('0x10'));var as=require(_0xe314('0x11'));var hardwareService=require(_0xe314('0x12'));var logger=require(_0xe314('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xe314('0x14'));var licenseUtil=require(_0xe314('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cb3b3,_0x2888b9){_0x2888b9=_0x2888b9||0xcc;return function(_0x1b7407){if(_0x1b7407){return _0x5cb3b3['sendStatus'](_0x2888b9);}return _0x5cb3b3['status'](_0x2888b9)[_0xe314('0x16')]();};}function respondWithResult(_0x1a0df8,_0xb59a5e){_0xb59a5e=_0xb59a5e||0xc8;return function(_0x365ddf){if(_0x365ddf){return _0x1a0df8[_0xe314('0x17')](_0xb59a5e)[_0xe314('0x18')](_0x365ddf);}};}function respondWithFilteredResult(_0x2a4644,_0x58e694){return function(_0x4af251){if(_0x4af251){var _0x4f0705=_0x4af251[_0xe314('0x19')],_0x52dde9=_0x58e694['offset'],_0x529279=_0x58e694[_0xe314('0x1a')]+_0x58e694[_0xe314('0x1b')],_0x503bb2;if(_0x529279>=_0x4f0705){_0x529279=_0x4f0705;_0x503bb2=0xc8;}else{_0x503bb2=0xce;}_0x2a4644['status'](_0x503bb2);return _0x2a4644[_0xe314('0x1c')](_0xe314('0x1d'),_0x52dde9+'-'+_0x529279+'/'+_0x4f0705)[_0xe314('0x18')](_0x4af251);}return null;};}function patchUpdates(_0x2368c9){return function(_0x54e426){try{jsonpatch[_0xe314('0x1e')](_0x54e426,_0x2368c9,!![]);}catch(_0xf4da4e){return BPromise[_0xe314('0x1f')](_0xf4da4e);}return _0x54e426[_0xe314('0x20')]();};}function saveUpdates(_0xd37018,_0x9f7c02){return function(_0x265c35){if(_0x265c35){return _0x265c35[_0xe314('0x21')](_0xd37018)[_0xe314('0x22')](function(_0x562e4a){return _0x562e4a;});}return null;};}function removeEntity(_0x11c27f,_0x3a9326){return function(_0x5ce605){if(_0x5ce605){return _0x5ce605[_0xe314('0x23')]()[_0xe314('0x22')](function(){_0x11c27f[_0xe314('0x17')](0xcc)[_0xe314('0x16')]();});}};}function handleEntityNotFound(_0x1f1625,_0x5d62b4){return function(_0x3cfe75){if(!_0x3cfe75){_0x1f1625[_0xe314('0x24')](0x194);}return _0x3cfe75;};}function handleError(_0x288066,_0x201690){_0x201690=_0x201690||0x1f4;return function(_0x4effcd){logger[_0xe314('0x25')](_0x4effcd['stack']);if(_0x4effcd[_0xe314('0x26')]){delete _0x4effcd[_0xe314('0x26')];}_0x288066[_0xe314('0x17')](_0x201690)[_0xe314('0x27')](_0x4effcd);};}exports['index']=function(_0x3911e7,_0xb0a1ac){var _0x1cf240={},_0x346b61={},_0x1116f7={'count':0x0,'rows':[]};var _0x378895=_[_0xe314('0x28')](db[_0xe314('0x29')][_0xe314('0x2a')],function(_0x561baa){return{'name':_0x561baa[_0xe314('0x2b')],'type':_0x561baa[_0xe314('0x2c')][_0xe314('0x2d')]};});_0x346b61['model']=_[_0xe314('0x28')](_0x378895,'name');_0x346b61[_0xe314('0x2e')]=_[_0xe314('0x2f')](_0x3911e7[_0xe314('0x2e')]);_0x346b61[_0xe314('0x30')]=_['intersection'](_0x346b61[_0xe314('0x31')],_0x346b61[_0xe314('0x2e')]);_0x1cf240[_0xe314('0x32')]=_[_0xe314('0x33')](_0x346b61[_0xe314('0x31')],qs[_0xe314('0x34')](_0x3911e7[_0xe314('0x2e')][_0xe314('0x34')]));_0x1cf240['attributes']=_0x1cf240[_0xe314('0x32')]['length']?_0x1cf240['attributes']:_0x346b61[_0xe314('0x31')];if(!_0x3911e7[_0xe314('0x2e')]['hasOwnProperty'](_0xe314('0x35'))){_0x1cf240[_0xe314('0x1b')]=qs[_0xe314('0x1b')](_0x3911e7[_0xe314('0x2e')][_0xe314('0x1b')]);_0x1cf240[_0xe314('0x1a')]=qs[_0xe314('0x1a')](_0x3911e7[_0xe314('0x2e')][_0xe314('0x1a')]);}_0x1cf240[_0xe314('0x36')]=qs[_0xe314('0x37')](_0x3911e7[_0xe314('0x2e')][_0xe314('0x37')]);_0x1cf240[_0xe314('0x38')]=qs[_0xe314('0x30')](_[_0xe314('0x39')](_0x3911e7[_0xe314('0x2e')],_0x346b61[_0xe314('0x30')]),_0x378895);if(_0x3911e7[_0xe314('0x2e')][_0xe314('0x3a')]){_0x1cf240['where']=_[_0xe314('0x3b')](_0x1cf240['where'],{'$or':_['map'](_0x378895,function(_0x10916b){if(_0x10916b['type']!=='VIRTUAL'){var _0x1fa3aa={};_0x1fa3aa[_0x10916b[_0xe314('0x26')]]={'$like':'%'+_0x3911e7[_0xe314('0x2e')][_0xe314('0x3a')]+'%'};return _0x1fa3aa;}})});}_0x1cf240=_[_0xe314('0x3b')]({},_0x1cf240,_0x3911e7[_0xe314('0x3c')]);var _0x29834a={'where':_0x1cf240['where']};return db[_0xe314('0x29')][_0xe314('0x19')](_0x29834a)['then'](function(_0x28b0d2){_0x1116f7[_0xe314('0x19')]=_0x28b0d2;if(_0x3911e7[_0xe314('0x2e')]['includeAll']){_0x1cf240[_0xe314('0x3d')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x1cf240);})[_0xe314('0x22')](function(_0x279073){_0x1116f7['rows']=_0x279073;return _0x1116f7;})[_0xe314('0x22')](respondWithFilteredResult(_0xb0a1ac,_0x1cf240))[_0xe314('0x3e')](handleError(_0xb0a1ac,null));};exports[_0xe314('0x3f')]=function(_0x5b06b1,_0x45d231){var _0x2e86f1={'raw':![],'where':{'id':_0x5b06b1[_0xe314('0x40')]['id']}},_0x121ad8={};_0x121ad8[_0xe314('0x31')]=_[_0xe314('0x2f')](db[_0xe314('0x29')][_0xe314('0x2a')]);_0x121ad8[_0xe314('0x2e')]=_[_0xe314('0x2f')](_0x5b06b1[_0xe314('0x2e')]);_0x121ad8[_0xe314('0x30')]=_[_0xe314('0x33')](_0x121ad8[_0xe314('0x31')],_0x121ad8[_0xe314('0x2e')]);_0x2e86f1[_0xe314('0x32')]=_[_0xe314('0x33')](_0x121ad8[_0xe314('0x31')],qs[_0xe314('0x34')](_0x5b06b1[_0xe314('0x2e')][_0xe314('0x34')]));_0x2e86f1[_0xe314('0x32')]=_0x2e86f1['attributes'][_0xe314('0x41')]?_0x2e86f1[_0xe314('0x32')]:_0x121ad8[_0xe314('0x31')];if(_0x5b06b1['query'][_0xe314('0x42')]){_0x2e86f1[_0xe314('0x3d')]=[{'all':!![]}];}_0x2e86f1=_['merge']({},_0x2e86f1,_0x5b06b1[_0xe314('0x3c')]);return db[_0xe314('0x29')]['find'](_0x2e86f1)['then'](handleEntityNotFound(_0x45d231,null))[_0xe314('0x22')](respondWithResult(_0x45d231,null))[_0xe314('0x3e')](handleError(_0x45d231,null));};exports[_0xe314('0x43')]=function(_0x18bf68,_0x497fa0){return db[_0xe314('0x29')]['create'](_0x18bf68[_0xe314('0x44')],{})[_0xe314('0x22')](respondWithResult(_0x497fa0,0xc9))[_0xe314('0x3e')](handleError(_0x497fa0,null));};exports[_0xe314('0x21')]=function(_0x5f10a4,_0x174fc0){if(_0x5f10a4[_0xe314('0x44')]['id']){delete _0x5f10a4[_0xe314('0x44')]['id'];}return db[_0xe314('0x29')]['find']({'where':{'id':_0x5f10a4[_0xe314('0x40')]['id']}})['then'](handleEntityNotFound(_0x174fc0,null))[_0xe314('0x22')](saveUpdates(_0x5f10a4[_0xe314('0x44')],null))[_0xe314('0x22')](respondWithResult(_0x174fc0,null))[_0xe314('0x3e')](handleError(_0x174fc0,null));};exports[_0xe314('0x23')]=function(_0x29af46,_0x52f28d){return db['Integration'][_0xe314('0x45')]({'where':{'id':_0x29af46[_0xe314('0x40')]['id']}})[_0xe314('0x22')](handleEntityNotFound(_0x52f28d,null))[_0xe314('0x22')](removeEntity(_0x52f28d,null))['catch'](handleError(_0x52f28d,null));}; \ No newline at end of file +var _0x527c=['error','stack','name','map','Integration','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','then','include','findAll','catch','show','merge','create','body','find','params','destroy','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','ejs','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','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','sendStatus'];(function(_0x223d47,_0x45bfcc){var _0xdf8129=function(_0x5022f9){while(--_0x5022f9){_0x223d47['push'](_0x223d47['shift']());}};_0xdf8129(++_0x45bfcc);}(_0x527c,0xb3));var _0xc527=function(_0x14f89e,_0x139fce){_0x14f89e=_0x14f89e-0x0;var _0x26092d=_0x527c[_0x14f89e];return _0x26092d;};'use strict';var pdf=require(_0xc527('0x0'));var emlformat=require(_0xc527('0x1'));var rimraf=require(_0xc527('0x2'));var zipdir=require(_0xc527('0x3'));var jsonpatch=require(_0xc527('0x4'));var rp=require(_0xc527('0x5'));var moment=require(_0xc527('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xc527('0x7'));var util=require('util');var path=require(_0xc527('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc527('0x9'));var fs=require('fs');var _=require(_0xc527('0xa'));var squel=require(_0xc527('0xb'));var crypto=require(_0xc527('0xc'));var jsforce=require(_0xc527('0xd'));var deskjs=require(_0xc527('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc527('0xf'));var Redis=require(_0xc527('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc527('0x11'));var as=require(_0xc527('0x12'));var hardwareService=require(_0xc527('0x13'));var logger=require(_0xc527('0x14'))(_0xc527('0x15'));var utils=require(_0xc527('0x16'));var config=require(_0xc527('0x17'));var licenseUtil=require(_0xc527('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c09e6,_0x25e5a8){_0x25e5a8=_0x25e5a8||0xcc;return function(_0x4f346a){if(_0x4f346a){return _0x1c09e6['sendStatus'](_0x25e5a8);}return _0x1c09e6[_0xc527('0x19')](_0x25e5a8)[_0xc527('0x1a')]();};}function respondWithResult(_0x58f035,_0x3f9042){_0x3f9042=_0x3f9042||0xc8;return function(_0x25f913){if(_0x25f913){return _0x58f035[_0xc527('0x19')](_0x3f9042)[_0xc527('0x1b')](_0x25f913);}};}function respondWithFilteredResult(_0x1d5c1c,_0x4f2a2f){return function(_0x5667ee){if(_0x5667ee){var _0x2860e6=_0x5667ee[_0xc527('0x1c')],_0x2676b6=_0x4f2a2f[_0xc527('0x1d')],_0x1510fd=_0x4f2a2f[_0xc527('0x1d')]+_0x4f2a2f[_0xc527('0x1e')],_0x1faeec;if(_0x1510fd>=_0x2860e6){_0x1510fd=_0x2860e6;_0x1faeec=0xc8;}else{_0x1faeec=0xce;}_0x1d5c1c[_0xc527('0x19')](_0x1faeec);return _0x1d5c1c[_0xc527('0x1f')](_0xc527('0x20'),_0x2676b6+'-'+_0x1510fd+'/'+_0x2860e6)[_0xc527('0x1b')](_0x5667ee);}return null;};}function patchUpdates(_0x34efc6){return function(_0x3bd20c){try{jsonpatch['apply'](_0x3bd20c,_0x34efc6,!![]);}catch(_0x181d68){return BPromise[_0xc527('0x21')](_0x181d68);}return _0x3bd20c[_0xc527('0x22')]();};}function saveUpdates(_0x287e5d,_0x32ffec){return function(_0x2807a8){if(_0x2807a8){return _0x2807a8[_0xc527('0x23')](_0x287e5d)['then'](function(_0x474362){return _0x474362;});}return null;};}function removeEntity(_0x4b23e1,_0x585a9d){return function(_0x50a07b){if(_0x50a07b){return _0x50a07b['destroy']()['then'](function(){_0x4b23e1[_0xc527('0x19')](0xcc)[_0xc527('0x1a')]();});}};}function handleEntityNotFound(_0x598758,_0x5e4364){return function(_0x160574){if(!_0x160574){_0x598758[_0xc527('0x24')](0x194);}return _0x160574;};}function handleError(_0x1ae64e,_0x3ac484){_0x3ac484=_0x3ac484||0x1f4;return function(_0xf91370){logger[_0xc527('0x25')](_0xf91370[_0xc527('0x26')]);if(_0xf91370['name']){delete _0xf91370[_0xc527('0x27')];}_0x1ae64e[_0xc527('0x19')](_0x3ac484)['send'](_0xf91370);};}exports['index']=function(_0x2755be,_0x187538){var _0x29b526={},_0x280779={},_0x3de0e0={'count':0x0,'rows':[]};var _0x424114=_[_0xc527('0x28')](db[_0xc527('0x29')]['rawAttributes'],function(_0x14be08){return{'name':_0x14be08[_0xc527('0x2a')],'type':_0x14be08[_0xc527('0x2b')]['key']};});_0x280779[_0xc527('0x2c')]=_[_0xc527('0x28')](_0x424114,_0xc527('0x27'));_0x280779[_0xc527('0x2d')]=_[_0xc527('0x2e')](_0x2755be[_0xc527('0x2d')]);_0x280779[_0xc527('0x2f')]=_[_0xc527('0x30')](_0x280779[_0xc527('0x2c')],_0x280779[_0xc527('0x2d')]);_0x29b526[_0xc527('0x31')]=_[_0xc527('0x30')](_0x280779[_0xc527('0x2c')],qs[_0xc527('0x32')](_0x2755be[_0xc527('0x2d')][_0xc527('0x32')]));_0x29b526['attributes']=_0x29b526[_0xc527('0x31')][_0xc527('0x33')]?_0x29b526[_0xc527('0x31')]:_0x280779['model'];if(!_0x2755be[_0xc527('0x2d')][_0xc527('0x34')](_0xc527('0x35'))){_0x29b526['limit']=qs['limit'](_0x2755be[_0xc527('0x2d')][_0xc527('0x1e')]);_0x29b526[_0xc527('0x1d')]=qs[_0xc527('0x1d')](_0x2755be[_0xc527('0x2d')][_0xc527('0x1d')]);}_0x29b526[_0xc527('0x36')]=qs['sort'](_0x2755be['query'][_0xc527('0x37')]);_0x29b526[_0xc527('0x38')]=qs[_0xc527('0x2f')](_[_0xc527('0x39')](_0x2755be[_0xc527('0x2d')],_0x280779[_0xc527('0x2f')]),_0x424114);if(_0x2755be[_0xc527('0x2d')][_0xc527('0x3a')]){_0x29b526[_0xc527('0x38')]=_['merge'](_0x29b526[_0xc527('0x38')],{'$or':_[_0xc527('0x28')](_0x424114,function(_0x57c59c){if(_0x57c59c['type']!==_0xc527('0x3b')){var _0x415bf6={};_0x415bf6[_0x57c59c[_0xc527('0x27')]]={'$like':'%'+_0x2755be[_0xc527('0x2d')][_0xc527('0x3a')]+'%'};return _0x415bf6;}})});}_0x29b526=_['merge']({},_0x29b526,_0x2755be[_0xc527('0x3c')]);var _0x44bc5b={'where':_0x29b526['where']};return db[_0xc527('0x29')][_0xc527('0x1c')](_0x44bc5b)[_0xc527('0x3d')](function(_0x4dd8cd){_0x3de0e0['count']=_0x4dd8cd;if(_0x2755be[_0xc527('0x2d')]['includeAll']){_0x29b526[_0xc527('0x3e')]=[{'all':!![]}];}return db[_0xc527('0x29')][_0xc527('0x3f')](_0x29b526);})['then'](function(_0xec5ce1){_0x3de0e0['rows']=_0xec5ce1;return _0x3de0e0;})['then'](respondWithFilteredResult(_0x187538,_0x29b526))[_0xc527('0x40')](handleError(_0x187538,null));};exports[_0xc527('0x41')]=function(_0x332780,_0xa3970e){var _0x88c87e={'raw':![],'where':{'id':_0x332780['params']['id']}},_0x13c3de={};_0x13c3de['model']=_[_0xc527('0x2e')](db['Integration']['rawAttributes']);_0x13c3de[_0xc527('0x2d')]=_['keys'](_0x332780[_0xc527('0x2d')]);_0x13c3de[_0xc527('0x2f')]=_[_0xc527('0x30')](_0x13c3de[_0xc527('0x2c')],_0x13c3de[_0xc527('0x2d')]);_0x88c87e[_0xc527('0x31')]=_[_0xc527('0x30')](_0x13c3de[_0xc527('0x2c')],qs[_0xc527('0x32')](_0x332780['query'][_0xc527('0x32')]));_0x88c87e[_0xc527('0x31')]=_0x88c87e[_0xc527('0x31')][_0xc527('0x33')]?_0x88c87e[_0xc527('0x31')]:_0x13c3de['model'];if(_0x332780[_0xc527('0x2d')]['includeAll']){_0x88c87e[_0xc527('0x3e')]=[{'all':!![]}];}_0x88c87e=_[_0xc527('0x42')]({},_0x88c87e,_0x332780[_0xc527('0x3c')]);return db[_0xc527('0x29')]['find'](_0x88c87e)['then'](handleEntityNotFound(_0xa3970e,null))[_0xc527('0x3d')](respondWithResult(_0xa3970e,null))[_0xc527('0x40')](handleError(_0xa3970e,null));};exports[_0xc527('0x43')]=function(_0xce4b0e,_0x50035c){return db[_0xc527('0x29')][_0xc527('0x43')](_0xce4b0e[_0xc527('0x44')],{})['then'](respondWithResult(_0x50035c,0xc9))['catch'](handleError(_0x50035c,null));};exports[_0xc527('0x23')]=function(_0x40516d,_0x26bbfb){if(_0x40516d[_0xc527('0x44')]['id']){delete _0x40516d[_0xc527('0x44')]['id'];}return db['Integration'][_0xc527('0x45')]({'where':{'id':_0x40516d[_0xc527('0x46')]['id']}})[_0xc527('0x3d')](handleEntityNotFound(_0x26bbfb,null))['then'](saveUpdates(_0x40516d[_0xc527('0x44')],null))[_0xc527('0x3d')](respondWithResult(_0x26bbfb,null))[_0xc527('0x40')](handleError(_0x26bbfb,null));};exports[_0xc527('0x47')]=function(_0x437f65,_0x2b8b59){return db[_0xc527('0x29')][_0xc527('0x45')]({'where':{'id':_0x437f65['params']['id']}})[_0xc527('0x3d')](handleEntityNotFound(_0x2b8b59,null))[_0xc527('0x3d')](removeEntity(_0x2b8b59,null))[_0xc527('0x40')](handleError(_0x2b8b59,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 0c7d234..1ae941f 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 _0x05b4=['../../config/environment','./integration.attributes','exports','define','Integration','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x05b4,0x1cd));var _0x405b=function(_0xaf7bae,_0x571f22){_0xaf7bae=_0xaf7bae-0x0;var _0x5e446d=_0x05b4[_0xaf7bae];return _0x5e446d;};'use strict';var _=require(_0x405b('0x0'));var util=require(_0x405b('0x1'));var logger=require(_0x405b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x405b('0x3'));var rp=require(_0x405b('0x4'));var fs=require('fs');var path=require(_0x405b('0x5'));var rimraf=require(_0x405b('0x6'));var config=require(_0x405b('0x7'));var attributes=require(_0x405b('0x8'));module[_0x405b('0x9')]=function(_0x3b5980,_0x286f6b){return _0x3b5980[_0x405b('0xa')](_0x405b('0xb'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fa7=['./integration.attributes','exports','define','Integration','lodash','util','api','bluebird','rimraf','../../config/environment'];(function(_0x485a0a,_0x52301a){var _0x530a70=function(_0x18bb27){while(--_0x18bb27){_0x485a0a['push'](_0x485a0a['shift']());}};_0x530a70(++_0x52301a);}(_0x7fa7,0x144));var _0x77fa=function(_0x2b4065,_0x4f9afe){_0x2b4065=_0x2b4065-0x0;var _0x2e7a4b=_0x7fa7[_0x2b4065];return _0x2e7a4b;};'use strict';var _=require(_0x77fa('0x0'));var util=require(_0x77fa('0x1'));var logger=require('../../config/logger')(_0x77fa('0x2'));var moment=require('moment');var BPromise=require(_0x77fa('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x77fa('0x4'));var config=require(_0x77fa('0x5'));var attributes=require(_0x77fa('0x6'));module[_0x77fa('0x7')]=function(_0x4590ec,_0x4e79ec){return _0x4590ec[_0x77fa('0x8')](_0x77fa('0x9'),attributes,{'tableName':'integrations','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 890540a..698c5b4 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 _0xc99e=['Integration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2c1265,_0x1f04d8){var _0x2b1084=function(_0x1ef9ce){while(--_0x1ef9ce){_0x2c1265['push'](_0x2c1265['shift']());}};_0x2b1084(++_0x1f04d8);}(_0xc99e,0x6e));var _0xec99=function(_0x43d3ed,_0xa17d4){_0x43d3ed=_0x43d3ed-0x0;var _0x2affeb=_0xc99e[_0x43d3ed];return _0x2affeb;};'use strict';var _=require(_0xec99('0x0'));var util=require(_0xec99('0x1'));var moment=require(_0xec99('0x2'));var BPromise=require(_0xec99('0x3'));var rs=require(_0xec99('0x4'));var fs=require('fs');var Redis=require(_0xec99('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xec99('0x6'));var logger=require(_0xec99('0x7'))(_0xec99('0x8'));var config=require(_0xec99('0x9'));var jayson=require(_0xec99('0xa'));var client=jayson[_0xec99('0xb')][_0xec99('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x470d70,_0x558b08,_0x797806){return new BPromise(function(_0x425a61,_0x546391){return client[_0xec99('0xd')](_0x470d70,_0x797806)[_0xec99('0xe')](function(_0x47ecf6){logger['info'](_0xec99('0xf'),_0x558b08,_0xec99('0x10'));logger[_0xec99('0x11')]('Integration,\x20%s,\x20%s,\x20%s',_0x558b08,_0xec99('0x10'),JSON[_0xec99('0x12')](_0x47ecf6));if(_0x47ecf6[_0xec99('0x13')]){if(_0x47ecf6[_0xec99('0x13')][_0xec99('0x14')]===0x1f4){logger[_0xec99('0x13')]('Integration,\x20%s,\x20%s',_0x558b08,_0x47ecf6[_0xec99('0x13')]['message']);return _0x546391(_0x47ecf6[_0xec99('0x13')]['message']);}logger[_0xec99('0x13')]('Integration,\x20%s,\x20%s',_0x558b08,_0x47ecf6['error'][_0xec99('0x15')]);return _0x425a61(_0x47ecf6['error'][_0xec99('0x15')]);}else{logger[_0xec99('0x16')](_0xec99('0xf'),_0x558b08,_0xec99('0x10'));_0x425a61(_0x47ecf6[_0xec99('0x17')][_0xec99('0x15')]);}})[_0xec99('0x18')](function(_0x4e03db){logger[_0xec99('0x13')](_0xec99('0xf'),_0x558b08,_0x4e03db);_0x546391(_0x4e03db);});});} \ No newline at end of file +var _0xb91a=['jayson/promise','client','http','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1e4a8e,_0x18022b){var _0x5408f9=function(_0x4ef2ed){while(--_0x4ef2ed){_0x1e4a8e['push'](_0x1e4a8e['shift']());}};_0x5408f9(++_0x18022b);}(_0xb91a,0xf4));var _0xab91=function(_0x5afb3a,_0x2b84dc){_0x5afb3a=_0x5afb3a-0x0;var _0x355a97=_0xb91a[_0x5afb3a];return _0x355a97;};'use strict';var _=require(_0xab91('0x0'));var util=require(_0xab91('0x1'));var moment=require(_0xab91('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab91('0x3'));var db=require(_0xab91('0x4'))['db'];var utils=require(_0xab91('0x5'));var logger=require(_0xab91('0x6'))(_0xab91('0x7'));var config=require(_0xab91('0x8'));var jayson=require(_0xab91('0x9'));var client=jayson[_0xab91('0xa')][_0xab91('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34932f,_0x5dd52d,_0x1729f6){return new BPromise(function(_0x1e8d52,_0x4bc8cd){return client['request'](_0x34932f,_0x1729f6)['then'](function(_0x19e61d){logger[_0xab91('0xc')](_0xab91('0xd'),_0x5dd52d,_0xab91('0xe'));logger[_0xab91('0xf')](_0xab91('0x10'),_0x5dd52d,_0xab91('0xe'),JSON[_0xab91('0x11')](_0x19e61d));if(_0x19e61d[_0xab91('0x12')]){if(_0x19e61d[_0xab91('0x12')][_0xab91('0x13')]===0x1f4){logger[_0xab91('0x12')](_0xab91('0xd'),_0x5dd52d,_0x19e61d['error']['message']);return _0x4bc8cd(_0x19e61d[_0xab91('0x12')][_0xab91('0x14')]);}logger[_0xab91('0x12')](_0xab91('0xd'),_0x5dd52d,_0x19e61d[_0xab91('0x12')][_0xab91('0x14')]);return _0x1e8d52(_0x19e61d['error']['message']);}else{logger[_0xab91('0xc')](_0xab91('0xd'),_0x5dd52d,_0xab91('0xe'));_0x1e8d52(_0x19e61d[_0xab91('0x15')][_0xab91('0x14')]);}})[_0xab91('0x16')](function(_0x27b7d1){logger[_0xab91('0x12')]('Integration,\x20%s,\x20%s',_0x5dd52d,_0x27b7d1);_0x4bc8cd(_0x27b7d1);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index f499d79..5a857b8 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 _0xdeff=['util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','destroy','exports','multer'];(function(_0x20ea37,_0x108e2b){var _0xf8200f=function(_0xd8ebff){while(--_0xd8ebff){_0x20ea37['push'](_0x20ea37['shift']());}};_0xf8200f(++_0x108e2b);}(_0xdeff,0xef));var _0xfdef=function(_0x12254f,_0x100cfe){_0x12254f=_0x12254f-0x0;var _0x3a4fa2=_0xdeff[_0x12254f];return _0x3a4fa2;};'use strict';var multer=require(_0xfdef('0x0'));var util=require(_0xfdef('0x1'));var path=require(_0xfdef('0x2'));var timeout=require(_0xfdef('0x3'));var express=require('express');var router=express[_0xfdef('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xfdef('0x5'));var config=require(_0xfdef('0x6'));var controller=require(_0xfdef('0x7'));router[_0xfdef('0x8')]('/',auth[_0xfdef('0x9')](),controller[_0xfdef('0xa')]);router[_0xfdef('0x8')](_0xfdef('0xb'),auth[_0xfdef('0x9')](),controller[_0xfdef('0xc')]);router[_0xfdef('0x8')](_0xfdef('0xd'),auth['isAuthenticated'](),controller[_0xfdef('0xe')]);router['post']('/',auth[_0xfdef('0x9')](),controller['create']);router[_0xfdef('0xf')](_0xfdef('0xd'),auth['isAuthenticated'](),controller[_0xfdef('0x10')]);router[_0xfdef('0x11')](_0xfdef('0xd'),auth[_0xfdef('0x9')](),controller[_0xfdef('0x12')]);module[_0xfdef('0x13')]=router; \ No newline at end of file +var _0xf6d5=['util','Router','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','show','update','delete','destroy','exports','multer'];(function(_0x1269c1,_0x1e6089){var _0x1a1f37=function(_0x2d1608){while(--_0x2d1608){_0x1269c1['push'](_0x1269c1['shift']());}};_0x1a1f37(++_0x1e6089);}(_0xf6d5,0x15d));var _0x5f6d=function(_0x483017,_0x73092c){_0x483017=_0x483017-0x0;var _0x3cc794=_0xf6d5[_0x483017];return _0x3cc794;};'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 auth=require('../../components/auth/service');var interaction=require(_0x5f6d('0x3'));var config=require(_0x5f6d('0x4'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0x5f6d('0x5')](),controller['index']);router[_0x5f6d('0x6')](_0x5f6d('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0x5f6d('0x6')](_0x5f6d('0x8'),auth[_0x5f6d('0x5')](),controller[_0x5f6d('0x9')]);router['post']('/',auth[_0x5f6d('0x5')](),controller['create']);router['put'](_0x5f6d('0x8'),auth[_0x5f6d('0x5')](),controller[_0x5f6d('0xa')]);router[_0x5f6d('0xb')](_0x5f6d('0x8'),auth[_0x5f6d('0x5')](),controller[_0x5f6d('0xc')]);module[_0x5f6d('0xd')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 071452b..298552a 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 _0x645c=['exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','FAILED','sequelize'];(function(_0x4779ae,_0x1a74ac){var _0x25627f=function(_0x3882b8){while(--_0x3882b8){_0x4779ae['push'](_0x4779ae['shift']());}};_0x25627f(++_0x1a74ac);}(_0x645c,0xef));var _0xc645=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x645c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc645('0x0'));module[_0xc645('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xc645('0x2')]},'integrationId':{'type':Sequelize[_0xc645('0x3')]},'contacts':{'type':Sequelize[_0xc645('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc645('0x2')]},'calleridname':{'type':Sequelize[_0xc645('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xc645('0x2')]},'membername':{'type':Sequelize[_0xc645('0x2')]},'agentcalledAt':{'type':Sequelize[_0xc645('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xc645('0x3')]},'agentcomplete':{'type':Sequelize[_0xc645('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xc645('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xc645('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc645('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xc645('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xc645('0x4')]},'lastevent':{'type':Sequelize[_0xc645('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xc645('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xc645('0x2')]},'language':{'type':Sequelize[_0xc645('0x2')]},'accountcode':{'type':Sequelize[_0xc645('0x2')]},'context':{'type':Sequelize[_0xc645('0x2')]},'exten':{'type':Sequelize[_0xc645('0x2')]},'priority':{'type':Sequelize[_0xc645('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc645('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xc645('0x2')]},'destcalleridnum':{'type':Sequelize[_0xc645('0x2')]},'destcalleridname':{'type':Sequelize[_0xc645('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xc645('0x2')]},'destaccountcode':{'type':Sequelize[_0xc645('0x2')]},'destcontext':{'type':Sequelize[_0xc645('0x2')]},'destexten':{'type':Sequelize[_0xc645('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xc645('0x2')]},'messageId':{'type':Sequelize[_0xc645('0x2')]},'inReplyTo':{'type':Sequelize[_0xc645('0x2')]},'subject':{'type':Sequelize[_0xc645('0x2')]},'from':{'type':Sequelize[_0xc645('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xc645('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xc645('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0xc645('0x7')](_0xc645('0x8'),'SENDING','RECEIVED',_0xc645('0x9'))},'url':{'type':Sequelize[_0xc645('0x2')]},'app':{'type':Sequelize[_0xc645('0x2')]},'appdata':{'type':Sequelize[_0xc645('0x2')]},'projectId':{'type':Sequelize[_0xc645('0x3')]}}; \ No newline at end of file +var _0x6929=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','exports','STRING'];(function(_0xe9c1ee,_0x2ee931){var _0x38521e=function(_0x4ed3f5){while(--_0x4ed3f5){_0xe9c1ee['push'](_0xe9c1ee['shift']());}};_0x38521e(++_0x2ee931);}(_0x6929,0x13d));var _0x9692=function(_0x396795,_0x4b7db4){_0x396795=_0x396795-0x0;var _0x1067bf=_0x6929[_0x396795];return _0x1067bf;};'use strict';var Sequelize=require('sequelize');module[_0x9692('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x9692('0x1')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x9692('0x1')]},'integrationId':{'type':Sequelize[_0x9692('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9692('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9692('0x1')]},'queue':{'type':Sequelize[_0x9692('0x1')]},'interface':{'type':Sequelize[_0x9692('0x1')]},'membername':{'type':Sequelize[_0x9692('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x9692('0x3')]},'holdtime':{'type':Sequelize[_0x9692('0x2')]},'agentcomplete':{'type':Sequelize[_0x9692('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x9692('0x2')]},'agentacw':{'type':Sequelize[_0x9692('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x9692('0x2')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x9692('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x9692('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x9692('0x3')]},'lastevent':{'type':Sequelize[_0x9692('0x1')]},'channel':{'type':Sequelize[_0x9692('0x1')]},'channelstate':{'type':Sequelize[_0x9692('0x2')]},'channelstatedesc':{'type':Sequelize[_0x9692('0x1')]},'connectedlinenum':{'type':Sequelize[_0x9692('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x9692('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x9692('0x1')]},'exten':{'type':Sequelize[_0x9692('0x1')]},'priority':{'type':Sequelize[_0x9692('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x9692('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x9692('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x9692('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x9692('0x1')]},'destlanguage':{'type':Sequelize[_0x9692('0x1')]},'destaccountcode':{'type':Sequelize[_0x9692('0x1')]},'destcontext':{'type':Sequelize[_0x9692('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x9692('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x9692('0x1')]},'from':{'type':Sequelize[_0x9692('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x9692('0x1')]},'attachment':{'type':Sequelize[_0x9692('0x5')]},'html':{'type':Sequelize[_0x9692('0x5')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x9692('0x6')](_0x9692('0x7'),_0x9692('0x8'),_0x9692('0x9'),_0x9692('0xa'))},'url':{'type':Sequelize[_0x9692('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x9692('0x1')]},'projectId':{'type':Sequelize[_0x9692('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 8911e50..1455f41 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 _0x837c=['error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','IntegrationReport','includeAll','findAll','rows','show','params','body','catch','update','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','limit','reject','then','destroy'];(function(_0x15efae,_0x428a5d){var _0x3c1d6b=function(_0x3fd392){while(--_0x3fd392){_0x15efae['push'](_0x15efae['shift']());}};_0x3c1d6b(++_0x428a5d);}(_0x837c,0xb0));var _0xc837=function(_0x121a73,_0x59de7e){_0x121a73=_0x121a73-0x0;var _0x28f494=_0x837c[_0x121a73];return _0x28f494;};'use strict';var pdf=require(_0xc837('0x0'));var emlformat=require(_0xc837('0x1'));var rimraf=require(_0xc837('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc837('0x3'));var rp=require(_0xc837('0x4'));var moment=require(_0xc837('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc837('0x6'));var util=require(_0xc837('0x7'));var path=require(_0xc837('0x8'));var sox=require(_0xc837('0x9'));var csv=require(_0xc837('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc837('0xb'));var squel=require(_0xc837('0xc'));var crypto=require(_0xc837('0xd'));var jsforce=require(_0xc837('0xe'));var deskjs=require(_0xc837('0xf'));var toCsv=require(_0xc837('0xa'));var querystring=require(_0xc837('0x10'));var Papa=require(_0xc837('0x11'));var Redis=require(_0xc837('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc837('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc837('0x14'));var logger=require('../../config/logger')(_0xc837('0x15'));var utils=require(_0xc837('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc837('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c9d2c,_0x5a6d2d){_0x5a6d2d=_0x5a6d2d||0xcc;return function(_0x219e2f){if(_0x219e2f){return _0x1c9d2c[_0xc837('0x18')](_0x5a6d2d);}return _0x1c9d2c[_0xc837('0x19')](_0x5a6d2d)[_0xc837('0x1a')]();};}function respondWithResult(_0x6bef77,_0xa21246){_0xa21246=_0xa21246||0xc8;return function(_0x2ef9fd){if(_0x2ef9fd){return _0x6bef77[_0xc837('0x19')](_0xa21246)[_0xc837('0x1b')](_0x2ef9fd);}};}function respondWithFilteredResult(_0x26aea9,_0x5e2bd1){return function(_0x58e47b){if(_0x58e47b){var _0x18d739=_0x58e47b[_0xc837('0x1c')],_0x5682ac=_0x5e2bd1[_0xc837('0x1d')],_0x238bd6=_0x5e2bd1[_0xc837('0x1d')]+_0x5e2bd1[_0xc837('0x1e')],_0x3513ee;if(_0x238bd6>=_0x18d739){_0x238bd6=_0x18d739;_0x3513ee=0xc8;}else{_0x3513ee=0xce;}_0x26aea9[_0xc837('0x19')](_0x3513ee);return _0x26aea9['set']('Content-Range',_0x5682ac+'-'+_0x238bd6+'/'+_0x18d739)[_0xc837('0x1b')](_0x58e47b);}return null;};}function patchUpdates(_0x2f63f1){return function(_0x5e59fd){try{jsonpatch['apply'](_0x5e59fd,_0x2f63f1,!![]);}catch(_0x5cee93){return BPromise[_0xc837('0x1f')](_0x5cee93);}return _0x5e59fd['save']();};}function saveUpdates(_0x3bcf2c,_0x23f1ae){return function(_0x39c4ac){if(_0x39c4ac){return _0x39c4ac['update'](_0x3bcf2c)[_0xc837('0x20')](function(_0x4e22b9){return _0x4e22b9;});}return null;};}function removeEntity(_0x5e7fcf,_0x3f479f){return function(_0x159a54){if(_0x159a54){return _0x159a54[_0xc837('0x21')]()[_0xc837('0x20')](function(){_0x5e7fcf[_0xc837('0x19')](0xcc)[_0xc837('0x1a')]();});}};}function handleEntityNotFound(_0x2df026,_0x7ae7c3){return function(_0x288acd){if(!_0x288acd){_0x2df026['sendStatus'](0x194);}return _0x288acd;};}function handleError(_0x65d56,_0x3c9c98){_0x3c9c98=_0x3c9c98||0x1f4;return function(_0x13916d){logger[_0xc837('0x22')](_0x13916d[_0xc837('0x23')]);if(_0x13916d[_0xc837('0x24')]){delete _0x13916d[_0xc837('0x24')];}_0x65d56[_0xc837('0x19')](_0x3c9c98)[_0xc837('0x25')](_0x13916d);};}exports['index']=function(_0x3cae14,_0x3675b2){var _0x3c2468={},_0x9dcba1={},_0x1b4481={'count':0x0,'rows':[]};var _0x5aa81e=_[_0xc837('0x26')](db['IntegrationReport'][_0xc837('0x27')],function(_0xb68385){return{'name':_0xb68385[_0xc837('0x28')],'type':_0xb68385[_0xc837('0x29')][_0xc837('0x2a')]};});_0x9dcba1[_0xc837('0x2b')]=_[_0xc837('0x26')](_0x5aa81e,_0xc837('0x24'));_0x9dcba1[_0xc837('0x2c')]=_[_0xc837('0x2d')](_0x3cae14[_0xc837('0x2c')]);_0x9dcba1[_0xc837('0x2e')]=_[_0xc837('0x2f')](_0x9dcba1[_0xc837('0x2b')],_0x9dcba1[_0xc837('0x2c')]);_0x3c2468[_0xc837('0x30')]=_[_0xc837('0x2f')](_0x9dcba1['model'],qs[_0xc837('0x31')](_0x3cae14['query'][_0xc837('0x31')]));_0x3c2468[_0xc837('0x30')]=_0x3c2468[_0xc837('0x30')][_0xc837('0x32')]?_0x3c2468[_0xc837('0x30')]:_0x9dcba1[_0xc837('0x2b')];if(!_0x3cae14[_0xc837('0x2c')][_0xc837('0x33')]('nolimit')){_0x3c2468[_0xc837('0x1e')]=qs['limit'](_0x3cae14[_0xc837('0x2c')][_0xc837('0x1e')]);_0x3c2468[_0xc837('0x1d')]=qs[_0xc837('0x1d')](_0x3cae14[_0xc837('0x2c')][_0xc837('0x1d')]);}_0x3c2468['order']=qs[_0xc837('0x34')](_0x3cae14['query']['sort']);_0x3c2468[_0xc837('0x35')]=qs[_0xc837('0x2e')](_[_0xc837('0x36')](_0x3cae14[_0xc837('0x2c')],_0x9dcba1[_0xc837('0x2e')]),_0x5aa81e);if(_0x3cae14[_0xc837('0x2c')][_0xc837('0x37')]){_0x3c2468[_0xc837('0x35')]=_[_0xc837('0x38')](_0x3c2468[_0xc837('0x35')],{'$or':_[_0xc837('0x26')](_0x5aa81e,function(_0x2509e3){if(_0x2509e3[_0xc837('0x29')]!==_0xc837('0x39')){var _0x4440b7={};_0x4440b7[_0x2509e3[_0xc837('0x24')]]={'$like':'%'+_0x3cae14[_0xc837('0x2c')]['filter']+'%'};return _0x4440b7;}})});}_0x3c2468=_['merge']({},_0x3c2468,_0x3cae14[_0xc837('0x3a')]);var _0x511f8b={'where':_0x3c2468[_0xc837('0x35')]};return db[_0xc837('0x3b')][_0xc837('0x1c')](_0x511f8b)[_0xc837('0x20')](function(_0x2d0ac4){_0x1b4481[_0xc837('0x1c')]=_0x2d0ac4;if(_0x3cae14['query'][_0xc837('0x3c')]){_0x3c2468['include']=[{'all':!![]}];}return db['IntegrationReport'][_0xc837('0x3d')](_0x3c2468);})['then'](function(_0x10b7dc){_0x1b4481[_0xc837('0x3e')]=_0x10b7dc;return _0x1b4481;})['then'](respondWithFilteredResult(_0x3675b2,_0x3c2468))['catch'](handleError(_0x3675b2,null));};exports[_0xc837('0x3f')]=function(_0x18759e,_0x34018d){var _0x2635e4={'raw':![],'where':{'id':_0x18759e[_0xc837('0x40')]['id']}},_0xcd7434={};_0xcd7434[_0xc837('0x2b')]=_[_0xc837('0x2d')](db[_0xc837('0x3b')][_0xc837('0x27')]);_0xcd7434[_0xc837('0x2c')]=_[_0xc837('0x2d')](_0x18759e[_0xc837('0x2c')]);_0xcd7434[_0xc837('0x2e')]=_['intersection'](_0xcd7434[_0xc837('0x2b')],_0xcd7434['query']);_0x2635e4[_0xc837('0x30')]=_[_0xc837('0x2f')](_0xcd7434[_0xc837('0x2b')],qs['fields'](_0x18759e[_0xc837('0x2c')]['fields']));_0x2635e4[_0xc837('0x30')]=_0x2635e4['attributes'][_0xc837('0x32')]?_0x2635e4['attributes']:_0xcd7434[_0xc837('0x2b')];if(_0x18759e[_0xc837('0x2c')][_0xc837('0x3c')]){_0x2635e4['include']=[{'all':!![]}];}_0x2635e4=_['merge']({},_0x2635e4,_0x18759e[_0xc837('0x3a')]);return db[_0xc837('0x3b')]['find'](_0x2635e4)[_0xc837('0x20')](handleEntityNotFound(_0x34018d,null))[_0xc837('0x20')](respondWithResult(_0x34018d,null))['catch'](handleError(_0x34018d,null));};exports['create']=function(_0x332583,_0x2ca9d2){return db['IntegrationReport']['create'](_0x332583[_0xc837('0x41')],{})[_0xc837('0x20')](respondWithResult(_0x2ca9d2,0xc9))[_0xc837('0x42')](handleError(_0x2ca9d2,null));};exports[_0xc837('0x43')]=function(_0x5b1499,_0x1749bf){if(_0x5b1499[_0xc837('0x41')]['id']){delete _0x5b1499[_0xc837('0x41')]['id'];}return db[_0xc837('0x3b')][_0xc837('0x44')]({'where':{'id':_0x5b1499[_0xc837('0x40')]['id']}})[_0xc837('0x20')](handleEntityNotFound(_0x1749bf,null))[_0xc837('0x20')](saveUpdates(_0x5b1499['body'],null))['then'](respondWithResult(_0x1749bf,null))[_0xc837('0x42')](handleError(_0x1749bf,null));};exports[_0xc837('0x21')]=function(_0x54c33f,_0x492061){return db[_0xc837('0x3b')][_0xc837('0x44')]({'where':{'id':_0x54c33f[_0xc837('0x40')]['id']}})[_0xc837('0x20')](handleEntityNotFound(_0x492061,null))[_0xc837('0x20')](removeEntity(_0x492061,null))[_0xc837('0x42')](handleError(_0x492061,null));};exports[_0xc837('0x45')]=function(_0x1c3982,_0x5bbb68){return db[_0xc837('0x3b')][_0xc837('0x45')]()[_0xc837('0x20')](respondWithResult(_0x5bbb68,null))[_0xc837('0x42')](handleError(_0x5bbb68,null));}; \ No newline at end of file +var _0x5046=['where','VIRTUAL','filter','merge','options','include','rows','catch','params','rawAttributes','includeAll','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','IntegrationReport','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick'];(function(_0x45cc18,_0xe3dfb2){var _0x4f028a=function(_0x5830e7){while(--_0x5830e7){_0x45cc18['push'](_0x45cc18['shift']());}};_0x4f028a(++_0xe3dfb2);}(_0x5046,0xf9));var _0x6504=function(_0x51ed92,_0x1640f9){_0x51ed92=_0x51ed92-0x0;var _0x1ee9ca=_0x5046[_0x51ed92];return _0x1ee9ca;};'use strict';var pdf=require(_0x6504('0x0'));var emlformat=require(_0x6504('0x1'));var rimraf=require(_0x6504('0x2'));var zipdir=require(_0x6504('0x3'));var jsonpatch=require(_0x6504('0x4'));var rp=require(_0x6504('0x5'));var moment=require('moment');var BPromise=require(_0x6504('0x6'));var Mustache=require(_0x6504('0x7'));var util=require(_0x6504('0x8'));var path=require(_0x6504('0x9'));var sox=require(_0x6504('0xa'));var csv=require('to-csv');var ejs=require(_0x6504('0xb'));var fs=require('fs');var _=require(_0x6504('0xc'));var squel=require('squel');var crypto=require(_0x6504('0xd'));var jsforce=require(_0x6504('0xe'));var deskjs=require(_0x6504('0xf'));var toCsv=require(_0x6504('0x10'));var querystring=require(_0x6504('0x11'));var Papa=require(_0x6504('0x12'));var Redis=require(_0x6504('0x13'));var authService=require(_0x6504('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x6504('0x15'));var hardwareService=require(_0x6504('0x16'));var logger=require(_0x6504('0x17'))(_0x6504('0x18'));var utils=require(_0x6504('0x19'));var config=require(_0x6504('0x1a'));var licenseUtil=require(_0x6504('0x1b'));var db=require(_0x6504('0x1c'))['db'];function respondWithStatusCode(_0x311776,_0x461f85){_0x461f85=_0x461f85||0xcc;return function(_0x4e4e7f){if(_0x4e4e7f){return _0x311776[_0x6504('0x1d')](_0x461f85);}return _0x311776['status'](_0x461f85)[_0x6504('0x1e')]();};}function respondWithResult(_0x524aab,_0x803592){_0x803592=_0x803592||0xc8;return function(_0x18e213){if(_0x18e213){return _0x524aab[_0x6504('0x1f')](_0x803592)['json'](_0x18e213);}};}function respondWithFilteredResult(_0x2e2f77,_0x290837){return function(_0xc8c7d4){if(_0xc8c7d4){var _0x454af0=_0xc8c7d4[_0x6504('0x20')],_0x2732e7=_0x290837['offset'],_0x5e0e63=_0x290837[_0x6504('0x21')]+_0x290837[_0x6504('0x22')],_0x299118;if(_0x5e0e63>=_0x454af0){_0x5e0e63=_0x454af0;_0x299118=0xc8;}else{_0x299118=0xce;}_0x2e2f77['status'](_0x299118);return _0x2e2f77[_0x6504('0x23')](_0x6504('0x24'),_0x2732e7+'-'+_0x5e0e63+'/'+_0x454af0)[_0x6504('0x25')](_0xc8c7d4);}return null;};}function patchUpdates(_0x5661cc){return function(_0x5e0a39){try{jsonpatch[_0x6504('0x26')](_0x5e0a39,_0x5661cc,!![]);}catch(_0x5355ab){return BPromise[_0x6504('0x27')](_0x5355ab);}return _0x5e0a39[_0x6504('0x28')]();};}function saveUpdates(_0x5cc522,_0x433193){return function(_0x4de348){if(_0x4de348){return _0x4de348[_0x6504('0x29')](_0x5cc522)[_0x6504('0x2a')](function(_0x5e79af){return _0x5e79af;});}return null;};}function removeEntity(_0xd2930c,_0x5b7a9f){return function(_0x4dd200){if(_0x4dd200){return _0x4dd200[_0x6504('0x2b')]()[_0x6504('0x2a')](function(){_0xd2930c[_0x6504('0x1f')](0xcc)[_0x6504('0x1e')]();});}};}function handleEntityNotFound(_0x5e7f15,_0x3b7580){return function(_0x169d1f){if(!_0x169d1f){_0x5e7f15[_0x6504('0x1d')](0x194);}return _0x169d1f;};}function handleError(_0x2b12dc,_0x554fc0){_0x554fc0=_0x554fc0||0x1f4;return function(_0x1fade4){logger[_0x6504('0x2c')](_0x1fade4[_0x6504('0x2d')]);if(_0x1fade4[_0x6504('0x2e')]){delete _0x1fade4[_0x6504('0x2e')];}_0x2b12dc['status'](_0x554fc0)['send'](_0x1fade4);};}exports[_0x6504('0x2f')]=function(_0x37db83,_0x1e1694){var _0x3a7389={},_0x5ac449={},_0x5602a5={'count':0x0,'rows':[]};var _0x45f7dc=_[_0x6504('0x30')](db[_0x6504('0x31')]['rawAttributes'],function(_0x5e096f){return{'name':_0x5e096f['fieldName'],'type':_0x5e096f[_0x6504('0x32')]['key']};});_0x5ac449[_0x6504('0x33')]=_[_0x6504('0x30')](_0x45f7dc,_0x6504('0x2e'));_0x5ac449[_0x6504('0x34')]=_[_0x6504('0x35')](_0x37db83['query']);_0x5ac449['filters']=_[_0x6504('0x36')](_0x5ac449[_0x6504('0x33')],_0x5ac449[_0x6504('0x34')]);_0x3a7389['attributes']=_[_0x6504('0x36')](_0x5ac449[_0x6504('0x33')],qs['fields'](_0x37db83[_0x6504('0x34')][_0x6504('0x37')]));_0x3a7389[_0x6504('0x38')]=_0x3a7389[_0x6504('0x38')][_0x6504('0x39')]?_0x3a7389[_0x6504('0x38')]:_0x5ac449[_0x6504('0x33')];if(!_0x37db83[_0x6504('0x34')][_0x6504('0x3a')](_0x6504('0x3b'))){_0x3a7389['limit']=qs['limit'](_0x37db83[_0x6504('0x34')][_0x6504('0x22')]);_0x3a7389[_0x6504('0x21')]=qs['offset'](_0x37db83[_0x6504('0x34')][_0x6504('0x21')]);}_0x3a7389['order']=qs[_0x6504('0x3c')](_0x37db83[_0x6504('0x34')]['sort']);_0x3a7389['where']=qs[_0x6504('0x3d')](_[_0x6504('0x3e')](_0x37db83[_0x6504('0x34')],_0x5ac449[_0x6504('0x3d')]),_0x45f7dc);if(_0x37db83[_0x6504('0x34')]['filter']){_0x3a7389[_0x6504('0x3f')]=_['merge'](_0x3a7389['where'],{'$or':_['map'](_0x45f7dc,function(_0x4c14cb){if(_0x4c14cb[_0x6504('0x32')]!==_0x6504('0x40')){var _0x2230d6={};_0x2230d6[_0x4c14cb['name']]={'$like':'%'+_0x37db83[_0x6504('0x34')][_0x6504('0x41')]+'%'};return _0x2230d6;}})});}_0x3a7389=_[_0x6504('0x42')]({},_0x3a7389,_0x37db83[_0x6504('0x43')]);var _0x49ef35={'where':_0x3a7389[_0x6504('0x3f')]};return db[_0x6504('0x31')][_0x6504('0x20')](_0x49ef35)[_0x6504('0x2a')](function(_0x9885cd){_0x5602a5[_0x6504('0x20')]=_0x9885cd;if(_0x37db83[_0x6504('0x34')]['includeAll']){_0x3a7389[_0x6504('0x44')]=[{'all':!![]}];}return db[_0x6504('0x31')]['findAll'](_0x3a7389);})['then'](function(_0x49e485){_0x5602a5[_0x6504('0x45')]=_0x49e485;return _0x5602a5;})['then'](respondWithFilteredResult(_0x1e1694,_0x3a7389))[_0x6504('0x46')](handleError(_0x1e1694,null));};exports['show']=function(_0x1d6570,_0x5e975d){var _0x58026a={'raw':![],'where':{'id':_0x1d6570[_0x6504('0x47')]['id']}},_0x2bd13e={};_0x2bd13e['model']=_[_0x6504('0x35')](db['IntegrationReport'][_0x6504('0x48')]);_0x2bd13e[_0x6504('0x34')]=_[_0x6504('0x35')](_0x1d6570[_0x6504('0x34')]);_0x2bd13e[_0x6504('0x3d')]=_['intersection'](_0x2bd13e[_0x6504('0x33')],_0x2bd13e[_0x6504('0x34')]);_0x58026a[_0x6504('0x38')]=_['intersection'](_0x2bd13e[_0x6504('0x33')],qs[_0x6504('0x37')](_0x1d6570['query']['fields']));_0x58026a['attributes']=_0x58026a['attributes'][_0x6504('0x39')]?_0x58026a['attributes']:_0x2bd13e[_0x6504('0x33')];if(_0x1d6570['query'][_0x6504('0x49')]){_0x58026a[_0x6504('0x44')]=[{'all':!![]}];}_0x58026a=_[_0x6504('0x42')]({},_0x58026a,_0x1d6570[_0x6504('0x43')]);return db[_0x6504('0x31')]['find'](_0x58026a)[_0x6504('0x2a')](handleEntityNotFound(_0x5e975d,null))[_0x6504('0x2a')](respondWithResult(_0x5e975d,null))[_0x6504('0x46')](handleError(_0x5e975d,null));};exports['create']=function(_0x2afd11,_0x4d799f){return db[_0x6504('0x31')][_0x6504('0x4a')](_0x2afd11['body'],{})[_0x6504('0x2a')](respondWithResult(_0x4d799f,0xc9))['catch'](handleError(_0x4d799f,null));};exports['update']=function(_0x1cce1a,_0x5caa92){if(_0x1cce1a[_0x6504('0x4b')]['id']){delete _0x1cce1a[_0x6504('0x4b')]['id'];}return db[_0x6504('0x31')][_0x6504('0x4c')]({'where':{'id':_0x1cce1a['params']['id']}})['then'](handleEntityNotFound(_0x5caa92,null))[_0x6504('0x2a')](saveUpdates(_0x1cce1a[_0x6504('0x4b')],null))[_0x6504('0x2a')](respondWithResult(_0x5caa92,null))[_0x6504('0x46')](handleError(_0x5caa92,null));};exports[_0x6504('0x2b')]=function(_0x37ffa1,_0x3eeb97){return db[_0x6504('0x31')][_0x6504('0x4c')]({'where':{'id':_0x37ffa1[_0x6504('0x47')]['id']}})[_0x6504('0x2a')](handleEntityNotFound(_0x3eeb97,null))[_0x6504('0x2a')](removeEntity(_0x3eeb97,null))['catch'](handleError(_0x3eeb97,null));};exports[_0x6504('0x4d')]=function(_0x551616,_0x53fbeb){return db[_0x6504('0x31')][_0x6504('0x4d')]()[_0x6504('0x2a')](respondWithResult(_0x53fbeb,null))[_0x6504('0x46')](handleError(_0x53fbeb,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 7ddc349..2279af2 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 _0xaec4=['api','moment','request-promise','path','rimraf','./integrationReport.attributes','exports','define','../../config/logger'];(function(_0x5bb08f,_0x49de63){var _0x3ddfef=function(_0x339791){while(--_0x339791){_0x5bb08f['push'](_0x5bb08f['shift']());}};_0x3ddfef(++_0x49de63);}(_0xaec4,0x194));var _0x4aec=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xaec4[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4aec('0x0'))(_0x4aec('0x1'));var moment=require(_0x4aec('0x2'));var BPromise=require('bluebird');var rp=require(_0x4aec('0x3'));var fs=require('fs');var path=require(_0x4aec('0x4'));var rimraf=require(_0x4aec('0x5'));var config=require('../../config/environment');var attributes=require(_0x4aec('0x6'));module[_0x4aec('0x7')]=function(_0x624b91,_0x55eb7b){return _0x624b91[_0x4aec('0x8')]('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb625=['path','rimraf','../../config/environment','exports','define','IntegrationReport','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4ea0cc,_0x2b4043){var _0x18afb=function(_0x3f13fb){while(--_0x3f13fb){_0x4ea0cc['push'](_0x4ea0cc['shift']());}};_0x18afb(++_0x2b4043);}(_0xb625,0x7e));var _0x5b62=function(_0x132844,_0x98bc49){_0x132844=_0x132844-0x0;var _0x13c26f=_0xb625[_0x132844];return _0x13c26f;};'use strict';var _=require(_0x5b62('0x0'));var util=require(_0x5b62('0x1'));var logger=require(_0x5b62('0x2'))(_0x5b62('0x3'));var moment=require(_0x5b62('0x4'));var BPromise=require(_0x5b62('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b62('0x6'));var rimraf=require(_0x5b62('0x7'));var config=require(_0x5b62('0x8'));var attributes=require('./integrationReport.attributes');module[_0x5b62('0x9')]=function(_0x34dcbf,_0x4b6992){return _0x34dcbf[_0x5b62('0xa')](_0x5b62('0xb'),attributes,{'tableName':'report_integration','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 6432c31..d0eb5f3 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 _0x0b0e=['IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','debug'];(function(_0x2459fd,_0x575d9b){var _0x364cd2=function(_0x4b22f6){while(--_0x4b22f6){_0x2459fd['push'](_0x2459fd['shift']());}};_0x364cd2(++_0x575d9b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x0b0e[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x219b1c,_0x5cf9cc,_0x50be7f){return new BPromise(function(_0x11effc,_0x435060){return client[_0xe0b0('0xc')](_0x219b1c,_0x50be7f)[_0xe0b0('0xd')](function(_0x4c24f9){logger[_0xe0b0('0xe')](_0xe0b0('0xf'),_0x5cf9cc,'request\x20sent');logger[_0xe0b0('0x10')](_0xe0b0('0x11'),_0x5cf9cc,'request\x20sent',JSON[_0xe0b0('0x12')](_0x4c24f9));if(_0x4c24f9[_0xe0b0('0x13')]){if(_0x4c24f9[_0xe0b0('0x13')]['code']===0x1f4){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x435060(_0x4c24f9[_0xe0b0('0x13')]['message']);}logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4c24f9[_0xe0b0('0x13')][_0xe0b0('0x14')]);return _0x11effc(_0x4c24f9[_0xe0b0('0x13')]['message']);}else{logger[_0xe0b0('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5cf9cc,_0xe0b0('0x15'));_0x11effc(_0x4c24f9[_0xe0b0('0x16')]['message']);}})[_0xe0b0('0x17')](function(_0x4a4cc0){logger[_0xe0b0('0x13')](_0xe0b0('0xf'),_0x5cf9cc,_0x4a4cc0);_0x435060(_0x4a4cc0);});});} \ No newline at end of file +var _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','util','moment'];(function(_0x2abf7f,_0x23b05a){var _0x248bce=function(_0x4c836d){while(--_0x4c836d){_0x2abf7f['push'](_0x2abf7f['shift']());}};_0x248bce(++_0x23b05a);}(_0xda2d,0x102));var _0xdda2=function(_0x314785,_0x304874){_0x314785=_0x314785-0x0;var _0x4fbf52=_0xda2d[_0x314785];return _0x4fbf52;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('IntegrationReport,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index e43b0be..d060167 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 _0x34e8=['./interval.controller','get','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','/:id','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x213e70,_0x5df20b){var _0x567335=function(_0x2504f6){while(--_0x2504f6){_0x213e70['push'](_0x213e70['shift']());}};_0x567335(++_0x5df20b);}(_0x34e8,0x12c));var _0x834e=function(_0x1026ec,_0x339055){_0x1026ec=_0x1026ec-0x0;var _0x1c1f71=_0x34e8[_0x1026ec];return _0x1c1f71;};'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 auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/:id',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0x9')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0xe')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0x10')]);router[_0x834e('0xe')](_0x834e('0x11'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);router['put'](_0x834e('0x13'),auth[_0x834e('0xa')](),controller['update']);router[_0x834e('0x14')](_0x834e('0x13'),auth[_0x834e('0xa')](),controller[_0x834e('0x15')]);module['exports']=router; \ No newline at end of file +var _0x55ca=['/:id/sub_intervals','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','getIntervals','create','post'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x55ca,0x126));var _0xa55c=function(_0x35faeb,_0x55b23c){_0x35faeb=_0x35faeb-0x0;var _0x136aa8=_0x55ca[_0x35faeb];return _0x136aa8;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/:id/sub_intervals',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0xd')](_0xa55c('0x10'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x14')]);module[_0xa55c('0x15')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index bdf6cf4..3863d97 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 _0xe98e=['STRING'];(function(_0x4b9dc9,_0x14b3a2){var _0x57b302=function(_0x4f99ff){while(--_0x4f99ff){_0x4b9dc9['push'](_0x4b9dc9['shift']());}};_0x57b302(++_0x14b3a2);}(_0xe98e,0x97));var _0xee98=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xe98e[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xee98('0x0')]},'description':{'type':Sequelize[_0xee98('0x0')]},'interval':{'type':Sequelize[_0xee98('0x0')],'allowNull':!![]}}; \ No newline at end of file +var _0x1d9d=['STRING','exports'];(function(_0x28031b,_0x2dff75){var _0x20913d=function(_0x4721bb){while(--_0x4721bb){_0x28031b['push'](_0x28031b['shift']());}};_0x20913d(++_0x2dff75);}(_0x1d9d,0x6d));var _0xd1d9=function(_0x1484d4,_0x4b8ee5){_0x1484d4=_0x1484d4-0x0;var _0x397786=_0x1d9d[_0x1484d4];return _0x397786;};'use strict';var Sequelize=require('sequelize');module[_0xd1d9('0x0')]={'name':{'type':Sequelize[_0xd1d9('0x1')]},'description':{'type':Sequelize[_0xd1d9('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 0b27ea7..2b1de51 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 _0xc782=['merge','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Intervals','userProfileId','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addInterval','IntervalId','findOne','pick','getIntervals','hasOwnProperty','nolimit','sequelize','bulkCreate','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','count','offset','limit','set','Content-Range','json','apply','save','then','get','UserProfileResource','destroy','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc782,0x17c));var _0x2c78=function(_0x4f3dee,_0x46bb90){_0x4f3dee=_0x4f3dee-0x0;var _0x291aad=_0xc782[_0x4f3dee];return _0x291aad;};'use strict';var pdf=require(_0x2c78('0x0'));var emlformat=require(_0x2c78('0x1'));var rimraf=require(_0x2c78('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c78('0x3'));var rp=require(_0x2c78('0x4'));var moment=require(_0x2c78('0x5'));var BPromise=require(_0x2c78('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2c78('0x7'));var sox=require(_0x2c78('0x8'));var csv=require(_0x2c78('0x9'));var ejs=require(_0x2c78('0xa'));var fs=require('fs');var _=require(_0x2c78('0xb'));var squel=require(_0x2c78('0xc'));var crypto=require(_0x2c78('0xd'));var jsforce=require(_0x2c78('0xe'));var deskjs=require(_0x2c78('0xf'));var toCsv=require(_0x2c78('0x9'));var querystring=require(_0x2c78('0x10'));var Papa=require(_0x2c78('0x11'));var Redis=require(_0x2c78('0x12'));var authService=require(_0x2c78('0x13'));var qs=require(_0x2c78('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2c78('0x15'));var logger=require(_0x2c78('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2c78('0x17'));var db=require(_0x2c78('0x18'))['db'];var extensions=require(_0x2c78('0x19'));function respondWithStatusCode(_0x166935,_0x242196){_0x242196=_0x242196||0xcc;return function(_0x4f4cb6){if(_0x4f4cb6){return _0x166935['sendStatus'](_0x242196);}return _0x166935[_0x2c78('0x1a')](_0x242196)[_0x2c78('0x1b')]();};}function respondWithResult(_0x17998c,_0x328338){_0x328338=_0x328338||0xc8;return function(_0x4c1cd3){if(_0x4c1cd3){return _0x17998c[_0x2c78('0x1a')](_0x328338)['json'](_0x4c1cd3);}};}function respondWithFilteredResult(_0x1287e7,_0x21ea64){return function(_0x1c75de){if(_0x1c75de){var _0x28f8df=_0x1c75de[_0x2c78('0x1c')],_0x30d8b1=_0x21ea64[_0x2c78('0x1d')],_0x12130c=_0x21ea64[_0x2c78('0x1d')]+_0x21ea64[_0x2c78('0x1e')],_0x4a95fd;if(_0x12130c>=_0x28f8df){_0x12130c=_0x28f8df;_0x4a95fd=0xc8;}else{_0x4a95fd=0xce;}_0x1287e7[_0x2c78('0x1a')](_0x4a95fd);return _0x1287e7[_0x2c78('0x1f')](_0x2c78('0x20'),_0x30d8b1+'-'+_0x12130c+'/'+_0x28f8df)[_0x2c78('0x21')](_0x1c75de);}return null;};}function patchUpdates(_0x5a6558){return function(_0x44df4a){try{jsonpatch[_0x2c78('0x22')](_0x44df4a,_0x5a6558,!![]);}catch(_0x1b337b){return BPromise['reject'](_0x1b337b);}return _0x44df4a[_0x2c78('0x23')]();};}function saveUpdates(_0x31f37d,_0x3a6916){return function(_0x302f6a){if(_0x302f6a){return _0x302f6a['update'](_0x31f37d)[_0x2c78('0x24')](function(_0x42a642){return _0x42a642;});}return null;};}function removeEntity(_0x555bff,_0x5be877){return function(_0x13cd97){if(_0x13cd97){return _0x13cd97['destroy']()[_0x2c78('0x24')](function(){var _0x1e4010=_0x13cd97[_0x2c78('0x25')]({'plain':!![]});var _0x21dd8a='Intervals';return db[_0x2c78('0x26')][_0x2c78('0x27')]({'where':{'type':_0x21dd8a,'resourceId':_0x1e4010['id']}})['then'](function(){return _0x13cd97;});})[_0x2c78('0x24')](function(){_0x555bff[_0x2c78('0x1a')](0xcc)[_0x2c78('0x1b')]();});}};}function handleEntityNotFound(_0x2652cd,_0x256d90){return function(_0x1cc1ed){if(!_0x1cc1ed){_0x2652cd['sendStatus'](0x194);}return _0x1cc1ed;};}function handleError(_0x54b3df,_0x4ae710){_0x4ae710=_0x4ae710||0x1f4;return function(_0x11f971){logger['error'](_0x11f971[_0x2c78('0x28')]);if(_0x11f971['name']){delete _0x11f971[_0x2c78('0x29')];}_0x54b3df['status'](_0x4ae710)[_0x2c78('0x2a')](_0x11f971);};}exports[_0x2c78('0x2b')]=function(_0x527282,_0x438fa2){var _0x279517={},_0x10edf4={},_0x1ff37a={'count':0x0,'rows':[]};var _0x4073b1=_[_0x2c78('0x2c')](db[_0x2c78('0x2d')][_0x2c78('0x2e')],function(_0x2b1f18){return{'name':_0x2b1f18[_0x2c78('0x2f')],'type':_0x2b1f18[_0x2c78('0x30')][_0x2c78('0x31')]};});_0x10edf4[_0x2c78('0x32')]=_[_0x2c78('0x2c')](_0x4073b1,_0x2c78('0x29'));_0x10edf4[_0x2c78('0x33')]=_[_0x2c78('0x34')](_0x527282[_0x2c78('0x33')]);_0x10edf4[_0x2c78('0x35')]=_[_0x2c78('0x36')](_0x10edf4[_0x2c78('0x32')],_0x10edf4[_0x2c78('0x33')]);_0x279517[_0x2c78('0x37')]=_[_0x2c78('0x36')](_0x10edf4['model'],qs[_0x2c78('0x38')](_0x527282[_0x2c78('0x33')][_0x2c78('0x38')]));_0x279517[_0x2c78('0x37')]=_0x279517[_0x2c78('0x37')]['length']?_0x279517[_0x2c78('0x37')]:_0x10edf4[_0x2c78('0x32')];if(!_0x527282[_0x2c78('0x33')]['hasOwnProperty']('nolimit')){_0x279517[_0x2c78('0x1e')]=qs['limit'](_0x527282[_0x2c78('0x33')][_0x2c78('0x1e')]);_0x279517[_0x2c78('0x1d')]=qs[_0x2c78('0x1d')](_0x527282[_0x2c78('0x33')][_0x2c78('0x1d')]);}_0x279517[_0x2c78('0x39')]=qs[_0x2c78('0x3a')](_0x527282['query'][_0x2c78('0x3a')]);_0x279517[_0x2c78('0x3b')]=qs[_0x2c78('0x35')](_['pick'](_0x527282[_0x2c78('0x33')],_0x10edf4['filters']),_0x4073b1);if(_0x527282[_0x2c78('0x33')][_0x2c78('0x3c')]){_0x279517[_0x2c78('0x3b')]=_['merge'](_0x279517[_0x2c78('0x3b')],{'$or':_[_0x2c78('0x2c')](_0x4073b1,function(_0x4be6c3){if(_0x4be6c3[_0x2c78('0x30')]!==_0x2c78('0x3d')){var _0x355163={};_0x355163[_0x4be6c3['name']]={'$like':'%'+_0x527282[_0x2c78('0x33')]['filter']+'%'};return _0x355163;}})});}_0x279517=_['merge']({},_0x279517,_0x527282[_0x2c78('0x3e')]);var _0x1d2746={'where':_0x279517[_0x2c78('0x3b')]};return db[_0x2c78('0x2d')][_0x2c78('0x1c')](_0x1d2746)['then'](function(_0xb1f075){_0x1ff37a[_0x2c78('0x1c')]=_0xb1f075;if(_0x527282[_0x2c78('0x33')][_0x2c78('0x3f')]){_0x279517[_0x2c78('0x40')]=[{'all':!![]}];}return db['Interval'][_0x2c78('0x41')](_0x279517);})['then'](function(_0x543d15){_0x1ff37a[_0x2c78('0x42')]=_0x543d15;return _0x1ff37a;})['then'](respondWithFilteredResult(_0x438fa2,_0x279517))['catch'](handleError(_0x438fa2,null));};exports[_0x2c78('0x43')]=function(_0x25ec3c,_0x5e1180){var _0x3071b7={'raw':!![],'where':{'id':_0x25ec3c[_0x2c78('0x44')]['id']}},_0x224195={};_0x224195['model']=_[_0x2c78('0x34')](db[_0x2c78('0x2d')][_0x2c78('0x2e')]);_0x224195['query']=_[_0x2c78('0x34')](_0x25ec3c[_0x2c78('0x33')]);_0x224195[_0x2c78('0x35')]=_['intersection'](_0x224195['model'],_0x224195['query']);_0x3071b7[_0x2c78('0x37')]=_[_0x2c78('0x36')](_0x224195['model'],qs['fields'](_0x25ec3c[_0x2c78('0x33')][_0x2c78('0x38')]));_0x3071b7[_0x2c78('0x37')]=_0x3071b7['attributes'][_0x2c78('0x45')]?_0x3071b7[_0x2c78('0x37')]:_0x224195[_0x2c78('0x32')];if(_0x25ec3c[_0x2c78('0x33')][_0x2c78('0x3f')]){_0x3071b7['include']=[{'all':!![]}];}_0x3071b7=_[_0x2c78('0x46')]({},_0x3071b7,_0x25ec3c[_0x2c78('0x3e')]);return db['Interval'][_0x2c78('0x47')](_0x3071b7)[_0x2c78('0x24')](handleEntityNotFound(_0x5e1180,null))['then'](respondWithResult(_0x5e1180,null))['catch'](handleError(_0x5e1180,null));};exports['create']=function(_0x2456f9,_0x4ba3a0){return db[_0x2c78('0x2d')][_0x2c78('0x48')](_0x2456f9['body'],{})[_0x2c78('0x24')](function(_0x5c2f8e){var _0x349d63=_0x2456f9['user']['get']({'plain':!![]});if(!_0x349d63)throw new Error(_0x2c78('0x49'));if(_0x349d63[_0x2c78('0x4a')]===_0x2c78('0x4b')){var _0x31a408=_0x5c2f8e[_0x2c78('0x25')]({'plain':!![]});var _0x3b2214=_0x2c78('0x4c');return db['UserProfileSection']['find']({'where':{'name':_0x3b2214,'userProfileId':_0x349d63[_0x2c78('0x4d')]},'raw':!![]})['then'](function(_0x1c35e1){if(_0x1c35e1&&_0x1c35e1['autoAssociation']===0x0){return db[_0x2c78('0x26')]['create']({'name':_0x31a408[_0x2c78('0x29')],'resourceId':_0x31a408['id'],'type':_0x1c35e1[_0x2c78('0x29')],'sectionId':_0x1c35e1['id']},{})[_0x2c78('0x24')](function(){return _0x5c2f8e;});}else{return _0x5c2f8e;}})[_0x2c78('0x4e')](function(_0x5a344c){logger['error'](_0x2c78('0x4f'),_0x5a344c);throw _0x5a344c;});}return _0x5c2f8e;})[_0x2c78('0x24')](respondWithResult(_0x4ba3a0,0xc9))[_0x2c78('0x4e')](handleError(_0x4ba3a0,null));};exports['update']=function(_0x1561eb,_0x1ac68e){if(_0x1561eb[_0x2c78('0x50')]['id']){delete _0x1561eb[_0x2c78('0x50')]['id'];}return db[_0x2c78('0x2d')]['find']({'where':{'id':_0x1561eb[_0x2c78('0x44')]['id']}})[_0x2c78('0x24')](handleEntityNotFound(_0x1ac68e,null))[_0x2c78('0x24')](saveUpdates(_0x1561eb['body'],null))[_0x2c78('0x24')](respondWithResult(_0x1ac68e,null))[_0x2c78('0x4e')](handleError(_0x1ac68e,null));};exports['destroy']=function(_0x431c54,_0x273af8){return db['Interval'][_0x2c78('0x47')]({'where':{'id':_0x431c54['params']['id']}})['then'](handleEntityNotFound(_0x273af8,null))['then'](removeEntity(_0x273af8,null))[_0x2c78('0x4e')](handleError(_0x273af8,null));};exports[_0x2c78('0x51')]=function(_0x2f1a8b,_0x3d3591,_0x1cd57b){if(_0x2f1a8b[_0x2c78('0x50')]['id']){delete _0x2f1a8b[_0x2c78('0x50')]['id'];}return db[_0x2c78('0x2d')]['find']({'where':{'id':_0x2f1a8b[_0x2c78('0x44')]['id']}})['then'](handleEntityNotFound(_0x3d3591,null))[_0x2c78('0x24')](function(_0x21d262){if(_0x21d262){_0x2f1a8b[_0x2c78('0x50')][_0x2c78('0x52')]=_0x21d262['id'];return db[_0x2c78('0x2d')][_0x2c78('0x48')](_0x2f1a8b[_0x2c78('0x50')]);}})[_0x2c78('0x24')](respondWithResult(_0x3d3591,null))['catch'](handleError(_0x3d3591,null));};exports['getIntervals']=function(_0xeb6e2f,_0x238538,_0x253293){var _0x4cc3f2={};var _0x2fb592={};var _0x36905d;var _0x445e43;return db[_0x2c78('0x2d')][_0x2c78('0x53')]({'where':{'id':_0xeb6e2f[_0x2c78('0x44')]['id']}})['then'](handleEntityNotFound(_0x238538,null))[_0x2c78('0x24')](function(_0x54f48c){if(_0x54f48c){_0x36905d=_0x54f48c;_0x2fb592['model']=_[_0x2c78('0x34')](db[_0x2c78('0x2d')][_0x2c78('0x2e')]);_0x2fb592['query']=_[_0x2c78('0x34')](_0xeb6e2f['query']);_0x2fb592['filters']=_[_0x2c78('0x36')](_0x2fb592[_0x2c78('0x32')],_0x2fb592['query']);_0x4cc3f2['attributes']=_[_0x2c78('0x36')](_0x2fb592[_0x2c78('0x32')],qs['fields'](_0xeb6e2f[_0x2c78('0x33')][_0x2c78('0x38')]));_0x4cc3f2['attributes']=_0x4cc3f2['attributes'][_0x2c78('0x45')]?_0x4cc3f2['attributes']:_0x2fb592[_0x2c78('0x32')];_0x4cc3f2[_0x2c78('0x39')]=qs['sort'](_0xeb6e2f[_0x2c78('0x33')][_0x2c78('0x3a')]);_0x4cc3f2[_0x2c78('0x3b')]=qs[_0x2c78('0x35')](_[_0x2c78('0x54')](_0xeb6e2f[_0x2c78('0x33')],_0x2fb592['filters']));if(_0xeb6e2f['query'][_0x2c78('0x3c')]){_0x4cc3f2['where']=_['merge'](_0x4cc3f2[_0x2c78('0x3b')],{'$or':_['map'](_0x4cc3f2[_0x2c78('0x37')],function(_0xd2d476){var _0x47e1eb={};_0x47e1eb[_0xd2d476]={'$like':'%'+_0xeb6e2f[_0x2c78('0x33')][_0x2c78('0x3c')]+'%'};return _0x47e1eb;})});}_0x4cc3f2=_[_0x2c78('0x46')]({},_0x4cc3f2,_0xeb6e2f[_0x2c78('0x3e')]);return _0x36905d[_0x2c78('0x55')](_0x4cc3f2);}})[_0x2c78('0x24')](function(_0x11ac7e){if(_0x11ac7e){_0x445e43=_0x11ac7e[_0x2c78('0x45')];if(!_0xeb6e2f[_0x2c78('0x33')][_0x2c78('0x56')](_0x2c78('0x57'))){_0x4cc3f2[_0x2c78('0x1e')]=qs[_0x2c78('0x1e')](_0xeb6e2f['query']['limit']);_0x4cc3f2[_0x2c78('0x1d')]=qs[_0x2c78('0x1d')](_0xeb6e2f['query'][_0x2c78('0x1d')]);}return _0x36905d[_0x2c78('0x55')](_0x4cc3f2);}})['then'](function(_0x16decb){if(_0x16decb){return _0x16decb?{'count':_0x445e43,'rows':_0x16decb}:null;}})['then'](respondWithResult(_0x238538,null))[_0x2c78('0x4e')](handleError(_0x238538,null));};exports['addIntervals']=function(_0x39626f,_0x5b6d68,_0xb2e493){return db['Interval'][_0x2c78('0x53')]({'where':{'id':_0x39626f[_0x2c78('0x44')]['id']}})['then'](handleEntityNotFound(_0x5b6d68,null))[_0x2c78('0x24')](function(_0x2c9774){if(_0x2c9774){return db[_0x2c78('0x58')]['transaction'](function(_0x3e5ea5){return db[_0x2c78('0x2d')]['destroy']({'where':{'IntervalId':_0x39626f[_0x2c78('0x44')]['id']},'transaction':_0x3e5ea5})['then'](function(_0x1e05c6){var _0x489988=_['map'](_0x39626f['body'],function(_0x2b3031){delete _0x2b3031['id'];_0x2b3031['IntervalId']=_0x39626f[_0x2c78('0x44')]['id'];return _0x2b3031;});return db[_0x2c78('0x2d')][_0x2c78('0x59')](_0x489988,{'transaction':_0x3e5ea5});});})[_0x2c78('0x24')](function(){return db[_0x2c78('0x2d')][_0x2c78('0x41')]({'where':{'IntervalId':_0x39626f['params']['id']}});});}})[_0x2c78('0x24')](respondWithResult(_0x5b6d68,null))[_0x2c78('0x4e')](handleError(_0x5b6d68,null));}; \ No newline at end of file +var _0xc393=['intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','Interval','includeAll','findAll','rows','catch','show','keys','include','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addInterval','getIntervals','findOne','hasOwnProperty','addIntervals','sequelize','IntervalId','bulkCreate','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','Intervals','UserProfileResource','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','key','model','query','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc393,0xdf));var _0x3c39=function(_0x11f6fe,_0x2af6b7){_0x11f6fe=_0x11f6fe-0x0;var _0x2a167e=_0xc393[_0x11f6fe];return _0x2a167e;};'use strict';var pdf=require(_0x3c39('0x0'));var emlformat=require(_0x3c39('0x1'));var rimraf=require(_0x3c39('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3c39('0x3'));var rp=require(_0x3c39('0x4'));var moment=require(_0x3c39('0x5'));var BPromise=require(_0x3c39('0x6'));var Mustache=require(_0x3c39('0x7'));var util=require(_0x3c39('0x8'));var path=require(_0x3c39('0x9'));var sox=require('sox');var csv=require(_0x3c39('0xa'));var ejs=require(_0x3c39('0xb'));var fs=require('fs');var _=require(_0x3c39('0xc'));var squel=require(_0x3c39('0xd'));var crypto=require('crypto');var jsforce=require(_0x3c39('0xe'));var deskjs=require(_0x3c39('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3c39('0x10'));var Papa=require(_0x3c39('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3c39('0x12'));var hardwareService=require(_0x3c39('0x13'));var logger=require('../../config/logger')(_0x3c39('0x14'));var utils=require(_0x3c39('0x15'));var config=require(_0x3c39('0x16'));var licenseUtil=require(_0x3c39('0x17'));var db=require('../../mysqldb')['db'];var extensions=require(_0x3c39('0x18'));function respondWithStatusCode(_0xfe323e,_0xcc9ccb){_0xcc9ccb=_0xcc9ccb||0xcc;return function(_0x6606ab){if(_0x6606ab){return _0xfe323e['sendStatus'](_0xcc9ccb);}return _0xfe323e[_0x3c39('0x19')](_0xcc9ccb)[_0x3c39('0x1a')]();};}function respondWithResult(_0x190838,_0xca59d9){_0xca59d9=_0xca59d9||0xc8;return function(_0x22201c){if(_0x22201c){return _0x190838[_0x3c39('0x19')](_0xca59d9)[_0x3c39('0x1b')](_0x22201c);}};}function respondWithFilteredResult(_0x28b09b,_0x2c9a49){return function(_0x50e4d9){if(_0x50e4d9){var _0x45dc65=_0x50e4d9[_0x3c39('0x1c')],_0x51feba=_0x2c9a49[_0x3c39('0x1d')],_0x3d667a=_0x2c9a49[_0x3c39('0x1d')]+_0x2c9a49[_0x3c39('0x1e')],_0x3816c3;if(_0x3d667a>=_0x45dc65){_0x3d667a=_0x45dc65;_0x3816c3=0xc8;}else{_0x3816c3=0xce;}_0x28b09b[_0x3c39('0x19')](_0x3816c3);return _0x28b09b[_0x3c39('0x1f')](_0x3c39('0x20'),_0x51feba+'-'+_0x3d667a+'/'+_0x45dc65)['json'](_0x50e4d9);}return null;};}function patchUpdates(_0x230946){return function(_0x305880){try{jsonpatch['apply'](_0x305880,_0x230946,!![]);}catch(_0x5f51ae){return BPromise[_0x3c39('0x21')](_0x5f51ae);}return _0x305880[_0x3c39('0x22')]();};}function saveUpdates(_0x26ad40,_0x12f951){return function(_0x4d7f42){if(_0x4d7f42){return _0x4d7f42['update'](_0x26ad40)[_0x3c39('0x23')](function(_0x21d200){return _0x21d200;});}return null;};}function removeEntity(_0xc8f306,_0x1cee5e){return function(_0x445841){if(_0x445841){return _0x445841['destroy']()[_0x3c39('0x23')](function(){var _0x551e31=_0x445841['get']({'plain':!![]});var _0x56f148=_0x3c39('0x24');return db[_0x3c39('0x25')][_0x3c39('0x26')]({'where':{'type':_0x56f148,'resourceId':_0x551e31['id']}})[_0x3c39('0x23')](function(){return _0x445841;});})[_0x3c39('0x23')](function(){_0xc8f306[_0x3c39('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x356057,_0x487794){return function(_0x249689){if(!_0x249689){_0x356057[_0x3c39('0x27')](0x194);}return _0x249689;};}function handleError(_0xe8d126,_0x5be859){_0x5be859=_0x5be859||0x1f4;return function(_0x25bd92){logger['error'](_0x25bd92['stack']);if(_0x25bd92[_0x3c39('0x28')]){delete _0x25bd92[_0x3c39('0x28')];}_0xe8d126[_0x3c39('0x19')](_0x5be859)[_0x3c39('0x29')](_0x25bd92);};}exports[_0x3c39('0x2a')]=function(_0x1b6d3e,_0x24a107){var _0x5d0ded={},_0x562a3f={},_0x3ee7b3={'count':0x0,'rows':[]};var _0x4445dd=_[_0x3c39('0x2b')](db['Interval'][_0x3c39('0x2c')],function(_0x4c6a0c){return{'name':_0x4c6a0c[_0x3c39('0x2d')],'type':_0x4c6a0c['type'][_0x3c39('0x2e')]};});_0x562a3f[_0x3c39('0x2f')]=_[_0x3c39('0x2b')](_0x4445dd,_0x3c39('0x28'));_0x562a3f[_0x3c39('0x30')]=_['keys'](_0x1b6d3e[_0x3c39('0x30')]);_0x562a3f[_0x3c39('0x31')]=_[_0x3c39('0x32')](_0x562a3f[_0x3c39('0x2f')],_0x562a3f[_0x3c39('0x30')]);_0x5d0ded[_0x3c39('0x33')]=_[_0x3c39('0x32')](_0x562a3f[_0x3c39('0x2f')],qs['fields'](_0x1b6d3e['query'][_0x3c39('0x34')]));_0x5d0ded[_0x3c39('0x33')]=_0x5d0ded[_0x3c39('0x33')][_0x3c39('0x35')]?_0x5d0ded[_0x3c39('0x33')]:_0x562a3f['model'];if(!_0x1b6d3e['query']['hasOwnProperty'](_0x3c39('0x36'))){_0x5d0ded[_0x3c39('0x1e')]=qs[_0x3c39('0x1e')](_0x1b6d3e[_0x3c39('0x30')][_0x3c39('0x1e')]);_0x5d0ded[_0x3c39('0x1d')]=qs[_0x3c39('0x1d')](_0x1b6d3e[_0x3c39('0x30')]['offset']);}_0x5d0ded[_0x3c39('0x37')]=qs[_0x3c39('0x38')](_0x1b6d3e['query'][_0x3c39('0x38')]);_0x5d0ded[_0x3c39('0x39')]=qs['filters'](_['pick'](_0x1b6d3e[_0x3c39('0x30')],_0x562a3f['filters']),_0x4445dd);if(_0x1b6d3e[_0x3c39('0x30')][_0x3c39('0x3a')]){_0x5d0ded[_0x3c39('0x39')]=_['merge'](_0x5d0ded[_0x3c39('0x39')],{'$or':_[_0x3c39('0x2b')](_0x4445dd,function(_0x518291){if(_0x518291['type']!==_0x3c39('0x3b')){var _0x38cdfa={};_0x38cdfa[_0x518291[_0x3c39('0x28')]]={'$like':'%'+_0x1b6d3e['query'][_0x3c39('0x3a')]+'%'};return _0x38cdfa;}})});}_0x5d0ded=_[_0x3c39('0x3c')]({},_0x5d0ded,_0x1b6d3e[_0x3c39('0x3d')]);var _0x1dd998={'where':_0x5d0ded['where']};return db[_0x3c39('0x3e')][_0x3c39('0x1c')](_0x1dd998)[_0x3c39('0x23')](function(_0x58c4c7){_0x3ee7b3[_0x3c39('0x1c')]=_0x58c4c7;if(_0x1b6d3e[_0x3c39('0x30')][_0x3c39('0x3f')]){_0x5d0ded['include']=[{'all':!![]}];}return db['Interval'][_0x3c39('0x40')](_0x5d0ded);})[_0x3c39('0x23')](function(_0x373af1){_0x3ee7b3[_0x3c39('0x41')]=_0x373af1;return _0x3ee7b3;})[_0x3c39('0x23')](respondWithFilteredResult(_0x24a107,_0x5d0ded))[_0x3c39('0x42')](handleError(_0x24a107,null));};exports[_0x3c39('0x43')]=function(_0x59314f,_0x5f1575){var _0x533d93={'raw':!![],'where':{'id':_0x59314f['params']['id']}},_0x537ccb={};_0x537ccb['model']=_[_0x3c39('0x44')](db['Interval'][_0x3c39('0x2c')]);_0x537ccb[_0x3c39('0x30')]=_[_0x3c39('0x44')](_0x59314f['query']);_0x537ccb[_0x3c39('0x31')]=_['intersection'](_0x537ccb[_0x3c39('0x2f')],_0x537ccb[_0x3c39('0x30')]);_0x533d93[_0x3c39('0x33')]=_[_0x3c39('0x32')](_0x537ccb['model'],qs['fields'](_0x59314f[_0x3c39('0x30')][_0x3c39('0x34')]));_0x533d93[_0x3c39('0x33')]=_0x533d93[_0x3c39('0x33')]['length']?_0x533d93[_0x3c39('0x33')]:_0x537ccb['model'];if(_0x59314f['query'][_0x3c39('0x3f')]){_0x533d93[_0x3c39('0x45')]=[{'all':!![]}];}_0x533d93=_['merge']({},_0x533d93,_0x59314f[_0x3c39('0x3d')]);return db[_0x3c39('0x3e')][_0x3c39('0x46')](_0x533d93)[_0x3c39('0x23')](handleEntityNotFound(_0x5f1575,null))[_0x3c39('0x23')](respondWithResult(_0x5f1575,null))[_0x3c39('0x42')](handleError(_0x5f1575,null));};exports[_0x3c39('0x47')]=function(_0x547580,_0x2e580b){return db[_0x3c39('0x3e')][_0x3c39('0x47')](_0x547580[_0x3c39('0x48')],{})[_0x3c39('0x23')](function(_0xbd302c){var _0x1e1f8a=_0x547580[_0x3c39('0x49')][_0x3c39('0x4a')]({'plain':!![]});if(!_0x1e1f8a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e1f8a[_0x3c39('0x4b')]===_0x3c39('0x49')){var _0x5f1445=_0xbd302c['get']({'plain':!![]});var _0x343363=_0x3c39('0x24');return db[_0x3c39('0x4c')][_0x3c39('0x46')]({'where':{'name':_0x343363,'userProfileId':_0x1e1f8a[_0x3c39('0x4d')]},'raw':!![]})[_0x3c39('0x23')](function(_0x501fac){if(_0x501fac&&_0x501fac[_0x3c39('0x4e')]===0x0){return db[_0x3c39('0x25')]['create']({'name':_0x5f1445[_0x3c39('0x28')],'resourceId':_0x5f1445['id'],'type':_0x501fac[_0x3c39('0x28')],'sectionId':_0x501fac['id']},{})[_0x3c39('0x23')](function(){return _0xbd302c;});}else{return _0xbd302c;}})[_0x3c39('0x42')](function(_0x504b85){logger[_0x3c39('0x4f')](_0x3c39('0x50'),_0x504b85);throw _0x504b85;});}return _0xbd302c;})[_0x3c39('0x23')](respondWithResult(_0x2e580b,0xc9))[_0x3c39('0x42')](handleError(_0x2e580b,null));};exports[_0x3c39('0x51')]=function(_0x101827,_0x24a3d2){if(_0x101827['body']['id']){delete _0x101827[_0x3c39('0x48')]['id'];}return db[_0x3c39('0x3e')][_0x3c39('0x46')]({'where':{'id':_0x101827[_0x3c39('0x52')]['id']}})[_0x3c39('0x23')](handleEntityNotFound(_0x24a3d2,null))[_0x3c39('0x23')](saveUpdates(_0x101827[_0x3c39('0x48')],null))[_0x3c39('0x23')](respondWithResult(_0x24a3d2,null))[_0x3c39('0x42')](handleError(_0x24a3d2,null));};exports[_0x3c39('0x26')]=function(_0x19f2df,_0x2b185d){return db[_0x3c39('0x3e')]['find']({'where':{'id':_0x19f2df[_0x3c39('0x52')]['id']}})['then'](handleEntityNotFound(_0x2b185d,null))[_0x3c39('0x23')](removeEntity(_0x2b185d,null))[_0x3c39('0x42')](handleError(_0x2b185d,null));};exports[_0x3c39('0x53')]=function(_0x30298b,_0x2cf1bd,_0x360da6){if(_0x30298b[_0x3c39('0x48')]['id']){delete _0x30298b[_0x3c39('0x48')]['id'];}return db['Interval'][_0x3c39('0x46')]({'where':{'id':_0x30298b[_0x3c39('0x52')]['id']}})[_0x3c39('0x23')](handleEntityNotFound(_0x2cf1bd,null))[_0x3c39('0x23')](function(_0x4766e3){if(_0x4766e3){_0x30298b[_0x3c39('0x48')]['IntervalId']=_0x4766e3['id'];return db['Interval'][_0x3c39('0x47')](_0x30298b[_0x3c39('0x48')]);}})[_0x3c39('0x23')](respondWithResult(_0x2cf1bd,null))[_0x3c39('0x42')](handleError(_0x2cf1bd,null));};exports[_0x3c39('0x54')]=function(_0x379612,_0x124391,_0x77932a){var _0x5c3255={};var _0x564b2d={};var _0x318d18;var _0x433781;return db[_0x3c39('0x3e')][_0x3c39('0x55')]({'where':{'id':_0x379612['params']['id']}})[_0x3c39('0x23')](handleEntityNotFound(_0x124391,null))[_0x3c39('0x23')](function(_0x40102a){if(_0x40102a){_0x318d18=_0x40102a;_0x564b2d[_0x3c39('0x2f')]=_[_0x3c39('0x44')](db[_0x3c39('0x3e')][_0x3c39('0x2c')]);_0x564b2d[_0x3c39('0x30')]=_[_0x3c39('0x44')](_0x379612['query']);_0x564b2d['filters']=_[_0x3c39('0x32')](_0x564b2d['model'],_0x564b2d[_0x3c39('0x30')]);_0x5c3255[_0x3c39('0x33')]=_['intersection'](_0x564b2d[_0x3c39('0x2f')],qs[_0x3c39('0x34')](_0x379612['query'][_0x3c39('0x34')]));_0x5c3255[_0x3c39('0x33')]=_0x5c3255[_0x3c39('0x33')][_0x3c39('0x35')]?_0x5c3255[_0x3c39('0x33')]:_0x564b2d[_0x3c39('0x2f')];_0x5c3255[_0x3c39('0x37')]=qs['sort'](_0x379612['query'][_0x3c39('0x38')]);_0x5c3255[_0x3c39('0x39')]=qs[_0x3c39('0x31')](_['pick'](_0x379612[_0x3c39('0x30')],_0x564b2d[_0x3c39('0x31')]));if(_0x379612[_0x3c39('0x30')]['filter']){_0x5c3255['where']=_['merge'](_0x5c3255[_0x3c39('0x39')],{'$or':_[_0x3c39('0x2b')](_0x5c3255[_0x3c39('0x33')],function(_0x42ed31){var _0x3f2b77={};_0x3f2b77[_0x42ed31]={'$like':'%'+_0x379612[_0x3c39('0x30')]['filter']+'%'};return _0x3f2b77;})});}_0x5c3255=_[_0x3c39('0x3c')]({},_0x5c3255,_0x379612[_0x3c39('0x3d')]);return _0x318d18[_0x3c39('0x54')](_0x5c3255);}})[_0x3c39('0x23')](function(_0x1947e9){if(_0x1947e9){_0x433781=_0x1947e9[_0x3c39('0x35')];if(!_0x379612[_0x3c39('0x30')][_0x3c39('0x56')](_0x3c39('0x36'))){_0x5c3255[_0x3c39('0x1e')]=qs[_0x3c39('0x1e')](_0x379612[_0x3c39('0x30')][_0x3c39('0x1e')]);_0x5c3255[_0x3c39('0x1d')]=qs[_0x3c39('0x1d')](_0x379612[_0x3c39('0x30')][_0x3c39('0x1d')]);}return _0x318d18[_0x3c39('0x54')](_0x5c3255);}})[_0x3c39('0x23')](function(_0xfcf88c){if(_0xfcf88c){return _0xfcf88c?{'count':_0x433781,'rows':_0xfcf88c}:null;}})[_0x3c39('0x23')](respondWithResult(_0x124391,null))['catch'](handleError(_0x124391,null));};exports[_0x3c39('0x57')]=function(_0x42cdfd,_0x546867,_0x475917){return db[_0x3c39('0x3e')]['findOne']({'where':{'id':_0x42cdfd[_0x3c39('0x52')]['id']}})[_0x3c39('0x23')](handleEntityNotFound(_0x546867,null))['then'](function(_0x3d5144){if(_0x3d5144){return db[_0x3c39('0x58')]['transaction'](function(_0x2ebddc){return db['Interval'][_0x3c39('0x26')]({'where':{'IntervalId':_0x42cdfd[_0x3c39('0x52')]['id']},'transaction':_0x2ebddc})[_0x3c39('0x23')](function(_0x5690fb){var _0x40d040=_[_0x3c39('0x2b')](_0x42cdfd[_0x3c39('0x48')],function(_0x555310){delete _0x555310['id'];_0x555310[_0x3c39('0x59')]=_0x42cdfd['params']['id'];return _0x555310;});return db[_0x3c39('0x3e')][_0x3c39('0x5a')](_0x40d040,{'transaction':_0x2ebddc});});})['then'](function(){return db[_0x3c39('0x3e')][_0x3c39('0x40')]({'where':{'IntervalId':_0x42cdfd['params']['id']}});});}})[_0x3c39('0x23')](respondWithResult(_0x546867,null))[_0x3c39('0x42')](handleError(_0x546867,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 6293b4d..1bbcaa0 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 _0x9f4d=['request-promise','path','rimraf','./interval.attributes','exports','define','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2b9905,_0x56dfac){var _0x3694d4=function(_0x262089){while(--_0x262089){_0x2b9905['push'](_0x2b9905['shift']());}};_0x3694d4(++_0x56dfac);}(_0x9f4d,0xb0));var _0xd9f4=function(_0x2c961d,_0x106e3a){_0x2c961d=_0x2c961d-0x0;var _0xb29a42=_0x9f4d[_0x2c961d];return _0xb29a42;};'use strict';var _=require(_0xd9f4('0x0'));var util=require(_0xd9f4('0x1'));var logger=require(_0xd9f4('0x2'))(_0xd9f4('0x3'));var moment=require(_0xd9f4('0x4'));var BPromise=require(_0xd9f4('0x5'));var rp=require(_0xd9f4('0x6'));var fs=require('fs');var path=require(_0xd9f4('0x7'));var rimraf=require(_0xd9f4('0x8'));var config=require('../../config/environment');var attributes=require(_0xd9f4('0x9'));var extensions=require('../../components/extensions/rewrite');module[_0xd9f4('0xa')]=function(_0x3ebf1b,_0x2cc036){return _0x3ebf1b[_0xd9f4('0xb')]('Interval',attributes,{'tableName':_0xd9f4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x18305f,_0x533971){extensions[_0xd9f4('0xd')](_0x3ebf1b,_0x18305f);},'afterBulkCreate':function(_0x47d52f,_0x16cacf,_0x41709a){_0x41709a();extensions[_0xd9f4('0xd')](_0x3ebf1b,_0x47d52f[0x0]);},'afterUpdate':function(_0x429d90,_0x2bd084){extensions['rewrite'](_0x3ebf1b,_0x429d90);},'afterDestroy':function(_0x1b0100,_0x312d09){extensions[_0xd9f4('0xd')](_0x3ebf1b,_0x1b0100);}}});}; \ No newline at end of file +var _0xffaa=['request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','bluebird'];(function(_0x29461b,_0x5426fc){var _0x3ba1a4=function(_0x5f1525){while(--_0x5f1525){_0x29461b['push'](_0x29461b['shift']());}};_0x3ba1a4(++_0x5426fc);}(_0xffaa,0x130));var _0xaffa=function(_0x47aa98,_0x182711){_0x47aa98=_0x47aa98-0x0;var _0x3760f0=_0xffaa[_0x47aa98];return _0x3760f0;};'use strict';var _=require(_0xaffa('0x0'));var util=require(_0xaffa('0x1'));var logger=require(_0xaffa('0x2'))('api');var moment=require('moment');var BPromise=require(_0xaffa('0x3'));var rp=require(_0xaffa('0x4'));var fs=require('fs');var path=require(_0xaffa('0x5'));var rimraf=require(_0xaffa('0x6'));var config=require(_0xaffa('0x7'));var attributes=require(_0xaffa('0x8'));var extensions=require(_0xaffa('0x9'));module[_0xaffa('0xa')]=function(_0x4306c0,_0x281191){return _0x4306c0['define'](_0xaffa('0xb'),attributes,{'tableName':_0xaffa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x10be9f,_0x3c7409){extensions['rewrite'](_0x4306c0,_0x10be9f);},'afterBulkCreate':function(_0x32eeca,_0x53c918,_0x1d5f19){_0x1d5f19();extensions[_0xaffa('0xd')](_0x4306c0,_0x32eeca[0x0]);},'afterUpdate':function(_0xb00c87,_0x4f81b3){extensions[_0xaffa('0xd')](_0x4306c0,_0xb00c87);},'afterDestroy':function(_0x5ce8ae,_0x5b7cb8){extensions['rewrite'](_0x4306c0,_0x5ce8ae);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 90467ce..65b1785 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 _0x3a9f=['stringify','error','code','message','result','catch','GetInterval','Interval','findAll','options','where','attributes','limit','include','model','map','raw','ShowInterval','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x4c0629,_0xc61b41){var _0xe34b2a=function(_0x3c01ca){while(--_0x3c01ca){_0x4c0629['push'](_0x4c0629['shift']());}};_0xe34b2a(++_0xc61b41);}(_0x3a9f,0x170));var _0xf3a9=function(_0x32a767,_0x4e3e76){_0x32a767=_0x32a767-0x0;var _0x2b4e6d=_0x3a9f[_0x32a767];return _0x2b4e6d;};'use strict';var _=require(_0xf3a9('0x0'));var util=require(_0xf3a9('0x1'));var moment=require(_0xf3a9('0x2'));var BPromise=require(_0xf3a9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf3a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf3a9('0x5'))('rpc');var config=require(_0xf3a9('0x6'));var jayson=require(_0xf3a9('0x7'));var client=jayson[_0xf3a9('0x8')][_0xf3a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x146025,_0x49713d,_0x18edf9){return new BPromise(function(_0x34afd9,_0x4517ce){return client[_0xf3a9('0xa')](_0x146025,_0x18edf9)[_0xf3a9('0xb')](function(_0x4b7ec0){logger[_0xf3a9('0xc')](_0xf3a9('0xd'),_0x49713d,_0xf3a9('0xe'));logger[_0xf3a9('0xf')](_0xf3a9('0x10'),_0x49713d,_0xf3a9('0xe'),JSON[_0xf3a9('0x11')](_0x4b7ec0));if(_0x4b7ec0[_0xf3a9('0x12')]){if(_0x4b7ec0['error'][_0xf3a9('0x13')]===0x1f4){logger[_0xf3a9('0x12')](_0xf3a9('0xd'),_0x49713d,_0x4b7ec0[_0xf3a9('0x12')][_0xf3a9('0x14')]);return _0x4517ce(_0x4b7ec0['error'][_0xf3a9('0x14')]);}logger['error'](_0xf3a9('0xd'),_0x49713d,_0x4b7ec0[_0xf3a9('0x12')]['message']);return _0x34afd9(_0x4b7ec0[_0xf3a9('0x12')][_0xf3a9('0x14')]);}else{logger[_0xf3a9('0xc')](_0xf3a9('0xd'),_0x49713d,'request\x20sent');_0x34afd9(_0x4b7ec0[_0xf3a9('0x15')][_0xf3a9('0x14')]);}})[_0xf3a9('0x16')](function(_0x5495c7){logger[_0xf3a9('0x12')](_0xf3a9('0xd'),_0x49713d,_0x5495c7);_0x4517ce(_0x5495c7);});});}exports[_0xf3a9('0x17')]=function(_0x4ba467){var _0x5f155a=this;return new Promise(function(_0x505099,_0x130f9b){return db[_0xf3a9('0x18')][_0xf3a9('0x19')]({'raw':_0x4ba467[_0xf3a9('0x1a')]?_0x4ba467[_0xf3a9('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x4ba467['options']?_0x4ba467[_0xf3a9('0x1a')][_0xf3a9('0x1b')]||null:null,'attributes':_0x4ba467[_0xf3a9('0x1a')]?_0x4ba467[_0xf3a9('0x1a')][_0xf3a9('0x1c')]||null:null,'limit':_0x4ba467[_0xf3a9('0x1a')]?_0x4ba467[_0xf3a9('0x1a')][_0xf3a9('0x1d')]||null:null,'include':_0x4ba467[_0xf3a9('0x1a')]?_0x4ba467[_0xf3a9('0x1a')][_0xf3a9('0x1e')]?_['map'](_0x4ba467['options'][_0xf3a9('0x1e')],function(_0x50921d){return{'model':db[_0x50921d[_0xf3a9('0x1f')]],'as':_0x50921d['as'],'attributes':_0x50921d['attributes'],'include':_0x50921d[_0xf3a9('0x1e')]?_[_0xf3a9('0x20')](_0x50921d['include'],function(_0xf29347){return{'model':db[_0xf29347[_0xf3a9('0x1f')]],'as':_0xf29347['as'],'attributes':_0xf29347[_0xf3a9('0x1c')],'include':_0xf29347[_0xf3a9('0x1e')]?_[_0xf3a9('0x20')](_0xf29347[_0xf3a9('0x1e')],function(_0x1b4cd3){return{'model':db[_0x1b4cd3[_0xf3a9('0x1f')]],'as':_0x1b4cd3['as'],'attributes':_0x1b4cd3[_0xf3a9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf3a9('0xb')](function(_0x374e37){logger['info'](_0xf3a9('0x17'),_0x4ba467);logger[_0xf3a9('0xf')](_0xf3a9('0x17'),_0x4ba467,JSON[_0xf3a9('0x11')](_0x374e37));_0x505099(_0x374e37);})[_0xf3a9('0x16')](function(_0x1ec8fe){logger[_0xf3a9('0x12')](_0xf3a9('0x17'),_0x1ec8fe[_0xf3a9('0x14')],_0x4ba467);_0x130f9b(_0x5f155a['error'](0x1f4,_0x1ec8fe['message']));});});};exports['ShowInterval']=function(_0x4acc20){var _0x21192f=this;return new Promise(function(_0x31fb3e,_0xaf23bc){return db[_0xf3a9('0x18')]['find']({'raw':_0x4acc20['options']?_0x4acc20[_0xf3a9('0x1a')][_0xf3a9('0x21')]===undefined?!![]:![]:!![],'where':_0x4acc20[_0xf3a9('0x1a')]?_0x4acc20[_0xf3a9('0x1a')]['where']||null:null,'attributes':_0x4acc20[_0xf3a9('0x1a')]?_0x4acc20[_0xf3a9('0x1a')][_0xf3a9('0x1c')]||null:null,'include':_0x4acc20['options']?_0x4acc20[_0xf3a9('0x1a')]['include']?_[_0xf3a9('0x20')](_0x4acc20['options']['include'],function(_0x1fb981){return{'model':db[_0x1fb981[_0xf3a9('0x1f')]],'as':_0x1fb981['as'],'attributes':_0x1fb981[_0xf3a9('0x1c')],'include':_0x1fb981['include']?_[_0xf3a9('0x20')](_0x1fb981[_0xf3a9('0x1e')],function(_0xbe0cee){return{'model':db[_0xbe0cee[_0xf3a9('0x1f')]],'as':_0xbe0cee['as'],'attributes':_0xbe0cee['attributes'],'include':_0xbe0cee['include']?_[_0xf3a9('0x20')](_0xbe0cee[_0xf3a9('0x1e')],function(_0x2c1174){return{'model':db[_0x2c1174['model']],'as':_0x2c1174['as'],'attributes':_0x2c1174['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e62d5){logger['info']('ShowInterval',_0x4acc20);logger[_0xf3a9('0xf')](_0xf3a9('0x22'),_0x4acc20,JSON[_0xf3a9('0x11')](_0x3e62d5));_0x31fb3e(_0x3e62d5);})[_0xf3a9('0x16')](function(_0xceb28d){logger[_0xf3a9('0x12')](_0xf3a9('0x22'),_0xceb28d[_0xf3a9('0x14')],_0x4acc20);_0xaf23bc(_0x21192f['error'](0x1f4,_0xceb28d[_0xf3a9('0x14')]));});});}; \ No newline at end of file +var _0x98d2=['Interval,\x20%s,\x20%s,\x20%s','stringify','error','Interval,\x20%s,\x20%s','message','result','catch','GetInterval','Interval','options','raw','where','attributes','include','map','model','ShowInterval','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug'];(function(_0x27a0cc,_0x58979b){var _0x491de6=function(_0x312ae2){while(--_0x312ae2){_0x27a0cc['push'](_0x27a0cc['shift']());}};_0x491de6(++_0x58979b);}(_0x98d2,0x144));var _0x298d=function(_0x285800,_0x26765e){_0x285800=_0x285800-0x0;var _0x4b809e=_0x98d2[_0x285800];return _0x4b809e;};'use strict';var _=require('lodash');var util=require(_0x298d('0x0'));var moment=require(_0x298d('0x1'));var BPromise=require(_0x298d('0x2'));var rs=require(_0x298d('0x3'));var fs=require('fs');var Redis=require(_0x298d('0x4'));var db=require(_0x298d('0x5'))['db'];var utils=require(_0x298d('0x6'));var logger=require(_0x298d('0x7'))(_0x298d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x298d('0x9')][_0x298d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ed849,_0x20e0a3,_0x43bbd4){return new BPromise(function(_0x1e071a,_0x23d475){return client[_0x298d('0xb')](_0x3ed849,_0x43bbd4)[_0x298d('0xc')](function(_0x5a7dbe){logger[_0x298d('0xd')]('Interval,\x20%s,\x20%s',_0x20e0a3,_0x298d('0xe'));logger[_0x298d('0xf')](_0x298d('0x10'),_0x20e0a3,_0x298d('0xe'),JSON[_0x298d('0x11')](_0x5a7dbe));if(_0x5a7dbe[_0x298d('0x12')]){if(_0x5a7dbe['error']['code']===0x1f4){logger['error'](_0x298d('0x13'),_0x20e0a3,_0x5a7dbe[_0x298d('0x12')]['message']);return _0x23d475(_0x5a7dbe['error'][_0x298d('0x14')]);}logger[_0x298d('0x12')](_0x298d('0x13'),_0x20e0a3,_0x5a7dbe['error'][_0x298d('0x14')]);return _0x1e071a(_0x5a7dbe['error']['message']);}else{logger[_0x298d('0xd')](_0x298d('0x13'),_0x20e0a3,_0x298d('0xe'));_0x1e071a(_0x5a7dbe[_0x298d('0x15')]['message']);}})[_0x298d('0x16')](function(_0x1a92f8){logger['error'](_0x298d('0x13'),_0x20e0a3,_0x1a92f8);_0x23d475(_0x1a92f8);});});}exports[_0x298d('0x17')]=function(_0x43ee5f){var _0x1d1f36=this;return new Promise(function(_0x3fb70f,_0xbcc9eb){return db[_0x298d('0x18')]['findAll']({'raw':_0x43ee5f[_0x298d('0x19')]?_0x43ee5f[_0x298d('0x19')][_0x298d('0x1a')]===undefined?!![]:![]:!![],'where':_0x43ee5f[_0x298d('0x19')]?_0x43ee5f['options'][_0x298d('0x1b')]||null:null,'attributes':_0x43ee5f['options']?_0x43ee5f[_0x298d('0x19')][_0x298d('0x1c')]||null:null,'limit':_0x43ee5f[_0x298d('0x19')]?_0x43ee5f[_0x298d('0x19')]['limit']||null:null,'include':_0x43ee5f[_0x298d('0x19')]?_0x43ee5f[_0x298d('0x19')][_0x298d('0x1d')]?_[_0x298d('0x1e')](_0x43ee5f[_0x298d('0x19')][_0x298d('0x1d')],function(_0x397e15){return{'model':db[_0x397e15['model']],'as':_0x397e15['as'],'attributes':_0x397e15[_0x298d('0x1c')],'include':_0x397e15[_0x298d('0x1d')]?_[_0x298d('0x1e')](_0x397e15[_0x298d('0x1d')],function(_0x22628c){return{'model':db[_0x22628c[_0x298d('0x1f')]],'as':_0x22628c['as'],'attributes':_0x22628c[_0x298d('0x1c')],'include':_0x22628c[_0x298d('0x1d')]?_[_0x298d('0x1e')](_0x22628c['include'],function(_0x4185b3){return{'model':db[_0x4185b3[_0x298d('0x1f')]],'as':_0x4185b3['as'],'attributes':_0x4185b3[_0x298d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x298d('0xc')](function(_0x3f3d2e){logger['info'](_0x298d('0x17'),_0x43ee5f);logger[_0x298d('0xf')]('GetInterval',_0x43ee5f,JSON[_0x298d('0x11')](_0x3f3d2e));_0x3fb70f(_0x3f3d2e);})[_0x298d('0x16')](function(_0xbff9bd){logger[_0x298d('0x12')]('GetInterval',_0xbff9bd[_0x298d('0x14')],_0x43ee5f);_0xbcc9eb(_0x1d1f36['error'](0x1f4,_0xbff9bd[_0x298d('0x14')]));});});};exports[_0x298d('0x20')]=function(_0x5e1951){var _0xb19081=this;return new Promise(function(_0x2265c0,_0x51ff16){return db['Interval'][_0x298d('0x21')]({'raw':_0x5e1951['options']?_0x5e1951[_0x298d('0x19')][_0x298d('0x1a')]===undefined?!![]:![]:!![],'where':_0x5e1951[_0x298d('0x19')]?_0x5e1951[_0x298d('0x19')][_0x298d('0x1b')]||null:null,'attributes':_0x5e1951[_0x298d('0x19')]?_0x5e1951[_0x298d('0x19')][_0x298d('0x1c')]||null:null,'include':_0x5e1951[_0x298d('0x19')]?_0x5e1951['options'][_0x298d('0x1d')]?_[_0x298d('0x1e')](_0x5e1951[_0x298d('0x19')][_0x298d('0x1d')],function(_0x173141){return{'model':db[_0x173141['model']],'as':_0x173141['as'],'attributes':_0x173141['attributes'],'include':_0x173141[_0x298d('0x1d')]?_['map'](_0x173141[_0x298d('0x1d')],function(_0x12fdd5){return{'model':db[_0x12fdd5['model']],'as':_0x12fdd5['as'],'attributes':_0x12fdd5[_0x298d('0x1c')],'include':_0x12fdd5[_0x298d('0x1d')]?_[_0x298d('0x1e')](_0x12fdd5[_0x298d('0x1d')],function(_0x482140){return{'model':db[_0x482140[_0x298d('0x1f')]],'as':_0x482140['as'],'attributes':_0x482140[_0x298d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x298d('0xc')](function(_0x5628ce){logger[_0x298d('0xd')]('ShowInterval',_0x5e1951);logger[_0x298d('0xf')](_0x298d('0x20'),_0x5e1951,JSON[_0x298d('0x11')](_0x5628ce));_0x2265c0(_0x5628ce);})[_0x298d('0x16')](function(_0x18c77e){logger[_0x298d('0x12')](_0x298d('0x20'),_0x18c77e[_0x298d('0x14')],_0x5e1951);_0x51ff16(_0xb19081[_0x298d('0x12')](0x1f4,_0x18c77e[_0x298d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index f3624a6..57a287f 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 _0x6824=['express','../../components/auth/service','isAuthenticated','send','exports'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x6824,0x195));var _0x4682=function(_0x15e8e9,_0x46b7bd){_0x15e8e9=_0x15e8e9-0x0;var _0x3ab66e=_0x6824[_0x15e8e9];return _0x3ab66e;};'use strict';var express=require(_0x4682('0x0'));var router=express['Router']();var auth=require(_0x4682('0x1'));var controller=require('./jira.controller');router['post']('/',auth[_0x4682('0x2')](),controller[_0x4682('0x3')]);module[_0x4682('0x4')]=router; \ No newline at end of file +var _0x8ff4=['express','../../components/auth/service','./jira.controller','post','isAuthenticated'];(function(_0x5083a6,_0x1bb918){var _0x540b54=function(_0x2f9038){while(--_0x2f9038){_0x5083a6['push'](_0x5083a6['shift']());}};_0x540b54(++_0x1bb918);}(_0x8ff4,0x1b3));var _0x48ff=function(_0xf5d71c,_0x2613a6){_0xf5d71c=_0xf5d71c-0x0;var _0x5af672=_0x8ff4[_0xf5d71c];return _0x5af672;};'use strict';var express=require(_0x48ff('0x0'));var router=express['Router']();var auth=require(_0x48ff('0x1'));var controller=require(_0x48ff('0x2'));router[_0x48ff('0x3')]('/',auth[_0x48ff('0x4')](),controller['send']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 23c4dea..b66c4d5 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 _0x339a=['customfield_11504','reason','track.xcallymotion.com','POST','application/json','toString','base64','request','utf8','data','end','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','https','../../config/logger','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','Bug','customfield_11500','email','fields','oldToken','customfield_11502','name'];(function(_0x55ae30,_0x281726){var _0x17ecf0=function(_0x2fbae7){while(--_0x2fbae7){_0x55ae30['push'](_0x55ae30['shift']());}};_0x17ecf0(++_0x281726);}(_0x339a,0xce));var _0xa339=function(_0x3af714,_0x38e54f){_0x3af714=_0x3af714-0x0;var _0x38d899=_0x339a[_0x3af714];return _0x38d899;};'use strict';var BPromise=require(_0xa339('0x0'));var https=require(_0xa339('0x1'));var logger=require(_0xa339('0x2'))('api');var USERNAME=_0xa339('0x3');var PASSWORD=_0xa339('0x4');function openIssue(_0x4297f2,_0x4ffb07){var _0xeb7557={'fields':{'project':{'key':_0x4297f2[_0xa339('0x5')]||_0xa339('0x6')},'summary':(_0x4297f2[_0xa339('0x7')]||_0xa339('0x8'))+_0xa339('0x9')+_0x4297f2['ip'],'description':_0x4297f2[_0xa339('0xa')]||JSON[_0xa339('0xb')](_0x4297f2),'issuetype':{'name':_0x4297f2['issuetype']||_0xa339('0xc')}}};_0xeb7557['fields'][_0xa339('0xd')]=_0x4297f2[_0xa339('0xe')];_0xeb7557[_0xa339('0xf')]['customfield_11501']=_0x4297f2[_0xa339('0x10')];_0xeb7557['fields'][_0xa339('0x11')]=_0x4297f2['newToken'];_0xeb7557[_0xa339('0xf')]['customfield_11503']=_0x4297f2[_0xa339('0x12')];_0xeb7557['fields'][_0xa339('0x13')]=_0x4297f2[_0xa339('0x14')];_0xeb7557[_0xa339('0xf')]['customfield_10102']=_0x4297f2['ip'];var _0x4e031c={'host':_0xa339('0x15'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xa339('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0xa339('0x17'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xa339('0x18')](_0xa339('0x19'))}};var _0x4e92d3=JSON['stringify'](_0xeb7557);var _0x20b899=https[_0xa339('0x1a')](_0x4e031c,function(_0x318575){_0x318575['setEncoding'](_0xa339('0x1b'));var _0x217f24='';_0x318575['on'](_0xa339('0x1c'),function(_0x13dfb){_0x217f24+=_0x13dfb;});_0x318575['on'](_0xa339('0x1d'),function(){if(_0x4ffb07){return _0x4ffb07[_0xa339('0x1e')](_0x318575['statusCode'])[_0xa339('0x1f')](JSON[_0xa339('0x20')](_0x217f24));}});});_0x20b899['on'](_0xa339('0x21'),function(_0xf27cc){if(_0x4ffb07){return _0x4ffb07[_0xa339('0x1e')](0x1f4)[_0xa339('0x1f')]({'errors':[{'message':_0xa339('0x22'),'type':_0xa339('0x23')}]});}});_0x20b899[_0xa339('0x24')](_0x4e92d3);_0x20b899[_0xa339('0x1d')]();}exports[_0xa339('0x25')]=openIssue;exports[_0xa339('0x26')]=function(_0x214c62,_0x250c93){_0x214c62['body']['ip']=_0x214c62[_0xa339('0x27')][_0xa339('0x28')]||_0x214c62[_0xa339('0x29')][_0xa339('0x2a')]||_0x214c62[_0xa339('0x2b')][_0xa339('0x2a')]||_0x214c62[_0xa339('0x29')][_0xa339('0x2b')]['remoteAddress'];return openIssue(_0x214c62[_0xa339('0x2c')],_0x250c93);}; \ No newline at end of file +var _0xc4fa=['stringify','issuetype','Bug','customfield_11500','fields','customfield_11501','customfield_11502','customfield_11504','reason','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','setEncoding','utf8','data','end','status','statusCode','parse','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','openIssue','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','../../config/logger','api','support','key','MOTGUI','summary','\x20from\x20','description'];(function(_0x962fc5,_0x58f074){var _0x43667c=function(_0x5e6ec0){while(--_0x5e6ec0){_0x962fc5['push'](_0x962fc5['shift']());}};_0x43667c(++_0x58f074);}(_0xc4fa,0xa3));var _0xac4f=function(_0x2670ac,_0x416f90){_0x2670ac=_0x2670ac-0x0;var _0x75b69e=_0xc4fa[_0x2670ac];return _0x75b69e;};'use strict';var BPromise=require(_0xac4f('0x0'));var https=require('https');var logger=require(_0xac4f('0x1'))(_0xac4f('0x2'));var USERNAME=_0xac4f('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x10079b,_0x3ef804){var _0x879fcb={'fields':{'project':{'key':_0x10079b[_0xac4f('0x4')]||_0xac4f('0x5')},'summary':(_0x10079b[_0xac4f('0x6')]||'Report')+_0xac4f('0x7')+_0x10079b['ip'],'description':_0x10079b[_0xac4f('0x8')]||JSON[_0xac4f('0x9')](_0x10079b),'issuetype':{'name':_0x10079b[_0xac4f('0xa')]||_0xac4f('0xb')}}};_0x879fcb['fields'][_0xac4f('0xc')]=_0x10079b['email'];_0x879fcb[_0xac4f('0xd')][_0xac4f('0xe')]=_0x10079b['oldToken'];_0x879fcb[_0xac4f('0xd')][_0xac4f('0xf')]=_0x10079b['newToken'];_0x879fcb[_0xac4f('0xd')]['customfield_11503']=_0x10079b['name'];_0x879fcb['fields'][_0xac4f('0x10')]=_0x10079b[_0xac4f('0x11')];_0x879fcb['fields']['customfield_10102']=_0x10079b['ip'];var _0x31413d={'host':'track.xcallymotion.com','port':0x1bb,'path':_0xac4f('0x12'),'method':_0xac4f('0x13'),'timeout':0x4e20,'headers':{'Content-Type':_0xac4f('0x14'),'Authorization':_0xac4f('0x15')+new Buffer(USERNAME+':'+PASSWORD)[_0xac4f('0x16')](_0xac4f('0x17'))}};var _0x5e9bf0=JSON[_0xac4f('0x9')](_0x879fcb);var _0x5c9783=https['request'](_0x31413d,function(_0x2ef593){_0x2ef593[_0xac4f('0x18')](_0xac4f('0x19'));var _0x5a7cac='';_0x2ef593['on'](_0xac4f('0x1a'),function(_0x39a755){_0x5a7cac+=_0x39a755;});_0x2ef593['on'](_0xac4f('0x1b'),function(){if(_0x3ef804){return _0x3ef804[_0xac4f('0x1c')](_0x2ef593[_0xac4f('0x1d')])['json'](JSON[_0xac4f('0x1e')](_0x5a7cac));}});});_0x5c9783['on'](_0xac4f('0x1f'),function(_0x3e4702){if(_0x3ef804){return _0x3ef804[_0xac4f('0x1c')](0x1f4)[_0xac4f('0x20')]({'errors':[{'message':_0xac4f('0x21'),'type':_0xac4f('0x22')}]});}});_0x5c9783['write'](_0x5e9bf0);_0x5c9783['end']();}exports[_0xac4f('0x23')]=openIssue;exports[_0xac4f('0x24')]=function(_0x200a25,_0x5f33d5){_0x200a25[_0xac4f('0x25')]['ip']=_0x200a25[_0xac4f('0x26')][_0xac4f('0x27')]||_0x200a25[_0xac4f('0x28')]['remoteAddress']||_0x200a25[_0xac4f('0x29')][_0xac4f('0x2a')]||_0x200a25[_0xac4f('0x28')][_0xac4f('0x29')]['remoteAddress'];return openIssue(_0x200a25[_0xac4f('0x25')],_0x5f33d5);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 15bec46..969c78a 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 _0x7ddb=['../../components/auth/service','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','/:id','post','put','update','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x4a54ac,_0x1878f6){var _0x583cd8=function(_0x2679a1){while(--_0x2679a1){_0x4a54ac['push'](_0x4a54ac['shift']());}};_0x583cd8(++_0x1878f6);}(_0x7ddb,0xc7));var _0xb7dd=function(_0x31f95e,_0x39ccc1){_0x31f95e=_0x31f95e-0x0;var _0x7f698b=_0x7ddb[_0x31f95e];return _0x7f698b;};'use strict';var multer=require(_0xb7dd('0x0'));var util=require(_0xb7dd('0x1'));var path=require(_0xb7dd('0x2'));var timeout=require('connect-timeout');var express=require(_0xb7dd('0x3'));var router=express[_0xb7dd('0x4')]();var auth=require(_0xb7dd('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb7dd('0x6'));router[_0xb7dd('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb7dd('0x7')]('/describe',auth[_0xb7dd('0x8')](),controller[_0xb7dd('0x9')]);router[_0xb7dd('0x7')](_0xb7dd('0xa'),auth[_0xb7dd('0x8')](),controller['show']);router[_0xb7dd('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb7dd('0xc')](_0xb7dd('0xa'),auth['isAuthenticated'](),controller[_0xb7dd('0xd')]);router[_0xb7dd('0xe')](_0xb7dd('0xa'),auth['isAuthenticated'](),controller[_0xb7dd('0xf')]);module[_0xb7dd('0x10')]=router; \ No newline at end of file +var _0x3782=['create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post'];(function(_0x327450,_0x333d26){var _0xff3bab=function(_0x4e7a9c){while(--_0x4e7a9c){_0x327450['push'](_0x327450['shift']());}};_0xff3bab(++_0x333d26);}(_0x3782,0xec));var _0x2378=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3782[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x2378('0x0'));var path=require(_0x2378('0x1'));var timeout=require(_0x2378('0x2'));var express=require(_0x2378('0x3'));var router=express[_0x2378('0x4')]();var auth=require(_0x2378('0x5'));var interaction=require(_0x2378('0x6'));var config=require(_0x2378('0x7'));var controller=require(_0x2378('0x8'));router['get']('/',auth[_0x2378('0x9')](),controller[_0x2378('0xa')]);router[_0x2378('0xb')](_0x2378('0xc'),auth[_0x2378('0x9')](),controller[_0x2378('0xd')]);router[_0x2378('0xb')](_0x2378('0xe'),auth['isAuthenticated'](),controller[_0x2378('0xf')]);router[_0x2378('0x10')]('/',auth[_0x2378('0x9')](),controller[_0x2378('0x11')]);router[_0x2378('0x12')](_0x2378('0xe'),auth[_0x2378('0x9')](),controller[_0x2378('0x13')]);router[_0x2378('0x14')](_0x2378('0xe'),auth[_0x2378('0x9')](),controller[_0x2378('0x15')]);module[_0x2378('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 2f2f26d..28d7e11 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 _0x28f2=['TEXT','long','STRING','sequelize','exports'];(function(_0x35659e,_0x58daa8){var _0x59006f=function(_0x47e4c4){while(--_0x47e4c4){_0x35659e['push'](_0x35659e['shift']());}};_0x59006f(++_0x58daa8);}(_0x28f2,0x193));var _0x228f=function(_0x513332,_0x27ab3b){_0x513332=_0x513332-0x0;var _0x4678d4=_0x28f2[_0x513332];return _0x4678d4;};'use strict';var Sequelize=require(_0x228f('0x0'));module[_0x228f('0x1')]={'question':{'type':Sequelize[_0x228f('0x2')]},'answer':{'type':Sequelize[_0x228f('0x2')](_0x228f('0x3'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x228f('0x4')]},'queue':{'type':Sequelize[_0x228f('0x4')]},'uniqueid':{'type':Sequelize[_0x228f('0x4')]},'calleridname':{'type':Sequelize[_0x228f('0x4')]},'calleridnum':{'type':Sequelize[_0x228f('0x4')]},'questionId':{'type':Sequelize[_0x228f('0x4')]}}; \ No newline at end of file +var _0x3264=['TEXT','long','STRING','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3264,0x7f));var _0x4326=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x3264[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require('sequelize');module[_0x4326('0x0')]={'question':{'type':Sequelize[_0x4326('0x1')]},'answer':{'type':Sequelize[_0x4326('0x1')](_0x4326('0x2'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x4326('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4326('0x3')]},'questionId':{'type':Sequelize[_0x4326('0x3')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 5a9154c..8a1256c 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 _0x9423=['index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','length','hasOwnProperty','order','sort','where','type','VIRTUAL','filter','merge','JscriptyAnswerReport','count','includeAll','include','findAll','rows','params','intersection','fields','options','catch','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','reject','update','then','destroy','error','stack','name','send'];(function(_0x5c3d11,_0x589686){var _0x31e455=function(_0x251512){while(--_0x251512){_0x5c3d11['push'](_0x5c3d11['shift']());}};_0x31e455(++_0x589686);}(_0x9423,0x100));var _0x3942=function(_0x34177d,_0x4fdcf9){_0x34177d=_0x34177d-0x0;var _0x561eef=_0x9423[_0x34177d];return _0x561eef;};'use strict';var pdf=require(_0x3942('0x0'));var emlformat=require(_0x3942('0x1'));var rimraf=require(_0x3942('0x2'));var zipdir=require(_0x3942('0x3'));var jsonpatch=require(_0x3942('0x4'));var rp=require('request-promise');var moment=require(_0x3942('0x5'));var BPromise=require(_0x3942('0x6'));var Mustache=require(_0x3942('0x7'));var util=require(_0x3942('0x8'));var path=require(_0x3942('0x9'));var sox=require(_0x3942('0xa'));var csv=require(_0x3942('0xb'));var ejs=require(_0x3942('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3942('0xd'));var crypto=require('crypto');var jsforce=require(_0x3942('0xe'));var deskjs=require(_0x3942('0xf'));var toCsv=require('to-csv');var querystring=require(_0x3942('0x10'));var Papa=require(_0x3942('0x11'));var Redis=require(_0x3942('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x3942('0x13'));var as=require(_0x3942('0x14'));var hardwareService=require(_0x3942('0x15'));var logger=require('../../config/logger')(_0x3942('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3942('0x17'));var db=require(_0x3942('0x18'))['db'];function respondWithStatusCode(_0x445ed6,_0x51600c){_0x51600c=_0x51600c||0xcc;return function(_0x4ceb99){if(_0x4ceb99){return _0x445ed6[_0x3942('0x19')](_0x51600c);}return _0x445ed6[_0x3942('0x1a')](_0x51600c)[_0x3942('0x1b')]();};}function respondWithResult(_0x5dbbe4,_0xd636ee){_0xd636ee=_0xd636ee||0xc8;return function(_0x538d24){if(_0x538d24){return _0x5dbbe4[_0x3942('0x1a')](_0xd636ee)[_0x3942('0x1c')](_0x538d24);}};}function respondWithFilteredResult(_0x2b5687,_0x54f401){return function(_0x130719){if(_0x130719){var _0x47968a=_0x130719['count'],_0x50c7d8=_0x54f401[_0x3942('0x1d')],_0x38612e=_0x54f401[_0x3942('0x1d')]+_0x54f401[_0x3942('0x1e')],_0xf3cf8;if(_0x38612e>=_0x47968a){_0x38612e=_0x47968a;_0xf3cf8=0xc8;}else{_0xf3cf8=0xce;}_0x2b5687[_0x3942('0x1a')](_0xf3cf8);return _0x2b5687['set']('Content-Range',_0x50c7d8+'-'+_0x38612e+'/'+_0x47968a)[_0x3942('0x1c')](_0x130719);}return null;};}function patchUpdates(_0x4c6730){return function(_0x4d09f4){try{jsonpatch[_0x3942('0x1f')](_0x4d09f4,_0x4c6730,!![]);}catch(_0x3e193b){return BPromise[_0x3942('0x20')](_0x3e193b);}return _0x4d09f4['save']();};}function saveUpdates(_0x6aa6f3,_0x34cec5){return function(_0x4b3b8d){if(_0x4b3b8d){return _0x4b3b8d[_0x3942('0x21')](_0x6aa6f3)[_0x3942('0x22')](function(_0x3019f5){return _0x3019f5;});}return null;};}function removeEntity(_0x7ee008,_0x29f236){return function(_0x3e2b9b){if(_0x3e2b9b){return _0x3e2b9b[_0x3942('0x23')]()[_0x3942('0x22')](function(){_0x7ee008[_0x3942('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x270500,_0x2fa72f){return function(_0x9da1c4){if(!_0x9da1c4){_0x270500['sendStatus'](0x194);}return _0x9da1c4;};}function handleError(_0x24c7c7,_0x45a1e0){_0x45a1e0=_0x45a1e0||0x1f4;return function(_0x13619e){logger[_0x3942('0x24')](_0x13619e[_0x3942('0x25')]);if(_0x13619e[_0x3942('0x26')]){delete _0x13619e[_0x3942('0x26')];}_0x24c7c7['status'](_0x45a1e0)[_0x3942('0x27')](_0x13619e);};}exports[_0x3942('0x28')]=function(_0x53af80,_0x2549d1){var _0x57bad5={},_0x32a90f={},_0x1063e9={'count':0x0,'rows':[]};var _0x2896cc=_[_0x3942('0x29')](db['JscriptyAnswerReport'][_0x3942('0x2a')],function(_0x226c6a){return{'name':_0x226c6a[_0x3942('0x2b')],'type':_0x226c6a['type'][_0x3942('0x2c')]};});_0x32a90f[_0x3942('0x2d')]=_[_0x3942('0x29')](_0x2896cc,'name');_0x32a90f[_0x3942('0x2e')]=_[_0x3942('0x2f')](_0x53af80[_0x3942('0x2e')]);_0x32a90f[_0x3942('0x30')]=_['intersection'](_0x32a90f[_0x3942('0x2d')],_0x32a90f[_0x3942('0x2e')]);_0x57bad5[_0x3942('0x31')]=_['intersection'](_0x32a90f[_0x3942('0x2d')],qs['fields'](_0x53af80[_0x3942('0x2e')]['fields']));_0x57bad5[_0x3942('0x31')]=_0x57bad5[_0x3942('0x31')][_0x3942('0x32')]?_0x57bad5[_0x3942('0x31')]:_0x32a90f[_0x3942('0x2d')];if(!_0x53af80[_0x3942('0x2e')][_0x3942('0x33')]('nolimit')){_0x57bad5[_0x3942('0x1e')]=qs[_0x3942('0x1e')](_0x53af80['query'][_0x3942('0x1e')]);_0x57bad5[_0x3942('0x1d')]=qs[_0x3942('0x1d')](_0x53af80['query'][_0x3942('0x1d')]);}_0x57bad5[_0x3942('0x34')]=qs[_0x3942('0x35')](_0x53af80['query'][_0x3942('0x35')]);_0x57bad5[_0x3942('0x36')]=qs[_0x3942('0x30')](_['pick'](_0x53af80[_0x3942('0x2e')],_0x32a90f['filters']),_0x2896cc);if(_0x53af80[_0x3942('0x2e')]['filter']){_0x57bad5[_0x3942('0x36')]=_['merge'](_0x57bad5[_0x3942('0x36')],{'$or':_[_0x3942('0x29')](_0x2896cc,function(_0x2468f7){if(_0x2468f7[_0x3942('0x37')]!==_0x3942('0x38')){var _0x4c1c6d={};_0x4c1c6d[_0x2468f7[_0x3942('0x26')]]={'$like':'%'+_0x53af80[_0x3942('0x2e')][_0x3942('0x39')]+'%'};return _0x4c1c6d;}})});}_0x57bad5=_[_0x3942('0x3a')]({},_0x57bad5,_0x53af80['options']);var _0x3bd39d={'where':_0x57bad5[_0x3942('0x36')]};return db[_0x3942('0x3b')][_0x3942('0x3c')](_0x3bd39d)[_0x3942('0x22')](function(_0x185eb7){_0x1063e9[_0x3942('0x3c')]=_0x185eb7;if(_0x53af80[_0x3942('0x2e')][_0x3942('0x3d')]){_0x57bad5[_0x3942('0x3e')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x3942('0x3f')](_0x57bad5);})['then'](function(_0x512ba4){_0x1063e9[_0x3942('0x40')]=_0x512ba4;return _0x1063e9;})[_0x3942('0x22')](respondWithFilteredResult(_0x2549d1,_0x57bad5))['catch'](handleError(_0x2549d1,null));};exports['show']=function(_0x512dfa,_0x5967d6){var _0x1aec71={'raw':!![],'where':{'id':_0x512dfa[_0x3942('0x41')]['id']}},_0x697a85={};_0x697a85[_0x3942('0x2d')]=_['keys'](db[_0x3942('0x3b')][_0x3942('0x2a')]);_0x697a85[_0x3942('0x2e')]=_[_0x3942('0x2f')](_0x512dfa['query']);_0x697a85['filters']=_[_0x3942('0x42')](_0x697a85[_0x3942('0x2d')],_0x697a85[_0x3942('0x2e')]);_0x1aec71['attributes']=_[_0x3942('0x42')](_0x697a85[_0x3942('0x2d')],qs[_0x3942('0x43')](_0x512dfa[_0x3942('0x2e')]['fields']));_0x1aec71[_0x3942('0x31')]=_0x1aec71['attributes'][_0x3942('0x32')]?_0x1aec71[_0x3942('0x31')]:_0x697a85[_0x3942('0x2d')];if(_0x512dfa['query']['includeAll']){_0x1aec71[_0x3942('0x3e')]=[{'all':!![]}];}_0x1aec71=_[_0x3942('0x3a')]({},_0x1aec71,_0x512dfa[_0x3942('0x44')]);return db['JscriptyAnswerReport']['find'](_0x1aec71)[_0x3942('0x22')](handleEntityNotFound(_0x5967d6,null))[_0x3942('0x22')](respondWithResult(_0x5967d6,null))[_0x3942('0x45')](handleError(_0x5967d6,null));};exports['create']=function(_0x24fa3d,_0x6b5f11){return db[_0x3942('0x3b')][_0x3942('0x46')](_0x24fa3d[_0x3942('0x47')],{})['then'](respondWithResult(_0x6b5f11,0xc9))[_0x3942('0x45')](handleError(_0x6b5f11,null));};exports['update']=function(_0x59d4ce,_0x4604ff){if(_0x59d4ce[_0x3942('0x47')]['id']){delete _0x59d4ce['body']['id'];}return db['JscriptyAnswerReport'][_0x3942('0x48')]({'where':{'id':_0x59d4ce['params']['id']}})['then'](handleEntityNotFound(_0x4604ff,null))[_0x3942('0x22')](saveUpdates(_0x59d4ce[_0x3942('0x47')],null))[_0x3942('0x22')](respondWithResult(_0x4604ff,null))[_0x3942('0x45')](handleError(_0x4604ff,null));};exports[_0x3942('0x23')]=function(_0x4a669e,_0x41e8b8){return db['JscriptyAnswerReport'][_0x3942('0x48')]({'where':{'id':_0x4a669e[_0x3942('0x41')]['id']}})[_0x3942('0x22')](handleEntityNotFound(_0x41e8b8,null))[_0x3942('0x22')](removeEntity(_0x41e8b8,null))[_0x3942('0x45')](handleError(_0x41e8b8,null));};exports[_0x3942('0x49')]=function(_0x3a965c,_0x1e6160){return db[_0x3942('0x3b')][_0x3942('0x49')]()[_0x3942('0x22')](respondWithResult(_0x1e6160,null))[_0x3942('0x45')](handleError(_0x1e6160,null));}; \ No newline at end of file +var _0x4bee=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','map','JscriptyAnswerReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','type','VIRTUAL','include','rows','catch','show','params','includeAll','find','create','body','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4bee,0x1eb));var _0xe4be=function(_0x3cb3ca,_0x44d697){_0x3cb3ca=_0x3cb3ca-0x0;var _0x214366=_0x4bee[_0x3cb3ca];return _0x214366;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe4be('0x0'));var rimraf=require(_0xe4be('0x1'));var zipdir=require(_0xe4be('0x2'));var jsonpatch=require(_0xe4be('0x3'));var rp=require(_0xe4be('0x4'));var moment=require(_0xe4be('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe4be('0x6'));var util=require('util');var path=require(_0xe4be('0x7'));var sox=require(_0xe4be('0x8'));var csv=require(_0xe4be('0x9'));var ejs=require(_0xe4be('0xa'));var fs=require('fs');var _=require(_0xe4be('0xb'));var squel=require(_0xe4be('0xc'));var crypto=require('crypto');var jsforce=require(_0xe4be('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe4be('0xe'));var Papa=require('papaparse');var Redis=require(_0xe4be('0xf'));var authService=require(_0xe4be('0x10'));var qs=require(_0xe4be('0x11'));var as=require(_0xe4be('0x12'));var hardwareService=require(_0xe4be('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xe4be('0x14'));var config=require(_0xe4be('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cac3a,_0x59817c){_0x59817c=_0x59817c||0xcc;return function(_0x99e3ef){if(_0x99e3ef){return _0x3cac3a[_0xe4be('0x16')](_0x59817c);}return _0x3cac3a[_0xe4be('0x17')](_0x59817c)[_0xe4be('0x18')]();};}function respondWithResult(_0x286c5b,_0x49495b){_0x49495b=_0x49495b||0xc8;return function(_0x4f0ade){if(_0x4f0ade){return _0x286c5b[_0xe4be('0x17')](_0x49495b)[_0xe4be('0x19')](_0x4f0ade);}};}function respondWithFilteredResult(_0x5b8c16,_0x39347a){return function(_0x1b224a){if(_0x1b224a){var _0x503873=_0x1b224a[_0xe4be('0x1a')],_0x1e9187=_0x39347a[_0xe4be('0x1b')],_0x46d7a0=_0x39347a['offset']+_0x39347a[_0xe4be('0x1c')],_0x30d4e8;if(_0x46d7a0>=_0x503873){_0x46d7a0=_0x503873;_0x30d4e8=0xc8;}else{_0x30d4e8=0xce;}_0x5b8c16['status'](_0x30d4e8);return _0x5b8c16[_0xe4be('0x1d')](_0xe4be('0x1e'),_0x1e9187+'-'+_0x46d7a0+'/'+_0x503873)[_0xe4be('0x19')](_0x1b224a);}return null;};}function patchUpdates(_0xdc1a6){return function(_0x29bb1a){try{jsonpatch[_0xe4be('0x1f')](_0x29bb1a,_0xdc1a6,!![]);}catch(_0x494641){return BPromise[_0xe4be('0x20')](_0x494641);}return _0x29bb1a['save']();};}function saveUpdates(_0x3318cc,_0x2d292c){return function(_0x43a74e){if(_0x43a74e){return _0x43a74e['update'](_0x3318cc)[_0xe4be('0x21')](function(_0x3ce9cc){return _0x3ce9cc;});}return null;};}function removeEntity(_0x53d489,_0x2061ee){return function(_0x4c8cfc){if(_0x4c8cfc){return _0x4c8cfc[_0xe4be('0x22')]()[_0xe4be('0x21')](function(){_0x53d489[_0xe4be('0x17')](0xcc)[_0xe4be('0x18')]();});}};}function handleEntityNotFound(_0x175daa,_0x558ed2){return function(_0x22f16e){if(!_0x22f16e){_0x175daa[_0xe4be('0x16')](0x194);}return _0x22f16e;};}function handleError(_0x532768,_0x14325c){_0x14325c=_0x14325c||0x1f4;return function(_0x1e0186){logger[_0xe4be('0x23')](_0x1e0186[_0xe4be('0x24')]);if(_0x1e0186[_0xe4be('0x25')]){delete _0x1e0186[_0xe4be('0x25')];}_0x532768[_0xe4be('0x17')](_0x14325c)[_0xe4be('0x26')](_0x1e0186);};}exports['index']=function(_0x110317,_0x5549b7){var _0x29fd13={},_0xdc178e={},_0x216b57={'count':0x0,'rows':[]};var _0x24016e=_[_0xe4be('0x27')](db[_0xe4be('0x28')][_0xe4be('0x29')],function(_0x8e8b67){return{'name':_0x8e8b67[_0xe4be('0x2a')],'type':_0x8e8b67['type'][_0xe4be('0x2b')]};});_0xdc178e[_0xe4be('0x2c')]=_['map'](_0x24016e,_0xe4be('0x25'));_0xdc178e['query']=_[_0xe4be('0x2d')](_0x110317[_0xe4be('0x2e')]);_0xdc178e[_0xe4be('0x2f')]=_[_0xe4be('0x30')](_0xdc178e[_0xe4be('0x2c')],_0xdc178e[_0xe4be('0x2e')]);_0x29fd13['attributes']=_[_0xe4be('0x30')](_0xdc178e['model'],qs[_0xe4be('0x31')](_0x110317[_0xe4be('0x2e')]['fields']));_0x29fd13[_0xe4be('0x32')]=_0x29fd13[_0xe4be('0x32')][_0xe4be('0x33')]?_0x29fd13['attributes']:_0xdc178e['model'];if(!_0x110317['query']['hasOwnProperty'](_0xe4be('0x34'))){_0x29fd13[_0xe4be('0x1c')]=qs[_0xe4be('0x1c')](_0x110317[_0xe4be('0x2e')][_0xe4be('0x1c')]);_0x29fd13[_0xe4be('0x1b')]=qs['offset'](_0x110317['query'][_0xe4be('0x1b')]);}_0x29fd13[_0xe4be('0x35')]=qs[_0xe4be('0x36')](_0x110317[_0xe4be('0x2e')][_0xe4be('0x36')]);_0x29fd13[_0xe4be('0x37')]=qs['filters'](_['pick'](_0x110317['query'],_0xdc178e[_0xe4be('0x2f')]),_0x24016e);if(_0x110317['query'][_0xe4be('0x38')]){_0x29fd13['where']=_['merge'](_0x29fd13[_0xe4be('0x37')],{'$or':_['map'](_0x24016e,function(_0x3a4545){if(_0x3a4545[_0xe4be('0x39')]!==_0xe4be('0x3a')){var _0x3566ab={};_0x3566ab[_0x3a4545[_0xe4be('0x25')]]={'$like':'%'+_0x110317[_0xe4be('0x2e')]['filter']+'%'};return _0x3566ab;}})});}_0x29fd13=_['merge']({},_0x29fd13,_0x110317['options']);var _0x7717d9={'where':_0x29fd13['where']};return db[_0xe4be('0x28')][_0xe4be('0x1a')](_0x7717d9)[_0xe4be('0x21')](function(_0x27d245){_0x216b57['count']=_0x27d245;if(_0x110317[_0xe4be('0x2e')]['includeAll']){_0x29fd13[_0xe4be('0x3b')]=[{'all':!![]}];}return db[_0xe4be('0x28')]['findAll'](_0x29fd13);})[_0xe4be('0x21')](function(_0x38872e){_0x216b57[_0xe4be('0x3c')]=_0x38872e;return _0x216b57;})[_0xe4be('0x21')](respondWithFilteredResult(_0x5549b7,_0x29fd13))[_0xe4be('0x3d')](handleError(_0x5549b7,null));};exports[_0xe4be('0x3e')]=function(_0x55a9c1,_0x11a323){var _0x2f5470={'raw':!![],'where':{'id':_0x55a9c1[_0xe4be('0x3f')]['id']}},_0x212896={};_0x212896[_0xe4be('0x2c')]=_[_0xe4be('0x2d')](db[_0xe4be('0x28')][_0xe4be('0x29')]);_0x212896[_0xe4be('0x2e')]=_['keys'](_0x55a9c1[_0xe4be('0x2e')]);_0x212896[_0xe4be('0x2f')]=_[_0xe4be('0x30')](_0x212896[_0xe4be('0x2c')],_0x212896[_0xe4be('0x2e')]);_0x2f5470[_0xe4be('0x32')]=_['intersection'](_0x212896[_0xe4be('0x2c')],qs[_0xe4be('0x31')](_0x55a9c1[_0xe4be('0x2e')][_0xe4be('0x31')]));_0x2f5470['attributes']=_0x2f5470[_0xe4be('0x32')][_0xe4be('0x33')]?_0x2f5470['attributes']:_0x212896['model'];if(_0x55a9c1['query'][_0xe4be('0x40')]){_0x2f5470[_0xe4be('0x3b')]=[{'all':!![]}];}_0x2f5470=_['merge']({},_0x2f5470,_0x55a9c1['options']);return db[_0xe4be('0x28')][_0xe4be('0x41')](_0x2f5470)[_0xe4be('0x21')](handleEntityNotFound(_0x11a323,null))[_0xe4be('0x21')](respondWithResult(_0x11a323,null))['catch'](handleError(_0x11a323,null));};exports[_0xe4be('0x42')]=function(_0x5e01f5,_0x10c0e1){return db[_0xe4be('0x28')][_0xe4be('0x42')](_0x5e01f5[_0xe4be('0x43')],{})[_0xe4be('0x21')](respondWithResult(_0x10c0e1,0xc9))[_0xe4be('0x3d')](handleError(_0x10c0e1,null));};exports[_0xe4be('0x44')]=function(_0x452cc6,_0x1b029c){if(_0x452cc6[_0xe4be('0x43')]['id']){delete _0x452cc6[_0xe4be('0x43')]['id'];}return db[_0xe4be('0x28')][_0xe4be('0x41')]({'where':{'id':_0x452cc6['params']['id']}})[_0xe4be('0x21')](handleEntityNotFound(_0x1b029c,null))[_0xe4be('0x21')](saveUpdates(_0x452cc6[_0xe4be('0x43')],null))[_0xe4be('0x21')](respondWithResult(_0x1b029c,null))[_0xe4be('0x3d')](handleError(_0x1b029c,null));};exports['destroy']=function(_0x1642d5,_0x221458){return db[_0xe4be('0x28')][_0xe4be('0x41')]({'where':{'id':_0x1642d5['params']['id']}})['then'](handleEntityNotFound(_0x221458,null))['then'](removeEntity(_0x221458,null))[_0xe4be('0x3d')](handleError(_0x221458,null));};exports[_0xe4be('0x45')]=function(_0x5d5579,_0x2ef1df){return db['JscriptyAnswerReport']['describe']()[_0xe4be('0x21')](respondWithResult(_0x2ef1df,null))['catch'](handleError(_0x2ef1df,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 0f55a17..4623b74 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 _0x47fb=['bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','lodash','../../config/logger','moment'];(function(_0x273006,_0x2fac38){var _0xfb0637=function(_0x31c1e3){while(--_0x31c1e3){_0x273006['push'](_0x273006['shift']());}};_0xfb0637(++_0x2fac38);}(_0x47fb,0x1cb));var _0xb47f=function(_0x423adf,_0x120823){_0x423adf=_0x423adf-0x0;var _0x5c5f14=_0x47fb[_0x423adf];return _0x5c5f14;};'use strict';var _=require(_0xb47f('0x0'));var util=require('util');var logger=require(_0xb47f('0x1'))('api');var moment=require(_0xb47f('0x2'));var BPromise=require(_0xb47f('0x3'));var rp=require(_0xb47f('0x4'));var fs=require('fs');var path=require(_0xb47f('0x5'));var rimraf=require('rimraf');var config=require(_0xb47f('0x6'));var attributes=require(_0xb47f('0x7'));module[_0xb47f('0x8')]=function(_0x314890,_0xac1305){return _0x314890[_0xb47f('0x9')](_0xb47f('0xa'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x556b=['api','moment','bluebird','path','rimraf','define','JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger'];(function(_0x2491e1,_0x22b4ea){var _0x4dd72f=function(_0x5e7e7e){while(--_0x5e7e7e){_0x2491e1['push'](_0x2491e1['shift']());}};_0x4dd72f(++_0x22b4ea);}(_0x556b,0x1f2));var _0xb556=function(_0x599109,_0x431311){_0x599109=_0x599109-0x0;var _0x3be269=_0x556b[_0x599109];return _0x3be269;};'use strict';var _=require(_0xb556('0x0'));var util=require('util');var logger=require(_0xb556('0x1'))(_0xb556('0x2'));var moment=require(_0xb556('0x3'));var BPromise=require(_0xb556('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb556('0x5'));var rimraf=require(_0xb556('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x2149a3,_0x404190){return _0x2149a3[_0xb556('0x7')](_0xb556('0x8'),attributes,{'tableName':_0xb556('0x9'),'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 7fb0165..94ca807 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 _0x1411=['moment','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x380a3f,_0x202483){var _0x2b4eca=function(_0x1e99b2){while(--_0x1e99b2){_0x380a3f['push'](_0x380a3f['shift']());}};_0x2b4eca(++_0x202483);}(_0x1411,0x12b));var _0x1141=function(_0x13eaae,_0x11ec0a){_0x13eaae=_0x13eaae-0x0;var _0x4493db=_0x1411[_0x13eaae];return _0x4493db;};'use strict';var _=require(_0x1141('0x0'));var util=require('util');var moment=require(_0x1141('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1141('0x2'));var db=require(_0x1141('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1141('0x4'))(_0x1141('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1141('0x6')][_0x1141('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x179985,_0x536b37,_0x4b89e8){return new BPromise(function(_0x42ddf1,_0x222976){return client[_0x1141('0x8')](_0x179985,_0x4b89e8)[_0x1141('0x9')](function(_0x272972){logger[_0x1141('0xa')](_0x1141('0xb'),_0x536b37,'request\x20sent');logger[_0x1141('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x536b37,_0x1141('0xd'),JSON[_0x1141('0xe')](_0x272972));if(_0x272972[_0x1141('0xf')]){if(_0x272972[_0x1141('0xf')][_0x1141('0x10')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x536b37,_0x272972[_0x1141('0xf')]['message']);return _0x222976(_0x272972[_0x1141('0xf')][_0x1141('0x11')]);}logger[_0x1141('0xf')](_0x1141('0xb'),_0x536b37,_0x272972[_0x1141('0xf')][_0x1141('0x11')]);return _0x42ddf1(_0x272972['error'][_0x1141('0x11')]);}else{logger['info'](_0x1141('0xb'),_0x536b37,_0x1141('0xd'));_0x42ddf1(_0x272972[_0x1141('0x12')][_0x1141('0x11')]);}})[_0x1141('0x13')](function(_0xe216fb){logger['error'](_0x1141('0xb'),_0x536b37,_0xe216fb);_0x222976(_0xe216fb);});});} \ No newline at end of file +var _0xc7f9=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','bluebird','randomstring'];(function(_0x9ce29c,_0x1a84d5){var _0x5743a0=function(_0x47783e){while(--_0x47783e){_0x9ce29c['push'](_0x9ce29c['shift']());}};_0x5743a0(++_0x1a84d5);}(_0xc7f9,0xb1));var _0x9c7f=function(_0x52a658,_0x17ed4c){_0x52a658=_0x52a658-0x0;var _0x4f53ce=_0xc7f9[_0x52a658];return _0x4f53ce;};'use strict';var _=require(_0x9c7f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9c7f('0x1'));var rs=require(_0x9c7f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c7f('0x3'))['db'];var utils=require(_0x9c7f('0x4'));var logger=require(_0x9c7f('0x5'))('rpc');var config=require(_0x9c7f('0x6'));var jayson=require(_0x9c7f('0x7'));var client=jayson['client'][_0x9c7f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ebaf6,_0xa0d9ff,_0x3bac9b){return new BPromise(function(_0x2c3fe5,_0x3d5436){return client['request'](_0x3ebaf6,_0x3bac9b)[_0x9c7f('0x9')](function(_0xaa2608){logger[_0x9c7f('0xa')](_0x9c7f('0xb'),_0xa0d9ff,'request\x20sent');logger[_0x9c7f('0xc')](_0x9c7f('0xd'),_0xa0d9ff,_0x9c7f('0xe'),JSON['stringify'](_0xaa2608));if(_0xaa2608[_0x9c7f('0xf')]){if(_0xaa2608[_0x9c7f('0xf')][_0x9c7f('0x10')]===0x1f4){logger['error'](_0x9c7f('0xb'),_0xa0d9ff,_0xaa2608[_0x9c7f('0xf')][_0x9c7f('0x11')]);return _0x3d5436(_0xaa2608[_0x9c7f('0xf')][_0x9c7f('0x11')]);}logger[_0x9c7f('0xf')](_0x9c7f('0xb'),_0xa0d9ff,_0xaa2608['error']['message']);return _0x2c3fe5(_0xaa2608[_0x9c7f('0xf')][_0x9c7f('0x11')]);}else{logger[_0x9c7f('0xa')](_0x9c7f('0xb'),_0xa0d9ff,_0x9c7f('0xe'));_0x2c3fe5(_0xaa2608[_0x9c7f('0x12')][_0x9c7f('0x11')]);}})[_0x9c7f('0x13')](function(_0x8e6e2f){logger[_0x9c7f('0xf')](_0x9c7f('0xb'),_0xa0d9ff,_0x8e6e2f);_0x3d5436(_0x8e6e2f);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 57317e6..94e5a6a 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 _0xba96=['/:id/summary','30s','getSummary','post','create','/:id/clone','put','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','show','getSessions','/:id/answers','isAuthenticated','getAnswers'];(function(_0xc8e8aa,_0x500acd){var _0x13bb8d=function(_0x1b4e71){while(--_0x1b4e71){_0xc8e8aa['push'](_0xc8e8aa['shift']());}};_0x13bb8d(++_0x500acd);}(_0xba96,0xeb));var _0x6ba9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xba96[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x6ba9('0x0'));var util=require(_0x6ba9('0x1'));var path=require('path');var timeout=require(_0x6ba9('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x6ba9('0x3'));var interaction=require(_0x6ba9('0x4'));var config=require(_0x6ba9('0x5'));var controller=require(_0x6ba9('0x6'));router[_0x6ba9('0x7')]('/',auth['isAuthenticated'](),controller[_0x6ba9('0x8')]);router[_0x6ba9('0x7')](_0x6ba9('0x9'),auth['isAuthenticated'](),controller[_0x6ba9('0xa')]);router[_0x6ba9('0x7')]('/:id/sessions',auth['isAuthenticated'](),controller[_0x6ba9('0xb')]);router[_0x6ba9('0x7')](_0x6ba9('0xc'),auth[_0x6ba9('0xd')](),controller[_0x6ba9('0xe')]);router[_0x6ba9('0x7')](_0x6ba9('0xf'),auth['isAuthenticated'](),timeout(_0x6ba9('0x10')),controller[_0x6ba9('0x11')]);router[_0x6ba9('0x12')]('/',auth[_0x6ba9('0xd')](),controller[_0x6ba9('0x13')]);router[_0x6ba9('0x12')](_0x6ba9('0x14'),auth[_0x6ba9('0xd')](),controller['clone']);router[_0x6ba9('0x15')](_0x6ba9('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x6ba9('0x16')](_0x6ba9('0x9'),auth[_0x6ba9('0xd')](),controller[_0x6ba9('0x17')]);module[_0x6ba9('0x18')]=router; \ No newline at end of file +var _0x28fe=['getAnswers','30s','getSummary','post','create','clone','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','/:id/sessions','getSessions','/:id/answers'];(function(_0x5a6877,_0x5d2385){var _0x26a784=function(_0x3eb0df){while(--_0x3eb0df){_0x5a6877['push'](_0x5a6877['shift']());}};_0x26a784(++_0x5d2385);}(_0x28fe,0x7e));var _0xe28f=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x28fe[_0x36ed3c];return _0x52a2e0;};'use strict';var multer=require(_0xe28f('0x0'));var util=require(_0xe28f('0x1'));var path=require(_0xe28f('0x2'));var timeout=require(_0xe28f('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xe28f('0x4'));var interaction=require(_0xe28f('0x5'));var config=require('../../config/environment');var controller=require('./jscriptyProject.controller');router[_0xe28f('0x6')]('/',auth['isAuthenticated'](),controller[_0xe28f('0x7')]);router[_0xe28f('0x6')]('/:id',auth[_0xe28f('0x8')](),controller['show']);router[_0xe28f('0x6')](_0xe28f('0x9'),auth[_0xe28f('0x8')](),controller[_0xe28f('0xa')]);router[_0xe28f('0x6')](_0xe28f('0xb'),auth['isAuthenticated'](),controller[_0xe28f('0xc')]);router[_0xe28f('0x6')]('/:id/summary',auth[_0xe28f('0x8')](),timeout(_0xe28f('0xd')),controller[_0xe28f('0xe')]);router[_0xe28f('0xf')]('/',auth[_0xe28f('0x8')](),controller[_0xe28f('0x10')]);router[_0xe28f('0xf')]('/:id/clone',auth[_0xe28f('0x8')](),controller[_0xe28f('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xe28f('0x12')]);router[_0xe28f('0x13')](_0xe28f('0x14'),auth['isAuthenticated'](),controller[_0xe28f('0x15')]);module[_0xe28f('0x16')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index e34ddb1..b2d71cf 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 _0x9f6f=['TEXT','long','isObjectLike','stringify','isString','setDataValue','formData','format','getDataValue','description','BOOLEAN','sequelize','util','exports','STRING','name'];(function(_0x35b47f,_0x45f028){var _0x393abb=function(_0x1cebf2){while(--_0x1cebf2){_0x35b47f['push'](_0x35b47f['shift']());}};_0x393abb(++_0x45f028);}(_0x9f6f,0x1db));var _0xf9f6=function(_0x201a17,_0x5241f0){_0x201a17=_0x201a17-0x0;var _0x1c13a0=_0x9f6f[_0x201a17];return _0x1c13a0;};'use strict';var Sequelize=require(_0xf9f6('0x0'));var _=require('lodash');var util=require(_0xf9f6('0x1'));module[_0xf9f6('0x2')]={'name':{'type':Sequelize[_0xf9f6('0x3')],'unique':_0xf9f6('0x4')},'description':{'type':Sequelize[_0xf9f6('0x3')]},'formData':{'type':Sequelize[_0xf9f6('0x5')](_0xf9f6('0x6')),'set':function(_0x4ce5d9){if(_[_0xf9f6('0x7')](_0x4ce5d9)){this['setDataValue']('formData',JSON[_0xf9f6('0x8')](_0x4ce5d9));}else if(_[_0xf9f6('0x9')](_0x4ce5d9)){this[_0xf9f6('0xa')](_0xf9f6('0xb'),_0x4ce5d9);}else{this[_0xf9f6('0xa')](_0xf9f6('0xb'),util[_0xf9f6('0xc')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xf9f6('0xd')](_0xf9f6('0x4'))||'',this[_0xf9f6('0xd')](_0xf9f6('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xf9f6('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0xa92e=['getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x15d97b,_0x45db62){var _0x4fa9ff=function(_0x442a9b){while(--_0x442a9b){_0x15d97b['push'](_0x15d97b['shift']());}};_0x4fa9ff(++_0x45db62);}(_0xa92e,0x1ce));var _0xea92=function(_0x585c00,_0x543bee){_0x585c00=_0x585c00-0x0;var _0x306546=_0xa92e[_0x585c00];return _0x306546;};'use strict';var Sequelize=require(_0xea92('0x0'));var _=require(_0xea92('0x1'));var util=require(_0xea92('0x2'));module[_0xea92('0x3')]={'name':{'type':Sequelize[_0xea92('0x4')],'unique':_0xea92('0x5')},'description':{'type':Sequelize[_0xea92('0x4')]},'formData':{'type':Sequelize[_0xea92('0x6')](_0xea92('0x7')),'set':function(_0x3f8303){if(_[_0xea92('0x8')](_0x3f8303)){this[_0xea92('0x9')](_0xea92('0xa'),JSON[_0xea92('0xb')](_0x3f8303));}else if(_['isString'](_0x3f8303)){this['setDataValue']('formData',_0x3f8303);}else{this[_0xea92('0x9')](_0xea92('0xa'),util[_0xea92('0xc')](_0xea92('0xd'),this[_0xea92('0xe')](_0xea92('0x5'))||'',this[_0xea92('0xe')](_0xea92('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xea92('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xea92('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index f936273..b7a7402 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 _0x39a2=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','set','Content-Range','reject','save','update','then','destroy','Projects','UserProfileResource','end','error','stack','name','send','index','map','JscriptyProject','fieldName','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','user','get','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','fields','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','getSessions','findOne','pick','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','fromCharCode','apply','indexOf','toString','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','format','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x366e61,_0x2a6041){var _0x1b0afb=function(_0x2c3178){while(--_0x2c3178){_0x366e61['push'](_0x366e61['shift']());}};_0x1b0afb(++_0x2a6041);}(_0x39a2,0x1d4));var _0x239a=function(_0x5a5276,_0x262d69){_0x5a5276=_0x5a5276-0x0;var _0x3e8ee2=_0x39a2[_0x5a5276];return _0x3e8ee2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x239a('0x0'));var rimraf=require(_0x239a('0x1'));var zipdir=require(_0x239a('0x2'));var jsonpatch=require(_0x239a('0x3'));var rp=require(_0x239a('0x4'));var moment=require(_0x239a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x239a('0x6'));var path=require('path');var sox=require(_0x239a('0x7'));var csv=require(_0x239a('0x8'));var ejs=require(_0x239a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x239a('0xa'));var crypto=require(_0x239a('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x239a('0x8'));var querystring=require(_0x239a('0xc'));var Papa=require('papaparse');var Redis=require(_0x239a('0xd'));var authService=require(_0x239a('0xe'));var qs=require(_0x239a('0xf'));var as=require(_0x239a('0x10'));var hardwareService=require(_0x239a('0x11'));var logger=require(_0x239a('0x12'))(_0x239a('0x13'));var utils=require(_0x239a('0x14'));var config=require(_0x239a('0x15'));var licenseUtil=require(_0x239a('0x16'));var db=require(_0x239a('0x17'))['db'];function respondWithStatusCode(_0x2a2433,_0x405c4d){_0x405c4d=_0x405c4d||0xcc;return function(_0x2ea9d2){if(_0x2ea9d2){return _0x2a2433[_0x239a('0x18')](_0x405c4d);}return _0x2a2433[_0x239a('0x19')](_0x405c4d)['end']();};}function respondWithResult(_0x128247,_0x57b7c7){_0x57b7c7=_0x57b7c7||0xc8;return function(_0x5b0898){if(_0x5b0898){return _0x128247[_0x239a('0x19')](_0x57b7c7)[_0x239a('0x1a')](_0x5b0898);}};}function respondWithFilteredResult(_0x32101b,_0x4c30d7){return function(_0x5534e7){if(_0x5534e7){var _0x36d3b9=_0x5534e7['count'],_0x2d9086=_0x4c30d7[_0x239a('0x1b')],_0x10c74e=_0x4c30d7[_0x239a('0x1b')]+_0x4c30d7['limit'],_0x3089bc;if(_0x10c74e>=_0x36d3b9){_0x10c74e=_0x36d3b9;_0x3089bc=0xc8;}else{_0x3089bc=0xce;}_0x32101b[_0x239a('0x19')](_0x3089bc);return _0x32101b[_0x239a('0x1c')](_0x239a('0x1d'),_0x2d9086+'-'+_0x10c74e+'/'+_0x36d3b9)['json'](_0x5534e7);}return null;};}function patchUpdates(_0x4d9e22){return function(_0x354c85){try{jsonpatch['apply'](_0x354c85,_0x4d9e22,!![]);}catch(_0x31e3b6){return BPromise[_0x239a('0x1e')](_0x31e3b6);}return _0x354c85[_0x239a('0x1f')]();};}function saveUpdates(_0x23d535,_0x29fc15){return function(_0x405c01){if(_0x405c01){return _0x405c01[_0x239a('0x20')](_0x23d535)[_0x239a('0x21')](function(_0x67b4be){return _0x67b4be;});}return null;};}function removeEntity(_0x31b3ea,_0x2886c9){return function(_0x26aa53){if(_0x26aa53){return _0x26aa53[_0x239a('0x22')]()[_0x239a('0x21')](function(){var _0xe17bd2=_0x26aa53['get']({'plain':!![]});var _0x1b9aa6=_0x239a('0x23');return db[_0x239a('0x24')][_0x239a('0x22')]({'where':{'type':_0x1b9aa6,'resourceId':_0xe17bd2['id']}})[_0x239a('0x21')](function(){return _0x26aa53;});})[_0x239a('0x21')](function(){_0x31b3ea[_0x239a('0x19')](0xcc)[_0x239a('0x25')]();});}};}function handleEntityNotFound(_0x2030a9,_0x5a2518){return function(_0x3fca4e){if(!_0x3fca4e){_0x2030a9[_0x239a('0x18')](0x194);}return _0x3fca4e;};}function handleError(_0xcf9dbc,_0x18ea5c){_0x18ea5c=_0x18ea5c||0x1f4;return function(_0x525508){logger[_0x239a('0x26')](_0x525508[_0x239a('0x27')]);if(_0x525508[_0x239a('0x28')]){delete _0x525508[_0x239a('0x28')];}_0xcf9dbc[_0x239a('0x19')](_0x18ea5c)[_0x239a('0x29')](_0x525508);};}exports[_0x239a('0x2a')]=function(_0x3b9a16,_0x338b07){var _0x56ea8c={},_0xeee3c2={},_0x37817e={'count':0x0,'rows':[]};var _0xc6bff2=_[_0x239a('0x2b')](db[_0x239a('0x2c')]['rawAttributes'],function(_0x4b996b){return{'name':_0x4b996b[_0x239a('0x2d')],'type':_0x4b996b[_0x239a('0x2e')]['key']};});_0xeee3c2[_0x239a('0x2f')]=_[_0x239a('0x2b')](_0xc6bff2,_0x239a('0x28'));_0xeee3c2[_0x239a('0x30')]=_['keys'](_0x3b9a16[_0x239a('0x30')]);_0xeee3c2[_0x239a('0x31')]=_[_0x239a('0x32')](_0xeee3c2['model'],_0xeee3c2[_0x239a('0x30')]);_0x56ea8c['attributes']=_[_0x239a('0x32')](_0xeee3c2[_0x239a('0x2f')],qs['fields'](_0x3b9a16['query']['fields']));_0x56ea8c[_0x239a('0x33')]=_0x56ea8c[_0x239a('0x33')][_0x239a('0x34')]?_0x56ea8c[_0x239a('0x33')]:_0xeee3c2[_0x239a('0x2f')];if(!_0x3b9a16[_0x239a('0x30')][_0x239a('0x35')](_0x239a('0x36'))){_0x56ea8c[_0x239a('0x37')]=qs[_0x239a('0x37')](_0x3b9a16[_0x239a('0x30')][_0x239a('0x37')]);_0x56ea8c['offset']=qs[_0x239a('0x1b')](_0x3b9a16['query'][_0x239a('0x1b')]);}_0x56ea8c[_0x239a('0x38')]=qs[_0x239a('0x39')](_0x3b9a16[_0x239a('0x30')][_0x239a('0x39')]);_0x56ea8c[_0x239a('0x3a')]=qs[_0x239a('0x31')](_['pick'](_0x3b9a16[_0x239a('0x30')],_0xeee3c2['filters']),_0xc6bff2);if(_0x3b9a16[_0x239a('0x30')][_0x239a('0x3b')]){_0x56ea8c[_0x239a('0x3a')]=_[_0x239a('0x3c')](_0x56ea8c[_0x239a('0x3a')],{'$or':_[_0x239a('0x2b')](_0xc6bff2,function(_0x371629){if(_0x371629['type']!==_0x239a('0x3d')){var _0x4707ca={};_0x4707ca[_0x371629[_0x239a('0x28')]]={'$like':'%'+_0x3b9a16[_0x239a('0x30')][_0x239a('0x3b')]+'%'};return _0x4707ca;}})});}_0x56ea8c=_['merge']({},_0x56ea8c,_0x3b9a16[_0x239a('0x3e')]);var _0xab171e={'where':_0x56ea8c['where']};return db[_0x239a('0x2c')][_0x239a('0x3f')](_0xab171e)[_0x239a('0x21')](function(_0x517dd6){_0x37817e[_0x239a('0x3f')]=_0x517dd6;if(_0x3b9a16['query'][_0x239a('0x40')]){_0x56ea8c[_0x239a('0x41')]=[{'all':!![]}];}return db[_0x239a('0x2c')][_0x239a('0x42')](_0x56ea8c);})['then'](function(_0x29a998){_0x37817e[_0x239a('0x43')]=_0x29a998;return _0x37817e;})[_0x239a('0x21')](respondWithFilteredResult(_0x338b07,_0x56ea8c))[_0x239a('0x44')](handleError(_0x338b07,null));};exports[_0x239a('0x45')]=function(_0x3fc951,_0x496ad2){var _0x2958cd={'raw':![],'where':{'id':_0x3fc951[_0x239a('0x46')]['id']}},_0x4624e3={};_0x4624e3[_0x239a('0x2f')]=_[_0x239a('0x47')](db[_0x239a('0x2c')][_0x239a('0x48')]);_0x4624e3[_0x239a('0x30')]=_[_0x239a('0x47')](_0x3fc951['query']);_0x4624e3['filters']=_[_0x239a('0x32')](_0x4624e3[_0x239a('0x2f')],_0x4624e3[_0x239a('0x30')]);_0x2958cd[_0x239a('0x33')]=_[_0x239a('0x32')](_0x4624e3[_0x239a('0x2f')],qs['fields'](_0x3fc951[_0x239a('0x30')]['fields']));_0x2958cd[_0x239a('0x33')]=_0x2958cd[_0x239a('0x33')]['length']?_0x2958cd['attributes']:_0x4624e3['model'];if(_0x3fc951['query']['includeAll']){_0x2958cd[_0x239a('0x41')]=[{'all':!![]}];}_0x2958cd=_[_0x239a('0x3c')]({},_0x2958cd,_0x3fc951[_0x239a('0x3e')]);return db[_0x239a('0x2c')][_0x239a('0x49')](_0x2958cd)[_0x239a('0x21')](handleEntityNotFound(_0x496ad2,null))['then'](respondWithResult(_0x496ad2,null))[_0x239a('0x44')](handleError(_0x496ad2,null));};exports['create']=function(_0x59edb4,_0x36e1de){return db[_0x239a('0x2c')][_0x239a('0x4a')](_0x59edb4[_0x239a('0x4b')],{})[_0x239a('0x21')](function(_0x74c77a){var _0x585135=_0x59edb4[_0x239a('0x4c')][_0x239a('0x4d')]({'plain':!![]});if(!_0x585135)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x585135[_0x239a('0x4e')]===_0x239a('0x4c')){var _0x1f9c45=_0x74c77a[_0x239a('0x4d')]({'plain':!![]});var _0x13b332=_0x239a('0x23');return db['UserProfileSection'][_0x239a('0x49')]({'where':{'name':_0x13b332,'userProfileId':_0x585135[_0x239a('0x4f')]},'raw':!![]})[_0x239a('0x21')](function(_0x5085ab){if(_0x5085ab&&_0x5085ab[_0x239a('0x50')]===0x0){return db[_0x239a('0x24')][_0x239a('0x4a')]({'name':_0x1f9c45['name'],'resourceId':_0x1f9c45['id'],'type':_0x5085ab[_0x239a('0x28')],'sectionId':_0x5085ab['id']},{})[_0x239a('0x21')](function(){return _0x74c77a;});}else{return _0x74c77a;}})[_0x239a('0x44')](function(_0x515a4d){logger['error'](_0x239a('0x51'),_0x515a4d);throw _0x515a4d;});}return _0x74c77a;})[_0x239a('0x21')](respondWithResult(_0x36e1de,0xc9))[_0x239a('0x44')](handleError(_0x36e1de,null));};exports[_0x239a('0x52')]=function(_0x400b56,_0x390f40){var _0x1bd584={'where':{'id':_0x400b56[_0x239a('0x46')]['id']}},_0x5761b7={};_0x5761b7['model']=_[_0x239a('0x47')](db[_0x239a('0x2c')]['rawAttributes']);_0x1bd584[_0x239a('0x33')]=_[_0x239a('0x32')](_0x5761b7[_0x239a('0x2f')],qs[_0x239a('0x53')](_0x400b56[_0x239a('0x30')]['fields']));_0x1bd584[_0x239a('0x33')]=_0x1bd584['attributes'][_0x239a('0x34')]?_0x1bd584['attributes']:_0x5761b7[_0x239a('0x2f')];if(_0x400b56['query'][_0x239a('0x40')]){_0x1bd584[_0x239a('0x41')]=[{'all':!![]}];}_0x1bd584=_[_0x239a('0x3c')]({},_0x1bd584,_0x400b56[_0x239a('0x3e')]);return db[_0x239a('0x2c')][_0x239a('0x49')](_0x1bd584)[_0x239a('0x21')](handleEntityNotFound(_0x390f40,null))[_0x239a('0x21')](function(_0x343f71){if(_0x343f71){var _0x31d5f0=_0x343f71[_0x239a('0x4d')]({'plain':!![]});_0x31d5f0=qs[_0x239a('0x54')](_0x31d5f0,['id',_0x239a('0x55'),_0x239a('0x56')]);_0x400b56[_0x239a('0x4b')]=_[_0x239a('0x54')](_0x400b56[_0x239a('0x4b')],['id',_0x239a('0x55'),'updatedAt']);return db['JscriptyProject'][_0x239a('0x4a')](_[_0x239a('0x3c')](_0x31d5f0,_0x400b56[_0x239a('0x4b')]),{'include':_0x400b56[_0x239a('0x30')][_0x239a('0x40')]?[{'all':!![]}]:undefined})[_0x239a('0x21')](function(_0x404ae1){var _0x3fd9fa=_0x400b56['user'][_0x239a('0x4d')]({'plain':!![]});if(!_0x3fd9fa)throw new Error(_0x239a('0x57'));if(_0x3fd9fa[_0x239a('0x4e')]==='user'){var _0x45f3a3=_0x404ae1[_0x239a('0x4d')]({'plain':!![]});var _0x21ed02='Projects';return db[_0x239a('0x58')][_0x239a('0x49')]({'where':{'name':_0x21ed02,'userProfileId':_0x3fd9fa[_0x239a('0x4f')]},'raw':!![]})[_0x239a('0x21')](function(_0xff13cd){if(_0xff13cd&&_0xff13cd[_0x239a('0x50')]===0x0){return db[_0x239a('0x24')][_0x239a('0x4a')]({'name':_0x45f3a3[_0x239a('0x28')],'resourceId':_0x45f3a3['id'],'type':_0xff13cd[_0x239a('0x28')],'sectionId':_0xff13cd['id']},{})[_0x239a('0x21')](function(){return _0x404ae1;});}else{return _0x404ae1;}})[_0x239a('0x44')](function(_0x4267fd){logger[_0x239a('0x26')](_0x239a('0x51'),_0x4267fd);throw _0x4267fd;});}return _0x404ae1;});}})[_0x239a('0x21')](respondWithResult(_0x390f40,0xc9))[_0x239a('0x44')](handleError(_0x390f40,null));};exports[_0x239a('0x20')]=function(_0x1a6195,_0x360246){if(_0x1a6195[_0x239a('0x4b')]['id']){delete _0x1a6195['body']['id'];}return db[_0x239a('0x2c')][_0x239a('0x49')]({'where':{'id':_0x1a6195[_0x239a('0x46')]['id']}})[_0x239a('0x21')](handleEntityNotFound(_0x360246,null))[_0x239a('0x21')](saveUpdates(_0x1a6195[_0x239a('0x4b')],null))['then'](respondWithResult(_0x360246,null))['catch'](handleError(_0x360246,null));};exports[_0x239a('0x22')]=function(_0x14af3e,_0xabf99a){return db[_0x239a('0x2c')][_0x239a('0x49')]({'where':{'id':_0x14af3e[_0x239a('0x46')]['id']}})['then'](handleEntityNotFound(_0xabf99a,null))[_0x239a('0x21')](removeEntity(_0xabf99a,null))['catch'](handleError(_0xabf99a,null));};exports[_0x239a('0x59')]=function(_0x134849,_0x104ba1,_0x1715e4){var _0x5ebe57={'raw':!![],'where':{}};var _0x1db459={};var _0x54ac50={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x239a('0x5a')]({'where':{'id':_0x134849[_0x239a('0x46')]['id']}})[_0x239a('0x21')](handleEntityNotFound(_0x104ba1,null))[_0x239a('0x21')](function(_0x3e478b){if(_0x3e478b){_0x1db459[_0x239a('0x2f')]=_[_0x239a('0x47')](db['JscriptySessionReport'][_0x239a('0x48')]);_0x1db459['query']=_['keys'](_0x134849[_0x239a('0x30')]);_0x1db459['filters']=_[_0x239a('0x32')](_0x1db459[_0x239a('0x2f')],_0x1db459['query']);_0x5ebe57['attributes']=_['intersection'](_0x1db459['model'],qs[_0x239a('0x53')](_0x134849[_0x239a('0x30')][_0x239a('0x53')]));_0x5ebe57[_0x239a('0x33')]=_0x5ebe57['attributes']['length']?_0x5ebe57[_0x239a('0x33')]:_0x1db459[_0x239a('0x2f')];if(!_0x134849['query'][_0x239a('0x35')](_0x239a('0x36'))){_0x5ebe57['limit']=qs['limit'](_0x134849[_0x239a('0x30')][_0x239a('0x37')]);_0x5ebe57['offset']=qs[_0x239a('0x1b')](_0x134849[_0x239a('0x30')]['offset']);}_0x5ebe57[_0x239a('0x38')]=qs[_0x239a('0x39')](_0x134849[_0x239a('0x30')]['sort']);_0x5ebe57[_0x239a('0x3a')]=qs[_0x239a('0x31')](_[_0x239a('0x5b')](_0x134849['query'],_0x1db459[_0x239a('0x31')]));_0x5ebe57[_0x239a('0x3a')][_0x239a('0x5c')]=_0x3e478b['id'];if(_0x134849['query'][_0x239a('0x3b')]){_0x5ebe57[_0x239a('0x3a')]=_[_0x239a('0x3c')](_0x5ebe57['where'],{'$or':_[_0x239a('0x2b')](_0x5ebe57[_0x239a('0x33')],function(_0x51fd6b){var _0x19bc0c={};_0x19bc0c[_0x51fd6b]={'$like':'%'+_0x134849[_0x239a('0x30')][_0x239a('0x3b')]+'%'};return _0x19bc0c;})});}_0x5ebe57=_[_0x239a('0x3c')]({},_0x5ebe57,_0x134849[_0x239a('0x3e')]);return db[_0x239a('0x5d')]['count']({'where':_0x5ebe57['where']})[_0x239a('0x21')](function(_0x186204){_0x54ac50[_0x239a('0x3f')]=_0x186204;if(_0x134849[_0x239a('0x30')][_0x239a('0x40')]){_0x5ebe57['include']=[{'all':!![]}];}return db[_0x239a('0x5d')][_0x239a('0x42')](_0x5ebe57);})[_0x239a('0x21')](function(_0x17ccd9){_0x54ac50[_0x239a('0x43')]=_0x17ccd9;return _0x54ac50;});}})[_0x239a('0x21')](respondWithFilteredResult(_0x104ba1,_0x5ebe57))[_0x239a('0x44')](handleError(_0x104ba1,null));};exports[_0x239a('0x5e')]=function(_0x514412,_0x8b0310,_0x3294c5){var _0x2e6cca={'raw':!![],'where':{}};var _0x564cca={};var _0x778d27={'count':0x0,'rows':[]};return db[_0x239a('0x2c')][_0x239a('0x5a')]({'where':{'id':_0x514412[_0x239a('0x46')]['id']}})['then'](handleEntityNotFound(_0x8b0310,null))[_0x239a('0x21')](function(_0x151649){if(_0x151649){_0x564cca['model']=_[_0x239a('0x47')](db[_0x239a('0x5f')][_0x239a('0x48')]);_0x564cca[_0x239a('0x30')]=_[_0x239a('0x47')](_0x514412[_0x239a('0x30')]);_0x564cca[_0x239a('0x31')]=_['intersection'](_0x564cca[_0x239a('0x2f')],_0x564cca['query']);_0x2e6cca['attributes']=_[_0x239a('0x32')](_0x564cca[_0x239a('0x2f')],qs['fields'](_0x514412['query'][_0x239a('0x53')]));_0x2e6cca[_0x239a('0x33')]=_0x2e6cca[_0x239a('0x33')]['length']?_0x2e6cca[_0x239a('0x33')]:_0x564cca[_0x239a('0x2f')];if(!_0x514412[_0x239a('0x30')][_0x239a('0x35')](_0x239a('0x36'))){_0x2e6cca[_0x239a('0x37')]=qs['limit'](_0x514412[_0x239a('0x30')]['limit']);_0x2e6cca[_0x239a('0x1b')]=qs[_0x239a('0x1b')](_0x514412[_0x239a('0x30')][_0x239a('0x1b')]);}_0x2e6cca[_0x239a('0x38')]=qs[_0x239a('0x39')](_0x514412[_0x239a('0x30')]['sort']);_0x2e6cca[_0x239a('0x3a')]=qs[_0x239a('0x31')](_['pick'](_0x514412[_0x239a('0x30')],_0x564cca[_0x239a('0x31')]));_0x2e6cca[_0x239a('0x3a')][_0x239a('0x5c')]=_0x151649['id'];if(_0x514412['query'][_0x239a('0x3b')]){_0x2e6cca[_0x239a('0x3a')]=_[_0x239a('0x3c')](_0x2e6cca[_0x239a('0x3a')],{'$or':_[_0x239a('0x2b')](_0x2e6cca[_0x239a('0x33')],function(_0xd80890){var _0x2bfb4f={};_0x2bfb4f[_0xd80890]={'$like':'%'+_0x514412[_0x239a('0x30')][_0x239a('0x3b')]+'%'};return _0x2bfb4f;})});}_0x2e6cca=_[_0x239a('0x3c')]({},_0x2e6cca,_0x514412['options']);return db[_0x239a('0x5f')]['count']({'where':_0x2e6cca['where']})[_0x239a('0x21')](function(_0x331cdc){_0x778d27[_0x239a('0x3f')]=_0x331cdc;if(_0x514412[_0x239a('0x30')][_0x239a('0x40')]){_0x2e6cca[_0x239a('0x41')]=[{'all':!![]}];}return db[_0x239a('0x5f')][_0x239a('0x42')](_0x2e6cca);})[_0x239a('0x21')](function(_0x5f104c){_0x778d27[_0x239a('0x43')]=_0x5f104c;return _0x778d27;});}})[_0x239a('0x21')](respondWithFilteredResult(_0x8b0310,_0x2e6cca))[_0x239a('0x44')](handleError(_0x8b0310,null));};function char(_0x1b043d){return'number'===typeof _0x1b043d?String[_0x239a('0x60')][_0x239a('0x61')](null,arguments):_0x1b043d;}function needsEncapsulation(_0x416b83){return!!_0x416b83&&(_0x416b83['toString']()[_0x239a('0x62')](char(0xd))>=0x0||_0x416b83[_0x239a('0x63')]()[_0x239a('0x62')](char(0xa))>=0x0||_0x416b83[_0x239a('0x63')]()['indexOf'](char(0x2c))>=0x0||_0x416b83['toString']()[_0x239a('0x62')](char(0x22))>=0x0);}function encapsulate(_0x350e31){var _0x3cf034=char(0x22),_0x362d9b='\x5c'+char(0x22),_0x5f3fb0=_0x350e31[_0x239a('0x63')]()[_0x239a('0x64')](new RegExp(_0x3cf034,'g'),_0x362d9b);return _0x3cf034+_0x5f3fb0+_0x3cf034;}exports[_0x239a('0x65')]=function(_0x364688,_0x1ec1c1,_0xf1129){var _0x1e54df,_0x5d5d65;var _0x3bdc24={'where':{'ProjectId':_0x364688[_0x239a('0x46')]['id']}};if(_0x364688[_0x239a('0x30')][_0x239a('0x66')]){_0x3bdc24[_0x239a('0x3a')]['starttime']=JSON[_0x239a('0x67')](_0x364688['query'][_0x239a('0x66')]);}return db[_0x239a('0x5d')][_0x239a('0x42')](_0x3bdc24)[_0x239a('0x21')](handleEntityNotFound(_0x1ec1c1,null))[_0x239a('0x21')](function(_0x8f721c){if(_0x8f721c){_0x1e54df=_0x8f721c;return db[_0x239a('0x68')][_0x239a('0x42')]({'where':{'SessionId':{'$in':_[_0x239a('0x2b')](_0x1e54df,'id')},'ProjectId':_0x364688[_0x239a('0x46')]['id']},'order':_0x239a('0x69')});}})[_0x239a('0x21')](handleEntityNotFound(_0x1ec1c1,null))[_0x239a('0x21')](function(_0x51ccfa){if(_0x51ccfa){_0x5d5d65=_0x51ccfa;var _0x433fdb={};for(var _0x1f07be=0x0,_0x103daf=_0x5d5d65[_0x239a('0x34')];_0x1f07be<_0x103daf;_0x1f07be++){if(!_0x433fdb[_0x239a('0x35')](_0x5d5d65[_0x1f07be][_0x239a('0x6a')])){_0x433fdb[_0x5d5d65[_0x1f07be][_0x239a('0x6a')]]=needsEncapsulation(_0x5d5d65[_0x1f07be][_0x239a('0x6b')])?encapsulate(_0x5d5d65[_0x1f07be][_0x239a('0x6b')]):_0x5d5d65[_0x1f07be]['question'];}}var _0x2cbb9c=[],_0x2880cc={};for(var _0x4bf5c9=0x0,_0x441360=_0x1e54df[_0x239a('0x34')];_0x4bf5c9<_0x441360;_0x4bf5c9++){_0x2880cc={'ProjectId':_0x364688['params']['id'],'SessionId':_0x1e54df[_0x4bf5c9]['id'],'StartTime':moment(_0x1e54df[_0x4bf5c9]['starttime'])['format'](_0x239a('0x6c'))};for(var _0x499eec=0x0,_0x2eb5a0=_0x5d5d65[_0x239a('0x34')];_0x499eec<_0x2eb5a0;_0x499eec++){if(_0x5d5d65[_0x499eec][_0x239a('0x6d')]==_0x1e54df[_0x4bf5c9]['id']&&_0x433fdb[_0x239a('0x35')](_0x5d5d65[_0x499eec][_0x239a('0x6a')])){_0x2880cc[_0x433fdb[_0x5d5d65[_0x499eec][_0x239a('0x6a')]]]=_0x5d5d65[_0x499eec][_0x239a('0x6e')];}}for(var _0x39a28f in _0x433fdb){if(!_0x2880cc[_0x239a('0x35')](_0x433fdb[_0x39a28f])){_0x2880cc[_0x433fdb[_0x39a28f]]=null;}}_0x2cbb9c[_0x239a('0x6f')](_0x2880cc);}return _0x2cbb9c;}})['then'](function(_0x24c4ea){if(!_[_0x239a('0x70')](_0x24c4ea)){var _0x366f71=toCsv(_0x24c4ea);var _0x2404f7=Date['now']();fs[_0x239a('0x71')](util[_0x239a('0x72')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x364688[_0x239a('0x46')]['id'],_0x2404f7),_0x366f71);_0x1ec1c1[_0x239a('0x73')](_0x239a('0x74'),_0x239a('0x75')+util[_0x239a('0x72')](_0x239a('0x76'),_0x364688[_0x239a('0x46')]['id'],_0x2404f7));_0x1ec1c1['setHeader'](_0x239a('0x77'),'text/csv');return _0x1ec1c1[_0x239a('0x78')](util[_0x239a('0x72')](_0x239a('0x79'),_0x364688[_0x239a('0x46')]['id'],_0x2404f7));}else{return _0x1ec1c1['sendStatus'](0xcc);}})['catch'](handleError(_0x1ec1c1,null));}; \ No newline at end of file +var _0x2ed0=['rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','JscriptyProject','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','clone','params','includeAll','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','JscriptySessionReport','ProjectId','include','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','isEmpty','now','writeFileSync','format','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','/tmp/Jscripty_Project_%d_Summary_%s.csv','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','end','sendStatus','error','stack','name','index','map'];(function(_0x1d3da5,_0x48694e){var _0x302224=function(_0x11d52b){while(--_0x11d52b){_0x1d3da5['push'](_0x1d3da5['shift']());}};_0x302224(++_0x48694e);}(_0x2ed0,0x19a));var _0x02ed=function(_0x2b9db3,_0xa20d09){_0x2b9db3=_0x2b9db3-0x0;var _0x55ae3f=_0x2ed0[_0x2b9db3];return _0x55ae3f;};'use strict';var pdf=require(_0x02ed('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x02ed('0x1'));var jsonpatch=require(_0x02ed('0x2'));var rp=require(_0x02ed('0x3'));var moment=require(_0x02ed('0x4'));var BPromise=require(_0x02ed('0x5'));var Mustache=require(_0x02ed('0x6'));var util=require(_0x02ed('0x7'));var path=require(_0x02ed('0x8'));var sox=require(_0x02ed('0x9'));var csv=require(_0x02ed('0xa'));var ejs=require(_0x02ed('0xb'));var fs=require('fs');var _=require(_0x02ed('0xc'));var squel=require('squel');var crypto=require(_0x02ed('0xd'));var jsforce=require(_0x02ed('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x02ed('0xf'));var Papa=require(_0x02ed('0x10'));var Redis=require(_0x02ed('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x02ed('0x12'));var as=require(_0x02ed('0x13'));var hardwareService=require(_0x02ed('0x14'));var logger=require('../../config/logger')(_0x02ed('0x15'));var utils=require(_0x02ed('0x16'));var config=require(_0x02ed('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e8379,_0x84c94d){_0x84c94d=_0x84c94d||0xcc;return function(_0x715713){if(_0x715713){return _0x4e8379['sendStatus'](_0x84c94d);}return _0x4e8379[_0x02ed('0x18')](_0x84c94d)['end']();};}function respondWithResult(_0x4a967e,_0x4285b7){_0x4285b7=_0x4285b7||0xc8;return function(_0x31fdef){if(_0x31fdef){return _0x4a967e['status'](_0x4285b7)[_0x02ed('0x19')](_0x31fdef);}};}function respondWithFilteredResult(_0x301163,_0x143cad){return function(_0x2f5c69){if(_0x2f5c69){var _0x2616eb=_0x2f5c69[_0x02ed('0x1a')],_0x598aff=_0x143cad[_0x02ed('0x1b')],_0x4f1fbc=_0x143cad[_0x02ed('0x1b')]+_0x143cad[_0x02ed('0x1c')],_0x514f01;if(_0x4f1fbc>=_0x2616eb){_0x4f1fbc=_0x2616eb;_0x514f01=0xc8;}else{_0x514f01=0xce;}_0x301163[_0x02ed('0x18')](_0x514f01);return _0x301163[_0x02ed('0x1d')]('Content-Range',_0x598aff+'-'+_0x4f1fbc+'/'+_0x2616eb)[_0x02ed('0x19')](_0x2f5c69);}return null;};}function patchUpdates(_0x39ccbd){return function(_0x312e28){try{jsonpatch[_0x02ed('0x1e')](_0x312e28,_0x39ccbd,!![]);}catch(_0x4ac3c9){return BPromise[_0x02ed('0x1f')](_0x4ac3c9);}return _0x312e28[_0x02ed('0x20')]();};}function saveUpdates(_0x277b0a,_0x397fd3){return function(_0x1848d8){if(_0x1848d8){return _0x1848d8[_0x02ed('0x21')](_0x277b0a)[_0x02ed('0x22')](function(_0x6f8584){return _0x6f8584;});}return null;};}function removeEntity(_0x4393b4,_0x785a55){return function(_0x31465b){if(_0x31465b){return _0x31465b[_0x02ed('0x23')]()[_0x02ed('0x22')](function(){var _0x451416=_0x31465b[_0x02ed('0x24')]({'plain':!![]});var _0x4b6feb=_0x02ed('0x25');return db[_0x02ed('0x26')][_0x02ed('0x23')]({'where':{'type':_0x4b6feb,'resourceId':_0x451416['id']}})[_0x02ed('0x22')](function(){return _0x31465b;});})[_0x02ed('0x22')](function(){_0x4393b4[_0x02ed('0x18')](0xcc)[_0x02ed('0x27')]();});}};}function handleEntityNotFound(_0x1aa1c4,_0x3e4067){return function(_0x1a6dc9){if(!_0x1a6dc9){_0x1aa1c4[_0x02ed('0x28')](0x194);}return _0x1a6dc9;};}function handleError(_0x415c41,_0x58ae52){_0x58ae52=_0x58ae52||0x1f4;return function(_0x28c705){logger[_0x02ed('0x29')](_0x28c705[_0x02ed('0x2a')]);if(_0x28c705['name']){delete _0x28c705[_0x02ed('0x2b')];}_0x415c41['status'](_0x58ae52)['send'](_0x28c705);};}exports[_0x02ed('0x2c')]=function(_0x3319ae,_0xa9c955){var _0x2b8d71={},_0x7f7b0={},_0xa58bf8={'count':0x0,'rows':[]};var _0x253970=_[_0x02ed('0x2d')](db['JscriptyProject'][_0x02ed('0x2e')],function(_0x4cc4e9){return{'name':_0x4cc4e9['fieldName'],'type':_0x4cc4e9[_0x02ed('0x2f')][_0x02ed('0x30')]};});_0x7f7b0[_0x02ed('0x31')]=_[_0x02ed('0x2d')](_0x253970,_0x02ed('0x2b'));_0x7f7b0[_0x02ed('0x32')]=_[_0x02ed('0x33')](_0x3319ae[_0x02ed('0x32')]);_0x7f7b0[_0x02ed('0x34')]=_[_0x02ed('0x35')](_0x7f7b0[_0x02ed('0x31')],_0x7f7b0[_0x02ed('0x32')]);_0x2b8d71[_0x02ed('0x36')]=_['intersection'](_0x7f7b0[_0x02ed('0x31')],qs[_0x02ed('0x37')](_0x3319ae[_0x02ed('0x32')][_0x02ed('0x37')]));_0x2b8d71['attributes']=_0x2b8d71['attributes'][_0x02ed('0x38')]?_0x2b8d71[_0x02ed('0x36')]:_0x7f7b0[_0x02ed('0x31')];if(!_0x3319ae['query'][_0x02ed('0x39')](_0x02ed('0x3a'))){_0x2b8d71[_0x02ed('0x1c')]=qs[_0x02ed('0x1c')](_0x3319ae[_0x02ed('0x32')][_0x02ed('0x1c')]);_0x2b8d71['offset']=qs[_0x02ed('0x1b')](_0x3319ae[_0x02ed('0x32')][_0x02ed('0x1b')]);}_0x2b8d71[_0x02ed('0x3b')]=qs[_0x02ed('0x3c')](_0x3319ae[_0x02ed('0x32')][_0x02ed('0x3c')]);_0x2b8d71[_0x02ed('0x3d')]=qs['filters'](_[_0x02ed('0x3e')](_0x3319ae[_0x02ed('0x32')],_0x7f7b0[_0x02ed('0x34')]),_0x253970);if(_0x3319ae[_0x02ed('0x32')][_0x02ed('0x3f')]){_0x2b8d71[_0x02ed('0x3d')]=_[_0x02ed('0x40')](_0x2b8d71['where'],{'$or':_['map'](_0x253970,function(_0x350860){if(_0x350860[_0x02ed('0x2f')]!=='VIRTUAL'){var _0x204719={};_0x204719[_0x350860[_0x02ed('0x2b')]]={'$like':'%'+_0x3319ae[_0x02ed('0x32')]['filter']+'%'};return _0x204719;}})});}_0x2b8d71=_['merge']({},_0x2b8d71,_0x3319ae[_0x02ed('0x41')]);var _0x9e76ae={'where':_0x2b8d71['where']};return db[_0x02ed('0x42')][_0x02ed('0x1a')](_0x9e76ae)[_0x02ed('0x22')](function(_0x5b397c){_0xa58bf8[_0x02ed('0x1a')]=_0x5b397c;if(_0x3319ae[_0x02ed('0x32')]['includeAll']){_0x2b8d71['include']=[{'all':!![]}];}return db[_0x02ed('0x42')][_0x02ed('0x43')](_0x2b8d71);})[_0x02ed('0x22')](function(_0x427e7f){_0xa58bf8[_0x02ed('0x44')]=_0x427e7f;return _0xa58bf8;})[_0x02ed('0x22')](respondWithFilteredResult(_0xa9c955,_0x2b8d71))[_0x02ed('0x45')](handleError(_0xa9c955,null));};exports[_0x02ed('0x46')]=function(_0x3e2581,_0x23a991){var _0x1d8191={'raw':![],'where':{'id':_0x3e2581['params']['id']}},_0x558d76={};_0x558d76[_0x02ed('0x31')]=_[_0x02ed('0x33')](db['JscriptyProject'][_0x02ed('0x2e')]);_0x558d76[_0x02ed('0x32')]=_[_0x02ed('0x33')](_0x3e2581[_0x02ed('0x32')]);_0x558d76[_0x02ed('0x34')]=_[_0x02ed('0x35')](_0x558d76[_0x02ed('0x31')],_0x558d76['query']);_0x1d8191[_0x02ed('0x36')]=_[_0x02ed('0x35')](_0x558d76['model'],qs['fields'](_0x3e2581[_0x02ed('0x32')][_0x02ed('0x37')]));_0x1d8191['attributes']=_0x1d8191[_0x02ed('0x36')][_0x02ed('0x38')]?_0x1d8191[_0x02ed('0x36')]:_0x558d76[_0x02ed('0x31')];if(_0x3e2581[_0x02ed('0x32')]['includeAll']){_0x1d8191['include']=[{'all':!![]}];}_0x1d8191=_[_0x02ed('0x40')]({},_0x1d8191,_0x3e2581[_0x02ed('0x41')]);return db[_0x02ed('0x42')][_0x02ed('0x47')](_0x1d8191)[_0x02ed('0x22')](handleEntityNotFound(_0x23a991,null))[_0x02ed('0x22')](respondWithResult(_0x23a991,null))[_0x02ed('0x45')](handleError(_0x23a991,null));};exports[_0x02ed('0x48')]=function(_0x27bad6,_0x54fea5){return db[_0x02ed('0x42')][_0x02ed('0x48')](_0x27bad6[_0x02ed('0x49')],{})[_0x02ed('0x22')](function(_0x3e77f1){var _0x19e945=_0x27bad6[_0x02ed('0x4a')][_0x02ed('0x24')]({'plain':!![]});if(!_0x19e945)throw new Error(_0x02ed('0x4b'));if(_0x19e945[_0x02ed('0x4c')]===_0x02ed('0x4a')){var _0x378a90=_0x3e77f1[_0x02ed('0x24')]({'plain':!![]});var _0x5c283c='Projects';return db['UserProfileSection']['find']({'where':{'name':_0x5c283c,'userProfileId':_0x19e945[_0x02ed('0x4d')]},'raw':!![]})[_0x02ed('0x22')](function(_0x41b25b){if(_0x41b25b&&_0x41b25b[_0x02ed('0x4e')]===0x0){return db[_0x02ed('0x26')][_0x02ed('0x48')]({'name':_0x378a90['name'],'resourceId':_0x378a90['id'],'type':_0x41b25b[_0x02ed('0x2b')],'sectionId':_0x41b25b['id']},{})[_0x02ed('0x22')](function(){return _0x3e77f1;});}else{return _0x3e77f1;}})[_0x02ed('0x45')](function(_0x4f83fd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f83fd);throw _0x4f83fd;});}return _0x3e77f1;})[_0x02ed('0x22')](respondWithResult(_0x54fea5,0xc9))['catch'](handleError(_0x54fea5,null));};exports[_0x02ed('0x4f')]=function(_0x4a3e5a,_0x1f2dee){var _0xb4df03={'where':{'id':_0x4a3e5a[_0x02ed('0x50')]['id']}},_0x37fa4a={};_0x37fa4a[_0x02ed('0x31')]=_['keys'](db[_0x02ed('0x42')]['rawAttributes']);_0xb4df03[_0x02ed('0x36')]=_['intersection'](_0x37fa4a[_0x02ed('0x31')],qs['fields'](_0x4a3e5a[_0x02ed('0x32')][_0x02ed('0x37')]));_0xb4df03[_0x02ed('0x36')]=_0xb4df03[_0x02ed('0x36')]['length']?_0xb4df03[_0x02ed('0x36')]:_0x37fa4a['model'];if(_0x4a3e5a['query'][_0x02ed('0x51')]){_0xb4df03['include']=[{'all':!![]}];}_0xb4df03=_[_0x02ed('0x40')]({},_0xb4df03,_0x4a3e5a[_0x02ed('0x41')]);return db['JscriptyProject'][_0x02ed('0x47')](_0xb4df03)[_0x02ed('0x22')](handleEntityNotFound(_0x1f2dee,null))[_0x02ed('0x22')](function(_0x817188){if(_0x817188){var _0x3d9364=_0x817188[_0x02ed('0x24')]({'plain':!![]});_0x3d9364=qs[_0x02ed('0x52')](_0x3d9364,['id',_0x02ed('0x53'),_0x02ed('0x54')]);_0x4a3e5a[_0x02ed('0x49')]=_[_0x02ed('0x52')](_0x4a3e5a['body'],['id',_0x02ed('0x53'),_0x02ed('0x54')]);return db[_0x02ed('0x42')]['create'](_['merge'](_0x3d9364,_0x4a3e5a[_0x02ed('0x49')]),{'include':_0x4a3e5a[_0x02ed('0x32')][_0x02ed('0x51')]?[{'all':!![]}]:undefined})[_0x02ed('0x22')](function(_0x3574df){var _0x106aad=_0x4a3e5a[_0x02ed('0x4a')][_0x02ed('0x24')]({'plain':!![]});if(!_0x106aad)throw new Error(_0x02ed('0x4b'));if(_0x106aad[_0x02ed('0x4c')]===_0x02ed('0x4a')){var _0x11338a=_0x3574df[_0x02ed('0x24')]({'plain':!![]});var _0x4ef371='Projects';return db['UserProfileSection'][_0x02ed('0x47')]({'where':{'name':_0x4ef371,'userProfileId':_0x106aad[_0x02ed('0x4d')]},'raw':!![]})[_0x02ed('0x22')](function(_0x40871c){if(_0x40871c&&_0x40871c[_0x02ed('0x4e')]===0x0){return db[_0x02ed('0x26')]['create']({'name':_0x11338a[_0x02ed('0x2b')],'resourceId':_0x11338a['id'],'type':_0x40871c[_0x02ed('0x2b')],'sectionId':_0x40871c['id']},{})['then'](function(){return _0x3574df;});}else{return _0x3574df;}})[_0x02ed('0x45')](function(_0x27d2c9){logger['error'](_0x02ed('0x55'),_0x27d2c9);throw _0x27d2c9;});}return _0x3574df;});}})[_0x02ed('0x22')](respondWithResult(_0x1f2dee,0xc9))[_0x02ed('0x45')](handleError(_0x1f2dee,null));};exports[_0x02ed('0x21')]=function(_0x480c2c,_0x591ba7){if(_0x480c2c[_0x02ed('0x49')]['id']){delete _0x480c2c['body']['id'];}return db['JscriptyProject'][_0x02ed('0x47')]({'where':{'id':_0x480c2c[_0x02ed('0x50')]['id']}})[_0x02ed('0x22')](handleEntityNotFound(_0x591ba7,null))['then'](saveUpdates(_0x480c2c[_0x02ed('0x49')],null))['then'](respondWithResult(_0x591ba7,null))[_0x02ed('0x45')](handleError(_0x591ba7,null));};exports[_0x02ed('0x23')]=function(_0x5ba88b,_0x1c0054){return db[_0x02ed('0x42')][_0x02ed('0x47')]({'where':{'id':_0x5ba88b['params']['id']}})[_0x02ed('0x22')](handleEntityNotFound(_0x1c0054,null))[_0x02ed('0x22')](removeEntity(_0x1c0054,null))[_0x02ed('0x45')](handleError(_0x1c0054,null));};exports['getSessions']=function(_0x4b2ac8,_0x566a64,_0x5e154c){var _0x1d04c0={'raw':!![],'where':{}};var _0x5d747a={};var _0x56e784={'count':0x0,'rows':[]};return db[_0x02ed('0x42')][_0x02ed('0x56')]({'where':{'id':_0x4b2ac8[_0x02ed('0x50')]['id']}})['then'](handleEntityNotFound(_0x566a64,null))['then'](function(_0xe1e05e){if(_0xe1e05e){_0x5d747a[_0x02ed('0x31')]=_[_0x02ed('0x33')](db[_0x02ed('0x57')][_0x02ed('0x2e')]);_0x5d747a[_0x02ed('0x32')]=_[_0x02ed('0x33')](_0x4b2ac8[_0x02ed('0x32')]);_0x5d747a[_0x02ed('0x34')]=_[_0x02ed('0x35')](_0x5d747a[_0x02ed('0x31')],_0x5d747a[_0x02ed('0x32')]);_0x1d04c0[_0x02ed('0x36')]=_[_0x02ed('0x35')](_0x5d747a[_0x02ed('0x31')],qs[_0x02ed('0x37')](_0x4b2ac8[_0x02ed('0x32')][_0x02ed('0x37')]));_0x1d04c0['attributes']=_0x1d04c0['attributes']['length']?_0x1d04c0[_0x02ed('0x36')]:_0x5d747a['model'];if(!_0x4b2ac8['query']['hasOwnProperty'](_0x02ed('0x3a'))){_0x1d04c0[_0x02ed('0x1c')]=qs[_0x02ed('0x1c')](_0x4b2ac8[_0x02ed('0x32')][_0x02ed('0x1c')]);_0x1d04c0['offset']=qs[_0x02ed('0x1b')](_0x4b2ac8[_0x02ed('0x32')][_0x02ed('0x1b')]);}_0x1d04c0['order']=qs['sort'](_0x4b2ac8[_0x02ed('0x32')]['sort']);_0x1d04c0[_0x02ed('0x3d')]=qs['filters'](_[_0x02ed('0x3e')](_0x4b2ac8[_0x02ed('0x32')],_0x5d747a[_0x02ed('0x34')]));_0x1d04c0[_0x02ed('0x3d')][_0x02ed('0x58')]=_0xe1e05e['id'];if(_0x4b2ac8[_0x02ed('0x32')][_0x02ed('0x3f')]){_0x1d04c0['where']=_[_0x02ed('0x40')](_0x1d04c0[_0x02ed('0x3d')],{'$or':_[_0x02ed('0x2d')](_0x1d04c0[_0x02ed('0x36')],function(_0x5e8476){var _0x421167={};_0x421167[_0x5e8476]={'$like':'%'+_0x4b2ac8['query']['filter']+'%'};return _0x421167;})});}_0x1d04c0=_[_0x02ed('0x40')]({},_0x1d04c0,_0x4b2ac8[_0x02ed('0x41')]);return db[_0x02ed('0x57')][_0x02ed('0x1a')]({'where':_0x1d04c0[_0x02ed('0x3d')]})[_0x02ed('0x22')](function(_0x4eddf3){_0x56e784[_0x02ed('0x1a')]=_0x4eddf3;if(_0x4b2ac8['query']['includeAll']){_0x1d04c0[_0x02ed('0x59')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x02ed('0x43')](_0x1d04c0);})[_0x02ed('0x22')](function(_0x18b9a6){_0x56e784[_0x02ed('0x44')]=_0x18b9a6;return _0x56e784;});}})[_0x02ed('0x22')](respondWithFilteredResult(_0x566a64,_0x1d04c0))[_0x02ed('0x45')](handleError(_0x566a64,null));};exports[_0x02ed('0x5a')]=function(_0xc62703,_0x4444a0,_0x1f314b){var _0x436376={'raw':!![],'where':{}};var _0x584c9c={};var _0x2297f7={'count':0x0,'rows':[]};return db[_0x02ed('0x42')]['findOne']({'where':{'id':_0xc62703[_0x02ed('0x50')]['id']}})[_0x02ed('0x22')](handleEntityNotFound(_0x4444a0,null))['then'](function(_0x461eb0){if(_0x461eb0){_0x584c9c[_0x02ed('0x31')]=_[_0x02ed('0x33')](db[_0x02ed('0x5b')][_0x02ed('0x2e')]);_0x584c9c[_0x02ed('0x32')]=_[_0x02ed('0x33')](_0xc62703[_0x02ed('0x32')]);_0x584c9c[_0x02ed('0x34')]=_[_0x02ed('0x35')](_0x584c9c[_0x02ed('0x31')],_0x584c9c[_0x02ed('0x32')]);_0x436376[_0x02ed('0x36')]=_[_0x02ed('0x35')](_0x584c9c[_0x02ed('0x31')],qs['fields'](_0xc62703[_0x02ed('0x32')]['fields']));_0x436376[_0x02ed('0x36')]=_0x436376['attributes']['length']?_0x436376[_0x02ed('0x36')]:_0x584c9c['model'];if(!_0xc62703[_0x02ed('0x32')][_0x02ed('0x39')](_0x02ed('0x3a'))){_0x436376[_0x02ed('0x1c')]=qs[_0x02ed('0x1c')](_0xc62703[_0x02ed('0x32')][_0x02ed('0x1c')]);_0x436376['offset']=qs[_0x02ed('0x1b')](_0xc62703[_0x02ed('0x32')][_0x02ed('0x1b')]);}_0x436376['order']=qs['sort'](_0xc62703[_0x02ed('0x32')][_0x02ed('0x3c')]);_0x436376[_0x02ed('0x3d')]=qs[_0x02ed('0x34')](_[_0x02ed('0x3e')](_0xc62703['query'],_0x584c9c['filters']));_0x436376['where'][_0x02ed('0x58')]=_0x461eb0['id'];if(_0xc62703[_0x02ed('0x32')]['filter']){_0x436376[_0x02ed('0x3d')]=_[_0x02ed('0x40')](_0x436376[_0x02ed('0x3d')],{'$or':_[_0x02ed('0x2d')](_0x436376[_0x02ed('0x36')],function(_0x16ad4d){var _0x286107={};_0x286107[_0x16ad4d]={'$like':'%'+_0xc62703[_0x02ed('0x32')][_0x02ed('0x3f')]+'%'};return _0x286107;})});}_0x436376=_[_0x02ed('0x40')]({},_0x436376,_0xc62703[_0x02ed('0x41')]);return db[_0x02ed('0x5b')]['count']({'where':_0x436376['where']})['then'](function(_0x3484d7){_0x2297f7[_0x02ed('0x1a')]=_0x3484d7;if(_0xc62703[_0x02ed('0x32')][_0x02ed('0x51')]){_0x436376[_0x02ed('0x59')]=[{'all':!![]}];}return db[_0x02ed('0x5b')][_0x02ed('0x43')](_0x436376);})['then'](function(_0x535d0c){_0x2297f7['rows']=_0x535d0c;return _0x2297f7;});}})[_0x02ed('0x22')](respondWithFilteredResult(_0x4444a0,_0x436376))[_0x02ed('0x45')](handleError(_0x4444a0,null));};function char(_0x59c9e8){return _0x02ed('0x5c')===typeof _0x59c9e8?String[_0x02ed('0x5d')][_0x02ed('0x1e')](null,arguments):_0x59c9e8;}function needsEncapsulation(_0x48960f){return!!_0x48960f&&(_0x48960f['toString']()['indexOf'](char(0xd))>=0x0||_0x48960f[_0x02ed('0x5e')]()['indexOf'](char(0xa))>=0x0||_0x48960f[_0x02ed('0x5e')]()['indexOf'](char(0x2c))>=0x0||_0x48960f[_0x02ed('0x5e')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x201842){var _0x1e0773=char(0x22),_0x4347f2='\x5c'+char(0x22),_0x3603ff=_0x201842['toString']()['replace'](new RegExp(_0x1e0773,'g'),_0x4347f2);return _0x1e0773+_0x3603ff+_0x1e0773;}exports['getSummary']=function(_0x4f59b5,_0x5b5d94,_0x5cfbe5){var _0x248313,_0x51c2ce;var _0x1cb8f4={'where':{'ProjectId':_0x4f59b5[_0x02ed('0x50')]['id']}};if(_0x4f59b5[_0x02ed('0x32')][_0x02ed('0x5f')]){_0x1cb8f4[_0x02ed('0x3d')]['starttime']=JSON[_0x02ed('0x60')](_0x4f59b5['query'][_0x02ed('0x5f')]);}return db[_0x02ed('0x57')]['findAll'](_0x1cb8f4)[_0x02ed('0x22')](handleEntityNotFound(_0x5b5d94,null))[_0x02ed('0x22')](function(_0x13bb94){if(_0x13bb94){_0x248313=_0x13bb94;return db[_0x02ed('0x61')]['findAll']({'where':{'SessionId':{'$in':_[_0x02ed('0x2d')](_0x248313,'id')},'ProjectId':_0x4f59b5['params']['id']},'order':_0x02ed('0x62')});}})[_0x02ed('0x22')](handleEntityNotFound(_0x5b5d94,null))[_0x02ed('0x22')](function(_0x3f0ad6){if(_0x3f0ad6){_0x51c2ce=_0x3f0ad6;var _0x50f6bb={};for(var _0x43f301=0x0,_0xa994c9=_0x51c2ce[_0x02ed('0x38')];_0x43f301<_0xa994c9;_0x43f301++){if(!_0x50f6bb[_0x02ed('0x39')](_0x51c2ce[_0x43f301][_0x02ed('0x63')])){_0x50f6bb[_0x51c2ce[_0x43f301][_0x02ed('0x63')]]=needsEncapsulation(_0x51c2ce[_0x43f301]['question'])?encapsulate(_0x51c2ce[_0x43f301][_0x02ed('0x64')]):_0x51c2ce[_0x43f301][_0x02ed('0x64')];}}var _0xcd5e6c=[],_0x5ea57c={};for(var _0x16ead7=0x0,_0xe3adfc=_0x248313[_0x02ed('0x38')];_0x16ead7<_0xe3adfc;_0x16ead7++){_0x5ea57c={'ProjectId':_0x4f59b5['params']['id'],'SessionId':_0x248313[_0x16ead7]['id'],'StartTime':moment(_0x248313[_0x16ead7][_0x02ed('0x65')])['format'](_0x02ed('0x66'))};for(var _0x34b2f9=0x0,_0x261986=_0x51c2ce['length'];_0x34b2f9<_0x261986;_0x34b2f9++){if(_0x51c2ce[_0x34b2f9][_0x02ed('0x67')]==_0x248313[_0x16ead7]['id']&&_0x50f6bb[_0x02ed('0x39')](_0x51c2ce[_0x34b2f9][_0x02ed('0x63')])){_0x5ea57c[_0x50f6bb[_0x51c2ce[_0x34b2f9][_0x02ed('0x63')]]]=_0x51c2ce[_0x34b2f9]['answer'];}}for(var _0x46395d in _0x50f6bb){if(!_0x5ea57c['hasOwnProperty'](_0x50f6bb[_0x46395d])){_0x5ea57c[_0x50f6bb[_0x46395d]]=null;}}_0xcd5e6c[_0x02ed('0x68')](_0x5ea57c);}return _0xcd5e6c;}})['then'](function(_0x525f85){if(!_[_0x02ed('0x69')](_0x525f85)){var _0x2f11de=toCsv(_0x525f85);var _0x258ae9=Date[_0x02ed('0x6a')]();fs[_0x02ed('0x6b')](util[_0x02ed('0x6c')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4f59b5[_0x02ed('0x50')]['id'],_0x258ae9),_0x2f11de);_0x5b5d94['setHeader']('Content-disposition','attachment;\x20filename='+util['format'](_0x02ed('0x6d'),_0x4f59b5[_0x02ed('0x50')]['id'],_0x258ae9));_0x5b5d94[_0x02ed('0x6e')](_0x02ed('0x6f'),_0x02ed('0x70'));return _0x5b5d94['download'](util[_0x02ed('0x6c')](_0x02ed('0x71'),_0x4f59b5['params']['id'],_0x258ae9));}else{return _0x5b5d94[_0x02ed('0x28')](0xcc);}})[_0x02ed('0x45')](handleError(_0x5b5d94,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 4424758..a10d73e 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 _0x223b=['path','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x43557f,_0x2d10bc){var _0x8e70bf=function(_0x14bc47){while(--_0x14bc47){_0x43557f['push'](_0x43557f['shift']());}};_0x8e70bf(++_0x2d10bc);}(_0x223b,0x10e));var _0xb223=function(_0x4ab503,_0x301433){_0x4ab503=_0x4ab503-0x0;var _0x3d034f=_0x223b[_0x4ab503];return _0x3d034f;};'use strict';var _=require(_0xb223('0x0'));var util=require('util');var logger=require(_0xb223('0x1'))('api');var moment=require(_0xb223('0x2'));var BPromise=require(_0xb223('0x3'));var rp=require(_0xb223('0x4'));var fs=require('fs');var path=require(_0xb223('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb223('0x6'));module[_0xb223('0x7')]=function(_0x4fff59,_0x9be15c){return _0x4fff59[_0xb223('0x8')](_0xb223('0x9'),attributes,{'tableName':_0xb223('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35d5=['exports','define','JscriptyProject','util','../../config/logger','api','bluebird','path','./jscriptyProject.attributes'];(function(_0x1bdca,_0x4e8792){var _0x26ada3=function(_0x5ed3e8){while(--_0x5ed3e8){_0x1bdca['push'](_0x1bdca['shift']());}};_0x26ada3(++_0x4e8792);}(_0x35d5,0x1e0));var _0x535d=function(_0x46d4f4,_0x3d57a5){_0x46d4f4=_0x46d4f4-0x0;var _0x4cdee5=_0x35d5[_0x46d4f4];return _0x4cdee5;};'use strict';var _=require('lodash');var util=require(_0x535d('0x0'));var logger=require(_0x535d('0x1'))(_0x535d('0x2'));var moment=require('moment');var BPromise=require(_0x535d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x535d('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x535d('0x5'));module[_0x535d('0x6')]=function(_0x1f6840,_0x48c650){return _0x1f6840[_0x535d('0x7')](_0x535d('0x8'),attributes,{'tableName':'jscripty_projects','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 1ada09b..724934a 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 _0xe353=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyProject,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe353,0xb9));var _0x3e35=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xe353[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require('lodash');var util=require(_0x3e35('0x0'));var moment=require(_0x3e35('0x1'));var BPromise=require(_0x3e35('0x2'));var rs=require(_0x3e35('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e35('0x4'))['db'];var utils=require(_0x3e35('0x5'));var logger=require('../../config/logger')(_0x3e35('0x6'));var config=require(_0x3e35('0x7'));var jayson=require(_0x3e35('0x8'));var client=jayson[_0x3e35('0x9')][_0x3e35('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb5e7d0,_0x316dce,_0x40af70){return new BPromise(function(_0x36c82d,_0x1abe3a){return client[_0x3e35('0xb')](_0xb5e7d0,_0x40af70)['then'](function(_0x5f055c){logger[_0x3e35('0xc')](_0x3e35('0xd'),_0x316dce,'request\x20sent');logger[_0x3e35('0xe')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x316dce,_0x3e35('0xf'),JSON[_0x3e35('0x10')](_0x5f055c));if(_0x5f055c['error']){if(_0x5f055c[_0x3e35('0x11')]['code']===0x1f4){logger[_0x3e35('0x11')](_0x3e35('0xd'),_0x316dce,_0x5f055c[_0x3e35('0x11')]['message']);return _0x1abe3a(_0x5f055c['error']['message']);}logger[_0x3e35('0x11')](_0x3e35('0xd'),_0x316dce,_0x5f055c[_0x3e35('0x11')][_0x3e35('0x12')]);return _0x36c82d(_0x5f055c[_0x3e35('0x11')][_0x3e35('0x12')]);}else{logger[_0x3e35('0xc')](_0x3e35('0xd'),_0x316dce,_0x3e35('0xf'));_0x36c82d(_0x5f055c['result']['message']);}})['catch'](function(_0x180e5a){logger['error'](_0x3e35('0xd'),_0x316dce,_0x180e5a);_0x1abe3a(_0x180e5a);});});} \ No newline at end of file +var _0x6588=['debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent'];(function(_0x403d57,_0x501978){var _0x150baa=function(_0xfb7ea4){while(--_0xfb7ea4){_0x403d57['push'](_0x403d57['shift']());}};_0x150baa(++_0x501978);}(_0x6588,0x1b1));var _0x8658=function(_0x58b900,_0x4067f4){_0x58b900=_0x58b900-0x0;var _0x142565=_0x6588[_0x58b900];return _0x142565;};'use strict';var _=require('lodash');var util=require(_0x8658('0x0'));var moment=require(_0x8658('0x1'));var BPromise=require(_0x8658('0x2'));var rs=require(_0x8658('0x3'));var fs=require('fs');var Redis=require(_0x8658('0x4'));var db=require(_0x8658('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8658('0x6'))(_0x8658('0x7'));var config=require(_0x8658('0x8'));var jayson=require(_0x8658('0x9'));var client=jayson[_0x8658('0xa')][_0x8658('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38e7a2,_0x287945,_0x255a83){return new BPromise(function(_0x51b3e7,_0x4ae075){return client[_0x8658('0xc')](_0x38e7a2,_0x255a83)[_0x8658('0xd')](function(_0x1db8d3){logger[_0x8658('0xe')](_0x8658('0xf'),_0x287945,_0x8658('0x10'));logger[_0x8658('0x11')](_0x8658('0x12'),_0x287945,_0x8658('0x10'),JSON[_0x8658('0x13')](_0x1db8d3));if(_0x1db8d3[_0x8658('0x14')]){if(_0x1db8d3[_0x8658('0x14')][_0x8658('0x15')]===0x1f4){logger['error']('JscriptyProject,\x20%s,\x20%s',_0x287945,_0x1db8d3[_0x8658('0x14')][_0x8658('0x16')]);return _0x4ae075(_0x1db8d3[_0x8658('0x14')][_0x8658('0x16')]);}logger['error'](_0x8658('0xf'),_0x287945,_0x1db8d3['error'][_0x8658('0x16')]);return _0x51b3e7(_0x1db8d3['error'][_0x8658('0x16')]);}else{logger[_0x8658('0xe')](_0x8658('0xf'),_0x287945,_0x8658('0x10'));_0x51b3e7(_0x1db8d3[_0x8658('0x17')][_0x8658('0x16')]);}})[_0x8658('0x18')](function(_0x579b9c){logger[_0x8658('0x14')](_0x8658('0xf'),_0x287945,_0x579b9c);_0x4ae075(_0x579b9c);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 27938e0..8ef100f 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 _0xe651=['update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/:id','show','post','put'];(function(_0x39143b,_0x186a7a){var _0x56503f=function(_0x5d2d00){while(--_0x5d2d00){_0x39143b['push'](_0x39143b['shift']());}};_0x56503f(++_0x186a7a);}(_0xe651,0x1a5));var _0x1e65=function(_0x3a6a2b,_0x1cc6a4){_0x3a6a2b=_0x3a6a2b-0x0;var _0xe3ebf3=_0xe651[_0x3a6a2b];return _0xe3ebf3;};'use strict';var multer=require(_0x1e65('0x0'));var util=require(_0x1e65('0x1'));var path=require(_0x1e65('0x2'));var timeout=require(_0x1e65('0x3'));var express=require(_0x1e65('0x4'));var router=express[_0x1e65('0x5')]();var auth=require(_0x1e65('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1e65('0x7'));var controller=require(_0x1e65('0x8'));router[_0x1e65('0x9')]('/',auth[_0x1e65('0xa')](),controller[_0x1e65('0xb')]);router['get']('/describe',auth[_0x1e65('0xa')](),controller['describe']);router[_0x1e65('0x9')](_0x1e65('0xc'),auth[_0x1e65('0xa')](),controller[_0x1e65('0xd')]);router[_0x1e65('0xe')]('/',auth[_0x1e65('0xa')](),controller['create']);router[_0x1e65('0xf')](_0x1e65('0xc'),auth['isAuthenticated'](),controller[_0x1e65('0x10')]);router[_0x1e65('0x11')](_0x1e65('0xc'),auth[_0x1e65('0xa')](),controller['destroy']);module[_0x1e65('0x12')]=router; \ No newline at end of file +var _0x8683=['../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','/describe','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router'];(function(_0x3bdbcf,_0x4cf440){var _0x358bfa=function(_0x1d6ff0){while(--_0x1d6ff0){_0x3bdbcf['push'](_0x3bdbcf['shift']());}};_0x358bfa(++_0x4cf440);}(_0x8683,0xec));var _0x3868=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x8683[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require('multer');var util=require(_0x3868('0x0'));var path=require(_0x3868('0x1'));var timeout=require(_0x3868('0x2'));var express=require('express');var router=express[_0x3868('0x3')]();var auth=require(_0x3868('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3868('0x5'));var controller=require(_0x3868('0x6'));router[_0x3868('0x7')]('/',auth['isAuthenticated'](),controller[_0x3868('0x8')]);router[_0x3868('0x7')](_0x3868('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x3868('0xa'),auth['isAuthenticated'](),controller[_0x3868('0xb')]);router[_0x3868('0xc')]('/',auth[_0x3868('0xd')](),controller[_0x3868('0xe')]);router[_0x3868('0xf')](_0x3868('0xa'),auth['isAuthenticated'](),controller[_0x3868('0x10')]);router[_0x3868('0x11')](_0x3868('0xa'),auth['isAuthenticated'](),controller[_0x3868('0x12')]);module[_0x3868('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 21da5e7..79af400 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 _0x2b65=['sequelize','exports','TEXT','long','STRING'];(function(_0x3c22e0,_0x1dc6ea){var _0x215811=function(_0x1b453c){while(--_0x1b453c){_0x3c22e0['push'](_0x3c22e0['shift']());}};_0x215811(++_0x1dc6ea);}(_0x2b65,0x131));var _0x52b6=function(_0xbbcb36,_0x586383){_0xbbcb36=_0xbbcb36-0x0;var _0x4278ff=_0x2b65[_0xbbcb36];return _0x4278ff;};'use strict';var Sequelize=require(_0x52b6('0x0'));module[_0x52b6('0x1')]={'question':{'type':Sequelize[_0x52b6('0x2')]},'answer':{'type':Sequelize[_0x52b6('0x2')](_0x52b6('0x3'))},'membername':{'type':Sequelize[_0x52b6('0x4')]},'projectname':{'type':Sequelize[_0x52b6('0x4')]},'queue':{'type':Sequelize[_0x52b6('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x52b6('0x4')]},'calleridnum':{'type':Sequelize[_0x52b6('0x4')]},'questionId':{'type':Sequelize[_0x52b6('0x4')]}}; \ No newline at end of file +var _0x174b=['STRING','sequelize','TEXT','long'];(function(_0x162953,_0x213160){var _0x3073fa=function(_0xdc08fc){while(--_0xdc08fc){_0x162953['push'](_0x162953['shift']());}};_0x3073fa(++_0x213160);}(_0x174b,0x19d));var _0xb174=function(_0xcd5766,_0x2f250d){_0xcd5766=_0xcd5766-0x0;var _0x5383af=_0x174b[_0xcd5766];return _0x5383af;};'use strict';var Sequelize=require(_0xb174('0x0'));module['exports']={'question':{'type':Sequelize['TEXT']},'answer':{'type':Sequelize[_0xb174('0x1')](_0xb174('0x2'))},'membername':{'type':Sequelize[_0xb174('0x3')]},'projectname':{'type':Sequelize[_0xb174('0x3')]},'queue':{'type':Sequelize[_0xb174('0x3')]},'uniqueid':{'type':Sequelize[_0xb174('0x3')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0xb174('0x3')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index f58054f..8380cdd 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 _0xf24c=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','save','update','then','destroy','error','stack','name','send','index','JscriptyQuestionReport','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','includeAll','catch','show','include','find','create','body','params','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4f1423,_0x13cc99){var _0x33c235=function(_0x48f704){while(--_0x48f704){_0x4f1423['push'](_0x4f1423['shift']());}};_0x33c235(++_0x13cc99);}(_0xf24c,0x158));var _0xcf24=function(_0x15cbc7,_0x186e17){_0x15cbc7=_0x15cbc7-0x0;var _0x5fdf24=_0xf24c[_0x15cbc7];return _0x5fdf24;};'use strict';var pdf=require(_0xcf24('0x0'));var emlformat=require(_0xcf24('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcf24('0x2'));var jsonpatch=require(_0xcf24('0x3'));var rp=require('request-promise');var moment=require(_0xcf24('0x4'));var BPromise=require(_0xcf24('0x5'));var Mustache=require('mustache');var util=require(_0xcf24('0x6'));var path=require(_0xcf24('0x7'));var sox=require(_0xcf24('0x8'));var csv=require(_0xcf24('0x9'));var ejs=require(_0xcf24('0xa'));var fs=require('fs');var _=require(_0xcf24('0xb'));var squel=require(_0xcf24('0xc'));var crypto=require(_0xcf24('0xd'));var jsforce=require(_0xcf24('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcf24('0x9'));var querystring=require(_0xcf24('0xf'));var Papa=require(_0xcf24('0x10'));var Redis=require(_0xcf24('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xcf24('0x12'));var as=require(_0xcf24('0x13'));var hardwareService=require(_0xcf24('0x14'));var logger=require('../../config/logger')(_0xcf24('0x15'));var utils=require('../../config/utils');var config=require(_0xcf24('0x16'));var licenseUtil=require(_0xcf24('0x17'));var db=require(_0xcf24('0x18'))['db'];function respondWithStatusCode(_0x3f6b61,_0x116569){_0x116569=_0x116569||0xcc;return function(_0x202fc6){if(_0x202fc6){return _0x3f6b61[_0xcf24('0x19')](_0x116569);}return _0x3f6b61[_0xcf24('0x1a')](_0x116569)[_0xcf24('0x1b')]();};}function respondWithResult(_0x162f07,_0xcb9dd5){_0xcb9dd5=_0xcb9dd5||0xc8;return function(_0x324d25){if(_0x324d25){return _0x162f07[_0xcf24('0x1a')](_0xcb9dd5)[_0xcf24('0x1c')](_0x324d25);}};}function respondWithFilteredResult(_0x3e16b8,_0x462b92){return function(_0x27d0ac){if(_0x27d0ac){var _0x7a7453=_0x27d0ac[_0xcf24('0x1d')],_0x269948=_0x462b92[_0xcf24('0x1e')],_0x3ef4dd=_0x462b92['offset']+_0x462b92[_0xcf24('0x1f')],_0x253da3;if(_0x3ef4dd>=_0x7a7453){_0x3ef4dd=_0x7a7453;_0x253da3=0xc8;}else{_0x253da3=0xce;}_0x3e16b8[_0xcf24('0x1a')](_0x253da3);return _0x3e16b8['set']('Content-Range',_0x269948+'-'+_0x3ef4dd+'/'+_0x7a7453)[_0xcf24('0x1c')](_0x27d0ac);}return null;};}function patchUpdates(_0x35dd14){return function(_0x11dcbd){try{jsonpatch[_0xcf24('0x20')](_0x11dcbd,_0x35dd14,!![]);}catch(_0x465e4e){return BPromise[_0xcf24('0x21')](_0x465e4e);}return _0x11dcbd[_0xcf24('0x22')]();};}function saveUpdates(_0x3a1304,_0x213204){return function(_0x4b53ad){if(_0x4b53ad){return _0x4b53ad[_0xcf24('0x23')](_0x3a1304)[_0xcf24('0x24')](function(_0x18d08d){return _0x18d08d;});}return null;};}function removeEntity(_0x47eb41,_0xe9e885){return function(_0x2d95dd){if(_0x2d95dd){return _0x2d95dd[_0xcf24('0x25')]()[_0xcf24('0x24')](function(){_0x47eb41['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x35dc3c,_0x3e9eae){return function(_0x42a7e6){if(!_0x42a7e6){_0x35dc3c[_0xcf24('0x19')](0x194);}return _0x42a7e6;};}function handleError(_0x4f3689,_0x59d0a2){_0x59d0a2=_0x59d0a2||0x1f4;return function(_0x4503f2){logger[_0xcf24('0x26')](_0x4503f2[_0xcf24('0x27')]);if(_0x4503f2[_0xcf24('0x28')]){delete _0x4503f2[_0xcf24('0x28')];}_0x4f3689[_0xcf24('0x1a')](_0x59d0a2)[_0xcf24('0x29')](_0x4503f2);};}exports[_0xcf24('0x2a')]=function(_0x5c79f8,_0x4aa4d4){var _0x3780a2={},_0x258d0a={},_0x4f6594={'count':0x0,'rows':[]};var _0x179ed5=_['map'](db[_0xcf24('0x2b')][_0xcf24('0x2c')],function(_0x57d58f){return{'name':_0x57d58f[_0xcf24('0x2d')],'type':_0x57d58f[_0xcf24('0x2e')][_0xcf24('0x2f')]};});_0x258d0a['model']=_[_0xcf24('0x30')](_0x179ed5,_0xcf24('0x28'));_0x258d0a[_0xcf24('0x31')]=_[_0xcf24('0x32')](_0x5c79f8[_0xcf24('0x31')]);_0x258d0a['filters']=_[_0xcf24('0x33')](_0x258d0a[_0xcf24('0x34')],_0x258d0a['query']);_0x3780a2[_0xcf24('0x35')]=_[_0xcf24('0x33')](_0x258d0a[_0xcf24('0x34')],qs[_0xcf24('0x36')](_0x5c79f8[_0xcf24('0x31')]['fields']));_0x3780a2[_0xcf24('0x35')]=_0x3780a2['attributes'][_0xcf24('0x37')]?_0x3780a2[_0xcf24('0x35')]:_0x258d0a['model'];if(!_0x5c79f8['query'][_0xcf24('0x38')]('nolimit')){_0x3780a2[_0xcf24('0x1f')]=qs[_0xcf24('0x1f')](_0x5c79f8[_0xcf24('0x31')]['limit']);_0x3780a2[_0xcf24('0x1e')]=qs[_0xcf24('0x1e')](_0x5c79f8[_0xcf24('0x31')]['offset']);}_0x3780a2[_0xcf24('0x39')]=qs[_0xcf24('0x3a')](_0x5c79f8[_0xcf24('0x31')][_0xcf24('0x3a')]);_0x3780a2[_0xcf24('0x3b')]=qs[_0xcf24('0x3c')](_['pick'](_0x5c79f8[_0xcf24('0x31')],_0x258d0a[_0xcf24('0x3c')]),_0x179ed5);if(_0x5c79f8[_0xcf24('0x31')][_0xcf24('0x3d')]){_0x3780a2[_0xcf24('0x3b')]=_[_0xcf24('0x3e')](_0x3780a2['where'],{'$or':_[_0xcf24('0x30')](_0x179ed5,function(_0x5cdf53){if(_0x5cdf53[_0xcf24('0x2e')]!=='VIRTUAL'){var _0x5326a4={};_0x5326a4[_0x5cdf53[_0xcf24('0x28')]]={'$like':'%'+_0x5c79f8[_0xcf24('0x31')][_0xcf24('0x3d')]+'%'};return _0x5326a4;}})});}_0x3780a2=_[_0xcf24('0x3e')]({},_0x3780a2,_0x5c79f8[_0xcf24('0x3f')]);var _0x3c61bc={'where':_0x3780a2[_0xcf24('0x3b')]};return db[_0xcf24('0x2b')][_0xcf24('0x1d')](_0x3c61bc)[_0xcf24('0x24')](function(_0xe16534){_0x4f6594[_0xcf24('0x1d')]=_0xe16534;if(_0x5c79f8[_0xcf24('0x31')][_0xcf24('0x40')]){_0x3780a2['include']=[{'all':!![]}];}return db[_0xcf24('0x2b')]['findAll'](_0x3780a2);})[_0xcf24('0x24')](function(_0x2d9348){_0x4f6594['rows']=_0x2d9348;return _0x4f6594;})[_0xcf24('0x24')](respondWithFilteredResult(_0x4aa4d4,_0x3780a2))[_0xcf24('0x41')](handleError(_0x4aa4d4,null));};exports[_0xcf24('0x42')]=function(_0x27d17c,_0x39e403){var _0x110c33={'raw':!![],'where':{'id':_0x27d17c['params']['id']}},_0x4e2006={};_0x4e2006[_0xcf24('0x34')]=_['keys'](db[_0xcf24('0x2b')][_0xcf24('0x2c')]);_0x4e2006[_0xcf24('0x31')]=_[_0xcf24('0x32')](_0x27d17c[_0xcf24('0x31')]);_0x4e2006[_0xcf24('0x3c')]=_[_0xcf24('0x33')](_0x4e2006[_0xcf24('0x34')],_0x4e2006['query']);_0x110c33[_0xcf24('0x35')]=_['intersection'](_0x4e2006['model'],qs[_0xcf24('0x36')](_0x27d17c[_0xcf24('0x31')][_0xcf24('0x36')]));_0x110c33[_0xcf24('0x35')]=_0x110c33['attributes'][_0xcf24('0x37')]?_0x110c33[_0xcf24('0x35')]:_0x4e2006[_0xcf24('0x34')];if(_0x27d17c[_0xcf24('0x31')][_0xcf24('0x40')]){_0x110c33[_0xcf24('0x43')]=[{'all':!![]}];}_0x110c33=_[_0xcf24('0x3e')]({},_0x110c33,_0x27d17c[_0xcf24('0x3f')]);return db[_0xcf24('0x2b')][_0xcf24('0x44')](_0x110c33)[_0xcf24('0x24')](handleEntityNotFound(_0x39e403,null))['then'](respondWithResult(_0x39e403,null))[_0xcf24('0x41')](handleError(_0x39e403,null));};exports['create']=function(_0x122374,_0x52897){return db['JscriptyQuestionReport'][_0xcf24('0x45')](_0x122374[_0xcf24('0x46')],{})['then'](respondWithResult(_0x52897,0xc9))[_0xcf24('0x41')](handleError(_0x52897,null));};exports['update']=function(_0x3f785a,_0x386080){if(_0x3f785a[_0xcf24('0x46')]['id']){delete _0x3f785a['body']['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x3f785a[_0xcf24('0x47')]['id']}})[_0xcf24('0x24')](handleEntityNotFound(_0x386080,null))[_0xcf24('0x24')](saveUpdates(_0x3f785a[_0xcf24('0x46')],null))[_0xcf24('0x24')](respondWithResult(_0x386080,null))[_0xcf24('0x41')](handleError(_0x386080,null));};exports[_0xcf24('0x25')]=function(_0x16d75e,_0x44bfb8){return db['JscriptyQuestionReport'][_0xcf24('0x44')]({'where':{'id':_0x16d75e[_0xcf24('0x47')]['id']}})[_0xcf24('0x24')](handleEntityNotFound(_0x44bfb8,null))[_0xcf24('0x24')](removeEntity(_0x44bfb8,null))[_0xcf24('0x41')](handleError(_0x44bfb8,null));};exports[_0xcf24('0x48')]=function(_0x2c1bfb,_0x51011f){return db['JscriptyQuestionReport'][_0xcf24('0x48')]()['then'](respondWithResult(_0x51011f,null))[_0xcf24('0x41')](handleError(_0x51011f,null));}; \ No newline at end of file +var _0xaf15=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','options','includeAll','include','catch','show','params','filters','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs'];(function(_0x4bc65f,_0x39ec43){var _0x44f85f=function(_0x175343){while(--_0x175343){_0x4bc65f['push'](_0x4bc65f['shift']());}};_0x44f85f(++_0x39ec43);}(_0xaf15,0xd4));var _0x5af1=function(_0xdeee65,_0x5aeb97){_0xdeee65=_0xdeee65-0x0;var _0x266eb9=_0xaf15[_0xdeee65];return _0x266eb9;};'use strict';var pdf=require(_0x5af1('0x0'));var emlformat=require(_0x5af1('0x1'));var rimraf=require(_0x5af1('0x2'));var zipdir=require(_0x5af1('0x3'));var jsonpatch=require(_0x5af1('0x4'));var rp=require(_0x5af1('0x5'));var moment=require(_0x5af1('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x5af1('0x7'));var util=require(_0x5af1('0x8'));var path=require(_0x5af1('0x9'));var sox=require('sox');var csv=require(_0x5af1('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5af1('0xb'));var squel=require(_0x5af1('0xc'));var crypto=require(_0x5af1('0xd'));var jsforce=require(_0x5af1('0xe'));var deskjs=require(_0x5af1('0xf'));var toCsv=require(_0x5af1('0xa'));var querystring=require(_0x5af1('0x10'));var Papa=require('papaparse');var Redis=require(_0x5af1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5af1('0x12'));var as=require(_0x5af1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5af1('0x14'))(_0x5af1('0x15'));var utils=require(_0x5af1('0x16'));var config=require(_0x5af1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5af1('0x18'))['db'];function respondWithStatusCode(_0x3cd36c,_0xb634ae){_0xb634ae=_0xb634ae||0xcc;return function(_0x15df43){if(_0x15df43){return _0x3cd36c[_0x5af1('0x19')](_0xb634ae);}return _0x3cd36c[_0x5af1('0x1a')](_0xb634ae)[_0x5af1('0x1b')]();};}function respondWithResult(_0x3867b2,_0x5ef23c){_0x5ef23c=_0x5ef23c||0xc8;return function(_0x58a8ab){if(_0x58a8ab){return _0x3867b2[_0x5af1('0x1a')](_0x5ef23c)[_0x5af1('0x1c')](_0x58a8ab);}};}function respondWithFilteredResult(_0x1455d6,_0xf912a6){return function(_0x47cc5a){if(_0x47cc5a){var _0x2a3ab4=_0x47cc5a[_0x5af1('0x1d')],_0xa5cb65=_0xf912a6['offset'],_0x43f802=_0xf912a6[_0x5af1('0x1e')]+_0xf912a6[_0x5af1('0x1f')],_0xc18220;if(_0x43f802>=_0x2a3ab4){_0x43f802=_0x2a3ab4;_0xc18220=0xc8;}else{_0xc18220=0xce;}_0x1455d6[_0x5af1('0x1a')](_0xc18220);return _0x1455d6[_0x5af1('0x20')](_0x5af1('0x21'),_0xa5cb65+'-'+_0x43f802+'/'+_0x2a3ab4)['json'](_0x47cc5a);}return null;};}function patchUpdates(_0x2cdc0a){return function(_0x2b2511){try{jsonpatch[_0x5af1('0x22')](_0x2b2511,_0x2cdc0a,!![]);}catch(_0x29a4a2){return BPromise[_0x5af1('0x23')](_0x29a4a2);}return _0x2b2511[_0x5af1('0x24')]();};}function saveUpdates(_0x564907,_0x45710c){return function(_0x3c0b84){if(_0x3c0b84){return _0x3c0b84[_0x5af1('0x25')](_0x564907)[_0x5af1('0x26')](function(_0x27aad4){return _0x27aad4;});}return null;};}function removeEntity(_0x532850,_0x56042a){return function(_0x140bd4){if(_0x140bd4){return _0x140bd4[_0x5af1('0x27')]()[_0x5af1('0x26')](function(){_0x532850[_0x5af1('0x1a')](0xcc)[_0x5af1('0x1b')]();});}};}function handleEntityNotFound(_0x11a812,_0xcff6b9){return function(_0xa0d1ec){if(!_0xa0d1ec){_0x11a812[_0x5af1('0x19')](0x194);}return _0xa0d1ec;};}function handleError(_0xd90aa9,_0x5af6aa){_0x5af6aa=_0x5af6aa||0x1f4;return function(_0x4300e5){logger[_0x5af1('0x28')](_0x4300e5[_0x5af1('0x29')]);if(_0x4300e5[_0x5af1('0x2a')]){delete _0x4300e5[_0x5af1('0x2a')];}_0xd90aa9[_0x5af1('0x1a')](_0x5af6aa)[_0x5af1('0x2b')](_0x4300e5);};}exports[_0x5af1('0x2c')]=function(_0x408cc0,_0x575d99){var _0x1c0660={},_0x13c572={},_0x503aee={'count':0x0,'rows':[]};var _0x116f8d=_[_0x5af1('0x2d')](db[_0x5af1('0x2e')][_0x5af1('0x2f')],function(_0xe9b72b){return{'name':_0xe9b72b[_0x5af1('0x30')],'type':_0xe9b72b['type'][_0x5af1('0x31')]};});_0x13c572['model']=_[_0x5af1('0x2d')](_0x116f8d,_0x5af1('0x2a'));_0x13c572[_0x5af1('0x32')]=_[_0x5af1('0x33')](_0x408cc0[_0x5af1('0x32')]);_0x13c572['filters']=_[_0x5af1('0x34')](_0x13c572[_0x5af1('0x35')],_0x13c572[_0x5af1('0x32')]);_0x1c0660[_0x5af1('0x36')]=_[_0x5af1('0x34')](_0x13c572[_0x5af1('0x35')],qs[_0x5af1('0x37')](_0x408cc0[_0x5af1('0x32')][_0x5af1('0x37')]));_0x1c0660['attributes']=_0x1c0660[_0x5af1('0x36')]['length']?_0x1c0660[_0x5af1('0x36')]:_0x13c572[_0x5af1('0x35')];if(!_0x408cc0[_0x5af1('0x32')][_0x5af1('0x38')](_0x5af1('0x39'))){_0x1c0660['limit']=qs[_0x5af1('0x1f')](_0x408cc0[_0x5af1('0x32')][_0x5af1('0x1f')]);_0x1c0660['offset']=qs[_0x5af1('0x1e')](_0x408cc0['query']['offset']);}_0x1c0660[_0x5af1('0x3a')]=qs[_0x5af1('0x3b')](_0x408cc0[_0x5af1('0x32')]['sort']);_0x1c0660[_0x5af1('0x3c')]=qs['filters'](_[_0x5af1('0x3d')](_0x408cc0[_0x5af1('0x32')],_0x13c572['filters']),_0x116f8d);if(_0x408cc0[_0x5af1('0x32')]['filter']){_0x1c0660['where']=_[_0x5af1('0x3e')](_0x1c0660[_0x5af1('0x3c')],{'$or':_[_0x5af1('0x2d')](_0x116f8d,function(_0x5b593e){if(_0x5b593e[_0x5af1('0x3f')]!==_0x5af1('0x40')){var _0x34175b={};_0x34175b[_0x5b593e[_0x5af1('0x2a')]]={'$like':'%'+_0x408cc0[_0x5af1('0x32')]['filter']+'%'};return _0x34175b;}})});}_0x1c0660=_[_0x5af1('0x3e')]({},_0x1c0660,_0x408cc0[_0x5af1('0x41')]);var _0x1acd91={'where':_0x1c0660[_0x5af1('0x3c')]};return db['JscriptyQuestionReport']['count'](_0x1acd91)['then'](function(_0x4da69f){_0x503aee[_0x5af1('0x1d')]=_0x4da69f;if(_0x408cc0[_0x5af1('0x32')][_0x5af1('0x42')]){_0x1c0660[_0x5af1('0x43')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x1c0660);})[_0x5af1('0x26')](function(_0x33cd9b){_0x503aee['rows']=_0x33cd9b;return _0x503aee;})[_0x5af1('0x26')](respondWithFilteredResult(_0x575d99,_0x1c0660))[_0x5af1('0x44')](handleError(_0x575d99,null));};exports[_0x5af1('0x45')]=function(_0x5722cb,_0x12225f){var _0x1748f7={'raw':!![],'where':{'id':_0x5722cb[_0x5af1('0x46')]['id']}},_0x1dfaab={};_0x1dfaab[_0x5af1('0x35')]=_[_0x5af1('0x33')](db[_0x5af1('0x2e')][_0x5af1('0x2f')]);_0x1dfaab[_0x5af1('0x32')]=_['keys'](_0x5722cb[_0x5af1('0x32')]);_0x1dfaab[_0x5af1('0x47')]=_[_0x5af1('0x34')](_0x1dfaab[_0x5af1('0x35')],_0x1dfaab[_0x5af1('0x32')]);_0x1748f7[_0x5af1('0x36')]=_[_0x5af1('0x34')](_0x1dfaab['model'],qs[_0x5af1('0x37')](_0x5722cb['query'][_0x5af1('0x37')]));_0x1748f7[_0x5af1('0x36')]=_0x1748f7[_0x5af1('0x36')][_0x5af1('0x48')]?_0x1748f7['attributes']:_0x1dfaab[_0x5af1('0x35')];if(_0x5722cb[_0x5af1('0x32')]['includeAll']){_0x1748f7[_0x5af1('0x43')]=[{'all':!![]}];}_0x1748f7=_[_0x5af1('0x3e')]({},_0x1748f7,_0x5722cb['options']);return db[_0x5af1('0x2e')][_0x5af1('0x49')](_0x1748f7)[_0x5af1('0x26')](handleEntityNotFound(_0x12225f,null))[_0x5af1('0x26')](respondWithResult(_0x12225f,null))[_0x5af1('0x44')](handleError(_0x12225f,null));};exports[_0x5af1('0x4a')]=function(_0x149cd5,_0x5a4de8){return db['JscriptyQuestionReport'][_0x5af1('0x4a')](_0x149cd5[_0x5af1('0x4b')],{})['then'](respondWithResult(_0x5a4de8,0xc9))[_0x5af1('0x44')](handleError(_0x5a4de8,null));};exports['update']=function(_0x4d220f,_0x1c9f0f){if(_0x4d220f[_0x5af1('0x4b')]['id']){delete _0x4d220f[_0x5af1('0x4b')]['id'];}return db['JscriptyQuestionReport'][_0x5af1('0x49')]({'where':{'id':_0x4d220f[_0x5af1('0x46')]['id']}})['then'](handleEntityNotFound(_0x1c9f0f,null))[_0x5af1('0x26')](saveUpdates(_0x4d220f['body'],null))[_0x5af1('0x26')](respondWithResult(_0x1c9f0f,null))[_0x5af1('0x44')](handleError(_0x1c9f0f,null));};exports[_0x5af1('0x27')]=function(_0x283ea6,_0x3f2c4b){return db[_0x5af1('0x2e')]['find']({'where':{'id':_0x283ea6[_0x5af1('0x46')]['id']}})[_0x5af1('0x26')](handleEntityNotFound(_0x3f2c4b,null))[_0x5af1('0x26')](removeEntity(_0x3f2c4b,null))[_0x5af1('0x44')](handleError(_0x3f2c4b,null));};exports[_0x5af1('0x4c')]=function(_0x3d8aa3,_0x17888e){return db[_0x5af1('0x2e')][_0x5af1('0x4c')]()[_0x5af1('0x26')](respondWithResult(_0x17888e,null))['catch'](handleError(_0x17888e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 6f87ed9..65f2424 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 _0x24d9=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','util'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x24d9,0xc2));var _0x924d=function(_0x281e4b,_0x13cc6a){_0x281e4b=_0x281e4b-0x0;var _0x53b735=_0x24d9[_0x281e4b];return _0x53b735;};'use strict';var _=require('lodash');var util=require(_0x924d('0x0'));var logger=require(_0x924d('0x1'))(_0x924d('0x2'));var moment=require(_0x924d('0x3'));var BPromise=require(_0x924d('0x4'));var rp=require(_0x924d('0x5'));var fs=require('fs');var path=require(_0x924d('0x6'));var rimraf=require('rimraf');var config=require(_0x924d('0x7'));var attributes=require(_0x924d('0x8'));module[_0x924d('0x9')]=function(_0x34f4c2,_0x1c02ee){return _0x34f4c2[_0x924d('0xa')](_0x924d('0xb'),attributes,{'tableName':_0x924d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x785d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash'];(function(_0x45016e,_0x9517fb){var _0x260948=function(_0x400896){while(--_0x400896){_0x45016e['push'](_0x45016e['shift']());}};_0x260948(++_0x9517fb);}(_0x785d,0x1b1));var _0xd785=function(_0x2cf49c,_0x3c27fd){_0x2cf49c=_0x2cf49c-0x0;var _0x4f755c=_0x785d[_0x2cf49c];return _0x4f755c;};'use strict';var _=require(_0xd785('0x0'));var util=require('util');var logger=require(_0xd785('0x1'))(_0xd785('0x2'));var moment=require(_0xd785('0x3'));var BPromise=require(_0xd785('0x4'));var rp=require(_0xd785('0x5'));var fs=require('fs');var path=require(_0xd785('0x6'));var rimraf=require(_0xd785('0x7'));var config=require(_0xd785('0x8'));var attributes=require(_0xd785('0x9'));module[_0xd785('0xa')]=function(_0x422164,_0x315719){return _0x422164[_0xd785('0xb')](_0xd785('0xc'),attributes,{'tableName':_0xd785('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 390f7d8..1b7d821 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 _0x6311=['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','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x6311,0x183));var _0x1631=function(_0x439af6,_0x479095){_0x439af6=_0x439af6-0x0;var _0x259601=_0x6311[_0x439af6];return _0x259601;};'use strict';var _=require(_0x1631('0x0'));var util=require(_0x1631('0x1'));var moment=require(_0x1631('0x2'));var BPromise=require(_0x1631('0x3'));var rs=require(_0x1631('0x4'));var fs=require('fs');var Redis=require(_0x1631('0x5'));var db=require(_0x1631('0x6'))['db'];var utils=require(_0x1631('0x7'));var logger=require(_0x1631('0x8'))(_0x1631('0x9'));var config=require(_0x1631('0xa'));var jayson=require(_0x1631('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x81c39c,_0x2dbb25,_0x275764){return new BPromise(function(_0x4d128f,_0x391963){return client[_0x1631('0xc')](_0x81c39c,_0x275764)[_0x1631('0xd')](function(_0x179d13){logger[_0x1631('0xe')](_0x1631('0xf'),_0x2dbb25,_0x1631('0x10'));logger[_0x1631('0x11')](_0x1631('0x12'),_0x2dbb25,_0x1631('0x10'),JSON[_0x1631('0x13')](_0x179d13));if(_0x179d13[_0x1631('0x14')]){if(_0x179d13[_0x1631('0x14')][_0x1631('0x15')]===0x1f4){logger[_0x1631('0x14')](_0x1631('0xf'),_0x2dbb25,_0x179d13[_0x1631('0x14')][_0x1631('0x16')]);return _0x391963(_0x179d13[_0x1631('0x14')]['message']);}logger['error'](_0x1631('0xf'),_0x2dbb25,_0x179d13[_0x1631('0x14')]['message']);return _0x4d128f(_0x179d13['error']['message']);}else{logger[_0x1631('0xe')](_0x1631('0xf'),_0x2dbb25,_0x1631('0x10'));_0x4d128f(_0x179d13[_0x1631('0x17')][_0x1631('0x16')]);}})[_0x1631('0x18')](function(_0x306214){logger[_0x1631('0x14')](_0x1631('0xf'),_0x2dbb25,_0x306214);_0x391963(_0x306214);});});} \ No newline at end of file +var _0xce10=['http','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xce10,0xe4));var _0x0ce1=function(_0x43aee5,_0x11268b){_0x43aee5=_0x43aee5-0x0;var _0x76d1d0=_0xce10[_0x43aee5];return _0x76d1d0;};'use strict';var _=require(_0x0ce1('0x0'));var util=require(_0x0ce1('0x1'));var moment=require(_0x0ce1('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ce1('0x3'));var fs=require('fs');var Redis=require(_0x0ce1('0x4'));var db=require(_0x0ce1('0x5'))['db'];var utils=require(_0x0ce1('0x6'));var logger=require(_0x0ce1('0x7'))(_0x0ce1('0x8'));var config=require(_0x0ce1('0x9'));var jayson=require(_0x0ce1('0xa'));var client=jayson[_0x0ce1('0xb')][_0x0ce1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12cd7e,_0x4b20e9,_0x3dd9c2){return new BPromise(function(_0x1630f2,_0x1da96f){return client['request'](_0x12cd7e,_0x3dd9c2)[_0x0ce1('0xd')](function(_0x5cd2ec){logger[_0x0ce1('0xe')](_0x0ce1('0xf'),_0x4b20e9,_0x0ce1('0x10'));logger[_0x0ce1('0x11')](_0x0ce1('0x12'),_0x4b20e9,_0x0ce1('0x10'),JSON['stringify'](_0x5cd2ec));if(_0x5cd2ec[_0x0ce1('0x13')]){if(_0x5cd2ec[_0x0ce1('0x13')][_0x0ce1('0x14')]===0x1f4){logger['error'](_0x0ce1('0xf'),_0x4b20e9,_0x5cd2ec[_0x0ce1('0x13')][_0x0ce1('0x15')]);return _0x1da96f(_0x5cd2ec[_0x0ce1('0x13')][_0x0ce1('0x15')]);}logger['error'](_0x0ce1('0xf'),_0x4b20e9,_0x5cd2ec['error'][_0x0ce1('0x15')]);return _0x1630f2(_0x5cd2ec[_0x0ce1('0x13')][_0x0ce1('0x15')]);}else{logger['info'](_0x0ce1('0xf'),_0x4b20e9,'request\x20sent');_0x1630f2(_0x5cd2ec[_0x0ce1('0x16')][_0x0ce1('0x15')]);}})[_0x0ce1('0x17')](function(_0x4ebceb){logger['error'](_0x0ce1('0xf'),_0x4b20e9,_0x4ebceb);_0x1da96f(_0x4ebceb);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index ca6231a..777e73b 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 _0x48ea=['update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','post'];(function(_0x938436,_0x31990d){var _0x4543e5=function(_0x46c612){while(--_0x46c612){_0x938436['push'](_0x938436['shift']());}};_0x4543e5(++_0x31990d);}(_0x48ea,0x9c));var _0xa48e=function(_0x12cfda,_0x40da9c){_0x12cfda=_0x12cfda-0x0;var _0x40ac4b=_0x48ea[_0x12cfda];return _0x40ac4b;};'use strict';var multer=require(_0xa48e('0x0'));var util=require('util');var path=require(_0xa48e('0x1'));var timeout=require(_0xa48e('0x2'));var express=require(_0xa48e('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa48e('0x4'));var config=require('../../config/environment');var controller=require(_0xa48e('0x5'));router[_0xa48e('0x6')]('/',auth[_0xa48e('0x7')](),controller[_0xa48e('0x8')]);router[_0xa48e('0x6')](_0xa48e('0x9'),auth[_0xa48e('0x7')](),controller[_0xa48e('0xa')]);router[_0xa48e('0x6')](_0xa48e('0xb'),auth[_0xa48e('0x7')](),controller[_0xa48e('0xc')]);router[_0xa48e('0x6')](_0xa48e('0xd'),auth[_0xa48e('0x7')](),controller['getQuestions']);router[_0xa48e('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa48e('0xb'),auth[_0xa48e('0x7')](),controller[_0xa48e('0xf')]);router[_0xa48e('0x10')]('/:id',auth[_0xa48e('0x7')](),controller[_0xa48e('0x11')]);module[_0xa48e('0x12')]=router; \ No newline at end of file +var _0xbeea=['express','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','multer','path','connect-timeout'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0xbeea,0xb1));var _0xabee=function(_0x100770,_0x2a6617){_0x100770=_0x100770-0x0;var _0x26c777=_0xbeea[_0x100770];return _0x26c777;};'use strict';var multer=require(_0xabee('0x0'));var util=require('util');var path=require(_0xabee('0x1'));var timeout=require(_0xabee('0x2'));var express=require(_0xabee('0x3'));var router=express['Router']();var auth=require(_0xabee('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xabee('0x5'));var controller=require(_0xabee('0x6'));router[_0xabee('0x7')]('/',auth[_0xabee('0x8')](),controller[_0xabee('0x9')]);router['get']('/describe',auth[_0xabee('0x8')](),controller[_0xabee('0xa')]);router['get'](_0xabee('0xb'),auth['isAuthenticated'](),controller[_0xabee('0xc')]);router[_0xabee('0x7')](_0xabee('0xd'),auth[_0xabee('0x8')](),controller[_0xabee('0xe')]);router[_0xabee('0xf')]('/',auth['isAuthenticated'](),controller[_0xabee('0x10')]);router[_0xabee('0x11')](_0xabee('0xb'),auth['isAuthenticated'](),controller[_0xabee('0x12')]);router[_0xabee('0x13')](_0xabee('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 68a9d7b..704ba5c 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 _0x6798=['STRING','BOOLEAN','moment','sequelize','setDataValue','starttime','endtime','format','DATE'];(function(_0x332e80,_0x4c9692){var _0x38a443=function(_0x10caff){while(--_0x10caff){_0x332e80['push'](_0x332e80['shift']());}};_0x38a443(++_0x4c9692);}(_0x6798,0x9b));var _0x8679=function(_0x4f3802,_0x5d43f8){_0x4f3802=_0x4f3802-0x0;var _0x2b4049=_0x6798[_0x4f3802];return _0x2b4049;};'use strict';var moment=require(_0x8679('0x0'));var Sequelize=require(_0x8679('0x1'));module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x1270d4){this[_0x8679('0x2')](_0x8679('0x3'),_0x1270d4);this['setDataValue'](_0x8679('0x4'),moment()[_0x8679('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x8679('0x6')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x8679('0x7')]},'calleridnum':{'type':Sequelize[_0x8679('0x7')]},'completed':{'type':Sequelize[_0x8679('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x96d8=['exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','sequelize'];(function(_0x4cada4,_0x2505af){var _0x1faee5=function(_0x2c26a0){while(--_0x2c26a0){_0x4cada4['push'](_0x4cada4['shift']());}};_0x1faee5(++_0x2505af);}(_0x96d8,0x81));var _0x896d=function(_0x2bf038,_0x3ecaf4){_0x2bf038=_0x2bf038-0x0;var _0x2bb8ad=_0x96d8[_0x2bf038];return _0x2bb8ad;};'use strict';var moment=require('moment');var Sequelize=require(_0x896d('0x0'));module[_0x896d('0x1')]={'starttime':{'type':Sequelize[_0x896d('0x2')],'set':function(_0x5a138f){this[_0x896d('0x3')](_0x896d('0x4'),_0x5a138f);this[_0x896d('0x3')](_0x896d('0x5'),moment()[_0x896d('0x6')](_0x896d('0x7')));}},'endtime':{'type':Sequelize[_0x896d('0x2')]},'membername':{'type':Sequelize[_0x896d('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x896d('0x8')]},'uniqueid':{'type':Sequelize[_0x896d('0x8')]},'calleridname':{'type':Sequelize[_0x896d('0x8')]},'calleridnum':{'type':Sequelize[_0x896d('0x8')]},'completed':{'type':Sequelize[_0x896d('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 66bfb09..8183b3e 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 _0xc77f=['error','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','type','VIRTUAL','options','where','includeAll','include','catch','params','filters','find','create','body','describe','findOne','JscriptyQuestionReport','length','SessionId','findAll','rows','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','sox','to-csv','ejs','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0xe0a57f,_0x29fecf){var _0x16f834=function(_0x29edcc){while(--_0x29edcc){_0xe0a57f['push'](_0xe0a57f['shift']());}};_0x16f834(++_0x29fecf);}(_0xc77f,0x161));var _0xfc77=function(_0x595013,_0x65a215){_0x595013=_0x595013-0x0;var _0x2a29e3=_0xc77f[_0x595013];return _0x2a29e3;};'use strict';var pdf=require(_0xfc77('0x0'));var emlformat=require(_0xfc77('0x1'));var rimraf=require(_0xfc77('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfc77('0x3'));var moment=require(_0xfc77('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xfc77('0x5'));var util=require(_0xfc77('0x6'));var path=require('path');var sox=require(_0xfc77('0x7'));var csv=require(_0xfc77('0x8'));var ejs=require(_0xfc77('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfc77('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xfc77('0x8'));var querystring=require(_0xfc77('0xb'));var Papa=require(_0xfc77('0xc'));var Redis=require(_0xfc77('0xd'));var authService=require(_0xfc77('0xe'));var qs=require(_0xfc77('0xf'));var as=require(_0xfc77('0x10'));var hardwareService=require(_0xfc77('0x11'));var logger=require(_0xfc77('0x12'))(_0xfc77('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfc77('0x14'));var db=require(_0xfc77('0x15'))['db'];function respondWithStatusCode(_0x3861dc,_0x5fbc1e){_0x5fbc1e=_0x5fbc1e||0xcc;return function(_0x2902bd){if(_0x2902bd){return _0x3861dc[_0xfc77('0x16')](_0x5fbc1e);}return _0x3861dc[_0xfc77('0x17')](_0x5fbc1e)[_0xfc77('0x18')]();};}function respondWithResult(_0x45f8ab,_0x5ef4f4){_0x5ef4f4=_0x5ef4f4||0xc8;return function(_0x18bbe8){if(_0x18bbe8){return _0x45f8ab[_0xfc77('0x17')](_0x5ef4f4)[_0xfc77('0x19')](_0x18bbe8);}};}function respondWithFilteredResult(_0x1394f1,_0x404bf7){return function(_0x6aee1f){if(_0x6aee1f){var _0x3ba3ea=_0x6aee1f[_0xfc77('0x1a')],_0x20002e=_0x404bf7[_0xfc77('0x1b')],_0x3b7ee6=_0x404bf7[_0xfc77('0x1b')]+_0x404bf7[_0xfc77('0x1c')],_0x59dff0;if(_0x3b7ee6>=_0x3ba3ea){_0x3b7ee6=_0x3ba3ea;_0x59dff0=0xc8;}else{_0x59dff0=0xce;}_0x1394f1[_0xfc77('0x17')](_0x59dff0);return _0x1394f1[_0xfc77('0x1d')](_0xfc77('0x1e'),_0x20002e+'-'+_0x3b7ee6+'/'+_0x3ba3ea)['json'](_0x6aee1f);}return null;};}function patchUpdates(_0x23a415){return function(_0x35ba09){try{jsonpatch[_0xfc77('0x1f')](_0x35ba09,_0x23a415,!![]);}catch(_0xa689e5){return BPromise[_0xfc77('0x20')](_0xa689e5);}return _0x35ba09[_0xfc77('0x21')]();};}function saveUpdates(_0x516871,_0x3c768f){return function(_0x142199){if(_0x142199){return _0x142199[_0xfc77('0x22')](_0x516871)[_0xfc77('0x23')](function(_0x2312eb){return _0x2312eb;});}return null;};}function removeEntity(_0x29e4db,_0x1fb4f2){return function(_0x18921e){if(_0x18921e){return _0x18921e[_0xfc77('0x24')]()[_0xfc77('0x23')](function(){_0x29e4db['status'](0xcc)[_0xfc77('0x18')]();});}};}function handleEntityNotFound(_0x4ebea8,_0x4b088b){return function(_0x1ff0f1){if(!_0x1ff0f1){_0x4ebea8[_0xfc77('0x16')](0x194);}return _0x1ff0f1;};}function handleError(_0x21e556,_0x42ac5f){_0x42ac5f=_0x42ac5f||0x1f4;return function(_0x4e8402){logger[_0xfc77('0x25')](_0x4e8402['stack']);if(_0x4e8402[_0xfc77('0x26')]){delete _0x4e8402[_0xfc77('0x26')];}_0x21e556[_0xfc77('0x17')](_0x42ac5f)[_0xfc77('0x27')](_0x4e8402);};}exports[_0xfc77('0x28')]=function(_0x38cb52,_0x34d652){var _0x10996f={},_0x120f32={},_0x58aa92={'count':0x0,'rows':[]};var _0xbe82b5=_[_0xfc77('0x29')](db[_0xfc77('0x2a')][_0xfc77('0x2b')],function(_0x866a11){return{'name':_0x866a11[_0xfc77('0x2c')],'type':_0x866a11['type'][_0xfc77('0x2d')]};});_0x120f32[_0xfc77('0x2e')]=_[_0xfc77('0x29')](_0xbe82b5,'name');_0x120f32[_0xfc77('0x2f')]=_[_0xfc77('0x30')](_0x38cb52[_0xfc77('0x2f')]);_0x120f32['filters']=_[_0xfc77('0x31')](_0x120f32['model'],_0x120f32[_0xfc77('0x2f')]);_0x10996f[_0xfc77('0x32')]=_[_0xfc77('0x31')](_0x120f32[_0xfc77('0x2e')],qs['fields'](_0x38cb52[_0xfc77('0x2f')][_0xfc77('0x33')]));_0x10996f[_0xfc77('0x32')]=_0x10996f[_0xfc77('0x32')]['length']?_0x10996f['attributes']:_0x120f32[_0xfc77('0x2e')];if(!_0x38cb52[_0xfc77('0x2f')][_0xfc77('0x34')](_0xfc77('0x35'))){_0x10996f[_0xfc77('0x1c')]=qs['limit'](_0x38cb52[_0xfc77('0x2f')][_0xfc77('0x1c')]);_0x10996f[_0xfc77('0x1b')]=qs['offset'](_0x38cb52[_0xfc77('0x2f')][_0xfc77('0x1b')]);}_0x10996f[_0xfc77('0x36')]=qs[_0xfc77('0x37')](_0x38cb52[_0xfc77('0x2f')][_0xfc77('0x37')]);_0x10996f['where']=qs['filters'](_[_0xfc77('0x38')](_0x38cb52[_0xfc77('0x2f')],_0x120f32['filters']),_0xbe82b5);if(_0x38cb52[_0xfc77('0x2f')][_0xfc77('0x39')]){_0x10996f['where']=_[_0xfc77('0x3a')](_0x10996f['where'],{'$or':_[_0xfc77('0x29')](_0xbe82b5,function(_0x4fedf6){if(_0x4fedf6[_0xfc77('0x3b')]!==_0xfc77('0x3c')){var _0x309a72={};_0x309a72[_0x4fedf6[_0xfc77('0x26')]]={'$like':'%'+_0x38cb52[_0xfc77('0x2f')][_0xfc77('0x39')]+'%'};return _0x309a72;}})});}_0x10996f=_[_0xfc77('0x3a')]({},_0x10996f,_0x38cb52[_0xfc77('0x3d')]);var _0x5486ee={'where':_0x10996f[_0xfc77('0x3e')]};return db[_0xfc77('0x2a')][_0xfc77('0x1a')](_0x5486ee)[_0xfc77('0x23')](function(_0x366c53){_0x58aa92['count']=_0x366c53;if(_0x38cb52[_0xfc77('0x2f')][_0xfc77('0x3f')]){_0x10996f[_0xfc77('0x40')]=[{'all':!![]}];}return db[_0xfc77('0x2a')]['findAll'](_0x10996f);})[_0xfc77('0x23')](function(_0x2a8dba){_0x58aa92['rows']=_0x2a8dba;return _0x58aa92;})[_0xfc77('0x23')](respondWithFilteredResult(_0x34d652,_0x10996f))[_0xfc77('0x41')](handleError(_0x34d652,null));};exports['show']=function(_0x2fcc25,_0x45cfb0){var _0x5121f5={'raw':!![],'where':{'id':_0x2fcc25[_0xfc77('0x42')]['id']}},_0x1a6d56={};_0x1a6d56['model']=_[_0xfc77('0x30')](db['JscriptySessionReport'][_0xfc77('0x2b')]);_0x1a6d56[_0xfc77('0x2f')]=_['keys'](_0x2fcc25[_0xfc77('0x2f')]);_0x1a6d56[_0xfc77('0x43')]=_['intersection'](_0x1a6d56['model'],_0x1a6d56[_0xfc77('0x2f')]);_0x5121f5['attributes']=_[_0xfc77('0x31')](_0x1a6d56[_0xfc77('0x2e')],qs[_0xfc77('0x33')](_0x2fcc25[_0xfc77('0x2f')][_0xfc77('0x33')]));_0x5121f5[_0xfc77('0x32')]=_0x5121f5[_0xfc77('0x32')]['length']?_0x5121f5[_0xfc77('0x32')]:_0x1a6d56[_0xfc77('0x2e')];if(_0x2fcc25[_0xfc77('0x2f')][_0xfc77('0x3f')]){_0x5121f5[_0xfc77('0x40')]=[{'all':!![]}];}_0x5121f5=_[_0xfc77('0x3a')]({},_0x5121f5,_0x2fcc25[_0xfc77('0x3d')]);return db[_0xfc77('0x2a')][_0xfc77('0x44')](_0x5121f5)[_0xfc77('0x23')](handleEntityNotFound(_0x45cfb0,null))[_0xfc77('0x23')](respondWithResult(_0x45cfb0,null))['catch'](handleError(_0x45cfb0,null));};exports['create']=function(_0x19a218,_0x336f52){return db[_0xfc77('0x2a')][_0xfc77('0x45')](_0x19a218[_0xfc77('0x46')],{})[_0xfc77('0x23')](respondWithResult(_0x336f52,0xc9))[_0xfc77('0x41')](handleError(_0x336f52,null));};exports[_0xfc77('0x22')]=function(_0x25e419,_0x1dae52){if(_0x25e419['body']['id']){delete _0x25e419['body']['id'];}return db['JscriptySessionReport'][_0xfc77('0x44')]({'where':{'id':_0x25e419[_0xfc77('0x42')]['id']}})[_0xfc77('0x23')](handleEntityNotFound(_0x1dae52,null))[_0xfc77('0x23')](saveUpdates(_0x25e419[_0xfc77('0x46')],null))[_0xfc77('0x23')](respondWithResult(_0x1dae52,null))['catch'](handleError(_0x1dae52,null));};exports['destroy']=function(_0x5bb78c,_0x153d2b){return db[_0xfc77('0x2a')]['find']({'where':{'id':_0x5bb78c[_0xfc77('0x42')]['id']}})['then'](handleEntityNotFound(_0x153d2b,null))['then'](removeEntity(_0x153d2b,null))['catch'](handleError(_0x153d2b,null));};exports['describe']=function(_0x58ea8a,_0x3ecde4){return db['JscriptySessionReport'][_0xfc77('0x47')]()[_0xfc77('0x23')](respondWithResult(_0x3ecde4,null))[_0xfc77('0x41')](handleError(_0x3ecde4,null));};exports['getQuestions']=function(_0x4b12c5,_0x5c167f,_0x201260){var _0x51eb95={'raw':!![],'where':{}};var _0x1f366e={};var _0x575168={'count':0x0,'rows':[]};return db[_0xfc77('0x2a')][_0xfc77('0x48')]({'where':{'id':_0x4b12c5['params']['id']}})[_0xfc77('0x23')](handleEntityNotFound(_0x5c167f,null))[_0xfc77('0x23')](function(_0x57affb){if(_0x57affb){_0x1f366e[_0xfc77('0x2e')]=_['keys'](db[_0xfc77('0x49')]['rawAttributes']);_0x1f366e['query']=_['keys'](_0x4b12c5[_0xfc77('0x2f')]);_0x1f366e[_0xfc77('0x43')]=_[_0xfc77('0x31')](_0x1f366e[_0xfc77('0x2e')],_0x1f366e[_0xfc77('0x2f')]);_0x51eb95[_0xfc77('0x32')]=_[_0xfc77('0x31')](_0x1f366e[_0xfc77('0x2e')],qs[_0xfc77('0x33')](_0x4b12c5[_0xfc77('0x2f')][_0xfc77('0x33')]));_0x51eb95[_0xfc77('0x32')]=_0x51eb95[_0xfc77('0x32')][_0xfc77('0x4a')]?_0x51eb95[_0xfc77('0x32')]:_0x1f366e[_0xfc77('0x2e')];if(!_0x4b12c5[_0xfc77('0x2f')][_0xfc77('0x34')](_0xfc77('0x35'))){_0x51eb95[_0xfc77('0x1c')]=qs[_0xfc77('0x1c')](_0x4b12c5[_0xfc77('0x2f')][_0xfc77('0x1c')]);_0x51eb95[_0xfc77('0x1b')]=qs[_0xfc77('0x1b')](_0x4b12c5[_0xfc77('0x2f')]['offset']);}_0x51eb95[_0xfc77('0x36')]=qs['sort'](_0x4b12c5[_0xfc77('0x2f')][_0xfc77('0x37')]);_0x51eb95[_0xfc77('0x3e')]=qs[_0xfc77('0x43')](_[_0xfc77('0x38')](_0x4b12c5[_0xfc77('0x2f')],_0x1f366e[_0xfc77('0x43')]));_0x51eb95[_0xfc77('0x3e')][_0xfc77('0x4b')]=_0x57affb['id'];if(_0x4b12c5['query'][_0xfc77('0x39')]){_0x51eb95[_0xfc77('0x3e')]=_[_0xfc77('0x3a')](_0x51eb95['where'],{'$or':_['map'](_0x51eb95[_0xfc77('0x32')],function(_0x19dab9){var _0x8eb93a={};_0x8eb93a[_0x19dab9]={'$like':'%'+_0x4b12c5[_0xfc77('0x2f')][_0xfc77('0x39')]+'%'};return _0x8eb93a;})});}_0x51eb95=_[_0xfc77('0x3a')]({},_0x51eb95,_0x4b12c5[_0xfc77('0x3d')]);return db[_0xfc77('0x49')][_0xfc77('0x1a')]({'where':_0x51eb95[_0xfc77('0x3e')]})['then'](function(_0x116f85){_0x575168['count']=_0x116f85;if(_0x4b12c5['query']['includeAll']){_0x51eb95['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xfc77('0x4c')](_0x51eb95);})[_0xfc77('0x23')](function(_0x1419b3){_0x575168[_0xfc77('0x4d')]=_0x1419b3;return _0x575168;});}})[_0xfc77('0x23')](respondWithFilteredResult(_0x5c167f,_0x51eb95))[_0xfc77('0x41')](handleError(_0x5c167f,null));}; \ No newline at end of file +var _0xb78e=['count','offset','limit','set','apply','reject','save','then','end','error','stack','name','send','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','body','update','params','describe','getQuestions','hasOwnProperty','sort','JscriptyQuestionReport','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x1473d4,_0x118ff8){var _0x432b5f=function(_0x292914){while(--_0x292914){_0x1473d4['push'](_0x1473d4['shift']());}};_0x432b5f(++_0x118ff8);}(_0xb78e,0x1b3));var _0xeb78=function(_0x3ea33c,_0x3c8b73){_0x3ea33c=_0x3ea33c-0x0;var _0x3016d5=_0xb78e[_0x3ea33c];return _0x3016d5;};'use strict';var pdf=require(_0xeb78('0x0'));var emlformat=require(_0xeb78('0x1'));var rimraf=require(_0xeb78('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb78('0x3'));var rp=require(_0xeb78('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeb78('0x5'));var util=require(_0xeb78('0x6'));var path=require(_0xeb78('0x7'));var sox=require(_0xeb78('0x8'));var csv=require(_0xeb78('0x9'));var ejs=require(_0xeb78('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xeb78('0xb'));var crypto=require(_0xeb78('0xc'));var jsforce=require(_0xeb78('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xeb78('0x9'));var querystring=require(_0xeb78('0xe'));var Papa=require(_0xeb78('0xf'));var Redis=require('ioredis');var authService=require(_0xeb78('0x10'));var qs=require(_0xeb78('0x11'));var as=require(_0xeb78('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb78('0x13'));var utils=require(_0xeb78('0x14'));var config=require(_0xeb78('0x15'));var licenseUtil=require(_0xeb78('0x16'));var db=require(_0xeb78('0x17'))['db'];function respondWithStatusCode(_0x2bee08,_0x4571c2){_0x4571c2=_0x4571c2||0xcc;return function(_0x19b931){if(_0x19b931){return _0x2bee08[_0xeb78('0x18')](_0x4571c2);}return _0x2bee08[_0xeb78('0x19')](_0x4571c2)['end']();};}function respondWithResult(_0x22b6b6,_0x3c0f13){_0x3c0f13=_0x3c0f13||0xc8;return function(_0x43a7d4){if(_0x43a7d4){return _0x22b6b6[_0xeb78('0x19')](_0x3c0f13)[_0xeb78('0x1a')](_0x43a7d4);}};}function respondWithFilteredResult(_0x3c1e94,_0x263dca){return function(_0x41d268){if(_0x41d268){var _0x26500a=_0x41d268[_0xeb78('0x1b')],_0x51c415=_0x263dca[_0xeb78('0x1c')],_0x1d4486=_0x263dca['offset']+_0x263dca[_0xeb78('0x1d')],_0x2229e0;if(_0x1d4486>=_0x26500a){_0x1d4486=_0x26500a;_0x2229e0=0xc8;}else{_0x2229e0=0xce;}_0x3c1e94[_0xeb78('0x19')](_0x2229e0);return _0x3c1e94[_0xeb78('0x1e')]('Content-Range',_0x51c415+'-'+_0x1d4486+'/'+_0x26500a)['json'](_0x41d268);}return null;};}function patchUpdates(_0x13dc05){return function(_0x1e2ce7){try{jsonpatch[_0xeb78('0x1f')](_0x1e2ce7,_0x13dc05,!![]);}catch(_0x49e0f7){return BPromise[_0xeb78('0x20')](_0x49e0f7);}return _0x1e2ce7[_0xeb78('0x21')]();};}function saveUpdates(_0x3465cf,_0x2906dc){return function(_0x19cf99){if(_0x19cf99){return _0x19cf99['update'](_0x3465cf)[_0xeb78('0x22')](function(_0xdce739){return _0xdce739;});}return null;};}function removeEntity(_0x31616c,_0x186b38){return function(_0x671d7){if(_0x671d7){return _0x671d7['destroy']()['then'](function(){_0x31616c[_0xeb78('0x19')](0xcc)[_0xeb78('0x23')]();});}};}function handleEntityNotFound(_0x1a486b,_0xc4063d){return function(_0x25965e){if(!_0x25965e){_0x1a486b[_0xeb78('0x18')](0x194);}return _0x25965e;};}function handleError(_0x25b09a,_0x3a837c){_0x3a837c=_0x3a837c||0x1f4;return function(_0x43b824){logger[_0xeb78('0x24')](_0x43b824[_0xeb78('0x25')]);if(_0x43b824[_0xeb78('0x26')]){delete _0x43b824[_0xeb78('0x26')];}_0x25b09a[_0xeb78('0x19')](_0x3a837c)[_0xeb78('0x27')](_0x43b824);};}exports['index']=function(_0x38ea88,_0x53749b){var _0x18275a={},_0x5c27d8={},_0x37e5aa={'count':0x0,'rows':[]};var _0x432195=_[_0xeb78('0x28')](db[_0xeb78('0x29')][_0xeb78('0x2a')],function(_0x45904c){return{'name':_0x45904c[_0xeb78('0x2b')],'type':_0x45904c[_0xeb78('0x2c')][_0xeb78('0x2d')]};});_0x5c27d8[_0xeb78('0x2e')]=_['map'](_0x432195,_0xeb78('0x26'));_0x5c27d8[_0xeb78('0x2f')]=_[_0xeb78('0x30')](_0x38ea88['query']);_0x5c27d8[_0xeb78('0x31')]=_[_0xeb78('0x32')](_0x5c27d8['model'],_0x5c27d8['query']);_0x18275a[_0xeb78('0x33')]=_[_0xeb78('0x32')](_0x5c27d8[_0xeb78('0x2e')],qs['fields'](_0x38ea88['query'][_0xeb78('0x34')]));_0x18275a['attributes']=_0x18275a[_0xeb78('0x33')][_0xeb78('0x35')]?_0x18275a[_0xeb78('0x33')]:_0x5c27d8[_0xeb78('0x2e')];if(!_0x38ea88[_0xeb78('0x2f')]['hasOwnProperty'](_0xeb78('0x36'))){_0x18275a[_0xeb78('0x1d')]=qs[_0xeb78('0x1d')](_0x38ea88[_0xeb78('0x2f')][_0xeb78('0x1d')]);_0x18275a[_0xeb78('0x1c')]=qs[_0xeb78('0x1c')](_0x38ea88[_0xeb78('0x2f')][_0xeb78('0x1c')]);}_0x18275a[_0xeb78('0x37')]=qs['sort'](_0x38ea88[_0xeb78('0x2f')]['sort']);_0x18275a['where']=qs['filters'](_[_0xeb78('0x38')](_0x38ea88[_0xeb78('0x2f')],_0x5c27d8[_0xeb78('0x31')]),_0x432195);if(_0x38ea88[_0xeb78('0x2f')][_0xeb78('0x39')]){_0x18275a[_0xeb78('0x3a')]=_[_0xeb78('0x3b')](_0x18275a[_0xeb78('0x3a')],{'$or':_[_0xeb78('0x28')](_0x432195,function(_0x3c475c){if(_0x3c475c[_0xeb78('0x2c')]!==_0xeb78('0x3c')){var _0x5562b4={};_0x5562b4[_0x3c475c['name']]={'$like':'%'+_0x38ea88[_0xeb78('0x2f')][_0xeb78('0x39')]+'%'};return _0x5562b4;}})});}_0x18275a=_[_0xeb78('0x3b')]({},_0x18275a,_0x38ea88[_0xeb78('0x3d')]);var _0x49a989={'where':_0x18275a['where']};return db[_0xeb78('0x29')][_0xeb78('0x1b')](_0x49a989)[_0xeb78('0x22')](function(_0x27d7a7){_0x37e5aa[_0xeb78('0x1b')]=_0x27d7a7;if(_0x38ea88[_0xeb78('0x2f')][_0xeb78('0x3e')]){_0x18275a[_0xeb78('0x3f')]=[{'all':!![]}];}return db[_0xeb78('0x29')][_0xeb78('0x40')](_0x18275a);})[_0xeb78('0x22')](function(_0xc4fc7d){_0x37e5aa[_0xeb78('0x41')]=_0xc4fc7d;return _0x37e5aa;})[_0xeb78('0x22')](respondWithFilteredResult(_0x53749b,_0x18275a))[_0xeb78('0x42')](handleError(_0x53749b,null));};exports[_0xeb78('0x43')]=function(_0x33d9a9,_0x11b7ff){var _0x37a088={'raw':!![],'where':{'id':_0x33d9a9['params']['id']}},_0xd68939={};_0xd68939['model']=_[_0xeb78('0x30')](db[_0xeb78('0x29')][_0xeb78('0x2a')]);_0xd68939[_0xeb78('0x2f')]=_[_0xeb78('0x30')](_0x33d9a9[_0xeb78('0x2f')]);_0xd68939[_0xeb78('0x31')]=_['intersection'](_0xd68939['model'],_0xd68939[_0xeb78('0x2f')]);_0x37a088[_0xeb78('0x33')]=_[_0xeb78('0x32')](_0xd68939[_0xeb78('0x2e')],qs[_0xeb78('0x34')](_0x33d9a9[_0xeb78('0x2f')][_0xeb78('0x34')]));_0x37a088[_0xeb78('0x33')]=_0x37a088[_0xeb78('0x33')][_0xeb78('0x35')]?_0x37a088['attributes']:_0xd68939['model'];if(_0x33d9a9[_0xeb78('0x2f')][_0xeb78('0x3e')]){_0x37a088[_0xeb78('0x3f')]=[{'all':!![]}];}_0x37a088=_['merge']({},_0x37a088,_0x33d9a9['options']);return db[_0xeb78('0x29')]['find'](_0x37a088)[_0xeb78('0x22')](handleEntityNotFound(_0x11b7ff,null))[_0xeb78('0x22')](respondWithResult(_0x11b7ff,null))[_0xeb78('0x42')](handleError(_0x11b7ff,null));};exports[_0xeb78('0x44')]=function(_0x407fae,_0x3ad7a5){return db['JscriptySessionReport'][_0xeb78('0x44')](_0x407fae[_0xeb78('0x45')],{})[_0xeb78('0x22')](respondWithResult(_0x3ad7a5,0xc9))['catch'](handleError(_0x3ad7a5,null));};exports[_0xeb78('0x46')]=function(_0x27fa1f,_0x440bc0){if(_0x27fa1f['body']['id']){delete _0x27fa1f[_0xeb78('0x45')]['id'];}return db['JscriptySessionReport']['find']({'where':{'id':_0x27fa1f[_0xeb78('0x47')]['id']}})['then'](handleEntityNotFound(_0x440bc0,null))['then'](saveUpdates(_0x27fa1f[_0xeb78('0x45')],null))[_0xeb78('0x22')](respondWithResult(_0x440bc0,null))[_0xeb78('0x42')](handleError(_0x440bc0,null));};exports['destroy']=function(_0x3a7110,_0x4c6bba){return db[_0xeb78('0x29')]['find']({'where':{'id':_0x3a7110[_0xeb78('0x47')]['id']}})[_0xeb78('0x22')](handleEntityNotFound(_0x4c6bba,null))['then'](removeEntity(_0x4c6bba,null))[_0xeb78('0x42')](handleError(_0x4c6bba,null));};exports['describe']=function(_0x1b40a7,_0x231a08){return db[_0xeb78('0x29')][_0xeb78('0x48')]()[_0xeb78('0x22')](respondWithResult(_0x231a08,null))[_0xeb78('0x42')](handleError(_0x231a08,null));};exports[_0xeb78('0x49')]=function(_0x504620,_0x1517f4,_0x1a8301){var _0x37d468={'raw':!![],'where':{}};var _0x5999cf={};var _0x23b113={'count':0x0,'rows':[]};return db[_0xeb78('0x29')]['findOne']({'where':{'id':_0x504620[_0xeb78('0x47')]['id']}})[_0xeb78('0x22')](handleEntityNotFound(_0x1517f4,null))[_0xeb78('0x22')](function(_0x233382){if(_0x233382){_0x5999cf[_0xeb78('0x2e')]=_['keys'](db['JscriptyQuestionReport'][_0xeb78('0x2a')]);_0x5999cf[_0xeb78('0x2f')]=_[_0xeb78('0x30')](_0x504620[_0xeb78('0x2f')]);_0x5999cf[_0xeb78('0x31')]=_['intersection'](_0x5999cf[_0xeb78('0x2e')],_0x5999cf[_0xeb78('0x2f')]);_0x37d468[_0xeb78('0x33')]=_[_0xeb78('0x32')](_0x5999cf[_0xeb78('0x2e')],qs[_0xeb78('0x34')](_0x504620[_0xeb78('0x2f')][_0xeb78('0x34')]));_0x37d468[_0xeb78('0x33')]=_0x37d468[_0xeb78('0x33')][_0xeb78('0x35')]?_0x37d468[_0xeb78('0x33')]:_0x5999cf[_0xeb78('0x2e')];if(!_0x504620['query'][_0xeb78('0x4a')](_0xeb78('0x36'))){_0x37d468[_0xeb78('0x1d')]=qs['limit'](_0x504620[_0xeb78('0x2f')][_0xeb78('0x1d')]);_0x37d468[_0xeb78('0x1c')]=qs[_0xeb78('0x1c')](_0x504620['query'][_0xeb78('0x1c')]);}_0x37d468['order']=qs[_0xeb78('0x4b')](_0x504620[_0xeb78('0x2f')][_0xeb78('0x4b')]);_0x37d468[_0xeb78('0x3a')]=qs[_0xeb78('0x31')](_[_0xeb78('0x38')](_0x504620[_0xeb78('0x2f')],_0x5999cf[_0xeb78('0x31')]));_0x37d468[_0xeb78('0x3a')]['SessionId']=_0x233382['id'];if(_0x504620[_0xeb78('0x2f')]['filter']){_0x37d468[_0xeb78('0x3a')]=_[_0xeb78('0x3b')](_0x37d468[_0xeb78('0x3a')],{'$or':_[_0xeb78('0x28')](_0x37d468[_0xeb78('0x33')],function(_0x3b76b6){var _0x2414b4={};_0x2414b4[_0x3b76b6]={'$like':'%'+_0x504620[_0xeb78('0x2f')]['filter']+'%'};return _0x2414b4;})});}_0x37d468=_['merge']({},_0x37d468,_0x504620[_0xeb78('0x3d')]);return db[_0xeb78('0x4c')][_0xeb78('0x1b')]({'where':_0x37d468[_0xeb78('0x3a')]})[_0xeb78('0x22')](function(_0x2a77ae){_0x23b113[_0xeb78('0x1b')]=_0x2a77ae;if(_0x504620[_0xeb78('0x2f')]['includeAll']){_0x37d468[_0xeb78('0x3f')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xeb78('0x40')](_0x37d468);})[_0xeb78('0x22')](function(_0x3027ad){_0x23b113[_0xeb78('0x41')]=_0x3027ad;return _0x23b113;});}})[_0xeb78('0x22')](respondWithFilteredResult(_0x1517f4,_0x37d468))[_0xeb78('0x42')](handleError(_0x1517f4,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 8402092..1e0a0b1 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 _0x0624=['exports','define','JscriptySessionReport','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptySessionReport.attributes'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0624,0x13b));var _0x4062=function(_0x3b72fd,_0x23117b){_0x3b72fd=_0x3b72fd-0x0;var _0xebe387=_0x0624[_0x3b72fd];return _0xebe387;};'use strict';var _=require(_0x4062('0x0'));var util=require(_0x4062('0x1'));var logger=require('../../config/logger')(_0x4062('0x2'));var moment=require(_0x4062('0x3'));var BPromise=require(_0x4062('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4062('0x5'));var rimraf=require(_0x4062('0x6'));var config=require(_0x4062('0x7'));var attributes=require(_0x4062('0x8'));module[_0x4062('0x9')]=function(_0x147de3,_0x2d1087){return _0x147de3[_0x4062('0xa')](_0x4062('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4083=['api','moment','bluebird','path','rimraf','../../config/environment','exports','report_jscripty_sessions','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4083,0xe4));var _0x3408=function(_0x5ce317,_0x1fd9d1){_0x5ce317=_0x5ce317-0x0;var _0x37a9d0=_0x4083[_0x5ce317];return _0x37a9d0;};'use strict';var _=require(_0x3408('0x0'));var util=require(_0x3408('0x1'));var logger=require(_0x3408('0x2'))(_0x3408('0x3'));var moment=require(_0x3408('0x4'));var BPromise=require(_0x3408('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3408('0x6'));var rimraf=require(_0x3408('0x7'));var config=require(_0x3408('0x8'));var attributes=require('./jscriptySessionReport.attributes');module[_0x3408('0x9')]=function(_0x46ee49,_0x126fc5){return _0x46ee49['define']('JscriptySessionReport',attributes,{'tableName':_0x3408('0xa'),'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 51b9420..f6f60dd 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 _0xb7f1=['request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http'];(function(_0x5b92b6,_0x464d99){var _0xc5ceb7=function(_0x36d567){while(--_0x36d567){_0x5b92b6['push'](_0x5b92b6['shift']());}};_0xc5ceb7(++_0x464d99);}(_0xb7f1,0xdc));var _0x1b7f=function(_0x51c7c5,_0x135c79){_0x51c7c5=_0x51c7c5-0x0;var _0x55abf1=_0xb7f1[_0x51c7c5];return _0x55abf1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1b7f('0x0'));var BPromise=require(_0x1b7f('0x1'));var rs=require(_0x1b7f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b7f('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1b7f('0x4'));var config=require(_0x1b7f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1b7f('0x6')][_0x1b7f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2b58f7,_0x6c9f9,_0x34213c){return new BPromise(function(_0x4dda12,_0x16935b){return client[_0x1b7f('0x8')](_0x2b58f7,_0x34213c)[_0x1b7f('0x9')](function(_0x1ee997){logger[_0x1b7f('0xa')](_0x1b7f('0xb'),_0x6c9f9,_0x1b7f('0xc'));logger['debug'](_0x1b7f('0xd'),_0x6c9f9,'request\x20sent',JSON['stringify'](_0x1ee997));if(_0x1ee997[_0x1b7f('0xe')]){if(_0x1ee997[_0x1b7f('0xe')][_0x1b7f('0xf')]===0x1f4){logger[_0x1b7f('0xe')](_0x1b7f('0xb'),_0x6c9f9,_0x1ee997[_0x1b7f('0xe')]['message']);return _0x16935b(_0x1ee997[_0x1b7f('0xe')][_0x1b7f('0x10')]);}logger[_0x1b7f('0xe')](_0x1b7f('0xb'),_0x6c9f9,_0x1ee997[_0x1b7f('0xe')][_0x1b7f('0x10')]);return _0x4dda12(_0x1ee997[_0x1b7f('0xe')][_0x1b7f('0x10')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x6c9f9,_0x1b7f('0xc'));_0x4dda12(_0x1ee997[_0x1b7f('0x11')]['message']);}})[_0x1b7f('0x12')](function(_0x45735f){logger[_0x1b7f('0xe')](_0x1b7f('0xb'),_0x6c9f9,_0x45735f);_0x16935b(_0x45735f);});});} \ No newline at end of file +var _0x02fa=['catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','JscriptySessionReport,\x20%s,\x20%s','message','result'];(function(_0x5a3ef6,_0x4ce6ad){var _0x1d25b2=function(_0x485b7e){while(--_0x485b7e){_0x5a3ef6['push'](_0x5a3ef6['shift']());}};_0x1d25b2(++_0x4ce6ad);}(_0x02fa,0xdd));var _0xa02f=function(_0x975745,_0x54d06b){_0x975745=_0x975745-0x0;var _0xdc0eb7=_0x02fa[_0x975745];return _0xdc0eb7;};'use strict';var _=require(_0xa02f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa02f('0x1'));var rs=require(_0xa02f('0x2'));var fs=require('fs');var Redis=require(_0xa02f('0x3'));var db=require(_0xa02f('0x4'))['db'];var utils=require(_0xa02f('0x5'));var logger=require(_0xa02f('0x6'))(_0xa02f('0x7'));var config=require(_0xa02f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa02f('0x9')][_0xa02f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bea52,_0x4e7f32,_0x49f7d6){return new BPromise(function(_0x319ee5,_0x1f8658){return client[_0xa02f('0xb')](_0x2bea52,_0x49f7d6)[_0xa02f('0xc')](function(_0x435887){logger[_0xa02f('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x4e7f32,_0xa02f('0xe'));logger[_0xa02f('0xf')](_0xa02f('0x10'),_0x4e7f32,_0xa02f('0xe'),JSON['stringify'](_0x435887));if(_0x435887[_0xa02f('0x11')]){if(_0x435887[_0xa02f('0x11')]['code']===0x1f4){logger[_0xa02f('0x11')](_0xa02f('0x12'),_0x4e7f32,_0x435887[_0xa02f('0x11')][_0xa02f('0x13')]);return _0x1f8658(_0x435887[_0xa02f('0x11')][_0xa02f('0x13')]);}logger[_0xa02f('0x11')](_0xa02f('0x12'),_0x4e7f32,_0x435887[_0xa02f('0x11')][_0xa02f('0x13')]);return _0x319ee5(_0x435887[_0xa02f('0x11')][_0xa02f('0x13')]);}else{logger[_0xa02f('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x4e7f32,'request\x20sent');_0x319ee5(_0x435887[_0xa02f('0x14')][_0xa02f('0x13')]);}})[_0xa02f('0x15')](function(_0x5bf938){logger['error'](_0xa02f('0x12'),_0x4e7f32,_0x5bf938);_0x1f8658(_0x5bf938);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 859486b..db6a1e7 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 _0xc27c=['update','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated'];(function(_0x11516b,_0x534210){var _0x4612f3=function(_0x1b0972){while(--_0x1b0972){_0x11516b['push'](_0x11516b['shift']());}};_0x4612f3(++_0x534210);}(_0xc27c,0x197));var _0xcc27=function(_0x4bf78f,_0x4d65c2){_0x4bf78f=_0x4bf78f-0x0;var _0x11cdca=_0xc27c[_0x4bf78f];return _0x11cdca;};'use strict';var multer=require(_0xcc27('0x0'));var util=require('util');var path=require(_0xcc27('0x1'));var timeout=require(_0xcc27('0x2'));var express=require('express');var router=express[_0xcc27('0x3')]();var auth=require(_0xcc27('0x4'));var interaction=require(_0xcc27('0x5'));var config=require(_0xcc27('0x6'));var controller=require(_0xcc27('0x7'));router[_0xcc27('0x8')]('/',controller[_0xcc27('0x9')]);router[_0xcc27('0xa')](_0xcc27('0xb'),auth[_0xcc27('0xc')](),controller[_0xcc27('0xd')]);module['exports']=router; \ No newline at end of file +var _0x6d85=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./license.controller','get','index','put','/:id','isAuthenticated','exports','multer','util'];(function(_0x4a8f25,_0x1acb7a){var _0x478142=function(_0x3c740b){while(--_0x3c740b){_0x4a8f25['push'](_0x4a8f25['shift']());}};_0x478142(++_0x1acb7a);}(_0x6d85,0xb4));var _0x56d8=function(_0x1a3d57,_0x270dab){_0x1a3d57=_0x1a3d57-0x0;var _0x451d5a=_0x6d85[_0x1a3d57];return _0x451d5a;};'use strict';var multer=require(_0x56d8('0x0'));var util=require(_0x56d8('0x1'));var path=require('path');var timeout=require(_0x56d8('0x2'));var express=require(_0x56d8('0x3'));var router=express[_0x56d8('0x4')]();var auth=require(_0x56d8('0x5'));var interaction=require(_0x56d8('0x6'));var config=require('../../config/environment');var controller=require(_0x56d8('0x7'));router[_0x56d8('0x8')]('/',controller[_0x56d8('0x9')]);router[_0x56d8('0xa')](_0x56d8('0xb'),auth[_0x56d8('0xc')](),controller['update']);module[_0x56d8('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 469c4ce..2e8c9eb 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 _0xba34=['STRING','sequelize','exports','TEXT'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xba34,0x119));var _0x4ba3=function(_0x315545,_0x1fe7e6){_0x315545=_0x315545-0x0;var _0x27aa09=_0xba34[_0x315545];return _0x27aa09;};'use strict';var Sequelize=require(_0x4ba3('0x0'));module[_0x4ba3('0x1')]={'license':{'type':Sequelize[_0x4ba3('0x2')]},'data1':{'type':Sequelize[_0x4ba3('0x3')]},'data2':{'type':Sequelize[_0x4ba3('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x687b=['TEXT','STRING','sequelize','exports'];(function(_0x536bed,_0x17aea5){var _0x58f2cf=function(_0xa25e93){while(--_0xa25e93){_0x536bed['push'](_0x536bed['shift']());}};_0x58f2cf(++_0x17aea5);}(_0x687b,0x14a));var _0xb687=function(_0x383f33,_0x290ffa){_0x383f33=_0x383f33-0x0;var _0x357573=_0x687b[_0x383f33];return _0x357573;};'use strict';var Sequelize=require(_0xb687('0x0'));module[_0xb687('0x1')]={'license':{'type':Sequelize[_0xb687('0x2')]},'data1':{'type':Sequelize[_0xb687('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 7bf23bf..bc77016 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 _0x2070=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','index','keys','rawAttributes','query','filters','attributes','intersection','model','fields','length','merge','options','getLicense','catch','body','License','find','params','get','checkLicense','key','demo','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x26cce5,_0x2b9242){var _0x470a45=function(_0x9ef30e){while(--_0x9ef30e){_0x26cce5['push'](_0x26cce5['shift']());}};_0x470a45(++_0x2b9242);}(_0x2070,0x1a2));var _0x0207=function(_0x4bf01f,_0x4cf23e){_0x4bf01f=_0x4bf01f-0x0;var _0x5e50ca=_0x2070[_0x4bf01f];return _0x5e50ca;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x0207('0x0'));var zipdir=require(_0x0207('0x1'));var jsonpatch=require(_0x0207('0x2'));var rp=require('request-promise');var moment=require(_0x0207('0x3'));var BPromise=require(_0x0207('0x4'));var Mustache=require('mustache');var util=require(_0x0207('0x5'));var path=require(_0x0207('0x6'));var sox=require('sox');var csv=require(_0x0207('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x0207('0x8'));var crypto=require(_0x0207('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0207('0xa'));var toCsv=require(_0x0207('0x7'));var querystring=require('querystring');var Papa=require(_0x0207('0xb'));var Redis=require(_0x0207('0xc'));var authService=require(_0x0207('0xd'));var qs=require(_0x0207('0xe'));var as=require(_0x0207('0xf'));var hardwareService=require(_0x0207('0x10'));var logger=require(_0x0207('0x11'))(_0x0207('0x12'));var utils=require(_0x0207('0x13'));var config=require(_0x0207('0x14'));var licenseUtil=require(_0x0207('0x15'));var db=require(_0x0207('0x16'))['db'];function respondWithStatusCode(_0x22be26,_0x7c84b){_0x7c84b=_0x7c84b||0xcc;return function(_0x5bb744){if(_0x5bb744){return _0x22be26[_0x0207('0x17')](_0x7c84b);}return _0x22be26['status'](_0x7c84b)[_0x0207('0x18')]();};}function respondWithResult(_0x3bd0c4,_0x3ffc3a){_0x3ffc3a=_0x3ffc3a||0xc8;return function(_0x1748a1){if(_0x1748a1){return _0x3bd0c4[_0x0207('0x19')](_0x3ffc3a)['json'](_0x1748a1);}};}function respondWithFilteredResult(_0x3cb346,_0x1cbefd){return function(_0x5e8d17){if(_0x5e8d17){var _0x2bb662=_0x5e8d17['count'],_0x31880b=_0x1cbefd[_0x0207('0x1a')],_0x108181=_0x1cbefd[_0x0207('0x1a')]+_0x1cbefd[_0x0207('0x1b')],_0x325eb1;if(_0x108181>=_0x2bb662){_0x108181=_0x2bb662;_0x325eb1=0xc8;}else{_0x325eb1=0xce;}_0x3cb346[_0x0207('0x19')](_0x325eb1);return _0x3cb346[_0x0207('0x1c')](_0x0207('0x1d'),_0x31880b+'-'+_0x108181+'/'+_0x2bb662)[_0x0207('0x1e')](_0x5e8d17);}return null;};}function patchUpdates(_0x1151e8){return function(_0x4255bb){try{jsonpatch[_0x0207('0x1f')](_0x4255bb,_0x1151e8,!![]);}catch(_0x61f1bd){return BPromise[_0x0207('0x20')](_0x61f1bd);}return _0x4255bb[_0x0207('0x21')]();};}function saveUpdates(_0xfc201,_0x3474f3){return function(_0x5a8d60){if(_0x5a8d60){return _0x5a8d60[_0x0207('0x22')](_0xfc201)['then'](function(_0x1438df){return _0x1438df;});}return null;};}function removeEntity(_0x1421e7,_0x37c050){return function(_0x56a158){if(_0x56a158){return _0x56a158[_0x0207('0x23')]()[_0x0207('0x24')](function(){_0x1421e7['status'](0xcc)[_0x0207('0x18')]();});}};}function handleEntityNotFound(_0x11bb0f,_0x40224d){return function(_0x412d3a){if(!_0x412d3a){_0x11bb0f[_0x0207('0x17')](0x194);}return _0x412d3a;};}function handleError(_0x520a88,_0x17cfc9){_0x17cfc9=_0x17cfc9||0x1f4;return function(_0x4089f1){logger['error'](_0x4089f1[_0x0207('0x25')]);if(_0x4089f1['name']){delete _0x4089f1[_0x0207('0x26')];}_0x520a88[_0x0207('0x19')](_0x17cfc9)[_0x0207('0x27')](_0x4089f1);};}var utilLicense=require('../../config/license/util');exports[_0x0207('0x28')]=function(_0x26e59b,_0x1f6286){var _0x35085c={'raw':!![],'where':{'id':0x1}},_0x1bc810={};_0x1bc810['model']=_[_0x0207('0x29')](db['License'][_0x0207('0x2a')]);_0x1bc810[_0x0207('0x2b')]=_[_0x0207('0x29')](_0x26e59b['query']);_0x1bc810[_0x0207('0x2c')]=_['intersection'](_0x1bc810['model'],_0x1bc810[_0x0207('0x2b')]);_0x35085c[_0x0207('0x2d')]=_[_0x0207('0x2e')](_0x1bc810[_0x0207('0x2f')],qs[_0x0207('0x30')](_0x26e59b['query'][_0x0207('0x30')]));_0x35085c[_0x0207('0x2d')]=_0x35085c[_0x0207('0x2d')][_0x0207('0x31')]?_0x35085c['attributes']:_0x1bc810[_0x0207('0x2f')];_0x35085c=_[_0x0207('0x32')]({},_0x35085c,_0x26e59b[_0x0207('0x33')]);return utilLicense[_0x0207('0x34')](_0x35085c)[_0x0207('0x24')](respondWithResult(_0x1f6286,null))[_0x0207('0x35')](handleError(_0x1f6286,null));};exports['update']=function(_0x54aac8,_0x55576d){if(_0x54aac8['body']['id']){delete _0x54aac8[_0x0207('0x36')]['id'];}return db[_0x0207('0x37')][_0x0207('0x38')]({'where':{'id':_0x54aac8[_0x0207('0x39')]['id']}})['then'](handleEntityNotFound(_0x55576d,null))[_0x0207('0x24')](function(_0x4f1e91){var _0x558885=_0x4f1e91[_0x0207('0x3a')]({'plain':!![]});return utilLicense[_0x0207('0x3b')](_0x558885,_0x54aac8[_0x0207('0x36')][_0x0207('0x3c')]);})[_0x0207('0x24')](function(_0x1fe836){if(!_0x1fe836[_0x0207('0x3d')]){return saveUpdates(_0x54aac8['body'],null);}return _0x1fe836;})[_0x0207('0x24')](respondWithResult(_0x55576d,null))[_0x0207('0x35')](handleError(_0x55576d,null));}; \ No newline at end of file +var _0xbe3b=['getLicense','body','params','get','checkLicense','demo','eml-format','rimraf','fast-json-patch','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','model','keys','License','rawAttributes','query','intersection','fields','attributes','length','merge'];(function(_0x59d524,_0x38c395){var _0x22a32d=function(_0xf14965){while(--_0xf14965){_0x59d524['push'](_0x59d524['shift']());}};_0x22a32d(++_0x38c395);}(_0xbe3b,0x19c));var _0xbbe3=function(_0x4fa66c,_0x51f9a3){_0x4fa66c=_0x4fa66c-0x0;var _0x9b192b=_0xbe3b[_0x4fa66c];return _0x9b192b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbbe3('0x0'));var rimraf=require(_0xbbe3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbbe3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbbe3('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbbe3('0x4'));var sox=require(_0xbbe3('0x5'));var csv=require(_0xbbe3('0x6'));var ejs=require(_0xbbe3('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xbbe3('0x8'));var crypto=require(_0xbbe3('0x9'));var jsforce=require(_0xbbe3('0xa'));var deskjs=require(_0xbbe3('0xb'));var toCsv=require(_0xbbe3('0x6'));var querystring=require('querystring');var Papa=require(_0xbbe3('0xc'));var Redis=require(_0xbbe3('0xd'));var authService=require(_0xbbe3('0xe'));var qs=require(_0xbbe3('0xf'));var as=require(_0xbbe3('0x10'));var hardwareService=require(_0xbbe3('0x11'));var logger=require(_0xbbe3('0x12'))(_0xbbe3('0x13'));var utils=require('../../config/utils');var config=require(_0xbbe3('0x14'));var licenseUtil=require(_0xbbe3('0x15'));var db=require(_0xbbe3('0x16'))['db'];function respondWithStatusCode(_0x464538,_0x5ea5b7){_0x5ea5b7=_0x5ea5b7||0xcc;return function(_0x5bd27e){if(_0x5bd27e){return _0x464538[_0xbbe3('0x17')](_0x5ea5b7);}return _0x464538[_0xbbe3('0x18')](_0x5ea5b7)[_0xbbe3('0x19')]();};}function respondWithResult(_0x32b786,_0x1e1552){_0x1e1552=_0x1e1552||0xc8;return function(_0x2df26d){if(_0x2df26d){return _0x32b786['status'](_0x1e1552)[_0xbbe3('0x1a')](_0x2df26d);}};}function respondWithFilteredResult(_0x5ba69a,_0x41b8ba){return function(_0x12a90c){if(_0x12a90c){var _0x46c91b=_0x12a90c[_0xbbe3('0x1b')],_0x44ad97=_0x41b8ba[_0xbbe3('0x1c')],_0x1bea70=_0x41b8ba[_0xbbe3('0x1c')]+_0x41b8ba[_0xbbe3('0x1d')],_0x2af60d;if(_0x1bea70>=_0x46c91b){_0x1bea70=_0x46c91b;_0x2af60d=0xc8;}else{_0x2af60d=0xce;}_0x5ba69a[_0xbbe3('0x18')](_0x2af60d);return _0x5ba69a[_0xbbe3('0x1e')]('Content-Range',_0x44ad97+'-'+_0x1bea70+'/'+_0x46c91b)['json'](_0x12a90c);}return null;};}function patchUpdates(_0x4aebd6){return function(_0x39d104){try{jsonpatch[_0xbbe3('0x1f')](_0x39d104,_0x4aebd6,!![]);}catch(_0x1d6d62){return BPromise[_0xbbe3('0x20')](_0x1d6d62);}return _0x39d104[_0xbbe3('0x21')]();};}function saveUpdates(_0x4d13da,_0x25f694){return function(_0xa29385){if(_0xa29385){return _0xa29385[_0xbbe3('0x22')](_0x4d13da)[_0xbbe3('0x23')](function(_0x58473c){return _0x58473c;});}return null;};}function removeEntity(_0x545084,_0x4a5d39){return function(_0x5e78dc){if(_0x5e78dc){return _0x5e78dc[_0xbbe3('0x24')]()[_0xbbe3('0x23')](function(){_0x545084[_0xbbe3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x224bad,_0x190611){return function(_0x5dd318){if(!_0x5dd318){_0x224bad['sendStatus'](0x194);}return _0x5dd318;};}function handleError(_0x33a90f,_0x7e26db){_0x7e26db=_0x7e26db||0x1f4;return function(_0x4df833){logger[_0xbbe3('0x25')](_0x4df833[_0xbbe3('0x26')]);if(_0x4df833[_0xbbe3('0x27')]){delete _0x4df833[_0xbbe3('0x27')];}_0x33a90f['status'](_0x7e26db)[_0xbbe3('0x28')](_0x4df833);};}var utilLicense=require(_0xbbe3('0x15'));exports[_0xbbe3('0x29')]=function(_0x56ee13,_0x193721){var _0x5f351e={'raw':!![],'where':{'id':0x1}},_0x189780={};_0x189780[_0xbbe3('0x2a')]=_[_0xbbe3('0x2b')](db[_0xbbe3('0x2c')][_0xbbe3('0x2d')]);_0x189780['query']=_['keys'](_0x56ee13[_0xbbe3('0x2e')]);_0x189780['filters']=_['intersection'](_0x189780['model'],_0x189780[_0xbbe3('0x2e')]);_0x5f351e['attributes']=_[_0xbbe3('0x2f')](_0x189780[_0xbbe3('0x2a')],qs['fields'](_0x56ee13[_0xbbe3('0x2e')][_0xbbe3('0x30')]));_0x5f351e['attributes']=_0x5f351e[_0xbbe3('0x31')][_0xbbe3('0x32')]?_0x5f351e['attributes']:_0x189780['model'];_0x5f351e=_[_0xbbe3('0x33')]({},_0x5f351e,_0x56ee13['options']);return utilLicense[_0xbbe3('0x34')](_0x5f351e)[_0xbbe3('0x23')](respondWithResult(_0x193721,null))['catch'](handleError(_0x193721,null));};exports[_0xbbe3('0x22')]=function(_0x45d5c7,_0x2e2c16){if(_0x45d5c7[_0xbbe3('0x35')]['id']){delete _0x45d5c7[_0xbbe3('0x35')]['id'];}return db[_0xbbe3('0x2c')]['find']({'where':{'id':_0x45d5c7[_0xbbe3('0x36')]['id']}})['then'](handleEntityNotFound(_0x2e2c16,null))[_0xbbe3('0x23')](function(_0x614923){var _0x5ac2b0=_0x614923[_0xbbe3('0x37')]({'plain':!![]});return utilLicense[_0xbbe3('0x38')](_0x5ac2b0,_0x45d5c7[_0xbbe3('0x35')]['key']);})[_0xbbe3('0x23')](function(_0x3e7609){if(!_0x3e7609[_0xbbe3('0x39')]){return saveUpdates(_0x45d5c7['body'],null);}return _0x3e7609;})[_0xbbe3('0x23')](respondWithResult(_0x2e2c16,null))['catch'](handleError(_0x2e2c16,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index d2aef54..dbd9c99 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 _0x2f50=['License','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./license.attributes','exports','define'];(function(_0x57aac1,_0x14d928){var _0x43f9ef=function(_0x50627e){while(--_0x50627e){_0x57aac1['push'](_0x57aac1['shift']());}};_0x43f9ef(++_0x14d928);}(_0x2f50,0x7a));var _0x02f5=function(_0x433541,_0x2e830f){_0x433541=_0x433541-0x0;var _0x57e70e=_0x2f50[_0x433541];return _0x57e70e;};'use strict';var _=require(_0x02f5('0x0'));var util=require(_0x02f5('0x1'));var logger=require(_0x02f5('0x2'))(_0x02f5('0x3'));var moment=require('moment');var BPromise=require(_0x02f5('0x4'));var rp=require(_0x02f5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x02f5('0x6'));var config=require('../../config/environment');var attributes=require(_0x02f5('0x7'));module[_0x02f5('0x8')]=function(_0x511ab3,_0x46e985){return _0x511ab3[_0x02f5('0x9')](_0x02f5('0xa'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xff24=['define','License','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes'];(function(_0xee122e,_0x58ef2e){var _0x34f98a=function(_0x18163e){while(--_0x18163e){_0xee122e['push'](_0xee122e['shift']());}};_0x34f98a(++_0x58ef2e);}(_0xff24,0x146));var _0x4ff2=function(_0x369cf9,_0x4e4ddc){_0x369cf9=_0x369cf9-0x0;var _0x1ad2d9=_0xff24[_0x369cf9];return _0x1ad2d9;};'use strict';var _=require(_0x4ff2('0x0'));var util=require(_0x4ff2('0x1'));var logger=require('../../config/logger')(_0x4ff2('0x2'));var moment=require(_0x4ff2('0x3'));var BPromise=require(_0x4ff2('0x4'));var rp=require(_0x4ff2('0x5'));var fs=require('fs');var path=require(_0x4ff2('0x6'));var rimraf=require(_0x4ff2('0x7'));var config=require(_0x4ff2('0x8'));var attributes=require(_0x4ff2('0x9'));module['exports']=function(_0x2480c9,_0x1bbe71){return _0x2480c9[_0x4ff2('0xa')](_0x4ff2('0xb'),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 cbcba99..be10ef5 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 _0xd816=['error','message','result','catch','lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','License,\x20%s,\x20%s'];(function(_0x24a4a3,_0x10a76){var _0x310386=function(_0x26e030){while(--_0x26e030){_0x24a4a3['push'](_0x24a4a3['shift']());}};_0x310386(++_0x10a76);}(_0xd816,0xd5));var _0x6d81=function(_0x1b33f1,_0x299364){_0x1b33f1=_0x1b33f1-0x0;var _0x166bc5=_0xd816[_0x1b33f1];return _0x166bc5;};'use strict';var _=require(_0x6d81('0x0'));var util=require(_0x6d81('0x1'));var moment=require('moment');var BPromise=require(_0x6d81('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6d81('0x3'));var logger=require(_0x6d81('0x4'))(_0x6d81('0x5'));var config=require(_0x6d81('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6d81('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10f1a7,_0x522603,_0x96d1ac){return new BPromise(function(_0x15d634,_0x4e77e8){return client[_0x6d81('0x8')](_0x10f1a7,_0x96d1ac)[_0x6d81('0x9')](function(_0x8612be){logger[_0x6d81('0xa')]('License,\x20%s,\x20%s',_0x522603,_0x6d81('0xb'));logger['debug'](_0x6d81('0xc'),_0x522603,_0x6d81('0xb'),JSON[_0x6d81('0xd')](_0x8612be));if(_0x8612be['error']){if(_0x8612be['error']['code']===0x1f4){logger['error'](_0x6d81('0xe'),_0x522603,_0x8612be[_0x6d81('0xf')][_0x6d81('0x10')]);return _0x4e77e8(_0x8612be[_0x6d81('0xf')]['message']);}logger[_0x6d81('0xf')](_0x6d81('0xe'),_0x522603,_0x8612be[_0x6d81('0xf')][_0x6d81('0x10')]);return _0x15d634(_0x8612be['error'][_0x6d81('0x10')]);}else{logger['info']('License,\x20%s,\x20%s',_0x522603,_0x6d81('0xb'));_0x15d634(_0x8612be[_0x6d81('0x11')][_0x6d81('0x10')]);}})[_0x6d81('0x12')](function(_0x219f73){logger[_0x6d81('0xf')](_0x6d81('0xe'),_0x522603,_0x219f73);_0x4e77e8(_0x219f73);});});} \ No newline at end of file +var _0xe130=['License,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x46509c,_0x3e5ca8){var _0x37f2f5=function(_0x2ba0e0){while(--_0x2ba0e0){_0x46509c['push'](_0x46509c['shift']());}};_0x37f2f5(++_0x3e5ca8);}(_0xe130,0x127));var _0x0e13=function(_0x5ac106,_0x35d8f2){_0x5ac106=_0x5ac106-0x0;var _0x3bcef5=_0xe130[_0x5ac106];return _0x3bcef5;};'use strict';var _=require(_0x0e13('0x0'));var util=require(_0x0e13('0x1'));var moment=require('moment');var BPromise=require(_0x0e13('0x2'));var rs=require(_0x0e13('0x3'));var fs=require('fs');var Redis=require(_0x0e13('0x4'));var db=require(_0x0e13('0x5'))['db'];var utils=require(_0x0e13('0x6'));var logger=require('../../config/logger')(_0x0e13('0x7'));var config=require(_0x0e13('0x8'));var jayson=require(_0x0e13('0x9'));var client=jayson[_0x0e13('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1774a5,_0x5f0d09,_0x567031){return new BPromise(function(_0x5aaa22,_0x2faf49){return client[_0x0e13('0xb')](_0x1774a5,_0x567031)['then'](function(_0x5d066a){logger[_0x0e13('0xc')](_0x0e13('0xd'),_0x5f0d09,_0x0e13('0xe'));logger[_0x0e13('0xf')]('License,\x20%s,\x20%s,\x20%s',_0x5f0d09,'request\x20sent',JSON[_0x0e13('0x10')](_0x5d066a));if(_0x5d066a[_0x0e13('0x11')]){if(_0x5d066a[_0x0e13('0x11')][_0x0e13('0x12')]===0x1f4){logger['error'](_0x0e13('0xd'),_0x5f0d09,_0x5d066a['error'][_0x0e13('0x13')]);return _0x2faf49(_0x5d066a[_0x0e13('0x11')][_0x0e13('0x13')]);}logger[_0x0e13('0x11')](_0x0e13('0xd'),_0x5f0d09,_0x5d066a[_0x0e13('0x11')][_0x0e13('0x13')]);return _0x5aaa22(_0x5d066a[_0x0e13('0x11')][_0x0e13('0x13')]);}else{logger['info'](_0x0e13('0xd'),_0x5f0d09,_0x0e13('0xe'));_0x5aaa22(_0x5d066a[_0x0e13('0x14')][_0x0e13('0x13')]);}})[_0x0e13('0x15')](function(_0x32f76a){logger['error'](_0x0e13('0xd'),_0x5f0d09,_0x32f76a);_0x2faf49(_0x32f76a);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index b69027b..c9229da 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 _0xa381=['show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addImap','addSmtp','addInteraction','addApplications','/:id/send','addAgents','update','delete','removeAnswers','removeImap','removeSmtp','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','describe','/:id'];(function(_0x561adb,_0x5043ef){var _0x3156e8=function(_0x4acd2f){while(--_0x4acd2f){_0x561adb['push'](_0x561adb['shift']());}};_0x3156e8(++_0x5043ef);}(_0xa381,0x79));var _0x1a38=function(_0x57fa91,_0x87ea8a){_0x57fa91=_0x57fa91-0x0;var _0x425572=_0xa381[_0x57fa91];return _0x425572;};'use strict';var multer=require(_0x1a38('0x0'));var util=require(_0x1a38('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1a38('0x2'));var router=express[_0x1a38('0x3')]();var auth=require(_0x1a38('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1a38('0x5'));var controller=require(_0x1a38('0x6'));router[_0x1a38('0x7')]('/',auth[_0x1a38('0x8')](),controller['index']);router[_0x1a38('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x1a38('0x9')]);router['get'](_0x1a38('0xa'),auth[_0x1a38('0x8')](),controller[_0x1a38('0xb')]);router[_0x1a38('0x7')]('/:id/dispositions',auth[_0x1a38('0x8')](),controller[_0x1a38('0xc')]);router[_0x1a38('0x7')](_0x1a38('0xd'),auth[_0x1a38('0x8')](),controller[_0x1a38('0xe')]);router[_0x1a38('0x7')](_0x1a38('0xf'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x10')]);router[_0x1a38('0x7')](_0x1a38('0x11'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x12')]);router[_0x1a38('0x7')](_0x1a38('0x13'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x14')]);router[_0x1a38('0x7')](_0x1a38('0x15'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x16')]);router[_0x1a38('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0x1a38('0x17')]);router['get'](_0x1a38('0x18'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x19')]);router[_0x1a38('0x7')](_0x1a38('0x1a'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x1b')]);router[_0x1a38('0x1c')](_0x1a38('0x1d'),auth['isAuthenticated'](),controller[_0x1a38('0x1e')]);router['post'](_0x1a38('0xd'),auth[_0x1a38('0x8')](),controller['addAnswer']);router[_0x1a38('0x1c')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1a38('0x1c')](_0x1a38('0xf'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x1f')]);router['post'](_0x1a38('0x11'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x20')]);router['post'](_0x1a38('0x13'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x21')]);router[_0x1a38('0x1c')](_0x1a38('0x15'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x22')]);router[_0x1a38('0x1c')](_0x1a38('0x23'),auth[_0x1a38('0x8')](),controller['send']);router[_0x1a38('0x1c')]('/:id/users',auth[_0x1a38('0x8')](),controller[_0x1a38('0x24')]);router['put'](_0x1a38('0xa'),auth['isAuthenticated'](),controller[_0x1a38('0x25')]);router[_0x1a38('0x26')](_0x1a38('0x1d'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x1a38('0x26')](_0x1a38('0xd'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x27')]);router[_0x1a38('0x26')](_0x1a38('0xf'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x28')]);router['delete']('/:id/out_servers',auth[_0x1a38('0x8')](),controller[_0x1a38('0x29')]);router[_0x1a38('0x26')](_0x1a38('0xa'),auth[_0x1a38('0x8')](),controller[_0x1a38('0x2a')]);router[_0x1a38('0x26')]('/:id/users',auth[_0x1a38('0x8')](),controller['removeAgents']);module[_0x1a38('0x2b')]=router; \ No newline at end of file +var _0xb7f0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','send','addAgents','put','update','delete','/:id/dispositions','removeAnswers','removeImap','destroy','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x29c533,_0x461de4){var _0x116f36=function(_0x2ca9cc){while(--_0x2ca9cc){_0x29c533['push'](_0x29c533['shift']());}};_0x116f36(++_0x461de4);}(_0xb7f0,0x1eb));var _0x0b7f=function(_0x536bc2,_0x35c4bf){_0x536bc2=_0x536bc2-0x0;var _0x551b56=_0xb7f0[_0x536bc2];return _0x551b56;};'use strict';var multer=require(_0x0b7f('0x0'));var util=require(_0x0b7f('0x1'));var path=require(_0x0b7f('0x2'));var timeout=require(_0x0b7f('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x0b7f('0x4'));var interaction=require(_0x0b7f('0x5'));var config=require(_0x0b7f('0x6'));var controller=require(_0x0b7f('0x7'));router[_0x0b7f('0x8')]('/',auth[_0x0b7f('0x9')](),controller[_0x0b7f('0xa')]);router[_0x0b7f('0x8')](_0x0b7f('0xb'),auth[_0x0b7f('0x9')](),controller['describe']);router[_0x0b7f('0x8')](_0x0b7f('0xc'),auth['isAuthenticated'](),controller[_0x0b7f('0xd')]);router[_0x0b7f('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0x0b7f('0x8')](_0x0b7f('0xe'),auth[_0x0b7f('0x9')](),controller[_0x0b7f('0xf')]);router[_0x0b7f('0x8')](_0x0b7f('0x10'),auth[_0x0b7f('0x9')](),controller[_0x0b7f('0x11')]);router[_0x0b7f('0x8')](_0x0b7f('0x12'),auth[_0x0b7f('0x9')](),controller['getSmtp']);router[_0x0b7f('0x8')](_0x0b7f('0x13'),auth[_0x0b7f('0x9')](),controller[_0x0b7f('0x14')]);router[_0x0b7f('0x8')](_0x0b7f('0x15'),auth[_0x0b7f('0x9')](),controller[_0x0b7f('0x16')]);router['get'](_0x0b7f('0x17'),auth[_0x0b7f('0x9')](),controller[_0x0b7f('0x18')]);router[_0x0b7f('0x8')]('/:id/verify',auth[_0x0b7f('0x9')](),controller[_0x0b7f('0x19')]);router[_0x0b7f('0x8')](_0x0b7f('0x1a'),auth[_0x0b7f('0x9')](),controller['getAgents']);router[_0x0b7f('0x1b')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x0b7f('0x1c')]);router[_0x0b7f('0x1b')](_0x0b7f('0xe'),auth[_0x0b7f('0x9')](),controller[_0x0b7f('0x1d')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0b7f('0x1e')]);router[_0x0b7f('0x1b')](_0x0b7f('0x10'),auth['isAuthenticated'](),controller[_0x0b7f('0x1f')]);router[_0x0b7f('0x1b')](_0x0b7f('0x12'),auth[_0x0b7f('0x9')](),controller[_0x0b7f('0x20')]);router[_0x0b7f('0x1b')](_0x0b7f('0x13'),auth[_0x0b7f('0x9')](),controller[_0x0b7f('0x21')]);router['post'](_0x0b7f('0x15'),auth[_0x0b7f('0x9')](),controller['addApplications']);router['post']('/:id/send',auth[_0x0b7f('0x9')](),controller[_0x0b7f('0x22')]);router['post'](_0x0b7f('0x1a'),auth[_0x0b7f('0x9')](),controller[_0x0b7f('0x23')]);router[_0x0b7f('0x24')](_0x0b7f('0xc'),auth[_0x0b7f('0x9')](),controller[_0x0b7f('0x25')]);router[_0x0b7f('0x26')](_0x0b7f('0x27'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x0b7f('0xe'),auth['isAuthenticated'](),controller[_0x0b7f('0x28')]);router[_0x0b7f('0x26')](_0x0b7f('0x10'),auth[_0x0b7f('0x9')](),controller[_0x0b7f('0x29')]);router[_0x0b7f('0x26')](_0x0b7f('0x12'),auth['isAuthenticated'](),controller['removeSmtp']);router[_0x0b7f('0x26')]('/:id',auth[_0x0b7f('0x9')](),controller[_0x0b7f('0x2a')]);router[_0x0b7f('0x26')](_0x0b7f('0x1a'),auth[_0x0b7f('0x9')](),controller[_0x0b7f('0x2b')]);module[_0x0b7f('0x2c')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 48c0657..f8ec113 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 _0x34cd=['exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','setDataValue','mandatoryDispositionPauseId'];(function(_0x1b8e7f,_0x555ac7){var _0x2bfe29=function(_0x4623e0){while(--_0x4623e0){_0x1b8e7f['push'](_0x1b8e7f['shift']());}};_0x2bfe29(++_0x555ac7);}(_0x34cd,0xfc));var _0xd34c=function(_0x188c44,_0xcaf8a8){_0x188c44=_0x188c44-0x0;var _0x332933=_0x34cd[_0x188c44];return _0x332933;};'use strict';var Sequelize=require('sequelize');module[_0xd34c('0x0')]={'description':{'type':Sequelize[_0xd34c('0x1')]},'name':{'type':Sequelize[_0xd34c('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xd34c('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xd34c('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xd34c('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xd34c('0x3')]},'markAsUnread':{'type':Sequelize[_0xd34c('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd34c('0x4')},'fontSize':{'type':Sequelize[_0xd34c('0x5')](0x2)[_0xd34c('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xd34c('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0xd34c('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd34c('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd34c('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd34c('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd34c('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xd34c('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x280399){if(!_0x280399)this[_0xd34c('0x7')](_0xd34c('0x8'),null);this[_0xd34c('0x7')]('mandatoryDisposition',_0x280399);}}}; \ No newline at end of file +var _0x486c=['INTEGER','UNSIGNED','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif'];(function(_0x5a7e78,_0x400b57){var _0xa8d4a1=function(_0x486659){while(--_0x486659){_0x5a7e78['push'](_0x5a7e78['shift']());}};_0xa8d4a1(++_0x400b57);}(_0x486c,0x188));var _0xc486=function(_0x32131e,_0x56d97d){_0x32131e=_0x32131e-0x0;var _0x3f1c72=_0x486c[_0x32131e];return _0x3f1c72;};'use strict';var Sequelize=require('sequelize');module[_0xc486('0x0')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xc486('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xc486('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xc486('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xc486('0x1')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0xc486('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc486('0x3')},'fontSize':{'type':Sequelize[_0xc486('0x4')](0x2)[_0xc486('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xc486('0x6')],'defaultValue':function(){return _0xc486('0x7');}},'notificationSound':{'type':Sequelize[_0xc486('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc486('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc486('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc486('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc486('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc486('0x4')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc486('0x8'),'set':function(_0x4a0bdd){if(!_0x4a0bdd)this[_0xc486('0x9')]('mandatoryDispositionPauseId',null);this[_0xc486('0x9')](_0xc486('0xa'),_0x4a0bdd);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 22f3e1e..70102ba 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 _0x2d6e=['emit','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','html-to-text','juice','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./mailAccount.socket','jayson/promise','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','get','MailAccounts','UserProfileResource','stack','name','send','index','MailServerIn','MailServerOut','Pause','map','MailAccount','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','findAll','show','Imap','mandatoryDispositionPause','rawAttributes','find','body','params','Smtp','describe','addDisposition','MailAccountId','create','getDispositions','Disposition','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','email','ListId','isNil','active','description','cservice','user','cuser','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addImap','removeImap','getSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','rows','addApplications','sequelize','MailApplication','destroy','bulkCreate','priority','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','server/files/attachments','auth','secure','sendMail','List\x20not\x20found','defaults','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','userMailAccount:save','removeAgents','isArray'];(function(_0x575cdf,_0x2cf0c8){var _0x5d93f0=function(_0x5b5302){while(--_0x5b5302){_0x575cdf['push'](_0x575cdf['shift']());}};_0x5d93f0(++_0x2cf0c8);}(_0x2d6e,0x193));var _0xe2d6=function(_0x213011,_0x1de2e2){_0x213011=_0x213011-0x0;var _0xacf03f=_0x2d6e[_0x213011];return _0xacf03f;};'use strict';var pdf=require(_0xe2d6('0x0'));var emlformat=require(_0xe2d6('0x1'));var rimraf=require(_0xe2d6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe2d6('0x3'));var moment=require(_0xe2d6('0x4'));var BPromise=require(_0xe2d6('0x5'));var Mustache=require(_0xe2d6('0x6'));var util=require(_0xe2d6('0x7'));var path=require(_0xe2d6('0x8'));var sox=require(_0xe2d6('0x9'));var csv=require('to-csv');var ejs=require(_0xe2d6('0xa'));var fs=require('fs');var _=require(_0xe2d6('0xb'));var squel=require('squel');var crypto=require(_0xe2d6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe2d6('0xd'));var toCsv=require(_0xe2d6('0xe'));var querystring=require(_0xe2d6('0xf'));var Papa=require(_0xe2d6('0x10'));var htmlToText=require(_0xe2d6('0x11'));var juice=require(_0xe2d6('0x12'));var Redis=require(_0xe2d6('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe2d6('0x14'));var hardwareService=require(_0xe2d6('0x15'));var logger=require(_0xe2d6('0x16'))(_0xe2d6('0x17'));var utils=require(_0xe2d6('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe2d6('0x19'));var db=require(_0xe2d6('0x1a'))['db'];config[_0xe2d6('0x1b')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe2d6('0x1c'))(new Redis(config['redis']));require(_0xe2d6('0x1d'))['register'](socket);var jayson=require(_0xe2d6('0x1e'));var client=jayson['client'][_0xe2d6('0x1f')]({'port':0x232b});function respondWithRpcPromise(_0x31ec82,_0x3d68a8,_0x248652,_0x7a4a86){return new BPromise(function(_0x3d1992,_0x4ae12e){var _0x17df2b=_0x7a4a86||client;return _0x17df2b[_0xe2d6('0x20')](_0x31ec82,_0x248652)[_0xe2d6('0x21')](function(_0x5aad8b){logger[_0xe2d6('0x22')](_0xe2d6('0x23'),_0x3d68a8,_0xe2d6('0x24'));logger[_0xe2d6('0x25')](_0xe2d6('0x26'),_0x3d68a8,_0xe2d6('0x24'),JSON[_0xe2d6('0x27')](_0x5aad8b));if(_0x5aad8b[_0xe2d6('0x28')]){if(_0x5aad8b['error'][_0xe2d6('0x29')]===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x3d68a8,_0x5aad8b[_0xe2d6('0x28')]['message']);return _0x4ae12e(_0x5aad8b[_0xe2d6('0x28')][_0xe2d6('0x2a')]);}logger[_0xe2d6('0x28')](_0xe2d6('0x23'),_0x3d68a8,_0x5aad8b[_0xe2d6('0x28')][_0xe2d6('0x2a')]);return _0x3d1992(_0x5aad8b['error'][_0xe2d6('0x2a')]);}else{logger[_0xe2d6('0x22')](_0xe2d6('0x23'),_0x3d68a8,_0xe2d6('0x24'));_0x3d1992(_0x5aad8b['result'][_0xe2d6('0x2a')]);}})[_0xe2d6('0x2b')](function(_0x43c83b){logger['error'](_0xe2d6('0x23'),_0x3d68a8,_0x43c83b);_0x4ae12e(_0x43c83b);});});}function respondWithStatusCode(_0x261fac,_0x4cf710){_0x4cf710=_0x4cf710||0xcc;return function(_0x3e25e8){if(_0x3e25e8){return _0x261fac[_0xe2d6('0x2c')](_0x4cf710);}return _0x261fac[_0xe2d6('0x2d')](_0x4cf710)[_0xe2d6('0x2e')]();};}function respondWithResult(_0x9481b3,_0x2c05c9){_0x2c05c9=_0x2c05c9||0xc8;return function(_0x2e65d2){if(_0x2e65d2){return _0x9481b3[_0xe2d6('0x2d')](_0x2c05c9)[_0xe2d6('0x2f')](_0x2e65d2);}};}function respondWithFilteredResult(_0x106497,_0x295028){return function(_0x5aa975){if(_0x5aa975){var _0x343cfe=_0x5aa975['count'],_0x7adbbc=_0x295028[_0xe2d6('0x30')],_0x21d87a=_0x295028[_0xe2d6('0x30')]+_0x295028[_0xe2d6('0x31')],_0x4104bf;if(_0x21d87a>=_0x343cfe){_0x21d87a=_0x343cfe;_0x4104bf=0xc8;}else{_0x4104bf=0xce;}_0x106497['status'](_0x4104bf);return _0x106497[_0xe2d6('0x32')](_0xe2d6('0x33'),_0x7adbbc+'-'+_0x21d87a+'/'+_0x343cfe)[_0xe2d6('0x2f')](_0x5aa975);}return null;};}function patchUpdates(_0x947a8f){return function(_0x1b9ad6){try{jsonpatch[_0xe2d6('0x34')](_0x1b9ad6,_0x947a8f,!![]);}catch(_0x174f3e){return BPromise[_0xe2d6('0x35')](_0x174f3e);}return _0x1b9ad6[_0xe2d6('0x36')]();};}function saveUpdates(_0x1adb70,_0x37b298){return function(_0x6920d5){if(_0x6920d5){return _0x6920d5[_0xe2d6('0x37')](_0x1adb70)[_0xe2d6('0x21')](function(_0x38eea3){return _0x38eea3;});}return null;};}function removeEntity(_0x216f30,_0x58fb93){return function(_0x2a88bc){if(_0x2a88bc){return _0x2a88bc['destroy']()['then'](function(){var _0x38fe5=_0x2a88bc[_0xe2d6('0x38')]({'plain':!![]});var _0x542788=_0xe2d6('0x39');return db[_0xe2d6('0x3a')]['destroy']({'where':{'type':_0x542788,'resourceId':_0x38fe5['id']}})[_0xe2d6('0x21')](function(){return _0x2a88bc;});})[_0xe2d6('0x21')](function(){_0x216f30[_0xe2d6('0x2d')](0xcc)[_0xe2d6('0x2e')]();});}};}function handleEntityNotFound(_0x12590e,_0x171cdf){return function(_0x2a7ac3){if(!_0x2a7ac3){_0x12590e[_0xe2d6('0x2c')](0x194);}return _0x2a7ac3;};}function handleError(_0x2b379c,_0x3df2ae){_0x3df2ae=_0x3df2ae||0x1f4;return function(_0x1b2e28){logger[_0xe2d6('0x28')](_0x1b2e28[_0xe2d6('0x3b')]);if(_0x1b2e28['name']){delete _0x1b2e28[_0xe2d6('0x3c')];}_0x2b379c[_0xe2d6('0x2d')](_0x3df2ae)[_0xe2d6('0x3d')](_0x1b2e28);};}exports[_0xe2d6('0x3e')]=function(_0x3368ce,_0x5cb850){var _0x1d86ee={'include':[{'model':db[_0xe2d6('0x3f')],'as':'Imap'},{'model':db[_0xe2d6('0x40')],'as':'Smtp'},{'model':db[_0xe2d6('0x41')],'as':'mandatoryDispositionPause'}]},_0x78724e={},_0x2a6db2={'count':0x0,'rows':[]};var _0x12522c=_[_0xe2d6('0x42')](db[_0xe2d6('0x43')]['rawAttributes'],function(_0x2deb3e){return{'name':_0x2deb3e[_0xe2d6('0x44')],'type':_0x2deb3e[_0xe2d6('0x45')][_0xe2d6('0x46')]};});_0x78724e['model']=_[_0xe2d6('0x42')](_0x12522c,'name');_0x78724e['query']=_[_0xe2d6('0x47')](_0x3368ce['query']);_0x78724e[_0xe2d6('0x48')]=_[_0xe2d6('0x49')](_0x78724e[_0xe2d6('0x4a')],_0x78724e[_0xe2d6('0x4b')]);_0x1d86ee[_0xe2d6('0x4c')]=_['intersection'](_0x78724e['model'],qs[_0xe2d6('0x4d')](_0x3368ce[_0xe2d6('0x4b')]['fields']));_0x1d86ee['attributes']=_0x1d86ee[_0xe2d6('0x4c')][_0xe2d6('0x4e')]?_0x1d86ee[_0xe2d6('0x4c')]:_0x78724e[_0xe2d6('0x4a')];if(!_0x3368ce[_0xe2d6('0x4b')][_0xe2d6('0x4f')](_0xe2d6('0x50'))){_0x1d86ee[_0xe2d6('0x31')]=qs[_0xe2d6('0x31')](_0x3368ce[_0xe2d6('0x4b')][_0xe2d6('0x31')]);_0x1d86ee[_0xe2d6('0x30')]=qs[_0xe2d6('0x30')](_0x3368ce[_0xe2d6('0x4b')][_0xe2d6('0x30')]);}_0x1d86ee[_0xe2d6('0x51')]=qs[_0xe2d6('0x52')](_0x3368ce[_0xe2d6('0x4b')]['sort']);_0x1d86ee[_0xe2d6('0x53')]=qs[_0xe2d6('0x48')](_['pick'](_0x3368ce['query'],_0x78724e['filters']),_0x12522c);if(_0x3368ce['query'][_0xe2d6('0x54')]){_0x1d86ee[_0xe2d6('0x53')]=_[_0xe2d6('0x55')](_0x1d86ee['where'],{'$or':_['map'](_0x12522c,function(_0x1eeb00){if(_0x1eeb00['type']!=='VIRTUAL'){var _0x3512b4={};_0x3512b4[_0x1eeb00[_0xe2d6('0x3c')]]={'$like':'%'+_0x3368ce['query'][_0xe2d6('0x54')]+'%'};return _0x3512b4;}})});}_0x1d86ee=_[_0xe2d6('0x55')]({},_0x1d86ee,_0x3368ce[_0xe2d6('0x56')]);var _0x38d1ad={'where':_0x1d86ee[_0xe2d6('0x53')]};return db[_0xe2d6('0x43')][_0xe2d6('0x57')](_0x38d1ad)[_0xe2d6('0x21')](function(_0x54156d){_0x2a6db2[_0xe2d6('0x57')]=_0x54156d;if(_0x3368ce[_0xe2d6('0x4b')][_0xe2d6('0x58')]){_0x1d86ee[_0xe2d6('0x59')]=[{'all':!![]}];}return db[_0xe2d6('0x43')][_0xe2d6('0x5a')](_0x1d86ee);})[_0xe2d6('0x21')](function(_0xfaf60b){_0x2a6db2['rows']=_0xfaf60b;return _0x2a6db2;})[_0xe2d6('0x21')](respondWithFilteredResult(_0x5cb850,_0x1d86ee))[_0xe2d6('0x2b')](handleError(_0x5cb850,null));};exports[_0xe2d6('0x5b')]=function(_0x3cc104,_0x181267){var _0x3acacf={'raw':![],'where':{'id':_0x3cc104['params']['id']},'include':[{'model':db[_0xe2d6('0x3f')],'as':_0xe2d6('0x5c')},{'model':db[_0xe2d6('0x40')],'as':'Smtp'},{'model':db['Pause'],'as':_0xe2d6('0x5d')}]},_0x5ce17e={};_0x5ce17e[_0xe2d6('0x4a')]=_[_0xe2d6('0x47')](db[_0xe2d6('0x43')][_0xe2d6('0x5e')]);_0x5ce17e[_0xe2d6('0x4b')]=_['keys'](_0x3cc104[_0xe2d6('0x4b')]);_0x5ce17e[_0xe2d6('0x48')]=_[_0xe2d6('0x49')](_0x5ce17e['model'],_0x5ce17e['query']);_0x3acacf[_0xe2d6('0x4c')]=_[_0xe2d6('0x49')](_0x5ce17e[_0xe2d6('0x4a')],qs[_0xe2d6('0x4d')](_0x3cc104['query'][_0xe2d6('0x4d')]));_0x3acacf[_0xe2d6('0x4c')]=_0x3acacf[_0xe2d6('0x4c')][_0xe2d6('0x4e')]?_0x3acacf[_0xe2d6('0x4c')]:_0x5ce17e[_0xe2d6('0x4a')];if(_0x3cc104[_0xe2d6('0x4b')][_0xe2d6('0x58')]){_0x3acacf[_0xe2d6('0x59')]=[{'all':!![]}];}_0x3acacf=_[_0xe2d6('0x55')]({},_0x3acacf,_0x3cc104[_0xe2d6('0x56')]);return db[_0xe2d6('0x43')][_0xe2d6('0x5f')](_0x3acacf)[_0xe2d6('0x21')](handleEntityNotFound(_0x181267,null))[_0xe2d6('0x21')](respondWithResult(_0x181267,null))[_0xe2d6('0x2b')](handleError(_0x181267,null));};exports[_0xe2d6('0x37')]=function(_0x43d4b5,_0x198112){if(_0x43d4b5[_0xe2d6('0x60')]['id']){delete _0x43d4b5[_0xe2d6('0x60')]['id'];}return db[_0xe2d6('0x43')]['find']({'where':{'id':_0x43d4b5[_0xe2d6('0x61')]['id']},'include':[{'model':db['MailServerIn'],'as':_0xe2d6('0x5c')},{'model':db['MailServerOut'],'as':_0xe2d6('0x62')},{'model':db[_0xe2d6('0x41')],'as':_0xe2d6('0x5d')}]})[_0xe2d6('0x21')](handleEntityNotFound(_0x198112,null))['then'](saveUpdates(_0x43d4b5['body'],null))['then'](function(_0x44a80b){if(_0x44a80b&&_0x43d4b5['body'][_0xe2d6('0x5c')]){return db[_0xe2d6('0x3f')][_0xe2d6('0x37')](_0x43d4b5[_0xe2d6('0x60')][_0xe2d6('0x5c')],{'where':{'MailAccountId':_0x44a80b['id']}})[_0xe2d6('0x21')](function(){return _0x44a80b;});}return _0x44a80b;})[_0xe2d6('0x21')](function(_0x5492e5){if(_0x5492e5&&_0x43d4b5['body'][_0xe2d6('0x62')]){return db[_0xe2d6('0x40')][_0xe2d6('0x37')](_0x43d4b5[_0xe2d6('0x60')]['Smtp'],{'where':{'MailAccountId':_0x5492e5['id']}})[_0xe2d6('0x21')](function(){return _0x5492e5;});}return _0x5492e5;})[_0xe2d6('0x21')](respondWithResult(_0x198112,null))[_0xe2d6('0x2b')](handleError(_0x198112,null));};exports[_0xe2d6('0x63')]=function(_0x50de9d,_0x360c3b){return db['MailAccount']['describe']()[_0xe2d6('0x21')](respondWithResult(_0x360c3b,null))[_0xe2d6('0x2b')](handleError(_0x360c3b,null));};exports[_0xe2d6('0x64')]=function(_0x5ac485,_0x2ef1db,_0x4c02bb){if(_0x5ac485[_0xe2d6('0x60')]['id']){delete _0x5ac485[_0xe2d6('0x60')]['id'];}return db[_0xe2d6('0x43')]['find']({'where':{'id':_0x5ac485['params']['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x2ef1db,null))['then'](function(_0xcb19f1){if(_0xcb19f1){_0x5ac485[_0xe2d6('0x60')][_0xe2d6('0x65')]=_0xcb19f1['id'];return db['Disposition'][_0xe2d6('0x66')](_0x5ac485[_0xe2d6('0x60')]);}})['then'](respondWithResult(_0x2ef1db,null))[_0xe2d6('0x2b')](handleError(_0x2ef1db,null));};exports[_0xe2d6('0x67')]=function(_0x502eaf,_0x340d1b,_0x15262e){var _0x538538={'raw':![],'where':{}};var _0x4e8451={};var _0xfd7bee={'count':0x0,'rows':[]};return db[_0xe2d6('0x43')]['findOne']({'where':{'id':_0x502eaf[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x340d1b,null))['then'](function(_0xe5f95){if(_0xe5f95){_0x4e8451[_0xe2d6('0x4a')]=_[_0xe2d6('0x47')](db[_0xe2d6('0x68')][_0xe2d6('0x5e')]);_0x4e8451['query']=_[_0xe2d6('0x47')](_0x502eaf[_0xe2d6('0x4b')]);_0x4e8451['filters']=_[_0xe2d6('0x49')](_0x4e8451[_0xe2d6('0x4a')],_0x4e8451['query']);_0x538538[_0xe2d6('0x4c')]=_[_0xe2d6('0x49')](_0x4e8451[_0xe2d6('0x4a')],qs[_0xe2d6('0x4d')](_0x502eaf[_0xe2d6('0x4b')]['fields']));_0x538538[_0xe2d6('0x4c')]=_0x538538['attributes'][_0xe2d6('0x4e')]?_0x538538[_0xe2d6('0x4c')]:_0x4e8451[_0xe2d6('0x4a')];if(!_0x502eaf['query'][_0xe2d6('0x4f')]('nolimit')){_0x538538[_0xe2d6('0x31')]=qs['limit'](_0x502eaf['query'][_0xe2d6('0x31')]);_0x538538['offset']=qs[_0xe2d6('0x30')](_0x502eaf[_0xe2d6('0x4b')][_0xe2d6('0x30')]);}_0x538538[_0xe2d6('0x51')]=qs[_0xe2d6('0x52')](_0x502eaf['query'][_0xe2d6('0x52')]);_0x538538[_0xe2d6('0x53')]=qs[_0xe2d6('0x48')](_[_0xe2d6('0x69')](_0x502eaf['query'],_0x4e8451['filters']));_0x538538['where'][_0xe2d6('0x65')]=_0xe5f95['id'];if(_0x502eaf[_0xe2d6('0x4b')][_0xe2d6('0x54')]){_0x538538[_0xe2d6('0x53')]=_['merge'](_0x538538[_0xe2d6('0x53')],{'$or':_[_0xe2d6('0x42')](_0x538538[_0xe2d6('0x4c')],function(_0x48a06e){var _0x329e18={};_0x329e18[_0x48a06e]={'$like':'%'+_0x502eaf[_0xe2d6('0x4b')]['filter']+'%'};return _0x329e18;})});}_0x538538=_[_0xe2d6('0x55')]({},_0x538538,_0x502eaf[_0xe2d6('0x56')]);return db[_0xe2d6('0x68')][_0xe2d6('0x57')]({'where':_0x538538[_0xe2d6('0x53')]})[_0xe2d6('0x21')](function(_0x47f498){_0xfd7bee[_0xe2d6('0x57')]=_0x47f498;if(_0x502eaf[_0xe2d6('0x4b')][_0xe2d6('0x58')]){_0x538538[_0xe2d6('0x59')]=[{'all':!![]}];}return db['Disposition'][_0xe2d6('0x5a')](_0x538538);})[_0xe2d6('0x21')](function(_0xa802d9){_0xfd7bee['rows']=_0xa802d9;return _0xfd7bee;});}})[_0xe2d6('0x21')](respondWithFilteredResult(_0x340d1b,_0x538538))[_0xe2d6('0x2b')](handleError(_0x340d1b,null));};exports[_0xe2d6('0x6a')]=function(_0x42f1ee,_0x3e0f79,_0x546af9){return db[_0xe2d6('0x43')]['find']({'where':{'id':_0x42f1ee['params']['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x3e0f79,null))[_0xe2d6('0x21')](function(_0x438a46){if(_0x438a46){return _0x438a46[_0xe2d6('0x6a')](_0x42f1ee['query'][_0xe2d6('0x6b')]);}})[_0xe2d6('0x21')](respondWithStatusCode(_0x3e0f79,null))[_0xe2d6('0x2b')](handleError(_0x3e0f79,null));};exports[_0xe2d6('0x6c')]=function(_0xcf66f4,_0x12e856,_0x23e2c7){if(_0xcf66f4[_0xe2d6('0x60')]['id']){delete _0xcf66f4[_0xe2d6('0x60')]['id'];}return db[_0xe2d6('0x43')][_0xe2d6('0x5f')]({'where':{'id':_0xcf66f4[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x12e856,null))['then'](function(_0x48e096){if(_0x48e096){_0xcf66f4[_0xe2d6('0x60')][_0xe2d6('0x65')]=_0x48e096['id'];return db[_0xe2d6('0x6d')][_0xe2d6('0x66')](_0xcf66f4[_0xe2d6('0x60')]);}})[_0xe2d6('0x21')](respondWithResult(_0x12e856,null))[_0xe2d6('0x2b')](handleError(_0x12e856,null));};exports[_0xe2d6('0x6e')]=function(_0x584593,_0x3d6d00,_0x220264){var _0x321dc3={'raw':![],'where':{}};var _0x50efff={};var _0x1ab41b={'count':0x0,'rows':[]};return db[_0xe2d6('0x43')][_0xe2d6('0x6f')]({'where':{'id':_0x584593['params']['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x3d6d00,null))['then'](function(_0x5025d5){if(_0x5025d5){_0x50efff[_0xe2d6('0x4a')]=_['keys'](db[_0xe2d6('0x6d')]['rawAttributes']);_0x50efff[_0xe2d6('0x4b')]=_[_0xe2d6('0x47')](_0x584593[_0xe2d6('0x4b')]);_0x50efff[_0xe2d6('0x48')]=_['intersection'](_0x50efff[_0xe2d6('0x4a')],_0x50efff[_0xe2d6('0x4b')]);_0x321dc3[_0xe2d6('0x4c')]=_[_0xe2d6('0x49')](_0x50efff[_0xe2d6('0x4a')],qs[_0xe2d6('0x4d')](_0x584593['query']['fields']));_0x321dc3[_0xe2d6('0x4c')]=_0x321dc3[_0xe2d6('0x4c')][_0xe2d6('0x4e')]?_0x321dc3[_0xe2d6('0x4c')]:_0x50efff[_0xe2d6('0x4a')];if(!_0x584593[_0xe2d6('0x4b')][_0xe2d6('0x4f')](_0xe2d6('0x50'))){_0x321dc3[_0xe2d6('0x31')]=qs[_0xe2d6('0x31')](_0x584593[_0xe2d6('0x4b')]['limit']);_0x321dc3[_0xe2d6('0x30')]=qs[_0xe2d6('0x30')](_0x584593[_0xe2d6('0x4b')][_0xe2d6('0x30')]);}_0x321dc3['order']=qs[_0xe2d6('0x52')](_0x584593[_0xe2d6('0x4b')]['sort']);_0x321dc3['where']=qs[_0xe2d6('0x48')](_[_0xe2d6('0x69')](_0x584593['query'],_0x50efff[_0xe2d6('0x48')]));_0x321dc3[_0xe2d6('0x53')][_0xe2d6('0x65')]=_0x5025d5['id'];if(_0x584593['query']['filter']){_0x321dc3[_0xe2d6('0x53')]=_[_0xe2d6('0x55')](_0x321dc3[_0xe2d6('0x53')],{'$or':_[_0xe2d6('0x42')](_0x321dc3['attributes'],function(_0x4c4196){var _0x3c233b={};_0x3c233b[_0x4c4196]={'$like':'%'+_0x584593[_0xe2d6('0x4b')][_0xe2d6('0x54')]+'%'};return _0x3c233b;})});}_0x321dc3=_['merge']({},_0x321dc3,_0x584593[_0xe2d6('0x56')]);return db['CannedAnswer'][_0xe2d6('0x57')]({'where':_0x321dc3[_0xe2d6('0x53')]})[_0xe2d6('0x21')](function(_0x49e022){_0x1ab41b[_0xe2d6('0x57')]=_0x49e022;if(_0x584593[_0xe2d6('0x4b')][_0xe2d6('0x58')]){_0x321dc3['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x321dc3);})[_0xe2d6('0x21')](function(_0x2a7d11){_0x1ab41b['rows']=_0x2a7d11;return _0x1ab41b;});}})['then'](respondWithFilteredResult(_0x3d6d00,_0x321dc3))[_0xe2d6('0x2b')](handleError(_0x3d6d00,null));};exports[_0xe2d6('0x70')]=function(_0x532d7a,_0x3cbbc0,_0x506a60){return db[_0xe2d6('0x43')]['find']({'where':{'id':_0x532d7a[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x3cbbc0,null))[_0xe2d6('0x21')](function(_0x1f65f5){if(_0x1f65f5){return _0x1f65f5[_0xe2d6('0x70')](_0x532d7a['query'][_0xe2d6('0x6b')]);}})[_0xe2d6('0x21')](respondWithStatusCode(_0x3cbbc0,null))[_0xe2d6('0x2b')](handleError(_0x3cbbc0,null));};exports['create']=function(_0x5044b0,_0x1439f7){var _0x57cc4a={'name':_0x5044b0[_0xe2d6('0x60')]['name'],'key':_0x5044b0['body'][_0xe2d6('0x46')],'email':_0x5044b0[_0xe2d6('0x60')][_0xe2d6('0x71')],'ListId':_0x5044b0[_0xe2d6('0x60')][_0xe2d6('0x72')],'active':!_[_0xe2d6('0x73')](_0x5044b0[_0xe2d6('0x60')][_0xe2d6('0x74')])?_0x5044b0[_0xe2d6('0x60')][_0xe2d6('0x74')]:!![],'description':_0x5044b0[_0xe2d6('0x60')][_0xe2d6('0x75')]||null,'Imap':{},'Smtp':{}};if(_[_0xe2d6('0x73')](_0x5044b0[_0xe2d6('0x60')][_0xe2d6('0x76')])){if(_0x5044b0[_0xe2d6('0x60')]['cauthentication']){_0x57cc4a[_0xe2d6('0x5c')][_0xe2d6('0x77')]=_0x57cc4a[_0xe2d6('0x62')]['user']=_0x5044b0[_0xe2d6('0x60')][_0xe2d6('0x78')];_0x57cc4a[_0xe2d6('0x5c')][_0xe2d6('0x79')]=_0x57cc4a[_0xe2d6('0x62')][_0xe2d6('0x7a')]=_0x5044b0[_0xe2d6('0x60')][_0xe2d6('0x7b')];}else{_0x57cc4a[_0xe2d6('0x5c')][_0xe2d6('0x7c')]=_0x57cc4a[_0xe2d6('0x62')][_0xe2d6('0x7c')]=![];}_0x57cc4a['Imap'][_0xe2d6('0x7d')]=_0x5044b0['body'][_0xe2d6('0x5c')]['host'];_0x57cc4a[_0xe2d6('0x5c')]['port']=_0x5044b0[_0xe2d6('0x60')]['Imap']['port'];_0x57cc4a[_0xe2d6('0x62')][_0xe2d6('0x7d')]=_0x5044b0[_0xe2d6('0x60')][_0xe2d6('0x62')][_0xe2d6('0x7d')];_0x57cc4a[_0xe2d6('0x62')][_0xe2d6('0x7e')]=_0x5044b0[_0xe2d6('0x60')][_0xe2d6('0x62')][_0xe2d6('0x7e')];}else{_0x57cc4a[_0xe2d6('0x5c')][_0xe2d6('0x7f')]=_0x57cc4a['Smtp'][_0xe2d6('0x7f')]=_0x5044b0[_0xe2d6('0x60')][_0xe2d6('0x76')];_0x57cc4a[_0xe2d6('0x5c')][_0xe2d6('0x77')]=_0x57cc4a[_0xe2d6('0x62')][_0xe2d6('0x77')]=_0x5044b0[_0xe2d6('0x60')]['cuser'];_0x57cc4a['Imap'][_0xe2d6('0x79')]=_0x57cc4a[_0xe2d6('0x62')]['pass']=_0x5044b0[_0xe2d6('0x60')][_0xe2d6('0x7b')];}return db['MailAccount']['create'](_0x57cc4a,{'include':[{'model':db[_0xe2d6('0x40')],'as':_0xe2d6('0x62')},{'model':db[_0xe2d6('0x3f')],'as':_0xe2d6('0x5c')}]})[_0xe2d6('0x21')](function(_0x102b39){var _0x40d92e=_0x5044b0['user'][_0xe2d6('0x38')]({'plain':!![]});if(!_0x40d92e)throw new Error(_0xe2d6('0x80'));if(_0x40d92e['role']===_0xe2d6('0x77')){var _0xc8465c=_0x102b39['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xe2d6('0x39'),'userProfileId':_0x40d92e[_0xe2d6('0x81')]},'raw':!![]})['then'](function(_0x1e33cb){if(_0x1e33cb&&_0x1e33cb[_0xe2d6('0x82')]===0x0){return db[_0xe2d6('0x3a')][_0xe2d6('0x66')]({'name':_0xc8465c[_0xe2d6('0x3c')],'resourceId':_0xc8465c['id'],'type':_0x1e33cb[_0xe2d6('0x3c')],'sectionId':_0x1e33cb['id']},{})['then'](function(){return _0x102b39;});}else{return _0x102b39;}})['catch'](function(_0x58c190){logger[_0xe2d6('0x28')](_0xe2d6('0x83'),_0x58c190);throw _0x58c190;});}return _0x102b39;})[_0xe2d6('0x21')](respondWithResult(_0x1439f7,0xc9))[_0xe2d6('0x2b')](handleError(_0x1439f7,null));};exports['getImap']=function(_0xa10f5a,_0x176a38,_0x21007d){return db[_0xe2d6('0x43')][_0xe2d6('0x6f')]({'where':{'id':_0xa10f5a[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x176a38,null))[_0xe2d6('0x21')](function(_0x5ebd88){if(_0x5ebd88){return _0x5ebd88['getImap']();}return null;})[_0xe2d6('0x21')](respondWithResult(_0x176a38,null))[_0xe2d6('0x2b')](handleError(_0x176a38,null));};exports[_0xe2d6('0x84')]=function(_0xacd9c6,_0x550df8,_0x59b2e1){if(_0xacd9c6[_0xe2d6('0x60')]['id']){delete _0xacd9c6[_0xe2d6('0x60')]['id'];}return db[_0xe2d6('0x43')]['find']({'where':{'id':_0xacd9c6['params']['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x550df8,null))['then'](function(_0x40041b){if(_0x40041b){_0xacd9c6[_0xe2d6('0x60')]['MailAccountId']=_0x40041b['id'];return db[_0xe2d6('0x3f')][_0xe2d6('0x66')](_0xacd9c6[_0xe2d6('0x60')]);}})['then'](respondWithResult(_0x550df8,null))[_0xe2d6('0x2b')](handleError(_0x550df8,null));};exports[_0xe2d6('0x85')]=function(_0x4b07a2,_0x93a5b,_0x511461){return db[_0xe2d6('0x43')][_0xe2d6('0x6f')]({'where':{'id':_0x4b07a2[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x93a5b,null))['then'](function(_0x225cf4){if(_0x225cf4){return _0x225cf4['setImap'](null);}return null;})[_0xe2d6('0x21')](respondWithStatusCode(_0x93a5b,null))[_0xe2d6('0x2b')](handleError(_0x93a5b,null));};exports['getSmtp']=function(_0x1031f5,_0x34eac7,_0x36636d){return db['MailAccount']['findOne']({'where':{'id':_0x1031f5[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x34eac7,null))[_0xe2d6('0x21')](function(_0x5bd7e8){if(_0x5bd7e8){return _0x5bd7e8[_0xe2d6('0x86')]();}return null;})['then'](respondWithResult(_0x34eac7,null))[_0xe2d6('0x2b')](handleError(_0x34eac7,null));};exports['addSmtp']=function(_0x1443dd,_0x5cc1be,_0x237982){if(_0x1443dd[_0xe2d6('0x60')]['id']){delete _0x1443dd['body']['id'];}return db[_0xe2d6('0x43')][_0xe2d6('0x5f')]({'where':{'id':_0x1443dd[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x5cc1be,null))[_0xe2d6('0x21')](function(_0x276704){if(_0x276704){_0x1443dd[_0xe2d6('0x60')][_0xe2d6('0x65')]=_0x276704['id'];return db[_0xe2d6('0x40')][_0xe2d6('0x66')](_0x1443dd[_0xe2d6('0x60')]);}})[_0xe2d6('0x21')](respondWithResult(_0x5cc1be,null))[_0xe2d6('0x2b')](handleError(_0x5cc1be,null));};exports[_0xe2d6('0x87')]=function(_0x5af208,_0x53b432,_0xd43fbc){return db[_0xe2d6('0x43')][_0xe2d6('0x6f')]({'where':{'id':_0x5af208[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x53b432,null))[_0xe2d6('0x21')](function(_0x58f30d){if(_0x58f30d){return _0x58f30d[_0xe2d6('0x88')](null);}return null;})[_0xe2d6('0x21')](respondWithStatusCode(_0x53b432,null))[_0xe2d6('0x2b')](handleError(_0x53b432,null));};exports['addInteraction']=function(_0x46f020,_0xa4f920,_0x341683){return db[_0xe2d6('0x89')][_0xe2d6('0x5f')]({'where':{'id':_0x46f020['params']['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0xa4f920,null))['then'](function(_0x4749c9){if(_0x4749c9){return _0x4749c9[_0xe2d6('0x8a')](_0x46f020['body'][_0xe2d6('0x6b')],_[_0xe2d6('0x8b')](_0x46f020[_0xe2d6('0x60')],['ids','id'])||{});}})[_0xe2d6('0x21')](respondWithResult(_0xa4f920,null))['catch'](handleError(_0xa4f920,null));};exports[_0xe2d6('0x8c')]=function(_0x5a082b,_0x14eaaf,_0x1b830a){var _0x2cda28={'raw':![],'where':{}};var _0x3bab16={};var _0x44f34f={'count':0x0,'rows':[]};return db[_0xe2d6('0x43')][_0xe2d6('0x6f')]({'where':{'id':_0x5a082b[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x14eaaf,null))[_0xe2d6('0x21')](function(_0x2b0707){if(_0x2b0707){_0x3bab16[_0xe2d6('0x4a')]=_['keys'](db[_0xe2d6('0x89')][_0xe2d6('0x5e')]);_0x3bab16['query']=_[_0xe2d6('0x47')](_0x5a082b[_0xe2d6('0x4b')]);_0x3bab16['filters']=_[_0xe2d6('0x49')](_0x3bab16[_0xe2d6('0x4a')],_0x3bab16[_0xe2d6('0x4b')]);_0x2cda28['attributes']=_[_0xe2d6('0x49')](_0x3bab16[_0xe2d6('0x4a')],qs[_0xe2d6('0x4d')](_0x5a082b['query'][_0xe2d6('0x4d')]));_0x2cda28['attributes']=_0x2cda28[_0xe2d6('0x4c')]['length']?_0x2cda28[_0xe2d6('0x4c')]:_0x3bab16[_0xe2d6('0x4a')];if(!_0x5a082b['query'][_0xe2d6('0x4f')](_0xe2d6('0x50'))){_0x2cda28[_0xe2d6('0x31')]=qs['limit'](_0x5a082b[_0xe2d6('0x4b')][_0xe2d6('0x31')]);_0x2cda28[_0xe2d6('0x30')]=qs[_0xe2d6('0x30')](_0x5a082b[_0xe2d6('0x4b')][_0xe2d6('0x30')]);}_0x2cda28[_0xe2d6('0x51')]=qs[_0xe2d6('0x52')](_0x5a082b[_0xe2d6('0x4b')][_0xe2d6('0x52')]);_0x2cda28[_0xe2d6('0x53')]=qs[_0xe2d6('0x48')](_['pick'](_0x5a082b[_0xe2d6('0x4b')],_0x3bab16[_0xe2d6('0x48')]));_0x2cda28[_0xe2d6('0x53')][_0xe2d6('0x65')]=_0x2b0707['id'];if(_0x5a082b['query'][_0xe2d6('0x54')]){_0x2cda28[_0xe2d6('0x53')]=_[_0xe2d6('0x55')](_0x2cda28[_0xe2d6('0x53')],{'$or':_[_0xe2d6('0x42')](_0x2cda28[_0xe2d6('0x4c')],function(_0x1fc6dd){var _0x354bac={};_0x354bac[_0x1fc6dd]={'$like':'%'+_0x5a082b[_0xe2d6('0x4b')][_0xe2d6('0x54')]+'%'};return _0x354bac;})});}_0x2cda28=_[_0xe2d6('0x55')]({},_0x2cda28,_0x5a082b[_0xe2d6('0x56')]);return db[_0xe2d6('0x89')][_0xe2d6('0x57')]({'where':_0x2cda28[_0xe2d6('0x53')]})[_0xe2d6('0x21')](function(_0x7d8ad3){_0x44f34f[_0xe2d6('0x57')]=_0x7d8ad3;if(_0x5a082b[_0xe2d6('0x4b')][_0xe2d6('0x58')]){_0x2cda28[_0xe2d6('0x59')]=[{'model':db[_0xe2d6('0x8d')],'as':'Contact','required':![]},{'model':db[_0xe2d6('0x8e')],'as':_0xe2d6('0x8f'),'attributes':[_0xe2d6('0x3c'),_0xe2d6('0x90'),_0xe2d6('0x91')],'required':![]},{'model':db[_0xe2d6('0x92')],'as':_0xe2d6('0x93'),'attributes':['id',_0xe2d6('0x3c'),_0xe2d6('0x94')],'where':_0x5a082b[_0xe2d6('0x4b')][_0xe2d6('0x95')]?{'id':_0x5a082b['query'][_0xe2d6('0x95')]}:undefined,'required':_0x5a082b[_0xe2d6('0x4b')][_0xe2d6('0x95')]?!![]:![]}];}return db[_0xe2d6('0x89')][_0xe2d6('0x5a')](_0x2cda28);})[_0xe2d6('0x21')](function(_0x578fc3){_0x44f34f[_0xe2d6('0x96')]=_0x578fc3;return _0x44f34f;});}})['then'](respondWithFilteredResult(_0x14eaaf,_0x2cda28))[_0xe2d6('0x2b')](handleError(_0x14eaaf,null));};exports[_0xe2d6('0x97')]=function(_0x2cb8bc,_0x3724df,_0x3a3d12){return db[_0xe2d6('0x43')][_0xe2d6('0x6f')]({'where':{'id':_0x2cb8bc[_0xe2d6('0x61')]['id']}})['then'](handleEntityNotFound(_0x3724df,null))[_0xe2d6('0x21')](function(_0x5f6b86){if(_0x5f6b86){return db[_0xe2d6('0x98')]['transaction'](function(_0x5ecd77){return db[_0xe2d6('0x99')][_0xe2d6('0x9a')]({'where':{'MailAccountId':_0x2cb8bc[_0xe2d6('0x61')]['id']},'transaction':_0x5ecd77})['then'](function(_0x229374){var _0x58f1ed=_[_0xe2d6('0x42')](_0x2cb8bc[_0xe2d6('0x60')],function(_0x1c74be){_0x1c74be[_0xe2d6('0x65')]=_0x2cb8bc[_0xe2d6('0x61')]['id'];return _0x1c74be;});return db[_0xe2d6('0x99')][_0xe2d6('0x9b')](_0x58f1ed,{'transaction':_0x5ecd77});});})[_0xe2d6('0x21')](function(){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x2cb8bc[_0xe2d6('0x61')]['id']},'order':_0xe2d6('0x9c')});});}})[_0xe2d6('0x21')](respondWithResult(_0x3724df,null))[_0xe2d6('0x2b')](handleError(_0x3724df,null));};exports[_0xe2d6('0x9d')]=function(_0x568e07,_0x2562a7,_0xb8e9a3){var _0xd76eb1={};var _0x6790d4={};var _0x562882;var _0x3c5129;return db[_0xe2d6('0x43')][_0xe2d6('0x6f')]({'where':{'id':_0x568e07[_0xe2d6('0x61')]['id']}})['then'](handleEntityNotFound(_0x2562a7,null))[_0xe2d6('0x21')](function(_0x580bf3){if(_0x580bf3){_0x562882=_0x580bf3;_0x6790d4[_0xe2d6('0x4a')]=_['keys'](db[_0xe2d6('0x99')][_0xe2d6('0x5e')]);_0x6790d4[_0xe2d6('0x4b')]=_[_0xe2d6('0x47')](_0x568e07[_0xe2d6('0x4b')]);_0x6790d4[_0xe2d6('0x48')]=_[_0xe2d6('0x49')](_0x6790d4['model'],_0x6790d4['query']);_0xd76eb1[_0xe2d6('0x4c')]=_[_0xe2d6('0x49')](_0x6790d4[_0xe2d6('0x4a')],qs[_0xe2d6('0x4d')](_0x568e07[_0xe2d6('0x4b')][_0xe2d6('0x4d')]));_0xd76eb1[_0xe2d6('0x4c')]=_0xd76eb1[_0xe2d6('0x4c')][_0xe2d6('0x4e')]?_0xd76eb1['attributes']:_0x6790d4[_0xe2d6('0x4a')];_0xd76eb1[_0xe2d6('0x51')]=qs[_0xe2d6('0x52')](_0x568e07[_0xe2d6('0x4b')]['sort']);_0xd76eb1[_0xe2d6('0x53')]=qs[_0xe2d6('0x48')](_[_0xe2d6('0x69')](_0x568e07[_0xe2d6('0x4b')],_0x6790d4[_0xe2d6('0x48')]));if(_0x568e07[_0xe2d6('0x4b')][_0xe2d6('0x54')]){_0xd76eb1['where']=_[_0xe2d6('0x55')](_0xd76eb1[_0xe2d6('0x53')],{'$or':_[_0xe2d6('0x42')](_0xd76eb1[_0xe2d6('0x4c')],function(_0x3f9ef0){var _0x3e1bdb={};_0x3e1bdb[_0x3f9ef0]={'$like':'%'+_0x568e07[_0xe2d6('0x4b')]['filter']+'%'};return _0x3e1bdb;})});}_0xd76eb1=_[_0xe2d6('0x55')]({},_0xd76eb1,_0x568e07[_0xe2d6('0x56')]);return _0x562882[_0xe2d6('0x9d')](_0xd76eb1);}})[_0xe2d6('0x21')](function(_0x49afa7){if(_0x49afa7){_0x3c5129=_0x49afa7[_0xe2d6('0x4e')];if(!_0x568e07[_0xe2d6('0x4b')]['hasOwnProperty'](_0xe2d6('0x50'))){_0xd76eb1[_0xe2d6('0x31')]=qs[_0xe2d6('0x31')](_0x568e07['query'][_0xe2d6('0x31')]);_0xd76eb1['offset']=qs[_0xe2d6('0x30')](_0x568e07[_0xe2d6('0x4b')][_0xe2d6('0x30')]);}return _0x562882[_0xe2d6('0x9d')](_0xd76eb1);}})['then'](function(_0x1ae853){if(_0x1ae853){return _0x1ae853?{'count':_0x3c5129,'rows':_0x1ae853}:null;}})[_0xe2d6('0x21')](respondWithResult(_0x2562a7,null))['catch'](handleError(_0x2562a7,null));};exports[_0xe2d6('0x9e')]=function(_0x33a766,_0x310388,_0x2173d8){var _0x4454fa={'raw':!![],'where':{}};var _0x409ebd={};var _0x1e0d24={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x33a766[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x310388,null))['then'](function(_0x3e096b){if(_0x3e096b){_0x409ebd[_0xe2d6('0x4a')]=_[_0xe2d6('0x47')](db['MailMessage'][_0xe2d6('0x5e')]);_0x409ebd[_0xe2d6('0x4b')]=_['keys'](_0x33a766[_0xe2d6('0x4b')]);_0x409ebd[_0xe2d6('0x48')]=_[_0xe2d6('0x49')](_0x409ebd['model'],_0x409ebd[_0xe2d6('0x4b')]);_0x4454fa['attributes']=_[_0xe2d6('0x49')](_0x409ebd[_0xe2d6('0x4a')],qs['fields'](_0x33a766[_0xe2d6('0x4b')][_0xe2d6('0x4d')]));_0x4454fa['attributes']=_0x4454fa[_0xe2d6('0x4c')][_0xe2d6('0x4e')]?_0x4454fa['attributes']:_0x409ebd[_0xe2d6('0x4a')];if(!_0x33a766[_0xe2d6('0x4b')]['hasOwnProperty']('nolimit')){_0x4454fa[_0xe2d6('0x31')]=qs['limit'](_0x33a766[_0xe2d6('0x4b')][_0xe2d6('0x31')]);_0x4454fa[_0xe2d6('0x30')]=qs[_0xe2d6('0x30')](_0x33a766['query'][_0xe2d6('0x30')]);}_0x4454fa['order']=qs[_0xe2d6('0x52')](_0x33a766[_0xe2d6('0x4b')][_0xe2d6('0x52')]);_0x4454fa[_0xe2d6('0x53')]=qs[_0xe2d6('0x48')](_[_0xe2d6('0x69')](_0x33a766[_0xe2d6('0x4b')],_0x409ebd[_0xe2d6('0x48')]));_0x4454fa[_0xe2d6('0x53')][_0xe2d6('0x65')]=_0x3e096b['id'];if(_0x33a766['query'][_0xe2d6('0x54')]){_0x4454fa[_0xe2d6('0x53')]=_[_0xe2d6('0x55')](_0x4454fa[_0xe2d6('0x53')],{'$or':_['map'](_0x4454fa[_0xe2d6('0x4c')],function(_0x1c7911){var _0x5acefb={};_0x5acefb[_0x1c7911]={'$like':'%'+_0x33a766[_0xe2d6('0x4b')][_0xe2d6('0x54')]+'%'};return _0x5acefb;})});}if(_0x33a766[_0xe2d6('0x4b')][_0xe2d6('0x9f')]){var _0xa27451=_0x33a766[_0xe2d6('0x4b')][_0xe2d6('0x9f')][_0xe2d6('0xa0')](',');var _0x5caac6={};_0x5caac6[_0xa27451[0x0]]={'$gte':moment(_0xa27451[0x1])[_0xe2d6('0xa1')](_0xe2d6('0xa2'))};_0x4454fa[_0xe2d6('0x53')]=_[_0xe2d6('0x55')](_0x4454fa['where'],_0x5caac6);}_0x4454fa=_[_0xe2d6('0x55')]({},_0x4454fa,_0x33a766[_0xe2d6('0x56')]);return db[_0xe2d6('0xa3')][_0xe2d6('0x57')]({'where':_0x4454fa[_0xe2d6('0x53')]})[_0xe2d6('0x21')](function(_0x287251){_0x1e0d24[_0xe2d6('0x57')]=_0x287251;if(_0x33a766[_0xe2d6('0x4b')]['includeAll']){_0x4454fa[_0xe2d6('0x59')]=[{'all':!![]}];}return db[_0xe2d6('0xa3')][_0xe2d6('0x5a')](_0x4454fa);})['then'](function(_0x5e6ebe){if(_0x33a766[_0xe2d6('0x4b')][_0xe2d6('0xa4')]===_0xe2d6('0xa5')){for(var _0x3454d2=0x0;_0x3454d2<_0x5e6ebe[_0xe2d6('0x4e')];_0x3454d2++){_0x5e6ebe[_0x3454d2]['body']=juice(_0x5e6ebe[_0x3454d2][_0xe2d6('0x60')]);}}_0x1e0d24['rows']=_0x5e6ebe;return _0x1e0d24;});}})[_0xe2d6('0x21')](respondWithFilteredResult(_0x310388,_0x4454fa))[_0xe2d6('0x2b')](handleError(_0x310388,null));};exports['send']=function(_0x41c934,_0x41a798,_0x320ac4){var _0x2222c5,_0x4ea805={},_0x4256bc;if(_0x41c934['body']['to']){_0x4256bc=_0x41c934[_0xe2d6('0x60')]['to']['split'](',')[0x0];}return db['MailAccount'][_0xe2d6('0x5f')]({'where':{'id':_0x41c934[_0xe2d6('0x61')]['id']},'include':[{'model':db[_0xe2d6('0xa6')],'as':_0xe2d6('0xa7'),'include':[{'model':db[_0xe2d6('0x8d')],'as':_0xe2d6('0xa8'),'where':{'email':_0x4256bc},'limit':0x1,'order':[[_0xe2d6('0xa9'),_0xe2d6('0xaa')]]}]},{'model':db['MailServerOut'],'as':_0xe2d6('0x62'),'raw':!![]}]})['then'](handleEntityNotFound(_0x41a798,null))[_0xe2d6('0x21')](function(_0x1ada59){if(_0x1ada59){_0x2222c5=_0x1ada59;if(_0x1ada59[_0xe2d6('0x62')]){if(_[_0xe2d6('0x73')](_0x41c934[_0xe2d6('0x60')][_0xe2d6('0xab')])){_0x41c934[_0xe2d6('0x60')][_0xe2d6('0xab')]=util[_0xe2d6('0xa1')](_0xe2d6('0xac'),_0x1ada59[_0xe2d6('0x3c')],_0x1ada59[_0xe2d6('0x71')]||_0x1ada59['Smtp'][_0xe2d6('0x77')]);}if(_0x41c934[_0xe2d6('0x60')][_0xe2d6('0xad')]&&_0x41c934['body']['attachments'][_0xe2d6('0x4e')]){for(var _0x2ce7d6=0x0;_0x2ce7d6<_0x41c934[_0xe2d6('0x60')][_0xe2d6('0xad')]['length'];_0x2ce7d6+=0x1){_0x41c934['body'][_0xe2d6('0xad')][_0x2ce7d6]={'filename':_0x41c934[_0xe2d6('0x60')]['attachments'][_0x2ce7d6]['name'],'path':path[_0xe2d6('0xae')](config[_0xe2d6('0xaf')],_0xe2d6('0xb0'),_0x41c934[_0xe2d6('0x60')]['attachments'][_0x2ce7d6]['basename'])};}}var _0xb2cbf5={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x1ada59['Smtp']['service'])){if(_0x1ada59[_0xe2d6('0x62')][_0xe2d6('0x7c')]){_0xb2cbf5[_0xe2d6('0xb1')]={'user':_0x1ada59[_0xe2d6('0x62')][_0xe2d6('0x77')],'pass':_0x1ada59['Smtp']['pass']};}_0xb2cbf5[_0xe2d6('0x7d')]=_0x1ada59[_0xe2d6('0x62')][_0xe2d6('0x7d')];_0xb2cbf5[_0xe2d6('0x7e')]=_0x1ada59[_0xe2d6('0x62')][_0xe2d6('0x7e')];_0xb2cbf5[_0xe2d6('0xb2')]=_0x1ada59[_0xe2d6('0x62')]['secure'];}else{_0xb2cbf5[_0xe2d6('0x7f')]=_0x1ada59[_0xe2d6('0x62')][_0xe2d6('0x7f')];_0xb2cbf5[_0xe2d6('0xb1')]={'user':_0x1ada59['Smtp'][_0xe2d6('0x77')],'pass':_0x1ada59[_0xe2d6('0x62')][_0xe2d6('0x7a')]};}return respondWithRpcPromise('SendMail',_0xe2d6('0xb3'),{'account':_0xb2cbf5,'message':_0x41c934[_0xe2d6('0x60')]});}else{throw new Error(_0xe2d6('0xb4'));}}})['then'](function(_0x50b7cf){if(_0x50b7cf){_0x4ea805=_0x50b7cf;if(_0x2222c5[_0xe2d6('0xa7')]){if(_0x2222c5[_0xe2d6('0xa7')]['Contacts']['length']){return _0x2222c5[_0xe2d6('0xa7')][_0xe2d6('0xa8')][0x0];}else{return db[_0xe2d6('0x8d')][_0xe2d6('0x66')](_[_0xe2d6('0xb5')](_0x41c934[_0xe2d6('0x60')],{'firstName':_0x41c934[_0xe2d6('0x60')]['to'],'email':_0x41c934[_0xe2d6('0x60')]['to'],'phone':_0x41c934[_0xe2d6('0x60')]['to'],'ListId':_0x2222c5[_0xe2d6('0x72')]}));}}else{throw new Error(_0xe2d6('0xb4'));}}})[_0xe2d6('0x21')](function(_0xf1099a){if(_0xf1099a){var _0x428042={'UserId':_0x41c934[_0xe2d6('0x77')]['id'],'ContactId':_0xf1099a['id'],'MailAccountId':_0x2222c5['id'],'inReplyTo':_0x4ea805[_0xe2d6('0xb6')],'to':_0x41c934[_0xe2d6('0x60')][_0xe2d6('0xab')],'cc':_0x41c934[_0xe2d6('0x60')]['cc'],'subject':_0x41c934[_0xe2d6('0x60')][_0xe2d6('0xb7')],'attach':_0x41c934[_0xe2d6('0x60')][_0xe2d6('0xb8')],'firstMsgDirection':_0xe2d6('0xb9'),'lastMsgAt':moment()[_0xe2d6('0xa1')](_0xe2d6('0xa2')),'lastMsgDirection':_0xe2d6('0xb9'),'lastMsgBody':_0x41c934[_0xe2d6('0x60')][_0xe2d6('0x60')],'Messages':[_[_0xe2d6('0x55')](_0x41c934[_0xe2d6('0x60')],{'messageId':_0x4ea805[_0xe2d6('0xb6')],'sentAt':moment()['format'](_0xe2d6('0xa2')),'read':!![],'MailAccountId':_0x2222c5['id'],'UserId':_0x41c934[_0xe2d6('0x77')]['id'],'ContactId':_0xf1099a['id']})]};if(_0x41c934[_0xe2d6('0x60')][_0xe2d6('0xba')]){_0x428042=_[_0xe2d6('0x55')](_0x428042,_0x41c934[_0xe2d6('0x60')][_0xe2d6('0xba')]);}return db[_0xe2d6('0x89')][_0xe2d6('0x66')](_0x428042,{'include':[{'model':db[_0xe2d6('0xa3')],'as':_0xe2d6('0xbb')}]});}})[_0xe2d6('0x21')](respondWithResult(_0x41a798,null))[_0xe2d6('0x2b')](handleError(_0x41a798,null));};exports[_0xe2d6('0xbc')]=function(_0x10bedd,_0x19a088,_0x488c49){return db['MailAccount'][_0xe2d6('0x5f')]({'where':{'id':_0x10bedd[_0xe2d6('0x61')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xe2d6('0x62'),'raw':!![]}]})[_0xe2d6('0x21')](handleEntityNotFound(_0x19a088,null))[_0xe2d6('0x21')](function(_0xb7599){if(_0xb7599&&_0xb7599[_0xe2d6('0x62')]){var _0x229ee4={'id':_0xb7599['id'],'tls':{'rejectUnauthorized':![]}};if(_0xb7599[_0xe2d6('0x62')][_0xe2d6('0x7f')]){_0x229ee4[_0xe2d6('0x7f')]=_0xb7599['Smtp']['service'];}else{_0x229ee4[_0xe2d6('0x7d')]=_0xb7599['Smtp'][_0xe2d6('0x7d')];_0x229ee4[_0xe2d6('0x7e')]=_0xb7599[_0xe2d6('0x62')][_0xe2d6('0x7e')];_0x229ee4[_0xe2d6('0xb2')]=_0xb7599[_0xe2d6('0x62')]['secure'];}if(_0xb7599[_0xe2d6('0x62')][_0xe2d6('0x7c')]){_0x229ee4[_0xe2d6('0xb1')]={'user':_0xb7599[_0xe2d6('0x62')][_0xe2d6('0x77')],'pass':_0xb7599['Smtp'][_0xe2d6('0x7a')]};}return respondWithRpcPromise(_0xe2d6('0xbd'),_0xe2d6('0xbc'),{'account':_0x229ee4});}})[_0xe2d6('0x21')](respondWithResult(_0x19a088,null))[_0xe2d6('0x2b')](handleError(_0x19a088,null));};exports[_0xe2d6('0x9a')]=function(_0x324b4f,_0x1d01ce){return db[_0xe2d6('0x43')][_0xe2d6('0x5f')]({'where':{'id':_0x324b4f[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x1d01ce,null))[_0xe2d6('0x21')](function(_0x55fc0c){if(_0x55fc0c&&_0x55fc0c[_0xe2d6('0x7f')]){throw new db['Sequelize'][(_0xe2d6('0xbe'))](_0xe2d6('0xbf'));}return _0x55fc0c;})[_0xe2d6('0x21')](removeEntity(_0x1d01ce,null))['catch'](handleError(_0x1d01ce,null));};exports[_0xe2d6('0xc0')]=function(_0x33804f,_0x2ee199,_0x5e124e){return db['MailAccount']['find']({'where':{'id':_0x33804f[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x2ee199,null))[_0xe2d6('0x21')](function(_0x49725a){if(_0x49725a){return _0x49725a[_0xe2d6('0xc0')](_0x33804f[_0xe2d6('0x60')][_0xe2d6('0x6b')],_[_0xe2d6('0x8b')](_0x33804f[_0xe2d6('0x60')],[_0xe2d6('0x6b'),'id'])||{})[_0xe2d6('0xc1')](function(_0x3ba97f){for(var _0xb8fb84=0x0;_0xb8fb84<_0x33804f[_0xe2d6('0x60')][_0xe2d6('0x6b')][_0xe2d6('0x4e')];_0xb8fb84+=0x1){socket['emit'](_0xe2d6('0xc2'),{'UserId':_0x33804f['body']['ids'][_0xb8fb84],'MailAccountId':_0x33804f[_0xe2d6('0x61')]['id']});}return _0x3ba97f;});}})[_0xe2d6('0x21')](respondWithResult(_0x2ee199,null))['catch'](handleError(_0x2ee199,null));};exports['removeAgents']=function(_0x48fba0,_0x3d6d98,_0x45c7f1){return db[_0xe2d6('0x43')][_0xe2d6('0x5f')]({'where':{'id':_0x48fba0[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x3d6d98,null))['then'](function(_0x6803ee){if(_0x6803ee){return _0x6803ee[_0xe2d6('0xc3')](_0x48fba0[_0xe2d6('0x4b')]['ids'])[_0xe2d6('0x21')](function(){if(_[_0xe2d6('0xc4')](_0x48fba0['query'][_0xe2d6('0x6b')])){for(var _0x4861ae=0x0;_0x4861ae<_0x48fba0[_0xe2d6('0x4b')]['ids']['length'];_0x4861ae+=0x1){socket[_0xe2d6('0xc5')]('userMailAccount:remove',{'UserId':Number(_0x48fba0[_0xe2d6('0x4b')][_0xe2d6('0x6b')][_0x4861ae]),'MailAccountId':Number(_0x48fba0[_0xe2d6('0x61')]['id'])});}}else{socket['emit'](_0xe2d6('0xc6'),{'UserId':Number(_0x48fba0[_0xe2d6('0x4b')][_0xe2d6('0x6b')]),'MailAccountId':Number(_0x48fba0[_0xe2d6('0x61')]['id'])});}});}})[_0xe2d6('0x21')](respondWithStatusCode(_0x3d6d98,null))[_0xe2d6('0x2b')](handleError(_0x3d6d98,null));};exports['getAgents']=function(_0x4aa98d,_0x3441e1,_0x374197){var _0x4ee4f9={};var _0x47ee17={};var _0x4896ed;var _0x3db6b6;return db[_0xe2d6('0x43')][_0xe2d6('0x6f')]({'where':{'id':_0x4aa98d[_0xe2d6('0x61')]['id']}})[_0xe2d6('0x21')](handleEntityNotFound(_0x3441e1,null))[_0xe2d6('0x21')](function(_0x42c4f3){if(_0x42c4f3){_0x4896ed=_0x42c4f3;_0x47ee17['model']=_[_0xe2d6('0x47')](db[_0xe2d6('0x8e')][_0xe2d6('0x5e')]);_0x47ee17[_0xe2d6('0x4b')]=_[_0xe2d6('0x47')](_0x4aa98d[_0xe2d6('0x4b')]);_0x47ee17[_0xe2d6('0x48')]=_['intersection'](_0x47ee17[_0xe2d6('0x4a')],_0x47ee17['query']);_0x4ee4f9[_0xe2d6('0x4c')]=_[_0xe2d6('0x49')](_0x47ee17[_0xe2d6('0x4a')],qs[_0xe2d6('0x4d')](_0x4aa98d[_0xe2d6('0x4b')][_0xe2d6('0x4d')]));_0x4ee4f9['attributes']=_0x4ee4f9[_0xe2d6('0x4c')][_0xe2d6('0x4e')]?_0x4ee4f9[_0xe2d6('0x4c')]:_0x47ee17['model'];_0x4ee4f9[_0xe2d6('0x51')]=qs[_0xe2d6('0x52')](_0x4aa98d[_0xe2d6('0x4b')]['sort']);_0x4ee4f9['where']=qs[_0xe2d6('0x48')](_[_0xe2d6('0x69')](_0x4aa98d['query'],_0x47ee17[_0xe2d6('0x48')]));if(_0x4aa98d[_0xe2d6('0x4b')][_0xe2d6('0x54')]){_0x4ee4f9[_0xe2d6('0x53')]=_[_0xe2d6('0x55')](_0x4ee4f9['where'],{'$or':_[_0xe2d6('0x42')](_0x4ee4f9[_0xe2d6('0x4c')],function(_0x3d216f){var _0x3513b4={};_0x3513b4[_0x3d216f]={'$like':'%'+_0x4aa98d[_0xe2d6('0x4b')]['filter']+'%'};return _0x3513b4;})});}_0x4ee4f9=_[_0xe2d6('0x55')]({},_0x4ee4f9,_0x4aa98d[_0xe2d6('0x56')]);return _0x4896ed['getAgents'](_0x4ee4f9);}})[_0xe2d6('0x21')](function(_0xb46f5c){if(_0xb46f5c){_0x3db6b6=_0xb46f5c['length'];if(!_0x4aa98d['query'][_0xe2d6('0x4f')](_0xe2d6('0x50'))){_0x4ee4f9[_0xe2d6('0x31')]=qs['limit'](_0x4aa98d[_0xe2d6('0x4b')][_0xe2d6('0x31')]);_0x4ee4f9[_0xe2d6('0x30')]=qs[_0xe2d6('0x30')](_0x4aa98d['query']['offset']);}return _0x4896ed[_0xe2d6('0xc7')](_0x4ee4f9);}})[_0xe2d6('0x21')](function(_0x529b00){if(_0x529b00){return _0x529b00?{'count':_0x3db6b6,'rows':_0x529b00}:null;}})[_0xe2d6('0x21')](respondWithResult(_0x3441e1,null))[_0xe2d6('0x2b')](handleError(_0x3441e1,null));}; \ No newline at end of file +var _0xee73=['MailServerIn','Imap','Smtp','Pause','map','MailAccount','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','body','find','MailServerOut','describe','Disposition','create','getDispositions','findOne','MailAccountId','addAnswer','CannedAnswer','getAnswers','nolimit','removeAnswers','ids','email','ListId','isNil','active','cservice','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','setSmtp','addInteraction','MailInteraction','CmContact','Contact','User','Owner','fullname','Tags','color','tag','addApplications','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','CmList','Contacts','updatedAt','from','%s\x20<%s>','attachments','join','basename','auth','secure','SendMail','sendMail','List','List\x20not\x20found','messageId','out','Interaction','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','crypto','papaparse','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','apply','save','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','index'];(function(_0x1d8020,_0x5950c4){var _0x51e791=function(_0x2802d3){while(--_0x2802d3){_0x1d8020['push'](_0x1d8020['shift']());}};_0x51e791(++_0x5950c4);}(_0xee73,0x13e));var _0x3ee7=function(_0x12e650,_0x33f29f){_0x12e650=_0x12e650-0x0;var _0x5b56b1=_0xee73[_0x12e650];return _0x5b56b1;};'use strict';var pdf=require(_0x3ee7('0x0'));var emlformat=require(_0x3ee7('0x1'));var rimraf=require(_0x3ee7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ee7('0x3'));var rp=require(_0x3ee7('0x4'));var moment=require(_0x3ee7('0x5'));var BPromise=require(_0x3ee7('0x6'));var Mustache=require(_0x3ee7('0x7'));var util=require(_0x3ee7('0x8'));var path=require(_0x3ee7('0x9'));var sox=require('sox');var csv=require(_0x3ee7('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3ee7('0xb'));var squel=require('squel');var crypto=require(_0x3ee7('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3ee7('0xa'));var querystring=require('querystring');var Papa=require(_0x3ee7('0xd'));var htmlToText=require(_0x3ee7('0xe'));var juice=require(_0x3ee7('0xf'));var Redis=require(_0x3ee7('0x10'));var authService=require(_0x3ee7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3ee7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ee7('0x13'))('api');var utils=require(_0x3ee7('0x14'));var config=require(_0x3ee7('0x15'));var licenseUtil=require(_0x3ee7('0x16'));var db=require(_0x3ee7('0x17'))['db'];config['redis']=_[_0x3ee7('0x18')](config[_0x3ee7('0x19')],{'host':_0x3ee7('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3ee7('0x19')]));require(_0x3ee7('0x1b'))[_0x3ee7('0x1c')](socket);var jayson=require(_0x3ee7('0x1d'));var client=jayson[_0x3ee7('0x1e')][_0x3ee7('0x1f')]({'port':0x232b});function respondWithRpcPromise(_0x971150,_0x1ade27,_0x10b61a,_0x28755a){return new BPromise(function(_0x4db9a8,_0x304b03){var _0x12b5eb=_0x28755a||client;return _0x12b5eb[_0x3ee7('0x20')](_0x971150,_0x10b61a)[_0x3ee7('0x21')](function(_0xd32397){logger[_0x3ee7('0x22')](_0x3ee7('0x23'),_0x1ade27,'request\x20sent');logger['debug'](_0x3ee7('0x24'),_0x1ade27,_0x3ee7('0x25'),JSON[_0x3ee7('0x26')](_0xd32397));if(_0xd32397['error']){if(_0xd32397[_0x3ee7('0x27')][_0x3ee7('0x28')]===0x1f4){logger[_0x3ee7('0x27')]('MailAccount,\x20%s,\x20%s',_0x1ade27,_0xd32397[_0x3ee7('0x27')][_0x3ee7('0x29')]);return _0x304b03(_0xd32397[_0x3ee7('0x27')][_0x3ee7('0x29')]);}logger[_0x3ee7('0x27')](_0x3ee7('0x23'),_0x1ade27,_0xd32397['error']['message']);return _0x4db9a8(_0xd32397['error'][_0x3ee7('0x29')]);}else{logger[_0x3ee7('0x22')](_0x3ee7('0x23'),_0x1ade27,_0x3ee7('0x25'));_0x4db9a8(_0xd32397[_0x3ee7('0x2a')]['message']);}})[_0x3ee7('0x2b')](function(_0x4eeca5){logger[_0x3ee7('0x27')](_0x3ee7('0x23'),_0x1ade27,_0x4eeca5);_0x304b03(_0x4eeca5);});});}function respondWithStatusCode(_0x3818a5,_0x2740bb){_0x2740bb=_0x2740bb||0xcc;return function(_0x44b4ea){if(_0x44b4ea){return _0x3818a5[_0x3ee7('0x2c')](_0x2740bb);}return _0x3818a5[_0x3ee7('0x2d')](_0x2740bb)[_0x3ee7('0x2e')]();};}function respondWithResult(_0x3d5a70,_0x37d49b){_0x37d49b=_0x37d49b||0xc8;return function(_0x4be634){if(_0x4be634){return _0x3d5a70[_0x3ee7('0x2d')](_0x37d49b)[_0x3ee7('0x2f')](_0x4be634);}};}function respondWithFilteredResult(_0x51a3a7,_0x36c237){return function(_0x194b74){if(_0x194b74){var _0x2c9a78=_0x194b74[_0x3ee7('0x30')],_0xdd970f=_0x36c237[_0x3ee7('0x31')],_0x48e557=_0x36c237[_0x3ee7('0x31')]+_0x36c237['limit'],_0x797b49;if(_0x48e557>=_0x2c9a78){_0x48e557=_0x2c9a78;_0x797b49=0xc8;}else{_0x797b49=0xce;}_0x51a3a7[_0x3ee7('0x2d')](_0x797b49);return _0x51a3a7[_0x3ee7('0x32')]('Content-Range',_0xdd970f+'-'+_0x48e557+'/'+_0x2c9a78)[_0x3ee7('0x2f')](_0x194b74);}return null;};}function patchUpdates(_0x37ec01){return function(_0x25eb46){try{jsonpatch[_0x3ee7('0x33')](_0x25eb46,_0x37ec01,!![]);}catch(_0x3fa86f){return BPromise['reject'](_0x3fa86f);}return _0x25eb46[_0x3ee7('0x34')]();};}function saveUpdates(_0x3f4285,_0x5d1771){return function(_0x50368b){if(_0x50368b){return _0x50368b[_0x3ee7('0x35')](_0x3f4285)[_0x3ee7('0x21')](function(_0x5353f1){return _0x5353f1;});}return null;};}function removeEntity(_0x425b19,_0x262623){return function(_0x22c8a0){if(_0x22c8a0){return _0x22c8a0[_0x3ee7('0x36')]()['then'](function(){var _0x2d5294=_0x22c8a0[_0x3ee7('0x37')]({'plain':!![]});var _0x4158b2=_0x3ee7('0x38');return db[_0x3ee7('0x39')][_0x3ee7('0x36')]({'where':{'type':_0x4158b2,'resourceId':_0x2d5294['id']}})['then'](function(){return _0x22c8a0;});})[_0x3ee7('0x21')](function(){_0x425b19[_0x3ee7('0x2d')](0xcc)[_0x3ee7('0x2e')]();});}};}function handleEntityNotFound(_0x240b41,_0x17077c){return function(_0x29c8ec){if(!_0x29c8ec){_0x240b41[_0x3ee7('0x2c')](0x194);}return _0x29c8ec;};}function handleError(_0x35b3d0,_0x307e04){_0x307e04=_0x307e04||0x1f4;return function(_0x322d25){logger[_0x3ee7('0x27')](_0x322d25[_0x3ee7('0x3a')]);if(_0x322d25[_0x3ee7('0x3b')]){delete _0x322d25[_0x3ee7('0x3b')];}_0x35b3d0[_0x3ee7('0x2d')](_0x307e04)[_0x3ee7('0x3c')](_0x322d25);};}exports[_0x3ee7('0x3d')]=function(_0x129302,_0x3b694b){var _0x5dfb0a={'include':[{'model':db[_0x3ee7('0x3e')],'as':_0x3ee7('0x3f')},{'model':db['MailServerOut'],'as':_0x3ee7('0x40')},{'model':db[_0x3ee7('0x41')],'as':'mandatoryDispositionPause'}]},_0x3ffe5c={},_0x22d4f5={'count':0x0,'rows':[]};var _0x1e07f2=_[_0x3ee7('0x42')](db[_0x3ee7('0x43')][_0x3ee7('0x44')],function(_0x5393c1){return{'name':_0x5393c1[_0x3ee7('0x45')],'type':_0x5393c1['type'][_0x3ee7('0x46')]};});_0x3ffe5c[_0x3ee7('0x47')]=_[_0x3ee7('0x42')](_0x1e07f2,_0x3ee7('0x3b'));_0x3ffe5c[_0x3ee7('0x48')]=_[_0x3ee7('0x49')](_0x129302[_0x3ee7('0x48')]);_0x3ffe5c[_0x3ee7('0x4a')]=_['intersection'](_0x3ffe5c[_0x3ee7('0x47')],_0x3ffe5c[_0x3ee7('0x48')]);_0x5dfb0a[_0x3ee7('0x4b')]=_[_0x3ee7('0x4c')](_0x3ffe5c[_0x3ee7('0x47')],qs[_0x3ee7('0x4d')](_0x129302[_0x3ee7('0x48')][_0x3ee7('0x4d')]));_0x5dfb0a['attributes']=_0x5dfb0a[_0x3ee7('0x4b')][_0x3ee7('0x4e')]?_0x5dfb0a['attributes']:_0x3ffe5c[_0x3ee7('0x47')];if(!_0x129302[_0x3ee7('0x48')][_0x3ee7('0x4f')]('nolimit')){_0x5dfb0a[_0x3ee7('0x50')]=qs[_0x3ee7('0x50')](_0x129302['query']['limit']);_0x5dfb0a[_0x3ee7('0x31')]=qs[_0x3ee7('0x31')](_0x129302[_0x3ee7('0x48')]['offset']);}_0x5dfb0a[_0x3ee7('0x51')]=qs['sort'](_0x129302[_0x3ee7('0x48')][_0x3ee7('0x52')]);_0x5dfb0a[_0x3ee7('0x53')]=qs[_0x3ee7('0x4a')](_[_0x3ee7('0x54')](_0x129302[_0x3ee7('0x48')],_0x3ffe5c['filters']),_0x1e07f2);if(_0x129302[_0x3ee7('0x48')]['filter']){_0x5dfb0a[_0x3ee7('0x53')]=_[_0x3ee7('0x55')](_0x5dfb0a['where'],{'$or':_[_0x3ee7('0x42')](_0x1e07f2,function(_0x12db5d){if(_0x12db5d[_0x3ee7('0x56')]!==_0x3ee7('0x57')){var _0x16e9c2={};_0x16e9c2[_0x12db5d['name']]={'$like':'%'+_0x129302['query'][_0x3ee7('0x58')]+'%'};return _0x16e9c2;}})});}_0x5dfb0a=_[_0x3ee7('0x55')]({},_0x5dfb0a,_0x129302[_0x3ee7('0x59')]);var _0x588722={'where':_0x5dfb0a[_0x3ee7('0x53')]};return db['MailAccount'][_0x3ee7('0x30')](_0x588722)[_0x3ee7('0x21')](function(_0x4c9a60){_0x22d4f5[_0x3ee7('0x30')]=_0x4c9a60;if(_0x129302['query'][_0x3ee7('0x5a')]){_0x5dfb0a[_0x3ee7('0x5b')]=[{'all':!![]}];}return db[_0x3ee7('0x43')][_0x3ee7('0x5c')](_0x5dfb0a);})[_0x3ee7('0x21')](function(_0x7d2171){_0x22d4f5[_0x3ee7('0x5d')]=_0x7d2171;return _0x22d4f5;})[_0x3ee7('0x21')](respondWithFilteredResult(_0x3b694b,_0x5dfb0a))[_0x3ee7('0x2b')](handleError(_0x3b694b,null));};exports[_0x3ee7('0x5e')]=function(_0x33ec46,_0x11c8ab){var _0x11aa13={'raw':![],'where':{'id':_0x33ec46[_0x3ee7('0x5f')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x3ee7('0x40')},{'model':db[_0x3ee7('0x41')],'as':_0x3ee7('0x60')}]},_0x3bdc32={};_0x3bdc32[_0x3ee7('0x47')]=_[_0x3ee7('0x49')](db[_0x3ee7('0x43')][_0x3ee7('0x44')]);_0x3bdc32[_0x3ee7('0x48')]=_['keys'](_0x33ec46[_0x3ee7('0x48')]);_0x3bdc32[_0x3ee7('0x4a')]=_[_0x3ee7('0x4c')](_0x3bdc32[_0x3ee7('0x47')],_0x3bdc32[_0x3ee7('0x48')]);_0x11aa13['attributes']=_['intersection'](_0x3bdc32[_0x3ee7('0x47')],qs[_0x3ee7('0x4d')](_0x33ec46[_0x3ee7('0x48')][_0x3ee7('0x4d')]));_0x11aa13[_0x3ee7('0x4b')]=_0x11aa13[_0x3ee7('0x4b')][_0x3ee7('0x4e')]?_0x11aa13[_0x3ee7('0x4b')]:_0x3bdc32[_0x3ee7('0x47')];if(_0x33ec46[_0x3ee7('0x48')][_0x3ee7('0x5a')]){_0x11aa13[_0x3ee7('0x5b')]=[{'all':!![]}];}_0x11aa13=_[_0x3ee7('0x55')]({},_0x11aa13,_0x33ec46[_0x3ee7('0x59')]);return db[_0x3ee7('0x43')]['find'](_0x11aa13)[_0x3ee7('0x21')](handleEntityNotFound(_0x11c8ab,null))[_0x3ee7('0x21')](respondWithResult(_0x11c8ab,null))['catch'](handleError(_0x11c8ab,null));};exports['update']=function(_0x5a3b88,_0x5013cf){if(_0x5a3b88['body']['id']){delete _0x5a3b88[_0x3ee7('0x61')]['id'];}return db[_0x3ee7('0x43')][_0x3ee7('0x62')]({'where':{'id':_0x5a3b88['params']['id']},'include':[{'model':db[_0x3ee7('0x3e')],'as':_0x3ee7('0x3f')},{'model':db[_0x3ee7('0x63')],'as':_0x3ee7('0x40')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x3ee7('0x21')](handleEntityNotFound(_0x5013cf,null))[_0x3ee7('0x21')](saveUpdates(_0x5a3b88[_0x3ee7('0x61')],null))[_0x3ee7('0x21')](function(_0x44bd17){if(_0x44bd17&&_0x5a3b88['body'][_0x3ee7('0x3f')]){return db[_0x3ee7('0x3e')][_0x3ee7('0x35')](_0x5a3b88[_0x3ee7('0x61')]['Imap'],{'where':{'MailAccountId':_0x44bd17['id']}})[_0x3ee7('0x21')](function(){return _0x44bd17;});}return _0x44bd17;})['then'](function(_0x4bfaff){if(_0x4bfaff&&_0x5a3b88[_0x3ee7('0x61')][_0x3ee7('0x40')]){return db[_0x3ee7('0x63')][_0x3ee7('0x35')](_0x5a3b88[_0x3ee7('0x61')]['Smtp'],{'where':{'MailAccountId':_0x4bfaff['id']}})['then'](function(){return _0x4bfaff;});}return _0x4bfaff;})[_0x3ee7('0x21')](respondWithResult(_0x5013cf,null))[_0x3ee7('0x2b')](handleError(_0x5013cf,null));};exports[_0x3ee7('0x64')]=function(_0x3960ee,_0xabbeb1){return db[_0x3ee7('0x43')][_0x3ee7('0x64')]()[_0x3ee7('0x21')](respondWithResult(_0xabbeb1,null))[_0x3ee7('0x2b')](handleError(_0xabbeb1,null));};exports['addDisposition']=function(_0x33025d,_0x258471,_0x5952bd){if(_0x33025d[_0x3ee7('0x61')]['id']){delete _0x33025d[_0x3ee7('0x61')]['id'];}return db['MailAccount'][_0x3ee7('0x62')]({'where':{'id':_0x33025d[_0x3ee7('0x5f')]['id']}})[_0x3ee7('0x21')](handleEntityNotFound(_0x258471,null))[_0x3ee7('0x21')](function(_0x58fb6d){if(_0x58fb6d){_0x33025d[_0x3ee7('0x61')]['MailAccountId']=_0x58fb6d['id'];return db[_0x3ee7('0x65')][_0x3ee7('0x66')](_0x33025d[_0x3ee7('0x61')]);}})[_0x3ee7('0x21')](respondWithResult(_0x258471,null))[_0x3ee7('0x2b')](handleError(_0x258471,null));};exports[_0x3ee7('0x67')]=function(_0x2faf31,_0x473d8e,_0x33e27d){var _0x53f3e7={'raw':![],'where':{}};var _0x35d7cd={};var _0x56688e={'count':0x0,'rows':[]};return db[_0x3ee7('0x43')][_0x3ee7('0x68')]({'where':{'id':_0x2faf31[_0x3ee7('0x5f')]['id']}})[_0x3ee7('0x21')](handleEntityNotFound(_0x473d8e,null))[_0x3ee7('0x21')](function(_0x3717b9){if(_0x3717b9){_0x35d7cd[_0x3ee7('0x47')]=_['keys'](db[_0x3ee7('0x65')][_0x3ee7('0x44')]);_0x35d7cd['query']=_[_0x3ee7('0x49')](_0x2faf31[_0x3ee7('0x48')]);_0x35d7cd[_0x3ee7('0x4a')]=_[_0x3ee7('0x4c')](_0x35d7cd['model'],_0x35d7cd['query']);_0x53f3e7['attributes']=_['intersection'](_0x35d7cd[_0x3ee7('0x47')],qs[_0x3ee7('0x4d')](_0x2faf31['query'][_0x3ee7('0x4d')]));_0x53f3e7[_0x3ee7('0x4b')]=_0x53f3e7['attributes'][_0x3ee7('0x4e')]?_0x53f3e7['attributes']:_0x35d7cd[_0x3ee7('0x47')];if(!_0x2faf31['query'][_0x3ee7('0x4f')]('nolimit')){_0x53f3e7['limit']=qs[_0x3ee7('0x50')](_0x2faf31[_0x3ee7('0x48')][_0x3ee7('0x50')]);_0x53f3e7[_0x3ee7('0x31')]=qs[_0x3ee7('0x31')](_0x2faf31[_0x3ee7('0x48')][_0x3ee7('0x31')]);}_0x53f3e7[_0x3ee7('0x51')]=qs[_0x3ee7('0x52')](_0x2faf31[_0x3ee7('0x48')]['sort']);_0x53f3e7[_0x3ee7('0x53')]=qs[_0x3ee7('0x4a')](_[_0x3ee7('0x54')](_0x2faf31['query'],_0x35d7cd[_0x3ee7('0x4a')]));_0x53f3e7['where'][_0x3ee7('0x69')]=_0x3717b9['id'];if(_0x2faf31[_0x3ee7('0x48')][_0x3ee7('0x58')]){_0x53f3e7[_0x3ee7('0x53')]=_[_0x3ee7('0x55')](_0x53f3e7['where'],{'$or':_[_0x3ee7('0x42')](_0x53f3e7[_0x3ee7('0x4b')],function(_0x5f541e){var _0x5d971d={};_0x5d971d[_0x5f541e]={'$like':'%'+_0x2faf31[_0x3ee7('0x48')][_0x3ee7('0x58')]+'%'};return _0x5d971d;})});}_0x53f3e7=_['merge']({},_0x53f3e7,_0x2faf31[_0x3ee7('0x59')]);return db['Disposition'][_0x3ee7('0x30')]({'where':_0x53f3e7['where']})['then'](function(_0xc5c364){_0x56688e[_0x3ee7('0x30')]=_0xc5c364;if(_0x2faf31[_0x3ee7('0x48')][_0x3ee7('0x5a')]){_0x53f3e7[_0x3ee7('0x5b')]=[{'all':!![]}];}return db[_0x3ee7('0x65')][_0x3ee7('0x5c')](_0x53f3e7);})['then'](function(_0x474c0c){_0x56688e[_0x3ee7('0x5d')]=_0x474c0c;return _0x56688e;});}})[_0x3ee7('0x21')](respondWithFilteredResult(_0x473d8e,_0x53f3e7))[_0x3ee7('0x2b')](handleError(_0x473d8e,null));};exports['removeDispositions']=function(_0x3c493a,_0x326278,_0x281f30){return db[_0x3ee7('0x43')][_0x3ee7('0x62')]({'where':{'id':_0x3c493a['params']['id']}})[_0x3ee7('0x21')](handleEntityNotFound(_0x326278,null))['then'](function(_0x49d919){if(_0x49d919){return _0x49d919['removeDispositions'](_0x3c493a['query']['ids']);}})[_0x3ee7('0x21')](respondWithStatusCode(_0x326278,null))['catch'](handleError(_0x326278,null));};exports[_0x3ee7('0x6a')]=function(_0x52caab,_0x437453,_0x52c492){if(_0x52caab[_0x3ee7('0x61')]['id']){delete _0x52caab[_0x3ee7('0x61')]['id'];}return db['MailAccount'][_0x3ee7('0x62')]({'where':{'id':_0x52caab[_0x3ee7('0x5f')]['id']}})[_0x3ee7('0x21')](handleEntityNotFound(_0x437453,null))[_0x3ee7('0x21')](function(_0x45176f){if(_0x45176f){_0x52caab['body']['MailAccountId']=_0x45176f['id'];return db[_0x3ee7('0x6b')][_0x3ee7('0x66')](_0x52caab[_0x3ee7('0x61')]);}})[_0x3ee7('0x21')](respondWithResult(_0x437453,null))['catch'](handleError(_0x437453,null));};exports[_0x3ee7('0x6c')]=function(_0x3fb424,_0xce3a5c,_0x4c6f29){var _0x1d143e={'raw':![],'where':{}};var _0x480a26={};var _0x31118c={'count':0x0,'rows':[]};return db[_0x3ee7('0x43')]['findOne']({'where':{'id':_0x3fb424[_0x3ee7('0x5f')]['id']}})['then'](handleEntityNotFound(_0xce3a5c,null))[_0x3ee7('0x21')](function(_0x201203){if(_0x201203){_0x480a26[_0x3ee7('0x47')]=_[_0x3ee7('0x49')](db[_0x3ee7('0x6b')][_0x3ee7('0x44')]);_0x480a26['query']=_[_0x3ee7('0x49')](_0x3fb424[_0x3ee7('0x48')]);_0x480a26['filters']=_[_0x3ee7('0x4c')](_0x480a26[_0x3ee7('0x47')],_0x480a26['query']);_0x1d143e[_0x3ee7('0x4b')]=_['intersection'](_0x480a26[_0x3ee7('0x47')],qs['fields'](_0x3fb424[_0x3ee7('0x48')][_0x3ee7('0x4d')]));_0x1d143e[_0x3ee7('0x4b')]=_0x1d143e[_0x3ee7('0x4b')][_0x3ee7('0x4e')]?_0x1d143e[_0x3ee7('0x4b')]:_0x480a26[_0x3ee7('0x47')];if(!_0x3fb424[_0x3ee7('0x48')][_0x3ee7('0x4f')](_0x3ee7('0x6d'))){_0x1d143e[_0x3ee7('0x50')]=qs[_0x3ee7('0x50')](_0x3fb424['query'][_0x3ee7('0x50')]);_0x1d143e[_0x3ee7('0x31')]=qs[_0x3ee7('0x31')](_0x3fb424[_0x3ee7('0x48')][_0x3ee7('0x31')]);}_0x1d143e[_0x3ee7('0x51')]=qs[_0x3ee7('0x52')](_0x3fb424[_0x3ee7('0x48')][_0x3ee7('0x52')]);_0x1d143e[_0x3ee7('0x53')]=qs[_0x3ee7('0x4a')](_[_0x3ee7('0x54')](_0x3fb424[_0x3ee7('0x48')],_0x480a26[_0x3ee7('0x4a')]));_0x1d143e['where'][_0x3ee7('0x69')]=_0x201203['id'];if(_0x3fb424[_0x3ee7('0x48')][_0x3ee7('0x58')]){_0x1d143e[_0x3ee7('0x53')]=_[_0x3ee7('0x55')](_0x1d143e[_0x3ee7('0x53')],{'$or':_[_0x3ee7('0x42')](_0x1d143e[_0x3ee7('0x4b')],function(_0x78ffc3){var _0x54cf5a={};_0x54cf5a[_0x78ffc3]={'$like':'%'+_0x3fb424['query'][_0x3ee7('0x58')]+'%'};return _0x54cf5a;})});}_0x1d143e=_[_0x3ee7('0x55')]({},_0x1d143e,_0x3fb424[_0x3ee7('0x59')]);return db[_0x3ee7('0x6b')][_0x3ee7('0x30')]({'where':_0x1d143e[_0x3ee7('0x53')]})[_0x3ee7('0x21')](function(_0x27004f){_0x31118c[_0x3ee7('0x30')]=_0x27004f;if(_0x3fb424[_0x3ee7('0x48')][_0x3ee7('0x5a')]){_0x1d143e[_0x3ee7('0x5b')]=[{'all':!![]}];}return db[_0x3ee7('0x6b')][_0x3ee7('0x5c')](_0x1d143e);})[_0x3ee7('0x21')](function(_0x267d36){_0x31118c[_0x3ee7('0x5d')]=_0x267d36;return _0x31118c;});}})['then'](respondWithFilteredResult(_0xce3a5c,_0x1d143e))[_0x3ee7('0x2b')](handleError(_0xce3a5c,null));};exports[_0x3ee7('0x6e')]=function(_0x52047d,_0x4063b4,_0x12c1fb){return db[_0x3ee7('0x43')][_0x3ee7('0x62')]({'where':{'id':_0x52047d[_0x3ee7('0x5f')]['id']}})[_0x3ee7('0x21')](handleEntityNotFound(_0x4063b4,null))[_0x3ee7('0x21')](function(_0xab7171){if(_0xab7171){return _0xab7171[_0x3ee7('0x6e')](_0x52047d[_0x3ee7('0x48')][_0x3ee7('0x6f')]);}})[_0x3ee7('0x21')](respondWithStatusCode(_0x4063b4,null))[_0x3ee7('0x2b')](handleError(_0x4063b4,null));};exports[_0x3ee7('0x66')]=function(_0x1722fa,_0x524c65){var _0x11f52f={'name':_0x1722fa[_0x3ee7('0x61')][_0x3ee7('0x3b')],'key':_0x1722fa[_0x3ee7('0x61')][_0x3ee7('0x46')],'email':_0x1722fa[_0x3ee7('0x61')][_0x3ee7('0x70')],'ListId':_0x1722fa[_0x3ee7('0x61')][_0x3ee7('0x71')],'active':!_[_0x3ee7('0x72')](_0x1722fa['body'][_0x3ee7('0x73')])?_0x1722fa[_0x3ee7('0x61')][_0x3ee7('0x73')]:!![],'description':_0x1722fa[_0x3ee7('0x61')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0x3ee7('0x72')](_0x1722fa[_0x3ee7('0x61')][_0x3ee7('0x74')])){if(_0x1722fa[_0x3ee7('0x61')][_0x3ee7('0x75')]){_0x11f52f['Imap'][_0x3ee7('0x76')]=_0x11f52f[_0x3ee7('0x40')]['user']=_0x1722fa[_0x3ee7('0x61')][_0x3ee7('0x77')];_0x11f52f[_0x3ee7('0x3f')][_0x3ee7('0x78')]=_0x11f52f[_0x3ee7('0x40')][_0x3ee7('0x79')]=_0x1722fa[_0x3ee7('0x61')][_0x3ee7('0x7a')];}else{_0x11f52f['Imap'][_0x3ee7('0x7b')]=_0x11f52f[_0x3ee7('0x40')][_0x3ee7('0x7b')]=![];}_0x11f52f[_0x3ee7('0x3f')][_0x3ee7('0x7c')]=_0x1722fa[_0x3ee7('0x61')][_0x3ee7('0x3f')][_0x3ee7('0x7c')];_0x11f52f['Imap'][_0x3ee7('0x7d')]=_0x1722fa[_0x3ee7('0x61')][_0x3ee7('0x3f')]['port'];_0x11f52f['Smtp'][_0x3ee7('0x7c')]=_0x1722fa[_0x3ee7('0x61')][_0x3ee7('0x40')][_0x3ee7('0x7c')];_0x11f52f['Smtp']['port']=_0x1722fa['body'][_0x3ee7('0x40')]['port'];}else{_0x11f52f[_0x3ee7('0x3f')][_0x3ee7('0x7e')]=_0x11f52f[_0x3ee7('0x40')][_0x3ee7('0x7e')]=_0x1722fa[_0x3ee7('0x61')][_0x3ee7('0x74')];_0x11f52f['Imap'][_0x3ee7('0x76')]=_0x11f52f[_0x3ee7('0x40')][_0x3ee7('0x76')]=_0x1722fa[_0x3ee7('0x61')][_0x3ee7('0x77')];_0x11f52f[_0x3ee7('0x3f')][_0x3ee7('0x78')]=_0x11f52f[_0x3ee7('0x40')]['pass']=_0x1722fa[_0x3ee7('0x61')][_0x3ee7('0x7a')];}return db[_0x3ee7('0x43')][_0x3ee7('0x66')](_0x11f52f,{'include':[{'model':db['MailServerOut'],'as':_0x3ee7('0x40')},{'model':db[_0x3ee7('0x3e')],'as':_0x3ee7('0x3f')}]})[_0x3ee7('0x21')](function(_0x213a38){var _0x800f28=_0x1722fa[_0x3ee7('0x76')][_0x3ee7('0x37')]({'plain':!![]});if(!_0x800f28)throw new Error(_0x3ee7('0x7f'));if(_0x800f28[_0x3ee7('0x80')]===_0x3ee7('0x76')){var _0x14e998=_0x213a38[_0x3ee7('0x37')]({'plain':!![]});return db[_0x3ee7('0x81')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x800f28[_0x3ee7('0x82')]},'raw':!![]})[_0x3ee7('0x21')](function(_0x32a73a){if(_0x32a73a&&_0x32a73a[_0x3ee7('0x83')]===0x0){return db[_0x3ee7('0x39')][_0x3ee7('0x66')]({'name':_0x14e998[_0x3ee7('0x3b')],'resourceId':_0x14e998['id'],'type':_0x32a73a['name'],'sectionId':_0x32a73a['id']},{})[_0x3ee7('0x21')](function(){return _0x213a38;});}else{return _0x213a38;}})[_0x3ee7('0x2b')](function(_0x2b5e87){logger['error'](_0x3ee7('0x84'),_0x2b5e87);throw _0x2b5e87;});}return _0x213a38;})[_0x3ee7('0x21')](respondWithResult(_0x524c65,0xc9))['catch'](handleError(_0x524c65,null));};exports[_0x3ee7('0x85')]=function(_0x2af207,_0x58b332,_0x1da3ce){return db[_0x3ee7('0x43')][_0x3ee7('0x68')]({'where':{'id':_0x2af207[_0x3ee7('0x5f')]['id']}})[_0x3ee7('0x21')](handleEntityNotFound(_0x58b332,null))[_0x3ee7('0x21')](function(_0x2af763){if(_0x2af763){return _0x2af763['getImap']();}return null;})[_0x3ee7('0x21')](respondWithResult(_0x58b332,null))[_0x3ee7('0x2b')](handleError(_0x58b332,null));};exports[_0x3ee7('0x86')]=function(_0x1df74b,_0x134cf7,_0x4eb6c4){if(_0x1df74b[_0x3ee7('0x61')]['id']){delete _0x1df74b['body']['id'];}return db[_0x3ee7('0x43')][_0x3ee7('0x62')]({'where':{'id':_0x1df74b[_0x3ee7('0x5f')]['id']}})['then'](handleEntityNotFound(_0x134cf7,null))[_0x3ee7('0x21')](function(_0x3b8480){if(_0x3b8480){_0x1df74b[_0x3ee7('0x61')][_0x3ee7('0x69')]=_0x3b8480['id'];return db['MailServerIn'][_0x3ee7('0x66')](_0x1df74b[_0x3ee7('0x61')]);}})[_0x3ee7('0x21')](respondWithResult(_0x134cf7,null))['catch'](handleError(_0x134cf7,null));};exports['removeImap']=function(_0x479004,_0x4821d2,_0x53360b){return db[_0x3ee7('0x43')]['findOne']({'where':{'id':_0x479004['params']['id']}})[_0x3ee7('0x21')](handleEntityNotFound(_0x4821d2,null))[_0x3ee7('0x21')](function(_0xee1ec2){if(_0xee1ec2){return _0xee1ec2[_0x3ee7('0x87')](null);}return null;})[_0x3ee7('0x21')](respondWithStatusCode(_0x4821d2,null))[_0x3ee7('0x2b')](handleError(_0x4821d2,null));};exports[_0x3ee7('0x88')]=function(_0x4c223f,_0x32f7de,_0x4e1cbf){return db[_0x3ee7('0x43')][_0x3ee7('0x68')]({'where':{'id':_0x4c223f[_0x3ee7('0x5f')]['id']}})[_0x3ee7('0x21')](handleEntityNotFound(_0x32f7de,null))[_0x3ee7('0x21')](function(_0x1bd284){if(_0x1bd284){return _0x1bd284[_0x3ee7('0x88')]();}return null;})[_0x3ee7('0x21')](respondWithResult(_0x32f7de,null))['catch'](handleError(_0x32f7de,null));};exports['addSmtp']=function(_0x436ef9,_0x3a416d,_0x3d472e){if(_0x436ef9[_0x3ee7('0x61')]['id']){delete _0x436ef9[_0x3ee7('0x61')]['id'];}return db[_0x3ee7('0x43')][_0x3ee7('0x62')]({'where':{'id':_0x436ef9[_0x3ee7('0x5f')]['id']}})[_0x3ee7('0x21')](handleEntityNotFound(_0x3a416d,null))['then'](function(_0x3b34a5){if(_0x3b34a5){_0x436ef9[_0x3ee7('0x61')][_0x3ee7('0x69')]=_0x3b34a5['id'];return db[_0x3ee7('0x63')][_0x3ee7('0x66')](_0x436ef9['body']);}})[_0x3ee7('0x21')](respondWithResult(_0x3a416d,null))[_0x3ee7('0x2b')](handleError(_0x3a416d,null));};exports['removeSmtp']=function(_0xeace58,_0x347126,_0xdaaf9){return db['MailAccount'][_0x3ee7('0x68')]({'where':{'id':_0xeace58[_0x3ee7('0x5f')]['id']}})['then'](handleEntityNotFound(_0x347126,null))[_0x3ee7('0x21')](function(_0x1d0c32){if(_0x1d0c32){return _0x1d0c32[_0x3ee7('0x89')](null);}return null;})['then'](respondWithStatusCode(_0x347126,null))[_0x3ee7('0x2b')](handleError(_0x347126,null));};exports[_0x3ee7('0x8a')]=function(_0x2fd43a,_0x3ce00b,_0x26c66d){return db[_0x3ee7('0x8b')][_0x3ee7('0x62')]({'where':{'id':_0x2fd43a[_0x3ee7('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3ce00b,null))[_0x3ee7('0x21')](function(_0x1b2fcc){if(_0x1b2fcc){return _0x1b2fcc['addInteraction'](_0x2fd43a[_0x3ee7('0x61')][_0x3ee7('0x6f')],_['omit'](_0x2fd43a[_0x3ee7('0x61')],[_0x3ee7('0x6f'),'id'])||{});}})[_0x3ee7('0x21')](respondWithResult(_0x3ce00b,null))['catch'](handleError(_0x3ce00b,null));};exports['getInteractions']=function(_0x3b7add,_0x4bf7fc,_0x3dac03){var _0x518219={'raw':![],'where':{}};var _0x3c9b71={};var _0x4de375={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x3b7add[_0x3ee7('0x5f')]['id']}})[_0x3ee7('0x21')](handleEntityNotFound(_0x4bf7fc,null))[_0x3ee7('0x21')](function(_0x19000d){if(_0x19000d){_0x3c9b71[_0x3ee7('0x47')]=_[_0x3ee7('0x49')](db[_0x3ee7('0x8b')][_0x3ee7('0x44')]);_0x3c9b71['query']=_[_0x3ee7('0x49')](_0x3b7add[_0x3ee7('0x48')]);_0x3c9b71['filters']=_[_0x3ee7('0x4c')](_0x3c9b71['model'],_0x3c9b71['query']);_0x518219[_0x3ee7('0x4b')]=_[_0x3ee7('0x4c')](_0x3c9b71[_0x3ee7('0x47')],qs[_0x3ee7('0x4d')](_0x3b7add[_0x3ee7('0x48')][_0x3ee7('0x4d')]));_0x518219[_0x3ee7('0x4b')]=_0x518219[_0x3ee7('0x4b')][_0x3ee7('0x4e')]?_0x518219[_0x3ee7('0x4b')]:_0x3c9b71[_0x3ee7('0x47')];if(!_0x3b7add[_0x3ee7('0x48')][_0x3ee7('0x4f')](_0x3ee7('0x6d'))){_0x518219[_0x3ee7('0x50')]=qs[_0x3ee7('0x50')](_0x3b7add['query'][_0x3ee7('0x50')]);_0x518219['offset']=qs[_0x3ee7('0x31')](_0x3b7add['query']['offset']);}_0x518219[_0x3ee7('0x51')]=qs['sort'](_0x3b7add[_0x3ee7('0x48')][_0x3ee7('0x52')]);_0x518219[_0x3ee7('0x53')]=qs[_0x3ee7('0x4a')](_[_0x3ee7('0x54')](_0x3b7add[_0x3ee7('0x48')],_0x3c9b71[_0x3ee7('0x4a')]));_0x518219['where'][_0x3ee7('0x69')]=_0x19000d['id'];if(_0x3b7add[_0x3ee7('0x48')][_0x3ee7('0x58')]){_0x518219[_0x3ee7('0x53')]=_[_0x3ee7('0x55')](_0x518219[_0x3ee7('0x53')],{'$or':_[_0x3ee7('0x42')](_0x518219[_0x3ee7('0x4b')],function(_0x1c891d){var _0x4d62a9={};_0x4d62a9[_0x1c891d]={'$like':'%'+_0x3b7add['query'][_0x3ee7('0x58')]+'%'};return _0x4d62a9;})});}_0x518219=_[_0x3ee7('0x55')]({},_0x518219,_0x3b7add[_0x3ee7('0x59')]);return db['MailInteraction'][_0x3ee7('0x30')]({'where':_0x518219['where']})[_0x3ee7('0x21')](function(_0x2f08dc){_0x4de375[_0x3ee7('0x30')]=_0x2f08dc;if(_0x3b7add[_0x3ee7('0x48')][_0x3ee7('0x5a')]){_0x518219[_0x3ee7('0x5b')]=[{'model':db[_0x3ee7('0x8c')],'as':_0x3ee7('0x8d'),'required':![]},{'model':db[_0x3ee7('0x8e')],'as':_0x3ee7('0x8f'),'attributes':[_0x3ee7('0x3b'),_0x3ee7('0x90'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x3ee7('0x91'),'attributes':['id',_0x3ee7('0x3b'),_0x3ee7('0x92')],'where':_0x3b7add[_0x3ee7('0x48')][_0x3ee7('0x93')]?{'id':_0x3b7add[_0x3ee7('0x48')][_0x3ee7('0x93')]}:undefined,'required':_0x3b7add[_0x3ee7('0x48')][_0x3ee7('0x93')]?!![]:![]}];}return db['MailInteraction'][_0x3ee7('0x5c')](_0x518219);})[_0x3ee7('0x21')](function(_0xb80cd){_0x4de375[_0x3ee7('0x5d')]=_0xb80cd;return _0x4de375;});}})['then'](respondWithFilteredResult(_0x4bf7fc,_0x518219))[_0x3ee7('0x2b')](handleError(_0x4bf7fc,null));};exports[_0x3ee7('0x94')]=function(_0x2cf61c,_0x41561a,_0x71ea4c){return db[_0x3ee7('0x43')][_0x3ee7('0x68')]({'where':{'id':_0x2cf61c['params']['id']}})[_0x3ee7('0x21')](handleEntityNotFound(_0x41561a,null))[_0x3ee7('0x21')](function(_0x4d2bb0){if(_0x4d2bb0){return db['sequelize'][_0x3ee7('0x95')](function(_0xabe04d){return db['MailApplication']['destroy']({'where':{'MailAccountId':_0x2cf61c[_0x3ee7('0x5f')]['id']},'transaction':_0xabe04d})['then'](function(_0x4e3dbd){var _0x504333=_['map'](_0x2cf61c[_0x3ee7('0x61')],function(_0x57c576){_0x57c576[_0x3ee7('0x69')]=_0x2cf61c['params']['id'];return _0x57c576;});return db[_0x3ee7('0x96')][_0x3ee7('0x97')](_0x504333,{'transaction':_0xabe04d});});})[_0x3ee7('0x21')](function(){return db[_0x3ee7('0x96')][_0x3ee7('0x98')]({'where':{'MailAccountId':_0x2cf61c[_0x3ee7('0x5f')]['id']},'order':_0x3ee7('0x99')});});}})['then'](respondWithResult(_0x41561a,null))['catch'](handleError(_0x41561a,null));};exports[_0x3ee7('0x9a')]=function(_0x55a240,_0x78dba3,_0x5bbc47){var _0x1b4e7c={};var _0x491409={};var _0x599e64;var _0x1389f9;return db[_0x3ee7('0x43')]['findOne']({'where':{'id':_0x55a240[_0x3ee7('0x5f')]['id']}})[_0x3ee7('0x21')](handleEntityNotFound(_0x78dba3,null))[_0x3ee7('0x21')](function(_0x49eb18){if(_0x49eb18){_0x599e64=_0x49eb18;_0x491409[_0x3ee7('0x47')]=_[_0x3ee7('0x49')](db[_0x3ee7('0x96')][_0x3ee7('0x44')]);_0x491409[_0x3ee7('0x48')]=_[_0x3ee7('0x49')](_0x55a240[_0x3ee7('0x48')]);_0x491409['filters']=_[_0x3ee7('0x4c')](_0x491409['model'],_0x491409[_0x3ee7('0x48')]);_0x1b4e7c[_0x3ee7('0x4b')]=_[_0x3ee7('0x4c')](_0x491409['model'],qs['fields'](_0x55a240[_0x3ee7('0x48')][_0x3ee7('0x4d')]));_0x1b4e7c[_0x3ee7('0x4b')]=_0x1b4e7c[_0x3ee7('0x4b')][_0x3ee7('0x4e')]?_0x1b4e7c[_0x3ee7('0x4b')]:_0x491409[_0x3ee7('0x47')];_0x1b4e7c[_0x3ee7('0x51')]=qs[_0x3ee7('0x52')](_0x55a240['query'][_0x3ee7('0x52')]);_0x1b4e7c[_0x3ee7('0x53')]=qs['filters'](_[_0x3ee7('0x54')](_0x55a240[_0x3ee7('0x48')],_0x491409[_0x3ee7('0x4a')]));if(_0x55a240[_0x3ee7('0x48')][_0x3ee7('0x58')]){_0x1b4e7c['where']=_[_0x3ee7('0x55')](_0x1b4e7c['where'],{'$or':_[_0x3ee7('0x42')](_0x1b4e7c[_0x3ee7('0x4b')],function(_0x789433){var _0x11585c={};_0x11585c[_0x789433]={'$like':'%'+_0x55a240[_0x3ee7('0x48')][_0x3ee7('0x58')]+'%'};return _0x11585c;})});}_0x1b4e7c=_[_0x3ee7('0x55')]({},_0x1b4e7c,_0x55a240['options']);return _0x599e64[_0x3ee7('0x9a')](_0x1b4e7c);}})[_0x3ee7('0x21')](function(_0x1a8e75){if(_0x1a8e75){_0x1389f9=_0x1a8e75['length'];if(!_0x55a240[_0x3ee7('0x48')][_0x3ee7('0x4f')](_0x3ee7('0x6d'))){_0x1b4e7c[_0x3ee7('0x50')]=qs[_0x3ee7('0x50')](_0x55a240[_0x3ee7('0x48')][_0x3ee7('0x50')]);_0x1b4e7c[_0x3ee7('0x31')]=qs[_0x3ee7('0x31')](_0x55a240[_0x3ee7('0x48')][_0x3ee7('0x31')]);}return _0x599e64['getApplications'](_0x1b4e7c);}})['then'](function(_0x33c231){if(_0x33c231){return _0x33c231?{'count':_0x1389f9,'rows':_0x33c231}:null;}})['then'](respondWithResult(_0x78dba3,null))[_0x3ee7('0x2b')](handleError(_0x78dba3,null));};exports[_0x3ee7('0x9b')]=function(_0x43b717,_0x378e1d,_0x33de07){var _0x37d918={'raw':!![],'where':{}};var _0x5483d9={};var _0x353ca3={'count':0x0,'rows':[]};return db[_0x3ee7('0x43')][_0x3ee7('0x68')]({'where':{'id':_0x43b717[_0x3ee7('0x5f')]['id']}})[_0x3ee7('0x21')](handleEntityNotFound(_0x378e1d,null))[_0x3ee7('0x21')](function(_0x59db3b){if(_0x59db3b){_0x5483d9[_0x3ee7('0x47')]=_['keys'](db[_0x3ee7('0x9c')]['rawAttributes']);_0x5483d9[_0x3ee7('0x48')]=_[_0x3ee7('0x49')](_0x43b717[_0x3ee7('0x48')]);_0x5483d9[_0x3ee7('0x4a')]=_['intersection'](_0x5483d9[_0x3ee7('0x47')],_0x5483d9[_0x3ee7('0x48')]);_0x37d918[_0x3ee7('0x4b')]=_[_0x3ee7('0x4c')](_0x5483d9[_0x3ee7('0x47')],qs[_0x3ee7('0x4d')](_0x43b717[_0x3ee7('0x48')][_0x3ee7('0x4d')]));_0x37d918[_0x3ee7('0x4b')]=_0x37d918[_0x3ee7('0x4b')][_0x3ee7('0x4e')]?_0x37d918[_0x3ee7('0x4b')]:_0x5483d9['model'];if(!_0x43b717[_0x3ee7('0x48')]['hasOwnProperty'](_0x3ee7('0x6d'))){_0x37d918['limit']=qs[_0x3ee7('0x50')](_0x43b717['query']['limit']);_0x37d918[_0x3ee7('0x31')]=qs[_0x3ee7('0x31')](_0x43b717[_0x3ee7('0x48')][_0x3ee7('0x31')]);}_0x37d918[_0x3ee7('0x51')]=qs[_0x3ee7('0x52')](_0x43b717['query']['sort']);_0x37d918[_0x3ee7('0x53')]=qs['filters'](_[_0x3ee7('0x54')](_0x43b717[_0x3ee7('0x48')],_0x5483d9[_0x3ee7('0x4a')]));_0x37d918[_0x3ee7('0x53')][_0x3ee7('0x69')]=_0x59db3b['id'];if(_0x43b717[_0x3ee7('0x48')]['filter']){_0x37d918[_0x3ee7('0x53')]=_['merge'](_0x37d918[_0x3ee7('0x53')],{'$or':_['map'](_0x37d918[_0x3ee7('0x4b')],function(_0x459a1c){var _0x12f6a0={};_0x12f6a0[_0x459a1c]={'$like':'%'+_0x43b717['query']['filter']+'%'};return _0x12f6a0;})});}if(_0x43b717[_0x3ee7('0x48')][_0x3ee7('0x9d')]){var _0x3cda31=_0x43b717['query'][_0x3ee7('0x9d')][_0x3ee7('0x9e')](',');var _0xe47b45={};_0xe47b45[_0x3cda31[0x0]]={'$gte':moment(_0x3cda31[0x1])[_0x3ee7('0x9f')](_0x3ee7('0xa0'))};_0x37d918['where']=_[_0x3ee7('0x55')](_0x37d918[_0x3ee7('0x53')],_0xe47b45);}_0x37d918=_[_0x3ee7('0x55')]({},_0x37d918,_0x43b717[_0x3ee7('0x59')]);return db['MailMessage'][_0x3ee7('0x30')]({'where':_0x37d918[_0x3ee7('0x53')]})['then'](function(_0x3892e4){_0x353ca3[_0x3ee7('0x30')]=_0x3892e4;if(_0x43b717[_0x3ee7('0x48')][_0x3ee7('0x5a')]){_0x37d918['include']=[{'all':!![]}];}return db[_0x3ee7('0x9c')]['findAll'](_0x37d918);})['then'](function(_0x4cc7b5){if(_0x43b717[_0x3ee7('0x48')]['inlineCss']===_0x3ee7('0xa1')){for(var _0x2aa2d9=0x0;_0x2aa2d9<_0x4cc7b5[_0x3ee7('0x4e')];_0x2aa2d9++){_0x4cc7b5[_0x2aa2d9][_0x3ee7('0x61')]=juice(_0x4cc7b5[_0x2aa2d9][_0x3ee7('0x61')]);}}_0x353ca3[_0x3ee7('0x5d')]=_0x4cc7b5;return _0x353ca3;});}})[_0x3ee7('0x21')](respondWithFilteredResult(_0x378e1d,_0x37d918))[_0x3ee7('0x2b')](handleError(_0x378e1d,null));};exports[_0x3ee7('0x3c')]=function(_0x509fc5,_0x53202e,_0x2b5f42){var _0x124ae7,_0x4a155e={},_0x359908;if(_0x509fc5[_0x3ee7('0x61')]['to']){_0x359908=_0x509fc5[_0x3ee7('0x61')]['to'][_0x3ee7('0x9e')](',')[0x0];}return db[_0x3ee7('0x43')]['find']({'where':{'id':_0x509fc5[_0x3ee7('0x5f')]['id']},'include':[{'model':db[_0x3ee7('0xa2')],'as':'List','include':[{'model':db[_0x3ee7('0x8c')],'as':_0x3ee7('0xa3'),'where':{'email':_0x359908},'limit':0x1,'order':[[_0x3ee7('0xa4'),'DESC']]}]},{'model':db[_0x3ee7('0x63')],'as':_0x3ee7('0x40'),'raw':!![]}]})[_0x3ee7('0x21')](handleEntityNotFound(_0x53202e,null))[_0x3ee7('0x21')](function(_0x228d60){if(_0x228d60){_0x124ae7=_0x228d60;if(_0x228d60[_0x3ee7('0x40')]){if(_[_0x3ee7('0x72')](_0x509fc5[_0x3ee7('0x61')][_0x3ee7('0xa5')])){_0x509fc5[_0x3ee7('0x61')][_0x3ee7('0xa5')]=util['format'](_0x3ee7('0xa6'),_0x228d60['name'],_0x228d60[_0x3ee7('0x70')]||_0x228d60[_0x3ee7('0x40')][_0x3ee7('0x76')]);}if(_0x509fc5[_0x3ee7('0x61')][_0x3ee7('0xa7')]&&_0x509fc5['body'][_0x3ee7('0xa7')][_0x3ee7('0x4e')]){for(var _0x5a3a0b=0x0;_0x5a3a0b<_0x509fc5[_0x3ee7('0x61')]['attachments']['length'];_0x5a3a0b+=0x1){_0x509fc5[_0x3ee7('0x61')][_0x3ee7('0xa7')][_0x5a3a0b]={'filename':_0x509fc5[_0x3ee7('0x61')][_0x3ee7('0xa7')][_0x5a3a0b][_0x3ee7('0x3b')],'path':path[_0x3ee7('0xa8')](config['root'],'server/files/attachments',_0x509fc5['body'][_0x3ee7('0xa7')][_0x5a3a0b][_0x3ee7('0xa9')])};}}var _0x5069e8={'tls':{'rejectUnauthorized':![]}};if(_[_0x3ee7('0x72')](_0x228d60['Smtp']['service'])){if(_0x228d60[_0x3ee7('0x40')][_0x3ee7('0x7b')]){_0x5069e8[_0x3ee7('0xaa')]={'user':_0x228d60[_0x3ee7('0x40')]['user'],'pass':_0x228d60[_0x3ee7('0x40')][_0x3ee7('0x79')]};}_0x5069e8[_0x3ee7('0x7c')]=_0x228d60[_0x3ee7('0x40')][_0x3ee7('0x7c')];_0x5069e8[_0x3ee7('0x7d')]=_0x228d60['Smtp'][_0x3ee7('0x7d')];_0x5069e8[_0x3ee7('0xab')]=_0x228d60['Smtp'][_0x3ee7('0xab')];}else{_0x5069e8[_0x3ee7('0x7e')]=_0x228d60[_0x3ee7('0x40')]['service'];_0x5069e8['auth']={'user':_0x228d60[_0x3ee7('0x40')][_0x3ee7('0x76')],'pass':_0x228d60['Smtp']['pass']};}return respondWithRpcPromise(_0x3ee7('0xac'),_0x3ee7('0xad'),{'account':_0x5069e8,'message':_0x509fc5[_0x3ee7('0x61')]});}else{throw new Error('List\x20not\x20found');}}})[_0x3ee7('0x21')](function(_0x38580e){if(_0x38580e){_0x4a155e=_0x38580e;if(_0x124ae7[_0x3ee7('0xae')]){if(_0x124ae7[_0x3ee7('0xae')][_0x3ee7('0xa3')]['length']){return _0x124ae7[_0x3ee7('0xae')][_0x3ee7('0xa3')][0x0];}else{return db[_0x3ee7('0x8c')]['create'](_[_0x3ee7('0x18')](_0x509fc5[_0x3ee7('0x61')],{'firstName':_0x509fc5['body']['to'],'email':_0x509fc5[_0x3ee7('0x61')]['to'],'phone':_0x509fc5['body']['to'],'ListId':_0x124ae7[_0x3ee7('0x71')]}));}}else{throw new Error(_0x3ee7('0xaf'));}}})[_0x3ee7('0x21')](function(_0x2543cd){if(_0x2543cd){var _0x13e06c={'UserId':_0x509fc5[_0x3ee7('0x76')]['id'],'ContactId':_0x2543cd['id'],'MailAccountId':_0x124ae7['id'],'inReplyTo':_0x4a155e[_0x3ee7('0xb0')],'to':_0x509fc5[_0x3ee7('0x61')][_0x3ee7('0xa5')],'cc':_0x509fc5[_0x3ee7('0x61')]['cc'],'subject':_0x509fc5[_0x3ee7('0x61')]['subject'],'attach':_0x509fc5[_0x3ee7('0x61')]['attach'],'firstMsgDirection':_0x3ee7('0xb1'),'lastMsgAt':moment()['format'](_0x3ee7('0xa0')),'lastMsgDirection':_0x3ee7('0xb1'),'lastMsgBody':_0x509fc5[_0x3ee7('0x61')][_0x3ee7('0x61')],'Messages':[_[_0x3ee7('0x55')](_0x509fc5[_0x3ee7('0x61')],{'messageId':_0x4a155e[_0x3ee7('0xb0')],'sentAt':moment()[_0x3ee7('0x9f')](_0x3ee7('0xa0')),'read':!![],'MailAccountId':_0x124ae7['id'],'UserId':_0x509fc5['user']['id'],'ContactId':_0x2543cd['id']})]};if(_0x509fc5['body'][_0x3ee7('0xb2')]){_0x13e06c=_[_0x3ee7('0x55')](_0x13e06c,_0x509fc5[_0x3ee7('0x61')][_0x3ee7('0xb2')]);}return db[_0x3ee7('0x8b')]['create'](_0x13e06c,{'include':[{'model':db[_0x3ee7('0x9c')],'as':'Messages'}]});}})[_0x3ee7('0x21')](respondWithResult(_0x53202e,null))[_0x3ee7('0x2b')](handleError(_0x53202e,null));};exports['verifySmtp']=function(_0x1f2004,_0x227eb4,_0x4d8dd4){return db[_0x3ee7('0x43')][_0x3ee7('0x62')]({'where':{'id':_0x1f2004['params']['id']},'include':[{'model':db[_0x3ee7('0x63')],'as':_0x3ee7('0x40'),'raw':!![]}]})[_0x3ee7('0x21')](handleEntityNotFound(_0x227eb4,null))['then'](function(_0x1bbbb7){if(_0x1bbbb7&&_0x1bbbb7[_0x3ee7('0x40')]){var _0x2df519={'id':_0x1bbbb7['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1bbbb7['Smtp']['service']){_0x2df519['service']=_0x1bbbb7['Smtp'][_0x3ee7('0x7e')];}else{_0x2df519[_0x3ee7('0x7c')]=_0x1bbbb7['Smtp']['host'];_0x2df519['port']=_0x1bbbb7[_0x3ee7('0x40')][_0x3ee7('0x7d')];_0x2df519['secure']=_0x1bbbb7['Smtp']['secure'];}if(_0x1bbbb7['Smtp']['authentication']){_0x2df519[_0x3ee7('0xaa')]={'user':_0x1bbbb7[_0x3ee7('0x40')][_0x3ee7('0x76')],'pass':_0x1bbbb7[_0x3ee7('0x40')][_0x3ee7('0x79')]};}return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x2df519});}})['then'](respondWithResult(_0x227eb4,null))[_0x3ee7('0x2b')](handleError(_0x227eb4,null));};exports[_0x3ee7('0x36')]=function(_0x2b2223,_0x29bb25){return db[_0x3ee7('0x43')][_0x3ee7('0x62')]({'where':{'id':_0x2b2223[_0x3ee7('0x5f')]['id']}})[_0x3ee7('0x21')](handleEntityNotFound(_0x29bb25,null))[_0x3ee7('0x21')](function(_0x1dc2c6){if(_0x1dc2c6&&_0x1dc2c6['service']){throw new db['Sequelize'][(_0x3ee7('0xb3'))](_0x3ee7('0xb4'));}return _0x1dc2c6;})['then'](removeEntity(_0x29bb25,null))[_0x3ee7('0x2b')](handleError(_0x29bb25,null));};exports[_0x3ee7('0xb5')]=function(_0x344879,_0x30f865,_0x118e9f){return db['MailAccount']['find']({'where':{'id':_0x344879[_0x3ee7('0x5f')]['id']}})[_0x3ee7('0x21')](handleEntityNotFound(_0x30f865,null))[_0x3ee7('0x21')](function(_0x592545){if(_0x592545){return _0x592545[_0x3ee7('0xb5')](_0x344879[_0x3ee7('0x61')]['ids'],_[_0x3ee7('0xb6')](_0x344879[_0x3ee7('0x61')],[_0x3ee7('0x6f'),'id'])||{})[_0x3ee7('0xb7')](function(_0x3b5736){for(var _0xf42add=0x0;_0xf42add<_0x344879['body'][_0x3ee7('0x6f')][_0x3ee7('0x4e')];_0xf42add+=0x1){socket['emit'](_0x3ee7('0xb8'),{'UserId':_0x344879[_0x3ee7('0x61')]['ids'][_0xf42add],'MailAccountId':_0x344879[_0x3ee7('0x5f')]['id']});}return _0x3b5736;});}})[_0x3ee7('0x21')](respondWithResult(_0x30f865,null))[_0x3ee7('0x2b')](handleError(_0x30f865,null));};exports[_0x3ee7('0xb9')]=function(_0x98ba1e,_0x27f3f6,_0x2863d4){return db[_0x3ee7('0x43')][_0x3ee7('0x62')]({'where':{'id':_0x98ba1e[_0x3ee7('0x5f')]['id']}})[_0x3ee7('0x21')](handleEntityNotFound(_0x27f3f6,null))[_0x3ee7('0x21')](function(_0x42468a){if(_0x42468a){return _0x42468a[_0x3ee7('0xb9')](_0x98ba1e['query'][_0x3ee7('0x6f')])[_0x3ee7('0x21')](function(){if(_[_0x3ee7('0xba')](_0x98ba1e[_0x3ee7('0x48')]['ids'])){for(var _0x25a645=0x0;_0x25a645<_0x98ba1e[_0x3ee7('0x48')][_0x3ee7('0x6f')][_0x3ee7('0x4e')];_0x25a645+=0x1){socket[_0x3ee7('0xbb')](_0x3ee7('0xbc'),{'UserId':Number(_0x98ba1e[_0x3ee7('0x48')]['ids'][_0x25a645]),'MailAccountId':Number(_0x98ba1e['params']['id'])});}}else{socket[_0x3ee7('0xbb')](_0x3ee7('0xbc'),{'UserId':Number(_0x98ba1e[_0x3ee7('0x48')]['ids']),'MailAccountId':Number(_0x98ba1e['params']['id'])});}});}})[_0x3ee7('0x21')](respondWithStatusCode(_0x27f3f6,null))[_0x3ee7('0x2b')](handleError(_0x27f3f6,null));};exports[_0x3ee7('0xbd')]=function(_0x35d2c8,_0x2a76c1,_0x47bffe){var _0x3d698={};var _0x2e9ef0={};var _0x3592bd;var _0x1aea74;return db[_0x3ee7('0x43')][_0x3ee7('0x68')]({'where':{'id':_0x35d2c8[_0x3ee7('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2a76c1,null))['then'](function(_0x37d6ea){if(_0x37d6ea){_0x3592bd=_0x37d6ea;_0x2e9ef0[_0x3ee7('0x47')]=_['keys'](db[_0x3ee7('0x8e')][_0x3ee7('0x44')]);_0x2e9ef0['query']=_[_0x3ee7('0x49')](_0x35d2c8[_0x3ee7('0x48')]);_0x2e9ef0[_0x3ee7('0x4a')]=_['intersection'](_0x2e9ef0['model'],_0x2e9ef0[_0x3ee7('0x48')]);_0x3d698[_0x3ee7('0x4b')]=_[_0x3ee7('0x4c')](_0x2e9ef0[_0x3ee7('0x47')],qs[_0x3ee7('0x4d')](_0x35d2c8[_0x3ee7('0x48')][_0x3ee7('0x4d')]));_0x3d698['attributes']=_0x3d698[_0x3ee7('0x4b')][_0x3ee7('0x4e')]?_0x3d698[_0x3ee7('0x4b')]:_0x2e9ef0[_0x3ee7('0x47')];_0x3d698['order']=qs[_0x3ee7('0x52')](_0x35d2c8[_0x3ee7('0x48')][_0x3ee7('0x52')]);_0x3d698['where']=qs[_0x3ee7('0x4a')](_[_0x3ee7('0x54')](_0x35d2c8['query'],_0x2e9ef0['filters']));if(_0x35d2c8[_0x3ee7('0x48')][_0x3ee7('0x58')]){_0x3d698[_0x3ee7('0x53')]=_['merge'](_0x3d698[_0x3ee7('0x53')],{'$or':_[_0x3ee7('0x42')](_0x3d698[_0x3ee7('0x4b')],function(_0x4bff6c){var _0x264755={};_0x264755[_0x4bff6c]={'$like':'%'+_0x35d2c8['query'][_0x3ee7('0x58')]+'%'};return _0x264755;})});}_0x3d698=_[_0x3ee7('0x55')]({},_0x3d698,_0x35d2c8['options']);return _0x3592bd['getAgents'](_0x3d698);}})[_0x3ee7('0x21')](function(_0x36e7fa){if(_0x36e7fa){_0x1aea74=_0x36e7fa[_0x3ee7('0x4e')];if(!_0x35d2c8[_0x3ee7('0x48')]['hasOwnProperty'](_0x3ee7('0x6d'))){_0x3d698['limit']=qs[_0x3ee7('0x50')](_0x35d2c8[_0x3ee7('0x48')][_0x3ee7('0x50')]);_0x3d698[_0x3ee7('0x31')]=qs[_0x3ee7('0x31')](_0x35d2c8[_0x3ee7('0x48')][_0x3ee7('0x31')]);}return _0x3592bd['getAgents'](_0x3d698);}})[_0x3ee7('0x21')](function(_0x7b8732){if(_0x7b8732){return _0x7b8732?{'count':_0x1aea74,'rows':_0x7b8732}:null;}})['then'](respondWithResult(_0x2a76c1,null))[_0x3ee7('0x2b')](handleError(_0x2a76c1,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 962f7e2..80079f6 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 _0x0d10=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x1fa8dd,_0x491111){var _0x5610e5=function(_0x11826e){while(--_0x11826e){_0x1fa8dd['push'](_0x1fa8dd['shift']());}};_0x5610e5(++_0x491111);}(_0x0d10,0x1bf));var _0x00d1=function(_0x53ad58,_0x3fb489){_0x53ad58=_0x53ad58-0x0;var _0x554b03=_0x0d10[_0x53ad58];return _0x554b03;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x00d1('0x0'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x00d1('0x1')](0x0);var events={'afterCreate':_0x00d1('0x2'),'afterUpdate':_0x00d1('0x3'),'afterDestroy':_0x00d1('0x4')};function emitEvent(_0x2ad3d1){return function(_0x1d6f71,_0x346ad2,_0x15936b){MailAccountEvents['emit'](_0x2ad3d1+':'+_0x1d6f71['id'],_0x1d6f71);MailAccountEvents[_0x00d1('0x5')](_0x2ad3d1,_0x1d6f71);_0x15936b(null);};}for(var e in events){if(events[_0x00d1('0x6')](e)){var event=events[e];MailAccount[_0x00d1('0x7')](e,emitEvent(event));}}module[_0x00d1('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x5385=['save','emit','hasOwnProperty','exports','events','../../mysqldb','MailAccount','setMaxListeners'];(function(_0x53d178,_0x36ff0a){var _0x2411d0=function(_0x4822f1){while(--_0x4822f1){_0x53d178['push'](_0x53d178['shift']());}};_0x2411d0(++_0x36ff0a);}(_0x5385,0x17c));var _0x5538=function(_0x3758dd,_0x277a57){_0x3758dd=_0x3758dd-0x0;var _0x4af937=_0x5385[_0x3758dd];return _0x4af937;};'use strict';var EventEmitter=require(_0x5538('0x0'));var MailAccount=require(_0x5538('0x1'))['db'][_0x5538('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x5538('0x3')](0x0);var events={'afterCreate':_0x5538('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xacac8c){return function(_0x3619a6,_0x37fa11,_0x37b78f){MailAccountEvents[_0x5538('0x5')](_0xacac8c+':'+_0x3619a6['id'],_0x3619a6);MailAccountEvents[_0x5538('0x5')](_0xacac8c,_0x3619a6);_0x37b78f(null);};}for(var e in events){if(events[_0x5538('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x5538('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 673bc46..12a9880 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 _0x36f9=['mail_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x36f9,0x7f));var _0x936f=function(_0x4bfa2e,_0x59d749){_0x4bfa2e=_0x4bfa2e-0x0;var _0x5613bf=_0x36f9[_0x4bfa2e];return _0x5613bf;};'use strict';var _=require('lodash');var util=require(_0x936f('0x0'));var logger=require(_0x936f('0x1'))(_0x936f('0x2'));var moment=require(_0x936f('0x3'));var BPromise=require(_0x936f('0x4'));var rp=require(_0x936f('0x5'));var fs=require('fs');var path=require(_0x936f('0x6'));var rimraf=require(_0x936f('0x7'));var config=require(_0x936f('0x8'));var attributes=require(_0x936f('0x9'));module[_0x936f('0xa')]=function(_0x290b95,_0xb2ab68){return _0x290b95[_0x936f('0xb')](_0x936f('0xc'),attributes,{'tableName':_0x936f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa396=['define','MailAccount','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports'];(function(_0x32c97e,_0x2fc7a7){var _0x1c1852=function(_0x13f0a7){while(--_0x13f0a7){_0x32c97e['push'](_0x32c97e['shift']());}};_0x1c1852(++_0x2fc7a7);}(_0xa396,0xaa));var _0x6a39=function(_0x2a8509,_0x3c9b76){_0x2a8509=_0x2a8509-0x0;var _0x4c8567=_0xa396[_0x2a8509];return _0x4c8567;};'use strict';var _=require(_0x6a39('0x0'));var util=require(_0x6a39('0x1'));var logger=require('../../config/logger')(_0x6a39('0x2'));var moment=require(_0x6a39('0x3'));var BPromise=require('bluebird');var rp=require(_0x6a39('0x4'));var fs=require('fs');var path=require(_0x6a39('0x5'));var rimraf=require(_0x6a39('0x6'));var config=require(_0x6a39('0x7'));var attributes=require(_0x6a39('0x8'));module[_0x6a39('0x9')]=function(_0x1cd04b,_0x44279c){return _0x1cd04b[_0x6a39('0xa')](_0x6a39('0xb'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 9014c04..28936a6 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 _0x411b=['mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','List','get','omit','applications','list','orderBy','priority','asc','autoclose','push','length','close','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','YYYY-MM-DD\x20HH:mm:ss','interaction','originTo','originCc','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachments','UserId','User','name','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailAccount','options','where','limit','include','map','model','attributes','GetMailAccount','find','ShowMailAccount','body','mail','difference','keys','CmContact','createdAt','CompanyId','ListId','isNil','from'];(function(_0x56b965,_0x4b5b84){var _0x13dc5e=function(_0x596634){while(--_0x596634){_0x56b965['push'](_0x56b965['shift']());}};_0x13dc5e(++_0x4b5b84);}(_0x411b,0x1d6));var _0xb411=function(_0x1477ef,_0x3cdd13){_0x1477ef=_0x1477ef-0x0;var _0x1c11b2=_0x411b[_0x1477ef];return _0x1c11b2;};'use strict';var _=require(_0xb411('0x0'));var util=require(_0xb411('0x1'));var moment=require(_0xb411('0x2'));var BPromise=require(_0xb411('0x3'));var rs=require(_0xb411('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb411('0x5'))['db'];var utils=require(_0xb411('0x6'));var logger=require('../../config/logger')(_0xb411('0x7'));var config=require(_0xb411('0x8'));var jayson=require(_0xb411('0x9'));var client=jayson[_0xb411('0xa')]['http']({'port':0x232c});config[_0xb411('0xb')]=_[_0xb411('0xc')](config[_0xb411('0xb')],{'host':_0xb411('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb411('0xb')]));require(_0xb411('0xe'))[_0xb411('0xf')](socket);function respondWithRpcPromise(_0x318287,_0x3f05e0,_0x17ba5a){return new BPromise(function(_0x4b32f5,_0x9d915d){return client[_0xb411('0x10')](_0x318287,_0x17ba5a)[_0xb411('0x11')](function(_0xe4a3c3){logger[_0xb411('0x12')](_0xb411('0x13'),_0x3f05e0,_0xb411('0x14'));logger[_0xb411('0x15')](_0xb411('0x16'),_0x3f05e0,_0xb411('0x14'),JSON[_0xb411('0x17')](_0xe4a3c3));if(_0xe4a3c3[_0xb411('0x18')]){if(_0xe4a3c3[_0xb411('0x18')][_0xb411('0x19')]===0x1f4){logger[_0xb411('0x18')]('MailAccount,\x20%s,\x20%s',_0x3f05e0,_0xe4a3c3['error'][_0xb411('0x1a')]);return _0x9d915d(_0xe4a3c3['error']['message']);}logger[_0xb411('0x18')](_0xb411('0x13'),_0x3f05e0,_0xe4a3c3[_0xb411('0x18')][_0xb411('0x1a')]);return _0x4b32f5(_0xe4a3c3[_0xb411('0x18')][_0xb411('0x1a')]);}else{logger[_0xb411('0x12')](_0xb411('0x13'),_0x3f05e0,_0xb411('0x14'));_0x4b32f5(_0xe4a3c3[_0xb411('0x1b')]['message']);}})[_0xb411('0x1c')](function(_0x9c143c){logger['error'](_0xb411('0x13'),_0x3f05e0,_0x9c143c);_0x9d915d(_0x9c143c);});});}exports['GetMailAccount']=function(_0x19cf18){var _0xeb485a=this;return new Promise(function(_0x3ad86c,_0x42f3c7){return db[_0xb411('0x1d')]['findAll']({'raw':_0x19cf18['options']?_0x19cf18[_0xb411('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x19cf18[_0xb411('0x1e')]?_0x19cf18['options'][_0xb411('0x1f')]||null:null,'attributes':_0x19cf18['options']?_0x19cf18['options']['attributes']||null:null,'limit':_0x19cf18[_0xb411('0x1e')]?_0x19cf18['options'][_0xb411('0x20')]||null:null,'include':_0x19cf18['options']?_0x19cf18['options'][_0xb411('0x21')]?_[_0xb411('0x22')](_0x19cf18[_0xb411('0x1e')]['include'],function(_0x1403df){return{'model':db[_0x1403df[_0xb411('0x23')]],'as':_0x1403df['as'],'attributes':_0x1403df[_0xb411('0x24')],'include':_0x1403df[_0xb411('0x21')]?_['map'](_0x1403df[_0xb411('0x21')],function(_0x345f5c){return{'model':db[_0x345f5c[_0xb411('0x23')]],'as':_0x345f5c['as'],'attributes':_0x345f5c[_0xb411('0x24')],'include':_0x345f5c[_0xb411('0x21')]?_[_0xb411('0x22')](_0x345f5c[_0xb411('0x21')],function(_0x303a8a){return{'model':db[_0x303a8a['model']],'as':_0x303a8a['as'],'attributes':_0x303a8a['attributes']};}):[]};}):[]};}):[]:[]})[_0xb411('0x11')](function(_0x34461a){logger[_0xb411('0x12')](_0xb411('0x25'),_0x19cf18);logger['debug'](_0xb411('0x25'),_0x19cf18,JSON['stringify'](_0x34461a));_0x3ad86c(_0x34461a);})[_0xb411('0x1c')](function(_0x79ec7b){logger[_0xb411('0x18')]('GetMailAccount',_0x79ec7b[_0xb411('0x1a')],_0x19cf18);_0x42f3c7(_0xeb485a[_0xb411('0x18')](0x1f4,_0x79ec7b[_0xb411('0x1a')]));});});};exports['ShowMailAccount']=function(_0x2948e2){var _0x25b1f7=this;return new Promise(function(_0x2ba887,_0x260e9f){return db[_0xb411('0x1d')][_0xb411('0x26')]({'raw':_0x2948e2['options']?_0x2948e2[_0xb411('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2948e2[_0xb411('0x1e')]?_0x2948e2[_0xb411('0x1e')]['where']||null:null,'attributes':_0x2948e2[_0xb411('0x1e')]?_0x2948e2[_0xb411('0x1e')]['attributes']||null:null,'include':_0x2948e2['options']?_0x2948e2[_0xb411('0x1e')][_0xb411('0x21')]?_['map'](_0x2948e2[_0xb411('0x1e')][_0xb411('0x21')],function(_0xdf7e21){return{'model':db[_0xdf7e21[_0xb411('0x23')]],'as':_0xdf7e21['as'],'attributes':_0xdf7e21[_0xb411('0x24')],'include':_0xdf7e21[_0xb411('0x21')]?_['map'](_0xdf7e21['include'],function(_0x265013){return{'model':db[_0x265013['model']],'as':_0x265013['as'],'attributes':_0x265013[_0xb411('0x24')],'include':_0x265013[_0xb411('0x21')]?_[_0xb411('0x22')](_0x265013['include'],function(_0x57efbf){return{'model':db[_0x57efbf['model']],'as':_0x57efbf['as'],'attributes':_0x57efbf[_0xb411('0x24')]};}):[]};}):[]};}):[]:[]})[_0xb411('0x11')](function(_0x29fd59){logger['info'](_0xb411('0x27'),_0x2948e2);logger[_0xb411('0x15')](_0xb411('0x27'),_0x2948e2,JSON[_0xb411('0x17')](_0x29fd59));_0x2ba887(_0x29fd59);})['catch'](function(_0x5797b9){logger[_0xb411('0x18')]('ShowMailAccount',_0x5797b9[_0xb411('0x1a')],_0x2948e2);_0x260e9f(_0x25b1f7[_0xb411('0x18')](0x1f4,_0x5797b9['message']));});});};exports['NotifyMailAccount']=function(_0x10b560){var _0x14dee3=this;return new Promise(function(_0x44050e,_0x52fff7){var _0x138379={'body':_0x10b560[_0xb411('0x28')],'channel':_0xb411('0x29')};var _0x5c589c=_[_0xb411('0x2a')](_[_0xb411('0x2b')](db[_0xb411('0x2c')]['rawAttributes']),[_0xb411('0x2d'),'updatedAt',_0xb411('0x2e'),_0xb411('0x2f')]);var _0x118acb=![];if(_0x10b560[_0xb411('0x28')]['id']){delete _0x10b560['body']['id'];}if(_[_0xb411('0x30')](_0x10b560[_0xb411('0x28')][_0xb411('0x31')])){return _0x52fff7(_0x14dee3[_0xb411('0x18')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0xb411('0x30')](_0x10b560[_0xb411('0x28')][_0xb411('0x28')])||_0x10b560[_0xb411('0x28')][_0xb411('0x28')]===''){return _0x52fff7(_0x14dee3['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x10b560[_0xb411('0x28')][_0xb411('0x32')])){return _0x52fff7(_0x14dee3['error'](0x1f4,_0xb411('0x33')+_0x5c589c));}if(!_[_0xb411('0x34')](_0x5c589c,_0x10b560['body']['mapKey'])){return _0x52fff7(_0x14dee3['error'](0x1f4,_0xb411('0x35')+_0x5c589c));}var _0x42b611={};_0x42b611[_0x10b560['body'][_0xb411('0x32')]]=_0x10b560[_0xb411('0x28')][_0xb411('0x31')];return db[_0xb411('0x1d')][_0xb411('0x26')]({'where':{'id':_0x10b560[_0xb411('0x36')]['id']},'include':[{'model':db[_0xb411('0x37')],'as':'List','include':[{'model':db['CmContact'],'as':_0xb411('0x38'),'where':_0x42b611,'limit':0x1,'order':[['updatedAt',_0xb411('0x39')]]}]},{'model':db[_0xb411('0x3a')],'as':_0xb411('0x3b')},{'model':db[_0xb411('0x3c')],'as':_0xb411('0x3d')}]})[_0xb411('0x11')](function(_0x48bf22){if(_0x48bf22&&_0x48bf22[_0xb411('0x3e')]){var _0x306c3e=_0x48bf22[_0xb411('0x3f')]({'plain':!![]});_0x138379['account']=_[_0xb411('0x40')](_0x306c3e,[_0xb411('0x3b'),_0xb411('0x3e')]);_0x138379[_0xb411('0x41')]=_0x306c3e[_0xb411('0x3b')];_0x138379[_0xb411('0x42')]=_0x306c3e[_0xb411('0x3e')];_0x138379[_0xb411('0x41')]=_[_0xb411('0x43')](_0x138379[_0xb411('0x41')],[_0xb411('0x44')],[_0xb411('0x45')]);if(_0x138379['account']&&_0x138379[_0xb411('0x36')][_0xb411('0x46')]){_0x138379[_0xb411('0x41')][_0xb411('0x47')]({'id':0x0,'priority':_0x138379['applications'][_0xb411('0x48')]+0x1,'app':_0xb411('0x49'),'appdata':_0xb411('0x46'),'interval':'*,*,*,*'});}if(_0x138379[_0xb411('0x36')][_0xb411('0x3b')]){delete _0x138379[_0xb411('0x36')]['Applications'];}if(_0x138379[_0xb411('0x36')][_0xb411('0x3e')]){delete _0x138379[_0xb411('0x36')][_0xb411('0x3e')];}if(_0x306c3e[_0xb411('0x3e')][_0xb411('0x38')][_0xb411('0x48')]){return _0x306c3e[_0xb411('0x3e')]['Contacts'][0x0];}var _0x3a0f46=_['defaults'](_0x10b560[_0xb411('0x28')],{'firstName':_0x10b560[_0xb411('0x28')]['from'],'ListId':_0x306c3e['ListId']});_0x3a0f46[_0x10b560['body'][_0xb411('0x32')]]=_0x10b560[_0xb411('0x28')]['from'];return db['CmContact'][_0xb411('0x4a')](_0x3a0f46);}else{throw new Error(_0xb411('0x4b'));}})['then'](function(_0xcde6d4){_0x138379[_0xb411('0x4c')]=_0xcde6d4;if(_0xcde6d4){if(!_0x10b560[_0xb411('0x28')]['message'][_0xb411('0x4d')]){_0x10b560[_0xb411('0x28')][_0xb411('0x1a')][_0xb411('0x4d')]=rs[_0xb411('0x4e')]()+'\x20'+_0x10b560[_0xb411('0x28')][_0xb411('0x1a')][_0xb411('0x31')];}var _0x2700ab={'ContactId':_0xcde6d4['id'],'MailAccountId':_0x10b560[_0xb411('0x36')]['id'],'inReplyTo':_0x10b560['body'][_0xb411('0x1a')][_0xb411('0x4d')],'to':_0x10b560['body'][_0xb411('0x1a')][_0xb411('0x31')],'cc':_0x10b560['body']['message']['cc'],'subject':_0x10b560[_0xb411('0x28')]['message'][_0xb411('0x4f')],'attach':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')][_0xb411('0x50')],'lastMsgAt':moment()[_0xb411('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x10b560[_0xb411('0x28')][_0xb411('0x28')]};return db[_0xb411('0x52')][_0xb411('0x26')]({'where':{'closed':![],'MailAccountId':_0x10b560[_0xb411('0x36')]['id']},'include':[{'model':db[_0xb411('0x53')],'as':_0xb411('0x54'),'attributes':[_0xb411('0x4d')],'where':{'messageId':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')][_0xb411('0x55')]}}]})[_0xb411('0x11')](function(_0x378783){if(_0x378783){return[_0x378783,![]];}return db[_0xb411('0x52')][_0xb411('0x4a')](_0x2700ab)[_0xb411('0x11')](function(_0x3c6f9e){return[_0x3c6f9e,!![]];});});}else{throw new Error(_0xb411('0x56'));}})[_0xb411('0x57')](function(_0x4fff7c,_0x51fa3c){if(_0x4fff7c){_0x118acb=_0x51fa3c;if(!_0x51fa3c){return _0x4fff7c['update']({'inReplyTo':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')]['messageId'],'to':_0x10b560[_0xb411('0x28')]['message'][_0xb411('0x31')],'cc':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')]['cc'],'subject':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')][_0xb411('0x4f')],'attach':_0x4fff7c['attach']?_0x4fff7c[_0xb411('0x50')]:_0x10b560[_0xb411('0x28')]['message'][_0xb411('0x50')],'substatus':null,'substatusAt':moment()['format'](_0xb411('0x58')),'lastMsgAt':moment()['format'](_0xb411('0x58')),'lastMsgDirection':'in','lastMsgBody':_0x10b560[_0xb411('0x28')]['body']});}else{return _0x4fff7c;}}})[_0xb411('0x11')](function(_0xa524e5){_0x138379[_0xb411('0x59')]=_0xa524e5['get']({'plain':!![]});_0x138379[_0xb411('0x59')]['created']=_0x118acb;return db[_0xb411('0x53')][_0xb411('0x4a')]({'body':_0x10b560[_0xb411('0x28')][_0xb411('0x28')],'MailAccountId':_0x10b560[_0xb411('0x36')]['id'],'MailInteractionId':_0xa524e5['id'],'direction':'in','ContactId':_0x138379[_0xb411('0x4c')]['id'],'messageId':_0x10b560[_0xb411('0x28')]['message'][_0xb411('0x4d')],'from':_0x10b560['body'][_0xb411('0x1a')][_0xb411('0x31')],'to':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')]['to'],'cc':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')]['cc'],'subject':_0x10b560[_0xb411('0x28')]['message'][_0xb411('0x4f')],'attach':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')][_0xb411('0x50')],'Attachments':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')]['attachments'],'originTo':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')][_0xb411('0x5a')],'originCc':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')][_0xb411('0x5b')],'bcc':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')][_0xb411('0x5c')],'ChatWebsiteId':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')][_0xb411('0x5d')]||null,'originChannel':_0x10b560[_0xb411('0x28')][_0xb411('0x1a')]['originChannel']||_0xb411('0x5e'),'ChatOfflineMessageId':_0x10b560[_0xb411('0x28')]['message'][_0xb411('0x5f')]||null},{'include':[{'model':db['Attachment'],'as':_0xb411('0x60')}]});})['then'](function(_0x837d7d){_0x138379[_0xb411('0x1a')]=_0x837d7d;if(_0x138379[_0xb411('0x59')][_0xb411('0x61')]){return db[_0xb411('0x62')][_0xb411('0x26')]({'attributes':['id',_0xb411('0x63')],'where':{'id':_0x138379[_0xb411('0x59')]['UserId']}})[_0xb411('0x11')](function(_0x48367f){if(_0x48367f){_0x138379[_0xb411('0x41')][_0xb411('0x64')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x48367f[_0xb411('0x63')]+','+(_0x138379[_0xb411('0x36')][_0xb411('0x65')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xb411('0x66'),_0xb411('0x67'),_0x138379);});}return respondWithRpcPromise(_0xb411('0x66'),_0xb411('0x67'),_0x138379);})[_0xb411('0x11')](function(_0x4724ec){_0x44050e(_0x4724ec);})['catch'](function(_0x1736ba){_0x52fff7(_0x14dee3[_0xb411('0x18')](0x1f4,_0x1736ba[_0xb411('0x1a')]));});});}; \ No newline at end of file +var _0x23bc=['catch','MailAccount','findAll','options','raw','where','attributes','include','map','model','GetMailAccount','ShowMailAccount','find','NotifyMailAccount','mail','CmContact','updatedAt','CompanyId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','MailApplication','Applications','MailServerOut','List','account','omit','applications','list','orderBy','priority','asc','autoclose','length','close','create','List\x20not\x20found','contact','messageId','subject','attach','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','YYYY-MM-DD\x20HH:mm:ss','format','interaction','created','attachments','originTo','bcc','Email','Attachments','User','name','UserId','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5dc21d,_0x1ddd25){var _0x493377=function(_0x51e47d){while(--_0x51e47d){_0x5dc21d['push'](_0x5dc21d['shift']());}};_0x493377(++_0x1ddd25);}(_0x23bc,0x108));var _0xc23b=function(_0x264a50,_0x4584f0){_0x264a50=_0x264a50-0x0;var _0x2bb85c=_0x23bc[_0x264a50];return _0x2bb85c;};'use strict';var _=require(_0xc23b('0x0'));var util=require(_0xc23b('0x1'));var moment=require(_0xc23b('0x2'));var BPromise=require(_0xc23b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc23b('0x4'));var db=require(_0xc23b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc23b('0x6'));var config=require(_0xc23b('0x7'));var jayson=require(_0xc23b('0x8'));var client=jayson['client'][_0xc23b('0x9')]({'port':0x232c});config[_0xc23b('0xa')]=_[_0xc23b('0xb')](config['redis'],{'host':_0xc23b('0xc'),'port':0x18eb});var socket=require(_0xc23b('0xd'))(new Redis(config[_0xc23b('0xa')]));require(_0xc23b('0xe'))[_0xc23b('0xf')](socket);function respondWithRpcPromise(_0x4b4678,_0x7279d9,_0x36eedd){return new BPromise(function(_0x522bd4,_0x1b8c9f){return client['request'](_0x4b4678,_0x36eedd)[_0xc23b('0x10')](function(_0x3a083e){logger[_0xc23b('0x11')](_0xc23b('0x12'),_0x7279d9,_0xc23b('0x13'));logger[_0xc23b('0x14')](_0xc23b('0x15'),_0x7279d9,_0xc23b('0x13'),JSON[_0xc23b('0x16')](_0x3a083e));if(_0x3a083e['error']){if(_0x3a083e[_0xc23b('0x17')][_0xc23b('0x18')]===0x1f4){logger[_0xc23b('0x17')](_0xc23b('0x12'),_0x7279d9,_0x3a083e[_0xc23b('0x17')][_0xc23b('0x19')]);return _0x1b8c9f(_0x3a083e[_0xc23b('0x17')]['message']);}logger[_0xc23b('0x17')](_0xc23b('0x12'),_0x7279d9,_0x3a083e['error']['message']);return _0x522bd4(_0x3a083e[_0xc23b('0x17')][_0xc23b('0x19')]);}else{logger[_0xc23b('0x11')](_0xc23b('0x12'),_0x7279d9,_0xc23b('0x13'));_0x522bd4(_0x3a083e[_0xc23b('0x1a')][_0xc23b('0x19')]);}})[_0xc23b('0x1b')](function(_0x290b46){logger[_0xc23b('0x17')](_0xc23b('0x12'),_0x7279d9,_0x290b46);_0x1b8c9f(_0x290b46);});});}exports['GetMailAccount']=function(_0x2bf809){var _0x136bcf=this;return new Promise(function(_0x4a0a13,_0x31a27f){return db[_0xc23b('0x1c')][_0xc23b('0x1d')]({'raw':_0x2bf809[_0xc23b('0x1e')]?_0x2bf809[_0xc23b('0x1e')][_0xc23b('0x1f')]===undefined?!![]:![]:!![],'where':_0x2bf809[_0xc23b('0x1e')]?_0x2bf809[_0xc23b('0x1e')][_0xc23b('0x20')]||null:null,'attributes':_0x2bf809[_0xc23b('0x1e')]?_0x2bf809[_0xc23b('0x1e')][_0xc23b('0x21')]||null:null,'limit':_0x2bf809[_0xc23b('0x1e')]?_0x2bf809['options']['limit']||null:null,'include':_0x2bf809[_0xc23b('0x1e')]?_0x2bf809[_0xc23b('0x1e')][_0xc23b('0x22')]?_[_0xc23b('0x23')](_0x2bf809['options'][_0xc23b('0x22')],function(_0x2fa820){return{'model':db[_0x2fa820[_0xc23b('0x24')]],'as':_0x2fa820['as'],'attributes':_0x2fa820['attributes'],'include':_0x2fa820[_0xc23b('0x22')]?_[_0xc23b('0x23')](_0x2fa820[_0xc23b('0x22')],function(_0x3d4ea1){return{'model':db[_0x3d4ea1[_0xc23b('0x24')]],'as':_0x3d4ea1['as'],'attributes':_0x3d4ea1[_0xc23b('0x21')],'include':_0x3d4ea1[_0xc23b('0x22')]?_['map'](_0x3d4ea1[_0xc23b('0x22')],function(_0x26f9ff){return{'model':db[_0x26f9ff[_0xc23b('0x24')]],'as':_0x26f9ff['as'],'attributes':_0x26f9ff[_0xc23b('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc23b('0x10')](function(_0x17cc3d){logger[_0xc23b('0x11')](_0xc23b('0x25'),_0x2bf809);logger[_0xc23b('0x14')](_0xc23b('0x25'),_0x2bf809,JSON['stringify'](_0x17cc3d));_0x4a0a13(_0x17cc3d);})['catch'](function(_0x2521ee){logger['error'](_0xc23b('0x25'),_0x2521ee[_0xc23b('0x19')],_0x2bf809);_0x31a27f(_0x136bcf[_0xc23b('0x17')](0x1f4,_0x2521ee[_0xc23b('0x19')]));});});};exports[_0xc23b('0x26')]=function(_0x1de13a){var _0x4ca6d1=this;return new Promise(function(_0x11e2e1,_0x40bee5){return db[_0xc23b('0x1c')][_0xc23b('0x27')]({'raw':_0x1de13a['options']?_0x1de13a[_0xc23b('0x1e')][_0xc23b('0x1f')]===undefined?!![]:![]:!![],'where':_0x1de13a[_0xc23b('0x1e')]?_0x1de13a[_0xc23b('0x1e')][_0xc23b('0x20')]||null:null,'attributes':_0x1de13a[_0xc23b('0x1e')]?_0x1de13a[_0xc23b('0x1e')][_0xc23b('0x21')]||null:null,'include':_0x1de13a[_0xc23b('0x1e')]?_0x1de13a[_0xc23b('0x1e')][_0xc23b('0x22')]?_[_0xc23b('0x23')](_0x1de13a[_0xc23b('0x1e')][_0xc23b('0x22')],function(_0x16b380){return{'model':db[_0x16b380[_0xc23b('0x24')]],'as':_0x16b380['as'],'attributes':_0x16b380['attributes'],'include':_0x16b380['include']?_[_0xc23b('0x23')](_0x16b380['include'],function(_0x524a32){return{'model':db[_0x524a32[_0xc23b('0x24')]],'as':_0x524a32['as'],'attributes':_0x524a32[_0xc23b('0x21')],'include':_0x524a32[_0xc23b('0x22')]?_[_0xc23b('0x23')](_0x524a32[_0xc23b('0x22')],function(_0x29ffe5){return{'model':db[_0x29ffe5[_0xc23b('0x24')]],'as':_0x29ffe5['as'],'attributes':_0x29ffe5[_0xc23b('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4fa200){logger[_0xc23b('0x11')](_0xc23b('0x26'),_0x1de13a);logger[_0xc23b('0x14')](_0xc23b('0x26'),_0x1de13a,JSON['stringify'](_0x4fa200));_0x11e2e1(_0x4fa200);})[_0xc23b('0x1b')](function(_0x1adc02){logger['error'](_0xc23b('0x26'),_0x1adc02['message'],_0x1de13a);_0x40bee5(_0x4ca6d1[_0xc23b('0x17')](0x1f4,_0x1adc02['message']));});});};exports[_0xc23b('0x28')]=function(_0x2d7364){var _0x7a7c4e=this;return new Promise(function(_0x38b663,_0x1232fa){var _0x34ef90={'body':_0x2d7364['body'],'channel':_0xc23b('0x29')};var _0x25d350=_['difference'](_['keys'](db[_0xc23b('0x2a')]['rawAttributes']),['createdAt',_0xc23b('0x2b'),_0xc23b('0x2c'),'ListId']);var _0x4299db=![];if(_0x2d7364[_0xc23b('0x2d')]['id']){delete _0x2d7364[_0xc23b('0x2d')]['id'];}if(_[_0xc23b('0x2e')](_0x2d7364[_0xc23b('0x2d')][_0xc23b('0x2f')])){return _0x1232fa(_0x7a7c4e[_0xc23b('0x17')](0x1f4,_0xc23b('0x30')));}if(_['isNil'](_0x2d7364[_0xc23b('0x2d')][_0xc23b('0x2d')])||_0x2d7364[_0xc23b('0x2d')][_0xc23b('0x2d')]===''){return _0x1232fa(_0x7a7c4e[_0xc23b('0x17')](0x1f4,_0xc23b('0x31')));}if(_['isNil'](_0x2d7364['body'][_0xc23b('0x32')])){return _0x1232fa(_0x7a7c4e[_0xc23b('0x17')](0x1f4,_0xc23b('0x33')+_0x25d350));}if(!_['includes'](_0x25d350,_0x2d7364[_0xc23b('0x2d')][_0xc23b('0x32')])){return _0x1232fa(_0x7a7c4e[_0xc23b('0x17')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x25d350));}var _0x1e2226={};_0x1e2226[_0x2d7364[_0xc23b('0x2d')]['mapKey']]=_0x2d7364[_0xc23b('0x2d')]['from'];return db[_0xc23b('0x1c')][_0xc23b('0x27')]({'where':{'id':_0x2d7364['account']['id']},'include':[{'model':db[_0xc23b('0x34')],'as':'List','include':[{'model':db[_0xc23b('0x2a')],'as':_0xc23b('0x35'),'where':_0x1e2226,'limit':0x1,'order':[[_0xc23b('0x2b'),'DESC']]}]},{'model':db[_0xc23b('0x36')],'as':_0xc23b('0x37')},{'model':db[_0xc23b('0x38')],'as':'Smtp'}]})[_0xc23b('0x10')](function(_0x702445){if(_0x702445&&_0x702445[_0xc23b('0x39')]){var _0x534c0c=_0x702445['get']({'plain':!![]});_0x34ef90[_0xc23b('0x3a')]=_[_0xc23b('0x3b')](_0x534c0c,[_0xc23b('0x37'),_0xc23b('0x39')]);_0x34ef90[_0xc23b('0x3c')]=_0x534c0c[_0xc23b('0x37')];_0x34ef90[_0xc23b('0x3d')]=_0x534c0c['List'];_0x34ef90[_0xc23b('0x3c')]=_[_0xc23b('0x3e')](_0x34ef90[_0xc23b('0x3c')],[_0xc23b('0x3f')],[_0xc23b('0x40')]);if(_0x34ef90[_0xc23b('0x3a')]&&_0x34ef90[_0xc23b('0x3a')][_0xc23b('0x41')]){_0x34ef90[_0xc23b('0x3c')]['push']({'id':0x0,'priority':_0x34ef90['applications'][_0xc23b('0x42')]+0x1,'app':_0xc23b('0x43'),'appdata':_0xc23b('0x41'),'interval':'*,*,*,*'});}if(_0x34ef90['account'][_0xc23b('0x37')]){delete _0x34ef90[_0xc23b('0x3a')][_0xc23b('0x37')];}if(_0x34ef90[_0xc23b('0x3a')][_0xc23b('0x39')]){delete _0x34ef90[_0xc23b('0x3a')][_0xc23b('0x39')];}if(_0x534c0c['List'][_0xc23b('0x35')][_0xc23b('0x42')]){return _0x534c0c['List'][_0xc23b('0x35')][0x0];}var _0x53f739=_[_0xc23b('0xb')](_0x2d7364['body'],{'firstName':_0x2d7364['body'][_0xc23b('0x2f')],'ListId':_0x534c0c['ListId']});_0x53f739[_0x2d7364[_0xc23b('0x2d')]['mapKey']]=_0x2d7364[_0xc23b('0x2d')]['from'];return db[_0xc23b('0x2a')][_0xc23b('0x44')](_0x53f739);}else{throw new Error(_0xc23b('0x45'));}})[_0xc23b('0x10')](function(_0x8f4aa){_0x34ef90[_0xc23b('0x46')]=_0x8f4aa;if(_0x8f4aa){if(!_0x2d7364['body'][_0xc23b('0x19')][_0xc23b('0x47')]){_0x2d7364['body']['message'][_0xc23b('0x47')]=rs['generate']()+'\x20'+_0x2d7364[_0xc23b('0x2d')][_0xc23b('0x19')][_0xc23b('0x2f')];}var _0x169f7d={'ContactId':_0x8f4aa['id'],'MailAccountId':_0x2d7364[_0xc23b('0x3a')]['id'],'inReplyTo':_0x2d7364[_0xc23b('0x2d')][_0xc23b('0x19')][_0xc23b('0x47')],'to':_0x2d7364[_0xc23b('0x2d')]['message'][_0xc23b('0x2f')],'cc':_0x2d7364[_0xc23b('0x2d')][_0xc23b('0x19')]['cc'],'subject':_0x2d7364[_0xc23b('0x2d')][_0xc23b('0x19')][_0xc23b('0x48')],'attach':_0x2d7364[_0xc23b('0x2d')][_0xc23b('0x19')][_0xc23b('0x49')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x2d7364[_0xc23b('0x2d')]['body']};return db['MailInteraction'][_0xc23b('0x27')]({'where':{'closed':![],'MailAccountId':_0x2d7364[_0xc23b('0x3a')]['id']},'include':[{'model':db[_0xc23b('0x4a')],'as':_0xc23b('0x4b'),'attributes':[_0xc23b('0x47')],'where':{'messageId':_0x2d7364[_0xc23b('0x2d')][_0xc23b('0x19')][_0xc23b('0x4c')]}}]})[_0xc23b('0x10')](function(_0x40e176){if(_0x40e176){return[_0x40e176,![]];}return db['MailInteraction'][_0xc23b('0x44')](_0x169f7d)[_0xc23b('0x10')](function(_0x16e48a){return[_0x16e48a,!![]];});});}else{throw new Error(_0xc23b('0x4d'));}})[_0xc23b('0x4e')](function(_0x306eb6,_0x426aa5){if(_0x306eb6){_0x4299db=_0x426aa5;if(!_0x426aa5){return _0x306eb6[_0xc23b('0x4f')]({'inReplyTo':_0x2d7364[_0xc23b('0x2d')][_0xc23b('0x19')][_0xc23b('0x47')],'to':_0x2d7364['body'][_0xc23b('0x19')]['from'],'cc':_0x2d7364[_0xc23b('0x2d')][_0xc23b('0x19')]['cc'],'subject':_0x2d7364[_0xc23b('0x2d')]['message'][_0xc23b('0x48')],'attach':_0x306eb6[_0xc23b('0x49')]?_0x306eb6[_0xc23b('0x49')]:_0x2d7364[_0xc23b('0x2d')][_0xc23b('0x19')][_0xc23b('0x49')],'substatus':null,'substatusAt':moment()['format'](_0xc23b('0x50')),'lastMsgAt':moment()[_0xc23b('0x51')](_0xc23b('0x50')),'lastMsgDirection':'in','lastMsgBody':_0x2d7364[_0xc23b('0x2d')][_0xc23b('0x2d')]});}else{return _0x306eb6;}}})[_0xc23b('0x10')](function(_0x232021){_0x34ef90[_0xc23b('0x52')]=_0x232021['get']({'plain':!![]});_0x34ef90[_0xc23b('0x52')][_0xc23b('0x53')]=_0x4299db;return db[_0xc23b('0x4a')][_0xc23b('0x44')]({'body':_0x2d7364[_0xc23b('0x2d')][_0xc23b('0x2d')],'MailAccountId':_0x2d7364[_0xc23b('0x3a')]['id'],'MailInteractionId':_0x232021['id'],'direction':'in','ContactId':_0x34ef90[_0xc23b('0x46')]['id'],'messageId':_0x2d7364[_0xc23b('0x2d')][_0xc23b('0x19')][_0xc23b('0x47')],'from':_0x2d7364[_0xc23b('0x2d')][_0xc23b('0x19')][_0xc23b('0x2f')],'to':_0x2d7364['body']['message']['to'],'cc':_0x2d7364[_0xc23b('0x2d')]['message']['cc'],'subject':_0x2d7364[_0xc23b('0x2d')][_0xc23b('0x19')]['subject'],'attach':_0x2d7364[_0xc23b('0x2d')]['message']['attach'],'Attachments':_0x2d7364[_0xc23b('0x2d')][_0xc23b('0x19')][_0xc23b('0x54')],'originTo':_0x2d7364[_0xc23b('0x2d')][_0xc23b('0x19')][_0xc23b('0x55')],'originCc':_0x2d7364[_0xc23b('0x2d')][_0xc23b('0x19')]['originCc'],'bcc':_0x2d7364[_0xc23b('0x2d')][_0xc23b('0x19')][_0xc23b('0x56')],'ChatWebsiteId':_0x2d7364[_0xc23b('0x2d')][_0xc23b('0x19')]['ChatWebsiteId']||null,'originChannel':_0x2d7364['body'][_0xc23b('0x19')]['originChannel']||_0xc23b('0x57'),'ChatOfflineMessageId':_0x2d7364[_0xc23b('0x2d')][_0xc23b('0x19')]['ChatOfflineMessageId']||null},{'include':[{'model':db['Attachment'],'as':_0xc23b('0x58')}]});})[_0xc23b('0x10')](function(_0x4fb346){_0x34ef90[_0xc23b('0x19')]=_0x4fb346;if(_0x34ef90['interaction']['UserId']){return db[_0xc23b('0x59')][_0xc23b('0x27')]({'attributes':['id',_0xc23b('0x5a')],'where':{'id':_0x34ef90[_0xc23b('0x52')][_0xc23b('0x5b')]}})['then'](function(_0x157457){if(_0x157457){_0x34ef90[_0xc23b('0x3c')]['unshift']({'id':0x0,'priority':0x0,'app':_0xc23b('0x5c'),'appdata':_0x157457[_0xc23b('0x5a')]+','+(_0x34ef90[_0xc23b('0x3a')][_0xc23b('0x5d')]||0xa),'interval':_0xc23b('0x5e')});}return respondWithRpcPromise(_0xc23b('0x5f'),_0xc23b('0x60'),_0x34ef90);});}return respondWithRpcPromise(_0xc23b('0x5f'),'startRouting',_0x34ef90);})[_0xc23b('0x10')](function(_0x572d4b){_0x38b663(_0x572d4b);})[_0xc23b('0x1b')](function(_0x96d4aa){_0x1232fa(_0x7a7c4e[_0xc23b('0x17')](0x1f4,_0x96d4aa[_0xc23b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index a311500..ec82659 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 _0x644f=['emit','removeListener','register','length','mailAccount:','./mailAccount.events','save'];(function(_0x591e11,_0x363e09){var _0x23a0a=function(_0x43734d){while(--_0x43734d){_0x591e11['push'](_0x591e11['shift']());}};_0x23a0a(++_0x363e09);}(_0x644f,0xc2));var _0xf644=function(_0x1abeb2,_0x79f462){_0x1abeb2=_0x1abeb2-0x0;var _0x48da20=_0x644f[_0x1abeb2];return _0x48da20;};'use strict';var MailAccountEvents=require(_0xf644('0x0'));var events=[_0xf644('0x1'),'remove','update'];function createListener(_0x19242f,_0xc5044c){return function(_0x240500){_0xc5044c[_0xf644('0x2')](_0x19242f,_0x240500);};}function removeListener(_0x372b63,_0x3759da){return function(){MailAccountEvents[_0xf644('0x3')](_0x372b63,_0x3759da);};}exports[_0xf644('0x4')]=function(_0x9938ed){for(var _0x1a6cbb=0x0,_0x2c7aaf=events[_0xf644('0x5')];_0x1a6cbb<_0x2c7aaf;_0x1a6cbb++){var _0x50362e=events[_0x1a6cbb];var _0x2c2868=createListener(_0xf644('0x6')+_0x50362e,_0x9938ed);MailAccountEvents['on'](_0x50362e,_0x2c2868);}}; \ No newline at end of file +var _0xf1c6=['remove','update','register','length','mailAccount:'];(function(_0x2eb35d,_0x4a7a45){var _0x1f9854=function(_0x5eb6f9){while(--_0x5eb6f9){_0x2eb35d['push'](_0x2eb35d['shift']());}};_0x1f9854(++_0x4a7a45);}(_0xf1c6,0x145));var _0x6f1c=function(_0xbc0550,_0x1f05cf){_0xbc0550=_0xbc0550-0x0;var _0x39138b=_0xf1c6[_0xbc0550];return _0x39138b;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=['save',_0x6f1c('0x0'),_0x6f1c('0x1')];function createListener(_0x26cd1b,_0x405b3c){return function(_0xc393e2){_0x405b3c['emit'](_0x26cd1b,_0xc393e2);};}function removeListener(_0x5f0d77,_0x43775d){return function(){MailAccountEvents['removeListener'](_0x5f0d77,_0x43775d);};}exports[_0x6f1c('0x2')]=function(_0xa275f4){for(var _0x462c85=0x0,_0x537c4f=events[_0x6f1c('0x3')];_0x462c85<_0x537c4f;_0x462c85++){var _0x564a8f=events[_0x462c85];var _0x275f11=createListener(_0x6f1c('0x4')+_0x564a8f,_0xa275f4);MailAccountEvents['on'](_0x564a8f,_0x275f11);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index ee64f7e..7e70a8e 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 _0x2e54=['exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','show','update','destroy'];(function(_0x1dfbf0,_0x25aa11){var _0x248732=function(_0x322ab7){while(--_0x322ab7){_0x1dfbf0['push'](_0x1dfbf0['shift']());}};_0x248732(++_0x25aa11);}(_0x2e54,0x1dd));var _0x42e5=function(_0x23d4a2,_0x8a4d6d){_0x23d4a2=_0x23d4a2-0x0;var _0x43d2b3=_0x2e54[_0x23d4a2];return _0x43d2b3;};'use strict';var multer=require(_0x42e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x42e5('0x1'));var express=require(_0x42e5('0x2'));var router=express[_0x42e5('0x3')]();var auth=require(_0x42e5('0x4'));var interaction=require(_0x42e5('0x5'));var config=require(_0x42e5('0x6'));var controller=require(_0x42e5('0x7'));router['get'](_0x42e5('0x8'),auth[_0x42e5('0x9')](),controller[_0x42e5('0xa')]);router['put'](_0x42e5('0x8'),auth['isAuthenticated'](),controller[_0x42e5('0xb')]);router['delete'](_0x42e5('0x8'),auth[_0x42e5('0x9')](),controller[_0x42e5('0xc')]);module[_0x42e5('0xd')]=router; \ No newline at end of file +var _0xee5b=['/:id','isAuthenticated','show','put','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xb948b4,_0x27f4d9){var _0x507513=function(_0x3453db){while(--_0x3453db){_0xb948b4['push'](_0xb948b4['shift']());}};_0x507513(++_0x27f4d9);}(_0xee5b,0x1f4));var _0xbee5=function(_0x168b36,_0x381562){_0x168b36=_0x168b36-0x0;var _0x24c29e=_0xee5b[_0x168b36];return _0x24c29e;};'use strict';var multer=require(_0xbee5('0x0'));var util=require('util');var path=require(_0xbee5('0x1'));var timeout=require(_0xbee5('0x2'));var express=require('express');var router=express[_0xbee5('0x3')]();var auth=require(_0xbee5('0x4'));var interaction=require(_0xbee5('0x5'));var config=require(_0xbee5('0x6'));var controller=require('./mailApplication.controller');router['get'](_0xbee5('0x7'),auth[_0xbee5('0x8')](),controller[_0xbee5('0x9')]);router[_0xbee5('0xa')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xbee5('0x8')](),controller[_0xbee5('0xb')]);module[_0xbee5('0xc')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index e8df9e5..e6364b2 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 _0xb583=['*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x589ac8,_0x10ac6e){var _0x1bb5dc=function(_0x7a6239){while(--_0x7a6239){_0x589ac8['push'](_0x589ac8['shift']());}};_0x1bb5dc(++_0x10ac6e);}(_0xb583,0xb0));var _0x3b58=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb583[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x3b58('0x0'));module[_0x3b58('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x3b58('0x2')],'allowNull':![],'defaultValue':_0x3b58('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x3b58('0x4')}}; \ No newline at end of file +var _0x524c=['noop','TEXT','STRING','*,*,*,*','INTEGER'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x524c,0xe0));var _0xc524=function(_0x500bce,_0x20225a){_0x500bce=_0x500bce-0x0;var _0x16df28=_0x524c[_0x500bce];return _0x16df28;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xc524('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc524('0x1')},'appdata':{'type':Sequelize[_0xc524('0x2')]()},'description':{'type':Sequelize[_0xc524('0x3')]},'interval':{'type':Sequelize[_0xc524('0x3')],'defaultValue':_0xc524('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 9bf7a99..24b4357 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 _0xc8bc=['intersection','attributes','fields','length','includeAll','include','merge','catch','body','params','find','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','show','model','keys','MailApplication','rawAttributes','query','filters'];(function(_0x427126,_0x5b9d2a){var _0x170228=function(_0x59e5de){while(--_0x59e5de){_0x427126['push'](_0x427126['shift']());}};_0x170228(++_0x5b9d2a);}(_0xc8bc,0xf7));var _0xcc8b=function(_0x478c8a,_0x9afc92){_0x478c8a=_0x478c8a-0x0;var _0x3b6b3e=_0xc8bc[_0x478c8a];return _0x3b6b3e;};'use strict';var pdf=require(_0xcc8b('0x0'));var emlformat=require(_0xcc8b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcc8b('0x2'));var jsonpatch=require(_0xcc8b('0x3'));var rp=require('request-promise');var moment=require(_0xcc8b('0x4'));var BPromise=require(_0xcc8b('0x5'));var Mustache=require(_0xcc8b('0x6'));var util=require('util');var path=require(_0xcc8b('0x7'));var sox=require('sox');var csv=require(_0xcc8b('0x8'));var ejs=require(_0xcc8b('0x9'));var fs=require('fs');var _=require(_0xcc8b('0xa'));var squel=require(_0xcc8b('0xb'));var crypto=require(_0xcc8b('0xc'));var jsforce=require(_0xcc8b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcc8b('0x8'));var querystring=require('querystring');var Papa=require(_0xcc8b('0xe'));var Redis=require(_0xcc8b('0xf'));var authService=require(_0xcc8b('0x10'));var qs=require(_0xcc8b('0x11'));var as=require(_0xcc8b('0x12'));var hardwareService=require(_0xcc8b('0x13'));var logger=require(_0xcc8b('0x14'))(_0xcc8b('0x15'));var utils=require(_0xcc8b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xcc8b('0x17'));var db=require(_0xcc8b('0x18'))['db'];function respondWithStatusCode(_0x739f7,_0x8cfd84){_0x8cfd84=_0x8cfd84||0xcc;return function(_0x349ccc){if(_0x349ccc){return _0x739f7[_0xcc8b('0x19')](_0x8cfd84);}return _0x739f7['status'](_0x8cfd84)['end']();};}function respondWithResult(_0x672cd4,_0x294424){_0x294424=_0x294424||0xc8;return function(_0x2b14f3){if(_0x2b14f3){return _0x672cd4[_0xcc8b('0x1a')](_0x294424)[_0xcc8b('0x1b')](_0x2b14f3);}};}function respondWithFilteredResult(_0x4b9462,_0x795b81){return function(_0x4f6775){if(_0x4f6775){var _0x1752ee=_0x4f6775[_0xcc8b('0x1c')],_0x31a563=_0x795b81[_0xcc8b('0x1d')],_0x55c954=_0x795b81[_0xcc8b('0x1d')]+_0x795b81[_0xcc8b('0x1e')],_0x35e30a;if(_0x55c954>=_0x1752ee){_0x55c954=_0x1752ee;_0x35e30a=0xc8;}else{_0x35e30a=0xce;}_0x4b9462[_0xcc8b('0x1a')](_0x35e30a);return _0x4b9462[_0xcc8b('0x1f')](_0xcc8b('0x20'),_0x31a563+'-'+_0x55c954+'/'+_0x1752ee)[_0xcc8b('0x1b')](_0x4f6775);}return null;};}function patchUpdates(_0x7e4af4){return function(_0x5ea626){try{jsonpatch[_0xcc8b('0x21')](_0x5ea626,_0x7e4af4,!![]);}catch(_0x44c2df){return BPromise['reject'](_0x44c2df);}return _0x5ea626['save']();};}function saveUpdates(_0x56322b,_0x3f437f){return function(_0x22ca9c){if(_0x22ca9c){return _0x22ca9c[_0xcc8b('0x22')](_0x56322b)[_0xcc8b('0x23')](function(_0x13114f){return _0x13114f;});}return null;};}function removeEntity(_0x567b14,_0x2f78e8){return function(_0x34abbf){if(_0x34abbf){return _0x34abbf[_0xcc8b('0x24')]()[_0xcc8b('0x23')](function(){_0x567b14[_0xcc8b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x266b15,_0x382c66){return function(_0x2ea08c){if(!_0x2ea08c){_0x266b15[_0xcc8b('0x19')](0x194);}return _0x2ea08c;};}function handleError(_0x4758a2,_0x2ac96c){_0x2ac96c=_0x2ac96c||0x1f4;return function(_0x435a42){logger[_0xcc8b('0x25')](_0x435a42[_0xcc8b('0x26')]);if(_0x435a42[_0xcc8b('0x27')]){delete _0x435a42[_0xcc8b('0x27')];}_0x4758a2['status'](_0x2ac96c)[_0xcc8b('0x28')](_0x435a42);};}exports[_0xcc8b('0x29')]=function(_0xde2a1b,_0x25ce63){var _0x5decaf={'raw':!![],'where':{'id':_0xde2a1b['params']['id']}},_0x4f6160={};_0x4f6160[_0xcc8b('0x2a')]=_[_0xcc8b('0x2b')](db[_0xcc8b('0x2c')][_0xcc8b('0x2d')]);_0x4f6160['query']=_[_0xcc8b('0x2b')](_0xde2a1b[_0xcc8b('0x2e')]);_0x4f6160[_0xcc8b('0x2f')]=_[_0xcc8b('0x30')](_0x4f6160['model'],_0x4f6160['query']);_0x5decaf[_0xcc8b('0x31')]=_[_0xcc8b('0x30')](_0x4f6160[_0xcc8b('0x2a')],qs[_0xcc8b('0x32')](_0xde2a1b[_0xcc8b('0x2e')]['fields']));_0x5decaf[_0xcc8b('0x31')]=_0x5decaf[_0xcc8b('0x31')][_0xcc8b('0x33')]?_0x5decaf[_0xcc8b('0x31')]:_0x4f6160[_0xcc8b('0x2a')];if(_0xde2a1b[_0xcc8b('0x2e')][_0xcc8b('0x34')]){_0x5decaf[_0xcc8b('0x35')]=[{'all':!![]}];}_0x5decaf=_[_0xcc8b('0x36')]({},_0x5decaf,_0xde2a1b['options']);return db[_0xcc8b('0x2c')]['find'](_0x5decaf)[_0xcc8b('0x23')](handleEntityNotFound(_0x25ce63,null))[_0xcc8b('0x23')](respondWithResult(_0x25ce63,null))[_0xcc8b('0x37')](handleError(_0x25ce63,null));};exports['update']=function(_0x2698c2,_0x1e92dc){if(_0x2698c2[_0xcc8b('0x38')]['id']){delete _0x2698c2[_0xcc8b('0x38')]['id'];}return db[_0xcc8b('0x2c')]['find']({'where':{'id':_0x2698c2[_0xcc8b('0x39')]['id']}})['then'](handleEntityNotFound(_0x1e92dc,null))['then'](saveUpdates(_0x2698c2[_0xcc8b('0x38')],null))[_0xcc8b('0x23')](respondWithResult(_0x1e92dc,null))[_0xcc8b('0x37')](handleError(_0x1e92dc,null));};exports['destroy']=function(_0x4f9b9a,_0x4fd499){return db[_0xcc8b('0x2c')][_0xcc8b('0x3a')]({'where':{'id':_0x4f9b9a[_0xcc8b('0x39')]['id']}})['then'](handleEntityNotFound(_0x4fd499,null))[_0xcc8b('0x23')](removeEntity(_0x4fd499,null))[_0xcc8b('0x37')](handleError(_0x4fd499,null));}; \ No newline at end of file +var _0x2e2b=['body','find','params','html-pdf','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','set','apply','reject','then','destroy','error','name','send','show','model','keys','rawAttributes','query','filters','intersection','attributes','fields','merge','options','MailApplication','catch','update'];(function(_0x5b6a48,_0x4c5827){var _0x3f4f56=function(_0x237d0b){while(--_0x237d0b){_0x5b6a48['push'](_0x5b6a48['shift']());}};_0x3f4f56(++_0x4c5827);}(_0x2e2b,0x9f));var _0xb2e2=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x2e2b[_0x556927];return _0x5f1235;};'use strict';var pdf=require(_0xb2e2('0x0'));var emlformat=require(_0xb2e2('0x1'));var rimraf=require(_0xb2e2('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb2e2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb2e2('0x4'));var Mustache=require(_0xb2e2('0x5'));var util=require('util');var path=require(_0xb2e2('0x6'));var sox=require(_0xb2e2('0x7'));var csv=require('to-csv');var ejs=require(_0xb2e2('0x8'));var fs=require('fs');var _=require(_0xb2e2('0x9'));var squel=require('squel');var crypto=require(_0xb2e2('0xa'));var jsforce=require(_0xb2e2('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb2e2('0xc'));var querystring=require(_0xb2e2('0xd'));var Papa=require(_0xb2e2('0xe'));var Redis=require(_0xb2e2('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb2e2('0x10'));var as=require(_0xb2e2('0x11'));var hardwareService=require(_0xb2e2('0x12'));var logger=require('../../config/logger')(_0xb2e2('0x13'));var utils=require('../../config/utils');var config=require(_0xb2e2('0x14'));var licenseUtil=require(_0xb2e2('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2240c3,_0x7121d4){_0x7121d4=_0x7121d4||0xcc;return function(_0x25cf0c){if(_0x25cf0c){return _0x2240c3[_0xb2e2('0x16')](_0x7121d4);}return _0x2240c3[_0xb2e2('0x17')](_0x7121d4)[_0xb2e2('0x18')]();};}function respondWithResult(_0x39e034,_0x5359a0){_0x5359a0=_0x5359a0||0xc8;return function(_0x6595ef){if(_0x6595ef){return _0x39e034['status'](_0x5359a0)['json'](_0x6595ef);}};}function respondWithFilteredResult(_0x5ac1f2,_0x12500d){return function(_0x585a00){if(_0x585a00){var _0x34c675=_0x585a00['count'],_0x48036c=_0x12500d['offset'],_0x121c1d=_0x12500d[_0xb2e2('0x19')]+_0x12500d[_0xb2e2('0x1a')],_0x1faf1a;if(_0x121c1d>=_0x34c675){_0x121c1d=_0x34c675;_0x1faf1a=0xc8;}else{_0x1faf1a=0xce;}_0x5ac1f2[_0xb2e2('0x17')](_0x1faf1a);return _0x5ac1f2[_0xb2e2('0x1b')]('Content-Range',_0x48036c+'-'+_0x121c1d+'/'+_0x34c675)['json'](_0x585a00);}return null;};}function patchUpdates(_0x109404){return function(_0x4ca261){try{jsonpatch[_0xb2e2('0x1c')](_0x4ca261,_0x109404,!![]);}catch(_0x129cf5){return BPromise[_0xb2e2('0x1d')](_0x129cf5);}return _0x4ca261['save']();};}function saveUpdates(_0x2f184c,_0x2cd1c2){return function(_0x60eb9c){if(_0x60eb9c){return _0x60eb9c['update'](_0x2f184c)[_0xb2e2('0x1e')](function(_0x236ba0){return _0x236ba0;});}return null;};}function removeEntity(_0x3eb4d6,_0x2c38cc){return function(_0x3cbd78){if(_0x3cbd78){return _0x3cbd78[_0xb2e2('0x1f')]()['then'](function(){_0x3eb4d6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x349d73,_0x214805){return function(_0x349ad2){if(!_0x349ad2){_0x349d73[_0xb2e2('0x16')](0x194);}return _0x349ad2;};}function handleError(_0x26a8b1,_0x4ec4a3){_0x4ec4a3=_0x4ec4a3||0x1f4;return function(_0x375197){logger[_0xb2e2('0x20')](_0x375197['stack']);if(_0x375197[_0xb2e2('0x21')]){delete _0x375197[_0xb2e2('0x21')];}_0x26a8b1[_0xb2e2('0x17')](_0x4ec4a3)[_0xb2e2('0x22')](_0x375197);};}exports[_0xb2e2('0x23')]=function(_0x48947e,_0x26c8d9){var _0x4b8df7={'raw':!![],'where':{'id':_0x48947e['params']['id']}},_0xa83af1={};_0xa83af1[_0xb2e2('0x24')]=_[_0xb2e2('0x25')](db['MailApplication'][_0xb2e2('0x26')]);_0xa83af1[_0xb2e2('0x27')]=_['keys'](_0x48947e[_0xb2e2('0x27')]);_0xa83af1[_0xb2e2('0x28')]=_[_0xb2e2('0x29')](_0xa83af1['model'],_0xa83af1['query']);_0x4b8df7[_0xb2e2('0x2a')]=_[_0xb2e2('0x29')](_0xa83af1[_0xb2e2('0x24')],qs[_0xb2e2('0x2b')](_0x48947e[_0xb2e2('0x27')][_0xb2e2('0x2b')]));_0x4b8df7[_0xb2e2('0x2a')]=_0x4b8df7[_0xb2e2('0x2a')]['length']?_0x4b8df7[_0xb2e2('0x2a')]:_0xa83af1[_0xb2e2('0x24')];if(_0x48947e['query']['includeAll']){_0x4b8df7['include']=[{'all':!![]}];}_0x4b8df7=_[_0xb2e2('0x2c')]({},_0x4b8df7,_0x48947e[_0xb2e2('0x2d')]);return db[_0xb2e2('0x2e')]['find'](_0x4b8df7)['then'](handleEntityNotFound(_0x26c8d9,null))[_0xb2e2('0x1e')](respondWithResult(_0x26c8d9,null))[_0xb2e2('0x2f')](handleError(_0x26c8d9,null));};exports[_0xb2e2('0x30')]=function(_0x500de7,_0xcccfcb){if(_0x500de7[_0xb2e2('0x31')]['id']){delete _0x500de7[_0xb2e2('0x31')]['id'];}return db[_0xb2e2('0x2e')][_0xb2e2('0x32')]({'where':{'id':_0x500de7[_0xb2e2('0x33')]['id']}})[_0xb2e2('0x1e')](handleEntityNotFound(_0xcccfcb,null))['then'](saveUpdates(_0x500de7[_0xb2e2('0x31')],null))['then'](respondWithResult(_0xcccfcb,null))[_0xb2e2('0x2f')](handleError(_0xcccfcb,null));};exports[_0xb2e2('0x1f')]=function(_0x172263,_0x5a78b0){return db['MailApplication'][_0xb2e2('0x32')]({'where':{'id':_0x172263[_0xb2e2('0x33')]['id']}})[_0xb2e2('0x1e')](handleEntityNotFound(_0x5a78b0,null))[_0xb2e2('0x1e')](removeEntity(_0x5a78b0,null))[_0xb2e2('0x2f')](handleError(_0x5a78b0,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index b71db24..c168c3f 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 _0x955f=['moment','request-promise','../../config/environment','exports','MailApplication','mail_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x54e970,_0x56881d){var _0x64c2ae=function(_0x14fc8c){while(--_0x14fc8c){_0x54e970['push'](_0x54e970['shift']());}};_0x64c2ae(++_0x56881d);}(_0x955f,0x1eb));var _0xf955=function(_0x4c1a6d,_0x8fdd49){_0x4c1a6d=_0x4c1a6d-0x0;var _0x38e1a2=_0x955f[_0x4c1a6d];return _0x38e1a2;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var logger=require(_0xf955('0x2'))(_0xf955('0x3'));var moment=require(_0xf955('0x4'));var BPromise=require('bluebird');var rp=require(_0xf955('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf955('0x6'));var attributes=require('./mailApplication.attributes');module[_0xf955('0x7')]=function(_0x2caff2,_0x3fdac2){return _0x2caff2['define'](_0xf955('0x8'),attributes,{'tableName':_0xf955('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf955('0xa')});}; \ No newline at end of file +var _0x1219=['define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports'];(function(_0x54b396,_0x3612ee){var _0x532e6d=function(_0xc8286e){while(--_0xc8286e){_0x54b396['push'](_0x54b396['shift']());}};_0x532e6d(++_0x3612ee);}(_0x1219,0x17c));var _0x9121=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1219[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9121('0x0'));var util=require(_0x9121('0x1'));var logger=require(_0x9121('0x2'))(_0x9121('0x3'));var moment=require(_0x9121('0x4'));var BPromise=require('bluebird');var rp=require(_0x9121('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9121('0x6'));var config=require(_0x9121('0x7'));var attributes=require(_0x9121('0x8'));module[_0x9121('0x9')]=function(_0x420b62,_0x430583){return _0x420b62[_0x9121('0xa')](_0x9121('0xb'),attributes,{'tableName':_0x9121('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9121('0xd'),'collate':_0x9121('0xe')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 650ac1c..eda656b 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 _0x0012=['request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','error','message','result','update','body','options','raw','where','info','UpdateMailApplication','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x0012,0x1d0));var _0x2001=function(_0x560ecf,_0x406bd1){_0x560ecf=_0x560ecf-0x0;var _0x267aba=_0x0012[_0x560ecf];return _0x267aba;};'use strict';var _=require('lodash');var util=require(_0x2001('0x0'));var moment=require(_0x2001('0x1'));var BPromise=require(_0x2001('0x2'));var rs=require(_0x2001('0x3'));var fs=require('fs');var Redis=require(_0x2001('0x4'));var db=require(_0x2001('0x5'))['db'];var utils=require(_0x2001('0x6'));var logger=require('../../config/logger')(_0x2001('0x7'));var config=require(_0x2001('0x8'));var jayson=require(_0x2001('0x9'));var client=jayson[_0x2001('0xa')][_0x2001('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2970eb,_0x26dae4,_0xc0b9ba){return new BPromise(function(_0x521c37,_0xa42e4a){return client[_0x2001('0xc')](_0x2970eb,_0xc0b9ba)[_0x2001('0xd')](function(_0xaaabef){logger['info'](_0x2001('0xe'),_0x26dae4,_0x2001('0xf'));logger[_0x2001('0x10')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x26dae4,'request\x20sent',JSON['stringify'](_0xaaabef));if(_0xaaabef['error']){if(_0xaaabef[_0x2001('0x11')]['code']===0x1f4){logger[_0x2001('0x11')](_0x2001('0xe'),_0x26dae4,_0xaaabef['error']['message']);return _0xa42e4a(_0xaaabef[_0x2001('0x11')][_0x2001('0x12')]);}logger['error'](_0x2001('0xe'),_0x26dae4,_0xaaabef[_0x2001('0x11')][_0x2001('0x12')]);return _0x521c37(_0xaaabef[_0x2001('0x11')][_0x2001('0x12')]);}else{logger['info']('MailApplication,\x20%s,\x20%s',_0x26dae4,_0x2001('0xf'));_0x521c37(_0xaaabef[_0x2001('0x13')][_0x2001('0x12')]);}})['catch'](function(_0x90ef05){logger[_0x2001('0x11')](_0x2001('0xe'),_0x26dae4,_0x90ef05);_0xa42e4a(_0x90ef05);});});}exports['UpdateMailApplication']=function(_0x45e7d0){var _0x4a4cad=this;return new Promise(function(_0x1f8478,_0x1a87e4){return db['MailApplication'][_0x2001('0x14')](_0x45e7d0[_0x2001('0x15')],{'raw':_0x45e7d0[_0x2001('0x16')]?_0x45e7d0['options'][_0x2001('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45e7d0[_0x2001('0x16')]?_0x45e7d0[_0x2001('0x16')][_0x2001('0x18')]||null:null,'attributes':_0x45e7d0['options']?_0x45e7d0[_0x2001('0x16')]['attributes']||null:null,'limit':_0x45e7d0[_0x2001('0x16')]?_0x45e7d0[_0x2001('0x16')]['limit']||null:null})[_0x2001('0xd')](function(_0x431c91){logger[_0x2001('0x19')](_0x2001('0x1a'),_0x45e7d0);logger['debug'](_0x2001('0x1a'),_0x45e7d0,JSON['stringify'](_0x431c91));_0x1f8478(_0x431c91);})[_0x2001('0x1b')](function(_0x9d3364){logger['error'](_0x2001('0x1a'),_0x9d3364[_0x2001('0x12')],_0x45e7d0);_0x1a87e4(_0x4a4cad[_0x2001('0x11')](0x1f4,_0x9d3364[_0x2001('0x12')]));});});}; \ No newline at end of file +var _0xae11=['attributes','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','where'];(function(_0x4b354f,_0x350965){var _0xe3f93c=function(_0x3cb787){while(--_0x3cb787){_0x4b354f['push'](_0x4b354f['shift']());}};_0xe3f93c(++_0x350965);}(_0xae11,0xf1));var _0x1ae1=function(_0x53e3fa,_0x50c5f2){_0x53e3fa=_0x53e3fa-0x0;var _0xe8584a=_0xae11[_0x53e3fa];return _0xe8584a;};'use strict';var _=require('lodash');var util=require(_0x1ae1('0x0'));var moment=require(_0x1ae1('0x1'));var BPromise=require(_0x1ae1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ae1('0x3'));var db=require(_0x1ae1('0x4'))['db'];var utils=require(_0x1ae1('0x5'));var logger=require(_0x1ae1('0x6'))('rpc');var config=require(_0x1ae1('0x7'));var jayson=require(_0x1ae1('0x8'));var client=jayson[_0x1ae1('0x9')][_0x1ae1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34cf6e,_0x2c94b3,_0x39d482){return new BPromise(function(_0xd86dbf,_0xbfed84){return client[_0x1ae1('0xb')](_0x34cf6e,_0x39d482)[_0x1ae1('0xc')](function(_0x43e133){logger[_0x1ae1('0xd')](_0x1ae1('0xe'),_0x2c94b3,_0x1ae1('0xf'));logger[_0x1ae1('0x10')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x2c94b3,_0x1ae1('0xf'),JSON[_0x1ae1('0x11')](_0x43e133));if(_0x43e133[_0x1ae1('0x12')]){if(_0x43e133[_0x1ae1('0x12')][_0x1ae1('0x13')]===0x1f4){logger[_0x1ae1('0x12')](_0x1ae1('0xe'),_0x2c94b3,_0x43e133[_0x1ae1('0x12')]['message']);return _0xbfed84(_0x43e133[_0x1ae1('0x12')][_0x1ae1('0x14')]);}logger[_0x1ae1('0x12')](_0x1ae1('0xe'),_0x2c94b3,_0x43e133[_0x1ae1('0x12')][_0x1ae1('0x14')]);return _0xd86dbf(_0x43e133[_0x1ae1('0x12')][_0x1ae1('0x14')]);}else{logger[_0x1ae1('0xd')](_0x1ae1('0xe'),_0x2c94b3,_0x1ae1('0xf'));_0xd86dbf(_0x43e133[_0x1ae1('0x15')][_0x1ae1('0x14')]);}})[_0x1ae1('0x16')](function(_0x4e7356){logger[_0x1ae1('0x12')](_0x1ae1('0xe'),_0x2c94b3,_0x4e7356);_0xbfed84(_0x4e7356);});});}exports[_0x1ae1('0x17')]=function(_0x391211){var _0x32c881=this;return new Promise(function(_0x3a254c,_0x1bb08c){return db[_0x1ae1('0x18')][_0x1ae1('0x19')](_0x391211[_0x1ae1('0x1a')],{'raw':_0x391211['options']?_0x391211[_0x1ae1('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x391211[_0x1ae1('0x1b')]?_0x391211[_0x1ae1('0x1b')][_0x1ae1('0x1c')]||null:null,'attributes':_0x391211[_0x1ae1('0x1b')]?_0x391211['options'][_0x1ae1('0x1d')]||null:null,'limit':_0x391211['options']?_0x391211[_0x1ae1('0x1b')]['limit']||null:null})['then'](function(_0x506a61){logger[_0x1ae1('0xd')](_0x1ae1('0x17'),_0x391211);logger['debug'](_0x1ae1('0x17'),_0x391211,JSON[_0x1ae1('0x11')](_0x506a61));_0x3a254c(_0x506a61);})[_0x1ae1('0x16')](function(_0x4932bc){logger[_0x1ae1('0x12')](_0x1ae1('0x17'),_0x4932bc['message'],_0x391211);_0x1bb08c(_0x32c881['error'](0x1f4,_0x4932bc[_0x1ae1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index bc10585..891fa3b 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 _0x2e9f=['delete','mailinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','/:id','mailinteraction:update','update'];(function(_0x39678c,_0x37c03c){var _0x1624a2=function(_0x131fc9){while(--_0x131fc9){_0x39678c['push'](_0x39678c['shift']());}};_0x1624a2(++_0x37c03c);}(_0x2e9f,0xc5));var _0xf2e9=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x2e9f[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0xf2e9('0x0'));var util=require(_0xf2e9('0x1'));var path=require('path');var timeout=require(_0xf2e9('0x2'));var express=require(_0xf2e9('0x3'));var router=express[_0xf2e9('0x4')]();var auth=require(_0xf2e9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf2e9('0x6'));var controller=require('./mailInteraction.controller');router[_0xf2e9('0x7')]('/',auth[_0xf2e9('0x8')](),controller[_0xf2e9('0x9')]);router['get']('/describe',auth[_0xf2e9('0x8')](),controller[_0xf2e9('0xa')]);router[_0xf2e9('0x7')]('/:id',auth[_0xf2e9('0x8')](),controller[_0xf2e9('0xb')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xf2e9('0xc')]);router[_0xf2e9('0x7')](_0xf2e9('0xd'),auth['isAuthenticated'](),controller[_0xf2e9('0xe')]);router[_0xf2e9('0xf')]('/',auth[_0xf2e9('0x8')](),controller[_0xf2e9('0x10')]);router[_0xf2e9('0xf')](_0xf2e9('0x11'),auth[_0xf2e9('0x8')](),controller[_0xf2e9('0x12')]);router[_0xf2e9('0xf')](_0xf2e9('0x13'),auth[_0xf2e9('0x8')](),interaction[_0xf2e9('0x14')](_0xf2e9('0x15'),_0xf2e9('0x16')),controller[_0xf2e9('0x17')]);router['put'](_0xf2e9('0x18'),auth['isAuthenticated'](),interaction[_0xf2e9('0x14')](_0xf2e9('0x15'),_0xf2e9('0x19')),controller[_0xf2e9('0x1a')]);router[_0xf2e9('0x1b')](_0xf2e9('0x18'),auth[_0xf2e9('0x8')](),interaction[_0xf2e9('0x14')](_0xf2e9('0x15'),_0xf2e9('0x1c')),controller[_0xf2e9('0x1d')]);router['delete'](_0xf2e9('0x13'),auth[_0xf2e9('0x8')](),controller[_0xf2e9('0x1e')]);module[_0xf2e9('0x1f')]=router; \ No newline at end of file +var _0x2dc9=['/:id/download','download','create','addMessage','post','tracked','mail','mailinteraction:addtags','addTags','/:id','mailinteraction:update','update','delete','/:id/tags','removeTags','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','isAuthenticated','index','get','/describe','describe','show','/:id/messages','getMessages'];(function(_0x363057,_0x11310d){var _0x4e6b20=function(_0x2bd3ab){while(--_0x2bd3ab){_0x363057['push'](_0x363057['shift']());}};_0x4e6b20(++_0x11310d);}(_0x2dc9,0x127));var _0x92dc=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2dc9[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require(_0x92dc('0x0'));var path=require(_0x92dc('0x1'));var timeout=require(_0x92dc('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x92dc('0x3'));var interaction=require(_0x92dc('0x4'));var config=require(_0x92dc('0x5'));var controller=require(_0x92dc('0x6'));router['get']('/',auth[_0x92dc('0x7')](),controller[_0x92dc('0x8')]);router[_0x92dc('0x9')](_0x92dc('0xa'),auth['isAuthenticated'](),controller[_0x92dc('0xb')]);router[_0x92dc('0x9')]('/:id',auth[_0x92dc('0x7')](),controller[_0x92dc('0xc')]);router[_0x92dc('0x9')](_0x92dc('0xd'),auth[_0x92dc('0x7')](),controller[_0x92dc('0xe')]);router[_0x92dc('0x9')](_0x92dc('0xf'),auth[_0x92dc('0x7')](),controller[_0x92dc('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x92dc('0x11')]);router['post'](_0x92dc('0xd'),auth[_0x92dc('0x7')](),controller[_0x92dc('0x12')]);router[_0x92dc('0x13')]('/:id/tags',auth[_0x92dc('0x7')](),interaction[_0x92dc('0x14')](_0x92dc('0x15'),_0x92dc('0x16')),controller[_0x92dc('0x17')]);router['put'](_0x92dc('0x18'),auth['isAuthenticated'](),interaction[_0x92dc('0x14')](_0x92dc('0x15'),_0x92dc('0x19')),controller[_0x92dc('0x1a')]);router[_0x92dc('0x1b')](_0x92dc('0x18'),auth[_0x92dc('0x7')](),interaction[_0x92dc('0x14')]('mail','mailinteraction:destroy'),controller['destroy']);router[_0x92dc('0x1b')](_0x92dc('0x1c'),auth['isAuthenticated'](),controller[_0x92dc('0x1d')]);module[_0x92dc('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index f272fcd..c233482 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 _0x117a=['iconv','DATE','STRING','TEXT','long','BOOLEAN','ENUM','out'];(function(_0x28297f,_0x343fd4){var _0x13ec6b=function(_0x5afaaf){while(--_0x5afaaf){_0x28297f['push'](_0x28297f['shift']());}};_0x13ec6b(++_0x343fd4);}(_0x117a,0x1d8));var _0xa117=function(_0x112fe3,_0x16b642){_0x112fe3=_0x112fe3-0x0;var _0x1ec903=_0x117a[_0x112fe3];return _0x1ec903;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xa117('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa117('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa117('0x2')]},'thirdDisposition':{'type':Sequelize[_0xa117('0x2')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xa117('0x3')](_0xa117('0x4'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xa117('0x5')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xa117('0x1')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xa117('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xa117('0x6')]('in',_0xa117('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa117('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xa117('0x6')]('in',_0xa117('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0xa117('0x3')](_0xa117('0x4'))},'lastMsgText':{'type':Sequelize['TEXT'](_0xa117('0x4'))}}; \ No newline at end of file +var _0xdafc=['STRING','TEXT','long','DATE','ENUM','out','sequelize','BOOLEAN'];(function(_0x439662,_0x5defdb){var _0x251ec4=function(_0x499549){while(--_0x499549){_0x439662['push'](_0x439662['shift']());}};_0x251ec4(++_0x5defdb);}(_0xdafc,0x106));var _0xcdaf=function(_0x4dd6e4,_0x1336d4){_0x4dd6e4=_0x4dd6e4-0x0;var _0x46c1bb=_0xdafc[_0x4dd6e4];return _0x46c1bb;};'use strict';var Sequelize=require(_0xcdaf('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0xcdaf('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xcdaf('0x2')]},'secondDisposition':{'type':Sequelize[_0xcdaf('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xcdaf('0x2')]},'inReplyTo':{'type':Sequelize[_0xcdaf('0x2')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xcdaf('0x3')](_0xcdaf('0x4'))},'subject':{'type':Sequelize[_0xcdaf('0x3')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xcdaf('0x5')]},'substatus':{'type':Sequelize[_0xcdaf('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0xcdaf('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xcdaf('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xcdaf('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xcdaf('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT']('long')},'lastMsgText':{'type':Sequelize[_0xcdaf('0x3')](_0xcdaf('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 6ef4351..801737a 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 _0x5c3c=['o.fullname','Owner.fullname','o.internal','Owner.internal','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','enableEmailPreview','all','rows','show','params','includeAll','include','merge','options','create','body','describe','MailMessage','addMessage','ids','getMessages','pick','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','setTags','omit','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','sort','get','mkdirSync','each','headers','Bcc','basename','existsSync','readFileSync','message%d.eml','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','map','Tags','TagIds','split','forEach','push','MailInteraction','findOne','lastMsgBody','lastMsgText','fromString','catch','index','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','field','color','from','select','u.id','ui.MailInteractionId','user_has_mail_interactions','users','u.id\x20=\x20ui.UserId','mail_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','it.MailInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.subject','i.secondDisposition','i.thirdDisposition','i.to','i.MailAccountId','i.UserId','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax'];(function(_0x473068,_0xf0d848){var _0x47476a=function(_0x59b1f7){while(--_0x59b1f7){_0x473068['push'](_0x473068['shift']());}};_0x47476a(++_0xf0d848);}(_0x5c3c,0x132));var _0xc5c3=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0x5c3c[_0x1b828b];return _0x98da1a;};'use strict';var pdf=require(_0xc5c3('0x0'));var emlformat=require(_0xc5c3('0x1'));var rimraf=require(_0xc5c3('0x2'));var zipdir=require(_0xc5c3('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc5c3('0x4'));var moment=require(_0xc5c3('0x5'));var BPromise=require(_0xc5c3('0x6'));var Mustache=require(_0xc5c3('0x7'));var util=require(_0xc5c3('0x8'));var path=require(_0xc5c3('0x9'));var sox=require(_0xc5c3('0xa'));var csv=require(_0xc5c3('0xb'));var ejs=require(_0xc5c3('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc5c3('0xd'));var deskjs=require(_0xc5c3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc5c3('0xf'));var Papa=require(_0xc5c3('0x10'));var htmlToText=require('html-to-text');var juice=require(_0xc5c3('0x11'));var Redis=require(_0xc5c3('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc5c3('0x13'));var as=require(_0xc5c3('0x14'));var hardwareService=require(_0xc5c3('0x15'));var logger=require('../../config/logger')(_0xc5c3('0x16'));var utils=require(_0xc5c3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc5c3('0x18'));var db=require(_0xc5c3('0x19'))['db'];config[_0xc5c3('0x1a')]=_['defaults'](config[_0xc5c3('0x1a')],{'host':_0xc5c3('0x1b'),'port':0x18eb});var socket=require(_0xc5c3('0x1c'))(new Redis(config[_0xc5c3('0x1a')]));require(_0xc5c3('0x1d'))['register'](socket);function respondWithStatusCode(_0x5c0341,_0x4445ea){_0x4445ea=_0x4445ea||0xcc;return function(_0x577e1a){if(_0x577e1a){return _0x5c0341[_0xc5c3('0x1e')](_0x4445ea);}return _0x5c0341[_0xc5c3('0x1f')](_0x4445ea)['end']();};}function respondWithResult(_0x4ff2de,_0x467ba9){_0x467ba9=_0x467ba9||0xc8;return function(_0x52cd2e){if(_0x52cd2e){return _0x4ff2de[_0xc5c3('0x1f')](_0x467ba9)[_0xc5c3('0x20')](_0x52cd2e);}};}function respondWithFilteredResult(_0x2ff158,_0x13c867){return function(_0x28bae6){if(_0x28bae6){var _0x5e11d5=_0x28bae6[_0xc5c3('0x21')],_0x364f42=_0x13c867['offset'],_0x41af00=_0x13c867[_0xc5c3('0x22')]+_0x13c867[_0xc5c3('0x23')],_0x123dba;if(_0x41af00>=_0x5e11d5){_0x41af00=_0x5e11d5;_0x123dba=0xc8;}else{_0x123dba=0xce;}_0x2ff158[_0xc5c3('0x1f')](_0x123dba);return _0x2ff158[_0xc5c3('0x24')](_0xc5c3('0x25'),_0x364f42+'-'+_0x41af00+'/'+_0x5e11d5)['json'](_0x28bae6);}return null;};}function patchUpdates(_0xb07420){return function(_0x159bec){try{jsonpatch[_0xc5c3('0x26')](_0x159bec,_0xb07420,!![]);}catch(_0x2de266){return BPromise[_0xc5c3('0x27')](_0x2de266);}return _0x159bec[_0xc5c3('0x28')]();};}function saveUpdates(_0x40ebcc,_0x5996a0){return function(_0x52d638){if(_0x52d638){return _0x52d638[_0xc5c3('0x29')](_0x40ebcc)[_0xc5c3('0x2a')](function(_0x53ab72){return _0x53ab72;});}return null;};}function removeEntity(_0x5c7329,_0x23e2fb){return function(_0x1591e3){if(_0x1591e3){return _0x1591e3[_0xc5c3('0x2b')]()['then'](function(){_0x5c7329['status'](0xcc)[_0xc5c3('0x2c')]();});}};}function handleEntityNotFound(_0x22f607,_0x20c506){return function(_0x29791c){if(!_0x29791c){_0x22f607['sendStatus'](0x194);}return _0x29791c;};}function handleError(_0x21efd6,_0x5176c4){_0x5176c4=_0x5176c4||0x1f4;return function(_0x2eacec){logger['error'](_0x2eacec[_0xc5c3('0x2d')]);if(_0x2eacec[_0xc5c3('0x2e')]){delete _0x2eacec[_0xc5c3('0x2e')];}_0x21efd6[_0xc5c3('0x1f')](_0x5176c4)[_0xc5c3('0x2f')](_0x2eacec);};}function getInteractionUsers(_0x2d07e1,_0x35a397){return new BPromise(function(_0x4b5a0c,_0xbcafd6){try{if(_0x35a397[_0x2d07e1['id']]){_0x2d07e1['Users']=_[_0xc5c3('0x30')](_0x35a397[_0x2d07e1['id']],function(_0x43ebfc){return{'id':_0x43ebfc['id'],'fullname':_0x43ebfc['fullname']};});}}catch(_0x4daa8b){_0xbcafd6(_0x4daa8b);}_0x4b5a0c(_0x2d07e1);});}function getInteractionTags(_0x2e648f,_0x46f149){return new BPromise(function(_0x66e83c,_0x19e482){try{if(_0x2e648f['TagIds']){_0x2e648f[_0xc5c3('0x31')]=[];_0x2e648f[_0xc5c3('0x32')][_0xc5c3('0x33')](',')[_0xc5c3('0x34')](function(_0x1b4538){_0x2e648f[_0xc5c3('0x31')][_0xc5c3('0x35')](_0x46f149[_0x1b4538]);});}delete _0x2e648f[_0xc5c3('0x32')];}catch(_0x1d1e6d){_0x19e482(_0x1d1e6d);}_0x66e83c(_0x2e648f);});}function getLastMessageText(_0x4b8be9){return new BPromise(function(_0x340439,_0x7fd66e){return db[_0xc5c3('0x36')][_0xc5c3('0x37')]({'where':{'id':_0x4b8be9['id']},'attributes':[_0xc5c3('0x38'),_0xc5c3('0x39')],'raw':!![]})[_0xc5c3('0x2a')](function(_0x4c1ab4){if(!_0x4c1ab4['lastMsgText']){_0x4b8be9[_0xc5c3('0x39')]=_['trimStart'](htmlToText[_0xc5c3('0x3a')](_0x4c1ab4[_0xc5c3('0x38')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x4b8be9[_0xc5c3('0x39')]=_0x4c1ab4[_0xc5c3('0x39')];}_0x340439(_0x4b8be9);})[_0xc5c3('0x3b')](function(_0x498677){_0x7fd66e(_0x498677);});});}function updateMailInteraction(_0x21b243,_0xdaecce,_0x547e20,_0x29f57d){return new BPromise(function(_0x17d93c,_0x321917){return getInteractionUsers(_0x21b243,_0x547e20)[_0xc5c3('0x2a')](function(_0x7347d){return getInteractionTags(_0x7347d,_0xdaecce);})[_0xc5c3('0x2a')](function(_0x168056){if(_0x29f57d){_0x17d93c(getLastMessageText(_0x168056));}else{_0x17d93c(_0x168056);}})[_0xc5c3('0x3b')](function(_0x1fb127){_0x321917(_0x1fb127);});});}exports[_0xc5c3('0x3c')]=function(_0x49523a,_0x361b04){var _0x541bbd={},_0x4fdbe6={},_0x11c029={'count':0x0,'rows':[]};var _0x10e27d=_[_0xc5c3('0x30')](db[_0xc5c3('0x36')][_0xc5c3('0x3d')],function(_0x499791){return{'name':_0x499791['fieldName'],'type':_0x499791[_0xc5c3('0x3e')][_0xc5c3('0x3f')]};});_0x4fdbe6['model']=_[_0xc5c3('0x30')](_0x10e27d,'name');_0x4fdbe6[_0xc5c3('0x40')]=_[_0xc5c3('0x41')](_0x49523a[_0xc5c3('0x40')]);_0x4fdbe6['filters']=_[_0xc5c3('0x42')](_0x4fdbe6[_0xc5c3('0x43')],_0x4fdbe6['query']);_0x541bbd[_0xc5c3('0x44')]=_['intersection'](_0x4fdbe6[_0xc5c3('0x43')],qs[_0xc5c3('0x45')](_0x49523a['query']['fields']));_0x541bbd['attributes']=_0x541bbd[_0xc5c3('0x44')][_0xc5c3('0x46')]?_0x541bbd['attributes']:_0x4fdbe6[_0xc5c3('0x43')];if(!_0x49523a[_0xc5c3('0x40')][_0xc5c3('0x47')](_0xc5c3('0x48'))){_0x541bbd['limit']=qs[_0xc5c3('0x23')](_0x49523a['query']['limit']);_0x541bbd[_0xc5c3('0x22')]=qs[_0xc5c3('0x22')](_0x49523a['query'][_0xc5c3('0x22')]);}_0x541bbd[_0xc5c3('0x49')]=qs['sort'](_0x49523a[_0xc5c3('0x40')]['sort']);_0x541bbd[_0xc5c3('0x4a')]=qs[_0xc5c3('0x4b')](_['pick'](_0x49523a[_0xc5c3('0x40')],_0x4fdbe6['filters']),_0x10e27d);var _0x11b997=[];var _0x30179f=squel['select']()[_0xc5c3('0x4c')]('id')[_0xc5c3('0x4c')](_0xc5c3('0x2e'))[_0xc5c3('0x4c')](_0xc5c3('0x4d'))[_0xc5c3('0x4e')]('tools_tags');var _0x3e658b=squel[_0xc5c3('0x4f')]()[_0xc5c3('0x4c')](_0xc5c3('0x50'))[_0xc5c3('0x4c')]('u.fullname')['field'](_0xc5c3('0x51'))[_0xc5c3('0x4e')](_0xc5c3('0x52'),'ui')['left_join'](_0xc5c3('0x53'),'u',_0xc5c3('0x54'));var _0x3a901f=squel[_0xc5c3('0x4f')]()[_0xc5c3('0x4e')](_0xc5c3('0x55'),'i')[_0xc5c3('0x56')]('cm_contacts','c',_0xc5c3('0x57'))[_0xc5c3('0x56')](_0xc5c3('0x53'),'o','o.id\x20=\x20i.UserId')[_0xc5c3('0x56')](_0xc5c3('0x58'),'a',_0xc5c3('0x59'))[_0xc5c3('0x56')](_0xc5c3('0x5a'),'me','me.MailInteractionId\x20=\x20i.id')[_0xc5c3('0x56')]('mail_interaction_has_tags','it',_0xc5c3('0x5b'))['left_join'](_0xc5c3('0x5c'),'t',_0xc5c3('0x5d'));var _0x4add6b=squel[_0xc5c3('0x5e')]();var _0x1311de=[];var _0x4be969=squel[_0xc5c3('0x5e')]();var _0x1b906;if(_0x49523a[_0xc5c3('0x40')][_0xc5c3('0x5f')]){_0x1b906=as[_0xc5c3('0x60')](_0x49523a['query'][_0xc5c3('0x5f')]);var _0x34bf9c=_0x1b906[_0xc5c3('0x61')];for(var _0x4d1ff8=0x0;_0x4d1ff8<_0x1b906[_0xc5c3('0x62')]['length'];_0x4d1ff8++){var _0x5a6480=_0x1b906[_0xc5c3('0x62')][_0x4d1ff8];var _0x11a6c4='i';var _0x110105=_[_0xc5c3('0x63')](_0x10e27d,[_0xc5c3('0x2e'),_0x5a6480[_0xc5c3('0x4c')]]);if(!_0x110105){switch(_0x5a6480['field']){case _0xc5c3('0x64'):if(_0x5a6480[_0xc5c3('0x65')]==0x1){_0x3a901f[_0xc5c3('0x66')]('`'+_0x5a6480[_0xc5c3('0x4c')]+_0xc5c3('0x67'));}else{_0x3a901f[_0xc5c3('0x66')]('`'+_0x5a6480[_0xc5c3('0x4c')]+'`\x20>\x200');}break;case'Contact':if(_0x5a6480[_0xc5c3('0x68')]===_0xc5c3('0x69')){if(_0x5a6480['value'][_0xc5c3('0x33')]('\x20')[_0xc5c3('0x46')]>0x1){_0x4add6b[_0x34bf9c](_0xc5c3('0x6a'),qs[_0xc5c3('0x6b')](_0x5a6480['value']),null);}else{var _0x41fc40='%'+_0x5a6480[_0xc5c3('0x65')]+'%';_0x4add6b[_0x34bf9c](_0xc5c3('0x6c'),_0x41fc40,_0x41fc40,_0x41fc40);}}else{_0x110105=_[_0xc5c3('0x63')](_0x10e27d,[_0xc5c3('0x2e'),_0xc5c3('0x6d')]);_0x5a6480[_0xc5c3('0x4c')]=_0xc5c3('0x6d');_0x578843=as[_0xc5c3('0x6e')](_0x11a6c4,_0x110105['type'],_0x5a6480);_0x4add6b[_0x34bf9c](_0x578843[_0xc5c3('0x6f')],_0x578843[_0xc5c3('0x65')][_0xc5c3('0x70')],_0x578843['value'][_0xc5c3('0x2c')]);}break;case _0xc5c3('0x71'):var _0x18adc4=_0x5a6480[_0xc5c3('0x65')][_0xc5c3('0x33')](',')['map'](function(_0xf54924){return Number(_0xf54924);});_0x18adc4[_0xc5c3('0x34')](function(_0xf40f27){_0x4be969['or'](_0xc5c3('0x72'),'%,'+_0xf40f27+',%');});_0x1311de=_[_0xc5c3('0x73')](_0x1311de,_0x18adc4);break;case _0xc5c3('0x74'):if(_0x5a6480[_0xc5c3('0x68')]==='$substring'){_0x4add6b[_0x34bf9c](_0xc5c3('0x75'),'%'+_0x5a6480[_0xc5c3('0x65')]+'%',null);}else{_0x110105=_[_0xc5c3('0x63')](_0x10e27d,[_0xc5c3('0x2e'),_0xc5c3('0x76')]);_0x5a6480[_0xc5c3('0x4c')]=_0xc5c3('0x76');_0x578843=as['buildExpression'](_0x11a6c4,_0x110105['type'],_0x5a6480);_0x4add6b[_0x34bf9c](_0x578843[_0xc5c3('0x6f')],_0x578843[_0xc5c3('0x65')][_0xc5c3('0x70')],_0x578843[_0xc5c3('0x65')][_0xc5c3('0x2c')]);}break;case _0xc5c3('0x77'):_0x578843=as[_0xc5c3('0x6e')]('me',null,_0x5a6480);_0x4add6b[_0x34bf9c](_0x578843[_0xc5c3('0x6f')],_0x578843[_0xc5c3('0x65')]['start'],_0x578843[_0xc5c3('0x65')][_0xc5c3('0x2c')]);break;}}else{var _0x578843=as['buildExpression'](_0x11a6c4,_0x110105[_0xc5c3('0x3e')],_0x5a6480);_0x4add6b[_0x34bf9c](_0x578843[_0xc5c3('0x6f')],_0x578843[_0xc5c3('0x65')][_0xc5c3('0x70')],_0x578843[_0xc5c3('0x65')][_0xc5c3('0x2c')]);}}}else{var _0x34f284=_(_0x49523a[_0xc5c3('0x40')])[_0xc5c3('0x41')]()['map'](function(_0x429fcb){return _[_0xc5c3('0x78')](_0x10e27d,[_0xc5c3('0x2e'),_0x429fcb])?_0x429fcb:undefined;})[_0xc5c3('0x79')]()[_0xc5c3('0x65')]();if(!_[_0xc5c3('0x7a')](_0x34f284)){_0x34f284[_0xc5c3('0x34')](function(_0x114c90){if(_0x114c90===_0xc5c3('0x7b')){_0x3a901f[_0xc5c3('0x4a')](_0xc5c3('0x7c'),[]['concat'](_0x49523a['query'][_0x114c90]));}else if(_0x114c90===_0xc5c3('0x7d')){var _0xcf6fc0=JSON[_0xc5c3('0x7e')](_0x49523a[_0xc5c3('0x40')][_0x114c90])[_0xc5c3('0x7f')];var _0x2da018=JSON[_0xc5c3('0x7e')](_0x49523a[_0xc5c3('0x40')][_0x114c90])[_0xc5c3('0x80')];_0x3a901f[_0xc5c3('0x4a')](_0xc5c3('0x81'),_0xcf6fc0,_0x2da018);}else{if(_0x49523a[_0xc5c3('0x40')][_0x114c90]==='null'){_0x3a901f[_0xc5c3('0x4a')]('i.'+_0x114c90+'\x20IS\x20NULL');}else{_0x3a901f[_0xc5c3('0x4a')]('i.'+_0x114c90+_0xc5c3('0x82'),_0x49523a[_0xc5c3('0x40')][_0x114c90]);}}});}if(_0x49523a[_0xc5c3('0x40')][_0xc5c3('0x83')]){if(_0x49523a[_0xc5c3('0x40')][_0xc5c3('0x83')]==0x1){_0x3a901f[_0xc5c3('0x66')]('`unreadMessages`\x20=\x200');}else{_0x3a901f[_0xc5c3('0x66')](_0xc5c3('0x84'));}}if(_0x49523a[_0xc5c3('0x40')]['tag']){_0x1311de=_['isArray'](_0x49523a[_0xc5c3('0x40')]['tag'])?_0x49523a[_0xc5c3('0x40')][_0xc5c3('0x85')]:new Array(_0x49523a[_0xc5c3('0x40')]['tag']);_0x1311de[_0xc5c3('0x34')](function(_0x5bc049){_0x4be969['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5bc049+',%');});}if(_0x49523a[_0xc5c3('0x40')][_0xc5c3('0x86')]){var _0x5c9862=_0x49523a[_0xc5c3('0x40')][_0xc5c3('0x86')]['replace']('\x5c','\x5c\x5c')[_0xc5c3('0x87')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x5c9862)){_0x4add6b['or'](_0xc5c3('0x88'),_0x5c9862+'%');}else if(qs[_0xc5c3('0x89')](_0x5c9862)){_0x4add6b['or'](_0xc5c3('0x8a'),_0x5c9862+'%');}else{_0x4add6b['or'](_0xc5c3('0x8b'),qs[_0xc5c3('0x6b')](_0x5c9862))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x5c9862));}}}_0x3a901f['where'](_0x4add6b);_0x3a901f[_0xc5c3('0x8c')](_0xc5c3('0x8d'));var _0xa78c7e={'type':db['Sequelize'][_0xc5c3('0x8e')][_0xc5c3('0x8f')],'raw':!![]};var _0x5dcd4d=_0x3a901f[_0xc5c3('0x90')]();_0x5dcd4d['field'](_0xc5c3('0x8d'));_0x5dcd4d[_0xc5c3('0x4c')](_0xc5c3('0x91'),_0xc5c3('0x64'));if(_0x541bbd['order']){_0x541bbd[_0xc5c3('0x49')][_0xc5c3('0x34')](function(_0x370a03){var _0x2bd0ac=_0x370a03[0x0]===_0xc5c3('0x92')?_0x370a03[0x0]:'i.'+_0x370a03[0x0];_0x3a901f[_0xc5c3('0x49')](_0x2bd0ac,_0x370a03[0x1]===_0xc5c3('0x93')?![]:!![]);});}if(!_[_0xc5c3('0x7a')](_0x1311de)){_0x3a901f['having'](_0x4be969);_0x5dcd4d['where']('t.id\x20IN\x20?',_0x1311de);}BPromise['resolve']()[_0xc5c3('0x2a')](function(){if(!_0x1b906){if(_0x49523a[_0xc5c3('0x40')][_0xc5c3('0x7b')])return;_0x5dcd4d[_0xc5c3('0x4a')](_0xc5c3('0x94'));_0x3a901f[_0xc5c3('0x4a')](_0xc5c3('0x94'));return;}if(_0x49523a[_0xc5c3('0x95')][_0xc5c3('0x96')]!=='agent')return;return _0x49523a[_0xc5c3('0x95')][_0xc5c3('0x97')]({'attributes':['id'],'raw':!![]})[_0xc5c3('0x2a')](function(_0x1efa1d){if(_[_0xc5c3('0x7a')](_0x1efa1d)){_0x5dcd4d[_0xc5c3('0x4a')](_0xc5c3('0x98'));_0x3a901f['where']('i.MailAccountId\x20IS\x20NULL');}else{_0x5dcd4d[_0xc5c3('0x4a')](_0xc5c3('0x7c'),_[_0xc5c3('0x30')](_0x1efa1d,'id'));_0x3a901f[_0xc5c3('0x4a')](_0xc5c3('0x7c'),_[_0xc5c3('0x30')](_0x1efa1d,'id'));}});})[_0xc5c3('0x2a')](function(){if(_0x49523a[_0xc5c3('0x95')][_0xc5c3('0x96')]===_0xc5c3('0x99')&&!_0x1b906&&!_0x49523a[_0xc5c3('0x40')]['MailAccountId'])return[];return db[_0xc5c3('0x9a')][_0xc5c3('0x40')](_0x5dcd4d[_0xc5c3('0x9b')](),_0xa78c7e);})[_0xc5c3('0x2a')](function(_0x12df92){_0x11c029['count']=_0x12df92[_0xc5c3('0x46')];if(_0x11c029[_0xc5c3('0x21')]===0x0)return[];return db[_0xc5c3('0x9a')][_0xc5c3('0x40')](_0x30179f['toString'](),_0xa78c7e)[_0xc5c3('0x2a')](function(_0x2a59eb){_0x11b997=_[_0xc5c3('0x9c')](_0x2a59eb,'id');_0xa78c7e=_['merge'](_0xa78c7e,{'model':db[_0xc5c3('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x49523a[_0xc5c3('0x40')][_0xc5c3('0x45')]){_0x541bbd[_0xc5c3('0x44')][_0xc5c3('0x34')](function(_0x2eb475){_0x3a901f[_0xc5c3('0x4c')]('i.'+_0x2eb475);});}else{_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0x91'),_0xc5c3('0x64'));_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0x9d'),_0xc5c3('0x9e'));_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0x9f'),_0xc5c3('0xa0'));_0x3a901f['field'](_0xc5c3('0xa1'),_0xc5c3('0x92'));_0x3a901f['field'](_0xc5c3('0x8d'));_0x3a901f['field'](_0xc5c3('0xa2'));_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0xa3'));_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0xa4'));_0x3a901f['field'](_0xc5c3('0xa5'));_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0xa6'));_0x3a901f['field']('i.lastMsgAt');_0x3a901f[_0xc5c3('0x4c')]('i.lastMsgDirection');_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0xa7'));_0x3a901f[_0xc5c3('0x4c')]('i.disposition');_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0xa8'));_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0xa9'));_0x3a901f[_0xc5c3('0x4c')]('i.substatus');_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0xaa'));_0x3a901f[_0xc5c3('0x4c')]('i.ContactId');_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0xab'));_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0xac'));_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0xad'),_0xc5c3('0xae'));_0x3a901f[_0xc5c3('0x4c')]('c.lastName',_0xc5c3('0xaf'));_0x3a901f['field'](_0xc5c3('0xb0'),_0xc5c3('0xb1'));_0x3a901f['field'](_0xc5c3('0xb2'),_0xc5c3('0xb3'));_0x3a901f['field'](_0xc5c3('0xb4'),_0xc5c3('0xb5'));_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0xb6'),_0xc5c3('0xb7'));_0x3a901f['field'](_0xc5c3('0xb8'),_0xc5c3('0xb9'));_0x3a901f[_0xc5c3('0x4c')](_0xc5c3('0xba'),_0xc5c3('0xbb'));_0x3a901f[_0xc5c3('0x4c')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xc5c3('0x32'));}if(_0x541bbd[_0xc5c3('0x23')])_0x3a901f['limit'](_0x541bbd['limit']);if(_0x541bbd[_0xc5c3('0x22')])_0x3a901f[_0xc5c3('0x22')](_0x541bbd['offset']);return db[_0xc5c3('0x9a')][_0xc5c3('0x40')](_0x3a901f[_0xc5c3('0x9b')](),_0xa78c7e);})['then'](function(_0xe29de8){_0x3e658b[_0xc5c3('0x4a')](_0xc5c3('0xbc'),_[_0xc5c3('0x30')](_0xe29de8,'id'));return db[_0xc5c3('0x9a')][_0xc5c3('0x40')](_0x3e658b[_0xc5c3('0x9b')](),_0xa78c7e)[_0xc5c3('0x2a')](function(_0x413e50){var _0x13798=_[_0xc5c3('0xbd')](_0x413e50,_0xc5c3('0xbe'));var _0x4d1f82=[];return db['Setting'][_0xc5c3('0x37')]({'attributes':['enableEmailPreview'],'raw':!![]})['then'](function(_0x433f74){var _0x527db5=_0x433f74[_0xc5c3('0xbf')];_0xe29de8[_0xc5c3('0x34')](function(_0x589064){_0x4d1f82['push'](updateMailInteraction(_0x589064,_0x11b997,_0x13798,_0x527db5));});return BPromise[_0xc5c3('0xc0')](_0x4d1f82);});});});})['then'](function(_0x50409f){_0x11c029[_0xc5c3('0xc1')]=_0x50409f;return _0x11c029;})[_0xc5c3('0x2a')](respondWithFilteredResult(_0x361b04,_0x541bbd))[_0xc5c3('0x3b')](handleError(_0x361b04,null));};exports[_0xc5c3('0xc2')]=function(_0x1fa1fb,_0x111551){var _0x116965={'raw':![],'where':{'id':_0x1fa1fb[_0xc5c3('0xc3')]['id']}},_0xa4672a={};_0xa4672a['model']=_['keys'](db[_0xc5c3('0x36')][_0xc5c3('0x3d')]);_0xa4672a[_0xc5c3('0x40')]=_[_0xc5c3('0x41')](_0x1fa1fb[_0xc5c3('0x40')]);_0xa4672a['filters']=_[_0xc5c3('0x42')](_0xa4672a['model'],_0xa4672a[_0xc5c3('0x40')]);_0x116965[_0xc5c3('0x44')]=_[_0xc5c3('0x42')](_0xa4672a[_0xc5c3('0x43')],qs[_0xc5c3('0x45')](_0x1fa1fb[_0xc5c3('0x40')][_0xc5c3('0x45')]));_0x116965[_0xc5c3('0x44')]=_0x116965['attributes']['length']?_0x116965['attributes']:_0xa4672a[_0xc5c3('0x43')];if(_0x1fa1fb[_0xc5c3('0x40')][_0xc5c3('0xc4')]){_0x116965[_0xc5c3('0xc5')]=[{'all':!![]}];}_0x116965=_[_0xc5c3('0xc6')]({},_0x116965,_0x1fa1fb[_0xc5c3('0xc7')]);return db[_0xc5c3('0x36')][_0xc5c3('0x63')](_0x116965)[_0xc5c3('0x2a')](handleEntityNotFound(_0x111551,null))[_0xc5c3('0x2a')](respondWithResult(_0x111551,null))['catch'](handleError(_0x111551,null));};exports[_0xc5c3('0xc8')]=function(_0x463900,_0x1db1c4){return db[_0xc5c3('0x36')][_0xc5c3('0xc8')](_0x463900['body'],{})[_0xc5c3('0x2a')](respondWithResult(_0x1db1c4,0xc9))[_0xc5c3('0x3b')](handleError(_0x1db1c4,null));};exports[_0xc5c3('0x29')]=function(_0x4ee116,_0x263c51){if(_0x4ee116[_0xc5c3('0xc9')]['id']){delete _0x4ee116[_0xc5c3('0xc9')]['id'];}return db[_0xc5c3('0x36')][_0xc5c3('0x63')]({'where':{'id':_0x4ee116[_0xc5c3('0xc3')]['id']}})[_0xc5c3('0x2a')](handleEntityNotFound(_0x263c51,null))['then'](saveUpdates(_0x4ee116[_0xc5c3('0xc9')],null))[_0xc5c3('0x2a')](respondWithResult(_0x263c51,null))['catch'](handleError(_0x263c51,null));};exports[_0xc5c3('0x2b')]=function(_0x2dc6ca,_0x96f5db){return db[_0xc5c3('0x36')]['find']({'where':{'id':_0x2dc6ca[_0xc5c3('0xc3')]['id']}})[_0xc5c3('0x2a')](handleEntityNotFound(_0x96f5db,null))[_0xc5c3('0x2a')](removeEntity(_0x96f5db,null))[_0xc5c3('0x3b')](handleError(_0x96f5db,null));};exports[_0xc5c3('0xca')]=function(_0x2b49da,_0x47bd08){return db[_0xc5c3('0x36')][_0xc5c3('0xca')]()['then'](respondWithResult(_0x47bd08,null))[_0xc5c3('0x3b')](handleError(_0x47bd08,null));};exports['addMessage']=function(_0xde9430,_0x40399c,_0x43d0a4){return db[_0xc5c3('0xcb')]['find']({'where':{'id':_0xde9430['params']['id']}})['then'](handleEntityNotFound(_0x40399c,null))[_0xc5c3('0x2a')](function(_0x2d6dd0){if(_0x2d6dd0){return _0x2d6dd0[_0xc5c3('0xcc')](_0xde9430['body'][_0xc5c3('0xcd')],_['omit'](_0xde9430[_0xc5c3('0xc9')],[_0xc5c3('0xcd'),'id'])||{});}})[_0xc5c3('0x2a')](respondWithResult(_0x40399c,null))[_0xc5c3('0x3b')](handleError(_0x40399c,null));};exports[_0xc5c3('0xce')]=function(_0x247496,_0x4bdb59,_0x3f468e){var _0x423d82={'raw':![],'where':{}};var _0x27d2df={};var _0x5db455={'count':0x0,'rows':[]};return db[_0xc5c3('0x36')]['findOne']({'where':{'id':_0x247496[_0xc5c3('0xc3')]['id']}})[_0xc5c3('0x2a')](handleEntityNotFound(_0x4bdb59,null))[_0xc5c3('0x2a')](function(_0x21941a){if(_0x21941a){_0x27d2df['model']=_[_0xc5c3('0x41')](db[_0xc5c3('0xcb')][_0xc5c3('0x3d')]);_0x27d2df['query']=_['keys'](_0x247496[_0xc5c3('0x40')]);_0x27d2df['filters']=_[_0xc5c3('0x42')](_0x27d2df[_0xc5c3('0x43')],_0x27d2df['query']);_0x423d82[_0xc5c3('0x44')]=_[_0xc5c3('0x42')](_0x27d2df['model'],qs['fields'](_0x247496[_0xc5c3('0x40')][_0xc5c3('0x45')]));_0x423d82[_0xc5c3('0x44')]=_0x423d82[_0xc5c3('0x44')]['length']?_0x423d82[_0xc5c3('0x44')]:_0x27d2df[_0xc5c3('0x43')];if(!_0x247496[_0xc5c3('0x40')]['hasOwnProperty'](_0xc5c3('0x48'))){_0x423d82[_0xc5c3('0x23')]=qs['limit'](_0x247496[_0xc5c3('0x40')][_0xc5c3('0x23')]);_0x423d82[_0xc5c3('0x22')]=qs[_0xc5c3('0x22')](_0x247496[_0xc5c3('0x40')]['offset']);}_0x423d82[_0xc5c3('0x49')]=qs['sort'](_0x247496['query']['sort']);_0x423d82[_0xc5c3('0x4a')]=qs['filters'](_[_0xc5c3('0xcf')](_0x247496['query'],_0x27d2df[_0xc5c3('0x4b')]));_0x423d82['where'][_0xc5c3('0xbe')]=_0x21941a['id'];if(_0x247496[_0xc5c3('0x40')][_0xc5c3('0x86')]){_0x423d82[_0xc5c3('0x4a')]=_[_0xc5c3('0xc6')](_0x423d82['where'],{'$or':_[_0xc5c3('0x30')](_0x423d82['attributes'],function(_0x4d626c){var _0x5f1e2a={};_0x5f1e2a[_0x4d626c]={'$like':'%'+_0x247496[_0xc5c3('0x40')][_0xc5c3('0x86')]+'%'};return _0x5f1e2a;})});}if(_0x247496[_0xc5c3('0x40')][_0xc5c3('0x7f')]){var _0x4106d2=_0x247496[_0xc5c3('0x40')][_0xc5c3('0x7f')][_0xc5c3('0x33')](',');var _0x17561f={};_0x17561f[_0x4106d2[0x0]]={'$gte':moment(_0x4106d2[0x1])[_0xc5c3('0xd0')](_0xc5c3('0xd1'))};_0x423d82['where']=_[_0xc5c3('0xc6')](_0x423d82[_0xc5c3('0x4a')],_0x17561f);}_0x423d82=_[_0xc5c3('0xc6')]({},_0x423d82,_0x247496[_0xc5c3('0xc7')]);return db[_0xc5c3('0xcb')][_0xc5c3('0x21')]({'where':_0x423d82[_0xc5c3('0x4a')]})['then'](function(_0x1a5285){_0x5db455[_0xc5c3('0x21')]=_0x1a5285;if(_0x247496['query']['includeAll']){_0x423d82[_0xc5c3('0xc5')]=[{'all':!![]}];}return db[_0xc5c3('0xcb')][_0xc5c3('0xd2')](_0x423d82);})['then'](function(_0x2cefe2){if(_0x247496[_0xc5c3('0x40')][_0xc5c3('0xd3')]===_0xc5c3('0xd4')){for(var _0x370c8c=0x0;_0x370c8c<_0x2cefe2[_0xc5c3('0x46')];_0x370c8c++){_0x2cefe2[_0x370c8c][_0xc5c3('0xc9')]=juice(_0x2cefe2[_0x370c8c][_0xc5c3('0xc9')]);}}_0x5db455[_0xc5c3('0xc1')]=_0x2cefe2;return _0x5db455;});}})[_0xc5c3('0x2a')](respondWithFilteredResult(_0x4bdb59,_0x423d82))[_0xc5c3('0x3b')](handleError(_0x4bdb59,null));};exports['addTags']=function(_0x457169,_0x1daaeb,_0x90b891){return db[_0xc5c3('0x36')][_0xc5c3('0x63')]({'where':{'id':_0x457169[_0xc5c3('0xc3')]['id']}})[_0xc5c3('0x2a')](handleEntityNotFound(_0x1daaeb,null))[_0xc5c3('0x2a')](function(_0x3091bf){if(_0x3091bf){return _0x3091bf[_0xc5c3('0xd5')](_0x457169['body']['ids'],_[_0xc5c3('0xd6')](_0x457169[_0xc5c3('0xc9')],[_0xc5c3('0xcd'),'id'])||{})[_0xc5c3('0xd7')](function(){return db[_0xc5c3('0x71')][_0xc5c3('0xd2')]({'attributes':['id',_0xc5c3('0x2e'),_0xc5c3('0x4d')],'where':{'id':_0x457169['body']['ids']}});})['then'](function(_0x1d2d28){socket[_0xc5c3('0xd8')](_0xc5c3('0xd9'),{'id':Number(_0x457169[_0xc5c3('0xc3')]['id']),'tags':_0x1d2d28||[]});return{'id':Number(_0x457169['params']['id']),'tags':_0x1d2d28||[]};});}})[_0xc5c3('0x2a')](respondWithResult(_0x1daaeb,null))[_0xc5c3('0x3b')](handleError(_0x1daaeb,null));};exports[_0xc5c3('0xda')]=function(_0x4c019e,_0x1cf503,_0x464c69){return db[_0xc5c3('0x36')]['find']({'where':{'id':_0x4c019e[_0xc5c3('0xc3')]['id']}})['then'](handleEntityNotFound(_0x1cf503,null))[_0xc5c3('0x2a')](function(_0x47e898){if(_0x47e898){return _0x47e898[_0xc5c3('0xda')](_0x4c019e[_0xc5c3('0x40')][_0xc5c3('0xcd')]);}})[_0xc5c3('0x2a')](respondWithStatusCode(_0x1cf503,null))[_0xc5c3('0x3b')](handleError(_0x1cf503,null));};exports[_0xc5c3('0xdb')]=function(_0x5e15d8,_0x429d7d){var _0x19bce4=moment()[_0xc5c3('0xdc')]()[_0xc5c3('0x9b')]();var _0x5672fc=path[_0xc5c3('0xdd')](config[_0xc5c3('0xde')],_0xc5c3('0xdf'),_0xc5c3('0xe0'),_0xc5c3('0xe1'));var _0x5b737b=path[_0xc5c3('0xdd')](config[_0xc5c3('0xde')],_0xc5c3('0xdf'),_0xc5c3('0xe0'),'attachments');var _0xbd0a3=path[_0xc5c3('0xdd')](_0x5672fc,_0x19bce4);var _0x514e7f=util['format'](_0xc5c3('0xe2'),_0x5e15d8[_0xc5c3('0xc3')]['id'],_0x19bce4);var _0x2ca239=path[_0xc5c3('0xdd')](_0x5672fc,_0x514e7f);var _0x21d793=[];if(_0x5e15d8[_0xc5c3('0x40')]['attachments']){_0x21d793['push']({'model':db[_0xc5c3('0xe3')],'as':_0xc5c3('0xe4'),'raw':!![]});}var _0x2cc211=[{'model':db[_0xc5c3('0xcb')],'as':_0xc5c3('0xe5'),'attributes':['id','body',_0xc5c3('0x4e'),'to','cc',_0xc5c3('0xe6'),_0xc5c3('0xe7'),_0xc5c3('0x7d')],'where':{'secret':![]},'order':qs[_0xc5c3('0xe8')]('id'),'include':_0x21d793}];return db[_0xc5c3('0x36')]['find']({'where':{'id':_0x5e15d8[_0xc5c3('0xc3')]['id']},'include':_0x2cc211})['then'](handleEntityNotFound(_0x429d7d,null))['then'](function(_0x3e0c0f){if(_0x3e0c0f&&_0x3e0c0f['Messages']){var _0xe7c279=_0x3e0c0f[_0xc5c3('0xe9')]({'plain':!![]});fs[_0xc5c3('0xea')](_0xbd0a3);return BPromise[_0xc5c3('0xeb')](_0xe7c279[_0xc5c3('0xe5')],function(_0x571069,_0x1debce){var _0x2bad2b={'from':_0x571069[_0xc5c3('0x4e')],'to':_0x571069['to'],'subject':_0x571069['subject'],'html':_0x571069[_0xc5c3('0xc9')],'headers':{'Date':moment(_0x571069[_0xc5c3('0x7d')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x571069['cc']){_0x2bad2b[_0xc5c3('0xec')]['Cc']=_0x571069['cc'];}if(_0x571069[_0xc5c3('0xe6')]){_0x2bad2b[_0xc5c3('0xec')][_0xc5c3('0xed')]=_0x571069[_0xc5c3('0xe6')];}return new BPromise(function(_0x242d2c,_0x4e7f36){if(_0x571069[_0xc5c3('0xe4')]){for(var _0x1b9194=0x0;_0x1b9194<_0x571069['Attachments'][_0xc5c3('0x46')];_0x1b9194++){var _0x291bcd=_0x571069['Attachments'][_0x1b9194];var _0x3403bd=path[_0xc5c3('0xdd')](_0x5b737b,_0x291bcd[_0xc5c3('0xee')]);if(fs[_0xc5c3('0xef')](_0x3403bd)){_0x2bad2b['attachments'][_0xc5c3('0x35')]({'name':_0x291bcd[_0xc5c3('0x2e')],'contentType':_0x291bcd[_0xc5c3('0x3e')],'data':fs[_0xc5c3('0xf0')](_0x3403bd)});}}}emlformat['build'](_0x2bad2b,function(_0x40f04b,_0xeb98c9){if(_0x40f04b)return _0x4e7f36(_0x40f04b);fs['writeFileSync'](path[_0xc5c3('0xdd')](_0xbd0a3,util['format'](_0xc5c3('0xf1'),_0x1debce)),_0xeb98c9);return _0x242d2c(_0xeb98c9);});});})[_0xc5c3('0x2a')](function(){return new BPromise(function(_0x155df0,_0x29f72c){zipdir(_0xbd0a3,{'saveTo':_0x2ca239},function(_0xcb0a62,_0x2bdc13){if(_0xcb0a62)return _0x29f72c(_0xcb0a62);return _0x155df0(_0x2bdc13);});})[_0xc5c3('0x2a')](function(){return new BPromise(function(_0x57e84f,_0x35b5a2){rimraf(_0xbd0a3,function(_0x1e23a9){if(_0x1e23a9)_0x35b5a2(_0x1e23a9);return _0x57e84f();});});})['then'](function(){return _0x429d7d[_0xc5c3('0xdb')](_0x2ca239,_0x514e7f,function(_0x457533){if(_0x457533){console[_0xc5c3('0xf2')](_0xc5c3('0xf3'),_0x457533);}else{fs[_0xc5c3('0xf4')](_0x2ca239);}});});});}else{return _0x429d7d[_0xc5c3('0x1e')](0xc8);}})[_0xc5c3('0x3b')](handleError(_0x429d7d,null));}; \ No newline at end of file +var _0x3f8c=['setTags','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','get','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','bcc','basename','readFileSync','build','message%d.eml','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','html-to-text','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','apply','reject','save','then','destroy','error','stack','name','send','Users','map','TagIds','Tags','split','forEach','push','MailInteraction','findOne','lastMsgBody','lastMsgText','trimStart','catch','index','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','select','field','color','u.fullname','ui.MailInteractionId','from','left_join','users','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','mail_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','conditions','find','unreadMessages','having','`\x20=\x200','operator','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','plainBody','keys','isEmpty','i.MailAccountId\x20IN\x20?','createdAt','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','user','i.MailAccountId\x20IS\x20NULL','agent','sequelize','toString','merge','a.key','Account.key','i.createdAt','i.updatedAt','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.substatus','i.to','i.ContactId','i.MailAccountId','c.firstName','c.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','MailInteractionId','Setting','enableEmailPreview','params','includeAll','include','options','create','body','update','describe','MailMessage','addMessage','ids','omit','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','rows'];(function(_0x1863fb,_0x37f99c){var _0x12da5d=function(_0x3782ab){while(--_0x3782ab){_0x1863fb['push'](_0x1863fb['shift']());}};_0x12da5d(++_0x37f99c);}(_0x3f8c,0x104));var _0xc3f8=function(_0x43c61a,_0x545633){_0x43c61a=_0x43c61a-0x0;var _0x40ae81=_0x3f8c[_0x43c61a];return _0x40ae81;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xc3f8('0x0'));var zipdir=require(_0xc3f8('0x1'));var jsonpatch=require(_0xc3f8('0x2'));var rp=require(_0xc3f8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc3f8('0x4'));var csv=require(_0xc3f8('0x5'));var ejs=require(_0xc3f8('0x6'));var fs=require('fs');var _=require(_0xc3f8('0x7'));var squel=require(_0xc3f8('0x8'));var crypto=require(_0xc3f8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc3f8('0xa'));var toCsv=require(_0xc3f8('0x5'));var querystring=require(_0xc3f8('0xb'));var Papa=require(_0xc3f8('0xc'));var htmlToText=require(_0xc3f8('0xd'));var juice=require(_0xc3f8('0xe'));var Redis=require(_0xc3f8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc3f8('0x10'));var as=require(_0xc3f8('0x11'));var hardwareService=require(_0xc3f8('0x12'));var logger=require(_0xc3f8('0x13'))('api');var utils=require(_0xc3f8('0x14'));var config=require(_0xc3f8('0x15'));var licenseUtil=require(_0xc3f8('0x16'));var db=require(_0xc3f8('0x17'))['db'];config['redis']=_[_0xc3f8('0x18')](config[_0xc3f8('0x19')],{'host':_0xc3f8('0x1a'),'port':0x18eb});var socket=require(_0xc3f8('0x1b'))(new Redis(config[_0xc3f8('0x19')]));require(_0xc3f8('0x1c'))[_0xc3f8('0x1d')](socket);function respondWithStatusCode(_0x4731cd,_0x12b141){_0x12b141=_0x12b141||0xcc;return function(_0x2fd8e8){if(_0x2fd8e8){return _0x4731cd[_0xc3f8('0x1e')](_0x12b141);}return _0x4731cd[_0xc3f8('0x1f')](_0x12b141)[_0xc3f8('0x20')]();};}function respondWithResult(_0x58f636,_0x14b3ed){_0x14b3ed=_0x14b3ed||0xc8;return function(_0x4ccca7){if(_0x4ccca7){return _0x58f636['status'](_0x14b3ed)[_0xc3f8('0x21')](_0x4ccca7);}};}function respondWithFilteredResult(_0x2e7c0f,_0x35500f){return function(_0xb4ab67){if(_0xb4ab67){var _0x47a185=_0xb4ab67[_0xc3f8('0x22')],_0x3e75a4=_0x35500f['offset'],_0x1db809=_0x35500f[_0xc3f8('0x23')]+_0x35500f[_0xc3f8('0x24')],_0x5df6f9;if(_0x1db809>=_0x47a185){_0x1db809=_0x47a185;_0x5df6f9=0xc8;}else{_0x5df6f9=0xce;}_0x2e7c0f[_0xc3f8('0x1f')](_0x5df6f9);return _0x2e7c0f['set']('Content-Range',_0x3e75a4+'-'+_0x1db809+'/'+_0x47a185)[_0xc3f8('0x21')](_0xb4ab67);}return null;};}function patchUpdates(_0x2a7096){return function(_0x1436d7){try{jsonpatch[_0xc3f8('0x25')](_0x1436d7,_0x2a7096,!![]);}catch(_0x6522e9){return BPromise[_0xc3f8('0x26')](_0x6522e9);}return _0x1436d7[_0xc3f8('0x27')]();};}function saveUpdates(_0x42a155,_0x49aeea){return function(_0x571f92){if(_0x571f92){return _0x571f92['update'](_0x42a155)[_0xc3f8('0x28')](function(_0x5e1d14){return _0x5e1d14;});}return null;};}function removeEntity(_0x11335,_0x3f196d){return function(_0x5c13fc){if(_0x5c13fc){return _0x5c13fc[_0xc3f8('0x29')]()[_0xc3f8('0x28')](function(){_0x11335[_0xc3f8('0x1f')](0xcc)[_0xc3f8('0x20')]();});}};}function handleEntityNotFound(_0x25088f,_0x9d43b4){return function(_0xf1d460){if(!_0xf1d460){_0x25088f[_0xc3f8('0x1e')](0x194);}return _0xf1d460;};}function handleError(_0x21b002,_0xbea3b8){_0xbea3b8=_0xbea3b8||0x1f4;return function(_0x22c8e6){logger[_0xc3f8('0x2a')](_0x22c8e6[_0xc3f8('0x2b')]);if(_0x22c8e6[_0xc3f8('0x2c')]){delete _0x22c8e6['name'];}_0x21b002[_0xc3f8('0x1f')](_0xbea3b8)[_0xc3f8('0x2d')](_0x22c8e6);};}function getInteractionUsers(_0x218029,_0x5bf6e2){return new BPromise(function(_0x151bba,_0x4d39a0){try{if(_0x5bf6e2[_0x218029['id']]){_0x218029[_0xc3f8('0x2e')]=_[_0xc3f8('0x2f')](_0x5bf6e2[_0x218029['id']],function(_0x47ab53){return{'id':_0x47ab53['id'],'fullname':_0x47ab53['fullname']};});}}catch(_0x21a225){_0x4d39a0(_0x21a225);}_0x151bba(_0x218029);});}function getInteractionTags(_0x25df65,_0xd32b09){return new BPromise(function(_0x3704e5,_0x3713c5){try{if(_0x25df65[_0xc3f8('0x30')]){_0x25df65[_0xc3f8('0x31')]=[];_0x25df65[_0xc3f8('0x30')][_0xc3f8('0x32')](',')[_0xc3f8('0x33')](function(_0x52e543){_0x25df65[_0xc3f8('0x31')][_0xc3f8('0x34')](_0xd32b09[_0x52e543]);});}delete _0x25df65[_0xc3f8('0x30')];}catch(_0x3e07af){_0x3713c5(_0x3e07af);}_0x3704e5(_0x25df65);});}function getLastMessageText(_0x31e86){return new BPromise(function(_0x579056,_0x47c4ef){return db[_0xc3f8('0x35')][_0xc3f8('0x36')]({'where':{'id':_0x31e86['id']},'attributes':[_0xc3f8('0x37'),_0xc3f8('0x38')],'raw':!![]})[_0xc3f8('0x28')](function(_0x4e51ac){if(!_0x4e51ac[_0xc3f8('0x38')]){_0x31e86[_0xc3f8('0x38')]=_[_0xc3f8('0x39')](htmlToText['fromString'](_0x4e51ac[_0xc3f8('0x37')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x31e86[_0xc3f8('0x38')]=_0x4e51ac[_0xc3f8('0x38')];}_0x579056(_0x31e86);})['catch'](function(_0x21a725){_0x47c4ef(_0x21a725);});});}function updateMailInteraction(_0x37ae52,_0x560553,_0x2bf1c0,_0x84d5d2){return new BPromise(function(_0x3c0810,_0x1cda2c){return getInteractionUsers(_0x37ae52,_0x2bf1c0)[_0xc3f8('0x28')](function(_0x1fddc7){return getInteractionTags(_0x1fddc7,_0x560553);})['then'](function(_0x285307){if(_0x84d5d2){_0x3c0810(getLastMessageText(_0x285307));}else{_0x3c0810(_0x285307);}})[_0xc3f8('0x3a')](function(_0x2d3129){_0x1cda2c(_0x2d3129);});});}exports[_0xc3f8('0x3b')]=function(_0x17aff0,_0x502293){var _0x3dede2={},_0x4451a2={},_0xaa4c98={'count':0x0,'rows':[]};var _0x4d430c=_[_0xc3f8('0x2f')](db[_0xc3f8('0x35')][_0xc3f8('0x3c')],function(_0x2d4167){return{'name':_0x2d4167['fieldName'],'type':_0x2d4167[_0xc3f8('0x3d')][_0xc3f8('0x3e')]};});_0x4451a2[_0xc3f8('0x3f')]=_[_0xc3f8('0x2f')](_0x4d430c,'name');_0x4451a2[_0xc3f8('0x40')]=_['keys'](_0x17aff0['query']);_0x4451a2[_0xc3f8('0x41')]=_[_0xc3f8('0x42')](_0x4451a2[_0xc3f8('0x3f')],_0x4451a2[_0xc3f8('0x40')]);_0x3dede2['attributes']=_['intersection'](_0x4451a2[_0xc3f8('0x3f')],qs[_0xc3f8('0x43')](_0x17aff0[_0xc3f8('0x40')][_0xc3f8('0x43')]));_0x3dede2[_0xc3f8('0x44')]=_0x3dede2[_0xc3f8('0x44')][_0xc3f8('0x45')]?_0x3dede2[_0xc3f8('0x44')]:_0x4451a2[_0xc3f8('0x3f')];if(!_0x17aff0[_0xc3f8('0x40')][_0xc3f8('0x46')]('nolimit')){_0x3dede2[_0xc3f8('0x24')]=qs[_0xc3f8('0x24')](_0x17aff0['query'][_0xc3f8('0x24')]);_0x3dede2[_0xc3f8('0x23')]=qs['offset'](_0x17aff0[_0xc3f8('0x40')][_0xc3f8('0x23')]);}_0x3dede2[_0xc3f8('0x47')]=qs[_0xc3f8('0x48')](_0x17aff0[_0xc3f8('0x40')][_0xc3f8('0x48')]);_0x3dede2[_0xc3f8('0x49')]=qs[_0xc3f8('0x41')](_[_0xc3f8('0x4a')](_0x17aff0[_0xc3f8('0x40')],_0x4451a2[_0xc3f8('0x41')]),_0x4d430c);var _0x5129bb=[];var _0x35ce2f=squel[_0xc3f8('0x4b')]()['field']('id')[_0xc3f8('0x4c')](_0xc3f8('0x2c'))[_0xc3f8('0x4c')](_0xc3f8('0x4d'))['from']('tools_tags');var _0x35ef68=squel[_0xc3f8('0x4b')]()[_0xc3f8('0x4c')]('u.id')[_0xc3f8('0x4c')](_0xc3f8('0x4e'))[_0xc3f8('0x4c')](_0xc3f8('0x4f'))[_0xc3f8('0x50')]('user_has_mail_interactions','ui')[_0xc3f8('0x51')](_0xc3f8('0x52'),'u','u.id\x20=\x20ui.UserId');var _0x1becae=squel[_0xc3f8('0x4b')]()[_0xc3f8('0x50')](_0xc3f8('0x53'),'i')[_0xc3f8('0x51')](_0xc3f8('0x54'),'c',_0xc3f8('0x55'))['left_join'](_0xc3f8('0x52'),'o',_0xc3f8('0x56'))['left_join'](_0xc3f8('0x57'),'a',_0xc3f8('0x58'))[_0xc3f8('0x51')](_0xc3f8('0x59'),'me',_0xc3f8('0x5a'))[_0xc3f8('0x51')](_0xc3f8('0x5b'),'it','it.MailInteractionId\x20=\x20i.id')[_0xc3f8('0x51')](_0xc3f8('0x5c'),'t',_0xc3f8('0x5d'));var _0x267c95=squel[_0xc3f8('0x5e')]();var _0x3d752a=[];var _0x97a88e=squel[_0xc3f8('0x5e')]();var _0x4fc02c;if(_0x17aff0['query'][_0xc3f8('0x5f')]){_0x4fc02c=as[_0xc3f8('0x60')](_0x17aff0['query']['search']);var _0x773d56=_0x4fc02c['sqlOperator'];for(var _0x1b1e13=0x0;_0x1b1e13<_0x4fc02c[_0xc3f8('0x61')][_0xc3f8('0x45')];_0x1b1e13++){var _0x5292a0=_0x4fc02c[_0xc3f8('0x61')][_0x1b1e13];var _0x5371c2='i';var _0x4d8436=_[_0xc3f8('0x62')](_0x4d430c,['name',_0x5292a0[_0xc3f8('0x4c')]]);if(!_0x4d8436){switch(_0x5292a0[_0xc3f8('0x4c')]){case _0xc3f8('0x63'):if(_0x5292a0['value']==0x1){_0x1becae[_0xc3f8('0x64')]('`'+_0x5292a0[_0xc3f8('0x4c')]+_0xc3f8('0x65'));}else{_0x1becae[_0xc3f8('0x64')]('`'+_0x5292a0[_0xc3f8('0x4c')]+'`\x20>\x200');}break;case'Contact':if(_0x5292a0[_0xc3f8('0x66')]===_0xc3f8('0x67')){if(_0x5292a0[_0xc3f8('0x68')][_0xc3f8('0x32')]('\x20')[_0xc3f8('0x45')]>0x1){_0x267c95[_0x773d56]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc3f8('0x69')](_0x5292a0['value']),null);}else{var _0x21dfc8='%'+_0x5292a0[_0xc3f8('0x68')]+'%';_0x267c95[_0x773d56](_0xc3f8('0x6a'),_0x21dfc8,_0x21dfc8,_0x21dfc8);}}else{_0x4d8436=_[_0xc3f8('0x62')](_0x4d430c,['name',_0xc3f8('0x6b')]);_0x5292a0['field']='ContactId';_0x24811c=as['buildExpression'](_0x5371c2,_0x4d8436['type'],_0x5292a0);_0x267c95[_0x773d56](_0x24811c[_0xc3f8('0x6c')],_0x24811c[_0xc3f8('0x68')][_0xc3f8('0x6d')],_0x24811c[_0xc3f8('0x68')][_0xc3f8('0x20')]);}break;case _0xc3f8('0x6e'):var _0x468116=_0x5292a0[_0xc3f8('0x68')]['split'](',')[_0xc3f8('0x2f')](function(_0x1c1d08){return Number(_0x1c1d08);});_0x468116[_0xc3f8('0x33')](function(_0x202103){_0x97a88e['or'](_0xc3f8('0x6f'),'%,'+_0x202103+',%');});_0x3d752a=_['union'](_0x3d752a,_0x468116);break;case _0xc3f8('0x70'):if(_0x5292a0[_0xc3f8('0x66')]===_0xc3f8('0x67')){_0x267c95[_0x773d56](_0xc3f8('0x71'),'%'+_0x5292a0[_0xc3f8('0x68')]+'%',null);}else{_0x4d8436=_['find'](_0x4d430c,[_0xc3f8('0x2c'),_0xc3f8('0x72')]);_0x5292a0[_0xc3f8('0x4c')]=_0xc3f8('0x72');_0x24811c=as[_0xc3f8('0x73')](_0x5371c2,_0x4d8436[_0xc3f8('0x3d')],_0x5292a0);_0x267c95[_0x773d56](_0x24811c['text'],_0x24811c[_0xc3f8('0x68')][_0xc3f8('0x6d')],_0x24811c[_0xc3f8('0x68')]['end']);}break;case _0xc3f8('0x74'):_0x24811c=as[_0xc3f8('0x73')]('me',null,_0x5292a0);_0x267c95[_0x773d56](_0x24811c['text'],_0x24811c['value'][_0xc3f8('0x6d')],_0x24811c[_0xc3f8('0x68')]['end']);break;}}else{var _0x24811c=as[_0xc3f8('0x73')](_0x5371c2,_0x4d8436[_0xc3f8('0x3d')],_0x5292a0);_0x267c95[_0x773d56](_0x24811c[_0xc3f8('0x6c')],_0x24811c[_0xc3f8('0x68')][_0xc3f8('0x6d')],_0x24811c[_0xc3f8('0x68')][_0xc3f8('0x20')]);}}}else{var _0x58268e=_(_0x17aff0['query'])[_0xc3f8('0x75')]()['map'](function(_0x4a1cf5){return _['some'](_0x4d430c,['name',_0x4a1cf5])?_0x4a1cf5:undefined;})['compact']()[_0xc3f8('0x68')]();if(!_[_0xc3f8('0x76')](_0x58268e)){_0x58268e[_0xc3f8('0x33')](function(_0x1a34fd){if(_0x1a34fd==='MailAccountId'){_0x1becae[_0xc3f8('0x49')](_0xc3f8('0x77'),[]['concat'](_0x17aff0[_0xc3f8('0x40')][_0x1a34fd]));}else if(_0x1a34fd===_0xc3f8('0x78')){var _0x104eec=JSON['parse'](_0x17aff0[_0xc3f8('0x40')][_0x1a34fd])['$gte'];var _0x59821b=JSON['parse'](_0x17aff0[_0xc3f8('0x40')][_0x1a34fd])[_0xc3f8('0x79')];_0x1becae['where'](_0xc3f8('0x7a'),_0x104eec,_0x59821b);}else{if(_0x17aff0[_0xc3f8('0x40')][_0x1a34fd]==='null'){_0x1becae[_0xc3f8('0x49')]('i.'+_0x1a34fd+_0xc3f8('0x7b'));}else{_0x1becae['where']('i.'+_0x1a34fd+_0xc3f8('0x7c'),_0x17aff0['query'][_0x1a34fd]);}}});}if(_0x17aff0[_0xc3f8('0x40')][_0xc3f8('0x7d')]){if(_0x17aff0['query']['read']==0x1){_0x1becae[_0xc3f8('0x64')](_0xc3f8('0x7e'));}else{_0x1becae['having'](_0xc3f8('0x7f'));}}if(_0x17aff0['query'][_0xc3f8('0x80')]){_0x3d752a=_['isArray'](_0x17aff0[_0xc3f8('0x40')][_0xc3f8('0x80')])?_0x17aff0[_0xc3f8('0x40')][_0xc3f8('0x80')]:new Array(_0x17aff0[_0xc3f8('0x40')][_0xc3f8('0x80')]);_0x3d752a[_0xc3f8('0x33')](function(_0x30a5e2){_0x97a88e['or'](_0xc3f8('0x6f'),'%,'+_0x30a5e2+',%');});}if(_0x17aff0['query'][_0xc3f8('0x81')]){var _0x232013=_0x17aff0[_0xc3f8('0x40')][_0xc3f8('0x81')][_0xc3f8('0x82')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xc3f8('0x83')](_0x232013)){_0x267c95['or'](_0xc3f8('0x84'),_0x232013+'%');}else if(qs[_0xc3f8('0x85')](_0x232013)){_0x267c95['or'](_0xc3f8('0x86'),_0x232013+'%');}else{_0x267c95['or'](_0xc3f8('0x87'),qs['getFullTextValue'](_0x232013))['or'](_0xc3f8('0x88'),qs[_0xc3f8('0x69')](_0x232013));}}}_0x1becae[_0xc3f8('0x49')](_0x267c95);_0x1becae['group']('i.id');var _0x119a60={'type':db[_0xc3f8('0x89')][_0xc3f8('0x8a')][_0xc3f8('0x8b')],'raw':!![]};var _0x4b9b3b=_0x1becae[_0xc3f8('0x8c')]();_0x4b9b3b[_0xc3f8('0x4c')](_0xc3f8('0x8d'));_0x4b9b3b['field'](_0xc3f8('0x8e'),_0xc3f8('0x63'));if(_0x3dede2['order']){_0x3dede2['order'][_0xc3f8('0x33')](function(_0xc4cd8c){var _0x56f750=_0xc4cd8c[0x0]===_0xc3f8('0x8f')?_0xc4cd8c[0x0]:'i.'+_0xc4cd8c[0x0];_0x1becae[_0xc3f8('0x47')](_0x56f750,_0xc4cd8c[0x1]==='DESC'?![]:!![]);});}if(!_[_0xc3f8('0x76')](_0x3d752a)){_0x1becae['having'](_0x97a88e);_0x4b9b3b[_0xc3f8('0x49')]('t.id\x20IN\x20?',_0x3d752a);}BPromise[_0xc3f8('0x90')]()[_0xc3f8('0x28')](function(){if(!_0x4fc02c){if(_0x17aff0[_0xc3f8('0x40')][_0xc3f8('0x91')])return;_0x4b9b3b[_0xc3f8('0x49')](_0xc3f8('0x92'));_0x1becae[_0xc3f8('0x49')](_0xc3f8('0x92'));return;}if(_0x17aff0[_0xc3f8('0x93')]['role']!=='agent')return;return _0x17aff0[_0xc3f8('0x93')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0xc3f8('0x28')](function(_0x2bde1c){if(_[_0xc3f8('0x76')](_0x2bde1c)){_0x4b9b3b[_0xc3f8('0x49')]('i.MailAccountId\x20IS\x20NULL');_0x1becae[_0xc3f8('0x49')](_0xc3f8('0x94'));}else{_0x4b9b3b[_0xc3f8('0x49')](_0xc3f8('0x77'),_[_0xc3f8('0x2f')](_0x2bde1c,'id'));_0x1becae[_0xc3f8('0x49')](_0xc3f8('0x77'),_[_0xc3f8('0x2f')](_0x2bde1c,'id'));}});})[_0xc3f8('0x28')](function(){if(_0x17aff0['user']['role']===_0xc3f8('0x95')&&!_0x4fc02c&&!_0x17aff0[_0xc3f8('0x40')][_0xc3f8('0x91')])return[];return db['sequelize'][_0xc3f8('0x40')](_0x4b9b3b['toString'](),_0x119a60);})[_0xc3f8('0x28')](function(_0x5ba0f5){_0xaa4c98[_0xc3f8('0x22')]=_0x5ba0f5[_0xc3f8('0x45')];if(_0xaa4c98[_0xc3f8('0x22')]===0x0)return[];return db[_0xc3f8('0x96')][_0xc3f8('0x40')](_0x35ce2f[_0xc3f8('0x97')](),_0x119a60)[_0xc3f8('0x28')](function(_0x1d4830){_0x5129bb=_['keyBy'](_0x1d4830,'id');_0x119a60=_[_0xc3f8('0x98')](_0x119a60,{'model':db[_0xc3f8('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x17aff0[_0xc3f8('0x40')][_0xc3f8('0x43')]){_0x3dede2[_0xc3f8('0x44')]['forEach'](function(_0x169ced){_0x1becae[_0xc3f8('0x4c')]('i.'+_0x169ced);});}else{_0x1becae[_0xc3f8('0x4c')](_0xc3f8('0x8e'),'unreadMessages');_0x1becae['field'](_0xc3f8('0x99'),_0xc3f8('0x9a'));_0x1becae['field']('a.mandatoryDisposition','Account.mandatoryDisposition');_0x1becae[_0xc3f8('0x4c')]('CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xc3f8('0x8f'));_0x1becae[_0xc3f8('0x4c')](_0xc3f8('0x8d'));_0x1becae[_0xc3f8('0x4c')](_0xc3f8('0x9b'));_0x1becae[_0xc3f8('0x4c')](_0xc3f8('0x9c'));_0x1becae['field']('i.closed');_0x1becae['field']('i.closedAt');_0x1becae[_0xc3f8('0x4c')]('i.attach');_0x1becae[_0xc3f8('0x4c')](_0xc3f8('0x9d'));_0x1becae[_0xc3f8('0x4c')]('i.lastMsgDirection');_0x1becae[_0xc3f8('0x4c')](_0xc3f8('0x9e'));_0x1becae['field'](_0xc3f8('0x9f'));_0x1becae[_0xc3f8('0x4c')](_0xc3f8('0xa0'));_0x1becae['field'](_0xc3f8('0xa1'));_0x1becae[_0xc3f8('0x4c')](_0xc3f8('0xa2'));_0x1becae['field'](_0xc3f8('0xa3'));_0x1becae[_0xc3f8('0x4c')](_0xc3f8('0xa4'));_0x1becae[_0xc3f8('0x4c')](_0xc3f8('0xa5'));_0x1becae[_0xc3f8('0x4c')]('i.UserId');_0x1becae[_0xc3f8('0x4c')](_0xc3f8('0xa6'),'Contact.firstName');_0x1becae[_0xc3f8('0x4c')](_0xc3f8('0xa7'),'Contact.lastName');_0x1becae[_0xc3f8('0x4c')](_0xc3f8('0xa8'),_0xc3f8('0xa9'));_0x1becae['field']('c.phone',_0xc3f8('0xaa'));_0x1becae['field'](_0xc3f8('0xab'),_0xc3f8('0xac'));_0x1becae[_0xc3f8('0x4c')]('c.fax',_0xc3f8('0xad'));_0x1becae[_0xc3f8('0x4c')](_0xc3f8('0xae'),_0xc3f8('0xaf'));_0x1becae[_0xc3f8('0x4c')](_0xc3f8('0xb0'),'Owner.internal');_0x1becae[_0xc3f8('0x4c')](_0xc3f8('0xb1'),_0xc3f8('0x30'));}if(_0x3dede2[_0xc3f8('0x24')])_0x1becae[_0xc3f8('0x24')](_0x3dede2['limit']);if(_0x3dede2[_0xc3f8('0x23')])_0x1becae[_0xc3f8('0x23')](_0x3dede2[_0xc3f8('0x23')]);return db['sequelize'][_0xc3f8('0x40')](_0x1becae[_0xc3f8('0x97')](),_0x119a60);})[_0xc3f8('0x28')](function(_0x29b90b){_0x35ef68[_0xc3f8('0x49')]('ui.MailInteractionId\x20IN\x20?',_[_0xc3f8('0x2f')](_0x29b90b,'id'));return db[_0xc3f8('0x96')][_0xc3f8('0x40')](_0x35ef68[_0xc3f8('0x97')](),_0x119a60)[_0xc3f8('0x28')](function(_0x132ac1){var _0x2697c7=_[_0xc3f8('0xb2')](_0x132ac1,_0xc3f8('0xb3'));var _0x132d60=[];return db[_0xc3f8('0xb4')]['findOne']({'attributes':['enableEmailPreview'],'raw':!![]})[_0xc3f8('0x28')](function(_0x53e794){var _0x54b8ee=_0x53e794[_0xc3f8('0xb5')];_0x29b90b[_0xc3f8('0x33')](function(_0x2a9ea3){_0x132d60[_0xc3f8('0x34')](updateMailInteraction(_0x2a9ea3,_0x5129bb,_0x2697c7,_0x54b8ee));});return BPromise['all'](_0x132d60);});});});})[_0xc3f8('0x28')](function(_0x34cf54){_0xaa4c98['rows']=_0x34cf54;return _0xaa4c98;})[_0xc3f8('0x28')](respondWithFilteredResult(_0x502293,_0x3dede2))[_0xc3f8('0x3a')](handleError(_0x502293,null));};exports['show']=function(_0x4feb9e,_0x54042d){var _0x1426ea={'raw':![],'where':{'id':_0x4feb9e[_0xc3f8('0xb6')]['id']}},_0x307954={};_0x307954[_0xc3f8('0x3f')]=_[_0xc3f8('0x75')](db[_0xc3f8('0x35')][_0xc3f8('0x3c')]);_0x307954[_0xc3f8('0x40')]=_[_0xc3f8('0x75')](_0x4feb9e['query']);_0x307954['filters']=_[_0xc3f8('0x42')](_0x307954[_0xc3f8('0x3f')],_0x307954[_0xc3f8('0x40')]);_0x1426ea[_0xc3f8('0x44')]=_[_0xc3f8('0x42')](_0x307954[_0xc3f8('0x3f')],qs[_0xc3f8('0x43')](_0x4feb9e[_0xc3f8('0x40')][_0xc3f8('0x43')]));_0x1426ea['attributes']=_0x1426ea[_0xc3f8('0x44')]['length']?_0x1426ea['attributes']:_0x307954[_0xc3f8('0x3f')];if(_0x4feb9e[_0xc3f8('0x40')][_0xc3f8('0xb7')]){_0x1426ea[_0xc3f8('0xb8')]=[{'all':!![]}];}_0x1426ea=_[_0xc3f8('0x98')]({},_0x1426ea,_0x4feb9e[_0xc3f8('0xb9')]);return db['MailInteraction'][_0xc3f8('0x62')](_0x1426ea)[_0xc3f8('0x28')](handleEntityNotFound(_0x54042d,null))[_0xc3f8('0x28')](respondWithResult(_0x54042d,null))['catch'](handleError(_0x54042d,null));};exports['create']=function(_0x14427e,_0x460889){return db['MailInteraction'][_0xc3f8('0xba')](_0x14427e[_0xc3f8('0xbb')],{})['then'](respondWithResult(_0x460889,0xc9))[_0xc3f8('0x3a')](handleError(_0x460889,null));};exports[_0xc3f8('0xbc')]=function(_0x2f6a2d,_0xc0e1db){if(_0x2f6a2d[_0xc3f8('0xbb')]['id']){delete _0x2f6a2d['body']['id'];}return db[_0xc3f8('0x35')]['find']({'where':{'id':_0x2f6a2d[_0xc3f8('0xb6')]['id']}})[_0xc3f8('0x28')](handleEntityNotFound(_0xc0e1db,null))['then'](saveUpdates(_0x2f6a2d[_0xc3f8('0xbb')],null))[_0xc3f8('0x28')](respondWithResult(_0xc0e1db,null))[_0xc3f8('0x3a')](handleError(_0xc0e1db,null));};exports[_0xc3f8('0x29')]=function(_0x22d4b4,_0x33712a){return db[_0xc3f8('0x35')][_0xc3f8('0x62')]({'where':{'id':_0x22d4b4[_0xc3f8('0xb6')]['id']}})[_0xc3f8('0x28')](handleEntityNotFound(_0x33712a,null))[_0xc3f8('0x28')](removeEntity(_0x33712a,null))[_0xc3f8('0x3a')](handleError(_0x33712a,null));};exports[_0xc3f8('0xbd')]=function(_0x23b330,_0x38e365){return db[_0xc3f8('0x35')][_0xc3f8('0xbd')]()[_0xc3f8('0x28')](respondWithResult(_0x38e365,null))[_0xc3f8('0x3a')](handleError(_0x38e365,null));};exports['addMessage']=function(_0x285037,_0x4395c7,_0x59ce36){return db[_0xc3f8('0xbe')]['find']({'where':{'id':_0x285037[_0xc3f8('0xb6')]['id']}})['then'](handleEntityNotFound(_0x4395c7,null))[_0xc3f8('0x28')](function(_0x1db4eb){if(_0x1db4eb){return _0x1db4eb[_0xc3f8('0xbf')](_0x285037['body'][_0xc3f8('0xc0')],_[_0xc3f8('0xc1')](_0x285037[_0xc3f8('0xbb')],[_0xc3f8('0xc0'),'id'])||{});}})[_0xc3f8('0x28')](respondWithResult(_0x4395c7,null))[_0xc3f8('0x3a')](handleError(_0x4395c7,null));};exports[_0xc3f8('0xc2')]=function(_0x4af05a,_0x1e1adf,_0xa7e06){var _0x103ded={'raw':![],'where':{}};var _0x3e87d7={};var _0x349dd9={'count':0x0,'rows':[]};return db[_0xc3f8('0x35')][_0xc3f8('0x36')]({'where':{'id':_0x4af05a[_0xc3f8('0xb6')]['id']}})[_0xc3f8('0x28')](handleEntityNotFound(_0x1e1adf,null))[_0xc3f8('0x28')](function(_0x1cc82b){if(_0x1cc82b){_0x3e87d7[_0xc3f8('0x3f')]=_[_0xc3f8('0x75')](db[_0xc3f8('0xbe')]['rawAttributes']);_0x3e87d7[_0xc3f8('0x40')]=_['keys'](_0x4af05a[_0xc3f8('0x40')]);_0x3e87d7['filters']=_['intersection'](_0x3e87d7[_0xc3f8('0x3f')],_0x3e87d7[_0xc3f8('0x40')]);_0x103ded[_0xc3f8('0x44')]=_['intersection'](_0x3e87d7['model'],qs[_0xc3f8('0x43')](_0x4af05a[_0xc3f8('0x40')][_0xc3f8('0x43')]));_0x103ded[_0xc3f8('0x44')]=_0x103ded[_0xc3f8('0x44')]['length']?_0x103ded[_0xc3f8('0x44')]:_0x3e87d7[_0xc3f8('0x3f')];if(!_0x4af05a[_0xc3f8('0x40')]['hasOwnProperty']('nolimit')){_0x103ded[_0xc3f8('0x24')]=qs['limit'](_0x4af05a['query']['limit']);_0x103ded[_0xc3f8('0x23')]=qs[_0xc3f8('0x23')](_0x4af05a[_0xc3f8('0x40')][_0xc3f8('0x23')]);}_0x103ded['order']=qs[_0xc3f8('0x48')](_0x4af05a[_0xc3f8('0x40')][_0xc3f8('0x48')]);_0x103ded['where']=qs[_0xc3f8('0x41')](_[_0xc3f8('0x4a')](_0x4af05a[_0xc3f8('0x40')],_0x3e87d7[_0xc3f8('0x41')]));_0x103ded[_0xc3f8('0x49')]['MailInteractionId']=_0x1cc82b['id'];if(_0x4af05a[_0xc3f8('0x40')][_0xc3f8('0x81')]){_0x103ded[_0xc3f8('0x49')]=_[_0xc3f8('0x98')](_0x103ded[_0xc3f8('0x49')],{'$or':_[_0xc3f8('0x2f')](_0x103ded['attributes'],function(_0x46e5ea){var _0x1a7a20={};_0x1a7a20[_0x46e5ea]={'$like':'%'+_0x4af05a['query'][_0xc3f8('0x81')]+'%'};return _0x1a7a20;})});}if(_0x4af05a[_0xc3f8('0x40')][_0xc3f8('0xc3')]){var _0x4b1018=_0x4af05a[_0xc3f8('0x40')]['$gte'][_0xc3f8('0x32')](',');var _0xaa9b1c={};_0xaa9b1c[_0x4b1018[0x0]]={'$gte':moment(_0x4b1018[0x1])[_0xc3f8('0xc4')](_0xc3f8('0xc5'))};_0x103ded[_0xc3f8('0x49')]=_[_0xc3f8('0x98')](_0x103ded[_0xc3f8('0x49')],_0xaa9b1c);}_0x103ded=_[_0xc3f8('0x98')]({},_0x103ded,_0x4af05a[_0xc3f8('0xb9')]);return db[_0xc3f8('0xbe')][_0xc3f8('0x22')]({'where':_0x103ded[_0xc3f8('0x49')]})[_0xc3f8('0x28')](function(_0x1446c4){_0x349dd9[_0xc3f8('0x22')]=_0x1446c4;if(_0x4af05a[_0xc3f8('0x40')]['includeAll']){_0x103ded[_0xc3f8('0xb8')]=[{'all':!![]}];}return db[_0xc3f8('0xbe')][_0xc3f8('0xc6')](_0x103ded);})[_0xc3f8('0x28')](function(_0x41ac93){if(_0x4af05a['query'][_0xc3f8('0xc7')]===_0xc3f8('0xc8')){for(var _0x102a54=0x0;_0x102a54<_0x41ac93[_0xc3f8('0x45')];_0x102a54++){_0x41ac93[_0x102a54][_0xc3f8('0xbb')]=juice(_0x41ac93[_0x102a54][_0xc3f8('0xbb')]);}}_0x349dd9[_0xc3f8('0xc9')]=_0x41ac93;return _0x349dd9;});}})['then'](respondWithFilteredResult(_0x1e1adf,_0x103ded))[_0xc3f8('0x3a')](handleError(_0x1e1adf,null));};exports['addTags']=function(_0x52125b,_0x28db21,_0x264b1f){return db[_0xc3f8('0x35')][_0xc3f8('0x62')]({'where':{'id':_0x52125b[_0xc3f8('0xb6')]['id']}})['then'](handleEntityNotFound(_0x28db21,null))[_0xc3f8('0x28')](function(_0x50bdbf){if(_0x50bdbf){return _0x50bdbf[_0xc3f8('0xca')](_0x52125b[_0xc3f8('0xbb')]['ids'],_[_0xc3f8('0xc1')](_0x52125b[_0xc3f8('0xbb')],['ids','id'])||{})[_0xc3f8('0xcb')](function(){return db[_0xc3f8('0x6e')][_0xc3f8('0xc6')]({'attributes':['id',_0xc3f8('0x2c'),_0xc3f8('0x4d')],'where':{'id':_0x52125b[_0xc3f8('0xbb')][_0xc3f8('0xc0')]}});})[_0xc3f8('0x28')](function(_0xd22237){socket[_0xc3f8('0xcc')](_0xc3f8('0xcd'),{'id':Number(_0x52125b['params']['id']),'tags':_0xd22237||[]});return{'id':Number(_0x52125b[_0xc3f8('0xb6')]['id']),'tags':_0xd22237||[]};});}})['then'](respondWithResult(_0x28db21,null))[_0xc3f8('0x3a')](handleError(_0x28db21,null));};exports['removeTags']=function(_0xa0b4d0,_0x30d7cb,_0x5f2eac){return db['MailInteraction']['find']({'where':{'id':_0xa0b4d0[_0xc3f8('0xb6')]['id']}})[_0xc3f8('0x28')](handleEntityNotFound(_0x30d7cb,null))[_0xc3f8('0x28')](function(_0x159604){if(_0x159604){return _0x159604[_0xc3f8('0xce')](_0xa0b4d0[_0xc3f8('0x40')][_0xc3f8('0xc0')]);}})[_0xc3f8('0x28')](respondWithStatusCode(_0x30d7cb,null))[_0xc3f8('0x3a')](handleError(_0x30d7cb,null));};exports[_0xc3f8('0xcf')]=function(_0x74188e,_0x149355){var _0x5e7adb=moment()[_0xc3f8('0xd0')]()[_0xc3f8('0x97')]();var _0x2dc74f=path[_0xc3f8('0xd1')](config[_0xc3f8('0xd2')],_0xc3f8('0xd3'),_0xc3f8('0xd4'),_0xc3f8('0xd5'));var _0xc68dd7=path['join'](config[_0xc3f8('0xd2')],_0xc3f8('0xd3'),_0xc3f8('0xd4'),_0xc3f8('0xd6'));var _0x3d088a=path[_0xc3f8('0xd1')](_0x2dc74f,_0x5e7adb);var _0x4f89c=util[_0xc3f8('0xc4')](_0xc3f8('0xd7'),_0x74188e[_0xc3f8('0xb6')]['id'],_0x5e7adb);var _0x1fe7db=path[_0xc3f8('0xd1')](_0x2dc74f,_0x4f89c);var _0x118020=[];if(_0x74188e[_0xc3f8('0x40')][_0xc3f8('0xd6')]){_0x118020[_0xc3f8('0x34')]({'model':db[_0xc3f8('0xd8')],'as':_0xc3f8('0xd9'),'raw':!![]});}var _0x3c2a1c=[{'model':db[_0xc3f8('0xbe')],'as':_0xc3f8('0xda'),'attributes':['id',_0xc3f8('0xbb'),'from','to','cc','bcc','subject',_0xc3f8('0x78')],'where':{'secret':![]},'order':qs[_0xc3f8('0x48')]('id'),'include':_0x118020}];return db[_0xc3f8('0x35')]['find']({'where':{'id':_0x74188e['params']['id']},'include':_0x3c2a1c})['then'](handleEntityNotFound(_0x149355,null))[_0xc3f8('0x28')](function(_0x10820b){if(_0x10820b&&_0x10820b[_0xc3f8('0xda')]){var _0x17e568=_0x10820b[_0xc3f8('0xdb')]({'plain':!![]});fs['mkdirSync'](_0x3d088a);return BPromise['each'](_0x17e568[_0xc3f8('0xda')],function(_0x5c5295,_0x4aedc9){var _0x258412={'from':_0x5c5295[_0xc3f8('0x50')],'to':_0x5c5295['to'],'subject':_0x5c5295['subject'],'html':_0x5c5295['body'],'headers':{'Date':moment(_0x5c5295[_0xc3f8('0x78')])[_0xc3f8('0xc4')](_0xc3f8('0xdc'))},'attachments':[]};if(_0x5c5295['cc']){_0x258412[_0xc3f8('0xdd')]['Cc']=_0x5c5295['cc'];}if(_0x5c5295['bcc']){_0x258412[_0xc3f8('0xdd')][_0xc3f8('0xde')]=_0x5c5295[_0xc3f8('0xdf')];}return new BPromise(function(_0x3182a5,_0x365c56){if(_0x5c5295['Attachments']){for(var _0x2a9d71=0x0;_0x2a9d71<_0x5c5295[_0xc3f8('0xd9')][_0xc3f8('0x45')];_0x2a9d71++){var _0x476982=_0x5c5295[_0xc3f8('0xd9')][_0x2a9d71];var _0x5b7671=path[_0xc3f8('0xd1')](_0xc68dd7,_0x476982[_0xc3f8('0xe0')]);if(fs['existsSync'](_0x5b7671)){_0x258412['attachments'][_0xc3f8('0x34')]({'name':_0x476982[_0xc3f8('0x2c')],'contentType':_0x476982[_0xc3f8('0x3d')],'data':fs[_0xc3f8('0xe1')](_0x5b7671)});}}}emlformat[_0xc3f8('0xe2')](_0x258412,function(_0x5082e2,_0x226dc1){if(_0x5082e2)return _0x365c56(_0x5082e2);fs['writeFileSync'](path['join'](_0x3d088a,util[_0xc3f8('0xc4')](_0xc3f8('0xe3'),_0x4aedc9)),_0x226dc1);return _0x3182a5(_0x226dc1);});});})[_0xc3f8('0x28')](function(){return new BPromise(function(_0x1e66b1,_0x2087f7){zipdir(_0x3d088a,{'saveTo':_0x1fe7db},function(_0x3afce0,_0x2ec718){if(_0x3afce0)return _0x2087f7(_0x3afce0);return _0x1e66b1(_0x2ec718);});})[_0xc3f8('0x28')](function(){return new BPromise(function(_0x32215f,_0x512834){rimraf(_0x3d088a,function(_0x4077d5){if(_0x4077d5)_0x512834(_0x4077d5);return _0x32215f();});});})[_0xc3f8('0x28')](function(){return _0x149355[_0xc3f8('0xcf')](_0x1fe7db,_0x4f89c,function(_0x5a4af4){if(_0x5a4af4){console[_0xc3f8('0xe4')](_0xc3f8('0xe5'),_0x5a4af4);}else{fs[_0xc3f8('0xe6')](_0x1fe7db);}});});});}else{return _0x149355[_0xc3f8('0x1e')](0xc8);}})[_0xc3f8('0x3a')](handleError(_0x149355,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index d3d8501..6b19576 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 _0xa38e=['setDataValue','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove','getUsers','then'];(function(_0x457b21,_0x4d9208){var _0x313056=function(_0x34be41){while(--_0x34be41){_0x457b21['push'](_0x457b21['shift']());}};_0x313056(++_0x4d9208);}(_0xa38e,0xcb));var _0xea38=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0xa38e[_0x2b9b7f];return _0x4ed19a;};'use strict';var EventEmitter=require(_0xea38('0x0'));var MailInteraction=require(_0xea38('0x1'))['db']['MailInteraction'];var MailMessage=require(_0xea38('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xea38('0x2'),'afterUpdate':_0xea38('0x3'),'afterDestroy':_0xea38('0x4')};function emitEvent(_0x408368){return function(_0x5ee119,_0x193495,_0x4632f2){_0x5ee119[_0xea38('0x5')]({'attributes':['id'],'raw':!![]})[_0xea38('0x6')](function(_0x4029f6){_0x5ee119[_0xea38('0x7')]('Users',_0x4029f6['map'](function(_0x52d902){return{'id':_0x52d902['id']};}));return MailMessage[_0xea38('0x8')]({'where':{'MailInteractionId':_0x5ee119['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x11e583){_0x5ee119['setDataValue'](_0xea38('0x9'),_0x11e583['length']);MailInteractionEvents['emit'](_0x408368+':'+_0x5ee119['id'],_0x5ee119);MailInteractionEvents[_0xea38('0xa')](_0x408368,_0x5ee119);_0x4632f2(null);})[_0xea38('0xb')](_0x4632f2(null));};}for(var e in events){if(events[_0xea38('0xc')](e)){var event=events[e];MailInteraction[_0xea38('0xd')](e,emitEvent(event));}}module[_0xea38('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0x81d9=['exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','getUsers','then','setDataValue','Users','unreadMessages','length','emit','catch','hook'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x81d9,0x1f1));var _0x981d=function(_0x32674b,_0x50cba5){_0x32674b=_0x32674b-0x0;var _0x38d463=_0x81d9[_0x32674b];return _0x38d463;};'use strict';var EventEmitter=require(_0x981d('0x0'));var MailInteraction=require(_0x981d('0x1'))['db'][_0x981d('0x2')];var MailMessage=require(_0x981d('0x1'))['db'][_0x981d('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x981d('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x981d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4f3b3c){return function(_0x30c23f,_0x39fa08,_0x4fb570){_0x30c23f[_0x981d('0x6')]({'attributes':['id'],'raw':!![]})[_0x981d('0x7')](function(_0x30ece){_0x30c23f[_0x981d('0x8')](_0x981d('0x9'),_0x30ece['map'](function(_0x162c31){return{'id':_0x162c31['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x30c23f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x981d('0x7')](function(_0x3612ab){_0x30c23f['setDataValue'](_0x981d('0xa'),_0x3612ab[_0x981d('0xb')]);MailInteractionEvents[_0x981d('0xc')](_0x4f3b3c+':'+_0x30c23f['id'],_0x30c23f);MailInteractionEvents[_0x981d('0xc')](_0x4f3b3c,_0x30c23f);_0x4fb570(null);})[_0x981d('0xd')](_0x4fb570(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x981d('0xe')](e,emitEvent(event));}}module[_0x981d('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index bf2b76e..e95e152 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 _0xf3dc=['closed','get','update','then','catch','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','format'];(function(_0x3bc5a6,_0x5befea){var _0x414f51=function(_0xc08f80){while(--_0xc08f80){_0x3bc5a6['push'](_0x3bc5a6['shift']());}};_0x414f51(++_0x5befea);}(_0xf3dc,0x9c));var _0xcf3d=function(_0x183c00,_0x5327b8){_0x183c00=_0x183c00-0x0;var _0x4a8361=_0xf3dc[_0x183c00];return _0x4a8361;};'use strict';var _=require(_0xcf3d('0x0'));var util=require(_0xcf3d('0x1'));var logger=require(_0xcf3d('0x2'))('api');var moment=require(_0xcf3d('0x3'));var BPromise=require(_0xcf3d('0x4'));var rp=require(_0xcf3d('0x5'));var fs=require('fs');var path=require(_0xcf3d('0x6'));var rimraf=require(_0xcf3d('0x7'));var config=require(_0xcf3d('0x8'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x55074b,_0x5b1441){return _0x55074b['define']('MailInteraction',attributes,{'tableName':_0xcf3d('0x9'),'paranoid':![],'indexes':[{'name':_0xcf3d('0xa'),'fields':[_0xcf3d('0xb'),'to'],'type':_0xcf3d('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x368e74,_0x27c49c,_0x249945){if(_0x368e74[_0xcf3d('0xd')]){_0x368e74[_0xcf3d('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x368e74['closed']){_0x368e74[_0xcf3d('0xf')]=moment()['format'](_0xcf3d('0x10'));}_0x249945(null,_0x27c49c);},'beforeUpdate':function(_0x29f0e7,_0x100427,_0x16d627){if(_0x29f0e7[_0xcf3d('0x11')](_0xcf3d('0xd'))){_0x29f0e7[_0xcf3d('0xe')]=_0x29f0e7[_0xcf3d('0xd')]?moment()[_0xcf3d('0x12')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x29f0e7['changed'](_0xcf3d('0x13'))){_0x29f0e7[_0xcf3d('0xf')]=moment()[_0xcf3d('0x12')](_0xcf3d('0x10'));_0x29f0e7[_0xcf3d('0xd')]=null;_0x29f0e7[_0xcf3d('0xe')]=null;}_0x16d627(null,_0x29f0e7);},'afterUpdate':function(_0x196b1f,_0x71e44b,_0x410004){var _0x88c2de=_0x55074b['models'];var _0x5e5f18=_0x196b1f[_0xcf3d('0x14')]({'plain':!![]});if(_0x5e5f18[_0xcf3d('0x13')]){return _0x88c2de['MailMessage'][_0xcf3d('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x5e5f18['id']}})[_0xcf3d('0x16')](function(){_0x410004();})[_0xcf3d('0x17')](function(_0x18d5fb){_0x410004(_0x18d5fb);});}else{_0x410004();}}},'charset':_0xcf3d('0x18'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9755=['define','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatusAt','models','get','update','utf8mb4','lodash','../../config/logger','api','moment','rimraf','../../config/environment','./mailInteraction.attributes','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9755,0x1c6));var _0x5975=function(_0x4314d7,_0x355218){_0x4314d7=_0x4314d7-0x0;var _0x5c599b=_0x9755[_0x4314d7];return _0x5c599b;};'use strict';var _=require(_0x5975('0x0'));var util=require('util');var logger=require(_0x5975('0x1'))(_0x5975('0x2'));var moment=require(_0x5975('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5975('0x4'));var config=require(_0x5975('0x5'));var attributes=require(_0x5975('0x6'));module[_0x5975('0x7')]=function(_0x414e54,_0x1839fb){return _0x414e54[_0x5975('0x8')]('MailInteraction',attributes,{'tableName':_0x5975('0x9'),'paranoid':![],'indexes':[{'name':_0x5975('0xa'),'fields':['subject','to'],'type':_0x5975('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3920c1,_0x15ebfd,_0x5701dd){if(_0x3920c1[_0x5975('0xc')]){_0x3920c1['substatusAt']=moment()['format'](_0x5975('0xd'));}if(_0x3920c1[_0x5975('0xe')]){_0x3920c1[_0x5975('0xf')]=moment()['format'](_0x5975('0xd'));}_0x5701dd(null,_0x15ebfd);},'beforeUpdate':function(_0xe62491,_0x471ddf,_0x52bdaa){if(_0xe62491[_0x5975('0x10')](_0x5975('0xc'))){_0xe62491[_0x5975('0x11')]=_0xe62491[_0x5975('0xc')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0xe62491[_0x5975('0x10')](_0x5975('0xe'))){_0xe62491[_0x5975('0xf')]=moment()['format'](_0x5975('0xd'));_0xe62491['substatus']=null;_0xe62491[_0x5975('0x11')]=null;}_0x52bdaa(null,_0xe62491);},'afterUpdate':function(_0x58da02,_0x2d9d4c,_0x30685f){var _0x16706c=_0x414e54[_0x5975('0x12')];var _0x25f2a0=_0x58da02[_0x5975('0x13')]({'plain':!![]});if(_0x25f2a0[_0x5975('0xe')]){return _0x16706c['MailMessage'][_0x5975('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x25f2a0['id']}})['then'](function(){_0x30685f();})['catch'](function(_0x5355bf){_0x30685f(_0x5355bf);});}else{_0x30685f();}}},'charset':_0x5975('0x15'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 3d9fcce..13d5a1f 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 _0x4e61=['then','info','debug','AddTagsToMailInteraction','addTags','ids','spread','AddTags','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','request\x20sent','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4e61,0x8c));var _0x14e6=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0x4e61[_0x261522];return _0x98a25a;};'use strict';var _=require(_0x14e6('0x0'));var util=require(_0x14e6('0x1'));var moment=require(_0x14e6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x14e6('0x3'));var db=require(_0x14e6('0x4'))['db'];var utils=require(_0x14e6('0x5'));var logger=require(_0x14e6('0x6'))(_0x14e6('0x7'));var config=require(_0x14e6('0x8'));var jayson=require(_0x14e6('0x9'));var client=jayson[_0x14e6('0xa')][_0x14e6('0xb')]({'port':0x232a});config[_0x14e6('0xc')]=_[_0x14e6('0xd')](config[_0x14e6('0xc')],{'host':_0x14e6('0xe'),'port':0x18eb});var socket=require(_0x14e6('0xf'))(new Redis(config[_0x14e6('0xc')]));require(_0x14e6('0x10'))[_0x14e6('0x11')](socket);function respondWithRpcPromise(_0x40ce5d,_0x4bc647,_0x213bf3){return new BPromise(function(_0x473ed2,_0x1ae9be){return client[_0x14e6('0x12')](_0x40ce5d,_0x213bf3)['then'](function(_0x57e88a){logger['info']('MailInteraction,\x20%s,\x20%s',_0x4bc647,_0x14e6('0x13'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x4bc647,_0x14e6('0x13'),JSON[_0x14e6('0x14')](_0x57e88a));if(_0x57e88a[_0x14e6('0x15')]){if(_0x57e88a['error'][_0x14e6('0x16')]===0x1f4){logger[_0x14e6('0x15')](_0x14e6('0x17'),_0x4bc647,_0x57e88a[_0x14e6('0x15')][_0x14e6('0x18')]);return _0x1ae9be(_0x57e88a['error'][_0x14e6('0x18')]);}logger[_0x14e6('0x15')](_0x14e6('0x17'),_0x4bc647,_0x57e88a[_0x14e6('0x15')][_0x14e6('0x18')]);return _0x473ed2(_0x57e88a['error'][_0x14e6('0x18')]);}else{logger['info']('MailInteraction,\x20%s,\x20%s',_0x4bc647,'request\x20sent');_0x473ed2(_0x57e88a[_0x14e6('0x19')][_0x14e6('0x18')]);}})[_0x14e6('0x1a')](function(_0x3423b3){logger['error']('MailInteraction,\x20%s,\x20%s',_0x4bc647,_0x3423b3);_0x1ae9be(_0x3423b3);});});}exports[_0x14e6('0x1b')]=function(_0xaa4597){var _0x4280e8=this;return new Promise(function(_0x3d2837,_0x28f75f){return db[_0x14e6('0x1c')][_0x14e6('0x1d')](_0xaa4597[_0x14e6('0x1e')],{'raw':_0xaa4597[_0x14e6('0x1f')]?_0xaa4597[_0x14e6('0x1f')][_0x14e6('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xaa4597[_0x14e6('0x1f')]?_0xaa4597[_0x14e6('0x1f')][_0x14e6('0x21')]||null:null,'attributes':_0xaa4597[_0x14e6('0x1f')]?_0xaa4597[_0x14e6('0x1f')][_0x14e6('0x22')]||null:null,'limit':_0xaa4597[_0x14e6('0x1f')]?_0xaa4597[_0x14e6('0x1f')][_0x14e6('0x23')]||null:null})[_0x14e6('0x24')](function(_0x4a5084){logger[_0x14e6('0x25')](_0x14e6('0x1b'),_0xaa4597);logger[_0x14e6('0x26')](_0x14e6('0x1b'),_0xaa4597,JSON[_0x14e6('0x14')](_0x4a5084));_0x3d2837(_0x4a5084);})[_0x14e6('0x1a')](function(_0x477833){logger['error'](_0x14e6('0x1b'),_0x477833['message'],_0xaa4597);_0x28f75f(_0x4280e8['error'](0x1f4,_0x477833['message']));});});};exports[_0x14e6('0x27')]=function(_0x52e725){return new Promise(function(_0x31f5d7,_0x1aef5d){return db[_0x14e6('0x1c')]['find']({'where':_0x52e725[_0x14e6('0x1f')]?_0x52e725[_0x14e6('0x1f')][_0x14e6('0x21')]||null:null})['then'](function(_0x1e21a3){if(_0x1e21a3){return _0x1e21a3[_0x14e6('0x28')](_0x52e725[_0x14e6('0x1e')][_0x14e6('0x29')],_['omit'](_0x52e725[_0x14e6('0x1e')],['ids','id'])||{});}})[_0x14e6('0x2a')](function(_0x11ca20){logger['info'](_0x14e6('0x2b'),_0x52e725);logger[_0x14e6('0x26')](_0x14e6('0x2b'),_0x52e725,JSON[_0x14e6('0x14')](_0x11ca20));_0x31f5d7(_0x11ca20);})['catch'](function(_0x14b18a){logger[_0x14e6('0x15')](_0x14e6('0x2b'),_0x14b18a[_0x14e6('0x18')],_0x52e725);_0x1aef5d(_this[_0x14e6('0x15')](0x1f4,_0x14b18a[_0x14e6('0x18')]));});});}; \ No newline at end of file +var _0x1782=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','localhost','socket.io-emitter','redis','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','body','options','raw','where','attributes','limit','find','ids','omit','spread','AddTags','lodash','moment'];(function(_0x4f37bc,_0x305757){var _0x2d0f5c=function(_0x168308){while(--_0x168308){_0x4f37bc['push'](_0x4f37bc['shift']());}};_0x2d0f5c(++_0x305757);}(_0x1782,0x13e));var _0x2178=function(_0x507e46,_0x4166c1){_0x507e46=_0x507e46-0x0;var _0x3604d3=_0x1782[_0x507e46];return _0x3604d3;};'use strict';var _=require(_0x2178('0x0'));var util=require('util');var moment=require(_0x2178('0x1'));var BPromise=require(_0x2178('0x2'));var rs=require(_0x2178('0x3'));var fs=require('fs');var Redis=require(_0x2178('0x4'));var db=require(_0x2178('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2178('0x6'))(_0x2178('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2178('0x8')][_0x2178('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x2178('0xa'),'port':0x18eb});var socket=require(_0x2178('0xb'))(new Redis(config[_0x2178('0xc')]));require(_0x2178('0xd'))[_0x2178('0xe')](socket);function respondWithRpcPromise(_0x5ac52e,_0x5119ea,_0x380ab6){return new BPromise(function(_0x201b7b,_0x33a201){return client[_0x2178('0xf')](_0x5ac52e,_0x380ab6)[_0x2178('0x10')](function(_0x2de258){logger[_0x2178('0x11')](_0x2178('0x12'),_0x5119ea,_0x2178('0x13'));logger[_0x2178('0x14')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x5119ea,_0x2178('0x13'),JSON[_0x2178('0x15')](_0x2de258));if(_0x2de258['error']){if(_0x2de258[_0x2178('0x16')][_0x2178('0x17')]===0x1f4){logger[_0x2178('0x16')](_0x2178('0x12'),_0x5119ea,_0x2de258[_0x2178('0x16')]['message']);return _0x33a201(_0x2de258['error']['message']);}logger[_0x2178('0x16')]('MailInteraction,\x20%s,\x20%s',_0x5119ea,_0x2de258[_0x2178('0x16')][_0x2178('0x18')]);return _0x201b7b(_0x2de258['error']['message']);}else{logger[_0x2178('0x11')](_0x2178('0x12'),_0x5119ea,'request\x20sent');_0x201b7b(_0x2de258[_0x2178('0x19')][_0x2178('0x18')]);}})[_0x2178('0x1a')](function(_0x3a6493){logger[_0x2178('0x16')](_0x2178('0x12'),_0x5119ea,_0x3a6493);_0x33a201(_0x3a6493);});});}exports[_0x2178('0x1b')]=function(_0x1833be){var _0x3e308b=this;return new Promise(function(_0x2cb878,_0x1d2dd5){return db[_0x2178('0x1c')]['update'](_0x1833be[_0x2178('0x1d')],{'raw':_0x1833be[_0x2178('0x1e')]?_0x1833be[_0x2178('0x1e')][_0x2178('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1833be[_0x2178('0x1e')]?_0x1833be[_0x2178('0x1e')][_0x2178('0x20')]||null:null,'attributes':_0x1833be[_0x2178('0x1e')]?_0x1833be[_0x2178('0x1e')][_0x2178('0x21')]||null:null,'limit':_0x1833be[_0x2178('0x1e')]?_0x1833be[_0x2178('0x1e')][_0x2178('0x22')]||null:null})[_0x2178('0x10')](function(_0x35dcb9){logger[_0x2178('0x11')](_0x2178('0x1b'),_0x1833be);logger[_0x2178('0x14')](_0x2178('0x1b'),_0x1833be,JSON[_0x2178('0x15')](_0x35dcb9));_0x2cb878(_0x35dcb9);})[_0x2178('0x1a')](function(_0x2b5a0f){logger[_0x2178('0x16')]('UpdateMailInteraction',_0x2b5a0f[_0x2178('0x18')],_0x1833be);_0x1d2dd5(_0x3e308b[_0x2178('0x16')](0x1f4,_0x2b5a0f['message']));});});};exports['AddTagsToMailInteraction']=function(_0x30fbad){return new Promise(function(_0x51c88c,_0xffcd00){return db[_0x2178('0x1c')][_0x2178('0x23')]({'where':_0x30fbad['options']?_0x30fbad['options'][_0x2178('0x20')]||null:null})[_0x2178('0x10')](function(_0x475fdc){if(_0x475fdc){return _0x475fdc['addTags'](_0x30fbad['body'][_0x2178('0x24')],_[_0x2178('0x25')](_0x30fbad[_0x2178('0x1d')],[_0x2178('0x24'),'id'])||{});}})[_0x2178('0x26')](function(_0x23cd38){logger[_0x2178('0x11')]('AddTags',_0x30fbad);logger[_0x2178('0x14')](_0x2178('0x27'),_0x30fbad,JSON['stringify'](_0x23cd38));_0x51c88c(_0x23cd38);})[_0x2178('0x1a')](function(_0x2d13de){logger[_0x2178('0x16')](_0x2178('0x27'),_0x2d13de['message'],_0x30fbad);_0xffcd00(_this[_0x2178('0x16')](0x1f4,_0x2d13de['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index f65c9c8..8e39970 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 _0x7a72=['mailInteraction:','./mailInteraction.events','save','remove','update','removeListener','register','length'];(function(_0x5eb529,_0x43ea86){var _0x48ce78=function(_0x14d14c){while(--_0x14d14c){_0x5eb529['push'](_0x5eb529['shift']());}};_0x48ce78(++_0x43ea86);}(_0x7a72,0x109));var _0x27a7=function(_0x3ca0da,_0x2691f5){_0x3ca0da=_0x3ca0da-0x0;var _0x5298b7=_0x7a72[_0x3ca0da];return _0x5298b7;};'use strict';var MailInteractionEvents=require(_0x27a7('0x0'));var events=[_0x27a7('0x1'),_0x27a7('0x2'),_0x27a7('0x3')];function createListener(_0x540ec6,_0x5b1707){return function(_0x3713a4){_0x5b1707['emit'](_0x540ec6,_0x3713a4);};}function removeListener(_0x1c5b2c,_0x2f56c8){return function(){MailInteractionEvents[_0x27a7('0x4')](_0x1c5b2c,_0x2f56c8);};}exports[_0x27a7('0x5')]=function(_0x1e9593){for(var _0x43051f=0x0,_0x1ac5c7=events[_0x27a7('0x6')];_0x43051f<_0x1ac5c7;_0x43051f++){var _0x17b6e6=events[_0x43051f];var _0x484ed7=createListener(_0x27a7('0x7')+_0x17b6e6,_0x1e9593);MailInteractionEvents['on'](_0x17b6e6,_0x484ed7);}}; \ No newline at end of file +var _0x30cc=['update','mailInteraction:','./mailInteraction.events','save'];(function(_0x14e73d,_0x59fd74){var _0x4c5ef1=function(_0x2ccd70){while(--_0x2ccd70){_0x14e73d['push'](_0x14e73d['shift']());}};_0x4c5ef1(++_0x59fd74);}(_0x30cc,0x1aa));var _0xc30c=function(_0x1943d9,_0x245bb8){_0x1943d9=_0x1943d9-0x0;var _0x4b4f3f=_0x30cc[_0x1943d9];return _0x4b4f3f;};'use strict';var MailInteractionEvents=require(_0xc30c('0x0'));var events=[_0xc30c('0x1'),'remove',_0xc30c('0x2')];function createListener(_0x45dadb,_0x52f234){return function(_0x30d283){_0x52f234['emit'](_0x45dadb,_0x30d283);};}function removeListener(_0x4666dd,_0x4e0cd6){return function(){MailInteractionEvents['removeListener'](_0x4666dd,_0x4e0cd6);};}exports['register']=function(_0x1f0d8c){for(var _0x1634cf=0x0,_0x1a32b7=events['length'];_0x1634cf<_0x1a32b7;_0x1634cf++){var _0x775258=events[_0x1634cf];var _0x22b51f=createListener(_0xc30c('0x3')+_0x775258,_0x1f0d8c);MailInteractionEvents['on'](_0x775258,_0x22b51f);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 3686ffe..1d4936e 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 _0x55ca=['get','isAuthenticated','index','/describe','describe','show','download','post','tracked','mail','mailmessage:create','create','put','/:id','/:id/reject','reject','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./mailMessage.controller'];(function(_0x21b3b9,_0x1e6fe2){var _0x7588e3=function(_0x3f56cf){while(--_0x3f56cf){_0x21b3b9['push'](_0x21b3b9['shift']());}};_0x7588e3(++_0x1e6fe2);}(_0x55ca,0x126));var _0xa55c=function(_0xb4ec3a,_0x2bace0){_0xb4ec3a=_0xb4ec3a-0x0;var _0x1b83db=_0x55ca[_0xb4ec3a];return _0x1b83db;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0x6')]('/:id',auth[_0xa55c('0x7')](),controller[_0xa55c('0xb')]);router['get']('/:id/download',auth[_0xa55c('0x7')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')]('/',auth[_0xa55c('0x7')](),interaction[_0xa55c('0xe')](_0xa55c('0xf'),_0xa55c('0x10')),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth['isAuthenticated'](),controller['update']);router[_0xa55c('0x12')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0xa55c('0x12')](_0xa55c('0x14'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x15')]);router[_0xa55c('0x16')](_0xa55c('0x13'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);module[_0xa55c('0x18')]=router; \ No newline at end of file +var _0xbec5=['/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','mail','mailmessage:create','create','put','/:id/accept','accept'];(function(_0x5d1115,_0x1b6c50){var _0x5249d3=function(_0xf9e51f){while(--_0xf9e51f){_0x5d1115['push'](_0x5d1115['shift']());}};_0x5249d3(++_0x1b6c50);}(_0xbec5,0xe5));var _0x5bec=function(_0x1b25c1,_0x2c6ce6){_0x1b25c1=_0x1b25c1-0x0;var _0x1e4447=_0xbec5[_0x1b25c1];return _0x1e4447;};'use strict';var multer=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var path=require('path');var timeout=require(_0x5bec('0x2'));var express=require(_0x5bec('0x3'));var router=express[_0x5bec('0x4')]();var auth=require(_0x5bec('0x5'));var interaction=require(_0x5bec('0x6'));var config=require('../../config/environment');var controller=require(_0x5bec('0x7'));router[_0x5bec('0x8')]('/',auth[_0x5bec('0x9')](),controller['index']);router[_0x5bec('0x8')](_0x5bec('0xa'),auth[_0x5bec('0x9')](),controller[_0x5bec('0xb')]);router[_0x5bec('0x8')](_0x5bec('0xc'),auth[_0x5bec('0x9')](),controller[_0x5bec('0xd')]);router['get'](_0x5bec('0xe'),auth['isAuthenticated'](),controller[_0x5bec('0xf')]);router[_0x5bec('0x10')]('/',auth[_0x5bec('0x9')](),interaction['tracked'](_0x5bec('0x11'),_0x5bec('0x12')),controller[_0x5bec('0x13')]);router['put'](_0x5bec('0xc'),auth[_0x5bec('0x9')](),controller['update']);router[_0x5bec('0x14')](_0x5bec('0x15'),auth[_0x5bec('0x9')](),controller[_0x5bec('0x16')]);router[_0x5bec('0x14')](_0x5bec('0x17'),auth[_0x5bec('0x9')](),controller[_0x5bec('0x18')]);router[_0x5bec('0x19')](_0x5bec('0xc'),auth[_0x5bec('0x9')](),controller[_0x5bec('0x1a')]);module[_0x5bec('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index b9ee3ba..9108fdd 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 _0x3d65=['long','BOOLEAN','STRING','DATE','ENUM','Email','Chat','sequelize','lodash','exports','TEXT'];(function(_0x19aa66,_0x2dc75a){var _0x4ab50e=function(_0x43f485){while(--_0x43f485){_0x19aa66['push'](_0x19aa66['shift']());}};_0x4ab50e(++_0x2dc75a);}(_0x3d65,0x11a));var _0x53d6=function(_0x4fe5d2,_0x45b077){_0x4fe5d2=_0x4fe5d2-0x0;var _0x107113=_0x3d65[_0x4fe5d2];return _0x107113;};'use strict';var Sequelize=require(_0x53d6('0x0'));var _=require(_0x53d6('0x1'));module[_0x53d6('0x2')]={'body':{'type':Sequelize[_0x53d6('0x3')](_0x53d6('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x53d6('0x3')]('medium')},'read':{'type':Sequelize[_0x53d6('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x53d6('0x6')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0x53d6('0x3')](_0x53d6('0x4'))},'bcc':{'type':Sequelize['TEXT'](_0x53d6('0x4'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x53d6('0x7')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x53d6('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x53d6('0x7')]},'originTo':{'type':Sequelize[_0x53d6('0x3')](_0x53d6('0x4'))},'originCc':{'type':Sequelize[_0x53d6('0x3')](_0x53d6('0x4'))},'originChannel':{'type':Sequelize[_0x53d6('0x8')](_0x53d6('0x9'),_0x53d6('0xa')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0xa87f=['long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email','Chat','sequelize','lodash','TEXT'];(function(_0x3a3b9e,_0xc59037){var _0x148103=function(_0x406731){while(--_0x406731){_0x3a3b9e['push'](_0x3a3b9e['shift']());}};_0x148103(++_0xc59037);}(_0xa87f,0x10e));var _0xfa87=function(_0x2c52d8,_0x3e1b85){_0x2c52d8=_0x2c52d8-0x0;var _0x1c3745=_0xa87f[_0x2c52d8];return _0x1c3745;};'use strict';var Sequelize=require(_0xfa87('0x0'));var _=require(_0xfa87('0x1'));module['exports']={'body':{'type':Sequelize[_0xfa87('0x2')](_0xfa87('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xfa87('0x2')](_0xfa87('0x4'))},'read':{'type':Sequelize[_0xfa87('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfa87('0x6')]('in',_0xfa87('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xfa87('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xfa87('0x2')](_0xfa87('0x3'))},'cc':{'type':Sequelize[_0xfa87('0x2')](_0xfa87('0x3'))},'bcc':{'type':Sequelize['TEXT'](_0xfa87('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xfa87('0x9')]},'attach':{'type':Sequelize[_0xfa87('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xfa87('0x9')]},'originTo':{'type':Sequelize[_0xfa87('0x2')](_0xfa87('0x3'))},'originCc':{'type':Sequelize[_0xfa87('0x2')](_0xfa87('0x3'))},'originChannel':{'type':Sequelize[_0xfa87('0x6')](_0xfa87('0xb'),_0xfa87('0xc')),'defaultValue':_0xfa87('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index dfc16ca..a8fb652 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 _0xa9e0=['sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','MailMessage','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','body','find','describe','create','out','secret','findOne','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','service','host','port','secure','authentication','user','auth','pass','attachments','root','server/files/attachments','basename','ListId','List\x20not\x20found','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','accept','mail','read','readAt','UserId','Contact','get','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','mail-interactions','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','join','server','files','tmp','from','createdAt','Attachment','Attachments','bcc','headers','push','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x13bd80,_0x23202a){var _0x4e19af=function(_0x210a9a){while(--_0x210a9a){_0x13bd80['push'](_0x13bd80['shift']());}};_0x4e19af(++_0x23202a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9003=jayson['client'][_0x0a9e('0x1c')]({'port':0x232b});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x519dfd,_0x16033c,_0x12066b,_0x48f32d){return new BPromise(function(_0x225616,_0x5a0a06){var _0x459eb1=_0x48f32d||client;return _0x459eb1[_0x0a9e('0x1d')](_0x519dfd,_0x12066b)[_0x0a9e('0x1e')](function(_0x205fd6){logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));logger[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x16033c,_0x0a9e('0x21'),JSON[_0x0a9e('0x24')](_0x205fd6));if(_0x205fd6[_0x0a9e('0x25')]){if(_0x205fd6['error'][_0x0a9e('0x26')]===0x1f4){logger[_0x0a9e('0x25')]('MailMessage,\x20%s,\x20%s',_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x5a0a06(_0x205fd6['error'][_0x0a9e('0x27')]);}logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x225616(_0x205fd6[_0x0a9e('0x25')][_0x0a9e('0x27')]);}else{logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));_0x225616(_0x205fd6[_0x0a9e('0x28')][_0x0a9e('0x27')]);}})['catch'](function(_0x59181e){logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x59181e);_0x5a0a06(_0x59181e);});});}function respondWithStatusCode(_0x40c424,_0x33161b){_0x33161b=_0x33161b||0xcc;return function(_0x526cf3){if(_0x526cf3){return _0x40c424[_0x0a9e('0x29')](_0x33161b);}return _0x40c424['status'](_0x33161b)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x5bfb33,_0x1dc186){_0x1dc186=_0x1dc186||0xc8;return function(_0x34dc65){if(_0x34dc65){return _0x5bfb33[_0x0a9e('0x2b')](_0x1dc186)[_0x0a9e('0x2c')](_0x34dc65);}};}function respondWithFilteredResult(_0x140511,_0x1538a4){return function(_0x11c3b6){if(_0x11c3b6){var _0x14de77=_0x11c3b6[_0x0a9e('0x2d')],_0x5a101a=_0x1538a4[_0x0a9e('0x2e')],_0x3652a7=_0x1538a4['offset']+_0x1538a4[_0x0a9e('0x2f')],_0x468813;if(_0x3652a7>=_0x14de77){_0x3652a7=_0x14de77;_0x468813=0xc8;}else{_0x468813=0xce;}_0x140511[_0x0a9e('0x2b')](_0x468813);return _0x140511[_0x0a9e('0x30')](_0x0a9e('0x31'),_0x5a101a+'-'+_0x3652a7+'/'+_0x14de77)[_0x0a9e('0x2c')](_0x11c3b6);}return null;};}function patchUpdates(_0x563b45){return function(_0x296f41){try{jsonpatch[_0x0a9e('0x32')](_0x296f41,_0x563b45,!![]);}catch(_0x1dbde2){return BPromise['reject'](_0x1dbde2);}return _0x296f41[_0x0a9e('0x33')]();};}function saveUpdates(_0x5d1e0e,_0x2407f9){return function(_0x3ae878){if(_0x3ae878){return _0x3ae878[_0x0a9e('0x34')](_0x5d1e0e)[_0x0a9e('0x1e')](function(_0x25ce3a){return _0x25ce3a;});}return null;};}function removeEntity(_0x5180f1,_0x66c1d2){return function(_0x46f0a5){if(_0x46f0a5){return _0x46f0a5[_0x0a9e('0x35')]()[_0x0a9e('0x1e')](function(){_0x5180f1[_0x0a9e('0x2b')](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x332d35,_0x39e565){return function(_0x5583a4){if(!_0x5583a4){_0x332d35[_0x0a9e('0x29')](0x194);}return _0x5583a4;};}function handleError(_0x5e7238,_0x2cc7a0){_0x2cc7a0=_0x2cc7a0||0x1f4;return function(_0x14b13f){logger[_0x0a9e('0x25')](_0x14b13f[_0x0a9e('0x36')]);if(_0x14b13f['name']){delete _0x14b13f[_0x0a9e('0x37')];}_0x5e7238[_0x0a9e('0x2b')](_0x2cc7a0)[_0x0a9e('0x38')](_0x14b13f);};}exports[_0x0a9e('0x39')]=function(_0x4853b1,_0x54135e){var _0x1e8694={},_0x5640eb={},_0x24936a={'count':0x0,'rows':[]};var _0x3d9717=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x31916f){return{'name':_0x31916f[_0x0a9e('0x3c')],'type':_0x31916f[_0x0a9e('0x3d')]['key']};});_0x5640eb[_0x0a9e('0x3e')]=_[_0x0a9e('0x3a')](_0x3d9717,_0x0a9e('0x37'));_0x5640eb['query']=_['keys'](_0x4853b1[_0x0a9e('0x3f')]);_0x5640eb[_0x0a9e('0x40')]=_['intersection'](_0x5640eb[_0x0a9e('0x3e')],_0x5640eb[_0x0a9e('0x3f')]);_0x1e8694[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x5640eb['model'],qs['fields'](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1e8694['attributes']=_0x1e8694[_0x0a9e('0x41')][_0x0a9e('0x44')]?_0x1e8694[_0x0a9e('0x41')]:_0x5640eb['model'];if(!_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x45')](_0x0a9e('0x46'))){_0x1e8694[_0x0a9e('0x2f')]=qs[_0x0a9e('0x2f')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2f')]);_0x1e8694[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2e')]);}_0x1e8694[_0x0a9e('0x47')]=qs[_0x0a9e('0x48')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x1e8694['where']=qs['filters'](_[_0x0a9e('0x49')](_0x4853b1[_0x0a9e('0x3f')],_0x5640eb[_0x0a9e('0x40')]),_0x3d9717);if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]){_0x1e8694[_0x0a9e('0x4b')]=_[_0x0a9e('0x4c')](_0x1e8694[_0x0a9e('0x4b')],{'$or':_[_0x0a9e('0x3a')](_0x3d9717,function(_0x25c6e6){if(_0x25c6e6[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0x5026aa={};_0x5026aa[_0x25c6e6[_0x0a9e('0x37')]]={'$like':'%'+_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]+'%'};return _0x5026aa;}})});}_0x1e8694=_[_0x0a9e('0x4c')]({},_0x1e8694,_0x4853b1[_0x0a9e('0x4e')]);var _0xbe9d19={'where':_0x1e8694[_0x0a9e('0x4b')]};return db[_0x0a9e('0x3b')]['count'](_0xbe9d19)[_0x0a9e('0x1e')](function(_0x48fd45){_0x24936a[_0x0a9e('0x2d')]=_0x48fd45;if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1e8694['include']=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x1e8694);})[_0x0a9e('0x1e')](function(_0x34aa5a){_0x24936a[_0x0a9e('0x51')]=_0x34aa5a;return _0x24936a;})[_0x0a9e('0x1e')](respondWithFilteredResult(_0x54135e,_0x1e8694))[_0x0a9e('0x52')](handleError(_0x54135e,null));};exports['show']=function(_0x13f44d,_0x1bde3c){var _0x1b5e80={'raw':!![],'where':{'id':_0x13f44d[_0x0a9e('0x53')]['id']}},_0x16f976={};_0x16f976[_0x0a9e('0x3e')]=_[_0x0a9e('0x54')](db[_0x0a9e('0x3b')][_0x0a9e('0x55')]);_0x16f976['query']=_[_0x0a9e('0x54')](_0x13f44d[_0x0a9e('0x3f')]);_0x16f976['filters']=_['intersection'](_0x16f976['model'],_0x16f976[_0x0a9e('0x3f')]);_0x1b5e80[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x16f976[_0x0a9e('0x3e')],qs[_0x0a9e('0x43')](_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1b5e80[_0x0a9e('0x41')]=_0x1b5e80['attributes']['length']?_0x1b5e80['attributes']:_0x16f976[_0x0a9e('0x3e')];if(_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1b5e80['include']=[{'all':!![]}];}_0x1b5e80=_[_0x0a9e('0x4c')]({},_0x1b5e80,_0x13f44d[_0x0a9e('0x4e')]);return db['MailMessage']['find'](_0x1b5e80)[_0x0a9e('0x1e')](handleEntityNotFound(_0x1bde3c,null))['then'](respondWithResult(_0x1bde3c,null))[_0x0a9e('0x52')](handleError(_0x1bde3c,null));};exports['update']=function(_0x2e5e62,_0x3c20b2){if(_0x2e5e62[_0x0a9e('0x56')]['id']){delete _0x2e5e62['body']['id'];}return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x2e5e62['params']['id']}})['then'](handleEntityNotFound(_0x3c20b2,null))[_0x0a9e('0x1e')](saveUpdates(_0x2e5e62[_0x0a9e('0x56')],null))['then'](respondWithResult(_0x3c20b2,null))[_0x0a9e('0x52')](handleError(_0x3c20b2,null));};exports['destroy']=function(_0x211ef9,_0x523cd2){return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x211ef9['params']['id']}})['then'](handleEntityNotFound(_0x523cd2,null))[_0x0a9e('0x1e')](removeEntity(_0x523cd2,null))['catch'](handleError(_0x523cd2,null));};exports[_0x0a9e('0x58')]=function(_0x65432,_0x3cfd00){return db[_0x0a9e('0x3b')][_0x0a9e('0x58')]()[_0x0a9e('0x1e')](respondWithResult(_0x3cfd00,null))[_0x0a9e('0x52')](handleError(_0x3cfd00,null));};exports[_0x0a9e('0x59')]=function(_0x4e67ab,_0x1c693e){return db[_0x0a9e('0x3b')][_0x0a9e('0x59')](_0x4e67ab[_0x0a9e('0x56')])[_0x0a9e('0x1e')](function(_0x156662){if(_0x156662){if(_0x156662['direction']===_0x0a9e('0x5a')&&!_0x156662[_0x0a9e('0x5b')]){var _0x5239ef,_0x3649cc,_0x5cc8fb;if(_0x4e67ab[_0x0a9e('0x56')]['to']){_0x3649cc=_0x4e67ab['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0x0a9e('0x5c')]({'where':{'id':_0x156662['MailAccountId']},'include':[{'model':db[_0x0a9e('0x5d')],'as':_0x0a9e('0x5e'),'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x60'),'where':{'email':_0x3649cc},'limit':0x1,'order':[[_0x0a9e('0x61'),_0x0a9e('0x62')]]}]},{'model':db['MailServerOut'],'as':_0x0a9e('0x63'),'raw':!![]}]})['then'](function(_0xca4ade){_0x5239ef=_0xca4ade;if(_0x5239ef&&_0x5239ef[_0x0a9e('0x63')]){var _0x51aaf7={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x64')])){_0x51aaf7[_0x0a9e('0x65')]=_0x5239ef[_0x0a9e('0x63')]['host'];_0x51aaf7[_0x0a9e('0x66')]=_0x5239ef[_0x0a9e('0x63')]['port'];_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];if(_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x68')]){_0x51aaf7['auth']={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')]['pass']};}}else{_0x51aaf7[_0x0a9e('0x64')]=_0x5239ef['Smtp']['service'];_0x51aaf7[_0x0a9e('0x6a')]={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x6b')]};_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];}if(_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')]&&_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')]){for(var _0x2b8192=0x0;_0x2b8192<_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')];_0x2b8192+=0x1){_0x4e67ab[_0x0a9e('0x56')]['attachments'][_0x2b8192]={'filename':_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x37')],'path':path['join'](config[_0x0a9e('0x6d')],_0x0a9e('0x6e'),_0x4e67ab['body'][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x6f')])};}}_0x5cc8fb={'account':_0x51aaf7,'message':_0x4e67ab[_0x0a9e('0x56')]};return;}})[_0x0a9e('0x1e')](function(){if(_0x5239ef[_0x0a9e('0x5e')]){if(_0x5239ef['List']['Contacts']['length']){return _0x5239ef[_0x0a9e('0x5e')][_0x0a9e('0x60')][0x0];}else{return db[_0x0a9e('0x5f')][_0x0a9e('0x59')](_[_0x0a9e('0x16')](_0x4e67ab[_0x0a9e('0x56')],{'firstName':_0x4e67ab[_0x0a9e('0x56')]['to'],'email':_0x4e67ab[_0x0a9e('0x56')]['to'],'phone':_0x4e67ab['body']['to'],'ListId':_0x5239ef[_0x0a9e('0x70')]}));}}else{throw new Error(_0x0a9e('0x71'));}})[_0x0a9e('0x1e')](function(){if(_0x5cc8fb){return respondWithRpcPromise('SendMail',_0x0a9e('0x72'),_0x5cc8fb,client9003)['then'](function(_0x4437ff){return _0x156662[_0x0a9e('0x34')]({'read':!![],'messageId':_0x4437ff['messageId'],'sentAt':moment()[_0x0a9e('0x73')](_0x0a9e('0x74'))});})[_0x0a9e('0x52')](function(_0x317c0c){logger['error']('%s',JSON[_0x0a9e('0x24')](_0x317c0c));return _0x156662;});}return _0x156662;});}return _0x156662;}})[_0x0a9e('0x1e')](respondWithResult(_0x1c693e,0xc9))[_0x0a9e('0x52')](handleError(_0x1c693e,null));};var interaction_log=require(_0x0a9e('0x75'))('mail-interactions');exports[_0x0a9e('0x76')]=function(_0x3d91db,_0x2d5506,_0x361b21){var _0x4abc8f={'agent':{},'channel':_0x0a9e('0x77')};if(_0x3d91db[_0x0a9e('0x56')]['id']){delete _0x3d91db[_0x0a9e('0x56')]['id'];}_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x78')]=!![];_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x79')]=moment()[_0x0a9e('0x73')](_0x0a9e('0x74'));_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]||_0x3d91db[_0x0a9e('0x69')]['id'];_0x4abc8f['agent']['id']=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x3d91db[_0x0a9e('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x7b')}]})[_0x0a9e('0x1e')](handleEntityNotFound(_0x2d5506,null))['then'](saveUpdates(_0x3d91db['body'],null))[_0x0a9e('0x1e')](function(_0x2bbdb5){if(_0x2bbdb5){_0x4abc8f['message']=_0x2bbdb5[_0x0a9e('0x7c')]({'plain':!![]});return db['MailInteraction'][_0x0a9e('0x57')]({'where':{'id':_0x2bbdb5[_0x0a9e('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x2d5506,null))[_0x0a9e('0x1e')](function(_0x41cf12){if(_0x41cf12){return _0x41cf12[_0x0a9e('0x34')]({'UserId':_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')],'read1stAt':_[_0x0a9e('0x7e')](_0x41cf12[_0x0a9e('0x7f')])?moment()['format'](_0x0a9e('0x74')):undefined});}return null;})[_0x0a9e('0x1e')](function(_0x45c109){if(_0x45c109){_0x4abc8f[_0x0a9e('0x80')]=_0x45c109['get']({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x81'),_0x3d91db['user']['id'],_0x3d91db[_0x0a9e('0x69')]['name'],_0x3d91db[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x4abc8f[_0x0a9e('0x80')]['id'],_0x3d91db[_0x0a9e('0x56')]?JSON['stringify'](_0x3d91db['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x84'),_0x0a9e('0x85'),_0x4abc8f);}return null;})['then'](function(_0x3b4a9f){if(_0x3b4a9f){if(_0x3d91db[_0x0a9e('0x56')]['manual']){_0x4abc8f['message'][_0x0a9e('0x86')]=util['format']('SIP/%s',_0x3d91db['user'][_0x0a9e('0x37')]);_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x4abc8f[_0x0a9e('0x87')];_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x88')]='accept';return respondWithRpcPromise(_0x0a9e('0x89'),'EventManager',{'event':_0x0a9e('0x8a'),'message':_0x4abc8f[_0x0a9e('0x27')]},client9002)[_0x0a9e('0x1e')](function(){return _0x4abc8f;});}return _0x4abc8f;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0x2d5506,null))['catch'](handleError(_0x2d5506,null));};var interaction_log=require(_0x0a9e('0x75'))(_0x0a9e('0x8b'));exports[_0x0a9e('0x8c')]=function(_0x5b74c3,_0xb6e411,_0x21e592){var _0x2a563d={'agent':{},'channel':_0x0a9e('0x77')};if(_0x5b74c3[_0x0a9e('0x56')]['id']){delete _0x5b74c3[_0x0a9e('0x56')]['id'];}_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x5b74c3['body'][_0x0a9e('0x7a')]||_0x5b74c3[_0x0a9e('0x69')]['id'];_0x2a563d['agent']['id']=_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5b74c3[_0x0a9e('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xb6e411,null))[_0x0a9e('0x1e')](function(_0x2b5148){if(_0x2b5148){_0x2a563d[_0x0a9e('0x27')]=_0x2b5148[_0x0a9e('0x7c')]({'plain':!![]});return db[_0x0a9e('0x8d')][_0x0a9e('0x57')]({'where':{'id':_0x2b5148[_0x0a9e('0x7d')]}});}return null;})[_0x0a9e('0x1e')](handleEntityNotFound(_0xb6e411,null))['then'](function(_0x329d88){if(_0x329d88){_0x2a563d[_0x0a9e('0x80')]=_0x329d88[_0x0a9e('0x7c')]({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x8e'),_0x5b74c3[_0x0a9e('0x69')]['id'],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x37')],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x2a563d[_0x0a9e('0x80')]['id'],_0x5b74c3[_0x0a9e('0x56')]?JSON[_0x0a9e('0x24')](_0x5b74c3['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x8f'),_0x0a9e('0x90'),_0x2a563d);}return null;})[_0x0a9e('0x1e')](function(_0xb0599a){if(_0xb0599a){_0xb0599a['message'][_0x0a9e('0x86')]=util[_0x0a9e('0x73')]('SIP/%s',_0x5b74c3[_0x0a9e('0x69')]['name']);_0xb0599a[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x2a563d[_0x0a9e('0x87')];_0xb0599a[_0x0a9e('0x27')]['event']=_0x0a9e('0x8c');respondWithRpcPromise('EventManager',_0x0a9e('0x89'),{'event':_0x0a9e('0x91'),'message':_0xb0599a['message']},client9002);return _0x2a563d;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0xb6e411,null))[_0x0a9e('0x52')](handleError(_0xb6e411,null));};exports[_0x0a9e('0x92')]=function(_0x4ab276,_0x4c788f){var _0x1b82b7=moment()[_0x0a9e('0x93')]()[_0x0a9e('0x94')]();var _0x413190=path[_0x0a9e('0x95')](config[_0x0a9e('0x6d')],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x98'));var _0x586510=path[_0x0a9e('0x95')](config['root'],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x6c'));var _0x28ce92=util[_0x0a9e('0x73')]('message-%s.eml',_0x1b82b7);return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x4ab276[_0x0a9e('0x53')]['id']},'attributes':['id',_0x0a9e('0x56'),_0x0a9e('0x99'),'to','cc','bcc','subject',_0x0a9e('0x9a')],'include':_0x4ab276['query'][_0x0a9e('0x6c')]?[{'model':db[_0x0a9e('0x9b')],'as':_0x0a9e('0x9c')}]:undefined})[_0x0a9e('0x1e')](handleEntityNotFound(_0x4c788f,null))[_0x0a9e('0x1e')](function(_0x213e5d){if(_0x213e5d){var _0x596312=_0x213e5d;var _0x4db918={'from':_0x596312[_0x0a9e('0x99')],'to':_0x596312['to'],'subject':_0x596312['subject'],'html':_0x596312[_0x0a9e('0x56')],'headers':{'Date':moment(_0x596312['createdAt'])[_0x0a9e('0x73')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x213e5d['cc']){_0x4db918['headers']['Cc']=_0x213e5d['cc'];}if(_0x213e5d[_0x0a9e('0x9d')]){_0x4db918[_0x0a9e('0x9e')]['Bcc']=_0x213e5d[_0x0a9e('0x9d')];}return new BPromise(function(_0x17cb30,_0x15c6b9){if(_0x213e5d[_0x0a9e('0x9c')]){for(var _0x2eb028=0x0;_0x2eb028<_0x213e5d['Attachments']['length'];_0x2eb028++){var _0x16449b=_0x213e5d[_0x0a9e('0x9c')][_0x2eb028];var _0x41c8cd=path[_0x0a9e('0x95')](_0x586510,_0x16449b[_0x0a9e('0x6f')]);if(fs['existsSync'](_0x41c8cd)){_0x4db918[_0x0a9e('0x6c')][_0x0a9e('0x9f')]({'name':_0x16449b['name'],'contentType':_0x16449b[_0x0a9e('0x3d')],'data':fs[_0x0a9e('0xa0')](_0x41c8cd)});}}}emlformat[_0x0a9e('0xa1')](_0x4db918,function(_0x2427d5,_0x23b25b){if(_0x2427d5)return _0x15c6b9(_0x2427d5);fs[_0x0a9e('0xa2')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92),_0x23b25b);return _0x17cb30(_0x23b25b);});});}})[_0x0a9e('0x1e')](function(_0x40dd2a){if(_0x40dd2a){return _0x4c788f[_0x0a9e('0x92')](path['join'](_0x413190,_0x28ce92),_0x28ce92,function(_0x1065a7){if(_0x1065a7){console[_0x0a9e('0xa3')](_0x0a9e('0xa4'),_0x1065a7);}else{fs[_0x0a9e('0xa5')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92));}});}})['catch'](handleError(_0x4c788f,null));}; \ No newline at end of file +var _0xa9e0=['sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','MailMessage','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','body','find','describe','create','out','secret','findOne','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','service','host','port','secure','authentication','user','auth','pass','attachments','root','server/files/attachments','basename','ListId','List\x20not\x20found','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','accept','mail','read','readAt','UserId','Contact','get','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','channel','event','EventManager','acceptmessage','mail-interactions','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','download','unix','toString','join','server','files','tmp','from','createdAt','Attachment','Attachments','bcc','headers','push','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0xa91d97,_0x50ef5c){var _0x2afc4b=function(_0x2f0d8f){while(--_0x2f0d8f){_0xa91d97['push'](_0xa91d97['shift']());}};_0x2afc4b(++_0x50ef5c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9003=jayson['client'][_0x0a9e('0x1c')]({'port':0x232b});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x519dfd,_0x16033c,_0x12066b,_0x48f32d){return new BPromise(function(_0x225616,_0x5a0a06){var _0x459eb1=_0x48f32d||client;return _0x459eb1[_0x0a9e('0x1d')](_0x519dfd,_0x12066b)[_0x0a9e('0x1e')](function(_0x205fd6){logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));logger[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x16033c,_0x0a9e('0x21'),JSON[_0x0a9e('0x24')](_0x205fd6));if(_0x205fd6[_0x0a9e('0x25')]){if(_0x205fd6['error'][_0x0a9e('0x26')]===0x1f4){logger[_0x0a9e('0x25')]('MailMessage,\x20%s,\x20%s',_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x5a0a06(_0x205fd6['error'][_0x0a9e('0x27')]);}logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x205fd6[_0x0a9e('0x25')]['message']);return _0x225616(_0x205fd6[_0x0a9e('0x25')][_0x0a9e('0x27')]);}else{logger[_0x0a9e('0x1f')](_0x0a9e('0x20'),_0x16033c,_0x0a9e('0x21'));_0x225616(_0x205fd6[_0x0a9e('0x28')][_0x0a9e('0x27')]);}})['catch'](function(_0x59181e){logger[_0x0a9e('0x25')](_0x0a9e('0x20'),_0x16033c,_0x59181e);_0x5a0a06(_0x59181e);});});}function respondWithStatusCode(_0x40c424,_0x33161b){_0x33161b=_0x33161b||0xcc;return function(_0x526cf3){if(_0x526cf3){return _0x40c424[_0x0a9e('0x29')](_0x33161b);}return _0x40c424['status'](_0x33161b)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x5bfb33,_0x1dc186){_0x1dc186=_0x1dc186||0xc8;return function(_0x34dc65){if(_0x34dc65){return _0x5bfb33[_0x0a9e('0x2b')](_0x1dc186)[_0x0a9e('0x2c')](_0x34dc65);}};}function respondWithFilteredResult(_0x140511,_0x1538a4){return function(_0x11c3b6){if(_0x11c3b6){var _0x14de77=_0x11c3b6[_0x0a9e('0x2d')],_0x5a101a=_0x1538a4[_0x0a9e('0x2e')],_0x3652a7=_0x1538a4['offset']+_0x1538a4[_0x0a9e('0x2f')],_0x468813;if(_0x3652a7>=_0x14de77){_0x3652a7=_0x14de77;_0x468813=0xc8;}else{_0x468813=0xce;}_0x140511[_0x0a9e('0x2b')](_0x468813);return _0x140511[_0x0a9e('0x30')](_0x0a9e('0x31'),_0x5a101a+'-'+_0x3652a7+'/'+_0x14de77)[_0x0a9e('0x2c')](_0x11c3b6);}return null;};}function patchUpdates(_0x563b45){return function(_0x296f41){try{jsonpatch[_0x0a9e('0x32')](_0x296f41,_0x563b45,!![]);}catch(_0x1dbde2){return BPromise['reject'](_0x1dbde2);}return _0x296f41[_0x0a9e('0x33')]();};}function saveUpdates(_0x5d1e0e,_0x2407f9){return function(_0x3ae878){if(_0x3ae878){return _0x3ae878[_0x0a9e('0x34')](_0x5d1e0e)[_0x0a9e('0x1e')](function(_0x25ce3a){return _0x25ce3a;});}return null;};}function removeEntity(_0x5180f1,_0x66c1d2){return function(_0x46f0a5){if(_0x46f0a5){return _0x46f0a5[_0x0a9e('0x35')]()[_0x0a9e('0x1e')](function(){_0x5180f1[_0x0a9e('0x2b')](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x332d35,_0x39e565){return function(_0x5583a4){if(!_0x5583a4){_0x332d35[_0x0a9e('0x29')](0x194);}return _0x5583a4;};}function handleError(_0x5e7238,_0x2cc7a0){_0x2cc7a0=_0x2cc7a0||0x1f4;return function(_0x14b13f){logger[_0x0a9e('0x25')](_0x14b13f[_0x0a9e('0x36')]);if(_0x14b13f['name']){delete _0x14b13f[_0x0a9e('0x37')];}_0x5e7238[_0x0a9e('0x2b')](_0x2cc7a0)[_0x0a9e('0x38')](_0x14b13f);};}exports[_0x0a9e('0x39')]=function(_0x4853b1,_0x54135e){var _0x1e8694={},_0x5640eb={},_0x24936a={'count':0x0,'rows':[]};var _0x3d9717=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x31916f){return{'name':_0x31916f[_0x0a9e('0x3c')],'type':_0x31916f[_0x0a9e('0x3d')]['key']};});_0x5640eb[_0x0a9e('0x3e')]=_[_0x0a9e('0x3a')](_0x3d9717,_0x0a9e('0x37'));_0x5640eb['query']=_['keys'](_0x4853b1[_0x0a9e('0x3f')]);_0x5640eb[_0x0a9e('0x40')]=_['intersection'](_0x5640eb[_0x0a9e('0x3e')],_0x5640eb[_0x0a9e('0x3f')]);_0x1e8694[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x5640eb['model'],qs['fields'](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1e8694['attributes']=_0x1e8694[_0x0a9e('0x41')][_0x0a9e('0x44')]?_0x1e8694[_0x0a9e('0x41')]:_0x5640eb['model'];if(!_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x45')](_0x0a9e('0x46'))){_0x1e8694[_0x0a9e('0x2f')]=qs[_0x0a9e('0x2f')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2f')]);_0x1e8694[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x2e')]);}_0x1e8694[_0x0a9e('0x47')]=qs[_0x0a9e('0x48')](_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x1e8694['where']=qs['filters'](_[_0x0a9e('0x49')](_0x4853b1[_0x0a9e('0x3f')],_0x5640eb[_0x0a9e('0x40')]),_0x3d9717);if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]){_0x1e8694[_0x0a9e('0x4b')]=_[_0x0a9e('0x4c')](_0x1e8694[_0x0a9e('0x4b')],{'$or':_[_0x0a9e('0x3a')](_0x3d9717,function(_0x25c6e6){if(_0x25c6e6[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0x5026aa={};_0x5026aa[_0x25c6e6[_0x0a9e('0x37')]]={'$like':'%'+_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4a')]+'%'};return _0x5026aa;}})});}_0x1e8694=_[_0x0a9e('0x4c')]({},_0x1e8694,_0x4853b1[_0x0a9e('0x4e')]);var _0xbe9d19={'where':_0x1e8694[_0x0a9e('0x4b')]};return db[_0x0a9e('0x3b')]['count'](_0xbe9d19)[_0x0a9e('0x1e')](function(_0x48fd45){_0x24936a[_0x0a9e('0x2d')]=_0x48fd45;if(_0x4853b1[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1e8694['include']=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x1e8694);})[_0x0a9e('0x1e')](function(_0x34aa5a){_0x24936a[_0x0a9e('0x51')]=_0x34aa5a;return _0x24936a;})[_0x0a9e('0x1e')](respondWithFilteredResult(_0x54135e,_0x1e8694))[_0x0a9e('0x52')](handleError(_0x54135e,null));};exports['show']=function(_0x13f44d,_0x1bde3c){var _0x1b5e80={'raw':!![],'where':{'id':_0x13f44d[_0x0a9e('0x53')]['id']}},_0x16f976={};_0x16f976[_0x0a9e('0x3e')]=_[_0x0a9e('0x54')](db[_0x0a9e('0x3b')][_0x0a9e('0x55')]);_0x16f976['query']=_[_0x0a9e('0x54')](_0x13f44d[_0x0a9e('0x3f')]);_0x16f976['filters']=_['intersection'](_0x16f976['model'],_0x16f976[_0x0a9e('0x3f')]);_0x1b5e80[_0x0a9e('0x41')]=_[_0x0a9e('0x42')](_0x16f976[_0x0a9e('0x3e')],qs[_0x0a9e('0x43')](_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x1b5e80[_0x0a9e('0x41')]=_0x1b5e80['attributes']['length']?_0x1b5e80['attributes']:_0x16f976[_0x0a9e('0x3e')];if(_0x13f44d[_0x0a9e('0x3f')][_0x0a9e('0x4f')]){_0x1b5e80['include']=[{'all':!![]}];}_0x1b5e80=_[_0x0a9e('0x4c')]({},_0x1b5e80,_0x13f44d[_0x0a9e('0x4e')]);return db['MailMessage']['find'](_0x1b5e80)[_0x0a9e('0x1e')](handleEntityNotFound(_0x1bde3c,null))['then'](respondWithResult(_0x1bde3c,null))[_0x0a9e('0x52')](handleError(_0x1bde3c,null));};exports['update']=function(_0x2e5e62,_0x3c20b2){if(_0x2e5e62[_0x0a9e('0x56')]['id']){delete _0x2e5e62['body']['id'];}return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x2e5e62['params']['id']}})['then'](handleEntityNotFound(_0x3c20b2,null))[_0x0a9e('0x1e')](saveUpdates(_0x2e5e62[_0x0a9e('0x56')],null))['then'](respondWithResult(_0x3c20b2,null))[_0x0a9e('0x52')](handleError(_0x3c20b2,null));};exports['destroy']=function(_0x211ef9,_0x523cd2){return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x211ef9['params']['id']}})['then'](handleEntityNotFound(_0x523cd2,null))[_0x0a9e('0x1e')](removeEntity(_0x523cd2,null))['catch'](handleError(_0x523cd2,null));};exports[_0x0a9e('0x58')]=function(_0x65432,_0x3cfd00){return db[_0x0a9e('0x3b')][_0x0a9e('0x58')]()[_0x0a9e('0x1e')](respondWithResult(_0x3cfd00,null))[_0x0a9e('0x52')](handleError(_0x3cfd00,null));};exports[_0x0a9e('0x59')]=function(_0x4e67ab,_0x1c693e){return db[_0x0a9e('0x3b')][_0x0a9e('0x59')](_0x4e67ab[_0x0a9e('0x56')])[_0x0a9e('0x1e')](function(_0x156662){if(_0x156662){if(_0x156662['direction']===_0x0a9e('0x5a')&&!_0x156662[_0x0a9e('0x5b')]){var _0x5239ef,_0x3649cc,_0x5cc8fb;if(_0x4e67ab[_0x0a9e('0x56')]['to']){_0x3649cc=_0x4e67ab['body']['to']['split'](',')[0x0];}return db['MailAccount'][_0x0a9e('0x5c')]({'where':{'id':_0x156662['MailAccountId']},'include':[{'model':db[_0x0a9e('0x5d')],'as':_0x0a9e('0x5e'),'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x60'),'where':{'email':_0x3649cc},'limit':0x1,'order':[[_0x0a9e('0x61'),_0x0a9e('0x62')]]}]},{'model':db['MailServerOut'],'as':_0x0a9e('0x63'),'raw':!![]}]})['then'](function(_0xca4ade){_0x5239ef=_0xca4ade;if(_0x5239ef&&_0x5239ef[_0x0a9e('0x63')]){var _0x51aaf7={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x64')])){_0x51aaf7[_0x0a9e('0x65')]=_0x5239ef[_0x0a9e('0x63')]['host'];_0x51aaf7[_0x0a9e('0x66')]=_0x5239ef[_0x0a9e('0x63')]['port'];_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];if(_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x68')]){_0x51aaf7['auth']={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')]['pass']};}}else{_0x51aaf7[_0x0a9e('0x64')]=_0x5239ef['Smtp']['service'];_0x51aaf7[_0x0a9e('0x6a')]={'user':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x69')],'pass':_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x6b')]};_0x51aaf7[_0x0a9e('0x67')]=_0x5239ef[_0x0a9e('0x63')][_0x0a9e('0x67')];}if(_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')]&&_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')]){for(var _0x2b8192=0x0;_0x2b8192<_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x0a9e('0x44')];_0x2b8192+=0x1){_0x4e67ab[_0x0a9e('0x56')]['attachments'][_0x2b8192]={'filename':_0x4e67ab[_0x0a9e('0x56')][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x37')],'path':path['join'](config[_0x0a9e('0x6d')],_0x0a9e('0x6e'),_0x4e67ab['body'][_0x0a9e('0x6c')][_0x2b8192][_0x0a9e('0x6f')])};}}_0x5cc8fb={'account':_0x51aaf7,'message':_0x4e67ab[_0x0a9e('0x56')]};return;}})[_0x0a9e('0x1e')](function(){if(_0x5239ef[_0x0a9e('0x5e')]){if(_0x5239ef['List']['Contacts']['length']){return _0x5239ef[_0x0a9e('0x5e')][_0x0a9e('0x60')][0x0];}else{return db[_0x0a9e('0x5f')][_0x0a9e('0x59')](_[_0x0a9e('0x16')](_0x4e67ab[_0x0a9e('0x56')],{'firstName':_0x4e67ab[_0x0a9e('0x56')]['to'],'email':_0x4e67ab[_0x0a9e('0x56')]['to'],'phone':_0x4e67ab['body']['to'],'ListId':_0x5239ef[_0x0a9e('0x70')]}));}}else{throw new Error(_0x0a9e('0x71'));}})[_0x0a9e('0x1e')](function(){if(_0x5cc8fb){return respondWithRpcPromise('SendMail',_0x0a9e('0x72'),_0x5cc8fb,client9003)['then'](function(_0x4437ff){return _0x156662[_0x0a9e('0x34')]({'read':!![],'messageId':_0x4437ff['messageId'],'sentAt':moment()[_0x0a9e('0x73')](_0x0a9e('0x74'))});})[_0x0a9e('0x52')](function(_0x317c0c){logger['error']('%s',JSON[_0x0a9e('0x24')](_0x317c0c));return _0x156662;});}return _0x156662;});}return _0x156662;}})[_0x0a9e('0x1e')](respondWithResult(_0x1c693e,0xc9))[_0x0a9e('0x52')](handleError(_0x1c693e,null));};var interaction_log=require(_0x0a9e('0x75'))('mail-interactions');exports[_0x0a9e('0x76')]=function(_0x3d91db,_0x2d5506,_0x361b21){var _0x4abc8f={'agent':{},'channel':_0x0a9e('0x77')};if(_0x3d91db[_0x0a9e('0x56')]['id']){delete _0x3d91db[_0x0a9e('0x56')]['id'];}_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x78')]=!![];_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x79')]=moment()[_0x0a9e('0x73')](_0x0a9e('0x74'));_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')]||_0x3d91db[_0x0a9e('0x69')]['id'];_0x4abc8f['agent']['id']=_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x3d91db[_0x0a9e('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x5f')],'as':_0x0a9e('0x7b')}]})[_0x0a9e('0x1e')](handleEntityNotFound(_0x2d5506,null))['then'](saveUpdates(_0x3d91db['body'],null))[_0x0a9e('0x1e')](function(_0x2bbdb5){if(_0x2bbdb5){_0x4abc8f['message']=_0x2bbdb5[_0x0a9e('0x7c')]({'plain':!![]});return db['MailInteraction'][_0x0a9e('0x57')]({'where':{'id':_0x2bbdb5[_0x0a9e('0x7d')]}});}return null;})['then'](handleEntityNotFound(_0x2d5506,null))[_0x0a9e('0x1e')](function(_0x41cf12){if(_0x41cf12){return _0x41cf12[_0x0a9e('0x34')]({'UserId':_0x3d91db[_0x0a9e('0x56')][_0x0a9e('0x7a')],'read1stAt':_[_0x0a9e('0x7e')](_0x41cf12[_0x0a9e('0x7f')])?moment()['format'](_0x0a9e('0x74')):undefined});}return null;})[_0x0a9e('0x1e')](function(_0x45c109){if(_0x45c109){_0x4abc8f[_0x0a9e('0x80')]=_0x45c109['get']({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x81'),_0x3d91db['user']['id'],_0x3d91db[_0x0a9e('0x69')]['name'],_0x3d91db[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x4abc8f[_0x0a9e('0x80')]['id'],_0x3d91db[_0x0a9e('0x56')]?JSON['stringify'](_0x3d91db['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x84'),_0x0a9e('0x85'),_0x4abc8f);}return null;})['then'](function(_0x3b4a9f){if(_0x3b4a9f){if(_0x3d91db[_0x0a9e('0x56')]['manual']){_0x4abc8f['message'][_0x0a9e('0x86')]=util['format']('SIP/%s',_0x3d91db['user'][_0x0a9e('0x37')]);_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x4abc8f[_0x0a9e('0x87')];_0x4abc8f[_0x0a9e('0x27')][_0x0a9e('0x88')]='accept';return respondWithRpcPromise(_0x0a9e('0x89'),'EventManager',{'event':_0x0a9e('0x8a'),'message':_0x4abc8f[_0x0a9e('0x27')]},client9002)[_0x0a9e('0x1e')](function(){return _0x4abc8f;});}return _0x4abc8f;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0x2d5506,null))['catch'](handleError(_0x2d5506,null));};var interaction_log=require(_0x0a9e('0x75'))(_0x0a9e('0x8b'));exports[_0x0a9e('0x8c')]=function(_0x5b74c3,_0xb6e411,_0x21e592){var _0x2a563d={'agent':{},'channel':_0x0a9e('0x77')};if(_0x5b74c3[_0x0a9e('0x56')]['id']){delete _0x5b74c3[_0x0a9e('0x56')]['id'];}_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')]=_0x5b74c3['body'][_0x0a9e('0x7a')]||_0x5b74c3[_0x0a9e('0x69')]['id'];_0x2a563d['agent']['id']=_0x5b74c3[_0x0a9e('0x56')][_0x0a9e('0x7a')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5b74c3[_0x0a9e('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xb6e411,null))[_0x0a9e('0x1e')](function(_0x2b5148){if(_0x2b5148){_0x2a563d[_0x0a9e('0x27')]=_0x2b5148[_0x0a9e('0x7c')]({'plain':!![]});return db[_0x0a9e('0x8d')][_0x0a9e('0x57')]({'where':{'id':_0x2b5148[_0x0a9e('0x7d')]}});}return null;})[_0x0a9e('0x1e')](handleEntityNotFound(_0xb6e411,null))['then'](function(_0x329d88){if(_0x329d88){_0x2a563d[_0x0a9e('0x80')]=_0x329d88[_0x0a9e('0x7c')]({'plain':!![]});interaction_log[_0x0a9e('0x1f')](_0x0a9e('0x8e'),_0x5b74c3[_0x0a9e('0x69')]['id'],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x37')],_0x5b74c3[_0x0a9e('0x69')][_0x0a9e('0x82')],_0x2a563d[_0x0a9e('0x80')]['id'],_0x5b74c3[_0x0a9e('0x56')]?JSON[_0x0a9e('0x24')](_0x5b74c3['body']):_0x0a9e('0x83'));return respondWithRpcPromise(_0x0a9e('0x8f'),_0x0a9e('0x90'),_0x2a563d);}return null;})[_0x0a9e('0x1e')](function(_0xb0599a){if(_0xb0599a){_0xb0599a['message'][_0x0a9e('0x86')]=util[_0x0a9e('0x73')]('SIP/%s',_0x5b74c3[_0x0a9e('0x69')]['name']);_0xb0599a[_0x0a9e('0x27')][_0x0a9e('0x87')]=_0x2a563d[_0x0a9e('0x87')];_0xb0599a[_0x0a9e('0x27')]['event']=_0x0a9e('0x8c');respondWithRpcPromise('EventManager',_0x0a9e('0x89'),{'event':_0x0a9e('0x91'),'message':_0xb0599a['message']},client9002);return _0x2a563d;}return null;})[_0x0a9e('0x1e')](respondWithResult(_0xb6e411,null))[_0x0a9e('0x52')](handleError(_0xb6e411,null));};exports[_0x0a9e('0x92')]=function(_0x4ab276,_0x4c788f){var _0x1b82b7=moment()[_0x0a9e('0x93')]()[_0x0a9e('0x94')]();var _0x413190=path[_0x0a9e('0x95')](config[_0x0a9e('0x6d')],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x98'));var _0x586510=path[_0x0a9e('0x95')](config['root'],_0x0a9e('0x96'),_0x0a9e('0x97'),_0x0a9e('0x6c'));var _0x28ce92=util[_0x0a9e('0x73')]('message-%s.eml',_0x1b82b7);return db[_0x0a9e('0x3b')][_0x0a9e('0x57')]({'where':{'id':_0x4ab276[_0x0a9e('0x53')]['id']},'attributes':['id',_0x0a9e('0x56'),_0x0a9e('0x99'),'to','cc','bcc','subject',_0x0a9e('0x9a')],'include':_0x4ab276['query'][_0x0a9e('0x6c')]?[{'model':db[_0x0a9e('0x9b')],'as':_0x0a9e('0x9c')}]:undefined})[_0x0a9e('0x1e')](handleEntityNotFound(_0x4c788f,null))[_0x0a9e('0x1e')](function(_0x213e5d){if(_0x213e5d){var _0x596312=_0x213e5d;var _0x4db918={'from':_0x596312[_0x0a9e('0x99')],'to':_0x596312['to'],'subject':_0x596312['subject'],'html':_0x596312[_0x0a9e('0x56')],'headers':{'Date':moment(_0x596312['createdAt'])[_0x0a9e('0x73')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x213e5d['cc']){_0x4db918['headers']['Cc']=_0x213e5d['cc'];}if(_0x213e5d[_0x0a9e('0x9d')]){_0x4db918[_0x0a9e('0x9e')]['Bcc']=_0x213e5d[_0x0a9e('0x9d')];}return new BPromise(function(_0x17cb30,_0x15c6b9){if(_0x213e5d[_0x0a9e('0x9c')]){for(var _0x2eb028=0x0;_0x2eb028<_0x213e5d['Attachments']['length'];_0x2eb028++){var _0x16449b=_0x213e5d[_0x0a9e('0x9c')][_0x2eb028];var _0x41c8cd=path[_0x0a9e('0x95')](_0x586510,_0x16449b[_0x0a9e('0x6f')]);if(fs['existsSync'](_0x41c8cd)){_0x4db918[_0x0a9e('0x6c')][_0x0a9e('0x9f')]({'name':_0x16449b['name'],'contentType':_0x16449b[_0x0a9e('0x3d')],'data':fs[_0x0a9e('0xa0')](_0x41c8cd)});}}}emlformat[_0x0a9e('0xa1')](_0x4db918,function(_0x2427d5,_0x23b25b){if(_0x2427d5)return _0x15c6b9(_0x2427d5);fs[_0x0a9e('0xa2')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92),_0x23b25b);return _0x17cb30(_0x23b25b);});});}})[_0x0a9e('0x1e')](function(_0x40dd2a){if(_0x40dd2a){return _0x4c788f[_0x0a9e('0x92')](path['join'](_0x413190,_0x28ce92),_0x28ce92,function(_0x1065a7){if(_0x1065a7){console[_0x0a9e('0xa3')](_0x0a9e('0xa4'),_0x1065a7);}else{fs[_0x0a9e('0xa5')](path[_0x0a9e('0x95')](_0x413190,_0x28ce92));}});}})['catch'](handleError(_0x4c788f,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 4be9a42..b496c45 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 _0xa508=['hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit'];(function(_0x5e657e,_0xe942d6){var _0x2690af=function(_0x530275){while(--_0x530275){_0x5e657e['push'](_0x5e657e['shift']());}};_0x2690af(++_0xe942d6);}(_0xa508,0x18f));var _0x8a50=function(_0x5a4e85,_0x30ba85){_0x5a4e85=_0x5a4e85-0x0;var _0x209aa7=_0xa508[_0x5a4e85];return _0x209aa7;};'use strict';var EventEmitter=require(_0x8a50('0x0'));var MailMessage=require(_0x8a50('0x1'))['db'][_0x8a50('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x8a50('0x3')](0x0);var events={'afterCreate':_0x8a50('0x4'),'afterUpdate':_0x8a50('0x5'),'afterDestroy':_0x8a50('0x6')};function emitEvent(_0x437b30){return function(_0x15d7ba,_0xd73afa,_0xd1ede2){MailMessageEvents[_0x8a50('0x7')](_0x437b30+':'+_0x15d7ba['id'],_0x15d7ba);MailMessageEvents[_0x8a50('0x7')](_0x437b30,_0x15d7ba);_0xd1ede2(null);};}for(var e in events){if(events[_0x8a50('0x8')](e)){var event=events[e];MailMessage[_0x8a50('0x9')](e,emitEvent(event));}}module[_0x8a50('0xa')]=MailMessageEvents; \ No newline at end of file +var _0xfed2=['exports','events','../../mysqldb','MailMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x384f2d,_0x3a41da){var _0x1037c2=function(_0x1dd34f){while(--_0x1dd34f){_0x384f2d['push'](_0x384f2d['shift']());}};_0x1037c2(++_0x3a41da);}(_0xfed2,0x1af));var _0x2fed=function(_0x896682,_0x2a69b9){_0x896682=_0x896682-0x0;var _0x9dcfc6=_0xfed2[_0x896682];return _0x9dcfc6;};'use strict';var EventEmitter=require(_0x2fed('0x0'));var MailMessage=require(_0x2fed('0x1'))['db'][_0x2fed('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x2fed('0x3')](0x0);var events={'afterCreate':_0x2fed('0x4'),'afterUpdate':'update','afterDestroy':_0x2fed('0x5')};function emitEvent(_0x1eb875){return function(_0x265ff9,_0x5353cf,_0x5e467a){MailMessageEvents[_0x2fed('0x6')](_0x1eb875+':'+_0x265ff9['id'],_0x265ff9);MailMessageEvents[_0x2fed('0x6')](_0x1eb875,_0x265ff9);_0x5e467a(null);};}for(var e in events){if(events[_0x2fed('0x7')](e)){var event=events[e];MailMessage[_0x2fed('0x8')](e,emitEvent(event));}}module[_0x2fed('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 9bb7b26..2c7b205 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 _0x5a04=['subject','FULLTEXT','body','get','direction','toLowerCase','out','isNil','UserId','findOne','MailInteractionId','then','update','catch','error','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','../../config/environment','exports','define','MailMessage','messageId','fti_mail_messages','plainBody'];(function(_0x131f2b,_0x52b085){var _0x245d8c=function(_0x49a492){while(--_0x49a492){_0x131f2b['push'](_0x131f2b['shift']());}};_0x245d8c(++_0x52b085);}(_0x5a04,0xab));var _0x45a0=function(_0x568d6f,_0x1e579d){_0x568d6f=_0x568d6f-0x0;var _0x29597b=_0x5a04[_0x568d6f];return _0x29597b;};'use strict';var _=require('lodash');var util=require(_0x45a0('0x0'));var logger=require(_0x45a0('0x1'))(_0x45a0('0x2'));var moment=require(_0x45a0('0x3'));var BPromise=require(_0x45a0('0x4'));var rp=require(_0x45a0('0x5'));var htmlToText=require(_0x45a0('0x6'));var fs=require('fs');var path=require(_0x45a0('0x7'));var rimraf=require('rimraf');var config=require(_0x45a0('0x8'));var attributes=require('./mailMessage.attributes');module[_0x45a0('0x9')]=function(_0x4bda94,_0x589063){return _0x4bda94[_0x45a0('0xa')](_0x45a0('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x45a0('0xc')]},{'name':_0x45a0('0xd'),'fields':[_0x45a0('0xe'),_0x45a0('0xf')],'type':_0x45a0('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x11dc31,_0x1bc47e,_0x4a17ac){if(_0x11dc31[_0x45a0('0x11')]){_0x11dc31[_0x45a0('0xe')]=htmlToText['fromString'](_0x11dc31[_0x45a0('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4a17ac(null,_0x1bc47e);},'afterCreate':function(_0x4ece52,_0x324fc2,_0x3743e7){var _0x5793a6=_0x4bda94['models'];var _0x5ca31a=_0x4ece52[_0x45a0('0x12')]({'plain':!![]});if(_0x5ca31a[_0x45a0('0x13')][_0x45a0('0x14')]()==='in'||_0x5ca31a[_0x45a0('0x13')][_0x45a0('0x14')]()===_0x45a0('0x15')&&!_0x5ca31a['secret']&&!_[_0x45a0('0x16')](_0x5ca31a[_0x45a0('0x17')])){_0x5793a6['MailInteraction'][_0x45a0('0x18')]({'where':{'id':_0x5ca31a[_0x45a0('0x19')]}})[_0x45a0('0x1a')](function(_0x3c52e1){if(_0x3c52e1){_0x3c52e1[_0x45a0('0x1b')]({'lastMsgAt':_0x5ca31a['createdAt'],'lastMsgDirection':_0x5ca31a[_0x45a0('0x13')][_0x45a0('0x14')](),'lastMsgBody':_0x5ca31a[_0x45a0('0x11')]});}})[_0x45a0('0x1c')](function(_0x32c713){console[_0x45a0('0x1d')](_0x32c713);});}_0x3743e7();}},'charset':_0x45a0('0x1e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x09c9=['then','createdAt','toLowerCase','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports','define','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','models','get','direction','out','secret','isNil','MailInteraction','findOne'];(function(_0x11a44a,_0x38c203){var _0x1f3a32=function(_0x560f1d){while(--_0x560f1d){_0x11a44a['push'](_0x11a44a['shift']());}};_0x1f3a32(++_0x38c203);}(_0x09c9,0x87));var _0x909c=function(_0x31bc48,_0x18759e){_0x31bc48=_0x31bc48-0x0;var _0x3abd4a=_0x09c9[_0x31bc48];return _0x3abd4a;};'use strict';var _=require(_0x909c('0x0'));var util=require(_0x909c('0x1'));var logger=require(_0x909c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x909c('0x3'));var rp=require('request-promise');var htmlToText=require(_0x909c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x909c('0x5'));var config=require(_0x909c('0x6'));var attributes=require(_0x909c('0x7'));module[_0x909c('0x8')]=function(_0x42faee,_0x4d495d){return _0x42faee[_0x909c('0x9')]('MailMessage',attributes,{'tableName':_0x909c('0xa'),'paranoid':![],'indexes':[{'name':_0x909c('0xb'),'fields':[_0x909c('0xb')]},{'name':_0x909c('0xc'),'fields':[_0x909c('0xd'),_0x909c('0xe')],'type':_0x909c('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x23d041,_0x51686d,_0x2fb080){if(_0x23d041[_0x909c('0x10')]){_0x23d041[_0x909c('0xd')]=htmlToText['fromString'](_0x23d041['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2fb080(null,_0x51686d);},'afterCreate':function(_0xbb77,_0x2b4ea6,_0x28a463){var _0x49df56=_0x42faee[_0x909c('0x11')];var _0x1fb4e9=_0xbb77[_0x909c('0x12')]({'plain':!![]});if(_0x1fb4e9[_0x909c('0x13')]['toLowerCase']()==='in'||_0x1fb4e9[_0x909c('0x13')]['toLowerCase']()===_0x909c('0x14')&&!_0x1fb4e9[_0x909c('0x15')]&&!_[_0x909c('0x16')](_0x1fb4e9['UserId'])){_0x49df56[_0x909c('0x17')][_0x909c('0x18')]({'where':{'id':_0x1fb4e9['MailInteractionId']}})[_0x909c('0x19')](function(_0x4c0fa9){if(_0x4c0fa9){_0x4c0fa9['update']({'lastMsgAt':_0x1fb4e9[_0x909c('0x1a')],'lastMsgDirection':_0x1fb4e9['direction'][_0x909c('0x1b')](),'lastMsgBody':_0x1fb4e9[_0x909c('0x10')]});}})[_0x909c('0x1c')](function(_0x340d64){console[_0x909c('0x1d')](_0x340d64);});}_0x28a463();}},'charset':_0x909c('0x1e'),'collate':_0x909c('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index d662b1c..8274f82 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 _0x5915=['lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','client','http','defaults','redis','localhost','socket.io-emitter','register','request','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateMailMessage','MailMessage','raw','then','debug'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5915,0x14a));var _0x5591=function(_0x28598b,_0x34b0ec){_0x28598b=_0x28598b-0x0;var _0xb19018=_0x5915[_0x28598b];return _0xb19018;};'use strict';var _=require(_0x5591('0x0'));var util=require(_0x5591('0x1'));var moment=require(_0x5591('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5591('0x3'));var db=require(_0x5591('0x4'))['db'];var utils=require(_0x5591('0x5'));var logger=require('../../config/logger')(_0x5591('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5591('0x7')][_0x5591('0x8')]({'port':0x232a});config['redis']=_[_0x5591('0x9')](config[_0x5591('0xa')],{'host':_0x5591('0xb'),'port':0x18eb});var socket=require(_0x5591('0xc'))(new Redis(config[_0x5591('0xa')]));require('./mailMessage.socket')[_0x5591('0xd')](socket);function respondWithRpcPromise(_0x3ca61c,_0x5a964e,_0xa9a68f){return new BPromise(function(_0x5d8375,_0x1636d3){return client[_0x5591('0xe')](_0x3ca61c,_0xa9a68f)['then'](function(_0x2b97a3){logger['info'](_0x5591('0xf'),_0x5a964e,_0x5591('0x10'));logger['debug'](_0x5591('0x11'),_0x5a964e,_0x5591('0x10'),JSON[_0x5591('0x12')](_0x2b97a3));if(_0x2b97a3[_0x5591('0x13')]){if(_0x2b97a3[_0x5591('0x13')][_0x5591('0x14')]===0x1f4){logger['error'](_0x5591('0xf'),_0x5a964e,_0x2b97a3[_0x5591('0x13')]['message']);return _0x1636d3(_0x2b97a3[_0x5591('0x13')][_0x5591('0x15')]);}logger[_0x5591('0x13')](_0x5591('0xf'),_0x5a964e,_0x2b97a3['error'][_0x5591('0x15')]);return _0x5d8375(_0x2b97a3[_0x5591('0x13')][_0x5591('0x15')]);}else{logger[_0x5591('0x16')](_0x5591('0xf'),_0x5a964e,_0x5591('0x10'));_0x5d8375(_0x2b97a3[_0x5591('0x17')][_0x5591('0x15')]);}})[_0x5591('0x18')](function(_0xf8fd40){logger[_0x5591('0x13')](_0x5591('0xf'),_0x5a964e,_0xf8fd40);_0x1636d3(_0xf8fd40);});});}exports[_0x5591('0x19')]=function(_0xb8449f){var _0x129c92=this;return new Promise(function(_0x5105dc,_0x15694a){return db[_0x5591('0x1a')]['create'](_0xb8449f['body'],{'raw':_0xb8449f['options']?_0xb8449f['options'][_0x5591('0x1b')]===undefined?!![]:![]:!![]})[_0x5591('0x1c')](function(_0x277c45){logger[_0x5591('0x16')](_0x5591('0x19'),_0xb8449f);logger[_0x5591('0x1d')](_0x5591('0x19'),_0xb8449f,JSON['stringify'](_0x277c45));_0x5105dc(_0x277c45);})['catch'](function(_0xf4d2a1){logger[_0x5591('0x13')](_0x5591('0x19'),_0xf4d2a1[_0x5591('0x15')],_0xb8449f);_0x15694a(_0x129c92['error'](0x1f4,_0xf4d2a1[_0x5591('0x15')]));});});}; \ No newline at end of file +var _0xd4b6=['MailMessage,\x20%s,\x20%s','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','redis','defaults','localhost','./mailMessage.socket','register','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2874d5,_0x1012b1){var _0x34b789=function(_0x2365de){while(--_0x2365de){_0x2874d5['push'](_0x2874d5['shift']());}};_0x34b789(++_0x1012b1);}(_0xd4b6,0x13f));var _0x6d4b=function(_0xeb25c1,_0x3c7871){_0xeb25c1=_0xeb25c1-0x0;var _0x46bf18=_0xd4b6[_0xeb25c1];return _0x46bf18;};'use strict';var _=require(_0x6d4b('0x0'));var util=require(_0x6d4b('0x1'));var moment=require('moment');var BPromise=require(_0x6d4b('0x2'));var rs=require(_0x6d4b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d4b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6d4b('0x5'));var jayson=require(_0x6d4b('0x6'));var client=jayson[_0x6d4b('0x7')]['http']({'port':0x232a});config[_0x6d4b('0x8')]=_[_0x6d4b('0x9')](config[_0x6d4b('0x8')],{'host':_0x6d4b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6d4b('0x8')]));require(_0x6d4b('0xb'))[_0x6d4b('0xc')](socket);function respondWithRpcPromise(_0x379dd8,_0x559134,_0x19f8ef){return new BPromise(function(_0x396267,_0x97aff7){return client[_0x6d4b('0xd')](_0x379dd8,_0x19f8ef)[_0x6d4b('0xe')](function(_0x45126d){logger[_0x6d4b('0xf')]('MailMessage,\x20%s,\x20%s',_0x559134,_0x6d4b('0x10'));logger[_0x6d4b('0x11')](_0x6d4b('0x12'),_0x559134,'request\x20sent',JSON[_0x6d4b('0x13')](_0x45126d));if(_0x45126d[_0x6d4b('0x14')]){if(_0x45126d[_0x6d4b('0x14')][_0x6d4b('0x15')]===0x1f4){logger[_0x6d4b('0x14')](_0x6d4b('0x16'),_0x559134,_0x45126d[_0x6d4b('0x14')][_0x6d4b('0x17')]);return _0x97aff7(_0x45126d[_0x6d4b('0x14')][_0x6d4b('0x17')]);}logger['error'](_0x6d4b('0x16'),_0x559134,_0x45126d['error'][_0x6d4b('0x17')]);return _0x396267(_0x45126d[_0x6d4b('0x14')]['message']);}else{logger['info'](_0x6d4b('0x16'),_0x559134,_0x6d4b('0x10'));_0x396267(_0x45126d[_0x6d4b('0x18')][_0x6d4b('0x17')]);}})[_0x6d4b('0x19')](function(_0x35cf05){logger[_0x6d4b('0x14')](_0x6d4b('0x16'),_0x559134,_0x35cf05);_0x97aff7(_0x35cf05);});});}exports[_0x6d4b('0x1a')]=function(_0x34d9bf){var _0x57f939=this;return new Promise(function(_0x5c88a1,_0x25a1fa){return db[_0x6d4b('0x1b')][_0x6d4b('0x1c')](_0x34d9bf['body'],{'raw':_0x34d9bf[_0x6d4b('0x1d')]?_0x34d9bf[_0x6d4b('0x1d')][_0x6d4b('0x1e')]===undefined?!![]:![]:!![]})[_0x6d4b('0xe')](function(_0x4c46cf){logger[_0x6d4b('0xf')](_0x6d4b('0x1a'),_0x34d9bf);logger[_0x6d4b('0x11')](_0x6d4b('0x1a'),_0x34d9bf,JSON[_0x6d4b('0x13')](_0x4c46cf));_0x5c88a1(_0x4c46cf);})['catch'](function(_0x38dc85){logger['error'](_0x6d4b('0x1a'),_0x38dc85[_0x6d4b('0x17')],_0x34d9bf);_0x25a1fa(_0x57f939['error'](0x1f4,_0x38dc85[_0x6d4b('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index d2e9397..771d850 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 _0x5173=['mailMessage:','./mailMessage.events','save','remove','emit','removeListener','register','length'];(function(_0x4c114f,_0x1c1318){var _0x5a4d3e=function(_0x30b622){while(--_0x30b622){_0x4c114f['push'](_0x4c114f['shift']());}};_0x5a4d3e(++_0x1c1318);}(_0x5173,0x109));var _0x3517=function(_0x3968ec,_0x4d2221){_0x3968ec=_0x3968ec-0x0;var _0x30e7f4=_0x5173[_0x3968ec];return _0x30e7f4;};'use strict';var MailMessageEvents=require(_0x3517('0x0'));var events=[_0x3517('0x1'),_0x3517('0x2'),'update'];function createListener(_0x3b8ca7,_0x5bafab){return function(_0x3eb5a7){_0x5bafab[_0x3517('0x3')](_0x3b8ca7,_0x3eb5a7);};}function removeListener(_0x48d6d6,_0x256e3a){return function(){MailMessageEvents[_0x3517('0x4')](_0x48d6d6,_0x256e3a);};}exports[_0x3517('0x5')]=function(_0x46d835){for(var _0x2a0b0c=0x0,_0x3c65f6=events[_0x3517('0x6')];_0x2a0b0c<_0x3c65f6;_0x2a0b0c++){var _0x47d5b7=events[_0x2a0b0c];var _0x241a49=createListener(_0x3517('0x7')+_0x47d5b7,_0x46d835);MailMessageEvents['on'](_0x47d5b7,_0x241a49);}}; \ No newline at end of file +var _0xd5cc=['remove','update','emit','save'];(function(_0x3e4bd5,_0x1191df){var _0x261d71=function(_0x9f1a84){while(--_0x9f1a84){_0x3e4bd5['push'](_0x3e4bd5['shift']());}};_0x261d71(++_0x1191df);}(_0xd5cc,0x93));var _0xcd5c=function(_0x14b5af,_0x5c6711){_0x14b5af=_0x14b5af-0x0;var _0x123289=_0xd5cc[_0x14b5af];return _0x123289;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xcd5c('0x0'),_0xcd5c('0x1'),_0xcd5c('0x2')];function createListener(_0x3771d7,_0xa55cc6){return function(_0x1f7834){_0xa55cc6[_0xcd5c('0x3')](_0x3771d7,_0x1f7834);};}function removeListener(_0x167ed5,_0x1b7629){return function(){MailMessageEvents['removeListener'](_0x167ed5,_0x1b7629);};}exports['register']=function(_0x38e6a0){for(var _0x3fc05f=0x0,_0x2a4479=events['length'];_0x3fc05f<_0x2a4479;_0x3fc05f++){var _0x2e4d58=events[_0x3fc05f];var _0x393f3e=createListener('mailMessage:'+_0x2e4d58,_0x38e6a0);MailMessageEvents['on'](_0x2e4d58,_0x393f3e);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 1a5068f..59c0629 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 _0xd9da=['addTeams','addAgents','put','/:id','update','destroy','removeTeams','delete','removeAgents','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','/describe','describe','show','/:id/members','get','/:id/teams','getTeams','/:id/users','create','post'];(function(_0x73e318,_0x199dcd){var _0x3ac574=function(_0xe88ebc){while(--_0xe88ebc){_0x73e318['push'](_0x73e318['shift']());}};_0x3ac574(++_0x199dcd);}(_0xd9da,0xdc));var _0xad9d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd9da[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xad9d('0x0'));var util=require(_0xad9d('0x1'));var path=require(_0xad9d('0x2'));var timeout=require(_0xad9d('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xad9d('0x4'));var interaction=require(_0xad9d('0x5'));var config=require(_0xad9d('0x6'));var controller=require(_0xad9d('0x7'));router['get']('/',auth[_0xad9d('0x8')](),controller[_0xad9d('0x9')]);router['get'](_0xad9d('0xa'),auth[_0xad9d('0x8')](),controller[_0xad9d('0xb')]);router['get']('/:id',auth[_0xad9d('0x8')](),controller[_0xad9d('0xc')]);router['get'](_0xad9d('0xd'),auth['isAuthenticated'](),controller['getMembers']);router[_0xad9d('0xe')](_0xad9d('0xf'),auth[_0xad9d('0x8')](),controller[_0xad9d('0x10')]);router[_0xad9d('0xe')](_0xad9d('0x11'),auth[_0xad9d('0x8')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0xad9d('0x12')]);router[_0xad9d('0x13')](_0xad9d('0xf'),auth[_0xad9d('0x8')](),controller[_0xad9d('0x14')]);router[_0xad9d('0x13')](_0xad9d('0x11'),auth[_0xad9d('0x8')](),controller[_0xad9d('0x15')]);router[_0xad9d('0x16')](_0xad9d('0x17'),auth[_0xad9d('0x8')](),controller[_0xad9d('0x18')]);router['delete'](_0xad9d('0x17'),auth[_0xad9d('0x8')](),controller[_0xad9d('0x19')]);router['delete'](_0xad9d('0xf'),auth[_0xad9d('0x8')](),controller[_0xad9d('0x1a')]);router[_0xad9d('0x1b')](_0xad9d('0x11'),auth[_0xad9d('0x8')](),controller[_0xad9d('0x1c')]);module[_0xad9d('0x1d')]=router; \ No newline at end of file +var _0xca9c=['path','express','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','addAgents','update','delete','destroy','exports','multer','util'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xca9c,0x18e));var _0xcca9=function(_0x5d1ffc,_0x305f6b){_0x5d1ffc=_0x5d1ffc-0x0;var _0xe2c760=_0xca9c[_0x5d1ffc];return _0xe2c760;};'use strict';var multer=require(_0xcca9('0x0'));var util=require(_0xcca9('0x1'));var path=require(_0xcca9('0x2'));var timeout=require('connect-timeout');var express=require(_0xcca9('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xcca9('0x4'));var config=require(_0xcca9('0x5'));var controller=require(_0xcca9('0x6'));router[_0xcca9('0x7')]('/',auth[_0xcca9('0x8')](),controller[_0xcca9('0x9')]);router['get'](_0xcca9('0xa'),auth[_0xcca9('0x8')](),controller[_0xcca9('0xb')]);router[_0xcca9('0x7')](_0xcca9('0xc'),auth[_0xcca9('0x8')](),controller['show']);router[_0xcca9('0x7')](_0xcca9('0xd'),auth[_0xcca9('0x8')](),controller['getMembers']);router['get'](_0xcca9('0xe'),auth[_0xcca9('0x8')](),controller[_0xcca9('0xf')]);router['get']('/:id/users',auth[_0xcca9('0x8')](),controller[_0xcca9('0x10')]);router[_0xcca9('0x11')]('/',auth[_0xcca9('0x8')](),controller['create']);router['post'](_0xcca9('0xe'),auth[_0xcca9('0x8')](),controller[_0xcca9('0x12')]);router[_0xcca9('0x11')](_0xcca9('0x13'),auth[_0xcca9('0x8')](),controller[_0xcca9('0x14')]);router['put'](_0xcca9('0xc'),auth[_0xcca9('0x8')](),controller[_0xcca9('0x15')]);router[_0xcca9('0x16')]('/:id',auth[_0xcca9('0x8')](),controller[_0xcca9('0x17')]);router[_0xcca9('0x16')]('/:id/teams',auth[_0xcca9('0x8')](),controller['removeTeams']);router[_0xcca9('0x16')](_0xcca9('0x13'),auth[_0xcca9('0x8')](),controller['removeAgents']);module[_0xcca9('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 0feebd5..f595df2 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 _0x75ff=['name','ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0x75ff,0x131));var _0xf75f=function(_0x1c391b,_0x331dc5){_0x1c391b=_0x1c391b-0x0;var _0x3da0c1=_0x75ff[_0x1c391b];return _0x3da0c1;};'use strict';var Sequelize=require(_0xf75f('0x0'));module[_0xf75f('0x1')]={'name':{'type':Sequelize[_0xf75f('0x2')],'unique':_0xf75f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf75f('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf75f('0x4')](_0xf75f('0x5'),_0xf75f('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x0733=['roundrobin','STRING','name','ENUM','rrmemory'];(function(_0x5f2e3e,_0x2569a1){var _0x1730a0=function(_0x38b0b3){while(--_0x38b0b3){_0x5f2e3e['push'](_0x5f2e3e['shift']());}};_0x1730a0(++_0x2569a1);}(_0x0733,0xc4));var _0x3073=function(_0x3d6f84,_0x2b3b66){_0x3d6f84=_0x3d6f84-0x0;var _0x204062=_0x0733[_0x3d6f84];return _0x204062;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3073('0x0')],'unique':_0x3073('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3073('0x0')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3073('0x2')](_0x3073('0x3'),'beepall',_0x3073('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 9047816..a915ed7 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 _0xa1aa=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','stack','name','index','map','MailQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','include','findAll','rows','params','keys','includeAll','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','mailPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','addTeams','online','voicePause','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','emit','select','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','toString','SELECT','every','TeamId','includes','value','removeTeams','ids','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','getAgents','pick'];(function(_0x1a776e,_0x413797){var _0x1bdd49=function(_0x5d0a6f){while(--_0x5d0a6f){_0x1a776e['push'](_0x1a776e['shift']());}};_0x1bdd49(++_0x413797);}(_0xa1aa,0x19b));var _0xaa1a=function(_0x4f71be,_0x287d60){_0x4f71be=_0x4f71be-0x0;var _0x387505=_0xa1aa[_0x4f71be];return _0x387505;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xaa1a('0x0'));var rimraf=require(_0xaa1a('0x1'));var zipdir=require(_0xaa1a('0x2'));var jsonpatch=require(_0xaa1a('0x3'));var rp=require(_0xaa1a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaa1a('0x5'));var util=require(_0xaa1a('0x6'));var path=require('path');var sox=require(_0xaa1a('0x7'));var csv=require(_0xaa1a('0x8'));var ejs=require(_0xaa1a('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xaa1a('0xa'));var crypto=require('crypto');var jsforce=require(_0xaa1a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xaa1a('0x8'));var querystring=require(_0xaa1a('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaa1a('0xd'));var qs=require(_0xaa1a('0xe'));var as=require(_0xaa1a('0xf'));var hardwareService=require(_0xaa1a('0x10'));var logger=require('../../config/logger')(_0xaa1a('0x11'));var utils=require(_0xaa1a('0x12'));var config=require(_0xaa1a('0x13'));var licenseUtil=require(_0xaa1a('0x14'));var db=require(_0xaa1a('0x15'))['db'];config[_0xaa1a('0x16')]=_[_0xaa1a('0x17')](config[_0xaa1a('0x16')],{'host':_0xaa1a('0x18'),'port':0x18eb});var socket=require(_0xaa1a('0x19'))(new Redis(config['redis']));require('./mailQueue.socket')[_0xaa1a('0x1a')](socket);function respondWithStatusCode(_0x3a577f,_0x268f91){_0x268f91=_0x268f91||0xcc;return function(_0x14f6b5){if(_0x14f6b5){return _0x3a577f[_0xaa1a('0x1b')](_0x268f91);}return _0x3a577f['status'](_0x268f91)[_0xaa1a('0x1c')]();};}function respondWithResult(_0x480a27,_0x12153c){_0x12153c=_0x12153c||0xc8;return function(_0x384eb3){if(_0x384eb3){return _0x480a27[_0xaa1a('0x1d')](_0x12153c)[_0xaa1a('0x1e')](_0x384eb3);}};}function respondWithFilteredResult(_0x5ba030,_0x521a8e){return function(_0x1b3174){if(_0x1b3174){var _0xcb3609=_0x1b3174[_0xaa1a('0x1f')],_0x56ff91=_0x521a8e[_0xaa1a('0x20')],_0x33f564=_0x521a8e[_0xaa1a('0x20')]+_0x521a8e[_0xaa1a('0x21')],_0x32e118;if(_0x33f564>=_0xcb3609){_0x33f564=_0xcb3609;_0x32e118=0xc8;}else{_0x32e118=0xce;}_0x5ba030['status'](_0x32e118);return _0x5ba030[_0xaa1a('0x22')](_0xaa1a('0x23'),_0x56ff91+'-'+_0x33f564+'/'+_0xcb3609)[_0xaa1a('0x1e')](_0x1b3174);}return null;};}function patchUpdates(_0x3298ed){return function(_0x2c0238){try{jsonpatch[_0xaa1a('0x24')](_0x2c0238,_0x3298ed,!![]);}catch(_0x21019a){return BPromise['reject'](_0x21019a);}return _0x2c0238[_0xaa1a('0x25')]();};}function saveUpdates(_0x282f07,_0x1ac174){return function(_0x506db4){if(_0x506db4){return _0x506db4[_0xaa1a('0x26')](_0x282f07)[_0xaa1a('0x27')](function(_0x583c90){return _0x583c90;});}return null;};}function removeEntity(_0x4accdf,_0x64fc15){return function(_0x3b0eaa){if(_0x3b0eaa){return _0x3b0eaa[_0xaa1a('0x28')]()[_0xaa1a('0x27')](function(){var _0x582843=_0x3b0eaa[_0xaa1a('0x29')]({'plain':!![]});var _0x32f406='MailQueues';return db[_0xaa1a('0x2a')][_0xaa1a('0x28')]({'where':{'type':_0x32f406,'resourceId':_0x582843['id']}})[_0xaa1a('0x27')](function(){return _0x3b0eaa;});})['then'](function(){_0x4accdf[_0xaa1a('0x1d')](0xcc)[_0xaa1a('0x1c')]();});}};}function handleEntityNotFound(_0x1b1b67,_0x139f53){return function(_0x3f29a8){if(!_0x3f29a8){_0x1b1b67[_0xaa1a('0x1b')](0x194);}return _0x3f29a8;};}function handleError(_0x26fdea,_0x5291be){_0x5291be=_0x5291be||0x1f4;return function(_0x4c495f){logger['error'](_0x4c495f[_0xaa1a('0x2b')]);if(_0x4c495f[_0xaa1a('0x2c')]){delete _0x4c495f[_0xaa1a('0x2c')];}_0x26fdea[_0xaa1a('0x1d')](_0x5291be)['send'](_0x4c495f);};}exports[_0xaa1a('0x2d')]=function(_0x22ba1d,_0x2767be){var _0x22b4e3={},_0x13afce={},_0xd3390e={'count':0x0,'rows':[]};var _0x27047b=_[_0xaa1a('0x2e')](db[_0xaa1a('0x2f')][_0xaa1a('0x30')],function(_0x1b874f){return{'name':_0x1b874f[_0xaa1a('0x31')],'type':_0x1b874f[_0xaa1a('0x32')][_0xaa1a('0x33')]};});_0x13afce[_0xaa1a('0x34')]=_['map'](_0x27047b,'name');_0x13afce[_0xaa1a('0x35')]=_['keys'](_0x22ba1d[_0xaa1a('0x35')]);_0x13afce[_0xaa1a('0x36')]=_[_0xaa1a('0x37')](_0x13afce[_0xaa1a('0x34')],_0x13afce[_0xaa1a('0x35')]);_0x22b4e3[_0xaa1a('0x38')]=_['intersection'](_0x13afce[_0xaa1a('0x34')],qs[_0xaa1a('0x39')](_0x22ba1d[_0xaa1a('0x35')][_0xaa1a('0x39')]));_0x22b4e3[_0xaa1a('0x38')]=_0x22b4e3[_0xaa1a('0x38')][_0xaa1a('0x3a')]?_0x22b4e3[_0xaa1a('0x38')]:_0x13afce['model'];if(!_0x22ba1d[_0xaa1a('0x35')][_0xaa1a('0x3b')](_0xaa1a('0x3c'))){_0x22b4e3[_0xaa1a('0x21')]=qs[_0xaa1a('0x21')](_0x22ba1d[_0xaa1a('0x35')][_0xaa1a('0x21')]);_0x22b4e3[_0xaa1a('0x20')]=qs[_0xaa1a('0x20')](_0x22ba1d[_0xaa1a('0x35')][_0xaa1a('0x20')]);}_0x22b4e3[_0xaa1a('0x3d')]=qs[_0xaa1a('0x3e')](_0x22ba1d[_0xaa1a('0x35')][_0xaa1a('0x3e')]);_0x22b4e3[_0xaa1a('0x3f')]=qs['filters'](_['pick'](_0x22ba1d[_0xaa1a('0x35')],_0x13afce[_0xaa1a('0x36')]),_0x27047b);if(_0x22ba1d[_0xaa1a('0x35')][_0xaa1a('0x40')]){_0x22b4e3[_0xaa1a('0x3f')]=_[_0xaa1a('0x41')](_0x22b4e3['where'],{'$or':_[_0xaa1a('0x2e')](_0x27047b,function(_0x529e82){if(_0x529e82[_0xaa1a('0x32')]!=='VIRTUAL'){var _0x31c95a={};_0x31c95a[_0x529e82[_0xaa1a('0x2c')]]={'$like':'%'+_0x22ba1d[_0xaa1a('0x35')][_0xaa1a('0x40')]+'%'};return _0x31c95a;}})});}_0x22b4e3=_['merge']({},_0x22b4e3,_0x22ba1d['options']);var _0x18e373={'where':_0x22b4e3[_0xaa1a('0x3f')]};return db['MailQueue'][_0xaa1a('0x1f')](_0x18e373)[_0xaa1a('0x27')](function(_0x4fbd5d){_0xd3390e['count']=_0x4fbd5d;if(_0x22ba1d[_0xaa1a('0x35')]['includeAll']){_0x22b4e3[_0xaa1a('0x42')]=[{'all':!![]}];}return db[_0xaa1a('0x2f')][_0xaa1a('0x43')](_0x22b4e3);})[_0xaa1a('0x27')](function(_0x253998){_0xd3390e[_0xaa1a('0x44')]=_0x253998;return _0xd3390e;})['then'](respondWithFilteredResult(_0x2767be,_0x22b4e3))['catch'](handleError(_0x2767be,null));};exports['show']=function(_0x5ce7f1,_0x27fcfd){var _0x4e4f67={'raw':!![],'where':{'id':_0x5ce7f1[_0xaa1a('0x45')]['id']}},_0x2ca78b={};_0x2ca78b[_0xaa1a('0x34')]=_[_0xaa1a('0x46')](db[_0xaa1a('0x2f')][_0xaa1a('0x30')]);_0x2ca78b[_0xaa1a('0x35')]=_[_0xaa1a('0x46')](_0x5ce7f1[_0xaa1a('0x35')]);_0x2ca78b[_0xaa1a('0x36')]=_[_0xaa1a('0x37')](_0x2ca78b['model'],_0x2ca78b[_0xaa1a('0x35')]);_0x4e4f67[_0xaa1a('0x38')]=_[_0xaa1a('0x37')](_0x2ca78b['model'],qs[_0xaa1a('0x39')](_0x5ce7f1['query'][_0xaa1a('0x39')]));_0x4e4f67[_0xaa1a('0x38')]=_0x4e4f67[_0xaa1a('0x38')][_0xaa1a('0x3a')]?_0x4e4f67['attributes']:_0x2ca78b[_0xaa1a('0x34')];if(_0x5ce7f1[_0xaa1a('0x35')][_0xaa1a('0x47')]){_0x4e4f67[_0xaa1a('0x42')]=[{'all':!![]}];}_0x4e4f67=_[_0xaa1a('0x41')]({},_0x4e4f67,_0x5ce7f1[_0xaa1a('0x48')]);return db[_0xaa1a('0x2f')][_0xaa1a('0x49')](_0x4e4f67)[_0xaa1a('0x27')](handleEntityNotFound(_0x27fcfd,null))['then'](respondWithResult(_0x27fcfd,null))[_0xaa1a('0x4a')](handleError(_0x27fcfd,null));};exports[_0xaa1a('0x4b')]=function(_0x13f32e,_0x955779){return db[_0xaa1a('0x2f')][_0xaa1a('0x4b')](_0x13f32e[_0xaa1a('0x4c')],{})[_0xaa1a('0x27')](function(_0x2da50f){var _0x31c3b3=_0x13f32e[_0xaa1a('0x4d')][_0xaa1a('0x29')]({'plain':!![]});if(!_0x31c3b3)throw new Error(_0xaa1a('0x4e'));if(_0x31c3b3[_0xaa1a('0x4f')]===_0xaa1a('0x4d')){var _0x42c5e5=_0x2da50f[_0xaa1a('0x29')]({'plain':!![]});var _0xa23e7f='MailQueues';return db[_0xaa1a('0x50')][_0xaa1a('0x49')]({'where':{'name':_0xa23e7f,'userProfileId':_0x31c3b3[_0xaa1a('0x51')]},'raw':!![]})['then'](function(_0x56a465){if(_0x56a465&&_0x56a465[_0xaa1a('0x52')]===0x0){return db['UserProfileResource'][_0xaa1a('0x4b')]({'name':_0x42c5e5['name'],'resourceId':_0x42c5e5['id'],'type':_0x56a465[_0xaa1a('0x2c')],'sectionId':_0x56a465['id']},{})['then'](function(){return _0x2da50f;});}else{return _0x2da50f;}})[_0xaa1a('0x4a')](function(_0x453243){logger[_0xaa1a('0x53')](_0xaa1a('0x54'),_0x453243);throw _0x453243;});}return _0x2da50f;})[_0xaa1a('0x27')](respondWithResult(_0x955779,0xc9))['catch'](handleError(_0x955779,null));};exports['update']=function(_0x4cd226,_0x2ce080){if(_0x4cd226[_0xaa1a('0x4c')]['id']){delete _0x4cd226[_0xaa1a('0x4c')]['id'];}return db['MailQueue'][_0xaa1a('0x49')]({'where':{'id':_0x4cd226[_0xaa1a('0x45')]['id']}})['then'](handleEntityNotFound(_0x2ce080,null))['then'](saveUpdates(_0x4cd226[_0xaa1a('0x4c')],null))[_0xaa1a('0x27')](respondWithResult(_0x2ce080,null))[_0xaa1a('0x4a')](handleError(_0x2ce080,null));};exports[_0xaa1a('0x28')]=function(_0x321b28,_0x2e5e6a){return db[_0xaa1a('0x2f')][_0xaa1a('0x49')]({'where':{'id':_0x321b28[_0xaa1a('0x45')]['id']}})[_0xaa1a('0x27')](handleEntityNotFound(_0x2e5e6a,null))[_0xaa1a('0x27')](removeEntity(_0x2e5e6a,null))[_0xaa1a('0x4a')](handleError(_0x2e5e6a,null));};exports['describe']=function(_0xda7d2e,_0x56e9c9){return db[_0xaa1a('0x2f')][_0xaa1a('0x55')]()['then'](respondWithResult(_0x56e9c9,null))['catch'](handleError(_0x56e9c9,null));};exports[_0xaa1a('0x56')]=function(_0x5e692d,_0xdbe347,_0x38eba5){var _0x39a663={'raw':!![],'where':{}},_0x38fb88={},_0x170669;return db[_0xaa1a('0x2f')][_0xaa1a('0x57')]({'where':{'id':_0x5e692d[_0xaa1a('0x45')]['id']}})['then'](handleEntityNotFound(_0xdbe347,null))[_0xaa1a('0x27')](function(_0x170f91){if(_0x170f91){_0x170669=_0x170f91['get']({'plain':!![]});_0x38fb88[_0xaa1a('0x34')]=_[_0xaa1a('0x46')](db[_0xaa1a('0x58')][_0xaa1a('0x30')]);_0x38fb88[_0xaa1a('0x35')]=_[_0xaa1a('0x46')](_0x5e692d['query']);_0x38fb88[_0xaa1a('0x36')]=_[_0xaa1a('0x37')](_0x38fb88[_0xaa1a('0x34')],_0x38fb88['query']);_0x39a663['attributes']=_[_0xaa1a('0x37')](_0x38fb88[_0xaa1a('0x34')],qs[_0xaa1a('0x39')](_0x5e692d['query']['fields']));_0x39a663[_0xaa1a('0x38')]=_0x39a663[_0xaa1a('0x38')]['length']?_0x39a663[_0xaa1a('0x38')]:_0x38fb88[_0xaa1a('0x34')];if(!_0x5e692d[_0xaa1a('0x35')][_0xaa1a('0x3b')](_0xaa1a('0x3c'))){_0x39a663[_0xaa1a('0x21')]=qs['limit'](_0x5e692d[_0xaa1a('0x35')][_0xaa1a('0x21')]);_0x39a663[_0xaa1a('0x20')]=qs[_0xaa1a('0x20')](_0x5e692d[_0xaa1a('0x35')][_0xaa1a('0x20')]);}_0x39a663[_0xaa1a('0x3d')]=qs['sort'](_0x5e692d[_0xaa1a('0x35')]['sort']);_0x39a663[_0xaa1a('0x3f')]=qs[_0xaa1a('0x36')](_['pick'](_0x5e692d[_0xaa1a('0x35')],_0x38fb88[_0xaa1a('0x36')]));_0x39a663[_0xaa1a('0x3f')][_0xaa1a('0x59')]=_0x170f91['id'];if(_0x5e692d[_0xaa1a('0x35')][_0xaa1a('0x40')]){_0x39a663[_0xaa1a('0x3f')]=_[_0xaa1a('0x41')](_0x39a663[_0xaa1a('0x3f')],{'$or':_[_0xaa1a('0x2e')](_0x39a663[_0xaa1a('0x38')],function(_0x954f13){var _0xd6f995={};_0xd6f995[_0x954f13]={'$like':'%'+_0x5e692d[_0xaa1a('0x35')][_0xaa1a('0x40')]+'%'};return _0xd6f995;})});}_0x39a663=_['merge']({},_0x39a663,_0x5e692d['options']);return db[_0xaa1a('0x58')][_0xaa1a('0x43')](_0x39a663);}})[_0xaa1a('0x27')](function(_0x3f48b2){if(_0x3f48b2){return db[_0xaa1a('0x5a')][_0xaa1a('0x5b')]({'where':{'id':_[_0xaa1a('0x2e')](_0x3f48b2,_0xaa1a('0x5c')),'role':'agent'},'attributes':['id',_0xaa1a('0x2c'),_0xaa1a('0x5d'),'updatedAt','createdAt']});}})[_0xaa1a('0x27')](function(_0x42f479){if(_0x42f479){return{'count':_0x42f479[_0xaa1a('0x1f')],'rows':_[_0xaa1a('0x2e')](_0x42f479[_0xaa1a('0x44')],function(_0x3966e8){return{'membername':_0x3966e8[_0xaa1a('0x2c')],'UserId':_0x3966e8['id'],'queue_name':_0x170669[_0xaa1a('0x2c')],'MailQueueId':_0x170669['id'],'interface':util[_0xaa1a('0x5e')](_0xaa1a('0x5f'),_0xaa1a('0x60'),_0x3966e8[_0xaa1a('0x2c')]),'penalty':0x0,'paused':_0x3966e8[_0xaa1a('0x5d')],'createdAt':_0x3966e8[_0xaa1a('0x61')],'updatedAt':_0x3966e8[_0xaa1a('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xaa1a('0x27')](respondWithFilteredResult(_0xdbe347,_0x39a663))[_0xaa1a('0x4a')](handleError(_0xdbe347,null));};exports[_0xaa1a('0x63')]=function(_0x1ae2c3,_0x5ef63e,_0xd65317){var _0x160e71={};var _0x2e46ab={};var _0x172290;var _0x5ca901;return db[_0xaa1a('0x2f')][_0xaa1a('0x57')]({'where':{'id':_0x1ae2c3[_0xaa1a('0x45')]['id']}})[_0xaa1a('0x27')](handleEntityNotFound(_0x5ef63e,null))[_0xaa1a('0x27')](function(_0xbf7190){if(_0xbf7190){_0x172290=_0xbf7190;_0x2e46ab[_0xaa1a('0x34')]=_[_0xaa1a('0x46')](db[_0xaa1a('0x64')]['rawAttributes']);_0x2e46ab[_0xaa1a('0x35')]=_[_0xaa1a('0x46')](_0x1ae2c3['query']);_0x2e46ab['filters']=_[_0xaa1a('0x37')](_0x2e46ab[_0xaa1a('0x34')],_0x2e46ab[_0xaa1a('0x35')]);_0x160e71[_0xaa1a('0x38')]=_[_0xaa1a('0x37')](_0x2e46ab[_0xaa1a('0x34')],qs[_0xaa1a('0x39')](_0x1ae2c3['query'][_0xaa1a('0x39')]));_0x160e71['attributes']=_0x160e71[_0xaa1a('0x38')][_0xaa1a('0x3a')]?_0x160e71['attributes']:_0x2e46ab['model'];_0x160e71['order']=qs[_0xaa1a('0x3e')](_0x1ae2c3['query'][_0xaa1a('0x3e')]);_0x160e71['where']=qs[_0xaa1a('0x36')](_['pick'](_0x1ae2c3[_0xaa1a('0x35')],_0x2e46ab[_0xaa1a('0x36')]));if(_0x1ae2c3[_0xaa1a('0x35')]['filter']){_0x160e71['where']=_[_0xaa1a('0x41')](_0x160e71[_0xaa1a('0x3f')],{'$or':_[_0xaa1a('0x2e')](_0x160e71[_0xaa1a('0x38')],function(_0x31786a){var _0x21d6b3={};_0x21d6b3[_0x31786a]={'$like':'%'+_0x1ae2c3[_0xaa1a('0x35')][_0xaa1a('0x40')]+'%'};return _0x21d6b3;})});}_0x160e71=_[_0xaa1a('0x41')]({},_0x160e71,_0x1ae2c3[_0xaa1a('0x48')]);return _0x172290[_0xaa1a('0x63')](_0x160e71);}})['then'](function(_0x32bff4){if(_0x32bff4){_0x5ca901=_0x32bff4[_0xaa1a('0x3a')];if(!_0x1ae2c3[_0xaa1a('0x35')][_0xaa1a('0x3b')](_0xaa1a('0x3c'))){_0x160e71['limit']=qs[_0xaa1a('0x21')](_0x1ae2c3[_0xaa1a('0x35')]['limit']);_0x160e71['offset']=qs['offset'](_0x1ae2c3[_0xaa1a('0x35')][_0xaa1a('0x20')]);}return _0x172290[_0xaa1a('0x63')](_0x160e71);}})['then'](function(_0x23f195){if(_0x23f195){return _0x23f195?{'count':_0x5ca901,'rows':_0x23f195}:null;}})['then'](respondWithResult(_0x5ef63e,null))['catch'](handleError(_0x5ef63e,null));};exports[_0xaa1a('0x65')]=function(_0xd06d62,_0x163c29,_0x11ff88){var _0x5ed542=_0xd06d62[_0xaa1a('0x4c')]['ids'];return db[_0xaa1a('0x64')][_0xaa1a('0x43')]({'where':{'id':_0x5ed542},'attributes':['id'],'include':[{'model':db[_0xaa1a('0x5a')],'as':'Agents','attributes':['id',_0xaa1a('0x2c'),_0xaa1a('0x66'),_0xaa1a('0x67'),'interface'],'raw':!![]}]})['then'](function(_0x561b81){if(_0x561b81){var _0x3ced80=_[_0xaa1a('0x68')](_0x561b81,function(_0x454860){var _0x8f7837=_0x454860[_0xaa1a('0x29')]({'plain':!![]});return _0x8f7837[_0xaa1a('0x69')];});return db[_0xaa1a('0x2f')]['find']({'where':{'id':_0xd06d62[_0xaa1a('0x45')]['id']}})[_0xaa1a('0x27')](function(_0x230470){return db[_0xaa1a('0x6a')][_0xaa1a('0x6b')](function(_0x18319c){return _0x230470['addTeams'](_0x5ed542,{'transaction':_0x18319c})['then'](function(){return BPromise['each'](_0x3ced80,function(_0x26ad59){return db[_0xaa1a('0x58')][_0xaa1a('0x6c')]({'where':{'UserId':_0x26ad59['id'],'MailQueueId':_0xd06d62[_0xaa1a('0x45')]['id']},'transaction':_0x18319c});});})[_0xaa1a('0x27')](function(){_0x3ced80[_0xaa1a('0x6d')](function(_0x2cac45){socket[_0xaa1a('0x6e')]('userMailQueue:save',{'UserId':_0x2cac45['id'],'MailQueueId':_0x230470['id']});});});});});}})[_0xaa1a('0x27')](respondWithStatusCode(_0x163c29,null))[_0xaa1a('0x4a')](handleError(_0x163c29,null));};exports['removeTeams']=function(_0x2b6224,_0x456bed,_0x984c47){return db['Team'][_0xaa1a('0x43')]({'where':{'id':_0x2b6224['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xaa1a('0x5a')],'as':_0xaa1a('0x69'),'attributes':['id'],'raw':!![]}]})[_0xaa1a('0x27')](handleEntityNotFound(_0x456bed,null))[_0xaa1a('0x27')](function(_0x4265c3){var _0x19f8fe=_[_0xaa1a('0x2e')](_0x4265c3,'id');var _0x5eaea4=[];var _0x56ed8b=[];var _0x3fcead=squel[_0xaa1a('0x6f')]();_0x3fcead['field'](_0xaa1a('0x70'))[_0xaa1a('0x71')](_0xaa1a('0x72'),'tq')[_0xaa1a('0x73')](_0xaa1a('0x74'),'ut',_0xaa1a('0x75'))[_0xaa1a('0x3f')](_0xaa1a('0x76'),_0x2b6224[_0xaa1a('0x45')]['id']);for(var _0x2d8990=0x0;_0x2d8990<_0x4265c3[_0xaa1a('0x3a')];_0x2d8990+=0x1){let _0x4a3349=_0x4265c3[_0x2d8990];for(var _0x1d0493=0x0;_0x1d0493<_0x4a3349[_0xaa1a('0x69')][_0xaa1a('0x3a')];_0x1d0493+=0x1){let _0x3e89a4=_0x4a3349[_0xaa1a('0x69')][_0x1d0493];var _0x4389fb=_0x3fcead[_0xaa1a('0x77')]();_0x4389fb[_0xaa1a('0x3f')]('ut.UserId\x20=\x20?',_0x3e89a4['id']);_0x56ed8b['push'](db[_0xaa1a('0x6a')]['query'](_0x4389fb[_0xaa1a('0x78')](),{'type':db[_0xaa1a('0x6a')]['QueryTypes'][_0xaa1a('0x79')]})[_0xaa1a('0x27')](function(_0x39325b){if(_0x39325b[_0xaa1a('0x3a')]===0x1){return _0x3e89a4['id'];}else{var _0x3791c9=_[_0xaa1a('0x7a')](_[_0xaa1a('0x2e')](_0x39325b,_0xaa1a('0x7b')),function(_0x3b19f0){return _[_0xaa1a('0x7c')](_0x19f8fe,_0x3b19f0);});if(_0x3791c9){return _0x3e89a4['id'];}}}));}}return BPromise['all'](_0x56ed8b)[_0xaa1a('0x27')](function(_0x165f50){_0x5eaea4=_(_0x5eaea4)['union'](_0x165f50)['compact']()[_0xaa1a('0x7d')]();return db['MailQueue'][_0xaa1a('0x49')]({'where':{'id':_0x2b6224['params']['id']}})['then'](function(_0x35a8ea){return db['sequelize']['transaction'](function(_0x21789a){return _0x35a8ea[_0xaa1a('0x7e')](_0x2b6224[_0xaa1a('0x35')][_0xaa1a('0x7f')],{'transaction':_0x21789a})[_0xaa1a('0x27')](function(){if(!_[_0xaa1a('0x80')](_0x5eaea4)){return _0x35a8ea[_0xaa1a('0x81')](_0x5eaea4,{'transaction':_0x21789a});}})[_0xaa1a('0x27')](function(){_0x5eaea4[_0xaa1a('0x6d')](function(_0x1d6984){socket[_0xaa1a('0x6e')](_0xaa1a('0x82'),{'UserId':_0x1d6984,'MailQueueId':_0x35a8ea['id']});});});});});});})[_0xaa1a('0x27')](respondWithStatusCode(_0x456bed,null))[_0xaa1a('0x4a')](handleError(_0x456bed,null));};exports[_0xaa1a('0x83')]=function(_0x4e86a7,_0x334b9c,_0x2ea85c){return db[_0xaa1a('0x2f')][_0xaa1a('0x49')]({'where':{'id':_0x4e86a7[_0xaa1a('0x45')]['id']}})['then'](handleEntityNotFound(_0x334b9c,null))[_0xaa1a('0x27')](function(_0x46ed30){if(_0x46ed30){return _0x46ed30[_0xaa1a('0x83')](_0x4e86a7['body'][_0xaa1a('0x7f')],_[_0xaa1a('0x84')](_0x4e86a7[_0xaa1a('0x4c')],['ids','id'])||{})[_0xaa1a('0x85')](function(_0x19dd74){for(var _0xdd9f5e=0x0;_0xdd9f5e<_0x4e86a7['body'][_0xaa1a('0x7f')][_0xaa1a('0x3a')];_0xdd9f5e+=0x1){socket[_0xaa1a('0x6e')](_0xaa1a('0x86'),{'UserId':_0x4e86a7['body'][_0xaa1a('0x7f')][_0xdd9f5e],'MailQueueId':_0x4e86a7[_0xaa1a('0x45')]['id']});}return _0x19dd74;});}})[_0xaa1a('0x27')](respondWithResult(_0x334b9c,null))[_0xaa1a('0x4a')](handleError(_0x334b9c,null));};exports[_0xaa1a('0x81')]=function(_0x4f43aa,_0x16aa1e,_0x103c39){return db[_0xaa1a('0x2f')][_0xaa1a('0x49')]({'where':{'id':_0x4f43aa[_0xaa1a('0x45')]['id']}})['then'](handleEntityNotFound(_0x16aa1e,null))[_0xaa1a('0x27')](function(_0x5475a9){if(_0x5475a9){return _0x5475a9[_0xaa1a('0x81')](_0x4f43aa['query']['ids'])[_0xaa1a('0x27')](function(){if(_['isArray'](_0x4f43aa['query'][_0xaa1a('0x7f')])){for(var _0xe9f54b=0x0;_0xe9f54b<_0x4f43aa[_0xaa1a('0x35')][_0xaa1a('0x7f')]['length'];_0xe9f54b+=0x1){socket[_0xaa1a('0x6e')]('userMailQueue:remove',{'UserId':Number(_0x4f43aa['query']['ids'][_0xe9f54b]),'MailQueueId':Number(_0x4f43aa[_0xaa1a('0x45')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x4f43aa[_0xaa1a('0x35')]['ids']),'MailQueueId':Number(_0x4f43aa[_0xaa1a('0x45')]['id'])});}});}})[_0xaa1a('0x27')](respondWithStatusCode(_0x16aa1e,null))[_0xaa1a('0x4a')](handleError(_0x16aa1e,null));};exports[_0xaa1a('0x87')]=function(_0x1e48c8,_0x108539,_0x5eacaa){var _0x581847={};var _0x4f92a8={};var _0x5ccaa6;var _0x21d6cd;return db[_0xaa1a('0x2f')]['findOne']({'where':{'id':_0x1e48c8[_0xaa1a('0x45')]['id']}})['then'](handleEntityNotFound(_0x108539,null))[_0xaa1a('0x27')](function(_0x14d468){if(_0x14d468){_0x5ccaa6=_0x14d468;_0x4f92a8[_0xaa1a('0x34')]=_[_0xaa1a('0x46')](db[_0xaa1a('0x5a')][_0xaa1a('0x30')]);_0x4f92a8['query']=_['keys'](_0x1e48c8[_0xaa1a('0x35')]);_0x4f92a8['filters']=_[_0xaa1a('0x37')](_0x4f92a8[_0xaa1a('0x34')],_0x4f92a8[_0xaa1a('0x35')]);_0x581847[_0xaa1a('0x38')]=_['intersection'](_0x4f92a8[_0xaa1a('0x34')],qs[_0xaa1a('0x39')](_0x1e48c8[_0xaa1a('0x35')]['fields']));_0x581847[_0xaa1a('0x38')]=_0x581847[_0xaa1a('0x38')][_0xaa1a('0x3a')]?_0x581847['attributes']:_0x4f92a8['model'];_0x581847['order']=qs[_0xaa1a('0x3e')](_0x1e48c8[_0xaa1a('0x35')][_0xaa1a('0x3e')]);_0x581847[_0xaa1a('0x3f')]=qs[_0xaa1a('0x36')](_[_0xaa1a('0x88')](_0x1e48c8[_0xaa1a('0x35')],_0x4f92a8['filters']));if(_0x1e48c8[_0xaa1a('0x35')]['filter']){_0x581847['where']=_[_0xaa1a('0x41')](_0x581847[_0xaa1a('0x3f')],{'$or':_[_0xaa1a('0x2e')](_0x581847['attributes'],function(_0xa0ca69){var _0x3dd8af={};_0x3dd8af[_0xa0ca69]={'$like':'%'+_0x1e48c8[_0xaa1a('0x35')][_0xaa1a('0x40')]+'%'};return _0x3dd8af;})});}_0x581847=_[_0xaa1a('0x41')]({},_0x581847,_0x1e48c8[_0xaa1a('0x48')]);return _0x5ccaa6[_0xaa1a('0x87')](_0x581847);}})['then'](function(_0xbe1d44){if(_0xbe1d44){_0x21d6cd=_0xbe1d44[_0xaa1a('0x3a')];if(!_0x1e48c8[_0xaa1a('0x35')][_0xaa1a('0x3b')]('nolimit')){_0x581847['limit']=qs[_0xaa1a('0x21')](_0x1e48c8[_0xaa1a('0x35')][_0xaa1a('0x21')]);_0x581847['offset']=qs[_0xaa1a('0x20')](_0x1e48c8['query']['offset']);}return _0x5ccaa6[_0xaa1a('0x87')](_0x581847);}})[_0xaa1a('0x27')](function(_0x2bac9f){if(_0x2bac9f){return _0x2bac9f?{'count':_0x21d6cd,'rows':_0x2bac9f}:null;}})['then'](respondWithResult(_0x108539,null))['catch'](handleError(_0x108539,null));}; \ No newline at end of file +var _0x4227=['moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','sendStatus','end','status','json','offset','limit','set','Content-Range','reject','save','update','destroy','then','MailQueues','UserProfileResource','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','rows','catch','show','params','keys','fields','length','create','body','user','get','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','findAll','findAndCountAll','UserId','agent','mailPause','updatedAt','count','format','createdAt','getTeams','Team','addTeams','User','Agents','online','voicePause','flatMap','sequelize','transaction','each','forEach','emit','userMailQueue:save','ids','select','field','tq.TeamId','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','union','compact','value','removeTeams','isEmpty','userMailQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','zip-dir','request-promise'];(function(_0x1c0ca6,_0x4c3ad4){var _0x4b1655=function(_0x180615){while(--_0x180615){_0x1c0ca6['push'](_0x1c0ca6['shift']());}};_0x4b1655(++_0x4c3ad4);}(_0x4227,0x89));var _0x7422=function(_0x59a35e,_0x1a8eb1){_0x59a35e=_0x59a35e-0x0;var _0x935ad=_0x4227[_0x59a35e];return _0x935ad;};'use strict';var pdf=require(_0x7422('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7422('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7422('0x2'));var moment=require(_0x7422('0x3'));var BPromise=require(_0x7422('0x4'));var Mustache=require('mustache');var util=require(_0x7422('0x5'));var path=require(_0x7422('0x6'));var sox=require(_0x7422('0x7'));var csv=require(_0x7422('0x8'));var ejs=require(_0x7422('0x9'));var fs=require('fs');var _=require(_0x7422('0xa'));var squel=require(_0x7422('0xb'));var crypto=require(_0x7422('0xc'));var jsforce=require(_0x7422('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7422('0x8'));var querystring=require(_0x7422('0xe'));var Papa=require(_0x7422('0xf'));var Redis=require('ioredis');var authService=require(_0x7422('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7422('0x11'));var hardwareService=require(_0x7422('0x12'));var logger=require(_0x7422('0x13'))(_0x7422('0x14'));var utils=require(_0x7422('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7422('0x16'));var db=require(_0x7422('0x17'))['db'];config['redis']=_[_0x7422('0x18')](config[_0x7422('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x7422('0x1a'))(new Redis(config[_0x7422('0x19')]));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0xeafd58,_0x4ca0e4){_0x4ca0e4=_0x4ca0e4||0xcc;return function(_0x105e1b){if(_0x105e1b){return _0xeafd58[_0x7422('0x1b')](_0x4ca0e4);}return _0xeafd58['status'](_0x4ca0e4)[_0x7422('0x1c')]();};}function respondWithResult(_0x39c31c,_0x31c3ec){_0x31c3ec=_0x31c3ec||0xc8;return function(_0x1d1ac3){if(_0x1d1ac3){return _0x39c31c[_0x7422('0x1d')](_0x31c3ec)[_0x7422('0x1e')](_0x1d1ac3);}};}function respondWithFilteredResult(_0x4e2b60,_0x21d4b9){return function(_0xa7ff41){if(_0xa7ff41){var _0x493f59=_0xa7ff41['count'],_0x30656d=_0x21d4b9[_0x7422('0x1f')],_0x57b8bf=_0x21d4b9[_0x7422('0x1f')]+_0x21d4b9[_0x7422('0x20')],_0x1f9e09;if(_0x57b8bf>=_0x493f59){_0x57b8bf=_0x493f59;_0x1f9e09=0xc8;}else{_0x1f9e09=0xce;}_0x4e2b60['status'](_0x1f9e09);return _0x4e2b60[_0x7422('0x21')](_0x7422('0x22'),_0x30656d+'-'+_0x57b8bf+'/'+_0x493f59)[_0x7422('0x1e')](_0xa7ff41);}return null;};}function patchUpdates(_0x3eb555){return function(_0x55f98f){try{jsonpatch['apply'](_0x55f98f,_0x3eb555,!![]);}catch(_0x2fedd2){return BPromise[_0x7422('0x23')](_0x2fedd2);}return _0x55f98f[_0x7422('0x24')]();};}function saveUpdates(_0x7d34f2,_0x71d28c){return function(_0x35e2b0){if(_0x35e2b0){return _0x35e2b0[_0x7422('0x25')](_0x7d34f2)['then'](function(_0x24ce62){return _0x24ce62;});}return null;};}function removeEntity(_0x46b927,_0x4fc200){return function(_0x3a5a0c){if(_0x3a5a0c){return _0x3a5a0c[_0x7422('0x26')]()[_0x7422('0x27')](function(){var _0x3eeb9c=_0x3a5a0c['get']({'plain':!![]});var _0x3f579a=_0x7422('0x28');return db[_0x7422('0x29')][_0x7422('0x26')]({'where':{'type':_0x3f579a,'resourceId':_0x3eeb9c['id']}})[_0x7422('0x27')](function(){return _0x3a5a0c;});})['then'](function(){_0x46b927[_0x7422('0x1d')](0xcc)[_0x7422('0x1c')]();});}};}function handleEntityNotFound(_0x81c27e,_0x11e94f){return function(_0x5ae0f7){if(!_0x5ae0f7){_0x81c27e[_0x7422('0x1b')](0x194);}return _0x5ae0f7;};}function handleError(_0x20f71e,_0x9b0144){_0x9b0144=_0x9b0144||0x1f4;return function(_0x702aef){logger['error'](_0x702aef[_0x7422('0x2a')]);if(_0x702aef[_0x7422('0x2b')]){delete _0x702aef['name'];}_0x20f71e['status'](_0x9b0144)[_0x7422('0x2c')](_0x702aef);};}exports[_0x7422('0x2d')]=function(_0x5e08f7,_0x1d5ae5){var _0x194a5e={},_0x3f577e={},_0x3c3f9d={'count':0x0,'rows':[]};var _0x1f23b7=_[_0x7422('0x2e')](db[_0x7422('0x2f')][_0x7422('0x30')],function(_0xdaf900){return{'name':_0xdaf900[_0x7422('0x31')],'type':_0xdaf900[_0x7422('0x32')]['key']};});_0x3f577e[_0x7422('0x33')]=_[_0x7422('0x2e')](_0x1f23b7,_0x7422('0x2b'));_0x3f577e[_0x7422('0x34')]=_['keys'](_0x5e08f7[_0x7422('0x34')]);_0x3f577e[_0x7422('0x35')]=_[_0x7422('0x36')](_0x3f577e['model'],_0x3f577e['query']);_0x194a5e[_0x7422('0x37')]=_['intersection'](_0x3f577e[_0x7422('0x33')],qs['fields'](_0x5e08f7[_0x7422('0x34')]['fields']));_0x194a5e[_0x7422('0x37')]=_0x194a5e['attributes']['length']?_0x194a5e[_0x7422('0x37')]:_0x3f577e['model'];if(!_0x5e08f7[_0x7422('0x34')][_0x7422('0x38')](_0x7422('0x39'))){_0x194a5e[_0x7422('0x20')]=qs[_0x7422('0x20')](_0x5e08f7[_0x7422('0x34')][_0x7422('0x20')]);_0x194a5e['offset']=qs[_0x7422('0x1f')](_0x5e08f7[_0x7422('0x34')][_0x7422('0x1f')]);}_0x194a5e[_0x7422('0x3a')]=qs[_0x7422('0x3b')](_0x5e08f7['query'][_0x7422('0x3b')]);_0x194a5e[_0x7422('0x3c')]=qs['filters'](_[_0x7422('0x3d')](_0x5e08f7['query'],_0x3f577e[_0x7422('0x35')]),_0x1f23b7);if(_0x5e08f7['query']['filter']){_0x194a5e[_0x7422('0x3c')]=_[_0x7422('0x3e')](_0x194a5e[_0x7422('0x3c')],{'$or':_['map'](_0x1f23b7,function(_0x4ecce){if(_0x4ecce[_0x7422('0x32')]!=='VIRTUAL'){var _0x477c13={};_0x477c13[_0x4ecce['name']]={'$like':'%'+_0x5e08f7[_0x7422('0x34')][_0x7422('0x3f')]+'%'};return _0x477c13;}})});}_0x194a5e=_[_0x7422('0x3e')]({},_0x194a5e,_0x5e08f7[_0x7422('0x40')]);var _0x2508dd={'where':_0x194a5e[_0x7422('0x3c')]};return db[_0x7422('0x2f')]['count'](_0x2508dd)[_0x7422('0x27')](function(_0x2b45de){_0x3c3f9d['count']=_0x2b45de;if(_0x5e08f7[_0x7422('0x34')][_0x7422('0x41')]){_0x194a5e['include']=[{'all':!![]}];}return db[_0x7422('0x2f')]['findAll'](_0x194a5e);})[_0x7422('0x27')](function(_0x516430){_0x3c3f9d[_0x7422('0x42')]=_0x516430;return _0x3c3f9d;})[_0x7422('0x27')](respondWithFilteredResult(_0x1d5ae5,_0x194a5e))[_0x7422('0x43')](handleError(_0x1d5ae5,null));};exports[_0x7422('0x44')]=function(_0x451ebb,_0x208e72){var _0x40c1dd={'raw':!![],'where':{'id':_0x451ebb[_0x7422('0x45')]['id']}},_0x40441a={};_0x40441a[_0x7422('0x33')]=_['keys'](db[_0x7422('0x2f')]['rawAttributes']);_0x40441a['query']=_[_0x7422('0x46')](_0x451ebb[_0x7422('0x34')]);_0x40441a['filters']=_[_0x7422('0x36')](_0x40441a[_0x7422('0x33')],_0x40441a[_0x7422('0x34')]);_0x40c1dd[_0x7422('0x37')]=_[_0x7422('0x36')](_0x40441a[_0x7422('0x33')],qs[_0x7422('0x47')](_0x451ebb['query'][_0x7422('0x47')]));_0x40c1dd[_0x7422('0x37')]=_0x40c1dd[_0x7422('0x37')][_0x7422('0x48')]?_0x40c1dd['attributes']:_0x40441a[_0x7422('0x33')];if(_0x451ebb[_0x7422('0x34')][_0x7422('0x41')]){_0x40c1dd['include']=[{'all':!![]}];}_0x40c1dd=_[_0x7422('0x3e')]({},_0x40c1dd,_0x451ebb[_0x7422('0x40')]);return db['MailQueue']['find'](_0x40c1dd)['then'](handleEntityNotFound(_0x208e72,null))[_0x7422('0x27')](respondWithResult(_0x208e72,null))[_0x7422('0x43')](handleError(_0x208e72,null));};exports['create']=function(_0x4c6896,_0x50e9bb){return db[_0x7422('0x2f')][_0x7422('0x49')](_0x4c6896[_0x7422('0x4a')],{})[_0x7422('0x27')](function(_0x557bcc){var _0x56e97b=_0x4c6896[_0x7422('0x4b')][_0x7422('0x4c')]({'plain':!![]});if(!_0x56e97b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x56e97b[_0x7422('0x4d')]===_0x7422('0x4b')){var _0x5034f8=_0x557bcc[_0x7422('0x4c')]({'plain':!![]});var _0x17de3f=_0x7422('0x28');return db[_0x7422('0x4e')][_0x7422('0x4f')]({'where':{'name':_0x17de3f,'userProfileId':_0x56e97b[_0x7422('0x50')]},'raw':!![]})[_0x7422('0x27')](function(_0x38ed10){if(_0x38ed10&&_0x38ed10[_0x7422('0x51')]===0x0){return db[_0x7422('0x29')]['create']({'name':_0x5034f8[_0x7422('0x2b')],'resourceId':_0x5034f8['id'],'type':_0x38ed10[_0x7422('0x2b')],'sectionId':_0x38ed10['id']},{})[_0x7422('0x27')](function(){return _0x557bcc;});}else{return _0x557bcc;}})['catch'](function(_0x285cf7){logger[_0x7422('0x52')](_0x7422('0x53'),_0x285cf7);throw _0x285cf7;});}return _0x557bcc;})[_0x7422('0x27')](respondWithResult(_0x50e9bb,0xc9))[_0x7422('0x43')](handleError(_0x50e9bb,null));};exports[_0x7422('0x25')]=function(_0x55efae,_0x281e14){if(_0x55efae[_0x7422('0x4a')]['id']){delete _0x55efae[_0x7422('0x4a')]['id'];}return db[_0x7422('0x2f')][_0x7422('0x4f')]({'where':{'id':_0x55efae[_0x7422('0x45')]['id']}})[_0x7422('0x27')](handleEntityNotFound(_0x281e14,null))['then'](saveUpdates(_0x55efae[_0x7422('0x4a')],null))['then'](respondWithResult(_0x281e14,null))['catch'](handleError(_0x281e14,null));};exports[_0x7422('0x26')]=function(_0x52ab59,_0x35cb5b){return db[_0x7422('0x2f')][_0x7422('0x4f')]({'where':{'id':_0x52ab59['params']['id']}})[_0x7422('0x27')](handleEntityNotFound(_0x35cb5b,null))[_0x7422('0x27')](removeEntity(_0x35cb5b,null))[_0x7422('0x43')](handleError(_0x35cb5b,null));};exports[_0x7422('0x54')]=function(_0x57e7a7,_0x5889f7){return db[_0x7422('0x2f')][_0x7422('0x54')]()['then'](respondWithResult(_0x5889f7,null))['catch'](handleError(_0x5889f7,null));};exports[_0x7422('0x55')]=function(_0x935550,_0x2d87c8,_0xabcc7){var _0x3a48ae={'raw':!![],'where':{}},_0x296f69={},_0x127f15;return db[_0x7422('0x2f')][_0x7422('0x56')]({'where':{'id':_0x935550[_0x7422('0x45')]['id']}})['then'](handleEntityNotFound(_0x2d87c8,null))[_0x7422('0x27')](function(_0x285c82){if(_0x285c82){_0x127f15=_0x285c82[_0x7422('0x4c')]({'plain':!![]});_0x296f69[_0x7422('0x33')]=_[_0x7422('0x46')](db[_0x7422('0x57')]['rawAttributes']);_0x296f69[_0x7422('0x34')]=_[_0x7422('0x46')](_0x935550[_0x7422('0x34')]);_0x296f69[_0x7422('0x35')]=_[_0x7422('0x36')](_0x296f69[_0x7422('0x33')],_0x296f69[_0x7422('0x34')]);_0x3a48ae[_0x7422('0x37')]=_['intersection'](_0x296f69['model'],qs[_0x7422('0x47')](_0x935550[_0x7422('0x34')][_0x7422('0x47')]));_0x3a48ae['attributes']=_0x3a48ae[_0x7422('0x37')]['length']?_0x3a48ae['attributes']:_0x296f69[_0x7422('0x33')];if(!_0x935550['query'][_0x7422('0x38')](_0x7422('0x39'))){_0x3a48ae[_0x7422('0x20')]=qs[_0x7422('0x20')](_0x935550[_0x7422('0x34')][_0x7422('0x20')]);_0x3a48ae[_0x7422('0x1f')]=qs[_0x7422('0x1f')](_0x935550[_0x7422('0x34')][_0x7422('0x1f')]);}_0x3a48ae[_0x7422('0x3a')]=qs['sort'](_0x935550[_0x7422('0x34')][_0x7422('0x3b')]);_0x3a48ae[_0x7422('0x3c')]=qs[_0x7422('0x35')](_['pick'](_0x935550[_0x7422('0x34')],_0x296f69['filters']));_0x3a48ae[_0x7422('0x3c')]['MailQueueId']=_0x285c82['id'];if(_0x935550[_0x7422('0x34')][_0x7422('0x3f')]){_0x3a48ae['where']=_[_0x7422('0x3e')](_0x3a48ae[_0x7422('0x3c')],{'$or':_[_0x7422('0x2e')](_0x3a48ae[_0x7422('0x37')],function(_0x27d478){var _0x127a61={};_0x127a61[_0x27d478]={'$like':'%'+_0x935550['query'][_0x7422('0x3f')]+'%'};return _0x127a61;})});}_0x3a48ae=_[_0x7422('0x3e')]({},_0x3a48ae,_0x935550['options']);return db[_0x7422('0x57')][_0x7422('0x58')](_0x3a48ae);}})['then'](function(_0x2784bf){if(_0x2784bf){return db['User'][_0x7422('0x59')]({'where':{'id':_[_0x7422('0x2e')](_0x2784bf,_0x7422('0x5a')),'role':_0x7422('0x5b')},'attributes':['id',_0x7422('0x2b'),_0x7422('0x5c'),_0x7422('0x5d'),'createdAt']});}})[_0x7422('0x27')](function(_0x5a3e4c){if(_0x5a3e4c){return{'count':_0x5a3e4c[_0x7422('0x5e')],'rows':_[_0x7422('0x2e')](_0x5a3e4c['rows'],function(_0x10df21){return{'membername':_0x10df21[_0x7422('0x2b')],'UserId':_0x10df21['id'],'queue_name':_0x127f15[_0x7422('0x2b')],'MailQueueId':_0x127f15['id'],'interface':util[_0x7422('0x5f')]('%s/%s','SIP',_0x10df21[_0x7422('0x2b')]),'penalty':0x0,'paused':_0x10df21[_0x7422('0x5c')],'createdAt':_0x10df21[_0x7422('0x60')],'updatedAt':_0x10df21[_0x7422('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7422('0x27')](respondWithFilteredResult(_0x2d87c8,_0x3a48ae))[_0x7422('0x43')](handleError(_0x2d87c8,null));};exports[_0x7422('0x61')]=function(_0x32ba78,_0x3e6367,_0x4f04be){var _0x170705={};var _0x514724={};var _0x4f0d0f;var _0x110b3f;return db['MailQueue']['findOne']({'where':{'id':_0x32ba78[_0x7422('0x45')]['id']}})[_0x7422('0x27')](handleEntityNotFound(_0x3e6367,null))[_0x7422('0x27')](function(_0x223908){if(_0x223908){_0x4f0d0f=_0x223908;_0x514724[_0x7422('0x33')]=_[_0x7422('0x46')](db[_0x7422('0x62')][_0x7422('0x30')]);_0x514724['query']=_[_0x7422('0x46')](_0x32ba78[_0x7422('0x34')]);_0x514724[_0x7422('0x35')]=_[_0x7422('0x36')](_0x514724['model'],_0x514724[_0x7422('0x34')]);_0x170705[_0x7422('0x37')]=_[_0x7422('0x36')](_0x514724[_0x7422('0x33')],qs['fields'](_0x32ba78[_0x7422('0x34')][_0x7422('0x47')]));_0x170705[_0x7422('0x37')]=_0x170705['attributes'][_0x7422('0x48')]?_0x170705[_0x7422('0x37')]:_0x514724[_0x7422('0x33')];_0x170705[_0x7422('0x3a')]=qs[_0x7422('0x3b')](_0x32ba78[_0x7422('0x34')][_0x7422('0x3b')]);_0x170705['where']=qs[_0x7422('0x35')](_[_0x7422('0x3d')](_0x32ba78[_0x7422('0x34')],_0x514724[_0x7422('0x35')]));if(_0x32ba78['query'][_0x7422('0x3f')]){_0x170705['where']=_[_0x7422('0x3e')](_0x170705[_0x7422('0x3c')],{'$or':_[_0x7422('0x2e')](_0x170705['attributes'],function(_0x153054){var _0x171e0a={};_0x171e0a[_0x153054]={'$like':'%'+_0x32ba78[_0x7422('0x34')]['filter']+'%'};return _0x171e0a;})});}_0x170705=_[_0x7422('0x3e')]({},_0x170705,_0x32ba78[_0x7422('0x40')]);return _0x4f0d0f[_0x7422('0x61')](_0x170705);}})['then'](function(_0x1321b3){if(_0x1321b3){_0x110b3f=_0x1321b3[_0x7422('0x48')];if(!_0x32ba78[_0x7422('0x34')][_0x7422('0x38')](_0x7422('0x39'))){_0x170705[_0x7422('0x20')]=qs[_0x7422('0x20')](_0x32ba78['query'][_0x7422('0x20')]);_0x170705[_0x7422('0x1f')]=qs[_0x7422('0x1f')](_0x32ba78[_0x7422('0x34')][_0x7422('0x1f')]);}return _0x4f0d0f[_0x7422('0x61')](_0x170705);}})[_0x7422('0x27')](function(_0x2d003a){if(_0x2d003a){return _0x2d003a?{'count':_0x110b3f,'rows':_0x2d003a}:null;}})[_0x7422('0x27')](respondWithResult(_0x3e6367,null))[_0x7422('0x43')](handleError(_0x3e6367,null));};exports[_0x7422('0x63')]=function(_0x181469,_0x399c86,_0x119c9b){var _0x3c8a2b=_0x181469[_0x7422('0x4a')]['ids'];return db[_0x7422('0x62')][_0x7422('0x58')]({'where':{'id':_0x3c8a2b},'attributes':['id'],'include':[{'model':db[_0x7422('0x64')],'as':_0x7422('0x65'),'attributes':['id','name',_0x7422('0x66'),_0x7422('0x67'),'interface'],'raw':!![]}]})[_0x7422('0x27')](function(_0x3312ac){if(_0x3312ac){var _0x501065=_[_0x7422('0x68')](_0x3312ac,function(_0x289bb4){var _0x43ee8d=_0x289bb4[_0x7422('0x4c')]({'plain':!![]});return _0x43ee8d['Agents'];});return db[_0x7422('0x2f')][_0x7422('0x4f')]({'where':{'id':_0x181469[_0x7422('0x45')]['id']}})['then'](function(_0x1eb34f){return db[_0x7422('0x69')][_0x7422('0x6a')](function(_0x491927){return _0x1eb34f[_0x7422('0x63')](_0x3c8a2b,{'transaction':_0x491927})[_0x7422('0x27')](function(){return BPromise[_0x7422('0x6b')](_0x501065,function(_0x45641e){return db[_0x7422('0x57')]['findOrCreate']({'where':{'UserId':_0x45641e['id'],'MailQueueId':_0x181469[_0x7422('0x45')]['id']},'transaction':_0x491927});});})[_0x7422('0x27')](function(){_0x501065[_0x7422('0x6c')](function(_0x5cabcc){socket[_0x7422('0x6d')](_0x7422('0x6e'),{'UserId':_0x5cabcc['id'],'MailQueueId':_0x1eb34f['id']});});});});});}})[_0x7422('0x27')](respondWithStatusCode(_0x399c86,null))[_0x7422('0x43')](handleError(_0x399c86,null));};exports['removeTeams']=function(_0x268962,_0x212b6f,_0x5a0ff5){return db[_0x7422('0x62')][_0x7422('0x58')]({'where':{'id':_0x268962[_0x7422('0x34')][_0x7422('0x6f')]},'attributes':['id'],'include':[{'model':db[_0x7422('0x64')],'as':_0x7422('0x65'),'attributes':['id'],'raw':!![]}]})[_0x7422('0x27')](handleEntityNotFound(_0x212b6f,null))[_0x7422('0x27')](function(_0x5ee1e9){var _0x40e6aa=_[_0x7422('0x2e')](_0x5ee1e9,'id');var _0x659249=[];var _0x4ee0c9=[];var _0x388952=squel[_0x7422('0x70')]();_0x388952[_0x7422('0x71')](_0x7422('0x72'))[_0x7422('0x73')](_0x7422('0x74'),'tq')[_0x7422('0x75')]('user_has_teams','ut',_0x7422('0x76'))[_0x7422('0x3c')](_0x7422('0x77'),_0x268962[_0x7422('0x45')]['id']);for(var _0x327ebd=0x0;_0x327ebd<_0x5ee1e9[_0x7422('0x48')];_0x327ebd+=0x1){let _0x251f32=_0x5ee1e9[_0x327ebd];for(var _0x25a9df=0x0;_0x25a9df<_0x251f32[_0x7422('0x65')]['length'];_0x25a9df+=0x1){let _0x5731f2=_0x251f32[_0x7422('0x65')][_0x25a9df];var _0x4ec39d=_0x388952[_0x7422('0x78')]();_0x4ec39d[_0x7422('0x3c')](_0x7422('0x79'),_0x5731f2['id']);_0x4ee0c9[_0x7422('0x7a')](db[_0x7422('0x69')][_0x7422('0x34')](_0x4ec39d[_0x7422('0x7b')](),{'type':db[_0x7422('0x69')][_0x7422('0x7c')][_0x7422('0x7d')]})['then'](function(_0x16e181){if(_0x16e181[_0x7422('0x48')]===0x1){return _0x5731f2['id'];}else{var _0x1c75e1=_['every'](_[_0x7422('0x2e')](_0x16e181,'TeamId'),function(_0x311882){return _[_0x7422('0x7e')](_0x40e6aa,_0x311882);});if(_0x1c75e1){return _0x5731f2['id'];}}}));}}return BPromise[_0x7422('0x7f')](_0x4ee0c9)['then'](function(_0x110443){_0x659249=_(_0x659249)[_0x7422('0x80')](_0x110443)[_0x7422('0x81')]()[_0x7422('0x82')]();return db[_0x7422('0x2f')][_0x7422('0x4f')]({'where':{'id':_0x268962[_0x7422('0x45')]['id']}})[_0x7422('0x27')](function(_0x2f9ceb){return db['sequelize']['transaction'](function(_0x255626){return _0x2f9ceb[_0x7422('0x83')](_0x268962[_0x7422('0x34')][_0x7422('0x6f')],{'transaction':_0x255626})[_0x7422('0x27')](function(){if(!_[_0x7422('0x84')](_0x659249)){return _0x2f9ceb['removeAgents'](_0x659249,{'transaction':_0x255626});}})[_0x7422('0x27')](function(){_0x659249['forEach'](function(_0x410c97){socket[_0x7422('0x6d')](_0x7422('0x85'),{'UserId':_0x410c97,'MailQueueId':_0x2f9ceb['id']});});});});});});})['then'](respondWithStatusCode(_0x212b6f,null))[_0x7422('0x43')](handleError(_0x212b6f,null));};exports[_0x7422('0x86')]=function(_0xa350af,_0x503d02,_0x5038c2){return db[_0x7422('0x2f')]['find']({'where':{'id':_0xa350af['params']['id']}})[_0x7422('0x27')](handleEntityNotFound(_0x503d02,null))[_0x7422('0x27')](function(_0x2616bb){if(_0x2616bb){return _0x2616bb[_0x7422('0x86')](_0xa350af[_0x7422('0x4a')][_0x7422('0x6f')],_[_0x7422('0x87')](_0xa350af[_0x7422('0x4a')],[_0x7422('0x6f'),'id'])||{})[_0x7422('0x88')](function(_0x4a2037){for(var _0x328631=0x0;_0x328631<_0xa350af['body'][_0x7422('0x6f')]['length'];_0x328631+=0x1){socket[_0x7422('0x6d')](_0x7422('0x6e'),{'UserId':_0xa350af['body'][_0x7422('0x6f')][_0x328631],'MailQueueId':_0xa350af[_0x7422('0x45')]['id']});}return _0x4a2037;});}})[_0x7422('0x27')](respondWithResult(_0x503d02,null))[_0x7422('0x43')](handleError(_0x503d02,null));};exports[_0x7422('0x89')]=function(_0x3a1f22,_0x5cc169,_0xe8b729){return db[_0x7422('0x2f')]['find']({'where':{'id':_0x3a1f22[_0x7422('0x45')]['id']}})['then'](handleEntityNotFound(_0x5cc169,null))[_0x7422('0x27')](function(_0x3d9162){if(_0x3d9162){return _0x3d9162[_0x7422('0x89')](_0x3a1f22[_0x7422('0x34')][_0x7422('0x6f')])['then'](function(){if(_[_0x7422('0x8a')](_0x3a1f22[_0x7422('0x34')][_0x7422('0x6f')])){for(var _0x3fe0fc=0x0;_0x3fe0fc<_0x3a1f22['query']['ids'][_0x7422('0x48')];_0x3fe0fc+=0x1){socket[_0x7422('0x6d')](_0x7422('0x85'),{'UserId':Number(_0x3a1f22[_0x7422('0x34')][_0x7422('0x6f')][_0x3fe0fc]),'MailQueueId':Number(_0x3a1f22[_0x7422('0x45')]['id'])});}}else{socket[_0x7422('0x6d')](_0x7422('0x85'),{'UserId':Number(_0x3a1f22[_0x7422('0x34')][_0x7422('0x6f')]),'MailQueueId':Number(_0x3a1f22[_0x7422('0x45')]['id'])});}});}})['then'](respondWithStatusCode(_0x5cc169,null))[_0x7422('0x43')](handleError(_0x5cc169,null));};exports['getAgents']=function(_0x2ccf2f,_0x189070,_0x1f43d1){var _0x391989={};var _0x376700={};var _0x5e1c9f;var _0x1ca944;return db[_0x7422('0x2f')][_0x7422('0x56')]({'where':{'id':_0x2ccf2f[_0x7422('0x45')]['id']}})[_0x7422('0x27')](handleEntityNotFound(_0x189070,null))['then'](function(_0x11b066){if(_0x11b066){_0x5e1c9f=_0x11b066;_0x376700[_0x7422('0x33')]=_[_0x7422('0x46')](db[_0x7422('0x64')][_0x7422('0x30')]);_0x376700[_0x7422('0x34')]=_[_0x7422('0x46')](_0x2ccf2f['query']);_0x376700['filters']=_['intersection'](_0x376700[_0x7422('0x33')],_0x376700[_0x7422('0x34')]);_0x391989[_0x7422('0x37')]=_[_0x7422('0x36')](_0x376700[_0x7422('0x33')],qs[_0x7422('0x47')](_0x2ccf2f[_0x7422('0x34')]['fields']));_0x391989[_0x7422('0x37')]=_0x391989[_0x7422('0x37')][_0x7422('0x48')]?_0x391989[_0x7422('0x37')]:_0x376700[_0x7422('0x33')];_0x391989['order']=qs[_0x7422('0x3b')](_0x2ccf2f[_0x7422('0x34')][_0x7422('0x3b')]);_0x391989[_0x7422('0x3c')]=qs['filters'](_[_0x7422('0x3d')](_0x2ccf2f['query'],_0x376700[_0x7422('0x35')]));if(_0x2ccf2f[_0x7422('0x34')]['filter']){_0x391989[_0x7422('0x3c')]=_[_0x7422('0x3e')](_0x391989[_0x7422('0x3c')],{'$or':_['map'](_0x391989[_0x7422('0x37')],function(_0x2b7afc){var _0x20f282={};_0x20f282[_0x2b7afc]={'$like':'%'+_0x2ccf2f['query']['filter']+'%'};return _0x20f282;})});}_0x391989=_[_0x7422('0x3e')]({},_0x391989,_0x2ccf2f[_0x7422('0x40')]);return _0x5e1c9f['getAgents'](_0x391989);}})[_0x7422('0x27')](function(_0x25c130){if(_0x25c130){_0x1ca944=_0x25c130[_0x7422('0x48')];if(!_0x2ccf2f[_0x7422('0x34')][_0x7422('0x38')](_0x7422('0x39'))){_0x391989[_0x7422('0x20')]=qs[_0x7422('0x20')](_0x2ccf2f[_0x7422('0x34')]['limit']);_0x391989[_0x7422('0x1f')]=qs[_0x7422('0x1f')](_0x2ccf2f[_0x7422('0x34')][_0x7422('0x1f')]);}return _0x5e1c9f[_0x7422('0x8b')](_0x391989);}})[_0x7422('0x27')](function(_0x36092c){if(_0x36092c){return _0x36092c?{'count':_0x1ca944,'rows':_0x36092c}:null;}})[_0x7422('0x27')](respondWithResult(_0x189070,null))[_0x7422('0x43')](handleError(_0x189070,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index df65180..fc5cf49 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 _0x4510=['MailQueue','setMaxListeners','save','remove','emit','hook','exports','../../mysqldb'];(function(_0x218695,_0x37ad20){var _0x3e759e=function(_0x5164a8){while(--_0x5164a8){_0x218695['push'](_0x218695['shift']());}};_0x3e759e(++_0x37ad20);}(_0x4510,0x197));var _0x0451=function(_0x1c37f4,_0x3a9610){_0x1c37f4=_0x1c37f4-0x0;var _0xc0552e=_0x4510[_0x1c37f4];return _0xc0552e;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x0451('0x0'))['db'][_0x0451('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x0451('0x2')](0x0);var events={'afterCreate':_0x0451('0x3'),'afterUpdate':'update','afterDestroy':_0x0451('0x4')};function emitEvent(_0x170e2e){return function(_0x29cb03,_0x2060a0,_0x174e45){MailQueueEvents[_0x0451('0x5')](_0x170e2e+':'+_0x29cb03['id'],_0x29cb03);MailQueueEvents[_0x0451('0x5')](_0x170e2e,_0x29cb03);_0x174e45(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x0451('0x6')](e,emitEvent(event));}}module[_0x0451('0x7')]=MailQueueEvents; \ No newline at end of file +var _0xc80a=['MailQueue','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x3d8d5a,_0x1109fd){var _0x2b6354=function(_0x3ddc8c){while(--_0x3ddc8c){_0x3d8d5a['push'](_0x3d8d5a['shift']());}};_0x2b6354(++_0x1109fd);}(_0xc80a,0x6b));var _0xac80=function(_0x300531,_0xfd2fdc){_0x300531=_0x300531-0x0;var _0x791405=_0xc80a[_0x300531];return _0x791405;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xac80('0x0'))['db'][_0xac80('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xac80('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xac80('0x3'),'afterDestroy':_0xac80('0x4')};function emitEvent(_0x238930){return function(_0x30c196,_0x1cac8d,_0x3c2676){MailQueueEvents[_0xac80('0x5')](_0x238930+':'+_0x30c196['id'],_0x30c196);MailQueueEvents[_0xac80('0x5')](_0x238930,_0x30c196);_0x3c2676(null);};}for(var e in events){if(events[_0xac80('0x6')](e)){var event=events[e];MailQueue[_0xac80('0x7')](e,emitEvent(event));}}module[_0xac80('0x8')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 719edd9..92c76ef 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 _0x2ee4=['path','rimraf','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x27c038,_0x18a452){var _0x1be2f9=function(_0x31ddc8){while(--_0x31ddc8){_0x27c038['push'](_0x27c038['shift']());}};_0x1be2f9(++_0x18a452);}(_0x2ee4,0x12d));var _0x42ee=function(_0x2e10b1,_0x845b82){_0x2e10b1=_0x2e10b1-0x0;var _0x41de8b=_0x2ee4[_0x2e10b1];return _0x41de8b;};'use strict';var _=require(_0x42ee('0x0'));var util=require(_0x42ee('0x1'));var logger=require(_0x42ee('0x2'))(_0x42ee('0x3'));var moment=require(_0x42ee('0x4'));var BPromise=require(_0x42ee('0x5'));var rp=require(_0x42ee('0x6'));var fs=require('fs');var path=require(_0x42ee('0x7'));var rimraf=require(_0x42ee('0x8'));var config=require('../../config/environment');var attributes=require(_0x42ee('0x9'));module[_0x42ee('0xa')]=function(_0x3f6e26,_0x373efc){return _0x3f6e26[_0x42ee('0xb')](_0x42ee('0xc'),attributes,{'tableName':_0x42ee('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3caf=['MailQueue','mail_queues','lodash','util','../../config/logger','api','bluebird','path','rimraf','exports','define'];(function(_0xa1151e,_0x3c5220){var _0x27d97f=function(_0x2f239d){while(--_0x2f239d){_0xa1151e['push'](_0xa1151e['shift']());}};_0x27d97f(++_0x3c5220);}(_0x3caf,0x1c5));var _0xf3ca=function(_0x4e2d5e,_0x373a23){_0x4e2d5e=_0x4e2d5e-0x0;var _0x141950=_0x3caf[_0x4e2d5e];return _0x141950;};'use strict';var _=require(_0xf3ca('0x0'));var util=require(_0xf3ca('0x1'));var logger=require(_0xf3ca('0x2'))(_0xf3ca('0x3'));var moment=require('moment');var BPromise=require(_0xf3ca('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf3ca('0x5'));var rimraf=require(_0xf3ca('0x6'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0xf3ca('0x7')]=function(_0x12d3bd,_0x45ce6e){return _0x12d3bd[_0xf3ca('0x8')](_0xf3ca('0x9'),attributes,{'tableName':_0xf3ca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index a52e783..6d3d0a9 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 _0x73b7=['localhost','socket.io-emitter','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','findAll','options','where','attributes','limit','include','map','model','ShowMailQueue','MailQueue','find','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x73b7,0x1bd));var _0x773b=function(_0x50a2ee,_0x5ef06e){_0x50a2ee=_0x50a2ee-0x0;var _0x130080=_0x73b7[_0x50a2ee];return _0x130080;};'use strict';var _=require(_0x773b('0x0'));var util=require(_0x773b('0x1'));var moment=require(_0x773b('0x2'));var BPromise=require(_0x773b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x773b('0x4'))['db'];var utils=require(_0x773b('0x5'));var logger=require(_0x773b('0x6'))('rpc');var config=require(_0x773b('0x7'));var jayson=require(_0x773b('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x773b('0x9')]=_[_0x773b('0xa')](config[_0x773b('0x9')],{'host':_0x773b('0xb'),'port':0x18eb});var socket=require(_0x773b('0xc'))(new Redis(config[_0x773b('0x9')]));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0x251ca7,_0x17a704,_0x5c6df2){return new BPromise(function(_0x26e28d,_0x15483f){return client[_0x773b('0xd')](_0x251ca7,_0x5c6df2)[_0x773b('0xe')](function(_0x12557f){logger[_0x773b('0xf')](_0x773b('0x10'),_0x17a704,_0x773b('0x11'));logger[_0x773b('0x12')](_0x773b('0x13'),_0x17a704,_0x773b('0x11'),JSON[_0x773b('0x14')](_0x12557f));if(_0x12557f[_0x773b('0x15')]){if(_0x12557f[_0x773b('0x15')][_0x773b('0x16')]===0x1f4){logger[_0x773b('0x15')]('MailQueue,\x20%s,\x20%s',_0x17a704,_0x12557f[_0x773b('0x15')]['message']);return _0x15483f(_0x12557f[_0x773b('0x15')][_0x773b('0x17')]);}logger[_0x773b('0x15')](_0x773b('0x10'),_0x17a704,_0x12557f[_0x773b('0x15')][_0x773b('0x17')]);return _0x26e28d(_0x12557f[_0x773b('0x15')][_0x773b('0x17')]);}else{logger['info'](_0x773b('0x10'),_0x17a704,_0x773b('0x11'));_0x26e28d(_0x12557f[_0x773b('0x18')][_0x773b('0x17')]);}})[_0x773b('0x19')](function(_0x2bbe00){logger['error']('MailQueue,\x20%s,\x20%s',_0x17a704,_0x2bbe00);_0x15483f(_0x2bbe00);});});}exports[_0x773b('0x1a')]=function(_0x4229a6){var _0x433526=this;return new Promise(function(_0x4b608f,_0x52e365){return db['MailQueue'][_0x773b('0x1b')]({'raw':_0x4229a6[_0x773b('0x1c')]?_0x4229a6['options']['raw']===undefined?!![]:![]:!![],'where':_0x4229a6[_0x773b('0x1c')]?_0x4229a6['options'][_0x773b('0x1d')]||null:null,'attributes':_0x4229a6[_0x773b('0x1c')]?_0x4229a6[_0x773b('0x1c')][_0x773b('0x1e')]||null:null,'limit':_0x4229a6[_0x773b('0x1c')]?_0x4229a6[_0x773b('0x1c')][_0x773b('0x1f')]||null:null,'include':_0x4229a6[_0x773b('0x1c')]?_0x4229a6[_0x773b('0x1c')][_0x773b('0x20')]?_[_0x773b('0x21')](_0x4229a6['options'][_0x773b('0x20')],function(_0x331016){return{'model':db[_0x331016[_0x773b('0x22')]],'as':_0x331016['as'],'attributes':_0x331016[_0x773b('0x1e')],'include':_0x331016[_0x773b('0x20')]?_[_0x773b('0x21')](_0x331016[_0x773b('0x20')],function(_0x36f046){return{'model':db[_0x36f046[_0x773b('0x22')]],'as':_0x36f046['as'],'attributes':_0x36f046[_0x773b('0x1e')],'include':_0x36f046['include']?_[_0x773b('0x21')](_0x36f046['include'],function(_0xcf0126){return{'model':db[_0xcf0126[_0x773b('0x22')]],'as':_0xcf0126['as'],'attributes':_0xcf0126[_0x773b('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29794f){logger[_0x773b('0xf')]('GetMailQueue',_0x4229a6);logger[_0x773b('0x12')](_0x773b('0x1a'),_0x4229a6,JSON[_0x773b('0x14')](_0x29794f));_0x4b608f(_0x29794f);})[_0x773b('0x19')](function(_0x1f7355){logger['error']('GetMailQueue',_0x1f7355[_0x773b('0x17')],_0x4229a6);_0x52e365(_0x433526[_0x773b('0x15')](0x1f4,_0x1f7355[_0x773b('0x17')]));});});};exports[_0x773b('0x23')]=function(_0x5a0c1c){var _0x1328e5=this;return new Promise(function(_0x44a770,_0x3cd8e4){return db[_0x773b('0x24')][_0x773b('0x25')]({'raw':_0x5a0c1c[_0x773b('0x1c')]?_0x5a0c1c[_0x773b('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x5a0c1c[_0x773b('0x1c')]?_0x5a0c1c[_0x773b('0x1c')][_0x773b('0x1d')]||null:null,'attributes':_0x5a0c1c[_0x773b('0x1c')]?_0x5a0c1c[_0x773b('0x1c')]['attributes']||null:null,'include':_0x5a0c1c[_0x773b('0x1c')]?_0x5a0c1c[_0x773b('0x1c')][_0x773b('0x20')]?_[_0x773b('0x21')](_0x5a0c1c['options']['include'],function(_0x3e14e7){return{'model':db[_0x3e14e7[_0x773b('0x22')]],'as':_0x3e14e7['as'],'attributes':_0x3e14e7[_0x773b('0x1e')],'include':_0x3e14e7['include']?_[_0x773b('0x21')](_0x3e14e7[_0x773b('0x20')],function(_0xa58a59){return{'model':db[_0xa58a59[_0x773b('0x22')]],'as':_0xa58a59['as'],'attributes':_0xa58a59['attributes'],'include':_0xa58a59[_0x773b('0x20')]?_[_0x773b('0x21')](_0xa58a59[_0x773b('0x20')],function(_0x284fa8){return{'model':db[_0x284fa8[_0x773b('0x22')]],'as':_0x284fa8['as'],'attributes':_0x284fa8[_0x773b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x773b('0xe')](function(_0x4c4769){logger[_0x773b('0xf')](_0x773b('0x23'),_0x5a0c1c);logger[_0x773b('0x12')](_0x773b('0x23'),_0x5a0c1c,JSON[_0x773b('0x14')](_0x4c4769));_0x44a770(_0x4c4769);})[_0x773b('0x19')](function(_0x42f3d4){logger[_0x773b('0x15')](_0x773b('0x23'),_0x42f3d4['message'],_0x5a0c1c);_0x3cd8e4(_0x1328e5['error'](0x1f4,_0x42f3d4[_0x773b('0x17')]));});});}; \ No newline at end of file +var _0xfffe=['jayson/promise','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMailQueue','MailQueue','findAll','raw','options','attributes','limit','include','map','model','ShowMailQueue','find','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2338ae,_0x1896f8){var _0x4adad9=function(_0x1f6ed1){while(--_0x1f6ed1){_0x2338ae['push'](_0x2338ae['shift']());}};_0x4adad9(++_0x1896f8);}(_0xfffe,0x1c0));var _0xefff=function(_0x2dee6e,_0x47ec74){_0x2dee6e=_0x2dee6e-0x0;var _0x34c573=_0xfffe[_0x2dee6e];return _0x34c573;};'use strict';var _=require('lodash');var util=require(_0xefff('0x0'));var moment=require(_0xefff('0x1'));var BPromise=require(_0xefff('0x2'));var rs=require(_0xefff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xefff('0x4'));var logger=require(_0xefff('0x5'))(_0xefff('0x6'));var config=require(_0xefff('0x7'));var jayson=require(_0xefff('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xefff('0x9')]=_[_0xefff('0xa')](config[_0xefff('0x9')],{'host':_0xefff('0xb'),'port':0x18eb});var socket=require(_0xefff('0xc'))(new Redis(config[_0xefff('0x9')]));require(_0xefff('0xd'))['register'](socket);function respondWithRpcPromise(_0x437212,_0x1b5d5d,_0x2ece8a){return new BPromise(function(_0x10df02,_0x43c563){return client['request'](_0x437212,_0x2ece8a)[_0xefff('0xe')](function(_0x476868){logger[_0xefff('0xf')](_0xefff('0x10'),_0x1b5d5d,_0xefff('0x11'));logger[_0xefff('0x12')](_0xefff('0x13'),_0x1b5d5d,_0xefff('0x11'),JSON[_0xefff('0x14')](_0x476868));if(_0x476868[_0xefff('0x15')]){if(_0x476868[_0xefff('0x15')][_0xefff('0x16')]===0x1f4){logger[_0xefff('0x15')](_0xefff('0x10'),_0x1b5d5d,_0x476868[_0xefff('0x15')][_0xefff('0x17')]);return _0x43c563(_0x476868[_0xefff('0x15')][_0xefff('0x17')]);}logger[_0xefff('0x15')]('MailQueue,\x20%s,\x20%s',_0x1b5d5d,_0x476868[_0xefff('0x15')][_0xefff('0x17')]);return _0x10df02(_0x476868['error'][_0xefff('0x17')]);}else{logger[_0xefff('0xf')]('MailQueue,\x20%s,\x20%s',_0x1b5d5d,'request\x20sent');_0x10df02(_0x476868[_0xefff('0x18')]['message']);}})['catch'](function(_0x293f9c){logger[_0xefff('0x15')](_0xefff('0x10'),_0x1b5d5d,_0x293f9c);_0x43c563(_0x293f9c);});});}exports[_0xefff('0x19')]=function(_0x8dccf9){var _0xbdff48=this;return new Promise(function(_0xe5e018,_0x4a6b41){return db[_0xefff('0x1a')][_0xefff('0x1b')]({'raw':_0x8dccf9['options']?_0x8dccf9['options'][_0xefff('0x1c')]===undefined?!![]:![]:!![],'where':_0x8dccf9[_0xefff('0x1d')]?_0x8dccf9[_0xefff('0x1d')]['where']||null:null,'attributes':_0x8dccf9['options']?_0x8dccf9[_0xefff('0x1d')][_0xefff('0x1e')]||null:null,'limit':_0x8dccf9[_0xefff('0x1d')]?_0x8dccf9['options'][_0xefff('0x1f')]||null:null,'include':_0x8dccf9[_0xefff('0x1d')]?_0x8dccf9[_0xefff('0x1d')][_0xefff('0x20')]?_[_0xefff('0x21')](_0x8dccf9[_0xefff('0x1d')]['include'],function(_0xcbb6e5){return{'model':db[_0xcbb6e5['model']],'as':_0xcbb6e5['as'],'attributes':_0xcbb6e5[_0xefff('0x1e')],'include':_0xcbb6e5[_0xefff('0x20')]?_[_0xefff('0x21')](_0xcbb6e5[_0xefff('0x20')],function(_0x45643e){return{'model':db[_0x45643e[_0xefff('0x22')]],'as':_0x45643e['as'],'attributes':_0x45643e[_0xefff('0x1e')],'include':_0x45643e[_0xefff('0x20')]?_[_0xefff('0x21')](_0x45643e[_0xefff('0x20')],function(_0x4edeba){return{'model':db[_0x4edeba[_0xefff('0x22')]],'as':_0x4edeba['as'],'attributes':_0x4edeba[_0xefff('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xefff('0xe')](function(_0x2f1fae){logger['info'](_0xefff('0x19'),_0x8dccf9);logger[_0xefff('0x12')](_0xefff('0x19'),_0x8dccf9,JSON['stringify'](_0x2f1fae));_0xe5e018(_0x2f1fae);})['catch'](function(_0xf1bd2){logger[_0xefff('0x15')](_0xefff('0x19'),_0xf1bd2[_0xefff('0x17')],_0x8dccf9);_0x4a6b41(_0xbdff48[_0xefff('0x15')](0x1f4,_0xf1bd2[_0xefff('0x17')]));});});};exports[_0xefff('0x23')]=function(_0x4b6a99){var _0xf55bf4=this;return new Promise(function(_0x2477c9,_0x4bdc8f){return db[_0xefff('0x1a')][_0xefff('0x24')]({'raw':_0x4b6a99[_0xefff('0x1d')]?_0x4b6a99[_0xefff('0x1d')][_0xefff('0x1c')]===undefined?!![]:![]:!![],'where':_0x4b6a99[_0xefff('0x1d')]?_0x4b6a99[_0xefff('0x1d')]['where']||null:null,'attributes':_0x4b6a99['options']?_0x4b6a99['options'][_0xefff('0x1e')]||null:null,'include':_0x4b6a99['options']?_0x4b6a99[_0xefff('0x1d')][_0xefff('0x20')]?_['map'](_0x4b6a99[_0xefff('0x1d')][_0xefff('0x20')],function(_0x457676){return{'model':db[_0x457676[_0xefff('0x22')]],'as':_0x457676['as'],'attributes':_0x457676[_0xefff('0x1e')],'include':_0x457676[_0xefff('0x20')]?_[_0xefff('0x21')](_0x457676[_0xefff('0x20')],function(_0x46b44e){return{'model':db[_0x46b44e['model']],'as':_0x46b44e['as'],'attributes':_0x46b44e[_0xefff('0x1e')],'include':_0x46b44e[_0xefff('0x20')]?_['map'](_0x46b44e[_0xefff('0x20')],function(_0x88fac){return{'model':db[_0x88fac[_0xefff('0x22')]],'as':_0x88fac['as'],'attributes':_0x88fac['attributes']};}):[]};}):[]};}):[]:[]})[_0xefff('0xe')](function(_0x20ef94){logger[_0xefff('0xf')]('ShowMailQueue',_0x4b6a99);logger[_0xefff('0x12')]('ShowMailQueue',_0x4b6a99,JSON['stringify'](_0x20ef94));_0x2477c9(_0x20ef94);})[_0xefff('0x25')](function(_0x4c4149){logger[_0xefff('0x15')]('ShowMailQueue',_0x4c4149[_0xefff('0x17')],_0x4b6a99);_0x4bdc8f(_0xf55bf4[_0xefff('0x15')](0x1f4,_0x4c4149[_0xefff('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 17e2e7b..92640b2 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 _0xbe81=['emit','removeListener','register','length','mailQueue:','./mailQueue.events','save','remove','update'];(function(_0x258fb0,_0x5362dc){var _0x4d1afe=function(_0x1c8f24){while(--_0x1c8f24){_0x258fb0['push'](_0x258fb0['shift']());}};_0x4d1afe(++_0x5362dc);}(_0xbe81,0xf8));var _0x1be8=function(_0x10aa73,_0xc744f4){_0x10aa73=_0x10aa73-0x0;var _0x3496d9=_0xbe81[_0x10aa73];return _0x3496d9;};'use strict';var MailQueueEvents=require(_0x1be8('0x0'));var events=[_0x1be8('0x1'),_0x1be8('0x2'),_0x1be8('0x3')];function createListener(_0x58cbe2,_0x492268){return function(_0x2e5186){_0x492268[_0x1be8('0x4')](_0x58cbe2,_0x2e5186);};}function removeListener(_0x10bba5,_0x3ce815){return function(){MailQueueEvents[_0x1be8('0x5')](_0x10bba5,_0x3ce815);};}exports[_0x1be8('0x6')]=function(_0x20f866){for(var _0x255554=0x0,_0x3c37f8=events[_0x1be8('0x7')];_0x255554<_0x3c37f8;_0x255554++){var _0x959a25=events[_0x255554];var _0x100221=createListener(_0x1be8('0x8')+_0x959a25,_0x20f866);MailQueueEvents['on'](_0x959a25,_0x100221);}}; \ No newline at end of file +var _0x9c00=['remove','emit','removeListener','register','mailQueue:','./mailQueue.events','save'];(function(_0x568286,_0xfa8e02){var _0x4d5ed0=function(_0x255042){while(--_0x255042){_0x568286['push'](_0x568286['shift']());}};_0x4d5ed0(++_0xfa8e02);}(_0x9c00,0x108));var _0x09c0=function(_0x18959e,_0x24e830){_0x18959e=_0x18959e-0x0;var _0x308aba=_0x9c00[_0x18959e];return _0x308aba;};'use strict';var MailQueueEvents=require(_0x09c0('0x0'));var events=[_0x09c0('0x1'),_0x09c0('0x2'),'update'];function createListener(_0x480708,_0x67fd6){return function(_0x48edd3){_0x67fd6[_0x09c0('0x3')](_0x480708,_0x48edd3);};}function removeListener(_0x5eff82,_0x10c0e1){return function(){MailQueueEvents[_0x09c0('0x4')](_0x5eff82,_0x10c0e1);};}exports[_0x09c0('0x5')]=function(_0x284dab){for(var _0x36b440=0x0,_0x570080=events['length'];_0x36b440<_0x570080;_0x36b440++){var _0x1d075a=events[_0x36b440];var _0x52fe5d=createListener(_0x09c0('0x6')+_0x1d075a,_0x284dab);MailQueueEvents['on'](_0x1d075a,_0x52fe5d);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 81edd79..f3da798 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 _0x9e75=['../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','describe','/:id','show','create','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4e27af,_0x184574){var _0x4a80b9=function(_0x2b690f){while(--_0x2b690f){_0x4e27af['push'](_0x4e27af['shift']());}};_0x4a80b9(++_0x184574);}(_0x9e75,0x12b));var _0x59e7=function(_0x54dc37,_0xd3065a){_0x54dc37=_0x54dc37-0x0;var _0x140ba7=_0x9e75[_0x54dc37];return _0x140ba7;};'use strict';var multer=require(_0x59e7('0x0'));var util=require(_0x59e7('0x1'));var path=require(_0x59e7('0x2'));var timeout=require(_0x59e7('0x3'));var express=require(_0x59e7('0x4'));var router=express[_0x59e7('0x5')]();var auth=require(_0x59e7('0x6'));var interaction=require(_0x59e7('0x7'));var config=require('../../config/environment');var controller=require(_0x59e7('0x8'));router[_0x59e7('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x59e7('0x9')]('/describe',auth[_0x59e7('0xa')](),controller[_0x59e7('0xb')]);router[_0x59e7('0x9')](_0x59e7('0xc'),auth[_0x59e7('0xa')](),controller[_0x59e7('0xd')]);router['post']('/',auth[_0x59e7('0xa')](),controller[_0x59e7('0xe')]);router[_0x59e7('0xf')](_0x59e7('0xc'),auth[_0x59e7('0xa')](),controller[_0x59e7('0x10')]);router['delete'](_0x59e7('0xc'),auth[_0x59e7('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x051b=['path','express','Router','../../components/interaction/service','index','get','/describe','isAuthenticated','describe','/:id','post','create','update','delete','destroy','exports','multer','util'];(function(_0x121ab3,_0x1e9564){var _0x2a5ae7=function(_0x1d81b2){while(--_0x1d81b2){_0x121ab3['push'](_0x121ab3['shift']());}};_0x2a5ae7(++_0x1e9564);}(_0x051b,0xb2));var _0xb051=function(_0x37df7c,_0x52652e){_0x37df7c=_0x37df7c-0x0;var _0x48cf19=_0x051b[_0x37df7c];return _0x48cf19;};'use strict';var multer=require(_0xb051('0x0'));var util=require(_0xb051('0x1'));var path=require(_0xb051('0x2'));var timeout=require('connect-timeout');var express=require(_0xb051('0x3'));var router=express[_0xb051('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb051('0x5'));var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb051('0x6')]);router[_0xb051('0x7')](_0xb051('0x8'),auth[_0xb051('0x9')](),controller[_0xb051('0xa')]);router['get'](_0xb051('0xb'),auth[_0xb051('0x9')](),controller['show']);router[_0xb051('0xc')]('/',auth[_0xb051('0x9')](),controller[_0xb051('0xd')]);router['put']('/:id',auth[_0xb051('0x9')](),controller[_0xb051('0xe')]);router[_0xb051('0xf')](_0xb051('0xb'),auth[_0xb051('0x9')](),controller[_0xb051('0x10')]);module[_0xb051('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 fbc6278..c01977e 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 _0x5e4e=['DATE','moment','exports','STRING'];(function(_0x515be7,_0x222362){var _0x84eba1=function(_0x9e5413){while(--_0x9e5413){_0x515be7['push'](_0x515be7['shift']());}};_0x84eba1(++_0x222362);}(_0x5e4e,0x131));var _0xe5e4=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5e4e[_0x1facfa];return _0x9ec701;};'use strict';var moment=require(_0xe5e4('0x0'));var Sequelize=require('sequelize');module[_0xe5e4('0x1')]={'uniqueid':{'type':Sequelize[_0xe5e4('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe5e4('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xe5e4('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe5e4('0x3')]},'reason':{'type':Sequelize[_0xe5e4('0x2')]}}; \ No newline at end of file +var _0x2d62=['STRING','DATE'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x2d62,0x74));var _0x22d6=function(_0x54f3b3,_0x106b7c){_0x54f3b3=_0x54f3b3-0x0;var _0x12187a=_0x2d62[_0x54f3b3];return _0x12187a;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x22d6('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0x22d6('0x0')]},'joinAt':{'type':Sequelize[_0x22d6('0x1')]},'leaveAt':{'type':Sequelize[_0x22d6('0x1')]},'acceptAt':{'type':Sequelize[_0x22d6('0x1')]},'exitAt':{'type':Sequelize[_0x22d6('0x1')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 5d484df..4d04b2d 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 _0xedfb=['reject','save','update','then','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','include','MailQueueReport','findAll','rows','catch','params','keys','includeAll','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply'];(function(_0x1c3a11,_0x303924){var _0x1a344b=function(_0x39a468){while(--_0x39a468){_0x1c3a11['push'](_0x1c3a11['shift']());}};_0x1a344b(++_0x303924);}(_0xedfb,0xc7));var _0xbedf=function(_0x28202e,_0x5d0604){_0x28202e=_0x28202e-0x0;var _0x126f8b=_0xedfb[_0x28202e];return _0x126f8b;};'use strict';var pdf=require(_0xbedf('0x0'));var emlformat=require(_0xbedf('0x1'));var rimraf=require(_0xbedf('0x2'));var zipdir=require(_0xbedf('0x3'));var jsonpatch=require(_0xbedf('0x4'));var rp=require('request-promise');var moment=require(_0xbedf('0x5'));var BPromise=require(_0xbedf('0x6'));var Mustache=require(_0xbedf('0x7'));var util=require(_0xbedf('0x8'));var path=require('path');var sox=require(_0xbedf('0x9'));var csv=require('to-csv');var ejs=require(_0xbedf('0xa'));var fs=require('fs');var _=require(_0xbedf('0xb'));var squel=require(_0xbedf('0xc'));var crypto=require(_0xbedf('0xd'));var jsforce=require(_0xbedf('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbedf('0xf'));var querystring=require(_0xbedf('0x10'));var Papa=require(_0xbedf('0x11'));var Redis=require('ioredis');var authService=require(_0xbedf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbedf('0x13'));var hardwareService=require(_0xbedf('0x14'));var logger=require(_0xbedf('0x15'))(_0xbedf('0x16'));var utils=require('../../config/utils');var config=require(_0xbedf('0x17'));var licenseUtil=require(_0xbedf('0x18'));var db=require(_0xbedf('0x19'))['db'];function respondWithStatusCode(_0x49d0d1,_0x25061c){_0x25061c=_0x25061c||0xcc;return function(_0x55f492){if(_0x55f492){return _0x49d0d1[_0xbedf('0x1a')](_0x25061c);}return _0x49d0d1['status'](_0x25061c)['end']();};}function respondWithResult(_0x510556,_0x3714a1){_0x3714a1=_0x3714a1||0xc8;return function(_0xd643b7){if(_0xd643b7){return _0x510556[_0xbedf('0x1b')](_0x3714a1)['json'](_0xd643b7);}};}function respondWithFilteredResult(_0x3b6186,_0x5c0e36){return function(_0x86f898){if(_0x86f898){var _0x18d7c0=_0x86f898[_0xbedf('0x1c')],_0x1639b4=_0x5c0e36[_0xbedf('0x1d')],_0x528f32=_0x5c0e36[_0xbedf('0x1d')]+_0x5c0e36[_0xbedf('0x1e')],_0x3535bc;if(_0x528f32>=_0x18d7c0){_0x528f32=_0x18d7c0;_0x3535bc=0xc8;}else{_0x3535bc=0xce;}_0x3b6186[_0xbedf('0x1b')](_0x3535bc);return _0x3b6186[_0xbedf('0x1f')](_0xbedf('0x20'),_0x1639b4+'-'+_0x528f32+'/'+_0x18d7c0)[_0xbedf('0x21')](_0x86f898);}return null;};}function patchUpdates(_0x32e232){return function(_0x1369b0){try{jsonpatch[_0xbedf('0x22')](_0x1369b0,_0x32e232,!![]);}catch(_0x57d458){return BPromise[_0xbedf('0x23')](_0x57d458);}return _0x1369b0[_0xbedf('0x24')]();};}function saveUpdates(_0x37a808,_0x384c35){return function(_0x492604){if(_0x492604){return _0x492604[_0xbedf('0x25')](_0x37a808)[_0xbedf('0x26')](function(_0x3a1d83){return _0x3a1d83;});}return null;};}function removeEntity(_0x297c73,_0x2f4fcc){return function(_0x1784f3){if(_0x1784f3){return _0x1784f3[_0xbedf('0x27')]()['then'](function(){_0x297c73[_0xbedf('0x1b')](0xcc)[_0xbedf('0x28')]();});}};}function handleEntityNotFound(_0x5ef640,_0x2809bc){return function(_0x406bfe){if(!_0x406bfe){_0x5ef640[_0xbedf('0x1a')](0x194);}return _0x406bfe;};}function handleError(_0x26301f,_0xc03a4){_0xc03a4=_0xc03a4||0x1f4;return function(_0x3f2249){logger[_0xbedf('0x29')](_0x3f2249[_0xbedf('0x2a')]);if(_0x3f2249[_0xbedf('0x2b')]){delete _0x3f2249[_0xbedf('0x2b')];}_0x26301f[_0xbedf('0x1b')](_0xc03a4)['send'](_0x3f2249);};}exports[_0xbedf('0x2c')]=function(_0x4c866c,_0x473b9d){var _0x4ca126={},_0x5c012d={},_0x27eea3={'count':0x0,'rows':[]};var _0x4445e1=_[_0xbedf('0x2d')](db['MailQueueReport'][_0xbedf('0x2e')],function(_0x1b8b7d){return{'name':_0x1b8b7d[_0xbedf('0x2f')],'type':_0x1b8b7d[_0xbedf('0x30')][_0xbedf('0x31')]};});_0x5c012d[_0xbedf('0x32')]=_[_0xbedf('0x2d')](_0x4445e1,_0xbedf('0x2b'));_0x5c012d[_0xbedf('0x33')]=_['keys'](_0x4c866c[_0xbedf('0x33')]);_0x5c012d['filters']=_[_0xbedf('0x34')](_0x5c012d[_0xbedf('0x32')],_0x5c012d[_0xbedf('0x33')]);_0x4ca126[_0xbedf('0x35')]=_[_0xbedf('0x34')](_0x5c012d[_0xbedf('0x32')],qs[_0xbedf('0x36')](_0x4c866c[_0xbedf('0x33')]['fields']));_0x4ca126[_0xbedf('0x35')]=_0x4ca126[_0xbedf('0x35')][_0xbedf('0x37')]?_0x4ca126[_0xbedf('0x35')]:_0x5c012d[_0xbedf('0x32')];if(!_0x4c866c[_0xbedf('0x33')][_0xbedf('0x38')](_0xbedf('0x39'))){_0x4ca126[_0xbedf('0x1e')]=qs['limit'](_0x4c866c[_0xbedf('0x33')]['limit']);_0x4ca126[_0xbedf('0x1d')]=qs[_0xbedf('0x1d')](_0x4c866c[_0xbedf('0x33')][_0xbedf('0x1d')]);}_0x4ca126[_0xbedf('0x3a')]=qs[_0xbedf('0x3b')](_0x4c866c[_0xbedf('0x33')][_0xbedf('0x3b')]);_0x4ca126[_0xbedf('0x3c')]=qs[_0xbedf('0x3d')](_[_0xbedf('0x3e')](_0x4c866c[_0xbedf('0x33')],_0x5c012d[_0xbedf('0x3d')]),_0x4445e1);if(_0x4c866c[_0xbedf('0x33')]['filter']){_0x4ca126[_0xbedf('0x3c')]=_[_0xbedf('0x3f')](_0x4ca126[_0xbedf('0x3c')],{'$or':_[_0xbedf('0x2d')](_0x4445e1,function(_0x416161){if(_0x416161['type']!==_0xbedf('0x40')){var _0x434938={};_0x434938[_0x416161['name']]={'$like':'%'+_0x4c866c['query'][_0xbedf('0x41')]+'%'};return _0x434938;}})});}_0x4ca126=_['merge']({},_0x4ca126,_0x4c866c['options']);var _0x1c385a={'where':_0x4ca126['where']};return db['MailQueueReport'][_0xbedf('0x1c')](_0x1c385a)[_0xbedf('0x26')](function(_0x384b1a){_0x27eea3['count']=_0x384b1a;if(_0x4c866c[_0xbedf('0x33')]['includeAll']){_0x4ca126[_0xbedf('0x42')]=[{'all':!![]}];}return db[_0xbedf('0x43')][_0xbedf('0x44')](_0x4ca126);})[_0xbedf('0x26')](function(_0x5b017b){_0x27eea3[_0xbedf('0x45')]=_0x5b017b;return _0x27eea3;})['then'](respondWithFilteredResult(_0x473b9d,_0x4ca126))[_0xbedf('0x46')](handleError(_0x473b9d,null));};exports['show']=function(_0x4e7ed6,_0xc007b3){var _0x5d2d56={'raw':!![],'where':{'id':_0x4e7ed6[_0xbedf('0x47')]['id']}},_0x6b4ed5={};_0x6b4ed5[_0xbedf('0x32')]=_[_0xbedf('0x48')](db[_0xbedf('0x43')][_0xbedf('0x2e')]);_0x6b4ed5[_0xbedf('0x33')]=_[_0xbedf('0x48')](_0x4e7ed6[_0xbedf('0x33')]);_0x6b4ed5['filters']=_[_0xbedf('0x34')](_0x6b4ed5[_0xbedf('0x32')],_0x6b4ed5[_0xbedf('0x33')]);_0x5d2d56['attributes']=_[_0xbedf('0x34')](_0x6b4ed5[_0xbedf('0x32')],qs[_0xbedf('0x36')](_0x4e7ed6[_0xbedf('0x33')][_0xbedf('0x36')]));_0x5d2d56[_0xbedf('0x35')]=_0x5d2d56['attributes'][_0xbedf('0x37')]?_0x5d2d56['attributes']:_0x6b4ed5[_0xbedf('0x32')];if(_0x4e7ed6[_0xbedf('0x33')][_0xbedf('0x49')]){_0x5d2d56[_0xbedf('0x42')]=[{'all':!![]}];}_0x5d2d56=_[_0xbedf('0x3f')]({},_0x5d2d56,_0x4e7ed6['options']);return db['MailQueueReport']['find'](_0x5d2d56)[_0xbedf('0x26')](handleEntityNotFound(_0xc007b3,null))[_0xbedf('0x26')](respondWithResult(_0xc007b3,null))[_0xbedf('0x46')](handleError(_0xc007b3,null));};exports['create']=function(_0x3c2e96,_0x4861f4){return db[_0xbedf('0x43')][_0xbedf('0x4a')](_0x3c2e96[_0xbedf('0x4b')],{})[_0xbedf('0x26')](respondWithResult(_0x4861f4,0xc9))['catch'](handleError(_0x4861f4,null));};exports[_0xbedf('0x25')]=function(_0x116b6f,_0x267afb){if(_0x116b6f[_0xbedf('0x4b')]['id']){delete _0x116b6f['body']['id'];}return db['MailQueueReport'][_0xbedf('0x4c')]({'where':{'id':_0x116b6f['params']['id']}})[_0xbedf('0x26')](handleEntityNotFound(_0x267afb,null))[_0xbedf('0x26')](saveUpdates(_0x116b6f[_0xbedf('0x4b')],null))[_0xbedf('0x26')](respondWithResult(_0x267afb,null))[_0xbedf('0x46')](handleError(_0x267afb,null));};exports[_0xbedf('0x27')]=function(_0x3c8c0a,_0xce6af1){return db[_0xbedf('0x43')]['find']({'where':{'id':_0x3c8c0a[_0xbedf('0x47')]['id']}})['then'](handleEntityNotFound(_0xce6af1,null))[_0xbedf('0x26')](removeEntity(_0xce6af1,null))[_0xbedf('0x46')](handleError(_0xce6af1,null));};exports[_0xbedf('0x4d')]=function(_0x3e0e6a,_0x1f3fb5){return db[_0xbedf('0x43')][_0xbedf('0x4d')]()[_0xbedf('0x26')](respondWithResult(_0x1f3fb5,null))['catch'](handleError(_0x1f3fb5,null));}; \ No newline at end of file +var _0x82df=['set','json','reject','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','MailQueueReport','count','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit'];(function(_0x532c40,_0x3b8997){var _0x2b8907=function(_0x1ec242){while(--_0x1ec242){_0x532c40['push'](_0x532c40['shift']());}};_0x2b8907(++_0x3b8997);}(_0x82df,0x109));var _0xf82d=function(_0x1a3f6c,_0x2177cc){_0x1a3f6c=_0x1a3f6c-0x0;var _0x361953=_0x82df[_0x1a3f6c];return _0x361953;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf82d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf82d('0x1'));var moment=require(_0xf82d('0x2'));var BPromise=require(_0xf82d('0x3'));var Mustache=require(_0xf82d('0x4'));var util=require(_0xf82d('0x5'));var path=require(_0xf82d('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf82d('0x7'));var fs=require('fs');var _=require(_0xf82d('0x8'));var squel=require(_0xf82d('0x9'));var crypto=require(_0xf82d('0xa'));var jsforce=require(_0xf82d('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf82d('0xc'));var querystring=require(_0xf82d('0xd'));var Papa=require(_0xf82d('0xe'));var Redis=require(_0xf82d('0xf'));var authService=require(_0xf82d('0x10'));var qs=require(_0xf82d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf82d('0x12'));var logger=require('../../config/logger')(_0xf82d('0x13'));var utils=require('../../config/utils');var config=require(_0xf82d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf82d('0x15'))['db'];function respondWithStatusCode(_0x4155a0,_0x3a77f4){_0x3a77f4=_0x3a77f4||0xcc;return function(_0x1d0930){if(_0x1d0930){return _0x4155a0[_0xf82d('0x16')](_0x3a77f4);}return _0x4155a0[_0xf82d('0x17')](_0x3a77f4)[_0xf82d('0x18')]();};}function respondWithResult(_0x35bc3f,_0x542073){_0x542073=_0x542073||0xc8;return function(_0x511fa9){if(_0x511fa9){return _0x35bc3f[_0xf82d('0x17')](_0x542073)['json'](_0x511fa9);}};}function respondWithFilteredResult(_0x34780a,_0x26c186){return function(_0x3253a0){if(_0x3253a0){var _0x2cc177=_0x3253a0['count'],_0xdb5d23=_0x26c186['offset'],_0x14fb6a=_0x26c186[_0xf82d('0x19')]+_0x26c186[_0xf82d('0x1a')],_0x5d8e88;if(_0x14fb6a>=_0x2cc177){_0x14fb6a=_0x2cc177;_0x5d8e88=0xc8;}else{_0x5d8e88=0xce;}_0x34780a[_0xf82d('0x17')](_0x5d8e88);return _0x34780a[_0xf82d('0x1b')]('Content-Range',_0xdb5d23+'-'+_0x14fb6a+'/'+_0x2cc177)[_0xf82d('0x1c')](_0x3253a0);}return null;};}function patchUpdates(_0x4234f1){return function(_0x143cbf){try{jsonpatch['apply'](_0x143cbf,_0x4234f1,!![]);}catch(_0xb98a93){return BPromise[_0xf82d('0x1d')](_0xb98a93);}return _0x143cbf['save']();};}function saveUpdates(_0x33040f,_0x2b48eb){return function(_0x3dd86d){if(_0x3dd86d){return _0x3dd86d[_0xf82d('0x1e')](_0x33040f)['then'](function(_0x3ec34d){return _0x3ec34d;});}return null;};}function removeEntity(_0x19e074,_0x41bf9){return function(_0x581a12){if(_0x581a12){return _0x581a12[_0xf82d('0x1f')]()[_0xf82d('0x20')](function(){_0x19e074[_0xf82d('0x17')](0xcc)[_0xf82d('0x18')]();});}};}function handleEntityNotFound(_0x679c4d,_0x1f7dab){return function(_0x1ae5e8){if(!_0x1ae5e8){_0x679c4d[_0xf82d('0x16')](0x194);}return _0x1ae5e8;};}function handleError(_0x7a8a08,_0xdbe45a){_0xdbe45a=_0xdbe45a||0x1f4;return function(_0x4f3218){logger[_0xf82d('0x21')](_0x4f3218[_0xf82d('0x22')]);if(_0x4f3218['name']){delete _0x4f3218[_0xf82d('0x23')];}_0x7a8a08[_0xf82d('0x17')](_0xdbe45a)[_0xf82d('0x24')](_0x4f3218);};}exports[_0xf82d('0x25')]=function(_0x40e59c,_0x482d7a){var _0x162b7f={},_0x1e7518={},_0x57ef38={'count':0x0,'rows':[]};var _0x19325f=_[_0xf82d('0x26')](db['MailQueueReport'][_0xf82d('0x27')],function(_0x2c6f2e){return{'name':_0x2c6f2e[_0xf82d('0x28')],'type':_0x2c6f2e[_0xf82d('0x29')][_0xf82d('0x2a')]};});_0x1e7518[_0xf82d('0x2b')]=_[_0xf82d('0x26')](_0x19325f,_0xf82d('0x23'));_0x1e7518['query']=_[_0xf82d('0x2c')](_0x40e59c[_0xf82d('0x2d')]);_0x1e7518['filters']=_[_0xf82d('0x2e')](_0x1e7518[_0xf82d('0x2b')],_0x1e7518[_0xf82d('0x2d')]);_0x162b7f['attributes']=_[_0xf82d('0x2e')](_0x1e7518[_0xf82d('0x2b')],qs['fields'](_0x40e59c[_0xf82d('0x2d')][_0xf82d('0x2f')]));_0x162b7f[_0xf82d('0x30')]=_0x162b7f[_0xf82d('0x30')][_0xf82d('0x31')]?_0x162b7f[_0xf82d('0x30')]:_0x1e7518[_0xf82d('0x2b')];if(!_0x40e59c[_0xf82d('0x2d')][_0xf82d('0x32')](_0xf82d('0x33'))){_0x162b7f['limit']=qs[_0xf82d('0x1a')](_0x40e59c[_0xf82d('0x2d')][_0xf82d('0x1a')]);_0x162b7f[_0xf82d('0x19')]=qs[_0xf82d('0x19')](_0x40e59c[_0xf82d('0x2d')][_0xf82d('0x19')]);}_0x162b7f['order']=qs[_0xf82d('0x34')](_0x40e59c[_0xf82d('0x2d')][_0xf82d('0x34')]);_0x162b7f[_0xf82d('0x35')]=qs[_0xf82d('0x36')](_[_0xf82d('0x37')](_0x40e59c[_0xf82d('0x2d')],_0x1e7518[_0xf82d('0x36')]),_0x19325f);if(_0x40e59c['query'][_0xf82d('0x38')]){_0x162b7f[_0xf82d('0x35')]=_[_0xf82d('0x39')](_0x162b7f[_0xf82d('0x35')],{'$or':_[_0xf82d('0x26')](_0x19325f,function(_0x1d3bff){if(_0x1d3bff[_0xf82d('0x29')]!==_0xf82d('0x3a')){var _0x41b31f={};_0x41b31f[_0x1d3bff[_0xf82d('0x23')]]={'$like':'%'+_0x40e59c[_0xf82d('0x2d')]['filter']+'%'};return _0x41b31f;}})});}_0x162b7f=_['merge']({},_0x162b7f,_0x40e59c[_0xf82d('0x3b')]);var _0x5da002={'where':_0x162b7f[_0xf82d('0x35')]};return db[_0xf82d('0x3c')][_0xf82d('0x3d')](_0x5da002)[_0xf82d('0x20')](function(_0x352cce){_0x57ef38[_0xf82d('0x3d')]=_0x352cce;if(_0x40e59c[_0xf82d('0x2d')][_0xf82d('0x3e')]){_0x162b7f[_0xf82d('0x3f')]=[{'all':!![]}];}return db[_0xf82d('0x3c')][_0xf82d('0x40')](_0x162b7f);})[_0xf82d('0x20')](function(_0x162a99){_0x57ef38[_0xf82d('0x41')]=_0x162a99;return _0x57ef38;})[_0xf82d('0x20')](respondWithFilteredResult(_0x482d7a,_0x162b7f))[_0xf82d('0x42')](handleError(_0x482d7a,null));};exports[_0xf82d('0x43')]=function(_0x375800,_0x4bfe9e){var _0x429064={'raw':!![],'where':{'id':_0x375800[_0xf82d('0x44')]['id']}},_0x522598={};_0x522598[_0xf82d('0x2b')]=_[_0xf82d('0x2c')](db[_0xf82d('0x3c')][_0xf82d('0x27')]);_0x522598[_0xf82d('0x2d')]=_[_0xf82d('0x2c')](_0x375800[_0xf82d('0x2d')]);_0x522598['filters']=_['intersection'](_0x522598['model'],_0x522598[_0xf82d('0x2d')]);_0x429064[_0xf82d('0x30')]=_[_0xf82d('0x2e')](_0x522598[_0xf82d('0x2b')],qs['fields'](_0x375800[_0xf82d('0x2d')][_0xf82d('0x2f')]));_0x429064[_0xf82d('0x30')]=_0x429064['attributes'][_0xf82d('0x31')]?_0x429064[_0xf82d('0x30')]:_0x522598[_0xf82d('0x2b')];if(_0x375800[_0xf82d('0x2d')][_0xf82d('0x3e')]){_0x429064[_0xf82d('0x3f')]=[{'all':!![]}];}_0x429064=_[_0xf82d('0x39')]({},_0x429064,_0x375800[_0xf82d('0x3b')]);return db[_0xf82d('0x3c')]['find'](_0x429064)[_0xf82d('0x20')](handleEntityNotFound(_0x4bfe9e,null))[_0xf82d('0x20')](respondWithResult(_0x4bfe9e,null))[_0xf82d('0x42')](handleError(_0x4bfe9e,null));};exports['create']=function(_0x297475,_0x5dcf4){return db[_0xf82d('0x3c')][_0xf82d('0x45')](_0x297475[_0xf82d('0x46')],{})['then'](respondWithResult(_0x5dcf4,0xc9))['catch'](handleError(_0x5dcf4,null));};exports[_0xf82d('0x1e')]=function(_0x36887f,_0x56bc81){if(_0x36887f[_0xf82d('0x46')]['id']){delete _0x36887f[_0xf82d('0x46')]['id'];}return db['MailQueueReport'][_0xf82d('0x47')]({'where':{'id':_0x36887f[_0xf82d('0x44')]['id']}})[_0xf82d('0x20')](handleEntityNotFound(_0x56bc81,null))[_0xf82d('0x20')](saveUpdates(_0x36887f[_0xf82d('0x46')],null))[_0xf82d('0x20')](respondWithResult(_0x56bc81,null))[_0xf82d('0x42')](handleError(_0x56bc81,null));};exports[_0xf82d('0x1f')]=function(_0x96a978,_0x52b300){return db[_0xf82d('0x3c')][_0xf82d('0x47')]({'where':{'id':_0x96a978[_0xf82d('0x44')]['id']}})[_0xf82d('0x20')](handleEntityNotFound(_0x52b300,null))['then'](removeEntity(_0x52b300,null))[_0xf82d('0x42')](handleError(_0x52b300,null));};exports[_0xf82d('0x48')]=function(_0x370ac8,_0x395c2b){return db['MailQueueReport'][_0xf82d('0x48')]()[_0xf82d('0x20')](respondWithResult(_0x395c2b,null))[_0xf82d('0x42')](handleError(_0x395c2b,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 8bcea11..900b2a8 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 _0x44c5=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util'];(function(_0x1eebe7,_0x2124cf){var _0x4dc17c=function(_0x17bb80){while(--_0x17bb80){_0x1eebe7['push'](_0x1eebe7['shift']());}};_0x4dc17c(++_0x2124cf);}(_0x44c5,0x76));var _0x544c=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0x44c5[_0x43a37c];return _0x5d1d40;};'use strict';var _=require(_0x544c('0x0'));var util=require(_0x544c('0x1'));var logger=require(_0x544c('0x2'))(_0x544c('0x3'));var moment=require('moment');var BPromise=require(_0x544c('0x4'));var rp=require(_0x544c('0x5'));var fs=require('fs');var path=require(_0x544c('0x6'));var rimraf=require(_0x544c('0x7'));var config=require(_0x544c('0x8'));var attributes=require(_0x544c('0x9'));module[_0x544c('0xa')]=function(_0xcfd37a,_0x45d35f){return _0xcfd37a[_0x544c('0xb')](_0x544c('0xc'),attributes,{'tableName':_0x544c('0xd'),'paranoid':![],'indexes':[{'name':_0x544c('0xe'),'fields':[_0x544c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x42d0=['api','moment','path','rimraf','../../config/environment','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','lodash'];(function(_0x2904e9,_0x386e36){var _0x4355d8=function(_0x3c76b2){while(--_0x3c76b2){_0x2904e9['push'](_0x2904e9['shift']());}};_0x4355d8(++_0x386e36);}(_0x42d0,0xe6));var _0x042d=function(_0x207d2f,_0x44400f){_0x207d2f=_0x207d2f-0x0;var _0x3c3498=_0x42d0[_0x207d2f];return _0x3c3498;};'use strict';var _=require(_0x042d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x042d('0x1'));var moment=require(_0x042d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x042d('0x3'));var rimraf=require(_0x042d('0x4'));var config=require(_0x042d('0x5'));var attributes=require(_0x042d('0x6'));module['exports']=function(_0x2d7bf9,_0x24b276){return _0x2d7bf9[_0x042d('0x7')](_0x042d('0x8'),attributes,{'tableName':_0x042d('0x9'),'paranoid':![],'indexes':[{'name':_0x042d('0xa'),'fields':[_0x042d('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 a4246b7..d0cb1e4 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 _0xf148=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','info','attributes','limit','UpdateMailQueueReport','lodash'];(function(_0x3c528e,_0x20c64a){var _0x9fc602=function(_0x989b03){while(--_0x989b03){_0x3c528e['push'](_0x3c528e['shift']());}};_0x9fc602(++_0x20c64a);}(_0xf148,0x11f));var _0x8f14=function(_0x23cf6f,_0x11d345){_0x23cf6f=_0x23cf6f-0x0;var _0xa8eb7a=_0xf148[_0x23cf6f];return _0xa8eb7a;};'use strict';var _=require(_0x8f14('0x0'));var util=require(_0x8f14('0x1'));var moment=require(_0x8f14('0x2'));var BPromise=require('bluebird');var rs=require(_0x8f14('0x3'));var fs=require('fs');var Redis=require(_0x8f14('0x4'));var db=require(_0x8f14('0x5'))['db'];var utils=require(_0x8f14('0x6'));var logger=require(_0x8f14('0x7'))(_0x8f14('0x8'));var config=require(_0x8f14('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3b5c82,_0x3ee0cc,_0x225912){return new BPromise(function(_0x41103c,_0x5a2939){return client[_0x8f14('0xa')](_0x3b5c82,_0x225912)[_0x8f14('0xb')](function(_0x2116e5){logger['info'](_0x8f14('0xc'),_0x3ee0cc,_0x8f14('0xd'));logger[_0x8f14('0xe')](_0x8f14('0xf'),_0x3ee0cc,_0x8f14('0xd'),JSON[_0x8f14('0x10')](_0x2116e5));if(_0x2116e5[_0x8f14('0x11')]){if(_0x2116e5[_0x8f14('0x11')][_0x8f14('0x12')]===0x1f4){logger[_0x8f14('0x11')](_0x8f14('0xc'),_0x3ee0cc,_0x2116e5[_0x8f14('0x11')]['message']);return _0x5a2939(_0x2116e5[_0x8f14('0x11')][_0x8f14('0x13')]);}logger[_0x8f14('0x11')](_0x8f14('0xc'),_0x3ee0cc,_0x2116e5[_0x8f14('0x11')][_0x8f14('0x13')]);return _0x41103c(_0x2116e5['error']['message']);}else{logger['info']('MailQueueReport,\x20%s,\x20%s',_0x3ee0cc,'request\x20sent');_0x41103c(_0x2116e5[_0x8f14('0x14')][_0x8f14('0x13')]);}})[_0x8f14('0x15')](function(_0x2cac99){logger['error'](_0x8f14('0xc'),_0x3ee0cc,_0x2cac99);_0x5a2939(_0x2cac99);});});}exports[_0x8f14('0x16')]=function(_0x354151){var _0xc2d286=this;return new Promise(function(_0x1714db,_0x244d9a){return db[_0x8f14('0x17')][_0x8f14('0x18')](_0x354151[_0x8f14('0x19')],{'raw':_0x354151[_0x8f14('0x1a')]?_0x354151[_0x8f14('0x1a')][_0x8f14('0x1b')]===undefined?!![]:![]:!![]})[_0x8f14('0xb')](function(_0x4dd31a){logger[_0x8f14('0x1c')](_0x8f14('0x16'),_0x354151);logger[_0x8f14('0xe')](_0x8f14('0x16'),_0x354151,JSON[_0x8f14('0x10')](_0x4dd31a));_0x1714db(_0x4dd31a);})[_0x8f14('0x15')](function(_0x56431b){logger['error'](_0x8f14('0x16'),_0x56431b[_0x8f14('0x13')],_0x354151);_0x244d9a(_0xc2d286['error'](0x1f4,_0x56431b[_0x8f14('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x87b7b6){var _0x5ee143=this;return new Promise(function(_0x15784b,_0x3d6364){return db[_0x8f14('0x17')]['update'](_0x87b7b6[_0x8f14('0x19')],{'raw':_0x87b7b6[_0x8f14('0x1a')]?_0x87b7b6['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x87b7b6['options']?_0x87b7b6[_0x8f14('0x1a')]['where']||null:null,'attributes':_0x87b7b6[_0x8f14('0x1a')]?_0x87b7b6['options'][_0x8f14('0x1d')]||null:null,'limit':_0x87b7b6[_0x8f14('0x1a')]?_0x87b7b6[_0x8f14('0x1a')][_0x8f14('0x1e')]||null:null})[_0x8f14('0xb')](function(_0x456372){logger[_0x8f14('0x1c')]('UpdateMailQueueReport',_0x87b7b6);logger[_0x8f14('0xe')]('UpdateMailQueueReport',_0x87b7b6,JSON[_0x8f14('0x10')](_0x456372));_0x15784b(_0x456372);})[_0x8f14('0x15')](function(_0x382f6a){logger[_0x8f14('0x11')](_0x8f14('0x1f'),_0x382f6a['message'],_0x87b7b6);_0x3d6364(_0x5ee143[_0x8f14('0x11')](0x1f4,_0x382f6a[_0x8f14('0x13')]));});});}; \ No newline at end of file +var _0xbde7=['stringify','error','code','message','result','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','MailQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x85666,_0x403be2){var _0x233527=function(_0x31d496){while(--_0x31d496){_0x85666['push'](_0x85666['shift']());}};_0x233527(++_0x403be2);}(_0xbde7,0xe3));var _0x7bde=function(_0x201c69,_0x1bded2){_0x201c69=_0x201c69-0x0;var _0x426581=_0xbde7[_0x201c69];return _0x426581;};'use strict';var _=require(_0x7bde('0x0'));var util=require('util');var moment=require(_0x7bde('0x1'));var BPromise=require(_0x7bde('0x2'));var rs=require(_0x7bde('0x3'));var fs=require('fs');var Redis=require(_0x7bde('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7bde('0x5'));var logger=require(_0x7bde('0x6'))(_0x7bde('0x7'));var config=require(_0x7bde('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7bde('0x9')][_0x7bde('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29d735,_0x2c3df8,_0x181bb1){return new BPromise(function(_0x56d1ba,_0x2a87f6){return client[_0x7bde('0xb')](_0x29d735,_0x181bb1)[_0x7bde('0xc')](function(_0x18bfca){logger[_0x7bde('0xd')](_0x7bde('0xe'),_0x2c3df8,_0x7bde('0xf'));logger[_0x7bde('0x10')](_0x7bde('0x11'),_0x2c3df8,_0x7bde('0xf'),JSON[_0x7bde('0x12')](_0x18bfca));if(_0x18bfca[_0x7bde('0x13')]){if(_0x18bfca[_0x7bde('0x13')][_0x7bde('0x14')]===0x1f4){logger['error'](_0x7bde('0xe'),_0x2c3df8,_0x18bfca['error'][_0x7bde('0x15')]);return _0x2a87f6(_0x18bfca[_0x7bde('0x13')][_0x7bde('0x15')]);}logger[_0x7bde('0x13')](_0x7bde('0xe'),_0x2c3df8,_0x18bfca[_0x7bde('0x13')][_0x7bde('0x15')]);return _0x56d1ba(_0x18bfca[_0x7bde('0x13')][_0x7bde('0x15')]);}else{logger[_0x7bde('0xd')](_0x7bde('0xe'),_0x2c3df8,'request\x20sent');_0x56d1ba(_0x18bfca[_0x7bde('0x16')]['message']);}})['catch'](function(_0xa155a8){logger['error'](_0x7bde('0xe'),_0x2c3df8,_0xa155a8);_0x2a87f6(_0xa155a8);});});}exports['CreateMailQueueReport']=function(_0x24c094){var _0xbd0178=this;return new Promise(function(_0x342c70,_0x4d088b){return db[_0x7bde('0x17')][_0x7bde('0x18')](_0x24c094[_0x7bde('0x19')],{'raw':_0x24c094[_0x7bde('0x1a')]?_0x24c094[_0x7bde('0x1a')][_0x7bde('0x1b')]===undefined?!![]:![]:!![]})[_0x7bde('0xc')](function(_0x3523f6){logger['info'](_0x7bde('0x1c'),_0x24c094);logger[_0x7bde('0x10')]('CreateMailQueueReport',_0x24c094,JSON[_0x7bde('0x12')](_0x3523f6));_0x342c70(_0x3523f6);})['catch'](function(_0x185da1){logger[_0x7bde('0x13')](_0x7bde('0x1c'),_0x185da1[_0x7bde('0x15')],_0x24c094);_0x4d088b(_0xbd0178[_0x7bde('0x13')](0x1f4,_0x185da1[_0x7bde('0x15')]));});});};exports[_0x7bde('0x1d')]=function(_0xb9512){var _0x2dd36a=this;return new Promise(function(_0x2debe4,_0xe5ea70){return db['MailQueueReport'][_0x7bde('0x1e')](_0xb9512[_0x7bde('0x19')],{'raw':_0xb9512['options']?_0xb9512[_0x7bde('0x1a')][_0x7bde('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb9512[_0x7bde('0x1a')]?_0xb9512['options'][_0x7bde('0x1f')]||null:null,'attributes':_0xb9512[_0x7bde('0x1a')]?_0xb9512['options'][_0x7bde('0x20')]||null:null,'limit':_0xb9512[_0x7bde('0x1a')]?_0xb9512['options'][_0x7bde('0x21')]||null:null})[_0x7bde('0xc')](function(_0x27f11e){logger[_0x7bde('0xd')](_0x7bde('0x1d'),_0xb9512);logger[_0x7bde('0x10')]('UpdateMailQueueReport',_0xb9512,JSON[_0x7bde('0x12')](_0x27f11e));_0x2debe4(_0x27f11e);})[_0x7bde('0x22')](function(_0x33141d){logger[_0x7bde('0x13')](_0x7bde('0x1d'),_0x33141d['message'],_0xb9512);_0xe5ea70(_0x2dd36a['error'](0x1f4,_0x33141d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 1c6e63c..0d30469 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 _0x0bcd=['../../components/interaction/service','../../config/environment','exports','multer','path','express','Router','../../components/auth/service'];(function(_0x4deba6,_0x290b83){var _0x947b6e=function(_0x3766fe){while(--_0x3766fe){_0x4deba6['push'](_0x4deba6['shift']());}};_0x947b6e(++_0x290b83);}(_0x0bcd,0xa3));var _0xd0bc=function(_0x52f3b4,_0x2bcaec){_0x52f3b4=_0x52f3b4-0x0;var _0x2ac632=_0x0bcd[_0x52f3b4];return _0x2ac632;};'use strict';var multer=require(_0xd0bc('0x0'));var util=require('util');var path=require(_0xd0bc('0x1'));var timeout=require('connect-timeout');var express=require(_0xd0bc('0x2'));var router=express[_0xd0bc('0x3')]();var auth=require(_0xd0bc('0x4'));var interaction=require(_0xd0bc('0x5'));var config=require(_0xd0bc('0x6'));module[_0xd0bc('0x7')]=router; \ No newline at end of file +var _0x2850=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x45b29d,_0x44ce43){var _0x32d74=function(_0x559eff){while(--_0x559eff){_0x45b29d['push'](_0x45b29d['shift']());}};_0x32d74(++_0x44ce43);}(_0x2850,0xfe));var _0x0285=function(_0xbc081c,_0x238a03){_0xbc081c=_0xbc081c-0x0;var _0x3ee6cc=_0x2850[_0xbc081c];return _0x3ee6cc;};'use strict';var multer=require(_0x0285('0x0'));var util=require(_0x0285('0x1'));var path=require(_0x0285('0x2'));var timeout=require(_0x0285('0x3'));var express=require('express');var router=express[_0x0285('0x4')]();var auth=require(_0x0285('0x5'));var interaction=require(_0x0285('0x6'));var config=require(_0x0285('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index a861ce8..5641f63 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 _0x4084=['BOOLEAN','username','INTEGER','sequelize','exports','STRING'];(function(_0x2af952,_0x2fca4b){var _0x158e89=function(_0x5d991b){while(--_0x5d991b){_0x2af952['push'](_0x2af952['shift']());}};_0x158e89(++_0x2fca4b);}(_0x4084,0xc9));var _0x4408=function(_0x3110e5,_0x5daeae){_0x3110e5=_0x3110e5-0x0;var _0x8c9d4=_0x4084[_0x3110e5];return _0x8c9d4;};'use strict';var Sequelize=require(_0x4408('0x0'));module[_0x4408('0x1')]={'description':{'type':Sequelize[_0x4408('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x4408('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x4408('0x2')],'unique':_0x4408('0x4')},'password':{'type':Sequelize[_0x4408('0x2')]},'port':{'type':Sequelize[_0x4408('0x5')]},'tls':{'type':Sequelize[_0x4408('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x4408('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb30c=['INTEGER','sequelize','exports','STRING','username','BOOLEAN','INBOX'];(function(_0x383fa9,_0x120b57){var _0x1c0653=function(_0x5ab633){while(--_0x5ab633){_0x383fa9['push'](_0x383fa9['shift']());}};_0x1c0653(++_0x120b57);}(_0xb30c,0xd3));var _0xcb30=function(_0xb85d1d,_0xaab05e){_0xb85d1d=_0xb85d1d-0x0;var _0x88809d=_0xb30c[_0xb85d1d];return _0x88809d;};'use strict';var Sequelize=require(_0xcb30('0x0'));module[_0xcb30('0x1')]={'description':{'type':Sequelize[_0xcb30('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xcb30('0x2')],'unique':_0xcb30('0x3')},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0xcb30('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xcb30('0x2')],'defaultValue':_0xcb30('0x5')},'connTimeout':{'type':Sequelize[_0xcb30('0x6')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xcb30('0x6')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index cd57270..c0f08ae 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 _0x777d=['./mailServerIn.attributes','define','util','../../config/logger','api','bluebird','request-promise'];(function(_0x5a5139,_0x45b1e3){var _0xec7ba6=function(_0x48f137){while(--_0x48f137){_0x5a5139['push'](_0x5a5139['shift']());}};_0xec7ba6(++_0x45b1e3);}(_0x777d,0xe9));var _0xd777=function(_0x32efcb,_0x55523f){_0x32efcb=_0x32efcb-0x0;var _0x1dae88=_0x777d[_0x32efcb];return _0x1dae88;};'use strict';var _=require('lodash');var util=require(_0xd777('0x0'));var logger=require(_0xd777('0x1'))(_0xd777('0x2'));var moment=require('moment');var BPromise=require(_0xd777('0x3'));var rp=require(_0xd777('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd777('0x5'));module['exports']=function(_0x253dc1,_0x51e918){return _0x253dc1[_0xd777('0x6')]('MailServerIn',attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x594d=['define','MailServerIn','mail_servers_in','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes'];(function(_0x1341d5,_0x261229){var _0x2ab031=function(_0x54a410){while(--_0x54a410){_0x1341d5['push'](_0x1341d5['shift']());}};_0x2ab031(++_0x261229);}(_0x594d,0x92));var _0xd594=function(_0x2bda00,_0x4f275f){_0x2bda00=_0x2bda00-0x0;var _0xd80417=_0x594d[_0x2bda00];return _0xd80417;};'use strict';var _=require(_0xd594('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd594('0x1'));var moment=require(_0xd594('0x2'));var BPromise=require(_0xd594('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd594('0x4'));var rimraf=require(_0xd594('0x5'));var config=require(_0xd594('0x6'));var attributes=require(_0xd594('0x7'));module['exports']=function(_0x3347cd,_0x498ef4){return _0x3347cd[_0xd594('0x8')](_0xd594('0x9'),attributes,{'tableName':_0xd594('0xa'),'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 b87b168..a47bfbc 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 _0x0f10=['MailServerIn,\x20%s,\x20%s','result','catch','GetMailServerIn','MailServerIn','findAll','options','where','attributes','include','model','map','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x0f10,0x16c));var _0x00f1=function(_0x556957,_0x3a10dd){_0x556957=_0x556957-0x0;var _0x353dee=_0x0f10[_0x556957];return _0x353dee;};'use strict';var _=require(_0x00f1('0x0'));var util=require(_0x00f1('0x1'));var moment=require('moment');var BPromise=require(_0x00f1('0x2'));var rs=require(_0x00f1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x00f1('0x4'))['db'];var utils=require(_0x00f1('0x5'));var logger=require(_0x00f1('0x6'))(_0x00f1('0x7'));var config=require('../../config/environment');var jayson=require(_0x00f1('0x8'));var client=jayson[_0x00f1('0x9')][_0x00f1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa601dc,_0x33f2c1,_0x4ff66f){return new BPromise(function(_0x2a84fa,_0x5e874c){return client['request'](_0xa601dc,_0x4ff66f)[_0x00f1('0xb')](function(_0x4158c1){logger[_0x00f1('0xc')]('MailServerIn,\x20%s,\x20%s',_0x33f2c1,_0x00f1('0xd'));logger[_0x00f1('0xe')](_0x00f1('0xf'),_0x33f2c1,'request\x20sent',JSON[_0x00f1('0x10')](_0x4158c1));if(_0x4158c1[_0x00f1('0x11')]){if(_0x4158c1[_0x00f1('0x11')][_0x00f1('0x12')]===0x1f4){logger[_0x00f1('0x11')]('MailServerIn,\x20%s,\x20%s',_0x33f2c1,_0x4158c1[_0x00f1('0x11')][_0x00f1('0x13')]);return _0x5e874c(_0x4158c1['error']['message']);}logger[_0x00f1('0x11')](_0x00f1('0x14'),_0x33f2c1,_0x4158c1[_0x00f1('0x11')][_0x00f1('0x13')]);return _0x2a84fa(_0x4158c1[_0x00f1('0x11')]['message']);}else{logger[_0x00f1('0xc')]('MailServerIn,\x20%s,\x20%s',_0x33f2c1,'request\x20sent');_0x2a84fa(_0x4158c1[_0x00f1('0x15')][_0x00f1('0x13')]);}})[_0x00f1('0x16')](function(_0xa19b77){logger[_0x00f1('0x11')](_0x00f1('0x14'),_0x33f2c1,_0xa19b77);_0x5e874c(_0xa19b77);});});}exports[_0x00f1('0x17')]=function(_0x308df3){var _0xb2a08b=this;return new Promise(function(_0x57c868,_0x13cd3c){return db[_0x00f1('0x18')][_0x00f1('0x19')]({'raw':_0x308df3[_0x00f1('0x1a')]?_0x308df3[_0x00f1('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x308df3[_0x00f1('0x1a')]?_0x308df3['options'][_0x00f1('0x1b')]||null:null,'attributes':_0x308df3[_0x00f1('0x1a')]?_0x308df3['options'][_0x00f1('0x1c')]||null:null,'limit':_0x308df3[_0x00f1('0x1a')]?_0x308df3['options']['limit']||null:null,'include':_0x308df3[_0x00f1('0x1a')]?_0x308df3[_0x00f1('0x1a')][_0x00f1('0x1d')]?_['map'](_0x308df3[_0x00f1('0x1a')]['include'],function(_0x30cc45){return{'model':db[_0x30cc45[_0x00f1('0x1e')]],'as':_0x30cc45['as'],'attributes':_0x30cc45[_0x00f1('0x1c')],'include':_0x30cc45[_0x00f1('0x1d')]?_[_0x00f1('0x1f')](_0x30cc45[_0x00f1('0x1d')],function(_0x107e91){return{'model':db[_0x107e91[_0x00f1('0x1e')]],'as':_0x107e91['as'],'attributes':_0x107e91[_0x00f1('0x1c')],'include':_0x107e91[_0x00f1('0x1d')]?_[_0x00f1('0x1f')](_0x107e91[_0x00f1('0x1d')],function(_0x4c70){return{'model':db[_0x4c70['model']],'as':_0x4c70['as'],'attributes':_0x4c70[_0x00f1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x00f1('0xb')](function(_0x18ed3a){logger['info'](_0x00f1('0x17'),_0x308df3);logger[_0x00f1('0xe')](_0x00f1('0x17'),_0x308df3,JSON[_0x00f1('0x10')](_0x18ed3a));_0x57c868(_0x18ed3a);})[_0x00f1('0x16')](function(_0x414400){logger[_0x00f1('0x11')]('GetMailServerIn',_0x414400['message'],_0x308df3);_0x13cd3c(_0xb2a08b[_0x00f1('0x11')](0x1f4,_0x414400[_0x00f1('0x13')]));});});}; \ No newline at end of file +var _0xb573=['limit','include','model','then','lodash','util','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','GetMailServerIn','MailServerIn','findAll','raw','options','where','attributes'];(function(_0x25c465,_0x279dc3){var _0x4925b0=function(_0x58b62d){while(--_0x58b62d){_0x25c465['push'](_0x25c465['shift']());}};_0x4925b0(++_0x279dc3);}(_0xb573,0x160));var _0x3b57=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb573[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3b57('0x0'));var util=require(_0x3b57('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3b57('0x2'));var fs=require('fs');var Redis=require(_0x3b57('0x3'));var db=require(_0x3b57('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x3b57('0x5'));var jayson=require(_0x3b57('0x6'));var client=jayson[_0x3b57('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a1fc6,_0x21ad01,_0x442b0b){return new BPromise(function(_0x30f885,_0x2aa16c){return client[_0x3b57('0x8')](_0x3a1fc6,_0x442b0b)['then'](function(_0x50400c){logger['info'](_0x3b57('0x9'),_0x21ad01,_0x3b57('0xa'));logger[_0x3b57('0xb')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x21ad01,_0x3b57('0xa'),JSON['stringify'](_0x50400c));if(_0x50400c[_0x3b57('0xc')]){if(_0x50400c[_0x3b57('0xc')][_0x3b57('0xd')]===0x1f4){logger[_0x3b57('0xc')](_0x3b57('0x9'),_0x21ad01,_0x50400c[_0x3b57('0xc')]['message']);return _0x2aa16c(_0x50400c['error'][_0x3b57('0xe')]);}logger[_0x3b57('0xc')](_0x3b57('0x9'),_0x21ad01,_0x50400c[_0x3b57('0xc')][_0x3b57('0xe')]);return _0x30f885(_0x50400c[_0x3b57('0xc')][_0x3b57('0xe')]);}else{logger[_0x3b57('0xf')]('MailServerIn,\x20%s,\x20%s',_0x21ad01,_0x3b57('0xa'));_0x30f885(_0x50400c[_0x3b57('0x10')][_0x3b57('0xe')]);}})[_0x3b57('0x11')](function(_0x4d94e6){logger['error']('MailServerIn,\x20%s,\x20%s',_0x21ad01,_0x4d94e6);_0x2aa16c(_0x4d94e6);});});}exports[_0x3b57('0x12')]=function(_0x2e7e9d){var _0x3f9dbd=this;return new Promise(function(_0x23bbb6,_0x18b9ae){return db[_0x3b57('0x13')][_0x3b57('0x14')]({'raw':_0x2e7e9d['options']?_0x2e7e9d['options'][_0x3b57('0x15')]===undefined?!![]:![]:!![],'where':_0x2e7e9d[_0x3b57('0x16')]?_0x2e7e9d['options'][_0x3b57('0x17')]||null:null,'attributes':_0x2e7e9d['options']?_0x2e7e9d[_0x3b57('0x16')][_0x3b57('0x18')]||null:null,'limit':_0x2e7e9d['options']?_0x2e7e9d[_0x3b57('0x16')][_0x3b57('0x19')]||null:null,'include':_0x2e7e9d[_0x3b57('0x16')]?_0x2e7e9d[_0x3b57('0x16')][_0x3b57('0x1a')]?_['map'](_0x2e7e9d[_0x3b57('0x16')]['include'],function(_0x53940e){return{'model':db[_0x53940e[_0x3b57('0x1b')]],'as':_0x53940e['as'],'attributes':_0x53940e[_0x3b57('0x18')],'include':_0x53940e[_0x3b57('0x1a')]?_['map'](_0x53940e[_0x3b57('0x1a')],function(_0x1b83e8){return{'model':db[_0x1b83e8[_0x3b57('0x1b')]],'as':_0x1b83e8['as'],'attributes':_0x1b83e8[_0x3b57('0x18')],'include':_0x1b83e8['include']?_['map'](_0x1b83e8[_0x3b57('0x1a')],function(_0x54222e){return{'model':db[_0x54222e[_0x3b57('0x1b')]],'as':_0x54222e['as'],'attributes':_0x54222e[_0x3b57('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3b57('0x1c')](function(_0x223924){logger['info'](_0x3b57('0x12'),_0x2e7e9d);logger[_0x3b57('0xb')](_0x3b57('0x12'),_0x2e7e9d,JSON['stringify'](_0x223924));_0x23bbb6(_0x223924);})[_0x3b57('0x11')](function(_0x4dfe1b){logger[_0x3b57('0xc')](_0x3b57('0x12'),_0x4dfe1b[_0x3b57('0xe')],_0x2e7e9d);_0x18b9ae(_0x3f9dbd[_0x3b57('0xc')](0x1f4,_0x4dfe1b[_0x3b57('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 2eb6746..20f1170 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 _0xc526=['exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','index','/:id','post','isAuthenticated','update','destroy'];(function(_0x25a065,_0x127082){var _0x4690be=function(_0x299990){while(--_0x299990){_0x25a065['push'](_0x25a065['shift']());}};_0x4690be(++_0x127082);}(_0xc526,0xf1));var _0x6c52=function(_0x1b736c,_0x283f44){_0x1b736c=_0x1b736c-0x0;var _0x18f7da=_0xc526[_0x1b736c];return _0x18f7da;};'use strict';var multer=require('multer');var util=require(_0x6c52('0x0'));var path=require(_0x6c52('0x1'));var timeout=require(_0x6c52('0x2'));var express=require(_0x6c52('0x3'));var router=express['Router']();var auth=require(_0x6c52('0x4'));var interaction=require(_0x6c52('0x5'));var config=require(_0x6c52('0x6'));var controller=require(_0x6c52('0x7'));router[_0x6c52('0x8')]('/',auth['isAuthenticated'](),controller[_0x6c52('0x9')]);router['get'](_0x6c52('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x6c52('0xb')]('/',auth[_0x6c52('0xc')](),controller['create']);router['put']('/:id',auth[_0x6c52('0xc')](),controller[_0x6c52('0xd')]);router['delete'](_0x6c52('0xa'),auth[_0x6c52('0xc')](),controller[_0x6c52('0xe')]);module[_0x6c52('0xf')]=router; \ No newline at end of file +var _0x8bdf=['./mailServerOut.controller','get','index','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x18e732,_0x31b328){var _0x1d72bf=function(_0x152c9d){while(--_0x152c9d){_0x18e732['push'](_0x18e732['shift']());}};_0x1d72bf(++_0x31b328);}(_0x8bdf,0x14c));var _0xf8bd=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x8bdf[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0xf8bd('0x0'));var util=require(_0xf8bd('0x1'));var path=require(_0xf8bd('0x2'));var timeout=require(_0xf8bd('0x3'));var express=require(_0xf8bd('0x4'));var router=express[_0xf8bd('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf8bd('0x6'));var config=require(_0xf8bd('0x7'));var controller=require(_0xf8bd('0x8'));router[_0xf8bd('0x9')]('/',auth['isAuthenticated'](),controller[_0xf8bd('0xa')]);router[_0xf8bd('0x9')]('/:id',auth[_0xf8bd('0xb')](),controller['show']);router[_0xf8bd('0xc')]('/',auth[_0xf8bd('0xb')](),controller[_0xf8bd('0xd')]);router[_0xf8bd('0xe')](_0xf8bd('0xf'),auth[_0xf8bd('0xb')](),controller[_0xf8bd('0x10')]);router[_0xf8bd('0x11')](_0xf8bd('0xf'),auth[_0xf8bd('0xb')](),controller[_0xf8bd('0x12')]);module[_0xf8bd('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 0555c7a..1ed3b6c 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 _0xac41=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x59162a,_0x10e547){var _0x35e50d=function(_0x578425){while(--_0x578425){_0x59162a['push'](_0x59162a['shift']());}};_0x35e50d(++_0x10e547);}(_0xac41,0xdd));var _0x1ac4=function(_0xa95b36,_0x106e4a){_0xa95b36=_0xa95b36-0x0;var _0x4de65a=_0xac41[_0xa95b36];return _0x4de65a;};'use strict';var Sequelize=require(_0x1ac4('0x0'));module[_0x1ac4('0x1')]={'description':{'type':Sequelize[_0x1ac4('0x2')]},'host':{'type':Sequelize[_0x1ac4('0x2')]},'user':{'type':Sequelize[_0x1ac4('0x2')]},'pass':{'type':Sequelize[_0x1ac4('0x2')]},'port':{'type':Sequelize[_0x1ac4('0x3')]},'secure':{'type':Sequelize[_0x1ac4('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x1ac4('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd663=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd663,0x1ed));var _0x3d66=function(_0x315ac8,_0x3199f5){_0x315ac8=_0x315ac8-0x0;var _0x20c15d=_0xd663[_0x315ac8];return _0x20c15d;};'use strict';var Sequelize=require(_0x3d66('0x0'));module[_0x3d66('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x3d66('0x2')]},'user':{'type':Sequelize[_0x3d66('0x2')]},'pass':{'type':Sequelize[_0x3d66('0x2')]},'port':{'type':Sequelize[_0x3d66('0x3')]},'secure':{'type':Sequelize[_0x3d66('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x3d66('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 92db940..23b0e62 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 _0x19ed=['fields','includeAll','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','attributes','intersection','length','nolimit','order','sort','pick','filters','filter','where','merge','type','options','MailServerOut','findAll','rows','catch','show','params'];(function(_0x232ec0,_0x45fdd0){var _0x356705=function(_0x4099ea){while(--_0x4099ea){_0x232ec0['push'](_0x232ec0['shift']());}};_0x356705(++_0x45fdd0);}(_0x19ed,0xa2));var _0xd19e=function(_0x8c51b6,_0x431aff){_0x8c51b6=_0x8c51b6-0x0;var _0x2fe4b7=_0x19ed[_0x8c51b6];return _0x2fe4b7;};'use strict';var pdf=require(_0xd19e('0x0'));var emlformat=require(_0xd19e('0x1'));var rimraf=require(_0xd19e('0x2'));var zipdir=require(_0xd19e('0x3'));var jsonpatch=require(_0xd19e('0x4'));var rp=require(_0xd19e('0x5'));var moment=require(_0xd19e('0x6'));var BPromise=require(_0xd19e('0x7'));var Mustache=require(_0xd19e('0x8'));var util=require(_0xd19e('0x9'));var path=require(_0xd19e('0xa'));var sox=require(_0xd19e('0xb'));var csv=require(_0xd19e('0xc'));var ejs=require(_0xd19e('0xd'));var fs=require('fs');var _=require(_0xd19e('0xe'));var squel=require(_0xd19e('0xf'));var crypto=require(_0xd19e('0x10'));var jsforce=require(_0xd19e('0x11'));var deskjs=require(_0xd19e('0x12'));var toCsv=require(_0xd19e('0xc'));var querystring=require(_0xd19e('0x13'));var Papa=require(_0xd19e('0x14'));var Redis=require('ioredis');var authService=require(_0xd19e('0x15'));var qs=require(_0xd19e('0x16'));var as=require(_0xd19e('0x17'));var hardwareService=require(_0xd19e('0x18'));var logger=require(_0xd19e('0x19'))('api');var utils=require(_0xd19e('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xd19e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x20e56b,_0x308617){_0x308617=_0x308617||0xcc;return function(_0x574ffb){if(_0x574ffb){return _0x20e56b[_0xd19e('0x1c')](_0x308617);}return _0x20e56b[_0xd19e('0x1d')](_0x308617)[_0xd19e('0x1e')]();};}function respondWithResult(_0x74b82f,_0x5d08ba){_0x5d08ba=_0x5d08ba||0xc8;return function(_0x52d9b1){if(_0x52d9b1){return _0x74b82f['status'](_0x5d08ba)[_0xd19e('0x1f')](_0x52d9b1);}};}function respondWithFilteredResult(_0x3ee7d6,_0x1a84ba){return function(_0x57eb77){if(_0x57eb77){var _0x488d08=_0x57eb77[_0xd19e('0x20')],_0x45565b=_0x1a84ba['offset'],_0x3fa8e3=_0x1a84ba[_0xd19e('0x21')]+_0x1a84ba[_0xd19e('0x22')],_0x57f669;if(_0x3fa8e3>=_0x488d08){_0x3fa8e3=_0x488d08;_0x57f669=0xc8;}else{_0x57f669=0xce;}_0x3ee7d6[_0xd19e('0x1d')](_0x57f669);return _0x3ee7d6[_0xd19e('0x23')](_0xd19e('0x24'),_0x45565b+'-'+_0x3fa8e3+'/'+_0x488d08)[_0xd19e('0x1f')](_0x57eb77);}return null;};}function patchUpdates(_0x5fd1c6){return function(_0x4da0d1){try{jsonpatch[_0xd19e('0x25')](_0x4da0d1,_0x5fd1c6,!![]);}catch(_0x13d884){return BPromise[_0xd19e('0x26')](_0x13d884);}return _0x4da0d1[_0xd19e('0x27')]();};}function saveUpdates(_0x3dab4a,_0x197312){return function(_0x703d68){if(_0x703d68){return _0x703d68[_0xd19e('0x28')](_0x3dab4a)[_0xd19e('0x29')](function(_0x2222ef){return _0x2222ef;});}return null;};}function removeEntity(_0x55140f,_0xc26d3f){return function(_0x1587df){if(_0x1587df){return _0x1587df['destroy']()[_0xd19e('0x29')](function(){_0x55140f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c3ef6,_0x3eb9f0){return function(_0x136778){if(!_0x136778){_0x1c3ef6[_0xd19e('0x1c')](0x194);}return _0x136778;};}function handleError(_0x3adb90,_0x5f8dd6){_0x5f8dd6=_0x5f8dd6||0x1f4;return function(_0x103e74){logger[_0xd19e('0x2a')](_0x103e74[_0xd19e('0x2b')]);if(_0x103e74[_0xd19e('0x2c')]){delete _0x103e74[_0xd19e('0x2c')];}_0x3adb90[_0xd19e('0x1d')](_0x5f8dd6)[_0xd19e('0x2d')](_0x103e74);};}exports[_0xd19e('0x2e')]=function(_0x46bfa6,_0x5e025a){var _0x12e758={},_0x27fff3={},_0x4299b1={'count':0x0,'rows':[]};var _0x382104=_[_0xd19e('0x2f')](db['MailServerOut'][_0xd19e('0x30')],function(_0x10df7d){return{'name':_0x10df7d[_0xd19e('0x31')],'type':_0x10df7d['type'][_0xd19e('0x32')]};});_0x27fff3[_0xd19e('0x33')]=_[_0xd19e('0x2f')](_0x382104,'name');_0x27fff3[_0xd19e('0x34')]=_['keys'](_0x46bfa6[_0xd19e('0x34')]);_0x27fff3['filters']=_['intersection'](_0x27fff3['model'],_0x27fff3['query']);_0x12e758[_0xd19e('0x35')]=_[_0xd19e('0x36')](_0x27fff3[_0xd19e('0x33')],qs['fields'](_0x46bfa6['query']['fields']));_0x12e758['attributes']=_0x12e758[_0xd19e('0x35')][_0xd19e('0x37')]?_0x12e758['attributes']:_0x27fff3['model'];if(!_0x46bfa6[_0xd19e('0x34')]['hasOwnProperty'](_0xd19e('0x38'))){_0x12e758[_0xd19e('0x22')]=qs[_0xd19e('0x22')](_0x46bfa6[_0xd19e('0x34')][_0xd19e('0x22')]);_0x12e758[_0xd19e('0x21')]=qs[_0xd19e('0x21')](_0x46bfa6['query'][_0xd19e('0x21')]);}_0x12e758[_0xd19e('0x39')]=qs['sort'](_0x46bfa6[_0xd19e('0x34')][_0xd19e('0x3a')]);_0x12e758['where']=qs['filters'](_[_0xd19e('0x3b')](_0x46bfa6[_0xd19e('0x34')],_0x27fff3[_0xd19e('0x3c')]),_0x382104);if(_0x46bfa6[_0xd19e('0x34')][_0xd19e('0x3d')]){_0x12e758[_0xd19e('0x3e')]=_[_0xd19e('0x3f')](_0x12e758[_0xd19e('0x3e')],{'$or':_[_0xd19e('0x2f')](_0x382104,function(_0x24e6e0){if(_0x24e6e0[_0xd19e('0x40')]!=='VIRTUAL'){var _0x468f98={};_0x468f98[_0x24e6e0[_0xd19e('0x2c')]]={'$like':'%'+_0x46bfa6[_0xd19e('0x34')][_0xd19e('0x3d')]+'%'};return _0x468f98;}})});}_0x12e758=_[_0xd19e('0x3f')]({},_0x12e758,_0x46bfa6[_0xd19e('0x41')]);var _0x2ee783={'where':_0x12e758[_0xd19e('0x3e')]};return db['MailServerOut']['count'](_0x2ee783)[_0xd19e('0x29')](function(_0xddc1bd){_0x4299b1[_0xd19e('0x20')]=_0xddc1bd;if(_0x46bfa6[_0xd19e('0x34')]['includeAll']){_0x12e758['include']=[{'all':!![]}];}return db[_0xd19e('0x42')][_0xd19e('0x43')](_0x12e758);})[_0xd19e('0x29')](function(_0x1c13fc){_0x4299b1[_0xd19e('0x44')]=_0x1c13fc;return _0x4299b1;})[_0xd19e('0x29')](respondWithFilteredResult(_0x5e025a,_0x12e758))[_0xd19e('0x45')](handleError(_0x5e025a,null));};exports[_0xd19e('0x46')]=function(_0x242d94,_0xb3e51a){var _0x491612={'raw':!![],'where':{'id':_0x242d94[_0xd19e('0x47')]['id']}},_0x599518={};_0x599518[_0xd19e('0x33')]=_['keys'](db['MailServerOut']['rawAttributes']);_0x599518[_0xd19e('0x34')]=_['keys'](_0x242d94[_0xd19e('0x34')]);_0x599518['filters']=_[_0xd19e('0x36')](_0x599518['model'],_0x599518[_0xd19e('0x34')]);_0x491612[_0xd19e('0x35')]=_['intersection'](_0x599518[_0xd19e('0x33')],qs[_0xd19e('0x48')](_0x242d94['query'][_0xd19e('0x48')]));_0x491612[_0xd19e('0x35')]=_0x491612['attributes'][_0xd19e('0x37')]?_0x491612[_0xd19e('0x35')]:_0x599518['model'];if(_0x242d94[_0xd19e('0x34')][_0xd19e('0x49')]){_0x491612[_0xd19e('0x4a')]=[{'all':!![]}];}_0x491612=_['merge']({},_0x491612,_0x242d94[_0xd19e('0x41')]);return db[_0xd19e('0x42')][_0xd19e('0x4b')](_0x491612)[_0xd19e('0x29')](handleEntityNotFound(_0xb3e51a,null))[_0xd19e('0x29')](respondWithResult(_0xb3e51a,null))['catch'](handleError(_0xb3e51a,null));};exports[_0xd19e('0x4c')]=function(_0x5d8c34,_0x3926bf){return db[_0xd19e('0x42')][_0xd19e('0x4c')](_0x5d8c34[_0xd19e('0x4d')],{})[_0xd19e('0x29')](respondWithResult(_0x3926bf,0xc9))[_0xd19e('0x45')](handleError(_0x3926bf,null));};exports['update']=function(_0x5e99d9,_0x65835d){if(_0x5e99d9['body']['id']){delete _0x5e99d9['body']['id'];}return db[_0xd19e('0x42')][_0xd19e('0x4b')]({'where':{'id':_0x5e99d9['params']['id']}})[_0xd19e('0x29')](handleEntityNotFound(_0x65835d,null))['then'](saveUpdates(_0x5e99d9['body'],null))[_0xd19e('0x29')](respondWithResult(_0x65835d,null))[_0xd19e('0x45')](handleError(_0x65835d,null));};exports['destroy']=function(_0x452767,_0x2e57e0){return db[_0xd19e('0x42')][_0xd19e('0x4b')]({'where':{'id':_0x452767['params']['id']}})['then'](handleEntityNotFound(_0x2e57e0,null))[_0xd19e('0x29')](removeEntity(_0x2e57e0,null))[_0xd19e('0x45')](handleError(_0x2e57e0,null));}; \ No newline at end of file +var _0x4b0e=['find','create','body','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','MailServerOut','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll'];(function(_0x198446,_0x119c8f){var _0x38d7b7=function(_0x293752){while(--_0x293752){_0x198446['push'](_0x198446['shift']());}};_0x38d7b7(++_0x119c8f);}(_0x4b0e,0x12b));var _0xe4b0=function(_0x584de3,_0x96b58d){_0x584de3=_0x584de3-0x0;var _0x54c303=_0x4b0e[_0x584de3];return _0x54c303;};'use strict';var pdf=require(_0xe4b0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe4b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe4b0('0x2'));var rp=require(_0xe4b0('0x3'));var moment=require(_0xe4b0('0x4'));var BPromise=require(_0xe4b0('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe4b0('0x6'));var sox=require(_0xe4b0('0x7'));var csv=require(_0xe4b0('0x8'));var ejs=require(_0xe4b0('0x9'));var fs=require('fs');var _=require(_0xe4b0('0xa'));var squel=require(_0xe4b0('0xb'));var crypto=require(_0xe4b0('0xc'));var jsforce=require(_0xe4b0('0xd'));var deskjs=require(_0xe4b0('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe4b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe4b0('0x10'));var authService=require(_0xe4b0('0x11'));var qs=require(_0xe4b0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe4b0('0x13'));var logger=require(_0xe4b0('0x14'))(_0xe4b0('0x15'));var utils=require(_0xe4b0('0x16'));var config=require(_0xe4b0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4b0('0x18'))['db'];function respondWithStatusCode(_0x5e9b88,_0x3bcabe){_0x3bcabe=_0x3bcabe||0xcc;return function(_0x5f1493){if(_0x5f1493){return _0x5e9b88[_0xe4b0('0x19')](_0x3bcabe);}return _0x5e9b88[_0xe4b0('0x1a')](_0x3bcabe)[_0xe4b0('0x1b')]();};}function respondWithResult(_0x4501a0,_0x51c2ab){_0x51c2ab=_0x51c2ab||0xc8;return function(_0xaa5f55){if(_0xaa5f55){return _0x4501a0[_0xe4b0('0x1a')](_0x51c2ab)['json'](_0xaa5f55);}};}function respondWithFilteredResult(_0x196e91,_0x278d6b){return function(_0x11d104){if(_0x11d104){var _0x3a8bce=_0x11d104[_0xe4b0('0x1c')],_0x420e64=_0x278d6b[_0xe4b0('0x1d')],_0x3aa4dc=_0x278d6b[_0xe4b0('0x1d')]+_0x278d6b[_0xe4b0('0x1e')],_0x55a2a6;if(_0x3aa4dc>=_0x3a8bce){_0x3aa4dc=_0x3a8bce;_0x55a2a6=0xc8;}else{_0x55a2a6=0xce;}_0x196e91['status'](_0x55a2a6);return _0x196e91[_0xe4b0('0x1f')]('Content-Range',_0x420e64+'-'+_0x3aa4dc+'/'+_0x3a8bce)[_0xe4b0('0x20')](_0x11d104);}return null;};}function patchUpdates(_0x456825){return function(_0x1d64de){try{jsonpatch[_0xe4b0('0x21')](_0x1d64de,_0x456825,!![]);}catch(_0x3b9939){return BPromise[_0xe4b0('0x22')](_0x3b9939);}return _0x1d64de[_0xe4b0('0x23')]();};}function saveUpdates(_0x51026c,_0x4e2e37){return function(_0x31c907){if(_0x31c907){return _0x31c907[_0xe4b0('0x24')](_0x51026c)[_0xe4b0('0x25')](function(_0x1cef41){return _0x1cef41;});}return null;};}function removeEntity(_0x433d85,_0x41beff){return function(_0x72c185){if(_0x72c185){return _0x72c185[_0xe4b0('0x26')]()[_0xe4b0('0x25')](function(){_0x433d85['status'](0xcc)[_0xe4b0('0x1b')]();});}};}function handleEntityNotFound(_0x33fa42,_0x3fc818){return function(_0x3f8cb0){if(!_0x3f8cb0){_0x33fa42[_0xe4b0('0x19')](0x194);}return _0x3f8cb0;};}function handleError(_0x43e634,_0x2568fd){_0x2568fd=_0x2568fd||0x1f4;return function(_0x3758a1){logger[_0xe4b0('0x27')](_0x3758a1[_0xe4b0('0x28')]);if(_0x3758a1[_0xe4b0('0x29')]){delete _0x3758a1['name'];}_0x43e634['status'](_0x2568fd)[_0xe4b0('0x2a')](_0x3758a1);};}exports[_0xe4b0('0x2b')]=function(_0x2de0ca,_0x1ebacf){var _0x483c30={},_0x5a6922={},_0x2f48c1={'count':0x0,'rows':[]};var _0x3aefb5=_['map'](db[_0xe4b0('0x2c')][_0xe4b0('0x2d')],function(_0x1474cd){return{'name':_0x1474cd[_0xe4b0('0x2e')],'type':_0x1474cd[_0xe4b0('0x2f')][_0xe4b0('0x30')]};});_0x5a6922[_0xe4b0('0x31')]=_[_0xe4b0('0x32')](_0x3aefb5,'name');_0x5a6922['query']=_[_0xe4b0('0x33')](_0x2de0ca[_0xe4b0('0x34')]);_0x5a6922[_0xe4b0('0x35')]=_[_0xe4b0('0x36')](_0x5a6922[_0xe4b0('0x31')],_0x5a6922[_0xe4b0('0x34')]);_0x483c30['attributes']=_['intersection'](_0x5a6922[_0xe4b0('0x31')],qs[_0xe4b0('0x37')](_0x2de0ca[_0xe4b0('0x34')][_0xe4b0('0x37')]));_0x483c30[_0xe4b0('0x38')]=_0x483c30[_0xe4b0('0x38')][_0xe4b0('0x39')]?_0x483c30['attributes']:_0x5a6922['model'];if(!_0x2de0ca['query']['hasOwnProperty'](_0xe4b0('0x3a'))){_0x483c30[_0xe4b0('0x1e')]=qs['limit'](_0x2de0ca[_0xe4b0('0x34')][_0xe4b0('0x1e')]);_0x483c30[_0xe4b0('0x1d')]=qs['offset'](_0x2de0ca[_0xe4b0('0x34')][_0xe4b0('0x1d')]);}_0x483c30['order']=qs['sort'](_0x2de0ca[_0xe4b0('0x34')][_0xe4b0('0x3b')]);_0x483c30[_0xe4b0('0x3c')]=qs[_0xe4b0('0x35')](_['pick'](_0x2de0ca[_0xe4b0('0x34')],_0x5a6922[_0xe4b0('0x35')]),_0x3aefb5);if(_0x2de0ca[_0xe4b0('0x34')][_0xe4b0('0x3d')]){_0x483c30[_0xe4b0('0x3c')]=_[_0xe4b0('0x3e')](_0x483c30['where'],{'$or':_['map'](_0x3aefb5,function(_0x255501){if(_0x255501[_0xe4b0('0x2f')]!==_0xe4b0('0x3f')){var _0x1ccf3e={};_0x1ccf3e[_0x255501['name']]={'$like':'%'+_0x2de0ca[_0xe4b0('0x34')][_0xe4b0('0x3d')]+'%'};return _0x1ccf3e;}})});}_0x483c30=_[_0xe4b0('0x3e')]({},_0x483c30,_0x2de0ca[_0xe4b0('0x40')]);var _0x25b376={'where':_0x483c30[_0xe4b0('0x3c')]};return db[_0xe4b0('0x2c')]['count'](_0x25b376)['then'](function(_0x565857){_0x2f48c1['count']=_0x565857;if(_0x2de0ca[_0xe4b0('0x34')]['includeAll']){_0x483c30[_0xe4b0('0x41')]=[{'all':!![]}];}return db['MailServerOut'][_0xe4b0('0x42')](_0x483c30);})[_0xe4b0('0x25')](function(_0x19b65d){_0x2f48c1[_0xe4b0('0x43')]=_0x19b65d;return _0x2f48c1;})[_0xe4b0('0x25')](respondWithFilteredResult(_0x1ebacf,_0x483c30))[_0xe4b0('0x44')](handleError(_0x1ebacf,null));};exports['show']=function(_0x348399,_0x436eff){var _0x2b7a51={'raw':!![],'where':{'id':_0x348399[_0xe4b0('0x45')]['id']}},_0x1d8c4a={};_0x1d8c4a[_0xe4b0('0x31')]=_[_0xe4b0('0x33')](db[_0xe4b0('0x2c')][_0xe4b0('0x2d')]);_0x1d8c4a[_0xe4b0('0x34')]=_[_0xe4b0('0x33')](_0x348399['query']);_0x1d8c4a[_0xe4b0('0x35')]=_[_0xe4b0('0x36')](_0x1d8c4a['model'],_0x1d8c4a['query']);_0x2b7a51[_0xe4b0('0x38')]=_[_0xe4b0('0x36')](_0x1d8c4a[_0xe4b0('0x31')],qs[_0xe4b0('0x37')](_0x348399[_0xe4b0('0x34')][_0xe4b0('0x37')]));_0x2b7a51[_0xe4b0('0x38')]=_0x2b7a51[_0xe4b0('0x38')][_0xe4b0('0x39')]?_0x2b7a51['attributes']:_0x1d8c4a[_0xe4b0('0x31')];if(_0x348399[_0xe4b0('0x34')][_0xe4b0('0x46')]){_0x2b7a51[_0xe4b0('0x41')]=[{'all':!![]}];}_0x2b7a51=_[_0xe4b0('0x3e')]({},_0x2b7a51,_0x348399[_0xe4b0('0x40')]);return db[_0xe4b0('0x2c')][_0xe4b0('0x47')](_0x2b7a51)[_0xe4b0('0x25')](handleEntityNotFound(_0x436eff,null))['then'](respondWithResult(_0x436eff,null))[_0xe4b0('0x44')](handleError(_0x436eff,null));};exports[_0xe4b0('0x48')]=function(_0x2977d6,_0x26dbb1){return db[_0xe4b0('0x2c')][_0xe4b0('0x48')](_0x2977d6[_0xe4b0('0x49')],{})[_0xe4b0('0x25')](respondWithResult(_0x26dbb1,0xc9))[_0xe4b0('0x44')](handleError(_0x26dbb1,null));};exports[_0xe4b0('0x24')]=function(_0x316a7e,_0x33bd0a){if(_0x316a7e['body']['id']){delete _0x316a7e['body']['id'];}return db[_0xe4b0('0x2c')][_0xe4b0('0x47')]({'where':{'id':_0x316a7e[_0xe4b0('0x45')]['id']}})[_0xe4b0('0x25')](handleEntityNotFound(_0x33bd0a,null))[_0xe4b0('0x25')](saveUpdates(_0x316a7e['body'],null))['then'](respondWithResult(_0x33bd0a,null))['catch'](handleError(_0x33bd0a,null));};exports['destroy']=function(_0x47ec9c,_0xbf0a88){return db[_0xe4b0('0x2c')][_0xe4b0('0x47')]({'where':{'id':_0x47ec9c[_0xe4b0('0x45')]['id']}})[_0xe4b0('0x25')](handleEntityNotFound(_0xbf0a88,null))[_0xe4b0('0x25')](removeEntity(_0xbf0a88,null))[_0xe4b0('0x44')](handleError(_0xbf0a88,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index a6f23ae..be239c9 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 _0xba34=['rimraf','../../config/environment','./mailServerOut.attributes','exports','define','mail_servers_out','lodash','util','../../config/logger','api','moment'];(function(_0x5d40e2,_0x4a967c){var _0x845291=function(_0x59d0dd){while(--_0x59d0dd){_0x5d40e2['push'](_0x5d40e2['shift']());}};_0x845291(++_0x4a967c);}(_0xba34,0x119));var _0x4ba3=function(_0x379cba,_0x5c0a8f){_0x379cba=_0x379cba-0x0;var _0x10862a=_0xba34[_0x379cba];return _0x10862a;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));module[_0x4ba3('0x8')]=function(_0x3590a1,_0xb88621){return _0x3590a1[_0x4ba3('0x9')]('MailServerOut',attributes,{'tableName':_0x4ba3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['mail_servers_out','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x1695b7,_0x230b7c){var _0x56b125=function(_0x2dc20c){while(--_0x2dc20c){_0x1695b7['push'](_0x1695b7['shift']());}};_0x56b125(++_0x230b7c);}(_0x326f,0xd1));var _0xf326=function(_0x388865,_0x289a91){_0x388865=_0x388865-0x0;var _0x8c7a42=_0x326f[_0x388865];return _0x8c7a42;};'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/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 9db93b3..0351c02 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 _0x0445=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x1137ac,_0x353892){var _0x2ac89b=function(_0x36993a){while(--_0x36993a){_0x1137ac['push'](_0x1137ac['shift']());}};_0x2ac89b(++_0x353892);}(_0x0445,0xa8));var _0x5044=function(_0x99ff94,_0x47a1b1){_0x99ff94=_0x99ff94-0x0;var _0x1b5bc0=_0x0445[_0x99ff94];return _0x1b5bc0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x5044('0x0'));var rs=require(_0x5044('0x1'));var fs=require('fs');var Redis=require(_0x5044('0x2'));var db=require(_0x5044('0x3'))['db'];var utils=require(_0x5044('0x4'));var logger=require(_0x5044('0x5'))(_0x5044('0x6'));var config=require('../../config/environment');var jayson=require(_0x5044('0x7'));var client=jayson[_0x5044('0x8')][_0x5044('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a5969,_0x16dbfa,_0x9c194c){return new BPromise(function(_0x2c3332,_0x194b24){return client[_0x5044('0xa')](_0x1a5969,_0x9c194c)[_0x5044('0xb')](function(_0x29a823){logger['info'](_0x5044('0xc'),_0x16dbfa,_0x5044('0xd'));logger[_0x5044('0xe')](_0x5044('0xf'),_0x16dbfa,'request\x20sent',JSON[_0x5044('0x10')](_0x29a823));if(_0x29a823[_0x5044('0x11')]){if(_0x29a823[_0x5044('0x11')]['code']===0x1f4){logger[_0x5044('0x11')](_0x5044('0xc'),_0x16dbfa,_0x29a823[_0x5044('0x11')][_0x5044('0x12')]);return _0x194b24(_0x29a823[_0x5044('0x11')][_0x5044('0x12')]);}logger[_0x5044('0x11')]('MailServerOut,\x20%s,\x20%s',_0x16dbfa,_0x29a823[_0x5044('0x11')][_0x5044('0x12')]);return _0x2c3332(_0x29a823[_0x5044('0x11')][_0x5044('0x12')]);}else{logger[_0x5044('0x13')](_0x5044('0xc'),_0x16dbfa,'request\x20sent');_0x2c3332(_0x29a823[_0x5044('0x14')][_0x5044('0x12')]);}})['catch'](function(_0x20c92b){logger[_0x5044('0x11')]('MailServerOut,\x20%s,\x20%s',_0x16dbfa,_0x20c92b);_0x194b24(_0x20c92b);});});} \ No newline at end of file +var _0x12cf=['../../config/environment','jayson/promise','request','info','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerOut,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x44988f,_0x2d8e11){var _0x257425=function(_0x24437a){while(--_0x24437a){_0x44988f['push'](_0x44988f['shift']());}};_0x257425(++_0x2d8e11);}(_0x12cf,0x6a));var _0xf12c=function(_0x4372bc,_0x879a2f){_0x4372bc=_0x4372bc-0x0;var _0x609a27=_0x12cf[_0x4372bc];return _0x609a27;};'use strict';var _=require(_0xf12c('0x0'));var util=require(_0xf12c('0x1'));var moment=require(_0xf12c('0x2'));var BPromise=require(_0xf12c('0x3'));var rs=require(_0xf12c('0x4'));var fs=require('fs');var Redis=require(_0xf12c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf12c('0x6'));var logger=require(_0xf12c('0x7'))(_0xf12c('0x8'));var config=require(_0xf12c('0x9'));var jayson=require(_0xf12c('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ee3dd,_0x45aa0f,_0x3019be){return new BPromise(function(_0x2b9294,_0x27f3c4){return client[_0xf12c('0xb')](_0x5ee3dd,_0x3019be)['then'](function(_0x4a5afd){logger[_0xf12c('0xc')]('MailServerOut,\x20%s,\x20%s',_0x45aa0f,'request\x20sent');logger[_0xf12c('0xd')](_0xf12c('0xe'),_0x45aa0f,'request\x20sent',JSON[_0xf12c('0xf')](_0x4a5afd));if(_0x4a5afd[_0xf12c('0x10')]){if(_0x4a5afd[_0xf12c('0x10')][_0xf12c('0x11')]===0x1f4){logger['error'](_0xf12c('0x12'),_0x45aa0f,_0x4a5afd['error'][_0xf12c('0x13')]);return _0x27f3c4(_0x4a5afd['error'][_0xf12c('0x13')]);}logger['error']('MailServerOut,\x20%s,\x20%s',_0x45aa0f,_0x4a5afd[_0xf12c('0x10')][_0xf12c('0x13')]);return _0x2b9294(_0x4a5afd[_0xf12c('0x10')][_0xf12c('0x13')]);}else{logger['info'](_0xf12c('0x12'),_0x45aa0f,_0xf12c('0x14'));_0x2b9294(_0x4a5afd[_0xf12c('0x15')][_0xf12c('0x13')]);}})[_0xf12c('0x16')](function(_0x17deeb){logger[_0xf12c('0x10')](_0xf12c('0x12'),_0x45aa0f,_0x17deeb);_0x27f3c4(_0x17deeb);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index a1f295d..d8e36e9 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 _0x8d12=['connect-timeout','express','../../components/auth/service','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d12,0x9e));var _0x28d1=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x8d12[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0x28d1('0x0'));var util=require(_0x28d1('0x1'));var path=require('path');var timeout=require(_0x28d1('0x2'));var express=require(_0x28d1('0x3'));var router=express['Router']();var auth=require(_0x28d1('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x28d1('0x5'));router[_0x28d1('0x6')]('/',auth[_0x28d1('0x7')](),controller[_0x28d1('0x8')]);router[_0x28d1('0x6')](_0x28d1('0x9'),auth[_0x28d1('0x7')](),controller[_0x28d1('0xa')]);router[_0x28d1('0x6')](_0x28d1('0xb'),auth['isAuthenticated'](),controller[_0x28d1('0xc')]);router[_0x28d1('0xd')]('/',auth[_0x28d1('0x7')](),controller[_0x28d1('0xe')]);router[_0x28d1('0xf')](_0x28d1('0xb'),auth[_0x28d1('0x7')](),controller[_0x28d1('0x10')]);router[_0x28d1('0x11')](_0x28d1('0xb'),auth['isAuthenticated'](),controller[_0x28d1('0x12')]);module[_0x28d1('0x13')]=router; \ No newline at end of file +var _0xbddb=['/describe','describe','get','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','./mailSubstatus.controller','isAuthenticated','index'];(function(_0x30bc34,_0x4ef8cb){var _0x2a6cee=function(_0x1466c4){while(--_0x1466c4){_0x30bc34['push'](_0x30bc34['shift']());}};_0x2a6cee(++_0x4ef8cb);}(_0xbddb,0x69));var _0xbbdd=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xbddb[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xbbdd('0x0'));var util=require(_0xbbdd('0x1'));var path=require(_0xbbdd('0x2'));var timeout=require(_0xbbdd('0x3'));var express=require(_0xbbdd('0x4'));var router=express['Router']();var auth=require(_0xbbdd('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbbdd('0x6'));router['get']('/',auth[_0xbbdd('0x7')](),controller[_0xbbdd('0x8')]);router['get'](_0xbbdd('0x9'),auth[_0xbbdd('0x7')](),controller[_0xbbdd('0xa')]);router[_0xbbdd('0xb')](_0xbbdd('0xc'),auth[_0xbbdd('0x7')](),controller[_0xbbdd('0xd')]);router[_0xbbdd('0xe')]('/',auth[_0xbbdd('0x7')](),controller['create']);router[_0xbbdd('0xf')](_0xbbdd('0xc'),auth[_0xbbdd('0x7')](),controller[_0xbbdd('0x10')]);router[_0xbbdd('0x11')](_0xbbdd('0xc'),auth[_0xbbdd('0x7')](),controller[_0xbbdd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 1f0fd41..3aada8b 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 _0xf3a8=['exports','STRING'];(function(_0x555337,_0x1559d1){var _0x49b217=function(_0x3cb634){while(--_0x3cb634){_0x555337['push'](_0x555337['shift']());}};_0x49b217(++_0x1559d1);}(_0xf3a8,0xf2));var _0x8f3a=function(_0x25c2dd,_0x686804){_0x25c2dd=_0x25c2dd-0x0;var _0x193894=_0xf3a8[_0x25c2dd];return _0x193894;};'use strict';var Sequelize=require('sequelize');module[_0x8f3a('0x0')]={'name':{'type':Sequelize[_0x8f3a('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8f3a('0x1')]}}; \ No newline at end of file +var _0x7382=['exports'];(function(_0x17cccf,_0x4bc109){var _0x36f8f1=function(_0x2421e1){while(--_0x2421e1){_0x17cccf['push'](_0x17cccf['shift']());}};_0x36f8f1(++_0x4bc109);}(_0x7382,0x111));var _0x2738=function(_0x35727a,_0x2b7c12){_0x35727a=_0x35727a-0x0;var _0x1f1958=_0x7382[_0x35727a];return _0x1f1958;};'use strict';var Sequelize=require('sequelize');module[_0x2738('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 7b0bc30..c391b10 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 _0x4fcb=['MailSubstatus','fieldName','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','map'];(function(_0x424329,_0x1a3e61){var _0x324625=function(_0x3e2ce2){while(--_0x3e2ce2){_0x424329['push'](_0x424329['shift']());}};_0x324625(++_0x1a3e61);}(_0x4fcb,0x102));var _0xb4fc=function(_0x586362,_0x20d7b7){_0x586362=_0x586362-0x0;var _0x2edefe=_0x4fcb[_0x586362];return _0x2edefe;};'use strict';var pdf=require(_0xb4fc('0x0'));var emlformat=require(_0xb4fc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb4fc('0x2'));var jsonpatch=require(_0xb4fc('0x3'));var rp=require(_0xb4fc('0x4'));var moment=require(_0xb4fc('0x5'));var BPromise=require(_0xb4fc('0x6'));var Mustache=require(_0xb4fc('0x7'));var util=require(_0xb4fc('0x8'));var path=require('path');var sox=require(_0xb4fc('0x9'));var csv=require(_0xb4fc('0xa'));var ejs=require(_0xb4fc('0xb'));var fs=require('fs');var _=require(_0xb4fc('0xc'));var squel=require(_0xb4fc('0xd'));var crypto=require(_0xb4fc('0xe'));var jsforce=require(_0xb4fc('0xf'));var deskjs=require(_0xb4fc('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb4fc('0x11'));var Papa=require(_0xb4fc('0x12'));var Redis=require('ioredis');var authService=require(_0xb4fc('0x13'));var qs=require(_0xb4fc('0x14'));var as=require(_0xb4fc('0x15'));var hardwareService=require(_0xb4fc('0x16'));var logger=require(_0xb4fc('0x17'))(_0xb4fc('0x18'));var utils=require(_0xb4fc('0x19'));var config=require(_0xb4fc('0x1a'));var licenseUtil=require(_0xb4fc('0x1b'));var db=require(_0xb4fc('0x1c'))['db'];function respondWithStatusCode(_0x16c8ab,_0x1de020){_0x1de020=_0x1de020||0xcc;return function(_0x59f1b2){if(_0x59f1b2){return _0x16c8ab['sendStatus'](_0x1de020);}return _0x16c8ab['status'](_0x1de020)[_0xb4fc('0x1d')]();};}function respondWithResult(_0x173a4b,_0x2e41b7){_0x2e41b7=_0x2e41b7||0xc8;return function(_0x26b908){if(_0x26b908){return _0x173a4b[_0xb4fc('0x1e')](_0x2e41b7)[_0xb4fc('0x1f')](_0x26b908);}};}function respondWithFilteredResult(_0x3b183f,_0x2b7fcf){return function(_0x55ca00){if(_0x55ca00){var _0x5d0f03=_0x55ca00[_0xb4fc('0x20')],_0x3af3b4=_0x2b7fcf[_0xb4fc('0x21')],_0x2d0faa=_0x2b7fcf['offset']+_0x2b7fcf[_0xb4fc('0x22')],_0x2c2b21;if(_0x2d0faa>=_0x5d0f03){_0x2d0faa=_0x5d0f03;_0x2c2b21=0xc8;}else{_0x2c2b21=0xce;}_0x3b183f[_0xb4fc('0x1e')](_0x2c2b21);return _0x3b183f[_0xb4fc('0x23')](_0xb4fc('0x24'),_0x3af3b4+'-'+_0x2d0faa+'/'+_0x5d0f03)[_0xb4fc('0x1f')](_0x55ca00);}return null;};}function patchUpdates(_0x22b35b){return function(_0x26293b){try{jsonpatch['apply'](_0x26293b,_0x22b35b,!![]);}catch(_0x5d46e7){return BPromise[_0xb4fc('0x25')](_0x5d46e7);}return _0x26293b[_0xb4fc('0x26')]();};}function saveUpdates(_0x3488bd,_0x2319a8){return function(_0x46aae6){if(_0x46aae6){return _0x46aae6['update'](_0x3488bd)[_0xb4fc('0x27')](function(_0x47aa12){return _0x47aa12;});}return null;};}function removeEntity(_0x31b2b0,_0x1a5315){return function(_0x59747e){if(_0x59747e){return _0x59747e[_0xb4fc('0x28')]()[_0xb4fc('0x27')](function(){_0x31b2b0['status'](0xcc)[_0xb4fc('0x1d')]();});}};}function handleEntityNotFound(_0x2683ff,_0x50b5e0){return function(_0x481bb3){if(!_0x481bb3){_0x2683ff[_0xb4fc('0x29')](0x194);}return _0x481bb3;};}function handleError(_0xb8f598,_0x554e69){_0x554e69=_0x554e69||0x1f4;return function(_0x555640){logger[_0xb4fc('0x2a')](_0x555640[_0xb4fc('0x2b')]);if(_0x555640[_0xb4fc('0x2c')]){delete _0x555640['name'];}_0xb8f598['status'](_0x554e69)['send'](_0x555640);};}exports['index']=function(_0x5e9f84,_0x1b4965){var _0x418b37={},_0x47a138={},_0x436fde={'count':0x0,'rows':[]};var _0x5d6413=_[_0xb4fc('0x2d')](db[_0xb4fc('0x2e')]['rawAttributes'],function(_0x480d48){return{'name':_0x480d48[_0xb4fc('0x2f')],'type':_0x480d48['type']['key']};});_0x47a138[_0xb4fc('0x30')]=_[_0xb4fc('0x2d')](_0x5d6413,_0xb4fc('0x2c'));_0x47a138[_0xb4fc('0x31')]=_[_0xb4fc('0x32')](_0x5e9f84[_0xb4fc('0x31')]);_0x47a138[_0xb4fc('0x33')]=_[_0xb4fc('0x34')](_0x47a138[_0xb4fc('0x30')],_0x47a138['query']);_0x418b37[_0xb4fc('0x35')]=_['intersection'](_0x47a138[_0xb4fc('0x30')],qs[_0xb4fc('0x36')](_0x5e9f84[_0xb4fc('0x31')][_0xb4fc('0x36')]));_0x418b37[_0xb4fc('0x35')]=_0x418b37['attributes'][_0xb4fc('0x37')]?_0x418b37[_0xb4fc('0x35')]:_0x47a138['model'];if(!_0x5e9f84[_0xb4fc('0x31')]['hasOwnProperty'](_0xb4fc('0x38'))){_0x418b37['limit']=qs[_0xb4fc('0x22')](_0x5e9f84['query'][_0xb4fc('0x22')]);_0x418b37[_0xb4fc('0x21')]=qs[_0xb4fc('0x21')](_0x5e9f84[_0xb4fc('0x31')][_0xb4fc('0x21')]);}_0x418b37['order']=qs[_0xb4fc('0x39')](_0x5e9f84[_0xb4fc('0x31')]['sort']);_0x418b37[_0xb4fc('0x3a')]=qs[_0xb4fc('0x33')](_[_0xb4fc('0x3b')](_0x5e9f84[_0xb4fc('0x31')],_0x47a138[_0xb4fc('0x33')]),_0x5d6413);if(_0x5e9f84[_0xb4fc('0x31')][_0xb4fc('0x3c')]){_0x418b37[_0xb4fc('0x3a')]=_[_0xb4fc('0x3d')](_0x418b37[_0xb4fc('0x3a')],{'$or':_[_0xb4fc('0x2d')](_0x5d6413,function(_0x48e4f7){if(_0x48e4f7[_0xb4fc('0x3e')]!==_0xb4fc('0x3f')){var _0x36287b={};_0x36287b[_0x48e4f7['name']]={'$like':'%'+_0x5e9f84[_0xb4fc('0x31')][_0xb4fc('0x3c')]+'%'};return _0x36287b;}})});}_0x418b37=_[_0xb4fc('0x3d')]({},_0x418b37,_0x5e9f84[_0xb4fc('0x40')]);var _0x3cfbd3={'where':_0x418b37[_0xb4fc('0x3a')]};return db['MailSubstatus'][_0xb4fc('0x20')](_0x3cfbd3)['then'](function(_0x1e3098){_0x436fde[_0xb4fc('0x20')]=_0x1e3098;if(_0x5e9f84[_0xb4fc('0x31')][_0xb4fc('0x41')]){_0x418b37[_0xb4fc('0x42')]=[{'all':!![]}];}return db[_0xb4fc('0x2e')][_0xb4fc('0x43')](_0x418b37);})[_0xb4fc('0x27')](function(_0x5fe403){_0x436fde[_0xb4fc('0x44')]=_0x5fe403;return _0x436fde;})[_0xb4fc('0x27')](respondWithFilteredResult(_0x1b4965,_0x418b37))[_0xb4fc('0x45')](handleError(_0x1b4965,null));};exports['show']=function(_0x16fbe7,_0x152c96){var _0x2cd3c6={'raw':!![],'where':{'id':_0x16fbe7[_0xb4fc('0x46')]['id']}},_0x4d1f42={};_0x4d1f42[_0xb4fc('0x30')]=_[_0xb4fc('0x32')](db['MailSubstatus'][_0xb4fc('0x47')]);_0x4d1f42[_0xb4fc('0x31')]=_[_0xb4fc('0x32')](_0x16fbe7[_0xb4fc('0x31')]);_0x4d1f42[_0xb4fc('0x33')]=_[_0xb4fc('0x34')](_0x4d1f42[_0xb4fc('0x30')],_0x4d1f42[_0xb4fc('0x31')]);_0x2cd3c6[_0xb4fc('0x35')]=_[_0xb4fc('0x34')](_0x4d1f42[_0xb4fc('0x30')],qs[_0xb4fc('0x36')](_0x16fbe7[_0xb4fc('0x31')][_0xb4fc('0x36')]));_0x2cd3c6['attributes']=_0x2cd3c6[_0xb4fc('0x35')][_0xb4fc('0x37')]?_0x2cd3c6['attributes']:_0x4d1f42[_0xb4fc('0x30')];if(_0x16fbe7['query']['includeAll']){_0x2cd3c6[_0xb4fc('0x42')]=[{'all':!![]}];}_0x2cd3c6=_[_0xb4fc('0x3d')]({},_0x2cd3c6,_0x16fbe7[_0xb4fc('0x40')]);return db['MailSubstatus'][_0xb4fc('0x48')](_0x2cd3c6)[_0xb4fc('0x27')](handleEntityNotFound(_0x152c96,null))[_0xb4fc('0x27')](respondWithResult(_0x152c96,null))[_0xb4fc('0x45')](handleError(_0x152c96,null));};exports[_0xb4fc('0x49')]=function(_0x11d420,_0x12f5a1){return db[_0xb4fc('0x2e')][_0xb4fc('0x49')](_0x11d420[_0xb4fc('0x4a')],{})[_0xb4fc('0x27')](respondWithResult(_0x12f5a1,0xc9))[_0xb4fc('0x45')](handleError(_0x12f5a1,null));};exports['update']=function(_0x7586d8,_0x568ac9){if(_0x7586d8['body']['id']){delete _0x7586d8[_0xb4fc('0x4a')]['id'];}return db[_0xb4fc('0x2e')][_0xb4fc('0x48')]({'where':{'id':_0x7586d8[_0xb4fc('0x46')]['id']}})[_0xb4fc('0x27')](handleEntityNotFound(_0x568ac9,null))[_0xb4fc('0x27')](saveUpdates(_0x7586d8[_0xb4fc('0x4a')],null))[_0xb4fc('0x27')](respondWithResult(_0x568ac9,null))[_0xb4fc('0x45')](handleError(_0x568ac9,null));};exports[_0xb4fc('0x28')]=function(_0x520900,_0x5b9633){return db[_0xb4fc('0x2e')][_0xb4fc('0x48')]({'where':{'id':_0x520900[_0xb4fc('0x46')]['id']}})[_0xb4fc('0x27')](handleEntityNotFound(_0x5b9633,null))['then'](removeEntity(_0x5b9633,null))[_0xb4fc('0x45')](handleError(_0x5b9633,null));};exports[_0xb4fc('0x4b')]=function(_0x31b9ab,_0x21dc92){return db[_0xb4fc('0x2e')][_0xb4fc('0x4b')]()[_0xb4fc('0x27')](respondWithResult(_0x21dc92,null))[_0xb4fc('0x45')](handleError(_0x21dc92,null));}; \ No newline at end of file +var _0x735f=['sort','pick','where','type','VIRTUAL','name','filter','options','then','count','includeAll','include','findAll','show','params','keys','model','merge','catch','body','find','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','Content-Range','apply','reject','save','update','destroy','stack','send','index','map','MailSubstatus','rawAttributes','fieldName','key','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order'];(function(_0x407f67,_0x233fab){var _0xdece37=function(_0x11a50a){while(--_0x11a50a){_0x407f67['push'](_0x407f67['shift']());}};_0xdece37(++_0x233fab);}(_0x735f,0x18d));var _0xf735=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x735f[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf735('0x0'));var jsonpatch=require(_0xf735('0x1'));var rp=require(_0xf735('0x2'));var moment=require('moment');var BPromise=require(_0xf735('0x3'));var Mustache=require(_0xf735('0x4'));var util=require(_0xf735('0x5'));var path=require(_0xf735('0x6'));var sox=require(_0xf735('0x7'));var csv=require(_0xf735('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf735('0x9'));var squel=require(_0xf735('0xa'));var crypto=require(_0xf735('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf735('0xc'));var toCsv=require(_0xf735('0x8'));var querystring=require(_0xf735('0xd'));var Papa=require(_0xf735('0xe'));var Redis=require(_0xf735('0xf'));var authService=require(_0xf735('0x10'));var qs=require(_0xf735('0x11'));var as=require(_0xf735('0x12'));var hardwareService=require(_0xf735('0x13'));var logger=require(_0xf735('0x14'))(_0xf735('0x15'));var utils=require(_0xf735('0x16'));var config=require(_0xf735('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf735('0x18'))['db'];function respondWithStatusCode(_0x2b798f,_0x3daa3b){_0x3daa3b=_0x3daa3b||0xcc;return function(_0x14bf43){if(_0x14bf43){return _0x2b798f[_0xf735('0x19')](_0x3daa3b);}return _0x2b798f['status'](_0x3daa3b)[_0xf735('0x1a')]();};}function respondWithResult(_0x1bc09a,_0x27cf51){_0x27cf51=_0x27cf51||0xc8;return function(_0x58d64f){if(_0x58d64f){return _0x1bc09a[_0xf735('0x1b')](_0x27cf51)[_0xf735('0x1c')](_0x58d64f);}};}function respondWithFilteredResult(_0x1ef353,_0x187626){return function(_0x2db4e5){if(_0x2db4e5){var _0x5394ce=_0x2db4e5['count'],_0x3fa11d=_0x187626[_0xf735('0x1d')],_0x49b23b=_0x187626[_0xf735('0x1d')]+_0x187626['limit'],_0x41397f;if(_0x49b23b>=_0x5394ce){_0x49b23b=_0x5394ce;_0x41397f=0xc8;}else{_0x41397f=0xce;}_0x1ef353[_0xf735('0x1b')](_0x41397f);return _0x1ef353['set'](_0xf735('0x1e'),_0x3fa11d+'-'+_0x49b23b+'/'+_0x5394ce)[_0xf735('0x1c')](_0x2db4e5);}return null;};}function patchUpdates(_0x5d9ed7){return function(_0x3c196d){try{jsonpatch[_0xf735('0x1f')](_0x3c196d,_0x5d9ed7,!![]);}catch(_0x5677a5){return BPromise[_0xf735('0x20')](_0x5677a5);}return _0x3c196d[_0xf735('0x21')]();};}function saveUpdates(_0x394c16,_0x129cc8){return function(_0x2f4483){if(_0x2f4483){return _0x2f4483[_0xf735('0x22')](_0x394c16)['then'](function(_0x5abe06){return _0x5abe06;});}return null;};}function removeEntity(_0x55ed81,_0x1ec1b){return function(_0x22629c){if(_0x22629c){return _0x22629c[_0xf735('0x23')]()['then'](function(){_0x55ed81['status'](0xcc)[_0xf735('0x1a')]();});}};}function handleEntityNotFound(_0x2a1a1a,_0x3c8500){return function(_0xf8fd56){if(!_0xf8fd56){_0x2a1a1a[_0xf735('0x19')](0x194);}return _0xf8fd56;};}function handleError(_0x135444,_0x43b11b){_0x43b11b=_0x43b11b||0x1f4;return function(_0x454df0){logger['error'](_0x454df0[_0xf735('0x24')]);if(_0x454df0['name']){delete _0x454df0['name'];}_0x135444[_0xf735('0x1b')](_0x43b11b)[_0xf735('0x25')](_0x454df0);};}exports[_0xf735('0x26')]=function(_0x44cb73,_0x181edb){var _0x55b106={},_0x4ea288={},_0x5dfca0={'count':0x0,'rows':[]};var _0x3deb3f=_[_0xf735('0x27')](db[_0xf735('0x28')][_0xf735('0x29')],function(_0x1c2aca){return{'name':_0x1c2aca[_0xf735('0x2a')],'type':_0x1c2aca['type'][_0xf735('0x2b')]};});_0x4ea288['model']=_[_0xf735('0x27')](_0x3deb3f,'name');_0x4ea288['query']=_['keys'](_0x44cb73[_0xf735('0x2c')]);_0x4ea288[_0xf735('0x2d')]=_[_0xf735('0x2e')](_0x4ea288['model'],_0x4ea288['query']);_0x55b106[_0xf735('0x2f')]=_['intersection'](_0x4ea288['model'],qs['fields'](_0x44cb73['query'][_0xf735('0x30')]));_0x55b106[_0xf735('0x2f')]=_0x55b106[_0xf735('0x2f')][_0xf735('0x31')]?_0x55b106[_0xf735('0x2f')]:_0x4ea288['model'];if(!_0x44cb73[_0xf735('0x2c')][_0xf735('0x32')]('nolimit')){_0x55b106[_0xf735('0x33')]=qs[_0xf735('0x33')](_0x44cb73[_0xf735('0x2c')][_0xf735('0x33')]);_0x55b106[_0xf735('0x1d')]=qs[_0xf735('0x1d')](_0x44cb73['query'][_0xf735('0x1d')]);}_0x55b106[_0xf735('0x34')]=qs[_0xf735('0x35')](_0x44cb73[_0xf735('0x2c')]['sort']);_0x55b106['where']=qs[_0xf735('0x2d')](_[_0xf735('0x36')](_0x44cb73[_0xf735('0x2c')],_0x4ea288[_0xf735('0x2d')]),_0x3deb3f);if(_0x44cb73[_0xf735('0x2c')]['filter']){_0x55b106[_0xf735('0x37')]=_['merge'](_0x55b106[_0xf735('0x37')],{'$or':_['map'](_0x3deb3f,function(_0x8500b5){if(_0x8500b5[_0xf735('0x38')]!==_0xf735('0x39')){var _0x4c5973={};_0x4c5973[_0x8500b5[_0xf735('0x3a')]]={'$like':'%'+_0x44cb73[_0xf735('0x2c')][_0xf735('0x3b')]+'%'};return _0x4c5973;}})});}_0x55b106=_['merge']({},_0x55b106,_0x44cb73[_0xf735('0x3c')]);var _0x2feaf2={'where':_0x55b106[_0xf735('0x37')]};return db[_0xf735('0x28')]['count'](_0x2feaf2)[_0xf735('0x3d')](function(_0x5a6fe1){_0x5dfca0[_0xf735('0x3e')]=_0x5a6fe1;if(_0x44cb73[_0xf735('0x2c')][_0xf735('0x3f')]){_0x55b106[_0xf735('0x40')]=[{'all':!![]}];}return db[_0xf735('0x28')][_0xf735('0x41')](_0x55b106);})['then'](function(_0x1d632e){_0x5dfca0['rows']=_0x1d632e;return _0x5dfca0;})[_0xf735('0x3d')](respondWithFilteredResult(_0x181edb,_0x55b106))['catch'](handleError(_0x181edb,null));};exports[_0xf735('0x42')]=function(_0x983f59,_0x82b8d1){var _0x3c7ee7={'raw':!![],'where':{'id':_0x983f59[_0xf735('0x43')]['id']}},_0x734472={};_0x734472['model']=_[_0xf735('0x44')](db[_0xf735('0x28')][_0xf735('0x29')]);_0x734472['query']=_[_0xf735('0x44')](_0x983f59[_0xf735('0x2c')]);_0x734472[_0xf735('0x2d')]=_[_0xf735('0x2e')](_0x734472[_0xf735('0x45')],_0x734472[_0xf735('0x2c')]);_0x3c7ee7[_0xf735('0x2f')]=_[_0xf735('0x2e')](_0x734472[_0xf735('0x45')],qs[_0xf735('0x30')](_0x983f59[_0xf735('0x2c')][_0xf735('0x30')]));_0x3c7ee7[_0xf735('0x2f')]=_0x3c7ee7[_0xf735('0x2f')]['length']?_0x3c7ee7[_0xf735('0x2f')]:_0x734472[_0xf735('0x45')];if(_0x983f59['query'][_0xf735('0x3f')]){_0x3c7ee7[_0xf735('0x40')]=[{'all':!![]}];}_0x3c7ee7=_[_0xf735('0x46')]({},_0x3c7ee7,_0x983f59[_0xf735('0x3c')]);return db[_0xf735('0x28')]['find'](_0x3c7ee7)[_0xf735('0x3d')](handleEntityNotFound(_0x82b8d1,null))['then'](respondWithResult(_0x82b8d1,null))[_0xf735('0x47')](handleError(_0x82b8d1,null));};exports['create']=function(_0x1be1a9,_0x134ff7){return db[_0xf735('0x28')]['create'](_0x1be1a9[_0xf735('0x48')],{})['then'](respondWithResult(_0x134ff7,0xc9))[_0xf735('0x47')](handleError(_0x134ff7,null));};exports[_0xf735('0x22')]=function(_0x135078,_0x2a04cb){if(_0x135078['body']['id']){delete _0x135078[_0xf735('0x48')]['id'];}return db[_0xf735('0x28')]['find']({'where':{'id':_0x135078[_0xf735('0x43')]['id']}})[_0xf735('0x3d')](handleEntityNotFound(_0x2a04cb,null))[_0xf735('0x3d')](saveUpdates(_0x135078['body'],null))[_0xf735('0x3d')](respondWithResult(_0x2a04cb,null))['catch'](handleError(_0x2a04cb,null));};exports[_0xf735('0x23')]=function(_0x5c564d,_0x1332df){return db['MailSubstatus'][_0xf735('0x49')]({'where':{'id':_0x5c564d[_0xf735('0x43')]['id']}})[_0xf735('0x3d')](handleEntityNotFound(_0x1332df,null))['then'](removeEntity(_0x1332df,null))[_0xf735('0x47')](handleError(_0x1332df,null));};exports[_0xf735('0x4a')]=function(_0x124cfe,_0x1fd260){return db[_0xf735('0x28')][_0xf735('0x4a')]()[_0xf735('0x3d')](respondWithResult(_0x1fd260,null))['catch'](handleError(_0x1fd260,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index de85c42..b69eed7 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 _0xd0e4=['rimraf','../../config/environment','./mailSubstatus.attributes','define','MailSubstatus','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x1b07c0,_0x2a7322){var _0xe57578=function(_0x37fc87){while(--_0x37fc87){_0x1b07c0['push'](_0x1b07c0['shift']());}};_0xe57578(++_0x2a7322);}(_0xd0e4,0x1d3));var _0x4d0e=function(_0x1698f6,_0x441e4b){_0x1698f6=_0x1698f6-0x0;var _0x11d58f=_0xd0e4[_0x1698f6];return _0x11d58f;};'use strict';var _=require(_0x4d0e('0x0'));var util=require(_0x4d0e('0x1'));var logger=require(_0x4d0e('0x2'))(_0x4d0e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4d0e('0x4'));var fs=require('fs');var path=require(_0x4d0e('0x5'));var rimraf=require(_0x4d0e('0x6'));var config=require(_0x4d0e('0x7'));var attributes=require(_0x4d0e('0x8'));module['exports']=function(_0x588895,_0x5be772){return _0x588895[_0x4d0e('0x9')](_0x4d0e('0xa'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1d7=['MailSubstatus','mail_substatuses','util','bluebird','request-promise','path','../../config/environment','./mailSubstatus.attributes','exports'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xe1d7,0x1a9));var _0x7e1d=function(_0x6dd5c,_0x4bfc19){_0x6dd5c=_0x6dd5c-0x0;var _0x5a87fa=_0xe1d7[_0x6dd5c];return _0x5a87fa;};'use strict';var _=require('lodash');var util=require(_0x7e1d('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7e1d('0x1'));var rp=require(_0x7e1d('0x2'));var fs=require('fs');var path=require(_0x7e1d('0x3'));var rimraf=require('rimraf');var config=require(_0x7e1d('0x4'));var attributes=require(_0x7e1d('0x5'));module[_0x7e1d('0x6')]=function(_0x4e9e2d,_0x467d6e){return _0x4e9e2d['define'](_0x7e1d('0x7'),attributes,{'tableName':_0x7e1d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 378155a..d8f713f 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 _0xf3cd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','result'];(function(_0x186e7c,_0x542c10){var _0x1715e3=function(_0x165e08){while(--_0x165e08){_0x186e7c['push'](_0x186e7c['shift']());}};_0x1715e3(++_0x542c10);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x556a99,_0x3d0574){_0x556a99=_0x556a99-0x0;var _0x45a65a=_0xf3cd[_0x556a99];return _0x45a65a;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','MailSubstatus,\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','MailSubstatus,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x448747,_0x52303a){_0x448747=_0x448747-0x0;var _0x34b9f4=_0xbdb7[_0x448747];return _0x34b9f4;};'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 diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index cf8168d..f1dc91c 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 _0xbfec=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0xbfec,0xf7));var _0xcbfe=function(_0x2e44d9,_0x47ecdb){_0x2e44d9=_0x2e44d9-0x0;var _0x3ddf6b=_0xbfec[_0x2e44d9];return _0x3ddf6b;};'use strict';var multer=require(_0xcbfe('0x0'));var util=require(_0xcbfe('0x1'));var path=require(_0xcbfe('0x2'));var timeout=require(_0xcbfe('0x3'));var express=require('express');var router=express[_0xcbfe('0x4')]();var auth=require(_0xcbfe('0x5'));var interaction=require(_0xcbfe('0x6'));var config=require(_0xcbfe('0x7'));var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0xcbfe('0x8')](),controller['index']);router[_0xcbfe('0x9')](_0xcbfe('0xa'),auth[_0xcbfe('0x8')](),controller[_0xcbfe('0xb')]);router[_0xcbfe('0x9')](_0xcbfe('0xc'),auth[_0xcbfe('0x8')](),controller[_0xcbfe('0xd')]);router[_0xcbfe('0xe')]('/',auth[_0xcbfe('0x8')](),controller[_0xcbfe('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xcbfe('0x10')]);router[_0xcbfe('0x11')](_0xcbfe('0xc'),auth[_0xcbfe('0x8')](),controller[_0xcbfe('0x12')]);module[_0xcbfe('0x13')]=router; \ No newline at end of file +var _0xd1a1=['connect-timeout','Router','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd1a1,0x1cb));var _0x1d1a=function(_0x22966a,_0x47ad43){_0x22966a=_0x22966a-0x0;var _0x36ae56=_0xd1a1[_0x22966a];return _0x36ae56;};'use strict';var multer=require(_0x1d1a('0x0'));var util=require(_0x1d1a('0x1'));var path=require(_0x1d1a('0x2'));var timeout=require(_0x1d1a('0x3'));var express=require('express');var router=express[_0x1d1a('0x4')]();var auth=require(_0x1d1a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1d1a('0x6'));var controller=require(_0x1d1a('0x7'));router[_0x1d1a('0x8')]('/',auth[_0x1d1a('0x9')](),controller[_0x1d1a('0xa')]);router[_0x1d1a('0x8')](_0x1d1a('0xb'),auth[_0x1d1a('0x9')](),controller['describe']);router[_0x1d1a('0x8')](_0x1d1a('0xc'),auth[_0x1d1a('0x9')](),controller[_0x1d1a('0xd')]);router[_0x1d1a('0xe')]('/',auth[_0x1d1a('0x9')](),controller[_0x1d1a('0xf')]);router[_0x1d1a('0x10')](_0x1d1a('0xc'),auth['isAuthenticated'](),controller[_0x1d1a('0x11')]);router[_0x1d1a('0x12')](_0x1d1a('0xc'),auth['isAuthenticated'](),controller[_0x1d1a('0x13')]);module[_0x1d1a('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index a6400cd..9b994d6 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 _0xcefc=['STRING','ENUM','queue'];(function(_0x3a8b9e,_0x2ca964){var _0x135d31=function(_0x16fc8a){while(--_0x16fc8a){_0x3a8b9e['push'](_0x3a8b9e['shift']());}};_0x135d31(++_0x2ca964);}(_0xcefc,0x1e3));var _0xccef=function(_0x1c48d5,_0x2d2d93){_0x1c48d5=_0x1c48d5-0x0;var _0x2799d8=_0xcefc[_0x1c48d5];return _0x2799d8;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xccef('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xccef('0x1')]('account','agent',_0xccef('0x2')),'allowNull':![],'defaultValue':_0xccef('0x2')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x7715=['STRING','ENUM','agent','queue','moment','sequelize'];(function(_0x43caa2,_0x1ffb73){var _0x51b342=function(_0x288f85){while(--_0x288f85){_0x43caa2['push'](_0x43caa2['shift']());}};_0x51b342(++_0x1ffb73);}(_0x7715,0x196));var _0x5771=function(_0x200a95,_0x2de25d){_0x200a95=_0x200a95-0x0;var _0x1a01d6=_0x7715[_0x200a95];return _0x1a01d6;};'use strict';var moment=require(_0x5771('0x0'));var Sequelize=require(_0x5771('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x5771('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5771('0x3')]('account',_0x5771('0x4'),_0x5771('0x5')),'allowNull':![],'defaultValue':_0x5771('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 72d03a9..60f6447 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 _0xff7c=['../../config/environment','sendStatus','end','status','count','json','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','MailTransferReport','include','findAll','params','keys','includeAll','catch','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x55c7c9,_0x2e6869){var _0x1fd795=function(_0x5b5d29){while(--_0x5b5d29){_0x55c7c9['push'](_0x55c7c9['shift']());}};_0x1fd795(++_0x2e6869);}(_0xff7c,0x1d4));var _0xcff7=function(_0x273dc5,_0x268a81){_0x273dc5=_0x273dc5-0x0;var _0x46dae7=_0xff7c[_0x273dc5];return _0x46dae7;};'use strict';var pdf=require(_0xcff7('0x0'));var emlformat=require(_0xcff7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xcff7('0x2'));var jsonpatch=require(_0xcff7('0x3'));var rp=require(_0xcff7('0x4'));var moment=require(_0xcff7('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcff7('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xcff7('0x7'));var ejs=require(_0xcff7('0x8'));var fs=require('fs');var _=require(_0xcff7('0x9'));var squel=require(_0xcff7('0xa'));var crypto=require(_0xcff7('0xb'));var jsforce=require(_0xcff7('0xc'));var deskjs=require(_0xcff7('0xd'));var toCsv=require('to-csv');var querystring=require(_0xcff7('0xe'));var Papa=require(_0xcff7('0xf'));var Redis=require(_0xcff7('0x10'));var authService=require(_0xcff7('0x11'));var qs=require(_0xcff7('0x12'));var as=require(_0xcff7('0x13'));var hardwareService=require(_0xcff7('0x14'));var logger=require(_0xcff7('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xcff7('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17f817,_0x2b0a3c){_0x2b0a3c=_0x2b0a3c||0xcc;return function(_0x1f5e0a){if(_0x1f5e0a){return _0x17f817[_0xcff7('0x17')](_0x2b0a3c);}return _0x17f817['status'](_0x2b0a3c)[_0xcff7('0x18')]();};}function respondWithResult(_0x4882ec,_0x15b8d2){_0x15b8d2=_0x15b8d2||0xc8;return function(_0xf10efd){if(_0xf10efd){return _0x4882ec[_0xcff7('0x19')](_0x15b8d2)['json'](_0xf10efd);}};}function respondWithFilteredResult(_0x3723ef,_0x38d69d){return function(_0x53679e){if(_0x53679e){var _0x4e1df5=_0x53679e[_0xcff7('0x1a')],_0x41f3ed=_0x38d69d['offset'],_0x1b7010=_0x38d69d['offset']+_0x38d69d['limit'],_0x24b0a5;if(_0x1b7010>=_0x4e1df5){_0x1b7010=_0x4e1df5;_0x24b0a5=0xc8;}else{_0x24b0a5=0xce;}_0x3723ef[_0xcff7('0x19')](_0x24b0a5);return _0x3723ef['set']('Content-Range',_0x41f3ed+'-'+_0x1b7010+'/'+_0x4e1df5)[_0xcff7('0x1b')](_0x53679e);}return null;};}function patchUpdates(_0x235f77){return function(_0x18e3cd){try{jsonpatch[_0xcff7('0x1c')](_0x18e3cd,_0x235f77,!![]);}catch(_0x533779){return BPromise[_0xcff7('0x1d')](_0x533779);}return _0x18e3cd[_0xcff7('0x1e')]();};}function saveUpdates(_0x36d156,_0x5d030e){return function(_0x2880e7){if(_0x2880e7){return _0x2880e7[_0xcff7('0x1f')](_0x36d156)[_0xcff7('0x20')](function(_0x5194db){return _0x5194db;});}return null;};}function removeEntity(_0x164d3c,_0x433793){return function(_0x555e6e){if(_0x555e6e){return _0x555e6e[_0xcff7('0x21')]()['then'](function(){_0x164d3c[_0xcff7('0x19')](0xcc)[_0xcff7('0x18')]();});}};}function handleEntityNotFound(_0x23ecfe,_0x2968c6){return function(_0x8beaa8){if(!_0x8beaa8){_0x23ecfe[_0xcff7('0x17')](0x194);}return _0x8beaa8;};}function handleError(_0x3fbb6e,_0x2e858c){_0x2e858c=_0x2e858c||0x1f4;return function(_0x15ff5d){logger[_0xcff7('0x22')](_0x15ff5d['stack']);if(_0x15ff5d[_0xcff7('0x23')]){delete _0x15ff5d[_0xcff7('0x23')];}_0x3fbb6e[_0xcff7('0x19')](_0x2e858c)[_0xcff7('0x24')](_0x15ff5d);};}exports[_0xcff7('0x25')]=function(_0x5c828d,_0x276069){var _0x372936={},_0x3ed713={},_0x58379e={'count':0x0,'rows':[]};var _0x4487b5=_[_0xcff7('0x26')](db['MailTransferReport'][_0xcff7('0x27')],function(_0x736877){return{'name':_0x736877['fieldName'],'type':_0x736877[_0xcff7('0x28')]['key']};});_0x3ed713[_0xcff7('0x29')]=_[_0xcff7('0x26')](_0x4487b5,'name');_0x3ed713[_0xcff7('0x2a')]=_['keys'](_0x5c828d['query']);_0x3ed713[_0xcff7('0x2b')]=_[_0xcff7('0x2c')](_0x3ed713['model'],_0x3ed713['query']);_0x372936[_0xcff7('0x2d')]=_['intersection'](_0x3ed713[_0xcff7('0x29')],qs[_0xcff7('0x2e')](_0x5c828d['query']['fields']));_0x372936[_0xcff7('0x2d')]=_0x372936[_0xcff7('0x2d')][_0xcff7('0x2f')]?_0x372936[_0xcff7('0x2d')]:_0x3ed713[_0xcff7('0x29')];if(!_0x5c828d['query'][_0xcff7('0x30')]('nolimit')){_0x372936[_0xcff7('0x31')]=qs[_0xcff7('0x31')](_0x5c828d['query']['limit']);_0x372936[_0xcff7('0x32')]=qs[_0xcff7('0x32')](_0x5c828d[_0xcff7('0x2a')][_0xcff7('0x32')]);}_0x372936[_0xcff7('0x33')]=qs[_0xcff7('0x34')](_0x5c828d[_0xcff7('0x2a')][_0xcff7('0x34')]);_0x372936[_0xcff7('0x35')]=qs[_0xcff7('0x2b')](_[_0xcff7('0x36')](_0x5c828d['query'],_0x3ed713['filters']),_0x4487b5);if(_0x5c828d[_0xcff7('0x2a')][_0xcff7('0x37')]){_0x372936['where']=_[_0xcff7('0x38')](_0x372936[_0xcff7('0x35')],{'$or':_['map'](_0x4487b5,function(_0x3b58ce){if(_0x3b58ce[_0xcff7('0x28')]!==_0xcff7('0x39')){var _0x312257={};_0x312257[_0x3b58ce[_0xcff7('0x23')]]={'$like':'%'+_0x5c828d[_0xcff7('0x2a')][_0xcff7('0x37')]+'%'};return _0x312257;}})});}_0x372936=_[_0xcff7('0x38')]({},_0x372936,_0x5c828d[_0xcff7('0x3a')]);var _0x9d6bd1={'where':_0x372936[_0xcff7('0x35')]};return db[_0xcff7('0x3b')]['count'](_0x9d6bd1)[_0xcff7('0x20')](function(_0x4b60e2){_0x58379e[_0xcff7('0x1a')]=_0x4b60e2;if(_0x5c828d[_0xcff7('0x2a')]['includeAll']){_0x372936[_0xcff7('0x3c')]=[{'all':!![]}];}return db[_0xcff7('0x3b')][_0xcff7('0x3d')](_0x372936);})[_0xcff7('0x20')](function(_0xa3e0a6){_0x58379e['rows']=_0xa3e0a6;return _0x58379e;})[_0xcff7('0x20')](respondWithFilteredResult(_0x276069,_0x372936))['catch'](handleError(_0x276069,null));};exports['show']=function(_0x443785,_0x2ece6d){var _0x4321ec={'raw':!![],'where':{'id':_0x443785[_0xcff7('0x3e')]['id']}},_0x4ca3b7={};_0x4ca3b7[_0xcff7('0x29')]=_['keys'](db[_0xcff7('0x3b')][_0xcff7('0x27')]);_0x4ca3b7[_0xcff7('0x2a')]=_[_0xcff7('0x3f')](_0x443785['query']);_0x4ca3b7[_0xcff7('0x2b')]=_[_0xcff7('0x2c')](_0x4ca3b7[_0xcff7('0x29')],_0x4ca3b7[_0xcff7('0x2a')]);_0x4321ec[_0xcff7('0x2d')]=_[_0xcff7('0x2c')](_0x4ca3b7['model'],qs[_0xcff7('0x2e')](_0x443785[_0xcff7('0x2a')][_0xcff7('0x2e')]));_0x4321ec['attributes']=_0x4321ec[_0xcff7('0x2d')][_0xcff7('0x2f')]?_0x4321ec['attributes']:_0x4ca3b7[_0xcff7('0x29')];if(_0x443785['query'][_0xcff7('0x40')]){_0x4321ec['include']=[{'all':!![]}];}_0x4321ec=_[_0xcff7('0x38')]({},_0x4321ec,_0x443785[_0xcff7('0x3a')]);return db['MailTransferReport']['find'](_0x4321ec)['then'](handleEntityNotFound(_0x2ece6d,null))['then'](respondWithResult(_0x2ece6d,null))[_0xcff7('0x41')](handleError(_0x2ece6d,null));};exports[_0xcff7('0x42')]=function(_0x818e98,_0x4f7a83){return db[_0xcff7('0x3b')]['create'](_0x818e98[_0xcff7('0x43')],{})['then'](respondWithResult(_0x4f7a83,0xc9))[_0xcff7('0x41')](handleError(_0x4f7a83,null));};exports[_0xcff7('0x1f')]=function(_0x361658,_0x555580){if(_0x361658[_0xcff7('0x43')]['id']){delete _0x361658[_0xcff7('0x43')]['id'];}return db[_0xcff7('0x3b')][_0xcff7('0x44')]({'where':{'id':_0x361658[_0xcff7('0x3e')]['id']}})[_0xcff7('0x20')](handleEntityNotFound(_0x555580,null))[_0xcff7('0x20')](saveUpdates(_0x361658[_0xcff7('0x43')],null))[_0xcff7('0x20')](respondWithResult(_0x555580,null))[_0xcff7('0x41')](handleError(_0x555580,null));};exports[_0xcff7('0x21')]=function(_0x153e75,_0x882b1f){return db[_0xcff7('0x3b')][_0xcff7('0x44')]({'where':{'id':_0x153e75[_0xcff7('0x3e')]['id']}})[_0xcff7('0x20')](handleEntityNotFound(_0x882b1f,null))[_0xcff7('0x20')](removeEntity(_0x882b1f,null))[_0xcff7('0x41')](handleError(_0x882b1f,null));};exports[_0xcff7('0x45')]=function(_0x1af046,_0x233baf){return db[_0xcff7('0x3b')]['describe']()['then'](respondWithResult(_0x233baf,null))[_0xcff7('0x41')](handleError(_0x233baf,null));}; \ No newline at end of file +var _0xc782=['model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','pick','merge','options','includeAll','include','catch','show','params','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','update','then','destroy','stack','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xc782,0x130));var _0x2c78=function(_0x32986,_0x4489c8){_0x32986=_0x32986-0x0;var _0x355ebb=_0xc782[_0x32986];return _0x355ebb;};'use strict';var pdf=require(_0x2c78('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2c78('0x1'));var zipdir=require(_0x2c78('0x2'));var jsonpatch=require(_0x2c78('0x3'));var rp=require(_0x2c78('0x4'));var moment=require(_0x2c78('0x5'));var BPromise=require(_0x2c78('0x6'));var Mustache=require(_0x2c78('0x7'));var util=require(_0x2c78('0x8'));var path=require(_0x2c78('0x9'));var sox=require(_0x2c78('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2c78('0xb'));var squel=require(_0x2c78('0xc'));var crypto=require(_0x2c78('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2c78('0xe'));var toCsv=require(_0x2c78('0xf'));var querystring=require(_0x2c78('0x10'));var Papa=require('papaparse');var Redis=require(_0x2c78('0x11'));var authService=require(_0x2c78('0x12'));var qs=require(_0x2c78('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2c78('0x14'));var logger=require(_0x2c78('0x15'))(_0x2c78('0x16'));var utils=require(_0x2c78('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2c78('0x18'));var db=require(_0x2c78('0x19'))['db'];function respondWithStatusCode(_0xf40f13,_0x20ee2d){_0x20ee2d=_0x20ee2d||0xcc;return function(_0xd89665){if(_0xd89665){return _0xf40f13[_0x2c78('0x1a')](_0x20ee2d);}return _0xf40f13[_0x2c78('0x1b')](_0x20ee2d)[_0x2c78('0x1c')]();};}function respondWithResult(_0x51150c,_0x1c4537){_0x1c4537=_0x1c4537||0xc8;return function(_0x140cac){if(_0x140cac){return _0x51150c[_0x2c78('0x1b')](_0x1c4537)[_0x2c78('0x1d')](_0x140cac);}};}function respondWithFilteredResult(_0x3fde23,_0x1c82c3){return function(_0x56e918){if(_0x56e918){var _0x1d212f=_0x56e918[_0x2c78('0x1e')],_0x202491=_0x1c82c3[_0x2c78('0x1f')],_0x4922ce=_0x1c82c3[_0x2c78('0x1f')]+_0x1c82c3['limit'],_0x604df2;if(_0x4922ce>=_0x1d212f){_0x4922ce=_0x1d212f;_0x604df2=0xc8;}else{_0x604df2=0xce;}_0x3fde23[_0x2c78('0x1b')](_0x604df2);return _0x3fde23[_0x2c78('0x20')]('Content-Range',_0x202491+'-'+_0x4922ce+'/'+_0x1d212f)[_0x2c78('0x1d')](_0x56e918);}return null;};}function patchUpdates(_0x4b2f9c){return function(_0x38eff3){try{jsonpatch['apply'](_0x38eff3,_0x4b2f9c,!![]);}catch(_0x57dbdc){return BPromise[_0x2c78('0x21')](_0x57dbdc);}return _0x38eff3['save']();};}function saveUpdates(_0x5238b5,_0xad9cca){return function(_0x1d4b51){if(_0x1d4b51){return _0x1d4b51[_0x2c78('0x22')](_0x5238b5)[_0x2c78('0x23')](function(_0x2df4ff){return _0x2df4ff;});}return null;};}function removeEntity(_0x2138ef,_0x2f11e8){return function(_0x20a4e2){if(_0x20a4e2){return _0x20a4e2[_0x2c78('0x24')]()[_0x2c78('0x23')](function(){_0x2138ef[_0x2c78('0x1b')](0xcc)[_0x2c78('0x1c')]();});}};}function handleEntityNotFound(_0x403643,_0x2a3178){return function(_0x4ac452){if(!_0x4ac452){_0x403643[_0x2c78('0x1a')](0x194);}return _0x4ac452;};}function handleError(_0x58b223,_0xb184ad){_0xb184ad=_0xb184ad||0x1f4;return function(_0x5f3869){logger['error'](_0x5f3869[_0x2c78('0x25')]);if(_0x5f3869[_0x2c78('0x26')]){delete _0x5f3869['name'];}_0x58b223[_0x2c78('0x1b')](_0xb184ad)[_0x2c78('0x27')](_0x5f3869);};}exports[_0x2c78('0x28')]=function(_0x2fe934,_0xaba1b0){var _0x40df37={},_0x318570={},_0x4f073c={'count':0x0,'rows':[]};var _0xe1d136=_[_0x2c78('0x29')](db[_0x2c78('0x2a')][_0x2c78('0x2b')],function(_0x3a496a){return{'name':_0x3a496a[_0x2c78('0x2c')],'type':_0x3a496a[_0x2c78('0x2d')]['key']};});_0x318570[_0x2c78('0x2e')]=_['map'](_0xe1d136,_0x2c78('0x26'));_0x318570[_0x2c78('0x2f')]=_[_0x2c78('0x30')](_0x2fe934[_0x2c78('0x2f')]);_0x318570[_0x2c78('0x31')]=_['intersection'](_0x318570[_0x2c78('0x2e')],_0x318570[_0x2c78('0x2f')]);_0x40df37[_0x2c78('0x32')]=_[_0x2c78('0x33')](_0x318570[_0x2c78('0x2e')],qs['fields'](_0x2fe934[_0x2c78('0x2f')][_0x2c78('0x34')]));_0x40df37[_0x2c78('0x32')]=_0x40df37[_0x2c78('0x32')][_0x2c78('0x35')]?_0x40df37[_0x2c78('0x32')]:_0x318570[_0x2c78('0x2e')];if(!_0x2fe934[_0x2c78('0x2f')][_0x2c78('0x36')]('nolimit')){_0x40df37[_0x2c78('0x37')]=qs['limit'](_0x2fe934[_0x2c78('0x2f')][_0x2c78('0x37')]);_0x40df37[_0x2c78('0x1f')]=qs['offset'](_0x2fe934[_0x2c78('0x2f')][_0x2c78('0x1f')]);}_0x40df37['order']=qs[_0x2c78('0x38')](_0x2fe934['query'][_0x2c78('0x38')]);_0x40df37[_0x2c78('0x39')]=qs[_0x2c78('0x31')](_[_0x2c78('0x3a')](_0x2fe934[_0x2c78('0x2f')],_0x318570['filters']),_0xe1d136);if(_0x2fe934[_0x2c78('0x2f')]['filter']){_0x40df37[_0x2c78('0x39')]=_['merge'](_0x40df37[_0x2c78('0x39')],{'$or':_[_0x2c78('0x29')](_0xe1d136,function(_0x275d98){if(_0x275d98[_0x2c78('0x2d')]!=='VIRTUAL'){var _0x5b38d9={};_0x5b38d9[_0x275d98[_0x2c78('0x26')]]={'$like':'%'+_0x2fe934['query']['filter']+'%'};return _0x5b38d9;}})});}_0x40df37=_[_0x2c78('0x3b')]({},_0x40df37,_0x2fe934[_0x2c78('0x3c')]);var _0x847acc={'where':_0x40df37[_0x2c78('0x39')]};return db['MailTransferReport'][_0x2c78('0x1e')](_0x847acc)['then'](function(_0x3d6ec3){_0x4f073c[_0x2c78('0x1e')]=_0x3d6ec3;if(_0x2fe934['query'][_0x2c78('0x3d')]){_0x40df37[_0x2c78('0x3e')]=[{'all':!![]}];}return db['MailTransferReport']['findAll'](_0x40df37);})[_0x2c78('0x23')](function(_0x4e45c0){_0x4f073c['rows']=_0x4e45c0;return _0x4f073c;})[_0x2c78('0x23')](respondWithFilteredResult(_0xaba1b0,_0x40df37))[_0x2c78('0x3f')](handleError(_0xaba1b0,null));};exports[_0x2c78('0x40')]=function(_0x2cb779,_0x2112d8){var _0x9081a6={'raw':!![],'where':{'id':_0x2cb779[_0x2c78('0x41')]['id']}},_0x502a78={};_0x502a78[_0x2c78('0x2e')]=_['keys'](db['MailTransferReport'][_0x2c78('0x2b')]);_0x502a78['query']=_['keys'](_0x2cb779[_0x2c78('0x2f')]);_0x502a78[_0x2c78('0x31')]=_[_0x2c78('0x33')](_0x502a78['model'],_0x502a78[_0x2c78('0x2f')]);_0x9081a6[_0x2c78('0x32')]=_[_0x2c78('0x33')](_0x502a78['model'],qs[_0x2c78('0x34')](_0x2cb779['query'][_0x2c78('0x34')]));_0x9081a6[_0x2c78('0x32')]=_0x9081a6['attributes'][_0x2c78('0x35')]?_0x9081a6[_0x2c78('0x32')]:_0x502a78[_0x2c78('0x2e')];if(_0x2cb779[_0x2c78('0x2f')][_0x2c78('0x3d')]){_0x9081a6[_0x2c78('0x3e')]=[{'all':!![]}];}_0x9081a6=_[_0x2c78('0x3b')]({},_0x9081a6,_0x2cb779[_0x2c78('0x3c')]);return db[_0x2c78('0x2a')][_0x2c78('0x42')](_0x9081a6)['then'](handleEntityNotFound(_0x2112d8,null))[_0x2c78('0x23')](respondWithResult(_0x2112d8,null))[_0x2c78('0x3f')](handleError(_0x2112d8,null));};exports[_0x2c78('0x43')]=function(_0x3c9bba,_0x247a43){return db['MailTransferReport'][_0x2c78('0x43')](_0x3c9bba[_0x2c78('0x44')],{})[_0x2c78('0x23')](respondWithResult(_0x247a43,0xc9))['catch'](handleError(_0x247a43,null));};exports['update']=function(_0x5d214e,_0x5ecb90){if(_0x5d214e[_0x2c78('0x44')]['id']){delete _0x5d214e[_0x2c78('0x44')]['id'];}return db[_0x2c78('0x2a')][_0x2c78('0x42')]({'where':{'id':_0x5d214e[_0x2c78('0x41')]['id']}})[_0x2c78('0x23')](handleEntityNotFound(_0x5ecb90,null))[_0x2c78('0x23')](saveUpdates(_0x5d214e[_0x2c78('0x44')],null))[_0x2c78('0x23')](respondWithResult(_0x5ecb90,null))[_0x2c78('0x3f')](handleError(_0x5ecb90,null));};exports[_0x2c78('0x24')]=function(_0x3adc25,_0x1eee28){return db[_0x2c78('0x2a')]['find']({'where':{'id':_0x3adc25[_0x2c78('0x41')]['id']}})[_0x2c78('0x23')](handleEntityNotFound(_0x1eee28,null))[_0x2c78('0x23')](removeEntity(_0x1eee28,null))[_0x2c78('0x3f')](handleError(_0x1eee28,null));};exports['describe']=function(_0x5a54a8,_0x146d82){return db['MailTransferReport'][_0x2c78('0x45')]()['then'](respondWithResult(_0x146d82,null))[_0x2c78('0x3f')](handleError(_0x146d82,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 57eed31..506a438 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 _0x9003=['report_mail_transfer','uniqueid','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0xd299c3,_0x4ba0f1){var _0x376574=function(_0xc585f){while(--_0xc585f){_0xd299c3['push'](_0xd299c3['shift']());}};_0x376574(++_0x4ba0f1);}(_0x9003,0x92));var _0x3900=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9003[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x3900('0x0'));var logger=require('../../config/logger')(_0x3900('0x1'));var moment=require(_0x3900('0x2'));var BPromise=require(_0x3900('0x3'));var rp=require(_0x3900('0x4'));var fs=require('fs');var path=require(_0x3900('0x5'));var rimraf=require(_0x3900('0x6'));var config=require(_0x3900('0x7'));var attributes=require(_0x3900('0x8'));module[_0x3900('0x9')]=function(_0x194077,_0xfb9138){return _0x194077['define']('MailTransferReport',attributes,{'tableName':_0x3900('0xa'),'paranoid':![],'indexes':[{'name':_0x3900('0xb'),'fields':[_0x3900('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa7bd=['path','rimraf','../../config/environment','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3d095f,_0x2567d9){var _0x36fa9c=function(_0x34b2f2){while(--_0x34b2f2){_0x3d095f['push'](_0x3d095f['shift']());}};_0x36fa9c(++_0x2567d9);}(_0xa7bd,0x125));var _0xda7b=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0xa7bd[_0x1b70e3];return _0x1452ab;};'use strict';var _=require(_0xda7b('0x0'));var util=require(_0xda7b('0x1'));var logger=require(_0xda7b('0x2'))('api');var moment=require(_0xda7b('0x3'));var BPromise=require(_0xda7b('0x4'));var rp=require(_0xda7b('0x5'));var fs=require('fs');var path=require(_0xda7b('0x6'));var rimraf=require(_0xda7b('0x7'));var config=require(_0xda7b('0x8'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x1f1180,_0x5b5c52){return _0x1f1180[_0xda7b('0x9')](_0xda7b('0xa'),attributes,{'tableName':_0xda7b('0xb'),'paranoid':![],'indexes':[{'name':_0xda7b('0xc'),'fields':[_0xda7b('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 428ab5f..ad6de9b 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 _0x5f98=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2947f9,_0x3de637){var _0x3736b4=function(_0x2fbaa5){while(--_0x2fbaa5){_0x2947f9['push'](_0x2947f9['shift']());}};_0x3736b4(++_0x3de637);}(_0x5f98,0x152));var _0x85f9=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x5f98[_0x2763f2];return _0x3ef471;};'use strict';var _=require(_0x85f9('0x0'));var util=require(_0x85f9('0x1'));var moment=require(_0x85f9('0x2'));var BPromise=require(_0x85f9('0x3'));var rs=require(_0x85f9('0x4'));var fs=require('fs');var Redis=require(_0x85f9('0x5'));var db=require(_0x85f9('0x6'))['db'];var utils=require(_0x85f9('0x7'));var logger=require(_0x85f9('0x8'))(_0x85f9('0x9'));var config=require('../../config/environment');var jayson=require(_0x85f9('0xa'));var client=jayson[_0x85f9('0xb')][_0x85f9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x43d07a,_0x15d82a,_0x3e9d6f){return new BPromise(function(_0x295acd,_0x1fd3c4){return client['request'](_0x43d07a,_0x3e9d6f)[_0x85f9('0xd')](function(_0x5d0860){logger['info'](_0x85f9('0xe'),_0x15d82a,_0x85f9('0xf'));logger[_0x85f9('0x10')](_0x85f9('0x11'),_0x15d82a,'request\x20sent',JSON[_0x85f9('0x12')](_0x5d0860));if(_0x5d0860[_0x85f9('0x13')]){if(_0x5d0860[_0x85f9('0x13')]['code']===0x1f4){logger[_0x85f9('0x13')](_0x85f9('0xe'),_0x15d82a,_0x5d0860['error'][_0x85f9('0x14')]);return _0x1fd3c4(_0x5d0860[_0x85f9('0x13')][_0x85f9('0x14')]);}logger['error'](_0x85f9('0xe'),_0x15d82a,_0x5d0860['error']['message']);return _0x295acd(_0x5d0860['error'][_0x85f9('0x14')]);}else{logger['info'](_0x85f9('0xe'),_0x15d82a,'request\x20sent');_0x295acd(_0x5d0860[_0x85f9('0x15')][_0x85f9('0x14')]);}})[_0x85f9('0x16')](function(_0x5df98e){logger[_0x85f9('0x13')](_0x85f9('0xe'),_0x15d82a,_0x5df98e);_0x1fd3c4(_0x5df98e);});});} \ No newline at end of file +var _0x489e=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','bluebird'];(function(_0x3a5529,_0x43eeef){var _0x4ecec4=function(_0x30c3b7){while(--_0x30c3b7){_0x3a5529['push'](_0x3a5529['shift']());}};_0x4ecec4(++_0x43eeef);}(_0x489e,0xae));var _0xe489=function(_0x3acf1f,_0x1df1cb){_0x3acf1f=_0x3acf1f-0x0;var _0x593d3e=_0x489e[_0x3acf1f];return _0x593d3e;};'use strict';var _=require('lodash');var util=require(_0xe489('0x0'));var moment=require('moment');var BPromise=require(_0xe489('0x1'));var rs=require(_0xe489('0x2'));var fs=require('fs');var Redis=require(_0xe489('0x3'));var db=require(_0xe489('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe489('0x5'))(_0xe489('0x6'));var config=require('../../config/environment');var jayson=require(_0xe489('0x7'));var client=jayson[_0xe489('0x8')][_0xe489('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc709f2,_0x51b4b8,_0x29c609){return new BPromise(function(_0x3143d5,_0x349888){return client[_0xe489('0xa')](_0xc709f2,_0x29c609)[_0xe489('0xb')](function(_0x460b12){logger[_0xe489('0xc')](_0xe489('0xd'),_0x51b4b8,'request\x20sent');logger[_0xe489('0xe')](_0xe489('0xf'),_0x51b4b8,_0xe489('0x10'),JSON[_0xe489('0x11')](_0x460b12));if(_0x460b12[_0xe489('0x12')]){if(_0x460b12[_0xe489('0x12')][_0xe489('0x13')]===0x1f4){logger[_0xe489('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x51b4b8,_0x460b12[_0xe489('0x12')][_0xe489('0x14')]);return _0x349888(_0x460b12[_0xe489('0x12')][_0xe489('0x14')]);}logger[_0xe489('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x51b4b8,_0x460b12['error'][_0xe489('0x14')]);return _0x3143d5(_0x460b12[_0xe489('0x12')][_0xe489('0x14')]);}else{logger['info'](_0xe489('0xd'),_0x51b4b8,_0xe489('0x10'));_0x3143d5(_0x460b12[_0xe489('0x15')]['message']);}})['catch'](function(_0x36dc03){logger[_0xe489('0x12')]('MailTransferReport,\x20%s,\x20%s',_0x51b4b8,_0x36dc03);_0x349888(_0x36dc03);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 3bda706..f467ada 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 _0x130f=['isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller'];(function(_0x101b24,_0x1b4c44){var _0x1a98d8=function(_0x52dde6){while(--_0x52dde6){_0x101b24['push'](_0x101b24['shift']());}};_0x1a98d8(++_0x1b4c44);}(_0x130f,0x1ee));var _0xf130=function(_0x1744d9,_0x306c35){_0x1744d9=_0x1744d9-0x0;var _0x389f5b=_0x130f[_0x1744d9];return _0x389f5b;};'use strict';var multer=require(_0xf130('0x0'));var util=require(_0xf130('0x1'));var path=require(_0xf130('0x2'));var timeout=require(_0xf130('0x3'));var express=require(_0xf130('0x4'));var router=express[_0xf130('0x5')]();var auth=require(_0xf130('0x6'));var interaction=require(_0xf130('0x7'));var config=require(_0xf130('0x8'));var controller=require(_0xf130('0x9'));router['get']('/',auth[_0xf130('0xa')](),controller[_0xf130('0xb')]);router[_0xf130('0xc')]('/describe',auth[_0xf130('0xa')](),controller['describe']);router['get'](_0xf130('0xd'),auth['isAuthenticated'](),controller[_0xf130('0xe')]);router[_0xf130('0xf')]('/',auth[_0xf130('0xa')](),controller[_0xf130('0x10')]);router[_0xf130('0x11')](_0xf130('0xd'),auth[_0xf130('0xa')](),controller[_0xf130('0x12')]);router['delete'](_0xf130('0xd'),auth[_0xf130('0xa')](),controller[_0xf130('0x13')]);module[_0xf130('0x14')]=router; \ No newline at end of file +var _0xcdcd=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','create','put','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x244539,_0x599eb3){var _0x393e59=function(_0x63629a){while(--_0x63629a){_0x244539['push'](_0x244539['shift']());}};_0x393e59(++_0x599eb3);}(_0xcdcd,0x10d));var _0xdcdc=function(_0x1d39f6,_0x146f4a){_0x1d39f6=_0x1d39f6-0x0;var _0x3dbd7a=_0xcdcd[_0x1d39f6];return _0x3dbd7a;};'use strict';var multer=require(_0xdcdc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdcdc('0x1'));var express=require(_0xdcdc('0x2'));var router=express['Router']();var auth=require(_0xdcdc('0x3'));var interaction=require(_0xdcdc('0x4'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0xdcdc('0x5')]('/',auth[_0xdcdc('0x6')](),controller[_0xdcdc('0x7')]);router[_0xdcdc('0x5')](_0xdcdc('0x8'),auth[_0xdcdc('0x6')](),controller['describe']);router[_0xdcdc('0x5')](_0xdcdc('0x9'),auth[_0xdcdc('0x6')](),controller[_0xdcdc('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdcdc('0xb')]);router[_0xdcdc('0xc')](_0xdcdc('0x9'),auth[_0xdcdc('0x6')](),controller[_0xdcdc('0xd')]);router[_0xdcdc('0xe')](_0xdcdc('0x9'),auth[_0xdcdc('0x6')](),controller[_0xdcdc('0xf')]);module[_0xdcdc('0x10')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index b131482..800849f 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 _0xf643=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue','exitAt','duration'];(function(_0x3c414c,_0x399dbb){var _0x4f3062=function(_0x1b71cc){while(--_0x1b71cc){_0x3c414c['push'](_0x3c414c['shift']());}};_0x4f3062(++_0x399dbb);}(_0xf643,0x113));var _0x3f64=function(_0x321976,_0x2cb745){_0x321976=_0x321976-0x0;var _0x1537f8=_0xf643[_0x321976];return _0x1537f8;};'use strict';var Sequelize=require(_0x3f64('0x0'));var moment=require(_0x3f64('0x1'));module[_0x3f64('0x2')]={'channel':{'type':Sequelize[_0x3f64('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x3f64('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x3f64('0x4')},'duration':{'type':Sequelize[_0x3f64('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x3f64('0x6')],'set':function(_0x3a3f58){var _0x274cec=moment(_0x3a3f58);var _0x52287e=moment(this[_0x3f64('0x7')](_0x3f64('0x8')));var _0x379772=_0x274cec['diff'](_0x52287e,_0x3f64('0x9'));this[_0x3f64('0xa')](_0x3f64('0xb'),_0x3a3f58);this[_0x3f64('0xa')](_0x3f64('0xc'),_0x379772||null);}},'data1':{'type':Sequelize[_0x3f64('0x3')],'comment':_0x3f64('0xd')},'data2':{'type':Sequelize[_0x3f64('0x3')],'comment':_0x3f64('0xe')},'data3':{'type':Sequelize[_0x3f64('0x3')],'comment':_0x3f64('0xf')},'data4':{'type':Sequelize[_0x3f64('0x3')],'comment':_0x3f64('0x10')},'data5':{'type':Sequelize[_0x3f64('0x3')],'comment':_0x3f64('0x11')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x3f64('0x3')]}}; \ No newline at end of file +var _0x7129=['STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[dial\x20string]','talk:[queue]','moment','exports'];(function(_0x3152a7,_0x12d793){var _0x4be533=function(_0x1283af){while(--_0x1283af){_0x3152a7['push'](_0x3152a7['shift']());}};_0x4be533(++_0x12d793);}(_0x7129,0x11b));var _0x9712=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x7129[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9712('0x0'));module[_0x9712('0x1')]={'channel':{'type':Sequelize[_0x9712('0x2')]},'membername':{'type':Sequelize[_0x9712('0x2')]},'interface':{'type':Sequelize[_0x9712('0x2')]},'type':{'type':Sequelize[_0x9712('0x2')],'defaultValue':_0x9712('0x3'),'comment':_0x9712('0x4')},'duration':{'type':Sequelize[_0x9712('0x5')]},'enterAt':{'type':Sequelize[_0x9712('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0xfe3e3e){var _0x2b14c6=moment(_0xfe3e3e);var _0xe02593=moment(this['getDataValue'](_0x9712('0x7')));var _0x5203bf=_0x2b14c6[_0x9712('0x8')](_0xe02593,_0x9712('0x9'));this[_0x9712('0xa')](_0x9712('0xb'),_0xfe3e3e);this['setDataValue'](_0x9712('0xc'),_0x5203bf||null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x9712('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x9712('0x2')],'comment':'talk:[destination]'},'data4':{'type':Sequelize['STRING'],'comment':_0x9712('0xd')},'data5':{'type':Sequelize['STRING'],'comment':_0x9712('0xe')},'role':{'type':Sequelize[_0x9712('0x2')]},'internal':{'type':Sequelize[_0x9712('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index e934af4..443416d 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 _0x75d5=['count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','filter','options','include','rows','catch','params','includeAll','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','sox','ejs','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/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x538460,_0x350ff4){var _0x15e57c=function(_0x1dd909){while(--_0x1dd909){_0x538460['push'](_0x538460['shift']());}};_0x15e57c(++_0x350ff4);}(_0x75d5,0x1d6));var _0x575d=function(_0x21f0ef,_0x30f79f){_0x21f0ef=_0x21f0ef-0x0;var _0x445dc4=_0x75d5[_0x21f0ef];return _0x445dc4;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x575d('0x0'));var rimraf=require(_0x575d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x575d('0x2'));var moment=require(_0x575d('0x3'));var BPromise=require(_0x575d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x575d('0x5'));var csv=require('to-csv');var ejs=require(_0x575d('0x6'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x575d('0x7'));var jsforce=require(_0x575d('0x8'));var deskjs=require(_0x575d('0x9'));var toCsv=require(_0x575d('0xa'));var querystring=require(_0x575d('0xb'));var Papa=require(_0x575d('0xc'));var Redis=require(_0x575d('0xd'));var authService=require(_0x575d('0xe'));var qs=require(_0x575d('0xf'));var as=require(_0x575d('0x10'));var hardwareService=require(_0x575d('0x11'));var logger=require(_0x575d('0x12'))(_0x575d('0x13'));var utils=require(_0x575d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x575d('0x15'));var db=require(_0x575d('0x16'))['db'];function respondWithStatusCode(_0x5727d2,_0x17c153){_0x17c153=_0x17c153||0xcc;return function(_0x4381a4){if(_0x4381a4){return _0x5727d2[_0x575d('0x17')](_0x17c153);}return _0x5727d2[_0x575d('0x18')](_0x17c153)[_0x575d('0x19')]();};}function respondWithResult(_0x462e4e,_0x349d23){_0x349d23=_0x349d23||0xc8;return function(_0x5c4d05){if(_0x5c4d05){return _0x462e4e[_0x575d('0x18')](_0x349d23)[_0x575d('0x1a')](_0x5c4d05);}};}function respondWithFilteredResult(_0x46bf33,_0x5960dc){return function(_0x5e7992){if(_0x5e7992){var _0x16c34f=_0x5e7992[_0x575d('0x1b')],_0x91842c=_0x5960dc[_0x575d('0x1c')],_0x5ed4c5=_0x5960dc[_0x575d('0x1c')]+_0x5960dc[_0x575d('0x1d')],_0x54a1ae;if(_0x5ed4c5>=_0x16c34f){_0x5ed4c5=_0x16c34f;_0x54a1ae=0xc8;}else{_0x54a1ae=0xce;}_0x46bf33[_0x575d('0x18')](_0x54a1ae);return _0x46bf33[_0x575d('0x1e')](_0x575d('0x1f'),_0x91842c+'-'+_0x5ed4c5+'/'+_0x16c34f)['json'](_0x5e7992);}return null;};}function patchUpdates(_0x5e610c){return function(_0x205017){try{jsonpatch[_0x575d('0x20')](_0x205017,_0x5e610c,!![]);}catch(_0x1da570){return BPromise['reject'](_0x1da570);}return _0x205017[_0x575d('0x21')]();};}function saveUpdates(_0x2c68b8,_0x38c53a){return function(_0x464dcc){if(_0x464dcc){return _0x464dcc[_0x575d('0x22')](_0x2c68b8)[_0x575d('0x23')](function(_0x224dd5){return _0x224dd5;});}return null;};}function removeEntity(_0x201dc5,_0x5a37cb){return function(_0x467eab){if(_0x467eab){return _0x467eab[_0x575d('0x24')]()[_0x575d('0x23')](function(){_0x201dc5['status'](0xcc)[_0x575d('0x19')]();});}};}function handleEntityNotFound(_0x3cd9f6,_0x2b27a9){return function(_0xb0c261){if(!_0xb0c261){_0x3cd9f6['sendStatus'](0x194);}return _0xb0c261;};}function handleError(_0x496ebe,_0x3c1f85){_0x3c1f85=_0x3c1f85||0x1f4;return function(_0x15b3bf){logger[_0x575d('0x25')](_0x15b3bf[_0x575d('0x26')]);if(_0x15b3bf[_0x575d('0x27')]){delete _0x15b3bf['name'];}_0x496ebe['status'](_0x3c1f85)[_0x575d('0x28')](_0x15b3bf);};}exports[_0x575d('0x29')]=function(_0x3cdbbd,_0x550922){var _0x35828f={},_0x5697c7={},_0x292bf2={'count':0x0,'rows':[]};var _0x4a88f2=_[_0x575d('0x2a')](db[_0x575d('0x2b')][_0x575d('0x2c')],function(_0x3611d0){return{'name':_0x3611d0[_0x575d('0x2d')],'type':_0x3611d0[_0x575d('0x2e')]['key']};});_0x5697c7[_0x575d('0x2f')]=_[_0x575d('0x2a')](_0x4a88f2,_0x575d('0x27'));_0x5697c7[_0x575d('0x30')]=_[_0x575d('0x31')](_0x3cdbbd[_0x575d('0x30')]);_0x5697c7[_0x575d('0x32')]=_[_0x575d('0x33')](_0x5697c7[_0x575d('0x2f')],_0x5697c7[_0x575d('0x30')]);_0x35828f[_0x575d('0x34')]=_['intersection'](_0x5697c7['model'],qs[_0x575d('0x35')](_0x3cdbbd[_0x575d('0x30')][_0x575d('0x35')]));_0x35828f[_0x575d('0x34')]=_0x35828f['attributes'][_0x575d('0x36')]?_0x35828f[_0x575d('0x34')]:_0x5697c7[_0x575d('0x2f')];if(!_0x3cdbbd['query'][_0x575d('0x37')]('nolimit')){_0x35828f['limit']=qs[_0x575d('0x1d')](_0x3cdbbd[_0x575d('0x30')]['limit']);_0x35828f[_0x575d('0x1c')]=qs['offset'](_0x3cdbbd[_0x575d('0x30')]['offset']);}_0x35828f[_0x575d('0x38')]=qs[_0x575d('0x39')](_0x3cdbbd[_0x575d('0x30')]['sort']);_0x35828f[_0x575d('0x3a')]=qs[_0x575d('0x32')](_['pick'](_0x3cdbbd[_0x575d('0x30')],_0x5697c7[_0x575d('0x32')]),_0x4a88f2);if(_0x3cdbbd[_0x575d('0x30')]['filter']){_0x35828f[_0x575d('0x3a')]=_[_0x575d('0x3b')](_0x35828f['where'],{'$or':_[_0x575d('0x2a')](_0x4a88f2,function(_0x3799f9){if(_0x3799f9['type']!=='VIRTUAL'){var _0x3c5e6e={};_0x3c5e6e[_0x3799f9['name']]={'$like':'%'+_0x3cdbbd[_0x575d('0x30')][_0x575d('0x3c')]+'%'};return _0x3c5e6e;}})});}_0x35828f=_[_0x575d('0x3b')]({},_0x35828f,_0x3cdbbd[_0x575d('0x3d')]);var _0x4b0521={'where':_0x35828f[_0x575d('0x3a')]};return db['MemberReport'][_0x575d('0x1b')](_0x4b0521)[_0x575d('0x23')](function(_0x430925){_0x292bf2[_0x575d('0x1b')]=_0x430925;if(_0x3cdbbd[_0x575d('0x30')]['includeAll']){_0x35828f[_0x575d('0x3e')]=[{'all':!![]}];}return db['MemberReport']['findAll'](_0x35828f);})[_0x575d('0x23')](function(_0x504853){_0x292bf2[_0x575d('0x3f')]=_0x504853;return _0x292bf2;})[_0x575d('0x23')](respondWithFilteredResult(_0x550922,_0x35828f))[_0x575d('0x40')](handleError(_0x550922,null));};exports['show']=function(_0x5471e2,_0x2af30a){var _0x54716d={'raw':!![],'where':{'id':_0x5471e2[_0x575d('0x41')]['id']}},_0x3f2692={};_0x3f2692[_0x575d('0x2f')]=_['keys'](db[_0x575d('0x2b')][_0x575d('0x2c')]);_0x3f2692['query']=_['keys'](_0x5471e2[_0x575d('0x30')]);_0x3f2692[_0x575d('0x32')]=_[_0x575d('0x33')](_0x3f2692[_0x575d('0x2f')],_0x3f2692[_0x575d('0x30')]);_0x54716d[_0x575d('0x34')]=_['intersection'](_0x3f2692[_0x575d('0x2f')],qs[_0x575d('0x35')](_0x5471e2[_0x575d('0x30')][_0x575d('0x35')]));_0x54716d[_0x575d('0x34')]=_0x54716d[_0x575d('0x34')]['length']?_0x54716d[_0x575d('0x34')]:_0x3f2692[_0x575d('0x2f')];if(_0x5471e2[_0x575d('0x30')][_0x575d('0x42')]){_0x54716d[_0x575d('0x3e')]=[{'all':!![]}];}_0x54716d=_['merge']({},_0x54716d,_0x5471e2[_0x575d('0x3d')]);return db[_0x575d('0x2b')][_0x575d('0x43')](_0x54716d)[_0x575d('0x23')](handleEntityNotFound(_0x2af30a,null))[_0x575d('0x23')](respondWithResult(_0x2af30a,null))[_0x575d('0x40')](handleError(_0x2af30a,null));};exports[_0x575d('0x44')]=function(_0x1874db,_0x2f8cdf){return db[_0x575d('0x2b')][_0x575d('0x44')](_0x1874db['body'],{})[_0x575d('0x23')](respondWithResult(_0x2f8cdf,0xc9))[_0x575d('0x40')](handleError(_0x2f8cdf,null));};exports[_0x575d('0x22')]=function(_0x25eb34,_0x195cb9){if(_0x25eb34[_0x575d('0x45')]['id']){delete _0x25eb34[_0x575d('0x45')]['id'];}return db[_0x575d('0x2b')][_0x575d('0x43')]({'where':{'id':_0x25eb34[_0x575d('0x41')]['id']}})['then'](handleEntityNotFound(_0x195cb9,null))[_0x575d('0x23')](saveUpdates(_0x25eb34[_0x575d('0x45')],null))[_0x575d('0x23')](respondWithResult(_0x195cb9,null))['catch'](handleError(_0x195cb9,null));};exports[_0x575d('0x24')]=function(_0x35f0a2,_0x190458){return db[_0x575d('0x2b')][_0x575d('0x43')]({'where':{'id':_0x35f0a2['params']['id']}})[_0x575d('0x23')](handleEntityNotFound(_0x190458,null))['then'](removeEntity(_0x190458,null))[_0x575d('0x40')](handleError(_0x190458,null));};exports[_0x575d('0x46')]=function(_0x52a2a6,_0x909129){return db[_0x575d('0x2b')]['describe']()[_0x575d('0x23')](respondWithResult(_0x909129,null))[_0x575d('0x40')](handleError(_0x909129,null));}; \ No newline at end of file +var _0x56f3=['error','name','send','map','MemberReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','includeAll','findAll','rows','catch','show','params','find','create','body','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','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','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy'];(function(_0x349b8a,_0x292ba2){var _0x1a5687=function(_0x3447fd){while(--_0x3447fd){_0x349b8a['push'](_0x349b8a['shift']());}};_0x1a5687(++_0x292ba2);}(_0x56f3,0x142));var _0x356f=function(_0x1b2bf2,_0x5d61c9){_0x1b2bf2=_0x1b2bf2-0x0;var _0x166cab=_0x56f3[_0x1b2bf2];return _0x166cab;};'use strict';var pdf=require(_0x356f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x356f('0x1'));var zipdir=require(_0x356f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x356f('0x3'));var moment=require(_0x356f('0x4'));var BPromise=require(_0x356f('0x5'));var Mustache=require(_0x356f('0x6'));var util=require(_0x356f('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x356f('0x8'));var ejs=require(_0x356f('0x9'));var fs=require('fs');var _=require(_0x356f('0xa'));var squel=require('squel');var crypto=require(_0x356f('0xb'));var jsforce=require(_0x356f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x356f('0x8'));var querystring=require('querystring');var Papa=require(_0x356f('0xd'));var Redis=require(_0x356f('0xe'));var authService=require(_0x356f('0xf'));var qs=require(_0x356f('0x10'));var as=require(_0x356f('0x11'));var hardwareService=require(_0x356f('0x12'));var logger=require(_0x356f('0x13'))(_0x356f('0x14'));var utils=require(_0x356f('0x15'));var config=require(_0x356f('0x16'));var licenseUtil=require(_0x356f('0x17'));var db=require(_0x356f('0x18'))['db'];function respondWithStatusCode(_0x46c6ea,_0x2620ad){_0x2620ad=_0x2620ad||0xcc;return function(_0x52ac11){if(_0x52ac11){return _0x46c6ea[_0x356f('0x19')](_0x2620ad);}return _0x46c6ea[_0x356f('0x1a')](_0x2620ad)[_0x356f('0x1b')]();};}function respondWithResult(_0x3e91c5,_0x5e5f8a){_0x5e5f8a=_0x5e5f8a||0xc8;return function(_0x34e346){if(_0x34e346){return _0x3e91c5[_0x356f('0x1a')](_0x5e5f8a)[_0x356f('0x1c')](_0x34e346);}};}function respondWithFilteredResult(_0x2af484,_0x3dd9e6){return function(_0xec1961){if(_0xec1961){var _0x1b3ab9=_0xec1961[_0x356f('0x1d')],_0x3ef13f=_0x3dd9e6['offset'],_0x36c092=_0x3dd9e6[_0x356f('0x1e')]+_0x3dd9e6[_0x356f('0x1f')],_0x1a169d;if(_0x36c092>=_0x1b3ab9){_0x36c092=_0x1b3ab9;_0x1a169d=0xc8;}else{_0x1a169d=0xce;}_0x2af484['status'](_0x1a169d);return _0x2af484['set'](_0x356f('0x20'),_0x3ef13f+'-'+_0x36c092+'/'+_0x1b3ab9)[_0x356f('0x1c')](_0xec1961);}return null;};}function patchUpdates(_0xaaa750){return function(_0x519dfe){try{jsonpatch['apply'](_0x519dfe,_0xaaa750,!![]);}catch(_0x522042){return BPromise[_0x356f('0x21')](_0x522042);}return _0x519dfe[_0x356f('0x22')]();};}function saveUpdates(_0x2c4bbe,_0x4e5647){return function(_0x1cb5ad){if(_0x1cb5ad){return _0x1cb5ad[_0x356f('0x23')](_0x2c4bbe)[_0x356f('0x24')](function(_0x2431d4){return _0x2431d4;});}return null;};}function removeEntity(_0x27bef6,_0x19a354){return function(_0x9418c3){if(_0x9418c3){return _0x9418c3[_0x356f('0x25')]()[_0x356f('0x24')](function(){_0x27bef6[_0x356f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x770ee2,_0xb5b18e){return function(_0x3f1509){if(!_0x3f1509){_0x770ee2['sendStatus'](0x194);}return _0x3f1509;};}function handleError(_0x214340,_0xad85e5){_0xad85e5=_0xad85e5||0x1f4;return function(_0x49c5df){logger[_0x356f('0x26')](_0x49c5df['stack']);if(_0x49c5df[_0x356f('0x27')]){delete _0x49c5df[_0x356f('0x27')];}_0x214340[_0x356f('0x1a')](_0xad85e5)[_0x356f('0x28')](_0x49c5df);};}exports['index']=function(_0x5e00cb,_0x42fe88){var _0x520cb0={},_0x2f4610={},_0x459f96={'count':0x0,'rows':[]};var _0x4904f3=_[_0x356f('0x29')](db[_0x356f('0x2a')][_0x356f('0x2b')],function(_0x1234e8){return{'name':_0x1234e8[_0x356f('0x2c')],'type':_0x1234e8['type'][_0x356f('0x2d')]};});_0x2f4610[_0x356f('0x2e')]=_[_0x356f('0x29')](_0x4904f3,_0x356f('0x27'));_0x2f4610[_0x356f('0x2f')]=_[_0x356f('0x30')](_0x5e00cb[_0x356f('0x2f')]);_0x2f4610[_0x356f('0x31')]=_[_0x356f('0x32')](_0x2f4610[_0x356f('0x2e')],_0x2f4610['query']);_0x520cb0[_0x356f('0x33')]=_['intersection'](_0x2f4610[_0x356f('0x2e')],qs[_0x356f('0x34')](_0x5e00cb[_0x356f('0x2f')][_0x356f('0x34')]));_0x520cb0['attributes']=_0x520cb0[_0x356f('0x33')][_0x356f('0x35')]?_0x520cb0['attributes']:_0x2f4610[_0x356f('0x2e')];if(!_0x5e00cb[_0x356f('0x2f')][_0x356f('0x36')](_0x356f('0x37'))){_0x520cb0[_0x356f('0x1f')]=qs[_0x356f('0x1f')](_0x5e00cb[_0x356f('0x2f')][_0x356f('0x1f')]);_0x520cb0[_0x356f('0x1e')]=qs[_0x356f('0x1e')](_0x5e00cb[_0x356f('0x2f')][_0x356f('0x1e')]);}_0x520cb0['order']=qs[_0x356f('0x38')](_0x5e00cb[_0x356f('0x2f')][_0x356f('0x38')]);_0x520cb0[_0x356f('0x39')]=qs['filters'](_[_0x356f('0x3a')](_0x5e00cb['query'],_0x2f4610[_0x356f('0x31')]),_0x4904f3);if(_0x5e00cb[_0x356f('0x2f')]['filter']){_0x520cb0[_0x356f('0x39')]=_[_0x356f('0x3b')](_0x520cb0[_0x356f('0x39')],{'$or':_[_0x356f('0x29')](_0x4904f3,function(_0x57b464){if(_0x57b464['type']!=='VIRTUAL'){var _0x410f7d={};_0x410f7d[_0x57b464['name']]={'$like':'%'+_0x5e00cb[_0x356f('0x2f')][_0x356f('0x3c')]+'%'};return _0x410f7d;}})});}_0x520cb0=_['merge']({},_0x520cb0,_0x5e00cb[_0x356f('0x3d')]);var _0x593393={'where':_0x520cb0['where']};return db[_0x356f('0x2a')][_0x356f('0x1d')](_0x593393)['then'](function(_0x4c929f){_0x459f96['count']=_0x4c929f;if(_0x5e00cb[_0x356f('0x2f')][_0x356f('0x3e')]){_0x520cb0['include']=[{'all':!![]}];}return db['MemberReport'][_0x356f('0x3f')](_0x520cb0);})[_0x356f('0x24')](function(_0x1b15a4){_0x459f96[_0x356f('0x40')]=_0x1b15a4;return _0x459f96;})[_0x356f('0x24')](respondWithFilteredResult(_0x42fe88,_0x520cb0))[_0x356f('0x41')](handleError(_0x42fe88,null));};exports[_0x356f('0x42')]=function(_0x2216a7,_0x354b53){var _0x41ab7a={'raw':!![],'where':{'id':_0x2216a7[_0x356f('0x43')]['id']}},_0xe8c9fb={};_0xe8c9fb[_0x356f('0x2e')]=_[_0x356f('0x30')](db[_0x356f('0x2a')][_0x356f('0x2b')]);_0xe8c9fb[_0x356f('0x2f')]=_[_0x356f('0x30')](_0x2216a7['query']);_0xe8c9fb[_0x356f('0x31')]=_['intersection'](_0xe8c9fb[_0x356f('0x2e')],_0xe8c9fb[_0x356f('0x2f')]);_0x41ab7a[_0x356f('0x33')]=_[_0x356f('0x32')](_0xe8c9fb[_0x356f('0x2e')],qs[_0x356f('0x34')](_0x2216a7['query'][_0x356f('0x34')]));_0x41ab7a[_0x356f('0x33')]=_0x41ab7a[_0x356f('0x33')][_0x356f('0x35')]?_0x41ab7a['attributes']:_0xe8c9fb[_0x356f('0x2e')];if(_0x2216a7['query'][_0x356f('0x3e')]){_0x41ab7a['include']=[{'all':!![]}];}_0x41ab7a=_[_0x356f('0x3b')]({},_0x41ab7a,_0x2216a7[_0x356f('0x3d')]);return db['MemberReport'][_0x356f('0x44')](_0x41ab7a)[_0x356f('0x24')](handleEntityNotFound(_0x354b53,null))['then'](respondWithResult(_0x354b53,null))[_0x356f('0x41')](handleError(_0x354b53,null));};exports[_0x356f('0x45')]=function(_0x3b868c,_0x188613){return db[_0x356f('0x2a')]['create'](_0x3b868c[_0x356f('0x46')],{})['then'](respondWithResult(_0x188613,0xc9))['catch'](handleError(_0x188613,null));};exports[_0x356f('0x23')]=function(_0x51617e,_0x6ee6c9){if(_0x51617e['body']['id']){delete _0x51617e['body']['id'];}return db[_0x356f('0x2a')][_0x356f('0x44')]({'where':{'id':_0x51617e[_0x356f('0x43')]['id']}})[_0x356f('0x24')](handleEntityNotFound(_0x6ee6c9,null))['then'](saveUpdates(_0x51617e[_0x356f('0x46')],null))[_0x356f('0x24')](respondWithResult(_0x6ee6c9,null))['catch'](handleError(_0x6ee6c9,null));};exports[_0x356f('0x25')]=function(_0x4f05b1,_0x49ad91){return db[_0x356f('0x2a')][_0x356f('0x44')]({'where':{'id':_0x4f05b1[_0x356f('0x43')]['id']}})[_0x356f('0x24')](handleEntityNotFound(_0x49ad91,null))['then'](removeEntity(_0x49ad91,null))[_0x356f('0x41')](handleError(_0x49ad91,null));};exports[_0x356f('0x47')]=function(_0x3217f8,_0x4285c5){return db['MemberReport'][_0x356f('0x47')]()[_0x356f('0x24')](respondWithResult(_0x4285c5,null))['catch'](handleError(_0x4285c5,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 792747e..f27bb1b 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 _0x4a91=['../../config/environment','./memberReport.attributes','exports','define','MemberReport','membername_interface','membername','interface','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3d916c,_0x2dbb05){var _0x2d5d74=function(_0x1a131b){while(--_0x1a131b){_0x3d916c['push'](_0x3d916c['shift']());}};_0x2d5d74(++_0x2dbb05);}(_0x4a91,0xa8));var _0x14a9=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x4a91[_0x40a825];return _0x273a54;};'use strict';var _=require(_0x14a9('0x0'));var util=require(_0x14a9('0x1'));var logger=require('../../config/logger')(_0x14a9('0x2'));var moment=require(_0x14a9('0x3'));var BPromise=require(_0x14a9('0x4'));var rp=require(_0x14a9('0x5'));var fs=require('fs');var path=require(_0x14a9('0x6'));var rimraf=require(_0x14a9('0x7'));var config=require(_0x14a9('0x8'));var attributes=require(_0x14a9('0x9'));module[_0x14a9('0xa')]=function(_0x4071fe,_0xb90cd5){return _0x4071fe[_0x14a9('0xb')](_0x14a9('0xc'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x14a9('0xd'),'fields':[_0x14a9('0xe'),_0x14a9('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x12ee=['define','MemberReport','membername','interface','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./memberReport.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x12ee,0x100));var _0xe12e=function(_0x4f5f36,_0x290286){_0x4f5f36=_0x4f5f36-0x0;var _0x3cbcf2=_0x12ee[_0x4f5f36];return _0x3cbcf2;};'use strict';var _=require(_0xe12e('0x0'));var util=require('util');var logger=require(_0xe12e('0x1'))(_0xe12e('0x2'));var moment=require(_0xe12e('0x3'));var BPromise=require(_0xe12e('0x4'));var rp=require(_0xe12e('0x5'));var fs=require('fs');var path=require(_0xe12e('0x6'));var rimraf=require(_0xe12e('0x7'));var config=require('../../config/environment');var attributes=require(_0xe12e('0x8'));module[_0xe12e('0x9')]=function(_0x129649,_0x341110){return _0x129649[_0xe12e('0xa')](_0xe12e('0xb'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xe12e('0xc'),_0xe12e('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index ced603d..4edc0e1 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 _0x2f66=['jayson/promise','client','http','request','info','MemberReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','MemberReport','findAll','options','raw','where','limit','include','map','model','attributes','then','GetMemberReport','stringify','CreateMemberReport','body','update','UpdateMemberReport','lodash','randomstring','../../config/utils'];(function(_0x46288b,_0x4f51b0){var _0x1a3d7f=function(_0x2053a3){while(--_0x2053a3){_0x46288b['push'](_0x46288b['shift']());}};_0x1a3d7f(++_0x4f51b0);}(_0x2f66,0x168));var _0x62f6=function(_0x14f681,_0xa0808e){_0x14f681=_0x14f681-0x0;var _0x1d4cb2=_0x2f66[_0x14f681];return _0x1d4cb2;};'use strict';var _=require(_0x62f6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x62f6('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x62f6('0x2'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x62f6('0x3'));var client=jayson[_0x62f6('0x4')][_0x62f6('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x42d121,_0x54f1ee,_0x5e3d86){return new BPromise(function(_0x3c8b5f,_0x10b5c5){return client[_0x62f6('0x6')](_0x42d121,_0x5e3d86)['then'](function(_0x37f322){logger[_0x62f6('0x7')](_0x62f6('0x8'),_0x54f1ee,'request\x20sent');logger[_0x62f6('0x9')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x54f1ee,_0x62f6('0xa'),JSON['stringify'](_0x37f322));if(_0x37f322[_0x62f6('0xb')]){if(_0x37f322[_0x62f6('0xb')][_0x62f6('0xc')]===0x1f4){logger[_0x62f6('0xb')](_0x62f6('0x8'),_0x54f1ee,_0x37f322[_0x62f6('0xb')][_0x62f6('0xd')]);return _0x10b5c5(_0x37f322[_0x62f6('0xb')][_0x62f6('0xd')]);}logger[_0x62f6('0xb')](_0x62f6('0x8'),_0x54f1ee,_0x37f322[_0x62f6('0xb')][_0x62f6('0xd')]);return _0x3c8b5f(_0x37f322[_0x62f6('0xb')][_0x62f6('0xd')]);}else{logger[_0x62f6('0x7')]('MemberReport,\x20%s,\x20%s',_0x54f1ee,_0x62f6('0xa'));_0x3c8b5f(_0x37f322[_0x62f6('0xe')][_0x62f6('0xd')]);}})[_0x62f6('0xf')](function(_0x1f56a0){logger[_0x62f6('0xb')](_0x62f6('0x8'),_0x54f1ee,_0x1f56a0);_0x10b5c5(_0x1f56a0);});});}exports['GetMemberReport']=function(_0x508857){var _0x536e78=this;return new Promise(function(_0x1ab341,_0x518777){return db[_0x62f6('0x10')][_0x62f6('0x11')]({'raw':_0x508857[_0x62f6('0x12')]?_0x508857['options'][_0x62f6('0x13')]===undefined?!![]:![]:!![],'where':_0x508857[_0x62f6('0x12')]?_0x508857['options'][_0x62f6('0x14')]||null:null,'attributes':_0x508857[_0x62f6('0x12')]?_0x508857[_0x62f6('0x12')]['attributes']||null:null,'limit':_0x508857[_0x62f6('0x12')]?_0x508857[_0x62f6('0x12')][_0x62f6('0x15')]||null:null,'include':_0x508857[_0x62f6('0x12')]?_0x508857[_0x62f6('0x12')][_0x62f6('0x16')]?_[_0x62f6('0x17')](_0x508857[_0x62f6('0x12')]['include'],function(_0x1c3eb4){return{'model':db[_0x1c3eb4['model']],'as':_0x1c3eb4['as'],'attributes':_0x1c3eb4['attributes'],'include':_0x1c3eb4['include']?_['map'](_0x1c3eb4[_0x62f6('0x16')],function(_0x56b34d){return{'model':db[_0x56b34d[_0x62f6('0x18')]],'as':_0x56b34d['as'],'attributes':_0x56b34d[_0x62f6('0x19')],'include':_0x56b34d[_0x62f6('0x16')]?_[_0x62f6('0x17')](_0x56b34d[_0x62f6('0x16')],function(_0x32a6de){return{'model':db[_0x32a6de[_0x62f6('0x18')]],'as':_0x32a6de['as'],'attributes':_0x32a6de['attributes']};}):[]};}):[]};}):[]:[]})[_0x62f6('0x1a')](function(_0x5b4fac){logger[_0x62f6('0x7')](_0x62f6('0x1b'),_0x508857);logger[_0x62f6('0x9')](_0x62f6('0x1b'),_0x508857,JSON[_0x62f6('0x1c')](_0x5b4fac));_0x1ab341(_0x5b4fac);})[_0x62f6('0xf')](function(_0x4035f2){logger[_0x62f6('0xb')](_0x62f6('0x1b'),_0x4035f2[_0x62f6('0xd')],_0x508857);_0x518777(_0x536e78[_0x62f6('0xb')](0x1f4,_0x4035f2['message']));});});};exports[_0x62f6('0x1d')]=function(_0x1fcde0){var _0x23ccc1=this;return new Promise(function(_0x299881,_0x694f29){return db[_0x62f6('0x10')]['create'](_0x1fcde0[_0x62f6('0x1e')],{'raw':_0x1fcde0[_0x62f6('0x12')]?_0x1fcde0[_0x62f6('0x12')]['raw']===undefined?!![]:![]:!![]})[_0x62f6('0x1a')](function(_0x4d9a46){logger[_0x62f6('0x7')](_0x62f6('0x1d'),_0x1fcde0);logger[_0x62f6('0x9')](_0x62f6('0x1d'),_0x1fcde0,JSON['stringify'](_0x4d9a46));_0x299881(_0x4d9a46);})[_0x62f6('0xf')](function(_0x215bb9){logger[_0x62f6('0xb')](_0x62f6('0x1d'),_0x215bb9['message'],_0x1fcde0);_0x694f29(_0x23ccc1[_0x62f6('0xb')](0x1f4,_0x215bb9['message']));});});};exports['UpdateMemberReport']=function(_0x5e6e91){var _0x3ec9af=this;return new Promise(function(_0x2551e6,_0x2a743b){return db[_0x62f6('0x10')][_0x62f6('0x1f')](_0x5e6e91['body'],{'raw':_0x5e6e91['options']?_0x5e6e91[_0x62f6('0x12')][_0x62f6('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e6e91['options']?_0x5e6e91[_0x62f6('0x12')][_0x62f6('0x14')]||null:null,'attributes':_0x5e6e91['options']?_0x5e6e91[_0x62f6('0x12')][_0x62f6('0x19')]||null:null,'limit':_0x5e6e91[_0x62f6('0x12')]?_0x5e6e91[_0x62f6('0x12')][_0x62f6('0x15')]||null:null})[_0x62f6('0x1a')](function(_0x43df98){logger[_0x62f6('0x7')](_0x62f6('0x20'),_0x5e6e91);logger[_0x62f6('0x9')]('UpdateMemberReport',_0x5e6e91,JSON['stringify'](_0x43df98));_0x2551e6(_0x43df98);})[_0x62f6('0xf')](function(_0x4c0be8){logger[_0x62f6('0xb')]('UpdateMemberReport',_0x4c0be8[_0x62f6('0xd')],_0x5e6e91);_0x2a743b(_0x3ec9af[_0x62f6('0xb')](0x1f4,_0x4c0be8[_0x62f6('0xd')]));});});}; \ No newline at end of file +var _0xbea8=['MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','map','model','catch','CreateMemberReport','body','stringify','UpdateMemberReport','update','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info'];(function(_0x3f6a07,_0x4b3c23){var _0x4fe33e=function(_0x4bdd43){while(--_0x4bdd43){_0x3f6a07['push'](_0x3f6a07['shift']());}};_0x4fe33e(++_0x4b3c23);}(_0xbea8,0x140));var _0x8bea=function(_0x1d83db,_0x89d115){_0x1d83db=_0x1d83db-0x0;var _0x2dc1d1=_0xbea8[_0x1d83db];return _0x2dc1d1;};'use strict';var _=require(_0x8bea('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8bea('0x1'));var rs=require(_0x8bea('0x2'));var fs=require('fs');var Redis=require(_0x8bea('0x3'));var db=require(_0x8bea('0x4'))['db'];var utils=require(_0x8bea('0x5'));var logger=require(_0x8bea('0x6'))(_0x8bea('0x7'));var config=require(_0x8bea('0x8'));var jayson=require(_0x8bea('0x9'));var client=jayson[_0x8bea('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1cfae5,_0xa0d946,_0x597f79){return new BPromise(function(_0x4b0fd9,_0x480981){return client['request'](_0x1cfae5,_0x597f79)[_0x8bea('0xb')](function(_0x1650d2){logger[_0x8bea('0xc')](_0x8bea('0xd'),_0xa0d946,_0x8bea('0xe'));logger[_0x8bea('0xf')](_0x8bea('0x10'),_0xa0d946,_0x8bea('0xe'),JSON['stringify'](_0x1650d2));if(_0x1650d2[_0x8bea('0x11')]){if(_0x1650d2[_0x8bea('0x11')][_0x8bea('0x12')]===0x1f4){logger[_0x8bea('0x11')](_0x8bea('0xd'),_0xa0d946,_0x1650d2[_0x8bea('0x11')][_0x8bea('0x13')]);return _0x480981(_0x1650d2[_0x8bea('0x11')]['message']);}logger[_0x8bea('0x11')](_0x8bea('0xd'),_0xa0d946,_0x1650d2['error'][_0x8bea('0x13')]);return _0x4b0fd9(_0x1650d2['error'][_0x8bea('0x13')]);}else{logger[_0x8bea('0xc')](_0x8bea('0xd'),_0xa0d946,_0x8bea('0xe'));_0x4b0fd9(_0x1650d2['result'][_0x8bea('0x13')]);}})['catch'](function(_0x2a4b8c){logger['error'](_0x8bea('0xd'),_0xa0d946,_0x2a4b8c);_0x480981(_0x2a4b8c);});});}exports[_0x8bea('0x14')]=function(_0x4123ac){var _0x27125=this;return new Promise(function(_0x3aefb7,_0x1cde9a){return db[_0x8bea('0x15')][_0x8bea('0x16')]({'raw':_0x4123ac[_0x8bea('0x17')]?_0x4123ac[_0x8bea('0x17')][_0x8bea('0x18')]===undefined?!![]:![]:!![],'where':_0x4123ac[_0x8bea('0x17')]?_0x4123ac['options'][_0x8bea('0x19')]||null:null,'attributes':_0x4123ac[_0x8bea('0x17')]?_0x4123ac[_0x8bea('0x17')][_0x8bea('0x1a')]||null:null,'limit':_0x4123ac[_0x8bea('0x17')]?_0x4123ac[_0x8bea('0x17')][_0x8bea('0x1b')]||null:null,'include':_0x4123ac[_0x8bea('0x17')]?_0x4123ac[_0x8bea('0x17')][_0x8bea('0x1c')]?_[_0x8bea('0x1d')](_0x4123ac['options'][_0x8bea('0x1c')],function(_0x1feb2b){return{'model':db[_0x1feb2b[_0x8bea('0x1e')]],'as':_0x1feb2b['as'],'attributes':_0x1feb2b[_0x8bea('0x1a')],'include':_0x1feb2b['include']?_[_0x8bea('0x1d')](_0x1feb2b[_0x8bea('0x1c')],function(_0x3e0af3){return{'model':db[_0x3e0af3[_0x8bea('0x1e')]],'as':_0x3e0af3['as'],'attributes':_0x3e0af3[_0x8bea('0x1a')],'include':_0x3e0af3['include']?_[_0x8bea('0x1d')](_0x3e0af3['include'],function(_0x276eed){return{'model':db[_0x276eed[_0x8bea('0x1e')]],'as':_0x276eed['as'],'attributes':_0x276eed[_0x8bea('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x238269){logger['info'](_0x8bea('0x14'),_0x4123ac);logger[_0x8bea('0xf')](_0x8bea('0x14'),_0x4123ac,JSON['stringify'](_0x238269));_0x3aefb7(_0x238269);})[_0x8bea('0x1f')](function(_0x6dd8ab){logger[_0x8bea('0x11')]('GetMemberReport',_0x6dd8ab['message'],_0x4123ac);_0x1cde9a(_0x27125[_0x8bea('0x11')](0x1f4,_0x6dd8ab[_0x8bea('0x13')]));});});};exports[_0x8bea('0x20')]=function(_0x50b45e){var _0x3f5ddd=this;return new Promise(function(_0x17d357,_0x5c2ae){return db[_0x8bea('0x15')]['create'](_0x50b45e[_0x8bea('0x21')],{'raw':_0x50b45e[_0x8bea('0x17')]?_0x50b45e[_0x8bea('0x17')][_0x8bea('0x18')]===undefined?!![]:![]:!![]})[_0x8bea('0xb')](function(_0xf0a97e){logger['info'](_0x8bea('0x20'),_0x50b45e);logger[_0x8bea('0xf')](_0x8bea('0x20'),_0x50b45e,JSON[_0x8bea('0x22')](_0xf0a97e));_0x17d357(_0xf0a97e);})[_0x8bea('0x1f')](function(_0x176cc8){logger[_0x8bea('0x11')]('CreateMemberReport',_0x176cc8['message'],_0x50b45e);_0x5c2ae(_0x3f5ddd['error'](0x1f4,_0x176cc8[_0x8bea('0x13')]));});});};exports[_0x8bea('0x23')]=function(_0x50dcbb){var _0x31cb46=this;return new Promise(function(_0x152c5f,_0x1556bd){return db[_0x8bea('0x15')][_0x8bea('0x24')](_0x50dcbb[_0x8bea('0x21')],{'raw':_0x50dcbb['options']?_0x50dcbb[_0x8bea('0x17')][_0x8bea('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50dcbb[_0x8bea('0x17')]?_0x50dcbb[_0x8bea('0x17')][_0x8bea('0x19')]||null:null,'attributes':_0x50dcbb[_0x8bea('0x17')]?_0x50dcbb['options'][_0x8bea('0x1a')]||null:null,'limit':_0x50dcbb[_0x8bea('0x17')]?_0x50dcbb[_0x8bea('0x17')][_0x8bea('0x1b')]||null:null})[_0x8bea('0xb')](function(_0x254df2){logger[_0x8bea('0xc')](_0x8bea('0x23'),_0x50dcbb);logger[_0x8bea('0xf')]('UpdateMemberReport',_0x50dcbb,JSON['stringify'](_0x254df2));_0x152c5f(_0x254df2);})[_0x8bea('0x1f')](function(_0x3279b5){logger['error'](_0x8bea('0x23'),_0x3279b5['message'],_0x50dcbb);_0x1556bd(_0x31cb46[_0x8bea('0x11')](0x1f4,_0x3279b5[_0x8bea('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 640e8d5..bf8f26e 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 _0xb9be=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','exports','multer'];(function(_0x54813d,_0x101c1f){var _0x561eea=function(_0x1faa0a){while(--_0x1faa0a){_0x54813d['push'](_0x54813d['shift']());}};_0x561eea(++_0x101c1f);}(_0xb9be,0xc5));var _0xeb9b=function(_0x496738,_0x3f1a9f){_0x496738=_0x496738-0x0;var _0xee1381=_0xb9be[_0x496738];return _0xee1381;};'use strict';var multer=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var path=require(_0xeb9b('0x2'));var timeout=require(_0xeb9b('0x3'));var express=require(_0xeb9b('0x4'));var router=express[_0xeb9b('0x5')]();var auth=require(_0xeb9b('0x6'));var interaction=require(_0xeb9b('0x7'));var config=require(_0xeb9b('0x8'));var controller=require('./migration.controller');router['get']('/',controller[_0xeb9b('0x9')]);module[_0xeb9b('0xa')]=router; \ No newline at end of file +var _0x4fc2=['./migration.controller','get','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x335886,_0x3a857e){var _0x3d10be=function(_0x1567f6){while(--_0x1567f6){_0x335886['push'](_0x335886['shift']());}};_0x3d10be(++_0x3a857e);}(_0x4fc2,0x111));var _0x24fc=function(_0x181c02,_0x2f21e6){_0x181c02=_0x181c02-0x0;var _0x17e08c=_0x4fc2[_0x181c02];return _0x17e08c;};'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 auth=require(_0x24fc('0x5'));var interaction=require(_0x24fc('0x6'));var config=require('../../config/environment');var controller=require(_0x24fc('0x7'));router[_0x24fc('0x8')]('/',controller['index']);module[_0x24fc('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 475db5e..322ee96 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 _0x906a=['exports','version'];(function(_0x18f18d,_0x5ea672){var _0x24899c=function(_0x19b80c){while(--_0x19b80c){_0x18f18d['push'](_0x18f18d['shift']());}};_0x24899c(++_0x5ea672);}(_0x906a,0x90));var _0xa906=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x906a[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0xa906('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0xa906('0x1')}}; \ No newline at end of file +var _0xc49a=['version','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc49a,0x171));var _0xac49=function(_0x21ed1c,_0x338e1e){_0x21ed1c=_0x21ed1c-0x0;var _0x3d0771=_0xc49a[_0x21ed1c];return _0x3d0771;};'use strict';var Sequelize=require('sequelize');module[_0xac49('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0xac49('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index a42227b..4314668 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 _0x89a5=['ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','then','destroy','error','name','send','Migration','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','html-pdf','eml-format','rimraf','zip-dir','request-promise','util','path','sox','to-csv'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x89a5,0x1a9));var _0x589a=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x89a5[_0x2aec52];return _0x3b8835;};'use strict';var pdf=require(_0x589a('0x0'));var emlformat=require(_0x589a('0x1'));var rimraf=require(_0x589a('0x2'));var zipdir=require(_0x589a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x589a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x589a('0x5'));var path=require(_0x589a('0x6'));var sox=require(_0x589a('0x7'));var csv=require(_0x589a('0x8'));var ejs=require(_0x589a('0x9'));var fs=require('fs');var _=require(_0x589a('0xa'));var squel=require('squel');var crypto=require(_0x589a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x589a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x589a('0xd'));var Papa=require(_0x589a('0xe'));var Redis=require(_0x589a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x589a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x589a('0x11'));var logger=require('../../config/logger')(_0x589a('0x12'));var utils=require('../../config/utils');var config=require(_0x589a('0x13'));var licenseUtil=require(_0x589a('0x14'));var db=require(_0x589a('0x15'))['db'];function respondWithStatusCode(_0x1e9eb2,_0x3b2265){_0x3b2265=_0x3b2265||0xcc;return function(_0xea49c){if(_0xea49c){return _0x1e9eb2[_0x589a('0x16')](_0x3b2265);}return _0x1e9eb2[_0x589a('0x17')](_0x3b2265)[_0x589a('0x18')]();};}function respondWithResult(_0x1bb211,_0x2cc166){_0x2cc166=_0x2cc166||0xc8;return function(_0x3cbd3c){if(_0x3cbd3c){return _0x1bb211[_0x589a('0x17')](_0x2cc166)[_0x589a('0x19')](_0x3cbd3c);}};}function respondWithFilteredResult(_0x1255dd,_0x3de3cc){return function(_0xb1f4fe){if(_0xb1f4fe){var _0x613bcd=_0xb1f4fe[_0x589a('0x1a')],_0x192032=_0x3de3cc[_0x589a('0x1b')],_0x812305=_0x3de3cc[_0x589a('0x1b')]+_0x3de3cc[_0x589a('0x1c')],_0x2f4485;if(_0x812305>=_0x613bcd){_0x812305=_0x613bcd;_0x2f4485=0xc8;}else{_0x2f4485=0xce;}_0x1255dd[_0x589a('0x17')](_0x2f4485);return _0x1255dd['set'](_0x589a('0x1d'),_0x192032+'-'+_0x812305+'/'+_0x613bcd)[_0x589a('0x19')](_0xb1f4fe);}return null;};}function patchUpdates(_0x4a1776){return function(_0x39915f){try{jsonpatch[_0x589a('0x1e')](_0x39915f,_0x4a1776,!![]);}catch(_0x2dbcdf){return BPromise['reject'](_0x2dbcdf);}return _0x39915f[_0x589a('0x1f')]();};}function saveUpdates(_0x4e4603,_0x3bf58b){return function(_0x69883d){if(_0x69883d){return _0x69883d['update'](_0x4e4603)[_0x589a('0x20')](function(_0x4cba31){return _0x4cba31;});}return null;};}function removeEntity(_0x15f387,_0x46e449){return function(_0x5692da){if(_0x5692da){return _0x5692da[_0x589a('0x21')]()[_0x589a('0x20')](function(){_0x15f387[_0x589a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x176101,_0x446bba){return function(_0x36515e){if(!_0x36515e){_0x176101[_0x589a('0x16')](0x194);}return _0x36515e;};}function handleError(_0x45d353,_0x30a4ca){_0x30a4ca=_0x30a4ca||0x1f4;return function(_0x4a93bb){logger[_0x589a('0x22')](_0x4a93bb['stack']);if(_0x4a93bb[_0x589a('0x23')]){delete _0x4a93bb[_0x589a('0x23')];}_0x45d353['status'](_0x30a4ca)[_0x589a('0x24')](_0x4a93bb);};}exports['index']=function(_0x20a08b,_0x5b415e){var _0x369411={},_0x618b3={},_0x3beedb={'count':0x0,'rows':[]};var _0x26f799=_['map'](db[_0x589a('0x25')][_0x589a('0x26')],function(_0x7a62c7){return{'name':_0x7a62c7['fieldName'],'type':_0x7a62c7[_0x589a('0x27')][_0x589a('0x28')]};});_0x618b3[_0x589a('0x29')]=_[_0x589a('0x2a')](_0x26f799,'name');_0x618b3[_0x589a('0x2b')]=_['keys'](_0x20a08b[_0x589a('0x2b')]);_0x618b3[_0x589a('0x2c')]=_[_0x589a('0x2d')](_0x618b3[_0x589a('0x29')],_0x618b3[_0x589a('0x2b')]);_0x369411[_0x589a('0x2e')]=_[_0x589a('0x2d')](_0x618b3[_0x589a('0x29')],qs[_0x589a('0x2f')](_0x20a08b['query'][_0x589a('0x2f')]));_0x369411['attributes']=_0x369411[_0x589a('0x2e')][_0x589a('0x30')]?_0x369411[_0x589a('0x2e')]:_0x618b3['model'];if(!_0x20a08b['query']['hasOwnProperty']('nolimit')){_0x369411['limit']=qs[_0x589a('0x1c')](_0x20a08b['query'][_0x589a('0x1c')]);_0x369411[_0x589a('0x1b')]=qs[_0x589a('0x1b')](_0x20a08b[_0x589a('0x2b')][_0x589a('0x1b')]);}_0x369411[_0x589a('0x31')]=qs[_0x589a('0x32')](_0x20a08b[_0x589a('0x2b')][_0x589a('0x32')]);_0x369411[_0x589a('0x33')]=qs[_0x589a('0x2c')](_[_0x589a('0x34')](_0x20a08b[_0x589a('0x2b')],_0x618b3[_0x589a('0x2c')]),_0x26f799);if(_0x20a08b[_0x589a('0x2b')][_0x589a('0x35')]){_0x369411[_0x589a('0x33')]=_['merge'](_0x369411[_0x589a('0x33')],{'$or':_[_0x589a('0x2a')](_0x26f799,function(_0x2fd60a){if(_0x2fd60a[_0x589a('0x27')]!==_0x589a('0x36')){var _0x332920={};_0x332920[_0x2fd60a[_0x589a('0x23')]]={'$like':'%'+_0x20a08b[_0x589a('0x2b')]['filter']+'%'};return _0x332920;}})});}_0x369411=_[_0x589a('0x37')]({},_0x369411,_0x20a08b[_0x589a('0x38')]);var _0x2f9a72={'where':_0x369411['where']};return db[_0x589a('0x25')][_0x589a('0x1a')](_0x2f9a72)[_0x589a('0x20')](function(_0x18efa6){_0x3beedb[_0x589a('0x1a')]=_0x18efa6;if(_0x20a08b[_0x589a('0x2b')][_0x589a('0x39')]){_0x369411[_0x589a('0x3a')]=[{'all':!![]}];}return db['Migration'][_0x589a('0x3b')](_0x369411);})[_0x589a('0x20')](function(_0x55f51c){_0x3beedb[_0x589a('0x3c')]=_0x55f51c;return _0x3beedb;})[_0x589a('0x20')](respondWithFilteredResult(_0x5b415e,_0x369411))[_0x589a('0x3d')](handleError(_0x5b415e,null));}; \ No newline at end of file +var _0xf4e5=['count','offset','limit','Content-Range','json','destroy','then','stack','send','index','map','Migration','rawAttributes','fieldName','key','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf4e5,0xad));var _0x5f4e=function(_0x2613d4,_0x18e3dc){_0x2613d4=_0x2613d4-0x0;var _0x4a9bd1=_0xf4e5[_0x2613d4];return _0x4a9bd1;};'use strict';var pdf=require(_0x5f4e('0x0'));var emlformat=require(_0x5f4e('0x1'));var rimraf=require(_0x5f4e('0x2'));var zipdir=require(_0x5f4e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5f4e('0x4'));var moment=require(_0x5f4e('0x5'));var BPromise=require(_0x5f4e('0x6'));var Mustache=require(_0x5f4e('0x7'));var util=require(_0x5f4e('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5f4e('0x9'));var fs=require('fs');var _=require(_0x5f4e('0xa'));var squel=require(_0x5f4e('0xb'));var crypto=require(_0x5f4e('0xc'));var jsforce=require(_0x5f4e('0xd'));var deskjs=require(_0x5f4e('0xe'));var toCsv=require(_0x5f4e('0xf'));var querystring=require(_0x5f4e('0x10'));var Papa=require(_0x5f4e('0x11'));var Redis=require(_0x5f4e('0x12'));var authService=require(_0x5f4e('0x13'));var qs=require(_0x5f4e('0x14'));var as=require(_0x5f4e('0x15'));var hardwareService=require(_0x5f4e('0x16'));var logger=require('../../config/logger')(_0x5f4e('0x17'));var utils=require(_0x5f4e('0x18'));var config=require(_0x5f4e('0x19'));var licenseUtil=require(_0x5f4e('0x1a'));var db=require(_0x5f4e('0x1b'))['db'];function respondWithStatusCode(_0x5b4387,_0x5d6c8d){_0x5d6c8d=_0x5d6c8d||0xcc;return function(_0x34b6bf){if(_0x34b6bf){return _0x5b4387[_0x5f4e('0x1c')](_0x5d6c8d);}return _0x5b4387[_0x5f4e('0x1d')](_0x5d6c8d)[_0x5f4e('0x1e')]();};}function respondWithResult(_0x54e099,_0x3ba516){_0x3ba516=_0x3ba516||0xc8;return function(_0x257d61){if(_0x257d61){return _0x54e099[_0x5f4e('0x1d')](_0x3ba516)['json'](_0x257d61);}};}function respondWithFilteredResult(_0x6f9b75,_0x1fe58a){return function(_0x125000){if(_0x125000){var _0x14d962=_0x125000[_0x5f4e('0x1f')],_0xdb77d1=_0x1fe58a[_0x5f4e('0x20')],_0x93ccc1=_0x1fe58a[_0x5f4e('0x20')]+_0x1fe58a[_0x5f4e('0x21')],_0x3fae3c;if(_0x93ccc1>=_0x14d962){_0x93ccc1=_0x14d962;_0x3fae3c=0xc8;}else{_0x3fae3c=0xce;}_0x6f9b75[_0x5f4e('0x1d')](_0x3fae3c);return _0x6f9b75['set'](_0x5f4e('0x22'),_0xdb77d1+'-'+_0x93ccc1+'/'+_0x14d962)[_0x5f4e('0x23')](_0x125000);}return null;};}function patchUpdates(_0x311e7c){return function(_0x4fd6a8){try{jsonpatch['apply'](_0x4fd6a8,_0x311e7c,!![]);}catch(_0x4e9a6a){return BPromise['reject'](_0x4e9a6a);}return _0x4fd6a8['save']();};}function saveUpdates(_0x500ea4,_0x4e010c){return function(_0x537f30){if(_0x537f30){return _0x537f30['update'](_0x500ea4)['then'](function(_0x7c2d95){return _0x7c2d95;});}return null;};}function removeEntity(_0x2d2e57,_0x504a79){return function(_0x121adb){if(_0x121adb){return _0x121adb[_0x5f4e('0x24')]()[_0x5f4e('0x25')](function(){_0x2d2e57['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c3a18,_0x35a229){return function(_0x18892d){if(!_0x18892d){_0x5c3a18[_0x5f4e('0x1c')](0x194);}return _0x18892d;};}function handleError(_0x3da936,_0x55ce58){_0x55ce58=_0x55ce58||0x1f4;return function(_0x21a994){logger['error'](_0x21a994[_0x5f4e('0x26')]);if(_0x21a994['name']){delete _0x21a994['name'];}_0x3da936[_0x5f4e('0x1d')](_0x55ce58)[_0x5f4e('0x27')](_0x21a994);};}exports[_0x5f4e('0x28')]=function(_0x11f270,_0x233d8c){var _0x5a6a96={},_0x34b65c={},_0x2a6448={'count':0x0,'rows':[]};var _0x338513=_[_0x5f4e('0x29')](db[_0x5f4e('0x2a')][_0x5f4e('0x2b')],function(_0x20229d){return{'name':_0x20229d[_0x5f4e('0x2c')],'type':_0x20229d['type'][_0x5f4e('0x2d')]};});_0x34b65c[_0x5f4e('0x2e')]=_[_0x5f4e('0x29')](_0x338513,_0x5f4e('0x2f'));_0x34b65c[_0x5f4e('0x30')]=_[_0x5f4e('0x31')](_0x11f270[_0x5f4e('0x30')]);_0x34b65c['filters']=_[_0x5f4e('0x32')](_0x34b65c[_0x5f4e('0x2e')],_0x34b65c['query']);_0x5a6a96[_0x5f4e('0x33')]=_[_0x5f4e('0x32')](_0x34b65c[_0x5f4e('0x2e')],qs[_0x5f4e('0x34')](_0x11f270[_0x5f4e('0x30')][_0x5f4e('0x34')]));_0x5a6a96[_0x5f4e('0x33')]=_0x5a6a96[_0x5f4e('0x33')][_0x5f4e('0x35')]?_0x5a6a96[_0x5f4e('0x33')]:_0x34b65c[_0x5f4e('0x2e')];if(!_0x11f270[_0x5f4e('0x30')][_0x5f4e('0x36')](_0x5f4e('0x37'))){_0x5a6a96[_0x5f4e('0x21')]=qs[_0x5f4e('0x21')](_0x11f270[_0x5f4e('0x30')][_0x5f4e('0x21')]);_0x5a6a96[_0x5f4e('0x20')]=qs[_0x5f4e('0x20')](_0x11f270[_0x5f4e('0x30')][_0x5f4e('0x20')]);}_0x5a6a96['order']=qs[_0x5f4e('0x38')](_0x11f270[_0x5f4e('0x30')][_0x5f4e('0x38')]);_0x5a6a96[_0x5f4e('0x39')]=qs['filters'](_['pick'](_0x11f270[_0x5f4e('0x30')],_0x34b65c[_0x5f4e('0x3a')]),_0x338513);if(_0x11f270[_0x5f4e('0x30')][_0x5f4e('0x3b')]){_0x5a6a96[_0x5f4e('0x39')]=_[_0x5f4e('0x3c')](_0x5a6a96['where'],{'$or':_[_0x5f4e('0x29')](_0x338513,function(_0x42cc6e){if(_0x42cc6e[_0x5f4e('0x3d')]!==_0x5f4e('0x3e')){var _0x43e2e2={};_0x43e2e2[_0x42cc6e[_0x5f4e('0x2f')]]={'$like':'%'+_0x11f270[_0x5f4e('0x30')]['filter']+'%'};return _0x43e2e2;}})});}_0x5a6a96=_[_0x5f4e('0x3c')]({},_0x5a6a96,_0x11f270[_0x5f4e('0x3f')]);var _0x300508={'where':_0x5a6a96[_0x5f4e('0x39')]};return db['Migration']['count'](_0x300508)[_0x5f4e('0x25')](function(_0x19c897){_0x2a6448[_0x5f4e('0x1f')]=_0x19c897;if(_0x11f270[_0x5f4e('0x30')][_0x5f4e('0x40')]){_0x5a6a96[_0x5f4e('0x41')]=[{'all':!![]}];}return db[_0x5f4e('0x2a')][_0x5f4e('0x42')](_0x5a6a96);})[_0x5f4e('0x25')](function(_0x22dc67){_0x2a6448['rows']=_0x22dc67;return _0x2a6448;})[_0x5f4e('0x25')](respondWithFilteredResult(_0x233d8c,_0x5a6a96))[_0x5f4e('0x43')](handleError(_0x233d8c,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 90958f1..7892833 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 _0x7700=['path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x27ad07,_0x2d3d47){var _0x3148b4=function(_0x3e8f75){while(--_0x3e8f75){_0x27ad07['push'](_0x27ad07['shift']());}};_0x3148b4(++_0x2d3d47);}(_0x7700,0xcb));var _0x0770=function(_0x3d3a2d,_0x1e246b){_0x3d3a2d=_0x3d3a2d-0x0;var _0x3f16ae=_0x7700[_0x3d3a2d];return _0x3f16ae;};'use strict';var _=require('lodash');var util=require(_0x0770('0x0'));var logger=require(_0x0770('0x1'))('api');var moment=require(_0x0770('0x2'));var BPromise=require(_0x0770('0x3'));var rp=require(_0x0770('0x4'));var fs=require('fs');var path=require(_0x0770('0x5'));var rimraf=require(_0x0770('0x6'));var config=require(_0x0770('0x7'));var attributes=require(_0x0770('0x8'));module[_0x0770('0x9')]=function(_0x225ac2,_0x33f0e5){return _0x225ac2[_0x0770('0xa')](_0x0770('0xb'),attributes,{'tableName':_0x0770('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa187=['lodash','../../config/logger','api','request-promise','path','./migration.attributes','exports','define','Migration','migrations'];(function(_0x43645f,_0x656278){var _0x36f9ab=function(_0x20f6ec){while(--_0x20f6ec){_0x43645f['push'](_0x43645f['shift']());}};_0x36f9ab(++_0x656278);}(_0xa187,0x10e));var _0x7a18=function(_0x44e50a,_0x1cc4a2){_0x44e50a=_0x44e50a-0x0;var _0x1b5994=_0xa187[_0x44e50a];return _0x1b5994;};'use strict';var _=require(_0x7a18('0x0'));var util=require('util');var logger=require(_0x7a18('0x1'))(_0x7a18('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7a18('0x3'));var fs=require('fs');var path=require(_0x7a18('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7a18('0x5'));module[_0x7a18('0x6')]=function(_0x237867,_0x5ea5f5){return _0x237867[_0x7a18('0x7')](_0x7a18('0x8'),attributes,{'tableName':_0x7a18('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index ee03dd5..d100efd 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 _0x6ca5=['client','http','then','info','Migration,\x20%s,\x20%s','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1af105,_0x1221b8){var _0x13f7ec=function(_0x3530cf){while(--_0x3530cf){_0x1af105['push'](_0x1af105['shift']());}};_0x13f7ec(++_0x1221b8);}(_0x6ca5,0xf2));var _0x56ca=function(_0x2e046d,_0x346fb9){_0x2e046d=_0x2e046d-0x0;var _0x536fa2=_0x6ca5[_0x2e046d];return _0x536fa2;};'use strict';var _=require(_0x56ca('0x0'));var util=require(_0x56ca('0x1'));var moment=require('moment');var BPromise=require(_0x56ca('0x2'));var rs=require(_0x56ca('0x3'));var fs=require('fs');var Redis=require(_0x56ca('0x4'));var db=require(_0x56ca('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x56ca('0x6'))(_0x56ca('0x7'));var config=require(_0x56ca('0x8'));var jayson=require(_0x56ca('0x9'));var client=jayson[_0x56ca('0xa')][_0x56ca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fae6a,_0x3d98c0,_0x7a06da){return new BPromise(function(_0x51d51d,_0x30b506){return client['request'](_0x4fae6a,_0x7a06da)[_0x56ca('0xc')](function(_0x23aed8){logger[_0x56ca('0xd')](_0x56ca('0xe'),_0x3d98c0,'request\x20sent');logger['debug'](_0x56ca('0xf'),_0x3d98c0,_0x56ca('0x10'),JSON[_0x56ca('0x11')](_0x23aed8));if(_0x23aed8['error']){if(_0x23aed8[_0x56ca('0x12')]['code']===0x1f4){logger['error'](_0x56ca('0xe'),_0x3d98c0,_0x23aed8[_0x56ca('0x12')][_0x56ca('0x13')]);return _0x30b506(_0x23aed8[_0x56ca('0x12')]['message']);}logger[_0x56ca('0x12')]('Migration,\x20%s,\x20%s',_0x3d98c0,_0x23aed8[_0x56ca('0x12')][_0x56ca('0x13')]);return _0x51d51d(_0x23aed8[_0x56ca('0x12')][_0x56ca('0x13')]);}else{logger[_0x56ca('0xd')](_0x56ca('0xe'),_0x3d98c0,_0x56ca('0x10'));_0x51d51d(_0x23aed8['result'][_0x56ca('0x13')]);}})[_0x56ca('0x14')](function(_0x5c0ddc){logger[_0x56ca('0x12')]('Migration,\x20%s,\x20%s',_0x3d98c0,_0x5c0ddc);_0x30b506(_0x5c0ddc);});});} \ No newline at end of file +var _0xd719=['../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','Migration,\x20%s,\x20%s','request\x20sent','debug','code','error','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x2ba7ee,_0x54db97){var _0x5530a4=function(_0x27ce1d){while(--_0x27ce1d){_0x2ba7ee['push'](_0x2ba7ee['shift']());}};_0x5530a4(++_0x54db97);}(_0xd719,0xb8));var _0x9d71=function(_0x20e181,_0x1b3585){_0x20e181=_0x20e181-0x0;var _0x3c9a87=_0xd719[_0x20e181];return _0x3c9a87;};'use strict';var _=require(_0x9d71('0x0'));var util=require(_0x9d71('0x1'));var moment=require('moment');var BPromise=require(_0x9d71('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d71('0x3'));var db=require(_0x9d71('0x4'))['db'];var utils=require(_0x9d71('0x5'));var logger=require('../../config/logger')(_0x9d71('0x6'));var config=require(_0x9d71('0x7'));var jayson=require(_0x9d71('0x8'));var client=jayson['client'][_0x9d71('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xc3d8c8,_0x539300,_0x4d981a){return new BPromise(function(_0x508ba8,_0x31d6ff){return client[_0x9d71('0xa')](_0xc3d8c8,_0x4d981a)[_0x9d71('0xb')](function(_0x3583bb){logger['info'](_0x9d71('0xc'),_0x539300,_0x9d71('0xd'));logger[_0x9d71('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0x539300,_0x9d71('0xd'),JSON['stringify'](_0x3583bb));if(_0x3583bb['error']){if(_0x3583bb['error'][_0x9d71('0xf')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x539300,_0x3583bb[_0x9d71('0x10')]['message']);return _0x31d6ff(_0x3583bb[_0x9d71('0x10')][_0x9d71('0x11')]);}logger[_0x9d71('0x10')]('Migration,\x20%s,\x20%s',_0x539300,_0x3583bb['error']['message']);return _0x508ba8(_0x3583bb['error']['message']);}else{logger[_0x9d71('0x12')](_0x9d71('0xc'),_0x539300,_0x9d71('0xd'));_0x508ba8(_0x3583bb[_0x9d71('0x13')]['message']);}})[_0x9d71('0x14')](function(_0x1a68e6){logger['error'](_0x9d71('0xc'),_0x539300,_0x1a68e6);_0x31d6ff(_0x1a68e6);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 5dd6b2c..34da1ca 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 _0x5733=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x40c616,_0x805861){var _0x39d91b=function(_0x2ce277){while(--_0x2ce277){_0x40c616['push'](_0x40c616['shift']());}};_0x39d91b(++_0x805861);}(_0x5733,0x163));var _0x3573=function(_0x891272,_0x4e33fc){_0x891272=_0x891272-0x0;var _0x5eaf79=_0x5733[_0x891272];return _0x5eaf79;};'use strict';var multer=require(_0x3573('0x0'));var util=require(_0x3573('0x1'));var path=require(_0x3573('0x2'));var timeout=require(_0x3573('0x3'));var express=require(_0x3573('0x4'));var router=express[_0x3573('0x5')]();var auth=require(_0x3573('0x6'));var interaction=require(_0x3573('0x7'));var config=require(_0x3573('0x8'));var controller=require('./network.controller');router[_0x3573('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3573('0x9')](_0x3573('0xa'),auth[_0x3573('0xb')](),controller[_0x3573('0xc')]);router[_0x3573('0xd')]('/',auth[_0x3573('0xb')](),controller[_0x3573('0xe')]);router[_0x3573('0xf')](_0x3573('0xa'),auth['isAuthenticated'](),controller[_0x3573('0x10')]);router[_0x3573('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3573('0x12')]);module['exports']=router; \ No newline at end of file +var _0xc7b3=['index','/:id','post','put','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x2b365f,_0x17aa37){var _0x26b060=function(_0x5e0a39){while(--_0x5e0a39){_0x2b365f['push'](_0x2b365f['shift']());}};_0x26b060(++_0x17aa37);}(_0xc7b3,0x1c6));var _0x3c7b=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc7b3[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0x3c7b('0x0'));var util=require(_0x3c7b('0x1'));var path=require('path');var timeout=require(_0x3c7b('0x2'));var express=require(_0x3c7b('0x3'));var router=express[_0x3c7b('0x4')]();var auth=require(_0x3c7b('0x5'));var interaction=require(_0x3c7b('0x6'));var config=require(_0x3c7b('0x7'));var controller=require('./network.controller');router[_0x3c7b('0x8')]('/',auth[_0x3c7b('0x9')](),controller[_0x3c7b('0xa')]);router['get'](_0x3c7b('0xb'),auth[_0x3c7b('0x9')](),controller['show']);router[_0x3c7b('0xc')]('/',auth[_0x3c7b('0x9')](),controller['create']);router[_0x3c7b('0xd')](_0x3c7b('0xb'),auth[_0x3c7b('0x9')](),controller['update']);router[_0x3c7b('0xe')]('/:id',auth[_0x3c7b('0x9')](),controller[_0x3c7b('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 597bec9..6cdae04 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 _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x4c0bb0,_0x155af2){var _0x2ef50b=function(_0x10d114){while(--_0x10d114){_0x4c0bb0['push'](_0x4c0bb0['shift']());}};_0x2ef50b(++_0x155af2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file +var _0xa9e0=['STRING','sequelize','exports','ENUM','stun'];(function(_0x5c34ad,_0x376e04){var _0x1c38d8=function(_0x4ace9f){while(--_0x4ace9f){_0x5c34ad['push'](_0x5c34ad['shift']());}};_0x1c38d8(++_0x376e04);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'type':{'type':Sequelize[_0x0a9e('0x2')]('localnet','externip',_0x0a9e('0x3'),'turn')},'value':{'type':Sequelize[_0x0a9e('0x4')]},'username':{'type':Sequelize[_0x0a9e('0x4')]},'password':{'type':Sequelize[_0x0a9e('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index cd8fa04..604703b 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 _0x02fe=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','then','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Network,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','Network','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','rows','show','params','include','find','sequelize','transaction','create','body','findAll','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','writeFileSync','Reload','res_stun_monitor.so','TURN','utf8','render','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','toUpperCase','/etc/asterisk/stun_xcally.conf','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x5085c1,_0x222c2a){var _0x399a43=function(_0x2cfd2d){while(--_0x2cfd2d){_0x5085c1['push'](_0x5085c1['shift']());}};_0x399a43(++_0x222c2a);}(_0x02fe,0x1b8));var _0xe02f=function(_0x46015e,_0x3a20f9){_0x46015e=_0x46015e-0x0;var _0x3c1bfc=_0x02fe[_0x46015e];return _0x3c1bfc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe02f('0x0'));var rimraf=require(_0xe02f('0x1'));var zipdir=require(_0xe02f('0x2'));var jsonpatch=require(_0xe02f('0x3'));var rp=require(_0xe02f('0x4'));var moment=require(_0xe02f('0x5'));var BPromise=require(_0xe02f('0x6'));var Mustache=require(_0xe02f('0x7'));var util=require(_0xe02f('0x8'));var path=require(_0xe02f('0x9'));var sox=require(_0xe02f('0xa'));var csv=require(_0xe02f('0xb'));var ejs=require(_0xe02f('0xc'));var fs=require('fs');var _=require(_0xe02f('0xd'));var squel=require(_0xe02f('0xe'));var crypto=require(_0xe02f('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xe02f('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe02f('0x11'));var Papa=require(_0xe02f('0x12'));var Redis=require(_0xe02f('0x13'));var authService=require(_0xe02f('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe02f('0x15'));var hardwareService=require(_0xe02f('0x16'));var logger=require(_0xe02f('0x17'))(_0xe02f('0x18'));var utils=require(_0xe02f('0x19'));var config=require(_0xe02f('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xe02f('0x1b'))['db'];var jayson=require(_0xe02f('0x1c'));var client=jayson[_0xe02f('0x1d')][_0xe02f('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x445c46,_0x4e6c5d,_0x58eaa3,_0x2ef418){return new BPromise(function(_0x1fe881,_0x35fe54){var _0x5ed618=_0x2ef418||client;return _0x5ed618['request'](_0x445c46,_0x58eaa3)[_0xe02f('0x1f')](function(_0x3cdec3){logger['info']('Network,\x20%s,\x20%s',_0x4e6c5d,'request\x20sent');logger[_0xe02f('0x20')](_0xe02f('0x21'),_0x4e6c5d,_0xe02f('0x22'),JSON[_0xe02f('0x23')](_0x3cdec3));if(_0x3cdec3['error']){if(_0x3cdec3[_0xe02f('0x24')][_0xe02f('0x25')]===0x1f4){logger[_0xe02f('0x24')](_0xe02f('0x26'),_0x4e6c5d,_0x3cdec3['error']['message']);return _0x35fe54(_0x3cdec3[_0xe02f('0x24')]['message']);}logger[_0xe02f('0x24')](_0xe02f('0x26'),_0x4e6c5d,_0x3cdec3[_0xe02f('0x24')][_0xe02f('0x27')]);return _0x1fe881(_0x3cdec3[_0xe02f('0x24')][_0xe02f('0x27')]);}else{logger[_0xe02f('0x28')]('Network,\x20%s,\x20%s',_0x4e6c5d,'request\x20sent');_0x1fe881(_0x3cdec3[_0xe02f('0x29')][_0xe02f('0x27')]);}})[_0xe02f('0x2a')](function(_0x246c73){logger['error'](_0xe02f('0x26'),_0x4e6c5d,_0x246c73);_0x35fe54(_0x246c73);});});}function respondWithStatusCode(_0x272608,_0x53dfaa){_0x53dfaa=_0x53dfaa||0xcc;return function(_0x41ecc2){if(_0x41ecc2){return _0x272608[_0xe02f('0x2b')](_0x53dfaa);}return _0x272608[_0xe02f('0x2c')](_0x53dfaa)[_0xe02f('0x2d')]();};}function respondWithResult(_0xcd2da3,_0x4a986a){_0x4a986a=_0x4a986a||0xc8;return function(_0xf5644){if(_0xf5644){return _0xcd2da3['status'](_0x4a986a)[_0xe02f('0x2e')](_0xf5644);}};}function respondWithFilteredResult(_0x4fa9ea,_0xd35be5){return function(_0x314ecf){if(_0x314ecf){var _0x1d69ff=_0x314ecf[_0xe02f('0x2f')],_0xa8d9ee=_0xd35be5[_0xe02f('0x30')],_0x18ce7c=_0xd35be5[_0xe02f('0x30')]+_0xd35be5[_0xe02f('0x31')],_0x35b481;if(_0x18ce7c>=_0x1d69ff){_0x18ce7c=_0x1d69ff;_0x35b481=0xc8;}else{_0x35b481=0xce;}_0x4fa9ea['status'](_0x35b481);return _0x4fa9ea[_0xe02f('0x32')](_0xe02f('0x33'),_0xa8d9ee+'-'+_0x18ce7c+'/'+_0x1d69ff)[_0xe02f('0x2e')](_0x314ecf);}return null;};}function patchUpdates(_0x29ede1){return function(_0x389d59){try{jsonpatch[_0xe02f('0x34')](_0x389d59,_0x29ede1,!![]);}catch(_0x25601c){return BPromise[_0xe02f('0x35')](_0x25601c);}return _0x389d59[_0xe02f('0x36')]();};}function saveUpdates(_0xdd06d,_0x58fe33){return function(_0x4d5c23){if(_0x4d5c23){return _0x4d5c23[_0xe02f('0x37')](_0xdd06d)[_0xe02f('0x1f')](function(_0x141267){return _0x141267;});}return null;};}function removeEntity(_0x285561,_0x5a4a9e){return function(_0x320bec){if(_0x320bec){return _0x320bec[_0xe02f('0x38')]()['then'](function(){_0x285561['status'](0xcc)[_0xe02f('0x2d')]();});}};}function handleEntityNotFound(_0x38d6f2,_0x3a0bab){return function(_0x55ffe6){if(!_0x55ffe6){_0x38d6f2[_0xe02f('0x2b')](0x194);}return _0x55ffe6;};}function handleError(_0x2500fa,_0x70e878){_0x70e878=_0x70e878||0x1f4;return function(_0x5f35a1){logger[_0xe02f('0x24')](_0x5f35a1[_0xe02f('0x39')]);if(_0x5f35a1['name']){delete _0x5f35a1[_0xe02f('0x3a')];}_0x2500fa[_0xe02f('0x2c')](_0x70e878)['send'](_0x5f35a1);};}exports[_0xe02f('0x3b')]=function(_0x50f294,_0x4acd22){var _0x3fb321={},_0x5bd86e={},_0x279576={'count':0x0,'rows':[]};var _0x554fa2=_[_0xe02f('0x3c')](db[_0xe02f('0x3d')]['rawAttributes'],function(_0x4db336){return{'name':_0x4db336[_0xe02f('0x3e')],'type':_0x4db336[_0xe02f('0x3f')][_0xe02f('0x40')]};});_0x5bd86e[_0xe02f('0x41')]=_[_0xe02f('0x3c')](_0x554fa2,_0xe02f('0x3a'));_0x5bd86e[_0xe02f('0x42')]=_[_0xe02f('0x43')](_0x50f294[_0xe02f('0x42')]);_0x5bd86e[_0xe02f('0x44')]=_['intersection'](_0x5bd86e[_0xe02f('0x41')],_0x5bd86e[_0xe02f('0x42')]);_0x3fb321[_0xe02f('0x45')]=_[_0xe02f('0x46')](_0x5bd86e[_0xe02f('0x41')],qs[_0xe02f('0x47')](_0x50f294['query'][_0xe02f('0x47')]));_0x3fb321[_0xe02f('0x45')]=_0x3fb321[_0xe02f('0x45')][_0xe02f('0x48')]?_0x3fb321[_0xe02f('0x45')]:_0x5bd86e[_0xe02f('0x41')];if(!_0x50f294[_0xe02f('0x42')][_0xe02f('0x49')](_0xe02f('0x4a'))){_0x3fb321[_0xe02f('0x31')]=qs[_0xe02f('0x31')](_0x50f294['query']['limit']);_0x3fb321[_0xe02f('0x30')]=qs[_0xe02f('0x30')](_0x50f294['query'][_0xe02f('0x30')]);}_0x3fb321[_0xe02f('0x4b')]=qs[_0xe02f('0x4c')](_0x50f294[_0xe02f('0x42')][_0xe02f('0x4c')]);_0x3fb321[_0xe02f('0x4d')]=qs['filters'](_['pick'](_0x50f294['query'],_0x5bd86e[_0xe02f('0x44')]),_0x554fa2);if(_0x50f294['query'][_0xe02f('0x4e')]){_0x3fb321[_0xe02f('0x4d')]=_[_0xe02f('0x4f')](_0x3fb321['where'],{'$or':_[_0xe02f('0x3c')](_0x554fa2,function(_0x6c1946){if(_0x6c1946['type']!==_0xe02f('0x50')){var _0x3fe9a7={};_0x3fe9a7[_0x6c1946[_0xe02f('0x3a')]]={'$like':'%'+_0x50f294['query'][_0xe02f('0x4e')]+'%'};return _0x3fe9a7;}})});}_0x3fb321=_[_0xe02f('0x4f')]({},_0x3fb321,_0x50f294['options']);var _0x212b27={'where':_0x3fb321[_0xe02f('0x4d')]};return db[_0xe02f('0x3d')][_0xe02f('0x2f')](_0x212b27)[_0xe02f('0x1f')](function(_0x3c0114){_0x279576[_0xe02f('0x2f')]=_0x3c0114;if(_0x50f294[_0xe02f('0x42')][_0xe02f('0x51')]){_0x3fb321['include']=[{'all':!![]}];}return db[_0xe02f('0x3d')]['findAll'](_0x3fb321);})[_0xe02f('0x1f')](function(_0x5b17c8){_0x279576[_0xe02f('0x52')]=_0x5b17c8;return _0x279576;})[_0xe02f('0x1f')](respondWithFilteredResult(_0x4acd22,_0x3fb321))[_0xe02f('0x2a')](handleError(_0x4acd22,null));};exports[_0xe02f('0x53')]=function(_0x27b8a9,_0x3c0883){var _0x30c4ec={'raw':!![],'where':{'id':_0x27b8a9[_0xe02f('0x54')]['id']}},_0x2de3ce={};_0x2de3ce['model']=_[_0xe02f('0x43')](db[_0xe02f('0x3d')]['rawAttributes']);_0x2de3ce[_0xe02f('0x42')]=_[_0xe02f('0x43')](_0x27b8a9[_0xe02f('0x42')]);_0x2de3ce[_0xe02f('0x44')]=_[_0xe02f('0x46')](_0x2de3ce[_0xe02f('0x41')],_0x2de3ce['query']);_0x30c4ec[_0xe02f('0x45')]=_['intersection'](_0x2de3ce[_0xe02f('0x41')],qs[_0xe02f('0x47')](_0x27b8a9['query']['fields']));_0x30c4ec[_0xe02f('0x45')]=_0x30c4ec['attributes']['length']?_0x30c4ec[_0xe02f('0x45')]:_0x2de3ce[_0xe02f('0x41')];if(_0x27b8a9[_0xe02f('0x42')][_0xe02f('0x51')]){_0x30c4ec[_0xe02f('0x55')]=[{'all':!![]}];}_0x30c4ec=_[_0xe02f('0x4f')]({},_0x30c4ec,_0x27b8a9['options']);return db['Network'][_0xe02f('0x56')](_0x30c4ec)[_0xe02f('0x1f')](handleEntityNotFound(_0x3c0883,null))[_0xe02f('0x1f')](respondWithResult(_0x3c0883,null))[_0xe02f('0x2a')](handleError(_0x3c0883,null));};exports['create']=function(_0x1d31e4,_0x1e8169,_0x3f8e92){var _0x1926fd;return db[_0xe02f('0x57')][_0xe02f('0x58')](function(_0x1f40cd){return db[_0xe02f('0x3d')][_0xe02f('0x59')](_0x1d31e4[_0xe02f('0x5a')],{'raw':!![]})[_0xe02f('0x1f')](function(_0x3cb43f){_0x1926fd=_0x3cb43f;return db[_0xe02f('0x3d')][_0xe02f('0x5b')]({'where':{'type':_0x1d31e4['body']['type']},'raw':!![]});})[_0xe02f('0x1f')](function(_0x4cd2e2){if(_0x1926fd[_0xe02f('0x3f')]['toUpperCase']()==_0xe02f('0x5c')){var _0x587eec=fs[_0xe02f('0x5d')](path[_0xe02f('0x5e')](config[_0xe02f('0x5f')],_0xe02f('0x60')),'utf8');var _0x119a62=ejs['render'](_0x587eec,{'networks':_0x4cd2e2||[]});fs[_0xe02f('0x61')]('/etc/asterisk/stun_xcally.conf',_0x119a62);return respondWithRpcPromise(_0xe02f('0x62'),_0xe02f('0x59'),{'module':_0xe02f('0x63')});}else if(_0x1926fd[_0xe02f('0x3f')]['toUpperCase']()==_0xe02f('0x64')){var _0x5e472d=fs[_0xe02f('0x5d')](path[_0xe02f('0x5e')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xe02f('0x65'));var _0xf224f4=ejs[_0xe02f('0x66')](_0x5e472d,{'networks':_0x4cd2e2||[]});fs[_0xe02f('0x61')](_0xe02f('0x67'),_0xf224f4);return respondWithRpcPromise(_0xe02f('0x62'),'create',{'module':_0xe02f('0x63')});}else{var _0x1f23d7=fs[_0xe02f('0x5d')](path[_0xe02f('0x5e')](config[_0xe02f('0x5f')],_0xe02f('0x68')),'utf8');var _0x3ce900=ejs[_0xe02f('0x66')](_0x1f23d7,{'networks':_0x4cd2e2||[]});fs['writeFileSync'](util[_0xe02f('0x69')](_0xe02f('0x6a'),_0x1d31e4[_0xe02f('0x5a')][_0xe02f('0x3f')][_0xe02f('0x6b')]()),_0x3ce900);return respondWithRpcPromise(_0xe02f('0x62'),_0xe02f('0x59'),{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x1926fd;});})[_0xe02f('0x1f')](respondWithResult(_0x1e8169,0xc9))[_0xe02f('0x2a')](handleError(_0x1e8169,null));};exports[_0xe02f('0x37')]=function(_0x31e85f,_0x2e1631,_0x1dca35){var _0x552869;return db[_0xe02f('0x57')][_0xe02f('0x58')](function(_0x207c40){return db[_0xe02f('0x3d')]['find']({'where':{'id':_0x31e85f['params']['id']}})[_0xe02f('0x1f')](handleEntityNotFound(_0x2e1631,null))[_0xe02f('0x1f')](saveUpdates(_0x31e85f[_0xe02f('0x5a')],null))['then'](function(_0x4ebb8e){if(_0x4ebb8e){_0x552869=_0x4ebb8e;return db['Network'][_0xe02f('0x5b')]({'where':{'type':_0x552869[_0xe02f('0x3f')]},'raw':!![]});}return null;})['then'](function(_0x3a05e5){if(_0x552869[_0xe02f('0x3f')][_0xe02f('0x6c')]()=='STUN'){var _0x1483bd=fs[_0xe02f('0x5d')](path[_0xe02f('0x5e')](config[_0xe02f('0x5f')],_0xe02f('0x60')),'utf8');var _0x296e5e=ejs['render'](_0x1483bd,{'networks':_0x3a05e5||[]});fs[_0xe02f('0x61')](_0xe02f('0x6d'),_0x296e5e);return respondWithRpcPromise(_0xe02f('0x62'),'update',{'module':'res_stun_monitor.so'});}else if(_0x552869[_0xe02f('0x3f')][_0xe02f('0x6c')]()==_0xe02f('0x64')){var _0x562adb=fs['readFileSync'](path[_0xe02f('0x5e')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xe02f('0x65'));var _0x58ab89=ejs[_0xe02f('0x66')](_0x562adb,{'networks':_0x3a05e5||[]});fs[_0xe02f('0x61')](_0xe02f('0x67'),_0x58ab89);return respondWithRpcPromise(_0xe02f('0x62'),_0xe02f('0x37'),{'module':_0xe02f('0x63')});}else{var _0x1de5cd=fs[_0xe02f('0x5d')](path[_0xe02f('0x5e')](config['root'],_0xe02f('0x68')),'utf8');var _0x3eb6b3=ejs[_0xe02f('0x66')](_0x1de5cd,{'networks':_0x3a05e5||[]});fs[_0xe02f('0x61')](util[_0xe02f('0x69')](_0xe02f('0x6a'),_0x31e85f['body'][_0xe02f('0x3f')]['toLowerCase']()),_0x3eb6b3);return respondWithRpcPromise('Reload',_0xe02f('0x37'),{'module':_0xe02f('0x6e')});}return null;})[_0xe02f('0x1f')](function(_0x952607){if(_0x952607){return _0x552869;}return null;});})[_0xe02f('0x1f')](respondWithResult(_0x2e1631,null))['catch'](handleError(_0x2e1631,null));};exports['destroy']=function(_0x4212ad,_0x548036,_0x341619){var _0x3c8e63;return db['Network'][_0xe02f('0x56')]({'where':{'id':_0x4212ad[_0xe02f('0x54')]['id']}})[_0xe02f('0x1f')](function(_0x45c845){_0x3c8e63=_0x45c845;return _0x45c845;})[_0xe02f('0x1f')](handleEntityNotFound(_0x548036,null))['then'](removeEntity(_0x548036,null))[_0xe02f('0x1f')](function(){if(_0x3c8e63){return db['Network'][_0xe02f('0x5b')]({'where':{'type':_0x3c8e63['type']},'raw':!![]});}})[_0xe02f('0x1f')](function(_0x40592b){if(_0x3c8e63[_0xe02f('0x3f')][_0xe02f('0x6c')]()==_0xe02f('0x5c')){var _0x4edfa6=fs[_0xe02f('0x5d')](path[_0xe02f('0x5e')](config[_0xe02f('0x5f')],'server/files/templates/stun_multiple.ejs'),_0xe02f('0x65'));var _0x402682=ejs[_0xe02f('0x66')](_0x4edfa6,{'networks':_0x40592b||[]});fs[_0xe02f('0x61')](_0xe02f('0x6d'),_0x402682);return respondWithRpcPromise('Reload','destroy',{'module':_0xe02f('0x63')});}else if(_0x3c8e63['type'][_0xe02f('0x6c')]()==_0xe02f('0x64')){var _0x131634=fs['readFileSync'](path[_0xe02f('0x5e')](config[_0xe02f('0x5f')],'server/files/templates/turn_multiple.ejs'),_0xe02f('0x65'));var _0x2b94f5=ejs['render'](_0x131634,{'networks':_0x40592b||[]});fs[_0xe02f('0x61')](_0xe02f('0x67'),_0x2b94f5);return respondWithRpcPromise(_0xe02f('0x62'),_0xe02f('0x38'),{'module':_0xe02f('0x63')});}else{var _0x5e4920=fs[_0xe02f('0x5d')](path[_0xe02f('0x5e')](config[_0xe02f('0x5f')],'server/files/templates/network.ejs'),_0xe02f('0x65'));var _0x4e4091=ejs[_0xe02f('0x66')](_0x5e4920,{'networks':_0x40592b||[]});fs[_0xe02f('0x61')](util[_0xe02f('0x69')](_0xe02f('0x6a'),_0x4212ad[_0xe02f('0x5a')][_0xe02f('0x3f')][_0xe02f('0x6b')]()),_0x4e4091);return respondWithRpcPromise(_0xe02f('0x62'),'destroy',{'module':_0xe02f('0x6e')});}return null;})[_0xe02f('0x2a')](handleError(_0x548036,null));}; \ No newline at end of file +var _0x0c97=['key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','filter','count','includeAll','include','findAll','rows','show','params','keys','options','find','create','transaction','body','STUN','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','sequelize','toUpperCase','server/files/templates/stun_multiple.ejs','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','Content-Range','json','reject','save','update','destroy','stack','name','send','index','map','Network','rawAttributes','fieldName'];(function(_0x501d0c,_0x3dcef6){var _0x1d5a44=function(_0x10d889){while(--_0x10d889){_0x501d0c['push'](_0x501d0c['shift']());}};_0x1d5a44(++_0x3dcef6);}(_0x0c97,0x9f));var _0x70c9=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0x0c97[_0x2ff238];return _0x204a56;};'use strict';var pdf=require(_0x70c9('0x0'));var emlformat=require(_0x70c9('0x1'));var rimraf=require(_0x70c9('0x2'));var zipdir=require(_0x70c9('0x3'));var jsonpatch=require(_0x70c9('0x4'));var rp=require('request-promise');var moment=require(_0x70c9('0x5'));var BPromise=require(_0x70c9('0x6'));var Mustache=require(_0x70c9('0x7'));var util=require('util');var path=require('path');var sox=require(_0x70c9('0x8'));var csv=require(_0x70c9('0x9'));var ejs=require(_0x70c9('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x70c9('0xb'));var jsforce=require(_0x70c9('0xc'));var deskjs=require(_0x70c9('0xd'));var toCsv=require('to-csv');var querystring=require(_0x70c9('0xe'));var Papa=require(_0x70c9('0xf'));var Redis=require(_0x70c9('0x10'));var authService=require(_0x70c9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x70c9('0x12'));var hardwareService=require(_0x70c9('0x13'));var logger=require('../../config/logger')(_0x70c9('0x14'));var utils=require(_0x70c9('0x15'));var config=require(_0x70c9('0x16'));var licenseUtil=require(_0x70c9('0x17'));var db=require(_0x70c9('0x18'))['db'];var jayson=require(_0x70c9('0x19'));var client=jayson['client'][_0x70c9('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5e48ad,_0x2155f0,_0xd8f431,_0x93194d){return new BPromise(function(_0x1c1c95,_0x468775){var _0x5a1a6e=_0x93194d||client;return _0x5a1a6e[_0x70c9('0x1b')](_0x5e48ad,_0xd8f431)[_0x70c9('0x1c')](function(_0x2dee44){logger['info'](_0x70c9('0x1d'),_0x2155f0,_0x70c9('0x1e'));logger['debug'](_0x70c9('0x1f'),_0x2155f0,_0x70c9('0x1e'),JSON[_0x70c9('0x20')](_0x2dee44));if(_0x2dee44[_0x70c9('0x21')]){if(_0x2dee44[_0x70c9('0x21')][_0x70c9('0x22')]===0x1f4){logger[_0x70c9('0x21')](_0x70c9('0x1d'),_0x2155f0,_0x2dee44[_0x70c9('0x21')]['message']);return _0x468775(_0x2dee44['error'][_0x70c9('0x23')]);}logger['error']('Network,\x20%s,\x20%s',_0x2155f0,_0x2dee44['error'][_0x70c9('0x23')]);return _0x1c1c95(_0x2dee44[_0x70c9('0x21')][_0x70c9('0x23')]);}else{logger['info'](_0x70c9('0x1d'),_0x2155f0,_0x70c9('0x1e'));_0x1c1c95(_0x2dee44[_0x70c9('0x24')][_0x70c9('0x23')]);}})[_0x70c9('0x25')](function(_0x44c10f){logger[_0x70c9('0x21')](_0x70c9('0x1d'),_0x2155f0,_0x44c10f);_0x468775(_0x44c10f);});});}function respondWithStatusCode(_0xc87591,_0x9d174c){_0x9d174c=_0x9d174c||0xcc;return function(_0x1c30e3){if(_0x1c30e3){return _0xc87591[_0x70c9('0x26')](_0x9d174c);}return _0xc87591[_0x70c9('0x27')](_0x9d174c)[_0x70c9('0x28')]();};}function respondWithResult(_0x1f29b2,_0x41e646){_0x41e646=_0x41e646||0xc8;return function(_0x233a96){if(_0x233a96){return _0x1f29b2[_0x70c9('0x27')](_0x41e646)['json'](_0x233a96);}};}function respondWithFilteredResult(_0x3f3470,_0x4c9d4c){return function(_0x2cccf8){if(_0x2cccf8){var _0x5497ad=_0x2cccf8['count'],_0x396b61=_0x4c9d4c[_0x70c9('0x29')],_0x5e97bc=_0x4c9d4c[_0x70c9('0x29')]+_0x4c9d4c[_0x70c9('0x2a')],_0x5ef387;if(_0x5e97bc>=_0x5497ad){_0x5e97bc=_0x5497ad;_0x5ef387=0xc8;}else{_0x5ef387=0xce;}_0x3f3470[_0x70c9('0x27')](_0x5ef387);return _0x3f3470['set'](_0x70c9('0x2b'),_0x396b61+'-'+_0x5e97bc+'/'+_0x5497ad)[_0x70c9('0x2c')](_0x2cccf8);}return null;};}function patchUpdates(_0x5d3177){return function(_0x393b39){try{jsonpatch['apply'](_0x393b39,_0x5d3177,!![]);}catch(_0x57082c){return BPromise[_0x70c9('0x2d')](_0x57082c);}return _0x393b39[_0x70c9('0x2e')]();};}function saveUpdates(_0x52b106,_0x2375ed){return function(_0x43c645){if(_0x43c645){return _0x43c645[_0x70c9('0x2f')](_0x52b106)['then'](function(_0xaba385){return _0xaba385;});}return null;};}function removeEntity(_0x218a22,_0x39d790){return function(_0x149849){if(_0x149849){return _0x149849[_0x70c9('0x30')]()['then'](function(){_0x218a22[_0x70c9('0x27')](0xcc)[_0x70c9('0x28')]();});}};}function handleEntityNotFound(_0x1af4f1,_0x14bfd1){return function(_0x36b396){if(!_0x36b396){_0x1af4f1[_0x70c9('0x26')](0x194);}return _0x36b396;};}function handleError(_0x22a0a5,_0x3df833){_0x3df833=_0x3df833||0x1f4;return function(_0x26a13c){logger[_0x70c9('0x21')](_0x26a13c[_0x70c9('0x31')]);if(_0x26a13c[_0x70c9('0x32')]){delete _0x26a13c[_0x70c9('0x32')];}_0x22a0a5[_0x70c9('0x27')](_0x3df833)[_0x70c9('0x33')](_0x26a13c);};}exports[_0x70c9('0x34')]=function(_0x55bdbe,_0x5cdcd8){var _0x1aac4f={},_0x475c93={},_0x3610ea={'count':0x0,'rows':[]};var _0x430980=_[_0x70c9('0x35')](db[_0x70c9('0x36')][_0x70c9('0x37')],function(_0x1d26d8){return{'name':_0x1d26d8[_0x70c9('0x38')],'type':_0x1d26d8['type'][_0x70c9('0x39')]};});_0x475c93[_0x70c9('0x3a')]=_[_0x70c9('0x35')](_0x430980,'name');_0x475c93[_0x70c9('0x3b')]=_['keys'](_0x55bdbe[_0x70c9('0x3b')]);_0x475c93['filters']=_['intersection'](_0x475c93[_0x70c9('0x3a')],_0x475c93[_0x70c9('0x3b')]);_0x1aac4f['attributes']=_[_0x70c9('0x3c')](_0x475c93[_0x70c9('0x3a')],qs[_0x70c9('0x3d')](_0x55bdbe[_0x70c9('0x3b')]['fields']));_0x1aac4f[_0x70c9('0x3e')]=_0x1aac4f['attributes'][_0x70c9('0x3f')]?_0x1aac4f[_0x70c9('0x3e')]:_0x475c93['model'];if(!_0x55bdbe[_0x70c9('0x3b')][_0x70c9('0x40')](_0x70c9('0x41'))){_0x1aac4f[_0x70c9('0x2a')]=qs[_0x70c9('0x2a')](_0x55bdbe[_0x70c9('0x3b')]['limit']);_0x1aac4f['offset']=qs['offset'](_0x55bdbe[_0x70c9('0x3b')][_0x70c9('0x29')]);}_0x1aac4f['order']=qs[_0x70c9('0x42')](_0x55bdbe[_0x70c9('0x3b')][_0x70c9('0x42')]);_0x1aac4f[_0x70c9('0x43')]=qs[_0x70c9('0x44')](_[_0x70c9('0x45')](_0x55bdbe[_0x70c9('0x3b')],_0x475c93[_0x70c9('0x44')]),_0x430980);if(_0x55bdbe[_0x70c9('0x3b')]['filter']){_0x1aac4f['where']=_[_0x70c9('0x46')](_0x1aac4f['where'],{'$or':_['map'](_0x430980,function(_0x5bcb59){if(_0x5bcb59[_0x70c9('0x47')]!==_0x70c9('0x48')){var _0x95cb13={};_0x95cb13[_0x5bcb59[_0x70c9('0x32')]]={'$like':'%'+_0x55bdbe[_0x70c9('0x3b')][_0x70c9('0x49')]+'%'};return _0x95cb13;}})});}_0x1aac4f=_['merge']({},_0x1aac4f,_0x55bdbe['options']);var _0x579ae1={'where':_0x1aac4f[_0x70c9('0x43')]};return db['Network'][_0x70c9('0x4a')](_0x579ae1)['then'](function(_0x4bb585){_0x3610ea[_0x70c9('0x4a')]=_0x4bb585;if(_0x55bdbe['query'][_0x70c9('0x4b')]){_0x1aac4f[_0x70c9('0x4c')]=[{'all':!![]}];}return db[_0x70c9('0x36')][_0x70c9('0x4d')](_0x1aac4f);})[_0x70c9('0x1c')](function(_0x2a56d5){_0x3610ea[_0x70c9('0x4e')]=_0x2a56d5;return _0x3610ea;})[_0x70c9('0x1c')](respondWithFilteredResult(_0x5cdcd8,_0x1aac4f))[_0x70c9('0x25')](handleError(_0x5cdcd8,null));};exports[_0x70c9('0x4f')]=function(_0x50fe6f,_0x4f257d){var _0x102477={'raw':!![],'where':{'id':_0x50fe6f[_0x70c9('0x50')]['id']}},_0x1b28a1={};_0x1b28a1[_0x70c9('0x3a')]=_[_0x70c9('0x51')](db[_0x70c9('0x36')][_0x70c9('0x37')]);_0x1b28a1[_0x70c9('0x3b')]=_[_0x70c9('0x51')](_0x50fe6f['query']);_0x1b28a1[_0x70c9('0x44')]=_[_0x70c9('0x3c')](_0x1b28a1['model'],_0x1b28a1[_0x70c9('0x3b')]);_0x102477['attributes']=_[_0x70c9('0x3c')](_0x1b28a1[_0x70c9('0x3a')],qs['fields'](_0x50fe6f[_0x70c9('0x3b')][_0x70c9('0x3d')]));_0x102477[_0x70c9('0x3e')]=_0x102477['attributes'][_0x70c9('0x3f')]?_0x102477[_0x70c9('0x3e')]:_0x1b28a1[_0x70c9('0x3a')];if(_0x50fe6f[_0x70c9('0x3b')][_0x70c9('0x4b')]){_0x102477[_0x70c9('0x4c')]=[{'all':!![]}];}_0x102477=_[_0x70c9('0x46')]({},_0x102477,_0x50fe6f[_0x70c9('0x52')]);return db[_0x70c9('0x36')][_0x70c9('0x53')](_0x102477)[_0x70c9('0x1c')](handleEntityNotFound(_0x4f257d,null))[_0x70c9('0x1c')](respondWithResult(_0x4f257d,null))[_0x70c9('0x25')](handleError(_0x4f257d,null));};exports[_0x70c9('0x54')]=function(_0x376b98,_0x11667b,_0x3a887e){var _0x5cafb9;return db['sequelize'][_0x70c9('0x55')](function(_0xe82d){return db[_0x70c9('0x36')][_0x70c9('0x54')](_0x376b98[_0x70c9('0x56')],{'raw':!![]})['then'](function(_0x384155){_0x5cafb9=_0x384155;return db['Network'][_0x70c9('0x4d')]({'where':{'type':_0x376b98[_0x70c9('0x56')][_0x70c9('0x47')]},'raw':!![]});})['then'](function(_0xe25923){if(_0x5cafb9[_0x70c9('0x47')]['toUpperCase']()==_0x70c9('0x57')){var _0x10d75b=fs[_0x70c9('0x58')](path[_0x70c9('0x59')](config[_0x70c9('0x5a')],'server/files/templates/stun_multiple.ejs'),_0x70c9('0x5b'));var _0x5b0b1f=ejs[_0x70c9('0x5c')](_0x10d75b,{'networks':_0xe25923||[]});fs[_0x70c9('0x5d')](_0x70c9('0x5e'),_0x5b0b1f);return respondWithRpcPromise(_0x70c9('0x5f'),_0x70c9('0x54'),{'module':'res_stun_monitor.so'});}else if(_0x5cafb9[_0x70c9('0x47')]['toUpperCase']()==_0x70c9('0x60')){var _0x11f2c0=fs[_0x70c9('0x58')](path[_0x70c9('0x59')](config[_0x70c9('0x5a')],'server/files/templates/turn_multiple.ejs'),_0x70c9('0x5b'));var _0x93bde4=ejs['render'](_0x11f2c0,{'networks':_0xe25923||[]});fs[_0x70c9('0x5d')](_0x70c9('0x61'),_0x93bde4);return respondWithRpcPromise('Reload',_0x70c9('0x54'),{'module':'res_stun_monitor.so'});}else{var _0x1b0786=fs[_0x70c9('0x58')](path['join'](config['root'],_0x70c9('0x62')),'utf8');var _0x1c70ce=ejs[_0x70c9('0x5c')](_0x1b0786,{'networks':_0xe25923||[]});fs[_0x70c9('0x5d')](util[_0x70c9('0x63')](_0x70c9('0x64'),_0x376b98[_0x70c9('0x56')]['type'][_0x70c9('0x65')]()),_0x1c70ce);return respondWithRpcPromise(_0x70c9('0x5f'),'create',{'module':_0x70c9('0x66')});}return null;})[_0x70c9('0x1c')](function(){return _0x5cafb9;});})['then'](respondWithResult(_0x11667b,0xc9))[_0x70c9('0x25')](handleError(_0x11667b,null));};exports['update']=function(_0x1f658a,_0x44245e,_0x7e4be2){var _0x43baf2;return db[_0x70c9('0x67')]['transaction'](function(_0x2dbc63){return db[_0x70c9('0x36')][_0x70c9('0x53')]({'where':{'id':_0x1f658a['params']['id']}})[_0x70c9('0x1c')](handleEntityNotFound(_0x44245e,null))['then'](saveUpdates(_0x1f658a[_0x70c9('0x56')],null))[_0x70c9('0x1c')](function(_0x594061){if(_0x594061){_0x43baf2=_0x594061;return db[_0x70c9('0x36')][_0x70c9('0x4d')]({'where':{'type':_0x43baf2['type']},'raw':!![]});}return null;})[_0x70c9('0x1c')](function(_0x1e05d4){if(_0x43baf2[_0x70c9('0x47')][_0x70c9('0x68')]()==_0x70c9('0x57')){var _0x827af4=fs[_0x70c9('0x58')](path['join'](config[_0x70c9('0x5a')],_0x70c9('0x69')),_0x70c9('0x5b'));var _0x1518c4=ejs[_0x70c9('0x5c')](_0x827af4,{'networks':_0x1e05d4||[]});fs[_0x70c9('0x5d')](_0x70c9('0x5e'),_0x1518c4);return respondWithRpcPromise('Reload',_0x70c9('0x2f'),{'module':_0x70c9('0x6a')});}else if(_0x43baf2[_0x70c9('0x47')]['toUpperCase']()==_0x70c9('0x60')){var _0x33a305=fs[_0x70c9('0x58')](path['join'](config[_0x70c9('0x5a')],_0x70c9('0x6b')),_0x70c9('0x5b'));var _0x455485=ejs['render'](_0x33a305,{'networks':_0x1e05d4||[]});fs['writeFileSync'](_0x70c9('0x61'),_0x455485);return respondWithRpcPromise(_0x70c9('0x5f'),_0x70c9('0x2f'),{'module':'res_stun_monitor.so'});}else{var _0x50731a=fs['readFileSync'](path['join'](config[_0x70c9('0x5a')],_0x70c9('0x62')),'utf8');var _0x36ad5a=ejs['render'](_0x50731a,{'networks':_0x1e05d4||[]});fs[_0x70c9('0x5d')](util[_0x70c9('0x63')](_0x70c9('0x64'),_0x1f658a[_0x70c9('0x56')][_0x70c9('0x47')][_0x70c9('0x65')]()),_0x36ad5a);return respondWithRpcPromise(_0x70c9('0x5f'),_0x70c9('0x2f'),{'module':_0x70c9('0x66')});}return null;})[_0x70c9('0x1c')](function(_0x12e192){if(_0x12e192){return _0x43baf2;}return null;});})[_0x70c9('0x1c')](respondWithResult(_0x44245e,null))[_0x70c9('0x25')](handleError(_0x44245e,null));};exports[_0x70c9('0x30')]=function(_0x1782a1,_0x3575b1,_0x36b5db){var _0x239868;return db['Network'][_0x70c9('0x53')]({'where':{'id':_0x1782a1['params']['id']}})[_0x70c9('0x1c')](function(_0x17bb17){_0x239868=_0x17bb17;return _0x17bb17;})[_0x70c9('0x1c')](handleEntityNotFound(_0x3575b1,null))['then'](removeEntity(_0x3575b1,null))[_0x70c9('0x1c')](function(){if(_0x239868){return db[_0x70c9('0x36')]['findAll']({'where':{'type':_0x239868['type']},'raw':!![]});}})['then'](function(_0x253af9){if(_0x239868['type'][_0x70c9('0x68')]()==_0x70c9('0x57')){var _0x3e1c30=fs[_0x70c9('0x58')](path[_0x70c9('0x59')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x70c9('0x5b'));var _0x3392e6=ejs[_0x70c9('0x5c')](_0x3e1c30,{'networks':_0x253af9||[]});fs[_0x70c9('0x5d')](_0x70c9('0x5e'),_0x3392e6);return respondWithRpcPromise(_0x70c9('0x5f'),_0x70c9('0x30'),{'module':'res_stun_monitor.so'});}else if(_0x239868[_0x70c9('0x47')][_0x70c9('0x68')]()==_0x70c9('0x60')){var _0x30a749=fs['readFileSync'](path[_0x70c9('0x59')](config[_0x70c9('0x5a')],_0x70c9('0x6b')),'utf8');var _0x27997f=ejs[_0x70c9('0x5c')](_0x30a749,{'networks':_0x253af9||[]});fs['writeFileSync'](_0x70c9('0x61'),_0x27997f);return respondWithRpcPromise('Reload','destroy',{'module':_0x70c9('0x6a')});}else{var _0x315dcc=fs[_0x70c9('0x58')](path[_0x70c9('0x59')](config[_0x70c9('0x5a')],'server/files/templates/network.ejs'),_0x70c9('0x5b'));var _0x58600c=ejs['render'](_0x315dcc,{'networks':_0x253af9||[]});fs[_0x70c9('0x5d')](util[_0x70c9('0x63')](_0x70c9('0x64'),_0x1782a1['body'][_0x70c9('0x47')]['toLowerCase']()),_0x58600c);return respondWithRpcPromise(_0x70c9('0x5f'),_0x70c9('0x30'),{'module':_0x70c9('0x66')});}return null;})['catch'](handleError(_0x3575b1,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index b6a9d8c..580e7a7 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 _0x6d7f=['Network','network','lodash','util','api','request-promise','path','../../config/environment','./network.attributes','exports'];(function(_0x120da6,_0x15f450){var _0x3d6c07=function(_0x5acddd){while(--_0x5acddd){_0x120da6['push'](_0x120da6['shift']());}};_0x3d6c07(++_0x15f450);}(_0x6d7f,0xd4));var _0xf6d7=function(_0xa0dbc5,_0x3816c6){_0xa0dbc5=_0xa0dbc5-0x0;var _0x5f1a78=_0x6d7f[_0xa0dbc5];return _0x5f1a78;};'use strict';var _=require(_0xf6d7('0x0'));var util=require(_0xf6d7('0x1'));var logger=require('../../config/logger')(_0xf6d7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf6d7('0x3'));var fs=require('fs');var path=require(_0xf6d7('0x4'));var rimraf=require('rimraf');var config=require(_0xf6d7('0x5'));var attributes=require(_0xf6d7('0x6'));module[_0xf6d7('0x7')]=function(_0x3ec586,_0x1763d8){return _0x3ec586['define'](_0xf6d7('0x8'),attributes,{'tableName':_0xf6d7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9865=['rimraf','../../config/environment','./network.attributes','exports','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x45ce08,_0x59dcc7){var _0x23dff2=function(_0x1ad0e5){while(--_0x1ad0e5){_0x45ce08['push'](_0x45ce08['shift']());}};_0x23dff2(++_0x59dcc7);}(_0x9865,0x1dd));var _0x5986=function(_0x5663c9,_0x49fe63){_0x5663c9=_0x5663c9-0x0;var _0x44f301=_0x9865[_0x5663c9];return _0x44f301;};'use strict';var _=require(_0x5986('0x0'));var util=require(_0x5986('0x1'));var logger=require(_0x5986('0x2'))('api');var moment=require(_0x5986('0x3'));var BPromise=require(_0x5986('0x4'));var rp=require(_0x5986('0x5'));var fs=require('fs');var path=require(_0x5986('0x6'));var rimraf=require(_0x5986('0x7'));var config=require(_0x5986('0x8'));var attributes=require(_0x5986('0x9'));module[_0x5986('0xa')]=function(_0x1f5e19,_0x5757e5){return _0x1f5e19['define']('Network',attributes,{'tableName':'network','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 561b0d0..7bedeb7 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 _0xd746=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash'];(function(_0x529296,_0x1a6a23){var _0x1796bf=function(_0x3cae53){while(--_0x3cae53){_0x529296['push'](_0x529296['shift']());}};_0x1796bf(++_0x1a6a23);}(_0xd746,0x14f));var _0x6d74=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xd746[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x6d74('0x0'));var util=require(_0x6d74('0x1'));var moment=require(_0x6d74('0x2'));var BPromise=require(_0x6d74('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d74('0x4'));var db=require(_0x6d74('0x5'))['db'];var utils=require(_0x6d74('0x6'));var logger=require(_0x6d74('0x7'))(_0x6d74('0x8'));var config=require(_0x6d74('0x9'));var jayson=require(_0x6d74('0xa'));var client=jayson[_0x6d74('0xb')][_0x6d74('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4c8fe3,_0xf465a,_0x489e44){return new BPromise(function(_0x27ab4c,_0x1a1cf1){return client['request'](_0x4c8fe3,_0x489e44)[_0x6d74('0xd')](function(_0x548a7e){logger[_0x6d74('0xe')](_0x6d74('0xf'),_0xf465a,'request\x20sent');logger[_0x6d74('0x10')](_0x6d74('0x11'),_0xf465a,_0x6d74('0x12'),JSON[_0x6d74('0x13')](_0x548a7e));if(_0x548a7e[_0x6d74('0x14')]){if(_0x548a7e[_0x6d74('0x14')]['code']===0x1f4){logger[_0x6d74('0x14')](_0x6d74('0xf'),_0xf465a,_0x548a7e[_0x6d74('0x14')][_0x6d74('0x15')]);return _0x1a1cf1(_0x548a7e[_0x6d74('0x14')][_0x6d74('0x15')]);}logger[_0x6d74('0x14')](_0x6d74('0xf'),_0xf465a,_0x548a7e[_0x6d74('0x14')][_0x6d74('0x15')]);return _0x27ab4c(_0x548a7e['error'][_0x6d74('0x15')]);}else{logger[_0x6d74('0xe')](_0x6d74('0xf'),_0xf465a,_0x6d74('0x12'));_0x27ab4c(_0x548a7e[_0x6d74('0x16')][_0x6d74('0x15')]);}})[_0x6d74('0x17')](function(_0x47e85a){logger[_0x6d74('0x14')](_0x6d74('0xf'),_0xf465a,_0x47e85a);_0x1a1cf1(_0x47e85a);});});} \ No newline at end of file +var _0x8404=['error','message','Network,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','stringify'];(function(_0x3082b6,_0x247718){var _0x35b4d9=function(_0x163564){while(--_0x163564){_0x3082b6['push'](_0x3082b6['shift']());}};_0x35b4d9(++_0x247718);}(_0x8404,0xad));var _0x4840=function(_0x3a3c33,_0x8c0a5c){_0x3a3c33=_0x3a3c33-0x0;var _0x43bbb0=_0x8404[_0x3a3c33];return _0x43bbb0;};'use strict';var _=require(_0x4840('0x0'));var util=require(_0x4840('0x1'));var moment=require(_0x4840('0x2'));var BPromise=require(_0x4840('0x3'));var rs=require(_0x4840('0x4'));var fs=require('fs');var Redis=require(_0x4840('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4840('0x6'));var logger=require('../../config/logger')(_0x4840('0x7'));var config=require(_0x4840('0x8'));var jayson=require(_0x4840('0x9'));var client=jayson['client'][_0x4840('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x378529,_0x528e38,_0x211a22){return new BPromise(function(_0x4060e4,_0x5ac873){return client['request'](_0x378529,_0x211a22)[_0x4840('0xb')](function(_0x4af619){logger[_0x4840('0xc')]('Network,\x20%s,\x20%s',_0x528e38,_0x4840('0xd'));logger[_0x4840('0xe')]('Network,\x20%s,\x20%s,\x20%s',_0x528e38,_0x4840('0xd'),JSON[_0x4840('0xf')](_0x4af619));if(_0x4af619[_0x4840('0x10')]){if(_0x4af619[_0x4840('0x10')]['code']===0x1f4){logger[_0x4840('0x10')]('Network,\x20%s,\x20%s',_0x528e38,_0x4af619['error'][_0x4840('0x11')]);return _0x5ac873(_0x4af619[_0x4840('0x10')][_0x4840('0x11')]);}logger[_0x4840('0x10')]('Network,\x20%s,\x20%s',_0x528e38,_0x4af619[_0x4840('0x10')][_0x4840('0x11')]);return _0x4060e4(_0x4af619[_0x4840('0x10')]['message']);}else{logger[_0x4840('0xc')](_0x4840('0x12'),_0x528e38,_0x4840('0xd'));_0x4060e4(_0x4af619[_0x4840('0x13')][_0x4840('0x11')]);}})[_0x4840('0x14')](function(_0x29e86a){logger[_0x4840('0x10')](_0x4840('0x12'),_0x528e38,_0x29e86a);_0x5ac873(_0x29e86a);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 79b66ad..4ab66c5 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 _0xfcd7=['addDisposition','/:id/notify','notify','addApplications','addAgents','/:id/send','send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','post','create','/:id/dispositions'];(function(_0x1cf57c,_0x1bf6fe){var _0x4f6ad9=function(_0x12e8a3){while(--_0x12e8a3){_0x1cf57c['push'](_0x1cf57c['shift']());}};_0x4f6ad9(++_0x1bf6fe);}(_0xfcd7,0xa2));var _0x7fcd=function(_0x55856f,_0x35f6c2){_0x55856f=_0x55856f-0x0;var _0x3bef91=_0xfcd7[_0x55856f];return _0x3bef91;};'use strict';var multer=require(_0x7fcd('0x0'));var util=require(_0x7fcd('0x1'));var path=require('path');var timeout=require(_0x7fcd('0x2'));var express=require('express');var router=express[_0x7fcd('0x3')]();var auth=require(_0x7fcd('0x4'));var interaction=require(_0x7fcd('0x5'));var config=require(_0x7fcd('0x6'));var controller=require('./openchannelAccount.controller');router[_0x7fcd('0x7')]('/',auth[_0x7fcd('0x8')](),controller[_0x7fcd('0x9')]);router[_0x7fcd('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x7fcd('0xa')]);router['get'](_0x7fcd('0xb'),auth['isAuthenticated'](),controller[_0x7fcd('0xc')]);router[_0x7fcd('0x7')]('/:id/dispositions',auth[_0x7fcd('0x8')](),controller['getDispositions']);router[_0x7fcd('0x7')](_0x7fcd('0xd'),auth[_0x7fcd('0x8')](),controller[_0x7fcd('0xe')]);router['get'](_0x7fcd('0xf'),auth[_0x7fcd('0x8')](),controller[_0x7fcd('0x10')]);router[_0x7fcd('0x7')]('/:id/interactions',auth[_0x7fcd('0x8')](),controller[_0x7fcd('0x11')]);router[_0x7fcd('0x7')](_0x7fcd('0x12'),auth[_0x7fcd('0x8')](),controller[_0x7fcd('0x13')]);router[_0x7fcd('0x14')]('/',auth['isAuthenticated'](),controller[_0x7fcd('0x15')]);router[_0x7fcd('0x14')](_0x7fcd('0x16'),auth[_0x7fcd('0x8')](),controller[_0x7fcd('0x17')]);router[_0x7fcd('0x14')](_0x7fcd('0xd'),auth[_0x7fcd('0x8')](),controller['addAnswer']);router[_0x7fcd('0x14')](_0x7fcd('0x18'),controller[_0x7fcd('0x19')]);router[_0x7fcd('0x14')](_0x7fcd('0xf'),auth[_0x7fcd('0x8')](),controller[_0x7fcd('0x1a')]);router[_0x7fcd('0x14')]('/:id/users',auth[_0x7fcd('0x8')](),controller[_0x7fcd('0x1b')]);router['post'](_0x7fcd('0x1c'),auth[_0x7fcd('0x8')](),controller[_0x7fcd('0x1d')]);router['put']('/:id',auth[_0x7fcd('0x8')](),controller[_0x7fcd('0x1e')]);router[_0x7fcd('0x1f')]('/:id',auth['isAuthenticated'](),controller[_0x7fcd('0x20')]);router[_0x7fcd('0x1f')]('/:id/dispositions',auth[_0x7fcd('0x8')](),controller[_0x7fcd('0x21')]);router[_0x7fcd('0x1f')](_0x7fcd('0xd'),auth[_0x7fcd('0x8')](),controller[_0x7fcd('0x22')]);router['delete'](_0x7fcd('0x12'),auth['isAuthenticated'](),controller[_0x7fcd('0x23')]);module[_0x7fcd('0x24')]=router; \ No newline at end of file +var _0x9446=['getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','/:id/dispositions','/:id/canned_answers','addAnswer','notify','addApplications','addAgents','/:id/send','send','put','delete','destroy','removeDispositions','removeAnswers','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions'];(function(_0x55ef8b,_0x5deb5e){var _0x359c84=function(_0x437673){while(--_0x437673){_0x55ef8b['push'](_0x55ef8b['shift']());}};_0x359c84(++_0x5deb5e);}(_0x9446,0x187));var _0x6944=function(_0x1da04e,_0x34074a){_0x1da04e=_0x1da04e-0x0;var _0x1a14bb=_0x9446[_0x1da04e];return _0x1a14bb;};'use strict';var multer=require(_0x6944('0x0'));var util=require(_0x6944('0x1'));var path=require(_0x6944('0x2'));var timeout=require(_0x6944('0x3'));var express=require(_0x6944('0x4'));var router=express[_0x6944('0x5')]();var auth=require(_0x6944('0x6'));var interaction=require(_0x6944('0x7'));var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router[_0x6944('0x8')]('/',auth[_0x6944('0x9')](),controller[_0x6944('0xa')]);router[_0x6944('0x8')](_0x6944('0xb'),auth[_0x6944('0x9')](),controller[_0x6944('0xc')]);router[_0x6944('0x8')](_0x6944('0xd'),auth[_0x6944('0x9')](),controller[_0x6944('0xe')]);router[_0x6944('0x8')]('/:id/dispositions',auth[_0x6944('0x9')](),controller[_0x6944('0xf')]);router[_0x6944('0x8')]('/:id/canned_answers',auth[_0x6944('0x9')](),controller[_0x6944('0x10')]);router[_0x6944('0x8')]('/:id/applications',auth[_0x6944('0x9')](),controller[_0x6944('0x11')]);router[_0x6944('0x8')](_0x6944('0x12'),auth['isAuthenticated'](),controller[_0x6944('0x13')]);router[_0x6944('0x8')](_0x6944('0x14'),auth[_0x6944('0x9')](),controller[_0x6944('0x15')]);router['post']('/',auth[_0x6944('0x9')](),controller[_0x6944('0x16')]);router[_0x6944('0x17')](_0x6944('0x18'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x6944('0x17')](_0x6944('0x19'),auth['isAuthenticated'](),controller[_0x6944('0x1a')]);router[_0x6944('0x17')]('/:id/notify',controller[_0x6944('0x1b')]);router[_0x6944('0x17')]('/:id/applications',auth['isAuthenticated'](),controller[_0x6944('0x1c')]);router[_0x6944('0x17')](_0x6944('0x14'),auth['isAuthenticated'](),controller[_0x6944('0x1d')]);router['post'](_0x6944('0x1e'),auth[_0x6944('0x9')](),controller[_0x6944('0x1f')]);router[_0x6944('0x20')]('/:id',auth[_0x6944('0x9')](),controller['update']);router[_0x6944('0x21')](_0x6944('0xd'),auth[_0x6944('0x9')](),controller[_0x6944('0x22')]);router['delete']('/:id/dispositions',auth[_0x6944('0x9')](),controller[_0x6944('0x23')]);router[_0x6944('0x21')](_0x6944('0x19'),auth[_0x6944('0x9')](),controller[_0x6944('0x24')]);router['delete'](_0x6944('0x14'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index ad712cf..eac4f78 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 _0xca1c=['STRING','name','TEXT','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','randomstring'];(function(_0x3df00d,_0xe9a05){var _0x3d1400=function(_0x2a2139){while(--_0x2a2139){_0x3df00d['push'](_0x3df00d['shift']());}};_0x3d1400(++_0xe9a05);}(_0xca1c,0x13a));var _0xcca1=function(_0x4640b0,_0x13cb46){_0x4640b0=_0x4640b0-0x0;var _0x22665f=_0xca1c[_0x4640b0];return _0x22665f;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xcca1('0x0'));module['exports']={'name':{'type':Sequelize[_0xcca1('0x1')],'unique':_0xcca1('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xcca1('0x1')]},'token':{'type':Sequelize[_0xcca1('0x1')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xcca1('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xcca1('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xcca1('0x3')],'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[_0xcca1('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xcca1('0x1')]},'queueTransfer':{'type':Sequelize[_0xcca1('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcca1('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcca1('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcca1('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0xcca1('0x6')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x52a028){if(!_0x52a028)this['setDataValue'](_0xcca1('0x7'),null);this[_0xcca1('0x8')]('mandatoryDisposition',_0x52a028);}}}; \ No newline at end of file +var _0x2999=['mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x5a889a,_0x5dfa94){var _0x1107a1=function(_0xc63cda){while(--_0xc63cda){_0x5a889a['push'](_0x5a889a['shift']());}};_0x1107a1(++_0x5dfa94);}(_0x2999,0x85));var _0x9299=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2999[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x9299('0x0')]={'name':{'type':Sequelize[_0x9299('0x1')],'unique':_0x9299('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9299('0x1')]},'token':{'type':Sequelize[_0x9299('0x1')],'defaultValue':function(){return rs[_0x9299('0x3')]();}},'replyUri':{'type':Sequelize[_0x9299('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9299('0x4')],'defaultValue':function(){return _0x9299('0x5');}},'notificationSound':{'type':Sequelize[_0x9299('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9299('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x9299('0x1')]},'queueTransfer':{'type':Sequelize[_0x9299('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9299('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9299('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9299('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x9299('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x9299('0x6')],'defaultValue':![],'comment':_0x9299('0x9'),'set':function(_0x4e5b8d){if(!_0x4e5b8d)this['setDataValue'](_0x9299('0xa'),null);this[_0x9299('0xb')](_0x9299('0xc'),_0x4e5b8d);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index d24e981..6558526 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 _0x3181=['save','OpenchannelAccounts','UserProfileResource','destroy','stack','name','send','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','show','params','find','create','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','Contacts','OpenchannelApplication','Applications','List','applications','orderBy','asc','account','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','transaction','findAndCountAll','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply'];(function(_0x39fca6,_0x202c8d){var _0x1ccb27=function(_0x2c870a){while(--_0x2c870a){_0x39fca6['push'](_0x39fca6['shift']());}};_0x1ccb27(++_0x202c8d);}(_0x3181,0x142));var _0x1318=function(_0x21c601,_0x26f456){_0x21c601=_0x21c601-0x0;var _0xd423f=_0x3181[_0x21c601];return _0xd423f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1318('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1318('0x1'));var jsonpatch=require(_0x1318('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1318('0x3'));var Mustache=require('mustache');var util=require(_0x1318('0x4'));var path=require(_0x1318('0x5'));var sox=require(_0x1318('0x6'));var csv=require('to-csv');var ejs=require(_0x1318('0x7'));var fs=require('fs');var _=require(_0x1318('0x8'));var squel=require('squel');var crypto=require(_0x1318('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x1318('0xa'));var toCsv=require(_0x1318('0xb'));var querystring=require(_0x1318('0xc'));var Papa=require(_0x1318('0xd'));var Redis=require('ioredis');var authService=require(_0x1318('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1318('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1318('0x10'))(_0x1318('0x11'));var utils=require(_0x1318('0x12'));var config=require(_0x1318('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x1318('0x14'))['db'];config[_0x1318('0x15')]=_[_0x1318('0x16')](config[_0x1318('0x15')],{'host':_0x1318('0x17'),'port':0x18eb});var socket=require(_0x1318('0x18'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x1318('0x19')](socket);var jayson=require(_0x1318('0x1a'));var client=jayson[_0x1318('0x1b')][_0x1318('0x1c')]({'port':0x232c});var client9002=jayson[_0x1318('0x1b')][_0x1318('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x129b5a,_0x7cdd18,_0x3742f0,_0xcbca1b){return new BPromise(function(_0x1f205b,_0x49a895){var _0x2865f7=_0xcbca1b||client;return _0x2865f7[_0x1318('0x1d')](_0x129b5a,_0x3742f0)[_0x1318('0x1e')](function(_0x460c8a){logger[_0x1318('0x1f')]('OpenchannelAccount,\x20%s,\x20%s',_0x7cdd18,'request\x20sent');logger[_0x1318('0x20')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x7cdd18,_0x1318('0x21'),JSON[_0x1318('0x22')](_0x460c8a));if(_0x460c8a[_0x1318('0x23')]){if(_0x460c8a[_0x1318('0x23')][_0x1318('0x24')]===0x1f4){logger[_0x1318('0x23')](_0x1318('0x25'),_0x7cdd18,_0x460c8a[_0x1318('0x23')][_0x1318('0x26')]);return _0x49a895(_0x460c8a[_0x1318('0x23')]['message']);}logger[_0x1318('0x23')](_0x1318('0x25'),_0x7cdd18,_0x460c8a[_0x1318('0x23')]['message']);return _0x1f205b(_0x460c8a['error'][_0x1318('0x26')]);}else{logger[_0x1318('0x1f')](_0x1318('0x25'),_0x7cdd18,_0x1318('0x21'));_0x1f205b(_0x460c8a[_0x1318('0x27')][_0x1318('0x26')]);}})[_0x1318('0x28')](function(_0x3f7791){logger[_0x1318('0x23')](_0x1318('0x25'),_0x7cdd18,_0x3f7791);_0x49a895(_0x3f7791);});});}function respondWithStatusCode(_0x5e9f78,_0x1f83d9){_0x1f83d9=_0x1f83d9||0xcc;return function(_0xd35c64){if(_0xd35c64){return _0x5e9f78[_0x1318('0x29')](_0x1f83d9);}return _0x5e9f78[_0x1318('0x2a')](_0x1f83d9)[_0x1318('0x2b')]();};}function respondWithResult(_0x41f653,_0x8afc07){_0x8afc07=_0x8afc07||0xc8;return function(_0x3655d7){if(_0x3655d7){return _0x41f653[_0x1318('0x2a')](_0x8afc07)[_0x1318('0x2c')](_0x3655d7);}};}function respondWithFilteredResult(_0x1d93d5,_0x2ba3bc){return function(_0x1ac6bf){if(_0x1ac6bf){var _0x476270=_0x1ac6bf['count'],_0xd5612=_0x2ba3bc[_0x1318('0x2d')],_0x10511b=_0x2ba3bc[_0x1318('0x2d')]+_0x2ba3bc[_0x1318('0x2e')],_0x2d07f3;if(_0x10511b>=_0x476270){_0x10511b=_0x476270;_0x2d07f3=0xc8;}else{_0x2d07f3=0xce;}_0x1d93d5['status'](_0x2d07f3);return _0x1d93d5[_0x1318('0x2f')](_0x1318('0x30'),_0xd5612+'-'+_0x10511b+'/'+_0x476270)[_0x1318('0x2c')](_0x1ac6bf);}return null;};}function patchUpdates(_0x385062){return function(_0x2e4303){try{jsonpatch[_0x1318('0x31')](_0x2e4303,_0x385062,!![]);}catch(_0x3512e1){return BPromise['reject'](_0x3512e1);}return _0x2e4303[_0x1318('0x32')]();};}function saveUpdates(_0x4af375,_0x1a6670){return function(_0x3b0421){if(_0x3b0421){return _0x3b0421['update'](_0x4af375)[_0x1318('0x1e')](function(_0x17c7aa){return _0x17c7aa;});}return null;};}function removeEntity(_0x4587b9,_0x1f5d42){return function(_0x1acc09){if(_0x1acc09){return _0x1acc09['destroy']()[_0x1318('0x1e')](function(){var _0x4f4300=_0x1acc09['get']({'plain':!![]});var _0xeb4a72=_0x1318('0x33');return db[_0x1318('0x34')][_0x1318('0x35')]({'where':{'type':_0xeb4a72,'resourceId':_0x4f4300['id']}})[_0x1318('0x1e')](function(){return _0x1acc09;});})['then'](function(){_0x4587b9[_0x1318('0x2a')](0xcc)[_0x1318('0x2b')]();});}};}function handleEntityNotFound(_0x10bfe6,_0x1c52f2){return function(_0xf63d07){if(!_0xf63d07){_0x10bfe6[_0x1318('0x29')](0x194);}return _0xf63d07;};}function handleError(_0x4f8b15,_0x1c7aac){_0x1c7aac=_0x1c7aac||0x1f4;return function(_0x1e8c38){logger[_0x1318('0x23')](_0x1e8c38[_0x1318('0x36')]);if(_0x1e8c38[_0x1318('0x37')]){delete _0x1e8c38[_0x1318('0x37')];}_0x4f8b15[_0x1318('0x2a')](_0x1c7aac)[_0x1318('0x38')](_0x1e8c38);};}exports['index']=function(_0x131415,_0xdf7217){var _0x352327={'include':[{'model':db[_0x1318('0x39')],'as':_0x1318('0x3a')}]},_0x128f77={},_0x3a4b77={'count':0x0,'rows':[]};var _0x4b7bbc=_[_0x1318('0x3b')](db[_0x1318('0x3c')][_0x1318('0x3d')],function(_0x298dfb){return{'name':_0x298dfb[_0x1318('0x3e')],'type':_0x298dfb[_0x1318('0x3f')]['key']};});_0x128f77[_0x1318('0x40')]=_[_0x1318('0x3b')](_0x4b7bbc,'name');_0x128f77['query']=_[_0x1318('0x41')](_0x131415[_0x1318('0x42')]);_0x128f77[_0x1318('0x43')]=_[_0x1318('0x44')](_0x128f77['model'],_0x128f77[_0x1318('0x42')]);_0x352327[_0x1318('0x45')]=_[_0x1318('0x44')](_0x128f77[_0x1318('0x40')],qs[_0x1318('0x46')](_0x131415[_0x1318('0x42')][_0x1318('0x46')]));_0x352327[_0x1318('0x45')]=_0x352327[_0x1318('0x45')][_0x1318('0x47')]?_0x352327['attributes']:_0x128f77[_0x1318('0x40')];if(!_0x131415[_0x1318('0x42')][_0x1318('0x48')](_0x1318('0x49'))){_0x352327[_0x1318('0x2e')]=qs[_0x1318('0x2e')](_0x131415[_0x1318('0x42')]['limit']);_0x352327[_0x1318('0x2d')]=qs[_0x1318('0x2d')](_0x131415[_0x1318('0x42')][_0x1318('0x2d')]);}_0x352327[_0x1318('0x4a')]=qs['sort'](_0x131415[_0x1318('0x42')][_0x1318('0x4b')]);_0x352327[_0x1318('0x4c')]=qs[_0x1318('0x43')](_[_0x1318('0x4d')](_0x131415[_0x1318('0x42')],_0x128f77[_0x1318('0x43')]),_0x4b7bbc);if(_0x131415[_0x1318('0x42')][_0x1318('0x4e')]){_0x352327[_0x1318('0x4c')]=_['merge'](_0x352327[_0x1318('0x4c')],{'$or':_[_0x1318('0x3b')](_0x4b7bbc,function(_0x11b30b){if(_0x11b30b['type']!==_0x1318('0x4f')){var _0x5bb4b6={};_0x5bb4b6[_0x11b30b[_0x1318('0x37')]]={'$like':'%'+_0x131415[_0x1318('0x42')][_0x1318('0x4e')]+'%'};return _0x5bb4b6;}})});}_0x352327=_[_0x1318('0x50')]({},_0x352327,_0x131415[_0x1318('0x51')]);var _0x11fce8={'where':_0x352327['where']};return db[_0x1318('0x3c')][_0x1318('0x52')](_0x11fce8)['then'](function(_0x32f5b6){_0x3a4b77['count']=_0x32f5b6;if(_0x131415['query'][_0x1318('0x53')]){_0x352327[_0x1318('0x54')]=[{'all':!![]}];}return db[_0x1318('0x3c')][_0x1318('0x55')](_0x352327);})[_0x1318('0x1e')](function(_0x3127a0){_0x3a4b77['rows']=_0x3127a0;return _0x3a4b77;})['then'](respondWithFilteredResult(_0xdf7217,_0x352327))['catch'](handleError(_0xdf7217,null));};exports[_0x1318('0x56')]=function(_0x38f5b3,_0x3b765e){var _0x3870fd={'raw':![],'where':{'id':_0x38f5b3[_0x1318('0x57')]['id']},'include':[{'model':db[_0x1318('0x39')],'as':_0x1318('0x3a')}]},_0x558305={};_0x558305['model']=_[_0x1318('0x41')](db['OpenchannelAccount'][_0x1318('0x3d')]);_0x558305[_0x1318('0x42')]=_[_0x1318('0x41')](_0x38f5b3[_0x1318('0x42')]);_0x558305[_0x1318('0x43')]=_[_0x1318('0x44')](_0x558305['model'],_0x558305[_0x1318('0x42')]);_0x3870fd[_0x1318('0x45')]=_['intersection'](_0x558305['model'],qs[_0x1318('0x46')](_0x38f5b3[_0x1318('0x42')][_0x1318('0x46')]));_0x3870fd[_0x1318('0x45')]=_0x3870fd[_0x1318('0x45')][_0x1318('0x47')]?_0x3870fd['attributes']:_0x558305[_0x1318('0x40')];if(_0x38f5b3['query'][_0x1318('0x53')]){_0x3870fd[_0x1318('0x54')]=[{'all':!![]}];}_0x3870fd=_[_0x1318('0x50')]({},_0x3870fd,_0x38f5b3[_0x1318('0x51')]);return db[_0x1318('0x3c')][_0x1318('0x58')](_0x3870fd)[_0x1318('0x1e')](handleEntityNotFound(_0x3b765e,null))[_0x1318('0x1e')](respondWithResult(_0x3b765e,null))[_0x1318('0x28')](handleError(_0x3b765e,null));};exports['create']=function(_0x34f7fe,_0x2b5cb8){return db[_0x1318('0x3c')][_0x1318('0x59')](_0x34f7fe['body'],{})[_0x1318('0x1e')](function(_0x17f092){var _0x3c7b1a=_0x34f7fe[_0x1318('0x5a')][_0x1318('0x5b')]({'plain':!![]});if(!_0x3c7b1a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c7b1a[_0x1318('0x5c')]===_0x1318('0x5a')){var _0x4942fc=_0x17f092[_0x1318('0x5b')]({'plain':!![]});var _0x1d5f4c=_0x1318('0x33');return db[_0x1318('0x5d')]['find']({'where':{'name':_0x1d5f4c,'userProfileId':_0x3c7b1a[_0x1318('0x5e')]},'raw':!![]})[_0x1318('0x1e')](function(_0xc7c257){if(_0xc7c257&&_0xc7c257['autoAssociation']===0x0){return db[_0x1318('0x34')][_0x1318('0x59')]({'name':_0x4942fc[_0x1318('0x37')],'resourceId':_0x4942fc['id'],'type':_0xc7c257[_0x1318('0x37')],'sectionId':_0xc7c257['id']},{})[_0x1318('0x1e')](function(){return _0x17f092;});}else{return _0x17f092;}})[_0x1318('0x28')](function(_0x34f24e){logger[_0x1318('0x23')](_0x1318('0x5f'),_0x34f24e);throw _0x34f24e;});}return _0x17f092;})[_0x1318('0x1e')](respondWithResult(_0x2b5cb8,0xc9))[_0x1318('0x28')](handleError(_0x2b5cb8,null));};exports[_0x1318('0x60')]=function(_0x38dc58,_0x294bb8){if(_0x38dc58[_0x1318('0x61')]['id']){delete _0x38dc58[_0x1318('0x61')]['id'];}return db[_0x1318('0x3c')][_0x1318('0x58')]({'where':{'id':_0x38dc58[_0x1318('0x57')]['id']},'include':[{'model':db[_0x1318('0x39')],'as':_0x1318('0x3a')}]})[_0x1318('0x1e')](handleEntityNotFound(_0x294bb8,null))['then'](saveUpdates(_0x38dc58['body'],null))[_0x1318('0x1e')](respondWithResult(_0x294bb8,null))['catch'](handleError(_0x294bb8,null));};exports['destroy']=function(_0x5d58a1,_0x2df7aa){return db[_0x1318('0x3c')][_0x1318('0x58')]({'where':{'id':_0x5d58a1[_0x1318('0x57')]['id']}})['then'](handleEntityNotFound(_0x2df7aa,null))[_0x1318('0x1e')](removeEntity(_0x2df7aa,null))['catch'](handleError(_0x2df7aa,null));};exports[_0x1318('0x62')]=function(_0x406c28,_0x5a4f65){return db[_0x1318('0x3c')][_0x1318('0x62')]()[_0x1318('0x1e')](respondWithResult(_0x5a4f65,null))['catch'](handleError(_0x5a4f65,null));};exports[_0x1318('0x63')]=function(_0x109340,_0x12fe9c,_0x3fc627){if(_0x109340['body']['id']){delete _0x109340[_0x1318('0x61')]['id'];}return db[_0x1318('0x3c')][_0x1318('0x58')]({'where':{'id':_0x109340['params']['id']}})[_0x1318('0x1e')](handleEntityNotFound(_0x12fe9c,null))[_0x1318('0x1e')](function(_0x27fb1f){if(_0x27fb1f){_0x109340[_0x1318('0x61')][_0x1318('0x64')]=_0x27fb1f['id'];return db[_0x1318('0x65')][_0x1318('0x59')](_0x109340[_0x1318('0x61')]);}})[_0x1318('0x1e')](respondWithResult(_0x12fe9c,null))[_0x1318('0x28')](handleError(_0x12fe9c,null));};exports[_0x1318('0x66')]=function(_0x5232cf,_0x1dbf30,_0x44656d){var _0x4ba8ec={'raw':![],'where':{}};var _0x26f5f5={};var _0x4b287f={'count':0x0,'rows':[]};return db[_0x1318('0x3c')][_0x1318('0x67')]({'where':{'id':_0x5232cf[_0x1318('0x57')]['id']}})[_0x1318('0x1e')](handleEntityNotFound(_0x1dbf30,null))['then'](function(_0xe79af){if(_0xe79af){_0x26f5f5[_0x1318('0x40')]=_['keys'](db[_0x1318('0x65')][_0x1318('0x3d')]);_0x26f5f5[_0x1318('0x42')]=_[_0x1318('0x41')](_0x5232cf[_0x1318('0x42')]);_0x26f5f5[_0x1318('0x43')]=_['intersection'](_0x26f5f5[_0x1318('0x40')],_0x26f5f5[_0x1318('0x42')]);_0x4ba8ec[_0x1318('0x45')]=_[_0x1318('0x44')](_0x26f5f5['model'],qs[_0x1318('0x46')](_0x5232cf[_0x1318('0x42')][_0x1318('0x46')]));_0x4ba8ec[_0x1318('0x45')]=_0x4ba8ec[_0x1318('0x45')][_0x1318('0x47')]?_0x4ba8ec[_0x1318('0x45')]:_0x26f5f5[_0x1318('0x40')];if(!_0x5232cf[_0x1318('0x42')][_0x1318('0x48')](_0x1318('0x49'))){_0x4ba8ec[_0x1318('0x2e')]=qs['limit'](_0x5232cf[_0x1318('0x42')][_0x1318('0x2e')]);_0x4ba8ec[_0x1318('0x2d')]=qs[_0x1318('0x2d')](_0x5232cf[_0x1318('0x42')][_0x1318('0x2d')]);}_0x4ba8ec['order']=qs['sort'](_0x5232cf[_0x1318('0x42')][_0x1318('0x4b')]);_0x4ba8ec[_0x1318('0x4c')]=qs[_0x1318('0x43')](_[_0x1318('0x4d')](_0x5232cf[_0x1318('0x42')],_0x26f5f5[_0x1318('0x43')]));_0x4ba8ec[_0x1318('0x4c')]['OpenchannelAccountId']=_0xe79af['id'];if(_0x5232cf[_0x1318('0x42')][_0x1318('0x4e')]){_0x4ba8ec[_0x1318('0x4c')]=_[_0x1318('0x50')](_0x4ba8ec[_0x1318('0x4c')],{'$or':_['map'](_0x4ba8ec['attributes'],function(_0x36cf89){var _0x284908={};_0x284908[_0x36cf89]={'$like':'%'+_0x5232cf['query'][_0x1318('0x4e')]+'%'};return _0x284908;})});}_0x4ba8ec=_[_0x1318('0x50')]({},_0x4ba8ec,_0x5232cf[_0x1318('0x51')]);return db[_0x1318('0x65')]['count']({'where':_0x4ba8ec[_0x1318('0x4c')]})[_0x1318('0x1e')](function(_0x4309d5){_0x4b287f[_0x1318('0x52')]=_0x4309d5;if(_0x5232cf['query'][_0x1318('0x53')]){_0x4ba8ec[_0x1318('0x54')]=[{'all':!![]}];}return db['Disposition'][_0x1318('0x55')](_0x4ba8ec);})['then'](function(_0x2115bf){_0x4b287f[_0x1318('0x68')]=_0x2115bf;return _0x4b287f;});}})[_0x1318('0x1e')](respondWithFilteredResult(_0x1dbf30,_0x4ba8ec))[_0x1318('0x28')](handleError(_0x1dbf30,null));};exports[_0x1318('0x69')]=function(_0x47550f,_0x2fd86f,_0x34e21a){return db['OpenchannelAccount']['find']({'where':{'id':_0x47550f[_0x1318('0x57')]['id']}})['then'](handleEntityNotFound(_0x2fd86f,null))[_0x1318('0x1e')](function(_0x172c56){if(_0x172c56){return _0x172c56[_0x1318('0x69')](_0x47550f['query'][_0x1318('0x6a')]);}})['then'](respondWithStatusCode(_0x2fd86f,null))[_0x1318('0x28')](handleError(_0x2fd86f,null));};exports[_0x1318('0x6b')]=function(_0x479dc8,_0x19bf4e,_0x2a0392){if(_0x479dc8[_0x1318('0x61')]['id']){delete _0x479dc8[_0x1318('0x61')]['id'];}return db[_0x1318('0x3c')][_0x1318('0x58')]({'where':{'id':_0x479dc8['params']['id']}})[_0x1318('0x1e')](handleEntityNotFound(_0x19bf4e,null))[_0x1318('0x1e')](function(_0x3e7124){if(_0x3e7124){_0x479dc8[_0x1318('0x61')][_0x1318('0x64')]=_0x3e7124['id'];return db[_0x1318('0x6c')][_0x1318('0x59')](_0x479dc8[_0x1318('0x61')]);}})['then'](respondWithResult(_0x19bf4e,null))[_0x1318('0x28')](handleError(_0x19bf4e,null));};exports['getAnswers']=function(_0x278935,_0x2fd89a,_0x57970f){var _0x34263a={'raw':![],'where':{}};var _0x477fb1={};var _0x27f700={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x1318('0x67')]({'where':{'id':_0x278935[_0x1318('0x57')]['id']}})[_0x1318('0x1e')](handleEntityNotFound(_0x2fd89a,null))[_0x1318('0x1e')](function(_0x5b53ed){if(_0x5b53ed){_0x477fb1['model']=_[_0x1318('0x41')](db[_0x1318('0x6c')][_0x1318('0x3d')]);_0x477fb1[_0x1318('0x42')]=_[_0x1318('0x41')](_0x278935['query']);_0x477fb1[_0x1318('0x43')]=_[_0x1318('0x44')](_0x477fb1['model'],_0x477fb1['query']);_0x34263a['attributes']=_[_0x1318('0x44')](_0x477fb1[_0x1318('0x40')],qs[_0x1318('0x46')](_0x278935[_0x1318('0x42')]['fields']));_0x34263a[_0x1318('0x45')]=_0x34263a[_0x1318('0x45')][_0x1318('0x47')]?_0x34263a['attributes']:_0x477fb1[_0x1318('0x40')];if(!_0x278935['query'][_0x1318('0x48')](_0x1318('0x49'))){_0x34263a['limit']=qs['limit'](_0x278935[_0x1318('0x42')][_0x1318('0x2e')]);_0x34263a[_0x1318('0x2d')]=qs[_0x1318('0x2d')](_0x278935[_0x1318('0x42')][_0x1318('0x2d')]);}_0x34263a[_0x1318('0x4a')]=qs[_0x1318('0x4b')](_0x278935['query']['sort']);_0x34263a[_0x1318('0x4c')]=qs['filters'](_[_0x1318('0x4d')](_0x278935['query'],_0x477fb1[_0x1318('0x43')]));_0x34263a[_0x1318('0x4c')][_0x1318('0x64')]=_0x5b53ed['id'];if(_0x278935[_0x1318('0x42')][_0x1318('0x4e')]){_0x34263a[_0x1318('0x4c')]=_[_0x1318('0x50')](_0x34263a['where'],{'$or':_[_0x1318('0x3b')](_0x34263a[_0x1318('0x45')],function(_0x1ee83f){var _0x5eb0e1={};_0x5eb0e1[_0x1ee83f]={'$like':'%'+_0x278935[_0x1318('0x42')]['filter']+'%'};return _0x5eb0e1;})});}_0x34263a=_['merge']({},_0x34263a,_0x278935[_0x1318('0x51')]);return db[_0x1318('0x6c')]['count']({'where':_0x34263a[_0x1318('0x4c')]})['then'](function(_0x118993){_0x27f700[_0x1318('0x52')]=_0x118993;if(_0x278935[_0x1318('0x42')]['includeAll']){_0x34263a[_0x1318('0x54')]=[{'all':!![]}];}return db[_0x1318('0x6c')][_0x1318('0x55')](_0x34263a);})[_0x1318('0x1e')](function(_0x29045e){_0x27f700['rows']=_0x29045e;return _0x27f700;});}})[_0x1318('0x1e')](respondWithFilteredResult(_0x2fd89a,_0x34263a))[_0x1318('0x28')](handleError(_0x2fd89a,null));};exports[_0x1318('0x6d')]=function(_0x5d7736,_0x359fc1,_0x555be6){return db[_0x1318('0x3c')][_0x1318('0x58')]({'where':{'id':_0x5d7736[_0x1318('0x57')]['id']}})[_0x1318('0x1e')](handleEntityNotFound(_0x359fc1,null))[_0x1318('0x1e')](function(_0x4e3760){if(_0x4e3760){return _0x4e3760[_0x1318('0x6d')](_0x5d7736['query'][_0x1318('0x6a')]);}})['then'](respondWithStatusCode(_0x359fc1,null))[_0x1318('0x28')](handleError(_0x359fc1,null));};exports[_0x1318('0x6e')]=function(_0x5031e6,_0x20853d,_0x341bce){var _0x15d1a7={'body':_0x5031e6['body'],'channel':_0x1318('0x6f')};var _0x16f67a=[];var _0x18ed94=[];var _0xb8dc1d={};var _0x4b8f1b=![];return db[_0x1318('0x70')][_0x1318('0x62')]()[_0x1318('0x1e')](function(_0x414372){if(!_0x414372){throw new db['Sequelize'][(_0x1318('0x71'))](_0x1318('0x72'));}_0x16f67a=_[_0x1318('0x73')](_[_0x1318('0x41')](_0x414372),[_0x1318('0x74'),_0x1318('0x75')]);_0x18ed94=_[_0x1318('0x73')](_[_0x1318('0x41')](_0x414372),['createdAt',_0x1318('0x75'),_0x1318('0x76'),_0x1318('0x77')]);if(_0x5031e6[_0x1318('0x61')]['id']){delete _0x5031e6[_0x1318('0x61')]['id'];}if(_[_0x1318('0x78')](_0x5031e6[_0x1318('0x61')]['from'])){throw new db[(_0x1318('0x79'))][(_0x1318('0x71'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x5031e6[_0x1318('0x61')]['body'])||_0x5031e6[_0x1318('0x61')][_0x1318('0x61')]===''){throw new db[(_0x1318('0x79'))][(_0x1318('0x71'))](_0x1318('0x7a'));}if(_['isNil'](_0x5031e6[_0x1318('0x61')]['mapKey'])){throw new db[(_0x1318('0x79'))][(_0x1318('0x71'))](_0x1318('0x7b')+_0x18ed94);}if(!_[_0x1318('0x7c')](_0x18ed94,_0x5031e6[_0x1318('0x61')][_0x1318('0x7d')])){throw new db[(_0x1318('0x79'))]['ValidationError'](_0x1318('0x7e')+_0x18ed94);}_0xb8dc1d[_0x5031e6[_0x1318('0x61')][_0x1318('0x7d')]]=_0x5031e6[_0x1318('0x61')][_0x1318('0x7f')];})[_0x1318('0x1e')](function(){return db[_0x1318('0x3c')][_0x1318('0x58')]({'where':{'id':_0x5031e6[_0x1318('0x57')]['id']},'include':[{'model':db[_0x1318('0x80')],'as':'List','include':[{'model':db['CmContact'],'as':_0x1318('0x81'),'where':_0xb8dc1d,'limit':0x1,'order':[[_0x1318('0x75'),'DESC']]}]},{'model':db[_0x1318('0x82')],'as':_0x1318('0x83')}]});})['then'](handleEntityNotFound(_0x20853d,null))[_0x1318('0x1e')](function(_0x462817){if(_0x462817&&_0x462817[_0x1318('0x84')]){_0x15d1a7['account']=_0x462817;_0x15d1a7[_0x1318('0x85')]=_0x462817[_0x1318('0x83')];_0x15d1a7['list']=_0x462817['List'];_0x15d1a7['applications']=_[_0x1318('0x86')](_0x15d1a7['applications'],['priority'],[_0x1318('0x87')]);if(_0x15d1a7[_0x1318('0x88')][_0x1318('0x83')]){delete _0x15d1a7['account'][_0x1318('0x83')];}if(_0x15d1a7[_0x1318('0x88')][_0x1318('0x84')]&&_0x15d1a7[_0x1318('0x88')][_0x1318('0x84')][_0x1318('0x81')][_0x1318('0x47')]){return _0x15d1a7[_0x1318('0x88')][_0x1318('0x84')][_0x1318('0x81')][0x0];}var _0x5e8d4d=_[_0x1318('0x16')](_0x5031e6[_0x1318('0x61')],{'firstName':_0x5031e6[_0x1318('0x61')][_0x1318('0x7f')],'ListId':_0x462817[_0x1318('0x77')]});_0x5e8d4d[_0x5031e6['body']['mapKey']]=_0x5031e6[_0x1318('0x61')][_0x1318('0x7f')];return db[_0x1318('0x70')][_0x1318('0x59')](_0x5e8d4d,{'fields':_0x16f67a,'raw':!![]});}})['then'](handleEntityNotFound(_0x20853d,null))['then'](function(_0x5ad6b6){_0x15d1a7[_0x1318('0x89')]=_0x5ad6b6;if(_0x5ad6b6){var _0x2598d4={'ContactId':_0x5ad6b6['id'],'OpenchannelAccountId':_0x5031e6[_0x1318('0x57')]['id'],'from':(_0x5ad6b6[_0x1318('0x8a')]||'')+'\x20'+(_0x5ad6b6[_0x1318('0x8b')]||'')};var _0xdab5d9={'OpenchannelAccountId':_0x5031e6[_0x1318('0x57')]['id'],'closed':![]};if(_0x5031e6[_0x1318('0x61')][_0x1318('0x8c')]){_0xdab5d9['threadId']=_0x5031e6[_0x1318('0x61')][_0x1318('0x8c')];return db[_0x1318('0x8d')][_0x1318('0x58')]({'where':_0xdab5d9})[_0x1318('0x1e')](function(_0x23023f){if(_0x23023f){return[_0x23023f,![]];}_0x2598d4['threadId']=_0x5031e6[_0x1318('0x61')][_0x1318('0x8c')];_0x2598d4[_0x1318('0x8e')]=_0x5031e6['body'][_0x1318('0x8e')];return db['OpenchannelInteraction']['create'](_0x2598d4)['then'](function(_0x4af0cd){return[_0x4af0cd,!![]];});});}else{_0xdab5d9['threadId']=null;}_0xdab5d9[_0x1318('0x8f')]=_0x5ad6b6['id'];return db[_0x1318('0x8d')]['find']({'where':_0xdab5d9})[_0x1318('0x1e')](function(_0x584bb2){if(_0x584bb2){return[_0x584bb2,![]];}return db[_0x1318('0x8d')][_0x1318('0x59')](_0x2598d4)['then'](function(_0x270aff){return[_0x270aff,!![]];});});}})[_0x1318('0x90')](function(_0x34947f,_0x37bb7b){if(_0x34947f){_0x4b8f1b=_0x37bb7b;if(!_0x37bb7b){var _0x5351fa={'from':(_0x15d1a7['contact']['firstName']||'')+'\x20'+(_0x15d1a7[_0x1318('0x89')]['lastName']||'')};if(_0x5031e6[_0x1318('0x61')]['threadId']&&_0x5031e6['body']['messageId']&&_0x5031e6[_0x1318('0x61')][_0x1318('0x8c')]!=_0x5031e6[_0x1318('0x61')][_0x1318('0x91')]){_0x5351fa[_0x1318('0x8c')]=_0x5031e6[_0x1318('0x61')][_0x1318('0x91')];}return _0x34947f[_0x1318('0x60')](_0x5351fa);}else{return _0x34947f;}}})[_0x1318('0x1e')](function(_0x20b938){_0x15d1a7[_0x1318('0x92')]=_0x20b938[_0x1318('0x5b')]({'plain':!![]});_0x15d1a7[_0x1318('0x92')][_0x1318('0x93')]=_0x4b8f1b;if(_0x15d1a7[_0x1318('0x92')][_0x1318('0x93')]){if(_0x15d1a7[_0x1318('0x88')][_0x1318('0x94')]){_0x15d1a7['applications'][_0x1318('0x95')]({'id':0x0,'priority':_0x15d1a7['applications'][_0x1318('0x47')]+0x1,'app':_0x1318('0x96'),'appdata':_0x1318('0x97'),'interval':_0x1318('0x98')});}}return db[_0x1318('0x99')][_0x1318('0x59')]({'body':_0x5031e6['body']['body'],'OpenchannelAccountId':_0x5031e6[_0x1318('0x57')]['id'],'OpenchannelInteractionId':_0x20b938['id'],'direction':'in','ContactId':_0x15d1a7[_0x1318('0x89')]['id'],'AttachmentId':_0x5031e6[_0x1318('0x61')][_0x1318('0x9a')]});})[_0x1318('0x1e')](function(_0x17df23){_0x15d1a7['message']=_0x17df23;if(_0x15d1a7[_0x1318('0x92')][_0x1318('0x9b')]){return db[_0x1318('0x9c')]['find']({'attributes':['id','name'],'where':{'id':_0x15d1a7[_0x1318('0x92')]['UserId']}})[_0x1318('0x1e')](function(_0x292106){if(_0x292106){_0x15d1a7['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x1318('0x9d'),'appdata':_0x292106[_0x1318('0x37')]+','+(_0x15d1a7['account'][_0x1318('0x9e')]||0xa),'interval':_0x1318('0x98')});_0x15d1a7[_0x1318('0x9f')]=![];}return respondWithRpcPromise('Start','startRouting',_0x15d1a7);});}return respondWithRpcPromise(_0x1318('0xa0'),_0x1318('0xa1'),_0x15d1a7);})[_0x1318('0x1e')](function(_0x33c420){respondWithRpcPromise(_0x1318('0xa2'),_0x1318('0xa2'),{'event':'notify','message':_0x33c420},client9002);return _0x33c420;})[_0x1318('0x1e')](respondWithResult(_0x20853d,null))[_0x1318('0x28')](handleError(_0x20853d,null));};exports[_0x1318('0xa3')]=function(_0x232a60,_0x51d1fd,_0x312310){return db[_0x1318('0x3c')][_0x1318('0x67')]({'where':{'id':_0x232a60[_0x1318('0x57')]['id']}})[_0x1318('0x1e')](handleEntityNotFound(_0x51d1fd,null))['then'](function(_0x3846b0){if(_0x3846b0){return db['sequelize'][_0x1318('0xa4')](function(_0x13a8a1){return db[_0x1318('0x82')][_0x1318('0x35')]({'where':{'OpenchannelAccountId':_0x232a60[_0x1318('0x57')]['id']},'transaction':_0x13a8a1})[_0x1318('0x1e')](function(_0x2dac90){var _0x468573=_[_0x1318('0x3b')](_0x232a60[_0x1318('0x61')],function(_0x4aacec){_0x4aacec[_0x1318('0x64')]=_0x232a60[_0x1318('0x57')]['id'];return _0x4aacec;});return db[_0x1318('0x82')]['bulkCreate'](_0x468573,{'transaction':_0x13a8a1});});})[_0x1318('0x1e')](function(){return db[_0x1318('0x82')][_0x1318('0xa5')]({'where':{'OpenchannelAccountId':_0x232a60[_0x1318('0x57')]['id']},'order':'priority'});});}})[_0x1318('0x1e')](respondWithResult(_0x51d1fd,null))[_0x1318('0x28')](handleError(_0x51d1fd,null));};exports[_0x1318('0xa6')]=function(_0x56a0ad,_0x4c210e,_0x550abf){var _0x37e6aa={};var _0x11782d={};var _0x45a700;var _0x4a1824;return db[_0x1318('0x3c')][_0x1318('0x67')]({'where':{'id':_0x56a0ad[_0x1318('0x57')]['id']}})['then'](handleEntityNotFound(_0x4c210e,null))[_0x1318('0x1e')](function(_0x24de4c){if(_0x24de4c){_0x45a700=_0x24de4c;_0x11782d[_0x1318('0x40')]=_['keys'](db[_0x1318('0x82')][_0x1318('0x3d')]);_0x11782d['query']=_[_0x1318('0x41')](_0x56a0ad[_0x1318('0x42')]);_0x11782d[_0x1318('0x43')]=_[_0x1318('0x44')](_0x11782d[_0x1318('0x40')],_0x11782d['query']);_0x37e6aa[_0x1318('0x45')]=_[_0x1318('0x44')](_0x11782d[_0x1318('0x40')],qs[_0x1318('0x46')](_0x56a0ad[_0x1318('0x42')][_0x1318('0x46')]));_0x37e6aa[_0x1318('0x45')]=_0x37e6aa[_0x1318('0x45')][_0x1318('0x47')]?_0x37e6aa['attributes']:_0x11782d[_0x1318('0x40')];_0x37e6aa[_0x1318('0x4a')]=qs['sort'](_0x56a0ad[_0x1318('0x42')]['sort']);_0x37e6aa[_0x1318('0x4c')]=qs['filters'](_[_0x1318('0x4d')](_0x56a0ad['query'],_0x11782d[_0x1318('0x43')]));if(_0x56a0ad[_0x1318('0x42')][_0x1318('0x4e')]){_0x37e6aa[_0x1318('0x4c')]=_['merge'](_0x37e6aa[_0x1318('0x4c')],{'$or':_[_0x1318('0x3b')](_0x37e6aa[_0x1318('0x45')],function(_0x4e0903){var _0x5cbe70={};_0x5cbe70[_0x4e0903]={'$like':'%'+_0x56a0ad[_0x1318('0x42')][_0x1318('0x4e')]+'%'};return _0x5cbe70;})});}_0x37e6aa=_[_0x1318('0x50')]({},_0x37e6aa,_0x56a0ad['options']);return _0x45a700['getApplications'](_0x37e6aa);}})[_0x1318('0x1e')](function(_0x21df85){if(_0x21df85){_0x4a1824=_0x21df85[_0x1318('0x47')];if(!_0x56a0ad[_0x1318('0x42')][_0x1318('0x48')](_0x1318('0x49'))){_0x37e6aa[_0x1318('0x2e')]=qs['limit'](_0x56a0ad[_0x1318('0x42')]['limit']);_0x37e6aa[_0x1318('0x2d')]=qs['offset'](_0x56a0ad[_0x1318('0x42')][_0x1318('0x2d')]);}return _0x45a700[_0x1318('0xa6')](_0x37e6aa);}})['then'](function(_0x39a995){if(_0x39a995){return _0x39a995?{'count':_0x4a1824,'rows':_0x39a995}:null;}})[_0x1318('0x1e')](respondWithResult(_0x4c210e,null))[_0x1318('0x28')](handleError(_0x4c210e,null));};exports[_0x1318('0xa7')]=function(_0x5bd200,_0x5ede97,_0x5ac6bb){var _0x5854bc={'raw':![],'where':{}};var _0x24269f={};var _0x4aa99d={'count':0x0,'rows':[]};return db[_0x1318('0x3c')][_0x1318('0x67')]({'where':{'id':_0x5bd200[_0x1318('0x57')]['id']}})[_0x1318('0x1e')](handleEntityNotFound(_0x5ede97,null))[_0x1318('0x1e')](function(_0xde9b99){if(_0xde9b99){_0x24269f[_0x1318('0x40')]=_[_0x1318('0x41')](db[_0x1318('0x8d')][_0x1318('0x3d')]);_0x24269f[_0x1318('0x42')]=_[_0x1318('0x41')](_0x5bd200[_0x1318('0x42')]);_0x24269f[_0x1318('0x43')]=_['intersection'](_0x24269f[_0x1318('0x40')],_0x24269f['query']);_0x5854bc[_0x1318('0x45')]=_['intersection'](_0x24269f[_0x1318('0x40')],qs[_0x1318('0x46')](_0x5bd200['query'][_0x1318('0x46')]));_0x5854bc[_0x1318('0x45')]=_0x5854bc[_0x1318('0x45')][_0x1318('0x47')]?_0x5854bc['attributes']:_0x24269f['model'];if(!_0x5bd200[_0x1318('0x42')][_0x1318('0x48')](_0x1318('0x49'))){_0x5854bc[_0x1318('0x2e')]=qs[_0x1318('0x2e')](_0x5bd200[_0x1318('0x42')][_0x1318('0x2e')]);_0x5854bc[_0x1318('0x2d')]=qs['offset'](_0x5bd200[_0x1318('0x42')][_0x1318('0x2d')]);}_0x5854bc[_0x1318('0x4a')]=qs[_0x1318('0x4b')](_0x5bd200['query'][_0x1318('0x4b')]);_0x5854bc[_0x1318('0x4c')]=qs[_0x1318('0x43')](_['pick'](_0x5bd200[_0x1318('0x42')],_0x24269f[_0x1318('0x43')]));_0x5854bc[_0x1318('0x4c')][_0x1318('0x64')]=_0xde9b99['id'];if(_0x5bd200[_0x1318('0x42')][_0x1318('0x4e')]){_0x5854bc['where']=_[_0x1318('0x50')](_0x5854bc[_0x1318('0x4c')],{'$or':_['map'](_0x5854bc['attributes'],function(_0x62e470){var _0x59f720={};_0x59f720[_0x62e470]={'$like':'%'+_0x5bd200[_0x1318('0x42')][_0x1318('0x4e')]+'%'};return _0x59f720;})});}_0x5854bc=_[_0x1318('0x50')]({},_0x5854bc,_0x5bd200['options']);return db[_0x1318('0x8d')][_0x1318('0x52')]({'where':_0x5854bc[_0x1318('0x4c')]})[_0x1318('0x1e')](function(_0x4daa0a){_0x4aa99d['count']=_0x4daa0a;if(_0x5bd200[_0x1318('0x42')][_0x1318('0x53')]){_0x5854bc[_0x1318('0x54')]=[{'model':db[_0x1318('0x70')],'as':_0x1318('0xa8'),'required':![]},{'model':db['User'],'as':_0x1318('0xa9'),'attributes':[_0x1318('0x37'),'fullname',_0x1318('0xaa')],'required':![]},{'model':db[_0x1318('0xab')],'as':_0x1318('0xac'),'attributes':['id','name',_0x1318('0xad')],'where':_0x5bd200[_0x1318('0x42')][_0x1318('0xae')]?{'id':_0x5bd200[_0x1318('0x42')][_0x1318('0xae')]}:undefined,'required':_0x5bd200['query']['tag']?!![]:![]}];}return db[_0x1318('0x8d')][_0x1318('0x55')](_0x5854bc);})[_0x1318('0x1e')](function(_0x2ca7c3){_0x4aa99d[_0x1318('0x68')]=_0x2ca7c3;return _0x4aa99d;});}})[_0x1318('0x1e')](respondWithFilteredResult(_0x5ede97,_0x5854bc))[_0x1318('0x28')](handleError(_0x5ede97,null));};exports[_0x1318('0xaf')]=function(_0x4adfce,_0x7e7434,_0x5cc826){return db['OpenchannelAccount'][_0x1318('0x58')]({'where':{'id':_0x4adfce[_0x1318('0x57')]['id']}})[_0x1318('0x1e')](handleEntityNotFound(_0x7e7434,null))[_0x1318('0x1e')](function(_0x56ff04){if(_0x56ff04){return _0x56ff04[_0x1318('0xaf')](_0x4adfce[_0x1318('0x61')]['ids'],_[_0x1318('0xb0')](_0x4adfce['body'],[_0x1318('0x6a'),'id'])||{})[_0x1318('0x90')](function(_0x1e7d4f){for(var _0x5532eb=0x0;_0x5532eb<_0x4adfce[_0x1318('0x61')][_0x1318('0x6a')][_0x1318('0x47')];_0x5532eb+=0x1){socket[_0x1318('0xb1')]('userOpenchannelAccount:save',{'UserId':_0x4adfce[_0x1318('0x61')][_0x1318('0x6a')][_0x5532eb],'OpenchannelAccountId':_0x4adfce[_0x1318('0x57')]['id']});}return _0x1e7d4f;});}})[_0x1318('0x1e')](respondWithResult(_0x7e7434,null))[_0x1318('0x28')](handleError(_0x7e7434,null));};exports[_0x1318('0xb2')]=function(_0x98cf2e,_0x5c6be9,_0x24d483){return db[_0x1318('0x3c')][_0x1318('0x58')]({'where':{'id':_0x98cf2e[_0x1318('0x57')]['id']}})['then'](handleEntityNotFound(_0x5c6be9,null))[_0x1318('0x1e')](function(_0x53e587){if(_0x53e587){return _0x53e587[_0x1318('0xb2')](_0x98cf2e[_0x1318('0x42')][_0x1318('0x6a')])[_0x1318('0x1e')](function(){if(_[_0x1318('0xb3')](_0x98cf2e[_0x1318('0x42')][_0x1318('0x6a')])){for(var _0x49e677=0x0;_0x49e677<_0x98cf2e[_0x1318('0x42')][_0x1318('0x6a')]['length'];_0x49e677+=0x1){socket[_0x1318('0xb1')]('userOpenchannelAccount:remove',{'UserId':Number(_0x98cf2e[_0x1318('0x42')][_0x1318('0x6a')][_0x49e677]),'OpenchannelAccountId':Number(_0x98cf2e[_0x1318('0x57')]['id'])});}}else{socket[_0x1318('0xb1')](_0x1318('0xb4'),{'UserId':Number(_0x98cf2e[_0x1318('0x42')][_0x1318('0x6a')]),'OpenchannelAccountId':Number(_0x98cf2e[_0x1318('0x57')]['id'])});}});}})['then'](respondWithStatusCode(_0x5c6be9,null))[_0x1318('0x28')](handleError(_0x5c6be9,null));};exports[_0x1318('0xb5')]=function(_0x58d2ab,_0xf8adb,_0x36022c){var _0x3697a0={};var _0x3d99a3={};var _0x499959;var _0xe7ecf8;return db[_0x1318('0x3c')][_0x1318('0x67')]({'where':{'id':_0x58d2ab['params']['id']}})[_0x1318('0x1e')](handleEntityNotFound(_0xf8adb,null))[_0x1318('0x1e')](function(_0x21dcb7){if(_0x21dcb7){_0x499959=_0x21dcb7;_0x3d99a3[_0x1318('0x40')]=_[_0x1318('0x41')](db[_0x1318('0x9c')][_0x1318('0x3d')]);_0x3d99a3[_0x1318('0x42')]=_[_0x1318('0x41')](_0x58d2ab[_0x1318('0x42')]);_0x3d99a3[_0x1318('0x43')]=_[_0x1318('0x44')](_0x3d99a3[_0x1318('0x40')],_0x3d99a3[_0x1318('0x42')]);_0x3697a0[_0x1318('0x45')]=_[_0x1318('0x44')](_0x3d99a3[_0x1318('0x40')],qs['fields'](_0x58d2ab[_0x1318('0x42')]['fields']));_0x3697a0[_0x1318('0x45')]=_0x3697a0[_0x1318('0x45')][_0x1318('0x47')]?_0x3697a0[_0x1318('0x45')]:_0x3d99a3[_0x1318('0x40')];_0x3697a0[_0x1318('0x4a')]=qs[_0x1318('0x4b')](_0x58d2ab['query'][_0x1318('0x4b')]);_0x3697a0[_0x1318('0x4c')]=qs[_0x1318('0x43')](_[_0x1318('0x4d')](_0x58d2ab['query'],_0x3d99a3[_0x1318('0x43')]));if(_0x58d2ab[_0x1318('0x42')][_0x1318('0x4e')]){_0x3697a0[_0x1318('0x4c')]=_[_0x1318('0x50')](_0x3697a0['where'],{'$or':_[_0x1318('0x3b')](_0x3697a0[_0x1318('0x45')],function(_0x4f2cb5){var _0x4c6a16={};_0x4c6a16[_0x4f2cb5]={'$like':'%'+_0x58d2ab['query'][_0x1318('0x4e')]+'%'};return _0x4c6a16;})});}_0x3697a0=_['merge']({},_0x3697a0,_0x58d2ab['options']);return _0x499959[_0x1318('0xb5')](_0x3697a0);}})[_0x1318('0x1e')](function(_0x498029){if(_0x498029){_0xe7ecf8=_0x498029[_0x1318('0x47')];if(!_0x58d2ab[_0x1318('0x42')]['hasOwnProperty']('nolimit')){_0x3697a0[_0x1318('0x2e')]=qs[_0x1318('0x2e')](_0x58d2ab[_0x1318('0x42')]['limit']);_0x3697a0['offset']=qs[_0x1318('0x2d')](_0x58d2ab[_0x1318('0x42')][_0x1318('0x2d')]);}return _0x499959[_0x1318('0xb5')](_0x3697a0);}})['then'](function(_0x2fd7e4){if(_0x2fd7e4){return _0x2fd7e4?{'count':_0xe7ecf8,'rows':_0x2fd7e4}:null;}})[_0x1318('0x1e')](respondWithResult(_0xf8adb,null))['catch'](handleError(_0xf8adb,null));};exports['send']=function(_0x476f90,_0x470a85,_0x32e649){var _0x40668a,_0x49e859,_0x586cef;if(_['isNil'](_0x476f90[_0x1318('0x61')]['body'])||_0x476f90[_0x1318('0x61')]['body']===''){throw new db[(_0x1318('0x79'))][(_0x1318('0x71'))](_0x1318('0x7a'));}if(_[_0x1318('0x78')](_0x476f90['body']['to'])){}_0x40668a=_0x476f90['body']['to'];return db['OpenchannelAccount'][_0x1318('0x67')]({'where':{'id':_0x476f90[_0x1318('0x57')]['id']}})[_0x1318('0x1e')](handleEntityNotFound(_0x470a85,null))[_0x1318('0x1e')](function(_0x4ce2b9){if(_0x4ce2b9){return db['OpenchannelAccount'][_0x1318('0x58')]({'where':{'id':_0x4ce2b9['id']},'include':[{'model':db[_0x1318('0x80')],'as':_0x1318('0x84'),'include':[{'model':db[_0x1318('0x70')],'as':_0x1318('0x81'),'where':{[_0x4ce2b9['mapKey']]:_0x40668a},'limit':0x1,'order':[['updatedAt',_0x1318('0xb6')]]}]}]})[_0x1318('0x1e')](handleEntityNotFound(_0x470a85,null))[_0x1318('0x1e')](function(_0x494a09){if(_0x494a09&&_0x494a09['List']){_0x49e859=_0x494a09[_0x1318('0x5b')]({'plain':!![]});if(_0x49e859['List']&&_0x49e859[_0x1318('0x84')]['Contacts'][_0x1318('0x47')]){return _0x49e859[_0x1318('0x84')][_0x1318('0x81')][0x0];}return db[_0x1318('0x70')][_0x1318('0x59')](_[_0x1318('0x16')](_0x476f90[_0x1318('0x61')],{'firstName':_0x40668a,[_0x494a09[_0x1318('0x7d')]]:_0x40668a,'phone':_0x40668a,'ListId':_0x49e859[_0x1318('0x77')]}));}})[_0x1318('0x1e')](handleEntityNotFound(_0x470a85,null))[_0x1318('0x1e')](function(_0x2f723c){if(_0x2f723c){_0x586cef=_0x2f723c;return db[_0x1318('0x8d')][_0x1318('0x58')]({'where':{'ContactId':_0x586cef['id'],'closed':![],'OpenchannelAccountId':_0x49e859['id']}})[_0x1318('0x1e')](function(_0xd4926e){if(_0xd4926e){return[_0xd4926e,![]];}return db[_0x1318('0x8d')][_0x1318('0x59')]({'UserId':_0x476f90[_0x1318('0x5a')]['id'],'ContactId':_0x586cef['id'],'OpenchannelAccountId':_0x49e859['id'],'lastMsgDirection':_0x1318('0xb7'),'Messages':[_[_0x1318('0x50')](_0x476f90['body'],{'read':![],'body':_0x476f90[_0x1318('0x61')][_0x1318('0x61')],'OpenchannelAccountId':_0x49e859['id'],'UserId':_0x476f90[_0x1318('0x5a')]['id'],'ContactId':_0x586cef['id']})]},{'include':[{'model':db[_0x1318('0x99')],'as':_0x1318('0xb8')}]})[_0x1318('0x1e')](function(_0x3b7f32){return[_0x3b7f32,!![]];});});}})[_0x1318('0x90')](function(_0x4c3bbc,_0x3cad9b){if(_0x3cad9b){return _0x4c3bbc;}return db[_0x1318('0x99')][_0x1318('0x59')](_[_0x1318('0x50')](_0x476f90['body'],{'read':![],'body':_0x476f90['body'][_0x1318('0x61')],'OpenchannelAccountId':_0x49e859['id'],'OpenchannelInteractionId':_0x4c3bbc['id'],'UserId':_0x476f90[_0x1318('0x5a')]['id'],'ContactId':_0x586cef['id']}))[_0x1318('0x1e')](function(_0x205cdc){_0x4c3bbc[_0x1318('0xb9')][_0x1318('0xb8')]=[];_0x4c3bbc[_0x1318('0xb9')]['Messages']['push'](_0x205cdc[_0x1318('0xb9')]);return _0x4c3bbc;});});}})[_0x1318('0x1e')](respondWithResult(_0x470a85,null))[_0x1318('0x28')](handleError(_0x470a85,null));}; \ No newline at end of file +var _0x0a6d=['push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','addApplications','sequelize','findAndCountAll','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','DESC','Messages','dataValues','html-pdf','eml-format','fast-json-patch','moment','bluebird','util','path','ejs','lodash','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','save','update','OpenchannelAccounts','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','order','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','CmContact','OpenchannelApplication','Applications','account','list','applications','priority','asc','Contacts','contact','threadId','externalUrl','OpenchannelInteraction','firstName','lastName','messageId','interaction','created','autoclose'];(function(_0x375c50,_0x7d5ffc){var _0x5858a2=function(_0x2da1f2){while(--_0x2da1f2){_0x375c50['push'](_0x375c50['shift']());}};_0x5858a2(++_0x7d5ffc);}(_0x0a6d,0xdb));var _0xd0a6=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x0a6d[_0x422905];return _0x33dc6c;};'use strict';var pdf=require(_0xd0a6('0x0'));var emlformat=require(_0xd0a6('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd0a6('0x2'));var rp=require('request-promise');var moment=require(_0xd0a6('0x3'));var BPromise=require(_0xd0a6('0x4'));var Mustache=require('mustache');var util=require(_0xd0a6('0x5'));var path=require(_0xd0a6('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd0a6('0x7'));var fs=require('fs');var _=require(_0xd0a6('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd0a6('0x9'));var deskjs=require(_0xd0a6('0xa'));var toCsv=require(_0xd0a6('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd0a6('0xc'));var qs=require(_0xd0a6('0xd'));var as=require(_0xd0a6('0xe'));var hardwareService=require(_0xd0a6('0xf'));var logger=require(_0xd0a6('0x10'))(_0xd0a6('0x11'));var utils=require('../../config/utils');var config=require(_0xd0a6('0x12'));var licenseUtil=require(_0xd0a6('0x13'));var db=require('../../mysqldb')['db'];config[_0xd0a6('0x14')]=_[_0xd0a6('0x15')](config[_0xd0a6('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xd0a6('0x16'))(new Redis(config[_0xd0a6('0x14')]));require(_0xd0a6('0x17'))['register'](socket);var jayson=require(_0xd0a6('0x18'));var client=jayson[_0xd0a6('0x19')][_0xd0a6('0x1a')]({'port':0x232c});var client9002=jayson[_0xd0a6('0x19')][_0xd0a6('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x36063f,_0x103638,_0xe88b64,_0x2e86f4){return new BPromise(function(_0x26ff70,_0x1421f3){var _0x2202ff=_0x2e86f4||client;return _0x2202ff[_0xd0a6('0x1b')](_0x36063f,_0xe88b64)[_0xd0a6('0x1c')](function(_0x63559e){logger['info'](_0xd0a6('0x1d'),_0x103638,_0xd0a6('0x1e'));logger[_0xd0a6('0x1f')](_0xd0a6('0x20'),_0x103638,'request\x20sent',JSON[_0xd0a6('0x21')](_0x63559e));if(_0x63559e[_0xd0a6('0x22')]){if(_0x63559e[_0xd0a6('0x22')][_0xd0a6('0x23')]===0x1f4){logger[_0xd0a6('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x103638,_0x63559e[_0xd0a6('0x22')][_0xd0a6('0x24')]);return _0x1421f3(_0x63559e['error'][_0xd0a6('0x24')]);}logger[_0xd0a6('0x22')](_0xd0a6('0x1d'),_0x103638,_0x63559e[_0xd0a6('0x22')]['message']);return _0x26ff70(_0x63559e[_0xd0a6('0x22')][_0xd0a6('0x24')]);}else{logger[_0xd0a6('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x103638,'request\x20sent');_0x26ff70(_0x63559e[_0xd0a6('0x26')][_0xd0a6('0x24')]);}})['catch'](function(_0x153796){logger[_0xd0a6('0x22')](_0xd0a6('0x1d'),_0x103638,_0x153796);_0x1421f3(_0x153796);});});}function respondWithStatusCode(_0x29ba84,_0x514569){_0x514569=_0x514569||0xcc;return function(_0x5285e5){if(_0x5285e5){return _0x29ba84[_0xd0a6('0x27')](_0x514569);}return _0x29ba84[_0xd0a6('0x28')](_0x514569)[_0xd0a6('0x29')]();};}function respondWithResult(_0x4f66c3,_0x41d7b6){_0x41d7b6=_0x41d7b6||0xc8;return function(_0x3c47dd){if(_0x3c47dd){return _0x4f66c3[_0xd0a6('0x28')](_0x41d7b6)[_0xd0a6('0x2a')](_0x3c47dd);}};}function respondWithFilteredResult(_0x5f6e4e,_0x489957){return function(_0x3a87d0){if(_0x3a87d0){var _0x3fc651=_0x3a87d0[_0xd0a6('0x2b')],_0x59f1c7=_0x489957[_0xd0a6('0x2c')],_0x340b54=_0x489957['offset']+_0x489957[_0xd0a6('0x2d')],_0x465b2a;if(_0x340b54>=_0x3fc651){_0x340b54=_0x3fc651;_0x465b2a=0xc8;}else{_0x465b2a=0xce;}_0x5f6e4e[_0xd0a6('0x28')](_0x465b2a);return _0x5f6e4e['set'](_0xd0a6('0x2e'),_0x59f1c7+'-'+_0x340b54+'/'+_0x3fc651)[_0xd0a6('0x2a')](_0x3a87d0);}return null;};}function patchUpdates(_0x10d332){return function(_0x1fdfe8){try{jsonpatch[_0xd0a6('0x2f')](_0x1fdfe8,_0x10d332,!![]);}catch(_0x1d0698){return BPromise['reject'](_0x1d0698);}return _0x1fdfe8[_0xd0a6('0x30')]();};}function saveUpdates(_0x59e910,_0x5ae789){return function(_0x15b652){if(_0x15b652){return _0x15b652[_0xd0a6('0x31')](_0x59e910)[_0xd0a6('0x1c')](function(_0x1f4c10){return _0x1f4c10;});}return null;};}function removeEntity(_0x38a92a,_0x25b408){return function(_0x4762d6){if(_0x4762d6){return _0x4762d6['destroy']()[_0xd0a6('0x1c')](function(){var _0x3adf89=_0x4762d6['get']({'plain':!![]});var _0x59650b=_0xd0a6('0x32');return db['UserProfileResource'][_0xd0a6('0x33')]({'where':{'type':_0x59650b,'resourceId':_0x3adf89['id']}})[_0xd0a6('0x1c')](function(){return _0x4762d6;});})[_0xd0a6('0x1c')](function(){_0x38a92a[_0xd0a6('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f2529,_0x148b79){return function(_0x26d543){if(!_0x26d543){_0x5f2529[_0xd0a6('0x27')](0x194);}return _0x26d543;};}function handleError(_0xce8972,_0xef075f){_0xef075f=_0xef075f||0x1f4;return function(_0x2abb90){logger[_0xd0a6('0x22')](_0x2abb90[_0xd0a6('0x34')]);if(_0x2abb90[_0xd0a6('0x35')]){delete _0x2abb90['name'];}_0xce8972[_0xd0a6('0x28')](_0xef075f)[_0xd0a6('0x36')](_0x2abb90);};}exports[_0xd0a6('0x37')]=function(_0x588938,_0x3e6f3a){var _0x4a7e2b={'include':[{'model':db[_0xd0a6('0x38')],'as':_0xd0a6('0x39')}]},_0x50536a={},_0x3025ce={'count':0x0,'rows':[]};var _0xe44391=_[_0xd0a6('0x3a')](db[_0xd0a6('0x3b')]['rawAttributes'],function(_0x2a23ac){return{'name':_0x2a23ac[_0xd0a6('0x3c')],'type':_0x2a23ac[_0xd0a6('0x3d')][_0xd0a6('0x3e')]};});_0x50536a[_0xd0a6('0x3f')]=_[_0xd0a6('0x3a')](_0xe44391,_0xd0a6('0x35'));_0x50536a[_0xd0a6('0x40')]=_[_0xd0a6('0x41')](_0x588938[_0xd0a6('0x40')]);_0x50536a['filters']=_[_0xd0a6('0x42')](_0x50536a[_0xd0a6('0x3f')],_0x50536a['query']);_0x4a7e2b[_0xd0a6('0x43')]=_['intersection'](_0x50536a[_0xd0a6('0x3f')],qs[_0xd0a6('0x44')](_0x588938['query'][_0xd0a6('0x44')]));_0x4a7e2b[_0xd0a6('0x43')]=_0x4a7e2b[_0xd0a6('0x43')][_0xd0a6('0x45')]?_0x4a7e2b[_0xd0a6('0x43')]:_0x50536a['model'];if(!_0x588938[_0xd0a6('0x40')][_0xd0a6('0x46')](_0xd0a6('0x47'))){_0x4a7e2b[_0xd0a6('0x2d')]=qs['limit'](_0x588938[_0xd0a6('0x40')]['limit']);_0x4a7e2b['offset']=qs[_0xd0a6('0x2c')](_0x588938['query']['offset']);}_0x4a7e2b['order']=qs[_0xd0a6('0x48')](_0x588938[_0xd0a6('0x40')][_0xd0a6('0x48')]);_0x4a7e2b[_0xd0a6('0x49')]=qs[_0xd0a6('0x4a')](_[_0xd0a6('0x4b')](_0x588938[_0xd0a6('0x40')],_0x50536a[_0xd0a6('0x4a')]),_0xe44391);if(_0x588938[_0xd0a6('0x40')][_0xd0a6('0x4c')]){_0x4a7e2b[_0xd0a6('0x49')]=_[_0xd0a6('0x4d')](_0x4a7e2b[_0xd0a6('0x49')],{'$or':_[_0xd0a6('0x3a')](_0xe44391,function(_0x318c66){if(_0x318c66[_0xd0a6('0x3d')]!==_0xd0a6('0x4e')){var _0x5271a6={};_0x5271a6[_0x318c66['name']]={'$like':'%'+_0x588938[_0xd0a6('0x40')][_0xd0a6('0x4c')]+'%'};return _0x5271a6;}})});}_0x4a7e2b=_[_0xd0a6('0x4d')]({},_0x4a7e2b,_0x588938[_0xd0a6('0x4f')]);var _0x39c2bd={'where':_0x4a7e2b[_0xd0a6('0x49')]};return db[_0xd0a6('0x3b')][_0xd0a6('0x2b')](_0x39c2bd)[_0xd0a6('0x1c')](function(_0x20646a){_0x3025ce['count']=_0x20646a;if(_0x588938['query'][_0xd0a6('0x50')]){_0x4a7e2b[_0xd0a6('0x51')]=[{'all':!![]}];}return db[_0xd0a6('0x3b')][_0xd0a6('0x52')](_0x4a7e2b);})[_0xd0a6('0x1c')](function(_0x386974){_0x3025ce[_0xd0a6('0x53')]=_0x386974;return _0x3025ce;})[_0xd0a6('0x1c')](respondWithFilteredResult(_0x3e6f3a,_0x4a7e2b))['catch'](handleError(_0x3e6f3a,null));};exports[_0xd0a6('0x54')]=function(_0x2fe175,_0x30bbef){var _0x53c6d2={'raw':![],'where':{'id':_0x2fe175[_0xd0a6('0x55')]['id']},'include':[{'model':db[_0xd0a6('0x38')],'as':_0xd0a6('0x39')}]},_0x427051={};_0x427051[_0xd0a6('0x3f')]=_[_0xd0a6('0x41')](db[_0xd0a6('0x3b')][_0xd0a6('0x56')]);_0x427051['query']=_[_0xd0a6('0x41')](_0x2fe175[_0xd0a6('0x40')]);_0x427051[_0xd0a6('0x4a')]=_[_0xd0a6('0x42')](_0x427051[_0xd0a6('0x3f')],_0x427051['query']);_0x53c6d2['attributes']=_[_0xd0a6('0x42')](_0x427051[_0xd0a6('0x3f')],qs[_0xd0a6('0x44')](_0x2fe175[_0xd0a6('0x40')][_0xd0a6('0x44')]));_0x53c6d2[_0xd0a6('0x43')]=_0x53c6d2[_0xd0a6('0x43')][_0xd0a6('0x45')]?_0x53c6d2[_0xd0a6('0x43')]:_0x427051[_0xd0a6('0x3f')];if(_0x2fe175[_0xd0a6('0x40')]['includeAll']){_0x53c6d2[_0xd0a6('0x51')]=[{'all':!![]}];}_0x53c6d2=_['merge']({},_0x53c6d2,_0x2fe175[_0xd0a6('0x4f')]);return db[_0xd0a6('0x3b')][_0xd0a6('0x57')](_0x53c6d2)[_0xd0a6('0x1c')](handleEntityNotFound(_0x30bbef,null))[_0xd0a6('0x1c')](respondWithResult(_0x30bbef,null))[_0xd0a6('0x58')](handleError(_0x30bbef,null));};exports[_0xd0a6('0x59')]=function(_0x4e8f3a,_0x4bf77b){return db[_0xd0a6('0x3b')][_0xd0a6('0x59')](_0x4e8f3a[_0xd0a6('0x5a')],{})['then'](function(_0x2e1f18){var _0x1565c6=_0x4e8f3a[_0xd0a6('0x5b')][_0xd0a6('0x5c')]({'plain':!![]});if(!_0x1565c6)throw new Error(_0xd0a6('0x5d'));if(_0x1565c6[_0xd0a6('0x5e')]===_0xd0a6('0x5b')){var _0x1a076d=_0x2e1f18[_0xd0a6('0x5c')]({'plain':!![]});var _0x23ea67=_0xd0a6('0x32');return db[_0xd0a6('0x5f')][_0xd0a6('0x57')]({'where':{'name':_0x23ea67,'userProfileId':_0x1565c6[_0xd0a6('0x60')]},'raw':!![]})[_0xd0a6('0x1c')](function(_0xd2facb){if(_0xd2facb&&_0xd2facb[_0xd0a6('0x61')]===0x0){return db[_0xd0a6('0x62')][_0xd0a6('0x59')]({'name':_0x1a076d[_0xd0a6('0x35')],'resourceId':_0x1a076d['id'],'type':_0xd2facb[_0xd0a6('0x35')],'sectionId':_0xd2facb['id']},{})[_0xd0a6('0x1c')](function(){return _0x2e1f18;});}else{return _0x2e1f18;}})[_0xd0a6('0x58')](function(_0x2eaa54){logger['error'](_0xd0a6('0x63'),_0x2eaa54);throw _0x2eaa54;});}return _0x2e1f18;})[_0xd0a6('0x1c')](respondWithResult(_0x4bf77b,0xc9))[_0xd0a6('0x58')](handleError(_0x4bf77b,null));};exports[_0xd0a6('0x31')]=function(_0x1847ea,_0x594db1){if(_0x1847ea[_0xd0a6('0x5a')]['id']){delete _0x1847ea[_0xd0a6('0x5a')]['id'];}return db[_0xd0a6('0x3b')]['find']({'where':{'id':_0x1847ea[_0xd0a6('0x55')]['id']},'include':[{'model':db[_0xd0a6('0x38')],'as':_0xd0a6('0x39')}]})[_0xd0a6('0x1c')](handleEntityNotFound(_0x594db1,null))[_0xd0a6('0x1c')](saveUpdates(_0x1847ea[_0xd0a6('0x5a')],null))['then'](respondWithResult(_0x594db1,null))['catch'](handleError(_0x594db1,null));};exports[_0xd0a6('0x33')]=function(_0x22d14d,_0x2f886e){return db[_0xd0a6('0x3b')][_0xd0a6('0x57')]({'where':{'id':_0x22d14d[_0xd0a6('0x55')]['id']}})[_0xd0a6('0x1c')](handleEntityNotFound(_0x2f886e,null))[_0xd0a6('0x1c')](removeEntity(_0x2f886e,null))[_0xd0a6('0x58')](handleError(_0x2f886e,null));};exports['describe']=function(_0x5cc538,_0x533017){return db[_0xd0a6('0x3b')][_0xd0a6('0x64')]()[_0xd0a6('0x1c')](respondWithResult(_0x533017,null))[_0xd0a6('0x58')](handleError(_0x533017,null));};exports['addDisposition']=function(_0x109b6e,_0x44d0ef,_0x351d4b){if(_0x109b6e[_0xd0a6('0x5a')]['id']){delete _0x109b6e[_0xd0a6('0x5a')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x109b6e[_0xd0a6('0x55')]['id']}})['then'](handleEntityNotFound(_0x44d0ef,null))['then'](function(_0x226295){if(_0x226295){_0x109b6e[_0xd0a6('0x5a')][_0xd0a6('0x65')]=_0x226295['id'];return db[_0xd0a6('0x66')]['create'](_0x109b6e[_0xd0a6('0x5a')]);}})[_0xd0a6('0x1c')](respondWithResult(_0x44d0ef,null))[_0xd0a6('0x58')](handleError(_0x44d0ef,null));};exports[_0xd0a6('0x67')]=function(_0x202aa0,_0x3f8bd2,_0xc19076){var _0x5c782f={'raw':![],'where':{}};var _0x2586d7={};var _0x10f9e5={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xd0a6('0x68')]({'where':{'id':_0x202aa0[_0xd0a6('0x55')]['id']}})[_0xd0a6('0x1c')](handleEntityNotFound(_0x3f8bd2,null))['then'](function(_0x8397f0){if(_0x8397f0){_0x2586d7[_0xd0a6('0x3f')]=_['keys'](db[_0xd0a6('0x66')][_0xd0a6('0x56')]);_0x2586d7[_0xd0a6('0x40')]=_[_0xd0a6('0x41')](_0x202aa0[_0xd0a6('0x40')]);_0x2586d7[_0xd0a6('0x4a')]=_[_0xd0a6('0x42')](_0x2586d7['model'],_0x2586d7['query']);_0x5c782f['attributes']=_['intersection'](_0x2586d7[_0xd0a6('0x3f')],qs[_0xd0a6('0x44')](_0x202aa0['query'][_0xd0a6('0x44')]));_0x5c782f['attributes']=_0x5c782f[_0xd0a6('0x43')][_0xd0a6('0x45')]?_0x5c782f['attributes']:_0x2586d7[_0xd0a6('0x3f')];if(!_0x202aa0[_0xd0a6('0x40')][_0xd0a6('0x46')](_0xd0a6('0x47'))){_0x5c782f[_0xd0a6('0x2d')]=qs[_0xd0a6('0x2d')](_0x202aa0[_0xd0a6('0x40')][_0xd0a6('0x2d')]);_0x5c782f['offset']=qs[_0xd0a6('0x2c')](_0x202aa0['query']['offset']);}_0x5c782f[_0xd0a6('0x69')]=qs[_0xd0a6('0x48')](_0x202aa0['query'][_0xd0a6('0x48')]);_0x5c782f[_0xd0a6('0x49')]=qs[_0xd0a6('0x4a')](_[_0xd0a6('0x4b')](_0x202aa0[_0xd0a6('0x40')],_0x2586d7[_0xd0a6('0x4a')]));_0x5c782f[_0xd0a6('0x49')][_0xd0a6('0x65')]=_0x8397f0['id'];if(_0x202aa0[_0xd0a6('0x40')][_0xd0a6('0x4c')]){_0x5c782f['where']=_[_0xd0a6('0x4d')](_0x5c782f[_0xd0a6('0x49')],{'$or':_[_0xd0a6('0x3a')](_0x5c782f[_0xd0a6('0x43')],function(_0x14581d){var _0x11dfb3={};_0x11dfb3[_0x14581d]={'$like':'%'+_0x202aa0[_0xd0a6('0x40')][_0xd0a6('0x4c')]+'%'};return _0x11dfb3;})});}_0x5c782f=_[_0xd0a6('0x4d')]({},_0x5c782f,_0x202aa0[_0xd0a6('0x4f')]);return db[_0xd0a6('0x66')]['count']({'where':_0x5c782f[_0xd0a6('0x49')]})[_0xd0a6('0x1c')](function(_0x215957){_0x10f9e5[_0xd0a6('0x2b')]=_0x215957;if(_0x202aa0[_0xd0a6('0x40')][_0xd0a6('0x50')]){_0x5c782f[_0xd0a6('0x51')]=[{'all':!![]}];}return db[_0xd0a6('0x66')][_0xd0a6('0x52')](_0x5c782f);})[_0xd0a6('0x1c')](function(_0x2aae05){_0x10f9e5[_0xd0a6('0x53')]=_0x2aae05;return _0x10f9e5;});}})[_0xd0a6('0x1c')](respondWithFilteredResult(_0x3f8bd2,_0x5c782f))['catch'](handleError(_0x3f8bd2,null));};exports['removeDispositions']=function(_0x1097ce,_0x2c0d6c,_0x16930f){return db[_0xd0a6('0x3b')][_0xd0a6('0x57')]({'where':{'id':_0x1097ce[_0xd0a6('0x55')]['id']}})[_0xd0a6('0x1c')](handleEntityNotFound(_0x2c0d6c,null))[_0xd0a6('0x1c')](function(_0x1c944c){if(_0x1c944c){return _0x1c944c[_0xd0a6('0x6a')](_0x1097ce['query']['ids']);}})['then'](respondWithStatusCode(_0x2c0d6c,null))[_0xd0a6('0x58')](handleError(_0x2c0d6c,null));};exports[_0xd0a6('0x6b')]=function(_0x5498c3,_0x16dd71,_0x533b6b){if(_0x5498c3[_0xd0a6('0x5a')]['id']){delete _0x5498c3[_0xd0a6('0x5a')]['id'];}return db[_0xd0a6('0x3b')][_0xd0a6('0x57')]({'where':{'id':_0x5498c3['params']['id']}})[_0xd0a6('0x1c')](handleEntityNotFound(_0x16dd71,null))[_0xd0a6('0x1c')](function(_0xa68c14){if(_0xa68c14){_0x5498c3[_0xd0a6('0x5a')]['OpenchannelAccountId']=_0xa68c14['id'];return db[_0xd0a6('0x6c')][_0xd0a6('0x59')](_0x5498c3[_0xd0a6('0x5a')]);}})['then'](respondWithResult(_0x16dd71,null))[_0xd0a6('0x58')](handleError(_0x16dd71,null));};exports[_0xd0a6('0x6d')]=function(_0x446d11,_0x450d21,_0x1a0fe6){var _0x59d277={'raw':![],'where':{}};var _0x16eecd={};var _0xb9bd02={'count':0x0,'rows':[]};return db[_0xd0a6('0x3b')][_0xd0a6('0x68')]({'where':{'id':_0x446d11[_0xd0a6('0x55')]['id']}})[_0xd0a6('0x1c')](handleEntityNotFound(_0x450d21,null))['then'](function(_0x105ff2){if(_0x105ff2){_0x16eecd[_0xd0a6('0x3f')]=_[_0xd0a6('0x41')](db[_0xd0a6('0x6c')][_0xd0a6('0x56')]);_0x16eecd[_0xd0a6('0x40')]=_[_0xd0a6('0x41')](_0x446d11[_0xd0a6('0x40')]);_0x16eecd[_0xd0a6('0x4a')]=_[_0xd0a6('0x42')](_0x16eecd['model'],_0x16eecd[_0xd0a6('0x40')]);_0x59d277['attributes']=_[_0xd0a6('0x42')](_0x16eecd[_0xd0a6('0x3f')],qs[_0xd0a6('0x44')](_0x446d11[_0xd0a6('0x40')]['fields']));_0x59d277['attributes']=_0x59d277['attributes'][_0xd0a6('0x45')]?_0x59d277[_0xd0a6('0x43')]:_0x16eecd[_0xd0a6('0x3f')];if(!_0x446d11[_0xd0a6('0x40')][_0xd0a6('0x46')](_0xd0a6('0x47'))){_0x59d277[_0xd0a6('0x2d')]=qs[_0xd0a6('0x2d')](_0x446d11[_0xd0a6('0x40')][_0xd0a6('0x2d')]);_0x59d277['offset']=qs[_0xd0a6('0x2c')](_0x446d11[_0xd0a6('0x40')][_0xd0a6('0x2c')]);}_0x59d277[_0xd0a6('0x69')]=qs[_0xd0a6('0x48')](_0x446d11['query'][_0xd0a6('0x48')]);_0x59d277['where']=qs[_0xd0a6('0x4a')](_[_0xd0a6('0x4b')](_0x446d11['query'],_0x16eecd[_0xd0a6('0x4a')]));_0x59d277[_0xd0a6('0x49')][_0xd0a6('0x65')]=_0x105ff2['id'];if(_0x446d11[_0xd0a6('0x40')]['filter']){_0x59d277[_0xd0a6('0x49')]=_[_0xd0a6('0x4d')](_0x59d277[_0xd0a6('0x49')],{'$or':_[_0xd0a6('0x3a')](_0x59d277[_0xd0a6('0x43')],function(_0x4f656c){var _0x850b9d={};_0x850b9d[_0x4f656c]={'$like':'%'+_0x446d11[_0xd0a6('0x40')][_0xd0a6('0x4c')]+'%'};return _0x850b9d;})});}_0x59d277=_[_0xd0a6('0x4d')]({},_0x59d277,_0x446d11[_0xd0a6('0x4f')]);return db['CannedAnswer'][_0xd0a6('0x2b')]({'where':_0x59d277[_0xd0a6('0x49')]})[_0xd0a6('0x1c')](function(_0x5bcbd8){_0xb9bd02[_0xd0a6('0x2b')]=_0x5bcbd8;if(_0x446d11[_0xd0a6('0x40')][_0xd0a6('0x50')]){_0x59d277[_0xd0a6('0x51')]=[{'all':!![]}];}return db[_0xd0a6('0x6c')][_0xd0a6('0x52')](_0x59d277);})[_0xd0a6('0x1c')](function(_0x408932){_0xb9bd02[_0xd0a6('0x53')]=_0x408932;return _0xb9bd02;});}})['then'](respondWithFilteredResult(_0x450d21,_0x59d277))['catch'](handleError(_0x450d21,null));};exports[_0xd0a6('0x6e')]=function(_0x5ee748,_0x5a9dc4,_0xe0d8e9){return db[_0xd0a6('0x3b')][_0xd0a6('0x57')]({'where':{'id':_0x5ee748[_0xd0a6('0x55')]['id']}})[_0xd0a6('0x1c')](handleEntityNotFound(_0x5a9dc4,null))[_0xd0a6('0x1c')](function(_0x3bcf73){if(_0x3bcf73){return _0x3bcf73[_0xd0a6('0x6e')](_0x5ee748[_0xd0a6('0x40')][_0xd0a6('0x6f')]);}})[_0xd0a6('0x1c')](respondWithStatusCode(_0x5a9dc4,null))[_0xd0a6('0x58')](handleError(_0x5a9dc4,null));};exports[_0xd0a6('0x70')]=function(_0x19e79e,_0x327aaa,_0x1ea479){var _0x4042ec={'body':_0x19e79e['body'],'channel':'openchannel'};var _0x301a72=[];var _0x320e04=[];var _0x490191={};var _0x13c93a=![];return db['CmContact'][_0xd0a6('0x64')]()[_0xd0a6('0x1c')](function(_0x3cf77e){if(!_0x3cf77e){throw new db['Sequelize'][(_0xd0a6('0x71'))](_0xd0a6('0x72'));}_0x301a72=_['difference'](_[_0xd0a6('0x41')](_0x3cf77e),[_0xd0a6('0x73'),_0xd0a6('0x74')]);_0x320e04=_[_0xd0a6('0x75')](_['keys'](_0x3cf77e),[_0xd0a6('0x73'),_0xd0a6('0x74'),'CompanyId',_0xd0a6('0x76')]);if(_0x19e79e[_0xd0a6('0x5a')]['id']){delete _0x19e79e['body']['id'];}if(_['isNil'](_0x19e79e[_0xd0a6('0x5a')][_0xd0a6('0x77')])){throw new db[(_0xd0a6('0x78'))][(_0xd0a6('0x71'))](_0xd0a6('0x79'));}if(_['isNil'](_0x19e79e['body'][_0xd0a6('0x5a')])||_0x19e79e['body']['body']===''){throw new db[(_0xd0a6('0x78'))][(_0xd0a6('0x71'))](_0xd0a6('0x7a'));}if(_[_0xd0a6('0x7b')](_0x19e79e[_0xd0a6('0x5a')][_0xd0a6('0x7c')])){throw new db['Sequelize'][(_0xd0a6('0x71'))](_0xd0a6('0x7d')+_0x320e04);}if(!_['includes'](_0x320e04,_0x19e79e['body'][_0xd0a6('0x7c')])){throw new db[(_0xd0a6('0x78'))][(_0xd0a6('0x71'))](_0xd0a6('0x7e')+_0x320e04);}_0x490191[_0x19e79e[_0xd0a6('0x5a')][_0xd0a6('0x7c')]]=_0x19e79e[_0xd0a6('0x5a')]['from'];})[_0xd0a6('0x1c')](function(){return db[_0xd0a6('0x3b')][_0xd0a6('0x57')]({'where':{'id':_0x19e79e[_0xd0a6('0x55')]['id']},'include':[{'model':db['CmList'],'as':_0xd0a6('0x7f'),'include':[{'model':db[_0xd0a6('0x80')],'as':'Contacts','where':_0x490191,'limit':0x1,'order':[[_0xd0a6('0x74'),'DESC']]}]},{'model':db[_0xd0a6('0x81')],'as':_0xd0a6('0x82')}]});})[_0xd0a6('0x1c')](handleEntityNotFound(_0x327aaa,null))['then'](function(_0x4182b8){if(_0x4182b8&&_0x4182b8[_0xd0a6('0x7f')]){_0x4042ec[_0xd0a6('0x83')]=_0x4182b8;_0x4042ec['applications']=_0x4182b8[_0xd0a6('0x82')];_0x4042ec[_0xd0a6('0x84')]=_0x4182b8['List'];_0x4042ec[_0xd0a6('0x85')]=_['orderBy'](_0x4042ec[_0xd0a6('0x85')],[_0xd0a6('0x86')],[_0xd0a6('0x87')]);if(_0x4042ec['account'][_0xd0a6('0x82')]){delete _0x4042ec[_0xd0a6('0x83')][_0xd0a6('0x82')];}if(_0x4042ec['account'][_0xd0a6('0x7f')]&&_0x4042ec[_0xd0a6('0x83')]['List']['Contacts']['length']){return _0x4042ec[_0xd0a6('0x83')][_0xd0a6('0x7f')][_0xd0a6('0x88')][0x0];}var _0x5116a6=_['defaults'](_0x19e79e[_0xd0a6('0x5a')],{'firstName':_0x19e79e[_0xd0a6('0x5a')][_0xd0a6('0x77')],'ListId':_0x4182b8[_0xd0a6('0x76')]});_0x5116a6[_0x19e79e[_0xd0a6('0x5a')][_0xd0a6('0x7c')]]=_0x19e79e['body']['from'];return db[_0xd0a6('0x80')]['create'](_0x5116a6,{'fields':_0x301a72,'raw':!![]});}})['then'](handleEntityNotFound(_0x327aaa,null))[_0xd0a6('0x1c')](function(_0x5cba9b){_0x4042ec[_0xd0a6('0x89')]=_0x5cba9b;if(_0x5cba9b){var _0x472381={'ContactId':_0x5cba9b['id'],'OpenchannelAccountId':_0x19e79e[_0xd0a6('0x55')]['id'],'from':(_0x5cba9b['firstName']||'')+'\x20'+(_0x5cba9b['lastName']||'')};var _0x15581c={'OpenchannelAccountId':_0x19e79e[_0xd0a6('0x55')]['id'],'closed':![]};if(_0x19e79e[_0xd0a6('0x5a')]['threadId']){_0x15581c[_0xd0a6('0x8a')]=_0x19e79e[_0xd0a6('0x5a')]['threadId'];return db['OpenchannelInteraction'][_0xd0a6('0x57')]({'where':_0x15581c})['then'](function(_0x4b3629){if(_0x4b3629){return[_0x4b3629,![]];}_0x472381[_0xd0a6('0x8a')]=_0x19e79e['body'][_0xd0a6('0x8a')];_0x472381[_0xd0a6('0x8b')]=_0x19e79e[_0xd0a6('0x5a')][_0xd0a6('0x8b')];return db[_0xd0a6('0x8c')][_0xd0a6('0x59')](_0x472381)[_0xd0a6('0x1c')](function(_0x4adaec){return[_0x4adaec,!![]];});});}else{_0x15581c[_0xd0a6('0x8a')]=null;}_0x15581c['ContactId']=_0x5cba9b['id'];return db[_0xd0a6('0x8c')]['find']({'where':_0x15581c})[_0xd0a6('0x1c')](function(_0x4ca527){if(_0x4ca527){return[_0x4ca527,![]];}return db['OpenchannelInteraction']['create'](_0x472381)['then'](function(_0xdd9360){return[_0xdd9360,!![]];});});}})['spread'](function(_0x4b0bfa,_0x3724cb){if(_0x4b0bfa){_0x13c93a=_0x3724cb;if(!_0x3724cb){var _0x353354={'from':(_0x4042ec[_0xd0a6('0x89')][_0xd0a6('0x8d')]||'')+'\x20'+(_0x4042ec[_0xd0a6('0x89')][_0xd0a6('0x8e')]||'')};if(_0x19e79e[_0xd0a6('0x5a')][_0xd0a6('0x8a')]&&_0x19e79e['body']['messageId']&&_0x19e79e[_0xd0a6('0x5a')][_0xd0a6('0x8a')]!=_0x19e79e[_0xd0a6('0x5a')]['messageId']){_0x353354['threadId']=_0x19e79e['body'][_0xd0a6('0x8f')];}return _0x4b0bfa[_0xd0a6('0x31')](_0x353354);}else{return _0x4b0bfa;}}})[_0xd0a6('0x1c')](function(_0x178f57){_0x4042ec['interaction']=_0x178f57[_0xd0a6('0x5c')]({'plain':!![]});_0x4042ec[_0xd0a6('0x90')][_0xd0a6('0x91')]=_0x13c93a;if(_0x4042ec[_0xd0a6('0x90')]['created']){if(_0x4042ec[_0xd0a6('0x83')][_0xd0a6('0x92')]){_0x4042ec[_0xd0a6('0x85')][_0xd0a6('0x93')]({'id':0x0,'priority':_0x4042ec[_0xd0a6('0x85')][_0xd0a6('0x45')]+0x1,'app':_0xd0a6('0x94'),'appdata':_0xd0a6('0x95'),'interval':_0xd0a6('0x96')});}}return db[_0xd0a6('0x97')][_0xd0a6('0x59')]({'body':_0x19e79e[_0xd0a6('0x5a')][_0xd0a6('0x5a')],'OpenchannelAccountId':_0x19e79e[_0xd0a6('0x55')]['id'],'OpenchannelInteractionId':_0x178f57['id'],'direction':'in','ContactId':_0x4042ec[_0xd0a6('0x89')]['id'],'AttachmentId':_0x19e79e[_0xd0a6('0x5a')][_0xd0a6('0x98')]});})[_0xd0a6('0x1c')](function(_0x4ed44b){_0x4042ec[_0xd0a6('0x24')]=_0x4ed44b;if(_0x4042ec[_0xd0a6('0x90')][_0xd0a6('0x99')]){return db[_0xd0a6('0x9a')]['find']({'attributes':['id','name'],'where':{'id':_0x4042ec[_0xd0a6('0x90')][_0xd0a6('0x99')]}})['then'](function(_0x6acecf){if(_0x6acecf){_0x4042ec[_0xd0a6('0x85')]['unshift']({'id':0x0,'priority':0x0,'app':_0xd0a6('0x9b'),'appdata':_0x6acecf['name']+','+(_0x4042ec['account'][_0xd0a6('0x9c')]||0xa),'interval':'*,*,*,*'});_0x4042ec['forcedOwnership']=![];}return respondWithRpcPromise(_0xd0a6('0x9d'),_0xd0a6('0x9e'),_0x4042ec);});}return respondWithRpcPromise(_0xd0a6('0x9d'),_0xd0a6('0x9e'),_0x4042ec);})[_0xd0a6('0x1c')](function(_0x260d64){respondWithRpcPromise(_0xd0a6('0x9f'),_0xd0a6('0x9f'),{'event':_0xd0a6('0x70'),'message':_0x260d64},client9002);return _0x260d64;})['then'](respondWithResult(_0x327aaa,null))[_0xd0a6('0x58')](handleError(_0x327aaa,null));};exports[_0xd0a6('0xa0')]=function(_0x38d13f,_0x3dbdaf,_0xea5536){return db[_0xd0a6('0x3b')]['findOne']({'where':{'id':_0x38d13f[_0xd0a6('0x55')]['id']}})[_0xd0a6('0x1c')](handleEntityNotFound(_0x3dbdaf,null))['then'](function(_0x2220f6){if(_0x2220f6){return db[_0xd0a6('0xa1')]['transaction'](function(_0x1d08d3){return db[_0xd0a6('0x81')]['destroy']({'where':{'OpenchannelAccountId':_0x38d13f[_0xd0a6('0x55')]['id']},'transaction':_0x1d08d3})['then'](function(_0x534378){var _0x1eedcd=_['map'](_0x38d13f['body'],function(_0x4b4b16){_0x4b4b16[_0xd0a6('0x65')]=_0x38d13f['params']['id'];return _0x4b4b16;});return db['OpenchannelApplication']['bulkCreate'](_0x1eedcd,{'transaction':_0x1d08d3});});})['then'](function(){return db[_0xd0a6('0x81')][_0xd0a6('0xa2')]({'where':{'OpenchannelAccountId':_0x38d13f[_0xd0a6('0x55')]['id']},'order':'priority'});});}})[_0xd0a6('0x1c')](respondWithResult(_0x3dbdaf,null))[_0xd0a6('0x58')](handleError(_0x3dbdaf,null));};exports[_0xd0a6('0xa3')]=function(_0x38a74a,_0x3b9217,_0x4e3207){var _0x2ee6a0={};var _0x422dae={};var _0x17f5b3;var _0x1ac396;return db[_0xd0a6('0x3b')][_0xd0a6('0x68')]({'where':{'id':_0x38a74a[_0xd0a6('0x55')]['id']}})[_0xd0a6('0x1c')](handleEntityNotFound(_0x3b9217,null))[_0xd0a6('0x1c')](function(_0x28e40b){if(_0x28e40b){_0x17f5b3=_0x28e40b;_0x422dae[_0xd0a6('0x3f')]=_['keys'](db['OpenchannelApplication'][_0xd0a6('0x56')]);_0x422dae['query']=_[_0xd0a6('0x41')](_0x38a74a[_0xd0a6('0x40')]);_0x422dae[_0xd0a6('0x4a')]=_[_0xd0a6('0x42')](_0x422dae['model'],_0x422dae[_0xd0a6('0x40')]);_0x2ee6a0['attributes']=_[_0xd0a6('0x42')](_0x422dae[_0xd0a6('0x3f')],qs[_0xd0a6('0x44')](_0x38a74a[_0xd0a6('0x40')]['fields']));_0x2ee6a0[_0xd0a6('0x43')]=_0x2ee6a0[_0xd0a6('0x43')][_0xd0a6('0x45')]?_0x2ee6a0[_0xd0a6('0x43')]:_0x422dae[_0xd0a6('0x3f')];_0x2ee6a0[_0xd0a6('0x69')]=qs[_0xd0a6('0x48')](_0x38a74a[_0xd0a6('0x40')][_0xd0a6('0x48')]);_0x2ee6a0[_0xd0a6('0x49')]=qs[_0xd0a6('0x4a')](_[_0xd0a6('0x4b')](_0x38a74a[_0xd0a6('0x40')],_0x422dae[_0xd0a6('0x4a')]));if(_0x38a74a[_0xd0a6('0x40')]['filter']){_0x2ee6a0[_0xd0a6('0x49')]=_[_0xd0a6('0x4d')](_0x2ee6a0[_0xd0a6('0x49')],{'$or':_['map'](_0x2ee6a0[_0xd0a6('0x43')],function(_0x153c00){var _0x3c0c1b={};_0x3c0c1b[_0x153c00]={'$like':'%'+_0x38a74a[_0xd0a6('0x40')][_0xd0a6('0x4c')]+'%'};return _0x3c0c1b;})});}_0x2ee6a0=_[_0xd0a6('0x4d')]({},_0x2ee6a0,_0x38a74a['options']);return _0x17f5b3[_0xd0a6('0xa3')](_0x2ee6a0);}})[_0xd0a6('0x1c')](function(_0x214676){if(_0x214676){_0x1ac396=_0x214676[_0xd0a6('0x45')];if(!_0x38a74a[_0xd0a6('0x40')][_0xd0a6('0x46')]('nolimit')){_0x2ee6a0[_0xd0a6('0x2d')]=qs[_0xd0a6('0x2d')](_0x38a74a[_0xd0a6('0x40')]['limit']);_0x2ee6a0[_0xd0a6('0x2c')]=qs['offset'](_0x38a74a['query'][_0xd0a6('0x2c')]);}return _0x17f5b3['getApplications'](_0x2ee6a0);}})['then'](function(_0x56e48e){if(_0x56e48e){return _0x56e48e?{'count':_0x1ac396,'rows':_0x56e48e}:null;}})[_0xd0a6('0x1c')](respondWithResult(_0x3b9217,null))[_0xd0a6('0x58')](handleError(_0x3b9217,null));};exports[_0xd0a6('0xa4')]=function(_0x22f9cf,_0x16a095,_0x868d1f){var _0x5af647={'raw':![],'where':{}};var _0x2401e0={};var _0x350319={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x22f9cf[_0xd0a6('0x55')]['id']}})[_0xd0a6('0x1c')](handleEntityNotFound(_0x16a095,null))[_0xd0a6('0x1c')](function(_0x3095cf){if(_0x3095cf){_0x2401e0['model']=_[_0xd0a6('0x41')](db['OpenchannelInteraction'][_0xd0a6('0x56')]);_0x2401e0[_0xd0a6('0x40')]=_['keys'](_0x22f9cf['query']);_0x2401e0[_0xd0a6('0x4a')]=_[_0xd0a6('0x42')](_0x2401e0[_0xd0a6('0x3f')],_0x2401e0[_0xd0a6('0x40')]);_0x5af647[_0xd0a6('0x43')]=_[_0xd0a6('0x42')](_0x2401e0['model'],qs[_0xd0a6('0x44')](_0x22f9cf[_0xd0a6('0x40')][_0xd0a6('0x44')]));_0x5af647[_0xd0a6('0x43')]=_0x5af647['attributes'][_0xd0a6('0x45')]?_0x5af647['attributes']:_0x2401e0['model'];if(!_0x22f9cf[_0xd0a6('0x40')]['hasOwnProperty'](_0xd0a6('0x47'))){_0x5af647[_0xd0a6('0x2d')]=qs[_0xd0a6('0x2d')](_0x22f9cf[_0xd0a6('0x40')][_0xd0a6('0x2d')]);_0x5af647[_0xd0a6('0x2c')]=qs['offset'](_0x22f9cf['query'][_0xd0a6('0x2c')]);}_0x5af647[_0xd0a6('0x69')]=qs[_0xd0a6('0x48')](_0x22f9cf[_0xd0a6('0x40')][_0xd0a6('0x48')]);_0x5af647[_0xd0a6('0x49')]=qs[_0xd0a6('0x4a')](_[_0xd0a6('0x4b')](_0x22f9cf[_0xd0a6('0x40')],_0x2401e0['filters']));_0x5af647[_0xd0a6('0x49')][_0xd0a6('0x65')]=_0x3095cf['id'];if(_0x22f9cf[_0xd0a6('0x40')][_0xd0a6('0x4c')]){_0x5af647['where']=_[_0xd0a6('0x4d')](_0x5af647[_0xd0a6('0x49')],{'$or':_[_0xd0a6('0x3a')](_0x5af647[_0xd0a6('0x43')],function(_0x16a150){var _0x13c06c={};_0x13c06c[_0x16a150]={'$like':'%'+_0x22f9cf[_0xd0a6('0x40')][_0xd0a6('0x4c')]+'%'};return _0x13c06c;})});}_0x5af647=_[_0xd0a6('0x4d')]({},_0x5af647,_0x22f9cf['options']);return db['OpenchannelInteraction'][_0xd0a6('0x2b')]({'where':_0x5af647[_0xd0a6('0x49')]})[_0xd0a6('0x1c')](function(_0x4cea5d){_0x350319[_0xd0a6('0x2b')]=_0x4cea5d;if(_0x22f9cf[_0xd0a6('0x40')][_0xd0a6('0x50')]){_0x5af647[_0xd0a6('0x51')]=[{'model':db[_0xd0a6('0x80')],'as':_0xd0a6('0xa5'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xd0a6('0x35'),_0xd0a6('0xa6'),_0xd0a6('0xa7')],'required':![]},{'model':db[_0xd0a6('0xa8')],'as':_0xd0a6('0xa9'),'attributes':['id',_0xd0a6('0x35'),'color'],'where':_0x22f9cf[_0xd0a6('0x40')][_0xd0a6('0xaa')]?{'id':_0x22f9cf[_0xd0a6('0x40')]['tag']}:undefined,'required':_0x22f9cf[_0xd0a6('0x40')]['tag']?!![]:![]}];}return db[_0xd0a6('0x8c')][_0xd0a6('0x52')](_0x5af647);})[_0xd0a6('0x1c')](function(_0x338fe2){_0x350319[_0xd0a6('0x53')]=_0x338fe2;return _0x350319;});}})[_0xd0a6('0x1c')](respondWithFilteredResult(_0x16a095,_0x5af647))[_0xd0a6('0x58')](handleError(_0x16a095,null));};exports[_0xd0a6('0xab')]=function(_0x511b92,_0x43cd94,_0x4fb1dd){return db[_0xd0a6('0x3b')][_0xd0a6('0x57')]({'where':{'id':_0x511b92[_0xd0a6('0x55')]['id']}})['then'](handleEntityNotFound(_0x43cd94,null))['then'](function(_0x5dc865){if(_0x5dc865){return _0x5dc865[_0xd0a6('0xab')](_0x511b92[_0xd0a6('0x5a')][_0xd0a6('0x6f')],_[_0xd0a6('0xac')](_0x511b92[_0xd0a6('0x5a')],['ids','id'])||{})[_0xd0a6('0xad')](function(_0x1b85ee){for(var _0x58a22d=0x0;_0x58a22d<_0x511b92['body'][_0xd0a6('0x6f')][_0xd0a6('0x45')];_0x58a22d+=0x1){socket[_0xd0a6('0xae')](_0xd0a6('0xaf'),{'UserId':_0x511b92[_0xd0a6('0x5a')][_0xd0a6('0x6f')][_0x58a22d],'OpenchannelAccountId':_0x511b92['params']['id']});}return _0x1b85ee;});}})[_0xd0a6('0x1c')](respondWithResult(_0x43cd94,null))[_0xd0a6('0x58')](handleError(_0x43cd94,null));};exports[_0xd0a6('0xb0')]=function(_0x211a40,_0xdf5f1a,_0x48a883){return db[_0xd0a6('0x3b')]['find']({'where':{'id':_0x211a40[_0xd0a6('0x55')]['id']}})[_0xd0a6('0x1c')](handleEntityNotFound(_0xdf5f1a,null))[_0xd0a6('0x1c')](function(_0x1b3ad9){if(_0x1b3ad9){return _0x1b3ad9['removeAgents'](_0x211a40[_0xd0a6('0x40')][_0xd0a6('0x6f')])['then'](function(){if(_[_0xd0a6('0xb1')](_0x211a40[_0xd0a6('0x40')][_0xd0a6('0x6f')])){for(var _0x306181=0x0;_0x306181<_0x211a40['query']['ids'][_0xd0a6('0x45')];_0x306181+=0x1){socket[_0xd0a6('0xae')](_0xd0a6('0xb2'),{'UserId':Number(_0x211a40[_0xd0a6('0x40')][_0xd0a6('0x6f')][_0x306181]),'OpenchannelAccountId':Number(_0x211a40[_0xd0a6('0x55')]['id'])});}}else{socket[_0xd0a6('0xae')](_0xd0a6('0xb2'),{'UserId':Number(_0x211a40['query']['ids']),'OpenchannelAccountId':Number(_0x211a40[_0xd0a6('0x55')]['id'])});}});}})[_0xd0a6('0x1c')](respondWithStatusCode(_0xdf5f1a,null))[_0xd0a6('0x58')](handleError(_0xdf5f1a,null));};exports['getAgents']=function(_0xeec6d2,_0x560a0e,_0xb5ba12){var _0x46878b={};var _0x365a27={};var _0x420b05;var _0xe4c8fc;return db['OpenchannelAccount'][_0xd0a6('0x68')]({'where':{'id':_0xeec6d2[_0xd0a6('0x55')]['id']}})[_0xd0a6('0x1c')](handleEntityNotFound(_0x560a0e,null))[_0xd0a6('0x1c')](function(_0x1e4322){if(_0x1e4322){_0x420b05=_0x1e4322;_0x365a27[_0xd0a6('0x3f')]=_[_0xd0a6('0x41')](db[_0xd0a6('0x9a')][_0xd0a6('0x56')]);_0x365a27['query']=_['keys'](_0xeec6d2[_0xd0a6('0x40')]);_0x365a27['filters']=_['intersection'](_0x365a27['model'],_0x365a27[_0xd0a6('0x40')]);_0x46878b[_0xd0a6('0x43')]=_[_0xd0a6('0x42')](_0x365a27[_0xd0a6('0x3f')],qs['fields'](_0xeec6d2['query']['fields']));_0x46878b[_0xd0a6('0x43')]=_0x46878b['attributes'][_0xd0a6('0x45')]?_0x46878b['attributes']:_0x365a27['model'];_0x46878b[_0xd0a6('0x69')]=qs[_0xd0a6('0x48')](_0xeec6d2[_0xd0a6('0x40')][_0xd0a6('0x48')]);_0x46878b[_0xd0a6('0x49')]=qs['filters'](_['pick'](_0xeec6d2[_0xd0a6('0x40')],_0x365a27[_0xd0a6('0x4a')]));if(_0xeec6d2[_0xd0a6('0x40')][_0xd0a6('0x4c')]){_0x46878b[_0xd0a6('0x49')]=_[_0xd0a6('0x4d')](_0x46878b['where'],{'$or':_[_0xd0a6('0x3a')](_0x46878b[_0xd0a6('0x43')],function(_0xe1a961){var _0xc026ad={};_0xc026ad[_0xe1a961]={'$like':'%'+_0xeec6d2['query'][_0xd0a6('0x4c')]+'%'};return _0xc026ad;})});}_0x46878b=_[_0xd0a6('0x4d')]({},_0x46878b,_0xeec6d2['options']);return _0x420b05[_0xd0a6('0xb3')](_0x46878b);}})['then'](function(_0x4ac650){if(_0x4ac650){_0xe4c8fc=_0x4ac650[_0xd0a6('0x45')];if(!_0xeec6d2[_0xd0a6('0x40')][_0xd0a6('0x46')]('nolimit')){_0x46878b[_0xd0a6('0x2d')]=qs[_0xd0a6('0x2d')](_0xeec6d2[_0xd0a6('0x40')][_0xd0a6('0x2d')]);_0x46878b[_0xd0a6('0x2c')]=qs[_0xd0a6('0x2c')](_0xeec6d2[_0xd0a6('0x40')][_0xd0a6('0x2c')]);}return _0x420b05[_0xd0a6('0xb3')](_0x46878b);}})[_0xd0a6('0x1c')](function(_0xc2ed7e){if(_0xc2ed7e){return _0xc2ed7e?{'count':_0xe4c8fc,'rows':_0xc2ed7e}:null;}})[_0xd0a6('0x1c')](respondWithResult(_0x560a0e,null))['catch'](handleError(_0x560a0e,null));};exports[_0xd0a6('0x36')]=function(_0x2eefce,_0x300467,_0x486b80){var _0x1c2022,_0x10fb73,_0x151f0e;if(_[_0xd0a6('0x7b')](_0x2eefce[_0xd0a6('0x5a')][_0xd0a6('0x5a')])||_0x2eefce[_0xd0a6('0x5a')]['body']===''){throw new db[(_0xd0a6('0x78'))][(_0xd0a6('0x71'))](_0xd0a6('0x7a'));}if(_[_0xd0a6('0x7b')](_0x2eefce[_0xd0a6('0x5a')]['to'])){}_0x1c2022=_0x2eefce[_0xd0a6('0x5a')]['to'];return db[_0xd0a6('0x3b')][_0xd0a6('0x68')]({'where':{'id':_0x2eefce[_0xd0a6('0x55')]['id']}})[_0xd0a6('0x1c')](handleEntityNotFound(_0x300467,null))['then'](function(_0x29e900){if(_0x29e900){return db[_0xd0a6('0x3b')][_0xd0a6('0x57')]({'where':{'id':_0x29e900['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xd0a6('0x80')],'as':'Contacts','where':{[_0x29e900[_0xd0a6('0x7c')]]:_0x1c2022},'limit':0x1,'order':[[_0xd0a6('0x74'),_0xd0a6('0xb4')]]}]}]})[_0xd0a6('0x1c')](handleEntityNotFound(_0x300467,null))[_0xd0a6('0x1c')](function(_0x28d2b9){if(_0x28d2b9&&_0x28d2b9['List']){_0x10fb73=_0x28d2b9[_0xd0a6('0x5c')]({'plain':!![]});if(_0x10fb73[_0xd0a6('0x7f')]&&_0x10fb73[_0xd0a6('0x7f')][_0xd0a6('0x88')]['length']){return _0x10fb73[_0xd0a6('0x7f')]['Contacts'][0x0];}return db[_0xd0a6('0x80')][_0xd0a6('0x59')](_[_0xd0a6('0x15')](_0x2eefce[_0xd0a6('0x5a')],{'firstName':_0x1c2022,[_0x28d2b9[_0xd0a6('0x7c')]]:_0x1c2022,'phone':_0x1c2022,'ListId':_0x10fb73[_0xd0a6('0x76')]}));}})[_0xd0a6('0x1c')](handleEntityNotFound(_0x300467,null))[_0xd0a6('0x1c')](function(_0x3f434b){if(_0x3f434b){_0x151f0e=_0x3f434b;return db[_0xd0a6('0x8c')]['find']({'where':{'ContactId':_0x151f0e['id'],'closed':![],'OpenchannelAccountId':_0x10fb73['id']}})[_0xd0a6('0x1c')](function(_0x532bfd){if(_0x532bfd){return[_0x532bfd,![]];}return db[_0xd0a6('0x8c')]['create']({'UserId':_0x2eefce[_0xd0a6('0x5b')]['id'],'ContactId':_0x151f0e['id'],'OpenchannelAccountId':_0x10fb73['id'],'lastMsgDirection':'out','Messages':[_[_0xd0a6('0x4d')](_0x2eefce[_0xd0a6('0x5a')],{'read':![],'body':_0x2eefce['body'][_0xd0a6('0x5a')],'OpenchannelAccountId':_0x10fb73['id'],'UserId':_0x2eefce[_0xd0a6('0x5b')]['id'],'ContactId':_0x151f0e['id']})]},{'include':[{'model':db[_0xd0a6('0x97')],'as':_0xd0a6('0xb5')}]})[_0xd0a6('0x1c')](function(_0x3ba6ed){return[_0x3ba6ed,!![]];});});}})[_0xd0a6('0xad')](function(_0x3e9fc6,_0xf92c19){if(_0xf92c19){return _0x3e9fc6;}return db[_0xd0a6('0x97')]['create'](_[_0xd0a6('0x4d')](_0x2eefce[_0xd0a6('0x5a')],{'read':![],'body':_0x2eefce[_0xd0a6('0x5a')][_0xd0a6('0x5a')],'OpenchannelAccountId':_0x10fb73['id'],'OpenchannelInteractionId':_0x3e9fc6['id'],'UserId':_0x2eefce['user']['id'],'ContactId':_0x151f0e['id']}))[_0xd0a6('0x1c')](function(_0x515d96){_0x3e9fc6[_0xd0a6('0xb6')][_0xd0a6('0xb5')]=[];_0x3e9fc6[_0xd0a6('0xb6')][_0xd0a6('0xb5')]['push'](_0x515d96['dataValues']);return _0x3e9fc6;});});}})['then'](respondWithResult(_0x300467,null))[_0xd0a6('0x58')](handleError(_0x300467,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 9d08fdf..340c9ba 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 _0x32bc=['events','OpenchannelAccount','update','remove','hasOwnProperty','hook'];(function(_0x549e1d,_0x4c5ddf){var _0x2da99d=function(_0x49f919){while(--_0x49f919){_0x549e1d['push'](_0x549e1d['shift']());}};_0x2da99d(++_0x4c5ddf);}(_0x32bc,0x12c));var _0xc32b=function(_0x69d1e7,_0x32abb4){_0x69d1e7=_0x69d1e7-0x0;var _0xa45a7e=_0x32bc[_0x69d1e7];return _0xa45a7e;};'use strict';var EventEmitter=require(_0xc32b('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xc32b('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc32b('0x2'),'afterDestroy':_0xc32b('0x3')};function emitEvent(_0x4a2dbd){return function(_0x458077,_0x1fab1d,_0x4c5193){OpenchannelAccountEvents['emit'](_0x4a2dbd+':'+_0x458077['id'],_0x458077);OpenchannelAccountEvents['emit'](_0x4a2dbd,_0x458077);_0x4c5193(null);};}for(var e in events){if(events[_0xc32b('0x4')](e)){var event=events[e];OpenchannelAccount[_0xc32b('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xc110=['hook','exports','events','OpenchannelAccount','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x1e928f,_0x2c599d){var _0x1910bc=function(_0x375284){while(--_0x375284){_0x1e928f['push'](_0x1e928f['shift']());}};_0x1910bc(++_0x2c599d);}(_0xc110,0x9b));var _0x0c11=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc110[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x0c11('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x0c11('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x0c11('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0c11('0x3'),'afterDestroy':_0x0c11('0x4')};function emitEvent(_0x3cf753){return function(_0x53c755,_0x3516e0,_0x2c4699){OpenchannelAccountEvents[_0x0c11('0x5')](_0x3cf753+':'+_0x53c755['id'],_0x53c755);OpenchannelAccountEvents[_0x0c11('0x5')](_0x3cf753,_0x53c755);_0x2c4699(null);};}for(var e in events){if(events[_0x0c11('0x6')](e)){var event=events[e];OpenchannelAccount[_0x0c11('0x7')](e,emitEvent(event));}}module[_0x0c11('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 5ba0e65..699452d 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 _0xb492=['path','rimraf','../../config/environment','./openchannelAccount.attributes','define','OpenchannelAccount','openchannel_accounts','util','../../config/logger','api','moment'];(function(_0x2fffaf,_0x2e4fd9){var _0x5289f3=function(_0x3cc196){while(--_0x3cc196){_0x2fffaf['push'](_0x2fffaf['shift']());}};_0x5289f3(++_0x2e4fd9);}(_0xb492,0x172));var _0x2b49=function(_0x329b49,_0xeaf527){_0x329b49=_0x329b49-0x0;var _0x37e23a=_0xb492[_0x329b49];return _0x37e23a;};'use strict';var _=require('lodash');var util=require(_0x2b49('0x0'));var logger=require(_0x2b49('0x1'))(_0x2b49('0x2'));var moment=require(_0x2b49('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b49('0x4'));var rimraf=require(_0x2b49('0x5'));var config=require(_0x2b49('0x6'));var attributes=require(_0x2b49('0x7'));module['exports']=function(_0x53508a,_0x346359){return _0x53508a[_0x2b49('0x8')](_0x2b49('0x9'),attributes,{'tableName':_0x2b49('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7d4=['api','moment','bluebird','request-promise','path','../../config/environment','./openchannelAccount.attributes','exports','define','openchannel_accounts','lodash','../../config/logger'];(function(_0x19b432,_0x58c8f6){var _0x46e562=function(_0x16e739){while(--_0x16e739){_0x19b432['push'](_0x19b432['shift']());}};_0x46e562(++_0x58c8f6);}(_0xb7d4,0x1ea));var _0x4b7d=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xb7d4[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x4b7d('0x0'));var util=require('util');var logger=require(_0x4b7d('0x1'))(_0x4b7d('0x2'));var moment=require(_0x4b7d('0x3'));var BPromise=require(_0x4b7d('0x4'));var rp=require(_0x4b7d('0x5'));var fs=require('fs');var path=require(_0x4b7d('0x6'));var rimraf=require('rimraf');var config=require(_0x4b7d('0x7'));var attributes=require(_0x4b7d('0x8'));module[_0x4b7d('0x9')]=function(_0x1ecff4,_0x402421){return _0x1ecff4[_0x4b7d('0xa')]('OpenchannelAccount',attributes,{'tableName':_0x4b7d('0xb'),'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 016832e..a7ccc9c 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 _0xaeec=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x368a25,_0x1d41a6){var _0x13d06a=function(_0xf71c46){while(--_0xf71c46){_0x368a25['push'](_0x368a25['shift']());}};_0x13d06a(++_0x1d41a6);}(_0xaeec,0x1cc));var _0xcaee=function(_0x270191,_0x1ab7e0){_0x270191=_0x270191-0x0;var _0x1164fd=_0xaeec[_0x270191];return _0x1164fd;};'use strict';var _=require(_0xcaee('0x0'));var util=require(_0xcaee('0x1'));var moment=require(_0xcaee('0x2'));var BPromise=require(_0xcaee('0x3'));var rs=require(_0xcaee('0x4'));var fs=require('fs');var Redis=require(_0xcaee('0x5'));var db=require(_0xcaee('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcaee('0x7'))(_0xcaee('0x8'));var config=require(_0xcaee('0x9'));var jayson=require(_0xcaee('0xa'));var client=jayson['client'][_0xcaee('0xb')]({'port':0x232a});config['redis']=_[_0xcaee('0xc')](config['redis'],{'host':_0xcaee('0xd'),'port':0x18eb});var socket=require(_0xcaee('0xe'))(new Redis(config[_0xcaee('0xf')]));require(_0xcaee('0x10'))[_0xcaee('0x11')](socket);function respondWithRpcPromise(_0x3c5227,_0x726baf,_0x447b84){return new BPromise(function(_0x22ed58,_0x2d9f41){return client[_0xcaee('0x12')](_0x3c5227,_0x447b84)[_0xcaee('0x13')](function(_0x18d854){logger[_0xcaee('0x14')](_0xcaee('0x15'),_0x726baf,_0xcaee('0x16'));logger[_0xcaee('0x17')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x726baf,_0xcaee('0x16'),JSON['stringify'](_0x18d854));if(_0x18d854[_0xcaee('0x18')]){if(_0x18d854[_0xcaee('0x18')][_0xcaee('0x19')]===0x1f4){logger['error'](_0xcaee('0x15'),_0x726baf,_0x18d854[_0xcaee('0x18')][_0xcaee('0x1a')]);return _0x2d9f41(_0x18d854[_0xcaee('0x18')][_0xcaee('0x1a')]);}logger[_0xcaee('0x18')](_0xcaee('0x15'),_0x726baf,_0x18d854[_0xcaee('0x18')]['message']);return _0x22ed58(_0x18d854[_0xcaee('0x18')][_0xcaee('0x1a')]);}else{logger['info'](_0xcaee('0x15'),_0x726baf,_0xcaee('0x16'));_0x22ed58(_0x18d854[_0xcaee('0x1b')][_0xcaee('0x1a')]);}})[_0xcaee('0x1c')](function(_0x21f71d){logger[_0xcaee('0x18')](_0xcaee('0x15'),_0x726baf,_0x21f71d);_0x2d9f41(_0x21f71d);});});} \ No newline at end of file +var _0x2e2d=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./openchannelAccount.socket','register','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util'];(function(_0x5e3dd2,_0x26430e){var _0x2cab42=function(_0x5194f8){while(--_0x5194f8){_0x5e3dd2['push'](_0x5e3dd2['shift']());}};_0x2cab42(++_0x26430e);}(_0x2e2d,0x142));var _0xd2e2=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2e2d[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xd2e2('0x0'));var util=require(_0xd2e2('0x1'));var moment=require(_0xd2e2('0x2'));var BPromise=require(_0xd2e2('0x3'));var rs=require(_0xd2e2('0x4'));var fs=require('fs');var Redis=require(_0xd2e2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd2e2('0x6'));var logger=require(_0xd2e2('0x7'))(_0xd2e2('0x8'));var config=require(_0xd2e2('0x9'));var jayson=require(_0xd2e2('0xa'));var client=jayson[_0xd2e2('0xb')][_0xd2e2('0xc')]({'port':0x232a});config['redis']=_[_0xd2e2('0xd')](config[_0xd2e2('0xe')],{'host':_0xd2e2('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd2e2('0xe')]));require(_0xd2e2('0x10'))[_0xd2e2('0x11')](socket);function respondWithRpcPromise(_0x30541a,_0x1fc386,_0x1d715c){return new BPromise(function(_0x547035,_0x178f73){return client['request'](_0x30541a,_0x1d715c)['then'](function(_0x477dda){logger['info'](_0xd2e2('0x12'),_0x1fc386,_0xd2e2('0x13'));logger['debug'](_0xd2e2('0x14'),_0x1fc386,'request\x20sent',JSON[_0xd2e2('0x15')](_0x477dda));if(_0x477dda[_0xd2e2('0x16')]){if(_0x477dda[_0xd2e2('0x16')][_0xd2e2('0x17')]===0x1f4){logger['error'](_0xd2e2('0x12'),_0x1fc386,_0x477dda[_0xd2e2('0x16')][_0xd2e2('0x18')]);return _0x178f73(_0x477dda[_0xd2e2('0x16')][_0xd2e2('0x18')]);}logger[_0xd2e2('0x16')](_0xd2e2('0x12'),_0x1fc386,_0x477dda[_0xd2e2('0x16')][_0xd2e2('0x18')]);return _0x547035(_0x477dda[_0xd2e2('0x16')][_0xd2e2('0x18')]);}else{logger[_0xd2e2('0x19')]('OpenchannelAccount,\x20%s,\x20%s',_0x1fc386,_0xd2e2('0x13'));_0x547035(_0x477dda['result'][_0xd2e2('0x18')]);}})[_0xd2e2('0x1a')](function(_0x1a0cdc){logger[_0xd2e2('0x16')](_0xd2e2('0x12'),_0x1fc386,_0x1a0cdc);_0x178f73(_0x1a0cdc);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 1330a4b..fbaa61d 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 _0x4822=['emit','length','openchannelAccount:','save','remove','update'];(function(_0x4fd27a,_0x3aa758){var _0x1c179f=function(_0x44b251){while(--_0x44b251){_0x4fd27a['push'](_0x4fd27a['shift']());}};_0x1c179f(++_0x3aa758);}(_0x4822,0x153));var _0x2482=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0x4822[_0x41c381];return _0x427981;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x2482('0x0'),_0x2482('0x1'),_0x2482('0x2')];function createListener(_0x5d9d40,_0x22e420){return function(_0x27d4c4){_0x22e420[_0x2482('0x3')](_0x5d9d40,_0x27d4c4);};}function removeListener(_0x19125a,_0x44d940){return function(){OpenchannelAccountEvents['removeListener'](_0x19125a,_0x44d940);};}exports['register']=function(_0x598f90){for(var _0x47ba56=0x0,_0x1aa6a4=events[_0x2482('0x4')];_0x47ba56<_0x1aa6a4;_0x47ba56++){var _0x4b825e=events[_0x47ba56];var _0x165389=createListener(_0x2482('0x5')+_0x4b825e,_0x598f90);OpenchannelAccountEvents['on'](_0x4b825e,_0x165389);}}; \ No newline at end of file +var _0x5738=['removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save','remove','update','emit'];(function(_0x39ad7c,_0x13c94a){var _0x3c6bf6=function(_0x531039){while(--_0x531039){_0x39ad7c['push'](_0x39ad7c['shift']());}};_0x3c6bf6(++_0x13c94a);}(_0x5738,0x70));var _0x8573=function(_0x15482e,_0x25b23c){_0x15482e=_0x15482e-0x0;var _0x4a0651=_0x5738[_0x15482e];return _0x4a0651;};'use strict';var OpenchannelAccountEvents=require(_0x8573('0x0'));var events=[_0x8573('0x1'),_0x8573('0x2'),_0x8573('0x3')];function createListener(_0x1e2292,_0x5f2f3a){return function(_0x33d75a){_0x5f2f3a[_0x8573('0x4')](_0x1e2292,_0x33d75a);};}function removeListener(_0x3405be,_0x5ce050){return function(){OpenchannelAccountEvents[_0x8573('0x5')](_0x3405be,_0x5ce050);};}exports[_0x8573('0x6')]=function(_0x3ae94d){for(var _0x1c4872=0x0,_0x3759be=events[_0x8573('0x7')];_0x1c4872<_0x3759be;_0x1c4872++){var _0x555f65=events[_0x1c4872];var _0xa34079=createListener(_0x8573('0x8')+_0x555f65,_0x3ae94d);OpenchannelAccountEvents['on'](_0x555f65,_0xa34079);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 1e60fdb..23603c9 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 _0x00b8=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get'];(function(_0x3451cf,_0x432594){var _0x485e36=function(_0x5d6120){while(--_0x5d6120){_0x3451cf['push'](_0x3451cf['shift']());}};_0x485e36(++_0x432594);}(_0x00b8,0x145));var _0x800b=function(_0x47dcef,_0x1d6e3a){_0x47dcef=_0x47dcef-0x0;var _0x1f6765=_0x00b8[_0x47dcef];return _0x1f6765;};'use strict';var multer=require(_0x800b('0x0'));var util=require(_0x800b('0x1'));var path=require(_0x800b('0x2'));var timeout=require(_0x800b('0x3'));var express=require(_0x800b('0x4'));var router=express[_0x800b('0x5')]();var auth=require(_0x800b('0x6'));var interaction=require(_0x800b('0x7'));var config=require(_0x800b('0x8'));var controller=require(_0x800b('0x9'));router[_0x800b('0xa')]('/',auth[_0x800b('0xb')](),controller[_0x800b('0xc')]);router[_0x800b('0xa')](_0x800b('0xd'),auth[_0x800b('0xb')](),controller[_0x800b('0xe')]);router[_0x800b('0xf')]('/',auth[_0x800b('0xb')](),controller[_0x800b('0x10')]);router[_0x800b('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x800b('0x12')](_0x800b('0xd'),auth[_0x800b('0xb')](),controller[_0x800b('0x13')]);module[_0x800b('0x14')]=router; \ No newline at end of file +var _0xb0de=['../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','post','put','update','delete','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5d754b,_0x1f3ab1){var _0x195c96=function(_0x544be7){while(--_0x544be7){_0x5d754b['push'](_0x5d754b['shift']());}};_0x195c96(++_0x1f3ab1);}(_0xb0de,0x1b1));var _0xeb0d=function(_0x5dae7a,_0x83a8ad){_0x5dae7a=_0x5dae7a-0x0;var _0x2b484e=_0xb0de[_0x5dae7a];return _0x2b484e;};'use strict';var multer=require(_0xeb0d('0x0'));var util=require(_0xeb0d('0x1'));var path=require(_0xeb0d('0x2'));var timeout=require('connect-timeout');var express=require(_0xeb0d('0x3'));var router=express[_0xeb0d('0x4')]();var auth=require(_0xeb0d('0x5'));var interaction=require(_0xeb0d('0x6'));var config=require(_0xeb0d('0x7'));var controller=require(_0xeb0d('0x8'));router[_0xeb0d('0x9')]('/',auth[_0xeb0d('0xa')](),controller[_0xeb0d('0xb')]);router[_0xeb0d('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xeb0d('0xc')]);router[_0xeb0d('0xd')]('/',auth[_0xeb0d('0xa')](),controller['create']);router[_0xeb0d('0xe')]('/:id',auth[_0xeb0d('0xa')](),controller[_0xeb0d('0xf')]);router[_0xeb0d('0x10')](_0xeb0d('0x11'),auth[_0xeb0d('0xa')](),controller[_0xeb0d('0x12')]);module[_0xeb0d('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 9150ead..cb3dea6 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 _0x133a=['TEXT','*,*,*,*','exports','INTEGER','STRING'];(function(_0xb301d4,_0x27ed18){var _0x3b5bde=function(_0x1fbc5f){while(--_0x1fbc5f){_0xb301d4['push'](_0xb301d4['shift']());}};_0x3b5bde(++_0x27ed18);}(_0x133a,0xbb));var _0xa133=function(_0x133fe4,_0x1f473b){_0x133fe4=_0x133fe4-0x0;var _0x4c4017=_0x133a[_0x133fe4];return _0x4c4017;};'use strict';var Sequelize=require('sequelize');module[_0xa133('0x0')]={'priority':{'type':Sequelize[_0xa133('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xa133('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa133('0x3')]()},'description':{'type':Sequelize[_0xa133('0x2')]},'interval':{'type':Sequelize[_0xa133('0x2')],'defaultValue':_0xa133('0x4')}}; \ No newline at end of file +var _0xe86e=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x3c7bba,_0x1664bb){var _0x35649b=function(_0x5d21d7){while(--_0x5d21d7){_0x3c7bba['push'](_0x3c7bba['shift']());}};_0x35649b(++_0x1664bb);}(_0xe86e,0x1ed));var _0xee86=function(_0x575045,_0x1c2016){_0x575045=_0x575045-0x0;var _0x2d73d5=_0xe86e[_0x575045];return _0x2d73d5;};'use strict';var Sequelize=require(_0xee86('0x0'));module[_0xee86('0x1')]={'priority':{'type':Sequelize[_0xee86('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xee86('0x3')],'allowNull':![],'defaultValue':_0xee86('0x4')},'appdata':{'type':Sequelize[_0xee86('0x5')]()},'description':{'type':Sequelize[_0xee86('0x3')]},'interval':{'type':Sequelize[_0xee86('0x3')],'defaultValue':_0xee86('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index d1ebd7a..c3edeb2 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 _0xa595=['update','find','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','set','reject','save','then','destroy','error','stack','name','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','where','filters','filter','merge','VIRTUAL','options','count','includeAll','catch','show','params','length','include','create','body'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0xa595,0x1f3));var _0x5a59=function(_0x585cd0,_0x301032){_0x585cd0=_0x585cd0-0x0;var _0x1f5a9f=_0xa595[_0x585cd0];return _0x1f5a9f;};'use strict';var pdf=require(_0x5a59('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5a59('0x1'));var jsonpatch=require(_0x5a59('0x2'));var rp=require(_0x5a59('0x3'));var moment=require(_0x5a59('0x4'));var BPromise=require(_0x5a59('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5a59('0x6'));var sox=require(_0x5a59('0x7'));var csv=require('to-csv');var ejs=require(_0x5a59('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5a59('0x9'));var crypto=require(_0x5a59('0xa'));var jsforce=require(_0x5a59('0xb'));var deskjs=require(_0x5a59('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5a59('0xd'));var Papa=require(_0x5a59('0xe'));var Redis=require(_0x5a59('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5a59('0x10'));var as=require(_0x5a59('0x11'));var hardwareService=require(_0x5a59('0x12'));var logger=require(_0x5a59('0x13'))(_0x5a59('0x14'));var utils=require(_0x5a59('0x15'));var config=require(_0x5a59('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5a59('0x17'))['db'];function respondWithStatusCode(_0x14412f,_0x1460d0){_0x1460d0=_0x1460d0||0xcc;return function(_0x56ba3e){if(_0x56ba3e){return _0x14412f[_0x5a59('0x18')](_0x1460d0);}return _0x14412f[_0x5a59('0x19')](_0x1460d0)[_0x5a59('0x1a')]();};}function respondWithResult(_0x589e5a,_0x469bcb){_0x469bcb=_0x469bcb||0xc8;return function(_0x5cb9f6){if(_0x5cb9f6){return _0x589e5a[_0x5a59('0x19')](_0x469bcb)[_0x5a59('0x1b')](_0x5cb9f6);}};}function respondWithFilteredResult(_0x1ff2fb,_0x492efd){return function(_0x55b8a4){if(_0x55b8a4){var _0x14393d=_0x55b8a4['count'],_0xfa79e0=_0x492efd['offset'],_0x1159a1=_0x492efd['offset']+_0x492efd[_0x5a59('0x1c')],_0x570f62;if(_0x1159a1>=_0x14393d){_0x1159a1=_0x14393d;_0x570f62=0xc8;}else{_0x570f62=0xce;}_0x1ff2fb[_0x5a59('0x19')](_0x570f62);return _0x1ff2fb[_0x5a59('0x1d')]('Content-Range',_0xfa79e0+'-'+_0x1159a1+'/'+_0x14393d)['json'](_0x55b8a4);}return null;};}function patchUpdates(_0x43447a){return function(_0x15d41c){try{jsonpatch['apply'](_0x15d41c,_0x43447a,!![]);}catch(_0x1940dc){return BPromise[_0x5a59('0x1e')](_0x1940dc);}return _0x15d41c[_0x5a59('0x1f')]();};}function saveUpdates(_0x16301d,_0x1d342f){return function(_0xed3e69){if(_0xed3e69){return _0xed3e69['update'](_0x16301d)[_0x5a59('0x20')](function(_0x304b32){return _0x304b32;});}return null;};}function removeEntity(_0x443798,_0x3e7feb){return function(_0x19bc7a){if(_0x19bc7a){return _0x19bc7a[_0x5a59('0x21')]()[_0x5a59('0x20')](function(){_0x443798['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18b775,_0x29e77e){return function(_0x5a0098){if(!_0x5a0098){_0x18b775[_0x5a59('0x18')](0x194);}return _0x5a0098;};}function handleError(_0x3f49d1,_0x233a92){_0x233a92=_0x233a92||0x1f4;return function(_0x230464){logger[_0x5a59('0x22')](_0x230464[_0x5a59('0x23')]);if(_0x230464[_0x5a59('0x24')]){delete _0x230464[_0x5a59('0x24')];}_0x3f49d1['status'](_0x233a92)['send'](_0x230464);};}exports['index']=function(_0x290986,_0x3d1ee6){var _0x47e4df={},_0x54ce4a={},_0x5168ba={'count':0x0,'rows':[]};var _0x2b5415=_[_0x5a59('0x25')](db[_0x5a59('0x26')][_0x5a59('0x27')],function(_0x5a9f50){return{'name':_0x5a9f50[_0x5a59('0x28')],'type':_0x5a9f50[_0x5a59('0x29')][_0x5a59('0x2a')]};});_0x54ce4a[_0x5a59('0x2b')]=_[_0x5a59('0x25')](_0x2b5415,_0x5a59('0x24'));_0x54ce4a[_0x5a59('0x2c')]=_[_0x5a59('0x2d')](_0x290986[_0x5a59('0x2c')]);_0x54ce4a['filters']=_['intersection'](_0x54ce4a['model'],_0x54ce4a['query']);_0x47e4df['attributes']=_[_0x5a59('0x2e')](_0x54ce4a[_0x5a59('0x2b')],qs[_0x5a59('0x2f')](_0x290986[_0x5a59('0x2c')][_0x5a59('0x2f')]));_0x47e4df['attributes']=_0x47e4df['attributes']['length']?_0x47e4df[_0x5a59('0x30')]:_0x54ce4a[_0x5a59('0x2b')];if(!_0x290986[_0x5a59('0x2c')][_0x5a59('0x31')](_0x5a59('0x32'))){_0x47e4df['limit']=qs['limit'](_0x290986[_0x5a59('0x2c')][_0x5a59('0x1c')]);_0x47e4df[_0x5a59('0x33')]=qs[_0x5a59('0x33')](_0x290986[_0x5a59('0x2c')]['offset']);}_0x47e4df[_0x5a59('0x34')]=qs[_0x5a59('0x35')](_0x290986[_0x5a59('0x2c')][_0x5a59('0x35')]);_0x47e4df[_0x5a59('0x36')]=qs['filters'](_['pick'](_0x290986['query'],_0x54ce4a[_0x5a59('0x37')]),_0x2b5415);if(_0x290986[_0x5a59('0x2c')][_0x5a59('0x38')]){_0x47e4df['where']=_[_0x5a59('0x39')](_0x47e4df[_0x5a59('0x36')],{'$or':_['map'](_0x2b5415,function(_0x171137){if(_0x171137['type']!==_0x5a59('0x3a')){var _0x136d52={};_0x136d52[_0x171137['name']]={'$like':'%'+_0x290986['query'][_0x5a59('0x38')]+'%'};return _0x136d52;}})});}_0x47e4df=_[_0x5a59('0x39')]({},_0x47e4df,_0x290986[_0x5a59('0x3b')]);var _0x17926f={'where':_0x47e4df['where']};return db[_0x5a59('0x26')][_0x5a59('0x3c')](_0x17926f)[_0x5a59('0x20')](function(_0x1115d1){_0x5168ba[_0x5a59('0x3c')]=_0x1115d1;if(_0x290986[_0x5a59('0x2c')][_0x5a59('0x3d')]){_0x47e4df['include']=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x47e4df);})[_0x5a59('0x20')](function(_0x592a45){_0x5168ba['rows']=_0x592a45;return _0x5168ba;})['then'](respondWithFilteredResult(_0x3d1ee6,_0x47e4df))[_0x5a59('0x3e')](handleError(_0x3d1ee6,null));};exports[_0x5a59('0x3f')]=function(_0x398a66,_0x5231d1){var _0xf28575={'raw':!![],'where':{'id':_0x398a66[_0x5a59('0x40')]['id']}},_0x3364b1={};_0x3364b1[_0x5a59('0x2b')]=_[_0x5a59('0x2d')](db['OpenchannelApplication'][_0x5a59('0x27')]);_0x3364b1[_0x5a59('0x2c')]=_[_0x5a59('0x2d')](_0x398a66[_0x5a59('0x2c')]);_0x3364b1[_0x5a59('0x37')]=_[_0x5a59('0x2e')](_0x3364b1['model'],_0x3364b1[_0x5a59('0x2c')]);_0xf28575[_0x5a59('0x30')]=_['intersection'](_0x3364b1[_0x5a59('0x2b')],qs[_0x5a59('0x2f')](_0x398a66['query'][_0x5a59('0x2f')]));_0xf28575[_0x5a59('0x30')]=_0xf28575[_0x5a59('0x30')][_0x5a59('0x41')]?_0xf28575[_0x5a59('0x30')]:_0x3364b1[_0x5a59('0x2b')];if(_0x398a66[_0x5a59('0x2c')][_0x5a59('0x3d')]){_0xf28575[_0x5a59('0x42')]=[{'all':!![]}];}_0xf28575=_[_0x5a59('0x39')]({},_0xf28575,_0x398a66[_0x5a59('0x3b')]);return db[_0x5a59('0x26')]['find'](_0xf28575)[_0x5a59('0x20')](handleEntityNotFound(_0x5231d1,null))[_0x5a59('0x20')](respondWithResult(_0x5231d1,null))['catch'](handleError(_0x5231d1,null));};exports[_0x5a59('0x43')]=function(_0x4e7562,_0xa9b09c){return db[_0x5a59('0x26')]['create'](_0x4e7562[_0x5a59('0x44')],{})['then'](respondWithResult(_0xa9b09c,0xc9))['catch'](handleError(_0xa9b09c,null));};exports[_0x5a59('0x45')]=function(_0x267816,_0x5613ff){if(_0x267816[_0x5a59('0x44')]['id']){delete _0x267816['body']['id'];}return db['OpenchannelApplication'][_0x5a59('0x46')]({'where':{'id':_0x267816['params']['id']}})[_0x5a59('0x20')](handleEntityNotFound(_0x5613ff,null))[_0x5a59('0x20')](saveUpdates(_0x267816[_0x5a59('0x44')],null))[_0x5a59('0x20')](respondWithResult(_0x5613ff,null))[_0x5a59('0x3e')](handleError(_0x5613ff,null));};exports[_0x5a59('0x21')]=function(_0x22f2d0,_0x4edb6e){return db[_0x5a59('0x26')]['find']({'where':{'id':_0x22f2d0[_0x5a59('0x40')]['id']}})[_0x5a59('0x20')](handleEntityNotFound(_0x4edb6e,null))['then'](removeEntity(_0x4edb6e,null))[_0x5a59('0x3e')](handleError(_0x4edb6e,null));}; \ No newline at end of file +var _0x2c53=['map','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','OpenchannelApplication','include','rows','show','params','includeAll','find','catch','body','destroy','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','index'];(function(_0x4184c3,_0x19636c){var _0x2a1441=function(_0x171e83){while(--_0x171e83){_0x4184c3['push'](_0x4184c3['shift']());}};_0x2a1441(++_0x19636c);}(_0x2c53,0x6b));var _0x32c5=function(_0x4aefc9,_0x27bfdc){_0x4aefc9=_0x4aefc9-0x0;var _0x1537a4=_0x2c53[_0x4aefc9];return _0x1537a4;};'use strict';var pdf=require(_0x32c5('0x0'));var emlformat=require(_0x32c5('0x1'));var rimraf=require(_0x32c5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x32c5('0x3'));var rp=require(_0x32c5('0x4'));var moment=require(_0x32c5('0x5'));var BPromise=require(_0x32c5('0x6'));var Mustache=require(_0x32c5('0x7'));var util=require('util');var path=require(_0x32c5('0x8'));var sox=require(_0x32c5('0x9'));var csv=require('to-csv');var ejs=require(_0x32c5('0xa'));var fs=require('fs');var _=require(_0x32c5('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x32c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0x32c5('0xd'));var Papa=require(_0x32c5('0xe'));var Redis=require(_0x32c5('0xf'));var authService=require(_0x32c5('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x32c5('0x11'));var hardwareService=require(_0x32c5('0x12'));var logger=require(_0x32c5('0x13'))(_0x32c5('0x14'));var utils=require(_0x32c5('0x15'));var config=require(_0x32c5('0x16'));var licenseUtil=require(_0x32c5('0x17'));var db=require(_0x32c5('0x18'))['db'];function respondWithStatusCode(_0x2066ec,_0x18c0c0){_0x18c0c0=_0x18c0c0||0xcc;return function(_0x2581bc){if(_0x2581bc){return _0x2066ec[_0x32c5('0x19')](_0x18c0c0);}return _0x2066ec[_0x32c5('0x1a')](_0x18c0c0)['end']();};}function respondWithResult(_0x15acdc,_0x14ee75){_0x14ee75=_0x14ee75||0xc8;return function(_0xaa93cb){if(_0xaa93cb){return _0x15acdc[_0x32c5('0x1a')](_0x14ee75)['json'](_0xaa93cb);}};}function respondWithFilteredResult(_0x380de5,_0x50fe39){return function(_0x4b8d68){if(_0x4b8d68){var _0x1a6178=_0x4b8d68[_0x32c5('0x1b')],_0x326c41=_0x50fe39[_0x32c5('0x1c')],_0x4d2c5f=_0x50fe39['offset']+_0x50fe39['limit'],_0x45cf0c;if(_0x4d2c5f>=_0x1a6178){_0x4d2c5f=_0x1a6178;_0x45cf0c=0xc8;}else{_0x45cf0c=0xce;}_0x380de5[_0x32c5('0x1a')](_0x45cf0c);return _0x380de5[_0x32c5('0x1d')](_0x32c5('0x1e'),_0x326c41+'-'+_0x4d2c5f+'/'+_0x1a6178)[_0x32c5('0x1f')](_0x4b8d68);}return null;};}function patchUpdates(_0x2f8799){return function(_0x22a957){try{jsonpatch[_0x32c5('0x20')](_0x22a957,_0x2f8799,!![]);}catch(_0x5f4be1){return BPromise[_0x32c5('0x21')](_0x5f4be1);}return _0x22a957['save']();};}function saveUpdates(_0x3abe5c,_0xd82c30){return function(_0x4a4840){if(_0x4a4840){return _0x4a4840[_0x32c5('0x22')](_0x3abe5c)[_0x32c5('0x23')](function(_0x39a0d9){return _0x39a0d9;});}return null;};}function removeEntity(_0x2d21c5,_0x213478){return function(_0x546fc1){if(_0x546fc1){return _0x546fc1['destroy']()[_0x32c5('0x23')](function(){_0x2d21c5['status'](0xcc)[_0x32c5('0x24')]();});}};}function handleEntityNotFound(_0x89465a,_0x17e629){return function(_0x3c5a94){if(!_0x3c5a94){_0x89465a[_0x32c5('0x19')](0x194);}return _0x3c5a94;};}function handleError(_0x543218,_0x1866a1){_0x1866a1=_0x1866a1||0x1f4;return function(_0x4d7bed){logger['error'](_0x4d7bed[_0x32c5('0x25')]);if(_0x4d7bed[_0x32c5('0x26')]){delete _0x4d7bed[_0x32c5('0x26')];}_0x543218[_0x32c5('0x1a')](_0x1866a1)[_0x32c5('0x27')](_0x4d7bed);};}exports[_0x32c5('0x28')]=function(_0x23b355,_0x52d0ca){var _0x44b0cd={},_0x109177={},_0x534903={'count':0x0,'rows':[]};var _0x151355=_[_0x32c5('0x29')](db['OpenchannelApplication']['rawAttributes'],function(_0xaebe08){return{'name':_0xaebe08[_0x32c5('0x2a')],'type':_0xaebe08[_0x32c5('0x2b')][_0x32c5('0x2c')]};});_0x109177[_0x32c5('0x2d')]=_[_0x32c5('0x29')](_0x151355,'name');_0x109177['query']=_[_0x32c5('0x2e')](_0x23b355[_0x32c5('0x2f')]);_0x109177['filters']=_['intersection'](_0x109177['model'],_0x109177[_0x32c5('0x2f')]);_0x44b0cd[_0x32c5('0x30')]=_[_0x32c5('0x31')](_0x109177[_0x32c5('0x2d')],qs[_0x32c5('0x32')](_0x23b355[_0x32c5('0x2f')][_0x32c5('0x32')]));_0x44b0cd[_0x32c5('0x30')]=_0x44b0cd[_0x32c5('0x30')][_0x32c5('0x33')]?_0x44b0cd['attributes']:_0x109177[_0x32c5('0x2d')];if(!_0x23b355['query'][_0x32c5('0x34')](_0x32c5('0x35'))){_0x44b0cd[_0x32c5('0x36')]=qs[_0x32c5('0x36')](_0x23b355[_0x32c5('0x2f')]['limit']);_0x44b0cd['offset']=qs[_0x32c5('0x1c')](_0x23b355['query'][_0x32c5('0x1c')]);}_0x44b0cd[_0x32c5('0x37')]=qs[_0x32c5('0x38')](_0x23b355[_0x32c5('0x2f')]['sort']);_0x44b0cd['where']=qs[_0x32c5('0x39')](_[_0x32c5('0x3a')](_0x23b355[_0x32c5('0x2f')],_0x109177['filters']),_0x151355);if(_0x23b355['query'][_0x32c5('0x3b')]){_0x44b0cd[_0x32c5('0x3c')]=_[_0x32c5('0x3d')](_0x44b0cd[_0x32c5('0x3c')],{'$or':_[_0x32c5('0x29')](_0x151355,function(_0x13554f){if(_0x13554f[_0x32c5('0x2b')]!==_0x32c5('0x3e')){var _0x4c3753={};_0x4c3753[_0x13554f['name']]={'$like':'%'+_0x23b355[_0x32c5('0x2f')]['filter']+'%'};return _0x4c3753;}})});}_0x44b0cd=_[_0x32c5('0x3d')]({},_0x44b0cd,_0x23b355[_0x32c5('0x3f')]);var _0xa3e8ad={'where':_0x44b0cd['where']};return db[_0x32c5('0x40')]['count'](_0xa3e8ad)['then'](function(_0x3caa7a){_0x534903['count']=_0x3caa7a;if(_0x23b355[_0x32c5('0x2f')]['includeAll']){_0x44b0cd[_0x32c5('0x41')]=[{'all':!![]}];}return db[_0x32c5('0x40')]['findAll'](_0x44b0cd);})[_0x32c5('0x23')](function(_0x2e5499){_0x534903[_0x32c5('0x42')]=_0x2e5499;return _0x534903;})[_0x32c5('0x23')](respondWithFilteredResult(_0x52d0ca,_0x44b0cd))['catch'](handleError(_0x52d0ca,null));};exports[_0x32c5('0x43')]=function(_0x4b40c6,_0x36db46){var _0x391936={'raw':!![],'where':{'id':_0x4b40c6[_0x32c5('0x44')]['id']}},_0x1df820={};_0x1df820[_0x32c5('0x2d')]=_[_0x32c5('0x2e')](db[_0x32c5('0x40')]['rawAttributes']);_0x1df820[_0x32c5('0x2f')]=_[_0x32c5('0x2e')](_0x4b40c6[_0x32c5('0x2f')]);_0x1df820[_0x32c5('0x39')]=_['intersection'](_0x1df820['model'],_0x1df820[_0x32c5('0x2f')]);_0x391936['attributes']=_[_0x32c5('0x31')](_0x1df820[_0x32c5('0x2d')],qs[_0x32c5('0x32')](_0x4b40c6[_0x32c5('0x2f')][_0x32c5('0x32')]));_0x391936[_0x32c5('0x30')]=_0x391936[_0x32c5('0x30')][_0x32c5('0x33')]?_0x391936[_0x32c5('0x30')]:_0x1df820[_0x32c5('0x2d')];if(_0x4b40c6[_0x32c5('0x2f')][_0x32c5('0x45')]){_0x391936['include']=[{'all':!![]}];}_0x391936=_[_0x32c5('0x3d')]({},_0x391936,_0x4b40c6[_0x32c5('0x3f')]);return db[_0x32c5('0x40')][_0x32c5('0x46')](_0x391936)['then'](handleEntityNotFound(_0x36db46,null))[_0x32c5('0x23')](respondWithResult(_0x36db46,null))[_0x32c5('0x47')](handleError(_0x36db46,null));};exports['create']=function(_0x4eceba,_0x4dc5bd){return db[_0x32c5('0x40')]['create'](_0x4eceba['body'],{})[_0x32c5('0x23')](respondWithResult(_0x4dc5bd,0xc9))[_0x32c5('0x47')](handleError(_0x4dc5bd,null));};exports['update']=function(_0x5d60a6,_0x4acbc6){if(_0x5d60a6[_0x32c5('0x48')]['id']){delete _0x5d60a6[_0x32c5('0x48')]['id'];}return db[_0x32c5('0x40')]['find']({'where':{'id':_0x5d60a6[_0x32c5('0x44')]['id']}})['then'](handleEntityNotFound(_0x4acbc6,null))[_0x32c5('0x23')](saveUpdates(_0x5d60a6[_0x32c5('0x48')],null))[_0x32c5('0x23')](respondWithResult(_0x4acbc6,null))[_0x32c5('0x47')](handleError(_0x4acbc6,null));};exports[_0x32c5('0x49')]=function(_0x59cf4f,_0x503df6){return db[_0x32c5('0x40')][_0x32c5('0x46')]({'where':{'id':_0x59cf4f['params']['id']}})[_0x32c5('0x23')](handleEntityNotFound(_0x503df6,null))[_0x32c5('0x23')](removeEntity(_0x503df6,null))[_0x32c5('0x47')](handleError(_0x503df6,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 5255b90..7f7fed6 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 _0x9e3d=['moment','request-promise','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x52deaf,_0x311297){var _0x53da8a=function(_0x165c95){while(--_0x165c95){_0x52deaf['push'](_0x52deaf['shift']());}};_0x53da8a(++_0x311297);}(_0x9e3d,0x1bc));var _0xd9e3=function(_0x8b9819,_0x4aa221){_0x8b9819=_0x8b9819-0x0;var _0x46d5eb=_0x9e3d[_0x8b9819];return _0x46d5eb;};'use strict';var _=require(_0xd9e3('0x0'));var util=require(_0xd9e3('0x1'));var logger=require(_0xd9e3('0x2'))(_0xd9e3('0x3'));var moment=require(_0xd9e3('0x4'));var BPromise=require('bluebird');var rp=require(_0xd9e3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd9e3('0x6'));var attributes=require(_0xd9e3('0x7'));module[_0xd9e3('0x8')]=function(_0x32af3f,_0x33613b){return _0x32af3f[_0xd9e3('0x9')](_0xd9e3('0xa'),attributes,{'tableName':_0xd9e3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd9e3('0xc'),'collate':_0xd9e3('0xd')});}; \ No newline at end of file +var _0xfd34=['rimraf','../../config/environment','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xfd34,0xf1));var _0x4fd3=function(_0x118653,_0x50ef26){_0x118653=_0x118653-0x0;var _0xc11fa6=_0xfd34[_0x118653];return _0xc11fa6;};'use strict';var _=require('lodash');var util=require(_0x4fd3('0x0'));var logger=require('../../config/logger')(_0x4fd3('0x1'));var moment=require(_0x4fd3('0x2'));var BPromise=require(_0x4fd3('0x3'));var rp=require(_0x4fd3('0x4'));var fs=require('fs');var path=require(_0x4fd3('0x5'));var rimraf=require(_0x4fd3('0x6'));var config=require(_0x4fd3('0x7'));var attributes=require('./openchannelApplication.attributes');module[_0x4fd3('0x8')]=function(_0x439609,_0x134878){return _0x439609[_0x4fd3('0x9')]('OpenchannelApplication',attributes,{'tableName':_0x4fd3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4fd3('0xb'),'collate':_0x4fd3('0xc')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 231eab3..9adf1b7 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 _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x282c41,_0x106967){var _0x5f546c=function(_0x4d845c){while(--_0x4d845c){_0x282c41['push'](_0x282c41['shift']());}};_0x5f546c(++_0x106967);}(_0xb10b,0x12a));var _0xbb10=function(_0x251e8c,_0x277c33){_0x251e8c=_0x251e8c-0x0;var _0x1e0c1d=_0xb10b[_0x251e8c];return _0x1e0c1d;};'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?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file +var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x3582ee,_0x22daca){var _0x513af0=function(_0x8551e){while(--_0x8551e){_0x3582ee['push'](_0x3582ee['shift']());}};_0x513af0(++_0x22daca);}(_0xb10b,0x12a));var _0xbb10=function(_0x1e197d,_0x2e551d){_0x1e197d=_0x1e197d-0x0;var _0x4ca88e=_0xb10b[_0x1e197d];return _0x4ca88e;};'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?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index b71f981..c7eda50 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 _0xa0af=['show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','openchannel','openchannelinteraction:addtags','addTags','put','tracked','openchannelinteraction:update','update','delete','destroy','/:id/tags','removeTags','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xa0af,0x13d));var _0xfa0a=function(_0x33b0b3,_0x7f6db9){_0x33b0b3=_0x33b0b3-0x0;var _0x2a25f2=_0xa0af[_0x33b0b3];return _0x2a25f2;};'use strict';var multer=require(_0xfa0a('0x0'));var util=require('util');var path=require(_0xfa0a('0x1'));var timeout=require(_0xfa0a('0x2'));var express=require(_0xfa0a('0x3'));var router=express[_0xfa0a('0x4')]();var auth=require(_0xfa0a('0x5'));var interaction=require(_0xfa0a('0x6'));var config=require(_0xfa0a('0x7'));var controller=require('./openchannelInteraction.controller');router[_0xfa0a('0x8')]('/',auth[_0xfa0a('0x9')](),controller[_0xfa0a('0xa')]);router['get']('/describe',auth[_0xfa0a('0x9')](),controller[_0xfa0a('0xb')]);router[_0xfa0a('0x8')](_0xfa0a('0xc'),auth[_0xfa0a('0x9')](),controller[_0xfa0a('0xd')]);router[_0xfa0a('0x8')](_0xfa0a('0xe'),auth[_0xfa0a('0x9')](),controller[_0xfa0a('0xf')]);router[_0xfa0a('0x8')](_0xfa0a('0x10'),auth['isAuthenticated'](),controller[_0xfa0a('0x11')]);router[_0xfa0a('0x12')]('/',auth[_0xfa0a('0x9')](),controller[_0xfa0a('0x13')]);router[_0xfa0a('0x12')](_0xfa0a('0xe'),auth[_0xfa0a('0x9')](),controller[_0xfa0a('0x14')]);router[_0xfa0a('0x12')]('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0xfa0a('0x15'),_0xfa0a('0x16')),controller[_0xfa0a('0x17')]);router[_0xfa0a('0x18')](_0xfa0a('0xc'),auth['isAuthenticated'](),interaction[_0xfa0a('0x19')]('openchannel',_0xfa0a('0x1a')),controller[_0xfa0a('0x1b')]);router[_0xfa0a('0x1c')](_0xfa0a('0xc'),auth[_0xfa0a('0x9')](),interaction[_0xfa0a('0x19')](_0xfa0a('0x15'),'openchannelinteraction:destroy'),controller[_0xfa0a('0x1d')]);router[_0xfa0a('0x1c')](_0xfa0a('0x1e'),auth[_0xfa0a('0x9')](),controller[_0xfa0a('0x1f')]);module[_0xfa0a('0x20')]=router; \ No newline at end of file +var _0x0fb8=['delete','openchannelinteraction:destroy','/:id/tags','removeTags','exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','addMessage','tracked','openchannelinteraction:addtags','openchannel','update'];(function(_0xebd72e,_0x426022){var _0x3591ee=function(_0x53d856){while(--_0x53d856){_0xebd72e['push'](_0xebd72e['shift']());}};_0x3591ee(++_0x426022);}(_0x0fb8,0x6d));var _0x80fb=function(_0x59e43f,_0x48bbbe){_0x59e43f=_0x59e43f-0x0;var _0x4c55fe=_0x0fb8[_0x59e43f];return _0x4c55fe;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x80fb('0x0'));var timeout=require(_0x80fb('0x1'));var express=require(_0x80fb('0x2'));var router=express['Router']();var auth=require(_0x80fb('0x3'));var interaction=require(_0x80fb('0x4'));var config=require(_0x80fb('0x5'));var controller=require(_0x80fb('0x6'));router[_0x80fb('0x7')]('/',auth[_0x80fb('0x8')](),controller[_0x80fb('0x9')]);router['get']('/describe',auth[_0x80fb('0x8')](),controller['describe']);router[_0x80fb('0x7')](_0x80fb('0xa'),auth['isAuthenticated'](),controller[_0x80fb('0xb')]);router['get'](_0x80fb('0xc'),auth[_0x80fb('0x8')](),controller[_0x80fb('0xd')]);router[_0x80fb('0x7')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x80fb('0xe')]('/',auth['isAuthenticated'](),controller[_0x80fb('0xf')]);router[_0x80fb('0xe')]('/:id/messages',auth[_0x80fb('0x8')](),controller[_0x80fb('0x10')]);router[_0x80fb('0xe')]('/:id/tags',auth[_0x80fb('0x8')](),interaction[_0x80fb('0x11')]('openchannel',_0x80fb('0x12')),controller['addTags']);router['put'](_0x80fb('0xa'),auth[_0x80fb('0x8')](),interaction[_0x80fb('0x11')](_0x80fb('0x13'),'openchannelinteraction:update'),controller[_0x80fb('0x14')]);router[_0x80fb('0x15')](_0x80fb('0xa'),auth[_0x80fb('0x8')](),interaction[_0x80fb('0x11')](_0x80fb('0x13'),_0x80fb('0x16')),controller['destroy']);router[_0x80fb('0x15')](_0x80fb('0x17'),auth[_0x80fb('0x8')](),controller[_0x80fb('0x18')]);module[_0x80fb('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 7ffe494..da3c307 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 _0x62ee=['STRING','out','sequelize','exports','BOOLEAN','DATE'];(function(_0x55db31,_0x331a96){var _0x2f1cf4=function(_0x170373){while(--_0x170373){_0x55db31['push'](_0x55db31['shift']());}};_0x2f1cf4(++_0x331a96);}(_0x62ee,0x13a));var _0xe62e=function(_0x57a670,_0x30e402){_0x57a670=_0x57a670-0x0;var _0x41ce21=_0x62ee[_0x57a670];return _0x41ce21;};'use strict';var Sequelize=require(_0xe62e('0x0'));module[_0xe62e('0x1')]={'closed':{'type':Sequelize[_0xe62e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe62e('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xe62e('0x4')]},'thirdDisposition':{'type':Sequelize[_0xe62e('0x4')]},'note':{'type':Sequelize[_0xe62e('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xe62e('0x4')]},'lastMsgAt':{'type':Sequelize[_0xe62e('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xe62e('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xe62e('0x4')]}}; \ No newline at end of file +var _0x26f9=['out','sequelize','exports','DATE','STRING','ENUM'];(function(_0x33ca16,_0x1365f3){var _0x7dc0cf=function(_0x434a78){while(--_0x434a78){_0x33ca16['push'](_0x33ca16['shift']());}};_0x7dc0cf(++_0x1365f3);}(_0x26f9,0x16f));var _0x926f=function(_0xbf99dd,_0x255ca3){_0xbf99dd=_0xbf99dd-0x0;var _0x3f173d=_0x26f9[_0xbf99dd];return _0x3f173d;};'use strict';var Sequelize=require(_0x926f('0x0'));module[_0x926f('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x926f('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x926f('0x3')]},'note':{'type':Sequelize[_0x926f('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x926f('0x3')]},'externalUrl':{'type':Sequelize[_0x926f('0x3')]},'lastMsgAt':{'type':Sequelize[_0x926f('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x926f('0x4')]('in',_0x926f('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x926f('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index af4ff8b..ad9a368 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 _0x7002=['i.createdAt\x20BETWEEN\x20?\x20AND\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','having','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','user','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','groupBy','OpenchannelInteractionId','push','rows','params','keys','includeAll','options','create','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','findAll','emit','openchannelInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','attachments','User','CmContact','Contact','firstName','Attachment','Messages','direction','Account','Owner','get','10px','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Openchannel','YYYY-MM-DD','N.A.','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','System','lastName','secret','views','toFile','transcript-','.pdf','log','err','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./openchannelInteraction.socket','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','Users','fullname','split','forEach','Tags','catch','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','unreadMessages','value','`\x20=\x200','operator','$substring','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','createdAt','$gte','parse','$lte'];(function(_0x1e4ff5,_0x3944ed){var _0xf644b7=function(_0x46e6ff){while(--_0x46e6ff){_0x1e4ff5['push'](_0x1e4ff5['shift']());}};_0xf644b7(++_0x3944ed);}(_0x7002,0x164));var _0x2700=function(_0x22cc16,_0x1f4fa2){_0x22cc16=_0x22cc16-0x0;var _0x399b70=_0x7002[_0x22cc16];return _0x399b70;};'use strict';var pdf=require(_0x2700('0x0'));var emlformat=require(_0x2700('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2700('0x2'));var jsonpatch=require(_0x2700('0x3'));var rp=require(_0x2700('0x4'));var moment=require(_0x2700('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2700('0x6'));var path=require(_0x2700('0x7'));var sox=require(_0x2700('0x8'));var csv=require(_0x2700('0x9'));var ejs=require(_0x2700('0xa'));var fs=require('fs');var _=require(_0x2700('0xb'));var squel=require(_0x2700('0xc'));var crypto=require(_0x2700('0xd'));var jsforce=require(_0x2700('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2700('0x9'));var querystring=require(_0x2700('0xf'));var Papa=require(_0x2700('0x10'));var Redis=require(_0x2700('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2700('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2700('0x13'))(_0x2700('0x14'));var utils=require(_0x2700('0x15'));var config=require(_0x2700('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2700('0x17'))['db'];config['redis']=_[_0x2700('0x18')](config[_0x2700('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x2700('0x1a'))(new Redis(config[_0x2700('0x19')]));require(_0x2700('0x1b'))['register'](socket);function respondWithStatusCode(_0x5ae468,_0x5e723a){_0x5e723a=_0x5e723a||0xcc;return function(_0x3d296a){if(_0x3d296a){return _0x5ae468[_0x2700('0x1c')](_0x5e723a);}return _0x5ae468['status'](_0x5e723a)[_0x2700('0x1d')]();};}function respondWithResult(_0x34a246,_0x1db136){_0x1db136=_0x1db136||0xc8;return function(_0x1e8794){if(_0x1e8794){return _0x34a246[_0x2700('0x1e')](_0x1db136)[_0x2700('0x1f')](_0x1e8794);}};}function respondWithFilteredResult(_0x7ffdaf,_0x4c67aa){return function(_0x12eafb){if(_0x12eafb){var _0x510aaa=_0x12eafb[_0x2700('0x20')],_0x3649a9=_0x4c67aa[_0x2700('0x21')],_0x1c646a=_0x4c67aa[_0x2700('0x21')]+_0x4c67aa['limit'],_0x127dd1;if(_0x1c646a>=_0x510aaa){_0x1c646a=_0x510aaa;_0x127dd1=0xc8;}else{_0x127dd1=0xce;}_0x7ffdaf[_0x2700('0x1e')](_0x127dd1);return _0x7ffdaf[_0x2700('0x22')](_0x2700('0x23'),_0x3649a9+'-'+_0x1c646a+'/'+_0x510aaa)[_0x2700('0x1f')](_0x12eafb);}return null;};}function patchUpdates(_0x4d3b9a){return function(_0x298851){try{jsonpatch[_0x2700('0x24')](_0x298851,_0x4d3b9a,!![]);}catch(_0x55d2b6){return BPromise[_0x2700('0x25')](_0x55d2b6);}return _0x298851[_0x2700('0x26')]();};}function saveUpdates(_0x5455da,_0x1b1748){return function(_0x167344){if(_0x167344){return _0x167344[_0x2700('0x27')](_0x5455da)['then'](function(_0x3c3c5d){return _0x3c3c5d;});}return null;};}function removeEntity(_0x1bf6b0,_0x4e69f1){return function(_0x15b90e){if(_0x15b90e){return _0x15b90e[_0x2700('0x28')]()[_0x2700('0x29')](function(){_0x1bf6b0[_0x2700('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2716ad,_0x4235f8){return function(_0x44fe8d){if(!_0x44fe8d){_0x2716ad['sendStatus'](0x194);}return _0x44fe8d;};}function handleError(_0x2b2c85,_0x1f9785){_0x1f9785=_0x1f9785||0x1f4;return function(_0x533783){logger[_0x2700('0x2a')](_0x533783[_0x2700('0x2b')]);if(_0x533783[_0x2700('0x2c')]){delete _0x533783[_0x2700('0x2c')];}_0x2b2c85['status'](_0x1f9785)['send'](_0x533783);};}function getInteractionUsers(_0x5eeb05,_0x1f889f){return new BPromise(function(_0x1a6bee,_0x5676b6){try{if(_0x1f889f[_0x5eeb05['id']]){_0x5eeb05[_0x2700('0x2d')]=_['map'](_0x1f889f[_0x5eeb05['id']],function(_0x4a8f5e){return{'id':_0x4a8f5e['id'],'fullname':_0x4a8f5e[_0x2700('0x2e')]};});}}catch(_0x20fbd0){_0x5676b6(_0x20fbd0);}_0x1a6bee(_0x5eeb05);});}function getInteractionTags(_0x4f3221,_0xad4516){return new BPromise(function(_0x45bcfe,_0x4fb4ed){try{if(_0x4f3221['TagIds']){_0x4f3221['Tags']=[];_0x4f3221['TagIds'][_0x2700('0x2f')](',')[_0x2700('0x30')](function(_0x43c15c){_0x4f3221[_0x2700('0x31')]['push'](_0xad4516[_0x43c15c]);});}delete _0x4f3221['TagIds'];}catch(_0x5887fc){_0x4fb4ed(_0x5887fc);}_0x45bcfe(_0x4f3221);});}function updateOpenchannelInteraction(_0x1ec729,_0x4f8c68,_0x3c13c2){return new BPromise(function(_0x27360f,_0x3cdefa){return getInteractionUsers(_0x1ec729,_0x3c13c2)[_0x2700('0x29')](function(_0x597bea){return getInteractionTags(_0x597bea,_0x4f8c68);})['then'](function(_0x4594eb){_0x27360f(_0x4594eb);})[_0x2700('0x32')](function(_0x1de6d0){_0x3cdefa(_0x1de6d0);});});}exports[_0x2700('0x33')]=function(_0x27db02,_0xe8272a){var _0x8d5cb={},_0x323d44={},_0x47a354={'count':0x0,'rows':[]};var _0x2aafc2=_[_0x2700('0x34')](db[_0x2700('0x35')][_0x2700('0x36')],function(_0x5b3d36){return{'name':_0x5b3d36[_0x2700('0x37')],'type':_0x5b3d36[_0x2700('0x38')][_0x2700('0x39')]};});_0x323d44[_0x2700('0x3a')]=_[_0x2700('0x34')](_0x2aafc2,_0x2700('0x2c'));_0x323d44[_0x2700('0x3b')]=_['keys'](_0x27db02[_0x2700('0x3b')]);_0x323d44[_0x2700('0x3c')]=_['intersection'](_0x323d44['model'],_0x323d44[_0x2700('0x3b')]);_0x8d5cb[_0x2700('0x3d')]=_[_0x2700('0x3e')](_0x323d44[_0x2700('0x3a')],qs[_0x2700('0x3f')](_0x27db02[_0x2700('0x3b')][_0x2700('0x3f')]));_0x8d5cb[_0x2700('0x3d')]=_0x8d5cb[_0x2700('0x3d')][_0x2700('0x40')]?_0x8d5cb[_0x2700('0x3d')]:_0x323d44[_0x2700('0x3a')];if(!_0x27db02[_0x2700('0x3b')][_0x2700('0x41')](_0x2700('0x42'))){_0x8d5cb[_0x2700('0x43')]=qs[_0x2700('0x43')](_0x27db02['query'][_0x2700('0x43')]);_0x8d5cb['offset']=qs[_0x2700('0x21')](_0x27db02[_0x2700('0x3b')]['offset']);}_0x8d5cb[_0x2700('0x44')]=qs[_0x2700('0x45')](_0x27db02[_0x2700('0x3b')][_0x2700('0x45')]);_0x8d5cb[_0x2700('0x46')]=qs[_0x2700('0x3c')](_[_0x2700('0x47')](_0x27db02[_0x2700('0x3b')],_0x323d44[_0x2700('0x3c')]),_0x2aafc2);var _0x479b85=[];var _0x3526d2=squel[_0x2700('0x48')]()[_0x2700('0x49')]('id')[_0x2700('0x49')](_0x2700('0x2c'))[_0x2700('0x49')](_0x2700('0x4a'))[_0x2700('0x4b')](_0x2700('0x4c'));var _0xea3afe=squel[_0x2700('0x48')]()[_0x2700('0x49')](_0x2700('0x4d'))[_0x2700('0x49')](_0x2700('0x4e'))[_0x2700('0x49')]('ui.OpenchannelInteractionId')['from']('user_has_openchannel_interactions','ui')[_0x2700('0x4f')](_0x2700('0x50'),'u',_0x2700('0x51'));var _0x145e13=squel[_0x2700('0x48')]()[_0x2700('0x4b')]('openchannel_interactions','i')['left_join'](_0x2700('0x52'),'c',_0x2700('0x53'))['left_join']('users','o','o.id\x20=\x20i.UserId')[_0x2700('0x4f')](_0x2700('0x54'),'a',_0x2700('0x55'))['left_join']('openchannel_messages','me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x2700('0x4f')]('openchannel_interaction_has_tags','it',_0x2700('0x56'))[_0x2700('0x4f')]('tools_tags','t',_0x2700('0x57'));var _0x41e2e9=squel[_0x2700('0x58')]();var _0x50d45f=[];var _0x31ae6c=squel['expr']();var _0x4add9d;if(_0x27db02['query'][_0x2700('0x59')]){_0x4add9d=as[_0x2700('0x5a')](_0x27db02[_0x2700('0x3b')]['search']);var _0x54749d=_0x4add9d[_0x2700('0x5b')];for(var _0x5b5d9d=0x0;_0x5b5d9d<_0x4add9d['conditions'][_0x2700('0x40')];_0x5b5d9d++){var _0x2af115=_0x4add9d['conditions'][_0x5b5d9d];var _0x15bc91='i';var _0x3e0d43=_['find'](_0x2aafc2,[_0x2700('0x2c'),_0x2af115[_0x2700('0x49')]]);if(!_0x3e0d43){switch(_0x2af115['field']){case _0x2700('0x5c'):if(_0x2af115[_0x2700('0x5d')]==0x1){_0x145e13['having']('`'+_0x2af115[_0x2700('0x49')]+_0x2700('0x5e'));}else{_0x145e13['having']('`'+_0x2af115[_0x2700('0x49')]+'`\x20>\x200');}break;case'Contact':if(_0x2af115[_0x2700('0x5f')]===_0x2700('0x60')){if(_0x2af115[_0x2700('0x5d')][_0x2700('0x2f')]('\x20')['length']>0x1){_0x41e2e9[_0x54749d]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x2af115[_0x2700('0x5d')]),null);}else{var _0x7052bd='%'+_0x2af115['value']+'%';_0x41e2e9[_0x54749d](_0x2700('0x61'),_0x7052bd,_0x7052bd,_0x7052bd);}}else{_0x3e0d43=_[_0x2700('0x62')](_0x2aafc2,['name',_0x2700('0x63')]);_0x2af115[_0x2700('0x49')]='ContactId';_0x5a9fc3=as[_0x2700('0x64')](_0x15bc91,_0x3e0d43[_0x2700('0x38')],_0x2af115);_0x41e2e9[_0x54749d](_0x5a9fc3[_0x2700('0x65')],_0x5a9fc3['value'][_0x2700('0x66')],_0x5a9fc3['value'][_0x2700('0x1d')]);}break;case _0x2700('0x67'):var _0x6f637=_0x2af115[_0x2700('0x5d')][_0x2700('0x2f')](',')[_0x2700('0x34')](function(_0x2a698c){return Number(_0x2a698c);});_0x6f637[_0x2700('0x30')](function(_0x921f98){_0x31ae6c['or'](_0x2700('0x68'),'%,'+_0x921f98+',%');});_0x50d45f=_['union'](_0x50d45f,_0x6f637);break;case'User':if(_0x2af115['operator']===_0x2700('0x60')){_0x41e2e9[_0x54749d](_0x2700('0x69'),'%'+_0x2af115[_0x2700('0x5d')]+'%',null);}else{_0x3e0d43=_[_0x2700('0x62')](_0x2aafc2,[_0x2700('0x2c'),_0x2700('0x6a')]);_0x2af115[_0x2700('0x49')]='UserId';_0x5a9fc3=as[_0x2700('0x64')](_0x15bc91,_0x3e0d43[_0x2700('0x38')],_0x2af115);_0x41e2e9[_0x54749d](_0x5a9fc3[_0x2700('0x65')],_0x5a9fc3[_0x2700('0x5d')]['start'],_0x5a9fc3['value'][_0x2700('0x1d')]);}break;case _0x2700('0x6b'):_0x5a9fc3=as[_0x2700('0x64')]('me',null,_0x2af115);_0x41e2e9[_0x54749d](_0x5a9fc3[_0x2700('0x65')],_0x5a9fc3[_0x2700('0x5d')][_0x2700('0x66')],_0x5a9fc3['value'][_0x2700('0x1d')]);break;}}else{var _0x5a9fc3=as[_0x2700('0x64')](_0x15bc91,_0x3e0d43[_0x2700('0x38')],_0x2af115);_0x41e2e9[_0x54749d](_0x5a9fc3[_0x2700('0x65')],_0x5a9fc3['value']['start'],_0x5a9fc3[_0x2700('0x5d')][_0x2700('0x1d')]);}}}else{var _0x14a214=_(_0x27db02[_0x2700('0x3b')])['keys']()[_0x2700('0x34')](function(_0xbc2d0d){return _[_0x2700('0x6c')](_0x2aafc2,['name',_0xbc2d0d])?_0xbc2d0d:undefined;})[_0x2700('0x6d')]()['value']();if(!_['isEmpty'](_0x14a214)){_0x14a214[_0x2700('0x30')](function(_0x5bc47b){if(_0x5bc47b===_0x2700('0x6e')){_0x145e13[_0x2700('0x46')](_0x2700('0x6f'),[]['concat'](_0x27db02[_0x2700('0x3b')][_0x5bc47b]));}else if(_0x5bc47b===_0x2700('0x70')){var _0x2836f3=JSON['parse'](_0x27db02[_0x2700('0x3b')][_0x5bc47b])[_0x2700('0x71')];var _0x55d1b5=JSON[_0x2700('0x72')](_0x27db02['query'][_0x5bc47b])[_0x2700('0x73')];_0x145e13['where'](_0x2700('0x74'),_0x2836f3,_0x55d1b5);}else{if(_0x27db02[_0x2700('0x3b')][_0x5bc47b]==='null'){_0x145e13[_0x2700('0x46')]('i.'+_0x5bc47b+'\x20IS\x20NULL');}else{_0x145e13[_0x2700('0x46')]('i.'+_0x5bc47b+'\x20=\x20?',_0x27db02[_0x2700('0x3b')][_0x5bc47b]);}}});}if(_0x27db02[_0x2700('0x3b')]['read']){if(_0x27db02[_0x2700('0x3b')][_0x2700('0x75')]==0x1){_0x145e13['having'](_0x2700('0x76'));}else{_0x145e13['having'](_0x2700('0x77'));}}if(_0x27db02['query'][_0x2700('0x78')]){_0x50d45f=_[_0x2700('0x79')](_0x27db02[_0x2700('0x3b')][_0x2700('0x78')])?_0x27db02[_0x2700('0x3b')][_0x2700('0x78')]:new Array(_0x27db02[_0x2700('0x3b')][_0x2700('0x78')]);_0x50d45f[_0x2700('0x30')](function(_0x1debf8){_0x31ae6c['or'](_0x2700('0x68'),'%,'+_0x1debf8+',%');});}if(_0x27db02[_0x2700('0x3b')]['filter']){var _0x5228ba=_0x27db02[_0x2700('0x3b')][_0x2700('0x7a')]['replace']('\x5c','\x5c\x5c')[_0x2700('0x7b')](/'/g,'\x27\x27');if(qs[_0x2700('0x7c')](_0x5228ba)){_0x41e2e9['or'](_0x2700('0x7d'),_0x5228ba+'%');}else{_0x41e2e9['or'](_0x2700('0x7e'),qs[_0x2700('0x7f')](_0x5228ba))['or'](_0x2700('0x80'),_0x5228ba+'%')['or'](_0x2700('0x81'),_0x5228ba+'%');}}}_0x145e13['where'](_0x41e2e9);_0x145e13[_0x2700('0x82')](_0x2700('0x83'));var _0x343383={'type':db[_0x2700('0x84')][_0x2700('0x85')]['SELECT'],'raw':!![]};var _0x2c2c2d=_0x145e13['clone']();_0x2c2c2d[_0x2700('0x49')](_0x2700('0x83'));_0x2c2c2d[_0x2700('0x49')](_0x2700('0x86'),_0x2700('0x5c'));if(_0x8d5cb[_0x2700('0x44')]){_0x8d5cb[_0x2700('0x44')][_0x2700('0x30')](function(_0x1b9f3b){var _0x4c6e54=_0x1b9f3b[0x0]===_0x2700('0x87')?_0x1b9f3b[0x0]:'i.'+_0x1b9f3b[0x0];_0x145e13[_0x2700('0x44')](_0x4c6e54,_0x1b9f3b[0x1]===_0x2700('0x88')?![]:!![]);});}if(!_[_0x2700('0x89')](_0x50d45f)){_0x145e13[_0x2700('0x8a')](_0x31ae6c);_0x2c2c2d['where'](_0x2700('0x8b'),_0x50d45f);}BPromise[_0x2700('0x8c')]()[_0x2700('0x29')](function(){if(!_0x4add9d){if(_0x27db02[_0x2700('0x3b')]['OpenchannelAccountId'])return;_0x2c2c2d['where']('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x145e13[_0x2700('0x46')](_0x2700('0x8d'));return;}if(_0x27db02['user'][_0x2700('0x8e')]!==_0x2700('0x8f'))return;return _0x27db02[_0x2700('0x90')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})[_0x2700('0x29')](function(_0x19c2c7){if(_[_0x2700('0x89')](_0x19c2c7)){_0x2c2c2d[_0x2700('0x46')](_0x2700('0x91'));_0x145e13['where'](_0x2700('0x91'));}else{_0x2c2c2d[_0x2700('0x46')](_0x2700('0x6f'),_[_0x2700('0x34')](_0x19c2c7,'id'));_0x145e13[_0x2700('0x46')](_0x2700('0x6f'),_['map'](_0x19c2c7,'id'));}});})[_0x2700('0x29')](function(){if(_0x27db02['user'][_0x2700('0x8e')]===_0x2700('0x8f')&&!_0x4add9d&&!_0x27db02[_0x2700('0x3b')][_0x2700('0x6e')])return[];return db[_0x2700('0x92')][_0x2700('0x3b')](_0x2c2c2d[_0x2700('0x93')](),_0x343383);})['then'](function(_0x175fd6){_0x47a354[_0x2700('0x20')]=_0x175fd6[_0x2700('0x40')];if(_0x47a354[_0x2700('0x20')]===0x0)return[];return db[_0x2700('0x92')][_0x2700('0x3b')](_0x3526d2[_0x2700('0x93')](),_0x343383)['then'](function(_0x5519a7){_0x479b85=_['keyBy'](_0x5519a7,'id');_0x343383=_[_0x2700('0x94')](_0x343383,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x27db02[_0x2700('0x3b')]['fields']){_0x8d5cb['attributes']['forEach'](function(_0x5f0328){_0x145e13[_0x2700('0x49')]('i.'+_0x5f0328);});}else{_0x145e13['field'](_0x2700('0x86'),_0x2700('0x5c'));_0x145e13[_0x2700('0x49')](_0x2700('0x95'),'Account.key');_0x145e13[_0x2700('0x49')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x145e13[_0x2700('0x49')](_0x2700('0x96'),_0x2700('0x87'));_0x145e13[_0x2700('0x49')]('i.*');_0x145e13['field'](_0x2700('0x97'),_0x2700('0x98'));_0x145e13['field'](_0x2700('0x99'),_0x2700('0x9a'));_0x145e13[_0x2700('0x49')]('c.email',_0x2700('0x9b'));_0x145e13['field']('c.phone','Contact.phone');_0x145e13[_0x2700('0x49')](_0x2700('0x9c'),_0x2700('0x9d'));_0x145e13[_0x2700('0x49')]('c.fax',_0x2700('0x9e'));_0x145e13[_0x2700('0x49')](_0x2700('0x9f'),_0x2700('0xa0'));_0x145e13[_0x2700('0x49')](_0x2700('0xa1'),'Owner.internal');_0x145e13[_0x2700('0x49')](_0x2700('0xa2'),_0x2700('0xa3'));}if(_0x8d5cb[_0x2700('0x43')])_0x145e13['limit'](_0x8d5cb[_0x2700('0x43')]);if(_0x8d5cb[_0x2700('0x21')])_0x145e13[_0x2700('0x21')](_0x8d5cb[_0x2700('0x21')]);return db[_0x2700('0x92')][_0x2700('0x3b')](_0x145e13[_0x2700('0x93')](),_0x343383);})['then'](function(_0x100066){_0xea3afe[_0x2700('0x46')]('ui.OpenchannelInteractionId\x20IN\x20?',_[_0x2700('0x34')](_0x100066,'id'));return db[_0x2700('0x92')][_0x2700('0x3b')](_0xea3afe[_0x2700('0x93')](),_0x343383)[_0x2700('0x29')](function(_0x105190){var _0x50f9c5=_[_0x2700('0xa4')](_0x105190,_0x2700('0xa5'));var _0x56781d=[];_0x100066['forEach'](function(_0x4b4d08){_0x56781d[_0x2700('0xa6')](updateOpenchannelInteraction(_0x4b4d08,_0x479b85,_0x50f9c5));});return BPromise['all'](_0x56781d);});});})['then'](function(_0x37eaad){_0x47a354[_0x2700('0xa7')]=_0x37eaad;return _0x47a354;})[_0x2700('0x29')](respondWithFilteredResult(_0xe8272a,_0x8d5cb))[_0x2700('0x32')](handleError(_0xe8272a,null));};exports['show']=function(_0x4bda52,_0x5d0666){var _0x5b92f1={};if(_0x4bda52[_0x2700('0x3b')][_0x2700('0x38')]&&_0x4bda52['query'][_0x2700('0x38')]===_0x2700('0x4b')){_0x5b92f1[_0x2700('0x4b')]=_0x4bda52[_0x2700('0xa8')]['id'];}else{_0x5b92f1['id']=_0x4bda52[_0x2700('0xa8')]['id'];}var _0x24342e={'raw':![],'where':_0x5b92f1},_0x56ff7f={};_0x56ff7f['model']=_['keys'](db[_0x2700('0x35')][_0x2700('0x36')]);_0x56ff7f['query']=_[_0x2700('0xa9')](_0x4bda52[_0x2700('0x3b')]);_0x56ff7f[_0x2700('0x3c')]=_[_0x2700('0x3e')](_0x56ff7f[_0x2700('0x3a')],_0x56ff7f[_0x2700('0x3b')]);_0x24342e[_0x2700('0x3d')]=_[_0x2700('0x3e')](_0x56ff7f['model'],qs[_0x2700('0x3f')](_0x4bda52[_0x2700('0x3b')][_0x2700('0x3f')]));_0x24342e[_0x2700('0x3d')]=_0x24342e[_0x2700('0x3d')][_0x2700('0x40')]?_0x24342e[_0x2700('0x3d')]:_0x56ff7f[_0x2700('0x3a')];if(_0x4bda52[_0x2700('0x3b')][_0x2700('0xaa')]){_0x24342e['include']=[{'all':!![]}];}_0x24342e=_[_0x2700('0x94')]({},_0x24342e,_0x4bda52[_0x2700('0xab')]);return db[_0x2700('0x35')][_0x2700('0x62')](_0x24342e)[_0x2700('0x29')](handleEntityNotFound(_0x5d0666,null))[_0x2700('0x29')](respondWithResult(_0x5d0666,null))[_0x2700('0x32')](handleError(_0x5d0666,null));};exports['create']=function(_0xf238d4,_0x552ecd){return db[_0x2700('0x35')][_0x2700('0xac')](_0xf238d4[_0x2700('0x6b')],{})[_0x2700('0x29')](respondWithResult(_0x552ecd,0xc9))[_0x2700('0x32')](handleError(_0x552ecd,null));};exports[_0x2700('0x27')]=function(_0x3d50a7,_0x3d374c){if(_0x3d50a7[_0x2700('0x6b')]['id']){delete _0x3d50a7['body']['id'];}return db[_0x2700('0x35')][_0x2700('0x62')]({'where':{'id':_0x3d50a7[_0x2700('0xa8')]['id']}})[_0x2700('0x29')](handleEntityNotFound(_0x3d374c,null))[_0x2700('0x29')](saveUpdates(_0x3d50a7[_0x2700('0x6b')],null))[_0x2700('0x29')](respondWithResult(_0x3d374c,null))['catch'](handleError(_0x3d374c,null));};exports[_0x2700('0x28')]=function(_0xafc921,_0x5b4d71){return db[_0x2700('0x35')][_0x2700('0x62')]({'where':{'id':_0xafc921[_0x2700('0xa8')]['id']}})[_0x2700('0x29')](handleEntityNotFound(_0x5b4d71,null))[_0x2700('0x29')](removeEntity(_0x5b4d71,null))[_0x2700('0x32')](handleError(_0x5b4d71,null));};exports['describe']=function(_0x32f4f5,_0x5b5783){return db['OpenchannelInteraction'][_0x2700('0xad')]()[_0x2700('0x29')](respondWithResult(_0x5b5783,null))[_0x2700('0x32')](handleError(_0x5b5783,null));};exports[_0x2700('0xae')]=function(_0x31ddec,_0x5ebd79,_0x10e75d){return db[_0x2700('0xaf')][_0x2700('0x62')]({'where':{'id':_0x31ddec[_0x2700('0xa8')]['id']}})[_0x2700('0x29')](handleEntityNotFound(_0x5ebd79,null))[_0x2700('0x29')](function(_0x4d9911){if(_0x4d9911){return _0x4d9911[_0x2700('0xae')](_0x31ddec[_0x2700('0x6b')][_0x2700('0xb0')],_[_0x2700('0xb1')](_0x31ddec[_0x2700('0x6b')],[_0x2700('0xb0'),'id'])||{});}})[_0x2700('0x29')](respondWithResult(_0x5ebd79,null))['catch'](handleError(_0x5ebd79,null));};exports[_0x2700('0xb2')]=function(_0x4b0dc6,_0x1df0be,_0x513e3b){var _0x59944f={'raw':![],'where':{}};var _0x2fe9ea={};var _0x5c442a={'count':0x0,'rows':[]};return db[_0x2700('0x35')][_0x2700('0xb3')]({'where':{'id':_0x4b0dc6[_0x2700('0xa8')]['id']}})[_0x2700('0x29')](handleEntityNotFound(_0x1df0be,null))[_0x2700('0x29')](function(_0x5a5d3b){if(_0x5a5d3b){_0x2fe9ea[_0x2700('0x3a')]=_[_0x2700('0xa9')](db['OpenchannelMessage']['rawAttributes']);_0x2fe9ea[_0x2700('0x3b')]=_[_0x2700('0xa9')](_0x4b0dc6[_0x2700('0x3b')]);_0x2fe9ea[_0x2700('0x3c')]=_[_0x2700('0x3e')](_0x2fe9ea[_0x2700('0x3a')],_0x2fe9ea['query']);_0x59944f[_0x2700('0x3d')]=_['intersection'](_0x2fe9ea['model'],qs[_0x2700('0x3f')](_0x4b0dc6[_0x2700('0x3b')]['fields']));_0x59944f[_0x2700('0x3d')]=_0x59944f['attributes']['length']?_0x59944f[_0x2700('0x3d')]:_0x2fe9ea[_0x2700('0x3a')];if(!_0x4b0dc6[_0x2700('0x3b')]['hasOwnProperty'](_0x2700('0x42'))){_0x59944f[_0x2700('0x43')]=qs[_0x2700('0x43')](_0x4b0dc6['query'][_0x2700('0x43')]);_0x59944f[_0x2700('0x21')]=qs[_0x2700('0x21')](_0x4b0dc6[_0x2700('0x3b')][_0x2700('0x21')]);}_0x59944f[_0x2700('0x44')]=qs['sort'](_0x4b0dc6[_0x2700('0x3b')][_0x2700('0x45')]);_0x59944f[_0x2700('0x46')]=qs[_0x2700('0x3c')](_[_0x2700('0x47')](_0x4b0dc6['query'],_0x2fe9ea[_0x2700('0x3c')]));_0x59944f[_0x2700('0x46')][_0x2700('0xa5')]=_0x5a5d3b['id'];if(_0x4b0dc6[_0x2700('0x3b')][_0x2700('0x7a')]){_0x59944f[_0x2700('0x46')]=_[_0x2700('0x94')](_0x59944f[_0x2700('0x46')],{'$or':_[_0x2700('0x34')](_0x59944f[_0x2700('0x3d')],function(_0x4c4300){var _0x2900d5={};_0x2900d5[_0x4c4300]={'$like':'%'+_0x4b0dc6[_0x2700('0x3b')][_0x2700('0x7a')]+'%'};return _0x2900d5;})});}if(_0x4b0dc6['query'][_0x2700('0x71')]){var _0x10c747=_0x4b0dc6[_0x2700('0x3b')][_0x2700('0x71')][_0x2700('0x2f')](',');var _0x4c772c={};_0x4c772c[_0x10c747[0x0]]={'$gte':moment(_0x10c747[0x1])[_0x2700('0xb4')](_0x2700('0xb5'))};_0x59944f['where']=_[_0x2700('0x94')](_0x59944f[_0x2700('0x46')],_0x4c772c);}_0x59944f=_[_0x2700('0x94')]({},_0x59944f,_0x4b0dc6['options']);return db[_0x2700('0xaf')][_0x2700('0x20')]({'where':_0x59944f[_0x2700('0x46')]})[_0x2700('0x29')](function(_0x5574c7){_0x5c442a['count']=_0x5574c7;if(_0x4b0dc6[_0x2700('0x3b')][_0x2700('0xaa')]){_0x59944f['include']=[{'all':!![]}];}return db[_0x2700('0xaf')]['findAll'](_0x59944f);})[_0x2700('0x29')](function(_0x46a6e0){_0x5c442a[_0x2700('0xa7')]=_0x46a6e0;return _0x5c442a;});}})['then'](respondWithFilteredResult(_0x1df0be,_0x59944f))['catch'](handleError(_0x1df0be,null));};exports[_0x2700('0xb6')]=function(_0x554de8,_0x431d15,_0x49bcf3){return db['OpenchannelInteraction'][_0x2700('0x62')]({'where':{'id':_0x554de8[_0x2700('0xa8')]['id']}})[_0x2700('0x29')](handleEntityNotFound(_0x431d15,null))[_0x2700('0x29')](function(_0x4b1edd){if(_0x4b1edd){return _0x4b1edd[_0x2700('0xb7')](_0x554de8[_0x2700('0x6b')][_0x2700('0xb0')],_[_0x2700('0xb1')](_0x554de8[_0x2700('0x6b')],[_0x2700('0xb0'),'id'])||{})[_0x2700('0xb8')](function(){return db[_0x2700('0x67')][_0x2700('0xb9')]({'attributes':['id',_0x2700('0x2c'),_0x2700('0x4a')],'where':{'id':_0x554de8['body'][_0x2700('0xb0')]}});})['then'](function(_0x4faea4){socket[_0x2700('0xba')](_0x2700('0xbb'),{'id':Number(_0x554de8[_0x2700('0xa8')]['id']),'tags':_0x4faea4||[]});return{'id':Number(_0x554de8[_0x2700('0xa8')]['id']),'tags':_0x4faea4||[]};});}})['then'](respondWithResult(_0x431d15,null))[_0x2700('0x32')](handleError(_0x431d15,null));};exports[_0x2700('0xbc')]=function(_0xc0735c,_0x1d3de9,_0x38a9f0){return db[_0x2700('0x35')][_0x2700('0x62')]({'where':{'id':_0xc0735c[_0x2700('0xa8')]['id']}})['then'](handleEntityNotFound(_0x1d3de9,null))['then'](function(_0x2b61dc){if(_0x2b61dc){return _0x2b61dc[_0x2700('0xbc')](_0xc0735c['query'][_0x2700('0xb0')]);}})[_0x2700('0x29')](respondWithStatusCode(_0x1d3de9,null))[_0x2700('0x32')](handleError(_0x1d3de9,null));};exports[_0x2700('0xbd')]=function(_0x35fd5f,_0x4fcc45){var _0x9a861e=moment()[_0x2700('0xbe')]()[_0x2700('0x93')]();var _0x4ab6ab=path[_0x2700('0xbf')](config['root'],_0x2700('0xc0'),_0x2700('0xc1'),_0x2700('0xc2'));var _0x180eef=path[_0x2700('0xbf')](config[_0x2700('0xc3')],_0x2700('0xc0'),'files',_0x2700('0xc4'));var _0x47b35e=path['join'](_0x4ab6ab,_0x9a861e);var _0x3418d4=util[_0x2700('0xb4')]('transcript-%d-%s.zip',_0x35fd5f['params']['id'],_0x9a861e);var _0x5f1f15=path[_0x2700('0xbf')](_0x4ab6ab,_0x3418d4);var _0x1d85b2=[];_0x1d85b2[_0x2700('0xa6')]({'model':db[_0x2700('0xc5')],'as':_0x2700('0xc5'),'attributes':['id','fullname'],'raw':!![]});_0x1d85b2['push']({'model':db[_0x2700('0xc6')],'as':_0x2700('0xc7'),'attributes':['id',_0x2700('0xc8'),'lastName'],'raw':!![]});if(_0x35fd5f[_0x2700('0x3b')][_0x2700('0xc4')]){_0x1d85b2[_0x2700('0xa6')]({'model':db[_0x2700('0xc9')],'as':_0x2700('0xc9'),'raw':!![]});}var _0x255aff=[{'model':db[_0x2700('0xaf')],'as':_0x2700('0xca'),'attributes':['id',_0x2700('0x6b'),_0x2700('0x70'),_0x2700('0xcb'),'secret',_0x2700('0x75')],'include':_0x1d85b2}];_0x255aff[_0x2700('0xa6')]({'model':db['OpenchannelAccount'],'as':_0x2700('0xcc'),'attributes':['id',_0x2700('0x2c')]});_0x255aff['push']({'model':db[_0x2700('0xc5')],'as':_0x2700('0xcd'),'attributes':['id','fullname']});return db['OpenchannelInteraction'][_0x2700('0x62')]({'where':{'id':_0x35fd5f[_0x2700('0xa8')]['id']},'include':_0x255aff})[_0x2700('0x29')](handleEntityNotFound(_0x4fcc45,null))[_0x2700('0x29')](function(_0x1db6f9){if(_0x1db6f9){var _0xd053fd=_0x1db6f9[_0x2700('0xce')]({'plain':!![]});fs['mkdirSync'](_0x47b35e);var _0x38da33={'format':'A4','border':_0x2700('0xcf'),'header':{'height':_0x2700('0xd0'),'contents':{'first':_0x2700('0xd1')}},'footer':{'height':_0x2700('0xd2'),'contents':{'default':util[_0x2700('0xb4')](_0x2700('0xd3'),util[_0x2700('0xb4')]('%s\x20#%d',_0x2700('0xd4'),_0xd053fd['id']),moment()[_0x2700('0xb4')](_0x2700('0xd5'))['toString']())}}};var _0x1d80e3={'channel':_0x2700('0xd4'),'account':_0xd053fd[_0x2700('0xcc')]['name'],'agent':_0xd053fd['Owner']?_0xd053fd['Owner']['fullname']:_0x2700('0xd6'),'createdAt':moment(_0xd053fd['createdAt'])[_0x2700('0xb4')](_0x2700('0xb5'))[_0x2700('0x93')](),'closedAt':_0xd053fd[_0x2700('0xd7')]?moment(_0xd053fd[_0x2700('0xd8')])[_0x2700('0xb4')]('YYYY-MM-DD\x20HH:mm:ss')[_0x2700('0x93')]():'','disposition':_0xd053fd[_0x2700('0xd9')],'visibility':_0xd053fd[_0x2700('0xda')]?_0x2700('0xdb'):_0x2700('0xdc'),'messages':_(_0xd053fd[_0x2700('0xca')])[_0x2700('0x7a')]({'secret':![]})[_0x2700('0x34')](function(_0x397582){if(_0x397582[_0x2700('0xc9')]){var _0x626ca1=path[_0x2700('0xbf')](_0x180eef,_0x397582[_0x2700('0xc9')][_0x2700('0xdd')]);if(fs[_0x2700('0xde')](_0x626ca1)){fs[_0x2700('0xdf')](_0x626ca1)[_0x2700('0xe0')](fs[_0x2700('0xe1')](path[_0x2700('0xbf')](_0x47b35e,_0x397582[_0x2700('0xc9')]['basename'])));}}return{'date':moment(_0x397582[_0x2700('0x70')])['format'](_0x2700('0xb5'))['toString'](),'sender':_0x397582['direction']==='out'?_0x397582['User']?_0x397582[_0x2700('0xc5')]['fullname']:_0x2700('0xe2'):_0x397582[_0x2700('0xc7')][_0x2700('0xc8')]+(_0x397582['Contact']['lastName']?'\x20'+_0x397582['Contact'][_0x2700('0xe3')]:''),'body':_0x397582[_0x2700('0xc9')]?_0x397582['Attachment'][_0x2700('0xdd')]:_0x397582[_0x2700('0x6b')],'direction':_0x397582['direction']==='out'?'A':'C','secret':_0x397582[_0x2700('0xe4')],'read':_0x397582[_0x2700('0x75')],'attachment':_0x397582[_0x2700('0xc9')]};})[_0x2700('0x5d')]()};return ejs['renderFile'](path[_0x2700('0xbf')](config[_0x2700('0xc3')],'server',_0x2700('0xe5'),'downloadInteraction.html'),{'interaction':_0x1d80e3})[_0x2700('0x29')](function(_0x1d69b4){return new BPromise(function(_0x27cc96,_0x2ec386){pdf[_0x2700('0xac')](_0x1d69b4,_0x38da33)[_0x2700('0xe6')](path[_0x2700('0xbf')](_0x47b35e,_0x2700('0xe7')+_0xd053fd['id']+'-'+_0x9a861e+_0x2700('0xe8')),function(_0x19ed15,_0x2f26c8){if(_0x19ed15)return _0x2ec386(_0x19ed15);_0x27cc96(_0x2f26c8);});});})[_0x2700('0x29')](function(){return new BPromise(function(_0x3b38d8,_0x507b58){zipdir(_0x47b35e,{'saveTo':_0x5f1f15},function(_0x242c06,_0x400f0d){if(_0x242c06)return _0x507b58(_0x242c06);return _0x3b38d8(_0x400f0d);});})[_0x2700('0x29')](function(){return new BPromise(function(_0xab54e8,_0x2e02f4){rimraf(_0x47b35e,function(_0x19dbe4){if(_0x19dbe4)_0x2e02f4(_0x19dbe4);return _0xab54e8();});});})[_0x2700('0x29')](function(){return _0x4fcc45['download'](_0x5f1f15,_0x3418d4,function(_0x2264a5){if(_0x2264a5){console[_0x2700('0xe9')](_0x2700('0xea'),_0x2264a5);}else{fs[_0x2700('0xeb')](_0x5f1f15);}});});});}else{return _0x4fcc45[_0x2700('0x1c')](0xc8);}})['catch'](handleError(_0x4fcc45,null));}; \ No newline at end of file +var _0x5089=['type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','field','color','tools_tags','select','u.id','u.fullname','ui.OpenchannelInteractionId','from','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','expr','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','some','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','user','role','agent','sequelize','toString','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','includeAll','include','merge','options','create','body','OpenchannelMessage','addMessage','ids','omit','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','findAll','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','files','tmp','server','transcript-%d-%s.zip','CmContact','firstName','lastName','attachments','Attachment','Messages','createdAt','secret','Account','Owner','mkdirSync','10px','40px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Openchannel','YYYY-MM-DD','N.A.','closed','closedAt','threadId','Public','Private','basename','existsSync','createReadStream','pipe','direction','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','end','error','name','Users','map','fullname','TagIds','split','forEach','Tags','push','catch','OpenchannelInteraction','rawAttributes'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x5089,0x1b5));var _0x9508=function(_0x10852d,_0x4cdcc6){_0x10852d=_0x10852d-0x0;var _0x13a8d6=_0x5089[_0x10852d];return _0x13a8d6;};'use strict';var pdf=require(_0x9508('0x0'));var emlformat=require(_0x9508('0x1'));var rimraf=require(_0x9508('0x2'));var zipdir=require(_0x9508('0x3'));var jsonpatch=require(_0x9508('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9508('0x5'));var Mustache=require(_0x9508('0x6'));var util=require(_0x9508('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x9508('0x8'));var ejs=require(_0x9508('0x9'));var fs=require('fs');var _=require(_0x9508('0xa'));var squel=require(_0x9508('0xb'));var crypto=require(_0x9508('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9508('0xd'));var toCsv=require(_0x9508('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9508('0xe'));var authService=require(_0x9508('0xf'));var qs=require(_0x9508('0x10'));var as=require(_0x9508('0x11'));var hardwareService=require(_0x9508('0x12'));var logger=require('../../config/logger')(_0x9508('0x13'));var utils=require(_0x9508('0x14'));var config=require(_0x9508('0x15'));var licenseUtil=require(_0x9508('0x16'));var db=require(_0x9508('0x17'))['db'];config['redis']=_[_0x9508('0x18')](config[_0x9508('0x19')],{'host':_0x9508('0x1a'),'port':0x18eb});var socket=require(_0x9508('0x1b'))(new Redis(config['redis']));require(_0x9508('0x1c'))['register'](socket);function respondWithStatusCode(_0x2b9fd1,_0x369f7d){_0x369f7d=_0x369f7d||0xcc;return function(_0x11c01){if(_0x11c01){return _0x2b9fd1[_0x9508('0x1d')](_0x369f7d);}return _0x2b9fd1['status'](_0x369f7d)['end']();};}function respondWithResult(_0x28c7de,_0x9f3f4b){_0x9f3f4b=_0x9f3f4b||0xc8;return function(_0x141841){if(_0x141841){return _0x28c7de[_0x9508('0x1e')](_0x9f3f4b)[_0x9508('0x1f')](_0x141841);}};}function respondWithFilteredResult(_0x1a3860,_0x50cf49){return function(_0x59c2ba){if(_0x59c2ba){var _0x492a8b=_0x59c2ba[_0x9508('0x20')],_0x3a0fb6=_0x50cf49[_0x9508('0x21')],_0x12d75b=_0x50cf49['offset']+_0x50cf49['limit'],_0x35e3b2;if(_0x12d75b>=_0x492a8b){_0x12d75b=_0x492a8b;_0x35e3b2=0xc8;}else{_0x35e3b2=0xce;}_0x1a3860[_0x9508('0x1e')](_0x35e3b2);return _0x1a3860[_0x9508('0x22')](_0x9508('0x23'),_0x3a0fb6+'-'+_0x12d75b+'/'+_0x492a8b)[_0x9508('0x1f')](_0x59c2ba);}return null;};}function patchUpdates(_0x593c75){return function(_0x1ff5ad){try{jsonpatch['apply'](_0x1ff5ad,_0x593c75,!![]);}catch(_0x408599){return BPromise[_0x9508('0x24')](_0x408599);}return _0x1ff5ad[_0x9508('0x25')]();};}function saveUpdates(_0xfd30f5,_0x30a701){return function(_0x3178de){if(_0x3178de){return _0x3178de[_0x9508('0x26')](_0xfd30f5)[_0x9508('0x27')](function(_0x5a4882){return _0x5a4882;});}return null;};}function removeEntity(_0x1ff9ce,_0x1b7714){return function(_0x3cde9c){if(_0x3cde9c){return _0x3cde9c[_0x9508('0x28')]()['then'](function(){_0x1ff9ce['status'](0xcc)[_0x9508('0x29')]();});}};}function handleEntityNotFound(_0x5d7964,_0xc03e3a){return function(_0x24f26e){if(!_0x24f26e){_0x5d7964[_0x9508('0x1d')](0x194);}return _0x24f26e;};}function handleError(_0x415ee3,_0x3f1626){_0x3f1626=_0x3f1626||0x1f4;return function(_0xf59caa){logger[_0x9508('0x2a')](_0xf59caa['stack']);if(_0xf59caa[_0x9508('0x2b')]){delete _0xf59caa['name'];}_0x415ee3['status'](_0x3f1626)['send'](_0xf59caa);};}function getInteractionUsers(_0x133e70,_0x779503){return new BPromise(function(_0x1fbf34,_0x2a5547){try{if(_0x779503[_0x133e70['id']]){_0x133e70[_0x9508('0x2c')]=_[_0x9508('0x2d')](_0x779503[_0x133e70['id']],function(_0x461c7e){return{'id':_0x461c7e['id'],'fullname':_0x461c7e[_0x9508('0x2e')]};});}}catch(_0x42659b){_0x2a5547(_0x42659b);}_0x1fbf34(_0x133e70);});}function getInteractionTags(_0x54bcef,_0x782f34){return new BPromise(function(_0x53050a,_0x4459ed){try{if(_0x54bcef[_0x9508('0x2f')]){_0x54bcef['Tags']=[];_0x54bcef['TagIds'][_0x9508('0x30')](',')[_0x9508('0x31')](function(_0x18503c){_0x54bcef[_0x9508('0x32')][_0x9508('0x33')](_0x782f34[_0x18503c]);});}delete _0x54bcef[_0x9508('0x2f')];}catch(_0x2a4b8a){_0x4459ed(_0x2a4b8a);}_0x53050a(_0x54bcef);});}function updateOpenchannelInteraction(_0x4db2ed,_0x1ec5cf,_0x132bb0){return new BPromise(function(_0x30d8ff,_0x33fb06){return getInteractionUsers(_0x4db2ed,_0x132bb0)[_0x9508('0x27')](function(_0x50a779){return getInteractionTags(_0x50a779,_0x1ec5cf);})['then'](function(_0x5b6ff9){_0x30d8ff(_0x5b6ff9);})[_0x9508('0x34')](function(_0x15ff37){_0x33fb06(_0x15ff37);});});}exports['index']=function(_0x3dbecc,_0x56403a){var _0x20a0bb={},_0x460bb5={},_0x79f8a0={'count':0x0,'rows':[]};var _0x5dbc78=_['map'](db[_0x9508('0x35')][_0x9508('0x36')],function(_0x212202){return{'name':_0x212202['fieldName'],'type':_0x212202[_0x9508('0x37')][_0x9508('0x38')]};});_0x460bb5[_0x9508('0x39')]=_[_0x9508('0x2d')](_0x5dbc78,_0x9508('0x2b'));_0x460bb5[_0x9508('0x3a')]=_[_0x9508('0x3b')](_0x3dbecc[_0x9508('0x3a')]);_0x460bb5['filters']=_[_0x9508('0x3c')](_0x460bb5['model'],_0x460bb5[_0x9508('0x3a')]);_0x20a0bb[_0x9508('0x3d')]=_['intersection'](_0x460bb5[_0x9508('0x39')],qs[_0x9508('0x3e')](_0x3dbecc[_0x9508('0x3a')][_0x9508('0x3e')]));_0x20a0bb[_0x9508('0x3d')]=_0x20a0bb[_0x9508('0x3d')][_0x9508('0x3f')]?_0x20a0bb['attributes']:_0x460bb5[_0x9508('0x39')];if(!_0x3dbecc[_0x9508('0x3a')][_0x9508('0x40')](_0x9508('0x41'))){_0x20a0bb[_0x9508('0x42')]=qs[_0x9508('0x42')](_0x3dbecc['query'][_0x9508('0x42')]);_0x20a0bb[_0x9508('0x21')]=qs[_0x9508('0x21')](_0x3dbecc[_0x9508('0x3a')][_0x9508('0x21')]);}_0x20a0bb['order']=qs[_0x9508('0x43')](_0x3dbecc[_0x9508('0x3a')]['sort']);_0x20a0bb[_0x9508('0x44')]=qs[_0x9508('0x45')](_[_0x9508('0x46')](_0x3dbecc[_0x9508('0x3a')],_0x460bb5['filters']),_0x5dbc78);var _0x32ae77=[];var _0xa180ce=squel['select']()[_0x9508('0x47')]('id')[_0x9508('0x47')](_0x9508('0x2b'))[_0x9508('0x47')](_0x9508('0x48'))['from'](_0x9508('0x49'));var _0x3f5bc8=squel[_0x9508('0x4a')]()['field'](_0x9508('0x4b'))['field'](_0x9508('0x4c'))[_0x9508('0x47')](_0x9508('0x4d'))[_0x9508('0x4e')](_0x9508('0x4f'),'ui')[_0x9508('0x50')](_0x9508('0x51'),'u',_0x9508('0x52'));var _0x3f5074=squel[_0x9508('0x4a')]()['from'](_0x9508('0x53'),'i')[_0x9508('0x50')](_0x9508('0x54'),'c',_0x9508('0x55'))[_0x9508('0x50')]('users','o',_0x9508('0x56'))[_0x9508('0x50')](_0x9508('0x57'),'a',_0x9508('0x58'))['left_join']('openchannel_messages','me',_0x9508('0x59'))[_0x9508('0x50')]('openchannel_interaction_has_tags','it','it.OpenchannelInteractionId\x20=\x20i.id')[_0x9508('0x50')](_0x9508('0x49'),'t','t.id\x20=\x20it.TagId');var _0x5e3bf=squel[_0x9508('0x5a')]();var _0x5a7a0c=[];var _0x59eba3=squel['expr']();var _0x5a1ccf;if(_0x3dbecc[_0x9508('0x3a')]['search']){_0x5a1ccf=as[_0x9508('0x5b')](_0x3dbecc[_0x9508('0x3a')]['search']);var _0x3cf6c5=_0x5a1ccf[_0x9508('0x5c')];for(var _0x1a3367=0x0;_0x1a3367<_0x5a1ccf[_0x9508('0x5d')][_0x9508('0x3f')];_0x1a3367++){var _0x8157d5=_0x5a1ccf[_0x9508('0x5d')][_0x1a3367];var _0x14a97b='i';var _0x146c2e=_[_0x9508('0x5e')](_0x5dbc78,['name',_0x8157d5[_0x9508('0x47')]]);if(!_0x146c2e){switch(_0x8157d5[_0x9508('0x47')]){case _0x9508('0x5f'):if(_0x8157d5['value']==0x1){_0x3f5074[_0x9508('0x60')]('`'+_0x8157d5[_0x9508('0x47')]+_0x9508('0x61'));}else{_0x3f5074[_0x9508('0x60')]('`'+_0x8157d5[_0x9508('0x47')]+_0x9508('0x62'));}break;case _0x9508('0x63'):if(_0x8157d5[_0x9508('0x64')]===_0x9508('0x65')){if(_0x8157d5[_0x9508('0x66')][_0x9508('0x30')]('\x20')['length']>0x1){_0x5e3bf[_0x3cf6c5](_0x9508('0x67'),qs[_0x9508('0x68')](_0x8157d5['value']),null);}else{var _0x49e525='%'+_0x8157d5[_0x9508('0x66')]+'%';_0x5e3bf[_0x3cf6c5]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x49e525,_0x49e525,_0x49e525);}}else{_0x146c2e=_[_0x9508('0x5e')](_0x5dbc78,['name',_0x9508('0x69')]);_0x8157d5[_0x9508('0x47')]=_0x9508('0x69');_0x550f90=as['buildExpression'](_0x14a97b,_0x146c2e[_0x9508('0x37')],_0x8157d5);_0x5e3bf[_0x3cf6c5](_0x550f90[_0x9508('0x6a')],_0x550f90['value'][_0x9508('0x6b')],_0x550f90[_0x9508('0x66')][_0x9508('0x29')]);}break;case _0x9508('0x6c'):var _0x37a659=_0x8157d5[_0x9508('0x66')]['split'](',')[_0x9508('0x2d')](function(_0x14a6f7){return Number(_0x14a6f7);});_0x37a659['forEach'](function(_0x4e9217){_0x59eba3['or'](_0x9508('0x6d'),'%,'+_0x4e9217+',%');});_0x5a7a0c=_[_0x9508('0x6e')](_0x5a7a0c,_0x37a659);break;case _0x9508('0x6f'):if(_0x8157d5['operator']===_0x9508('0x65')){_0x5e3bf[_0x3cf6c5](_0x9508('0x70'),'%'+_0x8157d5['value']+'%',null);}else{_0x146c2e=_['find'](_0x5dbc78,[_0x9508('0x2b'),_0x9508('0x71')]);_0x8157d5['field']=_0x9508('0x71');_0x550f90=as[_0x9508('0x72')](_0x14a97b,_0x146c2e[_0x9508('0x37')],_0x8157d5);_0x5e3bf[_0x3cf6c5](_0x550f90[_0x9508('0x6a')],_0x550f90[_0x9508('0x66')]['start'],_0x550f90[_0x9508('0x66')][_0x9508('0x29')]);}break;case'body':_0x550f90=as[_0x9508('0x72')]('me',null,_0x8157d5);_0x5e3bf[_0x3cf6c5](_0x550f90[_0x9508('0x6a')],_0x550f90[_0x9508('0x66')][_0x9508('0x6b')],_0x550f90[_0x9508('0x66')][_0x9508('0x29')]);break;}}else{var _0x550f90=as[_0x9508('0x72')](_0x14a97b,_0x146c2e['type'],_0x8157d5);_0x5e3bf[_0x3cf6c5](_0x550f90[_0x9508('0x6a')],_0x550f90[_0x9508('0x66')][_0x9508('0x6b')],_0x550f90[_0x9508('0x66')][_0x9508('0x29')]);}}}else{var _0x3bd31c=_(_0x3dbecc[_0x9508('0x3a')])[_0x9508('0x3b')]()[_0x9508('0x2d')](function(_0x155ee0){return _[_0x9508('0x73')](_0x5dbc78,[_0x9508('0x2b'),_0x155ee0])?_0x155ee0:undefined;})['compact']()[_0x9508('0x66')]();if(!_[_0x9508('0x74')](_0x3bd31c)){_0x3bd31c[_0x9508('0x31')](function(_0x10e229){if(_0x10e229===_0x9508('0x75')){_0x3f5074[_0x9508('0x44')](_0x9508('0x76'),[][_0x9508('0x77')](_0x3dbecc[_0x9508('0x3a')][_0x10e229]));}else if(_0x10e229==='createdAt'){var _0x43cd50=JSON[_0x9508('0x78')](_0x3dbecc[_0x9508('0x3a')][_0x10e229])['$gte'];var _0x34cfea=JSON['parse'](_0x3dbecc[_0x9508('0x3a')][_0x10e229])[_0x9508('0x79')];_0x3f5074[_0x9508('0x44')](_0x9508('0x7a'),_0x43cd50,_0x34cfea);}else{if(_0x3dbecc[_0x9508('0x3a')][_0x10e229]===_0x9508('0x7b')){_0x3f5074[_0x9508('0x44')]('i.'+_0x10e229+_0x9508('0x7c'));}else{_0x3f5074['where']('i.'+_0x10e229+_0x9508('0x7d'),_0x3dbecc['query'][_0x10e229]);}}});}if(_0x3dbecc['query']['read']){if(_0x3dbecc['query'][_0x9508('0x7e')]==0x1){_0x3f5074[_0x9508('0x60')](_0x9508('0x7f'));}else{_0x3f5074['having']('`unreadMessages`\x20>\x200');}}if(_0x3dbecc[_0x9508('0x3a')][_0x9508('0x80')]){_0x5a7a0c=_[_0x9508('0x81')](_0x3dbecc[_0x9508('0x3a')][_0x9508('0x80')])?_0x3dbecc[_0x9508('0x3a')][_0x9508('0x80')]:new Array(_0x3dbecc[_0x9508('0x3a')][_0x9508('0x80')]);_0x5a7a0c['forEach'](function(_0x38e095){_0x59eba3['or'](_0x9508('0x6d'),'%,'+_0x38e095+',%');});}if(_0x3dbecc[_0x9508('0x3a')]['filter']){var _0x3e2a53=_0x3dbecc[_0x9508('0x3a')][_0x9508('0x82')][_0x9508('0x83')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x9508('0x84')](_0x3e2a53)){_0x5e3bf['or'](_0x9508('0x85'),_0x3e2a53+'%');}else{_0x5e3bf['or'](_0x9508('0x86'),qs[_0x9508('0x68')](_0x3e2a53))['or'](_0x9508('0x87'),_0x3e2a53+'%')['or'](_0x9508('0x88'),_0x3e2a53+'%');}}}_0x3f5074[_0x9508('0x44')](_0x5e3bf);_0x3f5074[_0x9508('0x89')](_0x9508('0x8a'));var _0xf68374={'type':db[_0x9508('0x8b')][_0x9508('0x8c')][_0x9508('0x8d')],'raw':!![]};var _0x2c63c2=_0x3f5074[_0x9508('0x8e')]();_0x2c63c2[_0x9508('0x47')](_0x9508('0x8a'));_0x2c63c2[_0x9508('0x47')](_0x9508('0x8f'),_0x9508('0x5f'));if(_0x20a0bb[_0x9508('0x90')]){_0x20a0bb[_0x9508('0x90')]['forEach'](function(_0x4f58d9){var _0x2c1897=_0x4f58d9[0x0]===_0x9508('0x91')?_0x4f58d9[0x0]:'i.'+_0x4f58d9[0x0];_0x3f5074[_0x9508('0x90')](_0x2c1897,_0x4f58d9[0x1]==='DESC'?![]:!![]);});}if(!_[_0x9508('0x74')](_0x5a7a0c)){_0x3f5074[_0x9508('0x60')](_0x59eba3);_0x2c63c2[_0x9508('0x44')]('t.id\x20IN\x20?',_0x5a7a0c);}BPromise[_0x9508('0x92')]()[_0x9508('0x27')](function(){if(!_0x5a1ccf){if(_0x3dbecc['query']['OpenchannelAccountId'])return;_0x2c63c2[_0x9508('0x44')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x3f5074[_0x9508('0x44')](_0x9508('0x93'));return;}if(_0x3dbecc['user']['role']!=='agent')return;return _0x3dbecc['user'][_0x9508('0x94')]({'attributes':['id'],'raw':!![]})[_0x9508('0x27')](function(_0x1778f9){if(_['isEmpty'](_0x1778f9)){_0x2c63c2[_0x9508('0x44')](_0x9508('0x95'));_0x3f5074['where'](_0x9508('0x95'));}else{_0x2c63c2[_0x9508('0x44')]('i.OpenchannelAccountId\x20IN\x20?',_[_0x9508('0x2d')](_0x1778f9,'id'));_0x3f5074[_0x9508('0x44')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x1778f9,'id'));}});})[_0x9508('0x27')](function(){if(_0x3dbecc[_0x9508('0x96')][_0x9508('0x97')]===_0x9508('0x98')&&!_0x5a1ccf&&!_0x3dbecc[_0x9508('0x3a')][_0x9508('0x75')])return[];return db[_0x9508('0x99')][_0x9508('0x3a')](_0x2c63c2[_0x9508('0x9a')](),_0xf68374);})['then'](function(_0x12c0d5){_0x79f8a0[_0x9508('0x20')]=_0x12c0d5['length'];if(_0x79f8a0[_0x9508('0x20')]===0x0)return[];return db[_0x9508('0x99')][_0x9508('0x3a')](_0xa180ce['toString'](),_0xf68374)[_0x9508('0x27')](function(_0x643257){_0x32ae77=_[_0x9508('0x9b')](_0x643257,'id');_0xf68374=_['merge'](_0xf68374,{'model':db[_0x9508('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3dbecc['query'][_0x9508('0x3e')]){_0x20a0bb[_0x9508('0x3d')][_0x9508('0x31')](function(_0x401070){_0x3f5074[_0x9508('0x47')]('i.'+_0x401070);});}else{_0x3f5074[_0x9508('0x47')](_0x9508('0x8f'),_0x9508('0x5f'));_0x3f5074[_0x9508('0x47')](_0x9508('0x9c'),'Account.key');_0x3f5074['field'](_0x9508('0x9d'),_0x9508('0x9e'));_0x3f5074[_0x9508('0x47')](_0x9508('0x9f'),_0x9508('0x91'));_0x3f5074['field']('i.*');_0x3f5074[_0x9508('0x47')]('c.firstName',_0x9508('0xa0'));_0x3f5074[_0x9508('0x47')](_0x9508('0xa1'),_0x9508('0xa2'));_0x3f5074['field'](_0x9508('0xa3'),'Contact.email');_0x3f5074[_0x9508('0x47')](_0x9508('0xa4'),'Contact.phone');_0x3f5074['field']('c.mobile',_0x9508('0xa5'));_0x3f5074['field'](_0x9508('0xa6'),_0x9508('0xa7'));_0x3f5074['field'](_0x9508('0xa8'),_0x9508('0xa9'));_0x3f5074[_0x9508('0x47')](_0x9508('0xaa'),_0x9508('0xab'));_0x3f5074[_0x9508('0x47')](_0x9508('0xac'),_0x9508('0x2f'));}if(_0x20a0bb['limit'])_0x3f5074[_0x9508('0x42')](_0x20a0bb['limit']);if(_0x20a0bb[_0x9508('0x21')])_0x3f5074[_0x9508('0x21')](_0x20a0bb[_0x9508('0x21')]);return db[_0x9508('0x99')]['query'](_0x3f5074[_0x9508('0x9a')](),_0xf68374);})[_0x9508('0x27')](function(_0x338588){_0x3f5bc8[_0x9508('0x44')](_0x9508('0xad'),_['map'](_0x338588,'id'));return db[_0x9508('0x99')]['query'](_0x3f5bc8[_0x9508('0x9a')](),_0xf68374)[_0x9508('0x27')](function(_0x415cb6){var _0x2e8c81=_[_0x9508('0xae')](_0x415cb6,_0x9508('0xaf'));var _0x5e33a0=[];_0x338588[_0x9508('0x31')](function(_0x38a293){_0x5e33a0[_0x9508('0x33')](updateOpenchannelInteraction(_0x38a293,_0x32ae77,_0x2e8c81));});return BPromise[_0x9508('0xb0')](_0x5e33a0);});});})['then'](function(_0x5c056c){_0x79f8a0[_0x9508('0xb1')]=_0x5c056c;return _0x79f8a0;})[_0x9508('0x27')](respondWithFilteredResult(_0x56403a,_0x20a0bb))['catch'](handleError(_0x56403a,null));};exports[_0x9508('0xb2')]=function(_0x1fea3a,_0x6f381f){var _0x3e7f85={};if(_0x1fea3a[_0x9508('0x3a')][_0x9508('0x37')]&&_0x1fea3a['query']['type']==='from'){_0x3e7f85[_0x9508('0x4e')]=_0x1fea3a['params']['id'];}else{_0x3e7f85['id']=_0x1fea3a[_0x9508('0xb3')]['id'];}var _0x97b46b={'raw':![],'where':_0x3e7f85},_0x102110={};_0x102110[_0x9508('0x39')]=_[_0x9508('0x3b')](db['OpenchannelInteraction'][_0x9508('0x36')]);_0x102110[_0x9508('0x3a')]=_[_0x9508('0x3b')](_0x1fea3a['query']);_0x102110[_0x9508('0x45')]=_[_0x9508('0x3c')](_0x102110[_0x9508('0x39')],_0x102110[_0x9508('0x3a')]);_0x97b46b[_0x9508('0x3d')]=_[_0x9508('0x3c')](_0x102110[_0x9508('0x39')],qs['fields'](_0x1fea3a[_0x9508('0x3a')][_0x9508('0x3e')]));_0x97b46b[_0x9508('0x3d')]=_0x97b46b[_0x9508('0x3d')][_0x9508('0x3f')]?_0x97b46b[_0x9508('0x3d')]:_0x102110[_0x9508('0x39')];if(_0x1fea3a[_0x9508('0x3a')][_0x9508('0xb4')]){_0x97b46b[_0x9508('0xb5')]=[{'all':!![]}];}_0x97b46b=_[_0x9508('0xb6')]({},_0x97b46b,_0x1fea3a[_0x9508('0xb7')]);return db['OpenchannelInteraction'][_0x9508('0x5e')](_0x97b46b)['then'](handleEntityNotFound(_0x6f381f,null))[_0x9508('0x27')](respondWithResult(_0x6f381f,null))['catch'](handleError(_0x6f381f,null));};exports[_0x9508('0xb8')]=function(_0x5b8ffb,_0x4a94a8){return db['OpenchannelInteraction'][_0x9508('0xb8')](_0x5b8ffb[_0x9508('0xb9')],{})[_0x9508('0x27')](respondWithResult(_0x4a94a8,0xc9))[_0x9508('0x34')](handleError(_0x4a94a8,null));};exports[_0x9508('0x26')]=function(_0x2221df,_0x19d3ab){if(_0x2221df[_0x9508('0xb9')]['id']){delete _0x2221df[_0x9508('0xb9')]['id'];}return db[_0x9508('0x35')][_0x9508('0x5e')]({'where':{'id':_0x2221df[_0x9508('0xb3')]['id']}})[_0x9508('0x27')](handleEntityNotFound(_0x19d3ab,null))[_0x9508('0x27')](saveUpdates(_0x2221df[_0x9508('0xb9')],null))[_0x9508('0x27')](respondWithResult(_0x19d3ab,null))[_0x9508('0x34')](handleError(_0x19d3ab,null));};exports[_0x9508('0x28')]=function(_0x47661a,_0x472e7f){return db[_0x9508('0x35')][_0x9508('0x5e')]({'where':{'id':_0x47661a[_0x9508('0xb3')]['id']}})[_0x9508('0x27')](handleEntityNotFound(_0x472e7f,null))[_0x9508('0x27')](removeEntity(_0x472e7f,null))[_0x9508('0x34')](handleError(_0x472e7f,null));};exports['describe']=function(_0x416616,_0x59d44e){return db[_0x9508('0x35')]['describe']()[_0x9508('0x27')](respondWithResult(_0x59d44e,null))[_0x9508('0x34')](handleError(_0x59d44e,null));};exports['addMessage']=function(_0x1c6f81,_0x60050f,_0x482e96){return db[_0x9508('0xba')][_0x9508('0x5e')]({'where':{'id':_0x1c6f81[_0x9508('0xb3')]['id']}})[_0x9508('0x27')](handleEntityNotFound(_0x60050f,null))[_0x9508('0x27')](function(_0x13544c){if(_0x13544c){return _0x13544c[_0x9508('0xbb')](_0x1c6f81[_0x9508('0xb9')][_0x9508('0xbc')],_[_0x9508('0xbd')](_0x1c6f81['body'],[_0x9508('0xbc'),'id'])||{});}})[_0x9508('0x27')](respondWithResult(_0x60050f,null))[_0x9508('0x34')](handleError(_0x60050f,null));};exports[_0x9508('0xbe')]=function(_0x4c1d6b,_0xeb830b,_0x56678c){var _0x6b0ec0={'raw':![],'where':{}};var _0x5d555b={};var _0x4a1243={'count':0x0,'rows':[]};return db[_0x9508('0x35')]['findOne']({'where':{'id':_0x4c1d6b[_0x9508('0xb3')]['id']}})[_0x9508('0x27')](handleEntityNotFound(_0xeb830b,null))['then'](function(_0x4dda06){if(_0x4dda06){_0x5d555b[_0x9508('0x39')]=_[_0x9508('0x3b')](db[_0x9508('0xba')][_0x9508('0x36')]);_0x5d555b[_0x9508('0x3a')]=_['keys'](_0x4c1d6b['query']);_0x5d555b['filters']=_['intersection'](_0x5d555b['model'],_0x5d555b[_0x9508('0x3a')]);_0x6b0ec0[_0x9508('0x3d')]=_[_0x9508('0x3c')](_0x5d555b['model'],qs[_0x9508('0x3e')](_0x4c1d6b[_0x9508('0x3a')][_0x9508('0x3e')]));_0x6b0ec0[_0x9508('0x3d')]=_0x6b0ec0[_0x9508('0x3d')][_0x9508('0x3f')]?_0x6b0ec0[_0x9508('0x3d')]:_0x5d555b['model'];if(!_0x4c1d6b[_0x9508('0x3a')][_0x9508('0x40')](_0x9508('0x41'))){_0x6b0ec0[_0x9508('0x42')]=qs['limit'](_0x4c1d6b[_0x9508('0x3a')][_0x9508('0x42')]);_0x6b0ec0[_0x9508('0x21')]=qs[_0x9508('0x21')](_0x4c1d6b[_0x9508('0x3a')]['offset']);}_0x6b0ec0[_0x9508('0x90')]=qs[_0x9508('0x43')](_0x4c1d6b[_0x9508('0x3a')]['sort']);_0x6b0ec0[_0x9508('0x44')]=qs[_0x9508('0x45')](_['pick'](_0x4c1d6b[_0x9508('0x3a')],_0x5d555b['filters']));_0x6b0ec0[_0x9508('0x44')][_0x9508('0xaf')]=_0x4dda06['id'];if(_0x4c1d6b[_0x9508('0x3a')][_0x9508('0x82')]){_0x6b0ec0[_0x9508('0x44')]=_[_0x9508('0xb6')](_0x6b0ec0[_0x9508('0x44')],{'$or':_[_0x9508('0x2d')](_0x6b0ec0['attributes'],function(_0x508e8b){var _0x216bc2={};_0x216bc2[_0x508e8b]={'$like':'%'+_0x4c1d6b[_0x9508('0x3a')][_0x9508('0x82')]+'%'};return _0x216bc2;})});}if(_0x4c1d6b[_0x9508('0x3a')][_0x9508('0xbf')]){var _0x20787f=_0x4c1d6b['query'][_0x9508('0xbf')][_0x9508('0x30')](',');var _0x25e18e={};_0x25e18e[_0x20787f[0x0]]={'$gte':moment(_0x20787f[0x1])[_0x9508('0xc0')](_0x9508('0xc1'))};_0x6b0ec0[_0x9508('0x44')]=_['merge'](_0x6b0ec0[_0x9508('0x44')],_0x25e18e);}_0x6b0ec0=_[_0x9508('0xb6')]({},_0x6b0ec0,_0x4c1d6b['options']);return db[_0x9508('0xba')][_0x9508('0x20')]({'where':_0x6b0ec0[_0x9508('0x44')]})['then'](function(_0x441f72){_0x4a1243[_0x9508('0x20')]=_0x441f72;if(_0x4c1d6b['query'][_0x9508('0xb4')]){_0x6b0ec0[_0x9508('0xb5')]=[{'all':!![]}];}return db[_0x9508('0xba')]['findAll'](_0x6b0ec0);})[_0x9508('0x27')](function(_0x1a15e7){_0x4a1243[_0x9508('0xb1')]=_0x1a15e7;return _0x4a1243;});}})['then'](respondWithFilteredResult(_0xeb830b,_0x6b0ec0))[_0x9508('0x34')](handleError(_0xeb830b,null));};exports[_0x9508('0xc2')]=function(_0x5705fb,_0x553ce9,_0x1e3928){return db[_0x9508('0x35')][_0x9508('0x5e')]({'where':{'id':_0x5705fb['params']['id']}})['then'](handleEntityNotFound(_0x553ce9,null))[_0x9508('0x27')](function(_0x386754){if(_0x386754){return _0x386754[_0x9508('0xc3')](_0x5705fb[_0x9508('0xb9')][_0x9508('0xbc')],_[_0x9508('0xbd')](_0x5705fb[_0x9508('0xb9')],[_0x9508('0xbc'),'id'])||{})[_0x9508('0xc4')](function(){return db[_0x9508('0x6c')][_0x9508('0xc5')]({'attributes':['id','name',_0x9508('0x48')],'where':{'id':_0x5705fb[_0x9508('0xb9')][_0x9508('0xbc')]}});})['then'](function(_0x3cfcad){socket[_0x9508('0xc6')](_0x9508('0xc7'),{'id':Number(_0x5705fb['params']['id']),'tags':_0x3cfcad||[]});return{'id':Number(_0x5705fb[_0x9508('0xb3')]['id']),'tags':_0x3cfcad||[]};});}})[_0x9508('0x27')](respondWithResult(_0x553ce9,null))['catch'](handleError(_0x553ce9,null));};exports[_0x9508('0xc8')]=function(_0x1a6a08,_0x483241,_0x15a32e){return db['OpenchannelInteraction']['find']({'where':{'id':_0x1a6a08[_0x9508('0xb3')]['id']}})[_0x9508('0x27')](handleEntityNotFound(_0x483241,null))['then'](function(_0x20ffde){if(_0x20ffde){return _0x20ffde[_0x9508('0xc8')](_0x1a6a08['query'][_0x9508('0xbc')]);}})[_0x9508('0x27')](respondWithStatusCode(_0x483241,null))[_0x9508('0x34')](handleError(_0x483241,null));};exports[_0x9508('0xc9')]=function(_0x18804b,_0x680a78){var _0x499b3e=moment()[_0x9508('0xca')]()[_0x9508('0x9a')]();var _0x41836a=path[_0x9508('0xcb')](config[_0x9508('0xcc')],'server',_0x9508('0xcd'),_0x9508('0xce'));var _0x1d8d30=path[_0x9508('0xcb')](config['root'],_0x9508('0xcf'),_0x9508('0xcd'),'attachments');var _0x110a16=path[_0x9508('0xcb')](_0x41836a,_0x499b3e);var _0xb6002c=util[_0x9508('0xc0')](_0x9508('0xd0'),_0x18804b['params']['id'],_0x499b3e);var _0x1670bf=path[_0x9508('0xcb')](_0x41836a,_0xb6002c);var _0x4d8ba2=[];_0x4d8ba2['push']({'model':db[_0x9508('0x6f')],'as':'User','attributes':['id',_0x9508('0x2e')],'raw':!![]});_0x4d8ba2[_0x9508('0x33')]({'model':db[_0x9508('0xd1')],'as':_0x9508('0x63'),'attributes':['id',_0x9508('0xd2'),_0x9508('0xd3')],'raw':!![]});if(_0x18804b[_0x9508('0x3a')][_0x9508('0xd4')]){_0x4d8ba2[_0x9508('0x33')]({'model':db[_0x9508('0xd5')],'as':_0x9508('0xd5'),'raw':!![]});}var _0x2e780a=[{'model':db['OpenchannelMessage'],'as':_0x9508('0xd6'),'attributes':['id',_0x9508('0xb9'),_0x9508('0xd7'),'direction',_0x9508('0xd8'),_0x9508('0x7e')],'include':_0x4d8ba2}];_0x2e780a[_0x9508('0x33')]({'model':db['OpenchannelAccount'],'as':_0x9508('0xd9'),'attributes':['id',_0x9508('0x2b')]});_0x2e780a[_0x9508('0x33')]({'model':db[_0x9508('0x6f')],'as':_0x9508('0xda'),'attributes':['id',_0x9508('0x2e')]});return db[_0x9508('0x35')][_0x9508('0x5e')]({'where':{'id':_0x18804b[_0x9508('0xb3')]['id']},'include':_0x2e780a})['then'](handleEntityNotFound(_0x680a78,null))['then'](function(_0x3cb69e){if(_0x3cb69e){var _0x4d4491=_0x3cb69e['get']({'plain':!![]});fs[_0x9508('0xdb')](_0x110a16);var _0x692f2c={'format':'A4','border':_0x9508('0xdc'),'header':{'height':_0x9508('0xdd'),'contents':{'first':_0x9508('0xde')}},'footer':{'height':_0x9508('0xdf'),'contents':{'default':util[_0x9508('0xc0')](_0x9508('0xe0'),util[_0x9508('0xc0')](_0x9508('0xe1'),_0x9508('0xe2'),_0x4d4491['id']),moment()[_0x9508('0xc0')](_0x9508('0xe3'))[_0x9508('0x9a')]())}}};var _0x7e292a={'channel':'Openchannel','account':_0x4d4491[_0x9508('0xd9')][_0x9508('0x2b')],'agent':_0x4d4491[_0x9508('0xda')]?_0x4d4491['Owner'][_0x9508('0x2e')]:_0x9508('0xe4'),'createdAt':moment(_0x4d4491['createdAt'])[_0x9508('0xc0')](_0x9508('0xc1'))['toString'](),'closedAt':_0x4d4491[_0x9508('0xe5')]?moment(_0x4d4491[_0x9508('0xe6')])[_0x9508('0xc0')](_0x9508('0xc1'))[_0x9508('0x9a')]():'','disposition':_0x4d4491['disposition'],'visibility':_0x4d4491[_0x9508('0xe7')]?_0x9508('0xe8'):_0x9508('0xe9'),'messages':_(_0x4d4491[_0x9508('0xd6')])[_0x9508('0x82')]({'secret':![]})[_0x9508('0x2d')](function(_0x4bf265){if(_0x4bf265[_0x9508('0xd5')]){var _0x597409=path['join'](_0x1d8d30,_0x4bf265[_0x9508('0xd5')][_0x9508('0xea')]);if(fs[_0x9508('0xeb')](_0x597409)){fs[_0x9508('0xec')](_0x597409)[_0x9508('0xed')](fs['createWriteStream'](path['join'](_0x110a16,_0x4bf265['Attachment'][_0x9508('0xea')])));}}return{'date':moment(_0x4bf265[_0x9508('0xd7')])[_0x9508('0xc0')](_0x9508('0xc1'))['toString'](),'sender':_0x4bf265[_0x9508('0xee')]==='out'?_0x4bf265['User']?_0x4bf265[_0x9508('0x6f')]['fullname']:'System':_0x4bf265[_0x9508('0x63')][_0x9508('0xd2')]+(_0x4bf265['Contact'][_0x9508('0xd3')]?'\x20'+_0x4bf265[_0x9508('0x63')][_0x9508('0xd3')]:''),'body':_0x4bf265['Attachment']?_0x4bf265['Attachment'][_0x9508('0xea')]:_0x4bf265[_0x9508('0xb9')],'direction':_0x4bf265['direction']===_0x9508('0xef')?'A':'C','secret':_0x4bf265[_0x9508('0xd8')],'read':_0x4bf265[_0x9508('0x7e')],'attachment':_0x4bf265[_0x9508('0xd5')]};})[_0x9508('0x66')]()};return ejs[_0x9508('0xf0')](path['join'](config[_0x9508('0xcc')],_0x9508('0xcf'),_0x9508('0xf1'),_0x9508('0xf2')),{'interaction':_0x7e292a})[_0x9508('0x27')](function(_0x11619c){return new BPromise(function(_0x25263e,_0x190dce){pdf[_0x9508('0xb8')](_0x11619c,_0x692f2c)[_0x9508('0xf3')](path[_0x9508('0xcb')](_0x110a16,_0x9508('0xf4')+_0x4d4491['id']+'-'+_0x499b3e+_0x9508('0xf5')),function(_0x5769f3,_0x587509){if(_0x5769f3)return _0x190dce(_0x5769f3);_0x25263e(_0x587509);});});})['then'](function(){return new BPromise(function(_0x1181e3,_0x2ff025){zipdir(_0x110a16,{'saveTo':_0x1670bf},function(_0x3da9b2,_0x594106){if(_0x3da9b2)return _0x2ff025(_0x3da9b2);return _0x1181e3(_0x594106);});})[_0x9508('0x27')](function(){return new BPromise(function(_0x45d7aa,_0x4ff48d){rimraf(_0x110a16,function(_0x23e89b){if(_0x23e89b)_0x4ff48d(_0x23e89b);return _0x45d7aa();});});})['then'](function(){return _0x680a78['download'](_0x1670bf,_0xb6002c,function(_0x14a102){if(_0x14a102){console['log']('err',_0x14a102);}else{fs['unlinkSync'](_0x1670bf);}});});});}else{return _0x680a78[_0x9508('0x1d')](0xc8);}})[_0x9508('0x34')](handleError(_0x680a78,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 5b3a09d..516c24f 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 _0x579e=['setDataValue','map','findAll','unreadMessages','emit','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','then'];(function(_0x250010,_0x489f87){var _0x2448f2=function(_0x56f2b2){while(--_0x56f2b2){_0x250010['push'](_0x250010['shift']());}};_0x2448f2(++_0x489f87);}(_0x579e,0x114));var _0xe579=function(_0x526763,_0x3d3cdd){_0x526763=_0x526763-0x0;var _0x535351=_0x579e[_0x526763];return _0x535351;};'use strict';var EventEmitter=require(_0xe579('0x0'));var OpenchannelInteraction=require(_0xe579('0x1'))['db'][_0xe579('0x2')];var OpenchannelMessage=require(_0xe579('0x1'))['db'][_0xe579('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xe579('0x4')](0x0);var events={'afterCreate':_0xe579('0x5'),'afterUpdate':_0xe579('0x6'),'afterDestroy':_0xe579('0x7')};function emitEvent(_0x4a2279){return function(_0x46e171,_0x2d76e3,_0x4fe629){_0x46e171['getUsers']({'attributes':['id'],'raw':!![]})[_0xe579('0x8')](function(_0x258da1){_0x46e171[_0xe579('0x9')]('Users',_0x258da1[_0xe579('0xa')](function(_0x5023b9){return{'id':_0x5023b9['id']};}));return OpenchannelMessage[_0xe579('0xb')]({'where':{'OpenchannelInteractionId':_0x46e171['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2bf610){_0x46e171['setDataValue'](_0xe579('0xc'),_0x2bf610['length']);OpenchannelInteractionEvents['emit'](_0x4a2279+':'+_0x46e171['id'],_0x46e171);OpenchannelInteractionEvents[_0xe579('0xd')](_0x4a2279,_0x46e171);_0x4fe629(null);})['catch'](_0x4fe629(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xe579('0xe')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0x810b=['hasOwnProperty','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','getUsers','then','setDataValue','map','findAll','length','emit','catch'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x810b,0x135));var _0xb810=function(_0x8088b2,_0x550b25){_0x8088b2=_0x8088b2-0x0;var _0x2ad023=_0x810b[_0x8088b2];return _0x2ad023;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xb810('0x0'))['db'][_0xb810('0x1')];var OpenchannelMessage=require(_0xb810('0x0'))['db'][_0xb810('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xb810('0x3')](0x0);var events={'afterCreate':_0xb810('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x36837f){return function(_0x2e66f7,_0x5ac984,_0x1dd8c5){_0x2e66f7[_0xb810('0x5')]({'attributes':['id'],'raw':!![]})[_0xb810('0x6')](function(_0x39af06){_0x2e66f7[_0xb810('0x7')]('Users',_0x39af06[_0xb810('0x8')](function(_0x5c0353){return{'id':_0x5c0353['id']};}));return OpenchannelMessage[_0xb810('0x9')]({'where':{'OpenchannelInteractionId':_0x2e66f7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb810('0x6')](function(_0x5bdbd3){_0x2e66f7[_0xb810('0x7')]('unreadMessages',_0x5bdbd3[_0xb810('0xa')]);OpenchannelInteractionEvents[_0xb810('0xb')](_0x36837f+':'+_0x2e66f7['id'],_0x2e66f7);OpenchannelInteractionEvents[_0xb810('0xb')](_0x36837f,_0x2e66f7);_0x1dd8c5(null);})[_0xb810('0xc')](_0x1dd8c5(null));};}for(var e in events){if(events[_0xb810('0xd')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 9636d32..6b97284 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 _0xe015=['changed','closed','format','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./openchannelInteraction.attributes','openchannel_interactions'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0xe015,0x13b));var _0x5e01=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe015[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var logger=require(_0x5e01('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5e01('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e01('0x4'));var rimraf=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var attributes=require(_0x5e01('0x7'));module['exports']=function(_0x1814cb,_0x3d2da2){return _0x1814cb['define']('OpenchannelInteraction',attributes,{'tableName':_0x5e01('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3aeaef,_0x1420c2,_0x40d31f){if(_0x3aeaef[_0x5e01('0x9')](_0x5e01('0xa'))){_0x3aeaef['closedAt']=moment()[_0x5e01('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x40d31f(null,_0x3aeaef);}}});}; \ No newline at end of file +var _0x6334=['rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x399643,_0x4f5559){var _0x28ef6c=function(_0x3e3fa9){while(--_0x3e3fa9){_0x399643['push'](_0x399643['shift']());}};_0x28ef6c(++_0x4f5559);}(_0x6334,0x119));var _0x4633=function(_0x1fc82b,_0x5150a6){_0x1fc82b=_0x1fc82b-0x0;var _0x4c6679=_0x6334[_0x1fc82b];return _0x4c6679;};'use strict';var _=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var logger=require(_0x4633('0x2'))(_0x4633('0x3'));var moment=require(_0x4633('0x4'));var BPromise=require(_0x4633('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4633('0x6'));var rimraf=require(_0x4633('0x7'));var config=require(_0x4633('0x8'));var attributes=require(_0x4633('0x9'));module[_0x4633('0xa')]=function(_0x6493dc,_0x175e14){return _0x6493dc['define'](_0x4633('0xb'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x21af74,_0x148e72,_0x4ec5b1){if(_0x21af74[_0x4633('0xc')](_0x4633('0xd'))){_0x21af74[_0x4633('0xe')]=moment()['format'](_0x4633('0xf'));}_0x4ec5b1(null,_0x21af74);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 4adfbc0..d4d97aa 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 _0x3b3a=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./openchannelInteraction.socket','request','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','OpenchannelInteraction,\x20%s,\x20%s','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','limit','then','AddTagsToOpenchannelInteraction','find','ids','omit','spread','AddTags'];(function(_0x5a6b9b,_0x3d6b3f){var _0x3e71fd=function(_0x31b025){while(--_0x31b025){_0x5a6b9b['push'](_0x5a6b9b['shift']());}};_0x3e71fd(++_0x3d6b3f);}(_0x3b3a,0x190));var _0xa3b3=function(_0x1be0fd,_0xc90ad1){_0x1be0fd=_0x1be0fd-0x0;var _0x5a4e57=_0x3b3a[_0x1be0fd];return _0x5a4e57;};'use strict';var _=require('lodash');var util=require(_0xa3b3('0x0'));var moment=require(_0xa3b3('0x1'));var BPromise=require(_0xa3b3('0x2'));var rs=require(_0xa3b3('0x3'));var fs=require('fs');var Redis=require(_0xa3b3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa3b3('0x5'));var logger=require(_0xa3b3('0x6'))(_0xa3b3('0x7'));var config=require(_0xa3b3('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa3b3('0x9')][_0xa3b3('0xa')]({'port':0x232a});config[_0xa3b3('0xb')]=_[_0xa3b3('0xc')](config[_0xa3b3('0xb')],{'host':_0xa3b3('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa3b3('0xb')]));require(_0xa3b3('0xe'))['register'](socket);function respondWithRpcPromise(_0x8bc38e,_0x2fdc9f,_0x2307cc){return new BPromise(function(_0x56c282,_0xf9a160){return client[_0xa3b3('0xf')](_0x8bc38e,_0x2307cc)['then'](function(_0x4eb8a9){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x2fdc9f,_0xa3b3('0x10'));logger[_0xa3b3('0x11')](_0xa3b3('0x12'),_0x2fdc9f,_0xa3b3('0x10'),JSON[_0xa3b3('0x13')](_0x4eb8a9));if(_0x4eb8a9[_0xa3b3('0x14')]){if(_0x4eb8a9['error']['code']===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x2fdc9f,_0x4eb8a9[_0xa3b3('0x14')][_0xa3b3('0x15')]);return _0xf9a160(_0x4eb8a9['error'][_0xa3b3('0x15')]);}logger[_0xa3b3('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2fdc9f,_0x4eb8a9['error'][_0xa3b3('0x15')]);return _0x56c282(_0x4eb8a9['error'][_0xa3b3('0x15')]);}else{logger[_0xa3b3('0x16')](_0xa3b3('0x17'),_0x2fdc9f,_0xa3b3('0x10'));_0x56c282(_0x4eb8a9[_0xa3b3('0x18')][_0xa3b3('0x15')]);}})[_0xa3b3('0x19')](function(_0x55c2e8){logger[_0xa3b3('0x14')](_0xa3b3('0x17'),_0x2fdc9f,_0x55c2e8);_0xf9a160(_0x55c2e8);});});}exports[_0xa3b3('0x1a')]=function(_0x41dbbf){var _0xbc7827=this;return new Promise(function(_0x5c23d4,_0x1e8173){return db[_0xa3b3('0x1b')][_0xa3b3('0x1c')](_0x41dbbf[_0xa3b3('0x1d')],{'raw':_0x41dbbf['options']?_0x41dbbf[_0xa3b3('0x1e')][_0xa3b3('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41dbbf[_0xa3b3('0x1e')]?_0x41dbbf['options']['where']||null:null,'attributes':_0x41dbbf[_0xa3b3('0x1e')]?_0x41dbbf[_0xa3b3('0x1e')]['attributes']||null:null,'limit':_0x41dbbf[_0xa3b3('0x1e')]?_0x41dbbf[_0xa3b3('0x1e')][_0xa3b3('0x20')]||null:null})[_0xa3b3('0x21')](function(_0x15ffa1){logger[_0xa3b3('0x16')](_0xa3b3('0x1a'),_0x41dbbf);logger[_0xa3b3('0x11')](_0xa3b3('0x1a'),_0x41dbbf,JSON[_0xa3b3('0x13')](_0x15ffa1));_0x5c23d4(_0x15ffa1);})[_0xa3b3('0x19')](function(_0x214252){logger[_0xa3b3('0x14')](_0xa3b3('0x1a'),_0x214252[_0xa3b3('0x15')],_0x41dbbf);_0x1e8173(_0xbc7827['error'](0x1f4,_0x214252['message']));});});};exports[_0xa3b3('0x22')]=function(_0x1b15fa){return new Promise(function(_0x190e72,_0x31b6bb){return db[_0xa3b3('0x1b')][_0xa3b3('0x23')]({'where':_0x1b15fa[_0xa3b3('0x1e')]?_0x1b15fa[_0xa3b3('0x1e')]['where']||null:null})['then'](function(_0x3bfb65){if(_0x3bfb65){return _0x3bfb65['addTags'](_0x1b15fa['body'][_0xa3b3('0x24')],_[_0xa3b3('0x25')](_0x1b15fa[_0xa3b3('0x1d')],[_0xa3b3('0x24'),'id'])||{});}})[_0xa3b3('0x26')](function(_0x43a17f){logger[_0xa3b3('0x16')](_0xa3b3('0x27'),_0x1b15fa);logger[_0xa3b3('0x11')](_0xa3b3('0x27'),_0x1b15fa,JSON[_0xa3b3('0x13')](_0x43a17f));_0x190e72(_0x43a17f);})[_0xa3b3('0x19')](function(_0x5501c1){logger['error']('AddTags',_0x5501c1[_0xa3b3('0x15')],_0x1b15fa);_0x31b6bb(_this[_0xa3b3('0x14')](0x1f4,_0x5501c1[_0xa3b3('0x15')]));});});}; \ No newline at end of file +var _0x848a=['error','message','catch','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','OpenchannelInteraction','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','localhost','redis','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x47478e,_0x31faac){var _0x42dff6=function(_0x22d79e){while(--_0x22d79e){_0x47478e['push'](_0x47478e['shift']());}};_0x42dff6(++_0x31faac);}(_0x848a,0x16f));var _0xa848=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x848a[_0x2f1762];return _0x8ab21;};'use strict';var _=require(_0xa848('0x0'));var util=require(_0xa848('0x1'));var moment=require('moment');var BPromise=require(_0xa848('0x2'));var rs=require(_0xa848('0x3'));var fs=require('fs');var Redis=require(_0xa848('0x4'));var db=require(_0xa848('0x5'))['db'];var utils=require(_0xa848('0x6'));var logger=require(_0xa848('0x7'))('rpc');var config=require(_0xa848('0x8'));var jayson=require(_0xa848('0x9'));var client=jayson[_0xa848('0xa')][_0xa848('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xa848('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa848('0xd')]));require('./openchannelInteraction.socket')[_0xa848('0xe')](socket);function respondWithRpcPromise(_0x3ef3f2,_0x429a7c,_0x2a4503){return new BPromise(function(_0x4d6f6b,_0x3b5ef3){return client[_0xa848('0xf')](_0x3ef3f2,_0x2a4503)[_0xa848('0x10')](function(_0x53b34a){logger[_0xa848('0x11')](_0xa848('0x12'),_0x429a7c,_0xa848('0x13'));logger[_0xa848('0x14')](_0xa848('0x15'),_0x429a7c,'request\x20sent',JSON[_0xa848('0x16')](_0x53b34a));if(_0x53b34a[_0xa848('0x17')]){if(_0x53b34a[_0xa848('0x17')]['code']===0x1f4){logger[_0xa848('0x17')](_0xa848('0x12'),_0x429a7c,_0x53b34a[_0xa848('0x17')][_0xa848('0x18')]);return _0x3b5ef3(_0x53b34a[_0xa848('0x17')]['message']);}logger[_0xa848('0x17')](_0xa848('0x12'),_0x429a7c,_0x53b34a['error'][_0xa848('0x18')]);return _0x4d6f6b(_0x53b34a[_0xa848('0x17')][_0xa848('0x18')]);}else{logger[_0xa848('0x11')](_0xa848('0x12'),_0x429a7c,_0xa848('0x13'));_0x4d6f6b(_0x53b34a['result'][_0xa848('0x18')]);}})[_0xa848('0x19')](function(_0x2e08f2){logger[_0xa848('0x17')](_0xa848('0x12'),_0x429a7c,_0x2e08f2);_0x3b5ef3(_0x2e08f2);});});}exports[_0xa848('0x1a')]=function(_0x3aaf17){var _0x498804=this;return new Promise(function(_0x59fd54,_0x5b9801){return db['OpenchannelInteraction'][_0xa848('0x1b')](_0x3aaf17[_0xa848('0x1c')],{'raw':_0x3aaf17[_0xa848('0x1d')]?_0x3aaf17['options'][_0xa848('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3aaf17['options']?_0x3aaf17[_0xa848('0x1d')][_0xa848('0x1f')]||null:null,'attributes':_0x3aaf17[_0xa848('0x1d')]?_0x3aaf17[_0xa848('0x1d')][_0xa848('0x20')]||null:null,'limit':_0x3aaf17[_0xa848('0x1d')]?_0x3aaf17['options'][_0xa848('0x21')]||null:null})[_0xa848('0x10')](function(_0x34af86){logger[_0xa848('0x11')](_0xa848('0x1a'),_0x3aaf17);logger[_0xa848('0x14')](_0xa848('0x1a'),_0x3aaf17,JSON['stringify'](_0x34af86));_0x59fd54(_0x34af86);})['catch'](function(_0x5742ec){logger[_0xa848('0x17')](_0xa848('0x1a'),_0x5742ec['message'],_0x3aaf17);_0x5b9801(_0x498804[_0xa848('0x17')](0x1f4,_0x5742ec[_0xa848('0x18')]));});});};exports[_0xa848('0x22')]=function(_0x2618c3){return new Promise(function(_0x79b58e,_0x12b402){return db[_0xa848('0x23')]['find']({'where':_0x2618c3['options']?_0x2618c3[_0xa848('0x1d')][_0xa848('0x1f')]||null:null})[_0xa848('0x10')](function(_0x10e6f2){if(_0x10e6f2){return _0x10e6f2['addTags'](_0x2618c3['body'][_0xa848('0x24')],_['omit'](_0x2618c3[_0xa848('0x1c')],['ids','id'])||{});}})[_0xa848('0x25')](function(_0x21d94f){logger[_0xa848('0x11')](_0xa848('0x26'),_0x2618c3);logger[_0xa848('0x14')](_0xa848('0x26'),_0x2618c3,JSON['stringify'](_0x21d94f));_0x79b58e(_0x21d94f);})[_0xa848('0x19')](function(_0x5c2c69){logger['error'](_0xa848('0x26'),_0x5c2c69['message'],_0x2618c3);_0x12b402(_this[_0xa848('0x17')](0x1f4,_0x5c2c69[_0xa848('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 562c400..85419d0 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 _0x43db=['register','length','emit','removeListener'];(function(_0x2aa699,_0x376685){var _0x198f6b=function(_0x2f4150){while(--_0x2f4150){_0x2aa699['push'](_0x2aa699['shift']());}};_0x198f6b(++_0x376685);}(_0x43db,0x126));var _0xb43d=function(_0x44ea1b,_0x36bbd3){_0x44ea1b=_0x44ea1b-0x0;var _0x239690=_0x43db[_0x44ea1b];return _0x239690;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=['save','remove','update'];function createListener(_0x9bc814,_0x574ea8){return function(_0x202f97){_0x574ea8[_0xb43d('0x0')](_0x9bc814,_0x202f97);};}function removeListener(_0x2a82e7,_0x176559){return function(){OpenchannelInteractionEvents[_0xb43d('0x1')](_0x2a82e7,_0x176559);};}exports[_0xb43d('0x2')]=function(_0x1961a8){for(var _0x40cebe=0x0,_0x4c35b2=events[_0xb43d('0x3')];_0x40cebe<_0x4c35b2;_0x40cebe++){var _0x11102f=events[_0x40cebe];var _0xadc336=createListener('openchannelInteraction:'+_0x11102f,_0x1961a8);OpenchannelInteractionEvents['on'](_0x11102f,_0xadc336);}}; \ No newline at end of file +var _0xa9a5=['./openchannelInteraction.events','save','emit','register','length'];(function(_0x3c3698,_0xa0bf08){var _0x4e6637=function(_0x1fc9a4){while(--_0x1fc9a4){_0x3c3698['push'](_0x3c3698['shift']());}};_0x4e6637(++_0xa0bf08);}(_0xa9a5,0x113));var _0x5a9a=function(_0x46cd2e,_0x1572d3){_0x46cd2e=_0x46cd2e-0x0;var _0x3d3cbb=_0xa9a5[_0x46cd2e];return _0x3d3cbb;};'use strict';var OpenchannelInteractionEvents=require(_0x5a9a('0x0'));var events=[_0x5a9a('0x1'),'remove','update'];function createListener(_0x3012ea,_0x3526d4){return function(_0x470372){_0x3526d4[_0x5a9a('0x2')](_0x3012ea,_0x470372);};}function removeListener(_0x20dce0,_0x10aac8){return function(){OpenchannelInteractionEvents['removeListener'](_0x20dce0,_0x10aac8);};}exports[_0x5a9a('0x3')]=function(_0x15bc7c){for(var _0x3322d2=0x0,_0x215bab=events[_0x5a9a('0x4')];_0x3322d2<_0x215bab;_0x3322d2++){var _0x13fe7f=events[_0x3322d2];var _0x1ae028=createListener('openchannelInteraction:'+_0x13fe7f,_0x15bc7c);OpenchannelInteractionEvents['on'](_0x13fe7f,_0x1ae028);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 9e515fe..87093b4 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 _0x241c=['express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','describe','show','post','tracked','openchannelmessage:create','create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x30ea0d,_0x17aa56){var _0x55699e=function(_0x52a83f){while(--_0x52a83f){_0x30ea0d['push'](_0x30ea0d['shift']());}};_0x55699e(++_0x17aa56);}(_0x241c,0x1c7));var _0xc241=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x241c[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xc241('0x0'));var util=require(_0xc241('0x1'));var path=require(_0xc241('0x2'));var timeout=require(_0xc241('0x3'));var express=require(_0xc241('0x4'));var router=express[_0xc241('0x5')]();var auth=require(_0xc241('0x6'));var interaction=require(_0xc241('0x7'));var config=require('../../config/environment');var controller=require(_0xc241('0x8'));router[_0xc241('0x9')]('/',auth[_0xc241('0xa')](),controller['index']);router[_0xc241('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xc241('0xb')]);router[_0xc241('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc241('0xc')]);router[_0xc241('0xd')]('/',auth[_0xc241('0xa')](),interaction[_0xc241('0xe')]('openchannel',_0xc241('0xf')),controller[_0xc241('0x10')]);router[_0xc241('0x11')](_0xc241('0x12'),auth[_0xc241('0xa')](),controller[_0xc241('0x13')]);router[_0xc241('0x11')](_0xc241('0x14'),auth[_0xc241('0xa')](),controller[_0xc241('0x15')]);router[_0xc241('0x11')](_0xc241('0x16'),auth[_0xc241('0xa')](),controller[_0xc241('0x17')]);router[_0xc241('0x18')](_0xc241('0x12'),auth[_0xc241('0xa')](),controller[_0xc241('0x19')]);module[_0xc241('0x1a')]=router; \ No newline at end of file +var _0x515e=['Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','show','post','tracked','openchannelmessage:create','create','put','/:id','update','/:id/accept','/:id/reject','reject','exports','multer','util','path','express'];(function(_0x324e86,_0x81b1cb){var _0x592846=function(_0x33439c){while(--_0x33439c){_0x324e86['push'](_0x324e86['shift']());}};_0x592846(++_0x81b1cb);}(_0x515e,0x19a));var _0xe515=function(_0x5f4d59,_0x554969){_0x5f4d59=_0x5f4d59-0x0;var _0x4d5dea=_0x515e[_0x5f4d59];return _0x4d5dea;};'use strict';var multer=require(_0xe515('0x0'));var util=require(_0xe515('0x1'));var path=require(_0xe515('0x2'));var timeout=require('connect-timeout');var express=require(_0xe515('0x3'));var router=express[_0xe515('0x4')]();var auth=require(_0xe515('0x5'));var interaction=require(_0xe515('0x6'));var config=require('../../config/environment');var controller=require('./openchannelMessage.controller');router[_0xe515('0x7')]('/',auth[_0xe515('0x8')](),controller[_0xe515('0x9')]);router[_0xe515('0x7')](_0xe515('0xa'),auth[_0xe515('0x8')](),controller['describe']);router['get']('/:id',auth[_0xe515('0x8')](),controller[_0xe515('0xb')]);router[_0xe515('0xc')]('/',auth[_0xe515('0x8')](),interaction[_0xe515('0xd')]('openchannel',_0xe515('0xe')),controller[_0xe515('0xf')]);router[_0xe515('0x10')](_0xe515('0x11'),auth[_0xe515('0x8')](),controller[_0xe515('0x12')]);router['put'](_0xe515('0x13'),auth[_0xe515('0x8')](),controller['accept']);router['put'](_0xe515('0x14'),auth[_0xe515('0x8')](),controller[_0xe515('0x15')]);router['delete']('/:id',auth[_0xe515('0x8')](),controller['destroy']);module[_0xe515('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index cc82a5a..b76ec02 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 _0xa938=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x2835b8,_0x2038aa){var _0x4111d0=function(_0x56ae66){while(--_0x56ae66){_0x2835b8['push'](_0x2835b8['shift']());}};_0x4111d0(++_0x2038aa);}(_0xa938,0x92));var _0x8a93=function(_0x2e39ff,_0x34e9ca){_0x2e39ff=_0x2e39ff-0x0;var _0x253f7b=_0xa938[_0x2e39ff];return _0x253f7b;};'use strict';var Sequelize=require(_0x8a93('0x0'));module[_0x8a93('0x1')]={'body':{'type':Sequelize[_0x8a93('0x2')](_0x8a93('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x8a93('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x8a93('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8a93('0x5')]('in','out'),'defaultValue':_0x8a93('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x8a93('0x7')]},'providerResponse':{'type':Sequelize[_0x8a93('0x2')]}}; \ No newline at end of file +var _0x1bf9=['DATE','STRING','exports','TEXT','medium','BOOLEAN','out'];(function(_0x48b83c,_0x39a186){var _0x5bbdf0=function(_0xf08217){while(--_0xf08217){_0x48b83c['push'](_0x48b83c['shift']());}};_0x5bbdf0(++_0x39a186);}(_0x1bf9,0x95));var _0x91bf=function(_0x3ce572,_0x4ea237){_0x3ce572=_0x3ce572-0x0;var _0x27c1e8=_0x1bf9[_0x3ce572];return _0x27c1e8;};'use strict';var Sequelize=require('sequelize');module[_0x91bf('0x0')]={'body':{'type':Sequelize[_0x91bf('0x1')](_0x91bf('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x91bf('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x91bf('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x91bf('0x5')]},'providerName':{'type':Sequelize[_0x91bf('0x6')]},'providerResponse':{'type':Sequelize[_0x91bf('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index d07816b..4fe8de6 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 _0x4daa=['accept','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','interface','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./openchannelMessage.socket','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','destroy','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','merge','where','options','includeAll','include','findAll','rows','show','find','create','update','body','params','describe','openchannel-interactions','openchannel','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','format','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','AcceptMessage','manual','SIP/%s','channel','event'];(function(_0x2c3775,_0x145f1b){var _0x2d78ff=function(_0x129318){while(--_0x129318){_0x2c3775['push'](_0x2c3775['shift']());}};_0x2d78ff(++_0x145f1b);}(_0x4daa,0x7d));var _0xa4da=function(_0x1811e0,_0x487da0){_0x1811e0=_0x1811e0-0x0;var _0x3ce439=_0x4daa[_0x1811e0];return _0x3ce439;};'use strict';var pdf=require(_0xa4da('0x0'));var emlformat=require(_0xa4da('0x1'));var rimraf=require(_0xa4da('0x2'));var zipdir=require(_0xa4da('0x3'));var jsonpatch=require(_0xa4da('0x4'));var rp=require(_0xa4da('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa4da('0x6'));var util=require(_0xa4da('0x7'));var path=require(_0xa4da('0x8'));var sox=require(_0xa4da('0x9'));var csv=require(_0xa4da('0xa'));var ejs=require(_0xa4da('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa4da('0xc'));var jsforce=require(_0xa4da('0xd'));var deskjs=require(_0xa4da('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa4da('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa4da('0x10'));var qs=require(_0xa4da('0x11'));var as=require(_0xa4da('0x12'));var hardwareService=require(_0xa4da('0x13'));var logger=require(_0xa4da('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xa4da('0x15'));var licenseUtil=require(_0xa4da('0x16'));var db=require(_0xa4da('0x17'))['db'];config['redis']=_[_0xa4da('0x18')](config[_0xa4da('0x19')],{'host':_0xa4da('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa4da('0x19')]));require(_0xa4da('0x1b'))['register'](socket);var jayson=require(_0xa4da('0x1c'));var client=jayson[_0xa4da('0x1d')][_0xa4da('0x1e')]({'port':0x232c});var client9002=jayson[_0xa4da('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19363a,_0x33e910,_0x364b2d,_0x272f05){return new BPromise(function(_0x5132e8,_0x105640){var _0x589713=_0x272f05||client;return _0x589713[_0xa4da('0x1f')](_0x19363a,_0x364b2d)[_0xa4da('0x20')](function(_0x5b9e09){logger[_0xa4da('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x33e910,'request\x20sent');logger[_0xa4da('0x22')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x33e910,_0xa4da('0x23'),JSON['stringify'](_0x5b9e09));if(_0x5b9e09['error']){if(_0x5b9e09[_0xa4da('0x24')][_0xa4da('0x25')]===0x1f4){logger['error'](_0xa4da('0x26'),_0x33e910,_0x5b9e09[_0xa4da('0x24')][_0xa4da('0x27')]);return _0x105640(_0x5b9e09['error'][_0xa4da('0x27')]);}logger[_0xa4da('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x33e910,_0x5b9e09[_0xa4da('0x24')][_0xa4da('0x27')]);return _0x5132e8(_0x5b9e09[_0xa4da('0x24')][_0xa4da('0x27')]);}else{logger[_0xa4da('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x33e910,'request\x20sent');_0x5132e8(_0x5b9e09[_0xa4da('0x28')][_0xa4da('0x27')]);}})[_0xa4da('0x29')](function(_0x3c3d9a){logger[_0xa4da('0x24')](_0xa4da('0x26'),_0x33e910,_0x3c3d9a);_0x105640(_0x3c3d9a);});});}function respondWithStatusCode(_0x1db40c,_0x5a4de7){_0x5a4de7=_0x5a4de7||0xcc;return function(_0x14033b){if(_0x14033b){return _0x1db40c[_0xa4da('0x2a')](_0x5a4de7);}return _0x1db40c[_0xa4da('0x2b')](_0x5a4de7)[_0xa4da('0x2c')]();};}function respondWithResult(_0x53e401,_0x4cfb9e){_0x4cfb9e=_0x4cfb9e||0xc8;return function(_0x2ba5a2){if(_0x2ba5a2){return _0x53e401[_0xa4da('0x2b')](_0x4cfb9e)[_0xa4da('0x2d')](_0x2ba5a2);}};}function respondWithFilteredResult(_0x41f9e9,_0x3c571d){return function(_0x585f86){if(_0x585f86){var _0x2f14d1=_0x585f86[_0xa4da('0x2e')],_0x36fe74=_0x3c571d[_0xa4da('0x2f')],_0x7bbb56=_0x3c571d[_0xa4da('0x2f')]+_0x3c571d[_0xa4da('0x30')],_0x5bad55;if(_0x7bbb56>=_0x2f14d1){_0x7bbb56=_0x2f14d1;_0x5bad55=0xc8;}else{_0x5bad55=0xce;}_0x41f9e9[_0xa4da('0x2b')](_0x5bad55);return _0x41f9e9['set'](_0xa4da('0x31'),_0x36fe74+'-'+_0x7bbb56+'/'+_0x2f14d1)['json'](_0x585f86);}return null;};}function patchUpdates(_0xc54441){return function(_0x42d6bd){try{jsonpatch['apply'](_0x42d6bd,_0xc54441,!![]);}catch(_0x2e1a36){return BPromise[_0xa4da('0x32')](_0x2e1a36);}return _0x42d6bd['save']();};}function saveUpdates(_0x15be41,_0xbc9d77){return function(_0x32c277){if(_0x32c277){return _0x32c277['update'](_0x15be41)[_0xa4da('0x20')](function(_0x325f33){return _0x325f33;});}return null;};}function removeEntity(_0x5b6d6c,_0xaa8ede){return function(_0x45c733){if(_0x45c733){return _0x45c733[_0xa4da('0x33')]()['then'](function(){_0x5b6d6c[_0xa4da('0x2b')](0xcc)[_0xa4da('0x2c')]();});}};}function handleEntityNotFound(_0xf31475,_0x280ba8){return function(_0x515e57){if(!_0x515e57){_0xf31475[_0xa4da('0x2a')](0x194);}return _0x515e57;};}function handleError(_0x4df4fc,_0x3aa1aa){_0x3aa1aa=_0x3aa1aa||0x1f4;return function(_0x214647){logger[_0xa4da('0x24')](_0x214647['stack']);if(_0x214647[_0xa4da('0x34')]){delete _0x214647[_0xa4da('0x34')];}_0x4df4fc[_0xa4da('0x2b')](_0x3aa1aa)[_0xa4da('0x35')](_0x214647);};}exports['index']=function(_0x222dff,_0x245664){var _0x12b6a2={},_0x42a204={},_0x290062={'count':0x0,'rows':[]};var _0x5bb764=_[_0xa4da('0x36')](db[_0xa4da('0x37')][_0xa4da('0x38')],function(_0x5d61fc){return{'name':_0x5d61fc[_0xa4da('0x39')],'type':_0x5d61fc[_0xa4da('0x3a')][_0xa4da('0x3b')]};});_0x42a204[_0xa4da('0x3c')]=_['map'](_0x5bb764,_0xa4da('0x34'));_0x42a204[_0xa4da('0x3d')]=_[_0xa4da('0x3e')](_0x222dff['query']);_0x42a204[_0xa4da('0x3f')]=_[_0xa4da('0x40')](_0x42a204[_0xa4da('0x3c')],_0x42a204[_0xa4da('0x3d')]);_0x12b6a2[_0xa4da('0x41')]=_[_0xa4da('0x40')](_0x42a204[_0xa4da('0x3c')],qs[_0xa4da('0x42')](_0x222dff['query']['fields']));_0x12b6a2[_0xa4da('0x41')]=_0x12b6a2[_0xa4da('0x41')][_0xa4da('0x43')]?_0x12b6a2[_0xa4da('0x41')]:_0x42a204[_0xa4da('0x3c')];if(!_0x222dff['query'][_0xa4da('0x44')]('nolimit')){_0x12b6a2[_0xa4da('0x30')]=qs['limit'](_0x222dff[_0xa4da('0x3d')][_0xa4da('0x30')]);_0x12b6a2[_0xa4da('0x2f')]=qs['offset'](_0x222dff[_0xa4da('0x3d')][_0xa4da('0x2f')]);}_0x12b6a2[_0xa4da('0x45')]=qs[_0xa4da('0x46')](_0x222dff[_0xa4da('0x3d')][_0xa4da('0x46')]);_0x12b6a2['where']=qs[_0xa4da('0x3f')](_[_0xa4da('0x47')](_0x222dff[_0xa4da('0x3d')],_0x42a204['filters']),_0x5bb764);if(_0x222dff[_0xa4da('0x3d')][_0xa4da('0x48')]){_0x12b6a2['where']=_[_0xa4da('0x49')](_0x12b6a2[_0xa4da('0x4a')],{'$or':_[_0xa4da('0x36')](_0x5bb764,function(_0x4b4d22){if(_0x4b4d22[_0xa4da('0x3a')]!=='VIRTUAL'){var _0x55b6fb={};_0x55b6fb[_0x4b4d22['name']]={'$like':'%'+_0x222dff['query']['filter']+'%'};return _0x55b6fb;}})});}_0x12b6a2=_[_0xa4da('0x49')]({},_0x12b6a2,_0x222dff[_0xa4da('0x4b')]);var _0x2ad107={'where':_0x12b6a2[_0xa4da('0x4a')]};return db[_0xa4da('0x37')]['count'](_0x2ad107)['then'](function(_0x921b06){_0x290062[_0xa4da('0x2e')]=_0x921b06;if(_0x222dff[_0xa4da('0x3d')][_0xa4da('0x4c')]){_0x12b6a2[_0xa4da('0x4d')]=[{'all':!![]}];}return db[_0xa4da('0x37')][_0xa4da('0x4e')](_0x12b6a2);})[_0xa4da('0x20')](function(_0x2693f6){_0x290062[_0xa4da('0x4f')]=_0x2693f6;return _0x290062;})['then'](respondWithFilteredResult(_0x245664,_0x12b6a2))['catch'](handleError(_0x245664,null));};exports[_0xa4da('0x50')]=function(_0x3711b7,_0x2abdd7){var _0x57917e={'raw':!![],'where':{'id':_0x3711b7['params']['id']}},_0x5cb81b={};_0x5cb81b['model']=_[_0xa4da('0x3e')](db[_0xa4da('0x37')][_0xa4da('0x38')]);_0x5cb81b[_0xa4da('0x3d')]=_[_0xa4da('0x3e')](_0x3711b7['query']);_0x5cb81b[_0xa4da('0x3f')]=_[_0xa4da('0x40')](_0x5cb81b[_0xa4da('0x3c')],_0x5cb81b[_0xa4da('0x3d')]);_0x57917e['attributes']=_[_0xa4da('0x40')](_0x5cb81b[_0xa4da('0x3c')],qs[_0xa4da('0x42')](_0x3711b7['query'][_0xa4da('0x42')]));_0x57917e[_0xa4da('0x41')]=_0x57917e[_0xa4da('0x41')][_0xa4da('0x43')]?_0x57917e[_0xa4da('0x41')]:_0x5cb81b['model'];if(_0x3711b7[_0xa4da('0x3d')]['includeAll']){_0x57917e[_0xa4da('0x4d')]=[{'all':!![]}];}_0x57917e=_[_0xa4da('0x49')]({},_0x57917e,_0x3711b7[_0xa4da('0x4b')]);return db[_0xa4da('0x37')][_0xa4da('0x51')](_0x57917e)[_0xa4da('0x20')](handleEntityNotFound(_0x2abdd7,null))[_0xa4da('0x20')](respondWithResult(_0x2abdd7,null))[_0xa4da('0x29')](handleError(_0x2abdd7,null));};exports[_0xa4da('0x52')]=function(_0x469ec8,_0x1c2b5a){return db[_0xa4da('0x37')][_0xa4da('0x52')](_0x469ec8['body'],{})[_0xa4da('0x20')](respondWithResult(_0x1c2b5a,0xc9))[_0xa4da('0x29')](handleError(_0x1c2b5a,null));};exports[_0xa4da('0x53')]=function(_0x21a15d,_0x4e0a1e){if(_0x21a15d[_0xa4da('0x54')]['id']){delete _0x21a15d[_0xa4da('0x54')]['id'];}return db[_0xa4da('0x37')][_0xa4da('0x51')]({'where':{'id':_0x21a15d[_0xa4da('0x55')]['id']}})[_0xa4da('0x20')](handleEntityNotFound(_0x4e0a1e,null))[_0xa4da('0x20')](saveUpdates(_0x21a15d[_0xa4da('0x54')],null))['then'](respondWithResult(_0x4e0a1e,null))[_0xa4da('0x29')](handleError(_0x4e0a1e,null));};exports['destroy']=function(_0x146212,_0x1c378c){return db[_0xa4da('0x37')][_0xa4da('0x51')]({'where':{'id':_0x146212[_0xa4da('0x55')]['id']}})[_0xa4da('0x20')](handleEntityNotFound(_0x1c378c,null))[_0xa4da('0x20')](removeEntity(_0x1c378c,null))[_0xa4da('0x29')](handleError(_0x1c378c,null));};exports[_0xa4da('0x56')]=function(_0x4f4fc1,_0x2fa8b1){return db[_0xa4da('0x37')]['describe']()[_0xa4da('0x20')](respondWithResult(_0x2fa8b1,null))['catch'](handleError(_0x2fa8b1,null));};var interaction_log=require('../../config/logger')(_0xa4da('0x57'));exports['accept']=function(_0x311e17,_0x2b77a4,_0x2ae768){var _0x25d39f={'agent':{},'channel':_0xa4da('0x58')};if(_0x311e17[_0xa4da('0x54')]['id']){delete _0x311e17[_0xa4da('0x54')]['id'];}_0x311e17[_0xa4da('0x54')]['read']=!![];_0x311e17[_0xa4da('0x54')][_0xa4da('0x59')]=moment()['format'](_0xa4da('0x5a'));_0x311e17[_0xa4da('0x54')][_0xa4da('0x5b')]=_0x311e17['body'][_0xa4da('0x5b')]||_0x311e17[_0xa4da('0x5c')]['id'];_0x25d39f[_0xa4da('0x5d')]['id']=_0x311e17[_0xa4da('0x54')][_0xa4da('0x5b')];return db[_0xa4da('0x37')][_0xa4da('0x51')]({'where':{'id':_0x311e17[_0xa4da('0x55')]['id'],'UserId':null},'include':[{'model':db[_0xa4da('0x5e')],'as':_0xa4da('0x5f')}]})[_0xa4da('0x20')](handleEntityNotFound(_0x2b77a4,null))[_0xa4da('0x20')](saveUpdates(_0x311e17['body'],null))[_0xa4da('0x20')](function(_0x3d2174){if(_0x3d2174){_0x25d39f[_0xa4da('0x27')]=_0x3d2174[_0xa4da('0x60')]({'plain':!![]});return db[_0xa4da('0x61')][_0xa4da('0x51')]({'where':{'id':_0x3d2174[_0xa4da('0x62')]}});}return null;})[_0xa4da('0x20')](handleEntityNotFound(_0x2b77a4,null))[_0xa4da('0x20')](function(_0x37dd34){if(_0x37dd34){return _0x37dd34[_0xa4da('0x53')]({'UserId':_0x311e17[_0xa4da('0x54')]['UserId'],'read1stAt':_[_0xa4da('0x63')](_0x37dd34[_0xa4da('0x64')])?moment()[_0xa4da('0x65')](_0xa4da('0x5a')):undefined});}return null;})[_0xa4da('0x20')](function(_0x25651f){if(_0x25651f){_0x25d39f[_0xa4da('0x66')]=_0x25651f[_0xa4da('0x60')]({'plain':!![]});interaction_log['info'](_0xa4da('0x67'),_0x311e17[_0xa4da('0x5c')]['id'],_0x311e17[_0xa4da('0x5c')][_0xa4da('0x34')],_0x311e17[_0xa4da('0x5c')]['role'],_0x25d39f[_0xa4da('0x66')]['id'],_0x311e17[_0xa4da('0x54')]?JSON[_0xa4da('0x68')](_0x311e17['body']):_0xa4da('0x69'));return respondWithRpcPromise(_0xa4da('0x6a'),'acceptMessage',_0x25d39f);}return null;})[_0xa4da('0x20')](function(_0x3eab92){if(_0x3eab92){if(_0x311e17['body'][_0xa4da('0x6b')]){_0x25d39f[_0xa4da('0x27')]['interface']=util['format'](_0xa4da('0x6c'),_0x311e17['user'][_0xa4da('0x34')]);_0x25d39f[_0xa4da('0x27')][_0xa4da('0x6d')]=_0x25d39f['channel'];_0x25d39f[_0xa4da('0x27')][_0xa4da('0x6e')]=_0xa4da('0x6f');return respondWithRpcPromise(_0xa4da('0x70'),_0xa4da('0x70'),{'event':_0xa4da('0x71'),'message':_0x25d39f[_0xa4da('0x27')]},client9002)[_0xa4da('0x20')](function(){return _0x25d39f;});}return _0x25d39f;}return null;})['then'](respondWithResult(_0x2b77a4,null))[_0xa4da('0x29')](handleError(_0x2b77a4,null));};var interaction_log=require(_0xa4da('0x14'))(_0xa4da('0x57'));exports['reject']=function(_0x500afd,_0x5e128e,_0x6cb415){var _0x5b8ae6={'agent':{},'channel':_0xa4da('0x58')};if(_0x500afd[_0xa4da('0x54')]['id']){delete _0x500afd['body']['id'];}_0x500afd[_0xa4da('0x54')][_0xa4da('0x5b')]=_0x500afd['body'][_0xa4da('0x5b')]||_0x500afd[_0xa4da('0x5c')]['id'];_0x5b8ae6[_0xa4da('0x5d')]['id']=_0x500afd[_0xa4da('0x54')]['UserId'];return db[_0xa4da('0x37')][_0xa4da('0x51')]({'where':{'id':_0x500afd[_0xa4da('0x55')]['id'],'UserId':null}})[_0xa4da('0x20')](handleEntityNotFound(_0x5e128e,null))[_0xa4da('0x20')](function(_0x1c2391){if(_0x1c2391){_0x5b8ae6['message']=_0x1c2391['get']({'plain':!![]});return db[_0xa4da('0x61')][_0xa4da('0x51')]({'where':{'id':_0x1c2391['OpenchannelInteractionId']}});}return null;})[_0xa4da('0x20')](handleEntityNotFound(_0x5e128e,null))[_0xa4da('0x20')](function(_0x28629a){if(_0x28629a){_0x5b8ae6['interaction']=_0x28629a[_0xa4da('0x60')]({'plain':!![]});interaction_log[_0xa4da('0x21')](_0xa4da('0x72'),_0x500afd[_0xa4da('0x5c')]['id'],_0x500afd['user'][_0xa4da('0x34')],_0x500afd[_0xa4da('0x5c')][_0xa4da('0x73')],_0x5b8ae6[_0xa4da('0x66')]['id'],_0x500afd['body']?JSON[_0xa4da('0x68')](_0x500afd[_0xa4da('0x54')]):'null');return respondWithRpcPromise(_0xa4da('0x74'),'rejectMessage',_0x5b8ae6);}return null;})['then'](function(_0x1065c0){if(_0x1065c0){_0x1065c0[_0xa4da('0x27')][_0xa4da('0x75')]=util['format'](_0xa4da('0x6c'),_0x500afd[_0xa4da('0x5c')][_0xa4da('0x34')]);_0x1065c0[_0xa4da('0x27')]['channel']=_0x5b8ae6[_0xa4da('0x6d')];_0x1065c0[_0xa4da('0x27')]['event']=_0xa4da('0x32');respondWithRpcPromise('EventManager',_0xa4da('0x70'),{'event':'rejectmessage','message':_0x1065c0[_0xa4da('0x27')]},client9002);return _0x5b8ae6;}return null;})['then'](respondWithResult(_0x5e128e,null))[_0xa4da('0x29')](handleError(_0x5e128e,null));}; \ No newline at end of file +var _0xba56=['AcceptMessage','acceptMessage','manual','interface','channel','event','accept','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SIP/%s','rejectmessage','html-pdf','eml-format','rimraf','request-promise','mustache','util','to-csv','ejs','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./openchannelMessage.socket','register','jayson/promise','client','http','request','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','end','json','offset','limit','set','Content-Range','reject','save','destroy','then','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','sort','where','pick','filter','VIRTUAL','options','OpenchannelMessage','count','includeAll','include','findAll','rows','show','params','merge','body','update','find','describe','../../config/logger','openchannel-interactions','openchannel','read','readAt','format','UserId','user','agent','CmContact','Contact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null'];(function(_0x54ddae,_0x1532c4){var _0x91ae83=function(_0x5ba8dd){while(--_0x5ba8dd){_0x54ddae['push'](_0x54ddae['shift']());}};_0x91ae83(++_0x1532c4);}(_0xba56,0x85));var _0x6ba5=function(_0x4af01e,_0x543f5c){_0x4af01e=_0x4af01e-0x0;var _0x178c11=_0xba56[_0x4af01e];return _0x178c11;};'use strict';var pdf=require(_0x6ba5('0x0'));var emlformat=require(_0x6ba5('0x1'));var rimraf=require(_0x6ba5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6ba5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6ba5('0x4'));var util=require(_0x6ba5('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x6ba5('0x6'));var ejs=require(_0x6ba5('0x7'));var fs=require('fs');var _=require(_0x6ba5('0x8'));var squel=require(_0x6ba5('0x9'));var crypto=require('crypto');var jsforce=require(_0x6ba5('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6ba5('0x6'));var querystring=require(_0x6ba5('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6ba5('0xc'));var qs=require(_0x6ba5('0xd'));var as=require(_0x6ba5('0xe'));var hardwareService=require(_0x6ba5('0xf'));var logger=require('../../config/logger')(_0x6ba5('0x10'));var utils=require('../../config/utils');var config=require(_0x6ba5('0x11'));var licenseUtil=require(_0x6ba5('0x12'));var db=require(_0x6ba5('0x13'))['db'];config['redis']=_[_0x6ba5('0x14')](config['redis'],{'host':_0x6ba5('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6ba5('0x16')]));require(_0x6ba5('0x17'))[_0x6ba5('0x18')](socket);var jayson=require(_0x6ba5('0x19'));var client=jayson[_0x6ba5('0x1a')]['http']({'port':0x232c});var client9002=jayson[_0x6ba5('0x1a')][_0x6ba5('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x26929b,_0x5bcc8f,_0x11cc72,_0x5a68c0){return new BPromise(function(_0x3b41bc,_0x41d0c5){var _0x4a48c3=_0x5a68c0||client;return _0x4a48c3[_0x6ba5('0x1c')](_0x26929b,_0x11cc72)['then'](function(_0xcce6d1){logger['info'](_0x6ba5('0x1d'),_0x5bcc8f,_0x6ba5('0x1e'));logger[_0x6ba5('0x1f')](_0x6ba5('0x20'),_0x5bcc8f,_0x6ba5('0x1e'),JSON[_0x6ba5('0x21')](_0xcce6d1));if(_0xcce6d1[_0x6ba5('0x22')]){if(_0xcce6d1['error'][_0x6ba5('0x23')]===0x1f4){logger[_0x6ba5('0x22')](_0x6ba5('0x1d'),_0x5bcc8f,_0xcce6d1['error'][_0x6ba5('0x24')]);return _0x41d0c5(_0xcce6d1[_0x6ba5('0x22')]['message']);}logger[_0x6ba5('0x22')](_0x6ba5('0x1d'),_0x5bcc8f,_0xcce6d1[_0x6ba5('0x22')][_0x6ba5('0x24')]);return _0x3b41bc(_0xcce6d1['error'][_0x6ba5('0x24')]);}else{logger[_0x6ba5('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x5bcc8f,'request\x20sent');_0x3b41bc(_0xcce6d1['result']['message']);}})[_0x6ba5('0x26')](function(_0x55dd06){logger[_0x6ba5('0x22')]('OpenchannelMessage,\x20%s,\x20%s',_0x5bcc8f,_0x55dd06);_0x41d0c5(_0x55dd06);});});}function respondWithStatusCode(_0x94758f,_0x157ac2){_0x157ac2=_0x157ac2||0xcc;return function(_0x1c8f61){if(_0x1c8f61){return _0x94758f['sendStatus'](_0x157ac2);}return _0x94758f[_0x6ba5('0x27')](_0x157ac2)[_0x6ba5('0x28')]();};}function respondWithResult(_0x313b40,_0x532678){_0x532678=_0x532678||0xc8;return function(_0x293967){if(_0x293967){return _0x313b40['status'](_0x532678)[_0x6ba5('0x29')](_0x293967);}};}function respondWithFilteredResult(_0x525568,_0x45fd4c){return function(_0x434686){if(_0x434686){var _0x21dc77=_0x434686['count'],_0x50ca32=_0x45fd4c[_0x6ba5('0x2a')],_0x2b3fa8=_0x45fd4c['offset']+_0x45fd4c[_0x6ba5('0x2b')],_0x5dc494;if(_0x2b3fa8>=_0x21dc77){_0x2b3fa8=_0x21dc77;_0x5dc494=0xc8;}else{_0x5dc494=0xce;}_0x525568['status'](_0x5dc494);return _0x525568[_0x6ba5('0x2c')](_0x6ba5('0x2d'),_0x50ca32+'-'+_0x2b3fa8+'/'+_0x21dc77)[_0x6ba5('0x29')](_0x434686);}return null;};}function patchUpdates(_0xdff7b7){return function(_0x571f56){try{jsonpatch['apply'](_0x571f56,_0xdff7b7,!![]);}catch(_0x4a236e){return BPromise[_0x6ba5('0x2e')](_0x4a236e);}return _0x571f56[_0x6ba5('0x2f')]();};}function saveUpdates(_0x579647,_0x25ec9a){return function(_0xe70060){if(_0xe70060){return _0xe70060['update'](_0x579647)['then'](function(_0x2b988c){return _0x2b988c;});}return null;};}function removeEntity(_0x4ea777,_0x22c74d){return function(_0x235b67){if(_0x235b67){return _0x235b67[_0x6ba5('0x30')]()[_0x6ba5('0x31')](function(){_0x4ea777[_0x6ba5('0x27')](0xcc)[_0x6ba5('0x28')]();});}};}function handleEntityNotFound(_0x2aa23a,_0xfdfc3a){return function(_0x268728){if(!_0x268728){_0x2aa23a[_0x6ba5('0x32')](0x194);}return _0x268728;};}function handleError(_0x52f1d2,_0x56cf92){_0x56cf92=_0x56cf92||0x1f4;return function(_0x47fb81){logger['error'](_0x47fb81['stack']);if(_0x47fb81[_0x6ba5('0x33')]){delete _0x47fb81['name'];}_0x52f1d2[_0x6ba5('0x27')](_0x56cf92)[_0x6ba5('0x34')](_0x47fb81);};}exports[_0x6ba5('0x35')]=function(_0x4379e9,_0x1bdad3){var _0x3178ae={},_0x15c432={},_0x312982={'count':0x0,'rows':[]};var _0x558018=_[_0x6ba5('0x36')](db['OpenchannelMessage'][_0x6ba5('0x37')],function(_0x54cd22){return{'name':_0x54cd22[_0x6ba5('0x38')],'type':_0x54cd22[_0x6ba5('0x39')][_0x6ba5('0x3a')]};});_0x15c432['model']=_[_0x6ba5('0x36')](_0x558018,_0x6ba5('0x33'));_0x15c432[_0x6ba5('0x3b')]=_[_0x6ba5('0x3c')](_0x4379e9['query']);_0x15c432[_0x6ba5('0x3d')]=_['intersection'](_0x15c432[_0x6ba5('0x3e')],_0x15c432[_0x6ba5('0x3b')]);_0x3178ae[_0x6ba5('0x3f')]=_[_0x6ba5('0x40')](_0x15c432['model'],qs[_0x6ba5('0x41')](_0x4379e9['query'][_0x6ba5('0x41')]));_0x3178ae[_0x6ba5('0x3f')]=_0x3178ae[_0x6ba5('0x3f')][_0x6ba5('0x42')]?_0x3178ae[_0x6ba5('0x3f')]:_0x15c432[_0x6ba5('0x3e')];if(!_0x4379e9[_0x6ba5('0x3b')]['hasOwnProperty']('nolimit')){_0x3178ae[_0x6ba5('0x2b')]=qs[_0x6ba5('0x2b')](_0x4379e9['query']['limit']);_0x3178ae[_0x6ba5('0x2a')]=qs[_0x6ba5('0x2a')](_0x4379e9[_0x6ba5('0x3b')][_0x6ba5('0x2a')]);}_0x3178ae['order']=qs[_0x6ba5('0x43')](_0x4379e9[_0x6ba5('0x3b')][_0x6ba5('0x43')]);_0x3178ae[_0x6ba5('0x44')]=qs['filters'](_[_0x6ba5('0x45')](_0x4379e9[_0x6ba5('0x3b')],_0x15c432[_0x6ba5('0x3d')]),_0x558018);if(_0x4379e9[_0x6ba5('0x3b')][_0x6ba5('0x46')]){_0x3178ae[_0x6ba5('0x44')]=_['merge'](_0x3178ae[_0x6ba5('0x44')],{'$or':_[_0x6ba5('0x36')](_0x558018,function(_0x14c60c){if(_0x14c60c[_0x6ba5('0x39')]!==_0x6ba5('0x47')){var _0x3cbb61={};_0x3cbb61[_0x14c60c[_0x6ba5('0x33')]]={'$like':'%'+_0x4379e9['query'][_0x6ba5('0x46')]+'%'};return _0x3cbb61;}})});}_0x3178ae=_['merge']({},_0x3178ae,_0x4379e9[_0x6ba5('0x48')]);var _0x39c1c1={'where':_0x3178ae['where']};return db[_0x6ba5('0x49')][_0x6ba5('0x4a')](_0x39c1c1)[_0x6ba5('0x31')](function(_0xf25fdf){_0x312982[_0x6ba5('0x4a')]=_0xf25fdf;if(_0x4379e9[_0x6ba5('0x3b')][_0x6ba5('0x4b')]){_0x3178ae[_0x6ba5('0x4c')]=[{'all':!![]}];}return db[_0x6ba5('0x49')][_0x6ba5('0x4d')](_0x3178ae);})[_0x6ba5('0x31')](function(_0xfbd7bb){_0x312982[_0x6ba5('0x4e')]=_0xfbd7bb;return _0x312982;})[_0x6ba5('0x31')](respondWithFilteredResult(_0x1bdad3,_0x3178ae))[_0x6ba5('0x26')](handleError(_0x1bdad3,null));};exports[_0x6ba5('0x4f')]=function(_0x45afcc,_0x5761bc){var _0x2d454b={'raw':!![],'where':{'id':_0x45afcc[_0x6ba5('0x50')]['id']}},_0xf232e3={};_0xf232e3[_0x6ba5('0x3e')]=_[_0x6ba5('0x3c')](db[_0x6ba5('0x49')][_0x6ba5('0x37')]);_0xf232e3[_0x6ba5('0x3b')]=_[_0x6ba5('0x3c')](_0x45afcc['query']);_0xf232e3[_0x6ba5('0x3d')]=_[_0x6ba5('0x40')](_0xf232e3[_0x6ba5('0x3e')],_0xf232e3[_0x6ba5('0x3b')]);_0x2d454b[_0x6ba5('0x3f')]=_[_0x6ba5('0x40')](_0xf232e3[_0x6ba5('0x3e')],qs[_0x6ba5('0x41')](_0x45afcc[_0x6ba5('0x3b')]['fields']));_0x2d454b[_0x6ba5('0x3f')]=_0x2d454b[_0x6ba5('0x3f')][_0x6ba5('0x42')]?_0x2d454b[_0x6ba5('0x3f')]:_0xf232e3[_0x6ba5('0x3e')];if(_0x45afcc[_0x6ba5('0x3b')][_0x6ba5('0x4b')]){_0x2d454b[_0x6ba5('0x4c')]=[{'all':!![]}];}_0x2d454b=_[_0x6ba5('0x51')]({},_0x2d454b,_0x45afcc[_0x6ba5('0x48')]);return db[_0x6ba5('0x49')]['find'](_0x2d454b)['then'](handleEntityNotFound(_0x5761bc,null))[_0x6ba5('0x31')](respondWithResult(_0x5761bc,null))[_0x6ba5('0x26')](handleError(_0x5761bc,null));};exports['create']=function(_0x41f460,_0xf1a674){return db[_0x6ba5('0x49')]['create'](_0x41f460[_0x6ba5('0x52')],{})[_0x6ba5('0x31')](respondWithResult(_0xf1a674,0xc9))['catch'](handleError(_0xf1a674,null));};exports[_0x6ba5('0x53')]=function(_0x9841d,_0x31b1ac){if(_0x9841d[_0x6ba5('0x52')]['id']){delete _0x9841d['body']['id'];}return db[_0x6ba5('0x49')][_0x6ba5('0x54')]({'where':{'id':_0x9841d[_0x6ba5('0x50')]['id']}})[_0x6ba5('0x31')](handleEntityNotFound(_0x31b1ac,null))[_0x6ba5('0x31')](saveUpdates(_0x9841d[_0x6ba5('0x52')],null))[_0x6ba5('0x31')](respondWithResult(_0x31b1ac,null))[_0x6ba5('0x26')](handleError(_0x31b1ac,null));};exports[_0x6ba5('0x30')]=function(_0x83593b,_0xcfebbe){return db[_0x6ba5('0x49')][_0x6ba5('0x54')]({'where':{'id':_0x83593b[_0x6ba5('0x50')]['id']}})[_0x6ba5('0x31')](handleEntityNotFound(_0xcfebbe,null))[_0x6ba5('0x31')](removeEntity(_0xcfebbe,null))[_0x6ba5('0x26')](handleError(_0xcfebbe,null));};exports[_0x6ba5('0x55')]=function(_0x3f6612,_0x2088da){return db['OpenchannelMessage']['describe']()[_0x6ba5('0x31')](respondWithResult(_0x2088da,null))[_0x6ba5('0x26')](handleError(_0x2088da,null));};var interaction_log=require(_0x6ba5('0x56'))(_0x6ba5('0x57'));exports['accept']=function(_0x680a28,_0x1d5e3a,_0x4b5a95){var _0x52a89f={'agent':{},'channel':_0x6ba5('0x58')};if(_0x680a28[_0x6ba5('0x52')]['id']){delete _0x680a28[_0x6ba5('0x52')]['id'];}_0x680a28['body'][_0x6ba5('0x59')]=!![];_0x680a28[_0x6ba5('0x52')][_0x6ba5('0x5a')]=moment()[_0x6ba5('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x680a28[_0x6ba5('0x52')]['UserId']=_0x680a28['body'][_0x6ba5('0x5c')]||_0x680a28[_0x6ba5('0x5d')]['id'];_0x52a89f[_0x6ba5('0x5e')]['id']=_0x680a28['body']['UserId'];return db[_0x6ba5('0x49')][_0x6ba5('0x54')]({'where':{'id':_0x680a28[_0x6ba5('0x50')]['id'],'UserId':null},'include':[{'model':db[_0x6ba5('0x5f')],'as':_0x6ba5('0x60')}]})[_0x6ba5('0x31')](handleEntityNotFound(_0x1d5e3a,null))[_0x6ba5('0x31')](saveUpdates(_0x680a28[_0x6ba5('0x52')],null))['then'](function(_0x3136d9){if(_0x3136d9){_0x52a89f[_0x6ba5('0x24')]=_0x3136d9[_0x6ba5('0x61')]({'plain':!![]});return db[_0x6ba5('0x62')]['find']({'where':{'id':_0x3136d9[_0x6ba5('0x63')]}});}return null;})[_0x6ba5('0x31')](handleEntityNotFound(_0x1d5e3a,null))[_0x6ba5('0x31')](function(_0x21c103){if(_0x21c103){return _0x21c103[_0x6ba5('0x53')]({'UserId':_0x680a28['body']['UserId'],'read1stAt':_[_0x6ba5('0x64')](_0x21c103[_0x6ba5('0x65')])?moment()[_0x6ba5('0x5b')](_0x6ba5('0x66')):undefined});}return null;})[_0x6ba5('0x31')](function(_0x19370b){if(_0x19370b){_0x52a89f[_0x6ba5('0x67')]=_0x19370b[_0x6ba5('0x61')]({'plain':!![]});interaction_log[_0x6ba5('0x25')](_0x6ba5('0x68'),_0x680a28[_0x6ba5('0x5d')]['id'],_0x680a28[_0x6ba5('0x5d')][_0x6ba5('0x33')],_0x680a28[_0x6ba5('0x5d')][_0x6ba5('0x69')],_0x52a89f[_0x6ba5('0x67')]['id'],_0x680a28[_0x6ba5('0x52')]?JSON[_0x6ba5('0x21')](_0x680a28['body']):_0x6ba5('0x6a'));return respondWithRpcPromise(_0x6ba5('0x6b'),_0x6ba5('0x6c'),_0x52a89f);}return null;})[_0x6ba5('0x31')](function(_0x1cc87d){if(_0x1cc87d){if(_0x680a28['body'][_0x6ba5('0x6d')]){_0x52a89f[_0x6ba5('0x24')][_0x6ba5('0x6e')]=util[_0x6ba5('0x5b')]('SIP/%s',_0x680a28['user'][_0x6ba5('0x33')]);_0x52a89f['message'][_0x6ba5('0x6f')]=_0x52a89f[_0x6ba5('0x6f')];_0x52a89f['message'][_0x6ba5('0x70')]=_0x6ba5('0x71');return respondWithRpcPromise(_0x6ba5('0x72'),_0x6ba5('0x72'),{'event':_0x6ba5('0x73'),'message':_0x52a89f['message']},client9002)[_0x6ba5('0x31')](function(){return _0x52a89f;});}return _0x52a89f;}return null;})[_0x6ba5('0x31')](respondWithResult(_0x1d5e3a,null))[_0x6ba5('0x26')](handleError(_0x1d5e3a,null));};var interaction_log=require(_0x6ba5('0x56'))(_0x6ba5('0x57'));exports[_0x6ba5('0x2e')]=function(_0x5ed27f,_0x226c6a,_0x3e1109){var _0x3f65b5={'agent':{},'channel':_0x6ba5('0x58')};if(_0x5ed27f[_0x6ba5('0x52')]['id']){delete _0x5ed27f[_0x6ba5('0x52')]['id'];}_0x5ed27f['body'][_0x6ba5('0x5c')]=_0x5ed27f[_0x6ba5('0x52')][_0x6ba5('0x5c')]||_0x5ed27f[_0x6ba5('0x5d')]['id'];_0x3f65b5[_0x6ba5('0x5e')]['id']=_0x5ed27f[_0x6ba5('0x52')][_0x6ba5('0x5c')];return db[_0x6ba5('0x49')][_0x6ba5('0x54')]({'where':{'id':_0x5ed27f[_0x6ba5('0x50')]['id'],'UserId':null}})[_0x6ba5('0x31')](handleEntityNotFound(_0x226c6a,null))['then'](function(_0x27b536){if(_0x27b536){_0x3f65b5[_0x6ba5('0x24')]=_0x27b536['get']({'plain':!![]});return db[_0x6ba5('0x62')]['find']({'where':{'id':_0x27b536[_0x6ba5('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x226c6a,null))[_0x6ba5('0x31')](function(_0x1b6224){if(_0x1b6224){_0x3f65b5[_0x6ba5('0x67')]=_0x1b6224[_0x6ba5('0x61')]({'plain':!![]});interaction_log[_0x6ba5('0x25')](_0x6ba5('0x74'),_0x5ed27f[_0x6ba5('0x5d')]['id'],_0x5ed27f[_0x6ba5('0x5d')][_0x6ba5('0x33')],_0x5ed27f[_0x6ba5('0x5d')][_0x6ba5('0x69')],_0x3f65b5[_0x6ba5('0x67')]['id'],_0x5ed27f['body']?JSON['stringify'](_0x5ed27f['body']):'null');return respondWithRpcPromise('RejectMessage',_0x6ba5('0x75'),_0x3f65b5);}return null;})[_0x6ba5('0x31')](function(_0x548c2e){if(_0x548c2e){_0x548c2e[_0x6ba5('0x24')][_0x6ba5('0x6e')]=util['format'](_0x6ba5('0x76'),_0x5ed27f['user']['name']);_0x548c2e['message'][_0x6ba5('0x6f')]=_0x3f65b5[_0x6ba5('0x6f')];_0x548c2e[_0x6ba5('0x24')][_0x6ba5('0x70')]='reject';respondWithRpcPromise(_0x6ba5('0x72'),_0x6ba5('0x72'),{'event':_0x6ba5('0x77'),'message':_0x548c2e['message']},client9002);return _0x3f65b5;}return null;})[_0x6ba5('0x31')](respondWithResult(_0x226c6a,null))[_0x6ba5('0x26')](handleError(_0x226c6a,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index ce5d2b7..a4b643f 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 _0xac8d=['save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xac8d,0x1f0));var _0xdac8=function(_0xd066c8,_0x46b223){_0xd066c8=_0xd066c8-0x0;var _0x369df2=_0xac8d[_0xd066c8];return _0x369df2;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xdac8('0x0'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdac8('0x1'),'afterUpdate':_0xdac8('0x2'),'afterDestroy':'remove'};function emitEvent(_0x311d47){return function(_0xd8c066,_0x219fa2,_0x357f00){OpenchannelMessageEvents[_0xdac8('0x3')](_0x311d47+':'+_0xd8c066['id'],_0xd8c066);OpenchannelMessageEvents['emit'](_0x311d47,_0xd8c066);_0x357f00(null);};}for(var e in events){if(events[_0xdac8('0x4')](e)){var event=events[e];OpenchannelMessage[_0xdac8('0x5')](e,emitEvent(event));}}module[_0xdac8('0x6')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x528e=['events','../../mysqldb','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports'];(function(_0x13d2e8,_0x193847){var _0x230601=function(_0x4af3be){while(--_0x4af3be){_0x13d2e8['push'](_0x13d2e8['shift']());}};_0x230601(++_0x193847);}(_0x528e,0xab));var _0xe528=function(_0x544655,_0x169260){_0x544655=_0x544655-0x0;var _0x535ed7=_0x528e[_0x544655];return _0x535ed7;};'use strict';var EventEmitter=require(_0xe528('0x0'));var OpenchannelMessage=require(_0xe528('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xe528('0x2')](0x0);var events={'afterCreate':_0xe528('0x3'),'afterUpdate':_0xe528('0x4'),'afterDestroy':_0xe528('0x5')};function emitEvent(_0x388bda){return function(_0x4365b1,_0xe8379e,_0x5b2eeb){OpenchannelMessageEvents['emit'](_0x388bda+':'+_0x4365b1['id'],_0x4365b1);OpenchannelMessageEvents['emit'](_0x388bda,_0x4365b1);_0x5b2eeb(null);};}for(var e in events){if(events[_0xe528('0x6')](e)){var event=events[e];OpenchannelMessage[_0xe528('0x7')](e,emitEvent(event));}}module[_0xe528('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 e716f75..b2a6a22 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 _0x45fe=['findOne','OpenchannelInteractionId','then','update','createdAt','CmContact','describe','OpenchannelAccount','OpenchannelAccountId','Interactions','Contact','keys','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','method','GET','POST','body','threadId','catch','error','afterCreate','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','FULLTEXT','models','direction','out','secret','isNil','UserId','OpenchannelInteraction'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x45fe,0x1eb));var _0xe45f=function(_0x5055f1,_0x3cbb87){_0x5055f1=_0x5055f1-0x0;var _0x28a9f0=_0x45fe[_0x5055f1];return _0x28a9f0;};'use strict';var _=require(_0xe45f('0x0'));var util=require(_0xe45f('0x1'));var logger=require(_0xe45f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xe45f('0x3'));var rp=require(_0xe45f('0x4'));var fs=require('fs');var path=require(_0xe45f('0x5'));var rimraf=require('rimraf');var config=require(_0xe45f('0x6'));var attributes=require(_0xe45f('0x7'));module['exports']=function(_0x403ea7,_0x2517a0){return _0x403ea7[_0xe45f('0x8')](_0xe45f('0x9'),attributes,{'tableName':_0xe45f('0xa'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':['body'],'type':_0xe45f('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2bdb8e,_0xb7d102,_0x2059d3){var _0x3626bc=_0x403ea7[_0xe45f('0xc')];var _0x446ad8=_0x2bdb8e['get']({'plain':!![]});if(_0x446ad8[_0xe45f('0xd')]['toLowerCase']()==='in'||_0x446ad8[_0xe45f('0xd')]['toLowerCase']()===_0xe45f('0xe')&&!_0x446ad8[_0xe45f('0xf')]&&!_[_0xe45f('0x10')](_0x446ad8[_0xe45f('0x11')])){_0x3626bc[_0xe45f('0x12')][_0xe45f('0x13')]({'where':{'id':_0x446ad8[_0xe45f('0x14')]}})[_0xe45f('0x15')](function(_0x37a1e1){if(_0x37a1e1){_0x37a1e1[_0xe45f('0x16')]({'lastMsgAt':_0x446ad8[_0xe45f('0x17')],'lastMsgDirection':_0x446ad8['direction']['toLowerCase']()});}})['catch'](function(_0x253294){console['error'](_0x253294);});}if(_0x446ad8['direction']===_0xe45f('0xe')&&!_0x446ad8[_0xe45f('0xf')]){var _0xf3118;_0x3626bc[_0xe45f('0x18')][_0xe45f('0x19')]()[_0xe45f('0x15')](function(_0x205d56){return _0x3626bc[_0xe45f('0x1a')]['find']({'where':{'id':_0x446ad8[_0xe45f('0x1b')]},'include':[{'model':_0x3626bc[_0xe45f('0x12')],'as':_0xe45f('0x1c'),'where':{'id':_0x446ad8['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x3626bc[_0xe45f('0x18')],'as':_0xe45f('0x1d'),'attributes':_[_0xe45f('0x1e')](_0x205d56)}]}]});})[_0xe45f('0x15')](function(_0x38551f){_0xf3118=_0x38551f[_0xe45f('0x1f')]({'plain':!![]});if(_0xf3118&&_0xf3118[_0xe45f('0x20')]){logger[_0xe45f('0x21')](_0xe45f('0x22'),'afterCreate',util[_0xe45f('0x23')](_0xe45f('0x24'),_0x446ad8['id'],_0xf3118[_0xe45f('0x20')]));if(_0xf3118[_0xe45f('0x1c')]&&_0xf3118[_0xe45f('0x1c')]['length']){_0x446ad8[_0xe45f('0x25')]=_[_0xe45f('0x26')](_0xf3118[_0xe45f('0x1c')][0x0],'Contact');_0x446ad8[_0xe45f('0x1d')]=_0xf3118[_0xe45f('0x1c')][0x0][_0xe45f('0x1d')];}var _0xb7d102={'method':'POST','uri':encodeURI(_0xf3118[_0xe45f('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0xb7d102[_0xe45f('0x27')]){case _0xe45f('0x28'):_0xb7d102['qs']=_0x446ad8;break;case _0xe45f('0x29'):_0xb7d102[_0xe45f('0x2a')]=_0x446ad8;break;}return rp(_0xb7d102)[_0xe45f('0x15')](function(_0x260f9c){logger[_0xe45f('0x21')](_0xe45f('0x22'),'afterCreate',util[_0xe45f('0x23')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x446ad8['id'],_0xf3118[_0xe45f('0x20')]));if(_0x260f9c[_0xe45f('0x2a')][_0xe45f('0x2b')]&&_0x260f9c[_0xe45f('0x2a')][_0xe45f('0x2b')]!=_0x446ad8[_0xe45f('0x25')][_0xe45f('0x2b')]){return _0x3626bc[_0xe45f('0x12')][_0xe45f('0x16')]({'threadId':_0x260f9c[_0xe45f('0x2a')][_0xe45f('0x2b')]},{'logging':!![],'where':{'id':_0x446ad8['Interaction']['id']}});}else{return;}})[_0xe45f('0x15')](function(){return _0x2bdb8e[_0xe45f('0x16')]({'read':!![]});})[_0xe45f('0x2c')](function(_0x215f9d){logger[_0xe45f('0x2d')](_0xe45f('0x22'),_0xe45f('0x2e'),util[_0xe45f('0x2f')](_0x215f9d,{'showHidden':![],'depth':null}));_0x2059d3();});}else{_0x2059d3();}})[_0xe45f('0x30')](function(){_0x2059d3();});}else{_0x2059d3();}}},'charset':_0xe45f('0x31'),'collate':_0xe45f('0x32')});}; \ No newline at end of file +var _0xd357=['format','length','Interaction','omit','Contact','POST','method','body','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./openchannelMessage.attributes','define','openchannel_messages','fti_openchannel_messages','FULLTEXT','get','direction','toLowerCase','UserId','OpenchannelInteraction','findOne','update','error','out','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate'];(function(_0xfa3728,_0x24402f){var _0x171ad6=function(_0x91c5e1){while(--_0x91c5e1){_0xfa3728['push'](_0xfa3728['shift']());}};_0x171ad6(++_0x24402f);}(_0xd357,0xff));var _0x7d35=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd357[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x7d35('0x0'));var util=require('util');var logger=require(_0x7d35('0x1'))(_0x7d35('0x2'));var moment=require(_0x7d35('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7d35('0x4'));var rimraf=require(_0x7d35('0x5'));var config=require(_0x7d35('0x6'));var attributes=require(_0x7d35('0x7'));module['exports']=function(_0x107eef,_0x5deb7f){return _0x107eef[_0x7d35('0x8')]('OpenchannelMessage',attributes,{'tableName':_0x7d35('0x9'),'paranoid':![],'indexes':[{'name':_0x7d35('0xa'),'fields':['body'],'type':_0x7d35('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f2ddc,_0x1c83aa,_0x428cdf){var _0x16bf74=_0x107eef['models'];var _0x1fe3fd=_0x1f2ddc[_0x7d35('0xc')]({'plain':!![]});if(_0x1fe3fd[_0x7d35('0xd')][_0x7d35('0xe')]()==='in'||_0x1fe3fd[_0x7d35('0xd')][_0x7d35('0xe')]()==='out'&&!_0x1fe3fd['secret']&&!_['isNil'](_0x1fe3fd[_0x7d35('0xf')])){_0x16bf74[_0x7d35('0x10')][_0x7d35('0x11')]({'where':{'id':_0x1fe3fd['OpenchannelInteractionId']}})['then'](function(_0x1b65f4){if(_0x1b65f4){_0x1b65f4[_0x7d35('0x12')]({'lastMsgAt':_0x1fe3fd['createdAt'],'lastMsgDirection':_0x1fe3fd['direction'][_0x7d35('0xe')]()});}})['catch'](function(_0x329aaa){console[_0x7d35('0x13')](_0x329aaa);});}if(_0x1fe3fd[_0x7d35('0xd')]===_0x7d35('0x14')&&!_0x1fe3fd['secret']){var _0x3d9643;_0x16bf74[_0x7d35('0x15')][_0x7d35('0x16')]()[_0x7d35('0x17')](function(_0x318a19){return _0x16bf74[_0x7d35('0x18')][_0x7d35('0x19')]({'where':{'id':_0x1fe3fd[_0x7d35('0x1a')]},'include':[{'model':_0x16bf74['OpenchannelInteraction'],'as':_0x7d35('0x1b'),'where':{'id':_0x1fe3fd[_0x7d35('0x1c')]},'limit':0x1,'include':[{'model':_0x16bf74[_0x7d35('0x15')],'as':'Contact','attributes':_[_0x7d35('0x1d')](_0x318a19)}]}]});})[_0x7d35('0x17')](function(_0x195e8d){_0x3d9643=_0x195e8d[_0x7d35('0xc')]({'plain':!![]});if(_0x3d9643&&_0x3d9643[_0x7d35('0x1e')]){logger['info'](_0x7d35('0x1f'),_0x7d35('0x20'),util[_0x7d35('0x21')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x1fe3fd['id'],_0x3d9643[_0x7d35('0x1e')]));if(_0x3d9643['Interactions']&&_0x3d9643['Interactions'][_0x7d35('0x22')]){_0x1fe3fd[_0x7d35('0x23')]=_[_0x7d35('0x24')](_0x3d9643[_0x7d35('0x1b')][0x0],'Contact');_0x1fe3fd[_0x7d35('0x25')]=_0x3d9643[_0x7d35('0x1b')][0x0][_0x7d35('0x25')];}var _0x1c83aa={'method':_0x7d35('0x26'),'uri':encodeURI(_0x3d9643[_0x7d35('0x1e')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1c83aa[_0x7d35('0x27')]){case'GET':_0x1c83aa['qs']=_0x1fe3fd;break;case _0x7d35('0x26'):_0x1c83aa[_0x7d35('0x28')]=_0x1fe3fd;break;}return rp(_0x1c83aa)[_0x7d35('0x17')](function(_0x49261b){logger[_0x7d35('0x29')](_0x7d35('0x1f'),_0x7d35('0x20'),util[_0x7d35('0x21')](_0x7d35('0x2a'),_0x1fe3fd['id'],_0x3d9643[_0x7d35('0x1e')]));if(_0x49261b[_0x7d35('0x28')][_0x7d35('0x2b')]&&_0x49261b[_0x7d35('0x28')][_0x7d35('0x2b')]!=_0x1fe3fd[_0x7d35('0x23')][_0x7d35('0x2b')]){return _0x16bf74[_0x7d35('0x10')][_0x7d35('0x12')]({'threadId':_0x49261b[_0x7d35('0x28')][_0x7d35('0x2b')]},{'logging':!![],'where':{'id':_0x1fe3fd[_0x7d35('0x23')]['id']}});}else{return;}})[_0x7d35('0x17')](function(){return _0x1f2ddc[_0x7d35('0x12')]({'read':!![]});})[_0x7d35('0x2c')](function(_0x264541){logger[_0x7d35('0x13')](_0x7d35('0x1f'),_0x7d35('0x20'),util[_0x7d35('0x2d')](_0x264541,{'showHidden':![],'depth':null}));_0x428cdf();});}else{_0x428cdf();}})['finally'](function(){_0x428cdf();});}else{_0x428cdf();}}},'charset':_0x7d35('0x2e'),'collate':_0x7d35('0x2f')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 35b6f02..84a159d 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x9aa89,_0x42ec7a){var _0x2b4495=function(_0x5f4dfc){while(--_0x5f4dfc){_0x9aa89['push'](_0x9aa89['shift']());}};_0x2b4495(++_0x42ec7a);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1474f3,_0x3212ab){_0x1474f3=_0x1474f3-0x0;var _0x5811d3=_0x5f2f[_0x1474f3];return _0x5811d3;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file +var _0xb10b=['options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body'];(function(_0x54ccd5,_0x60321){var _0x559a9e=function(_0x49795b){while(--_0x49795b){_0x54ccd5['push'](_0x54ccd5['shift']());}};_0x559a9e(++_0x60321);}(_0xb10b,0x12a));var _0xbb10=function(_0x8ec6b4,_0x31ef52){_0x8ec6b4=_0x8ec6b4-0x0;var _0x52c0d0=_0xb10b[_0x8ec6b4];return _0x52c0d0;};'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});config[_0xbb10('0xb')]=_['defaults'](config[_0xbb10('0xb')],{'host':_0xbb10('0xc'),'port':0x18eb});var socket=require(_0xbb10('0xd'))(new Redis(config[_0xbb10('0xb')]));require(_0xbb10('0xe'))[_0xbb10('0xf')](socket);function respondWithRpcPromise(_0x229887,_0xa3adc8,_0x5ab04a){return new BPromise(function(_0x4e47f8,_0x20bd61){return client[_0xbb10('0x10')](_0x229887,_0x5ab04a)[_0xbb10('0x11')](function(_0x5e136d){logger[_0xbb10('0x12')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbb10('0x13'));logger[_0xbb10('0x14')](_0xbb10('0x15'),_0xa3adc8,_0xbb10('0x13'),JSON[_0xbb10('0x16')](_0x5e136d));if(_0x5e136d[_0xbb10('0x17')]){if(_0x5e136d['error'][_0xbb10('0x18')]===0x1f4){logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);return _0x20bd61(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}logger[_0xbb10('0x17')](_0xbb10('0x19'),_0xa3adc8,_0x5e136d[_0xbb10('0x17')]['message']);return _0x4e47f8(_0x5e136d[_0xbb10('0x17')][_0xbb10('0x1a')]);}else{logger[_0xbb10('0x12')](_0xbb10('0x19'),_0xa3adc8,_0xbb10('0x13'));_0x4e47f8(_0x5e136d[_0xbb10('0x1b')][_0xbb10('0x1a')]);}})[_0xbb10('0x1c')](function(_0xbf2906){logger[_0xbb10('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0xa3adc8,_0xbf2906);_0x20bd61(_0xbf2906);});});}exports[_0xbb10('0x1d')]=function(_0x19f48d){var _0x388fab=this;return new Promise(function(_0x109908,_0xdf237d){return db[_0xbb10('0x1e')]['create'](_0x19f48d[_0xbb10('0x1f')],{'raw':_0x19f48d[_0xbb10('0x20')]?_0x19f48d['options']['raw']===undefined?!![]:![]:!![]})[_0xbb10('0x11')](function(_0x311abe){logger[_0xbb10('0x12')](_0xbb10('0x1d'),_0x19f48d);logger[_0xbb10('0x14')](_0xbb10('0x1d'),_0x19f48d,JSON[_0xbb10('0x16')](_0x311abe));_0x109908(_0x311abe);})[_0xbb10('0x1c')](function(_0x7f2377){logger[_0xbb10('0x17')](_0xbb10('0x1d'),_0x7f2377[_0xbb10('0x1a')],_0x19f48d);_0xdf237d(_0x388fab['error'](0x1f4,_0x7f2377['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 555e1fc..8d1971c 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 _0xcb91=['remove','update','emit','removeListener','register'];(function(_0x54a83b,_0x33ce12){var _0x4cfc0e=function(_0x397378){while(--_0x397378){_0x54a83b['push'](_0x54a83b['shift']());}};_0x4cfc0e(++_0x33ce12);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0xcb91[_0x5cc8b9];return _0x58892e;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x1cb9('0x0'),_0x1cb9('0x1')];function createListener(_0x17d4ec,_0x22c4b8){return function(_0x4c37e8){_0x22c4b8[_0x1cb9('0x2')](_0x17d4ec,_0x4c37e8);};}function removeListener(_0x2c17b8,_0x545a34){return function(){OpenchannelMessageEvents[_0x1cb9('0x3')](_0x2c17b8,_0x545a34);};}exports[_0x1cb9('0x4')]=function(_0x53ffbd){for(var _0x226b69=0x0,_0x3f7deb=events['length'];_0x226b69<_0x3f7deb;_0x226b69++){var _0x38737d=events[_0x226b69];var _0x12567c=createListener('openchannelMessage:'+_0x38737d,_0x53ffbd);OpenchannelMessageEvents['on'](_0x38737d,_0x12567c);}}; \ No newline at end of file +var _0xe706=['register','length','openchannelMessage:','./openchannelMessage.events','save','remove','emit','removeListener'];(function(_0x56f84a,_0x177f5c){var _0x1787b2=function(_0x25d335){while(--_0x25d335){_0x56f84a['push'](_0x56f84a['shift']());}};_0x1787b2(++_0x177f5c);}(_0xe706,0xa3));var _0x6e70=function(_0x4a310d,_0x33322d){_0x4a310d=_0x4a310d-0x0;var _0x5eaf36=_0xe706[_0x4a310d];return _0x5eaf36;};'use strict';var OpenchannelMessageEvents=require(_0x6e70('0x0'));var events=[_0x6e70('0x1'),_0x6e70('0x2'),'update'];function createListener(_0x2cae77,_0x315629){return function(_0x2ca810){_0x315629[_0x6e70('0x3')](_0x2cae77,_0x2ca810);};}function removeListener(_0x142c27,_0x2164a4){return function(){OpenchannelMessageEvents[_0x6e70('0x4')](_0x142c27,_0x2164a4);};}exports[_0x6e70('0x5')]=function(_0x1b0389){for(var _0x4381d1=0x0,_0x36357b=events[_0x6e70('0x6')];_0x4381d1<_0x36357b;_0x4381d1++){var _0x45a2d4=events[_0x4381d1];var _0x188ed3=createListener(_0x6e70('0x7')+_0x45a2d4,_0x1b0389);OpenchannelMessageEvents['on'](_0x45a2d4,_0x188ed3);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 2a747fe..c1dc2ee 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 _0x38e4=['removeTeams','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','/:id/members','/:id/users','getAgents','post','create','/:id/teams','addAgents','put','/:id','update','delete','destroy'];(function(_0xd59da5,_0x44c4e6){var _0x25793a=function(_0x4d94c9){while(--_0x4d94c9){_0xd59da5['push'](_0xd59da5['shift']());}};_0x25793a(++_0x44c4e6);}(_0x38e4,0x9e));var _0x438e=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x38e4[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0x438e('0x0'));var util=require(_0x438e('0x1'));var path=require('path');var timeout=require(_0x438e('0x2'));var express=require(_0x438e('0x3'));var router=express['Router']();var auth=require(_0x438e('0x4'));var interaction=require(_0x438e('0x5'));var config=require(_0x438e('0x6'));var controller=require('./openchannelQueue.controller');router[_0x438e('0x7')]('/',auth[_0x438e('0x8')](),controller[_0x438e('0x9')]);router[_0x438e('0x7')](_0x438e('0xa'),auth[_0x438e('0x8')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x438e('0xb')]);router[_0x438e('0x7')](_0x438e('0xc'),auth[_0x438e('0x8')](),controller['getMembers']);router[_0x438e('0x7')]('/:id/teams',auth[_0x438e('0x8')](),controller['getTeams']);router[_0x438e('0x7')](_0x438e('0xd'),auth[_0x438e('0x8')](),controller[_0x438e('0xe')]);router[_0x438e('0xf')]('/',auth['isAuthenticated'](),controller[_0x438e('0x10')]);router[_0x438e('0xf')](_0x438e('0x11'),auth[_0x438e('0x8')](),controller['addTeams']);router['post']('/:id/users',auth[_0x438e('0x8')](),controller[_0x438e('0x12')]);router[_0x438e('0x13')](_0x438e('0x14'),auth[_0x438e('0x8')](),controller[_0x438e('0x15')]);router[_0x438e('0x16')]('/:id',auth[_0x438e('0x8')](),controller[_0x438e('0x17')]);router[_0x438e('0x16')](_0x438e('0x11'),auth[_0x438e('0x8')](),controller[_0x438e('0x18')]);router['delete'](_0x438e('0xd'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x438e('0x19')]=router; \ No newline at end of file +var _0x9c50=['put','delete','destroy','removeTeams','removeAgents','exports','connect-timeout','Router','../../config/environment','./openchannelQueue.controller','isAuthenticated','get','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x9c50,0xec));var _0x09c5=function(_0x259241,_0xf76a5){_0x259241=_0x259241-0x0;var _0x5d84df=_0x9c50[_0x259241];return _0x5d84df;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x09c5('0x0'));var express=require('express');var router=express[_0x09c5('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x09c5('0x2'));var controller=require(_0x09c5('0x3'));router['get']('/',auth[_0x09c5('0x4')](),controller['index']);router[_0x09c5('0x5')](_0x09c5('0x6'),auth[_0x09c5('0x4')](),controller['describe']);router[_0x09c5('0x5')](_0x09c5('0x7'),auth[_0x09c5('0x4')](),controller[_0x09c5('0x8')]);router['get'](_0x09c5('0x9'),auth['isAuthenticated'](),controller['getMembers']);router[_0x09c5('0x5')](_0x09c5('0xa'),auth[_0x09c5('0x4')](),controller[_0x09c5('0xb')]);router['get'](_0x09c5('0xc'),auth[_0x09c5('0x4')](),controller[_0x09c5('0xd')]);router[_0x09c5('0xe')]('/',auth[_0x09c5('0x4')](),controller[_0x09c5('0xf')]);router['post']('/:id/teams',auth[_0x09c5('0x4')](),controller[_0x09c5('0x10')]);router[_0x09c5('0xe')](_0x09c5('0xc'),auth['isAuthenticated'](),controller['addAgents']);router[_0x09c5('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x09c5('0x12')](_0x09c5('0x7'),auth[_0x09c5('0x4')](),controller[_0x09c5('0x13')]);router[_0x09c5('0x12')](_0x09c5('0xa'),auth[_0x09c5('0x4')](),controller[_0x09c5('0x14')]);router[_0x09c5('0x12')](_0x09c5('0xc'),auth['isAuthenticated'](),controller[_0x09c5('0x15')]);module[_0x09c5('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 981e0e3..4904856 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 _0xf198=['name','STRING','INTEGER','rrmemory','beepall','roundrobin','exports'];(function(_0x5e3e3d,_0x1a10e4){var _0x502e62=function(_0x23b38e){while(--_0x23b38e){_0x5e3e3d['push'](_0x5e3e3d['shift']());}};_0x502e62(++_0x1a10e4);}(_0xf198,0xd1));var _0x8f19=function(_0x2abae0,_0x5658ba){_0x2abae0=_0x2abae0-0x0;var _0x1c0b69=_0xf198[_0x2abae0];return _0x1c0b69;};'use strict';var Sequelize=require('sequelize');module[_0x8f19('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x8f19('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8f19('0x2')]},'timeout':{'type':Sequelize[_0x8f19('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x8f19('0x4'),_0x8f19('0x5'),_0x8f19('0x6'))}}; \ No newline at end of file +var _0x508a=['STRING','name','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x149dac,_0x5f41a0){var _0x50875c=function(_0x355bbd){while(--_0x355bbd){_0x149dac['push'](_0x149dac['shift']());}};_0x50875c(++_0x5f41a0);}(_0x508a,0x1aa));var _0xa508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x508a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa508('0x0'));module['exports']={'name':{'type':Sequelize[_0xa508('0x1')],'unique':_0xa508('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa508('0x1')]},'timeout':{'type':Sequelize[_0xa508('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa508('0x4')]('rrmemory',_0xa508('0x5'),_0xa508('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 38eb9c5..03792fe 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 _0x1a29=['include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','body','describe','UserOpenchannelQueue','order','OpenchannelQueueId','filter','options','UserId','agent','updatedAt','createdAt','rows','format','%s/%s','SIP','openchannelPause','getTeams','findOne','Team','addTeams','ids','User','online','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','removeTeams','isEmpty','addAgents','spread','removeAgents','isArray','getAgents','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','end','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filters','merge','VIRTUAL','where','includeAll','findAll','catch','show','params'];(function(_0x1e723e,_0x577e17){var _0x1a243b=function(_0x538d3f){while(--_0x538d3f){_0x1e723e['push'](_0x1e723e['shift']());}};_0x1a243b(++_0x577e17);}(_0x1a29,0xcb));var _0x91a2=function(_0x218556,_0x265ca4){_0x218556=_0x218556-0x0;var _0x394646=_0x1a29[_0x218556];return _0x394646;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x91a2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x91a2('0x1'));var rp=require(_0x91a2('0x2'));var moment=require(_0x91a2('0x3'));var BPromise=require(_0x91a2('0x4'));var Mustache=require(_0x91a2('0x5'));var util=require('util');var path=require(_0x91a2('0x6'));var sox=require('sox');var csv=require(_0x91a2('0x7'));var ejs=require(_0x91a2('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x91a2('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x91a2('0xa'));var toCsv=require(_0x91a2('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x91a2('0xb'));var authService=require(_0x91a2('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x91a2('0xd'));var hardwareService=require(_0x91a2('0xe'));var logger=require(_0x91a2('0xf'))(_0x91a2('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x91a2('0x11'));var db=require(_0x91a2('0x12'))['db'];config[_0x91a2('0x13')]=_[_0x91a2('0x14')](config[_0x91a2('0x13')],{'host':_0x91a2('0x15'),'port':0x18eb});var socket=require(_0x91a2('0x16'))(new Redis(config['redis']));require(_0x91a2('0x17'))[_0x91a2('0x18')](socket);function respondWithStatusCode(_0x36b70a,_0x1bbec4){_0x1bbec4=_0x1bbec4||0xcc;return function(_0x16cfc8){if(_0x16cfc8){return _0x36b70a[_0x91a2('0x19')](_0x1bbec4);}return _0x36b70a[_0x91a2('0x1a')](_0x1bbec4)['end']();};}function respondWithResult(_0x4a1cab,_0x3b562b){_0x3b562b=_0x3b562b||0xc8;return function(_0x1b4715){if(_0x1b4715){return _0x4a1cab[_0x91a2('0x1a')](_0x3b562b)[_0x91a2('0x1b')](_0x1b4715);}};}function respondWithFilteredResult(_0x25a7c4,_0x6cf194){return function(_0x2089f9){if(_0x2089f9){var _0x298d70=_0x2089f9[_0x91a2('0x1c')],_0x15e029=_0x6cf194[_0x91a2('0x1d')],_0x3c56ce=_0x6cf194[_0x91a2('0x1d')]+_0x6cf194['limit'],_0x1ef3c2;if(_0x3c56ce>=_0x298d70){_0x3c56ce=_0x298d70;_0x1ef3c2=0xc8;}else{_0x1ef3c2=0xce;}_0x25a7c4[_0x91a2('0x1a')](_0x1ef3c2);return _0x25a7c4[_0x91a2('0x1e')](_0x91a2('0x1f'),_0x15e029+'-'+_0x3c56ce+'/'+_0x298d70)[_0x91a2('0x1b')](_0x2089f9);}return null;};}function patchUpdates(_0x42d393){return function(_0x44814e){try{jsonpatch['apply'](_0x44814e,_0x42d393,!![]);}catch(_0x1323fa){return BPromise[_0x91a2('0x20')](_0x1323fa);}return _0x44814e[_0x91a2('0x21')]();};}function saveUpdates(_0x1fd847,_0x4011e2){return function(_0x1b4110){if(_0x1b4110){return _0x1b4110[_0x91a2('0x22')](_0x1fd847)[_0x91a2('0x23')](function(_0x361339){return _0x361339;});}return null;};}function removeEntity(_0x3dd1b9,_0x179bc7){return function(_0x4777e2){if(_0x4777e2){return _0x4777e2[_0x91a2('0x24')]()['then'](function(){var _0x1867db=_0x4777e2[_0x91a2('0x25')]({'plain':!![]});var _0x2f6a53=_0x91a2('0x26');return db[_0x91a2('0x27')][_0x91a2('0x24')]({'where':{'type':_0x2f6a53,'resourceId':_0x1867db['id']}})[_0x91a2('0x23')](function(){return _0x4777e2;});})[_0x91a2('0x23')](function(){_0x3dd1b9[_0x91a2('0x1a')](0xcc)[_0x91a2('0x28')]();});}};}function handleEntityNotFound(_0x2ec5e4,_0x2ead3f){return function(_0x50b4ba){if(!_0x50b4ba){_0x2ec5e4['sendStatus'](0x194);}return _0x50b4ba;};}function handleError(_0x7d2d6,_0x13db9f){_0x13db9f=_0x13db9f||0x1f4;return function(_0x5e3d3f){logger[_0x91a2('0x29')](_0x5e3d3f[_0x91a2('0x2a')]);if(_0x5e3d3f[_0x91a2('0x2b')]){delete _0x5e3d3f[_0x91a2('0x2b')];}_0x7d2d6[_0x91a2('0x1a')](_0x13db9f)[_0x91a2('0x2c')](_0x5e3d3f);};}exports[_0x91a2('0x2d')]=function(_0x266617,_0x38143e){var _0x146f85={},_0x425402={},_0x3c2238={'count':0x0,'rows':[]};var _0x4c1fc9=_[_0x91a2('0x2e')](db[_0x91a2('0x2f')][_0x91a2('0x30')],function(_0x7c8d62){return{'name':_0x7c8d62[_0x91a2('0x31')],'type':_0x7c8d62[_0x91a2('0x32')][_0x91a2('0x33')]};});_0x425402[_0x91a2('0x34')]=_['map'](_0x4c1fc9,_0x91a2('0x2b'));_0x425402[_0x91a2('0x35')]=_[_0x91a2('0x36')](_0x266617[_0x91a2('0x35')]);_0x425402['filters']=_[_0x91a2('0x37')](_0x425402['model'],_0x425402[_0x91a2('0x35')]);_0x146f85[_0x91a2('0x38')]=_[_0x91a2('0x37')](_0x425402[_0x91a2('0x34')],qs[_0x91a2('0x39')](_0x266617[_0x91a2('0x35')][_0x91a2('0x39')]));_0x146f85['attributes']=_0x146f85[_0x91a2('0x38')][_0x91a2('0x3a')]?_0x146f85['attributes']:_0x425402[_0x91a2('0x34')];if(!_0x266617[_0x91a2('0x35')][_0x91a2('0x3b')](_0x91a2('0x3c'))){_0x146f85['limit']=qs[_0x91a2('0x3d')](_0x266617[_0x91a2('0x35')]['limit']);_0x146f85[_0x91a2('0x1d')]=qs['offset'](_0x266617[_0x91a2('0x35')][_0x91a2('0x1d')]);}_0x146f85['order']=qs[_0x91a2('0x3e')](_0x266617[_0x91a2('0x35')][_0x91a2('0x3e')]);_0x146f85['where']=qs['filters'](_[_0x91a2('0x3f')](_0x266617[_0x91a2('0x35')],_0x425402[_0x91a2('0x40')]),_0x4c1fc9);if(_0x266617[_0x91a2('0x35')]['filter']){_0x146f85['where']=_[_0x91a2('0x41')](_0x146f85['where'],{'$or':_['map'](_0x4c1fc9,function(_0x422f93){if(_0x422f93[_0x91a2('0x32')]!==_0x91a2('0x42')){var _0x22d576={};_0x22d576[_0x422f93[_0x91a2('0x2b')]]={'$like':'%'+_0x266617[_0x91a2('0x35')]['filter']+'%'};return _0x22d576;}})});}_0x146f85=_['merge']({},_0x146f85,_0x266617['options']);var _0x38bba8={'where':_0x146f85[_0x91a2('0x43')]};return db[_0x91a2('0x2f')]['count'](_0x38bba8)[_0x91a2('0x23')](function(_0x4131a4){_0x3c2238['count']=_0x4131a4;if(_0x266617[_0x91a2('0x35')][_0x91a2('0x44')]){_0x146f85['include']=[{'all':!![]}];}return db[_0x91a2('0x2f')][_0x91a2('0x45')](_0x146f85);})['then'](function(_0x39ef2b){_0x3c2238['rows']=_0x39ef2b;return _0x3c2238;})[_0x91a2('0x23')](respondWithFilteredResult(_0x38143e,_0x146f85))[_0x91a2('0x46')](handleError(_0x38143e,null));};exports[_0x91a2('0x47')]=function(_0x34680d,_0x41725a){var _0x26374f={'raw':!![],'where':{'id':_0x34680d[_0x91a2('0x48')]['id']}},_0x37ac0a={};_0x37ac0a[_0x91a2('0x34')]=_[_0x91a2('0x36')](db[_0x91a2('0x2f')][_0x91a2('0x30')]);_0x37ac0a['query']=_['keys'](_0x34680d[_0x91a2('0x35')]);_0x37ac0a[_0x91a2('0x40')]=_['intersection'](_0x37ac0a['model'],_0x37ac0a[_0x91a2('0x35')]);_0x26374f[_0x91a2('0x38')]=_['intersection'](_0x37ac0a[_0x91a2('0x34')],qs[_0x91a2('0x39')](_0x34680d[_0x91a2('0x35')]['fields']));_0x26374f[_0x91a2('0x38')]=_0x26374f[_0x91a2('0x38')][_0x91a2('0x3a')]?_0x26374f[_0x91a2('0x38')]:_0x37ac0a[_0x91a2('0x34')];if(_0x34680d[_0x91a2('0x35')][_0x91a2('0x44')]){_0x26374f[_0x91a2('0x49')]=[{'all':!![]}];}_0x26374f=_[_0x91a2('0x41')]({},_0x26374f,_0x34680d['options']);return db[_0x91a2('0x2f')][_0x91a2('0x4a')](_0x26374f)[_0x91a2('0x23')](handleEntityNotFound(_0x41725a,null))[_0x91a2('0x23')](respondWithResult(_0x41725a,null))[_0x91a2('0x46')](handleError(_0x41725a,null));};exports[_0x91a2('0x4b')]=function(_0x42bdd8,_0x17c6b0){return db['OpenchannelQueue'][_0x91a2('0x4b')](_0x42bdd8['body'],{})[_0x91a2('0x23')](function(_0x543ee1){var _0x44debd=_0x42bdd8[_0x91a2('0x4c')]['get']({'plain':!![]});if(!_0x44debd)throw new Error(_0x91a2('0x4d'));if(_0x44debd[_0x91a2('0x4e')]===_0x91a2('0x4c')){var _0x2068ff=_0x543ee1[_0x91a2('0x25')]({'plain':!![]});var _0x16f8c0=_0x91a2('0x26');return db['UserProfileSection'][_0x91a2('0x4a')]({'where':{'name':_0x16f8c0,'userProfileId':_0x44debd[_0x91a2('0x4f')]},'raw':!![]})[_0x91a2('0x23')](function(_0x10666d){if(_0x10666d&&_0x10666d[_0x91a2('0x50')]===0x0){return db[_0x91a2('0x27')][_0x91a2('0x4b')]({'name':_0x2068ff[_0x91a2('0x2b')],'resourceId':_0x2068ff['id'],'type':_0x10666d[_0x91a2('0x2b')],'sectionId':_0x10666d['id']},{})[_0x91a2('0x23')](function(){return _0x543ee1;});}else{return _0x543ee1;}})[_0x91a2('0x46')](function(_0x1abf87){logger[_0x91a2('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1abf87);throw _0x1abf87;});}return _0x543ee1;})['then'](respondWithResult(_0x17c6b0,0xc9))[_0x91a2('0x46')](handleError(_0x17c6b0,null));};exports[_0x91a2('0x22')]=function(_0x3be701,_0xc9ef83){if(_0x3be701[_0x91a2('0x51')]['id']){delete _0x3be701[_0x91a2('0x51')]['id'];}return db[_0x91a2('0x2f')][_0x91a2('0x4a')]({'where':{'id':_0x3be701[_0x91a2('0x48')]['id']}})[_0x91a2('0x23')](handleEntityNotFound(_0xc9ef83,null))[_0x91a2('0x23')](saveUpdates(_0x3be701[_0x91a2('0x51')],null))[_0x91a2('0x23')](respondWithResult(_0xc9ef83,null))[_0x91a2('0x46')](handleError(_0xc9ef83,null));};exports['destroy']=function(_0x2768a1,_0x27065b){return db['OpenchannelQueue'][_0x91a2('0x4a')]({'where':{'id':_0x2768a1['params']['id']}})['then'](handleEntityNotFound(_0x27065b,null))[_0x91a2('0x23')](removeEntity(_0x27065b,null))['catch'](handleError(_0x27065b,null));};exports[_0x91a2('0x52')]=function(_0x35e126,_0x3a8803){return db[_0x91a2('0x2f')]['describe']()[_0x91a2('0x23')](respondWithResult(_0x3a8803,null))[_0x91a2('0x46')](handleError(_0x3a8803,null));};exports['getMembers']=function(_0x133ed7,_0x174df9,_0x5e8223){var _0x5a45ea={'raw':!![],'where':{}},_0x31da0f={},_0x2f4963;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x133ed7[_0x91a2('0x48')]['id']}})['then'](handleEntityNotFound(_0x174df9,null))[_0x91a2('0x23')](function(_0x274f75){if(_0x274f75){_0x2f4963=_0x274f75[_0x91a2('0x25')]({'plain':!![]});_0x31da0f['model']=_[_0x91a2('0x36')](db[_0x91a2('0x53')][_0x91a2('0x30')]);_0x31da0f['query']=_[_0x91a2('0x36')](_0x133ed7[_0x91a2('0x35')]);_0x31da0f[_0x91a2('0x40')]=_[_0x91a2('0x37')](_0x31da0f['model'],_0x31da0f['query']);_0x5a45ea['attributes']=_[_0x91a2('0x37')](_0x31da0f['model'],qs[_0x91a2('0x39')](_0x133ed7[_0x91a2('0x35')][_0x91a2('0x39')]));_0x5a45ea[_0x91a2('0x38')]=_0x5a45ea[_0x91a2('0x38')][_0x91a2('0x3a')]?_0x5a45ea[_0x91a2('0x38')]:_0x31da0f[_0x91a2('0x34')];if(!_0x133ed7[_0x91a2('0x35')][_0x91a2('0x3b')](_0x91a2('0x3c'))){_0x5a45ea['limit']=qs[_0x91a2('0x3d')](_0x133ed7[_0x91a2('0x35')][_0x91a2('0x3d')]);_0x5a45ea[_0x91a2('0x1d')]=qs[_0x91a2('0x1d')](_0x133ed7['query'][_0x91a2('0x1d')]);}_0x5a45ea[_0x91a2('0x54')]=qs[_0x91a2('0x3e')](_0x133ed7[_0x91a2('0x35')][_0x91a2('0x3e')]);_0x5a45ea['where']=qs[_0x91a2('0x40')](_[_0x91a2('0x3f')](_0x133ed7['query'],_0x31da0f[_0x91a2('0x40')]));_0x5a45ea[_0x91a2('0x43')][_0x91a2('0x55')]=_0x274f75['id'];if(_0x133ed7[_0x91a2('0x35')][_0x91a2('0x56')]){_0x5a45ea[_0x91a2('0x43')]=_[_0x91a2('0x41')](_0x5a45ea['where'],{'$or':_[_0x91a2('0x2e')](_0x5a45ea[_0x91a2('0x38')],function(_0x2906aa){var _0x1b91e0={};_0x1b91e0[_0x2906aa]={'$like':'%'+_0x133ed7[_0x91a2('0x35')][_0x91a2('0x56')]+'%'};return _0x1b91e0;})});}_0x5a45ea=_['merge']({},_0x5a45ea,_0x133ed7[_0x91a2('0x57')]);return db[_0x91a2('0x53')]['findAll'](_0x5a45ea);}})[_0x91a2('0x23')](function(_0x555b9e){if(_0x555b9e){return db['User']['findAndCountAll']({'where':{'id':_[_0x91a2('0x2e')](_0x555b9e,_0x91a2('0x58')),'role':_0x91a2('0x59')},'attributes':['id',_0x91a2('0x2b'),'openchannelPause',_0x91a2('0x5a'),_0x91a2('0x5b')]});}})[_0x91a2('0x23')](function(_0x133a4a){if(_0x133a4a){return{'count':_0x133a4a['count'],'rows':_['map'](_0x133a4a[_0x91a2('0x5c')],function(_0x46bcaa){return{'membername':_0x46bcaa[_0x91a2('0x2b')],'UserId':_0x46bcaa['id'],'queue_name':_0x2f4963['name'],'OpenchannelQueueId':_0x2f4963['id'],'interface':util[_0x91a2('0x5d')](_0x91a2('0x5e'),_0x91a2('0x5f'),_0x46bcaa[_0x91a2('0x2b')]),'penalty':0x0,'paused':_0x46bcaa[_0x91a2('0x60')],'createdAt':_0x46bcaa[_0x91a2('0x5b')],'updatedAt':_0x46bcaa[_0x91a2('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x174df9,_0x5a45ea))[_0x91a2('0x46')](handleError(_0x174df9,null));};exports[_0x91a2('0x61')]=function(_0x408277,_0x51bfa6,_0x378433){var _0x45e5de={};var _0x4b006f={};var _0x3e390d;var _0x3d4a09;return db[_0x91a2('0x2f')][_0x91a2('0x62')]({'where':{'id':_0x408277[_0x91a2('0x48')]['id']}})[_0x91a2('0x23')](handleEntityNotFound(_0x51bfa6,null))[_0x91a2('0x23')](function(_0xa2e797){if(_0xa2e797){_0x3e390d=_0xa2e797;_0x4b006f[_0x91a2('0x34')]=_[_0x91a2('0x36')](db[_0x91a2('0x63')][_0x91a2('0x30')]);_0x4b006f[_0x91a2('0x35')]=_[_0x91a2('0x36')](_0x408277[_0x91a2('0x35')]);_0x4b006f[_0x91a2('0x40')]=_[_0x91a2('0x37')](_0x4b006f[_0x91a2('0x34')],_0x4b006f[_0x91a2('0x35')]);_0x45e5de[_0x91a2('0x38')]=_[_0x91a2('0x37')](_0x4b006f[_0x91a2('0x34')],qs[_0x91a2('0x39')](_0x408277[_0x91a2('0x35')]['fields']));_0x45e5de['attributes']=_0x45e5de[_0x91a2('0x38')][_0x91a2('0x3a')]?_0x45e5de[_0x91a2('0x38')]:_0x4b006f[_0x91a2('0x34')];_0x45e5de[_0x91a2('0x54')]=qs[_0x91a2('0x3e')](_0x408277['query'][_0x91a2('0x3e')]);_0x45e5de['where']=qs[_0x91a2('0x40')](_[_0x91a2('0x3f')](_0x408277[_0x91a2('0x35')],_0x4b006f[_0x91a2('0x40')]));if(_0x408277[_0x91a2('0x35')]['filter']){_0x45e5de[_0x91a2('0x43')]=_['merge'](_0x45e5de[_0x91a2('0x43')],{'$or':_[_0x91a2('0x2e')](_0x45e5de['attributes'],function(_0x2d3f74){var _0x117b19={};_0x117b19[_0x2d3f74]={'$like':'%'+_0x408277[_0x91a2('0x35')]['filter']+'%'};return _0x117b19;})});}_0x45e5de=_[_0x91a2('0x41')]({},_0x45e5de,_0x408277['options']);return _0x3e390d[_0x91a2('0x61')](_0x45e5de);}})['then'](function(_0x1e7e88){if(_0x1e7e88){_0x3d4a09=_0x1e7e88[_0x91a2('0x3a')];if(!_0x408277[_0x91a2('0x35')][_0x91a2('0x3b')](_0x91a2('0x3c'))){_0x45e5de[_0x91a2('0x3d')]=qs[_0x91a2('0x3d')](_0x408277[_0x91a2('0x35')][_0x91a2('0x3d')]);_0x45e5de['offset']=qs[_0x91a2('0x1d')](_0x408277['query'][_0x91a2('0x1d')]);}return _0x3e390d[_0x91a2('0x61')](_0x45e5de);}})[_0x91a2('0x23')](function(_0x2bd7f0){if(_0x2bd7f0){return _0x2bd7f0?{'count':_0x3d4a09,'rows':_0x2bd7f0}:null;}})['then'](respondWithResult(_0x51bfa6,null))['catch'](handleError(_0x51bfa6,null));};exports[_0x91a2('0x64')]=function(_0x4df1b5,_0x3a2025,_0x296e16){var _0x32088b=_0x4df1b5[_0x91a2('0x51')][_0x91a2('0x65')];return db['Team'][_0x91a2('0x45')]({'where':{'id':_0x32088b},'attributes':['id'],'include':[{'model':db[_0x91a2('0x66')],'as':'Agents','attributes':['id','name',_0x91a2('0x67'),_0x91a2('0x68'),_0x91a2('0x69')],'raw':!![]}]})[_0x91a2('0x23')](function(_0x4afde4){if(_0x4afde4){var _0x134de0=_['flatMap'](_0x4afde4,function(_0xf5f8c){var _0x103c4a=_0xf5f8c[_0x91a2('0x25')]({'plain':!![]});return _0x103c4a[_0x91a2('0x6a')];});return db[_0x91a2('0x2f')][_0x91a2('0x4a')]({'where':{'id':_0x4df1b5['params']['id']}})[_0x91a2('0x23')](function(_0x331c43){return db[_0x91a2('0x6b')][_0x91a2('0x6c')](function(_0x1c21f){return _0x331c43[_0x91a2('0x64')](_0x32088b,{'transaction':_0x1c21f})[_0x91a2('0x23')](function(){return BPromise[_0x91a2('0x6d')](_0x134de0,function(_0x2ed3d1){return db[_0x91a2('0x53')][_0x91a2('0x6e')]({'where':{'UserId':_0x2ed3d1['id'],'OpenchannelQueueId':_0x4df1b5['params']['id']},'transaction':_0x1c21f});});})[_0x91a2('0x23')](function(){_0x134de0[_0x91a2('0x6f')](function(_0x10d381){socket[_0x91a2('0x70')](_0x91a2('0x71'),{'UserId':_0x10d381['id'],'OpenchannelQueueId':_0x331c43['id']});});});});});}})['then'](respondWithStatusCode(_0x3a2025,null))['catch'](handleError(_0x3a2025,null));};exports['removeTeams']=function(_0x561e3e,_0x13ae20,_0x52cab8){return db['Team'][_0x91a2('0x45')]({'where':{'id':_0x561e3e[_0x91a2('0x35')][_0x91a2('0x65')]},'attributes':['id'],'include':[{'model':db[_0x91a2('0x66')],'as':_0x91a2('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x91a2('0x23')](handleEntityNotFound(_0x13ae20,null))[_0x91a2('0x23')](function(_0x24212f){var _0x3b1c9d=_['map'](_0x24212f,'id');var _0x1b515d=[];var _0x3989f0=[];var _0x32fb4c=squel['select']();_0x32fb4c[_0x91a2('0x72')](_0x91a2('0x73'))[_0x91a2('0x74')]('team_has_openchannel_queues','tq')[_0x91a2('0x75')](_0x91a2('0x76'),'ut',_0x91a2('0x77'))[_0x91a2('0x43')]('OpenchannelQueueId\x20=\x20?',_0x561e3e[_0x91a2('0x48')]['id']);for(var _0x80126b=0x0;_0x80126b<_0x24212f[_0x91a2('0x3a')];_0x80126b+=0x1){let _0xba6d3c=_0x24212f[_0x80126b];for(var _0x2ab4fe=0x0;_0x2ab4fe<_0xba6d3c['Agents'][_0x91a2('0x3a')];_0x2ab4fe+=0x1){let _0x3cbdb6=_0xba6d3c[_0x91a2('0x6a')][_0x2ab4fe];var _0x4a599c=_0x32fb4c[_0x91a2('0x78')]();_0x4a599c[_0x91a2('0x43')]('ut.UserId\x20=\x20?',_0x3cbdb6['id']);_0x3989f0[_0x91a2('0x79')](db[_0x91a2('0x6b')][_0x91a2('0x35')](_0x4a599c[_0x91a2('0x7a')](),{'type':db[_0x91a2('0x6b')][_0x91a2('0x7b')][_0x91a2('0x7c')]})['then'](function(_0xf4cb60){if(_0xf4cb60[_0x91a2('0x3a')]===0x1){return _0x3cbdb6['id'];}else{var _0x2c342d=_[_0x91a2('0x7d')](_[_0x91a2('0x2e')](_0xf4cb60,_0x91a2('0x7e')),function(_0x2ffb3f){return _['includes'](_0x3b1c9d,_0x2ffb3f);});if(_0x2c342d){return _0x3cbdb6['id'];}}}));}}return BPromise[_0x91a2('0x7f')](_0x3989f0)[_0x91a2('0x23')](function(_0x4954ff){_0x1b515d=_(_0x1b515d)[_0x91a2('0x80')](_0x4954ff)[_0x91a2('0x81')]()[_0x91a2('0x82')]();return db['OpenchannelQueue'][_0x91a2('0x4a')]({'where':{'id':_0x561e3e[_0x91a2('0x48')]['id']}})[_0x91a2('0x23')](function(_0x5a3afe){return db[_0x91a2('0x6b')][_0x91a2('0x6c')](function(_0x4dd533){return _0x5a3afe[_0x91a2('0x83')](_0x561e3e[_0x91a2('0x35')][_0x91a2('0x65')],{'transaction':_0x4dd533})[_0x91a2('0x23')](function(){if(!_[_0x91a2('0x84')](_0x1b515d)){return _0x5a3afe['removeAgents'](_0x1b515d,{'transaction':_0x4dd533});}})[_0x91a2('0x23')](function(){_0x1b515d['forEach'](function(_0x3f8d75){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x3f8d75,'OpenchannelQueueId':_0x5a3afe['id']});});});});});});})['then'](respondWithStatusCode(_0x13ae20,null))[_0x91a2('0x46')](handleError(_0x13ae20,null));};exports[_0x91a2('0x85')]=function(_0x3baad3,_0xa7af71,_0x55df32){return db['OpenchannelQueue'][_0x91a2('0x4a')]({'where':{'id':_0x3baad3['params']['id']}})[_0x91a2('0x23')](handleEntityNotFound(_0xa7af71,null))[_0x91a2('0x23')](function(_0x21b497){if(_0x21b497){return _0x21b497[_0x91a2('0x85')](_0x3baad3['body'][_0x91a2('0x65')],_['omit'](_0x3baad3[_0x91a2('0x51')],['ids','id'])||{})[_0x91a2('0x86')](function(_0x11170a){for(var _0x51de6f=0x0;_0x51de6f<_0x3baad3[_0x91a2('0x51')]['ids'][_0x91a2('0x3a')];_0x51de6f+=0x1){socket[_0x91a2('0x70')]('userOpenchannelQueue:save',{'UserId':_0x3baad3[_0x91a2('0x51')][_0x91a2('0x65')][_0x51de6f],'OpenchannelQueueId':_0x3baad3['params']['id']});}return _0x11170a;});}})[_0x91a2('0x23')](respondWithResult(_0xa7af71,null))[_0x91a2('0x46')](handleError(_0xa7af71,null));};exports[_0x91a2('0x87')]=function(_0x4dcba0,_0x2c14e1,_0x5c3cd8){return db[_0x91a2('0x2f')]['find']({'where':{'id':_0x4dcba0[_0x91a2('0x48')]['id']}})[_0x91a2('0x23')](handleEntityNotFound(_0x2c14e1,null))[_0x91a2('0x23')](function(_0x2cac7a){if(_0x2cac7a){return _0x2cac7a[_0x91a2('0x87')](_0x4dcba0[_0x91a2('0x35')][_0x91a2('0x65')])[_0x91a2('0x23')](function(){if(_[_0x91a2('0x88')](_0x4dcba0['query']['ids'])){for(var _0x3870ca=0x0;_0x3870ca<_0x4dcba0[_0x91a2('0x35')][_0x91a2('0x65')][_0x91a2('0x3a')];_0x3870ca+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x4dcba0[_0x91a2('0x35')]['ids'][_0x3870ca]),'OpenchannelQueueId':Number(_0x4dcba0[_0x91a2('0x48')]['id'])});}}else{socket[_0x91a2('0x70')]('userOpenchannelQueue:remove',{'UserId':Number(_0x4dcba0[_0x91a2('0x35')][_0x91a2('0x65')]),'OpenchannelQueueId':Number(_0x4dcba0[_0x91a2('0x48')]['id'])});}});}})[_0x91a2('0x23')](respondWithStatusCode(_0x2c14e1,null))[_0x91a2('0x46')](handleError(_0x2c14e1,null));};exports[_0x91a2('0x89')]=function(_0x15e94a,_0x2bf7f7,_0x11c881){var _0x5c1066={};var _0x2f0200={};var _0x1f3e59;var _0xa86cd7;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x15e94a['params']['id']}})[_0x91a2('0x23')](handleEntityNotFound(_0x2bf7f7,null))[_0x91a2('0x23')](function(_0x527c39){if(_0x527c39){_0x1f3e59=_0x527c39;_0x2f0200[_0x91a2('0x34')]=_[_0x91a2('0x36')](db[_0x91a2('0x66')]['rawAttributes']);_0x2f0200[_0x91a2('0x35')]=_[_0x91a2('0x36')](_0x15e94a['query']);_0x2f0200[_0x91a2('0x40')]=_[_0x91a2('0x37')](_0x2f0200['model'],_0x2f0200[_0x91a2('0x35')]);_0x5c1066['attributes']=_[_0x91a2('0x37')](_0x2f0200[_0x91a2('0x34')],qs[_0x91a2('0x39')](_0x15e94a[_0x91a2('0x35')][_0x91a2('0x39')]));_0x5c1066['attributes']=_0x5c1066[_0x91a2('0x38')][_0x91a2('0x3a')]?_0x5c1066['attributes']:_0x2f0200['model'];_0x5c1066['order']=qs[_0x91a2('0x3e')](_0x15e94a[_0x91a2('0x35')][_0x91a2('0x3e')]);_0x5c1066['where']=qs[_0x91a2('0x40')](_['pick'](_0x15e94a[_0x91a2('0x35')],_0x2f0200[_0x91a2('0x40')]));if(_0x15e94a['query'][_0x91a2('0x56')]){_0x5c1066['where']=_[_0x91a2('0x41')](_0x5c1066[_0x91a2('0x43')],{'$or':_[_0x91a2('0x2e')](_0x5c1066[_0x91a2('0x38')],function(_0x6d5e00){var _0x2ccbc8={};_0x2ccbc8[_0x6d5e00]={'$like':'%'+_0x15e94a['query'][_0x91a2('0x56')]+'%'};return _0x2ccbc8;})});}_0x5c1066=_[_0x91a2('0x41')]({},_0x5c1066,_0x15e94a[_0x91a2('0x57')]);return _0x1f3e59[_0x91a2('0x89')](_0x5c1066);}})[_0x91a2('0x23')](function(_0x7d5a7b){if(_0x7d5a7b){_0xa86cd7=_0x7d5a7b['length'];if(!_0x15e94a['query'][_0x91a2('0x3b')]('nolimit')){_0x5c1066[_0x91a2('0x3d')]=qs['limit'](_0x15e94a[_0x91a2('0x35')][_0x91a2('0x3d')]);_0x5c1066[_0x91a2('0x1d')]=qs['offset'](_0x15e94a['query']['offset']);}return _0x1f3e59[_0x91a2('0x89')](_0x5c1066);}})[_0x91a2('0x23')](function(_0x1c9885){if(_0x1c9885){return _0x1c9885?{'count':_0xa86cd7,'rows':_0x1c9885}:null;}})[_0x91a2('0x23')](respondWithResult(_0x2bf7f7,null))[_0x91a2('0x46')](handleError(_0x2bf7f7,null));}; \ No newline at end of file +var _0xad5f=['type','key','model','query','keys','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','length','find','create','user','get','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','describe','findOne','UserOpenchannelQueue','hasOwnProperty','offset','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','ids','findAll','Agents','online','voicePause','interface','flatMap','transaction','addTeams','each','findOrCreate','emit','userOpenchannelQueue:save','field','tq.TeamId','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','union','compact','removeTeams','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','eml-format','fast-json-patch','bluebird','mustache','util','path','ejs','lodash','squel','to-csv','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','count','limit','set','Content-Range','json','apply','reject','update','then','OpenchannelQueues','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xad5f,0x172));var _0xfad5=function(_0x4d525c,_0x277dac){_0x4d525c=_0x4d525c-0x0;var _0x3f0655=_0xad5f[_0x4d525c];return _0x3f0655;};'use strict';var pdf=require(_0xfad5('0x0'));var emlformat=require(_0xfad5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfad5('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfad5('0x3'));var Mustache=require(_0xfad5('0x4'));var util=require(_0xfad5('0x5'));var path=require(_0xfad5('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfad5('0x7'));var fs=require('fs');var _=require(_0xfad5('0x8'));var squel=require(_0xfad5('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfad5('0xa'));var querystring=require('querystring');var Papa=require(_0xfad5('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfad5('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfad5('0xd'));var logger=require(_0xfad5('0xe'))(_0xfad5('0xf'));var utils=require(_0xfad5('0x10'));var config=require(_0xfad5('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xfad5('0x12'))['db'];config['redis']=_['defaults'](config[_0xfad5('0x13')],{'host':_0xfad5('0x14'),'port':0x18eb});var socket=require(_0xfad5('0x15'))(new Redis(config[_0xfad5('0x13')]));require(_0xfad5('0x16'))[_0xfad5('0x17')](socket);function respondWithStatusCode(_0x28cabc,_0x2eca4a){_0x2eca4a=_0x2eca4a||0xcc;return function(_0x1d0a43){if(_0x1d0a43){return _0x28cabc['sendStatus'](_0x2eca4a);}return _0x28cabc['status'](_0x2eca4a)['end']();};}function respondWithResult(_0x2c4a9c,_0x467578){_0x467578=_0x467578||0xc8;return function(_0x3d28f7){if(_0x3d28f7){return _0x2c4a9c[_0xfad5('0x18')](_0x467578)['json'](_0x3d28f7);}};}function respondWithFilteredResult(_0x25cca3,_0x1a4dce){return function(_0x40cb7b){if(_0x40cb7b){var _0x2a7650=_0x40cb7b[_0xfad5('0x19')],_0x4cbf7f=_0x1a4dce['offset'],_0x388640=_0x1a4dce['offset']+_0x1a4dce[_0xfad5('0x1a')],_0x5718a4;if(_0x388640>=_0x2a7650){_0x388640=_0x2a7650;_0x5718a4=0xc8;}else{_0x5718a4=0xce;}_0x25cca3[_0xfad5('0x18')](_0x5718a4);return _0x25cca3[_0xfad5('0x1b')](_0xfad5('0x1c'),_0x4cbf7f+'-'+_0x388640+'/'+_0x2a7650)[_0xfad5('0x1d')](_0x40cb7b);}return null;};}function patchUpdates(_0x28218a){return function(_0x5b91b5){try{jsonpatch[_0xfad5('0x1e')](_0x5b91b5,_0x28218a,!![]);}catch(_0x28159a){return BPromise[_0xfad5('0x1f')](_0x28159a);}return _0x5b91b5['save']();};}function saveUpdates(_0x38bf37,_0x2fae50){return function(_0x365bfe){if(_0x365bfe){return _0x365bfe[_0xfad5('0x20')](_0x38bf37)['then'](function(_0x3564cc){return _0x3564cc;});}return null;};}function removeEntity(_0x48c716,_0x3a8d05){return function(_0x4ffdac){if(_0x4ffdac){return _0x4ffdac['destroy']()[_0xfad5('0x21')](function(){var _0x2d3b13=_0x4ffdac['get']({'plain':!![]});var _0x5c9d8c=_0xfad5('0x22');return db[_0xfad5('0x23')]['destroy']({'where':{'type':_0x5c9d8c,'resourceId':_0x2d3b13['id']}})[_0xfad5('0x21')](function(){return _0x4ffdac;});})[_0xfad5('0x21')](function(){_0x48c716[_0xfad5('0x18')](0xcc)[_0xfad5('0x24')]();});}};}function handleEntityNotFound(_0x10c746,_0x4e61f3){return function(_0x546554){if(!_0x546554){_0x10c746[_0xfad5('0x25')](0x194);}return _0x546554;};}function handleError(_0x437575,_0x38236a){_0x38236a=_0x38236a||0x1f4;return function(_0xa18dd4){logger[_0xfad5('0x26')](_0xa18dd4[_0xfad5('0x27')]);if(_0xa18dd4[_0xfad5('0x28')]){delete _0xa18dd4[_0xfad5('0x28')];}_0x437575['status'](_0x38236a)[_0xfad5('0x29')](_0xa18dd4);};}exports[_0xfad5('0x2a')]=function(_0x2fe661,_0x3afae3){var _0x34da05={},_0x3bb04d={},_0x2a48a9={'count':0x0,'rows':[]};var _0x38677c=_[_0xfad5('0x2b')](db[_0xfad5('0x2c')][_0xfad5('0x2d')],function(_0x153ea9){return{'name':_0x153ea9[_0xfad5('0x2e')],'type':_0x153ea9[_0xfad5('0x2f')][_0xfad5('0x30')]};});_0x3bb04d[_0xfad5('0x31')]=_['map'](_0x38677c,_0xfad5('0x28'));_0x3bb04d[_0xfad5('0x32')]=_[_0xfad5('0x33')](_0x2fe661['query']);_0x3bb04d['filters']=_[_0xfad5('0x34')](_0x3bb04d[_0xfad5('0x31')],_0x3bb04d['query']);_0x34da05['attributes']=_[_0xfad5('0x34')](_0x3bb04d[_0xfad5('0x31')],qs[_0xfad5('0x35')](_0x2fe661[_0xfad5('0x32')][_0xfad5('0x35')]));_0x34da05[_0xfad5('0x36')]=_0x34da05['attributes']['length']?_0x34da05[_0xfad5('0x36')]:_0x3bb04d[_0xfad5('0x31')];if(!_0x2fe661[_0xfad5('0x32')]['hasOwnProperty'](_0xfad5('0x37'))){_0x34da05[_0xfad5('0x1a')]=qs[_0xfad5('0x1a')](_0x2fe661[_0xfad5('0x32')][_0xfad5('0x1a')]);_0x34da05['offset']=qs['offset'](_0x2fe661[_0xfad5('0x32')]['offset']);}_0x34da05[_0xfad5('0x38')]=qs[_0xfad5('0x39')](_0x2fe661[_0xfad5('0x32')][_0xfad5('0x39')]);_0x34da05[_0xfad5('0x3a')]=qs[_0xfad5('0x3b')](_[_0xfad5('0x3c')](_0x2fe661[_0xfad5('0x32')],_0x3bb04d['filters']),_0x38677c);if(_0x2fe661[_0xfad5('0x32')]['filter']){_0x34da05[_0xfad5('0x3a')]=_[_0xfad5('0x3d')](_0x34da05[_0xfad5('0x3a')],{'$or':_[_0xfad5('0x2b')](_0x38677c,function(_0x5f0eab){if(_0x5f0eab[_0xfad5('0x2f')]!==_0xfad5('0x3e')){var _0x3bc921={};_0x3bc921[_0x5f0eab[_0xfad5('0x28')]]={'$like':'%'+_0x2fe661['query'][_0xfad5('0x3f')]+'%'};return _0x3bc921;}})});}_0x34da05=_[_0xfad5('0x3d')]({},_0x34da05,_0x2fe661[_0xfad5('0x40')]);var _0x125a76={'where':_0x34da05[_0xfad5('0x3a')]};return db[_0xfad5('0x2c')]['count'](_0x125a76)[_0xfad5('0x21')](function(_0x4f01e3){_0x2a48a9[_0xfad5('0x19')]=_0x4f01e3;if(_0x2fe661[_0xfad5('0x32')][_0xfad5('0x41')]){_0x34da05[_0xfad5('0x42')]=[{'all':!![]}];}return db['OpenchannelQueue']['findAll'](_0x34da05);})[_0xfad5('0x21')](function(_0xc0bf94){_0x2a48a9[_0xfad5('0x43')]=_0xc0bf94;return _0x2a48a9;})[_0xfad5('0x21')](respondWithFilteredResult(_0x3afae3,_0x34da05))[_0xfad5('0x44')](handleError(_0x3afae3,null));};exports[_0xfad5('0x45')]=function(_0x4dada9,_0x5829bb){var _0x10a153={'raw':!![],'where':{'id':_0x4dada9[_0xfad5('0x46')]['id']}},_0x42fb68={};_0x42fb68[_0xfad5('0x31')]=_[_0xfad5('0x33')](db[_0xfad5('0x2c')][_0xfad5('0x2d')]);_0x42fb68[_0xfad5('0x32')]=_['keys'](_0x4dada9[_0xfad5('0x32')]);_0x42fb68[_0xfad5('0x3b')]=_[_0xfad5('0x34')](_0x42fb68['model'],_0x42fb68[_0xfad5('0x32')]);_0x10a153['attributes']=_[_0xfad5('0x34')](_0x42fb68[_0xfad5('0x31')],qs['fields'](_0x4dada9[_0xfad5('0x32')][_0xfad5('0x35')]));_0x10a153[_0xfad5('0x36')]=_0x10a153['attributes'][_0xfad5('0x47')]?_0x10a153['attributes']:_0x42fb68[_0xfad5('0x31')];if(_0x4dada9[_0xfad5('0x32')][_0xfad5('0x41')]){_0x10a153[_0xfad5('0x42')]=[{'all':!![]}];}_0x10a153=_['merge']({},_0x10a153,_0x4dada9[_0xfad5('0x40')]);return db['OpenchannelQueue'][_0xfad5('0x48')](_0x10a153)[_0xfad5('0x21')](handleEntityNotFound(_0x5829bb,null))['then'](respondWithResult(_0x5829bb,null))[_0xfad5('0x44')](handleError(_0x5829bb,null));};exports['create']=function(_0x59489f,_0x3a376f){return db[_0xfad5('0x2c')][_0xfad5('0x49')](_0x59489f['body'],{})[_0xfad5('0x21')](function(_0x2ee228){var _0x188a4b=_0x59489f[_0xfad5('0x4a')][_0xfad5('0x4b')]({'plain':!![]});if(!_0x188a4b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x188a4b[_0xfad5('0x4c')]==='user'){var _0x2b64dd=_0x2ee228[_0xfad5('0x4b')]({'plain':!![]});var _0x4df3a2='OpenchannelQueues';return db['UserProfileSection'][_0xfad5('0x48')]({'where':{'name':_0x4df3a2,'userProfileId':_0x188a4b[_0xfad5('0x4d')]},'raw':!![]})[_0xfad5('0x21')](function(_0x541ab2){if(_0x541ab2&&_0x541ab2[_0xfad5('0x4e')]===0x0){return db[_0xfad5('0x23')][_0xfad5('0x49')]({'name':_0x2b64dd[_0xfad5('0x28')],'resourceId':_0x2b64dd['id'],'type':_0x541ab2[_0xfad5('0x28')],'sectionId':_0x541ab2['id']},{})[_0xfad5('0x21')](function(){return _0x2ee228;});}else{return _0x2ee228;}})[_0xfad5('0x44')](function(_0x22867b){logger[_0xfad5('0x26')](_0xfad5('0x4f'),_0x22867b);throw _0x22867b;});}return _0x2ee228;})['then'](respondWithResult(_0x3a376f,0xc9))[_0xfad5('0x44')](handleError(_0x3a376f,null));};exports['update']=function(_0xce25df,_0x38f913){if(_0xce25df[_0xfad5('0x50')]['id']){delete _0xce25df[_0xfad5('0x50')]['id'];}return db[_0xfad5('0x2c')][_0xfad5('0x48')]({'where':{'id':_0xce25df['params']['id']}})[_0xfad5('0x21')](handleEntityNotFound(_0x38f913,null))['then'](saveUpdates(_0xce25df[_0xfad5('0x50')],null))[_0xfad5('0x21')](respondWithResult(_0x38f913,null))[_0xfad5('0x44')](handleError(_0x38f913,null));};exports[_0xfad5('0x51')]=function(_0x24105d,_0x326b90){return db[_0xfad5('0x2c')][_0xfad5('0x48')]({'where':{'id':_0x24105d[_0xfad5('0x46')]['id']}})['then'](handleEntityNotFound(_0x326b90,null))['then'](removeEntity(_0x326b90,null))[_0xfad5('0x44')](handleError(_0x326b90,null));};exports[_0xfad5('0x52')]=function(_0x2d83bb,_0x562289){return db[_0xfad5('0x2c')][_0xfad5('0x52')]()[_0xfad5('0x21')](respondWithResult(_0x562289,null))[_0xfad5('0x44')](handleError(_0x562289,null));};exports['getMembers']=function(_0x3f468d,_0x175cc9,_0x22fd8a){var _0x5ac890={'raw':!![],'where':{}},_0x5686f5={},_0x530030;return db['OpenchannelQueue'][_0xfad5('0x53')]({'where':{'id':_0x3f468d['params']['id']}})[_0xfad5('0x21')](handleEntityNotFound(_0x175cc9,null))[_0xfad5('0x21')](function(_0x22fead){if(_0x22fead){_0x530030=_0x22fead[_0xfad5('0x4b')]({'plain':!![]});_0x5686f5[_0xfad5('0x31')]=_[_0xfad5('0x33')](db[_0xfad5('0x54')]['rawAttributes']);_0x5686f5['query']=_[_0xfad5('0x33')](_0x3f468d[_0xfad5('0x32')]);_0x5686f5[_0xfad5('0x3b')]=_[_0xfad5('0x34')](_0x5686f5[_0xfad5('0x31')],_0x5686f5[_0xfad5('0x32')]);_0x5ac890[_0xfad5('0x36')]=_[_0xfad5('0x34')](_0x5686f5[_0xfad5('0x31')],qs[_0xfad5('0x35')](_0x3f468d[_0xfad5('0x32')][_0xfad5('0x35')]));_0x5ac890['attributes']=_0x5ac890[_0xfad5('0x36')][_0xfad5('0x47')]?_0x5ac890['attributes']:_0x5686f5['model'];if(!_0x3f468d[_0xfad5('0x32')][_0xfad5('0x55')](_0xfad5('0x37'))){_0x5ac890[_0xfad5('0x1a')]=qs[_0xfad5('0x1a')](_0x3f468d[_0xfad5('0x32')][_0xfad5('0x1a')]);_0x5ac890[_0xfad5('0x56')]=qs[_0xfad5('0x56')](_0x3f468d[_0xfad5('0x32')]['offset']);}_0x5ac890['order']=qs[_0xfad5('0x39')](_0x3f468d[_0xfad5('0x32')][_0xfad5('0x39')]);_0x5ac890[_0xfad5('0x3a')]=qs[_0xfad5('0x3b')](_[_0xfad5('0x3c')](_0x3f468d[_0xfad5('0x32')],_0x5686f5['filters']));_0x5ac890['where'][_0xfad5('0x57')]=_0x22fead['id'];if(_0x3f468d[_0xfad5('0x32')][_0xfad5('0x3f')]){_0x5ac890['where']=_[_0xfad5('0x3d')](_0x5ac890['where'],{'$or':_[_0xfad5('0x2b')](_0x5ac890['attributes'],function(_0x58bbe1){var _0x24b9fe={};_0x24b9fe[_0x58bbe1]={'$like':'%'+_0x3f468d[_0xfad5('0x32')][_0xfad5('0x3f')]+'%'};return _0x24b9fe;})});}_0x5ac890=_[_0xfad5('0x3d')]({},_0x5ac890,_0x3f468d[_0xfad5('0x40')]);return db[_0xfad5('0x54')]['findAll'](_0x5ac890);}})[_0xfad5('0x21')](function(_0xc8d596){if(_0xc8d596){return db[_0xfad5('0x58')][_0xfad5('0x59')]({'where':{'id':_[_0xfad5('0x2b')](_0xc8d596,_0xfad5('0x5a')),'role':_0xfad5('0x5b')},'attributes':['id',_0xfad5('0x28'),_0xfad5('0x5c'),'updatedAt','createdAt']});}})['then'](function(_0x1dd5ea){if(_0x1dd5ea){return{'count':_0x1dd5ea[_0xfad5('0x19')],'rows':_['map'](_0x1dd5ea[_0xfad5('0x43')],function(_0x2df1be){return{'membername':_0x2df1be[_0xfad5('0x28')],'UserId':_0x2df1be['id'],'queue_name':_0x530030['name'],'OpenchannelQueueId':_0x530030['id'],'interface':util[_0xfad5('0x5d')](_0xfad5('0x5e'),_0xfad5('0x5f'),_0x2df1be[_0xfad5('0x28')]),'penalty':0x0,'paused':_0x2df1be[_0xfad5('0x5c')],'createdAt':_0x2df1be[_0xfad5('0x60')],'updatedAt':_0x2df1be[_0xfad5('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x175cc9,_0x5ac890))[_0xfad5('0x44')](handleError(_0x175cc9,null));};exports[_0xfad5('0x62')]=function(_0xb2e120,_0x49b08d,_0x39f751){var _0x292b64={};var _0xb6efc1={};var _0x37d7a3;var _0x2ab112;return db[_0xfad5('0x2c')]['findOne']({'where':{'id':_0xb2e120[_0xfad5('0x46')]['id']}})[_0xfad5('0x21')](handleEntityNotFound(_0x49b08d,null))[_0xfad5('0x21')](function(_0x5c6946){if(_0x5c6946){_0x37d7a3=_0x5c6946;_0xb6efc1[_0xfad5('0x31')]=_[_0xfad5('0x33')](db[_0xfad5('0x63')][_0xfad5('0x2d')]);_0xb6efc1[_0xfad5('0x32')]=_[_0xfad5('0x33')](_0xb2e120['query']);_0xb6efc1[_0xfad5('0x3b')]=_[_0xfad5('0x34')](_0xb6efc1[_0xfad5('0x31')],_0xb6efc1['query']);_0x292b64[_0xfad5('0x36')]=_[_0xfad5('0x34')](_0xb6efc1[_0xfad5('0x31')],qs['fields'](_0xb2e120[_0xfad5('0x32')][_0xfad5('0x35')]));_0x292b64[_0xfad5('0x36')]=_0x292b64[_0xfad5('0x36')][_0xfad5('0x47')]?_0x292b64[_0xfad5('0x36')]:_0xb6efc1[_0xfad5('0x31')];_0x292b64['order']=qs[_0xfad5('0x39')](_0xb2e120[_0xfad5('0x32')][_0xfad5('0x39')]);_0x292b64['where']=qs[_0xfad5('0x3b')](_[_0xfad5('0x3c')](_0xb2e120['query'],_0xb6efc1[_0xfad5('0x3b')]));if(_0xb2e120['query'][_0xfad5('0x3f')]){_0x292b64[_0xfad5('0x3a')]=_['merge'](_0x292b64[_0xfad5('0x3a')],{'$or':_[_0xfad5('0x2b')](_0x292b64[_0xfad5('0x36')],function(_0x140cb2){var _0x3d7a92={};_0x3d7a92[_0x140cb2]={'$like':'%'+_0xb2e120[_0xfad5('0x32')][_0xfad5('0x3f')]+'%'};return _0x3d7a92;})});}_0x292b64=_[_0xfad5('0x3d')]({},_0x292b64,_0xb2e120[_0xfad5('0x40')]);return _0x37d7a3['getTeams'](_0x292b64);}})['then'](function(_0x545fa6){if(_0x545fa6){_0x2ab112=_0x545fa6['length'];if(!_0xb2e120[_0xfad5('0x32')][_0xfad5('0x55')]('nolimit')){_0x292b64[_0xfad5('0x1a')]=qs[_0xfad5('0x1a')](_0xb2e120[_0xfad5('0x32')][_0xfad5('0x1a')]);_0x292b64['offset']=qs[_0xfad5('0x56')](_0xb2e120[_0xfad5('0x32')][_0xfad5('0x56')]);}return _0x37d7a3['getTeams'](_0x292b64);}})['then'](function(_0x684f4b){if(_0x684f4b){return _0x684f4b?{'count':_0x2ab112,'rows':_0x684f4b}:null;}})['then'](respondWithResult(_0x49b08d,null))['catch'](handleError(_0x49b08d,null));};exports['addTeams']=function(_0x5ccb1d,_0x1c1486,_0x797712){var _0x417bc9=_0x5ccb1d[_0xfad5('0x50')][_0xfad5('0x64')];return db[_0xfad5('0x63')][_0xfad5('0x65')]({'where':{'id':_0x417bc9},'attributes':['id'],'include':[{'model':db[_0xfad5('0x58')],'as':_0xfad5('0x66'),'attributes':['id',_0xfad5('0x28'),_0xfad5('0x67'),_0xfad5('0x68'),_0xfad5('0x69')],'raw':!![]}]})[_0xfad5('0x21')](function(_0xdb8ff0){if(_0xdb8ff0){var _0x5a07c3=_[_0xfad5('0x6a')](_0xdb8ff0,function(_0x44c041){var _0x9c5e6f=_0x44c041[_0xfad5('0x4b')]({'plain':!![]});return _0x9c5e6f[_0xfad5('0x66')];});return db[_0xfad5('0x2c')][_0xfad5('0x48')]({'where':{'id':_0x5ccb1d[_0xfad5('0x46')]['id']}})[_0xfad5('0x21')](function(_0x222658){return db['sequelize'][_0xfad5('0x6b')](function(_0x39662b){return _0x222658[_0xfad5('0x6c')](_0x417bc9,{'transaction':_0x39662b})[_0xfad5('0x21')](function(){return BPromise[_0xfad5('0x6d')](_0x5a07c3,function(_0x4e0084){return db[_0xfad5('0x54')][_0xfad5('0x6e')]({'where':{'UserId':_0x4e0084['id'],'OpenchannelQueueId':_0x5ccb1d[_0xfad5('0x46')]['id']},'transaction':_0x39662b});});})[_0xfad5('0x21')](function(){_0x5a07c3['forEach'](function(_0x320db6){socket[_0xfad5('0x6f')](_0xfad5('0x70'),{'UserId':_0x320db6['id'],'OpenchannelQueueId':_0x222658['id']});});});});});}})[_0xfad5('0x21')](respondWithStatusCode(_0x1c1486,null))[_0xfad5('0x44')](handleError(_0x1c1486,null));};exports['removeTeams']=function(_0x5e5db5,_0x5d0f98,_0x443df8){return db[_0xfad5('0x63')][_0xfad5('0x65')]({'where':{'id':_0x5e5db5[_0xfad5('0x32')][_0xfad5('0x64')]},'attributes':['id'],'include':[{'model':db[_0xfad5('0x58')],'as':_0xfad5('0x66'),'attributes':['id'],'raw':!![]}]})[_0xfad5('0x21')](handleEntityNotFound(_0x5d0f98,null))[_0xfad5('0x21')](function(_0x461625){var _0x5209bc=_[_0xfad5('0x2b')](_0x461625,'id');var _0x18d42f=[];var _0x17a489=[];var _0x833dd4=squel['select']();_0x833dd4[_0xfad5('0x71')](_0xfad5('0x72'))['from'](_0xfad5('0x73'),'tq')[_0xfad5('0x74')]('user_has_teams','ut',_0xfad5('0x75'))[_0xfad5('0x3a')]('OpenchannelQueueId\x20=\x20?',_0x5e5db5[_0xfad5('0x46')]['id']);for(var _0x301b54=0x0;_0x301b54<_0x461625[_0xfad5('0x47')];_0x301b54+=0x1){let _0x224793=_0x461625[_0x301b54];for(var _0x2e752e=0x0;_0x2e752e<_0x224793[_0xfad5('0x66')][_0xfad5('0x47')];_0x2e752e+=0x1){let _0x1ead8b=_0x224793['Agents'][_0x2e752e];var _0x110978=_0x833dd4[_0xfad5('0x76')]();_0x110978[_0xfad5('0x3a')](_0xfad5('0x77'),_0x1ead8b['id']);_0x17a489[_0xfad5('0x78')](db[_0xfad5('0x79')][_0xfad5('0x32')](_0x110978[_0xfad5('0x7a')](),{'type':db[_0xfad5('0x79')][_0xfad5('0x7b')][_0xfad5('0x7c')]})['then'](function(_0xf60ccb){if(_0xf60ccb[_0xfad5('0x47')]===0x1){return _0x1ead8b['id'];}else{var _0x362ad4=_[_0xfad5('0x7d')](_[_0xfad5('0x2b')](_0xf60ccb,_0xfad5('0x7e')),function(_0x6887a){return _['includes'](_0x5209bc,_0x6887a);});if(_0x362ad4){return _0x1ead8b['id'];}}}));}}return BPromise['all'](_0x17a489)[_0xfad5('0x21')](function(_0x3544fa){_0x18d42f=_(_0x18d42f)[_0xfad5('0x7f')](_0x3544fa)[_0xfad5('0x80')]()['value']();return db[_0xfad5('0x2c')][_0xfad5('0x48')]({'where':{'id':_0x5e5db5[_0xfad5('0x46')]['id']}})[_0xfad5('0x21')](function(_0x3f9e87){return db[_0xfad5('0x79')][_0xfad5('0x6b')](function(_0x473bc6){return _0x3f9e87[_0xfad5('0x81')](_0x5e5db5[_0xfad5('0x32')][_0xfad5('0x64')],{'transaction':_0x473bc6})['then'](function(){if(!_[_0xfad5('0x82')](_0x18d42f)){return _0x3f9e87[_0xfad5('0x83')](_0x18d42f,{'transaction':_0x473bc6});}})[_0xfad5('0x21')](function(){_0x18d42f[_0xfad5('0x84')](function(_0x5253f3){socket[_0xfad5('0x6f')](_0xfad5('0x85'),{'UserId':_0x5253f3,'OpenchannelQueueId':_0x3f9e87['id']});});});});});});})['then'](respondWithStatusCode(_0x5d0f98,null))[_0xfad5('0x44')](handleError(_0x5d0f98,null));};exports[_0xfad5('0x86')]=function(_0xb03423,_0x2ca53d,_0x3f62d2){return db[_0xfad5('0x2c')]['find']({'where':{'id':_0xb03423[_0xfad5('0x46')]['id']}})[_0xfad5('0x21')](handleEntityNotFound(_0x2ca53d,null))[_0xfad5('0x21')](function(_0x138c74){if(_0x138c74){return _0x138c74[_0xfad5('0x86')](_0xb03423[_0xfad5('0x50')][_0xfad5('0x64')],_[_0xfad5('0x87')](_0xb03423['body'],[_0xfad5('0x64'),'id'])||{})[_0xfad5('0x88')](function(_0x36341a){for(var _0x4c92e9=0x0;_0x4c92e9<_0xb03423[_0xfad5('0x50')][_0xfad5('0x64')]['length'];_0x4c92e9+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':_0xb03423[_0xfad5('0x50')][_0xfad5('0x64')][_0x4c92e9],'OpenchannelQueueId':_0xb03423[_0xfad5('0x46')]['id']});}return _0x36341a;});}})[_0xfad5('0x21')](respondWithResult(_0x2ca53d,null))[_0xfad5('0x44')](handleError(_0x2ca53d,null));};exports[_0xfad5('0x83')]=function(_0x40c325,_0x5e32cd,_0x5409c7){return db[_0xfad5('0x2c')][_0xfad5('0x48')]({'where':{'id':_0x40c325[_0xfad5('0x46')]['id']}})['then'](handleEntityNotFound(_0x5e32cd,null))[_0xfad5('0x21')](function(_0x5189c8){if(_0x5189c8){return _0x5189c8[_0xfad5('0x83')](_0x40c325[_0xfad5('0x32')][_0xfad5('0x64')])[_0xfad5('0x21')](function(){if(_[_0xfad5('0x89')](_0x40c325[_0xfad5('0x32')][_0xfad5('0x64')])){for(var _0x193563=0x0;_0x193563<_0x40c325[_0xfad5('0x32')][_0xfad5('0x64')][_0xfad5('0x47')];_0x193563+=0x1){socket[_0xfad5('0x6f')](_0xfad5('0x85'),{'UserId':Number(_0x40c325[_0xfad5('0x32')][_0xfad5('0x64')][_0x193563]),'OpenchannelQueueId':Number(_0x40c325[_0xfad5('0x46')]['id'])});}}else{socket[_0xfad5('0x6f')](_0xfad5('0x85'),{'UserId':Number(_0x40c325[_0xfad5('0x32')][_0xfad5('0x64')]),'OpenchannelQueueId':Number(_0x40c325[_0xfad5('0x46')]['id'])});}});}})['then'](respondWithStatusCode(_0x5e32cd,null))[_0xfad5('0x44')](handleError(_0x5e32cd,null));};exports[_0xfad5('0x8a')]=function(_0x44ebd4,_0x5205d4,_0x328ce8){var _0x42dfd3={};var _0x4bb11f={};var _0x1ef077;var _0x45daff;return db[_0xfad5('0x2c')][_0xfad5('0x53')]({'where':{'id':_0x44ebd4[_0xfad5('0x46')]['id']}})['then'](handleEntityNotFound(_0x5205d4,null))[_0xfad5('0x21')](function(_0x296570){if(_0x296570){_0x1ef077=_0x296570;_0x4bb11f[_0xfad5('0x31')]=_[_0xfad5('0x33')](db[_0xfad5('0x58')][_0xfad5('0x2d')]);_0x4bb11f[_0xfad5('0x32')]=_[_0xfad5('0x33')](_0x44ebd4[_0xfad5('0x32')]);_0x4bb11f['filters']=_[_0xfad5('0x34')](_0x4bb11f[_0xfad5('0x31')],_0x4bb11f[_0xfad5('0x32')]);_0x42dfd3[_0xfad5('0x36')]=_[_0xfad5('0x34')](_0x4bb11f[_0xfad5('0x31')],qs['fields'](_0x44ebd4[_0xfad5('0x32')][_0xfad5('0x35')]));_0x42dfd3[_0xfad5('0x36')]=_0x42dfd3[_0xfad5('0x36')]['length']?_0x42dfd3[_0xfad5('0x36')]:_0x4bb11f[_0xfad5('0x31')];_0x42dfd3[_0xfad5('0x38')]=qs[_0xfad5('0x39')](_0x44ebd4['query'][_0xfad5('0x39')]);_0x42dfd3['where']=qs['filters'](_[_0xfad5('0x3c')](_0x44ebd4[_0xfad5('0x32')],_0x4bb11f[_0xfad5('0x3b')]));if(_0x44ebd4[_0xfad5('0x32')][_0xfad5('0x3f')]){_0x42dfd3['where']=_[_0xfad5('0x3d')](_0x42dfd3[_0xfad5('0x3a')],{'$or':_[_0xfad5('0x2b')](_0x42dfd3[_0xfad5('0x36')],function(_0x307011){var _0x1d64ad={};_0x1d64ad[_0x307011]={'$like':'%'+_0x44ebd4[_0xfad5('0x32')]['filter']+'%'};return _0x1d64ad;})});}_0x42dfd3=_[_0xfad5('0x3d')]({},_0x42dfd3,_0x44ebd4[_0xfad5('0x40')]);return _0x1ef077[_0xfad5('0x8a')](_0x42dfd3);}})[_0xfad5('0x21')](function(_0x5df062){if(_0x5df062){_0x45daff=_0x5df062[_0xfad5('0x47')];if(!_0x44ebd4[_0xfad5('0x32')][_0xfad5('0x55')](_0xfad5('0x37'))){_0x42dfd3['limit']=qs[_0xfad5('0x1a')](_0x44ebd4[_0xfad5('0x32')][_0xfad5('0x1a')]);_0x42dfd3[_0xfad5('0x56')]=qs[_0xfad5('0x56')](_0x44ebd4[_0xfad5('0x32')][_0xfad5('0x56')]);}return _0x1ef077[_0xfad5('0x8a')](_0x42dfd3);}})[_0xfad5('0x21')](function(_0xb7f881){if(_0xb7f881){return _0xb7f881?{'count':_0x45daff,'rows':_0xb7f881}:null;}})['then'](respondWithResult(_0x5205d4,null))[_0xfad5('0x44')](handleError(_0x5205d4,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 2a10901..912647d 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 _0x7553=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x8582f3,_0x46df44){var _0x5ec81c=function(_0x4813d0){while(--_0x4813d0){_0x8582f3['push'](_0x8582f3['shift']());}};_0x5ec81c(++_0x46df44);}(_0x7553,0x19a));var _0x3755=function(_0x5b6dd2,_0x43f939){_0x5b6dd2=_0x5b6dd2-0x0;var _0x4a62e8=_0x7553[_0x5b6dd2];return _0x4a62e8;};'use strict';var EventEmitter=require(_0x3755('0x0'));var OpenchannelQueue=require(_0x3755('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x3755('0x2')](0x0);var events={'afterCreate':_0x3755('0x3'),'afterUpdate':_0x3755('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1b6cb6){return function(_0x146d2f,_0x2fd2a9,_0x2c72d3){OpenchannelQueueEvents[_0x3755('0x5')](_0x1b6cb6+':'+_0x146d2f['id'],_0x146d2f);OpenchannelQueueEvents[_0x3755('0x5')](_0x1b6cb6,_0x146d2f);_0x2c72d3(null);};}for(var e in events){if(events[_0x3755('0x6')](e)){var event=events[e];OpenchannelQueue[_0x3755('0x7')](e,emitEvent(event));}}module[_0x3755('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x7da2=['hook','exports','events','../../mysqldb','OpenchannelQueue','save','update','remove','emit','hasOwnProperty'];(function(_0x198372,_0x137bbf){var _0x161a97=function(_0x461828){while(--_0x461828){_0x198372['push'](_0x198372['shift']());}};_0x161a97(++_0x137bbf);}(_0x7da2,0x14c));var _0x27da=function(_0x579891,_0x38f869){_0x579891=_0x579891-0x0;var _0x1b07b4=_0x7da2[_0x579891];return _0x1b07b4;};'use strict';var EventEmitter=require(_0x27da('0x0'));var OpenchannelQueue=require(_0x27da('0x1'))['db'][_0x27da('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x27da('0x3'),'afterUpdate':_0x27da('0x4'),'afterDestroy':_0x27da('0x5')};function emitEvent(_0xbcd776){return function(_0x11c5cf,_0x3b65c9,_0x3bd5c6){OpenchannelQueueEvents['emit'](_0xbcd776+':'+_0x11c5cf['id'],_0x11c5cf);OpenchannelQueueEvents[_0x27da('0x6')](_0xbcd776,_0x11c5cf);_0x3bd5c6(null);};}for(var e in events){if(events[_0x27da('0x7')](e)){var event=events[e];OpenchannelQueue[_0x27da('0x8')](e,emitEvent(event));}}module[_0x27da('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index d98b85b..b625ebe 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 _0xf7b4=['path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','api','moment'];(function(_0x50f9ee,_0x453849){var _0x39e025=function(_0x74f170){while(--_0x74f170){_0x50f9ee['push'](_0x50f9ee['shift']());}};_0x39e025(++_0x453849);}(_0xf7b4,0x152));var _0x4f7b=function(_0x2f60f5,_0xcbf7cb){_0x2f60f5=_0x2f60f5-0x0;var _0x28ec03=_0xf7b4[_0x2f60f5];return _0x28ec03;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4f7b('0x1'));var moment=require(_0x4f7b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f7b('0x3'));var rimraf=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var attributes=require(_0x4f7b('0x6'));module[_0x4f7b('0x7')]=function(_0x2637f0,_0x427f8b){return _0x2637f0[_0x4f7b('0x8')](_0x4f7b('0x9'),attributes,{'tableName':_0x4f7b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa83a=['request-promise','path','rimraf','./openchannelQueue.attributes','exports','define','util','../../config/logger','moment','bluebird'];(function(_0x57404d,_0x512ec){var _0x4a1b56=function(_0xf54a94){while(--_0xf54a94){_0x57404d['push'](_0x57404d['shift']());}};_0x4a1b56(++_0x512ec);}(_0xa83a,0x88));var _0xaa83=function(_0xfe3d00,_0x259f8e){_0xfe3d00=_0xfe3d00-0x0;var _0x3204d2=_0xa83a[_0xfe3d00];return _0x3204d2;};'use strict';var _=require('lodash');var util=require(_0xaa83('0x0'));var logger=require(_0xaa83('0x1'))('api');var moment=require(_0xaa83('0x2'));var BPromise=require(_0xaa83('0x3'));var rp=require(_0xaa83('0x4'));var fs=require('fs');var path=require(_0xaa83('0x5'));var rimraf=require(_0xaa83('0x6'));var config=require('../../config/environment');var attributes=require(_0xaa83('0x7'));module[_0xaa83('0x8')]=function(_0x280637,_0x9c332d){return _0x280637[_0xaa83('0x9')]('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 df0e9ce..8673565 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 _0x4517=['OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','findAll','options','raw','where','limit','include','map','model','attributes','debug','ShowOpenchannelQueue','OpenchannelQueue','find','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4517,0x17d));var _0x7451=function(_0x2dc9ef,_0x36ed96){_0x2dc9ef=_0x2dc9ef-0x0;var _0xbeb7ff=_0x4517[_0x2dc9ef];return _0xbeb7ff;};'use strict';var _=require(_0x7451('0x0'));var util=require(_0x7451('0x1'));var moment=require(_0x7451('0x2'));var BPromise=require('bluebird');var rs=require(_0x7451('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7451('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7451('0x5'))(_0x7451('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7451('0x7')][_0x7451('0x8')]({'port':0x232a});config[_0x7451('0x9')]=_[_0x7451('0xa')](config[_0x7451('0x9')],{'host':_0x7451('0xb'),'port':0x18eb});var socket=require(_0x7451('0xc'))(new Redis(config[_0x7451('0x9')]));require(_0x7451('0xd'))[_0x7451('0xe')](socket);function respondWithRpcPromise(_0x53625c,_0x22afc1,_0x571072){return new BPromise(function(_0x494287,_0x142602){return client['request'](_0x53625c,_0x571072)[_0x7451('0xf')](function(_0x1665f6){logger[_0x7451('0x10')](_0x7451('0x11'),_0x22afc1,_0x7451('0x12'));logger['debug'](_0x7451('0x13'),_0x22afc1,'request\x20sent',JSON[_0x7451('0x14')](_0x1665f6));if(_0x1665f6[_0x7451('0x15')]){if(_0x1665f6['error'][_0x7451('0x16')]===0x1f4){logger[_0x7451('0x15')](_0x7451('0x11'),_0x22afc1,_0x1665f6[_0x7451('0x15')][_0x7451('0x17')]);return _0x142602(_0x1665f6[_0x7451('0x15')][_0x7451('0x17')]);}logger['error'](_0x7451('0x11'),_0x22afc1,_0x1665f6[_0x7451('0x15')][_0x7451('0x17')]);return _0x494287(_0x1665f6['error'][_0x7451('0x17')]);}else{logger[_0x7451('0x10')](_0x7451('0x11'),_0x22afc1,_0x7451('0x12'));_0x494287(_0x1665f6[_0x7451('0x18')][_0x7451('0x17')]);}})[_0x7451('0x19')](function(_0x2edde3){logger[_0x7451('0x15')](_0x7451('0x11'),_0x22afc1,_0x2edde3);_0x142602(_0x2edde3);});});}exports[_0x7451('0x1a')]=function(_0x13baf5){var _0x4db8cc=this;return new Promise(function(_0x57a01d,_0x761b03){return db['OpenchannelQueue'][_0x7451('0x1b')]({'raw':_0x13baf5[_0x7451('0x1c')]?_0x13baf5[_0x7451('0x1c')][_0x7451('0x1d')]===undefined?!![]:![]:!![],'where':_0x13baf5[_0x7451('0x1c')]?_0x13baf5[_0x7451('0x1c')][_0x7451('0x1e')]||null:null,'attributes':_0x13baf5[_0x7451('0x1c')]?_0x13baf5[_0x7451('0x1c')]['attributes']||null:null,'limit':_0x13baf5['options']?_0x13baf5[_0x7451('0x1c')][_0x7451('0x1f')]||null:null,'include':_0x13baf5[_0x7451('0x1c')]?_0x13baf5[_0x7451('0x1c')][_0x7451('0x20')]?_[_0x7451('0x21')](_0x13baf5[_0x7451('0x1c')][_0x7451('0x20')],function(_0x19b222){return{'model':db[_0x19b222[_0x7451('0x22')]],'as':_0x19b222['as'],'attributes':_0x19b222['attributes'],'include':_0x19b222[_0x7451('0x20')]?_[_0x7451('0x21')](_0x19b222['include'],function(_0x46fab8){return{'model':db[_0x46fab8[_0x7451('0x22')]],'as':_0x46fab8['as'],'attributes':_0x46fab8[_0x7451('0x23')],'include':_0x46fab8[_0x7451('0x20')]?_[_0x7451('0x21')](_0x46fab8[_0x7451('0x20')],function(_0x160dcc){return{'model':db[_0x160dcc['model']],'as':_0x160dcc['as'],'attributes':_0x160dcc[_0x7451('0x23')]};}):[]};}):[]};}):[]:[]})[_0x7451('0xf')](function(_0x18592e){logger[_0x7451('0x10')](_0x7451('0x1a'),_0x13baf5);logger[_0x7451('0x24')](_0x7451('0x1a'),_0x13baf5,JSON[_0x7451('0x14')](_0x18592e));_0x57a01d(_0x18592e);})[_0x7451('0x19')](function(_0x292d2d){logger[_0x7451('0x15')](_0x7451('0x1a'),_0x292d2d[_0x7451('0x17')],_0x13baf5);_0x761b03(_0x4db8cc[_0x7451('0x15')](0x1f4,_0x292d2d['message']));});});};exports[_0x7451('0x25')]=function(_0x1aff06){var _0x5a2dee=this;return new Promise(function(_0x4ceaac,_0x1e3eee){return db[_0x7451('0x26')][_0x7451('0x27')]({'raw':_0x1aff06[_0x7451('0x1c')]?_0x1aff06['options'][_0x7451('0x1d')]===undefined?!![]:![]:!![],'where':_0x1aff06[_0x7451('0x1c')]?_0x1aff06[_0x7451('0x1c')]['where']||null:null,'attributes':_0x1aff06[_0x7451('0x1c')]?_0x1aff06[_0x7451('0x1c')][_0x7451('0x23')]||null:null,'include':_0x1aff06['options']?_0x1aff06[_0x7451('0x1c')][_0x7451('0x20')]?_[_0x7451('0x21')](_0x1aff06['options']['include'],function(_0x16a112){return{'model':db[_0x16a112[_0x7451('0x22')]],'as':_0x16a112['as'],'attributes':_0x16a112['attributes'],'include':_0x16a112[_0x7451('0x20')]?_[_0x7451('0x21')](_0x16a112[_0x7451('0x20')],function(_0x472e69){return{'model':db[_0x472e69['model']],'as':_0x472e69['as'],'attributes':_0x472e69[_0x7451('0x23')],'include':_0x472e69[_0x7451('0x20')]?_[_0x7451('0x21')](_0x472e69[_0x7451('0x20')],function(_0x31bb8b){return{'model':db[_0x31bb8b[_0x7451('0x22')]],'as':_0x31bb8b['as'],'attributes':_0x31bb8b[_0x7451('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1419a8){logger[_0x7451('0x10')]('ShowOpenchannelQueue',_0x1aff06);logger['debug'](_0x7451('0x25'),_0x1aff06,JSON[_0x7451('0x14')](_0x1419a8));_0x4ceaac(_0x1419a8);})['catch'](function(_0x144aa5){logger['error'](_0x7451('0x25'),_0x144aa5['message'],_0x1aff06);_0x1e3eee(_0x5a2dee['error'](0x1f4,_0x144aa5[_0x7451('0x17')]));});});}; \ No newline at end of file +var _0xd151=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','limit','include','map','model','attributes','ShowOpenchannelQueue','raw','then','lodash','util','bluebird','randomstring','../../mysqldb'];(function(_0x51a6d6,_0x3c9c49){var _0x5ef1a8=function(_0x8ff84a){while(--_0x8ff84a){_0x51a6d6['push'](_0x51a6d6['shift']());}};_0x5ef1a8(++_0x3c9c49);}(_0xd151,0x1a8));var _0x1d15=function(_0x2335e6,_0x1bade8){_0x2335e6=_0x2335e6-0x0;var _0x370a50=_0xd151[_0x2335e6];return _0x370a50;};'use strict';var _=require(_0x1d15('0x0'));var util=require(_0x1d15('0x1'));var moment=require('moment');var BPromise=require(_0x1d15('0x2'));var rs=require(_0x1d15('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d15('0x4'))['db'];var utils=require(_0x1d15('0x5'));var logger=require(_0x1d15('0x6'))('rpc');var config=require(_0x1d15('0x7'));var jayson=require(_0x1d15('0x8'));var client=jayson[_0x1d15('0x9')][_0x1d15('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x1d15('0xb')],{'host':_0x1d15('0xc'),'port':0x18eb});var socket=require(_0x1d15('0xd'))(new Redis(config['redis']));require(_0x1d15('0xe'))[_0x1d15('0xf')](socket);function respondWithRpcPromise(_0x147162,_0x5a43a2,_0x335f0d){return new BPromise(function(_0x3b071e,_0x1392d6){return client[_0x1d15('0x10')](_0x147162,_0x335f0d)['then'](function(_0xa10a5){logger['info'](_0x1d15('0x11'),_0x5a43a2,'request\x20sent');logger[_0x1d15('0x12')](_0x1d15('0x13'),_0x5a43a2,_0x1d15('0x14'),JSON[_0x1d15('0x15')](_0xa10a5));if(_0xa10a5['error']){if(_0xa10a5[_0x1d15('0x16')][_0x1d15('0x17')]===0x1f4){logger['error'](_0x1d15('0x11'),_0x5a43a2,_0xa10a5[_0x1d15('0x16')][_0x1d15('0x18')]);return _0x1392d6(_0xa10a5[_0x1d15('0x16')]['message']);}logger[_0x1d15('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x5a43a2,_0xa10a5[_0x1d15('0x16')][_0x1d15('0x18')]);return _0x3b071e(_0xa10a5[_0x1d15('0x16')][_0x1d15('0x18')]);}else{logger[_0x1d15('0x19')](_0x1d15('0x11'),_0x5a43a2,'request\x20sent');_0x3b071e(_0xa10a5['result'][_0x1d15('0x18')]);}})['catch'](function(_0x52b2da){logger[_0x1d15('0x16')](_0x1d15('0x11'),_0x5a43a2,_0x52b2da);_0x1392d6(_0x52b2da);});});}exports[_0x1d15('0x1a')]=function(_0x1a29fc){var _0x5bc6ed=this;return new Promise(function(_0x1c4b70,_0x37595d){return db[_0x1d15('0x1b')][_0x1d15('0x1c')]({'raw':_0x1a29fc[_0x1d15('0x1d')]?_0x1a29fc['options']['raw']===undefined?!![]:![]:!![],'where':_0x1a29fc[_0x1d15('0x1d')]?_0x1a29fc[_0x1d15('0x1d')][_0x1d15('0x1e')]||null:null,'attributes':_0x1a29fc[_0x1d15('0x1d')]?_0x1a29fc[_0x1d15('0x1d')]['attributes']||null:null,'limit':_0x1a29fc['options']?_0x1a29fc['options'][_0x1d15('0x1f')]||null:null,'include':_0x1a29fc[_0x1d15('0x1d')]?_0x1a29fc[_0x1d15('0x1d')][_0x1d15('0x20')]?_[_0x1d15('0x21')](_0x1a29fc[_0x1d15('0x1d')][_0x1d15('0x20')],function(_0x52430c){return{'model':db[_0x52430c[_0x1d15('0x22')]],'as':_0x52430c['as'],'attributes':_0x52430c[_0x1d15('0x23')],'include':_0x52430c[_0x1d15('0x20')]?_[_0x1d15('0x21')](_0x52430c[_0x1d15('0x20')],function(_0x30eead){return{'model':db[_0x30eead[_0x1d15('0x22')]],'as':_0x30eead['as'],'attributes':_0x30eead[_0x1d15('0x23')],'include':_0x30eead[_0x1d15('0x20')]?_[_0x1d15('0x21')](_0x30eead[_0x1d15('0x20')],function(_0x2fd8a7){return{'model':db[_0x2fd8a7[_0x1d15('0x22')]],'as':_0x2fd8a7['as'],'attributes':_0x2fd8a7[_0x1d15('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5af915){logger[_0x1d15('0x19')]('GetOpenchannelQueue',_0x1a29fc);logger[_0x1d15('0x12')](_0x1d15('0x1a'),_0x1a29fc,JSON[_0x1d15('0x15')](_0x5af915));_0x1c4b70(_0x5af915);})['catch'](function(_0xea20ff){logger['error']('GetOpenchannelQueue',_0xea20ff[_0x1d15('0x18')],_0x1a29fc);_0x37595d(_0x5bc6ed[_0x1d15('0x16')](0x1f4,_0xea20ff['message']));});});};exports[_0x1d15('0x24')]=function(_0x156b97){var _0x32050b=this;return new Promise(function(_0x3c0bcf,_0x491e24){return db[_0x1d15('0x1b')]['find']({'raw':_0x156b97['options']?_0x156b97[_0x1d15('0x1d')][_0x1d15('0x25')]===undefined?!![]:![]:!![],'where':_0x156b97['options']?_0x156b97[_0x1d15('0x1d')][_0x1d15('0x1e')]||null:null,'attributes':_0x156b97[_0x1d15('0x1d')]?_0x156b97['options'][_0x1d15('0x23')]||null:null,'include':_0x156b97[_0x1d15('0x1d')]?_0x156b97['options'][_0x1d15('0x20')]?_[_0x1d15('0x21')](_0x156b97['options'][_0x1d15('0x20')],function(_0x2a6838){return{'model':db[_0x2a6838[_0x1d15('0x22')]],'as':_0x2a6838['as'],'attributes':_0x2a6838['attributes'],'include':_0x2a6838['include']?_[_0x1d15('0x21')](_0x2a6838[_0x1d15('0x20')],function(_0x3e3214){return{'model':db[_0x3e3214[_0x1d15('0x22')]],'as':_0x3e3214['as'],'attributes':_0x3e3214[_0x1d15('0x23')],'include':_0x3e3214['include']?_['map'](_0x3e3214[_0x1d15('0x20')],function(_0x281806){return{'model':db[_0x281806[_0x1d15('0x22')]],'as':_0x281806['as'],'attributes':_0x281806['attributes']};}):[]};}):[]};}):[]:[]})[_0x1d15('0x26')](function(_0x21c236){logger['info']('ShowOpenchannelQueue',_0x156b97);logger['debug'](_0x1d15('0x24'),_0x156b97,JSON[_0x1d15('0x15')](_0x21c236));_0x3c0bcf(_0x21c236);})['catch'](function(_0x570bd0){logger['error'](_0x1d15('0x24'),_0x570bd0[_0x1d15('0x18')],_0x156b97);_0x491e24(_0x32050b[_0x1d15('0x16')](0x1f4,_0x570bd0[_0x1d15('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 59b1cb2..ed45a8c 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 _0xbab7=['save','update','emit','removeListener','./openchannelQueue.events'];(function(_0xd34e50,_0x5edfe0){var _0x42ecb9=function(_0x28535a){while(--_0x28535a){_0xd34e50['push'](_0xd34e50['shift']());}};_0x42ecb9(++_0x5edfe0);}(_0xbab7,0x72));var _0x7bab=function(_0x30dbae,_0x323301){_0x30dbae=_0x30dbae-0x0;var _0x1ce5bf=_0xbab7[_0x30dbae];return _0x1ce5bf;};'use strict';var OpenchannelQueueEvents=require(_0x7bab('0x0'));var events=[_0x7bab('0x1'),'remove',_0x7bab('0x2')];function createListener(_0x376a62,_0x15e427){return function(_0x4789e5){_0x15e427[_0x7bab('0x3')](_0x376a62,_0x4789e5);};}function removeListener(_0x3f5ec6,_0x4f425e){return function(){OpenchannelQueueEvents[_0x7bab('0x4')](_0x3f5ec6,_0x4f425e);};}exports['register']=function(_0x2de1a4){for(var _0x48da58=0x0,_0x323bca=events['length'];_0x48da58<_0x323bca;_0x48da58++){var _0xd1f3b0=events[_0x48da58];var _0x1be3d9=createListener('openchannelQueue:'+_0xd1f3b0,_0x2de1a4);OpenchannelQueueEvents['on'](_0xd1f3b0,_0x1be3d9);}}; \ No newline at end of file +var _0x3bca=['length','openchannelQueue:','./openchannelQueue.events','save','remove','update','emit','register'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x3bca,0x172));var _0xa3bc=function(_0x1fad7b,_0x3ff871){_0x1fad7b=_0x1fad7b-0x0;var _0x3a5a3e=_0x3bca[_0x1fad7b];return _0x3a5a3e;};'use strict';var OpenchannelQueueEvents=require(_0xa3bc('0x0'));var events=[_0xa3bc('0x1'),_0xa3bc('0x2'),_0xa3bc('0x3')];function createListener(_0x4de512,_0x3cc6b9){return function(_0x28f660){_0x3cc6b9[_0xa3bc('0x4')](_0x4de512,_0x28f660);};}function removeListener(_0x4c8033,_0x3222e6){return function(){OpenchannelQueueEvents['removeListener'](_0x4c8033,_0x3222e6);};}exports[_0xa3bc('0x5')]=function(_0x4ec8a5){for(var _0x5b1966=0x0,_0x42009b=events[_0xa3bc('0x6')];_0x5b1966<_0x42009b;_0x5b1966++){var _0xafd91f=events[_0x5b1966];var _0x179553=createListener(_0xa3bc('0x7')+_0xafd91f,_0x4ec8a5);OpenchannelQueueEvents['on'](_0xafd91f,_0x179553);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index decd561..116772a 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 _0x9c9b=['show','post','create','put','delete','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','isAuthenticated','index','get','describe','/:id'];(function(_0x355a33,_0x1fbe85){var _0x4050d3=function(_0x159fb0){while(--_0x159fb0){_0x355a33['push'](_0x355a33['shift']());}};_0x4050d3(++_0x1fbe85);}(_0x9c9b,0x1b6));var _0xb9c9=function(_0x442cd3,_0x3fcd7d){_0x442cd3=_0x442cd3-0x0;var _0x49db3e=_0x9c9b[_0x442cd3];return _0x49db3e;};'use strict';var multer=require(_0xb9c9('0x0'));var util=require(_0xb9c9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb9c9('0x2'));var router=express[_0xb9c9('0x3')]();var auth=require(_0xb9c9('0x4'));var interaction=require(_0xb9c9('0x5'));var config=require('../../config/environment');var controller=require(_0xb9c9('0x6'));router['get']('/',auth[_0xb9c9('0x7')](),controller[_0xb9c9('0x8')]);router[_0xb9c9('0x9')]('/describe',auth[_0xb9c9('0x7')](),controller[_0xb9c9('0xa')]);router[_0xb9c9('0x9')](_0xb9c9('0xb'),auth['isAuthenticated'](),controller[_0xb9c9('0xc')]);router[_0xb9c9('0xd')]('/',auth[_0xb9c9('0x7')](),controller[_0xb9c9('0xe')]);router[_0xb9c9('0xf')](_0xb9c9('0xb'),auth[_0xb9c9('0x7')](),controller['update']);router[_0xb9c9('0x10')](_0xb9c9('0xb'),auth[_0xb9c9('0x7')](),controller[_0xb9c9('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb4ca=['delete','destroy','util','path','connect-timeout','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','post','/:id','update'];(function(_0x13fc2a,_0x505a7d){var _0x3fb4d6=function(_0x5b4fe7){while(--_0x5b4fe7){_0x13fc2a['push'](_0x13fc2a['shift']());}};_0x3fb4d6(++_0x505a7d);}(_0xb4ca,0x1e2));var _0xab4c=function(_0x1dc71d,_0x38bd65){_0x1dc71d=_0x1dc71d-0x0;var _0x281507=_0xb4ca[_0x1dc71d];return _0x281507;};'use strict';var multer=require('multer');var util=require(_0xab4c('0x0'));var path=require(_0xab4c('0x1'));var timeout=require(_0xab4c('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xab4c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xab4c('0x4'));var controller=require(_0xab4c('0x5'));router['get']('/',auth[_0xab4c('0x6')](),controller[_0xab4c('0x7')]);router[_0xab4c('0x8')](_0xab4c('0x9'),auth[_0xab4c('0x6')](),controller[_0xab4c('0xa')]);router[_0xab4c('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xab4c('0xb')]('/',auth[_0xab4c('0x6')](),controller['create']);router['put'](_0xab4c('0xc'),auth['isAuthenticated'](),controller[_0xab4c('0xd')]);router[_0xab4c('0xe')]('/:id',auth[_0xab4c('0x6')](),controller[_0xab4c('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 54ea246..2c63c96 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 _0x6db3=['DATE','STRING','moment','sequelize','exports'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x6db3,0x18d));var _0x36db=function(_0xd519cd,_0x410d5c){_0xd519cd=_0xd519cd-0x0;var _0x212e12=_0x6db3[_0xd519cd];return _0x212e12;};'use strict';var moment=require(_0x36db('0x0'));var Sequelize=require(_0x36db('0x1'));module[_0x36db('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x36db('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x36db('0x3')]},'reason':{'type':Sequelize[_0x36db('0x4')]}}; \ No newline at end of file +var _0x3d30=['sequelize','exports','STRING','DATE','moment'];(function(_0x534c8f,_0x500079){var _0x5a57f5=function(_0x38ec0a){while(--_0x38ec0a){_0x534c8f['push'](_0x534c8f['shift']());}};_0x5a57f5(++_0x500079);}(_0x3d30,0x158));var _0x03d3=function(_0x3dd073,_0x1a630f){_0x3dd073=_0x3dd073-0x0;var _0x352c2e=_0x3d30[_0x3dd073];return _0x352c2e;};'use strict';var moment=require(_0x03d3('0x0'));var Sequelize=require(_0x03d3('0x1'));module[_0x03d3('0x2')]={'uniqueid':{'type':Sequelize[_0x03d3('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x03d3('0x4')]},'leaveAt':{'type':Sequelize[_0x03d3('0x4')]},'acceptAt':{'type':Sequelize[_0x03d3('0x4')]},'exitAt':{'type':Sequelize[_0x03d3('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index fccf347..705de5b 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 _0x257e=['sort','pick','filter','where','merge','type','VIRTUAL','options','OpenchannelQueueReport','count','includeAll','include','findAll','rows','catch','show','params','keys','find','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','apply','destroy','then','error','name','send','index','map','rawAttributes','fieldName','model','query','intersection','attributes','fields','nolimit','limit','order'];(function(_0x1ad279,_0x42d157){var _0x272861=function(_0x3cb41f){while(--_0x3cb41f){_0x1ad279['push'](_0x1ad279['shift']());}};_0x272861(++_0x42d157);}(_0x257e,0x1dc));var _0xe257=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x257e[_0x2aea9e];return _0x430b92;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe257('0x0'));var rimraf=require(_0xe257('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe257('0x2'));var rp=require('request-promise');var moment=require(_0xe257('0x3'));var BPromise=require(_0xe257('0x4'));var Mustache=require(_0xe257('0x5'));var util=require(_0xe257('0x6'));var path=require('path');var sox=require(_0xe257('0x7'));var csv=require(_0xe257('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe257('0x9'));var squel=require(_0xe257('0xa'));var crypto=require(_0xe257('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe257('0xc'));var toCsv=require(_0xe257('0x8'));var querystring=require(_0xe257('0xd'));var Papa=require(_0xe257('0xe'));var Redis=require(_0xe257('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe257('0x10'));var hardwareService=require(_0xe257('0x11'));var logger=require('../../config/logger')(_0xe257('0x12'));var utils=require(_0xe257('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe257('0x14'));var db=require(_0xe257('0x15'))['db'];function respondWithStatusCode(_0x8d4cee,_0x41b454){_0x41b454=_0x41b454||0xcc;return function(_0x2bc9a3){if(_0x2bc9a3){return _0x8d4cee['sendStatus'](_0x41b454);}return _0x8d4cee[_0xe257('0x16')](_0x41b454)[_0xe257('0x17')]();};}function respondWithResult(_0x49afa3,_0x273854){_0x273854=_0x273854||0xc8;return function(_0x441cde){if(_0x441cde){return _0x49afa3[_0xe257('0x16')](_0x273854)[_0xe257('0x18')](_0x441cde);}};}function respondWithFilteredResult(_0x1e34db,_0x44f6d8){return function(_0x44a016){if(_0x44a016){var _0x396be4=_0x44a016['count'],_0x54a00c=_0x44f6d8[_0xe257('0x19')],_0x47e8eb=_0x44f6d8['offset']+_0x44f6d8['limit'],_0x9df9de;if(_0x47e8eb>=_0x396be4){_0x47e8eb=_0x396be4;_0x9df9de=0xc8;}else{_0x9df9de=0xce;}_0x1e34db[_0xe257('0x16')](_0x9df9de);return _0x1e34db['set']('Content-Range',_0x54a00c+'-'+_0x47e8eb+'/'+_0x396be4)[_0xe257('0x18')](_0x44a016);}return null;};}function patchUpdates(_0x50764b){return function(_0x3d62ce){try{jsonpatch[_0xe257('0x1a')](_0x3d62ce,_0x50764b,!![]);}catch(_0x4ba2a0){return BPromise['reject'](_0x4ba2a0);}return _0x3d62ce['save']();};}function saveUpdates(_0x34033d,_0x5ca40f){return function(_0x51e6f4){if(_0x51e6f4){return _0x51e6f4['update'](_0x34033d)['then'](function(_0x181ec6){return _0x181ec6;});}return null;};}function removeEntity(_0x47f1ed,_0x2a2816){return function(_0x3a8bc6){if(_0x3a8bc6){return _0x3a8bc6[_0xe257('0x1b')]()[_0xe257('0x1c')](function(){_0x47f1ed['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3bc026,_0x11b467){return function(_0x59e7fa){if(!_0x59e7fa){_0x3bc026['sendStatus'](0x194);}return _0x59e7fa;};}function handleError(_0x17be93,_0x1dfda2){_0x1dfda2=_0x1dfda2||0x1f4;return function(_0x301fd4){logger[_0xe257('0x1d')](_0x301fd4['stack']);if(_0x301fd4[_0xe257('0x1e')]){delete _0x301fd4[_0xe257('0x1e')];}_0x17be93[_0xe257('0x16')](_0x1dfda2)[_0xe257('0x1f')](_0x301fd4);};}exports[_0xe257('0x20')]=function(_0x5532d3,_0x1c3c8c){var _0x260baa={},_0x550762={},_0x31a468={'count':0x0,'rows':[]};var _0x5097cc=_[_0xe257('0x21')](db['OpenchannelQueueReport'][_0xe257('0x22')],function(_0x3b3b32){return{'name':_0x3b3b32[_0xe257('0x23')],'type':_0x3b3b32['type']['key']};});_0x550762[_0xe257('0x24')]=_['map'](_0x5097cc,'name');_0x550762[_0xe257('0x25')]=_['keys'](_0x5532d3[_0xe257('0x25')]);_0x550762['filters']=_[_0xe257('0x26')](_0x550762[_0xe257('0x24')],_0x550762['query']);_0x260baa[_0xe257('0x27')]=_['intersection'](_0x550762[_0xe257('0x24')],qs[_0xe257('0x28')](_0x5532d3[_0xe257('0x25')][_0xe257('0x28')]));_0x260baa[_0xe257('0x27')]=_0x260baa['attributes']['length']?_0x260baa['attributes']:_0x550762[_0xe257('0x24')];if(!_0x5532d3[_0xe257('0x25')]['hasOwnProperty'](_0xe257('0x29'))){_0x260baa[_0xe257('0x2a')]=qs[_0xe257('0x2a')](_0x5532d3[_0xe257('0x25')][_0xe257('0x2a')]);_0x260baa[_0xe257('0x19')]=qs[_0xe257('0x19')](_0x5532d3[_0xe257('0x25')][_0xe257('0x19')]);}_0x260baa[_0xe257('0x2b')]=qs[_0xe257('0x2c')](_0x5532d3[_0xe257('0x25')][_0xe257('0x2c')]);_0x260baa['where']=qs['filters'](_[_0xe257('0x2d')](_0x5532d3[_0xe257('0x25')],_0x550762['filters']),_0x5097cc);if(_0x5532d3['query'][_0xe257('0x2e')]){_0x260baa[_0xe257('0x2f')]=_[_0xe257('0x30')](_0x260baa[_0xe257('0x2f')],{'$or':_[_0xe257('0x21')](_0x5097cc,function(_0x3d8dc8){if(_0x3d8dc8[_0xe257('0x31')]!==_0xe257('0x32')){var _0x1223a0={};_0x1223a0[_0x3d8dc8[_0xe257('0x1e')]]={'$like':'%'+_0x5532d3[_0xe257('0x25')]['filter']+'%'};return _0x1223a0;}})});}_0x260baa=_[_0xe257('0x30')]({},_0x260baa,_0x5532d3[_0xe257('0x33')]);var _0x550908={'where':_0x260baa[_0xe257('0x2f')]};return db[_0xe257('0x34')]['count'](_0x550908)[_0xe257('0x1c')](function(_0x389c4e){_0x31a468[_0xe257('0x35')]=_0x389c4e;if(_0x5532d3[_0xe257('0x25')][_0xe257('0x36')]){_0x260baa[_0xe257('0x37')]=[{'all':!![]}];}return db[_0xe257('0x34')][_0xe257('0x38')](_0x260baa);})[_0xe257('0x1c')](function(_0x2e6572){_0x31a468[_0xe257('0x39')]=_0x2e6572;return _0x31a468;})[_0xe257('0x1c')](respondWithFilteredResult(_0x1c3c8c,_0x260baa))[_0xe257('0x3a')](handleError(_0x1c3c8c,null));};exports[_0xe257('0x3b')]=function(_0x34e566,_0x54efe0){var _0x189011={'raw':!![],'where':{'id':_0x34e566[_0xe257('0x3c')]['id']}},_0x3dce11={};_0x3dce11[_0xe257('0x24')]=_[_0xe257('0x3d')](db[_0xe257('0x34')]['rawAttributes']);_0x3dce11['query']=_[_0xe257('0x3d')](_0x34e566[_0xe257('0x25')]);_0x3dce11['filters']=_['intersection'](_0x3dce11['model'],_0x3dce11[_0xe257('0x25')]);_0x189011['attributes']=_['intersection'](_0x3dce11[_0xe257('0x24')],qs[_0xe257('0x28')](_0x34e566[_0xe257('0x25')]['fields']));_0x189011['attributes']=_0x189011[_0xe257('0x27')]['length']?_0x189011[_0xe257('0x27')]:_0x3dce11['model'];if(_0x34e566[_0xe257('0x25')][_0xe257('0x36')]){_0x189011[_0xe257('0x37')]=[{'all':!![]}];}_0x189011=_[_0xe257('0x30')]({},_0x189011,_0x34e566['options']);return db['OpenchannelQueueReport'][_0xe257('0x3e')](_0x189011)[_0xe257('0x1c')](handleEntityNotFound(_0x54efe0,null))[_0xe257('0x1c')](respondWithResult(_0x54efe0,null))[_0xe257('0x3a')](handleError(_0x54efe0,null));};exports['create']=function(_0x126906,_0x21c7da){return db[_0xe257('0x34')]['create'](_0x126906[_0xe257('0x3f')],{})[_0xe257('0x1c')](respondWithResult(_0x21c7da,0xc9))['catch'](handleError(_0x21c7da,null));};exports['update']=function(_0x7685d3,_0x2df1c6){if(_0x7685d3[_0xe257('0x3f')]['id']){delete _0x7685d3[_0xe257('0x3f')]['id'];}return db[_0xe257('0x34')][_0xe257('0x3e')]({'where':{'id':_0x7685d3[_0xe257('0x3c')]['id']}})[_0xe257('0x1c')](handleEntityNotFound(_0x2df1c6,null))[_0xe257('0x1c')](saveUpdates(_0x7685d3[_0xe257('0x3f')],null))[_0xe257('0x1c')](respondWithResult(_0x2df1c6,null))['catch'](handleError(_0x2df1c6,null));};exports[_0xe257('0x1b')]=function(_0x53d481,_0x2ba9e8){return db[_0xe257('0x34')][_0xe257('0x3e')]({'where':{'id':_0x53d481[_0xe257('0x3c')]['id']}})[_0xe257('0x1c')](handleEntityNotFound(_0x2ba9e8,null))['then'](removeEntity(_0x2ba9e8,null))['catch'](handleError(_0x2ba9e8,null));};exports[_0xe257('0x40')]=function(_0x59344a,_0x4c6e1d){return db[_0xe257('0x34')]['describe']()[_0xe257('0x1c')](respondWithResult(_0x4c6e1d,null))['catch'](handleError(_0x4c6e1d,null));}; \ No newline at end of file +var _0x4627=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','count','offset','limit','set','json','apply','reject','save','update','then','end','sendStatus','stack','name','map','OpenchannelQueueReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','find','catch','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3da34b,_0x4ccd78){var _0xdb7d05=function(_0x34e7fa){while(--_0x34e7fa){_0x3da34b['push'](_0x3da34b['shift']());}};_0xdb7d05(++_0x4ccd78);}(_0x4627,0x115));var _0x7462=function(_0x4dab14,_0x164ea0){_0x4dab14=_0x4dab14-0x0;var _0xf41aa=_0x4627[_0x4dab14];return _0xf41aa;};'use strict';var pdf=require(_0x7462('0x0'));var emlformat=require(_0x7462('0x1'));var rimraf=require(_0x7462('0x2'));var zipdir=require(_0x7462('0x3'));var jsonpatch=require(_0x7462('0x4'));var rp=require(_0x7462('0x5'));var moment=require(_0x7462('0x6'));var BPromise=require(_0x7462('0x7'));var Mustache=require(_0x7462('0x8'));var util=require(_0x7462('0x9'));var path=require(_0x7462('0xa'));var sox=require(_0x7462('0xb'));var csv=require(_0x7462('0xc'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7462('0xd'));var squel=require(_0x7462('0xe'));var crypto=require(_0x7462('0xf'));var jsforce=require(_0x7462('0x10'));var deskjs=require(_0x7462('0x11'));var toCsv=require(_0x7462('0xc'));var querystring=require(_0x7462('0x12'));var Papa=require(_0x7462('0x13'));var Redis=require(_0x7462('0x14'));var authService=require(_0x7462('0x15'));var qs=require(_0x7462('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7462('0x17'))(_0x7462('0x18'));var utils=require(_0x7462('0x19'));var config=require(_0x7462('0x1a'));var licenseUtil=require(_0x7462('0x1b'));var db=require(_0x7462('0x1c'))['db'];function respondWithStatusCode(_0x31bf84,_0x4e313a){_0x4e313a=_0x4e313a||0xcc;return function(_0x5cb363){if(_0x5cb363){return _0x31bf84['sendStatus'](_0x4e313a);}return _0x31bf84[_0x7462('0x1d')](_0x4e313a)['end']();};}function respondWithResult(_0x1ba7e5,_0x461bd2){_0x461bd2=_0x461bd2||0xc8;return function(_0x368f45){if(_0x368f45){return _0x1ba7e5[_0x7462('0x1d')](_0x461bd2)['json'](_0x368f45);}};}function respondWithFilteredResult(_0x27b8f5,_0x4913ff){return function(_0x36b008){if(_0x36b008){var _0x42ed50=_0x36b008[_0x7462('0x1e')],_0x1ebbe8=_0x4913ff['offset'],_0x112dc2=_0x4913ff[_0x7462('0x1f')]+_0x4913ff[_0x7462('0x20')],_0x4b9426;if(_0x112dc2>=_0x42ed50){_0x112dc2=_0x42ed50;_0x4b9426=0xc8;}else{_0x4b9426=0xce;}_0x27b8f5[_0x7462('0x1d')](_0x4b9426);return _0x27b8f5[_0x7462('0x21')]('Content-Range',_0x1ebbe8+'-'+_0x112dc2+'/'+_0x42ed50)[_0x7462('0x22')](_0x36b008);}return null;};}function patchUpdates(_0x59c2fe){return function(_0x85341c){try{jsonpatch[_0x7462('0x23')](_0x85341c,_0x59c2fe,!![]);}catch(_0x570e48){return BPromise[_0x7462('0x24')](_0x570e48);}return _0x85341c[_0x7462('0x25')]();};}function saveUpdates(_0x4d0e60,_0x25a44a){return function(_0x33c605){if(_0x33c605){return _0x33c605[_0x7462('0x26')](_0x4d0e60)[_0x7462('0x27')](function(_0x1c851e){return _0x1c851e;});}return null;};}function removeEntity(_0x4404eb,_0x32da06){return function(_0x3c9616){if(_0x3c9616){return _0x3c9616['destroy']()[_0x7462('0x27')](function(){_0x4404eb['status'](0xcc)[_0x7462('0x28')]();});}};}function handleEntityNotFound(_0x11caf5,_0x290715){return function(_0x51b9fc){if(!_0x51b9fc){_0x11caf5[_0x7462('0x29')](0x194);}return _0x51b9fc;};}function handleError(_0x4f19e8,_0x1191e2){_0x1191e2=_0x1191e2||0x1f4;return function(_0x5473d1){logger['error'](_0x5473d1[_0x7462('0x2a')]);if(_0x5473d1[_0x7462('0x2b')]){delete _0x5473d1['name'];}_0x4f19e8['status'](_0x1191e2)['send'](_0x5473d1);};}exports['index']=function(_0x54be83,_0x3e0f59){var _0x338e1a={},_0x5ec062={},_0x1023b0={'count':0x0,'rows':[]};var _0x34e058=_[_0x7462('0x2c')](db[_0x7462('0x2d')]['rawAttributes'],function(_0x1f279b){return{'name':_0x1f279b[_0x7462('0x2e')],'type':_0x1f279b[_0x7462('0x2f')][_0x7462('0x30')]};});_0x5ec062[_0x7462('0x31')]=_[_0x7462('0x2c')](_0x34e058,_0x7462('0x2b'));_0x5ec062[_0x7462('0x32')]=_[_0x7462('0x33')](_0x54be83[_0x7462('0x32')]);_0x5ec062['filters']=_[_0x7462('0x34')](_0x5ec062['model'],_0x5ec062[_0x7462('0x32')]);_0x338e1a[_0x7462('0x35')]=_[_0x7462('0x34')](_0x5ec062[_0x7462('0x31')],qs['fields'](_0x54be83[_0x7462('0x32')][_0x7462('0x36')]));_0x338e1a[_0x7462('0x35')]=_0x338e1a[_0x7462('0x35')][_0x7462('0x37')]?_0x338e1a[_0x7462('0x35')]:_0x5ec062['model'];if(!_0x54be83[_0x7462('0x32')]['hasOwnProperty'](_0x7462('0x38'))){_0x338e1a['limit']=qs[_0x7462('0x20')](_0x54be83[_0x7462('0x32')]['limit']);_0x338e1a[_0x7462('0x1f')]=qs[_0x7462('0x1f')](_0x54be83[_0x7462('0x32')][_0x7462('0x1f')]);}_0x338e1a[_0x7462('0x39')]=qs[_0x7462('0x3a')](_0x54be83[_0x7462('0x32')][_0x7462('0x3a')]);_0x338e1a[_0x7462('0x3b')]=qs[_0x7462('0x3c')](_[_0x7462('0x3d')](_0x54be83[_0x7462('0x32')],_0x5ec062[_0x7462('0x3c')]),_0x34e058);if(_0x54be83[_0x7462('0x32')]['filter']){_0x338e1a[_0x7462('0x3b')]=_[_0x7462('0x3e')](_0x338e1a[_0x7462('0x3b')],{'$or':_[_0x7462('0x2c')](_0x34e058,function(_0x5ce6d0){if(_0x5ce6d0[_0x7462('0x2f')]!==_0x7462('0x3f')){var _0x270d30={};_0x270d30[_0x5ce6d0[_0x7462('0x2b')]]={'$like':'%'+_0x54be83[_0x7462('0x32')][_0x7462('0x40')]+'%'};return _0x270d30;}})});}_0x338e1a=_['merge']({},_0x338e1a,_0x54be83[_0x7462('0x41')]);var _0x11192a={'where':_0x338e1a[_0x7462('0x3b')]};return db[_0x7462('0x2d')]['count'](_0x11192a)[_0x7462('0x27')](function(_0x6cc79){_0x1023b0[_0x7462('0x1e')]=_0x6cc79;if(_0x54be83['query'][_0x7462('0x42')]){_0x338e1a[_0x7462('0x43')]=[{'all':!![]}];}return db[_0x7462('0x2d')]['findAll'](_0x338e1a);})[_0x7462('0x27')](function(_0x51dbd8){_0x1023b0[_0x7462('0x44')]=_0x51dbd8;return _0x1023b0;})['then'](respondWithFilteredResult(_0x3e0f59,_0x338e1a))['catch'](handleError(_0x3e0f59,null));};exports['show']=function(_0x46369b,_0x128029){var _0x2317eb={'raw':!![],'where':{'id':_0x46369b['params']['id']}},_0x5da514={};_0x5da514['model']=_[_0x7462('0x33')](db[_0x7462('0x2d')]['rawAttributes']);_0x5da514['query']=_[_0x7462('0x33')](_0x46369b[_0x7462('0x32')]);_0x5da514[_0x7462('0x3c')]=_[_0x7462('0x34')](_0x5da514['model'],_0x5da514['query']);_0x2317eb[_0x7462('0x35')]=_[_0x7462('0x34')](_0x5da514[_0x7462('0x31')],qs[_0x7462('0x36')](_0x46369b['query'][_0x7462('0x36')]));_0x2317eb[_0x7462('0x35')]=_0x2317eb[_0x7462('0x35')]['length']?_0x2317eb[_0x7462('0x35')]:_0x5da514['model'];if(_0x46369b[_0x7462('0x32')]['includeAll']){_0x2317eb['include']=[{'all':!![]}];}_0x2317eb=_[_0x7462('0x3e')]({},_0x2317eb,_0x46369b[_0x7462('0x41')]);return db[_0x7462('0x2d')][_0x7462('0x45')](_0x2317eb)[_0x7462('0x27')](handleEntityNotFound(_0x128029,null))[_0x7462('0x27')](respondWithResult(_0x128029,null))[_0x7462('0x46')](handleError(_0x128029,null));};exports[_0x7462('0x47')]=function(_0x3b025e,_0x53b1d3){return db['OpenchannelQueueReport'][_0x7462('0x47')](_0x3b025e['body'],{})[_0x7462('0x27')](respondWithResult(_0x53b1d3,0xc9))['catch'](handleError(_0x53b1d3,null));};exports[_0x7462('0x26')]=function(_0x2cec83,_0x437722){if(_0x2cec83[_0x7462('0x48')]['id']){delete _0x2cec83[_0x7462('0x48')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x2cec83[_0x7462('0x49')]['id']}})[_0x7462('0x27')](handleEntityNotFound(_0x437722,null))[_0x7462('0x27')](saveUpdates(_0x2cec83[_0x7462('0x48')],null))[_0x7462('0x27')](respondWithResult(_0x437722,null))[_0x7462('0x46')](handleError(_0x437722,null));};exports['destroy']=function(_0x236196,_0x1ef931){return db[_0x7462('0x2d')][_0x7462('0x45')]({'where':{'id':_0x236196['params']['id']}})[_0x7462('0x27')](handleEntityNotFound(_0x1ef931,null))[_0x7462('0x27')](removeEntity(_0x1ef931,null))[_0x7462('0x46')](handleError(_0x1ef931,null));};exports['describe']=function(_0x1a047c,_0x5c02d0){return db[_0x7462('0x2d')][_0x7462('0x4a')]()['then'](respondWithResult(_0x5c02d0,null))['catch'](handleError(_0x5c02d0,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index bf14ba9..bc26743 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 _0x7351=['exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes'];(function(_0x5793ad,_0x2d917b){var _0x3e8920=function(_0x3a9699){while(--_0x3a9699){_0x5793ad['push'](_0x5793ad['shift']());}};_0x3e8920(++_0x2d917b);}(_0x7351,0x139));var _0x1735=function(_0x128b5c,_0x574888){_0x128b5c=_0x128b5c-0x0;var _0x442f32=_0x7351[_0x128b5c];return _0x442f32;};'use strict';var _=require(_0x1735('0x0'));var util=require(_0x1735('0x1'));var logger=require(_0x1735('0x2'))(_0x1735('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1735('0x4'));var fs=require('fs');var path=require(_0x1735('0x5'));var rimraf=require(_0x1735('0x6'));var config=require(_0x1735('0x7'));var attributes=require(_0x1735('0x8'));module[_0x1735('0x9')]=function(_0x47fa51,_0x3fdcc1){return _0x47fa51[_0x1735('0xa')](_0x1735('0xb'),attributes,{'tableName':_0x1735('0xc'),'paranoid':![],'indexes':[{'name':_0x1735('0xd'),'fields':[_0x1735('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x03cf=['uniqueid','util','../../config/logger','bluebird','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue'];(function(_0x396466,_0xe9857b){var _0x5e9ab4=function(_0x362f66){while(--_0x362f66){_0x396466['push'](_0x396466['shift']());}};_0x5e9ab4(++_0xe9857b);}(_0x03cf,0x64));var _0xf03c=function(_0xe24bb1,_0x5c0a4e){_0xe24bb1=_0xe24bb1-0x0;var _0x6290a2=_0x03cf[_0xe24bb1];return _0x6290a2;};'use strict';var _=require('lodash');var util=require(_0xf03c('0x0'));var logger=require(_0xf03c('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf03c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf03c('0x3'));var rimraf=require('rimraf');var config=require(_0xf03c('0x4'));var attributes=require(_0xf03c('0x5'));module[_0xf03c('0x6')]=function(_0x4c2af5,_0x11841d){return _0x4c2af5[_0xf03c('0x7')](_0xf03c('0x8'),attributes,{'tableName':_0xf03c('0x9'),'paranoid':![],'indexes':[{'name':_0xf03c('0xa'),'fields':[_0xf03c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 6b535f4..ad9f80d 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 _0xd783=['where','attributes','UpdateOpenchannelQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','CreateOpenchannelQueueReport','create','options','raw','OpenchannelQueueReport','update'];(function(_0x18c191,_0x360a7c){var _0x170a62=function(_0x498bdf){while(--_0x498bdf){_0x18c191['push'](_0x18c191['shift']());}};_0x170a62(++_0x360a7c);}(_0xd783,0xa3));var _0x3d78=function(_0x2ab3c5,_0x35a3ef){_0x2ab3c5=_0x2ab3c5-0x0;var _0x2733aa=_0xd783[_0x2ab3c5];return _0x2733aa;};'use strict';var _=require('lodash');var util=require(_0x3d78('0x0'));var moment=require(_0x3d78('0x1'));var BPromise=require(_0x3d78('0x2'));var rs=require(_0x3d78('0x3'));var fs=require('fs');var Redis=require(_0x3d78('0x4'));var db=require(_0x3d78('0x5'))['db'];var utils=require(_0x3d78('0x6'));var logger=require(_0x3d78('0x7'))('rpc');var config=require(_0x3d78('0x8'));var jayson=require(_0x3d78('0x9'));var client=jayson[_0x3d78('0xa')][_0x3d78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2747d8,_0x326927,_0x115e88){return new BPromise(function(_0x2f7df0,_0x49974d){return client[_0x3d78('0xc')](_0x2747d8,_0x115e88)[_0x3d78('0xd')](function(_0x3fb4ec){logger[_0x3d78('0xe')](_0x3d78('0xf'),_0x326927,_0x3d78('0x10'));logger[_0x3d78('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x326927,_0x3d78('0x10'),JSON[_0x3d78('0x12')](_0x3fb4ec));if(_0x3fb4ec[_0x3d78('0x13')]){if(_0x3fb4ec[_0x3d78('0x13')]['code']===0x1f4){logger[_0x3d78('0x13')](_0x3d78('0xf'),_0x326927,_0x3fb4ec[_0x3d78('0x13')][_0x3d78('0x14')]);return _0x49974d(_0x3fb4ec[_0x3d78('0x13')][_0x3d78('0x14')]);}logger['error'](_0x3d78('0xf'),_0x326927,_0x3fb4ec[_0x3d78('0x13')]['message']);return _0x2f7df0(_0x3fb4ec[_0x3d78('0x13')][_0x3d78('0x14')]);}else{logger[_0x3d78('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x326927,_0x3d78('0x10'));_0x2f7df0(_0x3fb4ec[_0x3d78('0x15')][_0x3d78('0x14')]);}})[_0x3d78('0x16')](function(_0x26f39c){logger[_0x3d78('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x326927,_0x26f39c);_0x49974d(_0x26f39c);});});}exports[_0x3d78('0x17')]=function(_0xb190ec){var _0x4fa5ce=this;return new Promise(function(_0x486318,_0x630467){return db['OpenchannelQueueReport'][_0x3d78('0x18')](_0xb190ec['body'],{'raw':_0xb190ec[_0x3d78('0x19')]?_0xb190ec[_0x3d78('0x19')][_0x3d78('0x1a')]===undefined?!![]:![]:!![]})[_0x3d78('0xd')](function(_0x1afc97){logger[_0x3d78('0xe')](_0x3d78('0x17'),_0xb190ec);logger[_0x3d78('0x11')](_0x3d78('0x17'),_0xb190ec,JSON[_0x3d78('0x12')](_0x1afc97));_0x486318(_0x1afc97);})['catch'](function(_0x1d6717){logger[_0x3d78('0x13')](_0x3d78('0x17'),_0x1d6717[_0x3d78('0x14')],_0xb190ec);_0x630467(_0x4fa5ce[_0x3d78('0x13')](0x1f4,_0x1d6717[_0x3d78('0x14')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x4d355f){var _0x503984=this;return new Promise(function(_0x5ba151,_0x7bf56){return db[_0x3d78('0x1b')][_0x3d78('0x1c')](_0x4d355f['body'],{'raw':_0x4d355f[_0x3d78('0x19')]?_0x4d355f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d355f['options']?_0x4d355f['options'][_0x3d78('0x1d')]||null:null,'attributes':_0x4d355f[_0x3d78('0x19')]?_0x4d355f['options'][_0x3d78('0x1e')]||null:null,'limit':_0x4d355f[_0x3d78('0x19')]?_0x4d355f[_0x3d78('0x19')]['limit']||null:null})[_0x3d78('0xd')](function(_0x244d29){logger[_0x3d78('0xe')](_0x3d78('0x1f'),_0x4d355f);logger[_0x3d78('0x11')](_0x3d78('0x1f'),_0x4d355f,JSON[_0x3d78('0x12')](_0x244d29));_0x5ba151(_0x244d29);})[_0x3d78('0x16')](function(_0x5ea37e){logger[_0x3d78('0x13')](_0x3d78('0x1f'),_0x5ea37e['message'],_0x4d355f);_0x7bf56(_0x503984[_0x3d78('0x13')](0x1f4,_0x5ea37e[_0x3d78('0x14')]));});});}; \ No newline at end of file +var _0x4930=['http','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','create','body','options','raw','then','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','update','where','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x656b04,_0x169a23){var _0xcff7dd=function(_0x5c5d5a){while(--_0x5c5d5a){_0x656b04['push'](_0x656b04['shift']());}};_0xcff7dd(++_0x169a23);}(_0x4930,0x177));var _0x0493=function(_0x2bf93c,_0x29e173){_0x2bf93c=_0x2bf93c-0x0;var _0x450667=_0x4930[_0x2bf93c];return _0x450667;};'use strict';var _=require('lodash');var util=require(_0x0493('0x0'));var moment=require(_0x0493('0x1'));var BPromise=require('bluebird');var rs=require(_0x0493('0x2'));var fs=require('fs');var Redis=require(_0x0493('0x3'));var db=require(_0x0493('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0493('0x5'))('rpc');var config=require(_0x0493('0x6'));var jayson=require(_0x0493('0x7'));var client=jayson[_0x0493('0x8')][_0x0493('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2056a3,_0x101746,_0x2edbec){return new BPromise(function(_0x566ca6,_0x2290cd){return client['request'](_0x2056a3,_0x2edbec)['then'](function(_0x39ea48){logger[_0x0493('0xa')](_0x0493('0xb'),_0x101746,'request\x20sent');logger[_0x0493('0xc')](_0x0493('0xd'),_0x101746,'request\x20sent',JSON[_0x0493('0xe')](_0x39ea48));if(_0x39ea48[_0x0493('0xf')]){if(_0x39ea48[_0x0493('0xf')][_0x0493('0x10')]===0x1f4){logger['error'](_0x0493('0xb'),_0x101746,_0x39ea48[_0x0493('0xf')]['message']);return _0x2290cd(_0x39ea48[_0x0493('0xf')]['message']);}logger[_0x0493('0xf')](_0x0493('0xb'),_0x101746,_0x39ea48[_0x0493('0xf')][_0x0493('0x11')]);return _0x566ca6(_0x39ea48[_0x0493('0xf')][_0x0493('0x11')]);}else{logger[_0x0493('0xa')](_0x0493('0xb'),_0x101746,_0x0493('0x12'));_0x566ca6(_0x39ea48[_0x0493('0x13')][_0x0493('0x11')]);}})[_0x0493('0x14')](function(_0x178306){logger[_0x0493('0xf')](_0x0493('0xb'),_0x101746,_0x178306);_0x2290cd(_0x178306);});});}exports['CreateOpenchannelQueueReport']=function(_0x8338){var _0x475077=this;return new Promise(function(_0xf2680c,_0x3d7f41){return db['OpenchannelQueueReport'][_0x0493('0x15')](_0x8338[_0x0493('0x16')],{'raw':_0x8338[_0x0493('0x17')]?_0x8338[_0x0493('0x17')][_0x0493('0x18')]===undefined?!![]:![]:!![]})[_0x0493('0x19')](function(_0x50964f){logger[_0x0493('0xa')](_0x0493('0x1a'),_0x8338);logger[_0x0493('0xc')](_0x0493('0x1a'),_0x8338,JSON[_0x0493('0xe')](_0x50964f));_0xf2680c(_0x50964f);})['catch'](function(_0x65725e){logger[_0x0493('0xf')](_0x0493('0x1a'),_0x65725e[_0x0493('0x11')],_0x8338);_0x3d7f41(_0x475077[_0x0493('0xf')](0x1f4,_0x65725e[_0x0493('0x11')]));});});};exports[_0x0493('0x1b')]=function(_0x38f69a){var _0x472e2c=this;return new Promise(function(_0x388353,_0x430079){return db['OpenchannelQueueReport'][_0x0493('0x1c')](_0x38f69a['body'],{'raw':_0x38f69a[_0x0493('0x17')]?_0x38f69a[_0x0493('0x17')][_0x0493('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x38f69a['options']?_0x38f69a['options'][_0x0493('0x1d')]||null:null,'attributes':_0x38f69a[_0x0493('0x17')]?_0x38f69a['options'][_0x0493('0x1e')]||null:null,'limit':_0x38f69a[_0x0493('0x17')]?_0x38f69a[_0x0493('0x17')][_0x0493('0x1f')]||null:null})[_0x0493('0x19')](function(_0x50a5fd){logger[_0x0493('0xa')]('UpdateOpenchannelQueueReport',_0x38f69a);logger[_0x0493('0xc')](_0x0493('0x1b'),_0x38f69a,JSON['stringify'](_0x50a5fd));_0x388353(_0x50a5fd);})[_0x0493('0x14')](function(_0x4ba80b){logger['error'](_0x0493('0x1b'),_0x4ba80b[_0x0493('0x11')],_0x38f69a);_0x430079(_0x472e2c[_0x0493('0xf')](0x1f4,_0x4ba80b[_0x0493('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index dfe866a..15c3677 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 _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x37c07d,_0xdbdb5f){var _0x10dadc=function(_0x2bafb7){while(--_0x2bafb7){_0x37c07d['push'](_0x37c07d['shift']());}};_0x10dadc(++_0xdbdb5f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file +var _0xa9e0=['put','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','/:id','post','create'];(function(_0x1f6f84,_0x2bab55){var _0x177f40=function(_0x384ab4){while(--_0x384ab4){_0x1f6f84['push'](_0x1f6f84['shift']());}};_0x177f40(++_0x2bab55);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth[_0x0a9e('0x8')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0xa'),auth[_0x0a9e('0x8')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);module[_0x0a9e('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 1a8d3cc..b9c3240 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 _0x6d63=['queue','DATE','moment','exports','STRING','ENUM','agent'];(function(_0x5ccfa9,_0x415e4d){var _0x228ced=function(_0x57750a){while(--_0x57750a){_0x5ccfa9['push'](_0x5ccfa9['shift']());}};_0x228ced(++_0x415e4d);}(_0x6d63,0x19f));var _0x36d6=function(_0x279ab4,_0x68df8c){_0x279ab4=_0x279ab4-0x0;var _0x6952f8=_0x6d63[_0x279ab4];return _0x6952f8;};'use strict';var moment=require(_0x36d6('0x0'));var Sequelize=require('sequelize');module[_0x36d6('0x1')]={'uniqueid':{'type':Sequelize[_0x36d6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x36d6('0x3')]('account',_0x36d6('0x4'),_0x36d6('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x36d6('0x6')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x3f09=['NOW','exports','STRING','agent','queue'];(function(_0x4391ea,_0x4d6492){var _0x2933c6=function(_0x54a057){while(--_0x54a057){_0x4391ea['push'](_0x4391ea['shift']());}};_0x2933c6(++_0x4d6492);}(_0x3f09,0xf6));var _0x93f0=function(_0x28e97f,_0x51fbb2){_0x28e97f=_0x28e97f-0x0;var _0xea8596=_0x3f09[_0x28e97f];return _0xea8596;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x93f0('0x0')]={'uniqueid':{'type':Sequelize[_0x93f0('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0x93f0('0x2'),_0x93f0('0x3')),'allowNull':![],'defaultValue':_0x93f0('0x3')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x93f0('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index ae8f4db..1b24d97 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 _0x20fc=['lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','set','Content-Range','json','apply','reject','save','update','then','sendStatus','error','name','index','map','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','length','nolimit','limit','offset','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','params','keys','OpenchannelTransferReport','options','catch','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs'];(function(_0x4398b9,_0xf7d1f8){var _0x2b1ae9=function(_0x4f5e52){while(--_0x4f5e52){_0x4398b9['push'](_0x4398b9['shift']());}};_0x2b1ae9(++_0xf7d1f8);}(_0x20fc,0xd5));var _0xc20f=function(_0xb24fad,_0xd58756){_0xb24fad=_0xb24fad-0x0;var _0x173226=_0x20fc[_0xb24fad];return _0x173226;};'use strict';var pdf=require(_0xc20f('0x0'));var emlformat=require(_0xc20f('0x1'));var rimraf=require(_0xc20f('0x2'));var zipdir=require(_0xc20f('0x3'));var jsonpatch=require(_0xc20f('0x4'));var rp=require(_0xc20f('0x5'));var moment=require(_0xc20f('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xc20f('0x7'));var util=require(_0xc20f('0x8'));var path=require(_0xc20f('0x9'));var sox=require(_0xc20f('0xa'));var csv=require('to-csv');var ejs=require(_0xc20f('0xb'));var fs=require('fs');var _=require(_0xc20f('0xc'));var squel=require(_0xc20f('0xd'));var crypto=require('crypto');var jsforce=require(_0xc20f('0xe'));var deskjs=require(_0xc20f('0xf'));var toCsv=require(_0xc20f('0x10'));var querystring=require('querystring');var Papa=require(_0xc20f('0x11'));var Redis=require(_0xc20f('0x12'));var authService=require(_0xc20f('0x13'));var qs=require(_0xc20f('0x14'));var as=require(_0xc20f('0x15'));var hardwareService=require(_0xc20f('0x16'));var logger=require(_0xc20f('0x17'))('api');var utils=require(_0xc20f('0x18'));var config=require(_0xc20f('0x19'));var licenseUtil=require(_0xc20f('0x1a'));var db=require(_0xc20f('0x1b'))['db'];function respondWithStatusCode(_0xfe704c,_0x544dbc){_0x544dbc=_0x544dbc||0xcc;return function(_0x40102a){if(_0x40102a){return _0xfe704c['sendStatus'](_0x544dbc);}return _0xfe704c[_0xc20f('0x1c')](_0x544dbc)['end']();};}function respondWithResult(_0x477bca,_0x2d1ad5){_0x2d1ad5=_0x2d1ad5||0xc8;return function(_0x2444e6){if(_0x2444e6){return _0x477bca['status'](_0x2d1ad5)['json'](_0x2444e6);}};}function respondWithFilteredResult(_0x53455e,_0x110af5){return function(_0x3afed1){if(_0x3afed1){var _0xc7e2f9=_0x3afed1['count'],_0x243cdd=_0x110af5['offset'],_0x1998c6=_0x110af5['offset']+_0x110af5['limit'],_0x264c21;if(_0x1998c6>=_0xc7e2f9){_0x1998c6=_0xc7e2f9;_0x264c21=0xc8;}else{_0x264c21=0xce;}_0x53455e[_0xc20f('0x1c')](_0x264c21);return _0x53455e[_0xc20f('0x1d')](_0xc20f('0x1e'),_0x243cdd+'-'+_0x1998c6+'/'+_0xc7e2f9)[_0xc20f('0x1f')](_0x3afed1);}return null;};}function patchUpdates(_0x48cb82){return function(_0x2fac32){try{jsonpatch[_0xc20f('0x20')](_0x2fac32,_0x48cb82,!![]);}catch(_0x524649){return BPromise[_0xc20f('0x21')](_0x524649);}return _0x2fac32[_0xc20f('0x22')]();};}function saveUpdates(_0x154304,_0x40283d){return function(_0x90109e){if(_0x90109e){return _0x90109e[_0xc20f('0x23')](_0x154304)[_0xc20f('0x24')](function(_0x396fc8){return _0x396fc8;});}return null;};}function removeEntity(_0x577ce7,_0x16d7fe){return function(_0x2c2be2){if(_0x2c2be2){return _0x2c2be2['destroy']()[_0xc20f('0x24')](function(){_0x577ce7[_0xc20f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15bcd8,_0xefb8e4){return function(_0x4f671b){if(!_0x4f671b){_0x15bcd8[_0xc20f('0x25')](0x194);}return _0x4f671b;};}function handleError(_0x60e381,_0x4f758c){_0x4f758c=_0x4f758c||0x1f4;return function(_0x2dc739){logger[_0xc20f('0x26')](_0x2dc739['stack']);if(_0x2dc739[_0xc20f('0x27')]){delete _0x2dc739[_0xc20f('0x27')];}_0x60e381['status'](_0x4f758c)['send'](_0x2dc739);};}exports[_0xc20f('0x28')]=function(_0x1c0a44,_0xac795a){var _0x163360={},_0x23a837={},_0x2325c1={'count':0x0,'rows':[]};var _0x55fc81=_[_0xc20f('0x29')](db['OpenchannelTransferReport'][_0xc20f('0x2a')],function(_0x1dee5f){return{'name':_0x1dee5f[_0xc20f('0x2b')],'type':_0x1dee5f[_0xc20f('0x2c')]['key']};});_0x23a837[_0xc20f('0x2d')]=_[_0xc20f('0x29')](_0x55fc81,_0xc20f('0x27'));_0x23a837[_0xc20f('0x2e')]=_['keys'](_0x1c0a44[_0xc20f('0x2e')]);_0x23a837['filters']=_['intersection'](_0x23a837[_0xc20f('0x2d')],_0x23a837['query']);_0x163360[_0xc20f('0x2f')]=_[_0xc20f('0x30')](_0x23a837[_0xc20f('0x2d')],qs['fields'](_0x1c0a44[_0xc20f('0x2e')][_0xc20f('0x31')]));_0x163360[_0xc20f('0x2f')]=_0x163360[_0xc20f('0x2f')][_0xc20f('0x32')]?_0x163360[_0xc20f('0x2f')]:_0x23a837[_0xc20f('0x2d')];if(!_0x1c0a44['query']['hasOwnProperty'](_0xc20f('0x33'))){_0x163360[_0xc20f('0x34')]=qs[_0xc20f('0x34')](_0x1c0a44[_0xc20f('0x2e')]['limit']);_0x163360[_0xc20f('0x35')]=qs['offset'](_0x1c0a44[_0xc20f('0x2e')]['offset']);}_0x163360[_0xc20f('0x36')]=qs[_0xc20f('0x37')](_0x1c0a44[_0xc20f('0x2e')][_0xc20f('0x37')]);_0x163360['where']=qs[_0xc20f('0x38')](_[_0xc20f('0x39')](_0x1c0a44[_0xc20f('0x2e')],_0x23a837[_0xc20f('0x38')]),_0x55fc81);if(_0x1c0a44[_0xc20f('0x2e')][_0xc20f('0x3a')]){_0x163360[_0xc20f('0x3b')]=_[_0xc20f('0x3c')](_0x163360['where'],{'$or':_[_0xc20f('0x29')](_0x55fc81,function(_0x11ccc3){if(_0x11ccc3[_0xc20f('0x2c')]!==_0xc20f('0x3d')){var _0x1ee7de={};_0x1ee7de[_0x11ccc3['name']]={'$like':'%'+_0x1c0a44[_0xc20f('0x2e')][_0xc20f('0x3a')]+'%'};return _0x1ee7de;}})});}_0x163360=_[_0xc20f('0x3c')]({},_0x163360,_0x1c0a44['options']);var _0x32874c={'where':_0x163360[_0xc20f('0x3b')]};return db['OpenchannelTransferReport']['count'](_0x32874c)['then'](function(_0x5d3189){_0x2325c1['count']=_0x5d3189;if(_0x1c0a44[_0xc20f('0x2e')][_0xc20f('0x3e')]){_0x163360[_0xc20f('0x3f')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xc20f('0x40')](_0x163360);})['then'](function(_0x2206c4){_0x2325c1['rows']=_0x2206c4;return _0x2325c1;})[_0xc20f('0x24')](respondWithFilteredResult(_0xac795a,_0x163360))['catch'](handleError(_0xac795a,null));};exports['show']=function(_0x1ae2f9,_0x4090aa){var _0x183669={'raw':!![],'where':{'id':_0x1ae2f9[_0xc20f('0x41')]['id']}},_0x39bbdd={};_0x39bbdd[_0xc20f('0x2d')]=_[_0xc20f('0x42')](db[_0xc20f('0x43')][_0xc20f('0x2a')]);_0x39bbdd[_0xc20f('0x2e')]=_[_0xc20f('0x42')](_0x1ae2f9[_0xc20f('0x2e')]);_0x39bbdd[_0xc20f('0x38')]=_['intersection'](_0x39bbdd[_0xc20f('0x2d')],_0x39bbdd[_0xc20f('0x2e')]);_0x183669[_0xc20f('0x2f')]=_['intersection'](_0x39bbdd[_0xc20f('0x2d')],qs[_0xc20f('0x31')](_0x1ae2f9['query'][_0xc20f('0x31')]));_0x183669[_0xc20f('0x2f')]=_0x183669['attributes'][_0xc20f('0x32')]?_0x183669['attributes']:_0x39bbdd[_0xc20f('0x2d')];if(_0x1ae2f9[_0xc20f('0x2e')][_0xc20f('0x3e')]){_0x183669[_0xc20f('0x3f')]=[{'all':!![]}];}_0x183669=_[_0xc20f('0x3c')]({},_0x183669,_0x1ae2f9[_0xc20f('0x44')]);return db[_0xc20f('0x43')]['find'](_0x183669)[_0xc20f('0x24')](handleEntityNotFound(_0x4090aa,null))[_0xc20f('0x24')](respondWithResult(_0x4090aa,null))[_0xc20f('0x45')](handleError(_0x4090aa,null));};exports['create']=function(_0x65e72a,_0x5013f3){return db['OpenchannelTransferReport'][_0xc20f('0x46')](_0x65e72a['body'],{})[_0xc20f('0x24')](respondWithResult(_0x5013f3,0xc9))['catch'](handleError(_0x5013f3,null));};exports['update']=function(_0x13ecbf,_0x748c4c){if(_0x13ecbf['body']['id']){delete _0x13ecbf[_0xc20f('0x47')]['id'];}return db[_0xc20f('0x43')][_0xc20f('0x48')]({'where':{'id':_0x13ecbf['params']['id']}})[_0xc20f('0x24')](handleEntityNotFound(_0x748c4c,null))[_0xc20f('0x24')](saveUpdates(_0x13ecbf[_0xc20f('0x47')],null))[_0xc20f('0x24')](respondWithResult(_0x748c4c,null))[_0xc20f('0x45')](handleError(_0x748c4c,null));};exports[_0xc20f('0x49')]=function(_0x470000,_0x40e210){return db[_0xc20f('0x43')][_0xc20f('0x48')]({'where':{'id':_0x470000[_0xc20f('0x41')]['id']}})[_0xc20f('0x24')](handleEntityNotFound(_0x40e210,null))[_0xc20f('0x24')](removeEntity(_0x40e210,null))['catch'](handleError(_0x40e210,null));};exports[_0xc20f('0x4a')]=function(_0x38b0c1,_0x4ba068){return db[_0xc20f('0x43')][_0xc20f('0x4a')]()[_0xc20f('0x24')](respondWithResult(_0x4ba068,null))['catch'](handleError(_0x4ba068,null));}; \ No newline at end of file +var _0x8503=['json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','OpenchannelTransferReport','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x8503,0x1bf));var _0x3850=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x8503[_0x543084];return _0x306a57;};'use strict';var pdf=require(_0x3850('0x0'));var emlformat=require(_0x3850('0x1'));var rimraf=require(_0x3850('0x2'));var zipdir=require(_0x3850('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3850('0x4'));var moment=require(_0x3850('0x5'));var BPromise=require(_0x3850('0x6'));var Mustache=require(_0x3850('0x7'));var util=require(_0x3850('0x8'));var path=require(_0x3850('0x9'));var sox=require(_0x3850('0xa'));var csv=require(_0x3850('0xb'));var ejs=require(_0x3850('0xc'));var fs=require('fs');var _=require(_0x3850('0xd'));var squel=require(_0x3850('0xe'));var crypto=require(_0x3850('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3850('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3850('0x10'));var authService=require(_0x3850('0x11'));var qs=require(_0x3850('0x12'));var as=require(_0x3850('0x13'));var hardwareService=require(_0x3850('0x14'));var logger=require(_0x3850('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x3850('0x16'));var licenseUtil=require(_0x3850('0x17'));var db=require(_0x3850('0x18'))['db'];function respondWithStatusCode(_0x5603f0,_0x11a2dd){_0x11a2dd=_0x11a2dd||0xcc;return function(_0x21e857){if(_0x21e857){return _0x5603f0[_0x3850('0x19')](_0x11a2dd);}return _0x5603f0['status'](_0x11a2dd)['end']();};}function respondWithResult(_0x6b9a6a,_0xb3db40){_0xb3db40=_0xb3db40||0xc8;return function(_0x48b1ef){if(_0x48b1ef){return _0x6b9a6a[_0x3850('0x1a')](_0xb3db40)[_0x3850('0x1b')](_0x48b1ef);}};}function respondWithFilteredResult(_0x367f55,_0x437c69){return function(_0x266652){if(_0x266652){var _0x406a2f=_0x266652[_0x3850('0x1c')],_0x52ea1c=_0x437c69['offset'],_0x466f53=_0x437c69[_0x3850('0x1d')]+_0x437c69[_0x3850('0x1e')],_0x41f2e6;if(_0x466f53>=_0x406a2f){_0x466f53=_0x406a2f;_0x41f2e6=0xc8;}else{_0x41f2e6=0xce;}_0x367f55[_0x3850('0x1a')](_0x41f2e6);return _0x367f55[_0x3850('0x1f')](_0x3850('0x20'),_0x52ea1c+'-'+_0x466f53+'/'+_0x406a2f)[_0x3850('0x1b')](_0x266652);}return null;};}function patchUpdates(_0x2a57e7){return function(_0x507903){try{jsonpatch[_0x3850('0x21')](_0x507903,_0x2a57e7,!![]);}catch(_0x37ddc2){return BPromise[_0x3850('0x22')](_0x37ddc2);}return _0x507903[_0x3850('0x23')]();};}function saveUpdates(_0x53d4c6,_0x2542b6){return function(_0x1d29a1){if(_0x1d29a1){return _0x1d29a1[_0x3850('0x24')](_0x53d4c6)[_0x3850('0x25')](function(_0x1ed2cd){return _0x1ed2cd;});}return null;};}function removeEntity(_0x222b4c,_0x4689e8){return function(_0x285a){if(_0x285a){return _0x285a['destroy']()[_0x3850('0x25')](function(){_0x222b4c[_0x3850('0x1a')](0xcc)[_0x3850('0x26')]();});}};}function handleEntityNotFound(_0x31864c,_0xb9bcb8){return function(_0x4504b6){if(!_0x4504b6){_0x31864c[_0x3850('0x19')](0x194);}return _0x4504b6;};}function handleError(_0x14ef4a,_0x4b08a){_0x4b08a=_0x4b08a||0x1f4;return function(_0x3dbb5d){logger[_0x3850('0x27')](_0x3dbb5d[_0x3850('0x28')]);if(_0x3dbb5d[_0x3850('0x29')]){delete _0x3dbb5d[_0x3850('0x29')];}_0x14ef4a[_0x3850('0x1a')](_0x4b08a)[_0x3850('0x2a')](_0x3dbb5d);};}exports[_0x3850('0x2b')]=function(_0x51ea35,_0x39e8f5){var _0x6223a8={},_0x2c4212={},_0x17aa99={'count':0x0,'rows':[]};var _0x1e6a2e=_[_0x3850('0x2c')](db['OpenchannelTransferReport'][_0x3850('0x2d')],function(_0x314b24){return{'name':_0x314b24[_0x3850('0x2e')],'type':_0x314b24[_0x3850('0x2f')][_0x3850('0x30')]};});_0x2c4212[_0x3850('0x31')]=_['map'](_0x1e6a2e,'name');_0x2c4212[_0x3850('0x32')]=_[_0x3850('0x33')](_0x51ea35['query']);_0x2c4212[_0x3850('0x34')]=_[_0x3850('0x35')](_0x2c4212['model'],_0x2c4212[_0x3850('0x32')]);_0x6223a8[_0x3850('0x36')]=_[_0x3850('0x35')](_0x2c4212[_0x3850('0x31')],qs['fields'](_0x51ea35['query'][_0x3850('0x37')]));_0x6223a8['attributes']=_0x6223a8['attributes'][_0x3850('0x38')]?_0x6223a8[_0x3850('0x36')]:_0x2c4212['model'];if(!_0x51ea35[_0x3850('0x32')][_0x3850('0x39')](_0x3850('0x3a'))){_0x6223a8[_0x3850('0x1e')]=qs[_0x3850('0x1e')](_0x51ea35[_0x3850('0x32')][_0x3850('0x1e')]);_0x6223a8['offset']=qs[_0x3850('0x1d')](_0x51ea35[_0x3850('0x32')][_0x3850('0x1d')]);}_0x6223a8[_0x3850('0x3b')]=qs[_0x3850('0x3c')](_0x51ea35['query'][_0x3850('0x3c')]);_0x6223a8['where']=qs[_0x3850('0x34')](_[_0x3850('0x3d')](_0x51ea35[_0x3850('0x32')],_0x2c4212[_0x3850('0x34')]),_0x1e6a2e);if(_0x51ea35[_0x3850('0x32')][_0x3850('0x3e')]){_0x6223a8[_0x3850('0x3f')]=_['merge'](_0x6223a8[_0x3850('0x3f')],{'$or':_['map'](_0x1e6a2e,function(_0x1c2701){if(_0x1c2701['type']!==_0x3850('0x40')){var _0x5dc7bf={};_0x5dc7bf[_0x1c2701[_0x3850('0x29')]]={'$like':'%'+_0x51ea35[_0x3850('0x32')][_0x3850('0x3e')]+'%'};return _0x5dc7bf;}})});}_0x6223a8=_[_0x3850('0x41')]({},_0x6223a8,_0x51ea35[_0x3850('0x42')]);var _0x5a12b3={'where':_0x6223a8[_0x3850('0x3f')]};return db[_0x3850('0x43')][_0x3850('0x1c')](_0x5a12b3)[_0x3850('0x25')](function(_0x3eac4d){_0x17aa99['count']=_0x3eac4d;if(_0x51ea35[_0x3850('0x32')][_0x3850('0x44')]){_0x6223a8[_0x3850('0x45')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0x3850('0x46')](_0x6223a8);})[_0x3850('0x25')](function(_0x41e4f9){_0x17aa99[_0x3850('0x47')]=_0x41e4f9;return _0x17aa99;})['then'](respondWithFilteredResult(_0x39e8f5,_0x6223a8))[_0x3850('0x48')](handleError(_0x39e8f5,null));};exports['show']=function(_0x470925,_0x29729b){var _0x5159fa={'raw':!![],'where':{'id':_0x470925[_0x3850('0x49')]['id']}},_0x1ebad7={};_0x1ebad7[_0x3850('0x31')]=_[_0x3850('0x33')](db['OpenchannelTransferReport'][_0x3850('0x2d')]);_0x1ebad7[_0x3850('0x32')]=_[_0x3850('0x33')](_0x470925[_0x3850('0x32')]);_0x1ebad7[_0x3850('0x34')]=_[_0x3850('0x35')](_0x1ebad7[_0x3850('0x31')],_0x1ebad7[_0x3850('0x32')]);_0x5159fa[_0x3850('0x36')]=_['intersection'](_0x1ebad7[_0x3850('0x31')],qs[_0x3850('0x37')](_0x470925[_0x3850('0x32')][_0x3850('0x37')]));_0x5159fa[_0x3850('0x36')]=_0x5159fa[_0x3850('0x36')][_0x3850('0x38')]?_0x5159fa['attributes']:_0x1ebad7[_0x3850('0x31')];if(_0x470925['query'][_0x3850('0x44')]){_0x5159fa[_0x3850('0x45')]=[{'all':!![]}];}_0x5159fa=_['merge']({},_0x5159fa,_0x470925['options']);return db['OpenchannelTransferReport'][_0x3850('0x4a')](_0x5159fa)['then'](handleEntityNotFound(_0x29729b,null))[_0x3850('0x25')](respondWithResult(_0x29729b,null))[_0x3850('0x48')](handleError(_0x29729b,null));};exports[_0x3850('0x4b')]=function(_0x4642a2,_0x1e2dab){return db[_0x3850('0x43')][_0x3850('0x4b')](_0x4642a2[_0x3850('0x4c')],{})[_0x3850('0x25')](respondWithResult(_0x1e2dab,0xc9))['catch'](handleError(_0x1e2dab,null));};exports[_0x3850('0x24')]=function(_0x29f111,_0x206ef3){if(_0x29f111[_0x3850('0x4c')]['id']){delete _0x29f111[_0x3850('0x4c')]['id'];}return db[_0x3850('0x43')][_0x3850('0x4a')]({'where':{'id':_0x29f111[_0x3850('0x49')]['id']}})[_0x3850('0x25')](handleEntityNotFound(_0x206ef3,null))[_0x3850('0x25')](saveUpdates(_0x29f111[_0x3850('0x4c')],null))[_0x3850('0x25')](respondWithResult(_0x206ef3,null))[_0x3850('0x48')](handleError(_0x206ef3,null));};exports[_0x3850('0x4d')]=function(_0x32a8bb,_0x13ed88){return db[_0x3850('0x43')][_0x3850('0x4a')]({'where':{'id':_0x32a8bb[_0x3850('0x49')]['id']}})[_0x3850('0x25')](handleEntityNotFound(_0x13ed88,null))[_0x3850('0x25')](removeEntity(_0x13ed88,null))[_0x3850('0x48')](handleError(_0x13ed88,null));};exports[_0x3850('0x4e')]=function(_0x46b94b,_0x49ee3b){return db[_0x3850('0x43')]['describe']()[_0x3850('0x25')](respondWithResult(_0x49ee3b,null))[_0x3850('0x48')](handleError(_0x49ee3b,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index eab86f6..6e03a01 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 _0x1df0=['lodash','../../config/logger','request-promise','path','../../config/environment','define','report_openchannel_transfer','uniqueid'];(function(_0x54e22d,_0x28226e){var _0x305c2f=function(_0x546b66){while(--_0x546b66){_0x54e22d['push'](_0x54e22d['shift']());}};_0x305c2f(++_0x28226e);}(_0x1df0,0x178));var _0x01df=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x1df0[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x01df('0x0'));var util=require('util');var logger=require(_0x01df('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x01df('0x2'));var fs=require('fs');var path=require(_0x01df('0x3'));var rimraf=require('rimraf');var config=require(_0x01df('0x4'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x5dc80c,_0x461c67){return _0x5dc80c[_0x01df('0x5')]('OpenchannelTransferReport',attributes,{'tableName':_0x01df('0x6'),'paranoid':![],'indexes':[{'name':_0x01df('0x7'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe0f3=['path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','request-promise'];(function(_0x321c52,_0x268c2a){var _0x1f1c39=function(_0x990360){while(--_0x990360){_0x321c52['push'](_0x321c52['shift']());}};_0x1f1c39(++_0x268c2a);}(_0xe0f3,0x1cf));var _0x3e0f=function(_0x55b940,_0x81a451){_0x55b940=_0x55b940-0x0;var _0x4c5009=_0xe0f3[_0x55b940];return _0x4c5009;};'use strict';var _=require(_0x3e0f('0x0'));var util=require(_0x3e0f('0x1'));var logger=require(_0x3e0f('0x2'))(_0x3e0f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3e0f('0x4'));var fs=require('fs');var path=require(_0x3e0f('0x5'));var rimraf=require(_0x3e0f('0x6'));var config=require(_0x3e0f('0x7'));var attributes=require(_0x3e0f('0x8'));module[_0x3e0f('0x9')]=function(_0x5e75b1,_0x1a9300){return _0x5e75b1['define'](_0x3e0f('0xa'),attributes,{'tableName':_0x3e0f('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3e0f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 1b9a967..e7e5ca7 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 _0x4504=['error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x3ca271,_0x446052){var _0x51ef4a=function(_0x2aceef){while(--_0x2aceef){_0x3ca271['push'](_0x3ca271['shift']());}};_0x51ef4a(++_0x446052);}(_0x4504,0xd4));var _0x4450=function(_0x2caf5d,_0x33ce95){_0x2caf5d=_0x2caf5d-0x0;var _0x309b75=_0x4504[_0x2caf5d];return _0x309b75;};'use strict';var _=require(_0x4450('0x0'));var util=require(_0x4450('0x1'));var moment=require('moment');var BPromise=require(_0x4450('0x2'));var rs=require(_0x4450('0x3'));var fs=require('fs');var Redis=require(_0x4450('0x4'));var db=require(_0x4450('0x5'))['db'];var utils=require(_0x4450('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4450('0x7'));var client=jayson[_0x4450('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ba484,_0x34afba,_0xa9671){return new BPromise(function(_0x4767b8,_0x1b9e98){return client[_0x4450('0x9')](_0x2ba484,_0xa9671)[_0x4450('0xa')](function(_0x2564ae){logger[_0x4450('0xb')](_0x4450('0xc'),_0x34afba,_0x4450('0xd'));logger[_0x4450('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x34afba,_0x4450('0xd'),JSON[_0x4450('0xf')](_0x2564ae));if(_0x2564ae['error']){if(_0x2564ae['error']['code']===0x1f4){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x34afba,_0x2564ae[_0x4450('0x10')][_0x4450('0x11')]);return _0x1b9e98(_0x2564ae[_0x4450('0x10')][_0x4450('0x11')]);}logger[_0x4450('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x34afba,_0x2564ae['error'][_0x4450('0x11')]);return _0x4767b8(_0x2564ae[_0x4450('0x10')][_0x4450('0x11')]);}else{logger['info'](_0x4450('0xc'),_0x34afba,_0x4450('0xd'));_0x4767b8(_0x2564ae['result'][_0x4450('0x11')]);}})[_0x4450('0x12')](function(_0x5977d8){logger[_0x4450('0x10')](_0x4450('0xc'),_0x34afba,_0x5977d8);_0x1b9e98(_0x5977d8);});});} \ No newline at end of file +var _0x5db5=['code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5db5,0x1ba));var _0x55db=function(_0xedbe02,_0x9b0b43){_0xedbe02=_0xedbe02-0x0;var _0x3581ea=_0x5db5[_0xedbe02];return _0x3581ea;};'use strict';var _=require(_0x55db('0x0'));var util=require(_0x55db('0x1'));var moment=require(_0x55db('0x2'));var BPromise=require(_0x55db('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x55db('0x4'));var db=require(_0x55db('0x5'))['db'];var utils=require(_0x55db('0x6'));var logger=require(_0x55db('0x7'))(_0x55db('0x8'));var config=require(_0x55db('0x9'));var jayson=require(_0x55db('0xa'));var client=jayson[_0x55db('0xb')][_0x55db('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x26f483,_0x278998,_0x33b7eb){return new BPromise(function(_0x40520c,_0x28b986){return client['request'](_0x26f483,_0x33b7eb)['then'](function(_0x579114){logger['info'](_0x55db('0xd'),_0x278998,_0x55db('0xe'));logger[_0x55db('0xf')](_0x55db('0x10'),_0x278998,_0x55db('0xe'),JSON['stringify'](_0x579114));if(_0x579114['error']){if(_0x579114[_0x55db('0x11')][_0x55db('0x12')]===0x1f4){logger['error'](_0x55db('0xd'),_0x278998,_0x579114['error'][_0x55db('0x13')]);return _0x28b986(_0x579114[_0x55db('0x11')][_0x55db('0x13')]);}logger[_0x55db('0x11')](_0x55db('0xd'),_0x278998,_0x579114[_0x55db('0x11')][_0x55db('0x13')]);return _0x40520c(_0x579114[_0x55db('0x11')][_0x55db('0x13')]);}else{logger[_0x55db('0x14')](_0x55db('0xd'),_0x278998,_0x55db('0xe'));_0x40520c(_0x579114[_0x55db('0x15')][_0x55db('0x13')]);}})[_0x55db('0x16')](function(_0x3349a6){logger[_0x55db('0x11')](_0x55db('0xd'),_0x278998,_0x3349a6);_0x28b986(_0x3349a6);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 07ddf4b..65f1447 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 _0x5955=['/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x559546,_0x5131f4){var _0x23a025=function(_0x44036b){while(--_0x44036b){_0x559546['push'](_0x559546['shift']());}};_0x23a025(++_0x5131f4);}(_0x5955,0x182));var _0x5595=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x5955[_0x59d89e];return _0x554e93;};'use strict';var multer=require(_0x5595('0x0'));var util=require(_0x5595('0x1'));var path=require(_0x5595('0x2'));var timeout=require(_0x5595('0x3'));var express=require(_0x5595('0x4'));var router=express['Router']();var auth=require(_0x5595('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5595('0x6'));var controller=require('./pause.controller');router[_0x5595('0x7')]('/',auth[_0x5595('0x8')](),controller[_0x5595('0x9')]);router[_0x5595('0x7')](_0x5595('0xa'),auth['isAuthenticated'](),controller[_0x5595('0xb')]);router[_0x5595('0xc')]('/',auth[_0x5595('0x8')](),controller[_0x5595('0xd')]);router[_0x5595('0xe')](_0x5595('0xa'),auth[_0x5595('0x8')](),controller[_0x5595('0xf')]);router[_0x5595('0x10')](_0x5595('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x5595('0x11')]=router; \ No newline at end of file +var _0x7910=['./pause.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment'];(function(_0x2c9cf9,_0x2bed45){var _0x560d6d=function(_0x419979){while(--_0x419979){_0x2c9cf9['push'](_0x2c9cf9['shift']());}};_0x560d6d(++_0x2bed45);}(_0x7910,0x107));var _0x0791=function(_0x5275b8,_0x51e5dd){_0x5275b8=_0x5275b8-0x0;var _0x568a9b=_0x7910[_0x5275b8];return _0x568a9b;};'use strict';var multer=require(_0x0791('0x0'));var util=require(_0x0791('0x1'));var path=require(_0x0791('0x2'));var timeout=require('connect-timeout');var express=require(_0x0791('0x3'));var router=express[_0x0791('0x4')]();var auth=require(_0x0791('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0791('0x6'));var controller=require(_0x0791('0x7'));router[_0x0791('0x8')]('/',auth[_0x0791('0x9')](),controller['index']);router['get'](_0x0791('0xa'),auth[_0x0791('0x9')](),controller[_0x0791('0xb')]);router[_0x0791('0xc')]('/',auth['isAuthenticated'](),controller[_0x0791('0xd')]);router['put'](_0x0791('0xa'),auth['isAuthenticated'](),controller[_0x0791('0xe')]);router[_0x0791('0xf')](_0x0791('0xa'),auth[_0x0791('0x9')](),controller[_0x0791('0x10')]);module[_0x0791('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 93e883b..f3b2914 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 _0xeb7d=['sequelize','exports','name'];(function(_0x26addb,_0x31d999){var _0x348788=function(_0x5d17c5){while(--_0x5d17c5){_0x26addb['push'](_0x26addb['shift']());}};_0x348788(++_0x31d999);}(_0xeb7d,0xa2));var _0xdeb7=function(_0x29d824,_0x24a09d){_0x29d824=_0x29d824-0x0;var _0x39d80c=_0xeb7d[_0x29d824];return _0x39d80c;};'use strict';var Sequelize=require(_0xdeb7('0x0'));module[_0xdeb7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xdeb7('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf305=['sequelize','exports','STRING'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xf305,0x150));var _0x5f30=function(_0x4536a4,_0x55af7b){_0x4536a4=_0x4536a4-0x0;var _0x4fd1c1=_0xf305[_0x4536a4];return _0x4fd1c1;};'use strict';var Sequelize=require(_0x5f30('0x0'));module[_0x5f30('0x1')]={'name':{'type':Sequelize[_0x5f30('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x5f30('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 9f57203..eb0f474 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 _0x28e5=['get','Pauses','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','catch','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','apply','reject','update','then','destroy'];(function(_0x7e6b22,_0x4116fd){var _0x3f7e2a=function(_0xd26244){while(--_0xd26244){_0x7e6b22['push'](_0x7e6b22['shift']());}};_0x3f7e2a(++_0x4116fd);}(_0x28e5,0x1a6));var _0x528e=function(_0x4ff51a,_0x15de86){_0x4ff51a=_0x4ff51a-0x0;var _0x8646c1=_0x28e5[_0x4ff51a];return _0x8646c1;};'use strict';var pdf=require(_0x528e('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x528e('0x1'));var jsonpatch=require(_0x528e('0x2'));var rp=require('request-promise');var moment=require(_0x528e('0x3'));var BPromise=require(_0x528e('0x4'));var Mustache=require(_0x528e('0x5'));var util=require(_0x528e('0x6'));var path=require(_0x528e('0x7'));var sox=require('sox');var csv=require(_0x528e('0x8'));var ejs=require(_0x528e('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x528e('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x528e('0xb'));var toCsv=require(_0x528e('0x8'));var querystring=require(_0x528e('0xc'));var Papa=require(_0x528e('0xd'));var Redis=require(_0x528e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x528e('0xf'));var as=require(_0x528e('0x10'));var hardwareService=require(_0x528e('0x11'));var logger=require(_0x528e('0x12'))(_0x528e('0x13'));var utils=require('../../config/utils');var config=require(_0x528e('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x528e('0x15'))['db'];function respondWithStatusCode(_0x1935bb,_0x549e7a){_0x549e7a=_0x549e7a||0xcc;return function(_0x114d21){if(_0x114d21){return _0x1935bb[_0x528e('0x16')](_0x549e7a);}return _0x1935bb[_0x528e('0x17')](_0x549e7a)[_0x528e('0x18')]();};}function respondWithResult(_0x4ec194,_0xc554f){_0xc554f=_0xc554f||0xc8;return function(_0x2cb351){if(_0x2cb351){return _0x4ec194[_0x528e('0x17')](_0xc554f)[_0x528e('0x19')](_0x2cb351);}};}function respondWithFilteredResult(_0x31d44f,_0x4c72a5){return function(_0x5e1fbe){if(_0x5e1fbe){var _0x2fa85d=_0x5e1fbe[_0x528e('0x1a')],_0x2fe62b=_0x4c72a5[_0x528e('0x1b')],_0x18e0ed=_0x4c72a5[_0x528e('0x1b')]+_0x4c72a5[_0x528e('0x1c')],_0x33af04;if(_0x18e0ed>=_0x2fa85d){_0x18e0ed=_0x2fa85d;_0x33af04=0xc8;}else{_0x33af04=0xce;}_0x31d44f[_0x528e('0x17')](_0x33af04);return _0x31d44f['set']('Content-Range',_0x2fe62b+'-'+_0x18e0ed+'/'+_0x2fa85d)['json'](_0x5e1fbe);}return null;};}function patchUpdates(_0x2fe890){return function(_0x24d8a5){try{jsonpatch[_0x528e('0x1d')](_0x24d8a5,_0x2fe890,!![]);}catch(_0x324f8f){return BPromise[_0x528e('0x1e')](_0x324f8f);}return _0x24d8a5['save']();};}function saveUpdates(_0x2e17cf,_0x59e76e){return function(_0xcf05cb){if(_0xcf05cb){return _0xcf05cb[_0x528e('0x1f')](_0x2e17cf)[_0x528e('0x20')](function(_0x5d7cf1){return _0x5d7cf1;});}return null;};}function removeEntity(_0x1ded39,_0x573144){return function(_0xeac146){if(_0xeac146){return _0xeac146[_0x528e('0x21')]()[_0x528e('0x20')](function(){var _0x60e01=_0xeac146[_0x528e('0x22')]({'plain':!![]});var _0x2fa2c0=_0x528e('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x2fa2c0,'resourceId':_0x60e01['id']}})[_0x528e('0x20')](function(){return _0xeac146;});})['then'](function(){_0x1ded39[_0x528e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15ceba,_0x82b734){return function(_0x59eb82){if(!_0x59eb82){_0x15ceba[_0x528e('0x16')](0x194);}return _0x59eb82;};}function handleError(_0x54a16a,_0x4db05f){_0x4db05f=_0x4db05f||0x1f4;return function(_0x21e916){logger[_0x528e('0x24')](_0x21e916[_0x528e('0x25')]);if(_0x21e916[_0x528e('0x26')]){delete _0x21e916[_0x528e('0x26')];}_0x54a16a['status'](_0x4db05f)[_0x528e('0x27')](_0x21e916);};}exports[_0x528e('0x28')]=function(_0x4159ea,_0x3f9ce6){var _0x2a217d={},_0x27a3d3={},_0x33b543={'count':0x0,'rows':[]};var _0x41402d=_[_0x528e('0x29')](db[_0x528e('0x2a')][_0x528e('0x2b')],function(_0x4720ff){return{'name':_0x4720ff[_0x528e('0x2c')],'type':_0x4720ff[_0x528e('0x2d')][_0x528e('0x2e')]};});_0x27a3d3[_0x528e('0x2f')]=_['map'](_0x41402d,_0x528e('0x26'));_0x27a3d3['query']=_['keys'](_0x4159ea[_0x528e('0x30')]);_0x27a3d3[_0x528e('0x31')]=_[_0x528e('0x32')](_0x27a3d3[_0x528e('0x2f')],_0x27a3d3[_0x528e('0x30')]);_0x2a217d[_0x528e('0x33')]=_['intersection'](_0x27a3d3[_0x528e('0x2f')],qs['fields'](_0x4159ea['query'][_0x528e('0x34')]));_0x2a217d[_0x528e('0x33')]=_0x2a217d['attributes'][_0x528e('0x35')]?_0x2a217d['attributes']:_0x27a3d3[_0x528e('0x2f')];if(!_0x4159ea['query'][_0x528e('0x36')]('nolimit')){_0x2a217d[_0x528e('0x1c')]=qs[_0x528e('0x1c')](_0x4159ea[_0x528e('0x30')]['limit']);_0x2a217d[_0x528e('0x1b')]=qs[_0x528e('0x1b')](_0x4159ea[_0x528e('0x30')][_0x528e('0x1b')]);}_0x2a217d[_0x528e('0x37')]=qs[_0x528e('0x38')](_0x4159ea['query'][_0x528e('0x38')]);_0x2a217d[_0x528e('0x39')]=qs[_0x528e('0x31')](_[_0x528e('0x3a')](_0x4159ea[_0x528e('0x30')],_0x27a3d3[_0x528e('0x31')]),_0x41402d);if(_0x4159ea['query']['filter']){_0x2a217d[_0x528e('0x39')]=_[_0x528e('0x3b')](_0x2a217d[_0x528e('0x39')],{'$or':_[_0x528e('0x29')](_0x41402d,function(_0x4a05b4){if(_0x4a05b4['type']!==_0x528e('0x3c')){var _0xd4de7a={};_0xd4de7a[_0x4a05b4[_0x528e('0x26')]]={'$like':'%'+_0x4159ea[_0x528e('0x30')][_0x528e('0x3d')]+'%'};return _0xd4de7a;}})});}_0x2a217d=_[_0x528e('0x3b')]({},_0x2a217d,_0x4159ea['options']);var _0x515526={'where':_0x2a217d[_0x528e('0x39')]};return db[_0x528e('0x2a')][_0x528e('0x1a')](_0x515526)[_0x528e('0x20')](function(_0x3a1629){_0x33b543[_0x528e('0x1a')]=_0x3a1629;if(_0x4159ea[_0x528e('0x30')][_0x528e('0x3e')]){_0x2a217d[_0x528e('0x3f')]=[{'all':!![]}];}return db[_0x528e('0x2a')]['findAll'](_0x2a217d);})[_0x528e('0x20')](function(_0x1b434d){_0x33b543['rows']=_0x1b434d;return _0x33b543;})[_0x528e('0x20')](respondWithFilteredResult(_0x3f9ce6,_0x2a217d))[_0x528e('0x40')](handleError(_0x3f9ce6,null));};exports['show']=function(_0x16f251,_0x6cbc63){var _0x5f2d1c={'raw':!![],'where':{'id':_0x16f251[_0x528e('0x41')]['id']}},_0x2157e1={};_0x2157e1[_0x528e('0x2f')]=_['keys'](db[_0x528e('0x2a')]['rawAttributes']);_0x2157e1['query']=_['keys'](_0x16f251[_0x528e('0x30')]);_0x2157e1['filters']=_[_0x528e('0x32')](_0x2157e1[_0x528e('0x2f')],_0x2157e1[_0x528e('0x30')]);_0x5f2d1c[_0x528e('0x33')]=_[_0x528e('0x32')](_0x2157e1[_0x528e('0x2f')],qs['fields'](_0x16f251['query'][_0x528e('0x34')]));_0x5f2d1c['attributes']=_0x5f2d1c[_0x528e('0x33')][_0x528e('0x35')]?_0x5f2d1c[_0x528e('0x33')]:_0x2157e1[_0x528e('0x2f')];if(_0x16f251[_0x528e('0x30')]['includeAll']){_0x5f2d1c[_0x528e('0x3f')]=[{'all':!![]}];}_0x5f2d1c=_[_0x528e('0x3b')]({},_0x5f2d1c,_0x16f251[_0x528e('0x42')]);return db[_0x528e('0x2a')][_0x528e('0x43')](_0x5f2d1c)[_0x528e('0x20')](handleEntityNotFound(_0x6cbc63,null))[_0x528e('0x20')](respondWithResult(_0x6cbc63,null))[_0x528e('0x40')](handleError(_0x6cbc63,null));};exports[_0x528e('0x44')]=function(_0x1c0e20,_0x5e065a){return db[_0x528e('0x2a')][_0x528e('0x44')](_0x1c0e20[_0x528e('0x45')],{})[_0x528e('0x20')](function(_0x44f616){var _0x20bd4d=_0x1c0e20['user'][_0x528e('0x22')]({'plain':!![]});if(!_0x20bd4d)throw new Error(_0x528e('0x46'));if(_0x20bd4d[_0x528e('0x47')]===_0x528e('0x48')){var _0x4d4f5d=_0x44f616['get']({'plain':!![]});var _0x2481f0='Pauses';return db[_0x528e('0x49')]['find']({'where':{'name':_0x2481f0,'userProfileId':_0x20bd4d[_0x528e('0x4a')]},'raw':!![]})[_0x528e('0x20')](function(_0x48b98a){if(_0x48b98a&&_0x48b98a['autoAssociation']===0x0){return db[_0x528e('0x4b')][_0x528e('0x44')]({'name':_0x4d4f5d[_0x528e('0x26')],'resourceId':_0x4d4f5d['id'],'type':_0x48b98a[_0x528e('0x26')],'sectionId':_0x48b98a['id']},{})[_0x528e('0x20')](function(){return _0x44f616;});}else{return _0x44f616;}})['catch'](function(_0x1ffcd9){logger[_0x528e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ffcd9);throw _0x1ffcd9;});}return _0x44f616;})[_0x528e('0x20')](respondWithResult(_0x5e065a,0xc9))[_0x528e('0x40')](handleError(_0x5e065a,null));};exports['update']=function(_0x8bdddb,_0x1d92e5){if(_0x8bdddb[_0x528e('0x45')]['id']){delete _0x8bdddb[_0x528e('0x45')]['id'];}return db[_0x528e('0x2a')][_0x528e('0x43')]({'where':{'id':_0x8bdddb['params']['id']}})[_0x528e('0x20')](handleEntityNotFound(_0x1d92e5,null))['then'](saveUpdates(_0x8bdddb[_0x528e('0x45')],null))[_0x528e('0x20')](respondWithResult(_0x1d92e5,null))[_0x528e('0x40')](handleError(_0x1d92e5,null));};exports[_0x528e('0x21')]=function(_0x1ae267,_0x28290e){return db['Pause'][_0x528e('0x43')]({'where':{'id':_0x1ae267[_0x528e('0x41')]['id']}})[_0x528e('0x20')](handleEntityNotFound(_0x28290e,null))[_0x528e('0x20')](removeEntity(_0x28290e,null))[_0x528e('0x40')](handleError(_0x28290e,null));}; \ No newline at end of file +var _0x19c3=['then','error','send','index','map','Pause','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','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','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','get','Pauses','UserProfileResource'];(function(_0x506d83,_0x1899e9){var _0x335e8b=function(_0x4a7044){while(--_0x4a7044){_0x506d83['push'](_0x506d83['shift']());}};_0x335e8b(++_0x1899e9);}(_0x19c3,0x79));var _0x319c=function(_0x35eaa1,_0x551753){_0x35eaa1=_0x35eaa1-0x0;var _0x21c201=_0x19c3[_0x35eaa1];return _0x21c201;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x319c('0x0'));var rimraf=require(_0x319c('0x1'));var zipdir=require(_0x319c('0x2'));var jsonpatch=require(_0x319c('0x3'));var rp=require(_0x319c('0x4'));var moment=require(_0x319c('0x5'));var BPromise=require(_0x319c('0x6'));var Mustache=require('mustache');var util=require(_0x319c('0x7'));var path=require(_0x319c('0x8'));var sox=require(_0x319c('0x9'));var csv=require(_0x319c('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x319c('0xb'));var jsforce=require(_0x319c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x319c('0xa'));var querystring=require(_0x319c('0xd'));var Papa=require(_0x319c('0xe'));var Redis=require(_0x319c('0xf'));var authService=require(_0x319c('0x10'));var qs=require(_0x319c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x319c('0x12'));var logger=require(_0x319c('0x13'))(_0x319c('0x14'));var utils=require('../../config/utils');var config=require(_0x319c('0x15'));var licenseUtil=require(_0x319c('0x16'));var db=require(_0x319c('0x17'))['db'];function respondWithStatusCode(_0x12934a,_0x5deca1){_0x5deca1=_0x5deca1||0xcc;return function(_0x2fe663){if(_0x2fe663){return _0x12934a[_0x319c('0x18')](_0x5deca1);}return _0x12934a[_0x319c('0x19')](_0x5deca1)[_0x319c('0x1a')]();};}function respondWithResult(_0x3bd4b1,_0x13bf59){_0x13bf59=_0x13bf59||0xc8;return function(_0x43b65d){if(_0x43b65d){return _0x3bd4b1['status'](_0x13bf59)[_0x319c('0x1b')](_0x43b65d);}};}function respondWithFilteredResult(_0xda3407,_0x5b0bbd){return function(_0x2425ff){if(_0x2425ff){var _0x2f9d24=_0x2425ff[_0x319c('0x1c')],_0x3fd75f=_0x5b0bbd[_0x319c('0x1d')],_0x3b1efa=_0x5b0bbd[_0x319c('0x1d')]+_0x5b0bbd[_0x319c('0x1e')],_0x439e06;if(_0x3b1efa>=_0x2f9d24){_0x3b1efa=_0x2f9d24;_0x439e06=0xc8;}else{_0x439e06=0xce;}_0xda3407[_0x319c('0x19')](_0x439e06);return _0xda3407[_0x319c('0x1f')](_0x319c('0x20'),_0x3fd75f+'-'+_0x3b1efa+'/'+_0x2f9d24)[_0x319c('0x1b')](_0x2425ff);}return null;};}function patchUpdates(_0xb6f71e){return function(_0x2e04f6){try{jsonpatch[_0x319c('0x21')](_0x2e04f6,_0xb6f71e,!![]);}catch(_0x4f73df){return BPromise[_0x319c('0x22')](_0x4f73df);}return _0x2e04f6[_0x319c('0x23')]();};}function saveUpdates(_0x3967ce,_0x3823c3){return function(_0x5ed3b8){if(_0x5ed3b8){return _0x5ed3b8[_0x319c('0x24')](_0x3967ce)['then'](function(_0x41d88f){return _0x41d88f;});}return null;};}function removeEntity(_0x20e42a,_0x59b17c){return function(_0x2adbef){if(_0x2adbef){return _0x2adbef[_0x319c('0x25')]()['then'](function(){var _0x2628ab=_0x2adbef[_0x319c('0x26')]({'plain':!![]});var _0x5ebae1=_0x319c('0x27');return db[_0x319c('0x28')][_0x319c('0x25')]({'where':{'type':_0x5ebae1,'resourceId':_0x2628ab['id']}})[_0x319c('0x29')](function(){return _0x2adbef;});})['then'](function(){_0x20e42a[_0x319c('0x19')](0xcc)[_0x319c('0x1a')]();});}};}function handleEntityNotFound(_0x25bf08,_0x7d321f){return function(_0x3e0993){if(!_0x3e0993){_0x25bf08['sendStatus'](0x194);}return _0x3e0993;};}function handleError(_0x553a75,_0x1370f){_0x1370f=_0x1370f||0x1f4;return function(_0x4cb1c1){logger[_0x319c('0x2a')](_0x4cb1c1['stack']);if(_0x4cb1c1['name']){delete _0x4cb1c1['name'];}_0x553a75['status'](_0x1370f)[_0x319c('0x2b')](_0x4cb1c1);};}exports[_0x319c('0x2c')]=function(_0x1ae461,_0x57bf0d){var _0xd41304={},_0x179509={},_0x4ad4d6={'count':0x0,'rows':[]};var _0x6288f5=_[_0x319c('0x2d')](db[_0x319c('0x2e')][_0x319c('0x2f')],function(_0x55056d){return{'name':_0x55056d[_0x319c('0x30')],'type':_0x55056d[_0x319c('0x31')][_0x319c('0x32')]};});_0x179509[_0x319c('0x33')]=_[_0x319c('0x2d')](_0x6288f5,_0x319c('0x34'));_0x179509[_0x319c('0x35')]=_[_0x319c('0x36')](_0x1ae461[_0x319c('0x35')]);_0x179509[_0x319c('0x37')]=_[_0x319c('0x38')](_0x179509[_0x319c('0x33')],_0x179509[_0x319c('0x35')]);_0xd41304[_0x319c('0x39')]=_['intersection'](_0x179509['model'],qs['fields'](_0x1ae461[_0x319c('0x35')][_0x319c('0x3a')]));_0xd41304[_0x319c('0x39')]=_0xd41304['attributes'][_0x319c('0x3b')]?_0xd41304[_0x319c('0x39')]:_0x179509[_0x319c('0x33')];if(!_0x1ae461['query']['hasOwnProperty']('nolimit')){_0xd41304['limit']=qs['limit'](_0x1ae461[_0x319c('0x35')][_0x319c('0x1e')]);_0xd41304[_0x319c('0x1d')]=qs['offset'](_0x1ae461['query'][_0x319c('0x1d')]);}_0xd41304['order']=qs[_0x319c('0x3c')](_0x1ae461[_0x319c('0x35')][_0x319c('0x3c')]);_0xd41304[_0x319c('0x3d')]=qs[_0x319c('0x37')](_['pick'](_0x1ae461[_0x319c('0x35')],_0x179509[_0x319c('0x37')]),_0x6288f5);if(_0x1ae461[_0x319c('0x35')][_0x319c('0x3e')]){_0xd41304['where']=_[_0x319c('0x3f')](_0xd41304[_0x319c('0x3d')],{'$or':_[_0x319c('0x2d')](_0x6288f5,function(_0xdbaa68){if(_0xdbaa68['type']!==_0x319c('0x40')){var _0x5eb72c={};_0x5eb72c[_0xdbaa68[_0x319c('0x34')]]={'$like':'%'+_0x1ae461['query'][_0x319c('0x3e')]+'%'};return _0x5eb72c;}})});}_0xd41304=_[_0x319c('0x3f')]({},_0xd41304,_0x1ae461[_0x319c('0x41')]);var _0x266733={'where':_0xd41304['where']};return db[_0x319c('0x2e')][_0x319c('0x1c')](_0x266733)[_0x319c('0x29')](function(_0x391961){_0x4ad4d6[_0x319c('0x1c')]=_0x391961;if(_0x1ae461[_0x319c('0x35')][_0x319c('0x42')]){_0xd41304[_0x319c('0x43')]=[{'all':!![]}];}return db[_0x319c('0x2e')][_0x319c('0x44')](_0xd41304);})[_0x319c('0x29')](function(_0x367a94){_0x4ad4d6[_0x319c('0x45')]=_0x367a94;return _0x4ad4d6;})[_0x319c('0x29')](respondWithFilteredResult(_0x57bf0d,_0xd41304))[_0x319c('0x46')](handleError(_0x57bf0d,null));};exports['show']=function(_0x2e9e74,_0xf9f476){var _0x10e796={'raw':!![],'where':{'id':_0x2e9e74[_0x319c('0x47')]['id']}},_0x17b24a={};_0x17b24a['model']=_['keys'](db[_0x319c('0x2e')][_0x319c('0x2f')]);_0x17b24a[_0x319c('0x35')]=_[_0x319c('0x36')](_0x2e9e74[_0x319c('0x35')]);_0x17b24a[_0x319c('0x37')]=_[_0x319c('0x38')](_0x17b24a[_0x319c('0x33')],_0x17b24a[_0x319c('0x35')]);_0x10e796['attributes']=_[_0x319c('0x38')](_0x17b24a['model'],qs['fields'](_0x2e9e74['query']['fields']));_0x10e796[_0x319c('0x39')]=_0x10e796[_0x319c('0x39')]['length']?_0x10e796['attributes']:_0x17b24a[_0x319c('0x33')];if(_0x2e9e74[_0x319c('0x35')]['includeAll']){_0x10e796[_0x319c('0x43')]=[{'all':!![]}];}_0x10e796=_[_0x319c('0x3f')]({},_0x10e796,_0x2e9e74[_0x319c('0x41')]);return db['Pause'][_0x319c('0x48')](_0x10e796)[_0x319c('0x29')](handleEntityNotFound(_0xf9f476,null))[_0x319c('0x29')](respondWithResult(_0xf9f476,null))[_0x319c('0x46')](handleError(_0xf9f476,null));};exports['create']=function(_0x22aa7e,_0x162299){return db[_0x319c('0x2e')]['create'](_0x22aa7e[_0x319c('0x49')],{})[_0x319c('0x29')](function(_0x5d526f){var _0x46b000=_0x22aa7e[_0x319c('0x4a')][_0x319c('0x26')]({'plain':!![]});if(!_0x46b000)throw new Error(_0x319c('0x4b'));if(_0x46b000[_0x319c('0x4c')]==='user'){var _0x4d4c31=_0x5d526f[_0x319c('0x26')]({'plain':!![]});var _0x2d29a0=_0x319c('0x27');return db[_0x319c('0x4d')]['find']({'where':{'name':_0x2d29a0,'userProfileId':_0x46b000[_0x319c('0x4e')]},'raw':!![]})[_0x319c('0x29')](function(_0x55c097){if(_0x55c097&&_0x55c097[_0x319c('0x4f')]===0x0){return db[_0x319c('0x28')]['create']({'name':_0x4d4c31[_0x319c('0x34')],'resourceId':_0x4d4c31['id'],'type':_0x55c097[_0x319c('0x34')],'sectionId':_0x55c097['id']},{})['then'](function(){return _0x5d526f;});}else{return _0x5d526f;}})[_0x319c('0x46')](function(_0x23b434){logger['error'](_0x319c('0x50'),_0x23b434);throw _0x23b434;});}return _0x5d526f;})[_0x319c('0x29')](respondWithResult(_0x162299,0xc9))[_0x319c('0x46')](handleError(_0x162299,null));};exports['update']=function(_0x1d5797,_0x517ac7){if(_0x1d5797[_0x319c('0x49')]['id']){delete _0x1d5797[_0x319c('0x49')]['id'];}return db[_0x319c('0x2e')]['find']({'where':{'id':_0x1d5797[_0x319c('0x47')]['id']}})[_0x319c('0x29')](handleEntityNotFound(_0x517ac7,null))['then'](saveUpdates(_0x1d5797[_0x319c('0x49')],null))['then'](respondWithResult(_0x517ac7,null))[_0x319c('0x46')](handleError(_0x517ac7,null));};exports[_0x319c('0x25')]=function(_0x328902,_0x42f935){return db[_0x319c('0x2e')]['find']({'where':{'id':_0x328902[_0x319c('0x47')]['id']}})['then'](handleEntityNotFound(_0x42f935,null))[_0x319c('0x29')](removeEntity(_0x42f935,null))[_0x319c('0x46')](handleError(_0x42f935,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index c91387c..cf94689 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 _0x1d11=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','define','Pause'];(function(_0x28e2cd,_0x153b42){var _0x11fd46=function(_0x50df13){while(--_0x50df13){_0x28e2cd['push'](_0x28e2cd['shift']());}};_0x11fd46(++_0x153b42);}(_0x1d11,0xb6));var _0x11d1=function(_0x3504a6,_0x49e159){_0x3504a6=_0x3504a6-0x0;var _0x3a035c=_0x1d11[_0x3504a6];return _0x3a035c;};'use strict';var _=require(_0x11d1('0x0'));var util=require(_0x11d1('0x1'));var logger=require(_0x11d1('0x2'))(_0x11d1('0x3'));var moment=require(_0x11d1('0x4'));var BPromise=require(_0x11d1('0x5'));var rp=require(_0x11d1('0x6'));var fs=require('fs');var path=require(_0x11d1('0x7'));var rimraf=require(_0x11d1('0x8'));var config=require(_0x11d1('0x9'));var attributes=require(_0x11d1('0xa'));module['exports']=function(_0x32d808,_0x4a9622){return _0x32d808[_0x11d1('0xb')](_0x11d1('0xc'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb875=['moment','request-promise','path','../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash'];(function(_0x316d68,_0x4851f5){var _0x59848a=function(_0x5b58d2){while(--_0x5b58d2){_0x316d68['push'](_0x316d68['shift']());}};_0x59848a(++_0x4851f5);}(_0xb875,0x167));var _0x5b87=function(_0x35f4d8,_0x479fdb){_0x35f4d8=_0x35f4d8-0x0;var _0x5b5927=_0xb875[_0x35f4d8];return _0x5b5927;};'use strict';var _=require(_0x5b87('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5b87('0x1'));var BPromise=require('bluebird');var rp=require(_0x5b87('0x2'));var fs=require('fs');var path=require(_0x5b87('0x3'));var rimraf=require('rimraf');var config=require(_0x5b87('0x4'));var attributes=require(_0x5b87('0x5'));module[_0x5b87('0x6')]=function(_0x32ed83,_0x253d91){return _0x32ed83[_0x5b87('0x7')](_0x5b87('0x8'),attributes,{'tableName':_0x5b87('0x9'),'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 68eeef7..41f722e 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 _0xe7a5=['catch','ShowPause','Pause','find','options','where','attributes','include','map','model','stringify','lodash','util','moment','bluebird','ioredis','../../config/logger','jayson/promise','client','http','request','then','info','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x4a6065,_0x2333b8){var _0x1619e1=function(_0x7e0fab){while(--_0x7e0fab){_0x4a6065['push'](_0x4a6065['shift']());}};_0x1619e1(++_0x2333b8);}(_0xe7a5,0xe4));var _0x5e7a=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xe7a5[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x5e7a('0x0'));var util=require(_0x5e7a('0x1'));var moment=require(_0x5e7a('0x2'));var BPromise=require(_0x5e7a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5e7a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5e7a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5e7a('0x6'));var client=jayson[_0x5e7a('0x7')][_0x5e7a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58edde,_0x1c9607,_0x15a5dd){return new BPromise(function(_0x5444f6,_0x319a48){return client[_0x5e7a('0x9')](_0x58edde,_0x15a5dd)[_0x5e7a('0xa')](function(_0x1ad75a){logger[_0x5e7a('0xb')](_0x5e7a('0xc'),_0x1c9607,_0x5e7a('0xd'));logger[_0x5e7a('0xe')](_0x5e7a('0xf'),_0x1c9607,_0x5e7a('0xd'),JSON['stringify'](_0x1ad75a));if(_0x1ad75a[_0x5e7a('0x10')]){if(_0x1ad75a[_0x5e7a('0x10')][_0x5e7a('0x11')]===0x1f4){logger[_0x5e7a('0x10')](_0x5e7a('0xc'),_0x1c9607,_0x1ad75a[_0x5e7a('0x10')][_0x5e7a('0x12')]);return _0x319a48(_0x1ad75a[_0x5e7a('0x10')][_0x5e7a('0x12')]);}logger[_0x5e7a('0x10')](_0x5e7a('0xc'),_0x1c9607,_0x1ad75a[_0x5e7a('0x10')][_0x5e7a('0x12')]);return _0x5444f6(_0x1ad75a[_0x5e7a('0x10')][_0x5e7a('0x12')]);}else{logger[_0x5e7a('0xb')](_0x5e7a('0xc'),_0x1c9607,'request\x20sent');_0x5444f6(_0x1ad75a[_0x5e7a('0x13')][_0x5e7a('0x12')]);}})[_0x5e7a('0x14')](function(_0x1babcc){logger[_0x5e7a('0x10')](_0x5e7a('0xc'),_0x1c9607,_0x1babcc);_0x319a48(_0x1babcc);});});}exports[_0x5e7a('0x15')]=function(_0xe3a873){var _0x1825c5=this;return new Promise(function(_0x578eee,_0x35a872){return db[_0x5e7a('0x16')][_0x5e7a('0x17')]({'raw':_0xe3a873[_0x5e7a('0x18')]?_0xe3a873[_0x5e7a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xe3a873['options']?_0xe3a873[_0x5e7a('0x18')][_0x5e7a('0x19')]||null:null,'attributes':_0xe3a873[_0x5e7a('0x18')]?_0xe3a873[_0x5e7a('0x18')][_0x5e7a('0x1a')]||null:null,'include':_0xe3a873[_0x5e7a('0x18')]?_0xe3a873[_0x5e7a('0x18')][_0x5e7a('0x1b')]?_[_0x5e7a('0x1c')](_0xe3a873[_0x5e7a('0x18')][_0x5e7a('0x1b')],function(_0x32255a){return{'model':db[_0x32255a[_0x5e7a('0x1d')]],'as':_0x32255a['as'],'attributes':_0x32255a[_0x5e7a('0x1a')],'include':_0x32255a['include']?_['map'](_0x32255a['include'],function(_0x41ff43){return{'model':db[_0x41ff43[_0x5e7a('0x1d')]],'as':_0x41ff43['as'],'attributes':_0x41ff43[_0x5e7a('0x1a')],'include':_0x41ff43[_0x5e7a('0x1b')]?_['map'](_0x41ff43[_0x5e7a('0x1b')],function(_0x54a51c){return{'model':db[_0x54a51c[_0x5e7a('0x1d')]],'as':_0x54a51c['as'],'attributes':_0x54a51c['attributes']};}):[]};}):[]};}):[]:[]})[_0x5e7a('0xa')](function(_0x4a7cb3){logger[_0x5e7a('0xb')]('ShowPause',_0xe3a873);logger[_0x5e7a('0xe')](_0x5e7a('0x15'),_0xe3a873,JSON[_0x5e7a('0x1e')](_0x4a7cb3));_0x578eee(_0x4a7cb3);})['catch'](function(_0x37c046){logger[_0x5e7a('0x10')](_0x5e7a('0x15'),_0x37c046[_0x5e7a('0x12')],_0xe3a873);_0x35a872(_0x1825c5[_0x5e7a('0x10')](0x1f4,_0x37c046[_0x5e7a('0x12')]));});});}; \ No newline at end of file +var _0xd8a1=['debug','Pause,\x20%s,\x20%s,\x20%s','error','code','message','result','ShowPause','Pause','find','options','raw','where','include','map','attributes','model','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','Pause,\x20%s,\x20%s','request\x20sent'];(function(_0xa4755a,_0x57c2b8){var _0x54acb2=function(_0x37d5d6){while(--_0x37d5d6){_0xa4755a['push'](_0xa4755a['shift']());}};_0x54acb2(++_0x57c2b8);}(_0xd8a1,0x111));var _0x1d8a=function(_0x290ca0,_0x3d6f7e){_0x290ca0=_0x290ca0-0x0;var _0x3efcd3=_0xd8a1[_0x290ca0];return _0x3efcd3;};'use strict';var _=require(_0x1d8a('0x0'));var util=require(_0x1d8a('0x1'));var moment=require(_0x1d8a('0x2'));var BPromise=require('bluebird');var rs=require(_0x1d8a('0x3'));var fs=require('fs');var Redis=require(_0x1d8a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1d8a('0x5'));var logger=require(_0x1d8a('0x6'))(_0x1d8a('0x7'));var config=require('../../config/environment');var jayson=require(_0x1d8a('0x8'));var client=jayson[_0x1d8a('0x9')][_0x1d8a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17b21d,_0x4d04c2,_0x5c6591){return new BPromise(function(_0x4b7d36,_0x4b6de3){return client['request'](_0x17b21d,_0x5c6591)[_0x1d8a('0xb')](function(_0x566ff0){logger[_0x1d8a('0xc')](_0x1d8a('0xd'),_0x4d04c2,_0x1d8a('0xe'));logger[_0x1d8a('0xf')](_0x1d8a('0x10'),_0x4d04c2,'request\x20sent',JSON['stringify'](_0x566ff0));if(_0x566ff0[_0x1d8a('0x11')]){if(_0x566ff0[_0x1d8a('0x11')][_0x1d8a('0x12')]===0x1f4){logger['error'](_0x1d8a('0xd'),_0x4d04c2,_0x566ff0['error'][_0x1d8a('0x13')]);return _0x4b6de3(_0x566ff0['error'][_0x1d8a('0x13')]);}logger['error'](_0x1d8a('0xd'),_0x4d04c2,_0x566ff0[_0x1d8a('0x11')][_0x1d8a('0x13')]);return _0x4b7d36(_0x566ff0[_0x1d8a('0x11')]['message']);}else{logger[_0x1d8a('0xc')](_0x1d8a('0xd'),_0x4d04c2,_0x1d8a('0xe'));_0x4b7d36(_0x566ff0[_0x1d8a('0x14')][_0x1d8a('0x13')]);}})['catch'](function(_0x369435){logger['error'](_0x1d8a('0xd'),_0x4d04c2,_0x369435);_0x4b6de3(_0x369435);});});}exports[_0x1d8a('0x15')]=function(_0x5ed089){var _0x55e2c1=this;return new Promise(function(_0x472ef9,_0x3259a2){return db[_0x1d8a('0x16')][_0x1d8a('0x17')]({'raw':_0x5ed089[_0x1d8a('0x18')]?_0x5ed089[_0x1d8a('0x18')][_0x1d8a('0x19')]===undefined?!![]:![]:!![],'where':_0x5ed089[_0x1d8a('0x18')]?_0x5ed089[_0x1d8a('0x18')][_0x1d8a('0x1a')]||null:null,'attributes':_0x5ed089[_0x1d8a('0x18')]?_0x5ed089['options']['attributes']||null:null,'include':_0x5ed089[_0x1d8a('0x18')]?_0x5ed089['options'][_0x1d8a('0x1b')]?_[_0x1d8a('0x1c')](_0x5ed089[_0x1d8a('0x18')][_0x1d8a('0x1b')],function(_0x35a5ea){return{'model':db[_0x35a5ea['model']],'as':_0x35a5ea['as'],'attributes':_0x35a5ea[_0x1d8a('0x1d')],'include':_0x35a5ea['include']?_[_0x1d8a('0x1c')](_0x35a5ea['include'],function(_0x40c9fd){return{'model':db[_0x40c9fd[_0x1d8a('0x1e')]],'as':_0x40c9fd['as'],'attributes':_0x40c9fd[_0x1d8a('0x1d')],'include':_0x40c9fd[_0x1d8a('0x1b')]?_['map'](_0x40c9fd[_0x1d8a('0x1b')],function(_0x2d5ac8){return{'model':db[_0x2d5ac8[_0x1d8a('0x1e')]],'as':_0x2d5ac8['as'],'attributes':_0x2d5ac8[_0x1d8a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1d8a('0xb')](function(_0x5aca30){logger[_0x1d8a('0xc')](_0x1d8a('0x15'),_0x5ed089);logger[_0x1d8a('0xf')](_0x1d8a('0x15'),_0x5ed089,JSON['stringify'](_0x5aca30));_0x472ef9(_0x5aca30);})[_0x1d8a('0x1f')](function(_0x5c0d76){logger['error'](_0x1d8a('0x15'),_0x5c0d76[_0x1d8a('0x13')],_0x5ed089);_0x3259a2(_0x55e2c1[_0x1d8a('0x11')](0x1f4,_0x5c0d76[_0x1d8a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index a406d26..15782ae 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 _0x258f=['webhookGet','/:id','isAuthenticated','show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','replace','format','basename','extname','now','post','single','webhookPost','put','update','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook'];(function(_0x4b36df,_0x346c32){var _0x4246f5=function(_0xb42f39){while(--_0xb42f39){_0x4b36df['push'](_0x4b36df['shift']());}};_0x4246f5(++_0x346c32);}(_0x258f,0x160));var _0xf258=function(_0x4c31c2,_0x2befb6){_0x4c31c2=_0x4c31c2-0x0;var _0x4357f9=_0x258f[_0x4c31c2];return _0x4357f9;};'use strict';var multer=require(_0xf258('0x0'));var util=require(_0xf258('0x1'));var path=require('path');var timeout=require(_0xf258('0x2'));var express=require(_0xf258('0x3'));var router=express['Router']();var auth=require(_0xf258('0x4'));var interaction=require(_0xf258('0x5'));var config=require(_0xf258('0x6'));var controller=require(_0xf258('0x7'));router[_0xf258('0x8')]('/',auth['isAuthenticated'](),controller[_0xf258('0x9')]);router[_0xf258('0x8')](_0xf258('0xa'),controller[_0xf258('0xb')]);router['get'](_0xf258('0xc'),auth[_0xf258('0xd')](),controller[_0xf258('0xe')]);router[_0xf258('0x8')](_0xf258('0xf'),auth[_0xf258('0xd')](),controller['download']);var upload=multer({'storage':multer[_0xf258('0x10')]({'destination':function(_0xef3958,_0x5d3ce4,_0x2ae0dd){_0x2ae0dd(null,path[_0xf258('0x11')](config[_0xf258('0x12')],_0xf258('0x13')));},'filename':function(_0x4abc2e,_0x5b4260,_0x247bec){_0x5b4260[_0xf258('0x14')]=_0x5b4260[_0xf258('0x14')][_0xf258('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x247bec(null,util[_0xf258('0x16')]('%s-%s%s',path[_0xf258('0x17')](_0x5b4260[_0xf258('0x14')],path[_0xf258('0x18')](_0x5b4260['originalname'])),Date[_0xf258('0x19')](),path[_0xf258('0x18')](_0x5b4260[_0xf258('0x14')])));}})});router[_0xf258('0x1a')]('/',upload[_0xf258('0x1b')]('file'),controller['upload']);router[_0xf258('0x1a')]('/webhook',controller[_0xf258('0x1c')]);router[_0xf258('0x1d')](_0xf258('0xc'),auth['isAuthenticated'](),controller[_0xf258('0x1e')]);router['delete'](_0xf258('0xc'),auth[_0xf258('0xd')](),controller[_0xf258('0x1f')]);module[_0xf258('0x20')]=router; \ No newline at end of file +var _0x458d=['connect-timeout','express','Router','../../components/interaction/service','index','get','/webhook','/:id','isAuthenticated','download','diskStorage','root','server/files/plugins','originalname','replace','%s-%s%s','basename','now','post','single','file','upload','webhookPost','put','update','delete','exports','multer','path'];(function(_0x208431,_0xa05891){var _0x2ded43=function(_0x2b2bbd){while(--_0x2b2bbd){_0x208431['push'](_0x208431['shift']());}};_0x2ded43(++_0xa05891);}(_0x458d,0x15a));var _0xd458=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x458d[_0xbd08b4];return _0x314f1e;};'use strict';var multer=require(_0xd458('0x0'));var util=require('util');var path=require(_0xd458('0x1'));var timeout=require(_0xd458('0x2'));var express=require(_0xd458('0x3'));var router=express[_0xd458('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd458('0x5'));var config=require('../../config/environment');var controller=require('./plugin.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd458('0x6')]);router[_0xd458('0x7')](_0xd458('0x8'),controller['webhookGet']);router[_0xd458('0x7')](_0xd458('0x9'),auth[_0xd458('0xa')](),controller['show']);router[_0xd458('0x7')]('/:id/download',auth['isAuthenticated'](),controller[_0xd458('0xb')]);var upload=multer({'storage':multer[_0xd458('0xc')]({'destination':function(_0x199663,_0x1c474a,_0x1b91e1){_0x1b91e1(null,path['join'](config[_0xd458('0xd')],_0xd458('0xe')));},'filename':function(_0xd6639f,_0x158d89,_0x2bfbee){_0x158d89['originalname']=_0x158d89[_0xd458('0xf')][_0xd458('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2bfbee(null,util['format'](_0xd458('0x11'),path[_0xd458('0x12')](_0x158d89[_0xd458('0xf')],path['extname'](_0x158d89[_0xd458('0xf')])),Date[_0xd458('0x13')](),path['extname'](_0x158d89[_0xd458('0xf')])));}})});router[_0xd458('0x14')]('/',upload[_0xd458('0x15')](_0xd458('0x16')),controller[_0xd458('0x17')]);router[_0xd458('0x14')](_0xd458('0x8'),controller[_0xd458('0x18')]);router[_0xd458('0x19')](_0xd458('0x9'),auth['isAuthenticated'](),controller[_0xd458('0x1a')]);router[_0xd458('0x1b')](_0xd458('0x9'),auth[_0xd458('0xa')](),controller['delete']);module[_0xd458('0x1c')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 1c3239b..a6121cc 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 _0x9b65=['agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly'];(function(_0xc5f065,_0x59e711){var _0x67d9a=function(_0x3ade8f){while(--_0x3ade8f){_0xc5f065['push'](_0xc5f065['shift']());}};_0x67d9a(++_0x59e711);}(_0x9b65,0x1d2));var _0x59b6=function(_0x38f0e8,_0x266286){_0x38f0e8=_0x38f0e8-0x0;var _0x25a453=_0x9b65[_0x38f0e8];return _0x25a453;};'use strict';var Sequelize=require(_0x59b6('0x0'));module[_0x59b6('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x59b6('0x2')](_0x59b6('0x3'),_0x59b6('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x59b6('0x5')]},'path':{'type':Sequelize[_0x59b6('0x6')],'comment':_0x59b6('0x7')},'active':{'type':Sequelize[_0x59b6('0x8')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x59b6('0x2')](_0x59b6('0x9'),_0x59b6('0xa'),_0x59b6('0xb'),_0x59b6('0xc')),'defaultValue':_0x59b6('0xb'),'comment':_0x59b6('0xd')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0x59b6('0x6')]},'agentUrl':{'type':Sequelize[_0x59b6('0x6')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x59b6('0x6')]}}; \ No newline at end of file +var _0xc51e=['never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always'];(function(_0x5eccea,_0x30a796){var _0x3e7afc=function(_0xd49c0c){while(--_0xd49c0c){_0x5eccea['push'](_0x5eccea['shift']());}};_0x3e7afc(++_0x30a796);}(_0xc51e,0x13a));var _0xec51=function(_0x3238bd,_0x4ea3ef){_0x3238bd=_0x3238bd-0x0;var _0xdc7a7e=_0xc51e[_0x3238bd];return _0xdc7a7e;};'use strict';var Sequelize=require(_0xec51('0x0'));module[_0xec51('0x1')]={'name':{'type':Sequelize[_0xec51('0x2')]},'type':{'type':Sequelize[_0xec51('0x3')]('html','script')},'description':{'type':Sequelize[_0xec51('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xec51('0x2')],'comment':_0xec51('0x5')},'active':{'type':Sequelize[_0xec51('0x6')],'defaultValue':0x0,'comment':_0xec51('0x7')},'sidebar':{'type':Sequelize[_0xec51('0x3')]('adminOnly',_0xec51('0x8'),_0xec51('0x9'),_0xec51('0xa')),'defaultValue':_0xec51('0x9'),'comment':_0xec51('0xb')},'icon':{'type':Sequelize[_0xec51('0x2')]},'adminUrl':{'type':Sequelize[_0xec51('0x2')]},'agentUrl':{'type':Sequelize[_0xec51('0x2')]},'scriptName':{'type':Sequelize[_0xec51('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index cb4c0a8..64b812a 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 _0x8338=['scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','statusCode','webhookPost','resolve','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','Plugins','UserProfileResource','sendStatus','stack','send','map','rawAttributes','fieldName','key','keys','query','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','filters','filter','where','type','VIRTUAL','name','merge','options','Plugin','includeAll','include','findAll','rows','show','params','find','download','server/files/plugins','format','%s.zip','basename','createWriteStream','warning','code','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','root','dirname','node_modules/**/*','finalize','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','catch','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing'];(function(_0x974307,_0x19d1af){var _0x5bec47=function(_0x19d7a3){while(--_0x19d7a3){_0x974307['push'](_0x974307['shift']());}};_0x5bec47(++_0x19d1af);}(_0x8338,0xd2));var _0x8833=function(_0x36c516,_0x4f9f40){_0x36c516=_0x36c516-0x0;var _0x55a95c=_0x8338[_0x36c516];return _0x55a95c;};'use strict';var pdf=require(_0x8833('0x0'));var emlformat=require(_0x8833('0x1'));var rimraf=require(_0x8833('0x2'));var zipdir=require(_0x8833('0x3'));var jsonpatch=require(_0x8833('0x4'));var rp=require(_0x8833('0x5'));var moment=require(_0x8833('0x6'));var BPromise=require(_0x8833('0x7'));var Mustache=require(_0x8833('0x8'));var util=require('util');var path=require(_0x8833('0x9'));var sox=require(_0x8833('0xa'));var csv=require(_0x8833('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8833('0xc'));var squel=require(_0x8833('0xd'));var crypto=require(_0x8833('0xe'));var jsforce=require(_0x8833('0xf'));var deskjs=require(_0x8833('0x10'));var toCsv=require(_0x8833('0xb'));var querystring=require(_0x8833('0x11'));var Papa=require(_0x8833('0x12'));var extract=require(_0x8833('0x13'));var rimraf=require(_0x8833('0x2'));var archiver=require(_0x8833('0x14'));var Redis=require(_0x8833('0x15'));var authService=require(_0x8833('0x16'));var qs=require(_0x8833('0x17'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8833('0x18'));var logger=require(_0x8833('0x19'))(_0x8833('0x1a'));var utils=require(_0x8833('0x1b'));var config=require(_0x8833('0x1c'));var licenseUtil=require(_0x8833('0x1d'));var db=require(_0x8833('0x1e'))['db'];config[_0x8833('0x1f')]=_[_0x8833('0x20')](config[_0x8833('0x1f')],{'host':'localhost','port':0x18eb});var socket=require(_0x8833('0x21'))(new Redis(config[_0x8833('0x1f')]));require('./plugin.socket')[_0x8833('0x22')](socket);function respondWithStatusCode(_0x42ea05,_0x46bd5){_0x46bd5=_0x46bd5||0xcc;return function(_0x49d33b){if(_0x49d33b){return _0x42ea05['sendStatus'](_0x46bd5);}return _0x42ea05[_0x8833('0x23')](_0x46bd5)[_0x8833('0x24')]();};}function respondWithResult(_0x5a8009,_0x597408){_0x597408=_0x597408||0xc8;return function(_0x5924a1){if(_0x5924a1){return _0x5a8009['status'](_0x597408)[_0x8833('0x25')](_0x5924a1);}};}function respondWithFilteredResult(_0x231fca,_0x390564){return function(_0x4adefa){if(_0x4adefa){var _0x4caa50=_0x4adefa[_0x8833('0x26')],_0x5db36b=_0x390564[_0x8833('0x27')],_0x338db9=_0x390564[_0x8833('0x27')]+_0x390564[_0x8833('0x28')],_0x370719;if(_0x338db9>=_0x4caa50){_0x338db9=_0x4caa50;_0x370719=0xc8;}else{_0x370719=0xce;}_0x231fca[_0x8833('0x23')](_0x370719);return _0x231fca[_0x8833('0x29')](_0x8833('0x2a'),_0x5db36b+'-'+_0x338db9+'/'+_0x4caa50)[_0x8833('0x25')](_0x4adefa);}return null;};}function patchUpdates(_0x192b77){return function(_0x516518){try{jsonpatch[_0x8833('0x2b')](_0x516518,_0x192b77,!![]);}catch(_0x17483e){return BPromise[_0x8833('0x2c')](_0x17483e);}return _0x516518['save']();};}function saveUpdates(_0x39fc2d,_0x32d105){return function(_0x111b3b){if(_0x111b3b){return _0x111b3b[_0x8833('0x2d')](_0x39fc2d)[_0x8833('0x2e')](function(_0x51bebe){return _0x51bebe;});}return null;};}function removeEntity(_0x3f217e,_0x3c6813){return function(_0x48876e){if(_0x48876e){return _0x48876e[_0x8833('0x2f')]()['then'](function(){var _0x53f3ec=_0x48876e['get']({'plain':!![]});var _0x232141=_0x8833('0x30');return db[_0x8833('0x31')]['destroy']({'where':{'type':_0x232141,'resourceId':_0x53f3ec['id']}})[_0x8833('0x2e')](function(){return _0x48876e;});})[_0x8833('0x2e')](function(){_0x3f217e[_0x8833('0x23')](0xcc)[_0x8833('0x24')]();});}};}function handleEntityNotFound(_0x291a39,_0x50435e){return function(_0x18e4d0){if(!_0x18e4d0){_0x291a39[_0x8833('0x32')](0x194);}return _0x18e4d0;};}function handleError(_0x488845,_0x678b9a){_0x678b9a=_0x678b9a||0x1f4;return function(_0x5296a2){logger['error'](_0x5296a2[_0x8833('0x33')]);if(_0x5296a2['name']){delete _0x5296a2['name'];}_0x488845[_0x8833('0x23')](_0x678b9a)[_0x8833('0x34')](_0x5296a2);};}exports['index']=function(_0x2f68da,_0x218232){var _0xa33cfa={},_0x3f0f8c={},_0x3241b7={'count':0x0,'rows':[]};var _0x2753a8=_[_0x8833('0x35')](db['Plugin'][_0x8833('0x36')],function(_0x466da9){return{'name':_0x466da9[_0x8833('0x37')],'type':_0x466da9['type'][_0x8833('0x38')]};});_0x3f0f8c['model']=_[_0x8833('0x35')](_0x2753a8,'name');_0x3f0f8c['query']=_[_0x8833('0x39')](_0x2f68da[_0x8833('0x3a')]);_0x3f0f8c['filters']=_[_0x8833('0x3b')](_0x3f0f8c['model'],_0x3f0f8c[_0x8833('0x3a')]);_0xa33cfa['attributes']=_[_0x8833('0x3b')](_0x3f0f8c['model'],qs[_0x8833('0x3c')](_0x2f68da[_0x8833('0x3a')][_0x8833('0x3c')]));_0xa33cfa[_0x8833('0x3d')]=_0xa33cfa[_0x8833('0x3d')][_0x8833('0x3e')]?_0xa33cfa[_0x8833('0x3d')]:_0x3f0f8c[_0x8833('0x3f')];if(!_0x2f68da[_0x8833('0x3a')][_0x8833('0x40')](_0x8833('0x41'))){_0xa33cfa['limit']=qs[_0x8833('0x28')](_0x2f68da[_0x8833('0x3a')][_0x8833('0x28')]);_0xa33cfa[_0x8833('0x27')]=qs['offset'](_0x2f68da['query'][_0x8833('0x27')]);}_0xa33cfa[_0x8833('0x42')]=qs[_0x8833('0x43')](_0x2f68da['query']['sort']);_0xa33cfa['where']=qs['filters'](_['pick'](_0x2f68da['query'],_0x3f0f8c[_0x8833('0x44')]),_0x2753a8);if(_0x2f68da[_0x8833('0x3a')][_0x8833('0x45')]){_0xa33cfa[_0x8833('0x46')]=_['merge'](_0xa33cfa[_0x8833('0x46')],{'$or':_[_0x8833('0x35')](_0x2753a8,function(_0x100c97){if(_0x100c97[_0x8833('0x47')]!==_0x8833('0x48')){var _0x2544a7={};_0x2544a7[_0x100c97[_0x8833('0x49')]]={'$like':'%'+_0x2f68da[_0x8833('0x3a')]['filter']+'%'};return _0x2544a7;}})});}_0xa33cfa=_[_0x8833('0x4a')]({},_0xa33cfa,_0x2f68da[_0x8833('0x4b')]);var _0xab0951={'where':_0xa33cfa['where']};return db[_0x8833('0x4c')][_0x8833('0x26')](_0xab0951)[_0x8833('0x2e')](function(_0x3a5c8e){_0x3241b7['count']=_0x3a5c8e;if(_0x2f68da[_0x8833('0x3a')][_0x8833('0x4d')]){_0xa33cfa[_0x8833('0x4e')]=[{'all':!![]}];}return db['Plugin'][_0x8833('0x4f')](_0xa33cfa);})['then'](function(_0x407e90){_0x3241b7[_0x8833('0x50')]=_0x407e90;return _0x3241b7;})[_0x8833('0x2e')](respondWithFilteredResult(_0x218232,_0xa33cfa))['catch'](handleError(_0x218232,null));};exports[_0x8833('0x51')]=function(_0x2e2961,_0x48dee){var _0x5b98f7={'raw':!![],'where':{'id':_0x2e2961[_0x8833('0x52')]['id']}},_0x3170b6={};_0x3170b6[_0x8833('0x3f')]=_['keys'](db[_0x8833('0x4c')][_0x8833('0x36')]);_0x3170b6['query']=_[_0x8833('0x39')](_0x2e2961[_0x8833('0x3a')]);_0x3170b6[_0x8833('0x44')]=_[_0x8833('0x3b')](_0x3170b6[_0x8833('0x3f')],_0x3170b6[_0x8833('0x3a')]);_0x5b98f7[_0x8833('0x3d')]=_['intersection'](_0x3170b6[_0x8833('0x3f')],qs['fields'](_0x2e2961['query']['fields']));_0x5b98f7[_0x8833('0x3d')]=_0x5b98f7['attributes']['length']?_0x5b98f7[_0x8833('0x3d')]:_0x3170b6[_0x8833('0x3f')];if(_0x2e2961[_0x8833('0x3a')][_0x8833('0x4d')]){_0x5b98f7['include']=[{'all':!![]}];}_0x5b98f7=_[_0x8833('0x4a')]({},_0x5b98f7,_0x2e2961['options']);return db[_0x8833('0x4c')][_0x8833('0x53')](_0x5b98f7)[_0x8833('0x2e')](handleEntityNotFound(_0x48dee,null))[_0x8833('0x2e')](respondWithResult(_0x48dee,null))['catch'](handleError(_0x48dee,null));};exports[_0x8833('0x54')]=function(_0x899533,_0x55dfaf,_0x370ceb){return db[_0x8833('0x4c')][_0x8833('0x53')]({'where':{'id':_0x899533[_0x8833('0x52')]['id']},'attributes':[_0x8833('0x49'),_0x8833('0x9')],'raw':!![]})['then'](handleEntityNotFound(_0x55dfaf,null))[_0x8833('0x2e')](function(_0x369c1f){if(_0x369c1f){var _0x38f047=path['join'](config['root'],_0x8833('0x55'),util[_0x8833('0x56')](_0x8833('0x57'),path[_0x8833('0x58')](_0x369c1f[_0x8833('0x9')])));var _0x30dd9a=fs[_0x8833('0x59')](_0x38f047);var _0xe7c6b8=archiver('zip',{'zlib':{'level':0x9}});_0xe7c6b8['on'](_0x8833('0x5a'),function(_0xc654c0){if(_0xc654c0[_0x8833('0x5b')]===_0x8833('0x5c')){logger[_0x8833('0x5d')](_0xc654c0);}else{throw new db[(_0x8833('0x5e'))][(_0x8833('0x5f'))](_0x8833('0x60'));}});_0xe7c6b8['on']('error',function(_0x2715aa){throw new db['Sequelize']['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0xe7c6b8[_0x8833('0x61')](_0x30dd9a);_0xe7c6b8[_0x8833('0x62')](_0x8833('0x63'),{'cwd':path[_0x8833('0x64')](config[_0x8833('0x65')],_0x8833('0x55'),path[_0x8833('0x66')](_0x369c1f['path'])),'ignore':[path['join'](path['basename'](_0x369c1f[_0x8833('0x9')]),_0x8833('0x67')),path[_0x8833('0x64')](path['basename'](_0x369c1f['path']),'attachments/**/*')],'nodir':!![]})[_0x8833('0x68')]();_0x30dd9a['on'](_0x8833('0x69'),function(){if(!fs[_0x8833('0x6a')](_0x38f047)){throw new db[(_0x8833('0x5e'))][(_0x8833('0x5f'))]('Plugin\x20not\x20found');}return _0x55dfaf[_0x8833('0x54')](_0x38f047,util[_0x8833('0x56')](_0x8833('0x57'),path[_0x8833('0x58')](_0x369c1f[_0x8833('0x9')])),function(_0x23f0e5){if(_0x23f0e5){throw new db[(_0x8833('0x5e'))]['Error'](_0x8833('0x6b'));}fs[_0x8833('0x6c')](_0x38f047);logger[_0x8833('0x6d')](_0x8833('0x6e'));logger['info'](_0x8833('0x6f'));});});}return null;})[_0x8833('0x70')](handleError(_0x55dfaf,null));};exports[_0x8833('0x71')]=function(_0x2108e2,_0x55bcdb,_0x38d2ba){var _0x1cf741=path[_0x8833('0x58')](_0x2108e2[_0x8833('0x72')][_0x8833('0x73')],path['extname'](_0x2108e2['file'][_0x8833('0x73')]));var _0x743b6b=path[_0x8833('0x64')](config[_0x8833('0x65')],_0x8833('0x55'),_0x2108e2[_0x8833('0x72')][_0x8833('0x73')]);var _0x3f7d19=path[_0x8833('0x64')](config[_0x8833('0x65')],'server/files/plugins',_0x1cf741);logger[_0x8833('0x6d')](_0x8833('0x74'),_0x743b6b);logger[_0x8833('0x6d')]('Plugin\x20upload\x20destination:\x20%s',_0x3f7d19);try{fs[_0x8833('0x75')](_0x743b6b,parseInt(_0x8833('0x76'),0x8));extract(_0x743b6b,{'dir':_0x3f7d19},function(_0x34b4ca){if(_0x34b4ca){logger[_0x8833('0x5d')](_0x34b4ca);handleError(_0x34b4ca,!![]);};var _0x50dc29=fs[_0x8833('0x77')](_0x3f7d19);if(_0x50dc29['length']>0x1){removeReferences(_0x743b6b,_0x3f7d19);logger['error'](_0x8833('0x78'));return _0x38d2ba(new Error('Invalid\x20plugin\x20structure'));}var _0x1b739b=fs[_0x8833('0x79')](path[_0x8833('0x64')](_0x3f7d19,_0x50dc29[0x0]));if(_0x1b739b['isFile']()){removeReferences(_0x743b6b,_0x3f7d19);logger[_0x8833('0x5d')]('Invalid\x20plugin\x20structure');return _0x38d2ba(new Error('Invalid\x20plugin\x20structure'));}if(_0x1b739b[_0x8833('0x7a')]()){var _0xa634d7=fs[_0x8833('0x77')](path['join'](_0x3f7d19,_0x50dc29[0x0]));if(_0xa634d7[_0x8833('0x3e')]===0x0){removeReferences(_0x743b6b,_0x3f7d19);logger[_0x8833('0x5d')](_0x8833('0x78'));return _0x38d2ba(new Error(_0x8833('0x78')));}var _0x2c33b4=_0xa634d7[_0x8833('0x7b')](function(_0x400566){return _0x400566===_0x8833('0x7c');});if(!_0x2c33b4){return _0x38d2ba(new Error(_0x8833('0x7d')));}var _0x45e750=fs[_0x8833('0x7e')](path['join'](_0x3f7d19,_0x50dc29[0x0],_0x8833('0x7c')));var _0x3fb2ed=JSON[_0x8833('0x7f')](_0x45e750);if(_0x8833('0x80')==typeof _0x3fb2ed[_0x8833('0x49')]){return _0x38d2ba(new Error(_0x8833('0x81')));}if(_0x8833('0x80')==typeof _0x3fb2ed[_0x8833('0x47')]){return _0x38d2ba(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x8833('0x80')==typeof _0x3fb2ed['version']){return _0x38d2ba(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if('undefined'==typeof _0x3fb2ed[_0x8833('0x82')]){return _0x38d2ba(new Error(_0x8833('0x83')));}if(_0x3fb2ed[_0x8833('0x47')]==='html'){if(_0x8833('0x80')==typeof _0x3fb2ed[_0x8833('0x82')][_0x8833('0x84')]){return _0x38d2ba(new Error(_0x8833('0x85')));}if(_0x8833('0x80')==typeof _0x3fb2ed['parameters'][_0x8833('0x84')][_0x8833('0x86')]&&_0x8833('0x80')==typeof _0x3fb2ed['parameters'][_0x8833('0x84')][_0x8833('0x87')]){return _0x38d2ba(new Error(_0x8833('0x88')));}}else if(_0x3fb2ed['type']===_0x8833('0x89')){if(_0x8833('0x80')==typeof _0x3fb2ed['parameters'][_0x8833('0x8a')]){return _0x38d2ba(new Error(_0x8833('0x8b')));}if(_0x8833('0x80')==typeof _0x3fb2ed[_0x8833('0x82')][_0x8833('0x8c')]){return _0x38d2ba(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x38d2ba(new Error(_0x8833('0x8d')));}var _0x59e960=_0x3fb2ed[_0x8833('0x49')];var _0x562267=_0x3fb2ed[_0x8833('0x8e')];var _0x3c89f0=_0x3fb2ed['type'];var _0x4386f2=_0x3fb2ed['sidebar']?_0x3fb2ed[_0x8833('0x8f')]:'always';var _0x455aa3=_0x3fb2ed['icon']?_0x3fb2ed[_0x8833('0x90')]:_0x8833('0x91');var _0x56255c='';var _0x57d553='';var _0x2fadcd='';var _0x2d4a5c='';var _0x5efc59=_0x3fb2ed['version'];if(_0x3c89f0==='html'){if(_0x8833('0x80')!=typeof _0x3fb2ed[_0x8833('0x82')][_0x8833('0x84')][_0x8833('0x86')]){var _0x1af950=_0x3fb2ed['parameters']['views'][_0x8833('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x8833('0x92')](_0x1af950)){_0x56255c=path[_0x8833('0x64')](_0x8833('0x93'),_0x1cf741,_0x50dc29[0x0],_0x1af950);}else{_0x56255c=_0x1af950;}}else{logger[_0x8833('0x6d')](_0x8833('0x94'));}if('undefined'!=typeof _0x3fb2ed[_0x8833('0x82')][_0x8833('0x84')]['agent']){var _0x5246e7=_0x3fb2ed[_0x8833('0x82')][_0x8833('0x84')][_0x8833('0x87')];if(!/^(f|ht)tps?:\/\//i[_0x8833('0x92')](_0x5246e7)){_0x57d553=path[_0x8833('0x64')](_0x8833('0x93'),_0x1cf741,_0x50dc29[0x0],_0x5246e7);}else{_0x57d553=_0x5246e7;}}else{logger[_0x8833('0x6d')](_0x8833('0x95'));}}else if(_0x3c89f0===_0x8833('0x89')){_0x2fadcd=_0x3fb2ed['parameters'][_0x8833('0x8a')];_0x2d4a5c=_0x3fb2ed[_0x8833('0x82')][_0x8833('0x8c')];if(_0x8833('0x80')!=typeof _0x3fb2ed[_0x8833('0x82')][_0x8833('0x84')]){if('undefined'!=typeof _0x3fb2ed[_0x8833('0x82')][_0x8833('0x84')]['admin']){var _0x1af950=_0x3fb2ed[_0x8833('0x82')][_0x8833('0x84')][_0x8833('0x86')];if(!/^(f|ht)tps?:\/\//i[_0x8833('0x92')](_0x1af950)){_0x56255c=path[_0x8833('0x64')](_0x8833('0x93'),_0x1cf741,_0x50dc29[0x0],_0x1af950);}else{_0x56255c=_0x1af950;}}if(_0x8833('0x80')!=typeof _0x3fb2ed[_0x8833('0x82')][_0x8833('0x84')][_0x8833('0x87')]){var _0x5246e7=_0x3fb2ed[_0x8833('0x82')][_0x8833('0x84')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x8833('0x92')](_0x5246e7)){_0x57d553=path[_0x8833('0x64')](_0x8833('0x93'),_0x1cf741,_0x50dc29[0x0],_0x5246e7);}else{_0x57d553=_0x5246e7;}}}}var _0x398455={'name':_0x59e960,'description':_0x562267,'path':path[_0x8833('0x64')](_0x1cf741,_0x50dc29[0x0]),'type':_0x3c89f0,'sidebar':_0x4386f2,'icon':_0x455aa3,'adminUrl':_0x56255c,'agentUrl':_0x57d553,'scriptName':_0x2fadcd,'scriptPath':_0x2d4a5c,'version':_0x5efc59};removeReferences(_0x743b6b,null);return db[_0x8833('0x4c')][_0x8833('0x96')](_0x398455)[_0x8833('0x2e')](function(_0xe73f5a){var _0x4c692a={'role':_0x2108e2[_0x8833('0x97')][_0x8833('0x98')],'userProfileId':_0x2108e2[_0x8833('0x97')][_0x8833('0x99')]};if(!_0x4c692a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c692a[_0x8833('0x98')]==='user'){var _0x59735b=_0xe73f5a[_0x8833('0x9a')]({'plain':!![]});return db['UserProfileSection'][_0x8833('0x53')]({'where':{'name':'Plugins','userProfileId':_0x4c692a[_0x8833('0x99')]},'raw':!![]})[_0x8833('0x2e')](function(_0x35b281){if(_0x35b281&&_0x35b281[_0x8833('0x9b')]===0x0){return db['UserProfileResource'][_0x8833('0x96')]({'name':_0x59735b[_0x8833('0x49')],'resourceId':_0x59735b['id'],'type':_0x35b281[_0x8833('0x49')],'sectionId':_0x35b281['id']},{})[_0x8833('0x2e')](function(){return _0xe73f5a;});}else{return _0xe73f5a;}})[_0x8833('0x70')](function(_0x1fdcab){logger[_0x8833('0x5d')](_0x8833('0x9c'),_0x1fdcab);throw _0x1fdcab;});}return _0xe73f5a;})[_0x8833('0x2e')](respondWithResult(_0x55bcdb,null))[_0x8833('0x70')](handleError(_0x55bcdb,null));}});}catch(_0x11be53){_0x55bcdb[_0x8833('0x23')](0x1f4)[_0x8833('0x34')](_0x11be53);}};function removeReferences(_0xe72395,_0x33574f){try{if(_0xe72395){fs[_0x8833('0x6c')](_0xe72395);logger[_0x8833('0x6d')](_0x8833('0x9d'));}if(_0x33574f){rimraf(_0x33574f,function(){});logger[_0x8833('0x6d')](_0x8833('0x9e'));}}catch(_0x40e464){logger[_0x8833('0x5d')](_0x40e464);}}exports[_0x8833('0x2d')]=function(_0xe61a12,_0x4455b4,_0x236a10){return db[_0x8833('0x4c')][_0x8833('0x53')]({'where':{'id':_0xe61a12[_0x8833('0x52')]['id']}})[_0x8833('0x2e')](handleEntityNotFound(_0x4455b4,null))[_0x8833('0x2e')](saveUpdates(_0xe61a12[_0x8833('0x97')],null))[_0x8833('0x2e')](respondWithResult(_0x4455b4,null))[_0x8833('0x70')](handleError(_0x4455b4,null));};exports[_0x8833('0x9f')]=function(_0x576a0b,_0x25ac27,_0x23ee61){return db[_0x8833('0x4c')]['find']({'where':{'id':_0x576a0b[_0x8833('0x52')]['id']}})[_0x8833('0x2e')](function(_0x499de3){if(_0x499de3){return _0x499de3[_0x8833('0x2f')]();}})[_0x8833('0x2e')](function(_0x1d1c74){rimraf(path['join'](config[_0x8833('0x65')],_0x8833('0x55'),path[_0x8833('0x66')](_0x1d1c74[_0x8833('0x9')])),function(){});return _0x1d1c74;})[_0x8833('0x2e')](handleEntityNotFound(_0x25ac27,null))[_0x8833('0x2e')](respondWithStatusCode(_0x25ac27,null))['catch'](handleError(_0x25ac27,null));};exports[_0x8833('0xa0')]=function(_0x589c1b,_0x99a763,_0x369aaf){return BPromise['resolve']()[_0x8833('0x2e')](function(){if(!_0x589c1b['query'][_0x8833('0x9')]){throw new Error(_0x8833('0xa1'));}if(!_0x589c1b[_0x8833('0x3a')]['port']){throw new Error(_0x8833('0xa2'));}var _0x4fd8e2=_0x589c1b['query']['hostname']?_0x589c1b[_0x8833('0x3a')][_0x8833('0xa3')]+':'+_0x589c1b[_0x8833('0x3a')][_0x8833('0xa4')]:_0x8833('0xa5')+_0x589c1b['query'][_0x8833('0xa4')];var _0x204144=_0x589c1b[_0x8833('0x3a')]['json']?_0x589c1b[_0x8833('0x3a')]['json']:!![];var _0x17e04e=_0x589c1b[_0x8833('0x3a')][_0x8833('0xa6')]?_0x589c1b['query'][_0x8833('0xa6')]:null;var _0x1052bb={'method':_0x589c1b[_0x8833('0xa7')],'uri':util[_0x8833('0x56')](_0x8833('0xa8'),_0x4fd8e2,_0x589c1b[_0x8833('0x3a')][_0x8833('0x9')]),'json':_0x204144,'resolveWithFullResponse':!![],'encoding':_0x17e04e,'qs':_0x589c1b['query']};if(_0x589c1b[_0x8833('0xa9')]){_0x1052bb['headers']=_0x589c1b[_0x8833('0xa9')];if(_0x1052bb[_0x8833('0xa9')][_0x8833('0xaa')]){delete _0x1052bb['headers'][_0x8833('0xaa')];}}if(_0x1052bb['headers'][_0x8833('0xab')]){delete _0x1052bb[_0x8833('0xa9')][_0x8833('0xab')];}return rp(_0x1052bb);})['then'](function(_0x19c6c8){if(_0x19c6c8){_0x99a763[_0x8833('0x29')](_0x19c6c8['headers']);logger[_0x8833('0x6d')](_0x19c6c8[_0x8833('0x97')]);if(_['endsWith'](_0x589c1b[_0x8833('0x3a')][_0x8833('0x9')],_0x8833('0x54'))&&_0x19c6c8[_0x8833('0xac')]==0x1f4){return _0x99a763[_0x8833('0x32')](_0x19c6c8[_0x8833('0xac')]);}else{return _0x99a763[_0x8833('0x23')](_0x19c6c8[_0x8833('0xac')])[_0x8833('0x34')](_0x19c6c8['body']);}}else{return _0x99a763[_0x8833('0x32')](0xc8);}})[_0x8833('0x70')](handleError(_0x99a763,null));};exports[_0x8833('0xad')]=function(_0xfbef67,_0x29e90e,_0x2933b5){return BPromise[_0x8833('0xae')]()[_0x8833('0x2e')](function(){if(!_0xfbef67[_0x8833('0x3a')][_0x8833('0x9')]){throw new Error(_0x8833('0xa1'));}if(!_0xfbef67[_0x8833('0x3a')][_0x8833('0xa4')]){throw new Error(_0x8833('0xa2'));}var _0x751734=_0xfbef67[_0x8833('0x3a')][_0x8833('0xa3')]?_0xfbef67['query'][_0x8833('0xa3')]+':'+_0xfbef67[_0x8833('0x3a')][_0x8833('0xa4')]:_0x8833('0xa5')+_0xfbef67[_0x8833('0x3a')][_0x8833('0xa4')];var _0x50fc31=_0xfbef67[_0x8833('0x3a')]['json']?_0xfbef67['query']['json']:!![];var _0x42a7ee=_0xfbef67[_0x8833('0x3a')]['encoding']?_0xfbef67[_0x8833('0x3a')][_0x8833('0xa6')]:null;var _0x7cdb9b={'method':_0xfbef67[_0x8833('0xa7')],'uri':util[_0x8833('0x56')](_0x8833('0xa8'),_0x751734,_0xfbef67[_0x8833('0x3a')][_0x8833('0x9')]),'json':_0x50fc31,'resolveWithFullResponse':!![],'encoding':_0x42a7ee,'body':_0xfbef67[_0x8833('0x97')]};if(_0xfbef67[_0x8833('0xa9')]){_0x7cdb9b[_0x8833('0xa9')]=_0xfbef67[_0x8833('0xa9')];if(_0x7cdb9b['headers'][_0x8833('0xaa')]){delete _0x7cdb9b[_0x8833('0xa9')][_0x8833('0xaa')];}}if(_0x7cdb9b[_0x8833('0xa9')][_0x8833('0xab')]){delete _0x7cdb9b[_0x8833('0xa9')][_0x8833('0xab')];}return rp(_0x7cdb9b);})[_0x8833('0x2e')](function(_0xbb448b){if(_0xbb448b){_0x29e90e[_0x8833('0x29')](_0xbb448b[_0x8833('0xa9')]);logger[_0x8833('0x6d')](_0xbb448b['body']);return _0x29e90e['status'](_0xbb448b['statusCode'])['send'](_0xbb448b[_0x8833('0x97')]);}else{return _0x29e90e['sendStatus'](0xc8);}})[_0x8833('0x70')](handleError(_0x29e90e,null));}; \ No newline at end of file +var _0xc9a0=['endsWith','statusCode','webhookPost','%s%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','lodash','squel','crypto','jsforce','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','redis','localhost','./plugin.socket','sendStatus','status','json','count','offset','limit','apply','save','update','then','get','UserProfileResource','destroy','error','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','catch','show','params','Plugin','length','find','download','join','root','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','node_modules/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','upload','file','filename','server/files/plugins','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','undefined','Invalid\x20manifest:\x20name\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Extracted\x20folder\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','headers','content-length','content-type','set'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xc9a0,0x150));var _0x0c9a=function(_0x4d54f7,_0x57780b){_0x4d54f7=_0x4d54f7-0x0;var _0x142719=_0xc9a0[_0x4d54f7];return _0x142719;};'use strict';var pdf=require(_0x0c9a('0x0'));var emlformat=require(_0x0c9a('0x1'));var rimraf=require(_0x0c9a('0x2'));var zipdir=require(_0x0c9a('0x3'));var jsonpatch=require(_0x0c9a('0x4'));var rp=require(_0x0c9a('0x5'));var moment=require(_0x0c9a('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x0c9a('0x7'));var util=require(_0x0c9a('0x8'));var path=require(_0x0c9a('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x0c9a('0xa'));var squel=require(_0x0c9a('0xb'));var crypto=require(_0x0c9a('0xc'));var jsforce=require(_0x0c9a('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0c9a('0xe'));var Papa=require('papaparse');var extract=require(_0x0c9a('0xf'));var rimraf=require('rimraf');var archiver=require(_0x0c9a('0x10'));var Redis=require(_0x0c9a('0x11'));var authService=require(_0x0c9a('0x12'));var qs=require(_0x0c9a('0x13'));var as=require(_0x0c9a('0x14'));var hardwareService=require(_0x0c9a('0x15'));var logger=require('../../config/logger')(_0x0c9a('0x16'));var utils=require('../../config/utils');var config=require(_0x0c9a('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0c9a('0x18')]=_['defaults'](config[_0x0c9a('0x18')],{'host':_0x0c9a('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0c9a('0x1a'))['register'](socket);function respondWithStatusCode(_0x3f922c,_0x24a771){_0x24a771=_0x24a771||0xcc;return function(_0x122ec0){if(_0x122ec0){return _0x3f922c[_0x0c9a('0x1b')](_0x24a771);}return _0x3f922c[_0x0c9a('0x1c')](_0x24a771)['end']();};}function respondWithResult(_0x98607b,_0x543c26){_0x543c26=_0x543c26||0xc8;return function(_0x4b4d02){if(_0x4b4d02){return _0x98607b[_0x0c9a('0x1c')](_0x543c26)[_0x0c9a('0x1d')](_0x4b4d02);}};}function respondWithFilteredResult(_0x13a98a,_0x21b936){return function(_0x365017){if(_0x365017){var _0x103acb=_0x365017[_0x0c9a('0x1e')],_0x5335ac=_0x21b936[_0x0c9a('0x1f')],_0xe43d9b=_0x21b936[_0x0c9a('0x1f')]+_0x21b936[_0x0c9a('0x20')],_0x1e4718;if(_0xe43d9b>=_0x103acb){_0xe43d9b=_0x103acb;_0x1e4718=0xc8;}else{_0x1e4718=0xce;}_0x13a98a[_0x0c9a('0x1c')](_0x1e4718);return _0x13a98a['set']('Content-Range',_0x5335ac+'-'+_0xe43d9b+'/'+_0x103acb)[_0x0c9a('0x1d')](_0x365017);}return null;};}function patchUpdates(_0x4d7cc0){return function(_0x361bf8){try{jsonpatch[_0x0c9a('0x21')](_0x361bf8,_0x4d7cc0,!![]);}catch(_0x55d424){return BPromise['reject'](_0x55d424);}return _0x361bf8[_0x0c9a('0x22')]();};}function saveUpdates(_0x5d9fdb,_0x175eff){return function(_0x368ec1){if(_0x368ec1){return _0x368ec1[_0x0c9a('0x23')](_0x5d9fdb)[_0x0c9a('0x24')](function(_0x305ea0){return _0x305ea0;});}return null;};}function removeEntity(_0x25b684,_0x2e28ae){return function(_0x3c1f6d){if(_0x3c1f6d){return _0x3c1f6d['destroy']()[_0x0c9a('0x24')](function(){var _0x214060=_0x3c1f6d[_0x0c9a('0x25')]({'plain':!![]});var _0x49a5cb='Plugins';return db[_0x0c9a('0x26')][_0x0c9a('0x27')]({'where':{'type':_0x49a5cb,'resourceId':_0x214060['id']}})[_0x0c9a('0x24')](function(){return _0x3c1f6d;});})[_0x0c9a('0x24')](function(){_0x25b684[_0x0c9a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x533389,_0x3ab7f9){return function(_0x5a815c){if(!_0x5a815c){_0x533389['sendStatus'](0x194);}return _0x5a815c;};}function handleError(_0x27499d,_0x482155){_0x482155=_0x482155||0x1f4;return function(_0x3ba2f7){logger[_0x0c9a('0x28')](_0x3ba2f7['stack']);if(_0x3ba2f7[_0x0c9a('0x29')]){delete _0x3ba2f7['name'];}_0x27499d[_0x0c9a('0x1c')](_0x482155)[_0x0c9a('0x2a')](_0x3ba2f7);};}exports[_0x0c9a('0x2b')]=function(_0x20874e,_0x2bee47){var _0x4dab21={},_0x39bf23={},_0x330adb={'count':0x0,'rows':[]};var _0x4da5c4=_['map'](db['Plugin'][_0x0c9a('0x2c')],function(_0x4d31e0){return{'name':_0x4d31e0[_0x0c9a('0x2d')],'type':_0x4d31e0['type'][_0x0c9a('0x2e')]};});_0x39bf23[_0x0c9a('0x2f')]=_[_0x0c9a('0x30')](_0x4da5c4,_0x0c9a('0x29'));_0x39bf23[_0x0c9a('0x31')]=_[_0x0c9a('0x32')](_0x20874e[_0x0c9a('0x31')]);_0x39bf23[_0x0c9a('0x33')]=_[_0x0c9a('0x34')](_0x39bf23[_0x0c9a('0x2f')],_0x39bf23[_0x0c9a('0x31')]);_0x4dab21['attributes']=_['intersection'](_0x39bf23[_0x0c9a('0x2f')],qs[_0x0c9a('0x35')](_0x20874e[_0x0c9a('0x31')][_0x0c9a('0x35')]));_0x4dab21[_0x0c9a('0x36')]=_0x4dab21['attributes']['length']?_0x4dab21['attributes']:_0x39bf23[_0x0c9a('0x2f')];if(!_0x20874e[_0x0c9a('0x31')][_0x0c9a('0x37')](_0x0c9a('0x38'))){_0x4dab21[_0x0c9a('0x20')]=qs['limit'](_0x20874e[_0x0c9a('0x31')][_0x0c9a('0x20')]);_0x4dab21[_0x0c9a('0x1f')]=qs[_0x0c9a('0x1f')](_0x20874e[_0x0c9a('0x31')]['offset']);}_0x4dab21[_0x0c9a('0x39')]=qs[_0x0c9a('0x3a')](_0x20874e['query'][_0x0c9a('0x3a')]);_0x4dab21[_0x0c9a('0x3b')]=qs[_0x0c9a('0x33')](_[_0x0c9a('0x3c')](_0x20874e['query'],_0x39bf23['filters']),_0x4da5c4);if(_0x20874e[_0x0c9a('0x31')][_0x0c9a('0x3d')]){_0x4dab21['where']=_[_0x0c9a('0x3e')](_0x4dab21[_0x0c9a('0x3b')],{'$or':_[_0x0c9a('0x30')](_0x4da5c4,function(_0x4614e5){if(_0x4614e5[_0x0c9a('0x3f')]!=='VIRTUAL'){var _0x48ca82={};_0x48ca82[_0x4614e5['name']]={'$like':'%'+_0x20874e[_0x0c9a('0x31')]['filter']+'%'};return _0x48ca82;}})});}_0x4dab21=_[_0x0c9a('0x3e')]({},_0x4dab21,_0x20874e[_0x0c9a('0x40')]);var _0x197850={'where':_0x4dab21[_0x0c9a('0x3b')]};return db['Plugin']['count'](_0x197850)[_0x0c9a('0x24')](function(_0x441a67){_0x330adb[_0x0c9a('0x1e')]=_0x441a67;if(_0x20874e[_0x0c9a('0x31')][_0x0c9a('0x41')]){_0x4dab21['include']=[{'all':!![]}];}return db['Plugin'][_0x0c9a('0x42')](_0x4dab21);})[_0x0c9a('0x24')](function(_0x103f41){_0x330adb[_0x0c9a('0x43')]=_0x103f41;return _0x330adb;})[_0x0c9a('0x24')](respondWithFilteredResult(_0x2bee47,_0x4dab21))[_0x0c9a('0x44')](handleError(_0x2bee47,null));};exports[_0x0c9a('0x45')]=function(_0x55ce44,_0x31b600){var _0xded744={'raw':!![],'where':{'id':_0x55ce44[_0x0c9a('0x46')]['id']}},_0x489e4e={};_0x489e4e[_0x0c9a('0x2f')]=_[_0x0c9a('0x32')](db[_0x0c9a('0x47')]['rawAttributes']);_0x489e4e[_0x0c9a('0x31')]=_[_0x0c9a('0x32')](_0x55ce44[_0x0c9a('0x31')]);_0x489e4e[_0x0c9a('0x33')]=_[_0x0c9a('0x34')](_0x489e4e[_0x0c9a('0x2f')],_0x489e4e['query']);_0xded744[_0x0c9a('0x36')]=_[_0x0c9a('0x34')](_0x489e4e[_0x0c9a('0x2f')],qs[_0x0c9a('0x35')](_0x55ce44[_0x0c9a('0x31')][_0x0c9a('0x35')]));_0xded744[_0x0c9a('0x36')]=_0xded744[_0x0c9a('0x36')][_0x0c9a('0x48')]?_0xded744['attributes']:_0x489e4e[_0x0c9a('0x2f')];if(_0x55ce44[_0x0c9a('0x31')][_0x0c9a('0x41')]){_0xded744['include']=[{'all':!![]}];}_0xded744=_[_0x0c9a('0x3e')]({},_0xded744,_0x55ce44[_0x0c9a('0x40')]);return db[_0x0c9a('0x47')][_0x0c9a('0x49')](_0xded744)[_0x0c9a('0x24')](handleEntityNotFound(_0x31b600,null))['then'](respondWithResult(_0x31b600,null))['catch'](handleError(_0x31b600,null));};exports[_0x0c9a('0x4a')]=function(_0x7365f9,_0x5102a2,_0x14e42b){return db[_0x0c9a('0x47')][_0x0c9a('0x49')]({'where':{'id':_0x7365f9['params']['id']},'attributes':['name','path'],'raw':!![]})[_0x0c9a('0x24')](handleEntityNotFound(_0x5102a2,null))[_0x0c9a('0x24')](function(_0xa6f48b){if(_0xa6f48b){var _0x544757=path[_0x0c9a('0x4b')](config[_0x0c9a('0x4c')],'server/files/plugins',util[_0x0c9a('0x4d')](_0x0c9a('0x4e'),path[_0x0c9a('0x4f')](_0xa6f48b[_0x0c9a('0x9')])));var _0x22cb91=fs[_0x0c9a('0x50')](_0x544757);var _0x431695=archiver(_0x0c9a('0x51'),{'zlib':{'level':0x9}});_0x431695['on'](_0x0c9a('0x52'),function(_0x2d93df){if(_0x2d93df[_0x0c9a('0x53')]===_0x0c9a('0x54')){logger[_0x0c9a('0x28')](_0x2d93df);}else{throw new db[(_0x0c9a('0x55'))][(_0x0c9a('0x56'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x431695['on'](_0x0c9a('0x28'),function(_0x550878){throw new db['Sequelize'][(_0x0c9a('0x56'))](_0x0c9a('0x57'));});_0x431695[_0x0c9a('0x58')](_0x22cb91);_0x431695[_0x0c9a('0x59')](_0x0c9a('0x5a'),{'cwd':path['join'](config['root'],'server/files/plugins',path[_0x0c9a('0x5b')](_0xa6f48b['path'])),'ignore':[path[_0x0c9a('0x4b')](path[_0x0c9a('0x4f')](_0xa6f48b[_0x0c9a('0x9')]),_0x0c9a('0x5c')),path['join'](path['basename'](_0xa6f48b[_0x0c9a('0x9')]),'attachments/**/*')],'nodir':!![]})[_0x0c9a('0x5d')]();_0x22cb91['on']('close',function(){if(!fs[_0x0c9a('0x5e')](_0x544757)){throw new db[(_0x0c9a('0x55'))][(_0x0c9a('0x56'))](_0x0c9a('0x5f'));}return _0x5102a2[_0x0c9a('0x4a')](_0x544757,util[_0x0c9a('0x4d')](_0x0c9a('0x4e'),path['basename'](_0xa6f48b['path'])),function(_0x497dc4){if(_0x497dc4){throw new db[(_0x0c9a('0x55'))][(_0x0c9a('0x56'))](_0x0c9a('0x60'));}fs['unlinkSync'](_0x544757);logger[_0x0c9a('0x61')](_0x0c9a('0x62'));logger[_0x0c9a('0x61')]('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x5102a2,null));};exports[_0x0c9a('0x63')]=function(_0x4bc2fc,_0x286aca,_0x1ca111){var _0x32dfe4=path[_0x0c9a('0x4f')](_0x4bc2fc[_0x0c9a('0x64')][_0x0c9a('0x65')],path['extname'](_0x4bc2fc['file'][_0x0c9a('0x65')]));var _0x4169b5=path['join'](config[_0x0c9a('0x4c')],_0x0c9a('0x66'),_0x4bc2fc[_0x0c9a('0x64')][_0x0c9a('0x65')]);var _0x2043e7=path[_0x0c9a('0x4b')](config[_0x0c9a('0x4c')],_0x0c9a('0x66'),_0x32dfe4);logger[_0x0c9a('0x61')]('Plugin\x20upload\x20filepath:\x20%s',_0x4169b5);logger[_0x0c9a('0x61')](_0x0c9a('0x67'),_0x2043e7);try{fs[_0x0c9a('0x68')](_0x4169b5,parseInt(_0x0c9a('0x69'),0x8));extract(_0x4169b5,{'dir':_0x2043e7},function(_0x306a51){if(_0x306a51){logger[_0x0c9a('0x28')](_0x306a51);handleError(_0x306a51,!![]);};var _0x5265cc=fs[_0x0c9a('0x6a')](_0x2043e7);if(_0x5265cc['length']>0x1){removeReferences(_0x4169b5,_0x2043e7);logger[_0x0c9a('0x28')](_0x0c9a('0x6b'));return _0x1ca111(new Error(_0x0c9a('0x6b')));}var _0xcfe32d=fs['lstatSync'](path['join'](_0x2043e7,_0x5265cc[0x0]));if(_0xcfe32d[_0x0c9a('0x6c')]()){removeReferences(_0x4169b5,_0x2043e7);logger[_0x0c9a('0x28')](_0x0c9a('0x6b'));return _0x1ca111(new Error(_0x0c9a('0x6b')));}if(_0xcfe32d[_0x0c9a('0x6d')]()){var _0x4903fb=fs[_0x0c9a('0x6a')](path[_0x0c9a('0x4b')](_0x2043e7,_0x5265cc[0x0]));if(_0x4903fb[_0x0c9a('0x48')]===0x0){removeReferences(_0x4169b5,_0x2043e7);logger[_0x0c9a('0x28')](_0x0c9a('0x6b'));return _0x1ca111(new Error(_0x0c9a('0x6b')));}var _0x2591e9=_0x4903fb['some'](function(_0x45b203){return _0x45b203===_0x0c9a('0x6e');});if(!_0x2591e9){return _0x1ca111(new Error(_0x0c9a('0x6f')));}var _0x4fdd5d=fs[_0x0c9a('0x70')](path[_0x0c9a('0x4b')](_0x2043e7,_0x5265cc[0x0],'manifest.json'));var _0x288b0c=JSON['parse'](_0x4fdd5d);if(_0x0c9a('0x71')==typeof _0x288b0c['name']){return _0x1ca111(new Error(_0x0c9a('0x72')));}if('undefined'==typeof _0x288b0c[_0x0c9a('0x3f')]){return _0x1ca111(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x0c9a('0x71')==typeof _0x288b0c[_0x0c9a('0x73')]){return _0x1ca111(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x0c9a('0x71')==typeof _0x288b0c[_0x0c9a('0x74')]){return _0x1ca111(new Error(_0x0c9a('0x75')));}if(_0x288b0c['type']===_0x0c9a('0x76')){if(_0x0c9a('0x71')==typeof _0x288b0c[_0x0c9a('0x74')][_0x0c9a('0x77')]){return _0x1ca111(new Error(_0x0c9a('0x78')));}if('undefined'==typeof _0x288b0c[_0x0c9a('0x74')][_0x0c9a('0x77')][_0x0c9a('0x79')]&&'undefined'==typeof _0x288b0c['parameters'][_0x0c9a('0x77')][_0x0c9a('0x7a')]){return _0x1ca111(new Error(_0x0c9a('0x7b')));}}else if(_0x288b0c[_0x0c9a('0x3f')]==='script'){if(_0x0c9a('0x71')==typeof _0x288b0c['parameters'][_0x0c9a('0x7c')]){return _0x1ca111(new Error(_0x0c9a('0x7d')));}if('undefined'==typeof _0x288b0c['parameters'][_0x0c9a('0x7e')]){return _0x1ca111(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x1ca111(new Error(_0x0c9a('0x7f')));}var _0x40f5df=_0x288b0c['name'];var _0x3882d0=_0x288b0c[_0x0c9a('0x80')];var _0x3cd553=_0x288b0c[_0x0c9a('0x3f')];var _0x3c6b6d=_0x288b0c['sidebar']?_0x288b0c[_0x0c9a('0x81')]:_0x0c9a('0x82');var _0x5b4e28=_0x288b0c['icon']?_0x288b0c[_0x0c9a('0x83')]:'icon-apps';var _0x594f00='';var _0x2932e4='';var _0xbb1301='';var _0x58f80e='';var _0x1d7391=_0x288b0c[_0x0c9a('0x73')];if(_0x3cd553===_0x0c9a('0x76')){if('undefined'!=typeof _0x288b0c[_0x0c9a('0x74')][_0x0c9a('0x77')][_0x0c9a('0x79')]){var _0x260e88=_0x288b0c[_0x0c9a('0x74')][_0x0c9a('0x77')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x0c9a('0x84')](_0x260e88)){_0x594f00=path[_0x0c9a('0x4b')](_0x0c9a('0x85'),_0x32dfe4,_0x5265cc[0x0],_0x260e88);}else{_0x594f00=_0x260e88;}}else{logger[_0x0c9a('0x61')](_0x0c9a('0x86'));}if(_0x0c9a('0x71')!=typeof _0x288b0c[_0x0c9a('0x74')][_0x0c9a('0x77')][_0x0c9a('0x7a')]){var _0x39cfe4=_0x288b0c[_0x0c9a('0x74')][_0x0c9a('0x77')][_0x0c9a('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x0c9a('0x84')](_0x39cfe4)){_0x2932e4=path[_0x0c9a('0x4b')](_0x0c9a('0x85'),_0x32dfe4,_0x5265cc[0x0],_0x39cfe4);}else{_0x2932e4=_0x39cfe4;}}else{logger[_0x0c9a('0x61')](_0x0c9a('0x87'));}}else if(_0x3cd553===_0x0c9a('0x88')){_0xbb1301=_0x288b0c[_0x0c9a('0x74')][_0x0c9a('0x7c')];_0x58f80e=_0x288b0c[_0x0c9a('0x74')][_0x0c9a('0x7e')];if(_0x0c9a('0x71')!=typeof _0x288b0c[_0x0c9a('0x74')][_0x0c9a('0x77')]){if(_0x0c9a('0x71')!=typeof _0x288b0c['parameters'][_0x0c9a('0x77')][_0x0c9a('0x79')]){var _0x260e88=_0x288b0c['parameters']['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x0c9a('0x84')](_0x260e88)){_0x594f00=path[_0x0c9a('0x4b')](_0x0c9a('0x85'),_0x32dfe4,_0x5265cc[0x0],_0x260e88);}else{_0x594f00=_0x260e88;}}if(_0x0c9a('0x71')!=typeof _0x288b0c[_0x0c9a('0x74')][_0x0c9a('0x77')][_0x0c9a('0x7a')]){var _0x39cfe4=_0x288b0c[_0x0c9a('0x74')][_0x0c9a('0x77')][_0x0c9a('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x0c9a('0x84')](_0x39cfe4)){_0x2932e4=path['join'](_0x0c9a('0x85'),_0x32dfe4,_0x5265cc[0x0],_0x39cfe4);}else{_0x2932e4=_0x39cfe4;}}}}var _0x1f866c={'name':_0x40f5df,'description':_0x3882d0,'path':path[_0x0c9a('0x4b')](_0x32dfe4,_0x5265cc[0x0]),'type':_0x3cd553,'sidebar':_0x3c6b6d,'icon':_0x5b4e28,'adminUrl':_0x594f00,'agentUrl':_0x2932e4,'scriptName':_0xbb1301,'scriptPath':_0x58f80e,'version':_0x1d7391};removeReferences(_0x4169b5,null);return db[_0x0c9a('0x47')][_0x0c9a('0x89')](_0x1f866c)[_0x0c9a('0x24')](function(_0x397a33){var _0x3a9ac9={'role':_0x4bc2fc[_0x0c9a('0x8a')][_0x0c9a('0x8b')],'userProfileId':_0x4bc2fc[_0x0c9a('0x8a')][_0x0c9a('0x8c')]};if(!_0x3a9ac9)throw new Error(_0x0c9a('0x8d'));if(_0x3a9ac9[_0x0c9a('0x8b')]===_0x0c9a('0x8e')){var _0x33aec1=_0x397a33['get']({'plain':!![]});return db[_0x0c9a('0x8f')]['find']({'where':{'name':_0x0c9a('0x90'),'userProfileId':_0x3a9ac9[_0x0c9a('0x8c')]},'raw':!![]})[_0x0c9a('0x24')](function(_0x56dd77){if(_0x56dd77&&_0x56dd77[_0x0c9a('0x91')]===0x0){return db[_0x0c9a('0x26')][_0x0c9a('0x89')]({'name':_0x33aec1[_0x0c9a('0x29')],'resourceId':_0x33aec1['id'],'type':_0x56dd77['name'],'sectionId':_0x56dd77['id']},{})[_0x0c9a('0x24')](function(){return _0x397a33;});}else{return _0x397a33;}})[_0x0c9a('0x44')](function(_0x139c88){logger[_0x0c9a('0x28')](_0x0c9a('0x92'),_0x139c88);throw _0x139c88;});}return _0x397a33;})[_0x0c9a('0x24')](respondWithResult(_0x286aca,null))[_0x0c9a('0x44')](handleError(_0x286aca,null));}});}catch(_0x18bf7f){_0x286aca[_0x0c9a('0x1c')](0x1f4)['send'](_0x18bf7f);}};function removeReferences(_0x158f67,_0x5a7904){try{if(_0x158f67){fs[_0x0c9a('0x93')](_0x158f67);logger[_0x0c9a('0x61')]('Zip\x20archive\x20removed');}if(_0x5a7904){rimraf(_0x5a7904,function(){});logger[_0x0c9a('0x61')](_0x0c9a('0x94'));}}catch(_0x51ebd8){logger['error'](_0x51ebd8);}}exports[_0x0c9a('0x23')]=function(_0x224c0d,_0x958de3,_0x77d824){return db[_0x0c9a('0x47')][_0x0c9a('0x49')]({'where':{'id':_0x224c0d['params']['id']}})['then'](handleEntityNotFound(_0x958de3,null))[_0x0c9a('0x24')](saveUpdates(_0x224c0d[_0x0c9a('0x8a')],null))[_0x0c9a('0x24')](respondWithResult(_0x958de3,null))['catch'](handleError(_0x958de3,null));};exports['delete']=function(_0x120704,_0x167ea6,_0x284543){return db[_0x0c9a('0x47')][_0x0c9a('0x49')]({'where':{'id':_0x120704[_0x0c9a('0x46')]['id']}})[_0x0c9a('0x24')](function(_0x31aaa0){if(_0x31aaa0){return _0x31aaa0[_0x0c9a('0x27')]();}})[_0x0c9a('0x24')](function(_0x24dd54){rimraf(path['join'](config[_0x0c9a('0x4c')],_0x0c9a('0x66'),path['dirname'](_0x24dd54['path'])),function(){});return _0x24dd54;})[_0x0c9a('0x24')](handleEntityNotFound(_0x167ea6,null))['then'](respondWithStatusCode(_0x167ea6,null))[_0x0c9a('0x44')](handleError(_0x167ea6,null));};exports[_0x0c9a('0x95')]=function(_0x18c188,_0x122364,_0x1efc60){return BPromise[_0x0c9a('0x96')]()[_0x0c9a('0x24')](function(){if(!_0x18c188[_0x0c9a('0x31')][_0x0c9a('0x9')]){throw new Error(_0x0c9a('0x97'));}if(!_0x18c188[_0x0c9a('0x31')][_0x0c9a('0x98')]){throw new Error(_0x0c9a('0x99'));}var _0x374829=_0x18c188[_0x0c9a('0x31')][_0x0c9a('0x9a')]?_0x18c188['query']['hostname']+':'+_0x18c188[_0x0c9a('0x31')][_0x0c9a('0x98')]:_0x0c9a('0x9b')+_0x18c188[_0x0c9a('0x31')][_0x0c9a('0x98')];var _0x1a6a37=_0x18c188[_0x0c9a('0x31')][_0x0c9a('0x1d')]?_0x18c188['query']['json']:!![];var _0x209cc8=_0x18c188[_0x0c9a('0x31')][_0x0c9a('0x9c')]?_0x18c188[_0x0c9a('0x31')][_0x0c9a('0x9c')]:null;var _0x3878b4={'method':_0x18c188[_0x0c9a('0x9d')],'uri':util[_0x0c9a('0x4d')]('%s%s',_0x374829,_0x18c188[_0x0c9a('0x31')]['path']),'json':_0x1a6a37,'resolveWithFullResponse':!![],'encoding':_0x209cc8,'qs':_0x18c188[_0x0c9a('0x31')]};if(_0x18c188[_0x0c9a('0x9e')]){_0x3878b4[_0x0c9a('0x9e')]=_0x18c188[_0x0c9a('0x9e')];if(_0x3878b4[_0x0c9a('0x9e')][_0x0c9a('0x9f')]){delete _0x3878b4[_0x0c9a('0x9e')][_0x0c9a('0x9f')];}}if(_0x3878b4[_0x0c9a('0x9e')]['content-type']){delete _0x3878b4[_0x0c9a('0x9e')][_0x0c9a('0xa0')];}return rp(_0x3878b4);})[_0x0c9a('0x24')](function(_0x1bd62f){if(_0x1bd62f){_0x122364[_0x0c9a('0xa1')](_0x1bd62f[_0x0c9a('0x9e')]);logger[_0x0c9a('0x61')](_0x1bd62f['body']);if(_[_0x0c9a('0xa2')](_0x18c188[_0x0c9a('0x31')]['path'],_0x0c9a('0x4a'))&&_0x1bd62f[_0x0c9a('0xa3')]==0x1f4){return _0x122364[_0x0c9a('0x1b')](_0x1bd62f[_0x0c9a('0xa3')]);}else{return _0x122364[_0x0c9a('0x1c')](_0x1bd62f[_0x0c9a('0xa3')])[_0x0c9a('0x2a')](_0x1bd62f['body']);}}else{return _0x122364['sendStatus'](0xc8);}})[_0x0c9a('0x44')](handleError(_0x122364,null));};exports[_0x0c9a('0xa4')]=function(_0x46385d,_0x48eaff,_0x2c97a5){return BPromise[_0x0c9a('0x96')]()[_0x0c9a('0x24')](function(){if(!_0x46385d[_0x0c9a('0x31')][_0x0c9a('0x9')]){throw new Error(_0x0c9a('0x97'));}if(!_0x46385d[_0x0c9a('0x31')][_0x0c9a('0x98')]){throw new Error(_0x0c9a('0x99'));}var _0x224df9=_0x46385d[_0x0c9a('0x31')]['hostname']?_0x46385d[_0x0c9a('0x31')]['hostname']+':'+_0x46385d['query']['port']:_0x0c9a('0x9b')+_0x46385d['query']['port'];var _0x5dd074=_0x46385d[_0x0c9a('0x31')]['json']?_0x46385d[_0x0c9a('0x31')][_0x0c9a('0x1d')]:!![];var _0x40f97e=_0x46385d[_0x0c9a('0x31')][_0x0c9a('0x9c')]?_0x46385d['query']['encoding']:null;var _0x9105c9={'method':_0x46385d[_0x0c9a('0x9d')],'uri':util[_0x0c9a('0x4d')](_0x0c9a('0xa5'),_0x224df9,_0x46385d['query']['path']),'json':_0x5dd074,'resolveWithFullResponse':!![],'encoding':_0x40f97e,'body':_0x46385d[_0x0c9a('0x8a')]};if(_0x46385d[_0x0c9a('0x9e')]){_0x9105c9['headers']=_0x46385d['headers'];if(_0x9105c9[_0x0c9a('0x9e')][_0x0c9a('0x9f')]){delete _0x9105c9['headers'][_0x0c9a('0x9f')];}}if(_0x9105c9[_0x0c9a('0x9e')][_0x0c9a('0xa0')]){delete _0x9105c9['headers']['content-type'];}return rp(_0x9105c9);})[_0x0c9a('0x24')](function(_0x237729){if(_0x237729){_0x48eaff['set'](_0x237729[_0x0c9a('0x9e')]);logger['info'](_0x237729['body']);return _0x48eaff[_0x0c9a('0x1c')](_0x237729['statusCode'])['send'](_0x237729[_0x0c9a('0x8a')]);}else{return _0x48eaff[_0x0c9a('0x1b')](0xc8);}})[_0x0c9a('0x44')](handleError(_0x48eaff,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 94ddc52..7903eec 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update'];(function(_0x98cf51,_0xb7ab54){var _0x4b3e99=function(_0x4c7b5e){while(--_0x4c7b5e){_0x98cf51['push'](_0x98cf51['shift']());}};_0x4b3e99(++_0xb7ab54);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2b59b1,_0x46c17c){_0x2b59b1=_0x2b59b1-0x0;var _0x4a44bb=_0x5f2f[_0x2b59b1];return _0x4a44bb;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var Plugin=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){PluginEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);PluginEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];Plugin[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=PluginEvents; \ No newline at end of file +var _0x7096=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','update','remove'];(function(_0x23ec81,_0x4cbbed){var _0x56e5b3=function(_0x3c3fae){while(--_0x3c3fae){_0x23ec81['push'](_0x23ec81['shift']());}};_0x56e5b3(++_0x4cbbed);}(_0x7096,0x10c));var _0x6709=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x7096[_0x550d12];return _0x12103d;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x6709('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x6709('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6709('0x2'),'afterDestroy':_0x6709('0x3')};function emitEvent(_0x3e85e4){return function(_0xccdcb5,_0x3cd087,_0x3c8599){PluginEvents[_0x6709('0x4')](_0x3e85e4+':'+_0xccdcb5['id'],_0xccdcb5);PluginEvents[_0x6709('0x4')](_0x3e85e4,_0xccdcb5);_0x3c8599(null);};}for(var e in events){if(events[_0x6709('0x5')](e)){var event=events[e];Plugin[_0x6709('0x6')](e,emitEvent(event));}}module[_0x6709('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index ee2161a..09bd590 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 _0x2d17=['define','plugins','lodash','util','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x591022,_0x4063aa){var _0xdd803d=function(_0x3031bb){while(--_0x3031bb){_0x591022['push'](_0x591022['shift']());}};_0xdd803d(++_0x4063aa);}(_0x2d17,0x17e));var _0x72d1=function(_0x40308d,_0x5305cb){_0x40308d=_0x40308d-0x0;var _0x326bb9=_0x2d17[_0x40308d];return _0x326bb9;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var logger=require('../../config/logger')(_0x72d1('0x2'));var moment=require(_0x72d1('0x3'));var BPromise=require('bluebird');var rp=require(_0x72d1('0x4'));var fs=require('fs');var path=require(_0x72d1('0x5'));var rimraf=require('rimraf');var config=require(_0x72d1('0x6'));var attributes=require('./plugin.attributes');module[_0x72d1('0x7')]=function(_0x50f551,_0x139ba0){return _0x50f551[_0x72d1('0x8')]('Plugin',attributes,{'tableName':_0x72d1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bae=['rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','../../config/logger','api','bluebird','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7bae,0x13b));var _0xe7ba=function(_0x5317b5,_0x4dfd6e){_0x5317b5=_0x5317b5-0x0;var _0x3b7ce2=_0x7bae[_0x5317b5];return _0x3b7ce2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7ba('0x0'))(_0xe7ba('0x1'));var moment=require('moment');var BPromise=require(_0xe7ba('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe7ba('0x3'));var rimraf=require(_0xe7ba('0x4'));var config=require(_0xe7ba('0x5'));var attributes=require(_0xe7ba('0x6'));module[_0xe7ba('0x7')]=function(_0xfd3a22,_0x2d31df){return _0xfd3a22[_0xe7ba('0x8')](_0xe7ba('0x9'),attributes,{'tableName':_0xe7ba('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 53bc0c1..0335c8a 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 _0xe7c4=['Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreatePlugin','body','options','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','info','Plugin,\x20%s,\x20%s','debug'];(function(_0x37ad9e,_0x84649d){var _0x3fb925=function(_0x335e2a){while(--_0x335e2a){_0x37ad9e['push'](_0x37ad9e['shift']());}};_0x3fb925(++_0x84649d);}(_0xe7c4,0x1cb));var _0x4e7c=function(_0x4ac467,_0x31aca6){_0x4ac467=_0x4ac467-0x0;var _0x41fc07=_0xe7c4[_0x4ac467];return _0x41fc07;};'use strict';var _=require(_0x4e7c('0x0'));var util=require(_0x4e7c('0x1'));var moment=require(_0x4e7c('0x2'));var BPromise=require(_0x4e7c('0x3'));var rs=require(_0x4e7c('0x4'));var fs=require('fs');var Redis=require(_0x4e7c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e7c('0x6'));var logger=require('../../config/logger')(_0x4e7c('0x7'));var config=require(_0x4e7c('0x8'));var jayson=require(_0x4e7c('0x9'));var client=jayson[_0x4e7c('0xa')][_0x4e7c('0xb')]({'port':0x232a});config[_0x4e7c('0xc')]=_[_0x4e7c('0xd')](config[_0x4e7c('0xc')],{'host':_0x4e7c('0xe'),'port':0x18eb});var socket=require(_0x4e7c('0xf'))(new Redis(config[_0x4e7c('0xc')]));require(_0x4e7c('0x10'))[_0x4e7c('0x11')](socket);function respondWithRpcPromise(_0x3dcd25,_0x542ce1,_0x38d265){return new BPromise(function(_0x488273,_0x42cb6d){return client['request'](_0x3dcd25,_0x38d265)['then'](function(_0x488f37){logger[_0x4e7c('0x12')](_0x4e7c('0x13'),_0x542ce1,'request\x20sent');logger[_0x4e7c('0x14')](_0x4e7c('0x15'),_0x542ce1,_0x4e7c('0x16'),JSON[_0x4e7c('0x17')](_0x488f37));if(_0x488f37[_0x4e7c('0x18')]){if(_0x488f37[_0x4e7c('0x18')]['code']===0x1f4){logger[_0x4e7c('0x18')](_0x4e7c('0x13'),_0x542ce1,_0x488f37[_0x4e7c('0x18')]['message']);return _0x42cb6d(_0x488f37[_0x4e7c('0x18')]['message']);}logger[_0x4e7c('0x18')](_0x4e7c('0x13'),_0x542ce1,_0x488f37['error'][_0x4e7c('0x19')]);return _0x488273(_0x488f37[_0x4e7c('0x18')][_0x4e7c('0x19')]);}else{logger['info'](_0x4e7c('0x13'),_0x542ce1,'request\x20sent');_0x488273(_0x488f37[_0x4e7c('0x1a')][_0x4e7c('0x19')]);}})['catch'](function(_0x2b398f){logger[_0x4e7c('0x18')](_0x4e7c('0x13'),_0x542ce1,_0x2b398f);_0x42cb6d(_0x2b398f);});});}exports[_0x4e7c('0x1b')]=function(_0x1a874d){var _0x3f9e07=this;return new Promise(function(_0x5452cc,_0x2cc43d){return db['Plugin']['create'](_0x1a874d[_0x4e7c('0x1c')],{'raw':_0x1a874d[_0x4e7c('0x1d')]?_0x1a874d['options'][_0x4e7c('0x1e')]===undefined?!![]:![]:!![]})[_0x4e7c('0x1f')](function(_0x4a0606){logger[_0x4e7c('0x12')]('CreatePlugin',_0x1a874d);logger[_0x4e7c('0x14')](_0x4e7c('0x1b'),_0x1a874d,JSON[_0x4e7c('0x17')](_0x4a0606));_0x5452cc(_0x4a0606);})['catch'](function(_0x405a53){logger[_0x4e7c('0x18')](_0x4e7c('0x1b'),_0x405a53[_0x4e7c('0x19')],_0x1a874d);_0x2cc43d(_0x3f9e07[_0x4e7c('0x18')](0x1f4,_0x405a53[_0x4e7c('0x19')]));});});}; \ No newline at end of file +var _0x7001=['redis','defaults','localhost','./plugin.socket','register','request','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','then','info','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3391f4,_0x1d10d3){var _0x1ccac4=function(_0x1f6c08){while(--_0x1f6c08){_0x3391f4['push'](_0x3391f4['shift']());}};_0x1ccac4(++_0x1d10d3);}(_0x7001,0xc1));var _0x1700=function(_0x54d9c4,_0x4293bd){_0x54d9c4=_0x54d9c4-0x0;var _0x475d36=_0x7001[_0x54d9c4];return _0x475d36;};'use strict';var _=require('lodash');var util=require(_0x1700('0x0'));var moment=require('moment');var BPromise=require(_0x1700('0x1'));var rs=require(_0x1700('0x2'));var fs=require('fs');var Redis=require(_0x1700('0x3'));var db=require(_0x1700('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1700('0x5'))(_0x1700('0x6'));var config=require(_0x1700('0x7'));var jayson=require(_0x1700('0x8'));var client=jayson[_0x1700('0x9')][_0x1700('0xa')]({'port':0x232a});config[_0x1700('0xb')]=_[_0x1700('0xc')](config[_0x1700('0xb')],{'host':_0x1700('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1700('0xe'))[_0x1700('0xf')](socket);function respondWithRpcPromise(_0x54c1c8,_0x32fc58,_0x2ef437){return new BPromise(function(_0x47c8f7,_0x279e76){return client[_0x1700('0x10')](_0x54c1c8,_0x2ef437)['then'](function(_0x5e7911){logger['info'](_0x1700('0x11'),_0x32fc58,_0x1700('0x12'));logger['debug'](_0x1700('0x13'),_0x32fc58,'request\x20sent',JSON[_0x1700('0x14')](_0x5e7911));if(_0x5e7911['error']){if(_0x5e7911[_0x1700('0x15')][_0x1700('0x16')]===0x1f4){logger[_0x1700('0x15')](_0x1700('0x11'),_0x32fc58,_0x5e7911['error'][_0x1700('0x17')]);return _0x279e76(_0x5e7911[_0x1700('0x15')][_0x1700('0x17')]);}logger[_0x1700('0x15')]('Plugin,\x20%s,\x20%s',_0x32fc58,_0x5e7911[_0x1700('0x15')][_0x1700('0x17')]);return _0x47c8f7(_0x5e7911[_0x1700('0x15')][_0x1700('0x17')]);}else{logger['info'](_0x1700('0x11'),_0x32fc58,_0x1700('0x12'));_0x47c8f7(_0x5e7911[_0x1700('0x18')]['message']);}})[_0x1700('0x19')](function(_0x2769d3){logger[_0x1700('0x15')]('Plugin,\x20%s,\x20%s',_0x32fc58,_0x2769d3);_0x279e76(_0x2769d3);});});}exports[_0x1700('0x1a')]=function(_0x4a834f){var _0x525c48=this;return new Promise(function(_0x101bcc,_0x570831){return db[_0x1700('0x1b')][_0x1700('0x1c')](_0x4a834f[_0x1700('0x1d')],{'raw':_0x4a834f[_0x1700('0x1e')]?_0x4a834f['options'][_0x1700('0x1f')]===undefined?!![]:![]:!![]})[_0x1700('0x20')](function(_0x2c4c19){logger[_0x1700('0x21')](_0x1700('0x1a'),_0x4a834f);logger['debug'](_0x1700('0x1a'),_0x4a834f,JSON[_0x1700('0x14')](_0x2c4c19));_0x101bcc(_0x2c4c19);})['catch'](function(_0xdc4a51){logger[_0x1700('0x15')](_0x1700('0x1a'),_0xdc4a51['message'],_0x4a834f);_0x570831(_0x525c48['error'](0x1f4,_0xdc4a51['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 5b8a634..0dc6f03 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 _0xe6b6=['register','save','remove','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe6b6,0x150));var _0x6e6b=function(_0x243f03,_0x413413){_0x243f03=_0x243f03-0x0;var _0x2e327b=_0xe6b6[_0x243f03];return _0x2e327b;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x6e6b('0x0'),_0x6e6b('0x1'),'update'];function createListener(_0x444d9a,_0x4df263){return function(_0x4dc4cd){_0x4df263[_0x6e6b('0x2')](_0x444d9a,_0x4dc4cd);};}function removeListener(_0x4b96f8,_0x377bd0){return function(){PluginEvents[_0x6e6b('0x3')](_0x4b96f8,_0x377bd0);};}exports[_0x6e6b('0x4')]=function(_0x5c0fdc){for(var _0x528f42=0x0,_0x1bb636=events['length'];_0x528f42<_0x1bb636;_0x528f42++){var _0x3d3b77=events[_0x528f42];var _0x506791=createListener('plugin:'+_0x3d3b77,_0x5c0fdc);PluginEvents['on'](_0x3d3b77,_0x506791);}}; \ No newline at end of file +var _0xdd4d=['length','plugin:','./plugin.events','save','remove','update','removeListener','register'];(function(_0x15681d,_0x40d775){var _0x21f3df=function(_0x2dffc1){while(--_0x2dffc1){_0x15681d['push'](_0x15681d['shift']());}};_0x21f3df(++_0x40d775);}(_0xdd4d,0x152));var _0xddd4=function(_0x5e6d5d,_0x474263){_0x5e6d5d=_0x5e6d5d-0x0;var _0x397dd5=_0xdd4d[_0x5e6d5d];return _0x397dd5;};'use strict';var PluginEvents=require(_0xddd4('0x0'));var events=[_0xddd4('0x1'),_0xddd4('0x2'),_0xddd4('0x3')];function createListener(_0x5b65a2,_0x2056d7){return function(_0x16625e){_0x2056d7['emit'](_0x5b65a2,_0x16625e);};}function removeListener(_0x282e66,_0x1d718d){return function(){PluginEvents[_0xddd4('0x4')](_0x282e66,_0x1d718d);};}exports[_0xddd4('0x5')]=function(_0x2b9864){for(var _0x133f05=0x0,_0x28bfb6=events[_0xddd4('0x6')];_0x133f05<_0x28bfb6;_0x133f05++){var _0x1cf8e2=events[_0x133f05];var _0x1b3e8f=createListener(_0xddd4('0x7')+_0x1cf8e2,_0x2b9864);PluginEvents['on'](_0x1cf8e2,_0x1b3e8f);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 93a0653..738ca8e 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 _0x0d89=['express','Router','./pm2.controller','get','isAuthenticated','/:id','post','create','put','update','delete','exports'];(function(_0x2be920,_0x558694){var _0x2f5ca3=function(_0x504e25){while(--_0x504e25){_0x2be920['push'](_0x2be920['shift']());}};_0x2f5ca3(++_0x558694);}(_0x0d89,0x180));var _0x90d8=function(_0x3e7b5a,_0x4c06fe){_0x3e7b5a=_0x3e7b5a-0x0;var _0x4880aa=_0x0d89[_0x3e7b5a];return _0x4880aa;};'use strict';var express=require(_0x90d8('0x0'));var router=express[_0x90d8('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x90d8('0x2'));router[_0x90d8('0x3')]('/',auth[_0x90d8('0x4')](),controller['index']);router[_0x90d8('0x3')](_0x90d8('0x5'),auth[_0x90d8('0x4')](),controller['show']);router[_0x90d8('0x6')]('/',auth[_0x90d8('0x4')](),controller[_0x90d8('0x7')]);router[_0x90d8('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x90d8('0x9')]);router[_0x90d8('0xa')]('/:id',auth[_0x90d8('0x4')](),controller['destroy']);module[_0x90d8('0xb')]=router; \ No newline at end of file +var _0x7a5f=['delete','exports','express','get','isAuthenticated','/:id','post','create','put'];(function(_0x305fcc,_0x38d4fe){var _0x343051=function(_0xcc24d){while(--_0xcc24d){_0x305fcc['push'](_0x305fcc['shift']());}};_0x343051(++_0x38d4fe);}(_0x7a5f,0xbf));var _0xf7a5=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0x7a5f[_0x3afe18];return _0x19ed1f;};'use strict';var express=require(_0xf7a5('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./pm2.controller');router[_0xf7a5('0x1')]('/',auth[_0xf7a5('0x2')](),controller['index']);router[_0xf7a5('0x1')](_0xf7a5('0x3'),auth[_0xf7a5('0x2')](),controller['show']);router[_0xf7a5('0x4')]('/',auth['isAuthenticated'](),controller[_0xf7a5('0x5')]);router[_0xf7a5('0x6')]('/:id',auth[_0xf7a5('0x2')](),controller['update']);router[_0xf7a5('0x7')](_0xf7a5('0x3'),auth[_0xf7a5('0x2')](),controller['destroy']);module[_0xf7a5('0x8')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 2291cc0..354e599 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 _0xa50f=['npm\x20install','info','index','reject','express','motion2','catch','show','describe','params','body','script','join','../../files/plugins','cwd','chdir','start','dump','then','update','stop','hasOwnProperty','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','path','exec','sendStatus','status','json','error','name','send'];(function(_0x39f9da,_0x3832cd){var _0x2b75cd=function(_0x3a22ef){while(--_0x3a22ef){_0x39f9da['push'](_0x39f9da['shift']());}};_0x2b75cd(++_0x3832cd);}(_0xa50f,0x85));var _0xfa50=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xa50f[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xfa50('0x0'));var pm2=require(_0xfa50('0x1'));var logger=require(_0xfa50('0x2'))('api');var path=require(_0xfa50('0x3'));var exec=require('child_process')[_0xfa50('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x590ed8,_0x56bde3){return function(_0x1f68f0){if(!_0x1f68f0){_0x590ed8[_0xfa50('0x5')](0x194);;}return _0x1f68f0;};}function respondWithResult(_0x3124db,_0x2da7f8){_0x2da7f8=_0x2da7f8||0xc8;return function(_0x281734){if(_0x281734){return _0x3124db[_0xfa50('0x6')](_0x2da7f8)[_0xfa50('0x7')](_0x281734);}return null;};}function handleError(_0x38d8a4,_0x48e08f){_0x48e08f=_0x48e08f||0x1f4;return function(_0x11c605){logger[_0xfa50('0x8')](_0x11c605['stack']);if(_0x11c605['name']){delete _0x11c605[_0xfa50('0x9')];}_0x38d8a4[_0xfa50('0x6')](_0x48e08f)[_0xfa50('0xa')](_0x11c605);};}function execChildProcess(){return new BPromise(function(_0x4e8cf1,_0x1511b3){exec(_0xfa50('0xb'),function(_0x54863f,_0x2ba81b,_0x3077fd){logger[_0xfa50('0xc')](_0x2ba81b);logger[_0xfa50('0xc')](_0x3077fd);if(_0x54863f){logger[_0xfa50('0x8')](_0x54863f);return _0x1511b3(_0x54863f);}return _0x4e8cf1(_0x2ba81b);});});}exports[_0xfa50('0xd')]=function(_0x9452e2,_0x5a8f27){return pm2['list']()['then'](function(_0x31dfe4){if(_0x31dfe4){var _0x473d30=_[_0xfa50('0xe')](_0x31dfe4,function(_0x3056d4){return _0x3056d4['name']===_0xfa50('0xf')||_0x3056d4[_0xfa50('0x9')]===_0xfa50('0x10');});return{'rows':_0x473d30,'count':_0x473d30['length']};}return null;})['then'](respondWithResult(_0x5a8f27,null))[_0xfa50('0x11')](handleError(_0x5a8f27,null));};exports[_0xfa50('0x12')]=function(_0x33d756,_0x425ee6){return pm2[_0xfa50('0x13')](_0x33d756[_0xfa50('0x14')]['id'])['then'](respondWithResult(_0x425ee6,null))['then'](handleEntityNotFound(_0x425ee6,null))[_0xfa50('0x11')](handleError(_0x425ee6,null));};exports['create']=function(_0x99e2a3,_0x31889f){if(_0x99e2a3[_0xfa50('0x15')][_0xfa50('0x9')]&&_0x99e2a3[_0xfa50('0x15')][_0xfa50('0x16')]){var _0x94eb44=path[_0xfa50('0x17')](__dirname,_0xfa50('0x18'),_0x99e2a3['body'][_0xfa50('0x16')]);var _0x1b5a5c=process[_0xfa50('0x19')]();process[_0xfa50('0x1a')](path['dirname'](_0x94eb44));return execChildProcess()['then'](function(_0x4b7e4f){process[_0xfa50('0x1a')](_0x1b5a5c);return pm2[_0xfa50('0x1b')]({'name':_0x99e2a3[_0xfa50('0x15')][_0xfa50('0x9')],'script':_0x94eb44});})['then'](function(_0x5627c7){pm2[_0xfa50('0x1c')]();return _0x5627c7[0x0];})[_0xfa50('0x1d')](respondWithResult(_0x31889f,0xc9))['catch'](handleError(_0x31889f,null));}else{return _0x31889f[_0xfa50('0x6')](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xfa50('0x1e')]=function(_0x484085,_0x26f434){if(_0x484085['body']['id']){delete _0x484085[_0xfa50('0x15')]['id'];}var _0x1ca328={'online':'restart','stopped':_0xfa50('0x1f')};if(_0x1ca328[_0xfa50('0x20')](_0x484085[_0xfa50('0x15')][_0xfa50('0x6')])){return pm2[_0x1ca328[_0x484085['body'][_0xfa50('0x6')]]](_0x484085[_0xfa50('0x14')]['id'])[_0xfa50('0x1d')](respondWithResult(_0x26f434,0xc8))['catch'](handleError(_0x26f434,null));}else{return _0x26f434[_0xfa50('0x6')](0x1f4)['send']({'message':'Unknown\x20status'});}};exports[_0xfa50('0x21')]=function(_0xe9d2a9,_0x512ab1){if(_0xe9d2a9[_0xfa50('0x15')]['id']){delete _0xe9d2a9[_0xfa50('0x15')]['id'];}if(_0xe9d2a9[_0xfa50('0x14')]['id']){return pm2[_0xfa50('0x22')](_0xe9d2a9[_0xfa50('0x14')]['id'])[_0xfa50('0x1d')](function(_0x653de6){pm2[_0xfa50('0x1c')]();return _0x653de6[0x0];})['then'](respondWithResult(_0x512ab1,null))[_0xfa50('0x11')](handleError(_0x512ab1,null));}else{return _0x512ab1['status'](0x1f4)[_0xfa50('0xa')]({'message':_0xfa50('0x23')});}}; \ No newline at end of file +var _0x8571=['../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','list','then','reject','express','motion2','length','catch','show','describe','params','create','body','join','../../files/plugins','cwd','chdir','dirname','start','dump','update','restart','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash'];(function(_0x2ba0c2,_0x410a86){var _0x45e2bb=function(_0x494dd5){while(--_0x494dd5){_0x2ba0c2['push'](_0x2ba0c2['shift']());}};_0x45e2bb(++_0x410a86);}(_0x8571,0x80));var _0x1857=function(_0x107e4c,_0x2e7ccd){_0x107e4c=_0x107e4c-0x0;var _0x50c7fb=_0x8571[_0x107e4c];return _0x50c7fb;};'use strict';var _=require(_0x1857('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x1857('0x1'))(_0x1857('0x2'));var path=require(_0x1857('0x3'));var exec=require(_0x1857('0x4'))[_0x1857('0x5')];var BPromise=require(_0x1857('0x6'));function handleEntityNotFound(_0x51d7ab,_0x16ff51){return function(_0x22c3e7){if(!_0x22c3e7){_0x51d7ab[_0x1857('0x7')](0x194);;}return _0x22c3e7;};}function respondWithResult(_0x5ca773,_0x11f961){_0x11f961=_0x11f961||0xc8;return function(_0x25fdbe){if(_0x25fdbe){return _0x5ca773[_0x1857('0x8')](_0x11f961)[_0x1857('0x9')](_0x25fdbe);}return null;};}function handleError(_0x50b4b0,_0x17eaa7){_0x17eaa7=_0x17eaa7||0x1f4;return function(_0x52bcd2){logger[_0x1857('0xa')](_0x52bcd2[_0x1857('0xb')]);if(_0x52bcd2[_0x1857('0xc')]){delete _0x52bcd2['name'];}_0x50b4b0['status'](_0x17eaa7)[_0x1857('0xd')](_0x52bcd2);};}function execChildProcess(){return new BPromise(function(_0x2f3d95,_0x10f849){exec(_0x1857('0xe'),function(_0x462274,_0x1bbc9c,_0x241312){logger[_0x1857('0xf')](_0x1bbc9c);logger[_0x1857('0xf')](_0x241312);if(_0x462274){logger[_0x1857('0xa')](_0x462274);return _0x10f849(_0x462274);}return _0x2f3d95(_0x1bbc9c);});});}exports[_0x1857('0x10')]=function(_0x4e9c88,_0xa8808b){return pm2[_0x1857('0x11')]()[_0x1857('0x12')](function(_0x3a49c5){if(_0x3a49c5){var _0x5b079d=_[_0x1857('0x13')](_0x3a49c5,function(_0x3e0b5e){return _0x3e0b5e[_0x1857('0xc')]===_0x1857('0x14')||_0x3e0b5e[_0x1857('0xc')]===_0x1857('0x15');});return{'rows':_0x5b079d,'count':_0x5b079d[_0x1857('0x16')]};}return null;})[_0x1857('0x12')](respondWithResult(_0xa8808b,null))[_0x1857('0x17')](handleError(_0xa8808b,null));};exports[_0x1857('0x18')]=function(_0x1be801,_0x5641c1){return pm2[_0x1857('0x19')](_0x1be801[_0x1857('0x1a')]['id'])['then'](respondWithResult(_0x5641c1,null))[_0x1857('0x12')](handleEntityNotFound(_0x5641c1,null))['catch'](handleError(_0x5641c1,null));};exports[_0x1857('0x1b')]=function(_0x362f7e,_0x2958a9){if(_0x362f7e[_0x1857('0x1c')][_0x1857('0xc')]&&_0x362f7e['body']['script']){var _0x2c5679=path[_0x1857('0x1d')](__dirname,_0x1857('0x1e'),_0x362f7e[_0x1857('0x1c')]['script']);var _0x1ed57d=process[_0x1857('0x1f')]();process[_0x1857('0x20')](path[_0x1857('0x21')](_0x2c5679));return execChildProcess()[_0x1857('0x12')](function(_0x412ff0){process['chdir'](_0x1ed57d);return pm2[_0x1857('0x22')]({'name':_0x362f7e[_0x1857('0x1c')][_0x1857('0xc')],'script':_0x2c5679});})[_0x1857('0x12')](function(_0x400e20){pm2[_0x1857('0x23')]();return _0x400e20[0x0];})[_0x1857('0x12')](respondWithResult(_0x2958a9,0xc9))['catch'](handleError(_0x2958a9,null));}else{return _0x2958a9['status'](0x1f4)[_0x1857('0xd')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x1857('0x24')]=function(_0x2e92d9,_0x3e61a1){if(_0x2e92d9['body']['id']){delete _0x2e92d9['body']['id'];}var _0x45de94={'online':_0x1857('0x25'),'stopped':'stop'};if(_0x45de94[_0x1857('0x26')](_0x2e92d9[_0x1857('0x1c')][_0x1857('0x8')])){return pm2[_0x45de94[_0x2e92d9['body'][_0x1857('0x8')]]](_0x2e92d9[_0x1857('0x1a')]['id'])['then'](respondWithResult(_0x3e61a1,0xc8))[_0x1857('0x17')](handleError(_0x3e61a1,null));}else{return _0x3e61a1[_0x1857('0x8')](0x1f4)[_0x1857('0xd')]({'message':_0x1857('0x27')});}};exports[_0x1857('0x28')]=function(_0x48d669,_0x43e31a){if(_0x48d669[_0x1857('0x1c')]['id']){delete _0x48d669[_0x1857('0x1c')]['id'];}if(_0x48d669[_0x1857('0x1a')]['id']){return pm2[_0x1857('0x29')](_0x48d669[_0x1857('0x1a')]['id'])[_0x1857('0x12')](function(_0x46d4e5){pm2['dump']();return _0x46d4e5[0x0];})[_0x1857('0x12')](respondWithResult(_0x43e31a,null))['catch'](handleError(_0x43e31a,null));}else{return _0x43e31a['status'](0x1f4)[_0x1857('0xd')]({'message':_0x1857('0x2a')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 429acce..01d5dbe 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 _0xb050=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3935d7,_0x39958f){var _0x2ca73e=function(_0x4a6c5d){while(--_0x4a6c5d){_0x3935d7['push'](_0x3935d7['shift']());}};_0x2ca73e(++_0x39958f);}(_0xb050,0x127));var _0x0b05=function(_0x5514be,_0x3b37cb){_0x5514be=_0x5514be-0x0;var _0x2b21ff=_0xb050[_0x5514be];return _0x2b21ff;};'use strict';var multer=require(_0x0b05('0x0'));var util=require(_0x0b05('0x1'));var path=require(_0x0b05('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0b05('0x3')]();var auth=require(_0x0b05('0x4'));var interaction=require(_0x0b05('0x5'));var config=require('../../config/environment');module[_0x0b05('0x6')]=router; \ No newline at end of file +var _0xcfc5=['../../components/auth/service','../../components/interaction/service','exports','multer','path','connect-timeout','Router'];(function(_0x5f0b22,_0x454ef7){var _0x40a55e=function(_0x22f9cc){while(--_0x22f9cc){_0x5f0b22['push'](_0x5f0b22['shift']());}};_0x40a55e(++_0x454ef7);}(_0xcfc5,0xa4));var _0x5cfc=function(_0x31eb67,_0x9bc8c0){_0x31eb67=_0x31eb67-0x0;var _0x2a8cb8=_0xcfc5[_0x31eb67];return _0x2a8cb8;};'use strict';var multer=require(_0x5cfc('0x0'));var util=require('util');var path=require(_0x5cfc('0x1'));var timeout=require(_0x5cfc('0x2'));var express=require('express');var router=express[_0x5cfc('0x3')]();var auth=require(_0x5cfc('0x4'));var interaction=require(_0x5cfc('0x5'));var config=require('../../config/environment');module[_0x5cfc('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 50b48b6..f7a49c2 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 _0x0ca2=['INTEGER','DATE','STRING','exports'];(function(_0x17b140,_0xc447af){var _0x273ca5=function(_0x3323ab){while(--_0x3323ab){_0x17b140['push'](_0x17b140['shift']());}};_0x273ca5(++_0xc447af);}(_0x0ca2,0x10f));var _0x20ca=function(_0x297acf,_0x530d6c){_0x297acf=_0x297acf-0x0;var _0x2dd757=_0x0ca2[_0x297acf];return _0x2dd757;};'use strict';var Sequelize=require('sequelize');module[_0x20ca('0x0')]={'state':{'type':Sequelize[_0x20ca('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x20ca('0x2')]},'uniqueid':{'type':Sequelize[_0x20ca('0x3')]},'starttime':{'type':Sequelize[_0x20ca('0x2')]},'responsetime':{'type':Sequelize[_0x20ca('0x2')]},'ringtime':{'type':Sequelize[_0x20ca('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x20ca('0x3')]},'campaigntype':{'type':Sequelize[_0x20ca('0x3')]},'membername':{'type':Sequelize[_0x20ca('0x3')]}}; \ No newline at end of file +var _0x97c4=['sequelize','exports','DATE','STRING'];(function(_0x3e9b37,_0x553faf){var _0x320d54=function(_0x104c9f){while(--_0x104c9f){_0x3e9b37['push'](_0x3e9b37['shift']());}};_0x320d54(++_0x553faf);}(_0x97c4,0x120));var _0x497c=function(_0x338b9c,_0x5366f1){_0x338b9c=_0x338b9c-0x0;var _0x45debe=_0x97c4[_0x338b9c];return _0x45debe;};'use strict';var Sequelize=require(_0x497c('0x0'));module[_0x497c('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x497c('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x497c('0x2')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x497c('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 39346ae..088dce7 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 _0x4a3a=['../../config/logger','api','moment','bluebird','request-promise','./reportAgentPreview.attributes','exports','ReportAgentPreview','util'];(function(_0x30b84a,_0x25bad2){var _0x3748db=function(_0x469630){while(--_0x469630){_0x30b84a['push'](_0x30b84a['shift']());}};_0x3748db(++_0x25bad2);}(_0x4a3a,0xe0));var _0xa4a3=function(_0x49b8c0,_0x49b7a4){_0x49b8c0=_0x49b8c0-0x0;var _0x29450e=_0x4a3a[_0x49b8c0];return _0x29450e;};'use strict';var _=require('lodash');var util=require(_0xa4a3('0x0'));var logger=require(_0xa4a3('0x1'))(_0xa4a3('0x2'));var moment=require(_0xa4a3('0x3'));var BPromise=require(_0xa4a3('0x4'));var rp=require(_0xa4a3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa4a3('0x6'));module[_0xa4a3('0x7')]=function(_0x27de75,_0x4910b5){return _0x27de75['define'](_0xa4a3('0x8'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3faf=['request-promise','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','util','moment','bluebird'];(function(_0x2d5bf7,_0xb11600){var _0x490c56=function(_0x4ca549){while(--_0x4ca549){_0x2d5bf7['push'](_0x2d5bf7['shift']());}};_0x490c56(++_0xb11600);}(_0x3faf,0x1d6));var _0xf3fa=function(_0x436650,_0x286d65){_0x436650=_0x436650-0x0;var _0xa2bbc5=_0x3faf[_0x436650];return _0xa2bbc5;};'use strict';var _=require('lodash');var util=require(_0xf3fa('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf3fa('0x1'));var BPromise=require(_0xf3fa('0x2'));var rp=require(_0xf3fa('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf3fa('0x4'));var config=require(_0xf3fa('0x5'));var attributes=require(_0xf3fa('0x6'));module[_0xf3fa('0x7')]=function(_0x16e660,_0x2a2a71){return _0x16e660[_0xf3fa('0x8')](_0xf3fa('0x9'),attributes,{'tableName':_0xf3fa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index b893a9b..6035a8e 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 _0x0a5c=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','create','body','options','raw','lodash'];(function(_0x217f8,_0x369f44){var _0x2ae878=function(_0x28ee38){while(--_0x28ee38){_0x217f8['push'](_0x217f8['shift']());}};_0x2ae878(++_0x369f44);}(_0x0a5c,0x117));var _0xc0a5=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x0a5c[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0xc0a5('0x0'));var util=require(_0xc0a5('0x1'));var moment=require(_0xc0a5('0x2'));var BPromise=require(_0xc0a5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc0a5('0x4'));var db=require(_0xc0a5('0x5'))['db'];var utils=require(_0xc0a5('0x6'));var logger=require(_0xc0a5('0x7'))(_0xc0a5('0x8'));var config=require('../../config/environment');var jayson=require(_0xc0a5('0x9'));var client=jayson['client'][_0xc0a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x388635,_0x20472b,_0x24cac0){return new BPromise(function(_0x3b4174,_0x4c93b7){return client['request'](_0x388635,_0x24cac0)[_0xc0a5('0xb')](function(_0xde0d29){logger[_0xc0a5('0xc')](_0xc0a5('0xd'),_0x20472b,_0xc0a5('0xe'));logger[_0xc0a5('0xf')](_0xc0a5('0x10'),_0x20472b,_0xc0a5('0xe'),JSON[_0xc0a5('0x11')](_0xde0d29));if(_0xde0d29[_0xc0a5('0x12')]){if(_0xde0d29[_0xc0a5('0x12')][_0xc0a5('0x13')]===0x1f4){logger[_0xc0a5('0x12')](_0xc0a5('0xd'),_0x20472b,_0xde0d29['error'][_0xc0a5('0x14')]);return _0x4c93b7(_0xde0d29[_0xc0a5('0x12')]['message']);}logger[_0xc0a5('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x20472b,_0xde0d29[_0xc0a5('0x12')][_0xc0a5('0x14')]);return _0x3b4174(_0xde0d29['error'][_0xc0a5('0x14')]);}else{logger[_0xc0a5('0xc')]('ReportAgentPreview,\x20%s,\x20%s',_0x20472b,_0xc0a5('0xe'));_0x3b4174(_0xde0d29[_0xc0a5('0x15')][_0xc0a5('0x14')]);}})[_0xc0a5('0x16')](function(_0x4bc17b){logger[_0xc0a5('0x12')](_0xc0a5('0xd'),_0x20472b,_0x4bc17b);_0x4c93b7(_0x4bc17b);});});}exports[_0xc0a5('0x17')]=function(_0x5752e1){var _0x215690=this;return new Promise(function(_0x40c8c0,_0x500a4e){return db['ReportAgentPreview'][_0xc0a5('0x18')](_0x5752e1[_0xc0a5('0x19')],{'raw':_0x5752e1[_0xc0a5('0x1a')]?_0x5752e1[_0xc0a5('0x1a')][_0xc0a5('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x1bd7fe){logger[_0xc0a5('0xc')]('CreateReportAgentPreview',_0x5752e1);logger[_0xc0a5('0xf')]('CreateReportAgentPreview',_0x5752e1,JSON[_0xc0a5('0x11')](_0x1bd7fe));_0x40c8c0(_0x1bd7fe);})['catch'](function(_0x966e49){logger[_0xc0a5('0x12')](_0xc0a5('0x17'),_0x966e49['message'],_0x5752e1);_0x500a4e(_0x215690[_0xc0a5('0x12')](0x1f4,_0x966e49[_0xc0a5('0x14')]));});});}; \ No newline at end of file +var _0x2f9a=['debug','request\x20sent','stringify','error','code','message','info','result','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','ReportAgentPreview,\x20%s,\x20%s'];(function(_0xfa2e1e,_0x4002ed){var _0x2f1d12=function(_0x222fe6){while(--_0x222fe6){_0xfa2e1e['push'](_0xfa2e1e['shift']());}};_0x2f1d12(++_0x4002ed);}(_0x2f9a,0x1f4));var _0xa2f9=function(_0x53ed0b,_0x25e205){_0x53ed0b=_0x53ed0b-0x0;var _0x453628=_0x2f9a[_0x53ed0b];return _0x453628;};'use strict';var _=require(_0xa2f9('0x0'));var util=require(_0xa2f9('0x1'));var moment=require(_0xa2f9('0x2'));var BPromise=require('bluebird');var rs=require(_0xa2f9('0x3'));var fs=require('fs');var Redis=require(_0xa2f9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa2f9('0x5'));var logger=require(_0xa2f9('0x6'))(_0xa2f9('0x7'));var config=require(_0xa2f9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa2f9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c46ba,_0x2d486f,_0x2c0b0e){return new BPromise(function(_0x506811,_0x1eba2d){return client[_0xa2f9('0xa')](_0x5c46ba,_0x2c0b0e)[_0xa2f9('0xb')](function(_0x39c7d7){logger['info'](_0xa2f9('0xc'),_0x2d486f,'request\x20sent');logger[_0xa2f9('0xd')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x2d486f,_0xa2f9('0xe'),JSON[_0xa2f9('0xf')](_0x39c7d7));if(_0x39c7d7['error']){if(_0x39c7d7[_0xa2f9('0x10')][_0xa2f9('0x11')]===0x1f4){logger[_0xa2f9('0x10')](_0xa2f9('0xc'),_0x2d486f,_0x39c7d7[_0xa2f9('0x10')][_0xa2f9('0x12')]);return _0x1eba2d(_0x39c7d7[_0xa2f9('0x10')][_0xa2f9('0x12')]);}logger[_0xa2f9('0x10')](_0xa2f9('0xc'),_0x2d486f,_0x39c7d7[_0xa2f9('0x10')]['message']);return _0x506811(_0x39c7d7[_0xa2f9('0x10')][_0xa2f9('0x12')]);}else{logger[_0xa2f9('0x13')](_0xa2f9('0xc'),_0x2d486f,_0xa2f9('0xe'));_0x506811(_0x39c7d7[_0xa2f9('0x14')][_0xa2f9('0x12')]);}})['catch'](function(_0x1fd784){logger[_0xa2f9('0x10')](_0xa2f9('0xc'),_0x2d486f,_0x1fd784);_0x1eba2d(_0x1fd784);});});}exports[_0xa2f9('0x15')]=function(_0x66e45b){var _0x46b40e=this;return new Promise(function(_0x586a79,_0x43bddf){return db[_0xa2f9('0x16')]['create'](_0x66e45b[_0xa2f9('0x17')],{'raw':_0x66e45b[_0xa2f9('0x18')]?_0x66e45b[_0xa2f9('0x18')][_0xa2f9('0x19')]===undefined?!![]:![]:!![]})[_0xa2f9('0xb')](function(_0x175698){logger[_0xa2f9('0x13')](_0xa2f9('0x15'),_0x66e45b);logger[_0xa2f9('0xd')](_0xa2f9('0x15'),_0x66e45b,JSON['stringify'](_0x175698));_0x586a79(_0x175698);})[_0xa2f9('0x1a')](function(_0x4c6383){logger[_0xa2f9('0x10')](_0xa2f9('0x15'),_0x4c6383[_0xa2f9('0x12')],_0x66e45b);_0x43bddf(_0x46b40e[_0xa2f9('0x10')](0x1f4,_0x4c6383[_0xa2f9('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index b5b7a59..d82337d 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 _0xc5b1=['./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','/outbound','outbound','outboundChannels','/agents','agents','agentCapacity','/trunks','trunks','/campaigns','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','post','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x35cab3,_0x3a165f){var _0x1f82a8=function(_0x3e56a2){while(--_0x3e56a2){_0x35cab3['push'](_0x35cab3['shift']());}};_0x1f82a8(++_0x3a165f);}(_0xc5b1,0x98));var _0x1c5b=function(_0x198897,_0x39167a){_0x198897=_0x198897-0x0;var _0x2b10d6=_0xc5b1[_0x198897];return _0x2b10d6;};'use strict';var multer=require(_0x1c5b('0x0'));var util=require(_0x1c5b('0x1'));var path=require(_0x1c5b('0x2'));var express=require(_0x1c5b('0x3'));var router=express[_0x1c5b('0x4')]();var auth=require(_0x1c5b('0x5'));var controller=require(_0x1c5b('0x6'));router[_0x1c5b('0x7')](_0x1c5b('0x8'),auth['isAuthenticated'](),controller[_0x1c5b('0x9')]);router[_0x1c5b('0x7')](_0x1c5b('0xa'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0xc')]);router['get'](_0x1c5b('0xd'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0xe')]);router[_0x1c5b('0x7')](_0x1c5b('0xf'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x10')]);router[_0x1c5b('0x7')](_0x1c5b('0x11'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x12')]);router[_0x1c5b('0x7')](_0x1c5b('0x13'),auth['isAuthenticated'](),controller[_0x1c5b('0x14')]);router['get'](_0x1c5b('0x15'),auth[_0x1c5b('0xb')](),controller['mailAccounts']);router[_0x1c5b('0x7')](_0x1c5b('0x16'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x17')]);router[_0x1c5b('0x7')](_0x1c5b('0x18'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x19')]);router[_0x1c5b('0x7')](_0x1c5b('0x1a'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x1b')]);router['get']('/fax/queues',auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x1c')]);router['get']('/voice/queues/preview/:id',auth[_0x1c5b('0xb')](),controller['voiceQueuesPreview']);router[_0x1c5b('0x7')](_0x1c5b('0x1d'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x1e')]);router['get'](_0x1c5b('0x1f'),auth[_0x1c5b('0xb')](),controller['voiceQueuesChannel']);router[_0x1c5b('0x7')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x20')]);router['get'](_0x1c5b('0x21'),auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router[_0x1c5b('0x7')](_0x1c5b('0x22'),auth[_0x1c5b('0xb')](),controller['showVoiceQueues']);router[_0x1c5b('0x7')](_0x1c5b('0x23'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x24')]);router[_0x1c5b('0x7')]('/outbound/channels',auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x25')]);router[_0x1c5b('0x7')](_0x1c5b('0x26'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x27')]);router['put']('/agents/:id/capacity',auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x28')]);router['get']('/telephones',auth[_0x1c5b('0xb')](),controller['telephones']);router['get'](_0x1c5b('0x29'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x2a')]);router['get'](_0x1c5b('0x2b'),auth[_0x1c5b('0xb')](),controller['campaigns']);router[_0x1c5b('0x7')]('/fax/accounts',auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x2c')]);router['get'](_0x1c5b('0x2d'),auth[_0x1c5b('0xb')](),controller['chatQueuesWaitingInteractions']);router[_0x1c5b('0x7')]('/mail/queues/waitinginteractions',auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x2e')]);router['get'](_0x1c5b('0x2f'),auth[_0x1c5b('0xb')](),controller['openchannelQueuesWaitingInteractions']);router[_0x1c5b('0x7')](_0x1c5b('0x30'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x31')]);router['get']('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x1c5b('0x32')]);router[_0x1c5b('0x7')](_0x1c5b('0x33'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x34')]);router['get']('/fax/queues/waitinginteractions',auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x35')]);router['post'](_0x1c5b('0x36'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x37')](_0x1c5b('0x38')));router['get'](_0x1c5b('0x39'),auth['isAuthenticated'](),controller[_0x1c5b('0x3a')]);router[_0x1c5b('0x3b')]('/chat/queues/:id/notify',auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x37')](_0x1c5b('0x3c')));router['get'](_0x1c5b('0x3d'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x3e')]);router[_0x1c5b('0x3b')](_0x1c5b('0x3f'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x37')]('fax'));router[_0x1c5b('0x7')](_0x1c5b('0x40'),auth['isAuthenticated'](),controller['showFaxQueues']);router[_0x1c5b('0x3b')](_0x1c5b('0x41'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x37')]('openchannel'));router[_0x1c5b('0x7')](_0x1c5b('0x42'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x43')]);router[_0x1c5b('0x3b')](_0x1c5b('0x44'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x37')](_0x1c5b('0x45')));router[_0x1c5b('0x3b')](_0x1c5b('0x46'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x37')](_0x1c5b('0x47')));router[_0x1c5b('0x7')](_0x1c5b('0x48'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x49')]);router['get'](_0x1c5b('0x4a'),auth[_0x1c5b('0xb')](),controller[_0x1c5b('0x4b')]);router['post'](_0x1c5b('0x4c'),auth['isAuthenticated'](),controller[_0x1c5b('0x4d')]);module[_0x1c5b('0x4e')]=router; \ No newline at end of file +var _0x3e90=['put','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','exports','path','express','Router','get','/voice/channels','isAuthenticated','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues','mailAccounts','openchannelQueues','/sms/queues','/whatsapp/queues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','/outbound','outbound','/outbound/channels','outboundChannels','/agents'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3e90,0xfe));var _0x03e9=function(_0xb3f7a5,_0xb2a175){_0xb3f7a5=_0xb3f7a5-0x0;var _0x357045=_0x3e90[_0xb3f7a5];return _0x357045;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x03e9('0x0'));var express=require(_0x03e9('0x1'));var router=express[_0x03e9('0x2')]();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router[_0x03e9('0x3')](_0x03e9('0x4'),auth['isAuthenticated'](),controller['voiceChannels']);router[_0x03e9('0x3')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x03e9('0x5')](),controller[_0x03e9('0x6')]);router[_0x03e9('0x3')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x03e9('0x5')](),controller[_0x03e9('0x7')]);router[_0x03e9('0x3')](_0x03e9('0x8'),auth[_0x03e9('0x5')](),controller[_0x03e9('0x9')]);router['get'](_0x03e9('0xa'),auth[_0x03e9('0x5')](),controller[_0x03e9('0xb')]);router[_0x03e9('0x3')]('/mail/queues',auth[_0x03e9('0x5')](),controller[_0x03e9('0xc')]);router['get']('/mail/accounts',auth[_0x03e9('0x5')](),controller[_0x03e9('0xd')]);router[_0x03e9('0x3')]('/openchannel/queues',auth[_0x03e9('0x5')](),controller[_0x03e9('0xe')]);router[_0x03e9('0x3')](_0x03e9('0xf'),auth[_0x03e9('0x5')](),controller['smsQueues']);router[_0x03e9('0x3')](_0x03e9('0x10'),auth[_0x03e9('0x5')](),controller['whatsappQueues']);router[_0x03e9('0x3')](_0x03e9('0x11'),auth[_0x03e9('0x5')](),controller['faxQueues']);router[_0x03e9('0x3')](_0x03e9('0x12'),auth[_0x03e9('0x5')](),controller[_0x03e9('0x13')]);router[_0x03e9('0x3')](_0x03e9('0x14'),auth[_0x03e9('0x5')](),controller[_0x03e9('0x15')]);router[_0x03e9('0x3')](_0x03e9('0x16'),auth[_0x03e9('0x5')](),controller[_0x03e9('0x17')]);router[_0x03e9('0x3')](_0x03e9('0x18'),auth[_0x03e9('0x5')](),controller[_0x03e9('0x19')]);router[_0x03e9('0x3')](_0x03e9('0x1a'),auth['isAuthenticated'](),controller[_0x03e9('0x1b')]);router['get'](_0x03e9('0x1c'),auth[_0x03e9('0x5')](),controller['showVoiceQueues']);router[_0x03e9('0x3')](_0x03e9('0x1d'),auth[_0x03e9('0x5')](),controller[_0x03e9('0x1e')]);router[_0x03e9('0x3')](_0x03e9('0x1f'),auth['isAuthenticated'](),controller[_0x03e9('0x20')]);router[_0x03e9('0x3')](_0x03e9('0x21'),auth[_0x03e9('0x5')](),controller['agents']);router[_0x03e9('0x22')](_0x03e9('0x23'),auth[_0x03e9('0x5')](),controller[_0x03e9('0x24')]);router['get'](_0x03e9('0x25'),auth[_0x03e9('0x5')](),controller[_0x03e9('0x26')]);router[_0x03e9('0x3')](_0x03e9('0x27'),auth[_0x03e9('0x5')](),controller[_0x03e9('0x28')]);router['get'](_0x03e9('0x29'),auth['isAuthenticated'](),controller['campaigns']);router[_0x03e9('0x3')]('/fax/accounts',auth['isAuthenticated'](),controller['faxAccounts']);router[_0x03e9('0x3')](_0x03e9('0x2a'),auth[_0x03e9('0x5')](),controller[_0x03e9('0x2b')]);router[_0x03e9('0x3')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x03e9('0x2c')]);router[_0x03e9('0x3')]('/openchannel/queues/waitinginteractions',auth[_0x03e9('0x5')](),controller[_0x03e9('0x2d')]);router[_0x03e9('0x3')](_0x03e9('0x2e'),auth[_0x03e9('0x5')](),controller[_0x03e9('0x2f')]);router['get'](_0x03e9('0x30'),auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router[_0x03e9('0x3')](_0x03e9('0x31'),auth[_0x03e9('0x5')](),controller[_0x03e9('0x32')]);router[_0x03e9('0x3')](_0x03e9('0x33'),auth[_0x03e9('0x5')](),controller['faxQueuesWaitingInteractions']);router[_0x03e9('0x34')](_0x03e9('0x35'),auth[_0x03e9('0x5')](),controller[_0x03e9('0x36')](_0x03e9('0x37')));router[_0x03e9('0x3')]('/mail/queues/:id',auth[_0x03e9('0x5')](),controller[_0x03e9('0x38')]);router['post'](_0x03e9('0x39'),auth[_0x03e9('0x5')](),controller[_0x03e9('0x36')]('chat'));router[_0x03e9('0x3')](_0x03e9('0x3a'),auth['isAuthenticated'](),controller['showChatQueues']);router[_0x03e9('0x34')]('/fax/queues/:id/notify',auth[_0x03e9('0x5')](),controller[_0x03e9('0x36')]('fax'));router[_0x03e9('0x3')](_0x03e9('0x3b'),auth[_0x03e9('0x5')](),controller[_0x03e9('0x3c')]);router['post'](_0x03e9('0x3d'),auth['isAuthenticated'](),controller[_0x03e9('0x36')](_0x03e9('0x3e')));router['get'](_0x03e9('0x3f'),auth[_0x03e9('0x5')](),controller[_0x03e9('0x40')]);router[_0x03e9('0x34')]('/sms/queues/:id/notify',auth['isAuthenticated'](),controller[_0x03e9('0x36')](_0x03e9('0x41')));router[_0x03e9('0x34')](_0x03e9('0x42'),auth[_0x03e9('0x5')](),controller[_0x03e9('0x36')]('whatsapp'));router[_0x03e9('0x3')](_0x03e9('0x43'),auth['isAuthenticated'](),controller[_0x03e9('0x44')]);router[_0x03e9('0x3')](_0x03e9('0x45'),auth[_0x03e9('0x5')](),controller['showWhatsappQueues']);router['post'](_0x03e9('0x46'),auth[_0x03e9('0x5')](),controller['agentNotify']);module[_0x03e9('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 3d949b1..990b15b 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 _0xfdf6=['VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','interface','format','SIP/%s','agent','AgentCapacity','capacity','telephones','Telephones','Trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','queue_id','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','MessageId','InteractionId','From','QueueId','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','channel','Agent\x20not\x20found','\x20Message\x20not\x20found','update','TransferReport','agentTransferTimeout','bluebird','lodash','util','../../mysqldb','../../config/logger','api','client','http','then','error','code','message','result','catch','status','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','voiceChannelMixMonitor'];(function(_0x4adb59,_0x204658){var _0x4358dc=function(_0x25dc5f){while(--_0x25dc5f){_0x4adb59['push'](_0x4adb59['shift']());}};_0x4358dc(++_0x204658);}(_0xfdf6,0x1cc));var _0x6fdf=function(_0x3cf741,_0x31a0f6){_0x3cf741=_0x3cf741-0x0;var _0x311e57=_0xfdf6[_0x3cf741];return _0x311e57;};'use strict';var BPromise=require(_0x6fdf('0x0'));var moment=require('moment');var _=require(_0x6fdf('0x1'));var util=require(_0x6fdf('0x2'));var db=require(_0x6fdf('0x3'))['db'];var logger=require(_0x6fdf('0x4'))(_0x6fdf('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x6fdf('0x6')][_0x6fdf('0x7')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x6fdf('0x6')][_0x6fdf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x4449dc,_0x305c36,_0x33f7e3){return new BPromise(function(_0x51799a,_0x41f164){var _0x29fae1=_0x33f7e3?_0x33f7e3:amiClient;return _0x29fae1['request'](_0x4449dc,_0x305c36)[_0x6fdf('0x8')](function(_0x57cea2){if(_0x57cea2[_0x6fdf('0x9')]){if(_0x57cea2[_0x6fdf('0x9')][_0x6fdf('0xa')]===0x1f4){return _0x41f164(_0x57cea2[_0x6fdf('0x9')][_0x6fdf('0xb')]);}return _0x51799a(_0x57cea2[_0x6fdf('0x9')][_0x6fdf('0xb')]);}else{_0x51799a(_0x57cea2[_0x6fdf('0xc')]);}})[_0x6fdf('0xd')](function(_0x46b66a){_0x41f164(_0x46b66a);});});}function respondWithResult(_0x1f4d11,_0x348557){_0x348557=_0x348557||0xc8;return function(_0x378c87){if(_0x378c87){return _0x1f4d11[_0x6fdf('0xe')](_0x348557)['json'](_0x378c87);}return _0x1f4d11['sendStatus'](0x194);};}function handleError(_0x41c710,_0x5776c7){_0x5776c7=_0x5776c7||0x1f4;return function(_0x105395){logger['error'](_0x105395[_0x6fdf('0xf')]);if(_0x105395[_0x6fdf('0x10')]){delete _0x105395[_0x6fdf('0x10')];}_0x41c710[_0x6fdf('0xe')](_0x5776c7)[_0x6fdf('0x11')](_0x105395);};}function findById(_0x21493f){return function(_0x37c50c){if(!_[_0x6fdf('0x12')](_0x21493f)&&!_[_0x6fdf('0x12')](_0x37c50c)&&!_[_0x6fdf('0x12')](_0x37c50c[_0x6fdf('0x13')])){return _[_0x6fdf('0x14')](_0x37c50c[_0x6fdf('0x13')],function(_0x40a5c0){return _0x40a5c0['id']==_0x21493f;});}return null;};}exports[_0x6fdf('0x15')]=function(_0x1f2742,_0x39f08b){return respondWithRpcPromise(_0x6fdf('0x16'),_0x1f2742['query'])['then'](respondWithResult(_0x39f08b,null))[_0x6fdf('0xd')](handleError(_0x39f08b,null));};exports[_0x6fdf('0x17')]=function(_0x23ebd0,_0x3796b5){return respondWithRpcPromise(_0x6fdf('0x18'),_[_0x6fdf('0x19')](_0x23ebd0[_0x6fdf('0x1a')],_0x23ebd0[_0x6fdf('0x1b')]))[_0x6fdf('0x8')](respondWithResult(_0x3796b5,null))[_0x6fdf('0xd')](handleError(_0x3796b5,null));};exports['voiceChannelStopMixMonitor']=function(_0x4be876,_0x272d81){return respondWithRpcPromise(_0x6fdf('0x1c'),_['merge'](_0x4be876[_0x6fdf('0x1a')],_0x4be876['params']))[_0x6fdf('0x8')](respondWithResult(_0x272d81,null))[_0x6fdf('0xd')](handleError(_0x272d81,null));};exports[_0x6fdf('0x1d')]=function(_0x2a05e0,_0x10075f){return respondWithRpcPromise(_0x6fdf('0x1e'),_0x2a05e0[_0x6fdf('0x1a')])[_0x6fdf('0x8')](respondWithResult(_0x10075f,null))[_0x6fdf('0xd')](handleError(_0x10075f,null));};exports[_0x6fdf('0x1f')]=function(_0x4e7078,_0x196941){return respondWithRpcPromise(_0x6fdf('0x1e'),_0x4e7078[_0x6fdf('0x1a')])[_0x6fdf('0x8')](findById(_0x4e7078[_0x6fdf('0x1b')]['id']))[_0x6fdf('0x8')](respondWithResult(_0x196941,null))[_0x6fdf('0xd')](handleError(_0x196941,null));};exports[_0x6fdf('0x20')]=function(_0x2e63ea,_0x1f9d4d){return respondWithRpcPromise(_0x6fdf('0x21'),_[_0x6fdf('0x19')](_0x2e63ea[_0x6fdf('0x1a')],_0x2e63ea['params']))[_0x6fdf('0x8')](respondWithResult(_0x1f9d4d,null))[_0x6fdf('0xd')](handleError(_0x1f9d4d,null));};exports[_0x6fdf('0x22')]=function(_0x11f2ac,_0xd11c1a){return respondWithRpcPromise('VoiceQueuesChannels',_0x11f2ac['query'])[_0x6fdf('0x8')](respondWithResult(_0xd11c1a,null))[_0x6fdf('0xd')](handleError(_0xd11c1a,null));};exports[_0x6fdf('0x23')]=function(_0x4ec445,_0x65c445){return respondWithRpcPromise(_0x6fdf('0x24'),_[_0x6fdf('0x19')](_0x4ec445[_0x6fdf('0x1a')],_0x4ec445[_0x6fdf('0x1b')]))[_0x6fdf('0x8')](respondWithResult(_0x65c445,null))[_0x6fdf('0xd')](handleError(_0x65c445,null));};exports['voiceQueuesChannelHangup']=function(_0x4af836,_0x444eb6){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x6fdf('0x19')](_0x4af836[_0x6fdf('0x1a')],_0x4af836[_0x6fdf('0x1b')]))[_0x6fdf('0x8')](respondWithResult(_0x444eb6,null))[_0x6fdf('0xd')](handleError(_0x444eb6,null));};exports[_0x6fdf('0x25')]=function(_0x5f4be3,_0x3076d1){return respondWithRpcPromise(_0x6fdf('0x26'),_[_0x6fdf('0x19')](_0x5f4be3[_0x6fdf('0x1a')],_0x5f4be3['params']))['then'](respondWithResult(_0x3076d1,null))[_0x6fdf('0xd')](handleError(_0x3076d1,null));};exports['outbound']=function(_0x541b4c,_0x19b13e){return respondWithRpcPromise(_0x6fdf('0x27'),_0x541b4c[_0x6fdf('0x1a')])[_0x6fdf('0x8')](respondWithResult(_0x19b13e,null))['catch'](handleError(_0x19b13e,null));};exports[_0x6fdf('0x28')]=function(_0x4b7325,_0xc51b45){return respondWithRpcPromise(_0x6fdf('0x29'),_0x4b7325[_0x6fdf('0x1a')])[_0x6fdf('0x8')](respondWithResult(_0xc51b45,null))[_0x6fdf('0xd')](handleError(_0xc51b45,null));};exports[_0x6fdf('0x2a')]=function(_0x4b76f8,_0x45db2a){var _0x3c9106;return respondWithRpcPromise(_0x6fdf('0x2b'),_0x4b76f8[_0x6fdf('0x1a')])[_0x6fdf('0x8')](function(_0x33263d){_0x3c9106=_0x33263d;return respondWithRpcPromise(_0x6fdf('0x2b'),_0x4b76f8[_0x6fdf('0x1a')],routingClient);})[_0x6fdf('0x8')](function(_0xa0c4a2){return _[_0x6fdf('0x19')]({},_0xa0c4a2,_0x3c9106);})['then'](respondWithResult(_0x45db2a,null))[_0x6fdf('0xd')](handleError(_0x45db2a,null));};exports[_0x6fdf('0x2c')]=function(_0x51d926,_0x437b36){if(_0x51d926['body']&&_0x51d926[_0x6fdf('0x2d')][_0x6fdf('0x2e')]&&_0x51d926['user']&&_0x51d926[_0x6fdf('0x2f')][_0x6fdf('0x10')]){for(var _0x3dd206 in _0x51d926['body'][_0x6fdf('0x2e')]){if(_0x51d926[_0x6fdf('0x2d')]['interaction'][_0x6fdf('0x30')](_0x3dd206)){db[_0x6fdf('0x31')][_0x6fdf('0x32')]({'where':{'channel':_0x3dd206,'membername':_0x51d926[_0x6fdf('0x2f')]['name'],'type':_0x6fdf('0x33'),'exitAt':null,'uniqueid':_0x51d926[_0x6fdf('0x2d')][_0x6fdf('0x2e')][_0x3dd206]&&_0x51d926[_0x6fdf('0x2d')]['interaction'][_0x3dd206][_0x6fdf('0x34')]?{'$notIn':_0x51d926[_0x6fdf('0x2d')]['interaction'][_0x3dd206]}:{'$ne':null}}})[_0x6fdf('0x8')](function(_0x323d53){var _0x13d63c=moment()['format'](_0x6fdf('0x35'));for(var _0x39ca37=0x0,_0x13627d=_0x323d53[_0x6fdf('0x34')];_0x39ca37<_0x13627d;_0x39ca37+=0x1){_0x323d53[_0x39ca37][_0x6fdf('0x36')]({'exitAt':_0x13d63c});}});for(var _0x176f09=0x0;_0x176f09<_0x51d926['body'][_0x6fdf('0x2e')][_0x3dd206][_0x6fdf('0x34')];_0x176f09+=0x1){db[_0x6fdf('0x31')]['findOrCreate']({'where':{'channel':_0x3dd206,'membername':_0x51d926[_0x6fdf('0x2f')][_0x6fdf('0x10')],'type':_0x6fdf('0x33'),'uniqueid':_0x51d926['body'][_0x6fdf('0x2e')][_0x3dd206][_0x176f09],'exitAt':null},'defaults':{'channel':_0x3dd206,'membername':_0x51d926[_0x6fdf('0x2f')][_0x6fdf('0x10')],'interface':_['isNil'](_0x51d926['user'][_0x6fdf('0x37')])?util[_0x6fdf('0x38')](_0x6fdf('0x39'),_0x51d926[_0x6fdf('0x2f')][_0x6fdf('0x10')]):_0x51d926['user'][_0x6fdf('0x37')],'type':'INTERACTION','enterAt':moment()[_0x6fdf('0x38')](_0x6fdf('0x35')),'role':_0x6fdf('0x3a'),'internal':_0x51d926[_0x6fdf('0x2f')]['internal'],'uniqueid':_0x51d926[_0x6fdf('0x2d')][_0x6fdf('0x2e')][_0x3dd206][_0x176f09]}});}}}}return respondWithRpcPromise(_0x6fdf('0x3b'),{'id':_0x51d926['params']['id'],'capacity':_0x51d926[_0x6fdf('0x2d')][_0x6fdf('0x3c')]},routingClient)[_0x6fdf('0x8')](respondWithResult(_0x437b36,null))['catch'](handleError(_0x437b36,null));};exports[_0x6fdf('0x3d')]=function(_0x37cf4c,_0x14a097){return respondWithRpcPromise(_0x6fdf('0x3e'),_0x37cf4c[_0x6fdf('0x1a')])['then'](respondWithResult(_0x14a097,null))['catch'](handleError(_0x14a097,null));};exports['trunks']=function(_0x23d739,_0x161b01){return respondWithRpcPromise(_0x6fdf('0x3f'),_0x23d739[_0x6fdf('0x1a')])[_0x6fdf('0x8')](respondWithResult(_0x161b01,null))[_0x6fdf('0xd')](handleError(_0x161b01,null));};exports['campaigns']=function(_0x253715,_0x2420f2){return respondWithRpcPromise(_0x6fdf('0x40'),_0x253715['query'])['then'](respondWithResult(_0x2420f2,null))['catch'](handleError(_0x2420f2,null));};exports[_0x6fdf('0x41')]=function(_0x5c4734,_0x896543){return respondWithRpcPromise(_0x6fdf('0x42'),_0x5c4734[_0x6fdf('0x1a')],routingClient)[_0x6fdf('0x8')](respondWithResult(_0x896543,null))['catch'](handleError(_0x896543,null));};exports[_0x6fdf('0x43')]=function(_0x13fb45,_0x320633){return respondWithRpcPromise(_0x6fdf('0x42'),_0x13fb45[_0x6fdf('0x1a')],routingClient)[_0x6fdf('0x8')](findById(_0x13fb45[_0x6fdf('0x1b')]['id']))[_0x6fdf('0x8')](respondWithResult(_0x320633,null))['catch'](handleError(_0x320633,null));};exports[_0x6fdf('0x44')]=function(_0xae1618,_0x475c09){return respondWithRpcPromise(_0x6fdf('0x45'),_0xae1618[_0x6fdf('0x1a')],routingClient)[_0x6fdf('0x8')](respondWithResult(_0x475c09,null))[_0x6fdf('0xd')](handleError(_0x475c09,null));};exports[_0x6fdf('0x46')]=function(_0x1914a,_0x326352){return respondWithRpcPromise(_0x6fdf('0x45'),_0x1914a[_0x6fdf('0x1a')],routingClient)[_0x6fdf('0x8')](findById(_0x1914a['params']['id']))[_0x6fdf('0x8')](respondWithResult(_0x326352,null))['catch'](handleError(_0x326352,null));};exports['mailAccounts']=function(_0xd66c73,_0x3c0845){return respondWithRpcPromise(_0x6fdf('0x47'),_0xd66c73[_0x6fdf('0x1a')],mailClient)[_0x6fdf('0x8')](respondWithResult(_0x3c0845,null))['catch'](handleError(_0x3c0845,null));};exports[_0x6fdf('0x48')]=function(_0x10d97f,_0x3a40e7){return respondWithRpcPromise(_0x6fdf('0x49'),_0x10d97f['query'],routingClient)[_0x6fdf('0x8')](respondWithResult(_0x3a40e7,null))[_0x6fdf('0xd')](handleError(_0x3a40e7,null));};exports[_0x6fdf('0x4a')]=function(_0x5e4d1e,_0x5d3de4){return respondWithRpcPromise(_0x6fdf('0x49'),_0x5e4d1e[_0x6fdf('0x1a')],routingClient)[_0x6fdf('0x8')](findById(_0x5e4d1e[_0x6fdf('0x1b')]['id']))['then'](respondWithResult(_0x5d3de4,null))[_0x6fdf('0xd')](handleError(_0x5d3de4,null));};exports['smsQueues']=function(_0x165567,_0x3c8929){return respondWithRpcPromise('SmsQueues',_0x165567[_0x6fdf('0x1a')],routingClient)[_0x6fdf('0x8')](respondWithResult(_0x3c8929,null))['catch'](handleError(_0x3c8929,null));};exports[_0x6fdf('0x4b')]=function(_0x1bed78,_0x20065b){return respondWithRpcPromise(_0x6fdf('0x4c'),_0x1bed78[_0x6fdf('0x1a')],routingClient)['then'](findById(_0x1bed78[_0x6fdf('0x1b')]['id']))[_0x6fdf('0x8')](respondWithResult(_0x20065b,null))['catch'](handleError(_0x20065b,null));};exports[_0x6fdf('0x4d')]=function(_0x219054,_0x4a01f8){return respondWithRpcPromise(_0x6fdf('0x4e'),_0x219054[_0x6fdf('0x1a')],routingClient)[_0x6fdf('0x8')](respondWithResult(_0x4a01f8,null))['catch'](handleError(_0x4a01f8,null));};exports[_0x6fdf('0x4f')]=function(_0x372aaa,_0x55fdb1){return respondWithRpcPromise(_0x6fdf('0x4e'),_0x372aaa[_0x6fdf('0x1a')],routingClient)[_0x6fdf('0x8')](findById(_0x372aaa['params']['id']))[_0x6fdf('0x8')](respondWithResult(_0x55fdb1,null))[_0x6fdf('0xd')](handleError(_0x55fdb1,null));};exports['faxQueues']=function(_0x292c84,_0x18a520){return respondWithRpcPromise(_0x6fdf('0x50'),_0x292c84[_0x6fdf('0x1a')],routingClient)[_0x6fdf('0x8')](respondWithResult(_0x18a520,null))[_0x6fdf('0xd')](handleError(_0x18a520,null));};exports[_0x6fdf('0x51')]=function(_0x547965,_0xf4db55){return respondWithRpcPromise('FaxQueues',_0x547965[_0x6fdf('0x1a')],routingClient)['then'](findById(_0x547965['params']['id']))[_0x6fdf('0x8')](respondWithResult(_0xf4db55,null))[_0x6fdf('0xd')](handleError(_0xf4db55,null));};exports['faxAccounts']=function(_0x3e4b49,_0x5812be){return respondWithRpcPromise('FaxAccounts',_0x3e4b49[_0x6fdf('0x1a')])[_0x6fdf('0x8')](respondWithResult(_0x5812be,null))[_0x6fdf('0xd')](handleError(_0x5812be,null));};exports['chatQueuesWaitingInteractions']=function(_0x5b8730,_0x54801c){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x5b8730[_0x6fdf('0x1a')],routingClient)['then'](respondWithResult(_0x54801c,null))[_0x6fdf('0xd')](handleError(_0x54801c,null));};exports['mailQueuesWaitingInteractions']=function(_0x416f02,_0x30c61a){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x416f02[_0x6fdf('0x1a')],routingClient)['then'](respondWithResult(_0x30c61a,null))[_0x6fdf('0xd')](handleError(_0x30c61a,null));};exports[_0x6fdf('0x52')]=function(_0x3653c2,_0x299135){return respondWithRpcPromise(_0x6fdf('0x53'),_0x3653c2[_0x6fdf('0x1a')],routingClient)['then'](respondWithResult(_0x299135,null))[_0x6fdf('0xd')](handleError(_0x299135,null));};exports[_0x6fdf('0x54')]=function(_0x22abdb,_0x4eafa5){return respondWithRpcPromise(_0x6fdf('0x53'),_0x22abdb[_0x6fdf('0x1a')],routingClient)[_0x6fdf('0x8')](function(_0x49533d){if(_0x22abdb[_0x6fdf('0x1a')][_0x6fdf('0x55')]!==undefined){var _0x44a91a=_(_0x49533d['rows'])[_0x6fdf('0x56')]([_0x22abdb['query'][_0x6fdf('0x55')],_0x22abdb['params']['id']])['map'](_0x6fdf('0x57'))['uniq']()[_0x6fdf('0x58')]();return _0x49533d['rows'][_0x6fdf('0x56')](function(_0x53ebc2){return _0x44a91a[_0x6fdf('0x59')](_0x53ebc2[_0x6fdf('0x57')])>-0x1;});}else{return _0x49533d[_0x6fdf('0x13')][_0x6fdf('0x56')](function(_0x1cd39c){return _0x1cd39c['queue_id']===parseInt(_0x22abdb[_0x6fdf('0x1b')]['id']);});}})[_0x6fdf('0x8')](respondWithResult(_0x4eafa5,null))[_0x6fdf('0xd')](handleError(_0x4eafa5,null));};exports[_0x6fdf('0x5a')]=function(_0x5837b1,_0x2760f8){return respondWithRpcPromise(_0x6fdf('0x5b'),_0x5837b1['query'],routingClient)[_0x6fdf('0x8')](respondWithResult(_0x2760f8,null))[_0x6fdf('0xd')](handleError(_0x2760f8,null));};exports[_0x6fdf('0x5c')]=function(_0x11fe12,_0x192dd0){return respondWithRpcPromise(_0x6fdf('0x5d'),_0x11fe12['query'],routingClient)[_0x6fdf('0x8')](respondWithResult(_0x192dd0,null))[_0x6fdf('0xd')](handleError(_0x192dd0,null));};exports[_0x6fdf('0x5e')]=function(_0x517740,_0xe27bc7){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x517740[_0x6fdf('0x1a')],routingClient)[_0x6fdf('0x8')](respondWithResult(_0xe27bc7,null))[_0x6fdf('0xd')](handleError(_0xe27bc7,null));};exports[_0x6fdf('0x5f')]=function(_0x256e67){return function(_0x196eb0,_0x1db725){var _0x50b6ab,_0x189196;var _0x35c615=_[_0x6fdf('0x60')](_0x256e67);var _0x13383b=_0x256e67===_0x6fdf('0x61')?_0x6fdf('0x62'):_0x6fdf('0x63');return db[_0x35c615+'Queue'][_0x6fdf('0x64')]({'raw':!![],'where':{'id':_0x196eb0[_0x6fdf('0x1b')]['id']}})[_0x6fdf('0x8')](function(_0x327465){if(_[_0x6fdf('0x12')](_0x327465)){throw new Error(_0x35c615+_0x6fdf('0x65'));}_0x50b6ab=_0x327465;return db[_0x35c615+_0x6fdf('0x66')][_0x6fdf('0x64')]({'where':{'id':_0x196eb0[_0x6fdf('0x2d')][_0x6fdf('0x67')]},'include':[{'model':db[_0x35c615+_0x6fdf('0x68')],'as':_0x6fdf('0x68')},{'model':db[_0x35c615+_0x13383b],'as':'Account'}]});})['then'](function(_0x48e48f){if(_['isNil'](_0x48e48f)){throw new Error(_0x35c615+'\x20Message\x20not\x20found');}_0x189196=_0x48e48f;return _0x48e48f['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x1f114c={'uniqueid':_0x256e67+'.'+_0x189196['id']+'.'+_0x189196[_0x6fdf('0x68')]['id'],'FromUserId':_0x196eb0[_0x6fdf('0x2f')]['id'],'type':'queue'};_0x1f114c[_0x35c615+_0x6fdf('0x69')]=_0x189196['id'];_0x1f114c[_0x35c615+_0x6fdf('0x6a')]=_0x189196[_0x6fdf('0x68')]['id'];_0x1f114c[_0x6fdf('0x6b')+_0x35c615+_0x13383b+'Id']=_0x189196[_0x6fdf('0x63')]['id'];_0x1f114c['To'+_0x35c615+_0x6fdf('0x6c')]=_0x50b6ab['id'];return db[_0x35c615+'TransferReport'][_0x6fdf('0x6d')](_0x1f114c);})[_0x6fdf('0x8')](function(){return respondWithRpcPromise(_0x6fdf('0x6e'),{'channel':_0x256e67,'interaction':_0x189196['Interaction'],'message':_0x189196,'account':_0x189196[_0x6fdf('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6fdf('0x6f'),'appdata':_0x50b6ab[_0x6fdf('0x10')]+','+(_0x189196[_0x6fdf('0x63')][_0x6fdf('0x70')]||0x12c),'interval':_0x6fdf('0x71')}]},routingClient);})[_0x6fdf('0x8')](respondWithResult(_0x1db725,null))['catch'](handleError(_0x1db725,null));};};exports[_0x6fdf('0x72')]=function(_0x13d7a3,_0x5e877d){var _0x2b999e,_0x2ddc96;if(_[_0x6fdf('0x12')](_0x13d7a3[_0x6fdf('0x2d')]['channel'])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x572741=_0x13d7a3['body'][_0x6fdf('0x73')];var _0x5ed5ba=_[_0x6fdf('0x60')](_0x572741);var _0x3f2eab=_0x572741===_0x6fdf('0x61')?_0x6fdf('0x62'):_0x6fdf('0x63');return db['User'][_0x6fdf('0x64')]({'raw':!![],'where':{'id':_0x13d7a3[_0x6fdf('0x1b')]['id'],'role':_0x6fdf('0x3a')}})[_0x6fdf('0x8')](function(_0x4b7855){if(_['isNil'](_0x4b7855)){throw new Error(_0x6fdf('0x74'));}_0x2b999e=_0x4b7855;return db[_0x5ed5ba+_0x6fdf('0x66')][_0x6fdf('0x64')]({'where':{'id':_0x13d7a3[_0x6fdf('0x2d')][_0x6fdf('0x67')]},'include':[{'model':db[_0x5ed5ba+_0x6fdf('0x68')],'as':_0x6fdf('0x68')},{'model':db[_0x5ed5ba+_0x3f2eab],'as':'Account'}]});})[_0x6fdf('0x8')](function(_0x31c418){if(_['isNil'](_0x31c418)){throw new Error(_0x5ed5ba+_0x6fdf('0x75'));}_0x2ddc96=_0x31c418;return _0x31c418[_0x6fdf('0x76')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x4bad81={'uniqueid':_0x572741+'.'+_0x2ddc96['id']+'.'+_0x2ddc96[_0x6fdf('0x68')]['id'],'FromUserId':_0x13d7a3[_0x6fdf('0x2f')]['id'],'type':'queue','ToUserId':_0x2b999e['id']};_0x4bad81[_0x5ed5ba+'MessageId']=_0x2ddc96['id'];_0x4bad81[_0x5ed5ba+'InteractionId']=_0x2ddc96['Interaction']['id'];_0x4bad81[_0x6fdf('0x6b')+_0x5ed5ba+_0x3f2eab+'Id']=_0x2ddc96[_0x6fdf('0x63')]['id'];return db[_0x5ed5ba+_0x6fdf('0x77')]['create'](_0x4bad81);})[_0x6fdf('0x8')](function(){return respondWithRpcPromise(_0x6fdf('0x6e'),{'channel':_0x572741,'interaction':_0x2ddc96[_0x6fdf('0x68')],'message':_0x2ddc96,'account':_0x2ddc96['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x6fdf('0x3a'),'appdata':_0x2b999e[_0x6fdf('0x10')]+','+(_0x2ddc96[_0x6fdf('0x63')][_0x6fdf('0x78')]||0x12c),'interval':_0x6fdf('0x71')}]},routingClient);})['then'](respondWithResult(_0x5e877d,null))[_0x6fdf('0xd')](handleError(_0x5e877d,null));}; \ No newline at end of file +var _0x4718=['request','code','message','error','catch','status','json','sendStatus','stack','isNil','rows','find','VoiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','agents','Agents','agentCapacity','body','user','name','interaction','hasOwnProperty','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','MemberReport','findOrCreate','SIP/%s','interface','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','indexOf','queue_id','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Interaction','\x20Message\x20not\x20found','update','MessageId','From','QueueId','TransferReport','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','capitalize','User','Agent\x20not\x20found','Message','messageId','InteractionId','create','agentTransferTimeout','bluebird','moment','lodash','util','jayson/promise','client','http'];(function(_0x1dfbe4,_0x5ad76a){var _0x50a419=function(_0x4f2ac9){while(--_0x4f2ac9){_0x1dfbe4['push'](_0x1dfbe4['shift']());}};_0x50a419(++_0x5ad76a);}(_0x4718,0x17c));var _0x8471=function(_0x1df7b8,_0x2fe5e5){_0x1df7b8=_0x1df7b8-0x0;var _0x29d911=_0x4718[_0x1df7b8];return _0x29d911;};'use strict';var BPromise=require(_0x8471('0x0'));var moment=require(_0x8471('0x1'));var _=require(_0x8471('0x2'));var util=require(_0x8471('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('api');var jayson=require(_0x8471('0x4'));var amiClient=jayson[_0x8471('0x5')][_0x8471('0x6')]({'port':0x232a});var mailClient=jayson[_0x8471('0x5')][_0x8471('0x6')]({'port':0x232b});var routingClient=jayson[_0x8471('0x5')][_0x8471('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x384ab6,_0x356bc5,_0x386f6d){return new BPromise(function(_0x2d68c8,_0x3b7c6f){var _0x8ecab1=_0x386f6d?_0x386f6d:amiClient;return _0x8ecab1[_0x8471('0x7')](_0x384ab6,_0x356bc5)['then'](function(_0xcde90b){if(_0xcde90b['error']){if(_0xcde90b['error'][_0x8471('0x8')]===0x1f4){return _0x3b7c6f(_0xcde90b['error'][_0x8471('0x9')]);}return _0x2d68c8(_0xcde90b[_0x8471('0xa')][_0x8471('0x9')]);}else{_0x2d68c8(_0xcde90b['result']);}})[_0x8471('0xb')](function(_0x66ba0f){_0x3b7c6f(_0x66ba0f);});});}function respondWithResult(_0x36046c,_0x34f545){_0x34f545=_0x34f545||0xc8;return function(_0x5a3535){if(_0x5a3535){return _0x36046c[_0x8471('0xc')](_0x34f545)[_0x8471('0xd')](_0x5a3535);}return _0x36046c[_0x8471('0xe')](0x194);};}function handleError(_0x350c83,_0x15b0dd){_0x15b0dd=_0x15b0dd||0x1f4;return function(_0x5e1554){logger[_0x8471('0xa')](_0x5e1554[_0x8471('0xf')]);if(_0x5e1554['name']){delete _0x5e1554['name'];}_0x350c83['status'](_0x15b0dd)['send'](_0x5e1554);};}function findById(_0x29fe8d){return function(_0x5ac95a){if(!_[_0x8471('0x10')](_0x29fe8d)&&!_['isNil'](_0x5ac95a)&&!_[_0x8471('0x10')](_0x5ac95a[_0x8471('0x11')])){return _[_0x8471('0x12')](_0x5ac95a['rows'],function(_0x2128b0){return _0x2128b0['id']==_0x29fe8d;});}return null;};}exports['voiceChannels']=function(_0x5e9f83,_0xb95949){return respondWithRpcPromise(_0x8471('0x13'),_0x5e9f83[_0x8471('0x14')])[_0x8471('0x15')](respondWithResult(_0xb95949,null))[_0x8471('0xb')](handleError(_0xb95949,null));};exports[_0x8471('0x16')]=function(_0x3c6890,_0x4d83e0){return respondWithRpcPromise(_0x8471('0x17'),_[_0x8471('0x18')](_0x3c6890[_0x8471('0x14')],_0x3c6890[_0x8471('0x19')]))[_0x8471('0x15')](respondWithResult(_0x4d83e0,null))['catch'](handleError(_0x4d83e0,null));};exports['voiceChannelStopMixMonitor']=function(_0xec8132,_0x17c588){return respondWithRpcPromise(_0x8471('0x1a'),_[_0x8471('0x18')](_0xec8132[_0x8471('0x14')],_0xec8132[_0x8471('0x19')]))[_0x8471('0x15')](respondWithResult(_0x17c588,null))['catch'](handleError(_0x17c588,null));};exports[_0x8471('0x1b')]=function(_0x185a3e,_0x4e7f40){return respondWithRpcPromise(_0x8471('0x1c'),_0x185a3e[_0x8471('0x14')])['then'](respondWithResult(_0x4e7f40,null))[_0x8471('0xb')](handleError(_0x4e7f40,null));};exports[_0x8471('0x1d')]=function(_0x13c2a6,_0x15c753){return respondWithRpcPromise('VoiceQueues',_0x13c2a6[_0x8471('0x14')])['then'](findById(_0x13c2a6[_0x8471('0x19')]['id']))[_0x8471('0x15')](respondWithResult(_0x15c753,null))[_0x8471('0xb')](handleError(_0x15c753,null));};exports[_0x8471('0x1e')]=function(_0x4e3ac7,_0x38655d){return respondWithRpcPromise(_0x8471('0x1f'),_['merge'](_0x4e3ac7[_0x8471('0x14')],_0x4e3ac7[_0x8471('0x19')]))[_0x8471('0x15')](respondWithResult(_0x38655d,null))['catch'](handleError(_0x38655d,null));};exports[_0x8471('0x20')]=function(_0x386e7b,_0x8f0d52){return respondWithRpcPromise('VoiceQueuesChannels',_0x386e7b[_0x8471('0x14')])[_0x8471('0x15')](respondWithResult(_0x8f0d52,null))[_0x8471('0xb')](handleError(_0x8f0d52,null));};exports[_0x8471('0x21')]=function(_0x410df0,_0x50336a){return respondWithRpcPromise(_0x8471('0x22'),_[_0x8471('0x18')](_0x410df0[_0x8471('0x14')],_0x410df0[_0x8471('0x19')]))[_0x8471('0x15')](respondWithResult(_0x50336a,null))[_0x8471('0xb')](handleError(_0x50336a,null));};exports[_0x8471('0x23')]=function(_0x5ec9a4,_0x21384c){return respondWithRpcPromise(_0x8471('0x24'),_[_0x8471('0x18')](_0x5ec9a4['query'],_0x5ec9a4[_0x8471('0x19')]))[_0x8471('0x15')](respondWithResult(_0x21384c,null))['catch'](handleError(_0x21384c,null));};exports[_0x8471('0x25')]=function(_0x4b8795,_0x42fe6f){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x8471('0x18')](_0x4b8795[_0x8471('0x14')],_0x4b8795[_0x8471('0x19')]))[_0x8471('0x15')](respondWithResult(_0x42fe6f,null))['catch'](handleError(_0x42fe6f,null));};exports[_0x8471('0x26')]=function(_0x1e6d41,_0x5d8bd7){return respondWithRpcPromise(_0x8471('0x27'),_0x1e6d41['query'])[_0x8471('0x15')](respondWithResult(_0x5d8bd7,null))[_0x8471('0xb')](handleError(_0x5d8bd7,null));};exports[_0x8471('0x28')]=function(_0x30e52c,_0x2e1e40){return respondWithRpcPromise('OutboundChannels',_0x30e52c['query'])[_0x8471('0x15')](respondWithResult(_0x2e1e40,null))[_0x8471('0xb')](handleError(_0x2e1e40,null));};exports[_0x8471('0x29')]=function(_0x46bb8b,_0x482882){var _0x4c7279;return respondWithRpcPromise('Agents',_0x46bb8b['query'])[_0x8471('0x15')](function(_0x9857a9){_0x4c7279=_0x9857a9;return respondWithRpcPromise(_0x8471('0x2a'),_0x46bb8b[_0x8471('0x14')],routingClient);})['then'](function(_0x355e59){return _[_0x8471('0x18')]({},_0x355e59,_0x4c7279);})[_0x8471('0x15')](respondWithResult(_0x482882,null))[_0x8471('0xb')](handleError(_0x482882,null));};exports[_0x8471('0x2b')]=function(_0x4a8e80,_0x4851ef){if(_0x4a8e80[_0x8471('0x2c')]&&_0x4a8e80[_0x8471('0x2c')]['interaction']&&_0x4a8e80[_0x8471('0x2d')]&&_0x4a8e80['user'][_0x8471('0x2e')]){for(var _0x4fad42 in _0x4a8e80[_0x8471('0x2c')][_0x8471('0x2f')]){if(_0x4a8e80[_0x8471('0x2c')][_0x8471('0x2f')][_0x8471('0x30')](_0x4fad42)){db['MemberReport'][_0x8471('0x31')]({'where':{'channel':_0x4fad42,'membername':_0x4a8e80[_0x8471('0x2d')]['name'],'type':_0x8471('0x32'),'exitAt':null,'uniqueid':_0x4a8e80['body'][_0x8471('0x2f')][_0x4fad42]&&_0x4a8e80['body'][_0x8471('0x2f')][_0x4fad42]['length']?{'$notIn':_0x4a8e80[_0x8471('0x2c')][_0x8471('0x2f')][_0x4fad42]}:{'$ne':null}}})[_0x8471('0x15')](function(_0x544f97){var _0x25aad6=moment()[_0x8471('0x33')](_0x8471('0x34'));for(var _0x4724d3=0x0,_0x2e8e7b=_0x544f97[_0x8471('0x35')];_0x4724d3<_0x2e8e7b;_0x4724d3+=0x1){_0x544f97[_0x4724d3]['updateAttributes']({'exitAt':_0x25aad6});}});for(var _0xa20ca5=0x0;_0xa20ca5<_0x4a8e80[_0x8471('0x2c')][_0x8471('0x2f')][_0x4fad42][_0x8471('0x35')];_0xa20ca5+=0x1){db[_0x8471('0x36')][_0x8471('0x37')]({'where':{'channel':_0x4fad42,'membername':_0x4a8e80[_0x8471('0x2d')][_0x8471('0x2e')],'type':_0x8471('0x32'),'uniqueid':_0x4a8e80[_0x8471('0x2c')]['interaction'][_0x4fad42][_0xa20ca5],'exitAt':null},'defaults':{'channel':_0x4fad42,'membername':_0x4a8e80[_0x8471('0x2d')][_0x8471('0x2e')],'interface':_[_0x8471('0x10')](_0x4a8e80[_0x8471('0x2d')]['interface'])?util['format'](_0x8471('0x38'),_0x4a8e80[_0x8471('0x2d')][_0x8471('0x2e')]):_0x4a8e80[_0x8471('0x2d')][_0x8471('0x39')],'type':_0x8471('0x32'),'enterAt':moment()[_0x8471('0x33')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x8471('0x3a'),'internal':_0x4a8e80[_0x8471('0x2d')][_0x8471('0x3b')],'uniqueid':_0x4a8e80['body'][_0x8471('0x2f')][_0x4fad42][_0xa20ca5]}});}}}}return respondWithRpcPromise(_0x8471('0x3c'),{'id':_0x4a8e80['params']['id'],'capacity':_0x4a8e80[_0x8471('0x2c')][_0x8471('0x3d')]},routingClient)['then'](respondWithResult(_0x4851ef,null))[_0x8471('0xb')](handleError(_0x4851ef,null));};exports[_0x8471('0x3e')]=function(_0x19d4ed,_0x54098f){return respondWithRpcPromise(_0x8471('0x3f'),_0x19d4ed[_0x8471('0x14')])[_0x8471('0x15')](respondWithResult(_0x54098f,null))['catch'](handleError(_0x54098f,null));};exports[_0x8471('0x40')]=function(_0x295454,_0x5c3233){return respondWithRpcPromise(_0x8471('0x41'),_0x295454[_0x8471('0x14')])[_0x8471('0x15')](respondWithResult(_0x5c3233,null))[_0x8471('0xb')](handleError(_0x5c3233,null));};exports['campaigns']=function(_0x1614ea,_0x1ce2f3){return respondWithRpcPromise(_0x8471('0x42'),_0x1614ea[_0x8471('0x14')])[_0x8471('0x15')](respondWithResult(_0x1ce2f3,null))[_0x8471('0xb')](handleError(_0x1ce2f3,null));};exports[_0x8471('0x43')]=function(_0x1772de,_0x4ff18f){return respondWithRpcPromise('ChatQueues',_0x1772de[_0x8471('0x14')],routingClient)['then'](respondWithResult(_0x4ff18f,null))[_0x8471('0xb')](handleError(_0x4ff18f,null));};exports[_0x8471('0x44')]=function(_0x325ae4,_0x1cde89){return respondWithRpcPromise(_0x8471('0x45'),_0x325ae4[_0x8471('0x14')],routingClient)[_0x8471('0x15')](findById(_0x325ae4[_0x8471('0x19')]['id']))['then'](respondWithResult(_0x1cde89,null))['catch'](handleError(_0x1cde89,null));};exports[_0x8471('0x46')]=function(_0x4daa7c,_0xeb2cf5){return respondWithRpcPromise(_0x8471('0x47'),_0x4daa7c[_0x8471('0x14')],routingClient)[_0x8471('0x15')](respondWithResult(_0xeb2cf5,null))[_0x8471('0xb')](handleError(_0xeb2cf5,null));};exports['showMailQueues']=function(_0x1ad8bc,_0x27e4cd){return respondWithRpcPromise('MailQueues',_0x1ad8bc[_0x8471('0x14')],routingClient)[_0x8471('0x15')](findById(_0x1ad8bc[_0x8471('0x19')]['id']))['then'](respondWithResult(_0x27e4cd,null))[_0x8471('0xb')](handleError(_0x27e4cd,null));};exports[_0x8471('0x48')]=function(_0x19a412,_0x55f764){return respondWithRpcPromise(_0x8471('0x49'),_0x19a412[_0x8471('0x14')],mailClient)[_0x8471('0x15')](respondWithResult(_0x55f764,null))[_0x8471('0xb')](handleError(_0x55f764,null));};exports[_0x8471('0x4a')]=function(_0x4378f4,_0x26066c){return respondWithRpcPromise(_0x8471('0x4b'),_0x4378f4[_0x8471('0x14')],routingClient)[_0x8471('0x15')](respondWithResult(_0x26066c,null))[_0x8471('0xb')](handleError(_0x26066c,null));};exports[_0x8471('0x4c')]=function(_0x402a67,_0x13027a){return respondWithRpcPromise('OpenchannelQueues',_0x402a67[_0x8471('0x14')],routingClient)[_0x8471('0x15')](findById(_0x402a67[_0x8471('0x19')]['id']))[_0x8471('0x15')](respondWithResult(_0x13027a,null))[_0x8471('0xb')](handleError(_0x13027a,null));};exports['smsQueues']=function(_0xb50e9f,_0x378ad9){return respondWithRpcPromise(_0x8471('0x4d'),_0xb50e9f[_0x8471('0x14')],routingClient)[_0x8471('0x15')](respondWithResult(_0x378ad9,null))[_0x8471('0xb')](handleError(_0x378ad9,null));};exports[_0x8471('0x4e')]=function(_0x31550e,_0x3e566e){return respondWithRpcPromise(_0x8471('0x4d'),_0x31550e[_0x8471('0x14')],routingClient)[_0x8471('0x15')](findById(_0x31550e['params']['id']))[_0x8471('0x15')](respondWithResult(_0x3e566e,null))[_0x8471('0xb')](handleError(_0x3e566e,null));};exports[_0x8471('0x4f')]=function(_0xcc5cc7,_0x43168f){return respondWithRpcPromise(_0x8471('0x50'),_0xcc5cc7[_0x8471('0x14')],routingClient)[_0x8471('0x15')](respondWithResult(_0x43168f,null))[_0x8471('0xb')](handleError(_0x43168f,null));};exports['showWhatsappQueues']=function(_0x3122a6,_0x101968){return respondWithRpcPromise(_0x8471('0x50'),_0x3122a6[_0x8471('0x14')],routingClient)[_0x8471('0x15')](findById(_0x3122a6['params']['id']))['then'](respondWithResult(_0x101968,null))[_0x8471('0xb')](handleError(_0x101968,null));};exports[_0x8471('0x51')]=function(_0x57b8ab,_0x50199e){return respondWithRpcPromise(_0x8471('0x52'),_0x57b8ab['query'],routingClient)[_0x8471('0x15')](respondWithResult(_0x50199e,null))['catch'](handleError(_0x50199e,null));};exports[_0x8471('0x53')]=function(_0x92197c,_0x3b9ca6){return respondWithRpcPromise(_0x8471('0x52'),_0x92197c[_0x8471('0x14')],routingClient)['then'](findById(_0x92197c['params']['id']))[_0x8471('0x15')](respondWithResult(_0x3b9ca6,null))[_0x8471('0xb')](handleError(_0x3b9ca6,null));};exports[_0x8471('0x54')]=function(_0x56cd88,_0x45a179){return respondWithRpcPromise(_0x8471('0x55'),_0x56cd88['query'])[_0x8471('0x15')](respondWithResult(_0x45a179,null))[_0x8471('0xb')](handleError(_0x45a179,null));};exports[_0x8471('0x56')]=function(_0x3fe381,_0x129f0e){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x3fe381['query'],routingClient)['then'](respondWithResult(_0x129f0e,null))[_0x8471('0xb')](handleError(_0x129f0e,null));};exports['mailQueuesWaitingInteractions']=function(_0x8fb3fa,_0x4f1c8d){return respondWithRpcPromise(_0x8471('0x57'),_0x8fb3fa[_0x8471('0x14')],routingClient)[_0x8471('0x15')](respondWithResult(_0x4f1c8d,null))[_0x8471('0xb')](handleError(_0x4f1c8d,null));};exports[_0x8471('0x58')]=function(_0xa005ef,_0x565ebd){return respondWithRpcPromise(_0x8471('0x59'),_0xa005ef[_0x8471('0x14')],routingClient)[_0x8471('0x15')](respondWithResult(_0x565ebd,null))[_0x8471('0xb')](handleError(_0x565ebd,null));};exports[_0x8471('0x5a')]=function(_0x135e92,_0x18e81a){return respondWithRpcPromise(_0x8471('0x59'),_0x135e92[_0x8471('0x14')],routingClient)['then'](function(_0x1dde2d){if(_0x135e92[_0x8471('0x14')][_0x8471('0x5b')]!==undefined){var _0x3d099c=_(_0x1dde2d[_0x8471('0x11')])[_0x8471('0x5c')]([_0x135e92[_0x8471('0x14')][_0x8471('0x5b')],_0x135e92[_0x8471('0x19')]['id']])[_0x8471('0x5d')]('queue_id')['uniq']()['value']();return _0x1dde2d[_0x8471('0x11')][_0x8471('0x5c')](function(_0x289a1b){return _0x3d099c[_0x8471('0x5e')](_0x289a1b[_0x8471('0x5f')])>-0x1;});}else{return _0x1dde2d[_0x8471('0x11')][_0x8471('0x5c')](function(_0x1468a3){return _0x1468a3[_0x8471('0x5f')]===parseInt(_0x135e92[_0x8471('0x19')]['id']);});}})[_0x8471('0x15')](respondWithResult(_0x18e81a,null))['catch'](handleError(_0x18e81a,null));};exports['smsQueuesWaitingInteractions']=function(_0x34d752,_0x1dc54e){return respondWithRpcPromise(_0x8471('0x60'),_0x34d752[_0x8471('0x14')],routingClient)['then'](respondWithResult(_0x1dc54e,null))['catch'](handleError(_0x1dc54e,null));};exports[_0x8471('0x61')]=function(_0xb3c28,_0x5620fb){return respondWithRpcPromise(_0x8471('0x62'),_0xb3c28[_0x8471('0x14')],routingClient)[_0x8471('0x15')](respondWithResult(_0x5620fb,null))[_0x8471('0xb')](handleError(_0x5620fb,null));};exports[_0x8471('0x63')]=function(_0x1c61f1,_0x22d20a){return respondWithRpcPromise(_0x8471('0x64'),_0x1c61f1[_0x8471('0x14')],routingClient)[_0x8471('0x15')](respondWithResult(_0x22d20a,null))[_0x8471('0xb')](handleError(_0x22d20a,null));};exports['queueNotify']=function(_0x2493e1){return function(_0x101b9d,_0x52a367){var _0x4e1ec4,_0x260826;var _0x4cf6a9=_['capitalize'](_0x2493e1);var _0x1b5ec0=_0x2493e1===_0x8471('0x65')?_0x8471('0x66'):_0x8471('0x67');return db[_0x4cf6a9+_0x8471('0x68')][_0x8471('0x69')]({'raw':!![],'where':{'id':_0x101b9d['params']['id']}})['then'](function(_0x5d9914){if(_[_0x8471('0x10')](_0x5d9914)){throw new Error(_0x4cf6a9+_0x8471('0x6a'));}_0x4e1ec4=_0x5d9914;return db[_0x4cf6a9+'Message'][_0x8471('0x69')]({'where':{'id':_0x101b9d[_0x8471('0x2c')]['messageId']},'include':[{'model':db[_0x4cf6a9+_0x8471('0x6b')],'as':'Interaction'},{'model':db[_0x4cf6a9+_0x1b5ec0],'as':_0x8471('0x67')}]});})['then'](function(_0x122430){if(_['isNil'](_0x122430)){throw new Error(_0x4cf6a9+_0x8471('0x6c'));}_0x260826=_0x122430;return _0x122430[_0x8471('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8471('0x15')](function(){var _0x3ac332={'uniqueid':_0x2493e1+'.'+_0x260826['id']+'.'+_0x260826[_0x8471('0x6b')]['id'],'FromUserId':_0x101b9d[_0x8471('0x2d')]['id'],'type':'queue'};_0x3ac332[_0x4cf6a9+_0x8471('0x6e')]=_0x260826['id'];_0x3ac332[_0x4cf6a9+'InteractionId']=_0x260826[_0x8471('0x6b')]['id'];_0x3ac332[_0x8471('0x6f')+_0x4cf6a9+_0x1b5ec0+'Id']=_0x260826[_0x8471('0x67')]['id'];_0x3ac332['To'+_0x4cf6a9+_0x8471('0x70')]=_0x4e1ec4['id'];return db[_0x4cf6a9+_0x8471('0x71')]['create'](_0x3ac332);})['then'](function(){return respondWithRpcPromise(_0x8471('0x72'),{'channel':_0x2493e1,'interaction':_0x260826[_0x8471('0x6b')],'message':_0x260826,'account':_0x260826[_0x8471('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8471('0x73'),'appdata':_0x4e1ec4[_0x8471('0x2e')]+','+(_0x260826[_0x8471('0x67')][_0x8471('0x74')]||0x12c),'interval':_0x8471('0x75')}]},routingClient);})['then'](respondWithResult(_0x52a367,null))[_0x8471('0xb')](handleError(_0x52a367,null));};};exports[_0x8471('0x76')]=function(_0x41d14b,_0x546c46){var _0x342ea3,_0x2321e1;if(_[_0x8471('0x10')](_0x41d14b[_0x8471('0x2c')]['channel'])){throw new Error(_0x8471('0x77'));}var _0x3baa7a=_0x41d14b[_0x8471('0x2c')][_0x8471('0x78')];var _0x4f670b=_[_0x8471('0x79')](_0x3baa7a);var _0x2a89d0=_0x3baa7a===_0x8471('0x65')?_0x8471('0x66'):_0x8471('0x67');return db[_0x8471('0x7a')]['findOne']({'raw':!![],'where':{'id':_0x41d14b[_0x8471('0x19')]['id'],'role':_0x8471('0x3a')}})[_0x8471('0x15')](function(_0x514260){if(_[_0x8471('0x10')](_0x514260)){throw new Error(_0x8471('0x7b'));}_0x342ea3=_0x514260;return db[_0x4f670b+_0x8471('0x7c')][_0x8471('0x69')]({'where':{'id':_0x41d14b[_0x8471('0x2c')][_0x8471('0x7d')]},'include':[{'model':db[_0x4f670b+'Interaction'],'as':_0x8471('0x6b')},{'model':db[_0x4f670b+_0x2a89d0],'as':'Account'}]});})['then'](function(_0x4f3ef3){if(_[_0x8471('0x10')](_0x4f3ef3)){throw new Error(_0x4f670b+_0x8471('0x6c'));}_0x2321e1=_0x4f3ef3;return _0x4f3ef3[_0x8471('0x6d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8471('0x15')](function(){var _0x269651={'uniqueid':_0x3baa7a+'.'+_0x2321e1['id']+'.'+_0x2321e1[_0x8471('0x6b')]['id'],'FromUserId':_0x41d14b['user']['id'],'type':_0x8471('0x73'),'ToUserId':_0x342ea3['id']};_0x269651[_0x4f670b+_0x8471('0x6e')]=_0x2321e1['id'];_0x269651[_0x4f670b+_0x8471('0x7e')]=_0x2321e1[_0x8471('0x6b')]['id'];_0x269651[_0x8471('0x6f')+_0x4f670b+_0x2a89d0+'Id']=_0x2321e1[_0x8471('0x67')]['id'];return db[_0x4f670b+_0x8471('0x71')][_0x8471('0x7f')](_0x269651);})[_0x8471('0x15')](function(){return respondWithRpcPromise(_0x8471('0x72'),{'channel':_0x3baa7a,'interaction':_0x2321e1[_0x8471('0x6b')],'message':_0x2321e1,'account':_0x2321e1[_0x8471('0x67')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8471('0x3a'),'appdata':_0x342ea3[_0x8471('0x2e')]+','+(_0x2321e1['Account'][_0x8471('0x80')]||0x12c),'interval':_0x8471('0x75')}]},routingClient);})[_0x8471('0x15')](respondWithResult(_0x546c46,null))[_0x8471('0xb')](handleError(_0x546c46,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 1d2f229..da8960a 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 _0xd374=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','get','/:id','show','/:id/run','run','put','delete','destroy','exports','multer'];(function(_0x4d199d,_0x308fdb){var _0x4005b5=function(_0x3de0a6){while(--_0x3de0a6){_0x4d199d['push'](_0x4d199d['shift']());}};_0x4005b5(++_0x308fdb);}(_0xd374,0x12b));var _0x4d37=function(_0x5824f4,_0x589538){_0x5824f4=_0x5824f4-0x0;var _0x1b800f=_0xd374[_0x5824f4];return _0x1b800f;};'use strict';var multer=require(_0x4d37('0x0'));var util=require('util');var path=require(_0x4d37('0x1'));var timeout=require(_0x4d37('0x2'));var express=require(_0x4d37('0x3'));var router=express[_0x4d37('0x4')]();var auth=require(_0x4d37('0x5'));var interaction=require(_0x4d37('0x6'));var config=require(_0x4d37('0x7'));var controller=require(_0x4d37('0x8'));router['get']('/',auth[_0x4d37('0x9')](),controller[_0x4d37('0xa')]);router[_0x4d37('0xb')](_0x4d37('0xc'),auth['isAuthenticated'](),controller[_0x4d37('0xd')]);router[_0x4d37('0xb')](_0x4d37('0xe'),auth[_0x4d37('0x9')](),controller[_0x4d37('0xf')]);router['post']('/',auth[_0x4d37('0x9')](),controller['create']);router[_0x4d37('0x10')](_0x4d37('0xc'),auth[_0x4d37('0x9')](),controller['update']);router[_0x4d37('0x11')]('/:id',auth[_0x4d37('0x9')](),controller[_0x4d37('0x12')]);module[_0x4d37('0x13')]=router; \ No newline at end of file +var _0x00b6=['show','/:id/run','run','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x00b6,0xee));var _0x600b=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0x00b6[_0x62c958];return _0x57ec61;};'use strict';var multer=require(_0x600b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x600b('0x1'));var express=require(_0x600b('0x2'));var router=express['Router']();var auth=require(_0x600b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x600b('0x4'));var controller=require(_0x600b('0x5'));router[_0x600b('0x6')]('/',auth[_0x600b('0x7')](),controller['index']);router[_0x600b('0x6')](_0x600b('0x8'),auth[_0x600b('0x7')](),controller[_0x600b('0x9')]);router[_0x600b('0x6')](_0x600b('0xa'),auth[_0x600b('0x7')](),controller[_0x600b('0xb')]);router[_0x600b('0xc')]('/',auth['isAuthenticated'](),controller[_0x600b('0xd')]);router[_0x600b('0xe')](_0x600b('0x8'),auth[_0x600b('0x7')](),controller[_0x600b('0xf')]);router[_0x600b('0x10')](_0x600b('0x8'),auth['isAuthenticated'](),controller[_0x600b('0x11')]);module[_0x600b('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index d52fe64..29f50a5 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 _0x39d9=['years','months','days','hours','minutes','csv','pdf','custom','default','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x39d9,0x17f));var _0x939d=function(_0x197ee2,_0x241000){_0x197ee2=_0x197ee2-0x0;var _0x4cc669=_0x39d9[_0x197ee2];return _0x4cc669;};'use strict';var Sequelize=require(_0x939d('0x0'));module[_0x939d('0x1')]={'name':{'type':Sequelize[_0x939d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x939d('0x2')]},'active':{'type':Sequelize[_0x939d('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x939d('0x2')],'allowNull':![],'defaultValue':_0x939d('0x4')},'startAt':{'type':Sequelize[_0x939d('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x939d('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x939d('0x7')](_0x939d('0x8'),'quarters',_0x939d('0x9'),'weeks',_0x939d('0xa'),_0x939d('0xb'),_0x939d('0xc')),'allowNull':![],'defaultValue':_0x939d('0xa')},'output':{'type':Sequelize[_0x939d('0x7')](_0x939d('0xd'),_0x939d('0xe'),'xlsx'),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x939d('0x7')](_0x939d('0xf'),_0x939d('0x10')),'allowNull':![],'defaultValue':_0x939d('0xf')},'sendMail':{'type':Sequelize[_0x939d('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x939d('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x938d=['pdf','xlsx','default','custom','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','quarters','months','weeks','days','hours','minutes','csv'];(function(_0x5263a5,_0x44767a){var _0x1ac21a=function(_0x1000f6){while(--_0x1000f6){_0x5263a5['push'](_0x5263a5['shift']());}};_0x1ac21a(++_0x44767a);}(_0x938d,0x122));var _0xd938=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x938d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd938('0x0'));module[_0xd938('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd938('0x2')]},'active':{'type':Sequelize[_0xd938('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xd938('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xd938('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xd938('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xd938('0x6')]('years',_0xd938('0x7'),_0xd938('0x8'),_0xd938('0x9'),_0xd938('0xa'),_0xd938('0xb'),_0xd938('0xc')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xd938('0x6')](_0xd938('0xd'),_0xd938('0xe'),_0xd938('0xf')),'allowNull':![],'defaultValue':_0xd938('0xd')},'type':{'type':Sequelize[_0xd938('0x6')]('custom',_0xd938('0x10')),'allowNull':![],'defaultValue':_0xd938('0x11')},'sendMail':{'type':Sequelize[_0xd938('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xd938('0x2')]},'cc':{'type':Sequelize[_0xd938('0x12')]},'bcc':{'type':Sequelize[_0xd938('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xd938('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 edc1277..4172d92 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 _0x6c91=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','include','findAll','rows','intersection','includeAll','merge','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Scheduler','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','end','error','name','send','index','Schedule','rawAttributes','fieldName','type','key','model','map','query','keys','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6c91,0x7a));var _0x16c9=function(_0x50ce90,_0x134a0f){_0x50ce90=_0x50ce90-0x0;var _0x212fc9=_0x6c91[_0x50ce90];return _0x212fc9;};'use strict';var pdf=require(_0x16c9('0x0'));var emlformat=require(_0x16c9('0x1'));var rimraf=require(_0x16c9('0x2'));var zipdir=require(_0x16c9('0x3'));var jsonpatch=require(_0x16c9('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x16c9('0x5'));var Mustache=require(_0x16c9('0x6'));var util=require('util');var path=require(_0x16c9('0x7'));var sox=require(_0x16c9('0x8'));var csv=require(_0x16c9('0x9'));var ejs=require(_0x16c9('0xa'));var fs=require('fs');var _=require(_0x16c9('0xb'));var squel=require('squel');var crypto=require(_0x16c9('0xc'));var jsforce=require(_0x16c9('0xd'));var deskjs=require(_0x16c9('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x16c9('0xf'));var Redis=require(_0x16c9('0x10'));var authService=require(_0x16c9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x16c9('0x12'));var hardwareService=require(_0x16c9('0x13'));var logger=require(_0x16c9('0x14'))('api');var utils=require(_0x16c9('0x15'));var config=require(_0x16c9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x16c9('0x17'))['db'];function respondWithStatusCode(_0x25250f,_0x3e2c5c){_0x3e2c5c=_0x3e2c5c||0xcc;return function(_0x378b24){if(_0x378b24){return _0x25250f[_0x16c9('0x18')](_0x3e2c5c);}return _0x25250f[_0x16c9('0x19')](_0x3e2c5c)['end']();};}function respondWithResult(_0x217536,_0x2843b7){_0x2843b7=_0x2843b7||0xc8;return function(_0x15d202){if(_0x15d202){return _0x217536[_0x16c9('0x19')](_0x2843b7)[_0x16c9('0x1a')](_0x15d202);}};}function respondWithFilteredResult(_0x6f2a1d,_0x46d778){return function(_0x4a1009){if(_0x4a1009){var _0x395cb5=_0x4a1009[_0x16c9('0x1b')],_0x2bb2f2=_0x46d778[_0x16c9('0x1c')],_0x6187da=_0x46d778['offset']+_0x46d778[_0x16c9('0x1d')],_0x37157c;if(_0x6187da>=_0x395cb5){_0x6187da=_0x395cb5;_0x37157c=0xc8;}else{_0x37157c=0xce;}_0x6f2a1d[_0x16c9('0x19')](_0x37157c);return _0x6f2a1d[_0x16c9('0x1e')](_0x16c9('0x1f'),_0x2bb2f2+'-'+_0x6187da+'/'+_0x395cb5)[_0x16c9('0x1a')](_0x4a1009);}return null;};}function patchUpdates(_0x3adb5a){return function(_0xf7059a){try{jsonpatch[_0x16c9('0x20')](_0xf7059a,_0x3adb5a,!![]);}catch(_0x150aec){return BPromise[_0x16c9('0x21')](_0x150aec);}return _0xf7059a['save']();};}function saveUpdates(_0xde32b1,_0x1a6c56){return function(_0x5dbf1b){if(_0x5dbf1b){return _0x5dbf1b[_0x16c9('0x22')](_0xde32b1)['then'](function(_0x4f3123){return _0x4f3123;});}return null;};}function removeEntity(_0x11ee75,_0x6077f5){return function(_0x1caeaa){if(_0x1caeaa){return _0x1caeaa[_0x16c9('0x23')]()['then'](function(){var _0x19d13b=_0x1caeaa['get']({'plain':!![]});var _0x6185e3='Scheduler';return db['UserProfileResource']['destroy']({'where':{'type':_0x6185e3,'resourceId':_0x19d13b['id']}})[_0x16c9('0x24')](function(){return _0x1caeaa;});})[_0x16c9('0x24')](function(){_0x11ee75[_0x16c9('0x19')](0xcc)[_0x16c9('0x25')]();});}};}function handleEntityNotFound(_0x5eaa42,_0x519c35){return function(_0x239f94){if(!_0x239f94){_0x5eaa42[_0x16c9('0x18')](0x194);}return _0x239f94;};}function handleError(_0x12ee90,_0xd4abe6){_0xd4abe6=_0xd4abe6||0x1f4;return function(_0xcef46e){logger[_0x16c9('0x26')](_0xcef46e['stack']);if(_0xcef46e[_0x16c9('0x27')]){delete _0xcef46e[_0x16c9('0x27')];}_0x12ee90[_0x16c9('0x19')](_0xd4abe6)[_0x16c9('0x28')](_0xcef46e);};}exports[_0x16c9('0x29')]=function(_0x110d72,_0x197c6e){var _0x52a174={},_0x15b7ba={},_0x14964f={'count':0x0,'rows':[]};var _0x3d8f63=_['map'](db[_0x16c9('0x2a')][_0x16c9('0x2b')],function(_0x3a9760){return{'name':_0x3a9760[_0x16c9('0x2c')],'type':_0x3a9760[_0x16c9('0x2d')][_0x16c9('0x2e')]};});_0x15b7ba[_0x16c9('0x2f')]=_[_0x16c9('0x30')](_0x3d8f63,'name');_0x15b7ba[_0x16c9('0x31')]=_[_0x16c9('0x32')](_0x110d72[_0x16c9('0x31')]);_0x15b7ba[_0x16c9('0x33')]=_['intersection'](_0x15b7ba['model'],_0x15b7ba['query']);_0x52a174[_0x16c9('0x34')]=_['intersection'](_0x15b7ba[_0x16c9('0x2f')],qs[_0x16c9('0x35')](_0x110d72['query'][_0x16c9('0x35')]));_0x52a174['attributes']=_0x52a174[_0x16c9('0x34')][_0x16c9('0x36')]?_0x52a174[_0x16c9('0x34')]:_0x15b7ba[_0x16c9('0x2f')];if(!_0x110d72['query'][_0x16c9('0x37')](_0x16c9('0x38'))){_0x52a174[_0x16c9('0x1d')]=qs[_0x16c9('0x1d')](_0x110d72[_0x16c9('0x31')]['limit']);_0x52a174[_0x16c9('0x1c')]=qs['offset'](_0x110d72[_0x16c9('0x31')][_0x16c9('0x1c')]);}_0x52a174[_0x16c9('0x39')]=qs[_0x16c9('0x3a')](_0x110d72[_0x16c9('0x31')]['sort']);_0x52a174[_0x16c9('0x3b')]=qs[_0x16c9('0x33')](_[_0x16c9('0x3c')](_0x110d72[_0x16c9('0x31')],_0x15b7ba[_0x16c9('0x33')]),_0x3d8f63);if(_0x110d72[_0x16c9('0x31')][_0x16c9('0x3d')]){_0x52a174['where']=_['merge'](_0x52a174['where'],{'$or':_[_0x16c9('0x30')](_0x3d8f63,function(_0x2a60e3){if(_0x2a60e3['type']!==_0x16c9('0x3e')){var _0x354656={};_0x354656[_0x2a60e3[_0x16c9('0x27')]]={'$like':'%'+_0x110d72[_0x16c9('0x31')][_0x16c9('0x3d')]+'%'};return _0x354656;}})});}_0x52a174=_['merge']({},_0x52a174,_0x110d72['options']);var _0x66f72d={'where':_0x52a174['where']};return db[_0x16c9('0x2a')][_0x16c9('0x1b')](_0x66f72d)[_0x16c9('0x24')](function(_0x13f6e1){_0x14964f[_0x16c9('0x1b')]=_0x13f6e1;if(_0x110d72[_0x16c9('0x31')]['includeAll']){_0x52a174[_0x16c9('0x3f')]=[{'all':!![]}];}return db[_0x16c9('0x2a')][_0x16c9('0x40')](_0x52a174);})[_0x16c9('0x24')](function(_0x37eb5c){_0x14964f[_0x16c9('0x41')]=_0x37eb5c;return _0x14964f;})[_0x16c9('0x24')](respondWithFilteredResult(_0x197c6e,_0x52a174))['catch'](handleError(_0x197c6e,null));};exports['show']=function(_0x348d78,_0x2281b8){var _0x46fc8f={'raw':![],'where':{'id':_0x348d78['params']['id']}},_0x3d38dd={};_0x3d38dd[_0x16c9('0x2f')]=_['keys'](db[_0x16c9('0x2a')][_0x16c9('0x2b')]);_0x3d38dd[_0x16c9('0x31')]=_[_0x16c9('0x32')](_0x348d78[_0x16c9('0x31')]);_0x3d38dd[_0x16c9('0x33')]=_[_0x16c9('0x42')](_0x3d38dd[_0x16c9('0x2f')],_0x3d38dd[_0x16c9('0x31')]);_0x46fc8f['attributes']=_[_0x16c9('0x42')](_0x3d38dd['model'],qs[_0x16c9('0x35')](_0x348d78[_0x16c9('0x31')][_0x16c9('0x35')]));_0x46fc8f['attributes']=_0x46fc8f['attributes'][_0x16c9('0x36')]?_0x46fc8f['attributes']:_0x3d38dd['model'];if(_0x348d78[_0x16c9('0x31')][_0x16c9('0x43')]){_0x46fc8f[_0x16c9('0x3f')]=[{'all':!![]}];}_0x46fc8f=_[_0x16c9('0x44')]({},_0x46fc8f,_0x348d78[_0x16c9('0x45')]);return db[_0x16c9('0x2a')]['find'](_0x46fc8f)[_0x16c9('0x24')](handleEntityNotFound(_0x2281b8,null))[_0x16c9('0x24')](respondWithResult(_0x2281b8,null))['catch'](handleError(_0x2281b8,null));};exports[_0x16c9('0x46')]=function(_0x1296b5,_0x553ea7){return db[_0x16c9('0x2a')]['create'](_0x1296b5[_0x16c9('0x47')],{})['then'](function(_0xf15167){var _0x4b9ef3=_0x1296b5['user'][_0x16c9('0x48')]({'plain':!![]});if(!_0x4b9ef3)throw new Error(_0x16c9('0x49'));if(_0x4b9ef3[_0x16c9('0x4a')]===_0x16c9('0x4b')){var _0x55a9b3=_0xf15167[_0x16c9('0x48')]({'plain':!![]});var _0x271c4f=_0x16c9('0x4c');return db[_0x16c9('0x4d')][_0x16c9('0x4e')]({'where':{'name':_0x271c4f,'userProfileId':_0x4b9ef3[_0x16c9('0x4f')]},'raw':!![]})['then'](function(_0x2f0baa){if(_0x2f0baa&&_0x2f0baa[_0x16c9('0x50')]===0x0){return db[_0x16c9('0x51')][_0x16c9('0x46')]({'name':_0x55a9b3[_0x16c9('0x27')],'resourceId':_0x55a9b3['id'],'type':_0x2f0baa[_0x16c9('0x27')],'sectionId':_0x2f0baa['id']},{})[_0x16c9('0x24')](function(){return _0xf15167;});}else{return _0xf15167;}})[_0x16c9('0x52')](function(_0x380c1f){logger[_0x16c9('0x26')](_0x16c9('0x53'),_0x380c1f);throw _0x380c1f;});}return _0xf15167;})[_0x16c9('0x24')](respondWithResult(_0x553ea7,0xc9))[_0x16c9('0x52')](handleError(_0x553ea7,null));};exports[_0x16c9('0x22')]=function(_0x284be9,_0x56975e){if(_0x284be9['body']['id']){delete _0x284be9[_0x16c9('0x47')]['id'];}return db['Schedule'][_0x16c9('0x4e')]({'where':{'id':_0x284be9[_0x16c9('0x54')]['id']}})[_0x16c9('0x24')](handleEntityNotFound(_0x56975e,null))[_0x16c9('0x24')](saveUpdates(_0x284be9[_0x16c9('0x47')],null))[_0x16c9('0x24')](respondWithResult(_0x56975e,null))[_0x16c9('0x52')](handleError(_0x56975e,null));};exports[_0x16c9('0x23')]=function(_0x2cace0,_0x33f188){return db['Schedule'][_0x16c9('0x4e')]({'where':{'id':_0x2cace0[_0x16c9('0x54')]['id']}})['then'](handleEntityNotFound(_0x33f188,null))[_0x16c9('0x24')](removeEntity(_0x33f188,null))[_0x16c9('0x52')](handleError(_0x33f188,null));};exports[_0x16c9('0x55')]=function(_0x3b86c3,_0x20f1ab,_0xa84c99){var _0x391e26=require(_0x16c9('0x56'));return db[_0x16c9('0x2a')][_0x16c9('0x4e')]({'where':{'id':_0x3b86c3[_0x16c9('0x54')]['id']},'raw':!![]})[_0x16c9('0x24')](handleEntityNotFound(_0x20f1ab,null))[_0x16c9('0x24')](function(){_0x391e26[_0x16c9('0x55')](_0x3b86c3['params']['id']);})[_0x16c9('0x24')](respondWithStatusCode(_0x20f1ab,null))['catch'](handleError(_0x20f1ab,null));}; \ No newline at end of file +var _0x6afb=['length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','count','include','findAll','rows','show','params','keys','rawAttributes','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','run','../../config/schedule','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','set','json','save','update','then','destroy','get','Scheduler','sendStatus','error','stack','name','send','map','Schedule','fieldName','type','key','model','query','filters','intersection','attributes','fields'];(function(_0x44aadf,_0x2a08c8){var _0x1aafaa=function(_0x4cc125){while(--_0x4cc125){_0x44aadf['push'](_0x44aadf['shift']());}};_0x1aafaa(++_0x2a08c8);}(_0x6afb,0x116));var _0xb6af=function(_0x3b2e0a,_0x49a3f9){_0x3b2e0a=_0x3b2e0a-0x0;var _0x4a84bd=_0x6afb[_0x3b2e0a];return _0x4a84bd;};'use strict';var pdf=require(_0xb6af('0x0'));var emlformat=require(_0xb6af('0x1'));var rimraf=require(_0xb6af('0x2'));var zipdir=require(_0xb6af('0x3'));var jsonpatch=require(_0xb6af('0x4'));var rp=require(_0xb6af('0x5'));var moment=require('moment');var BPromise=require(_0xb6af('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb6af('0x7'));var sox=require(_0xb6af('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb6af('0x9'));var squel=require(_0xb6af('0xa'));var crypto=require(_0xb6af('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb6af('0xc'));var toCsv=require(_0xb6af('0xd'));var querystring=require('querystring');var Papa=require(_0xb6af('0xe'));var Redis=require(_0xb6af('0xf'));var authService=require(_0xb6af('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb6af('0x11'));var hardwareService=require(_0xb6af('0x12'));var logger=require('../../config/logger')(_0xb6af('0x13'));var utils=require(_0xb6af('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb6af('0x15'));var db=require(_0xb6af('0x16'))['db'];function respondWithStatusCode(_0x4f3461,_0x52c2c0){_0x52c2c0=_0x52c2c0||0xcc;return function(_0x2eba54){if(_0x2eba54){return _0x4f3461['sendStatus'](_0x52c2c0);}return _0x4f3461[_0xb6af('0x17')](_0x52c2c0)[_0xb6af('0x18')]();};}function respondWithResult(_0xd749c5,_0x5a77f5){_0x5a77f5=_0x5a77f5||0xc8;return function(_0x1653eb){if(_0x1653eb){return _0xd749c5[_0xb6af('0x17')](_0x5a77f5)['json'](_0x1653eb);}};}function respondWithFilteredResult(_0x1a88ca,_0x5affa9){return function(_0x5ce5bd){if(_0x5ce5bd){var _0xd84c74=_0x5ce5bd['count'],_0x4f7664=_0x5affa9[_0xb6af('0x19')],_0x131c01=_0x5affa9[_0xb6af('0x19')]+_0x5affa9['limit'],_0x547054;if(_0x131c01>=_0xd84c74){_0x131c01=_0xd84c74;_0x547054=0xc8;}else{_0x547054=0xce;}_0x1a88ca[_0xb6af('0x17')](_0x547054);return _0x1a88ca[_0xb6af('0x1a')]('Content-Range',_0x4f7664+'-'+_0x131c01+'/'+_0xd84c74)[_0xb6af('0x1b')](_0x5ce5bd);}return null;};}function patchUpdates(_0x51f1d1){return function(_0x366f57){try{jsonpatch['apply'](_0x366f57,_0x51f1d1,!![]);}catch(_0x271999){return BPromise['reject'](_0x271999);}return _0x366f57[_0xb6af('0x1c')]();};}function saveUpdates(_0x40836a,_0x2b118c){return function(_0x37c787){if(_0x37c787){return _0x37c787[_0xb6af('0x1d')](_0x40836a)[_0xb6af('0x1e')](function(_0x321adf){return _0x321adf;});}return null;};}function removeEntity(_0x85affe,_0x4ad367){return function(_0x203391){if(_0x203391){return _0x203391[_0xb6af('0x1f')]()[_0xb6af('0x1e')](function(){var _0x2dd743=_0x203391[_0xb6af('0x20')]({'plain':!![]});var _0x22f8f5=_0xb6af('0x21');return db['UserProfileResource'][_0xb6af('0x1f')]({'where':{'type':_0x22f8f5,'resourceId':_0x2dd743['id']}})[_0xb6af('0x1e')](function(){return _0x203391;});})[_0xb6af('0x1e')](function(){_0x85affe[_0xb6af('0x17')](0xcc)[_0xb6af('0x18')]();});}};}function handleEntityNotFound(_0x9ede71,_0x5ec162){return function(_0x4a692d){if(!_0x4a692d){_0x9ede71[_0xb6af('0x22')](0x194);}return _0x4a692d;};}function handleError(_0x3c4b56,_0x34ce68){_0x34ce68=_0x34ce68||0x1f4;return function(_0x82b1aa){logger[_0xb6af('0x23')](_0x82b1aa[_0xb6af('0x24')]);if(_0x82b1aa[_0xb6af('0x25')]){delete _0x82b1aa['name'];}_0x3c4b56[_0xb6af('0x17')](_0x34ce68)[_0xb6af('0x26')](_0x82b1aa);};}exports['index']=function(_0x2a1c41,_0x56d7d6){var _0x202056={},_0x2784b2={},_0x39d994={'count':0x0,'rows':[]};var _0x1b9407=_[_0xb6af('0x27')](db[_0xb6af('0x28')]['rawAttributes'],function(_0x407951){return{'name':_0x407951[_0xb6af('0x29')],'type':_0x407951[_0xb6af('0x2a')][_0xb6af('0x2b')]};});_0x2784b2[_0xb6af('0x2c')]=_[_0xb6af('0x27')](_0x1b9407,'name');_0x2784b2[_0xb6af('0x2d')]=_['keys'](_0x2a1c41[_0xb6af('0x2d')]);_0x2784b2[_0xb6af('0x2e')]=_[_0xb6af('0x2f')](_0x2784b2[_0xb6af('0x2c')],_0x2784b2[_0xb6af('0x2d')]);_0x202056[_0xb6af('0x30')]=_[_0xb6af('0x2f')](_0x2784b2[_0xb6af('0x2c')],qs['fields'](_0x2a1c41['query'][_0xb6af('0x31')]));_0x202056[_0xb6af('0x30')]=_0x202056[_0xb6af('0x30')][_0xb6af('0x32')]?_0x202056[_0xb6af('0x30')]:_0x2784b2['model'];if(!_0x2a1c41[_0xb6af('0x2d')][_0xb6af('0x33')]('nolimit')){_0x202056[_0xb6af('0x34')]=qs['limit'](_0x2a1c41[_0xb6af('0x2d')][_0xb6af('0x34')]);_0x202056[_0xb6af('0x19')]=qs[_0xb6af('0x19')](_0x2a1c41['query'][_0xb6af('0x19')]);}_0x202056[_0xb6af('0x35')]=qs[_0xb6af('0x36')](_0x2a1c41[_0xb6af('0x2d')]['sort']);_0x202056[_0xb6af('0x37')]=qs['filters'](_[_0xb6af('0x38')](_0x2a1c41[_0xb6af('0x2d')],_0x2784b2['filters']),_0x1b9407);if(_0x2a1c41[_0xb6af('0x2d')][_0xb6af('0x39')]){_0x202056[_0xb6af('0x37')]=_[_0xb6af('0x3a')](_0x202056[_0xb6af('0x37')],{'$or':_[_0xb6af('0x27')](_0x1b9407,function(_0x1670d2){if(_0x1670d2[_0xb6af('0x2a')]!=='VIRTUAL'){var _0x279510={};_0x279510[_0x1670d2[_0xb6af('0x25')]]={'$like':'%'+_0x2a1c41[_0xb6af('0x2d')][_0xb6af('0x39')]+'%'};return _0x279510;}})});}_0x202056=_[_0xb6af('0x3a')]({},_0x202056,_0x2a1c41['options']);var _0x3a7190={'where':_0x202056[_0xb6af('0x37')]};return db[_0xb6af('0x28')][_0xb6af('0x3b')](_0x3a7190)[_0xb6af('0x1e')](function(_0x5bb2d8){_0x39d994[_0xb6af('0x3b')]=_0x5bb2d8;if(_0x2a1c41[_0xb6af('0x2d')]['includeAll']){_0x202056[_0xb6af('0x3c')]=[{'all':!![]}];}return db[_0xb6af('0x28')][_0xb6af('0x3d')](_0x202056);})[_0xb6af('0x1e')](function(_0x41f49b){_0x39d994[_0xb6af('0x3e')]=_0x41f49b;return _0x39d994;})[_0xb6af('0x1e')](respondWithFilteredResult(_0x56d7d6,_0x202056))['catch'](handleError(_0x56d7d6,null));};exports[_0xb6af('0x3f')]=function(_0x1a0969,_0x9b5c30){var _0x33d442={'raw':![],'where':{'id':_0x1a0969[_0xb6af('0x40')]['id']}},_0x11d96c={};_0x11d96c[_0xb6af('0x2c')]=_[_0xb6af('0x41')](db[_0xb6af('0x28')][_0xb6af('0x42')]);_0x11d96c['query']=_[_0xb6af('0x41')](_0x1a0969['query']);_0x11d96c['filters']=_['intersection'](_0x11d96c[_0xb6af('0x2c')],_0x11d96c[_0xb6af('0x2d')]);_0x33d442[_0xb6af('0x30')]=_[_0xb6af('0x2f')](_0x11d96c[_0xb6af('0x2c')],qs[_0xb6af('0x31')](_0x1a0969[_0xb6af('0x2d')][_0xb6af('0x31')]));_0x33d442[_0xb6af('0x30')]=_0x33d442[_0xb6af('0x30')][_0xb6af('0x32')]?_0x33d442[_0xb6af('0x30')]:_0x11d96c[_0xb6af('0x2c')];if(_0x1a0969['query'][_0xb6af('0x43')]){_0x33d442[_0xb6af('0x3c')]=[{'all':!![]}];}_0x33d442=_[_0xb6af('0x3a')]({},_0x33d442,_0x1a0969[_0xb6af('0x44')]);return db[_0xb6af('0x28')][_0xb6af('0x45')](_0x33d442)[_0xb6af('0x1e')](handleEntityNotFound(_0x9b5c30,null))['then'](respondWithResult(_0x9b5c30,null))['catch'](handleError(_0x9b5c30,null));};exports[_0xb6af('0x46')]=function(_0x5e374b,_0x364bdd){return db[_0xb6af('0x28')]['create'](_0x5e374b[_0xb6af('0x47')],{})[_0xb6af('0x1e')](function(_0x2a599d){var _0xca41c4=_0x5e374b[_0xb6af('0x48')]['get']({'plain':!![]});if(!_0xca41c4)throw new Error(_0xb6af('0x49'));if(_0xca41c4[_0xb6af('0x4a')]===_0xb6af('0x48')){var _0x1b77c5=_0x2a599d[_0xb6af('0x20')]({'plain':!![]});var _0x2bc914=_0xb6af('0x21');return db[_0xb6af('0x4b')]['find']({'where':{'name':_0x2bc914,'userProfileId':_0xca41c4[_0xb6af('0x4c')]},'raw':!![]})[_0xb6af('0x1e')](function(_0x57b3a2){if(_0x57b3a2&&_0x57b3a2[_0xb6af('0x4d')]===0x0){return db[_0xb6af('0x4e')][_0xb6af('0x46')]({'name':_0x1b77c5['name'],'resourceId':_0x1b77c5['id'],'type':_0x57b3a2['name'],'sectionId':_0x57b3a2['id']},{})['then'](function(){return _0x2a599d;});}else{return _0x2a599d;}})[_0xb6af('0x4f')](function(_0x2c2596){logger[_0xb6af('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c2596);throw _0x2c2596;});}return _0x2a599d;})[_0xb6af('0x1e')](respondWithResult(_0x364bdd,0xc9))['catch'](handleError(_0x364bdd,null));};exports[_0xb6af('0x1d')]=function(_0x5a78da,_0x300893){if(_0x5a78da['body']['id']){delete _0x5a78da[_0xb6af('0x47')]['id'];}return db[_0xb6af('0x28')]['find']({'where':{'id':_0x5a78da[_0xb6af('0x40')]['id']}})['then'](handleEntityNotFound(_0x300893,null))[_0xb6af('0x1e')](saveUpdates(_0x5a78da[_0xb6af('0x47')],null))[_0xb6af('0x1e')](respondWithResult(_0x300893,null))['catch'](handleError(_0x300893,null));};exports[_0xb6af('0x1f')]=function(_0x483643,_0x2ab66d){return db['Schedule'][_0xb6af('0x45')]({'where':{'id':_0x483643['params']['id']}})[_0xb6af('0x1e')](handleEntityNotFound(_0x2ab66d,null))[_0xb6af('0x1e')](removeEntity(_0x2ab66d,null))[_0xb6af('0x4f')](handleError(_0x2ab66d,null));};exports[_0xb6af('0x50')]=function(_0x1d05b4,_0x5712d8,_0x264dcc){var _0x59e6b0=require(_0xb6af('0x51'));return db['Schedule'][_0xb6af('0x45')]({'where':{'id':_0x1d05b4[_0xb6af('0x40')]['id']},'raw':!![]})[_0xb6af('0x1e')](handleEntityNotFound(_0x5712d8,null))[_0xb6af('0x1e')](function(){_0x59e6b0[_0xb6af('0x50')](_0x1d05b4['params']['id']);})['then'](respondWithStatusCode(_0x5712d8,null))['catch'](handleError(_0x5712d8,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index e0dbd5c..2dd5ed2 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 _0x8932=['../../config/environment','./schedule.attributes','define','Schedule','tools_schedules','lodash','api','request-promise','path','rimraf'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8932,0xa5));var _0x2893=function(_0x55298e,_0x43c1e3){_0x55298e=_0x55298e-0x0;var _0x3aa916=_0x8932[_0x55298e];return _0x3aa916;};'use strict';var _=require(_0x2893('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2893('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2893('0x2'));var fs=require('fs');var path=require(_0x2893('0x3'));var rimraf=require(_0x2893('0x4'));var config=require(_0x2893('0x5'));var attributes=require(_0x2893('0x6'));module['exports']=function(_0x41c4a4,_0x35f842){return _0x41c4a4[_0x2893('0x7')](_0x2893('0x8'),attributes,{'tableName':_0x2893('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5b64=['rimraf','define','Schedule','tools_schedules','moment','path'];(function(_0x50d728,_0x55bb33){var _0x1043c7=function(_0x362036){while(--_0x362036){_0x50d728['push'](_0x50d728['shift']());}};_0x1043c7(++_0x55bb33);}(_0x5b64,0x14e));var _0x45b6=function(_0x285e7f,_0x234511){_0x285e7f=_0x285e7f-0x0;var _0x34e65b=_0x5b64[_0x285e7f];return _0x34e65b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x45b6('0x0'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x45b6('0x1'));var rimraf=require(_0x45b6('0x2'));var config=require('../../config/environment');var attributes=require('./schedule.attributes');module['exports']=function(_0x423bd1,_0x530fee){return _0x423bd1[_0x45b6('0x3')](_0x45b6('0x4'),attributes,{'tableName':_0x45b6('0x5'),'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 d8709d1..694f71c 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 _0x2f22=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x1233a7,_0x377b60){var _0x18e0eb=function(_0x43dfd2){while(--_0x43dfd2){_0x1233a7['push'](_0x1233a7['shift']());}};_0x18e0eb(++_0x377b60);}(_0x2f22,0xe7));var _0x22f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f22[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x22f2('0x0'));var moment=require(_0x22f2('0x1'));var BPromise=require(_0x22f2('0x2'));var rs=require(_0x22f2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x22f2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x22f2('0x5'))('rpc');var config=require(_0x22f2('0x6'));var jayson=require(_0x22f2('0x7'));var client=jayson['client'][_0x22f2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d22ba,_0x43ec6c,_0x1a5487){return new BPromise(function(_0x4f340e,_0x35d271){return client[_0x22f2('0x9')](_0x4d22ba,_0x1a5487)[_0x22f2('0xa')](function(_0x1d53a2){logger['info'](_0x22f2('0xb'),_0x43ec6c,_0x22f2('0xc'));logger[_0x22f2('0xd')](_0x22f2('0xe'),_0x43ec6c,'request\x20sent',JSON[_0x22f2('0xf')](_0x1d53a2));if(_0x1d53a2[_0x22f2('0x10')]){if(_0x1d53a2[_0x22f2('0x10')][_0x22f2('0x11')]===0x1f4){logger[_0x22f2('0x10')](_0x22f2('0xb'),_0x43ec6c,_0x1d53a2['error'][_0x22f2('0x12')]);return _0x35d271(_0x1d53a2[_0x22f2('0x10')][_0x22f2('0x12')]);}logger['error']('Schedule,\x20%s,\x20%s',_0x43ec6c,_0x1d53a2[_0x22f2('0x10')]['message']);return _0x4f340e(_0x1d53a2['error'][_0x22f2('0x12')]);}else{logger[_0x22f2('0x13')](_0x22f2('0xb'),_0x43ec6c,_0x22f2('0xc'));_0x4f340e(_0x1d53a2[_0x22f2('0x14')]['message']);}})['catch'](function(_0x4dd401){logger[_0x22f2('0x10')](_0x22f2('0xb'),_0x43ec6c,_0x4dd401);_0x35d271(_0x4dd401);});});} \ No newline at end of file +var _0x0bf5=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s','message','catch'];(function(_0x175a3d,_0x1913e0){var _0xf2d89c=function(_0x381467){while(--_0x381467){_0x175a3d['push'](_0x175a3d['shift']());}};_0xf2d89c(++_0x1913e0);}(_0x0bf5,0x1ce));var _0x50bf=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x0bf5[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x50bf('0x0'));var util=require('util');var moment=require(_0x50bf('0x1'));var BPromise=require(_0x50bf('0x2'));var rs=require(_0x50bf('0x3'));var fs=require('fs');var Redis=require(_0x50bf('0x4'));var db=require(_0x50bf('0x5'))['db'];var utils=require(_0x50bf('0x6'));var logger=require(_0x50bf('0x7'))(_0x50bf('0x8'));var config=require('../../config/environment');var jayson=require(_0x50bf('0x9'));var client=jayson[_0x50bf('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x464c30,_0xac325a,_0x545dbb){return new BPromise(function(_0x8a8232,_0x4784a1){return client[_0x50bf('0xb')](_0x464c30,_0x545dbb)[_0x50bf('0xc')](function(_0x21152c){logger['info']('Schedule,\x20%s,\x20%s',_0xac325a,_0x50bf('0xd'));logger[_0x50bf('0xe')](_0x50bf('0xf'),_0xac325a,'request\x20sent',JSON[_0x50bf('0x10')](_0x21152c));if(_0x21152c[_0x50bf('0x11')]){if(_0x21152c[_0x50bf('0x11')][_0x50bf('0x12')]===0x1f4){logger[_0x50bf('0x11')](_0x50bf('0x13'),_0xac325a,_0x21152c[_0x50bf('0x11')][_0x50bf('0x14')]);return _0x4784a1(_0x21152c[_0x50bf('0x11')][_0x50bf('0x14')]);}logger[_0x50bf('0x11')]('Schedule,\x20%s,\x20%s',_0xac325a,_0x21152c[_0x50bf('0x11')][_0x50bf('0x14')]);return _0x8a8232(_0x21152c['error']['message']);}else{logger['info']('Schedule,\x20%s,\x20%s',_0xac325a,'request\x20sent');_0x8a8232(_0x21152c['result'][_0x50bf('0x14')]);}})[_0x50bf('0x15')](function(_0x343015){logger['error'](_0x50bf('0x13'),_0xac325a,_0x343015);_0x4784a1(_0x343015);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 71e73c4..05cace0 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 _0xe58a=['../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','index','get','/describe','/:id/download','download','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x5b93d2,_0x1ca258){var _0xa8786d=function(_0x271f3b){while(--_0x271f3b){_0x5b93d2['push'](_0x5b93d2['shift']());}};_0xa8786d(++_0x1ca258);}(_0xe58a,0x19f));var _0xae58=function(_0x31dd31,_0x142a2f){_0x31dd31=_0x31dd31-0x0;var _0x4117f9=_0xe58a[_0x31dd31];return _0x4117f9;};'use strict';var multer=require(_0xae58('0x0'));var util=require(_0xae58('0x1'));var path=require(_0xae58('0x2'));var timeout=require(_0xae58('0x3'));var express=require('express');var router=express[_0xae58('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xae58('0x5'));var config=require(_0xae58('0x6'));var controller=require(_0xae58('0x7'));router['get']('/',auth[_0xae58('0x8')](),controller[_0xae58('0x9')]);router[_0xae58('0xa')](_0xae58('0xb'),auth[_0xae58('0x8')](),controller['describe']);router[_0xae58('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xae58('0xa')](_0xae58('0xc'),auth[_0xae58('0x8')](),controller[_0xae58('0xd')]);router[_0xae58('0xe')]('/',auth[_0xae58('0x8')](),controller['create']);router[_0xae58('0xf')](_0xae58('0x10'),auth[_0xae58('0x8')](),controller[_0xae58('0x11')]);router[_0xae58('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xae58('0x13')]);module[_0xae58('0x14')]=router; \ No newline at end of file +var _0x99e0=['util','connect-timeout','Router','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','download','post','create','put','delete','destroy'];(function(_0x432fa9,_0x15b0c0){var _0x42e913=function(_0x5ea140){while(--_0x5ea140){_0x432fa9['push'](_0x432fa9['shift']());}};_0x42e913(++_0x15b0c0);}(_0x99e0,0xbb));var _0x099e=function(_0x31250c,_0x31e07c){_0x31250c=_0x31250c-0x0;var _0x6ffffa=_0x99e0[_0x31250c];return _0x6ffffa;};'use strict';var multer=require('multer');var util=require(_0x099e('0x0'));var path=require('path');var timeout=require(_0x099e('0x1'));var express=require('express');var router=express[_0x099e('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x099e('0x3'));var controller=require(_0x099e('0x4'));router[_0x099e('0x5')]('/',auth[_0x099e('0x6')](),controller[_0x099e('0x7')]);router[_0x099e('0x5')](_0x099e('0x8'),auth['isAuthenticated'](),controller[_0x099e('0x9')]);router['get'](_0x099e('0xa'),auth[_0x099e('0x6')](),controller['show']);router['get']('/:id/download',auth[_0x099e('0x6')](),controller[_0x099e('0xb')]);router[_0x099e('0xc')]('/',auth[_0x099e('0x6')](),controller[_0x099e('0xd')]);router[_0x099e('0xe')](_0x099e('0xa'),auth[_0x099e('0x6')](),controller['update']);router[_0x099e('0xf')](_0x099e('0xa'),auth[_0x099e('0x6')](),controller[_0x099e('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 62db5cb..5ac00fa 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 _0x5fc3=['duration','startedAt','toString','closedAt','format','MM-DD-YYYY\x20HH:mm','DATE','updatedAt','sequelize','moment','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','subtract'];(function(_0x3e6832,_0xd3ce6d){var _0x41410c=function(_0x5cf605){while(--_0x5cf605){_0x3e6832['push'](_0x3e6832['shift']());}};_0x41410c(++_0xd3ce6d);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5ebc04,_0x14a363){_0x5ebc04=_0x5ebc04-0x0;var _0x17845c=_0x5fc3[_0x5ebc04];return _0x17845c;};'use strict';var Sequelize=require(_0x35fc('0x0'));var moment=require(_0x35fc('0x1'));var path=require('path');var config=require(_0x35fc('0x2'));module[_0x35fc('0x3')]={'format':{'type':Sequelize[_0x35fc('0x4')],'get':function(){return this[_0x35fc('0x5')](_0x35fc('0x6'))?path['extname'](this[_0x35fc('0x5')](_0x35fc('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x35fc('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x19a0d1){var _0x508b32=_0x19a0d1[_0x35fc('0x8')](/\\/g,'/');this[_0x35fc('0x9')](_0x35fc('0x6'),_0x508b32);}},'rating':{'type':Sequelize[_0x35fc('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x35fc('0xa')],'set':function(_0xf9d3a6){this[_0x35fc('0x9')]('startedAt',moment()[_0x35fc('0xb')](_0xf9d3a6,'ms'));this[_0x35fc('0x9')]('closedAt',moment());this[_0x35fc('0x9')](_0x35fc('0xc'),_0xf9d3a6);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x35fc('0x5')](_0x35fc('0xd')))['format']('MM-DD-YYYY\x20HH:mm')[_0x35fc('0xe')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x35fc('0x5')](_0x35fc('0xf')))[_0x35fc('0x10')](_0x35fc('0x11'))[_0x35fc('0xe')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('createdAt'))['format'](_0x35fc('0x11'))[_0x35fc('0xe')]();}},'updatedAt':{'type':Sequelize[_0x35fc('0x12')],'get':function(){return moment(this[_0x35fc('0x5')](_0x35fc('0x13')))[_0x35fc('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x35fc('0xe')]();}}}; \ No newline at end of file +var _0x98a8=['updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','extname','value','STRING','replace','INTEGER','setDataValue','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt'];(function(_0x16e45c,_0x3e7ca3){var _0x38ab27=function(_0x12ab78){while(--_0x12ab78){_0x16e45c['push'](_0x16e45c['shift']());}};_0x38ab27(++_0x3e7ca3);}(_0x98a8,0x12c));var _0x898a=function(_0x22b7b5,_0x468f18){_0x22b7b5=_0x22b7b5-0x0;var _0x37af12=_0x98a8[_0x22b7b5];return _0x37af12;};'use strict';var Sequelize=require(_0x898a('0x0'));var moment=require(_0x898a('0x1'));var path=require(_0x898a('0x2'));var config=require(_0x898a('0x3'));module[_0x898a('0x4')]={'format':{'type':Sequelize[_0x898a('0x5')],'get':function(){return this[_0x898a('0x6')]('value')?path[_0x898a('0x7')](this[_0x898a('0x6')](_0x898a('0x8'))):undefined;}},'interactionid':{'type':Sequelize[_0x898a('0x9')]},'channel':{'type':Sequelize[_0x898a('0x9')]},'value':{'type':Sequelize['STRING'],'set':function(_0x3aadc2){var _0x564583=_0x3aadc2[_0x898a('0xa')](/\\/g,'/');this['setDataValue'](_0x898a('0x8'),_0x564583);}},'rating':{'type':Sequelize[_0x898a('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x898a('0xb')],'set':function(_0x96b636){this[_0x898a('0xc')](_0x898a('0xd'),moment()[_0x898a('0xe')](_0x96b636,'ms'));this[_0x898a('0xc')](_0x898a('0xf'),moment());this['setDataValue'](_0x898a('0x10'),_0x96b636);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x898a('0x6')]('startedAt'))[_0x898a('0x11')](_0x898a('0x12'))[_0x898a('0x13')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('closedAt'))[_0x898a('0x11')](_0x898a('0x12'))[_0x898a('0x13')]();}},'createdAt':{'type':Sequelize[_0x898a('0x14')],'get':function(){return moment(this[_0x898a('0x6')](_0x898a('0x15')))['format'](_0x898a('0x12'))['toString']();}},'updatedAt':{'type':Sequelize[_0x898a('0x14')],'get':function(){return moment(this['getDataValue'](_0x898a('0x16')))['format'](_0x898a('0x12'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 8db910d..8f69639 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 _0x3a00=['ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','index','map','rawAttributes','type','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','ScreenRecording','includeAll','include','findAll','rows','catch','params','find','create','body','duration','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','recording','join','Sequelize','ValidationError'];(function(_0x3cbe1c,_0x4bcabd){var _0x5ee08b=function(_0x5c53e6){while(--_0x5c53e6){_0x3cbe1c['push'](_0x3cbe1c['shift']());}};_0x5ee08b(++_0x4bcabd);}(_0x3a00,0x74));var _0x03a0=function(_0x30f07a,_0x98341){_0x30f07a=_0x30f07a-0x0;var _0xb38461=_0x3a00[_0x30f07a];return _0xb38461;};'use strict';var pdf=require(_0x03a0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x03a0('0x1'));var zipdir=require(_0x03a0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x03a0('0x3'));var moment=require(_0x03a0('0x4'));var BPromise=require(_0x03a0('0x5'));var Mustache=require(_0x03a0('0x6'));var util=require(_0x03a0('0x7'));var path=require(_0x03a0('0x8'));var sox=require('sox');var csv=require(_0x03a0('0x9'));var ejs=require(_0x03a0('0xa'));var fs=require('fs');var _=require(_0x03a0('0xb'));var squel=require(_0x03a0('0xc'));var crypto=require(_0x03a0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x03a0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x03a0('0xf'));var Papa=require(_0x03a0('0x10'));var Redis=require(_0x03a0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x03a0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x03a0('0x13'));var logger=require(_0x03a0('0x14'))('api');var utils=require(_0x03a0('0x15'));var config=require(_0x03a0('0x16'));var licenseUtil=require(_0x03a0('0x17'));var db=require(_0x03a0('0x18'))['db'];function respondWithStatusCode(_0xdd010d,_0xfa8d4a){_0xfa8d4a=_0xfa8d4a||0xcc;return function(_0x581b9f){if(_0x581b9f){return _0xdd010d[_0x03a0('0x19')](_0xfa8d4a);}return _0xdd010d[_0x03a0('0x1a')](_0xfa8d4a)[_0x03a0('0x1b')]();};}function respondWithResult(_0x10e5ea,_0x4530a0){_0x4530a0=_0x4530a0||0xc8;return function(_0x1bfcda){if(_0x1bfcda){return _0x10e5ea['status'](_0x4530a0)[_0x03a0('0x1c')](_0x1bfcda);}};}function respondWithFilteredResult(_0xbf6037,_0x440280){return function(_0x55d027){if(_0x55d027){var _0x54a42f=_0x55d027[_0x03a0('0x1d')],_0x56c9ce=_0x440280[_0x03a0('0x1e')],_0x1ba070=_0x440280[_0x03a0('0x1e')]+_0x440280[_0x03a0('0x1f')],_0x2cf36a;if(_0x1ba070>=_0x54a42f){_0x1ba070=_0x54a42f;_0x2cf36a=0xc8;}else{_0x2cf36a=0xce;}_0xbf6037[_0x03a0('0x1a')](_0x2cf36a);return _0xbf6037[_0x03a0('0x20')](_0x03a0('0x21'),_0x56c9ce+'-'+_0x1ba070+'/'+_0x54a42f)[_0x03a0('0x1c')](_0x55d027);}return null;};}function patchUpdates(_0x3eebec){return function(_0x2018c1){try{jsonpatch[_0x03a0('0x22')](_0x2018c1,_0x3eebec,!![]);}catch(_0x1c84b1){return BPromise[_0x03a0('0x23')](_0x1c84b1);}return _0x2018c1['save']();};}function saveUpdates(_0x430336,_0x18229d){return function(_0x251929){if(_0x251929){return _0x251929[_0x03a0('0x24')](_0x430336)[_0x03a0('0x25')](function(_0x385cc8){return _0x385cc8;});}return null;};}function removeEntity(_0x1a8e17,_0x1a2336){return function(_0x221d98){if(_0x221d98){return _0x221d98[_0x03a0('0x26')]()[_0x03a0('0x25')](function(){_0x1a8e17[_0x03a0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2532e4,_0x4d7cbd){return function(_0x2d69be){if(!_0x2d69be){_0x2532e4[_0x03a0('0x19')](0x194);}return _0x2d69be;};}function handleError(_0x72abb,_0x54be37){_0x54be37=_0x54be37||0x1f4;return function(_0x4bf469){logger['error'](_0x4bf469[_0x03a0('0x27')]);if(_0x4bf469[_0x03a0('0x28')]){delete _0x4bf469[_0x03a0('0x28')];}_0x72abb[_0x03a0('0x1a')](_0x54be37)['send'](_0x4bf469);};}exports[_0x03a0('0x29')]=function(_0x1f8a6c,_0x3c3d19){var _0x4ad23d={},_0x5733de={},_0x195523={'count':0x0,'rows':[]};var _0x58206a=_[_0x03a0('0x2a')](db['ScreenRecording'][_0x03a0('0x2b')],function(_0x512baa){return{'name':_0x512baa['fieldName'],'type':_0x512baa[_0x03a0('0x2c')]['key']};});_0x5733de[_0x03a0('0x2d')]=_[_0x03a0('0x2e')](_[_0x03a0('0x2a')](_0x58206a,'name'),[_0x03a0('0x2f')]);_0x5733de[_0x03a0('0x30')]=_[_0x03a0('0x31')](_0x1f8a6c[_0x03a0('0x30')]);_0x5733de[_0x03a0('0x32')]=_[_0x03a0('0x33')](_0x5733de['model'],_0x5733de[_0x03a0('0x30')]);_0x4ad23d[_0x03a0('0x34')]=_[_0x03a0('0x33')](_0x5733de['model'],qs['fields'](_0x1f8a6c[_0x03a0('0x30')][_0x03a0('0x35')]));_0x4ad23d[_0x03a0('0x34')]=_0x4ad23d[_0x03a0('0x34')][_0x03a0('0x36')]?_0x4ad23d[_0x03a0('0x34')]:_0x5733de[_0x03a0('0x2d')];if(!_0x1f8a6c['query'][_0x03a0('0x37')](_0x03a0('0x38'))){_0x4ad23d[_0x03a0('0x1f')]=qs[_0x03a0('0x1f')](_0x1f8a6c[_0x03a0('0x30')][_0x03a0('0x1f')]);_0x4ad23d[_0x03a0('0x1e')]=qs[_0x03a0('0x1e')](_0x1f8a6c['query'][_0x03a0('0x1e')]);}_0x4ad23d[_0x03a0('0x39')]=qs['sort'](_0x1f8a6c[_0x03a0('0x30')][_0x03a0('0x3a')]);_0x4ad23d[_0x03a0('0x3b')]=qs[_0x03a0('0x32')](_['pick'](_0x1f8a6c[_0x03a0('0x30')],_0x5733de[_0x03a0('0x32')]),_0x58206a);if(_0x1f8a6c[_0x03a0('0x30')][_0x03a0('0x3c')]){_0x4ad23d[_0x03a0('0x3b')]=_[_0x03a0('0x3d')](_0x4ad23d[_0x03a0('0x3b')],{'$or':_['map'](_0x58206a,function(_0x56f41b){if(_0x56f41b[_0x03a0('0x2c')]!=='VIRTUAL'){var _0x417c80={};_0x417c80[_0x56f41b[_0x03a0('0x28')]]={'$like':'%'+_0x1f8a6c[_0x03a0('0x30')][_0x03a0('0x3c')]+'%'};return _0x417c80;}})});}_0x4ad23d=_['merge']({},_0x4ad23d,_0x1f8a6c[_0x03a0('0x3e')]);var _0x459948={'where':_0x4ad23d[_0x03a0('0x3b')]};return db[_0x03a0('0x3f')][_0x03a0('0x1d')](_0x459948)[_0x03a0('0x25')](function(_0x383772){_0x195523['count']=_0x383772;if(_0x1f8a6c[_0x03a0('0x30')][_0x03a0('0x40')]){_0x4ad23d[_0x03a0('0x41')]=[{'all':!![]}];}return db[_0x03a0('0x3f')][_0x03a0('0x42')](_0x4ad23d);})[_0x03a0('0x25')](function(_0x5bdd00){_0x195523[_0x03a0('0x43')]=_0x5bdd00;return _0x195523;})['then'](respondWithFilteredResult(_0x3c3d19,_0x4ad23d))[_0x03a0('0x44')](handleError(_0x3c3d19,null));};exports['show']=function(_0x50e730,_0x1f197b){var _0x3d9af1={'raw':![],'where':{'id':_0x50e730[_0x03a0('0x45')]['id']}},_0x1e59a9={};_0x1e59a9[_0x03a0('0x2d')]=_[_0x03a0('0x31')](db[_0x03a0('0x3f')][_0x03a0('0x2b')]);_0x1e59a9[_0x03a0('0x30')]=_[_0x03a0('0x31')](_0x50e730[_0x03a0('0x30')]);_0x1e59a9[_0x03a0('0x32')]=_[_0x03a0('0x33')](_0x1e59a9[_0x03a0('0x2d')],_0x1e59a9[_0x03a0('0x30')]);_0x3d9af1[_0x03a0('0x34')]=_['intersection'](_0x1e59a9['model'],qs['fields'](_0x50e730['query'][_0x03a0('0x35')]));_0x3d9af1['attributes']=_0x3d9af1[_0x03a0('0x34')]['length']?_0x3d9af1[_0x03a0('0x34')]:_0x1e59a9['model'];if(_0x50e730[_0x03a0('0x30')][_0x03a0('0x40')]){_0x3d9af1['include']=[{'all':!![]}];}_0x3d9af1=_[_0x03a0('0x3d')]({},_0x3d9af1,_0x50e730[_0x03a0('0x3e')]);return db[_0x03a0('0x3f')][_0x03a0('0x46')](_0x3d9af1)[_0x03a0('0x25')](handleEntityNotFound(_0x1f197b,null))[_0x03a0('0x25')](respondWithResult(_0x1f197b,null))[_0x03a0('0x44')](handleError(_0x1f197b,null));};exports[_0x03a0('0x47')]=function(_0x1b8208,_0x2efe3d){return db[_0x03a0('0x3f')][_0x03a0('0x47')](_0x1b8208['body'],{})['then'](respondWithResult(_0x2efe3d,0xc9))[_0x03a0('0x44')](handleError(_0x2efe3d,null));};exports['update']=function(_0x1d584f,_0x38b3b0){if(_0x1d584f[_0x03a0('0x48')]['id']){delete _0x1d584f['body']['id'];}delete _0x1d584f[_0x03a0('0x48')][_0x03a0('0x49')];delete _0x1d584f[_0x03a0('0x48')][_0x03a0('0x4a')];delete _0x1d584f[_0x03a0('0x48')][_0x03a0('0x4b')];delete _0x1d584f[_0x03a0('0x48')][_0x03a0('0x4c')];return db['ScreenRecording'][_0x03a0('0x46')]({'where':{'id':_0x1d584f[_0x03a0('0x45')]['id']}})['then'](handleEntityNotFound(_0x38b3b0,null))['then'](saveUpdates(_0x1d584f[_0x03a0('0x48')],null))[_0x03a0('0x25')](respondWithResult(_0x38b3b0,null))['catch'](handleError(_0x38b3b0,null));};exports[_0x03a0('0x4d')]=function(_0x136ea6,_0x458b3a){return db[_0x03a0('0x3f')][_0x03a0('0x4d')]()['then'](respondWithResult(_0x458b3a,null))['catch'](handleError(_0x458b3a,null));};exports[_0x03a0('0x4e')]=function(_0x102f24,_0x1f5cb0,_0x43a439){var _0x593f56=require(_0x03a0('0x4f'));var _0x207713=![];var _0x593ad4={};if(_0x102f24[_0x03a0('0x30')][_0x03a0('0x2c')]&&_0x102f24[_0x03a0('0x30')][_0x03a0('0x2c')]===_0x03a0('0x50')){_0x593ad4[_0x03a0('0x50')]=_0x102f24[_0x03a0('0x45')]['id'];}else{_0x593ad4['id']=_0x102f24['params']['id'];}return db[_0x03a0('0x3f')][_0x03a0('0x46')]({'where':_0x593ad4,'attributes':['id','value'],'raw':!![]})[_0x03a0('0x25')](handleEntityNotFound(_0x1f5cb0,null))['then'](function(_0x62afeb){if(_0x62afeb){var _0x1695f9=path['join'](config[_0x03a0('0x51')],_0x03a0('0x52'),_0x62afeb[_0x03a0('0x4c')]);var _0x1a0e5b=util['format'](_0x03a0('0x53'),_0x1695f9);if(fs[_0x03a0('0x54')](_0x1a0e5b)){_0x207713=!![];return _0x593f56[_0x03a0('0x55')](_0x1a0e5b,_0x1695f9,config['secrets'][_0x03a0('0x56')])[_0x03a0('0x25')](function(){return _0x62afeb;});}return _0x62afeb;}})[_0x03a0('0x25')](function(_0x2ba9a4){if(_0x2ba9a4){var _0x4ab989=path[_0x03a0('0x57')](config[_0x03a0('0x51')],'server/files/screen_recordings',_0x2ba9a4['value']);if(!fs[_0x03a0('0x54')](_0x4ab989)){throw new db[(_0x03a0('0x58'))][(_0x03a0('0x59'))](_0x03a0('0x5a'));}if(_0x2ba9a4['filename']){return _0x1f5cb0[_0x03a0('0x4e')](_0x4ab989,_0x2ba9a4[_0x03a0('0x5b')]+path['extname'](_0x4ab989),function(){if(_0x207713){fs[_0x03a0('0x5c')](_0x4ab989);}});}else{return _0x1f5cb0[_0x03a0('0x4e')](_0x4ab989,function(_0x19c03f){if(_0x207713){fs[_0x03a0('0x5c')](_0x4ab989);}});}}})[_0x03a0('0x44')](function(_0xf6eea8){if(_0xf6eea8[_0x03a0('0x5d')]===_0x03a0('0x5a')){_0x1f5cb0['status'](0x194)['send'](_0x03a0('0x5e'));}else{return handleError(_0x1f5cb0,null);}});};exports[_0x03a0('0x26')]=function(_0xb55b4c,_0x26d524){return db[_0x03a0('0x3f')][_0x03a0('0x46')]({'where':{'id':_0xb55b4c[_0x03a0('0x45')]['id']}})['then'](function(_0xd7971c){if(!_0xd7971c)throw new ReferenceError(_0x03a0('0x5f'));return _0xd7971c;})['then'](function(_0x270dc9){var _0x49cd5d=path[_0x03a0('0x57')](config[_0x03a0('0x51')],'server/files/screen_recordings',_0x270dc9['value']);logger[_0x03a0('0x60')](_0x03a0('0x61'),_0x49cd5d);if(!_[_0x03a0('0x62')](_0x270dc9[_0x03a0('0x4c')])&&fs[_0x03a0('0x54')](_0x49cd5d)){logger['info'](_0x03a0('0x63')+_0x49cd5d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x49cd5d);}_0x49cd5d=_0x49cd5d+_0x03a0('0x64');if(!_[_0x03a0('0x62')](_0x270dc9[_0x03a0('0x4c')])&&fs[_0x03a0('0x54')](_0x49cd5d)){logger[_0x03a0('0x60')](_0x03a0('0x63')+_0x49cd5d+_0x03a0('0x65'));fs[_0x03a0('0x66')](_0x49cd5d);}return _0x270dc9;})['then'](function(_0x597c20){if(!_0x597c20)throw new InternalError();return _0x597c20[_0x03a0('0x26')]();})[_0x03a0('0x25')](function(){_0x26d524['status'](0xcc)[_0x03a0('0x1b')]();})[_0x03a0('0x44')](handleError(_0x26d524,null));}; \ No newline at end of file +var _0x458a=['offset','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','fieldName','type','key','model','differenceBy','map','format','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','ScreenRecording','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','update','createdAt','closedAt','describe','../../components/encryptor','uniqueid','value','server/files/screen_recordings','secrets','recording','root','existsSync','ValidationError','ScreenRecording\x20not\x20found','download','filename','unlink','message','Entity\x20not\x20found','join','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','isNil','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count'];(function(_0x16b627,_0x3a9763){var _0x3cdd08=function(_0x6202bd){while(--_0x6202bd){_0x16b627['push'](_0x16b627['shift']());}};_0x3cdd08(++_0x3a9763);}(_0x458a,0x110));var _0xa458=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x458a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xa458('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa458('0x1'));var jsonpatch=require(_0xa458('0x2'));var rp=require('request-promise');var moment=require(_0xa458('0x3'));var BPromise=require(_0xa458('0x4'));var Mustache=require(_0xa458('0x5'));var util=require(_0xa458('0x6'));var path=require(_0xa458('0x7'));var sox=require(_0xa458('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa458('0x9'));var crypto=require(_0xa458('0xa'));var jsforce=require(_0xa458('0xb'));var deskjs=require(_0xa458('0xc'));var toCsv=require(_0xa458('0xd'));var querystring=require('querystring');var Papa=require(_0xa458('0xe'));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('../../config/license/hardware');var logger=require(_0xa458('0xf'))(_0xa458('0x10'));var utils=require(_0xa458('0x11'));var config=require(_0xa458('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xa458('0x13'))['db'];function respondWithStatusCode(_0x4a9294,_0x467897){_0x467897=_0x467897||0xcc;return function(_0x4432c0){if(_0x4432c0){return _0x4a9294[_0xa458('0x14')](_0x467897);}return _0x4a9294[_0xa458('0x15')](_0x467897)[_0xa458('0x16')]();};}function respondWithResult(_0x4bf6e1,_0x160e1b){_0x160e1b=_0x160e1b||0xc8;return function(_0x594171){if(_0x594171){return _0x4bf6e1['status'](_0x160e1b)[_0xa458('0x17')](_0x594171);}};}function respondWithFilteredResult(_0x35d30e,_0x2e3406){return function(_0x509d01){if(_0x509d01){var _0x4b72fd=_0x509d01[_0xa458('0x18')],_0x110800=_0x2e3406['offset'],_0x10b1a3=_0x2e3406[_0xa458('0x19')]+_0x2e3406[_0xa458('0x1a')],_0x2b3b5c;if(_0x10b1a3>=_0x4b72fd){_0x10b1a3=_0x4b72fd;_0x2b3b5c=0xc8;}else{_0x2b3b5c=0xce;}_0x35d30e[_0xa458('0x15')](_0x2b3b5c);return _0x35d30e[_0xa458('0x1b')](_0xa458('0x1c'),_0x110800+'-'+_0x10b1a3+'/'+_0x4b72fd)['json'](_0x509d01);}return null;};}function patchUpdates(_0x1e7f52){return function(_0x2dd02e){try{jsonpatch[_0xa458('0x1d')](_0x2dd02e,_0x1e7f52,!![]);}catch(_0x409028){return BPromise[_0xa458('0x1e')](_0x409028);}return _0x2dd02e['save']();};}function saveUpdates(_0x29b4f1,_0x29b298){return function(_0xb9049){if(_0xb9049){return _0xb9049['update'](_0x29b4f1)[_0xa458('0x1f')](function(_0x1d0d73){return _0x1d0d73;});}return null;};}function removeEntity(_0x32657c,_0x2a3b24){return function(_0xa70f6d){if(_0xa70f6d){return _0xa70f6d[_0xa458('0x20')]()['then'](function(){_0x32657c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x160889,_0x51031e){return function(_0xe40992){if(!_0xe40992){_0x160889[_0xa458('0x14')](0x194);}return _0xe40992;};}function handleError(_0x4519b1,_0x5a78bb){_0x5a78bb=_0x5a78bb||0x1f4;return function(_0x49bd8c){logger[_0xa458('0x21')](_0x49bd8c[_0xa458('0x22')]);if(_0x49bd8c['name']){delete _0x49bd8c[_0xa458('0x23')];}_0x4519b1[_0xa458('0x15')](_0x5a78bb)[_0xa458('0x24')](_0x49bd8c);};}exports[_0xa458('0x25')]=function(_0x450e9b,_0x61c155){var _0x595eed={},_0x129d04={},_0x2d8634={'count':0x0,'rows':[]};var _0x227c52=_['map'](db['ScreenRecording']['rawAttributes'],function(_0x5b73d1){return{'name':_0x5b73d1[_0xa458('0x26')],'type':_0x5b73d1[_0xa458('0x27')][_0xa458('0x28')]};});_0x129d04[_0xa458('0x29')]=_[_0xa458('0x2a')](_[_0xa458('0x2b')](_0x227c52,_0xa458('0x23')),[_0xa458('0x2c')]);_0x129d04[_0xa458('0x2d')]=_[_0xa458('0x2e')](_0x450e9b[_0xa458('0x2d')]);_0x129d04[_0xa458('0x2f')]=_[_0xa458('0x30')](_0x129d04[_0xa458('0x29')],_0x129d04[_0xa458('0x2d')]);_0x595eed['attributes']=_[_0xa458('0x30')](_0x129d04[_0xa458('0x29')],qs[_0xa458('0x31')](_0x450e9b['query'][_0xa458('0x31')]));_0x595eed[_0xa458('0x32')]=_0x595eed['attributes'][_0xa458('0x33')]?_0x595eed[_0xa458('0x32')]:_0x129d04[_0xa458('0x29')];if(!_0x450e9b[_0xa458('0x2d')][_0xa458('0x34')](_0xa458('0x35'))){_0x595eed[_0xa458('0x1a')]=qs[_0xa458('0x1a')](_0x450e9b['query'][_0xa458('0x1a')]);_0x595eed[_0xa458('0x19')]=qs[_0xa458('0x19')](_0x450e9b[_0xa458('0x2d')][_0xa458('0x19')]);}_0x595eed['order']=qs[_0xa458('0x36')](_0x450e9b[_0xa458('0x2d')][_0xa458('0x36')]);_0x595eed[_0xa458('0x37')]=qs[_0xa458('0x2f')](_[_0xa458('0x38')](_0x450e9b[_0xa458('0x2d')],_0x129d04['filters']),_0x227c52);if(_0x450e9b[_0xa458('0x2d')][_0xa458('0x39')]){_0x595eed[_0xa458('0x37')]=_[_0xa458('0x3a')](_0x595eed['where'],{'$or':_[_0xa458('0x2b')](_0x227c52,function(_0x5eb19e){if(_0x5eb19e[_0xa458('0x27')]!==_0xa458('0x3b')){var _0xc8a1de={};_0xc8a1de[_0x5eb19e[_0xa458('0x23')]]={'$like':'%'+_0x450e9b['query']['filter']+'%'};return _0xc8a1de;}})});}_0x595eed=_[_0xa458('0x3a')]({},_0x595eed,_0x450e9b[_0xa458('0x3c')]);var _0x1425f5={'where':_0x595eed[_0xa458('0x37')]};return db[_0xa458('0x3d')][_0xa458('0x18')](_0x1425f5)['then'](function(_0x2f6b95){_0x2d8634['count']=_0x2f6b95;if(_0x450e9b['query'][_0xa458('0x3e')]){_0x595eed[_0xa458('0x3f')]=[{'all':!![]}];}return db[_0xa458('0x3d')][_0xa458('0x40')](_0x595eed);})[_0xa458('0x1f')](function(_0x302c9f){_0x2d8634[_0xa458('0x41')]=_0x302c9f;return _0x2d8634;})['then'](respondWithFilteredResult(_0x61c155,_0x595eed))[_0xa458('0x42')](handleError(_0x61c155,null));};exports[_0xa458('0x43')]=function(_0x5a9352,_0x2adada){var _0x37bdbc={'raw':![],'where':{'id':_0x5a9352[_0xa458('0x44')]['id']}},_0x30298b={};_0x30298b[_0xa458('0x29')]=_[_0xa458('0x2e')](db['ScreenRecording'][_0xa458('0x45')]);_0x30298b[_0xa458('0x2d')]=_['keys'](_0x5a9352[_0xa458('0x2d')]);_0x30298b['filters']=_['intersection'](_0x30298b[_0xa458('0x29')],_0x30298b[_0xa458('0x2d')]);_0x37bdbc[_0xa458('0x32')]=_[_0xa458('0x30')](_0x30298b['model'],qs[_0xa458('0x31')](_0x5a9352[_0xa458('0x2d')][_0xa458('0x31')]));_0x37bdbc[_0xa458('0x32')]=_0x37bdbc['attributes']['length']?_0x37bdbc[_0xa458('0x32')]:_0x30298b[_0xa458('0x29')];if(_0x5a9352[_0xa458('0x2d')]['includeAll']){_0x37bdbc[_0xa458('0x3f')]=[{'all':!![]}];}_0x37bdbc=_['merge']({},_0x37bdbc,_0x5a9352['options']);return db[_0xa458('0x3d')][_0xa458('0x46')](_0x37bdbc)[_0xa458('0x1f')](handleEntityNotFound(_0x2adada,null))[_0xa458('0x1f')](respondWithResult(_0x2adada,null))[_0xa458('0x42')](handleError(_0x2adada,null));};exports['create']=function(_0x1f732f,_0x266567){return db[_0xa458('0x3d')]['create'](_0x1f732f[_0xa458('0x47')],{})[_0xa458('0x1f')](respondWithResult(_0x266567,0xc9))[_0xa458('0x42')](handleError(_0x266567,null));};exports[_0xa458('0x48')]=function(_0x4bf1a5,_0x15e680){if(_0x4bf1a5[_0xa458('0x47')]['id']){delete _0x4bf1a5[_0xa458('0x47')]['id'];}delete _0x4bf1a5[_0xa458('0x47')]['duration'];delete _0x4bf1a5[_0xa458('0x47')][_0xa458('0x49')];delete _0x4bf1a5[_0xa458('0x47')][_0xa458('0x4a')];delete _0x4bf1a5[_0xa458('0x47')]['value'];return db['ScreenRecording']['find']({'where':{'id':_0x4bf1a5[_0xa458('0x44')]['id']}})[_0xa458('0x1f')](handleEntityNotFound(_0x15e680,null))[_0xa458('0x1f')](saveUpdates(_0x4bf1a5['body'],null))[_0xa458('0x1f')](respondWithResult(_0x15e680,null))[_0xa458('0x42')](handleError(_0x15e680,null));};exports[_0xa458('0x4b')]=function(_0x5e8d7a,_0x57a4fc){return db[_0xa458('0x3d')][_0xa458('0x4b')]()[_0xa458('0x1f')](respondWithResult(_0x57a4fc,null))[_0xa458('0x42')](handleError(_0x57a4fc,null));};exports['download']=function(_0x5ce0cf,_0x16fb82,_0xaeb1c7){var _0x4de23f=require(_0xa458('0x4c'));var _0x53334f=![];var _0x39382c={};if(_0x5ce0cf['query']['type']&&_0x5ce0cf[_0xa458('0x2d')][_0xa458('0x27')]===_0xa458('0x4d')){_0x39382c[_0xa458('0x4d')]=_0x5ce0cf[_0xa458('0x44')]['id'];}else{_0x39382c['id']=_0x5ce0cf[_0xa458('0x44')]['id'];}return db['ScreenRecording']['find']({'where':_0x39382c,'attributes':['id',_0xa458('0x4e')],'raw':!![]})[_0xa458('0x1f')](handleEntityNotFound(_0x16fb82,null))[_0xa458('0x1f')](function(_0x43cc45){if(_0x43cc45){var _0x1cc31f=path['join'](config['root'],_0xa458('0x4f'),_0x43cc45['value']);var _0x51bb98=util[_0xa458('0x2c')]('%s.cypher',_0x1cc31f);if(fs['existsSync'](_0x51bb98)){_0x53334f=!![];return _0x4de23f['decryptFile'](_0x51bb98,_0x1cc31f,config[_0xa458('0x50')][_0xa458('0x51')])[_0xa458('0x1f')](function(){return _0x43cc45;});}return _0x43cc45;}})[_0xa458('0x1f')](function(_0x399af1){if(_0x399af1){var _0x39f7bb=path['join'](config[_0xa458('0x52')],_0xa458('0x4f'),_0x399af1[_0xa458('0x4e')]);if(!fs[_0xa458('0x53')](_0x39f7bb)){throw new db['Sequelize'][(_0xa458('0x54'))](_0xa458('0x55'));}if(_0x399af1['filename']){return _0x16fb82[_0xa458('0x56')](_0x39f7bb,_0x399af1[_0xa458('0x57')]+path['extname'](_0x39f7bb),function(){if(_0x53334f){fs[_0xa458('0x58')](_0x39f7bb);}});}else{return _0x16fb82[_0xa458('0x56')](_0x39f7bb,function(_0x4bd06a){if(_0x53334f){fs['unlink'](_0x39f7bb);}});}}})['catch'](function(_0x6a7ac){if(_0x6a7ac[_0xa458('0x59')]===_0xa458('0x55')){_0x16fb82[_0xa458('0x15')](0x194)[_0xa458('0x24')]('Not\x20found');}else{return handleError(_0x16fb82,null);}});};exports[_0xa458('0x20')]=function(_0x56f7b9,_0x5d5405){return db['ScreenRecording'][_0xa458('0x46')]({'where':{'id':_0x56f7b9[_0xa458('0x44')]['id']}})[_0xa458('0x1f')](function(_0x3cc213){if(!_0x3cc213)throw new ReferenceError(_0xa458('0x5a'));return _0x3cc213;})[_0xa458('0x1f')](function(_0x3bf708){var _0x5d96e9=path[_0xa458('0x5b')](config['root'],_0xa458('0x4f'),_0x3bf708[_0xa458('0x4e')]);logger[_0xa458('0x5c')](_0xa458('0x5d'),_0x5d96e9);if(!_['isNil'](_0x3bf708[_0xa458('0x4e')])&&fs[_0xa458('0x53')](_0x5d96e9)){logger[_0xa458('0x5c')](_0xa458('0x5e')+_0x5d96e9+_0xa458('0x5f'));fs[_0xa458('0x60')](_0x5d96e9);}_0x5d96e9=_0x5d96e9+_0xa458('0x61');if(!_[_0xa458('0x62')](_0x3bf708[_0xa458('0x4e')])&&fs[_0xa458('0x53')](_0x5d96e9)){logger['info'](_0xa458('0x5e')+_0x5d96e9+_0xa458('0x5f'));fs[_0xa458('0x60')](_0x5d96e9);}return _0x3bf708;})[_0xa458('0x1f')](function(_0x41ad23){if(!_0x41ad23)throw new InternalError();return _0x41ad23[_0xa458('0x20')]();})[_0xa458('0x1f')](function(){_0x5d5405[_0xa458('0x15')](0xcc)[_0xa458('0x16')]();})[_0xa458('0x42')](handleError(_0x5d5405,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 2f98c76..d186943 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 _0xdddd=['request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','define','ScreenRecording','interactionid','lodash','util','../../config/logger','api','moment'];(function(_0x3b87f4,_0x112243){var _0x63d16e=function(_0x3e7323){while(--_0x3e7323){_0x3b87f4['push'](_0x3b87f4['shift']());}};_0x63d16e(++_0x112243);}(_0xdddd,0x1cf));var _0xdddd=function(_0x21af3a,_0x386e1d){_0x21af3a=_0x21af3a-0x0;var _0x268a49=_0xdddd[_0x21af3a];return _0x268a49;};'use strict';var _=require(_0xdddd('0x0'));var util=require(_0xdddd('0x1'));var logger=require(_0xdddd('0x2'))(_0xdddd('0x3'));var moment=require(_0xdddd('0x4'));var BPromise=require('bluebird');var rp=require(_0xdddd('0x5'));var fs=require('fs');var path=require(_0xdddd('0x6'));var rimraf=require(_0xdddd('0x7'));var config=require(_0xdddd('0x8'));var attributes=require(_0xdddd('0x9'));module['exports']=function(_0x1b68b8,_0x233464){return _0x1b68b8[_0xdddd('0xa')](_0xdddd('0xb'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xdddd('0xc'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9c70=['../../config/environment','./screenRecording.attributes','exports','define','screen_recordings','interactionid','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2ee755,_0x24c75c){var _0x120204=function(_0x1c13eb){while(--_0x1c13eb){_0x2ee755['push'](_0x2ee755['shift']());}};_0x120204(++_0x24c75c);}(_0x9c70,0x17a));var _0x09c7=function(_0x52fa77,_0x2b381b){_0x52fa77=_0x52fa77-0x0;var _0x477535=_0x9c70[_0x52fa77];return _0x477535;};'use strict';var _=require('lodash');var util=require(_0x09c7('0x0'));var logger=require(_0x09c7('0x1'))(_0x09c7('0x2'));var moment=require('moment');var BPromise=require(_0x09c7('0x3'));var rp=require(_0x09c7('0x4'));var fs=require('fs');var path=require(_0x09c7('0x5'));var rimraf=require('rimraf');var config=require(_0x09c7('0x6'));var attributes=require(_0x09c7('0x7'));module[_0x09c7('0x8')]=function(_0x2d437e,_0x111862){return _0x2d437e[_0x09c7('0x9')]('ScreenRecording',attributes,{'tableName':_0x09c7('0xa'),'paranoid':![],'indexes':[{'name':_0x09c7('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index edefd49..6bda8cf 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 _0xa9e0=['http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\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(_0xc0ea3d,_0x542a0e){var _0x1612cd=function(_0x23f91b){while(--_0x23f91b){_0xc0ea3d['push'](_0xc0ea3d['shift']());}};_0x1612cd(++_0x542a0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\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(_0x58a4fc,_0x5a8cce){var _0x430cb4=function(_0x1e4900){while(--_0x1e4900){_0x58a4fc['push'](_0x58a4fc['shift']());}};_0x430cb4(++_0x5a8cce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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/setting/index.js b/server/api/setting/index.js index 0d1056b..dcf6b50 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 _0xb52e=['./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/preferred','getFavicon','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','diskStorage','join','logologin','addLogoLogin','addPreferred','/:id/favicon','file','update','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1626ac,_0x517818){var _0x3753ef=function(_0x4a9113){while(--_0x4a9113){_0x1626ac['push'](_0x1626ac['shift']());}};_0x3753ef(++_0x517818);}(_0xb52e,0x1a6));var _0xeb52=function(_0x43b5b9,_0x1c307c){_0x43b5b9=_0x43b5b9-0x0;var _0x4fbd27=_0xb52e[_0x43b5b9];return _0x4fbd27;};'use strict';var multer=require(_0xeb52('0x0'));var util=require(_0xeb52('0x1'));var path=require('path');var timeout=require(_0xeb52('0x2'));var express=require('express');var router=express[_0xeb52('0x3')]();var auth=require(_0xeb52('0x4'));var interaction=require(_0xeb52('0x5'));var config=require(_0xeb52('0x6'));var controller=require(_0xeb52('0x7'));router[_0xeb52('0x8')]('/',auth[_0xeb52('0x9')](),controller[_0xeb52('0xa')]);router[_0xeb52('0x8')](_0xeb52('0xb'),controller[_0xeb52('0xc')]);router[_0xeb52('0x8')](_0xeb52('0xd'),controller[_0xeb52('0xe')]);router['get'](_0xeb52('0xf'),controller[_0xeb52('0x10')]);router[_0xeb52('0x8')](_0xeb52('0x11'),controller[_0xeb52('0x12')]);router['get']('/:id/gdpr',controller['gdpr']);router[_0xeb52('0x8')](_0xeb52('0x13'),controller['getPreferred']);router[_0xeb52('0x8')]('/:id/favicon',controller[_0xeb52('0x14')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x342f40,_0xcfc55f,_0xa976d5){_0xa976d5(null,path['join'](config[_0xeb52('0x15')],_0xeb52('0x16')));},'filename':function(_0x53380d,_0x138bd1,_0x3fa6a9){_0x3fa6a9(null,util[_0xeb52('0x17')](_0xeb52('0x18'),_0xeb52('0x19'),path[_0xeb52('0x1a')](_0x138bd1[_0xeb52('0x1b')])));}})});router[_0xeb52('0x1c')](_0xeb52('0xf'),upload[_0xeb52('0x1d')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0xeb52('0x1e')]({'destination':function(_0x5ed1e4,_0x2264d2,_0x297cfc){_0x297cfc(null,path[_0xeb52('0x1f')](config[_0xeb52('0x15')],_0xeb52('0x16')));},'filename':function(_0x56d0ee,_0x4741bd,_0x2811a8){_0x2811a8(null,util[_0xeb52('0x17')](_0xeb52('0x18'),_0xeb52('0x20'),path[_0xeb52('0x1a')](_0x4741bd[_0xeb52('0x1b')])));}})});router['post'](_0xeb52('0x11'),upload[_0xeb52('0x1d')]('file'),controller[_0xeb52('0x21')]);var upload=multer({'storage':multer[_0xeb52('0x1e')]({'destination':function(_0x3a0961,_0x38efad,_0x55d71b){_0x55d71b(null,path[_0xeb52('0x1f')](config[_0xeb52('0x15')],_0xeb52('0x16')));},'filename':function(_0x5031da,_0x5e130f,_0x59b1c3){_0x59b1c3(null,util['format']('%s%s','preferred',path['extname'](_0x5e130f[_0xeb52('0x1b')])));}})});router['post'](_0xeb52('0x13'),upload[_0xeb52('0x1d')]('file'),controller[_0xeb52('0x22')]);var upload=multer({'storage':multer[_0xeb52('0x1e')]({'destination':function(_0x8cbcd,_0x6ee42e,_0x2bfeb7){_0x2bfeb7(null,path[_0xeb52('0x1f')](config[_0xeb52('0x15')],_0xeb52('0x16')));},'filename':function(_0x50b86a,_0x70111,_0x1571de){_0x1571de(null,util[_0xeb52('0x17')](_0xeb52('0x18'),'favicon',path[_0xeb52('0x1a')](_0x70111[_0xeb52('0x1b')])));}})});router['post'](_0xeb52('0x23'),upload['single'](_0xeb52('0x24')),controller['addFavicon']);router['put'](_0xeb52('0xd'),auth['isAuthenticated'](),controller[_0xeb52('0x25')]);module[_0xeb52('0x26')]=router; \ No newline at end of file +var _0xa4b9=['preferred','post','/:id/favicon','addFavicon','update','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getFavicon','diskStorage','join','server/files/images/logos/','format','%s%s','logo','extname','originalname','single','file','logologin','addLogoLogin','root'];(function(_0x5e1963,_0x69d041){var _0x23b759=function(_0x264b8f){while(--_0x264b8f){_0x5e1963['push'](_0x5e1963['shift']());}};_0x23b759(++_0x69d041);}(_0xa4b9,0x1f2));var _0x9a4b=function(_0x22b983,_0x244e2e){_0x22b983=_0x22b983-0x0;var _0x2b28da=_0xa4b9[_0x22b983];return _0x2b28da;};'use strict';var multer=require(_0x9a4b('0x0'));var util=require(_0x9a4b('0x1'));var path=require('path');var timeout=require(_0x9a4b('0x2'));var express=require(_0x9a4b('0x3'));var router=express[_0x9a4b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9a4b('0x5'));var config=require('../../config/environment');var controller=require(_0x9a4b('0x6'));router[_0x9a4b('0x7')]('/',auth[_0x9a4b('0x8')](),controller[_0x9a4b('0x9')]);router[_0x9a4b('0x7')](_0x9a4b('0xa'),controller[_0x9a4b('0xb')]);router[_0x9a4b('0x7')](_0x9a4b('0xc'),controller[_0x9a4b('0xd')]);router[_0x9a4b('0x7')](_0x9a4b('0xe'),controller[_0x9a4b('0xf')]);router[_0x9a4b('0x7')](_0x9a4b('0x10'),controller[_0x9a4b('0x11')]);router[_0x9a4b('0x7')](_0x9a4b('0x12'),controller[_0x9a4b('0x13')]);router[_0x9a4b('0x7')](_0x9a4b('0x14'),controller['getPreferred']);router['get']('/:id/favicon',controller[_0x9a4b('0x15')]);var upload=multer({'storage':multer[_0x9a4b('0x16')]({'destination':function(_0x3f08f8,_0x89b3fe,_0x31239d){_0x31239d(null,path[_0x9a4b('0x17')](config['root'],_0x9a4b('0x18')));},'filename':function(_0x11fefa,_0x56d245,_0x311d7a){_0x311d7a(null,util[_0x9a4b('0x19')](_0x9a4b('0x1a'),_0x9a4b('0x1b'),path[_0x9a4b('0x1c')](_0x56d245[_0x9a4b('0x1d')])));}})});router['post'](_0x9a4b('0xe'),upload[_0x9a4b('0x1e')](_0x9a4b('0x1f')),controller['addLogo']);var upload=multer({'storage':multer[_0x9a4b('0x16')]({'destination':function(_0x4b5d21,_0x43e5de,_0x4e1597){_0x4e1597(null,path[_0x9a4b('0x17')](config['root'],'server/files/images/logos/'));},'filename':function(_0x2c34c2,_0x555b3b,_0xfc55f7){_0xfc55f7(null,util[_0x9a4b('0x19')](_0x9a4b('0x1a'),_0x9a4b('0x20'),path[_0x9a4b('0x1c')](_0x555b3b[_0x9a4b('0x1d')])));}})});router['post'](_0x9a4b('0x10'),upload['single'](_0x9a4b('0x1f')),controller[_0x9a4b('0x21')]);var upload=multer({'storage':multer[_0x9a4b('0x16')]({'destination':function(_0x21a337,_0x11241a,_0xf10947){_0xf10947(null,path['join'](config[_0x9a4b('0x22')],_0x9a4b('0x18')));},'filename':function(_0x3b64f5,_0x2c92e0,_0x5e7001){_0x5e7001(null,util[_0x9a4b('0x19')](_0x9a4b('0x1a'),_0x9a4b('0x23'),path[_0x9a4b('0x1c')](_0x2c92e0[_0x9a4b('0x1d')])));}})});router['post'](_0x9a4b('0x14'),upload[_0x9a4b('0x1e')](_0x9a4b('0x1f')),controller['addPreferred']);var upload=multer({'storage':multer[_0x9a4b('0x16')]({'destination':function(_0x2f6183,_0x800887,_0x32fb16){_0x32fb16(null,path[_0x9a4b('0x17')](config[_0x9a4b('0x22')],_0x9a4b('0x18')));},'filename':function(_0x1aa08a,_0x252ccc,_0x13412a){_0x13412a(null,util[_0x9a4b('0x19')](_0x9a4b('0x1a'),'favicon',path[_0x9a4b('0x1c')](_0x252ccc[_0x9a4b('0x1d')])));}})});router[_0x9a4b('0x24')](_0x9a4b('0x25'),upload[_0x9a4b('0x1e')]('file'),controller[_0x9a4b('0x26')]);router['put']('/:id',auth[_0x9a4b('0x8')](),controller[_0x9a4b('0x27')]);module[_0x9a4b('0x28')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 7675352..4054fd2 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 _0xe168=['exports','min_internal','INTEGER','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize'];(function(_0x5e6122,_0x43ac49){var _0x54b993=function(_0x3d6bd8){while(--_0x3d6bd8){_0x5e6122['push'](_0x5e6122['shift']());}};_0x54b993(++_0x43ac49);}(_0xe168,0xb3));var _0x8e16=function(_0x49df79,_0x3c7442){_0x49df79=_0x49df79-0x0;var _0x2724db=_0xe168[_0x49df79];return _0x2724db;};'use strict';var Sequelize=require(_0x8e16('0x0'));module[_0x8e16('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x8e16('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x8e16('0x3')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x8e16('0x4')],'defaultValue':_0x8e16('0x5')},'logo':{'type':Sequelize[_0x8e16('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x8e16('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x8e16('0x4')]},'turnaddr':{'type':Sequelize[_0x8e16('0x4')]},'turnusername':{'type':Sequelize[_0x8e16('0x4')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x8e16('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x8e16('0x4')],'defaultValue':_0x8e16('0x7')},'enableEmailPreview':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x8e16('0x3')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x8e16('0x3')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x8e16('0x4')],'defaultValue':_0x8e16('0x8')},'chatTimeout':{'type':Sequelize[_0x8e16('0x3')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x8e16('0x4')]},'defaultPreferred':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x8e16('0x4')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x8e16('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x8e16('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x8e16('0x3')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x8e16('0x3')]},'sentimentRegion':{'type':Sequelize[_0x8e16('0x4')]},'language':{'type':Sequelize[_0x8e16('0x4')]},'bucket':{'type':Sequelize[_0x8e16('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x8e16('0x3')](0x2)[_0x8e16('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x8e16('0x3')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x8e16('0x3')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x8e16('0x3')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x8e16('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xd612=['INTEGER','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize'];(function(_0x51f6a5,_0x579d96){var _0x222150=function(_0xdeb0aa){while(--_0xdeb0aa){_0x51f6a5['push'](_0x51f6a5['shift']());}};_0x222150(++_0x579d96);}(_0xd612,0x1db));var _0x2d61=function(_0x5e4723,_0x4e0b15){_0x5e4723=_0x5e4723-0x0;var _0xa39c29=_0xd612[_0x5e4723];return _0xa39c29;};'use strict';var Sequelize=require(_0x2d61('0x0'));module['exports']={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x2d61('0x1')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x2d61('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x2d61('0x2')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x2d61('0x2')]},'defaultLogo':{'type':Sequelize[_0x2d61('0x3')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x2d61('0x2')]},'defaultLoginLogo':{'type':Sequelize[_0x2d61('0x3')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x2d61('0x2')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x2d61('0x3')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x2d61('0x3')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x2d61('0x2')]},'turnusername':{'type':Sequelize[_0x2d61('0x2')]},'turnpassword':{'type':Sequelize[_0x2d61('0x2')]},'pageTitle':{'type':Sequelize[_0x2d61('0x2')]},'defaultPageTitle':{'type':Sequelize[_0x2d61('0x3')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x2d61('0x3')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x2d61('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x2d61('0x3')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x2d61('0x4')},'enableEmailPreview':{'type':Sequelize[_0x2d61('0x3')],'defaultValue':![]},'split':{'type':Sequelize[_0x2d61('0x3')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x2d61('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x2d61('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x2d61('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x2d61('0x2')],'defaultValue':_0x2d61('0x5')},'chatTimeout':{'type':Sequelize[_0x2d61('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x2d61('0x2')]},'defaultPreferred':{'type':Sequelize[_0x2d61('0x3')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x2d61('0x3')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x2d61('0x2')]},'allowedLoginAttempts':{'type':Sequelize[_0x2d61('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x2d61('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x2d61('0x2')]},'defaultFavicon':{'type':Sequelize[_0x2d61('0x3')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x2d61('0x3')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x2d61('0x3')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x2d61('0x1')]},'transcribeRegion':{'type':Sequelize[_0x2d61('0x2')]},'sentiment':{'type':Sequelize[_0x2d61('0x3')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x2d61('0x3')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x2d61('0x1')]},'sentimentRegion':{'type':Sequelize[_0x2d61('0x2')]},'language':{'type':Sequelize[_0x2d61('0x2')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x2d61('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'searchOnEnterKey':{'type':Sequelize[_0x2d61('0x3')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x2d61('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x2d61('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x2d61('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x2d61('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x2d61('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index c0115ca..f009051 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 _0x10bb=['defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','default','upperFirst','custom','download','getLogoLogin','default_loginLogo.svg','existsSync','Sequelize','ValidationError','\x20not\x20found','gdpr','addPreferred','preferred','getPreferred','server/files/images/logos','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','now','format','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','rows','params','length','includeAll','include','find','body','addLogo','file','filename','logo','addLogoLogin','getLicense','loginLogo','favicon','defaultLogo'];(function(_0x20099a,_0x2bf584){var _0x2c3649=function(_0x3c2f4b){while(--_0x3c2f4b){_0x20099a['push'](_0x20099a['shift']());}};_0x2c3649(++_0x2bf584);}(_0x10bb,0x10f));var _0xb10b=function(_0x2b772a,_0x40b92f){_0x2b772a=_0x2b772a-0x0;var _0xef7eb5=_0x10bb[_0x2b772a];return _0xef7eb5;};'use strict';var pdf=require(_0xb10b('0x0'));var emlformat=require(_0xb10b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb10b('0x2'));var jsonpatch=require(_0xb10b('0x3'));var rp=require('request-promise');var moment=require(_0xb10b('0x4'));var BPromise=require(_0xb10b('0x5'));var Mustache=require(_0xb10b('0x6'));var util=require(_0xb10b('0x7'));var path=require(_0xb10b('0x8'));var sox=require(_0xb10b('0x9'));var csv=require(_0xb10b('0xa'));var ejs=require(_0xb10b('0xb'));var fs=require('fs');var _=require(_0xb10b('0xc'));var squel=require(_0xb10b('0xd'));var crypto=require('crypto');var jsforce=require(_0xb10b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb10b('0xf'));var Papa=require('papaparse');var Redis=require(_0xb10b('0x10'));var authService=require(_0xb10b('0x11'));var qs=require(_0xb10b('0x12'));var as=require(_0xb10b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb10b('0x14'))(_0xb10b('0x15'));var utils=require(_0xb10b('0x16'));var config=require(_0xb10b('0x17'));var licenseUtil=require(_0xb10b('0x18'));var db=require(_0xb10b('0x19'))['db'];var jayson=require(_0xb10b('0x1a'));var client=jayson[_0xb10b('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c9bf0,_0x30244d,_0x40227e,_0x495afa){return new BPromise(function(_0x1321bb,_0x356415){var _0x524578=_0x495afa||client;return _0x524578['request'](_0x2c9bf0,_0x40227e)[_0xb10b('0x1c')](function(_0x1dd19b){logger[_0xb10b('0x1d')](_0xb10b('0x1e'),_0x30244d,_0xb10b('0x1f'));logger[_0xb10b('0x20')]('Setting,\x20%s,\x20%s,\x20%s',_0x30244d,'request\x20sent',JSON[_0xb10b('0x21')](_0x1dd19b));if(_0x1dd19b[_0xb10b('0x22')]){if(_0x1dd19b[_0xb10b('0x22')][_0xb10b('0x23')]===0x1f4){logger[_0xb10b('0x22')](_0xb10b('0x1e'),_0x30244d,_0x1dd19b['error'][_0xb10b('0x24')]);return _0x356415(_0x1dd19b[_0xb10b('0x22')][_0xb10b('0x24')]);}logger[_0xb10b('0x22')](_0xb10b('0x1e'),_0x30244d,_0x1dd19b[_0xb10b('0x22')][_0xb10b('0x24')]);return _0x1321bb(_0x1dd19b[_0xb10b('0x22')][_0xb10b('0x24')]);}else{logger['info'](_0xb10b('0x1e'),_0x30244d,_0xb10b('0x1f'));_0x1321bb(_0x1dd19b[_0xb10b('0x25')][_0xb10b('0x24')]);}})[_0xb10b('0x26')](function(_0x30d4e7){logger['error'](_0xb10b('0x1e'),_0x30244d,_0x30d4e7);_0x356415(_0x30d4e7);});});}function respondWithStatusCode(_0x4e61bb,_0x453d85){_0x453d85=_0x453d85||0xcc;return function(_0x2d374d){if(_0x2d374d){return _0x4e61bb[_0xb10b('0x27')](_0x453d85);}return _0x4e61bb[_0xb10b('0x28')](_0x453d85)[_0xb10b('0x29')]();};}function respondWithResult(_0x2c3340,_0x567cf6){_0x567cf6=_0x567cf6||0xc8;return function(_0x530299){if(_0x530299){return _0x2c3340[_0xb10b('0x28')](_0x567cf6)[_0xb10b('0x2a')](_0x530299);}};}function respondWithFilteredResult(_0x47c427,_0x1c6620){return function(_0x52ed82){if(_0x52ed82){var _0x22055a=_0x52ed82['count'],_0x549fe6=_0x1c6620[_0xb10b('0x2b')],_0x3aeb62=_0x1c6620[_0xb10b('0x2b')]+_0x1c6620[_0xb10b('0x2c')],_0x46e146;if(_0x3aeb62>=_0x22055a){_0x3aeb62=_0x22055a;_0x46e146=0xc8;}else{_0x46e146=0xce;}_0x47c427[_0xb10b('0x28')](_0x46e146);return _0x47c427[_0xb10b('0x2d')](_0xb10b('0x2e'),_0x549fe6+'-'+_0x3aeb62+'/'+_0x22055a)[_0xb10b('0x2a')](_0x52ed82);}return null;};}function patchUpdates(_0x392451){return function(_0x27b213){try{jsonpatch[_0xb10b('0x2f')](_0x27b213,_0x392451,!![]);}catch(_0x3f74e2){return BPromise[_0xb10b('0x30')](_0x3f74e2);}return _0x27b213['save']();};}function saveUpdates(_0x1ccc53,_0x2d39e5){return function(_0x2801db){if(_0x2801db){return _0x2801db[_0xb10b('0x31')](_0x1ccc53)[_0xb10b('0x1c')](function(_0x4da284){return _0x4da284;});}return null;};}function removeEntity(_0x2c79da,_0x500143){return function(_0x36db98){if(_0x36db98){return _0x36db98['destroy']()[_0xb10b('0x1c')](function(){_0x2c79da[_0xb10b('0x28')](0xcc)[_0xb10b('0x29')]();});}};}function handleEntityNotFound(_0x15bf99,_0x44f8e8){return function(_0x4d3d6a){if(!_0x4d3d6a){_0x15bf99[_0xb10b('0x27')](0x194);}return _0x4d3d6a;};}function handleError(_0x444653,_0x299209){_0x299209=_0x299209||0x1f4;return function(_0x3142fa){logger[_0xb10b('0x22')](_0x3142fa[_0xb10b('0x32')]);if(_0x3142fa[_0xb10b('0x33')]){delete _0x3142fa[_0xb10b('0x33')];}_0x444653[_0xb10b('0x28')](_0x299209)[_0xb10b('0x34')](_0x3142fa);};}exports[_0xb10b('0x35')]=function(_0x7f3665,_0x47358a){var _0x50419e={},_0x459b82={},_0x5e05c5={'count':0x0,'rows':[]};var _0x2c9df9=_[_0xb10b('0x36')](db[_0xb10b('0x37')][_0xb10b('0x38')],function(_0x195c81){return{'name':_0x195c81[_0xb10b('0x39')],'type':_0x195c81[_0xb10b('0x3a')][_0xb10b('0x3b')]};});_0x459b82[_0xb10b('0x3c')]=_[_0xb10b('0x36')](_0x2c9df9,_0xb10b('0x33'));_0x459b82['query']=_[_0xb10b('0x3d')](_0x7f3665['query']);_0x459b82['filters']=_[_0xb10b('0x3e')](_0x459b82['model'],_0x459b82[_0xb10b('0x3f')]);_0x50419e[_0xb10b('0x40')]=_[_0xb10b('0x3e')](_0x459b82[_0xb10b('0x3c')],qs[_0xb10b('0x41')](_0x7f3665[_0xb10b('0x3f')][_0xb10b('0x41')]));_0x50419e[_0xb10b('0x40')]=_0x50419e[_0xb10b('0x40')]['length']?_0x50419e['attributes']:_0x459b82[_0xb10b('0x3c')];if(!_0x7f3665[_0xb10b('0x3f')][_0xb10b('0x42')](_0xb10b('0x43'))){_0x50419e['limit']=qs[_0xb10b('0x2c')](_0x7f3665[_0xb10b('0x3f')][_0xb10b('0x2c')]);_0x50419e[_0xb10b('0x2b')]=qs[_0xb10b('0x2b')](_0x7f3665['query'][_0xb10b('0x2b')]);}_0x50419e[_0xb10b('0x44')]=qs[_0xb10b('0x45')](_0x7f3665[_0xb10b('0x3f')][_0xb10b('0x45')]);_0x50419e[_0xb10b('0x46')]=qs[_0xb10b('0x47')](_[_0xb10b('0x48')](_0x7f3665[_0xb10b('0x3f')],_0x459b82[_0xb10b('0x47')]),_0x2c9df9);if(_0x7f3665[_0xb10b('0x3f')][_0xb10b('0x49')]){_0x50419e[_0xb10b('0x46')]=_[_0xb10b('0x4a')](_0x50419e[_0xb10b('0x46')],{'$or':_[_0xb10b('0x36')](_0x2c9df9,function(_0x14b9f){if(_0x14b9f[_0xb10b('0x3a')]!=='VIRTUAL'){var _0x3a91b3={};_0x3a91b3[_0x14b9f[_0xb10b('0x33')]]={'$like':'%'+_0x7f3665[_0xb10b('0x3f')][_0xb10b('0x49')]+'%'};return _0x3a91b3;}})});}_0x50419e=_[_0xb10b('0x4a')]({},_0x50419e,_0x7f3665[_0xb10b('0x4b')]);var _0x5ac744={'where':_0x50419e['where']};return db[_0xb10b('0x37')]['count'](_0x5ac744)[_0xb10b('0x1c')](function(_0x1c0a83){_0x5e05c5['count']=_0x1c0a83;if(_0x7f3665[_0xb10b('0x3f')]['includeAll']){_0x50419e['include']=[{'all':!![]}];}return db[_0xb10b('0x37')]['findAll'](_0x50419e);})[_0xb10b('0x1c')](function(_0x244271){_0x5e05c5[_0xb10b('0x4c')]=_0x244271;return _0x5e05c5;})[_0xb10b('0x1c')](respondWithFilteredResult(_0x47358a,_0x50419e))[_0xb10b('0x26')](handleError(_0x47358a,null));};exports['show']=function(_0xe65109,_0x48b78a){var _0x2a7097={'raw':![],'where':{'id':_0xe65109[_0xb10b('0x4d')]['id']}},_0x64cd98={};_0x64cd98[_0xb10b('0x3c')]=_[_0xb10b('0x3d')](db[_0xb10b('0x37')]['rawAttributes']);_0x64cd98['query']=_[_0xb10b('0x3d')](_0xe65109[_0xb10b('0x3f')]);_0x64cd98[_0xb10b('0x47')]=_[_0xb10b('0x3e')](_0x64cd98[_0xb10b('0x3c')],_0x64cd98['query']);_0x2a7097[_0xb10b('0x40')]=_['intersection'](_0x64cd98['model'],qs[_0xb10b('0x41')](_0xe65109[_0xb10b('0x3f')][_0xb10b('0x41')]));_0x2a7097['attributes']=_0x2a7097[_0xb10b('0x40')][_0xb10b('0x4e')]?_0x2a7097[_0xb10b('0x40')]:_0x64cd98[_0xb10b('0x3c')];if(_0xe65109[_0xb10b('0x3f')][_0xb10b('0x4f')]){_0x2a7097[_0xb10b('0x50')]=[{'all':!![]}];}_0x2a7097=_['merge']({},_0x2a7097,_0xe65109[_0xb10b('0x4b')]);return db[_0xb10b('0x37')][_0xb10b('0x51')](_0x2a7097)[_0xb10b('0x1c')](handleEntityNotFound(_0x48b78a,null))[_0xb10b('0x1c')](respondWithResult(_0x48b78a,null))['catch'](handleError(_0x48b78a,null));};exports['update']=function(_0x7d0fb6,_0x231847){if(_0x7d0fb6[_0xb10b('0x52')]['id']){delete _0x7d0fb6[_0xb10b('0x52')]['id'];}return db[_0xb10b('0x37')]['find']({'where':{'id':_0x7d0fb6[_0xb10b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x231847,null))[_0xb10b('0x1c')](saveUpdates(_0x7d0fb6[_0xb10b('0x52')],null))['then'](respondWithResult(_0x231847,null))[_0xb10b('0x26')](handleError(_0x231847,null));};exports[_0xb10b('0x53')]=function(_0xd5576,_0xcb6698,_0x2b7752){if(_0xd5576[_0xb10b('0x54')]&&_0xd5576[_0xb10b('0x54')][_0xb10b('0x55')]){_0xd5576[_0xb10b('0x52')][_0xb10b('0x56')]=_0xd5576[_0xb10b('0x54')][_0xb10b('0x55')];}return db[_0xb10b('0x37')][_0xb10b('0x51')]({'where':{'id':_0xd5576[_0xb10b('0x4d')]['id']}})[_0xb10b('0x1c')](handleEntityNotFound(_0xcb6698,null))[_0xb10b('0x1c')](saveUpdates(_0xd5576[_0xb10b('0x52')],null))[_0xb10b('0x1c')](respondWithResult(_0xcb6698,null))[_0xb10b('0x26')](handleError(_0xcb6698,null));};exports[_0xb10b('0x57')]=function(_0x52837e,_0x6a0a95,_0x10f6e4){if(_0x52837e[_0xb10b('0x54')]&&_0x52837e[_0xb10b('0x54')]['filename']){_0x52837e[_0xb10b('0x52')]['loginLogo']=_0x52837e[_0xb10b('0x54')][_0xb10b('0x55')];}return db['Setting'][_0xb10b('0x51')]({'where':{'id':_0x52837e[_0xb10b('0x4d')]['id']}})[_0xb10b('0x1c')](handleEntityNotFound(_0x6a0a95,null))[_0xb10b('0x1c')](saveUpdates(_0x52837e[_0xb10b('0x52')],null))[_0xb10b('0x1c')](respondWithResult(_0x6a0a95,null))[_0xb10b('0x26')](handleError(_0x6a0a95,null));};var utilLicense=require(_0xb10b('0x18'));exports['getLogo']=function(_0xdb3ab8,_0x4ec8d6,_0x3e573c){var _0x1ad6e9='server/files/images/logos';var _0x1556ba={'custom':![]};return utilLicense[_0xb10b('0x58')]()[_0xb10b('0x1c')](function(_0x2a08c6){if(_0x2a08c6){_0x1556ba=_0x2a08c6;}return db[_0xb10b('0x37')][_0xb10b('0x51')]({'where':{'id':_0xdb3ab8['params']['id']},'attributes':[_0xb10b('0x56'),_0xb10b('0x59'),'preferred',_0xb10b('0x5a'),_0xb10b('0x5b'),_0xb10b('0x5c'),_0xb10b('0x5d'),_0xb10b('0x5e')],'raw':!![]});})[_0xb10b('0x1c')](handleEntityNotFound(_0x4ec8d6,null))[_0xb10b('0x1c')](function(_0x4f85e3){if(_0x4f85e3){var _0x248474=_0x4f85e3[_0xb10b('0x56')]&&fs['existsSync'](path[_0xb10b('0x5f')](config[_0xb10b('0x60')],_0x1ad6e9,_[_0xb10b('0x61')](_0x4f85e3['logo'])))?path[_0xb10b('0x5f')](config[_0xb10b('0x60')],_0x1ad6e9,_[_0xb10b('0x61')](_0x4f85e3['logo'])):path['join'](config[_0xb10b('0x60')],_0x1ad6e9,_[_0xb10b('0x61')](_0xb10b('0x62')));var _0x44d230=_0xb10b('0x63')+_[_0xb10b('0x64')](_0xb10b('0x56'));if(_0x4f85e3[_0x44d230]||!_0x1556ba[_0xb10b('0x65')]){_0x248474=path['join'](config[_0xb10b('0x60')],_0x1ad6e9,_[_0xb10b('0x61')]('default_logo.svg'));}if(!fs['existsSync'](_0x248474)){throw new db['Sequelize']['ValidationError'](_[_0xb10b('0x64')](_0xb10b('0x56'))+'\x20not\x20found');}return _0x4ec8d6[_0xb10b('0x66')](_0x248474);}})[_0xb10b('0x26')](handleError(_0x4ec8d6,null));};var utilLicense=require(_0xb10b('0x18'));exports[_0xb10b('0x67')]=function(_0x4ce0fc,_0x1394db,_0x2f4d6a){var _0x1ffdfb='server/files/images/logos';var _0x47ea75={'custom':![]};return utilLicense[_0xb10b('0x58')]()[_0xb10b('0x1c')](function(_0x285e1b){if(_0x285e1b){_0x47ea75=_0x285e1b;}return db[_0xb10b('0x37')][_0xb10b('0x51')]({'where':{'id':_0x4ce0fc[_0xb10b('0x4d')]['id']},'attributes':['logo',_0xb10b('0x59'),'preferred',_0xb10b('0x5a'),_0xb10b('0x5b'),_0xb10b('0x5c'),_0xb10b('0x5d'),_0xb10b('0x5e')],'raw':!![]});})['then'](handleEntityNotFound(_0x1394db,null))['then'](function(_0xb7add7){if(_0xb7add7){var _0x52713e=_0xb7add7[_0xb10b('0x59')]&&fs['existsSync'](path[_0xb10b('0x5f')](config[_0xb10b('0x60')],_0x1ffdfb,_['toLower'](_0xb7add7[_0xb10b('0x59')])))?path[_0xb10b('0x5f')](config[_0xb10b('0x60')],_0x1ffdfb,_['toLower'](_0xb7add7[_0xb10b('0x59')])):path[_0xb10b('0x5f')](config[_0xb10b('0x60')],_0x1ffdfb,_[_0xb10b('0x61')]('default_loginLogo.svg'));var _0x346f2e=_0xb10b('0x63')+_[_0xb10b('0x64')](_0xb10b('0x59'));if(_0xb7add7[_0x346f2e]||!_0x47ea75['custom']){_0x52713e=path[_0xb10b('0x5f')](config[_0xb10b('0x60')],_0x1ffdfb,_['toLower'](_0xb10b('0x68')));}if(!fs[_0xb10b('0x69')](_0x52713e)){throw new db[(_0xb10b('0x6a'))][(_0xb10b('0x6b'))](_[_0xb10b('0x64')](_0xb10b('0x59'))+_0xb10b('0x6c'));}return _0x1394db[_0xb10b('0x66')](_0x52713e);}})[_0xb10b('0x26')](handleError(_0x1394db,null));};exports[_0xb10b('0x6d')]=function(_0x57a71b,_0x4c7d11){return db[_0xb10b('0x37')][_0xb10b('0x51')]({'where':{'id':_0x57a71b[_0xb10b('0x4d')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x4c7d11,null))[_0xb10b('0x26')](handleError(_0x4c7d11,null));};exports[_0xb10b('0x6e')]=function(_0x1061e5,_0x33d789,_0x4aa6a3){if(_0x1061e5[_0xb10b('0x54')]&&_0x1061e5[_0xb10b('0x54')]['filename']){_0x1061e5[_0xb10b('0x52')][_0xb10b('0x6f')]=_0x1061e5[_0xb10b('0x54')]['filename'];}return db[_0xb10b('0x37')][_0xb10b('0x51')]({'where':{'id':_0x1061e5[_0xb10b('0x4d')]['id']}})[_0xb10b('0x1c')](handleEntityNotFound(_0x33d789,null))[_0xb10b('0x1c')](saveUpdates(_0x1061e5[_0xb10b('0x52')],null))['then'](respondWithResult(_0x33d789,null))['catch'](handleError(_0x33d789,null));};var utilLicense=require(_0xb10b('0x18'));exports[_0xb10b('0x70')]=function(_0x25114b,_0x242cfd,_0x1cb117){var _0x149dc5=_0xb10b('0x71');var _0x1b5559={'custom':![]};return utilLicense['getLicense']()[_0xb10b('0x1c')](function(_0x48253a){if(_0x48253a){_0x1b5559=_0x48253a;}return db['Setting']['find']({'where':{'id':_0x25114b[_0xb10b('0x4d')]['id']},'attributes':[_0xb10b('0x56'),_0xb10b('0x59'),'preferred',_0xb10b('0x5a'),_0xb10b('0x5b'),_0xb10b('0x5c'),'defaultPreferred',_0xb10b('0x5e')],'raw':!![]});})[_0xb10b('0x1c')](handleEntityNotFound(_0x242cfd,null))[_0xb10b('0x1c')](function(_0x40329b){if(_0x40329b){var _0x45f00a=_0x40329b[_0xb10b('0x6f')]&&fs[_0xb10b('0x69')](path[_0xb10b('0x5f')](config['root'],_0x149dc5,_[_0xb10b('0x61')](_0x40329b[_0xb10b('0x6f')])))?path[_0xb10b('0x5f')](config[_0xb10b('0x60')],_0x149dc5,_[_0xb10b('0x61')](_0x40329b['preferred'])):path[_0xb10b('0x5f')](config[_0xb10b('0x60')],_0x149dc5,_[_0xb10b('0x61')](_0xb10b('0x72')));var _0x5eaa9d=_0xb10b('0x63')+_[_0xb10b('0x64')](_0xb10b('0x6f'));if(_0x40329b[_0x5eaa9d]||!_0x1b5559['custom']||!_0x1b5559['preferred']){_0x45f00a=path[_0xb10b('0x5f')](config[_0xb10b('0x60')],_0x149dc5,_['toLower'](_0xb10b('0x72')));}if(!fs[_0xb10b('0x69')](_0x45f00a)){throw new db[(_0xb10b('0x6a'))][(_0xb10b('0x6b'))](_[_0xb10b('0x64')](_0xb10b('0x6f'))+'\x20not\x20found');}return _0x242cfd[_0xb10b('0x66')](_0x45f00a);}})[_0xb10b('0x26')](handleError(_0x242cfd,null));};exports[_0xb10b('0x73')]=function(_0x1ed592,_0x1b7d02,_0x3f64a6){if(_0x1ed592[_0xb10b('0x54')]&&_0x1ed592[_0xb10b('0x54')][_0xb10b('0x55')]){_0x1ed592[_0xb10b('0x52')][_0xb10b('0x5a')]=_0x1ed592[_0xb10b('0x54')][_0xb10b('0x55')];}return db[_0xb10b('0x37')][_0xb10b('0x51')]({'where':{'id':_0x1ed592[_0xb10b('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1b7d02,null))[_0xb10b('0x1c')](saveUpdates(_0x1ed592[_0xb10b('0x52')],null))[_0xb10b('0x1c')](respondWithResult(_0x1b7d02,null))[_0xb10b('0x26')](handleError(_0x1b7d02,null));};var utilLicense=require(_0xb10b('0x18'));exports['getFavicon']=function(_0x519a80,_0x5ecba4,_0x31c470){var _0x5f5cf3=_0xb10b('0x71');var _0x1122ee={'custom':![]};return utilLicense[_0xb10b('0x58')]()[_0xb10b('0x1c')](function(_0x347186){if(_0x347186){_0x1122ee=_0x347186;}return db['Setting']['find']({'where':{'id':_0x519a80[_0xb10b('0x4d')]['id']},'attributes':[_0xb10b('0x56'),'loginLogo',_0xb10b('0x6f'),_0xb10b('0x5a'),_0xb10b('0x5b'),_0xb10b('0x5c'),_0xb10b('0x5d'),_0xb10b('0x5e')],'raw':!![]});})[_0xb10b('0x1c')](handleEntityNotFound(_0x5ecba4,null))[_0xb10b('0x1c')](function(_0x1e2532){if(_0x1e2532){var _0x29380a=_0x1e2532[_0xb10b('0x5a')]&&fs[_0xb10b('0x69')](path[_0xb10b('0x5f')](config[_0xb10b('0x60')],_0x5f5cf3,_[_0xb10b('0x61')](_0x1e2532[_0xb10b('0x5a')])))?path[_0xb10b('0x5f')](config['root'],_0x5f5cf3,_[_0xb10b('0x61')](_0x1e2532[_0xb10b('0x5a')])):path[_0xb10b('0x5f')](config['root'],_0x5f5cf3,_['toLower'](_0xb10b('0x74')));var _0x58373d=_0xb10b('0x63')+_[_0xb10b('0x64')](_0xb10b('0x5a'));if(_0x1e2532[_0x58373d]||!_0x1122ee[_0xb10b('0x65')]){_0x29380a=path['join'](config[_0xb10b('0x60')],_0x5f5cf3,_[_0xb10b('0x61')]('default_favicon.ico'));}if(!fs['existsSync'](_0x29380a)){throw new db[(_0xb10b('0x6a'))]['ValidationError'](_[_0xb10b('0x64')](_0xb10b('0x5a'))+_0xb10b('0x6c'));}return _0x5ecba4[_0xb10b('0x66')](_0x29380a);}})[_0xb10b('0x26')](handleError(_0x5ecba4,null));};exports[_0xb10b('0x75')]=function(_0x26a2d2,_0x1b68a1){var _0xe5504a={'offset':moment()[_0xb10b('0x76')]()};_0xe5504a[_0xb10b('0x77')]=moment()['utcOffset'](_0xe5504a['offset'])[_0xb10b('0x78')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x1b68a1[_0xb10b('0x28')](0xc8)[_0xb10b('0x34')](_0xe5504a);}; \ No newline at end of file +var _0x307d=['end','status','json','offset','limit','Content-Range','reject','save','update','destroy','sendStatus','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','order','sort','where','filters','pick','filter','merge','VIRTUAL','count','include','findAll','rows','params','length','includeAll','options','find','body','addLogo','filename','logo','file','addLogoLogin','loginLogo','getLogo','getLicense','preferred','favicon','defaultLoginLogo','defaultPreferred','existsSync','root','toLower','join','default','default_logo.svg','Sequelize','ValidationError','upperFirst','\x20not\x20found','download','server/files/images/logos','defaultLogo','defaultFavicon','default_loginLogo.svg','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','custom','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch'];(function(_0x44e5e3,_0x27cf75){var _0x4693a9=function(_0x15952a){while(--_0x15952a){_0x44e5e3['push'](_0x44e5e3['shift']());}};_0x4693a9(++_0x27cf75);}(_0x307d,0xcb));var _0xd307=function(_0x18ca23,_0x4af8ea){_0x18ca23=_0x18ca23-0x0;var _0x4f3c11=_0x307d[_0x18ca23];return _0x4f3c11;};'use strict';var pdf=require(_0xd307('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd307('0x1'));var zipdir=require(_0xd307('0x2'));var jsonpatch=require(_0xd307('0x3'));var rp=require(_0xd307('0x4'));var moment=require('moment');var BPromise=require(_0xd307('0x5'));var Mustache=require(_0xd307('0x6'));var util=require(_0xd307('0x7'));var path=require(_0xd307('0x8'));var sox=require(_0xd307('0x9'));var csv=require(_0xd307('0xa'));var ejs=require(_0xd307('0xb'));var fs=require('fs');var _=require(_0xd307('0xc'));var squel=require(_0xd307('0xd'));var crypto=require('crypto');var jsforce=require(_0xd307('0xe'));var deskjs=require(_0xd307('0xf'));var toCsv=require(_0xd307('0xa'));var querystring=require(_0xd307('0x10'));var Papa=require(_0xd307('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd307('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd307('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xd307('0x14'));var licenseUtil=require(_0xd307('0x15'));var db=require(_0xd307('0x16'))['db'];var jayson=require(_0xd307('0x17'));var client=jayson['client'][_0xd307('0x18')]({'port':0x232a});function respondWithRpcPromise(_0xe1256b,_0x3ca524,_0x390841,_0x301e19){return new BPromise(function(_0x505286,_0x3decdf){var _0x29669d=_0x301e19||client;return _0x29669d[_0xd307('0x19')](_0xe1256b,_0x390841)[_0xd307('0x1a')](function(_0x2f76d3){logger['info'](_0xd307('0x1b'),_0x3ca524,_0xd307('0x1c'));logger[_0xd307('0x1d')](_0xd307('0x1e'),_0x3ca524,_0xd307('0x1c'),JSON['stringify'](_0x2f76d3));if(_0x2f76d3['error']){if(_0x2f76d3['error'][_0xd307('0x1f')]===0x1f4){logger[_0xd307('0x20')]('Setting,\x20%s,\x20%s',_0x3ca524,_0x2f76d3[_0xd307('0x20')][_0xd307('0x21')]);return _0x3decdf(_0x2f76d3[_0xd307('0x20')]['message']);}logger[_0xd307('0x20')]('Setting,\x20%s,\x20%s',_0x3ca524,_0x2f76d3['error']['message']);return _0x505286(_0x2f76d3[_0xd307('0x20')][_0xd307('0x21')]);}else{logger[_0xd307('0x22')]('Setting,\x20%s,\x20%s',_0x3ca524,_0xd307('0x1c'));_0x505286(_0x2f76d3[_0xd307('0x23')][_0xd307('0x21')]);}})[_0xd307('0x24')](function(_0x336562){logger[_0xd307('0x20')](_0xd307('0x1b'),_0x3ca524,_0x336562);_0x3decdf(_0x336562);});});}function respondWithStatusCode(_0x34aff8,_0x1c7c60){_0x1c7c60=_0x1c7c60||0xcc;return function(_0x1886e4){if(_0x1886e4){return _0x34aff8['sendStatus'](_0x1c7c60);}return _0x34aff8['status'](_0x1c7c60)[_0xd307('0x25')]();};}function respondWithResult(_0x312246,_0x51860f){_0x51860f=_0x51860f||0xc8;return function(_0x4c162b){if(_0x4c162b){return _0x312246[_0xd307('0x26')](_0x51860f)[_0xd307('0x27')](_0x4c162b);}};}function respondWithFilteredResult(_0x2863ad,_0x3f42a8){return function(_0x34fba2){if(_0x34fba2){var _0x20f6f3=_0x34fba2['count'],_0x40af78=_0x3f42a8['offset'],_0x38bd67=_0x3f42a8[_0xd307('0x28')]+_0x3f42a8[_0xd307('0x29')],_0x244265;if(_0x38bd67>=_0x20f6f3){_0x38bd67=_0x20f6f3;_0x244265=0xc8;}else{_0x244265=0xce;}_0x2863ad['status'](_0x244265);return _0x2863ad['set'](_0xd307('0x2a'),_0x40af78+'-'+_0x38bd67+'/'+_0x20f6f3)['json'](_0x34fba2);}return null;};}function patchUpdates(_0x4f7182){return function(_0x497127){try{jsonpatch['apply'](_0x497127,_0x4f7182,!![]);}catch(_0x4d87e8){return BPromise[_0xd307('0x2b')](_0x4d87e8);}return _0x497127[_0xd307('0x2c')]();};}function saveUpdates(_0xd7bd59,_0x27a727){return function(_0x5b46a5){if(_0x5b46a5){return _0x5b46a5[_0xd307('0x2d')](_0xd7bd59)[_0xd307('0x1a')](function(_0x1f5746){return _0x1f5746;});}return null;};}function removeEntity(_0x2aa9fa,_0x3faf72){return function(_0x1eee55){if(_0x1eee55){return _0x1eee55[_0xd307('0x2e')]()['then'](function(){_0x2aa9fa['status'](0xcc)[_0xd307('0x25')]();});}};}function handleEntityNotFound(_0x1b7c53,_0x45ac70){return function(_0x518d52){if(!_0x518d52){_0x1b7c53[_0xd307('0x2f')](0x194);}return _0x518d52;};}function handleError(_0x12437a,_0x4fbb0e){_0x4fbb0e=_0x4fbb0e||0x1f4;return function(_0x52eb01){logger['error'](_0x52eb01[_0xd307('0x30')]);if(_0x52eb01[_0xd307('0x31')]){delete _0x52eb01[_0xd307('0x31')];}_0x12437a[_0xd307('0x26')](_0x4fbb0e)[_0xd307('0x32')](_0x52eb01);};}exports[_0xd307('0x33')]=function(_0x582473,_0x1d4da1){var _0x58c40a={},_0x4f9f5f={},_0x468537={'count':0x0,'rows':[]};var _0x590db1=_[_0xd307('0x34')](db[_0xd307('0x35')][_0xd307('0x36')],function(_0x48f8e0){return{'name':_0x48f8e0[_0xd307('0x37')],'type':_0x48f8e0[_0xd307('0x38')][_0xd307('0x39')]};});_0x4f9f5f[_0xd307('0x3a')]=_[_0xd307('0x34')](_0x590db1,'name');_0x4f9f5f[_0xd307('0x3b')]=_['keys'](_0x582473[_0xd307('0x3b')]);_0x4f9f5f['filters']=_['intersection'](_0x4f9f5f['model'],_0x4f9f5f['query']);_0x58c40a[_0xd307('0x3c')]=_[_0xd307('0x3d')](_0x4f9f5f['model'],qs[_0xd307('0x3e')](_0x582473[_0xd307('0x3b')][_0xd307('0x3e')]));_0x58c40a['attributes']=_0x58c40a[_0xd307('0x3c')]['length']?_0x58c40a[_0xd307('0x3c')]:_0x4f9f5f[_0xd307('0x3a')];if(!_0x582473[_0xd307('0x3b')]['hasOwnProperty']('nolimit')){_0x58c40a[_0xd307('0x29')]=qs[_0xd307('0x29')](_0x582473['query'][_0xd307('0x29')]);_0x58c40a[_0xd307('0x28')]=qs[_0xd307('0x28')](_0x582473['query'][_0xd307('0x28')]);}_0x58c40a[_0xd307('0x3f')]=qs['sort'](_0x582473[_0xd307('0x3b')][_0xd307('0x40')]);_0x58c40a[_0xd307('0x41')]=qs[_0xd307('0x42')](_[_0xd307('0x43')](_0x582473['query'],_0x4f9f5f[_0xd307('0x42')]),_0x590db1);if(_0x582473[_0xd307('0x3b')][_0xd307('0x44')]){_0x58c40a[_0xd307('0x41')]=_[_0xd307('0x45')](_0x58c40a[_0xd307('0x41')],{'$or':_[_0xd307('0x34')](_0x590db1,function(_0x4f0388){if(_0x4f0388['type']!==_0xd307('0x46')){var _0x54b231={};_0x54b231[_0x4f0388[_0xd307('0x31')]]={'$like':'%'+_0x582473[_0xd307('0x3b')][_0xd307('0x44')]+'%'};return _0x54b231;}})});}_0x58c40a=_[_0xd307('0x45')]({},_0x58c40a,_0x582473['options']);var _0x6324a6={'where':_0x58c40a[_0xd307('0x41')]};return db[_0xd307('0x35')]['count'](_0x6324a6)['then'](function(_0xf21fdf){_0x468537[_0xd307('0x47')]=_0xf21fdf;if(_0x582473[_0xd307('0x3b')]['includeAll']){_0x58c40a[_0xd307('0x48')]=[{'all':!![]}];}return db[_0xd307('0x35')][_0xd307('0x49')](_0x58c40a);})['then'](function(_0x2584a1){_0x468537[_0xd307('0x4a')]=_0x2584a1;return _0x468537;})[_0xd307('0x1a')](respondWithFilteredResult(_0x1d4da1,_0x58c40a))[_0xd307('0x24')](handleError(_0x1d4da1,null));};exports['show']=function(_0x2118d5,_0x14a602){var _0xc41b90={'raw':![],'where':{'id':_0x2118d5[_0xd307('0x4b')]['id']}},_0x40e72f={};_0x40e72f['model']=_['keys'](db['Setting'][_0xd307('0x36')]);_0x40e72f[_0xd307('0x3b')]=_['keys'](_0x2118d5[_0xd307('0x3b')]);_0x40e72f[_0xd307('0x42')]=_[_0xd307('0x3d')](_0x40e72f['model'],_0x40e72f['query']);_0xc41b90[_0xd307('0x3c')]=_[_0xd307('0x3d')](_0x40e72f[_0xd307('0x3a')],qs[_0xd307('0x3e')](_0x2118d5[_0xd307('0x3b')]['fields']));_0xc41b90[_0xd307('0x3c')]=_0xc41b90[_0xd307('0x3c')][_0xd307('0x4c')]?_0xc41b90[_0xd307('0x3c')]:_0x40e72f[_0xd307('0x3a')];if(_0x2118d5[_0xd307('0x3b')][_0xd307('0x4d')]){_0xc41b90[_0xd307('0x48')]=[{'all':!![]}];}_0xc41b90=_[_0xd307('0x45')]({},_0xc41b90,_0x2118d5[_0xd307('0x4e')]);return db[_0xd307('0x35')][_0xd307('0x4f')](_0xc41b90)[_0xd307('0x1a')](handleEntityNotFound(_0x14a602,null))[_0xd307('0x1a')](respondWithResult(_0x14a602,null))[_0xd307('0x24')](handleError(_0x14a602,null));};exports[_0xd307('0x2d')]=function(_0x4c2be7,_0x1bf2ac){if(_0x4c2be7[_0xd307('0x50')]['id']){delete _0x4c2be7[_0xd307('0x50')]['id'];}return db[_0xd307('0x35')][_0xd307('0x4f')]({'where':{'id':_0x4c2be7[_0xd307('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1bf2ac,null))[_0xd307('0x1a')](saveUpdates(_0x4c2be7[_0xd307('0x50')],null))[_0xd307('0x1a')](respondWithResult(_0x1bf2ac,null))[_0xd307('0x24')](handleError(_0x1bf2ac,null));};exports[_0xd307('0x51')]=function(_0x24ad11,_0x109b7c,_0x7453e1){if(_0x24ad11['file']&&_0x24ad11['file'][_0xd307('0x52')]){_0x24ad11[_0xd307('0x50')][_0xd307('0x53')]=_0x24ad11[_0xd307('0x54')]['filename'];}return db[_0xd307('0x35')][_0xd307('0x4f')]({'where':{'id':_0x24ad11['params']['id']}})[_0xd307('0x1a')](handleEntityNotFound(_0x109b7c,null))[_0xd307('0x1a')](saveUpdates(_0x24ad11[_0xd307('0x50')],null))['then'](respondWithResult(_0x109b7c,null))[_0xd307('0x24')](handleError(_0x109b7c,null));};exports[_0xd307('0x55')]=function(_0x390591,_0x446316,_0x325cae){if(_0x390591[_0xd307('0x54')]&&_0x390591[_0xd307('0x54')][_0xd307('0x52')]){_0x390591[_0xd307('0x50')][_0xd307('0x56')]=_0x390591['file']['filename'];}return db[_0xd307('0x35')]['find']({'where':{'id':_0x390591[_0xd307('0x4b')]['id']}})[_0xd307('0x1a')](handleEntityNotFound(_0x446316,null))[_0xd307('0x1a')](saveUpdates(_0x390591[_0xd307('0x50')],null))[_0xd307('0x1a')](respondWithResult(_0x446316,null))['catch'](handleError(_0x446316,null));};var utilLicense=require(_0xd307('0x15'));exports[_0xd307('0x57')]=function(_0x5f3c46,_0x3508c4,_0x19d582){var _0x341ac4='server/files/images/logos';var _0x16d069={'custom':![]};return utilLicense[_0xd307('0x58')]()[_0xd307('0x1a')](function(_0x49a4d3){if(_0x49a4d3){_0x16d069=_0x49a4d3;}return db[_0xd307('0x35')][_0xd307('0x4f')]({'where':{'id':_0x5f3c46['params']['id']},'attributes':['logo',_0xd307('0x56'),_0xd307('0x59'),_0xd307('0x5a'),'defaultLogo',_0xd307('0x5b'),_0xd307('0x5c'),'defaultFavicon'],'raw':!![]});})[_0xd307('0x1a')](handleEntityNotFound(_0x3508c4,null))['then'](function(_0x36da7d){if(_0x36da7d){var _0x5101fe=_0x36da7d[_0xd307('0x53')]&&fs[_0xd307('0x5d')](path['join'](config[_0xd307('0x5e')],_0x341ac4,_[_0xd307('0x5f')](_0x36da7d[_0xd307('0x53')])))?path['join'](config['root'],_0x341ac4,_[_0xd307('0x5f')](_0x36da7d[_0xd307('0x53')])):path[_0xd307('0x60')](config['root'],_0x341ac4,_[_0xd307('0x5f')]('default_logo.svg'));var _0x900014=_0xd307('0x61')+_['upperFirst']('logo');if(_0x36da7d[_0x900014]||!_0x16d069['custom']){_0x5101fe=path[_0xd307('0x60')](config['root'],_0x341ac4,_['toLower'](_0xd307('0x62')));}if(!fs[_0xd307('0x5d')](_0x5101fe)){throw new db[(_0xd307('0x63'))][(_0xd307('0x64'))](_[_0xd307('0x65')]('logo')+_0xd307('0x66'));}return _0x3508c4[_0xd307('0x67')](_0x5101fe);}})[_0xd307('0x24')](handleError(_0x3508c4,null));};var utilLicense=require(_0xd307('0x15'));exports['getLogoLogin']=function(_0x1eeba6,_0x770de2,_0x3b3b38){var _0x58d323=_0xd307('0x68');var _0x2be7d0={'custom':![]};return utilLicense[_0xd307('0x58')]()['then'](function(_0x20a654){if(_0x20a654){_0x2be7d0=_0x20a654;}return db[_0xd307('0x35')][_0xd307('0x4f')]({'where':{'id':_0x1eeba6['params']['id']},'attributes':[_0xd307('0x53'),'loginLogo',_0xd307('0x59'),_0xd307('0x5a'),_0xd307('0x69'),_0xd307('0x5b'),'defaultPreferred',_0xd307('0x6a')],'raw':!![]});})[_0xd307('0x1a')](handleEntityNotFound(_0x770de2,null))['then'](function(_0x1c8f78){if(_0x1c8f78){var _0x3ca1b1=_0x1c8f78['loginLogo']&&fs['existsSync'](path[_0xd307('0x60')](config[_0xd307('0x5e')],_0x58d323,_[_0xd307('0x5f')](_0x1c8f78[_0xd307('0x56')])))?path[_0xd307('0x60')](config[_0xd307('0x5e')],_0x58d323,_[_0xd307('0x5f')](_0x1c8f78[_0xd307('0x56')])):path['join'](config[_0xd307('0x5e')],_0x58d323,_['toLower'](_0xd307('0x6b')));var _0x1bdb10=_0xd307('0x61')+_['upperFirst'](_0xd307('0x56'));if(_0x1c8f78[_0x1bdb10]||!_0x2be7d0['custom']){_0x3ca1b1=path[_0xd307('0x60')](config[_0xd307('0x5e')],_0x58d323,_[_0xd307('0x5f')](_0xd307('0x6b')));}if(!fs[_0xd307('0x5d')](_0x3ca1b1)){throw new db[(_0xd307('0x63'))]['ValidationError'](_['upperFirst'](_0xd307('0x56'))+'\x20not\x20found');}return _0x770de2[_0xd307('0x67')](_0x3ca1b1);}})[_0xd307('0x24')](handleError(_0x770de2,null));};exports[_0xd307('0x6c')]=function(_0x3116ce,_0xfaf4e2){return db[_0xd307('0x35')][_0xd307('0x4f')]({'where':{'id':_0x3116ce[_0xd307('0x4b')]['id']},'attributes':[_0xd307('0x6d')]})[_0xd307('0x1a')](respondWithResult(_0xfaf4e2,null))[_0xd307('0x24')](handleError(_0xfaf4e2,null));};exports[_0xd307('0x6e')]=function(_0x3bc360,_0x253fb3,_0x5a2812){if(_0x3bc360[_0xd307('0x54')]&&_0x3bc360[_0xd307('0x54')]['filename']){_0x3bc360[_0xd307('0x50')][_0xd307('0x59')]=_0x3bc360[_0xd307('0x54')][_0xd307('0x52')];}return db[_0xd307('0x35')][_0xd307('0x4f')]({'where':{'id':_0x3bc360[_0xd307('0x4b')]['id']}})['then'](handleEntityNotFound(_0x253fb3,null))[_0xd307('0x1a')](saveUpdates(_0x3bc360[_0xd307('0x50')],null))[_0xd307('0x1a')](respondWithResult(_0x253fb3,null))[_0xd307('0x24')](handleError(_0x253fb3,null));};var utilLicense=require(_0xd307('0x15'));exports[_0xd307('0x6f')]=function(_0x124e4f,_0x2339bc,_0x24d15d){var _0x1eb2de=_0xd307('0x68');var _0x388811={'custom':![]};return utilLicense[_0xd307('0x58')]()[_0xd307('0x1a')](function(_0x4caf59){if(_0x4caf59){_0x388811=_0x4caf59;}return db['Setting'][_0xd307('0x4f')]({'where':{'id':_0x124e4f[_0xd307('0x4b')]['id']},'attributes':['logo',_0xd307('0x56'),_0xd307('0x59'),_0xd307('0x5a'),_0xd307('0x69'),'defaultLoginLogo',_0xd307('0x5c'),_0xd307('0x6a')],'raw':!![]});})[_0xd307('0x1a')](handleEntityNotFound(_0x2339bc,null))[_0xd307('0x1a')](function(_0x5cc499){if(_0x5cc499){var _0x5b2ebf=_0x5cc499[_0xd307('0x59')]&&fs[_0xd307('0x5d')](path[_0xd307('0x60')](config[_0xd307('0x5e')],_0x1eb2de,_[_0xd307('0x5f')](_0x5cc499[_0xd307('0x59')])))?path[_0xd307('0x60')](config[_0xd307('0x5e')],_0x1eb2de,_[_0xd307('0x5f')](_0x5cc499['preferred'])):path[_0xd307('0x60')](config['root'],_0x1eb2de,_[_0xd307('0x5f')](_0xd307('0x70')));var _0x4cd5f4=_0xd307('0x61')+_[_0xd307('0x65')](_0xd307('0x59'));if(_0x5cc499[_0x4cd5f4]||!_0x388811[_0xd307('0x71')]||!_0x388811[_0xd307('0x59')]){_0x5b2ebf=path[_0xd307('0x60')](config[_0xd307('0x5e')],_0x1eb2de,_[_0xd307('0x5f')](_0xd307('0x70')));}if(!fs['existsSync'](_0x5b2ebf)){throw new db[(_0xd307('0x63'))][(_0xd307('0x64'))](_[_0xd307('0x65')](_0xd307('0x59'))+'\x20not\x20found');}return _0x2339bc[_0xd307('0x67')](_0x5b2ebf);}})[_0xd307('0x24')](handleError(_0x2339bc,null));};exports['addFavicon']=function(_0x1d3e00,_0x3a76f4,_0x51c815){if(_0x1d3e00['file']&&_0x1d3e00['file'][_0xd307('0x52')]){_0x1d3e00[_0xd307('0x50')][_0xd307('0x5a')]=_0x1d3e00[_0xd307('0x54')][_0xd307('0x52')];}return db[_0xd307('0x35')][_0xd307('0x4f')]({'where':{'id':_0x1d3e00['params']['id']}})[_0xd307('0x1a')](handleEntityNotFound(_0x3a76f4,null))[_0xd307('0x1a')](saveUpdates(_0x1d3e00['body'],null))['then'](respondWithResult(_0x3a76f4,null))[_0xd307('0x24')](handleError(_0x3a76f4,null));};var utilLicense=require(_0xd307('0x15'));exports[_0xd307('0x72')]=function(_0x1a31b5,_0x5c0598,_0x58f70e){var _0x139fe1=_0xd307('0x68');var _0x3ec962={'custom':![]};return utilLicense[_0xd307('0x58')]()[_0xd307('0x1a')](function(_0x2d7319){if(_0x2d7319){_0x3ec962=_0x2d7319;}return db[_0xd307('0x35')][_0xd307('0x4f')]({'where':{'id':_0x1a31b5[_0xd307('0x4b')]['id']},'attributes':[_0xd307('0x53'),_0xd307('0x56'),_0xd307('0x59'),_0xd307('0x5a'),_0xd307('0x69'),'defaultLoginLogo',_0xd307('0x5c'),_0xd307('0x6a')],'raw':!![]});})[_0xd307('0x1a')](handleEntityNotFound(_0x5c0598,null))[_0xd307('0x1a')](function(_0x34f567){if(_0x34f567){var _0xaf28c4=_0x34f567[_0xd307('0x5a')]&&fs[_0xd307('0x5d')](path[_0xd307('0x60')](config['root'],_0x139fe1,_[_0xd307('0x5f')](_0x34f567[_0xd307('0x5a')])))?path['join'](config[_0xd307('0x5e')],_0x139fe1,_['toLower'](_0x34f567['favicon'])):path['join'](config[_0xd307('0x5e')],_0x139fe1,_[_0xd307('0x5f')](_0xd307('0x73')));var _0x5e11ef=_0xd307('0x61')+_[_0xd307('0x65')](_0xd307('0x5a'));if(_0x34f567[_0x5e11ef]||!_0x3ec962[_0xd307('0x71')]){_0xaf28c4=path['join'](config[_0xd307('0x5e')],_0x139fe1,_[_0xd307('0x5f')](_0xd307('0x73')));}if(!fs[_0xd307('0x5d')](_0xaf28c4)){throw new db['Sequelize'][(_0xd307('0x64'))](_[_0xd307('0x65')](_0xd307('0x5a'))+_0xd307('0x66'));}return _0x5c0598['download'](_0xaf28c4);}})['catch'](handleError(_0x5c0598,null));};exports[_0xd307('0x74')]=function(_0x5eccce,_0x57cfbf){var _0x53145a={'offset':moment()[_0xd307('0x75')]()};_0x53145a['now']=moment()[_0xd307('0x75')](_0x53145a[_0xd307('0x28')])[_0xd307('0x76')](_0xd307('0x77'));return _0x57cfbf[_0xd307('0x26')](0xc8)[_0xd307('0x32')](_0x53145a);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index ba4eadb..9665083 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 _0xe9b0=['./setting.attributes','settings','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x5aef17,_0x592cd4){var _0x43f9d0=function(_0x49ea9c){while(--_0x49ea9c){_0x5aef17['push'](_0x5aef17['shift']());}};_0x43f9d0(++_0x592cd4);}(_0xe9b0,0x141));var _0x0e9b=function(_0x3ddefb,_0x2641f9){_0x3ddefb=_0x3ddefb-0x0;var _0x206cfc=_0xe9b0[_0x3ddefb];return _0x206cfc;};'use strict';var _=require(_0x0e9b('0x0'));var util=require(_0x0e9b('0x1'));var logger=require(_0x0e9b('0x2'))(_0x0e9b('0x3'));var moment=require(_0x0e9b('0x4'));var BPromise=require(_0x0e9b('0x5'));var rp=require(_0x0e9b('0x6'));var fs=require('fs');var path=require(_0x0e9b('0x7'));var rimraf=require('rimraf');var config=require(_0x0e9b('0x8'));var attributes=require(_0x0e9b('0x9'));module['exports']=function(_0x16fd99,_0x8748d4){return _0x16fd99['define']('Setting',attributes,{'tableName':_0x0e9b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdae8=['settings','lodash','util','../../config/logger','api','moment','path','../../config/environment','./setting.attributes','exports','define'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xdae8,0x1f0));var _0x8dae=function(_0x3cb21e,_0x11849a){_0x3cb21e=_0x3cb21e-0x0;var _0xeacd6a=_0xdae8[_0x3cb21e];return _0xeacd6a;};'use strict';var _=require(_0x8dae('0x0'));var util=require(_0x8dae('0x1'));var logger=require(_0x8dae('0x2'))(_0x8dae('0x3'));var moment=require(_0x8dae('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8dae('0x5'));var rimraf=require('rimraf');var config=require(_0x8dae('0x6'));var attributes=require(_0x8dae('0x7'));module[_0x8dae('0x8')]=function(_0x33afa7,_0x2089f5){return _0x33afa7[_0x8dae('0x9')]('Setting',attributes,{'tableName':_0x8dae('0xa'),'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 2f1b35a..e898e88 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 _0x677c=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','debug','stringify','code','error','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','map','include','model','lodash','util','moment','bluebird','randomstring'];(function(_0x28ee9c,_0x1ae563){var _0x36f796=function(_0x4b9d9a){while(--_0x4b9d9a){_0x28ee9c['push'](_0x28ee9c['shift']());}};_0x36f796(++_0x1ae563);}(_0x677c,0x19b));var _0xc677=function(_0x3045dc,_0x1ea42d){_0x3045dc=_0x3045dc-0x0;var _0x140e2d=_0x677c[_0x3045dc];return _0x140e2d;};'use strict';var _=require(_0xc677('0x0'));var util=require(_0xc677('0x1'));var moment=require(_0xc677('0x2'));var BPromise=require(_0xc677('0x3'));var rs=require(_0xc677('0x4'));var fs=require('fs');var Redis=require(_0xc677('0x5'));var db=require(_0xc677('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc677('0x7'))(_0xc677('0x8'));var config=require('../../config/environment');var jayson=require(_0xc677('0x9'));var client=jayson['client'][_0xc677('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x360f2d,_0x4e6c46,_0x226a10){return new BPromise(function(_0x324def,_0x53579f){return client[_0xc677('0xb')](_0x360f2d,_0x226a10)[_0xc677('0xc')](function(_0x4fd896){logger[_0xc677('0xd')](_0xc677('0xe'),_0x4e6c46,'request\x20sent');logger[_0xc677('0xf')]('Setting,\x20%s,\x20%s,\x20%s',_0x4e6c46,'request\x20sent',JSON[_0xc677('0x10')](_0x4fd896));if(_0x4fd896['error']){if(_0x4fd896['error'][_0xc677('0x11')]===0x1f4){logger[_0xc677('0x12')]('Setting,\x20%s,\x20%s',_0x4e6c46,_0x4fd896[_0xc677('0x12')][_0xc677('0x13')]);return _0x53579f(_0x4fd896[_0xc677('0x12')][_0xc677('0x13')]);}logger['error'](_0xc677('0xe'),_0x4e6c46,_0x4fd896[_0xc677('0x12')][_0xc677('0x13')]);return _0x324def(_0x4fd896[_0xc677('0x12')][_0xc677('0x13')]);}else{logger[_0xc677('0xd')](_0xc677('0xe'),_0x4e6c46,'request\x20sent');_0x324def(_0x4fd896[_0xc677('0x14')][_0xc677('0x13')]);}})[_0xc677('0x15')](function(_0x5ec254){logger[_0xc677('0x12')]('Setting,\x20%s,\x20%s',_0x4e6c46,_0x5ec254);_0x53579f(_0x5ec254);});});}exports[_0xc677('0x16')]=function(_0x14ef4c){var _0x3ef27c=this;return new Promise(function(_0x8d01a4,_0x563b5e){return db[_0xc677('0x17')][_0xc677('0x18')]({'raw':_0x14ef4c['options']?_0x14ef4c[_0xc677('0x19')][_0xc677('0x1a')]===undefined?!![]:![]:!![],'where':_0x14ef4c[_0xc677('0x19')]?_0x14ef4c[_0xc677('0x19')][_0xc677('0x1b')]||null:null,'attributes':_0x14ef4c[_0xc677('0x19')]?_0x14ef4c[_0xc677('0x19')][_0xc677('0x1c')]||null:null,'include':_0x14ef4c['options']?_0x14ef4c[_0xc677('0x19')]['include']?_[_0xc677('0x1d')](_0x14ef4c[_0xc677('0x19')][_0xc677('0x1e')],function(_0x49ead2){return{'model':db[_0x49ead2[_0xc677('0x1f')]],'as':_0x49ead2['as'],'attributes':_0x49ead2[_0xc677('0x1c')],'include':_0x49ead2[_0xc677('0x1e')]?_[_0xc677('0x1d')](_0x49ead2['include'],function(_0x3b0072){return{'model':db[_0x3b0072['model']],'as':_0x3b0072['as'],'attributes':_0x3b0072[_0xc677('0x1c')],'include':_0x3b0072[_0xc677('0x1e')]?_[_0xc677('0x1d')](_0x3b0072[_0xc677('0x1e')],function(_0x11852d){return{'model':db[_0x11852d['model']],'as':_0x11852d['as'],'attributes':_0x11852d[_0xc677('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57ee0a){logger['info'](_0xc677('0x16'),_0x14ef4c);logger['debug'](_0xc677('0x16'),_0x14ef4c,JSON[_0xc677('0x10')](_0x57ee0a));_0x8d01a4(_0x57ee0a);})['catch'](function(_0x3ce1b5){logger[_0xc677('0x12')](_0xc677('0x16'),_0x3ce1b5[_0xc677('0x13')],_0x14ef4c);_0x563b5e(_0x3ef27c[_0xc677('0x12')](0x1f4,_0x3ce1b5['message']));});});}; \ No newline at end of file +var _0x33c8=['stringify','error','Setting,\x20%s,\x20%s','message','info','catch','find','options','raw','where','attributes','include','map','model','ShowSetting','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x376d7c,_0x53f9e0){var _0x28316d=function(_0x33b137){while(--_0x33b137){_0x376d7c['push'](_0x376d7c['shift']());}};_0x28316d(++_0x53f9e0);}(_0x33c8,0x17b));var _0x833c=function(_0x5c5aea,_0x295cfa){_0x5c5aea=_0x5c5aea-0x0;var _0x5d1f95=_0x33c8[_0x5c5aea];return _0x5d1f95;};'use strict';var _=require(_0x833c('0x0'));var util=require(_0x833c('0x1'));var moment=require(_0x833c('0x2'));var BPromise=require(_0x833c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x833c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x833c('0x5'))('rpc');var config=require(_0x833c('0x6'));var jayson=require(_0x833c('0x7'));var client=jayson[_0x833c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43e32e,_0xed433c,_0x5001d3){return new BPromise(function(_0x11ffa9,_0x495430){return client['request'](_0x43e32e,_0x5001d3)[_0x833c('0x9')](function(_0x575931){logger['info']('Setting,\x20%s,\x20%s',_0xed433c,_0x833c('0xa'));logger[_0x833c('0xb')](_0x833c('0xc'),_0xed433c,'request\x20sent',JSON[_0x833c('0xd')](_0x575931));if(_0x575931['error']){if(_0x575931['error']['code']===0x1f4){logger[_0x833c('0xe')](_0x833c('0xf'),_0xed433c,_0x575931[_0x833c('0xe')][_0x833c('0x10')]);return _0x495430(_0x575931[_0x833c('0xe')]['message']);}logger[_0x833c('0xe')](_0x833c('0xf'),_0xed433c,_0x575931['error'][_0x833c('0x10')]);return _0x11ffa9(_0x575931[_0x833c('0xe')][_0x833c('0x10')]);}else{logger[_0x833c('0x11')](_0x833c('0xf'),_0xed433c,_0x833c('0xa'));_0x11ffa9(_0x575931['result'][_0x833c('0x10')]);}})[_0x833c('0x12')](function(_0x3ef4dd){logger[_0x833c('0xe')](_0x833c('0xf'),_0xed433c,_0x3ef4dd);_0x495430(_0x3ef4dd);});});}exports['ShowSetting']=function(_0x4be327){var _0x32516e=this;return new Promise(function(_0x31e723,_0x140305){return db['Setting'][_0x833c('0x13')]({'raw':_0x4be327['options']?_0x4be327[_0x833c('0x14')][_0x833c('0x15')]===undefined?!![]:![]:!![],'where':_0x4be327[_0x833c('0x14')]?_0x4be327[_0x833c('0x14')][_0x833c('0x16')]||null:null,'attributes':_0x4be327[_0x833c('0x14')]?_0x4be327[_0x833c('0x14')][_0x833c('0x17')]||null:null,'include':_0x4be327[_0x833c('0x14')]?_0x4be327[_0x833c('0x14')][_0x833c('0x18')]?_[_0x833c('0x19')](_0x4be327[_0x833c('0x14')][_0x833c('0x18')],function(_0x2fcbc9){return{'model':db[_0x2fcbc9[_0x833c('0x1a')]],'as':_0x2fcbc9['as'],'attributes':_0x2fcbc9[_0x833c('0x17')],'include':_0x2fcbc9[_0x833c('0x18')]?_[_0x833c('0x19')](_0x2fcbc9[_0x833c('0x18')],function(_0x394f8f){return{'model':db[_0x394f8f['model']],'as':_0x394f8f['as'],'attributes':_0x394f8f[_0x833c('0x17')],'include':_0x394f8f[_0x833c('0x18')]?_[_0x833c('0x19')](_0x394f8f[_0x833c('0x18')],function(_0xf4dbd7){return{'model':db[_0xf4dbd7[_0x833c('0x1a')]],'as':_0xf4dbd7['as'],'attributes':_0xf4dbd7[_0x833c('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e8b23){logger['info'](_0x833c('0x1b'),_0x4be327);logger[_0x833c('0xb')]('ShowSetting',_0x4be327,JSON[_0x833c('0xd')](_0x5e8b23));_0x31e723(_0x5e8b23);})['catch'](function(_0x5ad89f){logger[_0x833c('0xe')](_0x833c('0x1b'),_0x5ad89f[_0x833c('0x10')],_0x4be327);_0x140305(_0x32516e['error'](0x1f4,_0x5ad89f[_0x833c('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 7c71351..47055fe 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 _0x6dbf=['/:id/status','statusGet','/:id/users','getAgents','post','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','notify','send','status','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x6dbf,0xbd));var _0xf6db=function(_0x552b6c,_0x1d04eb){_0x552b6c=_0x552b6c-0x0;var _0x7e7024=_0x6dbf[_0x552b6c];return _0x7e7024;};'use strict';var multer=require(_0xf6db('0x0'));var util=require(_0xf6db('0x1'));var path=require(_0xf6db('0x2'));var timeout=require('connect-timeout');var express=require(_0xf6db('0x3'));var router=express[_0xf6db('0x4')]();var auth=require(_0xf6db('0x5'));var interaction=require(_0xf6db('0x6'));var config=require(_0xf6db('0x7'));var controller=require(_0xf6db('0x8'));router[_0xf6db('0x9')]('/',auth[_0xf6db('0xa')](),controller['index']);router[_0xf6db('0x9')](_0xf6db('0xb'),auth[_0xf6db('0xa')](),controller[_0xf6db('0xc')]);router['get'](_0xf6db('0xd'),auth[_0xf6db('0xa')](),controller[_0xf6db('0xe')]);router[_0xf6db('0x9')]('/:id/dispositions',auth[_0xf6db('0xa')](),controller[_0xf6db('0xf')]);router[_0xf6db('0x9')]('/:id/canned_answers',auth[_0xf6db('0xa')](),controller[_0xf6db('0x10')]);router[_0xf6db('0x9')](_0xf6db('0x11'),auth[_0xf6db('0xa')](),controller[_0xf6db('0x12')]);router[_0xf6db('0x9')](_0xf6db('0x13'),auth[_0xf6db('0xa')](),controller[_0xf6db('0x14')]);router[_0xf6db('0x9')](_0xf6db('0x15'),controller[_0xf6db('0x16')]);router['get'](_0xf6db('0x17'),auth['isAuthenticated'](),controller[_0xf6db('0x18')]);router[_0xf6db('0x19')]('/',auth[_0xf6db('0xa')](),controller['create']);router[_0xf6db('0x19')](_0xf6db('0x1a'),auth[_0xf6db('0xa')](),controller[_0xf6db('0x1b')]);router[_0xf6db('0x19')](_0xf6db('0x1c'),auth[_0xf6db('0xa')](),controller[_0xf6db('0x1d')]);router[_0xf6db('0x19')]('/:id/notify',controller[_0xf6db('0x1e')]);router['post']('/:id/applications',auth[_0xf6db('0xa')](),controller['addApplications']);router[_0xf6db('0x19')]('/:id/send',auth[_0xf6db('0xa')](),controller[_0xf6db('0x1f')]);router[_0xf6db('0x19')](_0xf6db('0x15'),controller[_0xf6db('0x20')]);router['post'](_0xf6db('0x17'),auth['isAuthenticated'](),controller[_0xf6db('0x21')]);router[_0xf6db('0x22')](_0xf6db('0xd'),auth['isAuthenticated'](),controller[_0xf6db('0x23')]);router['delete'](_0xf6db('0xd'),auth[_0xf6db('0xa')](),controller[_0xf6db('0x24')]);router[_0xf6db('0x25')](_0xf6db('0x1a'),auth[_0xf6db('0xa')](),controller[_0xf6db('0x26')]);router[_0xf6db('0x25')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xf6db('0x27')]);router[_0xf6db('0x25')](_0xf6db('0x17'),auth['isAuthenticated'](),controller[_0xf6db('0x28')]);module[_0xf6db('0x29')]=router; \ No newline at end of file +var _0xb125=['put','delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','/:id/status','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','/:id/applications','addApplications','send','status','addAgents'];(function(_0x337da9,_0x42bb92){var _0x1e7a4d=function(_0x3fc3a4){while(--_0x3fc3a4){_0x337da9['push'](_0x337da9['shift']());}};_0x1e7a4d(++_0x42bb92);}(_0xb125,0x182));var _0x5b12=function(_0x3fa797,_0x48ac6f){_0x3fa797=_0x3fa797-0x0;var _0x455eb1=_0xb125[_0x3fa797];return _0x455eb1;};'use strict';var multer=require('multer');var util=require(_0x5b12('0x0'));var path=require(_0x5b12('0x1'));var timeout=require(_0x5b12('0x2'));var express=require(_0x5b12('0x3'));var router=express[_0x5b12('0x4')]();var auth=require(_0x5b12('0x5'));var interaction=require(_0x5b12('0x6'));var config=require(_0x5b12('0x7'));var controller=require('./smsAccount.controller');router[_0x5b12('0x8')]('/',auth[_0x5b12('0x9')](),controller['index']);router[_0x5b12('0x8')](_0x5b12('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x5b12('0x8')](_0x5b12('0xb'),auth['isAuthenticated'](),controller[_0x5b12('0xc')]);router[_0x5b12('0x8')](_0x5b12('0xd'),auth[_0x5b12('0x9')](),controller[_0x5b12('0xe')]);router['get'](_0x5b12('0xf'),auth[_0x5b12('0x9')](),controller[_0x5b12('0x10')]);router[_0x5b12('0x8')]('/:id/applications',auth[_0x5b12('0x9')](),controller[_0x5b12('0x11')]);router[_0x5b12('0x8')](_0x5b12('0x12'),auth[_0x5b12('0x9')](),controller['getInteractions']);router[_0x5b12('0x8')](_0x5b12('0x13'),controller['statusGet']);router[_0x5b12('0x8')](_0x5b12('0x14'),auth['isAuthenticated'](),controller[_0x5b12('0x15')]);router[_0x5b12('0x16')]('/',auth[_0x5b12('0x9')](),controller[_0x5b12('0x17')]);router[_0x5b12('0x16')](_0x5b12('0xd'),auth[_0x5b12('0x9')](),controller[_0x5b12('0x18')]);router['post'](_0x5b12('0xf'),auth[_0x5b12('0x9')](),controller[_0x5b12('0x19')]);router[_0x5b12('0x16')](_0x5b12('0x1a'),controller['notify']);router[_0x5b12('0x16')](_0x5b12('0x1b'),auth['isAuthenticated'](),controller[_0x5b12('0x1c')]);router[_0x5b12('0x16')]('/:id/send',auth['isAuthenticated'](),controller[_0x5b12('0x1d')]);router[_0x5b12('0x16')](_0x5b12('0x13'),controller[_0x5b12('0x1e')]);router[_0x5b12('0x16')](_0x5b12('0x14'),auth[_0x5b12('0x9')](),controller[_0x5b12('0x1f')]);router[_0x5b12('0x20')](_0x5b12('0xb'),auth[_0x5b12('0x9')](),controller['update']);router[_0x5b12('0x21')](_0x5b12('0xb'),auth[_0x5b12('0x9')](),controller['destroy']);router[_0x5b12('0x21')]('/:id/dispositions',auth[_0x5b12('0x9')](),controller[_0x5b12('0x22')]);router[_0x5b12('0x21')](_0x5b12('0xf'),auth[_0x5b12('0x9')](),controller[_0x5b12('0x23')]);router[_0x5b12('0x21')](_0x5b12('0x14'),auth[_0x5b12('0x9')](),controller[_0x5b12('0x24')]);module[_0x5b12('0x25')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 36f63f9..1741774 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 _0x7072=['randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x216d0c,_0x397ee5){var _0x57fd93=function(_0x55cacd){while(--_0x55cacd){_0x216d0c['push'](_0x216d0c['shift']());}};_0x57fd93(++_0x397ee5);}(_0x7072,0x138));var _0x2707=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x7072[_0xdc37a1];return _0x99b4fe;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x2707('0x0'));module[_0x2707('0x1')]={'name':{'type':Sequelize[_0x2707('0x2')],'unique':_0x2707('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x2707('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x2707('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2707('0x5')](_0x2707('0x6'),_0x2707('0x7'),_0x2707('0x8'),_0x2707('0x9'),_0x2707('0xa'),_0x2707('0xb'),_0x2707('0xc'),_0x2707('0xd'),_0x2707('0xe'),'intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x2707('0x2')]},'authToken':{'type':Sequelize[_0x2707('0x2')]},'smsMethod':{'type':Sequelize[_0x2707('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x2707('0x2')]},'password':{'type':Sequelize[_0x2707('0x2')]},'apiKey':{'type':Sequelize[_0x2707('0x2')]},'applicationId':{'type':Sequelize[_0x2707('0x2')]},'accountId':{'type':Sequelize[_0x2707('0x2')]},'senderString':{'type':Sequelize[_0x2707('0x2')]},'deliveryReport':{'type':Sequelize[_0x2707('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x2707('0x2')]},'notificationTemplate':{'type':Sequelize[_0x2707('0x10')],'defaultValue':function(){return _0x2707('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2707('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2707('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2707('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2707('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2707('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x2707('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x2707('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x2707('0xf')],'defaultValue':![],'comment':_0x2707('0x14'),'set':function(_0x5d523f){if(!_0x5d523f)this[_0x2707('0x15')](_0x2707('0x16'),null);this[_0x2707('0x15')](_0x2707('0x17'),_0x5d523f);}}}; \ No newline at end of file +var _0x14a0=['setDataValue','mandatoryDisposition','randomstring','exports','STRING','name','ENUM','twilio','skebby','plivo','clickatell','bandwidth','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x14a0,0x8e));var _0x014a=function(_0x3bbbce,_0x1c40a6){_0x3bbbce=_0x3bbbce-0x0;var _0x20af6b=_0x14a0[_0x3bbbce];return _0x20af6b;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x014a('0x0'));module[_0x014a('0x1')]={'name':{'type':Sequelize[_0x014a('0x2')],'unique':_0x014a('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x014a('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x014a('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x014a('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x014a('0x4')](_0x014a('0x5'),_0x014a('0x6'),'connectel','clicksend',_0x014a('0x7'),_0x014a('0x8'),_0x014a('0x9'),'csc','infobip',_0x014a('0xa'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x014a('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x014a('0x2')]},'applicationId':{'type':Sequelize[_0x014a('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x014a('0x2')]},'deliveryReport':{'type':Sequelize[_0x014a('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0x014a('0x2')]},'notificationTemplate':{'type':Sequelize[_0x014a('0xc')],'defaultValue':function(){return _0x014a('0xd');}},'notificationSound':{'type':Sequelize[_0x014a('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x014a('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x014a('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x014a('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x014a('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x014a('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x014a('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x014a('0xe')],'comment':_0x014a('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x014a('0x10'),'set':function(_0x128c46){if(!_0x128c46)this['setDataValue'](_0x014a('0x11'),null);this[_0x014a('0x12')](_0x014a('0x13'),_0x128c46);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index fb09d0a..e0dad56 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 _0x21ff=['state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','get','SmsAccounts','destroy','name','Pause','mandatoryDispositionPause','map','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','SmsAccount','findAll','rows','show','rawAttributes','keys','fields','include','find','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addDisposition','SmsAccountId','Disposition','create','findOne','pick','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','notify','sms','SmsApplication','Applications','account','applications','priority','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','MessageSid','skebby','from','sender','text','messageId','plivo','Text','infobip','results','csc','segmentedMessage','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','push','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','send','\x0a','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','connectel','requestid','statusInt','message_id','status_code','groupName','DELIVERED','redif','error_code','clicksend','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','clickatell','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id'];(function(_0x2f51f4,_0x125a59){var _0x375e8b=function(_0x3cd8a6){while(--_0x3cd8a6){_0x2f51f4['push'](_0x2f51f4['shift']());}};_0x375e8b(++_0x125a59);}(_0x21ff,0x1c8));var _0xf21f=function(_0x1ac77b,_0x10ee7a){_0x1ac77b=_0x1ac77b-0x0;var _0x161584=_0x21ff[_0x1ac77b];return _0x161584;};'use strict';var pdf=require(_0xf21f('0x0'));var emlformat=require(_0xf21f('0x1'));var rimraf=require(_0xf21f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf21f('0x3'));var moment=require(_0xf21f('0x4'));var BPromise=require(_0xf21f('0x5'));var Mustache=require(_0xf21f('0x6'));var util=require(_0xf21f('0x7'));var path=require(_0xf21f('0x8'));var sox=require(_0xf21f('0x9'));var csv=require(_0xf21f('0xa'));var ejs=require(_0xf21f('0xb'));var fs=require('fs');var _=require(_0xf21f('0xc'));var squel=require(_0xf21f('0xd'));var crypto=require('crypto');var jsforce=require(_0xf21f('0xe'));var deskjs=require(_0xf21f('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf21f('0x10'));var Papa=require('papaparse');var Redis=require(_0xf21f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf21f('0x12'));var as=require(_0xf21f('0x13'));var hardwareService=require(_0xf21f('0x14'));var logger=require('../../config/logger')(_0xf21f('0x15'));var utils=require(_0xf21f('0x16'));var config=require(_0xf21f('0x17'));var licenseUtil=require(_0xf21f('0x18'));var db=require(_0xf21f('0x19'))['db'];config[_0xf21f('0x1a')]=_[_0xf21f('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf21f('0x1c'))(new Redis(config['redis']));require(_0xf21f('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0xda60ea,_0x3ff44e,_0x585373,_0x23c568){return new BPromise(function(_0xaa2206,_0x4e02d2){var _0xf49f6b=_0x23c568||client;return _0xf49f6b[_0xf21f('0x1e')](_0xda60ea,_0x585373)[_0xf21f('0x1f')](function(_0x17665c){logger['info'](_0xf21f('0x20'),_0x3ff44e,_0xf21f('0x21'));logger[_0xf21f('0x22')](_0xf21f('0x23'),_0x3ff44e,_0xf21f('0x21'),JSON['stringify'](_0x17665c));if(_0x17665c[_0xf21f('0x24')]){if(_0x17665c[_0xf21f('0x24')]['code']===0x1f4){logger[_0xf21f('0x24')](_0xf21f('0x20'),_0x3ff44e,_0x17665c[_0xf21f('0x24')]['message']);return _0x4e02d2(_0x17665c['error'][_0xf21f('0x25')]);}logger[_0xf21f('0x24')](_0xf21f('0x20'),_0x3ff44e,_0x17665c['error'][_0xf21f('0x25')]);return _0xaa2206(_0x17665c['error'][_0xf21f('0x25')]);}else{logger[_0xf21f('0x26')]('SmsAccount,\x20%s,\x20%s',_0x3ff44e,_0xf21f('0x21'));_0xaa2206(_0x17665c[_0xf21f('0x27')][_0xf21f('0x25')]);}})[_0xf21f('0x28')](function(_0x74d97a){logger['error'](_0xf21f('0x20'),_0x3ff44e,_0x74d97a);_0x4e02d2(_0x74d97a);});});}function respondWithStatusCode(_0x21f8c1,_0x3fc1a3){_0x3fc1a3=_0x3fc1a3||0xcc;return function(_0x174da3){if(_0x174da3){return _0x21f8c1['sendStatus'](_0x3fc1a3);}return _0x21f8c1['status'](_0x3fc1a3)[_0xf21f('0x29')]();};}function respondWithResult(_0x117aef,_0x28bc56){_0x28bc56=_0x28bc56||0xc8;return function(_0x1fa077){if(_0x1fa077){return _0x117aef[_0xf21f('0x2a')](_0x28bc56)[_0xf21f('0x2b')](_0x1fa077);}};}function respondWithFilteredResult(_0x1abb94,_0xedc1f3){return function(_0x4ca34d){if(_0x4ca34d){var _0x47d61f=_0x4ca34d[_0xf21f('0x2c')],_0x1a690a=_0xedc1f3[_0xf21f('0x2d')],_0x36198a=_0xedc1f3[_0xf21f('0x2d')]+_0xedc1f3[_0xf21f('0x2e')],_0x32851;if(_0x36198a>=_0x47d61f){_0x36198a=_0x47d61f;_0x32851=0xc8;}else{_0x32851=0xce;}_0x1abb94['status'](_0x32851);return _0x1abb94[_0xf21f('0x2f')](_0xf21f('0x30'),_0x1a690a+'-'+_0x36198a+'/'+_0x47d61f)[_0xf21f('0x2b')](_0x4ca34d);}return null;};}function patchUpdates(_0x417937){return function(_0x4277c0){try{jsonpatch[_0xf21f('0x31')](_0x4277c0,_0x417937,!![]);}catch(_0x1046d9){return BPromise['reject'](_0x1046d9);}return _0x4277c0[_0xf21f('0x32')]();};}function saveUpdates(_0xde1b40,_0x370aa0){return function(_0x146e11){if(_0x146e11){return _0x146e11[_0xf21f('0x33')](_0xde1b40)['then'](function(_0x7d000b){return _0x7d000b;});}return null;};}function removeEntity(_0x304e46,_0x348dc1){return function(_0x25255a){if(_0x25255a){return _0x25255a['destroy']()[_0xf21f('0x1f')](function(){var _0xaae5c9=_0x25255a[_0xf21f('0x34')]({'plain':!![]});var _0xc2cbb7=_0xf21f('0x35');return db['UserProfileResource'][_0xf21f('0x36')]({'where':{'type':_0xc2cbb7,'resourceId':_0xaae5c9['id']}})[_0xf21f('0x1f')](function(){return _0x25255a;});})['then'](function(){_0x304e46['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x448506,_0x39c003){return function(_0x2a5f56){if(!_0x2a5f56){_0x448506['sendStatus'](0x194);}return _0x2a5f56;};}function handleError(_0x5efc8f,_0x1d7c7f){_0x1d7c7f=_0x1d7c7f||0x1f4;return function(_0x503c48){logger[_0xf21f('0x24')](_0x503c48['stack']);if(_0x503c48[_0xf21f('0x37')]){delete _0x503c48[_0xf21f('0x37')];}_0x5efc8f['status'](_0x1d7c7f)['send'](_0x503c48);};}exports['index']=function(_0x32c137,_0x329fc9){var _0x51ac49={'include':[{'model':db[_0xf21f('0x38')],'as':_0xf21f('0x39')}]},_0x1813ab={},_0x3ce365={'count':0x0,'rows':[]};var _0x202690=_[_0xf21f('0x3a')](db['SmsAccount']['rawAttributes'],function(_0x20cff2){return{'name':_0x20cff2[_0xf21f('0x3b')],'type':_0x20cff2[_0xf21f('0x3c')][_0xf21f('0x3d')]};});_0x1813ab[_0xf21f('0x3e')]=_[_0xf21f('0x3a')](_0x202690,_0xf21f('0x37'));_0x1813ab[_0xf21f('0x3f')]=_['keys'](_0x32c137[_0xf21f('0x3f')]);_0x1813ab[_0xf21f('0x40')]=_[_0xf21f('0x41')](_0x1813ab[_0xf21f('0x3e')],_0x1813ab[_0xf21f('0x3f')]);_0x51ac49[_0xf21f('0x42')]=_[_0xf21f('0x41')](_0x1813ab[_0xf21f('0x3e')],qs['fields'](_0x32c137[_0xf21f('0x3f')]['fields']));_0x51ac49['attributes']=_0x51ac49[_0xf21f('0x42')][_0xf21f('0x43')]?_0x51ac49[_0xf21f('0x42')]:_0x1813ab[_0xf21f('0x3e')];if(!_0x32c137[_0xf21f('0x3f')][_0xf21f('0x44')](_0xf21f('0x45'))){_0x51ac49[_0xf21f('0x2e')]=qs[_0xf21f('0x2e')](_0x32c137[_0xf21f('0x3f')][_0xf21f('0x2e')]);_0x51ac49[_0xf21f('0x2d')]=qs['offset'](_0x32c137[_0xf21f('0x3f')][_0xf21f('0x2d')]);}_0x51ac49[_0xf21f('0x46')]=qs['sort'](_0x32c137[_0xf21f('0x3f')][_0xf21f('0x47')]);_0x51ac49[_0xf21f('0x48')]=qs[_0xf21f('0x40')](_['pick'](_0x32c137[_0xf21f('0x3f')],_0x1813ab[_0xf21f('0x40')]),_0x202690);if(_0x32c137['query'][_0xf21f('0x49')]){_0x51ac49[_0xf21f('0x48')]=_[_0xf21f('0x4a')](_0x51ac49['where'],{'$or':_['map'](_0x202690,function(_0x2766c5){if(_0x2766c5[_0xf21f('0x3c')]!==_0xf21f('0x4b')){var _0x3ae65f={};_0x3ae65f[_0x2766c5[_0xf21f('0x37')]]={'$like':'%'+_0x32c137['query'][_0xf21f('0x49')]+'%'};return _0x3ae65f;}})});}_0x51ac49=_['merge']({},_0x51ac49,_0x32c137[_0xf21f('0x4c')]);var _0x351b57={'where':_0x51ac49['where']};return db['SmsAccount'][_0xf21f('0x2c')](_0x351b57)[_0xf21f('0x1f')](function(_0x1c0d7b){_0x3ce365['count']=_0x1c0d7b;if(_0x32c137[_0xf21f('0x3f')][_0xf21f('0x4d')]){_0x51ac49['include']=[{'all':!![]}];}return db[_0xf21f('0x4e')][_0xf21f('0x4f')](_0x51ac49);})['then'](function(_0x4972ba){_0x3ce365[_0xf21f('0x50')]=_0x4972ba;return _0x3ce365;})[_0xf21f('0x1f')](respondWithFilteredResult(_0x329fc9,_0x51ac49))[_0xf21f('0x28')](handleError(_0x329fc9,null));};exports[_0xf21f('0x51')]=function(_0x384496,_0x178f0a){var _0x4018b9={'raw':![],'where':{'id':_0x384496['params']['id']},'include':[{'model':db[_0xf21f('0x38')],'as':'mandatoryDispositionPause'}]},_0x2a1bcf={};_0x2a1bcf[_0xf21f('0x3e')]=_['keys'](db[_0xf21f('0x4e')][_0xf21f('0x52')]);_0x2a1bcf[_0xf21f('0x3f')]=_[_0xf21f('0x53')](_0x384496[_0xf21f('0x3f')]);_0x2a1bcf[_0xf21f('0x40')]=_[_0xf21f('0x41')](_0x2a1bcf['model'],_0x2a1bcf[_0xf21f('0x3f')]);_0x4018b9[_0xf21f('0x42')]=_['intersection'](_0x2a1bcf[_0xf21f('0x3e')],qs[_0xf21f('0x54')](_0x384496[_0xf21f('0x3f')]['fields']));_0x4018b9[_0xf21f('0x42')]=_0x4018b9['attributes']['length']?_0x4018b9['attributes']:_0x2a1bcf[_0xf21f('0x3e')];if(_0x384496[_0xf21f('0x3f')][_0xf21f('0x4d')]){_0x4018b9[_0xf21f('0x55')]=[{'all':!![]}];}_0x4018b9=_[_0xf21f('0x4a')]({},_0x4018b9,_0x384496['options']);return db['SmsAccount'][_0xf21f('0x56')](_0x4018b9)[_0xf21f('0x1f')](handleEntityNotFound(_0x178f0a,null))[_0xf21f('0x1f')](respondWithResult(_0x178f0a,null))[_0xf21f('0x28')](handleError(_0x178f0a,null));};exports['create']=function(_0x2d82ac,_0x4f8efd){return db[_0xf21f('0x4e')]['create'](_0x2d82ac['body'],{})['then'](function(_0x1630a1){var _0x37f0de=_0x2d82ac[_0xf21f('0x57')][_0xf21f('0x34')]({'plain':!![]});if(!_0x37f0de)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x37f0de[_0xf21f('0x58')]==='user'){var _0x184b15=_0x1630a1[_0xf21f('0x34')]({'plain':!![]});var _0x3caeda=_0xf21f('0x35');return db[_0xf21f('0x59')]['find']({'where':{'name':_0x3caeda,'userProfileId':_0x37f0de[_0xf21f('0x5a')]},'raw':!![]})[_0xf21f('0x1f')](function(_0x26c518){if(_0x26c518&&_0x26c518[_0xf21f('0x5b')]===0x0){return db[_0xf21f('0x5c')]['create']({'name':_0x184b15[_0xf21f('0x37')],'resourceId':_0x184b15['id'],'type':_0x26c518['name'],'sectionId':_0x26c518['id']},{})[_0xf21f('0x1f')](function(){return _0x1630a1;});}else{return _0x1630a1;}})[_0xf21f('0x28')](function(_0x32fb61){logger['error'](_0xf21f('0x5d'),_0x32fb61);throw _0x32fb61;});}return _0x1630a1;})['then'](respondWithResult(_0x4f8efd,0xc9))[_0xf21f('0x28')](handleError(_0x4f8efd,null));};exports[_0xf21f('0x33')]=function(_0x3a58c8,_0x4b228d){if(_0x3a58c8[_0xf21f('0x5e')]['id']){delete _0x3a58c8[_0xf21f('0x5e')]['id'];}return db[_0xf21f('0x4e')][_0xf21f('0x56')]({'where':{'id':_0x3a58c8['params']['id']},'include':[{'model':db[_0xf21f('0x38')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x4b228d,null))[_0xf21f('0x1f')](saveUpdates(_0x3a58c8[_0xf21f('0x5e')],null))[_0xf21f('0x1f')](respondWithResult(_0x4b228d,null))[_0xf21f('0x28')](handleError(_0x4b228d,null));};exports[_0xf21f('0x36')]=function(_0x34dc53,_0x4e1533){return db['SmsAccount'][_0xf21f('0x56')]({'where':{'id':_0x34dc53[_0xf21f('0x5f')]['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x4e1533,null))[_0xf21f('0x1f')](removeEntity(_0x4e1533,null))[_0xf21f('0x28')](handleError(_0x4e1533,null));};exports['describe']=function(_0x570c6e,_0x36fc91){return db['SmsAccount']['describe']()['then'](respondWithResult(_0x36fc91,null))[_0xf21f('0x28')](handleError(_0x36fc91,null));};exports[_0xf21f('0x60')]=function(_0x558fad,_0x136013,_0x104695){if(_0x558fad[_0xf21f('0x5e')]['id']){delete _0x558fad[_0xf21f('0x5e')]['id'];}return db[_0xf21f('0x4e')][_0xf21f('0x56')]({'where':{'id':_0x558fad[_0xf21f('0x5f')]['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x136013,null))['then'](function(_0x487704){if(_0x487704){_0x558fad[_0xf21f('0x5e')][_0xf21f('0x61')]=_0x487704['id'];return db[_0xf21f('0x62')][_0xf21f('0x63')](_0x558fad[_0xf21f('0x5e')]);}})[_0xf21f('0x1f')](respondWithResult(_0x136013,null))[_0xf21f('0x28')](handleError(_0x136013,null));};exports['getDispositions']=function(_0x18f394,_0x4358d8,_0x50659a){var _0x4f8812={'raw':![],'where':{}};var _0x5cfc49={};var _0x1b810c={'count':0x0,'rows':[]};return db[_0xf21f('0x4e')][_0xf21f('0x64')]({'where':{'id':_0x18f394['params']['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x4358d8,null))[_0xf21f('0x1f')](function(_0x2ce6b5){if(_0x2ce6b5){_0x5cfc49[_0xf21f('0x3e')]=_[_0xf21f('0x53')](db[_0xf21f('0x62')][_0xf21f('0x52')]);_0x5cfc49[_0xf21f('0x3f')]=_[_0xf21f('0x53')](_0x18f394[_0xf21f('0x3f')]);_0x5cfc49['filters']=_[_0xf21f('0x41')](_0x5cfc49[_0xf21f('0x3e')],_0x5cfc49['query']);_0x4f8812['attributes']=_['intersection'](_0x5cfc49[_0xf21f('0x3e')],qs['fields'](_0x18f394['query'][_0xf21f('0x54')]));_0x4f8812['attributes']=_0x4f8812[_0xf21f('0x42')][_0xf21f('0x43')]?_0x4f8812[_0xf21f('0x42')]:_0x5cfc49[_0xf21f('0x3e')];if(!_0x18f394['query'][_0xf21f('0x44')](_0xf21f('0x45'))){_0x4f8812[_0xf21f('0x2e')]=qs[_0xf21f('0x2e')](_0x18f394[_0xf21f('0x3f')][_0xf21f('0x2e')]);_0x4f8812[_0xf21f('0x2d')]=qs[_0xf21f('0x2d')](_0x18f394[_0xf21f('0x3f')][_0xf21f('0x2d')]);}_0x4f8812[_0xf21f('0x46')]=qs[_0xf21f('0x47')](_0x18f394['query'][_0xf21f('0x47')]);_0x4f8812[_0xf21f('0x48')]=qs[_0xf21f('0x40')](_[_0xf21f('0x65')](_0x18f394[_0xf21f('0x3f')],_0x5cfc49['filters']));_0x4f8812[_0xf21f('0x48')][_0xf21f('0x61')]=_0x2ce6b5['id'];if(_0x18f394[_0xf21f('0x3f')][_0xf21f('0x49')]){_0x4f8812[_0xf21f('0x48')]=_[_0xf21f('0x4a')](_0x4f8812['where'],{'$or':_[_0xf21f('0x3a')](_0x4f8812[_0xf21f('0x42')],function(_0x1bb66a){var _0x530f47={};_0x530f47[_0x1bb66a]={'$like':'%'+_0x18f394[_0xf21f('0x3f')][_0xf21f('0x49')]+'%'};return _0x530f47;})});}_0x4f8812=_['merge']({},_0x4f8812,_0x18f394[_0xf21f('0x4c')]);return db[_0xf21f('0x62')][_0xf21f('0x2c')]({'where':_0x4f8812[_0xf21f('0x48')]})[_0xf21f('0x1f')](function(_0xdb31c6){_0x1b810c[_0xf21f('0x2c')]=_0xdb31c6;if(_0x18f394[_0xf21f('0x3f')][_0xf21f('0x4d')]){_0x4f8812[_0xf21f('0x55')]=[{'all':!![]}];}return db[_0xf21f('0x62')][_0xf21f('0x4f')](_0x4f8812);})[_0xf21f('0x1f')](function(_0x7d7b64){_0x1b810c[_0xf21f('0x50')]=_0x7d7b64;return _0x1b810c;});}})[_0xf21f('0x1f')](respondWithFilteredResult(_0x4358d8,_0x4f8812))[_0xf21f('0x28')](handleError(_0x4358d8,null));};exports[_0xf21f('0x66')]=function(_0xa2970e,_0x2a9e5a,_0x3775bd){return db[_0xf21f('0x4e')]['find']({'where':{'id':_0xa2970e[_0xf21f('0x5f')]['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x2a9e5a,null))[_0xf21f('0x1f')](function(_0x1faa49){if(_0x1faa49){return _0x1faa49[_0xf21f('0x66')](_0xa2970e['query'][_0xf21f('0x67')]);}})[_0xf21f('0x1f')](respondWithStatusCode(_0x2a9e5a,null))[_0xf21f('0x28')](handleError(_0x2a9e5a,null));};exports[_0xf21f('0x68')]=function(_0xba7575,_0x3a9917,_0x404035){if(_0xba7575[_0xf21f('0x5e')]['id']){delete _0xba7575['body']['id'];}return db[_0xf21f('0x4e')]['find']({'where':{'id':_0xba7575[_0xf21f('0x5f')]['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x3a9917,null))[_0xf21f('0x1f')](function(_0x3f65f8){if(_0x3f65f8){_0xba7575[_0xf21f('0x5e')][_0xf21f('0x61')]=_0x3f65f8['id'];return db['CannedAnswer']['create'](_0xba7575['body']);}})[_0xf21f('0x1f')](respondWithResult(_0x3a9917,null))[_0xf21f('0x28')](handleError(_0x3a9917,null));};exports[_0xf21f('0x69')]=function(_0x3a0250,_0x1932c7,_0x5537fe){var _0x1aa99e={'raw':![],'where':{}};var _0x33e707={};var _0x1c51f1={'count':0x0,'rows':[]};return db[_0xf21f('0x4e')][_0xf21f('0x64')]({'where':{'id':_0x3a0250[_0xf21f('0x5f')]['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x1932c7,null))['then'](function(_0x12304a){if(_0x12304a){_0x33e707[_0xf21f('0x3e')]=_['keys'](db[_0xf21f('0x6a')]['rawAttributes']);_0x33e707[_0xf21f('0x3f')]=_['keys'](_0x3a0250[_0xf21f('0x3f')]);_0x33e707[_0xf21f('0x40')]=_['intersection'](_0x33e707[_0xf21f('0x3e')],_0x33e707[_0xf21f('0x3f')]);_0x1aa99e[_0xf21f('0x42')]=_[_0xf21f('0x41')](_0x33e707['model'],qs[_0xf21f('0x54')](_0x3a0250[_0xf21f('0x3f')][_0xf21f('0x54')]));_0x1aa99e[_0xf21f('0x42')]=_0x1aa99e[_0xf21f('0x42')]['length']?_0x1aa99e['attributes']:_0x33e707['model'];if(!_0x3a0250[_0xf21f('0x3f')][_0xf21f('0x44')]('nolimit')){_0x1aa99e[_0xf21f('0x2e')]=qs[_0xf21f('0x2e')](_0x3a0250[_0xf21f('0x3f')][_0xf21f('0x2e')]);_0x1aa99e[_0xf21f('0x2d')]=qs[_0xf21f('0x2d')](_0x3a0250[_0xf21f('0x3f')][_0xf21f('0x2d')]);}_0x1aa99e[_0xf21f('0x46')]=qs['sort'](_0x3a0250[_0xf21f('0x3f')][_0xf21f('0x47')]);_0x1aa99e[_0xf21f('0x48')]=qs['filters'](_[_0xf21f('0x65')](_0x3a0250[_0xf21f('0x3f')],_0x33e707[_0xf21f('0x40')]));_0x1aa99e[_0xf21f('0x48')]['SmsAccountId']=_0x12304a['id'];if(_0x3a0250[_0xf21f('0x3f')]['filter']){_0x1aa99e[_0xf21f('0x48')]=_[_0xf21f('0x4a')](_0x1aa99e['where'],{'$or':_[_0xf21f('0x3a')](_0x1aa99e['attributes'],function(_0x52089e){var _0xd9a1fc={};_0xd9a1fc[_0x52089e]={'$like':'%'+_0x3a0250[_0xf21f('0x3f')][_0xf21f('0x49')]+'%'};return _0xd9a1fc;})});}_0x1aa99e=_[_0xf21f('0x4a')]({},_0x1aa99e,_0x3a0250[_0xf21f('0x4c')]);return db[_0xf21f('0x6a')]['count']({'where':_0x1aa99e[_0xf21f('0x48')]})['then'](function(_0x6058cb){_0x1c51f1[_0xf21f('0x2c')]=_0x6058cb;if(_0x3a0250[_0xf21f('0x3f')][_0xf21f('0x4d')]){_0x1aa99e[_0xf21f('0x55')]=[{'all':!![]}];}return db[_0xf21f('0x6a')][_0xf21f('0x4f')](_0x1aa99e);})[_0xf21f('0x1f')](function(_0x5c1ff0){_0x1c51f1[_0xf21f('0x50')]=_0x5c1ff0;return _0x1c51f1;});}})[_0xf21f('0x1f')](respondWithFilteredResult(_0x1932c7,_0x1aa99e))[_0xf21f('0x28')](handleError(_0x1932c7,null));};exports['removeAnswers']=function(_0x234a7b,_0x4aeab6,_0x35d3c9){return db[_0xf21f('0x4e')]['find']({'where':{'id':_0x234a7b[_0xf21f('0x5f')]['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x4aeab6,null))[_0xf21f('0x1f')](function(_0x27fa29){if(_0x27fa29){return _0x27fa29['removeAnswers'](_0x234a7b[_0xf21f('0x3f')]['ids']);}})[_0xf21f('0x1f')](respondWithStatusCode(_0x4aeab6,null))[_0xf21f('0x28')](handleError(_0x4aeab6,null));};exports[_0xf21f('0x6b')]=function(_0x219af5,_0xa31c39,_0x2b8559){var _0x4010ec={'channel':_0xf21f('0x6c')};var _0x3c1966=[];var _0x37cce0=[];var _0x5679d1={};return db[_0xf21f('0x4e')][_0xf21f('0x56')]({'where':{'id':_0x219af5['params']['id']},'include':[{'model':db[_0xf21f('0x6d')],'as':_0xf21f('0x6e')}]})[_0xf21f('0x1f')](handleEntityNotFound(_0xa31c39,null))[_0xf21f('0x1f')](function(_0x2875b9){_0x4010ec[_0xf21f('0x6f')]=_0x2875b9;_0x4010ec[_0xf21f('0x70')]=_['orderBy'](_0x2875b9[_0xf21f('0x6e')],[_0xf21f('0x71')],['asc']);if(_0x4010ec[_0xf21f('0x6f')][_0xf21f('0x6e')]){delete _0x4010ec[_0xf21f('0x6f')][_0xf21f('0x6e')];}return db[_0xf21f('0x72')][_0xf21f('0x73')]();})[_0xf21f('0x1f')](function(_0x2bc447){if(!_0x2bc447){throw new db[(_0xf21f('0x74'))]['ValidationError'](_0xf21f('0x75'));}_0x3c1966=_[_0xf21f('0x76')](_[_0xf21f('0x53')](_0x2bc447),[_0xf21f('0x77'),'updatedAt']);_0x37cce0=_[_0xf21f('0x76')](_[_0xf21f('0x53')](_0x2bc447),[_0xf21f('0x77'),_0xf21f('0x78'),_0xf21f('0x79'),_0xf21f('0x7a')]);_0x4010ec[_0xf21f('0x5e')]={'mapKey':_0xf21f('0x7b')};if(_0x4010ec['account']['type']){switch(_0x4010ec[_0xf21f('0x6f')][_0xf21f('0x3c')]){case _0xf21f('0x7c'):_0x4010ec[_0xf21f('0x5e')]['from']=_0x219af5['body']['From'];_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x5e')]=_0x219af5[_0xf21f('0x5e')]['Body'];_0x4010ec[_0xf21f('0x5e')]['messageId']=_0x219af5[_0xf21f('0x5e')][_0xf21f('0x7d')];break;case _0xf21f('0x7e'):_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x7f')]='+'+_0x219af5['body'][_0xf21f('0x80')];_0x4010ec[_0xf21f('0x5e')]['body']=_0x219af5[_0xf21f('0x5e')][_0xf21f('0x81')];break;case'connectel':_0x4010ec[_0xf21f('0x5e')]['from']=_0x219af5['body'][_0xf21f('0x7f')];_0x4010ec['body'][_0xf21f('0x5e')]=_0x219af5[_0xf21f('0x5e')][_0xf21f('0x25')];break;case'clicksend':_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x7f')]=_0x219af5[_0xf21f('0x5e')][_0xf21f('0x7f')];_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x5e')]=_0x219af5[_0xf21f('0x5e')][_0xf21f('0x5e')];_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x82')]=_0x219af5['body']['message_id'];break;case _0xf21f('0x83'):_0x4010ec['body'][_0xf21f('0x7f')]=_0x219af5[_0xf21f('0x5e')]['From'];_0x4010ec[_0xf21f('0x5e')]['body']=_0x219af5[_0xf21f('0x5e')][_0xf21f('0x84')];_0x4010ec[_0xf21f('0x5e')]['messageId']=_0x219af5[_0xf21f('0x5e')]['MessageUUID'];break;case _0xf21f('0x85'):_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x7f')]='+'+_0x219af5[_0xf21f('0x5e')][_0xf21f('0x86')][0x0][_0xf21f('0x7f')];_0x4010ec[_0xf21f('0x5e')]['body']=_0x219af5['body'][_0xf21f('0x86')][0x0]['text'];_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x82')]=_0x219af5['body'][_0xf21f('0x86')][0x0]['messageId'];break;case _0xf21f('0x87'):_0x4010ec['body'][_0xf21f('0x7f')]=_0x219af5[_0xf21f('0x5e')]['originatingAddress'];_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x5e')]=_0x219af5[_0xf21f('0x5e')][_0xf21f('0x88')]['message'];break;case'clickatell':_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x7f')]=_0x219af5[_0xf21f('0x5e')][_0xf21f('0x89')];_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x5e')]=_0x219af5['body'][_0xf21f('0x81')];_0x4010ec[_0xf21f('0x5e')]['messageId']=_0x219af5['body'][_0xf21f('0x8a')];break;case _0xf21f('0x8b'):_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x82')]=_0x219af5['body'][0x0][_0xf21f('0x25')]['id'];_0x4010ec['body'][_0xf21f('0x7f')]=_0x219af5['body'][0x0]['message'][_0xf21f('0x7f')];_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x5e')]=_0x219af5[_0xf21f('0x5e')][0x0][_0xf21f('0x25')][_0xf21f('0x81')];break;case _0xf21f('0x8c'):_0x4010ec[_0xf21f('0x5e')]['from']=_0x219af5['body'][_0xf21f('0x7f')];_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x5e')]=_0x219af5[_0xf21f('0x5e')][_0xf21f('0x25')];_0x4010ec['body'][_0xf21f('0x82')]=_0x219af5[_0xf21f('0x5e')][_0xf21f('0x8d')];break;}}if(_0x4010ec[_0xf21f('0x5e')]['id']){delete _0x4010ec[_0xf21f('0x5e')]['id'];}if(_[_0xf21f('0x8e')](_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x7f')])){throw new db[(_0xf21f('0x74'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0xf21f('0x8e')](_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x5e')])||_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x5e')]===''){throw new db[(_0xf21f('0x74'))][(_0xf21f('0x8f'))](_0xf21f('0x90'));}if(_['isNil'](_0x4010ec['body'][_0xf21f('0x91')])){throw new db[(_0xf21f('0x74'))][(_0xf21f('0x8f'))](_0xf21f('0x92')+_0x37cce0);}if(!_['includes'](_0x37cce0,_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x91')])){throw new db['Sequelize'][(_0xf21f('0x8f'))](_0xf21f('0x93')+_0x37cce0);}_0x5679d1[_0x4010ec['body'][_0xf21f('0x91')]]=_0x4010ec[_0xf21f('0x5e')]['from'];return db[_0xf21f('0x94')][_0xf21f('0x56')]({'where':{'id':_0x4010ec[_0xf21f('0x6f')][_0xf21f('0x7a')]},'include':[{'model':db[_0xf21f('0x72')],'as':_0xf21f('0x95'),'where':_0x5679d1,'limit':0x1,'order':[['updatedAt',_0xf21f('0x96')]]}]});})[_0xf21f('0x1f')](handleEntityNotFound(_0xa31c39,null))[_0xf21f('0x1f')](function(_0xe79b8b){if(_0xe79b8b){_0x4010ec[_0xf21f('0x97')]=_[_0xf21f('0x98')](_0xe79b8b,[_0xf21f('0x95')]);if(_0xe79b8b[_0xf21f('0x95')]['length']){return _0xe79b8b[_0xf21f('0x95')][0x0];}var _0x698730=_[_0xf21f('0x1b')](_0x4010ec[_0xf21f('0x5e')],{'firstName':_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x7f')],'ListId':_0xe79b8b['id']});_0x698730[_0x4010ec['body']['mapKey']]=_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x7f')];return db[_0xf21f('0x72')]['create'](_0x698730,{'fields':_0x3c1966,'raw':!![]});}})[_0xf21f('0x1f')](handleEntityNotFound(_0xa31c39,null))[_0xf21f('0x1f')](function(_0x4b14f3){if(_0x4b14f3){_0x4010ec[_0xf21f('0x99')]=_0x4b14f3;var _0x276a21={'ContactId':_0x4b14f3['id'],'phone':_0x4010ec['body']['from'],'SmsAccountId':_0x219af5['params']['id']};var _0x438613={'ContactId':_0x4b14f3['id'],'SmsAccountId':_0x219af5[_0xf21f('0x5f')]['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x438613})[_0xf21f('0x1f')](function(_0x3a33a3){if(_0x3a33a3){return[_0x3a33a3,![]];}return db[_0xf21f('0x9a')][_0xf21f('0x63')](_0x276a21)[_0xf21f('0x1f')](function(_0x5ba3df){return[_0x5ba3df,!![]];});});}})[_0xf21f('0x9b')](function(_0x14254e,_0x30b65c){_0x4010ec[_0xf21f('0x9c')]=_0x14254e[_0xf21f('0x34')]({'plain':!![]});_0x4010ec['interaction'][_0xf21f('0x9d')]=![];if(_0x30b65c){if(_0x4010ec['account']['autoclose']){_0x4010ec[_0xf21f('0x70')][_0xf21f('0x9e')]({'id':0x0,'priority':_0x4010ec[_0xf21f('0x70')][_0xf21f('0x43')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xf21f('0x9f')});}_0x4010ec[_0xf21f('0x9c')][_0xf21f('0x9d')]=!![];}return db[_0xf21f('0xa0')][_0xf21f('0x63')]({'phone':_0x4010ec['body'][_0xf21f('0x7f')],'messageId':_0x4010ec[_0xf21f('0x5e')][_0xf21f('0x82')],'body':_0x4010ec['body'][_0xf21f('0x5e')],'SmsAccountId':_0x219af5['params']['id'],'SmsInteractionId':_0x14254e['id'],'direction':'in','ContactId':_0x14254e[_0xf21f('0xa1')],'AttachmentId':_0x4010ec[_0xf21f('0x5e')][_0xf21f('0xa2')]});})['then'](function(_0x461f79){_0x4010ec[_0xf21f('0x25')]=_0x461f79;if(_0x4010ec[_0xf21f('0x9c')][_0xf21f('0xa3')]){return db[_0xf21f('0xa4')]['find']({'attributes':['id',_0xf21f('0x37')],'where':{'id':_0x4010ec[_0xf21f('0x9c')]['UserId']}})[_0xf21f('0x1f')](function(_0x388488){if(_0x388488){_0x4010ec[_0xf21f('0x70')][_0xf21f('0xa5')]({'id':0x0,'priority':0x0,'app':_0xf21f('0xa6'),'appdata':_0x388488[_0xf21f('0x37')]+','+(_0x4010ec[_0xf21f('0x6f')][_0xf21f('0xa7')]||0xa),'interval':_0xf21f('0x9f')});}return respondWithRpcPromise(_0xf21f('0xa8'),'startRouting',_0x4010ec);});}return respondWithRpcPromise('Start',_0xf21f('0xa9'),_0x4010ec);})[_0xf21f('0x1f')](function(_0x5a4043){if(_0x5a4043){var _0xcdb8af=0xc8;var _0x23376c=_0xf21f('0xaa');logger['info'](_0xf21f('0x23'),_0x23376c,_0xcdb8af,_0xf21f('0xab'));logger[_0xf21f('0x22')](_0xf21f('0xac'),_0x23376c,_0xcdb8af,'entity\x20found',JSON[_0xf21f('0xad')](_0x5a4043));if(_0x4010ec[_0xf21f('0x6f')][_0xf21f('0x3c')]==='twilio'){return _0xa31c39[_0xf21f('0x2a')](_0xcdb8af)[_0xf21f('0x2f')](_0xf21f('0xae'),'text/xml')[_0xf21f('0xaf')](_0xf21f('0xb0'));}else{return _0xa31c39[_0xf21f('0x2a')](_0xcdb8af)[_0xf21f('0x2b')](_0x5a4043);}}})['catch'](handleError(_0xa31c39,null));};exports[_0xf21f('0xb1')]=function(_0x199e48,_0x548484,_0x20e96c){return db[_0xf21f('0x4e')][_0xf21f('0x64')]({'where':{'id':_0x199e48[_0xf21f('0x5f')]['id']}})['then'](handleEntityNotFound(_0x548484,null))[_0xf21f('0x1f')](function(_0x3e0bb0){if(_0x3e0bb0){return db[_0xf21f('0xb2')][_0xf21f('0xb3')](function(_0x36093e){return db['SmsApplication'][_0xf21f('0x36')]({'where':{'SmsAccountId':_0x199e48[_0xf21f('0x5f')]['id']},'transaction':_0x36093e})[_0xf21f('0x1f')](function(_0xe88b3a){var _0x553c6e=_['map'](_0x199e48[_0xf21f('0x5e')],function(_0x309ed3){_0x309ed3[_0xf21f('0x61')]=_0x199e48[_0xf21f('0x5f')]['id'];return _0x309ed3;});return db['SmsApplication'][_0xf21f('0xb4')](_0x553c6e,{'transaction':_0x36093e});});})[_0xf21f('0x1f')](function(){return db[_0xf21f('0x6d')][_0xf21f('0xb5')]({'where':{'SmsAccountId':_0x199e48['params']['id']},'order':_0xf21f('0x71')});});}})[_0xf21f('0x1f')](respondWithResult(_0x548484,null))[_0xf21f('0x28')](handleError(_0x548484,null));};exports[_0xf21f('0xb6')]=function(_0x414bc1,_0xb9ef4e,_0x3868b6){var _0x44a51b={};var _0x37f7f0={};var _0x3244b7;var _0x5b9207;return db[_0xf21f('0x4e')][_0xf21f('0x64')]({'where':{'id':_0x414bc1[_0xf21f('0x5f')]['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0xb9ef4e,null))[_0xf21f('0x1f')](function(_0x1f118c){if(_0x1f118c){_0x3244b7=_0x1f118c;_0x37f7f0[_0xf21f('0x3e')]=_['keys'](db['SmsApplication'][_0xf21f('0x52')]);_0x37f7f0['query']=_[_0xf21f('0x53')](_0x414bc1[_0xf21f('0x3f')]);_0x37f7f0[_0xf21f('0x40')]=_['intersection'](_0x37f7f0[_0xf21f('0x3e')],_0x37f7f0[_0xf21f('0x3f')]);_0x44a51b[_0xf21f('0x42')]=_[_0xf21f('0x41')](_0x37f7f0[_0xf21f('0x3e')],qs[_0xf21f('0x54')](_0x414bc1[_0xf21f('0x3f')][_0xf21f('0x54')]));_0x44a51b[_0xf21f('0x42')]=_0x44a51b[_0xf21f('0x42')]['length']?_0x44a51b[_0xf21f('0x42')]:_0x37f7f0['model'];_0x44a51b[_0xf21f('0x46')]=qs['sort'](_0x414bc1[_0xf21f('0x3f')][_0xf21f('0x47')]);_0x44a51b['where']=qs[_0xf21f('0x40')](_[_0xf21f('0x65')](_0x414bc1[_0xf21f('0x3f')],_0x37f7f0[_0xf21f('0x40')]));if(_0x414bc1['query']['filter']){_0x44a51b[_0xf21f('0x48')]=_[_0xf21f('0x4a')](_0x44a51b[_0xf21f('0x48')],{'$or':_[_0xf21f('0x3a')](_0x44a51b[_0xf21f('0x42')],function(_0x404b73){var _0x23d336={};_0x23d336[_0x404b73]={'$like':'%'+_0x414bc1[_0xf21f('0x3f')]['filter']+'%'};return _0x23d336;})});}_0x44a51b=_[_0xf21f('0x4a')]({},_0x44a51b,_0x414bc1[_0xf21f('0x4c')]);return _0x3244b7[_0xf21f('0xb6')](_0x44a51b);}})['then'](function(_0x3b7f7b){if(_0x3b7f7b){_0x5b9207=_0x3b7f7b[_0xf21f('0x43')];if(!_0x414bc1['query'][_0xf21f('0x44')](_0xf21f('0x45'))){_0x44a51b[_0xf21f('0x2e')]=qs['limit'](_0x414bc1['query'][_0xf21f('0x2e')]);_0x44a51b['offset']=qs[_0xf21f('0x2d')](_0x414bc1[_0xf21f('0x3f')]['offset']);}return _0x3244b7['getApplications'](_0x44a51b);}})[_0xf21f('0x1f')](function(_0x84f07){if(_0x84f07){return _0x84f07?{'count':_0x5b9207,'rows':_0x84f07}:null;}})[_0xf21f('0x1f')](respondWithResult(_0xb9ef4e,null))['catch'](handleError(_0xb9ef4e,null));};exports[_0xf21f('0xb7')]=function(_0x3208b7,_0x5eaa04,_0x48204b){var _0x531a2a={'raw':![],'where':{}};var _0x3cc5f={};var _0xef825b={'count':0x0,'rows':[]};return db[_0xf21f('0x4e')][_0xf21f('0x64')]({'where':{'id':_0x3208b7[_0xf21f('0x5f')]['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x5eaa04,null))[_0xf21f('0x1f')](function(_0x7f41e2){if(_0x7f41e2){_0x3cc5f[_0xf21f('0x3e')]=_['keys'](db[_0xf21f('0x9a')][_0xf21f('0x52')]);_0x3cc5f['query']=_[_0xf21f('0x53')](_0x3208b7[_0xf21f('0x3f')]);_0x3cc5f['filters']=_['intersection'](_0x3cc5f[_0xf21f('0x3e')],_0x3cc5f[_0xf21f('0x3f')]);_0x531a2a[_0xf21f('0x42')]=_[_0xf21f('0x41')](_0x3cc5f['model'],qs[_0xf21f('0x54')](_0x3208b7[_0xf21f('0x3f')][_0xf21f('0x54')]));_0x531a2a[_0xf21f('0x42')]=_0x531a2a[_0xf21f('0x42')][_0xf21f('0x43')]?_0x531a2a[_0xf21f('0x42')]:_0x3cc5f[_0xf21f('0x3e')];if(!_0x3208b7['query'][_0xf21f('0x44')]('nolimit')){_0x531a2a[_0xf21f('0x2e')]=qs[_0xf21f('0x2e')](_0x3208b7[_0xf21f('0x3f')][_0xf21f('0x2e')]);_0x531a2a[_0xf21f('0x2d')]=qs[_0xf21f('0x2d')](_0x3208b7['query'][_0xf21f('0x2d')]);}_0x531a2a['order']=qs['sort'](_0x3208b7[_0xf21f('0x3f')][_0xf21f('0x47')]);_0x531a2a['where']=qs[_0xf21f('0x40')](_['pick'](_0x3208b7[_0xf21f('0x3f')],_0x3cc5f[_0xf21f('0x40')]));_0x531a2a[_0xf21f('0x48')][_0xf21f('0x61')]=_0x7f41e2['id'];if(_0x3208b7[_0xf21f('0x3f')]['filter']){_0x531a2a[_0xf21f('0x48')]=_[_0xf21f('0x4a')](_0x531a2a[_0xf21f('0x48')],{'$or':_[_0xf21f('0x3a')](_0x531a2a[_0xf21f('0x42')],function(_0x2c5102){var _0x20cde6={};_0x20cde6[_0x2c5102]={'$like':'%'+_0x3208b7[_0xf21f('0x3f')]['filter']+'%'};return _0x20cde6;})});}_0x531a2a=_[_0xf21f('0x4a')]({},_0x531a2a,_0x3208b7[_0xf21f('0x4c')]);return db[_0xf21f('0x9a')][_0xf21f('0x2c')]({'where':_0x531a2a['where']})[_0xf21f('0x1f')](function(_0x5e9694){_0xef825b[_0xf21f('0x2c')]=_0x5e9694;if(_0x3208b7[_0xf21f('0x3f')]['includeAll']){_0x531a2a[_0xf21f('0x55')]=[{'model':db[_0xf21f('0x72')],'as':_0xf21f('0xb8'),'required':![]},{'model':db['User'],'as':_0xf21f('0xb9'),'attributes':[_0xf21f('0x37'),_0xf21f('0xba'),'internal'],'required':![]},{'model':db[_0xf21f('0xbb')],'as':_0xf21f('0xbc'),'attributes':['id',_0xf21f('0x37'),_0xf21f('0xbd')],'where':_0x3208b7['query'][_0xf21f('0xbe')]?{'id':_0x3208b7[_0xf21f('0x3f')][_0xf21f('0xbe')]}:undefined,'required':_0x3208b7[_0xf21f('0x3f')][_0xf21f('0xbe')]?!![]:![]}];}return db[_0xf21f('0x9a')][_0xf21f('0x4f')](_0x531a2a);})[_0xf21f('0x1f')](function(_0x36c852){_0xef825b['rows']=_0x36c852;return _0xef825b;});}})[_0xf21f('0x1f')](respondWithFilteredResult(_0x5eaa04,_0x531a2a))[_0xf21f('0x28')](handleError(_0x5eaa04,null));};exports['send']=function(_0x123bb7,_0x3f5430,_0x531921){var _0x1f7cc7,_0x3ae9b1,_0x45260c;if(_['isNil'](_0x123bb7['body'][_0xf21f('0x5e')])||_0x123bb7['body'][_0xf21f('0x5e')]===''){throw new db[(_0xf21f('0x74'))][(_0xf21f('0x8f'))](_0xf21f('0x90'));}if(_[_0xf21f('0x8e')](_0x123bb7[_0xf21f('0x5e')]['to'])){throw new db[(_0xf21f('0x74'))]['ValidationError']('to\x20is\x20mandatory');}_0x1f7cc7=_0x123bb7[_0xf21f('0x5e')]['to'];return db[_0xf21f('0x4e')][_0xf21f('0x56')]({'where':{'id':_0x123bb7['params']['id']},'include':[{'model':db[_0xf21f('0x94')],'as':_0xf21f('0xbf'),'include':[{'model':db[_0xf21f('0x72')],'as':'Contacts','where':{'mobile':_0x1f7cc7},'limit':0x1,'order':[[_0xf21f('0x78'),'DESC']]}]}]})[_0xf21f('0x1f')](handleEntityNotFound(_0x3f5430,null))[_0xf21f('0x1f')](function(_0x322a09){if(_0x322a09&&_0x322a09[_0xf21f('0xbf')]){_0x3ae9b1=_0x322a09[_0xf21f('0x34')]({'plain':!![]});if(_0x3ae9b1[_0xf21f('0xbf')]&&_0x3ae9b1[_0xf21f('0xbf')][_0xf21f('0x95')]['length']){return _0x3ae9b1[_0xf21f('0xbf')][_0xf21f('0x95')][0x0];}return db['CmContact'][_0xf21f('0x63')](_['defaults'](_0x123bb7[_0xf21f('0x5e')],{'firstName':_0x1f7cc7,'mobile':_0x1f7cc7,'phone':_0x1f7cc7,'ListId':_0x3ae9b1['ListId']}));}})[_0xf21f('0x1f')](handleEntityNotFound(_0x3f5430,null))[_0xf21f('0x1f')](function(_0x3f6364){if(_0x3f6364){_0x45260c=_0x3f6364;return db[_0xf21f('0x9a')][_0xf21f('0x56')]({'where':{'ContactId':_0x45260c['id'],'closed':![],'SmsAccountId':_0x3ae9b1['id']}})[_0xf21f('0x1f')](function(_0x4a577b){if(_0x4a577b){return[_0x4a577b,![]];}return db['SmsInteraction'][_0xf21f('0x63')]({'UserId':_0x123bb7['user']['id'],'ContactId':_0x45260c['id'],'SmsAccountId':_0x3ae9b1['id'],'phone':_0x1f7cc7,'firstMsgDirection':_0xf21f('0xc0'),'Messages':[_['merge'](_0x123bb7['body'],{'read':![],'body':_0x123bb7[_0xf21f('0x5e')][_0xf21f('0x5e')],'phone':_0x1f7cc7,'SmsAccountId':_0x3ae9b1['id'],'UserId':_0x123bb7[_0xf21f('0x57')]['id'],'ContactId':_0x45260c['id']})]},{'include':[{'model':db[_0xf21f('0xa0')],'as':_0xf21f('0xc1')}]})[_0xf21f('0x1f')](function(_0x5ef297){return[_0x5ef297,!![]];});});}})[_0xf21f('0x9b')](function(_0x3fd251,_0x50ada6){if(_0x50ada6){return _0x3fd251;}return db[_0xf21f('0xa0')][_0xf21f('0x63')](_[_0xf21f('0x4a')](_0x123bb7[_0xf21f('0x5e')],{'read':![],'body':_0x123bb7['body'][_0xf21f('0x5e')],'phone':_0x1f7cc7,'SmsAccountId':_0x3ae9b1['id'],'SmsInteractionId':_0x3fd251['id'],'UserId':_0x123bb7[_0xf21f('0x57')]['id'],'ContactId':_0x45260c['id']}))['then'](function(_0x22d707){_0x3fd251['dataValues'][_0xf21f('0xc1')]=[];_0x3fd251[_0xf21f('0xc2')][_0xf21f('0xc1')]['push'](_0x22d707['dataValues']);return _0x3fd251;});})[_0xf21f('0x1f')](respondWithResult(_0x3f5430,null))['catch'](handleError(_0x3f5430,null));};exports[_0xf21f('0x2a')]=function(_0x4541f6,_0x45cb0b,_0x14d0ed){if(_0x4541f6[_0xf21f('0x5e')]['id']){delete _0x4541f6[_0xf21f('0x5e')]['id'];}var _0x3428c1,_0x34a063,_0x38f08f;return db[_0xf21f('0x4e')][_0xf21f('0x56')]({'where':{'id':_0x4541f6['params']['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x45cb0b,null))[_0xf21f('0x1f')](function(_0x5d0c1f){if(_0x5d0c1f){_0x38f08f=_0x5d0c1f;logger['debug'](_0xf21f('0x23'),_0xf21f('0x2a'),_0xf21f('0xc3'),_0x5d0c1f['type'],util[_0xf21f('0xc4')](_0x4541f6[_0xf21f('0x5e')],{'showHidden':![],'depth':null}));switch(_0x5d0c1f[_0xf21f('0x3c')]){case'skebby':if(_0x4541f6[_0xf21f('0x5e')][_0xf21f('0xc5')]&&_0x4541f6[_0xf21f('0x5e')]['status']){_0x34a063=_0x4541f6[_0xf21f('0x5e')]['status'];return db[_0xf21f('0xa0')][_0xf21f('0x56')]({'where':{'messageId':_0x4541f6[_0xf21f('0x5e')]['skebby_dispatch_id']}});}break;case _0xf21f('0xc6'):if(_0x4541f6['body'][_0xf21f('0xc7')]&&_0x4541f6[_0xf21f('0x5e')]['statusInt']){_0x34a063=_0x4541f6[_0xf21f('0x5e')][_0xf21f('0xc8')];return db['SmsMessage'][_0xf21f('0x56')]({'where':{'messageId':_0x4541f6['body'][_0xf21f('0xc7')]}});}break;case'clicksend':if(_0x4541f6['body'][_0xf21f('0xc9')]&&_0x4541f6[_0xf21f('0x5e')][_0xf21f('0xca')]){_0x34a063=_0x4541f6['body'][_0xf21f('0xca')];return db[_0xf21f('0xa0')]['find']({'where':{'messageId':_0x4541f6[_0xf21f('0x5e')][_0xf21f('0xc9')]}});}break;case _0xf21f('0x85'):var _0x79040=_0x4541f6['body'][_0xf21f('0x86')][0x0];if(_0x79040['messageId']&&_0x79040['status'][_0xf21f('0xcb')]===_0xf21f('0xcc')){_0x34a063=_0x79040[_0xf21f('0x2a')][_0xf21f('0xcb')];return db[_0xf21f('0xa0')][_0xf21f('0x56')]({'where':{'messageId':_0x79040[_0xf21f('0x82')]}});}break;case'clickatell':if(_0x4541f6['body']['messageId']&&_0x4541f6[_0xf21f('0x5e')][_0xf21f('0x2a')]){_0x34a063=_0x4541f6['body'][_0xf21f('0x2a')];return db['SmsMessage'][_0xf21f('0x56')]({'where':{'messageId':_0x4541f6[_0xf21f('0x5e')]['messageId']}});}break;case _0xf21f('0x8b'):if(_0x4541f6[_0xf21f('0x5e')][0x0]['message']['id']){_0x34a063=_0x4541f6[_0xf21f('0x5e')][0x0][_0xf21f('0x3c')];return db[_0xf21f('0xa0')][_0xf21f('0x56')]({'where':{'messageId':_0x4541f6[_0xf21f('0x5e')][0x0][_0xf21f('0x25')]['id']}});}break;case'intelepeer':if(_0x4541f6[_0xf21f('0x5e')][_0xf21f('0xcd')]&&_0x4541f6[_0xf21f('0x5e')][_0xf21f('0x2a')]){_0x34a063=_0x4541f6[_0xf21f('0x5e')]['status'];return db[_0xf21f('0xa0')][_0xf21f('0x56')]({'where':{'messageId':_0x4541f6[_0xf21f('0x5e')][_0xf21f('0xcd')]}});}break;}}})['then'](handleEntityNotFound(_0x45cb0b,null))[_0xf21f('0x1f')](function(_0x171112){if(_0x171112){_0x3428c1=_0x171112;switch(_0x38f08f[_0xf21f('0x3c')]){case _0xf21f('0x7e'):if(_0x34a063==='DELIVERED'){return _0x3428c1[_0xf21f('0x33')]({'read':!![]});}else{logger[_0xf21f('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status','skebby',util[_0xf21f('0xc4')](_0x4541f6[_0xf21f('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xf21f('0xc6'):if(_0x34a063==='1'){return _0x3428c1[_0xf21f('0x33')]({'read':!![]});}else{logger[_0xf21f('0x24')](_0xf21f('0x23'),_0xf21f('0x2a'),'skebby',util[_0xf21f('0xc4')](_0x4541f6[_0xf21f('0x5e')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x4541f6[_0xf21f('0x5e')][_0xf21f('0xce')]&&_0x34a063>=0xc8&&_0x34a063<=0xce){return _0x3428c1[_0xf21f('0x33')]({'read':!![]});}else{logger[_0xf21f('0x24')](_0xf21f('0x23'),_0xf21f('0x2a'),_0xf21f('0xcf'),util[_0xf21f('0xc4')](_0x4541f6[_0xf21f('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xf21f('0x85'):var _0x45c2ca=_0x4541f6[_0xf21f('0x5e')][_0xf21f('0x86')][0x0];if(_0x45c2ca[_0xf21f('0x2a')][_0xf21f('0xcb')]===_0xf21f('0xcc')){return _0x3428c1[_0xf21f('0x33')]({'read':!![]});}else{logger['error'](_0xf21f('0x23'),_0xf21f('0x2a'),'infobip',util[_0xf21f('0xc4')](_0x4541f6[_0xf21f('0x5e')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x34a063==_0xf21f('0xd0')||_0x34a063==_0xf21f('0xd1')){return _0x3428c1[_0xf21f('0x33')]({'read':!![]});}else{logger[_0xf21f('0x24')](_0xf21f('0x23'),_0xf21f('0x2a'),_0xf21f('0xd2'),util['inspect'](_0x4541f6[_0xf21f('0x5e')],{'showHidden':![],'depth':null}));}break;case _0xf21f('0x8b'):if(_0x34a063==_0xf21f('0xd3')){return _0x3428c1[_0xf21f('0x33')]({'read':!![]});}else{logger[_0xf21f('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xf21f('0x8b'),util[_0xf21f('0xc4')](_0x4541f6[_0xf21f('0x5e')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x34a063===_0xf21f('0xd4')||_0x34a063===_0xf21f('0xd5')){return _0x3428c1[_0xf21f('0x33')]({'read':!![]});}else{logger[_0xf21f('0x24')](_0xf21f('0x23'),_0xf21f('0x2a'),_0xf21f('0x8c'),util[_0xf21f('0xc4')](_0x4541f6[_0xf21f('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x3428c1;}})[_0xf21f('0x1f')](respondWithResult(_0x45cb0b,null))[_0xf21f('0x28')](handleError(_0x45cb0b,null));};exports[_0xf21f('0xd6')]=function(_0x1f7737,_0x50c734,_0x1b5d83){var _0x7252ea,_0x1789ec,_0x477519;return db[_0xf21f('0x4e')]['find']({'where':{'id':_0x1f7737[_0xf21f('0x5f')]['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x50c734,null))[_0xf21f('0x1f')](function(_0x42030e){if(_0x42030e){_0x477519=_0x42030e;logger[_0xf21f('0x22')](_0xf21f('0x23'),_0xf21f('0x2a'),'received\x20delivery\x20report\x20from',_0x42030e[_0xf21f('0x3c')],util[_0xf21f('0xc4')](_0x1f7737[_0xf21f('0x3f')],{'showHidden':![],'depth':null}));switch(_0x42030e['type']){case _0xf21f('0x87'):if(_0x1f7737[_0xf21f('0x3f')][_0xf21f('0xd7')]&&_0x1f7737[_0xf21f('0x3f')][_0xf21f('0xd8')]){_0x1789ec=_0x1f7737[_0xf21f('0x3f')]['state'];return db[_0xf21f('0xa0')][_0xf21f('0x56')]({'where':{'messageId':_0x1f7737['query']['message-id']}});}break;}}})[_0xf21f('0x1f')](handleEntityNotFound(_0x50c734,null))[_0xf21f('0x1f')](function(_0x432d6c){if(_0x432d6c){_0x7252ea=_0x432d6c;switch(_0x477519['type']){case'csc':if(_0x1789ec==='2'||_0x1789ec==='6'){return _0x7252ea[_0xf21f('0x33')]({'read':!![]});}else{logger[_0xf21f('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf21f('0x2a'),_0xf21f('0x87'),util['inspect'](_0x1f7737[_0xf21f('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x7252ea;}})[_0xf21f('0x1f')](respondWithResult(_0x50c734,null))[_0xf21f('0x28')](handleError(_0x50c734,null));};exports[_0xf21f('0xd9')]=function(_0x13290a,_0x34c639,_0x605ff6){return db[_0xf21f('0x4e')]['find']({'where':{'id':_0x13290a[_0xf21f('0x5f')]['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x34c639,null))['then'](function(_0x1b9983){if(_0x1b9983){return _0x1b9983[_0xf21f('0xd9')](_0x13290a[_0xf21f('0x5e')]['ids'],_[_0xf21f('0x98')](_0x13290a[_0xf21f('0x5e')],[_0xf21f('0x67'),'id'])||{})[_0xf21f('0x9b')](function(_0x20d4a0){for(var _0x32745a=0x0;_0x32745a<_0x13290a[_0xf21f('0x5e')][_0xf21f('0x67')][_0xf21f('0x43')];_0x32745a+=0x1){socket[_0xf21f('0xda')](_0xf21f('0xdb'),{'UserId':_0x13290a[_0xf21f('0x5e')][_0xf21f('0x67')][_0x32745a],'SmsAccountId':_0x13290a['params']['id']});}return _0x20d4a0;});}})['then'](respondWithResult(_0x34c639,null))[_0xf21f('0x28')](handleError(_0x34c639,null));};exports[_0xf21f('0xdc')]=function(_0x2b4fd9,_0x2cc62e,_0x48595f){return db[_0xf21f('0x4e')][_0xf21f('0x56')]({'where':{'id':_0x2b4fd9[_0xf21f('0x5f')]['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x2cc62e,null))[_0xf21f('0x1f')](function(_0x190a41){if(_0x190a41){return _0x190a41[_0xf21f('0xdc')](_0x2b4fd9[_0xf21f('0x3f')][_0xf21f('0x67')])[_0xf21f('0x1f')](function(){if(_[_0xf21f('0xdd')](_0x2b4fd9[_0xf21f('0x3f')][_0xf21f('0x67')])){for(var _0x400b9f=0x0;_0x400b9f<_0x2b4fd9[_0xf21f('0x3f')]['ids'][_0xf21f('0x43')];_0x400b9f+=0x1){socket[_0xf21f('0xda')](_0xf21f('0xde'),{'UserId':Number(_0x2b4fd9[_0xf21f('0x3f')][_0xf21f('0x67')][_0x400b9f]),'SmsAccountId':Number(_0x2b4fd9[_0xf21f('0x5f')]['id'])});}}else{socket['emit'](_0xf21f('0xde'),{'UserId':Number(_0x2b4fd9['query']['ids']),'SmsAccountId':Number(_0x2b4fd9[_0xf21f('0x5f')]['id'])});}});}})[_0xf21f('0x1f')](respondWithStatusCode(_0x2cc62e,null))[_0xf21f('0x28')](handleError(_0x2cc62e,null));};exports[_0xf21f('0xdf')]=function(_0x5d668f,_0x4efd38,_0x39ae9b){var _0xad5f1b={};var _0x324eb5={};var _0x28a153;var _0x4bc7ab;return db[_0xf21f('0x4e')][_0xf21f('0x64')]({'where':{'id':_0x5d668f['params']['id']}})[_0xf21f('0x1f')](handleEntityNotFound(_0x4efd38,null))[_0xf21f('0x1f')](function(_0x550263){if(_0x550263){_0x28a153=_0x550263;_0x324eb5['model']=_['keys'](db[_0xf21f('0xa4')]['rawAttributes']);_0x324eb5[_0xf21f('0x3f')]=_[_0xf21f('0x53')](_0x5d668f['query']);_0x324eb5[_0xf21f('0x40')]=_[_0xf21f('0x41')](_0x324eb5[_0xf21f('0x3e')],_0x324eb5[_0xf21f('0x3f')]);_0xad5f1b[_0xf21f('0x42')]=_['intersection'](_0x324eb5['model'],qs[_0xf21f('0x54')](_0x5d668f['query'][_0xf21f('0x54')]));_0xad5f1b[_0xf21f('0x42')]=_0xad5f1b[_0xf21f('0x42')]['length']?_0xad5f1b['attributes']:_0x324eb5[_0xf21f('0x3e')];_0xad5f1b[_0xf21f('0x46')]=qs[_0xf21f('0x47')](_0x5d668f[_0xf21f('0x3f')][_0xf21f('0x47')]);_0xad5f1b[_0xf21f('0x48')]=qs[_0xf21f('0x40')](_[_0xf21f('0x65')](_0x5d668f[_0xf21f('0x3f')],_0x324eb5['filters']));if(_0x5d668f[_0xf21f('0x3f')][_0xf21f('0x49')]){_0xad5f1b['where']=_[_0xf21f('0x4a')](_0xad5f1b[_0xf21f('0x48')],{'$or':_[_0xf21f('0x3a')](_0xad5f1b[_0xf21f('0x42')],function(_0x3a5a6a){var _0x2560ce={};_0x2560ce[_0x3a5a6a]={'$like':'%'+_0x5d668f['query'][_0xf21f('0x49')]+'%'};return _0x2560ce;})});}_0xad5f1b=_[_0xf21f('0x4a')]({},_0xad5f1b,_0x5d668f['options']);return _0x28a153[_0xf21f('0xdf')](_0xad5f1b);}})[_0xf21f('0x1f')](function(_0x38d6a3){if(_0x38d6a3){_0x4bc7ab=_0x38d6a3[_0xf21f('0x43')];if(!_0x5d668f['query']['hasOwnProperty'](_0xf21f('0x45'))){_0xad5f1b[_0xf21f('0x2e')]=qs[_0xf21f('0x2e')](_0x5d668f[_0xf21f('0x3f')]['limit']);_0xad5f1b[_0xf21f('0x2d')]=qs[_0xf21f('0x2d')](_0x5d668f[_0xf21f('0x3f')][_0xf21f('0x2d')]);}return _0x28a153[_0xf21f('0xdf')](_0xad5f1b);}})[_0xf21f('0x1f')](function(_0x5d2666){if(_0x5d2666){return _0x5d2666?{'count':_0x4bc7ab,'rows':_0x5d2666}:null;}})['then'](respondWithResult(_0x4efd38,null))['catch'](handleError(_0x4efd38,null));}; \ No newline at end of file +var _0x439e=['fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','DESC','List','Messages','dataValues','received\x20delivery\x20report\x20from','SmsMessage','skebby_dispatch_id','requestid','statusInt','status_code','DELIVERED','groupName','clickatell','redif','inspect','clicksend','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','state','message-id','addAgents','emit','removeAgents','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','client','http','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','end','status','json','count','limit','set','Content-Range','apply','save','destroy','SmsAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','body','describe','addDisposition','Disposition','getDispositions','findOne','removeDispositions','addAnswer','SmsAccountId','CannedAnswer','getAnswers','findAll','removeAnswers','ids','notify','sms','SmsApplication','Applications','account','orderBy','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','messageId','skebby','sender','connectel','message_id','From','MessageUUID','infobip','results','text','csc','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','list','omit','Contacts','contact','SmsInteraction','spread','interaction','autoclose','applications','push','close','*,*,*,*','created','AttachmentId','UserId','User','agent','Start','startRouting','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact'];(function(_0x367108,_0xcbdb59){var _0x45001a=function(_0x26e1cf){while(--_0x26e1cf){_0x367108['push'](_0x367108['shift']());}};_0x45001a(++_0xcbdb59);}(_0x439e,0x1dc));var _0xe439=function(_0x180603,_0x35cdb6){_0x180603=_0x180603-0x0;var _0x2142f4=_0x439e[_0x180603];return _0x2142f4;};'use strict';var pdf=require(_0xe439('0x0'));var emlformat=require(_0xe439('0x1'));var rimraf=require(_0xe439('0x2'));var zipdir=require(_0xe439('0x3'));var jsonpatch=require(_0xe439('0x4'));var rp=require('request-promise');var moment=require(_0xe439('0x5'));var BPromise=require(_0xe439('0x6'));var Mustache=require('mustache');var util=require(_0xe439('0x7'));var path=require(_0xe439('0x8'));var sox=require('sox');var csv=require(_0xe439('0x9'));var ejs=require(_0xe439('0xa'));var fs=require('fs');var _=require(_0xe439('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe439('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe439('0x9'));var querystring=require(_0xe439('0xd'));var Papa=require('papaparse');var Redis=require(_0xe439('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe439('0xf'));var as=require(_0xe439('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe439('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xe439('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xe439('0x13'))['db'];config[_0xe439('0x14')]=_[_0xe439('0x15')](config[_0xe439('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xe439('0x16'))(new Redis(config[_0xe439('0x14')]));require(_0xe439('0x17'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xe439('0x18')][_0xe439('0x19')]({'port':0x232c});function respondWithRpcPromise(_0x38fa6c,_0x32a639,_0x5020b9,_0x36d56f){return new BPromise(function(_0x2db93a,_0x10cc58){var _0x2e41aa=_0x36d56f||client;return _0x2e41aa[_0xe439('0x1a')](_0x38fa6c,_0x5020b9)[_0xe439('0x1b')](function(_0x44426a){logger['info'](_0xe439('0x1c'),_0x32a639,_0xe439('0x1d'));logger['debug'](_0xe439('0x1e'),_0x32a639,_0xe439('0x1d'),JSON[_0xe439('0x1f')](_0x44426a));if(_0x44426a['error']){if(_0x44426a[_0xe439('0x20')]['code']===0x1f4){logger[_0xe439('0x20')](_0xe439('0x1c'),_0x32a639,_0x44426a[_0xe439('0x20')][_0xe439('0x21')]);return _0x10cc58(_0x44426a[_0xe439('0x20')]['message']);}logger[_0xe439('0x20')](_0xe439('0x1c'),_0x32a639,_0x44426a[_0xe439('0x20')][_0xe439('0x21')]);return _0x2db93a(_0x44426a[_0xe439('0x20')][_0xe439('0x21')]);}else{logger[_0xe439('0x22')](_0xe439('0x1c'),_0x32a639,_0xe439('0x1d'));_0x2db93a(_0x44426a[_0xe439('0x23')][_0xe439('0x21')]);}})[_0xe439('0x24')](function(_0x1a2bb4){logger[_0xe439('0x20')](_0xe439('0x1c'),_0x32a639,_0x1a2bb4);_0x10cc58(_0x1a2bb4);});});}function respondWithStatusCode(_0x5eece4,_0x42f43b){_0x42f43b=_0x42f43b||0xcc;return function(_0x4bdcd0){if(_0x4bdcd0){return _0x5eece4[_0xe439('0x25')](_0x42f43b);}return _0x5eece4['status'](_0x42f43b)[_0xe439('0x26')]();};}function respondWithResult(_0x45939d,_0x1ca9ec){_0x1ca9ec=_0x1ca9ec||0xc8;return function(_0x33f058){if(_0x33f058){return _0x45939d[_0xe439('0x27')](_0x1ca9ec)[_0xe439('0x28')](_0x33f058);}};}function respondWithFilteredResult(_0x5633c8,_0x3fdeac){return function(_0x1d0fa1){if(_0x1d0fa1){var _0x4cefdc=_0x1d0fa1[_0xe439('0x29')],_0x5e32cc=_0x3fdeac['offset'],_0x37a797=_0x3fdeac['offset']+_0x3fdeac[_0xe439('0x2a')],_0x2e43bc;if(_0x37a797>=_0x4cefdc){_0x37a797=_0x4cefdc;_0x2e43bc=0xc8;}else{_0x2e43bc=0xce;}_0x5633c8['status'](_0x2e43bc);return _0x5633c8[_0xe439('0x2b')](_0xe439('0x2c'),_0x5e32cc+'-'+_0x37a797+'/'+_0x4cefdc)[_0xe439('0x28')](_0x1d0fa1);}return null;};}function patchUpdates(_0x5eee03){return function(_0x4d606e){try{jsonpatch[_0xe439('0x2d')](_0x4d606e,_0x5eee03,!![]);}catch(_0x4a2b0b){return BPromise['reject'](_0x4a2b0b);}return _0x4d606e[_0xe439('0x2e')]();};}function saveUpdates(_0x442104,_0x2f7581){return function(_0x4fe212){if(_0x4fe212){return _0x4fe212['update'](_0x442104)[_0xe439('0x1b')](function(_0x27365c){return _0x27365c;});}return null;};}function removeEntity(_0xfce820,_0x3f5593){return function(_0x5b19ca){if(_0x5b19ca){return _0x5b19ca[_0xe439('0x2f')]()[_0xe439('0x1b')](function(){var _0x41da0e=_0x5b19ca['get']({'plain':!![]});var _0x1eb74a=_0xe439('0x30');return db[_0xe439('0x31')][_0xe439('0x2f')]({'where':{'type':_0x1eb74a,'resourceId':_0x41da0e['id']}})['then'](function(){return _0x5b19ca;});})['then'](function(){_0xfce820[_0xe439('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17ef11,_0x4ea018){return function(_0xa11603){if(!_0xa11603){_0x17ef11[_0xe439('0x25')](0x194);}return _0xa11603;};}function handleError(_0x4f0811,_0x4ab12e){_0x4ab12e=_0x4ab12e||0x1f4;return function(_0x588162){logger[_0xe439('0x20')](_0x588162[_0xe439('0x32')]);if(_0x588162[_0xe439('0x33')]){delete _0x588162[_0xe439('0x33')];}_0x4f0811[_0xe439('0x27')](_0x4ab12e)[_0xe439('0x34')](_0x588162);};}exports['index']=function(_0x2959a6,_0x1fdb3b){var _0x4e4b57={'include':[{'model':db[_0xe439('0x35')],'as':_0xe439('0x36')}]},_0xa27d72={},_0x731a8e={'count':0x0,'rows':[]};var _0xac3b02=_[_0xe439('0x37')](db[_0xe439('0x38')][_0xe439('0x39')],function(_0x7a3c6b){return{'name':_0x7a3c6b[_0xe439('0x3a')],'type':_0x7a3c6b[_0xe439('0x3b')][_0xe439('0x3c')]};});_0xa27d72['model']=_[_0xe439('0x37')](_0xac3b02,'name');_0xa27d72['query']=_[_0xe439('0x3d')](_0x2959a6[_0xe439('0x3e')]);_0xa27d72[_0xe439('0x3f')]=_[_0xe439('0x40')](_0xa27d72['model'],_0xa27d72[_0xe439('0x3e')]);_0x4e4b57[_0xe439('0x41')]=_[_0xe439('0x40')](_0xa27d72[_0xe439('0x42')],qs[_0xe439('0x43')](_0x2959a6[_0xe439('0x3e')]['fields']));_0x4e4b57[_0xe439('0x41')]=_0x4e4b57[_0xe439('0x41')][_0xe439('0x44')]?_0x4e4b57['attributes']:_0xa27d72[_0xe439('0x42')];if(!_0x2959a6[_0xe439('0x3e')][_0xe439('0x45')](_0xe439('0x46'))){_0x4e4b57[_0xe439('0x2a')]=qs[_0xe439('0x2a')](_0x2959a6['query'][_0xe439('0x2a')]);_0x4e4b57[_0xe439('0x47')]=qs[_0xe439('0x47')](_0x2959a6['query'][_0xe439('0x47')]);}_0x4e4b57[_0xe439('0x48')]=qs['sort'](_0x2959a6[_0xe439('0x3e')][_0xe439('0x49')]);_0x4e4b57[_0xe439('0x4a')]=qs[_0xe439('0x3f')](_[_0xe439('0x4b')](_0x2959a6[_0xe439('0x3e')],_0xa27d72[_0xe439('0x3f')]),_0xac3b02);if(_0x2959a6['query'][_0xe439('0x4c')]){_0x4e4b57[_0xe439('0x4a')]=_[_0xe439('0x4d')](_0x4e4b57[_0xe439('0x4a')],{'$or':_[_0xe439('0x37')](_0xac3b02,function(_0x2ed3c0){if(_0x2ed3c0[_0xe439('0x3b')]!==_0xe439('0x4e')){var _0x5a01c2={};_0x5a01c2[_0x2ed3c0[_0xe439('0x33')]]={'$like':'%'+_0x2959a6[_0xe439('0x3e')][_0xe439('0x4c')]+'%'};return _0x5a01c2;}})});}_0x4e4b57=_['merge']({},_0x4e4b57,_0x2959a6[_0xe439('0x4f')]);var _0x108f1e={'where':_0x4e4b57[_0xe439('0x4a')]};return db[_0xe439('0x38')][_0xe439('0x29')](_0x108f1e)['then'](function(_0x5d639c){_0x731a8e['count']=_0x5d639c;if(_0x2959a6['query'][_0xe439('0x50')]){_0x4e4b57[_0xe439('0x51')]=[{'all':!![]}];}return db[_0xe439('0x38')]['findAll'](_0x4e4b57);})[_0xe439('0x1b')](function(_0x5624d0){_0x731a8e[_0xe439('0x52')]=_0x5624d0;return _0x731a8e;})['then'](respondWithFilteredResult(_0x1fdb3b,_0x4e4b57))['catch'](handleError(_0x1fdb3b,null));};exports[_0xe439('0x53')]=function(_0x33cb77,_0xa26e6f){var _0x2fc08c={'raw':![],'where':{'id':_0x33cb77[_0xe439('0x54')]['id']},'include':[{'model':db[_0xe439('0x35')],'as':'mandatoryDispositionPause'}]},_0x21ccf7={};_0x21ccf7[_0xe439('0x42')]=_['keys'](db[_0xe439('0x38')]['rawAttributes']);_0x21ccf7[_0xe439('0x3e')]=_[_0xe439('0x3d')](_0x33cb77[_0xe439('0x3e')]);_0x21ccf7[_0xe439('0x3f')]=_[_0xe439('0x40')](_0x21ccf7[_0xe439('0x42')],_0x21ccf7[_0xe439('0x3e')]);_0x2fc08c[_0xe439('0x41')]=_[_0xe439('0x40')](_0x21ccf7[_0xe439('0x42')],qs[_0xe439('0x43')](_0x33cb77['query'][_0xe439('0x43')]));_0x2fc08c['attributes']=_0x2fc08c['attributes']['length']?_0x2fc08c[_0xe439('0x41')]:_0x21ccf7[_0xe439('0x42')];if(_0x33cb77['query'][_0xe439('0x50')]){_0x2fc08c['include']=[{'all':!![]}];}_0x2fc08c=_['merge']({},_0x2fc08c,_0x33cb77[_0xe439('0x4f')]);return db['SmsAccount'][_0xe439('0x55')](_0x2fc08c)[_0xe439('0x1b')](handleEntityNotFound(_0xa26e6f,null))[_0xe439('0x1b')](respondWithResult(_0xa26e6f,null))[_0xe439('0x24')](handleError(_0xa26e6f,null));};exports[_0xe439('0x56')]=function(_0x540bba,_0x1998f4){return db[_0xe439('0x38')][_0xe439('0x56')](_0x540bba['body'],{})[_0xe439('0x1b')](function(_0x49827e){var _0x1caebb=_0x540bba[_0xe439('0x57')][_0xe439('0x58')]({'plain':!![]});if(!_0x1caebb)throw new Error(_0xe439('0x59'));if(_0x1caebb[_0xe439('0x5a')]===_0xe439('0x57')){var _0x204c4a=_0x49827e[_0xe439('0x58')]({'plain':!![]});var _0xf6318b=_0xe439('0x30');return db[_0xe439('0x5b')][_0xe439('0x55')]({'where':{'name':_0xf6318b,'userProfileId':_0x1caebb[_0xe439('0x5c')]},'raw':!![]})['then'](function(_0x5bbfc6){if(_0x5bbfc6&&_0x5bbfc6[_0xe439('0x5d')]===0x0){return db['UserProfileResource'][_0xe439('0x56')]({'name':_0x204c4a[_0xe439('0x33')],'resourceId':_0x204c4a['id'],'type':_0x5bbfc6[_0xe439('0x33')],'sectionId':_0x5bbfc6['id']},{})[_0xe439('0x1b')](function(){return _0x49827e;});}else{return _0x49827e;}})[_0xe439('0x24')](function(_0x120381){logger[_0xe439('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x120381);throw _0x120381;});}return _0x49827e;})['then'](respondWithResult(_0x1998f4,0xc9))[_0xe439('0x24')](handleError(_0x1998f4,null));};exports[_0xe439('0x5e')]=function(_0x4aee20,_0xa51377){if(_0x4aee20[_0xe439('0x5f')]['id']){delete _0x4aee20[_0xe439('0x5f')]['id'];}return db[_0xe439('0x38')]['find']({'where':{'id':_0x4aee20[_0xe439('0x54')]['id']},'include':[{'model':db[_0xe439('0x35')],'as':_0xe439('0x36')}]})['then'](handleEntityNotFound(_0xa51377,null))[_0xe439('0x1b')](saveUpdates(_0x4aee20[_0xe439('0x5f')],null))[_0xe439('0x1b')](respondWithResult(_0xa51377,null))[_0xe439('0x24')](handleError(_0xa51377,null));};exports['destroy']=function(_0x339ce1,_0x33c18e){return db[_0xe439('0x38')][_0xe439('0x55')]({'where':{'id':_0x339ce1[_0xe439('0x54')]['id']}})[_0xe439('0x1b')](handleEntityNotFound(_0x33c18e,null))[_0xe439('0x1b')](removeEntity(_0x33c18e,null))[_0xe439('0x24')](handleError(_0x33c18e,null));};exports[_0xe439('0x60')]=function(_0x3d7fc9,_0x59d321){return db[_0xe439('0x38')][_0xe439('0x60')]()[_0xe439('0x1b')](respondWithResult(_0x59d321,null))[_0xe439('0x24')](handleError(_0x59d321,null));};exports[_0xe439('0x61')]=function(_0x42a448,_0x3451c6,_0x1ca858){if(_0x42a448['body']['id']){delete _0x42a448[_0xe439('0x5f')]['id'];}return db[_0xe439('0x38')][_0xe439('0x55')]({'where':{'id':_0x42a448['params']['id']}})[_0xe439('0x1b')](handleEntityNotFound(_0x3451c6,null))[_0xe439('0x1b')](function(_0x39ff94){if(_0x39ff94){_0x42a448[_0xe439('0x5f')]['SmsAccountId']=_0x39ff94['id'];return db[_0xe439('0x62')][_0xe439('0x56')](_0x42a448[_0xe439('0x5f')]);}})[_0xe439('0x1b')](respondWithResult(_0x3451c6,null))[_0xe439('0x24')](handleError(_0x3451c6,null));};exports[_0xe439('0x63')]=function(_0x5a39d0,_0x48bb47,_0x3be708){var _0x422318={'raw':![],'where':{}};var _0x410319={};var _0x271873={'count':0x0,'rows':[]};return db[_0xe439('0x38')][_0xe439('0x64')]({'where':{'id':_0x5a39d0[_0xe439('0x54')]['id']}})['then'](handleEntityNotFound(_0x48bb47,null))['then'](function(_0x20de4b){if(_0x20de4b){_0x410319[_0xe439('0x42')]=_['keys'](db['Disposition'][_0xe439('0x39')]);_0x410319['query']=_[_0xe439('0x3d')](_0x5a39d0['query']);_0x410319['filters']=_[_0xe439('0x40')](_0x410319['model'],_0x410319[_0xe439('0x3e')]);_0x422318['attributes']=_[_0xe439('0x40')](_0x410319['model'],qs[_0xe439('0x43')](_0x5a39d0[_0xe439('0x3e')][_0xe439('0x43')]));_0x422318['attributes']=_0x422318[_0xe439('0x41')][_0xe439('0x44')]?_0x422318[_0xe439('0x41')]:_0x410319['model'];if(!_0x5a39d0[_0xe439('0x3e')]['hasOwnProperty'](_0xe439('0x46'))){_0x422318[_0xe439('0x2a')]=qs[_0xe439('0x2a')](_0x5a39d0[_0xe439('0x3e')]['limit']);_0x422318['offset']=qs['offset'](_0x5a39d0['query'][_0xe439('0x47')]);}_0x422318[_0xe439('0x48')]=qs[_0xe439('0x49')](_0x5a39d0['query'][_0xe439('0x49')]);_0x422318[_0xe439('0x4a')]=qs[_0xe439('0x3f')](_[_0xe439('0x4b')](_0x5a39d0['query'],_0x410319[_0xe439('0x3f')]));_0x422318['where']['SmsAccountId']=_0x20de4b['id'];if(_0x5a39d0[_0xe439('0x3e')][_0xe439('0x4c')]){_0x422318['where']=_[_0xe439('0x4d')](_0x422318[_0xe439('0x4a')],{'$or':_[_0xe439('0x37')](_0x422318['attributes'],function(_0x4820c6){var _0x384d99={};_0x384d99[_0x4820c6]={'$like':'%'+_0x5a39d0[_0xe439('0x3e')]['filter']+'%'};return _0x384d99;})});}_0x422318=_[_0xe439('0x4d')]({},_0x422318,_0x5a39d0[_0xe439('0x4f')]);return db['Disposition'][_0xe439('0x29')]({'where':_0x422318[_0xe439('0x4a')]})[_0xe439('0x1b')](function(_0x5bb0c8){_0x271873[_0xe439('0x29')]=_0x5bb0c8;if(_0x5a39d0['query'][_0xe439('0x50')]){_0x422318[_0xe439('0x51')]=[{'all':!![]}];}return db[_0xe439('0x62')]['findAll'](_0x422318);})[_0xe439('0x1b')](function(_0x5afcf4){_0x271873[_0xe439('0x52')]=_0x5afcf4;return _0x271873;});}})['then'](respondWithFilteredResult(_0x48bb47,_0x422318))[_0xe439('0x24')](handleError(_0x48bb47,null));};exports[_0xe439('0x65')]=function(_0x1077a3,_0x3b3cb5,_0x4adecb){return db[_0xe439('0x38')][_0xe439('0x55')]({'where':{'id':_0x1077a3[_0xe439('0x54')]['id']}})['then'](handleEntityNotFound(_0x3b3cb5,null))[_0xe439('0x1b')](function(_0x3bbec3){if(_0x3bbec3){return _0x3bbec3[_0xe439('0x65')](_0x1077a3[_0xe439('0x3e')]['ids']);}})['then'](respondWithStatusCode(_0x3b3cb5,null))[_0xe439('0x24')](handleError(_0x3b3cb5,null));};exports[_0xe439('0x66')]=function(_0x379a6e,_0x5e6053,_0x54788a){if(_0x379a6e[_0xe439('0x5f')]['id']){delete _0x379a6e[_0xe439('0x5f')]['id'];}return db[_0xe439('0x38')][_0xe439('0x55')]({'where':{'id':_0x379a6e[_0xe439('0x54')]['id']}})[_0xe439('0x1b')](handleEntityNotFound(_0x5e6053,null))[_0xe439('0x1b')](function(_0x3af483){if(_0x3af483){_0x379a6e['body'][_0xe439('0x67')]=_0x3af483['id'];return db[_0xe439('0x68')][_0xe439('0x56')](_0x379a6e[_0xe439('0x5f')]);}})['then'](respondWithResult(_0x5e6053,null))['catch'](handleError(_0x5e6053,null));};exports[_0xe439('0x69')]=function(_0x480295,_0x4178f,_0x29c029){var _0x43159c={'raw':![],'where':{}};var _0x4b1abe={};var _0x258980={'count':0x0,'rows':[]};return db[_0xe439('0x38')][_0xe439('0x64')]({'where':{'id':_0x480295[_0xe439('0x54')]['id']}})[_0xe439('0x1b')](handleEntityNotFound(_0x4178f,null))[_0xe439('0x1b')](function(_0x1218a9){if(_0x1218a9){_0x4b1abe[_0xe439('0x42')]=_[_0xe439('0x3d')](db['CannedAnswer'][_0xe439('0x39')]);_0x4b1abe[_0xe439('0x3e')]=_[_0xe439('0x3d')](_0x480295[_0xe439('0x3e')]);_0x4b1abe['filters']=_[_0xe439('0x40')](_0x4b1abe[_0xe439('0x42')],_0x4b1abe[_0xe439('0x3e')]);_0x43159c[_0xe439('0x41')]=_[_0xe439('0x40')](_0x4b1abe['model'],qs[_0xe439('0x43')](_0x480295['query']['fields']));_0x43159c['attributes']=_0x43159c['attributes'][_0xe439('0x44')]?_0x43159c[_0xe439('0x41')]:_0x4b1abe[_0xe439('0x42')];if(!_0x480295[_0xe439('0x3e')][_0xe439('0x45')](_0xe439('0x46'))){_0x43159c[_0xe439('0x2a')]=qs[_0xe439('0x2a')](_0x480295['query'][_0xe439('0x2a')]);_0x43159c[_0xe439('0x47')]=qs[_0xe439('0x47')](_0x480295[_0xe439('0x3e')][_0xe439('0x47')]);}_0x43159c[_0xe439('0x48')]=qs[_0xe439('0x49')](_0x480295[_0xe439('0x3e')][_0xe439('0x49')]);_0x43159c[_0xe439('0x4a')]=qs['filters'](_['pick'](_0x480295[_0xe439('0x3e')],_0x4b1abe['filters']));_0x43159c[_0xe439('0x4a')][_0xe439('0x67')]=_0x1218a9['id'];if(_0x480295[_0xe439('0x3e')][_0xe439('0x4c')]){_0x43159c[_0xe439('0x4a')]=_[_0xe439('0x4d')](_0x43159c[_0xe439('0x4a')],{'$or':_[_0xe439('0x37')](_0x43159c[_0xe439('0x41')],function(_0x102c63){var _0x216945={};_0x216945[_0x102c63]={'$like':'%'+_0x480295[_0xe439('0x3e')][_0xe439('0x4c')]+'%'};return _0x216945;})});}_0x43159c=_[_0xe439('0x4d')]({},_0x43159c,_0x480295[_0xe439('0x4f')]);return db[_0xe439('0x68')][_0xe439('0x29')]({'where':_0x43159c['where']})[_0xe439('0x1b')](function(_0x3c6670){_0x258980['count']=_0x3c6670;if(_0x480295[_0xe439('0x3e')][_0xe439('0x50')]){_0x43159c[_0xe439('0x51')]=[{'all':!![]}];}return db[_0xe439('0x68')][_0xe439('0x6a')](_0x43159c);})[_0xe439('0x1b')](function(_0x1258d0){_0x258980[_0xe439('0x52')]=_0x1258d0;return _0x258980;});}})[_0xe439('0x1b')](respondWithFilteredResult(_0x4178f,_0x43159c))['catch'](handleError(_0x4178f,null));};exports['removeAnswers']=function(_0x33a5a1,_0xbd3c2b,_0x33d613){return db[_0xe439('0x38')]['find']({'where':{'id':_0x33a5a1[_0xe439('0x54')]['id']}})['then'](handleEntityNotFound(_0xbd3c2b,null))[_0xe439('0x1b')](function(_0x141404){if(_0x141404){return _0x141404[_0xe439('0x6b')](_0x33a5a1[_0xe439('0x3e')][_0xe439('0x6c')]);}})[_0xe439('0x1b')](respondWithStatusCode(_0xbd3c2b,null))[_0xe439('0x24')](handleError(_0xbd3c2b,null));};exports[_0xe439('0x6d')]=function(_0x20f2d2,_0x1d8af7,_0x3a662d){var _0x413985={'channel':_0xe439('0x6e')};var _0x52b8a3=[];var _0x2d6232=[];var _0x212e98={};return db[_0xe439('0x38')]['find']({'where':{'id':_0x20f2d2['params']['id']},'include':[{'model':db[_0xe439('0x6f')],'as':_0xe439('0x70')}]})['then'](handleEntityNotFound(_0x1d8af7,null))['then'](function(_0x3323c5){_0x413985[_0xe439('0x71')]=_0x3323c5;_0x413985['applications']=_[_0xe439('0x72')](_0x3323c5[_0xe439('0x70')],['priority'],[_0xe439('0x73')]);if(_0x413985[_0xe439('0x71')][_0xe439('0x70')]){delete _0x413985[_0xe439('0x71')][_0xe439('0x70')];}return db[_0xe439('0x74')]['describe']();})[_0xe439('0x1b')](function(_0x3e81ba){if(!_0x3e81ba){throw new db[(_0xe439('0x75'))][(_0xe439('0x76'))](_0xe439('0x77'));}_0x52b8a3=_[_0xe439('0x78')](_[_0xe439('0x3d')](_0x3e81ba),[_0xe439('0x79'),_0xe439('0x7a')]);_0x2d6232=_['difference'](_['keys'](_0x3e81ba),[_0xe439('0x79'),'updatedAt',_0xe439('0x7b'),'ListId']);_0x413985[_0xe439('0x5f')]={'mapKey':_0xe439('0x7c')};if(_0x413985['account']['type']){switch(_0x413985[_0xe439('0x71')][_0xe439('0x3b')]){case _0xe439('0x7d'):_0x413985['body'][_0xe439('0x7e')]=_0x20f2d2['body']['From'];_0x413985['body'][_0xe439('0x5f')]=_0x20f2d2[_0xe439('0x5f')]['Body'];_0x413985[_0xe439('0x5f')][_0xe439('0x7f')]=_0x20f2d2[_0xe439('0x5f')]['MessageSid'];break;case _0xe439('0x80'):_0x413985[_0xe439('0x5f')][_0xe439('0x7e')]='+'+_0x20f2d2[_0xe439('0x5f')][_0xe439('0x81')];_0x413985[_0xe439('0x5f')][_0xe439('0x5f')]=_0x20f2d2[_0xe439('0x5f')]['text'];break;case _0xe439('0x82'):_0x413985[_0xe439('0x5f')][_0xe439('0x7e')]=_0x20f2d2[_0xe439('0x5f')]['from'];_0x413985[_0xe439('0x5f')][_0xe439('0x5f')]=_0x20f2d2[_0xe439('0x5f')][_0xe439('0x21')];break;case'clicksend':_0x413985['body'][_0xe439('0x7e')]=_0x20f2d2['body'][_0xe439('0x7e')];_0x413985[_0xe439('0x5f')][_0xe439('0x5f')]=_0x20f2d2['body'][_0xe439('0x5f')];_0x413985[_0xe439('0x5f')][_0xe439('0x7f')]=_0x20f2d2[_0xe439('0x5f')][_0xe439('0x83')];break;case'plivo':_0x413985[_0xe439('0x5f')][_0xe439('0x7e')]=_0x20f2d2[_0xe439('0x5f')][_0xe439('0x84')];_0x413985['body'][_0xe439('0x5f')]=_0x20f2d2[_0xe439('0x5f')]['Text'];_0x413985[_0xe439('0x5f')][_0xe439('0x7f')]=_0x20f2d2[_0xe439('0x5f')][_0xe439('0x85')];break;case _0xe439('0x86'):_0x413985[_0xe439('0x5f')][_0xe439('0x7e')]='+'+_0x20f2d2[_0xe439('0x5f')][_0xe439('0x87')][0x0]['from'];_0x413985[_0xe439('0x5f')][_0xe439('0x5f')]=_0x20f2d2[_0xe439('0x5f')][_0xe439('0x87')][0x0][_0xe439('0x88')];_0x413985[_0xe439('0x5f')]['messageId']=_0x20f2d2[_0xe439('0x5f')][_0xe439('0x87')][0x0]['messageId'];break;case _0xe439('0x89'):_0x413985['body'][_0xe439('0x7e')]=_0x20f2d2[_0xe439('0x5f')]['originatingAddress'];_0x413985[_0xe439('0x5f')][_0xe439('0x5f')]=_0x20f2d2[_0xe439('0x5f')]['segmentedMessage']['message'];break;case'clickatell':_0x413985['body'][_0xe439('0x7e')]=_0x20f2d2[_0xe439('0x5f')][_0xe439('0x8a')];_0x413985[_0xe439('0x5f')][_0xe439('0x5f')]=_0x20f2d2[_0xe439('0x5f')][_0xe439('0x88')];_0x413985[_0xe439('0x5f')][_0xe439('0x7f')]=_0x20f2d2[_0xe439('0x5f')][_0xe439('0x8b')];break;case _0xe439('0x8c'):_0x413985[_0xe439('0x5f')][_0xe439('0x7f')]=_0x20f2d2['body'][0x0][_0xe439('0x21')]['id'];_0x413985[_0xe439('0x5f')]['from']=_0x20f2d2[_0xe439('0x5f')][0x0]['message'][_0xe439('0x7e')];_0x413985[_0xe439('0x5f')][_0xe439('0x5f')]=_0x20f2d2['body'][0x0][_0xe439('0x21')]['text'];break;case _0xe439('0x8d'):_0x413985['body'][_0xe439('0x7e')]=_0x20f2d2[_0xe439('0x5f')][_0xe439('0x7e')];_0x413985[_0xe439('0x5f')][_0xe439('0x5f')]=_0x20f2d2[_0xe439('0x5f')][_0xe439('0x21')];_0x413985[_0xe439('0x5f')][_0xe439('0x7f')]=_0x20f2d2[_0xe439('0x5f')][_0xe439('0x8e')];break;}}if(_0x413985[_0xe439('0x5f')]['id']){delete _0x413985['body']['id'];}if(_[_0xe439('0x8f')](_0x413985[_0xe439('0x5f')]['from'])){throw new db[(_0xe439('0x75'))][(_0xe439('0x76'))](_0xe439('0x90'));}if(_[_0xe439('0x8f')](_0x413985['body'][_0xe439('0x5f')])||_0x413985[_0xe439('0x5f')]['body']===''){throw new db[(_0xe439('0x75'))]['ValidationError'](_0xe439('0x91'));}if(_[_0xe439('0x8f')](_0x413985[_0xe439('0x5f')][_0xe439('0x92')])){throw new db[(_0xe439('0x75'))][(_0xe439('0x76'))](_0xe439('0x93')+_0x2d6232);}if(!_[_0xe439('0x94')](_0x2d6232,_0x413985[_0xe439('0x5f')][_0xe439('0x92')])){throw new db[(_0xe439('0x75'))][(_0xe439('0x76'))](_0xe439('0x95')+_0x2d6232);}_0x212e98[_0x413985[_0xe439('0x5f')][_0xe439('0x92')]]=_0x413985[_0xe439('0x5f')][_0xe439('0x7e')];return db[_0xe439('0x96')]['find']({'where':{'id':_0x413985['account'][_0xe439('0x97')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x212e98,'limit':0x1,'order':[[_0xe439('0x7a'),'DESC']]}]});})[_0xe439('0x1b')](handleEntityNotFound(_0x1d8af7,null))[_0xe439('0x1b')](function(_0x4480a8){if(_0x4480a8){_0x413985[_0xe439('0x98')]=_[_0xe439('0x99')](_0x4480a8,[_0xe439('0x9a')]);if(_0x4480a8[_0xe439('0x9a')]['length']){return _0x4480a8[_0xe439('0x9a')][0x0];}var _0x427658=_['defaults'](_0x413985['body'],{'firstName':_0x413985[_0xe439('0x5f')][_0xe439('0x7e')],'ListId':_0x4480a8['id']});_0x427658[_0x413985['body']['mapKey']]=_0x413985[_0xe439('0x5f')][_0xe439('0x7e')];return db['CmContact'][_0xe439('0x56')](_0x427658,{'fields':_0x52b8a3,'raw':!![]});}})['then'](handleEntityNotFound(_0x1d8af7,null))[_0xe439('0x1b')](function(_0x4684be){if(_0x4684be){_0x413985[_0xe439('0x9b')]=_0x4684be;var _0x319818={'ContactId':_0x4684be['id'],'phone':_0x413985[_0xe439('0x5f')]['from'],'SmsAccountId':_0x20f2d2[_0xe439('0x54')]['id']};var _0x8ca8d={'ContactId':_0x4684be['id'],'SmsAccountId':_0x20f2d2[_0xe439('0x54')]['id'],'closed':![]};return db[_0xe439('0x9c')]['find']({'where':_0x8ca8d})[_0xe439('0x1b')](function(_0x578ecb){if(_0x578ecb){return[_0x578ecb,![]];}return db[_0xe439('0x9c')]['create'](_0x319818)[_0xe439('0x1b')](function(_0x41545d){return[_0x41545d,!![]];});});}})[_0xe439('0x9d')](function(_0x2d3d2d,_0x511d44){_0x413985[_0xe439('0x9e')]=_0x2d3d2d['get']({'plain':!![]});_0x413985[_0xe439('0x9e')]['created']=![];if(_0x511d44){if(_0x413985[_0xe439('0x71')][_0xe439('0x9f')]){_0x413985[_0xe439('0xa0')][_0xe439('0xa1')]({'id':0x0,'priority':_0x413985[_0xe439('0xa0')]['length']+0x1,'app':_0xe439('0xa2'),'appdata':'unmanaged','interval':_0xe439('0xa3')});}_0x413985['interaction'][_0xe439('0xa4')]=!![];}return db['SmsMessage']['create']({'phone':_0x413985['body']['from'],'messageId':_0x413985[_0xe439('0x5f')][_0xe439('0x7f')],'body':_0x413985[_0xe439('0x5f')]['body'],'SmsAccountId':_0x20f2d2[_0xe439('0x54')]['id'],'SmsInteractionId':_0x2d3d2d['id'],'direction':'in','ContactId':_0x2d3d2d['ContactId'],'AttachmentId':_0x413985[_0xe439('0x5f')][_0xe439('0xa5')]});})['then'](function(_0x2a4c12){_0x413985[_0xe439('0x21')]=_0x2a4c12;if(_0x413985[_0xe439('0x9e')][_0xe439('0xa6')]){return db[_0xe439('0xa7')][_0xe439('0x55')]({'attributes':['id',_0xe439('0x33')],'where':{'id':_0x413985[_0xe439('0x9e')][_0xe439('0xa6')]}})[_0xe439('0x1b')](function(_0x437c9e){if(_0x437c9e){_0x413985[_0xe439('0xa0')]['unshift']({'id':0x0,'priority':0x0,'app':_0xe439('0xa8'),'appdata':_0x437c9e[_0xe439('0x33')]+','+(_0x413985[_0xe439('0x71')]['waitForTheAssignedAgent']||0xa),'interval':_0xe439('0xa3')});}return respondWithRpcPromise(_0xe439('0xa9'),_0xe439('0xaa'),_0x413985);});}return respondWithRpcPromise('Start',_0xe439('0xaa'),_0x413985);})[_0xe439('0x1b')](function(_0xbcb12a){if(_0xbcb12a){var _0x5bf2e8=0xc8;var _0x2b4cd4=_0xe439('0xab');logger[_0xe439('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2b4cd4,_0x5bf2e8,_0xe439('0xac'));logger[_0xe439('0xad')](_0xe439('0xae'),_0x2b4cd4,_0x5bf2e8,_0xe439('0xac'),JSON[_0xe439('0x1f')](_0xbcb12a));if(_0x413985[_0xe439('0x71')][_0xe439('0x3b')]==='twilio'){return _0x1d8af7[_0xe439('0x27')](_0x5bf2e8)[_0xe439('0x2b')](_0xe439('0xaf'),_0xe439('0xb0'))[_0xe439('0x34')](_0xe439('0xb1'));}else{return _0x1d8af7[_0xe439('0x27')](_0x5bf2e8)['json'](_0xbcb12a);}}})[_0xe439('0x24')](handleError(_0x1d8af7,null));};exports[_0xe439('0xb2')]=function(_0x13555a,_0x971102,_0x5a2e82){return db['SmsAccount'][_0xe439('0x64')]({'where':{'id':_0x13555a[_0xe439('0x54')]['id']}})[_0xe439('0x1b')](handleEntityNotFound(_0x971102,null))[_0xe439('0x1b')](function(_0x3a4be4){if(_0x3a4be4){return db[_0xe439('0xb3')][_0xe439('0xb4')](function(_0x2ed7e5){return db[_0xe439('0x6f')][_0xe439('0x2f')]({'where':{'SmsAccountId':_0x13555a[_0xe439('0x54')]['id']},'transaction':_0x2ed7e5})['then'](function(_0x1e3b75){var _0x3dd724=_[_0xe439('0x37')](_0x13555a[_0xe439('0x5f')],function(_0x5ca8d8){_0x5ca8d8[_0xe439('0x67')]=_0x13555a[_0xe439('0x54')]['id'];return _0x5ca8d8;});return db[_0xe439('0x6f')][_0xe439('0xb5')](_0x3dd724,{'transaction':_0x2ed7e5});});})[_0xe439('0x1b')](function(){return db[_0xe439('0x6f')][_0xe439('0xb6')]({'where':{'SmsAccountId':_0x13555a[_0xe439('0x54')]['id']},'order':_0xe439('0xb7')});});}})['then'](respondWithResult(_0x971102,null))['catch'](handleError(_0x971102,null));};exports[_0xe439('0xb8')]=function(_0x4b1041,_0x5c78ca,_0x2f329d){var _0x39a5be={};var _0x33b346={};var _0x3275cc;var _0xf49478;return db[_0xe439('0x38')][_0xe439('0x64')]({'where':{'id':_0x4b1041[_0xe439('0x54')]['id']}})['then'](handleEntityNotFound(_0x5c78ca,null))[_0xe439('0x1b')](function(_0x50b6b2){if(_0x50b6b2){_0x3275cc=_0x50b6b2;_0x33b346['model']=_[_0xe439('0x3d')](db[_0xe439('0x6f')]['rawAttributes']);_0x33b346[_0xe439('0x3e')]=_['keys'](_0x4b1041['query']);_0x33b346['filters']=_[_0xe439('0x40')](_0x33b346[_0xe439('0x42')],_0x33b346[_0xe439('0x3e')]);_0x39a5be['attributes']=_[_0xe439('0x40')](_0x33b346['model'],qs[_0xe439('0x43')](_0x4b1041[_0xe439('0x3e')][_0xe439('0x43')]));_0x39a5be[_0xe439('0x41')]=_0x39a5be[_0xe439('0x41')]['length']?_0x39a5be['attributes']:_0x33b346[_0xe439('0x42')];_0x39a5be[_0xe439('0x48')]=qs[_0xe439('0x49')](_0x4b1041[_0xe439('0x3e')][_0xe439('0x49')]);_0x39a5be['where']=qs[_0xe439('0x3f')](_[_0xe439('0x4b')](_0x4b1041[_0xe439('0x3e')],_0x33b346[_0xe439('0x3f')]));if(_0x4b1041[_0xe439('0x3e')][_0xe439('0x4c')]){_0x39a5be[_0xe439('0x4a')]=_[_0xe439('0x4d')](_0x39a5be[_0xe439('0x4a')],{'$or':_[_0xe439('0x37')](_0x39a5be[_0xe439('0x41')],function(_0x5f2393){var _0x402287={};_0x402287[_0x5f2393]={'$like':'%'+_0x4b1041[_0xe439('0x3e')][_0xe439('0x4c')]+'%'};return _0x402287;})});}_0x39a5be=_[_0xe439('0x4d')]({},_0x39a5be,_0x4b1041['options']);return _0x3275cc['getApplications'](_0x39a5be);}})['then'](function(_0x5a25ed){if(_0x5a25ed){_0xf49478=_0x5a25ed[_0xe439('0x44')];if(!_0x4b1041['query'][_0xe439('0x45')](_0xe439('0x46'))){_0x39a5be[_0xe439('0x2a')]=qs['limit'](_0x4b1041['query']['limit']);_0x39a5be[_0xe439('0x47')]=qs[_0xe439('0x47')](_0x4b1041[_0xe439('0x3e')][_0xe439('0x47')]);}return _0x3275cc[_0xe439('0xb8')](_0x39a5be);}})[_0xe439('0x1b')](function(_0x458cfd){if(_0x458cfd){return _0x458cfd?{'count':_0xf49478,'rows':_0x458cfd}:null;}})[_0xe439('0x1b')](respondWithResult(_0x5c78ca,null))[_0xe439('0x24')](handleError(_0x5c78ca,null));};exports[_0xe439('0xb9')]=function(_0x396fce,_0x30bae0,_0x4186f4){var _0x5a9113={'raw':![],'where':{}};var _0x382dda={};var _0x54d476={'count':0x0,'rows':[]};return db['SmsAccount'][_0xe439('0x64')]({'where':{'id':_0x396fce[_0xe439('0x54')]['id']}})['then'](handleEntityNotFound(_0x30bae0,null))[_0xe439('0x1b')](function(_0x25f060){if(_0x25f060){_0x382dda[_0xe439('0x42')]=_[_0xe439('0x3d')](db[_0xe439('0x9c')][_0xe439('0x39')]);_0x382dda[_0xe439('0x3e')]=_[_0xe439('0x3d')](_0x396fce[_0xe439('0x3e')]);_0x382dda[_0xe439('0x3f')]=_[_0xe439('0x40')](_0x382dda[_0xe439('0x42')],_0x382dda[_0xe439('0x3e')]);_0x5a9113[_0xe439('0x41')]=_[_0xe439('0x40')](_0x382dda['model'],qs['fields'](_0x396fce[_0xe439('0x3e')]['fields']));_0x5a9113[_0xe439('0x41')]=_0x5a9113['attributes'][_0xe439('0x44')]?_0x5a9113['attributes']:_0x382dda['model'];if(!_0x396fce[_0xe439('0x3e')]['hasOwnProperty'](_0xe439('0x46'))){_0x5a9113[_0xe439('0x2a')]=qs[_0xe439('0x2a')](_0x396fce['query'][_0xe439('0x2a')]);_0x5a9113[_0xe439('0x47')]=qs[_0xe439('0x47')](_0x396fce['query'][_0xe439('0x47')]);}_0x5a9113['order']=qs[_0xe439('0x49')](_0x396fce[_0xe439('0x3e')][_0xe439('0x49')]);_0x5a9113[_0xe439('0x4a')]=qs[_0xe439('0x3f')](_['pick'](_0x396fce[_0xe439('0x3e')],_0x382dda['filters']));_0x5a9113[_0xe439('0x4a')][_0xe439('0x67')]=_0x25f060['id'];if(_0x396fce['query'][_0xe439('0x4c')]){_0x5a9113[_0xe439('0x4a')]=_[_0xe439('0x4d')](_0x5a9113['where'],{'$or':_['map'](_0x5a9113[_0xe439('0x41')],function(_0x34b4dc){var _0x58822a={};_0x58822a[_0x34b4dc]={'$like':'%'+_0x396fce[_0xe439('0x3e')]['filter']+'%'};return _0x58822a;})});}_0x5a9113=_[_0xe439('0x4d')]({},_0x5a9113,_0x396fce[_0xe439('0x4f')]);return db[_0xe439('0x9c')][_0xe439('0x29')]({'where':_0x5a9113[_0xe439('0x4a')]})[_0xe439('0x1b')](function(_0x181f8e){_0x54d476[_0xe439('0x29')]=_0x181f8e;if(_0x396fce[_0xe439('0x3e')]['includeAll']){_0x5a9113[_0xe439('0x51')]=[{'model':db[_0xe439('0x74')],'as':_0xe439('0xba'),'required':![]},{'model':db[_0xe439('0xa7')],'as':'Owner','attributes':[_0xe439('0x33'),_0xe439('0xbb'),_0xe439('0xbc')],'required':![]},{'model':db[_0xe439('0xbd')],'as':_0xe439('0xbe'),'attributes':['id',_0xe439('0x33'),_0xe439('0xbf')],'where':_0x396fce[_0xe439('0x3e')][_0xe439('0xc0')]?{'id':_0x396fce['query']['tag']}:undefined,'required':_0x396fce[_0xe439('0x3e')][_0xe439('0xc0')]?!![]:![]}];}return db[_0xe439('0x9c')][_0xe439('0x6a')](_0x5a9113);})[_0xe439('0x1b')](function(_0x416ac1){_0x54d476[_0xe439('0x52')]=_0x416ac1;return _0x54d476;});}})[_0xe439('0x1b')](respondWithFilteredResult(_0x30bae0,_0x5a9113))[_0xe439('0x24')](handleError(_0x30bae0,null));};exports[_0xe439('0x34')]=function(_0x12ee6a,_0x569102,_0x1c8b12){var _0x494572,_0x2ec340,_0x248f01;if(_[_0xe439('0x8f')](_0x12ee6a[_0xe439('0x5f')]['body'])||_0x12ee6a[_0xe439('0x5f')][_0xe439('0x5f')]===''){throw new db[(_0xe439('0x75'))][(_0xe439('0x76'))](_0xe439('0x91'));}if(_[_0xe439('0x8f')](_0x12ee6a['body']['to'])){throw new db[(_0xe439('0x75'))][(_0xe439('0x76'))](_0xe439('0xc1'));}_0x494572=_0x12ee6a['body']['to'];return db[_0xe439('0x38')][_0xe439('0x55')]({'where':{'id':_0x12ee6a[_0xe439('0x54')]['id']},'include':[{'model':db[_0xe439('0x96')],'as':'List','include':[{'model':db[_0xe439('0x74')],'as':_0xe439('0x9a'),'where':{'mobile':_0x494572},'limit':0x1,'order':[[_0xe439('0x7a'),_0xe439('0xc2')]]}]}]})['then'](handleEntityNotFound(_0x569102,null))[_0xe439('0x1b')](function(_0x15d1c2){if(_0x15d1c2&&_0x15d1c2['List']){_0x2ec340=_0x15d1c2[_0xe439('0x58')]({'plain':!![]});if(_0x2ec340[_0xe439('0xc3')]&&_0x2ec340['List'][_0xe439('0x9a')]['length']){return _0x2ec340[_0xe439('0xc3')][_0xe439('0x9a')][0x0];}return db['CmContact'][_0xe439('0x56')](_['defaults'](_0x12ee6a['body'],{'firstName':_0x494572,'mobile':_0x494572,'phone':_0x494572,'ListId':_0x2ec340[_0xe439('0x97')]}));}})[_0xe439('0x1b')](handleEntityNotFound(_0x569102,null))[_0xe439('0x1b')](function(_0x5b0059){if(_0x5b0059){_0x248f01=_0x5b0059;return db[_0xe439('0x9c')]['find']({'where':{'ContactId':_0x248f01['id'],'closed':![],'SmsAccountId':_0x2ec340['id']}})[_0xe439('0x1b')](function(_0x303380){if(_0x303380){return[_0x303380,![]];}return db['SmsInteraction']['create']({'UserId':_0x12ee6a[_0xe439('0x57')]['id'],'ContactId':_0x248f01['id'],'SmsAccountId':_0x2ec340['id'],'phone':_0x494572,'firstMsgDirection':'out','Messages':[_[_0xe439('0x4d')](_0x12ee6a['body'],{'read':![],'body':_0x12ee6a[_0xe439('0x5f')][_0xe439('0x5f')],'phone':_0x494572,'SmsAccountId':_0x2ec340['id'],'UserId':_0x12ee6a[_0xe439('0x57')]['id'],'ContactId':_0x248f01['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xe439('0xc4')}]})[_0xe439('0x1b')](function(_0xe7b9aa){return[_0xe7b9aa,!![]];});});}})['spread'](function(_0x1edb51,_0x1053cb){if(_0x1053cb){return _0x1edb51;}return db['SmsMessage'][_0xe439('0x56')](_[_0xe439('0x4d')](_0x12ee6a[_0xe439('0x5f')],{'read':![],'body':_0x12ee6a[_0xe439('0x5f')]['body'],'phone':_0x494572,'SmsAccountId':_0x2ec340['id'],'SmsInteractionId':_0x1edb51['id'],'UserId':_0x12ee6a[_0xe439('0x57')]['id'],'ContactId':_0x248f01['id']}))['then'](function(_0x70591a){_0x1edb51[_0xe439('0xc5')][_0xe439('0xc4')]=[];_0x1edb51[_0xe439('0xc5')][_0xe439('0xc4')][_0xe439('0xa1')](_0x70591a[_0xe439('0xc5')]);return _0x1edb51;});})[_0xe439('0x1b')](respondWithResult(_0x569102,null))[_0xe439('0x24')](handleError(_0x569102,null));};exports['status']=function(_0x4b5f3e,_0x16ed07,_0x2210fb){if(_0x4b5f3e[_0xe439('0x5f')]['id']){delete _0x4b5f3e['body']['id'];}var _0x1f1012,_0x1f0de0,_0x3b6a61;return db['SmsAccount'][_0xe439('0x55')]({'where':{'id':_0x4b5f3e['params']['id']}})[_0xe439('0x1b')](handleEntityNotFound(_0x16ed07,null))[_0xe439('0x1b')](function(_0x46c0bf){if(_0x46c0bf){_0x3b6a61=_0x46c0bf;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xe439('0xc6'),_0x46c0bf['type'],util['inspect'](_0x4b5f3e[_0xe439('0x5f')],{'showHidden':![],'depth':null}));switch(_0x46c0bf[_0xe439('0x3b')]){case _0xe439('0x80'):if(_0x4b5f3e[_0xe439('0x5f')]['skebby_dispatch_id']&&_0x4b5f3e[_0xe439('0x5f')][_0xe439('0x27')]){_0x1f0de0=_0x4b5f3e[_0xe439('0x5f')][_0xe439('0x27')];return db[_0xe439('0xc7')][_0xe439('0x55')]({'where':{'messageId':_0x4b5f3e[_0xe439('0x5f')][_0xe439('0xc8')]}});}break;case _0xe439('0x82'):if(_0x4b5f3e[_0xe439('0x5f')][_0xe439('0xc9')]&&_0x4b5f3e[_0xe439('0x5f')]['statusInt']){_0x1f0de0=_0x4b5f3e[_0xe439('0x5f')][_0xe439('0xca')];return db[_0xe439('0xc7')][_0xe439('0x55')]({'where':{'messageId':_0x4b5f3e[_0xe439('0x5f')][_0xe439('0xc9')]}});}break;case'clicksend':if(_0x4b5f3e[_0xe439('0x5f')][_0xe439('0x83')]&&_0x4b5f3e['body'][_0xe439('0xcb')]){_0x1f0de0=_0x4b5f3e[_0xe439('0x5f')]['status_code'];return db[_0xe439('0xc7')][_0xe439('0x55')]({'where':{'messageId':_0x4b5f3e['body'][_0xe439('0x83')]}});}break;case'infobip':var _0x34747d=_0x4b5f3e[_0xe439('0x5f')][_0xe439('0x87')][0x0];if(_0x34747d['messageId']&&_0x34747d['status']['groupName']===_0xe439('0xcc')){_0x1f0de0=_0x34747d[_0xe439('0x27')][_0xe439('0xcd')];return db[_0xe439('0xc7')][_0xe439('0x55')]({'where':{'messageId':_0x34747d[_0xe439('0x7f')]}});}break;case _0xe439('0xce'):if(_0x4b5f3e[_0xe439('0x5f')][_0xe439('0x7f')]&&_0x4b5f3e['body'][_0xe439('0x27')]){_0x1f0de0=_0x4b5f3e[_0xe439('0x5f')][_0xe439('0x27')];return db[_0xe439('0xc7')][_0xe439('0x55')]({'where':{'messageId':_0x4b5f3e[_0xe439('0x5f')]['messageId']}});}break;case _0xe439('0x8c'):if(_0x4b5f3e[_0xe439('0x5f')][0x0][_0xe439('0x21')]['id']){_0x1f0de0=_0x4b5f3e[_0xe439('0x5f')][0x0][_0xe439('0x3b')];return db[_0xe439('0xc7')][_0xe439('0x55')]({'where':{'messageId':_0x4b5f3e[_0xe439('0x5f')][0x0][_0xe439('0x21')]['id']}});}break;case _0xe439('0x8d'):if(_0x4b5f3e[_0xe439('0x5f')][_0xe439('0xcf')]&&_0x4b5f3e[_0xe439('0x5f')][_0xe439('0x27')]){_0x1f0de0=_0x4b5f3e['body'][_0xe439('0x27')];return db[_0xe439('0xc7')][_0xe439('0x55')]({'where':{'messageId':_0x4b5f3e[_0xe439('0x5f')][_0xe439('0xcf')]}});}break;}}})[_0xe439('0x1b')](handleEntityNotFound(_0x16ed07,null))[_0xe439('0x1b')](function(_0x99b161){if(_0x99b161){_0x1f1012=_0x99b161;switch(_0x3b6a61[_0xe439('0x3b')]){case _0xe439('0x80'):if(_0x1f0de0==='DELIVERED'){return _0x1f1012[_0xe439('0x5e')]({'read':!![]});}else{logger[_0xe439('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe439('0x27'),_0xe439('0x80'),util[_0xe439('0xd0')](_0x4b5f3e[_0xe439('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xe439('0x82'):if(_0x1f0de0==='1'){return _0x1f1012['update']({'read':!![]});}else{logger[_0xe439('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe439('0x27'),_0xe439('0x80'),util[_0xe439('0xd0')](_0x4b5f3e[_0xe439('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xe439('0xd1'):if(!_0x4b5f3e[_0xe439('0x5f')]['error_code']&&_0x1f0de0>=0xc8&&_0x1f0de0<=0xce){return _0x1f1012[_0xe439('0x5e')]({'read':!![]});}else{logger[_0xe439('0x20')](_0xe439('0x1e'),_0xe439('0x27'),'clicksend',util[_0xe439('0xd0')](_0x4b5f3e[_0xe439('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xe439('0x86'):var _0x5a555b=_0x4b5f3e[_0xe439('0x5f')][_0xe439('0x87')][0x0];if(_0x5a555b[_0xe439('0x27')][_0xe439('0xcd')]==='DELIVERED'){return _0x1f1012[_0xe439('0x5e')]({'read':!![]});}else{logger[_0xe439('0x20')](_0xe439('0x1e'),'status','infobip',util[_0xe439('0xd0')](_0x4b5f3e[_0xe439('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xe439('0xce'):if(_0x1f0de0==_0xe439('0xd2')||_0x1f0de0==_0xe439('0xd3')){return _0x1f1012['update']({'read':!![]});}else{logger[_0xe439('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe439('0x27'),_0xe439('0xce'),util[_0xe439('0xd0')](_0x4b5f3e[_0xe439('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xe439('0x8c'):if(_0x1f0de0==_0xe439('0xd4')){return _0x1f1012[_0xe439('0x5e')]({'read':!![]});}else{logger[_0xe439('0x20')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xe439('0x8c'),util[_0xe439('0xd0')](_0x4b5f3e[_0xe439('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xe439('0x8d'):if(_0x1f0de0===_0xe439('0xd5')||_0x1f0de0==='ACCEPTD'){return _0x1f1012[_0xe439('0x5e')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe439('0x27'),'intelepeer',util[_0xe439('0xd0')](_0x4b5f3e[_0xe439('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x1f1012;}})[_0xe439('0x1b')](respondWithResult(_0x16ed07,null))[_0xe439('0x24')](handleError(_0x16ed07,null));};exports['statusGet']=function(_0x3ed6f8,_0x55d116,_0x287263){var _0x5daae4,_0x30bf25,_0x55b44a;return db[_0xe439('0x38')][_0xe439('0x55')]({'where':{'id':_0x3ed6f8['params']['id']}})['then'](handleEntityNotFound(_0x55d116,null))[_0xe439('0x1b')](function(_0x2ff5bc){if(_0x2ff5bc){_0x55b44a=_0x2ff5bc;logger['debug'](_0xe439('0x1e'),_0xe439('0x27'),_0xe439('0xc6'),_0x2ff5bc['type'],util[_0xe439('0xd0')](_0x3ed6f8[_0xe439('0x3e')],{'showHidden':![],'depth':null}));switch(_0x2ff5bc[_0xe439('0x3b')]){case _0xe439('0x89'):if(_0x3ed6f8[_0xe439('0x3e')]['message-id']&&_0x3ed6f8[_0xe439('0x3e')][_0xe439('0xd6')]){_0x30bf25=_0x3ed6f8[_0xe439('0x3e')]['state'];return db['SmsMessage'][_0xe439('0x55')]({'where':{'messageId':_0x3ed6f8['query'][_0xe439('0xd7')]}});}break;}}})['then'](handleEntityNotFound(_0x55d116,null))[_0xe439('0x1b')](function(_0xf3132d){if(_0xf3132d){_0x5daae4=_0xf3132d;switch(_0x55b44a[_0xe439('0x3b')]){case'csc':if(_0x30bf25==='2'||_0x30bf25==='6'){return _0x5daae4['update']({'read':!![]});}else{logger[_0xe439('0x20')](_0xe439('0x1e'),_0xe439('0x27'),_0xe439('0x89'),util[_0xe439('0xd0')](_0x3ed6f8['query'],{'showHidden':![],'depth':null}));};break;}return _0x5daae4;}})[_0xe439('0x1b')](respondWithResult(_0x55d116,null))[_0xe439('0x24')](handleError(_0x55d116,null));};exports[_0xe439('0xd8')]=function(_0x2eeeda,_0x392a76,_0x19b443){return db[_0xe439('0x38')]['find']({'where':{'id':_0x2eeeda[_0xe439('0x54')]['id']}})[_0xe439('0x1b')](handleEntityNotFound(_0x392a76,null))[_0xe439('0x1b')](function(_0xed3765){if(_0xed3765){return _0xed3765[_0xe439('0xd8')](_0x2eeeda['body'][_0xe439('0x6c')],_['omit'](_0x2eeeda['body'],['ids','id'])||{})['spread'](function(_0x5ad889){for(var _0x2a993e=0x0;_0x2a993e<_0x2eeeda[_0xe439('0x5f')][_0xe439('0x6c')][_0xe439('0x44')];_0x2a993e+=0x1){socket[_0xe439('0xd9')]('userSmsAccount:save',{'UserId':_0x2eeeda[_0xe439('0x5f')][_0xe439('0x6c')][_0x2a993e],'SmsAccountId':_0x2eeeda[_0xe439('0x54')]['id']});}return _0x5ad889;});}})['then'](respondWithResult(_0x392a76,null))[_0xe439('0x24')](handleError(_0x392a76,null));};exports['removeAgents']=function(_0x527144,_0x3b8589,_0x5e0f2b){return db[_0xe439('0x38')]['find']({'where':{'id':_0x527144['params']['id']}})[_0xe439('0x1b')](handleEntityNotFound(_0x3b8589,null))[_0xe439('0x1b')](function(_0x236a60){if(_0x236a60){return _0x236a60[_0xe439('0xda')](_0x527144['query'][_0xe439('0x6c')])[_0xe439('0x1b')](function(){if(_['isArray'](_0x527144[_0xe439('0x3e')][_0xe439('0x6c')])){for(var _0x289f0d=0x0;_0x289f0d<_0x527144[_0xe439('0x3e')][_0xe439('0x6c')][_0xe439('0x44')];_0x289f0d+=0x1){socket[_0xe439('0xd9')](_0xe439('0xdb'),{'UserId':Number(_0x527144[_0xe439('0x3e')][_0xe439('0x6c')][_0x289f0d]),'SmsAccountId':Number(_0x527144[_0xe439('0x54')]['id'])});}}else{socket[_0xe439('0xd9')](_0xe439('0xdb'),{'UserId':Number(_0x527144[_0xe439('0x3e')][_0xe439('0x6c')]),'SmsAccountId':Number(_0x527144[_0xe439('0x54')]['id'])});}});}})[_0xe439('0x1b')](respondWithStatusCode(_0x3b8589,null))['catch'](handleError(_0x3b8589,null));};exports['getAgents']=function(_0x5158b4,_0xc7b1cb,_0x193055){var _0x4f6e6c={};var _0x1c170d={};var _0x2650c9;var _0x500ab7;return db[_0xe439('0x38')][_0xe439('0x64')]({'where':{'id':_0x5158b4[_0xe439('0x54')]['id']}})[_0xe439('0x1b')](handleEntityNotFound(_0xc7b1cb,null))[_0xe439('0x1b')](function(_0x404d1d){if(_0x404d1d){_0x2650c9=_0x404d1d;_0x1c170d[_0xe439('0x42')]=_[_0xe439('0x3d')](db[_0xe439('0xa7')][_0xe439('0x39')]);_0x1c170d[_0xe439('0x3e')]=_['keys'](_0x5158b4[_0xe439('0x3e')]);_0x1c170d[_0xe439('0x3f')]=_['intersection'](_0x1c170d['model'],_0x1c170d['query']);_0x4f6e6c['attributes']=_[_0xe439('0x40')](_0x1c170d[_0xe439('0x42')],qs['fields'](_0x5158b4[_0xe439('0x3e')][_0xe439('0x43')]));_0x4f6e6c['attributes']=_0x4f6e6c['attributes']['length']?_0x4f6e6c[_0xe439('0x41')]:_0x1c170d[_0xe439('0x42')];_0x4f6e6c['order']=qs[_0xe439('0x49')](_0x5158b4[_0xe439('0x3e')][_0xe439('0x49')]);_0x4f6e6c[_0xe439('0x4a')]=qs[_0xe439('0x3f')](_[_0xe439('0x4b')](_0x5158b4[_0xe439('0x3e')],_0x1c170d['filters']));if(_0x5158b4[_0xe439('0x3e')][_0xe439('0x4c')]){_0x4f6e6c[_0xe439('0x4a')]=_[_0xe439('0x4d')](_0x4f6e6c[_0xe439('0x4a')],{'$or':_[_0xe439('0x37')](_0x4f6e6c[_0xe439('0x41')],function(_0x430203){var _0x5506bf={};_0x5506bf[_0x430203]={'$like':'%'+_0x5158b4[_0xe439('0x3e')][_0xe439('0x4c')]+'%'};return _0x5506bf;})});}_0x4f6e6c=_[_0xe439('0x4d')]({},_0x4f6e6c,_0x5158b4[_0xe439('0x4f')]);return _0x2650c9[_0xe439('0xdc')](_0x4f6e6c);}})[_0xe439('0x1b')](function(_0x1b4372){if(_0x1b4372){_0x500ab7=_0x1b4372[_0xe439('0x44')];if(!_0x5158b4[_0xe439('0x3e')][_0xe439('0x45')]('nolimit')){_0x4f6e6c['limit']=qs[_0xe439('0x2a')](_0x5158b4[_0xe439('0x3e')][_0xe439('0x2a')]);_0x4f6e6c[_0xe439('0x47')]=qs[_0xe439('0x47')](_0x5158b4[_0xe439('0x3e')]['offset']);}return _0x2650c9[_0xe439('0xdc')](_0x4f6e6c);}})[_0xe439('0x1b')](function(_0x2471bd){if(_0x2471bd){return _0x2471bd?{'count':_0x500ab7,'rows':_0x2471bd}:null;}})[_0xe439('0x1b')](respondWithResult(_0xc7b1cb,null))['catch'](handleError(_0xc7b1cb,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index e2aa94b..e0f1bfa 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 _0x80ee=['emit','hasOwnProperty','hook','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove'];(function(_0x29436c,_0x260a6a){var _0x3760a2=function(_0xc9ee2){while(--_0xc9ee2){_0x29436c['push'](_0x29436c['shift']());}};_0x3760a2(++_0x260a6a);}(_0x80ee,0x1d9));var _0xe80e=function(_0x1abbaa,_0x1b7a38){_0x1abbaa=_0x1abbaa-0x0;var _0x40ed52=_0x80ee[_0x1abbaa];return _0x40ed52;};'use strict';var EventEmitter=require(_0xe80e('0x0'));var SmsAccount=require(_0xe80e('0x1'))['db'][_0xe80e('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xe80e('0x3')](0x0);var events={'afterCreate':_0xe80e('0x4'),'afterUpdate':_0xe80e('0x5'),'afterDestroy':_0xe80e('0x6')};function emitEvent(_0x4cfee6){return function(_0x3145cb,_0x13b051,_0x3a2baa){SmsAccountEvents[_0xe80e('0x7')](_0x4cfee6+':'+_0x3145cb['id'],_0x3145cb);SmsAccountEvents[_0xe80e('0x7')](_0x4cfee6,_0x3145cb);_0x3a2baa(null);};}for(var e in events){if(events[_0xe80e('0x8')](e)){var event=events[e];SmsAccount[_0xe80e('0x9')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x1f43=['emit','hasOwnProperty','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x3ed2b9,_0x3a9509){var _0x212d69=function(_0x2a638f){while(--_0x2a638f){_0x3ed2b9['push'](_0x3ed2b9['shift']());}};_0x212d69(++_0x3a9509);}(_0x1f43,0xb8));var _0x31f4=function(_0x3fbe4a,_0x151cdc){_0x3fbe4a=_0x3fbe4a-0x0;var _0x181b1e=_0x1f43[_0x3fbe4a];return _0x181b1e;};'use strict';var EventEmitter=require(_0x31f4('0x0'));var SmsAccount=require(_0x31f4('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x31f4('0x2')](0x0);var events={'afterCreate':_0x31f4('0x3'),'afterUpdate':'update','afterDestroy':_0x31f4('0x4')};function emitEvent(_0x167f30){return function(_0x18b1de,_0x479983,_0x228702){SmsAccountEvents[_0x31f4('0x5')](_0x167f30+':'+_0x18b1de['id'],_0x18b1de);SmsAccountEvents[_0x31f4('0x5')](_0x167f30,_0x18b1de);_0x228702(null);};}for(var e in events){if(events[_0x31f4('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 9cb84e1..272e516 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 _0x1863=['define','sms_accounts','lodash','api','moment','bluebird','request-promise','path'];(function(_0x3788d6,_0x6bd7e8){var _0x53c3e8=function(_0x358170){while(--_0x358170){_0x3788d6['push'](_0x3788d6['shift']());}};_0x53c3e8(++_0x6bd7e8);}(_0x1863,0x1ca));var _0x3186=function(_0x20845e,_0x211e78){_0x20845e=_0x20845e-0x0;var _0x28cf2b=_0x1863[_0x20845e];return _0x28cf2b;};'use strict';var _=require(_0x3186('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3186('0x1'));var moment=require(_0x3186('0x2'));var BPromise=require(_0x3186('0x3'));var rp=require(_0x3186('0x4'));var fs=require('fs');var path=require(_0x3186('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module['exports']=function(_0x53a58a,_0x4a6dc5){return _0x53a58a[_0x3186('0x6')]('SmsAccount',attributes,{'tableName':_0x3186('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca8b=['bluebird','request-promise','path','../../config/environment','exports','define','SmsAccount','sms_accounts'];(function(_0x527727,_0x1cd15d){var _0x1fae39=function(_0x26fb7b){while(--_0x26fb7b){_0x527727['push'](_0x527727['shift']());}};_0x1fae39(++_0x1cd15d);}(_0xca8b,0x130));var _0xbca8=function(_0xbe1b9,_0x2226c7){_0xbe1b9=_0xbe1b9-0x0;var _0x1c4e4f=_0xca8b[_0xbe1b9];return _0x1c4e4f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbca8('0x0'));var rp=require(_0xbca8('0x1'));var fs=require('fs');var path=require(_0xbca8('0x2'));var rimraf=require('rimraf');var config=require(_0xbca8('0x3'));var attributes=require('./smsAccount.attributes');module[_0xbca8('0x4')]=function(_0x371d00,_0x1104a8){return _0x371d00[_0xbca8('0x5')](_0xbca8('0x6'),attributes,{'tableName':_0xbca8('0x7'),'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 4fe820b..95f7289 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 _0xf035=['where','include','map','model','attributes','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','SmsAccount,\x20%s,\x20%s','info','result','ShowSmsAccount','SmsAccount','find','options','raw'];(function(_0x273987,_0x44056f){var _0x50ebc7=function(_0x4efbf0){while(--_0x4efbf0){_0x273987['push'](_0x273987['shift']());}};_0x50ebc7(++_0x44056f);}(_0xf035,0x18d));var _0x5f03=function(_0xd8ab97,_0x2ec538){_0xd8ab97=_0xd8ab97-0x0;var _0x39eb9a=_0xf035[_0xd8ab97];return _0x39eb9a;};'use strict';var _=require(_0x5f03('0x0'));var util=require(_0x5f03('0x1'));var moment=require(_0x5f03('0x2'));var BPromise=require('bluebird');var rs=require(_0x5f03('0x3'));var fs=require('fs');var Redis=require(_0x5f03('0x4'));var db=require(_0x5f03('0x5'))['db'];var utils=require(_0x5f03('0x6'));var logger=require(_0x5f03('0x7'))(_0x5f03('0x8'));var config=require(_0x5f03('0x9'));var jayson=require(_0x5f03('0xa'));var client=jayson[_0x5f03('0xb')][_0x5f03('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5f03('0xd')],{'host':_0x5f03('0xe'),'port':0x18eb});var socket=require(_0x5f03('0xf'))(new Redis(config[_0x5f03('0xd')]));require('./smsAccount.socket')[_0x5f03('0x10')](socket);function respondWithRpcPromise(_0x3bc800,_0x46caeb,_0x427668){return new BPromise(function(_0x3c7b77,_0x5d8086){return client['request'](_0x3bc800,_0x427668)[_0x5f03('0x11')](function(_0x362cd6){logger['info']('SmsAccount,\x20%s,\x20%s',_0x46caeb,_0x5f03('0x12'));logger[_0x5f03('0x13')](_0x5f03('0x14'),_0x46caeb,_0x5f03('0x12'),JSON['stringify'](_0x362cd6));if(_0x362cd6[_0x5f03('0x15')]){if(_0x362cd6['error'][_0x5f03('0x16')]===0x1f4){logger[_0x5f03('0x15')]('SmsAccount,\x20%s,\x20%s',_0x46caeb,_0x362cd6['error']['message']);return _0x5d8086(_0x362cd6[_0x5f03('0x15')][_0x5f03('0x17')]);}logger[_0x5f03('0x15')](_0x5f03('0x18'),_0x46caeb,_0x362cd6[_0x5f03('0x15')][_0x5f03('0x17')]);return _0x3c7b77(_0x362cd6[_0x5f03('0x15')]['message']);}else{logger[_0x5f03('0x19')](_0x5f03('0x18'),_0x46caeb,'request\x20sent');_0x3c7b77(_0x362cd6[_0x5f03('0x1a')][_0x5f03('0x17')]);}})['catch'](function(_0x2db941){logger[_0x5f03('0x15')](_0x5f03('0x18'),_0x46caeb,_0x2db941);_0x5d8086(_0x2db941);});});}exports[_0x5f03('0x1b')]=function(_0x1390b6){var _0x4e6972=this;return new Promise(function(_0x35191f,_0x57172b){return db[_0x5f03('0x1c')][_0x5f03('0x1d')]({'raw':_0x1390b6[_0x5f03('0x1e')]?_0x1390b6[_0x5f03('0x1e')][_0x5f03('0x1f')]===undefined?!![]:![]:!![],'where':_0x1390b6['options']?_0x1390b6['options'][_0x5f03('0x20')]||null:null,'attributes':_0x1390b6['options']?_0x1390b6[_0x5f03('0x1e')]['attributes']||null:null,'include':_0x1390b6[_0x5f03('0x1e')]?_0x1390b6[_0x5f03('0x1e')][_0x5f03('0x21')]?_[_0x5f03('0x22')](_0x1390b6[_0x5f03('0x1e')]['include'],function(_0x44f668){return{'model':db[_0x44f668[_0x5f03('0x23')]],'as':_0x44f668['as'],'attributes':_0x44f668[_0x5f03('0x24')],'include':_0x44f668[_0x5f03('0x21')]?_['map'](_0x44f668['include'],function(_0x5a4400){return{'model':db[_0x5a4400[_0x5f03('0x23')]],'as':_0x5a4400['as'],'attributes':_0x5a4400[_0x5f03('0x24')],'include':_0x5a4400[_0x5f03('0x21')]?_[_0x5f03('0x22')](_0x5a4400['include'],function(_0x2e9e3a){return{'model':db[_0x2e9e3a[_0x5f03('0x23')]],'as':_0x2e9e3a['as'],'attributes':_0x2e9e3a[_0x5f03('0x24')]};}):[]};}):[]};}):[]:[]})[_0x5f03('0x11')](function(_0x53730f){logger['info']('ShowSmsAccount',_0x1390b6);logger[_0x5f03('0x13')](_0x5f03('0x1b'),_0x1390b6,JSON[_0x5f03('0x25')](_0x53730f));_0x35191f(_0x53730f);})[_0x5f03('0x26')](function(_0x79c58f){logger[_0x5f03('0x15')](_0x5f03('0x1b'),_0x79c58f[_0x5f03('0x17')],_0x1390b6);_0x57172b(_0x4e6972['error'](0x1f4,_0x79c58f['message']));});});}; \ No newline at end of file +var _0x00d9=['attributes','include','map','model','stringify','lodash','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','request\x20sent','result','catch','ShowSmsAccount','find','options','raw','where'];(function(_0x535efc,_0xf4fda0){var _0x3d942b=function(_0x4bbd62){while(--_0x4bbd62){_0x535efc['push'](_0x535efc['shift']());}};_0x3d942b(++_0xf4fda0);}(_0x00d9,0x1b5));var _0x900d=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x00d9[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0x900d('0x0'));var util=require('util');var moment=require(_0x900d('0x1'));var BPromise=require('bluebird');var rs=require(_0x900d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x900d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x900d('0x4'));var config=require(_0x900d('0x5'));var jayson=require(_0x900d('0x6'));var client=jayson[_0x900d('0x7')][_0x900d('0x8')]({'port':0x232a});config[_0x900d('0x9')]=_[_0x900d('0xa')](config[_0x900d('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x900d('0xb'))(new Redis(config[_0x900d('0x9')]));require(_0x900d('0xc'))[_0x900d('0xd')](socket);function respondWithRpcPromise(_0x17ee8d,_0x4c17ed,_0x4e611c){return new BPromise(function(_0x453b3d,_0x44fd0f){return client[_0x900d('0xe')](_0x17ee8d,_0x4e611c)[_0x900d('0xf')](function(_0xdcd26c){logger['info'](_0x900d('0x10'),_0x4c17ed,'request\x20sent');logger[_0x900d('0x11')](_0x900d('0x12'),_0x4c17ed,'request\x20sent',JSON['stringify'](_0xdcd26c));if(_0xdcd26c[_0x900d('0x13')]){if(_0xdcd26c[_0x900d('0x13')][_0x900d('0x14')]===0x1f4){logger[_0x900d('0x13')](_0x900d('0x10'),_0x4c17ed,_0xdcd26c[_0x900d('0x13')][_0x900d('0x15')]);return _0x44fd0f(_0xdcd26c['error'][_0x900d('0x15')]);}logger[_0x900d('0x13')](_0x900d('0x10'),_0x4c17ed,_0xdcd26c[_0x900d('0x13')][_0x900d('0x15')]);return _0x453b3d(_0xdcd26c[_0x900d('0x13')][_0x900d('0x15')]);}else{logger[_0x900d('0x16')]('SmsAccount,\x20%s,\x20%s',_0x4c17ed,_0x900d('0x17'));_0x453b3d(_0xdcd26c[_0x900d('0x18')][_0x900d('0x15')]);}})[_0x900d('0x19')](function(_0x51c707){logger[_0x900d('0x13')]('SmsAccount,\x20%s,\x20%s',_0x4c17ed,_0x51c707);_0x44fd0f(_0x51c707);});});}exports[_0x900d('0x1a')]=function(_0x2925e5){var _0x1bc0f=this;return new Promise(function(_0x1f0d1f,_0x5025d0){return db['SmsAccount'][_0x900d('0x1b')]({'raw':_0x2925e5['options']?_0x2925e5[_0x900d('0x1c')][_0x900d('0x1d')]===undefined?!![]:![]:!![],'where':_0x2925e5[_0x900d('0x1c')]?_0x2925e5['options'][_0x900d('0x1e')]||null:null,'attributes':_0x2925e5[_0x900d('0x1c')]?_0x2925e5[_0x900d('0x1c')][_0x900d('0x1f')]||null:null,'include':_0x2925e5[_0x900d('0x1c')]?_0x2925e5[_0x900d('0x1c')][_0x900d('0x20')]?_[_0x900d('0x21')](_0x2925e5[_0x900d('0x1c')][_0x900d('0x20')],function(_0x2eea17){return{'model':db[_0x2eea17[_0x900d('0x22')]],'as':_0x2eea17['as'],'attributes':_0x2eea17[_0x900d('0x1f')],'include':_0x2eea17['include']?_['map'](_0x2eea17[_0x900d('0x20')],function(_0x560e6c){return{'model':db[_0x560e6c[_0x900d('0x22')]],'as':_0x560e6c['as'],'attributes':_0x560e6c['attributes'],'include':_0x560e6c[_0x900d('0x20')]?_[_0x900d('0x21')](_0x560e6c[_0x900d('0x20')],function(_0x13a0f3){return{'model':db[_0x13a0f3[_0x900d('0x22')]],'as':_0x13a0f3['as'],'attributes':_0x13a0f3['attributes']};}):[]};}):[]};}):[]:[]})[_0x900d('0xf')](function(_0x2fe76c){logger[_0x900d('0x16')](_0x900d('0x1a'),_0x2925e5);logger[_0x900d('0x11')](_0x900d('0x1a'),_0x2925e5,JSON[_0x900d('0x23')](_0x2fe76c));_0x1f0d1f(_0x2fe76c);})[_0x900d('0x19')](function(_0xfe8869){logger['error'](_0x900d('0x1a'),_0xfe8869[_0x900d('0x15')],_0x2925e5);_0x5025d0(_0x1bc0f[_0x900d('0x13')](0x1f4,_0xfe8869['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 4d47c39..b29f756 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 _0x782b=['smsAccount:','remove','removeListener','register'];(function(_0x12c250,_0x326ae8){var _0x5eb220=function(_0x4484d0){while(--_0x4484d0){_0x12c250['push'](_0x12c250['shift']());}};_0x5eb220(++_0x326ae8);}(_0x782b,0x89));var _0xb782=function(_0x5e20bf,_0x936407){_0x5e20bf=_0x5e20bf-0x0;var _0x3978d9=_0x782b[_0x5e20bf];return _0x3978d9;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=['save',_0xb782('0x0'),'update'];function createListener(_0x22424e,_0x198435){return function(_0x404d9c){_0x198435['emit'](_0x22424e,_0x404d9c);};}function removeListener(_0x31aa36,_0x735d16){return function(){SmsAccountEvents[_0xb782('0x1')](_0x31aa36,_0x735d16);};}exports[_0xb782('0x2')]=function(_0x22005f){for(var _0x177318=0x0,_0x1a33c8=events['length'];_0x177318<_0x1a33c8;_0x177318++){var _0x21a5c8=events[_0x177318];var _0x15adef=createListener(_0xb782('0x3')+_0x21a5c8,_0x22005f);SmsAccountEvents['on'](_0x21a5c8,_0x15adef);}}; \ No newline at end of file +var _0xf0e3=['save','remove','emit','removeListener','register','length','smsAccount:'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xf0e3,0xd9));var _0x3f0e=function(_0x4a610e,_0xaf03bf){_0x4a610e=_0x4a610e-0x0;var _0x445f46=_0xf0e3[_0x4a610e];return _0x445f46;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=[_0x3f0e('0x0'),_0x3f0e('0x1'),'update'];function createListener(_0x4c53ea,_0x48a0a){return function(_0x82eb2e){_0x48a0a[_0x3f0e('0x2')](_0x4c53ea,_0x82eb2e);};}function removeListener(_0x5f0206,_0x22f5db){return function(){SmsAccountEvents[_0x3f0e('0x3')](_0x5f0206,_0x22f5db);};}exports[_0x3f0e('0x4')]=function(_0x25dc74){for(var _0x4a3b2c=0x0,_0x5a79c4=events[_0x3f0e('0x5')];_0x4a3b2c<_0x5a79c4;_0x4a3b2c++){var _0x48353d=events[_0x4a3b2c];var _0x3b4e99=createListener(_0x3f0e('0x6')+_0x48353d,_0x25dc74);SmsAccountEvents['on'](_0x48353d,_0x3b4e99);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index ba8aa50..26a51a9 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 _0xc57c=['put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','/:id','post'];(function(_0x4873e1,_0x5e4cbe){var _0x453c0a=function(_0x3ff784){while(--_0x3ff784){_0x4873e1['push'](_0x4873e1['shift']());}};_0x453c0a(++_0x5e4cbe);}(_0xc57c,0x17e));var _0xcc57=function(_0x535144,_0x20d1ca){_0x535144=_0x535144-0x0;var _0x2e33fc=_0xc57c[_0x535144];return _0x2e33fc;};'use strict';var multer=require(_0xcc57('0x0'));var util=require(_0xcc57('0x1'));var path=require(_0xcc57('0x2'));var timeout=require(_0xcc57('0x3'));var express=require(_0xcc57('0x4'));var router=express[_0xcc57('0x5')]();var auth=require(_0xcc57('0x6'));var interaction=require(_0xcc57('0x7'));var config=require(_0xcc57('0x8'));var controller=require(_0xcc57('0x9'));router[_0xcc57('0xa')]('/',auth[_0xcc57('0xb')](),controller['index']);router[_0xcc57('0xa')](_0xcc57('0xc'),auth[_0xcc57('0xb')](),controller['show']);router[_0xcc57('0xd')]('/',auth[_0xcc57('0xb')](),controller['create']);router[_0xcc57('0xe')]('/:id',auth[_0xcc57('0xb')](),controller[_0xcc57('0xf')]);router[_0xcc57('0x10')](_0xcc57('0xc'),auth[_0xcc57('0xb')](),controller[_0xcc57('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa48e=['isAuthenticated','index','get','show','post','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller'];(function(_0x41d898,_0x392171){var _0x132192=function(_0xd70e01){while(--_0xd70e01){_0x41d898['push'](_0x41d898['shift']());}};_0x132192(++_0x392171);}(_0xa48e,0x1ab));var _0xea48=function(_0x2b38b5,_0x4dddca){_0x2b38b5=_0x2b38b5-0x0;var _0x286376=_0xa48e[_0x2b38b5];return _0x286376;};'use strict';var multer=require(_0xea48('0x0'));var util=require(_0xea48('0x1'));var path=require(_0xea48('0x2'));var timeout=require(_0xea48('0x3'));var express=require(_0xea48('0x4'));var router=express[_0xea48('0x5')]();var auth=require(_0xea48('0x6'));var interaction=require(_0xea48('0x7'));var config=require(_0xea48('0x8'));var controller=require(_0xea48('0x9'));router['get']('/',auth[_0xea48('0xa')](),controller[_0xea48('0xb')]);router[_0xea48('0xc')]('/:id',auth[_0xea48('0xa')](),controller[_0xea48('0xd')]);router[_0xea48('0xe')]('/',auth[_0xea48('0xa')](),controller['create']);router[_0xea48('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xea48('0x10')]);router[_0xea48('0x11')]('/:id',auth[_0xea48('0xa')](),controller[_0xea48('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 2786db9..5c095d7 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 _0xd09c=['sequelize','exports','STRING','noop','TEXT'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0xd09c,0x113));var _0xcd09=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd09c[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xcd09('0x0'));module[_0xcd09('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xcd09('0x2')],'allowNull':![],'defaultValue':_0xcd09('0x3')},'appdata':{'type':Sequelize[_0xcd09('0x4')]()},'description':{'type':Sequelize[_0xcd09('0x2')]},'interval':{'type':Sequelize[_0xcd09('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x9b85=['STRING','*,*,*,*','exports','INTEGER','noop','TEXT'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9b85,0x1b8));var _0x59b8=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x9b85[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x59b8('0x0')]={'priority':{'type':Sequelize[_0x59b8('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x59b8('0x2')},'appdata':{'type':Sequelize[_0x59b8('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x59b8('0x4')],'defaultValue':_0x59b8('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index e260d14..a039891 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 _0x66ee=['squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','json','apply','reject','update','destroy','stack','name','send','index','SmsApplication','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','include','findAll','rows','then','catch','params','includeAll','create','body','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash'];(function(_0x34360e,_0x1009d6){var _0x4c19c7=function(_0x2755bd){while(--_0x2755bd){_0x34360e['push'](_0x34360e['shift']());}};_0x4c19c7(++_0x1009d6);}(_0x66ee,0x85));var _0xe66e=function(_0x59b583,_0x227f10){_0x59b583=_0x59b583-0x0;var _0x38217b=_0x66ee[_0x59b583];return _0x38217b;};'use strict';var pdf=require(_0xe66e('0x0'));var emlformat=require(_0xe66e('0x1'));var rimraf=require(_0xe66e('0x2'));var zipdir=require(_0xe66e('0x3'));var jsonpatch=require(_0xe66e('0x4'));var rp=require('request-promise');var moment=require(_0xe66e('0x5'));var BPromise=require(_0xe66e('0x6'));var Mustache=require(_0xe66e('0x7'));var util=require(_0xe66e('0x8'));var path=require('path');var sox=require(_0xe66e('0x9'));var csv=require(_0xe66e('0xa'));var ejs=require(_0xe66e('0xb'));var fs=require('fs');var _=require(_0xe66e('0xc'));var squel=require(_0xe66e('0xd'));var crypto=require('crypto');var jsforce=require(_0xe66e('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe66e('0xf'));var Papa=require('papaparse');var Redis=require(_0xe66e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe66e('0x11'));var as=require(_0xe66e('0x12'));var hardwareService=require(_0xe66e('0x13'));var logger=require(_0xe66e('0x14'))(_0xe66e('0x15'));var utils=require(_0xe66e('0x16'));var config=require(_0xe66e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe66e('0x18'))['db'];function respondWithStatusCode(_0x279384,_0x4e68e8){_0x4e68e8=_0x4e68e8||0xcc;return function(_0x265b15){if(_0x265b15){return _0x279384[_0xe66e('0x19')](_0x4e68e8);}return _0x279384[_0xe66e('0x1a')](_0x4e68e8)[_0xe66e('0x1b')]();};}function respondWithResult(_0x39e53f,_0x3331c2){_0x3331c2=_0x3331c2||0xc8;return function(_0x22fbe9){if(_0x22fbe9){return _0x39e53f[_0xe66e('0x1a')](_0x3331c2)['json'](_0x22fbe9);}};}function respondWithFilteredResult(_0x399b99,_0x55fb65){return function(_0x88e27){if(_0x88e27){var _0x37db26=_0x88e27[_0xe66e('0x1c')],_0x3b9f1f=_0x55fb65[_0xe66e('0x1d')],_0x4591e2=_0x55fb65['offset']+_0x55fb65[_0xe66e('0x1e')],_0x386003;if(_0x4591e2>=_0x37db26){_0x4591e2=_0x37db26;_0x386003=0xc8;}else{_0x386003=0xce;}_0x399b99['status'](_0x386003);return _0x399b99['set']('Content-Range',_0x3b9f1f+'-'+_0x4591e2+'/'+_0x37db26)[_0xe66e('0x1f')](_0x88e27);}return null;};}function patchUpdates(_0x373f8a){return function(_0x593232){try{jsonpatch[_0xe66e('0x20')](_0x593232,_0x373f8a,!![]);}catch(_0xcb207c){return BPromise[_0xe66e('0x21')](_0xcb207c);}return _0x593232['save']();};}function saveUpdates(_0x263772,_0x25a2da){return function(_0x62686f){if(_0x62686f){return _0x62686f[_0xe66e('0x22')](_0x263772)['then'](function(_0x461fde){return _0x461fde;});}return null;};}function removeEntity(_0x3251bc,_0x481859){return function(_0x55ba00){if(_0x55ba00){return _0x55ba00[_0xe66e('0x23')]()['then'](function(){_0x3251bc[_0xe66e('0x1a')](0xcc)[_0xe66e('0x1b')]();});}};}function handleEntityNotFound(_0x5bb8db,_0x203961){return function(_0x2683d4){if(!_0x2683d4){_0x5bb8db['sendStatus'](0x194);}return _0x2683d4;};}function handleError(_0x45b2c7,_0x188cb7){_0x188cb7=_0x188cb7||0x1f4;return function(_0x5949ee){logger['error'](_0x5949ee[_0xe66e('0x24')]);if(_0x5949ee[_0xe66e('0x25')]){delete _0x5949ee[_0xe66e('0x25')];}_0x45b2c7[_0xe66e('0x1a')](_0x188cb7)[_0xe66e('0x26')](_0x5949ee);};}exports[_0xe66e('0x27')]=function(_0x564477,_0x21d771){var _0x10ed38={},_0xb3bbb2={},_0x3a9f68={'count':0x0,'rows':[]};var _0x3108f9=_['map'](db[_0xe66e('0x28')][_0xe66e('0x29')],function(_0x1256fb){return{'name':_0x1256fb[_0xe66e('0x2a')],'type':_0x1256fb[_0xe66e('0x2b')][_0xe66e('0x2c')]};});_0xb3bbb2[_0xe66e('0x2d')]=_[_0xe66e('0x2e')](_0x3108f9,_0xe66e('0x25'));_0xb3bbb2[_0xe66e('0x2f')]=_[_0xe66e('0x30')](_0x564477[_0xe66e('0x2f')]);_0xb3bbb2['filters']=_[_0xe66e('0x31')](_0xb3bbb2[_0xe66e('0x2d')],_0xb3bbb2['query']);_0x10ed38[_0xe66e('0x32')]=_[_0xe66e('0x31')](_0xb3bbb2[_0xe66e('0x2d')],qs['fields'](_0x564477[_0xe66e('0x2f')][_0xe66e('0x33')]));_0x10ed38[_0xe66e('0x32')]=_0x10ed38[_0xe66e('0x32')][_0xe66e('0x34')]?_0x10ed38[_0xe66e('0x32')]:_0xb3bbb2['model'];if(!_0x564477[_0xe66e('0x2f')][_0xe66e('0x35')](_0xe66e('0x36'))){_0x10ed38[_0xe66e('0x1e')]=qs[_0xe66e('0x1e')](_0x564477[_0xe66e('0x2f')]['limit']);_0x10ed38[_0xe66e('0x1d')]=qs[_0xe66e('0x1d')](_0x564477['query'][_0xe66e('0x1d')]);}_0x10ed38[_0xe66e('0x37')]=qs['sort'](_0x564477[_0xe66e('0x2f')][_0xe66e('0x38')]);_0x10ed38[_0xe66e('0x39')]=qs[_0xe66e('0x3a')](_['pick'](_0x564477[_0xe66e('0x2f')],_0xb3bbb2[_0xe66e('0x3a')]),_0x3108f9);if(_0x564477[_0xe66e('0x2f')]['filter']){_0x10ed38[_0xe66e('0x39')]=_[_0xe66e('0x3b')](_0x10ed38[_0xe66e('0x39')],{'$or':_[_0xe66e('0x2e')](_0x3108f9,function(_0x2d5527){if(_0x2d5527[_0xe66e('0x2b')]!==_0xe66e('0x3c')){var _0x59ae19={};_0x59ae19[_0x2d5527[_0xe66e('0x25')]]={'$like':'%'+_0x564477[_0xe66e('0x2f')][_0xe66e('0x3d')]+'%'};return _0x59ae19;}})});}_0x10ed38=_[_0xe66e('0x3b')]({},_0x10ed38,_0x564477[_0xe66e('0x3e')]);var _0x3f961b={'where':_0x10ed38['where']};return db[_0xe66e('0x28')]['count'](_0x3f961b)['then'](function(_0x27b11f){_0x3a9f68[_0xe66e('0x1c')]=_0x27b11f;if(_0x564477[_0xe66e('0x2f')]['includeAll']){_0x10ed38[_0xe66e('0x3f')]=[{'all':!![]}];}return db[_0xe66e('0x28')][_0xe66e('0x40')](_0x10ed38);})['then'](function(_0x482e8c){_0x3a9f68[_0xe66e('0x41')]=_0x482e8c;return _0x3a9f68;})[_0xe66e('0x42')](respondWithFilteredResult(_0x21d771,_0x10ed38))[_0xe66e('0x43')](handleError(_0x21d771,null));};exports['show']=function(_0x23c0c4,_0x2010a3){var _0x3acfa8={'raw':!![],'where':{'id':_0x23c0c4[_0xe66e('0x44')]['id']}},_0x22d5d5={};_0x22d5d5['model']=_[_0xe66e('0x30')](db[_0xe66e('0x28')][_0xe66e('0x29')]);_0x22d5d5[_0xe66e('0x2f')]=_['keys'](_0x23c0c4['query']);_0x22d5d5[_0xe66e('0x3a')]=_[_0xe66e('0x31')](_0x22d5d5['model'],_0x22d5d5[_0xe66e('0x2f')]);_0x3acfa8['attributes']=_[_0xe66e('0x31')](_0x22d5d5[_0xe66e('0x2d')],qs[_0xe66e('0x33')](_0x23c0c4[_0xe66e('0x2f')][_0xe66e('0x33')]));_0x3acfa8[_0xe66e('0x32')]=_0x3acfa8[_0xe66e('0x32')]['length']?_0x3acfa8[_0xe66e('0x32')]:_0x22d5d5[_0xe66e('0x2d')];if(_0x23c0c4[_0xe66e('0x2f')][_0xe66e('0x45')]){_0x3acfa8[_0xe66e('0x3f')]=[{'all':!![]}];}_0x3acfa8=_[_0xe66e('0x3b')]({},_0x3acfa8,_0x23c0c4['options']);return db[_0xe66e('0x28')]['find'](_0x3acfa8)[_0xe66e('0x42')](handleEntityNotFound(_0x2010a3,null))[_0xe66e('0x42')](respondWithResult(_0x2010a3,null))['catch'](handleError(_0x2010a3,null));};exports['create']=function(_0x481681,_0x33c4f8){return db['SmsApplication'][_0xe66e('0x46')](_0x481681[_0xe66e('0x47')],{})[_0xe66e('0x42')](respondWithResult(_0x33c4f8,0xc9))[_0xe66e('0x43')](handleError(_0x33c4f8,null));};exports['update']=function(_0x2c0108,_0x5666d1){if(_0x2c0108[_0xe66e('0x47')]['id']){delete _0x2c0108[_0xe66e('0x47')]['id'];}return db['SmsApplication']['find']({'where':{'id':_0x2c0108[_0xe66e('0x44')]['id']}})['then'](handleEntityNotFound(_0x5666d1,null))[_0xe66e('0x42')](saveUpdates(_0x2c0108[_0xe66e('0x47')],null))[_0xe66e('0x42')](respondWithResult(_0x5666d1,null))[_0xe66e('0x43')](handleError(_0x5666d1,null));};exports[_0xe66e('0x23')]=function(_0x4b3617,_0x5c9869){return db[_0xe66e('0x28')][_0xe66e('0x48')]({'where':{'id':_0x4b3617['params']['id']}})[_0xe66e('0x42')](handleEntityNotFound(_0x5c9869,null))[_0xe66e('0x42')](removeEntity(_0x5c9869,null))[_0xe66e('0x43')](handleError(_0x5c9869,null));}; \ No newline at end of file +var _0x434a=['where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','find','create','body','params','destroy','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','apply','reject','save','update','then','error','name','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort'];(function(_0xf918a5,_0x4e8d35){var _0x2cf208=function(_0x1e5c59){while(--_0x1e5c59){_0xf918a5['push'](_0xf918a5['shift']());}};_0x2cf208(++_0x4e8d35);}(_0x434a,0x9f));var _0xa434=function(_0x24769e,_0x54710a){_0x24769e=_0x24769e-0x0;var _0x3b7b45=_0x434a[_0x24769e];return _0x3b7b45;};'use strict';var pdf=require(_0xa434('0x0'));var emlformat=require(_0xa434('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa434('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa434('0x3'));var moment=require('moment');var BPromise=require(_0xa434('0x4'));var Mustache=require(_0xa434('0x5'));var util=require(_0xa434('0x6'));var path=require('path');var sox=require(_0xa434('0x7'));var csv=require(_0xa434('0x8'));var ejs=require(_0xa434('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa434('0xa'));var crypto=require(_0xa434('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa434('0xc'));var Papa=require(_0xa434('0xd'));var Redis=require(_0xa434('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa434('0xf'));var as=require(_0xa434('0x10'));var hardwareService=require(_0xa434('0x11'));var logger=require(_0xa434('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xa434('0x13'));var licenseUtil=require(_0xa434('0x14'));var db=require(_0xa434('0x15'))['db'];function respondWithStatusCode(_0x28ad78,_0x319fd7){_0x319fd7=_0x319fd7||0xcc;return function(_0x764f5b){if(_0x764f5b){return _0x28ad78[_0xa434('0x16')](_0x319fd7);}return _0x28ad78[_0xa434('0x17')](_0x319fd7)['end']();};}function respondWithResult(_0x2c87b8,_0x102ddb){_0x102ddb=_0x102ddb||0xc8;return function(_0x57dfb6){if(_0x57dfb6){return _0x2c87b8[_0xa434('0x17')](_0x102ddb)[_0xa434('0x18')](_0x57dfb6);}};}function respondWithFilteredResult(_0x258752,_0x15f0e5){return function(_0x216044){if(_0x216044){var _0x2b9de3=_0x216044[_0xa434('0x19')],_0x53ea88=_0x15f0e5[_0xa434('0x1a')],_0x3a84de=_0x15f0e5[_0xa434('0x1a')]+_0x15f0e5['limit'],_0x5030ba;if(_0x3a84de>=_0x2b9de3){_0x3a84de=_0x2b9de3;_0x5030ba=0xc8;}else{_0x5030ba=0xce;}_0x258752[_0xa434('0x17')](_0x5030ba);return _0x258752['set']('Content-Range',_0x53ea88+'-'+_0x3a84de+'/'+_0x2b9de3)[_0xa434('0x18')](_0x216044);}return null;};}function patchUpdates(_0x18aa1b){return function(_0x4d186e){try{jsonpatch[_0xa434('0x1b')](_0x4d186e,_0x18aa1b,!![]);}catch(_0x21fe0d){return BPromise[_0xa434('0x1c')](_0x21fe0d);}return _0x4d186e[_0xa434('0x1d')]();};}function saveUpdates(_0x26d612,_0x4dd684){return function(_0x5d169a){if(_0x5d169a){return _0x5d169a[_0xa434('0x1e')](_0x26d612)[_0xa434('0x1f')](function(_0xc682b9){return _0xc682b9;});}return null;};}function removeEntity(_0x1a6953,_0x388e46){return function(_0x54a71d){if(_0x54a71d){return _0x54a71d['destroy']()[_0xa434('0x1f')](function(){_0x1a6953[_0xa434('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa0b074,_0x4eafa2){return function(_0x1fdcdd){if(!_0x1fdcdd){_0xa0b074[_0xa434('0x16')](0x194);}return _0x1fdcdd;};}function handleError(_0x5ed500,_0x5bcc0f){_0x5bcc0f=_0x5bcc0f||0x1f4;return function(_0x322f42){logger[_0xa434('0x20')](_0x322f42['stack']);if(_0x322f42[_0xa434('0x21')]){delete _0x322f42[_0xa434('0x21')];}_0x5ed500[_0xa434('0x17')](_0x5bcc0f)['send'](_0x322f42);};}exports[_0xa434('0x22')]=function(_0x3a907d,_0x29ddfc){var _0x35d833={},_0x3dc993={},_0x1ce85a={'count':0x0,'rows':[]};var _0x2c9a3e=_[_0xa434('0x23')](db[_0xa434('0x24')][_0xa434('0x25')],function(_0x1bb245){return{'name':_0x1bb245[_0xa434('0x26')],'type':_0x1bb245[_0xa434('0x27')][_0xa434('0x28')]};});_0x3dc993[_0xa434('0x29')]=_[_0xa434('0x23')](_0x2c9a3e,'name');_0x3dc993[_0xa434('0x2a')]=_[_0xa434('0x2b')](_0x3a907d[_0xa434('0x2a')]);_0x3dc993[_0xa434('0x2c')]=_[_0xa434('0x2d')](_0x3dc993[_0xa434('0x29')],_0x3dc993[_0xa434('0x2a')]);_0x35d833[_0xa434('0x2e')]=_[_0xa434('0x2d')](_0x3dc993[_0xa434('0x29')],qs[_0xa434('0x2f')](_0x3a907d[_0xa434('0x2a')][_0xa434('0x2f')]));_0x35d833[_0xa434('0x2e')]=_0x35d833[_0xa434('0x2e')][_0xa434('0x30')]?_0x35d833[_0xa434('0x2e')]:_0x3dc993['model'];if(!_0x3a907d[_0xa434('0x2a')][_0xa434('0x31')](_0xa434('0x32'))){_0x35d833[_0xa434('0x33')]=qs[_0xa434('0x33')](_0x3a907d[_0xa434('0x2a')][_0xa434('0x33')]);_0x35d833[_0xa434('0x1a')]=qs[_0xa434('0x1a')](_0x3a907d[_0xa434('0x2a')][_0xa434('0x1a')]);}_0x35d833[_0xa434('0x34')]=qs['sort'](_0x3a907d[_0xa434('0x2a')][_0xa434('0x35')]);_0x35d833[_0xa434('0x36')]=qs[_0xa434('0x2c')](_[_0xa434('0x37')](_0x3a907d[_0xa434('0x2a')],_0x3dc993[_0xa434('0x2c')]),_0x2c9a3e);if(_0x3a907d[_0xa434('0x2a')][_0xa434('0x38')]){_0x35d833['where']=_[_0xa434('0x39')](_0x35d833[_0xa434('0x36')],{'$or':_[_0xa434('0x23')](_0x2c9a3e,function(_0x32aa73){if(_0x32aa73['type']!==_0xa434('0x3a')){var _0xf14892={};_0xf14892[_0x32aa73[_0xa434('0x21')]]={'$like':'%'+_0x3a907d['query'][_0xa434('0x38')]+'%'};return _0xf14892;}})});}_0x35d833=_[_0xa434('0x39')]({},_0x35d833,_0x3a907d[_0xa434('0x3b')]);var _0xd1bb62={'where':_0x35d833[_0xa434('0x36')]};return db[_0xa434('0x24')][_0xa434('0x19')](_0xd1bb62)['then'](function(_0x3485ef){_0x1ce85a[_0xa434('0x19')]=_0x3485ef;if(_0x3a907d[_0xa434('0x2a')][_0xa434('0x3c')]){_0x35d833['include']=[{'all':!![]}];}return db[_0xa434('0x24')][_0xa434('0x3d')](_0x35d833);})[_0xa434('0x1f')](function(_0x5286d0){_0x1ce85a[_0xa434('0x3e')]=_0x5286d0;return _0x1ce85a;})[_0xa434('0x1f')](respondWithFilteredResult(_0x29ddfc,_0x35d833))[_0xa434('0x3f')](handleError(_0x29ddfc,null));};exports[_0xa434('0x40')]=function(_0x30421b,_0x2f3a7d){var _0x459d62={'raw':!![],'where':{'id':_0x30421b['params']['id']}},_0x30377c={};_0x30377c[_0xa434('0x29')]=_[_0xa434('0x2b')](db[_0xa434('0x24')][_0xa434('0x25')]);_0x30377c[_0xa434('0x2a')]=_[_0xa434('0x2b')](_0x30421b[_0xa434('0x2a')]);_0x30377c[_0xa434('0x2c')]=_[_0xa434('0x2d')](_0x30377c[_0xa434('0x29')],_0x30377c[_0xa434('0x2a')]);_0x459d62[_0xa434('0x2e')]=_[_0xa434('0x2d')](_0x30377c[_0xa434('0x29')],qs['fields'](_0x30421b[_0xa434('0x2a')][_0xa434('0x2f')]));_0x459d62[_0xa434('0x2e')]=_0x459d62[_0xa434('0x2e')]['length']?_0x459d62[_0xa434('0x2e')]:_0x30377c[_0xa434('0x29')];if(_0x30421b['query'][_0xa434('0x3c')]){_0x459d62[_0xa434('0x41')]=[{'all':!![]}];}_0x459d62=_[_0xa434('0x39')]({},_0x459d62,_0x30421b[_0xa434('0x3b')]);return db[_0xa434('0x24')][_0xa434('0x42')](_0x459d62)[_0xa434('0x1f')](handleEntityNotFound(_0x2f3a7d,null))[_0xa434('0x1f')](respondWithResult(_0x2f3a7d,null))[_0xa434('0x3f')](handleError(_0x2f3a7d,null));};exports[_0xa434('0x43')]=function(_0x1adb6c,_0x3c20f9){return db[_0xa434('0x24')]['create'](_0x1adb6c['body'],{})[_0xa434('0x1f')](respondWithResult(_0x3c20f9,0xc9))[_0xa434('0x3f')](handleError(_0x3c20f9,null));};exports[_0xa434('0x1e')]=function(_0x3b64c4,_0x201fad){if(_0x3b64c4[_0xa434('0x44')]['id']){delete _0x3b64c4[_0xa434('0x44')]['id'];}return db[_0xa434('0x24')]['find']({'where':{'id':_0x3b64c4[_0xa434('0x45')]['id']}})[_0xa434('0x1f')](handleEntityNotFound(_0x201fad,null))[_0xa434('0x1f')](saveUpdates(_0x3b64c4['body'],null))[_0xa434('0x1f')](respondWithResult(_0x201fad,null))[_0xa434('0x3f')](handleError(_0x201fad,null));};exports[_0xa434('0x46')]=function(_0x618704,_0x79fb57){return db[_0xa434('0x24')][_0xa434('0x42')]({'where':{'id':_0x618704[_0xa434('0x45')]['id']}})[_0xa434('0x1f')](handleEntityNotFound(_0x79fb57,null))[_0xa434('0x1f')](removeEntity(_0x79fb57,null))[_0xa434('0x3f')](handleError(_0x79fb57,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 32a2d6d..ce9f339 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 _0xe3bc=['bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xe3bc,0x1c6));var _0xce3b=function(_0xc03fac,_0x5e8753){_0xc03fac=_0xc03fac-0x0;var _0xa1af02=_0xe3bc[_0xc03fac];return _0xa1af02;};'use strict';var _=require(_0xce3b('0x0'));var util=require(_0xce3b('0x1'));var logger=require(_0xce3b('0x2'))(_0xce3b('0x3'));var moment=require(_0xce3b('0x4'));var BPromise=require(_0xce3b('0x5'));var rp=require(_0xce3b('0x6'));var fs=require('fs');var path=require(_0xce3b('0x7'));var rimraf=require(_0xce3b('0x8'));var config=require(_0xce3b('0x9'));var attributes=require(_0xce3b('0xa'));module[_0xce3b('0xb')]=function(_0x5ed801,_0x2fcf08){return _0x5ed801[_0xce3b('0xc')](_0xce3b('0xd'),attributes,{'tableName':_0xce3b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xce3b('0xf'),'collate':_0xce3b('0x10')});}; \ No newline at end of file +var _0xc4ac=['bluebird','request-promise','path','rimraf','../../config/environment','SmsApplication','utf8mb4','util','../../config/logger','api','moment'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0xc4ac,0x80));var _0xcc4a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4ac[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xcc4a('0x0'));var logger=require(_0xcc4a('0x1'))(_0xcc4a('0x2'));var moment=require(_0xcc4a('0x3'));var BPromise=require(_0xcc4a('0x4'));var rp=require(_0xcc4a('0x5'));var fs=require('fs');var path=require(_0xcc4a('0x6'));var rimraf=require(_0xcc4a('0x7'));var config=require(_0xcc4a('0x8'));var attributes=require('./smsApplication.attributes');module['exports']=function(_0x22de3b,_0x4f00fc){return _0x22de3b['define'](_0xcc4a('0x9'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcc4a('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index c2b34c5..b4e9e51 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 _0xe35c=['request','info','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe35c,0x146));var _0xce35=function(_0x3d6d5e,_0x2cf163){_0x3d6d5e=_0x3d6d5e-0x0;var _0x2a7731=_0xe35c[_0x3d6d5e];return _0x2a7731;};'use strict';var _=require(_0xce35('0x0'));var util=require(_0xce35('0x1'));var moment=require(_0xce35('0x2'));var BPromise=require(_0xce35('0x3'));var rs=require(_0xce35('0x4'));var fs=require('fs');var Redis=require(_0xce35('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xce35('0x6'))('rpc');var config=require(_0xce35('0x7'));var jayson=require(_0xce35('0x8'));var client=jayson[_0xce35('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x270b81,_0x2df0d0,_0x2b4a82){return new BPromise(function(_0x74ae5e,_0x55e7f0){return client[_0xce35('0xa')](_0x270b81,_0x2b4a82)['then'](function(_0x549f60){logger[_0xce35('0xb')]('SmsApplication,\x20%s,\x20%s',_0x2df0d0,'request\x20sent');logger[_0xce35('0xc')](_0xce35('0xd'),_0x2df0d0,_0xce35('0xe'),JSON[_0xce35('0xf')](_0x549f60));if(_0x549f60[_0xce35('0x10')]){if(_0x549f60['error']['code']===0x1f4){logger[_0xce35('0x10')](_0xce35('0x11'),_0x2df0d0,_0x549f60[_0xce35('0x10')][_0xce35('0x12')]);return _0x55e7f0(_0x549f60[_0xce35('0x10')]['message']);}logger['error'](_0xce35('0x11'),_0x2df0d0,_0x549f60[_0xce35('0x10')]['message']);return _0x74ae5e(_0x549f60[_0xce35('0x10')][_0xce35('0x12')]);}else{logger[_0xce35('0xb')](_0xce35('0x11'),_0x2df0d0,_0xce35('0xe'));_0x74ae5e(_0x549f60[_0xce35('0x13')][_0xce35('0x12')]);}})[_0xce35('0x14')](function(_0x4388fd){logger[_0xce35('0x10')](_0xce35('0x11'),_0x2df0d0,_0x4388fd);_0x55e7f0(_0x4388fd);});});} \ No newline at end of file +var _0x5577=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5577,0x1b4));var _0x7557=function(_0x133c7c,_0x470a71){_0x133c7c=_0x133c7c-0x0;var _0x23aeed=_0x5577[_0x133c7c];return _0x23aeed;};'use strict';var _=require(_0x7557('0x0'));var util=require('util');var moment=require(_0x7557('0x1'));var BPromise=require(_0x7557('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7557('0x3'));var db=require(_0x7557('0x4'))['db'];var utils=require(_0x7557('0x5'));var logger=require(_0x7557('0x6'))(_0x7557('0x7'));var config=require(_0x7557('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7557('0x9')][_0x7557('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3da895,_0x1446fd,_0x33e9aa){return new BPromise(function(_0x37f335,_0xa4f49a){return client[_0x7557('0xb')](_0x3da895,_0x33e9aa)[_0x7557('0xc')](function(_0x24b592){logger[_0x7557('0xd')](_0x7557('0xe'),_0x1446fd,_0x7557('0xf'));logger[_0x7557('0x10')](_0x7557('0x11'),_0x1446fd,'request\x20sent',JSON['stringify'](_0x24b592));if(_0x24b592[_0x7557('0x12')]){if(_0x24b592[_0x7557('0x12')][_0x7557('0x13')]===0x1f4){logger[_0x7557('0x12')](_0x7557('0xe'),_0x1446fd,_0x24b592[_0x7557('0x12')][_0x7557('0x14')]);return _0xa4f49a(_0x24b592[_0x7557('0x12')][_0x7557('0x14')]);}logger[_0x7557('0x12')]('SmsApplication,\x20%s,\x20%s',_0x1446fd,_0x24b592[_0x7557('0x12')][_0x7557('0x14')]);return _0x37f335(_0x24b592[_0x7557('0x12')]['message']);}else{logger[_0x7557('0xd')](_0x7557('0xe'),_0x1446fd,_0x7557('0xf'));_0x37f335(_0x24b592[_0x7557('0x15')]['message']);}})[_0x7557('0x16')](function(_0x46057c){logger['error']('SmsApplication,\x20%s,\x20%s',_0x1446fd,_0x46057c);_0xa4f49a(_0x46057c);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index cad8b39..44db48b 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 _0x6de3=['/describe','describe','show','/:id/messages','getMessages','post','create','addMessage','tracked','sms','addTags','put','/:id','update','delete','smsinteraction:destroy','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x2ecf03,_0x2adccf){var _0x4418ab=function(_0x201f87){while(--_0x201f87){_0x2ecf03['push'](_0x2ecf03['shift']());}};_0x4418ab(++_0x2adccf);}(_0x6de3,0x1b7));var _0x36de=function(_0x856835,_0x456eb0){_0x856835=_0x856835-0x0;var _0x10bd81=_0x6de3[_0x856835];return _0x10bd81;};'use strict';var multer=require(_0x36de('0x0'));var util=require(_0x36de('0x1'));var path=require('path');var timeout=require(_0x36de('0x2'));var express=require(_0x36de('0x3'));var router=express[_0x36de('0x4')]();var auth=require(_0x36de('0x5'));var interaction=require(_0x36de('0x6'));var config=require(_0x36de('0x7'));var controller=require('./smsInteraction.controller');router[_0x36de('0x8')]('/',auth[_0x36de('0x9')](),controller[_0x36de('0xa')]);router[_0x36de('0x8')](_0x36de('0xb'),auth[_0x36de('0x9')](),controller[_0x36de('0xc')]);router['get']('/:id',auth[_0x36de('0x9')](),controller[_0x36de('0xd')]);router[_0x36de('0x8')](_0x36de('0xe'),auth[_0x36de('0x9')](),controller[_0x36de('0xf')]);router[_0x36de('0x8')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x36de('0x10')]('/',auth['isAuthenticated'](),controller[_0x36de('0x11')]);router[_0x36de('0x10')](_0x36de('0xe'),auth[_0x36de('0x9')](),controller[_0x36de('0x12')]);router[_0x36de('0x10')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x36de('0x13')](_0x36de('0x14'),'smsinteraction:addtags'),controller[_0x36de('0x15')]);router[_0x36de('0x16')](_0x36de('0x17'),auth[_0x36de('0x9')](),interaction[_0x36de('0x13')](_0x36de('0x14'),'smsinteraction:update'),controller[_0x36de('0x18')]);router[_0x36de('0x19')](_0x36de('0x17'),auth['isAuthenticated'](),interaction[_0x36de('0x13')](_0x36de('0x14'),_0x36de('0x1a')),controller['destroy']);router[_0x36de('0x19')](_0x36de('0x1b'),auth[_0x36de('0x9')](),controller[_0x36de('0x1c')]);module[_0x36de('0x1d')]=router; \ No newline at end of file +var _0x6f70=['path','express','Router','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','sms','addTags','smsinteraction:update','delete','tracked','smsinteraction:destroy','destroy','removeTags'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6f70,0x179));var _0x06f7=function(_0x9ea047,_0x593e8f){_0x9ea047=_0x9ea047-0x0;var _0x36a1db=_0x6f70[_0x9ea047];return _0x36a1db;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x06f7('0x0'));var timeout=require('connect-timeout');var express=require(_0x06f7('0x1'));var router=express[_0x06f7('0x2')]();var auth=require(_0x06f7('0x3'));var interaction=require(_0x06f7('0x4'));var config=require('../../config/environment');var controller=require(_0x06f7('0x5'));router[_0x06f7('0x6')]('/',auth['isAuthenticated'](),controller[_0x06f7('0x7')]);router[_0x06f7('0x6')](_0x06f7('0x8'),auth['isAuthenticated'](),controller[_0x06f7('0x9')]);router[_0x06f7('0x6')](_0x06f7('0xa'),auth[_0x06f7('0xb')](),controller[_0x06f7('0xc')]);router[_0x06f7('0x6')](_0x06f7('0xd'),auth[_0x06f7('0xb')](),controller[_0x06f7('0xe')]);router[_0x06f7('0x6')](_0x06f7('0xf'),auth['isAuthenticated'](),controller[_0x06f7('0x10')]);router[_0x06f7('0x11')]('/',auth[_0x06f7('0xb')](),controller[_0x06f7('0x12')]);router[_0x06f7('0x11')](_0x06f7('0xd'),auth[_0x06f7('0xb')](),controller[_0x06f7('0x13')]);router[_0x06f7('0x11')](_0x06f7('0x14'),auth['isAuthenticated'](),interaction['tracked'](_0x06f7('0x15'),'smsinteraction:addtags'),controller[_0x06f7('0x16')]);router['put'](_0x06f7('0xa'),auth[_0x06f7('0xb')](),interaction['tracked'](_0x06f7('0x15'),_0x06f7('0x17')),controller['update']);router[_0x06f7('0x18')](_0x06f7('0xa'),auth[_0x06f7('0xb')](),interaction[_0x06f7('0x19')](_0x06f7('0x15'),_0x06f7('0x1a')),controller[_0x06f7('0x1b')]);router[_0x06f7('0x18')]('/:id/tags',auth[_0x06f7('0xb')](),controller[_0x06f7('0x1c')]);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 c098daa..011060e 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 _0x7372=['sequelize','moment','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x7372,0x173));var _0x2737=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7372[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2737('0x0'));var moment=require(_0x2737('0x1'));module['exports']={'closed':{'type':Sequelize[_0x2737('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2737('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2737('0x4')]},'thirdDisposition':{'type':Sequelize[_0x2737('0x4')]},'note':{'type':Sequelize[_0x2737('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x2737('0x5')]('in',_0x2737('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2737('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x2737('0x5')]('in',_0x2737('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xcbc6=['DATE','STRING','ENUM','out','moment','BOOLEAN'];(function(_0x354099,_0x13ab24){var _0x43b42d=function(_0x29bda1){while(--_0x29bda1){_0x354099['push'](_0x354099['shift']());}};_0x43b42d(++_0x13ab24);}(_0xcbc6,0x1f0));var _0x6cbc=function(_0x1ff6b4,_0x56296e){_0x1ff6b4=_0x1ff6b4-0x0;var _0x57f725=_0xcbc6[_0x1ff6b4];return _0x57f725;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6cbc('0x0'));module['exports']={'closed':{'type':Sequelize[_0x6cbc('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6cbc('0x2')]},'disposition':{'type':Sequelize[_0x6cbc('0x3')]},'secondDisposition':{'type':Sequelize[_0x6cbc('0x3')]},'thirdDisposition':{'type':Sequelize[_0x6cbc('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x6cbc('0x3')]},'read1stAt':{'type':Sequelize[_0x6cbc('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x6cbc('0x4')]('in',_0x6cbc('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6cbc('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x6cbc('0x4')]('in',_0x6cbc('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 172f5b1..88d51fa 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 _0xa9e0=['params','keys','includeAll','include','options','create','body','describe','SmsMessage','addMessage','ids','omit','getMessages','format','rows','addTags','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','transcript-%d-%s.zip','CmContact','lastName','direction','SmsAccount','Owner','mkdirSync','10px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','Sms','YYYY-MM-DD','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','Messages','out','System','secret','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','catch','index','map','SmsInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','ContactId','buildExpression','text','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','length','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','show'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function updateSmsInteraction(_0x2407f9,_0x3ae878,_0x1122db){return new BPromise(function(_0x33bdb7,_0x25ce3a){return getInteractionUsers(_0x2407f9,_0x1122db)['then'](function(_0x66c1d2){return getInteractionTags(_0x66c1d2,_0x3ae878);})[_0x0a9e('0x22')](function(_0x40cb85){_0x33bdb7(_0x40cb85);})[_0x0a9e('0x2d')](function(_0x2b45ea){_0x25ce3a(_0x2b45ea);});});}exports[_0x0a9e('0x2e')]=function(_0x332d35,_0x39e565){var _0x5583a4={},_0x44295a={},_0x5e7238={'count':0x0,'rows':[]};var _0x2cc7a0=_[_0x0a9e('0x2f')](db[_0x0a9e('0x30')][_0x0a9e('0x31')],function(_0x567193){return{'name':_0x567193[_0x0a9e('0x32')],'type':_0x567193[_0x0a9e('0x33')][_0x0a9e('0x34')]};});_0x44295a[_0x0a9e('0x35')]=_['map'](_0x2cc7a0,'name');_0x44295a[_0x0a9e('0x36')]=_['keys'](_0x332d35[_0x0a9e('0x36')]);_0x44295a[_0x0a9e('0x37')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],_0x44295a['query']);_0x5583a4[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],qs['fields'](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]));_0x5583a4[_0x0a9e('0x39')]=_0x5583a4['attributes']['length']?_0x5583a4[_0x0a9e('0x39')]:_0x44295a[_0x0a9e('0x35')];if(!_0x332d35['query'][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x5583a4[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x332d35['query']['limit']);_0x5583a4[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x332d35['query'][_0x0a9e('0x1c')]);}_0x5583a4[_0x0a9e('0x3d')]=qs[_0x0a9e('0x3e')](_0x332d35['query'][_0x0a9e('0x3e')]);_0x5583a4[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x40')](_0x332d35[_0x0a9e('0x36')],_0x44295a[_0x0a9e('0x37')]),_0x2cc7a0);var _0x2881b3=[];var _0x45a9b8=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x25'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')]('tools_tags');var _0x52628e=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')](_0x0a9e('0x45'))[_0x0a9e('0x42')](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x44')](_0x0a9e('0x48'),'ui')[_0x0a9e('0x49')](_0x0a9e('0x4a'),'u',_0x0a9e('0x4b'));var _0x5026aa=squel[_0x0a9e('0x41')]()[_0x0a9e('0x44')](_0x0a9e('0x4c'),'i')[_0x0a9e('0x49')](_0x0a9e('0x4d'),'c',_0x0a9e('0x4e'))[_0x0a9e('0x49')](_0x0a9e('0x4a'),'o','o.id\x20=\x20i.UserId')[_0x0a9e('0x49')]('sms_accounts','a',_0x0a9e('0x4f'))[_0x0a9e('0x49')](_0x0a9e('0x50'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x0a9e('0x49')](_0x0a9e('0x51'),'it',_0x0a9e('0x52'))[_0x0a9e('0x49')](_0x0a9e('0x53'),'t',_0x0a9e('0x54'));var _0x45bf7f=squel['expr']();var _0x13f44d=[];var _0x1bde3c=squel[_0x0a9e('0x55')]();var _0x16f976;if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]){_0x16f976=as[_0x0a9e('0x57')](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]);var _0x58a5c2=_0x16f976[_0x0a9e('0x58')];for(var _0x3fe430=0x0;_0x3fe430<_0x16f976['conditions']['length'];_0x3fe430++){var _0x5ddf84=_0x16f976[_0x0a9e('0x59')][_0x3fe430];var _0x4317e3='i';var _0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x5ddf84[_0x0a9e('0x42')]]);if(!_0x37edaa){switch(_0x5ddf84[_0x0a9e('0x42')]){case _0x0a9e('0x5b'):if(_0x5ddf84['value']==0x1){_0x5026aa['having']('`'+_0x5ddf84['field']+_0x0a9e('0x5c'));}else{_0x5026aa[_0x0a9e('0x5d')]('`'+_0x5ddf84[_0x0a9e('0x42')]+'`\x20>\x200');}break;case _0x0a9e('0x5e'):if(_0x5ddf84[_0x0a9e('0x5f')]==='$substring'){if(_0x5ddf84['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x45bf7f[_0x58a5c2](_0x0a9e('0x60'),qs['getFullTextValue'](_0x5ddf84[_0x0a9e('0x61')]),null);}else{var _0x3c20b2='%'+_0x5ddf84[_0x0a9e('0x61')]+'%';_0x45bf7f[_0x58a5c2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3c20b2,_0x3c20b2,_0x3c20b2);}}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),'ContactId']);_0x5ddf84['field']=_0x0a9e('0x62');_0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa['type'],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'Tag':var _0x5da27d=_0x5ddf84['value'][_0x0a9e('0x2b')](',')['map'](function(_0x2f7092){return Number(_0x2f7092);});_0x5da27d[_0x0a9e('0x2c')](function(_0x3cfd00){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x3cfd00+',%');});_0x13f44d=_[_0x0a9e('0x68')](_0x13f44d,_0x5da27d);break;case _0x0a9e('0x69'):if(_0x5ddf84[_0x0a9e('0x5f')]===_0x0a9e('0x6a')){_0x45bf7f[_0x58a5c2]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5ddf84[_0x0a9e('0x61')]+'%',null);}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x0a9e('0x6b')]);_0x5ddf84[_0x0a9e('0x42')]=_0x0a9e('0x6b');_0x261adb=as['buildExpression'](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'body':_0x261adb=as['buildExpression']('me',null,_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb['text'],_0x261adb[_0x0a9e('0x61')]['start'],_0x261adb[_0x0a9e('0x61')][_0x0a9e('0x66')]);break;}}else{var _0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}}}else{var _0x1f07cb=_(_0x332d35[_0x0a9e('0x36')])['keys']()[_0x0a9e('0x2f')](function(_0x156f1c){return _[_0x0a9e('0x6c')](_0x2cc7a0,[_0x0a9e('0x25'),_0x156f1c])?_0x156f1c:undefined;})['compact']()[_0x0a9e('0x61')]();if(!_[_0x0a9e('0x6d')](_0x1f07cb)){_0x1f07cb['forEach'](function(_0x797b45){if(_0x797b45===_0x0a9e('0x6e')){_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x6f'),[][_0x0a9e('0x70')](_0x332d35['query'][_0x797b45]));}else if(_0x797b45===_0x0a9e('0x71')){var _0x2937e0=JSON[_0x0a9e('0x72')](_0x332d35['query'][_0x797b45])[_0x0a9e('0x73')];var _0x4f1e60=JSON['parse'](_0x332d35[_0x0a9e('0x36')][_0x797b45])[_0x0a9e('0x74')];_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x75'),_0x2937e0,_0x4f1e60);}else{if(_0x332d35[_0x0a9e('0x36')][_0x797b45]===_0x0a9e('0x76')){_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x77'));}else{_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x78'),_0x332d35[_0x0a9e('0x36')][_0x797b45]);}}});}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]==0x1){_0x5026aa[_0x0a9e('0x5d')](_0x0a9e('0x7a'));}else{_0x5026aa[_0x0a9e('0x5d')]('`unreadMessages`\x20>\x200');}}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]){_0x13f44d=_[_0x0a9e('0x7c')](_0x332d35['query'][_0x0a9e('0x7b')])?_0x332d35[_0x0a9e('0x36')]['tag']:new Array(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]);_0x13f44d[_0x0a9e('0x2c')](function(_0x427946){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x427946+',%');});}if(_0x332d35['query']['filter']){var _0x4a2438=_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7d')][_0x0a9e('0x7e')]('\x5c','\x5c\x5c')[_0x0a9e('0x7e')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x7f')](_0x4a2438)){_0x45bf7f['or'](_0x0a9e('0x80'),_0x4a2438+'%')['or'](_0x0a9e('0x81'),_0x4a2438+'%');}else{_0x45bf7f['or'](_0x0a9e('0x82'),qs['getFullTextValue'](_0x4a2438))['or'](_0x0a9e('0x83'),_0x4a2438+'%');}}}_0x5026aa[_0x0a9e('0x3f')](_0x45bf7f);_0x5026aa[_0x0a9e('0x84')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x85')][_0x0a9e('0x86')],'raw':!![]};var _0x4c46c1=_0x5026aa[_0x0a9e('0x87')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x88'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5b'));if(_0x5583a4[_0x0a9e('0x3d')]){_0x5583a4[_0x0a9e('0x3d')][_0x0a9e('0x2c')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x89')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x5026aa[_0x0a9e('0x3d')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0x13f44d)){_0x5026aa[_0x0a9e('0x5d')](_0x1bde3c);_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8b'),_0x13f44d);}BPromise[_0x0a9e('0x8c')]()[_0x0a9e('0x22')](function(){if(!_0x16f976){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return;_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8d'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x8d'));return;}if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]!==_0x0a9e('0x90'))return;return _0x332d35['user'][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x92'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x92'));}else{_0x4c46c1['where']('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));_0x5026aa[_0x0a9e('0x3f')]('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));}});})['then'](function(){if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]==='agent'&&!_0x16f976&&!_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x4c46c1[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x444f1f){_0x5e7238['count']=_0x444f1f[_0x0a9e('0x95')];if(_0x5e7238[_0x0a9e('0x1b')]===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x45a9b8['toString'](),_0x2bdc44)[_0x0a9e('0x22')](function(_0xf0db1){_0x2881b3=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x96')](_0x2bdc44,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]){_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x2c')](function(_0x5af453){_0x5026aa['field']('i.'+_0x5af453);});}else{_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x97'),_0x0a9e('0x5b'));_0x5026aa['field'](_0x0a9e('0x98'),_0x0a9e('0x99'));_0x5026aa['field']('a.mandatoryDisposition',_0x0a9e('0x9a'));_0x5026aa['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','contactName');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9b'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9c'),_0x0a9e('0x9d'));_0x5026aa[_0x0a9e('0x42')]('c.lastName',_0x0a9e('0x9e'));_0x5026aa['field'](_0x0a9e('0x9f'),_0x0a9e('0xa0'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa1'),'Contact.phone');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x5026aa['field'](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x5026aa['field'](_0x0a9e('0xaa'),_0x0a9e('0x29'));}if(_0x5583a4['limit'])_0x5026aa[_0x0a9e('0x1d')](_0x5583a4[_0x0a9e('0x1d')]);if(_0x5583a4[_0x0a9e('0x1c')])_0x5026aa['offset'](_0x5583a4[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x36')](_0x5026aa[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x1f29bd){_0x52628e[_0x0a9e('0x3f')](_0x0a9e('0xab'),_[_0x0a9e('0x2f')](_0x1f29bd,'id'));return db[_0x0a9e('0x93')]['query'](_0x52628e[_0x0a9e('0x94')](),_0x2bdc44)[_0x0a9e('0x22')](function(_0x17f692){var _0x30ef6e=_[_0x0a9e('0xac')](_0x17f692,_0x0a9e('0xad'));var _0x6803d6=[];_0x1f29bd[_0x0a9e('0x2c')](function(_0x1808ba){_0x6803d6[_0x0a9e('0xae')](updateSmsInteraction(_0x1808ba,_0x2881b3,_0x30ef6e));});return BPromise[_0x0a9e('0xaf')](_0x6803d6);});});})[_0x0a9e('0x22')](function(_0x18273f){_0x5e7238['rows']=_0x18273f;return _0x5e7238;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x39e565,_0x5583a4))[_0x0a9e('0x2d')](handleError(_0x39e565,null));};exports[_0x0a9e('0xb0')]=function(_0x2ed526,_0xb0599a){var _0x5d9ddb={'raw':![],'where':{'id':_0x2ed526[_0x0a9e('0xb1')]['id']}},_0x3afc8c={};_0x3afc8c['model']=_[_0x0a9e('0xb2')](db['SmsInteraction'][_0x0a9e('0x31')]);_0x3afc8c[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x2ed526[_0x0a9e('0x36')]);_0x3afc8c['filters']=_[_0x0a9e('0x38')](_0x3afc8c['model'],_0x3afc8c[_0x0a9e('0x36')]);_0x5d9ddb[_0x0a9e('0x39')]=_['intersection'](_0x3afc8c[_0x0a9e('0x35')],qs[_0x0a9e('0x3a')](_0x2ed526[_0x0a9e('0x36')]['fields']));_0x5d9ddb['attributes']=_0x5d9ddb[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x5d9ddb[_0x0a9e('0x39')]:_0x3afc8c[_0x0a9e('0x35')];if(_0x2ed526[_0x0a9e('0x36')][_0x0a9e('0xb3')]){_0x5d9ddb[_0x0a9e('0xb4')]=[{'all':!![]}];}_0x5d9ddb=_[_0x0a9e('0x96')]({},_0x5d9ddb,_0x2ed526[_0x0a9e('0xb5')]);return db['SmsInteraction'][_0x0a9e('0x5a')](_0x5d9ddb)['then'](handleEntityNotFound(_0xb0599a,null))[_0x0a9e('0x22')](respondWithResult(_0xb0599a,null))[_0x0a9e('0x2d')](handleError(_0xb0599a,null));};exports[_0x0a9e('0xb6')]=function(_0x28ce92,_0x1b61d5){return db['SmsInteraction'][_0x0a9e('0xb6')](_0x28ce92[_0x0a9e('0xb7')],{})[_0x0a9e('0x22')](respondWithResult(_0x1b61d5,0xc9))[_0x0a9e('0x2d')](handleError(_0x1b61d5,null));};exports[_0x0a9e('0x20')]=function(_0x5c66ef,_0x4f074c){if(_0x5c66ef[_0x0a9e('0xb7')]['id']){delete _0x5c66ef['body']['id'];}return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x5c66ef[_0x0a9e('0xb1')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](saveUpdates(_0x5c66ef[_0x0a9e('0xb7')],null))['then'](respondWithResult(_0x4f074c,null))['catch'](handleError(_0x4f074c,null));};exports[_0x0a9e('0x21')]=function(_0x5dfbe2,_0x2469d1){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x5dfbe2['params']['id']}})['then'](handleEntityNotFound(_0x2469d1,null))[_0x0a9e('0x22')](removeEntity(_0x2469d1,null))[_0x0a9e('0x2d')](handleError(_0x2469d1,null));};exports['describe']=function(_0x170af6,_0x17cb30){return db[_0x0a9e('0x30')][_0x0a9e('0xb8')]()[_0x0a9e('0x22')](respondWithResult(_0x17cb30,null))['catch'](handleError(_0x17cb30,null));};exports['addMessage']=function(_0x16449b,_0x22286c,_0x41c8cd){return db[_0x0a9e('0xb9')][_0x0a9e('0x5a')]({'where':{'id':_0x16449b['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x22286c,null))[_0x0a9e('0x22')](function(_0x5416a9){if(_0x5416a9){return _0x5416a9[_0x0a9e('0xba')](_0x16449b[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_[_0x0a9e('0xbc')](_0x16449b[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x22286c,null))[_0x0a9e('0x2d')](handleError(_0x22286c,null));};exports[_0x0a9e('0xbd')]=function(_0x16afb3,_0x4bdebb,_0x1065a7){var _0x301047={'raw':![],'where':{}};var _0x2ada60={};var _0x1c4232={'count':0x0,'rows':[]};return db[_0x0a9e('0x30')]['findOne']({'where':{'id':_0x16afb3['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4bdebb,null))[_0x0a9e('0x22')](function(_0x466bbf){if(_0x466bbf){_0x2ada60[_0x0a9e('0x35')]=_[_0x0a9e('0xb2')](db['SmsMessage'][_0x0a9e('0x31')]);_0x2ada60[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x16afb3['query']);_0x2ada60[_0x0a9e('0x37')]=_['intersection'](_0x2ada60[_0x0a9e('0x35')],_0x2ada60['query']);_0x301047[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x2ada60[_0x0a9e('0x35')],qs['fields'](_0x16afb3[_0x0a9e('0x36')]['fields']));_0x301047[_0x0a9e('0x39')]=_0x301047[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x301047[_0x0a9e('0x39')]:_0x2ada60[_0x0a9e('0x35')];if(!_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x301047[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1d')]);_0x301047[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1c')]);}_0x301047['order']=qs['sort'](_0x16afb3[_0x0a9e('0x36')]['sort']);_0x301047[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_['pick'](_0x16afb3[_0x0a9e('0x36')],_0x2ada60[_0x0a9e('0x37')]));_0x301047[_0x0a9e('0x3f')][_0x0a9e('0xad')]=_0x466bbf['id'];if(_0x16afb3['query'][_0x0a9e('0x7d')]){_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047[_0x0a9e('0x3f')],{'$or':_['map'](_0x301047[_0x0a9e('0x39')],function(_0x1a0b08){var _0x2b7092={};_0x2b7092[_0x1a0b08]={'$like':'%'+_0x16afb3['query'][_0x0a9e('0x7d')]+'%'};return _0x2b7092;})});}if(_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')]){var _0x54b107=_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')][_0x0a9e('0x2b')](',');var _0x1a7f58={};_0x1a7f58[_0x54b107[0x0]]={'$gte':moment(_0x54b107[0x1])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047['where'],_0x1a7f58);}_0x301047=_[_0x0a9e('0x96')]({},_0x301047,_0x16afb3[_0x0a9e('0xb5')]);return db[_0x0a9e('0xb9')]['count']({'where':_0x301047['where']})['then'](function(_0x1015aa){_0x1c4232[_0x0a9e('0x1b')]=_0x1015aa;if(_0x16afb3['query'][_0x0a9e('0xb3')]){_0x301047[_0x0a9e('0xb4')]=[{'all':!![]}];}return db[_0x0a9e('0xb9')]['findAll'](_0x301047);})[_0x0a9e('0x22')](function(_0x30e037){_0x1c4232[_0x0a9e('0xbf')]=_0x30e037;return _0x1c4232;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4bdebb,_0x301047))[_0x0a9e('0x2d')](handleError(_0x4bdebb,null));};exports[_0x0a9e('0xc0')]=function(_0x40e6e7,_0x328ec5,_0x3b5bda){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x40e6e7['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x328ec5,null))[_0x0a9e('0x22')](function(_0x2097d8){if(_0x2097d8){return _0x2097d8[_0x0a9e('0xc1')](_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_['omit'](_0x40e6e7[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{})[_0x0a9e('0xc2')](function(){return db[_0x0a9e('0xc3')]['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x43')],'where':{'id':_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')]}});})[_0x0a9e('0x22')](function(_0x2be526){socket[_0x0a9e('0xc4')](_0x0a9e('0xc5'),{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]});return{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]};});}})['then'](respondWithResult(_0x328ec5,null))[_0x0a9e('0x2d')](handleError(_0x328ec5,null));};exports[_0x0a9e('0xc6')]=function(_0x2ff265,_0x26b826,_0xea8bd1){return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x2ff265[_0x0a9e('0xb1')]['id']}})['then'](handleEntityNotFound(_0x26b826,null))[_0x0a9e('0x22')](function(_0xd2391){if(_0xd2391){return _0xd2391[_0x0a9e('0xc6')](_0x2ff265['query'][_0x0a9e('0xbb')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x26b826,null))[_0x0a9e('0x2d')](handleError(_0x26b826,null));};exports[_0x0a9e('0xc7')]=function(_0x370b5e,_0x1ba457){var _0x424f1b=moment()[_0x0a9e('0xc8')]()[_0x0a9e('0x94')]();var _0x451010=path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xcb'),_0x0a9e('0xcc'));var _0x2b624e=path[_0x0a9e('0xcd')](config['root'],_0x0a9e('0xca'),'files','attachments');var _0x573df6=path[_0x0a9e('0xcd')](_0x451010,_0x424f1b);var _0x3fa3f2=util[_0x0a9e('0xbe')](_0x0a9e('0xce'),_0x370b5e['params']['id'],_0x424f1b);var _0x4156a5=path[_0x0a9e('0xcd')](_0x451010,_0x3fa3f2);var _0x3ddbc7=[];_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0x69')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xcf')],'as':_0x0a9e('0x5e'),'attributes':['id','firstName',_0x0a9e('0xd0')],'raw':!![]});var _0x248a9a=[{'model':db[_0x0a9e('0xb9')],'as':'Messages','attributes':['id',_0x0a9e('0xb7'),_0x0a9e('0x71'),_0x0a9e('0xd1'),'secret',_0x0a9e('0x79')],'include':_0x3ddbc7}];_0x248a9a[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xd2')],'as':'Account','attributes':['id','name']});_0x248a9a['push']({'model':db[_0x0a9e('0x69')],'as':_0x0a9e('0xd3'),'attributes':['id',_0x0a9e('0x28')]});return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x370b5e[_0x0a9e('0xb1')]['id']},'include':_0x248a9a})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x2ff2ab){if(_0x2ff2ab){var _0x242f23=_0x2ff2ab['get']({'plain':!![]});fs[_0x0a9e('0xd4')](_0x573df6);var _0x33a26c={'format':'A4','border':_0x0a9e('0xd5'),'header':{'height':'40px','contents':{'first':_0x0a9e('0xd6')}},'footer':{'height':'30px','contents':{'default':util[_0x0a9e('0xbe')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0x0a9e('0xbe')]('%s\x20#%d',_0x0a9e('0xd7'),_0x242f23['id']),moment()[_0x0a9e('0xbe')](_0x0a9e('0xd8'))[_0x0a9e('0x94')]())}}};var _0x1e306c={'channel':_0x0a9e('0xd7'),'account':_0x242f23[_0x0a9e('0xd9')]['name'],'agent':_0x242f23[_0x0a9e('0xd3')]?_0x242f23[_0x0a9e('0xd3')]['fullname']:_0x0a9e('0xda'),'createdAt':moment(_0x242f23[_0x0a9e('0x71')])['format'](_0x0a9e('0xdb'))[_0x0a9e('0x94')](),'closedAt':_0x242f23[_0x0a9e('0xdc')]?moment(_0x242f23['closedAt'])[_0x0a9e('0xbe')](_0x0a9e('0xdb'))[_0x0a9e('0x94')]():'','disposition':_0x242f23[_0x0a9e('0xdd')],'messages':_(_0x242f23[_0x0a9e('0xde')])[_0x0a9e('0x7d')]({'secret':![]})[_0x0a9e('0x2f')](function(_0x74d9b8){return{'date':moment(_0x74d9b8[_0x0a9e('0x71')])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0a9e('0x94')](),'sender':_0x74d9b8['direction']===_0x0a9e('0xdf')?_0x74d9b8[_0x0a9e('0x69')]?_0x74d9b8[_0x0a9e('0x69')][_0x0a9e('0x28')]:_0x0a9e('0xe0'):_0x74d9b8[_0x0a9e('0x5e')]['firstName']+(_0x74d9b8[_0x0a9e('0x5e')][_0x0a9e('0xd0')]?'\x20'+_0x74d9b8[_0x0a9e('0x5e')]['lastName']:''),'body':_0x74d9b8[_0x0a9e('0xb7')],'direction':_0x74d9b8[_0x0a9e('0xd1')]===_0x0a9e('0xdf')?'A':'C','secret':_0x74d9b8[_0x0a9e('0xe1')],'read':_0x74d9b8[_0x0a9e('0x79')]};})[_0x0a9e('0x61')]()};return ejs[_0x0a9e('0xe2')](path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xe3'),_0x0a9e('0xe4')),{'interaction':_0x1e306c})[_0x0a9e('0x22')](function(_0x241404){return new BPromise(function(_0x8120e,_0x5d6a48){pdf['create'](_0x241404,_0x33a26c)[_0x0a9e('0xe5')](path[_0x0a9e('0xcd')](_0x573df6,_0x0a9e('0xe6')+_0x242f23['id']+'-'+_0x424f1b+_0x0a9e('0xe7')),function(_0x40e2da,_0x131da8){if(_0x40e2da)return _0x5d6a48(_0x40e2da);_0x8120e(_0x131da8);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x584854,_0x39ea62){zipdir(_0x573df6,{'saveTo':_0x4156a5},function(_0x1d7fc4,_0x2d8e91){if(_0x1d7fc4)return _0x39ea62(_0x1d7fc4);return _0x584854(_0x2d8e91);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1b1757,_0x3c6082){rimraf(_0x573df6,function(_0x16be7e){if(_0x16be7e)_0x3c6082(_0x16be7e);return _0x1b1757();});});})['then'](function(){return _0x1ba457[_0x0a9e('0xc7')](_0x4156a5,_0x3fa3f2,function(_0x294310){if(_0x294310){console[_0x0a9e('0xe8')]('err',_0x294310);}else{fs[_0x0a9e('0xe9')](_0x4156a5);}});});});}else{return _0x1ba457[_0x0a9e('0x23')](0xc8);}})[_0x0a9e('0x2d')](handleError(_0x1ba457,null));}; \ No newline at end of file +var _0xa9e0=['params','keys','includeAll','include','options','create','body','describe','SmsMessage','addMessage','ids','omit','getMessages','format','rows','addTags','setTags','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','transcript-%d-%s.zip','CmContact','lastName','direction','SmsAccount','Owner','mkdirSync','10px','\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20','Sms','YYYY-MM-DD','Account','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','Messages','out','System','secret','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','unlinkSync','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','Users','fullname','TagIds','Tags','split','forEach','catch','index','map','SmsInteraction','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','ContactId','buildExpression','text','start','end','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','length','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','all','show'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}function getInteractionUsers(_0x14433c,_0x140511){return new BPromise(function(_0x1538a4,_0x11c3b6){try{if(_0x140511[_0x14433c['id']]){_0x14433c[_0x0a9e('0x27')]=_['map'](_0x140511[_0x14433c['id']],function(_0x3652a7){return{'id':_0x3652a7['id'],'fullname':_0x3652a7[_0x0a9e('0x28')]};});}}catch(_0x2b1f27){_0x11c3b6(_0x2b1f27);}_0x1538a4(_0x14433c);});}function getInteractionTags(_0x2ec755,_0x5c877d){return new BPromise(function(_0x15b200,_0x40e7a3){try{if(_0x2ec755[_0x0a9e('0x29')]){_0x2ec755[_0x0a9e('0x2a')]=[];_0x2ec755[_0x0a9e('0x29')][_0x0a9e('0x2b')](',')[_0x0a9e('0x2c')](function(_0x2e8759){_0x2ec755[_0x0a9e('0x2a')]['push'](_0x5c877d[_0x2e8759]);});}delete _0x2ec755[_0x0a9e('0x29')];}catch(_0x5d1e0e){_0x40e7a3(_0x5d1e0e);}_0x15b200(_0x2ec755);});}function updateSmsInteraction(_0x2407f9,_0x3ae878,_0x1122db){return new BPromise(function(_0x33bdb7,_0x25ce3a){return getInteractionUsers(_0x2407f9,_0x1122db)['then'](function(_0x66c1d2){return getInteractionTags(_0x66c1d2,_0x3ae878);})[_0x0a9e('0x22')](function(_0x40cb85){_0x33bdb7(_0x40cb85);})[_0x0a9e('0x2d')](function(_0x2b45ea){_0x25ce3a(_0x2b45ea);});});}exports[_0x0a9e('0x2e')]=function(_0x332d35,_0x39e565){var _0x5583a4={},_0x44295a={},_0x5e7238={'count':0x0,'rows':[]};var _0x2cc7a0=_[_0x0a9e('0x2f')](db[_0x0a9e('0x30')][_0x0a9e('0x31')],function(_0x567193){return{'name':_0x567193[_0x0a9e('0x32')],'type':_0x567193[_0x0a9e('0x33')][_0x0a9e('0x34')]};});_0x44295a[_0x0a9e('0x35')]=_['map'](_0x2cc7a0,'name');_0x44295a[_0x0a9e('0x36')]=_['keys'](_0x332d35[_0x0a9e('0x36')]);_0x44295a[_0x0a9e('0x37')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],_0x44295a['query']);_0x5583a4[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x44295a[_0x0a9e('0x35')],qs['fields'](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]));_0x5583a4[_0x0a9e('0x39')]=_0x5583a4['attributes']['length']?_0x5583a4[_0x0a9e('0x39')]:_0x44295a[_0x0a9e('0x35')];if(!_0x332d35['query'][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x5583a4[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x332d35['query']['limit']);_0x5583a4[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x332d35['query'][_0x0a9e('0x1c')]);}_0x5583a4[_0x0a9e('0x3d')]=qs[_0x0a9e('0x3e')](_0x332d35['query'][_0x0a9e('0x3e')]);_0x5583a4[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_[_0x0a9e('0x40')](_0x332d35[_0x0a9e('0x36')],_0x44295a[_0x0a9e('0x37')]),_0x2cc7a0);var _0x2881b3=[];var _0x45a9b8=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')]('id')[_0x0a9e('0x42')](_0x0a9e('0x25'))[_0x0a9e('0x42')](_0x0a9e('0x43'))[_0x0a9e('0x44')]('tools_tags');var _0x52628e=squel[_0x0a9e('0x41')]()[_0x0a9e('0x42')](_0x0a9e('0x45'))[_0x0a9e('0x42')](_0x0a9e('0x46'))[_0x0a9e('0x42')](_0x0a9e('0x47'))[_0x0a9e('0x44')](_0x0a9e('0x48'),'ui')[_0x0a9e('0x49')](_0x0a9e('0x4a'),'u',_0x0a9e('0x4b'));var _0x5026aa=squel[_0x0a9e('0x41')]()[_0x0a9e('0x44')](_0x0a9e('0x4c'),'i')[_0x0a9e('0x49')](_0x0a9e('0x4d'),'c',_0x0a9e('0x4e'))[_0x0a9e('0x49')](_0x0a9e('0x4a'),'o','o.id\x20=\x20i.UserId')[_0x0a9e('0x49')]('sms_accounts','a',_0x0a9e('0x4f'))[_0x0a9e('0x49')](_0x0a9e('0x50'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x0a9e('0x49')](_0x0a9e('0x51'),'it',_0x0a9e('0x52'))[_0x0a9e('0x49')](_0x0a9e('0x53'),'t',_0x0a9e('0x54'));var _0x45bf7f=squel['expr']();var _0x13f44d=[];var _0x1bde3c=squel[_0x0a9e('0x55')]();var _0x16f976;if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]){_0x16f976=as[_0x0a9e('0x57')](_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x56')]);var _0x58a5c2=_0x16f976[_0x0a9e('0x58')];for(var _0x3fe430=0x0;_0x3fe430<_0x16f976['conditions']['length'];_0x3fe430++){var _0x5ddf84=_0x16f976[_0x0a9e('0x59')][_0x3fe430];var _0x4317e3='i';var _0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x5ddf84[_0x0a9e('0x42')]]);if(!_0x37edaa){switch(_0x5ddf84[_0x0a9e('0x42')]){case _0x0a9e('0x5b'):if(_0x5ddf84['value']==0x1){_0x5026aa['having']('`'+_0x5ddf84['field']+_0x0a9e('0x5c'));}else{_0x5026aa[_0x0a9e('0x5d')]('`'+_0x5ddf84[_0x0a9e('0x42')]+'`\x20>\x200');}break;case _0x0a9e('0x5e'):if(_0x5ddf84[_0x0a9e('0x5f')]==='$substring'){if(_0x5ddf84['value'][_0x0a9e('0x2b')]('\x20')['length']>0x1){_0x45bf7f[_0x58a5c2](_0x0a9e('0x60'),qs['getFullTextValue'](_0x5ddf84[_0x0a9e('0x61')]),null);}else{var _0x3c20b2='%'+_0x5ddf84[_0x0a9e('0x61')]+'%';_0x45bf7f[_0x58a5c2]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3c20b2,_0x3c20b2,_0x3c20b2);}}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),'ContactId']);_0x5ddf84['field']=_0x0a9e('0x62');_0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa['type'],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'Tag':var _0x5da27d=_0x5ddf84['value'][_0x0a9e('0x2b')](',')['map'](function(_0x2f7092){return Number(_0x2f7092);});_0x5da27d[_0x0a9e('0x2c')](function(_0x3cfd00){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x3cfd00+',%');});_0x13f44d=_[_0x0a9e('0x68')](_0x13f44d,_0x5da27d);break;case _0x0a9e('0x69'):if(_0x5ddf84[_0x0a9e('0x5f')]===_0x0a9e('0x6a')){_0x45bf7f[_0x58a5c2]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x5ddf84[_0x0a9e('0x61')]+'%',null);}else{_0x37edaa=_[_0x0a9e('0x5a')](_0x2cc7a0,[_0x0a9e('0x25'),_0x0a9e('0x6b')]);_0x5ddf84[_0x0a9e('0x42')]=_0x0a9e('0x6b');_0x261adb=as['buildExpression'](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}break;case'body':_0x261adb=as['buildExpression']('me',null,_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb['text'],_0x261adb[_0x0a9e('0x61')]['start'],_0x261adb[_0x0a9e('0x61')][_0x0a9e('0x66')]);break;}}else{var _0x261adb=as[_0x0a9e('0x63')](_0x4317e3,_0x37edaa[_0x0a9e('0x33')],_0x5ddf84);_0x45bf7f[_0x58a5c2](_0x261adb[_0x0a9e('0x64')],_0x261adb['value'][_0x0a9e('0x65')],_0x261adb['value'][_0x0a9e('0x66')]);}}}else{var _0x1f07cb=_(_0x332d35[_0x0a9e('0x36')])['keys']()[_0x0a9e('0x2f')](function(_0x156f1c){return _[_0x0a9e('0x6c')](_0x2cc7a0,[_0x0a9e('0x25'),_0x156f1c])?_0x156f1c:undefined;})['compact']()[_0x0a9e('0x61')]();if(!_[_0x0a9e('0x6d')](_0x1f07cb)){_0x1f07cb['forEach'](function(_0x797b45){if(_0x797b45===_0x0a9e('0x6e')){_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x6f'),[][_0x0a9e('0x70')](_0x332d35['query'][_0x797b45]));}else if(_0x797b45===_0x0a9e('0x71')){var _0x2937e0=JSON[_0x0a9e('0x72')](_0x332d35['query'][_0x797b45])[_0x0a9e('0x73')];var _0x4f1e60=JSON['parse'](_0x332d35[_0x0a9e('0x36')][_0x797b45])[_0x0a9e('0x74')];_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x75'),_0x2937e0,_0x4f1e60);}else{if(_0x332d35[_0x0a9e('0x36')][_0x797b45]===_0x0a9e('0x76')){_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x77'));}else{_0x5026aa[_0x0a9e('0x3f')]('i.'+_0x797b45+_0x0a9e('0x78'),_0x332d35[_0x0a9e('0x36')][_0x797b45]);}}});}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x79')]==0x1){_0x5026aa[_0x0a9e('0x5d')](_0x0a9e('0x7a'));}else{_0x5026aa[_0x0a9e('0x5d')]('`unreadMessages`\x20>\x200');}}if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]){_0x13f44d=_[_0x0a9e('0x7c')](_0x332d35['query'][_0x0a9e('0x7b')])?_0x332d35[_0x0a9e('0x36')]['tag']:new Array(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7b')]);_0x13f44d[_0x0a9e('0x2c')](function(_0x427946){_0x1bde3c['or'](_0x0a9e('0x67'),'%,'+_0x427946+',%');});}if(_0x332d35['query']['filter']){var _0x4a2438=_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x7d')][_0x0a9e('0x7e')]('\x5c','\x5c\x5c')[_0x0a9e('0x7e')](/'/g,'\x27\x27');if(qs[_0x0a9e('0x7f')](_0x4a2438)){_0x45bf7f['or'](_0x0a9e('0x80'),_0x4a2438+'%')['or'](_0x0a9e('0x81'),_0x4a2438+'%');}else{_0x45bf7f['or'](_0x0a9e('0x82'),qs['getFullTextValue'](_0x4a2438))['or'](_0x0a9e('0x83'),_0x4a2438+'%');}}}_0x5026aa[_0x0a9e('0x3f')](_0x45bf7f);_0x5026aa[_0x0a9e('0x84')]('i.id');var _0x2bdc44={'type':db['Sequelize'][_0x0a9e('0x85')][_0x0a9e('0x86')],'raw':!![]};var _0x4c46c1=_0x5026aa[_0x0a9e('0x87')]();_0x4c46c1[_0x0a9e('0x42')](_0x0a9e('0x88'));_0x4c46c1[_0x0a9e('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a9e('0x5b'));if(_0x5583a4[_0x0a9e('0x3d')]){_0x5583a4[_0x0a9e('0x3d')][_0x0a9e('0x2c')](function(_0x5b7fc3){var _0x109ccb=_0x5b7fc3[0x0]===_0x0a9e('0x89')?_0x5b7fc3[0x0]:'i.'+_0x5b7fc3[0x0];_0x5026aa[_0x0a9e('0x3d')](_0x109ccb,_0x5b7fc3[0x1]===_0x0a9e('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0x13f44d)){_0x5026aa[_0x0a9e('0x5d')](_0x1bde3c);_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8b'),_0x13f44d);}BPromise[_0x0a9e('0x8c')]()[_0x0a9e('0x22')](function(){if(!_0x16f976){if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return;_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x8d'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x8d'));return;}if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]!==_0x0a9e('0x90'))return;return _0x332d35['user'][_0x0a9e('0x91')]({'attributes':['id'],'raw':!![]})[_0x0a9e('0x22')](function(_0xc599b3){if(_['isEmpty'](_0xc599b3)){_0x4c46c1[_0x0a9e('0x3f')](_0x0a9e('0x92'));_0x5026aa[_0x0a9e('0x3f')](_0x0a9e('0x92'));}else{_0x4c46c1['where']('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));_0x5026aa[_0x0a9e('0x3f')]('i.SmsAccountId\x20IN\x20?',_[_0x0a9e('0x2f')](_0xc599b3,'id'));}});})['then'](function(){if(_0x332d35[_0x0a9e('0x8e')][_0x0a9e('0x8f')]==='agent'&&!_0x16f976&&!_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x6e')])return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x4c46c1[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x444f1f){_0x5e7238['count']=_0x444f1f[_0x0a9e('0x95')];if(_0x5e7238[_0x0a9e('0x1b')]===0x0)return[];return db[_0x0a9e('0x93')][_0x0a9e('0x36')](_0x45a9b8['toString'](),_0x2bdc44)[_0x0a9e('0x22')](function(_0xf0db1){_0x2881b3=_['keyBy'](_0xf0db1,'id');_0x2bdc44=_[_0x0a9e('0x96')](_0x2bdc44,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x332d35[_0x0a9e('0x36')][_0x0a9e('0x3a')]){_0x5583a4[_0x0a9e('0x39')][_0x0a9e('0x2c')](function(_0x5af453){_0x5026aa['field']('i.'+_0x5af453);});}else{_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x97'),_0x0a9e('0x5b'));_0x5026aa['field'](_0x0a9e('0x98'),_0x0a9e('0x99'));_0x5026aa['field']('a.mandatoryDisposition',_0x0a9e('0x9a'));_0x5026aa['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','contactName');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9b'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0x9c'),_0x0a9e('0x9d'));_0x5026aa[_0x0a9e('0x42')]('c.lastName',_0x0a9e('0x9e'));_0x5026aa['field'](_0x0a9e('0x9f'),_0x0a9e('0xa0'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa1'),'Contact.phone');_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa2'),_0x0a9e('0xa3'));_0x5026aa['field'](_0x0a9e('0xa4'),_0x0a9e('0xa5'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa6'),_0x0a9e('0xa7'));_0x5026aa[_0x0a9e('0x42')](_0x0a9e('0xa8'),_0x0a9e('0xa9'));_0x5026aa['field'](_0x0a9e('0xaa'),_0x0a9e('0x29'));}if(_0x5583a4['limit'])_0x5026aa[_0x0a9e('0x1d')](_0x5583a4[_0x0a9e('0x1d')]);if(_0x5583a4[_0x0a9e('0x1c')])_0x5026aa['offset'](_0x5583a4[_0x0a9e('0x1c')]);return db['sequelize'][_0x0a9e('0x36')](_0x5026aa[_0x0a9e('0x94')](),_0x2bdc44);})[_0x0a9e('0x22')](function(_0x1f29bd){_0x52628e[_0x0a9e('0x3f')](_0x0a9e('0xab'),_[_0x0a9e('0x2f')](_0x1f29bd,'id'));return db[_0x0a9e('0x93')]['query'](_0x52628e[_0x0a9e('0x94')](),_0x2bdc44)[_0x0a9e('0x22')](function(_0x17f692){var _0x30ef6e=_[_0x0a9e('0xac')](_0x17f692,_0x0a9e('0xad'));var _0x6803d6=[];_0x1f29bd[_0x0a9e('0x2c')](function(_0x1808ba){_0x6803d6[_0x0a9e('0xae')](updateSmsInteraction(_0x1808ba,_0x2881b3,_0x30ef6e));});return BPromise[_0x0a9e('0xaf')](_0x6803d6);});});})[_0x0a9e('0x22')](function(_0x18273f){_0x5e7238['rows']=_0x18273f;return _0x5e7238;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x39e565,_0x5583a4))[_0x0a9e('0x2d')](handleError(_0x39e565,null));};exports[_0x0a9e('0xb0')]=function(_0x2ed526,_0xb0599a){var _0x5d9ddb={'raw':![],'where':{'id':_0x2ed526[_0x0a9e('0xb1')]['id']}},_0x3afc8c={};_0x3afc8c['model']=_[_0x0a9e('0xb2')](db['SmsInteraction'][_0x0a9e('0x31')]);_0x3afc8c[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x2ed526[_0x0a9e('0x36')]);_0x3afc8c['filters']=_[_0x0a9e('0x38')](_0x3afc8c['model'],_0x3afc8c[_0x0a9e('0x36')]);_0x5d9ddb[_0x0a9e('0x39')]=_['intersection'](_0x3afc8c[_0x0a9e('0x35')],qs[_0x0a9e('0x3a')](_0x2ed526[_0x0a9e('0x36')]['fields']));_0x5d9ddb['attributes']=_0x5d9ddb[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x5d9ddb[_0x0a9e('0x39')]:_0x3afc8c[_0x0a9e('0x35')];if(_0x2ed526[_0x0a9e('0x36')][_0x0a9e('0xb3')]){_0x5d9ddb[_0x0a9e('0xb4')]=[{'all':!![]}];}_0x5d9ddb=_[_0x0a9e('0x96')]({},_0x5d9ddb,_0x2ed526[_0x0a9e('0xb5')]);return db['SmsInteraction'][_0x0a9e('0x5a')](_0x5d9ddb)['then'](handleEntityNotFound(_0xb0599a,null))[_0x0a9e('0x22')](respondWithResult(_0xb0599a,null))[_0x0a9e('0x2d')](handleError(_0xb0599a,null));};exports[_0x0a9e('0xb6')]=function(_0x28ce92,_0x1b61d5){return db['SmsInteraction'][_0x0a9e('0xb6')](_0x28ce92[_0x0a9e('0xb7')],{})[_0x0a9e('0x22')](respondWithResult(_0x1b61d5,0xc9))[_0x0a9e('0x2d')](handleError(_0x1b61d5,null));};exports[_0x0a9e('0x20')]=function(_0x5c66ef,_0x4f074c){if(_0x5c66ef[_0x0a9e('0xb7')]['id']){delete _0x5c66ef['body']['id'];}return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x5c66ef[_0x0a9e('0xb1')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f074c,null))[_0x0a9e('0x22')](saveUpdates(_0x5c66ef[_0x0a9e('0xb7')],null))['then'](respondWithResult(_0x4f074c,null))['catch'](handleError(_0x4f074c,null));};exports[_0x0a9e('0x21')]=function(_0x5dfbe2,_0x2469d1){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x5dfbe2['params']['id']}})['then'](handleEntityNotFound(_0x2469d1,null))[_0x0a9e('0x22')](removeEntity(_0x2469d1,null))[_0x0a9e('0x2d')](handleError(_0x2469d1,null));};exports['describe']=function(_0x170af6,_0x17cb30){return db[_0x0a9e('0x30')][_0x0a9e('0xb8')]()[_0x0a9e('0x22')](respondWithResult(_0x17cb30,null))['catch'](handleError(_0x17cb30,null));};exports['addMessage']=function(_0x16449b,_0x22286c,_0x41c8cd){return db[_0x0a9e('0xb9')][_0x0a9e('0x5a')]({'where':{'id':_0x16449b['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x22286c,null))[_0x0a9e('0x22')](function(_0x5416a9){if(_0x5416a9){return _0x5416a9[_0x0a9e('0xba')](_0x16449b[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_[_0x0a9e('0xbc')](_0x16449b[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{});}})[_0x0a9e('0x22')](respondWithResult(_0x22286c,null))[_0x0a9e('0x2d')](handleError(_0x22286c,null));};exports[_0x0a9e('0xbd')]=function(_0x16afb3,_0x4bdebb,_0x1065a7){var _0x301047={'raw':![],'where':{}};var _0x2ada60={};var _0x1c4232={'count':0x0,'rows':[]};return db[_0x0a9e('0x30')]['findOne']({'where':{'id':_0x16afb3['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4bdebb,null))[_0x0a9e('0x22')](function(_0x466bbf){if(_0x466bbf){_0x2ada60[_0x0a9e('0x35')]=_[_0x0a9e('0xb2')](db['SmsMessage'][_0x0a9e('0x31')]);_0x2ada60[_0x0a9e('0x36')]=_[_0x0a9e('0xb2')](_0x16afb3['query']);_0x2ada60[_0x0a9e('0x37')]=_['intersection'](_0x2ada60[_0x0a9e('0x35')],_0x2ada60['query']);_0x301047[_0x0a9e('0x39')]=_[_0x0a9e('0x38')](_0x2ada60[_0x0a9e('0x35')],qs['fields'](_0x16afb3[_0x0a9e('0x36')]['fields']));_0x301047[_0x0a9e('0x39')]=_0x301047[_0x0a9e('0x39')][_0x0a9e('0x95')]?_0x301047[_0x0a9e('0x39')]:_0x2ada60[_0x0a9e('0x35')];if(!_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x3b')](_0x0a9e('0x3c'))){_0x301047[_0x0a9e('0x1d')]=qs[_0x0a9e('0x1d')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1d')]);_0x301047[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x1c')]);}_0x301047['order']=qs['sort'](_0x16afb3[_0x0a9e('0x36')]['sort']);_0x301047[_0x0a9e('0x3f')]=qs[_0x0a9e('0x37')](_['pick'](_0x16afb3[_0x0a9e('0x36')],_0x2ada60[_0x0a9e('0x37')]));_0x301047[_0x0a9e('0x3f')][_0x0a9e('0xad')]=_0x466bbf['id'];if(_0x16afb3['query'][_0x0a9e('0x7d')]){_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047[_0x0a9e('0x3f')],{'$or':_['map'](_0x301047[_0x0a9e('0x39')],function(_0x1a0b08){var _0x2b7092={};_0x2b7092[_0x1a0b08]={'$like':'%'+_0x16afb3['query'][_0x0a9e('0x7d')]+'%'};return _0x2b7092;})});}if(_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')]){var _0x54b107=_0x16afb3[_0x0a9e('0x36')][_0x0a9e('0x73')][_0x0a9e('0x2b')](',');var _0x1a7f58={};_0x1a7f58[_0x54b107[0x0]]={'$gte':moment(_0x54b107[0x1])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x301047[_0x0a9e('0x3f')]=_[_0x0a9e('0x96')](_0x301047['where'],_0x1a7f58);}_0x301047=_[_0x0a9e('0x96')]({},_0x301047,_0x16afb3[_0x0a9e('0xb5')]);return db[_0x0a9e('0xb9')]['count']({'where':_0x301047['where']})['then'](function(_0x1015aa){_0x1c4232[_0x0a9e('0x1b')]=_0x1015aa;if(_0x16afb3['query'][_0x0a9e('0xb3')]){_0x301047[_0x0a9e('0xb4')]=[{'all':!![]}];}return db[_0x0a9e('0xb9')]['findAll'](_0x301047);})[_0x0a9e('0x22')](function(_0x30e037){_0x1c4232[_0x0a9e('0xbf')]=_0x30e037;return _0x1c4232;});}})[_0x0a9e('0x22')](respondWithFilteredResult(_0x4bdebb,_0x301047))[_0x0a9e('0x2d')](handleError(_0x4bdebb,null));};exports[_0x0a9e('0xc0')]=function(_0x40e6e7,_0x328ec5,_0x3b5bda){return db['SmsInteraction'][_0x0a9e('0x5a')]({'where':{'id':_0x40e6e7['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x328ec5,null))[_0x0a9e('0x22')](function(_0x2097d8){if(_0x2097d8){return _0x2097d8[_0x0a9e('0xc1')](_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')],_['omit'](_0x40e6e7[_0x0a9e('0xb7')],[_0x0a9e('0xbb'),'id'])||{})[_0x0a9e('0xc2')](function(){return db[_0x0a9e('0xc3')]['findAll']({'attributes':['id',_0x0a9e('0x25'),_0x0a9e('0x43')],'where':{'id':_0x40e6e7[_0x0a9e('0xb7')][_0x0a9e('0xbb')]}});})[_0x0a9e('0x22')](function(_0x2be526){socket[_0x0a9e('0xc4')](_0x0a9e('0xc5'),{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]});return{'id':Number(_0x40e6e7[_0x0a9e('0xb1')]['id']),'tags':_0x2be526||[]};});}})['then'](respondWithResult(_0x328ec5,null))[_0x0a9e('0x2d')](handleError(_0x328ec5,null));};exports[_0x0a9e('0xc6')]=function(_0x2ff265,_0x26b826,_0xea8bd1){return db[_0x0a9e('0x30')][_0x0a9e('0x5a')]({'where':{'id':_0x2ff265[_0x0a9e('0xb1')]['id']}})['then'](handleEntityNotFound(_0x26b826,null))[_0x0a9e('0x22')](function(_0xd2391){if(_0xd2391){return _0xd2391[_0x0a9e('0xc6')](_0x2ff265['query'][_0x0a9e('0xbb')]);}})[_0x0a9e('0x22')](respondWithStatusCode(_0x26b826,null))[_0x0a9e('0x2d')](handleError(_0x26b826,null));};exports[_0x0a9e('0xc7')]=function(_0x370b5e,_0x1ba457){var _0x424f1b=moment()[_0x0a9e('0xc8')]()[_0x0a9e('0x94')]();var _0x451010=path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xcb'),_0x0a9e('0xcc'));var _0x2b624e=path[_0x0a9e('0xcd')](config['root'],_0x0a9e('0xca'),'files','attachments');var _0x573df6=path[_0x0a9e('0xcd')](_0x451010,_0x424f1b);var _0x3fa3f2=util[_0x0a9e('0xbe')](_0x0a9e('0xce'),_0x370b5e['params']['id'],_0x424f1b);var _0x4156a5=path[_0x0a9e('0xcd')](_0x451010,_0x3fa3f2);var _0x3ddbc7=[];_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0x69')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x3ddbc7[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xcf')],'as':_0x0a9e('0x5e'),'attributes':['id','firstName',_0x0a9e('0xd0')],'raw':!![]});var _0x248a9a=[{'model':db[_0x0a9e('0xb9')],'as':'Messages','attributes':['id',_0x0a9e('0xb7'),_0x0a9e('0x71'),_0x0a9e('0xd1'),'secret',_0x0a9e('0x79')],'include':_0x3ddbc7}];_0x248a9a[_0x0a9e('0xae')]({'model':db[_0x0a9e('0xd2')],'as':'Account','attributes':['id','name']});_0x248a9a['push']({'model':db[_0x0a9e('0x69')],'as':_0x0a9e('0xd3'),'attributes':['id',_0x0a9e('0x28')]});return db[_0x0a9e('0x30')]['find']({'where':{'id':_0x370b5e[_0x0a9e('0xb1')]['id']},'include':_0x248a9a})['then'](handleEntityNotFound(_0x1ba457,null))[_0x0a9e('0x22')](function(_0x2ff2ab){if(_0x2ff2ab){var _0x242f23=_0x2ff2ab['get']({'plain':!![]});fs[_0x0a9e('0xd4')](_0x573df6);var _0x33a26c={'format':'A4','border':_0x0a9e('0xd5'),'header':{'height':'40px','contents':{'first':_0x0a9e('0xd6')}},'footer':{'height':'30px','contents':{'default':util[_0x0a9e('0xbe')]('\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',util[_0x0a9e('0xbe')]('%s\x20#%d',_0x0a9e('0xd7'),_0x242f23['id']),moment()[_0x0a9e('0xbe')](_0x0a9e('0xd8'))[_0x0a9e('0x94')]())}}};var _0x1e306c={'channel':_0x0a9e('0xd7'),'account':_0x242f23[_0x0a9e('0xd9')]['name'],'agent':_0x242f23[_0x0a9e('0xd3')]?_0x242f23[_0x0a9e('0xd3')]['fullname']:_0x0a9e('0xda'),'createdAt':moment(_0x242f23[_0x0a9e('0x71')])['format'](_0x0a9e('0xdb'))[_0x0a9e('0x94')](),'closedAt':_0x242f23[_0x0a9e('0xdc')]?moment(_0x242f23['closedAt'])[_0x0a9e('0xbe')](_0x0a9e('0xdb'))[_0x0a9e('0x94')]():'','disposition':_0x242f23[_0x0a9e('0xdd')],'messages':_(_0x242f23[_0x0a9e('0xde')])[_0x0a9e('0x7d')]({'secret':![]})[_0x0a9e('0x2f')](function(_0x74d9b8){return{'date':moment(_0x74d9b8[_0x0a9e('0x71')])[_0x0a9e('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0a9e('0x94')](),'sender':_0x74d9b8['direction']===_0x0a9e('0xdf')?_0x74d9b8[_0x0a9e('0x69')]?_0x74d9b8[_0x0a9e('0x69')][_0x0a9e('0x28')]:_0x0a9e('0xe0'):_0x74d9b8[_0x0a9e('0x5e')]['firstName']+(_0x74d9b8[_0x0a9e('0x5e')][_0x0a9e('0xd0')]?'\x20'+_0x74d9b8[_0x0a9e('0x5e')]['lastName']:''),'body':_0x74d9b8[_0x0a9e('0xb7')],'direction':_0x74d9b8[_0x0a9e('0xd1')]===_0x0a9e('0xdf')?'A':'C','secret':_0x74d9b8[_0x0a9e('0xe1')],'read':_0x74d9b8[_0x0a9e('0x79')]};})[_0x0a9e('0x61')]()};return ejs[_0x0a9e('0xe2')](path['join'](config[_0x0a9e('0xc9')],_0x0a9e('0xca'),_0x0a9e('0xe3'),_0x0a9e('0xe4')),{'interaction':_0x1e306c})[_0x0a9e('0x22')](function(_0x241404){return new BPromise(function(_0x8120e,_0x5d6a48){pdf['create'](_0x241404,_0x33a26c)[_0x0a9e('0xe5')](path[_0x0a9e('0xcd')](_0x573df6,_0x0a9e('0xe6')+_0x242f23['id']+'-'+_0x424f1b+_0x0a9e('0xe7')),function(_0x40e2da,_0x131da8){if(_0x40e2da)return _0x5d6a48(_0x40e2da);_0x8120e(_0x131da8);});});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x584854,_0x39ea62){zipdir(_0x573df6,{'saveTo':_0x4156a5},function(_0x1d7fc4,_0x2d8e91){if(_0x1d7fc4)return _0x39ea62(_0x1d7fc4);return _0x584854(_0x2d8e91);});})[_0x0a9e('0x22')](function(){return new BPromise(function(_0x1b1757,_0x3c6082){rimraf(_0x573df6,function(_0x16be7e){if(_0x16be7e)_0x3c6082(_0x16be7e);return _0x1b1757();});});})['then'](function(){return _0x1ba457[_0x0a9e('0xc7')](_0x4156a5,_0x3fa3f2,function(_0x294310){if(_0x294310){console[_0x0a9e('0xe8')]('err',_0x294310);}else{fs[_0x0a9e('0xe9')](_0x4156a5);}});});});}else{return _0x1ba457[_0x0a9e('0x23')](0xc8);}})[_0x0a9e('0x2d')](handleError(_0x1ba457,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 5baf5fb..c9facd2 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 _0xb458=['findAll','length','emit','exports','events','../../mysqldb','SmsInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x31991b,_0xaf75d2){var _0x307304=function(_0x2f36c5){while(--_0x2f36c5){_0x31991b['push'](_0x31991b['shift']());}};_0x307304(++_0xaf75d2);}(_0xb458,0x103));var _0x8b45=function(_0x289ce3,_0x7b336){_0x289ce3=_0x289ce3-0x0;var _0x3c3f56=_0xb458[_0x289ce3];return _0x3c3f56;};'use strict';var EventEmitter=require(_0x8b45('0x0'));var SmsInteraction=require(_0x8b45('0x1'))['db'][_0x8b45('0x2')];var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x8b45('0x3')](0x0);var events={'afterCreate':_0x8b45('0x4'),'afterUpdate':_0x8b45('0x5'),'afterDestroy':_0x8b45('0x6')};function emitEvent(_0x5d51e4){return function(_0x333bc7,_0x59cce3,_0x5cc2d5){_0x333bc7[_0x8b45('0x7')]({'attributes':['id'],'raw':!![]})[_0x8b45('0x8')](function(_0x2daa9a){_0x333bc7[_0x8b45('0x9')](_0x8b45('0xa'),_0x2daa9a['map'](function(_0xa54725){return{'id':_0xa54725['id']};}));return SmsMessage[_0x8b45('0xb')]({'where':{'SmsInteractionId':_0x333bc7['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8b45('0x8')](function(_0x2bc809){_0x333bc7[_0x8b45('0x9')]('unreadMessages',_0x2bc809[_0x8b45('0xc')]);SmsInteractionEvents[_0x8b45('0xd')](_0x5d51e4+':'+_0x333bc7['id'],_0x333bc7);SmsInteractionEvents['emit'](_0x5d51e4,_0x333bc7);_0x5cc2d5(null);})['catch'](_0x5cc2d5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x8b45('0xe')]=SmsInteractionEvents; \ No newline at end of file +var _0x9b67=['findAll','unreadMessages','length','emit','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','getUsers','then','setDataValue','map'];(function(_0x2047af,_0x44b840){var _0x1b4b9f=function(_0x3b8d03){while(--_0x3b8d03){_0x2047af['push'](_0x2047af['shift']());}};_0x1b4b9f(++_0x44b840);}(_0x9b67,0xf6));var _0x79b6=function(_0x560b78,_0x2417e8){_0x560b78=_0x560b78-0x0;var _0x3cc6b5=_0x9b67[_0x560b78];return _0x3cc6b5;};'use strict';var EventEmitter=require(_0x79b6('0x0'));var SmsInteraction=require(_0x79b6('0x1'))['db'][_0x79b6('0x2')];var SmsMessage=require(_0x79b6('0x1'))['db'][_0x79b6('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x79b6('0x4'),'afterUpdate':_0x79b6('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4e8794){return function(_0x38479d,_0x174768,_0x258103){_0x38479d[_0x79b6('0x6')]({'attributes':['id'],'raw':!![]})[_0x79b6('0x7')](function(_0x128543){_0x38479d[_0x79b6('0x8')]('Users',_0x128543[_0x79b6('0x9')](function(_0x107e4b){return{'id':_0x107e4b['id']};}));return SmsMessage[_0x79b6('0xa')]({'where':{'SmsInteractionId':_0x38479d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x79b6('0x7')](function(_0x1222a0){_0x38479d['setDataValue'](_0x79b6('0xb'),_0x1222a0[_0x79b6('0xc')]);SmsInteractionEvents[_0x79b6('0xd')](_0x4e8794+':'+_0x38479d['id'],_0x38479d);SmsInteractionEvents[_0x79b6('0xd')](_0x4e8794,_0x38479d);_0x258103(null);})['catch'](_0x258103(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x79b6('0xe')](e,emitEvent(event));}}module[_0x79b6('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 10b10eb..a4147bb 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 _0xb205=['lodash','util','../../config/logger','api','moment','path','../../config/environment','./smsInteraction.attributes','define','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5d8e8a,_0x19b690){var _0x13c1bb=function(_0x11025b){while(--_0x11025b){_0x5d8e8a['push'](_0x5d8e8a['shift']());}};_0x13c1bb(++_0x19b690);}(_0xb205,0xf0));var _0x5b20=function(_0xa314b9,_0xbe404f){_0xa314b9=_0xa314b9-0x0;var _0x4627b9=_0xb205[_0xa314b9];return _0x4627b9;};'use strict';var _=require(_0x5b20('0x0'));var util=require(_0x5b20('0x1'));var logger=require(_0x5b20('0x2'))(_0x5b20('0x3'));var moment=require(_0x5b20('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b20('0x5'));var rimraf=require('rimraf');var config=require(_0x5b20('0x6'));var attributes=require(_0x5b20('0x7'));module['exports']=function(_0x3206cd,_0x29d926){return _0x3206cd[_0x5b20('0x8')]('SmsInteraction',attributes,{'tableName':_0x5b20('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x13fb27,_0x528c54,_0x4f19b2){if(_0x13fb27[_0x5b20('0xa')](_0x5b20('0xb'))){_0x13fb27[_0x5b20('0xc')]=moment()[_0x5b20('0xd')](_0x5b20('0xe'));}_0x4f19b2(null,_0x13fb27);}}});}; \ No newline at end of file +var _0xbdf9=['../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions','changed','format','util','../../config/logger','api','moment','rimraf'];(function(_0x1ee65d,_0x13e80f){var _0x2eb5bb=function(_0x1d23d0){while(--_0x1d23d0){_0x1ee65d['push'](_0x1ee65d['shift']());}};_0x2eb5bb(++_0x13e80f);}(_0xbdf9,0x13f));var _0x9bdf=function(_0x400b43,_0x55da4e){_0x400b43=_0x400b43-0x0;var _0x3c330f=_0xbdf9[_0x400b43];return _0x3c330f;};'use strict';var _=require('lodash');var util=require(_0x9bdf('0x0'));var logger=require(_0x9bdf('0x1'))(_0x9bdf('0x2'));var moment=require(_0x9bdf('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9bdf('0x4'));var config=require(_0x9bdf('0x5'));var attributes=require(_0x9bdf('0x6'));module[_0x9bdf('0x7')]=function(_0x58032c,_0x5ed001){return _0x58032c['define'](_0x9bdf('0x8'),attributes,{'tableName':_0x9bdf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1776d4,_0x38e1b1,_0x14239c){if(_0x1776d4[_0x9bdf('0xa')]('closed')){_0x1776d4['closedAt']=moment()[_0x9bdf('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x14239c(null,_0x1776d4);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index c727e75..26baf71 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 _0x8ab7=['message','result','catch','UpdateSmsInteraction','update','options','raw','where','attributes','limit','AddTagsToSmsInteraction','SmsInteraction','find','then','body','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x8ab7,0x6b));var _0x78ab=function(_0x1a111a,_0x3e581f){_0x1a111a=_0x1a111a-0x0;var _0x37c1d2=_0x8ab7[_0x1a111a];return _0x37c1d2;};'use strict';var _=require(_0x78ab('0x0'));var util=require(_0x78ab('0x1'));var moment=require(_0x78ab('0x2'));var BPromise=require('bluebird');var rs=require(_0x78ab('0x3'));var fs=require('fs');var Redis=require(_0x78ab('0x4'));var db=require(_0x78ab('0x5'))['db'];var utils=require(_0x78ab('0x6'));var logger=require('../../config/logger')(_0x78ab('0x7'));var config=require(_0x78ab('0x8'));var jayson=require(_0x78ab('0x9'));var client=jayson[_0x78ab('0xa')][_0x78ab('0xb')]({'port':0x232a});config[_0x78ab('0xc')]=_[_0x78ab('0xd')](config[_0x78ab('0xc')],{'host':_0x78ab('0xe'),'port':0x18eb});var socket=require(_0x78ab('0xf'))(new Redis(config['redis']));require(_0x78ab('0x10'))[_0x78ab('0x11')](socket);function respondWithRpcPromise(_0x157555,_0x582746,_0x2ece1d){return new BPromise(function(_0x571a03,_0x10c8a7){return client['request'](_0x157555,_0x2ece1d)['then'](function(_0x385df3){logger[_0x78ab('0x12')](_0x78ab('0x13'),_0x582746,_0x78ab('0x14'));logger[_0x78ab('0x15')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x582746,_0x78ab('0x14'),JSON[_0x78ab('0x16')](_0x385df3));if(_0x385df3[_0x78ab('0x17')]){if(_0x385df3['error'][_0x78ab('0x18')]===0x1f4){logger['error'](_0x78ab('0x13'),_0x582746,_0x385df3['error'][_0x78ab('0x19')]);return _0x10c8a7(_0x385df3[_0x78ab('0x17')][_0x78ab('0x19')]);}logger[_0x78ab('0x17')](_0x78ab('0x13'),_0x582746,_0x385df3['error']['message']);return _0x571a03(_0x385df3[_0x78ab('0x17')][_0x78ab('0x19')]);}else{logger['info'](_0x78ab('0x13'),_0x582746,_0x78ab('0x14'));_0x571a03(_0x385df3[_0x78ab('0x1a')][_0x78ab('0x19')]);}})[_0x78ab('0x1b')](function(_0x16a219){logger[_0x78ab('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x582746,_0x16a219);_0x10c8a7(_0x16a219);});});}exports[_0x78ab('0x1c')]=function(_0x5df0cf){var _0xfb0efc=this;return new Promise(function(_0x5e7eb5,_0x4d5ddc){return db['SmsInteraction'][_0x78ab('0x1d')](_0x5df0cf['body'],{'raw':_0x5df0cf['options']?_0x5df0cf[_0x78ab('0x1e')][_0x78ab('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5df0cf[_0x78ab('0x1e')]?_0x5df0cf[_0x78ab('0x1e')][_0x78ab('0x20')]||null:null,'attributes':_0x5df0cf[_0x78ab('0x1e')]?_0x5df0cf[_0x78ab('0x1e')][_0x78ab('0x21')]||null:null,'limit':_0x5df0cf['options']?_0x5df0cf['options'][_0x78ab('0x22')]||null:null})['then'](function(_0x131f6d){logger[_0x78ab('0x12')](_0x78ab('0x1c'),_0x5df0cf);logger[_0x78ab('0x15')]('UpdateSmsInteraction',_0x5df0cf,JSON[_0x78ab('0x16')](_0x131f6d));_0x5e7eb5(_0x131f6d);})[_0x78ab('0x1b')](function(_0x17a4a4){logger['error'](_0x78ab('0x1c'),_0x17a4a4['message'],_0x5df0cf);_0x4d5ddc(_0xfb0efc[_0x78ab('0x17')](0x1f4,_0x17a4a4[_0x78ab('0x19')]));});});};exports[_0x78ab('0x23')]=function(_0xf3c2a7){return new Promise(function(_0x49b9ed,_0x1c71f1){return db[_0x78ab('0x24')][_0x78ab('0x25')]({'where':_0xf3c2a7[_0x78ab('0x1e')]?_0xf3c2a7[_0x78ab('0x1e')]['where']||null:null})[_0x78ab('0x26')](function(_0x20c962){if(_0x20c962){return _0x20c962['addTags'](_0xf3c2a7[_0x78ab('0x27')][_0x78ab('0x28')],_[_0x78ab('0x29')](_0xf3c2a7[_0x78ab('0x27')],[_0x78ab('0x28'),'id'])||{});}})[_0x78ab('0x2a')](function(_0x54836f){logger[_0x78ab('0x12')]('AddTags',_0xf3c2a7);logger[_0x78ab('0x15')](_0x78ab('0x2b'),_0xf3c2a7,JSON[_0x78ab('0x16')](_0x54836f));_0x49b9ed(_0x54836f);})['catch'](function(_0x1332cd){logger[_0x78ab('0x17')](_0x78ab('0x2b'),_0x1332cd[_0x78ab('0x19')],_0xf3c2a7);_0x1c71f1(_this[_0x78ab('0x17')](0x1f4,_0x1332cd['message']));});});}; \ No newline at end of file +var _0x6e36=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsInteraction.socket','register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','AddTagsToSmsInteraction','omit','ids','spread','AddTags','lodash','util','moment','bluebird'];(function(_0x2dc343,_0xf015a2){var _0x51eac5=function(_0x1adfef){while(--_0x1adfef){_0x2dc343['push'](_0x2dc343['shift']());}};_0x51eac5(++_0xf015a2);}(_0x6e36,0x1a0));var _0x66e3=function(_0x5db569,_0x59ae7c){_0x5db569=_0x5db569-0x0;var _0x3c011b=_0x6e36[_0x5db569];return _0x3c011b;};'use strict';var _=require(_0x66e3('0x0'));var util=require(_0x66e3('0x1'));var moment=require(_0x66e3('0x2'));var BPromise=require(_0x66e3('0x3'));var rs=require(_0x66e3('0x4'));var fs=require('fs');var Redis=require(_0x66e3('0x5'));var db=require(_0x66e3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x66e3('0x7'))(_0x66e3('0x8'));var config=require(_0x66e3('0x9'));var jayson=require(_0x66e3('0xa'));var client=jayson[_0x66e3('0xb')][_0x66e3('0xc')]({'port':0x232a});config[_0x66e3('0xd')]=_[_0x66e3('0xe')](config['redis'],{'host':_0x66e3('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x66e3('0xd')]));require(_0x66e3('0x10'))[_0x66e3('0x11')](socket);function respondWithRpcPromise(_0x1f2c1d,_0x4fa974,_0xd574c9){return new BPromise(function(_0x154340,_0x29f7ca){return client['request'](_0x1f2c1d,_0xd574c9)[_0x66e3('0x12')](function(_0xf46ffc){logger[_0x66e3('0x13')](_0x66e3('0x14'),_0x4fa974,_0x66e3('0x15'));logger[_0x66e3('0x16')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x4fa974,_0x66e3('0x15'),JSON[_0x66e3('0x17')](_0xf46ffc));if(_0xf46ffc[_0x66e3('0x18')]){if(_0xf46ffc['error']['code']===0x1f4){logger[_0x66e3('0x18')](_0x66e3('0x14'),_0x4fa974,_0xf46ffc[_0x66e3('0x18')]['message']);return _0x29f7ca(_0xf46ffc[_0x66e3('0x18')][_0x66e3('0x19')]);}logger[_0x66e3('0x18')](_0x66e3('0x14'),_0x4fa974,_0xf46ffc[_0x66e3('0x18')]['message']);return _0x154340(_0xf46ffc['error']['message']);}else{logger[_0x66e3('0x13')](_0x66e3('0x14'),_0x4fa974,_0x66e3('0x15'));_0x154340(_0xf46ffc[_0x66e3('0x1a')][_0x66e3('0x19')]);}})[_0x66e3('0x1b')](function(_0x3d7db7){logger['error'](_0x66e3('0x14'),_0x4fa974,_0x3d7db7);_0x29f7ca(_0x3d7db7);});});}exports[_0x66e3('0x1c')]=function(_0x585481){var _0x4a8a52=this;return new Promise(function(_0x2c0f45,_0x3ac9c4){return db[_0x66e3('0x1d')][_0x66e3('0x1e')](_0x585481[_0x66e3('0x1f')],{'raw':_0x585481[_0x66e3('0x20')]?_0x585481[_0x66e3('0x20')][_0x66e3('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x585481[_0x66e3('0x20')]?_0x585481['options'][_0x66e3('0x22')]||null:null,'attributes':_0x585481[_0x66e3('0x20')]?_0x585481[_0x66e3('0x20')][_0x66e3('0x23')]||null:null,'limit':_0x585481['options']?_0x585481[_0x66e3('0x20')][_0x66e3('0x24')]||null:null})['then'](function(_0x455e9a){logger['info'](_0x66e3('0x1c'),_0x585481);logger[_0x66e3('0x16')]('UpdateSmsInteraction',_0x585481,JSON[_0x66e3('0x17')](_0x455e9a));_0x2c0f45(_0x455e9a);})[_0x66e3('0x1b')](function(_0x9864ff){logger[_0x66e3('0x18')](_0x66e3('0x1c'),_0x9864ff[_0x66e3('0x19')],_0x585481);_0x3ac9c4(_0x4a8a52['error'](0x1f4,_0x9864ff[_0x66e3('0x19')]));});});};exports[_0x66e3('0x25')]=function(_0x39fef6){return new Promise(function(_0x4dfad3,_0x3fc85e){return db['SmsInteraction']['find']({'where':_0x39fef6['options']?_0x39fef6[_0x66e3('0x20')][_0x66e3('0x22')]||null:null})[_0x66e3('0x12')](function(_0x434755){if(_0x434755){return _0x434755['addTags'](_0x39fef6[_0x66e3('0x1f')]['ids'],_[_0x66e3('0x26')](_0x39fef6['body'],[_0x66e3('0x27'),'id'])||{});}})[_0x66e3('0x28')](function(_0x52b4cf){logger[_0x66e3('0x13')](_0x66e3('0x29'),_0x39fef6);logger[_0x66e3('0x16')](_0x66e3('0x29'),_0x39fef6,JSON[_0x66e3('0x17')](_0x52b4cf));_0x4dfad3(_0x52b4cf);})[_0x66e3('0x1b')](function(_0x5487bd){logger[_0x66e3('0x18')](_0x66e3('0x29'),_0x5487bd['message'],_0x39fef6);_0x3fc85e(_this[_0x66e3('0x18')](0x1f4,_0x5487bd[_0x66e3('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index e744f9e..2dfb708 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 _0x5f66=['length','smsInteraction:','save','update','emit','register'];(function(_0x21c1d2,_0x37f70c){var _0x150ce7=function(_0x34aab6){while(--_0x34aab6){_0x21c1d2['push'](_0x21c1d2['shift']());}};_0x150ce7(++_0x37f70c);}(_0x5f66,0x1a0));var _0x65f6=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x5f66[_0x164eca];return _0x2ce562;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x65f6('0x0'),'remove',_0x65f6('0x1')];function createListener(_0x2f06ae,_0x3461cd){return function(_0xbce843){_0x3461cd[_0x65f6('0x2')](_0x2f06ae,_0xbce843);};}function removeListener(_0x5eb9ad,_0x3c5029){return function(){SmsInteractionEvents['removeListener'](_0x5eb9ad,_0x3c5029);};}exports[_0x65f6('0x3')]=function(_0x22b017){for(var _0x4ec221=0x0,_0x4ed98f=events[_0x65f6('0x4')];_0x4ec221<_0x4ed98f;_0x4ec221++){var _0x2c6571=events[_0x4ec221];var _0x112079=createListener(_0x65f6('0x5')+_0x2c6571,_0x22b017);SmsInteractionEvents['on'](_0x2c6571,_0x112079);}}; \ No newline at end of file +var _0x5f66=['length','smsInteraction:','save','update','emit','register'];(function(_0x5c4fee,_0x4f1d16){var _0x34a513=function(_0x5c3c06){while(--_0x5c3c06){_0x5c4fee['push'](_0x5c4fee['shift']());}};_0x34a513(++_0x4f1d16);}(_0x5f66,0x1a0));var _0x65f6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5f66[_0x13d07a];return _0x5ee0ee;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x65f6('0x0'),'remove',_0x65f6('0x1')];function createListener(_0x2f06ae,_0x3461cd){return function(_0xbce843){_0x3461cd[_0x65f6('0x2')](_0x2f06ae,_0xbce843);};}function removeListener(_0x5eb9ad,_0x3c5029){return function(){SmsInteractionEvents['removeListener'](_0x5eb9ad,_0x3c5029);};}exports[_0x65f6('0x3')]=function(_0x22b017){for(var _0x4ec221=0x0,_0x4ed98f=events[_0x65f6('0x4')];_0x4ec221<_0x4ed98f;_0x4ec221++){var _0x2c6571=events[_0x4ec221];var _0x112079=createListener(_0x65f6('0x5')+_0x2c6571,_0x22b017);SmsInteractionEvents['on'](_0x2c6571,_0x112079);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index f961f0c..7a615ed 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 _0xa0db=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','tracked','sms','/:id/status','status','put','update','accept','/:id/reject','delete','destroy','exports','path'];(function(_0x501066,_0x1a9b4b){var _0x4e9fc8=function(_0x2b90a3){while(--_0x2b90a3){_0x501066['push'](_0x501066['shift']());}};_0x4e9fc8(++_0x1a9b4b);}(_0xa0db,0x185));var _0xba0d=function(_0x2c537e,_0x1e24f6){_0x2c537e=_0x2c537e-0x0;var _0x32247b=_0xa0db[_0x2c537e];return _0x32247b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xba0d('0x0'));var timeout=require(_0xba0d('0x1'));var express=require(_0xba0d('0x2'));var router=express[_0xba0d('0x3')]();var auth=require(_0xba0d('0x4'));var interaction=require(_0xba0d('0x5'));var config=require(_0xba0d('0x6'));var controller=require(_0xba0d('0x7'));router[_0xba0d('0x8')]('/',auth[_0xba0d('0x9')](),controller[_0xba0d('0xa')]);router[_0xba0d('0x8')]('/describe',auth[_0xba0d('0x9')](),controller[_0xba0d('0xb')]);router[_0xba0d('0x8')](_0xba0d('0xc'),auth['isAuthenticated'](),controller[_0xba0d('0xd')]);router[_0xba0d('0xe')]('/',auth['isAuthenticated'](),interaction[_0xba0d('0xf')](_0xba0d('0x10'),'smsmessage:create'),controller['create']);router['post'](_0xba0d('0x11'),controller[_0xba0d('0x12')]);router[_0xba0d('0x13')](_0xba0d('0xc'),auth[_0xba0d('0x9')](),controller[_0xba0d('0x14')]);router[_0xba0d('0x13')]('/:id/accept',auth[_0xba0d('0x9')](),controller[_0xba0d('0x15')]);router['put'](_0xba0d('0x16'),auth[_0xba0d('0x9')](),controller['reject']);router[_0xba0d('0x17')](_0xba0d('0xc'),auth[_0xba0d('0x9')](),controller[_0xba0d('0x18')]);module[_0xba0d('0x19')]=router; \ No newline at end of file +var _0xcf73=['isAuthenticated','index','/describe','describe','/:id','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./smsMessage.controller','get'];(function(_0x167689,_0x1147a1){var _0x37da5b=function(_0x195319){while(--_0x195319){_0x167689['push'](_0x167689['shift']());}};_0x37da5b(++_0x1147a1);}(_0xcf73,0x13c));var _0x3cf7=function(_0x4a60a1,_0x56c9d2){_0x4a60a1=_0x4a60a1-0x0;var _0x28b85b=_0xcf73[_0x4a60a1];return _0x28b85b;};'use strict';var multer=require(_0x3cf7('0x0'));var util=require(_0x3cf7('0x1'));var path=require(_0x3cf7('0x2'));var timeout=require('connect-timeout');var express=require(_0x3cf7('0x3'));var router=express['Router']();var auth=require(_0x3cf7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3cf7('0x5'));var controller=require(_0x3cf7('0x6'));router[_0x3cf7('0x7')]('/',auth[_0x3cf7('0x8')](),controller[_0x3cf7('0x9')]);router[_0x3cf7('0x7')](_0x3cf7('0xa'),auth[_0x3cf7('0x8')](),controller[_0x3cf7('0xb')]);router[_0x3cf7('0x7')](_0x3cf7('0xc'),auth[_0x3cf7('0x8')](),controller['show']);router[_0x3cf7('0xd')]('/',auth[_0x3cf7('0x8')](),interaction[_0x3cf7('0xe')](_0x3cf7('0xf'),_0x3cf7('0x10')),controller[_0x3cf7('0x11')]);router['post'](_0x3cf7('0x12'),controller[_0x3cf7('0x13')]);router[_0x3cf7('0x14')](_0x3cf7('0xc'),auth[_0x3cf7('0x8')](),controller[_0x3cf7('0x15')]);router['put'](_0x3cf7('0x16'),auth[_0x3cf7('0x8')](),controller[_0x3cf7('0x17')]);router[_0x3cf7('0x14')](_0x3cf7('0x18'),auth[_0x3cf7('0x8')](),controller['reject']);router['delete'](_0x3cf7('0xc'),auth['isAuthenticated'](),controller[_0x3cf7('0x19')]);module[_0x3cf7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 69dd1fa..2f43ad8 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 _0x94d1=['ENUM','out','STRING','DATE','TEXT','exports'];(function(_0x1caf99,_0x553050){var _0x33f759=function(_0x2ae690){while(--_0x2ae690){_0x1caf99['push'](_0x1caf99['shift']());}};_0x33f759(++_0x553050);}(_0x94d1,0xb9));var _0x194d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94d1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x194d('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x194d('0x1')]('in',_0x194d('0x2')),'defaultValue':_0x194d('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0x194d('0x3')](0xbe)},'phone':{'type':Sequelize[_0x194d('0x3')]},'readAt':{'type':Sequelize[_0x194d('0x4')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x194d('0x5')]}}; \ No newline at end of file +var _0xcfbd=['exports','medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0x469edc,_0x370bcd){var _0x1c4d5b=function(_0x2508fd){while(--_0x2508fd){_0x469edc['push'](_0x469edc['shift']());}};_0x1c4d5b(++_0x370bcd);}(_0xcfbd,0xdf));var _0xdcfb=function(_0x497f7e,_0x4e4a2d){_0x497f7e=_0x497f7e-0x0;var _0x15273a=_0xcfbd[_0x497f7e];return _0x15273a;};'use strict';var Sequelize=require(_0xdcfb('0x0'));module[_0xdcfb('0x1')]={'body':{'type':Sequelize['TEXT'](_0xdcfb('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xdcfb('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdcfb('0x4')]('in',_0xdcfb('0x5')),'defaultValue':_0xdcfb('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xdcfb('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xdcfb('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 2c06409..b87f4e1 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 _0xe2f5=['model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','type','VIRTUAL','filter','merge','options','count','includeAll','include','findAll','rows','show','find','create','body','params','describe','../../config/logger','sms-interactions','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','SmsInteractionId','isNil','read1stAt','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','manual','SIP/%s','channel','accept','EventManager','acceptmessage','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','interface','event','rejectmessage','SmsAccount','SmsAccountId','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','Status','plivio','infobip','groupName','DELIVERED','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','http','client','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','code','error','message','SmsMessage,\x20%s,\x20%s','result','catch','sendStatus','status','end','offset','set','Content-Range','reject','save','update','destroy','name','send','index','SmsMessage','rawAttributes','fieldName','key','map','query','keys','filters','intersection'];(function(_0x170914,_0x121732){var _0x5211b5=function(_0x149ef0){while(--_0x149ef0){_0x170914['push'](_0x170914['shift']());}};_0x5211b5(++_0x121732);}(_0xe2f5,0xd0));var _0x5e2f=function(_0x232be0,_0x19fe84){_0x232be0=_0x232be0-0x0;var _0x236c75=_0xe2f5[_0x232be0];return _0x236c75;};'use strict';var pdf=require(_0x5e2f('0x0'));var emlformat=require(_0x5e2f('0x1'));var rimraf=require(_0x5e2f('0x2'));var zipdir=require(_0x5e2f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5e2f('0x4'));var moment=require(_0x5e2f('0x5'));var BPromise=require(_0x5e2f('0x6'));var Mustache=require(_0x5e2f('0x7'));var util=require(_0x5e2f('0x8'));var path=require(_0x5e2f('0x9'));var sox=require(_0x5e2f('0xa'));var csv=require('to-csv');var ejs=require(_0x5e2f('0xb'));var fs=require('fs');var _=require(_0x5e2f('0xc'));var squel=require('squel');var crypto=require(_0x5e2f('0xd'));var jsforce=require(_0x5e2f('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5e2f('0xf'));var Redis=require(_0x5e2f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5e2f('0x11'));var hardwareService=require(_0x5e2f('0x12'));var logger=require('../../config/logger')(_0x5e2f('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5e2f('0x14'));var db=require(_0x5e2f('0x15'))['db'];config[_0x5e2f('0x16')]=_['defaults'](config[_0x5e2f('0x16')],{'host':_0x5e2f('0x17'),'port':0x18eb});var socket=require(_0x5e2f('0x18'))(new Redis(config[_0x5e2f('0x16')]));require('./smsMessage.socket')['register'](socket);var jayson=require(_0x5e2f('0x19'));var client=jayson['client'][_0x5e2f('0x1a')]({'port':0x232c});var client9002=jayson[_0x5e2f('0x1b')][_0x5e2f('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xc26b46,_0xd9bb1b,_0x257a02,_0x1e79df){return new BPromise(function(_0x3dbcf4,_0x4a95e1){var _0x287dc6=_0x1e79df||client;return _0x287dc6[_0x5e2f('0x1c')](_0xc26b46,_0x257a02)[_0x5e2f('0x1d')](function(_0x4d561a){logger[_0x5e2f('0x1e')]('SmsMessage,\x20%s,\x20%s',_0xd9bb1b,_0x5e2f('0x1f'));logger[_0x5e2f('0x20')](_0x5e2f('0x21'),_0xd9bb1b,'request\x20sent',JSON['stringify'](_0x4d561a));if(_0x4d561a['error']){if(_0x4d561a['error'][_0x5e2f('0x22')]===0x1f4){logger[_0x5e2f('0x23')]('SmsMessage,\x20%s,\x20%s',_0xd9bb1b,_0x4d561a['error'][_0x5e2f('0x24')]);return _0x4a95e1(_0x4d561a[_0x5e2f('0x23')][_0x5e2f('0x24')]);}logger[_0x5e2f('0x23')](_0x5e2f('0x25'),_0xd9bb1b,_0x4d561a['error'][_0x5e2f('0x24')]);return _0x3dbcf4(_0x4d561a[_0x5e2f('0x23')][_0x5e2f('0x24')]);}else{logger[_0x5e2f('0x1e')]('SmsMessage,\x20%s,\x20%s',_0xd9bb1b,_0x5e2f('0x1f'));_0x3dbcf4(_0x4d561a[_0x5e2f('0x26')]['message']);}})[_0x5e2f('0x27')](function(_0x57d0dd){logger[_0x5e2f('0x23')]('SmsMessage,\x20%s,\x20%s',_0xd9bb1b,_0x57d0dd);_0x4a95e1(_0x57d0dd);});});}function respondWithStatusCode(_0x51b911,_0x45253c){_0x45253c=_0x45253c||0xcc;return function(_0x53b417){if(_0x53b417){return _0x51b911[_0x5e2f('0x28')](_0x45253c);}return _0x51b911[_0x5e2f('0x29')](_0x45253c)[_0x5e2f('0x2a')]();};}function respondWithResult(_0x3bd0a6,_0x5b85a9){_0x5b85a9=_0x5b85a9||0xc8;return function(_0x28a781){if(_0x28a781){return _0x3bd0a6[_0x5e2f('0x29')](_0x5b85a9)['json'](_0x28a781);}};}function respondWithFilteredResult(_0x1dc051,_0x38194b){return function(_0x2c4502){if(_0x2c4502){var _0x1edc4b=_0x2c4502['count'],_0x43ab8a=_0x38194b[_0x5e2f('0x2b')],_0x5cc3a0=_0x38194b[_0x5e2f('0x2b')]+_0x38194b['limit'],_0x2b4cfe;if(_0x5cc3a0>=_0x1edc4b){_0x5cc3a0=_0x1edc4b;_0x2b4cfe=0xc8;}else{_0x2b4cfe=0xce;}_0x1dc051['status'](_0x2b4cfe);return _0x1dc051[_0x5e2f('0x2c')](_0x5e2f('0x2d'),_0x43ab8a+'-'+_0x5cc3a0+'/'+_0x1edc4b)['json'](_0x2c4502);}return null;};}function patchUpdates(_0x3411d2){return function(_0x507721){try{jsonpatch['apply'](_0x507721,_0x3411d2,!![]);}catch(_0x484ad9){return BPromise[_0x5e2f('0x2e')](_0x484ad9);}return _0x507721[_0x5e2f('0x2f')]();};}function saveUpdates(_0x30070b,_0x160ad2){return function(_0x4b103c){if(_0x4b103c){return _0x4b103c[_0x5e2f('0x30')](_0x30070b)['then'](function(_0x2593f8){return _0x2593f8;});}return null;};}function removeEntity(_0x1d8a66,_0x5bdc9f){return function(_0x4f21ae){if(_0x4f21ae){return _0x4f21ae[_0x5e2f('0x31')]()['then'](function(){_0x1d8a66['status'](0xcc)[_0x5e2f('0x2a')]();});}};}function handleEntityNotFound(_0x5748aa,_0x1cdea3){return function(_0x589c82){if(!_0x589c82){_0x5748aa[_0x5e2f('0x28')](0x194);}return _0x589c82;};}function handleError(_0xc094b4,_0x4992f9){_0x4992f9=_0x4992f9||0x1f4;return function(_0x2818a2){logger[_0x5e2f('0x23')](_0x2818a2['stack']);if(_0x2818a2[_0x5e2f('0x32')]){delete _0x2818a2[_0x5e2f('0x32')];}_0xc094b4[_0x5e2f('0x29')](_0x4992f9)[_0x5e2f('0x33')](_0x2818a2);};}exports[_0x5e2f('0x34')]=function(_0x234283,_0x90ff85){var _0x9455a2={},_0x2583e5={},_0x21ae9d={'count':0x0,'rows':[]};var _0x1e6732=_['map'](db[_0x5e2f('0x35')][_0x5e2f('0x36')],function(_0x43da5d){return{'name':_0x43da5d[_0x5e2f('0x37')],'type':_0x43da5d['type'][_0x5e2f('0x38')]};});_0x2583e5['model']=_[_0x5e2f('0x39')](_0x1e6732,_0x5e2f('0x32'));_0x2583e5[_0x5e2f('0x3a')]=_[_0x5e2f('0x3b')](_0x234283['query']);_0x2583e5[_0x5e2f('0x3c')]=_[_0x5e2f('0x3d')](_0x2583e5[_0x5e2f('0x3e')],_0x2583e5['query']);_0x9455a2[_0x5e2f('0x3f')]=_[_0x5e2f('0x3d')](_0x2583e5[_0x5e2f('0x3e')],qs[_0x5e2f('0x40')](_0x234283[_0x5e2f('0x3a')][_0x5e2f('0x40')]));_0x9455a2[_0x5e2f('0x3f')]=_0x9455a2[_0x5e2f('0x3f')][_0x5e2f('0x41')]?_0x9455a2[_0x5e2f('0x3f')]:_0x2583e5[_0x5e2f('0x3e')];if(!_0x234283['query'][_0x5e2f('0x42')](_0x5e2f('0x43'))){_0x9455a2[_0x5e2f('0x44')]=qs[_0x5e2f('0x44')](_0x234283[_0x5e2f('0x3a')]['limit']);_0x9455a2['offset']=qs[_0x5e2f('0x2b')](_0x234283[_0x5e2f('0x3a')][_0x5e2f('0x2b')]);}_0x9455a2[_0x5e2f('0x45')]=qs['sort'](_0x234283[_0x5e2f('0x3a')][_0x5e2f('0x46')]);_0x9455a2[_0x5e2f('0x47')]=qs['filters'](_['pick'](_0x234283[_0x5e2f('0x3a')],_0x2583e5[_0x5e2f('0x3c')]),_0x1e6732);if(_0x234283['query']['filter']){_0x9455a2['where']=_['merge'](_0x9455a2['where'],{'$or':_['map'](_0x1e6732,function(_0x30172b){if(_0x30172b[_0x5e2f('0x48')]!==_0x5e2f('0x49')){var _0x34b97c={};_0x34b97c[_0x30172b['name']]={'$like':'%'+_0x234283[_0x5e2f('0x3a')][_0x5e2f('0x4a')]+'%'};return _0x34b97c;}})});}_0x9455a2=_[_0x5e2f('0x4b')]({},_0x9455a2,_0x234283[_0x5e2f('0x4c')]);var _0x287d4f={'where':_0x9455a2[_0x5e2f('0x47')]};return db['SmsMessage'][_0x5e2f('0x4d')](_0x287d4f)[_0x5e2f('0x1d')](function(_0x5f3cf2){_0x21ae9d['count']=_0x5f3cf2;if(_0x234283['query'][_0x5e2f('0x4e')]){_0x9455a2[_0x5e2f('0x4f')]=[{'all':!![]}];}return db[_0x5e2f('0x35')][_0x5e2f('0x50')](_0x9455a2);})[_0x5e2f('0x1d')](function(_0x33c65e){_0x21ae9d[_0x5e2f('0x51')]=_0x33c65e;return _0x21ae9d;})[_0x5e2f('0x1d')](respondWithFilteredResult(_0x90ff85,_0x9455a2))[_0x5e2f('0x27')](handleError(_0x90ff85,null));};exports[_0x5e2f('0x52')]=function(_0x51d716,_0x257484){var _0xeac2fb={'raw':!![],'where':{'id':_0x51d716['params']['id']}},_0x38c77c={};_0x38c77c[_0x5e2f('0x3e')]=_[_0x5e2f('0x3b')](db[_0x5e2f('0x35')]['rawAttributes']);_0x38c77c['query']=_[_0x5e2f('0x3b')](_0x51d716[_0x5e2f('0x3a')]);_0x38c77c[_0x5e2f('0x3c')]=_[_0x5e2f('0x3d')](_0x38c77c['model'],_0x38c77c[_0x5e2f('0x3a')]);_0xeac2fb[_0x5e2f('0x3f')]=_[_0x5e2f('0x3d')](_0x38c77c[_0x5e2f('0x3e')],qs[_0x5e2f('0x40')](_0x51d716['query'][_0x5e2f('0x40')]));_0xeac2fb[_0x5e2f('0x3f')]=_0xeac2fb[_0x5e2f('0x3f')]['length']?_0xeac2fb['attributes']:_0x38c77c['model'];if(_0x51d716['query']['includeAll']){_0xeac2fb[_0x5e2f('0x4f')]=[{'all':!![]}];}_0xeac2fb=_[_0x5e2f('0x4b')]({},_0xeac2fb,_0x51d716[_0x5e2f('0x4c')]);return db[_0x5e2f('0x35')][_0x5e2f('0x53')](_0xeac2fb)[_0x5e2f('0x1d')](handleEntityNotFound(_0x257484,null))[_0x5e2f('0x1d')](respondWithResult(_0x257484,null))['catch'](handleError(_0x257484,null));};exports[_0x5e2f('0x54')]=function(_0x2de847,_0x5e1695){return db[_0x5e2f('0x35')][_0x5e2f('0x54')](_0x2de847['body'],{})['then'](respondWithResult(_0x5e1695,0xc9))[_0x5e2f('0x27')](handleError(_0x5e1695,null));};exports[_0x5e2f('0x30')]=function(_0x2df6d8,_0xec04c9){if(_0x2df6d8[_0x5e2f('0x55')]['id']){delete _0x2df6d8[_0x5e2f('0x55')]['id'];}return db['SmsMessage']['find']({'where':{'id':_0x2df6d8['params']['id']}})[_0x5e2f('0x1d')](handleEntityNotFound(_0xec04c9,null))['then'](saveUpdates(_0x2df6d8[_0x5e2f('0x55')],null))[_0x5e2f('0x1d')](respondWithResult(_0xec04c9,null))['catch'](handleError(_0xec04c9,null));};exports[_0x5e2f('0x31')]=function(_0x2fcc85,_0x595cb3){return db[_0x5e2f('0x35')][_0x5e2f('0x53')]({'where':{'id':_0x2fcc85[_0x5e2f('0x56')]['id']}})[_0x5e2f('0x1d')](handleEntityNotFound(_0x595cb3,null))[_0x5e2f('0x1d')](removeEntity(_0x595cb3,null))[_0x5e2f('0x27')](handleError(_0x595cb3,null));};exports[_0x5e2f('0x57')]=function(_0x205d09,_0x5ca289){return db[_0x5e2f('0x35')][_0x5e2f('0x57')]()[_0x5e2f('0x1d')](respondWithResult(_0x5ca289,null))[_0x5e2f('0x27')](handleError(_0x5ca289,null));};var interaction_log=require(_0x5e2f('0x58'))(_0x5e2f('0x59'));exports['accept']=function(_0x4de77e,_0x5465f0,_0x31d6f7){var _0xe158e6={'agent':{},'channel':_0x5e2f('0x5a')};if(_0x4de77e['body']['id']){delete _0x4de77e[_0x5e2f('0x55')]['id'];}_0x4de77e[_0x5e2f('0x55')][_0x5e2f('0x5b')]=!![];_0x4de77e['body']['readAt']=moment()[_0x5e2f('0x5c')](_0x5e2f('0x5d'));_0x4de77e['body'][_0x5e2f('0x5e')]=_0x4de77e[_0x5e2f('0x55')][_0x5e2f('0x5e')]||_0x4de77e[_0x5e2f('0x5f')]['id'];_0xe158e6[_0x5e2f('0x60')]['id']=_0x4de77e[_0x5e2f('0x55')][_0x5e2f('0x5e')];return db[_0x5e2f('0x35')][_0x5e2f('0x53')]({'where':{'id':_0x4de77e[_0x5e2f('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x5e2f('0x61')],'as':_0x5e2f('0x62')}]})[_0x5e2f('0x1d')](handleEntityNotFound(_0x5465f0,null))[_0x5e2f('0x1d')](saveUpdates(_0x4de77e[_0x5e2f('0x55')],null))[_0x5e2f('0x1d')](function(_0x593afc){if(_0x593afc){_0xe158e6[_0x5e2f('0x24')]=_0x593afc['get']({'plain':!![]});return db['SmsInteraction'][_0x5e2f('0x53')]({'where':{'id':_0x593afc[_0x5e2f('0x63')]}});}return null;})[_0x5e2f('0x1d')](handleEntityNotFound(_0x5465f0,null))['then'](function(_0x2f332f){if(_0x2f332f){return _0x2f332f[_0x5e2f('0x30')]({'UserId':_0x4de77e[_0x5e2f('0x55')][_0x5e2f('0x5e')],'read1stAt':_[_0x5e2f('0x64')](_0x2f332f[_0x5e2f('0x65')])?moment()[_0x5e2f('0x5c')](_0x5e2f('0x5d')):undefined});}return null;})[_0x5e2f('0x1d')](function(_0x508b4e){if(_0x508b4e){_0xe158e6[_0x5e2f('0x66')]=_0x508b4e[_0x5e2f('0x67')]({'plain':!![]});interaction_log['info'](_0x5e2f('0x68'),_0x4de77e[_0x5e2f('0x5f')]['id'],_0x4de77e[_0x5e2f('0x5f')][_0x5e2f('0x32')],_0x4de77e[_0x5e2f('0x5f')][_0x5e2f('0x69')],_0xe158e6[_0x5e2f('0x66')]['id'],_0x4de77e[_0x5e2f('0x55')]?JSON[_0x5e2f('0x6a')](_0x4de77e[_0x5e2f('0x55')]):_0x5e2f('0x6b'));return respondWithRpcPromise(_0x5e2f('0x6c'),'acceptMessage',_0xe158e6);}return null;})[_0x5e2f('0x1d')](function(_0x590936){if(_0x590936){if(_0x4de77e[_0x5e2f('0x55')][_0x5e2f('0x6d')]){_0xe158e6[_0x5e2f('0x24')]['interface']=util['format'](_0x5e2f('0x6e'),_0x4de77e[_0x5e2f('0x5f')][_0x5e2f('0x32')]);_0xe158e6[_0x5e2f('0x24')]['channel']=_0xe158e6[_0x5e2f('0x6f')];_0xe158e6['message']['event']=_0x5e2f('0x70');return respondWithRpcPromise(_0x5e2f('0x71'),_0x5e2f('0x71'),{'event':_0x5e2f('0x72'),'message':_0xe158e6[_0x5e2f('0x24')]},client9002)['then'](function(){return _0xe158e6;});}return _0xe158e6;}return null;})['then'](respondWithResult(_0x5465f0,null))[_0x5e2f('0x27')](handleError(_0x5465f0,null));};var interaction_log=require(_0x5e2f('0x58'))(_0x5e2f('0x59'));exports[_0x5e2f('0x2e')]=function(_0x2588ae,_0x388664,_0x21414a){var _0x424732={'agent':{},'channel':_0x5e2f('0x5a')};if(_0x2588ae[_0x5e2f('0x55')]['id']){delete _0x2588ae['body']['id'];}_0x2588ae[_0x5e2f('0x55')][_0x5e2f('0x5e')]=_0x2588ae[_0x5e2f('0x55')][_0x5e2f('0x5e')]||_0x2588ae[_0x5e2f('0x5f')]['id'];_0x424732[_0x5e2f('0x60')]['id']=_0x2588ae['body']['UserId'];return db[_0x5e2f('0x35')]['find']({'where':{'id':_0x2588ae[_0x5e2f('0x56')]['id'],'UserId':null}})[_0x5e2f('0x1d')](handleEntityNotFound(_0x388664,null))[_0x5e2f('0x1d')](function(_0x1b1155){if(_0x1b1155){_0x424732['message']=_0x1b1155[_0x5e2f('0x67')]({'plain':!![]});return db[_0x5e2f('0x73')][_0x5e2f('0x53')]({'where':{'id':_0x1b1155[_0x5e2f('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x388664,null))[_0x5e2f('0x1d')](function(_0x1359bd){if(_0x1359bd){_0x424732[_0x5e2f('0x66')]=_0x1359bd[_0x5e2f('0x67')]({'plain':!![]});interaction_log[_0x5e2f('0x1e')](_0x5e2f('0x74'),_0x2588ae[_0x5e2f('0x5f')]['id'],_0x2588ae[_0x5e2f('0x5f')][_0x5e2f('0x32')],_0x2588ae[_0x5e2f('0x5f')]['role'],_0x424732[_0x5e2f('0x66')]['id'],_0x2588ae['body']?JSON[_0x5e2f('0x6a')](_0x2588ae[_0x5e2f('0x55')]):_0x5e2f('0x6b'));return respondWithRpcPromise(_0x5e2f('0x75'),'rejectMessage',_0x424732);}return null;})[_0x5e2f('0x1d')](function(_0x55be96){if(_0x55be96){_0x55be96['message'][_0x5e2f('0x76')]=util[_0x5e2f('0x5c')](_0x5e2f('0x6e'),_0x2588ae[_0x5e2f('0x5f')][_0x5e2f('0x32')]);_0x55be96[_0x5e2f('0x24')][_0x5e2f('0x6f')]=_0x424732[_0x5e2f('0x6f')];_0x55be96[_0x5e2f('0x24')][_0x5e2f('0x77')]=_0x5e2f('0x2e');respondWithRpcPromise(_0x5e2f('0x71'),_0x5e2f('0x71'),{'event':_0x5e2f('0x78'),'message':_0x55be96[_0x5e2f('0x24')]},client9002);return _0x424732;}return null;})[_0x5e2f('0x1d')](respondWithResult(_0x388664,null))[_0x5e2f('0x27')](handleError(_0x388664,null));};exports[_0x5e2f('0x29')]=function(_0x5b3d57,_0x169751,_0x204d74){if(_0x5b3d57[_0x5e2f('0x55')]['id']){delete _0x5b3d57['body']['id'];}var _0x33ab3c;return db[_0x5e2f('0x35')]['find']({'where':{'id':_0x5b3d57[_0x5e2f('0x56')]['id']}})[_0x5e2f('0x1d')](handleEntityNotFound(_0x169751,null))['then'](function(_0x3181fd){if(_0x3181fd){_0x33ab3c=_0x3181fd;return db[_0x5e2f('0x79')][_0x5e2f('0x53')]({'where':{'id':_0x3181fd[_0x5e2f('0x7a')]}});}})[_0x5e2f('0x1d')](handleEntityNotFound(_0x169751,null))[_0x5e2f('0x1d')](function(_0x45d7ce){if(_0x45d7ce){logger['debug'](_0x5e2f('0x21'),_0x5e2f('0x29'),'received\x20delivery\x20report\x20from',_0x45d7ce[_0x5e2f('0x48')],util[_0x5e2f('0x7b')](_0x5b3d57[_0x5e2f('0x55')],{'showHidden':![],'depth':null}));switch(_0x45d7ce[_0x5e2f('0x48')]){case'twilio':if(_0x5b3d57[_0x5e2f('0x55')][_0x5e2f('0x7c')]&&_0x5b3d57['body'][_0x5e2f('0x7c')]===_0x33ab3c[_0x5e2f('0x7d')]){return _0x33ab3c[_0x5e2f('0x30')]({'read':!![]});}else{logger[_0x5e2f('0x23')](_0x5e2f('0x7e'),_0x5e2f('0x29'),'twilio',util['inspect'](_0x5b3d57[_0x5e2f('0x55')],{'showHidden':![],'depth':null}));}break;case _0x5e2f('0x7f'):if(_0x5b3d57[_0x5e2f('0x55')][_0x5e2f('0x80')]&&_0x5b3d57[_0x5e2f('0x55')][_0x5e2f('0x80')]===_0x33ab3c[_0x5e2f('0x7d')]&&_[_0x5e2f('0x81')](['sent','delivered'],_0x5b3d57[_0x5e2f('0x55')][_0x5e2f('0x82')])>=0x0){return _0x33ab3c[_0x5e2f('0x30')]({'read':!![]});}else{logger['error'](_0x5e2f('0x7e'),'status',_0x5e2f('0x83'),util[_0x5e2f('0x7b')](_0x5b3d57[_0x5e2f('0x55')],{'showHidden':![],'depth':null}));}break;case _0x5e2f('0x84'):var _0x1572bd=_0x5b3d57[_0x5e2f('0x55')]['results'][0x0];if(_0x1572bd[_0x5e2f('0x29')][_0x5e2f('0x85')]===_0x5e2f('0x86')){return _0x33ab3c[_0x5e2f('0x30')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5e2f('0x29'),'infobip',util[_0x5e2f('0x7b')](_0x5b3d57[_0x5e2f('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x33ab3c;}})[_0x5e2f('0x1d')](respondWithResult(_0x169751,null))[_0x5e2f('0x27')](handleError(_0x169751,null));}; \ No newline at end of file +var _0xc8c1=['bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','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','socket.io-emitter','./smsMessage.socket','register','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','params','includeAll','find','create','body','describe','sms-interactions','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','SmsInteractionId','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','manual','interface','channel','event','accept','EventManager','acceptmessage','SmsInteraction','get','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SIP/%s','rejectmessage','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','results','groupName','DELIVERED','infobip','html-pdf','eml-format','fast-json-patch','moment'];(function(_0x377290,_0x5c48e1){var _0x2f8c0c=function(_0x4c7369){while(--_0x4c7369){_0x377290['push'](_0x377290['shift']());}};_0x2f8c0c(++_0x5c48e1);}(_0xc8c1,0x87));var _0x1c8c=function(_0x586a0d,_0x19556e){_0x586a0d=_0x586a0d-0x0;var _0x33c5eb=_0xc8c1[_0x586a0d];return _0x33c5eb;};'use strict';var pdf=require(_0x1c8c('0x0'));var emlformat=require(_0x1c8c('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1c8c('0x2'));var rp=require('request-promise');var moment=require(_0x1c8c('0x3'));var BPromise=require(_0x1c8c('0x4'));var Mustache=require(_0x1c8c('0x5'));var util=require(_0x1c8c('0x6'));var path=require(_0x1c8c('0x7'));var sox=require(_0x1c8c('0x8'));var csv=require(_0x1c8c('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1c8c('0xa'));var squel=require(_0x1c8c('0xb'));var crypto=require(_0x1c8c('0xc'));var jsforce=require(_0x1c8c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1c8c('0x9'));var querystring=require('querystring');var Papa=require(_0x1c8c('0xe'));var Redis=require('ioredis');var authService=require(_0x1c8c('0xf'));var qs=require(_0x1c8c('0x10'));var as=require(_0x1c8c('0x11'));var hardwareService=require(_0x1c8c('0x12'));var logger=require(_0x1c8c('0x13'))(_0x1c8c('0x14'));var utils=require(_0x1c8c('0x15'));var config=require(_0x1c8c('0x16'));var licenseUtil=require(_0x1c8c('0x17'));var db=require(_0x1c8c('0x18'))['db'];config[_0x1c8c('0x19')]=_[_0x1c8c('0x1a')](config[_0x1c8c('0x19')],{'host':_0x1c8c('0x1b'),'port':0x18eb});var socket=require(_0x1c8c('0x1c'))(new Redis(config[_0x1c8c('0x19')]));require(_0x1c8c('0x1d'))[_0x1c8c('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1c8c('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x1c8c('0x1f')][_0x1c8c('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1dafce,_0xb6f952,_0x44ebd2,_0x142901){return new BPromise(function(_0x2b92ab,_0x23bbd5){var _0x36caf2=_0x142901||client;return _0x36caf2[_0x1c8c('0x21')](_0x1dafce,_0x44ebd2)[_0x1c8c('0x22')](function(_0x390898){logger[_0x1c8c('0x23')](_0x1c8c('0x24'),_0xb6f952,_0x1c8c('0x25'));logger[_0x1c8c('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb6f952,_0x1c8c('0x25'),JSON[_0x1c8c('0x27')](_0x390898));if(_0x390898[_0x1c8c('0x28')]){if(_0x390898['error'][_0x1c8c('0x29')]===0x1f4){logger[_0x1c8c('0x28')](_0x1c8c('0x24'),_0xb6f952,_0x390898[_0x1c8c('0x28')][_0x1c8c('0x2a')]);return _0x23bbd5(_0x390898[_0x1c8c('0x28')][_0x1c8c('0x2a')]);}logger[_0x1c8c('0x28')](_0x1c8c('0x24'),_0xb6f952,_0x390898[_0x1c8c('0x28')]['message']);return _0x2b92ab(_0x390898[_0x1c8c('0x28')][_0x1c8c('0x2a')]);}else{logger[_0x1c8c('0x23')]('SmsMessage,\x20%s,\x20%s',_0xb6f952,_0x1c8c('0x25'));_0x2b92ab(_0x390898[_0x1c8c('0x2b')][_0x1c8c('0x2a')]);}})[_0x1c8c('0x2c')](function(_0x27c9fe){logger['error'](_0x1c8c('0x24'),_0xb6f952,_0x27c9fe);_0x23bbd5(_0x27c9fe);});});}function respondWithStatusCode(_0x5bd35d,_0x3904ac){_0x3904ac=_0x3904ac||0xcc;return function(_0x19772d){if(_0x19772d){return _0x5bd35d[_0x1c8c('0x2d')](_0x3904ac);}return _0x5bd35d[_0x1c8c('0x2e')](_0x3904ac)['end']();};}function respondWithResult(_0x4695cd,_0x7cb311){_0x7cb311=_0x7cb311||0xc8;return function(_0x399cb3){if(_0x399cb3){return _0x4695cd[_0x1c8c('0x2e')](_0x7cb311)[_0x1c8c('0x2f')](_0x399cb3);}};}function respondWithFilteredResult(_0x4e46d3,_0x2a86d1){return function(_0x3ba138){if(_0x3ba138){var _0x6d6c98=_0x3ba138[_0x1c8c('0x30')],_0x65d960=_0x2a86d1[_0x1c8c('0x31')],_0x435669=_0x2a86d1[_0x1c8c('0x31')]+_0x2a86d1[_0x1c8c('0x32')],_0x18bc99;if(_0x435669>=_0x6d6c98){_0x435669=_0x6d6c98;_0x18bc99=0xc8;}else{_0x18bc99=0xce;}_0x4e46d3[_0x1c8c('0x2e')](_0x18bc99);return _0x4e46d3[_0x1c8c('0x33')](_0x1c8c('0x34'),_0x65d960+'-'+_0x435669+'/'+_0x6d6c98)['json'](_0x3ba138);}return null;};}function patchUpdates(_0x2e55a3){return function(_0x67bac2){try{jsonpatch['apply'](_0x67bac2,_0x2e55a3,!![]);}catch(_0xf3a826){return BPromise[_0x1c8c('0x35')](_0xf3a826);}return _0x67bac2[_0x1c8c('0x36')]();};}function saveUpdates(_0x3665cc,_0x156c8d){return function(_0x1a9040){if(_0x1a9040){return _0x1a9040[_0x1c8c('0x37')](_0x3665cc)['then'](function(_0x1e90ba){return _0x1e90ba;});}return null;};}function removeEntity(_0x29aa20,_0x3c0e0e){return function(_0x5d484c){if(_0x5d484c){return _0x5d484c[_0x1c8c('0x38')]()[_0x1c8c('0x22')](function(){_0x29aa20['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x134ad9,_0x1742b6){return function(_0x273ad2){if(!_0x273ad2){_0x134ad9[_0x1c8c('0x2d')](0x194);}return _0x273ad2;};}function handleError(_0x29d2be,_0x1721ac){_0x1721ac=_0x1721ac||0x1f4;return function(_0xdc8fed){logger[_0x1c8c('0x28')](_0xdc8fed['stack']);if(_0xdc8fed['name']){delete _0xdc8fed[_0x1c8c('0x39')];}_0x29d2be[_0x1c8c('0x2e')](_0x1721ac)[_0x1c8c('0x3a')](_0xdc8fed);};}exports[_0x1c8c('0x3b')]=function(_0x1abcb2,_0x52b133){var _0x103410={},_0x22a381={},_0x15571b={'count':0x0,'rows':[]};var _0x98826=_[_0x1c8c('0x3c')](db[_0x1c8c('0x3d')][_0x1c8c('0x3e')],function(_0x4c81b9){return{'name':_0x4c81b9[_0x1c8c('0x3f')],'type':_0x4c81b9[_0x1c8c('0x40')][_0x1c8c('0x41')]};});_0x22a381['model']=_[_0x1c8c('0x3c')](_0x98826,_0x1c8c('0x39'));_0x22a381[_0x1c8c('0x42')]=_[_0x1c8c('0x43')](_0x1abcb2['query']);_0x22a381[_0x1c8c('0x44')]=_[_0x1c8c('0x45')](_0x22a381[_0x1c8c('0x46')],_0x22a381[_0x1c8c('0x42')]);_0x103410[_0x1c8c('0x47')]=_[_0x1c8c('0x45')](_0x22a381[_0x1c8c('0x46')],qs['fields'](_0x1abcb2[_0x1c8c('0x42')][_0x1c8c('0x48')]));_0x103410[_0x1c8c('0x47')]=_0x103410[_0x1c8c('0x47')][_0x1c8c('0x49')]?_0x103410[_0x1c8c('0x47')]:_0x22a381[_0x1c8c('0x46')];if(!_0x1abcb2[_0x1c8c('0x42')]['hasOwnProperty'](_0x1c8c('0x4a'))){_0x103410[_0x1c8c('0x32')]=qs[_0x1c8c('0x32')](_0x1abcb2[_0x1c8c('0x42')][_0x1c8c('0x32')]);_0x103410['offset']=qs[_0x1c8c('0x31')](_0x1abcb2['query'][_0x1c8c('0x31')]);}_0x103410[_0x1c8c('0x4b')]=qs['sort'](_0x1abcb2[_0x1c8c('0x42')][_0x1c8c('0x4c')]);_0x103410['where']=qs[_0x1c8c('0x44')](_[_0x1c8c('0x4d')](_0x1abcb2[_0x1c8c('0x42')],_0x22a381['filters']),_0x98826);if(_0x1abcb2['query'][_0x1c8c('0x4e')]){_0x103410[_0x1c8c('0x4f')]=_[_0x1c8c('0x50')](_0x103410['where'],{'$or':_[_0x1c8c('0x3c')](_0x98826,function(_0x5d2196){if(_0x5d2196[_0x1c8c('0x40')]!==_0x1c8c('0x51')){var _0x45fe69={};_0x45fe69[_0x5d2196[_0x1c8c('0x39')]]={'$like':'%'+_0x1abcb2[_0x1c8c('0x42')]['filter']+'%'};return _0x45fe69;}})});}_0x103410=_[_0x1c8c('0x50')]({},_0x103410,_0x1abcb2[_0x1c8c('0x52')]);var _0x1100db={'where':_0x103410['where']};return db[_0x1c8c('0x3d')][_0x1c8c('0x30')](_0x1100db)[_0x1c8c('0x22')](function(_0xbacbdc){_0x15571b[_0x1c8c('0x30')]=_0xbacbdc;if(_0x1abcb2[_0x1c8c('0x42')]['includeAll']){_0x103410[_0x1c8c('0x53')]=[{'all':!![]}];}return db[_0x1c8c('0x3d')][_0x1c8c('0x54')](_0x103410);})[_0x1c8c('0x22')](function(_0x371087){_0x15571b[_0x1c8c('0x55')]=_0x371087;return _0x15571b;})[_0x1c8c('0x22')](respondWithFilteredResult(_0x52b133,_0x103410))[_0x1c8c('0x2c')](handleError(_0x52b133,null));};exports['show']=function(_0x2da400,_0x516670){var _0x413a7a={'raw':!![],'where':{'id':_0x2da400[_0x1c8c('0x56')]['id']}},_0x24c8b7={};_0x24c8b7[_0x1c8c('0x46')]=_[_0x1c8c('0x43')](db['SmsMessage'][_0x1c8c('0x3e')]);_0x24c8b7[_0x1c8c('0x42')]=_[_0x1c8c('0x43')](_0x2da400['query']);_0x24c8b7['filters']=_[_0x1c8c('0x45')](_0x24c8b7[_0x1c8c('0x46')],_0x24c8b7['query']);_0x413a7a[_0x1c8c('0x47')]=_['intersection'](_0x24c8b7[_0x1c8c('0x46')],qs['fields'](_0x2da400[_0x1c8c('0x42')][_0x1c8c('0x48')]));_0x413a7a['attributes']=_0x413a7a[_0x1c8c('0x47')][_0x1c8c('0x49')]?_0x413a7a[_0x1c8c('0x47')]:_0x24c8b7[_0x1c8c('0x46')];if(_0x2da400[_0x1c8c('0x42')][_0x1c8c('0x57')]){_0x413a7a['include']=[{'all':!![]}];}_0x413a7a=_[_0x1c8c('0x50')]({},_0x413a7a,_0x2da400['options']);return db[_0x1c8c('0x3d')][_0x1c8c('0x58')](_0x413a7a)[_0x1c8c('0x22')](handleEntityNotFound(_0x516670,null))[_0x1c8c('0x22')](respondWithResult(_0x516670,null))[_0x1c8c('0x2c')](handleError(_0x516670,null));};exports[_0x1c8c('0x59')]=function(_0xd34c37,_0x3fb2fb){return db['SmsMessage'][_0x1c8c('0x59')](_0xd34c37[_0x1c8c('0x5a')],{})[_0x1c8c('0x22')](respondWithResult(_0x3fb2fb,0xc9))[_0x1c8c('0x2c')](handleError(_0x3fb2fb,null));};exports['update']=function(_0x4386d7,_0x310292){if(_0x4386d7['body']['id']){delete _0x4386d7[_0x1c8c('0x5a')]['id'];}return db[_0x1c8c('0x3d')][_0x1c8c('0x58')]({'where':{'id':_0x4386d7['params']['id']}})['then'](handleEntityNotFound(_0x310292,null))[_0x1c8c('0x22')](saveUpdates(_0x4386d7[_0x1c8c('0x5a')],null))[_0x1c8c('0x22')](respondWithResult(_0x310292,null))[_0x1c8c('0x2c')](handleError(_0x310292,null));};exports['destroy']=function(_0x4d36ab,_0x1bd703){return db[_0x1c8c('0x3d')][_0x1c8c('0x58')]({'where':{'id':_0x4d36ab[_0x1c8c('0x56')]['id']}})['then'](handleEntityNotFound(_0x1bd703,null))[_0x1c8c('0x22')](removeEntity(_0x1bd703,null))[_0x1c8c('0x2c')](handleError(_0x1bd703,null));};exports[_0x1c8c('0x5b')]=function(_0x7549b0,_0x242562){return db[_0x1c8c('0x3d')][_0x1c8c('0x5b')]()[_0x1c8c('0x22')](respondWithResult(_0x242562,null))['catch'](handleError(_0x242562,null));};var interaction_log=require(_0x1c8c('0x13'))(_0x1c8c('0x5c'));exports['accept']=function(_0x3f5d33,_0x59c2b4,_0x53f76a){var _0x48186b={'agent':{},'channel':_0x1c8c('0x5d')};if(_0x3f5d33[_0x1c8c('0x5a')]['id']){delete _0x3f5d33[_0x1c8c('0x5a')]['id'];}_0x3f5d33[_0x1c8c('0x5a')][_0x1c8c('0x5e')]=!![];_0x3f5d33[_0x1c8c('0x5a')]['readAt']=moment()[_0x1c8c('0x5f')](_0x1c8c('0x60'));_0x3f5d33[_0x1c8c('0x5a')][_0x1c8c('0x61')]=_0x3f5d33[_0x1c8c('0x5a')][_0x1c8c('0x61')]||_0x3f5d33[_0x1c8c('0x62')]['id'];_0x48186b[_0x1c8c('0x63')]['id']=_0x3f5d33[_0x1c8c('0x5a')][_0x1c8c('0x61')];return db['SmsMessage']['find']({'where':{'id':_0x3f5d33[_0x1c8c('0x56')]['id'],'UserId':null},'include':[{'model':db[_0x1c8c('0x64')],'as':'Contact'}]})[_0x1c8c('0x22')](handleEntityNotFound(_0x59c2b4,null))[_0x1c8c('0x22')](saveUpdates(_0x3f5d33[_0x1c8c('0x5a')],null))[_0x1c8c('0x22')](function(_0x21312e){if(_0x21312e){_0x48186b[_0x1c8c('0x2a')]=_0x21312e['get']({'plain':!![]});return db['SmsInteraction'][_0x1c8c('0x58')]({'where':{'id':_0x21312e[_0x1c8c('0x65')]}});}return null;})[_0x1c8c('0x22')](handleEntityNotFound(_0x59c2b4,null))[_0x1c8c('0x22')](function(_0x4a67f8){if(_0x4a67f8){return _0x4a67f8[_0x1c8c('0x37')]({'UserId':_0x3f5d33[_0x1c8c('0x5a')]['UserId'],'read1stAt':_['isNil'](_0x4a67f8[_0x1c8c('0x66')])?moment()[_0x1c8c('0x5f')](_0x1c8c('0x60')):undefined});}return null;})['then'](function(_0x2394a7){if(_0x2394a7){_0x48186b[_0x1c8c('0x67')]=_0x2394a7['get']({'plain':!![]});interaction_log[_0x1c8c('0x23')](_0x1c8c('0x68'),_0x3f5d33[_0x1c8c('0x62')]['id'],_0x3f5d33[_0x1c8c('0x62')]['name'],_0x3f5d33[_0x1c8c('0x62')]['role'],_0x48186b[_0x1c8c('0x67')]['id'],_0x3f5d33[_0x1c8c('0x5a')]?JSON[_0x1c8c('0x27')](_0x3f5d33[_0x1c8c('0x5a')]):_0x1c8c('0x69'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x48186b);}return null;})['then'](function(_0x1d9633){if(_0x1d9633){if(_0x3f5d33[_0x1c8c('0x5a')][_0x1c8c('0x6a')]){_0x48186b[_0x1c8c('0x2a')][_0x1c8c('0x6b')]=util['format']('SIP/%s',_0x3f5d33[_0x1c8c('0x62')][_0x1c8c('0x39')]);_0x48186b[_0x1c8c('0x2a')][_0x1c8c('0x6c')]=_0x48186b[_0x1c8c('0x6c')];_0x48186b[_0x1c8c('0x2a')][_0x1c8c('0x6d')]=_0x1c8c('0x6e');return respondWithRpcPromise(_0x1c8c('0x6f'),'EventManager',{'event':_0x1c8c('0x70'),'message':_0x48186b['message']},client9002)[_0x1c8c('0x22')](function(){return _0x48186b;});}return _0x48186b;}return null;})[_0x1c8c('0x22')](respondWithResult(_0x59c2b4,null))[_0x1c8c('0x2c')](handleError(_0x59c2b4,null));};var interaction_log=require('../../config/logger')(_0x1c8c('0x5c'));exports[_0x1c8c('0x35')]=function(_0x5b2201,_0x162b51,_0x4ea2f7){var _0x9262b1={'agent':{},'channel':_0x1c8c('0x5d')};if(_0x5b2201[_0x1c8c('0x5a')]['id']){delete _0x5b2201[_0x1c8c('0x5a')]['id'];}_0x5b2201[_0x1c8c('0x5a')][_0x1c8c('0x61')]=_0x5b2201[_0x1c8c('0x5a')]['UserId']||_0x5b2201[_0x1c8c('0x62')]['id'];_0x9262b1[_0x1c8c('0x63')]['id']=_0x5b2201[_0x1c8c('0x5a')][_0x1c8c('0x61')];return db[_0x1c8c('0x3d')][_0x1c8c('0x58')]({'where':{'id':_0x5b2201[_0x1c8c('0x56')]['id'],'UserId':null}})[_0x1c8c('0x22')](handleEntityNotFound(_0x162b51,null))[_0x1c8c('0x22')](function(_0x34d8c6){if(_0x34d8c6){_0x9262b1['message']=_0x34d8c6['get']({'plain':!![]});return db[_0x1c8c('0x71')][_0x1c8c('0x58')]({'where':{'id':_0x34d8c6['SmsInteractionId']}});}return null;})[_0x1c8c('0x22')](handleEntityNotFound(_0x162b51,null))['then'](function(_0x5f3be8){if(_0x5f3be8){_0x9262b1[_0x1c8c('0x67')]=_0x5f3be8[_0x1c8c('0x72')]({'plain':!![]});interaction_log[_0x1c8c('0x23')](_0x1c8c('0x73'),_0x5b2201['user']['id'],_0x5b2201[_0x1c8c('0x62')][_0x1c8c('0x39')],_0x5b2201['user'][_0x1c8c('0x74')],_0x9262b1[_0x1c8c('0x67')]['id'],_0x5b2201[_0x1c8c('0x5a')]?JSON[_0x1c8c('0x27')](_0x5b2201['body']):_0x1c8c('0x69'));return respondWithRpcPromise(_0x1c8c('0x75'),_0x1c8c('0x76'),_0x9262b1);}return null;})[_0x1c8c('0x22')](function(_0x3f91bf){if(_0x3f91bf){_0x3f91bf['message'][_0x1c8c('0x6b')]=util['format'](_0x1c8c('0x77'),_0x5b2201[_0x1c8c('0x62')][_0x1c8c('0x39')]);_0x3f91bf[_0x1c8c('0x2a')][_0x1c8c('0x6c')]=_0x9262b1[_0x1c8c('0x6c')];_0x3f91bf[_0x1c8c('0x2a')][_0x1c8c('0x6d')]=_0x1c8c('0x35');respondWithRpcPromise(_0x1c8c('0x6f'),_0x1c8c('0x6f'),{'event':_0x1c8c('0x78'),'message':_0x3f91bf[_0x1c8c('0x2a')]},client9002);return _0x9262b1;}return null;})[_0x1c8c('0x22')](respondWithResult(_0x162b51,null))[_0x1c8c('0x2c')](handleError(_0x162b51,null));};exports[_0x1c8c('0x2e')]=function(_0x34b34b,_0x388fa8,_0x29c842){if(_0x34b34b[_0x1c8c('0x5a')]['id']){delete _0x34b34b[_0x1c8c('0x5a')]['id'];}var _0x3aab70;return db[_0x1c8c('0x3d')]['find']({'where':{'id':_0x34b34b[_0x1c8c('0x56')]['id']}})[_0x1c8c('0x22')](handleEntityNotFound(_0x388fa8,null))[_0x1c8c('0x22')](function(_0x3a3a31){if(_0x3a3a31){_0x3aab70=_0x3a3a31;return db['SmsAccount'][_0x1c8c('0x58')]({'where':{'id':_0x3a3a31['SmsAccountId']}});}})[_0x1c8c('0x22')](handleEntityNotFound(_0x388fa8,null))['then'](function(_0x57ff4d){if(_0x57ff4d){logger[_0x1c8c('0x26')](_0x1c8c('0x79'),_0x1c8c('0x2e'),_0x1c8c('0x7a'),_0x57ff4d[_0x1c8c('0x40')],util[_0x1c8c('0x7b')](_0x34b34b['body'],{'showHidden':![],'depth':null}));switch(_0x57ff4d[_0x1c8c('0x40')]){case'twilio':if(_0x34b34b[_0x1c8c('0x5a')][_0x1c8c('0x7c')]&&_0x34b34b[_0x1c8c('0x5a')]['MessageSid']===_0x3aab70[_0x1c8c('0x7d')]){return _0x3aab70[_0x1c8c('0x37')]({'read':!![]});}else{logger['error'](_0x1c8c('0x7e'),'status',_0x1c8c('0x7f'),util[_0x1c8c('0x7b')](_0x34b34b[_0x1c8c('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x1c8c('0x80'):if(_0x34b34b[_0x1c8c('0x5a')]['MessageUUID']&&_0x34b34b['body'][_0x1c8c('0x81')]===_0x3aab70[_0x1c8c('0x7d')]&&_[_0x1c8c('0x82')]([_0x1c8c('0x83'),_0x1c8c('0x84')],_0x34b34b[_0x1c8c('0x5a')][_0x1c8c('0x85')])>=0x0){return _0x3aab70[_0x1c8c('0x37')]({'read':!![]});}else{logger[_0x1c8c('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1c8c('0x2e'),_0x1c8c('0x86'),util[_0x1c8c('0x7b')](_0x34b34b['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x1aa30f=_0x34b34b[_0x1c8c('0x5a')][_0x1c8c('0x87')][0x0];if(_0x1aa30f[_0x1c8c('0x2e')][_0x1c8c('0x88')]===_0x1c8c('0x89')){return _0x3aab70['update']({'read':!![]});}else{logger[_0x1c8c('0x28')](_0x1c8c('0x7e'),'status',_0x1c8c('0x8a'),util['inspect'](_0x34b34b[_0x1c8c('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x3aab70;}})[_0x1c8c('0x22')](respondWithResult(_0x388fa8,null))[_0x1c8c('0x2c')](handleError(_0x388fa8,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index d4592dc..ecbb736 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 _0x7086=['remove','hasOwnProperty','hook','exports','events','SmsMessage','setMaxListeners','update'];(function(_0x1778ac,_0x18cb8f){var _0x3c99d3=function(_0x570a3f){while(--_0x570a3f){_0x1778ac['push'](_0x1778ac['shift']());}};_0x3c99d3(++_0x18cb8f);}(_0x7086,0x64));var _0x6708=function(_0x49a9bc,_0x57d8d7){_0x49a9bc=_0x49a9bc-0x0;var _0x546fce=_0x7086[_0x49a9bc];return _0x546fce;};'use strict';var EventEmitter=require(_0x6708('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x6708('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x6708('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6708('0x3'),'afterDestroy':_0x6708('0x4')};function emitEvent(_0x3e5d85){return function(_0x4efd27,_0x27e6fd,_0x1e029c){SmsMessageEvents['emit'](_0x3e5d85+':'+_0x4efd27['id'],_0x4efd27);SmsMessageEvents['emit'](_0x3e5d85,_0x4efd27);_0x1e029c(null);};}for(var e in events){if(events[_0x6708('0x5')](e)){var event=events[e];SmsMessage[_0x6708('0x6')](e,emitEvent(event));}}module[_0x6708('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0x41be=['emit','hook','exports','SmsMessage','setMaxListeners'];(function(_0x320a91,_0x222e0b){var _0x3e337a=function(_0x1284ab){while(--_0x1284ab){_0x320a91['push'](_0x320a91['shift']());}};_0x3e337a(++_0x222e0b);}(_0x41be,0x111));var _0xe41b=function(_0x56ea6f,_0x15535a){_0x56ea6f=_0x56ea6f-0x0;var _0x43ac31=_0x41be[_0x56ea6f];return _0x43ac31;};'use strict';var EventEmitter=require('events');var SmsMessage=require('../../mysqldb')['db'][_0xe41b('0x0')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xe41b('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2c7c7b){return function(_0x4bec02,_0x214bf5,_0xd2f757){SmsMessageEvents[_0xe41b('0x2')](_0x2c7c7b+':'+_0x4bec02['id'],_0x4bec02);SmsMessageEvents['emit'](_0x2c7c7b,_0x4bec02);_0xd2f757(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xe41b('0x3')](e,emitEvent(event));}}module[_0xe41b('0x4')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 2ac11ab..0f78048 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 _0xee2e=['secret','isNil','UserId','SmsInteraction','findOne','then','update','createdAt','catch','find','type','twilio','accountSid','authToken','create','phone','remote','/api/sms/messages/','token','sid','error','afterCreate','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','sender','login?username=','&password=','split','POST','session_key','total_sent','internal_order_id','deliveryReport','inspect','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','read','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','clickSend','plivo','https://api.plivo.com/v1/Account/%s/Message/','authId','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/status?token=','application/json','IBSSO\x20','messages','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','text','keys','sort','createHash','md5','digest','hex','signature=','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','UTF-8','apiMessageId','clickatell','accountId','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','finally','utf8mb4','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out'];(function(_0x260c98,_0x3268ac){var _0x2eb92f=function(_0x2fb0b6){while(--_0x2fb0b6){_0x260c98['push'](_0x260c98['shift']());}};_0x2eb92f(++_0x3268ac);}(_0xee2e,0x159));var _0xeee2=function(_0x741670,_0x260e2d){_0x741670=_0x741670-0x0;var _0xd40d7b=_0xee2e[_0x741670];return _0xd40d7b;};'use strict';var _=require(_0xeee2('0x0'));var util=require('util');var logger=require(_0xeee2('0x1'))('api');var moment=require(_0xeee2('0x2'));var BPromise=require(_0xeee2('0x3'));var rp=require(_0xeee2('0x4'));var fs=require('fs');var path=require(_0xeee2('0x5'));var rimraf=require(_0xeee2('0x6'));var config=require(_0xeee2('0x7'));var attributes=require('./smsMessage.attributes');module[_0xeee2('0x8')]=function(_0x17c206,_0x1dad21){return _0x17c206['define']('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xeee2('0x9'),'fields':['messageId']},{'name':_0xeee2('0xa'),'fields':[_0xeee2('0xb')],'type':_0xeee2('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x43a2a3,_0x2ade1d,_0x328dbb){var _0x4a3761=_0x17c206[_0xeee2('0xd')];var _0x258862=_0x43a2a3[_0xeee2('0xe')]({'plain':!![]});if(_0x258862[_0xeee2('0xf')][_0xeee2('0x10')]()==='in'||_0x258862[_0xeee2('0xf')][_0xeee2('0x10')]()===_0xeee2('0x11')&&!_0x258862[_0xeee2('0x12')]&&!_[_0xeee2('0x13')](_0x258862[_0xeee2('0x14')])){_0x4a3761[_0xeee2('0x15')][_0xeee2('0x16')]({'where':{'id':_0x258862['SmsInteractionId']}})[_0xeee2('0x17')](function(_0x387954){if(_0x387954){_0x387954[_0xeee2('0x18')]({'lastMsgAt':_0x258862[_0xeee2('0x19')],'lastMsgDirection':_0x258862[_0xeee2('0xf')][_0xeee2('0x10')]()});}})[_0xeee2('0x1a')](function(_0x5c6016){console['error'](_0x5c6016);});}if(_0x258862['direction']==='out'&&!_0x258862[_0xeee2('0x12')]){var _0x309bcc;_0x4a3761['SmsAccount'][_0xeee2('0x1b')]({'where':{'id':_0x258862['SmsAccountId']},'raw':!![]})[_0xeee2('0x17')](function(_0x17a6e0){_0x309bcc=_0x17a6e0;if(_0x309bcc&&_0x309bcc[_0xeee2('0x1c')]){switch(_0x309bcc[_0xeee2('0x1c')]){case _0xeee2('0x1d'):var _0x1d9d4b=require('twilio');if(_0x309bcc[_0xeee2('0x1e')]&&_0x309bcc[_0xeee2('0x1f')]&&_0x309bcc['phone']){var _0x506c61=new _0x1d9d4b(_0x309bcc[_0xeee2('0x1e')],_0x309bcc[_0xeee2('0x1f')]);_0x506c61['messages'][_0xeee2('0x20')]({'body':_0x258862[_0xeee2('0xb')],'to':_0x258862['phone'],'from':_0x309bcc[_0xeee2('0x21')],'statusCallback':_0x309bcc[_0xeee2('0x22')]+_0xeee2('0x23')+_0x258862['id']+'/status?token='+_0x309bcc[_0xeee2('0x24')]})['then'](function(_0x100d2a){if(_0x100d2a[_0xeee2('0x25')]){return _0x43a2a3[_0xeee2('0x18')]({'messageId':_0x100d2a[_0xeee2('0x25')]});}})[_0xeee2('0x1a')](function(_0x1cc691){logger[_0xeee2('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeee2('0x27'),_0xeee2('0x1d'),util['inspect'](_0x1cc691,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xeee2('0x28'),'afterCreate','twilio',_0xeee2('0x29'));}break;case _0xeee2('0x2a'):var _0x3b26f5='https://api.skebby.it/API/v1.0/REST/';if(_0x309bcc[_0xeee2('0x2b')]&&_0x309bcc[_0xeee2('0x2c')]){var _0x3b2ef1={'recipient':[_0x258862[_0xeee2('0x21')]],'message':_0x258862[_0xeee2('0xb')],'message_type':_0x309bcc[_0xeee2('0x2d')]};if(_0x309bcc[_0xeee2('0x2d')]&&_0x309bcc[_0xeee2('0x2d')]!=='SI'){_0x3b2ef1[_0xeee2('0x2e')]=_0x309bcc[_0xeee2('0x21')];}var _0xae9c78={'url':_0x3b26f5+_0xeee2('0x2f')+_0x309bcc['username']+_0xeee2('0x30')+_0x309bcc[_0xeee2('0x2c')],'method':'GET'};rp(_0xae9c78)[_0xeee2('0x17')](function(_0x426f39){var _0x50fb48=_0x426f39[_0xeee2('0x31')](';');var _0x449ab1={'user_key':_0x50fb48[0x0],'session_key':_0x50fb48[0x1]};_0xae9c78={'url':_0x3b26f5+'sms','method':_0xeee2('0x32'),'headers':{'user_key':_0x449ab1['user_key'],'Session_key':_0x449ab1[_0xeee2('0x33')]},'json':!![],'body':_0x3b2ef1};return rp(_0xae9c78);})[_0xeee2('0x17')](function(_0x33fe4f){if(_0x33fe4f[_0xeee2('0x34')]>=0x1){var _0x2dc134={'messageId':_0x33fe4f[_0xeee2('0x35')]};if(_0x309bcc[_0xeee2('0x2d')]!=='GP'||!_0x309bcc[_0xeee2('0x36')]){_0x2dc134['read']=!![];}return _0x43a2a3[_0xeee2('0x18')](_0x2dc134);}else{return logger[_0xeee2('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeee2('0x27'),'skebby',util[_0xeee2('0x37')](_0x33fe4f,{'showHidden':![],'depth':null}));}})['catch'](function(_0x536a30){return logger[_0xeee2('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeee2('0x27'),'skebby',util[_0xeee2('0x37')](_0x536a30,{'showHidden':![],'depth':null}));});}else{logger[_0xeee2('0x26')](_0xeee2('0x28'),'afterCreate',_0xeee2('0x2a'),_0xeee2('0x38'));}break;case'connectel':if(_0x309bcc[_0xeee2('0x1f')]){var _0x423ee1={'recipient':_0x258862[_0xeee2('0x21')],'message':_0x258862[_0xeee2('0xb')],'sender':_0x309bcc[_0xeee2('0x39')]||_0x309bcc[_0xeee2('0x21')],'authorization':_0x309bcc['authToken']};var _0x2ade1d={'method':_0xeee2('0x32'),'uri':_0xeee2('0x3a'),'body':_0x423ee1,'json':!![]};rp(_0x2ade1d)[_0xeee2('0x17')](function(_0x4650d6){var _0x5015d6={'messageId':_0x4650d6[_0xeee2('0x3b')]};if(!_0x309bcc[_0xeee2('0x36')]){_0x5015d6[_0xeee2('0x3c')]=!![];}return _0x43a2a3[_0xeee2('0x18')](_0x5015d6);})[_0xeee2('0x1a')](function(_0x5cf6f4){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeee2('0x27'),_0xeee2('0x3d'),util[_0xeee2('0x37')](_0x5cf6f4,{'showHidden':![],'depth':null}));});}else{logger[_0xeee2('0x26')](_0xeee2('0x28'),'afterCreate','connectel',_0xeee2('0x3e'));}break;case _0xeee2('0x3f'):if(_0x309bcc[_0xeee2('0x2b')]&&_0x309bcc[_0xeee2('0x2c')]){var _0x423ee1={'messages':[{'source':_0xeee2('0x40'),'to':_0x258862['phone'],'body':_0x258862[_0xeee2('0xb')],'from':_0x309bcc[_0xeee2('0x39')]||_0x309bcc['phone']}]};var _0x30557e=util[_0xeee2('0x41')](_0xeee2('0x42'),_0x309bcc[_0xeee2('0x2b')],_0x309bcc[_0xeee2('0x2c')]);var _0x2ade1d={'method':_0xeee2('0x32'),'uri':_0xeee2('0x43'),'body':_0x423ee1,'headers':{'Authorization':util['format'](_0xeee2('0x44'),new Buffer(_0x30557e)[_0xeee2('0x45')]('base64'))},'json':!![]};rp(_0x2ade1d)[_0xeee2('0x17')](function(_0x476f18){if(_0x476f18['http_code']>=0xc8&&_0x476f18[_0xeee2('0x46')]<=0xce){if(_0x476f18[_0xeee2('0x47')]&&_0x476f18[_0xeee2('0x47')][_0xeee2('0x48')]>0x0){var _0x42b03b=_[_0xeee2('0x49')](_0x476f18[_0xeee2('0x47')]['messages']);var _0x406397={'messageId':_0x42b03b['message_id']};if(!_0x309bcc['deliveryReport']){_0x406397[_0xeee2('0x3c')]=!![];}return _0x43a2a3[_0xeee2('0x18')](_0x406397);}else{logger[_0xeee2('0x26')](_0xeee2('0x28'),'afterCreate',_0xeee2('0x4a'),util[_0xeee2('0x37')](_0x476f18,{'showHidden':![],'depth':null}));}}else{logger[_0xeee2('0x26')](_0xeee2('0x28'),_0xeee2('0x27'),_0xeee2('0x4a'),util['inspect'](_0x476f18,{'showHidden':![],'depth':null}));}})[_0xeee2('0x1a')](function(_0x11f8b8){logger['error'](_0xeee2('0x28'),_0xeee2('0x27'),_0xeee2('0x4a'),util[_0xeee2('0x37')](_0x11f8b8,{'showHidden':![],'depth':null}));});}else{logger[_0xeee2('0x26')](_0xeee2('0x28'),_0xeee2('0x27'),_0xeee2('0x4a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xeee2('0x4b'):if(_0x309bcc['authId']&&_0x309bcc[_0xeee2('0x1f')]){var _0x423ee1={'dst':_0x258862[_0xeee2('0x21')],'text':_0x258862[_0xeee2('0xb')],'src':_0x309bcc[_0xeee2('0x39')]||_0x309bcc[_0xeee2('0x21')],'url':_0x309bcc[_0xeee2('0x22')]+_0xeee2('0x23')+_0x258862['id']+'/status?token='+_0x309bcc[_0xeee2('0x24')]};var _0x30557e=util[_0xeee2('0x41')](_0xeee2('0x42'),_0x309bcc['authId'],_0x309bcc[_0xeee2('0x1f')]);var _0x2ade1d={'method':_0xeee2('0x32'),'uri':util[_0xeee2('0x41')](_0xeee2('0x4c'),_0x309bcc[_0xeee2('0x4d')]),'body':_0x423ee1,'headers':{'Authorization':util[_0xeee2('0x41')](_0xeee2('0x44'),new Buffer(_0x30557e)[_0xeee2('0x45')](_0xeee2('0x4e')))},'json':!![]};rp(_0x2ade1d)[_0xeee2('0x17')](function(_0x1f7f9b){var _0x1dbea6={'messageId':_0x1f7f9b[_0xeee2('0x4f')][0x0]};return _0x43a2a3[_0xeee2('0x18')](_0x1dbea6);})[_0xeee2('0x1a')](function(_0x4cc9ca){logger['error'](_0xeee2('0x28'),'afterCreate',_0xeee2('0x4b'),util['inspect'](_0x4cc9ca,{'showHidden':![],'depth':null}));});}else{logger[_0xeee2('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeee2('0x27'),_0xeee2('0x4b'),_0xeee2('0x50'));}break;case _0xeee2('0x51'):if(_0x309bcc[_0xeee2('0x2b')]&&_0x309bcc[_0xeee2('0x2c')]){if(_0x309bcc['baseUrl']){var _0x171bb1={'method':_0xeee2('0x32'),'uri':_0x309bcc[_0xeee2('0x52')]+_0xeee2('0x53'),'body':{'username':_0x309bcc['username'],'password':_0x309bcc[_0xeee2('0x2c')]},'json':!![]};return rp(_0x171bb1)[_0xeee2('0x17')](function(_0x37916d){var _0x7520b7={'method':_0xeee2('0x32'),'uri':_0x309bcc[_0xeee2('0x52')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x309bcc['phone'],'destinations':[{'to':_0x258862['phone']}],'text':_0x258862[_0xeee2('0xb')],'notifyUrl':_0x309bcc[_0xeee2('0x22')]+_0xeee2('0x23')+_0x258862['id']+_0xeee2('0x54')+_0x309bcc['token'],'notifyContentType':_0xeee2('0x55'),'callbackData':_0x309bcc[_0xeee2('0x21')]+';'+_0x258862[_0xeee2('0xb')]}]},'headers':{'Authorization':_0xeee2('0x56')+_0x37916d[_0xeee2('0x24')]},'json':!![]};return rp(_0x7520b7)['then'](function(_0x20d7a6){if(_0x20d7a6['messages']){var _0x433b4a={'messageId':_0x20d7a6[_0xeee2('0x57')][0x0][_0xeee2('0x9')]};if(!_0x309bcc[_0xeee2('0x36')]){_0x433b4a[_0xeee2('0x3c')]=!![];}return _0x43a2a3['update'](_0x433b4a);}else{return logger[_0xeee2('0x26')](_0xeee2('0x28'),'afterCreate','infobip',util['inspect'](_0x20d7a6,{'showHidden':![],'depth':null}));}});})[_0xeee2('0x1a')](function(_0x4fc11e){return logger[_0xeee2('0x26')](_0xeee2('0x28'),_0xeee2('0x27'),'infobip',util[_0xeee2('0x37')](_0x4fc11e,{'showHidden':![],'depth':null}));});}else{logger[_0xeee2('0x26')](_0xeee2('0x28'),_0xeee2('0x27'),_0xeee2('0x51'),_0xeee2('0x58'));}}else{logger['error'](_0xeee2('0x28'),_0xeee2('0x27'),_0xeee2('0x51'),_0xeee2('0x38'));}break;case _0xeee2('0x59'):var _0x40520a=require(_0xeee2('0x5a'));if(_0x309bcc[_0xeee2('0x5b')]){var _0x15b93={};_0x15b93['login']=_0x309bcc[_0xeee2('0x2b')];_0x15b93['phone']=_0x258862['phone'];_0x15b93[_0xeee2('0x2e')]=_0x309bcc[_0xeee2('0x21')];_0x15b93[_0xeee2('0x5c')]=_0x258862[_0xeee2('0xb')];_0x15b93['timestamp']=+new Date();var _0x3825c3='';var _0x3c5d4a='';var _0x2c219b=Object[_0xeee2('0x5d')](_0x15b93);_0x2c219b[_0xeee2('0x5e')]();for(var _0x4e9027=0x0;_0x4e9027<_0x2c219b['length'];_0x4e9027++){if(_0x3825c3!=''){_0x3825c3+='&';}_0x3825c3+=_0x2c219b[_0x4e9027]+'='+encodeURIComponent(_0x15b93[_0x2c219b[_0x4e9027]]);_0x3c5d4a+=_0x15b93[_0x2c219b[_0x4e9027]];}_0x3c5d4a+=_0x309bcc[_0xeee2('0x5b')];_0x3c5d4a=_0x40520a[_0xeee2('0x5f')](_0xeee2('0x60'))['update'](_0x3c5d4a)[_0xeee2('0x61')](_0xeee2('0x62'));if(_0x3825c3!==''){_0x3825c3+='&';}_0x3825c3+=_0xeee2('0x63')+_0x3c5d4a;var _0xae9c78={'method':_0xeee2('0x64'),'uri':_0x309bcc[_0xeee2('0x52')]+_0xeee2('0x65')+_0x3825c3,'json':!![]};return rp(_0xae9c78)[_0xeee2('0x17')](function(_0x5c35a7){var _0x18f959=Object[_0xeee2('0x5d')](_0x5c35a7);if(_0x5c35a7[_0x18f959[0x0]][_0xeee2('0x26')]&&parseInt(_0x5c35a7[_0x18f959[0x0]]['error'])===0x0){var _0x378f10={'messageId':_0x5c35a7[_0x18f959[0x0]][_0xeee2('0x66')]};if(!_0x309bcc[_0xeee2('0x36')]){_0x378f10[_0xeee2('0x3c')]=!![];}return _0x43a2a3[_0xeee2('0x18')](_0x378f10);}else{return logger[_0xeee2('0x26')](_0xeee2('0x28'),_0xeee2('0x27'),'csc',util['inspect'](_0x5c35a7[_0xeee2('0x26')],{'showHidden':![],'depth':null}));}})[_0xeee2('0x1a')](function(_0x52143e){return logger[_0xeee2('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeee2('0x27'),_0xeee2('0x59'),util[_0xeee2('0x37')](_0x52143e,{'showHidden':![],'depth':null}));});}else{logger[_0xeee2('0x26')](_0xeee2('0x28'),_0xeee2('0x27'),'csc',_0xeee2('0x67'));}break;case'clickatell':if(_0x309bcc[_0xeee2('0x5b')]){var _0xe2dbd6={'method':_0xeee2('0x32'),'uri':_0xeee2('0x68'),'headers':{'Authorization':_0x309bcc[_0xeee2('0x5b')]},'body':{'content':_0x258862['body'],'to':[_0x258862[_0xeee2('0x21')]],'from':_0x309bcc[_0xeee2('0x21')],'binary':![],'clientMessageId':'uuid','charset':_0xeee2('0x69')},'json':!![]};rp(_0xe2dbd6)[_0xeee2('0x17')](function(_0x1c4fed){if(!_0x1c4fed[_0xeee2('0x26')]){var _0x1c3a3b={'messageId':_0x1c4fed[_0xeee2('0x57')][0x0][_0xeee2('0x6a')]};if(!_0x309bcc[_0xeee2('0x36')]){_0x1c3a3b['read']=!![];}return _0x43a2a3[_0xeee2('0x18')](_0x1c3a3b);}else{return logger['error'](_0xeee2('0x28'),'afterCreate',_0xeee2('0x6b'),util[_0xeee2('0x37')](_0x1c4fed[_0xeee2('0x26')],{'showHidden':![],'depth':null}));}})['catch'](function(_0xaa17f9){return logger['error'](_0xeee2('0x28'),_0xeee2('0x27'),_0xeee2('0x6b'),util['inspect'](_0xaa17f9,{'showHidden':![],'depth':null}));});}else{logger[_0xeee2('0x26')](_0xeee2('0x28'),_0xeee2('0x27'),'clickatell',_0xeee2('0x67'));}break;case'bandwidth':if(_0x309bcc[_0xeee2('0x2b')]&&_0x309bcc[_0xeee2('0x2c')]){var _0x30557e=util[_0xeee2('0x41')](_0xeee2('0x42'),_0x309bcc[_0xeee2('0x2b')],_0x309bcc[_0xeee2('0x2c')]);var _0x2ade1d={'method':_0xeee2('0x32'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x309bcc[_0xeee2('0x6c')]+'/messages','body':{'to':[_0x258862[_0xeee2('0x21')]],'text':_0x258862[_0xeee2('0xb')],'from':_0x309bcc['phone'],'applicationId':_0x309bcc[_0xeee2('0x6d')]},'headers':{'Authorization':util[_0xeee2('0x41')](_0xeee2('0x44'),new Buffer(_0x30557e)[_0xeee2('0x45')]('base64'))},'json':!![]};rp(_0x2ade1d)[_0xeee2('0x17')](function(_0x36c29c){if(_0x36c29c['id']){var _0x2e446d={'messageId':_0x36c29c['id']};return _0x43a2a3[_0xeee2('0x18')](_0x2e446d);}else{logger[_0xeee2('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xeee2('0x6e'),util[_0xeee2('0x37')](_0x36c29c,{'showHidden':![],'depth':null}));}})[_0xeee2('0x1a')](function(_0x5e1f8c){logger[_0xeee2('0x26')](_0xeee2('0x28'),_0xeee2('0x27'),_0xeee2('0x6e'),util[_0xeee2('0x37')](_0x5e1f8c,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeee2('0x27'),'bandwidth',_0xeee2('0x38'));}break;case _0xeee2('0x6f'):if(_0x309bcc[_0xeee2('0x5b')]){var _0x24a4af={};var _0xae9c78={'method':_0xeee2('0x32'),'uri':_0xeee2('0x70'),'headers':{'Authorization':_0xeee2('0x71')+_0x309bcc[_0xeee2('0x5b')],'Content-Type':'application/json'},'body':{'from':_0x309bcc[_0xeee2('0x21')],'to':_0x258862[_0xeee2('0x21')],'text':_0x258862[_0xeee2('0xb')]},'json':!![]};return rp(_0xae9c78)[_0xeee2('0x17')](function(_0x15c5c2){if(_0x15c5c2[_0xeee2('0x72')]==0xca){_0x24a4af[_0xeee2('0x73')]=_0x15c5c2;var _0xf3188d={'method':'POST','uri':_0xeee2('0x74'),'headers':{'Authorization':_0xeee2('0x71')+_0x309bcc[_0xeee2('0x5b')],'Content-Type':'application/json'},'body':{'refid':_0x24a4af[_0xeee2('0x73')][_0xeee2('0x75')]},'json':!![]};return rp(_0xf3188d)[_0xeee2('0x17')](function(_0x117817){_0x24a4af[_0xeee2('0x76')]=_0x117817;var _0x45549a={'messageId':_0x24a4af[_0xeee2('0x73')][_0xeee2('0x75')],'read':!![]};return _0x43a2a3[_0xeee2('0x18')](_0x45549a);});}else{return logger[_0xeee2('0x26')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xeee2('0x27'),_0xeee2('0x6f'),util[_0xeee2('0x37')](_0x15c5c2,{'showHidden':![],'depth':null}));}})[_0xeee2('0x1a')](function(_0x2b6df0){return logger[_0xeee2('0x26')](_0xeee2('0x28'),_0xeee2('0x27'),_0xeee2('0x6f'),util['inspect'](_0x2b6df0,{'showHidden':![],'depth':null}));});}else{return logger[_0xeee2('0x26')](_0xeee2('0x28'),'afterCreate',_0xeee2('0x6f'),'Token\x20not\x20received');}break;}}})[_0xeee2('0x77')](function(){_0x328dbb();});}else{_0x328dbb();}}},'charset':_0xeee2('0x78'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1bbd=['Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','sort','length','createHash','hex','signature=','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','bluebird','request-promise','path','../../config/environment','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','secret','isNil','findOne','SmsInteractionId','then','update','catch','error','SmsAccountId','type','twilio','accountSid','phone','create','remote','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','split','sms','user_key','session_key','total_sent','internal_order_id','deliveryReport','connectel','authToken','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','clicksend','xCALLY\x20Motion','format','%s:%s','POST','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','queued_count','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','token','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','/api/sms/messages/','application/json','IBSSO\x20','messages'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1bbd,0x97));var _0xd1bb=function(_0x34fecc,_0x2db315){_0x34fecc=_0x34fecc-0x0;var _0x41326b=_0x1bbd[_0x34fecc];return _0x41326b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd1bb('0x0'))('api');var moment=require('moment');var BPromise=require(_0xd1bb('0x1'));var rp=require(_0xd1bb('0x2'));var fs=require('fs');var path=require(_0xd1bb('0x3'));var rimraf=require('rimraf');var config=require(_0xd1bb('0x4'));var attributes=require('./smsMessage.attributes');module['exports']=function(_0x53482a,_0x2dcf6c){return _0x53482a[_0xd1bb('0x5')](_0xd1bb('0x6'),attributes,{'tableName':_0xd1bb('0x7'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xd1bb('0x8')]},{'name':_0xd1bb('0x9'),'fields':[_0xd1bb('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x36d47f,_0x304c93,_0x3ba520){var _0x4ac2ff=_0x53482a[_0xd1bb('0xb')];var _0x20fe10=_0x36d47f[_0xd1bb('0xc')]({'plain':!![]});if(_0x20fe10[_0xd1bb('0xd')]['toLowerCase']()==='in'||_0x20fe10[_0xd1bb('0xd')][_0xd1bb('0xe')]()===_0xd1bb('0xf')&&!_0x20fe10[_0xd1bb('0x10')]&&!_[_0xd1bb('0x11')](_0x20fe10['UserId'])){_0x4ac2ff['SmsInteraction'][_0xd1bb('0x12')]({'where':{'id':_0x20fe10[_0xd1bb('0x13')]}})[_0xd1bb('0x14')](function(_0x1c1964){if(_0x1c1964){_0x1c1964[_0xd1bb('0x15')]({'lastMsgAt':_0x20fe10['createdAt'],'lastMsgDirection':_0x20fe10['direction'][_0xd1bb('0xe')]()});}})[_0xd1bb('0x16')](function(_0x50bc0d){console[_0xd1bb('0x17')](_0x50bc0d);});}if(_0x20fe10[_0xd1bb('0xd')]===_0xd1bb('0xf')&&!_0x20fe10[_0xd1bb('0x10')]){var _0xf74c2e;_0x4ac2ff['SmsAccount']['find']({'where':{'id':_0x20fe10[_0xd1bb('0x18')]},'raw':!![]})['then'](function(_0x33beae){_0xf74c2e=_0x33beae;if(_0xf74c2e&&_0xf74c2e[_0xd1bb('0x19')]){switch(_0xf74c2e['type']){case _0xd1bb('0x1a'):var _0x805840=require(_0xd1bb('0x1a'));if(_0xf74c2e[_0xd1bb('0x1b')]&&_0xf74c2e['authToken']&&_0xf74c2e[_0xd1bb('0x1c')]){var _0x23c405=new _0x805840(_0xf74c2e['accountSid'],_0xf74c2e['authToken']);_0x23c405['messages'][_0xd1bb('0x1d')]({'body':_0x20fe10[_0xd1bb('0xa')],'to':_0x20fe10[_0xd1bb('0x1c')],'from':_0xf74c2e['phone'],'statusCallback':_0xf74c2e[_0xd1bb('0x1e')]+'/api/sms/messages/'+_0x20fe10['id']+_0xd1bb('0x1f')+_0xf74c2e['token']})[_0xd1bb('0x14')](function(_0x1c98ad){if(_0x1c98ad[_0xd1bb('0x20')]){return _0x36d47f['update']({'messageId':_0x1c98ad[_0xd1bb('0x20')]});}})['catch'](function(_0x1996c8){logger[_0xd1bb('0x17')](_0xd1bb('0x21'),_0xd1bb('0x22'),_0xd1bb('0x1a'),util[_0xd1bb('0x23')](_0x1996c8,{'showHidden':![],'depth':null}));});}else{logger[_0xd1bb('0x17')](_0xd1bb('0x21'),_0xd1bb('0x22'),_0xd1bb('0x1a'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xd1bb('0x24'):var _0x341f2d=_0xd1bb('0x25');if(_0xf74c2e[_0xd1bb('0x26')]&&_0xf74c2e[_0xd1bb('0x27')]){var _0x477c01={'recipient':[_0x20fe10['phone']],'message':_0x20fe10[_0xd1bb('0xa')],'message_type':_0xf74c2e['smsMethod']};if(_0xf74c2e[_0xd1bb('0x28')]&&_0xf74c2e[_0xd1bb('0x28')]!=='SI'){_0x477c01[_0xd1bb('0x29')]=_0xf74c2e[_0xd1bb('0x1c')];}var _0x18f3c2={'url':_0x341f2d+'login?username='+_0xf74c2e['username']+_0xd1bb('0x2a')+_0xf74c2e[_0xd1bb('0x27')],'method':_0xd1bb('0x2b')};rp(_0x18f3c2)[_0xd1bb('0x14')](function(_0x2f1a01){var _0x48020a=_0x2f1a01[_0xd1bb('0x2c')](';');var _0x3018aa={'user_key':_0x48020a[0x0],'session_key':_0x48020a[0x1]};_0x18f3c2={'url':_0x341f2d+_0xd1bb('0x2d'),'method':'POST','headers':{'user_key':_0x3018aa[_0xd1bb('0x2e')],'Session_key':_0x3018aa[_0xd1bb('0x2f')]},'json':!![],'body':_0x477c01};return rp(_0x18f3c2);})[_0xd1bb('0x14')](function(_0x39ee83){if(_0x39ee83[_0xd1bb('0x30')]>=0x1){var _0x5002a6={'messageId':_0x39ee83[_0xd1bb('0x31')]};if(_0xf74c2e['smsMethod']!=='GP'||!_0xf74c2e[_0xd1bb('0x32')]){_0x5002a6['read']=!![];}return _0x36d47f[_0xd1bb('0x15')](_0x5002a6);}else{return logger[_0xd1bb('0x17')](_0xd1bb('0x21'),_0xd1bb('0x22'),_0xd1bb('0x24'),util['inspect'](_0x39ee83,{'showHidden':![],'depth':null}));}})[_0xd1bb('0x16')](function(_0x140d85){return logger[_0xd1bb('0x17')](_0xd1bb('0x21'),_0xd1bb('0x22'),_0xd1bb('0x24'),util['inspect'](_0x140d85,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd1bb('0x22'),_0xd1bb('0x24'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xd1bb('0x33'):if(_0xf74c2e[_0xd1bb('0x34')]){var _0x10ef73={'recipient':_0x20fe10['phone'],'message':_0x20fe10['body'],'sender':_0xf74c2e[_0xd1bb('0x35')]||_0xf74c2e[_0xd1bb('0x1c')],'authorization':_0xf74c2e[_0xd1bb('0x34')]};var _0x304c93={'method':'POST','uri':_0xd1bb('0x36'),'body':_0x10ef73,'json':!![]};rp(_0x304c93)[_0xd1bb('0x14')](function(_0x7c7e2a){var _0x2c9663={'messageId':_0x7c7e2a[_0xd1bb('0x37')]};if(!_0xf74c2e['deliveryReport']){_0x2c9663['read']=!![];}return _0x36d47f['update'](_0x2c9663);})[_0xd1bb('0x16')](function(_0x113e57){logger[_0xd1bb('0x17')](_0xd1bb('0x21'),_0xd1bb('0x22'),_0xd1bb('0x33'),util[_0xd1bb('0x23')](_0x113e57,{'showHidden':![],'depth':null}));});}else{logger[_0xd1bb('0x17')](_0xd1bb('0x21'),_0xd1bb('0x22'),_0xd1bb('0x33'),'Missing\x20parameters:\x20authToken');}break;case _0xd1bb('0x38'):if(_0xf74c2e[_0xd1bb('0x26')]&&_0xf74c2e[_0xd1bb('0x27')]){var _0x10ef73={'messages':[{'source':_0xd1bb('0x39'),'to':_0x20fe10['phone'],'body':_0x20fe10[_0xd1bb('0xa')],'from':_0xf74c2e[_0xd1bb('0x35')]||_0xf74c2e[_0xd1bb('0x1c')]}]};var _0x458d1c=util[_0xd1bb('0x3a')](_0xd1bb('0x3b'),_0xf74c2e[_0xd1bb('0x26')],_0xf74c2e[_0xd1bb('0x27')]);var _0x304c93={'method':_0xd1bb('0x3c'),'uri':_0xd1bb('0x3d'),'body':_0x10ef73,'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x458d1c)[_0xd1bb('0x3e')](_0xd1bb('0x3f')))},'json':!![]};rp(_0x304c93)[_0xd1bb('0x14')](function(_0x44fdc0){if(_0x44fdc0[_0xd1bb('0x40')]>=0xc8&&_0x44fdc0[_0xd1bb('0x40')]<=0xce){if(_0x44fdc0[_0xd1bb('0x41')]&&_0x44fdc0[_0xd1bb('0x41')][_0xd1bb('0x42')]>0x0){var _0x456e8b=_['head'](_0x44fdc0['data']['messages']);var _0x461d2d={'messageId':_0x456e8b['message_id']};if(!_0xf74c2e['deliveryReport']){_0x461d2d['read']=!![];}return _0x36d47f[_0xd1bb('0x15')](_0x461d2d);}else{logger[_0xd1bb('0x17')](_0xd1bb('0x21'),_0xd1bb('0x22'),'clickSend',util[_0xd1bb('0x23')](_0x44fdc0,{'showHidden':![],'depth':null}));}}else{logger[_0xd1bb('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd1bb('0x22'),_0xd1bb('0x43'),util[_0xd1bb('0x23')](_0x44fdc0,{'showHidden':![],'depth':null}));}})[_0xd1bb('0x16')](function(_0x24249b){logger[_0xd1bb('0x17')](_0xd1bb('0x21'),_0xd1bb('0x22'),_0xd1bb('0x43'),util[_0xd1bb('0x23')](_0x24249b,{'showHidden':![],'depth':null}));});}else{logger[_0xd1bb('0x17')](_0xd1bb('0x21'),_0xd1bb('0x22'),_0xd1bb('0x43'),_0xd1bb('0x44'));}break;case _0xd1bb('0x45'):if(_0xf74c2e['authId']&&_0xf74c2e[_0xd1bb('0x34')]){var _0x10ef73={'dst':_0x20fe10[_0xd1bb('0x1c')],'text':_0x20fe10[_0xd1bb('0xa')],'src':_0xf74c2e[_0xd1bb('0x35')]||_0xf74c2e['phone'],'url':_0xf74c2e[_0xd1bb('0x1e')]+'/api/sms/messages/'+_0x20fe10['id']+_0xd1bb('0x1f')+_0xf74c2e[_0xd1bb('0x46')]};var _0x458d1c=util[_0xd1bb('0x3a')](_0xd1bb('0x3b'),_0xf74c2e['authId'],_0xf74c2e[_0xd1bb('0x34')]);var _0x304c93={'method':_0xd1bb('0x3c'),'uri':util['format'](_0xd1bb('0x47'),_0xf74c2e['authId']),'body':_0x10ef73,'headers':{'Authorization':util[_0xd1bb('0x3a')](_0xd1bb('0x48'),new Buffer(_0x458d1c)[_0xd1bb('0x3e')](_0xd1bb('0x3f')))},'json':!![]};rp(_0x304c93)[_0xd1bb('0x14')](function(_0x3e5bb6){var _0x41c0d8={'messageId':_0x3e5bb6['message_uuid'][0x0]};return _0x36d47f[_0xd1bb('0x15')](_0x41c0d8);})[_0xd1bb('0x16')](function(_0x58292f){logger[_0xd1bb('0x17')](_0xd1bb('0x21'),'afterCreate',_0xd1bb('0x45'),util['inspect'](_0x58292f,{'showHidden':![],'depth':null}));});}else{logger[_0xd1bb('0x17')](_0xd1bb('0x21'),_0xd1bb('0x22'),_0xd1bb('0x45'),_0xd1bb('0x49'));}break;case _0xd1bb('0x4a'):if(_0xf74c2e[_0xd1bb('0x26')]&&_0xf74c2e[_0xd1bb('0x27')]){if(_0xf74c2e['baseUrl']){var _0x529920={'method':_0xd1bb('0x3c'),'uri':_0xf74c2e['baseUrl']+'/auth/1/session','body':{'username':_0xf74c2e[_0xd1bb('0x26')],'password':_0xf74c2e['password']},'json':!![]};return rp(_0x529920)[_0xd1bb('0x14')](function(_0x48b5b5){var _0x17d0f4={'method':_0xd1bb('0x3c'),'uri':_0xf74c2e[_0xd1bb('0x4b')]+_0xd1bb('0x4c'),'body':{'messages':[{'from':_0xf74c2e[_0xd1bb('0x1c')],'destinations':[{'to':_0x20fe10[_0xd1bb('0x1c')]}],'text':_0x20fe10['body'],'notifyUrl':_0xf74c2e[_0xd1bb('0x1e')]+_0xd1bb('0x4d')+_0x20fe10['id']+_0xd1bb('0x1f')+_0xf74c2e[_0xd1bb('0x46')],'notifyContentType':_0xd1bb('0x4e'),'callbackData':_0xf74c2e[_0xd1bb('0x1c')]+';'+_0x20fe10[_0xd1bb('0xa')]}]},'headers':{'Authorization':_0xd1bb('0x4f')+_0x48b5b5[_0xd1bb('0x46')]},'json':!![]};return rp(_0x17d0f4)[_0xd1bb('0x14')](function(_0x51aa29){if(_0x51aa29[_0xd1bb('0x50')]){var _0x9e7a92={'messageId':_0x51aa29[_0xd1bb('0x50')][0x0][_0xd1bb('0x8')]};if(!_0xf74c2e[_0xd1bb('0x32')]){_0x9e7a92['read']=!![];}return _0x36d47f[_0xd1bb('0x15')](_0x9e7a92);}else{return logger['error'](_0xd1bb('0x21'),_0xd1bb('0x22'),'infobip',util[_0xd1bb('0x23')](_0x51aa29,{'showHidden':![],'depth':null}));}});})[_0xd1bb('0x16')](function(_0x206fca){return logger[_0xd1bb('0x17')](_0xd1bb('0x21'),'afterCreate','infobip',util[_0xd1bb('0x23')](_0x206fca,{'showHidden':![],'depth':null}));});}else{logger[_0xd1bb('0x17')](_0xd1bb('0x21'),_0xd1bb('0x22'),'infobip',_0xd1bb('0x51'));}}else{logger[_0xd1bb('0x17')](_0xd1bb('0x21'),_0xd1bb('0x22'),_0xd1bb('0x4a'),_0xd1bb('0x44'));}break;case _0xd1bb('0x52'):var _0x386c97=require(_0xd1bb('0x53'));if(_0xf74c2e[_0xd1bb('0x54')]){var _0x3e0280={};_0x3e0280[_0xd1bb('0x55')]=_0xf74c2e[_0xd1bb('0x26')];_0x3e0280[_0xd1bb('0x1c')]=_0x20fe10[_0xd1bb('0x1c')];_0x3e0280[_0xd1bb('0x29')]=_0xf74c2e[_0xd1bb('0x1c')];_0x3e0280[_0xd1bb('0x56')]=_0x20fe10[_0xd1bb('0xa')];_0x3e0280[_0xd1bb('0x57')]=+new Date();var _0x154da6='';var _0x34188f='';var _0x5cda91=Object[_0xd1bb('0x58')](_0x3e0280);_0x5cda91[_0xd1bb('0x59')]();for(var _0x446297=0x0;_0x446297<_0x5cda91[_0xd1bb('0x5a')];_0x446297++){if(_0x154da6!=''){_0x154da6+='&';}_0x154da6+=_0x5cda91[_0x446297]+'='+encodeURIComponent(_0x3e0280[_0x5cda91[_0x446297]]);_0x34188f+=_0x3e0280[_0x5cda91[_0x446297]];}_0x34188f+=_0xf74c2e['apiKey'];_0x34188f=_0x386c97[_0xd1bb('0x5b')]('md5')[_0xd1bb('0x15')](_0x34188f)['digest'](_0xd1bb('0x5c'));if(_0x154da6!==''){_0x154da6+='&';}_0x154da6+=_0xd1bb('0x5d')+_0x34188f;var _0x18f3c2={'method':_0xd1bb('0x2b'),'uri':_0xf74c2e[_0xd1bb('0x4b')]+'/external/get/send.php?'+_0x154da6,'json':!![]};return rp(_0x18f3c2)[_0xd1bb('0x14')](function(_0x1d8e29){var _0x5e95be=Object[_0xd1bb('0x58')](_0x1d8e29);if(_0x1d8e29[_0x5e95be[0x0]][_0xd1bb('0x17')]&&parseInt(_0x1d8e29[_0x5e95be[0x0]][_0xd1bb('0x17')])===0x0){var _0x5d5041={'messageId':_0x1d8e29[_0x5e95be[0x0]][_0xd1bb('0x5e')]};if(!_0xf74c2e[_0xd1bb('0x32')]){_0x5d5041['read']=!![];}return _0x36d47f[_0xd1bb('0x15')](_0x5d5041);}else{return logger['error'](_0xd1bb('0x21'),'afterCreate',_0xd1bb('0x52'),util[_0xd1bb('0x23')](_0x1d8e29['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x5b0b9e){return logger[_0xd1bb('0x17')](_0xd1bb('0x21'),_0xd1bb('0x22'),'csc',util[_0xd1bb('0x23')](_0x5b0b9e,{'showHidden':![],'depth':null}));});}else{logger[_0xd1bb('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd1bb('0x22'),_0xd1bb('0x52'),_0xd1bb('0x5f'));}break;case'clickatell':if(_0xf74c2e[_0xd1bb('0x54')]){var _0x214b75={'method':_0xd1bb('0x3c'),'uri':_0xd1bb('0x60'),'headers':{'Authorization':_0xf74c2e[_0xd1bb('0x54')]},'body':{'content':_0x20fe10[_0xd1bb('0xa')],'to':[_0x20fe10[_0xd1bb('0x1c')]],'from':_0xf74c2e[_0xd1bb('0x1c')],'binary':![],'clientMessageId':_0xd1bb('0x61'),'charset':'UTF-8'},'json':!![]};rp(_0x214b75)['then'](function(_0x5c8704){if(!_0x5c8704[_0xd1bb('0x17')]){var _0x5a97ed={'messageId':_0x5c8704['messages'][0x0][_0xd1bb('0x62')]};if(!_0xf74c2e[_0xd1bb('0x32')]){_0x5a97ed['read']=!![];}return _0x36d47f[_0xd1bb('0x15')](_0x5a97ed);}else{return logger[_0xd1bb('0x17')](_0xd1bb('0x21'),_0xd1bb('0x22'),_0xd1bb('0x63'),util[_0xd1bb('0x23')](_0x5c8704[_0xd1bb('0x17')],{'showHidden':![],'depth':null}));}})[_0xd1bb('0x16')](function(_0x295d3e){return logger[_0xd1bb('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd1bb('0x22'),_0xd1bb('0x63'),util[_0xd1bb('0x23')](_0x295d3e,{'showHidden':![],'depth':null}));});}else{logger[_0xd1bb('0x17')](_0xd1bb('0x21'),'afterCreate','clickatell',_0xd1bb('0x5f'));}break;case _0xd1bb('0x64'):if(_0xf74c2e[_0xd1bb('0x26')]&&_0xf74c2e['password']){var _0x458d1c=util[_0xd1bb('0x3a')](_0xd1bb('0x3b'),_0xf74c2e[_0xd1bb('0x26')],_0xf74c2e[_0xd1bb('0x27')]);var _0x304c93={'method':_0xd1bb('0x3c'),'uri':_0xd1bb('0x65')+_0xf74c2e[_0xd1bb('0x66')]+_0xd1bb('0x67'),'body':{'to':[_0x20fe10[_0xd1bb('0x1c')]],'text':_0x20fe10[_0xd1bb('0xa')],'from':_0xf74c2e[_0xd1bb('0x1c')],'applicationId':_0xf74c2e['applicationId']},'headers':{'Authorization':util[_0xd1bb('0x3a')](_0xd1bb('0x48'),new Buffer(_0x458d1c)[_0xd1bb('0x3e')](_0xd1bb('0x3f')))},'json':!![]};rp(_0x304c93)[_0xd1bb('0x14')](function(_0x26cc80){if(_0x26cc80['id']){var _0x4f867b={'messageId':_0x26cc80['id']};return _0x36d47f['update'](_0x4f867b);}else{logger[_0xd1bb('0x17')](_0xd1bb('0x21'),_0xd1bb('0x22'),_0xd1bb('0x64'),util[_0xd1bb('0x23')](_0x26cc80,{'showHidden':![],'depth':null}));}})[_0xd1bb('0x16')](function(_0x1a8dbd){logger[_0xd1bb('0x17')](_0xd1bb('0x21'),_0xd1bb('0x22'),_0xd1bb('0x64'),util[_0xd1bb('0x23')](_0x1a8dbd,{'showHidden':![],'depth':null}));});}else{logger[_0xd1bb('0x17')](_0xd1bb('0x21'),_0xd1bb('0x22'),_0xd1bb('0x64'),_0xd1bb('0x44'));}break;case _0xd1bb('0x68'):if(_0xf74c2e[_0xd1bb('0x54')]){var _0x3f55b6={};var _0x18f3c2={'method':'POST','uri':_0xd1bb('0x69'),'headers':{'Authorization':_0xd1bb('0x6a')+_0xf74c2e[_0xd1bb('0x54')],'Content-Type':_0xd1bb('0x4e')},'body':{'from':_0xf74c2e[_0xd1bb('0x1c')],'to':_0x20fe10[_0xd1bb('0x1c')],'text':_0x20fe10[_0xd1bb('0xa')]},'json':!![]};return rp(_0x18f3c2)[_0xd1bb('0x14')](function(_0x27786c){if(_0x27786c[_0xd1bb('0x6b')]==0xca){_0x3f55b6[_0xd1bb('0x6c')]=_0x27786c;var _0x16d589={'method':'POST','uri':_0xd1bb('0x6d'),'headers':{'Authorization':_0xd1bb('0x6a')+_0xf74c2e[_0xd1bb('0x54')],'Content-Type':_0xd1bb('0x4e')},'body':{'refid':_0x3f55b6[_0xd1bb('0x6c')][_0xd1bb('0x6e')]},'json':!![]};return rp(_0x16d589)[_0xd1bb('0x14')](function(_0x1ef896){_0x3f55b6[_0xd1bb('0x6f')]=_0x1ef896;var _0xc8a65c={'messageId':_0x3f55b6[_0xd1bb('0x6c')][_0xd1bb('0x6e')],'read':!![]};return _0x36d47f[_0xd1bb('0x15')](_0xc8a65c);});}else{return logger[_0xd1bb('0x17')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd1bb('0x22'),'intelepeer',util[_0xd1bb('0x23')](_0x27786c,{'showHidden':![],'depth':null}));}})[_0xd1bb('0x16')](function(_0xbc64a5){return logger[_0xd1bb('0x17')](_0xd1bb('0x21'),_0xd1bb('0x22'),_0xd1bb('0x68'),util[_0xd1bb('0x23')](_0xbc64a5,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xd1bb('0x21'),_0xd1bb('0x22'),_0xd1bb('0x68'),_0xd1bb('0x70'));}break;}}})[_0xd1bb('0x71')](function(){_0x3ba520();});}else{_0x3ba520();}}},'charset':_0xd1bb('0x72'),'collate':_0xd1bb('0x73')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 6059522..f4dbe21 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 _0x1c87=['socket.io-emitter','./smsMessage.socket','register','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','body','options','CreateSmsMessage','catch','lodash','util','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0x264fb4,_0x341524){var _0x5a6a16=function(_0x2518d8){while(--_0x2518d8){_0x264fb4['push'](_0x264fb4['shift']());}};_0x5a6a16(++_0x341524);}(_0x1c87,0x151));var _0x71c8=function(_0x23eaad,_0x2ef62f){_0x23eaad=_0x23eaad-0x0;var _0x525ca5=_0x1c87[_0x23eaad];return _0x525ca5;};'use strict';var _=require(_0x71c8('0x0'));var util=require(_0x71c8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x71c8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x71c8('0x3'))(_0x71c8('0x4'));var config=require(_0x71c8('0x5'));var jayson=require(_0x71c8('0x6'));var client=jayson['client'][_0x71c8('0x7')]({'port':0x232a});config[_0x71c8('0x8')]=_[_0x71c8('0x9')](config[_0x71c8('0x8')],{'host':_0x71c8('0xa'),'port':0x18eb});var socket=require(_0x71c8('0xb'))(new Redis(config[_0x71c8('0x8')]));require(_0x71c8('0xc'))[_0x71c8('0xd')](socket);function respondWithRpcPromise(_0x1c86d2,_0x58bbdf,_0x4929a6){return new BPromise(function(_0x4bcce5,_0x1616e0){return client['request'](_0x1c86d2,_0x4929a6)[_0x71c8('0xe')](function(_0x5072f8){logger[_0x71c8('0xf')](_0x71c8('0x10'),_0x58bbdf,'request\x20sent');logger[_0x71c8('0x11')](_0x71c8('0x12'),_0x58bbdf,'request\x20sent',JSON[_0x71c8('0x13')](_0x5072f8));if(_0x5072f8[_0x71c8('0x14')]){if(_0x5072f8[_0x71c8('0x14')][_0x71c8('0x15')]===0x1f4){logger[_0x71c8('0x14')](_0x71c8('0x10'),_0x58bbdf,_0x5072f8[_0x71c8('0x14')]['message']);return _0x1616e0(_0x5072f8[_0x71c8('0x14')][_0x71c8('0x16')]);}logger[_0x71c8('0x14')]('SmsMessage,\x20%s,\x20%s',_0x58bbdf,_0x5072f8[_0x71c8('0x14')][_0x71c8('0x16')]);return _0x4bcce5(_0x5072f8[_0x71c8('0x14')]['message']);}else{logger['info'](_0x71c8('0x10'),_0x58bbdf,_0x71c8('0x17'));_0x4bcce5(_0x5072f8[_0x71c8('0x18')][_0x71c8('0x16')]);}})['catch'](function(_0x175a1d){logger[_0x71c8('0x14')](_0x71c8('0x10'),_0x58bbdf,_0x175a1d);_0x1616e0(_0x175a1d);});});}exports['CreateSmsMessage']=function(_0x5bb798){var _0x4bbbfe=this;return new Promise(function(_0x1c123c,_0xb805ba){return db['SmsMessage']['create'](_0x5bb798[_0x71c8('0x19')],{'raw':_0x5bb798[_0x71c8('0x1a')]?_0x5bb798[_0x71c8('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3984d9){logger[_0x71c8('0xf')](_0x71c8('0x1b'),_0x5bb798);logger[_0x71c8('0x11')](_0x71c8('0x1b'),_0x5bb798,JSON['stringify'](_0x3984d9));_0x1c123c(_0x3984d9);})[_0x71c8('0x1c')](function(_0x31c818){logger[_0x71c8('0x14')](_0x71c8('0x1b'),_0x31c818[_0x71c8('0x16')],_0x5bb798);_0xb805ba(_0x4bbbfe[_0x71c8('0x14')](0x1f4,_0x31c818['message']));});});}; \ No newline at end of file +var _0x8e95=['create','body','options','raw','then','stringify','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','socket.io-emitter','register','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSmsMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8e95,0x1ab));var _0x58e9=function(_0x32f646,_0x4a2e8a){_0x32f646=_0x32f646-0x0;var _0x1554f1=_0x8e95[_0x32f646];return _0x1554f1;};'use strict';var _=require('lodash');var util=require(_0x58e9('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x58e9('0x1'));var fs=require('fs');var Redis=require(_0x58e9('0x2'));var db=require(_0x58e9('0x3'))['db'];var utils=require(_0x58e9('0x4'));var logger=require(_0x58e9('0x5'))(_0x58e9('0x6'));var config=require('../../config/environment');var jayson=require(_0x58e9('0x7'));var client=jayson['client'][_0x58e9('0x8')]({'port':0x232a});config[_0x58e9('0x9')]=_['defaults'](config[_0x58e9('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x58e9('0xa'))(new Redis(config['redis']));require('./smsMessage.socket')[_0x58e9('0xb')](socket);function respondWithRpcPromise(_0x43a36d,_0x2ee7ac,_0x504521){return new BPromise(function(_0x303025,_0x17d8e4){return client[_0x58e9('0xc')](_0x43a36d,_0x504521)['then'](function(_0x54bd98){logger[_0x58e9('0xd')](_0x58e9('0xe'),_0x2ee7ac,_0x58e9('0xf'));logger[_0x58e9('0x10')](_0x58e9('0x11'),_0x2ee7ac,_0x58e9('0xf'),JSON['stringify'](_0x54bd98));if(_0x54bd98[_0x58e9('0x12')]){if(_0x54bd98[_0x58e9('0x12')][_0x58e9('0x13')]===0x1f4){logger[_0x58e9('0x12')](_0x58e9('0xe'),_0x2ee7ac,_0x54bd98['error']['message']);return _0x17d8e4(_0x54bd98[_0x58e9('0x12')][_0x58e9('0x14')]);}logger[_0x58e9('0x12')](_0x58e9('0xe'),_0x2ee7ac,_0x54bd98[_0x58e9('0x12')][_0x58e9('0x14')]);return _0x303025(_0x54bd98[_0x58e9('0x12')]['message']);}else{logger[_0x58e9('0xd')]('SmsMessage,\x20%s,\x20%s',_0x2ee7ac,_0x58e9('0xf'));_0x303025(_0x54bd98[_0x58e9('0x15')][_0x58e9('0x14')]);}})['catch'](function(_0x33f814){logger[_0x58e9('0x12')](_0x58e9('0xe'),_0x2ee7ac,_0x33f814);_0x17d8e4(_0x33f814);});});}exports[_0x58e9('0x16')]=function(_0x4c8bce){var _0x1529db=this;return new Promise(function(_0x98eb8c,_0x170740){return db['SmsMessage'][_0x58e9('0x17')](_0x4c8bce[_0x58e9('0x18')],{'raw':_0x4c8bce['options']?_0x4c8bce[_0x58e9('0x19')][_0x58e9('0x1a')]===undefined?!![]:![]:!![]})[_0x58e9('0x1b')](function(_0x326b10){logger['info'](_0x58e9('0x16'),_0x4c8bce);logger[_0x58e9('0x10')](_0x58e9('0x16'),_0x4c8bce,JSON[_0x58e9('0x1c')](_0x326b10));_0x98eb8c(_0x326b10);})[_0x58e9('0x1d')](function(_0x1c2cbc){logger[_0x58e9('0x12')]('CreateSmsMessage',_0x1c2cbc[_0x58e9('0x14')],_0x4c8bce);_0x170740(_0x1529db['error'](0x1f4,_0x1c2cbc[_0x58e9('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 5672278..25f0a6e 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 _0xceaa=['emit','register','length','./smsMessage.events','save'];(function(_0x11dc39,_0x491115){var _0x457277=function(_0x1d77cd){while(--_0x1d77cd){_0x11dc39['push'](_0x11dc39['shift']());}};_0x457277(++_0x491115);}(_0xceaa,0x6c));var _0xacea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xceaa[_0x3dd15e];return _0x231fd0;};'use strict';var SmsMessageEvents=require(_0xacea('0x0'));var events=[_0xacea('0x1'),'remove','update'];function createListener(_0x75a262,_0x5b2a12){return function(_0x3d98a8){_0x5b2a12[_0xacea('0x2')](_0x75a262,_0x3d98a8);};}function removeListener(_0xe10826,_0x58a484){return function(){SmsMessageEvents['removeListener'](_0xe10826,_0x58a484);};}exports[_0xacea('0x3')]=function(_0x595060){for(var _0x48f04b=0x0,_0x29cf85=events[_0xacea('0x4')];_0x48f04b<_0x29cf85;_0x48f04b++){var _0x5c793a=events[_0x48f04b];var _0x373faf=createListener('smsMessage:'+_0x5c793a,_0x595060);SmsMessageEvents['on'](_0x5c793a,_0x373faf);}}; \ No newline at end of file +var _0xd0ef=['./smsMessage.events','remove','update','emit','removeListener','register','length'];(function(_0x41712f,_0x1dec4e){var _0x3f0ee9=function(_0x463371){while(--_0x463371){_0x41712f['push'](_0x41712f['shift']());}};_0x3f0ee9(++_0x1dec4e);}(_0xd0ef,0x134));var _0xfd0e=function(_0x57a27c,_0x377c13){_0x57a27c=_0x57a27c-0x0;var _0x1a72c7=_0xd0ef[_0x57a27c];return _0x1a72c7;};'use strict';var SmsMessageEvents=require(_0xfd0e('0x0'));var events=['save',_0xfd0e('0x1'),_0xfd0e('0x2')];function createListener(_0x3953f7,_0x268475){return function(_0x2f0f39){_0x268475[_0xfd0e('0x3')](_0x3953f7,_0x2f0f39);};}function removeListener(_0x5980ef,_0x37c7fc){return function(){SmsMessageEvents[_0xfd0e('0x4')](_0x5980ef,_0x37c7fc);};}exports[_0xfd0e('0x5')]=function(_0x8cf680){for(var _0x568181=0x0,_0xe19f8a=events[_0xfd0e('0x6')];_0x568181<_0xe19f8a;_0x568181++){var _0x292d34=events[_0x568181];var _0x34cde1=createListener('smsMessage:'+_0x292d34,_0x8cf680);SmsMessageEvents['on'](_0x292d34,_0x34cde1);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 540751b..9ff4716 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 _0x31c2=['delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update'];(function(_0x58fac9,_0x290a65){var _0x35da60=function(_0xff9be0){while(--_0xff9be0){_0x58fac9['push'](_0x58fac9['shift']());}};_0x35da60(++_0x290a65);}(_0x31c2,0x1e1));var _0x231c=function(_0x1b1353,_0x8b7000){_0x1b1353=_0x1b1353-0x0;var _0x1cc5d1=_0x31c2[_0x1b1353];return _0x1cc5d1;};'use strict';var multer=require(_0x231c('0x0'));var util=require(_0x231c('0x1'));var path=require(_0x231c('0x2'));var timeout=require(_0x231c('0x3'));var express=require(_0x231c('0x4'));var router=express[_0x231c('0x5')]();var auth=require(_0x231c('0x6'));var interaction=require(_0x231c('0x7'));var config=require('../../config/environment');var controller=require('./smsQueue.controller');router[_0x231c('0x8')]('/',auth[_0x231c('0x9')](),controller[_0x231c('0xa')]);router[_0x231c('0x8')]('/describe',auth[_0x231c('0x9')](),controller['describe']);router[_0x231c('0x8')](_0x231c('0xb'),auth[_0x231c('0x9')](),controller['show']);router[_0x231c('0x8')](_0x231c('0xc'),auth[_0x231c('0x9')](),controller[_0x231c('0xd')]);router[_0x231c('0x8')](_0x231c('0xe'),auth[_0x231c('0x9')](),controller['getTeams']);router[_0x231c('0x8')](_0x231c('0xf'),auth['isAuthenticated'](),controller[_0x231c('0x10')]);router[_0x231c('0x11')]('/',auth[_0x231c('0x9')](),controller[_0x231c('0x12')]);router[_0x231c('0x11')](_0x231c('0xe'),auth[_0x231c('0x9')](),controller[_0x231c('0x13')]);router[_0x231c('0x11')](_0x231c('0xf'),auth[_0x231c('0x9')](),controller[_0x231c('0x14')]);router[_0x231c('0x15')](_0x231c('0xb'),auth[_0x231c('0x9')](),controller[_0x231c('0x16')]);router[_0x231c('0x17')](_0x231c('0xb'),auth[_0x231c('0x9')](),controller[_0x231c('0x18')]);router['delete'](_0x231c('0xe'),auth[_0x231c('0x9')](),controller[_0x231c('0x19')]);router[_0x231c('0x17')](_0x231c('0xf'),auth[_0x231c('0x9')](),controller[_0x231c('0x1a')]);module[_0x231c('0x1b')]=router; \ No newline at end of file +var _0xd8af=['index','/describe','isAuthenticated','describe','show','/:id/members','getMembers','getTeams','post','/:id/teams','addTeams','/:id/users','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsQueue.controller','get'];(function(_0x1865f3,_0x5154be){var _0xb69290=function(_0x12e20b){while(--_0x12e20b){_0x1865f3['push'](_0x1865f3['shift']());}};_0xb69290(++_0x5154be);}(_0xd8af,0x18d));var _0xfd8a=function(_0x3ed2d9,_0xac1758){_0x3ed2d9=_0x3ed2d9-0x0;var _0x36553a=_0xd8af[_0x3ed2d9];return _0x36553a;};'use strict';var multer=require(_0xfd8a('0x0'));var util=require(_0xfd8a('0x1'));var path=require(_0xfd8a('0x2'));var timeout=require(_0xfd8a('0x3'));var express=require(_0xfd8a('0x4'));var router=express['Router']();var auth=require(_0xfd8a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfd8a('0x6'));var controller=require(_0xfd8a('0x7'));router[_0xfd8a('0x8')]('/',auth['isAuthenticated'](),controller[_0xfd8a('0x9')]);router['get'](_0xfd8a('0xa'),auth[_0xfd8a('0xb')](),controller[_0xfd8a('0xc')]);router[_0xfd8a('0x8')]('/:id',auth[_0xfd8a('0xb')](),controller[_0xfd8a('0xd')]);router[_0xfd8a('0x8')](_0xfd8a('0xe'),auth[_0xfd8a('0xb')](),controller[_0xfd8a('0xf')]);router['get']('/:id/teams',auth[_0xfd8a('0xb')](),controller[_0xfd8a('0x10')]);router[_0xfd8a('0x8')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xfd8a('0x11')]('/',auth[_0xfd8a('0xb')](),controller['create']);router['post'](_0xfd8a('0x12'),auth[_0xfd8a('0xb')](),controller[_0xfd8a('0x13')]);router[_0xfd8a('0x11')](_0xfd8a('0x14'),auth[_0xfd8a('0xb')](),controller[_0xfd8a('0x15')]);router[_0xfd8a('0x16')](_0xfd8a('0x17'),auth[_0xfd8a('0xb')](),controller[_0xfd8a('0x18')]);router[_0xfd8a('0x19')](_0xfd8a('0x17'),auth[_0xfd8a('0xb')](),controller[_0xfd8a('0x1a')]);router[_0xfd8a('0x19')](_0xfd8a('0x12'),auth[_0xfd8a('0xb')](),controller[_0xfd8a('0x1b')]);router[_0xfd8a('0x19')](_0xfd8a('0x14'),auth[_0xfd8a('0xb')](),controller[_0xfd8a('0x1c')]);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 7c008bc..a7f4fc3 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 _0x9775=['exports','STRING','name','ENUM','rrmemory','beepall','roundrobin'];(function(_0x4a7c85,_0x258db3){var _0x4194ec=function(_0x4a8475){while(--_0x4a8475){_0x4a7c85['push'](_0x4a7c85['shift']());}};_0x4194ec(++_0x258db3);}(_0x9775,0x13b));var _0x5977=function(_0x3b4943,_0x481b16){_0x3b4943=_0x3b4943-0x0;var _0x15c6a6=_0x9775[_0x3b4943];return _0x15c6a6;};'use strict';var Sequelize=require('sequelize');module[_0x5977('0x0')]={'name':{'type':Sequelize[_0x5977('0x1')],'unique':_0x5977('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5977('0x3')](_0x5977('0x4'),_0x5977('0x5'),_0x5977('0x6'))}}; \ No newline at end of file +var _0x33ee=['rrmemory','beepall','roundrobin','STRING','ENUM'];(function(_0x39eec2,_0x229f43){var _0x9ac314=function(_0x265300){while(--_0x265300){_0x39eec2['push'](_0x39eec2['shift']());}};_0x9ac314(++_0x229f43);}(_0x33ee,0xa8));var _0xe33e=function(_0x56ba92,_0xb3c986){_0x56ba92=_0x56ba92-0x0;var _0x8fe94d=_0x33ee[_0x56ba92];return _0x8fe94d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe33e('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe33e('0x0')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe33e('0x1')](_0xe33e('0x2'),_0xe33e('0x3'),_0xe33e('0x4'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 2d5eb2d..dd94084 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 _0x24ca=['path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','./smsQueue.socket','register','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','name','send','index','map','SmsQueue','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsQueues','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','Team','pick','getTeams','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','html-pdf','zip-dir','request-promise','moment','bluebird','util'];(function(_0x3f05df,_0x228a42){var _0xe356b1=function(_0x504b09){while(--_0x504b09){_0x3f05df['push'](_0x3f05df['shift']());}};_0xe356b1(++_0x228a42);}(_0x24ca,0x8c));var _0xa24c=function(_0x303c30,_0x16edcb){_0x303c30=_0x303c30-0x0;var _0x43161b=_0x24ca[_0x303c30];return _0x43161b;};'use strict';var pdf=require(_0xa24c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa24c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa24c('0x2'));var moment=require(_0xa24c('0x3'));var BPromise=require(_0xa24c('0x4'));var Mustache=require('mustache');var util=require(_0xa24c('0x5'));var path=require(_0xa24c('0x6'));var sox=require(_0xa24c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xa24c('0x8'));var crypto=require(_0xa24c('0x9'));var jsforce=require(_0xa24c('0xa'));var deskjs=require(_0xa24c('0xb'));var toCsv=require(_0xa24c('0xc'));var querystring=require(_0xa24c('0xd'));var Papa=require('papaparse');var Redis=require(_0xa24c('0xe'));var authService=require(_0xa24c('0xf'));var qs=require(_0xa24c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa24c('0x11'))(_0xa24c('0x12'));var utils=require(_0xa24c('0x13'));var config=require(_0xa24c('0x14'));var licenseUtil=require(_0xa24c('0x15'));var db=require(_0xa24c('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xa24c('0x17'),'port':0x18eb});var socket=require(_0xa24c('0x18'))(new Redis(config[_0xa24c('0x19')]));require(_0xa24c('0x1a'))[_0xa24c('0x1b')](socket);function respondWithStatusCode(_0x4971af,_0x13076d){_0x13076d=_0x13076d||0xcc;return function(_0x488a78){if(_0x488a78){return _0x4971af['sendStatus'](_0x13076d);}return _0x4971af['status'](_0x13076d)[_0xa24c('0x1c')]();};}function respondWithResult(_0x2a4270,_0x3f762e){_0x3f762e=_0x3f762e||0xc8;return function(_0x267762){if(_0x267762){return _0x2a4270[_0xa24c('0x1d')](_0x3f762e)[_0xa24c('0x1e')](_0x267762);}};}function respondWithFilteredResult(_0x2197da,_0x32a226){return function(_0x14f0aa){if(_0x14f0aa){var _0x117177=_0x14f0aa[_0xa24c('0x1f')],_0x1970fc=_0x32a226['offset'],_0x1a667b=_0x32a226[_0xa24c('0x20')]+_0x32a226['limit'],_0x278cce;if(_0x1a667b>=_0x117177){_0x1a667b=_0x117177;_0x278cce=0xc8;}else{_0x278cce=0xce;}_0x2197da[_0xa24c('0x1d')](_0x278cce);return _0x2197da[_0xa24c('0x21')](_0xa24c('0x22'),_0x1970fc+'-'+_0x1a667b+'/'+_0x117177)[_0xa24c('0x1e')](_0x14f0aa);}return null;};}function patchUpdates(_0x240f6c){return function(_0x416dea){try{jsonpatch[_0xa24c('0x23')](_0x416dea,_0x240f6c,!![]);}catch(_0x432c15){return BPromise[_0xa24c('0x24')](_0x432c15);}return _0x416dea[_0xa24c('0x25')]();};}function saveUpdates(_0x2b471a,_0x53e729){return function(_0x4eadb2){if(_0x4eadb2){return _0x4eadb2[_0xa24c('0x26')](_0x2b471a)[_0xa24c('0x27')](function(_0x316a68){return _0x316a68;});}return null;};}function removeEntity(_0x1a04ff,_0x375c83){return function(_0xfb13c0){if(_0xfb13c0){return _0xfb13c0[_0xa24c('0x28')]()[_0xa24c('0x27')](function(){var _0x304d6c=_0xfb13c0['get']({'plain':!![]});var _0x2290e1='SmsQueues';return db[_0xa24c('0x29')][_0xa24c('0x28')]({'where':{'type':_0x2290e1,'resourceId':_0x304d6c['id']}})[_0xa24c('0x27')](function(){return _0xfb13c0;});})[_0xa24c('0x27')](function(){_0x1a04ff['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c86c6,_0x4e5d2c){return function(_0x23fb79){if(!_0x23fb79){_0x4c86c6[_0xa24c('0x2a')](0x194);}return _0x23fb79;};}function handleError(_0xab6197,_0x1cdee4){_0x1cdee4=_0x1cdee4||0x1f4;return function(_0x37cbd3){logger['error'](_0x37cbd3['stack']);if(_0x37cbd3[_0xa24c('0x2b')]){delete _0x37cbd3[_0xa24c('0x2b')];}_0xab6197[_0xa24c('0x1d')](_0x1cdee4)[_0xa24c('0x2c')](_0x37cbd3);};}exports[_0xa24c('0x2d')]=function(_0x3f7102,_0xc0db8f){var _0x1e30a9={},_0x29f539={},_0x17a001={'count':0x0,'rows':[]};var _0x59526b=_[_0xa24c('0x2e')](db[_0xa24c('0x2f')]['rawAttributes'],function(_0x3c9649){return{'name':_0x3c9649[_0xa24c('0x30')],'type':_0x3c9649[_0xa24c('0x31')][_0xa24c('0x32')]};});_0x29f539[_0xa24c('0x33')]=_[_0xa24c('0x2e')](_0x59526b,_0xa24c('0x2b'));_0x29f539[_0xa24c('0x34')]=_[_0xa24c('0x35')](_0x3f7102[_0xa24c('0x34')]);_0x29f539['filters']=_['intersection'](_0x29f539['model'],_0x29f539[_0xa24c('0x34')]);_0x1e30a9['attributes']=_[_0xa24c('0x36')](_0x29f539[_0xa24c('0x33')],qs[_0xa24c('0x37')](_0x3f7102['query'][_0xa24c('0x37')]));_0x1e30a9[_0xa24c('0x38')]=_0x1e30a9[_0xa24c('0x38')]['length']?_0x1e30a9[_0xa24c('0x38')]:_0x29f539[_0xa24c('0x33')];if(!_0x3f7102['query'][_0xa24c('0x39')](_0xa24c('0x3a'))){_0x1e30a9[_0xa24c('0x3b')]=qs['limit'](_0x3f7102[_0xa24c('0x34')][_0xa24c('0x3b')]);_0x1e30a9[_0xa24c('0x20')]=qs[_0xa24c('0x20')](_0x3f7102[_0xa24c('0x34')]['offset']);}_0x1e30a9[_0xa24c('0x3c')]=qs[_0xa24c('0x3d')](_0x3f7102['query'][_0xa24c('0x3d')]);_0x1e30a9[_0xa24c('0x3e')]=qs[_0xa24c('0x3f')](_['pick'](_0x3f7102['query'],_0x29f539[_0xa24c('0x3f')]),_0x59526b);if(_0x3f7102[_0xa24c('0x34')][_0xa24c('0x40')]){_0x1e30a9[_0xa24c('0x3e')]=_[_0xa24c('0x41')](_0x1e30a9[_0xa24c('0x3e')],{'$or':_['map'](_0x59526b,function(_0x46c0bf){if(_0x46c0bf[_0xa24c('0x31')]!==_0xa24c('0x42')){var _0x137a1d={};_0x137a1d[_0x46c0bf['name']]={'$like':'%'+_0x3f7102[_0xa24c('0x34')][_0xa24c('0x40')]+'%'};return _0x137a1d;}})});}_0x1e30a9=_[_0xa24c('0x41')]({},_0x1e30a9,_0x3f7102[_0xa24c('0x43')]);var _0x103b50={'where':_0x1e30a9[_0xa24c('0x3e')]};return db[_0xa24c('0x2f')]['count'](_0x103b50)['then'](function(_0x22c57e){_0x17a001['count']=_0x22c57e;if(_0x3f7102[_0xa24c('0x34')]['includeAll']){_0x1e30a9[_0xa24c('0x44')]=[{'all':!![]}];}return db[_0xa24c('0x2f')][_0xa24c('0x45')](_0x1e30a9);})[_0xa24c('0x27')](function(_0x21328f){_0x17a001[_0xa24c('0x46')]=_0x21328f;return _0x17a001;})[_0xa24c('0x27')](respondWithFilteredResult(_0xc0db8f,_0x1e30a9))[_0xa24c('0x47')](handleError(_0xc0db8f,null));};exports[_0xa24c('0x48')]=function(_0x38791c,_0x45dd80){var _0x1f87b7={'raw':!![],'where':{'id':_0x38791c[_0xa24c('0x49')]['id']}},_0x2e2f06={};_0x2e2f06[_0xa24c('0x33')]=_[_0xa24c('0x35')](db['SmsQueue'][_0xa24c('0x4a')]);_0x2e2f06[_0xa24c('0x34')]=_[_0xa24c('0x35')](_0x38791c['query']);_0x2e2f06[_0xa24c('0x3f')]=_[_0xa24c('0x36')](_0x2e2f06[_0xa24c('0x33')],_0x2e2f06[_0xa24c('0x34')]);_0x1f87b7['attributes']=_[_0xa24c('0x36')](_0x2e2f06[_0xa24c('0x33')],qs[_0xa24c('0x37')](_0x38791c[_0xa24c('0x34')][_0xa24c('0x37')]));_0x1f87b7[_0xa24c('0x38')]=_0x1f87b7[_0xa24c('0x38')][_0xa24c('0x4b')]?_0x1f87b7[_0xa24c('0x38')]:_0x2e2f06[_0xa24c('0x33')];if(_0x38791c[_0xa24c('0x34')][_0xa24c('0x4c')]){_0x1f87b7[_0xa24c('0x44')]=[{'all':!![]}];}_0x1f87b7=_['merge']({},_0x1f87b7,_0x38791c[_0xa24c('0x43')]);return db['SmsQueue'][_0xa24c('0x4d')](_0x1f87b7)[_0xa24c('0x27')](handleEntityNotFound(_0x45dd80,null))[_0xa24c('0x27')](respondWithResult(_0x45dd80,null))[_0xa24c('0x47')](handleError(_0x45dd80,null));};exports[_0xa24c('0x4e')]=function(_0x42d84b,_0x338877){return db[_0xa24c('0x2f')][_0xa24c('0x4e')](_0x42d84b[_0xa24c('0x4f')],{})[_0xa24c('0x27')](function(_0x390688){var _0x14c813=_0x42d84b['user'][_0xa24c('0x50')]({'plain':!![]});if(!_0x14c813)throw new Error(_0xa24c('0x51'));if(_0x14c813[_0xa24c('0x52')]===_0xa24c('0x53')){var _0x4b6cc0=_0x390688[_0xa24c('0x50')]({'plain':!![]});var _0xd09fd4=_0xa24c('0x54');return db['UserProfileSection']['find']({'where':{'name':_0xd09fd4,'userProfileId':_0x14c813[_0xa24c('0x55')]},'raw':!![]})[_0xa24c('0x27')](function(_0x4992ee){if(_0x4992ee&&_0x4992ee[_0xa24c('0x56')]===0x0){return db[_0xa24c('0x29')]['create']({'name':_0x4b6cc0[_0xa24c('0x2b')],'resourceId':_0x4b6cc0['id'],'type':_0x4992ee['name'],'sectionId':_0x4992ee['id']},{})['then'](function(){return _0x390688;});}else{return _0x390688;}})[_0xa24c('0x47')](function(_0x58f0e8){logger[_0xa24c('0x57')](_0xa24c('0x58'),_0x58f0e8);throw _0x58f0e8;});}return _0x390688;})['then'](respondWithResult(_0x338877,0xc9))[_0xa24c('0x47')](handleError(_0x338877,null));};exports[_0xa24c('0x26')]=function(_0x37379d,_0x2fe35e){if(_0x37379d['body']['id']){delete _0x37379d[_0xa24c('0x4f')]['id'];}return db['SmsQueue'][_0xa24c('0x4d')]({'where':{'id':_0x37379d[_0xa24c('0x49')]['id']}})['then'](handleEntityNotFound(_0x2fe35e,null))['then'](saveUpdates(_0x37379d[_0xa24c('0x4f')],null))[_0xa24c('0x27')](respondWithResult(_0x2fe35e,null))[_0xa24c('0x47')](handleError(_0x2fe35e,null));};exports[_0xa24c('0x28')]=function(_0x3aa9d7,_0x5f2564){return db[_0xa24c('0x2f')]['find']({'where':{'id':_0x3aa9d7[_0xa24c('0x49')]['id']}})['then'](handleEntityNotFound(_0x5f2564,null))['then'](removeEntity(_0x5f2564,null))['catch'](handleError(_0x5f2564,null));};exports[_0xa24c('0x59')]=function(_0x5c4834,_0x5d8086){return db[_0xa24c('0x2f')]['describe']()[_0xa24c('0x27')](respondWithResult(_0x5d8086,null))[_0xa24c('0x47')](handleError(_0x5d8086,null));};exports[_0xa24c('0x5a')]=function(_0x14c819,_0x33c5f7,_0x29c643){var _0x45d2fd={'raw':!![],'where':{}},_0x366505={},_0x47a366;return db['SmsQueue'][_0xa24c('0x5b')]({'where':{'id':_0x14c819[_0xa24c('0x49')]['id']}})['then'](handleEntityNotFound(_0x33c5f7,null))[_0xa24c('0x27')](function(_0x17d92d){if(_0x17d92d){_0x47a366=_0x17d92d['get']({'plain':!![]});_0x366505[_0xa24c('0x33')]=_[_0xa24c('0x35')](db[_0xa24c('0x5c')]['rawAttributes']);_0x366505[_0xa24c('0x34')]=_[_0xa24c('0x35')](_0x14c819['query']);_0x366505[_0xa24c('0x3f')]=_['intersection'](_0x366505[_0xa24c('0x33')],_0x366505[_0xa24c('0x34')]);_0x45d2fd[_0xa24c('0x38')]=_[_0xa24c('0x36')](_0x366505[_0xa24c('0x33')],qs[_0xa24c('0x37')](_0x14c819[_0xa24c('0x34')][_0xa24c('0x37')]));_0x45d2fd[_0xa24c('0x38')]=_0x45d2fd[_0xa24c('0x38')][_0xa24c('0x4b')]?_0x45d2fd[_0xa24c('0x38')]:_0x366505[_0xa24c('0x33')];if(!_0x14c819[_0xa24c('0x34')][_0xa24c('0x39')](_0xa24c('0x3a'))){_0x45d2fd[_0xa24c('0x3b')]=qs[_0xa24c('0x3b')](_0x14c819['query'][_0xa24c('0x3b')]);_0x45d2fd['offset']=qs[_0xa24c('0x20')](_0x14c819[_0xa24c('0x34')][_0xa24c('0x20')]);}_0x45d2fd[_0xa24c('0x3c')]=qs['sort'](_0x14c819['query'][_0xa24c('0x3d')]);_0x45d2fd[_0xa24c('0x3e')]=qs[_0xa24c('0x3f')](_['pick'](_0x14c819[_0xa24c('0x34')],_0x366505[_0xa24c('0x3f')]));_0x45d2fd[_0xa24c('0x3e')][_0xa24c('0x5d')]=_0x17d92d['id'];if(_0x14c819[_0xa24c('0x34')][_0xa24c('0x40')]){_0x45d2fd[_0xa24c('0x3e')]=_[_0xa24c('0x41')](_0x45d2fd[_0xa24c('0x3e')],{'$or':_[_0xa24c('0x2e')](_0x45d2fd[_0xa24c('0x38')],function(_0x19c87a){var _0x3b68d7={};_0x3b68d7[_0x19c87a]={'$like':'%'+_0x14c819[_0xa24c('0x34')][_0xa24c('0x40')]+'%'};return _0x3b68d7;})});}_0x45d2fd=_[_0xa24c('0x41')]({},_0x45d2fd,_0x14c819[_0xa24c('0x43')]);return db[_0xa24c('0x5c')][_0xa24c('0x45')](_0x45d2fd);}})[_0xa24c('0x27')](function(_0x333cb7){if(_0x333cb7){return db[_0xa24c('0x5e')][_0xa24c('0x5f')]({'where':{'id':_[_0xa24c('0x2e')](_0x333cb7,_0xa24c('0x60')),'role':_0xa24c('0x61')},'attributes':['id',_0xa24c('0x2b'),_0xa24c('0x62'),_0xa24c('0x63'),_0xa24c('0x64')]});}})['then'](function(_0x37f25d){if(_0x37f25d){return{'count':_0x37f25d['count'],'rows':_[_0xa24c('0x2e')](_0x37f25d[_0xa24c('0x46')],function(_0x19a6f3){return{'membername':_0x19a6f3[_0xa24c('0x2b')],'UserId':_0x19a6f3['id'],'queue_name':_0x47a366['name'],'SmsQueueId':_0x47a366['id'],'interface':util[_0xa24c('0x65')](_0xa24c('0x66'),_0xa24c('0x67'),_0x19a6f3['name']),'penalty':0x0,'paused':_0x19a6f3[_0xa24c('0x62')],'createdAt':_0x19a6f3['createdAt'],'updatedAt':_0x19a6f3[_0xa24c('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa24c('0x27')](respondWithFilteredResult(_0x33c5f7,_0x45d2fd))[_0xa24c('0x47')](handleError(_0x33c5f7,null));};exports['getTeams']=function(_0x2d1f56,_0x846186,_0x5ae89a){var _0x35fae7={};var _0x36e108={};var _0x316e26;var _0x2a189a;return db[_0xa24c('0x2f')][_0xa24c('0x5b')]({'where':{'id':_0x2d1f56[_0xa24c('0x49')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x846186,null))[_0xa24c('0x27')](function(_0x327360){if(_0x327360){_0x316e26=_0x327360;_0x36e108[_0xa24c('0x33')]=_[_0xa24c('0x35')](db[_0xa24c('0x68')][_0xa24c('0x4a')]);_0x36e108[_0xa24c('0x34')]=_[_0xa24c('0x35')](_0x2d1f56['query']);_0x36e108[_0xa24c('0x3f')]=_[_0xa24c('0x36')](_0x36e108[_0xa24c('0x33')],_0x36e108[_0xa24c('0x34')]);_0x35fae7[_0xa24c('0x38')]=_['intersection'](_0x36e108['model'],qs[_0xa24c('0x37')](_0x2d1f56[_0xa24c('0x34')][_0xa24c('0x37')]));_0x35fae7[_0xa24c('0x38')]=_0x35fae7[_0xa24c('0x38')]['length']?_0x35fae7[_0xa24c('0x38')]:_0x36e108[_0xa24c('0x33')];_0x35fae7[_0xa24c('0x3c')]=qs['sort'](_0x2d1f56[_0xa24c('0x34')]['sort']);_0x35fae7['where']=qs['filters'](_[_0xa24c('0x69')](_0x2d1f56[_0xa24c('0x34')],_0x36e108[_0xa24c('0x3f')]));if(_0x2d1f56[_0xa24c('0x34')]['filter']){_0x35fae7[_0xa24c('0x3e')]=_[_0xa24c('0x41')](_0x35fae7[_0xa24c('0x3e')],{'$or':_[_0xa24c('0x2e')](_0x35fae7[_0xa24c('0x38')],function(_0x4baa40){var _0x35f8e5={};_0x35f8e5[_0x4baa40]={'$like':'%'+_0x2d1f56[_0xa24c('0x34')]['filter']+'%'};return _0x35f8e5;})});}_0x35fae7=_['merge']({},_0x35fae7,_0x2d1f56[_0xa24c('0x43')]);return _0x316e26[_0xa24c('0x6a')](_0x35fae7);}})[_0xa24c('0x27')](function(_0x3479a9){if(_0x3479a9){_0x2a189a=_0x3479a9[_0xa24c('0x4b')];if(!_0x2d1f56[_0xa24c('0x34')][_0xa24c('0x39')](_0xa24c('0x3a'))){_0x35fae7['limit']=qs['limit'](_0x2d1f56[_0xa24c('0x34')][_0xa24c('0x3b')]);_0x35fae7[_0xa24c('0x20')]=qs[_0xa24c('0x20')](_0x2d1f56[_0xa24c('0x34')]['offset']);}return _0x316e26[_0xa24c('0x6a')](_0x35fae7);}})['then'](function(_0x47f744){if(_0x47f744){return _0x47f744?{'count':_0x2a189a,'rows':_0x47f744}:null;}})[_0xa24c('0x27')](respondWithResult(_0x846186,null))[_0xa24c('0x47')](handleError(_0x846186,null));};exports['addTeams']=function(_0x32b835,_0x2915f1,_0x283f63){var _0x4c7ca1=_0x32b835[_0xa24c('0x4f')]['ids'];return db[_0xa24c('0x68')][_0xa24c('0x45')]({'where':{'id':_0x4c7ca1},'attributes':['id'],'include':[{'model':db[_0xa24c('0x5e')],'as':_0xa24c('0x6b'),'attributes':['id',_0xa24c('0x2b'),_0xa24c('0x6c'),_0xa24c('0x6d'),_0xa24c('0x6e')],'raw':!![]}]})[_0xa24c('0x27')](function(_0x286b89){if(_0x286b89){var _0x475526=_[_0xa24c('0x6f')](_0x286b89,function(_0xd11c2a){var _0x569475=_0xd11c2a['get']({'plain':!![]});return _0x569475[_0xa24c('0x6b')];});return db[_0xa24c('0x2f')][_0xa24c('0x4d')]({'where':{'id':_0x32b835[_0xa24c('0x49')]['id']}})[_0xa24c('0x27')](function(_0x4b4f88){return db[_0xa24c('0x70')][_0xa24c('0x71')](function(_0x409f10){return _0x4b4f88[_0xa24c('0x72')](_0x4c7ca1,{'transaction':_0x409f10})[_0xa24c('0x27')](function(){return BPromise['each'](_0x475526,function(_0x1927c2){return db[_0xa24c('0x5c')][_0xa24c('0x73')]({'where':{'UserId':_0x1927c2['id'],'SmsQueueId':_0x32b835[_0xa24c('0x49')]['id']},'transaction':_0x409f10});});})[_0xa24c('0x27')](function(){_0x475526[_0xa24c('0x74')](function(_0x4bec32){socket[_0xa24c('0x75')](_0xa24c('0x76'),{'UserId':_0x4bec32['id'],'SmsQueueId':_0x4b4f88['id']});});});});});}})[_0xa24c('0x27')](respondWithStatusCode(_0x2915f1,null))['catch'](handleError(_0x2915f1,null));};exports[_0xa24c('0x77')]=function(_0x48edc9,_0x2c52fc,_0x43150f){return db[_0xa24c('0x68')]['findAll']({'where':{'id':_0x48edc9[_0xa24c('0x34')][_0xa24c('0x78')]},'attributes':['id'],'include':[{'model':db[_0xa24c('0x5e')],'as':_0xa24c('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xa24c('0x27')](handleEntityNotFound(_0x2c52fc,null))[_0xa24c('0x27')](function(_0x3c364d){var _0x2813cc=_[_0xa24c('0x2e')](_0x3c364d,'id');var _0x230bba=[];var _0x2e95cb=[];var _0x2f89cc=squel['select']();_0x2f89cc[_0xa24c('0x79')](_0xa24c('0x7a'))[_0xa24c('0x7b')](_0xa24c('0x7c'),'tq')[_0xa24c('0x7d')]('user_has_teams','ut',_0xa24c('0x7e'))['where'](_0xa24c('0x7f'),_0x48edc9[_0xa24c('0x49')]['id']);for(var _0x3d5949=0x0;_0x3d5949<_0x3c364d['length'];_0x3d5949+=0x1){let _0x1eb531=_0x3c364d[_0x3d5949];for(var _0x4f033b=0x0;_0x4f033b<_0x1eb531[_0xa24c('0x6b')][_0xa24c('0x4b')];_0x4f033b+=0x1){let _0x1e469d=_0x1eb531['Agents'][_0x4f033b];var _0x31b6f9=_0x2f89cc[_0xa24c('0x80')]();_0x31b6f9['where'](_0xa24c('0x81'),_0x1e469d['id']);_0x2e95cb[_0xa24c('0x82')](db[_0xa24c('0x70')][_0xa24c('0x34')](_0x31b6f9[_0xa24c('0x83')](),{'type':db[_0xa24c('0x70')][_0xa24c('0x84')][_0xa24c('0x85')]})[_0xa24c('0x27')](function(_0x2f3c06){if(_0x2f3c06[_0xa24c('0x4b')]===0x1){return _0x1e469d['id'];}else{var _0x2cffcd=_['every'](_[_0xa24c('0x2e')](_0x2f3c06,_0xa24c('0x86')),function(_0x2d3953){return _['includes'](_0x2813cc,_0x2d3953);});if(_0x2cffcd){return _0x1e469d['id'];}}}));}}return BPromise[_0xa24c('0x87')](_0x2e95cb)[_0xa24c('0x27')](function(_0xcbebc5){_0x230bba=_(_0x230bba)['union'](_0xcbebc5)[_0xa24c('0x88')]()[_0xa24c('0x89')]();return db[_0xa24c('0x2f')][_0xa24c('0x4d')]({'where':{'id':_0x48edc9[_0xa24c('0x49')]['id']}})[_0xa24c('0x27')](function(_0x5a1c2e){return db[_0xa24c('0x70')][_0xa24c('0x71')](function(_0xb4b74e){return _0x5a1c2e[_0xa24c('0x77')](_0x48edc9[_0xa24c('0x34')]['ids'],{'transaction':_0xb4b74e})[_0xa24c('0x27')](function(){if(!_[_0xa24c('0x8a')](_0x230bba)){return _0x5a1c2e[_0xa24c('0x8b')](_0x230bba,{'transaction':_0xb4b74e});}})[_0xa24c('0x27')](function(){_0x230bba[_0xa24c('0x74')](function(_0x494225){socket['emit'](_0xa24c('0x8c'),{'UserId':_0x494225,'SmsQueueId':_0x5a1c2e['id']});});});});});});})[_0xa24c('0x27')](respondWithStatusCode(_0x2c52fc,null))['catch'](handleError(_0x2c52fc,null));};exports[_0xa24c('0x8d')]=function(_0x25725d,_0x19a9d8,_0x39bfc5){return db['SmsQueue'][_0xa24c('0x4d')]({'where':{'id':_0x25725d[_0xa24c('0x49')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x19a9d8,null))[_0xa24c('0x27')](function(_0x4a5fcd){if(_0x4a5fcd){return _0x4a5fcd['addAgents'](_0x25725d[_0xa24c('0x4f')][_0xa24c('0x78')],_[_0xa24c('0x8e')](_0x25725d[_0xa24c('0x4f')],['ids','id'])||{})[_0xa24c('0x8f')](function(_0x16f089){for(var _0x3b6a05=0x0;_0x3b6a05<_0x25725d[_0xa24c('0x4f')][_0xa24c('0x78')][_0xa24c('0x4b')];_0x3b6a05+=0x1){socket[_0xa24c('0x75')](_0xa24c('0x76'),{'UserId':_0x25725d[_0xa24c('0x4f')][_0xa24c('0x78')][_0x3b6a05],'SmsQueueId':_0x25725d[_0xa24c('0x49')]['id']});}return _0x16f089;});}})[_0xa24c('0x27')](respondWithResult(_0x19a9d8,null))[_0xa24c('0x47')](handleError(_0x19a9d8,null));};exports['removeAgents']=function(_0x4538e6,_0x3bf62c,_0x2a3d0b){return db[_0xa24c('0x2f')][_0xa24c('0x4d')]({'where':{'id':_0x4538e6['params']['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x3bf62c,null))[_0xa24c('0x27')](function(_0x598d8e){if(_0x598d8e){return _0x598d8e['removeAgents'](_0x4538e6['query'][_0xa24c('0x78')])['then'](function(){if(_[_0xa24c('0x90')](_0x4538e6[_0xa24c('0x34')]['ids'])){for(var _0x30e24d=0x0;_0x30e24d<_0x4538e6[_0xa24c('0x34')]['ids']['length'];_0x30e24d+=0x1){socket[_0xa24c('0x75')](_0xa24c('0x8c'),{'UserId':Number(_0x4538e6[_0xa24c('0x34')][_0xa24c('0x78')][_0x30e24d]),'SmsQueueId':Number(_0x4538e6['params']['id'])});}}else{socket[_0xa24c('0x75')](_0xa24c('0x8c'),{'UserId':Number(_0x4538e6['query'][_0xa24c('0x78')]),'SmsQueueId':Number(_0x4538e6[_0xa24c('0x49')]['id'])});}});}})[_0xa24c('0x27')](respondWithStatusCode(_0x3bf62c,null))[_0xa24c('0x47')](handleError(_0x3bf62c,null));};exports[_0xa24c('0x91')]=function(_0x2bafac,_0x43e01a,_0x4e4788){var _0x55c670={};var _0x1e3114={};var _0x3bf57c;var _0x5c2235;return db['SmsQueue'][_0xa24c('0x5b')]({'where':{'id':_0x2bafac[_0xa24c('0x49')]['id']}})[_0xa24c('0x27')](handleEntityNotFound(_0x43e01a,null))['then'](function(_0x469d56){if(_0x469d56){_0x3bf57c=_0x469d56;_0x1e3114[_0xa24c('0x33')]=_[_0xa24c('0x35')](db[_0xa24c('0x5e')][_0xa24c('0x4a')]);_0x1e3114[_0xa24c('0x34')]=_[_0xa24c('0x35')](_0x2bafac[_0xa24c('0x34')]);_0x1e3114['filters']=_['intersection'](_0x1e3114[_0xa24c('0x33')],_0x1e3114[_0xa24c('0x34')]);_0x55c670['attributes']=_['intersection'](_0x1e3114[_0xa24c('0x33')],qs[_0xa24c('0x37')](_0x2bafac[_0xa24c('0x34')][_0xa24c('0x37')]));_0x55c670[_0xa24c('0x38')]=_0x55c670[_0xa24c('0x38')][_0xa24c('0x4b')]?_0x55c670[_0xa24c('0x38')]:_0x1e3114['model'];_0x55c670[_0xa24c('0x3c')]=qs[_0xa24c('0x3d')](_0x2bafac[_0xa24c('0x34')][_0xa24c('0x3d')]);_0x55c670[_0xa24c('0x3e')]=qs[_0xa24c('0x3f')](_[_0xa24c('0x69')](_0x2bafac[_0xa24c('0x34')],_0x1e3114[_0xa24c('0x3f')]));if(_0x2bafac[_0xa24c('0x34')][_0xa24c('0x40')]){_0x55c670[_0xa24c('0x3e')]=_[_0xa24c('0x41')](_0x55c670[_0xa24c('0x3e')],{'$or':_[_0xa24c('0x2e')](_0x55c670[_0xa24c('0x38')],function(_0x5eb0fa){var _0x5af5e4={};_0x5af5e4[_0x5eb0fa]={'$like':'%'+_0x2bafac[_0xa24c('0x34')][_0xa24c('0x40')]+'%'};return _0x5af5e4;})});}_0x55c670=_[_0xa24c('0x41')]({},_0x55c670,_0x2bafac[_0xa24c('0x43')]);return _0x3bf57c[_0xa24c('0x91')](_0x55c670);}})[_0xa24c('0x27')](function(_0x2d47ca){if(_0x2d47ca){_0x5c2235=_0x2d47ca['length'];if(!_0x2bafac['query']['hasOwnProperty']('nolimit')){_0x55c670['limit']=qs[_0xa24c('0x3b')](_0x2bafac[_0xa24c('0x34')][_0xa24c('0x3b')]);_0x55c670[_0xa24c('0x20')]=qs[_0xa24c('0x20')](_0x2bafac[_0xa24c('0x34')][_0xa24c('0x20')]);}return _0x3bf57c['getAgents'](_0x55c670);}})[_0xa24c('0x27')](function(_0x54ba90){if(_0x54ba90){return _0x54ba90?{'count':_0x5c2235,'rows':_0x54ba90}:null;}})[_0xa24c('0x27')](respondWithResult(_0x43e01a,null))[_0xa24c('0x47')](handleError(_0x43e01a,null));}; \ No newline at end of file +var _0x5075=['socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','SmsQueue','includeAll','include','findAll','rows','catch','show','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','UserSmsQueue','nolimit','SmsQueueId','User','findAndCountAll','UserId','updatedAt','createdAt','format','SIP','smsPause','getTeams','findOne','Team','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','QueryTypes','SELECT','TeamId','includes','compact','value','removeTeams','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','userSmsQueue:save','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost'];(function(_0x382c73,_0x21f557){var _0xaebd4d=function(_0x5b5804){while(--_0x5b5804){_0x382c73['push'](_0x382c73['shift']());}};_0xaebd4d(++_0x21f557);}(_0x5075,0x73));var _0x5507=function(_0x21595e,_0x554025){_0x21595e=_0x21595e-0x0;var _0x13a181=_0x5075[_0x21595e];return _0x13a181;};'use strict';var pdf=require(_0x5507('0x0'));var emlformat=require(_0x5507('0x1'));var rimraf=require(_0x5507('0x2'));var zipdir=require(_0x5507('0x3'));var jsonpatch=require(_0x5507('0x4'));var rp=require(_0x5507('0x5'));var moment=require(_0x5507('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x5507('0x7'));var util=require(_0x5507('0x8'));var path=require(_0x5507('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5507('0xa'));var fs=require('fs');var _=require(_0x5507('0xb'));var squel=require('squel');var crypto=require(_0x5507('0xc'));var jsforce=require(_0x5507('0xd'));var deskjs=require(_0x5507('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5507('0xf'));var Redis=require(_0x5507('0x10'));var authService=require(_0x5507('0x11'));var qs=require(_0x5507('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5507('0x13'));var logger=require(_0x5507('0x14'))('api');var utils=require(_0x5507('0x15'));var config=require(_0x5507('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5507('0x17'))['db'];config[_0x5507('0x18')]=_[_0x5507('0x19')](config[_0x5507('0x18')],{'host':_0x5507('0x1a'),'port':0x18eb});var socket=require(_0x5507('0x1b'))(new Redis(config['redis']));require(_0x5507('0x1c'))[_0x5507('0x1d')](socket);function respondWithStatusCode(_0xc828e5,_0x46545d){_0x46545d=_0x46545d||0xcc;return function(_0x4df473){if(_0x4df473){return _0xc828e5[_0x5507('0x1e')](_0x46545d);}return _0xc828e5[_0x5507('0x1f')](_0x46545d)[_0x5507('0x20')]();};}function respondWithResult(_0x1ab167,_0xa6e4b3){_0xa6e4b3=_0xa6e4b3||0xc8;return function(_0x2ede34){if(_0x2ede34){return _0x1ab167[_0x5507('0x1f')](_0xa6e4b3)[_0x5507('0x21')](_0x2ede34);}};}function respondWithFilteredResult(_0x3d1619,_0x2f0c7d){return function(_0x233b6a){if(_0x233b6a){var _0x2260f7=_0x233b6a[_0x5507('0x22')],_0x3822dd=_0x2f0c7d[_0x5507('0x23')],_0x5ad6d7=_0x2f0c7d[_0x5507('0x23')]+_0x2f0c7d['limit'],_0x14dab0;if(_0x5ad6d7>=_0x2260f7){_0x5ad6d7=_0x2260f7;_0x14dab0=0xc8;}else{_0x14dab0=0xce;}_0x3d1619[_0x5507('0x1f')](_0x14dab0);return _0x3d1619[_0x5507('0x24')](_0x5507('0x25'),_0x3822dd+'-'+_0x5ad6d7+'/'+_0x2260f7)[_0x5507('0x21')](_0x233b6a);}return null;};}function patchUpdates(_0x68397c){return function(_0x1be8b1){try{jsonpatch['apply'](_0x1be8b1,_0x68397c,!![]);}catch(_0x475970){return BPromise[_0x5507('0x26')](_0x475970);}return _0x1be8b1[_0x5507('0x27')]();};}function saveUpdates(_0xa3e2cf,_0x141d22){return function(_0x2de482){if(_0x2de482){return _0x2de482[_0x5507('0x28')](_0xa3e2cf)[_0x5507('0x29')](function(_0x398911){return _0x398911;});}return null;};}function removeEntity(_0xa47641,_0xc9a266){return function(_0x414e74){if(_0x414e74){return _0x414e74[_0x5507('0x2a')]()[_0x5507('0x29')](function(){var _0x1a2203=_0x414e74['get']({'plain':!![]});var _0x4e8906='SmsQueues';return db[_0x5507('0x2b')]['destroy']({'where':{'type':_0x4e8906,'resourceId':_0x1a2203['id']}})[_0x5507('0x29')](function(){return _0x414e74;});})[_0x5507('0x29')](function(){_0xa47641['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xbe8d32,_0x1a18d0){return function(_0x5912d4){if(!_0x5912d4){_0xbe8d32[_0x5507('0x1e')](0x194);}return _0x5912d4;};}function handleError(_0x24574b,_0x85d383){_0x85d383=_0x85d383||0x1f4;return function(_0x38f4d9){logger[_0x5507('0x2c')](_0x38f4d9[_0x5507('0x2d')]);if(_0x38f4d9['name']){delete _0x38f4d9[_0x5507('0x2e')];}_0x24574b[_0x5507('0x1f')](_0x85d383)[_0x5507('0x2f')](_0x38f4d9);};}exports[_0x5507('0x30')]=function(_0x29dd58,_0x495bbe){var _0x51e692={},_0x3b09be={},_0x37c364={'count':0x0,'rows':[]};var _0x993b07=_[_0x5507('0x31')](db['SmsQueue'][_0x5507('0x32')],function(_0x13b6e5){return{'name':_0x13b6e5[_0x5507('0x33')],'type':_0x13b6e5[_0x5507('0x34')][_0x5507('0x35')]};});_0x3b09be[_0x5507('0x36')]=_[_0x5507('0x31')](_0x993b07,_0x5507('0x2e'));_0x3b09be['query']=_[_0x5507('0x37')](_0x29dd58[_0x5507('0x38')]);_0x3b09be[_0x5507('0x39')]=_['intersection'](_0x3b09be['model'],_0x3b09be[_0x5507('0x38')]);_0x51e692[_0x5507('0x3a')]=_[_0x5507('0x3b')](_0x3b09be[_0x5507('0x36')],qs[_0x5507('0x3c')](_0x29dd58['query']['fields']));_0x51e692[_0x5507('0x3a')]=_0x51e692[_0x5507('0x3a')][_0x5507('0x3d')]?_0x51e692[_0x5507('0x3a')]:_0x3b09be['model'];if(!_0x29dd58['query'][_0x5507('0x3e')]('nolimit')){_0x51e692[_0x5507('0x3f')]=qs[_0x5507('0x3f')](_0x29dd58[_0x5507('0x38')][_0x5507('0x3f')]);_0x51e692[_0x5507('0x23')]=qs[_0x5507('0x23')](_0x29dd58[_0x5507('0x38')][_0x5507('0x23')]);}_0x51e692[_0x5507('0x40')]=qs[_0x5507('0x41')](_0x29dd58['query']['sort']);_0x51e692['where']=qs['filters'](_[_0x5507('0x42')](_0x29dd58[_0x5507('0x38')],_0x3b09be[_0x5507('0x39')]),_0x993b07);if(_0x29dd58[_0x5507('0x38')][_0x5507('0x43')]){_0x51e692[_0x5507('0x44')]=_[_0x5507('0x45')](_0x51e692[_0x5507('0x44')],{'$or':_[_0x5507('0x31')](_0x993b07,function(_0x84db0a){if(_0x84db0a[_0x5507('0x34')]!==_0x5507('0x46')){var _0x2db0b2={};_0x2db0b2[_0x84db0a[_0x5507('0x2e')]]={'$like':'%'+_0x29dd58['query']['filter']+'%'};return _0x2db0b2;}})});}_0x51e692=_['merge']({},_0x51e692,_0x29dd58[_0x5507('0x47')]);var _0x41283f={'where':_0x51e692[_0x5507('0x44')]};return db[_0x5507('0x48')][_0x5507('0x22')](_0x41283f)[_0x5507('0x29')](function(_0x340c4c){_0x37c364[_0x5507('0x22')]=_0x340c4c;if(_0x29dd58[_0x5507('0x38')][_0x5507('0x49')]){_0x51e692[_0x5507('0x4a')]=[{'all':!![]}];}return db[_0x5507('0x48')][_0x5507('0x4b')](_0x51e692);})[_0x5507('0x29')](function(_0x1b3006){_0x37c364[_0x5507('0x4c')]=_0x1b3006;return _0x37c364;})[_0x5507('0x29')](respondWithFilteredResult(_0x495bbe,_0x51e692))[_0x5507('0x4d')](handleError(_0x495bbe,null));};exports[_0x5507('0x4e')]=function(_0x4a8b67,_0x21f162){var _0x113f74={'raw':!![],'where':{'id':_0x4a8b67['params']['id']}},_0x4d8b2b={};_0x4d8b2b[_0x5507('0x36')]=_[_0x5507('0x37')](db[_0x5507('0x48')][_0x5507('0x32')]);_0x4d8b2b[_0x5507('0x38')]=_['keys'](_0x4a8b67[_0x5507('0x38')]);_0x4d8b2b[_0x5507('0x39')]=_[_0x5507('0x3b')](_0x4d8b2b['model'],_0x4d8b2b[_0x5507('0x38')]);_0x113f74[_0x5507('0x3a')]=_[_0x5507('0x3b')](_0x4d8b2b[_0x5507('0x36')],qs[_0x5507('0x3c')](_0x4a8b67['query'][_0x5507('0x3c')]));_0x113f74['attributes']=_0x113f74[_0x5507('0x3a')][_0x5507('0x3d')]?_0x113f74[_0x5507('0x3a')]:_0x4d8b2b[_0x5507('0x36')];if(_0x4a8b67[_0x5507('0x38')][_0x5507('0x49')]){_0x113f74[_0x5507('0x4a')]=[{'all':!![]}];}_0x113f74=_[_0x5507('0x45')]({},_0x113f74,_0x4a8b67['options']);return db[_0x5507('0x48')][_0x5507('0x4f')](_0x113f74)['then'](handleEntityNotFound(_0x21f162,null))['then'](respondWithResult(_0x21f162,null))['catch'](handleError(_0x21f162,null));};exports[_0x5507('0x50')]=function(_0x5961fd,_0x403d03){return db['SmsQueue'][_0x5507('0x50')](_0x5961fd['body'],{})['then'](function(_0x3b98ae){var _0x350c7e=_0x5961fd[_0x5507('0x51')][_0x5507('0x52')]({'plain':!![]});if(!_0x350c7e)throw new Error(_0x5507('0x53'));if(_0x350c7e[_0x5507('0x54')]==='user'){var _0x41f874=_0x3b98ae[_0x5507('0x52')]({'plain':!![]});var _0x2f795c='SmsQueues';return db[_0x5507('0x55')][_0x5507('0x4f')]({'where':{'name':_0x2f795c,'userProfileId':_0x350c7e[_0x5507('0x56')]},'raw':!![]})[_0x5507('0x29')](function(_0x300c9f){if(_0x300c9f&&_0x300c9f[_0x5507('0x57')]===0x0){return db[_0x5507('0x2b')][_0x5507('0x50')]({'name':_0x41f874[_0x5507('0x2e')],'resourceId':_0x41f874['id'],'type':_0x300c9f[_0x5507('0x2e')],'sectionId':_0x300c9f['id']},{})[_0x5507('0x29')](function(){return _0x3b98ae;});}else{return _0x3b98ae;}})['catch'](function(_0x570928){logger[_0x5507('0x2c')](_0x5507('0x58'),_0x570928);throw _0x570928;});}return _0x3b98ae;})[_0x5507('0x29')](respondWithResult(_0x403d03,0xc9))[_0x5507('0x4d')](handleError(_0x403d03,null));};exports[_0x5507('0x28')]=function(_0x10de3c,_0x18b566){if(_0x10de3c[_0x5507('0x59')]['id']){delete _0x10de3c[_0x5507('0x59')]['id'];}return db[_0x5507('0x48')][_0x5507('0x4f')]({'where':{'id':_0x10de3c[_0x5507('0x5a')]['id']}})[_0x5507('0x29')](handleEntityNotFound(_0x18b566,null))[_0x5507('0x29')](saveUpdates(_0x10de3c[_0x5507('0x59')],null))[_0x5507('0x29')](respondWithResult(_0x18b566,null))['catch'](handleError(_0x18b566,null));};exports[_0x5507('0x2a')]=function(_0x56e0cd,_0x5af5f5){return db[_0x5507('0x48')][_0x5507('0x4f')]({'where':{'id':_0x56e0cd[_0x5507('0x5a')]['id']}})[_0x5507('0x29')](handleEntityNotFound(_0x5af5f5,null))['then'](removeEntity(_0x5af5f5,null))[_0x5507('0x4d')](handleError(_0x5af5f5,null));};exports[_0x5507('0x5b')]=function(_0x314d4e,_0x34276a){return db[_0x5507('0x48')][_0x5507('0x5b')]()['then'](respondWithResult(_0x34276a,null))[_0x5507('0x4d')](handleError(_0x34276a,null));};exports[_0x5507('0x5c')]=function(_0x3a2f9f,_0x4e9801,_0x5ac5d7){var _0x3dd666={'raw':!![],'where':{}},_0x49eed9={},_0x208fc4;return db[_0x5507('0x48')]['findOne']({'where':{'id':_0x3a2f9f[_0x5507('0x5a')]['id']}})[_0x5507('0x29')](handleEntityNotFound(_0x4e9801,null))[_0x5507('0x29')](function(_0x80a954){if(_0x80a954){_0x208fc4=_0x80a954[_0x5507('0x52')]({'plain':!![]});_0x49eed9[_0x5507('0x36')]=_[_0x5507('0x37')](db[_0x5507('0x5d')][_0x5507('0x32')]);_0x49eed9[_0x5507('0x38')]=_[_0x5507('0x37')](_0x3a2f9f[_0x5507('0x38')]);_0x49eed9['filters']=_[_0x5507('0x3b')](_0x49eed9[_0x5507('0x36')],_0x49eed9[_0x5507('0x38')]);_0x3dd666[_0x5507('0x3a')]=_[_0x5507('0x3b')](_0x49eed9['model'],qs[_0x5507('0x3c')](_0x3a2f9f['query'][_0x5507('0x3c')]));_0x3dd666[_0x5507('0x3a')]=_0x3dd666[_0x5507('0x3a')]['length']?_0x3dd666[_0x5507('0x3a')]:_0x49eed9[_0x5507('0x36')];if(!_0x3a2f9f[_0x5507('0x38')]['hasOwnProperty'](_0x5507('0x5e'))){_0x3dd666['limit']=qs[_0x5507('0x3f')](_0x3a2f9f['query']['limit']);_0x3dd666[_0x5507('0x23')]=qs[_0x5507('0x23')](_0x3a2f9f[_0x5507('0x38')][_0x5507('0x23')]);}_0x3dd666[_0x5507('0x40')]=qs[_0x5507('0x41')](_0x3a2f9f['query']['sort']);_0x3dd666[_0x5507('0x44')]=qs[_0x5507('0x39')](_[_0x5507('0x42')](_0x3a2f9f[_0x5507('0x38')],_0x49eed9['filters']));_0x3dd666[_0x5507('0x44')][_0x5507('0x5f')]=_0x80a954['id'];if(_0x3a2f9f[_0x5507('0x38')][_0x5507('0x43')]){_0x3dd666[_0x5507('0x44')]=_[_0x5507('0x45')](_0x3dd666[_0x5507('0x44')],{'$or':_['map'](_0x3dd666[_0x5507('0x3a')],function(_0xfdbbe5){var _0x327a63={};_0x327a63[_0xfdbbe5]={'$like':'%'+_0x3a2f9f['query'][_0x5507('0x43')]+'%'};return _0x327a63;})});}_0x3dd666=_['merge']({},_0x3dd666,_0x3a2f9f['options']);return db['UserSmsQueue'][_0x5507('0x4b')](_0x3dd666);}})[_0x5507('0x29')](function(_0xb622bd){if(_0xb622bd){return db[_0x5507('0x60')][_0x5507('0x61')]({'where':{'id':_[_0x5507('0x31')](_0xb622bd,_0x5507('0x62')),'role':'agent'},'attributes':['id',_0x5507('0x2e'),'smsPause',_0x5507('0x63'),_0x5507('0x64')]});}})[_0x5507('0x29')](function(_0x98768c){if(_0x98768c){return{'count':_0x98768c[_0x5507('0x22')],'rows':_[_0x5507('0x31')](_0x98768c[_0x5507('0x4c')],function(_0x31e68e){return{'membername':_0x31e68e[_0x5507('0x2e')],'UserId':_0x31e68e['id'],'queue_name':_0x208fc4[_0x5507('0x2e')],'SmsQueueId':_0x208fc4['id'],'interface':util[_0x5507('0x65')]('%s/%s',_0x5507('0x66'),_0x31e68e[_0x5507('0x2e')]),'penalty':0x0,'paused':_0x31e68e[_0x5507('0x67')],'createdAt':_0x31e68e['createdAt'],'updatedAt':_0x31e68e[_0x5507('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5507('0x29')](respondWithFilteredResult(_0x4e9801,_0x3dd666))['catch'](handleError(_0x4e9801,null));};exports[_0x5507('0x68')]=function(_0x5815fb,_0x5c0c7a,_0x38b857){var _0x5ecf7c={};var _0xb92deb={};var _0x43edf7;var _0xfb59be;return db[_0x5507('0x48')][_0x5507('0x69')]({'where':{'id':_0x5815fb[_0x5507('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5c0c7a,null))[_0x5507('0x29')](function(_0x323dbf){if(_0x323dbf){_0x43edf7=_0x323dbf;_0xb92deb[_0x5507('0x36')]=_[_0x5507('0x37')](db[_0x5507('0x6a')][_0x5507('0x32')]);_0xb92deb[_0x5507('0x38')]=_[_0x5507('0x37')](_0x5815fb[_0x5507('0x38')]);_0xb92deb[_0x5507('0x39')]=_[_0x5507('0x3b')](_0xb92deb[_0x5507('0x36')],_0xb92deb['query']);_0x5ecf7c[_0x5507('0x3a')]=_[_0x5507('0x3b')](_0xb92deb[_0x5507('0x36')],qs[_0x5507('0x3c')](_0x5815fb[_0x5507('0x38')][_0x5507('0x3c')]));_0x5ecf7c['attributes']=_0x5ecf7c[_0x5507('0x3a')]['length']?_0x5ecf7c[_0x5507('0x3a')]:_0xb92deb['model'];_0x5ecf7c['order']=qs[_0x5507('0x41')](_0x5815fb[_0x5507('0x38')][_0x5507('0x41')]);_0x5ecf7c[_0x5507('0x44')]=qs[_0x5507('0x39')](_['pick'](_0x5815fb[_0x5507('0x38')],_0xb92deb['filters']));if(_0x5815fb[_0x5507('0x38')][_0x5507('0x43')]){_0x5ecf7c[_0x5507('0x44')]=_[_0x5507('0x45')](_0x5ecf7c['where'],{'$or':_[_0x5507('0x31')](_0x5ecf7c[_0x5507('0x3a')],function(_0x42bef4){var _0x5a8a1b={};_0x5a8a1b[_0x42bef4]={'$like':'%'+_0x5815fb['query'][_0x5507('0x43')]+'%'};return _0x5a8a1b;})});}_0x5ecf7c=_[_0x5507('0x45')]({},_0x5ecf7c,_0x5815fb[_0x5507('0x47')]);return _0x43edf7[_0x5507('0x68')](_0x5ecf7c);}})[_0x5507('0x29')](function(_0x26f796){if(_0x26f796){_0xfb59be=_0x26f796[_0x5507('0x3d')];if(!_0x5815fb[_0x5507('0x38')][_0x5507('0x3e')](_0x5507('0x5e'))){_0x5ecf7c[_0x5507('0x3f')]=qs[_0x5507('0x3f')](_0x5815fb['query'][_0x5507('0x3f')]);_0x5ecf7c[_0x5507('0x23')]=qs[_0x5507('0x23')](_0x5815fb[_0x5507('0x38')][_0x5507('0x23')]);}return _0x43edf7[_0x5507('0x68')](_0x5ecf7c);}})[_0x5507('0x29')](function(_0x5c0ff7){if(_0x5c0ff7){return _0x5c0ff7?{'count':_0xfb59be,'rows':_0x5c0ff7}:null;}})[_0x5507('0x29')](respondWithResult(_0x5c0c7a,null))[_0x5507('0x4d')](handleError(_0x5c0c7a,null));};exports[_0x5507('0x6b')]=function(_0x22cc0b,_0x536215,_0x38e8b7){var _0x3e8beb=_0x22cc0b[_0x5507('0x59')][_0x5507('0x6c')];return db[_0x5507('0x6a')][_0x5507('0x4b')]({'where':{'id':_0x3e8beb},'attributes':['id'],'include':[{'model':db[_0x5507('0x60')],'as':'Agents','attributes':['id',_0x5507('0x2e'),_0x5507('0x6d'),_0x5507('0x6e'),_0x5507('0x6f')],'raw':!![]}]})[_0x5507('0x29')](function(_0x5cf4ba){if(_0x5cf4ba){var _0xaefb37=_[_0x5507('0x70')](_0x5cf4ba,function(_0x1d97ca){var _0x334d7d=_0x1d97ca[_0x5507('0x52')]({'plain':!![]});return _0x334d7d[_0x5507('0x71')];});return db[_0x5507('0x48')][_0x5507('0x4f')]({'where':{'id':_0x22cc0b[_0x5507('0x5a')]['id']}})[_0x5507('0x29')](function(_0x315112){return db[_0x5507('0x72')][_0x5507('0x73')](function(_0x5c6d7f){return _0x315112['addTeams'](_0x3e8beb,{'transaction':_0x5c6d7f})['then'](function(){return BPromise[_0x5507('0x74')](_0xaefb37,function(_0x2fcde8){return db[_0x5507('0x5d')][_0x5507('0x75')]({'where':{'UserId':_0x2fcde8['id'],'SmsQueueId':_0x22cc0b[_0x5507('0x5a')]['id']},'transaction':_0x5c6d7f});});})['then'](function(){_0xaefb37[_0x5507('0x76')](function(_0x35694c){socket[_0x5507('0x77')]('userSmsQueue:save',{'UserId':_0x35694c['id'],'SmsQueueId':_0x315112['id']});});});});});}})[_0x5507('0x29')](respondWithStatusCode(_0x536215,null))['catch'](handleError(_0x536215,null));};exports['removeTeams']=function(_0x1e330c,_0x58b56c,_0x495ac2){return db['Team'][_0x5507('0x4b')]({'where':{'id':_0x1e330c[_0x5507('0x38')][_0x5507('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5507('0x29')](handleEntityNotFound(_0x58b56c,null))[_0x5507('0x29')](function(_0x3fca02){var _0x51bec0=_[_0x5507('0x31')](_0x3fca02,'id');var _0x3aee0b=[];var _0x2d4c1d=[];var _0x8291cd=squel['select']();_0x8291cd['field'](_0x5507('0x78'))[_0x5507('0x79')]('team_has_sms_queues','tq')[_0x5507('0x7a')](_0x5507('0x7b'),'ut',_0x5507('0x7c'))[_0x5507('0x44')]('SmsQueueId\x20=\x20?',_0x1e330c[_0x5507('0x5a')]['id']);for(var _0x3a2b0f=0x0;_0x3a2b0f<_0x3fca02['length'];_0x3a2b0f+=0x1){let _0x29e651=_0x3fca02[_0x3a2b0f];for(var _0x1ff88e=0x0;_0x1ff88e<_0x29e651[_0x5507('0x71')]['length'];_0x1ff88e+=0x1){let _0x24168e=_0x29e651[_0x5507('0x71')][_0x1ff88e];var _0x57104b=_0x8291cd[_0x5507('0x7d')]();_0x57104b[_0x5507('0x44')]('ut.UserId\x20=\x20?',_0x24168e['id']);_0x2d4c1d[_0x5507('0x7e')](db[_0x5507('0x72')][_0x5507('0x38')](_0x57104b['toString'](),{'type':db[_0x5507('0x72')][_0x5507('0x7f')][_0x5507('0x80')]})[_0x5507('0x29')](function(_0x31286d){if(_0x31286d[_0x5507('0x3d')]===0x1){return _0x24168e['id'];}else{var _0x41413b=_['every'](_[_0x5507('0x31')](_0x31286d,_0x5507('0x81')),function(_0x2fc9aa){return _[_0x5507('0x82')](_0x51bec0,_0x2fc9aa);});if(_0x41413b){return _0x24168e['id'];}}}));}}return BPromise['all'](_0x2d4c1d)['then'](function(_0x23f6df){_0x3aee0b=_(_0x3aee0b)['union'](_0x23f6df)[_0x5507('0x83')]()[_0x5507('0x84')]();return db[_0x5507('0x48')]['find']({'where':{'id':_0x1e330c[_0x5507('0x5a')]['id']}})[_0x5507('0x29')](function(_0x4a0d09){return db[_0x5507('0x72')][_0x5507('0x73')](function(_0x3ae57e){return _0x4a0d09[_0x5507('0x85')](_0x1e330c[_0x5507('0x38')][_0x5507('0x6c')],{'transaction':_0x3ae57e})['then'](function(){if(!_[_0x5507('0x86')](_0x3aee0b)){return _0x4a0d09[_0x5507('0x87')](_0x3aee0b,{'transaction':_0x3ae57e});}})['then'](function(){_0x3aee0b[_0x5507('0x76')](function(_0x399fd1){socket[_0x5507('0x77')](_0x5507('0x88'),{'UserId':_0x399fd1,'SmsQueueId':_0x4a0d09['id']});});});});});});})[_0x5507('0x29')](respondWithStatusCode(_0x58b56c,null))[_0x5507('0x4d')](handleError(_0x58b56c,null));};exports[_0x5507('0x89')]=function(_0x1c6e3,_0x206692,_0x35fc9d){return db[_0x5507('0x48')]['find']({'where':{'id':_0x1c6e3[_0x5507('0x5a')]['id']}})['then'](handleEntityNotFound(_0x206692,null))[_0x5507('0x29')](function(_0x6cf82d){if(_0x6cf82d){return _0x6cf82d[_0x5507('0x89')](_0x1c6e3[_0x5507('0x59')][_0x5507('0x6c')],_[_0x5507('0x8a')](_0x1c6e3[_0x5507('0x59')],[_0x5507('0x6c'),'id'])||{})[_0x5507('0x8b')](function(_0xccd155){for(var _0x189fd5=0x0;_0x189fd5<_0x1c6e3[_0x5507('0x59')][_0x5507('0x6c')][_0x5507('0x3d')];_0x189fd5+=0x1){socket['emit'](_0x5507('0x8c'),{'UserId':_0x1c6e3[_0x5507('0x59')][_0x5507('0x6c')][_0x189fd5],'SmsQueueId':_0x1c6e3[_0x5507('0x5a')]['id']});}return _0xccd155;});}})[_0x5507('0x29')](respondWithResult(_0x206692,null))[_0x5507('0x4d')](handleError(_0x206692,null));};exports[_0x5507('0x87')]=function(_0x3fface,_0x5e538e,_0x3328be){return db[_0x5507('0x48')][_0x5507('0x4f')]({'where':{'id':_0x3fface[_0x5507('0x5a')]['id']}})[_0x5507('0x29')](handleEntityNotFound(_0x5e538e,null))[_0x5507('0x29')](function(_0x24e994){if(_0x24e994){return _0x24e994[_0x5507('0x87')](_0x3fface[_0x5507('0x38')][_0x5507('0x6c')])[_0x5507('0x29')](function(){if(_['isArray'](_0x3fface['query'][_0x5507('0x6c')])){for(var _0x599a13=0x0;_0x599a13<_0x3fface['query'][_0x5507('0x6c')][_0x5507('0x3d')];_0x599a13+=0x1){socket[_0x5507('0x77')](_0x5507('0x88'),{'UserId':Number(_0x3fface[_0x5507('0x38')]['ids'][_0x599a13]),'SmsQueueId':Number(_0x3fface['params']['id'])});}}else{socket[_0x5507('0x77')](_0x5507('0x88'),{'UserId':Number(_0x3fface['query'][_0x5507('0x6c')]),'SmsQueueId':Number(_0x3fface[_0x5507('0x5a')]['id'])});}});}})[_0x5507('0x29')](respondWithStatusCode(_0x5e538e,null))[_0x5507('0x4d')](handleError(_0x5e538e,null));};exports[_0x5507('0x8d')]=function(_0x37a027,_0x44f613,_0x188152){var _0x3a854e={};var _0x25f65f={};var _0x5121c8;var _0x263981;return db[_0x5507('0x48')][_0x5507('0x69')]({'where':{'id':_0x37a027['params']['id']}})[_0x5507('0x29')](handleEntityNotFound(_0x44f613,null))[_0x5507('0x29')](function(_0x10690b){if(_0x10690b){_0x5121c8=_0x10690b;_0x25f65f[_0x5507('0x36')]=_[_0x5507('0x37')](db['User'][_0x5507('0x32')]);_0x25f65f[_0x5507('0x38')]=_[_0x5507('0x37')](_0x37a027[_0x5507('0x38')]);_0x25f65f[_0x5507('0x39')]=_[_0x5507('0x3b')](_0x25f65f['model'],_0x25f65f[_0x5507('0x38')]);_0x3a854e[_0x5507('0x3a')]=_['intersection'](_0x25f65f[_0x5507('0x36')],qs['fields'](_0x37a027[_0x5507('0x38')][_0x5507('0x3c')]));_0x3a854e[_0x5507('0x3a')]=_0x3a854e['attributes'][_0x5507('0x3d')]?_0x3a854e[_0x5507('0x3a')]:_0x25f65f[_0x5507('0x36')];_0x3a854e[_0x5507('0x40')]=qs[_0x5507('0x41')](_0x37a027[_0x5507('0x38')][_0x5507('0x41')]);_0x3a854e['where']=qs[_0x5507('0x39')](_[_0x5507('0x42')](_0x37a027[_0x5507('0x38')],_0x25f65f[_0x5507('0x39')]));if(_0x37a027[_0x5507('0x38')][_0x5507('0x43')]){_0x3a854e[_0x5507('0x44')]=_['merge'](_0x3a854e[_0x5507('0x44')],{'$or':_[_0x5507('0x31')](_0x3a854e[_0x5507('0x3a')],function(_0x418626){var _0x1f2841={};_0x1f2841[_0x418626]={'$like':'%'+_0x37a027[_0x5507('0x38')][_0x5507('0x43')]+'%'};return _0x1f2841;})});}_0x3a854e=_[_0x5507('0x45')]({},_0x3a854e,_0x37a027['options']);return _0x5121c8[_0x5507('0x8d')](_0x3a854e);}})[_0x5507('0x29')](function(_0x48fe21){if(_0x48fe21){_0x263981=_0x48fe21['length'];if(!_0x37a027[_0x5507('0x38')]['hasOwnProperty'](_0x5507('0x5e'))){_0x3a854e[_0x5507('0x3f')]=qs[_0x5507('0x3f')](_0x37a027[_0x5507('0x38')][_0x5507('0x3f')]);_0x3a854e[_0x5507('0x23')]=qs['offset'](_0x37a027['query'][_0x5507('0x23')]);}return _0x5121c8[_0x5507('0x8d')](_0x3a854e);}})[_0x5507('0x29')](function(_0x48958e){if(_0x48958e){return _0x48958e?{'count':_0x263981,'rows':_0x48958e}:null;}})[_0x5507('0x29')](respondWithResult(_0x44f613,null))[_0x5507('0x4d')](handleError(_0x44f613,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index ef63579..326238b 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 _0x23bd=['SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x42f298,_0x34bb28){var _0x3c3f82=function(_0x35782e){while(--_0x35782e){_0x42f298['push'](_0x42f298['shift']());}};_0x3c3f82(++_0x34bb28);}(_0x23bd,0x1a0));var _0xd23b=function(_0x18593c,_0x448b00){_0x18593c=_0x18593c-0x0;var _0x4f7799=_0x23bd[_0x18593c];return _0x4f7799;};'use strict';var EventEmitter=require(_0xd23b('0x0'));var SmsQueue=require(_0xd23b('0x1'))['db'][_0xd23b('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xd23b('0x3')](0x0);var events={'afterCreate':_0xd23b('0x4'),'afterUpdate':_0xd23b('0x5'),'afterDestroy':_0xd23b('0x6')};function emitEvent(_0xe49824){return function(_0x28c648,_0x55535d,_0x50a114){SmsQueueEvents[_0xd23b('0x7')](_0xe49824+':'+_0x28c648['id'],_0x28c648);SmsQueueEvents[_0xd23b('0x7')](_0xe49824,_0x28c648);_0x50a114(null);};}for(var e in events){if(events[_0xd23b('0x8')](e)){var event=events[e];SmsQueue[_0xd23b('0x9')](e,emitEvent(event));}}module[_0xd23b('0xa')]=SmsQueueEvents; \ No newline at end of file +var _0xb927=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsQueue'];(function(_0x272638,_0x42b993){var _0x19d027=function(_0x27ac44){while(--_0x27ac44){_0x272638['push'](_0x272638['shift']());}};_0x19d027(++_0x42b993);}(_0xb927,0xa9));var _0x7b92=function(_0x317435,_0x2c98cc){_0x317435=_0x317435-0x0;var _0x515609=_0xb927[_0x317435];return _0x515609;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0x7b92('0x0'))['db'][_0x7b92('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x7b92('0x2')](0x0);var events={'afterCreate':_0x7b92('0x3'),'afterUpdate':_0x7b92('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1942d6){return function(_0x2abe5e,_0x2dc30c,_0x3737e9){SmsQueueEvents[_0x7b92('0x5')](_0x1942d6+':'+_0x2abe5e['id'],_0x2abe5e);SmsQueueEvents[_0x7b92('0x5')](_0x1942d6,_0x2abe5e);_0x3737e9(null);};}for(var e in events){if(events[_0x7b92('0x6')](e)){var event=events[e];SmsQueue[_0x7b92('0x7')](e,emitEvent(event));}}module[_0x7b92('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 5b6db03..33ae0eb 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 _0x8dbd=['request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','api','moment','bluebird'];(function(_0x2c227b,_0x2ff5ee){var _0x30410b=function(_0x140dc8){while(--_0x140dc8){_0x2c227b['push'](_0x2c227b['shift']());}};_0x30410b(++_0x2ff5ee);}(_0x8dbd,0x159));var _0xd8db=function(_0x33ca86,_0x5ce8cf){_0x33ca86=_0x33ca86-0x0;var _0x5135ae=_0x8dbd[_0x33ca86];return _0x5135ae;};'use strict';var _=require(_0xd8db('0x0'));var util=require(_0xd8db('0x1'));var logger=require('../../config/logger')(_0xd8db('0x2'));var moment=require(_0xd8db('0x3'));var BPromise=require(_0xd8db('0x4'));var rp=require(_0xd8db('0x5'));var fs=require('fs');var path=require(_0xd8db('0x6'));var rimraf=require(_0xd8db('0x7'));var config=require(_0xd8db('0x8'));var attributes=require(_0xd8db('0x9'));module[_0xd8db('0xa')]=function(_0xa587d2,_0x12ada1){return _0xa587d2[_0xd8db('0xb')](_0xd8db('0xc'),attributes,{'tableName':_0xd8db('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd7fb=['define','SmsQueue','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueue.attributes','exports'];(function(_0x1bc019,_0x3b33ec){var _0x4dc25f=function(_0x18168c){while(--_0x18168c){_0x1bc019['push'](_0x1bc019['shift']());}};_0x4dc25f(++_0x3b33ec);}(_0xd7fb,0x1a0));var _0xbd7f=function(_0x41d900,_0xa0273e){_0x41d900=_0x41d900-0x0;var _0x5b1f6d=_0xd7fb[_0x41d900];return _0x5b1f6d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbd7f('0x0'))('api');var moment=require('moment');var BPromise=require(_0xbd7f('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd7f('0x2'));var rimraf=require(_0xbd7f('0x3'));var config=require(_0xbd7f('0x4'));var attributes=require(_0xbd7f('0x5'));module[_0xbd7f('0x6')]=function(_0x2bf28f,_0xa464dc){return _0x2bf28f[_0xbd7f('0x7')](_0xbd7f('0x8'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index dde641c..098965b 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 _0x9ab8=['request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetSmsQueue','findAll','options','where','limit','include','map','model','attributes','info','ShowSmsQueue','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket'];(function(_0x4ec485,_0x3c71d9){var _0x35f970=function(_0x478c89){while(--_0x478c89){_0x4ec485['push'](_0x4ec485['shift']());}};_0x35f970(++_0x3c71d9);}(_0x9ab8,0xd4));var _0x89ab=function(_0x501d4e,_0x17399d){_0x501d4e=_0x501d4e-0x0;var _0x4a6897=_0x9ab8[_0x501d4e];return _0x4a6897;};'use strict';var _=require(_0x89ab('0x0'));var util=require(_0x89ab('0x1'));var moment=require('moment');var BPromise=require(_0x89ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89ab('0x3'));var db=require(_0x89ab('0x4'))['db'];var utils=require(_0x89ab('0x5'));var logger=require(_0x89ab('0x6'))(_0x89ab('0x7'));var config=require(_0x89ab('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x89ab('0x9')][_0x89ab('0xa')]({'port':0x232a});config[_0x89ab('0xb')]=_[_0x89ab('0xc')](config['redis'],{'host':_0x89ab('0xd'),'port':0x18eb});var socket=require(_0x89ab('0xe'))(new Redis(config['redis']));require(_0x89ab('0xf'))['register'](socket);function respondWithRpcPromise(_0x21f97e,_0x55a27e,_0xa459c7){return new BPromise(function(_0x144405,_0x4fe91a){return client[_0x89ab('0x10')](_0x21f97e,_0xa459c7)[_0x89ab('0x11')](function(_0x160144){logger['info'](_0x89ab('0x12'),_0x55a27e,_0x89ab('0x13'));logger[_0x89ab('0x14')](_0x89ab('0x15'),_0x55a27e,_0x89ab('0x13'),JSON['stringify'](_0x160144));if(_0x160144[_0x89ab('0x16')]){if(_0x160144['error']['code']===0x1f4){logger[_0x89ab('0x16')](_0x89ab('0x12'),_0x55a27e,_0x160144[_0x89ab('0x16')]['message']);return _0x4fe91a(_0x160144[_0x89ab('0x16')]['message']);}logger[_0x89ab('0x16')](_0x89ab('0x12'),_0x55a27e,_0x160144[_0x89ab('0x16')]['message']);return _0x144405(_0x160144[_0x89ab('0x16')][_0x89ab('0x17')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x55a27e,_0x89ab('0x13'));_0x144405(_0x160144[_0x89ab('0x18')]['message']);}})[_0x89ab('0x19')](function(_0x446ae7){logger[_0x89ab('0x16')](_0x89ab('0x12'),_0x55a27e,_0x446ae7);_0x4fe91a(_0x446ae7);});});}exports[_0x89ab('0x1a')]=function(_0x982530){var _0x34da91=this;return new Promise(function(_0x27c7ef,_0x5d1c93){return db['SmsQueue'][_0x89ab('0x1b')]({'raw':_0x982530[_0x89ab('0x1c')]?_0x982530[_0x89ab('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x982530[_0x89ab('0x1c')]?_0x982530['options'][_0x89ab('0x1d')]||null:null,'attributes':_0x982530[_0x89ab('0x1c')]?_0x982530['options']['attributes']||null:null,'limit':_0x982530[_0x89ab('0x1c')]?_0x982530['options'][_0x89ab('0x1e')]||null:null,'include':_0x982530[_0x89ab('0x1c')]?_0x982530['options'][_0x89ab('0x1f')]?_[_0x89ab('0x20')](_0x982530['options'][_0x89ab('0x1f')],function(_0x5a16b6){return{'model':db[_0x5a16b6['model']],'as':_0x5a16b6['as'],'attributes':_0x5a16b6['attributes'],'include':_0x5a16b6[_0x89ab('0x1f')]?_['map'](_0x5a16b6['include'],function(_0xc45b73){return{'model':db[_0xc45b73[_0x89ab('0x21')]],'as':_0xc45b73['as'],'attributes':_0xc45b73[_0x89ab('0x22')],'include':_0xc45b73[_0x89ab('0x1f')]?_['map'](_0xc45b73[_0x89ab('0x1f')],function(_0x106409){return{'model':db[_0x106409[_0x89ab('0x21')]],'as':_0x106409['as'],'attributes':_0x106409[_0x89ab('0x22')]};}):[]};}):[]};}):[]:[]})[_0x89ab('0x11')](function(_0x35d4ce){logger[_0x89ab('0x23')](_0x89ab('0x1a'),_0x982530);logger[_0x89ab('0x14')](_0x89ab('0x1a'),_0x982530,JSON['stringify'](_0x35d4ce));_0x27c7ef(_0x35d4ce);})[_0x89ab('0x19')](function(_0x46c062){logger[_0x89ab('0x16')](_0x89ab('0x1a'),_0x46c062[_0x89ab('0x17')],_0x982530);_0x5d1c93(_0x34da91[_0x89ab('0x16')](0x1f4,_0x46c062[_0x89ab('0x17')]));});});};exports[_0x89ab('0x24')]=function(_0x31d141){var _0x4eab3e=this;return new Promise(function(_0x261a5a,_0x19847a){return db['SmsQueue']['find']({'raw':_0x31d141['options']?_0x31d141['options']['raw']===undefined?!![]:![]:!![],'where':_0x31d141[_0x89ab('0x1c')]?_0x31d141['options']['where']||null:null,'attributes':_0x31d141[_0x89ab('0x1c')]?_0x31d141[_0x89ab('0x1c')]['attributes']||null:null,'include':_0x31d141[_0x89ab('0x1c')]?_0x31d141[_0x89ab('0x1c')]['include']?_['map'](_0x31d141['options']['include'],function(_0x2d2a3f){return{'model':db[_0x2d2a3f[_0x89ab('0x21')]],'as':_0x2d2a3f['as'],'attributes':_0x2d2a3f[_0x89ab('0x22')],'include':_0x2d2a3f[_0x89ab('0x1f')]?_['map'](_0x2d2a3f[_0x89ab('0x1f')],function(_0x50e0cf){return{'model':db[_0x50e0cf[_0x89ab('0x21')]],'as':_0x50e0cf['as'],'attributes':_0x50e0cf[_0x89ab('0x22')],'include':_0x50e0cf[_0x89ab('0x1f')]?_[_0x89ab('0x20')](_0x50e0cf[_0x89ab('0x1f')],function(_0xcc0c6a){return{'model':db[_0xcc0c6a[_0x89ab('0x21')]],'as':_0xcc0c6a['as'],'attributes':_0xcc0c6a[_0x89ab('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4fe7db){logger['info'](_0x89ab('0x24'),_0x31d141);logger[_0x89ab('0x14')](_0x89ab('0x24'),_0x31d141,JSON[_0x89ab('0x25')](_0x4fe7db));_0x261a5a(_0x4fe7db);})[_0x89ab('0x19')](function(_0x54e5f7){logger['error'](_0x89ab('0x24'),_0x54e5f7[_0x89ab('0x17')],_0x31d141);_0x19847a(_0x4eab3e['error'](0x1f4,_0x54e5f7['message']));});});}; \ No newline at end of file +var _0x2b97=['code','message','result','catch','GetSmsQueue','findAll','options','where','attributes','limit','include','model','stringify','ShowSmsQueue','SmsQueue','find','raw','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','debug','request\x20sent','error'];(function(_0x379b94,_0x3a8c18){var _0x4793ed=function(_0x4de398){while(--_0x4de398){_0x379b94['push'](_0x379b94['shift']());}};_0x4793ed(++_0x3a8c18);}(_0x2b97,0x64));var _0x72b9=function(_0x324400,_0x4de5b3){_0x324400=_0x324400-0x0;var _0x1cfed5=_0x2b97[_0x324400];return _0x1cfed5;};'use strict';var _=require(_0x72b9('0x0'));var util=require(_0x72b9('0x1'));var moment=require(_0x72b9('0x2'));var BPromise=require(_0x72b9('0x3'));var rs=require(_0x72b9('0x4'));var fs=require('fs');var Redis=require(_0x72b9('0x5'));var db=require(_0x72b9('0x6'))['db'];var utils=require(_0x72b9('0x7'));var logger=require(_0x72b9('0x8'))(_0x72b9('0x9'));var config=require(_0x72b9('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x72b9('0xb')]['http']({'port':0x232a});config[_0x72b9('0xc')]=_[_0x72b9('0xd')](config[_0x72b9('0xc')],{'host':_0x72b9('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x72b9('0xc')]));require(_0x72b9('0xf'))['register'](socket);function respondWithRpcPromise(_0x196d96,_0x37b7c5,_0x53bc50){return new BPromise(function(_0x1da4d5,_0x35d59c){return client[_0x72b9('0x10')](_0x196d96,_0x53bc50)[_0x72b9('0x11')](function(_0xdf7c24){logger[_0x72b9('0x12')](_0x72b9('0x13'),_0x37b7c5,'request\x20sent');logger[_0x72b9('0x14')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x37b7c5,_0x72b9('0x15'),JSON['stringify'](_0xdf7c24));if(_0xdf7c24[_0x72b9('0x16')]){if(_0xdf7c24[_0x72b9('0x16')][_0x72b9('0x17')]===0x1f4){logger[_0x72b9('0x16')]('SmsQueue,\x20%s,\x20%s',_0x37b7c5,_0xdf7c24[_0x72b9('0x16')]['message']);return _0x35d59c(_0xdf7c24['error'][_0x72b9('0x18')]);}logger['error'](_0x72b9('0x13'),_0x37b7c5,_0xdf7c24[_0x72b9('0x16')][_0x72b9('0x18')]);return _0x1da4d5(_0xdf7c24[_0x72b9('0x16')][_0x72b9('0x18')]);}else{logger[_0x72b9('0x12')](_0x72b9('0x13'),_0x37b7c5,_0x72b9('0x15'));_0x1da4d5(_0xdf7c24[_0x72b9('0x19')][_0x72b9('0x18')]);}})[_0x72b9('0x1a')](function(_0x220b56){logger[_0x72b9('0x16')](_0x72b9('0x13'),_0x37b7c5,_0x220b56);_0x35d59c(_0x220b56);});});}exports[_0x72b9('0x1b')]=function(_0x1af710){var _0x264113=this;return new Promise(function(_0x556d9d,_0x59c19f){return db['SmsQueue'][_0x72b9('0x1c')]({'raw':_0x1af710[_0x72b9('0x1d')]?_0x1af710[_0x72b9('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1af710[_0x72b9('0x1d')]?_0x1af710[_0x72b9('0x1d')][_0x72b9('0x1e')]||null:null,'attributes':_0x1af710[_0x72b9('0x1d')]?_0x1af710['options'][_0x72b9('0x1f')]||null:null,'limit':_0x1af710[_0x72b9('0x1d')]?_0x1af710[_0x72b9('0x1d')][_0x72b9('0x20')]||null:null,'include':_0x1af710[_0x72b9('0x1d')]?_0x1af710[_0x72b9('0x1d')]['include']?_['map'](_0x1af710[_0x72b9('0x1d')][_0x72b9('0x21')],function(_0x5276ba){return{'model':db[_0x5276ba[_0x72b9('0x22')]],'as':_0x5276ba['as'],'attributes':_0x5276ba['attributes'],'include':_0x5276ba[_0x72b9('0x21')]?_['map'](_0x5276ba[_0x72b9('0x21')],function(_0x57f00a){return{'model':db[_0x57f00a[_0x72b9('0x22')]],'as':_0x57f00a['as'],'attributes':_0x57f00a[_0x72b9('0x1f')],'include':_0x57f00a[_0x72b9('0x21')]?_['map'](_0x57f00a[_0x72b9('0x21')],function(_0x3dbad4){return{'model':db[_0x3dbad4[_0x72b9('0x22')]],'as':_0x3dbad4['as'],'attributes':_0x3dbad4['attributes']};}):[]};}):[]};}):[]:[]})[_0x72b9('0x11')](function(_0x3fa24a){logger[_0x72b9('0x12')](_0x72b9('0x1b'),_0x1af710);logger[_0x72b9('0x14')]('GetSmsQueue',_0x1af710,JSON[_0x72b9('0x23')](_0x3fa24a));_0x556d9d(_0x3fa24a);})[_0x72b9('0x1a')](function(_0x3fe62b){logger[_0x72b9('0x16')](_0x72b9('0x1b'),_0x3fe62b[_0x72b9('0x18')],_0x1af710);_0x59c19f(_0x264113['error'](0x1f4,_0x3fe62b['message']));});});};exports[_0x72b9('0x24')]=function(_0x5bb8e0){var _0x3fa0cd=this;return new Promise(function(_0x4700f2,_0x4b9286){return db[_0x72b9('0x25')][_0x72b9('0x26')]({'raw':_0x5bb8e0[_0x72b9('0x1d')]?_0x5bb8e0[_0x72b9('0x1d')][_0x72b9('0x27')]===undefined?!![]:![]:!![],'where':_0x5bb8e0[_0x72b9('0x1d')]?_0x5bb8e0[_0x72b9('0x1d')]['where']||null:null,'attributes':_0x5bb8e0[_0x72b9('0x1d')]?_0x5bb8e0[_0x72b9('0x1d')][_0x72b9('0x1f')]||null:null,'include':_0x5bb8e0['options']?_0x5bb8e0['options']['include']?_[_0x72b9('0x28')](_0x5bb8e0[_0x72b9('0x1d')]['include'],function(_0x1c5037){return{'model':db[_0x1c5037[_0x72b9('0x22')]],'as':_0x1c5037['as'],'attributes':_0x1c5037[_0x72b9('0x1f')],'include':_0x1c5037[_0x72b9('0x21')]?_[_0x72b9('0x28')](_0x1c5037[_0x72b9('0x21')],function(_0x214030){return{'model':db[_0x214030[_0x72b9('0x22')]],'as':_0x214030['as'],'attributes':_0x214030[_0x72b9('0x1f')],'include':_0x214030['include']?_[_0x72b9('0x28')](_0x214030[_0x72b9('0x21')],function(_0x1828e1){return{'model':db[_0x1828e1[_0x72b9('0x22')]],'as':_0x1828e1['as'],'attributes':_0x1828e1[_0x72b9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x72b9('0x11')](function(_0x5aae52){logger[_0x72b9('0x12')](_0x72b9('0x24'),_0x5bb8e0);logger['debug'](_0x72b9('0x24'),_0x5bb8e0,JSON[_0x72b9('0x23')](_0x5aae52));_0x4700f2(_0x5aae52);})[_0x72b9('0x1a')](function(_0x5918f9){logger[_0x72b9('0x16')](_0x72b9('0x24'),_0x5918f9['message'],_0x5bb8e0);_0x4b9286(_0x3fa0cd['error'](0x1f4,_0x5918f9[_0x72b9('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 2c72518..cc8bb90 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 _0xc5a0=['length','smsQueue:','./smsQueue.events','save','remove','removeListener','register'];(function(_0x1d426f,_0x37e919){var _0x17f71a=function(_0x3bf60c){while(--_0x3bf60c){_0x1d426f['push'](_0x1d426f['shift']());}};_0x17f71a(++_0x37e919);}(_0xc5a0,0x1ec));var _0x0c5a=function(_0x48fe58,_0x334888){_0x48fe58=_0x48fe58-0x0;var _0x43f2c7=_0xc5a0[_0x48fe58];return _0x43f2c7;};'use strict';var SmsQueueEvents=require(_0x0c5a('0x0'));var events=[_0x0c5a('0x1'),_0x0c5a('0x2'),'update'];function createListener(_0x4e7fd0,_0xa92357){return function(_0x553a1a){_0xa92357['emit'](_0x4e7fd0,_0x553a1a);};}function removeListener(_0x1088d5,_0x569fd2){return function(){SmsQueueEvents[_0x0c5a('0x3')](_0x1088d5,_0x569fd2);};}exports[_0x0c5a('0x4')]=function(_0x16bd4e){for(var _0x4762e4=0x0,_0x3d93ad=events[_0x0c5a('0x5')];_0x4762e4<_0x3d93ad;_0x4762e4++){var _0x976af0=events[_0x4762e4];var _0x50b7ea=createListener(_0x0c5a('0x6')+_0x976af0,_0x16bd4e);SmsQueueEvents['on'](_0x976af0,_0x50b7ea);}}; \ No newline at end of file +var _0x1361=['length','smsQueue:','./smsQueue.events','remove','emit','removeListener'];(function(_0x28d465,_0x164f99){var _0x527843=function(_0x529705){while(--_0x529705){_0x28d465['push'](_0x28d465['shift']());}};_0x527843(++_0x164f99);}(_0x1361,0x128));var _0x1136=function(_0x10d268,_0x4a9af2){_0x10d268=_0x10d268-0x0;var _0x36bb0b=_0x1361[_0x10d268];return _0x36bb0b;};'use strict';var SmsQueueEvents=require(_0x1136('0x0'));var events=['save',_0x1136('0x1'),'update'];function createListener(_0x268042,_0x136098){return function(_0x10992d){_0x136098[_0x1136('0x2')](_0x268042,_0x10992d);};}function removeListener(_0x535525,_0x3979ac){return function(){SmsQueueEvents[_0x1136('0x3')](_0x535525,_0x3979ac);};}exports['register']=function(_0xde2424){for(var _0x33cbfd=0x0,_0xfbd488=events[_0x1136('0x4')];_0x33cbfd<_0xfbd488;_0x33cbfd++){var _0x58fa61=events[_0x33cbfd];var _0x393de4=createListener(_0x1136('0x5')+_0x58fa61,_0xde2424);SmsQueueEvents['on'](_0x58fa61,_0x393de4);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index dabcc3f..1b0dd1d 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 _0x8b67=['index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','path','express','Router','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated'];(function(_0x1fe99d,_0xcfd984){var _0x2c6114=function(_0x39c3e4){while(--_0x39c3e4){_0x1fe99d['push'](_0x1fe99d['shift']());}};_0x2c6114(++_0xcfd984);}(_0x8b67,0x161));var _0x78b6=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x8b67[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x78b6('0x0'));var timeout=require('connect-timeout');var express=require(_0x78b6('0x1'));var router=express[_0x78b6('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x78b6('0x3'));var config=require(_0x78b6('0x4'));var controller=require(_0x78b6('0x5'));router[_0x78b6('0x6')]('/',auth[_0x78b6('0x7')](),controller[_0x78b6('0x8')]);router[_0x78b6('0x6')](_0x78b6('0x9'),auth[_0x78b6('0x7')](),controller[_0x78b6('0xa')]);router[_0x78b6('0x6')](_0x78b6('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x78b6('0xc')]('/',auth[_0x78b6('0x7')](),controller[_0x78b6('0xd')]);router[_0x78b6('0xe')](_0x78b6('0xb'),auth[_0x78b6('0x7')](),controller[_0x78b6('0xf')]);router[_0x78b6('0x10')](_0x78b6('0xb'),auth[_0x78b6('0x7')](),controller[_0x78b6('0x11')]);module[_0x78b6('0x12')]=router; \ No newline at end of file +var _0xb7e1=['Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','create','put','update','delete','exports','util','path','connect-timeout','express'];(function(_0x83b7b0,_0x2ce83d){var _0x49f9fc=function(_0x2b1f6b){while(--_0x2b1f6b){_0x83b7b0['push'](_0x83b7b0['shift']());}};_0x49f9fc(++_0x2ce83d);}(_0xb7e1,0x11c));var _0x1b7e=function(_0x49e821,_0x1fa0ac){_0x49e821=_0x49e821-0x0;var _0x3aa830=_0xb7e1[_0x49e821];return _0x3aa830;};'use strict';var multer=require('multer');var util=require(_0x1b7e('0x0'));var path=require(_0x1b7e('0x1'));var timeout=require(_0x1b7e('0x2'));var express=require(_0x1b7e('0x3'));var router=express[_0x1b7e('0x4')]();var auth=require(_0x1b7e('0x5'));var interaction=require(_0x1b7e('0x6'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0x1b7e('0x7')]('/',auth[_0x1b7e('0x8')](),controller[_0x1b7e('0x9')]);router[_0x1b7e('0x7')](_0x1b7e('0xa'),auth[_0x1b7e('0x8')](),controller[_0x1b7e('0xb')]);router[_0x1b7e('0x7')](_0x1b7e('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x1b7e('0x8')](),controller[_0x1b7e('0xd')]);router[_0x1b7e('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x1b7e('0xf')]);router[_0x1b7e('0x10')](_0x1b7e('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x1b7e('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 6d58b9e..a01a078 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 _0x9d2a=['STRING','DATE','moment','sequelize','exports'];(function(_0x21bc9b,_0x1d8157){var _0x262273=function(_0x2fe2e3){while(--_0x2fe2e3){_0x21bc9b['push'](_0x21bc9b['shift']());}};_0x262273(++_0x1d8157);}(_0x9d2a,0xb6));var _0xa9d2=function(_0x429518,_0x111948){_0x429518=_0x429518-0x0;var _0x7592d1=_0x9d2a[_0x429518];return _0x7592d1;};'use strict';var moment=require(_0xa9d2('0x0'));var Sequelize=require(_0xa9d2('0x1'));module[_0xa9d2('0x2')]={'uniqueid':{'type':Sequelize[_0xa9d2('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xa9d2('0x3')]},'joinAt':{'type':Sequelize[_0xa9d2('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa9d2('0x4')]},'exitAt':{'type':Sequelize[_0xa9d2('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1f40=['DATE','moment','exports','STRING'];(function(_0x5d5011,_0x23f8f4){var _0x23c817=function(_0x15cb26){while(--_0x15cb26){_0x5d5011['push'](_0x5d5011['shift']());}};_0x23c817(++_0x23f8f4);}(_0x1f40,0x16d));var _0x01f4=function(_0x647332,_0x5e43f9){_0x647332=_0x647332-0x0;var _0x3e9692=_0x1f40[_0x647332];return _0x3e9692;};'use strict';var moment=require(_0x01f4('0x0'));var Sequelize=require('sequelize');module[_0x01f4('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x01f4('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x01f4('0x3')]},'acceptAt':{'type':Sequelize[_0x01f4('0x3')]},'exitAt':{'type':Sequelize[_0x01f4('0x3')]},'reason':{'type':Sequelize[_0x01f4('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 4ac197a..be12e7d 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 _0x9468=['fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','count','includeAll','include','SmsQueueReport','rows','catch','params','length','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','end','error','stack','name','send','map','rawAttributes','key','model','query','keys','filters','intersection','attributes'];(function(_0xcffa4,_0x235b3e){var _0x5bdf7b=function(_0x3610e3){while(--_0x3610e3){_0xcffa4['push'](_0xcffa4['shift']());}};_0x5bdf7b(++_0x235b3e);}(_0x9468,0x1e6));var _0x8946=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0x9468[_0x43a37c];return _0x5d1d40;};'use strict';var pdf=require(_0x8946('0x0'));var emlformat=require(_0x8946('0x1'));var rimraf=require(_0x8946('0x2'));var zipdir=require(_0x8946('0x3'));var jsonpatch=require(_0x8946('0x4'));var rp=require(_0x8946('0x5'));var moment=require(_0x8946('0x6'));var BPromise=require(_0x8946('0x7'));var Mustache=require('mustache');var util=require(_0x8946('0x8'));var path=require(_0x8946('0x9'));var sox=require(_0x8946('0xa'));var csv=require(_0x8946('0xb'));var ejs=require(_0x8946('0xc'));var fs=require('fs');var _=require(_0x8946('0xd'));var squel=require(_0x8946('0xe'));var crypto=require(_0x8946('0xf'));var jsforce=require(_0x8946('0x10'));var deskjs=require(_0x8946('0x11'));var toCsv=require('to-csv');var querystring=require(_0x8946('0x12'));var Papa=require('papaparse');var Redis=require(_0x8946('0x13'));var authService=require(_0x8946('0x14'));var qs=require(_0x8946('0x15'));var as=require(_0x8946('0x16'));var hardwareService=require(_0x8946('0x17'));var logger=require(_0x8946('0x18'))(_0x8946('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8946('0x1a'))['db'];function respondWithStatusCode(_0x36cb87,_0xb2b1d5){_0xb2b1d5=_0xb2b1d5||0xcc;return function(_0x11528b){if(_0x11528b){return _0x36cb87[_0x8946('0x1b')](_0xb2b1d5);}return _0x36cb87[_0x8946('0x1c')](_0xb2b1d5)['end']();};}function respondWithResult(_0x3c18a5,_0x28eb34){_0x28eb34=_0x28eb34||0xc8;return function(_0xefe991){if(_0xefe991){return _0x3c18a5[_0x8946('0x1c')](_0x28eb34)['json'](_0xefe991);}};}function respondWithFilteredResult(_0x5b1f8e,_0x2bfdf5){return function(_0x370a31){if(_0x370a31){var _0xe37d1e=_0x370a31['count'],_0x3b198a=_0x2bfdf5['offset'],_0x3a6bbe=_0x2bfdf5[_0x8946('0x1d')]+_0x2bfdf5[_0x8946('0x1e')],_0x4c6ce1;if(_0x3a6bbe>=_0xe37d1e){_0x3a6bbe=_0xe37d1e;_0x4c6ce1=0xc8;}else{_0x4c6ce1=0xce;}_0x5b1f8e[_0x8946('0x1c')](_0x4c6ce1);return _0x5b1f8e[_0x8946('0x1f')](_0x8946('0x20'),_0x3b198a+'-'+_0x3a6bbe+'/'+_0xe37d1e)[_0x8946('0x21')](_0x370a31);}return null;};}function patchUpdates(_0x28928a){return function(_0x3f3e8b){try{jsonpatch[_0x8946('0x22')](_0x3f3e8b,_0x28928a,!![]);}catch(_0x5ec1e9){return BPromise[_0x8946('0x23')](_0x5ec1e9);}return _0x3f3e8b[_0x8946('0x24')]();};}function saveUpdates(_0x5758b6,_0xa227a1){return function(_0x2b3c47){if(_0x2b3c47){return _0x2b3c47['update'](_0x5758b6)[_0x8946('0x25')](function(_0x3a907c){return _0x3a907c;});}return null;};}function removeEntity(_0x55a20f,_0x5afeb8){return function(_0x4b90df){if(_0x4b90df){return _0x4b90df[_0x8946('0x26')]()[_0x8946('0x25')](function(){_0x55a20f[_0x8946('0x1c')](0xcc)[_0x8946('0x27')]();});}};}function handleEntityNotFound(_0x3e9205,_0x29c8dc){return function(_0x58cd4f){if(!_0x58cd4f){_0x3e9205[_0x8946('0x1b')](0x194);}return _0x58cd4f;};}function handleError(_0x2abc0b,_0x188591){_0x188591=_0x188591||0x1f4;return function(_0x25fb8d){logger[_0x8946('0x28')](_0x25fb8d[_0x8946('0x29')]);if(_0x25fb8d['name']){delete _0x25fb8d[_0x8946('0x2a')];}_0x2abc0b['status'](_0x188591)[_0x8946('0x2b')](_0x25fb8d);};}exports['index']=function(_0x4df20d,_0x227ef7){var _0x156d8b={},_0x485635={},_0x4d8d24={'count':0x0,'rows':[]};var _0x771e2=_[_0x8946('0x2c')](db['SmsQueueReport'][_0x8946('0x2d')],function(_0x4785d2){return{'name':_0x4785d2['fieldName'],'type':_0x4785d2['type'][_0x8946('0x2e')]};});_0x485635[_0x8946('0x2f')]=_['map'](_0x771e2,'name');_0x485635[_0x8946('0x30')]=_[_0x8946('0x31')](_0x4df20d[_0x8946('0x30')]);_0x485635[_0x8946('0x32')]=_[_0x8946('0x33')](_0x485635[_0x8946('0x2f')],_0x485635['query']);_0x156d8b[_0x8946('0x34')]=_[_0x8946('0x33')](_0x485635[_0x8946('0x2f')],qs[_0x8946('0x35')](_0x4df20d[_0x8946('0x30')]['fields']));_0x156d8b[_0x8946('0x34')]=_0x156d8b[_0x8946('0x34')]['length']?_0x156d8b[_0x8946('0x34')]:_0x485635[_0x8946('0x2f')];if(!_0x4df20d[_0x8946('0x30')][_0x8946('0x36')](_0x8946('0x37'))){_0x156d8b[_0x8946('0x1e')]=qs[_0x8946('0x1e')](_0x4df20d['query'][_0x8946('0x1e')]);_0x156d8b[_0x8946('0x1d')]=qs[_0x8946('0x1d')](_0x4df20d[_0x8946('0x30')][_0x8946('0x1d')]);}_0x156d8b[_0x8946('0x38')]=qs[_0x8946('0x39')](_0x4df20d[_0x8946('0x30')][_0x8946('0x39')]);_0x156d8b[_0x8946('0x3a')]=qs[_0x8946('0x32')](_[_0x8946('0x3b')](_0x4df20d[_0x8946('0x30')],_0x485635[_0x8946('0x32')]),_0x771e2);if(_0x4df20d[_0x8946('0x30')]['filter']){_0x156d8b[_0x8946('0x3a')]=_[_0x8946('0x3c')](_0x156d8b[_0x8946('0x3a')],{'$or':_[_0x8946('0x2c')](_0x771e2,function(_0x5b8a1b){if(_0x5b8a1b[_0x8946('0x3d')]!==_0x8946('0x3e')){var _0x429b76={};_0x429b76[_0x5b8a1b[_0x8946('0x2a')]]={'$like':'%'+_0x4df20d['query'][_0x8946('0x3f')]+'%'};return _0x429b76;}})});}_0x156d8b=_['merge']({},_0x156d8b,_0x4df20d[_0x8946('0x40')]);var _0x4c0bd8={'where':_0x156d8b['where']};return db['SmsQueueReport']['count'](_0x4c0bd8)[_0x8946('0x25')](function(_0x3b2ab4){_0x4d8d24[_0x8946('0x41')]=_0x3b2ab4;if(_0x4df20d[_0x8946('0x30')][_0x8946('0x42')]){_0x156d8b[_0x8946('0x43')]=[{'all':!![]}];}return db[_0x8946('0x44')]['findAll'](_0x156d8b);})[_0x8946('0x25')](function(_0x1cf7e9){_0x4d8d24[_0x8946('0x45')]=_0x1cf7e9;return _0x4d8d24;})[_0x8946('0x25')](respondWithFilteredResult(_0x227ef7,_0x156d8b))[_0x8946('0x46')](handleError(_0x227ef7,null));};exports['show']=function(_0x3b4a6a,_0x57edde){var _0x3907ca={'raw':!![],'where':{'id':_0x3b4a6a[_0x8946('0x47')]['id']}},_0x1ba4f5={};_0x1ba4f5[_0x8946('0x2f')]=_[_0x8946('0x31')](db[_0x8946('0x44')][_0x8946('0x2d')]);_0x1ba4f5[_0x8946('0x30')]=_[_0x8946('0x31')](_0x3b4a6a[_0x8946('0x30')]);_0x1ba4f5['filters']=_[_0x8946('0x33')](_0x1ba4f5[_0x8946('0x2f')],_0x1ba4f5[_0x8946('0x30')]);_0x3907ca['attributes']=_[_0x8946('0x33')](_0x1ba4f5['model'],qs[_0x8946('0x35')](_0x3b4a6a['query'][_0x8946('0x35')]));_0x3907ca['attributes']=_0x3907ca[_0x8946('0x34')][_0x8946('0x48')]?_0x3907ca[_0x8946('0x34')]:_0x1ba4f5['model'];if(_0x3b4a6a[_0x8946('0x30')]['includeAll']){_0x3907ca[_0x8946('0x43')]=[{'all':!![]}];}_0x3907ca=_[_0x8946('0x3c')]({},_0x3907ca,_0x3b4a6a[_0x8946('0x40')]);return db[_0x8946('0x44')][_0x8946('0x49')](_0x3907ca)[_0x8946('0x25')](handleEntityNotFound(_0x57edde,null))[_0x8946('0x25')](respondWithResult(_0x57edde,null))[_0x8946('0x46')](handleError(_0x57edde,null));};exports[_0x8946('0x4a')]=function(_0x3cf443,_0x37f8da){return db[_0x8946('0x44')][_0x8946('0x4a')](_0x3cf443[_0x8946('0x4b')],{})[_0x8946('0x25')](respondWithResult(_0x37f8da,0xc9))[_0x8946('0x46')](handleError(_0x37f8da,null));};exports['update']=function(_0x193e8f,_0x58584a){if(_0x193e8f[_0x8946('0x4b')]['id']){delete _0x193e8f[_0x8946('0x4b')]['id'];}return db[_0x8946('0x44')][_0x8946('0x49')]({'where':{'id':_0x193e8f[_0x8946('0x47')]['id']}})[_0x8946('0x25')](handleEntityNotFound(_0x58584a,null))[_0x8946('0x25')](saveUpdates(_0x193e8f[_0x8946('0x4b')],null))[_0x8946('0x25')](respondWithResult(_0x58584a,null))['catch'](handleError(_0x58584a,null));};exports['destroy']=function(_0x69dd14,_0x2b26fd){return db[_0x8946('0x44')][_0x8946('0x49')]({'where':{'id':_0x69dd14[_0x8946('0x47')]['id']}})['then'](handleEntityNotFound(_0x2b26fd,null))[_0x8946('0x25')](removeEntity(_0x2b26fd,null))['catch'](handleError(_0x2b26fd,null));};exports[_0x8946('0x4c')]=function(_0x35e507,_0x33de15){return db[_0x8946('0x44')]['describe']()[_0x8946('0x25')](respondWithResult(_0x33de15,null))[_0x8946('0x46')](handleError(_0x33de15,null));}; \ No newline at end of file +var _0x1398=['then','destroy','end','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','filters','pick','merge','where','VIRTUAL','filter','includeAll','include','findAll','catch','show','params','options','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','count','offset','limit','set'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x1398,0x6c));var _0x8139=function(_0x48cf4c,_0x392951){_0x48cf4c=_0x48cf4c-0x0;var _0x4a57f0=_0x1398[_0x48cf4c];return _0x4a57f0;};'use strict';var pdf=require(_0x8139('0x0'));var emlformat=require(_0x8139('0x1'));var rimraf=require(_0x8139('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8139('0x3'));var rp=require(_0x8139('0x4'));var moment=require(_0x8139('0x5'));var BPromise=require(_0x8139('0x6'));var Mustache=require(_0x8139('0x7'));var util=require('util');var path=require(_0x8139('0x8'));var sox=require(_0x8139('0x9'));var csv=require(_0x8139('0xa'));var ejs=require(_0x8139('0xb'));var fs=require('fs');var _=require(_0x8139('0xc'));var squel=require(_0x8139('0xd'));var crypto=require('crypto');var jsforce=require(_0x8139('0xe'));var deskjs=require(_0x8139('0xf'));var toCsv=require(_0x8139('0xa'));var querystring=require(_0x8139('0x10'));var Papa=require(_0x8139('0x11'));var Redis=require(_0x8139('0x12'));var authService=require(_0x8139('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8139('0x14'));var logger=require(_0x8139('0x15'))(_0x8139('0x16'));var utils=require(_0x8139('0x17'));var config=require(_0x8139('0x18'));var licenseUtil=require(_0x8139('0x19'));var db=require(_0x8139('0x1a'))['db'];function respondWithStatusCode(_0x28fba0,_0x51b0d9){_0x51b0d9=_0x51b0d9||0xcc;return function(_0x42f912){if(_0x42f912){return _0x28fba0[_0x8139('0x1b')](_0x51b0d9);}return _0x28fba0['status'](_0x51b0d9)['end']();};}function respondWithResult(_0x452c35,_0x204163){_0x204163=_0x204163||0xc8;return function(_0xafd665){if(_0xafd665){return _0x452c35[_0x8139('0x1c')](_0x204163)[_0x8139('0x1d')](_0xafd665);}};}function respondWithFilteredResult(_0x42789b,_0x3fb63c){return function(_0x33a025){if(_0x33a025){var _0x1b598c=_0x33a025[_0x8139('0x1e')],_0x56f1f6=_0x3fb63c[_0x8139('0x1f')],_0x3e215f=_0x3fb63c[_0x8139('0x1f')]+_0x3fb63c[_0x8139('0x20')],_0x34212f;if(_0x3e215f>=_0x1b598c){_0x3e215f=_0x1b598c;_0x34212f=0xc8;}else{_0x34212f=0xce;}_0x42789b[_0x8139('0x1c')](_0x34212f);return _0x42789b[_0x8139('0x21')]('Content-Range',_0x56f1f6+'-'+_0x3e215f+'/'+_0x1b598c)[_0x8139('0x1d')](_0x33a025);}return null;};}function patchUpdates(_0x3d289b){return function(_0xd57ba5){try{jsonpatch['apply'](_0xd57ba5,_0x3d289b,!![]);}catch(_0x1853ad){return BPromise['reject'](_0x1853ad);}return _0xd57ba5['save']();};}function saveUpdates(_0x3db771,_0x57ec50){return function(_0x2f6379){if(_0x2f6379){return _0x2f6379['update'](_0x3db771)[_0x8139('0x22')](function(_0x3a734f){return _0x3a734f;});}return null;};}function removeEntity(_0x500f77,_0x476fec){return function(_0x1f2d43){if(_0x1f2d43){return _0x1f2d43[_0x8139('0x23')]()['then'](function(){_0x500f77[_0x8139('0x1c')](0xcc)[_0x8139('0x24')]();});}};}function handleEntityNotFound(_0x352052,_0x4eaf51){return function(_0x2302c5){if(!_0x2302c5){_0x352052[_0x8139('0x1b')](0x194);}return _0x2302c5;};}function handleError(_0x330ea1,_0x42a176){_0x42a176=_0x42a176||0x1f4;return function(_0x28af43){logger[_0x8139('0x25')](_0x28af43[_0x8139('0x26')]);if(_0x28af43['name']){delete _0x28af43[_0x8139('0x27')];}_0x330ea1[_0x8139('0x1c')](_0x42a176)[_0x8139('0x28')](_0x28af43);};}exports[_0x8139('0x29')]=function(_0x9e3460,_0x33f833){var _0x4b05d4={},_0x263832={},_0x3d903a={'count':0x0,'rows':[]};var _0x18b436=_[_0x8139('0x2a')](db[_0x8139('0x2b')][_0x8139('0x2c')],function(_0x357907){return{'name':_0x357907['fieldName'],'type':_0x357907[_0x8139('0x2d')]['key']};});_0x263832[_0x8139('0x2e')]=_[_0x8139('0x2a')](_0x18b436,_0x8139('0x27'));_0x263832[_0x8139('0x2f')]=_[_0x8139('0x30')](_0x9e3460[_0x8139('0x2f')]);_0x263832['filters']=_[_0x8139('0x31')](_0x263832[_0x8139('0x2e')],_0x263832[_0x8139('0x2f')]);_0x4b05d4[_0x8139('0x32')]=_[_0x8139('0x31')](_0x263832['model'],qs['fields'](_0x9e3460[_0x8139('0x2f')][_0x8139('0x33')]));_0x4b05d4[_0x8139('0x32')]=_0x4b05d4[_0x8139('0x32')][_0x8139('0x34')]?_0x4b05d4[_0x8139('0x32')]:_0x263832['model'];if(!_0x9e3460[_0x8139('0x2f')]['hasOwnProperty'](_0x8139('0x35'))){_0x4b05d4['limit']=qs[_0x8139('0x20')](_0x9e3460[_0x8139('0x2f')]['limit']);_0x4b05d4[_0x8139('0x1f')]=qs['offset'](_0x9e3460[_0x8139('0x2f')][_0x8139('0x1f')]);}_0x4b05d4[_0x8139('0x36')]=qs['sort'](_0x9e3460[_0x8139('0x2f')]['sort']);_0x4b05d4['where']=qs[_0x8139('0x37')](_[_0x8139('0x38')](_0x9e3460['query'],_0x263832[_0x8139('0x37')]),_0x18b436);if(_0x9e3460['query']['filter']){_0x4b05d4['where']=_[_0x8139('0x39')](_0x4b05d4[_0x8139('0x3a')],{'$or':_[_0x8139('0x2a')](_0x18b436,function(_0x56b35f){if(_0x56b35f[_0x8139('0x2d')]!==_0x8139('0x3b')){var _0x304f18={};_0x304f18[_0x56b35f['name']]={'$like':'%'+_0x9e3460[_0x8139('0x2f')][_0x8139('0x3c')]+'%'};return _0x304f18;}})});}_0x4b05d4=_['merge']({},_0x4b05d4,_0x9e3460['options']);var _0x307a0e={'where':_0x4b05d4[_0x8139('0x3a')]};return db[_0x8139('0x2b')][_0x8139('0x1e')](_0x307a0e)[_0x8139('0x22')](function(_0x17a7f9){_0x3d903a['count']=_0x17a7f9;if(_0x9e3460[_0x8139('0x2f')][_0x8139('0x3d')]){_0x4b05d4[_0x8139('0x3e')]=[{'all':!![]}];}return db[_0x8139('0x2b')][_0x8139('0x3f')](_0x4b05d4);})[_0x8139('0x22')](function(_0x5666af){_0x3d903a['rows']=_0x5666af;return _0x3d903a;})[_0x8139('0x22')](respondWithFilteredResult(_0x33f833,_0x4b05d4))[_0x8139('0x40')](handleError(_0x33f833,null));};exports[_0x8139('0x41')]=function(_0x2189c2,_0x5b6214){var _0x31de64={'raw':!![],'where':{'id':_0x2189c2[_0x8139('0x42')]['id']}},_0x345ebd={};_0x345ebd['model']=_[_0x8139('0x30')](db[_0x8139('0x2b')][_0x8139('0x2c')]);_0x345ebd['query']=_['keys'](_0x2189c2[_0x8139('0x2f')]);_0x345ebd[_0x8139('0x37')]=_[_0x8139('0x31')](_0x345ebd[_0x8139('0x2e')],_0x345ebd[_0x8139('0x2f')]);_0x31de64[_0x8139('0x32')]=_['intersection'](_0x345ebd[_0x8139('0x2e')],qs[_0x8139('0x33')](_0x2189c2['query'][_0x8139('0x33')]));_0x31de64['attributes']=_0x31de64[_0x8139('0x32')][_0x8139('0x34')]?_0x31de64[_0x8139('0x32')]:_0x345ebd['model'];if(_0x2189c2[_0x8139('0x2f')][_0x8139('0x3d')]){_0x31de64[_0x8139('0x3e')]=[{'all':!![]}];}_0x31de64=_['merge']({},_0x31de64,_0x2189c2[_0x8139('0x43')]);return db[_0x8139('0x2b')]['find'](_0x31de64)[_0x8139('0x22')](handleEntityNotFound(_0x5b6214,null))[_0x8139('0x22')](respondWithResult(_0x5b6214,null))[_0x8139('0x40')](handleError(_0x5b6214,null));};exports[_0x8139('0x44')]=function(_0x21ac70,_0x39437c){return db[_0x8139('0x2b')][_0x8139('0x44')](_0x21ac70[_0x8139('0x45')],{})[_0x8139('0x22')](respondWithResult(_0x39437c,0xc9))[_0x8139('0x40')](handleError(_0x39437c,null));};exports['update']=function(_0x5ada96,_0xba891c){if(_0x5ada96[_0x8139('0x45')]['id']){delete _0x5ada96[_0x8139('0x45')]['id'];}return db[_0x8139('0x2b')]['find']({'where':{'id':_0x5ada96[_0x8139('0x42')]['id']}})[_0x8139('0x22')](handleEntityNotFound(_0xba891c,null))[_0x8139('0x22')](saveUpdates(_0x5ada96['body'],null))[_0x8139('0x22')](respondWithResult(_0xba891c,null))[_0x8139('0x40')](handleError(_0xba891c,null));};exports[_0x8139('0x23')]=function(_0x5bae2d,_0x569292){return db[_0x8139('0x2b')]['find']({'where':{'id':_0x5bae2d['params']['id']}})[_0x8139('0x22')](handleEntityNotFound(_0x569292,null))['then'](removeEntity(_0x569292,null))[_0x8139('0x40')](handleError(_0x569292,null));};exports[_0x8139('0x46')]=function(_0xa17856,_0x1c13d2){return db[_0x8139('0x2b')]['describe']()[_0x8139('0x22')](respondWithResult(_0x1c13d2,null))[_0x8139('0x40')](handleError(_0x1c13d2,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 64416a6..7267c91 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 _0x14ac=['SmsQueueReport','report_sms_queue','uniqueid','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','define'];(function(_0x11e03f,_0x20b967){var _0x5666fe=function(_0x19ce63){while(--_0x19ce63){_0x11e03f['push'](_0x11e03f['shift']());}};_0x5666fe(++_0x20b967);}(_0x14ac,0x13b));var _0xc14a=function(_0x2b5584,_0x2c1bab){_0x2b5584=_0x2b5584-0x0;var _0x3f8885=_0x14ac[_0x2b5584];return _0x3f8885;};'use strict';var _=require('lodash');var util=require(_0xc14a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc14a('0x1'));var BPromise=require(_0xc14a('0x2'));var rp=require(_0xc14a('0x3'));var fs=require('fs');var path=require(_0xc14a('0x4'));var rimraf=require(_0xc14a('0x5'));var config=require(_0xc14a('0x6'));var attributes=require(_0xc14a('0x7'));module['exports']=function(_0x29832d,_0x22486f){return _0x29832d[_0xc14a('0x8')](_0xc14a('0x9'),attributes,{'tableName':_0xc14a('0xa'),'paranoid':![],'indexes':[{'name':_0xc14a('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xef92=['SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x33f766,_0x2e1a36){var _0xb268d6=function(_0x75edf2){while(--_0x75edf2){_0x33f766['push'](_0x33f766['shift']());}};_0xb268d6(++_0x2e1a36);}(_0xef92,0xf2));var _0x2ef9=function(_0x1844fb,_0x57396e){_0x1844fb=_0x1844fb-0x0;var _0x5e204c=_0xef92[_0x1844fb];return _0x5e204c;};'use strict';var _=require(_0x2ef9('0x0'));var util=require(_0x2ef9('0x1'));var logger=require(_0x2ef9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2ef9('0x3'));var rp=require(_0x2ef9('0x4'));var fs=require('fs');var path=require(_0x2ef9('0x5'));var rimraf=require(_0x2ef9('0x6'));var config=require(_0x2ef9('0x7'));var attributes=require('./smsQueueReport.attributes');module[_0x2ef9('0x8')]=function(_0x320ef6,_0x1012f4){return _0x320ef6[_0x2ef9('0x9')](_0x2ef9('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x2ef9('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 024e71b..1caa025 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 _0xb09a=['debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','info','UpdateSmsQueueReport','update','body','limit','stringify','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','then'];(function(_0x29a032,_0x429813){var _0x534df2=function(_0x125eb7){while(--_0x125eb7){_0x29a032['push'](_0x29a032['shift']());}};_0x534df2(++_0x429813);}(_0xb09a,0x67));var _0xab09=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xb09a[_0x20ef64];return _0x3707d8;};'use strict';var _=require(_0xab09('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xab09('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab09('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xab09('0x3'));var logger=require(_0xab09('0x4'))(_0xab09('0x5'));var config=require('../../config/environment');var jayson=require(_0xab09('0x6'));var client=jayson['client'][_0xab09('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x39ed3f,_0x5a192a,_0x596a43){return new BPromise(function(_0x364a3d,_0x2cac07){return client['request'](_0x39ed3f,_0x596a43)[_0xab09('0x8')](function(_0x490f48){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x5a192a,'request\x20sent');logger[_0xab09('0x9')](_0xab09('0xa'),_0x5a192a,_0xab09('0xb'),JSON['stringify'](_0x490f48));if(_0x490f48[_0xab09('0xc')]){if(_0x490f48[_0xab09('0xc')]['code']===0x1f4){logger['error'](_0xab09('0xd'),_0x5a192a,_0x490f48[_0xab09('0xc')][_0xab09('0xe')]);return _0x2cac07(_0x490f48[_0xab09('0xc')][_0xab09('0xe')]);}logger[_0xab09('0xc')](_0xab09('0xd'),_0x5a192a,_0x490f48[_0xab09('0xc')][_0xab09('0xe')]);return _0x364a3d(_0x490f48[_0xab09('0xc')]['message']);}else{logger['info'](_0xab09('0xd'),_0x5a192a,_0xab09('0xb'));_0x364a3d(_0x490f48[_0xab09('0xf')][_0xab09('0xe')]);}})[_0xab09('0x10')](function(_0x1029b4){logger[_0xab09('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x5a192a,_0x1029b4);_0x2cac07(_0x1029b4);});});}exports[_0xab09('0x11')]=function(_0x4963cf){var _0x3c80a7=this;return new Promise(function(_0x4d4c6f,_0x55f33f){return db[_0xab09('0x12')][_0xab09('0x13')](_0x4963cf['body'],{'raw':_0x4963cf[_0xab09('0x14')]?_0x4963cf['options'][_0xab09('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x2ae8c4){logger[_0xab09('0x16')](_0xab09('0x11'),_0x4963cf);logger['debug'](_0xab09('0x11'),_0x4963cf,JSON['stringify'](_0x2ae8c4));_0x4d4c6f(_0x2ae8c4);})[_0xab09('0x10')](function(_0x5585e2){logger[_0xab09('0xc')](_0xab09('0x11'),_0x5585e2[_0xab09('0xe')],_0x4963cf);_0x55f33f(_0x3c80a7[_0xab09('0xc')](0x1f4,_0x5585e2[_0xab09('0xe')]));});});};exports[_0xab09('0x17')]=function(_0xf74e15){var _0x5a3272=this;return new Promise(function(_0x3514d6,_0x52540e){return db[_0xab09('0x12')][_0xab09('0x18')](_0xf74e15[_0xab09('0x19')],{'raw':_0xf74e15[_0xab09('0x14')]?_0xf74e15[_0xab09('0x14')][_0xab09('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf74e15[_0xab09('0x14')]?_0xf74e15['options']['where']||null:null,'attributes':_0xf74e15['options']?_0xf74e15['options']['attributes']||null:null,'limit':_0xf74e15[_0xab09('0x14')]?_0xf74e15['options'][_0xab09('0x1a')]||null:null})[_0xab09('0x8')](function(_0x19de76){logger['info'](_0xab09('0x17'),_0xf74e15);logger[_0xab09('0x9')](_0xab09('0x17'),_0xf74e15,JSON[_0xab09('0x1b')](_0x19de76));_0x3514d6(_0x19de76);})[_0xab09('0x10')](function(_0x4afaee){logger['error']('UpdateSmsQueueReport',_0x4afaee['message'],_0xf74e15);_0x52540e(_0x5a3272[_0xab09('0xc')](0x1f4,_0x4afaee[_0xab09('0xe')]));});});}; \ No newline at end of file +var _0x25ee=['update','limit','UpdateSmsQueueReport','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','options','raw'];(function(_0x459a0a,_0x25c46f){var _0x4ab46c=function(_0x451a6a){while(--_0x451a6a){_0x459a0a['push'](_0x459a0a['shift']());}};_0x4ab46c(++_0x25c46f);}(_0x25ee,0x73));var _0xe25e=function(_0x3826c8,_0x2ec648){_0x3826c8=_0x3826c8-0x0;var _0x39d82f=_0x25ee[_0x3826c8];return _0x39d82f;};'use strict';var _=require(_0xe25e('0x0'));var util=require(_0xe25e('0x1'));var moment=require(_0xe25e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe25e('0x3'));var db=require(_0xe25e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe25e('0x5'));var config=require(_0xe25e('0x6'));var jayson=require(_0xe25e('0x7'));var client=jayson['client'][_0xe25e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25406f,_0x3bb916,_0x4842e8){return new BPromise(function(_0x29ae09,_0x2adf09){return client[_0xe25e('0x9')](_0x25406f,_0x4842e8)[_0xe25e('0xa')](function(_0x20678e){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x3bb916,_0xe25e('0xb'));logger[_0xe25e('0xc')](_0xe25e('0xd'),_0x3bb916,_0xe25e('0xb'),JSON[_0xe25e('0xe')](_0x20678e));if(_0x20678e['error']){if(_0x20678e[_0xe25e('0xf')]['code']===0x1f4){logger[_0xe25e('0xf')](_0xe25e('0x10'),_0x3bb916,_0x20678e[_0xe25e('0xf')][_0xe25e('0x11')]);return _0x2adf09(_0x20678e[_0xe25e('0xf')][_0xe25e('0x11')]);}logger[_0xe25e('0xf')](_0xe25e('0x10'),_0x3bb916,_0x20678e['error'][_0xe25e('0x11')]);return _0x29ae09(_0x20678e['error'][_0xe25e('0x11')]);}else{logger[_0xe25e('0x12')](_0xe25e('0x10'),_0x3bb916,_0xe25e('0xb'));_0x29ae09(_0x20678e[_0xe25e('0x13')][_0xe25e('0x11')]);}})[_0xe25e('0x14')](function(_0x500523){logger[_0xe25e('0xf')](_0xe25e('0x10'),_0x3bb916,_0x500523);_0x2adf09(_0x500523);});});}exports[_0xe25e('0x15')]=function(_0x27c6c1){var _0x37c57c=this;return new Promise(function(_0x3222ff,_0x5704d9){return db[_0xe25e('0x16')]['create'](_0x27c6c1['body'],{'raw':_0x27c6c1[_0xe25e('0x17')]?_0x27c6c1[_0xe25e('0x17')][_0xe25e('0x18')]===undefined?!![]:![]:!![]})[_0xe25e('0xa')](function(_0x5c3d9b){logger[_0xe25e('0x12')]('CreateSmsQueueReport',_0x27c6c1);logger['debug'](_0xe25e('0x15'),_0x27c6c1,JSON[_0xe25e('0xe')](_0x5c3d9b));_0x3222ff(_0x5c3d9b);})[_0xe25e('0x14')](function(_0x5209a2){logger[_0xe25e('0xf')](_0xe25e('0x15'),_0x5209a2[_0xe25e('0x11')],_0x27c6c1);_0x5704d9(_0x37c57c[_0xe25e('0xf')](0x1f4,_0x5209a2[_0xe25e('0x11')]));});});};exports['UpdateSmsQueueReport']=function(_0x44ef44){var _0x1392e5=this;return new Promise(function(_0x459122,_0x40f982){return db[_0xe25e('0x16')][_0xe25e('0x19')](_0x44ef44['body'],{'raw':_0x44ef44[_0xe25e('0x17')]?_0x44ef44['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44ef44['options']?_0x44ef44['options']['where']||null:null,'attributes':_0x44ef44[_0xe25e('0x17')]?_0x44ef44[_0xe25e('0x17')]['attributes']||null:null,'limit':_0x44ef44[_0xe25e('0x17')]?_0x44ef44['options'][_0xe25e('0x1a')]||null:null})[_0xe25e('0xa')](function(_0x358383){logger['info'](_0xe25e('0x1b'),_0x44ef44);logger['debug'](_0xe25e('0x1b'),_0x44ef44,JSON[_0xe25e('0xe')](_0x358383));_0x459122(_0x358383);})[_0xe25e('0x14')](function(_0x237206){logger['error'](_0xe25e('0x1b'),_0x237206['message'],_0x44ef44);_0x40f982(_0x1392e5[_0xe25e('0xf')](0x1f4,_0x237206[_0xe25e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 500d990..5cab24c 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 _0xf4f4=['Router','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x282a79,_0x1956e4){var _0x45e5f3=function(_0x24918f){while(--_0x24918f){_0x282a79['push'](_0x282a79['shift']());}};_0x45e5f3(++_0x1956e4);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x397e46,_0xff151b){_0x397e46=_0x397e46-0x0;var _0x234ba9=_0xf4f4[_0x397e46];return _0x234ba9;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var auth=require(_0x4f4f('0x5'));var interaction=require(_0x4f4f('0x6'));var config=require('../../config/environment');var controller=require(_0x4f4f('0x7'));router['get']('/',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x9')]);router[_0x4f4f('0xa')](_0x4f4f('0xb'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0xa')](_0x4f4f('0xd'),auth['isAuthenticated'](),controller[_0x4f4f('0xe')]);router[_0x4f4f('0xf')]('/',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x10')]);router[_0x4f4f('0x11')](_0x4f4f('0xd'),auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x12')]);router['delete']('/:id',auth[_0x4f4f('0x8')](),controller[_0x4f4f('0x13')]);module[_0x4f4f('0x14')]=router; \ No newline at end of file +var _0x9ffd=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','update','delete','destroy','exports','multer'];(function(_0x512930,_0x3c48b2){var _0x3924f9=function(_0x5a8bd5){while(--_0x5a8bd5){_0x512930['push'](_0x512930['shift']());}};_0x3924f9(++_0x3c48b2);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x3e283a,_0x4a6440){_0x3e283a=_0x3e283a-0x0;var _0x48c376=_0x9ffd[_0x3e283a];return _0x48c376;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var auth=require(_0xd9ff('0x5'));var interaction=require(_0xd9ff('0x6'));var config=require('../../config/environment');var controller=require(_0xd9ff('0x7'));router[_0xd9ff('0x8')]('/',auth['isAuthenticated'](),controller[_0xd9ff('0x9')]);router[_0xd9ff('0x8')](_0xd9ff('0xa'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0xc')]);router[_0xd9ff('0x8')](_0xd9ff('0xd'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xd9ff('0xd'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0x10')](_0xd9ff('0xd'),auth[_0xd9ff('0xb')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index b0b8003..469d0b1 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 _0x4683=['moment','sequelize','exports','STRING','ENUM','agent','queue','DATE','NOW'];(function(_0x4b4b0e,_0x6c674){var _0x4c2d91=function(_0x4d440d){while(--_0x4d440d){_0x4b4b0e['push'](_0x4b4b0e['shift']());}};_0x4c2d91(++_0x6c674);}(_0x4683,0x1ef));var _0x3468=function(_0x46769b,_0x44e80d){_0x46769b=_0x46769b-0x0;var _0x4d5974=_0x4683[_0x46769b];return _0x4d5974;};'use strict';var moment=require(_0x3468('0x0'));var Sequelize=require(_0x3468('0x1'));module[_0x3468('0x2')]={'uniqueid':{'type':Sequelize[_0x3468('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x3468('0x4')]('account',_0x3468('0x5'),_0x3468('0x6')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x3468('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x3468('0x8')]}}; \ No newline at end of file +var _0x0a46=['STRING','ENUM','agent','queue','DATE','NOW','moment','sequelize'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x0a46,0x6e));var _0x60a4=function(_0x65223a,_0x4c8025){_0x65223a=_0x65223a-0x0;var _0x247e16=_0x0a46[_0x65223a];return _0x247e16;};'use strict';var moment=require(_0x60a4('0x0'));var Sequelize=require(_0x60a4('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x60a4('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x60a4('0x3')]('account',_0x60a4('0x4'),_0x60a4('0x5')),'allowNull':![],'defaultValue':_0x60a4('0x5')},'transferredAt':{'type':Sequelize[_0x60a4('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x60a4('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 5d69d9d..caa260d 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 _0x740a=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','SmsTransferReport','include','findAll','rows','catch','params','options','find','create','body','destroy','describe','html-pdf','eml-format'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x740a,0x175));var _0xa740=function(_0x4b318e,_0x15fe4f){_0x4b318e=_0x4b318e-0x0;var _0x3b6a2f=_0x740a[_0x4b318e];return _0x3b6a2f;};'use strict';var pdf=require(_0xa740('0x0'));var emlformat=require(_0xa740('0x1'));var rimraf=require(_0xa740('0x2'));var zipdir=require(_0xa740('0x3'));var jsonpatch=require(_0xa740('0x4'));var rp=require(_0xa740('0x5'));var moment=require(_0xa740('0x6'));var BPromise=require(_0xa740('0x7'));var Mustache=require('mustache');var util=require(_0xa740('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xa740('0x9'));var ejs=require(_0xa740('0xa'));var fs=require('fs');var _=require(_0xa740('0xb'));var squel=require(_0xa740('0xc'));var crypto=require(_0xa740('0xd'));var jsforce=require(_0xa740('0xe'));var deskjs=require(_0xa740('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa740('0x10'));var Papa=require(_0xa740('0x11'));var Redis=require(_0xa740('0x12'));var authService=require(_0xa740('0x13'));var qs=require(_0xa740('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa740('0x15'));var config=require(_0xa740('0x16'));var licenseUtil=require(_0xa740('0x17'));var db=require(_0xa740('0x18'))['db'];function respondWithStatusCode(_0x4c14fe,_0x48a5fc){_0x48a5fc=_0x48a5fc||0xcc;return function(_0x4c7a9e){if(_0x4c7a9e){return _0x4c14fe[_0xa740('0x19')](_0x48a5fc);}return _0x4c14fe[_0xa740('0x1a')](_0x48a5fc)[_0xa740('0x1b')]();};}function respondWithResult(_0x18b403,_0x1df901){_0x1df901=_0x1df901||0xc8;return function(_0x32ff20){if(_0x32ff20){return _0x18b403[_0xa740('0x1a')](_0x1df901)[_0xa740('0x1c')](_0x32ff20);}};}function respondWithFilteredResult(_0x276d26,_0x54b81b){return function(_0x51737e){if(_0x51737e){var _0x2e806d=_0x51737e[_0xa740('0x1d')],_0x59fd75=_0x54b81b[_0xa740('0x1e')],_0x22ca11=_0x54b81b[_0xa740('0x1e')]+_0x54b81b[_0xa740('0x1f')],_0x455d33;if(_0x22ca11>=_0x2e806d){_0x22ca11=_0x2e806d;_0x455d33=0xc8;}else{_0x455d33=0xce;}_0x276d26[_0xa740('0x1a')](_0x455d33);return _0x276d26[_0xa740('0x20')]('Content-Range',_0x59fd75+'-'+_0x22ca11+'/'+_0x2e806d)['json'](_0x51737e);}return null;};}function patchUpdates(_0x38b567){return function(_0x2909d0){try{jsonpatch[_0xa740('0x21')](_0x2909d0,_0x38b567,!![]);}catch(_0x4f42b1){return BPromise['reject'](_0x4f42b1);}return _0x2909d0[_0xa740('0x22')]();};}function saveUpdates(_0x4ff2f6,_0x220ae5){return function(_0x211f2b){if(_0x211f2b){return _0x211f2b[_0xa740('0x23')](_0x4ff2f6)[_0xa740('0x24')](function(_0x3244d1){return _0x3244d1;});}return null;};}function removeEntity(_0x39b800,_0x1ea2ce){return function(_0xb6ecca){if(_0xb6ecca){return _0xb6ecca['destroy']()[_0xa740('0x24')](function(){_0x39b800[_0xa740('0x1a')](0xcc)[_0xa740('0x1b')]();});}};}function handleEntityNotFound(_0xd6841c,_0x1a3fc4){return function(_0x53d329){if(!_0x53d329){_0xd6841c['sendStatus'](0x194);}return _0x53d329;};}function handleError(_0x26177e,_0x4991aa){_0x4991aa=_0x4991aa||0x1f4;return function(_0x48d47e){logger[_0xa740('0x25')](_0x48d47e[_0xa740('0x26')]);if(_0x48d47e['name']){delete _0x48d47e[_0xa740('0x27')];}_0x26177e[_0xa740('0x1a')](_0x4991aa)['send'](_0x48d47e);};}exports[_0xa740('0x28')]=function(_0x391b9d,_0x33f1e5){var _0x461a9c={},_0x5555db={},_0x4ef898={'count':0x0,'rows':[]};var _0x4696f0=_[_0xa740('0x29')](db['SmsTransferReport'][_0xa740('0x2a')],function(_0x567820){return{'name':_0x567820[_0xa740('0x2b')],'type':_0x567820[_0xa740('0x2c')][_0xa740('0x2d')]};});_0x5555db[_0xa740('0x2e')]=_[_0xa740('0x29')](_0x4696f0,'name');_0x5555db['query']=_[_0xa740('0x2f')](_0x391b9d[_0xa740('0x30')]);_0x5555db[_0xa740('0x31')]=_[_0xa740('0x32')](_0x5555db[_0xa740('0x2e')],_0x5555db['query']);_0x461a9c[_0xa740('0x33')]=_[_0xa740('0x32')](_0x5555db['model'],qs[_0xa740('0x34')](_0x391b9d[_0xa740('0x30')]['fields']));_0x461a9c[_0xa740('0x33')]=_0x461a9c[_0xa740('0x33')][_0xa740('0x35')]?_0x461a9c[_0xa740('0x33')]:_0x5555db[_0xa740('0x2e')];if(!_0x391b9d['query'][_0xa740('0x36')](_0xa740('0x37'))){_0x461a9c[_0xa740('0x1f')]=qs[_0xa740('0x1f')](_0x391b9d[_0xa740('0x30')][_0xa740('0x1f')]);_0x461a9c[_0xa740('0x1e')]=qs[_0xa740('0x1e')](_0x391b9d['query']['offset']);}_0x461a9c[_0xa740('0x38')]=qs[_0xa740('0x39')](_0x391b9d[_0xa740('0x30')][_0xa740('0x39')]);_0x461a9c[_0xa740('0x3a')]=qs[_0xa740('0x31')](_[_0xa740('0x3b')](_0x391b9d[_0xa740('0x30')],_0x5555db[_0xa740('0x31')]),_0x4696f0);if(_0x391b9d[_0xa740('0x30')][_0xa740('0x3c')]){_0x461a9c['where']=_[_0xa740('0x3d')](_0x461a9c['where'],{'$or':_[_0xa740('0x29')](_0x4696f0,function(_0x49ba5b){if(_0x49ba5b[_0xa740('0x2c')]!==_0xa740('0x3e')){var _0x1376a7={};_0x1376a7[_0x49ba5b[_0xa740('0x27')]]={'$like':'%'+_0x391b9d[_0xa740('0x30')][_0xa740('0x3c')]+'%'};return _0x1376a7;}})});}_0x461a9c=_[_0xa740('0x3d')]({},_0x461a9c,_0x391b9d['options']);var _0x26d73d={'where':_0x461a9c[_0xa740('0x3a')]};return db[_0xa740('0x3f')][_0xa740('0x1d')](_0x26d73d)[_0xa740('0x24')](function(_0x14de83){_0x4ef898['count']=_0x14de83;if(_0x391b9d[_0xa740('0x30')]['includeAll']){_0x461a9c[_0xa740('0x40')]=[{'all':!![]}];}return db['SmsTransferReport'][_0xa740('0x41')](_0x461a9c);})['then'](function(_0x3600d1){_0x4ef898[_0xa740('0x42')]=_0x3600d1;return _0x4ef898;})[_0xa740('0x24')](respondWithFilteredResult(_0x33f1e5,_0x461a9c))[_0xa740('0x43')](handleError(_0x33f1e5,null));};exports['show']=function(_0x4a4035,_0x49b0b8){var _0x52141f={'raw':!![],'where':{'id':_0x4a4035[_0xa740('0x44')]['id']}},_0x422bf9={};_0x422bf9[_0xa740('0x2e')]=_['keys'](db[_0xa740('0x3f')][_0xa740('0x2a')]);_0x422bf9[_0xa740('0x30')]=_[_0xa740('0x2f')](_0x4a4035[_0xa740('0x30')]);_0x422bf9[_0xa740('0x31')]=_['intersection'](_0x422bf9['model'],_0x422bf9[_0xa740('0x30')]);_0x52141f[_0xa740('0x33')]=_['intersection'](_0x422bf9[_0xa740('0x2e')],qs[_0xa740('0x34')](_0x4a4035[_0xa740('0x30')][_0xa740('0x34')]));_0x52141f['attributes']=_0x52141f['attributes']['length']?_0x52141f[_0xa740('0x33')]:_0x422bf9[_0xa740('0x2e')];if(_0x4a4035[_0xa740('0x30')]['includeAll']){_0x52141f['include']=[{'all':!![]}];}_0x52141f=_[_0xa740('0x3d')]({},_0x52141f,_0x4a4035[_0xa740('0x45')]);return db[_0xa740('0x3f')][_0xa740('0x46')](_0x52141f)[_0xa740('0x24')](handleEntityNotFound(_0x49b0b8,null))[_0xa740('0x24')](respondWithResult(_0x49b0b8,null))[_0xa740('0x43')](handleError(_0x49b0b8,null));};exports[_0xa740('0x47')]=function(_0x4526f3,_0x24a03){return db['SmsTransferReport']['create'](_0x4526f3[_0xa740('0x48')],{})[_0xa740('0x24')](respondWithResult(_0x24a03,0xc9))[_0xa740('0x43')](handleError(_0x24a03,null));};exports['update']=function(_0x14acd1,_0x4ec0b2){if(_0x14acd1[_0xa740('0x48')]['id']){delete _0x14acd1['body']['id'];}return db[_0xa740('0x3f')][_0xa740('0x46')]({'where':{'id':_0x14acd1[_0xa740('0x44')]['id']}})[_0xa740('0x24')](handleEntityNotFound(_0x4ec0b2,null))[_0xa740('0x24')](saveUpdates(_0x14acd1['body'],null))[_0xa740('0x24')](respondWithResult(_0x4ec0b2,null))['catch'](handleError(_0x4ec0b2,null));};exports[_0xa740('0x49')]=function(_0x437dda,_0x371ff1){return db[_0xa740('0x3f')][_0xa740('0x46')]({'where':{'id':_0x437dda[_0xa740('0x44')]['id']}})['then'](handleEntityNotFound(_0x371ff1,null))['then'](removeEntity(_0x371ff1,null))[_0xa740('0x43')](handleError(_0x371ff1,null));};exports[_0xa740('0x4a')]=function(_0x1adf64,_0x327e1c){return db[_0xa740('0x3f')][_0xa740('0x4a')]()[_0xa740('0x24')](respondWithResult(_0x327e1c,null))[_0xa740('0x43')](handleError(_0x327e1c,null));}; \ No newline at end of file +var _0x2060=['hasOwnProperty','limit','order','where','pick','merge','type','VIRTUAL','options','count','includeAll','rows','catch','params','rawAttributes','find','create','body','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','set','Content-Range','apply','reject','save','update','then','status','error','name','send','index','map','SmsTransferReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x2060,0x1be));var _0x0206=function(_0x12643b,_0xb5f581){_0x12643b=_0x12643b-0x0;var _0x486642=_0x2060[_0x12643b];return _0x486642;};'use strict';var pdf=require(_0x0206('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0206('0x1'));var zipdir=require(_0x0206('0x2'));var jsonpatch=require(_0x0206('0x3'));var rp=require(_0x0206('0x4'));var moment=require('moment');var BPromise=require(_0x0206('0x5'));var Mustache=require(_0x0206('0x6'));var util=require('util');var path=require(_0x0206('0x7'));var sox=require('sox');var csv=require(_0x0206('0x8'));var ejs=require(_0x0206('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0206('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0206('0xb'));var toCsv=require(_0x0206('0x8'));var querystring=require(_0x0206('0xc'));var Papa=require(_0x0206('0xd'));var Redis=require(_0x0206('0xe'));var authService=require(_0x0206('0xf'));var qs=require(_0x0206('0x10'));var as=require(_0x0206('0x11'));var hardwareService=require(_0x0206('0x12'));var logger=require(_0x0206('0x13'))(_0x0206('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0206('0x15'));var db=require(_0x0206('0x16'))['db'];function respondWithStatusCode(_0x58cef1,_0x3e7cc1){_0x3e7cc1=_0x3e7cc1||0xcc;return function(_0x3d4bb6){if(_0x3d4bb6){return _0x58cef1[_0x0206('0x17')](_0x3e7cc1);}return _0x58cef1['status'](_0x3e7cc1)[_0x0206('0x18')]();};}function respondWithResult(_0x430327,_0x1838e0){_0x1838e0=_0x1838e0||0xc8;return function(_0x46acdb){if(_0x46acdb){return _0x430327['status'](_0x1838e0)[_0x0206('0x19')](_0x46acdb);}};}function respondWithFilteredResult(_0x4bedf9,_0x1370bd){return function(_0x1ac4b0){if(_0x1ac4b0){var _0x41a062=_0x1ac4b0['count'],_0x11bc7f=_0x1370bd['offset'],_0x1c1771=_0x1370bd[_0x0206('0x1a')]+_0x1370bd['limit'],_0x26c261;if(_0x1c1771>=_0x41a062){_0x1c1771=_0x41a062;_0x26c261=0xc8;}else{_0x26c261=0xce;}_0x4bedf9['status'](_0x26c261);return _0x4bedf9[_0x0206('0x1b')](_0x0206('0x1c'),_0x11bc7f+'-'+_0x1c1771+'/'+_0x41a062)[_0x0206('0x19')](_0x1ac4b0);}return null;};}function patchUpdates(_0x1bed63){return function(_0x5540e4){try{jsonpatch[_0x0206('0x1d')](_0x5540e4,_0x1bed63,!![]);}catch(_0x43ad08){return BPromise[_0x0206('0x1e')](_0x43ad08);}return _0x5540e4[_0x0206('0x1f')]();};}function saveUpdates(_0x3c189c,_0x41aa22){return function(_0x7ee5a2){if(_0x7ee5a2){return _0x7ee5a2[_0x0206('0x20')](_0x3c189c)['then'](function(_0x5ea4f){return _0x5ea4f;});}return null;};}function removeEntity(_0x5da8a4,_0x5cc687){return function(_0x2a37c7){if(_0x2a37c7){return _0x2a37c7['destroy']()[_0x0206('0x21')](function(){_0x5da8a4[_0x0206('0x22')](0xcc)[_0x0206('0x18')]();});}};}function handleEntityNotFound(_0x4c5452,_0x399f38){return function(_0x1c8ee9){if(!_0x1c8ee9){_0x4c5452[_0x0206('0x17')](0x194);}return _0x1c8ee9;};}function handleError(_0x4c5027,_0x487019){_0x487019=_0x487019||0x1f4;return function(_0x3b9890){logger[_0x0206('0x23')](_0x3b9890['stack']);if(_0x3b9890[_0x0206('0x24')]){delete _0x3b9890[_0x0206('0x24')];}_0x4c5027[_0x0206('0x22')](_0x487019)[_0x0206('0x25')](_0x3b9890);};}exports[_0x0206('0x26')]=function(_0x519a0a,_0x847866){var _0x18513c={},_0xe29e8d={},_0x5ec89c={'count':0x0,'rows':[]};var _0x29405f=_[_0x0206('0x27')](db[_0x0206('0x28')]['rawAttributes'],function(_0xe6320c){return{'name':_0xe6320c[_0x0206('0x29')],'type':_0xe6320c['type'][_0x0206('0x2a')]};});_0xe29e8d[_0x0206('0x2b')]=_[_0x0206('0x27')](_0x29405f,'name');_0xe29e8d[_0x0206('0x2c')]=_[_0x0206('0x2d')](_0x519a0a[_0x0206('0x2c')]);_0xe29e8d[_0x0206('0x2e')]=_[_0x0206('0x2f')](_0xe29e8d[_0x0206('0x2b')],_0xe29e8d[_0x0206('0x2c')]);_0x18513c[_0x0206('0x30')]=_[_0x0206('0x2f')](_0xe29e8d[_0x0206('0x2b')],qs[_0x0206('0x31')](_0x519a0a['query']['fields']));_0x18513c[_0x0206('0x30')]=_0x18513c[_0x0206('0x30')][_0x0206('0x32')]?_0x18513c[_0x0206('0x30')]:_0xe29e8d[_0x0206('0x2b')];if(!_0x519a0a[_0x0206('0x2c')][_0x0206('0x33')]('nolimit')){_0x18513c[_0x0206('0x34')]=qs[_0x0206('0x34')](_0x519a0a[_0x0206('0x2c')][_0x0206('0x34')]);_0x18513c[_0x0206('0x1a')]=qs['offset'](_0x519a0a[_0x0206('0x2c')][_0x0206('0x1a')]);}_0x18513c[_0x0206('0x35')]=qs['sort'](_0x519a0a[_0x0206('0x2c')]['sort']);_0x18513c[_0x0206('0x36')]=qs[_0x0206('0x2e')](_[_0x0206('0x37')](_0x519a0a['query'],_0xe29e8d[_0x0206('0x2e')]),_0x29405f);if(_0x519a0a[_0x0206('0x2c')]['filter']){_0x18513c['where']=_[_0x0206('0x38')](_0x18513c[_0x0206('0x36')],{'$or':_[_0x0206('0x27')](_0x29405f,function(_0x34944c){if(_0x34944c[_0x0206('0x39')]!==_0x0206('0x3a')){var _0x4faa92={};_0x4faa92[_0x34944c[_0x0206('0x24')]]={'$like':'%'+_0x519a0a[_0x0206('0x2c')]['filter']+'%'};return _0x4faa92;}})});}_0x18513c=_['merge']({},_0x18513c,_0x519a0a[_0x0206('0x3b')]);var _0x28c8dc={'where':_0x18513c[_0x0206('0x36')]};return db[_0x0206('0x28')][_0x0206('0x3c')](_0x28c8dc)[_0x0206('0x21')](function(_0x41601e){_0x5ec89c[_0x0206('0x3c')]=_0x41601e;if(_0x519a0a['query'][_0x0206('0x3d')]){_0x18513c['include']=[{'all':!![]}];}return db[_0x0206('0x28')]['findAll'](_0x18513c);})[_0x0206('0x21')](function(_0x3297e7){_0x5ec89c[_0x0206('0x3e')]=_0x3297e7;return _0x5ec89c;})[_0x0206('0x21')](respondWithFilteredResult(_0x847866,_0x18513c))[_0x0206('0x3f')](handleError(_0x847866,null));};exports['show']=function(_0x3d70ae,_0x25c382){var _0x5574e5={'raw':!![],'where':{'id':_0x3d70ae[_0x0206('0x40')]['id']}},_0x1afd1f={};_0x1afd1f[_0x0206('0x2b')]=_[_0x0206('0x2d')](db[_0x0206('0x28')][_0x0206('0x41')]);_0x1afd1f[_0x0206('0x2c')]=_[_0x0206('0x2d')](_0x3d70ae[_0x0206('0x2c')]);_0x1afd1f[_0x0206('0x2e')]=_['intersection'](_0x1afd1f[_0x0206('0x2b')],_0x1afd1f[_0x0206('0x2c')]);_0x5574e5[_0x0206('0x30')]=_[_0x0206('0x2f')](_0x1afd1f[_0x0206('0x2b')],qs[_0x0206('0x31')](_0x3d70ae['query'][_0x0206('0x31')]));_0x5574e5[_0x0206('0x30')]=_0x5574e5[_0x0206('0x30')][_0x0206('0x32')]?_0x5574e5[_0x0206('0x30')]:_0x1afd1f[_0x0206('0x2b')];if(_0x3d70ae['query']['includeAll']){_0x5574e5['include']=[{'all':!![]}];}_0x5574e5=_[_0x0206('0x38')]({},_0x5574e5,_0x3d70ae[_0x0206('0x3b')]);return db[_0x0206('0x28')][_0x0206('0x42')](_0x5574e5)[_0x0206('0x21')](handleEntityNotFound(_0x25c382,null))[_0x0206('0x21')](respondWithResult(_0x25c382,null))[_0x0206('0x3f')](handleError(_0x25c382,null));};exports[_0x0206('0x43')]=function(_0x41bdf2,_0x174d40){return db[_0x0206('0x28')]['create'](_0x41bdf2[_0x0206('0x44')],{})[_0x0206('0x21')](respondWithResult(_0x174d40,0xc9))['catch'](handleError(_0x174d40,null));};exports[_0x0206('0x20')]=function(_0xb17d9f,_0x37f389){if(_0xb17d9f['body']['id']){delete _0xb17d9f['body']['id'];}return db[_0x0206('0x28')][_0x0206('0x42')]({'where':{'id':_0xb17d9f[_0x0206('0x40')]['id']}})[_0x0206('0x21')](handleEntityNotFound(_0x37f389,null))['then'](saveUpdates(_0xb17d9f[_0x0206('0x44')],null))[_0x0206('0x21')](respondWithResult(_0x37f389,null))[_0x0206('0x3f')](handleError(_0x37f389,null));};exports[_0x0206('0x45')]=function(_0xd7176a,_0x1c4ee2){return db[_0x0206('0x28')][_0x0206('0x42')]({'where':{'id':_0xd7176a[_0x0206('0x40')]['id']}})[_0x0206('0x21')](handleEntityNotFound(_0x1c4ee2,null))['then'](removeEntity(_0x1c4ee2,null))[_0x0206('0x3f')](handleError(_0x1c4ee2,null));};exports[_0x0206('0x46')]=function(_0x272996,_0xa4dc5a){return db[_0x0206('0x28')][_0x0206('0x46')]()[_0x0206('0x21')](respondWithResult(_0xa4dc5a,null))['catch'](handleError(_0xa4dc5a,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 82107a2..c07ae83 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 _0xe2fe=['SmsTransferReport','uniqueid','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x2ff480,_0x35ea3d){var _0x229a1c=function(_0x514138){while(--_0x514138){_0x2ff480['push'](_0x2ff480['shift']());}};_0x229a1c(++_0x35ea3d);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'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('./smsTransferReport.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xee2f('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xeff8=['rimraf','../../config/environment','./smsTransferReport.attributes','define','SmsTransferReport','uniqueid','lodash','util','api','moment','bluebird','path'];(function(_0x118bf1,_0x4eafee){var _0x2ae59d=function(_0x270db3){while(--_0x270db3){_0x118bf1['push'](_0x118bf1['shift']());}};_0x2ae59d(++_0x4eafee);}(_0xeff8,0x186));var _0x8eff=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0xeff8[_0xfcbcb8];return _0x1b1f97;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));module['exports']=function(_0x469641,_0xb54063){return _0x469641[_0x8eff('0x9')](_0x8eff('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x8eff('0xb'),'fields':[_0x8eff('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 1a12010..d720290 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 _0xf162=['message','result','catch','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','request','then','info','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','SmsTransferReport,\x20%s,\x20%s'];(function(_0x1b96f0,_0x1248b0){var _0x47b9a5=function(_0x53c6df){while(--_0x53c6df){_0x1b96f0['push'](_0x1b96f0['shift']());}};_0x47b9a5(++_0x1248b0);}(_0xf162,0x1bd));var _0x2f16=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xf162[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2f16('0x0'));var BPromise=require(_0x2f16('0x1'));var rs=require(_0x2f16('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2f16('0x3'));var logger=require('../../config/logger')(_0x2f16('0x4'));var config=require('../../config/environment');var jayson=require(_0x2f16('0x5'));var client=jayson[_0x2f16('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481205,_0x4f3b69,_0x4b3f4f){return new BPromise(function(_0x4f1d28,_0x149bbc){return client[_0x2f16('0x7')](_0x481205,_0x4b3f4f)[_0x2f16('0x8')](function(_0x234930){logger[_0x2f16('0x9')]('SmsTransferReport,\x20%s,\x20%s',_0x4f3b69,_0x2f16('0xa'));logger['debug'](_0x2f16('0xb'),_0x4f3b69,'request\x20sent',JSON['stringify'](_0x234930));if(_0x234930['error']){if(_0x234930[_0x2f16('0xc')]['code']===0x1f4){logger['error'](_0x2f16('0xd'),_0x4f3b69,_0x234930[_0x2f16('0xc')][_0x2f16('0xe')]);return _0x149bbc(_0x234930[_0x2f16('0xc')][_0x2f16('0xe')]);}logger[_0x2f16('0xc')](_0x2f16('0xd'),_0x4f3b69,_0x234930[_0x2f16('0xc')][_0x2f16('0xe')]);return _0x4f1d28(_0x234930[_0x2f16('0xc')][_0x2f16('0xe')]);}else{logger[_0x2f16('0x9')](_0x2f16('0xd'),_0x4f3b69,_0x2f16('0xa'));_0x4f1d28(_0x234930[_0x2f16('0xf')][_0x2f16('0xe')]);}})[_0x2f16('0x10')](function(_0x33398a){logger[_0x2f16('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x4f3b69,_0x33398a);_0x149bbc(_0x33398a);});});} \ No newline at end of file +var _0x8bdc=['code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x5aee64,_0x42642b){var _0x267c8e=function(_0x42ba53){while(--_0x42ba53){_0x5aee64['push'](_0x5aee64['shift']());}};_0x267c8e(++_0x42642b);}(_0x8bdc,0x17e));var _0xc8bd=function(_0x5dc876,_0xb49845){_0x5dc876=_0x5dc876-0x0;var _0x2868ed=_0x8bdc[_0x5dc876];return _0x2868ed;};'use strict';var _=require('lodash');var util=require(_0xc8bd('0x0'));var moment=require('moment');var BPromise=require(_0xc8bd('0x1'));var rs=require(_0xc8bd('0x2'));var fs=require('fs');var Redis=require(_0xc8bd('0x3'));var db=require(_0xc8bd('0x4'))['db'];var utils=require(_0xc8bd('0x5'));var logger=require(_0xc8bd('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc8bd('0x7'));var client=jayson[_0xc8bd('0x8')][_0xc8bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x240b6d,_0x18973c,_0x36c76d){return new BPromise(function(_0x38a3e1,_0x361aa1){return client[_0xc8bd('0xa')](_0x240b6d,_0x36c76d)['then'](function(_0x22a706){logger[_0xc8bd('0xb')](_0xc8bd('0xc'),_0x18973c,_0xc8bd('0xd'));logger[_0xc8bd('0xe')](_0xc8bd('0xf'),_0x18973c,_0xc8bd('0xd'),JSON['stringify'](_0x22a706));if(_0x22a706[_0xc8bd('0x10')]){if(_0x22a706['error'][_0xc8bd('0x11')]===0x1f4){logger[_0xc8bd('0x10')](_0xc8bd('0xc'),_0x18973c,_0x22a706['error']['message']);return _0x361aa1(_0x22a706['error']['message']);}logger[_0xc8bd('0x10')](_0xc8bd('0xc'),_0x18973c,_0x22a706[_0xc8bd('0x10')]['message']);return _0x38a3e1(_0x22a706['error'][_0xc8bd('0x12')]);}else{logger['info'](_0xc8bd('0xc'),_0x18973c,_0xc8bd('0xd'));_0x38a3e1(_0x22a706[_0xc8bd('0x13')]['message']);}})[_0xc8bd('0x14')](function(_0x572ef1){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x18973c,_0x572ef1);_0x361aa1(_0x572ef1);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 6169a4c..c1fe9c7 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 _0x8c0d=['/:id','isAuthenticated','show','/:id/download','download','diskStorage','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x5d122d,_0x2ff259){var _0x52ea11=function(_0x3ade2c){while(--_0x3ade2c){_0x5d122d['push'](_0x5d122d['shift']());}};_0x52ea11(++_0x2ff259);}(_0x8c0d,0x10d));var _0xd8c0=function(_0x46409b,_0x1fe445){_0x46409b=_0x46409b-0x0;var _0x39f5b7=_0x8c0d[_0x46409b];return _0x39f5b7;};'use strict';var multer=require('multer');var util=require(_0xd8c0('0x0'));var path=require(_0xd8c0('0x1'));var timeout=require(_0xd8c0('0x2'));var express=require(_0xd8c0('0x3'));var router=express[_0xd8c0('0x4')]();var auth=require(_0xd8c0('0x5'));var interaction=require(_0xd8c0('0x6'));var config=require(_0xd8c0('0x7'));var controller=require('./sound.controller');router[_0xd8c0('0x8')]('/',auth['isAuthenticated'](),controller[_0xd8c0('0x9')]);router[_0xd8c0('0x8')](_0xd8c0('0xa'),auth[_0xd8c0('0xb')](),controller[_0xd8c0('0xc')]);router[_0xd8c0('0x8')](_0xd8c0('0xd'),auth['isAuthenticated'](),controller[_0xd8c0('0xe')]);var upload=multer({'storage':multer[_0xd8c0('0xf')]({'destination':function(_0x3f3f8f,_0x2cdcfd,_0x9131a4){_0x9131a4(null,path['join'](config['root'],'server/files/sounds/original/'));},'filename':function(_0x45dfd6,_0x185e79,_0x30e35d){_0x185e79[_0xd8c0('0x10')]=_0x185e79[_0xd8c0('0x10')][_0xd8c0('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x30e35d(null,util[_0xd8c0('0x12')](_0xd8c0('0x13'),path[_0xd8c0('0x14')](_0x185e79['originalname'],path[_0xd8c0('0x15')](_0x185e79[_0xd8c0('0x10')])),Date[_0xd8c0('0x16')](),path[_0xd8c0('0x15')](_0x185e79['originalname'])));}})});router[_0xd8c0('0x17')]('/',upload[_0xd8c0('0x18')](_0xd8c0('0x19')),controller[_0xd8c0('0x1a')]);router[_0xd8c0('0x1b')](_0xd8c0('0xa'),auth[_0xd8c0('0xb')](),controller[_0xd8c0('0x1c')]);router['delete'](_0xd8c0('0xa'),auth['isAuthenticated'](),controller[_0xd8c0('0x1d')]);module[_0xd8c0('0x1e')]=router; \ No newline at end of file +var _0x8e37=['delete','multer','path','connect-timeout','express','Router','./sound.controller','get','isAuthenticated','index','show','download','diskStorage','root','server/files/sounds/original/','originalname','format','%s-%s%s','basename','extname','now','file','create','put','/:id','update'];(function(_0x3a3713,_0x115756){var _0x82c5dc=function(_0x715aaf){while(--_0x715aaf){_0x3a3713['push'](_0x3a3713['shift']());}};_0x82c5dc(++_0x115756);}(_0x8e37,0x11f));var _0x78e3=function(_0x34e58e,_0x317f62){_0x34e58e=_0x34e58e-0x0;var _0x327acd=_0x8e37[_0x34e58e];return _0x327acd;};'use strict';var multer=require(_0x78e3('0x0'));var util=require('util');var path=require(_0x78e3('0x1'));var timeout=require(_0x78e3('0x2'));var express=require(_0x78e3('0x3'));var router=express[_0x78e3('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x78e3('0x5'));router[_0x78e3('0x6')]('/',auth[_0x78e3('0x7')](),controller[_0x78e3('0x8')]);router[_0x78e3('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x78e3('0x9')]);router['get']('/:id/download',auth[_0x78e3('0x7')](),controller[_0x78e3('0xa')]);var upload=multer({'storage':multer[_0x78e3('0xb')]({'destination':function(_0x172773,_0x217d75,_0x414575){_0x414575(null,path['join'](config[_0x78e3('0xc')],_0x78e3('0xd')));},'filename':function(_0x3f3eef,_0x52c3ac,_0x2485f0){_0x52c3ac[_0x78e3('0xe')]=_0x52c3ac[_0x78e3('0xe')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2485f0(null,util[_0x78e3('0xf')](_0x78e3('0x10'),path[_0x78e3('0x11')](_0x52c3ac[_0x78e3('0xe')],path[_0x78e3('0x12')](_0x52c3ac[_0x78e3('0xe')])),Date[_0x78e3('0x13')](),path['extname'](_0x52c3ac['originalname'])));}})});router['post']('/',upload['single'](_0x78e3('0x14')),controller[_0x78e3('0x15')]);router[_0x78e3('0x16')](_0x78e3('0x17'),auth[_0x78e3('0x7')](),controller[_0x78e3('0x18')]);router[_0x78e3('0x19')](_0x78e3('0x17'),auth[_0x78e3('0x7')](),controller[_0x78e3('0x19')]);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 c8c6158..4045290 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 _0x0782=['STRING','FLOAT','BIGINT','INTEGER','sequelize','name'];(function(_0x5b03fd,_0x3d5779){var _0x374f5f=function(_0x5d039e){while(--_0x5d039e){_0x5b03fd['push'](_0x5b03fd['shift']());}};_0x374f5f(++_0x3d5779);}(_0x0782,0x88));var _0x2078=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0x0782[_0x5d7227];return _0x15ac55;};'use strict';var Sequelize=require(_0x2078('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x2078('0x1'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x2078('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x2078('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x2078('0x3')]},'original_sampleCount':{'type':Sequelize[_0x2078('0x4')]},'original_channelCount':{'type':Sequelize[_0x2078('0x5')]},'original_bitRate':{'type':Sequelize[_0x2078('0x4')]},'original_sampleRate':{'type':Sequelize[_0x2078('0x5')]},'converted_format':{'type':Sequelize[_0x2078('0x2')]},'converted_duration':{'type':Sequelize[_0x2078('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x2078('0x4')]},'converted_channelCount':{'type':Sequelize[_0x2078('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x6672=['STRING','FLOAT','BIGINT','INTEGER','sequelize','exports'];(function(_0x582689,_0x20c7b4){var _0x1041ca=function(_0x1ff4da){while(--_0x1ff4da){_0x582689['push'](_0x582689['shift']());}};_0x1041ca(++_0x20c7b4);}(_0x6672,0xf4));var _0x2667=function(_0x138b2c,_0x142181){_0x138b2c=_0x138b2c-0x0;var _0xa8b921=_0x6672[_0x138b2c];return _0xa8b921;};'use strict';var Sequelize=require(_0x2667('0x0'));module[_0x2667('0x1')]={'name':{'type':Sequelize[_0x2667('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x2667('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x2667('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x2667('0x3')]},'original_sampleCount':{'type':Sequelize[_0x2667('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x2667('0x2')]},'converted_duration':{'type':Sequelize[_0x2667('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x2667('0x4')]},'converted_channelCount':{'type':Sequelize[_0x2667('0x5')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 98d3d85..8c58444 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 _0xde51=['filename','originalname','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','unlinkSync','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','start','update','description','delete','original_format','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','offset','limit','status','set','Content-Range','json','apply','reject','save','then','destroy','UserProfileResource','stack','name','send','map','Sound','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','download','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','file','extname','basename'];(function(_0x2e8418,_0x58c529){var _0x548fe6=function(_0x2b2877){while(--_0x2b2877){_0x2e8418['push'](_0x2e8418['shift']());}};_0x548fe6(++_0x58c529);}(_0xde51,0xa5));var _0x1de5=function(_0xb5e37f,_0xc624f1){_0xb5e37f=_0xb5e37f-0x0;var _0x23f431=_0xde51[_0xb5e37f];return _0x23f431;};'use strict';var pdf=require(_0x1de5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1de5('0x1'));var zipdir=require(_0x1de5('0x2'));var jsonpatch=require(_0x1de5('0x3'));var rp=require(_0x1de5('0x4'));var moment=require(_0x1de5('0x5'));var BPromise=require(_0x1de5('0x6'));var Mustache=require('mustache');var util=require(_0x1de5('0x7'));var path=require(_0x1de5('0x8'));var sox=require('sox');var csv=require(_0x1de5('0x9'));var ejs=require(_0x1de5('0xa'));var fs=require('fs');var _=require(_0x1de5('0xb'));var squel=require(_0x1de5('0xc'));var crypto=require(_0x1de5('0xd'));var jsforce=require(_0x1de5('0xe'));var deskjs=require(_0x1de5('0xf'));var toCsv=require(_0x1de5('0x9'));var querystring=require(_0x1de5('0x10'));var Papa=require('papaparse');var Redis=require(_0x1de5('0x11'));var authService=require(_0x1de5('0x12'));var qs=require(_0x1de5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1de5('0x14'));var logger=require(_0x1de5('0x15'))(_0x1de5('0x16'));var utils=require(_0x1de5('0x17'));var config=require(_0x1de5('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1de5('0x19'))['db'];function respondWithStatusCode(_0x3e9a0f,_0x54dc83){_0x54dc83=_0x54dc83||0xcc;return function(_0x2576cf){if(_0x2576cf){return _0x3e9a0f[_0x1de5('0x1a')](_0x54dc83);}return _0x3e9a0f['status'](_0x54dc83)[_0x1de5('0x1b')]();};}function respondWithResult(_0x4bec0e,_0x5a538e){_0x5a538e=_0x5a538e||0xc8;return function(_0x2117f6){if(_0x2117f6){return _0x4bec0e['status'](_0x5a538e)['json'](_0x2117f6);}};}function respondWithFilteredResult(_0x56a8c1,_0x472d53){return function(_0x4d6f99){if(_0x4d6f99){var _0x3b4c15=_0x4d6f99['count'],_0x349573=_0x472d53[_0x1de5('0x1c')],_0x6cf47a=_0x472d53[_0x1de5('0x1c')]+_0x472d53[_0x1de5('0x1d')],_0x3ed5bb;if(_0x6cf47a>=_0x3b4c15){_0x6cf47a=_0x3b4c15;_0x3ed5bb=0xc8;}else{_0x3ed5bb=0xce;}_0x56a8c1[_0x1de5('0x1e')](_0x3ed5bb);return _0x56a8c1[_0x1de5('0x1f')](_0x1de5('0x20'),_0x349573+'-'+_0x6cf47a+'/'+_0x3b4c15)[_0x1de5('0x21')](_0x4d6f99);}return null;};}function patchUpdates(_0x27897d){return function(_0xcbf7f4){try{jsonpatch[_0x1de5('0x22')](_0xcbf7f4,_0x27897d,!![]);}catch(_0x4bce46){return BPromise[_0x1de5('0x23')](_0x4bce46);}return _0xcbf7f4[_0x1de5('0x24')]();};}function saveUpdates(_0x7dd218,_0x350845){return function(_0x5e423f){if(_0x5e423f){return _0x5e423f['update'](_0x7dd218)[_0x1de5('0x25')](function(_0x43aed9){return _0x43aed9;});}return null;};}function removeEntity(_0x152483,_0xdf1e23){return function(_0x284451){if(_0x284451){return _0x284451[_0x1de5('0x26')]()[_0x1de5('0x25')](function(){var _0x11079e=_0x284451['get']({'plain':!![]});var _0x1a5040='Sounds';return db[_0x1de5('0x27')]['destroy']({'where':{'type':_0x1a5040,'resourceId':_0x11079e['id']}})[_0x1de5('0x25')](function(){return _0x284451;});})[_0x1de5('0x25')](function(){_0x152483[_0x1de5('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4943ed,_0x23d560){return function(_0x41e1d5){if(!_0x41e1d5){_0x4943ed['sendStatus'](0x194);}return _0x41e1d5;};}function handleError(_0x5c23be,_0x424853){_0x424853=_0x424853||0x1f4;return function(_0x48bc6b){logger['error'](_0x48bc6b[_0x1de5('0x28')]);if(_0x48bc6b['name']){delete _0x48bc6b[_0x1de5('0x29')];}_0x5c23be[_0x1de5('0x1e')](_0x424853)[_0x1de5('0x2a')](_0x48bc6b);};}exports['index']=function(_0x589627,_0x39c9ce){var _0x42a444={},_0x581257={},_0x26ff4a={'count':0x0,'rows':[]};var _0x28fe28=_[_0x1de5('0x2b')](db[_0x1de5('0x2c')]['rawAttributes'],function(_0x3e1853){return{'name':_0x3e1853[_0x1de5('0x2d')],'type':_0x3e1853[_0x1de5('0x2e')][_0x1de5('0x2f')]};});_0x581257[_0x1de5('0x30')]=_[_0x1de5('0x2b')](_0x28fe28,_0x1de5('0x29'));_0x581257[_0x1de5('0x31')]=_[_0x1de5('0x32')](_0x589627[_0x1de5('0x31')]);_0x581257[_0x1de5('0x33')]=_[_0x1de5('0x34')](_0x581257[_0x1de5('0x30')],_0x581257[_0x1de5('0x31')]);_0x42a444[_0x1de5('0x35')]=_[_0x1de5('0x34')](_0x581257[_0x1de5('0x30')],qs[_0x1de5('0x36')](_0x589627[_0x1de5('0x31')][_0x1de5('0x36')]));_0x42a444['attributes']=_0x42a444[_0x1de5('0x35')][_0x1de5('0x37')]?_0x42a444[_0x1de5('0x35')]:_0x581257[_0x1de5('0x30')];if(!_0x589627['query'][_0x1de5('0x38')](_0x1de5('0x39'))){_0x42a444['limit']=qs['limit'](_0x589627['query'][_0x1de5('0x1d')]);_0x42a444[_0x1de5('0x1c')]=qs[_0x1de5('0x1c')](_0x589627['query'][_0x1de5('0x1c')]);}_0x42a444['order']=qs[_0x1de5('0x3a')](_0x589627['query'][_0x1de5('0x3a')]);_0x42a444[_0x1de5('0x3b')]=qs[_0x1de5('0x33')](_[_0x1de5('0x3c')](_0x589627[_0x1de5('0x31')],_0x581257['filters']),_0x28fe28);if(_0x589627['query']['filter']){_0x42a444[_0x1de5('0x3b')]=_[_0x1de5('0x3d')](_0x42a444[_0x1de5('0x3b')],{'$or':_[_0x1de5('0x2b')](_0x28fe28,function(_0x321975){if(_0x321975['type']!==_0x1de5('0x3e')){var _0x38636a={};_0x38636a[_0x321975[_0x1de5('0x29')]]={'$like':'%'+_0x589627[_0x1de5('0x31')][_0x1de5('0x3f')]+'%'};return _0x38636a;}})});}_0x42a444=_[_0x1de5('0x3d')]({},_0x42a444,_0x589627['options']);var _0x1462ee={'where':_0x42a444[_0x1de5('0x3b')]};return db[_0x1de5('0x2c')][_0x1de5('0x40')](_0x1462ee)[_0x1de5('0x25')](function(_0x383852){_0x26ff4a[_0x1de5('0x40')]=_0x383852;if(_0x589627[_0x1de5('0x31')][_0x1de5('0x41')]){_0x42a444[_0x1de5('0x42')]=[{'all':!![]}];}return db[_0x1de5('0x2c')][_0x1de5('0x43')](_0x42a444);})['then'](function(_0x22e3b5){_0x26ff4a[_0x1de5('0x44')]=_0x22e3b5;return _0x26ff4a;})[_0x1de5('0x25')](respondWithFilteredResult(_0x39c9ce,_0x42a444))[_0x1de5('0x45')](handleError(_0x39c9ce,null));};exports[_0x1de5('0x46')]=function(_0x14b0bf,_0x2c6ef2){var _0x4aed48={'raw':!![],'where':{'id':_0x14b0bf[_0x1de5('0x47')]['id']}},_0x46ac5e={};_0x46ac5e[_0x1de5('0x30')]=_['keys'](db[_0x1de5('0x2c')][_0x1de5('0x48')]);_0x46ac5e[_0x1de5('0x31')]=_[_0x1de5('0x32')](_0x14b0bf['query']);_0x46ac5e[_0x1de5('0x33')]=_[_0x1de5('0x34')](_0x46ac5e[_0x1de5('0x30')],_0x46ac5e[_0x1de5('0x31')]);_0x4aed48[_0x1de5('0x35')]=_[_0x1de5('0x34')](_0x46ac5e[_0x1de5('0x30')],qs[_0x1de5('0x36')](_0x14b0bf[_0x1de5('0x31')][_0x1de5('0x36')]));_0x4aed48[_0x1de5('0x35')]=_0x4aed48[_0x1de5('0x35')][_0x1de5('0x37')]?_0x4aed48[_0x1de5('0x35')]:_0x46ac5e[_0x1de5('0x30')];if(_0x14b0bf[_0x1de5('0x31')]['includeAll']){_0x4aed48['include']=[{'all':!![]}];}_0x4aed48=_['merge']({},_0x4aed48,_0x14b0bf[_0x1de5('0x49')]);return db[_0x1de5('0x2c')]['find'](_0x4aed48)[_0x1de5('0x25')](handleEntityNotFound(_0x2c6ef2,null))['then'](respondWithResult(_0x2c6ef2,null))['catch'](handleError(_0x2c6ef2,null));};exports[_0x1de5('0x4a')]=function(_0x5001b3,_0x461ca3,_0x535164){return db[_0x1de5('0x2c')][_0x1de5('0x4b')]({'where':{'id':_0x5001b3[_0x1de5('0x47')]['id']},'attributes':[_0x1de5('0x29'),_0x1de5('0x4c'),_0x1de5('0x4d')],'raw':!![]})[_0x1de5('0x25')](handleEntityNotFound(_0x461ca3,null))[_0x1de5('0x25')](function(_0x4aac18){if(_0x4aac18){if(!fs[_0x1de5('0x4e')](path[_0x1de5('0x4f')](config[_0x1de5('0x50')],_0x1de5('0x51'),_0x4aac18[_0x1de5('0x4c')]+'.'+_0x4aac18['converted_format']))){throw new db[(_0x1de5('0x52'))][(_0x1de5('0x53'))](_0x1de5('0x54'));}return _0x461ca3['download'](path[_0x1de5('0x4f')](config[_0x1de5('0x50')],_0x1de5('0x51'),util[_0x1de5('0x55')]('%s.%s',_0x4aac18[_0x1de5('0x4c')],_0x4aac18[_0x1de5('0x4d')])),util[_0x1de5('0x55')](_0x1de5('0x56'),_0x4aac18[_0x1de5('0x29')],_0x4aac18[_0x1de5('0x4d')]));}return null;})[_0x1de5('0x45')](handleError(_0x461ca3,null));};exports[_0x1de5('0x57')]=function(_0x39b9ab,_0x38b663,_0x204b3a){var _0x509cea={'name':path['basename'](_0x39b9ab[_0x1de5('0x58')]['originalname'],path[_0x1de5('0x59')](_0x39b9ab[_0x1de5('0x58')]['originalname'])),'save_name':path[_0x1de5('0x5a')](_0x39b9ab[_0x1de5('0x58')][_0x1de5('0x5b')],path[_0x1de5('0x59')](_0x39b9ab[_0x1de5('0x58')][_0x1de5('0x5b')])),'original_format':path['extname'](_0x39b9ab['file'][_0x1de5('0x5c')])[_0x1de5('0x5d')](0x1),'converted_format':_0x1de5('0x5e')};var _0x1dd935=path[_0x1de5('0x4f')](config[_0x1de5('0x50')],_0x1de5('0x5f'),_0x39b9ab['file']['filename']);var _0x45b0cb=path[_0x1de5('0x4f')](config[_0x1de5('0x50')],'server/files/sounds/converted',util[_0x1de5('0x55')](_0x1de5('0x56'),path[_0x1de5('0x5a')](_0x39b9ab[_0x1de5('0x58')]['filename'],path[_0x1de5('0x59')](_0x39b9ab[_0x1de5('0x58')][_0x1de5('0x5b')])),_0x509cea[_0x1de5('0x4d')]));logger[_0x1de5('0x60')]('Sound\x20upload\x20filepath:\x20%s',_0x1dd935);logger['info'](_0x1de5('0x61'),_0x45b0cb);try{fs[_0x1de5('0x62')](_0x1dd935,parseInt(_0x1de5('0x63'),0x8));var _0x1c54c5=sox[_0x1de5('0x64')](_0x1dd935,_0x45b0cb,{'sampleRate':0x1f40,'format':_0x1de5('0x5e'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1c54c5['on'](_0x1de5('0x65'),function(_0x3363a6){fs[_0x1de5('0x66')](_0x1dd935);_0x38b663[_0x1de5('0x1e')](0x1f4)[_0x1de5('0x2a')](_0x3363a6);});_0x1c54c5['on']('src',function(_0x18bab4){_0x509cea['original_duration']=isNaN(_0x18bab4[_0x1de5('0x67')])?null:_0x18bab4[_0x1de5('0x67')]*0x3e8;_0x509cea[_0x1de5('0x68')]=isNaN(_0x18bab4[_0x1de5('0x69')])?null:_0x18bab4[_0x1de5('0x69')];_0x509cea[_0x1de5('0x6a')]=isNaN(_0x18bab4[_0x1de5('0x6b')])?null:_0x18bab4[_0x1de5('0x6b')];_0x509cea[_0x1de5('0x6c')]=isNaN(_0x18bab4[_0x1de5('0x6d')])?null:_0x18bab4[_0x1de5('0x6d')];_0x509cea['original_sampleRate']=isNaN(_0x18bab4[_0x1de5('0x6e')])?null:_0x18bab4[_0x1de5('0x6e')];});_0x1c54c5['on']('dest',function(_0x8ba109){_0x509cea[_0x1de5('0x6f')]=isNaN(_0x8ba109[_0x1de5('0x67')])?null:_0x8ba109['duration']*0x3e8;_0x509cea[_0x1de5('0x70')]=isNaN(_0x8ba109[_0x1de5('0x69')])?null:_0x8ba109[_0x1de5('0x69')];_0x509cea['converted_channelCount']=isNaN(_0x8ba109['channelCount'])?null:_0x8ba109[_0x1de5('0x6b')];_0x509cea[_0x1de5('0x71')]=isNaN(_0x8ba109[_0x1de5('0x6d')])?null:_0x8ba109[_0x1de5('0x6d')];_0x509cea[_0x1de5('0x72')]=isNaN(_0x8ba109[_0x1de5('0x6e')])?null:_0x8ba109['sampleRate'];});_0x1c54c5['on'](_0x1de5('0x1b'),function(){fs[_0x1de5('0x62')](_0x45b0cb,parseInt(_0x1de5('0x63'),0x8));return db['Sound'][_0x1de5('0x57')](_0x509cea)[_0x1de5('0x25')](function(_0x4fd419){var _0x3e7509={'role':_0x39b9ab['body'][_0x1de5('0x73')],'userProfileId':_0x39b9ab[_0x1de5('0x74')][_0x1de5('0x75')]};if(!_0x3e7509)throw new Error(_0x1de5('0x76'));if(_0x3e7509['role']===_0x1de5('0x77')){var _0x9fd2b6=_0x4fd419[_0x1de5('0x78')]({'plain':!![]});return db[_0x1de5('0x79')][_0x1de5('0x4b')]({'where':{'name':'Sounds','userProfileId':_0x3e7509[_0x1de5('0x75')]},'raw':!![]})['then'](function(_0x1354a5){if(_0x1354a5&&_0x1354a5[_0x1de5('0x7a')]===0x0){return db[_0x1de5('0x27')][_0x1de5('0x57')]({'name':_0x9fd2b6['name'],'resourceId':_0x9fd2b6['id'],'type':_0x1354a5['name'],'sectionId':_0x1354a5['id']},{})['then'](function(){return _0x4fd419;});}else{return _0x4fd419;}})[_0x1de5('0x45')](function(_0x1a4f31){logger[_0x1de5('0x65')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a4f31);throw _0x1a4f31;});}return _0x4fd419;})[_0x1de5('0x25')](respondWithResult(_0x38b663,null))['catch'](handleError(_0x38b663,null));});_0x1c54c5[_0x1de5('0x7b')]();}catch(_0x15b9c0){_0x38b663[_0x1de5('0x1e')](0x1f4)['send'](_0x15b9c0);}};exports[_0x1de5('0x7c')]=function(_0x2c99d9,_0x6c84eb,_0x1802a2){return db[_0x1de5('0x2c')]['find']({'where':{'id':_0x2c99d9[_0x1de5('0x47')]['id']}})[_0x1de5('0x25')](handleEntityNotFound(_0x6c84eb,null))[_0x1de5('0x25')](saveUpdates(_[_0x1de5('0x3c')](_0x2c99d9[_0x1de5('0x74')],[_0x1de5('0x29'),_0x1de5('0x7d')]),null))[_0x1de5('0x25')](respondWithResult(_0x6c84eb,null))[_0x1de5('0x45')](handleError(_0x6c84eb,null));};exports[_0x1de5('0x7e')]=function(_0x2910f8,_0x48edc8,_0x57e544){return db['Sound']['find']({'where':{'id':_0x2910f8['params']['id']}})[_0x1de5('0x25')](function(_0x39dbc0){if(_0x39dbc0){return _0x39dbc0[_0x1de5('0x26')]();}})[_0x1de5('0x25')](function(_0x53084c){var _0x5c93df=path['join'](config[_0x1de5('0x50')],_0x1de5('0x5f'),util[_0x1de5('0x55')](_0x1de5('0x56'),_0x53084c[_0x1de5('0x4c')],_0x53084c[_0x1de5('0x7f')]));var _0x3501c3=path[_0x1de5('0x4f')](config['root'],_0x1de5('0x51'),util[_0x1de5('0x55')]('%s.%s',_0x53084c['save_name'],_0x53084c['converted_format']));fs[_0x1de5('0x66')](_0x5c93df);fs[_0x1de5('0x66')](_0x3501c3);return _0x53084c;})[_0x1de5('0x25')](function(_0x507ec0){if(_0x507ec0){return _0x48edc8[_0x1de5('0x1e')](0xcc)[_0x1de5('0x1b')]();}})[_0x1de5('0x25')](handleEntityNotFound(_0x48edc8,null))[_0x1de5('0x45')](handleError(_0x48edc8,null));}; \ No newline at end of file +var _0x74c8=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','get','Sounds','UserProfileResource','sendStatus','error','name','send','index','map','type','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','where','filter','merge','Sound','includeAll','include','findAll','rows','catch','show','params','length','options','find','download','save_name','existsSync','join','server/files/sounds/converted','converted_format','Sequelize','ValidationError','format','%s.%s','create','basename','originalname','extname','file','filename','substring','root','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','original_format','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox'];(function(_0x423901,_0x3dd506){var _0x5e367e=function(_0xa52ff8){while(--_0xa52ff8){_0x423901['push'](_0x423901['shift']());}};_0x5e367e(++_0x3dd506);}(_0x74c8,0x16b));var _0x874c=function(_0x4d8742,_0xd8d845){_0x4d8742=_0x4d8742-0x0;var _0x59701d=_0x74c8[_0x4d8742];return _0x59701d;};'use strict';var pdf=require(_0x874c('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x874c('0x1'));var jsonpatch=require(_0x874c('0x2'));var rp=require(_0x874c('0x3'));var moment=require('moment');var BPromise=require(_0x874c('0x4'));var Mustache=require(_0x874c('0x5'));var util=require(_0x874c('0x6'));var path=require(_0x874c('0x7'));var sox=require(_0x874c('0x8'));var csv=require(_0x874c('0x9'));var ejs=require(_0x874c('0xa'));var fs=require('fs');var _=require(_0x874c('0xb'));var squel=require(_0x874c('0xc'));var crypto=require(_0x874c('0xd'));var jsforce=require(_0x874c('0xe'));var deskjs=require(_0x874c('0xf'));var toCsv=require(_0x874c('0x9'));var querystring=require(_0x874c('0x10'));var Papa=require(_0x874c('0x11'));var Redis=require(_0x874c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x874c('0x13'));var as=require(_0x874c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x874c('0x15'))(_0x874c('0x16'));var utils=require(_0x874c('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x874c('0x18'))['db'];function respondWithStatusCode(_0x4bfc41,_0x3dde74){_0x3dde74=_0x3dde74||0xcc;return function(_0x854519){if(_0x854519){return _0x4bfc41['sendStatus'](_0x3dde74);}return _0x4bfc41[_0x874c('0x19')](_0x3dde74)[_0x874c('0x1a')]();};}function respondWithResult(_0x175c8f,_0x4f2b82){_0x4f2b82=_0x4f2b82||0xc8;return function(_0x9be5b4){if(_0x9be5b4){return _0x175c8f[_0x874c('0x19')](_0x4f2b82)[_0x874c('0x1b')](_0x9be5b4);}};}function respondWithFilteredResult(_0x33a6a1,_0x29a4e0){return function(_0x48d67d){if(_0x48d67d){var _0x3ea44a=_0x48d67d[_0x874c('0x1c')],_0x4b9967=_0x29a4e0[_0x874c('0x1d')],_0x4330f2=_0x29a4e0['offset']+_0x29a4e0[_0x874c('0x1e')],_0x5b76ee;if(_0x4330f2>=_0x3ea44a){_0x4330f2=_0x3ea44a;_0x5b76ee=0xc8;}else{_0x5b76ee=0xce;}_0x33a6a1[_0x874c('0x19')](_0x5b76ee);return _0x33a6a1[_0x874c('0x1f')]('Content-Range',_0x4b9967+'-'+_0x4330f2+'/'+_0x3ea44a)[_0x874c('0x1b')](_0x48d67d);}return null;};}function patchUpdates(_0x52600c){return function(_0x3cbb66){try{jsonpatch[_0x874c('0x20')](_0x3cbb66,_0x52600c,!![]);}catch(_0x3bc9f6){return BPromise['reject'](_0x3bc9f6);}return _0x3cbb66[_0x874c('0x21')]();};}function saveUpdates(_0x2e4799,_0x22e5b6){return function(_0x3ab41b){if(_0x3ab41b){return _0x3ab41b[_0x874c('0x22')](_0x2e4799)[_0x874c('0x23')](function(_0x573298){return _0x573298;});}return null;};}function removeEntity(_0x3512e2,_0x4b649e){return function(_0xf68634){if(_0xf68634){return _0xf68634[_0x874c('0x24')]()[_0x874c('0x23')](function(){var _0x42907c=_0xf68634[_0x874c('0x25')]({'plain':!![]});var _0x324e93=_0x874c('0x26');return db[_0x874c('0x27')][_0x874c('0x24')]({'where':{'type':_0x324e93,'resourceId':_0x42907c['id']}})[_0x874c('0x23')](function(){return _0xf68634;});})[_0x874c('0x23')](function(){_0x3512e2[_0x874c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34537c,_0x34854b){return function(_0x2d4119){if(!_0x2d4119){_0x34537c[_0x874c('0x28')](0x194);}return _0x2d4119;};}function handleError(_0x26aad4,_0x2f80cc){_0x2f80cc=_0x2f80cc||0x1f4;return function(_0x538a55){logger[_0x874c('0x29')](_0x538a55['stack']);if(_0x538a55[_0x874c('0x2a')]){delete _0x538a55[_0x874c('0x2a')];}_0x26aad4[_0x874c('0x19')](_0x2f80cc)[_0x874c('0x2b')](_0x538a55);};}exports[_0x874c('0x2c')]=function(_0x191371,_0x594aef){var _0x5f1db6={},_0x38f737={},_0x362acd={'count':0x0,'rows':[]};var _0xeaec32=_[_0x874c('0x2d')](db['Sound']['rawAttributes'],function(_0x312a16){return{'name':_0x312a16['fieldName'],'type':_0x312a16[_0x874c('0x2e')]['key']};});_0x38f737['model']=_[_0x874c('0x2d')](_0xeaec32,_0x874c('0x2a'));_0x38f737['query']=_[_0x874c('0x2f')](_0x191371[_0x874c('0x30')]);_0x38f737[_0x874c('0x31')]=_[_0x874c('0x32')](_0x38f737[_0x874c('0x33')],_0x38f737[_0x874c('0x30')]);_0x5f1db6['attributes']=_['intersection'](_0x38f737[_0x874c('0x33')],qs[_0x874c('0x34')](_0x191371['query'][_0x874c('0x34')]));_0x5f1db6[_0x874c('0x35')]=_0x5f1db6['attributes']['length']?_0x5f1db6['attributes']:_0x38f737['model'];if(!_0x191371['query'][_0x874c('0x36')](_0x874c('0x37'))){_0x5f1db6[_0x874c('0x1e')]=qs[_0x874c('0x1e')](_0x191371[_0x874c('0x30')]['limit']);_0x5f1db6['offset']=qs[_0x874c('0x1d')](_0x191371[_0x874c('0x30')][_0x874c('0x1d')]);}_0x5f1db6[_0x874c('0x38')]=qs['sort'](_0x191371[_0x874c('0x30')]['sort']);_0x5f1db6[_0x874c('0x39')]=qs[_0x874c('0x31')](_['pick'](_0x191371[_0x874c('0x30')],_0x38f737[_0x874c('0x31')]),_0xeaec32);if(_0x191371[_0x874c('0x30')][_0x874c('0x3a')]){_0x5f1db6[_0x874c('0x39')]=_[_0x874c('0x3b')](_0x5f1db6[_0x874c('0x39')],{'$or':_[_0x874c('0x2d')](_0xeaec32,function(_0x1a404c){if(_0x1a404c['type']!=='VIRTUAL'){var _0x58cfa4={};_0x58cfa4[_0x1a404c[_0x874c('0x2a')]]={'$like':'%'+_0x191371[_0x874c('0x30')]['filter']+'%'};return _0x58cfa4;}})});}_0x5f1db6=_['merge']({},_0x5f1db6,_0x191371['options']);var _0x1c70ab={'where':_0x5f1db6[_0x874c('0x39')]};return db[_0x874c('0x3c')][_0x874c('0x1c')](_0x1c70ab)[_0x874c('0x23')](function(_0x1cab12){_0x362acd[_0x874c('0x1c')]=_0x1cab12;if(_0x191371[_0x874c('0x30')][_0x874c('0x3d')]){_0x5f1db6[_0x874c('0x3e')]=[{'all':!![]}];}return db[_0x874c('0x3c')][_0x874c('0x3f')](_0x5f1db6);})[_0x874c('0x23')](function(_0x5d8b6b){_0x362acd[_0x874c('0x40')]=_0x5d8b6b;return _0x362acd;})[_0x874c('0x23')](respondWithFilteredResult(_0x594aef,_0x5f1db6))[_0x874c('0x41')](handleError(_0x594aef,null));};exports[_0x874c('0x42')]=function(_0x3ca565,_0x2fc6bb){var _0x54eaee={'raw':!![],'where':{'id':_0x3ca565[_0x874c('0x43')]['id']}},_0x4e233d={};_0x4e233d[_0x874c('0x33')]=_[_0x874c('0x2f')](db[_0x874c('0x3c')]['rawAttributes']);_0x4e233d[_0x874c('0x30')]=_['keys'](_0x3ca565[_0x874c('0x30')]);_0x4e233d['filters']=_[_0x874c('0x32')](_0x4e233d[_0x874c('0x33')],_0x4e233d[_0x874c('0x30')]);_0x54eaee[_0x874c('0x35')]=_[_0x874c('0x32')](_0x4e233d[_0x874c('0x33')],qs[_0x874c('0x34')](_0x3ca565[_0x874c('0x30')][_0x874c('0x34')]));_0x54eaee['attributes']=_0x54eaee[_0x874c('0x35')][_0x874c('0x44')]?_0x54eaee[_0x874c('0x35')]:_0x4e233d[_0x874c('0x33')];if(_0x3ca565[_0x874c('0x30')][_0x874c('0x3d')]){_0x54eaee[_0x874c('0x3e')]=[{'all':!![]}];}_0x54eaee=_[_0x874c('0x3b')]({},_0x54eaee,_0x3ca565[_0x874c('0x45')]);return db[_0x874c('0x3c')][_0x874c('0x46')](_0x54eaee)['then'](handleEntityNotFound(_0x2fc6bb,null))[_0x874c('0x23')](respondWithResult(_0x2fc6bb,null))[_0x874c('0x41')](handleError(_0x2fc6bb,null));};exports[_0x874c('0x47')]=function(_0x3d74fe,_0x2f830c,_0x1502d6){return db[_0x874c('0x3c')][_0x874c('0x46')]({'where':{'id':_0x3d74fe[_0x874c('0x43')]['id']},'attributes':['name',_0x874c('0x48'),'converted_format'],'raw':!![]})[_0x874c('0x23')](handleEntityNotFound(_0x2f830c,null))[_0x874c('0x23')](function(_0x2c3aec){if(_0x2c3aec){if(!fs[_0x874c('0x49')](path[_0x874c('0x4a')](config['root'],_0x874c('0x4b'),_0x2c3aec[_0x874c('0x48')]+'.'+_0x2c3aec[_0x874c('0x4c')]))){throw new db[(_0x874c('0x4d'))][(_0x874c('0x4e'))]('Sound\x20not\x20found');}return _0x2f830c['download'](path[_0x874c('0x4a')](config['root'],'server/files/sounds/converted',util[_0x874c('0x4f')](_0x874c('0x50'),_0x2c3aec[_0x874c('0x48')],_0x2c3aec['converted_format'])),util[_0x874c('0x4f')](_0x874c('0x50'),_0x2c3aec[_0x874c('0x2a')],_0x2c3aec[_0x874c('0x4c')]));}return null;})['catch'](handleError(_0x2f830c,null));};exports[_0x874c('0x51')]=function(_0x779a0c,_0x25c02c,_0x270252){var _0x5d30e3={'name':path[_0x874c('0x52')](_0x779a0c['file'][_0x874c('0x53')],path[_0x874c('0x54')](_0x779a0c[_0x874c('0x55')][_0x874c('0x53')])),'save_name':path['basename'](_0x779a0c[_0x874c('0x55')]['filename'],path[_0x874c('0x54')](_0x779a0c[_0x874c('0x55')][_0x874c('0x56')])),'original_format':path[_0x874c('0x54')](_0x779a0c[_0x874c('0x55')]['originalname'])[_0x874c('0x57')](0x1),'converted_format':'wav'};var _0x27d190=path['join'](config[_0x874c('0x58')],_0x874c('0x59'),_0x779a0c[_0x874c('0x55')]['filename']);var _0x2b1e2e=path[_0x874c('0x4a')](config['root'],_0x874c('0x4b'),util['format']('%s.%s',path[_0x874c('0x52')](_0x779a0c['file'][_0x874c('0x56')],path[_0x874c('0x54')](_0x779a0c[_0x874c('0x55')]['filename'])),_0x5d30e3[_0x874c('0x4c')]));logger['info'](_0x874c('0x5a'),_0x27d190);logger[_0x874c('0x5b')](_0x874c('0x5c'),_0x2b1e2e);try{fs[_0x874c('0x5d')](_0x27d190,parseInt(_0x874c('0x5e'),0x8));var _0x4bbd32=sox[_0x874c('0x5f')](_0x27d190,_0x2b1e2e,{'sampleRate':0x1f40,'format':_0x874c('0x60'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4bbd32['on'](_0x874c('0x29'),function(_0x55a862){fs[_0x874c('0x61')](_0x27d190);_0x25c02c['status'](0x1f4)['send'](_0x55a862);});_0x4bbd32['on'](_0x874c('0x62'),function(_0x52662b){_0x5d30e3[_0x874c('0x63')]=isNaN(_0x52662b[_0x874c('0x64')])?null:_0x52662b[_0x874c('0x64')]*0x3e8;_0x5d30e3[_0x874c('0x65')]=isNaN(_0x52662b[_0x874c('0x66')])?null:_0x52662b['sampleCount'];_0x5d30e3[_0x874c('0x67')]=isNaN(_0x52662b['channelCount'])?null:_0x52662b[_0x874c('0x68')];_0x5d30e3[_0x874c('0x69')]=isNaN(_0x52662b[_0x874c('0x6a')])?null:_0x52662b[_0x874c('0x6a')];_0x5d30e3[_0x874c('0x6b')]=isNaN(_0x52662b[_0x874c('0x6c')])?null:_0x52662b['sampleRate'];});_0x4bbd32['on'](_0x874c('0x6d'),function(_0x43cd7d){_0x5d30e3[_0x874c('0x6e')]=isNaN(_0x43cd7d['duration'])?null:_0x43cd7d[_0x874c('0x64')]*0x3e8;_0x5d30e3[_0x874c('0x6f')]=isNaN(_0x43cd7d[_0x874c('0x66')])?null:_0x43cd7d[_0x874c('0x66')];_0x5d30e3[_0x874c('0x70')]=isNaN(_0x43cd7d[_0x874c('0x68')])?null:_0x43cd7d[_0x874c('0x68')];_0x5d30e3['converted_bitRate']=isNaN(_0x43cd7d[_0x874c('0x6a')])?null:_0x43cd7d[_0x874c('0x6a')];_0x5d30e3['converted_sampleRate']=isNaN(_0x43cd7d[_0x874c('0x6c')])?null:_0x43cd7d['sampleRate'];});_0x4bbd32['on'](_0x874c('0x1a'),function(){fs['chmodSync'](_0x2b1e2e,parseInt(_0x874c('0x5e'),0x8));return db[_0x874c('0x3c')]['create'](_0x5d30e3)[_0x874c('0x23')](function(_0x4fef19){var _0x412438={'role':_0x779a0c[_0x874c('0x71')]['role'],'userProfileId':_0x779a0c[_0x874c('0x71')][_0x874c('0x72')]};if(!_0x412438)throw new Error(_0x874c('0x73'));if(_0x412438[_0x874c('0x74')]===_0x874c('0x75')){var _0x421dd2=_0x4fef19[_0x874c('0x25')]({'plain':!![]});return db[_0x874c('0x76')][_0x874c('0x46')]({'where':{'name':'Sounds','userProfileId':_0x412438['userProfileId']},'raw':!![]})['then'](function(_0x5b8c93){if(_0x5b8c93&&_0x5b8c93[_0x874c('0x77')]===0x0){return db[_0x874c('0x27')][_0x874c('0x51')]({'name':_0x421dd2[_0x874c('0x2a')],'resourceId':_0x421dd2['id'],'type':_0x5b8c93[_0x874c('0x2a')],'sectionId':_0x5b8c93['id']},{})[_0x874c('0x23')](function(){return _0x4fef19;});}else{return _0x4fef19;}})[_0x874c('0x41')](function(_0x308ea8){logger[_0x874c('0x29')](_0x874c('0x78'),_0x308ea8);throw _0x308ea8;});}return _0x4fef19;})[_0x874c('0x23')](respondWithResult(_0x25c02c,null))[_0x874c('0x41')](handleError(_0x25c02c,null));});_0x4bbd32[_0x874c('0x79')]();}catch(_0x58dd13){_0x25c02c[_0x874c('0x19')](0x1f4)[_0x874c('0x2b')](_0x58dd13);}};exports[_0x874c('0x22')]=function(_0x1a6047,_0x44d300,_0x14e21a){return db[_0x874c('0x3c')][_0x874c('0x46')]({'where':{'id':_0x1a6047[_0x874c('0x43')]['id']}})[_0x874c('0x23')](handleEntityNotFound(_0x44d300,null))[_0x874c('0x23')](saveUpdates(_['pick'](_0x1a6047[_0x874c('0x71')],['name',_0x874c('0x7a')]),null))['then'](respondWithResult(_0x44d300,null))[_0x874c('0x41')](handleError(_0x44d300,null));};exports['delete']=function(_0x28d650,_0x51d6a8,_0x4098b5){return db[_0x874c('0x3c')][_0x874c('0x46')]({'where':{'id':_0x28d650['params']['id']}})[_0x874c('0x23')](function(_0x41412e){if(_0x41412e){return _0x41412e[_0x874c('0x24')]();}})[_0x874c('0x23')](function(_0x3192f4){var _0x20f5e7=path['join'](config[_0x874c('0x58')],_0x874c('0x59'),util['format'](_0x874c('0x50'),_0x3192f4[_0x874c('0x48')],_0x3192f4[_0x874c('0x7b')]));var _0x49476a=path['join'](config['root'],_0x874c('0x4b'),util['format'](_0x874c('0x50'),_0x3192f4[_0x874c('0x48')],_0x3192f4[_0x874c('0x4c')]));fs[_0x874c('0x61')](_0x20f5e7);fs[_0x874c('0x61')](_0x49476a);return _0x3192f4;})[_0x874c('0x23')](function(_0xd7a17){if(_0xd7a17){return _0x51d6a8[_0x874c('0x19')](0xcc)[_0x874c('0x1a')]();}})['then'](handleEntityNotFound(_0x51d6a8,null))[_0x874c('0x41')](handleError(_0x51d6a8,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 7eeb1be..52cd841 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 _0x9ecf=['../../config/environment','./sound.attributes','exports','define','Sound','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0xfc5de,_0x210af9){var _0x25ece8=function(_0x584144){while(--_0x584144){_0xfc5de['push'](_0xfc5de['shift']());}};_0x25ece8(++_0x210af9);}(_0x9ecf,0x131));var _0xf9ec=function(_0x3747ae,_0x408e61){_0x3747ae=_0x3747ae-0x0;var _0x339035=_0x9ecf[_0x3747ae];return _0x339035;};'use strict';var _=require(_0xf9ec('0x0'));var util=require(_0xf9ec('0x1'));var logger=require(_0xf9ec('0x2'))(_0xf9ec('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf9ec('0x4'));var fs=require('fs');var path=require(_0xf9ec('0x5'));var rimraf=require(_0xf9ec('0x6'));var config=require(_0xf9ec('0x7'));var attributes=require(_0xf9ec('0x8'));module[_0xf9ec('0x9')]=function(_0x4dd817,_0x42223c){return _0x4dd817[_0xf9ec('0xa')](_0xf9ec('0xb'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b7e=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util'];(function(_0x2db772,_0x4ce3ad){var _0x41b530=function(_0x2ce2b5){while(--_0x2ce2b5){_0x2db772['push'](_0x2db772['shift']());}};_0x41b530(++_0x4ce3ad);}(_0x7b7e,0xb4));var _0xe7b7=function(_0x445c98,_0x132bf7){_0x445c98=_0x445c98-0x0;var _0x2fe913=_0x7b7e[_0x445c98];return _0x2fe913;};'use strict';var _=require(_0xe7b7('0x0'));var util=require(_0xe7b7('0x1'));var logger=require(_0xe7b7('0x2'))(_0xe7b7('0x3'));var moment=require(_0xe7b7('0x4'));var BPromise=require(_0xe7b7('0x5'));var rp=require(_0xe7b7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe7b7('0x7'));var attributes=require(_0xe7b7('0x8'));module[_0xe7b7('0x9')]=function(_0x37b475,_0x26ac45){return _0x37b475[_0xe7b7('0xa')](_0xe7b7('0xb'),attributes,{'tableName':_0xe7b7('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 d0d19da..5aca2de 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 _0xb171=['jayson/promise','client','http','then','request\x20sent','debug','stringify','error','code','Sound,\x20%s,\x20%s','message','info','catch','find','options','raw','where','attributes','include','map','model','ShowSound','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x1cd840,_0x5ba9fb){var _0x1c3d39=function(_0x35029c){while(--_0x35029c){_0x1cd840['push'](_0x1cd840['shift']());}};_0x1c3d39(++_0x5ba9fb);}(_0xb171,0x1ba));var _0x1b17=function(_0x431e06,_0x50638a){_0x431e06=_0x431e06-0x0;var _0x427c63=_0xb171[_0x431e06];return _0x427c63;};'use strict';var _=require(_0x1b17('0x0'));var util=require('util');var moment=require(_0x1b17('0x1'));var BPromise=require(_0x1b17('0x2'));var rs=require(_0x1b17('0x3'));var fs=require('fs');var Redis=require(_0x1b17('0x4'));var db=require(_0x1b17('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1b17('0x6'))('rpc');var config=require(_0x1b17('0x7'));var jayson=require(_0x1b17('0x8'));var client=jayson[_0x1b17('0x9')][_0x1b17('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x404098,_0x23d265,_0x317818){return new BPromise(function(_0x2b3bf,_0x171735){return client['request'](_0x404098,_0x317818)[_0x1b17('0xb')](function(_0x3d3fdf){logger['info']('Sound,\x20%s,\x20%s',_0x23d265,_0x1b17('0xc'));logger[_0x1b17('0xd')]('Sound,\x20%s,\x20%s,\x20%s',_0x23d265,_0x1b17('0xc'),JSON[_0x1b17('0xe')](_0x3d3fdf));if(_0x3d3fdf[_0x1b17('0xf')]){if(_0x3d3fdf[_0x1b17('0xf')][_0x1b17('0x10')]===0x1f4){logger[_0x1b17('0xf')](_0x1b17('0x11'),_0x23d265,_0x3d3fdf['error'][_0x1b17('0x12')]);return _0x171735(_0x3d3fdf[_0x1b17('0xf')]['message']);}logger[_0x1b17('0xf')](_0x1b17('0x11'),_0x23d265,_0x3d3fdf[_0x1b17('0xf')]['message']);return _0x2b3bf(_0x3d3fdf[_0x1b17('0xf')]['message']);}else{logger[_0x1b17('0x13')](_0x1b17('0x11'),_0x23d265,_0x1b17('0xc'));_0x2b3bf(_0x3d3fdf['result'][_0x1b17('0x12')]);}})[_0x1b17('0x14')](function(_0x336c89){logger[_0x1b17('0xf')](_0x1b17('0x11'),_0x23d265,_0x336c89);_0x171735(_0x336c89);});});}exports['ShowSound']=function(_0x313cd3){var _0x24618f=this;return new Promise(function(_0x178c2f,_0x1f967b){return db['Sound'][_0x1b17('0x15')]({'raw':_0x313cd3[_0x1b17('0x16')]?_0x313cd3[_0x1b17('0x16')][_0x1b17('0x17')]===undefined?!![]:![]:!![],'where':_0x313cd3[_0x1b17('0x16')]?_0x313cd3[_0x1b17('0x16')][_0x1b17('0x18')]||null:null,'attributes':_0x313cd3[_0x1b17('0x16')]?_0x313cd3[_0x1b17('0x16')][_0x1b17('0x19')]||null:null,'include':_0x313cd3[_0x1b17('0x16')]?_0x313cd3[_0x1b17('0x16')][_0x1b17('0x1a')]?_['map'](_0x313cd3[_0x1b17('0x16')][_0x1b17('0x1a')],function(_0x3ba6e2){return{'model':db[_0x3ba6e2['model']],'as':_0x3ba6e2['as'],'attributes':_0x3ba6e2[_0x1b17('0x19')],'include':_0x3ba6e2[_0x1b17('0x1a')]?_['map'](_0x3ba6e2[_0x1b17('0x1a')],function(_0xdf036b){return{'model':db[_0xdf036b['model']],'as':_0xdf036b['as'],'attributes':_0xdf036b[_0x1b17('0x19')],'include':_0xdf036b[_0x1b17('0x1a')]?_[_0x1b17('0x1b')](_0xdf036b[_0x1b17('0x1a')],function(_0x360d02){return{'model':db[_0x360d02[_0x1b17('0x1c')]],'as':_0x360d02['as'],'attributes':_0x360d02[_0x1b17('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1b17('0xb')](function(_0x490849){logger[_0x1b17('0x13')](_0x1b17('0x1d'),_0x313cd3);logger[_0x1b17('0xd')](_0x1b17('0x1d'),_0x313cd3,JSON['stringify'](_0x490849));_0x178c2f(_0x490849);})[_0x1b17('0x14')](function(_0x22901a){logger[_0x1b17('0xf')](_0x1b17('0x1d'),_0x22901a[_0x1b17('0x12')],_0x313cd3);_0x1f967b(_0x24618f[_0x1b17('0xf')](0x1f4,_0x22901a[_0x1b17('0x12')]));});});}; \ No newline at end of file +var _0x4ab2=['attributes','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','ShowSound','raw','options','where','include','map','model'];(function(_0x37d4ec,_0x326e2e){var _0x5d31f7=function(_0x32205c){while(--_0x32205c){_0x37d4ec['push'](_0x37d4ec['shift']());}};_0x5d31f7(++_0x326e2e);}(_0x4ab2,0x123));var _0x24ab=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x4ab2[_0x42bdad];return _0x122626;};'use strict';var _=require('lodash');var util=require(_0x24ab('0x0'));var moment=require(_0x24ab('0x1'));var BPromise=require(_0x24ab('0x2'));var rs=require(_0x24ab('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x24ab('0x4'))('rpc');var config=require(_0x24ab('0x5'));var jayson=require(_0x24ab('0x6'));var client=jayson[_0x24ab('0x7')][_0x24ab('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x305027,_0x1c5c28,_0x1e349b){return new BPromise(function(_0x2f41fc,_0x42e12c){return client['request'](_0x305027,_0x1e349b)[_0x24ab('0x9')](function(_0x49e834){logger[_0x24ab('0xa')](_0x24ab('0xb'),_0x1c5c28,'request\x20sent');logger[_0x24ab('0xc')](_0x24ab('0xd'),_0x1c5c28,_0x24ab('0xe'),JSON[_0x24ab('0xf')](_0x49e834));if(_0x49e834['error']){if(_0x49e834['error'][_0x24ab('0x10')]===0x1f4){logger[_0x24ab('0x11')](_0x24ab('0xb'),_0x1c5c28,_0x49e834[_0x24ab('0x11')][_0x24ab('0x12')]);return _0x42e12c(_0x49e834[_0x24ab('0x11')][_0x24ab('0x12')]);}logger[_0x24ab('0x11')]('Sound,\x20%s,\x20%s',_0x1c5c28,_0x49e834[_0x24ab('0x11')][_0x24ab('0x12')]);return _0x2f41fc(_0x49e834[_0x24ab('0x11')][_0x24ab('0x12')]);}else{logger[_0x24ab('0xa')](_0x24ab('0xb'),_0x1c5c28,_0x24ab('0xe'));_0x2f41fc(_0x49e834[_0x24ab('0x13')][_0x24ab('0x12')]);}})[_0x24ab('0x14')](function(_0x10e329){logger[_0x24ab('0x11')](_0x24ab('0xb'),_0x1c5c28,_0x10e329);_0x42e12c(_0x10e329);});});}exports[_0x24ab('0x15')]=function(_0x4ade48){var _0x47fb5d=this;return new Promise(function(_0x5eea12,_0x26e8b4){return db['Sound']['find']({'raw':_0x4ade48['options']?_0x4ade48['options'][_0x24ab('0x16')]===undefined?!![]:![]:!![],'where':_0x4ade48[_0x24ab('0x17')]?_0x4ade48['options'][_0x24ab('0x18')]||null:null,'attributes':_0x4ade48[_0x24ab('0x17')]?_0x4ade48[_0x24ab('0x17')]['attributes']||null:null,'include':_0x4ade48['options']?_0x4ade48[_0x24ab('0x17')][_0x24ab('0x19')]?_[_0x24ab('0x1a')](_0x4ade48[_0x24ab('0x17')]['include'],function(_0x350016){return{'model':db[_0x350016[_0x24ab('0x1b')]],'as':_0x350016['as'],'attributes':_0x350016[_0x24ab('0x1c')],'include':_0x350016[_0x24ab('0x19')]?_[_0x24ab('0x1a')](_0x350016[_0x24ab('0x19')],function(_0x2c2956){return{'model':db[_0x2c2956[_0x24ab('0x1b')]],'as':_0x2c2956['as'],'attributes':_0x2c2956[_0x24ab('0x1c')],'include':_0x2c2956['include']?_[_0x24ab('0x1a')](_0x2c2956['include'],function(_0x1c2cf7){return{'model':db[_0x1c2cf7[_0x24ab('0x1b')]],'as':_0x1c2cf7['as'],'attributes':_0x1c2cf7[_0x24ab('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x554a0b){logger[_0x24ab('0xa')](_0x24ab('0x15'),_0x4ade48);logger['debug'](_0x24ab('0x15'),_0x4ade48,JSON[_0x24ab('0xf')](_0x554a0b));_0x5eea12(_0x554a0b);})[_0x24ab('0x14')](function(_0x5792ac){logger[_0x24ab('0x11')](_0x24ab('0x15'),_0x5792ac[_0x24ab('0x12')],_0x4ade48);_0x26e8b4(_0x47fb5d[_0x24ab('0x11')](0x1f4,_0x5792ac['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index af869da..b0d95b1 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 _0x3071=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','create','put','update'];(function(_0x497da3,_0x1f85cd){var _0x3fb05a=function(_0x3e292b){while(--_0x3e292b){_0x497da3['push'](_0x497da3['shift']());}};_0x3fb05a(++_0x1f85cd);}(_0x3071,0xf3));var _0x1307=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x3071[_0x3d42d8];return _0x27fc41;};'use strict';var multer=require(_0x1307('0x0'));var util=require(_0x1307('0x1'));var path=require(_0x1307('0x2'));var timeout=require(_0x1307('0x3'));var express=require(_0x1307('0x4'));var router=express['Router']();var auth=require(_0x1307('0x5'));var interaction=require(_0x1307('0x6'));var config=require(_0x1307('0x7'));var controller=require(_0x1307('0x8'));router[_0x1307('0x9')]('/',auth[_0x1307('0xa')](),controller[_0x1307('0xb')]);router[_0x1307('0x9')](_0x1307('0xc'),auth['isAuthenticated'](),controller[_0x1307('0xd')]);router['post']('/',auth[_0x1307('0xa')](),controller[_0x1307('0xe')]);router[_0x1307('0xf')](_0x1307('0xc'),auth[_0x1307('0xa')](),controller[_0x1307('0x10')]);router[_0x1307('0x11')](_0x1307('0xc'),auth[_0x1307('0xa')](),controller[_0x1307('0x12')]);module[_0x1307('0x13')]=router; \ No newline at end of file +var _0xa703=['create','put','update','exports','multer','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x14a5bf,_0x143ce8){var _0x5c07ac=function(_0x18eb20){while(--_0x18eb20){_0x14a5bf['push'](_0x14a5bf['shift']());}};_0x5c07ac(++_0x143ce8);}(_0xa703,0x194));var _0x3a70=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa703[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x3a70('0x0'));var util=require('util');var path=require(_0x3a70('0x1'));var timeout=require(_0x3a70('0x2'));var express=require('express');var router=express[_0x3a70('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x3a70('0x4'));var config=require(_0x3a70('0x5'));var controller=require('./squareMessage.controller');router[_0x3a70('0x6')]('/',auth[_0x3a70('0x7')](),controller[_0x3a70('0x8')]);router[_0x3a70('0x6')](_0x3a70('0x9'),auth[_0x3a70('0x7')](),controller[_0x3a70('0xa')]);router[_0x3a70('0xb')]('/',auth[_0x3a70('0x7')](),controller[_0x3a70('0xc')]);router[_0x3a70('0xd')](_0x3a70('0x9'),auth[_0x3a70('0x7')](),controller[_0x3a70('0xe')]);router['delete'](_0x3a70('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x3a70('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 1d69022..221399e 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 _0x3937=['out','sequelize','STRING','TEXT','ENUM'];(function(_0x644ecd,_0x397f36){var _0x1c66ce=function(_0x4cf42b){while(--_0x4cf42b){_0x644ecd['push'](_0x644ecd['shift']());}};_0x1c66ce(++_0x397f36);}(_0x3937,0xbf));var _0x7393=function(_0x407edf,_0x4b19a1){_0x407edf=_0x407edf-0x0;var _0x291409=_0x3937[_0x407edf];return _0x291409;};'use strict';var Sequelize=require(_0x7393('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7393('0x1')]},'body':{'type':Sequelize[_0x7393('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x7393('0x3')]('in','out'),'defaultValue':_0x7393('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x7393('0x2')]}}; \ No newline at end of file +var _0x4bc3=['sequelize','exports','TEXT','medium','out','STRING'];(function(_0x526d9a,_0x2e7077){var _0x300700=function(_0x34486a){while(--_0x34486a){_0x526d9a['push'](_0x526d9a['shift']());}};_0x300700(++_0x2e7077);}(_0x4bc3,0x16e));var _0x34bc=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x4bc3[_0x4e7d25];return _0x526fe6;};'use strict';var Sequelize=require(_0x34bc('0x0'));module[_0x34bc('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x34bc('0x2')](_0x34bc('0x3')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x34bc('0x4')),'defaultValue':_0x34bc('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x34bc('0x5')]},'providerResponse':{'type':Sequelize[_0x34bc('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 4bfe61f..48a7a34 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 _0x14e0=['lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','name','send','index','map','SquareMessage','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','length','options','find','create','body','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x5eee9d,_0x20c152){var _0x3690bc=function(_0x390a19){while(--_0x390a19){_0x5eee9d['push'](_0x5eee9d['shift']());}};_0x3690bc(++_0x20c152);}(_0x14e0,0x1ee));var _0x014e=function(_0x34ad72,_0x1e43f6){_0x34ad72=_0x34ad72-0x0;var _0x5c9aa8=_0x14e0[_0x34ad72];return _0x5c9aa8;};'use strict';var pdf=require(_0x014e('0x0'));var emlformat=require(_0x014e('0x1'));var rimraf=require(_0x014e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x014e('0x3'));var moment=require(_0x014e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x014e('0x5'));var util=require(_0x014e('0x6'));var path=require(_0x014e('0x7'));var sox=require(_0x014e('0x8'));var csv=require(_0x014e('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x014e('0xa'));var squel=require(_0x014e('0xb'));var crypto=require(_0x014e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x014e('0xd'));var toCsv=require(_0x014e('0x9'));var querystring=require(_0x014e('0xe'));var Papa=require(_0x014e('0xf'));var Redis=require(_0x014e('0x10'));var authService=require(_0x014e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x014e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x014e('0x13'));var utils=require(_0x014e('0x14'));var config=require(_0x014e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x014e('0x16'))['db'];function respondWithStatusCode(_0x45afef,_0x3714be){_0x3714be=_0x3714be||0xcc;return function(_0x3c629b){if(_0x3c629b){return _0x45afef[_0x014e('0x17')](_0x3714be);}return _0x45afef[_0x014e('0x18')](_0x3714be)[_0x014e('0x19')]();};}function respondWithResult(_0x2a3073,_0x4ad7da){_0x4ad7da=_0x4ad7da||0xc8;return function(_0x1ee808){if(_0x1ee808){return _0x2a3073[_0x014e('0x18')](_0x4ad7da)['json'](_0x1ee808);}};}function respondWithFilteredResult(_0x25d26c,_0x181b80){return function(_0x5927ba){if(_0x5927ba){var _0x4d1322=_0x5927ba[_0x014e('0x1a')],_0x54b6ee=_0x181b80['offset'],_0x505760=_0x181b80[_0x014e('0x1b')]+_0x181b80[_0x014e('0x1c')],_0x413941;if(_0x505760>=_0x4d1322){_0x505760=_0x4d1322;_0x413941=0xc8;}else{_0x413941=0xce;}_0x25d26c[_0x014e('0x18')](_0x413941);return _0x25d26c[_0x014e('0x1d')](_0x014e('0x1e'),_0x54b6ee+'-'+_0x505760+'/'+_0x4d1322)[_0x014e('0x1f')](_0x5927ba);}return null;};}function patchUpdates(_0x13299b){return function(_0x2fd238){try{jsonpatch[_0x014e('0x20')](_0x2fd238,_0x13299b,!![]);}catch(_0x23cfa4){return BPromise[_0x014e('0x21')](_0x23cfa4);}return _0x2fd238[_0x014e('0x22')]();};}function saveUpdates(_0x24a474,_0x49cf53){return function(_0x4f5a9f){if(_0x4f5a9f){return _0x4f5a9f[_0x014e('0x23')](_0x24a474)[_0x014e('0x24')](function(_0x11df15){return _0x11df15;});}return null;};}function removeEntity(_0xfeabc,_0x100458){return function(_0x1fbc56){if(_0x1fbc56){return _0x1fbc56[_0x014e('0x25')]()[_0x014e('0x24')](function(){_0xfeabc[_0x014e('0x18')](0xcc)[_0x014e('0x19')]();});}};}function handleEntityNotFound(_0x242c88,_0x2b971b){return function(_0x441d42){if(!_0x441d42){_0x242c88[_0x014e('0x17')](0x194);}return _0x441d42;};}function handleError(_0xbb4888,_0x3c7d0f){_0x3c7d0f=_0x3c7d0f||0x1f4;return function(_0x2436e8){logger['error'](_0x2436e8['stack']);if(_0x2436e8[_0x014e('0x26')]){delete _0x2436e8['name'];}_0xbb4888['status'](_0x3c7d0f)[_0x014e('0x27')](_0x2436e8);};}exports[_0x014e('0x28')]=function(_0x24d9d3,_0x2d3452){var _0x2ee9aa={},_0x46c1ff={},_0x34e567={'count':0x0,'rows':[]};var _0x2050eb=_[_0x014e('0x29')](db[_0x014e('0x2a')]['rawAttributes'],function(_0x18b472){return{'name':_0x18b472[_0x014e('0x2b')],'type':_0x18b472[_0x014e('0x2c')][_0x014e('0x2d')]};});_0x46c1ff[_0x014e('0x2e')]=_[_0x014e('0x29')](_0x2050eb,_0x014e('0x26'));_0x46c1ff['query']=_[_0x014e('0x2f')](_0x24d9d3[_0x014e('0x30')]);_0x46c1ff[_0x014e('0x31')]=_[_0x014e('0x32')](_0x46c1ff[_0x014e('0x2e')],_0x46c1ff[_0x014e('0x30')]);_0x2ee9aa['attributes']=_[_0x014e('0x32')](_0x46c1ff[_0x014e('0x2e')],qs[_0x014e('0x33')](_0x24d9d3[_0x014e('0x30')][_0x014e('0x33')]));_0x2ee9aa[_0x014e('0x34')]=_0x2ee9aa[_0x014e('0x34')]['length']?_0x2ee9aa[_0x014e('0x34')]:_0x46c1ff[_0x014e('0x2e')];if(!_0x24d9d3[_0x014e('0x30')][_0x014e('0x35')](_0x014e('0x36'))){_0x2ee9aa[_0x014e('0x1c')]=qs[_0x014e('0x1c')](_0x24d9d3[_0x014e('0x30')]['limit']);_0x2ee9aa[_0x014e('0x1b')]=qs[_0x014e('0x1b')](_0x24d9d3[_0x014e('0x30')][_0x014e('0x1b')]);}_0x2ee9aa[_0x014e('0x37')]=qs[_0x014e('0x38')](_0x24d9d3[_0x014e('0x30')][_0x014e('0x38')]);_0x2ee9aa[_0x014e('0x39')]=qs[_0x014e('0x31')](_[_0x014e('0x3a')](_0x24d9d3[_0x014e('0x30')],_0x46c1ff[_0x014e('0x31')]),_0x2050eb);if(_0x24d9d3[_0x014e('0x30')][_0x014e('0x3b')]){_0x2ee9aa[_0x014e('0x39')]=_[_0x014e('0x3c')](_0x2ee9aa['where'],{'$or':_[_0x014e('0x29')](_0x2050eb,function(_0x21894d){if(_0x21894d[_0x014e('0x2c')]!=='VIRTUAL'){var _0x426f93={};_0x426f93[_0x21894d[_0x014e('0x26')]]={'$like':'%'+_0x24d9d3[_0x014e('0x30')]['filter']+'%'};return _0x426f93;}})});}_0x2ee9aa=_['merge']({},_0x2ee9aa,_0x24d9d3['options']);var _0xd54032={'where':_0x2ee9aa['where']};return db[_0x014e('0x2a')][_0x014e('0x1a')](_0xd54032)[_0x014e('0x24')](function(_0x223f94){_0x34e567[_0x014e('0x1a')]=_0x223f94;if(_0x24d9d3[_0x014e('0x30')][_0x014e('0x3d')]){_0x2ee9aa[_0x014e('0x3e')]=[{'all':!![]}];}return db['SquareMessage']['findAll'](_0x2ee9aa);})[_0x014e('0x24')](function(_0x1640c0){_0x34e567[_0x014e('0x3f')]=_0x1640c0;return _0x34e567;})['then'](respondWithFilteredResult(_0x2d3452,_0x2ee9aa))[_0x014e('0x40')](handleError(_0x2d3452,null));};exports[_0x014e('0x41')]=function(_0x58cc95,_0x111d91){var _0x265a74={'raw':!![],'where':{'id':_0x58cc95[_0x014e('0x42')]['id']}},_0x2a1f17={};_0x2a1f17[_0x014e('0x2e')]=_['keys'](db[_0x014e('0x2a')]['rawAttributes']);_0x2a1f17[_0x014e('0x30')]=_[_0x014e('0x2f')](_0x58cc95['query']);_0x2a1f17[_0x014e('0x31')]=_[_0x014e('0x32')](_0x2a1f17['model'],_0x2a1f17[_0x014e('0x30')]);_0x265a74['attributes']=_[_0x014e('0x32')](_0x2a1f17[_0x014e('0x2e')],qs['fields'](_0x58cc95['query']['fields']));_0x265a74[_0x014e('0x34')]=_0x265a74['attributes'][_0x014e('0x43')]?_0x265a74['attributes']:_0x2a1f17[_0x014e('0x2e')];if(_0x58cc95[_0x014e('0x30')][_0x014e('0x3d')]){_0x265a74[_0x014e('0x3e')]=[{'all':!![]}];}_0x265a74=_['merge']({},_0x265a74,_0x58cc95[_0x014e('0x44')]);return db[_0x014e('0x2a')][_0x014e('0x45')](_0x265a74)[_0x014e('0x24')](handleEntityNotFound(_0x111d91,null))['then'](respondWithResult(_0x111d91,null))[_0x014e('0x40')](handleError(_0x111d91,null));};exports['create']=function(_0x597340,_0x50a529){return db[_0x014e('0x2a')][_0x014e('0x46')](_0x597340[_0x014e('0x47')],{})[_0x014e('0x24')](respondWithResult(_0x50a529,0xc9))[_0x014e('0x40')](handleError(_0x50a529,null));};exports[_0x014e('0x23')]=function(_0x4cad7b,_0x35a9f){if(_0x4cad7b['body']['id']){delete _0x4cad7b[_0x014e('0x47')]['id'];}return db[_0x014e('0x2a')][_0x014e('0x45')]({'where':{'id':_0x4cad7b[_0x014e('0x42')]['id']}})[_0x014e('0x24')](handleEntityNotFound(_0x35a9f,null))[_0x014e('0x24')](saveUpdates(_0x4cad7b[_0x014e('0x47')],null))[_0x014e('0x24')](respondWithResult(_0x35a9f,null))[_0x014e('0x40')](handleError(_0x35a9f,null));};exports['destroy']=function(_0x473941,_0x1f7d62){return db['SquareMessage'][_0x014e('0x45')]({'where':{'id':_0x473941[_0x014e('0x42')]['id']}})[_0x014e('0x24')](handleEntityNotFound(_0x1f7d62,null))['then'](removeEntity(_0x1f7d62,null))[_0x014e('0x40')](handleError(_0x1f7d62,null));}; \ No newline at end of file +var _0x31db=['params','include','options','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','squel','crypto','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','map','rawAttributes','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','filter','merge','includeAll','SquareMessage','findAll','rows','show'];(function(_0x24721a,_0x1ac53c){var _0x6a9880=function(_0x558dc8){while(--_0x558dc8){_0x24721a['push'](_0x24721a['shift']());}};_0x6a9880(++_0x1ac53c);}(_0x31db,0x103));var _0xb31d=function(_0x4b4d43,_0x1590f7){_0x4b4d43=_0x4b4d43-0x0;var _0x5706ba=_0x31db[_0x4b4d43];return _0x5706ba;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb31d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb31d('0x1'));var jsonpatch=require(_0xb31d('0x2'));var rp=require(_0xb31d('0x3'));var moment=require('moment');var BPromise=require(_0xb31d('0x4'));var Mustache=require('mustache');var util=require(_0xb31d('0x5'));var path=require(_0xb31d('0x6'));var sox=require('sox');var csv=require(_0xb31d('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb31d('0x8'));var crypto=require(_0xb31d('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb31d('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb31d('0xa'));var qs=require('../../components/parsers/qs');var as=require(_0xb31d('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb31d('0xc'));var utils=require(_0xb31d('0xd'));var config=require(_0xb31d('0xe'));var licenseUtil=require(_0xb31d('0xf'));var db=require(_0xb31d('0x10'))['db'];function respondWithStatusCode(_0x5f2e65,_0x350e03){_0x350e03=_0x350e03||0xcc;return function(_0x14b94d){if(_0x14b94d){return _0x5f2e65[_0xb31d('0x11')](_0x350e03);}return _0x5f2e65['status'](_0x350e03)[_0xb31d('0x12')]();};}function respondWithResult(_0x272ba7,_0x3eef10){_0x3eef10=_0x3eef10||0xc8;return function(_0x42b656){if(_0x42b656){return _0x272ba7[_0xb31d('0x13')](_0x3eef10)['json'](_0x42b656);}};}function respondWithFilteredResult(_0x212ebf,_0x594b36){return function(_0x1d7925){if(_0x1d7925){var _0x3b8f4e=_0x1d7925[_0xb31d('0x14')],_0x574810=_0x594b36['offset'],_0x35ca53=_0x594b36['offset']+_0x594b36['limit'],_0x517b03;if(_0x35ca53>=_0x3b8f4e){_0x35ca53=_0x3b8f4e;_0x517b03=0xc8;}else{_0x517b03=0xce;}_0x212ebf['status'](_0x517b03);return _0x212ebf['set'](_0xb31d('0x15'),_0x574810+'-'+_0x35ca53+'/'+_0x3b8f4e)['json'](_0x1d7925);}return null;};}function patchUpdates(_0x56d22c){return function(_0x272def){try{jsonpatch[_0xb31d('0x16')](_0x272def,_0x56d22c,!![]);}catch(_0x1d6b13){return BPromise[_0xb31d('0x17')](_0x1d6b13);}return _0x272def[_0xb31d('0x18')]();};}function saveUpdates(_0x16944c,_0x58a734){return function(_0x24790d){if(_0x24790d){return _0x24790d[_0xb31d('0x19')](_0x16944c)[_0xb31d('0x1a')](function(_0x5c7a19){return _0x5c7a19;});}return null;};}function removeEntity(_0x275138,_0x5a7d8a){return function(_0x5bc97a){if(_0x5bc97a){return _0x5bc97a[_0xb31d('0x1b')]()[_0xb31d('0x1a')](function(){_0x275138[_0xb31d('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fe260,_0x1911c6){return function(_0x57fa90){if(!_0x57fa90){_0x1fe260[_0xb31d('0x11')](0x194);}return _0x57fa90;};}function handleError(_0x318e50,_0x81a7fc){_0x81a7fc=_0x81a7fc||0x1f4;return function(_0x150591){logger['error'](_0x150591[_0xb31d('0x1c')]);if(_0x150591[_0xb31d('0x1d')]){delete _0x150591[_0xb31d('0x1d')];}_0x318e50[_0xb31d('0x13')](_0x81a7fc)['send'](_0x150591);};}exports['index']=function(_0x55ac46,_0x4215e0){var _0x45efe1={},_0x456925={},_0x39a8d0={'count':0x0,'rows':[]};var _0x80aec3=_[_0xb31d('0x1e')](db['SquareMessage'][_0xb31d('0x1f')],function(_0x40f8a8){return{'name':_0x40f8a8['fieldName'],'type':_0x40f8a8[_0xb31d('0x20')]['key']};});_0x456925['model']=_['map'](_0x80aec3,_0xb31d('0x1d'));_0x456925[_0xb31d('0x21')]=_[_0xb31d('0x22')](_0x55ac46['query']);_0x456925[_0xb31d('0x23')]=_[_0xb31d('0x24')](_0x456925['model'],_0x456925[_0xb31d('0x21')]);_0x45efe1[_0xb31d('0x25')]=_['intersection'](_0x456925[_0xb31d('0x26')],qs[_0xb31d('0x27')](_0x55ac46[_0xb31d('0x21')]['fields']));_0x45efe1[_0xb31d('0x25')]=_0x45efe1[_0xb31d('0x25')][_0xb31d('0x28')]?_0x45efe1[_0xb31d('0x25')]:_0x456925[_0xb31d('0x26')];if(!_0x55ac46[_0xb31d('0x21')][_0xb31d('0x29')](_0xb31d('0x2a'))){_0x45efe1[_0xb31d('0x2b')]=qs[_0xb31d('0x2b')](_0x55ac46['query'][_0xb31d('0x2b')]);_0x45efe1['offset']=qs[_0xb31d('0x2c')](_0x55ac46[_0xb31d('0x21')][_0xb31d('0x2c')]);}_0x45efe1[_0xb31d('0x2d')]=qs[_0xb31d('0x2e')](_0x55ac46[_0xb31d('0x21')]['sort']);_0x45efe1[_0xb31d('0x2f')]=qs['filters'](_[_0xb31d('0x30')](_0x55ac46[_0xb31d('0x21')],_0x456925[_0xb31d('0x23')]),_0x80aec3);if(_0x55ac46[_0xb31d('0x21')]['filter']){_0x45efe1[_0xb31d('0x2f')]=_['merge'](_0x45efe1[_0xb31d('0x2f')],{'$or':_[_0xb31d('0x1e')](_0x80aec3,function(_0x15208f){if(_0x15208f[_0xb31d('0x20')]!=='VIRTUAL'){var _0x3b02fc={};_0x3b02fc[_0x15208f['name']]={'$like':'%'+_0x55ac46[_0xb31d('0x21')][_0xb31d('0x31')]+'%'};return _0x3b02fc;}})});}_0x45efe1=_[_0xb31d('0x32')]({},_0x45efe1,_0x55ac46['options']);var _0x1dab17={'where':_0x45efe1['where']};return db['SquareMessage'][_0xb31d('0x14')](_0x1dab17)[_0xb31d('0x1a')](function(_0x30f2bc){_0x39a8d0[_0xb31d('0x14')]=_0x30f2bc;if(_0x55ac46['query'][_0xb31d('0x33')]){_0x45efe1['include']=[{'all':!![]}];}return db[_0xb31d('0x34')][_0xb31d('0x35')](_0x45efe1);})['then'](function(_0xaea887){_0x39a8d0[_0xb31d('0x36')]=_0xaea887;return _0x39a8d0;})['then'](respondWithFilteredResult(_0x4215e0,_0x45efe1))['catch'](handleError(_0x4215e0,null));};exports[_0xb31d('0x37')]=function(_0x487561,_0x216e46){var _0x3e8af2={'raw':!![],'where':{'id':_0x487561[_0xb31d('0x38')]['id']}},_0x5d53a3={};_0x5d53a3[_0xb31d('0x26')]=_['keys'](db['SquareMessage'][_0xb31d('0x1f')]);_0x5d53a3[_0xb31d('0x21')]=_[_0xb31d('0x22')](_0x487561[_0xb31d('0x21')]);_0x5d53a3['filters']=_['intersection'](_0x5d53a3[_0xb31d('0x26')],_0x5d53a3[_0xb31d('0x21')]);_0x3e8af2[_0xb31d('0x25')]=_[_0xb31d('0x24')](_0x5d53a3[_0xb31d('0x26')],qs[_0xb31d('0x27')](_0x487561[_0xb31d('0x21')][_0xb31d('0x27')]));_0x3e8af2[_0xb31d('0x25')]=_0x3e8af2[_0xb31d('0x25')][_0xb31d('0x28')]?_0x3e8af2[_0xb31d('0x25')]:_0x5d53a3[_0xb31d('0x26')];if(_0x487561['query']['includeAll']){_0x3e8af2[_0xb31d('0x39')]=[{'all':!![]}];}_0x3e8af2=_[_0xb31d('0x32')]({},_0x3e8af2,_0x487561[_0xb31d('0x3a')]);return db['SquareMessage'][_0xb31d('0x3b')](_0x3e8af2)[_0xb31d('0x1a')](handleEntityNotFound(_0x216e46,null))[_0xb31d('0x1a')](respondWithResult(_0x216e46,null))[_0xb31d('0x3c')](handleError(_0x216e46,null));};exports[_0xb31d('0x3d')]=function(_0x50fc79,_0x4c4379){return db[_0xb31d('0x34')][_0xb31d('0x3d')](_0x50fc79[_0xb31d('0x3e')],{})['then'](respondWithResult(_0x4c4379,0xc9))[_0xb31d('0x3c')](handleError(_0x4c4379,null));};exports[_0xb31d('0x19')]=function(_0x344cef,_0x55853f){if(_0x344cef[_0xb31d('0x3e')]['id']){delete _0x344cef[_0xb31d('0x3e')]['id'];}return db[_0xb31d('0x34')][_0xb31d('0x3b')]({'where':{'id':_0x344cef['params']['id']}})[_0xb31d('0x1a')](handleEntityNotFound(_0x55853f,null))[_0xb31d('0x1a')](saveUpdates(_0x344cef[_0xb31d('0x3e')],null))[_0xb31d('0x1a')](respondWithResult(_0x55853f,null))['catch'](handleError(_0x55853f,null));};exports['destroy']=function(_0x2acc17,_0x253bfe){return db[_0xb31d('0x34')][_0xb31d('0x3b')]({'where':{'id':_0x2acc17['params']['id']}})[_0xb31d('0x1a')](handleEntityNotFound(_0x253bfe,null))[_0xb31d('0x1a')](removeEntity(_0x253bfe,null))[_0xb31d('0x3c')](handleError(_0x253bfe,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 46d554f..10fb215 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 _0x431d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareMessage.attributes','exports','define','SquareMessage','square_messages','util'];(function(_0x22ad2d,_0x5172c6){var _0x5638f8=function(_0x3d5d5f){while(--_0x3d5d5f){_0x22ad2d['push'](_0x22ad2d['shift']());}};_0x5638f8(++_0x5172c6);}(_0x431d,0x19f));var _0xd431=function(_0x1417c6,_0x194309){_0x1417c6=_0x1417c6-0x0;var _0x44db97=_0x431d[_0x1417c6];return _0x44db97;};'use strict';var _=require('lodash');var util=require(_0xd431('0x0'));var logger=require(_0xd431('0x1'))(_0xd431('0x2'));var moment=require(_0xd431('0x3'));var BPromise=require(_0xd431('0x4'));var rp=require(_0xd431('0x5'));var fs=require('fs');var path=require(_0xd431('0x6'));var rimraf=require(_0xd431('0x7'));var config=require('../../config/environment');var attributes=require(_0xd431('0x8'));module[_0xd431('0x9')]=function(_0x41b33a,_0x10ba41){return _0x41b33a[_0xd431('0xa')](_0xd431('0xb'),attributes,{'tableName':_0xd431('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd63=['path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','lodash','util','moment','bluebird','request-promise'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xfd63,0xcc));var _0x3fd6=function(_0x4b9246,_0x43d4b4){_0x4b9246=_0x4b9246-0x0;var _0x50e770=_0xfd63[_0x4b9246];return _0x50e770;};'use strict';var _=require(_0x3fd6('0x0'));var util=require(_0x3fd6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3fd6('0x2'));var BPromise=require(_0x3fd6('0x3'));var rp=require(_0x3fd6('0x4'));var fs=require('fs');var path=require(_0x3fd6('0x5'));var rimraf=require(_0x3fd6('0x6'));var config=require(_0x3fd6('0x7'));var attributes=require(_0x3fd6('0x8'));module[_0x3fd6('0x9')]=function(_0x68538f,_0x3797f0){return _0x68538f[_0x3fd6('0xa')]('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index a68c782..e01fe7f 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 _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x41db72,_0x3bb8ff){var _0x1f1620=function(_0x424e7f){while(--_0x424e7f){_0x41db72['push'](_0x41db72['shift']());}};_0x1f1620(++_0x3bb8ff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file +var _0xa9e0=['message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x148887,_0x330bc5){var _0x196872=function(_0x3aa9ff){while(--_0x3aa9ff){_0x148887['push'](_0x148887['shift']());}};_0x196872(++_0x330bc5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['CreateSquareMessage']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![]})[_0x0a9e('0x19')](function(_0x105080){logger['info'](_0x0a9e('0x1a'),_0x459eb1);logger[_0x0a9e('0xd')]('CreateSquareMessage',_0x459eb1,JSON[_0x0a9e('0x1b')](_0x105080));_0x106033(_0x105080);})['catch'](function(_0x588269){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x588269[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x588269['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 1a7317c..a92a2b5 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 _0xfdaa=['/:id','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','show','/:id/test','test','post','create','put'];(function(_0x1a232b,_0x43a48d){var _0x1ff2bf=function(_0x376f51){while(--_0x376f51){_0x1a232b['push'](_0x1a232b['shift']());}};_0x1ff2bf(++_0x43a48d);}(_0xfdaa,0x12a));var _0xafda=function(_0x19efbc,_0x10b7d7){_0x19efbc=_0x19efbc-0x0;var _0x205c5e=_0xfdaa[_0x19efbc];return _0x205c5e;};'use strict';var multer=require(_0xafda('0x0'));var util=require('util');var path=require(_0xafda('0x1'));var timeout=require(_0xafda('0x2'));var express=require(_0xafda('0x3'));var router=express[_0xafda('0x4')]();var auth=require(_0xafda('0x5'));var interaction=require(_0xafda('0x6'));var config=require(_0xafda('0x7'));var controller=require('./squareOdbc.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xafda('0x8')]);router[_0xafda('0x9')]('/:id',auth[_0xafda('0xa')](),controller[_0xafda('0xb')]);router[_0xafda('0x9')](_0xafda('0xc'),auth[_0xafda('0xa')](),timeout('15s'),controller[_0xafda('0xd')]);router[_0xafda('0xe')]('/',auth[_0xafda('0xa')](),controller[_0xafda('0xf')]);router[_0xafda('0x10')](_0xafda('0x11'),auth[_0xafda('0xa')](),controller[_0xafda('0x12')]);router[_0xafda('0x13')]('/:id',auth[_0xafda('0xa')](),controller['destroy']);module[_0xafda('0x14')]=router; \ No newline at end of file +var _0x330c=['/:id','show','15s','test','post','create','put','update','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','isAuthenticated','index','get'];(function(_0x18e0bf,_0x2b3088){var _0x13c438=function(_0x377a84){while(--_0x377a84){_0x18e0bf['push'](_0x18e0bf['shift']());}};_0x13c438(++_0x2b3088);}(_0x330c,0x1c3));var _0xc330=function(_0x2b5b9c,_0x48c1fe){_0x2b5b9c=_0x2b5b9c-0x0;var _0x359604=_0x330c[_0x2b5b9c];return _0x359604;};'use strict';var multer=require('multer');var util=require(_0xc330('0x0'));var path=require(_0xc330('0x1'));var timeout=require('connect-timeout');var express=require(_0xc330('0x2'));var router=express['Router']();var auth=require(_0xc330('0x3'));var interaction=require(_0xc330('0x4'));var config=require('../../config/environment');var controller=require(_0xc330('0x5'));router['get']('/',auth[_0xc330('0x6')](),controller[_0xc330('0x7')]);router[_0xc330('0x8')](_0xc330('0x9'),auth[_0xc330('0x6')](),controller[_0xc330('0xa')]);router[_0xc330('0x8')]('/:id/test',auth[_0xc330('0x6')](),timeout(_0xc330('0xb')),controller[_0xc330('0xc')]);router[_0xc330('0xd')]('/',auth['isAuthenticated'](),controller[_0xc330('0xe')]);router[_0xc330('0xf')](_0xc330('0x9'),auth[_0xc330('0x6')](),controller[_0xc330('0x10')]);router[_0xc330('0x11')]('/:id',auth[_0xc330('0x6')](),controller[_0xc330('0x12')]);module[_0xc330('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 1644796..8dbaae4 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 _0x8eac=['name','STRING'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x8eac,0x121));var _0xc8ea=function(_0x17fd72,_0x2b8254){_0x17fd72=_0x17fd72-0x0;var _0xa8d8c6=_0x8eac[_0x17fd72];return _0xa8d8c6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc8ea('0x0')],'unique':_0xc8ea('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0xc8ea('0x0')]},'description':{'type':Sequelize[_0xc8ea('0x0')]}}; \ No newline at end of file +var _0x18e1=['sequelize','exports','STRING','name'];(function(_0x40d1a9,_0x12ddc4){var _0x5bed4c=function(_0x436585){while(--_0x436585){_0x40d1a9['push'](_0x40d1a9['shift']());}};_0x5bed4c(++_0x12ddc4);}(_0x18e1,0x16c));var _0x118e=function(_0x45fed4,_0x1fec47){_0x45fed4=_0x45fed4-0x0;var _0x5b5447=_0x18e1[_0x45fed4];return _0x5b5447;};'use strict';var Sequelize=require(_0x118e('0x0'));module[_0x118e('0x1')]={'name':{'type':Sequelize[_0x118e('0x2')],'unique':_0x118e('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x118e('0x2')]},'description':{'type':Sequelize[_0x118e('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 4327c08..22e62be 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 _0xe263=['api','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','set','Content-Range','reject','save','update','then','ODBC','UserProfileResource','error','name','send','index','map','SquareOdbc','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','filter','merge','options','count','include','rows','catch','show','params','includeAll','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','destroy','dsn','odbc','openSync','closeSync','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x4c3fbb,_0x6fce04){var _0x2e7b3b=function(_0x423537){while(--_0x423537){_0x4c3fbb['push'](_0x4c3fbb['shift']());}};_0x2e7b3b(++_0x6fce04);}(_0xe263,0x92));var _0x3e26=function(_0x76dc4f,_0x5018f9){_0x76dc4f=_0x76dc4f-0x0;var _0x357c86=_0xe263[_0x76dc4f];return _0x357c86;};'use strict';var pdf=require(_0x3e26('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3e26('0x1'));var zipdir=require(_0x3e26('0x2'));var jsonpatch=require(_0x3e26('0x3'));var rp=require(_0x3e26('0x4'));var moment=require(_0x3e26('0x5'));var BPromise=require(_0x3e26('0x6'));var Mustache=require(_0x3e26('0x7'));var util=require(_0x3e26('0x8'));var path=require('path');var sox=require(_0x3e26('0x9'));var csv=require(_0x3e26('0xa'));var ejs=require(_0x3e26('0xb'));var fs=require('fs');var _=require(_0x3e26('0xc'));var squel=require(_0x3e26('0xd'));var crypto=require('crypto');var jsforce=require(_0x3e26('0xe'));var deskjs=require(_0x3e26('0xf'));var toCsv=require(_0x3e26('0xa'));var querystring=require(_0x3e26('0x10'));var Papa=require(_0x3e26('0x11'));var Redis=require(_0x3e26('0x12'));var authService=require(_0x3e26('0x13'));var qs=require(_0x3e26('0x14'));var as=require(_0x3e26('0x15'));var hardwareService=require(_0x3e26('0x16'));var logger=require(_0x3e26('0x17'))(_0x3e26('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3e26('0x19'));var db=require(_0x3e26('0x1a'))['db'];function respondWithStatusCode(_0x169715,_0x36065d){_0x36065d=_0x36065d||0xcc;return function(_0x18903a){if(_0x18903a){return _0x169715[_0x3e26('0x1b')](_0x36065d);}return _0x169715['status'](_0x36065d)[_0x3e26('0x1c')]();};}function respondWithResult(_0xfd9db9,_0xe04371){_0xe04371=_0xe04371||0xc8;return function(_0x184b73){if(_0x184b73){return _0xfd9db9[_0x3e26('0x1d')](_0xe04371)['json'](_0x184b73);}};}function respondWithFilteredResult(_0x318fe3,_0x45d4f8){return function(_0x2b15cb){if(_0x2b15cb){var _0x5f338e=_0x2b15cb['count'],_0x48e188=_0x45d4f8[_0x3e26('0x1e')],_0x5b03d0=_0x45d4f8[_0x3e26('0x1e')]+_0x45d4f8[_0x3e26('0x1f')],_0x291d8a;if(_0x5b03d0>=_0x5f338e){_0x5b03d0=_0x5f338e;_0x291d8a=0xc8;}else{_0x291d8a=0xce;}_0x318fe3['status'](_0x291d8a);return _0x318fe3[_0x3e26('0x20')](_0x3e26('0x21'),_0x48e188+'-'+_0x5b03d0+'/'+_0x5f338e)['json'](_0x2b15cb);}return null;};}function patchUpdates(_0x463a0d){return function(_0x59b2ad){try{jsonpatch['apply'](_0x59b2ad,_0x463a0d,!![]);}catch(_0xca6398){return BPromise[_0x3e26('0x22')](_0xca6398);}return _0x59b2ad[_0x3e26('0x23')]();};}function saveUpdates(_0x32adc2,_0x5d2ad2){return function(_0x5b5197){if(_0x5b5197){return _0x5b5197[_0x3e26('0x24')](_0x32adc2)[_0x3e26('0x25')](function(_0x5348c3){return _0x5348c3;});}return null;};}function removeEntity(_0x33803a,_0x305ae5){return function(_0x164752){if(_0x164752){return _0x164752['destroy']()['then'](function(){var _0x1b46d4=_0x164752['get']({'plain':!![]});var _0x57b66e=_0x3e26('0x26');return db[_0x3e26('0x27')]['destroy']({'where':{'type':_0x57b66e,'resourceId':_0x1b46d4['id']}})[_0x3e26('0x25')](function(){return _0x164752;});})[_0x3e26('0x25')](function(){_0x33803a[_0x3e26('0x1d')](0xcc)[_0x3e26('0x1c')]();});}};}function handleEntityNotFound(_0x2d2156,_0x3f55e9){return function(_0x1ad477){if(!_0x1ad477){_0x2d2156[_0x3e26('0x1b')](0x194);}return _0x1ad477;};}function handleError(_0x216c8a,_0x80a111){_0x80a111=_0x80a111||0x1f4;return function(_0x129742){logger[_0x3e26('0x28')](_0x129742['stack']);if(_0x129742[_0x3e26('0x29')]){delete _0x129742[_0x3e26('0x29')];}_0x216c8a[_0x3e26('0x1d')](_0x80a111)[_0x3e26('0x2a')](_0x129742);};}exports[_0x3e26('0x2b')]=function(_0x55f90e,_0x3399f0){var _0x409ea6={},_0x1fbecc={},_0x4b674b={'count':0x0,'rows':[]};var _0x5858b3=_[_0x3e26('0x2c')](db[_0x3e26('0x2d')][_0x3e26('0x2e')],function(_0x15b1cf){return{'name':_0x15b1cf[_0x3e26('0x2f')],'type':_0x15b1cf['type'][_0x3e26('0x30')]};});_0x1fbecc[_0x3e26('0x31')]=_[_0x3e26('0x2c')](_0x5858b3,_0x3e26('0x29'));_0x1fbecc[_0x3e26('0x32')]=_[_0x3e26('0x33')](_0x55f90e[_0x3e26('0x32')]);_0x1fbecc[_0x3e26('0x34')]=_[_0x3e26('0x35')](_0x1fbecc[_0x3e26('0x31')],_0x1fbecc[_0x3e26('0x32')]);_0x409ea6['attributes']=_[_0x3e26('0x35')](_0x1fbecc[_0x3e26('0x31')],qs[_0x3e26('0x36')](_0x55f90e[_0x3e26('0x32')][_0x3e26('0x36')]));_0x409ea6['attributes']=_0x409ea6[_0x3e26('0x37')][_0x3e26('0x38')]?_0x409ea6[_0x3e26('0x37')]:_0x1fbecc[_0x3e26('0x31')];if(!_0x55f90e[_0x3e26('0x32')]['hasOwnProperty']('nolimit')){_0x409ea6[_0x3e26('0x1f')]=qs['limit'](_0x55f90e[_0x3e26('0x32')][_0x3e26('0x1f')]);_0x409ea6['offset']=qs[_0x3e26('0x1e')](_0x55f90e[_0x3e26('0x32')][_0x3e26('0x1e')]);}_0x409ea6[_0x3e26('0x39')]=qs[_0x3e26('0x3a')](_0x55f90e[_0x3e26('0x32')][_0x3e26('0x3a')]);_0x409ea6[_0x3e26('0x3b')]=qs['filters'](_['pick'](_0x55f90e['query'],_0x1fbecc[_0x3e26('0x34')]),_0x5858b3);if(_0x55f90e[_0x3e26('0x32')][_0x3e26('0x3c')]){_0x409ea6['where']=_['merge'](_0x409ea6['where'],{'$or':_[_0x3e26('0x2c')](_0x5858b3,function(_0x269d0a){if(_0x269d0a['type']!=='VIRTUAL'){var _0x153b15={};_0x153b15[_0x269d0a[_0x3e26('0x29')]]={'$like':'%'+_0x55f90e['query'][_0x3e26('0x3c')]+'%'};return _0x153b15;}})});}_0x409ea6=_[_0x3e26('0x3d')]({},_0x409ea6,_0x55f90e[_0x3e26('0x3e')]);var _0x4ca0a8={'where':_0x409ea6[_0x3e26('0x3b')]};return db[_0x3e26('0x2d')]['count'](_0x4ca0a8)[_0x3e26('0x25')](function(_0x2bab12){_0x4b674b[_0x3e26('0x3f')]=_0x2bab12;if(_0x55f90e['query']['includeAll']){_0x409ea6[_0x3e26('0x40')]=[{'all':!![]}];}return db[_0x3e26('0x2d')]['findAll'](_0x409ea6);})[_0x3e26('0x25')](function(_0x115fcf){_0x4b674b[_0x3e26('0x41')]=_0x115fcf;return _0x4b674b;})[_0x3e26('0x25')](respondWithFilteredResult(_0x3399f0,_0x409ea6))[_0x3e26('0x42')](handleError(_0x3399f0,null));};exports[_0x3e26('0x43')]=function(_0x363fb6,_0x283ccf){var _0x414b9a={'raw':!![],'where':{'id':_0x363fb6[_0x3e26('0x44')]['id']}},_0x2a2bb7={};_0x2a2bb7[_0x3e26('0x31')]=_[_0x3e26('0x33')](db[_0x3e26('0x2d')][_0x3e26('0x2e')]);_0x2a2bb7['query']=_[_0x3e26('0x33')](_0x363fb6[_0x3e26('0x32')]);_0x2a2bb7['filters']=_['intersection'](_0x2a2bb7[_0x3e26('0x31')],_0x2a2bb7['query']);_0x414b9a[_0x3e26('0x37')]=_[_0x3e26('0x35')](_0x2a2bb7['model'],qs[_0x3e26('0x36')](_0x363fb6['query']['fields']));_0x414b9a[_0x3e26('0x37')]=_0x414b9a[_0x3e26('0x37')][_0x3e26('0x38')]?_0x414b9a[_0x3e26('0x37')]:_0x2a2bb7['model'];if(_0x363fb6[_0x3e26('0x32')][_0x3e26('0x45')]){_0x414b9a[_0x3e26('0x40')]=[{'all':!![]}];}_0x414b9a=_[_0x3e26('0x3d')]({},_0x414b9a,_0x363fb6['options']);return db[_0x3e26('0x2d')][_0x3e26('0x46')](_0x414b9a)[_0x3e26('0x25')](handleEntityNotFound(_0x283ccf,null))[_0x3e26('0x25')](respondWithResult(_0x283ccf,null))['catch'](handleError(_0x283ccf,null));};exports['create']=function(_0x242043,_0x36f0bf){return db[_0x3e26('0x2d')][_0x3e26('0x47')](_0x242043[_0x3e26('0x48')],{})[_0x3e26('0x25')](function(_0x2911dd){var _0x2c344a=_0x242043['user'][_0x3e26('0x49')]({'plain':!![]});if(!_0x2c344a)throw new Error(_0x3e26('0x4a'));if(_0x2c344a[_0x3e26('0x4b')]===_0x3e26('0x4c')){var _0x40e9df=_0x2911dd['get']({'plain':!![]});var _0x4816a9=_0x3e26('0x26');return db[_0x3e26('0x4d')][_0x3e26('0x46')]({'where':{'name':_0x4816a9,'userProfileId':_0x2c344a[_0x3e26('0x4e')]},'raw':!![]})['then'](function(_0x33c50d){if(_0x33c50d&&_0x33c50d[_0x3e26('0x4f')]===0x0){return db[_0x3e26('0x27')][_0x3e26('0x47')]({'name':_0x40e9df[_0x3e26('0x29')],'resourceId':_0x40e9df['id'],'type':_0x33c50d[_0x3e26('0x29')],'sectionId':_0x33c50d['id']},{})['then'](function(){return _0x2911dd;});}else{return _0x2911dd;}})[_0x3e26('0x42')](function(_0x1ecf2a){logger[_0x3e26('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ecf2a);throw _0x1ecf2a;});}return _0x2911dd;})['then'](respondWithResult(_0x36f0bf,0xc9))['catch'](handleError(_0x36f0bf,null));};exports[_0x3e26('0x24')]=function(_0x3c650c,_0x5948e9){if(_0x3c650c['body']['id']){delete _0x3c650c[_0x3e26('0x48')]['id'];}return db[_0x3e26('0x2d')]['find']({'where':{'id':_0x3c650c[_0x3e26('0x44')]['id']}})[_0x3e26('0x25')](handleEntityNotFound(_0x5948e9,null))[_0x3e26('0x25')](saveUpdates(_0x3c650c['body'],null))[_0x3e26('0x25')](respondWithResult(_0x5948e9,null))['catch'](handleError(_0x5948e9,null));};exports[_0x3e26('0x50')]=function(_0x2c8e26,_0x1af618){return db[_0x3e26('0x2d')][_0x3e26('0x46')]({'where':{'id':_0x2c8e26['params']['id']}})[_0x3e26('0x25')](handleEntityNotFound(_0x1af618,null))['then'](removeEntity(_0x1af618,null))[_0x3e26('0x42')](handleError(_0x1af618,null));};exports['test']=function(_0x3e63d1,_0x1f4f85,_0xa24df1){var _0x45a5ad;return db['SquareOdbc'][_0x3e26('0x46')]({'where':{'id':_0x3e63d1[_0x3e26('0x44')]['id']},'attributes':['id',_0x3e26('0x51')]})[_0x3e26('0x25')](handleEntityNotFound(_0x1f4f85,null))[_0x3e26('0x25')](function(_0x109edf){if(_0x109edf){var _0x7e3052=require(_0x3e26('0x52'))();_0x7e3052[_0x3e26('0x53')](_0x109edf[_0x3e26('0x51')]);_0x7e3052[_0x3e26('0x54')]();return _0x109edf;}})[_0x3e26('0x25')](respondWithResult(_0x1f4f85,null))[_0x3e26('0x42')](handleError(_0x1f4f85,null));}; \ No newline at end of file +var _0x76d3=['body','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','test','openSync','dsn','closeSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','json','count','offset','set','Content-Range','reject','save','update','then','destroy','get','ODBC','UserProfileResource','end','error','stack','name','map','SquareOdbc','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','merge','filter','options','includeAll','findAll','catch','show','params','include','create'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x76d3,0x149));var _0x376d=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x76d3[_0x17d9e3];return _0x14192d;};'use strict';var pdf=require(_0x376d('0x0'));var emlformat=require(_0x376d('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x376d('0x2'));var jsonpatch=require(_0x376d('0x3'));var rp=require(_0x376d('0x4'));var moment=require(_0x376d('0x5'));var BPromise=require(_0x376d('0x6'));var Mustache=require(_0x376d('0x7'));var util=require('util');var path=require(_0x376d('0x8'));var sox=require('sox');var csv=require(_0x376d('0x9'));var ejs=require(_0x376d('0xa'));var fs=require('fs');var _=require(_0x376d('0xb'));var squel=require(_0x376d('0xc'));var crypto=require(_0x376d('0xd'));var jsforce=require(_0x376d('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x376d('0xf'));var Papa=require(_0x376d('0x10'));var Redis=require(_0x376d('0x11'));var authService=require(_0x376d('0x12'));var qs=require(_0x376d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x376d('0x14'));var logger=require(_0x376d('0x15'))(_0x376d('0x16'));var utils=require('../../config/utils');var config=require(_0x376d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x381391,_0x104b03){_0x104b03=_0x104b03||0xcc;return function(_0x29d1ea){if(_0x29d1ea){return _0x381391[_0x376d('0x18')](_0x104b03);}return _0x381391['status'](_0x104b03)['end']();};}function respondWithResult(_0x18e531,_0xc1572){_0xc1572=_0xc1572||0xc8;return function(_0x5d2fcf){if(_0x5d2fcf){return _0x18e531[_0x376d('0x19')](_0xc1572)[_0x376d('0x1a')](_0x5d2fcf);}};}function respondWithFilteredResult(_0x3c461d,_0x5481c0){return function(_0x5de1ec){if(_0x5de1ec){var _0x821805=_0x5de1ec[_0x376d('0x1b')],_0x178605=_0x5481c0[_0x376d('0x1c')],_0x34447a=_0x5481c0['offset']+_0x5481c0['limit'],_0x92e08f;if(_0x34447a>=_0x821805){_0x34447a=_0x821805;_0x92e08f=0xc8;}else{_0x92e08f=0xce;}_0x3c461d['status'](_0x92e08f);return _0x3c461d[_0x376d('0x1d')](_0x376d('0x1e'),_0x178605+'-'+_0x34447a+'/'+_0x821805)[_0x376d('0x1a')](_0x5de1ec);}return null;};}function patchUpdates(_0x401d3a){return function(_0x53b64f){try{jsonpatch['apply'](_0x53b64f,_0x401d3a,!![]);}catch(_0xa3f335){return BPromise[_0x376d('0x1f')](_0xa3f335);}return _0x53b64f[_0x376d('0x20')]();};}function saveUpdates(_0xef2ff,_0x27520e){return function(_0x246a98){if(_0x246a98){return _0x246a98[_0x376d('0x21')](_0xef2ff)[_0x376d('0x22')](function(_0xcbdd9){return _0xcbdd9;});}return null;};}function removeEntity(_0x4e5709,_0x5a1e23){return function(_0x1584ff){if(_0x1584ff){return _0x1584ff[_0x376d('0x23')]()['then'](function(){var _0x57aca9=_0x1584ff[_0x376d('0x24')]({'plain':!![]});var _0x4d1070=_0x376d('0x25');return db[_0x376d('0x26')][_0x376d('0x23')]({'where':{'type':_0x4d1070,'resourceId':_0x57aca9['id']}})[_0x376d('0x22')](function(){return _0x1584ff;});})[_0x376d('0x22')](function(){_0x4e5709[_0x376d('0x19')](0xcc)[_0x376d('0x27')]();});}};}function handleEntityNotFound(_0x5dc96f,_0x204bd9){return function(_0x3060b4){if(!_0x3060b4){_0x5dc96f[_0x376d('0x18')](0x194);}return _0x3060b4;};}function handleError(_0x4e5c2b,_0x218560){_0x218560=_0x218560||0x1f4;return function(_0x1885c1){logger[_0x376d('0x28')](_0x1885c1[_0x376d('0x29')]);if(_0x1885c1['name']){delete _0x1885c1[_0x376d('0x2a')];}_0x4e5c2b[_0x376d('0x19')](_0x218560)['send'](_0x1885c1);};}exports['index']=function(_0x338a6d,_0x319217){var _0x1a54c7={},_0x3e7ff2={},_0x55532f={'count':0x0,'rows':[]};var _0x85bb9=_[_0x376d('0x2b')](db[_0x376d('0x2c')][_0x376d('0x2d')],function(_0x1c8a90){return{'name':_0x1c8a90['fieldName'],'type':_0x1c8a90[_0x376d('0x2e')]['key']};});_0x3e7ff2[_0x376d('0x2f')]=_[_0x376d('0x2b')](_0x85bb9,_0x376d('0x2a'));_0x3e7ff2[_0x376d('0x30')]=_[_0x376d('0x31')](_0x338a6d[_0x376d('0x30')]);_0x3e7ff2['filters']=_[_0x376d('0x32')](_0x3e7ff2[_0x376d('0x2f')],_0x3e7ff2[_0x376d('0x30')]);_0x1a54c7[_0x376d('0x33')]=_[_0x376d('0x32')](_0x3e7ff2[_0x376d('0x2f')],qs[_0x376d('0x34')](_0x338a6d['query'][_0x376d('0x34')]));_0x1a54c7[_0x376d('0x33')]=_0x1a54c7['attributes'][_0x376d('0x35')]?_0x1a54c7[_0x376d('0x33')]:_0x3e7ff2[_0x376d('0x2f')];if(!_0x338a6d[_0x376d('0x30')][_0x376d('0x36')]('nolimit')){_0x1a54c7[_0x376d('0x37')]=qs[_0x376d('0x37')](_0x338a6d[_0x376d('0x30')][_0x376d('0x37')]);_0x1a54c7['offset']=qs['offset'](_0x338a6d[_0x376d('0x30')][_0x376d('0x1c')]);}_0x1a54c7[_0x376d('0x38')]=qs[_0x376d('0x39')](_0x338a6d[_0x376d('0x30')][_0x376d('0x39')]);_0x1a54c7[_0x376d('0x3a')]=qs[_0x376d('0x3b')](_[_0x376d('0x3c')](_0x338a6d[_0x376d('0x30')],_0x3e7ff2[_0x376d('0x3b')]),_0x85bb9);if(_0x338a6d['query']['filter']){_0x1a54c7['where']=_[_0x376d('0x3d')](_0x1a54c7[_0x376d('0x3a')],{'$or':_[_0x376d('0x2b')](_0x85bb9,function(_0x432f57){if(_0x432f57['type']!=='VIRTUAL'){var _0x36d19c={};_0x36d19c[_0x432f57[_0x376d('0x2a')]]={'$like':'%'+_0x338a6d[_0x376d('0x30')][_0x376d('0x3e')]+'%'};return _0x36d19c;}})});}_0x1a54c7=_[_0x376d('0x3d')]({},_0x1a54c7,_0x338a6d[_0x376d('0x3f')]);var _0x7d808a={'where':_0x1a54c7[_0x376d('0x3a')]};return db['SquareOdbc']['count'](_0x7d808a)[_0x376d('0x22')](function(_0x3db4a9){_0x55532f['count']=_0x3db4a9;if(_0x338a6d[_0x376d('0x30')][_0x376d('0x40')]){_0x1a54c7['include']=[{'all':!![]}];}return db[_0x376d('0x2c')][_0x376d('0x41')](_0x1a54c7);})[_0x376d('0x22')](function(_0x44ae5e){_0x55532f['rows']=_0x44ae5e;return _0x55532f;})[_0x376d('0x22')](respondWithFilteredResult(_0x319217,_0x1a54c7))[_0x376d('0x42')](handleError(_0x319217,null));};exports[_0x376d('0x43')]=function(_0x4e31b9,_0x4e5864){var _0x34ddaf={'raw':!![],'where':{'id':_0x4e31b9[_0x376d('0x44')]['id']}},_0x36bc66={};_0x36bc66['model']=_[_0x376d('0x31')](db['SquareOdbc'][_0x376d('0x2d')]);_0x36bc66[_0x376d('0x30')]=_[_0x376d('0x31')](_0x4e31b9[_0x376d('0x30')]);_0x36bc66['filters']=_[_0x376d('0x32')](_0x36bc66[_0x376d('0x2f')],_0x36bc66[_0x376d('0x30')]);_0x34ddaf['attributes']=_[_0x376d('0x32')](_0x36bc66[_0x376d('0x2f')],qs[_0x376d('0x34')](_0x4e31b9[_0x376d('0x30')][_0x376d('0x34')]));_0x34ddaf[_0x376d('0x33')]=_0x34ddaf[_0x376d('0x33')]['length']?_0x34ddaf['attributes']:_0x36bc66[_0x376d('0x2f')];if(_0x4e31b9[_0x376d('0x30')][_0x376d('0x40')]){_0x34ddaf[_0x376d('0x45')]=[{'all':!![]}];}_0x34ddaf=_[_0x376d('0x3d')]({},_0x34ddaf,_0x4e31b9[_0x376d('0x3f')]);return db[_0x376d('0x2c')]['find'](_0x34ddaf)['then'](handleEntityNotFound(_0x4e5864,null))[_0x376d('0x22')](respondWithResult(_0x4e5864,null))[_0x376d('0x42')](handleError(_0x4e5864,null));};exports[_0x376d('0x46')]=function(_0x6a1010,_0x437490){return db[_0x376d('0x2c')][_0x376d('0x46')](_0x6a1010[_0x376d('0x47')],{})[_0x376d('0x22')](function(_0x1f71bd){var _0x3e2a97=_0x6a1010['user'][_0x376d('0x24')]({'plain':!![]});if(!_0x3e2a97)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e2a97[_0x376d('0x48')]==='user'){var _0x102c90=_0x1f71bd[_0x376d('0x24')]({'plain':!![]});var _0x4d7fd9=_0x376d('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x4d7fd9,'userProfileId':_0x3e2a97['userProfileId']},'raw':!![]})['then'](function(_0x4e3da2){if(_0x4e3da2&&_0x4e3da2[_0x376d('0x49')]===0x0){return db['UserProfileResource'][_0x376d('0x46')]({'name':_0x102c90[_0x376d('0x2a')],'resourceId':_0x102c90['id'],'type':_0x4e3da2['name'],'sectionId':_0x4e3da2['id']},{})['then'](function(){return _0x1f71bd;});}else{return _0x1f71bd;}})['catch'](function(_0x2bf9b9){logger[_0x376d('0x28')](_0x376d('0x4a'),_0x2bf9b9);throw _0x2bf9b9;});}return _0x1f71bd;})[_0x376d('0x22')](respondWithResult(_0x437490,0xc9))['catch'](handleError(_0x437490,null));};exports[_0x376d('0x21')]=function(_0x2a671d,_0x16df7a){if(_0x2a671d[_0x376d('0x47')]['id']){delete _0x2a671d[_0x376d('0x47')]['id'];}return db[_0x376d('0x2c')][_0x376d('0x4b')]({'where':{'id':_0x2a671d[_0x376d('0x44')]['id']}})[_0x376d('0x22')](handleEntityNotFound(_0x16df7a,null))['then'](saveUpdates(_0x2a671d[_0x376d('0x47')],null))[_0x376d('0x22')](respondWithResult(_0x16df7a,null))[_0x376d('0x42')](handleError(_0x16df7a,null));};exports['destroy']=function(_0x3a6658,_0x3332fe){return db[_0x376d('0x2c')][_0x376d('0x4b')]({'where':{'id':_0x3a6658[_0x376d('0x44')]['id']}})[_0x376d('0x22')](handleEntityNotFound(_0x3332fe,null))['then'](removeEntity(_0x3332fe,null))[_0x376d('0x42')](handleError(_0x3332fe,null));};exports[_0x376d('0x4c')]=function(_0x40dc5c,_0x1ca6b8,_0x58d042){var _0x23078b;return db[_0x376d('0x2c')][_0x376d('0x4b')]({'where':{'id':_0x40dc5c[_0x376d('0x44')]['id']},'attributes':['id','dsn']})[_0x376d('0x22')](handleEntityNotFound(_0x1ca6b8,null))[_0x376d('0x22')](function(_0x38e46e){if(_0x38e46e){var _0x39b6d0=require('odbc')();_0x39b6d0[_0x376d('0x4d')](_0x38e46e[_0x376d('0x4e')]);_0x39b6d0[_0x376d('0x4f')]();return _0x38e46e;}})[_0x376d('0x22')](respondWithResult(_0x1ca6b8,null))[_0x376d('0x42')](handleError(_0x1ca6b8,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index f701ed0..c648d49 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 _0x71f4=['api','moment','bluebird','request-promise','rimraf','./squareOdbc.attributes','define','SquareOdbc','square_odbc','../../config/logger'];(function(_0x681b4f,_0x4022c0){var _0x8d820a=function(_0x539b51){while(--_0x539b51){_0x681b4f['push'](_0x681b4f['shift']());}};_0x8d820a(++_0x4022c0);}(_0x71f4,0xf9));var _0x471f=function(_0x4cf8ca,_0x3ae663){_0x4cf8ca=_0x4cf8ca-0x0;var _0x23de49=_0x71f4[_0x4cf8ca];return _0x23de49;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x471f('0x0'))(_0x471f('0x1'));var moment=require(_0x471f('0x2'));var BPromise=require(_0x471f('0x3'));var rp=require(_0x471f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x471f('0x5'));var config=require('../../config/environment');var attributes=require(_0x471f('0x6'));module['exports']=function(_0x1d0101,_0x3bdf82){return _0x1d0101[_0x471f('0x7')](_0x471f('0x8'),attributes,{'tableName':_0x471f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcabe=['lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./squareOdbc.attributes','define','SquareOdbc','square_odbc'];(function(_0x186d17,_0x9fa8ef){var _0x5d4b89=function(_0x57bd70){while(--_0x57bd70){_0x186d17['push'](_0x186d17['shift']());}};_0x5d4b89(++_0x9fa8ef);}(_0xcabe,0x1ef));var _0xecab=function(_0x36f81a,_0x1ac6f5){_0x36f81a=_0x36f81a-0x0;var _0x536a0c=_0xcabe[_0x36f81a];return _0x536a0c;};'use strict';var _=require(_0xecab('0x0'));var util=require('util');var logger=require(_0xecab('0x1'))(_0xecab('0x2'));var moment=require('moment');var BPromise=require(_0xecab('0x3'));var rp=require(_0xecab('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xecab('0x5'));var config=require(_0xecab('0x6'));var attributes=require(_0xecab('0x7'));module['exports']=function(_0x2ef298,_0x2ace9c){return _0x2ef298[_0xecab('0x8')](_0xecab('0x9'),attributes,{'tableName':_0xecab('0xa'),'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 dd6c6ee..c85e394 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 _0xe14b=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','map','include','model','stringify','lodash','util','randomstring'];(function(_0x5b474c,_0x426d87){var _0x273b2c=function(_0x2a3fcf){while(--_0x2a3fcf){_0x5b474c['push'](_0x5b474c['shift']());}};_0x273b2c(++_0x426d87);}(_0xe14b,0x93));var _0xbe14=function(_0x172153,_0xa788dc){_0x172153=_0x172153-0x0;var _0x3bede0=_0xe14b[_0x172153];return _0x3bede0;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe14('0x2'));var fs=require('fs');var Redis=require(_0xbe14('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe14('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe14('0x5'));var jayson=require(_0xbe14('0x6'));var client=jayson[_0xbe14('0x7')][_0xbe14('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9ade,_0x39387e,_0x196fca){return new BPromise(function(_0x566ae7,_0x50f909){return client['request'](_0x1d9ade,_0x196fca)[_0xbe14('0x9')](function(_0x6fceff){logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,'request\x20sent');logger['debug'](_0xbe14('0xc'),_0x39387e,_0xbe14('0xd'),JSON['stringify'](_0x6fceff));if(_0x6fceff[_0xbe14('0xe')]){if(_0x6fceff[_0xbe14('0xe')][_0xbe14('0xf')]===0x1f4){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x50f909(_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);}logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0x6fceff[_0xbe14('0xe')][_0xbe14('0x10')]);return _0x566ae7(_0x6fceff['error']['message']);}else{logger[_0xbe14('0xa')](_0xbe14('0xb'),_0x39387e,_0xbe14('0xd'));_0x566ae7(_0x6fceff[_0xbe14('0x11')]['message']);}})[_0xbe14('0x12')](function(_0xe9c3ec){logger[_0xbe14('0xe')](_0xbe14('0xb'),_0x39387e,_0xe9c3ec);_0x50f909(_0xe9c3ec);});});}exports[_0xbe14('0x13')]=function(_0x29ab73){var _0x17ae86=this;return new Promise(function(_0x5ea1f8,_0x137ee5){return db[_0xbe14('0x14')][_0xbe14('0x15')]({'raw':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x17')]===undefined?!![]:![]:!![],'where':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x18')]||null:null,'attributes':_0x29ab73[_0xbe14('0x16')]?_0x29ab73[_0xbe14('0x16')][_0xbe14('0x19')]||null:null,'include':_0x29ab73['options']?_0x29ab73[_0xbe14('0x16')]['include']?_[_0xbe14('0x1a')](_0x29ab73['options'][_0xbe14('0x1b')],function(_0x4a25fa){return{'model':db[_0x4a25fa[_0xbe14('0x1c')]],'as':_0x4a25fa['as'],'attributes':_0x4a25fa[_0xbe14('0x19')],'include':_0x4a25fa['include']?_[_0xbe14('0x1a')](_0x4a25fa['include'],function(_0x4587a8){return{'model':db[_0x4587a8['model']],'as':_0x4587a8['as'],'attributes':_0x4587a8[_0xbe14('0x19')],'include':_0x4587a8[_0xbe14('0x1b')]?_[_0xbe14('0x1a')](_0x4587a8[_0xbe14('0x1b')],function(_0x15ef02){return{'model':db[_0x15ef02[_0xbe14('0x1c')]],'as':_0x15ef02['as'],'attributes':_0x15ef02['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe14('0x9')](function(_0x1ba46a){logger[_0xbe14('0xa')](_0xbe14('0x13'),_0x29ab73);logger['debug'](_0xbe14('0x13'),_0x29ab73,JSON[_0xbe14('0x1d')](_0x1ba46a));_0x5ea1f8(_0x1ba46a);})['catch'](function(_0x3c3613){logger[_0xbe14('0xe')](_0xbe14('0x13'),_0x3c3613[_0xbe14('0x10')],_0x29ab73);_0x137ee5(_0x17ae86[_0xbe14('0xe')](0x1f4,_0x3c3613[_0xbe14('0x10')]));});});}; \ No newline at end of file +var _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find'];(function(_0x3d9e94,_0x48136c){var _0x45f76e=function(_0x3fb608){while(--_0x3fb608){_0x3d9e94['push'](_0x3d9e94['shift']());}};_0x45f76e(++_0x48136c);}(_0x55ca,0x126));var _0xa55c=function(_0x8abd64,_0x539570){_0x8abd64=_0x8abd64-0x0;var _0xd2511e=_0x55ca[_0x8abd64];return _0xd2511e;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 6835ba5..45a8e4d 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 _0x0aa5=['connect-timeout','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','/:id','isAuthenticated','show','/:id/users','getUsers','post','create','put','update','delete','removeUsers','exports','multer','path'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0x0aa5,0xe2));var _0x50aa=function(_0x4b7fa8,_0x2207d3){_0x4b7fa8=_0x4b7fa8-0x0;var _0x454a66=_0x0aa5[_0x4b7fa8];return _0x454a66;};'use strict';var multer=require(_0x50aa('0x0'));var util=require('util');var path=require(_0x50aa('0x1'));var timeout=require(_0x50aa('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x50aa('0x3'));var interaction=require(_0x50aa('0x4'));var config=require('../../config/environment');var controller=require(_0x50aa('0x5'));router[_0x50aa('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50aa('0x6')](_0x50aa('0x7'),auth[_0x50aa('0x8')](),controller[_0x50aa('0x9')]);router['get'](_0x50aa('0xa'),auth['isAuthenticated'](),controller[_0x50aa('0xb')]);router[_0x50aa('0xc')]('/',auth[_0x50aa('0x8')](),controller[_0x50aa('0xd')]);router[_0x50aa('0xc')](_0x50aa('0xa'),auth[_0x50aa('0x8')](),controller['addUsers']);router[_0x50aa('0xe')](_0x50aa('0x7'),auth[_0x50aa('0x8')](),controller[_0x50aa('0xf')]);router[_0x50aa('0x10')](_0x50aa('0x7'),auth[_0x50aa('0x8')](),controller['destroy']);router[_0x50aa('0x10')]('/:id/users',auth[_0x50aa('0x8')](),controller[_0x50aa('0x11')]);module[_0x50aa('0x12')]=router; \ No newline at end of file +var _0x38cb=['put','update','delete','destroy','removeUsers','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','/:id/users','getUsers','post','create'];(function(_0x4ab3fb,_0x776775){var _0x34fe1e=function(_0x1c94c5){while(--_0x1c94c5){_0x4ab3fb['push'](_0x4ab3fb['shift']());}};_0x34fe1e(++_0x776775);}(_0x38cb,0x1e9));var _0xb38c=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x38cb[_0x934425];return _0x31d596;};'use strict';var multer=require(_0xb38c('0x0'));var util=require(_0xb38c('0x1'));var path=require('path');var timeout=require(_0xb38c('0x2'));var express=require('express');var router=express[_0xb38c('0x3')]();var auth=require(_0xb38c('0x4'));var interaction=require(_0xb38c('0x5'));var config=require(_0xb38c('0x6'));var controller=require(_0xb38c('0x7'));router[_0xb38c('0x8')]('/',auth[_0xb38c('0x9')](),controller[_0xb38c('0xa')]);router[_0xb38c('0x8')](_0xb38c('0xb'),auth['isAuthenticated'](),controller[_0xb38c('0xc')]);router[_0xb38c('0x8')](_0xb38c('0xd'),auth[_0xb38c('0x9')](),controller[_0xb38c('0xe')]);router[_0xb38c('0xf')]('/',auth[_0xb38c('0x9')](),controller[_0xb38c('0x10')]);router[_0xb38c('0xf')](_0xb38c('0xd'),auth[_0xb38c('0x9')](),controller['addUsers']);router[_0xb38c('0x11')](_0xb38c('0xb'),auth['isAuthenticated'](),controller[_0xb38c('0x12')]);router[_0xb38c('0x13')](_0xb38c('0xb'),auth[_0xb38c('0x9')](),controller[_0xb38c('0x14')]);router[_0xb38c('0x13')](_0xb38c('0xd'),auth['isAuthenticated'](),controller[_0xb38c('0x15')]);module[_0xb38c('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 579451b..7a58d80 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 _0xe139=['sequelize','exports','STRING','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE'];(function(_0x20c436,_0x14fd00){var _0x46b0e4=function(_0x28332a){while(--_0x28332a){_0x20c436['push'](_0x20c436['shift']());}};_0x46b0e4(++_0x14fd00);}(_0xe139,0x15c));var _0x9e13=function(_0x213103,_0x147186){_0x213103=_0x213103-0x0;var _0x1baa56=_0xe139[_0x213103];return _0x1baa56;};'use strict';var Sequelize=require(_0x9e13('0x0'));module[_0x9e13('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x9e13('0x2')]},'notes':{'type':Sequelize[_0x9e13('0x3')]},'preproduction':{'type':Sequelize[_0x9e13('0x4')](_0x9e13('0x5')),'get':function(){if(this[_0x9e13('0x6')](_0x9e13('0x7'))){return this[_0x9e13('0x6')](_0x9e13('0x7'))[_0x9e13('0x8')](_0x9e13('0x9'));}}},'production':{'type':Sequelize[_0x9e13('0x4')]('long'),'get':function(){if(this[_0x9e13('0x6')](_0x9e13('0xa'))){return this[_0x9e13('0x6')](_0x9e13('0xa'))[_0x9e13('0x8')]('utf8');}}},'savedAt':{'type':Sequelize[_0x9e13('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x7eb8=['toString','utf8','production','DATE','exports','STRING','name','TEXT','BLOB','long','getDataValue','preproduction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7eb8,0x10c));var _0x87eb=function(_0x2179af,_0x231c02){_0x2179af=_0x2179af-0x0;var _0x409592=_0x7eb8[_0x2179af];return _0x409592;};'use strict';var Sequelize=require('sequelize');module[_0x87eb('0x0')]={'name':{'type':Sequelize[_0x87eb('0x1')],'unique':_0x87eb('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x87eb('0x3')]},'preproduction':{'type':Sequelize[_0x87eb('0x4')](_0x87eb('0x5')),'get':function(){if(this[_0x87eb('0x6')](_0x87eb('0x7'))){return this[_0x87eb('0x6')](_0x87eb('0x7'))[_0x87eb('0x8')](_0x87eb('0x9'));}}},'production':{'type':Sequelize[_0x87eb('0x4')](_0x87eb('0x5')),'get':function(){if(this[_0x87eb('0x6')]('production')){return this[_0x87eb('0x6')](_0x87eb('0xa'))[_0x87eb('0x8')](_0x87eb('0x9'));}}},'savedAt':{'type':Sequelize[_0x87eb('0xb')]},'publishedAt':{'type':Sequelize[_0x87eb('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 9e4e797..0f24dc4 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 _0x5649=['index','map','SquareProject','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','removeUsers','isArray','emit','getUsers','findOne','User','fields','pick','hasOwnProperty','nolimit','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','SquareProjects','error','name'];(function(_0x1ded44,_0x35969b){var _0x58613c=function(_0x594ba9){while(--_0x594ba9){_0x1ded44['push'](_0x1ded44['shift']());}};_0x58613c(++_0x35969b);}(_0x5649,0x153));var _0x9564=function(_0x555d87,_0x207a9c){_0x555d87=_0x555d87-0x0;var _0x47a78e=_0x5649[_0x555d87];return _0x47a78e;};'use strict';var pdf=require(_0x9564('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9564('0x1'));var zipdir=require(_0x9564('0x2'));var jsonpatch=require(_0x9564('0x3'));var rp=require(_0x9564('0x4'));var moment=require(_0x9564('0x5'));var BPromise=require(_0x9564('0x6'));var Mustache=require('mustache');var util=require(_0x9564('0x7'));var path=require(_0x9564('0x8'));var sox=require(_0x9564('0x9'));var csv=require('to-csv');var ejs=require(_0x9564('0xa'));var fs=require('fs');var _=require(_0x9564('0xb'));var squel=require(_0x9564('0xc'));var crypto=require(_0x9564('0xd'));var jsforce=require(_0x9564('0xe'));var deskjs=require(_0x9564('0xf'));var toCsv=require(_0x9564('0x10'));var querystring=require(_0x9564('0x11'));var Papa=require(_0x9564('0x12'));var Redis=require('ioredis');var authService=require(_0x9564('0x13'));var qs=require(_0x9564('0x14'));var as=require(_0x9564('0x15'));var hardwareService=require(_0x9564('0x16'));var logger=require(_0x9564('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x9564('0x18'));var licenseUtil=require(_0x9564('0x19'));var db=require('../../mysqldb')['db'];config[_0x9564('0x1a')]=_[_0x9564('0x1b')](config['redis'],{'host':_0x9564('0x1c'),'port':0x18eb});var socket=require(_0x9564('0x1d'))(new Redis(config['redis']));require('./squareProject.socket')[_0x9564('0x1e')](socket);function respondWithStatusCode(_0x2c6c96,_0x33c4e6){_0x33c4e6=_0x33c4e6||0xcc;return function(_0x2ee390){if(_0x2ee390){return _0x2c6c96[_0x9564('0x1f')](_0x33c4e6);}return _0x2c6c96[_0x9564('0x20')](_0x33c4e6)[_0x9564('0x21')]();};}function respondWithResult(_0x1b195c,_0x415af8){_0x415af8=_0x415af8||0xc8;return function(_0x152a50){if(_0x152a50){return _0x1b195c[_0x9564('0x20')](_0x415af8)[_0x9564('0x22')](_0x152a50);}};}function respondWithFilteredResult(_0x1bc642,_0x19c6bf){return function(_0x144eae){if(_0x144eae){var _0x240c2a=_0x144eae[_0x9564('0x23')],_0x2678dc=_0x19c6bf['offset'],_0x123ce8=_0x19c6bf[_0x9564('0x24')]+_0x19c6bf[_0x9564('0x25')],_0x5152ee;if(_0x123ce8>=_0x240c2a){_0x123ce8=_0x240c2a;_0x5152ee=0xc8;}else{_0x5152ee=0xce;}_0x1bc642[_0x9564('0x20')](_0x5152ee);return _0x1bc642[_0x9564('0x26')](_0x9564('0x27'),_0x2678dc+'-'+_0x123ce8+'/'+_0x240c2a)[_0x9564('0x22')](_0x144eae);}return null;};}function patchUpdates(_0x43699f){return function(_0x54720f){try{jsonpatch['apply'](_0x54720f,_0x43699f,!![]);}catch(_0x3fdee6){return BPromise[_0x9564('0x28')](_0x3fdee6);}return _0x54720f[_0x9564('0x29')]();};}function saveUpdates(_0x511c3a,_0x9b2731){return function(_0x5ed2c7){if(_0x5ed2c7){return _0x5ed2c7[_0x9564('0x2a')](_0x511c3a)[_0x9564('0x2b')](function(_0x4f16fe){return _0x4f16fe;});}return null;};}function removeEntity(_0x3a200e,_0x15eca8){return function(_0x52116a){if(_0x52116a){return _0x52116a[_0x9564('0x2c')]()[_0x9564('0x2b')](function(){var _0x284110=_0x52116a[_0x9564('0x2d')]({'plain':!![]});var _0x4b0abb=_0x9564('0x2e');return db['UserProfileResource'][_0x9564('0x2c')]({'where':{'type':_0x4b0abb,'resourceId':_0x284110['id']}})[_0x9564('0x2b')](function(){return _0x52116a;});})[_0x9564('0x2b')](function(){_0x3a200e[_0x9564('0x20')](0xcc)[_0x9564('0x21')]();});}};}function handleEntityNotFound(_0xa3803a,_0x557248){return function(_0x30f06a){if(!_0x30f06a){_0xa3803a[_0x9564('0x1f')](0x194);}return _0x30f06a;};}function handleError(_0x1c1fa7,_0x448dbd){_0x448dbd=_0x448dbd||0x1f4;return function(_0xa32808){logger[_0x9564('0x2f')](_0xa32808['stack']);if(_0xa32808[_0x9564('0x30')]){delete _0xa32808[_0x9564('0x30')];}_0x1c1fa7[_0x9564('0x20')](_0x448dbd)['send'](_0xa32808);};}exports[_0x9564('0x31')]=function(_0x3c1bc0,_0x23b1a0){var _0x40e822={},_0x158ec1={},_0x506831={'count':0x0,'rows':[]};var _0x597283=_[_0x9564('0x32')](db[_0x9564('0x33')][_0x9564('0x34')],function(_0x3d8110){return{'name':_0x3d8110[_0x9564('0x35')],'type':_0x3d8110[_0x9564('0x36')][_0x9564('0x37')]};});_0x158ec1[_0x9564('0x38')]=_[_0x9564('0x32')](_0x597283,_0x9564('0x30'));_0x158ec1[_0x9564('0x39')]=_[_0x9564('0x3a')](_0x3c1bc0[_0x9564('0x39')]);_0x158ec1['filters']=_[_0x9564('0x3b')](_0x158ec1[_0x9564('0x38')],_0x158ec1['query']);_0x40e822['attributes']=_[_0x9564('0x3b')](_0x158ec1[_0x9564('0x38')],qs['fields'](_0x3c1bc0[_0x9564('0x39')]['fields']));_0x40e822[_0x9564('0x3c')]=_0x40e822[_0x9564('0x3c')]['length']?_0x40e822[_0x9564('0x3c')]:_0x158ec1[_0x9564('0x38')];if(!_0x3c1bc0[_0x9564('0x39')]['hasOwnProperty']('nolimit')){_0x40e822['limit']=qs[_0x9564('0x25')](_0x3c1bc0[_0x9564('0x39')]['limit']);_0x40e822[_0x9564('0x24')]=qs['offset'](_0x3c1bc0[_0x9564('0x39')]['offset']);}_0x40e822[_0x9564('0x3d')]=qs[_0x9564('0x3e')](_0x3c1bc0[_0x9564('0x39')][_0x9564('0x3e')]);_0x40e822[_0x9564('0x3f')]=qs[_0x9564('0x40')](_['pick'](_0x3c1bc0[_0x9564('0x39')],_0x158ec1[_0x9564('0x40')]),_0x597283);if(_0x3c1bc0[_0x9564('0x39')][_0x9564('0x41')]){_0x40e822[_0x9564('0x3f')]=_[_0x9564('0x42')](_0x40e822[_0x9564('0x3f')],{'$or':_[_0x9564('0x32')](_0x597283,function(_0x53f297){if(_0x53f297[_0x9564('0x36')]!==_0x9564('0x43')){var _0x3cbf79={};_0x3cbf79[_0x53f297[_0x9564('0x30')]]={'$like':'%'+_0x3c1bc0[_0x9564('0x39')][_0x9564('0x41')]+'%'};return _0x3cbf79;}})});}_0x40e822=_[_0x9564('0x42')]({},_0x40e822,_0x3c1bc0[_0x9564('0x44')]);var _0x41c848={'where':_0x40e822[_0x9564('0x3f')]};return db[_0x9564('0x33')]['count'](_0x41c848)['then'](function(_0x187dd2){_0x506831[_0x9564('0x23')]=_0x187dd2;if(_0x3c1bc0[_0x9564('0x39')][_0x9564('0x45')]){_0x40e822['include']=[{'all':!![]}];}return db[_0x9564('0x33')][_0x9564('0x46')](_0x40e822);})[_0x9564('0x2b')](function(_0x5efb5f){_0x506831[_0x9564('0x47')]=_0x5efb5f;return _0x506831;})[_0x9564('0x2b')](respondWithFilteredResult(_0x23b1a0,_0x40e822))[_0x9564('0x48')](handleError(_0x23b1a0,null));};exports['show']=function(_0x1b3d9b,_0x592820){var _0x1819c0={'raw':![],'where':{'id':_0x1b3d9b[_0x9564('0x49')]['id']}},_0x56bc80={};_0x56bc80[_0x9564('0x38')]=_[_0x9564('0x3a')](db[_0x9564('0x33')][_0x9564('0x34')]);_0x56bc80[_0x9564('0x39')]=_[_0x9564('0x3a')](_0x1b3d9b[_0x9564('0x39')]);_0x56bc80[_0x9564('0x40')]=_[_0x9564('0x3b')](_0x56bc80['model'],_0x56bc80[_0x9564('0x39')]);_0x1819c0['attributes']=_[_0x9564('0x3b')](_0x56bc80[_0x9564('0x38')],qs['fields'](_0x1b3d9b[_0x9564('0x39')]['fields']));_0x1819c0[_0x9564('0x3c')]=_0x1819c0[_0x9564('0x3c')][_0x9564('0x4a')]?_0x1819c0[_0x9564('0x3c')]:_0x56bc80[_0x9564('0x38')];if(_0x1b3d9b[_0x9564('0x39')][_0x9564('0x45')]){_0x1819c0[_0x9564('0x4b')]=[{'all':!![]}];}_0x1819c0=_[_0x9564('0x42')]({},_0x1819c0,_0x1b3d9b[_0x9564('0x44')]);return db[_0x9564('0x33')][_0x9564('0x4c')](_0x1819c0)[_0x9564('0x2b')](handleEntityNotFound(_0x592820,null))[_0x9564('0x2b')](respondWithResult(_0x592820,null))[_0x9564('0x48')](handleError(_0x592820,null));};exports[_0x9564('0x4d')]=function(_0xf987a2,_0x368ca0){return db['SquareProject'][_0x9564('0x4d')](_0xf987a2[_0x9564('0x4e')],{})['then'](function(_0x650f86){var _0x3458c7=_0xf987a2[_0x9564('0x4f')][_0x9564('0x2d')]({'plain':!![]});if(!_0x3458c7)throw new Error(_0x9564('0x50'));if(_0x3458c7['role']==='user'){var _0x212a16=_0x650f86[_0x9564('0x2d')]({'plain':!![]});var _0x33c713='SquareProjects';return db[_0x9564('0x51')][_0x9564('0x4c')]({'where':{'name':_0x33c713,'userProfileId':_0x3458c7['userProfileId']},'raw':!![]})[_0x9564('0x2b')](function(_0x2f2989){if(_0x2f2989&&_0x2f2989[_0x9564('0x52')]===0x0){return db[_0x9564('0x53')][_0x9564('0x4d')]({'name':_0x212a16[_0x9564('0x30')],'resourceId':_0x212a16['id'],'type':_0x2f2989[_0x9564('0x30')],'sectionId':_0x2f2989['id']},{})['then'](function(){return _0x650f86;});}else{return _0x650f86;}})[_0x9564('0x48')](function(_0x512c79){logger[_0x9564('0x2f')](_0x9564('0x54'),_0x512c79);throw _0x512c79;});}return _0x650f86;})['then'](respondWithResult(_0x368ca0,0xc9))['catch'](handleError(_0x368ca0,null));};exports['update']=function(_0x5a5078,_0xc56548){if(_0x5a5078[_0x9564('0x4e')]['id']){delete _0x5a5078[_0x9564('0x4e')]['id'];}return db[_0x9564('0x33')][_0x9564('0x4c')]({'where':{'id':_0x5a5078['params']['id']}})[_0x9564('0x2b')](handleEntityNotFound(_0xc56548,null))[_0x9564('0x2b')](saveUpdates(_0x5a5078[_0x9564('0x4e')],null))[_0x9564('0x2b')](respondWithResult(_0xc56548,null))[_0x9564('0x48')](handleError(_0xc56548,null));};exports[_0x9564('0x2c')]=function(_0x4513a2,_0x5251aa){return db['SquareProject'][_0x9564('0x4c')]({'where':{'id':_0x4513a2[_0x9564('0x49')]['id']}})[_0x9564('0x2b')](handleEntityNotFound(_0x5251aa,null))['then'](removeEntity(_0x5251aa,null))[_0x9564('0x48')](handleError(_0x5251aa,null));};exports[_0x9564('0x55')]=function(_0x19c995,_0x1ef8a2,_0xcdfd49){return db[_0x9564('0x33')]['find']({'where':{'id':_0x19c995[_0x9564('0x49')]['id']}})['then'](handleEntityNotFound(_0x1ef8a2,null))[_0x9564('0x2b')](function(_0x140086){if(_0x140086){return _0x140086[_0x9564('0x55')](_0x19c995[_0x9564('0x4e')][_0x9564('0x56')],_['omit'](_0x19c995[_0x9564('0x4e')],[_0x9564('0x56'),'id'])||{});}})[_0x9564('0x2b')](respondWithResult(_0x1ef8a2,null))[_0x9564('0x48')](handleError(_0x1ef8a2,null));};exports['removeUsers']=function(_0x16ccd4,_0x2a0f79,_0xcfda7c){return db['SquareProject'][_0x9564('0x4c')]({'where':{'id':_0x16ccd4['params']['id']}})['then'](handleEntityNotFound(_0x2a0f79,null))[_0x9564('0x2b')](function(_0x1ceec6){if(_0x1ceec6){return _0x1ceec6[_0x9564('0x57')](_0x16ccd4[_0x9564('0x39')][_0x9564('0x56')])[_0x9564('0x2b')](function(){if(_[_0x9564('0x58')](_0x16ccd4['query']['ids'])){for(var _0x122130=0x0;_0x122130<_0x16ccd4[_0x9564('0x39')][_0x9564('0x56')]['length'];_0x122130+=0x1){socket[_0x9564('0x59')]('userSquareProject:remove',{'UserId':Number(_0x16ccd4[_0x9564('0x39')][_0x9564('0x56')][_0x122130]),'SquareProjectId':Number(_0x16ccd4[_0x9564('0x49')]['id'])});}}else{socket[_0x9564('0x59')]('userSquareProject:remove',{'UserId':Number(_0x16ccd4[_0x9564('0x39')][_0x9564('0x56')]),'SquareProjectId':Number(_0x16ccd4['params']['id'])});}});}})[_0x9564('0x2b')](respondWithStatusCode(_0x2a0f79,null))[_0x9564('0x48')](handleError(_0x2a0f79,null));};exports[_0x9564('0x5a')]=function(_0x152229,_0x241937,_0x4fce61){var _0x528c7c={};var _0x2696f6={};var _0x337083;var _0x73b8c4;return db[_0x9564('0x33')][_0x9564('0x5b')]({'where':{'id':_0x152229['params']['id']}})['then'](handleEntityNotFound(_0x241937,null))[_0x9564('0x2b')](function(_0x5eed5c){if(_0x5eed5c){_0x337083=_0x5eed5c;_0x2696f6['model']=_['keys'](db[_0x9564('0x5c')][_0x9564('0x34')]);_0x2696f6[_0x9564('0x39')]=_[_0x9564('0x3a')](_0x152229[_0x9564('0x39')]);_0x2696f6[_0x9564('0x40')]=_[_0x9564('0x3b')](_0x2696f6[_0x9564('0x38')],_0x2696f6[_0x9564('0x39')]);_0x528c7c[_0x9564('0x3c')]=_[_0x9564('0x3b')](_0x2696f6[_0x9564('0x38')],qs[_0x9564('0x5d')](_0x152229[_0x9564('0x39')][_0x9564('0x5d')]));_0x528c7c[_0x9564('0x3c')]=_0x528c7c[_0x9564('0x3c')][_0x9564('0x4a')]?_0x528c7c['attributes']:_0x2696f6[_0x9564('0x38')];_0x528c7c[_0x9564('0x3d')]=qs[_0x9564('0x3e')](_0x152229[_0x9564('0x39')][_0x9564('0x3e')]);_0x528c7c['where']=qs['filters'](_[_0x9564('0x5e')](_0x152229['query'],_0x2696f6[_0x9564('0x40')]));if(_0x152229[_0x9564('0x39')][_0x9564('0x41')]){_0x528c7c['where']=_[_0x9564('0x42')](_0x528c7c[_0x9564('0x3f')],{'$or':_[_0x9564('0x32')](_0x528c7c[_0x9564('0x3c')],function(_0x960979){var _0x1ad28a={};_0x1ad28a[_0x960979]={'$like':'%'+_0x152229[_0x9564('0x39')]['filter']+'%'};return _0x1ad28a;})});}_0x528c7c=_[_0x9564('0x42')]({},_0x528c7c,_0x152229['options']);return _0x337083[_0x9564('0x5a')](_0x528c7c);}})[_0x9564('0x2b')](function(_0x8659ca){if(_0x8659ca){_0x73b8c4=_0x8659ca['length'];if(!_0x152229[_0x9564('0x39')][_0x9564('0x5f')](_0x9564('0x60'))){_0x528c7c[_0x9564('0x25')]=qs[_0x9564('0x25')](_0x152229[_0x9564('0x39')][_0x9564('0x25')]);_0x528c7c[_0x9564('0x24')]=qs[_0x9564('0x24')](_0x152229[_0x9564('0x39')]['offset']);}return _0x337083[_0x9564('0x5a')](_0x528c7c);}})['then'](function(_0x4ea03b){if(_0x4ea03b){return _0x4ea03b?{'count':_0x73b8c4,'rows':_0x4ea03b}:null;}})[_0x9564('0x2b')](respondWithResult(_0x241937,null))[_0x9564('0x48')](handleError(_0x241937,null));}; \ No newline at end of file +var _0xdfa9=['SquareProject','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','findAll','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','body','addUsers','params','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','User','pick','getUsers','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','send'];(function(_0x16af87,_0x1beb23){var _0x10b5ac=function(_0x5dc414){while(--_0x5dc414){_0x16af87['push'](_0x16af87['shift']());}};_0x10b5ac(++_0x1beb23);}(_0xdfa9,0x19c));var _0x9dfa=function(_0x19443c,_0x285d12){_0x19443c=_0x19443c-0x0;var _0x3e9c74=_0xdfa9[_0x19443c];return _0x3e9c74;};'use strict';var pdf=require(_0x9dfa('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9dfa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9dfa('0x2'));var rp=require(_0x9dfa('0x3'));var moment=require(_0x9dfa('0x4'));var BPromise=require(_0x9dfa('0x5'));var Mustache=require(_0x9dfa('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9dfa('0x7'));var ejs=require(_0x9dfa('0x8'));var fs=require('fs');var _=require(_0x9dfa('0x9'));var squel=require(_0x9dfa('0xa'));var crypto=require(_0x9dfa('0xb'));var jsforce=require(_0x9dfa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9dfa('0x7'));var querystring=require(_0x9dfa('0xd'));var Papa=require(_0x9dfa('0xe'));var Redis=require(_0x9dfa('0xf'));var authService=require(_0x9dfa('0x10'));var qs=require(_0x9dfa('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9dfa('0x12'));var logger=require(_0x9dfa('0x13'))(_0x9dfa('0x14'));var utils=require(_0x9dfa('0x15'));var config=require(_0x9dfa('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9dfa('0x17'))['db'];config[_0x9dfa('0x18')]=_['defaults'](config['redis'],{'host':_0x9dfa('0x19'),'port':0x18eb});var socket=require(_0x9dfa('0x1a'))(new Redis(config[_0x9dfa('0x18')]));require('./squareProject.socket')[_0x9dfa('0x1b')](socket);function respondWithStatusCode(_0x19b204,_0x5a3d1a){_0x5a3d1a=_0x5a3d1a||0xcc;return function(_0x3ddd46){if(_0x3ddd46){return _0x19b204['sendStatus'](_0x5a3d1a);}return _0x19b204[_0x9dfa('0x1c')](_0x5a3d1a)[_0x9dfa('0x1d')]();};}function respondWithResult(_0x3ed200,_0x38c3cc){_0x38c3cc=_0x38c3cc||0xc8;return function(_0x47ee4d){if(_0x47ee4d){return _0x3ed200[_0x9dfa('0x1c')](_0x38c3cc)[_0x9dfa('0x1e')](_0x47ee4d);}};}function respondWithFilteredResult(_0x4245dc,_0x400b74){return function(_0x10ae69){if(_0x10ae69){var _0x402a4a=_0x10ae69[_0x9dfa('0x1f')],_0x50cc40=_0x400b74[_0x9dfa('0x20')],_0x25cc67=_0x400b74[_0x9dfa('0x20')]+_0x400b74[_0x9dfa('0x21')],_0x4c9022;if(_0x25cc67>=_0x402a4a){_0x25cc67=_0x402a4a;_0x4c9022=0xc8;}else{_0x4c9022=0xce;}_0x4245dc[_0x9dfa('0x1c')](_0x4c9022);return _0x4245dc[_0x9dfa('0x22')](_0x9dfa('0x23'),_0x50cc40+'-'+_0x25cc67+'/'+_0x402a4a)['json'](_0x10ae69);}return null;};}function patchUpdates(_0x2bf9e5){return function(_0x9a083a){try{jsonpatch[_0x9dfa('0x24')](_0x9a083a,_0x2bf9e5,!![]);}catch(_0x45aa46){return BPromise[_0x9dfa('0x25')](_0x45aa46);}return _0x9a083a['save']();};}function saveUpdates(_0x28a3e4,_0x3382d7){return function(_0x4cd8a5){if(_0x4cd8a5){return _0x4cd8a5[_0x9dfa('0x26')](_0x28a3e4)[_0x9dfa('0x27')](function(_0x5807e4){return _0x5807e4;});}return null;};}function removeEntity(_0x32defb,_0x56a81f){return function(_0x441084){if(_0x441084){return _0x441084[_0x9dfa('0x28')]()[_0x9dfa('0x27')](function(){var _0x4ca86e=_0x441084[_0x9dfa('0x29')]({'plain':!![]});var _0x560c1d=_0x9dfa('0x2a');return db[_0x9dfa('0x2b')]['destroy']({'where':{'type':_0x560c1d,'resourceId':_0x4ca86e['id']}})[_0x9dfa('0x27')](function(){return _0x441084;});})['then'](function(){_0x32defb[_0x9dfa('0x1c')](0xcc)[_0x9dfa('0x1d')]();});}};}function handleEntityNotFound(_0x507106,_0xd36fbf){return function(_0x35e834){if(!_0x35e834){_0x507106['sendStatus'](0x194);}return _0x35e834;};}function handleError(_0x3fa6ef,_0x1df88b){_0x1df88b=_0x1df88b||0x1f4;return function(_0x5530c1){logger[_0x9dfa('0x2c')](_0x5530c1[_0x9dfa('0x2d')]);if(_0x5530c1[_0x9dfa('0x2e')]){delete _0x5530c1[_0x9dfa('0x2e')];}_0x3fa6ef[_0x9dfa('0x1c')](_0x1df88b)[_0x9dfa('0x2f')](_0x5530c1);};}exports['index']=function(_0xcdb814,_0xd31b7a){var _0x5a99ba={},_0x475d65={},_0x179d43={'count':0x0,'rows':[]};var _0xd712aa=_['map'](db[_0x9dfa('0x30')][_0x9dfa('0x31')],function(_0x5684cc){return{'name':_0x5684cc['fieldName'],'type':_0x5684cc[_0x9dfa('0x32')][_0x9dfa('0x33')]};});_0x475d65[_0x9dfa('0x34')]=_[_0x9dfa('0x35')](_0xd712aa,'name');_0x475d65[_0x9dfa('0x36')]=_[_0x9dfa('0x37')](_0xcdb814[_0x9dfa('0x36')]);_0x475d65[_0x9dfa('0x38')]=_['intersection'](_0x475d65[_0x9dfa('0x34')],_0x475d65[_0x9dfa('0x36')]);_0x5a99ba[_0x9dfa('0x39')]=_[_0x9dfa('0x3a')](_0x475d65['model'],qs[_0x9dfa('0x3b')](_0xcdb814['query'][_0x9dfa('0x3b')]));_0x5a99ba['attributes']=_0x5a99ba[_0x9dfa('0x39')][_0x9dfa('0x3c')]?_0x5a99ba[_0x9dfa('0x39')]:_0x475d65[_0x9dfa('0x34')];if(!_0xcdb814[_0x9dfa('0x36')][_0x9dfa('0x3d')](_0x9dfa('0x3e'))){_0x5a99ba['limit']=qs[_0x9dfa('0x21')](_0xcdb814[_0x9dfa('0x36')]['limit']);_0x5a99ba[_0x9dfa('0x20')]=qs[_0x9dfa('0x20')](_0xcdb814[_0x9dfa('0x36')][_0x9dfa('0x20')]);}_0x5a99ba[_0x9dfa('0x3f')]=qs[_0x9dfa('0x40')](_0xcdb814['query']['sort']);_0x5a99ba[_0x9dfa('0x41')]=qs[_0x9dfa('0x38')](_['pick'](_0xcdb814[_0x9dfa('0x36')],_0x475d65['filters']),_0xd712aa);if(_0xcdb814['query'][_0x9dfa('0x42')]){_0x5a99ba[_0x9dfa('0x41')]=_['merge'](_0x5a99ba[_0x9dfa('0x41')],{'$or':_[_0x9dfa('0x35')](_0xd712aa,function(_0x19c200){if(_0x19c200[_0x9dfa('0x32')]!=='VIRTUAL'){var _0x126ebf={};_0x126ebf[_0x19c200[_0x9dfa('0x2e')]]={'$like':'%'+_0xcdb814[_0x9dfa('0x36')][_0x9dfa('0x42')]+'%'};return _0x126ebf;}})});}_0x5a99ba=_[_0x9dfa('0x43')]({},_0x5a99ba,_0xcdb814[_0x9dfa('0x44')]);var _0x2b4cc9={'where':_0x5a99ba[_0x9dfa('0x41')]};return db[_0x9dfa('0x30')][_0x9dfa('0x1f')](_0x2b4cc9)[_0x9dfa('0x27')](function(_0x197a81){_0x179d43['count']=_0x197a81;if(_0xcdb814[_0x9dfa('0x36')][_0x9dfa('0x45')]){_0x5a99ba['include']=[{'all':!![]}];}return db[_0x9dfa('0x30')][_0x9dfa('0x46')](_0x5a99ba);})[_0x9dfa('0x27')](function(_0x4ea5f0){_0x179d43['rows']=_0x4ea5f0;return _0x179d43;})[_0x9dfa('0x27')](respondWithFilteredResult(_0xd31b7a,_0x5a99ba))[_0x9dfa('0x47')](handleError(_0xd31b7a,null));};exports[_0x9dfa('0x48')]=function(_0x5b3acd,_0x20ce53){var _0x2f80f4={'raw':![],'where':{'id':_0x5b3acd['params']['id']}},_0x465507={};_0x465507[_0x9dfa('0x34')]=_['keys'](db[_0x9dfa('0x30')]['rawAttributes']);_0x465507['query']=_[_0x9dfa('0x37')](_0x5b3acd[_0x9dfa('0x36')]);_0x465507[_0x9dfa('0x38')]=_[_0x9dfa('0x3a')](_0x465507[_0x9dfa('0x34')],_0x465507[_0x9dfa('0x36')]);_0x2f80f4[_0x9dfa('0x39')]=_[_0x9dfa('0x3a')](_0x465507['model'],qs[_0x9dfa('0x3b')](_0x5b3acd[_0x9dfa('0x36')][_0x9dfa('0x3b')]));_0x2f80f4[_0x9dfa('0x39')]=_0x2f80f4[_0x9dfa('0x39')][_0x9dfa('0x3c')]?_0x2f80f4[_0x9dfa('0x39')]:_0x465507[_0x9dfa('0x34')];if(_0x5b3acd[_0x9dfa('0x36')]['includeAll']){_0x2f80f4['include']=[{'all':!![]}];}_0x2f80f4=_[_0x9dfa('0x43')]({},_0x2f80f4,_0x5b3acd[_0x9dfa('0x44')]);return db['SquareProject'][_0x9dfa('0x49')](_0x2f80f4)[_0x9dfa('0x27')](handleEntityNotFound(_0x20ce53,null))[_0x9dfa('0x27')](respondWithResult(_0x20ce53,null))[_0x9dfa('0x47')](handleError(_0x20ce53,null));};exports[_0x9dfa('0x4a')]=function(_0x370eec,_0x5c52b3){return db['SquareProject'][_0x9dfa('0x4a')](_0x370eec['body'],{})[_0x9dfa('0x27')](function(_0x54400b){var _0x21faa0=_0x370eec[_0x9dfa('0x4b')][_0x9dfa('0x29')]({'plain':!![]});if(!_0x21faa0)throw new Error(_0x9dfa('0x4c'));if(_0x21faa0[_0x9dfa('0x4d')]===_0x9dfa('0x4b')){var _0x2d3460=_0x54400b[_0x9dfa('0x29')]({'plain':!![]});var _0x278455=_0x9dfa('0x2a');return db['UserProfileSection'][_0x9dfa('0x49')]({'where':{'name':_0x278455,'userProfileId':_0x21faa0[_0x9dfa('0x4e')]},'raw':!![]})['then'](function(_0x10ab15){if(_0x10ab15&&_0x10ab15[_0x9dfa('0x4f')]===0x0){return db[_0x9dfa('0x2b')][_0x9dfa('0x4a')]({'name':_0x2d3460[_0x9dfa('0x2e')],'resourceId':_0x2d3460['id'],'type':_0x10ab15[_0x9dfa('0x2e')],'sectionId':_0x10ab15['id']},{})[_0x9dfa('0x27')](function(){return _0x54400b;});}else{return _0x54400b;}})[_0x9dfa('0x47')](function(_0x3b6ba1){logger[_0x9dfa('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b6ba1);throw _0x3b6ba1;});}return _0x54400b;})[_0x9dfa('0x27')](respondWithResult(_0x5c52b3,0xc9))[_0x9dfa('0x47')](handleError(_0x5c52b3,null));};exports[_0x9dfa('0x26')]=function(_0x4ad0c9,_0xca9c3){if(_0x4ad0c9[_0x9dfa('0x50')]['id']){delete _0x4ad0c9[_0x9dfa('0x50')]['id'];}return db['SquareProject'][_0x9dfa('0x49')]({'where':{'id':_0x4ad0c9['params']['id']}})[_0x9dfa('0x27')](handleEntityNotFound(_0xca9c3,null))[_0x9dfa('0x27')](saveUpdates(_0x4ad0c9[_0x9dfa('0x50')],null))[_0x9dfa('0x27')](respondWithResult(_0xca9c3,null))['catch'](handleError(_0xca9c3,null));};exports[_0x9dfa('0x28')]=function(_0x4831cb,_0x524879){return db[_0x9dfa('0x30')]['find']({'where':{'id':_0x4831cb['params']['id']}})[_0x9dfa('0x27')](handleEntityNotFound(_0x524879,null))[_0x9dfa('0x27')](removeEntity(_0x524879,null))[_0x9dfa('0x47')](handleError(_0x524879,null));};exports[_0x9dfa('0x51')]=function(_0x3799ad,_0x294884,_0x625815){return db[_0x9dfa('0x30')][_0x9dfa('0x49')]({'where':{'id':_0x3799ad[_0x9dfa('0x52')]['id']}})[_0x9dfa('0x27')](handleEntityNotFound(_0x294884,null))['then'](function(_0x4ab82d){if(_0x4ab82d){return _0x4ab82d[_0x9dfa('0x51')](_0x3799ad[_0x9dfa('0x50')][_0x9dfa('0x53')],_[_0x9dfa('0x54')](_0x3799ad['body'],[_0x9dfa('0x53'),'id'])||{});}})[_0x9dfa('0x27')](respondWithResult(_0x294884,null))[_0x9dfa('0x47')](handleError(_0x294884,null));};exports[_0x9dfa('0x55')]=function(_0x27350b,_0x4b810c,_0x1341d7){return db[_0x9dfa('0x30')][_0x9dfa('0x49')]({'where':{'id':_0x27350b[_0x9dfa('0x52')]['id']}})[_0x9dfa('0x27')](handleEntityNotFound(_0x4b810c,null))['then'](function(_0x265f88){if(_0x265f88){return _0x265f88[_0x9dfa('0x55')](_0x27350b[_0x9dfa('0x36')]['ids'])[_0x9dfa('0x27')](function(){if(_[_0x9dfa('0x56')](_0x27350b[_0x9dfa('0x36')][_0x9dfa('0x53')])){for(var _0x564c72=0x0;_0x564c72<_0x27350b['query']['ids'][_0x9dfa('0x3c')];_0x564c72+=0x1){socket[_0x9dfa('0x57')](_0x9dfa('0x58'),{'UserId':Number(_0x27350b[_0x9dfa('0x36')]['ids'][_0x564c72]),'SquareProjectId':Number(_0x27350b[_0x9dfa('0x52')]['id'])});}}else{socket[_0x9dfa('0x57')](_0x9dfa('0x58'),{'UserId':Number(_0x27350b[_0x9dfa('0x36')][_0x9dfa('0x53')]),'SquareProjectId':Number(_0x27350b[_0x9dfa('0x52')]['id'])});}});}})[_0x9dfa('0x27')](respondWithStatusCode(_0x4b810c,null))[_0x9dfa('0x47')](handleError(_0x4b810c,null));};exports['getUsers']=function(_0x2c6c95,_0x543558,_0x10081f){var _0x5e59e5={};var _0x3913eb={};var _0x7b4878;var _0x233354;return db['SquareProject']['findOne']({'where':{'id':_0x2c6c95[_0x9dfa('0x52')]['id']}})[_0x9dfa('0x27')](handleEntityNotFound(_0x543558,null))[_0x9dfa('0x27')](function(_0xc6fd27){if(_0xc6fd27){_0x7b4878=_0xc6fd27;_0x3913eb['model']=_[_0x9dfa('0x37')](db[_0x9dfa('0x59')][_0x9dfa('0x31')]);_0x3913eb[_0x9dfa('0x36')]=_[_0x9dfa('0x37')](_0x2c6c95[_0x9dfa('0x36')]);_0x3913eb['filters']=_['intersection'](_0x3913eb[_0x9dfa('0x34')],_0x3913eb[_0x9dfa('0x36')]);_0x5e59e5[_0x9dfa('0x39')]=_[_0x9dfa('0x3a')](_0x3913eb[_0x9dfa('0x34')],qs[_0x9dfa('0x3b')](_0x2c6c95[_0x9dfa('0x36')][_0x9dfa('0x3b')]));_0x5e59e5[_0x9dfa('0x39')]=_0x5e59e5[_0x9dfa('0x39')][_0x9dfa('0x3c')]?_0x5e59e5[_0x9dfa('0x39')]:_0x3913eb[_0x9dfa('0x34')];_0x5e59e5[_0x9dfa('0x3f')]=qs[_0x9dfa('0x40')](_0x2c6c95[_0x9dfa('0x36')]['sort']);_0x5e59e5[_0x9dfa('0x41')]=qs[_0x9dfa('0x38')](_[_0x9dfa('0x5a')](_0x2c6c95[_0x9dfa('0x36')],_0x3913eb[_0x9dfa('0x38')]));if(_0x2c6c95[_0x9dfa('0x36')][_0x9dfa('0x42')]){_0x5e59e5[_0x9dfa('0x41')]=_[_0x9dfa('0x43')](_0x5e59e5[_0x9dfa('0x41')],{'$or':_[_0x9dfa('0x35')](_0x5e59e5[_0x9dfa('0x39')],function(_0x44e73a){var _0x59892c={};_0x59892c[_0x44e73a]={'$like':'%'+_0x2c6c95[_0x9dfa('0x36')][_0x9dfa('0x42')]+'%'};return _0x59892c;})});}_0x5e59e5=_[_0x9dfa('0x43')]({},_0x5e59e5,_0x2c6c95['options']);return _0x7b4878[_0x9dfa('0x5b')](_0x5e59e5);}})['then'](function(_0x2b9fe2){if(_0x2b9fe2){_0x233354=_0x2b9fe2[_0x9dfa('0x3c')];if(!_0x2c6c95[_0x9dfa('0x36')]['hasOwnProperty'](_0x9dfa('0x3e'))){_0x5e59e5['limit']=qs[_0x9dfa('0x21')](_0x2c6c95[_0x9dfa('0x36')][_0x9dfa('0x21')]);_0x5e59e5['offset']=qs[_0x9dfa('0x20')](_0x2c6c95[_0x9dfa('0x36')]['offset']);}return _0x7b4878[_0x9dfa('0x5b')](_0x5e59e5);}})[_0x9dfa('0x27')](function(_0x9b0c58){if(_0x9b0c58){return _0x9b0c58?{'count':_0x233354,'rows':_0x9b0c58}:null;}})['then'](respondWithResult(_0x543558,null))[_0x9dfa('0x47')](handleError(_0x543558,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 1f63023..978cb6f 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 _0xe7a5=['update','emit','hasOwnProperty','exports','events','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x6d4f20,_0x463805){var _0x58deec=function(_0x54d3fb){while(--_0x54d3fb){_0x6d4f20['push'](_0x6d4f20['shift']());}};_0x58deec(++_0x463805);}(_0xe7a5,0xe4));var _0x5e7a=function(_0x361d3f,_0x3be2aa){_0x361d3f=_0x361d3f-0x0;var _0x320229=_0xe7a5[_0x361d3f];return _0x320229;};'use strict';var EventEmitter=require(_0x5e7a('0x0'));var SquareProject=require(_0x5e7a('0x1'))['db'][_0x5e7a('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x5e7a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5e7a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x48a953){return function(_0x391886,_0x4bc690,_0x5127a0){SquareProjectEvents[_0x5e7a('0x5')](_0x48a953+':'+_0x391886['id'],_0x391886);SquareProjectEvents[_0x5e7a('0x5')](_0x48a953,_0x391886);_0x5127a0(null);};}for(var e in events){if(events[_0x5e7a('0x6')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x5e7a('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x0fcf=['hasOwnProperty','hook','exports','SquareProject','setMaxListeners','save','update','remove','emit'];(function(_0x47b9bd,_0x5432af){var _0x366e5a=function(_0x58d4f4){while(--_0x58d4f4){_0x47b9bd['push'](_0x47b9bd['shift']());}};_0x366e5a(++_0x5432af);}(_0x0fcf,0xdb));var _0xf0fc=function(_0x380183,_0x21de95){_0x380183=_0x380183-0x0;var _0x41ec3c=_0x0fcf[_0x380183];return _0x41ec3c;};'use strict';var EventEmitter=require('events');var SquareProject=require('../../mysqldb')['db'][_0xf0fc('0x0')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xf0fc('0x1')](0x0);var events={'afterCreate':_0xf0fc('0x2'),'afterUpdate':_0xf0fc('0x3'),'afterDestroy':_0xf0fc('0x4')};function emitEvent(_0x538cfa){return function(_0x2c78a0,_0x20cc07,_0x16ec27){SquareProjectEvents['emit'](_0x538cfa+':'+_0x2c78a0['id'],_0x2c78a0);SquareProjectEvents[_0xf0fc('0x5')](_0x538cfa,_0x2c78a0);_0x16ec27(null);};}for(var e in events){if(events[_0xf0fc('0x6')](e)){var event=events[e];SquareProject[_0xf0fc('0x7')](e,emitEvent(event));}}module[_0xf0fc('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 500fa63..9155b20 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 _0xe3ee=['request-promise','../../config/environment','exports','define','SquareProject','square_projects','changed','preproduction','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','../../config/logger','api'];(function(_0x11bbcd,_0x4a5e5f){var _0x1c8232=function(_0x21c4d0){while(--_0x21c4d0){_0x11bbcd['push'](_0x11bbcd['shift']());}};_0x1c8232(++_0x4a5e5f);}(_0xe3ee,0x116));var _0xee3e=function(_0x5b523f,_0x9f43aa){_0x5b523f=_0x5b523f-0x0;var _0x53b819=_0xe3ee[_0x5b523f];return _0x53b819;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xee3e('0x0'))(_0xee3e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xee3e('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xee3e('0x3'));var attributes=require('./squareProject.attributes');module[_0xee3e('0x4')]=function(_0x352eca,_0x3907a7){return _0x352eca[_0xee3e('0x5')](_0xee3e('0x6'),attributes,{'tableName':_0xee3e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x43ab67,_0x17fba1,_0x5ee7fd){if(_0x43ab67[_0xee3e('0x8')](_0xee3e('0x9'))){_0x43ab67['savedAt']=moment()[_0xee3e('0xa')](_0xee3e('0xb'));}if(_0x43ab67['changed'](_0xee3e('0xc'))){_0x43ab67[_0xee3e('0xd')]=moment()[_0xee3e('0xa')](_0xee3e('0xb'));}_0x5ee7fd(null,_0x43ab67);}}});}; \ No newline at end of file +var _0xe2cc=['format','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','preproduction','savedAt'];(function(_0x578747,_0x53e1a7){var _0x41b2ad=function(_0x419444){while(--_0x419444){_0x578747['push'](_0x578747['shift']());}};_0x41b2ad(++_0x53e1a7);}(_0xe2cc,0x69));var _0xce2c=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xe2cc[_0x173441];return _0x2423a8;};'use strict';var _=require(_0xce2c('0x0'));var util=require(_0xce2c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xce2c('0x2'));var BPromise=require(_0xce2c('0x3'));var rp=require(_0xce2c('0x4'));var fs=require('fs');var path=require(_0xce2c('0x5'));var rimraf=require(_0xce2c('0x6'));var config=require(_0xce2c('0x7'));var attributes=require(_0xce2c('0x8'));module[_0xce2c('0x9')]=function(_0x592e10,_0x51e5d0){return _0x592e10[_0xce2c('0xa')](_0xce2c('0xb'),attributes,{'tableName':_0xce2c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x29632b,_0x2ce69f,_0x166965){if(_0x29632b['changed'](_0xce2c('0xd'))){_0x29632b[_0xce2c('0xe')]=moment()[_0xce2c('0xf')](_0xce2c('0x10'));}if(_0x29632b[_0xce2c('0x11')](_0xce2c('0x12'))){_0x29632b[_0xce2c('0x13')]=moment()[_0xce2c('0xf')](_0xce2c('0x10'));}_0x166965(null,_0x29632b);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index fa17a57..1f065c8 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 _0x9d2c=['../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','ShowSquareProject','find','options','where','include','map','model','attributes','then','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x549be3,_0x196a69){var _0x91e664=function(_0x144987){while(--_0x144987){_0x549be3['push'](_0x549be3['shift']());}};_0x91e664(++_0x196a69);}(_0x9d2c,0xc0));var _0xc9d2=function(_0xa80297,_0x523270){_0xa80297=_0xa80297-0x0;var _0x2b7ec8=_0x9d2c[_0xa80297];return _0x2b7ec8;};'use strict';var _=require('lodash');var util=require(_0xc9d2('0x0'));var moment=require('moment');var BPromise=require(_0xc9d2('0x1'));var rs=require(_0xc9d2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc9d2('0x3'))['db'];var utils=require(_0xc9d2('0x4'));var logger=require('../../config/logger')(_0xc9d2('0x5'));var config=require(_0xc9d2('0x6'));var jayson=require(_0xc9d2('0x7'));var client=jayson[_0xc9d2('0x8')]['http']({'port':0x232a});config[_0xc9d2('0x9')]=_[_0xc9d2('0xa')](config[_0xc9d2('0x9')],{'host':_0xc9d2('0xb'),'port':0x18eb});var socket=require(_0xc9d2('0xc'))(new Redis(config['redis']));require(_0xc9d2('0xd'))[_0xc9d2('0xe')](socket);function respondWithRpcPromise(_0x11a3d6,_0x3de411,_0x4564e8){return new BPromise(function(_0x5b2aaa,_0x11be7a){return client[_0xc9d2('0xf')](_0x11a3d6,_0x4564e8)['then'](function(_0x5d2b40){logger[_0xc9d2('0x10')](_0xc9d2('0x11'),_0x3de411,_0xc9d2('0x12'));logger[_0xc9d2('0x13')]('SquareProject,\x20%s,\x20%s,\x20%s',_0x3de411,_0xc9d2('0x12'),JSON[_0xc9d2('0x14')](_0x5d2b40));if(_0x5d2b40[_0xc9d2('0x15')]){if(_0x5d2b40[_0xc9d2('0x15')]['code']===0x1f4){logger[_0xc9d2('0x15')](_0xc9d2('0x11'),_0x3de411,_0x5d2b40[_0xc9d2('0x15')][_0xc9d2('0x16')]);return _0x11be7a(_0x5d2b40[_0xc9d2('0x15')][_0xc9d2('0x16')]);}logger[_0xc9d2('0x15')](_0xc9d2('0x11'),_0x3de411,_0x5d2b40[_0xc9d2('0x15')][_0xc9d2('0x16')]);return _0x5b2aaa(_0x5d2b40[_0xc9d2('0x15')]['message']);}else{logger[_0xc9d2('0x10')](_0xc9d2('0x11'),_0x3de411,_0xc9d2('0x12'));_0x5b2aaa(_0x5d2b40['result'][_0xc9d2('0x16')]);}})[_0xc9d2('0x17')](function(_0x1baf19){logger[_0xc9d2('0x15')](_0xc9d2('0x11'),_0x3de411,_0x1baf19);_0x11be7a(_0x1baf19);});});}exports[_0xc9d2('0x18')]=function(_0xac8325){var _0x620d09=this;return new Promise(function(_0x18954d,_0x27de5d){return db['SquareProject'][_0xc9d2('0x19')]({'raw':_0xac8325[_0xc9d2('0x1a')]?_0xac8325[_0xc9d2('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xac8325[_0xc9d2('0x1a')]?_0xac8325['options'][_0xc9d2('0x1b')]||null:null,'attributes':_0xac8325[_0xc9d2('0x1a')]?_0xac8325[_0xc9d2('0x1a')]['attributes']||null:null,'include':_0xac8325[_0xc9d2('0x1a')]?_0xac8325[_0xc9d2('0x1a')][_0xc9d2('0x1c')]?_[_0xc9d2('0x1d')](_0xac8325[_0xc9d2('0x1a')]['include'],function(_0x3d92dc){return{'model':db[_0x3d92dc[_0xc9d2('0x1e')]],'as':_0x3d92dc['as'],'attributes':_0x3d92dc[_0xc9d2('0x1f')],'include':_0x3d92dc['include']?_['map'](_0x3d92dc[_0xc9d2('0x1c')],function(_0x16db62){return{'model':db[_0x16db62['model']],'as':_0x16db62['as'],'attributes':_0x16db62[_0xc9d2('0x1f')],'include':_0x16db62[_0xc9d2('0x1c')]?_[_0xc9d2('0x1d')](_0x16db62[_0xc9d2('0x1c')],function(_0x46edef){return{'model':db[_0x46edef[_0xc9d2('0x1e')]],'as':_0x46edef['as'],'attributes':_0x46edef[_0xc9d2('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc9d2('0x20')](function(_0x1e698a){logger[_0xc9d2('0x10')](_0xc9d2('0x18'),_0xac8325);logger[_0xc9d2('0x13')]('ShowSquareProject',_0xac8325,JSON[_0xc9d2('0x14')](_0x1e698a));_0x18954d(_0x1e698a);})[_0xc9d2('0x17')](function(_0x188ec2){logger[_0xc9d2('0x15')](_0xc9d2('0x18'),_0x188ec2[_0xc9d2('0x16')],_0xac8325);_0x27de5d(_0x620d09[_0xc9d2('0x15')](0x1f4,_0x188ec2[_0xc9d2('0x16')]));});});}; \ No newline at end of file +var _0x04db=['client','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','find','options','raw','where','include','model','attributes','map','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x04db,0xe6));var _0xb04d=function(_0x416901,_0x4ec3c6){_0x416901=_0x416901-0x0;var _0x234a65=_0x04db[_0x416901];return _0x234a65;};'use strict';var _=require(_0xb04d('0x0'));var util=require(_0xb04d('0x1'));var moment=require(_0xb04d('0x2'));var BPromise=require(_0xb04d('0x3'));var rs=require(_0xb04d('0x4'));var fs=require('fs');var Redis=require(_0xb04d('0x5'));var db=require(_0xb04d('0x6'))['db'];var utils=require(_0xb04d('0x7'));var logger=require(_0xb04d('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb04d('0x9'));var client=jayson[_0xb04d('0xa')][_0xb04d('0xb')]({'port':0x232a});config[_0xb04d('0xc')]=_[_0xb04d('0xd')](config[_0xb04d('0xc')],{'host':_0xb04d('0xe'),'port':0x18eb});var socket=require(_0xb04d('0xf'))(new Redis(config[_0xb04d('0xc')]));require(_0xb04d('0x10'))[_0xb04d('0x11')](socket);function respondWithRpcPromise(_0x210ebc,_0x397a55,_0x2316d5){return new BPromise(function(_0x1431e3,_0x2ae259){return client['request'](_0x210ebc,_0x2316d5)[_0xb04d('0x12')](function(_0x554a78){logger[_0xb04d('0x13')](_0xb04d('0x14'),_0x397a55,_0xb04d('0x15'));logger['debug'](_0xb04d('0x16'),_0x397a55,_0xb04d('0x15'),JSON[_0xb04d('0x17')](_0x554a78));if(_0x554a78[_0xb04d('0x18')]){if(_0x554a78[_0xb04d('0x18')][_0xb04d('0x19')]===0x1f4){logger[_0xb04d('0x18')](_0xb04d('0x14'),_0x397a55,_0x554a78[_0xb04d('0x18')][_0xb04d('0x1a')]);return _0x2ae259(_0x554a78[_0xb04d('0x18')][_0xb04d('0x1a')]);}logger['error']('SquareProject,\x20%s,\x20%s',_0x397a55,_0x554a78[_0xb04d('0x18')]['message']);return _0x1431e3(_0x554a78[_0xb04d('0x18')][_0xb04d('0x1a')]);}else{logger[_0xb04d('0x13')](_0xb04d('0x14'),_0x397a55,_0xb04d('0x15'));_0x1431e3(_0x554a78[_0xb04d('0x1b')][_0xb04d('0x1a')]);}})[_0xb04d('0x1c')](function(_0x5e5f29){logger[_0xb04d('0x18')](_0xb04d('0x14'),_0x397a55,_0x5e5f29);_0x2ae259(_0x5e5f29);});});}exports[_0xb04d('0x1d')]=function(_0x323b10){var _0x1af6af=this;return new Promise(function(_0x5a48c4,_0x106f3f){return db[_0xb04d('0x1e')][_0xb04d('0x1f')]({'raw':_0x323b10[_0xb04d('0x20')]?_0x323b10['options'][_0xb04d('0x21')]===undefined?!![]:![]:!![],'where':_0x323b10['options']?_0x323b10[_0xb04d('0x20')][_0xb04d('0x22')]||null:null,'attributes':_0x323b10[_0xb04d('0x20')]?_0x323b10['options']['attributes']||null:null,'include':_0x323b10[_0xb04d('0x20')]?_0x323b10[_0xb04d('0x20')]['include']?_['map'](_0x323b10[_0xb04d('0x20')][_0xb04d('0x23')],function(_0x2335b8){return{'model':db[_0x2335b8[_0xb04d('0x24')]],'as':_0x2335b8['as'],'attributes':_0x2335b8[_0xb04d('0x25')],'include':_0x2335b8[_0xb04d('0x23')]?_[_0xb04d('0x26')](_0x2335b8['include'],function(_0x26b447){return{'model':db[_0x26b447[_0xb04d('0x24')]],'as':_0x26b447['as'],'attributes':_0x26b447[_0xb04d('0x25')],'include':_0x26b447[_0xb04d('0x23')]?_['map'](_0x26b447[_0xb04d('0x23')],function(_0x4fe37a){return{'model':db[_0x4fe37a[_0xb04d('0x24')]],'as':_0x4fe37a['as'],'attributes':_0x4fe37a['attributes']};}):[]};}):[]};}):[]:[]})[_0xb04d('0x12')](function(_0x1ba53f){logger[_0xb04d('0x13')]('ShowSquareProject',_0x323b10);logger[_0xb04d('0x27')](_0xb04d('0x1d'),_0x323b10,JSON[_0xb04d('0x17')](_0x1ba53f));_0x5a48c4(_0x1ba53f);})[_0xb04d('0x1c')](function(_0xe16bc5){logger[_0xb04d('0x18')](_0xb04d('0x1d'),_0xe16bc5[_0xb04d('0x1a')],_0x323b10);_0x106f3f(_0x1af6af['error'](0x1f4,_0xe16bc5['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index bb8eda2..4b3ed63 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 _0x7096=['emit','removeListener','register','length','save','update'];(function(_0x52dcc6,_0x176b5f){var _0x2fdf72=function(_0x4e1276){while(--_0x4e1276){_0x52dcc6['push'](_0x52dcc6['shift']());}};_0x2fdf72(++_0x176b5f);}(_0x7096,0x10c));var _0x6709=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x7096[_0x56482c];return _0x5aae7a;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x6709('0x0'),'remove',_0x6709('0x1')];function createListener(_0x5c668a,_0x233cbf){return function(_0x9544e0){_0x233cbf[_0x6709('0x2')](_0x5c668a,_0x9544e0);};}function removeListener(_0xccdcb5,_0x3cd087){return function(){SquareProjectEvents[_0x6709('0x3')](_0xccdcb5,_0x3cd087);};}exports[_0x6709('0x4')]=function(_0x9d630f){for(var _0xa35832=0x0,_0x3e2223=events[_0x6709('0x5')];_0xa35832<_0x3e2223;_0xa35832++){var _0x985814=events[_0xa35832];var _0x30147f=createListener('squareProject:'+_0x985814,_0x9d630f);SquareProjectEvents['on'](_0x985814,_0x30147f);}}; \ No newline at end of file +var _0x53ec=['length','squareProject:','./squareProject.events','save','remove','update','emit','removeListener'];(function(_0x7a2c37,_0x456505){var _0x25c096=function(_0x28a3bd){while(--_0x28a3bd){_0x7a2c37['push'](_0x7a2c37['shift']());}};_0x25c096(++_0x456505);}(_0x53ec,0x192));var _0xc53e=function(_0x996bc8,_0x291e01){_0x996bc8=_0x996bc8-0x0;var _0x20b0ea=_0x53ec[_0x996bc8];return _0x20b0ea;};'use strict';var SquareProjectEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){SquareProjectEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);SquareProjectEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 252f0e9..c49d995 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 _0xc8ee=['/:id/delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareRecording.controller','isAuthenticated','index','get','/:id','show','/:id/download','post','put','update'];(function(_0x4eb20a,_0x175a7a){var _0x3f2fed=function(_0x22d36a){while(--_0x22d36a){_0x4eb20a['push'](_0x4eb20a['shift']());}};_0x3f2fed(++_0x175a7a);}(_0xc8ee,0x17f));var _0xec8e=function(_0x3f07d7,_0x107fd6){_0x3f07d7=_0x3f07d7-0x0;var _0x3e8de0=_0xc8ee[_0x3f07d7];return _0x3e8de0;};'use strict';var multer=require(_0xec8e('0x0'));var util=require(_0xec8e('0x1'));var path=require('path');var timeout=require(_0xec8e('0x2'));var express=require(_0xec8e('0x3'));var router=express[_0xec8e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xec8e('0x5'));var config=require(_0xec8e('0x6'));var controller=require(_0xec8e('0x7'));router['get']('/',auth[_0xec8e('0x8')](),controller[_0xec8e('0x9')]);router[_0xec8e('0xa')](_0xec8e('0xb'),auth[_0xec8e('0x8')](),controller[_0xec8e('0xc')]);router[_0xec8e('0xa')](_0xec8e('0xd'),auth[_0xec8e('0x8')](),controller['download']);router[_0xec8e('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xec8e('0xf')](_0xec8e('0xb'),auth['isAuthenticated'](),controller[_0xec8e('0x10')]);router['delete'](_0xec8e('0x11'),auth[_0xec8e('0x8')](),controller[_0xec8e('0x12')]);module[_0xec8e('0x13')]=router; \ No newline at end of file +var _0x8964=['create','update','/:id/delete','destroy','util','connect-timeout','express','../../config/environment','./squareRecording.controller','get','/:id','isAuthenticated','show'];(function(_0x905b05,_0x2e2c78){var _0xec0e29=function(_0xc66d95){while(--_0xc66d95){_0x905b05['push'](_0x905b05['shift']());}};_0xec0e29(++_0x2e2c78);}(_0x8964,0x1a4));var _0x4896=function(_0x16f5d5,_0x184bb0){_0x16f5d5=_0x16f5d5-0x0;var _0x1b9f8c=_0x8964[_0x16f5d5];return _0x1b9f8c;};'use strict';var multer=require('multer');var util=require(_0x4896('0x0'));var path=require('path');var timeout=require(_0x4896('0x1'));var express=require(_0x4896('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4896('0x3'));var controller=require(_0x4896('0x4'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x4896('0x5')](_0x4896('0x6'),auth[_0x4896('0x7')](),controller[_0x4896('0x8')]);router[_0x4896('0x5')]('/:id/download',auth[_0x4896('0x7')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x4896('0x9')]);router['put'](_0x4896('0x6'),auth[_0x4896('0x7')](),controller[_0x4896('0xa')]);router['delete'](_0x4896('0xb'),auth[_0x4896('0x7')](),controller[_0x4896('0xc')]);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 3499d71..d90b2b4 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 _0xb0d9=['savePath','lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue'];(function(_0x507597,_0x412525){var _0x110a0f=function(_0x57935a){while(--_0x57935a){_0x507597['push'](_0x507597['shift']());}};_0x110a0f(++_0x412525);}(_0xb0d9,0x87));var _0x9b0d=function(_0x220b1e,_0x837d87){_0x220b1e=_0x220b1e-0x0;var _0x9b08e2=_0xb0d9[_0x220b1e];return _0x9b08e2;};'use strict';var Sequelize=require(_0x9b0d('0x0'));module[_0x9b0d('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x9b0d('0x2')]},'calleridname':{'type':Sequelize[_0x9b0d('0x2')]},'context':{'type':Sequelize[_0x9b0d('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x9b0d('0x2')]},'accountcode':{'type':Sequelize[_0x9b0d('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x9b0d('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x9b0d('0x3')],'get':function(){var _0xadcf0b='';var _0x19be51=this[_0x9b0d('0x4')](_0x9b0d('0x5'));if(_0x19be51){_0xadcf0b=_0x19be51['substring'](_0x19be51[_0x9b0d('0x6')]('.'));}return _0xadcf0b;}}}; \ No newline at end of file +var _0xcb1f=['lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath','substring'];(function(_0x531919,_0x5d369c){var _0x39b6c1=function(_0x67a1fc){while(--_0x67a1fc){_0x531919['push'](_0x531919['shift']());}};_0x39b6c1(++_0x5d369c);}(_0xcb1f,0x121));var _0xfcb1=function(_0x2e9baa,_0x8f2983){_0x2e9baa=_0x2e9baa-0x0;var _0x3cc842=_0xcb1f[_0x2e9baa];return _0x3cc842;};'use strict';var Sequelize=require(_0xfcb1('0x0'));module[_0xfcb1('0x1')]={'uniqueid':{'type':Sequelize[_0xfcb1('0x2')]},'callerid':{'type':Sequelize[_0xfcb1('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xfcb1('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xfcb1('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xfcb1('0x2')]},'savePath':{'type':Sequelize[_0xfcb1('0x2')]},'format':{'type':Sequelize[_0xfcb1('0x3')],'get':function(){var _0x2c4a0f='';var _0x21741a=this[_0xfcb1('0x4')](_0xfcb1('0x5'));if(_0x21741a){_0x2c4a0f=_0x21741a[_0xfcb1('0x6')](_0x21741a[_0xfcb1('0x7')]('.'));}return _0x2c4a0f;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 6936d0e..a42ff3f 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 _0x7920=['%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','unlinkSync','.cypher','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','mustache','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/environment','../../mysqldb','sendStatus','end','status','count','offset','limit','Content-Range','json','save','destroy','then','error','stack','name','send','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format'];(function(_0x4d5c73,_0x3fdd19){var _0xb5c564=function(_0x4fd53a){while(--_0x4fd53a){_0x4d5c73['push'](_0x4d5c73['shift']());}};_0xb5c564(++_0x3fdd19);}(_0x7920,0x131));var _0x0792=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x7920[_0x187ee1];return _0x388160;};'use strict';var pdf=require(_0x0792('0x0'));var emlformat=require(_0x0792('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0792('0x2'));var jsonpatch=require(_0x0792('0x3'));var rp=require(_0x0792('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0792('0x5'));var util=require(_0x0792('0x6'));var path=require(_0x0792('0x7'));var sox=require(_0x0792('0x8'));var csv=require(_0x0792('0x9'));var ejs=require(_0x0792('0xa'));var fs=require('fs');var _=require(_0x0792('0xb'));var squel=require(_0x0792('0xc'));var crypto=require(_0x0792('0xd'));var jsforce=require(_0x0792('0xe'));var deskjs=require(_0x0792('0xf'));var toCsv=require(_0x0792('0x9'));var querystring=require(_0x0792('0x10'));var Papa=require('papaparse');var Redis=require(_0x0792('0x11'));var authService=require(_0x0792('0x12'));var qs=require(_0x0792('0x13'));var as=require(_0x0792('0x14'));var hardwareService=require(_0x0792('0x15'));var logger=require(_0x0792('0x16'))(_0x0792('0x17'));var utils=require('../../config/utils');var config=require(_0x0792('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0792('0x19'))['db'];function respondWithStatusCode(_0x444372,_0x1dd744){_0x1dd744=_0x1dd744||0xcc;return function(_0x4e2db1){if(_0x4e2db1){return _0x444372[_0x0792('0x1a')](_0x1dd744);}return _0x444372['status'](_0x1dd744)[_0x0792('0x1b')]();};}function respondWithResult(_0x3aaf83,_0x48a251){_0x48a251=_0x48a251||0xc8;return function(_0x122fc3){if(_0x122fc3){return _0x3aaf83[_0x0792('0x1c')](_0x48a251)['json'](_0x122fc3);}};}function respondWithFilteredResult(_0x3530d8,_0x2906eb){return function(_0x3b7bc8){if(_0x3b7bc8){var _0x5a631e=_0x3b7bc8[_0x0792('0x1d')],_0x1676c6=_0x2906eb['offset'],_0x1333f3=_0x2906eb[_0x0792('0x1e')]+_0x2906eb[_0x0792('0x1f')],_0xbb8d6b;if(_0x1333f3>=_0x5a631e){_0x1333f3=_0x5a631e;_0xbb8d6b=0xc8;}else{_0xbb8d6b=0xce;}_0x3530d8[_0x0792('0x1c')](_0xbb8d6b);return _0x3530d8['set'](_0x0792('0x20'),_0x1676c6+'-'+_0x1333f3+'/'+_0x5a631e)[_0x0792('0x21')](_0x3b7bc8);}return null;};}function patchUpdates(_0x14f5b1){return function(_0x56596a){try{jsonpatch['apply'](_0x56596a,_0x14f5b1,!![]);}catch(_0x379a1f){return BPromise['reject'](_0x379a1f);}return _0x56596a[_0x0792('0x22')]();};}function saveUpdates(_0x461b3c,_0x593673){return function(_0x1c9244){if(_0x1c9244){return _0x1c9244['update'](_0x461b3c)['then'](function(_0x13840d){return _0x13840d;});}return null;};}function removeEntity(_0xebcd5f,_0x28d3b9){return function(_0x39f74c){if(_0x39f74c){return _0x39f74c[_0x0792('0x23')]()[_0x0792('0x24')](function(){_0xebcd5f[_0x0792('0x1c')](0xcc)[_0x0792('0x1b')]();});}};}function handleEntityNotFound(_0x5eac51,_0x58627e){return function(_0x461412){if(!_0x461412){_0x5eac51['sendStatus'](0x194);}return _0x461412;};}function handleError(_0x38f18e,_0x4fbada){_0x4fbada=_0x4fbada||0x1f4;return function(_0x5e438a){logger[_0x0792('0x25')](_0x5e438a[_0x0792('0x26')]);if(_0x5e438a[_0x0792('0x27')]){delete _0x5e438a['name'];}_0x38f18e[_0x0792('0x1c')](_0x4fbada)[_0x0792('0x28')](_0x5e438a);};}exports['index']=function(_0x7f9896,_0x2b8b27){var _0x30ead7={},_0xa51683={},_0x383aa4={'count':0x0,'rows':[]};var _0x3e1b1a=_[_0x0792('0x29')](db[_0x0792('0x2a')][_0x0792('0x2b')],function(_0x185408){return{'name':_0x185408[_0x0792('0x2c')],'type':_0x185408[_0x0792('0x2d')][_0x0792('0x2e')]};});_0xa51683[_0x0792('0x2f')]=_[_0x0792('0x29')](_0x3e1b1a,_0x0792('0x27'));_0xa51683[_0x0792('0x30')]=_[_0x0792('0x31')](_0x7f9896[_0x0792('0x30')]);_0xa51683[_0x0792('0x32')]=_[_0x0792('0x33')](_0xa51683['model'],_0xa51683['query']);_0x30ead7[_0x0792('0x34')]=_['intersection'](_0xa51683[_0x0792('0x2f')],qs[_0x0792('0x35')](_0x7f9896['query']['fields']));_0x30ead7[_0x0792('0x34')]=_0x30ead7[_0x0792('0x34')][_0x0792('0x36')]?_0x30ead7['attributes']:_0xa51683[_0x0792('0x2f')];if(!_0x7f9896[_0x0792('0x30')][_0x0792('0x37')](_0x0792('0x38'))){_0x30ead7[_0x0792('0x1f')]=qs[_0x0792('0x1f')](_0x7f9896[_0x0792('0x30')]['limit']);_0x30ead7[_0x0792('0x1e')]=qs[_0x0792('0x1e')](_0x7f9896[_0x0792('0x30')]['offset']);}_0x30ead7[_0x0792('0x39')]=qs[_0x0792('0x3a')](_0x7f9896[_0x0792('0x30')][_0x0792('0x3a')]);_0x30ead7['where']=qs[_0x0792('0x32')](_['pick'](_0x7f9896[_0x0792('0x30')],_0xa51683[_0x0792('0x32')]),_0x3e1b1a);if(_0x7f9896[_0x0792('0x30')][_0x0792('0x3b')]){_0x30ead7['where']=_[_0x0792('0x3c')](_0x30ead7[_0x0792('0x3d')],{'$or':_['map'](_0x3e1b1a,function(_0x3b5a52){if(_0x3b5a52[_0x0792('0x2d')]!==_0x0792('0x3e')){var _0x57aa68={};_0x57aa68[_0x3b5a52[_0x0792('0x27')]]={'$like':'%'+_0x7f9896[_0x0792('0x30')]['filter']+'%'};return _0x57aa68;}})});}_0x30ead7=_[_0x0792('0x3c')]({},_0x30ead7,_0x7f9896[_0x0792('0x3f')]);var _0x26e51f={'where':_0x30ead7['where']};return db['SquareRecording']['count'](_0x26e51f)[_0x0792('0x24')](function(_0x5f4927){_0x383aa4['count']=_0x5f4927;if(_0x7f9896[_0x0792('0x30')][_0x0792('0x40')]){_0x30ead7[_0x0792('0x41')]=[{'all':!![]}];}return db[_0x0792('0x2a')][_0x0792('0x42')](_0x30ead7);})[_0x0792('0x24')](function(_0x87f398){_0x383aa4[_0x0792('0x43')]=_0x87f398;return _0x383aa4;})[_0x0792('0x24')](respondWithFilteredResult(_0x2b8b27,_0x30ead7))[_0x0792('0x44')](handleError(_0x2b8b27,null));};exports['show']=function(_0x19936e,_0x21d9f6){var _0xc1a0a2={'raw':!![],'where':{'id':_0x19936e[_0x0792('0x45')]['id']}},_0xa53e11={};_0xa53e11['model']=_[_0x0792('0x31')](db[_0x0792('0x2a')][_0x0792('0x2b')]);_0xa53e11['query']=_[_0x0792('0x31')](_0x19936e[_0x0792('0x30')]);_0xa53e11[_0x0792('0x32')]=_[_0x0792('0x33')](_0xa53e11[_0x0792('0x2f')],_0xa53e11[_0x0792('0x30')]);_0xc1a0a2[_0x0792('0x34')]=_[_0x0792('0x33')](_0xa53e11[_0x0792('0x2f')],qs['fields'](_0x19936e[_0x0792('0x30')][_0x0792('0x35')]));_0xc1a0a2[_0x0792('0x34')]=_0xc1a0a2['attributes'][_0x0792('0x36')]?_0xc1a0a2[_0x0792('0x34')]:_0xa53e11[_0x0792('0x2f')];if(_0x19936e[_0x0792('0x30')][_0x0792('0x40')]){_0xc1a0a2[_0x0792('0x41')]=[{'all':!![]}];}_0xc1a0a2=_['merge']({},_0xc1a0a2,_0x19936e[_0x0792('0x3f')]);return db[_0x0792('0x2a')][_0x0792('0x46')](_0xc1a0a2)[_0x0792('0x24')](handleEntityNotFound(_0x21d9f6,null))[_0x0792('0x24')](respondWithResult(_0x21d9f6,null))[_0x0792('0x44')](handleError(_0x21d9f6,null));};exports[_0x0792('0x47')]=function(_0x1b3b36,_0x3249c4){return db[_0x0792('0x2a')][_0x0792('0x47')](_0x1b3b36[_0x0792('0x48')],{})[_0x0792('0x24')](respondWithResult(_0x3249c4,0xc9))[_0x0792('0x44')](handleError(_0x3249c4,null));};exports['update']=function(_0x310d56,_0x17ad1b){if(_0x310d56[_0x0792('0x48')]['id']){delete _0x310d56[_0x0792('0x48')]['id'];}return db['SquareRecording'][_0x0792('0x46')]({'where':{'id':_0x310d56[_0x0792('0x45')]['id']}})[_0x0792('0x24')](handleEntityNotFound(_0x17ad1b,null))[_0x0792('0x24')](saveUpdates(_0x310d56[_0x0792('0x48')],null))[_0x0792('0x24')](respondWithResult(_0x17ad1b,null))[_0x0792('0x44')](handleError(_0x17ad1b,null));};exports[_0x0792('0x49')]=function(_0x2e7c23,_0x464bc9,_0x48c1e5){var _0xf24269=require(_0x0792('0x4a'));var _0x388d94=![];var _0x4a5bc4={};if(_0x2e7c23[_0x0792('0x30')][_0x0792('0x2d')]&&_0x2e7c23['query'][_0x0792('0x2d')]===_0x0792('0x4b')){_0x4a5bc4['uniqueid']=_0x2e7c23[_0x0792('0x45')]['id'];}else{_0x4a5bc4['id']=_0x2e7c23[_0x0792('0x45')]['id'];}return db['SquareRecording'][_0x0792('0x46')]({'where':_0x4a5bc4,'attributes':['id',_0x0792('0x4c'),_0x0792('0x4d')],'raw':!![]})[_0x0792('0x24')](handleEntityNotFound(_0x464bc9,null))[_0x0792('0x24')](function(_0x2a22b7){if(_0x2a22b7){var _0x335160=_0x2a22b7['savePath'];var _0x32db27=util[_0x0792('0x4e')](_0x0792('0x4f'),_0x335160);if(fs[_0x0792('0x50')](_0x32db27)){_0x388d94=!![];return _0xf24269[_0x0792('0x51')](_0x32db27,_0x335160,config[_0x0792('0x52')]['recording'])[_0x0792('0x24')](function(){return _0x2a22b7;});}return _0x2a22b7;}})[_0x0792('0x24')](function(_0x31c464){if(_0x31c464){var _0x2de576=_0x31c464[_0x0792('0x4c')];if(!fs['existsSync'](_0x2de576)){throw new db[(_0x0792('0x53'))][(_0x0792('0x54'))](_0x0792('0x55'));}if(_0x31c464[_0x0792('0x4d')]){return _0x464bc9[_0x0792('0x49')](_0x2de576,_0x31c464[_0x0792('0x4d')]+path[_0x0792('0x56')](_0x2de576),function(){if(_0x388d94){fs[_0x0792('0x57')](_0x2de576);}});}else{return _0x464bc9[_0x0792('0x49')](_0x2de576,function(_0x1dd0f7){if(_0x388d94){fs[_0x0792('0x57')](_0x2de576);}});}}})[_0x0792('0x44')](function(_0x2d0156){if(_0x2d0156[_0x0792('0x58')]==='SquareRecording\x20not\x20found'){_0x464bc9['status'](0x194)[_0x0792('0x28')](_0x0792('0x59'));}else{return handleError(_0x464bc9,null);}});};exports[_0x0792('0x23')]=function(_0x261850,_0x4c5368){return db['SquareRecording'][_0x0792('0x46')]({'where':{'id':_0x261850[_0x0792('0x45')]['id']}})[_0x0792('0x24')](function(_0x396750){if(!_0x396750)throw new ReferenceError(_0x0792('0x5a'));return _0x396750;})[_0x0792('0x24')](function(_0x30765f){var _0x473eb8=_0x30765f['savePath'];logger[_0x0792('0x5b')](_0x0792('0x5c'),_0x473eb8);if(!_[_0x0792('0x5d')](_0x30765f['savePath'])&&fs[_0x0792('0x50')](_0x473eb8)){logger[_0x0792('0x5b')]('File:\x20\x22'+_0x473eb8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x0792('0x5e')](_0x473eb8);}_0x473eb8=_0x473eb8+_0x0792('0x5f');if(!_[_0x0792('0x5d')](_0x30765f['savePath'])&&fs[_0x0792('0x50')](_0x473eb8)){logger[_0x0792('0x5b')]('File:\x20\x22'+_0x473eb8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x0792('0x5e')](_0x473eb8);}return _0x30765f;})[_0x0792('0x24')](function(_0x18846a){if(!_0x18846a)throw new InternalError();return _0x18846a[_0x0792('0x23')]();})[_0x0792('0x24')](function(){_0x4c5368['status'](0xcc)['end']();})[_0x0792('0x44')](handleError(_0x4c5368,null));}; \ No newline at end of file +var _0x567a=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','options','then','include','findAll','rows','catch','show','includeAll','find','body','download','../../components/encryptor','type','uniqueid','params','savePath','filename','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','update','destroy','error','name','send','map','SquareRecording','rawAttributes','fieldName','key','model'];(function(_0x52e0ad,_0x20cd16){var _0x41d5d1=function(_0x5bd37e){while(--_0x5bd37e){_0x52e0ad['push'](_0x52e0ad['shift']());}};_0x41d5d1(++_0x20cd16);}(_0x567a,0x8d));var _0xa567=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x567a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xa567('0x0'));var emlformat=require(_0xa567('0x1'));var rimraf=require(_0xa567('0x2'));var zipdir=require(_0xa567('0x3'));var jsonpatch=require(_0xa567('0x4'));var rp=require(_0xa567('0x5'));var moment=require(_0xa567('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xa567('0x7'));var util=require('util');var path=require(_0xa567('0x8'));var sox=require(_0xa567('0x9'));var csv=require(_0xa567('0xa'));var ejs=require(_0xa567('0xb'));var fs=require('fs');var _=require(_0xa567('0xc'));var squel=require(_0xa567('0xd'));var crypto=require(_0xa567('0xe'));var jsforce=require(_0xa567('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa567('0x10'));var Papa=require('papaparse');var Redis=require(_0xa567('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa567('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa567('0x13'))(_0xa567('0x14'));var utils=require(_0xa567('0x15'));var config=require(_0xa567('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa567('0x17'))['db'];function respondWithStatusCode(_0x158f5e,_0x42089f){_0x42089f=_0x42089f||0xcc;return function(_0x593f1b){if(_0x593f1b){return _0x158f5e['sendStatus'](_0x42089f);}return _0x158f5e[_0xa567('0x18')](_0x42089f)[_0xa567('0x19')]();};}function respondWithResult(_0x4d329d,_0xb59e0f){_0xb59e0f=_0xb59e0f||0xc8;return function(_0x4177b8){if(_0x4177b8){return _0x4d329d['status'](_0xb59e0f)[_0xa567('0x1a')](_0x4177b8);}};}function respondWithFilteredResult(_0x5b3070,_0x4b5353){return function(_0x8f93fa){if(_0x8f93fa){var _0x1fe0cc=_0x8f93fa[_0xa567('0x1b')],_0x5e352d=_0x4b5353[_0xa567('0x1c')],_0x50593f=_0x4b5353['offset']+_0x4b5353[_0xa567('0x1d')],_0x37f654;if(_0x50593f>=_0x1fe0cc){_0x50593f=_0x1fe0cc;_0x37f654=0xc8;}else{_0x37f654=0xce;}_0x5b3070[_0xa567('0x18')](_0x37f654);return _0x5b3070['set'](_0xa567('0x1e'),_0x5e352d+'-'+_0x50593f+'/'+_0x1fe0cc)[_0xa567('0x1a')](_0x8f93fa);}return null;};}function patchUpdates(_0x3fd84f){return function(_0x186a6b){try{jsonpatch[_0xa567('0x1f')](_0x186a6b,_0x3fd84f,!![]);}catch(_0x26faa3){return BPromise['reject'](_0x26faa3);}return _0x186a6b['save']();};}function saveUpdates(_0x29fee8,_0x2910b6){return function(_0x13e71a){if(_0x13e71a){return _0x13e71a[_0xa567('0x20')](_0x29fee8)['then'](function(_0x11d9d9){return _0x11d9d9;});}return null;};}function removeEntity(_0x1e261e,_0x5aeabf){return function(_0x215605){if(_0x215605){return _0x215605[_0xa567('0x21')]()['then'](function(){_0x1e261e[_0xa567('0x18')](0xcc)[_0xa567('0x19')]();});}};}function handleEntityNotFound(_0x5ea11b,_0x41a3eb){return function(_0xa2087){if(!_0xa2087){_0x5ea11b['sendStatus'](0x194);}return _0xa2087;};}function handleError(_0x41e709,_0x1884fc){_0x1884fc=_0x1884fc||0x1f4;return function(_0x2e7430){logger[_0xa567('0x22')](_0x2e7430['stack']);if(_0x2e7430[_0xa567('0x23')]){delete _0x2e7430['name'];}_0x41e709[_0xa567('0x18')](_0x1884fc)[_0xa567('0x24')](_0x2e7430);};}exports['index']=function(_0x1a0e13,_0x3022a3){var _0x54f11={},_0x8e582f={},_0xcc1c2b={'count':0x0,'rows':[]};var _0x1d2e86=_[_0xa567('0x25')](db[_0xa567('0x26')][_0xa567('0x27')],function(_0x479ed0){return{'name':_0x479ed0[_0xa567('0x28')],'type':_0x479ed0['type'][_0xa567('0x29')]};});_0x8e582f[_0xa567('0x2a')]=_['map'](_0x1d2e86,_0xa567('0x23'));_0x8e582f[_0xa567('0x2b')]=_[_0xa567('0x2c')](_0x1a0e13[_0xa567('0x2b')]);_0x8e582f[_0xa567('0x2d')]=_[_0xa567('0x2e')](_0x8e582f[_0xa567('0x2a')],_0x8e582f['query']);_0x54f11[_0xa567('0x2f')]=_['intersection'](_0x8e582f[_0xa567('0x2a')],qs['fields'](_0x1a0e13[_0xa567('0x2b')][_0xa567('0x30')]));_0x54f11[_0xa567('0x2f')]=_0x54f11['attributes'][_0xa567('0x31')]?_0x54f11[_0xa567('0x2f')]:_0x8e582f[_0xa567('0x2a')];if(!_0x1a0e13[_0xa567('0x2b')][_0xa567('0x32')](_0xa567('0x33'))){_0x54f11[_0xa567('0x1d')]=qs['limit'](_0x1a0e13[_0xa567('0x2b')][_0xa567('0x1d')]);_0x54f11['offset']=qs[_0xa567('0x1c')](_0x1a0e13[_0xa567('0x2b')][_0xa567('0x1c')]);}_0x54f11[_0xa567('0x34')]=qs[_0xa567('0x35')](_0x1a0e13['query'][_0xa567('0x35')]);_0x54f11['where']=qs['filters'](_['pick'](_0x1a0e13['query'],_0x8e582f[_0xa567('0x2d')]),_0x1d2e86);if(_0x1a0e13[_0xa567('0x2b')][_0xa567('0x36')]){_0x54f11[_0xa567('0x37')]=_['merge'](_0x54f11[_0xa567('0x37')],{'$or':_[_0xa567('0x25')](_0x1d2e86,function(_0x26c82d){if(_0x26c82d['type']!==_0xa567('0x38')){var _0x4211d9={};_0x4211d9[_0x26c82d[_0xa567('0x23')]]={'$like':'%'+_0x1a0e13[_0xa567('0x2b')][_0xa567('0x36')]+'%'};return _0x4211d9;}})});}_0x54f11=_['merge']({},_0x54f11,_0x1a0e13[_0xa567('0x39')]);var _0x3cd2e8={'where':_0x54f11[_0xa567('0x37')]};return db['SquareRecording'][_0xa567('0x1b')](_0x3cd2e8)[_0xa567('0x3a')](function(_0x42efcb){_0xcc1c2b['count']=_0x42efcb;if(_0x1a0e13[_0xa567('0x2b')]['includeAll']){_0x54f11[_0xa567('0x3b')]=[{'all':!![]}];}return db[_0xa567('0x26')][_0xa567('0x3c')](_0x54f11);})[_0xa567('0x3a')](function(_0x214db2){_0xcc1c2b[_0xa567('0x3d')]=_0x214db2;return _0xcc1c2b;})[_0xa567('0x3a')](respondWithFilteredResult(_0x3022a3,_0x54f11))[_0xa567('0x3e')](handleError(_0x3022a3,null));};exports[_0xa567('0x3f')]=function(_0x590df5,_0x1b8dc3){var _0x50b09b={'raw':!![],'where':{'id':_0x590df5['params']['id']}},_0x1aac98={};_0x1aac98[_0xa567('0x2a')]=_[_0xa567('0x2c')](db['SquareRecording'][_0xa567('0x27')]);_0x1aac98['query']=_[_0xa567('0x2c')](_0x590df5[_0xa567('0x2b')]);_0x1aac98[_0xa567('0x2d')]=_[_0xa567('0x2e')](_0x1aac98['model'],_0x1aac98[_0xa567('0x2b')]);_0x50b09b['attributes']=_['intersection'](_0x1aac98[_0xa567('0x2a')],qs['fields'](_0x590df5[_0xa567('0x2b')][_0xa567('0x30')]));_0x50b09b['attributes']=_0x50b09b[_0xa567('0x2f')][_0xa567('0x31')]?_0x50b09b[_0xa567('0x2f')]:_0x1aac98[_0xa567('0x2a')];if(_0x590df5['query'][_0xa567('0x40')]){_0x50b09b[_0xa567('0x3b')]=[{'all':!![]}];}_0x50b09b=_['merge']({},_0x50b09b,_0x590df5[_0xa567('0x39')]);return db[_0xa567('0x26')]['find'](_0x50b09b)[_0xa567('0x3a')](handleEntityNotFound(_0x1b8dc3,null))[_0xa567('0x3a')](respondWithResult(_0x1b8dc3,null))['catch'](handleError(_0x1b8dc3,null));};exports['create']=function(_0x4588f4,_0x5f0eae){return db['SquareRecording']['create'](_0x4588f4['body'],{})['then'](respondWithResult(_0x5f0eae,0xc9))[_0xa567('0x3e')](handleError(_0x5f0eae,null));};exports[_0xa567('0x20')]=function(_0x307dc6,_0x4d1708){if(_0x307dc6['body']['id']){delete _0x307dc6['body']['id'];}return db[_0xa567('0x26')][_0xa567('0x41')]({'where':{'id':_0x307dc6['params']['id']}})[_0xa567('0x3a')](handleEntityNotFound(_0x4d1708,null))[_0xa567('0x3a')](saveUpdates(_0x307dc6[_0xa567('0x42')],null))[_0xa567('0x3a')](respondWithResult(_0x4d1708,null))[_0xa567('0x3e')](handleError(_0x4d1708,null));};exports[_0xa567('0x43')]=function(_0x4770eb,_0x437e4a,_0x77cd9c){var _0x502bd7=require(_0xa567('0x44'));var _0x3620ba=![];var _0x6af71={};if(_0x4770eb[_0xa567('0x2b')][_0xa567('0x45')]&&_0x4770eb[_0xa567('0x2b')][_0xa567('0x45')]===_0xa567('0x46')){_0x6af71[_0xa567('0x46')]=_0x4770eb['params']['id'];}else{_0x6af71['id']=_0x4770eb[_0xa567('0x47')]['id'];}return db[_0xa567('0x26')][_0xa567('0x41')]({'where':_0x6af71,'attributes':['id',_0xa567('0x48'),_0xa567('0x49')],'raw':!![]})[_0xa567('0x3a')](handleEntityNotFound(_0x437e4a,null))[_0xa567('0x3a')](function(_0x4dede7){if(_0x4dede7){var _0x3a22bb=_0x4dede7[_0xa567('0x48')];var _0xeb6862=util['format'](_0xa567('0x4a'),_0x3a22bb);if(fs[_0xa567('0x4b')](_0xeb6862)){_0x3620ba=!![];return _0x502bd7[_0xa567('0x4c')](_0xeb6862,_0x3a22bb,config[_0xa567('0x4d')][_0xa567('0x4e')])[_0xa567('0x3a')](function(){return _0x4dede7;});}return _0x4dede7;}})[_0xa567('0x3a')](function(_0x234d0a){if(_0x234d0a){var _0x103751=_0x234d0a['savePath'];if(!fs['existsSync'](_0x103751)){throw new db[(_0xa567('0x4f'))]['ValidationError'](_0xa567('0x50'));}if(_0x234d0a[_0xa567('0x49')]){return _0x437e4a[_0xa567('0x43')](_0x103751,_0x234d0a[_0xa567('0x49')]+path[_0xa567('0x51')](_0x103751),function(){if(_0x3620ba){fs['unlink'](_0x103751);}});}else{return _0x437e4a[_0xa567('0x43')](_0x103751,function(_0x381bb0){if(_0x3620ba){fs[_0xa567('0x52')](_0x103751);}});}}})[_0xa567('0x3e')](function(_0x58e66a){if(_0x58e66a[_0xa567('0x53')]===_0xa567('0x50')){_0x437e4a[_0xa567('0x18')](0x194)[_0xa567('0x24')](_0xa567('0x54'));}else{return handleError(_0x437e4a,null);}});};exports[_0xa567('0x21')]=function(_0x2ccebd,_0x309246){return db[_0xa567('0x26')][_0xa567('0x41')]({'where':{'id':_0x2ccebd[_0xa567('0x47')]['id']}})[_0xa567('0x3a')](function(_0x56b179){if(!_0x56b179)throw new ReferenceError(_0xa567('0x55'));return _0x56b179;})[_0xa567('0x3a')](function(_0x1132ae){var _0x3567ab=_0x1132ae[_0xa567('0x48')];logger['info'](_0xa567('0x56'),_0x3567ab);if(!_['isNil'](_0x1132ae[_0xa567('0x48')])&&fs[_0xa567('0x4b')](_0x3567ab)){logger[_0xa567('0x57')](_0xa567('0x58')+_0x3567ab+_0xa567('0x59'));fs[_0xa567('0x5a')](_0x3567ab);}_0x3567ab=_0x3567ab+_0xa567('0x5b');if(!_['isNil'](_0x1132ae[_0xa567('0x48')])&&fs['existsSync'](_0x3567ab)){logger[_0xa567('0x57')](_0xa567('0x58')+_0x3567ab+_0xa567('0x59'));fs[_0xa567('0x5a')](_0x3567ab);}return _0x1132ae;})['then'](function(_0x2f05fc){if(!_0x2f05fc)throw new InternalError();return _0x2f05fc['destroy']();})['then'](function(){_0x309246[_0xa567('0x18')](0xcc)['end']();})[_0xa567('0x3e')](handleError(_0x309246,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 9fa9ef9..decde05 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 _0x1678=['path','rimraf','../../config/environment','./squareRecording.attributes','exports','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment'];(function(_0x240978,_0x49ef3a){var _0x566c20=function(_0x19e970){while(--_0x19e970){_0x240978['push'](_0x240978['shift']());}};_0x566c20(++_0x49ef3a);}(_0x1678,0x17b));var _0x8167=function(_0x16b8ea,_0xfc7e77){_0x16b8ea=_0x16b8ea-0x0;var _0x562e17=_0x1678[_0x16b8ea];return _0x562e17;};'use strict';var _=require(_0x8167('0x0'));var util=require(_0x8167('0x1'));var logger=require(_0x8167('0x2'))(_0x8167('0x3'));var moment=require(_0x8167('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8167('0x5'));var rimraf=require(_0x8167('0x6'));var config=require(_0x8167('0x7'));var attributes=require(_0x8167('0x8'));module[_0x8167('0x9')]=function(_0xa9fd75,_0x30f248){return _0xa9fd75['define'](_0x8167('0xa'),attributes,{'tableName':_0x8167('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07a2=['../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x577f68,_0x57b943){var _0x4a18ca=function(_0x1df9bc){while(--_0x1df9bc){_0x577f68['push'](_0x577f68['shift']());}};_0x4a18ca(++_0x57b943);}(_0x07a2,0x12c));var _0x207a=function(_0x5817e6,_0x44a2d0){_0x5817e6=_0x5817e6-0x0;var _0x51916a=_0x07a2[_0x5817e6];return _0x51916a;};'use strict';var _=require(_0x207a('0x0'));var util=require(_0x207a('0x1'));var logger=require('../../config/logger')(_0x207a('0x2'));var moment=require(_0x207a('0x3'));var BPromise=require(_0x207a('0x4'));var rp=require(_0x207a('0x5'));var fs=require('fs');var path=require(_0x207a('0x6'));var rimraf=require(_0x207a('0x7'));var config=require(_0x207a('0x8'));var attributes=require(_0x207a('0x9'));module[_0x207a('0xa')]=function(_0x47dbbf,_0x5b1fa9){return _0x47dbbf[_0x207a('0xb')](_0x207a('0xc'),attributes,{'tableName':_0x207a('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 1e7cd79..569b899 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 _0xd128=['client','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','SquareRecording','create','body','options','raw','CreateSquareRecording','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xd128,0xbb));var _0x8d12=function(_0x44449b,_0x5e16ea){_0x44449b=_0x44449b-0x0;var _0x1dde55=_0xd128[_0x44449b];return _0x1dde55;};'use strict';var _=require('lodash');var util=require(_0x8d12('0x0'));var moment=require(_0x8d12('0x1'));var BPromise=require(_0x8d12('0x2'));var rs=require(_0x8d12('0x3'));var fs=require('fs');var Redis=require(_0x8d12('0x4'));var db=require(_0x8d12('0x5'))['db'];var utils=require(_0x8d12('0x6'));var logger=require(_0x8d12('0x7'))(_0x8d12('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8d12('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52d9da,_0x3a5b7a,_0xbb8b9a){return new BPromise(function(_0x11edb7,_0x10513c){return client[_0x8d12('0xa')](_0x52d9da,_0xbb8b9a)[_0x8d12('0xb')](function(_0x486dd5){logger[_0x8d12('0xc')](_0x8d12('0xd'),_0x3a5b7a,_0x8d12('0xe'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x3a5b7a,_0x8d12('0xe'),JSON[_0x8d12('0xf')](_0x486dd5));if(_0x486dd5['error']){if(_0x486dd5['error'][_0x8d12('0x10')]===0x1f4){logger[_0x8d12('0x11')](_0x8d12('0xd'),_0x3a5b7a,_0x486dd5['error'][_0x8d12('0x12')]);return _0x10513c(_0x486dd5['error'][_0x8d12('0x12')]);}logger[_0x8d12('0x11')](_0x8d12('0xd'),_0x3a5b7a,_0x486dd5[_0x8d12('0x11')]['message']);return _0x11edb7(_0x486dd5[_0x8d12('0x11')][_0x8d12('0x12')]);}else{logger[_0x8d12('0xc')]('SquareRecording,\x20%s,\x20%s',_0x3a5b7a,'request\x20sent');_0x11edb7(_0x486dd5[_0x8d12('0x13')][_0x8d12('0x12')]);}})[_0x8d12('0x14')](function(_0x89cfac){logger['error']('SquareRecording,\x20%s,\x20%s',_0x3a5b7a,_0x89cfac);_0x10513c(_0x89cfac);});});}exports['CreateSquareRecording']=function(_0xa957b8){var _0x4401e2=this;return new Promise(function(_0x4a44a8,_0x1f9735){return db[_0x8d12('0x15')][_0x8d12('0x16')](_0xa957b8[_0x8d12('0x17')],{'raw':_0xa957b8[_0x8d12('0x18')]?_0xa957b8[_0x8d12('0x18')][_0x8d12('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x186f64){logger[_0x8d12('0xc')](_0x8d12('0x1a'),_0xa957b8);logger[_0x8d12('0x1b')](_0x8d12('0x1a'),_0xa957b8,JSON['stringify'](_0x186f64));_0x4a44a8(_0x186f64);})[_0x8d12('0x14')](function(_0x1564fc){logger[_0x8d12('0x11')]('CreateSquareRecording',_0x1564fc['message'],_0xa957b8);_0x1f9735(_0x4401e2[_0x8d12('0x11')](0x1f4,_0x1564fc[_0x8d12('0x12')]));});});}; \ No newline at end of file +var _0x9825=['result','catch','CreateSquareRecording','SquareRecording','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x248296,_0x595244){var _0x366dd0=function(_0x277eed){while(--_0x277eed){_0x248296['push'](_0x248296['shift']());}};_0x366dd0(++_0x595244);}(_0x9825,0xbb));var _0x5982=function(_0x187692,_0x519cb5){_0x187692=_0x187692-0x0;var _0x371f3f=_0x9825[_0x187692];return _0x371f3f;};'use strict';var _=require(_0x5982('0x0'));var util=require(_0x5982('0x1'));var moment=require(_0x5982('0x2'));var BPromise=require(_0x5982('0x3'));var rs=require(_0x5982('0x4'));var fs=require('fs');var Redis=require(_0x5982('0x5'));var db=require(_0x5982('0x6'))['db'];var utils=require(_0x5982('0x7'));var logger=require('../../config/logger')(_0x5982('0x8'));var config=require('../../config/environment');var jayson=require(_0x5982('0x9'));var client=jayson[_0x5982('0xa')][_0x5982('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x151b1c,_0x59f235,_0x33fe48){return new BPromise(function(_0x575463,_0x418716){return client[_0x5982('0xc')](_0x151b1c,_0x33fe48)[_0x5982('0xd')](function(_0x2b0162){logger['info'](_0x5982('0xe'),_0x59f235,_0x5982('0xf'));logger[_0x5982('0x10')](_0x5982('0x11'),_0x59f235,_0x5982('0xf'),JSON[_0x5982('0x12')](_0x2b0162));if(_0x2b0162[_0x5982('0x13')]){if(_0x2b0162[_0x5982('0x13')][_0x5982('0x14')]===0x1f4){logger[_0x5982('0x13')](_0x5982('0xe'),_0x59f235,_0x2b0162[_0x5982('0x13')][_0x5982('0x15')]);return _0x418716(_0x2b0162[_0x5982('0x13')][_0x5982('0x15')]);}logger[_0x5982('0x13')](_0x5982('0xe'),_0x59f235,_0x2b0162['error'][_0x5982('0x15')]);return _0x575463(_0x2b0162[_0x5982('0x13')]['message']);}else{logger[_0x5982('0x16')](_0x5982('0xe'),_0x59f235,_0x5982('0xf'));_0x575463(_0x2b0162[_0x5982('0x17')][_0x5982('0x15')]);}})[_0x5982('0x18')](function(_0x4f9a40){logger['error'](_0x5982('0xe'),_0x59f235,_0x4f9a40);_0x418716(_0x4f9a40);});});}exports[_0x5982('0x19')]=function(_0x121a5a){var _0x58cf80=this;return new Promise(function(_0x2d9470,_0xd3ce79){return db[_0x5982('0x1a')]['create'](_0x121a5a[_0x5982('0x1b')],{'raw':_0x121a5a[_0x5982('0x1c')]?_0x121a5a[_0x5982('0x1c')][_0x5982('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x49cacd){logger[_0x5982('0x16')](_0x5982('0x19'),_0x121a5a);logger['debug'](_0x5982('0x19'),_0x121a5a,JSON[_0x5982('0x12')](_0x49cacd));_0x2d9470(_0x49cacd);})[_0x5982('0x18')](function(_0x170119){logger[_0x5982('0x13')](_0x5982('0x19'),_0x170119[_0x5982('0x15')],_0x121a5a);_0xd3ce79(_0x58cf80['error'](0x1f4,_0x170119[_0x5982('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 0fbf019..974f113 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 _0x9bbe=['update','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./squareReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create'];(function(_0x3c9cbe,_0x1a01f9){var _0x1fb30d=function(_0xd8c3a3){while(--_0xd8c3a3){_0x3c9cbe['push'](_0x3c9cbe['shift']());}};_0x1fb30d(++_0x1a01f9);}(_0x9bbe,0xce));var _0xe9bb=function(_0xd3b53e,_0x223052){_0xd3b53e=_0xd3b53e-0x0;var _0x431bcb=_0x9bbe[_0xd3b53e];return _0x431bcb;};'use strict';var multer=require(_0xe9bb('0x0'));var util=require('util');var path=require(_0xe9bb('0x1'));var timeout=require('connect-timeout');var express=require(_0xe9bb('0x2'));var router=express[_0xe9bb('0x3')]();var auth=require(_0xe9bb('0x4'));var interaction=require(_0xe9bb('0x5'));var config=require('../../config/environment');var controller=require(_0xe9bb('0x6'));router[_0xe9bb('0x7')]('/',auth[_0xe9bb('0x8')](),controller[_0xe9bb('0x9')]);router[_0xe9bb('0x7')](_0xe9bb('0xa'),auth[_0xe9bb('0x8')](),controller[_0xe9bb('0xb')]);router[_0xe9bb('0x7')](_0xe9bb('0xc'),auth[_0xe9bb('0x8')](),controller['show']);router[_0xe9bb('0xd')]('/',auth[_0xe9bb('0x8')](),controller[_0xe9bb('0xe')]);router['put'](_0xe9bb('0xc'),auth[_0xe9bb('0x8')](),controller[_0xe9bb('0xf')]);router['delete'](_0xe9bb('0xc'),auth[_0xe9bb('0x8')](),controller[_0xe9bb('0x10')]);module['exports']=router; \ No newline at end of file +var _0x7aac=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','index','get','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports'];(function(_0xff4b50,_0x4cda2a){var _0x4b5c8b=function(_0x536ac6){while(--_0x536ac6){_0xff4b50['push'](_0xff4b50['shift']());}};_0x4b5c8b(++_0x4cda2a);}(_0x7aac,0x17c));var _0xc7aa=function(_0x294c3c,_0x20f8bf){_0x294c3c=_0x294c3c-0x0;var _0x142758=_0x7aac[_0x294c3c];return _0x142758;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc7aa('0x0'));var timeout=require(_0xc7aa('0x1'));var express=require('express');var router=express[_0xc7aa('0x2')]();var auth=require(_0xc7aa('0x3'));var interaction=require(_0xc7aa('0x4'));var config=require(_0xc7aa('0x5'));var controller=require(_0xc7aa('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xc7aa('0x7')]);router[_0xc7aa('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xc7aa('0x9')]);router[_0xc7aa('0x8')](_0xc7aa('0xa'),auth[_0xc7aa('0xb')](),controller[_0xc7aa('0xc')]);router[_0xc7aa('0xd')]('/',auth[_0xc7aa('0xb')](),controller[_0xc7aa('0xe')]);router[_0xc7aa('0xf')](_0xc7aa('0xa'),auth['isAuthenticated'](),controller[_0xc7aa('0x10')]);router[_0xc7aa('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc7aa('0x12')]);module[_0xc7aa('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 34d83b7..b13ae82 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 _0xed9e=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0xed9e,0xbf));var _0xeed9=function(_0x2bced3,_0x5e0d41){_0x2bced3=_0x2bced3-0x0;var _0x1ed985=_0xed9e[_0x2bced3];return _0x1ed985;};'use strict';var Sequelize=require(_0xeed9('0x0'));module[_0xeed9('0x1')]={'network':{'type':Sequelize[_0xeed9('0x2')]},'network_script':{'type':Sequelize[_0xeed9('0x2')]},'request':{'type':Sequelize[_0xeed9('0x2')]},'channel':{'type':Sequelize[_0xeed9('0x2')]},'language':{'type':Sequelize[_0xeed9('0x2')]},'type':{'type':Sequelize[_0xeed9('0x2')]},'uniqueid':{'type':Sequelize[_0xeed9('0x2')]},'version':{'type':Sequelize[_0xeed9('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xeed9('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xeed9('0x2')]},'rdnis':{'type':Sequelize[_0xeed9('0x2')]},'context':{'type':Sequelize[_0xeed9('0x2')]},'extension':{'type':Sequelize[_0xeed9('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0xeed9('0x2')]},'accountcode':{'type':Sequelize[_0xeed9('0x2')]},'threadid':{'type':Sequelize[_0xeed9('0x2')]},'project_name':{'type':Sequelize[_0xeed9('0x2')]},'joinAt':{'type':Sequelize[_0xeed9('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0xeed9('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x9760=['sequelize','STRING','DATE'];(function(_0x343b56,_0x27ebbf){var _0x4bdc57=function(_0x46cccd){while(--_0x46cccd){_0x343b56['push'](_0x343b56['shift']());}};_0x4bdc57(++_0x27ebbf);}(_0x9760,0x1dd));var _0x0976=function(_0x4bd1ea,_0x4d9f1c){_0x4bd1ea=_0x4bd1ea-0x0;var _0x45b502=_0x9760[_0x4bd1ea];return _0x45b502;};'use strict';var Sequelize=require(_0x0976('0x0'));module['exports']={'network':{'type':Sequelize[_0x0976('0x1')]},'network_script':{'type':Sequelize[_0x0976('0x1')]},'request':{'type':Sequelize[_0x0976('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0976('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x0976('0x1')]},'callerid':{'type':Sequelize[_0x0976('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x0976('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x0976('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x0976('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x0976('0x1')]},'extension':{'type':Sequelize[_0x0976('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x0976('0x1')]},'accountcode':{'type':Sequelize[_0x0976('0x1')]},'threadid':{'type':Sequelize[_0x0976('0x1')]},'project_name':{'type':Sequelize[_0x0976('0x1')]},'joinAt':{'type':Sequelize[_0x0976('0x2')]},'leaveAt':{'type':Sequelize[_0x0976('0x2')]},'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 6808ad4..24fc0c1 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 _0xdded=['findAll','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','destroy','then','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xdded,0x17a));var _0xddde=function(_0x352377,_0x24f512){_0x352377=_0x352377-0x0;var _0x1d7d9a=_0xdded[_0x352377];return _0x1d7d9a;};'use strict';var pdf=require(_0xddde('0x0'));var emlformat=require(_0xddde('0x1'));var rimraf=require(_0xddde('0x2'));var zipdir=require(_0xddde('0x3'));var jsonpatch=require(_0xddde('0x4'));var rp=require(_0xddde('0x5'));var moment=require('moment');var BPromise=require(_0xddde('0x6'));var Mustache=require(_0xddde('0x7'));var util=require(_0xddde('0x8'));var path=require(_0xddde('0x9'));var sox=require(_0xddde('0xa'));var csv=require(_0xddde('0xb'));var ejs=require(_0xddde('0xc'));var fs=require('fs');var _=require(_0xddde('0xd'));var squel=require(_0xddde('0xe'));var crypto=require(_0xddde('0xf'));var jsforce=require(_0xddde('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xddde('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xddde('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xddde('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xddde('0x13'))(_0xddde('0x14'));var utils=require(_0xddde('0x15'));var config=require(_0xddde('0x16'));var licenseUtil=require(_0xddde('0x17'));var db=require(_0xddde('0x18'))['db'];function respondWithStatusCode(_0x25fadc,_0x35172e){_0x35172e=_0x35172e||0xcc;return function(_0x57e121){if(_0x57e121){return _0x25fadc[_0xddde('0x19')](_0x35172e);}return _0x25fadc[_0xddde('0x1a')](_0x35172e)[_0xddde('0x1b')]();};}function respondWithResult(_0x860ff4,_0x7cbcee){_0x7cbcee=_0x7cbcee||0xc8;return function(_0x31c111){if(_0x31c111){return _0x860ff4['status'](_0x7cbcee)[_0xddde('0x1c')](_0x31c111);}};}function respondWithFilteredResult(_0xbe1df5,_0x3698d4){return function(_0x48f602){if(_0x48f602){var _0x5de7ce=_0x48f602[_0xddde('0x1d')],_0xadd497=_0x3698d4[_0xddde('0x1e')],_0x4e98fd=_0x3698d4[_0xddde('0x1e')]+_0x3698d4[_0xddde('0x1f')],_0x30a9da;if(_0x4e98fd>=_0x5de7ce){_0x4e98fd=_0x5de7ce;_0x30a9da=0xc8;}else{_0x30a9da=0xce;}_0xbe1df5['status'](_0x30a9da);return _0xbe1df5[_0xddde('0x20')](_0xddde('0x21'),_0xadd497+'-'+_0x4e98fd+'/'+_0x5de7ce)['json'](_0x48f602);}return null;};}function patchUpdates(_0x221df0){return function(_0x1185f9){try{jsonpatch['apply'](_0x1185f9,_0x221df0,!![]);}catch(_0x5ae808){return BPromise[_0xddde('0x22')](_0x5ae808);}return _0x1185f9['save']();};}function saveUpdates(_0x1ef35a,_0x5175bd){return function(_0x1576ca){if(_0x1576ca){return _0x1576ca[_0xddde('0x23')](_0x1ef35a)['then'](function(_0x4ae0a8){return _0x4ae0a8;});}return null;};}function removeEntity(_0x3cfd91,_0x107bca){return function(_0x97bb0f){if(_0x97bb0f){return _0x97bb0f[_0xddde('0x24')]()[_0xddde('0x25')](function(){_0x3cfd91[_0xddde('0x1a')](0xcc)[_0xddde('0x1b')]();});}};}function handleEntityNotFound(_0x56a33a,_0x59320f){return function(_0x3daa4a){if(!_0x3daa4a){_0x56a33a[_0xddde('0x19')](0x194);}return _0x3daa4a;};}function handleError(_0x40f2d6,_0x306c01){_0x306c01=_0x306c01||0x1f4;return function(_0xdb57ef){logger['error'](_0xdb57ef[_0xddde('0x26')]);if(_0xdb57ef[_0xddde('0x27')]){delete _0xdb57ef['name'];}_0x40f2d6['status'](_0x306c01)[_0xddde('0x28')](_0xdb57ef);};}exports[_0xddde('0x29')]=function(_0x5ddf57,_0x560e28){var _0x45941e={},_0x5328ac={},_0x1d1c3e={'count':0x0,'rows':[]};var _0x41d94b=_[_0xddde('0x2a')](db[_0xddde('0x2b')][_0xddde('0x2c')],function(_0xb5d4b6){return{'name':_0xb5d4b6[_0xddde('0x2d')],'type':_0xb5d4b6[_0xddde('0x2e')][_0xddde('0x2f')]};});_0x5328ac[_0xddde('0x30')]=_[_0xddde('0x2a')](_0x41d94b,_0xddde('0x27'));_0x5328ac[_0xddde('0x31')]=_[_0xddde('0x32')](_0x5ddf57[_0xddde('0x31')]);_0x5328ac[_0xddde('0x33')]=_[_0xddde('0x34')](_0x5328ac[_0xddde('0x30')],_0x5328ac[_0xddde('0x31')]);_0x45941e[_0xddde('0x35')]=_['intersection'](_0x5328ac['model'],qs[_0xddde('0x36')](_0x5ddf57[_0xddde('0x31')][_0xddde('0x36')]));_0x45941e['attributes']=_0x45941e['attributes'][_0xddde('0x37')]?_0x45941e[_0xddde('0x35')]:_0x5328ac[_0xddde('0x30')];if(!_0x5ddf57[_0xddde('0x31')]['hasOwnProperty'](_0xddde('0x38'))){_0x45941e['limit']=qs[_0xddde('0x1f')](_0x5ddf57[_0xddde('0x31')][_0xddde('0x1f')]);_0x45941e[_0xddde('0x1e')]=qs[_0xddde('0x1e')](_0x5ddf57[_0xddde('0x31')][_0xddde('0x1e')]);}_0x45941e[_0xddde('0x39')]=qs[_0xddde('0x3a')](_0x5ddf57[_0xddde('0x31')][_0xddde('0x3a')]);_0x45941e[_0xddde('0x3b')]=qs['filters'](_[_0xddde('0x3c')](_0x5ddf57[_0xddde('0x31')],_0x5328ac['filters']),_0x41d94b);if(_0x5ddf57['query']['filter']){_0x45941e[_0xddde('0x3b')]=_[_0xddde('0x3d')](_0x45941e[_0xddde('0x3b')],{'$or':_[_0xddde('0x2a')](_0x41d94b,function(_0x2825c6){if(_0x2825c6[_0xddde('0x2e')]!==_0xddde('0x3e')){var _0x5d88ac={};_0x5d88ac[_0x2825c6['name']]={'$like':'%'+_0x5ddf57[_0xddde('0x31')]['filter']+'%'};return _0x5d88ac;}})});}_0x45941e=_[_0xddde('0x3d')]({},_0x45941e,_0x5ddf57[_0xddde('0x3f')]);var _0x4c356a={'where':_0x45941e[_0xddde('0x3b')]};return db[_0xddde('0x2b')][_0xddde('0x1d')](_0x4c356a)['then'](function(_0x5cb615){_0x1d1c3e[_0xddde('0x1d')]=_0x5cb615;if(_0x5ddf57['query'][_0xddde('0x40')]){_0x45941e[_0xddde('0x41')]=[{'all':!![]}];}return db[_0xddde('0x2b')][_0xddde('0x42')](_0x45941e);})[_0xddde('0x25')](function(_0x1faf5f){_0x1d1c3e['rows']=_0x1faf5f;return _0x1d1c3e;})[_0xddde('0x25')](respondWithFilteredResult(_0x560e28,_0x45941e))[_0xddde('0x43')](handleError(_0x560e28,null));};exports[_0xddde('0x44')]=function(_0xd490d5,_0x10d9d3){var _0x585b5a={'raw':!![],'where':{'id':_0xd490d5[_0xddde('0x45')]['id']}},_0x1f4ef2={};_0x1f4ef2[_0xddde('0x30')]=_[_0xddde('0x32')](db[_0xddde('0x2b')][_0xddde('0x2c')]);_0x1f4ef2[_0xddde('0x31')]=_[_0xddde('0x32')](_0xd490d5[_0xddde('0x31')]);_0x1f4ef2['filters']=_[_0xddde('0x34')](_0x1f4ef2['model'],_0x1f4ef2[_0xddde('0x31')]);_0x585b5a[_0xddde('0x35')]=_['intersection'](_0x1f4ef2[_0xddde('0x30')],qs[_0xddde('0x36')](_0xd490d5[_0xddde('0x31')]['fields']));_0x585b5a['attributes']=_0x585b5a['attributes'][_0xddde('0x37')]?_0x585b5a[_0xddde('0x35')]:_0x1f4ef2[_0xddde('0x30')];if(_0xd490d5[_0xddde('0x31')]['includeAll']){_0x585b5a[_0xddde('0x41')]=[{'all':!![]}];}_0x585b5a=_[_0xddde('0x3d')]({},_0x585b5a,_0xd490d5[_0xddde('0x3f')]);return db['SquareReport'][_0xddde('0x46')](_0x585b5a)[_0xddde('0x25')](handleEntityNotFound(_0x10d9d3,null))[_0xddde('0x25')](respondWithResult(_0x10d9d3,null))[_0xddde('0x43')](handleError(_0x10d9d3,null));};exports[_0xddde('0x47')]=function(_0x4dbf84,_0x3ac8c3){return db['SquareReport'][_0xddde('0x47')](_0x4dbf84['body'],{})[_0xddde('0x25')](respondWithResult(_0x3ac8c3,0xc9))[_0xddde('0x43')](handleError(_0x3ac8c3,null));};exports[_0xddde('0x23')]=function(_0x83ee21,_0x1cf1d6){if(_0x83ee21[_0xddde('0x48')]['id']){delete _0x83ee21[_0xddde('0x48')]['id'];}return db[_0xddde('0x2b')]['find']({'where':{'id':_0x83ee21[_0xddde('0x45')]['id']}})[_0xddde('0x25')](handleEntityNotFound(_0x1cf1d6,null))[_0xddde('0x25')](saveUpdates(_0x83ee21[_0xddde('0x48')],null))[_0xddde('0x25')](respondWithResult(_0x1cf1d6,null))[_0xddde('0x43')](handleError(_0x1cf1d6,null));};exports['destroy']=function(_0x135d97,_0xb3f972){return db[_0xddde('0x2b')][_0xddde('0x46')]({'where':{'id':_0x135d97[_0xddde('0x45')]['id']}})['then'](handleEntityNotFound(_0xb3f972,null))[_0xddde('0x25')](removeEntity(_0xb3f972,null))[_0xddde('0x43')](handleError(_0xb3f972,null));};exports[_0xddde('0x49')]=function(_0x2ff917,_0x4553ab){return db[_0xddde('0x2b')][_0xddde('0x49')]()[_0xddde('0x25')](respondWithResult(_0x4553ab,null))[_0xddde('0x43')](handleError(_0x4553ab,null));}; \ No newline at end of file +var _0xf970=['attributes','fields','length','nolimit','sort','pick','filter','where','merge','VIRTUAL','SquareReport','includeAll','include','findAll','rows','catch','show','options','find','create','body','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xf970,0x1d9));var _0x0f97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf970[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x0f97('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0f97('0x1'));var zipdir=require(_0x0f97('0x2'));var jsonpatch=require(_0x0f97('0x3'));var rp=require(_0x0f97('0x4'));var moment=require(_0x0f97('0x5'));var BPromise=require(_0x0f97('0x6'));var Mustache=require(_0x0f97('0x7'));var util=require('util');var path=require(_0x0f97('0x8'));var sox=require(_0x0f97('0x9'));var csv=require(_0x0f97('0xa'));var ejs=require(_0x0f97('0xb'));var fs=require('fs');var _=require(_0x0f97('0xc'));var squel=require(_0x0f97('0xd'));var crypto=require(_0x0f97('0xe'));var jsforce=require(_0x0f97('0xf'));var deskjs=require(_0x0f97('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0f97('0x11'));var Redis=require('ioredis');var authService=require(_0x0f97('0x12'));var qs=require(_0x0f97('0x13'));var as=require(_0x0f97('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f97('0x15'))('api');var utils=require(_0x0f97('0x16'));var config=require(_0x0f97('0x17'));var licenseUtil=require(_0x0f97('0x18'));var db=require(_0x0f97('0x19'))['db'];function respondWithStatusCode(_0x38ae73,_0x4934af){_0x4934af=_0x4934af||0xcc;return function(_0x56d310){if(_0x56d310){return _0x38ae73[_0x0f97('0x1a')](_0x4934af);}return _0x38ae73[_0x0f97('0x1b')](_0x4934af)[_0x0f97('0x1c')]();};}function respondWithResult(_0x2aeeed,_0x300f29){_0x300f29=_0x300f29||0xc8;return function(_0x424c47){if(_0x424c47){return _0x2aeeed['status'](_0x300f29)['json'](_0x424c47);}};}function respondWithFilteredResult(_0x2a1fb8,_0x2392c0){return function(_0x1448f9){if(_0x1448f9){var _0xe92b09=_0x1448f9[_0x0f97('0x1d')],_0x5e3f3a=_0x2392c0[_0x0f97('0x1e')],_0x58cb79=_0x2392c0[_0x0f97('0x1e')]+_0x2392c0[_0x0f97('0x1f')],_0x336f61;if(_0x58cb79>=_0xe92b09){_0x58cb79=_0xe92b09;_0x336f61=0xc8;}else{_0x336f61=0xce;}_0x2a1fb8[_0x0f97('0x1b')](_0x336f61);return _0x2a1fb8['set']('Content-Range',_0x5e3f3a+'-'+_0x58cb79+'/'+_0xe92b09)[_0x0f97('0x20')](_0x1448f9);}return null;};}function patchUpdates(_0x132d2f){return function(_0x3b547f){try{jsonpatch[_0x0f97('0x21')](_0x3b547f,_0x132d2f,!![]);}catch(_0x398216){return BPromise[_0x0f97('0x22')](_0x398216);}return _0x3b547f['save']();};}function saveUpdates(_0x27b771,_0x15a1ef){return function(_0x3dc0bf){if(_0x3dc0bf){return _0x3dc0bf[_0x0f97('0x23')](_0x27b771)[_0x0f97('0x24')](function(_0x316e84){return _0x316e84;});}return null;};}function removeEntity(_0x21784d,_0x52dde8){return function(_0x2977fa){if(_0x2977fa){return _0x2977fa[_0x0f97('0x25')]()[_0x0f97('0x24')](function(){_0x21784d['status'](0xcc)[_0x0f97('0x1c')]();});}};}function handleEntityNotFound(_0x25d1ef,_0x4ec6d0){return function(_0xb5721e){if(!_0xb5721e){_0x25d1ef[_0x0f97('0x1a')](0x194);}return _0xb5721e;};}function handleError(_0x4ef5bc,_0x489e1e){_0x489e1e=_0x489e1e||0x1f4;return function(_0x51aa82){logger[_0x0f97('0x26')](_0x51aa82[_0x0f97('0x27')]);if(_0x51aa82['name']){delete _0x51aa82[_0x0f97('0x28')];}_0x4ef5bc[_0x0f97('0x1b')](_0x489e1e)[_0x0f97('0x29')](_0x51aa82);};}exports[_0x0f97('0x2a')]=function(_0x10f71c,_0x23f078){var _0x51a376={},_0x164ad6={},_0x1e688d={'count':0x0,'rows':[]};var _0x3f4922=_[_0x0f97('0x2b')](db['SquareReport'][_0x0f97('0x2c')],function(_0x22cc9e){return{'name':_0x22cc9e[_0x0f97('0x2d')],'type':_0x22cc9e[_0x0f97('0x2e')][_0x0f97('0x2f')]};});_0x164ad6[_0x0f97('0x30')]=_[_0x0f97('0x2b')](_0x3f4922,_0x0f97('0x28'));_0x164ad6['query']=_['keys'](_0x10f71c[_0x0f97('0x31')]);_0x164ad6[_0x0f97('0x32')]=_[_0x0f97('0x33')](_0x164ad6[_0x0f97('0x30')],_0x164ad6[_0x0f97('0x31')]);_0x51a376[_0x0f97('0x34')]=_[_0x0f97('0x33')](_0x164ad6[_0x0f97('0x30')],qs[_0x0f97('0x35')](_0x10f71c[_0x0f97('0x31')][_0x0f97('0x35')]));_0x51a376['attributes']=_0x51a376[_0x0f97('0x34')][_0x0f97('0x36')]?_0x51a376[_0x0f97('0x34')]:_0x164ad6[_0x0f97('0x30')];if(!_0x10f71c[_0x0f97('0x31')]['hasOwnProperty'](_0x0f97('0x37'))){_0x51a376['limit']=qs[_0x0f97('0x1f')](_0x10f71c['query'][_0x0f97('0x1f')]);_0x51a376[_0x0f97('0x1e')]=qs[_0x0f97('0x1e')](_0x10f71c[_0x0f97('0x31')][_0x0f97('0x1e')]);}_0x51a376['order']=qs['sort'](_0x10f71c[_0x0f97('0x31')][_0x0f97('0x38')]);_0x51a376['where']=qs[_0x0f97('0x32')](_[_0x0f97('0x39')](_0x10f71c[_0x0f97('0x31')],_0x164ad6[_0x0f97('0x32')]),_0x3f4922);if(_0x10f71c['query'][_0x0f97('0x3a')]){_0x51a376[_0x0f97('0x3b')]=_[_0x0f97('0x3c')](_0x51a376[_0x0f97('0x3b')],{'$or':_[_0x0f97('0x2b')](_0x3f4922,function(_0x507a90){if(_0x507a90[_0x0f97('0x2e')]!==_0x0f97('0x3d')){var _0xe56880={};_0xe56880[_0x507a90[_0x0f97('0x28')]]={'$like':'%'+_0x10f71c[_0x0f97('0x31')][_0x0f97('0x3a')]+'%'};return _0xe56880;}})});}_0x51a376=_['merge']({},_0x51a376,_0x10f71c['options']);var _0x230ccf={'where':_0x51a376[_0x0f97('0x3b')]};return db[_0x0f97('0x3e')]['count'](_0x230ccf)[_0x0f97('0x24')](function(_0xb24a15){_0x1e688d[_0x0f97('0x1d')]=_0xb24a15;if(_0x10f71c['query'][_0x0f97('0x3f')]){_0x51a376[_0x0f97('0x40')]=[{'all':!![]}];}return db[_0x0f97('0x3e')][_0x0f97('0x41')](_0x51a376);})[_0x0f97('0x24')](function(_0x1dc76d){_0x1e688d[_0x0f97('0x42')]=_0x1dc76d;return _0x1e688d;})[_0x0f97('0x24')](respondWithFilteredResult(_0x23f078,_0x51a376))[_0x0f97('0x43')](handleError(_0x23f078,null));};exports[_0x0f97('0x44')]=function(_0x3087af,_0x5c1cd1){var _0x22c424={'raw':!![],'where':{'id':_0x3087af['params']['id']}},_0x423aa3={};_0x423aa3[_0x0f97('0x30')]=_['keys'](db[_0x0f97('0x3e')][_0x0f97('0x2c')]);_0x423aa3[_0x0f97('0x31')]=_['keys'](_0x3087af['query']);_0x423aa3[_0x0f97('0x32')]=_[_0x0f97('0x33')](_0x423aa3[_0x0f97('0x30')],_0x423aa3[_0x0f97('0x31')]);_0x22c424[_0x0f97('0x34')]=_['intersection'](_0x423aa3['model'],qs[_0x0f97('0x35')](_0x3087af[_0x0f97('0x31')][_0x0f97('0x35')]));_0x22c424[_0x0f97('0x34')]=_0x22c424[_0x0f97('0x34')][_0x0f97('0x36')]?_0x22c424[_0x0f97('0x34')]:_0x423aa3[_0x0f97('0x30')];if(_0x3087af[_0x0f97('0x31')]['includeAll']){_0x22c424[_0x0f97('0x40')]=[{'all':!![]}];}_0x22c424=_['merge']({},_0x22c424,_0x3087af[_0x0f97('0x45')]);return db[_0x0f97('0x3e')][_0x0f97('0x46')](_0x22c424)['then'](handleEntityNotFound(_0x5c1cd1,null))['then'](respondWithResult(_0x5c1cd1,null))[_0x0f97('0x43')](handleError(_0x5c1cd1,null));};exports[_0x0f97('0x47')]=function(_0x40ea51,_0x4d3649){return db['SquareReport']['create'](_0x40ea51[_0x0f97('0x48')],{})[_0x0f97('0x24')](respondWithResult(_0x4d3649,0xc9))[_0x0f97('0x43')](handleError(_0x4d3649,null));};exports[_0x0f97('0x23')]=function(_0x13e08c,_0xdfe372){if(_0x13e08c[_0x0f97('0x48')]['id']){delete _0x13e08c[_0x0f97('0x48')]['id'];}return db[_0x0f97('0x3e')][_0x0f97('0x46')]({'where':{'id':_0x13e08c[_0x0f97('0x49')]['id']}})['then'](handleEntityNotFound(_0xdfe372,null))[_0x0f97('0x24')](saveUpdates(_0x13e08c['body'],null))['then'](respondWithResult(_0xdfe372,null))[_0x0f97('0x43')](handleError(_0xdfe372,null));};exports['destroy']=function(_0x1a2f25,_0x20df4e){return db[_0x0f97('0x3e')][_0x0f97('0x46')]({'where':{'id':_0x1a2f25[_0x0f97('0x49')]['id']}})['then'](handleEntityNotFound(_0x20df4e,null))['then'](removeEntity(_0x20df4e,null))[_0x0f97('0x43')](handleError(_0x20df4e,null));};exports[_0x0f97('0x4a')]=function(_0x517ea0,_0x1a5d99){return db[_0x0f97('0x3e')][_0x0f97('0x4a')]()[_0x0f97('0x24')](respondWithResult(_0x1a5d99,null))['catch'](handleError(_0x1a5d99,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index d4225ef..3ad191f 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 _0xe078=['project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./squareReport.attributes','define','SquareReport','report_square','uid_pname','uniqueid'];(function(_0x2e1879,_0x25c62a){var _0x5d2cc3=function(_0x881805){while(--_0x881805){_0x2e1879['push'](_0x2e1879['shift']());}};_0x5d2cc3(++_0x25c62a);}(_0xe078,0x12e));var _0x8e07=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xe078[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0x8e07('0x0'));var util=require(_0x8e07('0x1'));var logger=require(_0x8e07('0x2'))(_0x8e07('0x3'));var moment=require(_0x8e07('0x4'));var BPromise=require(_0x8e07('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8e07('0x6'));var attributes=require(_0x8e07('0x7'));module['exports']=function(_0x1a661a,_0xdfc1e0){return _0x1a661a[_0x8e07('0x8')](_0x8e07('0x9'),attributes,{'tableName':_0x8e07('0xa'),'paranoid':![],'indexes':[{'name':_0x8e07('0xb'),'fields':[_0x8e07('0xc'),_0x8e07('0xd')]},{'name':_0x8e07('0xe'),'fields':[_0x8e07('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8d5f=['moment','bluebird','path','../../config/environment','./squareReport.attributes','report_square','uid_pname','uniqueid','leaveAt','util','../../config/logger','api'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x8d5f,0xe1));var _0xf8d5=function(_0x2da357,_0x1f9b2f){_0x2da357=_0x2da357-0x0;var _0x138fdd=_0x8d5f[_0x2da357];return _0x138fdd;};'use strict';var _=require('lodash');var util=require(_0xf8d5('0x0'));var logger=require(_0xf8d5('0x1'))(_0xf8d5('0x2'));var moment=require(_0xf8d5('0x3'));var BPromise=require(_0xf8d5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf8d5('0x5'));var rimraf=require('rimraf');var config=require(_0xf8d5('0x6'));var attributes=require(_0xf8d5('0x7'));module['exports']=function(_0x5688ea,_0x55b4da){return _0x5688ea['define']('SquareReport',attributes,{'tableName':_0xf8d5('0x8'),'paranoid':![],'indexes':[{'name':_0xf8d5('0x9'),'fields':[_0xf8d5('0xa'),'project_name']},{'name':_0xf8d5('0xb'),'fields':[_0xf8d5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index c2ce30b..b8e6660 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 _0x7da7=['update','raw','where','attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareReport','create','body','options','CreateSquareReport','debug','UpdateSquareReport'];(function(_0x7b5cdd,_0x8c88d8){var _0x3a29ae=function(_0x17859a){while(--_0x17859a){_0x7b5cdd['push'](_0x7b5cdd['shift']());}};_0x3a29ae(++_0x8c88d8);}(_0x7da7,0x10d));var _0x77da=function(_0x29ae80,_0x3579f1){_0x29ae80=_0x29ae80-0x0;var _0x5d6d71=_0x7da7[_0x29ae80];return _0x5d6d71;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var moment=require(_0x77da('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77da('0x3'));var db=require(_0x77da('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x77da('0x5'))(_0x77da('0x6'));var config=require('../../config/environment');var jayson=require(_0x77da('0x7'));var client=jayson[_0x77da('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30afe0,_0x47cf1d,_0x1191de){return new BPromise(function(_0x13992e,_0x37c5ab){return client[_0x77da('0x9')](_0x30afe0,_0x1191de)[_0x77da('0xa')](function(_0x58f3fe){logger[_0x77da('0xb')](_0x77da('0xc'),_0x47cf1d,_0x77da('0xd'));logger['debug'](_0x77da('0xe'),_0x47cf1d,_0x77da('0xd'),JSON[_0x77da('0xf')](_0x58f3fe));if(_0x58f3fe[_0x77da('0x10')]){if(_0x58f3fe['error'][_0x77da('0x11')]===0x1f4){logger[_0x77da('0x10')](_0x77da('0xc'),_0x47cf1d,_0x58f3fe['error']['message']);return _0x37c5ab(_0x58f3fe[_0x77da('0x10')][_0x77da('0x12')]);}logger['error'](_0x77da('0xc'),_0x47cf1d,_0x58f3fe[_0x77da('0x10')][_0x77da('0x12')]);return _0x13992e(_0x58f3fe[_0x77da('0x10')]['message']);}else{logger[_0x77da('0xb')]('SquareReport,\x20%s,\x20%s',_0x47cf1d,_0x77da('0xd'));_0x13992e(_0x58f3fe[_0x77da('0x13')][_0x77da('0x12')]);}})[_0x77da('0x14')](function(_0x4ecd98){logger['error']('SquareReport,\x20%s,\x20%s',_0x47cf1d,_0x4ecd98);_0x37c5ab(_0x4ecd98);});});}exports['CreateSquareReport']=function(_0x103e46){var _0x295bef=this;return new Promise(function(_0x289887,_0x335dcb){return db[_0x77da('0x15')][_0x77da('0x16')](_0x103e46[_0x77da('0x17')],{'raw':_0x103e46[_0x77da('0x18')]?_0x103e46['options']['raw']===undefined?!![]:![]:!![]})[_0x77da('0xa')](function(_0x4d1512){logger['info'](_0x77da('0x19'),_0x103e46);logger[_0x77da('0x1a')](_0x77da('0x19'),_0x103e46,JSON['stringify'](_0x4d1512));_0x289887(_0x4d1512);})['catch'](function(_0x3e6cfe){logger['error'](_0x77da('0x19'),_0x3e6cfe[_0x77da('0x12')],_0x103e46);_0x335dcb(_0x295bef[_0x77da('0x10')](0x1f4,_0x3e6cfe[_0x77da('0x12')]));});});};exports[_0x77da('0x1b')]=function(_0x270318){var _0x95b5db=this;return new Promise(function(_0x50799d,_0x4885ec){return db[_0x77da('0x15')][_0x77da('0x1c')](_0x270318[_0x77da('0x17')],{'raw':_0x270318[_0x77da('0x18')]?_0x270318['options'][_0x77da('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x270318[_0x77da('0x18')]?_0x270318[_0x77da('0x18')][_0x77da('0x1e')]||null:null,'attributes':_0x270318[_0x77da('0x18')]?_0x270318['options'][_0x77da('0x1f')]||null:null,'limit':_0x270318[_0x77da('0x18')]?_0x270318[_0x77da('0x18')][_0x77da('0x20')]||null:null})['then'](function(_0x5b4638){logger['info'](_0x77da('0x1b'),_0x270318);logger[_0x77da('0x1a')](_0x77da('0x1b'),_0x270318,JSON[_0x77da('0xf')](_0x5b4638));_0x50799d(_0x5b4638);})[_0x77da('0x14')](function(_0x4eeb99){logger[_0x77da('0x10')](_0x77da('0x1b'),_0x4eeb99[_0x77da('0x12')],_0x270318);_0x4885ec(_0x95b5db[_0x77da('0x10')](0x1f4,_0x4eeb99[_0x77da('0x12')]));});});}; \ No newline at end of file +var _0x008c=['client','http','info','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SquareReport,\x20%s,\x20%s','message','catch','create','then','stringify','CreateSquareReport','SquareReport','options','raw','limit','UpdateSquareReport','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x592b8f,_0x5ddc05){var _0x152f11=function(_0x5edf2f){while(--_0x5edf2f){_0x592b8f['push'](_0x592b8f['shift']());}};_0x152f11(++_0x5ddc05);}(_0x008c,0x188));var _0xc008=function(_0x49f8c2,_0x5166b7){_0x49f8c2=_0x49f8c2-0x0;var _0x3e63ec=_0x008c[_0x49f8c2];return _0x3e63ec;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('SquareReport,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('SquareReport,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('SquareReport,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('SquareReport,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});}exports['CreateSquareReport']=function(_0x540e45){var _0x5c2668=this;return new Promise(function(_0x46042b,_0x462af5){return db['SquareReport'][_0xc008('0x15')](_0x540e45['body'],{'raw':_0x540e45['options']?_0x540e45['options']['raw']===undefined?!![]:![]:!![]})[_0xc008('0x16')](function(_0x4b9726){logger['info']('CreateSquareReport',_0x540e45);logger['debug']('CreateSquareReport',_0x540e45,JSON[_0xc008('0x17')](_0x4b9726));_0x46042b(_0x4b9726);})[_0xc008('0x14')](function(_0x251db2){logger[_0xc008('0x10')](_0xc008('0x18'),_0x251db2[_0xc008('0x13')],_0x540e45);_0x462af5(_0x5c2668['error'](0x1f4,_0x251db2[_0xc008('0x13')]));});});};exports['UpdateSquareReport']=function(_0x58a6ea){var _0x218599=this;return new Promise(function(_0x36f358,_0x2e3cfb){return db[_0xc008('0x19')]['update'](_0x58a6ea['body'],{'raw':_0x58a6ea['options']?_0x58a6ea[_0xc008('0x1a')][_0xc008('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58a6ea[_0xc008('0x1a')]?_0x58a6ea[_0xc008('0x1a')]['where']||null:null,'attributes':_0x58a6ea['options']?_0x58a6ea['options']['attributes']||null:null,'limit':_0x58a6ea['options']?_0x58a6ea[_0xc008('0x1a')][_0xc008('0x1c')]||null:null})[_0xc008('0x16')](function(_0x529961){logger[_0xc008('0xd')](_0xc008('0x1d'),_0x58a6ea);logger[_0xc008('0x1e')](_0xc008('0x1d'),_0x58a6ea,JSON['stringify'](_0x529961));_0x36f358(_0x529961);})[_0xc008('0x14')](function(_0x2e0b4e){logger['error']('UpdateSquareReport',_0x2e0b4e['message'],_0x58a6ea);_0x2e3cfb(_0x218599[_0xc008('0x10')](0x1f4,_0x2e0b4e[_0xc008('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 4c6c174..f49ab8b 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 _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x9fc2e6,_0x59cc51){var _0x41aa8b=function(_0x3f8c28){while(--_0x3f8c28){_0x9fc2e6['push'](_0x9fc2e6['shift']());}};_0x41aa8b(++_0x59cc51);}(_0x7a54,0x106));var _0x47a5=function(_0x176fd8,_0x290116){_0x176fd8=_0x176fd8-0x0;var _0x47f201=_0x7a54[_0x176fd8];return _0x47f201;};'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 auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file +var _0x7a54=['describe','/:id','create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated'];(function(_0x885a73,_0x182734){var _0x3a2630=function(_0x50b244){while(--_0x50b244){_0x885a73['push'](_0x885a73['shift']());}};_0x3a2630(++_0x182734);}(_0x7a54,0x106));var _0x47a5=function(_0x552bea,_0x47911c){_0x552bea=_0x552bea-0x0;var _0x1d0a19=_0x7a54[_0x552bea];return _0x1d0a19;};'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 auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 60b9505..9aac3b4 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 _0x1264=['sequelize','STRING','TEXT'];(function(_0x54eace,_0x1ba673){var _0x2f0147=function(_0xfbf7de){while(--_0xfbf7de){_0x54eace['push'](_0x54eace['shift']());}};_0x2f0147(++_0x1ba673);}(_0x1264,0xa5));var _0x4126=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0x1264[_0x3f5dca];return _0x5b833a;};'use strict';var Sequelize=require(_0x4126('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x4126('0x1')]},'node':{'type':Sequelize[_0x4126('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x4126('0x2')]},'project_name':{'type':Sequelize[_0x4126('0x1')]},'callerid':{'type':Sequelize[_0x4126('0x1')]}}; \ No newline at end of file +var _0x7603=['TEXT','sequelize','exports','STRING'];(function(_0x4b50d6,_0x27397b){var _0x316e25=function(_0x100912){while(--_0x100912){_0x4b50d6['push'](_0x4b50d6['shift']());}};_0x316e25(++_0x27397b);}(_0x7603,0xf5));var _0x3760=function(_0x9ac948,_0x4bad76){_0x9ac948=_0x9ac948-0x0;var _0x274ab6=_0x7603[_0x9ac948];return _0x274ab6;};'use strict';var Sequelize=require(_0x3760('0x0'));module[_0x3760('0x1')]={'uniqueid':{'type':Sequelize[_0x3760('0x2')]},'node':{'type':Sequelize[_0x3760('0x2')]},'application':{'type':Sequelize[_0x3760('0x2')]},'data':{'type':Sequelize[_0x3760('0x3')]},'project_name':{'type':Sequelize[_0x3760('0x2')]},'callerid':{'type':Sequelize[_0x3760('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 47a22c8..15211e5 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 _0x376f=['save','then','destroy','error','stack','name','send','index','SquareDetailsReport','fieldName','key','map','keys','intersection','query','model','fields','attributes','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','show','rawAttributes','length','catch','create','body','update','find','params','describe','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x376f,0x78));var _0xf376=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x376f[_0x42bdad];return _0x122626;};'use strict';var pdf=require(_0xf376('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf376('0x1'));var jsonpatch=require(_0xf376('0x2'));var rp=require('request-promise');var moment=require(_0xf376('0x3'));var BPromise=require(_0xf376('0x4'));var Mustache=require(_0xf376('0x5'));var util=require(_0xf376('0x6'));var path=require(_0xf376('0x7'));var sox=require(_0xf376('0x8'));var csv=require(_0xf376('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf376('0xa'));var squel=require(_0xf376('0xb'));var crypto=require(_0xf376('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf376('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf376('0xe'));var Papa=require('papaparse');var Redis=require(_0xf376('0xf'));var authService=require(_0xf376('0x10'));var qs=require(_0xf376('0x11'));var as=require(_0xf376('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf376('0x13'))(_0xf376('0x14'));var utils=require(_0xf376('0x15'));var config=require(_0xf376('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf376('0x17'))['db'];function respondWithStatusCode(_0x2b2b37,_0x100295){_0x100295=_0x100295||0xcc;return function(_0x4dca87){if(_0x4dca87){return _0x2b2b37[_0xf376('0x18')](_0x100295);}return _0x2b2b37[_0xf376('0x19')](_0x100295)[_0xf376('0x1a')]();};}function respondWithResult(_0xb133c,_0xd2a05e){_0xd2a05e=_0xd2a05e||0xc8;return function(_0x1688c7){if(_0x1688c7){return _0xb133c[_0xf376('0x19')](_0xd2a05e)[_0xf376('0x1b')](_0x1688c7);}};}function respondWithFilteredResult(_0x54b651,_0x69c83c){return function(_0x56c89f){if(_0x56c89f){var _0x36ed42=_0x56c89f['count'],_0x22e500=_0x69c83c[_0xf376('0x1c')],_0x281527=_0x69c83c['offset']+_0x69c83c[_0xf376('0x1d')],_0x59e4a8;if(_0x281527>=_0x36ed42){_0x281527=_0x36ed42;_0x59e4a8=0xc8;}else{_0x59e4a8=0xce;}_0x54b651[_0xf376('0x19')](_0x59e4a8);return _0x54b651[_0xf376('0x1e')](_0xf376('0x1f'),_0x22e500+'-'+_0x281527+'/'+_0x36ed42)[_0xf376('0x1b')](_0x56c89f);}return null;};}function patchUpdates(_0xbdc8d8){return function(_0x5cbf32){try{jsonpatch[_0xf376('0x20')](_0x5cbf32,_0xbdc8d8,!![]);}catch(_0x4017fe){return BPromise[_0xf376('0x21')](_0x4017fe);}return _0x5cbf32[_0xf376('0x22')]();};}function saveUpdates(_0x5a8286,_0x290659){return function(_0xba9748){if(_0xba9748){return _0xba9748['update'](_0x5a8286)[_0xf376('0x23')](function(_0x1fe1e3){return _0x1fe1e3;});}return null;};}function removeEntity(_0x56a08a,_0x31bb2a){return function(_0x2250d2){if(_0x2250d2){return _0x2250d2[_0xf376('0x24')]()[_0xf376('0x23')](function(){_0x56a08a['status'](0xcc)[_0xf376('0x1a')]();});}};}function handleEntityNotFound(_0x27fbd3,_0x12b6ba){return function(_0x5ef0b8){if(!_0x5ef0b8){_0x27fbd3[_0xf376('0x18')](0x194);}return _0x5ef0b8;};}function handleError(_0xf0a79b,_0x21c7ba){_0x21c7ba=_0x21c7ba||0x1f4;return function(_0x3ade8e){logger[_0xf376('0x25')](_0x3ade8e[_0xf376('0x26')]);if(_0x3ade8e['name']){delete _0x3ade8e[_0xf376('0x27')];}_0xf0a79b[_0xf376('0x19')](_0x21c7ba)[_0xf376('0x28')](_0x3ade8e);};}exports[_0xf376('0x29')]=function(_0xad35c7,_0x14d52a){var _0x2b0904={},_0x3432ac={},_0x19ecc5={'count':0x0,'rows':[]};var _0x154e78=_['map'](db[_0xf376('0x2a')]['rawAttributes'],function(_0x2efa59){return{'name':_0x2efa59[_0xf376('0x2b')],'type':_0x2efa59['type'][_0xf376('0x2c')]};});_0x3432ac['model']=_[_0xf376('0x2d')](_0x154e78,_0xf376('0x27'));_0x3432ac['query']=_[_0xf376('0x2e')](_0xad35c7['query']);_0x3432ac['filters']=_[_0xf376('0x2f')](_0x3432ac['model'],_0x3432ac[_0xf376('0x30')]);_0x2b0904['attributes']=_[_0xf376('0x2f')](_0x3432ac[_0xf376('0x31')],qs[_0xf376('0x32')](_0xad35c7[_0xf376('0x30')][_0xf376('0x32')]));_0x2b0904[_0xf376('0x33')]=_0x2b0904[_0xf376('0x33')]['length']?_0x2b0904[_0xf376('0x33')]:_0x3432ac[_0xf376('0x31')];if(!_0xad35c7['query']['hasOwnProperty']('nolimit')){_0x2b0904[_0xf376('0x1d')]=qs[_0xf376('0x1d')](_0xad35c7[_0xf376('0x30')]['limit']);_0x2b0904[_0xf376('0x1c')]=qs[_0xf376('0x1c')](_0xad35c7[_0xf376('0x30')][_0xf376('0x1c')]);}_0x2b0904[_0xf376('0x34')]=qs[_0xf376('0x35')](_0xad35c7[_0xf376('0x30')][_0xf376('0x35')]);_0x2b0904[_0xf376('0x36')]=qs[_0xf376('0x37')](_[_0xf376('0x38')](_0xad35c7['query'],_0x3432ac[_0xf376('0x37')]),_0x154e78);if(_0xad35c7[_0xf376('0x30')][_0xf376('0x39')]){_0x2b0904[_0xf376('0x36')]=_[_0xf376('0x3a')](_0x2b0904[_0xf376('0x36')],{'$or':_[_0xf376('0x2d')](_0x154e78,function(_0x1bba4a){if(_0x1bba4a[_0xf376('0x3b')]!==_0xf376('0x3c')){var _0x445539={};_0x445539[_0x1bba4a['name']]={'$like':'%'+_0xad35c7['query']['filter']+'%'};return _0x445539;}})});}_0x2b0904=_['merge']({},_0x2b0904,_0xad35c7[_0xf376('0x3d')]);var _0x2eef22={'where':_0x2b0904[_0xf376('0x36')]};return db[_0xf376('0x2a')][_0xf376('0x3e')](_0x2eef22)[_0xf376('0x23')](function(_0xbdf04){_0x19ecc5['count']=_0xbdf04;if(_0xad35c7[_0xf376('0x30')][_0xf376('0x3f')]){_0x2b0904[_0xf376('0x40')]=[{'all':!![]}];}return db[_0xf376('0x2a')][_0xf376('0x41')](_0x2b0904);})['then'](function(_0xcac266){_0x19ecc5[_0xf376('0x42')]=_0xcac266;return _0x19ecc5;})['then'](respondWithFilteredResult(_0x14d52a,_0x2b0904))['catch'](handleError(_0x14d52a,null));};exports[_0xf376('0x43')]=function(_0x5e98ae,_0x2aa9c4){var _0x15e69f={'raw':!![],'where':{'id':_0x5e98ae['params']['id']}},_0xebef3a={};_0xebef3a[_0xf376('0x31')]=_[_0xf376('0x2e')](db['SquareDetailsReport'][_0xf376('0x44')]);_0xebef3a[_0xf376('0x30')]=_[_0xf376('0x2e')](_0x5e98ae['query']);_0xebef3a[_0xf376('0x37')]=_[_0xf376('0x2f')](_0xebef3a[_0xf376('0x31')],_0xebef3a[_0xf376('0x30')]);_0x15e69f[_0xf376('0x33')]=_[_0xf376('0x2f')](_0xebef3a[_0xf376('0x31')],qs[_0xf376('0x32')](_0x5e98ae[_0xf376('0x30')]['fields']));_0x15e69f[_0xf376('0x33')]=_0x15e69f[_0xf376('0x33')][_0xf376('0x45')]?_0x15e69f[_0xf376('0x33')]:_0xebef3a[_0xf376('0x31')];if(_0x5e98ae[_0xf376('0x30')][_0xf376('0x3f')]){_0x15e69f[_0xf376('0x40')]=[{'all':!![]}];}_0x15e69f=_['merge']({},_0x15e69f,_0x5e98ae[_0xf376('0x3d')]);return db[_0xf376('0x2a')]['find'](_0x15e69f)['then'](handleEntityNotFound(_0x2aa9c4,null))[_0xf376('0x23')](respondWithResult(_0x2aa9c4,null))[_0xf376('0x46')](handleError(_0x2aa9c4,null));};exports[_0xf376('0x47')]=function(_0x5a6d74,_0x142fec){return db[_0xf376('0x2a')]['create'](_0x5a6d74[_0xf376('0x48')],{})[_0xf376('0x23')](respondWithResult(_0x142fec,0xc9))['catch'](handleError(_0x142fec,null));};exports[_0xf376('0x49')]=function(_0x2384e8,_0x303c88){if(_0x2384e8[_0xf376('0x48')]['id']){delete _0x2384e8[_0xf376('0x48')]['id'];}return db[_0xf376('0x2a')][_0xf376('0x4a')]({'where':{'id':_0x2384e8[_0xf376('0x4b')]['id']}})[_0xf376('0x23')](handleEntityNotFound(_0x303c88,null))[_0xf376('0x23')](saveUpdates(_0x2384e8[_0xf376('0x48')],null))[_0xf376('0x23')](respondWithResult(_0x303c88,null))[_0xf376('0x46')](handleError(_0x303c88,null));};exports[_0xf376('0x24')]=function(_0x414c09,_0x126bbe){return db[_0xf376('0x2a')][_0xf376('0x4a')]({'where':{'id':_0x414c09['params']['id']}})[_0xf376('0x23')](handleEntityNotFound(_0x126bbe,null))[_0xf376('0x23')](removeEntity(_0x126bbe,null))['catch'](handleError(_0x126bbe,null));};exports[_0xf376('0x4c')]=function(_0x374e81,_0x62e446){return db['SquareDetailsReport'][_0xf376('0x4c')]()['then'](respondWithResult(_0x62e446,null))['catch'](handleError(_0x62e446,null));}; \ No newline at end of file +var _0x6348=['update','then','destroy','stack','name','send','index','SquareDetailsReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x6348,0x1f3));var _0x8634=function(_0x195c2c,_0x157ee4){_0x195c2c=_0x195c2c-0x0;var _0x35dbee=_0x6348[_0x195c2c];return _0x35dbee;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8634('0x0'));var rimraf=require(_0x8634('0x1'));var zipdir=require(_0x8634('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8634('0x3'));var moment=require('moment');var BPromise=require(_0x8634('0x4'));var Mustache=require(_0x8634('0x5'));var util=require(_0x8634('0x6'));var path=require(_0x8634('0x7'));var sox=require('sox');var csv=require(_0x8634('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8634('0x9'));var squel=require(_0x8634('0xa'));var crypto=require('crypto');var jsforce=require(_0x8634('0xb'));var deskjs=require(_0x8634('0xc'));var toCsv=require(_0x8634('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8634('0xd'));var authService=require(_0x8634('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8634('0xf'));var hardwareService=require(_0x8634('0x10'));var logger=require(_0x8634('0x11'))('api');var utils=require(_0x8634('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3877e1,_0x3885d1){_0x3885d1=_0x3885d1||0xcc;return function(_0x313bcc){if(_0x313bcc){return _0x3877e1[_0x8634('0x13')](_0x3885d1);}return _0x3877e1['status'](_0x3885d1)[_0x8634('0x14')]();};}function respondWithResult(_0x54c679,_0x404d7a){_0x404d7a=_0x404d7a||0xc8;return function(_0x53ada2){if(_0x53ada2){return _0x54c679[_0x8634('0x15')](_0x404d7a)[_0x8634('0x16')](_0x53ada2);}};}function respondWithFilteredResult(_0x5f366f,_0x389c07){return function(_0x1ca59b){if(_0x1ca59b){var _0x4fd62a=_0x1ca59b[_0x8634('0x17')],_0x663b66=_0x389c07[_0x8634('0x18')],_0x2997cf=_0x389c07[_0x8634('0x18')]+_0x389c07[_0x8634('0x19')],_0x4e4de2;if(_0x2997cf>=_0x4fd62a){_0x2997cf=_0x4fd62a;_0x4e4de2=0xc8;}else{_0x4e4de2=0xce;}_0x5f366f[_0x8634('0x15')](_0x4e4de2);return _0x5f366f['set'](_0x8634('0x1a'),_0x663b66+'-'+_0x2997cf+'/'+_0x4fd62a)[_0x8634('0x16')](_0x1ca59b);}return null;};}function patchUpdates(_0x3a128b){return function(_0x360d4f){try{jsonpatch[_0x8634('0x1b')](_0x360d4f,_0x3a128b,!![]);}catch(_0x22649b){return BPromise[_0x8634('0x1c')](_0x22649b);}return _0x360d4f['save']();};}function saveUpdates(_0x23e02f,_0x53665b){return function(_0x287f64){if(_0x287f64){return _0x287f64[_0x8634('0x1d')](_0x23e02f)[_0x8634('0x1e')](function(_0x5187bb){return _0x5187bb;});}return null;};}function removeEntity(_0x9b9155,_0x1654a6){return function(_0xee9394){if(_0xee9394){return _0xee9394[_0x8634('0x1f')]()[_0x8634('0x1e')](function(){_0x9b9155[_0x8634('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e83bc,_0x5824f1){return function(_0xcd3aab){if(!_0xcd3aab){_0x1e83bc[_0x8634('0x13')](0x194);}return _0xcd3aab;};}function handleError(_0x1b3597,_0x2ed87a){_0x2ed87a=_0x2ed87a||0x1f4;return function(_0x58c5f0){logger['error'](_0x58c5f0[_0x8634('0x20')]);if(_0x58c5f0['name']){delete _0x58c5f0[_0x8634('0x21')];}_0x1b3597[_0x8634('0x15')](_0x2ed87a)[_0x8634('0x22')](_0x58c5f0);};}exports[_0x8634('0x23')]=function(_0x53ee67,_0x31faa1){var _0x1fc010={},_0x4047e2={},_0xfb1b7={'count':0x0,'rows':[]};var _0x2a4c2e=_['map'](db[_0x8634('0x24')][_0x8634('0x25')],function(_0x262e3e){return{'name':_0x262e3e[_0x8634('0x26')],'type':_0x262e3e[_0x8634('0x27')]['key']};});_0x4047e2[_0x8634('0x28')]=_[_0x8634('0x29')](_0x2a4c2e,'name');_0x4047e2[_0x8634('0x2a')]=_['keys'](_0x53ee67[_0x8634('0x2a')]);_0x4047e2[_0x8634('0x2b')]=_[_0x8634('0x2c')](_0x4047e2[_0x8634('0x28')],_0x4047e2[_0x8634('0x2a')]);_0x1fc010['attributes']=_[_0x8634('0x2c')](_0x4047e2['model'],qs[_0x8634('0x2d')](_0x53ee67[_0x8634('0x2a')][_0x8634('0x2d')]));_0x1fc010[_0x8634('0x2e')]=_0x1fc010[_0x8634('0x2e')]['length']?_0x1fc010[_0x8634('0x2e')]:_0x4047e2['model'];if(!_0x53ee67[_0x8634('0x2a')][_0x8634('0x2f')]('nolimit')){_0x1fc010['limit']=qs[_0x8634('0x19')](_0x53ee67[_0x8634('0x2a')][_0x8634('0x19')]);_0x1fc010[_0x8634('0x18')]=qs[_0x8634('0x18')](_0x53ee67[_0x8634('0x2a')]['offset']);}_0x1fc010['order']=qs[_0x8634('0x30')](_0x53ee67[_0x8634('0x2a')][_0x8634('0x30')]);_0x1fc010[_0x8634('0x31')]=qs[_0x8634('0x2b')](_[_0x8634('0x32')](_0x53ee67[_0x8634('0x2a')],_0x4047e2[_0x8634('0x2b')]),_0x2a4c2e);if(_0x53ee67[_0x8634('0x2a')][_0x8634('0x33')]){_0x1fc010[_0x8634('0x31')]=_[_0x8634('0x34')](_0x1fc010[_0x8634('0x31')],{'$or':_[_0x8634('0x29')](_0x2a4c2e,function(_0x163c26){if(_0x163c26['type']!==_0x8634('0x35')){var _0x2217d9={};_0x2217d9[_0x163c26[_0x8634('0x21')]]={'$like':'%'+_0x53ee67[_0x8634('0x2a')][_0x8634('0x33')]+'%'};return _0x2217d9;}})});}_0x1fc010=_[_0x8634('0x34')]({},_0x1fc010,_0x53ee67[_0x8634('0x36')]);var _0x3ba563={'where':_0x1fc010[_0x8634('0x31')]};return db['SquareDetailsReport'][_0x8634('0x17')](_0x3ba563)[_0x8634('0x1e')](function(_0x29647b){_0xfb1b7['count']=_0x29647b;if(_0x53ee67['query'][_0x8634('0x37')]){_0x1fc010['include']=[{'all':!![]}];}return db[_0x8634('0x24')][_0x8634('0x38')](_0x1fc010);})[_0x8634('0x1e')](function(_0x3d6186){_0xfb1b7[_0x8634('0x39')]=_0x3d6186;return _0xfb1b7;})[_0x8634('0x1e')](respondWithFilteredResult(_0x31faa1,_0x1fc010))[_0x8634('0x3a')](handleError(_0x31faa1,null));};exports[_0x8634('0x3b')]=function(_0x3e6578,_0x43dbad){var _0x5998f9={'raw':!![],'where':{'id':_0x3e6578[_0x8634('0x3c')]['id']}},_0x5637f6={};_0x5637f6['model']=_['keys'](db['SquareDetailsReport'][_0x8634('0x25')]);_0x5637f6[_0x8634('0x2a')]=_['keys'](_0x3e6578[_0x8634('0x2a')]);_0x5637f6[_0x8634('0x2b')]=_[_0x8634('0x2c')](_0x5637f6[_0x8634('0x28')],_0x5637f6[_0x8634('0x2a')]);_0x5998f9[_0x8634('0x2e')]=_['intersection'](_0x5637f6[_0x8634('0x28')],qs[_0x8634('0x2d')](_0x3e6578[_0x8634('0x2a')]['fields']));_0x5998f9[_0x8634('0x2e')]=_0x5998f9[_0x8634('0x2e')]['length']?_0x5998f9['attributes']:_0x5637f6[_0x8634('0x28')];if(_0x3e6578['query']['includeAll']){_0x5998f9[_0x8634('0x3d')]=[{'all':!![]}];}_0x5998f9=_[_0x8634('0x34')]({},_0x5998f9,_0x3e6578['options']);return db['SquareDetailsReport'][_0x8634('0x3e')](_0x5998f9)[_0x8634('0x1e')](handleEntityNotFound(_0x43dbad,null))[_0x8634('0x1e')](respondWithResult(_0x43dbad,null))[_0x8634('0x3a')](handleError(_0x43dbad,null));};exports[_0x8634('0x3f')]=function(_0x5c81a2,_0x557796){return db[_0x8634('0x24')][_0x8634('0x3f')](_0x5c81a2[_0x8634('0x40')],{})[_0x8634('0x1e')](respondWithResult(_0x557796,0xc9))['catch'](handleError(_0x557796,null));};exports[_0x8634('0x1d')]=function(_0x2c8e9b,_0x4c4efd){if(_0x2c8e9b[_0x8634('0x40')]['id']){delete _0x2c8e9b[_0x8634('0x40')]['id'];}return db[_0x8634('0x24')]['find']({'where':{'id':_0x2c8e9b[_0x8634('0x3c')]['id']}})[_0x8634('0x1e')](handleEntityNotFound(_0x4c4efd,null))['then'](saveUpdates(_0x2c8e9b[_0x8634('0x40')],null))['then'](respondWithResult(_0x4c4efd,null))[_0x8634('0x3a')](handleError(_0x4c4efd,null));};exports['destroy']=function(_0x122b50,_0x14aee5){return db[_0x8634('0x24')][_0x8634('0x3e')]({'where':{'id':_0x122b50['params']['id']}})[_0x8634('0x1e')](handleEntityNotFound(_0x14aee5,null))[_0x8634('0x1e')](removeEntity(_0x14aee5,null))[_0x8634('0x3a')](handleError(_0x14aee5,null));};exports[_0x8634('0x41')]=function(_0x44609c,_0x127b33){return db['SquareDetailsReport'][_0x8634('0x41')]()['then'](respondWithResult(_0x127b33,null))[_0x8634('0x3a')](handleError(_0x127b33,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 3015075..b440e3b 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 _0xd647=['exports','define','SquareDetailsReport','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2e2c4a,_0x3aee9b){var _0x131e89=function(_0x50595d){while(--_0x50595d){_0x2e2c4a['push'](_0x2e2c4a['shift']());}};_0x131e89(++_0x3aee9b);}(_0xd647,0x8f));var _0x7d64=function(_0x407461,_0x1cf61c){_0x407461=_0x407461-0x0;var _0x2b3ffa=_0xd647[_0x407461];return _0x2b3ffa;};'use strict';var _=require('lodash');var util=require(_0x7d64('0x0'));var logger=require(_0x7d64('0x1'))('api');var moment=require(_0x7d64('0x2'));var BPromise=require(_0x7d64('0x3'));var rp=require(_0x7d64('0x4'));var fs=require('fs');var path=require(_0x7d64('0x5'));var rimraf=require('rimraf');var config=require(_0x7d64('0x6'));var attributes=require('./squareReportDetail.attributes');module[_0x7d64('0x7')]=function(_0x32ac11,_0x4c3b07){return _0x32ac11[_0x7d64('0x8')](_0x7d64('0x9'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef2a=['moment','bluebird','request-promise','path','../../config/environment','./squareReportDetail.attributes','define','report_square_details','lodash','util','../../config/logger','api'];(function(_0x6182ff,_0x59d492){var _0x1cec22=function(_0x2e96f8){while(--_0x2e96f8){_0x6182ff['push'](_0x6182ff['shift']());}};_0x1cec22(++_0x59d492);}(_0xef2a,0x1a0));var _0xaef2=function(_0x4adc7a,_0x1eebf4){_0x4adc7a=_0x4adc7a-0x0;var _0x24a3a1=_0xef2a[_0x4adc7a];return _0x24a3a1;};'use strict';var _=require(_0xaef2('0x0'));var util=require(_0xaef2('0x1'));var logger=require(_0xaef2('0x2'))(_0xaef2('0x3'));var moment=require(_0xaef2('0x4'));var BPromise=require(_0xaef2('0x5'));var rp=require(_0xaef2('0x6'));var fs=require('fs');var path=require(_0xaef2('0x7'));var rimraf=require('rimraf');var config=require(_0xaef2('0x8'));var attributes=require(_0xaef2('0x9'));module['exports']=function(_0xc976a4,_0x56365a){return _0xc976a4[_0xaef2('0xa')]('SquareDetailsReport',attributes,{'tableName':_0xaef2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 6b008ac..a6e469f 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 _0x354c=['ioredis','../../config/utils','jayson/promise','http','then','info','SquareDetailsReport,\x20%s,\x20%s','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareDetailsReport','create','body','options','CreateSquareDetailsReport','debug','util','moment','bluebird','randomstring'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x354c,0x173));var _0xc354=function(_0xeb19bc,_0x4eb2ff){_0xeb19bc=_0xeb19bc-0x0;var _0x2c721a=_0x354c[_0xeb19bc];return _0x2c721a;};'use strict';var _=require('lodash');var util=require(_0xc354('0x0'));var moment=require(_0xc354('0x1'));var BPromise=require(_0xc354('0x2'));var rs=require(_0xc354('0x3'));var fs=require('fs');var Redis=require(_0xc354('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc354('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc354('0x6'));var client=jayson['client'][_0xc354('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xb1f768,_0x22a0a3,_0x1fe55b){return new BPromise(function(_0x635f0f,_0x48b665){return client['request'](_0xb1f768,_0x1fe55b)[_0xc354('0x8')](function(_0x167cf3){logger[_0xc354('0x9')](_0xc354('0xa'),_0x22a0a3,'request\x20sent');logger['debug'](_0xc354('0xb'),_0x22a0a3,_0xc354('0xc'),JSON[_0xc354('0xd')](_0x167cf3));if(_0x167cf3[_0xc354('0xe')]){if(_0x167cf3[_0xc354('0xe')][_0xc354('0xf')]===0x1f4){logger[_0xc354('0xe')](_0xc354('0xa'),_0x22a0a3,_0x167cf3[_0xc354('0xe')][_0xc354('0x10')]);return _0x48b665(_0x167cf3['error'][_0xc354('0x10')]);}logger[_0xc354('0xe')](_0xc354('0xa'),_0x22a0a3,_0x167cf3[_0xc354('0xe')]['message']);return _0x635f0f(_0x167cf3[_0xc354('0xe')][_0xc354('0x10')]);}else{logger[_0xc354('0x9')](_0xc354('0xa'),_0x22a0a3,_0xc354('0xc'));_0x635f0f(_0x167cf3[_0xc354('0x11')]['message']);}})[_0xc354('0x12')](function(_0x42c945){logger[_0xc354('0xe')](_0xc354('0xa'),_0x22a0a3,_0x42c945);_0x48b665(_0x42c945);});});}exports['CreateSquareDetailsReport']=function(_0x5a60a7){var _0x4d5af1=this;return new Promise(function(_0x321244,_0x127099){return db[_0xc354('0x13')][_0xc354('0x14')](_0x5a60a7[_0xc354('0x15')],{'raw':_0x5a60a7[_0xc354('0x16')]?_0x5a60a7[_0xc354('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xc354('0x8')](function(_0x1a9263){logger[_0xc354('0x9')](_0xc354('0x17'),_0x5a60a7);logger[_0xc354('0x18')]('CreateSquareDetailsReport',_0x5a60a7,JSON['stringify'](_0x1a9263));_0x321244(_0x1a9263);})[_0xc354('0x12')](function(_0x40b6ff){logger['error'](_0xc354('0x17'),_0x40b6ff[_0xc354('0x10')],_0x5a60a7);_0x127099(_0x4d5af1[_0xc354('0xe')](0x1f4,_0x40b6ff[_0xc354('0x10')]));});});}; \ No newline at end of file +var _0x67f9=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','info','result','CreateSquareDetailsReport','body','options','raw','util','moment','bluebird','ioredis'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x67f9,0x128));var _0x967f=function(_0x34c840,_0x15a72b){_0x34c840=_0x34c840-0x0;var _0x14cdc1=_0x67f9[_0x34c840];return _0x14cdc1;};'use strict';var _=require('lodash');var util=require(_0x967f('0x0'));var moment=require(_0x967f('0x1'));var BPromise=require(_0x967f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x967f('0x3'));var db=require(_0x967f('0x4'))['db'];var utils=require(_0x967f('0x5'));var logger=require(_0x967f('0x6'))(_0x967f('0x7'));var config=require(_0x967f('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2484be,_0x571cf7,_0x567e6e){return new BPromise(function(_0x56076e,_0x1aff56){return client[_0x967f('0x9')](_0x2484be,_0x567e6e)[_0x967f('0xa')](function(_0x101c27){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x571cf7,'request\x20sent');logger[_0x967f('0xb')](_0x967f('0xc'),_0x571cf7,_0x967f('0xd'),JSON[_0x967f('0xe')](_0x101c27));if(_0x101c27[_0x967f('0xf')]){if(_0x101c27['error'][_0x967f('0x10')]===0x1f4){logger['error'](_0x967f('0x11'),_0x571cf7,_0x101c27[_0x967f('0xf')][_0x967f('0x12')]);return _0x1aff56(_0x101c27[_0x967f('0xf')][_0x967f('0x12')]);}logger[_0x967f('0xf')](_0x967f('0x11'),_0x571cf7,_0x101c27[_0x967f('0xf')]['message']);return _0x56076e(_0x101c27[_0x967f('0xf')][_0x967f('0x12')]);}else{logger[_0x967f('0x13')]('SquareDetailsReport,\x20%s,\x20%s',_0x571cf7,_0x967f('0xd'));_0x56076e(_0x101c27[_0x967f('0x14')][_0x967f('0x12')]);}})['catch'](function(_0x2bc0b2){logger[_0x967f('0xf')](_0x967f('0x11'),_0x571cf7,_0x2bc0b2);_0x1aff56(_0x2bc0b2);});});}exports[_0x967f('0x15')]=function(_0x55ea03){var _0x458ff2=this;return new Promise(function(_0x4a39ca,_0x207f83){return db['SquareDetailsReport']['create'](_0x55ea03[_0x967f('0x16')],{'raw':_0x55ea03[_0x967f('0x17')]?_0x55ea03[_0x967f('0x17')][_0x967f('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x275096){logger[_0x967f('0x13')]('CreateSquareDetailsReport',_0x55ea03);logger[_0x967f('0xb')](_0x967f('0x15'),_0x55ea03,JSON['stringify'](_0x275096));_0x4a39ca(_0x275096);})['catch'](function(_0x57c5d2){logger[_0x967f('0xf')](_0x967f('0x15'),_0x57c5d2[_0x967f('0x12')],_0x55ea03);_0x207f83(_0x458ff2[_0x967f('0xf')](0x1f4,_0x57c5d2[_0x967f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 32873e9..5114911 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 _0xb6c6=['killProcess','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index','/process/:pid/kill'];(function(_0x26f081,_0x4277f3){var _0x4bf032=function(_0x1e49d8){while(--_0x1e49d8){_0x26f081['push'](_0x26f081['shift']());}};_0x4bf032(++_0x4277f3);}(_0xb6c6,0xeb));var _0x6b6c=function(_0x437f44,_0x5ee92c){_0x437f44=_0x437f44-0x0;var _0x2f93bb=_0xb6c6[_0x437f44];return _0x2f93bb;};'use strict';var express=require(_0x6b6c('0x0'));var router=express[_0x6b6c('0x1')]();var auth=require(_0x6b6c('0x2'));var controller=require(_0x6b6c('0x3'));router[_0x6b6c('0x4')]('/',auth[_0x6b6c('0x5')](),controller[_0x6b6c('0x6')]);router[_0x6b6c('0x4')](_0x6b6c('0x7'),auth['isAuthenticated'](),controller[_0x6b6c('0x8')]);module['exports']=router; \ No newline at end of file +var _0x3557=['index','/process/:pid/kill','killProcess','../../components/auth/service','./system.controller','get','isAuthenticated'];(function(_0x474c39,_0x17399c){var _0x1e25b4=function(_0x242f87){while(--_0x242f87){_0x474c39['push'](_0x474c39['shift']());}};_0x1e25b4(++_0x17399c);}(_0x3557,0x137));var _0x7355=function(_0x5426e2,_0x5f2968){_0x5426e2=_0x5426e2-0x0;var _0x920dc=_0x3557[_0x5426e2];return _0x920dc;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x7355('0x0'));var controller=require(_0x7355('0x1'));router[_0x7355('0x2')]('/',auth[_0x7355('0x3')](),controller[_0x7355('0x4')]);router[_0x7355('0x2')](_0x7355('0x5'),auth[_0x7355('0x3')](),controller[_0x7355('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 26e13ca..6233ec8 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 _0x339d=['ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','child_process','exec','../../config/logger','api','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','killProcess','format'];(function(_0x5d3903,_0x3d6c3e){var _0x4b8bc9=function(_0x92b297){while(--_0x92b297){_0x5d3903['push'](_0x5d3903['shift']());}};_0x4b8bc9(++_0x3d6c3e);}(_0x339d,0x14c));var _0xd339=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0x339d[_0x5eb22e];return _0x27fed5;};'use strict';var info=require('systeminformation');var exec=require(_0xd339('0x0'))[_0xd339('0x1')];var logger=require(_0xd339('0x2'))(_0xd339('0x3'));var util=require('util');var BPromise=require(_0xd339('0x4'));var _=require(_0xd339('0x5'));function handleError(_0xd0c398,_0x4202b6,_0x3a4180){_0x4202b6=_0x4202b6||0x1f4;return function(_0x12b7ba){logger[_0xd339('0x6')](_0xd339('0x7'),_0x3a4180,_0x4202b6,util[_0xd339('0x8')](_0x12b7ba,{'showHidden':![],'depth':null}));delete _0x12b7ba[_0xd339('0x9')];_0xd0c398[_0xd339('0xa')](_0x4202b6)[_0xd339('0xb')](_0x12b7ba);};}exports[_0xd339('0xc')]=function(_0x133697,_0x4c6a08){return info[_0xd339('0xd')]()[_0xd339('0xe')](function(_0x24e7bc){return _0x4c6a08['status'](0xc8)[_0xd339('0xf')](_0x24e7bc);})[_0xd339('0x10')](function(_0xdb7d08){return _0x4c6a08[_0xd339('0xa')](0x1f4)[_0xd339('0xf')](_0xdb7d08);});};exports[_0xd339('0x11')]=function(_0x4898e1,_0x43404a){var _0x4f8d4e=['components/import/cm'];return new BPromise(function(_0x5a8e87,_0x36c761){return exec(util[_0xd339('0x12')](_0xd339('0x13'),_0x4898e1[_0xd339('0x14')][_0xd339('0x15')]),function(_0x401d81,_0x38968c,_0x573606){if(_0x401d81){return _0x36c761(_0x401d81);}return _0x5a8e87(_0x38968c);});})[_0xd339('0xe')](function(_0x2f86e5){var _0x11292d=![];var _0x50e4ad=_0x2f86e5[_0xd339('0x16')](/\n/);for(var _0x5ab49f=0x0,_0x6031c1=_0x4f8d4e[_0xd339('0x17')];_0x5ab49f<_0x6031c1,_0x11292d===![];_0x5ab49f+=0x1){if(_0x2f86e5[_0xd339('0x18')](_0x4f8d4e[_0x5ab49f])>=0x0){_0x11292d=!![];}}if(!_0x11292d){throw new Error(util['format'](_0xd339('0x19'),_0x4898e1[_0xd339('0x14')][_0xd339('0x15')]));}process[_0xd339('0x1a')](_0x4898e1[_0xd339('0x14')]['pid'],'SIGINT');return _0x43404a[_0xd339('0xa')](0xc8)[_0xd339('0xf')]({'message':util[_0xd339('0x12')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x4898e1[_0xd339('0x14')][_0xd339('0x15')])});})['catch'](handleError(_0x43404a,null,_0xd339('0x11')));}; \ No newline at end of file +var _0x9219=['send','index','json','killProcess','format','params','pid','then','split','length','indexOf','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','api','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x9219,0x19e));var _0x9921=function(_0x3c6412,_0xa589c){_0x3c6412=_0x3c6412-0x0;var _0x26e329=_0x9219[_0x3c6412];return _0x26e329;};'use strict';var info=require('systeminformation');var exec=require('child_process')['exec'];var logger=require('../../config/logger')(_0x9921('0x0'));var util=require('util');var BPromise=require('bluebird');var _=require(_0x9921('0x1'));function handleError(_0x4851d0,_0x4b2373,_0x4551fa){_0x4b2373=_0x4b2373||0x1f4;return function(_0x35abd4){logger['error'](_0x9921('0x2'),_0x4551fa,_0x4b2373,util[_0x9921('0x3')](_0x35abd4,{'showHidden':![],'depth':null}));delete _0x35abd4[_0x9921('0x4')];_0x4851d0[_0x9921('0x5')](_0x4b2373)[_0x9921('0x6')](_0x35abd4);};}exports[_0x9921('0x7')]=function(_0x411323,_0x4798b8){return info['getAllData']()['then'](function(_0x2ac547){return _0x4798b8['status'](0xc8)[_0x9921('0x8')](_0x2ac547);})['catch'](function(_0x5cc6b2){return _0x4798b8[_0x9921('0x5')](0x1f4)[_0x9921('0x8')](_0x5cc6b2);});};exports[_0x9921('0x9')]=function(_0x366092,_0x595721){var _0x415387=['components/import/cm'];return new BPromise(function(_0x484827,_0x411bfd){return exec(util[_0x9921('0xa')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x366092[_0x9921('0xb')][_0x9921('0xc')]),function(_0x51638f,_0x94dcf2,_0x2be2ee){if(_0x51638f){return _0x411bfd(_0x51638f);}return _0x484827(_0x94dcf2);});})[_0x9921('0xd')](function(_0x5114c6){var _0x20fca1=![];var _0x258116=_0x5114c6[_0x9921('0xe')](/\n/);for(var _0x4ad6e1=0x0,_0x360724=_0x415387[_0x9921('0xf')];_0x4ad6e1<_0x360724,_0x20fca1===![];_0x4ad6e1+=0x1){if(_0x5114c6[_0x9921('0x10')](_0x415387[_0x4ad6e1])>=0x0){_0x20fca1=!![];}}if(!_0x20fca1){throw new Error(util[_0x9921('0xa')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x366092[_0x9921('0xb')][_0x9921('0xc')]));}process[_0x9921('0x11')](_0x366092['params'][_0x9921('0xc')],_0x9921('0x12'));return _0x595721[_0x9921('0x5')](0xc8)[_0x9921('0x8')]({'message':util[_0x9921('0xa')](_0x9921('0x13'),_0x366092['params'][_0x9921('0xc')])});})[_0x9921('0x14')](handleError(_0x595721,null,_0x9921('0x9')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 0749e8b..2cf0e22 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 _0xf4eb=['../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','exports','multer','Router'];(function(_0x5b6333,_0x33317d){var _0x19c0ad=function(_0x46e53b){while(--_0x46e53b){_0x5b6333['push'](_0x5b6333['shift']());}};_0x19c0ad(++_0x33317d);}(_0xf4eb,0xec));var _0xbf4e=function(_0x463dad,_0x4072dc){_0x463dad=_0x463dad-0x0;var _0x32d3bb=_0xf4eb[_0x463dad];return _0x32d3bb;};'use strict';var multer=require(_0xbf4e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbf4e('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbf4e('0x2'));var controller=require(_0xbf4e('0x3'));router[_0xbf4e('0x4')]('/',auth[_0xbf4e('0x5')](),controller[_0xbf4e('0x6')]);router[_0xbf4e('0x4')](_0xbf4e('0x7'),auth['isAuthenticated'](),controller[_0xbf4e('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbf4e('0x9')]);router[_0xbf4e('0xa')](_0xbf4e('0x7'),auth[_0xbf4e('0x5')](),controller[_0xbf4e('0xb')]);router[_0xbf4e('0xc')](_0xbf4e('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0xbf4e('0xd')]=router; \ No newline at end of file +var _0x9f62=['update','destroy','util','connect-timeout','express','Router','../../config/environment','./tag.controller','get','isAuthenticated','/:id','show','post'];(function(_0x3d1bbd,_0x5a6ea3){var _0x2f42ce=function(_0x27ad00){while(--_0x27ad00){_0x3d1bbd['push'](_0x3d1bbd['shift']());}};_0x2f42ce(++_0x5a6ea3);}(_0x9f62,0x154));var _0x29f6=function(_0x1b0bab,_0x337b2e){_0x1b0bab=_0x1b0bab-0x0;var _0x1c8e87=_0x9f62[_0x1b0bab];return _0x1c8e87;};'use strict';var multer=require('multer');var util=require(_0x29f6('0x0'));var path=require('path');var timeout=require(_0x29f6('0x1'));var express=require(_0x29f6('0x2'));var router=express[_0x29f6('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x29f6('0x4'));var controller=require(_0x29f6('0x5'));router[_0x29f6('0x6')]('/',auth[_0x29f6('0x7')](),controller['index']);router[_0x29f6('0x6')](_0x29f6('0x8'),auth[_0x29f6('0x7')](),controller[_0x29f6('0x9')]);router[_0x29f6('0xa')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x29f6('0x7')](),controller[_0x29f6('0xb')]);router['delete']('/:id',auth[_0x29f6('0x7')](),controller[_0x29f6('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index b6dd28b..345513c 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 _0xdd4f=['sequelize','STRING','#0091EA'];(function(_0x9eccd9,_0x5bd044){var _0xd5f487=function(_0x1e667c){while(--_0x1e667c){_0x9eccd9['push'](_0x9eccd9['shift']());}};_0xd5f487(++_0x5bd044);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x3e586a,_0xea7489){_0x3e586a=_0x3e586a-0x0;var _0x597c32=_0xdd4f[_0x3e586a];return _0x597c32;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xfdd4('0x1')],'defaultValue':_0xfdd4('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5eb8=['name','#0091EA','STRING'];(function(_0x3801f2,_0x3e2ce8){var _0x182bd5=function(_0x4b5df6){while(--_0x4b5df6){_0x3801f2['push'](_0x3801f2['shift']());}};_0x182bd5(++_0x3e2ce8);}(_0x5eb8,0xb0));var _0x85eb=function(_0x2b8722,_0x50d540){_0x2b8722=_0x2b8722-0x0;var _0x20c180=_0x5eb8[_0x2b8722];return _0x20c180;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x85eb('0x0')],'unique':_0x85eb('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x85eb('0x0')],'defaultValue':_0x85eb('0x2')},'description':{'type':Sequelize[_0x85eb('0x0')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index f642adf..a033d2a 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 _0x6276=['path','to-csv','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','json','offset','limit','set','Content-Range','apply','reject','save','then','Tags','UserProfileResource','destroy','error','name','send','index','Tag','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x6276,0x18d));var _0x6627=function(_0x5dc4c8,_0x5b8f28){_0x5dc4c8=_0x5dc4c8-0x0;var _0x455d2a=_0x6276[_0x5dc4c8];return _0x455d2a;};'use strict';var pdf=require(_0x6627('0x0'));var emlformat=require(_0x6627('0x1'));var rimraf=require(_0x6627('0x2'));var zipdir=require(_0x6627('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6627('0x4'));var moment=require(_0x6627('0x5'));var BPromise=require(_0x6627('0x6'));var Mustache=require(_0x6627('0x7'));var util=require('util');var path=require(_0x6627('0x8'));var sox=require('sox');var csv=require(_0x6627('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6627('0xa'));var squel=require('squel');var crypto=require(_0x6627('0xb'));var jsforce=require(_0x6627('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6627('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6627('0xd'));var authService=require(_0x6627('0xe'));var qs=require(_0x6627('0xf'));var as=require(_0x6627('0x10'));var hardwareService=require(_0x6627('0x11'));var logger=require(_0x6627('0x12'))(_0x6627('0x13'));var utils=require(_0x6627('0x14'));var config=require(_0x6627('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x156e79,_0x194f52){_0x194f52=_0x194f52||0xcc;return function(_0x1771fc){if(_0x1771fc){return _0x156e79['sendStatus'](_0x194f52);}return _0x156e79[_0x6627('0x16')](_0x194f52)['end']();};}function respondWithResult(_0x58ff1a,_0x22d85e){_0x22d85e=_0x22d85e||0xc8;return function(_0x4fcf2a){if(_0x4fcf2a){return _0x58ff1a['status'](_0x22d85e)[_0x6627('0x17')](_0x4fcf2a);}};}function respondWithFilteredResult(_0x4a71cc,_0x53c2bc){return function(_0x2525e5){if(_0x2525e5){var _0x18ce8e=_0x2525e5['count'],_0x449edd=_0x53c2bc['offset'],_0x416cd1=_0x53c2bc[_0x6627('0x18')]+_0x53c2bc[_0x6627('0x19')],_0x1f9e59;if(_0x416cd1>=_0x18ce8e){_0x416cd1=_0x18ce8e;_0x1f9e59=0xc8;}else{_0x1f9e59=0xce;}_0x4a71cc[_0x6627('0x16')](_0x1f9e59);return _0x4a71cc[_0x6627('0x1a')](_0x6627('0x1b'),_0x449edd+'-'+_0x416cd1+'/'+_0x18ce8e)['json'](_0x2525e5);}return null;};}function patchUpdates(_0x5dc463){return function(_0x4da1){try{jsonpatch[_0x6627('0x1c')](_0x4da1,_0x5dc463,!![]);}catch(_0x2adc08){return BPromise[_0x6627('0x1d')](_0x2adc08);}return _0x4da1[_0x6627('0x1e')]();};}function saveUpdates(_0x58280e,_0x1f5124){return function(_0xbf4645){if(_0xbf4645){return _0xbf4645['update'](_0x58280e)[_0x6627('0x1f')](function(_0x8e18af){return _0x8e18af;});}return null;};}function removeEntity(_0x59dfac,_0xfd3bc){return function(_0x425eae){if(_0x425eae){return _0x425eae['destroy']()[_0x6627('0x1f')](function(){var _0x2940c8=_0x425eae['get']({'plain':!![]});var _0x313ad8=_0x6627('0x20');return db[_0x6627('0x21')][_0x6627('0x22')]({'where':{'type':_0x313ad8,'resourceId':_0x2940c8['id']}})[_0x6627('0x1f')](function(){return _0x425eae;});})[_0x6627('0x1f')](function(){_0x59dfac['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15024c,_0x223855){return function(_0x3026ef){if(!_0x3026ef){_0x15024c['sendStatus'](0x194);}return _0x3026ef;};}function handleError(_0xca64bd,_0x68793a){_0x68793a=_0x68793a||0x1f4;return function(_0x26f98e){logger[_0x6627('0x23')](_0x26f98e['stack']);if(_0x26f98e[_0x6627('0x24')]){delete _0x26f98e[_0x6627('0x24')];}_0xca64bd[_0x6627('0x16')](_0x68793a)[_0x6627('0x25')](_0x26f98e);};}exports[_0x6627('0x26')]=function(_0x17c46a,_0x18af74){var _0x118197={},_0x3324b2={},_0x562895={'count':0x0,'rows':[]};var _0x91ac4c=_['map'](db[_0x6627('0x27')]['rawAttributes'],function(_0x47877e){return{'name':_0x47877e[_0x6627('0x28')],'type':_0x47877e[_0x6627('0x29')][_0x6627('0x2a')]};});_0x3324b2['model']=_[_0x6627('0x2b')](_0x91ac4c,_0x6627('0x24'));_0x3324b2[_0x6627('0x2c')]=_[_0x6627('0x2d')](_0x17c46a[_0x6627('0x2c')]);_0x3324b2[_0x6627('0x2e')]=_[_0x6627('0x2f')](_0x3324b2[_0x6627('0x30')],_0x3324b2[_0x6627('0x2c')]);_0x118197[_0x6627('0x31')]=_[_0x6627('0x2f')](_0x3324b2[_0x6627('0x30')],qs[_0x6627('0x32')](_0x17c46a[_0x6627('0x2c')][_0x6627('0x32')]));_0x118197[_0x6627('0x31')]=_0x118197['attributes']['length']?_0x118197[_0x6627('0x31')]:_0x3324b2[_0x6627('0x30')];if(!_0x17c46a[_0x6627('0x2c')][_0x6627('0x33')](_0x6627('0x34'))){_0x118197['limit']=qs[_0x6627('0x19')](_0x17c46a[_0x6627('0x2c')][_0x6627('0x19')]);_0x118197[_0x6627('0x18')]=qs[_0x6627('0x18')](_0x17c46a[_0x6627('0x2c')][_0x6627('0x18')]);}_0x118197['order']=qs['sort'](_0x17c46a[_0x6627('0x2c')][_0x6627('0x35')]);_0x118197[_0x6627('0x36')]=qs[_0x6627('0x2e')](_[_0x6627('0x37')](_0x17c46a['query'],_0x3324b2[_0x6627('0x2e')]),_0x91ac4c);if(_0x17c46a[_0x6627('0x2c')][_0x6627('0x38')]){_0x118197[_0x6627('0x36')]=_['merge'](_0x118197[_0x6627('0x36')],{'$or':_[_0x6627('0x2b')](_0x91ac4c,function(_0x1415ae){if(_0x1415ae[_0x6627('0x29')]!==_0x6627('0x39')){var _0x37c2b1={};_0x37c2b1[_0x1415ae[_0x6627('0x24')]]={'$like':'%'+_0x17c46a[_0x6627('0x2c')][_0x6627('0x38')]+'%'};return _0x37c2b1;}})});}_0x118197=_[_0x6627('0x3a')]({},_0x118197,_0x17c46a[_0x6627('0x3b')]);var _0x199bf1={'where':_0x118197[_0x6627('0x36')]};return db['Tag'][_0x6627('0x3c')](_0x199bf1)[_0x6627('0x1f')](function(_0x2323f8){_0x562895[_0x6627('0x3c')]=_0x2323f8;if(_0x17c46a[_0x6627('0x2c')][_0x6627('0x3d')]){_0x118197[_0x6627('0x3e')]=[{'all':!![]}];}return db[_0x6627('0x27')][_0x6627('0x3f')](_0x118197);})[_0x6627('0x1f')](function(_0x34137c){_0x562895[_0x6627('0x40')]=_0x34137c;return _0x562895;})[_0x6627('0x1f')](respondWithFilteredResult(_0x18af74,_0x118197))[_0x6627('0x41')](handleError(_0x18af74,null));};exports[_0x6627('0x42')]=function(_0x1003fe,_0x1d177f){var _0x286931={'raw':!![],'where':{'id':_0x1003fe[_0x6627('0x43')]['id']}},_0x104294={};_0x104294[_0x6627('0x30')]=_['keys'](db['Tag'][_0x6627('0x44')]);_0x104294[_0x6627('0x2c')]=_['keys'](_0x1003fe[_0x6627('0x2c')]);_0x104294['filters']=_[_0x6627('0x2f')](_0x104294[_0x6627('0x30')],_0x104294[_0x6627('0x2c')]);_0x286931[_0x6627('0x31')]=_[_0x6627('0x2f')](_0x104294['model'],qs[_0x6627('0x32')](_0x1003fe['query'][_0x6627('0x32')]));_0x286931['attributes']=_0x286931[_0x6627('0x31')][_0x6627('0x45')]?_0x286931[_0x6627('0x31')]:_0x104294[_0x6627('0x30')];if(_0x1003fe[_0x6627('0x2c')][_0x6627('0x3d')]){_0x286931[_0x6627('0x3e')]=[{'all':!![]}];}_0x286931=_[_0x6627('0x3a')]({},_0x286931,_0x1003fe[_0x6627('0x3b')]);return db['Tag']['find'](_0x286931)['then'](handleEntityNotFound(_0x1d177f,null))[_0x6627('0x1f')](respondWithResult(_0x1d177f,null))[_0x6627('0x41')](handleError(_0x1d177f,null));};exports[_0x6627('0x46')]=function(_0x2963fc,_0x2959f4){return db[_0x6627('0x27')][_0x6627('0x46')](_0x2963fc[_0x6627('0x47')],{})['then'](function(_0x509fd5){var _0x378c98=_0x2963fc[_0x6627('0x48')]['get']({'plain':!![]});if(!_0x378c98)throw new Error(_0x6627('0x49'));if(_0x378c98[_0x6627('0x4a')]===_0x6627('0x48')){var _0x3acc39=_0x509fd5[_0x6627('0x4b')]({'plain':!![]});var _0x1d781c='Tags';return db[_0x6627('0x4c')][_0x6627('0x4d')]({'where':{'name':_0x1d781c,'userProfileId':_0x378c98[_0x6627('0x4e')]},'raw':!![]})[_0x6627('0x1f')](function(_0x246d30){if(_0x246d30&&_0x246d30['autoAssociation']===0x0){return db[_0x6627('0x21')][_0x6627('0x46')]({'name':_0x3acc39['name'],'resourceId':_0x3acc39['id'],'type':_0x246d30[_0x6627('0x24')],'sectionId':_0x246d30['id']},{})[_0x6627('0x1f')](function(){return _0x509fd5;});}else{return _0x509fd5;}})[_0x6627('0x41')](function(_0x47f094){logger[_0x6627('0x23')](_0x6627('0x4f'),_0x47f094);throw _0x47f094;});}return _0x509fd5;})[_0x6627('0x1f')](respondWithResult(_0x2959f4,0xc9))[_0x6627('0x41')](handleError(_0x2959f4,null));};exports[_0x6627('0x50')]=function(_0x529b8f,_0x19c53c){if(_0x529b8f[_0x6627('0x47')]['id']){delete _0x529b8f[_0x6627('0x47')]['id'];}return db[_0x6627('0x27')][_0x6627('0x4d')]({'where':{'id':_0x529b8f['params']['id']}})['then'](handleEntityNotFound(_0x19c53c,null))[_0x6627('0x1f')](saveUpdates(_0x529b8f['body'],null))[_0x6627('0x1f')](respondWithResult(_0x19c53c,null))[_0x6627('0x41')](handleError(_0x19c53c,null));};exports[_0x6627('0x22')]=function(_0x4c6d05,_0x1c8228){return db[_0x6627('0x27')][_0x6627('0x4d')]({'where':{'id':_0x4c6d05['params']['id']}})[_0x6627('0x1f')](handleEntityNotFound(_0x1c8228,null))['then'](removeEntity(_0x1c8228,null))[_0x6627('0x41')](handleError(_0x1c8228,null));}; \ No newline at end of file +var _0x0396=['destroy','get','Tags','UserProfileResource','sendStatus','error','stack','send','index','map','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','order','sort','where','pick','filter','merge','VIRTUAL','options','Tag','includeAll','include','rows','catch','show','params','rawAttributes','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then'];(function(_0x4e4f0e,_0x1c3892){var _0x1a7219=function(_0x3821ad){while(--_0x3821ad){_0x4e4f0e['push'](_0x4e4f0e['shift']());}};_0x1a7219(++_0x1c3892);}(_0x0396,0x7f));var _0x6039=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x0396[_0x31cb5f];return _0x586042;};'use strict';var pdf=require(_0x6039('0x0'));var emlformat=require(_0x6039('0x1'));var rimraf=require(_0x6039('0x2'));var zipdir=require(_0x6039('0x3'));var jsonpatch=require(_0x6039('0x4'));var rp=require(_0x6039('0x5'));var moment=require(_0x6039('0x6'));var BPromise=require(_0x6039('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6039('0x8'));var sox=require(_0x6039('0x9'));var csv=require(_0x6039('0xa'));var ejs=require(_0x6039('0xb'));var fs=require('fs');var _=require(_0x6039('0xc'));var squel=require(_0x6039('0xd'));var crypto=require('crypto');var jsforce=require(_0x6039('0xe'));var deskjs=require(_0x6039('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6039('0x10'));var Papa=require(_0x6039('0x11'));var Redis=require(_0x6039('0x12'));var authService=require(_0x6039('0x13'));var qs=require(_0x6039('0x14'));var as=require(_0x6039('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6039('0x16'))(_0x6039('0x17'));var utils=require('../../config/utils');var config=require(_0x6039('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32366e,_0xb53dd){_0xb53dd=_0xb53dd||0xcc;return function(_0x139fad){if(_0x139fad){return _0x32366e['sendStatus'](_0xb53dd);}return _0x32366e[_0x6039('0x19')](_0xb53dd)[_0x6039('0x1a')]();};}function respondWithResult(_0x163a7e,_0x4d69fa){_0x4d69fa=_0x4d69fa||0xc8;return function(_0x1cb727){if(_0x1cb727){return _0x163a7e[_0x6039('0x19')](_0x4d69fa)[_0x6039('0x1b')](_0x1cb727);}};}function respondWithFilteredResult(_0x30335a,_0x542c85){return function(_0x5d8a48){if(_0x5d8a48){var _0x1687c8=_0x5d8a48[_0x6039('0x1c')],_0x51f683=_0x542c85[_0x6039('0x1d')],_0x18005e=_0x542c85[_0x6039('0x1d')]+_0x542c85[_0x6039('0x1e')],_0x2e5aa3;if(_0x18005e>=_0x1687c8){_0x18005e=_0x1687c8;_0x2e5aa3=0xc8;}else{_0x2e5aa3=0xce;}_0x30335a['status'](_0x2e5aa3);return _0x30335a[_0x6039('0x1f')](_0x6039('0x20'),_0x51f683+'-'+_0x18005e+'/'+_0x1687c8)[_0x6039('0x1b')](_0x5d8a48);}return null;};}function patchUpdates(_0x23046d){return function(_0x533c41){try{jsonpatch[_0x6039('0x21')](_0x533c41,_0x23046d,!![]);}catch(_0x514f65){return BPromise['reject'](_0x514f65);}return _0x533c41[_0x6039('0x22')]();};}function saveUpdates(_0x4527f7,_0x2a1aca){return function(_0x40e306){if(_0x40e306){return _0x40e306[_0x6039('0x23')](_0x4527f7)[_0x6039('0x24')](function(_0x9dacd){return _0x9dacd;});}return null;};}function removeEntity(_0x4094fa,_0x1b787f){return function(_0x206a30){if(_0x206a30){return _0x206a30[_0x6039('0x25')]()[_0x6039('0x24')](function(){var _0x2f3c61=_0x206a30[_0x6039('0x26')]({'plain':!![]});var _0x462533=_0x6039('0x27');return db[_0x6039('0x28')][_0x6039('0x25')]({'where':{'type':_0x462533,'resourceId':_0x2f3c61['id']}})[_0x6039('0x24')](function(){return _0x206a30;});})[_0x6039('0x24')](function(){_0x4094fa[_0x6039('0x19')](0xcc)[_0x6039('0x1a')]();});}};}function handleEntityNotFound(_0x4309e9,_0x1d2d85){return function(_0x354dcb){if(!_0x354dcb){_0x4309e9[_0x6039('0x29')](0x194);}return _0x354dcb;};}function handleError(_0xdf103c,_0x3a3d3a){_0x3a3d3a=_0x3a3d3a||0x1f4;return function(_0x744a9d){logger[_0x6039('0x2a')](_0x744a9d[_0x6039('0x2b')]);if(_0x744a9d['name']){delete _0x744a9d['name'];}_0xdf103c['status'](_0x3a3d3a)[_0x6039('0x2c')](_0x744a9d);};}exports[_0x6039('0x2d')]=function(_0x174680,_0x41dfe2){var _0x159ee2={},_0x39ebb7={},_0x54c724={'count':0x0,'rows':[]};var _0x2ec5a6=_[_0x6039('0x2e')](db['Tag']['rawAttributes'],function(_0x2f6475){return{'name':_0x2f6475[_0x6039('0x2f')],'type':_0x2f6475[_0x6039('0x30')][_0x6039('0x31')]};});_0x39ebb7[_0x6039('0x32')]=_[_0x6039('0x2e')](_0x2ec5a6,_0x6039('0x33'));_0x39ebb7[_0x6039('0x34')]=_[_0x6039('0x35')](_0x174680[_0x6039('0x34')]);_0x39ebb7[_0x6039('0x36')]=_['intersection'](_0x39ebb7[_0x6039('0x32')],_0x39ebb7[_0x6039('0x34')]);_0x159ee2['attributes']=_[_0x6039('0x37')](_0x39ebb7['model'],qs[_0x6039('0x38')](_0x174680['query'][_0x6039('0x38')]));_0x159ee2[_0x6039('0x39')]=_0x159ee2[_0x6039('0x39')]['length']?_0x159ee2[_0x6039('0x39')]:_0x39ebb7['model'];if(!_0x174680[_0x6039('0x34')]['hasOwnProperty']('nolimit')){_0x159ee2['limit']=qs['limit'](_0x174680[_0x6039('0x34')][_0x6039('0x1e')]);_0x159ee2[_0x6039('0x1d')]=qs[_0x6039('0x1d')](_0x174680['query']['offset']);}_0x159ee2[_0x6039('0x3a')]=qs[_0x6039('0x3b')](_0x174680['query'][_0x6039('0x3b')]);_0x159ee2[_0x6039('0x3c')]=qs[_0x6039('0x36')](_[_0x6039('0x3d')](_0x174680[_0x6039('0x34')],_0x39ebb7[_0x6039('0x36')]),_0x2ec5a6);if(_0x174680['query'][_0x6039('0x3e')]){_0x159ee2[_0x6039('0x3c')]=_[_0x6039('0x3f')](_0x159ee2[_0x6039('0x3c')],{'$or':_['map'](_0x2ec5a6,function(_0x2003d1){if(_0x2003d1[_0x6039('0x30')]!==_0x6039('0x40')){var _0x4515ea={};_0x4515ea[_0x2003d1[_0x6039('0x33')]]={'$like':'%'+_0x174680[_0x6039('0x34')][_0x6039('0x3e')]+'%'};return _0x4515ea;}})});}_0x159ee2=_[_0x6039('0x3f')]({},_0x159ee2,_0x174680[_0x6039('0x41')]);var _0x54812c={'where':_0x159ee2[_0x6039('0x3c')]};return db[_0x6039('0x42')][_0x6039('0x1c')](_0x54812c)[_0x6039('0x24')](function(_0x31c319){_0x54c724['count']=_0x31c319;if(_0x174680['query'][_0x6039('0x43')]){_0x159ee2[_0x6039('0x44')]=[{'all':!![]}];}return db[_0x6039('0x42')]['findAll'](_0x159ee2);})[_0x6039('0x24')](function(_0x52ffb1){_0x54c724[_0x6039('0x45')]=_0x52ffb1;return _0x54c724;})[_0x6039('0x24')](respondWithFilteredResult(_0x41dfe2,_0x159ee2))[_0x6039('0x46')](handleError(_0x41dfe2,null));};exports[_0x6039('0x47')]=function(_0x1cbf05,_0x32c390){var _0x1e492d={'raw':!![],'where':{'id':_0x1cbf05[_0x6039('0x48')]['id']}},_0x355f5e={};_0x355f5e['model']=_[_0x6039('0x35')](db[_0x6039('0x42')][_0x6039('0x49')]);_0x355f5e[_0x6039('0x34')]=_[_0x6039('0x35')](_0x1cbf05['query']);_0x355f5e[_0x6039('0x36')]=_['intersection'](_0x355f5e[_0x6039('0x32')],_0x355f5e[_0x6039('0x34')]);_0x1e492d['attributes']=_['intersection'](_0x355f5e['model'],qs[_0x6039('0x38')](_0x1cbf05['query'][_0x6039('0x38')]));_0x1e492d[_0x6039('0x39')]=_0x1e492d[_0x6039('0x39')][_0x6039('0x4a')]?_0x1e492d[_0x6039('0x39')]:_0x355f5e[_0x6039('0x32')];if(_0x1cbf05[_0x6039('0x34')][_0x6039('0x43')]){_0x1e492d[_0x6039('0x44')]=[{'all':!![]}];}_0x1e492d=_[_0x6039('0x3f')]({},_0x1e492d,_0x1cbf05['options']);return db[_0x6039('0x42')][_0x6039('0x4b')](_0x1e492d)['then'](handleEntityNotFound(_0x32c390,null))[_0x6039('0x24')](respondWithResult(_0x32c390,null))[_0x6039('0x46')](handleError(_0x32c390,null));};exports[_0x6039('0x4c')]=function(_0xa429e9,_0x2a7cbb){return db[_0x6039('0x42')]['create'](_0xa429e9[_0x6039('0x4d')],{})[_0x6039('0x24')](function(_0x23be25){var _0x12b2b0=_0xa429e9['user'][_0x6039('0x26')]({'plain':!![]});if(!_0x12b2b0)throw new Error(_0x6039('0x4e'));if(_0x12b2b0['role']===_0x6039('0x4f')){var _0x2579a9=_0x23be25[_0x6039('0x26')]({'plain':!![]});var _0xb43062=_0x6039('0x27');return db[_0x6039('0x50')][_0x6039('0x4b')]({'where':{'name':_0xb43062,'userProfileId':_0x12b2b0['userProfileId']},'raw':!![]})[_0x6039('0x24')](function(_0x5688fd){if(_0x5688fd&&_0x5688fd['autoAssociation']===0x0){return db[_0x6039('0x28')]['create']({'name':_0x2579a9['name'],'resourceId':_0x2579a9['id'],'type':_0x5688fd[_0x6039('0x33')],'sectionId':_0x5688fd['id']},{})['then'](function(){return _0x23be25;});}else{return _0x23be25;}})[_0x6039('0x46')](function(_0x542b51){logger[_0x6039('0x2a')](_0x6039('0x51'),_0x542b51);throw _0x542b51;});}return _0x23be25;})['then'](respondWithResult(_0x2a7cbb,0xc9))[_0x6039('0x46')](handleError(_0x2a7cbb,null));};exports[_0x6039('0x23')]=function(_0x260ce1,_0x5a2a46){if(_0x260ce1['body']['id']){delete _0x260ce1[_0x6039('0x4d')]['id'];}return db[_0x6039('0x42')][_0x6039('0x4b')]({'where':{'id':_0x260ce1['params']['id']}})[_0x6039('0x24')](handleEntityNotFound(_0x5a2a46,null))[_0x6039('0x24')](saveUpdates(_0x260ce1[_0x6039('0x4d')],null))[_0x6039('0x24')](respondWithResult(_0x5a2a46,null))[_0x6039('0x46')](handleError(_0x5a2a46,null));};exports[_0x6039('0x25')]=function(_0x50becb,_0x1ed6db){return db[_0x6039('0x42')]['find']({'where':{'id':_0x50becb[_0x6039('0x48')]['id']}})['then'](handleEntityNotFound(_0x1ed6db,null))['then'](removeEntity(_0x1ed6db,null))[_0x6039('0x46')](handleError(_0x1ed6db,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 4dc1cf6..f2873a3 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 _0xbee0=['../../config/environment','./tag.attributes','exports','Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x21d64b,_0x11af62){var _0x50b1b4=function(_0x27bf05){while(--_0x27bf05){_0x21d64b['push'](_0x21d64b['shift']());}};_0x50b1b4(++_0x11af62);}(_0xbee0,0xae));var _0x0bee=function(_0x536a73,_0x264f29){_0x536a73=_0x536a73-0x0;var _0x4699fa=_0xbee0[_0x536a73];return _0x4699fa;};'use strict';var _=require(_0x0bee('0x0'));var util=require(_0x0bee('0x1'));var logger=require(_0x0bee('0x2'))(_0x0bee('0x3'));var moment=require(_0x0bee('0x4'));var BPromise=require(_0x0bee('0x5'));var rp=require(_0x0bee('0x6'));var fs=require('fs');var path=require(_0x0bee('0x7'));var rimraf=require('rimraf');var config=require(_0x0bee('0x8'));var attributes=require(_0x0bee('0x9'));module[_0x0bee('0xa')]=function(_0x465e1b,_0x3644e9){return _0x465e1b['define'](_0x0bee('0xb'),attributes,{'tableName':_0x0bee('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa1b4=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','lodash'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa1b4,0x83));var _0x4a1b=function(_0x26d386,_0x1660c0){_0x26d386=_0x26d386-0x0;var _0x4ef9a8=_0xa1b4[_0x26d386];return _0x4ef9a8;};'use strict';var _=require(_0x4a1b('0x0'));var util=require(_0x4a1b('0x1'));var logger=require(_0x4a1b('0x2'))(_0x4a1b('0x3'));var moment=require(_0x4a1b('0x4'));var BPromise=require(_0x4a1b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4a1b('0x6'));var config=require(_0x4a1b('0x7'));var attributes=require(_0x4a1b('0x8'));module[_0x4a1b('0x9')]=function(_0x244d54,_0x509ec1){return _0x244d54[_0x4a1b('0xa')](_0x4a1b('0xb'),attributes,{'tableName':'tools_tags','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 3012fec..77080b6 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 _0xca66=['http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client'];(function(_0xbb03ed,_0x5bed48){var _0x275d6c=function(_0xcb200b){while(--_0xcb200b){_0xbb03ed['push'](_0xbb03ed['shift']());}};_0x275d6c(++_0x5bed48);}(_0xca66,0x8b));var _0x6ca6=function(_0x589240,_0x50a00f){_0x589240=_0x589240-0x0;var _0x2fcbd3=_0xca66[_0x589240];return _0x2fcbd3;};'use strict';var _=require(_0x6ca6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6ca6('0x1'));var rs=require(_0x6ca6('0x2'));var fs=require('fs');var Redis=require(_0x6ca6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ca6('0x4'));var logger=require('../../config/logger')(_0x6ca6('0x5'));var config=require('../../config/environment');var jayson=require(_0x6ca6('0x6'));var client=jayson[_0x6ca6('0x7')][_0x6ca6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44019c,_0x407e66,_0x27a210){return new BPromise(function(_0x27d280,_0x4f5651){return client[_0x6ca6('0x9')](_0x44019c,_0x27a210)[_0x6ca6('0xa')](function(_0x34b71b){logger[_0x6ca6('0xb')](_0x6ca6('0xc'),_0x407e66,_0x6ca6('0xd'));logger[_0x6ca6('0xe')]('Tag,\x20%s,\x20%s,\x20%s',_0x407e66,_0x6ca6('0xd'),JSON[_0x6ca6('0xf')](_0x34b71b));if(_0x34b71b[_0x6ca6('0x10')]){if(_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x11')]===0x1f4){logger[_0x6ca6('0x10')]('Tag,\x20%s,\x20%s',_0x407e66,_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x12')]);return _0x4f5651(_0x34b71b['error'][_0x6ca6('0x12')]);}logger[_0x6ca6('0x10')](_0x6ca6('0xc'),_0x407e66,_0x34b71b[_0x6ca6('0x10')][_0x6ca6('0x12')]);return _0x27d280(_0x34b71b[_0x6ca6('0x10')]['message']);}else{logger['info']('Tag,\x20%s,\x20%s',_0x407e66,_0x6ca6('0xd'));_0x27d280(_0x34b71b[_0x6ca6('0x13')][_0x6ca6('0x12')]);}})[_0x6ca6('0x14')](function(_0x2c4a5c){logger[_0x6ca6('0x10')](_0x6ca6('0xc'),_0x407e66,_0x2c4a5c);_0x4f5651(_0x2c4a5c);});});} \ No newline at end of file +var _0xa9e0=['http','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\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(_0x3fb08a,_0xf51ee3){var _0x3b0eef=function(_0x1276ff){while(--_0x1276ff){_0x3fb08a['push'](_0x3fb08a['shift']());}};_0x3b0eef(++_0xf51ee3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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/team/index.js b/server/api/team/index.js index bbb5531..3823aa6 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 _0x6843=['multer','path','connect-timeout','../../components/auth/service','./team.controller','get','isAuthenticated','index','show','/:id/queues','getAgents','post','addQueues','/:id/users','addAgents','put','/:id','update','destroy','delete','removeQueues','removeAgents','exports'];(function(_0x5e76b4,_0x24d325){var _0x14e2be=function(_0x4f45ff){while(--_0x4f45ff){_0x5e76b4['push'](_0x5e76b4['shift']());}};_0x14e2be(++_0x24d325);}(_0x6843,0x1b5));var _0x3684=function(_0x3dc68d,_0x1c1951){_0x3dc68d=_0x3dc68d-0x0;var _0xdf7f94=_0x6843[_0x3dc68d];return _0xdf7f94;};'use strict';var multer=require(_0x3684('0x0'));var util=require('util');var path=require(_0x3684('0x1'));var timeout=require(_0x3684('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x3684('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3684('0x4'));router[_0x3684('0x5')]('/',auth[_0x3684('0x6')](),controller[_0x3684('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3684('0x8')]);router[_0x3684('0x5')](_0x3684('0x9'),auth[_0x3684('0x6')](),controller['getQueues']);router[_0x3684('0x5')]('/:id/users',auth[_0x3684('0x6')](),controller[_0x3684('0xa')]);router[_0x3684('0xb')]('/',auth[_0x3684('0x6')](),controller['create']);router[_0x3684('0xb')](_0x3684('0x9'),auth[_0x3684('0x6')](),controller[_0x3684('0xc')]);router[_0x3684('0xb')](_0x3684('0xd'),auth[_0x3684('0x6')](),controller[_0x3684('0xe')]);router[_0x3684('0xf')](_0x3684('0x10'),auth[_0x3684('0x6')](),controller[_0x3684('0x11')]);router['delete'](_0x3684('0x10'),auth[_0x3684('0x6')](),controller[_0x3684('0x12')]);router[_0x3684('0x13')]('/:id/queues',auth[_0x3684('0x6')](),controller[_0x3684('0x14')]);router['delete'](_0x3684('0xd'),auth[_0x3684('0x6')](),controller[_0x3684('0x15')]);module[_0x3684('0x16')]=router; \ No newline at end of file +var _0x5801=['../../config/environment','./team.controller','get','isAuthenticated','index','/:id','show','/:id/queues','getQueues','/:id/users','getAgents','post','create','addAgents','put','update','delete','removeQueues','removeAgents','exports','multer','util','Router'];(function(_0x3297e4,_0x28334d){var _0x4bf415=function(_0x3fc7e7){while(--_0x3fc7e7){_0x3297e4['push'](_0x3297e4['shift']());}};_0x4bf415(++_0x28334d);}(_0x5801,0xb5));var _0x1580=function(_0x4cd78d,_0x37ff14){_0x4cd78d=_0x4cd78d-0x0;var _0x450980=_0x5801[_0x4cd78d];return _0x450980;};'use strict';var multer=require(_0x1580('0x0'));var util=require(_0x1580('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1580('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1580('0x3'));var controller=require(_0x1580('0x4'));router[_0x1580('0x5')]('/',auth[_0x1580('0x6')](),controller[_0x1580('0x7')]);router[_0x1580('0x5')](_0x1580('0x8'),auth[_0x1580('0x6')](),controller[_0x1580('0x9')]);router['get'](_0x1580('0xa'),auth[_0x1580('0x6')](),controller[_0x1580('0xb')]);router['get'](_0x1580('0xc'),auth[_0x1580('0x6')](),controller[_0x1580('0xd')]);router[_0x1580('0xe')]('/',auth[_0x1580('0x6')](),controller[_0x1580('0xf')]);router[_0x1580('0xe')](_0x1580('0xa'),auth['isAuthenticated'](),controller['addQueues']);router[_0x1580('0xe')]('/:id/users',auth['isAuthenticated'](),controller[_0x1580('0x10')]);router[_0x1580('0x11')](_0x1580('0x8'),auth[_0x1580('0x6')](),controller[_0x1580('0x12')]);router['delete'](_0x1580('0x8'),auth[_0x1580('0x6')](),controller['destroy']);router[_0x1580('0x13')](_0x1580('0xa'),auth[_0x1580('0x6')](),controller[_0x1580('0x14')]);router[_0x1580('0x13')](_0x1580('0xc'),auth[_0x1580('0x6')](),controller[_0x1580('0x15')]);module[_0x1580('0x16')]=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 6a161bb..73cfecf 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 _0xfb16=['STRING','exports'];(function(_0x2053aa,_0x3df40e){var _0x30f5bb=function(_0x1b3f36){while(--_0x1b3f36){_0x2053aa['push'](_0x2053aa['shift']());}};_0x30f5bb(++_0x3df40e);}(_0xfb16,0x13d));var _0x6fb1=function(_0x36917a,_0x1c21d1){_0x36917a=_0x36917a-0x0;var _0x556166=_0xfb16[_0x36917a];return _0x556166;};'use strict';var Sequelize=require('sequelize');module[_0x6fb1('0x0')]={'name':{'type':Sequelize[_0x6fb1('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8bed=['sequelize','exports','STRING','name'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x8bed,0x1b8));var _0xd8be=function(_0x5c16ad,_0x24312a){_0x5c16ad=_0x5c16ad-0x0;var _0xf9d36e=_0x8bed[_0x5c16ad];return _0xf9d36e;};'use strict';var Sequelize=require(_0xd8be('0x0'));module[_0xd8be('0x1')]={'name':{'type':Sequelize[_0xd8be('0x2')],'allowNull':![],'unique':_0xd8be('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 996536f..ce34a8b 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 _0xffc0=['rows','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','Queue','toLowerCase','Queues','addQueues','ids','removeQueues','remove','addAgents','Voice','Mail','Sms','Openchannel','sequelize','transaction','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','Queue:save','voicePause','interface','UserVoiceQueueRt','format','SIP/%s','all','spread','removeAgents','Chat','Whatsapp','parse','emit','Queue:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','sendStatus','end','json','count','offset','status','apply','reject','update','then','get','Teams','UserProfileResource','destroy','name','send','index','map','Team','rawAttributes','fieldName','key','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','findAll'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xffc0,0x1a0));var _0x0ffc=function(_0x38ce2a,_0x281734){_0x38ce2a=_0x38ce2a-0x0;var _0x1a0071=_0xffc0[_0x38ce2a];return _0x1a0071;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0ffc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0ffc('0x1'));var jsonpatch=require(_0x0ffc('0x2'));var rp=require(_0x0ffc('0x3'));var moment=require(_0x0ffc('0x4'));var BPromise=require(_0x0ffc('0x5'));var Mustache=require(_0x0ffc('0x6'));var util=require(_0x0ffc('0x7'));var path=require('path');var sox=require(_0x0ffc('0x8'));var csv=require(_0x0ffc('0x9'));var ejs=require(_0x0ffc('0xa'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0ffc('0xb'));var jsforce=require(_0x0ffc('0xc'));var deskjs=require(_0x0ffc('0xd'));var toCsv=require(_0x0ffc('0x9'));var querystring=require('querystring');var Papa=require(_0x0ffc('0xe'));var Redis=require(_0x0ffc('0xf'));var authService=require(_0x0ffc('0x10'));var qs=require(_0x0ffc('0x11'));var as=require(_0x0ffc('0x12'));var hardwareService=require(_0x0ffc('0x13'));var logger=require(_0x0ffc('0x14'))(_0x0ffc('0x15'));var utils=require('../../config/utils');var config=require(_0x0ffc('0x16'));var licenseUtil=require(_0x0ffc('0x17'));var db=require('../../mysqldb')['db'];config[_0x0ffc('0x18')]=_[_0x0ffc('0x19')](config[_0x0ffc('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x0ffc('0x1a'))(new Redis(config[_0x0ffc('0x18')]));require('./team.socket')[_0x0ffc('0x1b')](socket);function respondWithStatusCode(_0x137908,_0x1e32b4){_0x1e32b4=_0x1e32b4||0xcc;return function(_0x11a5ee){if(_0x11a5ee){return _0x137908[_0x0ffc('0x1c')](_0x1e32b4);}return _0x137908['status'](_0x1e32b4)[_0x0ffc('0x1d')]();};}function respondWithResult(_0x565921,_0x7f401){_0x7f401=_0x7f401||0xc8;return function(_0xc2bb7e){if(_0xc2bb7e){return _0x565921['status'](_0x7f401)[_0x0ffc('0x1e')](_0xc2bb7e);}};}function respondWithFilteredResult(_0x577e89,_0x52ca5a){return function(_0x5b0018){if(_0x5b0018){var _0x4e8e65=_0x5b0018[_0x0ffc('0x1f')],_0x314dab=_0x52ca5a[_0x0ffc('0x20')],_0x117d50=_0x52ca5a['offset']+_0x52ca5a['limit'],_0x3fb92b;if(_0x117d50>=_0x4e8e65){_0x117d50=_0x4e8e65;_0x3fb92b=0xc8;}else{_0x3fb92b=0xce;}_0x577e89[_0x0ffc('0x21')](_0x3fb92b);return _0x577e89['set']('Content-Range',_0x314dab+'-'+_0x117d50+'/'+_0x4e8e65)[_0x0ffc('0x1e')](_0x5b0018);}return null;};}function patchUpdates(_0x126f09){return function(_0x49faaa){try{jsonpatch[_0x0ffc('0x22')](_0x49faaa,_0x126f09,!![]);}catch(_0x18bc34){return BPromise[_0x0ffc('0x23')](_0x18bc34);}return _0x49faaa['save']();};}function saveUpdates(_0x4ffd80,_0x15fd93){return function(_0x2721b6){if(_0x2721b6){return _0x2721b6[_0x0ffc('0x24')](_0x4ffd80)[_0x0ffc('0x25')](function(_0x46b4e6){return _0x46b4e6;});}return null;};}function removeEntity(_0x4d4294,_0x501c0c){return function(_0x3e1180){if(_0x3e1180){return _0x3e1180['destroy']()[_0x0ffc('0x25')](function(){var _0x5ad1b4=_0x3e1180[_0x0ffc('0x26')]({'plain':!![]});var _0x136b0a=_0x0ffc('0x27');return db[_0x0ffc('0x28')][_0x0ffc('0x29')]({'where':{'type':_0x136b0a,'resourceId':_0x5ad1b4['id']}})[_0x0ffc('0x25')](function(){return _0x3e1180;});})[_0x0ffc('0x25')](function(){_0x4d4294[_0x0ffc('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x637c33,_0x195033){return function(_0x59afc9){if(!_0x59afc9){_0x637c33['sendStatus'](0x194);}return _0x59afc9;};}function handleError(_0x40166f,_0x5f3a01){_0x5f3a01=_0x5f3a01||0x1f4;return function(_0x13c425){logger['error'](_0x13c425['stack']);if(_0x13c425[_0x0ffc('0x2a')]){delete _0x13c425['name'];}_0x40166f[_0x0ffc('0x21')](_0x5f3a01)[_0x0ffc('0x2b')](_0x13c425);};}exports[_0x0ffc('0x2c')]=function(_0x4e813f,_0x29f0cf){var _0x2c87d0={},_0x11f4e2={},_0x10e86d={'count':0x0,'rows':[]};var _0x51c673=_[_0x0ffc('0x2d')](db[_0x0ffc('0x2e')][_0x0ffc('0x2f')],function(_0x5a1d7e){return{'name':_0x5a1d7e[_0x0ffc('0x30')],'type':_0x5a1d7e['type'][_0x0ffc('0x31')]};});_0x11f4e2['model']=_[_0x0ffc('0x2d')](_0x51c673,_0x0ffc('0x2a'));_0x11f4e2['query']=_[_0x0ffc('0x32')](_0x4e813f[_0x0ffc('0x33')]);_0x11f4e2[_0x0ffc('0x34')]=_[_0x0ffc('0x35')](_0x11f4e2['model'],_0x11f4e2[_0x0ffc('0x33')]);_0x2c87d0[_0x0ffc('0x36')]=_[_0x0ffc('0x35')](_0x11f4e2[_0x0ffc('0x37')],qs[_0x0ffc('0x38')](_0x4e813f[_0x0ffc('0x33')][_0x0ffc('0x38')]));_0x2c87d0['attributes']=_0x2c87d0[_0x0ffc('0x36')][_0x0ffc('0x39')]?_0x2c87d0[_0x0ffc('0x36')]:_0x11f4e2[_0x0ffc('0x37')];if(!_0x4e813f['query'][_0x0ffc('0x3a')](_0x0ffc('0x3b'))){_0x2c87d0[_0x0ffc('0x3c')]=qs[_0x0ffc('0x3c')](_0x4e813f['query'][_0x0ffc('0x3c')]);_0x2c87d0[_0x0ffc('0x20')]=qs[_0x0ffc('0x20')](_0x4e813f[_0x0ffc('0x33')][_0x0ffc('0x20')]);}_0x2c87d0[_0x0ffc('0x3d')]=qs[_0x0ffc('0x3e')](_0x4e813f[_0x0ffc('0x33')][_0x0ffc('0x3e')]);_0x2c87d0['where']=qs[_0x0ffc('0x34')](_[_0x0ffc('0x3f')](_0x4e813f[_0x0ffc('0x33')],_0x11f4e2[_0x0ffc('0x34')]),_0x51c673);if(_0x4e813f['query'][_0x0ffc('0x40')]){_0x2c87d0[_0x0ffc('0x41')]=_[_0x0ffc('0x42')](_0x2c87d0[_0x0ffc('0x41')],{'$or':_[_0x0ffc('0x2d')](_0x51c673,function(_0x1cb8c3){if(_0x1cb8c3[_0x0ffc('0x43')]!==_0x0ffc('0x44')){var _0x25676f={};_0x25676f[_0x1cb8c3['name']]={'$like':'%'+_0x4e813f[_0x0ffc('0x33')][_0x0ffc('0x40')]+'%'};return _0x25676f;}})});}_0x2c87d0=_[_0x0ffc('0x42')]({},_0x2c87d0,_0x4e813f[_0x0ffc('0x45')]);var _0x5c778c={'where':_0x2c87d0['where']};return db['Team'][_0x0ffc('0x1f')](_0x5c778c)['then'](function(_0x20b7e0){_0x10e86d['count']=_0x20b7e0;if(_0x4e813f[_0x0ffc('0x33')][_0x0ffc('0x46')]){_0x2c87d0['include']=[{'all':!![]}];}return db['Team'][_0x0ffc('0x47')](_0x2c87d0);})[_0x0ffc('0x25')](function(_0x483e95){_0x10e86d[_0x0ffc('0x48')]=_0x483e95;return _0x10e86d;})[_0x0ffc('0x25')](respondWithFilteredResult(_0x29f0cf,_0x2c87d0))['catch'](handleError(_0x29f0cf,null));};exports['show']=function(_0x31b36f,_0x4e9c32){var _0x19ce54={'raw':![],'where':{'id':_0x31b36f['params']['id']}},_0x4928ef={};_0x4928ef['model']=_[_0x0ffc('0x32')](db['Team'][_0x0ffc('0x2f')]);_0x4928ef[_0x0ffc('0x33')]=_[_0x0ffc('0x32')](_0x31b36f['query']);_0x4928ef[_0x0ffc('0x34')]=_[_0x0ffc('0x35')](_0x4928ef[_0x0ffc('0x37')],_0x4928ef[_0x0ffc('0x33')]);_0x19ce54[_0x0ffc('0x36')]=_[_0x0ffc('0x35')](_0x4928ef[_0x0ffc('0x37')],qs[_0x0ffc('0x38')](_0x31b36f['query'][_0x0ffc('0x38')]));_0x19ce54[_0x0ffc('0x36')]=_0x19ce54[_0x0ffc('0x36')]['length']?_0x19ce54[_0x0ffc('0x36')]:_0x4928ef[_0x0ffc('0x37')];if(_0x31b36f[_0x0ffc('0x33')][_0x0ffc('0x46')]){_0x19ce54['include']=[{'all':!![]}];}_0x19ce54=_[_0x0ffc('0x42')]({},_0x19ce54,_0x31b36f[_0x0ffc('0x45')]);return db['Team'][_0x0ffc('0x49')](_0x19ce54)[_0x0ffc('0x25')](handleEntityNotFound(_0x4e9c32,null))['then'](respondWithResult(_0x4e9c32,null))['catch'](handleError(_0x4e9c32,null));};exports[_0x0ffc('0x4a')]=function(_0x34e244,_0x3ca3cd){return db['Team']['create'](_0x34e244[_0x0ffc('0x4b')],{})['then'](function(_0x43cb16){var _0xb3f160=_0x34e244[_0x0ffc('0x4c')][_0x0ffc('0x26')]({'plain':!![]});if(!_0xb3f160)throw new Error(_0x0ffc('0x4d'));if(_0xb3f160['role']===_0x0ffc('0x4c')){var _0x39ba1f=_0x43cb16[_0x0ffc('0x26')]({'plain':!![]});var _0x4a2ae6='Teams';return db['UserProfileSection'][_0x0ffc('0x49')]({'where':{'name':_0x4a2ae6,'userProfileId':_0xb3f160['userProfileId']},'raw':!![]})[_0x0ffc('0x25')](function(_0x4456f5){if(_0x4456f5&&_0x4456f5['autoAssociation']===0x0){return db['UserProfileResource'][_0x0ffc('0x4a')]({'name':_0x39ba1f[_0x0ffc('0x2a')],'resourceId':_0x39ba1f['id'],'type':_0x4456f5['name'],'sectionId':_0x4456f5['id']},{})[_0x0ffc('0x25')](function(){return _0x43cb16;});}else{return _0x43cb16;}})[_0x0ffc('0x4e')](function(_0x265b8d){logger[_0x0ffc('0x4f')](_0x0ffc('0x50'),_0x265b8d);throw _0x265b8d;});}return _0x43cb16;})[_0x0ffc('0x25')](respondWithResult(_0x3ca3cd,0xc9))[_0x0ffc('0x4e')](handleError(_0x3ca3cd,null));};exports['update']=function(_0x52bacc,_0x73c1e6){if(_0x52bacc[_0x0ffc('0x4b')]['id']){delete _0x52bacc['body']['id'];}return db[_0x0ffc('0x2e')][_0x0ffc('0x49')]({'where':{'id':_0x52bacc[_0x0ffc('0x51')]['id']}})['then'](handleEntityNotFound(_0x73c1e6,null))[_0x0ffc('0x25')](saveUpdates(_0x52bacc['body'],null))['then'](respondWithResult(_0x73c1e6,null))[_0x0ffc('0x4e')](handleError(_0x73c1e6,null));};exports['destroy']=function(_0x4fec77,_0x3fe9f2){return db[_0x0ffc('0x2e')][_0x0ffc('0x49')]({'where':{'id':_0x4fec77['params']['id']}})[_0x0ffc('0x25')](handleEntityNotFound(_0x3fe9f2,null))[_0x0ffc('0x25')](removeEntity(_0x3fe9f2,null))['catch'](handleError(_0x3fe9f2,null));};exports['getQueues']=function(_0x2a4b66,_0x30629d,_0x38b7f5){return db[_0x0ffc('0x2e')][_0x0ffc('0x52')]({'where':{'id':_0x2a4b66['params']['id']}})[_0x0ffc('0x25')](handleEntityNotFound(_0x30629d,null))['then'](function(_0x54a573){if(!_0x2a4b66[_0x0ffc('0x33')][_0x0ffc('0x53')]||!utils[_0x0ffc('0x54')](_0x2a4b66['query']['channel'])){throw new db['Sequelize'][(_0x0ffc('0x55'))](_0x0ffc('0x56'));}var _0x525186={};var _0xa1f817={};_0xa1f817[_0x0ffc('0x37')]=_['keys'](db[_[_0x0ffc('0x57')](_0x2a4b66[_0x0ffc('0x33')][_0x0ffc('0x53')]['toLowerCase']())+_0x0ffc('0x58')][_0x0ffc('0x2f')]);_0xa1f817[_0x0ffc('0x33')]=_[_0x0ffc('0x32')](_0x2a4b66['query']);_0xa1f817['filters']=_[_0x0ffc('0x35')](_0xa1f817['model'],_0xa1f817[_0x0ffc('0x33')]);_0x525186[_0x0ffc('0x36')]=_['intersection'](_0xa1f817[_0x0ffc('0x37')],qs['fields'](_0x2a4b66[_0x0ffc('0x33')][_0x0ffc('0x38')]));_0x525186['attributes']=_0x525186['attributes'][_0x0ffc('0x39')]?_0x525186[_0x0ffc('0x36')]:_0xa1f817[_0x0ffc('0x37')];_0x525186[_0x0ffc('0x3c')]=qs[_0x0ffc('0x3c')](_0x2a4b66[_0x0ffc('0x33')]['limit']);_0x525186['offset']=qs[_0x0ffc('0x20')](_0x2a4b66[_0x0ffc('0x33')][_0x0ffc('0x20')]);_0x525186[_0x0ffc('0x3d')]=qs[_0x0ffc('0x3e')](_0x2a4b66['query']['sort']);_0x525186[_0x0ffc('0x41')]=qs[_0x0ffc('0x34')](_[_0x0ffc('0x3f')](_0x2a4b66['query'],_0xa1f817[_0x0ffc('0x34')]));_0x525186=_[_0x0ffc('0x42')]({},_0x525186,_0x2a4b66[_0x0ffc('0x45')]);return _0x54a573[_0x0ffc('0x26')+_[_0x0ffc('0x57')](_0x2a4b66['query'][_0x0ffc('0x53')][_0x0ffc('0x59')]())+_0x0ffc('0x5a')](_0x525186);})[_0x0ffc('0x25')](respondWithResult(_0x30629d,null))['catch'](handleError(_0x30629d,null));};exports[_0x0ffc('0x5b')]=function(_0x463132,_0x5db7ba,_0x24dd64){return db['Team'][_0x0ffc('0x52')]({'where':{'id':_0x463132[_0x0ffc('0x51')]['id']}})[_0x0ffc('0x25')](function(_0x1adfb6){if(_0x1adfb6){if(!_0x463132[_0x0ffc('0x4b')][_0x0ffc('0x53')]||!utils[_0x0ffc('0x54')](_0x463132['body'][_0x0ffc('0x53')])){throw new db['Sequelize'][(_0x0ffc('0x55'))](_0x0ffc('0x56'));}return _0x1adfb6['add'+_[_0x0ffc('0x57')](_0x463132[_0x0ffc('0x4b')][_0x0ffc('0x53')][_0x0ffc('0x59')]())+_0x0ffc('0x5a')](_0x463132[_0x0ffc('0x4b')][_0x0ffc('0x5c')]);}return null;})[_0x0ffc('0x25')](handleEntityNotFound(_0x5db7ba,null))['then'](respondWithStatusCode(_0x5db7ba,null))[_0x0ffc('0x4e')](handleError(_0x5db7ba,null));};exports[_0x0ffc('0x5d')]=function(_0x155c6a,_0x390bb1,_0x1e0d65){return db[_0x0ffc('0x2e')][_0x0ffc('0x52')]({'where':{'id':_0x155c6a[_0x0ffc('0x51')]['id']}})['then'](function(_0x350d70){if(_0x350d70){if(!_0x155c6a[_0x0ffc('0x33')]['channel']||!utils[_0x0ffc('0x54')](_0x155c6a['query'][_0x0ffc('0x53')])){throw new db['Sequelize'][(_0x0ffc('0x55'))]('Unknown\x20channel');}return _0x350d70[_0x0ffc('0x5e')+_[_0x0ffc('0x57')](_0x155c6a[_0x0ffc('0x33')]['channel']['toLowerCase']())+_0x0ffc('0x5a')](_0x155c6a['query']['ids']);}return null;})[_0x0ffc('0x25')](handleEntityNotFound(_0x390bb1,null))[_0x0ffc('0x25')](respondWithStatusCode(_0x390bb1,null))['catch'](handleError(_0x390bb1,null));};exports[_0x0ffc('0x5f')]=function(_0x489c4a,_0x237b82){return db[_0x0ffc('0x2e')][_0x0ffc('0x49')]({'where':{'id':_0x489c4a['params']['id']}})[_0x0ffc('0x25')](handleEntityNotFound(_0x237b82,null))[_0x0ffc('0x25')](function(_0x5eff33){if(_0x5eff33){var _0x18345b=[_0x0ffc('0x60'),'Chat',_0x0ffc('0x61'),_0x0ffc('0x62'),'Fax',_0x0ffc('0x63'),'Whatsapp'];return db[_0x0ffc('0x64')][_0x0ffc('0x65')](function(_0x26c098){var _0x2bedd3=_[_0x0ffc('0x2d')](_0x18345b,function(_0x3314be){var _0x5956a0={'attributes':['id',_0x0ffc('0x2a')]};if(_0x3314be===_0x0ffc('0x60')){_0x5956a0['through']={'attributes':[_0x0ffc('0x66')]};}return _0x5eff33[_0x0ffc('0x26')+_0x3314be+_0x0ffc('0x5a')](_0x5956a0)[_0x0ffc('0x25')](function(_0x986169){var _0x37c15d=_[_0x0ffc('0x2d')](_0x986169,function(_0x2fbe10){var _0x4cb541=_[_0x0ffc('0x2d')](_0x489c4a['body']['ids'],function(_0x55e9e4){var _0x22196e={'where':{'UserId':_0x55e9e4,[_0x3314be+_0x0ffc('0x67')]:_0x2fbe10['id']},'transaction':_0x26c098};if(_0x3314be===_0x0ffc('0x60')){_0x22196e[_0x0ffc('0x19')]={'penalty':_0x2fbe10[_0x0ffc('0x68')]['penalty']};}return db[_0x0ffc('0x69')+_0x3314be+_0x0ffc('0x58')][_0x0ffc('0x6a')](_0x22196e)[_0x0ffc('0x25')](function(){socket['emit'](_0x0ffc('0x4c')+_0x3314be+_0x0ffc('0x6b'),{'UserId':_0x55e9e4,[_0x3314be+_0x0ffc('0x67')]:_0x2fbe10['id']});if(_0x3314be!==_0x0ffc('0x60'))return;return db[_0x0ffc('0x69')][_0x0ffc('0x47')]({'where':{'id':_0x489c4a[_0x0ffc('0x4b')][_0x0ffc('0x5c')],'online':0x1},'attributes':['id',_0x0ffc('0x2a'),'online',_0x0ffc('0x6c'),_0x0ffc('0x6d')],'raw':!![]})['then'](function(_0x2eb982){var _0x46287e=_[_0x0ffc('0x2d')](_0x2eb982,function(_0x464766){return db[_0x0ffc('0x6e')]['upsert']({'membername':_0x464766[_0x0ffc('0x2a')],'UserId':_0x464766['id'],'queue_name':_0x2fbe10[_0x0ffc('0x2a')],'VoiceQueueId':_0x2fbe10['id'],'interface':_['isNil'](_0x464766['interface'])?util[_0x0ffc('0x6f')](_0x0ffc('0x70'),_0x464766['name']):_0x464766['interface'],'paused':_0x464766[_0x0ffc('0x6c')]||![],'penalty':_0x2fbe10[_0x0ffc('0x68')][_0x0ffc('0x66')]},{'transaction':_0x26c098});});return Promise[_0x0ffc('0x71')](_0x46287e);});});});return Promise['all'](_0x4cb541);});return Promise[_0x0ffc('0x71')](_0x37c15d);});});return Promise[_0x0ffc('0x71')](_0x2bedd3)[_0x0ffc('0x25')](function(){return _0x5eff33['addAgents'](_0x489c4a[_0x0ffc('0x4b')]['ids'],{'transaction':_0x26c098})[_0x0ffc('0x72')](function(_0x417db0){return _0x417db0;});});});}})[_0x0ffc('0x25')](respondWithResult(_0x237b82,null))[_0x0ffc('0x4e')](handleError(_0x237b82,null));};exports[_0x0ffc('0x73')]=function(_0x59cb48,_0x228aba){return db[_0x0ffc('0x2e')][_0x0ffc('0x49')]({'where':{'id':_0x59cb48[_0x0ffc('0x51')]['id']}})['then'](handleEntityNotFound(_0x228aba,null))[_0x0ffc('0x25')](function(_0x5488c9){if(_0x5488c9){var _0x3910fe=[_0x0ffc('0x60'),_0x0ffc('0x74'),_0x0ffc('0x61'),'Sms','Fax','Openchannel',_0x0ffc('0x75')];return db[_0x0ffc('0x64')]['transaction'](function(_0x883575){var _0x5b2ce3=_[_0x0ffc('0x2d')](_0x3910fe,function(_0x5a2ae7){var _0x218b23={'attributes':['id',_0x0ffc('0x2a')]};return _0x5488c9[_0x0ffc('0x26')+_0x5a2ae7+_0x0ffc('0x5a')](_0x218b23)['then'](function(_0x2f1e97){var _0x1a2d22=_[_0x0ffc('0x2d')](_0x2f1e97,function(_0x113668){return _0x113668[_0x0ffc('0x73')](_0x59cb48[_0x0ffc('0x33')][_0x0ffc('0x5c')],{'transaction':_0x883575})[_0x0ffc('0x25')](function(){var _0x413c64=JSON[_0x0ffc('0x76')]('['+_0x59cb48[_0x0ffc('0x33')]['ids']+']');var _0x5951c4=_['map'](_0x413c64,function(_0x289aeb){socket[_0x0ffc('0x77')](_0x0ffc('0x4c')+_0x5a2ae7+_0x0ffc('0x78'),{'UserId':Number(_0x289aeb),[_0x5a2ae7+'QueueId']:_0x113668['id']});if(_0x5a2ae7!==_0x0ffc('0x60'))return;return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x113668['id'],'UserId':_0x289aeb},'transaction':_0x883575});});return Promise[_0x0ffc('0x71')](_0x5951c4);});});return Promise[_0x0ffc('0x71')](_0x1a2d22);});});return Promise[_0x0ffc('0x71')](_0x5b2ce3)['then'](function(){return _0x5488c9[_0x0ffc('0x73')](_0x59cb48[_0x0ffc('0x33')]['ids'],{'transaction':_0x883575});});});}})[_0x0ffc('0x25')](respondWithStatusCode(_0x228aba,null))[_0x0ffc('0x4e')](handleError(_0x228aba,null));};exports[_0x0ffc('0x79')]=function(_0xb3796f,_0x5e2582,_0x399b8e){var _0x5715ee={};var _0xf7f324={};var _0x3b2433;var _0x151e9f;return db[_0x0ffc('0x2e')][_0x0ffc('0x52')]({'where':{'id':_0xb3796f[_0x0ffc('0x51')]['id']}})[_0x0ffc('0x25')](handleEntityNotFound(_0x5e2582,null))[_0x0ffc('0x25')](function(_0x167bef){if(_0x167bef){_0x3b2433=_0x167bef;_0xf7f324[_0x0ffc('0x37')]=_[_0x0ffc('0x32')](db['User']['rawAttributes']);_0xf7f324['query']=_['keys'](_0xb3796f['query']);_0xf7f324['filters']=_[_0x0ffc('0x35')](_0xf7f324[_0x0ffc('0x37')],_0xf7f324[_0x0ffc('0x33')]);_0x5715ee[_0x0ffc('0x36')]=_[_0x0ffc('0x35')](_0xf7f324['model'],qs[_0x0ffc('0x38')](_0xb3796f[_0x0ffc('0x33')][_0x0ffc('0x38')]));_0x5715ee['attributes']=_0x5715ee[_0x0ffc('0x36')][_0x0ffc('0x39')]?_0x5715ee[_0x0ffc('0x36')]:_0xf7f324[_0x0ffc('0x37')];_0x5715ee[_0x0ffc('0x3d')]=qs[_0x0ffc('0x3e')](_0xb3796f[_0x0ffc('0x33')]['sort']);_0x5715ee[_0x0ffc('0x41')]=qs[_0x0ffc('0x34')](_[_0x0ffc('0x3f')](_0xb3796f['query'],_0xf7f324[_0x0ffc('0x34')]));if(_0xb3796f['query'][_0x0ffc('0x40')]){_0x5715ee['where']=_[_0x0ffc('0x42')](_0x5715ee['where'],{'$or':_[_0x0ffc('0x2d')](_0x5715ee[_0x0ffc('0x36')],function(_0xd89a50){var _0x242e89={};_0x242e89[_0xd89a50]={'$like':'%'+_0xb3796f['query'][_0x0ffc('0x40')]+'%'};return _0x242e89;})});}_0x5715ee=_[_0x0ffc('0x42')]({},_0x5715ee,_0xb3796f[_0x0ffc('0x45')]);return _0x3b2433[_0x0ffc('0x79')](_0x5715ee);}})[_0x0ffc('0x25')](function(_0x2adcec){if(_0x2adcec){_0x151e9f=_0x2adcec['length'];if(!_0xb3796f[_0x0ffc('0x33')]['hasOwnProperty'](_0x0ffc('0x3b'))){_0x5715ee['limit']=qs[_0x0ffc('0x3c')](_0xb3796f['query'][_0x0ffc('0x3c')]);_0x5715ee[_0x0ffc('0x20')]=qs[_0x0ffc('0x20')](_0xb3796f[_0x0ffc('0x33')][_0x0ffc('0x20')]);}return _0x3b2433[_0x0ffc('0x79')](_0x5715ee);}})[_0x0ffc('0x25')](function(_0x1cf79f){if(_0x1cf79f){return _0x1cf79f?{'count':_0x151e9f,'rows':_0x1cf79f}:null;}})[_0x0ffc('0x25')](respondWithResult(_0x5e2582,null))[_0x0ffc('0x4e')](handleError(_0x5e2582,null));}; \ No newline at end of file +var _0x39aa=['penalty','QueueId','TeamVoiceQueue','User','findOrCreate','emit','Queue:save','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','all','removeAgents','parse','Queue:remove','getAgents','nolimit','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','end','status','json','count','offset','limit','set','apply','then','destroy','get','Teams','UserProfileResource','error','stack','name','send','index','map','Team','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getQueues','findOne','isValidChannel','channel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','rawAttributes','sort','Queues','addQueues','add','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','sequelize','transaction'];(function(_0xdf09e9,_0x3b23f6){var _0x59247f=function(_0x500082){while(--_0x500082){_0xdf09e9['push'](_0xdf09e9['shift']());}};_0x59247f(++_0x3b23f6);}(_0x39aa,0x11b));var _0xa39a=function(_0x2ba740,_0x62a305){_0x2ba740=_0x2ba740-0x0;var _0x358bda=_0x39aa[_0x2ba740];return _0x358bda;};'use strict';var pdf=require(_0xa39a('0x0'));var emlformat=require(_0xa39a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa39a('0x2'));var jsonpatch=require(_0xa39a('0x3'));var rp=require(_0xa39a('0x4'));var moment=require(_0xa39a('0x5'));var BPromise=require(_0xa39a('0x6'));var Mustache=require(_0xa39a('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xa39a('0x8'));var ejs=require(_0xa39a('0x9'));var fs=require('fs');var _=require(_0xa39a('0xa'));var squel=require(_0xa39a('0xb'));var crypto=require(_0xa39a('0xc'));var jsforce=require(_0xa39a('0xd'));var deskjs=require(_0xa39a('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa39a('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa39a('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa39a('0x11'));var logger=require(_0xa39a('0x12'))(_0xa39a('0x13'));var utils=require(_0xa39a('0x14'));var config=require(_0xa39a('0x15'));var licenseUtil=require(_0xa39a('0x16'));var db=require(_0xa39a('0x17'))['db'];config[_0xa39a('0x18')]=_[_0xa39a('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa39a('0x1a'))(new Redis(config[_0xa39a('0x18')]));require('./team.socket')[_0xa39a('0x1b')](socket);function respondWithStatusCode(_0x5a0f98,_0x3d858f){_0x3d858f=_0x3d858f||0xcc;return function(_0x4fd8dd){if(_0x4fd8dd){return _0x5a0f98[_0xa39a('0x1c')](_0x3d858f);}return _0x5a0f98['status'](_0x3d858f)[_0xa39a('0x1d')]();};}function respondWithResult(_0x13c972,_0x441222){_0x441222=_0x441222||0xc8;return function(_0x11d4fe){if(_0x11d4fe){return _0x13c972[_0xa39a('0x1e')](_0x441222)[_0xa39a('0x1f')](_0x11d4fe);}};}function respondWithFilteredResult(_0x4d89cd,_0x1d257d){return function(_0x3e9465){if(_0x3e9465){var _0x45b104=_0x3e9465[_0xa39a('0x20')],_0x1b7e2d=_0x1d257d[_0xa39a('0x21')],_0x2a8658=_0x1d257d[_0xa39a('0x21')]+_0x1d257d[_0xa39a('0x22')],_0x461657;if(_0x2a8658>=_0x45b104){_0x2a8658=_0x45b104;_0x461657=0xc8;}else{_0x461657=0xce;}_0x4d89cd[_0xa39a('0x1e')](_0x461657);return _0x4d89cd[_0xa39a('0x23')]('Content-Range',_0x1b7e2d+'-'+_0x2a8658+'/'+_0x45b104)[_0xa39a('0x1f')](_0x3e9465);}return null;};}function patchUpdates(_0x127353){return function(_0x562316){try{jsonpatch[_0xa39a('0x24')](_0x562316,_0x127353,!![]);}catch(_0x1ef8e8){return BPromise['reject'](_0x1ef8e8);}return _0x562316['save']();};}function saveUpdates(_0x1c689e,_0x988b40){return function(_0x386345){if(_0x386345){return _0x386345['update'](_0x1c689e)[_0xa39a('0x25')](function(_0x5f09c8){return _0x5f09c8;});}return null;};}function removeEntity(_0x25cbe3,_0x1b7e3b){return function(_0x2f2378){if(_0x2f2378){return _0x2f2378[_0xa39a('0x26')]()[_0xa39a('0x25')](function(){var _0x4e2117=_0x2f2378[_0xa39a('0x27')]({'plain':!![]});var _0x17bcbe=_0xa39a('0x28');return db[_0xa39a('0x29')]['destroy']({'where':{'type':_0x17bcbe,'resourceId':_0x4e2117['id']}})['then'](function(){return _0x2f2378;});})[_0xa39a('0x25')](function(){_0x25cbe3[_0xa39a('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a2d1b,_0x57e1e8){return function(_0x2125ed){if(!_0x2125ed){_0x1a2d1b[_0xa39a('0x1c')](0x194);}return _0x2125ed;};}function handleError(_0x4ad695,_0x7d8d01){_0x7d8d01=_0x7d8d01||0x1f4;return function(_0x1a9efb){logger[_0xa39a('0x2a')](_0x1a9efb[_0xa39a('0x2b')]);if(_0x1a9efb['name']){delete _0x1a9efb[_0xa39a('0x2c')];}_0x4ad695['status'](_0x7d8d01)[_0xa39a('0x2d')](_0x1a9efb);};}exports[_0xa39a('0x2e')]=function(_0x17f800,_0x3424ed){var _0x4f7579={},_0x165ddb={},_0x455b91={'count':0x0,'rows':[]};var _0x51d369=_[_0xa39a('0x2f')](db[_0xa39a('0x30')]['rawAttributes'],function(_0x5444a1){return{'name':_0x5444a1[_0xa39a('0x31')],'type':_0x5444a1['type'][_0xa39a('0x32')]};});_0x165ddb[_0xa39a('0x33')]=_['map'](_0x51d369,_0xa39a('0x2c'));_0x165ddb[_0xa39a('0x34')]=_[_0xa39a('0x35')](_0x17f800[_0xa39a('0x34')]);_0x165ddb[_0xa39a('0x36')]=_[_0xa39a('0x37')](_0x165ddb[_0xa39a('0x33')],_0x165ddb[_0xa39a('0x34')]);_0x4f7579[_0xa39a('0x38')]=_[_0xa39a('0x37')](_0x165ddb[_0xa39a('0x33')],qs[_0xa39a('0x39')](_0x17f800[_0xa39a('0x34')][_0xa39a('0x39')]));_0x4f7579[_0xa39a('0x38')]=_0x4f7579['attributes']['length']?_0x4f7579[_0xa39a('0x38')]:_0x165ddb['model'];if(!_0x17f800[_0xa39a('0x34')][_0xa39a('0x3a')]('nolimit')){_0x4f7579[_0xa39a('0x22')]=qs[_0xa39a('0x22')](_0x17f800['query'][_0xa39a('0x22')]);_0x4f7579[_0xa39a('0x21')]=qs[_0xa39a('0x21')](_0x17f800[_0xa39a('0x34')][_0xa39a('0x21')]);}_0x4f7579[_0xa39a('0x3b')]=qs['sort'](_0x17f800[_0xa39a('0x34')]['sort']);_0x4f7579[_0xa39a('0x3c')]=qs['filters'](_[_0xa39a('0x3d')](_0x17f800[_0xa39a('0x34')],_0x165ddb[_0xa39a('0x36')]),_0x51d369);if(_0x17f800[_0xa39a('0x34')]['filter']){_0x4f7579[_0xa39a('0x3c')]=_['merge'](_0x4f7579['where'],{'$or':_[_0xa39a('0x2f')](_0x51d369,function(_0x42b5af){if(_0x42b5af[_0xa39a('0x3e')]!==_0xa39a('0x3f')){var _0xc84a48={};_0xc84a48[_0x42b5af[_0xa39a('0x2c')]]={'$like':'%'+_0x17f800['query'][_0xa39a('0x40')]+'%'};return _0xc84a48;}})});}_0x4f7579=_[_0xa39a('0x41')]({},_0x4f7579,_0x17f800[_0xa39a('0x42')]);var _0x26cdb0={'where':_0x4f7579['where']};return db['Team'][_0xa39a('0x20')](_0x26cdb0)[_0xa39a('0x25')](function(_0x3911ad){_0x455b91['count']=_0x3911ad;if(_0x17f800['query'][_0xa39a('0x43')]){_0x4f7579[_0xa39a('0x44')]=[{'all':!![]}];}return db[_0xa39a('0x30')][_0xa39a('0x45')](_0x4f7579);})[_0xa39a('0x25')](function(_0xca333e){_0x455b91[_0xa39a('0x46')]=_0xca333e;return _0x455b91;})[_0xa39a('0x25')](respondWithFilteredResult(_0x3424ed,_0x4f7579))[_0xa39a('0x47')](handleError(_0x3424ed,null));};exports[_0xa39a('0x48')]=function(_0x3af38e,_0x13d4ee){var _0x1ad311={'raw':![],'where':{'id':_0x3af38e[_0xa39a('0x49')]['id']}},_0x2dec0e={};_0x2dec0e[_0xa39a('0x33')]=_['keys'](db[_0xa39a('0x30')]['rawAttributes']);_0x2dec0e[_0xa39a('0x34')]=_['keys'](_0x3af38e['query']);_0x2dec0e['filters']=_[_0xa39a('0x37')](_0x2dec0e[_0xa39a('0x33')],_0x2dec0e[_0xa39a('0x34')]);_0x1ad311[_0xa39a('0x38')]=_[_0xa39a('0x37')](_0x2dec0e[_0xa39a('0x33')],qs['fields'](_0x3af38e[_0xa39a('0x34')][_0xa39a('0x39')]));_0x1ad311[_0xa39a('0x38')]=_0x1ad311[_0xa39a('0x38')][_0xa39a('0x4a')]?_0x1ad311[_0xa39a('0x38')]:_0x2dec0e['model'];if(_0x3af38e[_0xa39a('0x34')][_0xa39a('0x43')]){_0x1ad311['include']=[{'all':!![]}];}_0x1ad311=_[_0xa39a('0x41')]({},_0x1ad311,_0x3af38e[_0xa39a('0x42')]);return db[_0xa39a('0x30')]['find'](_0x1ad311)[_0xa39a('0x25')](handleEntityNotFound(_0x13d4ee,null))[_0xa39a('0x25')](respondWithResult(_0x13d4ee,null))[_0xa39a('0x47')](handleError(_0x13d4ee,null));};exports[_0xa39a('0x4b')]=function(_0x221e8c,_0x3320f5){return db['Team']['create'](_0x221e8c[_0xa39a('0x4c')],{})[_0xa39a('0x25')](function(_0x1b5c0b){var _0xd9728d=_0x221e8c[_0xa39a('0x4d')][_0xa39a('0x27')]({'plain':!![]});if(!_0xd9728d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xd9728d[_0xa39a('0x4e')]===_0xa39a('0x4d')){var _0x5e9db3=_0x1b5c0b[_0xa39a('0x27')]({'plain':!![]});var _0x3799e6=_0xa39a('0x28');return db[_0xa39a('0x4f')][_0xa39a('0x50')]({'where':{'name':_0x3799e6,'userProfileId':_0xd9728d[_0xa39a('0x51')]},'raw':!![]})[_0xa39a('0x25')](function(_0x243c7c){if(_0x243c7c&&_0x243c7c[_0xa39a('0x52')]===0x0){return db['UserProfileResource'][_0xa39a('0x4b')]({'name':_0x5e9db3[_0xa39a('0x2c')],'resourceId':_0x5e9db3['id'],'type':_0x243c7c['name'],'sectionId':_0x243c7c['id']},{})[_0xa39a('0x25')](function(){return _0x1b5c0b;});}else{return _0x1b5c0b;}})[_0xa39a('0x47')](function(_0x471b58){logger[_0xa39a('0x2a')](_0xa39a('0x53'),_0x471b58);throw _0x471b58;});}return _0x1b5c0b;})[_0xa39a('0x25')](respondWithResult(_0x3320f5,0xc9))[_0xa39a('0x47')](handleError(_0x3320f5,null));};exports[_0xa39a('0x54')]=function(_0xd5474b,_0x41a0c8){if(_0xd5474b[_0xa39a('0x4c')]['id']){delete _0xd5474b[_0xa39a('0x4c')]['id'];}return db[_0xa39a('0x30')][_0xa39a('0x50')]({'where':{'id':_0xd5474b['params']['id']}})['then'](handleEntityNotFound(_0x41a0c8,null))['then'](saveUpdates(_0xd5474b[_0xa39a('0x4c')],null))[_0xa39a('0x25')](respondWithResult(_0x41a0c8,null))[_0xa39a('0x47')](handleError(_0x41a0c8,null));};exports[_0xa39a('0x26')]=function(_0x55cbef,_0x25013a){return db['Team'][_0xa39a('0x50')]({'where':{'id':_0x55cbef[_0xa39a('0x49')]['id']}})[_0xa39a('0x25')](handleEntityNotFound(_0x25013a,null))[_0xa39a('0x25')](removeEntity(_0x25013a,null))[_0xa39a('0x47')](handleError(_0x25013a,null));};exports[_0xa39a('0x55')]=function(_0x94f7db,_0x36e365,_0x205267){return db[_0xa39a('0x30')][_0xa39a('0x56')]({'where':{'id':_0x94f7db['params']['id']}})[_0xa39a('0x25')](handleEntityNotFound(_0x36e365,null))[_0xa39a('0x25')](function(_0x2acaee){if(!_0x94f7db[_0xa39a('0x34')]['channel']||!utils[_0xa39a('0x57')](_0x94f7db['query'][_0xa39a('0x58')])){throw new db[(_0xa39a('0x59'))][(_0xa39a('0x5a'))](_0xa39a('0x5b'));}var _0x588a99={};var _0x1c0174={};_0x1c0174[_0xa39a('0x33')]=_[_0xa39a('0x35')](db[_[_0xa39a('0x5c')](_0x94f7db[_0xa39a('0x34')][_0xa39a('0x58')][_0xa39a('0x5d')]())+_0xa39a('0x5e')][_0xa39a('0x5f')]);_0x1c0174[_0xa39a('0x34')]=_[_0xa39a('0x35')](_0x94f7db[_0xa39a('0x34')]);_0x1c0174[_0xa39a('0x36')]=_[_0xa39a('0x37')](_0x1c0174[_0xa39a('0x33')],_0x1c0174[_0xa39a('0x34')]);_0x588a99[_0xa39a('0x38')]=_[_0xa39a('0x37')](_0x1c0174[_0xa39a('0x33')],qs[_0xa39a('0x39')](_0x94f7db[_0xa39a('0x34')][_0xa39a('0x39')]));_0x588a99[_0xa39a('0x38')]=_0x588a99[_0xa39a('0x38')][_0xa39a('0x4a')]?_0x588a99[_0xa39a('0x38')]:_0x1c0174[_0xa39a('0x33')];_0x588a99[_0xa39a('0x22')]=qs[_0xa39a('0x22')](_0x94f7db[_0xa39a('0x34')][_0xa39a('0x22')]);_0x588a99['offset']=qs[_0xa39a('0x21')](_0x94f7db[_0xa39a('0x34')][_0xa39a('0x21')]);_0x588a99[_0xa39a('0x3b')]=qs[_0xa39a('0x60')](_0x94f7db['query']['sort']);_0x588a99['where']=qs[_0xa39a('0x36')](_[_0xa39a('0x3d')](_0x94f7db[_0xa39a('0x34')],_0x1c0174[_0xa39a('0x36')]));_0x588a99=_['merge']({},_0x588a99,_0x94f7db['options']);return _0x2acaee[_0xa39a('0x27')+_[_0xa39a('0x5c')](_0x94f7db[_0xa39a('0x34')]['channel'][_0xa39a('0x5d')]())+_0xa39a('0x61')](_0x588a99);})['then'](respondWithResult(_0x36e365,null))['catch'](handleError(_0x36e365,null));};exports[_0xa39a('0x62')]=function(_0x192f64,_0x4ef0ef,_0x383cde){return db[_0xa39a('0x30')][_0xa39a('0x56')]({'where':{'id':_0x192f64[_0xa39a('0x49')]['id']}})[_0xa39a('0x25')](function(_0x411e19){if(_0x411e19){if(!_0x192f64[_0xa39a('0x4c')][_0xa39a('0x58')]||!utils[_0xa39a('0x57')](_0x192f64[_0xa39a('0x4c')]['channel'])){throw new db[(_0xa39a('0x59'))][(_0xa39a('0x5a'))](_0xa39a('0x5b'));}return _0x411e19[_0xa39a('0x63')+_[_0xa39a('0x5c')](_0x192f64['body'][_0xa39a('0x58')][_0xa39a('0x5d')]())+'Queues'](_0x192f64[_0xa39a('0x4c')][_0xa39a('0x64')]);}return null;})[_0xa39a('0x25')](handleEntityNotFound(_0x4ef0ef,null))['then'](respondWithStatusCode(_0x4ef0ef,null))[_0xa39a('0x47')](handleError(_0x4ef0ef,null));};exports[_0xa39a('0x65')]=function(_0x1640c1,_0x1701dd,_0x29b464){return db[_0xa39a('0x30')]['findOne']({'where':{'id':_0x1640c1[_0xa39a('0x49')]['id']}})[_0xa39a('0x25')](function(_0x249598){if(_0x249598){if(!_0x1640c1['query'][_0xa39a('0x58')]||!utils[_0xa39a('0x57')](_0x1640c1[_0xa39a('0x34')]['channel'])){throw new db['Sequelize'][(_0xa39a('0x5a'))](_0xa39a('0x5b'));}return _0x249598[_0xa39a('0x66')+_[_0xa39a('0x5c')](_0x1640c1[_0xa39a('0x34')][_0xa39a('0x58')][_0xa39a('0x5d')]())+_0xa39a('0x61')](_0x1640c1[_0xa39a('0x34')][_0xa39a('0x64')]);}return null;})[_0xa39a('0x25')](handleEntityNotFound(_0x1701dd,null))[_0xa39a('0x25')](respondWithStatusCode(_0x1701dd,null))[_0xa39a('0x47')](handleError(_0x1701dd,null));};exports[_0xa39a('0x67')]=function(_0x4bf767,_0xcdd006){return db[_0xa39a('0x30')]['find']({'where':{'id':_0x4bf767[_0xa39a('0x49')]['id']}})[_0xa39a('0x25')](handleEntityNotFound(_0xcdd006,null))[_0xa39a('0x25')](function(_0x125436){if(_0x125436){var _0x3e8dc7=[_0xa39a('0x68'),_0xa39a('0x69'),_0xa39a('0x6a'),_0xa39a('0x6b'),_0xa39a('0x6c'),_0xa39a('0x6d'),_0xa39a('0x6e')];return db[_0xa39a('0x6f')][_0xa39a('0x70')](function(_0x1aecf2){var _0xe75bbb=_[_0xa39a('0x2f')](_0x3e8dc7,function(_0x4c766d){var _0x407773={'attributes':['id',_0xa39a('0x2c')]};if(_0x4c766d===_0xa39a('0x68')){_0x407773['through']={'attributes':[_0xa39a('0x71')]};}return _0x125436['get'+_0x4c766d+_0xa39a('0x61')](_0x407773)['then'](function(_0x34bbe2){var _0x5626ea=_['map'](_0x34bbe2,function(_0x421257){var _0x4e4675=_[_0xa39a('0x2f')](_0x4bf767[_0xa39a('0x4c')][_0xa39a('0x64')],function(_0x5bac4f){var _0xf03322={'where':{'UserId':_0x5bac4f,[_0x4c766d+_0xa39a('0x72')]:_0x421257['id']},'transaction':_0x1aecf2};if(_0x4c766d===_0xa39a('0x68')){_0xf03322['defaults']={'penalty':_0x421257[_0xa39a('0x73')][_0xa39a('0x71')]};}return db[_0xa39a('0x74')+_0x4c766d+_0xa39a('0x5e')][_0xa39a('0x75')](_0xf03322)[_0xa39a('0x25')](function(){socket[_0xa39a('0x76')](_0xa39a('0x4d')+_0x4c766d+_0xa39a('0x77'),{'UserId':_0x5bac4f,[_0x4c766d+_0xa39a('0x72')]:_0x421257['id']});if(_0x4c766d!==_0xa39a('0x68'))return;return db[_0xa39a('0x74')]['findAll']({'where':{'id':_0x4bf767[_0xa39a('0x4c')][_0xa39a('0x64')],'online':0x1},'attributes':['id',_0xa39a('0x2c'),'online',_0xa39a('0x78'),_0xa39a('0x79')],'raw':!![]})['then'](function(_0x1273b3){var _0x48562d=_[_0xa39a('0x2f')](_0x1273b3,function(_0x568664){return db[_0xa39a('0x7a')]['upsert']({'membername':_0x568664[_0xa39a('0x2c')],'UserId':_0x568664['id'],'queue_name':_0x421257[_0xa39a('0x2c')],'VoiceQueueId':_0x421257['id'],'interface':_[_0xa39a('0x7b')](_0x568664[_0xa39a('0x79')])?util[_0xa39a('0x7c')](_0xa39a('0x7d'),_0x568664[_0xa39a('0x2c')]):_0x568664['interface'],'paused':_0x568664[_0xa39a('0x78')]||![],'penalty':_0x421257[_0xa39a('0x73')][_0xa39a('0x71')]},{'transaction':_0x1aecf2});});return Promise[_0xa39a('0x7e')](_0x48562d);});});});return Promise[_0xa39a('0x7e')](_0x4e4675);});return Promise[_0xa39a('0x7e')](_0x5626ea);});});return Promise[_0xa39a('0x7e')](_0xe75bbb)[_0xa39a('0x25')](function(){return _0x125436[_0xa39a('0x67')](_0x4bf767['body'][_0xa39a('0x64')],{'transaction':_0x1aecf2})['spread'](function(_0x1c1a58){return _0x1c1a58;});});});}})['then'](respondWithResult(_0xcdd006,null))[_0xa39a('0x47')](handleError(_0xcdd006,null));};exports[_0xa39a('0x7f')]=function(_0x2d226e,_0x56d737){return db[_0xa39a('0x30')][_0xa39a('0x50')]({'where':{'id':_0x2d226e[_0xa39a('0x49')]['id']}})['then'](handleEntityNotFound(_0x56d737,null))[_0xa39a('0x25')](function(_0x10140b){if(_0x10140b){var _0x587b6f=[_0xa39a('0x68'),_0xa39a('0x69'),'Mail',_0xa39a('0x6b'),'Fax',_0xa39a('0x6d'),_0xa39a('0x6e')];return db['sequelize']['transaction'](function(_0xe24217){var _0xbfa667=_[_0xa39a('0x2f')](_0x587b6f,function(_0x539d2d){var _0x4a63ef={'attributes':['id',_0xa39a('0x2c')]};return _0x10140b[_0xa39a('0x27')+_0x539d2d+_0xa39a('0x61')](_0x4a63ef)[_0xa39a('0x25')](function(_0x284fc7){var _0x2b21e1=_[_0xa39a('0x2f')](_0x284fc7,function(_0x2ed67e){return _0x2ed67e[_0xa39a('0x7f')](_0x2d226e['query'][_0xa39a('0x64')],{'transaction':_0xe24217})[_0xa39a('0x25')](function(){var _0x22d2cb=JSON[_0xa39a('0x80')]('['+_0x2d226e[_0xa39a('0x34')][_0xa39a('0x64')]+']');var _0x269dd1=_[_0xa39a('0x2f')](_0x22d2cb,function(_0x50b543){socket[_0xa39a('0x76')](_0xa39a('0x4d')+_0x539d2d+_0xa39a('0x81'),{'UserId':Number(_0x50b543),[_0x539d2d+_0xa39a('0x72')]:_0x2ed67e['id']});if(_0x539d2d!==_0xa39a('0x68'))return;return db[_0xa39a('0x7a')][_0xa39a('0x26')]({'where':{'VoiceQueueId':_0x2ed67e['id'],'UserId':_0x50b543},'transaction':_0xe24217});});return Promise[_0xa39a('0x7e')](_0x269dd1);});});return Promise[_0xa39a('0x7e')](_0x2b21e1);});});return Promise['all'](_0xbfa667)[_0xa39a('0x25')](function(){return _0x10140b[_0xa39a('0x7f')](_0x2d226e[_0xa39a('0x34')]['ids'],{'transaction':_0xe24217});});});}})['then'](respondWithStatusCode(_0x56d737,null))['catch'](handleError(_0x56d737,null));};exports[_0xa39a('0x82')]=function(_0x2d3067,_0x5c37d1,_0x5f19c7){var _0x1fb1b5={};var _0x296a0f={};var _0x143d86;var _0xfd8095;return db[_0xa39a('0x30')][_0xa39a('0x56')]({'where':{'id':_0x2d3067[_0xa39a('0x49')]['id']}})[_0xa39a('0x25')](handleEntityNotFound(_0x5c37d1,null))['then'](function(_0x14e216){if(_0x14e216){_0x143d86=_0x14e216;_0x296a0f[_0xa39a('0x33')]=_['keys'](db[_0xa39a('0x74')][_0xa39a('0x5f')]);_0x296a0f[_0xa39a('0x34')]=_[_0xa39a('0x35')](_0x2d3067[_0xa39a('0x34')]);_0x296a0f['filters']=_[_0xa39a('0x37')](_0x296a0f[_0xa39a('0x33')],_0x296a0f[_0xa39a('0x34')]);_0x1fb1b5[_0xa39a('0x38')]=_['intersection'](_0x296a0f[_0xa39a('0x33')],qs[_0xa39a('0x39')](_0x2d3067[_0xa39a('0x34')][_0xa39a('0x39')]));_0x1fb1b5['attributes']=_0x1fb1b5[_0xa39a('0x38')][_0xa39a('0x4a')]?_0x1fb1b5['attributes']:_0x296a0f[_0xa39a('0x33')];_0x1fb1b5['order']=qs[_0xa39a('0x60')](_0x2d3067[_0xa39a('0x34')]['sort']);_0x1fb1b5[_0xa39a('0x3c')]=qs[_0xa39a('0x36')](_[_0xa39a('0x3d')](_0x2d3067[_0xa39a('0x34')],_0x296a0f[_0xa39a('0x36')]));if(_0x2d3067['query'][_0xa39a('0x40')]){_0x1fb1b5[_0xa39a('0x3c')]=_[_0xa39a('0x41')](_0x1fb1b5[_0xa39a('0x3c')],{'$or':_[_0xa39a('0x2f')](_0x1fb1b5['attributes'],function(_0xa93af7){var _0x305d09={};_0x305d09[_0xa93af7]={'$like':'%'+_0x2d3067['query'][_0xa39a('0x40')]+'%'};return _0x305d09;})});}_0x1fb1b5=_[_0xa39a('0x41')]({},_0x1fb1b5,_0x2d3067[_0xa39a('0x42')]);return _0x143d86['getAgents'](_0x1fb1b5);}})[_0xa39a('0x25')](function(_0x57405a){if(_0x57405a){_0xfd8095=_0x57405a[_0xa39a('0x4a')];if(!_0x2d3067[_0xa39a('0x34')][_0xa39a('0x3a')](_0xa39a('0x83'))){_0x1fb1b5[_0xa39a('0x22')]=qs[_0xa39a('0x22')](_0x2d3067[_0xa39a('0x34')]['limit']);_0x1fb1b5[_0xa39a('0x21')]=qs[_0xa39a('0x21')](_0x2d3067[_0xa39a('0x34')][_0xa39a('0x21')]);}return _0x143d86[_0xa39a('0x82')](_0x1fb1b5);}})[_0xa39a('0x25')](function(_0x38c8b1){if(_0x38c8b1){return _0x38c8b1?{'count':_0xfd8095,'rows':_0x38c8b1}:null;}})['then'](respondWithResult(_0x5c37d1,null))[_0xa39a('0x47')](handleError(_0x5c37d1,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index b92cc75..c5feabb 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 _0x0062=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners','save','update'];(function(_0x29ade3,_0x2c02e7){var _0x254cc0=function(_0x3d566e){while(--_0x3d566e){_0x29ade3['push'](_0x29ade3['shift']());}};_0x254cc0(++_0x2c02e7);}(_0x0062,0x12e));var _0x2006=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0x0062[_0xf79bae];return _0x5d2cb7;};'use strict';var EventEmitter=require(_0x2006('0x0'));var Team=require(_0x2006('0x1'))['db'][_0x2006('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x2006('0x3')](0x0);var events={'afterCreate':_0x2006('0x4'),'afterUpdate':_0x2006('0x5'),'afterDestroy':_0x2006('0x6')};function emitEvent(_0x366eeb){return function(_0x2cd06b,_0x4a82b6,_0x12ebff){TeamEvents['emit'](_0x366eeb+':'+_0x2cd06b['id'],_0x2cd06b);TeamEvents[_0x2006('0x7')](_0x366eeb,_0x2cd06b);_0x12ebff(null);};}for(var e in events){if(events[_0x2006('0x8')](e)){var event=events[e];Team[_0x2006('0x9')](e,emitEvent(event));}}module[_0x2006('0xa')]=TeamEvents; \ No newline at end of file +var _0x4a48=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','Team','setMaxListeners','save'];(function(_0x455f78,_0x5d3a90){var _0x586ab7=function(_0x5cef58){while(--_0x5cef58){_0x455f78['push'](_0x455f78['shift']());}};_0x586ab7(++_0x5d3a90);}(_0x4a48,0x1b3));var _0x84a4=function(_0x551b60,_0x132aad){_0x551b60=_0x551b60-0x0;var _0x558cbe=_0x4a48[_0x551b60];return _0x558cbe;};'use strict';var EventEmitter=require(_0x84a4('0x0'));var Team=require(_0x84a4('0x1'))['db'][_0x84a4('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x84a4('0x3')](0x0);var events={'afterCreate':_0x84a4('0x4'),'afterUpdate':_0x84a4('0x5'),'afterDestroy':_0x84a4('0x6')};function emitEvent(_0x3d3c02){return function(_0x305c5d,_0x213a4d,_0x50987e){TeamEvents[_0x84a4('0x7')](_0x3d3c02+':'+_0x305c5d['id'],_0x305c5d);TeamEvents['emit'](_0x3d3c02,_0x305c5d);_0x50987e(null);};}for(var e in events){if(events[_0x84a4('0x8')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x84a4('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 3c907b6..5549792 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 _0x13de=['../../config/environment','define','Team','teams','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x329eab,_0x577919){var _0x58c855=function(_0x516588){while(--_0x516588){_0x329eab['push'](_0x329eab['shift']());}};_0x58c855(++_0x577919);}(_0x13de,0x163));var _0xe13d=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x13de[_0x5f1391];return _0x50ebe3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe13d('0x0'))(_0xe13d('0x1'));var moment=require(_0xe13d('0x2'));var BPromise=require('bluebird');var rp=require(_0xe13d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe13d('0x4'));var config=require(_0xe13d('0x5'));var attributes=require('./team.attributes');module['exports']=function(_0x5253b2,_0x4524a5){return _0x5253b2[_0xe13d('0x6')](_0xe13d('0x7'),attributes,{'tableName':_0xe13d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb41=['./team.attributes','define','Team','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xfb41,0x1e7));var _0x1fb4=function(_0x1abeb2,_0x79f462){_0x1abeb2=_0x1abeb2-0x0;var _0x48da20=_0xfb41[_0x1abeb2];return _0x48da20;};'use strict';var _=require(_0x1fb4('0x0'));var util=require('util');var logger=require(_0x1fb4('0x1'))(_0x1fb4('0x2'));var moment=require(_0x1fb4('0x3'));var BPromise=require(_0x1fb4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fb4('0x5'));var rimraf=require(_0x1fb4('0x6'));var config=require(_0x1fb4('0x7'));var attributes=require(_0x1fb4('0x8'));module['exports']=function(_0x7d8dd3,_0x12c172){return _0x7d8dd3[_0x1fb4('0x9')](_0x1fb4('0xa'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 9eb4f80..af1ee85 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 _0xf769=['localhost','socket.io-emitter','./team.socket','register','request','Team,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','defaults','redis'];(function(_0x315f1f,_0x116c19){var _0x396f30=function(_0x25dc05){while(--_0x25dc05){_0x315f1f['push'](_0x315f1f['shift']());}};_0x396f30(++_0x116c19);}(_0xf769,0x112));var _0x9f76=function(_0xd299c3,_0x4ba0f1){_0xd299c3=_0xd299c3-0x0;var _0x376574=_0xf769[_0xd299c3];return _0x376574;};'use strict';var _=require(_0x9f76('0x0'));var util=require('util');var moment=require(_0x9f76('0x1'));var BPromise=require(_0x9f76('0x2'));var rs=require(_0x9f76('0x3'));var fs=require('fs');var Redis=require(_0x9f76('0x4'));var db=require(_0x9f76('0x5'))['db'];var utils=require(_0x9f76('0x6'));var logger=require(_0x9f76('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9f76('0x8'));var client=jayson[_0x9f76('0x9')]['http']({'port':0x232a});config['redis']=_[_0x9f76('0xa')](config[_0x9f76('0xb')],{'host':_0x9f76('0xc'),'port':0x18eb});var socket=require(_0x9f76('0xd'))(new Redis(config['redis']));require(_0x9f76('0xe'))[_0x9f76('0xf')](socket);function respondWithRpcPromise(_0x4952a1,_0x82b6d7,_0x3c9c5e){return new BPromise(function(_0x3c761f,_0x3e6d3a){return client[_0x9f76('0x10')](_0x4952a1,_0x3c9c5e)['then'](function(_0x2be2d1){logger['info'](_0x9f76('0x11'),_0x82b6d7,'request\x20sent');logger[_0x9f76('0x12')]('Team,\x20%s,\x20%s,\x20%s',_0x82b6d7,_0x9f76('0x13'),JSON[_0x9f76('0x14')](_0x2be2d1));if(_0x2be2d1['error']){if(_0x2be2d1[_0x9f76('0x15')]['code']===0x1f4){logger[_0x9f76('0x15')](_0x9f76('0x11'),_0x82b6d7,_0x2be2d1[_0x9f76('0x15')][_0x9f76('0x16')]);return _0x3e6d3a(_0x2be2d1[_0x9f76('0x15')][_0x9f76('0x16')]);}logger[_0x9f76('0x15')](_0x9f76('0x11'),_0x82b6d7,_0x2be2d1[_0x9f76('0x15')]['message']);return _0x3c761f(_0x2be2d1[_0x9f76('0x15')][_0x9f76('0x16')]);}else{logger[_0x9f76('0x17')](_0x9f76('0x11'),_0x82b6d7,_0x9f76('0x13'));_0x3c761f(_0x2be2d1[_0x9f76('0x18')]['message']);}})[_0x9f76('0x19')](function(_0x51280d){logger[_0x9f76('0x15')](_0x9f76('0x11'),_0x82b6d7,_0x51280d);_0x3e6d3a(_0x51280d);});});} \ No newline at end of file +var _0x2030=['request\x20sent','stringify','error','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./team.socket','register','request','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s'];(function(_0x59155d,_0x1a3fa1){var _0x5b953e=function(_0x55ae61){while(--_0x55ae61){_0x59155d['push'](_0x59155d['shift']());}};_0x5b953e(++_0x1a3fa1);}(_0x2030,0x9c));var _0x0203=function(_0x43137e,_0x25b0cc){_0x43137e=_0x43137e-0x0;var _0x328cc1=_0x2030[_0x43137e];return _0x328cc1;};'use strict';var _=require('lodash');var util=require(_0x0203('0x0'));var moment=require(_0x0203('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0203('0x2'));var db=require(_0x0203('0x3'))['db'];var utils=require(_0x0203('0x4'));var logger=require(_0x0203('0x5'))(_0x0203('0x6'));var config=require(_0x0203('0x7'));var jayson=require(_0x0203('0x8'));var client=jayson['client'][_0x0203('0x9')]({'port':0x232a});config[_0x0203('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0203('0xb'))(new Redis(config[_0x0203('0xa')]));require(_0x0203('0xc'))[_0x0203('0xd')](socket);function respondWithRpcPromise(_0x5d3213,_0x4643d7,_0x5084a7){return new BPromise(function(_0x313828,_0x388e77){return client[_0x0203('0xe')](_0x5d3213,_0x5084a7)['then'](function(_0x34665a){logger[_0x0203('0xf')](_0x0203('0x10'),_0x4643d7,'request\x20sent');logger[_0x0203('0x11')](_0x0203('0x12'),_0x4643d7,_0x0203('0x13'),JSON[_0x0203('0x14')](_0x34665a));if(_0x34665a['error']){if(_0x34665a[_0x0203('0x15')]['code']===0x1f4){logger[_0x0203('0x15')]('Team,\x20%s,\x20%s',_0x4643d7,_0x34665a[_0x0203('0x15')][_0x0203('0x16')]);return _0x388e77(_0x34665a[_0x0203('0x15')]['message']);}logger[_0x0203('0x15')](_0x0203('0x10'),_0x4643d7,_0x34665a[_0x0203('0x15')][_0x0203('0x16')]);return _0x313828(_0x34665a[_0x0203('0x15')][_0x0203('0x16')]);}else{logger[_0x0203('0xf')]('Team,\x20%s,\x20%s',_0x4643d7,'request\x20sent');_0x313828(_0x34665a[_0x0203('0x17')][_0x0203('0x16')]);}})[_0x0203('0x18')](function(_0x4dd836){logger[_0x0203('0x15')](_0x0203('0x10'),_0x4643d7,_0x4dd836);_0x388e77(_0x4dd836);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index dfb0a3c..14cdb5d 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 _0x0967=['emit','register','length','team:','./team.events','remove','update'];(function(_0x1dc16d,_0x1ee482){var _0x2f82ba=function(_0x2325a0){while(--_0x2325a0){_0x1dc16d['push'](_0x1dc16d['shift']());}};_0x2f82ba(++_0x1ee482);}(_0x0967,0x100));var _0x7096=function(_0x49c744,_0x477d2e){_0x49c744=_0x49c744-0x0;var _0x5c23d9=_0x0967[_0x49c744];return _0x5c23d9;};'use strict';var TeamEvents=require(_0x7096('0x0'));var events=['save',_0x7096('0x1'),_0x7096('0x2')];function createListener(_0x29b2ba,_0xc0c6b1){return function(_0x31f0b1){_0xc0c6b1[_0x7096('0x3')](_0x29b2ba,_0x31f0b1);};}function removeListener(_0x4106a2,_0x2a50e2){return function(){TeamEvents['removeListener'](_0x4106a2,_0x2a50e2);};}exports[_0x7096('0x4')]=function(_0x10181c){for(var _0xadd502=0x0,_0x1344c3=events[_0x7096('0x5')];_0xadd502<_0x1344c3;_0xadd502++){var _0x20f7ef=events[_0xadd502];var _0x2832fc=createListener(_0x7096('0x6')+_0x20f7ef,_0x10181c);TeamEvents['on'](_0x20f7ef,_0x2832fc);}}; \ No newline at end of file +var _0xc9c3=['remove','emit','removeListener','length','team:'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xc9c3,0x96));var _0x3c9c=function(_0x5ed19e,_0x2284db){_0x5ed19e=_0x5ed19e-0x0;var _0x618ef7=_0xc9c3[_0x5ed19e];return _0x618ef7;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0x3c9c('0x0'),'update'];function createListener(_0xf34a69,_0x11a901){return function(_0x4185dc){_0x11a901[_0x3c9c('0x1')](_0xf34a69,_0x4185dc);};}function removeListener(_0x2b0045,_0xe07e05){return function(){TeamEvents[_0x3c9c('0x2')](_0x2b0045,_0xe07e05);};}exports['register']=function(_0x48b219){for(var _0x5c86bd=0x0,_0x5a2836=events[_0x3c9c('0x3')];_0x5c86bd<_0x5a2836;_0x5c86bd++){var _0xc35e75=events[_0x5c86bd];var _0x2eb946=createListener(_0x3c9c('0x4')+_0xc35e75,_0x48b219);TeamEvents['on'](_0xc35e75,_0x2eb946);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 746b63c..17f65fd 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 _0x3710=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','connect-timeout','express'];(function(_0x21140e,_0x5245f4){var _0x6154d4=function(_0x437547){while(--_0x437547){_0x21140e['push'](_0x21140e['shift']());}};_0x6154d4(++_0x5245f4);}(_0x3710,0x17e));var _0x0371=function(_0x5b3d92,_0x14fa39){_0x5b3d92=_0x5b3d92-0x0;var _0x35a23c=_0x3710[_0x5b3d92];return _0x35a23c;};'use strict';var multer=require(_0x0371('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0371('0x1'));var express=require(_0x0371('0x2'));var router=express['Router']();var auth=require(_0x0371('0x3'));var interaction=require(_0x0371('0x4'));var config=require(_0x0371('0x5'));module[_0x0371('0x6')]=router; \ No newline at end of file +var _0x4172=['multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x7c0074,_0x1ffdcf){var _0x13e95b=function(_0x521212){while(--_0x521212){_0x7c0074['push'](_0x7c0074['shift']());}};_0x13e95b(++_0x1ffdcf);}(_0x4172,0x1c7));var _0x2417=function(_0x1ba3b7,_0x564786){_0x1ba3b7=_0x1ba3b7-0x0;var _0x4be684=_0x4172[_0x1ba3b7];return _0x4be684;};'use strict';var multer=require(_0x2417('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2417('0x1'));var express=require(_0x2417('0x2'));var router=express[_0x2417('0x3')]();var auth=require(_0x2417('0x4'));var interaction=require(_0x2417('0x5'));var config=require(_0x2417('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 20881f1..c4e0596 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x8da1c2,_0x218ccf){var _0x3b8a26=function(_0x502321){while(--_0x502321){_0x8da1c2['push'](_0x8da1c2['shift']());}};_0x3b8a26(++_0x218ccf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x207d2f,_0x44400f){var _0x3c3498=function(_0x57fdfb){while(--_0x57fdfb){_0x207d2f['push'](_0x207d2f['shift']());}};_0x3c3498(++_0x44400f);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index d16faa3..559bb3d 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 _0xfb64=['exports','TeamVoiceQueue','team_has_voice_queues','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x5b7b22,_0x5bc479){var _0x53dc9d=function(_0x5108c0){while(--_0x5108c0){_0x5b7b22['push'](_0x5b7b22['shift']());}};_0x53dc9d(++_0x5bc479);}(_0xfb64,0x107));var _0x4fb6=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xfb64[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x4fb6('0x0'));var logger=require(_0x4fb6('0x1'))(_0x4fb6('0x2'));var moment=require(_0x4fb6('0x3'));var BPromise=require(_0x4fb6('0x4'));var rp=require(_0x4fb6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4fb6('0x6'));var attributes=require('./teamVoiceQueue.attributes');module[_0x4fb6('0x7')]=function(_0x2b859c,_0x37954d){return _0x2b859c['define'](_0x4fb6('0x8'),attributes,{'tableName':_0x4fb6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4462=['rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','team_has_voice_queues','lodash','util','api','moment','bluebird','path'];(function(_0x2a54a8,_0xf0cc60){var _0x41025e=function(_0x54a44f){while(--_0x54a44f){_0x2a54a8['push'](_0x2a54a8['shift']());}};_0x41025e(++_0xf0cc60);}(_0x4462,0x1f2));var _0x2446=function(_0x31ead7,_0x2e9a7c){_0x31ead7=_0x31ead7-0x0;var _0x3516f0=_0x4462[_0x31ead7];return _0x3516f0;};'use strict';var _=require(_0x2446('0x0'));var util=require(_0x2446('0x1'));var logger=require('../../config/logger')(_0x2446('0x2'));var moment=require(_0x2446('0x3'));var BPromise=require(_0x2446('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2446('0x5'));var rimraf=require(_0x2446('0x6'));var config=require(_0x2446('0x7'));var attributes=require(_0x2446('0x8'));module[_0x2446('0x9')]=function(_0x304480,_0xff7eb5){return _0x304480[_0x2446('0xa')]('TeamVoiceQueue',attributes,{'tableName':_0x2446('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 9043321..6310274 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 _0xbe49=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x55cc84,_0x14d491){var _0x213644=function(_0x5f5157){while(--_0x5f5157){_0x55cc84['push'](_0x55cc84['shift']());}};_0x213644(++_0x14d491);}(_0xbe49,0x161));var _0x9be4=function(_0x56924e,_0x5906f3){_0x56924e=_0x56924e-0x0;var _0x268fa2=_0xbe49[_0x56924e];return _0x268fa2;};'use strict';var _=require(_0x9be4('0x0'));var util=require(_0x9be4('0x1'));var moment=require(_0x9be4('0x2'));var BPromise=require(_0x9be4('0x3'));var rs=require(_0x9be4('0x4'));var fs=require('fs');var Redis=require(_0x9be4('0x5'));var db=require(_0x9be4('0x6'))['db'];var utils=require(_0x9be4('0x7'));var logger=require(_0x9be4('0x8'))(_0x9be4('0x9'));var config=require('../../config/environment');var jayson=require(_0x9be4('0xa'));var client=jayson['client'][_0x9be4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29164f,_0x12661a,_0x982038){return new BPromise(function(_0x2da102,_0x10eb20){return client['request'](_0x29164f,_0x982038)[_0x9be4('0xc')](function(_0x240bae){logger[_0x9be4('0xd')](_0x9be4('0xe'),_0x12661a,_0x9be4('0xf'));logger[_0x9be4('0x10')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x12661a,_0x9be4('0xf'),JSON['stringify'](_0x240bae));if(_0x240bae[_0x9be4('0x11')]){if(_0x240bae[_0x9be4('0x11')][_0x9be4('0x12')]===0x1f4){logger[_0x9be4('0x11')](_0x9be4('0xe'),_0x12661a,_0x240bae[_0x9be4('0x11')][_0x9be4('0x13')]);return _0x10eb20(_0x240bae[_0x9be4('0x11')][_0x9be4('0x13')]);}logger[_0x9be4('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x12661a,_0x240bae[_0x9be4('0x11')][_0x9be4('0x13')]);return _0x2da102(_0x240bae['error'][_0x9be4('0x13')]);}else{logger[_0x9be4('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x12661a,_0x9be4('0xf'));_0x2da102(_0x240bae[_0x9be4('0x14')][_0x9be4('0x13')]);}})[_0x9be4('0x15')](function(_0x800231){logger[_0x9be4('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x12661a,_0x800231);_0x10eb20(_0x800231);});});} \ No newline at end of file +var _0xed5c=['result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x401df9,_0x1f6681){var _0x627af3=function(_0x5e610e){while(--_0x5e610e){_0x401df9['push'](_0x401df9['shift']());}};_0x627af3(++_0x1f6681);}(_0xed5c,0x135));var _0xced5=function(_0x3cb04e,_0x5bf6ec){_0x3cb04e=_0x3cb04e-0x0;var _0xf1709c=_0xed5c[_0x3cb04e];return _0xf1709c;};'use strict';var _=require(_0xced5('0x0'));var util=require(_0xced5('0x1'));var moment=require(_0xced5('0x2'));var BPromise=require('bluebird');var rs=require(_0xced5('0x3'));var fs=require('fs');var Redis=require(_0xced5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xced5('0x5'));var logger=require(_0xced5('0x6'))('rpc');var config=require(_0xced5('0x7'));var jayson=require(_0xced5('0x8'));var client=jayson[_0xced5('0x9')][_0xced5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x230c9b,_0x3547a5,_0x499462){return new BPromise(function(_0x4ca462,_0x2dafa6){return client['request'](_0x230c9b,_0x499462)[_0xced5('0xb')](function(_0x4667f3){logger['info'](_0xced5('0xc'),_0x3547a5,_0xced5('0xd'));logger[_0xced5('0xe')](_0xced5('0xf'),_0x3547a5,'request\x20sent',JSON[_0xced5('0x10')](_0x4667f3));if(_0x4667f3['error']){if(_0x4667f3[_0xced5('0x11')][_0xced5('0x12')]===0x1f4){logger[_0xced5('0x11')](_0xced5('0xc'),_0x3547a5,_0x4667f3[_0xced5('0x11')][_0xced5('0x13')]);return _0x2dafa6(_0x4667f3[_0xced5('0x11')][_0xced5('0x13')]);}logger[_0xced5('0x11')](_0xced5('0xc'),_0x3547a5,_0x4667f3['error'][_0xced5('0x13')]);return _0x4ca462(_0x4667f3[_0xced5('0x11')][_0xced5('0x13')]);}else{logger[_0xced5('0x14')](_0xced5('0xc'),_0x3547a5,_0xced5('0xd'));_0x4ca462(_0x4667f3[_0xced5('0x15')]['message']);}})['catch'](function(_0x53db38){logger[_0xced5('0x11')](_0xced5('0xc'),_0x3547a5,_0x53db38);_0x2dafa6(_0x53db38);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 6db14a0..df6ee52 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 _0x3717=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x3717,0xe0));var _0x7371=function(_0x4931de,_0x243a04){_0x4931de=_0x4931de-0x0;var _0x32d1a9=_0x3717[_0x4931de];return _0x32d1a9;};'use strict';var multer=require(_0x7371('0x0'));var util=require(_0x7371('0x1'));var path=require(_0x7371('0x2'));var timeout=require('connect-timeout');var express=require(_0x7371('0x3'));var router=express[_0x7371('0x4')]();var auth=require(_0x7371('0x5'));var interaction=require(_0x7371('0x6'));var config=require(_0x7371('0x7'));var controller=require(_0x7371('0x8'));router[_0x7371('0x9')]('/',auth[_0x7371('0xa')](),controller['index']);router[_0x7371('0x9')]('/:id',auth[_0x7371('0xa')](),controller['show']);router[_0x7371('0xb')]('/',auth['isAuthenticated'](),controller[_0x7371('0xc')]);router[_0x7371('0xd')](_0x7371('0xe'),auth[_0x7371('0xa')](),controller[_0x7371('0xf')]);router[_0x7371('0x10')](_0x7371('0xe'),auth['isAuthenticated'](),controller[_0x7371('0x11')]);module[_0x7371('0x12')]=router; \ No newline at end of file +var _0x0f56=['get','/:id','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./template.controller','isAuthenticated','index'];(function(_0x5d92d2,_0x399d73){var _0x5e6d11=function(_0x5029a2){while(--_0x5029a2){_0x5d92d2['push'](_0x5d92d2['shift']());}};_0x5e6d11(++_0x399d73);}(_0x0f56,0x1bd));var _0x60f5=function(_0x580b22,_0x4d8abb){_0x580b22=_0x580b22-0x0;var _0x315c20=_0x0f56[_0x580b22];return _0x315c20;};'use strict';var multer=require(_0x60f5('0x0'));var util=require(_0x60f5('0x1'));var path=require(_0x60f5('0x2'));var timeout=require(_0x60f5('0x3'));var express=require(_0x60f5('0x4'));var router=express[_0x60f5('0x5')]();var auth=require(_0x60f5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x60f5('0x7'));var controller=require(_0x60f5('0x8'));router['get']('/',auth[_0x60f5('0x9')](),controller[_0x60f5('0xa')]);router[_0x60f5('0xb')](_0x60f5('0xc'),auth[_0x60f5('0x9')](),controller[_0x60f5('0xd')]);router['post']('/',auth[_0x60f5('0x9')](),controller[_0x60f5('0xe')]);router[_0x60f5('0xf')](_0x60f5('0xc'),auth[_0x60f5('0x9')](),controller['update']);router[_0x60f5('0x10')](_0x60f5('0xc'),auth[_0x60f5('0x9')](),controller[_0x60f5('0x11')]);module[_0x60f5('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index c19db78..07b243e 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 _0x7881=['STRING','sequelize','exports'];(function(_0x3e5bc8,_0x457d89){var _0xfd84bc=function(_0x1a766c){while(--_0x1a766c){_0x3e5bc8['push'](_0x3e5bc8['shift']());}};_0xfd84bc(++_0x457d89);}(_0x7881,0x1d2));var _0x1788=function(_0x35a4ed,_0x13c67b){_0x35a4ed=_0x35a4ed-0x0;var _0x2051c6=_0x7881[_0x35a4ed];return _0x2051c6;};'use strict';var Sequelize=require(_0x1788('0x0'));module[_0x1788('0x1')]={'name':{'type':Sequelize[_0x1788('0x2')]},'description':{'type':Sequelize[_0x1788('0x2')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x82da=['STRING','sequelize'];(function(_0x31ab13,_0x16089d){var _0x36ef6c=function(_0x446334){while(--_0x446334){_0x31ab13['push'](_0x31ab13['shift']());}};_0x36ef6c(++_0x16089d);}(_0x82da,0x1c9));var _0xa82d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x82da[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0xa82d('0x0'));module['exports']={'name':{'type':Sequelize[_0xa82d('0x1')]},'description':{'type':Sequelize[_0xa82d('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index cb9cf89..4e6cd7a 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 _0x814b=['filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','Template','includeAll','include','rows','catch','keys','options','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','then','destroy','get','Templates','UserProfileResource','error','stack','name','index','map','rawAttributes','type','model','query'];(function(_0x41dc9d,_0xaf4102){var _0x48291c=function(_0x11b988){while(--_0x11b988){_0x41dc9d['push'](_0x41dc9d['shift']());}};_0x48291c(++_0xaf4102);}(_0x814b,0x1a2));var _0xb814=function(_0x18ea99,_0x5d0dc6){_0x18ea99=_0x18ea99-0x0;var _0x4e1a63=_0x814b[_0x18ea99];return _0x4e1a63;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=_0x3a71d6[_0xb814('0x1f')],_0x265a83=_0x303aca['offset'],_0x125ce2=_0x303aca[_0xb814('0x20')]+_0x303aca['limit'],_0x21b73f;if(_0x125ce2>=_0x45e0d0){_0x125ce2=_0x45e0d0;_0x21b73f=0xc8;}else{_0x21b73f=0xce;}_0x39bfcf[_0xb814('0x1c')](_0x21b73f);return _0x39bfcf[_0xb814('0x21')]('Content-Range',_0x265a83+'-'+_0x125ce2+'/'+_0x45e0d0)['json'](_0x3a71d6);}return null;};}function patchUpdates(_0x55d63c){return function(_0x399b43){try{jsonpatch['apply'](_0x399b43,_0x55d63c,!![]);}catch(_0x57c128){return BPromise[_0xb814('0x22')](_0x57c128);}return _0x399b43[_0xb814('0x23')]();};}function saveUpdates(_0x25b6b6,_0x4e139e){return function(_0xf5b8aa){if(_0xf5b8aa){return _0xf5b8aa['update'](_0x25b6b6)[_0xb814('0x24')](function(_0x1808a3){return _0x1808a3;});}return null;};}function removeEntity(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x25')]()[_0xb814('0x24')](function(){var _0x594470=_0x27352e[_0xb814('0x26')]({'plain':!![]});var _0x52b7a3=_0xb814('0x27');return db[_0xb814('0x28')][_0xb814('0x25')]({'where':{'type':_0x52b7a3,'resourceId':_0x594470['id']}})[_0xb814('0x24')](function(){return _0x27352e;});})[_0xb814('0x24')](function(){_0x3b267e[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0x5755ea,_0x392222){return function(_0xc0ef66){if(!_0xc0ef66){_0x5755ea[_0xb814('0x1b')](0x194);}return _0xc0ef66;};}function handleError(_0x349394,_0x32ed56){_0x32ed56=_0x32ed56||0x1f4;return function(_0x1d5965){logger[_0xb814('0x29')](_0x1d5965[_0xb814('0x2a')]);if(_0x1d5965['name']){delete _0x1d5965[_0xb814('0x2b')];}_0x349394[_0xb814('0x1c')](_0x32ed56)['send'](_0x1d5965);};}exports[_0xb814('0x2c')]=function(_0x37d24d,_0x530744){var _0x499f22={},_0x20577b={},_0x2051d0={'count':0x0,'rows':[]};var _0x58c3ca=_[_0xb814('0x2d')](db['Template'][_0xb814('0x2e')],function(_0x5f3e9b){return{'name':_0x5f3e9b['fieldName'],'type':_0x5f3e9b[_0xb814('0x2f')]['key']};});_0x20577b[_0xb814('0x30')]=_[_0xb814('0x2d')](_0x58c3ca,_0xb814('0x2b'));_0x20577b['query']=_['keys'](_0x37d24d[_0xb814('0x31')]);_0x20577b[_0xb814('0x32')]=_['intersection'](_0x20577b[_0xb814('0x30')],_0x20577b[_0xb814('0x31')]);_0x499f22[_0xb814('0x33')]=_[_0xb814('0x34')](_0x20577b[_0xb814('0x30')],qs[_0xb814('0x35')](_0x37d24d[_0xb814('0x31')]['fields']));_0x499f22[_0xb814('0x33')]=_0x499f22[_0xb814('0x33')][_0xb814('0x36')]?_0x499f22[_0xb814('0x33')]:_0x20577b[_0xb814('0x30')];if(!_0x37d24d['query'][_0xb814('0x37')]('nolimit')){_0x499f22[_0xb814('0x38')]=qs[_0xb814('0x38')](_0x37d24d[_0xb814('0x31')]['limit']);_0x499f22[_0xb814('0x20')]=qs[_0xb814('0x20')](_0x37d24d['query'][_0xb814('0x20')]);}_0x499f22[_0xb814('0x39')]=qs[_0xb814('0x3a')](_0x37d24d[_0xb814('0x31')][_0xb814('0x3a')]);_0x499f22[_0xb814('0x3b')]=qs['filters'](_[_0xb814('0x3c')](_0x37d24d['query'],_0x20577b[_0xb814('0x32')]),_0x58c3ca);if(_0x37d24d['query'][_0xb814('0x3d')]){_0x499f22['where']=_[_0xb814('0x3e')](_0x499f22[_0xb814('0x3b')],{'$or':_['map'](_0x58c3ca,function(_0x4d308a){if(_0x4d308a['type']!=='VIRTUAL'){var _0x17549e={};_0x17549e[_0x4d308a[_0xb814('0x2b')]]={'$like':'%'+_0x37d24d[_0xb814('0x31')][_0xb814('0x3d')]+'%'};return _0x17549e;}})});}_0x499f22=_['merge']({},_0x499f22,_0x37d24d['options']);var _0x6f15d3={'where':_0x499f22['where']};return db[_0xb814('0x3f')][_0xb814('0x1f')](_0x6f15d3)[_0xb814('0x24')](function(_0x3063bf){_0x2051d0[_0xb814('0x1f')]=_0x3063bf;if(_0x37d24d[_0xb814('0x31')][_0xb814('0x40')]){_0x499f22[_0xb814('0x41')]=[{'all':!![]}];}return db[_0xb814('0x3f')]['findAll'](_0x499f22);})['then'](function(_0x5d26be){_0x2051d0[_0xb814('0x42')]=_0x5d26be;return _0x2051d0;})['then'](respondWithFilteredResult(_0x530744,_0x499f22))[_0xb814('0x43')](handleError(_0x530744,null));};exports['show']=function(_0x411723,_0x44ff56){var _0x9ef639={'raw':!![],'where':{'id':_0x411723['params']['id']}},_0x2e97cc={};_0x2e97cc[_0xb814('0x30')]=_[_0xb814('0x44')](db[_0xb814('0x3f')][_0xb814('0x2e')]);_0x2e97cc[_0xb814('0x31')]=_[_0xb814('0x44')](_0x411723['query']);_0x2e97cc[_0xb814('0x32')]=_[_0xb814('0x34')](_0x2e97cc[_0xb814('0x30')],_0x2e97cc[_0xb814('0x31')]);_0x9ef639[_0xb814('0x33')]=_[_0xb814('0x34')](_0x2e97cc[_0xb814('0x30')],qs['fields'](_0x411723['query'][_0xb814('0x35')]));_0x9ef639[_0xb814('0x33')]=_0x9ef639[_0xb814('0x33')][_0xb814('0x36')]?_0x9ef639[_0xb814('0x33')]:_0x2e97cc[_0xb814('0x30')];if(_0x411723[_0xb814('0x31')][_0xb814('0x40')]){_0x9ef639[_0xb814('0x41')]=[{'all':!![]}];}_0x9ef639=_[_0xb814('0x3e')]({},_0x9ef639,_0x411723[_0xb814('0x45')]);return db['Template'][_0xb814('0x46')](_0x9ef639)[_0xb814('0x24')](handleEntityNotFound(_0x44ff56,null))['then'](respondWithResult(_0x44ff56,null))[_0xb814('0x43')](handleError(_0x44ff56,null));};exports['create']=function(_0x2fb0f7,_0x37866f){return db[_0xb814('0x3f')][_0xb814('0x47')](_0x2fb0f7[_0xb814('0x48')],{})[_0xb814('0x24')](function(_0x2cc806){var _0x45480e=_0x2fb0f7[_0xb814('0x49')][_0xb814('0x26')]({'plain':!![]});if(!_0x45480e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45480e['role']===_0xb814('0x49')){var _0x30f07b=_0x2cc806[_0xb814('0x26')]({'plain':!![]});var _0x3f8e29=_0xb814('0x27');return db[_0xb814('0x4a')][_0xb814('0x46')]({'where':{'name':_0x3f8e29,'userProfileId':_0x45480e['userProfileId']},'raw':!![]})[_0xb814('0x24')](function(_0x388324){if(_0x388324&&_0x388324[_0xb814('0x4b')]===0x0){return db['UserProfileResource'][_0xb814('0x47')]({'name':_0x30f07b['name'],'resourceId':_0x30f07b['id'],'type':_0x388324[_0xb814('0x2b')],'sectionId':_0x388324['id']},{})['then'](function(){return _0x2cc806;});}else{return _0x2cc806;}})[_0xb814('0x43')](function(_0x3cf8f8){logger['error'](_0xb814('0x4c'),_0x3cf8f8);throw _0x3cf8f8;});}return _0x2cc806;})[_0xb814('0x24')](respondWithResult(_0x37866f,0xc9))[_0xb814('0x43')](handleError(_0x37866f,null));};exports['update']=function(_0x3da050,_0x5f0e58){if(_0x3da050[_0xb814('0x48')]['id']){delete _0x3da050[_0xb814('0x48')]['id'];}return db['Template'][_0xb814('0x46')]({'where':{'id':_0x3da050['params']['id']}})['then'](handleEntityNotFound(_0x5f0e58,null))[_0xb814('0x24')](saveUpdates(_0x3da050[_0xb814('0x48')],null))[_0xb814('0x24')](respondWithResult(_0x5f0e58,null))['catch'](handleError(_0x5f0e58,null));};exports[_0xb814('0x25')]=function(_0x538b0f,_0xf88d23){return db[_0xb814('0x3f')]['find']({'where':{'id':_0x538b0f[_0xb814('0x4d')]['id']}})['then'](handleEntityNotFound(_0xf88d23,null))[_0xb814('0x24')](removeEntity(_0xf88d23,null))[_0xb814('0x43')](handleError(_0xf88d23,null));}; \ No newline at end of file +var _0x814b=['filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','Template','includeAll','include','rows','catch','keys','options','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','then','destroy','get','Templates','UserProfileResource','error','stack','name','index','map','rawAttributes','type','model','query'];(function(_0x2cdf69,_0x53110c){var _0x501d6f=function(_0x1d8eb6){while(--_0x1d8eb6){_0x2cdf69['push'](_0x2cdf69['shift']());}};_0x501d6f(++_0x53110c);}(_0x814b,0x1a2));var _0xb814=function(_0x27d958,_0x29ef87){_0x27d958=_0x27d958-0x0;var _0x53e63e=_0x814b[_0x27d958];return _0x53e63e;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=_0x3a71d6[_0xb814('0x1f')],_0x265a83=_0x303aca['offset'],_0x125ce2=_0x303aca[_0xb814('0x20')]+_0x303aca['limit'],_0x21b73f;if(_0x125ce2>=_0x45e0d0){_0x125ce2=_0x45e0d0;_0x21b73f=0xc8;}else{_0x21b73f=0xce;}_0x39bfcf[_0xb814('0x1c')](_0x21b73f);return _0x39bfcf[_0xb814('0x21')]('Content-Range',_0x265a83+'-'+_0x125ce2+'/'+_0x45e0d0)['json'](_0x3a71d6);}return null;};}function patchUpdates(_0x55d63c){return function(_0x399b43){try{jsonpatch['apply'](_0x399b43,_0x55d63c,!![]);}catch(_0x57c128){return BPromise[_0xb814('0x22')](_0x57c128);}return _0x399b43[_0xb814('0x23')]();};}function saveUpdates(_0x25b6b6,_0x4e139e){return function(_0xf5b8aa){if(_0xf5b8aa){return _0xf5b8aa['update'](_0x25b6b6)[_0xb814('0x24')](function(_0x1808a3){return _0x1808a3;});}return null;};}function removeEntity(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x25')]()[_0xb814('0x24')](function(){var _0x594470=_0x27352e[_0xb814('0x26')]({'plain':!![]});var _0x52b7a3=_0xb814('0x27');return db[_0xb814('0x28')][_0xb814('0x25')]({'where':{'type':_0x52b7a3,'resourceId':_0x594470['id']}})[_0xb814('0x24')](function(){return _0x27352e;});})[_0xb814('0x24')](function(){_0x3b267e[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0x5755ea,_0x392222){return function(_0xc0ef66){if(!_0xc0ef66){_0x5755ea[_0xb814('0x1b')](0x194);}return _0xc0ef66;};}function handleError(_0x349394,_0x32ed56){_0x32ed56=_0x32ed56||0x1f4;return function(_0x1d5965){logger[_0xb814('0x29')](_0x1d5965[_0xb814('0x2a')]);if(_0x1d5965['name']){delete _0x1d5965[_0xb814('0x2b')];}_0x349394[_0xb814('0x1c')](_0x32ed56)['send'](_0x1d5965);};}exports[_0xb814('0x2c')]=function(_0x37d24d,_0x530744){var _0x499f22={},_0x20577b={},_0x2051d0={'count':0x0,'rows':[]};var _0x58c3ca=_[_0xb814('0x2d')](db['Template'][_0xb814('0x2e')],function(_0x5f3e9b){return{'name':_0x5f3e9b['fieldName'],'type':_0x5f3e9b[_0xb814('0x2f')]['key']};});_0x20577b[_0xb814('0x30')]=_[_0xb814('0x2d')](_0x58c3ca,_0xb814('0x2b'));_0x20577b['query']=_['keys'](_0x37d24d[_0xb814('0x31')]);_0x20577b[_0xb814('0x32')]=_['intersection'](_0x20577b[_0xb814('0x30')],_0x20577b[_0xb814('0x31')]);_0x499f22[_0xb814('0x33')]=_[_0xb814('0x34')](_0x20577b[_0xb814('0x30')],qs[_0xb814('0x35')](_0x37d24d[_0xb814('0x31')]['fields']));_0x499f22[_0xb814('0x33')]=_0x499f22[_0xb814('0x33')][_0xb814('0x36')]?_0x499f22[_0xb814('0x33')]:_0x20577b[_0xb814('0x30')];if(!_0x37d24d['query'][_0xb814('0x37')]('nolimit')){_0x499f22[_0xb814('0x38')]=qs[_0xb814('0x38')](_0x37d24d[_0xb814('0x31')]['limit']);_0x499f22[_0xb814('0x20')]=qs[_0xb814('0x20')](_0x37d24d['query'][_0xb814('0x20')]);}_0x499f22[_0xb814('0x39')]=qs[_0xb814('0x3a')](_0x37d24d[_0xb814('0x31')][_0xb814('0x3a')]);_0x499f22[_0xb814('0x3b')]=qs['filters'](_[_0xb814('0x3c')](_0x37d24d['query'],_0x20577b[_0xb814('0x32')]),_0x58c3ca);if(_0x37d24d['query'][_0xb814('0x3d')]){_0x499f22['where']=_[_0xb814('0x3e')](_0x499f22[_0xb814('0x3b')],{'$or':_['map'](_0x58c3ca,function(_0x4d308a){if(_0x4d308a['type']!=='VIRTUAL'){var _0x17549e={};_0x17549e[_0x4d308a[_0xb814('0x2b')]]={'$like':'%'+_0x37d24d[_0xb814('0x31')][_0xb814('0x3d')]+'%'};return _0x17549e;}})});}_0x499f22=_['merge']({},_0x499f22,_0x37d24d['options']);var _0x6f15d3={'where':_0x499f22['where']};return db[_0xb814('0x3f')][_0xb814('0x1f')](_0x6f15d3)[_0xb814('0x24')](function(_0x3063bf){_0x2051d0[_0xb814('0x1f')]=_0x3063bf;if(_0x37d24d[_0xb814('0x31')][_0xb814('0x40')]){_0x499f22[_0xb814('0x41')]=[{'all':!![]}];}return db[_0xb814('0x3f')]['findAll'](_0x499f22);})['then'](function(_0x5d26be){_0x2051d0[_0xb814('0x42')]=_0x5d26be;return _0x2051d0;})['then'](respondWithFilteredResult(_0x530744,_0x499f22))[_0xb814('0x43')](handleError(_0x530744,null));};exports['show']=function(_0x411723,_0x44ff56){var _0x9ef639={'raw':!![],'where':{'id':_0x411723['params']['id']}},_0x2e97cc={};_0x2e97cc[_0xb814('0x30')]=_[_0xb814('0x44')](db[_0xb814('0x3f')][_0xb814('0x2e')]);_0x2e97cc[_0xb814('0x31')]=_[_0xb814('0x44')](_0x411723['query']);_0x2e97cc[_0xb814('0x32')]=_[_0xb814('0x34')](_0x2e97cc[_0xb814('0x30')],_0x2e97cc[_0xb814('0x31')]);_0x9ef639[_0xb814('0x33')]=_[_0xb814('0x34')](_0x2e97cc[_0xb814('0x30')],qs['fields'](_0x411723['query'][_0xb814('0x35')]));_0x9ef639[_0xb814('0x33')]=_0x9ef639[_0xb814('0x33')][_0xb814('0x36')]?_0x9ef639[_0xb814('0x33')]:_0x2e97cc[_0xb814('0x30')];if(_0x411723[_0xb814('0x31')][_0xb814('0x40')]){_0x9ef639[_0xb814('0x41')]=[{'all':!![]}];}_0x9ef639=_[_0xb814('0x3e')]({},_0x9ef639,_0x411723[_0xb814('0x45')]);return db['Template'][_0xb814('0x46')](_0x9ef639)[_0xb814('0x24')](handleEntityNotFound(_0x44ff56,null))['then'](respondWithResult(_0x44ff56,null))[_0xb814('0x43')](handleError(_0x44ff56,null));};exports['create']=function(_0x2fb0f7,_0x37866f){return db[_0xb814('0x3f')][_0xb814('0x47')](_0x2fb0f7[_0xb814('0x48')],{})[_0xb814('0x24')](function(_0x2cc806){var _0x45480e=_0x2fb0f7[_0xb814('0x49')][_0xb814('0x26')]({'plain':!![]});if(!_0x45480e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45480e['role']===_0xb814('0x49')){var _0x30f07b=_0x2cc806[_0xb814('0x26')]({'plain':!![]});var _0x3f8e29=_0xb814('0x27');return db[_0xb814('0x4a')][_0xb814('0x46')]({'where':{'name':_0x3f8e29,'userProfileId':_0x45480e['userProfileId']},'raw':!![]})[_0xb814('0x24')](function(_0x388324){if(_0x388324&&_0x388324[_0xb814('0x4b')]===0x0){return db['UserProfileResource'][_0xb814('0x47')]({'name':_0x30f07b['name'],'resourceId':_0x30f07b['id'],'type':_0x388324[_0xb814('0x2b')],'sectionId':_0x388324['id']},{})['then'](function(){return _0x2cc806;});}else{return _0x2cc806;}})[_0xb814('0x43')](function(_0x3cf8f8){logger['error'](_0xb814('0x4c'),_0x3cf8f8);throw _0x3cf8f8;});}return _0x2cc806;})[_0xb814('0x24')](respondWithResult(_0x37866f,0xc9))[_0xb814('0x43')](handleError(_0x37866f,null));};exports['update']=function(_0x3da050,_0x5f0e58){if(_0x3da050[_0xb814('0x48')]['id']){delete _0x3da050[_0xb814('0x48')]['id'];}return db['Template'][_0xb814('0x46')]({'where':{'id':_0x3da050['params']['id']}})['then'](handleEntityNotFound(_0x5f0e58,null))[_0xb814('0x24')](saveUpdates(_0x3da050[_0xb814('0x48')],null))[_0xb814('0x24')](respondWithResult(_0x5f0e58,null))['catch'](handleError(_0x5f0e58,null));};exports[_0xb814('0x25')]=function(_0x538b0f,_0xf88d23){return db[_0xb814('0x3f')]['find']({'where':{'id':_0x538b0f[_0xb814('0x4d')]['id']}})['then'](handleEntityNotFound(_0xf88d23,null))[_0xb814('0x24')](removeEntity(_0xf88d23,null))[_0xb814('0x43')](handleError(_0xf88d23,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 5ccb163..06288c5 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 _0xc05f=['bluebird','request-promise','path','../../config/environment','exports','define','tools_templates','lodash','util','api','moment'];(function(_0x58f57f,_0x23028c){var _0x318b7f=function(_0x1f239b){while(--_0x1f239b){_0x58f57f['push'](_0x58f57f['shift']());}};_0x318b7f(++_0x23028c);}(_0xc05f,0x151));var _0xfc05=function(_0x26f926,_0x3530b0){_0x26f926=_0x26f926-0x0;var _0x569d96=_0xc05f[_0x26f926];return _0x569d96;};'use strict';var _=require(_0xfc05('0x0'));var util=require(_0xfc05('0x1'));var logger=require('../../config/logger')(_0xfc05('0x2'));var moment=require(_0xfc05('0x3'));var BPromise=require(_0xfc05('0x4'));var rp=require(_0xfc05('0x5'));var fs=require('fs');var path=require(_0xfc05('0x6'));var rimraf=require('rimraf');var config=require(_0xfc05('0x7'));var attributes=require('./template.attributes');module[_0xfc05('0x8')]=function(_0xdbad2c,_0x1de150){return _0xdbad2c[_0xfc05('0x9')]('Template',attributes,{'tableName':_0xfc05('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21d5=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./template.attributes','define','Template','tools_templates','util'];(function(_0x4eb913,_0xcbd670){var _0x5e0c78=function(_0x136cf){while(--_0x136cf){_0x4eb913['push'](_0x4eb913['shift']());}};_0x5e0c78(++_0xcbd670);}(_0x21d5,0x6b));var _0x521d=function(_0x4dddaa,_0x7f771a){_0x4dddaa=_0x4dddaa-0x0;var _0x36cc9b=_0x21d5[_0x4dddaa];return _0x36cc9b;};'use strict';var _=require('lodash');var util=require(_0x521d('0x0'));var logger=require(_0x521d('0x1'))(_0x521d('0x2'));var moment=require(_0x521d('0x3'));var BPromise=require(_0x521d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x521d('0x5'));var rimraf=require(_0x521d('0x6'));var config=require(_0x521d('0x7'));var attributes=require(_0x521d('0x8'));module['exports']=function(_0x27e21a,_0x1dbb16){return _0x27e21a[_0x521d('0x9')](_0x521d('0xa'),attributes,{'tableName':_0x521d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 866583d..cb7c389 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 _0x39ec=['Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','Template','findAll','options','raw','attributes','limit','include','model','map','GetTemplate','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Template,\x20%s,\x20%s','debug'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x39ec,0xb6));var _0xc39e=function(_0x18ce70,_0x14d8da){_0x18ce70=_0x18ce70-0x0;var _0x55f028=_0x39ec[_0x18ce70];return _0x55f028;};'use strict';var _=require(_0xc39e('0x0'));var util=require(_0xc39e('0x1'));var moment=require('moment');var BPromise=require(_0xc39e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc39e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc39e('0x4'));var logger=require(_0xc39e('0x5'))(_0xc39e('0x6'));var config=require(_0xc39e('0x7'));var jayson=require(_0xc39e('0x8'));var client=jayson[_0xc39e('0x9')][_0xc39e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1efecf,_0x3f1ba6,_0x39d010){return new BPromise(function(_0x12ff9a,_0xc78944){return client[_0xc39e('0xb')](_0x1efecf,_0x39d010)[_0xc39e('0xc')](function(_0x42032f){logger[_0xc39e('0xd')](_0xc39e('0xe'),_0x3f1ba6,'request\x20sent');logger[_0xc39e('0xf')](_0xc39e('0x10'),_0x3f1ba6,_0xc39e('0x11'),JSON[_0xc39e('0x12')](_0x42032f));if(_0x42032f[_0xc39e('0x13')]){if(_0x42032f['error']['code']===0x1f4){logger['error'](_0xc39e('0xe'),_0x3f1ba6,_0x42032f[_0xc39e('0x13')][_0xc39e('0x14')]);return _0xc78944(_0x42032f[_0xc39e('0x13')][_0xc39e('0x14')]);}logger[_0xc39e('0x13')](_0xc39e('0xe'),_0x3f1ba6,_0x42032f[_0xc39e('0x13')][_0xc39e('0x14')]);return _0x12ff9a(_0x42032f[_0xc39e('0x13')][_0xc39e('0x14')]);}else{logger['info'](_0xc39e('0xe'),_0x3f1ba6,_0xc39e('0x11'));_0x12ff9a(_0x42032f[_0xc39e('0x15')][_0xc39e('0x14')]);}})[_0xc39e('0x16')](function(_0xb08f7e){logger[_0xc39e('0x13')](_0xc39e('0xe'),_0x3f1ba6,_0xb08f7e);_0xc78944(_0xb08f7e);});});}exports['GetTemplate']=function(_0x1f867a){var _0x26054d=this;return new Promise(function(_0x10b459,_0x336479){return db[_0xc39e('0x17')][_0xc39e('0x18')]({'raw':_0x1f867a[_0xc39e('0x19')]?_0x1f867a[_0xc39e('0x19')][_0xc39e('0x1a')]===undefined?!![]:![]:!![],'where':_0x1f867a[_0xc39e('0x19')]?_0x1f867a[_0xc39e('0x19')]['where']||null:null,'attributes':_0x1f867a[_0xc39e('0x19')]?_0x1f867a[_0xc39e('0x19')][_0xc39e('0x1b')]||null:null,'limit':_0x1f867a[_0xc39e('0x19')]?_0x1f867a['options'][_0xc39e('0x1c')]||null:null,'include':_0x1f867a[_0xc39e('0x19')]?_0x1f867a['options'][_0xc39e('0x1d')]?_['map'](_0x1f867a[_0xc39e('0x19')][_0xc39e('0x1d')],function(_0x18ec2c){return{'model':db[_0x18ec2c[_0xc39e('0x1e')]],'as':_0x18ec2c['as'],'attributes':_0x18ec2c[_0xc39e('0x1b')],'include':_0x18ec2c[_0xc39e('0x1d')]?_[_0xc39e('0x1f')](_0x18ec2c[_0xc39e('0x1d')],function(_0x591693){return{'model':db[_0x591693[_0xc39e('0x1e')]],'as':_0x591693['as'],'attributes':_0x591693[_0xc39e('0x1b')],'include':_0x591693[_0xc39e('0x1d')]?_[_0xc39e('0x1f')](_0x591693[_0xc39e('0x1d')],function(_0x3f756c){return{'model':db[_0x3f756c['model']],'as':_0x3f756c['as'],'attributes':_0x3f756c[_0xc39e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc39e('0xc')](function(_0x4baf42){logger['info'](_0xc39e('0x20'),_0x1f867a);logger['debug'](_0xc39e('0x20'),_0x1f867a,JSON[_0xc39e('0x12')](_0x4baf42));_0x10b459(_0x4baf42);})[_0xc39e('0x16')](function(_0x1b750f){logger[_0xc39e('0x13')](_0xc39e('0x20'),_0x1b750f[_0xc39e('0x14')],_0x1f867a);_0x336479(_0x26054d[_0xc39e('0x13')](0x1f4,_0x1b750f['message']));});});}; \ No newline at end of file +var _0x47ce=['result','catch','Template','findAll','options','raw','limit','include','map','model','attributes','GetTemplate','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x37e9fc,_0x56f3a5){var _0x803877=function(_0x555738){while(--_0x555738){_0x37e9fc['push'](_0x37e9fc['shift']());}};_0x803877(++_0x56f3a5);}(_0x47ce,0x10c));var _0xe47c=function(_0x2e00cc,_0x167bdc){_0x2e00cc=_0x2e00cc-0x0;var _0x3af05a=_0x47ce[_0x2e00cc];return _0x3af05a;};'use strict';var _=require(_0xe47c('0x0'));var util=require(_0xe47c('0x1'));var moment=require(_0xe47c('0x2'));var BPromise=require('bluebird');var rs=require(_0xe47c('0x3'));var fs=require('fs');var Redis=require(_0xe47c('0x4'));var db=require(_0xe47c('0x5'))['db'];var utils=require(_0xe47c('0x6'));var logger=require(_0xe47c('0x7'))(_0xe47c('0x8'));var config=require(_0xe47c('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe47c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12da1b,_0x2e3599,_0x616f1c){return new BPromise(function(_0x2660c0,_0x4875ea){return client[_0xe47c('0xb')](_0x12da1b,_0x616f1c)[_0xe47c('0xc')](function(_0x847adf){logger['info'](_0xe47c('0xd'),_0x2e3599,_0xe47c('0xe'));logger['debug'](_0xe47c('0xf'),_0x2e3599,_0xe47c('0xe'),JSON[_0xe47c('0x10')](_0x847adf));if(_0x847adf[_0xe47c('0x11')]){if(_0x847adf[_0xe47c('0x11')]['code']===0x1f4){logger[_0xe47c('0x11')]('Template,\x20%s,\x20%s',_0x2e3599,_0x847adf[_0xe47c('0x11')][_0xe47c('0x12')]);return _0x4875ea(_0x847adf[_0xe47c('0x11')][_0xe47c('0x12')]);}logger[_0xe47c('0x11')](_0xe47c('0xd'),_0x2e3599,_0x847adf['error'][_0xe47c('0x12')]);return _0x2660c0(_0x847adf[_0xe47c('0x11')][_0xe47c('0x12')]);}else{logger[_0xe47c('0x13')](_0xe47c('0xd'),_0x2e3599,'request\x20sent');_0x2660c0(_0x847adf[_0xe47c('0x14')]['message']);}})[_0xe47c('0x15')](function(_0x51a479){logger[_0xe47c('0x11')](_0xe47c('0xd'),_0x2e3599,_0x51a479);_0x4875ea(_0x51a479);});});}exports['GetTemplate']=function(_0x473227){var _0x57e526=this;return new Promise(function(_0x1ed275,_0x3823f2){return db[_0xe47c('0x16')][_0xe47c('0x17')]({'raw':_0x473227[_0xe47c('0x18')]?_0x473227[_0xe47c('0x18')][_0xe47c('0x19')]===undefined?!![]:![]:!![],'where':_0x473227['options']?_0x473227[_0xe47c('0x18')]['where']||null:null,'attributes':_0x473227[_0xe47c('0x18')]?_0x473227['options']['attributes']||null:null,'limit':_0x473227[_0xe47c('0x18')]?_0x473227['options'][_0xe47c('0x1a')]||null:null,'include':_0x473227[_0xe47c('0x18')]?_0x473227[_0xe47c('0x18')][_0xe47c('0x1b')]?_[_0xe47c('0x1c')](_0x473227['options'][_0xe47c('0x1b')],function(_0x4aea46){return{'model':db[_0x4aea46[_0xe47c('0x1d')]],'as':_0x4aea46['as'],'attributes':_0x4aea46[_0xe47c('0x1e')],'include':_0x4aea46[_0xe47c('0x1b')]?_[_0xe47c('0x1c')](_0x4aea46[_0xe47c('0x1b')],function(_0x34f252){return{'model':db[_0x34f252[_0xe47c('0x1d')]],'as':_0x34f252['as'],'attributes':_0x34f252[_0xe47c('0x1e')],'include':_0x34f252[_0xe47c('0x1b')]?_['map'](_0x34f252[_0xe47c('0x1b')],function(_0x19ac36){return{'model':db[_0x19ac36[_0xe47c('0x1d')]],'as':_0x19ac36['as'],'attributes':_0x19ac36['attributes']};}):[]};}):[]};}):[]:[]})[_0xe47c('0xc')](function(_0x2eaecd){logger[_0xe47c('0x13')](_0xe47c('0x1f'),_0x473227);logger['debug']('GetTemplate',_0x473227,JSON['stringify'](_0x2eaecd));_0x1ed275(_0x2eaecd);})[_0xe47c('0x15')](function(_0x4b7de7){logger['error'](_0xe47c('0x1f'),_0x4b7de7[_0xe47c('0x12')],_0x473227);_0x3823f2(_0x57e526[_0xe47c('0x11')](0x1f4,_0x4b7de7[_0xe47c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 2fac9be..9073abb 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 _0x700f=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','/:id','show','getAllConditions','/:id/any_conditions','isAuthenticated','getAnyConditions','/:id/actions','getActions','post','/:id/all_conditions','addAllCondition','put'];(function(_0x2d6f9c,_0x2bf013){var _0x2ed6a5=function(_0x36bd74){while(--_0x36bd74){_0x2d6f9c['push'](_0x2d6f9c['shift']());}};_0x2ed6a5(++_0x2bf013);}(_0x700f,0xf7));var _0xf700=function(_0x5b2b52,_0x2887c3){_0x5b2b52=_0x5b2b52-0x0;var _0x1d432f=_0x700f[_0x5b2b52];return _0x1d432f;};'use strict';var multer=require(_0xf700('0x0'));var util=require(_0xf700('0x1'));var path=require('path');var timeout=require(_0xf700('0x2'));var express=require(_0xf700('0x3'));var router=express[_0xf700('0x4')]();var auth=require(_0xf700('0x5'));var interaction=require(_0xf700('0x6'));var config=require(_0xf700('0x7'));var controller=require(_0xf700('0x8'));router[_0xf700('0x9')]('/',auth['isAuthenticated'](),controller[_0xf700('0xa')]);router[_0xf700('0x9')](_0xf700('0xb'),auth['isAuthenticated'](),controller[_0xf700('0xc')]);router[_0xf700('0x9')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xf700('0xd')]);router[_0xf700('0x9')](_0xf700('0xe'),auth[_0xf700('0xf')](),controller[_0xf700('0x10')]);router[_0xf700('0x9')](_0xf700('0x11'),auth['isAuthenticated'](),controller[_0xf700('0x12')]);router[_0xf700('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf700('0x13')](_0xf700('0x14'),auth[_0xf700('0xf')](),controller[_0xf700('0x15')]);router[_0xf700('0x13')](_0xf700('0xe'),auth[_0xf700('0xf')](),controller['addAnyCondition']);router[_0xf700('0x13')](_0xf700('0x11'),auth['isAuthenticated'](),controller['addAction']);router[_0xf700('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xf700('0x17')]);router[_0xf700('0x18')](_0xf700('0xb'),auth[_0xf700('0xf')](),controller[_0xf700('0x19')]);module[_0xf700('0x1a')]=router; \ No newline at end of file +var _0x8aec=['put','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','/:id','show','/:id/all_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','addAction'];(function(_0x338442,_0x1974d1){var _0x11179b=function(_0x5bd177){while(--_0x5bd177){_0x338442['push'](_0x338442['shift']());}};_0x11179b(++_0x1974d1);}(_0x8aec,0x19a));var _0xc8ae=function(_0x47aaf9,_0xfa68ca){_0x47aaf9=_0x47aaf9-0x0;var _0x2f0fa2=_0x8aec[_0x47aaf9];return _0x2f0fa2;};'use strict';var multer=require(_0xc8ae('0x0'));var util=require(_0xc8ae('0x1'));var path=require(_0xc8ae('0x2'));var timeout=require(_0xc8ae('0x3'));var express=require('express');var router=express[_0xc8ae('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc8ae('0x5'));var config=require(_0xc8ae('0x6'));var controller=require(_0xc8ae('0x7'));router[_0xc8ae('0x8')]('/',auth[_0xc8ae('0x9')](),controller['index']);router[_0xc8ae('0x8')](_0xc8ae('0xa'),auth[_0xc8ae('0x9')](),controller[_0xc8ae('0xb')]);router[_0xc8ae('0x8')](_0xc8ae('0xc'),auth[_0xc8ae('0x9')](),controller['getAllConditions']);router[_0xc8ae('0x8')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0xc8ae('0xd')]);router['get'](_0xc8ae('0xe'),auth[_0xc8ae('0x9')](),controller[_0xc8ae('0xf')]);router[_0xc8ae('0x10')]('/',auth[_0xc8ae('0x9')](),controller[_0xc8ae('0x11')]);router[_0xc8ae('0x10')](_0xc8ae('0xc'),auth[_0xc8ae('0x9')](),controller[_0xc8ae('0x12')]);router[_0xc8ae('0x10')](_0xc8ae('0x13'),auth[_0xc8ae('0x9')](),controller[_0xc8ae('0x14')]);router[_0xc8ae('0x10')](_0xc8ae('0xe'),auth[_0xc8ae('0x9')](),controller[_0xc8ae('0x15')]);router[_0xc8ae('0x16')](_0xc8ae('0xa'),auth[_0xc8ae('0x9')](),controller['update']);router['delete'](_0xc8ae('0xa'),auth[_0xc8ae('0x9')](),controller[_0xc8ae('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index f3d63e8..2e143a5 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 _0xd6d4=['BOOLEAN','exports','STRING'];(function(_0x1bf614,_0x255851){var _0x5ed15c=function(_0x5051f6){while(--_0x5051f6){_0x1bf614['push'](_0x1bf614['shift']());}};_0x5ed15c(++_0x255851);}(_0xd6d4,0x1c6));var _0x4d6d=function(_0x5261b7,_0x3a4168){_0x5261b7=_0x5261b7-0x0;var _0x243145=_0xd6d4[_0x5261b7];return _0x243145;};'use strict';var Sequelize=require('sequelize');module[_0x4d6d('0x0')]={'name':{'type':Sequelize[_0x4d6d('0x1')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4d6d('0x1')]},'status':{'type':Sequelize[_0x4d6d('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x938c=['STRING','BOOLEAN','sequelize','exports'];(function(_0x54c63e,_0x4218d1){var _0x3ccd14=function(_0x3e6654){while(--_0x3e6654){_0x54c63e['push'](_0x54c63e['shift']());}};_0x3ccd14(++_0x4218d1);}(_0x938c,0x72));var _0xc938=function(_0x1607f4,_0x308e1d){_0x1607f4=_0x1607f4-0x0;var _0xc32294=_0x938c[_0x1607f4];return _0xc32294;};'use strict';var Sequelize=require(_0xc938('0x0'));module[_0xc938('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc938('0x2')]},'description':{'type':Sequelize[_0xc938('0x2')]},'status':{'type':Sequelize[_0xc938('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 3e95ed1..f94a46f 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 _0x36bb=['filter','where','merge','VIRTUAL','Trigger','includeAll','include','findAll','rows','catch','intersection','options','create','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','addAllCondition','TriggerAllId','Condition','getAllConditions','findOne','length','getAnyConditions','addAction','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Triggers','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick'];(function(_0x2f9fff,_0x234894){var _0x259aa8=function(_0x3dcd61){while(--_0x3dcd61){_0x2f9fff['push'](_0x2f9fff['shift']());}};_0x259aa8(++_0x234894);}(_0x36bb,0xe6));var _0xb36b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36bb[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xb36b('0x0'));var emlformat=require(_0xb36b('0x1'));var rimraf=require(_0xb36b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb36b('0x3'));var rp=require(_0xb36b('0x4'));var moment=require(_0xb36b('0x5'));var BPromise=require(_0xb36b('0x6'));var Mustache=require(_0xb36b('0x7'));var util=require(_0xb36b('0x8'));var path=require(_0xb36b('0x9'));var sox=require(_0xb36b('0xa'));var csv=require(_0xb36b('0xb'));var ejs=require(_0xb36b('0xc'));var fs=require('fs');var _=require(_0xb36b('0xd'));var squel=require(_0xb36b('0xe'));var crypto=require(_0xb36b('0xf'));var jsforce=require(_0xb36b('0x10'));var deskjs=require(_0xb36b('0x11'));var toCsv=require(_0xb36b('0xb'));var querystring=require(_0xb36b('0x12'));var Papa=require(_0xb36b('0x13'));var Redis=require(_0xb36b('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xb36b('0x15'));var as=require(_0xb36b('0x16'));var hardwareService=require(_0xb36b('0x17'));var logger=require('../../config/logger')(_0xb36b('0x18'));var utils=require(_0xb36b('0x19'));var config=require(_0xb36b('0x1a'));var licenseUtil=require(_0xb36b('0x1b'));var db=require(_0xb36b('0x1c'))['db'];function respondWithStatusCode(_0x11f775,_0x1ad623){_0x1ad623=_0x1ad623||0xcc;return function(_0x1c266a){if(_0x1c266a){return _0x11f775[_0xb36b('0x1d')](_0x1ad623);}return _0x11f775[_0xb36b('0x1e')](_0x1ad623)[_0xb36b('0x1f')]();};}function respondWithResult(_0x59af21,_0x1aef0b){_0x1aef0b=_0x1aef0b||0xc8;return function(_0x4c2c46){if(_0x4c2c46){return _0x59af21['status'](_0x1aef0b)[_0xb36b('0x20')](_0x4c2c46);}};}function respondWithFilteredResult(_0x329f60,_0x23e960){return function(_0x4b74f1){if(_0x4b74f1){var _0x5c7255=_0x4b74f1[_0xb36b('0x21')],_0x2b6dca=_0x23e960[_0xb36b('0x22')],_0x5ad8c8=_0x23e960[_0xb36b('0x22')]+_0x23e960['limit'],_0x12f119;if(_0x5ad8c8>=_0x5c7255){_0x5ad8c8=_0x5c7255;_0x12f119=0xc8;}else{_0x12f119=0xce;}_0x329f60[_0xb36b('0x1e')](_0x12f119);return _0x329f60[_0xb36b('0x23')](_0xb36b('0x24'),_0x2b6dca+'-'+_0x5ad8c8+'/'+_0x5c7255)['json'](_0x4b74f1);}return null;};}function patchUpdates(_0x42df8c){return function(_0x572d88){try{jsonpatch[_0xb36b('0x25')](_0x572d88,_0x42df8c,!![]);}catch(_0xac85bd){return BPromise[_0xb36b('0x26')](_0xac85bd);}return _0x572d88[_0xb36b('0x27')]();};}function saveUpdates(_0x4049fa,_0x5f6648){return function(_0x207d7f){if(_0x207d7f){return _0x207d7f['update'](_0x4049fa)[_0xb36b('0x28')](function(_0x530ecc){return _0x530ecc;});}return null;};}function removeEntity(_0x218995,_0x52b74f){return function(_0x3b8030){if(_0x3b8030){return _0x3b8030[_0xb36b('0x29')]()[_0xb36b('0x28')](function(){var _0x174795=_0x3b8030[_0xb36b('0x2a')]({'plain':!![]});var _0x5f4a25=_0xb36b('0x2b');return db[_0xb36b('0x2c')][_0xb36b('0x29')]({'where':{'type':_0x5f4a25,'resourceId':_0x174795['id']}})['then'](function(){return _0x3b8030;});})[_0xb36b('0x28')](function(){_0x218995['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50e8e4,_0x9a9cd8){return function(_0x1d904e){if(!_0x1d904e){_0x50e8e4[_0xb36b('0x1d')](0x194);}return _0x1d904e;};}function handleError(_0x5c4aee,_0x455d35){_0x455d35=_0x455d35||0x1f4;return function(_0x46dfc){logger[_0xb36b('0x2d')](_0x46dfc[_0xb36b('0x2e')]);if(_0x46dfc['name']){delete _0x46dfc['name'];}_0x5c4aee[_0xb36b('0x1e')](_0x455d35)[_0xb36b('0x2f')](_0x46dfc);};}exports[_0xb36b('0x30')]=function(_0x138f74,_0x4aabf5){var _0x492a96={},_0x14d3f1={},_0x4daf37={'count':0x0,'rows':[]};var _0x3e376f=_[_0xb36b('0x31')](db['Trigger'][_0xb36b('0x32')],function(_0x24f8bc){return{'name':_0x24f8bc[_0xb36b('0x33')],'type':_0x24f8bc[_0xb36b('0x34')][_0xb36b('0x35')]};});_0x14d3f1[_0xb36b('0x36')]=_[_0xb36b('0x31')](_0x3e376f,_0xb36b('0x37'));_0x14d3f1[_0xb36b('0x38')]=_[_0xb36b('0x39')](_0x138f74[_0xb36b('0x38')]);_0x14d3f1[_0xb36b('0x3a')]=_['intersection'](_0x14d3f1['model'],_0x14d3f1[_0xb36b('0x38')]);_0x492a96[_0xb36b('0x3b')]=_['intersection'](_0x14d3f1[_0xb36b('0x36')],qs['fields'](_0x138f74['query'][_0xb36b('0x3c')]));_0x492a96[_0xb36b('0x3b')]=_0x492a96[_0xb36b('0x3b')]['length']?_0x492a96['attributes']:_0x14d3f1[_0xb36b('0x36')];if(!_0x138f74[_0xb36b('0x38')][_0xb36b('0x3d')](_0xb36b('0x3e'))){_0x492a96[_0xb36b('0x3f')]=qs[_0xb36b('0x3f')](_0x138f74['query'][_0xb36b('0x3f')]);_0x492a96[_0xb36b('0x22')]=qs[_0xb36b('0x22')](_0x138f74[_0xb36b('0x38')][_0xb36b('0x22')]);}_0x492a96[_0xb36b('0x40')]=qs[_0xb36b('0x41')](_0x138f74[_0xb36b('0x38')][_0xb36b('0x41')]);_0x492a96['where']=qs[_0xb36b('0x3a')](_[_0xb36b('0x42')](_0x138f74[_0xb36b('0x38')],_0x14d3f1['filters']),_0x3e376f);if(_0x138f74[_0xb36b('0x38')][_0xb36b('0x43')]){_0x492a96[_0xb36b('0x44')]=_[_0xb36b('0x45')](_0x492a96['where'],{'$or':_['map'](_0x3e376f,function(_0x101a0c){if(_0x101a0c[_0xb36b('0x34')]!==_0xb36b('0x46')){var _0x15cc46={};_0x15cc46[_0x101a0c[_0xb36b('0x37')]]={'$like':'%'+_0x138f74[_0xb36b('0x38')][_0xb36b('0x43')]+'%'};return _0x15cc46;}})});}_0x492a96=_['merge']({},_0x492a96,_0x138f74['options']);var _0x4a9946={'where':_0x492a96[_0xb36b('0x44')]};return db[_0xb36b('0x47')][_0xb36b('0x21')](_0x4a9946)['then'](function(_0x29f426){_0x4daf37[_0xb36b('0x21')]=_0x29f426;if(_0x138f74[_0xb36b('0x38')][_0xb36b('0x48')]){_0x492a96[_0xb36b('0x49')]=[{'all':!![]}];}return db[_0xb36b('0x47')][_0xb36b('0x4a')](_0x492a96);})[_0xb36b('0x28')](function(_0xd1aaae){_0x4daf37[_0xb36b('0x4b')]=_0xd1aaae;return _0x4daf37;})['then'](respondWithFilteredResult(_0x4aabf5,_0x492a96))[_0xb36b('0x4c')](handleError(_0x4aabf5,null));};exports['show']=function(_0x4dd8e2,_0x107c41){var _0x1b70a4={'raw':![],'where':{'id':_0x4dd8e2['params']['id']}},_0x4e65f2={};_0x4e65f2[_0xb36b('0x36')]=_['keys'](db[_0xb36b('0x47')][_0xb36b('0x32')]);_0x4e65f2[_0xb36b('0x38')]=_[_0xb36b('0x39')](_0x4dd8e2[_0xb36b('0x38')]);_0x4e65f2['filters']=_[_0xb36b('0x4d')](_0x4e65f2[_0xb36b('0x36')],_0x4e65f2['query']);_0x1b70a4['attributes']=_['intersection'](_0x4e65f2[_0xb36b('0x36')],qs[_0xb36b('0x3c')](_0x4dd8e2[_0xb36b('0x38')][_0xb36b('0x3c')]));_0x1b70a4[_0xb36b('0x3b')]=_0x1b70a4['attributes']['length']?_0x1b70a4[_0xb36b('0x3b')]:_0x4e65f2['model'];if(_0x4dd8e2[_0xb36b('0x38')][_0xb36b('0x48')]){_0x1b70a4[_0xb36b('0x49')]=[{'all':!![]}];}_0x1b70a4=_[_0xb36b('0x45')]({},_0x1b70a4,_0x4dd8e2[_0xb36b('0x4e')]);return db[_0xb36b('0x47')]['find'](_0x1b70a4)[_0xb36b('0x28')](handleEntityNotFound(_0x107c41,null))[_0xb36b('0x28')](respondWithResult(_0x107c41,null))[_0xb36b('0x4c')](handleError(_0x107c41,null));};exports[_0xb36b('0x4f')]=function(_0x463328,_0x45d226){return db[_0xb36b('0x47')][_0xb36b('0x4f')](_0x463328['body'],{})[_0xb36b('0x28')](function(_0x453516){var _0x433257=_0x463328[_0xb36b('0x50')]['get']({'plain':!![]});if(!_0x433257)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x433257['role']===_0xb36b('0x50')){var _0xdc9a68=_0x453516[_0xb36b('0x2a')]({'plain':!![]});var _0x42b380=_0xb36b('0x2b');return db['UserProfileSection'][_0xb36b('0x51')]({'where':{'name':_0x42b380,'userProfileId':_0x433257[_0xb36b('0x52')]},'raw':!![]})[_0xb36b('0x28')](function(_0x46d2f8){if(_0x46d2f8&&_0x46d2f8[_0xb36b('0x53')]===0x0){return db['UserProfileResource'][_0xb36b('0x4f')]({'name':_0xdc9a68[_0xb36b('0x37')],'resourceId':_0xdc9a68['id'],'type':_0x46d2f8[_0xb36b('0x37')],'sectionId':_0x46d2f8['id']},{})[_0xb36b('0x28')](function(){return _0x453516;});}else{return _0x453516;}})[_0xb36b('0x4c')](function(_0x4a1c70){logger['error'](_0xb36b('0x54'),_0x4a1c70);throw _0x4a1c70;});}return _0x453516;})[_0xb36b('0x28')](respondWithResult(_0x45d226,0xc9))[_0xb36b('0x4c')](handleError(_0x45d226,null));};exports[_0xb36b('0x55')]=function(_0x19c765,_0x371bf3){if(_0x19c765[_0xb36b('0x56')]['id']){delete _0x19c765[_0xb36b('0x56')]['id'];}return db[_0xb36b('0x47')][_0xb36b('0x51')]({'where':{'id':_0x19c765[_0xb36b('0x57')]['id']}})['then'](handleEntityNotFound(_0x371bf3,null))[_0xb36b('0x28')](saveUpdates(_0x19c765[_0xb36b('0x56')],null))[_0xb36b('0x28')](respondWithResult(_0x371bf3,null))[_0xb36b('0x4c')](handleError(_0x371bf3,null));};exports[_0xb36b('0x29')]=function(_0x4026f9,_0x2d25ad){return db[_0xb36b('0x47')][_0xb36b('0x51')]({'where':{'id':_0x4026f9[_0xb36b('0x57')]['id']}})[_0xb36b('0x28')](handleEntityNotFound(_0x2d25ad,null))['then'](removeEntity(_0x2d25ad,null))[_0xb36b('0x4c')](handleError(_0x2d25ad,null));};exports[_0xb36b('0x58')]=function(_0x427860,_0x2267d6,_0x2ce68f){if(_0x427860[_0xb36b('0x56')]['id']){delete _0x427860['body']['id'];}return db[_0xb36b('0x47')][_0xb36b('0x51')]({'where':{'id':_0x427860[_0xb36b('0x57')]['id']}})[_0xb36b('0x28')](handleEntityNotFound(_0x2267d6,null))['then'](function(_0xf777c6){if(_0xf777c6){_0x427860[_0xb36b('0x56')][_0xb36b('0x59')]=_0xf777c6['id'];return db[_0xb36b('0x5a')][_0xb36b('0x4f')](_0x427860[_0xb36b('0x56')]);}})['then'](respondWithResult(_0x2267d6,null))['catch'](handleError(_0x2267d6,null));};exports['addAnyCondition']=function(_0x43204f,_0x2d01bf,_0x889c8d){if(_0x43204f['body']['id']){delete _0x43204f[_0xb36b('0x56')]['id'];}return db[_0xb36b('0x47')][_0xb36b('0x51')]({'where':{'id':_0x43204f[_0xb36b('0x57')]['id']}})[_0xb36b('0x28')](handleEntityNotFound(_0x2d01bf,null))[_0xb36b('0x28')](function(_0x5280ff){if(_0x5280ff){_0x43204f[_0xb36b('0x56')]['TriggerAnyId']=_0x5280ff['id'];return db['Condition'][_0xb36b('0x4f')](_0x43204f[_0xb36b('0x56')]);}})[_0xb36b('0x28')](respondWithResult(_0x2d01bf,null))['catch'](handleError(_0x2d01bf,null));};exports[_0xb36b('0x5b')]=function(_0x4e599f,_0x57f994,_0x4db0df){var _0x22dc63={};var _0x31c6b5={};var _0xf196c4;var _0x220d95;return db[_0xb36b('0x47')][_0xb36b('0x5c')]({'where':{'id':_0x4e599f[_0xb36b('0x57')]['id']}})[_0xb36b('0x28')](handleEntityNotFound(_0x57f994,null))['then'](function(_0x57a680){if(_0x57a680){_0xf196c4=_0x57a680;_0x31c6b5[_0xb36b('0x36')]=_['keys'](db['Condition'][_0xb36b('0x32')]);_0x31c6b5['query']=_[_0xb36b('0x39')](_0x4e599f[_0xb36b('0x38')]);_0x31c6b5[_0xb36b('0x3a')]=_[_0xb36b('0x4d')](_0x31c6b5[_0xb36b('0x36')],_0x31c6b5['query']);_0x22dc63[_0xb36b('0x3b')]=_[_0xb36b('0x4d')](_0x31c6b5[_0xb36b('0x36')],qs[_0xb36b('0x3c')](_0x4e599f[_0xb36b('0x38')][_0xb36b('0x3c')]));_0x22dc63['attributes']=_0x22dc63[_0xb36b('0x3b')]['length']?_0x22dc63[_0xb36b('0x3b')]:_0x31c6b5['model'];_0x22dc63[_0xb36b('0x40')]=qs[_0xb36b('0x41')](_0x4e599f[_0xb36b('0x38')][_0xb36b('0x41')]);_0x22dc63[_0xb36b('0x44')]=qs['filters'](_[_0xb36b('0x42')](_0x4e599f[_0xb36b('0x38')],_0x31c6b5['filters']));if(_0x4e599f[_0xb36b('0x38')]['filter']){_0x22dc63[_0xb36b('0x44')]=_[_0xb36b('0x45')](_0x22dc63[_0xb36b('0x44')],{'$or':_[_0xb36b('0x31')](_0x22dc63[_0xb36b('0x3b')],function(_0x294324){var _0x221860={};_0x221860[_0x294324]={'$like':'%'+_0x4e599f[_0xb36b('0x38')]['filter']+'%'};return _0x221860;})});}_0x22dc63=_[_0xb36b('0x45')]({},_0x22dc63,_0x4e599f[_0xb36b('0x4e')]);return _0xf196c4['getAllConditions'](_0x22dc63);}})['then'](function(_0x2c1817){if(_0x2c1817){_0x220d95=_0x2c1817[_0xb36b('0x5d')];if(!_0x4e599f[_0xb36b('0x38')][_0xb36b('0x3d')]('nolimit')){_0x22dc63[_0xb36b('0x3f')]=qs[_0xb36b('0x3f')](_0x4e599f['query'][_0xb36b('0x3f')]);_0x22dc63[_0xb36b('0x22')]=qs[_0xb36b('0x22')](_0x4e599f[_0xb36b('0x38')][_0xb36b('0x22')]);}return _0xf196c4['getAllConditions'](_0x22dc63);}})[_0xb36b('0x28')](function(_0x9b1c6e){if(_0x9b1c6e){return _0x9b1c6e?{'count':_0x220d95,'rows':_0x9b1c6e}:null;}})[_0xb36b('0x28')](respondWithResult(_0x57f994,null))['catch'](handleError(_0x57f994,null));};exports['getAnyConditions']=function(_0x3aa06b,_0x37391f,_0x126cc2){var _0x25216e={};var _0x199f9e={};var _0x339e44;var _0xac6918;return db[_0xb36b('0x47')][_0xb36b('0x5c')]({'where':{'id':_0x3aa06b['params']['id']}})[_0xb36b('0x28')](handleEntityNotFound(_0x37391f,null))[_0xb36b('0x28')](function(_0x15755e){if(_0x15755e){_0x339e44=_0x15755e;_0x199f9e[_0xb36b('0x36')]=_[_0xb36b('0x39')](db[_0xb36b('0x5a')]['rawAttributes']);_0x199f9e[_0xb36b('0x38')]=_['keys'](_0x3aa06b[_0xb36b('0x38')]);_0x199f9e[_0xb36b('0x3a')]=_[_0xb36b('0x4d')](_0x199f9e[_0xb36b('0x36')],_0x199f9e['query']);_0x25216e[_0xb36b('0x3b')]=_['intersection'](_0x199f9e['model'],qs['fields'](_0x3aa06b[_0xb36b('0x38')][_0xb36b('0x3c')]));_0x25216e[_0xb36b('0x3b')]=_0x25216e[_0xb36b('0x3b')][_0xb36b('0x5d')]?_0x25216e[_0xb36b('0x3b')]:_0x199f9e[_0xb36b('0x36')];_0x25216e['order']=qs['sort'](_0x3aa06b[_0xb36b('0x38')][_0xb36b('0x41')]);_0x25216e[_0xb36b('0x44')]=qs[_0xb36b('0x3a')](_[_0xb36b('0x42')](_0x3aa06b[_0xb36b('0x38')],_0x199f9e['filters']));if(_0x3aa06b[_0xb36b('0x38')]['filter']){_0x25216e[_0xb36b('0x44')]=_[_0xb36b('0x45')](_0x25216e[_0xb36b('0x44')],{'$or':_[_0xb36b('0x31')](_0x25216e[_0xb36b('0x3b')],function(_0x57348f){var _0x25482c={};_0x25482c[_0x57348f]={'$like':'%'+_0x3aa06b[_0xb36b('0x38')]['filter']+'%'};return _0x25482c;})});}_0x25216e=_['merge']({},_0x25216e,_0x3aa06b[_0xb36b('0x4e')]);return _0x339e44['getAnyConditions'](_0x25216e);}})[_0xb36b('0x28')](function(_0x4a4854){if(_0x4a4854){_0xac6918=_0x4a4854[_0xb36b('0x5d')];if(!_0x3aa06b[_0xb36b('0x38')][_0xb36b('0x3d')](_0xb36b('0x3e'))){_0x25216e['limit']=qs[_0xb36b('0x3f')](_0x3aa06b[_0xb36b('0x38')]['limit']);_0x25216e[_0xb36b('0x22')]=qs[_0xb36b('0x22')](_0x3aa06b['query']['offset']);}return _0x339e44[_0xb36b('0x5e')](_0x25216e);}})[_0xb36b('0x28')](function(_0x1df9cf){if(_0x1df9cf){return _0x1df9cf?{'count':_0xac6918,'rows':_0x1df9cf}:null;}})[_0xb36b('0x28')](respondWithResult(_0x37391f,null))[_0xb36b('0x4c')](handleError(_0x37391f,null));};exports[_0xb36b('0x5f')]=function(_0x477cf8,_0x459e21,_0x1db57e){if(_0x477cf8[_0xb36b('0x56')]['id']){delete _0x477cf8['body']['id'];}return db[_0xb36b('0x47')][_0xb36b('0x51')]({'where':{'id':_0x477cf8[_0xb36b('0x57')]['id']}})[_0xb36b('0x28')](handleEntityNotFound(_0x459e21,null))['then'](function(_0x18c7a7){if(_0x18c7a7){_0x477cf8[_0xb36b('0x56')][_0xb36b('0x60')]=_0x18c7a7['id'];return db[_0xb36b('0x61')][_0xb36b('0x4f')](_0x477cf8[_0xb36b('0x56')]);}})[_0xb36b('0x28')](respondWithResult(_0x459e21,null))[_0xb36b('0x4c')](handleError(_0x459e21,null));};exports['getActions']=function(_0x46edcd,_0x3ac795,_0x26e104){var _0x45f725={};var _0x97a6ef={};var _0x5b5d9a;var _0xafdd6b;return db[_0xb36b('0x47')][_0xb36b('0x5c')]({'where':{'id':_0x46edcd[_0xb36b('0x57')]['id']}})['then'](handleEntityNotFound(_0x3ac795,null))[_0xb36b('0x28')](function(_0x2a0f9f){if(_0x2a0f9f){_0x5b5d9a=_0x2a0f9f;_0x97a6ef[_0xb36b('0x36')]=_[_0xb36b('0x39')](db[_0xb36b('0x61')][_0xb36b('0x32')]);_0x97a6ef[_0xb36b('0x38')]=_[_0xb36b('0x39')](_0x46edcd[_0xb36b('0x38')]);_0x97a6ef[_0xb36b('0x3a')]=_[_0xb36b('0x4d')](_0x97a6ef[_0xb36b('0x36')],_0x97a6ef[_0xb36b('0x38')]);_0x45f725[_0xb36b('0x3b')]=_['intersection'](_0x97a6ef[_0xb36b('0x36')],qs[_0xb36b('0x3c')](_0x46edcd[_0xb36b('0x38')][_0xb36b('0x3c')]));_0x45f725[_0xb36b('0x3b')]=_0x45f725['attributes'][_0xb36b('0x5d')]?_0x45f725['attributes']:_0x97a6ef[_0xb36b('0x36')];_0x45f725[_0xb36b('0x40')]=qs[_0xb36b('0x41')](_0x46edcd[_0xb36b('0x38')][_0xb36b('0x41')]);_0x45f725['where']=qs[_0xb36b('0x3a')](_[_0xb36b('0x42')](_0x46edcd['query'],_0x97a6ef[_0xb36b('0x3a')]));if(_0x46edcd[_0xb36b('0x38')][_0xb36b('0x43')]){_0x45f725[_0xb36b('0x44')]=_[_0xb36b('0x45')](_0x45f725[_0xb36b('0x44')],{'$or':_[_0xb36b('0x31')](_0x45f725[_0xb36b('0x3b')],function(_0x13d51a){var _0x2dd036={};_0x2dd036[_0x13d51a]={'$like':'%'+_0x46edcd[_0xb36b('0x38')][_0xb36b('0x43')]+'%'};return _0x2dd036;})});}_0x45f725=_['merge']({},_0x45f725,_0x46edcd['options']);return _0x5b5d9a[_0xb36b('0x62')](_0x45f725);}})['then'](function(_0x28d636){if(_0x28d636){_0xafdd6b=_0x28d636['length'];if(!_0x46edcd[_0xb36b('0x38')][_0xb36b('0x3d')](_0xb36b('0x3e'))){_0x45f725[_0xb36b('0x3f')]=qs[_0xb36b('0x3f')](_0x46edcd[_0xb36b('0x38')][_0xb36b('0x3f')]);_0x45f725[_0xb36b('0x22')]=qs[_0xb36b('0x22')](_0x46edcd[_0xb36b('0x38')][_0xb36b('0x22')]);}return _0x5b5d9a[_0xb36b('0x62')](_0x45f725);}})['then'](function(_0x20d95d){if(_0x20d95d){return _0x20d95d?{'count':_0xafdd6b,'rows':_0x20d95d}:null;}})[_0xb36b('0x28')](respondWithResult(_0x3ac795,null))[_0xb36b('0x4c')](handleError(_0x3ac795,null));}; \ No newline at end of file +var _0xeec6=['hasOwnProperty','getAnyConditions','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','reject','update','then','destroy','get','Triggers','UserProfileResource','stack','name','send','map','Trigger','rawAttributes','type','model','filters','intersection','query','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','Condition','addAnyCondition','TriggerAnyId','findOne','getAllConditions'];(function(_0x45dbf2,_0x3bee92){var _0x24e8de=function(_0x51d47e){while(--_0x51d47e){_0x45dbf2['push'](_0x45dbf2['shift']());}};_0x24e8de(++_0x3bee92);}(_0xeec6,0x1c2));var _0x6eec=function(_0x570c8a,_0x4a11cc){_0x570c8a=_0x570c8a-0x0;var _0x25dc12=_0xeec6[_0x570c8a];return _0x25dc12;};'use strict';var pdf=require(_0x6eec('0x0'));var emlformat=require(_0x6eec('0x1'));var rimraf=require(_0x6eec('0x2'));var zipdir=require(_0x6eec('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6eec('0x4'));var moment=require(_0x6eec('0x5'));var BPromise=require(_0x6eec('0x6'));var Mustache=require(_0x6eec('0x7'));var util=require(_0x6eec('0x8'));var path=require(_0x6eec('0x9'));var sox=require('sox');var csv=require(_0x6eec('0xa'));var ejs=require(_0x6eec('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6eec('0xc'));var crypto=require(_0x6eec('0xd'));var jsforce=require(_0x6eec('0xe'));var deskjs=require(_0x6eec('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6eec('0x10'));var Papa=require(_0x6eec('0x11'));var Redis=require(_0x6eec('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6eec('0x13'));var logger=require(_0x6eec('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x6eec('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6eec('0x16'))['db'];function respondWithStatusCode(_0x3387c2,_0x162db1){_0x162db1=_0x162db1||0xcc;return function(_0x3fe94b){if(_0x3fe94b){return _0x3387c2[_0x6eec('0x17')](_0x162db1);}return _0x3387c2['status'](_0x162db1)[_0x6eec('0x18')]();};}function respondWithResult(_0x3b2972,_0x462dbb){_0x462dbb=_0x462dbb||0xc8;return function(_0xc35914){if(_0xc35914){return _0x3b2972[_0x6eec('0x19')](_0x462dbb)[_0x6eec('0x1a')](_0xc35914);}};}function respondWithFilteredResult(_0x345852,_0x393271){return function(_0x34a7fc){if(_0x34a7fc){var _0x2ac797=_0x34a7fc[_0x6eec('0x1b')],_0x5e2a9b=_0x393271[_0x6eec('0x1c')],_0x3c0c1b=_0x393271['offset']+_0x393271[_0x6eec('0x1d')],_0x5f1f33;if(_0x3c0c1b>=_0x2ac797){_0x3c0c1b=_0x2ac797;_0x5f1f33=0xc8;}else{_0x5f1f33=0xce;}_0x345852[_0x6eec('0x19')](_0x5f1f33);return _0x345852[_0x6eec('0x1e')]('Content-Range',_0x5e2a9b+'-'+_0x3c0c1b+'/'+_0x2ac797)[_0x6eec('0x1a')](_0x34a7fc);}return null;};}function patchUpdates(_0x1ed94c){return function(_0x3c7152){try{jsonpatch[_0x6eec('0x1f')](_0x3c7152,_0x1ed94c,!![]);}catch(_0xd86135){return BPromise[_0x6eec('0x20')](_0xd86135);}return _0x3c7152['save']();};}function saveUpdates(_0x328693,_0x2f843e){return function(_0x132652){if(_0x132652){return _0x132652[_0x6eec('0x21')](_0x328693)[_0x6eec('0x22')](function(_0xcd546f){return _0xcd546f;});}return null;};}function removeEntity(_0x52f941,_0x6e40b3){return function(_0x852d08){if(_0x852d08){return _0x852d08[_0x6eec('0x23')]()[_0x6eec('0x22')](function(){var _0x409b26=_0x852d08[_0x6eec('0x24')]({'plain':!![]});var _0x573249=_0x6eec('0x25');return db[_0x6eec('0x26')][_0x6eec('0x23')]({'where':{'type':_0x573249,'resourceId':_0x409b26['id']}})[_0x6eec('0x22')](function(){return _0x852d08;});})[_0x6eec('0x22')](function(){_0x52f941[_0x6eec('0x19')](0xcc)[_0x6eec('0x18')]();});}};}function handleEntityNotFound(_0x20bed3,_0x316317){return function(_0x58f95c){if(!_0x58f95c){_0x20bed3[_0x6eec('0x17')](0x194);}return _0x58f95c;};}function handleError(_0x44b31c,_0x30eb98){_0x30eb98=_0x30eb98||0x1f4;return function(_0x275fd0){logger['error'](_0x275fd0[_0x6eec('0x27')]);if(_0x275fd0[_0x6eec('0x28')]){delete _0x275fd0['name'];}_0x44b31c['status'](_0x30eb98)[_0x6eec('0x29')](_0x275fd0);};}exports['index']=function(_0x20a130,_0xede270){var _0x3bbdf8={},_0x34bdea={},_0x15e936={'count':0x0,'rows':[]};var _0x372f8f=_[_0x6eec('0x2a')](db[_0x6eec('0x2b')][_0x6eec('0x2c')],function(_0x414f5b){return{'name':_0x414f5b['fieldName'],'type':_0x414f5b[_0x6eec('0x2d')]['key']};});_0x34bdea[_0x6eec('0x2e')]=_[_0x6eec('0x2a')](_0x372f8f,_0x6eec('0x28'));_0x34bdea['query']=_['keys'](_0x20a130['query']);_0x34bdea[_0x6eec('0x2f')]=_[_0x6eec('0x30')](_0x34bdea[_0x6eec('0x2e')],_0x34bdea[_0x6eec('0x31')]);_0x3bbdf8[_0x6eec('0x32')]=_[_0x6eec('0x30')](_0x34bdea[_0x6eec('0x2e')],qs[_0x6eec('0x33')](_0x20a130[_0x6eec('0x31')][_0x6eec('0x33')]));_0x3bbdf8[_0x6eec('0x32')]=_0x3bbdf8[_0x6eec('0x32')]['length']?_0x3bbdf8[_0x6eec('0x32')]:_0x34bdea[_0x6eec('0x2e')];if(!_0x20a130[_0x6eec('0x31')]['hasOwnProperty'](_0x6eec('0x34'))){_0x3bbdf8[_0x6eec('0x1d')]=qs[_0x6eec('0x1d')](_0x20a130[_0x6eec('0x31')][_0x6eec('0x1d')]);_0x3bbdf8[_0x6eec('0x1c')]=qs['offset'](_0x20a130[_0x6eec('0x31')][_0x6eec('0x1c')]);}_0x3bbdf8[_0x6eec('0x35')]=qs['sort'](_0x20a130['query'][_0x6eec('0x36')]);_0x3bbdf8[_0x6eec('0x37')]=qs[_0x6eec('0x2f')](_[_0x6eec('0x38')](_0x20a130[_0x6eec('0x31')],_0x34bdea['filters']),_0x372f8f);if(_0x20a130[_0x6eec('0x31')][_0x6eec('0x39')]){_0x3bbdf8[_0x6eec('0x37')]=_[_0x6eec('0x3a')](_0x3bbdf8[_0x6eec('0x37')],{'$or':_[_0x6eec('0x2a')](_0x372f8f,function(_0x36cfe1){if(_0x36cfe1[_0x6eec('0x2d')]!=='VIRTUAL'){var _0x2f7a75={};_0x2f7a75[_0x36cfe1[_0x6eec('0x28')]]={'$like':'%'+_0x20a130['query']['filter']+'%'};return _0x2f7a75;}})});}_0x3bbdf8=_[_0x6eec('0x3a')]({},_0x3bbdf8,_0x20a130[_0x6eec('0x3b')]);var _0xf056e0={'where':_0x3bbdf8[_0x6eec('0x37')]};return db['Trigger']['count'](_0xf056e0)[_0x6eec('0x22')](function(_0x48fbf6){_0x15e936['count']=_0x48fbf6;if(_0x20a130[_0x6eec('0x31')][_0x6eec('0x3c')]){_0x3bbdf8[_0x6eec('0x3d')]=[{'all':!![]}];}return db[_0x6eec('0x2b')][_0x6eec('0x3e')](_0x3bbdf8);})['then'](function(_0x931bcf){_0x15e936[_0x6eec('0x3f')]=_0x931bcf;return _0x15e936;})['then'](respondWithFilteredResult(_0xede270,_0x3bbdf8))[_0x6eec('0x40')](handleError(_0xede270,null));};exports[_0x6eec('0x41')]=function(_0x5028a2,_0x2d39bf){var _0x44d75d={'raw':![],'where':{'id':_0x5028a2[_0x6eec('0x42')]['id']}},_0x4e3b1e={};_0x4e3b1e[_0x6eec('0x2e')]=_[_0x6eec('0x43')](db[_0x6eec('0x2b')]['rawAttributes']);_0x4e3b1e[_0x6eec('0x31')]=_[_0x6eec('0x43')](_0x5028a2[_0x6eec('0x31')]);_0x4e3b1e[_0x6eec('0x2f')]=_[_0x6eec('0x30')](_0x4e3b1e['model'],_0x4e3b1e['query']);_0x44d75d[_0x6eec('0x32')]=_[_0x6eec('0x30')](_0x4e3b1e[_0x6eec('0x2e')],qs[_0x6eec('0x33')](_0x5028a2[_0x6eec('0x31')]['fields']));_0x44d75d[_0x6eec('0x32')]=_0x44d75d['attributes'][_0x6eec('0x44')]?_0x44d75d[_0x6eec('0x32')]:_0x4e3b1e[_0x6eec('0x2e')];if(_0x5028a2['query'][_0x6eec('0x3c')]){_0x44d75d[_0x6eec('0x3d')]=[{'all':!![]}];}_0x44d75d=_[_0x6eec('0x3a')]({},_0x44d75d,_0x5028a2[_0x6eec('0x3b')]);return db[_0x6eec('0x2b')]['find'](_0x44d75d)[_0x6eec('0x22')](handleEntityNotFound(_0x2d39bf,null))['then'](respondWithResult(_0x2d39bf,null))['catch'](handleError(_0x2d39bf,null));};exports[_0x6eec('0x45')]=function(_0x535d96,_0x245a1b){return db[_0x6eec('0x2b')][_0x6eec('0x45')](_0x535d96['body'],{})['then'](function(_0x6b200d){var _0x142914=_0x535d96[_0x6eec('0x46')][_0x6eec('0x24')]({'plain':!![]});if(!_0x142914)throw new Error(_0x6eec('0x47'));if(_0x142914[_0x6eec('0x48')]===_0x6eec('0x46')){var _0x442bca=_0x6b200d[_0x6eec('0x24')]({'plain':!![]});var _0x2a1545='Triggers';return db['UserProfileSection'][_0x6eec('0x49')]({'where':{'name':_0x2a1545,'userProfileId':_0x142914[_0x6eec('0x4a')]},'raw':!![]})[_0x6eec('0x22')](function(_0x577fb6){if(_0x577fb6&&_0x577fb6[_0x6eec('0x4b')]===0x0){return db[_0x6eec('0x26')][_0x6eec('0x45')]({'name':_0x442bca[_0x6eec('0x28')],'resourceId':_0x442bca['id'],'type':_0x577fb6[_0x6eec('0x28')],'sectionId':_0x577fb6['id']},{})[_0x6eec('0x22')](function(){return _0x6b200d;});}else{return _0x6b200d;}})[_0x6eec('0x40')](function(_0x413de9){logger['error'](_0x6eec('0x4c'),_0x413de9);throw _0x413de9;});}return _0x6b200d;})[_0x6eec('0x22')](respondWithResult(_0x245a1b,0xc9))[_0x6eec('0x40')](handleError(_0x245a1b,null));};exports[_0x6eec('0x21')]=function(_0x490d27,_0x51fd37){if(_0x490d27['body']['id']){delete _0x490d27[_0x6eec('0x4d')]['id'];}return db[_0x6eec('0x2b')][_0x6eec('0x49')]({'where':{'id':_0x490d27[_0x6eec('0x42')]['id']}})['then'](handleEntityNotFound(_0x51fd37,null))['then'](saveUpdates(_0x490d27[_0x6eec('0x4d')],null))[_0x6eec('0x22')](respondWithResult(_0x51fd37,null))[_0x6eec('0x40')](handleError(_0x51fd37,null));};exports['destroy']=function(_0x238605,_0x35f411){return db[_0x6eec('0x2b')][_0x6eec('0x49')]({'where':{'id':_0x238605[_0x6eec('0x42')]['id']}})[_0x6eec('0x22')](handleEntityNotFound(_0x35f411,null))[_0x6eec('0x22')](removeEntity(_0x35f411,null))[_0x6eec('0x40')](handleError(_0x35f411,null));};exports[_0x6eec('0x4e')]=function(_0x4e921a,_0x22cf6c,_0x5e51c9){if(_0x4e921a[_0x6eec('0x4d')]['id']){delete _0x4e921a[_0x6eec('0x4d')]['id'];}return db[_0x6eec('0x2b')][_0x6eec('0x49')]({'where':{'id':_0x4e921a[_0x6eec('0x42')]['id']}})[_0x6eec('0x22')](handleEntityNotFound(_0x22cf6c,null))[_0x6eec('0x22')](function(_0x4cd062){if(_0x4cd062){_0x4e921a[_0x6eec('0x4d')]['TriggerAllId']=_0x4cd062['id'];return db[_0x6eec('0x4f')]['create'](_0x4e921a[_0x6eec('0x4d')]);}})[_0x6eec('0x22')](respondWithResult(_0x22cf6c,null))[_0x6eec('0x40')](handleError(_0x22cf6c,null));};exports[_0x6eec('0x50')]=function(_0x34dda9,_0x27e1ea,_0x8d5f53){if(_0x34dda9[_0x6eec('0x4d')]['id']){delete _0x34dda9[_0x6eec('0x4d')]['id'];}return db[_0x6eec('0x2b')]['find']({'where':{'id':_0x34dda9['params']['id']}})[_0x6eec('0x22')](handleEntityNotFound(_0x27e1ea,null))[_0x6eec('0x22')](function(_0x3e8e21){if(_0x3e8e21){_0x34dda9[_0x6eec('0x4d')][_0x6eec('0x51')]=_0x3e8e21['id'];return db['Condition'][_0x6eec('0x45')](_0x34dda9[_0x6eec('0x4d')]);}})['then'](respondWithResult(_0x27e1ea,null))['catch'](handleError(_0x27e1ea,null));};exports['getAllConditions']=function(_0xaa2a15,_0x3dfd47,_0x4cf859){var _0x1d2baf={};var _0x234c26={};var _0x4ec803;var _0x3b195d;return db[_0x6eec('0x2b')][_0x6eec('0x52')]({'where':{'id':_0xaa2a15[_0x6eec('0x42')]['id']}})['then'](handleEntityNotFound(_0x3dfd47,null))['then'](function(_0x54fcd0){if(_0x54fcd0){_0x4ec803=_0x54fcd0;_0x234c26[_0x6eec('0x2e')]=_[_0x6eec('0x43')](db[_0x6eec('0x4f')][_0x6eec('0x2c')]);_0x234c26[_0x6eec('0x31')]=_[_0x6eec('0x43')](_0xaa2a15[_0x6eec('0x31')]);_0x234c26[_0x6eec('0x2f')]=_[_0x6eec('0x30')](_0x234c26[_0x6eec('0x2e')],_0x234c26[_0x6eec('0x31')]);_0x1d2baf[_0x6eec('0x32')]=_[_0x6eec('0x30')](_0x234c26[_0x6eec('0x2e')],qs[_0x6eec('0x33')](_0xaa2a15[_0x6eec('0x31')]['fields']));_0x1d2baf[_0x6eec('0x32')]=_0x1d2baf[_0x6eec('0x32')]['length']?_0x1d2baf[_0x6eec('0x32')]:_0x234c26[_0x6eec('0x2e')];_0x1d2baf['order']=qs[_0x6eec('0x36')](_0xaa2a15[_0x6eec('0x31')][_0x6eec('0x36')]);_0x1d2baf[_0x6eec('0x37')]=qs['filters'](_[_0x6eec('0x38')](_0xaa2a15[_0x6eec('0x31')],_0x234c26[_0x6eec('0x2f')]));if(_0xaa2a15[_0x6eec('0x31')][_0x6eec('0x39')]){_0x1d2baf[_0x6eec('0x37')]=_['merge'](_0x1d2baf[_0x6eec('0x37')],{'$or':_['map'](_0x1d2baf[_0x6eec('0x32')],function(_0x19927d){var _0x261021={};_0x261021[_0x19927d]={'$like':'%'+_0xaa2a15[_0x6eec('0x31')][_0x6eec('0x39')]+'%'};return _0x261021;})});}_0x1d2baf=_[_0x6eec('0x3a')]({},_0x1d2baf,_0xaa2a15[_0x6eec('0x3b')]);return _0x4ec803[_0x6eec('0x53')](_0x1d2baf);}})[_0x6eec('0x22')](function(_0x5a7aa4){if(_0x5a7aa4){_0x3b195d=_0x5a7aa4[_0x6eec('0x44')];if(!_0xaa2a15[_0x6eec('0x31')][_0x6eec('0x54')]('nolimit')){_0x1d2baf[_0x6eec('0x1d')]=qs[_0x6eec('0x1d')](_0xaa2a15['query'][_0x6eec('0x1d')]);_0x1d2baf[_0x6eec('0x1c')]=qs[_0x6eec('0x1c')](_0xaa2a15[_0x6eec('0x31')][_0x6eec('0x1c')]);}return _0x4ec803['getAllConditions'](_0x1d2baf);}})[_0x6eec('0x22')](function(_0x149e80){if(_0x149e80){return _0x149e80?{'count':_0x3b195d,'rows':_0x149e80}:null;}})[_0x6eec('0x22')](respondWithResult(_0x3dfd47,null))[_0x6eec('0x40')](handleError(_0x3dfd47,null));};exports[_0x6eec('0x55')]=function(_0x56483b,_0x23984a,_0x16e5dd){var _0xe13c68={};var _0x1032f6={};var _0x43c590;var _0x232b3a;return db[_0x6eec('0x2b')][_0x6eec('0x52')]({'where':{'id':_0x56483b['params']['id']}})[_0x6eec('0x22')](handleEntityNotFound(_0x23984a,null))['then'](function(_0x55b7bb){if(_0x55b7bb){_0x43c590=_0x55b7bb;_0x1032f6[_0x6eec('0x2e')]=_[_0x6eec('0x43')](db[_0x6eec('0x4f')]['rawAttributes']);_0x1032f6[_0x6eec('0x31')]=_['keys'](_0x56483b[_0x6eec('0x31')]);_0x1032f6[_0x6eec('0x2f')]=_[_0x6eec('0x30')](_0x1032f6[_0x6eec('0x2e')],_0x1032f6['query']);_0xe13c68['attributes']=_['intersection'](_0x1032f6[_0x6eec('0x2e')],qs[_0x6eec('0x33')](_0x56483b[_0x6eec('0x31')][_0x6eec('0x33')]));_0xe13c68['attributes']=_0xe13c68[_0x6eec('0x32')]['length']?_0xe13c68[_0x6eec('0x32')]:_0x1032f6[_0x6eec('0x2e')];_0xe13c68['order']=qs[_0x6eec('0x36')](_0x56483b[_0x6eec('0x31')][_0x6eec('0x36')]);_0xe13c68[_0x6eec('0x37')]=qs[_0x6eec('0x2f')](_[_0x6eec('0x38')](_0x56483b['query'],_0x1032f6[_0x6eec('0x2f')]));if(_0x56483b['query'][_0x6eec('0x39')]){_0xe13c68[_0x6eec('0x37')]=_['merge'](_0xe13c68[_0x6eec('0x37')],{'$or':_['map'](_0xe13c68[_0x6eec('0x32')],function(_0x1d1683){var _0x8a4166={};_0x8a4166[_0x1d1683]={'$like':'%'+_0x56483b[_0x6eec('0x31')]['filter']+'%'};return _0x8a4166;})});}_0xe13c68=_[_0x6eec('0x3a')]({},_0xe13c68,_0x56483b['options']);return _0x43c590[_0x6eec('0x55')](_0xe13c68);}})[_0x6eec('0x22')](function(_0x51560c){if(_0x51560c){_0x232b3a=_0x51560c[_0x6eec('0x44')];if(!_0x56483b[_0x6eec('0x31')][_0x6eec('0x54')](_0x6eec('0x34'))){_0xe13c68[_0x6eec('0x1d')]=qs['limit'](_0x56483b[_0x6eec('0x31')][_0x6eec('0x1d')]);_0xe13c68[_0x6eec('0x1c')]=qs[_0x6eec('0x1c')](_0x56483b[_0x6eec('0x31')][_0x6eec('0x1c')]);}return _0x43c590['getAnyConditions'](_0xe13c68);}})['then'](function(_0x1d84a4){if(_0x1d84a4){return _0x1d84a4?{'count':_0x232b3a,'rows':_0x1d84a4}:null;}})[_0x6eec('0x22')](respondWithResult(_0x23984a,null))['catch'](handleError(_0x23984a,null));};exports['addAction']=function(_0x398cfe,_0x1b62ba,_0x52b8b4){if(_0x398cfe[_0x6eec('0x4d')]['id']){delete _0x398cfe[_0x6eec('0x4d')]['id'];}return db[_0x6eec('0x2b')]['find']({'where':{'id':_0x398cfe[_0x6eec('0x42')]['id']}})['then'](handleEntityNotFound(_0x1b62ba,null))[_0x6eec('0x22')](function(_0x1c391a){if(_0x1c391a){_0x398cfe['body'][_0x6eec('0x56')]=_0x1c391a['id'];return db[_0x6eec('0x57')][_0x6eec('0x45')](_0x398cfe['body']);}})[_0x6eec('0x22')](respondWithResult(_0x1b62ba,null))[_0x6eec('0x40')](handleError(_0x1b62ba,null));};exports[_0x6eec('0x58')]=function(_0x1bdf2b,_0x10d469,_0x36d9bd){var _0x548889={};var _0x4be9a7={};var _0x3430d4;var _0x9ee3e8;return db[_0x6eec('0x2b')][_0x6eec('0x52')]({'where':{'id':_0x1bdf2b[_0x6eec('0x42')]['id']}})[_0x6eec('0x22')](handleEntityNotFound(_0x10d469,null))[_0x6eec('0x22')](function(_0x292b0b){if(_0x292b0b){_0x3430d4=_0x292b0b;_0x4be9a7[_0x6eec('0x2e')]=_[_0x6eec('0x43')](db[_0x6eec('0x57')]['rawAttributes']);_0x4be9a7[_0x6eec('0x31')]=_[_0x6eec('0x43')](_0x1bdf2b[_0x6eec('0x31')]);_0x4be9a7[_0x6eec('0x2f')]=_[_0x6eec('0x30')](_0x4be9a7[_0x6eec('0x2e')],_0x4be9a7[_0x6eec('0x31')]);_0x548889[_0x6eec('0x32')]=_[_0x6eec('0x30')](_0x4be9a7[_0x6eec('0x2e')],qs[_0x6eec('0x33')](_0x1bdf2b[_0x6eec('0x31')][_0x6eec('0x33')]));_0x548889[_0x6eec('0x32')]=_0x548889[_0x6eec('0x32')]['length']?_0x548889[_0x6eec('0x32')]:_0x4be9a7['model'];_0x548889[_0x6eec('0x35')]=qs[_0x6eec('0x36')](_0x1bdf2b[_0x6eec('0x31')][_0x6eec('0x36')]);_0x548889['where']=qs[_0x6eec('0x2f')](_['pick'](_0x1bdf2b[_0x6eec('0x31')],_0x4be9a7[_0x6eec('0x2f')]));if(_0x1bdf2b[_0x6eec('0x31')][_0x6eec('0x39')]){_0x548889[_0x6eec('0x37')]=_[_0x6eec('0x3a')](_0x548889['where'],{'$or':_[_0x6eec('0x2a')](_0x548889[_0x6eec('0x32')],function(_0x32c56d){var _0xa98e1c={};_0xa98e1c[_0x32c56d]={'$like':'%'+_0x1bdf2b['query']['filter']+'%'};return _0xa98e1c;})});}_0x548889=_[_0x6eec('0x3a')]({},_0x548889,_0x1bdf2b[_0x6eec('0x3b')]);return _0x3430d4['getActions'](_0x548889);}})['then'](function(_0x2d350d){if(_0x2d350d){_0x9ee3e8=_0x2d350d[_0x6eec('0x44')];if(!_0x1bdf2b['query'][_0x6eec('0x54')](_0x6eec('0x34'))){_0x548889['limit']=qs[_0x6eec('0x1d')](_0x1bdf2b[_0x6eec('0x31')][_0x6eec('0x1d')]);_0x548889['offset']=qs['offset'](_0x1bdf2b['query'][_0x6eec('0x1c')]);}return _0x3430d4['getActions'](_0x548889);}})['then'](function(_0x41d777){if(_0x41d777){return _0x41d777?{'count':_0x9ee3e8,'rows':_0x41d777}:null;}})['then'](respondWithResult(_0x10d469,null))[_0x6eec('0x40')](handleError(_0x10d469,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 99608b1..407333e 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 _0x9766=['exports','define','Trigger','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x222371,_0x1793ed){var _0x37f8cf=function(_0x10d559){while(--_0x10d559){_0x222371['push'](_0x222371['shift']());}};_0x37f8cf(++_0x1793ed);}(_0x9766,0x10b));var _0x6976=function(_0x3b96cf,_0x1592f2){_0x3b96cf=_0x3b96cf-0x0;var _0x2e315a=_0x9766[_0x3b96cf];return _0x2e315a;};'use strict';var _=require(_0x6976('0x0'));var util=require(_0x6976('0x1'));var logger=require(_0x6976('0x2'))(_0x6976('0x3'));var moment=require(_0x6976('0x4'));var BPromise=require(_0x6976('0x5'));var rp=require(_0x6976('0x6'));var fs=require('fs');var path=require(_0x6976('0x7'));var rimraf=require('rimraf');var config=require(_0x6976('0x8'));var attributes=require('./trigger.attributes');module[_0x6976('0x9')]=function(_0x561f1b,_0x4ca417){return _0x561f1b[_0x6976('0xa')](_0x6976('0xb'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ebb=['bluebird','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ebb,0x75));var _0xb1eb=function(_0x16d820,_0x349acc){_0x16d820=_0x16d820-0x0;var _0x483b84=_0x1ebb[_0x16d820];return _0x483b84;};'use strict';var _=require('lodash');var util=require(_0xb1eb('0x0'));var logger=require(_0xb1eb('0x1'))(_0xb1eb('0x2'));var moment=require(_0xb1eb('0x3'));var BPromise=require(_0xb1eb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb1eb('0x5'));var attributes=require(_0xb1eb('0x6'));module[_0xb1eb('0x7')]=function(_0x1b66e4,_0x5026b4){return _0x1b66e4[_0xb1eb('0x8')](_0xb1eb('0x9'),attributes,{'tableName':_0xb1eb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index cc8c459..829e583 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 _0x282b=['map','model','ShowTrigger','Trigger','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Trigger,\x20%s,\x20%s','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetTrigger','findAll','options','raw','where','attributes','include'];(function(_0x59f271,_0x11196a){var _0xc66ca3=function(_0x48db05){while(--_0x48db05){_0x59f271['push'](_0x59f271['shift']());}};_0xc66ca3(++_0x11196a);}(_0x282b,0xec));var _0xb282=function(_0x458240,_0x3e5664){_0x458240=_0x458240-0x0;var _0xf6ad29=_0x282b[_0x458240];return _0xf6ad29;};'use strict';var _=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var moment=require(_0xb282('0x2'));var BPromise=require(_0xb282('0x3'));var rs=require(_0xb282('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb282('0x5'));var logger=require('../../config/logger')(_0xb282('0x6'));var config=require(_0xb282('0x7'));var jayson=require(_0xb282('0x8'));var client=jayson[_0xb282('0x9')][_0xb282('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33635f,_0x4f0410,_0x4a0d28){return new BPromise(function(_0x17fba1,_0x436eaa){return client['request'](_0x33635f,_0x4a0d28)[_0xb282('0xb')](function(_0x20f517){logger[_0xb282('0xc')](_0xb282('0xd'),_0x4f0410,'request\x20sent');logger['debug'](_0xb282('0xe'),_0x4f0410,_0xb282('0xf'),JSON[_0xb282('0x10')](_0x20f517));if(_0x20f517[_0xb282('0x11')]){if(_0x20f517[_0xb282('0x11')]['code']===0x1f4){logger['error'](_0xb282('0xd'),_0x4f0410,_0x20f517[_0xb282('0x11')][_0xb282('0x12')]);return _0x436eaa(_0x20f517[_0xb282('0x11')][_0xb282('0x12')]);}logger['error'](_0xb282('0xd'),_0x4f0410,_0x20f517['error'][_0xb282('0x12')]);return _0x17fba1(_0x20f517[_0xb282('0x11')]['message']);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x4f0410,_0xb282('0xf'));_0x17fba1(_0x20f517[_0xb282('0x13')][_0xb282('0x12')]);}})[_0xb282('0x14')](function(_0x438a05){logger['error'](_0xb282('0xd'),_0x4f0410,_0x438a05);_0x436eaa(_0x438a05);});});}exports[_0xb282('0x15')]=function(_0xca5f12){var _0x45b070=this;return new Promise(function(_0x3f8a3f,_0x492d20){return db['Trigger'][_0xb282('0x16')]({'raw':_0xca5f12[_0xb282('0x17')]?_0xca5f12['options'][_0xb282('0x18')]===undefined?!![]:![]:!![],'where':_0xca5f12[_0xb282('0x17')]?_0xca5f12[_0xb282('0x17')][_0xb282('0x19')]||null:null,'attributes':_0xca5f12[_0xb282('0x17')]?_0xca5f12['options'][_0xb282('0x1a')]||null:null,'limit':_0xca5f12[_0xb282('0x17')]?_0xca5f12[_0xb282('0x17')]['limit']||null:null,'include':_0xca5f12[_0xb282('0x17')]?_0xca5f12[_0xb282('0x17')][_0xb282('0x1b')]?_[_0xb282('0x1c')](_0xca5f12[_0xb282('0x17')]['include'],function(_0x4d624f){return{'model':db[_0x4d624f[_0xb282('0x1d')]],'as':_0x4d624f['as'],'attributes':_0x4d624f[_0xb282('0x1a')],'include':_0x4d624f['include']?_['map'](_0x4d624f[_0xb282('0x1b')],function(_0x114f77){return{'model':db[_0x114f77[_0xb282('0x1d')]],'as':_0x114f77['as'],'attributes':_0x114f77[_0xb282('0x1a')],'include':_0x114f77[_0xb282('0x1b')]?_[_0xb282('0x1c')](_0x114f77['include'],function(_0xa0d7fb){return{'model':db[_0xa0d7fb[_0xb282('0x1d')]],'as':_0xa0d7fb['as'],'attributes':_0xa0d7fb['attributes']};}):[]};}):[]};}):[]:[]})[_0xb282('0xb')](function(_0x38a1f8){logger[_0xb282('0xc')](_0xb282('0x15'),_0xca5f12);logger['debug'](_0xb282('0x15'),_0xca5f12,JSON[_0xb282('0x10')](_0x38a1f8));_0x3f8a3f(_0x38a1f8);})[_0xb282('0x14')](function(_0x433ad5){logger[_0xb282('0x11')](_0xb282('0x15'),_0x433ad5[_0xb282('0x12')],_0xca5f12);_0x492d20(_0x45b070['error'](0x1f4,_0x433ad5[_0xb282('0x12')]));});});};exports[_0xb282('0x1e')]=function(_0x3eb294){var _0xd8780b=this;return new Promise(function(_0x42ef75,_0x5f3ddf){return db[_0xb282('0x1f')]['find']({'raw':_0x3eb294[_0xb282('0x17')]?_0x3eb294[_0xb282('0x17')][_0xb282('0x18')]===undefined?!![]:![]:!![],'where':_0x3eb294['options']?_0x3eb294[_0xb282('0x17')]['where']||null:null,'attributes':_0x3eb294[_0xb282('0x17')]?_0x3eb294[_0xb282('0x17')][_0xb282('0x1a')]||null:null,'include':_0x3eb294[_0xb282('0x17')]?_0x3eb294[_0xb282('0x17')][_0xb282('0x1b')]?_['map'](_0x3eb294[_0xb282('0x17')][_0xb282('0x1b')],function(_0x4ede9d){return{'model':db[_0x4ede9d['model']],'as':_0x4ede9d['as'],'attributes':_0x4ede9d[_0xb282('0x1a')],'include':_0x4ede9d[_0xb282('0x1b')]?_[_0xb282('0x1c')](_0x4ede9d['include'],function(_0x4a76ce){return{'model':db[_0x4a76ce['model']],'as':_0x4a76ce['as'],'attributes':_0x4a76ce[_0xb282('0x1a')],'include':_0x4a76ce[_0xb282('0x1b')]?_[_0xb282('0x1c')](_0x4a76ce[_0xb282('0x1b')],function(_0x17c1e4){return{'model':db[_0x17c1e4[_0xb282('0x1d')]],'as':_0x17c1e4['as'],'attributes':_0x17c1e4[_0xb282('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dc171){logger['info'](_0xb282('0x1e'),_0x3eb294);logger[_0xb282('0x20')](_0xb282('0x1e'),_0x3eb294,JSON['stringify'](_0x3dc171));_0x42ef75(_0x3dc171);})[_0xb282('0x14')](function(_0x4beef2){logger[_0xb282('0x11')](_0xb282('0x1e'),_0x4beef2[_0xb282('0x12')],_0x3eb294);_0x5f3ddf(_0xd8780b[_0xb282('0x11')](0x1f4,_0x4beef2['message']));});});}; \ No newline at end of file +var _0x757a=['stringify','error','message','result','catch','GetTrigger','Trigger','findAll','options','where','attributes','limit','include','map','model','ShowTrigger','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s'];(function(_0x27aca4,_0x49e150){var _0x304e23=function(_0x5e3852){while(--_0x5e3852){_0x27aca4['push'](_0x27aca4['shift']());}};_0x304e23(++_0x49e150);}(_0x757a,0xde));var _0xa757=function(_0x5f08f0,_0x54def9){_0x5f08f0=_0x5f08f0-0x0;var _0x1b0599=_0x757a[_0x5f08f0];return _0x1b0599;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('Trigger,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetTrigger',_0x4d9f58);logger['debug']('GetTrigger',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetTrigger',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 5ab9879..88a1768 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 _0x34e8=['create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','show','post','/:id/clone','clone'];(function(_0xfbe13,_0x3be551){var _0x283b82=function(_0x26e74d){while(--_0x26e74d){_0xfbe13['push'](_0xfbe13['shift']());}};_0x283b82(++_0x3be551);}(_0x34e8,0x12c));var _0x834e=function(_0xb73709,_0x57d47a){_0xb73709=_0xb73709-0x0;var _0xbcec52=_0x34e8[_0xb73709];return _0xbcec52;};'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 auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/:id',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0xc')](_0x834e('0xd'),auth[_0x834e('0xa')](),controller[_0x834e('0xe')]);router[_0x834e('0xc')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0x10')](_0x834e('0x11'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0x11'),auth[_0x834e('0xa')](),controller[_0x834e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xbd50=['show','clone','post','create','put','update','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated'];(function(_0x133296,_0xe8ff9a){var _0x193517=function(_0x161ffd){while(--_0x161ffd){_0x133296['push'](_0x133296['shift']());}};_0x193517(++_0xe8ff9a);}(_0xbd50,0x196));var _0x0bd5=function(_0x16eb47,_0xf8f797){_0x16eb47=_0x16eb47-0x0;var _0x1d4d94=_0xbd50[_0x16eb47];return _0x1d4d94;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var auth=require(_0x0bd5('0x5'));var interaction=require(_0x0bd5('0x6'));var config=require(_0x0bd5('0x7'));var controller=require('./trunk.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0bd5('0x8')]);router[_0x0bd5('0x9')](_0x0bd5('0xa'),auth[_0x0bd5('0xb')](),controller[_0x0bd5('0xc')]);router['post']('/:id/clone',auth[_0x0bd5('0xb')](),controller[_0x0bd5('0xd')]);router[_0x0bd5('0xe')]('/',auth['isAuthenticated'](),controller[_0x0bd5('0xf')]);router[_0x0bd5('0x10')]('/:id',auth[_0x0bd5('0xb')](),controller[_0x0bd5('0x11')]);router['delete'](_0x0bd5('0xa'),auth[_0x0bd5('0xb')](),controller[_0x0bd5('0x12')]);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 7128c0a..f8a0a3d 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 _0xf50c=['PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','STRING','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','ENUM','yes','nonat','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','refuse','originate','uas','fingerprint','actpass','dynamic','update','update,nonat','BOOLEAN','sequelize','exports','name','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED'];(function(_0x2a5042,_0x307d04){var _0x4bc22f=function(_0x2ef928){while(--_0x2ef928){_0x2a5042['push'](_0x2a5042['shift']());}};_0x4bc22f(++_0x307d04);}(_0xf50c,0x12d));var _0xcf50=function(_0x9e9322,_0x3e4dbb){_0x9e9322=_0x9e9322-0x0;var _0x46061f=_0xf50c[_0x9e9322];return _0x46061f;};'use strict';var Sequelize=require(_0xcf50('0x0'));module[_0xcf50('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcf50('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xcf50('0x3'),_0xcf50('0x4'),_0xcf50('0x5')),'allowNull':![],'defaultValue':_0xcf50('0x3')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM'](_0xcf50('0x6'),_0xcf50('0x7'),_0xcf50('0x8'),_0xcf50('0x9'),_0xcf50('0xa'),_0xcf50('0xb'),_0xcf50('0xc'),_0xcf50('0xd'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0xcf50('0xe')]},'secret':{'type':Sequelize[_0xcf50('0xe')]},'md5secret':{'type':Sequelize[_0xcf50('0xe')]},'remotesecret':{'type':Sequelize[_0xcf50('0xe')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xcf50('0xf'),'set':function(_0x565657){this[_0xcf50('0x10')](_0xcf50('0x11'),_0x565657?_0x565657[_0xcf50('0x12')](','):null);},'get':function(){return this[_0xcf50('0x13')](_0xcf50('0x11'))?this[_0xcf50('0x13')]('transport')[_0xcf50('0x14')](','):null;},'comment':_0xcf50('0x15')},'dtmfmode':{'type':Sequelize['ENUM'](_0xcf50('0x16'),'info',_0xcf50('0x17'),_0xcf50('0x18'),_0xcf50('0x19')),'defaultValue':_0xcf50('0x16')},'directmedia':{'type':Sequelize[_0xcf50('0x1a')](_0xcf50('0x1b'),'no',_0xcf50('0x1c'),'update',_0xcf50('0x1d')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xcf50('0x1b'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xcf50('0xe')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xcf50('0x1e'),'set':function(_0x38b4f8){this[_0xcf50('0x10')](_0xcf50('0x1f'),_0x38b4f8?_0x38b4f8['join'](','):null);},'get':function(){return this['getDataValue'](_0xcf50('0x1f'))?this['getDataValue'](_0xcf50('0x1f'))['split'](','):null;},'comment':_0xcf50('0x20')},'callgroup':{'type':Sequelize[_0xcf50('0xe')]},'namedcallgroup':{'type':Sequelize[_0xcf50('0xe')]},'pickupgroup':{'type':Sequelize[_0xcf50('0xe')]},'namedpickupgroup':{'type':Sequelize[_0xcf50('0xe')]},'language':{'type':Sequelize[_0xcf50('0xe')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xcf50('0xe')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xcf50('0xe')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xcf50('0xe')],'allowNull':![],'defaultValue':_0xcf50('0x21'),'set':function(_0x3f3370){this[_0xcf50('0x10')](_0xcf50('0x22'),_0x3f3370?_0x3f3370[_0xcf50('0x12')](';'):_0xcf50('0x21'));},'get':function(){return this[_0xcf50('0x13')](_0xcf50('0x22'))?this[_0xcf50('0x13')](_0xcf50('0x22'))['split'](';'):null;},'comment':_0xcf50('0x23')},'autoframing':{'type':Sequelize[_0xcf50('0x1a')](_0xcf50('0x1b'),'no')},'insecure':{'type':Sequelize[_0xcf50('0xe')],'defaultValue':_0xcf50('0x24'),'set':function(_0x40d3b8){this[_0xcf50('0x10')](_0xcf50('0x25'),_0x40d3b8?_0x40d3b8[_0xcf50('0x12')](','):null);},'get':function(){return this[_0xcf50('0x13')](_0xcf50('0x25'))?this[_0xcf50('0x13')](_0xcf50('0x25'))['split'](','):null;},'comment':_0xcf50('0x26')},'trustrpid':{'type':Sequelize[_0xcf50('0x1a')](_0xcf50('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xcf50('0x1a')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xcf50('0x1b'),'no',_0xcf50('0x27'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0xcf50('0x1a')]('yes','no')},'accountcode':{'type':Sequelize[_0xcf50('0x28')](0xb)},'setvar':{'type':Sequelize[_0xcf50('0xe')]},'callerid':{'type':Sequelize[_0xcf50('0xe')],'defaultValue':_0xcf50('0x29')},'amaflags':{'type':Sequelize[_0xcf50('0xe')]},'callcounter':{'type':Sequelize['ENUM'](_0xcf50('0x1b'),'no'),'defaultValue':_0xcf50('0x1b')},'busylevel':{'type':Sequelize[_0xcf50('0x28')](0xb)},'allowoverlap':{'type':Sequelize[_0xcf50('0x1a')](_0xcf50('0x1b'),'no')},'allowsubscribe':{'type':Sequelize[_0xcf50('0x1a')](_0xcf50('0x1b'),'no')},'allowtransfer':{'type':Sequelize[_0xcf50('0x1a')]('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xcf50('0x1b'),'no')},'subscribecontext':{'type':Sequelize[_0xcf50('0xe')]},'template':{'type':Sequelize[_0xcf50('0xe')]},'videosupport':{'type':Sequelize[_0xcf50('0x1a')](_0xcf50('0x1b'),'no',_0xcf50('0x2a')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xcf50('0x28')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize[_0xcf50('0xe')]},'session_timers':{'type':Sequelize[_0xcf50('0x1a')]('accept',_0xcf50('0x2b'),_0xcf50('0x2c'))},'session_expires':{'type':Sequelize[_0xcf50('0x28')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xcf50('0x1a')]('uac',_0xcf50('0x2d')),'defaultValue':_0xcf50('0x2d')},'t38pt_usertpsource':{'type':Sequelize[_0xcf50('0xe')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xcf50('0x1a')]('yes','no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xcf50('0x28')](0xb)},'defaultip':{'type':Sequelize[_0xcf50('0xe')]},'defaultuser':{'type':Sequelize[_0xcf50('0xe')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xcf50('0x28')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xcf50('0x28')](0xb)},'sendrpid':{'type':Sequelize[_0xcf50('0x1a')](_0xcf50('0x1b'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xcf50('0xe')]},'callbackextension':{'type':Sequelize[_0xcf50('0xe')]},'timert1':{'type':Sequelize[_0xcf50('0x28')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xcf50('0x28')](0xb)},'contactpermit':{'type':Sequelize[_0xcf50('0xe')]},'contactdeny':{'type':Sequelize[_0xcf50('0xe')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xcf50('0xe')]},'use_q850_reason':{'type':Sequelize[_0xcf50('0xe')]},'maxforwards':{'type':Sequelize[_0xcf50('0x28')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xcf50('0x1b'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xcf50('0x1b'),'no')},'force_avp':{'type':Sequelize[_0xcf50('0x1a')](_0xcf50('0x1b'),'no')},'icesupport':{'type':Sequelize[_0xcf50('0x1a')](_0xcf50('0x1b'),'no')},'dtlsenable':{'type':Sequelize[_0xcf50('0x1a')](_0xcf50('0x1b'),'no')},'dtlsverify':{'type':Sequelize[_0xcf50('0x1a')]('yes','no',_0xcf50('0x2e'),'certificate')},'dtlsrekey':{'type':Sequelize[_0xcf50('0x28')](0xb)},'dtlscertfile':{'type':Sequelize[_0xcf50('0xe')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xcf50('0xe')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xcf50('0xe')]},'dtlssetup':{'type':Sequelize[_0xcf50('0x1a')]('active','passive',_0xcf50('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xcf50('0xe')]},'usereqphone':{'type':Sequelize['ENUM'](_0xcf50('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xcf50('0xe')]},'recordofffeature':{'type':Sequelize[_0xcf50('0xe')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xcf50('0x1a')](_0xcf50('0x1b'),'no')},'subscribemwi':{'type':Sequelize[_0xcf50('0x1a')](_0xcf50('0x1b'),'no')},'vmexten':{'type':Sequelize[_0xcf50('0xe')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0xcf50('0xe')]},'parkinglot':{'type':Sequelize[_0xcf50('0xe')]},'description':{'type':Sequelize[_0xcf50('0xe')]},'host':{'type':Sequelize[_0xcf50('0xe')],'defaultValue':_0xcf50('0x30')},'canreinvite':{'type':Sequelize[_0xcf50('0x1a')]('yes','no',_0xcf50('0x1c'),_0xcf50('0x31'),_0xcf50('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xcf50('0xe')]},'otherFields':{'type':Sequelize[_0xcf50('0xe')]},'active':{'type':Sequelize[_0xcf50('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xcf50('0xe')],'defaultValue':'no'}}; \ No newline at end of file +var _0xfc5c=['ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','originate','uas','pai','fingerprint','certificate','active','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','name','friend','user','from-voip-provider','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','STRING','udp','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','ENUM','rfc2833','inband','auto','yes','nonat','update','force_rport,comedia','nat','all','allow'];(function(_0x45c981,_0x2ad2d4){var _0x4f62c8=function(_0x55209b){while(--_0x55209b){_0x45c981['push'](_0x45c981['shift']());}};_0x4f62c8(++_0x2ad2d4);}(_0xfc5c,0x1de));var _0xcfc5=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xfc5c[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0xcfc5('0x0'));module[_0xcfc5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xcfc5('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xcfc5('0x3'),_0xcfc5('0x4'),'peer'),'allowNull':![],'defaultValue':_0xcfc5('0x3')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcfc5('0x5')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED',_0xcfc5('0x6'),_0xcfc5('0x7'),_0xcfc5('0x8'))},'deny':{'type':Sequelize[_0xcfc5('0x9')]},'permit':{'type':Sequelize[_0xcfc5('0x9')]},'secret':{'type':Sequelize[_0xcfc5('0x9')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0xcfc5('0x9')],'defaultValue':_0xcfc5('0xa'),'set':function(_0x828eff){this[_0xcfc5('0xb')]('transport',_0x828eff?_0x828eff[_0xcfc5('0xc')](','):null);},'get':function(){return this[_0xcfc5('0xd')](_0xcfc5('0xe'))?this[_0xcfc5('0xd')](_0xcfc5('0xe'))[_0xcfc5('0xf')](','):null;},'comment':_0xcfc5('0x10')},'dtmfmode':{'type':Sequelize[_0xcfc5('0x11')](_0xcfc5('0x12'),'info','shortinfo',_0xcfc5('0x13'),_0xcfc5('0x14')),'defaultValue':_0xcfc5('0x12')},'directmedia':{'type':Sequelize[_0xcfc5('0x11')](_0xcfc5('0x15'),'no',_0xcfc5('0x16'),_0xcfc5('0x17'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xcfc5('0x9')]},'directmediadeny':{'type':Sequelize[_0xcfc5('0x9')]},'nat':{'type':Sequelize[_0xcfc5('0x9')],'defaultValue':_0xcfc5('0x18'),'set':function(_0x1d5f4e){this[_0xcfc5('0xb')]('nat',_0x1d5f4e?_0x1d5f4e[_0xcfc5('0xc')](','):null);},'get':function(){return this['getDataValue'](_0xcfc5('0x19'))?this[_0xcfc5('0xd')](_0xcfc5('0x19'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xcfc5('0x9')]},'namedcallgroup':{'type':Sequelize[_0xcfc5('0x9')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xcfc5('0x9')]},'language':{'type':Sequelize[_0xcfc5('0x9')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xcfc5('0x9')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xcfc5('0x9')],'defaultValue':_0xcfc5('0x1a')},'allow':{'type':Sequelize[_0xcfc5('0x9')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x457a28){this[_0xcfc5('0xb')](_0xcfc5('0x1b'),_0x457a28?_0x457a28['join'](';'):_0xcfc5('0x1c'));},'get':function(){return this[_0xcfc5('0xd')](_0xcfc5('0x1b'))?this[_0xcfc5('0xd')]('allow')[_0xcfc5('0xf')](';'):null;},'comment':_0xcfc5('0x1d')},'autoframing':{'type':Sequelize['ENUM'](_0xcfc5('0x15'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x42bfe5){this[_0xcfc5('0xb')]('insecure',_0x42bfe5?_0x42bfe5[_0xcfc5('0xc')](','):null);},'get':function(){return this[_0xcfc5('0xd')](_0xcfc5('0x1e'))?this[_0xcfc5('0xd')](_0xcfc5('0x1e'))[_0xcfc5('0xf')](','):null;},'comment':_0xcfc5('0x1f')},'trustrpid':{'type':Sequelize['ENUM'](_0xcfc5('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xcfc5('0x11')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xcfc5('0x11')](_0xcfc5('0x15'),'no','never')},'promiscredir':{'type':Sequelize[_0xcfc5('0x11')](_0xcfc5('0x15'),'no')},'useclientcode':{'type':Sequelize[_0xcfc5('0x11')](_0xcfc5('0x15'),'no')},'accountcode':{'type':Sequelize[_0xcfc5('0x20')](0xb)},'setvar':{'type':Sequelize[_0xcfc5('0x9')]},'callerid':{'type':Sequelize[_0xcfc5('0x9')],'defaultValue':_0xcfc5('0x21')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xcfc5('0x11')]('yes','no'),'defaultValue':_0xcfc5('0x15')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xcfc5('0x15'),'no')},'allowsubscribe':{'type':Sequelize[_0xcfc5('0x11')](_0xcfc5('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0xcfc5('0x11')](_0xcfc5('0x15'),'no')},'ignoresdpversion':{'type':Sequelize[_0xcfc5('0x11')](_0xcfc5('0x15'),'no')},'subscribecontext':{'type':Sequelize[_0xcfc5('0x9')]},'template':{'type':Sequelize[_0xcfc5('0x9')]},'videosupport':{'type':Sequelize[_0xcfc5('0x11')]('yes','no',_0xcfc5('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xcfc5('0x20')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xcfc5('0x11')](_0xcfc5('0x15'),'no')},'mailbox':{'type':Sequelize[_0xcfc5('0x9')]},'session_timers':{'type':Sequelize[_0xcfc5('0x11')](_0xcfc5('0x23'),'refuse',_0xcfc5('0x24'))},'session_expires':{'type':Sequelize[_0xcfc5('0x20')](0xb)},'session_minse':{'type':Sequelize[_0xcfc5('0x20')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac',_0xcfc5('0x25')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xcfc5('0x9')]},'regexten':{'type':Sequelize[_0xcfc5('0x9')]},'fromdomain':{'type':Sequelize[_0xcfc5('0x9')]},'fromuser':{'type':Sequelize[_0xcfc5('0x9')]},'port':{'type':Sequelize[_0xcfc5('0x20')](0x5)},'qualify':{'type':Sequelize[_0xcfc5('0x11')](_0xcfc5('0x15'),'no'),'defaultValue':_0xcfc5('0x15')},'keepalive':{'type':Sequelize[_0xcfc5('0x20')](0xb)},'defaultip':{'type':Sequelize[_0xcfc5('0x9')]},'defaultuser':{'type':Sequelize[_0xcfc5('0x9')]},'rtptimeout':{'type':Sequelize[_0xcfc5('0x20')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xcfc5('0x20')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xcfc5('0x11')]('yes','no',_0xcfc5('0x26')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xcfc5('0x9')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xcfc5('0x20')](0xb)},'timerb':{'type':Sequelize[_0xcfc5('0x20')](0xb)},'qualifyfreq':{'type':Sequelize[_0xcfc5('0x20')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xcfc5('0x9')]},'contactacl':{'type':Sequelize[_0xcfc5('0x9')]},'unsolicited_mailbox':{'type':Sequelize[_0xcfc5('0x9')]},'use_q850_reason':{'type':Sequelize[_0xcfc5('0x9')]},'maxforwards':{'type':Sequelize[_0xcfc5('0x20')](0xb)},'encryption':{'type':Sequelize[_0xcfc5('0x11')](_0xcfc5('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xcfc5('0x11')](_0xcfc5('0x15'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xcfc5('0x15'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xcfc5('0x15'),'no')},'dtlsenable':{'type':Sequelize[_0xcfc5('0x11')](_0xcfc5('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0xcfc5('0x11')](_0xcfc5('0x15'),'no',_0xcfc5('0x27'),_0xcfc5('0x28'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xcfc5('0x9')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xcfc5('0x9')]},'dtlssetup':{'type':Sequelize[_0xcfc5('0x11')](_0xcfc5('0x29'),'passive',_0xcfc5('0x2a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xcfc5('0x11')](_0xcfc5('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xcfc5('0x9')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xcfc5('0x11')](_0xcfc5('0x15'),'no')},'subscribemwi':{'type':Sequelize[_0xcfc5('0x11')]('yes','no')},'vmexten':{'type':Sequelize[_0xcfc5('0x9')]},'mohinterpret':{'type':Sequelize[_0xcfc5('0x9')]},'mohsuggest':{'type':Sequelize[_0xcfc5('0x9')]},'parkinglot':{'type':Sequelize[_0xcfc5('0x9')]},'description':{'type':Sequelize[_0xcfc5('0x9')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xcfc5('0x2b')},'canreinvite':{'type':Sequelize[_0xcfc5('0x11')](_0xcfc5('0x15'),'no',_0xcfc5('0x16'),_0xcfc5('0x17'),_0xcfc5('0x2c')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xcfc5('0x9')]},'otherFields':{'type':Sequelize[_0xcfc5('0x9')]},'active':{'type':Sequelize[_0xcfc5('0x2d')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 7ffbcbc..e64259e 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 _0x3e49=['then','destroy','Trunks','UserProfileResource','stack','name','send','index','Trunk','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','root','server/files/templates/trunk.ejs','utf8','join','server/files/templates/registry.ejs','render','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','userProfileId','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','count','limit','set','Content-Range','save','update'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3e49,0x183));var _0x93e4=function(_0x44646e,_0x5ee8f1){_0x44646e=_0x44646e-0x0;var _0x507efa=_0x3e49[_0x44646e];return _0x507efa;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x93e4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x93e4('0x1'));var jsonpatch=require(_0x93e4('0x2'));var rp=require(_0x93e4('0x3'));var moment=require('moment');var BPromise=require(_0x93e4('0x4'));var Mustache=require(_0x93e4('0x5'));var util=require(_0x93e4('0x6'));var path=require(_0x93e4('0x7'));var sox=require(_0x93e4('0x8'));var csv=require(_0x93e4('0x9'));var ejs=require(_0x93e4('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x93e4('0xb'));var crypto=require(_0x93e4('0xc'));var jsforce=require(_0x93e4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x93e4('0x9'));var querystring=require(_0x93e4('0xe'));var Papa=require('papaparse');var Redis=require(_0x93e4('0xf'));var authService=require(_0x93e4('0x10'));var qs=require(_0x93e4('0x11'));var as=require(_0x93e4('0x12'));var hardwareService=require(_0x93e4('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x93e4('0x14'));var db=require(_0x93e4('0x15'))['db'];var jayson=require(_0x93e4('0x16'));var client=jayson[_0x93e4('0x17')][_0x93e4('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x5d1653,_0x22f7f4,_0x1f9816,_0x50b848){return new BPromise(function(_0x2be61b,_0x3c2bfd){var _0x41bc08=_0x50b848||client;return _0x41bc08[_0x93e4('0x19')](_0x5d1653,_0x1f9816)['then'](function(_0x2bcc3b){logger[_0x93e4('0x1a')](_0x93e4('0x1b'),_0x22f7f4,'request\x20sent');logger[_0x93e4('0x1c')](_0x93e4('0x1d'),_0x22f7f4,_0x93e4('0x1e'),JSON['stringify'](_0x2bcc3b));if(_0x2bcc3b[_0x93e4('0x1f')]){if(_0x2bcc3b['error'][_0x93e4('0x20')]===0x1f4){logger[_0x93e4('0x1f')](_0x93e4('0x1b'),_0x22f7f4,_0x2bcc3b['error']['message']);return _0x3c2bfd(_0x2bcc3b[_0x93e4('0x1f')]['message']);}logger[_0x93e4('0x1f')]('Trunk,\x20%s,\x20%s',_0x22f7f4,_0x2bcc3b[_0x93e4('0x1f')][_0x93e4('0x21')]);return _0x2be61b(_0x2bcc3b[_0x93e4('0x1f')]['message']);}else{logger[_0x93e4('0x1a')](_0x93e4('0x1b'),_0x22f7f4,_0x93e4('0x1e'));_0x2be61b(_0x2bcc3b[_0x93e4('0x22')][_0x93e4('0x21')]);}})[_0x93e4('0x23')](function(_0x4f1d11){logger['error'](_0x93e4('0x1b'),_0x22f7f4,_0x4f1d11);_0x3c2bfd(_0x4f1d11);});});}function respondWithStatusCode(_0x5b464a,_0x589213){_0x589213=_0x589213||0xcc;return function(_0x474681){if(_0x474681){return _0x5b464a[_0x93e4('0x24')](_0x589213);}return _0x5b464a[_0x93e4('0x25')](_0x589213)[_0x93e4('0x26')]();};}function respondWithResult(_0xcd8a81,_0x42251c){_0x42251c=_0x42251c||0xc8;return function(_0x1ee657){if(_0x1ee657){return _0xcd8a81[_0x93e4('0x25')](_0x42251c)['json'](_0x1ee657);}};}function respondWithFilteredResult(_0x15666f,_0x3ebe74){return function(_0x3f9148){if(_0x3f9148){var _0x39e37b=_0x3f9148[_0x93e4('0x27')],_0x5ce5bb=_0x3ebe74['offset'],_0x4cafac=_0x3ebe74['offset']+_0x3ebe74[_0x93e4('0x28')],_0x143147;if(_0x4cafac>=_0x39e37b){_0x4cafac=_0x39e37b;_0x143147=0xc8;}else{_0x143147=0xce;}_0x15666f['status'](_0x143147);return _0x15666f[_0x93e4('0x29')](_0x93e4('0x2a'),_0x5ce5bb+'-'+_0x4cafac+'/'+_0x39e37b)['json'](_0x3f9148);}return null;};}function patchUpdates(_0x2fe39e){return function(_0x357c50){try{jsonpatch['apply'](_0x357c50,_0x2fe39e,!![]);}catch(_0x4ac680){return BPromise['reject'](_0x4ac680);}return _0x357c50[_0x93e4('0x2b')]();};}function saveUpdates(_0x43ff6d,_0x22ef86){return function(_0x4ca94b){if(_0x4ca94b){return _0x4ca94b[_0x93e4('0x2c')](_0x43ff6d)[_0x93e4('0x2d')](function(_0xfbf885){return _0xfbf885;});}return null;};}function removeEntity(_0xbdeb6a,_0xd39a35){return function(_0x2e4643){if(_0x2e4643){return _0x2e4643[_0x93e4('0x2e')]()[_0x93e4('0x2d')](function(){var _0x21726b=_0x2e4643['get']({'plain':!![]});var _0x219a96=_0x93e4('0x2f');return db[_0x93e4('0x30')]['destroy']({'where':{'type':_0x219a96,'resourceId':_0x21726b['id']}})[_0x93e4('0x2d')](function(){return _0x2e4643;});})[_0x93e4('0x2d')](function(){_0xbdeb6a[_0x93e4('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15b11f,_0x1823c0){return function(_0x54bdff){if(!_0x54bdff){_0x15b11f[_0x93e4('0x24')](0x194);}return _0x54bdff;};}function handleError(_0x2898ec,_0x268ea5){_0x268ea5=_0x268ea5||0x1f4;return function(_0x43b993){logger[_0x93e4('0x1f')](_0x43b993[_0x93e4('0x31')]);if(_0x43b993[_0x93e4('0x32')]){delete _0x43b993['name'];}_0x2898ec['status'](_0x268ea5)[_0x93e4('0x33')](_0x43b993);};}exports[_0x93e4('0x34')]=function(_0x930736,_0x30c409){var _0x5db179={},_0x3bfd84={},_0x6e4b4c={'count':0x0,'rows':[]};var _0x2ddbb7=_['map'](db[_0x93e4('0x35')]['rawAttributes'],function(_0x5a4006){return{'name':_0x5a4006[_0x93e4('0x36')],'type':_0x5a4006[_0x93e4('0x37')][_0x93e4('0x38')]};});_0x3bfd84[_0x93e4('0x39')]=_[_0x93e4('0x3a')](_0x2ddbb7,_0x93e4('0x32'));_0x3bfd84[_0x93e4('0x3b')]=_[_0x93e4('0x3c')](_0x930736[_0x93e4('0x3b')]);_0x3bfd84['filters']=_[_0x93e4('0x3d')](_0x3bfd84[_0x93e4('0x39')],_0x3bfd84[_0x93e4('0x3b')]);_0x5db179['attributes']=_['intersection'](_0x3bfd84['model'],qs[_0x93e4('0x3e')](_0x930736['query'][_0x93e4('0x3e')]));_0x5db179['attributes']=_0x5db179[_0x93e4('0x3f')][_0x93e4('0x40')]?_0x5db179[_0x93e4('0x3f')]:_0x3bfd84[_0x93e4('0x39')];if(!_0x930736[_0x93e4('0x3b')]['hasOwnProperty']('nolimit')){_0x5db179['limit']=qs[_0x93e4('0x28')](_0x930736[_0x93e4('0x3b')]['limit']);_0x5db179[_0x93e4('0x41')]=qs['offset'](_0x930736['query'][_0x93e4('0x41')]);}_0x5db179[_0x93e4('0x42')]=qs[_0x93e4('0x43')](_0x930736[_0x93e4('0x3b')][_0x93e4('0x43')]);_0x5db179[_0x93e4('0x44')]=qs[_0x93e4('0x45')](_[_0x93e4('0x46')](_0x930736['query'],_0x3bfd84[_0x93e4('0x45')]),_0x2ddbb7);if(_0x930736[_0x93e4('0x3b')][_0x93e4('0x47')]){_0x5db179[_0x93e4('0x44')]=_[_0x93e4('0x48')](_0x5db179['where'],{'$or':_[_0x93e4('0x3a')](_0x2ddbb7,function(_0x355254){if(_0x355254[_0x93e4('0x37')]!==_0x93e4('0x49')){var _0x3c7204={};_0x3c7204[_0x355254['name']]={'$like':'%'+_0x930736[_0x93e4('0x3b')][_0x93e4('0x47')]+'%'};return _0x3c7204;}})});}_0x5db179=_[_0x93e4('0x48')]({},_0x5db179,_0x930736[_0x93e4('0x4a')]);var _0x36d850={'where':_0x5db179[_0x93e4('0x44')]};return db[_0x93e4('0x35')][_0x93e4('0x27')](_0x36d850)[_0x93e4('0x2d')](function(_0x1d6786){_0x6e4b4c[_0x93e4('0x27')]=_0x1d6786;if(_0x930736[_0x93e4('0x3b')][_0x93e4('0x4b')]){_0x5db179[_0x93e4('0x4c')]=[{'all':!![]}];}return db[_0x93e4('0x35')]['findAll'](_0x5db179);})['then'](function(_0x25cf01){_0x6e4b4c[_0x93e4('0x4d')]=_0x25cf01;return _0x6e4b4c;})['then'](respondWithFilteredResult(_0x30c409,_0x5db179))['catch'](handleError(_0x30c409,null));};exports[_0x93e4('0x4e')]=function(_0x2b2b1b,_0x332784){var _0x191e42={'raw':![],'where':{'id':_0x2b2b1b[_0x93e4('0x4f')]['id']}},_0x4d5f15={};_0x4d5f15[_0x93e4('0x39')]=_[_0x93e4('0x3c')](db[_0x93e4('0x35')]['rawAttributes']);_0x4d5f15[_0x93e4('0x3b')]=_[_0x93e4('0x3c')](_0x2b2b1b[_0x93e4('0x3b')]);_0x4d5f15[_0x93e4('0x45')]=_[_0x93e4('0x3d')](_0x4d5f15[_0x93e4('0x39')],_0x4d5f15[_0x93e4('0x3b')]);_0x191e42[_0x93e4('0x3f')]=_[_0x93e4('0x3d')](_0x4d5f15[_0x93e4('0x39')],qs[_0x93e4('0x3e')](_0x2b2b1b[_0x93e4('0x3b')][_0x93e4('0x3e')]));_0x191e42[_0x93e4('0x3f')]=_0x191e42[_0x93e4('0x3f')][_0x93e4('0x40')]?_0x191e42[_0x93e4('0x3f')]:_0x4d5f15[_0x93e4('0x39')];if(_0x2b2b1b['query'][_0x93e4('0x4b')]){_0x191e42[_0x93e4('0x4c')]=[{'all':!![]}];}_0x191e42=_[_0x93e4('0x48')]({},_0x191e42,_0x2b2b1b[_0x93e4('0x4a')]);return db[_0x93e4('0x35')][_0x93e4('0x50')](_0x191e42)[_0x93e4('0x2d')](handleEntityNotFound(_0x332784,null))[_0x93e4('0x2d')](respondWithResult(_0x332784,null))['catch'](handleError(_0x332784,null));};exports['clone']=function(_0x5011cc,_0x2ff565){var _0x5b5406={'where':{'id':_0x5011cc[_0x93e4('0x4f')]['id']}},_0x44e207={};_0x44e207[_0x93e4('0x39')]=_[_0x93e4('0x3c')](db[_0x93e4('0x35')]['rawAttributes']);_0x5b5406['attributes']=_[_0x93e4('0x3d')](_0x44e207[_0x93e4('0x39')],qs[_0x93e4('0x3e')](_0x5011cc[_0x93e4('0x3b')][_0x93e4('0x3e')]));_0x5b5406[_0x93e4('0x3f')]=_0x5b5406[_0x93e4('0x3f')][_0x93e4('0x40')]?_0x5b5406['attributes']:_0x44e207[_0x93e4('0x39')];if(_0x5011cc[_0x93e4('0x3b')][_0x93e4('0x4b')]){_0x5b5406[_0x93e4('0x4c')]=[{'all':!![]}];}_0x5b5406=_[_0x93e4('0x48')]({},_0x5b5406,_0x5011cc['options']);return db[_0x93e4('0x35')][_0x93e4('0x50')](_0x5b5406)[_0x93e4('0x2d')](handleEntityNotFound(_0x2ff565,null))[_0x93e4('0x2d')](function(_0x2f386e){if(_0x2f386e){var _0x50b731=_0x2f386e[_0x93e4('0x51')]({'plain':!![]});_0x50b731=qs[_0x93e4('0x52')](_0x50b731,['id',_0x93e4('0x53'),_0x93e4('0x54')]);_0x5011cc[_0x93e4('0x55')]=_[_0x93e4('0x52')](_0x5011cc[_0x93e4('0x55')],['id',_0x93e4('0x53'),_0x93e4('0x54')]);return db[_0x93e4('0x35')][_0x93e4('0x56')](_[_0x93e4('0x48')](_0x50b731,_0x5011cc['body']),{'include':_0x5011cc[_0x93e4('0x3b')][_0x93e4('0x4b')]?[{'all':!![]}]:undefined})[_0x93e4('0x2d')](function(_0x4da8a3){var _0x4804ad=_0x5011cc[_0x93e4('0x57')][_0x93e4('0x51')]({'plain':!![]});if(!_0x4804ad)throw new Error(_0x93e4('0x58'));if(_0x4804ad['role']==='user'){var _0x4c7eec=_0x4da8a3['get']({'plain':!![]});var _0xc13650=_0x93e4('0x2f');return db[_0x93e4('0x59')]['find']({'where':{'name':_0xc13650,'userProfileId':_0x4804ad['userProfileId']},'raw':!![]})['then'](function(_0x2db77d){if(_0x2db77d&&_0x2db77d[_0x93e4('0x5a')]===0x0){return db[_0x93e4('0x30')]['create']({'name':_0x4c7eec['name'],'resourceId':_0x4c7eec['id'],'type':_0x2db77d[_0x93e4('0x32')],'sectionId':_0x2db77d['id']},{})['then'](function(){return _0x4da8a3;});}else{return _0x4da8a3;}})[_0x93e4('0x23')](function(_0x54c4ff){logger['error'](_0x93e4('0x5b'),_0x54c4ff);throw _0x54c4ff;});}return _0x4da8a3;});}})[_0x93e4('0x2d')](respondWithResult(_0x2ff565,0xc9))[_0x93e4('0x23')](handleError(_0x2ff565,null));};exports['create']=function(_0x5a3c08,_0x402fef,_0xfed0ff){var _0x5a378a;return db['Trunk'][_0x93e4('0x56')](_0x5a3c08[_0x93e4('0x55')],{'raw':!![]})[_0x93e4('0x2d')](function(_0x4e065f){_0x5a378a=_0x4e065f;return db[_0x93e4('0x35')][_0x93e4('0x5c')]({'raw':!![]});})[_0x93e4('0x2d')](function(_0x418f9a){var _0x35082a=fs[_0x93e4('0x5d')](path['join'](config[_0x93e4('0x5e')],_0x93e4('0x5f')),_0x93e4('0x60'));var _0x3c6a2a=fs[_0x93e4('0x5d')](path[_0x93e4('0x61')](config[_0x93e4('0x5e')],_0x93e4('0x62')),'utf8');var _0x134be4=ejs[_0x93e4('0x63')](_0x35082a,{'trunks':_0x418f9a||[]});fs[_0x93e4('0x64')]('/etc/asterisk/sip_xcally_trunks.conf',_0x134be4);if(_0x5a378a[_0x93e4('0x65')]){var _0x17761b=ejs[_0x93e4('0x63')](_0x3c6a2a,{'trunks':_0x418f9a||[]});fs[_0x93e4('0x64')](_0x93e4('0x66'),_0x17761b);}})[_0x93e4('0x2d')](function(){return respondWithRpcPromise(_0x93e4('0x67'),'create',{'module':_0x93e4('0x68')});})[_0x93e4('0x2d')](function(){var _0x514612=_0x5a3c08['user'][_0x93e4('0x51')]({'plain':!![]});if(!_0x514612)throw new Error(_0x93e4('0x58'));if(_0x514612[_0x93e4('0x69')]===_0x93e4('0x57')){var _0x39fb0d=_0x5a378a[_0x93e4('0x51')]({'plain':!![]});return db[_0x93e4('0x59')][_0x93e4('0x50')]({'where':{'name':_0x93e4('0x2f'),'userProfileId':_0x514612[_0x93e4('0x6a')]},'raw':!![]})[_0x93e4('0x2d')](function(_0x2e679e){if(_0x2e679e&&_0x2e679e[_0x93e4('0x5a')]===0x0){return db[_0x93e4('0x30')][_0x93e4('0x56')]({'name':_0x39fb0d[_0x93e4('0x32')],'resourceId':_0x39fb0d['id'],'type':_0x2e679e[_0x93e4('0x32')],'sectionId':_0x2e679e['id']},{})['then'](function(){return _0x5a378a;});}else{return _0x5a378a;}})['catch'](function(_0x4fbdc4){logger[_0x93e4('0x1f')](_0x93e4('0x5b'),_0x4fbdc4);throw _0x4fbdc4;});}return _0x5a378a;})[_0x93e4('0x2d')](respondWithResult(_0x402fef,0xc9))[_0x93e4('0x23')](handleError(_0x402fef,null));};exports[_0x93e4('0x2c')]=function(_0x90000f,_0x392feb,_0x2b53d1){var _0x4ab5c4;return db[_0x93e4('0x35')][_0x93e4('0x50')]({'where':{'id':_0x90000f['params']['id']}})['then'](handleEntityNotFound(_0x392feb,null))[_0x93e4('0x2d')](saveUpdates(_0x90000f[_0x93e4('0x55')],null))[_0x93e4('0x2d')](function(_0x31072a){if(_0x31072a){_0x4ab5c4=_0x31072a;return db[_0x93e4('0x35')][_0x93e4('0x5c')]({'raw':!![]});}})['then'](function(_0x51f16c){if(_0x51f16c){var _0x3d3c03=fs['readFileSync'](path[_0x93e4('0x61')](config[_0x93e4('0x5e')],_0x93e4('0x5f')),_0x93e4('0x60'));var _0x176c29=fs[_0x93e4('0x5d')](path[_0x93e4('0x61')](config[_0x93e4('0x5e')],'server/files/templates/registry.ejs'),'utf8');var _0x97f57c=ejs[_0x93e4('0x63')](_0x3d3c03,{'trunks':_0x51f16c||[]});fs[_0x93e4('0x64')](_0x93e4('0x6b'),_0x97f57c);var _0x5a8e1a=ejs[_0x93e4('0x63')](_0x176c29,{'trunks':_0x51f16c||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x5a8e1a);return respondWithRpcPromise(_0x93e4('0x67'),_0x93e4('0x2c'),{'module':_0x93e4('0x68')});}return null;})[_0x93e4('0x2d')](function(_0x26b3e8){if(_0x26b3e8){return _0x4ab5c4;}})[_0x93e4('0x2d')](respondWithResult(_0x392feb,null))[_0x93e4('0x23')](handleError(_0x392feb,null));};exports[_0x93e4('0x2e')]=function(_0x3dcade,_0x3d09ed,_0x26a2f1){var _0x32c09a;return db[_0x93e4('0x35')][_0x93e4('0x50')]({'where':{'id':_0x3dcade[_0x93e4('0x4f')]['id']}})[_0x93e4('0x2d')](handleEntityNotFound(_0x3d09ed,null))[_0x93e4('0x2d')](removeEntity(_0x3d09ed,null))[_0x93e4('0x2d')](function(){return db[_0x93e4('0x35')][_0x93e4('0x5c')]({'raw':!![]});})[_0x93e4('0x2d')](function(_0x2bf09f){var _0x445c0b=fs[_0x93e4('0x5d')](path['join'](config[_0x93e4('0x5e')],'server/files/templates/trunk.ejs'),_0x93e4('0x60'));var _0x32acbb=fs['readFileSync'](path[_0x93e4('0x61')](config['root'],_0x93e4('0x62')),_0x93e4('0x60'));var _0x1faf09=ejs[_0x93e4('0x63')](_0x445c0b,{'trunks':_0x2bf09f});var _0x195a5a=ejs[_0x93e4('0x63')](_0x32acbb,{'trunks':_0x2bf09f});fs[_0x93e4('0x64')](_0x93e4('0x6b'),_0x1faf09);fs['writeFileSync'](_0x93e4('0x66'),_0x195a5a);return respondWithRpcPromise(_0x93e4('0x67'),_0x93e4('0x2e'),{'module':_0x93e4('0x68')});})[_0x93e4('0x23')](handleError(_0x3d09ed,null));}; \ No newline at end of file +var _0x3284=['params','rawAttributes','includeAll','clone','find','get','omit','updatedAt','body','createdAt','user','userProfileId','autoAssociation','create','findAll','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','render','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','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','jayson/promise','client','http','then','request\x20sent','error','code','Trunk,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','destroy','Trunks','UserProfileResource','stack','name','send','index','map','Trunk','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','merge','filter','options','include','rows','show'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x3284,0xfb));var _0x4328=function(_0x4bdb3a,_0x3fe603){_0x4bdb3a=_0x4bdb3a-0x0;var _0x314ce9=_0x3284[_0x4bdb3a];return _0x314ce9;};'use strict';var pdf=require(_0x4328('0x0'));var emlformat=require(_0x4328('0x1'));var rimraf=require(_0x4328('0x2'));var zipdir=require(_0x4328('0x3'));var jsonpatch=require(_0x4328('0x4'));var rp=require(_0x4328('0x5'));var moment=require(_0x4328('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x4328('0x7'));var util=require(_0x4328('0x8'));var path=require(_0x4328('0x9'));var sox=require(_0x4328('0xa'));var csv=require(_0x4328('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4328('0xc'));var squel=require(_0x4328('0xd'));var crypto=require(_0x4328('0xe'));var jsforce=require(_0x4328('0xf'));var deskjs=require(_0x4328('0x10'));var toCsv=require(_0x4328('0xb'));var querystring=require(_0x4328('0x11'));var Papa=require('papaparse');var Redis=require(_0x4328('0x12'));var authService=require(_0x4328('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4328('0x14'));var hardwareService=require(_0x4328('0x15'));var logger=require(_0x4328('0x16'))(_0x4328('0x17'));var utils=require('../../config/utils');var config=require(_0x4328('0x18'));var licenseUtil=require(_0x4328('0x19'));var db=require(_0x4328('0x1a'))['db'];var jayson=require(_0x4328('0x1b'));var client=jayson[_0x4328('0x1c')][_0x4328('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4d6955,_0x2d6aef,_0x10b99a,_0x8b4e00){return new BPromise(function(_0x221ac4,_0xe4a911){var _0x26647e=_0x8b4e00||client;return _0x26647e['request'](_0x4d6955,_0x10b99a)[_0x4328('0x1e')](function(_0x2fac32){logger['info']('Trunk,\x20%s,\x20%s',_0x2d6aef,'request\x20sent');logger['debug']('Trunk,\x20%s,\x20%s,\x20%s',_0x2d6aef,_0x4328('0x1f'),JSON['stringify'](_0x2fac32));if(_0x2fac32[_0x4328('0x20')]){if(_0x2fac32[_0x4328('0x20')][_0x4328('0x21')]===0x1f4){logger[_0x4328('0x20')](_0x4328('0x22'),_0x2d6aef,_0x2fac32[_0x4328('0x20')]['message']);return _0xe4a911(_0x2fac32[_0x4328('0x20')][_0x4328('0x23')]);}logger[_0x4328('0x20')](_0x4328('0x22'),_0x2d6aef,_0x2fac32['error'][_0x4328('0x23')]);return _0x221ac4(_0x2fac32[_0x4328('0x20')][_0x4328('0x23')]);}else{logger[_0x4328('0x24')]('Trunk,\x20%s,\x20%s',_0x2d6aef,_0x4328('0x1f'));_0x221ac4(_0x2fac32['result'][_0x4328('0x23')]);}})[_0x4328('0x25')](function(_0x56763d){logger[_0x4328('0x20')](_0x4328('0x22'),_0x2d6aef,_0x56763d);_0xe4a911(_0x56763d);});});}function respondWithStatusCode(_0x27c7cd,_0x5f0cf6){_0x5f0cf6=_0x5f0cf6||0xcc;return function(_0x44ae58){if(_0x44ae58){return _0x27c7cd[_0x4328('0x26')](_0x5f0cf6);}return _0x27c7cd[_0x4328('0x27')](_0x5f0cf6)[_0x4328('0x28')]();};}function respondWithResult(_0x40f740,_0x3bb181){_0x3bb181=_0x3bb181||0xc8;return function(_0x41a8a2){if(_0x41a8a2){return _0x40f740['status'](_0x3bb181)[_0x4328('0x29')](_0x41a8a2);}};}function respondWithFilteredResult(_0x92ebf9,_0x10eed2){return function(_0x51a8f7){if(_0x51a8f7){var _0x3f1315=_0x51a8f7[_0x4328('0x2a')],_0x20d947=_0x10eed2[_0x4328('0x2b')],_0x597e6b=_0x10eed2[_0x4328('0x2b')]+_0x10eed2['limit'],_0x1dab50;if(_0x597e6b>=_0x3f1315){_0x597e6b=_0x3f1315;_0x1dab50=0xc8;}else{_0x1dab50=0xce;}_0x92ebf9[_0x4328('0x27')](_0x1dab50);return _0x92ebf9[_0x4328('0x2c')](_0x4328('0x2d'),_0x20d947+'-'+_0x597e6b+'/'+_0x3f1315)[_0x4328('0x29')](_0x51a8f7);}return null;};}function patchUpdates(_0x126ae4){return function(_0x2216ff){try{jsonpatch[_0x4328('0x2e')](_0x2216ff,_0x126ae4,!![]);}catch(_0x53586a){return BPromise['reject'](_0x53586a);}return _0x2216ff[_0x4328('0x2f')]();};}function saveUpdates(_0x1f118,_0x1cd8db){return function(_0x5196a7){if(_0x5196a7){return _0x5196a7[_0x4328('0x30')](_0x1f118)[_0x4328('0x1e')](function(_0x1cc097){return _0x1cc097;});}return null;};}function removeEntity(_0x3dabe8,_0xa359e7){return function(_0x1d6244){if(_0x1d6244){return _0x1d6244[_0x4328('0x31')]()['then'](function(){var _0x4d55dc=_0x1d6244['get']({'plain':!![]});var _0x26c576=_0x4328('0x32');return db[_0x4328('0x33')][_0x4328('0x31')]({'where':{'type':_0x26c576,'resourceId':_0x4d55dc['id']}})[_0x4328('0x1e')](function(){return _0x1d6244;});})[_0x4328('0x1e')](function(){_0x3dabe8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bbc88,_0x2f135f){return function(_0x3c9bf6){if(!_0x3c9bf6){_0x2bbc88['sendStatus'](0x194);}return _0x3c9bf6;};}function handleError(_0x571fc3,_0x1ba330){_0x1ba330=_0x1ba330||0x1f4;return function(_0x4d3648){logger[_0x4328('0x20')](_0x4d3648[_0x4328('0x34')]);if(_0x4d3648[_0x4328('0x35')]){delete _0x4d3648[_0x4328('0x35')];}_0x571fc3[_0x4328('0x27')](_0x1ba330)[_0x4328('0x36')](_0x4d3648);};}exports[_0x4328('0x37')]=function(_0x8cc318,_0x507318){var _0x1388a1={},_0x5123a6={},_0x1f8ce8={'count':0x0,'rows':[]};var _0x1248cb=_[_0x4328('0x38')](db[_0x4328('0x39')]['rawAttributes'],function(_0xf10cc4){return{'name':_0xf10cc4['fieldName'],'type':_0xf10cc4[_0x4328('0x3a')][_0x4328('0x3b')]};});_0x5123a6[_0x4328('0x3c')]=_[_0x4328('0x38')](_0x1248cb,'name');_0x5123a6[_0x4328('0x3d')]=_[_0x4328('0x3e')](_0x8cc318[_0x4328('0x3d')]);_0x5123a6[_0x4328('0x3f')]=_[_0x4328('0x40')](_0x5123a6[_0x4328('0x3c')],_0x5123a6[_0x4328('0x3d')]);_0x1388a1[_0x4328('0x41')]=_[_0x4328('0x40')](_0x5123a6[_0x4328('0x3c')],qs[_0x4328('0x42')](_0x8cc318[_0x4328('0x3d')][_0x4328('0x42')]));_0x1388a1[_0x4328('0x41')]=_0x1388a1[_0x4328('0x41')][_0x4328('0x43')]?_0x1388a1['attributes']:_0x5123a6[_0x4328('0x3c')];if(!_0x8cc318[_0x4328('0x3d')][_0x4328('0x44')](_0x4328('0x45'))){_0x1388a1['limit']=qs[_0x4328('0x46')](_0x8cc318[_0x4328('0x3d')][_0x4328('0x46')]);_0x1388a1[_0x4328('0x2b')]=qs[_0x4328('0x2b')](_0x8cc318[_0x4328('0x3d')][_0x4328('0x2b')]);}_0x1388a1['order']=qs[_0x4328('0x47')](_0x8cc318[_0x4328('0x3d')][_0x4328('0x47')]);_0x1388a1[_0x4328('0x48')]=qs[_0x4328('0x3f')](_['pick'](_0x8cc318[_0x4328('0x3d')],_0x5123a6[_0x4328('0x3f')]),_0x1248cb);if(_0x8cc318[_0x4328('0x3d')]['filter']){_0x1388a1['where']=_[_0x4328('0x49')](_0x1388a1[_0x4328('0x48')],{'$or':_[_0x4328('0x38')](_0x1248cb,function(_0x4c0a67){if(_0x4c0a67[_0x4328('0x3a')]!=='VIRTUAL'){var _0x59a171={};_0x59a171[_0x4c0a67[_0x4328('0x35')]]={'$like':'%'+_0x8cc318[_0x4328('0x3d')][_0x4328('0x4a')]+'%'};return _0x59a171;}})});}_0x1388a1=_['merge']({},_0x1388a1,_0x8cc318[_0x4328('0x4b')]);var _0x38a182={'where':_0x1388a1['where']};return db['Trunk'][_0x4328('0x2a')](_0x38a182)[_0x4328('0x1e')](function(_0x22bfd3){_0x1f8ce8[_0x4328('0x2a')]=_0x22bfd3;if(_0x8cc318[_0x4328('0x3d')]['includeAll']){_0x1388a1[_0x4328('0x4c')]=[{'all':!![]}];}return db[_0x4328('0x39')]['findAll'](_0x1388a1);})[_0x4328('0x1e')](function(_0x4b9ff5){_0x1f8ce8[_0x4328('0x4d')]=_0x4b9ff5;return _0x1f8ce8;})[_0x4328('0x1e')](respondWithFilteredResult(_0x507318,_0x1388a1))['catch'](handleError(_0x507318,null));};exports[_0x4328('0x4e')]=function(_0x443596,_0x3c10a1){var _0x2dc245={'raw':![],'where':{'id':_0x443596[_0x4328('0x4f')]['id']}},_0xd827c0={};_0xd827c0[_0x4328('0x3c')]=_['keys'](db['Trunk'][_0x4328('0x50')]);_0xd827c0['query']=_[_0x4328('0x3e')](_0x443596[_0x4328('0x3d')]);_0xd827c0[_0x4328('0x3f')]=_[_0x4328('0x40')](_0xd827c0[_0x4328('0x3c')],_0xd827c0[_0x4328('0x3d')]);_0x2dc245['attributes']=_[_0x4328('0x40')](_0xd827c0[_0x4328('0x3c')],qs[_0x4328('0x42')](_0x443596[_0x4328('0x3d')][_0x4328('0x42')]));_0x2dc245[_0x4328('0x41')]=_0x2dc245[_0x4328('0x41')][_0x4328('0x43')]?_0x2dc245['attributes']:_0xd827c0[_0x4328('0x3c')];if(_0x443596[_0x4328('0x3d')][_0x4328('0x51')]){_0x2dc245[_0x4328('0x4c')]=[{'all':!![]}];}_0x2dc245=_[_0x4328('0x49')]({},_0x2dc245,_0x443596[_0x4328('0x4b')]);return db['Trunk']['find'](_0x2dc245)['then'](handleEntityNotFound(_0x3c10a1,null))[_0x4328('0x1e')](respondWithResult(_0x3c10a1,null))[_0x4328('0x25')](handleError(_0x3c10a1,null));};exports[_0x4328('0x52')]=function(_0x503528,_0x54aff4){var _0x4d085a={'where':{'id':_0x503528[_0x4328('0x4f')]['id']}},_0x231671={};_0x231671[_0x4328('0x3c')]=_[_0x4328('0x3e')](db[_0x4328('0x39')][_0x4328('0x50')]);_0x4d085a[_0x4328('0x41')]=_[_0x4328('0x40')](_0x231671[_0x4328('0x3c')],qs[_0x4328('0x42')](_0x503528[_0x4328('0x3d')][_0x4328('0x42')]));_0x4d085a['attributes']=_0x4d085a[_0x4328('0x41')]['length']?_0x4d085a['attributes']:_0x231671['model'];if(_0x503528['query'][_0x4328('0x51')]){_0x4d085a[_0x4328('0x4c')]=[{'all':!![]}];}_0x4d085a=_[_0x4328('0x49')]({},_0x4d085a,_0x503528[_0x4328('0x4b')]);return db['Trunk'][_0x4328('0x53')](_0x4d085a)[_0x4328('0x1e')](handleEntityNotFound(_0x54aff4,null))[_0x4328('0x1e')](function(_0x47fcf5){if(_0x47fcf5){var _0x5e7478=_0x47fcf5[_0x4328('0x54')]({'plain':!![]});_0x5e7478=qs[_0x4328('0x55')](_0x5e7478,['id','createdAt',_0x4328('0x56')]);_0x503528[_0x4328('0x57')]=_['omit'](_0x503528[_0x4328('0x57')],['id',_0x4328('0x58'),_0x4328('0x56')]);return db[_0x4328('0x39')]['create'](_[_0x4328('0x49')](_0x5e7478,_0x503528['body']),{'include':_0x503528[_0x4328('0x3d')][_0x4328('0x51')]?[{'all':!![]}]:undefined})[_0x4328('0x1e')](function(_0x3c6893){var _0x2ac891=_0x503528[_0x4328('0x59')]['get']({'plain':!![]});if(!_0x2ac891)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ac891['role']===_0x4328('0x59')){var _0x32d635=_0x3c6893[_0x4328('0x54')]({'plain':!![]});var _0x385958='Trunks';return db['UserProfileSection'][_0x4328('0x53')]({'where':{'name':_0x385958,'userProfileId':_0x2ac891[_0x4328('0x5a')]},'raw':!![]})[_0x4328('0x1e')](function(_0x1eacbc){if(_0x1eacbc&&_0x1eacbc[_0x4328('0x5b')]===0x0){return db[_0x4328('0x33')]['create']({'name':_0x32d635[_0x4328('0x35')],'resourceId':_0x32d635['id'],'type':_0x1eacbc[_0x4328('0x35')],'sectionId':_0x1eacbc['id']},{})[_0x4328('0x1e')](function(){return _0x3c6893;});}else{return _0x3c6893;}})[_0x4328('0x25')](function(_0x16035){logger[_0x4328('0x20')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16035);throw _0x16035;});}return _0x3c6893;});}})[_0x4328('0x1e')](respondWithResult(_0x54aff4,0xc9))[_0x4328('0x25')](handleError(_0x54aff4,null));};exports['create']=function(_0x41b7ae,_0x5416ae,_0x24659c){var _0x5463ed;return db['Trunk'][_0x4328('0x5c')](_0x41b7ae[_0x4328('0x57')],{'raw':!![]})[_0x4328('0x1e')](function(_0x11b915){_0x5463ed=_0x11b915;return db[_0x4328('0x39')][_0x4328('0x5d')]({'raw':!![]});})[_0x4328('0x1e')](function(_0x314aec){var _0x119b5d=fs[_0x4328('0x5e')](path[_0x4328('0x5f')](config[_0x4328('0x60')],_0x4328('0x61')),_0x4328('0x62'));var _0x9511be=fs[_0x4328('0x5e')](path[_0x4328('0x5f')](config[_0x4328('0x60')],_0x4328('0x63')),'utf8');var _0x31184b=ejs['render'](_0x119b5d,{'trunks':_0x314aec||[]});fs[_0x4328('0x64')](_0x4328('0x65'),_0x31184b);if(_0x5463ed[_0x4328('0x66')]){var _0x694c3c=ejs['render'](_0x9511be,{'trunks':_0x314aec||[]});fs[_0x4328('0x64')](_0x4328('0x67'),_0x694c3c);}})['then'](function(){return respondWithRpcPromise('Reload',_0x4328('0x5c'),{'module':_0x4328('0x68')});})[_0x4328('0x1e')](function(){var _0x436c08=_0x41b7ae[_0x4328('0x59')]['get']({'plain':!![]});if(!_0x436c08)throw new Error(_0x4328('0x69'));if(_0x436c08[_0x4328('0x6a')]===_0x4328('0x59')){var _0x207ad5=_0x5463ed['get']({'plain':!![]});return db[_0x4328('0x6b')][_0x4328('0x53')]({'where':{'name':_0x4328('0x32'),'userProfileId':_0x436c08[_0x4328('0x5a')]},'raw':!![]})[_0x4328('0x1e')](function(_0x2acd4b){if(_0x2acd4b&&_0x2acd4b[_0x4328('0x5b')]===0x0){return db[_0x4328('0x33')][_0x4328('0x5c')]({'name':_0x207ad5[_0x4328('0x35')],'resourceId':_0x207ad5['id'],'type':_0x2acd4b[_0x4328('0x35')],'sectionId':_0x2acd4b['id']},{})[_0x4328('0x1e')](function(){return _0x5463ed;});}else{return _0x5463ed;}})[_0x4328('0x25')](function(_0x507a31){logger[_0x4328('0x20')](_0x4328('0x6c'),_0x507a31);throw _0x507a31;});}return _0x5463ed;})[_0x4328('0x1e')](respondWithResult(_0x5416ae,0xc9))['catch'](handleError(_0x5416ae,null));};exports['update']=function(_0x18be5e,_0x12330c,_0x1f5a2c){var _0x26d044;return db['Trunk'][_0x4328('0x53')]({'where':{'id':_0x18be5e['params']['id']}})[_0x4328('0x1e')](handleEntityNotFound(_0x12330c,null))['then'](saveUpdates(_0x18be5e['body'],null))[_0x4328('0x1e')](function(_0x43b2ad){if(_0x43b2ad){_0x26d044=_0x43b2ad;return db[_0x4328('0x39')]['findAll']({'raw':!![]});}})[_0x4328('0x1e')](function(_0x5f4bd5){if(_0x5f4bd5){var _0x41783f=fs[_0x4328('0x5e')](path[_0x4328('0x5f')](config[_0x4328('0x60')],'server/files/templates/trunk.ejs'),'utf8');var _0x37408d=fs[_0x4328('0x5e')](path[_0x4328('0x5f')](config[_0x4328('0x60')],'server/files/templates/registry.ejs'),_0x4328('0x62'));var _0xd6554c=ejs[_0x4328('0x6d')](_0x41783f,{'trunks':_0x5f4bd5||[]});fs[_0x4328('0x64')](_0x4328('0x65'),_0xd6554c);var _0x4e2e9c=ejs['render'](_0x37408d,{'trunks':_0x5f4bd5||[]});fs[_0x4328('0x64')](_0x4328('0x67'),_0x4e2e9c);return respondWithRpcPromise('Reload',_0x4328('0x30'),{'module':_0x4328('0x68')});}return null;})[_0x4328('0x1e')](function(_0x2e8204){if(_0x2e8204){return _0x26d044;}})[_0x4328('0x1e')](respondWithResult(_0x12330c,null))[_0x4328('0x25')](handleError(_0x12330c,null));};exports['destroy']=function(_0x3b36ca,_0x4a0a9a,_0x4268bc){var _0x50c079;return db[_0x4328('0x39')][_0x4328('0x53')]({'where':{'id':_0x3b36ca[_0x4328('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4a0a9a,null))['then'](removeEntity(_0x4a0a9a,null))[_0x4328('0x1e')](function(){return db[_0x4328('0x39')]['findAll']({'raw':!![]});})[_0x4328('0x1e')](function(_0x4b3be7){var _0x2e9ddd=fs[_0x4328('0x5e')](path[_0x4328('0x5f')](config[_0x4328('0x60')],_0x4328('0x61')),'utf8');var _0x7bce40=fs[_0x4328('0x5e')](path[_0x4328('0x5f')](config[_0x4328('0x60')],'server/files/templates/registry.ejs'),_0x4328('0x62'));var _0x2316cd=ejs['render'](_0x2e9ddd,{'trunks':_0x4b3be7});var _0x324483=ejs[_0x4328('0x6d')](_0x7bce40,{'trunks':_0x4b3be7});fs[_0x4328('0x64')]('/etc/asterisk/sip_xcally_trunks.conf',_0x2316cd);fs['writeFileSync'](_0x4328('0x67'),_0x324483);return respondWithRpcPromise('Reload',_0x4328('0x31'),{'module':_0x4328('0x68')});})[_0x4328('0x25')](handleError(_0x4a0a9a,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 1a311bd..d7c3267 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 _0xbcc5=['./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x4b36bd,_0x25a84a){var _0xb4a41f=function(_0x51b264){while(--_0x51b264){_0x4b36bd['push'](_0x4b36bd['shift']());}};_0xb4a41f(++_0x25a84a);}(_0xbcc5,0x1e6));var _0x5bcc=function(_0xb662bc,_0x32d3d9){_0xb662bc=_0xb662bc-0x0;var _0x4efa69=_0xbcc5[_0xb662bc];return _0x4efa69;};'use strict';var _=require(_0x5bcc('0x0'));var util=require('util');var logger=require(_0x5bcc('0x1'))(_0x5bcc('0x2'));var moment=require(_0x5bcc('0x3'));var BPromise=require(_0x5bcc('0x4'));var rp=require(_0x5bcc('0x5'));var fs=require('fs');var path=require(_0x5bcc('0x6'));var rimraf=require('rimraf');var config=require(_0x5bcc('0x7'));var attributes=require(_0x5bcc('0x8'));module[_0x5bcc('0x9')]=function(_0x579467,_0x2a6821){return _0x579467[_0x5bcc('0xa')](_0x5bcc('0xb'),attributes,{'tableName':_0x5bcc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x244f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','define','tools_trunks','util','../../config/logger'];(function(_0x258cef,_0x4f7206){var _0x1039a5=function(_0x335363){while(--_0x335363){_0x258cef['push'](_0x258cef['shift']());}};_0x1039a5(++_0x4f7206);}(_0x244f,0x18a));var _0xf244=function(_0xec180e,_0x36c296){_0xec180e=_0xec180e-0x0;var _0x4a41a7=_0x244f[_0xec180e];return _0x4a41a7;};'use strict';var _=require('lodash');var util=require(_0xf244('0x0'));var logger=require(_0xf244('0x1'))(_0xf244('0x2'));var moment=require(_0xf244('0x3'));var BPromise=require(_0xf244('0x4'));var rp=require(_0xf244('0x5'));var fs=require('fs');var path=require(_0xf244('0x6'));var rimraf=require(_0xf244('0x7'));var config=require(_0xf244('0x8'));var attributes=require(_0xf244('0x9'));module['exports']=function(_0xbfb2df,_0x4d57d5){return _0xbfb2df[_0xf244('0xa')]('Trunk',attributes,{'tableName':_0xf244('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index d734be9..06f826f 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 _0x14a0=['limit','include','model','map','find','ShowTrunk','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','debug','request\x20sent','stringify','error','code','Trunk,\x20%s,\x20%s','message','info','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes'];(function(_0x1fa2ed,_0x3bc5b1){var _0x4fbd07=function(_0x4f14ae){while(--_0x4f14ae){_0x1fa2ed['push'](_0x1fa2ed['shift']());}};_0x4fbd07(++_0x3bc5b1);}(_0x14a0,0x8e));var _0x014a=function(_0x1a71cb,_0x5ca695){_0x1a71cb=_0x1a71cb-0x0;var _0x4fb562=_0x14a0[_0x1a71cb];return _0x4fb562;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var Redis=require(_0x014a('0x4'));var db=require(_0x014a('0x5'))['db'];var utils=require(_0x014a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x014a('0x7'));var jayson=require(_0x014a('0x8'));var client=jayson[_0x014a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a61ac,_0x11b8ce,_0x6d05f2){return new BPromise(function(_0x22f17c,_0x4d943b){return client['request'](_0x5a61ac,_0x6d05f2)[_0x014a('0xa')](function(_0x4f5506){logger['info']('Trunk,\x20%s,\x20%s',_0x11b8ce,'request\x20sent');logger[_0x014a('0xb')]('Trunk,\x20%s,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'),JSON[_0x014a('0xd')](_0x4f5506));if(_0x4f5506['error']){if(_0x4f5506[_0x014a('0xe')][_0x014a('0xf')]===0x1f4){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x4d943b(_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);}logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x4f5506[_0x014a('0xe')][_0x014a('0x11')]);return _0x22f17c(_0x4f5506['error'][_0x014a('0x11')]);}else{logger[_0x014a('0x12')]('Trunk,\x20%s,\x20%s',_0x11b8ce,_0x014a('0xc'));_0x22f17c(_0x4f5506[_0x014a('0x13')]['message']);}})[_0x014a('0x14')](function(_0x17e4be){logger[_0x014a('0xe')](_0x014a('0x10'),_0x11b8ce,_0x17e4be);_0x4d943b(_0x17e4be);});});}exports[_0x014a('0x15')]=function(_0x12d339){var _0x61ec9f=this;return new Promise(function(_0x263b07,_0x16490a){return db[_0x014a('0x16')][_0x014a('0x17')]({'raw':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x19')]===undefined?!![]:![]:!![],'where':_0x12d339['options']?_0x12d339[_0x014a('0x18')][_0x014a('0x1a')]||null:null,'attributes':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x1b')]||null:null,'limit':_0x12d339[_0x014a('0x18')]?_0x12d339[_0x014a('0x18')][_0x014a('0x1c')]||null:null,'include':_0x12d339[_0x014a('0x18')]?_0x12d339['options'][_0x014a('0x1d')]?_['map'](_0x12d339[_0x014a('0x18')][_0x014a('0x1d')],function(_0x44d921){return{'model':db[_0x44d921[_0x014a('0x1e')]],'as':_0x44d921['as'],'attributes':_0x44d921[_0x014a('0x1b')],'include':_0x44d921[_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x44d921[_0x014a('0x1d')],function(_0x165a42){return{'model':db[_0x165a42['model']],'as':_0x165a42['as'],'attributes':_0x165a42[_0x014a('0x1b')],'include':_0x165a42['include']?_[_0x014a('0x1f')](_0x165a42[_0x014a('0x1d')],function(_0x4f1c44){return{'model':db[_0x4f1c44['model']],'as':_0x4f1c44['as'],'attributes':_0x4f1c44[_0x014a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x014a('0xa')](function(_0x143346){logger['info'](_0x014a('0x15'),_0x12d339);logger[_0x014a('0xb')]('GetTrunk',_0x12d339,JSON[_0x014a('0xd')](_0x143346));_0x263b07(_0x143346);})[_0x014a('0x14')](function(_0x496040){logger['error'](_0x014a('0x15'),_0x496040[_0x014a('0x11')],_0x12d339);_0x16490a(_0x61ec9f[_0x014a('0xe')](0x1f4,_0x496040[_0x014a('0x11')]));});});};exports['ShowTrunk']=function(_0x434038){var _0x147e7e=this;return new Promise(function(_0x15af07,_0x402d3b){return db[_0x014a('0x16')][_0x014a('0x20')]({'raw':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x19')]===undefined?!![]:![]:!![],'where':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')]['where']||null:null,'attributes':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x1b')]||null:null,'include':_0x434038[_0x014a('0x18')]?_0x434038[_0x014a('0x18')][_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x434038['options'][_0x014a('0x1d')],function(_0x325b3c){return{'model':db[_0x325b3c['model']],'as':_0x325b3c['as'],'attributes':_0x325b3c[_0x014a('0x1b')],'include':_0x325b3c[_0x014a('0x1d')]?_[_0x014a('0x1f')](_0x325b3c[_0x014a('0x1d')],function(_0x329136){return{'model':db[_0x329136[_0x014a('0x1e')]],'as':_0x329136['as'],'attributes':_0x329136[_0x014a('0x1b')],'include':_0x329136[_0x014a('0x1d')]?_['map'](_0x329136[_0x014a('0x1d')],function(_0x1dfe6e){return{'model':db[_0x1dfe6e[_0x014a('0x1e')]],'as':_0x1dfe6e['as'],'attributes':_0x1dfe6e[_0x014a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x427c7a){logger[_0x014a('0x12')](_0x014a('0x21'),_0x434038);logger[_0x014a('0xb')](_0x014a('0x21'),_0x434038,JSON[_0x014a('0xd')](_0x427c7a));_0x15af07(_0x427c7a);})[_0x014a('0x14')](function(_0x36187b){logger[_0x014a('0xe')]('ShowTrunk',_0x36187b[_0x014a('0x11')],_0x434038);_0x402d3b(_0x147e7e['error'](0x1f4,_0x36187b[_0x014a('0x11')]));});});}; \ No newline at end of file +var _0x1a85=['info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','Trunk','options','raw','where','limit','include','model','map','attributes','then','ShowTrunk','find','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x1a85,0x178));var _0x51a8=function(_0x1abb11,_0xd68915){_0x1abb11=_0x1abb11-0x0;var _0x149a9f=_0x1a85[_0x1abb11];return _0x149a9f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('Trunk,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});}exports[_0x51a8('0x13')]=function(_0x45a433){var _0xd52230=this;return new Promise(function(_0x23539e,_0x3bc1a2){return db[_0x51a8('0x14')]['findAll']({'raw':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x16')]===undefined?!![]:![]:!![],'where':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x17')]||null:null,'attributes':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')]['attributes']||null:null,'limit':_0x45a433[_0x51a8('0x15')]?_0x45a433['options'][_0x51a8('0x18')]||null:null,'include':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x19')]?_['map'](_0x45a433[_0x51a8('0x15')]['include'],function(_0x47f063){return{'model':db[_0x47f063[_0x51a8('0x1a')]],'as':_0x47f063['as'],'attributes':_0x47f063['attributes'],'include':_0x47f063[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x47f063[_0x51a8('0x19')],function(_0x18e2f3){return{'model':db[_0x18e2f3[_0x51a8('0x1a')]],'as':_0x18e2f3['as'],'attributes':_0x18e2f3[_0x51a8('0x1c')],'include':_0x18e2f3[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x18e2f3['include'],function(_0x273ce2){return{'model':db[_0x273ce2[_0x51a8('0x1a')]],'as':_0x273ce2['as'],'attributes':_0x273ce2[_0x51a8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x51a8('0x1d')](function(_0x1c150d){logger[_0x51a8('0x8')](_0x51a8('0x13'),_0x45a433);logger[_0x51a8('0xb')](_0x51a8('0x13'),_0x45a433,JSON[_0x51a8('0xd')](_0x1c150d));_0x23539e(_0x1c150d);})[_0x51a8('0x12')](function(_0x347a02){logger['error'](_0x51a8('0x13'),_0x347a02['message'],_0x45a433);_0x3bc1a2(_0xd52230[_0x51a8('0xe')](0x1f4,_0x347a02[_0x51a8('0x10')]));});});};exports[_0x51a8('0x1e')]=function(_0x41df56){var _0x2136b4=this;return new Promise(function(_0x4ea271,_0x10c19b){return db['Trunk'][_0x51a8('0x1f')]({'raw':_0x41df56[_0x51a8('0x15')]?_0x41df56[_0x51a8('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x41df56[_0x51a8('0x15')]?_0x41df56['options'][_0x51a8('0x17')]||null:null,'attributes':_0x41df56[_0x51a8('0x15')]?_0x41df56[_0x51a8('0x15')][_0x51a8('0x1c')]||null:null,'include':_0x41df56[_0x51a8('0x15')]?_0x41df56['options'][_0x51a8('0x19')]?_['map'](_0x41df56[_0x51a8('0x15')][_0x51a8('0x19')],function(_0x41561a){return{'model':db[_0x41561a['model']],'as':_0x41561a['as'],'attributes':_0x41561a[_0x51a8('0x1c')],'include':_0x41561a[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x41561a[_0x51a8('0x19')],function(_0x41c020){return{'model':db[_0x41c020['model']],'as':_0x41c020['as'],'attributes':_0x41c020['attributes'],'include':_0x41c020['include']?_[_0x51a8('0x1b')](_0x41c020[_0x51a8('0x19')],function(_0x4ec1db){return{'model':db[_0x4ec1db[_0x51a8('0x1a')]],'as':_0x4ec1db['as'],'attributes':_0x4ec1db['attributes']};}):[]};}):[]};}):[]:[]})[_0x51a8('0x1d')](function(_0x38aa25){logger[_0x51a8('0x8')](_0x51a8('0x1e'),_0x41df56);logger[_0x51a8('0xb')](_0x51a8('0x1e'),_0x41df56,JSON['stringify'](_0x38aa25));_0x4ea271(_0x38aa25);})['catch'](function(_0x377b4c){logger['error']('ShowTrunk',_0x377b4c['message'],_0x41df56);_0x10c19b(_0x2136b4[_0x51a8('0xe')](0x1f4,_0x377b4c[_0x51a8('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 5fce969..73580aa 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 _0x0288=['/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addChatWebsites','addWhatsappAccounts','/:id/api_key','createApiKey','put','/:id','update','/:id/password','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','/:id/whatsapp_accounts','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','whoami','/presence','show','/:id/avatar','getAvatar','/:id/contacts','getContacts','getQueues','getVoiceQueuesRt','getGroups','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','post','addContacts','create','bulkCreate','/:id/queues','diskStorage','join','root','server/files/images/','format','%s-%s','now','single','file','addAvatar','/:id/login','login','/:id/logout','/:id/pause','pause','/:id/unpause','unpause','addTeams'];(function(_0x4a7449,_0x1b2dd6){var _0x2a5224=function(_0x3d503c){while(--_0x3d503c){_0x4a7449['push'](_0x4a7449['shift']());}};_0x2a5224(++_0x1b2dd6);}(_0x0288,0x109));var _0x8028=function(_0xbd4254,_0x31c08b){_0xbd4254=_0xbd4254-0x0;var _0x46c0f3=_0x0288[_0xbd4254];return _0x46c0f3;};'use strict';var multer=require(_0x8028('0x0'));var util=require(_0x8028('0x1'));var path=require(_0x8028('0x2'));var timeout=require(_0x8028('0x3'));var express=require(_0x8028('0x4'));var router=express[_0x8028('0x5')]();var auth=require(_0x8028('0x6'));var interaction=require(_0x8028('0x7'));var config=require(_0x8028('0x8'));var controller=require(_0x8028('0x9'));router[_0x8028('0xa')]('/',auth[_0x8028('0xb')](),controller['index']);router['get'](_0x8028('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x8028('0xa')]('/whoami',auth[_0x8028('0xb')](),controller[_0x8028('0xd')]);router[_0x8028('0xa')](_0x8028('0xe'),auth[_0x8028('0xb')](),controller['getPresence']);router[_0x8028('0xa')]('/:id',auth[_0x8028('0xb')](),controller[_0x8028('0xf')]);router[_0x8028('0xa')](_0x8028('0x10'),controller[_0x8028('0x11')]);router['get'](_0x8028('0x12'),auth['isAuthenticated'](),controller[_0x8028('0x13')]);router[_0x8028('0xa')]('/:id/queues',auth[_0x8028('0xb')](),controller[_0x8028('0x14')]);router[_0x8028('0xa')]('/:id/queues_rt',auth[_0x8028('0xb')](),controller[_0x8028('0x15')]);router[_0x8028('0xa')]('/:id/groups',auth[_0x8028('0xb')](),controller[_0x8028('0x16')]);router[_0x8028('0xa')]('/:id/recordings',auth[_0x8028('0xb')](),controller['getRecordings']);router[_0x8028('0xa')](_0x8028('0x17'),auth[_0x8028('0xb')](),controller['getScreenRecordings']);router[_0x8028('0xa')](_0x8028('0x18'),auth['isAuthenticated'](),controller[_0x8028('0x19')]);router['get']('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0x8028('0x1a')]);router[_0x8028('0xa')](_0x8028('0x1b'),auth[_0x8028('0xb')](),controller['getMailInteractions']);router['get'](_0x8028('0x1c'),auth['isAuthenticated'](),controller[_0x8028('0x1d')]);router[_0x8028('0xa')](_0x8028('0x1e'),auth[_0x8028('0xb')](),controller[_0x8028('0x1f')]);router[_0x8028('0xa')](_0x8028('0x20'),auth[_0x8028('0xb')](),controller[_0x8028('0x21')]);router[_0x8028('0xa')](_0x8028('0x22'),auth[_0x8028('0xb')](),controller[_0x8028('0x23')]);router['get'](_0x8028('0x24'),auth[_0x8028('0xb')](),controller[_0x8028('0x25')]);router[_0x8028('0xa')](_0x8028('0x26'),auth[_0x8028('0xb')](),controller['getAgents']);router['get'](_0x8028('0x27'),auth['isAuthenticated'](),controller[_0x8028('0x28')]);router[_0x8028('0xa')](_0x8028('0x29'),auth[_0x8028('0xb')](),controller[_0x8028('0x2a')]);router[_0x8028('0xa')](_0x8028('0x2b'),auth['isAuthenticated'](),controller[_0x8028('0x2c')]);router[_0x8028('0xa')](_0x8028('0x2d'),auth[_0x8028('0xb')](),controller[_0x8028('0x2e')]);router['get'](_0x8028('0x2f'),auth[_0x8028('0xb')](),controller[_0x8028('0x30')]);router[_0x8028('0xa')](_0x8028('0x31'),auth[_0x8028('0xb')](),controller[_0x8028('0x32')]);router[_0x8028('0xa')]('/:id/whatsapp_accounts',auth[_0x8028('0xb')](),controller[_0x8028('0x33')]);router[_0x8028('0xa')](_0x8028('0x34'),auth['isAuthenticated'](),controller[_0x8028('0x35')]);router[_0x8028('0xa')]('/:id/scheduled_calls',auth[_0x8028('0xb')](),controller['getScheduledCalls']);router[_0x8028('0xa')]('/:id/api_key',auth[_0x8028('0xb')](),controller['getApiKey']);router[_0x8028('0x36')]('/:id/contacts',auth[_0x8028('0xb')](),controller[_0x8028('0x37')]);router[_0x8028('0x36')]('/',auth[_0x8028('0xb')](),controller[_0x8028('0x38')]);router[_0x8028('0x36')]('/create_many',auth[_0x8028('0xb')](),controller[_0x8028('0x39')]);router['post'](_0x8028('0x3a'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0x8028('0x3b')]({'destination':function(_0x569f44,_0x2dbfcd,_0x30c6e7){_0x30c6e7(null,path[_0x8028('0x3c')](config[_0x8028('0x3d')],_0x8028('0x3e')));},'filename':function(_0x46bf24,_0x467add,_0x12d4c6){_0x12d4c6(null,util[_0x8028('0x3f')](_0x8028('0x40'),Date[_0x8028('0x41')](),_0x467add['originalname']));}})});router[_0x8028('0x36')](_0x8028('0x10'),upload[_0x8028('0x42')](_0x8028('0x43')),controller[_0x8028('0x44')]);router[_0x8028('0x36')](_0x8028('0x45'),auth[_0x8028('0xb')](),controller[_0x8028('0x46')]);router[_0x8028('0x36')](_0x8028('0x47'),auth[_0x8028('0xb')](),controller['logout']);router['post'](_0x8028('0x48'),auth[_0x8028('0xb')](),controller[_0x8028('0x49')]);router[_0x8028('0x36')](_0x8028('0x4a'),auth['isAuthenticated'](),controller[_0x8028('0x4b')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0x8028('0x4c')]);router[_0x8028('0x36')](_0x8028('0x4d'),auth['isAuthenticated'](),controller['addChatInteractions']);router[_0x8028('0x36')](_0x8028('0x4e'),auth[_0x8028('0xb')](),controller[_0x8028('0x4f')]);router[_0x8028('0x36')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x8028('0x50')]);router[_0x8028('0x36')]('/:id/sms_interactions',auth[_0x8028('0xb')](),controller['addSmsInteractions']);router['post'](_0x8028('0x51'),auth[_0x8028('0xb')](),controller[_0x8028('0x52')]);router[_0x8028('0x36')](_0x8028('0x53'),auth[_0x8028('0xb')](),controller[_0x8028('0x54')]);router[_0x8028('0x36')](_0x8028('0x29'),auth[_0x8028('0xb')](),controller[_0x8028('0x55')]);router[_0x8028('0x36')](_0x8028('0x2b'),auth[_0x8028('0xb')](),controller[_0x8028('0x56')]);router[_0x8028('0x36')](_0x8028('0x2d'),auth['isAuthenticated'](),controller[_0x8028('0x57')]);router[_0x8028('0x36')](_0x8028('0x2f'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0x8028('0x36')](_0x8028('0x31'),auth[_0x8028('0xb')](),controller[_0x8028('0x58')]);router[_0x8028('0x36')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0x8028('0x59')]);router[_0x8028('0x36')]('/:id/square_projects',auth[_0x8028('0xb')](),controller['addSquareProjects']);router[_0x8028('0x36')](_0x8028('0x5a'),auth[_0x8028('0xb')](),controller[_0x8028('0x5b')]);router[_0x8028('0x5c')](_0x8028('0x5d'),auth['isAuthenticated'](),controller[_0x8028('0x5e')]);router[_0x8028('0x5c')](_0x8028('0x5f'),auth['isAuthenticated'](),controller['changePassword']);router[_0x8028('0x60')]('/:id/queues',auth[_0x8028('0xb')](),controller[_0x8028('0x61')]);router[_0x8028('0x60')](_0x8028('0x22'),auth[_0x8028('0xb')](),controller[_0x8028('0x62')]);router['delete']('/:id',auth[_0x8028('0xb')](),controller[_0x8028('0x63')]);router[_0x8028('0x60')](_0x8028('0x4d'),auth['isAuthenticated'](),controller[_0x8028('0x64')]);router['delete'](_0x8028('0x4e'),auth[_0x8028('0xb')](),controller[_0x8028('0x65')]);router[_0x8028('0x60')](_0x8028('0x66'),auth[_0x8028('0xb')](),controller[_0x8028('0x67')]);router['delete']('/:id/sms_interactions',auth[_0x8028('0xb')](),controller['removeSmsInteractions']);router[_0x8028('0x60')](_0x8028('0x51'),auth[_0x8028('0xb')](),controller[_0x8028('0x68')]);router[_0x8028('0x60')]('/:id/whatsapp_interactions',auth[_0x8028('0xb')](),controller[_0x8028('0x69')]);router[_0x8028('0x60')](_0x8028('0x29'),auth[_0x8028('0xb')](),controller[_0x8028('0x6a')]);router['delete'](_0x8028('0x2b'),auth['isAuthenticated'](),controller[_0x8028('0x6b')]);router[_0x8028('0x60')](_0x8028('0x2d'),auth[_0x8028('0xb')](),controller[_0x8028('0x6c')]);router[_0x8028('0x60')](_0x8028('0x2f'),auth[_0x8028('0xb')](),controller[_0x8028('0x6d')]);router[_0x8028('0x60')](_0x8028('0x31'),auth[_0x8028('0xb')](),controller[_0x8028('0x6e')]);router[_0x8028('0x60')](_0x8028('0x6f'),auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router['delete'](_0x8028('0x34'),auth[_0x8028('0xb')](),controller['removeSquareProjects']);router['delete'](_0x8028('0x5a'),auth[_0x8028('0xb')](),controller[_0x8028('0x70')]);module[_0x8028('0x71')]=router; \ No newline at end of file +var _0xf2d3=['removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','/describe','describe','/whoami','/presence','getPresence','/:id','/:id/avatar','getAvatar','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/square_projects','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','server/files/images/','format','originalname','post','single','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','/:id/whatsapp_accounts','addWhatsappAccounts','addSquareProjects','createApiKey','put','update','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeSmsInteractions','removeWhatsappInteractions','removeMailAccounts'];(function(_0xd6b590,_0xe56f0e){var _0x1f965c=function(_0x3fac99){while(--_0x3fac99){_0xd6b590['push'](_0xd6b590['shift']());}};_0x1f965c(++_0xe56f0e);}(_0xf2d3,0xdf));var _0x3f2d=function(_0x2c3d63,_0x4fcf1e){_0x2c3d63=_0x2c3d63-0x0;var _0x2bb34e=_0xf2d3[_0x2c3d63];return _0x2bb34e;};'use strict';var multer=require(_0x3f2d('0x0'));var util=require(_0x3f2d('0x1'));var path=require(_0x3f2d('0x2'));var timeout=require(_0x3f2d('0x3'));var express=require(_0x3f2d('0x4'));var router=express[_0x3f2d('0x5')]();var auth=require(_0x3f2d('0x6'));var interaction=require(_0x3f2d('0x7'));var config=require(_0x3f2d('0x8'));var controller=require(_0x3f2d('0x9'));router[_0x3f2d('0xa')]('/',auth[_0x3f2d('0xb')](),controller['index']);router[_0x3f2d('0xa')](_0x3f2d('0xc'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0xd')]);router[_0x3f2d('0xa')](_0x3f2d('0xe'),auth[_0x3f2d('0xb')](),controller['whoami']);router[_0x3f2d('0xa')](_0x3f2d('0xf'),auth['isAuthenticated'](),controller[_0x3f2d('0x10')]);router['get'](_0x3f2d('0x11'),auth['isAuthenticated'](),controller['show']);router[_0x3f2d('0xa')](_0x3f2d('0x12'),controller[_0x3f2d('0x13')]);router[_0x3f2d('0xa')](_0x3f2d('0x14'),auth['isAuthenticated'](),controller[_0x3f2d('0x15')]);router[_0x3f2d('0xa')](_0x3f2d('0x16'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x17')]);router[_0x3f2d('0xa')]('/:id/queues_rt',auth['isAuthenticated'](),controller[_0x3f2d('0x18')]);router[_0x3f2d('0xa')](_0x3f2d('0x19'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x1a')]);router[_0x3f2d('0xa')](_0x3f2d('0x1b'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x1c')]);router[_0x3f2d('0xa')]('/:id/screen_recordings',auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x1d')]);router['get'](_0x3f2d('0x1e'),auth['isAuthenticated'](),controller['getChatInteractions']);router[_0x3f2d('0xa')]('/:id/openchannel/interactions',auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x1f')]);router[_0x3f2d('0xa')](_0x3f2d('0x20'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x21')]);router[_0x3f2d('0xa')](_0x3f2d('0x22'),auth[_0x3f2d('0xb')](),controller['getSmsInteractions']);router[_0x3f2d('0xa')](_0x3f2d('0x23'),auth[_0x3f2d('0xb')](),controller['getFaxInteractions']);router[_0x3f2d('0xa')](_0x3f2d('0x24'),auth['isAuthenticated'](),controller[_0x3f2d('0x25')]);router[_0x3f2d('0xa')](_0x3f2d('0x26'),auth[_0x3f2d('0xb')](),controller['getTeams']);router[_0x3f2d('0xa')](_0x3f2d('0x27'),auth['isAuthenticated'](),controller['getLists']);router['get'](_0x3f2d('0x28'),auth['isAuthenticated'](),controller[_0x3f2d('0x29')]);router['get']('/:id/prefixes',auth['isAuthenticated'](),controller[_0x3f2d('0x2a')]);router[_0x3f2d('0xa')](_0x3f2d('0x2b'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x2c')]);router[_0x3f2d('0xa')](_0x3f2d('0x2d'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x2e')]);router['get']('/:id/openchannel_accounts',auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x2f')]);router['get']('/:id/sms_accounts',auth['isAuthenticated'](),controller['getSmsAccounts']);router['get'](_0x3f2d('0x30'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x31')]);router[_0x3f2d('0xa')]('/:id/whatsapp_accounts',auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x32')]);router[_0x3f2d('0xa')](_0x3f2d('0x33'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x34')]);router[_0x3f2d('0xa')]('/:id/scheduled_calls',auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x35')]);router[_0x3f2d('0xa')](_0x3f2d('0x36'),auth['isAuthenticated'](),controller[_0x3f2d('0x37')]);router['post'](_0x3f2d('0x14'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x38')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3f2d('0x39')]);router['post'](_0x3f2d('0x3a'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x3b')]);router['post']('/:id/queues',auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x3c')]);var upload=multer({'storage':multer[_0x3f2d('0x3d')]({'destination':function(_0x2286a9,_0x347f9e,_0x124c3e){_0x124c3e(null,path[_0x3f2d('0x3e')](config['root'],_0x3f2d('0x3f')));},'filename':function(_0x37f6d0,_0x469db7,_0x30aa58){_0x30aa58(null,util[_0x3f2d('0x40')]('%s-%s',Date['now'](),_0x469db7[_0x3f2d('0x41')]));}})});router[_0x3f2d('0x42')](_0x3f2d('0x12'),upload[_0x3f2d('0x43')]('file'),controller['addAvatar']);router[_0x3f2d('0x42')](_0x3f2d('0x44'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x45')]);router['post']('/:id/logout',auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x46')]);router[_0x3f2d('0x42')](_0x3f2d('0x47'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x48')]);router[_0x3f2d('0x42')](_0x3f2d('0x49'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x4a')]);router['post'](_0x3f2d('0x26'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x4b')]);router[_0x3f2d('0x42')](_0x3f2d('0x4c'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x4d')]);router[_0x3f2d('0x42')](_0x3f2d('0x4e'),auth[_0x3f2d('0xb')](),controller['addMailInteractions']);router[_0x3f2d('0x42')]('/:id/fax_interactions',auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x4f')]);router['post'](_0x3f2d('0x50'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x51')]);router[_0x3f2d('0x42')]('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x3f2d('0x52')]);router[_0x3f2d('0x42')](_0x3f2d('0x53'),auth['isAuthenticated'](),controller[_0x3f2d('0x54')]);router['post'](_0x3f2d('0x2b'),auth[_0x3f2d('0xb')](),controller['addFaxAccounts']);router[_0x3f2d('0x42')](_0x3f2d('0x2d'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x55')]);router[_0x3f2d('0x42')](_0x3f2d('0x56'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router[_0x3f2d('0x42')](_0x3f2d('0x57'),auth[_0x3f2d('0xb')](),controller['addSmsAccounts']);router[_0x3f2d('0x42')](_0x3f2d('0x30'),auth[_0x3f2d('0xb')](),controller['addChatWebsites']);router[_0x3f2d('0x42')](_0x3f2d('0x58'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x59')]);router[_0x3f2d('0x42')](_0x3f2d('0x33'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x5a')]);router[_0x3f2d('0x42')](_0x3f2d('0x36'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x5b')]);router[_0x3f2d('0x5c')]('/:id',auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x5d')]);router['put']('/:id/password',auth['isAuthenticated'](),controller[_0x3f2d('0x5e')]);router[_0x3f2d('0x5f')](_0x3f2d('0x16'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x60')]);router[_0x3f2d('0x5f')]('/:id/teams',auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x61')]);router[_0x3f2d('0x5f')](_0x3f2d('0x11'),auth[_0x3f2d('0xb')](),controller['destroy']);router[_0x3f2d('0x5f')](_0x3f2d('0x4c'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x62')]);router[_0x3f2d('0x5f')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x3f2d('0x63')]);router[_0x3f2d('0x5f')](_0x3f2d('0x64'),auth[_0x3f2d('0xb')](),controller['removeFaxInteractions']);router[_0x3f2d('0x5f')](_0x3f2d('0x50'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x65')]);router[_0x3f2d('0x5f')]('/:id/openchannel_interactions',auth[_0x3f2d('0xb')](),controller['removeOpenchannelInteractions']);router[_0x3f2d('0x5f')](_0x3f2d('0x53'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x66')]);router[_0x3f2d('0x5f')](_0x3f2d('0x2b'),auth[_0x3f2d('0xb')](),controller['removeFaxAccounts']);router[_0x3f2d('0x5f')](_0x3f2d('0x2d'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x67')]);router[_0x3f2d('0x5f')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0x3f2d('0x5f')](_0x3f2d('0x57'),auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x68')]);router[_0x3f2d('0x5f')]('/:id/chat_websites',auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x69')]);router[_0x3f2d('0x5f')]('/:id/whatsapp_accounts',auth[_0x3f2d('0xb')](),controller[_0x3f2d('0x6a')]);router[_0x3f2d('0x5f')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x3f2d('0x6b')]);router['delete'](_0x3f2d('0x36'),auth['isAuthenticated'](),controller[_0x3f2d('0x6c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 4c8e83a..1fe0faa 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 _0x0e98=['shortinfo','auto','rfc2833','yes','nonat','update','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','actpass','update,nonat','showWebBar','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','dtlsverify','/etc/pki/tls/certs/motion.crt','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','loginAttempts','sequelize','moment','util','exports','STRING','setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','user','agent','telephone','local','INTEGER','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info'];(function(_0x4a9d82,_0x25f076){var _0x91b408=function(_0x18ca37){while(--_0x18ca37){_0x4a9d82['push'](_0x4a9d82['shift']());}};_0x91b408(++_0x25f076);}(_0x0e98,0xe6));var _0x80e9=function(_0x57fe69,_0x41098d){_0x57fe69=_0x57fe69-0x0;var _0x31565d=_0x0e98[_0x57fe69];return _0x31565d;};'use strict';var Sequelize=require(_0x80e9('0x0'));var moment=require(_0x80e9('0x1'));var util=require(_0x80e9('0x2'));var _=require('lodash');module[_0x80e9('0x3')]={'name':{'type':Sequelize[_0x80e9('0x4')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x58d9da){this[_0x80e9('0x5')](_0x80e9('0x6'),_0x58d9da);this['setDataValue'](_0x80e9('0x7'),_0x58d9da);},'comment':_0x80e9('0x8')},'fullname':{'type':Sequelize[_0x80e9('0x4')],'allowNull':![],'set':function(_0x590961){this['setDataValue'](_0x80e9('0x9'),_0x590961);this['setDataValue'](_0x80e9('0xa'),util[_0x80e9('0xb')](_0x80e9('0xc'),_0x590961,this[_0x80e9('0xd')](_0x80e9('0xe'))));}},'alias':{'type':Sequelize[_0x80e9('0x4')]},'email':{'type':Sequelize[_0x80e9('0x4')],'allowNull':![],'unique':_0x80e9('0xf'),'validate':{'isEmail':!![]},'set':function(_0x506a71){if(_0x506a71){this[_0x80e9('0x5')](_0x80e9('0xf'),_0x506a71[_0x80e9('0x10')]());}}},'role':{'type':Sequelize[_0x80e9('0x11')]('admin',_0x80e9('0x12'),_0x80e9('0x13'),_0x80e9('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0x80e9('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x80e9('0x15')},'internal':{'type':Sequelize[_0x80e9('0x16')](0xb),'allowNull':![],'unique':_0x80e9('0xe'),'set':function(_0x34f100){this[_0x80e9('0x5')](_0x80e9('0xe'),_0x34f100);this[_0x80e9('0x5')](_0x80e9('0x17'),_0x34f100);this[_0x80e9('0x5')](_0x80e9('0xa'),util[_0x80e9('0xb')](_0x80e9('0xc'),this[_0x80e9('0xd')](_0x80e9('0x9')),_0x34f100));}},'salt':{'type':Sequelize[_0x80e9('0x4')]},'phone':{'type':Sequelize[_0x80e9('0x4')]},'mobile':{'type':Sequelize[_0x80e9('0x4')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0x80e9('0x4')]},'city':{'type':Sequelize[_0x80e9('0x4')]},'country':{'type':Sequelize[_0x80e9('0x4')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x80e9('0x18')]},'voicePause':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x80e9('0x4')],'defaultValue':_0x80e9('0x1a')},'lastPauseAt':{'type':Sequelize[_0x80e9('0x18')]},'chatCapacity':{'type':Sequelize[_0x80e9('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x80e9('0x16')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x80e9('0x16')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x80e9('0x16')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x80e9('0x16')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x80e9('0x16')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'description':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![],'defaultValue':_0x80e9('0x1b')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x80e9('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x80e9('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend',_0x80e9('0x12'),_0x80e9('0x1c')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x80e9('0x1d')},'callingpres':{'type':Sequelize['ENUM'](_0x80e9('0x1e'),_0x80e9('0x1f'),_0x80e9('0x20'),_0x80e9('0x21'),'PROHIB_NOT_SCREENED',_0x80e9('0x22'),_0x80e9('0x23'),_0x80e9('0x24')),'allowNull':!![]},'deny':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![],'defaultValue':_0x80e9('0x25'),'set':function(_0x228fcb){this[_0x80e9('0x5')](_0x80e9('0x26'),_0x228fcb?_0x228fcb[_0x80e9('0x27')](','):null);},'get':function(){return this[_0x80e9('0xd')]('transport')?this['getDataValue'](_0x80e9('0x26'))[_0x80e9('0x28')](','):null;},'comment':_0x80e9('0x29')},'dtmfmode':{'type':Sequelize[_0x80e9('0x11')]('rfc2833',_0x80e9('0x2a'),_0x80e9('0x2b'),'inband',_0x80e9('0x2c')),'allowNull':!![],'defaultValue':_0x80e9('0x2d')},'directmedia':{'type':Sequelize['ENUM'](_0x80e9('0x2e'),'no',_0x80e9('0x2f'),_0x80e9('0x30'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x1f04d8){this[_0x80e9('0x5')](_0x80e9('0x31'),_0x1f04d8?_0x1f04d8[_0x80e9('0x27')](','):null);},'get':function(){return this[_0x80e9('0xd')]('nat')?this[_0x80e9('0xd')](_0x80e9('0x31'))[_0x80e9('0x28')](','):null;},'comment':_0x80e9('0x32')},'callgroup':{'type':Sequelize[_0x80e9('0x4')]},'namedcallgroup':{'type':Sequelize[_0x80e9('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x80e9('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x80e9('0x4')]},'disallow':{'type':Sequelize[_0x80e9('0x4')],'allowNull':![],'defaultValue':_0x80e9('0x33')},'allow':{'type':Sequelize[_0x80e9('0x4')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x36b174){this[_0x80e9('0x5')](_0x80e9('0x34'),_0x36b174?_0x36b174[_0x80e9('0x27')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x80e9('0xd')](_0x80e9('0x34'))?this[_0x80e9('0xd')](_0x80e9('0x34'))[_0x80e9('0x28')](';'):null;},'comment':_0x80e9('0x35')},'autoframing':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![],'set':function(_0x2c3373){this['setDataValue'](_0x80e9('0x36'),_0x2c3373?_0x2c3373[_0x80e9('0x27')](','):null);},'get':function(){return this['getDataValue'](_0x80e9('0x36'))?this[_0x80e9('0xd')](_0x80e9('0x36'))[_0x80e9('0x28')](','):null;},'comment':_0x80e9('0x37')},'trustrpid':{'type':Sequelize['ENUM'](_0x80e9('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x80e9('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no',_0x80e9('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x80e9('0x11')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x80e9('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x80e9('0x11')]('yes','no'),'allowNull':!![],'defaultValue':_0x80e9('0x2e')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x80e9('0x11')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x80e9('0x11')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x80e9('0x2e'),'no',_0x80e9('0x39')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x80e9('0x2e'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x3a'),_0x80e9('0x3b'),_0x80e9('0x3c')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x80e9('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x80e9('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x3d'),_0x80e9('0x3e')),'allowNull':!![],'defaultValue':_0x80e9('0x3e')},'t38pt_usertpsource':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no'),'allowNull':!![],'defaultValue':_0x80e9('0x2e')},'keepalive':{'type':Sequelize[_0x80e9('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x80e9('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x80e9('0x16')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x80e9('0x16')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x80e9('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x80e9('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x80e9('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x80e9('0x11')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x80e9('0x11')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x80e9('0x11')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x80e9('0x2e'),'no',_0x80e9('0x3f'),_0x80e9('0x40')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x80e9('0x41'),'passive',_0x80e9('0x42')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x80e9('0x16')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x80e9('0x11')]('yes','no',_0x80e9('0x2f'),_0x80e9('0x30'),_0x80e9('0x43')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x80e9('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x80e9('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x80e9('0x4')]},'showWebBar':{'type':Sequelize[_0x80e9('0x16')],'defaultValue':0x0,'set':function(_0x4ade57){this['setDataValue'](_0x80e9('0x44'),_0x4ade57);var _0x123601=this['get']({'plain':!![]});switch(_0x4ade57){case 0x0:case 0x1:var _0x421a40=_0x123601[_0x80e9('0x26')]?_[_0x80e9('0x45')](_0x123601['transport'])?_0x123601[_0x80e9('0x26')][_0x80e9('0x27')]():_0x123601[_0x80e9('0x26')]:'udp';if(_0x421a40===_0x80e9('0x46')){_0x421a40='udp';}this[_0x80e9('0x5')](_0x80e9('0x26'),_0x421a40);this[_0x80e9('0x5')](_0x80e9('0x47'),'no');this[_0x80e9('0x5')](_0x80e9('0x48'),null);this['setDataValue'](_0x80e9('0x49'),null);this['setDataValue'](_0x80e9('0x4a'),null);this['setDataValue'](_0x80e9('0x4b'),null);this[_0x80e9('0x5')]('dtlsverify',null);this['setDataValue'](_0x80e9('0x4c'),null);this['setDataValue'](_0x80e9('0x4d'),null);this[_0x80e9('0x5')](_0x80e9('0x4e'),null);this[_0x80e9('0x5')](_0x80e9('0x4f'),'no');break;case 0x2:this[_0x80e9('0x5')](_0x80e9('0x26'),'wss');this[_0x80e9('0x5')]('encryption','yes');this[_0x80e9('0x5')]('avpf','yes');this[_0x80e9('0x5')](_0x80e9('0x49'),_0x80e9('0x2e'));this[_0x80e9('0x5')](_0x80e9('0x4a'),_0x80e9('0x2e'));this[_0x80e9('0x5')](_0x80e9('0x4b'),_0x80e9('0x2e'));this[_0x80e9('0x5')](_0x80e9('0x50'),'no');this[_0x80e9('0x5')](_0x80e9('0x4c'),_0x80e9('0x42'));this[_0x80e9('0x5')](_0x80e9('0x4d'),_0x123601[_0x80e9('0x4d')]||_0x80e9('0x51'));this[_0x80e9('0x5')](_0x80e9('0x4e'),_0x123601[_0x80e9('0x4e')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0x80e9('0x4f'),_0x80e9('0x2e'));break;default:}}},'permissions':{'type':Sequelize[_0x80e9('0x52')],'set':function(_0x538ee5){this[_0x80e9('0x5')](_0x80e9('0x53'),_0x538ee5?_0x538ee5['join'](','):[]);},'get':function(){return this[_0x80e9('0xd')](_0x80e9('0x53'))?_[_0x80e9('0x54')](this[_0x80e9('0xd')]('permissions')['split'](','),function(_0x32cb12){return parseInt(_0x32cb12,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x80e9('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x80e9('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0x80e9('0x4')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x80e9('0x16')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x80e9('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x80e9('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x80e9('0x11')](_0x80e9('0x2e'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x80e9('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x80e9('0x55')],'get':function(){return this[_0x80e9('0xd')]('phoneBarEnableScreenRecordingByAgent')?this['getDataValue'](_0x80e9('0x56')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'interface':{'type':Sequelize[_0x80e9('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x80e9('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![],'set':function(_0x191da5){if(typeof _0x191da5===_0x80e9('0x57')){var _0x499089=_0x191da5==='1'?!![]:_0x191da5==='0'?![]:_0x191da5===_0x80e9('0x58')?!![]:_0x191da5==='false'?![]:![];this[_0x80e9('0x5')](_0x80e9('0x59'),_0x499089);}else{this[_0x80e9('0x5')](_0x80e9('0x59'),_0x191da5);}}},'blocked':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![],'set':function(_0x46608a){this[_0x80e9('0x5')]('blocked',_0x46608a);if(_0x46608a===!![]){this[_0x80e9('0x5')]('blockedAt',moment());this[_0x80e9('0x5')](_0x80e9('0x5a'),0x0);}else{this['setDataValue']('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x80e9('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x80e9('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x80e9('0x19')],'defaultValue':!![]}}; \ No newline at end of file +var _0xae86=['/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','true','false','screenrecording','blocked','loginAttempts','blockedAt','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','fullname','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','user','agent','telephone','local','accountcode','BOOLEAN','DATE','INTEGER','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','update','outgoing','force_rport,comedia','nat','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','originate','uac','uas','fingerprint','certificate','active','passive','nonat','update,nonat','showWebBar','get','isArray','encryption','force_avp','icesupport','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','wss','avpf','dtlsenable','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xae86,0xc4));var _0x6ae8=function(_0x39d9d7,_0xb6691){_0x39d9d7=_0x39d9d7-0x0;var _0x3b1c1d=_0xae86[_0x39d9d7];return _0x3b1c1d;};'use strict';var Sequelize=require(_0x6ae8('0x0'));var moment=require(_0x6ae8('0x1'));var util=require(_0x6ae8('0x2'));var _=require(_0x6ae8('0x3'));module[_0x6ae8('0x4')]={'name':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':![],'unique':_0x6ae8('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x387ec6){this['setDataValue'](_0x6ae8('0x6'),_0x387ec6);this[_0x6ae8('0x7')]('defaultuser',_0x387ec6);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':![],'set':function(_0x4eabda){this['setDataValue'](_0x6ae8('0x8'),_0x4eabda);this['setDataValue']('callerid',util[_0x6ae8('0x9')](_0x6ae8('0xa'),_0x4eabda,this[_0x6ae8('0xb')](_0x6ae8('0xc'))));}},'alias':{'type':Sequelize[_0x6ae8('0x5')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x51e7c6){if(_0x51e7c6){this['setDataValue'](_0x6ae8('0xd'),_0x51e7c6[_0x6ae8('0xe')]());}}},'role':{'type':Sequelize[_0x6ae8('0xf')]('admin',_0x6ae8('0x10'),_0x6ae8('0x11'),_0x6ae8('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x6ae8('0x5')],'defaultValue':_0x6ae8('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x6ae8('0xc'),'set':function(_0x4ccd66){this['setDataValue'](_0x6ae8('0xc'),_0x4ccd66);this['setDataValue'](_0x6ae8('0x14'),_0x4ccd66);this['setDataValue']('callerid',util[_0x6ae8('0x9')](_0x6ae8('0xa'),this[_0x6ae8('0xb')]('fullname'),_0x4ccd66));}},'salt':{'type':Sequelize[_0x6ae8('0x5')]},'phone':{'type':Sequelize[_0x6ae8('0x5')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x6ae8('0x5')]},'zipcode':{'type':Sequelize[_0x6ae8('0x5')]},'userpic':{'type':Sequelize[_0x6ae8('0x5')]},'city':{'type':Sequelize[_0x6ae8('0x5')]},'country':{'type':Sequelize[_0x6ae8('0x5')]},'online':{'type':Sequelize[_0x6ae8('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x6ae8('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x6ae8('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x6ae8('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x6ae8('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x6ae8('0x5')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x6ae8('0x16')]},'chatCapacity':{'type':Sequelize[_0x6ae8('0x17')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x6ae8('0x17')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x6ae8('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x6ae8('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x6ae8('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x6ae8('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x6ae8('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x6ae8('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x6ae8('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x6ae8('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x6ae8('0x17')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x6ae8('0x17')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x6ae8('0xf')]('friend','user',_0x6ae8('0x18')),'allowNull':!![],'defaultValue':_0x6ae8('0x19')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6ae8('0x1a')},'callingpres':{'type':Sequelize[_0x6ae8('0xf')](_0x6ae8('0x1b'),_0x6ae8('0x1c'),_0x6ae8('0x1d'),_0x6ae8('0x1e'),_0x6ae8('0x1f'),_0x6ae8('0x20'),_0x6ae8('0x21'),_0x6ae8('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6ae8('0x23'),'set':function(_0x255936){this['setDataValue']('transport',_0x255936?_0x255936['join'](','):null);},'get':function(){return this[_0x6ae8('0xb')](_0x6ae8('0x24'))?this[_0x6ae8('0xb')](_0x6ae8('0x24'))['split'](','):null;},'comment':_0x6ae8('0x25')},'dtmfmode':{'type':Sequelize[_0x6ae8('0xf')](_0x6ae8('0x26'),_0x6ae8('0x27'),_0x6ae8('0x28'),_0x6ae8('0x29'),'auto'),'allowNull':!![],'defaultValue':_0x6ae8('0x26')},'directmedia':{'type':Sequelize[_0x6ae8('0xf')](_0x6ae8('0x2a'),'no','nonat',_0x6ae8('0x2b'),_0x6ae8('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6ae8('0xf')](_0x6ae8('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![],'defaultValue':_0x6ae8('0x2d'),'set':function(_0x27fa02){this['setDataValue'](_0x6ae8('0x2e'),_0x27fa02?_0x27fa02[_0x6ae8('0x2f')](','):null);},'get':function(){return this['getDataValue'](_0x6ae8('0x2e'))?this[_0x6ae8('0xb')]('nat')[_0x6ae8('0x30')](','):null;},'comment':_0x6ae8('0x31')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x6ae8('0x5')]},'pickupgroup':{'type':Sequelize[_0x6ae8('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6ae8('0x5')]},'disallow':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':![],'defaultValue':_0x6ae8('0x32')},'allow':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':![],'defaultValue':_0x6ae8('0x33'),'set':function(_0x3f0fcb){this['setDataValue'](_0x6ae8('0x34'),_0x3f0fcb?_0x3f0fcb[_0x6ae8('0x2f')](';'):_0x6ae8('0x33'));},'get':function(){return this[_0x6ae8('0xb')]('allow')?this['getDataValue'](_0x6ae8('0x34'))[_0x6ae8('0x30')](';'):null;},'comment':_0x6ae8('0x35')},'autoframing':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![],'set':function(_0xf4b617){this['setDataValue']('insecure',_0xf4b617?_0xf4b617[_0x6ae8('0x2f')](','):null);},'get':function(){return this[_0x6ae8('0xb')](_0x6ae8('0x36'))?this['getDataValue'](_0x6ae8('0x36'))['split'](','):null;},'comment':_0x6ae8('0x37')},'trustrpid':{'type':Sequelize[_0x6ae8('0xf')](_0x6ae8('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6ae8('0xf')](_0x6ae8('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6ae8('0xf')]('yes','no',_0x6ae8('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x6ae8('0xf')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x6ae8('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x6ae8('0x17')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6ae8('0x39')},'amaflags':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x6ae8('0xf')]('yes','no'),'allowNull':!![],'defaultValue':_0x6ae8('0x2a')},'busylevel':{'type':Sequelize[_0x6ae8('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x6ae8('0x2a'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x6ae8('0xf')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x6ae8('0xf')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x6ae8('0xf')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x6ae8('0xf')](_0x6ae8('0x2a'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x6ae8('0xf')](_0x6ae8('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x6ae8('0xf')]('accept','refuse',_0x6ae8('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x6ae8('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x6ae8('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x6ae8('0xf')](_0x6ae8('0x3b'),_0x6ae8('0x3c')),'allowNull':!![],'defaultValue':_0x6ae8('0x3c')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x6ae8('0xf')](_0x6ae8('0x2a'),'no'),'allowNull':!![],'defaultValue':_0x6ae8('0x2a')},'keepalive':{'type':Sequelize[_0x6ae8('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x6ae8('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x6ae8('0xf')](_0x6ae8('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x6ae8('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x6ae8('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x6ae8('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x6ae8('0xf')](_0x6ae8('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x6ae8('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x6ae8('0xf')](_0x6ae8('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x6ae8('0xf')](_0x6ae8('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x6ae8('0xf')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x6ae8('0x2a'),'no',_0x6ae8('0x3d'),_0x6ae8('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x6ae8('0xf')](_0x6ae8('0x3f'),_0x6ae8('0x40'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x6ae8('0xf')](_0x6ae8('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x6ae8('0xf')](_0x6ae8('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x6ae8('0xf')](_0x6ae8('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x6ae8('0xf')]('yes','no',_0x6ae8('0x41'),_0x6ae8('0x2b'),_0x6ae8('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x6ae8('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0x6ae8('0x16')]},'passwordResetAt':{'type':Sequelize[_0x6ae8('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x6ae8('0x5')]},'showWebBar':{'type':Sequelize[_0x6ae8('0x17')],'defaultValue':0x0,'set':function(_0x55fb80){this[_0x6ae8('0x7')](_0x6ae8('0x43'),_0x55fb80);var _0x4cb5e0=this[_0x6ae8('0x44')]({'plain':!![]});switch(_0x55fb80){case 0x0:case 0x1:var _0x1ca562=_0x4cb5e0[_0x6ae8('0x24')]?_[_0x6ae8('0x45')](_0x4cb5e0['transport'])?_0x4cb5e0[_0x6ae8('0x24')][_0x6ae8('0x2f')]():_0x4cb5e0[_0x6ae8('0x24')]:_0x6ae8('0x23');if(_0x1ca562==='wss'){_0x1ca562=_0x6ae8('0x23');}this[_0x6ae8('0x7')](_0x6ae8('0x24'),_0x1ca562);this[_0x6ae8('0x7')](_0x6ae8('0x46'),'no');this[_0x6ae8('0x7')]('avpf',null);this[_0x6ae8('0x7')](_0x6ae8('0x47'),null);this[_0x6ae8('0x7')](_0x6ae8('0x48'),null);this[_0x6ae8('0x7')]('dtlsenable',null);this[_0x6ae8('0x7')](_0x6ae8('0x49'),null);this[_0x6ae8('0x7')](_0x6ae8('0x4a'),null);this[_0x6ae8('0x7')](_0x6ae8('0x4b'),null);this['setDataValue']('dtlsprivatekey',null);this[_0x6ae8('0x7')](_0x6ae8('0x4c'),'no');break;case 0x2:this['setDataValue']('transport',_0x6ae8('0x4d'));this[_0x6ae8('0x7')](_0x6ae8('0x46'),_0x6ae8('0x2a'));this['setDataValue'](_0x6ae8('0x4e'),'yes');this[_0x6ae8('0x7')]('force_avp',_0x6ae8('0x2a'));this['setDataValue'](_0x6ae8('0x48'),'yes');this[_0x6ae8('0x7')](_0x6ae8('0x4f'),_0x6ae8('0x2a'));this[_0x6ae8('0x7')](_0x6ae8('0x49'),'no');this[_0x6ae8('0x7')](_0x6ae8('0x4a'),_0x6ae8('0x50'));this[_0x6ae8('0x7')](_0x6ae8('0x4b'),_0x4cb5e0[_0x6ae8('0x4b')]||_0x6ae8('0x51'));this['setDataValue']('dtlsprivatekey',_0x4cb5e0[_0x6ae8('0x52')]||_0x6ae8('0x53'));this[_0x6ae8('0x7')](_0x6ae8('0x4c'),_0x6ae8('0x2a'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x23fe03){this[_0x6ae8('0x7')](_0x6ae8('0x54'),_0x23fe03?_0x23fe03[_0x6ae8('0x2f')](','):[]);},'get':function(){return this[_0x6ae8('0xb')](_0x6ae8('0x54'))?_[_0x6ae8('0x55')](this[_0x6ae8('0xb')](_0x6ae8('0x54'))['split'](','),function(_0xe18fb1){return parseInt(_0xe18fb1,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x6ae8('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x6ae8('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0x6ae8('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x6ae8('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x6ae8('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x6ae8('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x6ae8('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x6ae8('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x6ae8('0x17')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x6ae8('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x6ae8('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x6ae8('0x56')],'get':function(){return this[_0x6ae8('0xb')]('phoneBarEnableScreenRecordingByAgent')?this[_0x6ae8('0xb')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x6ae8('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x6ae8('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x6ae8('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x6ae8('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x6ae8('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x54b65e){if(typeof _0x54b65e==='string'){var _0x51c1da=_0x54b65e==='1'?!![]:_0x54b65e==='0'?![]:_0x54b65e===_0x6ae8('0x57')?!![]:_0x54b65e===_0x6ae8('0x58')?![]:![];this[_0x6ae8('0x7')]('screenrecording',_0x51c1da);}else{this[_0x6ae8('0x7')](_0x6ae8('0x59'),_0x54b65e);}}},'blocked':{'type':Sequelize[_0x6ae8('0x15')],'defaultValue':![],'set':function(_0x62635d){this['setDataValue'](_0x6ae8('0x5a'),_0x62635d);if(_0x62635d===!![]){this['setDataValue']('blockedAt',moment());this[_0x6ae8('0x7')](_0x6ae8('0x5b'),0x0);}else{this['setDataValue'](_0x6ae8('0x5c'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x6ae8('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x6ae8('0x15')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index a2c06b2..159dea4 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 _0xb8a9=['chat','sms','whatsapp','%s%s','Pause','getTeams','Team','addTeams','Voice','getChatQueues','Chat','getMailQueues','setDataValue','Mail','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Openchannel','flatten','transaction','addAgent','getDataValue','QueueId','removeTeams','Fax','getOpenchannelQueues','removeAgent','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','ChatWebsite','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$or','$gt','$gte','$lt','$ne','$between','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','lastName','Contact','dialActive','Queue','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','token','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','getPresence','teams','queues','toString','desc','asc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','offline','unknown','unavailable','voiceStatus','busy','slice','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./user.socket','register','jayson/promise','client','http','request','info','User,\x20%s,\x20%s','debug','request\x20sent','error','message','result','catch','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','get','role','admin','Users','user','Agents','agent','Telephones','telephone','filter','ignore','value','includes','find','name','destroy','stack','send','map','User','rawAttributes','key','model','differenceBy','password','salt','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','sequelize','lower','col','count','include','findAll','rows','show','params','includeAll','options','body','describe','addContacts','ids','omit','internal','Setting','findById','validatePasswordPattern','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','isNil','from','mailbox','fullname','email','permissions','102','103','113','110','104','105','106','108','109','111','114','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','UserProfileResource','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','checkUserLimits','push','all','each','isEmpty','autoAssociation','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','securePassword','previousPasswords','passwordHistoryLimit','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','emit','voice','VoiceQueue','interface','format','upsert','removeQueues','Queue:remove','UserVoiceQueueRt','addAvatar','userpic','filename','getAvatar','join','server/files/images/logos/default_profile.png','download','existsSync','root','server/files/images/','getContacts','CmContact','CmList','Tags','color','tag','Unknown\x20role','getVoiceQueuesRt','ChatGroup','getRecordings','VoiceRecording','UserId','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','getWhatsappInteractions','phone','mobile','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:%s','user:forcelogout','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','device','PAUSE','LOGININPAUSE','MemberReport','concat','isMiddleware','resolve','logout','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','smsPause','pauseType','lastPauseAt','QueuePause','manual','mail'];(function(_0x154f21,_0x3c7f37){var _0x5ae16f=function(_0x214498){while(--_0x214498){_0x154f21['push'](_0x154f21['shift']());}};_0x5ae16f(++_0x3c7f37);}(_0xb8a9,0x83));var _0x9b8a=function(_0x30abff,_0x5f2c5f){_0x30abff=_0x30abff-0x0;var _0x4c571e=_0xb8a9[_0x30abff];return _0x4c571e;};'use strict';var pdf=require(_0x9b8a('0x0'));var emlformat=require(_0x9b8a('0x1'));var rimraf=require(_0x9b8a('0x2'));var zipdir=require(_0x9b8a('0x3'));var jsonpatch=require(_0x9b8a('0x4'));var rp=require('request-promise');var moment=require(_0x9b8a('0x5'));var BPromise=require(_0x9b8a('0x6'));var Mustache=require(_0x9b8a('0x7'));var util=require('util');var path=require(_0x9b8a('0x8'));var sox=require(_0x9b8a('0x9'));var csv=require(_0x9b8a('0xa'));var ejs=require(_0x9b8a('0xb'));var fs=require('fs');var _=require(_0x9b8a('0xc'));var squel=require(_0x9b8a('0xd'));var crypto=require(_0x9b8a('0xe'));var jsforce=require(_0x9b8a('0xf'));var deskjs=require(_0x9b8a('0x10'));var toCsv=require(_0x9b8a('0xa'));var querystring=require('querystring');var Papa=require(_0x9b8a('0x11'));var Redis=require(_0x9b8a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9b8a('0x13'));var as=require(_0x9b8a('0x14'));var hardwareService=require(_0x9b8a('0x15'));var logger=require(_0x9b8a('0x16'))(_0x9b8a('0x17'));var utils=require(_0x9b8a('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9b8a('0x19'))['db'];config[_0x9b8a('0x1a')]=_[_0x9b8a('0x1b')](config[_0x9b8a('0x1a')],{'host':_0x9b8a('0x1c'),'port':0x18eb});var socket=require(_0x9b8a('0x1d'))(new Redis(config[_0x9b8a('0x1a')]));require(_0x9b8a('0x1e'))[_0x9b8a('0x1f')](socket);var jayson=require(_0x9b8a('0x20'));var client=jayson[_0x9b8a('0x21')][_0x9b8a('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x478229,_0x59957a,_0x539b1f,_0x4fdc97){return new BPromise(function(_0x4b9c54,_0x13db9f){var _0x4e2d35=_0x4fdc97||client;return _0x4e2d35[_0x9b8a('0x23')](_0x478229,_0x539b1f)['then'](function(_0x2f9b1b){logger[_0x9b8a('0x24')](_0x9b8a('0x25'),_0x59957a,'request\x20sent');logger[_0x9b8a('0x26')]('User,\x20%s,\x20%s,\x20%s',_0x59957a,_0x9b8a('0x27'),JSON['stringify'](_0x2f9b1b));if(_0x2f9b1b['error']){if(_0x2f9b1b[_0x9b8a('0x28')]['code']===0x1f4){logger[_0x9b8a('0x28')]('User,\x20%s,\x20%s',_0x59957a,_0x2f9b1b[_0x9b8a('0x28')]['message']);return _0x13db9f(_0x2f9b1b[_0x9b8a('0x28')]['message']);}logger['error'](_0x9b8a('0x25'),_0x59957a,_0x2f9b1b[_0x9b8a('0x28')][_0x9b8a('0x29')]);return _0x4b9c54(_0x2f9b1b[_0x9b8a('0x28')][_0x9b8a('0x29')]);}else{logger[_0x9b8a('0x24')](_0x9b8a('0x25'),_0x59957a,'request\x20sent');_0x4b9c54(_0x2f9b1b[_0x9b8a('0x2a')][_0x9b8a('0x29')]);}})[_0x9b8a('0x2b')](function(_0x3f298e){logger[_0x9b8a('0x28')](_0x9b8a('0x25'),_0x59957a,_0x3f298e);_0x13db9f(_0x3f298e);});});}function respondWithStatusCode(_0x3cc773,_0x1ca764){_0x1ca764=_0x1ca764||0xcc;return function(_0x4219a3){if(_0x4219a3){return _0x3cc773['sendStatus'](_0x1ca764);}return _0x3cc773[_0x9b8a('0x2c')](_0x1ca764)[_0x9b8a('0x2d')]();};}function respondWithResult(_0x2668e0,_0x2a9d45){_0x2a9d45=_0x2a9d45||0xc8;return function(_0x1e4a43){if(_0x1e4a43){return _0x2668e0['status'](_0x2a9d45)[_0x9b8a('0x2e')](_0x1e4a43);}};}function respondWithFilteredResult(_0x27148d,_0x2dd6ad){return function(_0x640d1b){if(_0x640d1b){var _0x2aa656=_0x640d1b['count'],_0x31e770=_0x2dd6ad['offset'],_0x213130=_0x2dd6ad[_0x9b8a('0x2f')]+_0x2dd6ad[_0x9b8a('0x30')],_0x28fc60;if(_0x213130>=_0x2aa656){_0x213130=_0x2aa656;_0x28fc60=0xc8;}else{_0x28fc60=0xce;}_0x27148d['status'](_0x28fc60);return _0x27148d[_0x9b8a('0x31')](_0x9b8a('0x32'),_0x31e770+'-'+_0x213130+'/'+_0x2aa656)[_0x9b8a('0x2e')](_0x640d1b);}return null;};}function patchUpdates(_0x8e9afc){return function(_0x3d32a1){try{jsonpatch[_0x9b8a('0x33')](_0x3d32a1,_0x8e9afc,!![]);}catch(_0xecfa5f){return BPromise[_0x9b8a('0x34')](_0xecfa5f);}return _0x3d32a1[_0x9b8a('0x35')]();};}function saveUpdates(_0x33950f,_0x1c4160){return function(_0x4ad683){if(_0x4ad683){return _0x4ad683[_0x9b8a('0x36')](_0x33950f)[_0x9b8a('0x37')](function(_0x16ab42){return _0x16ab42;});}return null;};}function removeEntity(_0x27b497,_0x5998bc){return function(_0x17d3fb){if(_0x17d3fb){return _0x17d3fb['destroy']()[_0x9b8a('0x37')](function(){var _0x155700=_0x17d3fb[_0x9b8a('0x38')]({'plain':!![]});if(_0x155700[_0x9b8a('0x39')]===_0x9b8a('0x3a'))return;var _0xa32f4b=[{'name':_0x9b8a('0x3b'),'value':_0x9b8a('0x3c'),'ignore':!![]},{'name':_0x9b8a('0x3d'),'value':_0x9b8a('0x3e'),'ignore':![]},{'name':_0x9b8a('0x3f'),'value':_0x9b8a('0x40'),'ignore':![]}];var _0x470a2a=_(_0xa32f4b)[_0x9b8a('0x41')](_0x9b8a('0x42'))['map'](_0x9b8a('0x43'))[_0x9b8a('0x43')]();if(_[_0x9b8a('0x44')](_0x470a2a,_0x155700['role'])){return;}var _0x1922fd=_[_0x9b8a('0x45')](_0xa32f4b,['value',_0x155700['role']])[_0x9b8a('0x46')];return db['UserProfileResource'][_0x9b8a('0x47')]({'where':{'type':_0x1922fd,'resourceId':_0x155700['id']}})['then'](function(){return _0x17d3fb;});})['then'](function(){_0x27b497[_0x9b8a('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x526352,_0x2b84d7){return function(_0x35033f){if(!_0x35033f){_0x526352['sendStatus'](0x194);}return _0x35033f;};}function handleError(_0xac8295,_0x307475){_0x307475=_0x307475||0x1f4;return function(_0x3963ca){logger[_0x9b8a('0x28')](_0x3963ca[_0x9b8a('0x48')]);if(_0x3963ca[_0x9b8a('0x46')]){delete _0x3963ca['name'];}_0xac8295[_0x9b8a('0x2c')](_0x307475)[_0x9b8a('0x49')](_0x3963ca);};}exports['index']=function(_0x4f5895,_0x3498db){var _0x7ea593={},_0x491a00={},_0x41f2a4={'count':0x0,'rows':[]};var _0x105305=_[_0x9b8a('0x4a')](db[_0x9b8a('0x4b')][_0x9b8a('0x4c')],function(_0x309890){return{'name':_0x309890['fieldName'],'type':_0x309890['type'][_0x9b8a('0x4d')]};});_0x491a00[_0x9b8a('0x4e')]=_[_0x9b8a('0x4f')](_[_0x9b8a('0x4a')](_0x105305,_0x9b8a('0x46')),[_0x9b8a('0x50'),_0x9b8a('0x51')]);_0x491a00[_0x9b8a('0x52')]=_[_0x9b8a('0x53')](_0x4f5895[_0x9b8a('0x52')]);_0x491a00[_0x9b8a('0x54')]=_[_0x9b8a('0x55')](_0x491a00[_0x9b8a('0x4e')],_0x491a00[_0x9b8a('0x52')]);_0x7ea593[_0x9b8a('0x56')]=_[_0x9b8a('0x55')](_0x491a00[_0x9b8a('0x4e')],qs[_0x9b8a('0x57')](_0x4f5895[_0x9b8a('0x52')][_0x9b8a('0x57')]));_0x7ea593['attributes']=_0x7ea593['attributes'][_0x9b8a('0x58')]?_0x7ea593['attributes']:_0x491a00[_0x9b8a('0x4e')];if(!_0x4f5895[_0x9b8a('0x52')][_0x9b8a('0x59')](_0x9b8a('0x5a'))){_0x7ea593[_0x9b8a('0x30')]=qs[_0x9b8a('0x30')](_0x4f5895[_0x9b8a('0x52')][_0x9b8a('0x30')]);_0x7ea593['offset']=qs[_0x9b8a('0x2f')](_0x4f5895[_0x9b8a('0x52')][_0x9b8a('0x2f')]);}_0x7ea593[_0x9b8a('0x5b')]=qs[_0x9b8a('0x5c')](_0x4f5895[_0x9b8a('0x52')]['sort']);_0x7ea593[_0x9b8a('0x5d')]=qs[_0x9b8a('0x54')](_[_0x9b8a('0x5e')](_0x4f5895['query'],_0x491a00[_0x9b8a('0x54')]),_0x105305);if(_0x4f5895[_0x9b8a('0x52')]['filter']){_0x7ea593['where']=_[_0x9b8a('0x5f')](_0x7ea593[_0x9b8a('0x5d')],{'$or':_[_0x9b8a('0x4a')](_0x105305,function(_0x562ec6){if(_0x562ec6[_0x9b8a('0x60')]!==_0x9b8a('0x61')){return db[_0x9b8a('0x62')][_0x9b8a('0x5d')](db['sequelize']['fn'](_0x9b8a('0x63'),db[_0x9b8a('0x62')][_0x9b8a('0x64')](_0x562ec6[_0x9b8a('0x46')])),{'$like':db[_0x9b8a('0x62')]['fn'](_0x9b8a('0x63'),'%'+_0x4f5895[_0x9b8a('0x52')][_0x9b8a('0x41')]+'%')});}})});}_0x7ea593=_[_0x9b8a('0x5f')]({},_0x7ea593,_0x4f5895['options']);var _0x513455={'where':_0x7ea593[_0x9b8a('0x5d')]};return db[_0x9b8a('0x4b')][_0x9b8a('0x65')](_0x513455)[_0x9b8a('0x37')](function(_0xe04338){_0x41f2a4[_0x9b8a('0x65')]=_0xe04338;if(_0x4f5895[_0x9b8a('0x52')]['includeAll']){_0x7ea593[_0x9b8a('0x66')]=[{'all':!![]}];}return db[_0x9b8a('0x4b')][_0x9b8a('0x67')](_0x7ea593);})[_0x9b8a('0x37')](function(_0x2e9ba3){_0x41f2a4[_0x9b8a('0x68')]=_0x2e9ba3;return _0x41f2a4;})[_0x9b8a('0x37')](respondWithFilteredResult(_0x3498db,_0x7ea593))['catch'](handleError(_0x3498db,null));};exports[_0x9b8a('0x69')]=function(_0x128e6d,_0x5e1402){var _0x440dc6={'raw':![],'where':{'id':_0x128e6d[_0x9b8a('0x6a')]['id']}},_0x3fae1d={};_0x3fae1d['model']=_['differenceBy'](_['keys'](db[_0x9b8a('0x4b')][_0x9b8a('0x4c')]),[_0x9b8a('0x50'),_0x9b8a('0x51')]);_0x3fae1d[_0x9b8a('0x52')]=_[_0x9b8a('0x53')](_0x128e6d['query']);_0x3fae1d[_0x9b8a('0x54')]=_[_0x9b8a('0x55')](_0x3fae1d[_0x9b8a('0x4e')],_0x3fae1d[_0x9b8a('0x52')]);_0x440dc6['attributes']=_[_0x9b8a('0x55')](_0x3fae1d[_0x9b8a('0x4e')],qs['fields'](_0x128e6d[_0x9b8a('0x52')][_0x9b8a('0x57')]));_0x440dc6[_0x9b8a('0x56')]=_0x440dc6[_0x9b8a('0x56')]['length']?_0x440dc6['attributes']:_0x3fae1d[_0x9b8a('0x4e')];if(_0x128e6d[_0x9b8a('0x52')][_0x9b8a('0x6b')]){_0x440dc6[_0x9b8a('0x66')]=[{'all':!![]}];}_0x440dc6=_['merge']({},_0x440dc6,_0x128e6d[_0x9b8a('0x6c')]);return db[_0x9b8a('0x4b')]['find'](_0x440dc6)[_0x9b8a('0x37')](handleEntityNotFound(_0x5e1402,null))[_0x9b8a('0x37')](respondWithResult(_0x5e1402,null))[_0x9b8a('0x2b')](handleError(_0x5e1402,null));};exports['update']=function(_0x538ac5,_0x1348fc){if(_0x538ac5['body']['id']){delete _0x538ac5[_0x9b8a('0x6d')]['id'];}delete _0x538ac5['body'][_0x9b8a('0x39')];return db[_0x9b8a('0x4b')][_0x9b8a('0x45')]({'where':{'id':_0x538ac5[_0x9b8a('0x6a')]['id']}})[_0x9b8a('0x37')](handleEntityNotFound(_0x1348fc,null))[_0x9b8a('0x37')](saveUpdates(_0x538ac5[_0x9b8a('0x6d')],null))[_0x9b8a('0x37')](respondWithResult(_0x1348fc,null))['catch'](handleError(_0x1348fc,null));};exports[_0x9b8a('0x6e')]=function(_0x44e78b,_0x38f41c){return db[_0x9b8a('0x4b')]['describe']()['then'](respondWithResult(_0x38f41c,null))[_0x9b8a('0x2b')](handleError(_0x38f41c,null));};exports[_0x9b8a('0x6f')]=function(_0x18c91e,_0x2a5acd,_0x2f5b3b){return db[_0x9b8a('0x4b')][_0x9b8a('0x45')]({'where':{'id':_0x18c91e[_0x9b8a('0x6a')]['id']}})['then'](handleEntityNotFound(_0x2a5acd,null))[_0x9b8a('0x37')](function(_0x1223ec){if(_0x1223ec){return _0x1223ec[_0x9b8a('0x6f')](_0x18c91e[_0x9b8a('0x6d')][_0x9b8a('0x70')],_[_0x9b8a('0x71')](_0x18c91e[_0x9b8a('0x6d')],['ids','id'])||{});}})['then'](respondWithResult(_0x2a5acd,null))[_0x9b8a('0x2b')](handleError(_0x2a5acd,null));};function validateUser(_0x46d346){return new BPromise(function(_0x563c70,_0x1802ad){if(_0x46d346[_0x9b8a('0x72')])return _0x563c70(_0x46d346);return db[_0x9b8a('0x73')][_0x9b8a('0x74')](0x1)[_0x9b8a('0x37')](function(_0x2059f1){if(_0x2059f1['securePassword'])authService[_0x9b8a('0x75')](_0x46d346['password']);db[_0x9b8a('0x4b')]['max'](_0x9b8a('0x72'))[_0x9b8a('0x37')](function(_0x119b64){if(_['isNil'](_0x119b64)){_0x46d346[_0x9b8a('0x72')]=_0x2059f1['min_internal']||0x1;return;}if(_['isNil'](_0x2059f1[_0x9b8a('0x76')])||_0x2059f1[_0x9b8a('0x76')]===_0x119b64){_0x46d346['internal']=_0x119b64+0x1;return;}if(_0x2059f1[_0x9b8a('0x76')]>_0x119b64){_0x46d346['internal']=_0x2059f1[_0x9b8a('0x76')];return;}return db[_0x9b8a('0x62')][_0x9b8a('0x52')](_0x9b8a('0x77'),{'type':db[_0x9b8a('0x62')][_0x9b8a('0x78')]['SELECT']})['then'](function(_0x23c4b5){if(_0x23c4b5&&_0x23c4b5[_0x9b8a('0x58')]){for(var _0x28965c=0x0,_0x51e87b=_0x23c4b5[_0x9b8a('0x58')];_0x28965c<_0x51e87b&&_[_0x9b8a('0x79')](_0x46d346[_0x9b8a('0x72')]);_0x28965c++){if(_0x2059f1[_0x9b8a('0x76')]<=_0x23c4b5[_0x28965c]['from']){_0x46d346[_0x9b8a('0x72')]=_0x23c4b5[_0x28965c][_0x9b8a('0x7a')];}else if(_0x2059f1[_0x9b8a('0x76')]>_0x23c4b5[_0x28965c][_0x9b8a('0x7a')]&&_0x2059f1[_0x9b8a('0x76')]<=_0x23c4b5[_0x28965c]['to']){_0x46d346['internal']=_0x2059f1[_0x9b8a('0x76')];}}}if(_[_0x9b8a('0x79')](_0x46d346[_0x9b8a('0x72')])){_0x46d346[_0x9b8a('0x72')]=_0x119b64+0x1;}return _0x563c70(_0x46d346);});});})[_0x9b8a('0x2b')](function(_0x96c9ab){_0x1802ad(_0x96c9ab);});});}function updateUser(_0x363df7){return new BPromise(function(_0x415f1d,_0x4076b3){try{if(_0x363df7['voicemail']){_0x363df7[_0x9b8a('0x7b')]=_0x363df7[_0x9b8a('0x72')];_0x363df7['VoiceMail']={'mailbox':_0x363df7[_0x9b8a('0x72')],'password':_0x363df7['password'],'fullname':_0x363df7[_0x9b8a('0x7c')],'email':_0x363df7[_0x9b8a('0x7d')]};}if(_0x363df7[_0x9b8a('0x39')]===_0x9b8a('0x3e')){if(!_0x363df7[_0x9b8a('0x7e')])_0x363df7['permissions']=['101',_0x9b8a('0x7f'),_0x9b8a('0x80'),_0x9b8a('0x81'),_0x9b8a('0x82'),_0x9b8a('0x83'),_0x9b8a('0x84'),_0x9b8a('0x85'),'107',_0x9b8a('0x86'),_0x9b8a('0x87'),'100',_0x9b8a('0x88'),_0x9b8a('0x89'),_0x9b8a('0x8a')];}_0x415f1d(_0x363df7);}catch(_0x846fb){_0x4076b3(_0x846fb);}});}exports[_0x9b8a('0x8b')]=function(_0x2e5027,_0xd0d79a){if(_0x2e5027[_0x9b8a('0x3c')][_0x9b8a('0x39')]===_0x9b8a('0x3e'))throw new Error(_0x9b8a('0x8c'));if(_0x2e5027[_0x9b8a('0x6d')][_0x9b8a('0x39')]===_0x9b8a('0x3c')&&_0x2e5027[_0x9b8a('0x3c')]['role']!==_0x9b8a('0x3a')){throw new Error(_0x9b8a('0x8d'));}if(_0x2e5027['body']['role']===_0x9b8a('0x3a')&&_0x2e5027[_0x9b8a('0x3c')][_0x9b8a('0x39')]!=='admin'){throw new Error(_0x9b8a('0x8e'));}return licenseUtil['checkUserLimits']([_0x2e5027[_0x9b8a('0x6d')]])['then'](function(){return validateUser(_0x2e5027['body']);})[_0x9b8a('0x37')](function(_0x197d92){return updateUser(_0x197d92)[_0x9b8a('0x37')](function(_0x326ecc){if(_0x326ecc[_0x9b8a('0x39')]===_0x9b8a('0x3a')){_0x326ecc['settingsEnabled']=_0x2e5027['user'][_0x9b8a('0x8f')];delete _0x326ecc[_0x9b8a('0x90')];}return _0x326ecc;});})[_0x9b8a('0x37')](function(_0x3db787){return db[_0x9b8a('0x4b')][_0x9b8a('0x8b')](_0x3db787,{'include':[{'model':db[_0x9b8a('0x91')],'as':_0x9b8a('0x91')}]});})[_0x9b8a('0x37')](function(_0xe5678e){if(_0x2e5027['body'][_0x9b8a('0x39')]===_0x9b8a('0x3c'))return _0xe5678e;if(_0x2e5027[_0x9b8a('0x3c')][_0x9b8a('0x39')]!==_0x9b8a('0x3c'))return _0xe5678e;return db[_0x9b8a('0x92')][_0x9b8a('0x45')]({'where':{'name':_0xe5678e[_0x9b8a('0x39')]===_0x9b8a('0x3e')?_0x9b8a('0x3d'):_0x9b8a('0x3f'),'userProfileId':_0x2e5027['user']['userProfileId']},'raw':!![]})['then'](function(_0x7adfc1){if(!_0x7adfc1||_0x7adfc1['autoAssociation']!=0x0)return _0xe5678e;return db[_0x9b8a('0x93')][_0x9b8a('0x8b')]({'name':_0xe5678e[_0x9b8a('0x46')],'resourceId':_0xe5678e['id'],'type':_0x7adfc1[_0x9b8a('0x46')],'sectionId':_0x7adfc1['id']},{})[_0x9b8a('0x37')](function(){return _0xe5678e;});})[_0x9b8a('0x2b')](function(_0x54951a){logger[_0x9b8a('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54951a);throw _0x54951a;});})[_0x9b8a('0x37')](respondWithResult(_0xd0d79a,0xc9))['catch'](handleError(_0xd0d79a,null));};exports[_0x9b8a('0x94')]=function(_0x26a815,_0x30bff2){var _0x5dbb07=_0x26a815[_0x9b8a('0x6d')];var _0x35984e=[];if(_0x26a815[_0x9b8a('0x3c')][_0x9b8a('0x39')]===_0x9b8a('0x3e'))throw new Error(_0x9b8a('0x8c'));if(_[_0x9b8a('0x95')](_0x5dbb07,[_0x9b8a('0x39'),_0x9b8a('0x3c')])&&_0x26a815[_0x9b8a('0x3c')][_0x9b8a('0x39')]!=='admin'){throw new Error(_0x9b8a('0x8d'));}if(_[_0x9b8a('0x95')](_0x5dbb07,[_0x9b8a('0x39'),'admin'])&&_0x26a815[_0x9b8a('0x3c')][_0x9b8a('0x39')]!=='admin'){throw new Error(_0x9b8a('0x96'));}return licenseUtil[_0x9b8a('0x97')](_0x5dbb07)['then'](function(){return validateUser(_0x5dbb07[0x0]);})[_0x9b8a('0x37')](function(){for(var _0x918a7d=0x1;_0x918a7d<_0x5dbb07[_0x9b8a('0x58')];_0x918a7d++){var _0x3c2f0d=_0x5dbb07[_0x918a7d-0x1]['internal'];if(!_0x5dbb07[_0x918a7d]['internal'])_0x5dbb07[_0x918a7d][_0x9b8a('0x72')]=_0x3c2f0d+0x1;_0x35984e[_0x9b8a('0x98')](validateUser(_0x5dbb07[_0x918a7d]));}return BPromise[_0x9b8a('0x99')](_0x35984e);})[_0x9b8a('0x37')](function(){_0x35984e=[];for(var _0x415353=0x0;_0x415353<_0x5dbb07[_0x9b8a('0x58')];_0x415353++){_0x35984e['push'](updateUser(_0x5dbb07[_0x415353]));}return BPromise[_0x9b8a('0x99')](_0x35984e);})[_0x9b8a('0x37')](function(){return BPromise[_0x9b8a('0x9a')](_0x5dbb07,function(_0x3a64b1){return db['User'][_0x9b8a('0x8b')](_0x3a64b1,{'include':[{'model':db[_0x9b8a('0x91')],'as':_0x9b8a('0x91')}]})[_0x9b8a('0x37')](function(_0x377197){_0x3a64b1['id']=_0x377197['id'];return _0x3a64b1;});});})[_0x9b8a('0x37')](function(_0x301294){if(_0x26a815[_0x9b8a('0x6d')]['role']===_0x9b8a('0x3c'))return _0x301294;if(_0x26a815[_0x9b8a('0x3c')][_0x9b8a('0x39')]!==_0x9b8a('0x3c'))return _0x301294;var _0x100499=_[_0x9b8a('0x95')](_0x301294,function(_0xaed79e){return _0xaed79e['role']===_0x9b8a('0x3e')||_0xaed79e[_0x9b8a('0x39')]===_0x9b8a('0x40');});if(!_0x100499)return _0x301294;return db[_0x9b8a('0x92')][_0x9b8a('0x67')]({'where':{'name':{'$or':[_0x9b8a('0x3d'),_0x9b8a('0x3f')]},'userProfileId':_0x26a815['user'][_0x9b8a('0x90')]},'raw':!![]})[_0x9b8a('0x37')](function(_0x4b0703){if(_[_0x9b8a('0x9b')](_0x4b0703)||!_['some'](_0x4b0703,[_0x9b8a('0x9c'),0x0]))return _0x301294;_0x35984e=[];var _0x1eab0d=_(_0x4b0703)[_0x9b8a('0x4a')](function(_0x178d16){if(_0x178d16['autoAssociation']===0x1)return;return _0x178d16[_0x9b8a('0x46')]==='Agents'?_0x9b8a('0x3e'):_0x9b8a('0x40');})[_0x9b8a('0x9d')]()['value']();for(var _0x5775f6=0x0;_0x5775f6<_0x301294[_0x9b8a('0x58')];_0x5775f6++){if(!_[_0x9b8a('0x44')](_0x1eab0d,_0x301294[_0x5775f6][_0x9b8a('0x39')]))return;var _0x5578b5=_0x301294[_0x5775f6][_0x9b8a('0x39')]===_0x9b8a('0x3e')?'Agents':_0x9b8a('0x3f');_0x35984e['push'](db['UserProfileResource'][_0x9b8a('0x8b')]({'name':_0x301294[_0x5775f6][_0x9b8a('0x46')],'resourceId':_0x301294[_0x5775f6]['id'],'type':_0x5578b5,'sectionId':_['find'](_0x4b0703,['name',_0x5578b5])['id']},{}));}return BPromise['all'](_0x35984e);});})[_0x9b8a('0x37')](respondWithResult(_0x30bff2,0xc9))[_0x9b8a('0x2b')](handleError(_0x30bff2,null));};exports[_0x9b8a('0x9e')]=function(_0x1068a1,_0xdb24a6,_0x3620d7){if(_0x1068a1[_0x9b8a('0x6d')]['id']){delete _0x1068a1[_0x9b8a('0x6d')]['id'];}return db['User'][_0x9b8a('0x45')]({'where':{'id':_0x1068a1['params']['id']}})['then'](function(_0x21485d){if(!_0x21485d)return null;if(_0x21485d['id']===_0x1068a1[_0x9b8a('0x3c')]['id']){if(!_0x1068a1[_0x9b8a('0x6d')][_0x9b8a('0x9f')]||!_0x1068a1[_0x9b8a('0x6d')][_0x9b8a('0xa0')]){throw new db[(_0x9b8a('0xa1'))][(_0x9b8a('0xa2'))](_0x9b8a('0xa3'));}if(!_0x21485d[_0x9b8a('0xa4')](_0x1068a1[_0x9b8a('0x6d')][_0x9b8a('0x9f')])){throw new db[(_0x9b8a('0xa1'))][(_0x9b8a('0xa2'))](_0x9b8a('0xa5'));}if(_0x1068a1['body'][_0x9b8a('0x9f')]===_0x1068a1['body'][_0x9b8a('0xa0')]){throw new db[(_0x9b8a('0xa1'))]['ValidationError'](_0x9b8a('0xa6'));}}else if(_0x1068a1['user'][_0x9b8a('0x39')]===_0x9b8a('0x3a')){if(!_0x1068a1[_0x9b8a('0x6d')][_0x9b8a('0xa0')]){throw new db[(_0x9b8a('0xa1'))]['ValidationError'](_0x9b8a('0xa7'));}}else if(_0x1068a1[_0x9b8a('0x3c')][_0x9b8a('0x39')]==='user'){if(!_0x1068a1['body'][_0x9b8a('0xa0')]){throw new db[(_0x9b8a('0xa1'))][(_0x9b8a('0xa2'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x21485d[_0x9b8a('0x39')]!=='agent'){throw new db['Sequelize']['ValidationError'](_0x9b8a('0x8c'));}}else{throw new db[(_0x9b8a('0xa1'))]['ValidationError']('Unauthorized');}return _0x21485d;})[_0x9b8a('0x37')](handleEntityNotFound(_0xdb24a6,null))[_0x9b8a('0x37')](function(_0x2eacab){return db[_0x9b8a('0x73')][_0x9b8a('0xa8')]({'attributes':['id',_0x9b8a('0xa9'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x9b8a('0x37')](function(_0x1fc6b1){if(_0x1fc6b1['securePassword'])authService[_0x9b8a('0x75')](_0x1068a1[_0x9b8a('0x6d')]['newPassword']);if(!_0x1fc6b1['enforcePasswordHistory']||!_0x2eacab['previousPasswords'])return _0x2eacab;authService['validatePasswordHistory'](_0x1068a1[_0x9b8a('0x6d')][_0x9b8a('0xa0')],_0x2eacab[_0x9b8a('0xaa')],_0x1fc6b1[_0x9b8a('0xab')]);return _0x2eacab;})['then'](saveUpdates({'password':_0x1068a1[_0x9b8a('0x6d')]['newPassword'],'passwordResetAt':_0x1068a1[_0x9b8a('0x3c')]['id']==_0x1068a1['params']['id']?moment():null,'previousPasswords':authService[_0x9b8a('0xac')](_0x1068a1['body'][_0x9b8a('0xa0')],_0x2eacab[_0x9b8a('0xaa')])},null));})[_0x9b8a('0x37')](respondWithResult(_0xdb24a6,null))['catch'](handleError(_0xdb24a6,null));};exports[_0x9b8a('0xad')]=function(_0x1ff8fd,_0x2f0df1,_0x1a61e7){var _0x1c4905=_0x1ff8fd['body'][_0x9b8a('0xae')];return db[_0x9b8a('0x4b')][_0x9b8a('0x45')]({'where':{'id':_0x1ff8fd[_0x9b8a('0x6a')]['id']},'attributes':['id',_0x9b8a('0x46'),_0x9b8a('0x39'),_0x9b8a('0xaf'),_0x9b8a('0xb0'),_0x9b8a('0xb1'),'interface']})[_0x9b8a('0x37')](handleEntityNotFound(_0x2f0df1,null))[_0x9b8a('0x37')](function(_0x44b45b){if(_0x44b45b){if(!utils[_0x9b8a('0xb2')](_0x1c4905)){throw new db[(_0x9b8a('0xa1'))][(_0x9b8a('0xa2'))](_0x9b8a('0xb3'));}return _0x44b45b[_0x9b8a('0xb4')+_[_0x9b8a('0xb5')](_0x1c4905[_0x9b8a('0xb6')]())+_0x9b8a('0xb7')](_0x1ff8fd[_0x9b8a('0x6d')][_0x9b8a('0x70')],{'penalty':_0x1ff8fd[_0x9b8a('0x6d')][_0x9b8a('0xb8')]||0x0})[_0x9b8a('0xb9')](function(_0x4610db){for(var _0xe2ff24=0x0;_0xe2ff24<_0x1ff8fd[_0x9b8a('0x6d')][_0x9b8a('0x70')][_0x9b8a('0x58')];_0xe2ff24+=0x1){var _0x193e2d={'UserId':_0x1ff8fd[_0x9b8a('0x6a')]['id']};_0x193e2d[_[_0x9b8a('0xb5')](_0x1c4905[_0x9b8a('0xb6')]())+'QueueId']=_0x1ff8fd[_0x9b8a('0x6d')][_0x9b8a('0x70')][_0xe2ff24];socket[_0x9b8a('0xba')](_0x9b8a('0x3c')+_[_0x9b8a('0xb5')](_0x1c4905[_0x9b8a('0xb6')]())+'Queue:save',_0x193e2d);}return _0x4610db;})[_0x9b8a('0x37')](function(){if(_0x1c4905===_0x9b8a('0xbb')){return db[_0x9b8a('0xbc')][_0x9b8a('0x67')]({'where':{'id':_0x1ff8fd[_0x9b8a('0x6d')][_0x9b8a('0x70')]||[]},'raw':!![],'attributes':['id',_0x9b8a('0x46')]});}})['then'](function(_0x1abf00){var _0x53962a=_0x44b45b[_0x9b8a('0x38')]({'plain':!![]});var _0x305511=[];if(_0x1c4905===_0x9b8a('0xbb')&&_0x53962a['role']===_0x9b8a('0x3e')&&_0x53962a[_0x9b8a('0xaf')]){for(var _0x47fb73=0x0;_0x47fb73<_0x1abf00[_0x9b8a('0x58')];_0x47fb73+=0x1){_0x305511[_0x9b8a('0x98')]({'membername':_0x53962a['name'],'UserId':_0x53962a['id'],'queue_name':_0x1abf00[_0x47fb73][_0x9b8a('0x46')],'VoiceQueueId':_0x1abf00[_0x47fb73]['id'],'interface':_[_0x9b8a('0x79')](_0x53962a[_0x9b8a('0xbd')])?util[_0x9b8a('0xbe')]('SIP/%s',_0x53962a[_0x9b8a('0x46')]):_0x53962a[_0x9b8a('0xbd')],'paused':_0x53962a[_0x9b8a('0xb1')]||![],'penalty':_0x1ff8fd['body']['penalty']||0x0});}return BPromise[_0x9b8a('0x9a')](_0x305511,function(_0xfbe58){return db['UserVoiceQueueRt'][_0x9b8a('0xbf')](_0xfbe58);});}return _0x44b45b;});}})[_0x9b8a('0x37')](respondWithStatusCode(_0x2f0df1,null))['catch'](handleError(_0x2f0df1,null));};exports[_0x9b8a('0xc0')]=function(_0x12e196,_0x430bf5,_0x5c4797){var _0xee6594;return db[_0x9b8a('0x4b')]['find']({'where':{'id':_0x12e196['params']['id']},'attributes':['id','name',_0x9b8a('0x39')]})[_0x9b8a('0x37')](handleEntityNotFound(_0x430bf5,null))[_0x9b8a('0x37')](function(_0x2e84d8){if(_0x2e84d8){_0xee6594=_0x2e84d8;if(!_0x12e196[_0x9b8a('0x52')]['channel']||!utils[_0x9b8a('0xb2')](_0x12e196[_0x9b8a('0x52')][_0x9b8a('0xae')])){throw new db[(_0x9b8a('0xa1'))][(_0x9b8a('0xa2'))](_0x9b8a('0xb3'));}return _0x2e84d8['remove'+_[_0x9b8a('0xb5')](_0x12e196[_0x9b8a('0x52')]['channel'][_0x9b8a('0xb6')]())+_0x9b8a('0xb7')](_0x12e196[_0x9b8a('0x52')][_0x9b8a('0x70')]);}})[_0x9b8a('0x37')](function(_0x44a340){for(var _0x167e5c=0x0;_0x167e5c<_0x12e196[_0x9b8a('0x52')][_0x9b8a('0x70')][_0x9b8a('0x58')];_0x167e5c+=0x1){var _0x5b4043={'UserId':_0x12e196['params']['id']};_0x5b4043[_['capitalize'](_0x12e196[_0x9b8a('0x52')][_0x9b8a('0xae')][_0x9b8a('0xb6')]())+'QueueId']=_0x12e196['query'][_0x9b8a('0x70')][_0x167e5c];socket[_0x9b8a('0xba')](_0x9b8a('0x3c')+_[_0x9b8a('0xb5')](_0x12e196[_0x9b8a('0x52')][_0x9b8a('0xae')][_0x9b8a('0xb6')]())+_0x9b8a('0xc1'),_0x5b4043);}return _0x44a340;})[_0x9b8a('0x37')](function(){if(_0x12e196['query'][_0x9b8a('0xae')]===_0x9b8a('0xbb')){return db[_0x9b8a('0xc2')][_0x9b8a('0x47')]({'where':{'UserId':_0x12e196[_0x9b8a('0x6a')]['id'],'VoiceQueueId':_0x12e196[_0x9b8a('0x52')][_0x9b8a('0x70')]},'individualHooks':!![]})['then'](function(){return _0xee6594;});}return _0xee6594;})[_0x9b8a('0x37')](respondWithStatusCode(_0x430bf5,null))[_0x9b8a('0x2b')](handleError(_0x430bf5,null));};exports[_0x9b8a('0xc3')]=function(_0x108a50,_0x4e54f9,_0x177ebf){_0x108a50['body'][_0x9b8a('0xc4')]=_0x108a50['file'][_0x9b8a('0xc5')];return db[_0x9b8a('0x4b')][_0x9b8a('0x45')]({'where':{'id':_0x108a50[_0x9b8a('0x6a')]['id']}})[_0x9b8a('0x37')](handleEntityNotFound(_0x4e54f9,null))[_0x9b8a('0x37')](saveUpdates(_0x108a50['body'],null))['then'](respondWithResult(_0x4e54f9,null))[_0x9b8a('0x2b')](handleError(_0x4e54f9,null));};exports[_0x9b8a('0xc6')]=function(_0x3c6a1c,_0x2b5224,_0x39ee25){var _0x52740e=path[_0x9b8a('0xc7')](config['root'],_0x9b8a('0xc8'));return db[_0x9b8a('0x4b')][_0x9b8a('0x45')]({'where':{'id':_0x3c6a1c[_0x9b8a('0x6a')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x9b8a('0x37')](handleEntityNotFound(_0x2b5224,null))[_0x9b8a('0x37')](function(_0x5b9e48){if(_0x5b9e48){if(_['isNil'](_0x5b9e48[_0x9b8a('0xc4')])){return _0x2b5224[_0x9b8a('0xc9')](_0x52740e);}else{if(!fs[_0x9b8a('0xca')](path['join'](config[_0x9b8a('0xcb')],_0x9b8a('0xcc'),_0x5b9e48[_0x9b8a('0xc4')]))){return _0x2b5224[_0x9b8a('0xc9')](_0x52740e);}return _0x2b5224[_0x9b8a('0xc9')](path[_0x9b8a('0xc7')](config[_0x9b8a('0xcb')],'server/files/images/',_0x5b9e48[_0x9b8a('0xc4')]));}}})[_0x9b8a('0x2b')](handleError(_0x2b5224,null));};exports[_0x9b8a('0xcd')]=function(_0x1f143f,_0x57e4de,_0x4806e0){var _0x43416c={};var _0x40df53={};var _0x2194a9;var _0xeebe79;return db[_0x9b8a('0x4b')]['findOne']({'where':{'id':_0x1f143f[_0x9b8a('0x6a')]['id']}})['then'](handleEntityNotFound(_0x57e4de,null))[_0x9b8a('0x37')](function(_0x16d887){if(_0x16d887){_0x2194a9=_0x16d887;_0x40df53[_0x9b8a('0x4e')]=_['keys'](db[_0x9b8a('0xce')][_0x9b8a('0x4c')]);_0x40df53[_0x9b8a('0x52')]=_['keys'](_0x1f143f[_0x9b8a('0x52')]);_0x40df53[_0x9b8a('0x54')]=_[_0x9b8a('0x55')](_0x40df53['model'],_0x40df53['query']);_0x43416c[_0x9b8a('0x56')]=_['intersection'](_0x40df53['model'],qs[_0x9b8a('0x57')](_0x1f143f['query'][_0x9b8a('0x57')]));_0x43416c[_0x9b8a('0x56')]=_0x43416c[_0x9b8a('0x56')][_0x9b8a('0x58')]?_0x43416c[_0x9b8a('0x56')]:_0x40df53[_0x9b8a('0x4e')];_0x43416c[_0x9b8a('0x5b')]=qs[_0x9b8a('0x5c')](_0x1f143f[_0x9b8a('0x52')][_0x9b8a('0x5c')]);_0x43416c[_0x9b8a('0x5d')]=qs['filters'](_[_0x9b8a('0x5e')](_0x1f143f[_0x9b8a('0x52')],_0x40df53[_0x9b8a('0x54')]));if(_0x1f143f['query'][_0x9b8a('0x41')]){_0x43416c[_0x9b8a('0x5d')]=_[_0x9b8a('0x5f')](_0x43416c[_0x9b8a('0x5d')],{'$or':_[_0x9b8a('0x4a')](_0x43416c[_0x9b8a('0x56')],function(_0x3d40c3){var _0x5ed02e={};_0x5ed02e[_0x3d40c3]={'$like':'%'+_0x1f143f['query'][_0x9b8a('0x41')]+'%'};return _0x5ed02e;})});}_0x43416c=_[_0x9b8a('0x5f')]({},_0x43416c,_0x1f143f[_0x9b8a('0x6c')]);return _0x2194a9[_0x9b8a('0xcd')](_0x43416c);}})[_0x9b8a('0x37')](function(_0x110033){if(_0x110033){_0xeebe79=_0x110033[_0x9b8a('0x58')];if(_0x1f143f[_0x9b8a('0x52')][_0x9b8a('0x59')]('includeAll')){_0x43416c[_0x9b8a('0x66')]=[{'model':db[_0x9b8a('0xcf')],'as':'List','required':![]},{'model':db['Tag'],'as':_0x9b8a('0xd0'),'attributes':['id',_0x9b8a('0x46'),_0x9b8a('0xd1')],'where':_0x1f143f['query'][_0x9b8a('0xd2')]?{'id':_0x1f143f[_0x9b8a('0x52')][_0x9b8a('0xd2')]}:undefined,'required':_0x1f143f['query'][_0x9b8a('0xd2')]?!![]:![]}];}if(!_0x1f143f[_0x9b8a('0x52')][_0x9b8a('0x59')](_0x9b8a('0x5a'))){_0x43416c[_0x9b8a('0x30')]=qs[_0x9b8a('0x30')](_0x1f143f[_0x9b8a('0x52')][_0x9b8a('0x30')]);_0x43416c[_0x9b8a('0x2f')]=qs['offset'](_0x1f143f[_0x9b8a('0x52')]['offset']);}return _0x2194a9[_0x9b8a('0xcd')](_0x43416c);}})[_0x9b8a('0x37')](function(_0x4b6c24){if(_0x4b6c24){return _0x4b6c24?{'count':_0xeebe79,'rows':_0x4b6c24}:null;}})['then'](respondWithResult(_0x57e4de,null))[_0x9b8a('0x2b')](handleError(_0x57e4de,null));};exports['getQueues']=function(_0x3e74ba,_0x54b87f,_0x4c8e23){var _0x1d0721;var _0x1fae86;var _0x8f579a={};var _0x3b03af;return db[_0x9b8a('0x4b')]['findOne']({'where':{'id':_0x3e74ba[_0x9b8a('0x6a')]['id']},'attributes':['id',_0x9b8a('0x46'),_0x9b8a('0x39')]})['then'](handleEntityNotFound(_0x54b87f,null))[_0x9b8a('0x37')](function(_0x34d454){if(!utils['isValidChannel'](_0x3e74ba[_0x9b8a('0x52')][_0x9b8a('0xae')])){throw new db[(_0x9b8a('0xa1'))][(_0x9b8a('0xa2'))](_0x9b8a('0xb3'));}_0x1d0721=_0x34d454;var _0x491939={};_0x491939['model']=_[_0x9b8a('0x53')](db[_[_0x9b8a('0xb5')](_0x3e74ba['query'][_0x9b8a('0xae')])+'Queue'][_0x9b8a('0x4c')]);_0x491939[_0x9b8a('0x52')]=_['keys'](_0x3e74ba[_0x9b8a('0x52')]);_0x491939[_0x9b8a('0x54')]=_[_0x9b8a('0x55')](_0x491939[_0x9b8a('0x4e')],_0x491939[_0x9b8a('0x52')]);_0x8f579a[_0x9b8a('0x56')]=_[_0x9b8a('0x55')](_0x491939['model'],qs[_0x9b8a('0x57')](_0x3e74ba[_0x9b8a('0x52')][_0x9b8a('0x57')]));_0x8f579a[_0x9b8a('0x56')]=_0x8f579a[_0x9b8a('0x56')][_0x9b8a('0x58')]?_0x8f579a[_0x9b8a('0x56')]:_0x491939['model'];_0x8f579a[_0x9b8a('0x5b')]=qs[_0x9b8a('0x5c')](_0x3e74ba[_0x9b8a('0x52')]['sort']);_0x8f579a['where']=qs[_0x9b8a('0x54')](_[_0x9b8a('0x5e')](_0x3e74ba['query'],_0x491939[_0x9b8a('0x54')]));if(_0x3e74ba['query'][_0x9b8a('0x41')]){_0x8f579a[_0x9b8a('0x5d')]=_[_0x9b8a('0x5f')](_0x8f579a[_0x9b8a('0x5d')],{'$or':_[_0x9b8a('0x4a')](_0x8f579a['attributes'],function(_0xb5531c){var _0x32b589={};_0x32b589[_0xb5531c]={'$like':'%'+_0x3e74ba['query'][_0x9b8a('0x41')]+'%'};return _0x32b589;})});}_0x8f579a=_[_0x9b8a('0x5f')]({},_0x8f579a,_0x3e74ba['options']);switch(_0x1d0721[_0x9b8a('0x39')]){case'admin':return db[_[_0x9b8a('0xb5')](_0x3e74ba[_0x9b8a('0x52')]['channel'])+'Queue'][_0x9b8a('0x67')](_0x8f579a);case _0x9b8a('0x3c'):case _0x9b8a('0x3e'):return _0x1d0721[_0x9b8a('0x38')+_['capitalize'](_0x3e74ba[_0x9b8a('0x52')][_0x9b8a('0xae')])+'Queues'](_0x8f579a);default:throw new db[(_0x9b8a('0xa1'))][(_0x9b8a('0xa2'))](_0x9b8a('0xd3'));}})[_0x9b8a('0x37')](function(_0x8f4942){_0x3b03af=_0x8f4942[_0x9b8a('0x58')];if(!_0x3e74ba[_0x9b8a('0x52')]['hasOwnProperty'](_0x9b8a('0x5a'))){_0x8f579a[_0x9b8a('0x30')]=qs['limit'](_0x3e74ba['query']['limit']);_0x8f579a['offset']=qs['offset'](_0x3e74ba[_0x9b8a('0x52')][_0x9b8a('0x2f')]);}switch(_0x1d0721[_0x9b8a('0x39')]){case _0x9b8a('0x3a'):return db[_[_0x9b8a('0xb5')](_0x3e74ba['query'][_0x9b8a('0xae')])+'Queue'][_0x9b8a('0x67')](_0x8f579a);case'user':case _0x9b8a('0x3e'):return _0x1d0721[_0x9b8a('0x38')+_[_0x9b8a('0xb5')](_0x3e74ba['query']['channel'])+_0x9b8a('0xb7')](_0x8f579a);}})[_0x9b8a('0x37')](function(_0x8244c){return{'count':_0x3b03af,'rows':_0x8244c};})['then'](respondWithResult(_0x54b87f,null))[_0x9b8a('0x2b')](handleError(_0x54b87f,null));};exports[_0x9b8a('0xd4')]=function(_0x1bbe3e,_0x1625e2,_0x5ec321){var _0x25b3ed={};var _0x41623e={};var _0x6e2e6;var _0x48b458;return db['User'][_0x9b8a('0xa8')]({'where':{'id':_0x1bbe3e[_0x9b8a('0x6a')]['id']}})[_0x9b8a('0x37')](handleEntityNotFound(_0x1625e2,null))[_0x9b8a('0x37')](function(_0x3a56c1){if(_0x3a56c1){_0x6e2e6=_0x3a56c1;_0x41623e[_0x9b8a('0x4e')]=_[_0x9b8a('0x53')](db[_0x9b8a('0xc2')][_0x9b8a('0x4c')]);_0x41623e[_0x9b8a('0x52')]=_[_0x9b8a('0x53')](_0x1bbe3e[_0x9b8a('0x52')]);_0x41623e[_0x9b8a('0x54')]=_[_0x9b8a('0x55')](_0x41623e[_0x9b8a('0x4e')],_0x41623e['query']);_0x25b3ed[_0x9b8a('0x56')]=_[_0x9b8a('0x55')](_0x41623e['model'],qs[_0x9b8a('0x57')](_0x1bbe3e[_0x9b8a('0x52')][_0x9b8a('0x57')]));_0x25b3ed['attributes']=_0x25b3ed['attributes'][_0x9b8a('0x58')]?_0x25b3ed[_0x9b8a('0x56')]:_0x41623e['model'];_0x25b3ed[_0x9b8a('0x5b')]=qs['sort'](_0x1bbe3e[_0x9b8a('0x52')]['sort']);_0x25b3ed[_0x9b8a('0x5d')]=qs['filters'](_['pick'](_0x1bbe3e[_0x9b8a('0x52')],_0x41623e[_0x9b8a('0x54')]));if(_0x1bbe3e['query'][_0x9b8a('0x41')]){_0x25b3ed['where']=_[_0x9b8a('0x5f')](_0x25b3ed[_0x9b8a('0x5d')],{'$or':_[_0x9b8a('0x4a')](_0x25b3ed['attributes'],function(_0x3afee1){var _0x41673f={};_0x41673f[_0x3afee1]={'$like':'%'+_0x1bbe3e[_0x9b8a('0x52')]['filter']+'%'};return _0x41673f;})});}_0x25b3ed=_[_0x9b8a('0x5f')]({},_0x25b3ed,_0x1bbe3e[_0x9b8a('0x6c')]);return _0x6e2e6['getVoiceQueuesRt'](_0x25b3ed);}})[_0x9b8a('0x37')](function(_0x4553fa){if(_0x4553fa){_0x48b458=_0x4553fa[_0x9b8a('0x58')];if(!_0x1bbe3e['query']['hasOwnProperty'](_0x9b8a('0x5a'))){_0x25b3ed[_0x9b8a('0x30')]=qs[_0x9b8a('0x30')](_0x1bbe3e[_0x9b8a('0x52')]['limit']);_0x25b3ed[_0x9b8a('0x2f')]=qs[_0x9b8a('0x2f')](_0x1bbe3e[_0x9b8a('0x52')]['offset']);}return _0x6e2e6[_0x9b8a('0xd4')](_0x25b3ed);}})[_0x9b8a('0x37')](function(_0x3f1523){if(_0x3f1523){return _0x3f1523?{'count':_0x48b458,'rows':_0x3f1523}:null;}})['then'](respondWithResult(_0x1625e2,null))[_0x9b8a('0x2b')](handleError(_0x1625e2,null));};exports['getGroups']=function(_0x58e5b9,_0x3433c4,_0x5288f4){var _0x195020={};var _0xe06d13={};var _0x6a2562;var _0xe16a72;return db[_0x9b8a('0x4b')][_0x9b8a('0xa8')]({'where':{'id':_0x58e5b9[_0x9b8a('0x6a')]['id']}})['then'](handleEntityNotFound(_0x3433c4,null))[_0x9b8a('0x37')](function(_0x5b5f5b){if(_0x5b5f5b){_0x6a2562=_0x5b5f5b;_0xe06d13[_0x9b8a('0x4e')]=_[_0x9b8a('0x53')](db[_0x9b8a('0xd5')][_0x9b8a('0x4c')]);_0xe06d13['query']=_[_0x9b8a('0x53')](_0x58e5b9[_0x9b8a('0x52')]);_0xe06d13[_0x9b8a('0x54')]=_['intersection'](_0xe06d13['model'],_0xe06d13[_0x9b8a('0x52')]);_0x195020[_0x9b8a('0x56')]=_['intersection'](_0xe06d13['model'],qs[_0x9b8a('0x57')](_0x58e5b9['query'][_0x9b8a('0x57')]));_0x195020[_0x9b8a('0x56')]=_0x195020['attributes'][_0x9b8a('0x58')]?_0x195020[_0x9b8a('0x56')]:_0xe06d13[_0x9b8a('0x4e')];_0x195020[_0x9b8a('0x5b')]=qs[_0x9b8a('0x5c')](_0x58e5b9[_0x9b8a('0x52')][_0x9b8a('0x5c')]);_0x195020[_0x9b8a('0x5d')]=qs[_0x9b8a('0x54')](_[_0x9b8a('0x5e')](_0x58e5b9[_0x9b8a('0x52')],_0xe06d13[_0x9b8a('0x54')]));if(_0x58e5b9['query'][_0x9b8a('0x41')]){_0x195020[_0x9b8a('0x5d')]=_['merge'](_0x195020[_0x9b8a('0x5d')],{'$or':_[_0x9b8a('0x4a')](_0x195020[_0x9b8a('0x56')],function(_0x45c16d){var _0x3efd14={};_0x3efd14[_0x45c16d]={'$like':'%'+_0x58e5b9['query'][_0x9b8a('0x41')]+'%'};return _0x3efd14;})});}_0x195020=_[_0x9b8a('0x5f')]({},_0x195020,_0x58e5b9['options']);return _0x6a2562['getGroups'](_0x195020);}})[_0x9b8a('0x37')](function(_0x2f5b5a){if(_0x2f5b5a){_0xe16a72=_0x2f5b5a['length'];if(!_0x58e5b9[_0x9b8a('0x52')][_0x9b8a('0x59')](_0x9b8a('0x5a'))){_0x195020[_0x9b8a('0x30')]=qs[_0x9b8a('0x30')](_0x58e5b9[_0x9b8a('0x52')][_0x9b8a('0x30')]);_0x195020[_0x9b8a('0x2f')]=qs[_0x9b8a('0x2f')](_0x58e5b9[_0x9b8a('0x52')]['offset']);}return _0x6a2562['getGroups'](_0x195020);}})[_0x9b8a('0x37')](function(_0x397f19){if(_0x397f19){return _0x397f19?{'count':_0xe16a72,'rows':_0x397f19}:null;}})[_0x9b8a('0x37')](respondWithResult(_0x3433c4,null))[_0x9b8a('0x2b')](handleError(_0x3433c4,null));};exports[_0x9b8a('0xd6')]=function(_0x4edde3,_0x578193,_0xcd4b99){var _0xf9e0fe={'raw':!![],'where':{}};var _0x26ca77={};var _0x498006={'count':0x0,'rows':[]};return db[_0x9b8a('0x4b')][_0x9b8a('0xa8')]({'where':{'id':_0x4edde3['params']['id']}})[_0x9b8a('0x37')](handleEntityNotFound(_0x578193,null))[_0x9b8a('0x37')](function(_0x579dc2){if(_0x579dc2){_0x26ca77[_0x9b8a('0x4e')]=_['keys'](db[_0x9b8a('0xd7')][_0x9b8a('0x4c')]);_0x26ca77[_0x9b8a('0x52')]=_['keys'](_0x4edde3['query']);_0x26ca77['filters']=_[_0x9b8a('0x55')](_0x26ca77[_0x9b8a('0x4e')],_0x26ca77['query']);_0xf9e0fe['attributes']=_[_0x9b8a('0x55')](_0x26ca77['model'],qs[_0x9b8a('0x57')](_0x4edde3[_0x9b8a('0x52')]['fields']));_0xf9e0fe[_0x9b8a('0x56')]=_0xf9e0fe[_0x9b8a('0x56')][_0x9b8a('0x58')]?_0xf9e0fe[_0x9b8a('0x56')]:_0x26ca77[_0x9b8a('0x4e')];if(!_0x4edde3[_0x9b8a('0x52')][_0x9b8a('0x59')](_0x9b8a('0x5a'))){_0xf9e0fe['limit']=qs[_0x9b8a('0x30')](_0x4edde3['query']['limit']);_0xf9e0fe[_0x9b8a('0x2f')]=qs[_0x9b8a('0x2f')](_0x4edde3[_0x9b8a('0x52')][_0x9b8a('0x2f')]);}_0xf9e0fe[_0x9b8a('0x5b')]=qs['sort'](_0x4edde3[_0x9b8a('0x52')]['sort']);_0xf9e0fe[_0x9b8a('0x5d')]=qs[_0x9b8a('0x54')](_[_0x9b8a('0x5e')](_0x4edde3['query'],_0x26ca77[_0x9b8a('0x54')]));_0xf9e0fe[_0x9b8a('0x5d')][_0x9b8a('0xd8')]=_0x579dc2['id'];if(_0x4edde3[_0x9b8a('0x52')][_0x9b8a('0x41')]){_0xf9e0fe[_0x9b8a('0x5d')]=_[_0x9b8a('0x5f')](_0xf9e0fe[_0x9b8a('0x5d')],{'$or':_[_0x9b8a('0x4a')](_0xf9e0fe[_0x9b8a('0x56')],function(_0x35d8a5){var _0x34b7fc={};_0x34b7fc[_0x35d8a5]={'$like':'%'+_0x4edde3['query'][_0x9b8a('0x41')]+'%'};return _0x34b7fc;})});}_0xf9e0fe=_[_0x9b8a('0x5f')]({},_0xf9e0fe,_0x4edde3[_0x9b8a('0x6c')]);return db[_0x9b8a('0xd7')]['count']({'where':_0xf9e0fe[_0x9b8a('0x5d')]})[_0x9b8a('0x37')](function(_0x5923f8){_0x498006[_0x9b8a('0x65')]=_0x5923f8;if(_0x4edde3['query'][_0x9b8a('0x6b')]){_0xf9e0fe[_0x9b8a('0x66')]=[{'all':!![]}];}return db[_0x9b8a('0xd7')][_0x9b8a('0x67')](_0xf9e0fe);})[_0x9b8a('0x37')](function(_0x306d93){_0x498006['rows']=_0x306d93;return _0x498006;});}})[_0x9b8a('0x37')](respondWithFilteredResult(_0x578193,_0xf9e0fe))[_0x9b8a('0x2b')](handleError(_0x578193,null));};exports['getScreenRecordings']=function(_0x3a8e49,_0x4764e5,_0x372c5b){var _0x4cb7fb={'raw':!![],'where':{}};var _0x2aabce={};var _0xc89353={'count':0x0,'rows':[]};return db[_0x9b8a('0x4b')][_0x9b8a('0xa8')]({'where':{'id':_0x3a8e49['params']['id']}})[_0x9b8a('0x37')](handleEntityNotFound(_0x4764e5,null))[_0x9b8a('0x37')](function(_0x4c4715){if(_0x4c4715){_0x2aabce[_0x9b8a('0x4e')]=_[_0x9b8a('0x53')](db[_0x9b8a('0xd9')]['rawAttributes']);_0x2aabce[_0x9b8a('0x52')]=_[_0x9b8a('0x53')](_0x3a8e49['query']);_0x2aabce[_0x9b8a('0x54')]=_['intersection'](_0x2aabce[_0x9b8a('0x4e')],_0x2aabce[_0x9b8a('0x52')]);_0x4cb7fb[_0x9b8a('0x56')]=_[_0x9b8a('0x55')](_0x2aabce['model'],qs[_0x9b8a('0x57')](_0x3a8e49[_0x9b8a('0x52')]['fields']));_0x4cb7fb[_0x9b8a('0x56')]=_0x4cb7fb['attributes'][_0x9b8a('0x58')]?_0x4cb7fb[_0x9b8a('0x56')]:_0x2aabce[_0x9b8a('0x4e')];if(!_0x3a8e49[_0x9b8a('0x52')][_0x9b8a('0x59')](_0x9b8a('0x5a'))){_0x4cb7fb[_0x9b8a('0x30')]=qs[_0x9b8a('0x30')](_0x3a8e49[_0x9b8a('0x52')][_0x9b8a('0x30')]);_0x4cb7fb['offset']=qs['offset'](_0x3a8e49[_0x9b8a('0x52')]['offset']);}_0x4cb7fb[_0x9b8a('0x5b')]=qs[_0x9b8a('0x5c')](_0x3a8e49['query'][_0x9b8a('0x5c')]);_0x4cb7fb[_0x9b8a('0x5d')]=qs[_0x9b8a('0x54')](_[_0x9b8a('0x5e')](_0x3a8e49[_0x9b8a('0x52')],_0x2aabce[_0x9b8a('0x54')]));_0x4cb7fb['where'][_0x9b8a('0xd8')]=_0x4c4715['id'];if(_0x3a8e49['query'][_0x9b8a('0x41')]){_0x4cb7fb[_0x9b8a('0x5d')]=_[_0x9b8a('0x5f')](_0x4cb7fb[_0x9b8a('0x5d')],{'$or':_[_0x9b8a('0x4a')](_0x4cb7fb['attributes'],function(_0x3f3693){var _0x33a20a={};_0x33a20a[_0x3f3693]={'$like':'%'+_0x3a8e49[_0x9b8a('0x52')][_0x9b8a('0x41')]+'%'};return _0x33a20a;})});}_0x4cb7fb=_[_0x9b8a('0x5f')]({},_0x4cb7fb,_0x3a8e49[_0x9b8a('0x6c')]);return db[_0x9b8a('0xd9')][_0x9b8a('0x65')]({'where':_0x4cb7fb[_0x9b8a('0x5d')]})[_0x9b8a('0x37')](function(_0x4a4eec){_0xc89353['count']=_0x4a4eec;if(_0x3a8e49[_0x9b8a('0x52')][_0x9b8a('0x6b')]){_0x4cb7fb[_0x9b8a('0x66')]=[{'all':!![]}];}return db[_0x9b8a('0xd9')][_0x9b8a('0x67')](_0x4cb7fb);})[_0x9b8a('0x37')](function(_0x52eee5){_0xc89353[_0x9b8a('0x68')]=_0x52eee5;return _0xc89353;});}})[_0x9b8a('0x37')](respondWithFilteredResult(_0x4764e5,_0x4cb7fb))[_0x9b8a('0x2b')](handleError(_0x4764e5,null));};exports[_0x9b8a('0xda')]=function(_0x36657c,_0x470371,_0x4eff06){var _0x283496={};var _0x5ddc57={};var _0x9527e3;var _0x1e0b75;return db[_0x9b8a('0x4b')][_0x9b8a('0xa8')]({'where':{'id':_0x36657c[_0x9b8a('0x6a')]['id']}})[_0x9b8a('0x37')](handleEntityNotFound(_0x470371,null))[_0x9b8a('0x37')](function(_0x51bc89){if(_0x51bc89){_0x9527e3=_0x51bc89;_0x5ddc57[_0x9b8a('0x4e')]=_[_0x9b8a('0x53')](db[_0x9b8a('0xdb')]['rawAttributes']);_0x5ddc57[_0x9b8a('0x52')]=_[_0x9b8a('0x53')](_0x36657c[_0x9b8a('0x52')]);_0x5ddc57[_0x9b8a('0x54')]=_[_0x9b8a('0x55')](_0x5ddc57['model'],_0x5ddc57['query']);_0x283496[_0x9b8a('0x56')]=_['intersection'](_0x5ddc57['model'],qs['fields'](_0x36657c[_0x9b8a('0x52')][_0x9b8a('0x57')]));_0x283496[_0x9b8a('0x56')]=_0x283496[_0x9b8a('0x56')][_0x9b8a('0x58')]?_0x283496[_0x9b8a('0x56')]:_0x5ddc57[_0x9b8a('0x4e')];_0x283496['order']=qs[_0x9b8a('0x5c')](_0x36657c['query']['sort']);_0x283496[_0x9b8a('0x5d')]=qs[_0x9b8a('0x54')](_[_0x9b8a('0x5e')](_0x36657c[_0x9b8a('0x52')],_0x5ddc57[_0x9b8a('0x54')]));if(_0x36657c['query'][_0x9b8a('0x41')]){_0x283496[_0x9b8a('0x5d')]=_['merge'](_0x283496['where'],{'$or':_[_0x9b8a('0x4a')](_0x283496[_0x9b8a('0x56')],function(_0x3e6405){var _0x34e009={};_0x34e009[_0x3e6405]={'$like':'%'+_0x36657c[_0x9b8a('0x52')][_0x9b8a('0x41')]+'%'};return _0x34e009;})});}_0x283496=_['merge']({},_0x283496,_0x36657c[_0x9b8a('0x6c')]);return _0x9527e3['getChatInteractions'](_0x283496);}})['then'](function(_0x1eca59){if(_0x1eca59){_0x1e0b75=_0x1eca59[_0x9b8a('0x58')];if(!_0x36657c[_0x9b8a('0x52')][_0x9b8a('0x59')]('nolimit')){_0x283496[_0x9b8a('0x30')]=qs[_0x9b8a('0x30')](_0x36657c[_0x9b8a('0x52')][_0x9b8a('0x30')]);_0x283496[_0x9b8a('0x2f')]=qs[_0x9b8a('0x2f')](_0x36657c[_0x9b8a('0x52')][_0x9b8a('0x2f')]);}return _0x9527e3['getChatInteractions'](_0x283496);}})[_0x9b8a('0x37')](function(_0x154b6d){if(_0x154b6d){return _0x154b6d?{'count':_0x1e0b75,'rows':_0x154b6d}:null;}})['then'](respondWithResult(_0x470371,null))['catch'](handleError(_0x470371,null));};exports[_0x9b8a('0xdc')]=function(_0x3cddcf,_0x3cce7b,_0x667b19){var _0x12c30a={};var _0x18d9be={};var _0x5618fc;var _0x526083;return db[_0x9b8a('0x4b')][_0x9b8a('0xa8')]({'where':{'id':_0x3cddcf['params']['id']}})['then'](handleEntityNotFound(_0x3cce7b,null))['then'](function(_0x830573){if(_0x830573){_0x5618fc=_0x830573;_0x18d9be[_0x9b8a('0x4e')]=_[_0x9b8a('0x53')](db[_0x9b8a('0xdd')][_0x9b8a('0x4c')]);_0x18d9be[_0x9b8a('0x52')]=_[_0x9b8a('0x53')](_0x3cddcf[_0x9b8a('0x52')]);_0x18d9be[_0x9b8a('0x54')]=_[_0x9b8a('0x55')](_0x18d9be[_0x9b8a('0x4e')],_0x18d9be[_0x9b8a('0x52')]);_0x12c30a[_0x9b8a('0x56')]=_['intersection'](_0x18d9be[_0x9b8a('0x4e')],qs['fields'](_0x3cddcf[_0x9b8a('0x52')][_0x9b8a('0x57')]));_0x12c30a['attributes']=_0x12c30a[_0x9b8a('0x56')]['length']?_0x12c30a[_0x9b8a('0x56')]:_0x18d9be[_0x9b8a('0x4e')];_0x12c30a[_0x9b8a('0x5b')]=qs[_0x9b8a('0x5c')](_0x3cddcf['query']['sort']);_0x12c30a['where']=qs[_0x9b8a('0x54')](_[_0x9b8a('0x5e')](_0x3cddcf['query'],_0x18d9be['filters']));if(_0x3cddcf[_0x9b8a('0x52')][_0x9b8a('0x41')]){_0x12c30a[_0x9b8a('0x5d')]=_[_0x9b8a('0x5f')](_0x12c30a[_0x9b8a('0x5d')],{'$or':_[_0x9b8a('0x4a')](_0x12c30a[_0x9b8a('0x56')],function(_0x3f4ca8){var _0x21d217={};_0x21d217[_0x3f4ca8]={'$like':'%'+_0x3cddcf[_0x9b8a('0x52')][_0x9b8a('0x41')]+'%'};return _0x21d217;})});}_0x12c30a=_[_0x9b8a('0x5f')]({},_0x12c30a,_0x3cddcf[_0x9b8a('0x6c')]);return _0x5618fc['getOpenchannelInteractions'](_0x12c30a);}})['then'](function(_0x47c5c8){if(_0x47c5c8){_0x526083=_0x47c5c8[_0x9b8a('0x58')];if(!_0x3cddcf['query'][_0x9b8a('0x59')]('nolimit')){_0x12c30a[_0x9b8a('0x30')]=qs[_0x9b8a('0x30')](_0x3cddcf['query'][_0x9b8a('0x30')]);_0x12c30a[_0x9b8a('0x2f')]=qs[_0x9b8a('0x2f')](_0x3cddcf['query']['offset']);}return _0x5618fc['getOpenchannelInteractions'](_0x12c30a);}})['then'](function(_0x5c951b){if(_0x5c951b){return _0x5c951b?{'count':_0x526083,'rows':_0x5c951b}:null;}})[_0x9b8a('0x37')](respondWithResult(_0x3cce7b,null))[_0x9b8a('0x2b')](handleError(_0x3cce7b,null));};exports[_0x9b8a('0xde')]=function(_0x167de3,_0x5ddb4e,_0x4bc891){var _0x24f2c0={'raw':!![],'where':{}};var _0x1c8d41={};var _0x25525e={'count':0x0,'rows':[]};return db[_0x9b8a('0x4b')][_0x9b8a('0xa8')]({'where':{'id':_0x167de3[_0x9b8a('0x6a')]['id']}})['then'](handleEntityNotFound(_0x5ddb4e,null))[_0x9b8a('0x37')](function(_0x4947cc){if(_0x4947cc){_0x1c8d41[_0x9b8a('0x4e')]=_[_0x9b8a('0x53')](db[_0x9b8a('0xdf')]['rawAttributes']);_0x1c8d41[_0x9b8a('0x52')]=_[_0x9b8a('0x53')](_0x167de3['query']);_0x1c8d41[_0x9b8a('0x54')]=_[_0x9b8a('0x55')](_0x1c8d41[_0x9b8a('0x4e')],_0x1c8d41[_0x9b8a('0x52')]);_0x24f2c0['attributes']=_['intersection'](_0x1c8d41[_0x9b8a('0x4e')],qs['fields'](_0x167de3[_0x9b8a('0x52')][_0x9b8a('0x57')]));_0x24f2c0[_0x9b8a('0x56')]=_0x24f2c0[_0x9b8a('0x56')]['length']?_0x24f2c0[_0x9b8a('0x56')]:_0x1c8d41[_0x9b8a('0x4e')];if(!_0x167de3['query']['hasOwnProperty'](_0x9b8a('0x5a'))){_0x24f2c0['limit']=qs[_0x9b8a('0x30')](_0x167de3[_0x9b8a('0x52')][_0x9b8a('0x30')]);_0x24f2c0[_0x9b8a('0x2f')]=qs[_0x9b8a('0x2f')](_0x167de3[_0x9b8a('0x52')][_0x9b8a('0x2f')]);}_0x24f2c0[_0x9b8a('0x5b')]=qs['sort'](_0x167de3[_0x9b8a('0x52')][_0x9b8a('0x5c')]);_0x24f2c0[_0x9b8a('0x5d')]=qs[_0x9b8a('0x54')](_['pick'](_0x167de3['query'],_0x1c8d41['filters']));_0x24f2c0['where'][_0x9b8a('0xd8')]=_0x4947cc['id'];if(_0x167de3[_0x9b8a('0x52')]['filter']){_0x24f2c0[_0x9b8a('0x5d')]=_[_0x9b8a('0x5f')](_0x24f2c0[_0x9b8a('0x5d')],{'$or':_[_0x9b8a('0x4a')](_0x24f2c0[_0x9b8a('0x56')],function(_0x11c98e){var _0x3b1e5e={};_0x3b1e5e[_0x11c98e]={'$like':'%'+_0x167de3[_0x9b8a('0x52')]['filter']+'%'};return _0x3b1e5e;})});}_0x24f2c0=_[_0x9b8a('0x5f')]({},_0x24f2c0,_0x167de3[_0x9b8a('0x6c')]);return db[_0x9b8a('0xdf')][_0x9b8a('0x65')]({'where':_0x24f2c0[_0x9b8a('0x5d')]})[_0x9b8a('0x37')](function(_0x4c7621){_0x25525e[_0x9b8a('0x65')]=_0x4c7621;if(_0x167de3[_0x9b8a('0x52')][_0x9b8a('0x6b')]){_0x24f2c0[_0x9b8a('0x66')]=[{'all':!![]}];}return db[_0x9b8a('0xdf')][_0x9b8a('0x67')](_0x24f2c0);})[_0x9b8a('0x37')](function(_0x446f62){_0x25525e[_0x9b8a('0x68')]=_0x446f62;return _0x25525e;});}})[_0x9b8a('0x37')](respondWithFilteredResult(_0x5ddb4e,_0x24f2c0))[_0x9b8a('0x2b')](handleError(_0x5ddb4e,null));};exports[_0x9b8a('0xe0')]=function(_0xe8b64a,_0x270662,_0x44cff7){var _0x1c8c47={};var _0x2fced2={};var _0x2b4345;var _0x2a6560;return db[_0x9b8a('0x4b')][_0x9b8a('0xa8')]({'where':{'id':_0xe8b64a[_0x9b8a('0x6a')]['id']}})[_0x9b8a('0x37')](handleEntityNotFound(_0x270662,null))[_0x9b8a('0x37')](function(_0x4d08c0){if(_0x4d08c0){_0x2b4345=_0x4d08c0;_0x2fced2[_0x9b8a('0x4e')]=_[_0x9b8a('0x53')](db[_0x9b8a('0xe1')][_0x9b8a('0x4c')]);_0x2fced2[_0x9b8a('0x52')]=_['keys'](_0xe8b64a[_0x9b8a('0x52')]);_0x2fced2['filters']=_[_0x9b8a('0x55')](_0x2fced2[_0x9b8a('0x4e')],_0x2fced2[_0x9b8a('0x52')]);_0x1c8c47[_0x9b8a('0x56')]=_[_0x9b8a('0x55')](_0x2fced2['model'],qs[_0x9b8a('0x57')](_0xe8b64a[_0x9b8a('0x52')][_0x9b8a('0x57')]));_0x1c8c47[_0x9b8a('0x56')]=_0x1c8c47[_0x9b8a('0x56')][_0x9b8a('0x58')]?_0x1c8c47[_0x9b8a('0x56')]:_0x2fced2[_0x9b8a('0x4e')];_0x1c8c47[_0x9b8a('0x5b')]=qs[_0x9b8a('0x5c')](_0xe8b64a[_0x9b8a('0x52')][_0x9b8a('0x5c')]);_0x1c8c47[_0x9b8a('0x5d')]=qs['filters'](_[_0x9b8a('0x5e')](_0xe8b64a[_0x9b8a('0x52')],_0x2fced2['filters']));if(_0xe8b64a[_0x9b8a('0x52')][_0x9b8a('0x41')]){_0x1c8c47[_0x9b8a('0x5d')]=_[_0x9b8a('0x5f')](_0x1c8c47[_0x9b8a('0x5d')],{'$or':_[_0x9b8a('0x4a')](_0x1c8c47[_0x9b8a('0x56')],function(_0x372115){var _0x393e53={};_0x393e53[_0x372115]={'$like':'%'+_0xe8b64a[_0x9b8a('0x52')][_0x9b8a('0x41')]+'%'};return _0x393e53;})});}_0x1c8c47=_['merge']({},_0x1c8c47,_0xe8b64a['options']);return _0x2b4345['getSmsInteractions'](_0x1c8c47);}})[_0x9b8a('0x37')](function(_0x41c72a){if(_0x41c72a){_0x2a6560=_0x41c72a['length'];if(!_0xe8b64a[_0x9b8a('0x52')][_0x9b8a('0x59')](_0x9b8a('0x5a'))){_0x1c8c47[_0x9b8a('0x30')]=qs['limit'](_0xe8b64a[_0x9b8a('0x52')][_0x9b8a('0x30')]);_0x1c8c47[_0x9b8a('0x2f')]=qs[_0x9b8a('0x2f')](_0xe8b64a[_0x9b8a('0x52')][_0x9b8a('0x2f')]);}return _0x2b4345[_0x9b8a('0xe0')](_0x1c8c47);}})[_0x9b8a('0x37')](function(_0x444349){if(_0x444349){return _0x444349?{'count':_0x2a6560,'rows':_0x444349}:null;}})[_0x9b8a('0x37')](respondWithResult(_0x270662,null))['catch'](handleError(_0x270662,null));};exports['getFaxInteractions']=function(_0x525b34,_0x9dda9b,_0x3b62cd){var _0x4c4890={};var _0x44c01e={};var _0x198fd5;var _0x4b6218;return db[_0x9b8a('0x4b')][_0x9b8a('0xa8')]({'where':{'id':_0x525b34['params']['id']}})[_0x9b8a('0x37')](handleEntityNotFound(_0x9dda9b,null))['then'](function(_0x2e416c){if(_0x2e416c){_0x198fd5=_0x2e416c;_0x44c01e[_0x9b8a('0x4e')]=_[_0x9b8a('0x53')](db['FaxInteraction']['rawAttributes']);_0x44c01e['query']=_[_0x9b8a('0x53')](_0x525b34[_0x9b8a('0x52')]);_0x44c01e[_0x9b8a('0x54')]=_[_0x9b8a('0x55')](_0x44c01e[_0x9b8a('0x4e')],_0x44c01e['query']);_0x4c4890['attributes']=_[_0x9b8a('0x55')](_0x44c01e['model'],qs[_0x9b8a('0x57')](_0x525b34[_0x9b8a('0x52')]['fields']));_0x4c4890[_0x9b8a('0x56')]=_0x4c4890['attributes'][_0x9b8a('0x58')]?_0x4c4890[_0x9b8a('0x56')]:_0x44c01e[_0x9b8a('0x4e')];_0x4c4890[_0x9b8a('0x5b')]=qs[_0x9b8a('0x5c')](_0x525b34['query'][_0x9b8a('0x5c')]);_0x4c4890[_0x9b8a('0x5d')]=qs['filters'](_[_0x9b8a('0x5e')](_0x525b34[_0x9b8a('0x52')],_0x44c01e[_0x9b8a('0x54')]));if(_0x525b34[_0x9b8a('0x52')][_0x9b8a('0x41')]){_0x4c4890[_0x9b8a('0x5d')]=_[_0x9b8a('0x5f')](_0x4c4890['where'],{'$or':_['map'](_0x4c4890[_0x9b8a('0x56')],function(_0x32de04){var _0x1a9662={};_0x1a9662[_0x32de04]={'$like':'%'+_0x525b34[_0x9b8a('0x52')][_0x9b8a('0x41')]+'%'};return _0x1a9662;})});}_0x4c4890=_[_0x9b8a('0x5f')]({},_0x4c4890,_0x525b34[_0x9b8a('0x6c')]);return _0x198fd5['getFaxInteractions'](_0x4c4890);}})[_0x9b8a('0x37')](function(_0x3b4f78){if(_0x3b4f78){_0x4b6218=_0x3b4f78[_0x9b8a('0x58')];if(!_0x525b34['query'][_0x9b8a('0x59')](_0x9b8a('0x5a'))){_0x4c4890[_0x9b8a('0x30')]=qs[_0x9b8a('0x30')](_0x525b34[_0x9b8a('0x52')][_0x9b8a('0x30')]);_0x4c4890[_0x9b8a('0x2f')]=qs[_0x9b8a('0x2f')](_0x525b34[_0x9b8a('0x52')][_0x9b8a('0x2f')]);}return _0x198fd5[_0x9b8a('0xe2')](_0x4c4890);}})[_0x9b8a('0x37')](function(_0x576e9e){if(_0x576e9e){return _0x576e9e?{'count':_0x4b6218,'rows':_0x576e9e}:null;}})[_0x9b8a('0x37')](respondWithResult(_0x9dda9b,null))[_0x9b8a('0x2b')](handleError(_0x9dda9b,null));};exports['getWhatsappInteractions']=function(_0x3be2ec,_0x4af8f1,_0x3008bf){var _0x24a656={};var _0x71e090={};var _0x40f6ec;var _0x5b6db4;return db[_0x9b8a('0x4b')][_0x9b8a('0xa8')]({'where':{'id':_0x3be2ec['params']['id']}})['then'](handleEntityNotFound(_0x4af8f1,null))[_0x9b8a('0x37')](function(_0x1ec50b){if(_0x1ec50b){_0x40f6ec=_0x1ec50b;_0x71e090[_0x9b8a('0x4e')]=_['keys'](db['WhatsappInteraction'][_0x9b8a('0x4c')]);_0x71e090['query']=_['keys'](_0x3be2ec[_0x9b8a('0x52')]);_0x71e090[_0x9b8a('0x54')]=_[_0x9b8a('0x55')](_0x71e090[_0x9b8a('0x4e')],_0x71e090[_0x9b8a('0x52')]);_0x24a656[_0x9b8a('0x56')]=_[_0x9b8a('0x55')](_0x71e090[_0x9b8a('0x4e')],qs[_0x9b8a('0x57')](_0x3be2ec[_0x9b8a('0x52')]['fields']));_0x24a656['attributes']=_0x24a656[_0x9b8a('0x56')][_0x9b8a('0x58')]?_0x24a656['attributes']:_0x71e090[_0x9b8a('0x4e')];_0x24a656[_0x9b8a('0x5b')]=qs[_0x9b8a('0x5c')](_0x3be2ec[_0x9b8a('0x52')][_0x9b8a('0x5c')]);_0x24a656[_0x9b8a('0x5d')]=qs[_0x9b8a('0x54')](_[_0x9b8a('0x5e')](_0x3be2ec[_0x9b8a('0x52')],_0x71e090[_0x9b8a('0x54')]));if(_0x3be2ec['query']['filter']){_0x24a656['where']=_[_0x9b8a('0x5f')](_0x24a656[_0x9b8a('0x5d')],{'$or':_[_0x9b8a('0x4a')](_0x24a656[_0x9b8a('0x56')],function(_0x1f4106){var _0x86d5c0={};_0x86d5c0[_0x1f4106]={'$like':'%'+_0x3be2ec['query']['filter']+'%'};return _0x86d5c0;})});}_0x24a656=_[_0x9b8a('0x5f')]({},_0x24a656,_0x3be2ec[_0x9b8a('0x6c')]);return _0x40f6ec[_0x9b8a('0xe3')](_0x24a656);}})[_0x9b8a('0x37')](function(_0x2da3be){if(_0x2da3be){_0x5b6db4=_0x2da3be[_0x9b8a('0x58')];if(!_0x3be2ec['query'][_0x9b8a('0x59')](_0x9b8a('0x5a'))){_0x24a656[_0x9b8a('0x30')]=qs['limit'](_0x3be2ec[_0x9b8a('0x52')][_0x9b8a('0x30')]);_0x24a656[_0x9b8a('0x2f')]=qs[_0x9b8a('0x2f')](_0x3be2ec[_0x9b8a('0x52')][_0x9b8a('0x2f')]);}return _0x40f6ec[_0x9b8a('0xe3')](_0x24a656);}})[_0x9b8a('0x37')](function(_0x215f56){if(_0x215f56){return _0x215f56?{'count':_0x5b6db4,'rows':_0x215f56}:null;}})[_0x9b8a('0x37')](respondWithResult(_0x4af8f1,null))[_0x9b8a('0x2b')](handleError(_0x4af8f1,null));};exports['login']=function(_0x18ecb3,_0x14d0ac,_0x33a97b){var _0x1b328d;var _0x3636d5;var _0x18e332;var _0x5f50a8=!_[_0x9b8a('0x79')](_0x18ecb3[_0x9b8a('0x6a')]['id'])?_0x18ecb3['params']['id']:!_[_0x9b8a('0x79')](_0x18ecb3[_0x9b8a('0x3c')]['id'])?_0x18ecb3[_0x9b8a('0x3c')]['id']:null;return db[_0x9b8a('0x4b')]['find']({'where':{'id':_0x5f50a8,'role':{'$or':[_0x9b8a('0x3a'),_0x9b8a('0x3c'),_0x9b8a('0x3e')]}},'attributes':['id','name',_0x9b8a('0xe4'),_0x9b8a('0xe5'),'role',_0x9b8a('0x72'),_0x9b8a('0xb0')]})[_0x9b8a('0x37')](function(_0x339c38){if(_0x339c38){if(_0x339c38[_0x9b8a('0x39')]===_0x9b8a('0x3e')){_0x1b328d=_0x339c38;if(_0x18ecb3[_0x9b8a('0x6d')][_0x9b8a('0xbd')]){_0x18e332=util[_0x9b8a('0xbe')](_0x9b8a('0xe6'),_0x1b328d[_0x18ecb3[_0x9b8a('0x6d')][_0x9b8a('0xbd')]]);}else if(_0x18ecb3[_0x9b8a('0x6d')][_0x9b8a('0xe7')]){_0x18e332=util[_0x9b8a('0xbe')](_0x9b8a('0xe8'),_0x18ecb3['body'][_0x9b8a('0xe7')]);}else{_0x18e332=util[_0x9b8a('0xbe')](_0x9b8a('0xe8'),_0x1b328d[_0x9b8a('0x46')]);}socket['to'](util['format'](_0x9b8a('0xe9'),_0x1b328d[_0x9b8a('0x46')]))[_0x9b8a('0xba')](_0x9b8a('0xea'),{'user':{'id':_0x1b328d['id'],'name':_0x1b328d[_0x9b8a('0x46')]},'ip':_0x18ecb3['headers'][_0x9b8a('0xeb')]||_0x18ecb3[_0x9b8a('0xec')][_0x9b8a('0xed')]||_0x18ecb3[_0x9b8a('0xee')][_0x9b8a('0xed')]||_0x18ecb3['connection']['socket'][_0x9b8a('0xed')]});return db[_0x9b8a('0xc2')][_0x9b8a('0x47')]({'where':{'membername':_0x1b328d[_0x9b8a('0x46')]},'individualHooks':!![]});}}else{throw new db[(_0x9b8a('0xa1'))]['ValidationError'](_0x9b8a('0xef'));}})[_0x9b8a('0x37')](function(){if(_0x1b328d){return _0x1b328d[_0x9b8a('0xf0')]({'raw':!![]});}})['then'](function(_0x5cebf2){if(_0x1b328d){var _0x54b776=[];if(_0x5cebf2){_0x3636d5=_0x5cebf2;if(_0x3636d5[_0x9b8a('0x58')]){for(var _0x15841c=0x0;_0x15841c<_0x3636d5[_0x9b8a('0x58')];_0x15841c++){_0x54b776[_0x9b8a('0x98')]({'membername':_0x1b328d['name'],'UserId':_0x1b328d['id'],'queue_name':_0x3636d5[_0x15841c]['name'],'VoiceQueueId':_0x3636d5[_0x15841c]['id'],'interface':_0x18e332,'paused':_0x1b328d[_0x9b8a('0xb0')]||![],'penalty':_0x3636d5[_0x15841c][_0x9b8a('0xf1')]||0x0});}return BPromise[_0x9b8a('0x9a')](_0x54b776,function(_0x5ba556){return db[_0x9b8a('0xc2')][_0x9b8a('0xbf')](_0x5ba556);});}}}})[_0x9b8a('0x37')](function(){if(_0x1b328d){return db['MemberReport'][_0x9b8a('0x67')]({'where':{'membername':_0x1b328d[_0x9b8a('0x46')],'exitAt':null}});}})[_0x9b8a('0x37')](function(_0x1ec4d0){if(_0x1b328d){var _0x3e04a7=[];_0x1ec4d0[_0x9b8a('0xf2')](function(_0x573277){_0x3e04a7['push'](_0x573277[_0x9b8a('0x36')]({'exitAt':moment()['format'](_0x9b8a('0xf3'))}));});return BPromise['all'](_0x3e04a7);}})[_0x9b8a('0x37')](function(){if(_0x1b328d){var _0x1946e3=[];var _0x1bbeca=[];var _0x49fdf2=utils[_0x9b8a('0xf4')]();var _0x3dbb99={'membername':_0x1b328d[_0x9b8a('0x46')],'interface':_0x18e332,'enterAt':moment()[_0x9b8a('0xbe')](_0x9b8a('0xf3')),'role':_0x1b328d[_0x9b8a('0x39')],'internal':_0x1b328d[_0x9b8a('0x72')]};_0x49fdf2[_0x9b8a('0xf2')](function(_0x39ef6d){_0x1946e3[_0x9b8a('0x98')](_[_0x9b8a('0x5f')]({'channel':_0x39ef6d,'type':'LOGIN','data1':_0x18ecb3[_0x9b8a('0x6d')][_0x9b8a('0xf5')],'data2':_0x18e332},_0x3dbb99));if(_0x1b328d[_0x9b8a('0xb0')]){_0x1bbeca[_0x9b8a('0x98')](_[_0x9b8a('0x5f')]({'channel':_0x39ef6d,'type':_0x9b8a('0xf6'),'data1':_0x9b8a('0xf7')},_0x3dbb99));}});return db[_0x9b8a('0xf8')][_0x9b8a('0x94')](_0x1946e3[_0x9b8a('0xf9')](_0x1bbeca),{'individualHooks':!![]});}})[_0x9b8a('0x37')](function(){if(_0x1b328d){return _0x1b328d['update']({'online':!![],'lastLoginAt':moment()[_0x9b8a('0xbe')](_0x9b8a('0xf3')),'voicePause':_0x1b328d[_0x9b8a('0xb0')]||![],'mailPause':_0x1b328d[_0x9b8a('0xb0')]||![],'chatPause':_0x1b328d['loginInPause']||![],'faxPause':_0x1b328d[_0x9b8a('0xb0')]||![],'smsPause':_0x1b328d['loginInPause']||![],'openchannelPause':_0x1b328d[_0x9b8a('0xb0')]||![],'whatsappPause':_0x1b328d[_0x9b8a('0xb0')]||![],'pauseType':_0x1b328d[_0x9b8a('0xb0')]?_0x9b8a('0xf7'):null,'interface':_0x18e332,'lastPauseAt':moment()['format'](_0x9b8a('0xf3'))});}})[_0x9b8a('0x37')](function(_0x4a51a9){if(_0x18ecb3[_0x9b8a('0xfa')]){return _0x33a97b();}else{return BPromise[_0x9b8a('0xfb')](_0x4a51a9)[_0x9b8a('0x37')](respondWithResult(_0x14d0ac,null));}})['catch'](handleError(_0x14d0ac,null));};exports[_0x9b8a('0xfc')]=function(_0x3b76a2,_0x6824d2,_0x1c04aa){var _0x10d0bd;return db[_0x9b8a('0x4b')][_0x9b8a('0x45')]({'where':{'id':_0x3b76a2[_0x9b8a('0x6a')]['id'],'role':_0x9b8a('0x3e')},'attributes':['id','name',_0x9b8a('0x39')]})['then'](handleEntityNotFound(_0x6824d2,null))[_0x9b8a('0x37')](function(_0x796a3c){if(_0x796a3c){_0x10d0bd=_0x796a3c;return db[_0x9b8a('0xc2')][_0x9b8a('0x47')]({'where':{'membername':_0x10d0bd[_0x9b8a('0x46')]},'individualHooks':!![]});}})[_0x9b8a('0x37')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x10d0bd['name'],'exitAt':null}});})[_0x9b8a('0x37')](function(_0x230ef1){var _0x2298c2=[];_0x230ef1['forEach'](function(_0x5b22c4){_0x2298c2[_0x9b8a('0x98')](_0x5b22c4[_0x9b8a('0x36')]({'exitAt':moment()[_0x9b8a('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x2298c2);})[_0x9b8a('0x37')](function(){return _0x10d0bd[_0x9b8a('0x36')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x9b8a('0x37')](respondWithResult(_0x6824d2,null))[_0x9b8a('0x2b')](handleError(_0x6824d2,null));};exports[_0x9b8a('0xfd')]=function(_0x46201b,_0x23709c,_0x222082){var _0xb6ddb8;return db[_0x9b8a('0xc2')][_0x9b8a('0x36')]({'paused':0x1},{'where':{'UserId':_0x46201b[_0x9b8a('0x6a')]['id']},'individualHooks':!![]})[_0x9b8a('0x37')](function(){return db['User']['find']({'where':{'id':_0x46201b[_0x9b8a('0x6a')]['id'],'role':'agent'},'attributes':['id','name',_0x9b8a('0x39'),_0x9b8a('0x72'),_0x9b8a('0xbd')]});})[_0x9b8a('0x37')](handleEntityNotFound(_0x23709c,null))[_0x9b8a('0x37')](function(_0x4f6cd4){if(_0x4f6cd4){_0xb6ddb8=_0x4f6cd4;return respondWithRpcPromise('QueuePause',_0x9b8a('0xfd'),{'id':_0xb6ddb8['id'],'name':_0xb6ddb8[_0x9b8a('0x46')],'pause':!![]});}})[_0x9b8a('0x37')](function(){if(_0xb6ddb8){return db['MemberReport'][_0x9b8a('0x67')]({'where':{'membername':_0xb6ddb8[_0x9b8a('0x46')],'type':'PAUSE','exitAt':null}});}})[_0x9b8a('0x37')](function(_0x4ee595){if(_0x4ee595[_0x9b8a('0x58')]){var _0x27bfe2=moment()[_0x9b8a('0xbe')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x126f84=0x0,_0x20289=_0x4ee595['length'];_0x126f84<_0x20289;_0x126f84++){_0x4ee595[_0x126f84][_0x9b8a('0xfe')]({'exitAt':_0x27bfe2});}}})['then'](function(){var _0x4abc38=[];var _0x3c4c29=utils['getChannels']();_0x3c4c29[_0x9b8a('0xf2')](function(_0xd9580f){_0x4abc38[_0x9b8a('0x98')]({'channel':_0xd9580f,'membername':_0xb6ddb8[_0x9b8a('0x46')],'interface':_['isNil'](_0xb6ddb8[_0x9b8a('0xbd')])?util[_0x9b8a('0xbe')]('SIP/%s',_0xb6ddb8[_0x9b8a('0x46')]):_0xb6ddb8[_0x9b8a('0xbd')],'type':_0x9b8a('0xf6'),'enterAt':moment()[_0x9b8a('0xbe')](_0x9b8a('0xf3')),'data1':_0x46201b[_0x9b8a('0x6d')][_0x9b8a('0x60')]||'DEFAULT\x20PAUSE','role':_0xb6ddb8['role'],'internal':_0xb6ddb8[_0x9b8a('0x72')]});});return db[_0x9b8a('0xf8')]['bulkCreate'](_0x4abc38,{'individualHooks':!![]});})['then'](function(){return _0xb6ddb8[_0x9b8a('0x36')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x46201b['body'][_0x9b8a('0x60')]||_0x9b8a('0xff'),'lastPauseAt':moment()[_0x9b8a('0xbe')](_0x9b8a('0xf3'))});})[_0x9b8a('0x37')](respondWithResult(_0x23709c,null))[_0x9b8a('0x2b')](handleError(_0x23709c,null));};exports[_0x9b8a('0x100')]=function(_0x1f05cd,_0xba31e2,_0x539f83){var _0x3da542;return db[_0x9b8a('0x4b')]['find']({'where':{'id':_0x1f05cd[_0x9b8a('0x6a')]['id']},'attributes':['id',_0x9b8a('0x46'),_0x9b8a('0x39'),'voicePause',_0x9b8a('0x101'),_0x9b8a('0x102'),_0x9b8a('0x103'),'openchannelPause',_0x9b8a('0x104'),'whatsapppause',_0x9b8a('0x105'),_0x9b8a('0x106')]})[_0x9b8a('0x37')](handleEntityNotFound(_0xba31e2,null))[_0x9b8a('0x37')](function(_0x430411){if(_0x430411){_0x3da542=_0x430411;if(_0x1f05cd[_0x9b8a('0x6d')][_0x9b8a('0xae')]&&!utils[_0x9b8a('0xb2')](_0x1f05cd[_0x9b8a('0x6d')][_0x9b8a('0xae')])){throw new db['Sequelize'][(_0x9b8a('0xa2'))](_0x9b8a('0xb3'));}switch(_0x1f05cd['body'][_0x9b8a('0xae')]){case'voice':return respondWithRpcPromise(_0x9b8a('0x107'),_0x9b8a('0x100'),{'id':_0x3da542['id'],'name':_0x3da542[_0x9b8a('0x46')],'pause':![]})['then'](function(){return db[_0x9b8a('0xc2')][_0x9b8a('0x36')]({'paused':0x0},{'where':{'UserId':_0x3da542['id']},'individualHooks':!![]});})['then'](function(){return db['MemberReport'][_0x9b8a('0x45')]({'where':{'channel':_0x1f05cd[_0x9b8a('0x6d')][_0x9b8a('0xae')],'membername':_0x3da542[_0x9b8a('0x46')],'type':'PAUSE','exitAt':null}});})[_0x9b8a('0x37')](function(_0x28c25b){if(_0x28c25b){return _0x28c25b[_0x9b8a('0x36')]({'exitAt':moment()[_0x9b8a('0xbe')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x9b8a('0x108')},{'individualHooks':!![]});}return null;})[_0x9b8a('0x37')](function(){return _0x3da542[_0x9b8a('0x36')]({'voicePause':![]});});case _0x9b8a('0x109'):case _0x9b8a('0x10a'):case'fax':case _0x9b8a('0x10b'):case _0x9b8a('0x10c'):case'openchannel':return db[_0x9b8a('0xf8')]['find']({'where':{'channel':_0x1f05cd['body'][_0x9b8a('0xae')],'membername':_0x3da542[_0x9b8a('0x46')],'type':_0x9b8a('0xf6'),'exitAt':null}})['then'](function(_0x57d91d){if(_0x57d91d){return _0x57d91d['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x9b8a('0x108')},{'individualHooks':!![]});}return null;})[_0x9b8a('0x37')](function(){var _0x628e64={};_[_0x9b8a('0x31')](_0x628e64,util[_0x9b8a('0xbe')](_0x9b8a('0x10d'),_0x1f05cd[_0x9b8a('0x6d')][_0x9b8a('0xae')],_0x9b8a('0x10e')),![]);return _0x3da542[_0x9b8a('0x36')](_0x628e64);});default:return respondWithRpcPromise(_0x9b8a('0x107'),_0x9b8a('0x100'),{'id':_0x3da542['id'],'name':_0x3da542[_0x9b8a('0x46')],'pause':![]})[_0x9b8a('0x37')](function(){return db[_0x9b8a('0xc2')][_0x9b8a('0x36')]({'paused':0x0},{'where':{'UserId':_0x3da542['id']}});})['then'](function(){return db['MemberReport'][_0x9b8a('0x67')]({'where':{'membername':_0x3da542[_0x9b8a('0x46')],'type':_0x9b8a('0xf6'),'exitAt':null}});})[_0x9b8a('0x37')](function(_0x236bb8){var _0x4d0734=[];_0x236bb8[_0x9b8a('0xf2')](function(_0x21d156){_0x4d0734[_0x9b8a('0x98')](_0x21d156[_0x9b8a('0x36')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x9b8a('0x108')}));});return BPromise[_0x9b8a('0x99')](_0x4d0734);})[_0x9b8a('0x37')](function(){return _0x3da542[_0x9b8a('0x36')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x9b8a('0x37')](respondWithResult(_0xba31e2,null))['catch'](handleError(_0xba31e2,null));};exports[_0x9b8a('0x10f')]=function(_0x31fe95,_0x5b8873,_0x503472){var _0x2fd6e3={};var _0xaae511={};var _0x284889;var _0x5e18d2;return db['User'][_0x9b8a('0xa8')]({'where':{'id':_0x31fe95[_0x9b8a('0x6a')]['id']}})[_0x9b8a('0x37')](handleEntityNotFound(_0x5b8873,null))[_0x9b8a('0x37')](function(_0x15ab3e){if(_0x15ab3e){_0x284889=_0x15ab3e;_0xaae511['model']=_['keys'](db[_0x9b8a('0x110')][_0x9b8a('0x4c')]);_0xaae511[_0x9b8a('0x52')]=_[_0x9b8a('0x53')](_0x31fe95['query']);_0xaae511[_0x9b8a('0x54')]=_[_0x9b8a('0x55')](_0xaae511[_0x9b8a('0x4e')],_0xaae511[_0x9b8a('0x52')]);_0x2fd6e3[_0x9b8a('0x56')]=_[_0x9b8a('0x55')](_0xaae511[_0x9b8a('0x4e')],qs[_0x9b8a('0x57')](_0x31fe95[_0x9b8a('0x52')][_0x9b8a('0x57')]));_0x2fd6e3[_0x9b8a('0x56')]=_0x2fd6e3[_0x9b8a('0x56')]['length']?_0x2fd6e3['attributes']:_0xaae511[_0x9b8a('0x4e')];_0x2fd6e3['order']=qs[_0x9b8a('0x5c')](_0x31fe95['query'][_0x9b8a('0x5c')]);_0x2fd6e3[_0x9b8a('0x5d')]=qs[_0x9b8a('0x54')](_['pick'](_0x31fe95[_0x9b8a('0x52')],_0xaae511[_0x9b8a('0x54')]));if(_0x31fe95[_0x9b8a('0x52')]['filter']){_0x2fd6e3[_0x9b8a('0x5d')]=_['merge'](_0x2fd6e3['where'],{'$or':_[_0x9b8a('0x4a')](_0x2fd6e3[_0x9b8a('0x56')],function(_0x103b93){var _0x29378e={};_0x29378e[_0x103b93]={'$like':'%'+_0x31fe95[_0x9b8a('0x52')][_0x9b8a('0x41')]+'%'};return _0x29378e;})});}_0x2fd6e3=_[_0x9b8a('0x5f')]({},_0x2fd6e3,_0x31fe95[_0x9b8a('0x6c')]);return _0x284889[_0x9b8a('0x10f')](_0x2fd6e3);}})[_0x9b8a('0x37')](function(_0x490b1b){if(_0x490b1b){_0x5e18d2=_0x490b1b[_0x9b8a('0x58')];if(!_0x31fe95['query'][_0x9b8a('0x59')](_0x9b8a('0x5a'))){_0x2fd6e3[_0x9b8a('0x30')]=qs[_0x9b8a('0x30')](_0x31fe95[_0x9b8a('0x52')][_0x9b8a('0x30')]);_0x2fd6e3[_0x9b8a('0x2f')]=qs[_0x9b8a('0x2f')](_0x31fe95[_0x9b8a('0x52')][_0x9b8a('0x2f')]);}return _0x284889['getTeams'](_0x2fd6e3);}})['then'](function(_0x377d92){if(_0x377d92){return _0x377d92?{'count':_0x5e18d2,'rows':_0x377d92}:null;}})[_0x9b8a('0x37')](respondWithResult(_0x5b8873,null))[_0x9b8a('0x2b')](handleError(_0x5b8873,null));};exports[_0x9b8a('0x111')]=function(_0x196f16,_0x5502ab){return db[_0x9b8a('0x4b')][_0x9b8a('0x45')]({'where':{'id':_0x196f16['params']['id']}})['then'](handleEntityNotFound(_0x5502ab,null))['then'](function(_0x127530){if(_0x127530){var _0x44b2e7=_0x127530[_0x9b8a('0x38')]({'plain':!![]});return _0x127530[_0x9b8a('0x111')](_0x196f16[_0x9b8a('0x6d')]['ids'],_[_0x9b8a('0x71')](_0x196f16[_0x9b8a('0x6d')],['ids','id'])||{})[_0x9b8a('0x37')](function(){for(var _0x3d0fbe=0x0;_0x3d0fbe<_0x196f16['body'][_0x9b8a('0x70')]['length'];_0x3d0fbe++){var _0xc26875=[];db[_0x9b8a('0x110')][_0x9b8a('0xa8')]({'where':{'id':_0x196f16['body']['ids'][_0x3d0fbe]}})[_0x9b8a('0x37')](function(_0x51b261){_0xc26875[_0x9b8a('0x98')](_0x51b261[_0x9b8a('0xf0')]()[_0x9b8a('0x37')](function(_0x5a70c7){for(var _0x3fb665=0x0;_0x3fb665<_0x5a70c7[_0x9b8a('0x58')];_0x3fb665++){_0x5a70c7[_0x3fb665]['setDataValue'](_0x9b8a('0xae'),_0x9b8a('0x112'));}return _0x5a70c7;}));_0xc26875[_0x9b8a('0x98')](_0x51b261[_0x9b8a('0x113')]()[_0x9b8a('0x37')](function(_0x3f5b92){for(var _0x11c552=0x0;_0x11c552<_0x3f5b92['length'];_0x11c552++){_0x3f5b92[_0x11c552]['setDataValue']('channel',_0x9b8a('0x114'));}return _0x3f5b92;}));_0xc26875[_0x9b8a('0x98')](_0x51b261[_0x9b8a('0x115')]()['then'](function(_0x402e70){for(var _0x1adc15=0x0;_0x1adc15<_0x402e70[_0x9b8a('0x58')];_0x1adc15++){_0x402e70[_0x1adc15][_0x9b8a('0x116')](_0x9b8a('0xae'),_0x9b8a('0x117'));}return _0x402e70;}));_0xc26875[_0x9b8a('0x98')](_0x51b261['getSmsQueues']()['then'](function(_0x20e754){for(var _0x23903b=0x0;_0x23903b<_0x20e754[_0x9b8a('0x58')];_0x23903b++){_0x20e754[_0x23903b][_0x9b8a('0x116')](_0x9b8a('0xae'),_0x9b8a('0x118'));}return _0x20e754;}));_0xc26875[_0x9b8a('0x98')](_0x51b261[_0x9b8a('0x119')]()[_0x9b8a('0x37')](function(_0x3afcc0){for(var _0x3b816c=0x0;_0x3b816c<_0x3afcc0[_0x9b8a('0x58')];_0x3b816c++){_0x3afcc0[_0x3b816c][_0x9b8a('0x116')](_0x9b8a('0xae'),_0x9b8a('0x11a'));}return _0x3afcc0;}));_0xc26875[_0x9b8a('0x98')](_0x51b261[_0x9b8a('0x11b')]()[_0x9b8a('0x37')](function(_0x5b87f0){for(var _0x43fc59=0x0;_0x43fc59<_0x5b87f0[_0x9b8a('0x58')];_0x43fc59++){_0x5b87f0[_0x43fc59]['setDataValue'](_0x9b8a('0xae'),'Fax');}return _0x5b87f0;}));_0xc26875[_0x9b8a('0x98')](_0x51b261['getOpenchannelQueues']()[_0x9b8a('0x37')](function(_0x60bba3){for(var _0x1cd682=0x0;_0x1cd682<_0x60bba3[_0x9b8a('0x58')];_0x1cd682++){_0x60bba3[_0x1cd682][_0x9b8a('0x116')](_0x9b8a('0xae'),_0x9b8a('0x11c'));}return _0x60bba3;}));return BPromise[_0x9b8a('0x99')](_0xc26875);})[_0x9b8a('0x37')](function(_0x5943da){var _0x1b1550=_[_0x9b8a('0x11d')](_0x5943da);_0xc26875=[];return db[_0x9b8a('0x62')][_0x9b8a('0x11e')](function(_0x3cccfd){for(var _0x473eca=0x0;_0x473eca<_0x1b1550[_0x9b8a('0x58')];_0x473eca++){_0xc26875[_0x9b8a('0x98')](_0x1b1550[_0x473eca][_0x9b8a('0x11f')](_0x44b2e7['id']),{'transaction':_0x3cccfd});}return BPromise[_0x9b8a('0x99')](_0xc26875)[_0x9b8a('0x37')](function(){if(_0x44b2e7['online']){return BPromise[_0x9b8a('0x9a')](_[_0x9b8a('0x41')](_0x1b1550,function(_0x498927){return _0x498927[_0x9b8a('0x120')]('channel')===_0x9b8a('0x112');}),function(_0x3f59e2){return db['UserVoiceQueueRt']['upsert']({'membername':_0x44b2e7[_0x9b8a('0x46')],'UserId':_0x44b2e7['id'],'queue_name':_0x3f59e2['name'],'VoiceQueueId':_0x3f59e2['id'],'interface':_['isNil'](_0x44b2e7[_0x9b8a('0xbd')])?util['format'](_0x9b8a('0xe8'),_0x44b2e7['name']):_0x44b2e7[_0x9b8a('0xbd')],'paused':_0x44b2e7[_0x9b8a('0xb1')]||![],'penalty':_0x44b2e7['penalty']},{'transaction':_0x3cccfd});});}else{return;}})[_0x9b8a('0x37')](function(){for(var _0x21be21=0x0;_0x21be21<_0x1b1550[_0x9b8a('0x58')];_0x21be21++){var _0x4dc9dd=_0x1b1550[_0x21be21]['getDataValue'](_0x9b8a('0xae'));var _0x4cd4ff=_0x4dc9dd+_0x9b8a('0x121');socket[_0x9b8a('0xba')]('user'+_0x4dc9dd+'Queue:save',{'UserId':_0x44b2e7['id'],['queueField']:_0x1b1550[_0x21be21]['id']});}});});});}});}})[_0x9b8a('0x37')](respondWithStatusCode(_0x5502ab,null))[_0x9b8a('0x2b')](handleError(_0x5502ab,null));};exports[_0x9b8a('0x122')]=function(_0x5a89a5,_0x30800e){return db[_0x9b8a('0x4b')][_0x9b8a('0xa8')]({'where':{'id':_0x5a89a5[_0x9b8a('0x6a')]['id']}})[_0x9b8a('0x37')](handleEntityNotFound(_0x30800e,null))[_0x9b8a('0x37')](function(_0x2ccf95){if(_0x2ccf95){var _0xf177f4=_0x2ccf95[_0x9b8a('0x38')]({'plain':!![]});var _0x367cd0=_0x5a89a5[_0x9b8a('0x52')][_0x9b8a('0x70')];return _0x2ccf95[_0x9b8a('0x122')](_0x367cd0)[_0x9b8a('0x37')](function(){for(var _0x510043=0x0;_0x510043<_0x367cd0[_0x9b8a('0x58')];_0x510043++){var _0x570fb6=[];db[_0x9b8a('0x110')][_0x9b8a('0xa8')]({'where':{'id':_0x367cd0[_0x510043]}})[_0x9b8a('0x37')](function(_0x47c108){_0x570fb6[_0x9b8a('0x98')](_0x47c108[_0x9b8a('0xf0')]()[_0x9b8a('0x37')](function(_0x254755){for(var _0x351bc8=0x0;_0x351bc8<_0x254755[_0x9b8a('0x58')];_0x351bc8++){_0x254755[_0x351bc8][_0x9b8a('0x116')](_0x9b8a('0xae'),_0x9b8a('0x112'));}return _0x254755;}));_0x570fb6[_0x9b8a('0x98')](_0x47c108[_0x9b8a('0x113')]()['then'](function(_0x40f4cf){for(var _0x22fe37=0x0;_0x22fe37<_0x40f4cf['length'];_0x22fe37++){_0x40f4cf[_0x22fe37][_0x9b8a('0x116')]('channel',_0x9b8a('0x114'));}return _0x40f4cf;}));_0x570fb6['push'](_0x47c108[_0x9b8a('0x115')]()[_0x9b8a('0x37')](function(_0x37fdb7){for(var _0x87e8f8=0x0;_0x87e8f8<_0x37fdb7[_0x9b8a('0x58')];_0x87e8f8++){_0x37fdb7[_0x87e8f8][_0x9b8a('0x116')]('channel',_0x9b8a('0x117'));}return _0x37fdb7;}));_0x570fb6[_0x9b8a('0x98')](_0x47c108['getSmsQueues']()[_0x9b8a('0x37')](function(_0x2e5bcb){for(var _0x17ed98=0x0;_0x17ed98<_0x2e5bcb[_0x9b8a('0x58')];_0x17ed98++){_0x2e5bcb[_0x17ed98][_0x9b8a('0x116')](_0x9b8a('0xae'),'Sms');}return _0x2e5bcb;}));_0x570fb6[_0x9b8a('0x98')](_0x47c108[_0x9b8a('0x119')]()[_0x9b8a('0x37')](function(_0xc353b0){for(var _0x1e8d8e=0x0;_0x1e8d8e<_0xc353b0[_0x9b8a('0x58')];_0x1e8d8e++){_0xc353b0[_0x1e8d8e][_0x9b8a('0x116')](_0x9b8a('0xae'),_0x9b8a('0x11a'));}return _0xc353b0;}));_0x570fb6[_0x9b8a('0x98')](_0x47c108['getFaxQueues']()[_0x9b8a('0x37')](function(_0x2295b1){for(var _0x302dc7=0x0;_0x302dc7<_0x2295b1['length'];_0x302dc7++){_0x2295b1[_0x302dc7][_0x9b8a('0x116')](_0x9b8a('0xae'),_0x9b8a('0x123'));}return _0x2295b1;}));_0x570fb6['push'](_0x47c108[_0x9b8a('0x124')]()[_0x9b8a('0x37')](function(_0x3d14d6){for(var _0x297b6d=0x0;_0x297b6d<_0x3d14d6[_0x9b8a('0x58')];_0x297b6d++){_0x3d14d6[_0x297b6d][_0x9b8a('0x116')](_0x9b8a('0xae'),_0x9b8a('0x11c'));}return _0x3d14d6;}));return BPromise[_0x9b8a('0x99')](_0x570fb6);})[_0x9b8a('0x37')](function(_0x535ea1){var _0x143687=_[_0x9b8a('0x11d')](_0x535ea1);_0x570fb6=[];return db[_0x9b8a('0x62')][_0x9b8a('0x11e')](function(_0x1b7438){for(var _0xd084fa=0x0;_0xd084fa<_0x143687[_0x9b8a('0x58')];_0xd084fa++){_0x570fb6[_0x9b8a('0x98')](_0x143687[_0xd084fa][_0x9b8a('0x125')](_0xf177f4['id']),{'transaction':_0x1b7438});}return BPromise[_0x9b8a('0x99')](_0x570fb6)[_0x9b8a('0x37')](function(){if(_0xf177f4[_0x9b8a('0xaf')]){return BPromise['each'](_[_0x9b8a('0x41')](_0x143687,function(_0x2b7a9e){return _0x2b7a9e[_0x9b8a('0x120')](_0x9b8a('0xae'))==='Voice';}),function(_0x44679e){return db[_0x9b8a('0xc2')][_0x9b8a('0x47')]({'where':{'VoiceQueueId':_0x44679e['id'],'UserId':_0xf177f4['id']},'transaction':_0x1b7438});});}else{return;}})['then'](function(){for(var _0x4498bc=0x0;_0x4498bc<_0x143687[_0x9b8a('0x58')];_0x4498bc++){var _0x2636ef=_0x143687[_0x4498bc][_0x9b8a('0x120')]('channel');var _0x2018f5=_0x2636ef+_0x9b8a('0x121');socket[_0x9b8a('0xba')](_0x9b8a('0x3c')+_0x2636ef+_0x9b8a('0xc1'),{'UserId':_0xf177f4['id'],['queueField']:_0x143687[_0x4498bc]['id']});}});});});}});}})[_0x9b8a('0x37')](respondWithStatusCode(_0x30800e,null))['catch'](handleError(_0x30800e,null));};exports['getLists']=function(_0xef540f,_0x293cf8,_0x2efb77){var _0x5071ac={};var _0x132841={};var _0x197fdf;var _0x2447ec;return db[_0x9b8a('0x4b')]['findOne']({'where':{'id':_0xef540f['params']['id']}})['then'](handleEntityNotFound(_0x293cf8,null))[_0x9b8a('0x37')](function(_0x83f4d7){if(_0x83f4d7){_0x197fdf=_0x83f4d7;_0x132841['model']=_[_0x9b8a('0x53')](db[_0x9b8a('0xcf')][_0x9b8a('0x4c')]);_0x132841[_0x9b8a('0x52')]=_[_0x9b8a('0x53')](_0xef540f[_0x9b8a('0x52')]);_0x132841[_0x9b8a('0x54')]=_[_0x9b8a('0x55')](_0x132841[_0x9b8a('0x4e')],_0x132841[_0x9b8a('0x52')]);_0x5071ac[_0x9b8a('0x56')]=_[_0x9b8a('0x55')](_0x132841[_0x9b8a('0x4e')],qs[_0x9b8a('0x57')](_0xef540f[_0x9b8a('0x52')][_0x9b8a('0x57')]));_0x5071ac[_0x9b8a('0x56')]=_0x5071ac[_0x9b8a('0x56')]['length']?_0x5071ac[_0x9b8a('0x56')]:_0x132841['model'];_0x5071ac[_0x9b8a('0x5b')]=qs[_0x9b8a('0x5c')](_0xef540f[_0x9b8a('0x52')]['sort']);_0x5071ac[_0x9b8a('0x5d')]=qs[_0x9b8a('0x54')](_[_0x9b8a('0x5e')](_0xef540f[_0x9b8a('0x52')],_0x132841[_0x9b8a('0x54')]));if(_0xef540f[_0x9b8a('0x52')][_0x9b8a('0x41')]){_0x5071ac['where']=_['merge'](_0x5071ac[_0x9b8a('0x5d')],{'$or':_[_0x9b8a('0x4a')](_0x5071ac[_0x9b8a('0x56')],function(_0x540ba4){var _0x129fca={};_0x129fca[_0x540ba4]={'$like':'%'+_0xef540f['query']['filter']+'%'};return _0x129fca;})});}_0x5071ac=_['merge']({},_0x5071ac,_0xef540f[_0x9b8a('0x6c')]);return _0x197fdf[_0x9b8a('0x126')](_0x5071ac);}})[_0x9b8a('0x37')](function(_0x3fee41){if(_0x3fee41){_0x2447ec=_0x3fee41[_0x9b8a('0x58')];if(!_0xef540f[_0x9b8a('0x52')][_0x9b8a('0x59')](_0x9b8a('0x5a'))){_0x5071ac[_0x9b8a('0x30')]=qs[_0x9b8a('0x30')](_0xef540f[_0x9b8a('0x52')]['limit']);_0x5071ac[_0x9b8a('0x2f')]=qs[_0x9b8a('0x2f')](_0xef540f[_0x9b8a('0x52')]['offset']);}return _0x197fdf['getLists'](_0x5071ac);}})['then'](function(_0x5bedd0){if(_0x5bedd0){return _0x5bedd0?{'count':_0x2447ec,'rows':_0x5bedd0}:null;}})[_0x9b8a('0x37')](respondWithResult(_0x293cf8,null))[_0x9b8a('0x2b')](handleError(_0x293cf8,null));};exports[_0x9b8a('0x127')]=function(_0x1138a7,_0x1bb448,_0x4a89e0){var _0x31fa72={};var _0x1f0a4f={};var _0x1cbb84;var _0x370b22;return db[_0x9b8a('0x4b')][_0x9b8a('0xa8')]({'where':{'id':_0x1138a7[_0x9b8a('0x6a')]['id']}})[_0x9b8a('0x37')](handleEntityNotFound(_0x1bb448,null))[_0x9b8a('0x37')](function(_0x5bca15){if(_0x5bca15){_0x1cbb84=_0x5bca15;_0x1f0a4f['model']=_[_0x9b8a('0x53')](db[_0x9b8a('0x4b')]['rawAttributes']);_0x1f0a4f['query']=_[_0x9b8a('0x53')](_0x1138a7[_0x9b8a('0x52')]);_0x1f0a4f['filters']=_[_0x9b8a('0x55')](_0x1f0a4f[_0x9b8a('0x4e')],_0x1f0a4f[_0x9b8a('0x52')]);_0x31fa72[_0x9b8a('0x56')]=_[_0x9b8a('0x55')](_0x1f0a4f[_0x9b8a('0x4e')],qs[_0x9b8a('0x57')](_0x1138a7[_0x9b8a('0x52')][_0x9b8a('0x57')]));_0x31fa72['attributes']=_0x31fa72[_0x9b8a('0x56')][_0x9b8a('0x58')]?_0x31fa72[_0x9b8a('0x56')]:_0x1f0a4f[_0x9b8a('0x4e')];_0x31fa72[_0x9b8a('0x5b')]=qs[_0x9b8a('0x5c')](_0x1138a7[_0x9b8a('0x52')][_0x9b8a('0x5c')]);_0x31fa72['where']=qs[_0x9b8a('0x54')](_[_0x9b8a('0x5e')](_0x1138a7[_0x9b8a('0x52')],_0x1f0a4f[_0x9b8a('0x54')]));if(_0x1138a7['query']['filter']){_0x31fa72[_0x9b8a('0x5d')]=_[_0x9b8a('0x5f')](_0x31fa72['where'],{'$or':_[_0x9b8a('0x4a')](_0x31fa72[_0x9b8a('0x56')],function(_0x18c184){var _0x293ed3={};_0x293ed3[_0x18c184]={'$like':'%'+_0x1138a7[_0x9b8a('0x52')][_0x9b8a('0x41')]+'%'};return _0x293ed3;})});}_0x31fa72[_0x9b8a('0x4e')]=db[_0x9b8a('0x4b')];_0x31fa72['as']=_0x9b8a('0x3d');_0x31fa72=_[_0x9b8a('0x5f')]({},_0x31fa72,_0x1138a7[_0x9b8a('0x6c')]);return _0x1cbb84[_0x9b8a('0xf0')]({'include':[_0x31fa72]});}})[_0x9b8a('0x37')](function(_0x335086){if(_0x335086){var _0x1015b7={},_0xa1768e=[],_0x6e9fc5=0x0;for(var _0xa66df6=0x0;_0xa66df6<_0x335086[_0x9b8a('0x58')];_0xa66df6+=0x1){for(var _0xbbbc59=0x0,_0x4c7c22;_0xbbbc59<_0x335086[_0xa66df6][_0x9b8a('0x3d')][_0x9b8a('0x58')];_0xbbbc59+=0x1){_0x4c7c22=_0x335086[_0xa66df6]['Agents'][_0xbbbc59][_0x9b8a('0x38')]({'plain':!![]});_0x1015b7[_0x4c7c22['id']]=_0x4c7c22;}}_0x1015b7=_[_0x9b8a('0x128')](_0x1015b7);for(var _0x4e8131=qs[_0x9b8a('0x2f')](_0x1138a7['query'][_0x9b8a('0x2f')]);_0x4e8131<_0x1015b7['length']&&_0xa1768e[_0x9b8a('0x58')]=_0x2f3d42){_0x14d2d7=_0x2f3d42;_0x1d95fd=0xc8;}else{_0x1d95fd=0xce;}_0x337ee1['status'](_0x1d95fd);return _0x337ee1[_0x0c80('0x2f')](_0x0c80('0x30'),_0x3becfb+'-'+_0x14d2d7+'/'+_0x2f3d42)[_0x0c80('0x31')](_0x3c6ae6);}return null;};}function patchUpdates(_0x5889e0){return function(_0x51b25e){try{jsonpatch[_0x0c80('0x32')](_0x51b25e,_0x5889e0,!![]);}catch(_0x4bccfe){return BPromise['reject'](_0x4bccfe);}return _0x51b25e[_0x0c80('0x33')]();};}function saveUpdates(_0x4d5fe2,_0x2d1cf0){return function(_0x59b1a1){if(_0x59b1a1){return _0x59b1a1['update'](_0x4d5fe2)[_0x0c80('0x22')](function(_0x8d8b30){return _0x8d8b30;});}return null;};}function removeEntity(_0x14ce3a,_0x5f1ae9){return function(_0x908496){if(_0x908496){return _0x908496[_0x0c80('0x34')]()['then'](function(){var _0x19e780=_0x908496[_0x0c80('0x35')]({'plain':!![]});if(_0x19e780['role']==='admin')return;var _0x96b404=[{'name':_0x0c80('0x36'),'value':_0x0c80('0x37'),'ignore':!![]},{'name':'Agents','value':_0x0c80('0x38'),'ignore':![]},{'name':_0x0c80('0x39'),'value':_0x0c80('0x3a'),'ignore':![]}];var _0x2422d8=_(_0x96b404)['filter'](_0x0c80('0x3b'))['map'](_0x0c80('0x3c'))[_0x0c80('0x3c')]();if(_[_0x0c80('0x3d')](_0x2422d8,_0x19e780[_0x0c80('0x3e')])){return;}var _0x2af0ee=_[_0x0c80('0x3f')](_0x96b404,['value',_0x19e780[_0x0c80('0x3e')]])[_0x0c80('0x40')];return db[_0x0c80('0x41')][_0x0c80('0x34')]({'where':{'type':_0x2af0ee,'resourceId':_0x19e780['id']}})[_0x0c80('0x22')](function(){return _0x908496;});})[_0x0c80('0x22')](function(){_0x14ce3a[_0x0c80('0x42')](0xcc)[_0x0c80('0x43')]();});}};}function handleEntityNotFound(_0x5af400,_0x2740a4){return function(_0x57f7c0){if(!_0x57f7c0){_0x5af400[_0x0c80('0x2d')](0x194);}return _0x57f7c0;};}function handleError(_0x2acf0d,_0x1fdd83){_0x1fdd83=_0x1fdd83||0x1f4;return function(_0x286ef6){logger['error'](_0x286ef6[_0x0c80('0x44')]);if(_0x286ef6['name']){delete _0x286ef6[_0x0c80('0x40')];}_0x2acf0d[_0x0c80('0x42')](_0x1fdd83)[_0x0c80('0x45')](_0x286ef6);};}exports[_0x0c80('0x46')]=function(_0x43dbf3,_0x4a1612){var _0x2ab647={},_0x2eb7d9={},_0x22c718={'count':0x0,'rows':[]};var _0x39a62b=_['map'](db[_0x0c80('0x47')][_0x0c80('0x48')],function(_0x255a27){return{'name':_0x255a27[_0x0c80('0x49')],'type':_0x255a27[_0x0c80('0x4a')]['key']};});_0x2eb7d9[_0x0c80('0x4b')]=_['differenceBy'](_[_0x0c80('0x4c')](_0x39a62b,'name'),[_0x0c80('0x4d'),_0x0c80('0x4e')]);_0x2eb7d9['query']=_[_0x0c80('0x4f')](_0x43dbf3[_0x0c80('0x50')]);_0x2eb7d9[_0x0c80('0x51')]=_[_0x0c80('0x52')](_0x2eb7d9[_0x0c80('0x4b')],_0x2eb7d9['query']);_0x2ab647[_0x0c80('0x53')]=_[_0x0c80('0x52')](_0x2eb7d9[_0x0c80('0x4b')],qs[_0x0c80('0x54')](_0x43dbf3[_0x0c80('0x50')][_0x0c80('0x54')]));_0x2ab647[_0x0c80('0x53')]=_0x2ab647[_0x0c80('0x53')][_0x0c80('0x55')]?_0x2ab647['attributes']:_0x2eb7d9[_0x0c80('0x4b')];if(!_0x43dbf3[_0x0c80('0x50')][_0x0c80('0x56')]('nolimit')){_0x2ab647[_0x0c80('0x57')]=qs['limit'](_0x43dbf3['query'][_0x0c80('0x57')]);_0x2ab647[_0x0c80('0x2e')]=qs[_0x0c80('0x2e')](_0x43dbf3['query']['offset']);}_0x2ab647[_0x0c80('0x58')]=qs[_0x0c80('0x59')](_0x43dbf3[_0x0c80('0x50')][_0x0c80('0x59')]);_0x2ab647[_0x0c80('0x5a')]=qs[_0x0c80('0x51')](_[_0x0c80('0x5b')](_0x43dbf3[_0x0c80('0x50')],_0x2eb7d9[_0x0c80('0x51')]),_0x39a62b);if(_0x43dbf3[_0x0c80('0x50')][_0x0c80('0x5c')]){_0x2ab647['where']=_[_0x0c80('0x5d')](_0x2ab647[_0x0c80('0x5a')],{'$or':_['map'](_0x39a62b,function(_0x1ea96a){if(_0x1ea96a[_0x0c80('0x4a')]!==_0x0c80('0x5e')){return db[_0x0c80('0x5f')][_0x0c80('0x5a')](db[_0x0c80('0x5f')]['fn'](_0x0c80('0x60'),db[_0x0c80('0x5f')][_0x0c80('0x61')](_0x1ea96a[_0x0c80('0x40')])),{'$like':db[_0x0c80('0x5f')]['fn'](_0x0c80('0x60'),'%'+_0x43dbf3['query']['filter']+'%')});}})});}_0x2ab647=_['merge']({},_0x2ab647,_0x43dbf3[_0x0c80('0x62')]);var _0x252fa4={'where':_0x2ab647['where']};return db[_0x0c80('0x47')][_0x0c80('0x63')](_0x252fa4)[_0x0c80('0x22')](function(_0x6b6d48){_0x22c718[_0x0c80('0x63')]=_0x6b6d48;if(_0x43dbf3[_0x0c80('0x50')][_0x0c80('0x64')]){_0x2ab647['include']=[{'all':!![]}];}return db[_0x0c80('0x47')]['findAll'](_0x2ab647);})['then'](function(_0x5881b6){_0x22c718[_0x0c80('0x65')]=_0x5881b6;return _0x22c718;})[_0x0c80('0x22')](respondWithFilteredResult(_0x4a1612,_0x2ab647))[_0x0c80('0x66')](handleError(_0x4a1612,null));};exports['show']=function(_0xc1a04a,_0x5470d7){var _0x1cb426={'raw':![],'where':{'id':_0xc1a04a[_0x0c80('0x67')]['id']}},_0x407c32={};_0x407c32[_0x0c80('0x4b')]=_[_0x0c80('0x68')](_['keys'](db[_0x0c80('0x47')][_0x0c80('0x48')]),[_0x0c80('0x4d'),_0x0c80('0x4e')]);_0x407c32[_0x0c80('0x50')]=_[_0x0c80('0x4f')](_0xc1a04a[_0x0c80('0x50')]);_0x407c32[_0x0c80('0x51')]=_[_0x0c80('0x52')](_0x407c32[_0x0c80('0x4b')],_0x407c32[_0x0c80('0x50')]);_0x1cb426[_0x0c80('0x53')]=_[_0x0c80('0x52')](_0x407c32[_0x0c80('0x4b')],qs[_0x0c80('0x54')](_0xc1a04a['query'][_0x0c80('0x54')]));_0x1cb426[_0x0c80('0x53')]=_0x1cb426['attributes'][_0x0c80('0x55')]?_0x1cb426[_0x0c80('0x53')]:_0x407c32[_0x0c80('0x4b')];if(_0xc1a04a[_0x0c80('0x50')]['includeAll']){_0x1cb426[_0x0c80('0x69')]=[{'all':!![]}];}_0x1cb426=_['merge']({},_0x1cb426,_0xc1a04a[_0x0c80('0x62')]);return db[_0x0c80('0x47')][_0x0c80('0x3f')](_0x1cb426)[_0x0c80('0x22')](handleEntityNotFound(_0x5470d7,null))[_0x0c80('0x22')](respondWithResult(_0x5470d7,null))[_0x0c80('0x66')](handleError(_0x5470d7,null));};exports[_0x0c80('0x6a')]=function(_0x1fb9ab,_0x242663){if(_0x1fb9ab['body']['id']){delete _0x1fb9ab['body']['id'];}delete _0x1fb9ab['body'][_0x0c80('0x3e')];return db['User'][_0x0c80('0x3f')]({'where':{'id':_0x1fb9ab['params']['id']}})[_0x0c80('0x22')](handleEntityNotFound(_0x242663,null))['then'](saveUpdates(_0x1fb9ab[_0x0c80('0x6b')],null))['then'](respondWithResult(_0x242663,null))[_0x0c80('0x66')](handleError(_0x242663,null));};exports[_0x0c80('0x6c')]=function(_0x1e260c,_0x13ca1a){return db[_0x0c80('0x47')][_0x0c80('0x6c')]()[_0x0c80('0x22')](respondWithResult(_0x13ca1a,null))['catch'](handleError(_0x13ca1a,null));};exports['addContacts']=function(_0x1cd358,_0x615911,_0x405241){return db[_0x0c80('0x47')][_0x0c80('0x3f')]({'where':{'id':_0x1cd358[_0x0c80('0x67')]['id']}})['then'](handleEntityNotFound(_0x615911,null))[_0x0c80('0x22')](function(_0x1592e0){if(_0x1592e0){return _0x1592e0[_0x0c80('0x6d')](_0x1cd358['body'][_0x0c80('0x6e')],_[_0x0c80('0x6f')](_0x1cd358[_0x0c80('0x6b')],['ids','id'])||{});}})['then'](respondWithResult(_0x615911,null))['catch'](handleError(_0x615911,null));};function validateUser(_0x38c1b7){return new BPromise(function(_0x2dbb41,_0x45b19d){if(_0x38c1b7['internal'])return _0x2dbb41(_0x38c1b7);return db[_0x0c80('0x70')]['findById'](0x1)[_0x0c80('0x22')](function(_0x58e141){if(_0x58e141[_0x0c80('0x71')])authService['validatePasswordPattern'](_0x38c1b7[_0x0c80('0x4d')]);db['User'][_0x0c80('0x72')](_0x0c80('0x73'))[_0x0c80('0x22')](function(_0x204d1a){if(_[_0x0c80('0x74')](_0x204d1a)){_0x38c1b7[_0x0c80('0x73')]=_0x58e141[_0x0c80('0x75')]||0x1;return;}if(_[_0x0c80('0x74')](_0x58e141[_0x0c80('0x75')])||_0x58e141[_0x0c80('0x75')]===_0x204d1a){_0x38c1b7[_0x0c80('0x73')]=_0x204d1a+0x1;return;}if(_0x58e141['min_internal']>_0x204d1a){_0x38c1b7[_0x0c80('0x73')]=_0x58e141[_0x0c80('0x75')];return;}return db[_0x0c80('0x5f')][_0x0c80('0x50')]('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'][_0x0c80('0x76')][_0x0c80('0x77')]})[_0x0c80('0x22')](function(_0x54ba8f){if(_0x54ba8f&&_0x54ba8f[_0x0c80('0x55')]){for(var _0xace624=0x0,_0x39d76d=_0x54ba8f[_0x0c80('0x55')];_0xace624<_0x39d76d&&_['isNil'](_0x38c1b7[_0x0c80('0x73')]);_0xace624++){if(_0x58e141[_0x0c80('0x75')]<=_0x54ba8f[_0xace624][_0x0c80('0x78')]){_0x38c1b7[_0x0c80('0x73')]=_0x54ba8f[_0xace624][_0x0c80('0x78')];}else if(_0x58e141[_0x0c80('0x75')]>_0x54ba8f[_0xace624][_0x0c80('0x78')]&&_0x58e141[_0x0c80('0x75')]<=_0x54ba8f[_0xace624]['to']){_0x38c1b7[_0x0c80('0x73')]=_0x58e141[_0x0c80('0x75')];}}}if(_['isNil'](_0x38c1b7[_0x0c80('0x73')])){_0x38c1b7[_0x0c80('0x73')]=_0x204d1a+0x1;}return _0x2dbb41(_0x38c1b7);});});})[_0x0c80('0x66')](function(_0x43b2e5){_0x45b19d(_0x43b2e5);});});}function updateUser(_0x39c049){return new BPromise(function(_0x212aea,_0xa63678){try{if(_0x39c049[_0x0c80('0x79')]){_0x39c049['mailbox']=_0x39c049[_0x0c80('0x73')];_0x39c049[_0x0c80('0x7a')]={'mailbox':_0x39c049['internal'],'password':_0x39c049[_0x0c80('0x4d')],'fullname':_0x39c049[_0x0c80('0x7b')],'email':_0x39c049[_0x0c80('0x7c')]};}if(_0x39c049[_0x0c80('0x3e')]==='agent'){if(!_0x39c049[_0x0c80('0x7d')])_0x39c049['permissions']=[_0x0c80('0x7e'),'102',_0x0c80('0x7f'),_0x0c80('0x80'),_0x0c80('0x81'),_0x0c80('0x82'),_0x0c80('0x83'),_0x0c80('0x84'),_0x0c80('0x85'),_0x0c80('0x86'),'109',_0x0c80('0x87'),_0x0c80('0x88'),_0x0c80('0x89'),_0x0c80('0x8a')];}_0x212aea(_0x39c049);}catch(_0xca7f93){_0xa63678(_0xca7f93);}});}exports['create']=function(_0x1d1190,_0x444f05){if(_0x1d1190['user'][_0x0c80('0x3e')]==='agent')throw new Error('Unauthorized');if(_0x1d1190['body'][_0x0c80('0x3e')]==='user'&&_0x1d1190[_0x0c80('0x37')][_0x0c80('0x3e')]!==_0x0c80('0x8b')){throw new Error(_0x0c80('0x8c'));}if(_0x1d1190[_0x0c80('0x6b')][_0x0c80('0x3e')]===_0x0c80('0x8b')&&_0x1d1190[_0x0c80('0x37')]['role']!==_0x0c80('0x8b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x0c80('0x8d')]([_0x1d1190[_0x0c80('0x6b')]])[_0x0c80('0x22')](function(){return validateUser(_0x1d1190[_0x0c80('0x6b')]);})[_0x0c80('0x22')](function(_0x3912f6){return updateUser(_0x3912f6)[_0x0c80('0x22')](function(_0x1b5f51){if(_0x1b5f51['role']===_0x0c80('0x8b')){_0x1b5f51[_0x0c80('0x8e')]=_0x1d1190[_0x0c80('0x37')][_0x0c80('0x8e')];delete _0x1b5f51['userProfileId'];}return _0x1b5f51;});})[_0x0c80('0x22')](function(_0x35f8db){return db['User'][_0x0c80('0x8f')](_0x35f8db,{'include':[{'model':db[_0x0c80('0x7a')],'as':_0x0c80('0x7a')}]});})[_0x0c80('0x22')](function(_0x123c6a){if(_0x1d1190[_0x0c80('0x6b')]['role']==='user')return _0x123c6a;if(_0x1d1190[_0x0c80('0x37')][_0x0c80('0x3e')]!==_0x0c80('0x37'))return _0x123c6a;return db[_0x0c80('0x90')][_0x0c80('0x3f')]({'where':{'name':_0x123c6a[_0x0c80('0x3e')]===_0x0c80('0x38')?_0x0c80('0x91'):_0x0c80('0x39'),'userProfileId':_0x1d1190['user'][_0x0c80('0x92')]},'raw':!![]})[_0x0c80('0x22')](function(_0x48b4c9){if(!_0x48b4c9||_0x48b4c9['autoAssociation']!=0x0)return _0x123c6a;return db[_0x0c80('0x41')][_0x0c80('0x8f')]({'name':_0x123c6a[_0x0c80('0x40')],'resourceId':_0x123c6a['id'],'type':_0x48b4c9[_0x0c80('0x40')],'sectionId':_0x48b4c9['id']},{})['then'](function(){return _0x123c6a;});})[_0x0c80('0x66')](function(_0x497c24){logger[_0x0c80('0x29')](_0x0c80('0x93'),_0x497c24);throw _0x497c24;});})[_0x0c80('0x22')](respondWithResult(_0x444f05,0xc9))['catch'](handleError(_0x444f05,null));};exports[_0x0c80('0x94')]=function(_0x836b58,_0x27ae8d){var _0x130e7c=_0x836b58[_0x0c80('0x6b')];var _0x414e17=[];if(_0x836b58[_0x0c80('0x37')]['role']===_0x0c80('0x38'))throw new Error(_0x0c80('0x95'));if(_[_0x0c80('0x96')](_0x130e7c,['role',_0x0c80('0x37')])&&_0x836b58[_0x0c80('0x37')][_0x0c80('0x3e')]!==_0x0c80('0x8b')){throw new Error(_0x0c80('0x8c'));}if(_['some'](_0x130e7c,[_0x0c80('0x3e'),_0x0c80('0x8b')])&&_0x836b58['user']['role']!==_0x0c80('0x8b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x0c80('0x8d')](_0x130e7c)['then'](function(){return validateUser(_0x130e7c[0x0]);})[_0x0c80('0x22')](function(){for(var _0x5409b9=0x1;_0x5409b9<_0x130e7c[_0x0c80('0x55')];_0x5409b9++){var _0x5461cb=_0x130e7c[_0x5409b9-0x1]['internal'];if(!_0x130e7c[_0x5409b9][_0x0c80('0x73')])_0x130e7c[_0x5409b9][_0x0c80('0x73')]=_0x5461cb+0x1;_0x414e17['push'](validateUser(_0x130e7c[_0x5409b9]));}return BPromise['all'](_0x414e17);})[_0x0c80('0x22')](function(){_0x414e17=[];for(var _0x384ea3=0x0;_0x384ea3<_0x130e7c[_0x0c80('0x55')];_0x384ea3++){_0x414e17[_0x0c80('0x97')](updateUser(_0x130e7c[_0x384ea3]));}return BPromise[_0x0c80('0x98')](_0x414e17);})['then'](function(){return BPromise['each'](_0x130e7c,function(_0x310ef3){return db[_0x0c80('0x47')][_0x0c80('0x8f')](_0x310ef3,{'include':[{'model':db['VoiceMail'],'as':_0x0c80('0x7a')}]})[_0x0c80('0x22')](function(_0x587679){_0x310ef3['id']=_0x587679['id'];return _0x310ef3;});});})[_0x0c80('0x22')](function(_0x3dac07){if(_0x836b58[_0x0c80('0x6b')][_0x0c80('0x3e')]==='user')return _0x3dac07;if(_0x836b58[_0x0c80('0x37')][_0x0c80('0x3e')]!=='user')return _0x3dac07;var _0x58ce99=_[_0x0c80('0x96')](_0x3dac07,function(_0x3ab653){return _0x3ab653[_0x0c80('0x3e')]===_0x0c80('0x38')||_0x3ab653['role']==='telephone';});if(!_0x58ce99)return _0x3dac07;return db['UserProfileSection']['findAll']({'where':{'name':{'$or':[_0x0c80('0x91'),_0x0c80('0x39')]},'userProfileId':_0x836b58[_0x0c80('0x37')][_0x0c80('0x92')]},'raw':!![]})['then'](function(_0x3d443d){if(_['isEmpty'](_0x3d443d)||!_['some'](_0x3d443d,[_0x0c80('0x99'),0x0]))return _0x3dac07;_0x414e17=[];var _0x1c260a=_(_0x3d443d)[_0x0c80('0x4c')](function(_0x3e9cc2){if(_0x3e9cc2[_0x0c80('0x99')]===0x1)return;return _0x3e9cc2[_0x0c80('0x40')]==='Agents'?'agent':_0x0c80('0x3a');})[_0x0c80('0x9a')]()['value']();for(var _0x2afdc1=0x0;_0x2afdc1<_0x3dac07[_0x0c80('0x55')];_0x2afdc1++){if(!_[_0x0c80('0x3d')](_0x1c260a,_0x3dac07[_0x2afdc1]['role']))return;var _0x249125=_0x3dac07[_0x2afdc1][_0x0c80('0x3e')]===_0x0c80('0x38')?_0x0c80('0x91'):_0x0c80('0x39');_0x414e17['push'](db[_0x0c80('0x41')][_0x0c80('0x8f')]({'name':_0x3dac07[_0x2afdc1][_0x0c80('0x40')],'resourceId':_0x3dac07[_0x2afdc1]['id'],'type':_0x249125,'sectionId':_[_0x0c80('0x3f')](_0x3d443d,[_0x0c80('0x40'),_0x249125])['id']},{}));}return BPromise[_0x0c80('0x98')](_0x414e17);});})[_0x0c80('0x22')](respondWithResult(_0x27ae8d,0xc9))[_0x0c80('0x66')](handleError(_0x27ae8d,null));};exports['changePassword']=function(_0x3db5b3,_0x5cb279,_0x310779){if(_0x3db5b3['body']['id']){delete _0x3db5b3[_0x0c80('0x6b')]['id'];}return db['User'][_0x0c80('0x3f')]({'where':{'id':_0x3db5b3[_0x0c80('0x67')]['id']}})[_0x0c80('0x22')](function(_0x4f62e5){if(!_0x4f62e5)return null;if(_0x4f62e5['id']===_0x3db5b3[_0x0c80('0x37')]['id']){if(!_0x3db5b3[_0x0c80('0x6b')][_0x0c80('0x9b')]||!_0x3db5b3['body'][_0x0c80('0x9c')]){throw new db[(_0x0c80('0x9d'))]['ValidationError'](_0x0c80('0x9e'));}if(!_0x4f62e5[_0x0c80('0x9f')](_0x3db5b3[_0x0c80('0x6b')]['oldPassword'])){throw new db[(_0x0c80('0x9d'))][(_0x0c80('0xa0'))](_0x0c80('0xa1'));}if(_0x3db5b3[_0x0c80('0x6b')]['oldPassword']===_0x3db5b3[_0x0c80('0x6b')][_0x0c80('0x9c')]){throw new db['Sequelize'][(_0x0c80('0xa0'))](_0x0c80('0xa2'));}}else if(_0x3db5b3['user'][_0x0c80('0x3e')]==='admin'){if(!_0x3db5b3[_0x0c80('0x6b')]['newPassword']){throw new db[(_0x0c80('0x9d'))]['ValidationError'](_0x0c80('0xa3'));}}else if(_0x3db5b3[_0x0c80('0x37')][_0x0c80('0x3e')]===_0x0c80('0x37')){if(!_0x3db5b3['body'][_0x0c80('0x9c')]){throw new db['Sequelize'][(_0x0c80('0xa0'))](_0x0c80('0xa3'));}if(_0x4f62e5[_0x0c80('0x3e')]!==_0x0c80('0x38')){throw new db[(_0x0c80('0x9d'))][(_0x0c80('0xa0'))](_0x0c80('0x95'));}}else{throw new db[(_0x0c80('0x9d'))][(_0x0c80('0xa0'))]('Unauthorized');}return _0x4f62e5;})[_0x0c80('0x22')](handleEntityNotFound(_0x5cb279,null))[_0x0c80('0x22')](function(_0x40ae8d){return db['Setting'][_0x0c80('0xa4')]({'attributes':['id',_0x0c80('0x71'),'enforcePasswordHistory',_0x0c80('0xa5')]})[_0x0c80('0x22')](function(_0x55288d){if(_0x55288d[_0x0c80('0x71')])authService[_0x0c80('0xa6')](_0x3db5b3[_0x0c80('0x6b')]['newPassword']);if(!_0x55288d[_0x0c80('0xa7')]||!_0x40ae8d['previousPasswords'])return _0x40ae8d;authService['validatePasswordHistory'](_0x3db5b3[_0x0c80('0x6b')]['newPassword'],_0x40ae8d[_0x0c80('0xa8')],_0x55288d[_0x0c80('0xa5')]);return _0x40ae8d;})[_0x0c80('0x22')](saveUpdates({'password':_0x3db5b3[_0x0c80('0x6b')][_0x0c80('0x9c')],'passwordResetAt':_0x3db5b3['user']['id']==_0x3db5b3[_0x0c80('0x67')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x3db5b3[_0x0c80('0x6b')][_0x0c80('0x9c')],_0x40ae8d[_0x0c80('0xa8')])},null));})['then'](respondWithResult(_0x5cb279,null))['catch'](handleError(_0x5cb279,null));};exports[_0x0c80('0xa9')]=function(_0x3a2089,_0x304e98,_0x3084c9){var _0x2bba2d=_0x3a2089[_0x0c80('0x6b')][_0x0c80('0xaa')];return db[_0x0c80('0x47')][_0x0c80('0x3f')]({'where':{'id':_0x3a2089[_0x0c80('0x67')]['id']},'attributes':['id',_0x0c80('0x40'),_0x0c80('0x3e'),'online',_0x0c80('0xab'),_0x0c80('0xac'),_0x0c80('0xad')]})['then'](handleEntityNotFound(_0x304e98,null))['then'](function(_0x148e48){if(_0x148e48){if(!utils[_0x0c80('0xae')](_0x2bba2d)){throw new db['Sequelize'][(_0x0c80('0xa0'))](_0x0c80('0xaf'));}return _0x148e48[_0x0c80('0xb0')+_[_0x0c80('0xb1')](_0x2bba2d[_0x0c80('0xb2')]())+_0x0c80('0xb3')](_0x3a2089[_0x0c80('0x6b')][_0x0c80('0x6e')],{'penalty':_0x3a2089[_0x0c80('0x6b')][_0x0c80('0xb4')]||0x0})[_0x0c80('0xb5')](function(_0x58d7c4){for(var _0x32c108=0x0;_0x32c108<_0x3a2089[_0x0c80('0x6b')][_0x0c80('0x6e')][_0x0c80('0x55')];_0x32c108+=0x1){var _0x25f278={'UserId':_0x3a2089[_0x0c80('0x67')]['id']};_0x25f278[_[_0x0c80('0xb1')](_0x2bba2d['toLowerCase']())+_0x0c80('0xb6')]=_0x3a2089['body']['ids'][_0x32c108];socket[_0x0c80('0xb7')](_0x0c80('0x37')+_[_0x0c80('0xb1')](_0x2bba2d[_0x0c80('0xb2')]())+_0x0c80('0xb8'),_0x25f278);}return _0x58d7c4;})[_0x0c80('0x22')](function(){if(_0x2bba2d==='voice'){return db[_0x0c80('0xb9')][_0x0c80('0xba')]({'where':{'id':_0x3a2089[_0x0c80('0x6b')][_0x0c80('0x6e')]||[]},'raw':!![],'attributes':['id',_0x0c80('0x40')]});}})[_0x0c80('0x22')](function(_0x2c872d){var _0x141dec=_0x148e48['get']({'plain':!![]});var _0x3e8a54=[];if(_0x2bba2d==='voice'&&_0x141dec['role']===_0x0c80('0x38')&&_0x141dec['online']){for(var _0xdde06a=0x0;_0xdde06a<_0x2c872d[_0x0c80('0x55')];_0xdde06a+=0x1){_0x3e8a54[_0x0c80('0x97')]({'membername':_0x141dec[_0x0c80('0x40')],'UserId':_0x141dec['id'],'queue_name':_0x2c872d[_0xdde06a][_0x0c80('0x40')],'VoiceQueueId':_0x2c872d[_0xdde06a]['id'],'interface':_['isNil'](_0x141dec[_0x0c80('0xad')])?util[_0x0c80('0xbb')](_0x0c80('0xbc'),_0x141dec['name']):_0x141dec['interface'],'paused':_0x141dec[_0x0c80('0xac')]||![],'penalty':_0x3a2089[_0x0c80('0x6b')][_0x0c80('0xb4')]||0x0});}return BPromise['each'](_0x3e8a54,function(_0x1ac83f){return db[_0x0c80('0xbd')][_0x0c80('0xbe')](_0x1ac83f);});}return _0x148e48;});}})[_0x0c80('0x22')](respondWithStatusCode(_0x304e98,null))[_0x0c80('0x66')](handleError(_0x304e98,null));};exports[_0x0c80('0xbf')]=function(_0xb95f62,_0x48f963,_0x108c93){var _0x4af2b0;return db[_0x0c80('0x47')][_0x0c80('0x3f')]({'where':{'id':_0xb95f62[_0x0c80('0x67')]['id']},'attributes':['id','name',_0x0c80('0x3e')]})['then'](handleEntityNotFound(_0x48f963,null))[_0x0c80('0x22')](function(_0x52a4b0){if(_0x52a4b0){_0x4af2b0=_0x52a4b0;if(!_0xb95f62['query'][_0x0c80('0xaa')]||!utils[_0x0c80('0xae')](_0xb95f62[_0x0c80('0x50')]['channel'])){throw new db[(_0x0c80('0x9d'))]['ValidationError'](_0x0c80('0xaf'));}return _0x52a4b0[_0x0c80('0xc0')+_['capitalize'](_0xb95f62['query']['channel'][_0x0c80('0xb2')]())+'Queues'](_0xb95f62[_0x0c80('0x50')][_0x0c80('0x6e')]);}})[_0x0c80('0x22')](function(_0x4ebddd){for(var _0x4bee72=0x0;_0x4bee72<_0xb95f62[_0x0c80('0x50')][_0x0c80('0x6e')][_0x0c80('0x55')];_0x4bee72+=0x1){var _0x47507b={'UserId':_0xb95f62[_0x0c80('0x67')]['id']};_0x47507b[_[_0x0c80('0xb1')](_0xb95f62[_0x0c80('0x50')][_0x0c80('0xaa')][_0x0c80('0xb2')]())+_0x0c80('0xb6')]=_0xb95f62[_0x0c80('0x50')][_0x0c80('0x6e')][_0x4bee72];socket[_0x0c80('0xb7')](_0x0c80('0x37')+_[_0x0c80('0xb1')](_0xb95f62['query'][_0x0c80('0xaa')][_0x0c80('0xb2')]())+_0x0c80('0xc1'),_0x47507b);}return _0x4ebddd;})[_0x0c80('0x22')](function(){if(_0xb95f62[_0x0c80('0x50')][_0x0c80('0xaa')]===_0x0c80('0xc2')){return db[_0x0c80('0xbd')]['destroy']({'where':{'UserId':_0xb95f62['params']['id'],'VoiceQueueId':_0xb95f62[_0x0c80('0x50')][_0x0c80('0x6e')]},'individualHooks':!![]})['then'](function(){return _0x4af2b0;});}return _0x4af2b0;})[_0x0c80('0x22')](respondWithStatusCode(_0x48f963,null))['catch'](handleError(_0x48f963,null));};exports['addAvatar']=function(_0x4bd070,_0x451c68,_0x588b81){_0x4bd070['body']['userpic']=_0x4bd070[_0x0c80('0xc3')][_0x0c80('0xc4')];return db[_0x0c80('0x47')][_0x0c80('0x3f')]({'where':{'id':_0x4bd070[_0x0c80('0x67')]['id']}})['then'](handleEntityNotFound(_0x451c68,null))[_0x0c80('0x22')](saveUpdates(_0x4bd070[_0x0c80('0x6b')],null))['then'](respondWithResult(_0x451c68,null))[_0x0c80('0x66')](handleError(_0x451c68,null));};exports[_0x0c80('0xc5')]=function(_0x57196b,_0x57c903,_0x5ba07f){var _0x190bf0=path['join'](config[_0x0c80('0xc6')],_0x0c80('0xc7'));return db['User'][_0x0c80('0x3f')]({'where':{'id':_0x57196b[_0x0c80('0x67')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x57c903,null))[_0x0c80('0x22')](function(_0xa1475c){if(_0xa1475c){if(_[_0x0c80('0x74')](_0xa1475c[_0x0c80('0xc8')])){return _0x57c903[_0x0c80('0xc9')](_0x190bf0);}else{if(!fs[_0x0c80('0xca')](path[_0x0c80('0xcb')](config[_0x0c80('0xc6')],_0x0c80('0xcc'),_0xa1475c[_0x0c80('0xc8')]))){return _0x57c903['download'](_0x190bf0);}return _0x57c903[_0x0c80('0xc9')](path[_0x0c80('0xcb')](config[_0x0c80('0xc6')],_0x0c80('0xcc'),_0xa1475c[_0x0c80('0xc8')]));}}})['catch'](handleError(_0x57c903,null));};exports[_0x0c80('0xcd')]=function(_0x38d50d,_0x351f8c,_0x5349b4){var _0x5b70a0={};var _0x11e79c={};var _0xcaca3e;var _0x5a0bac;return db['User'][_0x0c80('0xa4')]({'where':{'id':_0x38d50d[_0x0c80('0x67')]['id']}})[_0x0c80('0x22')](handleEntityNotFound(_0x351f8c,null))['then'](function(_0x2eda18){if(_0x2eda18){_0xcaca3e=_0x2eda18;_0x11e79c[_0x0c80('0x4b')]=_[_0x0c80('0x4f')](db['CmContact'][_0x0c80('0x48')]);_0x11e79c[_0x0c80('0x50')]=_['keys'](_0x38d50d[_0x0c80('0x50')]);_0x11e79c['filters']=_[_0x0c80('0x52')](_0x11e79c[_0x0c80('0x4b')],_0x11e79c[_0x0c80('0x50')]);_0x5b70a0[_0x0c80('0x53')]=_[_0x0c80('0x52')](_0x11e79c['model'],qs[_0x0c80('0x54')](_0x38d50d[_0x0c80('0x50')][_0x0c80('0x54')]));_0x5b70a0[_0x0c80('0x53')]=_0x5b70a0[_0x0c80('0x53')][_0x0c80('0x55')]?_0x5b70a0[_0x0c80('0x53')]:_0x11e79c['model'];_0x5b70a0[_0x0c80('0x58')]=qs[_0x0c80('0x59')](_0x38d50d['query'][_0x0c80('0x59')]);_0x5b70a0[_0x0c80('0x5a')]=qs[_0x0c80('0x51')](_['pick'](_0x38d50d[_0x0c80('0x50')],_0x11e79c[_0x0c80('0x51')]));if(_0x38d50d[_0x0c80('0x50')][_0x0c80('0x5c')]){_0x5b70a0[_0x0c80('0x5a')]=_[_0x0c80('0x5d')](_0x5b70a0[_0x0c80('0x5a')],{'$or':_[_0x0c80('0x4c')](_0x5b70a0[_0x0c80('0x53')],function(_0x3525ed){var _0x5b36b8={};_0x5b36b8[_0x3525ed]={'$like':'%'+_0x38d50d[_0x0c80('0x50')]['filter']+'%'};return _0x5b36b8;})});}_0x5b70a0=_['merge']({},_0x5b70a0,_0x38d50d[_0x0c80('0x62')]);return _0xcaca3e[_0x0c80('0xcd')](_0x5b70a0);}})[_0x0c80('0x22')](function(_0x137208){if(_0x137208){_0x5a0bac=_0x137208[_0x0c80('0x55')];if(_0x38d50d['query'][_0x0c80('0x56')](_0x0c80('0x64'))){_0x5b70a0['include']=[{'model':db[_0x0c80('0xce')],'as':'List','required':![]},{'model':db[_0x0c80('0xcf')],'as':_0x0c80('0xd0'),'attributes':['id',_0x0c80('0x40'),_0x0c80('0xd1')],'where':_0x38d50d[_0x0c80('0x50')][_0x0c80('0xd2')]?{'id':_0x38d50d[_0x0c80('0x50')][_0x0c80('0xd2')]}:undefined,'required':_0x38d50d[_0x0c80('0x50')][_0x0c80('0xd2')]?!![]:![]}];}if(!_0x38d50d[_0x0c80('0x50')][_0x0c80('0x56')](_0x0c80('0xd3'))){_0x5b70a0[_0x0c80('0x57')]=qs[_0x0c80('0x57')](_0x38d50d[_0x0c80('0x50')][_0x0c80('0x57')]);_0x5b70a0[_0x0c80('0x2e')]=qs[_0x0c80('0x2e')](_0x38d50d[_0x0c80('0x50')][_0x0c80('0x2e')]);}return _0xcaca3e[_0x0c80('0xcd')](_0x5b70a0);}})['then'](function(_0x3bc363){if(_0x3bc363){return _0x3bc363?{'count':_0x5a0bac,'rows':_0x3bc363}:null;}})[_0x0c80('0x22')](respondWithResult(_0x351f8c,null))[_0x0c80('0x66')](handleError(_0x351f8c,null));};exports[_0x0c80('0xd4')]=function(_0x5ecd19,_0x4c7f46,_0x2cc1e6){var _0x21d289;var _0x316c8e;var _0x16a357={};var _0x110119;return db['User'][_0x0c80('0xa4')]({'where':{'id':_0x5ecd19['params']['id']},'attributes':['id','name','role']})[_0x0c80('0x22')](handleEntityNotFound(_0x4c7f46,null))[_0x0c80('0x22')](function(_0x4617df){if(!utils[_0x0c80('0xae')](_0x5ecd19['query']['channel'])){throw new db[(_0x0c80('0x9d'))][(_0x0c80('0xa0'))](_0x0c80('0xaf'));}_0x21d289=_0x4617df;var _0x2f9d24={};_0x2f9d24[_0x0c80('0x4b')]=_[_0x0c80('0x4f')](db[_[_0x0c80('0xb1')](_0x5ecd19[_0x0c80('0x50')][_0x0c80('0xaa')])+'Queue']['rawAttributes']);_0x2f9d24[_0x0c80('0x50')]=_[_0x0c80('0x4f')](_0x5ecd19[_0x0c80('0x50')]);_0x2f9d24[_0x0c80('0x51')]=_[_0x0c80('0x52')](_0x2f9d24['model'],_0x2f9d24[_0x0c80('0x50')]);_0x16a357[_0x0c80('0x53')]=_[_0x0c80('0x52')](_0x2f9d24[_0x0c80('0x4b')],qs[_0x0c80('0x54')](_0x5ecd19[_0x0c80('0x50')][_0x0c80('0x54')]));_0x16a357[_0x0c80('0x53')]=_0x16a357[_0x0c80('0x53')][_0x0c80('0x55')]?_0x16a357[_0x0c80('0x53')]:_0x2f9d24[_0x0c80('0x4b')];_0x16a357['order']=qs['sort'](_0x5ecd19['query'][_0x0c80('0x59')]);_0x16a357[_0x0c80('0x5a')]=qs[_0x0c80('0x51')](_['pick'](_0x5ecd19[_0x0c80('0x50')],_0x2f9d24[_0x0c80('0x51')]));if(_0x5ecd19['query'][_0x0c80('0x5c')]){_0x16a357[_0x0c80('0x5a')]=_[_0x0c80('0x5d')](_0x16a357[_0x0c80('0x5a')],{'$or':_[_0x0c80('0x4c')](_0x16a357[_0x0c80('0x53')],function(_0x59596b){var _0x2d6d62={};_0x2d6d62[_0x59596b]={'$like':'%'+_0x5ecd19[_0x0c80('0x50')]['filter']+'%'};return _0x2d6d62;})});}_0x16a357=_[_0x0c80('0x5d')]({},_0x16a357,_0x5ecd19[_0x0c80('0x62')]);switch(_0x21d289[_0x0c80('0x3e')]){case _0x0c80('0x8b'):return db[_[_0x0c80('0xb1')](_0x5ecd19[_0x0c80('0x50')][_0x0c80('0xaa')])+_0x0c80('0xd5')]['findAll'](_0x16a357);case _0x0c80('0x37'):case'agent':return _0x21d289['get'+_[_0x0c80('0xb1')](_0x5ecd19[_0x0c80('0x50')]['channel'])+_0x0c80('0xb3')](_0x16a357);default:throw new db[(_0x0c80('0x9d'))][(_0x0c80('0xa0'))]('Unknown\x20role');}})[_0x0c80('0x22')](function(_0x35de6f){_0x110119=_0x35de6f[_0x0c80('0x55')];if(!_0x5ecd19[_0x0c80('0x50')]['hasOwnProperty'](_0x0c80('0xd3'))){_0x16a357[_0x0c80('0x57')]=qs[_0x0c80('0x57')](_0x5ecd19[_0x0c80('0x50')][_0x0c80('0x57')]);_0x16a357[_0x0c80('0x2e')]=qs['offset'](_0x5ecd19['query'][_0x0c80('0x2e')]);}switch(_0x21d289['role']){case _0x0c80('0x8b'):return db[_[_0x0c80('0xb1')](_0x5ecd19[_0x0c80('0x50')][_0x0c80('0xaa')])+_0x0c80('0xd5')]['findAll'](_0x16a357);case _0x0c80('0x37'):case _0x0c80('0x38'):return _0x21d289['get'+_['capitalize'](_0x5ecd19[_0x0c80('0x50')][_0x0c80('0xaa')])+_0x0c80('0xb3')](_0x16a357);}})[_0x0c80('0x22')](function(_0x14ed4b){return{'count':_0x110119,'rows':_0x14ed4b};})[_0x0c80('0x22')](respondWithResult(_0x4c7f46,null))[_0x0c80('0x66')](handleError(_0x4c7f46,null));};exports['getVoiceQueuesRt']=function(_0x1c1a08,_0x26248b,_0x33e09c){var _0x2e5bf0={};var _0x726104={};var _0x2c0ee4;var _0x1d55f8;return db[_0x0c80('0x47')][_0x0c80('0xa4')]({'where':{'id':_0x1c1a08[_0x0c80('0x67')]['id']}})[_0x0c80('0x22')](handleEntityNotFound(_0x26248b,null))['then'](function(_0x977828){if(_0x977828){_0x2c0ee4=_0x977828;_0x726104[_0x0c80('0x4b')]=_[_0x0c80('0x4f')](db[_0x0c80('0xbd')][_0x0c80('0x48')]);_0x726104[_0x0c80('0x50')]=_[_0x0c80('0x4f')](_0x1c1a08['query']);_0x726104['filters']=_[_0x0c80('0x52')](_0x726104[_0x0c80('0x4b')],_0x726104[_0x0c80('0x50')]);_0x2e5bf0['attributes']=_[_0x0c80('0x52')](_0x726104['model'],qs[_0x0c80('0x54')](_0x1c1a08[_0x0c80('0x50')]['fields']));_0x2e5bf0[_0x0c80('0x53')]=_0x2e5bf0[_0x0c80('0x53')][_0x0c80('0x55')]?_0x2e5bf0[_0x0c80('0x53')]:_0x726104[_0x0c80('0x4b')];_0x2e5bf0[_0x0c80('0x58')]=qs['sort'](_0x1c1a08[_0x0c80('0x50')]['sort']);_0x2e5bf0['where']=qs[_0x0c80('0x51')](_[_0x0c80('0x5b')](_0x1c1a08[_0x0c80('0x50')],_0x726104[_0x0c80('0x51')]));if(_0x1c1a08[_0x0c80('0x50')][_0x0c80('0x5c')]){_0x2e5bf0[_0x0c80('0x5a')]=_[_0x0c80('0x5d')](_0x2e5bf0[_0x0c80('0x5a')],{'$or':_['map'](_0x2e5bf0['attributes'],function(_0x46a94d){var _0x245bf1={};_0x245bf1[_0x46a94d]={'$like':'%'+_0x1c1a08['query'][_0x0c80('0x5c')]+'%'};return _0x245bf1;})});}_0x2e5bf0=_[_0x0c80('0x5d')]({},_0x2e5bf0,_0x1c1a08[_0x0c80('0x62')]);return _0x2c0ee4[_0x0c80('0xd6')](_0x2e5bf0);}})[_0x0c80('0x22')](function(_0x3a867a){if(_0x3a867a){_0x1d55f8=_0x3a867a['length'];if(!_0x1c1a08[_0x0c80('0x50')][_0x0c80('0x56')](_0x0c80('0xd3'))){_0x2e5bf0[_0x0c80('0x57')]=qs[_0x0c80('0x57')](_0x1c1a08[_0x0c80('0x50')][_0x0c80('0x57')]);_0x2e5bf0['offset']=qs[_0x0c80('0x2e')](_0x1c1a08['query'][_0x0c80('0x2e')]);}return _0x2c0ee4[_0x0c80('0xd6')](_0x2e5bf0);}})[_0x0c80('0x22')](function(_0x5a4123){if(_0x5a4123){return _0x5a4123?{'count':_0x1d55f8,'rows':_0x5a4123}:null;}})[_0x0c80('0x22')](respondWithResult(_0x26248b,null))['catch'](handleError(_0x26248b,null));};exports[_0x0c80('0xd7')]=function(_0x4df866,_0x57172b,_0xf85192){var _0x3bea4c={};var _0x46c3cc={};var _0x7d2487;var _0x4c36cb;return db[_0x0c80('0x47')][_0x0c80('0xa4')]({'where':{'id':_0x4df866[_0x0c80('0x67')]['id']}})['then'](handleEntityNotFound(_0x57172b,null))['then'](function(_0x4ba595){if(_0x4ba595){_0x7d2487=_0x4ba595;_0x46c3cc[_0x0c80('0x4b')]=_[_0x0c80('0x4f')](db[_0x0c80('0xd8')]['rawAttributes']);_0x46c3cc[_0x0c80('0x50')]=_['keys'](_0x4df866[_0x0c80('0x50')]);_0x46c3cc['filters']=_[_0x0c80('0x52')](_0x46c3cc[_0x0c80('0x4b')],_0x46c3cc[_0x0c80('0x50')]);_0x3bea4c[_0x0c80('0x53')]=_[_0x0c80('0x52')](_0x46c3cc['model'],qs[_0x0c80('0x54')](_0x4df866['query'][_0x0c80('0x54')]));_0x3bea4c[_0x0c80('0x53')]=_0x3bea4c[_0x0c80('0x53')][_0x0c80('0x55')]?_0x3bea4c['attributes']:_0x46c3cc[_0x0c80('0x4b')];_0x3bea4c[_0x0c80('0x58')]=qs['sort'](_0x4df866[_0x0c80('0x50')][_0x0c80('0x59')]);_0x3bea4c['where']=qs[_0x0c80('0x51')](_['pick'](_0x4df866['query'],_0x46c3cc[_0x0c80('0x51')]));if(_0x4df866['query'][_0x0c80('0x5c')]){_0x3bea4c[_0x0c80('0x5a')]=_[_0x0c80('0x5d')](_0x3bea4c[_0x0c80('0x5a')],{'$or':_['map'](_0x3bea4c[_0x0c80('0x53')],function(_0xeb44ce){var _0xce4bd6={};_0xce4bd6[_0xeb44ce]={'$like':'%'+_0x4df866[_0x0c80('0x50')]['filter']+'%'};return _0xce4bd6;})});}_0x3bea4c=_[_0x0c80('0x5d')]({},_0x3bea4c,_0x4df866[_0x0c80('0x62')]);return _0x7d2487['getGroups'](_0x3bea4c);}})[_0x0c80('0x22')](function(_0xc69780){if(_0xc69780){_0x4c36cb=_0xc69780[_0x0c80('0x55')];if(!_0x4df866['query'][_0x0c80('0x56')]('nolimit')){_0x3bea4c[_0x0c80('0x57')]=qs[_0x0c80('0x57')](_0x4df866[_0x0c80('0x50')]['limit']);_0x3bea4c['offset']=qs[_0x0c80('0x2e')](_0x4df866[_0x0c80('0x50')][_0x0c80('0x2e')]);}return _0x7d2487[_0x0c80('0xd7')](_0x3bea4c);}})[_0x0c80('0x22')](function(_0x12759b){if(_0x12759b){return _0x12759b?{'count':_0x4c36cb,'rows':_0x12759b}:null;}})[_0x0c80('0x22')](respondWithResult(_0x57172b,null))[_0x0c80('0x66')](handleError(_0x57172b,null));};exports[_0x0c80('0xd9')]=function(_0x480fe6,_0x6ff273,_0x23721f){var _0x3e8422={'raw':!![],'where':{}};var _0x60fcd4={};var _0x31b093={'count':0x0,'rows':[]};return db[_0x0c80('0x47')][_0x0c80('0xa4')]({'where':{'id':_0x480fe6[_0x0c80('0x67')]['id']}})['then'](handleEntityNotFound(_0x6ff273,null))[_0x0c80('0x22')](function(_0xb49d65){if(_0xb49d65){_0x60fcd4['model']=_[_0x0c80('0x4f')](db[_0x0c80('0xda')][_0x0c80('0x48')]);_0x60fcd4[_0x0c80('0x50')]=_[_0x0c80('0x4f')](_0x480fe6[_0x0c80('0x50')]);_0x60fcd4['filters']=_['intersection'](_0x60fcd4['model'],_0x60fcd4[_0x0c80('0x50')]);_0x3e8422[_0x0c80('0x53')]=_[_0x0c80('0x52')](_0x60fcd4[_0x0c80('0x4b')],qs[_0x0c80('0x54')](_0x480fe6[_0x0c80('0x50')][_0x0c80('0x54')]));_0x3e8422[_0x0c80('0x53')]=_0x3e8422['attributes'][_0x0c80('0x55')]?_0x3e8422[_0x0c80('0x53')]:_0x60fcd4[_0x0c80('0x4b')];if(!_0x480fe6[_0x0c80('0x50')][_0x0c80('0x56')](_0x0c80('0xd3'))){_0x3e8422[_0x0c80('0x57')]=qs[_0x0c80('0x57')](_0x480fe6[_0x0c80('0x50')][_0x0c80('0x57')]);_0x3e8422[_0x0c80('0x2e')]=qs['offset'](_0x480fe6[_0x0c80('0x50')][_0x0c80('0x2e')]);}_0x3e8422['order']=qs[_0x0c80('0x59')](_0x480fe6[_0x0c80('0x50')][_0x0c80('0x59')]);_0x3e8422[_0x0c80('0x5a')]=qs['filters'](_[_0x0c80('0x5b')](_0x480fe6['query'],_0x60fcd4['filters']));_0x3e8422[_0x0c80('0x5a')][_0x0c80('0xdb')]=_0xb49d65['id'];if(_0x480fe6[_0x0c80('0x50')][_0x0c80('0x5c')]){_0x3e8422['where']=_[_0x0c80('0x5d')](_0x3e8422[_0x0c80('0x5a')],{'$or':_[_0x0c80('0x4c')](_0x3e8422[_0x0c80('0x53')],function(_0xef039e){var _0x6fd751={};_0x6fd751[_0xef039e]={'$like':'%'+_0x480fe6[_0x0c80('0x50')][_0x0c80('0x5c')]+'%'};return _0x6fd751;})});}_0x3e8422=_[_0x0c80('0x5d')]({},_0x3e8422,_0x480fe6[_0x0c80('0x62')]);return db[_0x0c80('0xda')]['count']({'where':_0x3e8422[_0x0c80('0x5a')]})[_0x0c80('0x22')](function(_0x396fd5){_0x31b093[_0x0c80('0x63')]=_0x396fd5;if(_0x480fe6[_0x0c80('0x50')]['includeAll']){_0x3e8422[_0x0c80('0x69')]=[{'all':!![]}];}return db[_0x0c80('0xda')][_0x0c80('0xba')](_0x3e8422);})[_0x0c80('0x22')](function(_0x53dfb7){_0x31b093[_0x0c80('0x65')]=_0x53dfb7;return _0x31b093;});}})['then'](respondWithFilteredResult(_0x6ff273,_0x3e8422))[_0x0c80('0x66')](handleError(_0x6ff273,null));};exports[_0x0c80('0xdc')]=function(_0xfefd1a,_0x397369,_0x25f493){var _0x4c15a2={'raw':!![],'where':{}};var _0x42e3ef={};var _0x15ba65={'count':0x0,'rows':[]};return db[_0x0c80('0x47')][_0x0c80('0xa4')]({'where':{'id':_0xfefd1a['params']['id']}})[_0x0c80('0x22')](handleEntityNotFound(_0x397369,null))['then'](function(_0x183ad4){if(_0x183ad4){_0x42e3ef[_0x0c80('0x4b')]=_[_0x0c80('0x4f')](db['ScreenRecording']['rawAttributes']);_0x42e3ef[_0x0c80('0x50')]=_[_0x0c80('0x4f')](_0xfefd1a[_0x0c80('0x50')]);_0x42e3ef['filters']=_[_0x0c80('0x52')](_0x42e3ef[_0x0c80('0x4b')],_0x42e3ef['query']);_0x4c15a2['attributes']=_['intersection'](_0x42e3ef[_0x0c80('0x4b')],qs[_0x0c80('0x54')](_0xfefd1a[_0x0c80('0x50')][_0x0c80('0x54')]));_0x4c15a2[_0x0c80('0x53')]=_0x4c15a2['attributes'][_0x0c80('0x55')]?_0x4c15a2['attributes']:_0x42e3ef['model'];if(!_0xfefd1a['query'][_0x0c80('0x56')](_0x0c80('0xd3'))){_0x4c15a2[_0x0c80('0x57')]=qs[_0x0c80('0x57')](_0xfefd1a[_0x0c80('0x50')]['limit']);_0x4c15a2[_0x0c80('0x2e')]=qs[_0x0c80('0x2e')](_0xfefd1a['query'][_0x0c80('0x2e')]);}_0x4c15a2[_0x0c80('0x58')]=qs[_0x0c80('0x59')](_0xfefd1a[_0x0c80('0x50')][_0x0c80('0x59')]);_0x4c15a2[_0x0c80('0x5a')]=qs[_0x0c80('0x51')](_['pick'](_0xfefd1a['query'],_0x42e3ef[_0x0c80('0x51')]));_0x4c15a2[_0x0c80('0x5a')][_0x0c80('0xdb')]=_0x183ad4['id'];if(_0xfefd1a[_0x0c80('0x50')][_0x0c80('0x5c')]){_0x4c15a2[_0x0c80('0x5a')]=_[_0x0c80('0x5d')](_0x4c15a2[_0x0c80('0x5a')],{'$or':_[_0x0c80('0x4c')](_0x4c15a2[_0x0c80('0x53')],function(_0x4ccf40){var _0x296091={};_0x296091[_0x4ccf40]={'$like':'%'+_0xfefd1a[_0x0c80('0x50')][_0x0c80('0x5c')]+'%'};return _0x296091;})});}_0x4c15a2=_[_0x0c80('0x5d')]({},_0x4c15a2,_0xfefd1a[_0x0c80('0x62')]);return db[_0x0c80('0xdd')][_0x0c80('0x63')]({'where':_0x4c15a2[_0x0c80('0x5a')]})[_0x0c80('0x22')](function(_0x3c47f3){_0x15ba65[_0x0c80('0x63')]=_0x3c47f3;if(_0xfefd1a[_0x0c80('0x50')][_0x0c80('0x64')]){_0x4c15a2[_0x0c80('0x69')]=[{'all':!![]}];}return db[_0x0c80('0xdd')]['findAll'](_0x4c15a2);})[_0x0c80('0x22')](function(_0x642c31){_0x15ba65['rows']=_0x642c31;return _0x15ba65;});}})[_0x0c80('0x22')](respondWithFilteredResult(_0x397369,_0x4c15a2))[_0x0c80('0x66')](handleError(_0x397369,null));};exports['getChatInteractions']=function(_0x53e33b,_0x12788e,_0x57f248){var _0x3480e4={};var _0x57e2e1={};var _0x33a139;var _0x4ce667;return db[_0x0c80('0x47')][_0x0c80('0xa4')]({'where':{'id':_0x53e33b[_0x0c80('0x67')]['id']}})[_0x0c80('0x22')](handleEntityNotFound(_0x12788e,null))['then'](function(_0x3fdddf){if(_0x3fdddf){_0x33a139=_0x3fdddf;_0x57e2e1[_0x0c80('0x4b')]=_[_0x0c80('0x4f')](db[_0x0c80('0xde')][_0x0c80('0x48')]);_0x57e2e1['query']=_[_0x0c80('0x4f')](_0x53e33b['query']);_0x57e2e1[_0x0c80('0x51')]=_[_0x0c80('0x52')](_0x57e2e1[_0x0c80('0x4b')],_0x57e2e1['query']);_0x3480e4['attributes']=_[_0x0c80('0x52')](_0x57e2e1[_0x0c80('0x4b')],qs[_0x0c80('0x54')](_0x53e33b[_0x0c80('0x50')][_0x0c80('0x54')]));_0x3480e4[_0x0c80('0x53')]=_0x3480e4[_0x0c80('0x53')][_0x0c80('0x55')]?_0x3480e4[_0x0c80('0x53')]:_0x57e2e1[_0x0c80('0x4b')];_0x3480e4[_0x0c80('0x58')]=qs[_0x0c80('0x59')](_0x53e33b[_0x0c80('0x50')]['sort']);_0x3480e4['where']=qs[_0x0c80('0x51')](_[_0x0c80('0x5b')](_0x53e33b[_0x0c80('0x50')],_0x57e2e1[_0x0c80('0x51')]));if(_0x53e33b[_0x0c80('0x50')][_0x0c80('0x5c')]){_0x3480e4[_0x0c80('0x5a')]=_['merge'](_0x3480e4[_0x0c80('0x5a')],{'$or':_[_0x0c80('0x4c')](_0x3480e4[_0x0c80('0x53')],function(_0x2da245){var _0x9567e5={};_0x9567e5[_0x2da245]={'$like':'%'+_0x53e33b['query'][_0x0c80('0x5c')]+'%'};return _0x9567e5;})});}_0x3480e4=_[_0x0c80('0x5d')]({},_0x3480e4,_0x53e33b[_0x0c80('0x62')]);return _0x33a139[_0x0c80('0xdf')](_0x3480e4);}})[_0x0c80('0x22')](function(_0x3bb4cc){if(_0x3bb4cc){_0x4ce667=_0x3bb4cc['length'];if(!_0x53e33b['query'][_0x0c80('0x56')](_0x0c80('0xd3'))){_0x3480e4[_0x0c80('0x57')]=qs[_0x0c80('0x57')](_0x53e33b[_0x0c80('0x50')]['limit']);_0x3480e4[_0x0c80('0x2e')]=qs[_0x0c80('0x2e')](_0x53e33b[_0x0c80('0x50')][_0x0c80('0x2e')]);}return _0x33a139[_0x0c80('0xdf')](_0x3480e4);}})[_0x0c80('0x22')](function(_0x19e075){if(_0x19e075){return _0x19e075?{'count':_0x4ce667,'rows':_0x19e075}:null;}})[_0x0c80('0x22')](respondWithResult(_0x12788e,null))[_0x0c80('0x66')](handleError(_0x12788e,null));};exports[_0x0c80('0xe0')]=function(_0x547c9a,_0x22b443,_0x146826){var _0x386c8b={};var _0x5771c7={};var _0x59510f;var _0x49e4c1;return db[_0x0c80('0x47')][_0x0c80('0xa4')]({'where':{'id':_0x547c9a['params']['id']}})[_0x0c80('0x22')](handleEntityNotFound(_0x22b443,null))['then'](function(_0x4f2539){if(_0x4f2539){_0x59510f=_0x4f2539;_0x5771c7[_0x0c80('0x4b')]=_[_0x0c80('0x4f')](db[_0x0c80('0xe1')][_0x0c80('0x48')]);_0x5771c7[_0x0c80('0x50')]=_[_0x0c80('0x4f')](_0x547c9a[_0x0c80('0x50')]);_0x5771c7[_0x0c80('0x51')]=_[_0x0c80('0x52')](_0x5771c7[_0x0c80('0x4b')],_0x5771c7[_0x0c80('0x50')]);_0x386c8b['attributes']=_['intersection'](_0x5771c7[_0x0c80('0x4b')],qs[_0x0c80('0x54')](_0x547c9a[_0x0c80('0x50')][_0x0c80('0x54')]));_0x386c8b['attributes']=_0x386c8b['attributes'][_0x0c80('0x55')]?_0x386c8b['attributes']:_0x5771c7['model'];_0x386c8b[_0x0c80('0x58')]=qs[_0x0c80('0x59')](_0x547c9a[_0x0c80('0x50')][_0x0c80('0x59')]);_0x386c8b['where']=qs[_0x0c80('0x51')](_[_0x0c80('0x5b')](_0x547c9a[_0x0c80('0x50')],_0x5771c7[_0x0c80('0x51')]));if(_0x547c9a['query'][_0x0c80('0x5c')]){_0x386c8b['where']=_['merge'](_0x386c8b[_0x0c80('0x5a')],{'$or':_[_0x0c80('0x4c')](_0x386c8b[_0x0c80('0x53')],function(_0x5c587e){var _0x3c92a9={};_0x3c92a9[_0x5c587e]={'$like':'%'+_0x547c9a[_0x0c80('0x50')][_0x0c80('0x5c')]+'%'};return _0x3c92a9;})});}_0x386c8b=_[_0x0c80('0x5d')]({},_0x386c8b,_0x547c9a[_0x0c80('0x62')]);return _0x59510f[_0x0c80('0xe0')](_0x386c8b);}})[_0x0c80('0x22')](function(_0x308786){if(_0x308786){_0x49e4c1=_0x308786[_0x0c80('0x55')];if(!_0x547c9a[_0x0c80('0x50')][_0x0c80('0x56')]('nolimit')){_0x386c8b[_0x0c80('0x57')]=qs[_0x0c80('0x57')](_0x547c9a[_0x0c80('0x50')]['limit']);_0x386c8b[_0x0c80('0x2e')]=qs[_0x0c80('0x2e')](_0x547c9a['query']['offset']);}return _0x59510f['getOpenchannelInteractions'](_0x386c8b);}})[_0x0c80('0x22')](function(_0x16a5e1){if(_0x16a5e1){return _0x16a5e1?{'count':_0x49e4c1,'rows':_0x16a5e1}:null;}})[_0x0c80('0x22')](respondWithResult(_0x22b443,null))[_0x0c80('0x66')](handleError(_0x22b443,null));};exports['getMailInteractions']=function(_0x2b15f7,_0x190ce8,_0x1fd3a4){var _0x52637a={'raw':!![],'where':{}};var _0x298a29={};var _0x16d2f0={'count':0x0,'rows':[]};return db[_0x0c80('0x47')][_0x0c80('0xa4')]({'where':{'id':_0x2b15f7['params']['id']}})['then'](handleEntityNotFound(_0x190ce8,null))[_0x0c80('0x22')](function(_0x5cb317){if(_0x5cb317){_0x298a29[_0x0c80('0x4b')]=_[_0x0c80('0x4f')](db[_0x0c80('0xe2')][_0x0c80('0x48')]);_0x298a29[_0x0c80('0x50')]=_[_0x0c80('0x4f')](_0x2b15f7['query']);_0x298a29['filters']=_[_0x0c80('0x52')](_0x298a29[_0x0c80('0x4b')],_0x298a29['query']);_0x52637a[_0x0c80('0x53')]=_['intersection'](_0x298a29['model'],qs[_0x0c80('0x54')](_0x2b15f7[_0x0c80('0x50')][_0x0c80('0x54')]));_0x52637a[_0x0c80('0x53')]=_0x52637a['attributes'][_0x0c80('0x55')]?_0x52637a[_0x0c80('0x53')]:_0x298a29[_0x0c80('0x4b')];if(!_0x2b15f7[_0x0c80('0x50')][_0x0c80('0x56')](_0x0c80('0xd3'))){_0x52637a[_0x0c80('0x57')]=qs['limit'](_0x2b15f7[_0x0c80('0x50')]['limit']);_0x52637a[_0x0c80('0x2e')]=qs['offset'](_0x2b15f7[_0x0c80('0x50')][_0x0c80('0x2e')]);}_0x52637a[_0x0c80('0x58')]=qs[_0x0c80('0x59')](_0x2b15f7[_0x0c80('0x50')][_0x0c80('0x59')]);_0x52637a[_0x0c80('0x5a')]=qs[_0x0c80('0x51')](_['pick'](_0x2b15f7[_0x0c80('0x50')],_0x298a29[_0x0c80('0x51')]));_0x52637a['where'][_0x0c80('0xdb')]=_0x5cb317['id'];if(_0x2b15f7[_0x0c80('0x50')][_0x0c80('0x5c')]){_0x52637a[_0x0c80('0x5a')]=_['merge'](_0x52637a[_0x0c80('0x5a')],{'$or':_[_0x0c80('0x4c')](_0x52637a[_0x0c80('0x53')],function(_0x3227c8){var _0x55fd4c={};_0x55fd4c[_0x3227c8]={'$like':'%'+_0x2b15f7['query']['filter']+'%'};return _0x55fd4c;})});}_0x52637a=_[_0x0c80('0x5d')]({},_0x52637a,_0x2b15f7[_0x0c80('0x62')]);return db['MailInteraction']['count']({'where':_0x52637a['where']})['then'](function(_0x14796e){_0x16d2f0[_0x0c80('0x63')]=_0x14796e;if(_0x2b15f7[_0x0c80('0x50')][_0x0c80('0x64')]){_0x52637a[_0x0c80('0x69')]=[{'all':!![]}];}return db['MailInteraction'][_0x0c80('0xba')](_0x52637a);})[_0x0c80('0x22')](function(_0x433d01){_0x16d2f0[_0x0c80('0x65')]=_0x433d01;return _0x16d2f0;});}})['then'](respondWithFilteredResult(_0x190ce8,_0x52637a))['catch'](handleError(_0x190ce8,null));};exports[_0x0c80('0xe3')]=function(_0x1b8c67,_0x23e945,_0xe449e6){var _0x544d4c={};var _0x40b1fb={};var _0x2291ac;var _0x3a9758;return db[_0x0c80('0x47')][_0x0c80('0xa4')]({'where':{'id':_0x1b8c67['params']['id']}})[_0x0c80('0x22')](handleEntityNotFound(_0x23e945,null))[_0x0c80('0x22')](function(_0x3d6a23){if(_0x3d6a23){_0x2291ac=_0x3d6a23;_0x40b1fb[_0x0c80('0x4b')]=_[_0x0c80('0x4f')](db[_0x0c80('0xe4')]['rawAttributes']);_0x40b1fb[_0x0c80('0x50')]=_['keys'](_0x1b8c67[_0x0c80('0x50')]);_0x40b1fb[_0x0c80('0x51')]=_[_0x0c80('0x52')](_0x40b1fb[_0x0c80('0x4b')],_0x40b1fb[_0x0c80('0x50')]);_0x544d4c[_0x0c80('0x53')]=_[_0x0c80('0x52')](_0x40b1fb['model'],qs[_0x0c80('0x54')](_0x1b8c67[_0x0c80('0x50')]['fields']));_0x544d4c['attributes']=_0x544d4c[_0x0c80('0x53')][_0x0c80('0x55')]?_0x544d4c[_0x0c80('0x53')]:_0x40b1fb['model'];_0x544d4c['order']=qs['sort'](_0x1b8c67[_0x0c80('0x50')]['sort']);_0x544d4c['where']=qs[_0x0c80('0x51')](_[_0x0c80('0x5b')](_0x1b8c67[_0x0c80('0x50')],_0x40b1fb[_0x0c80('0x51')]));if(_0x1b8c67[_0x0c80('0x50')]['filter']){_0x544d4c[_0x0c80('0x5a')]=_[_0x0c80('0x5d')](_0x544d4c['where'],{'$or':_[_0x0c80('0x4c')](_0x544d4c[_0x0c80('0x53')],function(_0x2f8910){var _0x4fe3d2={};_0x4fe3d2[_0x2f8910]={'$like':'%'+_0x1b8c67['query']['filter']+'%'};return _0x4fe3d2;})});}_0x544d4c=_[_0x0c80('0x5d')]({},_0x544d4c,_0x1b8c67['options']);return _0x2291ac[_0x0c80('0xe3')](_0x544d4c);}})[_0x0c80('0x22')](function(_0x5d4ce5){if(_0x5d4ce5){_0x3a9758=_0x5d4ce5[_0x0c80('0x55')];if(!_0x1b8c67[_0x0c80('0x50')][_0x0c80('0x56')](_0x0c80('0xd3'))){_0x544d4c[_0x0c80('0x57')]=qs[_0x0c80('0x57')](_0x1b8c67[_0x0c80('0x50')][_0x0c80('0x57')]);_0x544d4c['offset']=qs[_0x0c80('0x2e')](_0x1b8c67[_0x0c80('0x50')]['offset']);}return _0x2291ac['getSmsInteractions'](_0x544d4c);}})[_0x0c80('0x22')](function(_0x180e4c){if(_0x180e4c){return _0x180e4c?{'count':_0x3a9758,'rows':_0x180e4c}:null;}})[_0x0c80('0x22')](respondWithResult(_0x23e945,null))[_0x0c80('0x66')](handleError(_0x23e945,null));};exports['getFaxInteractions']=function(_0x321991,_0xee374a,_0x3d9919){var _0x5cdf13={};var _0x1b793d={};var _0x1fff0a;var _0x10710;return db[_0x0c80('0x47')][_0x0c80('0xa4')]({'where':{'id':_0x321991['params']['id']}})[_0x0c80('0x22')](handleEntityNotFound(_0xee374a,null))['then'](function(_0x2de009){if(_0x2de009){_0x1fff0a=_0x2de009;_0x1b793d[_0x0c80('0x4b')]=_[_0x0c80('0x4f')](db[_0x0c80('0xe5')][_0x0c80('0x48')]);_0x1b793d[_0x0c80('0x50')]=_[_0x0c80('0x4f')](_0x321991[_0x0c80('0x50')]);_0x1b793d[_0x0c80('0x51')]=_[_0x0c80('0x52')](_0x1b793d['model'],_0x1b793d[_0x0c80('0x50')]);_0x5cdf13[_0x0c80('0x53')]=_[_0x0c80('0x52')](_0x1b793d['model'],qs[_0x0c80('0x54')](_0x321991[_0x0c80('0x50')][_0x0c80('0x54')]));_0x5cdf13[_0x0c80('0x53')]=_0x5cdf13[_0x0c80('0x53')][_0x0c80('0x55')]?_0x5cdf13['attributes']:_0x1b793d[_0x0c80('0x4b')];_0x5cdf13[_0x0c80('0x58')]=qs['sort'](_0x321991[_0x0c80('0x50')][_0x0c80('0x59')]);_0x5cdf13[_0x0c80('0x5a')]=qs[_0x0c80('0x51')](_['pick'](_0x321991[_0x0c80('0x50')],_0x1b793d['filters']));if(_0x321991[_0x0c80('0x50')][_0x0c80('0x5c')]){_0x5cdf13[_0x0c80('0x5a')]=_[_0x0c80('0x5d')](_0x5cdf13[_0x0c80('0x5a')],{'$or':_[_0x0c80('0x4c')](_0x5cdf13[_0x0c80('0x53')],function(_0xc7314d){var _0x7022ef={};_0x7022ef[_0xc7314d]={'$like':'%'+_0x321991[_0x0c80('0x50')][_0x0c80('0x5c')]+'%'};return _0x7022ef;})});}_0x5cdf13=_[_0x0c80('0x5d')]({},_0x5cdf13,_0x321991[_0x0c80('0x62')]);return _0x1fff0a[_0x0c80('0xe6')](_0x5cdf13);}})[_0x0c80('0x22')](function(_0x85007d){if(_0x85007d){_0x10710=_0x85007d[_0x0c80('0x55')];if(!_0x321991[_0x0c80('0x50')]['hasOwnProperty'](_0x0c80('0xd3'))){_0x5cdf13[_0x0c80('0x57')]=qs[_0x0c80('0x57')](_0x321991[_0x0c80('0x50')]['limit']);_0x5cdf13[_0x0c80('0x2e')]=qs['offset'](_0x321991['query'][_0x0c80('0x2e')]);}return _0x1fff0a[_0x0c80('0xe6')](_0x5cdf13);}})[_0x0c80('0x22')](function(_0x51e358){if(_0x51e358){return _0x51e358?{'count':_0x10710,'rows':_0x51e358}:null;}})[_0x0c80('0x22')](respondWithResult(_0xee374a,null))[_0x0c80('0x66')](handleError(_0xee374a,null));};exports['getWhatsappInteractions']=function(_0x455b0e,_0x43f3a7,_0x4ae153){var _0x54dee4={};var _0x2deb7e={};var _0x38c0d0;var _0x5d3a68;return db[_0x0c80('0x47')][_0x0c80('0xa4')]({'where':{'id':_0x455b0e[_0x0c80('0x67')]['id']}})[_0x0c80('0x22')](handleEntityNotFound(_0x43f3a7,null))[_0x0c80('0x22')](function(_0x46962c){if(_0x46962c){_0x38c0d0=_0x46962c;_0x2deb7e[_0x0c80('0x4b')]=_[_0x0c80('0x4f')](db[_0x0c80('0xe7')]['rawAttributes']);_0x2deb7e[_0x0c80('0x50')]=_[_0x0c80('0x4f')](_0x455b0e['query']);_0x2deb7e[_0x0c80('0x51')]=_[_0x0c80('0x52')](_0x2deb7e[_0x0c80('0x4b')],_0x2deb7e[_0x0c80('0x50')]);_0x54dee4[_0x0c80('0x53')]=_[_0x0c80('0x52')](_0x2deb7e[_0x0c80('0x4b')],qs[_0x0c80('0x54')](_0x455b0e[_0x0c80('0x50')]['fields']));_0x54dee4['attributes']=_0x54dee4[_0x0c80('0x53')][_0x0c80('0x55')]?_0x54dee4[_0x0c80('0x53')]:_0x2deb7e[_0x0c80('0x4b')];_0x54dee4[_0x0c80('0x58')]=qs[_0x0c80('0x59')](_0x455b0e[_0x0c80('0x50')][_0x0c80('0x59')]);_0x54dee4[_0x0c80('0x5a')]=qs[_0x0c80('0x51')](_[_0x0c80('0x5b')](_0x455b0e['query'],_0x2deb7e[_0x0c80('0x51')]));if(_0x455b0e[_0x0c80('0x50')][_0x0c80('0x5c')]){_0x54dee4[_0x0c80('0x5a')]=_[_0x0c80('0x5d')](_0x54dee4[_0x0c80('0x5a')],{'$or':_[_0x0c80('0x4c')](_0x54dee4[_0x0c80('0x53')],function(_0x487d94){var _0x5441f3={};_0x5441f3[_0x487d94]={'$like':'%'+_0x455b0e['query'][_0x0c80('0x5c')]+'%'};return _0x5441f3;})});}_0x54dee4=_[_0x0c80('0x5d')]({},_0x54dee4,_0x455b0e[_0x0c80('0x62')]);return _0x38c0d0[_0x0c80('0xe8')](_0x54dee4);}})[_0x0c80('0x22')](function(_0x1b33c6){if(_0x1b33c6){_0x5d3a68=_0x1b33c6['length'];if(!_0x455b0e[_0x0c80('0x50')]['hasOwnProperty'](_0x0c80('0xd3'))){_0x54dee4[_0x0c80('0x57')]=qs[_0x0c80('0x57')](_0x455b0e[_0x0c80('0x50')]['limit']);_0x54dee4[_0x0c80('0x2e')]=qs[_0x0c80('0x2e')](_0x455b0e[_0x0c80('0x50')][_0x0c80('0x2e')]);}return _0x38c0d0['getWhatsappInteractions'](_0x54dee4);}})[_0x0c80('0x22')](function(_0x274f68){if(_0x274f68){return _0x274f68?{'count':_0x5d3a68,'rows':_0x274f68}:null;}})[_0x0c80('0x22')](respondWithResult(_0x43f3a7,null))[_0x0c80('0x66')](handleError(_0x43f3a7,null));};exports[_0x0c80('0xe9')]=function(_0x23ce1c,_0x443b08,_0x52aad9){var _0x3d7c30;var _0x232a49;var _0x284b6c;var _0x4fed82=!_[_0x0c80('0x74')](_0x23ce1c[_0x0c80('0x67')]['id'])?_0x23ce1c['params']['id']:!_[_0x0c80('0x74')](_0x23ce1c['user']['id'])?_0x23ce1c[_0x0c80('0x37')]['id']:null;return db['User'][_0x0c80('0x3f')]({'where':{'id':_0x4fed82,'role':{'$or':[_0x0c80('0x8b'),_0x0c80('0x37'),_0x0c80('0x38')]}},'attributes':['id',_0x0c80('0x40'),'phone',_0x0c80('0xea'),_0x0c80('0x3e'),'internal',_0x0c80('0xab')]})[_0x0c80('0x22')](function(_0x2c8334){if(_0x2c8334){if(_0x2c8334[_0x0c80('0x3e')]===_0x0c80('0x38')){_0x3d7c30=_0x2c8334;if(_0x23ce1c[_0x0c80('0x6b')]['interface']){_0x284b6c=util[_0x0c80('0xbb')](_0x0c80('0xeb'),_0x3d7c30[_0x23ce1c[_0x0c80('0x6b')][_0x0c80('0xad')]]);}else if(_0x23ce1c[_0x0c80('0x6b')][_0x0c80('0xec')]){_0x284b6c=util['format'](_0x0c80('0xbc'),_0x23ce1c[_0x0c80('0x6b')][_0x0c80('0xec')]);}else{_0x284b6c=util[_0x0c80('0xbb')](_0x0c80('0xbc'),_0x3d7c30[_0x0c80('0x40')]);}socket['to'](util[_0x0c80('0xbb')](_0x0c80('0xed'),_0x3d7c30[_0x0c80('0x40')]))[_0x0c80('0xb7')](_0x0c80('0xee'),{'user':{'id':_0x3d7c30['id'],'name':_0x3d7c30[_0x0c80('0x40')]},'ip':_0x23ce1c['headers'][_0x0c80('0xef')]||_0x23ce1c[_0x0c80('0xf0')][_0x0c80('0xf1')]||_0x23ce1c['socket'][_0x0c80('0xf1')]||_0x23ce1c['connection'][_0x0c80('0xf2')][_0x0c80('0xf1')]});return db[_0x0c80('0xbd')][_0x0c80('0x34')]({'where':{'membername':_0x3d7c30[_0x0c80('0x40')]},'individualHooks':!![]});}}else{throw new db[(_0x0c80('0x9d'))][(_0x0c80('0xa0'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})['then'](function(){if(_0x3d7c30){return _0x3d7c30['getVoiceQueues']({'raw':!![]});}})[_0x0c80('0x22')](function(_0x100f1e){if(_0x3d7c30){var _0x5b700b=[];if(_0x100f1e){_0x232a49=_0x100f1e;if(_0x232a49[_0x0c80('0x55')]){for(var _0xa45e24=0x0;_0xa45e24<_0x232a49[_0x0c80('0x55')];_0xa45e24++){_0x5b700b['push']({'membername':_0x3d7c30[_0x0c80('0x40')],'UserId':_0x3d7c30['id'],'queue_name':_0x232a49[_0xa45e24][_0x0c80('0x40')],'VoiceQueueId':_0x232a49[_0xa45e24]['id'],'interface':_0x284b6c,'paused':_0x3d7c30[_0x0c80('0xab')]||![],'penalty':_0x232a49[_0xa45e24][_0x0c80('0xf3')]||0x0});}return BPromise[_0x0c80('0xf4')](_0x5b700b,function(_0x39e631){return db[_0x0c80('0xbd')][_0x0c80('0xbe')](_0x39e631);});}}}})['then'](function(){if(_0x3d7c30){return db[_0x0c80('0xf5')][_0x0c80('0xba')]({'where':{'membername':_0x3d7c30[_0x0c80('0x40')],'exitAt':null}});}})['then'](function(_0x4fb053){if(_0x3d7c30){var _0x304b38=[];_0x4fb053['forEach'](function(_0x2c0254){_0x304b38[_0x0c80('0x97')](_0x2c0254[_0x0c80('0x6a')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x304b38);}})[_0x0c80('0x22')](function(){if(_0x3d7c30){var _0x30c0c3=[];var _0x43c511=[];var _0x4bded2=utils[_0x0c80('0xf6')]();var _0x3c90de={'membername':_0x3d7c30['name'],'interface':_0x284b6c,'enterAt':moment()[_0x0c80('0xbb')](_0x0c80('0xf7')),'role':_0x3d7c30[_0x0c80('0x3e')],'internal':_0x3d7c30[_0x0c80('0x73')]};_0x4bded2[_0x0c80('0xf8')](function(_0x44ebaf){_0x30c0c3['push'](_[_0x0c80('0x5d')]({'channel':_0x44ebaf,'type':_0x0c80('0xf9'),'data1':_0x23ce1c['body'][_0x0c80('0xfa')],'data2':_0x284b6c},_0x3c90de));if(_0x3d7c30[_0x0c80('0xab')]){_0x43c511[_0x0c80('0x97')](_[_0x0c80('0x5d')]({'channel':_0x44ebaf,'type':_0x0c80('0xfb'),'data1':_0x0c80('0xfc')},_0x3c90de));}});return db[_0x0c80('0xf5')][_0x0c80('0x94')](_0x30c0c3[_0x0c80('0xfd')](_0x43c511),{'individualHooks':!![]});}})[_0x0c80('0x22')](function(){if(_0x3d7c30){return _0x3d7c30['update']({'online':!![],'lastLoginAt':moment()[_0x0c80('0xbb')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3d7c30[_0x0c80('0xab')]||![],'mailPause':_0x3d7c30[_0x0c80('0xab')]||![],'chatPause':_0x3d7c30['loginInPause']||![],'faxPause':_0x3d7c30[_0x0c80('0xab')]||![],'smsPause':_0x3d7c30['loginInPause']||![],'openchannelPause':_0x3d7c30[_0x0c80('0xab')]||![],'whatsappPause':_0x3d7c30[_0x0c80('0xab')]||![],'pauseType':_0x3d7c30[_0x0c80('0xab')]?_0x0c80('0xfc'):null,'interface':_0x284b6c,'lastPauseAt':moment()[_0x0c80('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0x2bcde2){if(_0x23ce1c[_0x0c80('0xfe')]){return _0x52aad9();}else{return BPromise['resolve'](_0x2bcde2)[_0x0c80('0x22')](respondWithResult(_0x443b08,null));}})[_0x0c80('0x66')](handleError(_0x443b08,null));};exports['logout']=function(_0x224949,_0x36d2c4,_0x2d6f26){var _0x51363f;return db[_0x0c80('0x47')][_0x0c80('0x3f')]({'where':{'id':_0x224949[_0x0c80('0x67')]['id'],'role':_0x0c80('0x38')},'attributes':['id',_0x0c80('0x40'),_0x0c80('0x3e')]})[_0x0c80('0x22')](handleEntityNotFound(_0x36d2c4,null))[_0x0c80('0x22')](function(_0x142461){if(_0x142461){_0x51363f=_0x142461;return db[_0x0c80('0xbd')]['destroy']({'where':{'membername':_0x51363f['name']},'individualHooks':!![]});}})[_0x0c80('0x22')](function(){return db['MemberReport'][_0x0c80('0xba')]({'where':{'membername':_0x51363f[_0x0c80('0x40')],'exitAt':null}});})[_0x0c80('0x22')](function(_0x22f664){var _0x5484fb=[];_0x22f664[_0x0c80('0xf8')](function(_0x1b0312){_0x5484fb[_0x0c80('0x97')](_0x1b0312['update']({'exitAt':moment()[_0x0c80('0xbb')](_0x0c80('0xf7'))}));});return BPromise[_0x0c80('0x98')](_0x5484fb);})[_0x0c80('0x22')](function(){return _0x51363f[_0x0c80('0x6a')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x0c80('0x22')](respondWithResult(_0x36d2c4,null))[_0x0c80('0x66')](handleError(_0x36d2c4,null));};exports[_0x0c80('0xff')]=function(_0x8c1fbc,_0x1ebce8,_0x24c633){var _0x49a086;return db[_0x0c80('0xbd')]['update']({'paused':0x1},{'where':{'UserId':_0x8c1fbc['params']['id']},'individualHooks':!![]})[_0x0c80('0x22')](function(){return db['User'][_0x0c80('0x3f')]({'where':{'id':_0x8c1fbc['params']['id'],'role':_0x0c80('0x38')},'attributes':['id',_0x0c80('0x40'),_0x0c80('0x3e'),_0x0c80('0x73'),_0x0c80('0xad')]});})[_0x0c80('0x22')](handleEntityNotFound(_0x1ebce8,null))[_0x0c80('0x22')](function(_0xcd18fe){if(_0xcd18fe){_0x49a086=_0xcd18fe;return respondWithRpcPromise(_0x0c80('0x100'),_0x0c80('0xff'),{'id':_0x49a086['id'],'name':_0x49a086[_0x0c80('0x40')],'pause':!![]});}})[_0x0c80('0x22')](function(){if(_0x49a086){return db[_0x0c80('0xf5')][_0x0c80('0xba')]({'where':{'membername':_0x49a086[_0x0c80('0x40')],'type':_0x0c80('0xfb'),'exitAt':null}});}})[_0x0c80('0x22')](function(_0x29dc9a){if(_0x29dc9a[_0x0c80('0x55')]){var _0x3fad3f=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x702b59=0x0,_0x416158=_0x29dc9a[_0x0c80('0x55')];_0x702b59<_0x416158;_0x702b59++){_0x29dc9a[_0x702b59][_0x0c80('0x101')]({'exitAt':_0x3fad3f});}}})[_0x0c80('0x22')](function(){var _0x2a4357=[];var _0x486ebc=utils['getChannels']();_0x486ebc['forEach'](function(_0x2d5ced){_0x2a4357['push']({'channel':_0x2d5ced,'membername':_0x49a086['name'],'interface':_['isNil'](_0x49a086['interface'])?util['format']('SIP/%s',_0x49a086[_0x0c80('0x40')]):_0x49a086['interface'],'type':_0x0c80('0xfb'),'enterAt':moment()[_0x0c80('0xbb')](_0x0c80('0xf7')),'data1':_0x8c1fbc[_0x0c80('0x6b')][_0x0c80('0x4a')]||_0x0c80('0x102'),'role':_0x49a086[_0x0c80('0x3e')],'internal':_0x49a086[_0x0c80('0x73')]});});return db[_0x0c80('0xf5')][_0x0c80('0x94')](_0x2a4357,{'individualHooks':!![]});})[_0x0c80('0x22')](function(){return _0x49a086[_0x0c80('0x6a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x8c1fbc['body'][_0x0c80('0x4a')]||_0x0c80('0x102'),'lastPauseAt':moment()[_0x0c80('0xbb')](_0x0c80('0xf7'))});})[_0x0c80('0x22')](respondWithResult(_0x1ebce8,null))[_0x0c80('0x66')](handleError(_0x1ebce8,null));};exports[_0x0c80('0x103')]=function(_0x27bba7,_0x520840,_0x4c4729){var _0x464fa1;return db[_0x0c80('0x47')]['find']({'where':{'id':_0x27bba7[_0x0c80('0x67')]['id']},'attributes':['id','name',_0x0c80('0x3e'),_0x0c80('0xac'),'mailPause',_0x0c80('0x104'),_0x0c80('0x105'),_0x0c80('0x106'),'smsPause','whatsapppause',_0x0c80('0x107'),_0x0c80('0x108')]})[_0x0c80('0x22')](handleEntityNotFound(_0x520840,null))[_0x0c80('0x22')](function(_0x5c2f6a){if(_0x5c2f6a){_0x464fa1=_0x5c2f6a;if(_0x27bba7[_0x0c80('0x6b')][_0x0c80('0xaa')]&&!utils[_0x0c80('0xae')](_0x27bba7[_0x0c80('0x6b')]['channel'])){throw new db[(_0x0c80('0x9d'))][(_0x0c80('0xa0'))](_0x0c80('0xaf'));}switch(_0x27bba7['body'][_0x0c80('0xaa')]){case _0x0c80('0xc2'):return respondWithRpcPromise('QueuePause','unpause',{'id':_0x464fa1['id'],'name':_0x464fa1['name'],'pause':![]})['then'](function(){return db[_0x0c80('0xbd')][_0x0c80('0x6a')]({'paused':0x0},{'where':{'UserId':_0x464fa1['id']},'individualHooks':!![]});})[_0x0c80('0x22')](function(){return db[_0x0c80('0xf5')][_0x0c80('0x3f')]({'where':{'channel':_0x27bba7[_0x0c80('0x6b')][_0x0c80('0xaa')],'membername':_0x464fa1['name'],'type':'PAUSE','exitAt':null}});})['then'](function(_0x74b8b6){if(_0x74b8b6){return _0x74b8b6[_0x0c80('0x6a')]({'exitAt':moment()[_0x0c80('0xbb')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x0c80('0x109')},{'individualHooks':!![]});}return null;})['then'](function(){return _0x464fa1[_0x0c80('0x6a')]({'voicePause':![]});});case _0x0c80('0x10a'):case'chat':case'fax':case _0x0c80('0x10b'):case _0x0c80('0x10c'):case _0x0c80('0x10d'):return db[_0x0c80('0xf5')][_0x0c80('0x3f')]({'where':{'channel':_0x27bba7[_0x0c80('0x6b')][_0x0c80('0xaa')],'membername':_0x464fa1[_0x0c80('0x40')],'type':_0x0c80('0xfb'),'exitAt':null}})[_0x0c80('0x22')](function(_0x22dc09){if(_0x22dc09){return _0x22dc09[_0x0c80('0x6a')]({'exitAt':moment()[_0x0c80('0xbb')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x0c80('0x109')},{'individualHooks':!![]});}return null;})['then'](function(){var _0x33c8ba={};_['set'](_0x33c8ba,util[_0x0c80('0xbb')](_0x0c80('0x10e'),_0x27bba7[_0x0c80('0x6b')][_0x0c80('0xaa')],_0x0c80('0x10f')),![]);return _0x464fa1[_0x0c80('0x6a')](_0x33c8ba);});default:return respondWithRpcPromise(_0x0c80('0x100'),_0x0c80('0x103'),{'id':_0x464fa1['id'],'name':_0x464fa1[_0x0c80('0x40')],'pause':![]})[_0x0c80('0x22')](function(){return db[_0x0c80('0xbd')][_0x0c80('0x6a')]({'paused':0x0},{'where':{'UserId':_0x464fa1['id']}});})['then'](function(){return db['MemberReport'][_0x0c80('0xba')]({'where':{'membername':_0x464fa1['name'],'type':_0x0c80('0xfb'),'exitAt':null}});})[_0x0c80('0x22')](function(_0x17d1e1){var _0x408c11=[];_0x17d1e1['forEach'](function(_0x2116f3){_0x408c11[_0x0c80('0x97')](_0x2116f3[_0x0c80('0x6a')]({'exitAt':moment()[_0x0c80('0xbb')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'manual'}));});return BPromise[_0x0c80('0x98')](_0x408c11);})[_0x0c80('0x22')](function(){return _0x464fa1[_0x0c80('0x6a')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'whatsappPause':![],'openchannelPause':![]});});}}})[_0x0c80('0x22')](respondWithResult(_0x520840,null))[_0x0c80('0x66')](handleError(_0x520840,null));};exports['getTeams']=function(_0x4fd115,_0x29ef71,_0x7ca350){var _0x38bd3a={};var _0xb79991={};var _0x571547;var _0x53fc34;return db[_0x0c80('0x47')][_0x0c80('0xa4')]({'where':{'id':_0x4fd115['params']['id']}})['then'](handleEntityNotFound(_0x29ef71,null))['then'](function(_0x55be8b){if(_0x55be8b){_0x571547=_0x55be8b;_0xb79991[_0x0c80('0x4b')]=_[_0x0c80('0x4f')](db[_0x0c80('0x110')][_0x0c80('0x48')]);_0xb79991['query']=_['keys'](_0x4fd115[_0x0c80('0x50')]);_0xb79991[_0x0c80('0x51')]=_[_0x0c80('0x52')](_0xb79991[_0x0c80('0x4b')],_0xb79991[_0x0c80('0x50')]);_0x38bd3a[_0x0c80('0x53')]=_[_0x0c80('0x52')](_0xb79991['model'],qs['fields'](_0x4fd115[_0x0c80('0x50')][_0x0c80('0x54')]));_0x38bd3a[_0x0c80('0x53')]=_0x38bd3a[_0x0c80('0x53')][_0x0c80('0x55')]?_0x38bd3a[_0x0c80('0x53')]:_0xb79991[_0x0c80('0x4b')];_0x38bd3a[_0x0c80('0x58')]=qs[_0x0c80('0x59')](_0x4fd115[_0x0c80('0x50')]['sort']);_0x38bd3a['where']=qs[_0x0c80('0x51')](_[_0x0c80('0x5b')](_0x4fd115[_0x0c80('0x50')],_0xb79991[_0x0c80('0x51')]));if(_0x4fd115['query'][_0x0c80('0x5c')]){_0x38bd3a[_0x0c80('0x5a')]=_[_0x0c80('0x5d')](_0x38bd3a['where'],{'$or':_[_0x0c80('0x4c')](_0x38bd3a[_0x0c80('0x53')],function(_0x59781c){var _0x379a13={};_0x379a13[_0x59781c]={'$like':'%'+_0x4fd115[_0x0c80('0x50')][_0x0c80('0x5c')]+'%'};return _0x379a13;})});}_0x38bd3a=_[_0x0c80('0x5d')]({},_0x38bd3a,_0x4fd115[_0x0c80('0x62')]);return _0x571547[_0x0c80('0x111')](_0x38bd3a);}})[_0x0c80('0x22')](function(_0x6da94a){if(_0x6da94a){_0x53fc34=_0x6da94a[_0x0c80('0x55')];if(!_0x4fd115['query'][_0x0c80('0x56')](_0x0c80('0xd3'))){_0x38bd3a[_0x0c80('0x57')]=qs[_0x0c80('0x57')](_0x4fd115['query'][_0x0c80('0x57')]);_0x38bd3a[_0x0c80('0x2e')]=qs['offset'](_0x4fd115['query'][_0x0c80('0x2e')]);}return _0x571547['getTeams'](_0x38bd3a);}})['then'](function(_0x3cb8c0){if(_0x3cb8c0){return _0x3cb8c0?{'count':_0x53fc34,'rows':_0x3cb8c0}:null;}})[_0x0c80('0x22')](respondWithResult(_0x29ef71,null))[_0x0c80('0x66')](handleError(_0x29ef71,null));};exports['addTeams']=function(_0x28739a,_0x56461e){return db['User'][_0x0c80('0x3f')]({'where':{'id':_0x28739a[_0x0c80('0x67')]['id']}})[_0x0c80('0x22')](handleEntityNotFound(_0x56461e,null))[_0x0c80('0x22')](function(_0x587e92){if(_0x587e92){var _0x513310=_0x587e92[_0x0c80('0x35')]({'plain':!![]});return _0x587e92[_0x0c80('0x112')](_0x28739a[_0x0c80('0x6b')][_0x0c80('0x6e')],_[_0x0c80('0x6f')](_0x28739a[_0x0c80('0x6b')],['ids','id'])||{})[_0x0c80('0x22')](function(){for(var _0x30f58a=0x0;_0x30f58a<_0x28739a[_0x0c80('0x6b')]['ids']['length'];_0x30f58a++){var _0x2c8043=[];db[_0x0c80('0x110')][_0x0c80('0xa4')]({'where':{'id':_0x28739a[_0x0c80('0x6b')]['ids'][_0x30f58a]}})[_0x0c80('0x22')](function(_0xc0beb6){_0x2c8043[_0x0c80('0x97')](_0xc0beb6[_0x0c80('0x113')]()['then'](function(_0xf858fb){for(var _0x30c504=0x0;_0x30c504<_0xf858fb[_0x0c80('0x55')];_0x30c504++){_0xf858fb[_0x30c504]['setDataValue'](_0x0c80('0xaa'),_0x0c80('0x114'));}return _0xf858fb;}));_0x2c8043[_0x0c80('0x97')](_0xc0beb6[_0x0c80('0x115')]()[_0x0c80('0x22')](function(_0x57af80){for(var _0x3cecf2=0x0;_0x3cecf2<_0x57af80[_0x0c80('0x55')];_0x3cecf2++){_0x57af80[_0x3cecf2]['setDataValue'](_0x0c80('0xaa'),_0x0c80('0x116'));}return _0x57af80;}));_0x2c8043[_0x0c80('0x97')](_0xc0beb6['getMailQueues']()[_0x0c80('0x22')](function(_0x149916){for(var _0x47dbea=0x0;_0x47dbea<_0x149916[_0x0c80('0x55')];_0x47dbea++){_0x149916[_0x47dbea][_0x0c80('0x117')](_0x0c80('0xaa'),_0x0c80('0x118'));}return _0x149916;}));_0x2c8043[_0x0c80('0x97')](_0xc0beb6['getSmsQueues']()['then'](function(_0x5c1251){for(var _0x3370a5=0x0;_0x3370a5<_0x5c1251[_0x0c80('0x55')];_0x3370a5++){_0x5c1251[_0x3370a5][_0x0c80('0x117')]('channel','Sms');}return _0x5c1251;}));_0x2c8043[_0x0c80('0x97')](_0xc0beb6['getWhatsappQueues']()['then'](function(_0x4005ac){for(var _0x24d4db=0x0;_0x24d4db<_0x4005ac[_0x0c80('0x55')];_0x24d4db++){_0x4005ac[_0x24d4db][_0x0c80('0x117')](_0x0c80('0xaa'),_0x0c80('0x119'));}return _0x4005ac;}));_0x2c8043[_0x0c80('0x97')](_0xc0beb6[_0x0c80('0x11a')]()[_0x0c80('0x22')](function(_0x1d8581){for(var _0x27bc32=0x0;_0x27bc32<_0x1d8581['length'];_0x27bc32++){_0x1d8581[_0x27bc32][_0x0c80('0x117')](_0x0c80('0xaa'),_0x0c80('0x11b'));}return _0x1d8581;}));_0x2c8043[_0x0c80('0x97')](_0xc0beb6[_0x0c80('0x11c')]()['then'](function(_0x4de3da){for(var _0xfe5f3e=0x0;_0xfe5f3e<_0x4de3da[_0x0c80('0x55')];_0xfe5f3e++){_0x4de3da[_0xfe5f3e][_0x0c80('0x117')](_0x0c80('0xaa'),_0x0c80('0x11d'));}return _0x4de3da;}));return BPromise[_0x0c80('0x98')](_0x2c8043);})['then'](function(_0x5ca411){var _0x45ad61=_[_0x0c80('0x11e')](_0x5ca411);_0x2c8043=[];return db[_0x0c80('0x5f')][_0x0c80('0x11f')](function(_0x2bdacc){for(var _0x112015=0x0;_0x112015<_0x45ad61['length'];_0x112015++){_0x2c8043['push'](_0x45ad61[_0x112015][_0x0c80('0x120')](_0x513310['id']),{'transaction':_0x2bdacc});}return BPromise[_0x0c80('0x98')](_0x2c8043)['then'](function(){if(_0x513310[_0x0c80('0x121')]){return BPromise[_0x0c80('0xf4')](_[_0x0c80('0x5c')](_0x45ad61,function(_0x5e3ea9){return _0x5e3ea9[_0x0c80('0x122')]('channel')==='Voice';}),function(_0x4d9275){return db[_0x0c80('0xbd')][_0x0c80('0xbe')]({'membername':_0x513310[_0x0c80('0x40')],'UserId':_0x513310['id'],'queue_name':_0x4d9275['name'],'VoiceQueueId':_0x4d9275['id'],'interface':_[_0x0c80('0x74')](_0x513310[_0x0c80('0xad')])?util['format'](_0x0c80('0xbc'),_0x513310['name']):_0x513310[_0x0c80('0xad')],'paused':_0x513310[_0x0c80('0xac')]||![],'penalty':_0x513310[_0x0c80('0xb4')]},{'transaction':_0x2bdacc});});}else{return;}})[_0x0c80('0x22')](function(){for(var _0xe0ad74=0x0;_0xe0ad74<_0x45ad61[_0x0c80('0x55')];_0xe0ad74++){var _0x130689=_0x45ad61[_0xe0ad74]['getDataValue'](_0x0c80('0xaa'));var _0x205cc9=_0x130689+_0x0c80('0xb6');socket[_0x0c80('0xb7')]('user'+_0x130689+_0x0c80('0xb8'),{'UserId':_0x513310['id'],['queueField']:_0x45ad61[_0xe0ad74]['id']});}});});});}});}})[_0x0c80('0x22')](respondWithStatusCode(_0x56461e,null))['catch'](handleError(_0x56461e,null));};exports['removeTeams']=function(_0x55a621,_0xfc38){return db[_0x0c80('0x47')]['findOne']({'where':{'id':_0x55a621[_0x0c80('0x67')]['id']}})[_0x0c80('0x22')](handleEntityNotFound(_0xfc38,null))[_0x0c80('0x22')](function(_0x34912d){if(_0x34912d){var _0x24869c=_0x34912d['get']({'plain':!![]});var _0x4935aa=_0x55a621[_0x0c80('0x50')][_0x0c80('0x6e')];return _0x34912d['removeTeams'](_0x4935aa)[_0x0c80('0x22')](function(){for(var _0xd20a37=0x0;_0xd20a37<_0x4935aa['length'];_0xd20a37++){var _0x5c7848=[];db[_0x0c80('0x110')]['findOne']({'where':{'id':_0x4935aa[_0xd20a37]}})[_0x0c80('0x22')](function(_0x4997fa){_0x5c7848[_0x0c80('0x97')](_0x4997fa[_0x0c80('0x113')]()[_0x0c80('0x22')](function(_0x716fc){for(var _0x72e2b3=0x0;_0x72e2b3<_0x716fc['length'];_0x72e2b3++){_0x716fc[_0x72e2b3]['setDataValue'](_0x0c80('0xaa'),_0x0c80('0x114'));}return _0x716fc;}));_0x5c7848['push'](_0x4997fa[_0x0c80('0x115')]()[_0x0c80('0x22')](function(_0x3b5b75){for(var _0x2da78e=0x0;_0x2da78e<_0x3b5b75['length'];_0x2da78e++){_0x3b5b75[_0x2da78e][_0x0c80('0x117')]('channel',_0x0c80('0x116'));}return _0x3b5b75;}));_0x5c7848['push'](_0x4997fa['getMailQueues']()[_0x0c80('0x22')](function(_0x15a620){for(var _0x522eb5=0x0;_0x522eb5<_0x15a620['length'];_0x522eb5++){_0x15a620[_0x522eb5][_0x0c80('0x117')](_0x0c80('0xaa'),'Mail');}return _0x15a620;}));_0x5c7848[_0x0c80('0x97')](_0x4997fa[_0x0c80('0x123')]()['then'](function(_0x1a5922){for(var _0x4719bb=0x0;_0x4719bb<_0x1a5922['length'];_0x4719bb++){_0x1a5922[_0x4719bb][_0x0c80('0x117')](_0x0c80('0xaa'),_0x0c80('0x124'));}return _0x1a5922;}));_0x5c7848[_0x0c80('0x97')](_0x4997fa[_0x0c80('0x125')]()[_0x0c80('0x22')](function(_0x56a113){for(var _0x40ca5f=0x0;_0x40ca5f<_0x56a113[_0x0c80('0x55')];_0x40ca5f++){_0x56a113[_0x40ca5f][_0x0c80('0x117')](_0x0c80('0xaa'),'Whatsapp');}return _0x56a113;}));_0x5c7848[_0x0c80('0x97')](_0x4997fa[_0x0c80('0x11a')]()[_0x0c80('0x22')](function(_0x5aae39){for(var _0xa7858c=0x0;_0xa7858c<_0x5aae39[_0x0c80('0x55')];_0xa7858c++){_0x5aae39[_0xa7858c][_0x0c80('0x117')](_0x0c80('0xaa'),'Fax');}return _0x5aae39;}));_0x5c7848['push'](_0x4997fa['getOpenchannelQueues']()['then'](function(_0x44c7e0){for(var _0x28c443=0x0;_0x28c443<_0x44c7e0[_0x0c80('0x55')];_0x28c443++){_0x44c7e0[_0x28c443][_0x0c80('0x117')](_0x0c80('0xaa'),_0x0c80('0x11d'));}return _0x44c7e0;}));return BPromise[_0x0c80('0x98')](_0x5c7848);})[_0x0c80('0x22')](function(_0x1f16e8){var _0x1747d7=_[_0x0c80('0x11e')](_0x1f16e8);_0x5c7848=[];return db['sequelize'][_0x0c80('0x11f')](function(_0x9e7726){for(var _0x463600=0x0;_0x463600<_0x1747d7[_0x0c80('0x55')];_0x463600++){_0x5c7848[_0x0c80('0x97')](_0x1747d7[_0x463600][_0x0c80('0x126')](_0x24869c['id']),{'transaction':_0x9e7726});}return BPromise[_0x0c80('0x98')](_0x5c7848)[_0x0c80('0x22')](function(){if(_0x24869c[_0x0c80('0x121')]){return BPromise[_0x0c80('0xf4')](_[_0x0c80('0x5c')](_0x1747d7,function(_0x274312){return _0x274312[_0x0c80('0x122')]('channel')===_0x0c80('0x114');}),function(_0x595bc6){return db[_0x0c80('0xbd')][_0x0c80('0x34')]({'where':{'VoiceQueueId':_0x595bc6['id'],'UserId':_0x24869c['id']},'transaction':_0x9e7726});});}else{return;}})['then'](function(){for(var _0x4e4478=0x0;_0x4e4478<_0x1747d7[_0x0c80('0x55')];_0x4e4478++){var _0x21843f=_0x1747d7[_0x4e4478][_0x0c80('0x122')](_0x0c80('0xaa'));var _0xa7cdad=_0x21843f+_0x0c80('0xb6');socket[_0x0c80('0xb7')](_0x0c80('0x37')+_0x21843f+_0x0c80('0xc1'),{'UserId':_0x24869c['id'],['queueField']:_0x1747d7[_0x4e4478]['id']});}});});});}});}})['then'](respondWithStatusCode(_0xfc38,null))[_0x0c80('0x66')](handleError(_0xfc38,null));};exports[_0x0c80('0x127')]=function(_0x44f0fa,_0xf34b42,_0x14c983){var _0x5c3261={};var _0x3f32c7={};var _0xbe9efe;var _0x234063;return db[_0x0c80('0x47')][_0x0c80('0xa4')]({'where':{'id':_0x44f0fa['params']['id']}})[_0x0c80('0x22')](handleEntityNotFound(_0xf34b42,null))[_0x0c80('0x22')](function(_0x2878f8){if(_0x2878f8){_0xbe9efe=_0x2878f8;_0x3f32c7['model']=_[_0x0c80('0x4f')](db[_0x0c80('0xce')]['rawAttributes']);_0x3f32c7[_0x0c80('0x50')]=_['keys'](_0x44f0fa[_0x0c80('0x50')]);_0x3f32c7[_0x0c80('0x51')]=_[_0x0c80('0x52')](_0x3f32c7[_0x0c80('0x4b')],_0x3f32c7[_0x0c80('0x50')]);_0x5c3261[_0x0c80('0x53')]=_[_0x0c80('0x52')](_0x3f32c7[_0x0c80('0x4b')],qs['fields'](_0x44f0fa[_0x0c80('0x50')]['fields']));_0x5c3261[_0x0c80('0x53')]=_0x5c3261[_0x0c80('0x53')][_0x0c80('0x55')]?_0x5c3261[_0x0c80('0x53')]:_0x3f32c7[_0x0c80('0x4b')];_0x5c3261[_0x0c80('0x58')]=qs[_0x0c80('0x59')](_0x44f0fa[_0x0c80('0x50')][_0x0c80('0x59')]);_0x5c3261[_0x0c80('0x5a')]=qs[_0x0c80('0x51')](_[_0x0c80('0x5b')](_0x44f0fa[_0x0c80('0x50')],_0x3f32c7[_0x0c80('0x51')]));if(_0x44f0fa[_0x0c80('0x50')][_0x0c80('0x5c')]){_0x5c3261[_0x0c80('0x5a')]=_[_0x0c80('0x5d')](_0x5c3261['where'],{'$or':_[_0x0c80('0x4c')](_0x5c3261['attributes'],function(_0x344c94){var _0x2b672f={};_0x2b672f[_0x344c94]={'$like':'%'+_0x44f0fa[_0x0c80('0x50')]['filter']+'%'};return _0x2b672f;})});}_0x5c3261=_['merge']({},_0x5c3261,_0x44f0fa[_0x0c80('0x62')]);return _0xbe9efe[_0x0c80('0x127')](_0x5c3261);}})['then'](function(_0x4bf271){if(_0x4bf271){_0x234063=_0x4bf271[_0x0c80('0x55')];if(!_0x44f0fa[_0x0c80('0x50')][_0x0c80('0x56')](_0x0c80('0xd3'))){_0x5c3261[_0x0c80('0x57')]=qs[_0x0c80('0x57')](_0x44f0fa[_0x0c80('0x50')][_0x0c80('0x57')]);_0x5c3261[_0x0c80('0x2e')]=qs['offset'](_0x44f0fa[_0x0c80('0x50')][_0x0c80('0x2e')]);}return _0xbe9efe['getLists'](_0x5c3261);}})[_0x0c80('0x22')](function(_0x3f1bd6){if(_0x3f1bd6){return _0x3f1bd6?{'count':_0x234063,'rows':_0x3f1bd6}:null;}})['then'](respondWithResult(_0xf34b42,null))[_0x0c80('0x66')](handleError(_0xf34b42,null));};exports[_0x0c80('0x128')]=function(_0x5bdf41,_0x34346f,_0x456eb1){var _0x2c1259={};var _0x6e4999={};var _0x642da2;var _0x577856;return db['User'][_0x0c80('0xa4')]({'where':{'id':_0x5bdf41[_0x0c80('0x67')]['id']}})[_0x0c80('0x22')](handleEntityNotFound(_0x34346f,null))[_0x0c80('0x22')](function(_0x30d4eb){if(_0x30d4eb){_0x642da2=_0x30d4eb;_0x6e4999[_0x0c80('0x4b')]=_['keys'](db[_0x0c80('0x47')][_0x0c80('0x48')]);_0x6e4999[_0x0c80('0x50')]=_['keys'](_0x5bdf41[_0x0c80('0x50')]);_0x6e4999['filters']=_[_0x0c80('0x52')](_0x6e4999[_0x0c80('0x4b')],_0x6e4999['query']);_0x2c1259[_0x0c80('0x53')]=_[_0x0c80('0x52')](_0x6e4999[_0x0c80('0x4b')],qs[_0x0c80('0x54')](_0x5bdf41[_0x0c80('0x50')]['fields']));_0x2c1259['attributes']=_0x2c1259['attributes'][_0x0c80('0x55')]?_0x2c1259[_0x0c80('0x53')]:_0x6e4999[_0x0c80('0x4b')];_0x2c1259[_0x0c80('0x58')]=qs[_0x0c80('0x59')](_0x5bdf41[_0x0c80('0x50')]['sort']);_0x2c1259[_0x0c80('0x5a')]=qs[_0x0c80('0x51')](_[_0x0c80('0x5b')](_0x5bdf41['query'],_0x6e4999['filters']));if(_0x5bdf41[_0x0c80('0x50')]['filter']){_0x2c1259['where']=_['merge'](_0x2c1259[_0x0c80('0x5a')],{'$or':_[_0x0c80('0x4c')](_0x2c1259[_0x0c80('0x53')],function(_0x3350ea){var _0x430063={};_0x430063[_0x3350ea]={'$like':'%'+_0x5bdf41[_0x0c80('0x50')][_0x0c80('0x5c')]+'%'};return _0x430063;})});}_0x2c1259[_0x0c80('0x4b')]=db['User'];_0x2c1259['as']='Agents';_0x2c1259=_[_0x0c80('0x5d')]({},_0x2c1259,_0x5bdf41['options']);return _0x642da2[_0x0c80('0x113')]({'include':[_0x2c1259]});}})[_0x0c80('0x22')](function(_0x5f3379){if(_0x5f3379){var _0xc158c8={},_0x585396=[],_0x1a3886=0x0;for(var _0x757993=0x0;_0x757993<_0x5f3379[_0x0c80('0x55')];_0x757993+=0x1){for(var _0x231751=0x0,_0x3376b3;_0x231751<_0x5f3379[_0x757993][_0x0c80('0x91')][_0x0c80('0x55')];_0x231751+=0x1){_0x3376b3=_0x5f3379[_0x757993][_0x0c80('0x91')][_0x231751][_0x0c80('0x35')]({'plain':!![]});_0xc158c8[_0x3376b3['id']]=_0x3376b3;}}_0xc158c8=_['values'](_0xc158c8);for(var _0x308bd1=qs['offset'](_0x5bdf41['query'][_0x0c80('0x2e')]);_0x308bd1<_0xc158c8['length']&&_0x585396[_0x0c80('0x55')]=_0x1d4d6f[_0x2b98('0x54')]){throw new Error(_0x2b98('0x55'));}})['then'](function(){if(_0xc59ac9){return db[_0x2b98('0x2e')][_0x2b98('0x4d')]({'where':{'membername':_0xc59ac9[_0x2b98('0x2a')]},'individualHooks':!![]});}})[_0x2b98('0x12')](function(){if(_0xc59ac9){return _0xc59ac9[_0x2b98('0x56')]({'raw':!![]});}})[_0x2b98('0x12')](function(_0x247dc3){if(_0xc59ac9){if(_0x247dc3){var _0x17ba8f=[];_0x30f140=_0x247dc3;if(_0x30f140[_0x2b98('0x31')]){for(var _0x3b83ca=0x0;_0x3b83ca<_0x30f140[_0x2b98('0x31')];_0x3b83ca++){_0x17ba8f['push'](db[_0x2b98('0x2e')][_0x2b98('0x57')]({'membername':_0xc59ac9[_0x2b98('0x2a')],'UserId':_0xc59ac9['id'],'queue_name':_0x30f140[_0x3b83ca][_0x2b98('0x2a')],'VoiceQueueId':_0x30f140[_0x3b83ca]['id'],'interface':_0x55b229,'paused':_0xc59ac9[_0x2b98('0x58')]||![],'penalty':_0x30f140[_0x3b83ca]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x2b98('0x4a')](_0x17ba8f);}}}})[_0x2b98('0x12')](function(){if(_0xc59ac9){return db[_0x2b98('0x2f')][_0x2b98('0x1b')]({'where':{'membername':_0xc59ac9[_0x2b98('0x2a')],'exitAt':null}});}})[_0x2b98('0x12')](function(_0x29dd3d){if(_0xc59ac9){if(_0x29dd3d&&_0x29dd3d['length']){var _0x1a33cf=[];_0x29dd3d[_0x2b98('0x59')](function(_0x12ed0b){_0x1a33cf['push'](_0x12ed0b[_0x2b98('0x3d')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x1a33cf);}}})[_0x2b98('0x12')](function(_0x31bf06){if(_0xc59ac9){var _0x3499d6=[];var _0x2cea79=[];var _0x4af093=utils['getChannels']();var _0x3f1ab7={'membername':_0xc59ac9[_0x2b98('0x2a')],'interface':_0x55b229,'enterAt':moment()[_0x2b98('0x32')](_0x2b98('0x33')),'role':_0xc59ac9[_0x2b98('0x2b')],'internal':_0xc59ac9[_0x2b98('0x2c')]};_0x4af093[_0x2b98('0x59')](function(_0x1c4543){_0x3499d6[_0x2b98('0x36')](_[_0x2b98('0x5a')]({'channel':_0x1c4543,'type':_0x2b98('0x5b'),'data1':'callysquare','data2':_0x55b229},_0x3f1ab7));if(_0xc59ac9['loginInPause']){_0x2cea79['push'](_[_0x2b98('0x5a')]({'channel':_0x1c4543,'type':'PAUSE','data1':_0x2b98('0x5c')},_0x3f1ab7));}});return db[_0x2b98('0x2f')]['bulkCreate'](_0x3499d6[_0x2b98('0x5d')](_0x2cea79),{'individualHooks':!![]});}})[_0x2b98('0x12')](function(){if(_0xc59ac9){return _0xc59ac9[_0x2b98('0x3d')]({'online':!![],'lastLoginAt':moment()[_0x2b98('0x32')](_0x2b98('0x33')),'voicePause':_0xc59ac9[_0x2b98('0x58')]||![],'mailPause':_0xc59ac9[_0x2b98('0x58')]||![],'chatPause':_0xc59ac9['loginInPause']||![],'faxPause':_0xc59ac9['loginInPause']||![],'smsPause':_0xc59ac9[_0x2b98('0x58')]||![],'openchannelPause':_0xc59ac9[_0x2b98('0x58')]||![],'pauseType':_0xc59ac9[_0x2b98('0x58')]?_0x2b98('0x5c'):null,'lastPauseAt':moment()[_0x2b98('0x32')](_0x2b98('0x33')),'interface':_0x55b229});}})[_0x2b98('0x12')](function(_0x24a572){_0x238dab(_0x24a572);})['catch'](function(_0x3481da){_0x97e33f(_0x48532d[_0x2b98('0x18')](0x1f4,_0x3481da['message']));});});}; \ No newline at end of file +var _0x5269=['raw','where','limit','map','include','model','attributes','catch','ShowUser','find','PauseUser','name','role','internal','interface','update','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','SIP/%s','body','type','DEFAULT\x20PAUSE','UnpauseUser','findOne','channel','Unknown\x20channel','UserVoiceQueueRt','MemberReport','system','chat','fax','sms','openchannel','set','%s%s','Pause','all','LogoutUser','destroy','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','LOGIN','callysquare','merge','bulkCreate','concat','LOGININPAUSE','lodash','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./user.socket','register','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetUser','User','findAll','options'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5269,0x150));var _0x9526=function(_0x883632,_0x57a1ed){_0x883632=_0x883632-0x0;var _0x1595e5=_0x5269[_0x883632];return _0x1595e5;};'use strict';var _=require(_0x9526('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9526('0x1'));var db=require(_0x9526('0x2'))['db'];var utils=require(_0x9526('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x9526('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x9526('0x5')][_0x9526('0x6')]({'port':0x232a});config[_0x9526('0x7')]=_[_0x9526('0x8')](config[_0x9526('0x7')],{'host':_0x9526('0x9'),'port':0x18eb});var socket=require(_0x9526('0xa'))(new Redis(config[_0x9526('0x7')]));require(_0x9526('0xb'))[_0x9526('0xc')](socket);function respondWithRpcPromise(_0x3f0797,_0x43a1d5,_0x487bf0){return new BPromise(function(_0x2532c1,_0x1b2dc5){return client['request'](_0x3f0797,_0x487bf0)[_0x9526('0xd')](function(_0x1fa565){logger[_0x9526('0xe')](_0x9526('0xf'),_0x43a1d5,_0x9526('0x10'));logger[_0x9526('0x11')](_0x9526('0x12'),_0x43a1d5,'request\x20sent',JSON[_0x9526('0x13')](_0x1fa565));if(_0x1fa565[_0x9526('0x14')]){if(_0x1fa565['error'][_0x9526('0x15')]===0x1f4){logger[_0x9526('0x14')]('User,\x20%s,\x20%s',_0x43a1d5,_0x1fa565['error']['message']);return _0x1b2dc5(_0x1fa565[_0x9526('0x14')]['message']);}logger[_0x9526('0x14')](_0x9526('0xf'),_0x43a1d5,_0x1fa565[_0x9526('0x14')][_0x9526('0x16')]);return _0x2532c1(_0x1fa565[_0x9526('0x14')][_0x9526('0x16')]);}else{logger['info']('User,\x20%s,\x20%s',_0x43a1d5,_0x9526('0x10'));_0x2532c1(_0x1fa565[_0x9526('0x17')][_0x9526('0x16')]);}})['catch'](function(_0x1aac0d){logger['error'](_0x9526('0xf'),_0x43a1d5,_0x1aac0d);_0x1b2dc5(_0x1aac0d);});});}exports[_0x9526('0x18')]=function(_0x2cfe35){var _0x57cdd1=this;return new Promise(function(_0x5f5ad0,_0x3bb291){return db[_0x9526('0x19')][_0x9526('0x1a')]({'raw':_0x2cfe35[_0x9526('0x1b')]?_0x2cfe35['options'][_0x9526('0x1c')]===undefined?!![]:![]:!![],'where':_0x2cfe35['options']?_0x2cfe35[_0x9526('0x1b')][_0x9526('0x1d')]||null:null,'attributes':_0x2cfe35['options']?_0x2cfe35['options']['attributes']||null:null,'limit':_0x2cfe35[_0x9526('0x1b')]?_0x2cfe35['options'][_0x9526('0x1e')]||null:null,'include':_0x2cfe35[_0x9526('0x1b')]?_0x2cfe35[_0x9526('0x1b')]['include']?_[_0x9526('0x1f')](_0x2cfe35[_0x9526('0x1b')][_0x9526('0x20')],function(_0x119882){return{'model':db[_0x119882[_0x9526('0x21')]],'as':_0x119882['as'],'attributes':_0x119882[_0x9526('0x22')],'include':_0x119882[_0x9526('0x20')]?_[_0x9526('0x1f')](_0x119882['include'],function(_0xdc01fe){return{'model':db[_0xdc01fe[_0x9526('0x21')]],'as':_0xdc01fe['as'],'attributes':_0xdc01fe['attributes'],'include':_0xdc01fe[_0x9526('0x20')]?_['map'](_0xdc01fe[_0x9526('0x20')],function(_0xfd0b7c){return{'model':db[_0xfd0b7c[_0x9526('0x21')]],'as':_0xfd0b7c['as'],'attributes':_0xfd0b7c[_0x9526('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9526('0xd')](function(_0x12dca3){logger[_0x9526('0xe')](_0x9526('0x18'),_0x2cfe35);logger['debug']('GetUser',_0x2cfe35,JSON['stringify'](_0x12dca3));_0x5f5ad0(_0x12dca3);})[_0x9526('0x23')](function(_0x3fe7ce){logger[_0x9526('0x14')](_0x9526('0x18'),_0x3fe7ce[_0x9526('0x16')],_0x2cfe35);_0x3bb291(_0x57cdd1[_0x9526('0x14')](0x1f4,_0x3fe7ce[_0x9526('0x16')]));});});};exports[_0x9526('0x24')]=function(_0xa6a45f){var _0x4e20f9=this;return new Promise(function(_0x4ac0d4,_0x581a11){return db[_0x9526('0x19')][_0x9526('0x25')]({'raw':_0xa6a45f[_0x9526('0x1b')]?_0xa6a45f[_0x9526('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xa6a45f[_0x9526('0x1b')]?_0xa6a45f[_0x9526('0x1b')][_0x9526('0x1d')]||null:null,'attributes':_0xa6a45f[_0x9526('0x1b')]?_0xa6a45f[_0x9526('0x1b')]['attributes']||null:null,'include':_0xa6a45f[_0x9526('0x1b')]?_0xa6a45f[_0x9526('0x1b')][_0x9526('0x20')]?_[_0x9526('0x1f')](_0xa6a45f[_0x9526('0x1b')][_0x9526('0x20')],function(_0x5daba7){return{'model':db[_0x5daba7[_0x9526('0x21')]],'as':_0x5daba7['as'],'attributes':_0x5daba7['attributes'],'include':_0x5daba7[_0x9526('0x20')]?_[_0x9526('0x1f')](_0x5daba7[_0x9526('0x20')],function(_0x1e6b2c){return{'model':db[_0x1e6b2c['model']],'as':_0x1e6b2c['as'],'attributes':_0x1e6b2c['attributes'],'include':_0x1e6b2c[_0x9526('0x20')]?_[_0x9526('0x1f')](_0x1e6b2c[_0x9526('0x20')],function(_0x546a15){return{'model':db[_0x546a15[_0x9526('0x21')]],'as':_0x546a15['as'],'attributes':_0x546a15[_0x9526('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9526('0xd')](function(_0x2196a3){logger[_0x9526('0xe')](_0x9526('0x24'),_0xa6a45f);logger[_0x9526('0x11')](_0x9526('0x24'),_0xa6a45f,JSON[_0x9526('0x13')](_0x2196a3));_0x4ac0d4(_0x2196a3);})['catch'](function(_0x2a6f6f){logger[_0x9526('0x14')](_0x9526('0x24'),_0x2a6f6f['message'],_0xa6a45f);_0x581a11(_0x4e20f9[_0x9526('0x14')](0x1f4,_0x2a6f6f['message']));});});};exports[_0x9526('0x26')]=function(_0x59f020){var _0x407d50=this;return new Promise(function(_0x43d2b1,_0x53a919){var _0x77bf92;return db['User']['find']({'where':_0x59f020[_0x9526('0x1b')][_0x9526('0x1d')]||{},'attributes':['id',_0x9526('0x27'),_0x9526('0x28'),_0x9526('0x29'),_0x9526('0x2a')]})[_0x9526('0xd')](function(_0x348c23){if(_0x348c23){_0x77bf92=_0x348c23;return db['UserVoiceQueueRt'][_0x9526('0x2b')]({'paused':0x1},{'where':{'UserId':_0x77bf92['id']},'individualHooks':!![]});}})[_0x9526('0xd')](function(){if(_0x77bf92){return db['MemberReport'][_0x9526('0x1a')]({'where':{'membername':_0x77bf92[_0x9526('0x27')],'type':_0x9526('0x2c'),'exitAt':null}});}})[_0x9526('0xd')](function(_0x2490ae){if(_0x77bf92){if(_0x2490ae&&_0x2490ae[_0x9526('0x2d')]){var _0x16d270=moment()[_0x9526('0x2e')](_0x9526('0x2f'));for(var _0x1e07c2=0x0,_0x4066c1=_0x2490ae[_0x9526('0x2d')];_0x1e07c2<_0x4066c1;_0x1e07c2++){_0x2490ae[_0x1e07c2][_0x9526('0x30')]({'exitAt':_0x16d270});}}}})['then'](function(){if(_0x77bf92){var _0x31b682=[];var _0x4efaee=utils[_0x9526('0x31')]();_0x4efaee[_0x9526('0x32')](function(_0x4811a8){_0x31b682[_0x9526('0x33')]({'channel':_0x4811a8,'membername':_0x77bf92[_0x9526('0x27')],'interface':_[_0x9526('0x34')](_0x77bf92[_0x9526('0x2a')])?util['format'](_0x9526('0x35'),_0x77bf92[_0x9526('0x27')]):_0x77bf92[_0x9526('0x2a')],'type':_0x9526('0x2c'),'enterAt':moment()['format'](_0x9526('0x2f')),'data1':_0x59f020[_0x9526('0x36')][_0x9526('0x37')]||_0x9526('0x38'),'role':_0x77bf92['role'],'internal':_0x77bf92[_0x9526('0x29')],'uniqueid':_0x59f020[_0x9526('0x36')]['uniqueid']||null});});return db['MemberReport']['bulkCreate'](_0x31b682,{'individualHooks':!![]});}})[_0x9526('0xd')](function(){if(_0x77bf92){return _0x77bf92[_0x9526('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x59f020['body'][_0x9526('0x37')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x9526('0x2e')](_0x9526('0x2f'))});}})[_0x9526('0xd')](function(_0x7a3f62){_0x43d2b1(_0x7a3f62);})['catch'](function(_0x19cfce){_0x53a919(_0x407d50[_0x9526('0x14')](0x1f4,_0x19cfce['message']));});});};exports[_0x9526('0x39')]=function(_0xcef23){var _0x12d3a0=this;return new Promise(function(_0x2e7461,_0x4e7ba6){var _0x5addbf;return db[_0x9526('0x19')][_0x9526('0x3a')]({'where':_0xcef23[_0x9526('0x1b')]['where']||{},'attributes':['id',_0x9526('0x27')]})[_0x9526('0xd')](function(_0x222e9d){if(_0x222e9d){_0x5addbf=_0x222e9d;if(_0xcef23[_0x9526('0x36')]['channel']&&!utils['isValidChannel'](_0xcef23[_0x9526('0x36')][_0x9526('0x3b')])){throw new Error(_0x9526('0x3c'));}switch(_0xcef23[_0x9526('0x36')][_0x9526('0x3b')]){case'voice':return db[_0x9526('0x3d')][_0x9526('0x2b')]({'paused':0x0},{'where':{'UserId':_0x5addbf['id']}})[_0x9526('0xd')](function(){return db[_0x9526('0x3e')][_0x9526('0x25')]({'where':{'channel':_0xcef23[_0x9526('0x36')]['channel'],'membername':_0x5addbf[_0x9526('0x27')],'type':_0x9526('0x2c'),'exitAt':null}});})[_0x9526('0xd')](function(_0x508213){if(_0x508213){return _0x508213[_0x9526('0x2b')]({'exitAt':moment()[_0x9526('0x2e')](_0x9526('0x2f')),'data2':_0x9526('0x3f')},{'individualHooks':!![]});}return null;})[_0x9526('0xd')](function(){return _0x5addbf[_0x9526('0x2b')]({'voicePause':![]});});case'mail':case _0x9526('0x40'):case _0x9526('0x41'):case _0x9526('0x42'):case _0x9526('0x43'):case'whatsapp':return db[_0x9526('0x3e')][_0x9526('0x25')]({'where':{'channel':_0xcef23['body'][_0x9526('0x3b')],'membername':_0x5addbf['name'],'type':_0x9526('0x2c'),'exitAt':null}})['then'](function(_0x44e4e1){return _0x44e4e1[_0x9526('0x2b')]({'exitAt':moment()[_0x9526('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'},{'individualHooks':!![]});})['then'](function(){var _0x4b8995={};_[_0x9526('0x44')](_0x4b8995,util[_0x9526('0x2e')](_0x9526('0x45'),_0xcef23[_0x9526('0x36')]['channel'],_0x9526('0x46')),![]);return _0x5addbf['update'](_0x4b8995);});default:return db[_0x9526('0x3d')][_0x9526('0x2b')]({'paused':0x0},{'where':{'UserId':_0x5addbf['id']}})[_0x9526('0xd')](function(){return db[_0x9526('0x3e')][_0x9526('0x1a')]({'where':{'membername':_0x5addbf['name'],'type':_0x9526('0x2c'),'exitAt':null}});})[_0x9526('0xd')](function(_0x2f9813){var _0x349dc5=[];_0x2f9813[_0x9526('0x32')](function(_0x519913){_0x349dc5[_0x9526('0x33')](_0x519913[_0x9526('0x2b')]({'exitAt':moment()['format'](_0x9526('0x2f')),'data2':_0x9526('0x3f')}));});return BPromise[_0x9526('0x47')](_0x349dc5);})[_0x9526('0xd')](function(){return _0x5addbf[_0x9526('0x2b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x9526('0xd')](function(_0x35777b){_0x2e7461(_0x35777b);})[_0x9526('0x23')](function(_0x4f1323){_0x4e7ba6(_0x12d3a0[_0x9526('0x14')](0x1f4,_0x4f1323[_0x9526('0x16')]));});});};exports[_0x9526('0x48')]=function(_0x4401c7){var _0x348976=this;return new Promise(function(_0x1fcf8d,_0x3f6b12){var _0x96e1e7;return db[_0x9526('0x19')][_0x9526('0x3a')]({'where':_0x4401c7[_0x9526('0x1b')]['where']||{},'attributes':['id',_0x9526('0x27')]})['then'](function(_0x560e10){if(_0x560e10){_0x96e1e7=_0x560e10;return db[_0x9526('0x3d')][_0x9526('0x49')]({'where':{'membername':_0x96e1e7['name']},'individualHooks':!![]});}})['then'](function(){if(_0x96e1e7){return db[_0x9526('0x3e')]['findAll']({'where':{'membername':_0x96e1e7['name'],'exitAt':null}});}})[_0x9526('0xd')](function(_0x145b27){if(_0x96e1e7){if(_0x145b27&&_0x145b27[_0x9526('0x2d')]){var _0x51a6b7=[];_0x145b27[_0x9526('0x32')](function(_0x4eacf6){_0x51a6b7[_0x9526('0x33')](_0x4eacf6['update']({'exitAt':moment()[_0x9526('0x2e')](_0x9526('0x2f'))}));});return BPromise[_0x9526('0x47')](_0x51a6b7);}}})[_0x9526('0xd')](function(){if(_0x96e1e7){return _0x96e1e7[_0x9526('0x2b')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x9526('0xd')](function(_0x55b75c){_0x1fcf8d(_0x55b75c);})[_0x9526('0x23')](function(_0x53dff8){_0x3f6b12(_0x348976[_0x9526('0x14')](0x1f4,_0x53dff8['message']));});});};exports['LoginUser']=function(_0xc645c2){var _0x4e0374=this;return new Promise(function(_0x48aba5,_0xcec84b){var _0x564f75;var _0x4592f9;var _0x214d41;var _0x1de8ac;return db[_0x9526('0x19')]['findOne']({'where':_0xc645c2[_0x9526('0x1b')][_0x9526('0x1d')]||{},'attributes':['id','name',_0x9526('0x28'),_0x9526('0x4a'),_0x9526('0x4b'),_0x9526('0x29'),_0x9526('0x4c'),_0x9526('0x2a')]})[_0x9526('0xd')](function(_0x51cf89){if(_0x51cf89){_0x564f75=_0x51cf89;_0x1de8ac=_0xc645c2[_0x9526('0x36')][_0x9526('0x2a')]?_0xc645c2[_0x9526('0x36')]['interface']:util[_0x9526('0x2e')](_0x9526('0x35'),_0x564f75[_0x9526('0x27')]);return db[_0x9526('0x19')][_0x9526('0x4d')]({'where':{'role':_0x9526('0x4e'),'online':!![],'id':{'$ne':_0x564f75['id']}}});}})[_0x9526('0xd')](function(_0x5cc8ab){if(_0x5cc8ab){_0x214d41=_0x5cc8ab;return require(_0x9526('0x4f'))[_0x9526('0x50')]();}})[_0x9526('0xd')](function(_0x283338){if(_0x283338&&_0x283338['agents']&&_0x214d41>=_0x283338[_0x9526('0x51')]){throw new Error(_0x9526('0x52'));}})['then'](function(){if(_0x564f75){return db['UserVoiceQueueRt'][_0x9526('0x49')]({'where':{'membername':_0x564f75['name']},'individualHooks':!![]});}})[_0x9526('0xd')](function(){if(_0x564f75){return _0x564f75['getVoiceQueues']({'raw':!![]});}})[_0x9526('0xd')](function(_0x1cd4d5){if(_0x564f75){if(_0x1cd4d5){var _0x4280ed=[];_0x4592f9=_0x1cd4d5;if(_0x4592f9[_0x9526('0x2d')]){for(var _0x50dbf0=0x0;_0x50dbf0<_0x4592f9[_0x9526('0x2d')];_0x50dbf0++){_0x4280ed[_0x9526('0x33')](db[_0x9526('0x3d')][_0x9526('0x53')]({'membername':_0x564f75[_0x9526('0x27')],'UserId':_0x564f75['id'],'queue_name':_0x4592f9[_0x50dbf0][_0x9526('0x27')],'VoiceQueueId':_0x4592f9[_0x50dbf0]['id'],'interface':_0x1de8ac,'paused':_0x564f75[_0x9526('0x4c')]||![],'penalty':_0x4592f9[_0x50dbf0][_0x9526('0x54')]||0x0}));}return BPromise[_0x9526('0x47')](_0x4280ed);}}}})[_0x9526('0xd')](function(){if(_0x564f75){return db[_0x9526('0x3e')][_0x9526('0x1a')]({'where':{'membername':_0x564f75['name'],'exitAt':null}});}})[_0x9526('0xd')](function(_0x2761d2){if(_0x564f75){if(_0x2761d2&&_0x2761d2[_0x9526('0x2d')]){var _0x2d12cd=[];_0x2761d2[_0x9526('0x32')](function(_0x307ab3){_0x2d12cd[_0x9526('0x33')](_0x307ab3[_0x9526('0x2b')]({'exitAt':moment()[_0x9526('0x2e')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x9526('0x47')](_0x2d12cd);}}})[_0x9526('0xd')](function(_0x30837b){if(_0x564f75){var _0x29a3d3=[];var _0x397bd0=[];var _0x5ec88e=utils[_0x9526('0x31')]();var _0x5c1f1f={'membername':_0x564f75[_0x9526('0x27')],'interface':_0x1de8ac,'enterAt':moment()[_0x9526('0x2e')](_0x9526('0x2f')),'role':_0x564f75[_0x9526('0x28')],'internal':_0x564f75[_0x9526('0x29')]};_0x5ec88e[_0x9526('0x32')](function(_0x1d320d){_0x29a3d3['push'](_['merge']({'channel':_0x1d320d,'type':_0x9526('0x55'),'data1':_0x9526('0x56'),'data2':_0x1de8ac},_0x5c1f1f));if(_0x564f75[_0x9526('0x4c')]){_0x397bd0[_0x9526('0x33')](_[_0x9526('0x57')]({'channel':_0x1d320d,'type':'PAUSE','data1':'LOGININPAUSE'},_0x5c1f1f));}});return db[_0x9526('0x3e')][_0x9526('0x58')](_0x29a3d3[_0x9526('0x59')](_0x397bd0),{'individualHooks':!![]});}})['then'](function(){if(_0x564f75){return _0x564f75[_0x9526('0x2b')]({'online':!![],'lastLoginAt':moment()['format'](_0x9526('0x2f')),'voicePause':_0x564f75['loginInPause']||![],'mailPause':_0x564f75['loginInPause']||![],'chatPause':_0x564f75[_0x9526('0x4c')]||![],'faxPause':_0x564f75['loginInPause']||![],'smsPause':_0x564f75[_0x9526('0x4c')]||![],'openchannelPause':_0x564f75['loginInPause']||![],'pauseType':_0x564f75[_0x9526('0x4c')]?_0x9526('0x5a'):null,'lastPauseAt':moment()['format'](_0x9526('0x2f')),'interface':_0x1de8ac});}})[_0x9526('0xd')](function(_0x43e5de){_0x48aba5(_0x43e5de);})[_0x9526('0x23')](function(_0x3d306f){_0xcec84b(_0x4e0374[_0x9526('0x14')](0x1f4,_0x3d306f['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 7955a1b..4ea70d7 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 _0xc251=['length','user:','./user.events','save','remove','removeListener','register'];(function(_0xd7a53e,_0x10a35a){var _0x18810e=function(_0x69b148){while(--_0x69b148){_0xd7a53e['push'](_0xd7a53e['shift']());}};_0x18810e(++_0x10a35a);}(_0xc251,0x128));var _0x1c25=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xc251[_0x17406a];return _0x1501ff;};'use strict';var UserEvents=require(_0x1c25('0x0'));var events=[_0x1c25('0x1'),_0x1c25('0x2'),'update'];function createListener(_0x573fb1,_0x67d930){return function(_0x12917d){_0x67d930['emit'](_0x573fb1,_0x12917d);};}function removeListener(_0x2bd709,_0x2a0524){return function(){UserEvents[_0x1c25('0x3')](_0x2bd709,_0x2a0524);};}exports[_0x1c25('0x4')]=function(_0x68dd0e){for(var _0x1db3f8=0x0,_0x515340=events[_0x1c25('0x5')];_0x1db3f8<_0x515340;_0x1db3f8++){var _0x1fd9d0=events[_0x1db3f8];var _0x339659=createListener(_0x1c25('0x6')+_0x1fd9d0,_0x68dd0e);UserEvents['on'](_0x1fd9d0,_0x339659);}}; \ No newline at end of file +var _0xa063=['emit','removeListener','register','length','user:','./user.events','save','remove','update'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xa063,0x8c));var _0x3a06=function(_0x332844,_0xc350cd){_0x332844=_0x332844-0x0;var _0x2f29ac=_0xa063[_0x332844];return _0x2f29ac;};'use strict';var UserEvents=require(_0x3a06('0x0'));var events=[_0x3a06('0x1'),_0x3a06('0x2'),_0x3a06('0x3')];function createListener(_0x1685c2,_0x5d0b6a){return function(_0xc6981e){_0x5d0b6a[_0x3a06('0x4')](_0x1685c2,_0xc6981e);};}function removeListener(_0x353807,_0x34e395){return function(){UserEvents[_0x3a06('0x5')](_0x353807,_0x34e395);};}exports[_0x3a06('0x6')]=function(_0x57b2cd){for(var _0xf12f85=0x0,_0x7f7918=events[_0x3a06('0x7')];_0xf12f85<_0x7f7918;_0xf12f85++){var _0x83f862=events[_0xf12f85];var _0x530a9b=createListener(_0x3a06('0x8')+_0x83f862,_0x57b2cd);UserEvents['on'](_0x83f862,_0x530a9b);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 528ebc6..2734e39 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 _0xa1e5=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','multer','util','path'];(function(_0x257924,_0x5c6f3c){var _0x1a530b=function(_0x3c6f32){while(--_0x3c6f32){_0x257924['push'](_0x257924['shift']());}};_0x1a530b(++_0x5c6f3c);}(_0xa1e5,0x135));var _0x5a1e=function(_0x448509,_0x47ed60){_0x448509=_0x448509-0x0;var _0x12311b=_0xa1e5[_0x448509];return _0x12311b;};'use strict';var multer=require(_0x5a1e('0x0'));var util=require(_0x5a1e('0x1'));var path=require(_0x5a1e('0x2'));var timeout=require(_0x5a1e('0x3'));var express=require(_0x5a1e('0x4'));var router=express[_0x5a1e('0x5')]();var auth=require(_0x5a1e('0x6'));var interaction=require(_0x5a1e('0x7'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x59f3=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout'];(function(_0x343455,_0x4918cb){var _0x133530=function(_0x5e2379){while(--_0x5e2379){_0x343455['push'](_0x343455['shift']());}};_0x133530(++_0x4918cb);}(_0x59f3,0x9d));var _0x359f=function(_0x1fa760,_0x1bf063){_0x1fa760=_0x1fa760-0x0;var _0xd8eda1=_0x59f3[_0x1fa760];return _0xd8eda1;};'use strict';var multer=require('multer');var util=require(_0x359f('0x0'));var path=require(_0x359f('0x1'));var timeout=require(_0x359f('0x2'));var express=require(_0x359f('0x3'));var router=express['Router']();var auth=require(_0x359f('0x4'));var interaction=require(_0x359f('0x5'));var config=require(_0x359f('0x6'));module[_0x359f('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 f6e7592..25ffe9d 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 _0xbaf0=['exports','INTEGER'];(function(_0x50fda9,_0x5ee44b){var _0x36b92b=function(_0x121877){while(--_0x121877){_0x50fda9['push'](_0x50fda9['shift']());}};_0x36b92b(++_0x5ee44b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x1aa444,_0x4d6b5f){var _0xb36b20=function(_0x29eb0f){while(--_0x29eb0f){_0x1aa444['push'](_0x1aa444['shift']());}};_0xb36b20(++_0x4d6b5f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 18ffcf5..89bcc08 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 _0x1a15=['request-promise','path','rimraf','./userChatQueue.attributes','exports','define','UserChatQueue','lodash','util','../../config/logger','moment','bluebird'];(function(_0x13d6d7,_0x298462){var _0x4de1cc=function(_0x15f754){while(--_0x15f754){_0x13d6d7['push'](_0x13d6d7['shift']());}};_0x4de1cc(++_0x298462);}(_0x1a15,0x103));var _0x51a1=function(_0x4fec16,_0x306138){_0x4fec16=_0x4fec16-0x0;var _0x19cb59=_0x1a15[_0x4fec16];return _0x19cb59;};'use strict';var _=require(_0x51a1('0x0'));var util=require(_0x51a1('0x1'));var logger=require(_0x51a1('0x2'))('api');var moment=require(_0x51a1('0x3'));var BPromise=require(_0x51a1('0x4'));var rp=require(_0x51a1('0x5'));var fs=require('fs');var path=require(_0x51a1('0x6'));var rimraf=require(_0x51a1('0x7'));var config=require('../../config/environment');var attributes=require(_0x51a1('0x8'));module[_0x51a1('0x9')]=function(_0x37d1e6,_0x4d8db0){return _0x37d1e6[_0x51a1('0xa')](_0x51a1('0xb'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5332=['api','moment','request-promise','path','rimraf','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5332,0x12a));var _0x2533=function(_0x2d60d9,_0x1b9cbc){_0x2d60d9=_0x2d60d9-0x0;var _0x583b25=_0x5332[_0x2d60d9];return _0x583b25;};'use strict';var _=require(_0x2533('0x0'));var util=require('util');var logger=require(_0x2533('0x1'))(_0x2533('0x2'));var moment=require(_0x2533('0x3'));var BPromise=require('bluebird');var rp=require(_0x2533('0x4'));var fs=require('fs');var path=require(_0x2533('0x5'));var rimraf=require(_0x2533('0x6'));var config=require('../../config/environment');var attributes=require(_0x2533('0x7'));module[_0x2533('0x8')]=function(_0x4bc6dc,_0x5ec155){return _0x4bc6dc[_0x2533('0x9')](_0x2533('0xa'),attributes,{'tableName':_0x2533('0xb'),'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 de34e82..48e2072 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 _0xa494=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment'];(function(_0x1a52bc,_0x49fe85){var _0x2f2109=function(_0x2c5619){while(--_0x2c5619){_0x1a52bc['push'](_0x1a52bc['shift']());}};_0x2f2109(++_0x49fe85);}(_0xa494,0x1ca));var _0x4a49=function(_0x30c106,_0x4eafa9){_0x30c106=_0x30c106-0x0;var _0xfbcc47=_0xa494[_0x30c106];return _0xfbcc47;};'use strict';var _=require('lodash');var util=require(_0x4a49('0x0'));var moment=require(_0x4a49('0x1'));var BPromise=require(_0x4a49('0x2'));var rs=require(_0x4a49('0x3'));var fs=require('fs');var Redis=require(_0x4a49('0x4'));var db=require(_0x4a49('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4a49('0x6'))(_0x4a49('0x7'));var config=require(_0x4a49('0x8'));var jayson=require(_0x4a49('0x9'));var client=jayson['client'][_0x4a49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54732a,_0x527af1,_0x5391e9){return new BPromise(function(_0x4f8174,_0x90c7a){return client[_0x4a49('0xb')](_0x54732a,_0x5391e9)['then'](function(_0x47325d){logger['info'](_0x4a49('0xc'),_0x527af1,_0x4a49('0xd'));logger[_0x4a49('0xe')](_0x4a49('0xf'),_0x527af1,_0x4a49('0xd'),JSON[_0x4a49('0x10')](_0x47325d));if(_0x47325d[_0x4a49('0x11')]){if(_0x47325d[_0x4a49('0x11')][_0x4a49('0x12')]===0x1f4){logger['error'](_0x4a49('0xc'),_0x527af1,_0x47325d[_0x4a49('0x11')][_0x4a49('0x13')]);return _0x90c7a(_0x47325d['error'][_0x4a49('0x13')]);}logger['error'](_0x4a49('0xc'),_0x527af1,_0x47325d[_0x4a49('0x11')][_0x4a49('0x13')]);return _0x4f8174(_0x47325d[_0x4a49('0x11')][_0x4a49('0x13')]);}else{logger[_0x4a49('0x14')](_0x4a49('0xc'),_0x527af1,'request\x20sent');_0x4f8174(_0x47325d[_0x4a49('0x15')][_0x4a49('0x13')]);}})[_0x4a49('0x16')](function(_0x1b6afb){logger[_0x4a49('0x11')](_0x4a49('0xc'),_0x527af1,_0x1b6afb);_0x90c7a(_0x1b6afb);});});} \ No newline at end of file +var _0xe236=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util'];(function(_0xde7306,_0x28ce67){var _0xdc2642=function(_0x5a8657){while(--_0x5a8657){_0xde7306['push'](_0xde7306['shift']());}};_0xdc2642(++_0x28ce67);}(_0xe236,0xdb));var _0x6e23=function(_0x1af05b,_0x5134b5){_0x1af05b=_0x1af05b-0x0;var _0x5be7cc=_0xe236[_0x1af05b];return _0x5be7cc;};'use strict';var _=require('lodash');var util=require(_0x6e23('0x0'));var moment=require(_0x6e23('0x1'));var BPromise=require(_0x6e23('0x2'));var rs=require(_0x6e23('0x3'));var fs=require('fs');var Redis=require(_0x6e23('0x4'));var db=require(_0x6e23('0x5'))['db'];var utils=require(_0x6e23('0x6'));var logger=require(_0x6e23('0x7'))(_0x6e23('0x8'));var config=require('../../config/environment');var jayson=require(_0x6e23('0x9'));var client=jayson[_0x6e23('0xa')][_0x6e23('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45b9e4,_0x23e16a,_0x3b1c7d){return new BPromise(function(_0xf469c1,_0x35317a){return client['request'](_0x45b9e4,_0x3b1c7d)['then'](function(_0x4815e4){logger[_0x6e23('0xc')](_0x6e23('0xd'),_0x23e16a,_0x6e23('0xe'));logger[_0x6e23('0xf')](_0x6e23('0x10'),_0x23e16a,'request\x20sent',JSON[_0x6e23('0x11')](_0x4815e4));if(_0x4815e4[_0x6e23('0x12')]){if(_0x4815e4[_0x6e23('0x12')][_0x6e23('0x13')]===0x1f4){logger[_0x6e23('0x12')](_0x6e23('0xd'),_0x23e16a,_0x4815e4['error']['message']);return _0x35317a(_0x4815e4['error']['message']);}logger[_0x6e23('0x12')](_0x6e23('0xd'),_0x23e16a,_0x4815e4[_0x6e23('0x12')]['message']);return _0xf469c1(_0x4815e4['error'][_0x6e23('0x14')]);}else{logger[_0x6e23('0xc')](_0x6e23('0xd'),_0x23e16a,_0x6e23('0xe'));_0xf469c1(_0x4815e4['result']['message']);}})[_0x6e23('0x15')](function(_0xdfa84a){logger[_0x6e23('0x12')](_0x6e23('0xd'),_0x23e16a,_0xdfa84a);_0x35317a(_0xdfa84a);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index d87eca9..0b5e717 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 _0x233c=['connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x233c,0x14d));var _0xc233=function(_0x16e385,_0x4e8db2){_0x16e385=_0x16e385-0x0;var _0x78c03e=_0x233c[_0x16e385];return _0x78c03e;};'use strict';var multer=require(_0xc233('0x0'));var util=require(_0xc233('0x1'));var path=require(_0xc233('0x2'));var timeout=require(_0xc233('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xc233('0x4'));var interaction=require(_0xc233('0x5'));var config=require(_0xc233('0x6'));module[_0xc233('0x7')]=router; \ No newline at end of file +var _0xbd9e=['Router','../../components/interaction/service','exports','util','path','connect-timeout','express'];(function(_0x496d86,_0x34c82a){var _0x23a83e=function(_0x3757f1){while(--_0x3757f1){_0x496d86['push'](_0x496d86['shift']());}};_0x23a83e(++_0x34c82a);}(_0xbd9e,0x1df));var _0xebd9=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xbd9e[_0x32d457];return _0x338386;};'use strict';var multer=require('multer');var util=require(_0xebd9('0x0'));var path=require(_0xebd9('0x1'));var timeout=require(_0xebd9('0x2'));var express=require(_0xebd9('0x3'));var router=express[_0xebd9('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xebd9('0x5'));var config=require('../../config/environment');module[_0xebd9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index d1d3647..e33dc1e 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 _0xe511=['INTEGER','sequelize','exports'];(function(_0x31c87a,_0x11b9f5){var _0x10366e=function(_0x56f96b){while(--_0x56f96b){_0x31c87a['push'](_0x31c87a['shift']());}};_0x10366e(++_0x11b9f5);}(_0xe511,0x16f));var _0x1e51=function(_0x586ec4,_0x5d1f1c){_0x586ec4=_0x586ec4-0x0;var _0x17267e=_0xe511[_0x586ec4];return _0x17267e;};'use strict';var Sequelize=require(_0x1e51('0x0'));module[_0x1e51('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x1e51('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1775=['STRING','exports','INTEGER'];(function(_0x335f02,_0x3507bf){var _0x32a6f1=function(_0xe1a088){while(--_0xe1a088){_0x335f02['push'](_0x335f02['shift']());}};_0x32a6f1(++_0x3507bf);}(_0x1775,0x1db));var _0x5177=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1775[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x5177('0x0')]={'penalty':{'type':Sequelize[_0x5177('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x5177('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x5177('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index e8dff83..665bbeb 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 _0x33f8=['path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','api','moment','request-promise'];(function(_0x10e4a5,_0x57c63d){var _0x1d53a9=function(_0xb893e9){while(--_0xb893e9){_0x10e4a5['push'](_0x10e4a5['shift']());}};_0x1d53a9(++_0x57c63d);}(_0x33f8,0x1f4));var _0x833f=function(_0x55962d,_0x119503){_0x55962d=_0x55962d-0x0;var _0x307b4d=_0x33f8[_0x55962d];return _0x307b4d;};'use strict';var _=require(_0x833f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x833f('0x1'));var moment=require(_0x833f('0x2'));var BPromise=require('bluebird');var rp=require(_0x833f('0x3'));var fs=require('fs');var path=require(_0x833f('0x4'));var rimraf=require(_0x833f('0x5'));var config=require(_0x833f('0x6'));var attributes=require(_0x833f('0x7'));module[_0x833f('0x8')]=function(_0x3bd816,_0x5f345f){return _0x3bd816[_0x833f('0x9')](_0x833f('0xa'),attributes,{'tableName':_0x833f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd873=['util','api','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash'];(function(_0x2da1f9,_0x5e4269){var _0x22ef92=function(_0x1a152a){while(--_0x1a152a){_0x2da1f9['push'](_0x2da1f9['shift']());}};_0x22ef92(++_0x5e4269);}(_0xd873,0xe6));var _0x3d87=function(_0x552593,_0x1259dd){_0x552593=_0x552593-0x0;var _0x1ae101=_0xd873[_0x552593];return _0x1ae101;};'use strict';var _=require(_0x3d87('0x0'));var util=require(_0x3d87('0x1'));var logger=require('../../config/logger')(_0x3d87('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3d87('0x3'));var rimraf=require(_0x3d87('0x4'));var config=require(_0x3d87('0x5'));var attributes=require(_0x3d87('0x6'));module[_0x3d87('0x7')]=function(_0x5e7ed8,_0x568e36){return _0x5e7ed8[_0x3d87('0x8')](_0x3d87('0x9'),attributes,{'tableName':_0x3d87('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 18df931..ca3ebb2 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 _0xacf5=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x4ec9e3,_0x15fbf4){var _0x2883ce=function(_0x3e9998){while(--_0x3e9998){_0x4ec9e3['push'](_0x4ec9e3['shift']());}};_0x2883ce(++_0x15fbf4);}(_0xacf5,0x110));var _0x5acf=function(_0x1e70a1,_0x688d0f){_0x1e70a1=_0x1e70a1-0x0;var _0xdb752c=_0xacf5[_0x1e70a1];return _0xdb752c;};'use strict';var _=require(_0x5acf('0x0'));var util=require(_0x5acf('0x1'));var moment=require(_0x5acf('0x2'));var BPromise=require(_0x5acf('0x3'));var rs=require(_0x5acf('0x4'));var fs=require('fs');var Redis=require(_0x5acf('0x5'));var db=require(_0x5acf('0x6'))['db'];var utils=require(_0x5acf('0x7'));var logger=require(_0x5acf('0x8'))(_0x5acf('0x9'));var config=require('../../config/environment');var jayson=require(_0x5acf('0xa'));var client=jayson[_0x5acf('0xb')][_0x5acf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21c7dd,_0x766711,_0x53b20f){return new BPromise(function(_0x555953,_0x5f12f0){return client[_0x5acf('0xd')](_0x21c7dd,_0x53b20f)[_0x5acf('0xe')](function(_0x57e2da){logger[_0x5acf('0xf')](_0x5acf('0x10'),_0x766711,_0x5acf('0x11'));logger[_0x5acf('0x12')](_0x5acf('0x13'),_0x766711,_0x5acf('0x11'),JSON[_0x5acf('0x14')](_0x57e2da));if(_0x57e2da[_0x5acf('0x15')]){if(_0x57e2da[_0x5acf('0x15')][_0x5acf('0x16')]===0x1f4){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x766711,_0x57e2da['error'][_0x5acf('0x17')]);return _0x5f12f0(_0x57e2da[_0x5acf('0x15')]['message']);}logger['error'](_0x5acf('0x10'),_0x766711,_0x57e2da[_0x5acf('0x15')][_0x5acf('0x17')]);return _0x555953(_0x57e2da['error'][_0x5acf('0x17')]);}else{logger[_0x5acf('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x766711,_0x5acf('0x11'));_0x555953(_0x57e2da['result'][_0x5acf('0x17')]);}})[_0x5acf('0x18')](function(_0x27373f){logger[_0x5acf('0x15')](_0x5acf('0x10'),_0x766711,_0x27373f);_0x5f12f0(_0x27373f);});});} \ No newline at end of file +var _0x9c29=['request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserFaxQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info'];(function(_0x3b670b,_0x10c33f){var _0x4d3717=function(_0x343108){while(--_0x343108){_0x3b670b['push'](_0x3b670b['shift']());}};_0x4d3717(++_0x10c33f);}(_0x9c29,0xc1));var _0x99c2=function(_0x2c6fb7,_0x1506e3){_0x2c6fb7=_0x2c6fb7-0x0;var _0x486b6a=_0x9c29[_0x2c6fb7];return _0x486b6a;};'use strict';var _=require(_0x99c2('0x0'));var util=require(_0x99c2('0x1'));var moment=require(_0x99c2('0x2'));var BPromise=require('bluebird');var rs=require(_0x99c2('0x3'));var fs=require('fs');var Redis=require(_0x99c2('0x4'));var db=require(_0x99c2('0x5'))['db'];var utils=require(_0x99c2('0x6'));var logger=require(_0x99c2('0x7'))(_0x99c2('0x8'));var config=require(_0x99c2('0x9'));var jayson=require(_0x99c2('0xa'));var client=jayson['client'][_0x99c2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3dba15,_0x3279e5,_0x297bed){return new BPromise(function(_0x11959c,_0x4490f1){return client[_0x99c2('0xc')](_0x3dba15,_0x297bed)['then'](function(_0x43a141){logger[_0x99c2('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x3279e5,_0x99c2('0xe'));logger[_0x99c2('0xf')](_0x99c2('0x10'),_0x3279e5,'request\x20sent',JSON[_0x99c2('0x11')](_0x43a141));if(_0x43a141[_0x99c2('0x12')]){if(_0x43a141['error']['code']===0x1f4){logger[_0x99c2('0x12')](_0x99c2('0x13'),_0x3279e5,_0x43a141[_0x99c2('0x12')][_0x99c2('0x14')]);return _0x4490f1(_0x43a141[_0x99c2('0x12')][_0x99c2('0x14')]);}logger[_0x99c2('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x3279e5,_0x43a141[_0x99c2('0x12')][_0x99c2('0x14')]);return _0x11959c(_0x43a141[_0x99c2('0x12')][_0x99c2('0x14')]);}else{logger[_0x99c2('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x3279e5,_0x99c2('0xe'));_0x11959c(_0x43a141[_0x99c2('0x15')][_0x99c2('0x14')]);}})[_0x99c2('0x16')](function(_0x13027e){logger[_0x99c2('0x12')](_0x99c2('0x13'),_0x3279e5,_0x13027e);_0x4490f1(_0x13027e);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index cf679c1..7dbb59c 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 _0xb3e4=['../../config/environment','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xb3e4,0x18a));var _0x4b3e=function(_0x53f11c,_0x16669f){_0x53f11c=_0x53f11c-0x0;var _0x11a862=_0xb3e4[_0x53f11c];return _0x11a862;};'use strict';var multer=require(_0x4b3e('0x0'));var util=require('util');var path=require(_0x4b3e('0x1'));var timeout=require(_0x4b3e('0x2'));var express=require('express');var router=express[_0x4b3e('0x3')]();var auth=require(_0x4b3e('0x4'));var interaction=require(_0x4b3e('0x5'));var config=require(_0x4b3e('0x6'));module[_0x4b3e('0x7')]=router; \ No newline at end of file +var _0xc9b0=['../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5c7773,_0x2ef8c2){var _0x536bf0=function(_0x58c8f4){while(--_0x58c8f4){_0x5c7773['push'](_0x5c7773['shift']());}};_0x536bf0(++_0x2ef8c2);}(_0xc9b0,0x14c));var _0x0c9b=function(_0x43675e,_0x1a3824){_0x43675e=_0x43675e-0x0;var _0x3c1f65=_0xc9b0[_0x43675e];return _0x3c1f65;};'use strict';var multer=require(_0x0c9b('0x0'));var util=require(_0x0c9b('0x1'));var path=require(_0x0c9b('0x2'));var timeout=require(_0x0c9b('0x3'));var express=require(_0x0c9b('0x4'));var router=express[_0x0c9b('0x5')]();var auth=require(_0x0c9b('0x6'));var interaction=require(_0x0c9b('0x7'));var config=require(_0x0c9b('0x8'));module[_0x0c9b('0x9')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index c994a13..39b2f17 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 _0xbaf0=['exports','INTEGER'];(function(_0x57f8c0,_0x136cf6){var _0x117f08=function(_0x426cd4){while(--_0x426cd4){_0x57f8c0['push'](_0x57f8c0['shift']());}};_0x117f08(++_0x136cf6);}(_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')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe706=['INTEGER','sequelize','exports'];(function(_0x588aed,_0x165c9c){var _0x40cdc4=function(_0x32e02a){while(--_0x32e02a){_0x588aed['push'](_0x588aed['shift']());}};_0x40cdc4(++_0x165c9c);}(_0xe706,0xa3));var _0x6e70=function(_0x473463,_0x21da73){_0x473463=_0x473463-0x0;var _0x42f406=_0xe706[_0x473463];return _0x42f406;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('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 39abf03..f5355dc 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 _0xb10b=['api','moment','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','../../config/logger'];(function(_0xd67723,_0x1e576f){var _0x53b62b=function(_0x2460a3){while(--_0x2460a3){_0xd67723['push'](_0xd67723['shift']());}};_0x53b62b(++_0x1e576f);}(_0xb10b,0x12a));var _0xbb10=function(_0x1bf57f,_0x255df4){_0x1bf57f=_0x1bf57f-0x0;var _0x23a86b=_0xb10b[_0x1bf57f];return _0x23a86b;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('UserMailQueue',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['UserMailQueue','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','define'];(function(_0x59c713,_0x4f0e08){var _0x103893=function(_0x37210d){while(--_0x37210d){_0x59c713['push'](_0x59c713['shift']());}};_0x103893(++_0x4f0e08);}(_0xb7e7,0x121));var _0x7b7e=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xb7e7[_0xac151d];return _0x111dba;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 226a09d..0f0ee4b 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 _0xd43e=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','UserMailQueue,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring'];(function(_0x39e7ed,_0x599328){var _0x8f9820=function(_0x14a653){while(--_0x14a653){_0x39e7ed['push'](_0x39e7ed['shift']());}};_0x8f9820(++_0x599328);}(_0xd43e,0x88));var _0xed43=function(_0x122a15,_0x1e539a){_0x122a15=_0x122a15-0x0;var _0x44330b=_0xd43e[_0x122a15];return _0x44330b;};'use strict';var _=require(_0xed43('0x0'));var util=require('util');var moment=require(_0xed43('0x1'));var BPromise=require(_0xed43('0x2'));var rs=require(_0xed43('0x3'));var fs=require('fs');var Redis=require(_0xed43('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xed43('0x5'))(_0xed43('0x6'));var config=require(_0xed43('0x7'));var jayson=require(_0xed43('0x8'));var client=jayson['client'][_0xed43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x463645,_0x4875eb,_0x4c3697){return new BPromise(function(_0x58b2b0,_0x3d603f){return client[_0xed43('0xa')](_0x463645,_0x4c3697)[_0xed43('0xb')](function(_0xd39ac0){logger[_0xed43('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x4875eb,_0xed43('0xd'));logger[_0xed43('0xe')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x4875eb,_0xed43('0xd'),JSON[_0xed43('0xf')](_0xd39ac0));if(_0xd39ac0[_0xed43('0x10')]){if(_0xd39ac0['error']['code']===0x1f4){logger[_0xed43('0x10')](_0xed43('0x11'),_0x4875eb,_0xd39ac0['error'][_0xed43('0x12')]);return _0x3d603f(_0xd39ac0[_0xed43('0x10')][_0xed43('0x12')]);}logger[_0xed43('0x10')](_0xed43('0x11'),_0x4875eb,_0xd39ac0[_0xed43('0x10')]['message']);return _0x58b2b0(_0xd39ac0[_0xed43('0x10')]['message']);}else{logger[_0xed43('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x4875eb,_0xed43('0xd'));_0x58b2b0(_0xd39ac0['result']['message']);}})[_0xed43('0x13')](function(_0x572df2){logger[_0xed43('0x10')](_0xed43('0x11'),_0x4875eb,_0x572df2);_0x3d603f(_0x572df2);});});} \ No newline at end of file +var _0x44e8=['UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','debug'];(function(_0x4a0bce,_0x9277c7){var _0x8d5942=function(_0xfa9162){while(--_0xfa9162){_0x4a0bce['push'](_0x4a0bce['shift']());}};_0x8d5942(++_0x9277c7);}(_0x44e8,0xd7));var _0x844e=function(_0x507151,_0x5df25d){_0x507151=_0x507151-0x0;var _0x252394=_0x44e8[_0x507151];return _0x252394;};'use strict';var _=require(_0x844e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x844e('0x1'));var rs=require(_0x844e('0x2'));var fs=require('fs');var Redis=require(_0x844e('0x3'));var db=require(_0x844e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x844e('0x5'))(_0x844e('0x6'));var config=require(_0x844e('0x7'));var jayson=require(_0x844e('0x8'));var client=jayson['client'][_0x844e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x238796,_0x1706b3,_0x11cbd6){return new BPromise(function(_0x571b91,_0x31ab50){return client[_0x844e('0xa')](_0x238796,_0x11cbd6)[_0x844e('0xb')](function(_0x134672){logger[_0x844e('0xc')](_0x844e('0xd'),_0x1706b3,'request\x20sent');logger[_0x844e('0xe')](_0x844e('0xf'),_0x1706b3,_0x844e('0x10'),JSON[_0x844e('0x11')](_0x134672));if(_0x134672[_0x844e('0x12')]){if(_0x134672[_0x844e('0x12')][_0x844e('0x13')]===0x1f4){logger['error'](_0x844e('0xd'),_0x1706b3,_0x134672[_0x844e('0x12')]['message']);return _0x31ab50(_0x134672[_0x844e('0x12')][_0x844e('0x14')]);}logger['error'](_0x844e('0xd'),_0x1706b3,_0x134672[_0x844e('0x12')][_0x844e('0x14')]);return _0x571b91(_0x134672['error'][_0x844e('0x14')]);}else{logger[_0x844e('0xc')](_0x844e('0xd'),_0x1706b3,_0x844e('0x10'));_0x571b91(_0x134672[_0x844e('0x15')][_0x844e('0x14')]);}})[_0x844e('0x16')](function(_0x5506ef){logger['error'](_0x844e('0xd'),_0x1706b3,_0x5506ef);_0x31ab50(_0x5506ef);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index eb37a55..f76ea95 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 _0xa899=['post','isAuthenticated','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2394be,_0x3a0629){var _0x3cba02=function(_0x2592d8){while(--_0x2592d8){_0x2394be['push'](_0x2394be['shift']());}};_0x3cba02(++_0x3a0629);}(_0xa899,0xdf));var _0x9a89=function(_0x386b03,_0x5d0000){_0x386b03=_0x386b03-0x0;var _0xd3d524=_0xa899[_0x386b03];return _0xd3d524;};'use strict';var multer=require(_0x9a89('0x0'));var util=require(_0x9a89('0x1'));var path=require(_0x9a89('0x2'));var timeout=require('connect-timeout');var express=require(_0x9a89('0x3'));var router=express[_0x9a89('0x4')]();var auth=require(_0x9a89('0x5'));var interaction=require(_0x9a89('0x6'));var config=require('../../config/environment');var controller=require('./userNotification.controller');router[_0x9a89('0x7')]('/',auth[_0x9a89('0x8')](),controller['sendUserNotification']);module[_0x9a89('0x9')]=router; \ No newline at end of file +var _0x8759=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','multer','util','path','connect-timeout','express','Router'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8759,0x1da));var _0x9875=function(_0x17c039,_0x1da0de){_0x17c039=_0x17c039-0x0;var _0x169dd0=_0x8759[_0x17c039];return _0x169dd0;};'use strict';var multer=require(_0x9875('0x0'));var util=require(_0x9875('0x1'));var path=require(_0x9875('0x2'));var timeout=require(_0x9875('0x3'));var express=require(_0x9875('0x4'));var router=express[_0x9875('0x5')]();var auth=require(_0x9875('0x6'));var interaction=require(_0x9875('0x7'));var config=require(_0x9875('0x8'));var controller=require(_0x9875('0x9'));router[_0x9875('0xa')]('/',auth[_0x9875('0xb')](),controller['sendUserNotification']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 992ab2f..1e8c948 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 _0xc3d1=['sequelize','exports','TEXT','STRING'];(function(_0x3e6729,_0x16d4af){var _0x535bcd=function(_0x5e6c5f){while(--_0x5e6c5f){_0x3e6729['push'](_0x3e6729['shift']());}};_0x535bcd(++_0x16d4af);}(_0xc3d1,0x128));var _0x1c3d=function(_0x166dcd,_0x1ba118){_0x166dcd=_0x166dcd-0x0;var _0x1731d4=_0xc3d1[_0x166dcd];return _0x1731d4;};'use strict';var Sequelize=require(_0x1c3d('0x0'));module[_0x1c3d('0x1')]={'body':{'type':Sequelize[_0x1c3d('0x2')]},'senderName':{'type':Sequelize[_0x1c3d('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x1c3d('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x0f5c=['TEXT','BOOLEAN','sequelize','exports','STRING'];(function(_0x2eef80,_0x241f70){var _0x4bdd07=function(_0xf6c6db){while(--_0xf6c6db){_0x2eef80['push'](_0x2eef80['shift']());}};_0x4bdd07(++_0x241f70);}(_0x0f5c,0x10b));var _0xc0f5=function(_0x4d7a70,_0x2d3bfa){_0x4d7a70=_0x4d7a70-0x0;var _0x3aafbb=_0x0f5c[_0x4d7a70];return _0x3aafbb;};'use strict';var Sequelize=require(_0xc0f5('0x0'));module[_0xc0f5('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xc0f5('0x2')]},'recipientsId':{'type':Sequelize[_0xc0f5('0x3')]},'recipientsDescription':{'type':Sequelize[_0xc0f5('0x2')]},'beep':{'type':Sequelize[_0xc0f5('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index a6ec48f..3160d36 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 _0x3880=['Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','mailqueue','openchannelqueue','voicequeue','whatsappqueue','team','user','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','recipientsId','join','sequelize','UserNotification','create','forEach','recipient','userNotification:send','catch','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','User','union','ids','replace','queue','Queue','push','all','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./userNotification.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','body','text','hasOwnProperty','TemplateId','Sequelize','ValidationError','view'];(function(_0x282490,_0x1667d6){var _0x5e7f1a=function(_0x37bf58){while(--_0x37bf58){_0x282490['push'](_0x282490['shift']());}};_0x5e7f1a(++_0x1667d6);}(_0x3880,0x14a));var _0x0388=function(_0x3371c4,_0x165ec2){_0x3371c4=_0x3371c4-0x0;var _0x53dc75=_0x3880[_0x3371c4];return _0x53dc75;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0388('0x0'));var rimraf=require(_0x0388('0x1'));var zipdir=require(_0x0388('0x2'));var jsonpatch=require(_0x0388('0x3'));var rp=require(_0x0388('0x4'));var moment=require(_0x0388('0x5'));var BPromise=require(_0x0388('0x6'));var Mustache=require(_0x0388('0x7'));var util=require(_0x0388('0x8'));var path=require(_0x0388('0x9'));var sox=require(_0x0388('0xa'));var csv=require(_0x0388('0xb'));var ejs=require(_0x0388('0xc'));var fs=require('fs');var _=require(_0x0388('0xd'));var squel=require(_0x0388('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0388('0xf'));var toCsv=require(_0x0388('0xb'));var querystring=require(_0x0388('0x10'));var Papa=require(_0x0388('0x11'));var Redis=require(_0x0388('0x12'));var authService=require(_0x0388('0x13'));var qs=require(_0x0388('0x14'));var as=require(_0x0388('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0388('0x16'));var utils=require(_0x0388('0x17'));var config=require(_0x0388('0x18'));var licenseUtil=require(_0x0388('0x19'));var db=require('../../mysqldb')['db'];config[_0x0388('0x1a')]=_[_0x0388('0x1b')](config[_0x0388('0x1a')],{'host':_0x0388('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0388('0x1a')]));require(_0x0388('0x1d'))[_0x0388('0x1e')](socket);function respondWithStatusCode(_0x3c7fa5,_0x529474){_0x529474=_0x529474||0xcc;return function(_0x3f0475){if(_0x3f0475){return _0x3c7fa5[_0x0388('0x1f')](_0x529474);}return _0x3c7fa5[_0x0388('0x20')](_0x529474)['end']();};}function respondWithResult(_0x51ec1e,_0x2d1116){_0x2d1116=_0x2d1116||0xc8;return function(_0x422d1c){if(_0x422d1c){return _0x51ec1e[_0x0388('0x20')](_0x2d1116)[_0x0388('0x21')](_0x422d1c);}};}function respondWithFilteredResult(_0x287942,_0x4c614f){return function(_0x360e11){if(_0x360e11){var _0x106655=_0x360e11[_0x0388('0x22')],_0x6d5285=_0x4c614f[_0x0388('0x23')],_0x337944=_0x4c614f['offset']+_0x4c614f[_0x0388('0x24')],_0x685a17;if(_0x337944>=_0x106655){_0x337944=_0x106655;_0x685a17=0xc8;}else{_0x685a17=0xce;}_0x287942[_0x0388('0x20')](_0x685a17);return _0x287942[_0x0388('0x25')](_0x0388('0x26'),_0x6d5285+'-'+_0x337944+'/'+_0x106655)[_0x0388('0x21')](_0x360e11);}return null;};}function patchUpdates(_0x2906ad){return function(_0x9eab1c){try{jsonpatch[_0x0388('0x27')](_0x9eab1c,_0x2906ad,!![]);}catch(_0xd48f4b){return BPromise[_0x0388('0x28')](_0xd48f4b);}return _0x9eab1c[_0x0388('0x29')]();};}function saveUpdates(_0x1dd0fd,_0x151f4f){return function(_0x1a8199){if(_0x1a8199){return _0x1a8199['update'](_0x1dd0fd)[_0x0388('0x2a')](function(_0x228c04){return _0x228c04;});}return null;};}function removeEntity(_0x11c3f0,_0x1e6c48){return function(_0x36b903){if(_0x36b903){return _0x36b903[_0x0388('0x2b')]()[_0x0388('0x2a')](function(){_0x11c3f0[_0x0388('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x215145,_0x46d323){return function(_0x36070a){if(!_0x36070a){_0x215145['sendStatus'](0x194);}return _0x36070a;};}function handleError(_0x4b6874,_0x4a79d7){_0x4a79d7=_0x4a79d7||0x1f4;return function(_0x3c0e6d){logger[_0x0388('0x2c')](_0x3c0e6d['stack']);if(_0x3c0e6d[_0x0388('0x2d')]){delete _0x3c0e6d[_0x0388('0x2d')];}_0x4b6874[_0x0388('0x20')](_0x4a79d7)[_0x0388('0x2e')](_0x3c0e6d);};}exports['sendUserNotification']=function(_0x5f34a4,_0xadb1af,_0x2e68fd){if(!_0x5f34a4[_0x0388('0x2f')]['hasOwnProperty'](_0x0388('0x30'))&&!_0x5f34a4[_0x0388('0x2f')][_0x0388('0x31')](_0x0388('0x32'))){throw new db[(_0x0388('0x33'))][(_0x0388('0x34'))]('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x5f34a4['body']['hasOwnProperty']('TemplateId')&&!_0x5f34a4[_0x0388('0x2f')]['hasOwnProperty'](_0x0388('0x35'))){throw new db[(_0x0388('0x33'))][(_0x0388('0x34'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x5f34a4[_0x0388('0x2f')][_0x0388('0x31')]('recipients')){throw new db[(_0x0388('0x33'))][(_0x0388('0x34'))](_0x0388('0x36'));}else{try{var _0x29d08e=JSON[_0x0388('0x37')](_0x5f34a4[_0x0388('0x2f')]['recipients']);}catch(_0x181e27){logger[_0x0388('0x2c')](_0x181e27);throw new db[(_0x0388('0x33'))]['ValidationError'](_0x0388('0x38'));}var _0x1a90c5=['chatqueue','faxqueue',_0x0388('0x39'),_0x0388('0x3a'),'smsqueue',_0x0388('0x3b'),_0x0388('0x3c'),_0x0388('0x3d'),_0x0388('0x3e')];if(_['some'](_0x29d08e,function(_0x16ac47){return!_[_0x0388('0x3f')](_0x1a90c5,_0x16ac47[_0x0388('0x40')][_0x0388('0x41')]());})){throw new db[(_0x0388('0x33'))]['ValidationError'](_0x0388('0x42'));}}}var _0x4be091={};_0x4be091[_0x0388('0x43')]=_0x5f34a4[_0x0388('0x2f')][_0x0388('0x31')]('senderName')?_0x5f34a4[_0x0388('0x2f')]['senderName']:_0x5f34a4[_0x0388('0x3e')][_0x0388('0x44')];_0x4be091[_0x0388('0x45')]=_[_0x0388('0x46')](_0x5f34a4[_0x0388('0x2f')][_0x0388('0x45')])?null:_0x5f34a4[_0x0388('0x2f')][_0x0388('0x45')];_0x4be091[_0x0388('0x47')]=_0x5f34a4['body'][_0x0388('0x47')]||![];_0x4be091['SenderId']=_0x5f34a4[_0x0388('0x3e')]['id'];return getContent(_0x5f34a4[_0x0388('0x2f')])[_0x0388('0x2a')](function(_0x56c03f){_0x4be091[_0x0388('0x2f')]=_0x56c03f;return getRecipients(_0x29d08e);})[_0x0388('0x2a')](function(_0x265ea4){_0x4be091[_0x0388('0x48')]=_['sortBy'](_0x265ea4)[_0x0388('0x49')](',');return db[_0x0388('0x4a')]['transaction'](function(_0x26dbbf){return db[_0x0388('0x4b')][_0x0388('0x4c')](_0x4be091,{'raw':!![],'transaction':_0x26dbbf})[_0x0388('0x2a')](function(_0x43a488){var _0x1d2bd7={'sender':_0x4be091[_0x0388('0x43')],'description':_0x4be091[_0x0388('0x45')],'content':_0x4be091['body'],'beep':_0x4be091[_0x0388('0x47')]};_0x265ea4[_0x0388('0x4d')](function(_0x178dee){_0x1d2bd7[_0x0388('0x4e')]=_0x178dee;socket['emit'](_0x0388('0x4f'),_0x1d2bd7);});return _0x43a488;});});})[_0x0388('0x2a')](respondWithResult(_0xadb1af,0xc9))[_0x0388('0x50')](handleError(_0xadb1af,null));};function getContent(_0x238c75){return new BPromise(function(_0x13d750,_0x3dbd61){if(_0x238c75[_0x0388('0x30')]){_0x13d750(_0x238c75['text']);return;}return db[_0x0388('0x51')][_0x0388('0x52')]({'attributes':['html'],'where':{'id':_0x238c75[_0x0388('0x32')]},'raw':!![]})['then'](function(_0x42b828){if(!_0x42b828)throw new db[(_0x0388('0x33'))][(_0x0388('0x34'))](_0x0388('0x53'));var _0x32748d=Mustache[_0x0388('0x54')](_0x42b828[_0x0388('0x55')],_0x238c75['view']);_0x13d750(_0x32748d);})[_0x0388('0x50')](function(_0x339c48){_0x3dbd61(_0x339c48);});});}function getRecipients(_0x219548){return new BPromise(function(_0x16a13f,_0x105947){var _0xd3a595=[];var _0x46b624=[];_0x219548['forEach'](function(_0x38de26){var _0x415908=_['startCase'](_0x38de26[_0x0388('0x40')]['toLowerCase']());if(_0x415908===_0x0388('0x56')){_0xd3a595=_[_0x0388('0x57')](_0xd3a595,_0x38de26[_0x0388('0x58')]);}else{if(_[_0x0388('0x3f')](_0x415908,'queue'))_0x415908=_0x415908[_0x0388('0x59')](_0x0388('0x5a'),_0x0388('0x5b'));_0x38de26[_0x0388('0x58')]['forEach'](function(_0x5ea7b2){_0x46b624[_0x0388('0x5c')](getAgents(_0x415908,_0x5ea7b2));});}});return BPromise[_0x0388('0x5d')](_0x46b624)[_0x0388('0x2a')](function(_0x4ff75d){_0xd3a595=_[_0x0388('0x57')](_0xd3a595,_['flatten'](_0x4ff75d));_0x16a13f(_0xd3a595);})['catch'](function(_0x55557b){_0x105947(_0x55557b);});});}function getAgents(_0x44770d,_0xa068ab){return new BPromise(function(_0xb52363,_0x293207){return db[_0x44770d][_0x0388('0x52')]({'where':{'id':_0xa068ab}})[_0x0388('0x2a')](function(_0x13bd36){return _0x13bd36[_0x0388('0x5e')]({'attributes':['id'],'raw':!![]})[_0x0388('0x2a')](function(_0x356dea){var _0x36c1c1=_[_0x0388('0x5f')](_0x356dea,'id');_0xb52363(_0x36c1c1);});})['catch'](function(_0x4e416f){_0x293207(_0x4e416f);});});} \ No newline at end of file +var _0x86b2=['openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','then','recipientsId','sortBy','join','sequelize','UserNotification','create','forEach','recipient','emit','catch','Template','findOne','html','TemplateId','render','view','startCase','User','union','ids','replace','queue','push','flatten','getAgents','map','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','defaults','redis','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','error','name','send','sendUserNotification','body','hasOwnProperty','text','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','Sequelize','Missing\x20\x27recipients\x27\x20parameter','parse','mailqueue'];(function(_0xd4636c,_0x34dbf6){var _0x5ee17d=function(_0x223c38){while(--_0x223c38){_0xd4636c['push'](_0xd4636c['shift']());}};_0x5ee17d(++_0x34dbf6);}(_0x86b2,0x8f));var _0x286b=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x86b2[_0xb24a3e];return _0x4038d7;};'use strict';var pdf=require(_0x286b('0x0'));var emlformat=require(_0x286b('0x1'));var rimraf=require(_0x286b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x286b('0x3'));var rp=require(_0x286b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x286b('0x5'));var path=require(_0x286b('0x6'));var sox=require(_0x286b('0x7'));var csv=require(_0x286b('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x286b('0x9'));var squel=require('squel');var crypto=require(_0x286b('0xa'));var jsforce=require(_0x286b('0xb'));var deskjs=require(_0x286b('0xc'));var toCsv=require(_0x286b('0x8'));var querystring=require(_0x286b('0xd'));var Papa=require('papaparse');var Redis=require(_0x286b('0xe'));var authService=require(_0x286b('0xf'));var qs=require(_0x286b('0x10'));var as=require(_0x286b('0x11'));var hardwareService=require(_0x286b('0x12'));var logger=require('../../config/logger')(_0x286b('0x13'));var utils=require(_0x286b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x286b('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x286b('0x16')](config[_0x286b('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x286b('0x18'))(new Redis(config[_0x286b('0x17')]));require(_0x286b('0x19'))[_0x286b('0x1a')](socket);function respondWithStatusCode(_0x1dcf4f,_0x2dc260){_0x2dc260=_0x2dc260||0xcc;return function(_0xebec64){if(_0xebec64){return _0x1dcf4f[_0x286b('0x1b')](_0x2dc260);}return _0x1dcf4f[_0x286b('0x1c')](_0x2dc260)[_0x286b('0x1d')]();};}function respondWithResult(_0x415286,_0x2fed22){_0x2fed22=_0x2fed22||0xc8;return function(_0x17c9c8){if(_0x17c9c8){return _0x415286[_0x286b('0x1c')](_0x2fed22)['json'](_0x17c9c8);}};}function respondWithFilteredResult(_0xb33fb0,_0x509b46){return function(_0x23947a){if(_0x23947a){var _0x5527c9=_0x23947a[_0x286b('0x1e')],_0xe79dbc=_0x509b46['offset'],_0x32fd17=_0x509b46[_0x286b('0x1f')]+_0x509b46[_0x286b('0x20')],_0x497eef;if(_0x32fd17>=_0x5527c9){_0x32fd17=_0x5527c9;_0x497eef=0xc8;}else{_0x497eef=0xce;}_0xb33fb0[_0x286b('0x1c')](_0x497eef);return _0xb33fb0['set'](_0x286b('0x21'),_0xe79dbc+'-'+_0x32fd17+'/'+_0x5527c9)[_0x286b('0x22')](_0x23947a);}return null;};}function patchUpdates(_0x5e4efd){return function(_0x25fae1){try{jsonpatch[_0x286b('0x23')](_0x25fae1,_0x5e4efd,!![]);}catch(_0x17ae4e){return BPromise[_0x286b('0x24')](_0x17ae4e);}return _0x25fae1[_0x286b('0x25')]();};}function saveUpdates(_0x52cfb8,_0x2d51ce){return function(_0x23439a){if(_0x23439a){return _0x23439a[_0x286b('0x26')](_0x52cfb8)['then'](function(_0x3a89bb){return _0x3a89bb;});}return null;};}function removeEntity(_0x1921d2,_0x71660a){return function(_0x394a30){if(_0x394a30){return _0x394a30[_0x286b('0x27')]()['then'](function(){_0x1921d2[_0x286b('0x1c')](0xcc)[_0x286b('0x1d')]();});}};}function handleEntityNotFound(_0x32fa74,_0x508354){return function(_0x1eda4e){if(!_0x1eda4e){_0x32fa74[_0x286b('0x1b')](0x194);}return _0x1eda4e;};}function handleError(_0x36caf9,_0x1885a2){_0x1885a2=_0x1885a2||0x1f4;return function(_0x34dbc9){logger[_0x286b('0x28')](_0x34dbc9['stack']);if(_0x34dbc9['name']){delete _0x34dbc9[_0x286b('0x29')];}_0x36caf9[_0x286b('0x1c')](_0x1885a2)[_0x286b('0x2a')](_0x34dbc9);};}exports[_0x286b('0x2b')]=function(_0xe6129b,_0x41aa3d,_0x587fc9){if(!_0xe6129b[_0x286b('0x2c')][_0x286b('0x2d')](_0x286b('0x2e'))&&!_0xe6129b[_0x286b('0x2c')][_0x286b('0x2d')]('TemplateId')){throw new db['Sequelize'][(_0x286b('0x2f'))](_0x286b('0x30'));}else{if(_0xe6129b[_0x286b('0x2c')][_0x286b('0x2d')]('TemplateId')&&!_0xe6129b[_0x286b('0x2c')]['hasOwnProperty']('view')){throw new db['Sequelize']['ValidationError'](_0x286b('0x31'));}if(!_0xe6129b['body'][_0x286b('0x2d')](_0x286b('0x32'))){throw new db[(_0x286b('0x33'))]['ValidationError'](_0x286b('0x34'));}else{try{var _0x3b165b=JSON[_0x286b('0x35')](_0xe6129b['body'][_0x286b('0x32')]);}catch(_0x3b1c93){logger[_0x286b('0x28')](_0x3b1c93);throw new db[(_0x286b('0x33'))][(_0x286b('0x2f'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x4dcad6=['chatqueue','faxqueue',_0x286b('0x36'),_0x286b('0x37'),_0x286b('0x38'),_0x286b('0x39'),_0x286b('0x3a'),_0x286b('0x3b'),_0x286b('0x3c')];if(_[_0x286b('0x3d')](_0x3b165b,function(_0x331afc){return!_[_0x286b('0x3e')](_0x4dcad6,_0x331afc[_0x286b('0x3f')][_0x286b('0x40')]());})){throw new db['Sequelize'][(_0x286b('0x2f'))](_0x286b('0x41'));}}}var _0x2ab349={};_0x2ab349[_0x286b('0x42')]=_0xe6129b[_0x286b('0x2c')][_0x286b('0x2d')]('senderName')?_0xe6129b[_0x286b('0x2c')]['senderName']:_0xe6129b[_0x286b('0x3c')][_0x286b('0x43')];_0x2ab349[_0x286b('0x44')]=_[_0x286b('0x45')](_0xe6129b['body'][_0x286b('0x44')])?null:_0xe6129b[_0x286b('0x2c')][_0x286b('0x44')];_0x2ab349['beep']=_0xe6129b['body'][_0x286b('0x46')]||![];_0x2ab349[_0x286b('0x47')]=_0xe6129b[_0x286b('0x3c')]['id'];return getContent(_0xe6129b[_0x286b('0x2c')])[_0x286b('0x48')](function(_0x37bc85){_0x2ab349['body']=_0x37bc85;return getRecipients(_0x3b165b);})[_0x286b('0x48')](function(_0x1123d6){_0x2ab349[_0x286b('0x49')]=_[_0x286b('0x4a')](_0x1123d6)[_0x286b('0x4b')](',');return db[_0x286b('0x4c')]['transaction'](function(_0x3dc8de){return db[_0x286b('0x4d')][_0x286b('0x4e')](_0x2ab349,{'raw':!![],'transaction':_0x3dc8de})[_0x286b('0x48')](function(_0x16d28f){var _0x2a54b9={'sender':_0x2ab349[_0x286b('0x42')],'description':_0x2ab349['recipientsDescription'],'content':_0x2ab349[_0x286b('0x2c')],'beep':_0x2ab349[_0x286b('0x46')]};_0x1123d6[_0x286b('0x4f')](function(_0x37f7ed){_0x2a54b9[_0x286b('0x50')]=_0x37f7ed;socket[_0x286b('0x51')]('userNotification:send',_0x2a54b9);});return _0x16d28f;});});})[_0x286b('0x48')](respondWithResult(_0x41aa3d,0xc9))[_0x286b('0x52')](handleError(_0x41aa3d,null));};function getContent(_0x529099){return new BPromise(function(_0x20b8fe,_0x4d3815){if(_0x529099[_0x286b('0x2e')]){_0x20b8fe(_0x529099['text']);return;}return db[_0x286b('0x53')][_0x286b('0x54')]({'attributes':[_0x286b('0x55')],'where':{'id':_0x529099[_0x286b('0x56')]},'raw':!![]})[_0x286b('0x48')](function(_0x2993c5){if(!_0x2993c5)throw new db['Sequelize'][(_0x286b('0x2f'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x4799cc=Mustache[_0x286b('0x57')](_0x2993c5[_0x286b('0x55')],_0x529099[_0x286b('0x58')]);_0x20b8fe(_0x4799cc);})[_0x286b('0x52')](function(_0xf5c679){_0x4d3815(_0xf5c679);});});}function getRecipients(_0x162231){return new BPromise(function(_0x22c5b7,_0x287334){var _0x529ad4=[];var _0x3d81cb=[];_0x162231[_0x286b('0x4f')](function(_0x130c65){var _0x7cf819=_[_0x286b('0x59')](_0x130c65[_0x286b('0x3f')][_0x286b('0x40')]());if(_0x7cf819===_0x286b('0x5a')){_0x529ad4=_[_0x286b('0x5b')](_0x529ad4,_0x130c65[_0x286b('0x5c')]);}else{if(_[_0x286b('0x3e')](_0x7cf819,'queue'))_0x7cf819=_0x7cf819[_0x286b('0x5d')](_0x286b('0x5e'),'Queue');_0x130c65[_0x286b('0x5c')][_0x286b('0x4f')](function(_0x3ad0ec){_0x3d81cb[_0x286b('0x5f')](getAgents(_0x7cf819,_0x3ad0ec));});}});return BPromise['all'](_0x3d81cb)[_0x286b('0x48')](function(_0x48f8de){_0x529ad4=_['union'](_0x529ad4,_[_0x286b('0x60')](_0x48f8de));_0x22c5b7(_0x529ad4);})['catch'](function(_0x2c47b4){_0x287334(_0x2c47b4);});});}function getAgents(_0x274281,_0x339faf){return new BPromise(function(_0x50f2ee,_0x415e71){return db[_0x274281][_0x286b('0x54')]({'where':{'id':_0x339faf}})[_0x286b('0x48')](function(_0x232726){return _0x232726[_0x286b('0x61')]({'attributes':['id'],'raw':!![]})['then'](function(_0x329653){var _0x268a0f=_[_0x286b('0x62')](_0x329653,'id');_0x50f2ee(_0x268a0f);});})[_0x286b('0x52')](function(_0x2b4828){_0x415e71(_0x2b4828);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index dc51347..87d174b 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 _0x5ad3=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x24a445,_0xd33d2){var _0x426c5d=function(_0x190c2c){while(--_0x190c2c){_0x24a445['push'](_0x24a445['shift']());}};_0x426c5d(++_0xd33d2);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5ad3[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0x35ad('0x0'));var UserNotification=require(_0x35ad('0x1'))['db'][_0x35ad('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x35ad('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x35ad('0x4'),'afterDestroy':_0x35ad('0x5')};function emitEvent(_0xc77352){return function(_0x69a0b3,_0x450f55,_0x1fed0d){UserNotificationEvents[_0x35ad('0x6')](_0xc77352+':'+_0x69a0b3['id'],_0x69a0b3);UserNotificationEvents[_0x35ad('0x6')](_0xc77352,_0x69a0b3);_0x1fed0d(null);};}for(var e in events){if(events[_0x35ad('0x7')](e)){var event=events[e];UserNotification[_0x35ad('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x68fc=['update','emit','hasOwnProperty','events','../../mysqldb','UserNotification'];(function(_0x509771,_0x3b6a5d){var _0x1ed8fe=function(_0x23d971){while(--_0x23d971){_0x509771['push'](_0x509771['shift']());}};_0x1ed8fe(++_0x3b6a5d);}(_0x68fc,0xa5));var _0xc68f=function(_0x25710e,_0x44491b){_0x25710e=_0x25710e-0x0;var _0x4ebdf2=_0x68fc[_0x25710e];return _0x4ebdf2;};'use strict';var EventEmitter=require(_0xc68f('0x0'));var UserNotification=require(_0xc68f('0x1'))['db'][_0xc68f('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc68f('0x3'),'afterDestroy':'remove'};function emitEvent(_0xe70787){return function(_0x593648,_0x5899ea,_0x3b2744){UserNotificationEvents[_0xc68f('0x4')](_0xe70787+':'+_0x593648['id'],_0x593648);UserNotificationEvents[_0xc68f('0x4')](_0xe70787,_0x593648);_0x3b2744(null);};}for(var e in events){if(events[_0xc68f('0x5')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index d74bc5f..935911f 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 _0x1cc3=['userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','path','../../config/environment','./userNotification.attributes','exports','define','UserNotification'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x1cc3,0x11b));var _0x31cc=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x1cc3[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x31cc('0x0'));var util=require(_0x31cc('0x1'));var logger=require('../../config/logger')(_0x31cc('0x2'));var moment=require('moment');var BPromise=require(_0x31cc('0x3'));var rp=require(_0x31cc('0x4'));var fs=require('fs');var path=require(_0x31cc('0x5'));var rimraf=require('rimraf');var config=require(_0x31cc('0x6'));var attributes=require(_0x31cc('0x7'));module[_0x31cc('0x8')]=function(_0x541da0,_0xc7ae44){return _0x541da0[_0x31cc('0x9')](_0x31cc('0xa'),attributes,{'tableName':_0x31cc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x31cc('0xc'),'collate':_0x31cc('0xd')});}; \ No newline at end of file +var _0x91b6=['exports','define','UserNotification','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','request-promise','path','rimraf','../../config/environment','./userNotification.attributes'];(function(_0x4bc738,_0x42db79){var _0x34e23e=function(_0x18a7d8){while(--_0x18a7d8){_0x4bc738['push'](_0x4bc738['shift']());}};_0x34e23e(++_0x42db79);}(_0x91b6,0x18b));var _0x691b=function(_0x2e12a6,_0x28269e){_0x2e12a6=_0x2e12a6-0x0;var _0x45d137=_0x91b6[_0x2e12a6];return _0x45d137;};'use strict';var _=require(_0x691b('0x0'));var util=require(_0x691b('0x1'));var logger=require('../../config/logger')(_0x691b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x691b('0x3'));var fs=require('fs');var path=require(_0x691b('0x4'));var rimraf=require(_0x691b('0x5'));var config=require(_0x691b('0x6'));var attributes=require(_0x691b('0x7'));module[_0x691b('0x8')]=function(_0x585420,_0x5586b9){return _0x585420[_0x691b('0x9')](_0x691b('0xa'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x691b('0xb'),'collate':_0x691b('0xc')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 799f25d..7e683cb 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 _0x8def=['result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x98cb08,_0x3212b4){var _0x23473c=function(_0x4074f1){while(--_0x4074f1){_0x98cb08['push'](_0x98cb08['shift']());}};_0x23473c(++_0x3212b4);}(_0x8def,0x17a));var _0xf8de=function(_0xe5e2a2,_0x351da6){_0xe5e2a2=_0xe5e2a2-0x0;var _0x29f668=_0x8def[_0xe5e2a2];return _0x29f668;};'use strict';var _=require(_0xf8de('0x0'));var util=require(_0xf8de('0x1'));var moment=require(_0xf8de('0x2'));var BPromise=require(_0xf8de('0x3'));var rs=require(_0xf8de('0x4'));var fs=require('fs');var Redis=require(_0xf8de('0x5'));var db=require(_0xf8de('0x6'))['db'];var utils=require(_0xf8de('0x7'));var logger=require(_0xf8de('0x8'))(_0xf8de('0x9'));var config=require(_0xf8de('0xa'));var jayson=require(_0xf8de('0xb'));var client=jayson['client'][_0xf8de('0xc')]({'port':0x232a});config[_0xf8de('0xd')]=_[_0xf8de('0xe')](config[_0xf8de('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xf8de('0xf'))(new Redis(config[_0xf8de('0xd')]));require('./userNotification.socket')[_0xf8de('0x10')](socket);function respondWithRpcPromise(_0x3126d2,_0x542968,_0x79606d){return new BPromise(function(_0x1009f0,_0x4529ee){return client[_0xf8de('0x11')](_0x3126d2,_0x79606d)[_0xf8de('0x12')](function(_0x543b13){logger[_0xf8de('0x13')](_0xf8de('0x14'),_0x542968,_0xf8de('0x15'));logger[_0xf8de('0x16')](_0xf8de('0x17'),_0x542968,'request\x20sent',JSON[_0xf8de('0x18')](_0x543b13));if(_0x543b13[_0xf8de('0x19')]){if(_0x543b13[_0xf8de('0x19')][_0xf8de('0x1a')]===0x1f4){logger[_0xf8de('0x19')](_0xf8de('0x14'),_0x542968,_0x543b13[_0xf8de('0x19')][_0xf8de('0x1b')]);return _0x4529ee(_0x543b13['error'][_0xf8de('0x1b')]);}logger[_0xf8de('0x19')]('UserNotification,\x20%s,\x20%s',_0x542968,_0x543b13[_0xf8de('0x19')][_0xf8de('0x1b')]);return _0x1009f0(_0x543b13[_0xf8de('0x19')][_0xf8de('0x1b')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x542968,_0xf8de('0x15'));_0x1009f0(_0x543b13[_0xf8de('0x1c')][_0xf8de('0x1b')]);}})['catch'](function(_0x4b14b8){logger[_0xf8de('0x19')](_0xf8de('0x14'),_0x542968,_0x4b14b8);_0x4529ee(_0x4b14b8);});});} \ No newline at end of file +var _0xcf45=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','util'];(function(_0x1c9d36,_0x39911a){var _0x3e1bbe=function(_0x2c4013){while(--_0x2c4013){_0x1c9d36['push'](_0x1c9d36['shift']());}};_0x3e1bbe(++_0x39911a);}(_0xcf45,0xf2));var _0x5cf4=function(_0x477ea7,_0x35a8a7){_0x477ea7=_0x477ea7-0x0;var _0x96df16=_0xcf45[_0x477ea7];return _0x96df16;};'use strict';var _=require('lodash');var util=require(_0x5cf4('0x0'));var moment=require(_0x5cf4('0x1'));var BPromise=require('bluebird');var rs=require(_0x5cf4('0x2'));var fs=require('fs');var Redis=require(_0x5cf4('0x3'));var db=require(_0x5cf4('0x4'))['db'];var utils=require(_0x5cf4('0x5'));var logger=require(_0x5cf4('0x6'))(_0x5cf4('0x7'));var config=require(_0x5cf4('0x8'));var jayson=require(_0x5cf4('0x9'));var client=jayson['client'][_0x5cf4('0xa')]({'port':0x232a});config[_0x5cf4('0xb')]=_[_0x5cf4('0xc')](config[_0x5cf4('0xb')],{'host':_0x5cf4('0xd'),'port':0x18eb});var socket=require(_0x5cf4('0xe'))(new Redis(config['redis']));require('./userNotification.socket')[_0x5cf4('0xf')](socket);function respondWithRpcPromise(_0x14f17f,_0x169966,_0x304e2a){return new BPromise(function(_0x50418f,_0x44c9f0){return client[_0x5cf4('0x10')](_0x14f17f,_0x304e2a)['then'](function(_0x3bff04){logger[_0x5cf4('0x11')](_0x5cf4('0x12'),_0x169966,'request\x20sent');logger[_0x5cf4('0x13')](_0x5cf4('0x14'),_0x169966,'request\x20sent',JSON[_0x5cf4('0x15')](_0x3bff04));if(_0x3bff04[_0x5cf4('0x16')]){if(_0x3bff04[_0x5cf4('0x16')][_0x5cf4('0x17')]===0x1f4){logger['error'](_0x5cf4('0x12'),_0x169966,_0x3bff04[_0x5cf4('0x16')][_0x5cf4('0x18')]);return _0x44c9f0(_0x3bff04[_0x5cf4('0x16')][_0x5cf4('0x18')]);}logger[_0x5cf4('0x16')](_0x5cf4('0x12'),_0x169966,_0x3bff04[_0x5cf4('0x16')][_0x5cf4('0x18')]);return _0x50418f(_0x3bff04[_0x5cf4('0x16')][_0x5cf4('0x18')]);}else{logger[_0x5cf4('0x11')](_0x5cf4('0x12'),_0x169966,_0x5cf4('0x19'));_0x50418f(_0x3bff04[_0x5cf4('0x1a')][_0x5cf4('0x18')]);}})['catch'](function(_0x2076ce){logger[_0x5cf4('0x16')]('UserNotification,\x20%s,\x20%s',_0x169966,_0x2076ce);_0x44c9f0(_0x2076ce);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 1c21918..95aaff1 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 _0xf966=['remove','removeListener','length','userNotification:','./userNotification.events','save'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0xf966,0x184));var _0x6f96=function(_0x4f09b2,_0x175cd2){_0x4f09b2=_0x4f09b2-0x0;var _0x10233e=_0xf966[_0x4f09b2];return _0x10233e;};'use strict';var UserNotificationEvents=require(_0x6f96('0x0'));var events=[_0x6f96('0x1'),_0x6f96('0x2'),'update'];function createListener(_0x452aad,_0x154716){return function(_0x22fbb3){_0x154716['emit'](_0x452aad,_0x22fbb3);};}function removeListener(_0x1820d1,_0x33a4e6){return function(){UserNotificationEvents[_0x6f96('0x3')](_0x1820d1,_0x33a4e6);};}exports['register']=function(_0x19f355){for(var _0x34284f=0x0,_0x652db3=events[_0x6f96('0x4')];_0x34284f<_0x652db3;_0x34284f++){var _0x2e62e6=events[_0x34284f];var _0x663c1f=createListener(_0x6f96('0x5')+_0x2e62e6,_0x19f355);UserNotificationEvents['on'](_0x2e62e6,_0x663c1f);}}; \ No newline at end of file +var _0xd5b2=['emit','length','save','remove'];(function(_0x5385b6,_0xbd4587){var _0x2dfff6=function(_0x2185fa){while(--_0x2185fa){_0x5385b6['push'](_0x5385b6['shift']());}};_0x2dfff6(++_0xbd4587);}(_0xd5b2,0x10e));var _0x2d5b=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xd5b2[_0x55f8b4];return _0x2475f9;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x2d5b('0x0'),_0x2d5b('0x1'),'update'];function createListener(_0x42b9d5,_0x2f54e1){return function(_0x457ace){_0x2f54e1[_0x2d5b('0x2')](_0x42b9d5,_0x457ace);};}function removeListener(_0x5c31d3,_0x39ef3){return function(){UserNotificationEvents['removeListener'](_0x5c31d3,_0x39ef3);};}exports['register']=function(_0x58cff9){for(var _0x2e1867=0x0,_0x5e2a74=events[_0x2d5b('0x3')];_0x2e1867<_0x5e2a74;_0x2e1867++){var _0x4c7873=events[_0x2e1867];var _0x1c2150=createListener('userNotification:'+_0x4c7873,_0x58cff9);UserNotificationEvents['on'](_0x4c7873,_0x1c2150);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index a5d8f96..f5fcb5e 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 _0x4e75=['../../components/interaction/service','multer','express','Router','../../components/auth/service'];(function(_0x460386,_0x553ec4){var _0x326666=function(_0x1bb173){while(--_0x1bb173){_0x460386['push'](_0x460386['shift']());}};_0x326666(++_0x553ec4);}(_0x4e75,0xc9));var _0x54e7=function(_0x1bbce9,_0x42c497){_0x1bbce9=_0x1bbce9-0x0;var _0x471f42=_0x4e75[_0x1bbce9];return _0x471f42;};'use strict';var multer=require(_0x54e7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x54e7('0x1'));var router=express[_0x54e7('0x2')]();var auth=require(_0x54e7('0x3'));var interaction=require(_0x54e7('0x4'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x02e4=['../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x02e4,0x1a7));var _0x402e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x02e4[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x402e('0x0'));var util=require(_0x402e('0x1'));var path=require(_0x402e('0x2'));var timeout=require(_0x402e('0x3'));var express=require(_0x402e('0x4'));var router=express[_0x402e('0x5')]();var auth=require(_0x402e('0x6'));var interaction=require(_0x402e('0x7'));var config=require(_0x402e('0x8'));module[_0x402e('0x9')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 5502784..b729692 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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x224c11,_0x4a94c7){var _0x2e8835=function(_0x4335e4){while(--_0x4335e4){_0x224c11['push'](_0x224c11['shift']());}};_0x2e8835(++_0x4a94c7);}(_0xe706,0xa3));var _0x6e70=function(_0x1fb9d2,_0x57a208){_0x1fb9d2=_0x1fb9d2-0x0;var _0x4a8916=_0xe706[_0x1fb9d2];return _0x4a8916;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x16b51e,_0x30cb17){var _0x27b91a=function(_0x131411){while(--_0x131411){_0x16b51e['push'](_0x16b51e['shift']());}};_0x27b91a(++_0x30cb17);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'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 31903bf..e2808d3 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 _0x1d7c=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','lodash','util'];(function(_0x5f0ff7,_0x7c04c1){var _0x40c25e=function(_0x356de9){while(--_0x356de9){_0x5f0ff7['push'](_0x5f0ff7['shift']());}};_0x40c25e(++_0x7c04c1);}(_0x1d7c,0x166));var _0xc1d7=function(_0x2d259a,_0x31068e){_0x2d259a=_0x2d259a-0x0;var _0x16f9d5=_0x1d7c[_0x2d259a];return _0x16f9d5;};'use strict';var _=require(_0xc1d7('0x0'));var util=require(_0xc1d7('0x1'));var logger=require(_0xc1d7('0x2'))('api');var moment=require(_0xc1d7('0x3'));var BPromise=require(_0xc1d7('0x4'));var rp=require(_0xc1d7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc1d7('0x6'));var config=require(_0xc1d7('0x7'));var attributes=require(_0xc1d7('0x8'));module[_0xc1d7('0x9')]=function(_0xda5f67,_0x125799){return _0xda5f67[_0xc1d7('0xa')](_0xc1d7('0xb'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b03=['./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment'];(function(_0x4d77d0,_0x2f91a0){var _0x2f4699=function(_0x4dcc6c){while(--_0x4dcc6c){_0x4d77d0['push'](_0x4d77d0['shift']());}};_0x2f4699(++_0x2f91a0);}(_0x3b03,0xf4));var _0x33b0=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x3b03[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x33b0('0x0'));var util=require('util');var logger=require(_0x33b0('0x1'))('api');var moment=require(_0x33b0('0x2'));var BPromise=require('bluebird');var rp=require(_0x33b0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x33b0('0x4'));var config=require(_0x33b0('0x5'));var attributes=require(_0x33b0('0x6'));module['exports']=function(_0x53f737,_0x4d5b88){return _0x53f737[_0x33b0('0x7')](_0x33b0('0x8'),attributes,{'tableName':_0x33b0('0x9'),'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 bdbeb77..45ec290 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 _0xddca=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','then','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','info','catch','lodash','util','moment'];(function(_0x302a84,_0xfaf37c){var _0x28ef60=function(_0x3981e8){while(--_0x3981e8){_0x302a84['push'](_0x302a84['shift']());}};_0x28ef60(++_0xfaf37c);}(_0xddca,0x18c));var _0xaddc=function(_0x58cf87,_0x3d57cb){_0x58cf87=_0x58cf87-0x0;var _0x5f2e3f=_0xddca[_0x58cf87];return _0x5f2e3f;};'use strict';var _=require(_0xaddc('0x0'));var util=require(_0xaddc('0x1'));var moment=require(_0xaddc('0x2'));var BPromise=require(_0xaddc('0x3'));var rs=require(_0xaddc('0x4'));var fs=require('fs');var Redis=require(_0xaddc('0x5'));var db=require(_0xaddc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xaddc('0x7'))(_0xaddc('0x8'));var config=require('../../config/environment');var jayson=require(_0xaddc('0x9'));var client=jayson[_0xaddc('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50a22d,_0x3dea47,_0x4aac15){return new BPromise(function(_0x28afac,_0x2fd0e6){return client['request'](_0x50a22d,_0x4aac15)[_0xaddc('0xb')](function(_0x2a243e){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x3dea47,_0xaddc('0xc'));logger['debug'](_0xaddc('0xd'),_0x3dea47,'request\x20sent',JSON[_0xaddc('0xe')](_0x2a243e));if(_0x2a243e['error']){if(_0x2a243e[_0xaddc('0xf')][_0xaddc('0x10')]===0x1f4){logger['error'](_0xaddc('0x11'),_0x3dea47,_0x2a243e[_0xaddc('0xf')][_0xaddc('0x12')]);return _0x2fd0e6(_0x2a243e['error']['message']);}logger[_0xaddc('0xf')](_0xaddc('0x11'),_0x3dea47,_0x2a243e[_0xaddc('0xf')][_0xaddc('0x12')]);return _0x28afac(_0x2a243e['error'][_0xaddc('0x12')]);}else{logger[_0xaddc('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x3dea47,'request\x20sent');_0x28afac(_0x2a243e['result'][_0xaddc('0x12')]);}})[_0xaddc('0x14')](function(_0x18c90a){logger['error'](_0xaddc('0x11'),_0x3dea47,_0x18c90a);_0x2fd0e6(_0x18c90a);});});} \ No newline at end of file +var _0xd41b=['debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x258245,_0x3c2c23){var _0x3b82fe=function(_0x3a96fe){while(--_0x3a96fe){_0x258245['push'](_0x258245['shift']());}};_0x3b82fe(++_0x3c2c23);}(_0xd41b,0x7a));var _0xbd41=function(_0x356d95,_0x2d5451){_0x356d95=_0x356d95-0x0;var _0xe1883a=_0xd41b[_0x356d95];return _0xe1883a;};'use strict';var _=require(_0xbd41('0x0'));var util=require(_0xbd41('0x1'));var moment=require(_0xbd41('0x2'));var BPromise=require(_0xbd41('0x3'));var rs=require(_0xbd41('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbd41('0x5'));var logger=require(_0xbd41('0x6'))('rpc');var config=require(_0xbd41('0x7'));var jayson=require(_0xbd41('0x8'));var client=jayson[_0xbd41('0x9')][_0xbd41('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf502e9,_0x49cc58,_0x1aacb0){return new BPromise(function(_0x477c92,_0x21a160){return client[_0xbd41('0xb')](_0xf502e9,_0x1aacb0)[_0xbd41('0xc')](function(_0x125163){logger[_0xbd41('0xd')](_0xbd41('0xe'),_0x49cc58,_0xbd41('0xf'));logger[_0xbd41('0x10')](_0xbd41('0x11'),_0x49cc58,_0xbd41('0xf'),JSON[_0xbd41('0x12')](_0x125163));if(_0x125163[_0xbd41('0x13')]){if(_0x125163['error'][_0xbd41('0x14')]===0x1f4){logger['error'](_0xbd41('0xe'),_0x49cc58,_0x125163['error'][_0xbd41('0x15')]);return _0x21a160(_0x125163['error'][_0xbd41('0x15')]);}logger['error'](_0xbd41('0xe'),_0x49cc58,_0x125163[_0xbd41('0x13')]['message']);return _0x477c92(_0x125163[_0xbd41('0x13')][_0xbd41('0x15')]);}else{logger[_0xbd41('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x49cc58,'request\x20sent');_0x477c92(_0x125163[_0xbd41('0x16')][_0xbd41('0x15')]);}})['catch'](function(_0x1a702d){logger[_0xbd41('0x13')](_0xbd41('0xe'),_0x49cc58,_0x1a702d);_0x21a160(_0x1a702d);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 4a7cde8..07f43a0 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 _0x23f9=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','addSections','addResources','put','update','delete','destroy','removeResources','exports'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x23f9,0x196));var _0x923f=function(_0x1b87cf,_0x9b5f31){_0x1b87cf=_0x1b87cf-0x0;var _0x48ac68=_0x23f9[_0x1b87cf];return _0x48ac68;};'use strict';var multer=require(_0x923f('0x0'));var util=require('util');var path=require(_0x923f('0x1'));var timeout=require(_0x923f('0x2'));var express=require(_0x923f('0x3'));var router=express[_0x923f('0x4')]();var auth=require(_0x923f('0x5'));var interaction=require(_0x923f('0x6'));var config=require('../../config/environment');var controller=require(_0x923f('0x7'));router[_0x923f('0x8')]('/',auth[_0x923f('0x9')](),controller[_0x923f('0xa')]);router[_0x923f('0x8')](_0x923f('0xb'),auth[_0x923f('0x9')](),controller['describe']);router['get'](_0x923f('0xc'),auth[_0x923f('0x9')](),controller[_0x923f('0xd')]);router['get'](_0x923f('0xe'),auth['isAuthenticated'](),controller[_0x923f('0xf')]);router[_0x923f('0x8')](_0x923f('0x10'),auth[_0x923f('0x9')](),controller[_0x923f('0x11')]);router[_0x923f('0x12')]('/',auth[_0x923f('0x9')](),controller[_0x923f('0x13')]);router['post'](_0x923f('0x14'),auth[_0x923f('0x9')](),controller['clone']);router[_0x923f('0x12')](_0x923f('0xe'),auth[_0x923f('0x9')](),controller[_0x923f('0x15')]);router[_0x923f('0x12')](_0x923f('0x10'),auth[_0x923f('0x9')](),controller[_0x923f('0x16')]);router[_0x923f('0x17')]('/:id',auth[_0x923f('0x9')](),controller[_0x923f('0x18')]);router[_0x923f('0x19')](_0x923f('0xc'),auth['isAuthenticated'](),controller[_0x923f('0x1a')]);router[_0x923f('0x19')](_0x923f('0xe'),auth[_0x923f('0x9')](),controller['removeSections']);router[_0x923f('0x19')](_0x923f('0x10'),auth[_0x923f('0x9')](),controller[_0x923f('0x1b')]);module[_0x923f('0x1c')]=router; \ No newline at end of file +var _0xcfa4=['util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/describe','describe','/:id','get','/:id/sections','getSections','/:id/resources','getResources','post','/:id/clone','clone','addSections','update','delete','destroy','removeSections','removeResources','exports'];(function(_0x3207ed,_0x318402){var _0x1c74db=function(_0x2c9666){while(--_0x2c9666){_0x3207ed['push'](_0x3207ed['shift']());}};_0x1c74db(++_0x318402);}(_0xcfa4,0x1a0));var _0x4cfa=function(_0x4c0976,_0xb3b94){_0x4c0976=_0x4c0976-0x0;var _0x3a2f24=_0xcfa4[_0x4c0976];return _0x3a2f24;};'use strict';var multer=require('multer');var util=require(_0x4cfa('0x0'));var path=require(_0x4cfa('0x1'));var timeout=require('connect-timeout');var express=require(_0x4cfa('0x2'));var router=express['Router']();var auth=require(_0x4cfa('0x3'));var interaction=require(_0x4cfa('0x4'));var config=require(_0x4cfa('0x5'));var controller=require('./userProfile.controller');router['get']('/',auth[_0x4cfa('0x6')](),controller[_0x4cfa('0x7')]);router['get'](_0x4cfa('0x8'),auth[_0x4cfa('0x6')](),controller[_0x4cfa('0x9')]);router['get'](_0x4cfa('0xa'),auth[_0x4cfa('0x6')](),controller['show']);router[_0x4cfa('0xb')](_0x4cfa('0xc'),auth['isAuthenticated'](),controller[_0x4cfa('0xd')]);router['get'](_0x4cfa('0xe'),auth[_0x4cfa('0x6')](),controller[_0x4cfa('0xf')]);router['post']('/',auth[_0x4cfa('0x6')](),controller['create']);router[_0x4cfa('0x10')](_0x4cfa('0x11'),auth[_0x4cfa('0x6')](),controller[_0x4cfa('0x12')]);router[_0x4cfa('0x10')](_0x4cfa('0xc'),auth['isAuthenticated'](),controller[_0x4cfa('0x13')]);router[_0x4cfa('0x10')](_0x4cfa('0xe'),auth[_0x4cfa('0x6')](),controller['addResources']);router['put'](_0x4cfa('0xa'),auth[_0x4cfa('0x6')](),controller[_0x4cfa('0x14')]);router[_0x4cfa('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x4cfa('0x16')]);router[_0x4cfa('0x15')](_0x4cfa('0xc'),auth[_0x4cfa('0x6')](),controller[_0x4cfa('0x17')]);router['delete'](_0x4cfa('0xe'),auth[_0x4cfa('0x6')](),controller[_0x4cfa('0x18')]);module[_0x4cfa('0x19')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 7a5baa4..3eab9b3 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 _0x6124=['sequelize','exports','STRING','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x3d17ae,_0x452be3){var _0x54fac8=function(_0x480bec){while(--_0x480bec){_0x3d17ae['push'](_0x3d17ae['shift']());}};_0x54fac8(++_0x452be3);}(_0x6124,0x140));var _0x4612=function(_0x14d8d1,_0x3e4e33){_0x14d8d1=_0x14d8d1-0x0;var _0x44bbb5=_0x6124[_0x14d8d1];return _0x44bbb5;};'use strict';var Sequelize=require(_0x4612('0x0'));module[_0x4612('0x1')]={'name':{'type':Sequelize[_0x4612('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x4612('0x2')],'set':function(_0x75f2e){this[_0x4612('0x3')](_0x4612('0x4'),_0x75f2e?_0x75f2e[_0x4612('0x5')](''):[]);},'get':function(){return this[_0x4612('0x6')](_0x4612('0x4'))?this['getDataValue'](_0x4612('0x4'))[_0x4612('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x4612('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x2e2a=['crudPermissions','join','getDataValue','exports','STRING','name'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0x2e2a,0x1b3));var _0xa2e2=function(_0x41f59e,_0x5e916a){_0x41f59e=_0x41f59e-0x0;var _0x1d5e3=_0x2e2a[_0x41f59e];return _0x1d5e3;};'use strict';var Sequelize=require('sequelize');module[_0xa2e2('0x0')]={'name':{'type':Sequelize[_0xa2e2('0x1')],'allowNull':![],'unique':_0xa2e2('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x3a2442){this['setDataValue'](_0xa2e2('0x3'),_0x3a2442?_0x3a2442[_0xa2e2('0x4')](''):[]);},'get':function(){return this[_0xa2e2('0x5')](_0xa2e2('0x3'))?this[_0xa2e2('0x5')](_0xa2e2('0x3'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xa2e2('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 38b816e..b97ed7a 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 _0xd70e=['rows','show','params','length','includeAll','merge','find','create','body','catch','clone','omit','createdAt','updatedAt','crudPermissions','sequelize','get','UserProfileSection','each','autoAssociation','sectionId','Resources','update','describe','userProfileId','UserProfileResource','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','push','forEach','resourceId','Plugin','addResources','transaction','bulkCreate','removeResources','getResources','section','Sequelize','ValidationError','Unknown\x20section','mergeResources','childModel','undefined','Invalid\x20section\x20\x27','parentSections','findOne','all','ignore','union','pick','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','DefaultReports','CustomReports','CmContact','Tag','Tags','tag','ThroughTags','value','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','JscriptyProject','contacts','Lists','lists','CmList','companies','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','FaxAccount','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','Telephones','User','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','smsqueues','SmsQueue','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','Pause','scheduler','Schedule','sounds','tags','templates','Trigger','trunks','Trunk','variables','Variable','extractedreports','Reports','metrics','AnalyticMetric','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','options','include','findAll'];(function(_0x1089fb,_0x2a412d){var _0x5deb2a=function(_0x4c3b10){while(--_0x4c3b10){_0x1089fb['push'](_0x1089fb['shift']());}};_0x5deb2a(++_0x2a412d);}(_0xd70e,0x1a2));var _0xed70=function(_0x32abfe,_0x1f5bae){_0x32abfe=_0x32abfe-0x0;var _0x22f64f=_0xd70e[_0x32abfe];return _0x22f64f;};'use strict';var pdf=require(_0xed70('0x0'));var emlformat=require(_0xed70('0x1'));var rimraf=require(_0xed70('0x2'));var zipdir=require(_0xed70('0x3'));var jsonpatch=require(_0xed70('0x4'));var rp=require('request-promise');var moment=require(_0xed70('0x5'));var BPromise=require(_0xed70('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xed70('0x7'));var sox=require(_0xed70('0x8'));var csv=require(_0xed70('0x9'));var ejs=require(_0xed70('0xa'));var fs=require('fs');var _=require(_0xed70('0xb'));var squel=require(_0xed70('0xc'));var crypto=require(_0xed70('0xd'));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(_0xed70('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xed70('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xed70('0x10'));var logger=require(_0xed70('0x11'))(_0xed70('0x12'));var utils=require(_0xed70('0x13'));var config=require(_0xed70('0x14'));var licenseUtil=require(_0xed70('0x15'));var db=require(_0xed70('0x16'))['db'];config[_0xed70('0x17')]=_[_0xed70('0x18')](config['redis'],{'host':_0xed70('0x19'),'port':0x18eb});var socket=require(_0xed70('0x1a'))(new Redis(config[_0xed70('0x17')]));require(_0xed70('0x1b'))[_0xed70('0x1c')](socket);function respondWithStatusCode(_0x4d14c4,_0x25acc3){_0x25acc3=_0x25acc3||0xcc;return function(_0xc701df){if(_0xc701df){return _0x4d14c4[_0xed70('0x1d')](_0x25acc3);}return _0x4d14c4['status'](_0x25acc3)[_0xed70('0x1e')]();};}function respondWithResult(_0x2618a0,_0x550371){_0x550371=_0x550371||0xc8;return function(_0x5170ca){if(_0x5170ca){return _0x2618a0[_0xed70('0x1f')](_0x550371)[_0xed70('0x20')](_0x5170ca);}};}function respondWithFilteredResult(_0x5c585c,_0x1af5a1){return function(_0x43d495){if(_0x43d495){var _0x3eef39=_0x43d495[_0xed70('0x21')],_0xb1e0b7=_0x1af5a1[_0xed70('0x22')],_0xd9c7e3=_0x1af5a1[_0xed70('0x22')]+_0x1af5a1[_0xed70('0x23')],_0x5a549a;if(_0xd9c7e3>=_0x3eef39){_0xd9c7e3=_0x3eef39;_0x5a549a=0xc8;}else{_0x5a549a=0xce;}_0x5c585c['status'](_0x5a549a);return _0x5c585c[_0xed70('0x24')](_0xed70('0x25'),_0xb1e0b7+'-'+_0xd9c7e3+'/'+_0x3eef39)[_0xed70('0x20')](_0x43d495);}return null;};}function patchUpdates(_0x3548c4){return function(_0x2b6b39){try{jsonpatch[_0xed70('0x26')](_0x2b6b39,_0x3548c4,!![]);}catch(_0x36f8ed){return BPromise['reject'](_0x36f8ed);}return _0x2b6b39[_0xed70('0x27')]();};}function saveUpdates(_0x2245eb,_0x4ac09){return function(_0x19391f){if(_0x19391f){return _0x19391f['update'](_0x2245eb)[_0xed70('0x28')](function(_0x2e4f6f){return _0x2e4f6f;});}return null;};}function removeEntity(_0x4325ae,_0x27c7c7){return function(_0x5ce834){if(_0x5ce834){return _0x5ce834[_0xed70('0x29')]()[_0xed70('0x28')](function(){_0x4325ae['status'](0xcc)[_0xed70('0x1e')]();});}};}function handleEntityNotFound(_0x1a9934,_0x1b844f){return function(_0x43d960){if(!_0x43d960){_0x1a9934[_0xed70('0x1d')](0x194);}return _0x43d960;};}function handleError(_0x30ca9d,_0x4909e7){_0x4909e7=_0x4909e7||0x1f4;return function(_0x3df30a){logger[_0xed70('0x2a')](_0x3df30a[_0xed70('0x2b')]);if(_0x3df30a[_0xed70('0x2c')]){delete _0x3df30a[_0xed70('0x2c')];}_0x30ca9d[_0xed70('0x1f')](_0x4909e7)[_0xed70('0x2d')](_0x3df30a);};}exports[_0xed70('0x2e')]=function(_0x35ff51,_0x40acad){var _0xe12f8a={},_0x484bf0={},_0xf7aaf={'count':0x0,'rows':[]};var _0x18ca12=_[_0xed70('0x2f')](db[_0xed70('0x30')][_0xed70('0x31')],function(_0x5a1498){return{'name':_0x5a1498[_0xed70('0x32')],'type':_0x5a1498[_0xed70('0x33')][_0xed70('0x34')]};});_0x484bf0[_0xed70('0x35')]=_['map'](_0x18ca12,'name');_0x484bf0['query']=_[_0xed70('0x36')](_0x35ff51[_0xed70('0x37')]);_0x484bf0['filters']=_[_0xed70('0x38')](_0x484bf0['model'],_0x484bf0[_0xed70('0x37')]);_0xe12f8a['attributes']=_[_0xed70('0x38')](_0x484bf0[_0xed70('0x35')],qs[_0xed70('0x39')](_0x35ff51[_0xed70('0x37')][_0xed70('0x39')]));_0xe12f8a['attributes']=_0xe12f8a[_0xed70('0x3a')]['length']?_0xe12f8a[_0xed70('0x3a')]:_0x484bf0[_0xed70('0x35')];if(!_0x35ff51[_0xed70('0x37')][_0xed70('0x3b')](_0xed70('0x3c'))){_0xe12f8a[_0xed70('0x23')]=qs[_0xed70('0x23')](_0x35ff51[_0xed70('0x37')][_0xed70('0x23')]);_0xe12f8a['offset']=qs[_0xed70('0x22')](_0x35ff51[_0xed70('0x37')][_0xed70('0x22')]);}_0xe12f8a[_0xed70('0x3d')]=qs[_0xed70('0x3e')](_0x35ff51[_0xed70('0x37')][_0xed70('0x3e')]);_0xe12f8a[_0xed70('0x3f')]=qs[_0xed70('0x40')](_['pick'](_0x35ff51[_0xed70('0x37')],_0x484bf0['filters']),_0x18ca12);if(_0x35ff51[_0xed70('0x37')][_0xed70('0x41')]){_0xe12f8a['where']=_['merge'](_0xe12f8a[_0xed70('0x3f')],{'$or':_[_0xed70('0x2f')](_0x18ca12,function(_0x2a31d4){if(_0x2a31d4[_0xed70('0x33')]!==_0xed70('0x42')){var _0x574837={};_0x574837[_0x2a31d4[_0xed70('0x2c')]]={'$like':'%'+_0x35ff51['query'][_0xed70('0x41')]+'%'};return _0x574837;}})});}_0xe12f8a=_['merge']({},_0xe12f8a,_0x35ff51[_0xed70('0x43')]);var _0x3d23e5={'where':_0xe12f8a[_0xed70('0x3f')]};return db['UserProfile'][_0xed70('0x21')](_0x3d23e5)[_0xed70('0x28')](function(_0x48a037){_0xf7aaf['count']=_0x48a037;if(_0x35ff51[_0xed70('0x37')]['includeAll']){_0xe12f8a[_0xed70('0x44')]=[{'all':!![]}];}return db[_0xed70('0x30')][_0xed70('0x45')](_0xe12f8a);})[_0xed70('0x28')](function(_0x551bfe){_0xf7aaf[_0xed70('0x46')]=_0x551bfe;return _0xf7aaf;})[_0xed70('0x28')](respondWithFilteredResult(_0x40acad,_0xe12f8a))['catch'](handleError(_0x40acad,null));};exports[_0xed70('0x47')]=function(_0x6dc40,_0x188b55){var _0x9acfcf={'raw':![],'where':{'id':_0x6dc40[_0xed70('0x48')]['id']}},_0x13e5fe={};_0x13e5fe[_0xed70('0x35')]=_[_0xed70('0x36')](db[_0xed70('0x30')][_0xed70('0x31')]);_0x13e5fe[_0xed70('0x37')]=_[_0xed70('0x36')](_0x6dc40[_0xed70('0x37')]);_0x13e5fe[_0xed70('0x40')]=_[_0xed70('0x38')](_0x13e5fe[_0xed70('0x35')],_0x13e5fe[_0xed70('0x37')]);_0x9acfcf['attributes']=_['intersection'](_0x13e5fe['model'],qs[_0xed70('0x39')](_0x6dc40[_0xed70('0x37')][_0xed70('0x39')]));_0x9acfcf[_0xed70('0x3a')]=_0x9acfcf[_0xed70('0x3a')][_0xed70('0x49')]?_0x9acfcf[_0xed70('0x3a')]:_0x13e5fe[_0xed70('0x35')];if(_0x6dc40[_0xed70('0x37')][_0xed70('0x4a')]){_0x9acfcf[_0xed70('0x44')]=[{'all':!![]}];}_0x9acfcf=_[_0xed70('0x4b')]({},_0x9acfcf,_0x6dc40[_0xed70('0x43')]);return db[_0xed70('0x30')][_0xed70('0x4c')](_0x9acfcf)[_0xed70('0x28')](handleEntityNotFound(_0x188b55,null))['then'](respondWithResult(_0x188b55,null))['catch'](handleError(_0x188b55,null));};exports[_0xed70('0x4d')]=function(_0x547b2a,_0x2cf002){return db[_0xed70('0x30')][_0xed70('0x4d')](_0x547b2a[_0xed70('0x4e')],{})[_0xed70('0x28')](respondWithResult(_0x2cf002,0xc9))[_0xed70('0x4f')](handleError(_0x2cf002,null));};exports[_0xed70('0x50')]=function(_0x5621ce,_0x301e8c){var _0x561b85={'where':{'id':_0x5621ce[_0xed70('0x48')]['id']}},_0x1b9e56={};_0x1b9e56[_0xed70('0x35')]=_['keys'](db[_0xed70('0x30')]['rawAttributes']);_0x561b85[_0xed70('0x3a')]=_[_0xed70('0x38')](_0x1b9e56[_0xed70('0x35')],qs[_0xed70('0x39')](_0x5621ce['query'][_0xed70('0x39')]));_0x561b85[_0xed70('0x3a')]=_0x561b85[_0xed70('0x3a')][_0xed70('0x49')]?_0x561b85[_0xed70('0x3a')]:_0x1b9e56['model'];if(_0x5621ce['query'][_0xed70('0x4a')]){_0x561b85[_0xed70('0x44')]=[{'all':!![]}];}_0x561b85=_['merge']({},_0x561b85,_0x5621ce[_0xed70('0x43')]);return db[_0xed70('0x30')][_0xed70('0x4c')](_0x561b85)[_0xed70('0x28')](handleEntityNotFound(_0x301e8c,null))[_0xed70('0x28')](function(_0x1be80f){if(_0x1be80f){var _0x4f8dd6=_0x1be80f['get']({'plain':!![]});_0x4f8dd6=qs[_0xed70('0x51')](_0x4f8dd6,['id',_0xed70('0x52'),_0xed70('0x53'),_0xed70('0x54')]);_0x5621ce['body']=_[_0xed70('0x51')](_0x5621ce[_0xed70('0x4e')],['id','createdAt',_0xed70('0x53')]);return db[_0xed70('0x55')]['transaction'](function(_0x53705a){return db[_0xed70('0x30')][_0xed70('0x4d')](_[_0xed70('0x4b')](_0x4f8dd6,_0x5621ce['body']),{'include':_0x5621ce['query'][_0xed70('0x4a')]?[{'all':!![]}]:undefined,'transaction':_0x53705a})[_0xed70('0x28')](function(_0x206803){var _0x2082e4=_0x206803[_0xed70('0x56')]({'plain':!![]});return db[_0xed70('0x57')][_0xed70('0x45')]({'where':{'userProfileId':_0x5621ce['params']['id']},'raw':!![]})[_0xed70('0x28')](function(_0x4ed45e){if(_0x4ed45e){return BPromise[_0xed70('0x58')](_0x4ed45e,function(_0x212363){return new BPromise(function(_0x1270ec,_0x2a6c8e){if(_0x212363[_0xed70('0x59')]===null||_0x212363['autoAssociation']===0x1)_0x1270ec(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x212363['id']},'raw':!![]})[_0xed70('0x28')](function(_0x5d03bf){var _0x505d01=_['map'](_0x5d03bf,function(_0x4545c1){return qs[_0xed70('0x51')](_0x4545c1,['id',_0xed70('0x52'),_0xed70('0x53'),_0xed70('0x5a')]);});_0x1270ec(_0x505d01);})['catch'](function(_0xbfaf59){_0x2a6c8e(_0xbfaf59);});})[_0xed70('0x28')](function(_0x531f88){var _0x29b130=qs['omit'](_0x212363,['id',_0xed70('0x52'),_0xed70('0x53')]);_0x29b130['userProfileId']=_0x2082e4['id'];if(_0x531f88)_0x29b130[_0xed70('0x5b')]=_0x531f88;return _0x29b130;})['then'](function(_0x4cd817){return db[_0xed70('0x57')][_0xed70('0x4d')](_0x4cd817,{'include':[{'model':db['UserProfileResource'],'as':_0xed70('0x5b')}],'raw':!![],'transaction':_0x53705a});});})['then'](function(){return _0x2082e4;});}});});});}})[_0xed70('0x28')](respondWithResult(_0x301e8c,0xc9))[_0xed70('0x4f')](handleError(_0x301e8c,null));};exports[_0xed70('0x5c')]=function(_0xd2b6fb,_0x1dd970){if(_0xd2b6fb[_0xed70('0x4e')]['id']){delete _0xd2b6fb[_0xed70('0x4e')]['id'];}return db[_0xed70('0x30')][_0xed70('0x4c')]({'where':{'id':_0xd2b6fb[_0xed70('0x48')]['id']}})[_0xed70('0x28')](handleEntityNotFound(_0x1dd970,null))[_0xed70('0x28')](saveUpdates(_0xd2b6fb[_0xed70('0x4e')],null))[_0xed70('0x28')](respondWithResult(_0x1dd970,null))[_0xed70('0x4f')](handleError(_0x1dd970,null));};exports[_0xed70('0x29')]=function(_0x5e1ce7,_0x2b7b07){return db[_0xed70('0x30')][_0xed70('0x4c')]({'where':{'id':_0x5e1ce7[_0xed70('0x48')]['id']}})[_0xed70('0x28')](handleEntityNotFound(_0x2b7b07,null))[_0xed70('0x28')](removeEntity(_0x2b7b07,null))[_0xed70('0x4f')](handleError(_0x2b7b07,null));};exports[_0xed70('0x5d')]=function(_0x39ef74,_0x6a7dc8){return db[_0xed70('0x30')][_0xed70('0x5d')]()[_0xed70('0x28')](respondWithResult(_0x6a7dc8,null))[_0xed70('0x4f')](handleError(_0x6a7dc8,null));};exports['addSections']=function(_0x72bc5d,_0x1cd73c){var _0x38c2b4=_0x72bc5d[_0xed70('0x4e')];return db[_0xed70('0x30')][_0xed70('0x4c')]({'where':{'id':_0x72bc5d[_0xed70('0x48')]['id']}})[_0xed70('0x28')](handleEntityNotFound(_0x1cd73c,null))[_0xed70('0x28')](function(_0x71ebfa){if(_0x71ebfa){return db[_0xed70('0x55')]['transaction'](function(_0x39a4eb){return db['UserProfileSection'][_0xed70('0x29')]({'where':{'userProfileId':_0x72bc5d[_0xed70('0x48')]['id'],'sectionId':_[_0xed70('0x2f')](_0x38c2b4,function(_0x26427f){return _0x26427f['sectionId'];})},'transaction':_0x39a4eb})[_0xed70('0x28')](function(){var _0x3b83c4=_['map'](_0x38c2b4,function(_0x24176e){_0x24176e[_0xed70('0x5e')]=_0x72bc5d[_0xed70('0x48')]['id'];return _0x24176e;});var _0x5d23ad=[];return BPromise['each'](_0x3b83c4,function(_0xd16978){return db[_0xed70('0x57')][_0xed70('0x4d')](_0xd16978,{'include':[{'model':db[_0xed70('0x5f')],'as':'Resources'}],'raw':!![],'transaction':_0x39a4eb})[_0xed70('0x28')](function(_0x3b27fa){_0x5d23ad['push'](_0x3b27fa[_0xed70('0x56')]({'plain':!![]}));});})['then'](function(){return _0x5d23ad;});});});}})[_0xed70('0x28')](function(_0x598d7f){return _0x598d7f;})[_0xed70('0x28')](respondWithResult(_0x1cd73c,null))[_0xed70('0x4f')](handleError(_0x1cd73c,null));};exports[_0xed70('0x60')]=function(_0x1ec805,_0xfea19b){var _0x18d3f2;return db['UserProfile'][_0xed70('0x4c')]({'where':{'id':_0x1ec805[_0xed70('0x48')]['id']},'attributes':['id','name']})[_0xed70('0x28')](handleEntityNotFound(_0xfea19b,null))[_0xed70('0x28')](function(_0xc217f1){if(_0xc217f1){_0x18d3f2=_0xc217f1;return db[_0xed70('0x57')][_0xed70('0x29')]({'where':{'userProfileId':_0x1ec805[_0xed70('0x48')]['id'],'sectionId':_0x1ec805[_0xed70('0x37')][_0xed70('0x61')]}});}})[_0xed70('0x28')](function(){return _0x18d3f2;})[_0xed70('0x28')](respondWithStatusCode(_0xfea19b,null))[_0xed70('0x4f')](handleError(_0xfea19b,null));};exports[_0xed70('0x62')]=function(_0x3ce86b,_0xb8a729){var _0x198dfb=[];var _0x5779df=[];return db[_0xed70('0x57')]['findAll']({'where':{'userProfileId':_0x3ce86b['params']['id']},'raw':!![]})[_0xed70('0x28')](function(_0x1685a7){_0x198dfb=_['filter'](_0x1685a7,function(_0xdf164d){return _0xdf164d[_0xed70('0x63')]===0x1||_[_0xed70('0x64')]([0x3eb,0x709],_0xdf164d['sectionId']);});if(!_[_0xed70('0x65')](_0x198dfb)){return _[_0xed70('0x2f')](_0x198dfb,function(_0xb35b87){return _0xb35b87['sectionId'];});}else{return;}})['then'](function(_0x40d245){if(_0x40d245)_0x5779df=_0x40d245;if(_['includes'](_0x5779df,0x64)){var _0xce85c9=_[_0xed70('0x4c')](_0x198dfb,{'sectionId':0x64});return hasDefaultDashboard(_0xce85c9)['then'](function(_0x36b365){return _[_0xed70('0x2f')](_0x198dfb,function(_0x449183){if(_0x449183[_0xed70('0x5a')]===0x64){_0x449183[_0xed70('0x66')]=_0x36b365;}return _0x449183;});});}else{return;}})[_0xed70('0x28')](function(_0x2ebe4f){if(_0x2ebe4f)_0x198dfb=_0x2ebe4f;if(_[_0xed70('0x64')](_0x5779df,0x3eb)){var _0x46b04c=_[_0xed70('0x4c')](_0x198dfb,{'sectionId':0x3eb});return getCustomDashboards(_0x46b04c)[_0xed70('0x28')](function(_0x421580){return _[_0xed70('0x2f')](_0x198dfb,function(_0x844ec6){if(_0x46b04c[_0xed70('0x63')]){if(_0x844ec6['sectionId']===0x3eb){_0x844ec6['subsections']=_0x421580;}}else{if(_0x844ec6[_0xed70('0x5a')]===0x64){_0x844ec6['subsections']=_0x421580;}}return _0x844ec6;});});}else{return;}})[_0xed70('0x28')](function(_0x38c181){if(_0x38c181)_0x198dfb=_0x38c181;if(_[_0xed70('0x64')](_0x5779df,0x709)){var _0x1cb0ae=_['find'](_0x198dfb,{'sectionId':0x709});return getPlugins(_0x1cb0ae)[_0xed70('0x28')](function(_0x42f880){if(_0x1cb0ae[_0xed70('0x63')]){return _[_0xed70('0x2f')](_0x198dfb,function(_0x296289){if(_0x296289[_0xed70('0x5a')]===0x709){_0x296289['subsections']=_0x42f880;}return _0x296289;});}else{var _0x1343b8={'sectionId':0x76c,'enabled':0x1,'subsections':_0x42f880};var _0x21f14f=_[_0xed70('0x2f')](_0x198dfb);_0x21f14f[_0xed70('0x67')](_0x1343b8);return _0x21f14f;}});}else{return;}})[_0xed70('0x28')](function(_0x7f92a){if(_0x7f92a)_0x198dfb=_0x7f92a;return _[_0xed70('0x41')](_0x198dfb,[_0xed70('0x63'),0x1]);})['then'](respondWithResult(_0xb8a729,null))['catch'](handleError(_0xb8a729,null));};function hasDefaultDashboard(_0x773a8c){var _0x5311c7=[0x65];return new BPromise(function(_0x3d456c,_0x32493d){try{if(_0x773a8c[_0xed70('0x59')]){_0x3d456c(_0x5311c7);}else{return db[_0xed70('0x5f')]['findOne']({'where':{'sectionId':_0x773a8c['id']},'raw':!![]})[_0xed70('0x28')](function(_0x58d990){_0x58d990?_0x3d456c(_0x5311c7):_0x3d456c();});}}catch(_0x2e08c0){_0x32493d(_0x2e08c0);}});}function getCustomDashboards(_0x20dd58){var _0xcf807e=[];return new BPromise(function(_0xfdce76,_0x110891){try{if(_0x20dd58['autoAssociation']){return db['Dashboard'][_0xed70('0x45')]({'raw':!![]})[_0xed70('0x28')](function(_0xc38b95){_0xc38b95[_0xed70('0x68')](function(_0x4b683a){_0xcf807e[_0xed70('0x67')](_0x4b683a['id']+0x1869f);});_0xfdce76(_0xcf807e);});}else{return db[_0xed70('0x5f')][_0xed70('0x45')]({'where':{'sectionId':_0x20dd58['id']},'raw':!![]})['then'](function(_0x32e3e6){_0x32e3e6[_0xed70('0x68')](function(_0x43e824){_0xcf807e[_0xed70('0x67')](_0x43e824[_0xed70('0x69')]+0x1869f);});_0xfdce76(_0xcf807e);});}}catch(_0x1c5ba6){_0x110891(_0x1c5ba6);}});}function getPlugins(_0x220b69){var _0x12124d=[];return new BPromise(function(_0x2869fe,_0x115784){try{if(_0x220b69[_0xed70('0x59')]){return db[_0xed70('0x6a')][_0xed70('0x45')]({'raw':!![]})['then'](function(_0x546b2f){_0x546b2f[_0xed70('0x68')](function(_0x566b5f){_0x12124d[_0xed70('0x67')](_0x566b5f['id']+0x15b38);});_0x2869fe(_0x12124d);});}else{return db[_0xed70('0x5f')]['findAll']({'where':{'sectionId':_0x220b69['id']},'raw':!![]})[_0xed70('0x28')](function(_0x21751c){_0x21751c[_0xed70('0x68')](function(_0x22f2f0){_0x12124d[_0xed70('0x67')](_0x22f2f0[_0xed70('0x69')]+0x15b38);});_0x2869fe(_0x12124d);});}}catch(_0x5da7f4){_0x115784(_0x5da7f4);}});}exports[_0xed70('0x6b')]=function(_0x376acd,_0x5225c2){return db[_0xed70('0x30')][_0xed70('0x4c')]({'where':{'id':_0x376acd[_0xed70('0x48')]['id']}})[_0xed70('0x28')](handleEntityNotFound(_0x5225c2,null))['then'](function(_0x3cbaad){if(_0x3cbaad){return db['sequelize'][_0xed70('0x6c')](function(_0xd6be9c){return db[_0xed70('0x57')][_0xed70('0x45')]({'where':{'userProfileId':_0x376acd['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x26060d){if(_0x26060d){return db[_0xed70('0x57')]['destroy']({'where':{'userProfileId':_0x376acd['params']['id'],'id':_[_0xed70('0x2f')](_0x26060d,function(_0x2d8ec7){return _0x2d8ec7['id'];})},'transaction':_0xd6be9c});}})[_0xed70('0x28')](function(_0x2040b7){var _0x4dc686=_[_0xed70('0x2f')](_0x376acd['body'],function(_0x11981e){_0x11981e[_0xed70('0x5e')]=_0x376acd[_0xed70('0x48')]['id'];return _0x11981e;});return db[_0xed70('0x57')]['bulkCreate'](_0x4dc686,{'raw':!![],'transaction':_0xd6be9c});})[_0xed70('0x28')](function(_0x179f2f){var _0x50f0ec=_[_0xed70('0x41')](_[_0xed70('0x2f')](_0x179f2f,function(_0x105646){return _0x105646['get']({'plain':!![]});}),{'includeAll':![]});if(_0x50f0ec){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x376acd['params']['id'],'sectionId':_[_0xed70('0x2f')](_0x50f0ec,function(_0x50bf3d){return _0x50bf3d[_0xed70('0x5a')];})},'attributes':['id',_0xed70('0x5a')],'raw':!![]})['then'](function(_0x11a22a){var _0x40f019=_[_0xed70('0x2f')](_0x376acd[_0xed70('0x4e')],function(_0x436bd8){_0x436bd8[_0xed70('0x5e')]=_0x376acd[_0xed70('0x48')]['id'];return _0x436bd8;});return db[_0xed70('0x5f')][_0xed70('0x6d')](_0x40f019,{'raw':!![],'transaction':_0xd6be9c});});}})[_0xed70('0x4f')](handleError(_0x5225c2,null));});}})[_0xed70('0x28')](function(_0x32768e){var _0x229070=_['map'](_0x32768e,function(_0x30444a){return _0x30444a['get']({'plain':!![]});});})[_0xed70('0x28')](respondWithResult(_0x5225c2,null))['catch'](handleError(_0x5225c2,null));};exports[_0xed70('0x6e')]=function(_0x3382a5,_0xadf196,_0x49a4cc){return db['UserProfile'][_0xed70('0x4c')]({'where':{'id':_0x3382a5['params']['id']}})[_0xed70('0x28')](handleEntityNotFound(_0xadf196,null))[_0xed70('0x28')](function(_0x4402cb){if(_0x4402cb){return _0x4402cb['removeResources'](_0x3382a5[_0xed70('0x37')][_0xed70('0x61')]);}})[_0xed70('0x28')](respondWithStatusCode(_0xadf196,null))[_0xed70('0x4f')](handleError(_0xadf196,null));};exports[_0xed70('0x6f')]=function(_0x2ab7e1,_0x567f54){var _0xea0df0={'raw':![],'where':{}};var _0x187035={};var _0x254568={'count':0x0,'rows':[]};var _0x3345a8=_0x2ab7e1[_0xed70('0x37')][_0xed70('0x70')];if(typeof _0x3345a8==='undefined'){throw new db[(_0xed70('0x71'))][(_0xed70('0x72'))](_0xed70('0x73'));}var _0x3750ba=_0x2ab7e1[_0xed70('0x37')][_0xed70('0x74')]||![];var _0x315170=getQueryModels(_0x3345a8,_0x3750ba);if(typeof _0x315170[_0xed70('0x75')]===_0xed70('0x76')){throw new db['Sequelize'][(_0xed70('0x72'))](_0xed70('0x77')+_0x3345a8+'\x27');}var _0x3d3ee8=[];if(!_[_0xed70('0x65')](_0x315170[_0xed70('0x78')])){_0x3d3ee8=_0x315170[_0xed70('0x78')];}else{_0x3d3ee8=[{'name':_0x3345a8}];}return db[_0xed70('0x30')][_0xed70('0x79')]({'where':{'id':_0x2ab7e1['params']['id']}})[_0xed70('0x28')](handleEntityNotFound(_0x567f54,null))[_0xed70('0x28')](function(_0x30dd2){if(_0x30dd2){var _0x54ed15=[];for(var _0x5923c1=0x0;_0x5923c1<_0x3d3ee8['length'];_0x5923c1++){_0x54ed15[_0xed70('0x67')](db[_0xed70('0x57')][_0xed70('0x79')]({'where':{'userProfileId':_0x30dd2['id'],'name':_0x3d3ee8[_0x5923c1][_0xed70('0x2c')]},'raw':!![]}));}return BPromise[_0xed70('0x7a')](_0x54ed15);}})['then'](function(_0x3935b6){var _0x1ea511=_[_0xed70('0x41')](_0x3935b6,function(_0xeec3d){return _0xeec3d?_0xeec3d:undefined;});var _0xdfa6b=_[_0xed70('0x41')](_0x3d3ee8,[_0xed70('0x7b'),!![]]);var _0x138ead=_[_0xed70('0x65')](_0x1ea511)&&_['isEmpty'](_0xdfa6b)?null:_[_0xed70('0x7c')](_0xdfa6b,_0x1ea511);if(_0x138ead){var _0x333017=[];for(var _0x260c80=0x0;_0x260c80<_0x138ead[_0xed70('0x49')];_0x260c80++){var _0x471827=_[_0xed70('0x4c')](_0x3d3ee8,function(_0x5cbf21){return _0x138ead[_0x260c80]?_0x5cbf21[_0xed70('0x2c')]===_0x138ead[_0x260c80][_0xed70('0x2c')]:null;});if(_0x471827){if(_0x138ead[_0x260c80][_0xed70('0x7b')]){_0x333017['push'](getAllResources(_0x315170[_0xed70('0x75')],_0x138ead[_0x260c80]));}else{if(!_0x138ead[_0x260c80][_0xed70('0x59')]){_0x333017[_0xed70('0x67')](getAllowedResources(_0x471827,_0x138ead[_0x260c80],_0x315170[_0xed70('0x75')]));}else{if(_0x471827['model']){_0x333017['push'](getAllFilteredResources(_0x471827,_0x138ead[_0x260c80]));}}}}}return BPromise[_0xed70('0x7a')](_0x333017);}else{return null;}})[_0xed70('0x28')](function(_0x23e011){var _0x1c1972=_0x23e011;var _0x2f7049=null;if(_0x1c1972){_0x2f7049=_0x1c1972[_0xed70('0x49')]===0x1?_0x1c1972[0x0]:null;}if(_0x2f7049||_0x1c1972){var _0x33bee1=db[_0x315170[_0xed70('0x75')]][_0xed70('0x31')];_0x187035[_0xed70('0x35')]=_[_0xed70('0x36')](_0x33bee1);_0x187035[_0xed70('0x37')]=_[_0xed70('0x36')](_0x2ab7e1['query']);_0x187035['filters']=_[_0xed70('0x38')](_0x187035[_0xed70('0x35')],_0x187035[_0xed70('0x37')]);_0xea0df0['attributes']=_['intersection'](_0x187035[_0xed70('0x35')],qs[_0xed70('0x39')](_0x2ab7e1['query'][_0xed70('0x39')]));_0xea0df0[_0xed70('0x3a')]=_0xea0df0[_0xed70('0x3a')]['length']?_0xea0df0[_0xed70('0x3a')]:_0x187035[_0xed70('0x35')];if(!_0x2ab7e1['query'][_0xed70('0x3b')](_0xed70('0x3c'))){_0xea0df0[_0xed70('0x23')]=qs[_0xed70('0x23')](_0x2ab7e1[_0xed70('0x37')][_0xed70('0x23')]);_0xea0df0['offset']=qs[_0xed70('0x22')](_0x2ab7e1[_0xed70('0x37')][_0xed70('0x22')]);}_0xea0df0[_0xed70('0x3d')]=qs[_0xed70('0x3e')](_0x2ab7e1[_0xed70('0x37')]['sort']);_0xea0df0['where']=qs['filters'](_[_0xed70('0x7d')](_0x2ab7e1[_0xed70('0x37')],_0x187035[_0xed70('0x40')]));if(_0x2ab7e1[_0xed70('0x37')][_0xed70('0x41')]){_0xea0df0['where']=_['merge'](_0xea0df0[_0xed70('0x3f')],{'$or':_[_0xed70('0x2f')](_0x33bee1,function(_0x5a58f4){if(_0x5a58f4[_0xed70('0x33')][_0xed70('0x34')]!=='VIRTUAL'){var _0x21bcaa={};_0x21bcaa[_0x5a58f4['field']]={'$like':'%'+_0x2ab7e1['query'][_0xed70('0x41')]+'%'};return _0x21bcaa;}})});}var _0x36ec20=[];if(_0x2f7049){var _0x19c56d=_[_0xed70('0x4c')](_0x3d3ee8,[_0xed70('0x2c'),_0x2f7049[_0xed70('0x2c')]]);if(_0x19c56d[_0xed70('0x7e')]){var _0x248905={};if(_0x315170['childModel']===_0xed70('0x7f')){_0x248905[_0x19c56d[_0xed70('0x80')]]=_['map'](_0x2f7049['associatedResources'],'id');}else{_0x248905[_0x19c56d[_0xed70('0x80')]]=_0x2f7049['associatedResources'];}_0x36ec20[_0xed70('0x67')](_0x248905);}else{_0xea0df0[_0xed70('0x3f')]['id']=_0x2f7049[_0xed70('0x81')];}}else{for(var _0x3ee986=0x0;_0x3ee986<_0x1c1972['length'];_0x3ee986++){var _0x19c56d=_['find'](_0x3d3ee8,['name',_0x1c1972[_0x3ee986][_0xed70('0x2c')]]);if(_0x19c56d[_0xed70('0x7e')]){var _0x248905={};_0x248905[_0x19c56d[_0xed70('0x80')]]=_0x1c1972[_0x3ee986][_0xed70('0x81')];_0x36ec20[_0xed70('0x67')](_0x248905);}else{if(!_0xea0df0[_0xed70('0x3f')]['id'])_0xea0df0[_0xed70('0x3f')]['id']=[];_0x1c1972[_0x3ee986][_0xed70('0x81')][_0xed70('0x68')](function(_0x40769f){_0xea0df0['where']['id'][_0xed70('0x67')](_0x40769f);});}}}if(!_[_0xed70('0x65')](_0x36ec20)){_0xea0df0[_0xed70('0x3f')]=_['merge'](_0xea0df0[_0xed70('0x3f')],{'$and':{'$or':_0x36ec20}});}_0xea0df0=_[_0xed70('0x4b')]({},_0xea0df0,_0x2ab7e1['options']);if(_0x2f7049&&!_0x2f7049[_0xed70('0x59')]&&_0x315170[_0xed70('0x75')]===_0xed70('0x7f')){if(_0x2ab7e1['query'][_0xed70('0x4a')]){_0xea0df0[_0xed70('0x44')]=[{'all':!![]}];}return db[_0x315170[_0xed70('0x75')]][_0xed70('0x45')](_0xea0df0)['then'](function(_0x4dc3c2){var _0x5ce275=[];_0x4dc3c2['forEach'](function(_0x20d67e){var _0xe47060;switch(_0x20d67e[_0xed70('0x82')]){case _0xed70('0x83'):_0xe47060=_['find'](_0x2f7049['associatedResources'],function(_0x12c366){return _0x12c366['id']===_0x20d67e[_0xed70('0x84')]&&_0x12c366['type']===_0xed70('0x85');});break;case'custom':_0xe47060=_[_0xed70('0x4c')](_0x2f7049['associatedResources'],function(_0x416018){return _0x416018['id']===_0x20d67e[_0xed70('0x84')]&&_0x416018[_0xed70('0x33')]===_0xed70('0x86');});break;}if(_0xe47060)_0x5ce275[_0xed70('0x67')](_0x20d67e);});_0x254568[_0xed70('0x21')]=_0x5ce275['length'];_0x254568[_0xed70('0x46')]=_0x5ce275;return _0x254568;});}else{return db[_0x315170[_0xed70('0x75')]]['count']({'where':_0xea0df0['where']})['then'](function(_0x27a75a){_0x254568[_0xed70('0x21')]=_0x27a75a;if(_0x2ab7e1[_0xed70('0x37')]['includeAll']){if(_0x315170[_0xed70('0x75')]===_0xed70('0x87')){_0xea0df0[_0xed70('0x44')]=[{'model':db[_0xed70('0x88')],'as':_0xed70('0x89'),'attributes':['id',_0xed70('0x2c'),'color'],'required':_0x2ab7e1[_0xed70('0x37')][_0xed70('0x8a')]?!![]:![]},{'model':db[_0xed70('0x88')],'as':_0xed70('0x8b'),'attributes':['id',_0xed70('0x2c'),'color'],'through':_0x2ab7e1[_0xed70('0x37')][_0xed70('0x8a')]?{'attributes':[],'where':{'TagId':_0x2ab7e1[_0xed70('0x37')][_0xed70('0x8a')]||undefined}}:{},'required':_0x2ab7e1[_0xed70('0x37')][_0xed70('0x8a')]?!![]:![]}];}else{_0xea0df0[_0xed70('0x44')]=[{'all':!![]}];}}return db[_0x315170[_0xed70('0x75')]][_0xed70('0x45')](_0xea0df0);})[_0xed70('0x28')](function(_0x326d4a){_0x254568[_0xed70('0x46')]=_0x326d4a;return _0x254568;});}}else{return _0x254568;}})[_0xed70('0x28')](respondWithFilteredResult(_0x567f54,_0xea0df0))[_0xed70('0x4f')](handleError(_0x567f54,null));};function getAllResources(_0xf660cd,_0x58aab6){return new BPromise(function(_0x4aa5df,_0x49e66a){if(_0x58aab6){var _0xb07407=_0x58aab6[_0xed70('0x41')]?{[_0x58aab6[_0xed70('0x41')]['field']]:_0x58aab6[_0xed70('0x41')][_0xed70('0x8c')]}:undefined;return db[_0xf660cd][_0xed70('0x45')]({'where':_0xb07407,'raw':!![]})[_0xed70('0x28')](function(_0x2ca838){_0x58aab6['associatedResources']=_[_0xed70('0x2f')](_0x2ca838,'id');_0x4aa5df(_0x58aab6);})[_0xed70('0x4f')](function(_0x2a2cd2){_0x49e66a(_0x2a2cd2);});}else{_0x4aa5df(null);}});}function getAllFilteredResources(_0x4ac5be,_0x1b8f5c){return new BPromise(function(_0x15aabd,_0x29720c){var _0x30b574=_0x4ac5be[_0xed70('0x41')]?{[_0x4ac5be[_0xed70('0x41')][_0xed70('0x7e')]]:_0x4ac5be['filter'][_0xed70('0x8c')]}:undefined;return db[_0x4ac5be[_0xed70('0x35')]][_0xed70('0x45')]({'where':_0x30b574,'raw':!![]})[_0xed70('0x28')](function(_0x4526a2){_0x1b8f5c[_0xed70('0x81')]=_[_0xed70('0x2f')](_0x4526a2,function(_0x3d8997){return _0x3d8997['name'];});_0x15aabd(_0x1b8f5c);})['catch'](function(_0x357265){_0x29720c(_0x357265);});});}function getAllowedResources(_0x3b34fe,_0x9e24d7,_0x335a47){return new BPromise(function(_0x129bd0,_0x4a0b66){if(_0x9e24d7){return db[_0xed70('0x5f')]['findAll']({'where':{'sectionId':_0x9e24d7['id']},'raw':!![]})[_0xed70('0x28')](function(_0x47e246){if(_0x3b34fe[_0xed70('0x7e')]&&_0x3b34fe[_0xed70('0x7e')]!=='id'){_0x9e24d7[_0xed70('0x81')]=_['map'](_0x47e246,function(_0x484e73){return _0x484e73[_0x3b34fe[_0xed70('0x7e')]];});}else{if(_0x335a47==='AnalyticExtractedReport'){_0x9e24d7[_0xed70('0x81')]=_['map'](_0x47e246,function(_0x278621){return{'id':_0x278621[_0xed70('0x69')],'type':_0x278621[_0xed70('0x33')]};});}else{_0x9e24d7['associatedResources']=_[_0xed70('0x2f')](_0x47e246,function(_0x239b00){return _0x239b00[_0xed70('0x69')];});}}_0x129bd0(_0x9e24d7);})[_0xed70('0x4f')](function(_0x3c353e){_0x4a0b66(_0x3c353e);});}else{_0x129bd0(null);}});}function getQueryModels(_0x5481de,_0x417788){var _0x15890e=_0x5481de['toLowerCase']();var _0x35e596={'childModel':undefined,'parentSections':[]};switch(_0x15890e){case _0xed70('0x8d'):_0x35e596[_0xed70('0x75')]=_0xed70('0x8e');break;case _0xed70('0x8f'):_0x35e596[_0xed70('0x75')]=_0xed70('0x90');break;case _0xed70('0x91'):_0x35e596['childModel']=_0xed70('0x92');_0x35e596[_0xed70('0x78')]=[{'name':_0xed70('0x93'),'field':'name','foreignKey':_0xed70('0x94')}];break;case'projects':_0x35e596[_0xed70('0x75')]=_0xed70('0x95');break;case _0xed70('0x96'):_0x35e596['childModel']=_0xed70('0x87');_0x35e596[_0xed70('0x78')]=[{'name':_0xed70('0x97'),'field':'id','foreignKey':'ListId'}];break;case _0xed70('0x98'):_0x35e596['childModel']=_0xed70('0x99');break;case _0xed70('0x9a'):_0x35e596['childModel']='CmCompany';break;case'globalcustomfields':_0x35e596[_0xed70('0x75')]=_0xed70('0x9b');break;case _0xed70('0x9c'):_0x35e596['childModel']=_0xed70('0x9d');break;case _0xed70('0x9e'):_0x35e596[_0xed70('0x75')]='ChatWebsite';break;case _0xed70('0x9f'):_0x35e596[_0xed70('0x75')]=_0xed70('0xa0');break;case'faxaccounts':_0x35e596[_0xed70('0x75')]=_0xed70('0xa1');break;case'inboundroutes':case _0xed70('0xa2'):case _0xed70('0xa3'):_0x35e596['childModel']=_0xed70('0xa4');break;case _0xed70('0xa5'):_0x35e596[_0xed70('0x75')]='VoiceContext';break;case _0xed70('0xa6'):_0x35e596[_0xed70('0x75')]=_0xed70('0xa7');break;case _0xed70('0xa8'):_0x35e596[_0xed70('0x75')]=_0xed70('0xa9');_0x35e596['parentSections']=[{'name':_0xed70('0xaa'),'field':_0xed70('0x2c'),'foreignKey':_0xed70('0xab'),'model':'User','filter':{'field':_0xed70('0xac'),'value':['agent']}},{'name':_0xed70('0xad'),'field':'name','foreignKey':_0xed70('0xab'),'model':_0xed70('0xae'),'filter':{'field':_0xed70('0xac'),'value':[_0xed70('0xaf')]}},{'name':_0xed70('0xb0'),'field':'name','foreignKey':_0xed70('0xb1'),'model':_0xed70('0xb2'),'filter':{'field':_0xed70('0x33'),'value':[_0xed70('0xb3')]}},{'name':_0xed70('0xb4'),'field':_0xed70('0x2c'),'foreignKey':'queue','model':_0xed70('0xb2'),'filter':{'field':_0xed70('0x33'),'value':[_0xed70('0xb5')]}}];break;case _0xed70('0xb6'):_0x35e596[_0xed70('0x75')]=_0xed70('0xb7');break;case _0xed70('0xb8'):_0x35e596[_0xed70('0x75')]=_0xed70('0xb9');break;case _0xed70('0xba'):_0x35e596[_0xed70('0x75')]=_0xed70('0xbb');break;case _0xed70('0xbc'):_0x35e596[_0xed70('0x75')]=_0xed70('0xbd');break;case'mailqueues':_0x35e596['childModel']=_0xed70('0xbe');break;case _0xed70('0xbf'):_0x35e596['childModel']='MailAccount';break;case _0xed70('0xc0'):_0x35e596[_0xed70('0x75')]=_0xed70('0xc1');break;case _0xed70('0xc2'):_0x35e596['childModel']='OpenchannelQueue';break;case _0xed70('0xc3'):_0x35e596[_0xed70('0x75')]='OpenchannelAccount';break;case _0xed70('0xc4'):_0x35e596[_0xed70('0x75')]=_0xed70('0xc5');break;case'smsaccounts':_0x35e596[_0xed70('0x75')]='SmsAccount';break;case _0xed70('0xc6'):_0x35e596['childModel']=_0xed70('0xc7');break;case _0xed70('0xc8'):_0x35e596[_0xed70('0x75')]=_0xed70('0xc9');break;case'teams':_0x35e596['childModel']=_0xed70('0xca');break;case _0xed70('0xcb'):case'queuecampaigns':_0x35e596[_0xed70('0x75')]='VoiceQueue';if(_0x417788){_0x35e596[_0xed70('0x78')]=[{'name':_0xed70('0xb0')},{'name':_0xed70('0xb4')}];}break;case _0xed70('0xcc'):case _0xed70('0xcd'):case _0xed70('0xce'):_0x35e596[_0xed70('0x75')]=_0xed70('0xae');if(_0x417788){_0x35e596[_0xed70('0x78')]=[{'name':_0xed70('0xcf'),'filter':{'field':_0xed70('0xac'),'value':[_0xed70('0xd0'),_0xed70('0xd1')]},'ignore':!![]},{'name':_0xed70('0xaa')},{'name':_0xed70('0xad')}];}break;case _0xed70('0xd2'):_0x35e596[_0xed70('0x75')]=_0xed70('0xd3');break;case _0xed70('0xd4'):_0x35e596[_0xed70('0x75')]=_0xed70('0xd5');break;case'freshdeskaccounts':_0x35e596[_0xed70('0x75')]='FreshdeskAccount';break;case _0xed70('0xd6'):_0x35e596[_0xed70('0x75')]=_0xed70('0xd7');break;case _0xed70('0xd8'):_0x35e596[_0xed70('0x75')]=_0xed70('0xd9');break;case _0xed70('0xda'):_0x35e596[_0xed70('0x75')]=_0xed70('0xdb');break;case _0xed70('0xdc'):_0x35e596['childModel']='User';break;case _0xed70('0xdd'):_0x35e596[_0xed70('0x75')]=_0xed70('0xde');break;case _0xed70('0xdf'):_0x35e596[_0xed70('0x75')]=_0xed70('0xe0');break;case _0xed70('0xe1'):_0x35e596[_0xed70('0x75')]=_0xed70('0xe2');break;case _0xed70('0xe3'):_0x35e596['childModel']=_0xed70('0xe4');break;case'pauses':_0x35e596[_0xed70('0x75')]=_0xed70('0xe5');break;case _0xed70('0xe6'):_0x35e596[_0xed70('0x75')]=_0xed70('0xe7');break;case _0xed70('0xe8'):_0x35e596[_0xed70('0x75')]='Sound';break;case _0xed70('0xe9'):_0x35e596['childModel']='Tag';break;case _0xed70('0xea'):_0x35e596[_0xed70('0x75')]='Template';break;case'triggers':_0x35e596[_0xed70('0x75')]=_0xed70('0xeb');break;case _0xed70('0xec'):_0x35e596[_0xed70('0x75')]=_0xed70('0xed');break;case _0xed70('0xee'):_0x35e596[_0xed70('0x75')]=_0xed70('0xef');break;case'plugins':_0x35e596[_0xed70('0x75')]=_0xed70('0x6a');break;case _0xed70('0xf0'):_0x35e596[_0xed70('0x75')]=_0xed70('0x7f');_0x35e596[_0xed70('0x78')]=[{'name':_0xed70('0xf1'),'field':'id','foreignKey':_0xed70('0x84')}];break;case _0xed70('0xf2'):_0x35e596[_0xed70('0x75')]=_0xed70('0xf3');break;case _0xed70('0xc8'):_0x35e596[_0xed70('0x75')]=_0xed70('0xc9');break;default:return _0x35e596;}return _0x35e596;} \ No newline at end of file +var _0xf27b=['dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Template','Trunk','variables','Variable','extractedreports','Reports','metrics','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','end','json','count','offset','limit','status','apply','reject','save','destroy','then','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','filters','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','options','include','UserProfile','findAll','rows','catch','params','rawAttributes','intersection','find','create','body','clone','omit','createdAt','updatedAt','sequelize','transaction','get','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','UserProfileSection','update','describe','push','removeSections','getSections','includes','isEmpty','enabled','subsections','findOne','Dashboard','forEach','resourceId','bulkCreate','removeResources','ids','getResources','section','undefined','ValidationError','mergeResources','childModel','Invalid\x20section\x20\x27','parentSections','all','ignore','nolimit','order','VIRTUAL','field','foreignKey','associatedResources','AnalyticExtractedReport','includeAll','reportType','DefaultReports','custom','reportId','CustomReports','CmContact','Tag','Tags','color','ThroughTags','tag','value','toLowerCase','squareprojects','SquareProject','odbc','squarerecordings','SquareRecording','SquareProjects','projectName','JscriptyProject','ListId','lists','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicerecordings','VoiceRecording','membername','role','agent','Telephones','User','telephone','VoiceQueues','queue','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailaccounts','mailsubstatuses','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','QueueCampaigns','agents','telephones','Users','admin','user','Agents','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','cannedanswers','CannedAnswer'];(function(_0x2cec91,_0x484701){var _0x222c19=function(_0x3fc02a){while(--_0x3fc02a){_0x2cec91['push'](_0x2cec91['shift']());}};_0x222c19(++_0x484701);}(_0xf27b,0xf9));var _0xbf27=function(_0x421725,_0x318a04){_0x421725=_0x421725-0x0;var _0x51b322=_0xf27b[_0x421725];return _0x51b322;};'use strict';var pdf=require(_0xbf27('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbf27('0x1'));var jsonpatch=require(_0xbf27('0x2'));var rp=require('request-promise');var moment=require(_0xbf27('0x3'));var BPromise=require(_0xbf27('0x4'));var Mustache=require(_0xbf27('0x5'));var util=require(_0xbf27('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xbf27('0x7'));var ejs=require(_0xbf27('0x8'));var fs=require('fs');var _=require(_0xbf27('0x9'));var squel=require(_0xbf27('0xa'));var crypto=require(_0xbf27('0xb'));var jsforce=require(_0xbf27('0xc'));var deskjs=require(_0xbf27('0xd'));var toCsv=require(_0xbf27('0x7'));var querystring=require(_0xbf27('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbf27('0xf'));var as=require(_0xbf27('0x10'));var hardwareService=require(_0xbf27('0x11'));var logger=require(_0xbf27('0x12'))(_0xbf27('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbf27('0x14'));var db=require(_0xbf27('0x15'))['db'];config[_0xbf27('0x16')]=_[_0xbf27('0x17')](config[_0xbf27('0x16')],{'host':_0xbf27('0x18'),'port':0x18eb});var socket=require(_0xbf27('0x19'))(new Redis(config[_0xbf27('0x16')]));require(_0xbf27('0x1a'))[_0xbf27('0x1b')](socket);function respondWithStatusCode(_0x1c31c1,_0x1d5959){_0x1d5959=_0x1d5959||0xcc;return function(_0x297b18){if(_0x297b18){return _0x1c31c1[_0xbf27('0x1c')](_0x1d5959);}return _0x1c31c1['status'](_0x1d5959)[_0xbf27('0x1d')]();};}function respondWithResult(_0x35b5ea,_0x104b0d){_0x104b0d=_0x104b0d||0xc8;return function(_0x1c76a1){if(_0x1c76a1){return _0x35b5ea['status'](_0x104b0d)[_0xbf27('0x1e')](_0x1c76a1);}};}function respondWithFilteredResult(_0x17b41d,_0x21244e){return function(_0x231f51){if(_0x231f51){var _0x5485bd=_0x231f51[_0xbf27('0x1f')],_0x3f5965=_0x21244e['offset'],_0x53a77e=_0x21244e[_0xbf27('0x20')]+_0x21244e[_0xbf27('0x21')],_0x30422e;if(_0x53a77e>=_0x5485bd){_0x53a77e=_0x5485bd;_0x30422e=0xc8;}else{_0x30422e=0xce;}_0x17b41d[_0xbf27('0x22')](_0x30422e);return _0x17b41d['set']('Content-Range',_0x3f5965+'-'+_0x53a77e+'/'+_0x5485bd)[_0xbf27('0x1e')](_0x231f51);}return null;};}function patchUpdates(_0x509d6f){return function(_0x178fe7){try{jsonpatch[_0xbf27('0x23')](_0x178fe7,_0x509d6f,!![]);}catch(_0x9295ce){return BPromise[_0xbf27('0x24')](_0x9295ce);}return _0x178fe7[_0xbf27('0x25')]();};}function saveUpdates(_0x51d248,_0x315cf4){return function(_0x9f1586){if(_0x9f1586){return _0x9f1586['update'](_0x51d248)['then'](function(_0x4b8108){return _0x4b8108;});}return null;};}function removeEntity(_0x1c9d30,_0x46ed6d){return function(_0x515f2e){if(_0x515f2e){return _0x515f2e[_0xbf27('0x26')]()[_0xbf27('0x27')](function(){_0x1c9d30[_0xbf27('0x22')](0xcc)[_0xbf27('0x1d')]();});}};}function handleEntityNotFound(_0x48001f,_0x5a29c0){return function(_0x58baa6){if(!_0x58baa6){_0x48001f[_0xbf27('0x1c')](0x194);}return _0x58baa6;};}function handleError(_0x47dcbb,_0x42f15b){_0x42f15b=_0x42f15b||0x1f4;return function(_0x2fe995){logger[_0xbf27('0x28')](_0x2fe995[_0xbf27('0x29')]);if(_0x2fe995['name']){delete _0x2fe995[_0xbf27('0x2a')];}_0x47dcbb[_0xbf27('0x22')](_0x42f15b)[_0xbf27('0x2b')](_0x2fe995);};}exports[_0xbf27('0x2c')]=function(_0x42d0d5,_0x34469c){var _0x4c060e={},_0x5229fc={},_0x4750cf={'count':0x0,'rows':[]};var _0x4fce9f=_[_0xbf27('0x2d')](db['UserProfile']['rawAttributes'],function(_0x4c3216){return{'name':_0x4c3216[_0xbf27('0x2e')],'type':_0x4c3216[_0xbf27('0x2f')][_0xbf27('0x30')]};});_0x5229fc[_0xbf27('0x31')]=_[_0xbf27('0x2d')](_0x4fce9f,_0xbf27('0x2a'));_0x5229fc['query']=_[_0xbf27('0x32')](_0x42d0d5[_0xbf27('0x33')]);_0x5229fc[_0xbf27('0x34')]=_['intersection'](_0x5229fc[_0xbf27('0x31')],_0x5229fc[_0xbf27('0x33')]);_0x4c060e[_0xbf27('0x35')]=_['intersection'](_0x5229fc[_0xbf27('0x31')],qs[_0xbf27('0x36')](_0x42d0d5[_0xbf27('0x33')][_0xbf27('0x36')]));_0x4c060e[_0xbf27('0x35')]=_0x4c060e[_0xbf27('0x35')][_0xbf27('0x37')]?_0x4c060e['attributes']:_0x5229fc['model'];if(!_0x42d0d5[_0xbf27('0x33')][_0xbf27('0x38')]('nolimit')){_0x4c060e[_0xbf27('0x21')]=qs[_0xbf27('0x21')](_0x42d0d5['query'][_0xbf27('0x21')]);_0x4c060e[_0xbf27('0x20')]=qs['offset'](_0x42d0d5[_0xbf27('0x33')][_0xbf27('0x20')]);}_0x4c060e['order']=qs[_0xbf27('0x39')](_0x42d0d5['query']['sort']);_0x4c060e[_0xbf27('0x3a')]=qs[_0xbf27('0x34')](_['pick'](_0x42d0d5[_0xbf27('0x33')],_0x5229fc[_0xbf27('0x34')]),_0x4fce9f);if(_0x42d0d5[_0xbf27('0x33')][_0xbf27('0x3b')]){_0x4c060e[_0xbf27('0x3a')]=_[_0xbf27('0x3c')](_0x4c060e[_0xbf27('0x3a')],{'$or':_[_0xbf27('0x2d')](_0x4fce9f,function(_0x56dfca){if(_0x56dfca[_0xbf27('0x2f')]!=='VIRTUAL'){var _0x247f3d={};_0x247f3d[_0x56dfca[_0xbf27('0x2a')]]={'$like':'%'+_0x42d0d5[_0xbf27('0x33')][_0xbf27('0x3b')]+'%'};return _0x247f3d;}})});}_0x4c060e=_[_0xbf27('0x3c')]({},_0x4c060e,_0x42d0d5[_0xbf27('0x3d')]);var _0x2c0c30={'where':_0x4c060e['where']};return db['UserProfile'][_0xbf27('0x1f')](_0x2c0c30)[_0xbf27('0x27')](function(_0x448305){_0x4750cf[_0xbf27('0x1f')]=_0x448305;if(_0x42d0d5[_0xbf27('0x33')]['includeAll']){_0x4c060e[_0xbf27('0x3e')]=[{'all':!![]}];}return db[_0xbf27('0x3f')][_0xbf27('0x40')](_0x4c060e);})['then'](function(_0x454b83){_0x4750cf[_0xbf27('0x41')]=_0x454b83;return _0x4750cf;})[_0xbf27('0x27')](respondWithFilteredResult(_0x34469c,_0x4c060e))[_0xbf27('0x42')](handleError(_0x34469c,null));};exports['show']=function(_0x918de6,_0x29044f){var _0x363d93={'raw':![],'where':{'id':_0x918de6[_0xbf27('0x43')]['id']}},_0x445895={};_0x445895[_0xbf27('0x31')]=_[_0xbf27('0x32')](db[_0xbf27('0x3f')][_0xbf27('0x44')]);_0x445895[_0xbf27('0x33')]=_[_0xbf27('0x32')](_0x918de6['query']);_0x445895[_0xbf27('0x34')]=_[_0xbf27('0x45')](_0x445895[_0xbf27('0x31')],_0x445895[_0xbf27('0x33')]);_0x363d93[_0xbf27('0x35')]=_['intersection'](_0x445895[_0xbf27('0x31')],qs['fields'](_0x918de6[_0xbf27('0x33')]['fields']));_0x363d93[_0xbf27('0x35')]=_0x363d93['attributes'][_0xbf27('0x37')]?_0x363d93[_0xbf27('0x35')]:_0x445895[_0xbf27('0x31')];if(_0x918de6[_0xbf27('0x33')]['includeAll']){_0x363d93[_0xbf27('0x3e')]=[{'all':!![]}];}_0x363d93=_[_0xbf27('0x3c')]({},_0x363d93,_0x918de6[_0xbf27('0x3d')]);return db[_0xbf27('0x3f')][_0xbf27('0x46')](_0x363d93)[_0xbf27('0x27')](handleEntityNotFound(_0x29044f,null))['then'](respondWithResult(_0x29044f,null))[_0xbf27('0x42')](handleError(_0x29044f,null));};exports[_0xbf27('0x47')]=function(_0x347b44,_0x4668aa){return db[_0xbf27('0x3f')][_0xbf27('0x47')](_0x347b44[_0xbf27('0x48')],{})[_0xbf27('0x27')](respondWithResult(_0x4668aa,0xc9))[_0xbf27('0x42')](handleError(_0x4668aa,null));};exports[_0xbf27('0x49')]=function(_0x158ebe,_0x4a6dff){var _0x43f301={'where':{'id':_0x158ebe['params']['id']}},_0x3890e6={};_0x3890e6['model']=_['keys'](db['UserProfile'][_0xbf27('0x44')]);_0x43f301[_0xbf27('0x35')]=_['intersection'](_0x3890e6[_0xbf27('0x31')],qs[_0xbf27('0x36')](_0x158ebe[_0xbf27('0x33')]['fields']));_0x43f301[_0xbf27('0x35')]=_0x43f301[_0xbf27('0x35')]['length']?_0x43f301[_0xbf27('0x35')]:_0x3890e6[_0xbf27('0x31')];if(_0x158ebe[_0xbf27('0x33')]['includeAll']){_0x43f301['include']=[{'all':!![]}];}_0x43f301=_['merge']({},_0x43f301,_0x158ebe['options']);return db[_0xbf27('0x3f')]['find'](_0x43f301)[_0xbf27('0x27')](handleEntityNotFound(_0x4a6dff,null))[_0xbf27('0x27')](function(_0x53896a){if(_0x53896a){var _0x7c4be7=_0x53896a['get']({'plain':!![]});_0x7c4be7=qs[_0xbf27('0x4a')](_0x7c4be7,['id',_0xbf27('0x4b'),_0xbf27('0x4c'),'crudPermissions']);_0x158ebe[_0xbf27('0x48')]=_[_0xbf27('0x4a')](_0x158ebe['body'],['id',_0xbf27('0x4b'),'updatedAt']);return db[_0xbf27('0x4d')][_0xbf27('0x4e')](function(_0x589886){return db['UserProfile'][_0xbf27('0x47')](_[_0xbf27('0x3c')](_0x7c4be7,_0x158ebe[_0xbf27('0x48')]),{'include':_0x158ebe[_0xbf27('0x33')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x589886})[_0xbf27('0x27')](function(_0x2debee){var _0x549c4c=_0x2debee[_0xbf27('0x4f')]({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x158ebe['params']['id']},'raw':!![]})[_0xbf27('0x27')](function(_0x48626d){if(_0x48626d){return BPromise['each'](_0x48626d,function(_0x1a8a98){return new BPromise(function(_0x2bdbf9,_0x3f19bd){if(_0x1a8a98[_0xbf27('0x50')]===null||_0x1a8a98[_0xbf27('0x50')]===0x1)_0x2bdbf9(null);return db[_0xbf27('0x51')][_0xbf27('0x40')]({'where':{'sectionId':_0x1a8a98['id']},'raw':!![]})[_0xbf27('0x27')](function(_0x268fc4){var _0x95d36c=_[_0xbf27('0x2d')](_0x268fc4,function(_0x443c14){return qs[_0xbf27('0x4a')](_0x443c14,['id',_0xbf27('0x4b'),_0xbf27('0x4c'),_0xbf27('0x52')]);});_0x2bdbf9(_0x95d36c);})[_0xbf27('0x42')](function(_0x44acd7){_0x3f19bd(_0x44acd7);});})['then'](function(_0x3bd63a){var _0x3402e4=qs[_0xbf27('0x4a')](_0x1a8a98,['id',_0xbf27('0x4b'),_0xbf27('0x4c')]);_0x3402e4[_0xbf27('0x53')]=_0x549c4c['id'];if(_0x3bd63a)_0x3402e4[_0xbf27('0x54')]=_0x3bd63a;return _0x3402e4;})['then'](function(_0x460806){return db[_0xbf27('0x55')][_0xbf27('0x47')](_0x460806,{'include':[{'model':db[_0xbf27('0x51')],'as':_0xbf27('0x54')}],'raw':!![],'transaction':_0x589886});});})[_0xbf27('0x27')](function(){return _0x549c4c;});}});});});}})['then'](respondWithResult(_0x4a6dff,0xc9))[_0xbf27('0x42')](handleError(_0x4a6dff,null));};exports[_0xbf27('0x56')]=function(_0x4c4d3c,_0x355a81){if(_0x4c4d3c['body']['id']){delete _0x4c4d3c[_0xbf27('0x48')]['id'];}return db[_0xbf27('0x3f')][_0xbf27('0x46')]({'where':{'id':_0x4c4d3c['params']['id']}})['then'](handleEntityNotFound(_0x355a81,null))['then'](saveUpdates(_0x4c4d3c[_0xbf27('0x48')],null))['then'](respondWithResult(_0x355a81,null))[_0xbf27('0x42')](handleError(_0x355a81,null));};exports[_0xbf27('0x26')]=function(_0x40a020,_0x2cf26d){return db[_0xbf27('0x3f')][_0xbf27('0x46')]({'where':{'id':_0x40a020[_0xbf27('0x43')]['id']}})[_0xbf27('0x27')](handleEntityNotFound(_0x2cf26d,null))[_0xbf27('0x27')](removeEntity(_0x2cf26d,null))['catch'](handleError(_0x2cf26d,null));};exports[_0xbf27('0x57')]=function(_0x3298ca,_0x31add9){return db[_0xbf27('0x3f')][_0xbf27('0x57')]()[_0xbf27('0x27')](respondWithResult(_0x31add9,null))[_0xbf27('0x42')](handleError(_0x31add9,null));};exports['addSections']=function(_0x3398c8,_0x38e26f){var _0x2dbd6b=_0x3398c8['body'];return db['UserProfile']['find']({'where':{'id':_0x3398c8['params']['id']}})['then'](handleEntityNotFound(_0x38e26f,null))[_0xbf27('0x27')](function(_0x427e9a){if(_0x427e9a){return db[_0xbf27('0x4d')][_0xbf27('0x4e')](function(_0x2a29fa){return db[_0xbf27('0x55')][_0xbf27('0x26')]({'where':{'userProfileId':_0x3398c8['params']['id'],'sectionId':_[_0xbf27('0x2d')](_0x2dbd6b,function(_0x2d85b1){return _0x2d85b1[_0xbf27('0x52')];})},'transaction':_0x2a29fa})['then'](function(){var _0x699c38=_[_0xbf27('0x2d')](_0x2dbd6b,function(_0x2b5d7d){_0x2b5d7d[_0xbf27('0x53')]=_0x3398c8[_0xbf27('0x43')]['id'];return _0x2b5d7d;});var _0x550cb5=[];return BPromise['each'](_0x699c38,function(_0x1349a2){return db[_0xbf27('0x55')][_0xbf27('0x47')](_0x1349a2,{'include':[{'model':db[_0xbf27('0x51')],'as':_0xbf27('0x54')}],'raw':!![],'transaction':_0x2a29fa})['then'](function(_0x442f36){_0x550cb5[_0xbf27('0x58')](_0x442f36['get']({'plain':!![]}));});})[_0xbf27('0x27')](function(){return _0x550cb5;});});});}})['then'](function(_0x520dfd){return _0x520dfd;})['then'](respondWithResult(_0x38e26f,null))[_0xbf27('0x42')](handleError(_0x38e26f,null));};exports[_0xbf27('0x59')]=function(_0x30b4ab,_0xacd30a){var _0x433e89;return db['UserProfile'][_0xbf27('0x46')]({'where':{'id':_0x30b4ab[_0xbf27('0x43')]['id']},'attributes':['id',_0xbf27('0x2a')]})[_0xbf27('0x27')](handleEntityNotFound(_0xacd30a,null))[_0xbf27('0x27')](function(_0x1fdf4b){if(_0x1fdf4b){_0x433e89=_0x1fdf4b;return db[_0xbf27('0x55')][_0xbf27('0x26')]({'where':{'userProfileId':_0x30b4ab[_0xbf27('0x43')]['id'],'sectionId':_0x30b4ab[_0xbf27('0x33')]['ids']}});}})[_0xbf27('0x27')](function(){return _0x433e89;})[_0xbf27('0x27')](respondWithStatusCode(_0xacd30a,null))['catch'](handleError(_0xacd30a,null));};exports[_0xbf27('0x5a')]=function(_0x256418,_0x286b34){var _0x5d2647=[];var _0x15a471=[];return db[_0xbf27('0x55')][_0xbf27('0x40')]({'where':{'userProfileId':_0x256418['params']['id']},'raw':!![]})['then'](function(_0x567fd9){_0x5d2647=_[_0xbf27('0x3b')](_0x567fd9,function(_0x5f0d41){return _0x5f0d41['enabled']===0x1||_[_0xbf27('0x5b')]([0x3eb,0x709],_0x5f0d41[_0xbf27('0x52')]);});if(!_[_0xbf27('0x5c')](_0x5d2647)){return _[_0xbf27('0x2d')](_0x5d2647,function(_0x1ef58e){return _0x1ef58e[_0xbf27('0x52')];});}else{return;}})['then'](function(_0x54229c){if(_0x54229c)_0x15a471=_0x54229c;if(_[_0xbf27('0x5b')](_0x15a471,0x64)){var _0x3c5fc5=_[_0xbf27('0x46')](_0x5d2647,{'sectionId':0x64});return hasDefaultDashboard(_0x3c5fc5)['then'](function(_0x24f1ca){return _[_0xbf27('0x2d')](_0x5d2647,function(_0x589b58){if(_0x589b58[_0xbf27('0x52')]===0x64){_0x589b58['subsections']=_0x24f1ca;}return _0x589b58;});});}else{return;}})[_0xbf27('0x27')](function(_0x1aa409){if(_0x1aa409)_0x5d2647=_0x1aa409;if(_[_0xbf27('0x5b')](_0x15a471,0x3eb)){var _0x598b33=_['find'](_0x5d2647,{'sectionId':0x3eb});return getCustomDashboards(_0x598b33)[_0xbf27('0x27')](function(_0x151236){return _[_0xbf27('0x2d')](_0x5d2647,function(_0x480d30){if(_0x598b33[_0xbf27('0x5d')]){if(_0x480d30[_0xbf27('0x52')]===0x3eb){_0x480d30[_0xbf27('0x5e')]=_0x151236;}}else{if(_0x480d30[_0xbf27('0x52')]===0x64){_0x480d30[_0xbf27('0x5e')]=_0x151236;}}return _0x480d30;});});}else{return;}})[_0xbf27('0x27')](function(_0x2240aa){if(_0x2240aa)_0x5d2647=_0x2240aa;if(_[_0xbf27('0x5b')](_0x15a471,0x709)){var _0x41f830=_[_0xbf27('0x46')](_0x5d2647,{'sectionId':0x709});return getPlugins(_0x41f830)[_0xbf27('0x27')](function(_0x259587){if(_0x41f830[_0xbf27('0x5d')]){return _[_0xbf27('0x2d')](_0x5d2647,function(_0x44143a){if(_0x44143a[_0xbf27('0x52')]===0x709){_0x44143a[_0xbf27('0x5e')]=_0x259587;}return _0x44143a;});}else{var _0x12c7ae={'sectionId':0x76c,'enabled':0x1,'subsections':_0x259587};var _0x5293e5=_[_0xbf27('0x2d')](_0x5d2647);_0x5293e5[_0xbf27('0x58')](_0x12c7ae);return _0x5293e5;}});}else{return;}})[_0xbf27('0x27')](function(_0x1cccea){if(_0x1cccea)_0x5d2647=_0x1cccea;return _['filter'](_0x5d2647,[_0xbf27('0x5d'),0x1]);})[_0xbf27('0x27')](respondWithResult(_0x286b34,null))[_0xbf27('0x42')](handleError(_0x286b34,null));};function hasDefaultDashboard(_0x18a574){var _0x14833b=[0x65];return new BPromise(function(_0xcb8ae3,_0x142b9f){try{if(_0x18a574['autoAssociation']){_0xcb8ae3(_0x14833b);}else{return db[_0xbf27('0x51')][_0xbf27('0x5f')]({'where':{'sectionId':_0x18a574['id']},'raw':!![]})[_0xbf27('0x27')](function(_0x20e043){_0x20e043?_0xcb8ae3(_0x14833b):_0xcb8ae3();});}}catch(_0x28fee4){_0x142b9f(_0x28fee4);}});}function getCustomDashboards(_0x15cb90){var _0x3e15aa=[];return new BPromise(function(_0x2afc10,_0x45c700){try{if(_0x15cb90[_0xbf27('0x50')]){return db[_0xbf27('0x60')]['findAll']({'raw':!![]})[_0xbf27('0x27')](function(_0x3e7f82){_0x3e7f82[_0xbf27('0x61')](function(_0xa1b521){_0x3e15aa[_0xbf27('0x58')](_0xa1b521['id']+0x1869f);});_0x2afc10(_0x3e15aa);});}else{return db[_0xbf27('0x51')]['findAll']({'where':{'sectionId':_0x15cb90['id']},'raw':!![]})[_0xbf27('0x27')](function(_0x115d95){_0x115d95['forEach'](function(_0x497d42){_0x3e15aa[_0xbf27('0x58')](_0x497d42[_0xbf27('0x62')]+0x1869f);});_0x2afc10(_0x3e15aa);});}}catch(_0x24e93a){_0x45c700(_0x24e93a);}});}function getPlugins(_0x157c8f){var _0x7e3efe=[];return new BPromise(function(_0x39bc6f,_0x1a59b9){try{if(_0x157c8f[_0xbf27('0x50')]){return db['Plugin'][_0xbf27('0x40')]({'raw':!![]})[_0xbf27('0x27')](function(_0x5c8d36){_0x5c8d36[_0xbf27('0x61')](function(_0x27df2b){_0x7e3efe[_0xbf27('0x58')](_0x27df2b['id']+0x15b38);});_0x39bc6f(_0x7e3efe);});}else{return db['UserProfileResource'][_0xbf27('0x40')]({'where':{'sectionId':_0x157c8f['id']},'raw':!![]})[_0xbf27('0x27')](function(_0x4a4c53){_0x4a4c53[_0xbf27('0x61')](function(_0x489c6e){_0x7e3efe['push'](_0x489c6e[_0xbf27('0x62')]+0x15b38);});_0x39bc6f(_0x7e3efe);});}}catch(_0x230a52){_0x1a59b9(_0x230a52);}});}exports['addResources']=function(_0x11a422,_0x307813){return db[_0xbf27('0x3f')]['find']({'where':{'id':_0x11a422['params']['id']}})[_0xbf27('0x27')](handleEntityNotFound(_0x307813,null))[_0xbf27('0x27')](function(_0x3801fd){if(_0x3801fd){return db[_0xbf27('0x4d')][_0xbf27('0x4e')](function(_0x46e7cd){return db[_0xbf27('0x55')][_0xbf27('0x40')]({'where':{'userProfileId':_0x11a422[_0xbf27('0x43')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x51aeae){if(_0x51aeae){return db[_0xbf27('0x55')][_0xbf27('0x26')]({'where':{'userProfileId':_0x11a422['params']['id'],'id':_[_0xbf27('0x2d')](_0x51aeae,function(_0x2361d4){return _0x2361d4['id'];})},'transaction':_0x46e7cd});}})['then'](function(_0x16728d){var _0x470488=_['map'](_0x11a422[_0xbf27('0x48')],function(_0x21d545){_0x21d545['userProfileId']=_0x11a422[_0xbf27('0x43')]['id'];return _0x21d545;});return db[_0xbf27('0x55')][_0xbf27('0x63')](_0x470488,{'raw':!![],'transaction':_0x46e7cd});})[_0xbf27('0x27')](function(_0x29434a){var _0x1ee6d7=_['filter'](_[_0xbf27('0x2d')](_0x29434a,function(_0x3e0260){return _0x3e0260[_0xbf27('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x1ee6d7){return db[_0xbf27('0x55')][_0xbf27('0x40')]({'where':{'userProfileId':_0x11a422['params']['id'],'sectionId':_['map'](_0x1ee6d7,function(_0x265b24){return _0x265b24['sectionId'];})},'attributes':['id',_0xbf27('0x52')],'raw':!![]})['then'](function(_0x4acaf0){var _0x57f1ba=_[_0xbf27('0x2d')](_0x11a422[_0xbf27('0x48')],function(_0x52cdfc){_0x52cdfc[_0xbf27('0x53')]=_0x11a422['params']['id'];return _0x52cdfc;});return db['UserProfileResource'][_0xbf27('0x63')](_0x57f1ba,{'raw':!![],'transaction':_0x46e7cd});});}})[_0xbf27('0x42')](handleError(_0x307813,null));});}})[_0xbf27('0x27')](function(_0x45260c){var _0x38cbff=_['map'](_0x45260c,function(_0x2c7b0a){return _0x2c7b0a[_0xbf27('0x4f')]({'plain':!![]});});})[_0xbf27('0x27')](respondWithResult(_0x307813,null))['catch'](handleError(_0x307813,null));};exports['removeResources']=function(_0x5c8597,_0x275fa9,_0x3e7f1b){return db[_0xbf27('0x3f')][_0xbf27('0x46')]({'where':{'id':_0x5c8597[_0xbf27('0x43')]['id']}})[_0xbf27('0x27')](handleEntityNotFound(_0x275fa9,null))[_0xbf27('0x27')](function(_0xb4b1ea){if(_0xb4b1ea){return _0xb4b1ea[_0xbf27('0x64')](_0x5c8597[_0xbf27('0x33')][_0xbf27('0x65')]);}})[_0xbf27('0x27')](respondWithStatusCode(_0x275fa9,null))['catch'](handleError(_0x275fa9,null));};exports[_0xbf27('0x66')]=function(_0x56d5fa,_0x40e894){var _0x590e73={'raw':![],'where':{}};var _0x4cba7b={};var _0x5bef53={'count':0x0,'rows':[]};var _0x31371d=_0x56d5fa[_0xbf27('0x33')][_0xbf27('0x67')];if(typeof _0x31371d===_0xbf27('0x68')){throw new db['Sequelize'][(_0xbf27('0x69'))]('Unknown\x20section');}var _0x2b75a1=_0x56d5fa[_0xbf27('0x33')][_0xbf27('0x6a')]||![];var _0x599e49=getQueryModels(_0x31371d,_0x2b75a1);if(typeof _0x599e49[_0xbf27('0x6b')]==='undefined'){throw new db['Sequelize'][(_0xbf27('0x69'))](_0xbf27('0x6c')+_0x31371d+'\x27');}var _0xf0096a=[];if(!_['isEmpty'](_0x599e49[_0xbf27('0x6d')])){_0xf0096a=_0x599e49[_0xbf27('0x6d')];}else{_0xf0096a=[{'name':_0x31371d}];}return db[_0xbf27('0x3f')][_0xbf27('0x5f')]({'where':{'id':_0x56d5fa['params']['id']}})[_0xbf27('0x27')](handleEntityNotFound(_0x40e894,null))[_0xbf27('0x27')](function(_0x189206){if(_0x189206){var _0x1328af=[];for(var _0x3b9905=0x0;_0x3b9905<_0xf0096a[_0xbf27('0x37')];_0x3b9905++){_0x1328af[_0xbf27('0x58')](db['UserProfileSection'][_0xbf27('0x5f')]({'where':{'userProfileId':_0x189206['id'],'name':_0xf0096a[_0x3b9905][_0xbf27('0x2a')]},'raw':!![]}));}return BPromise[_0xbf27('0x6e')](_0x1328af);}})[_0xbf27('0x27')](function(_0x74bd14){var _0x1f5ce=_[_0xbf27('0x3b')](_0x74bd14,function(_0x375955){return _0x375955?_0x375955:undefined;});var _0x3559d9=_[_0xbf27('0x3b')](_0xf0096a,['ignore',!![]]);var _0x1515e7=_['isEmpty'](_0x1f5ce)&&_[_0xbf27('0x5c')](_0x3559d9)?null:_['union'](_0x3559d9,_0x1f5ce);if(_0x1515e7){var _0x5e59f8=[];for(var _0x4cc81b=0x0;_0x4cc81b<_0x1515e7[_0xbf27('0x37')];_0x4cc81b++){var _0x1a59b5=_[_0xbf27('0x46')](_0xf0096a,function(_0x2adc2d){return _0x1515e7[_0x4cc81b]?_0x2adc2d['name']===_0x1515e7[_0x4cc81b][_0xbf27('0x2a')]:null;});if(_0x1a59b5){if(_0x1515e7[_0x4cc81b][_0xbf27('0x6f')]){_0x5e59f8[_0xbf27('0x58')](getAllResources(_0x599e49[_0xbf27('0x6b')],_0x1515e7[_0x4cc81b]));}else{if(!_0x1515e7[_0x4cc81b]['autoAssociation']){_0x5e59f8[_0xbf27('0x58')](getAllowedResources(_0x1a59b5,_0x1515e7[_0x4cc81b],_0x599e49[_0xbf27('0x6b')]));}else{if(_0x1a59b5['model']){_0x5e59f8['push'](getAllFilteredResources(_0x1a59b5,_0x1515e7[_0x4cc81b]));}}}}}return BPromise['all'](_0x5e59f8);}else{return null;}})[_0xbf27('0x27')](function(_0x4aedd8){var _0x69127e=_0x4aedd8;var _0x4985d6=null;if(_0x69127e){_0x4985d6=_0x69127e[_0xbf27('0x37')]===0x1?_0x69127e[0x0]:null;}if(_0x4985d6||_0x69127e){var _0x17159e=db[_0x599e49['childModel']][_0xbf27('0x44')];_0x4cba7b['model']=_[_0xbf27('0x32')](_0x17159e);_0x4cba7b[_0xbf27('0x33')]=_[_0xbf27('0x32')](_0x56d5fa[_0xbf27('0x33')]);_0x4cba7b[_0xbf27('0x34')]=_[_0xbf27('0x45')](_0x4cba7b[_0xbf27('0x31')],_0x4cba7b[_0xbf27('0x33')]);_0x590e73[_0xbf27('0x35')]=_[_0xbf27('0x45')](_0x4cba7b[_0xbf27('0x31')],qs['fields'](_0x56d5fa['query']['fields']));_0x590e73[_0xbf27('0x35')]=_0x590e73[_0xbf27('0x35')][_0xbf27('0x37')]?_0x590e73['attributes']:_0x4cba7b['model'];if(!_0x56d5fa['query']['hasOwnProperty'](_0xbf27('0x70'))){_0x590e73[_0xbf27('0x21')]=qs[_0xbf27('0x21')](_0x56d5fa[_0xbf27('0x33')][_0xbf27('0x21')]);_0x590e73['offset']=qs[_0xbf27('0x20')](_0x56d5fa[_0xbf27('0x33')][_0xbf27('0x20')]);}_0x590e73[_0xbf27('0x71')]=qs[_0xbf27('0x39')](_0x56d5fa[_0xbf27('0x33')][_0xbf27('0x39')]);_0x590e73[_0xbf27('0x3a')]=qs[_0xbf27('0x34')](_['pick'](_0x56d5fa['query'],_0x4cba7b[_0xbf27('0x34')]));if(_0x56d5fa[_0xbf27('0x33')]['filter']){_0x590e73[_0xbf27('0x3a')]=_[_0xbf27('0x3c')](_0x590e73['where'],{'$or':_[_0xbf27('0x2d')](_0x17159e,function(_0x3d21a9){if(_0x3d21a9[_0xbf27('0x2f')][_0xbf27('0x30')]!==_0xbf27('0x72')){var _0xbd671c={};_0xbd671c[_0x3d21a9[_0xbf27('0x73')]]={'$like':'%'+_0x56d5fa['query'][_0xbf27('0x3b')]+'%'};return _0xbd671c;}})});}var _0x1694d0=[];if(_0x4985d6){var _0x2ca4ed=_[_0xbf27('0x46')](_0xf0096a,['name',_0x4985d6['name']]);if(_0x2ca4ed[_0xbf27('0x73')]){var _0x184737={};if(_0x599e49[_0xbf27('0x6b')]==='AnalyticExtractedReport'){_0x184737[_0x2ca4ed[_0xbf27('0x74')]]=_[_0xbf27('0x2d')](_0x4985d6[_0xbf27('0x75')],'id');}else{_0x184737[_0x2ca4ed[_0xbf27('0x74')]]=_0x4985d6[_0xbf27('0x75')];}_0x1694d0[_0xbf27('0x58')](_0x184737);}else{_0x590e73[_0xbf27('0x3a')]['id']=_0x4985d6['associatedResources'];}}else{for(var _0x49c8e6=0x0;_0x49c8e6<_0x69127e[_0xbf27('0x37')];_0x49c8e6++){var _0x2ca4ed=_[_0xbf27('0x46')](_0xf0096a,[_0xbf27('0x2a'),_0x69127e[_0x49c8e6][_0xbf27('0x2a')]]);if(_0x2ca4ed[_0xbf27('0x73')]){var _0x184737={};_0x184737[_0x2ca4ed[_0xbf27('0x74')]]=_0x69127e[_0x49c8e6][_0xbf27('0x75')];_0x1694d0[_0xbf27('0x58')](_0x184737);}else{if(!_0x590e73[_0xbf27('0x3a')]['id'])_0x590e73['where']['id']=[];_0x69127e[_0x49c8e6][_0xbf27('0x75')][_0xbf27('0x61')](function(_0x1c2b4e){_0x590e73['where']['id'][_0xbf27('0x58')](_0x1c2b4e);});}}}if(!_[_0xbf27('0x5c')](_0x1694d0)){_0x590e73['where']=_['merge'](_0x590e73[_0xbf27('0x3a')],{'$and':{'$or':_0x1694d0}});}_0x590e73=_['merge']({},_0x590e73,_0x56d5fa[_0xbf27('0x3d')]);if(_0x4985d6&&!_0x4985d6[_0xbf27('0x50')]&&_0x599e49['childModel']===_0xbf27('0x76')){if(_0x56d5fa[_0xbf27('0x33')][_0xbf27('0x77')]){_0x590e73['include']=[{'all':!![]}];}return db[_0x599e49['childModel']]['findAll'](_0x590e73)[_0xbf27('0x27')](function(_0x140a27){var _0x176916=[];_0x140a27[_0xbf27('0x61')](function(_0x4b57df){var _0x576d38;switch(_0x4b57df[_0xbf27('0x78')]){case'default':_0x576d38=_['find'](_0x4985d6[_0xbf27('0x75')],function(_0x26fba3){return _0x26fba3['id']===_0x4b57df['reportId']&&_0x26fba3[_0xbf27('0x2f')]===_0xbf27('0x79');});break;case _0xbf27('0x7a'):_0x576d38=_['find'](_0x4985d6['associatedResources'],function(_0x3e7e36){return _0x3e7e36['id']===_0x4b57df[_0xbf27('0x7b')]&&_0x3e7e36['type']===_0xbf27('0x7c');});break;}if(_0x576d38)_0x176916[_0xbf27('0x58')](_0x4b57df);});_0x5bef53[_0xbf27('0x1f')]=_0x176916['length'];_0x5bef53['rows']=_0x176916;return _0x5bef53;});}else{return db[_0x599e49['childModel']][_0xbf27('0x1f')]({'where':_0x590e73[_0xbf27('0x3a')]})[_0xbf27('0x27')](function(_0x1f7f2a){_0x5bef53[_0xbf27('0x1f')]=_0x1f7f2a;if(_0x56d5fa[_0xbf27('0x33')][_0xbf27('0x77')]){if(_0x599e49['childModel']===_0xbf27('0x7d')){_0x590e73[_0xbf27('0x3e')]=[{'model':db[_0xbf27('0x7e')],'as':_0xbf27('0x7f'),'attributes':['id',_0xbf27('0x2a'),_0xbf27('0x80')],'required':_0x56d5fa[_0xbf27('0x33')]['tag']?!![]:![]},{'model':db[_0xbf27('0x7e')],'as':_0xbf27('0x81'),'attributes':['id',_0xbf27('0x2a'),_0xbf27('0x80')],'through':_0x56d5fa[_0xbf27('0x33')]['tag']?{'attributes':[],'where':{'TagId':_0x56d5fa['query'][_0xbf27('0x82')]||undefined}}:{},'required':_0x56d5fa[_0xbf27('0x33')][_0xbf27('0x82')]?!![]:![]}];}else{_0x590e73[_0xbf27('0x3e')]=[{'all':!![]}];}}return db[_0x599e49[_0xbf27('0x6b')]][_0xbf27('0x40')](_0x590e73);})[_0xbf27('0x27')](function(_0x2eeb2f){_0x5bef53[_0xbf27('0x41')]=_0x2eeb2f;return _0x5bef53;});}}else{return _0x5bef53;}})[_0xbf27('0x27')](respondWithFilteredResult(_0x40e894,_0x590e73))['catch'](handleError(_0x40e894,null));};function getAllResources(_0x5844a3,_0x4f3f5f){return new BPromise(function(_0x15a93f,_0x492983){if(_0x4f3f5f){var _0x3d8f59=_0x4f3f5f['filter']?{[_0x4f3f5f[_0xbf27('0x3b')][_0xbf27('0x73')]]:_0x4f3f5f['filter'][_0xbf27('0x83')]}:undefined;return db[_0x5844a3][_0xbf27('0x40')]({'where':_0x3d8f59,'raw':!![]})[_0xbf27('0x27')](function(_0x1fab99){_0x4f3f5f[_0xbf27('0x75')]=_[_0xbf27('0x2d')](_0x1fab99,'id');_0x15a93f(_0x4f3f5f);})[_0xbf27('0x42')](function(_0x548fa7){_0x492983(_0x548fa7);});}else{_0x15a93f(null);}});}function getAllFilteredResources(_0x133784,_0x51a9f7){return new BPromise(function(_0x1f68af,_0x43066c){var _0x2bcb86=_0x133784['filter']?{[_0x133784[_0xbf27('0x3b')]['field']]:_0x133784['filter']['value']}:undefined;return db[_0x133784[_0xbf27('0x31')]][_0xbf27('0x40')]({'where':_0x2bcb86,'raw':!![]})[_0xbf27('0x27')](function(_0x447bac){_0x51a9f7[_0xbf27('0x75')]=_['map'](_0x447bac,function(_0x13d406){return _0x13d406['name'];});_0x1f68af(_0x51a9f7);})['catch'](function(_0xc28a2d){_0x43066c(_0xc28a2d);});});}function getAllowedResources(_0x2841b2,_0x2692ff,_0x5747a2){return new BPromise(function(_0x5b2250,_0x4f3b19){if(_0x2692ff){return db[_0xbf27('0x51')]['findAll']({'where':{'sectionId':_0x2692ff['id']},'raw':!![]})['then'](function(_0x429cac){if(_0x2841b2[_0xbf27('0x73')]&&_0x2841b2[_0xbf27('0x73')]!=='id'){_0x2692ff[_0xbf27('0x75')]=_[_0xbf27('0x2d')](_0x429cac,function(_0x1836dc){return _0x1836dc[_0x2841b2[_0xbf27('0x73')]];});}else{if(_0x5747a2===_0xbf27('0x76')){_0x2692ff['associatedResources']=_[_0xbf27('0x2d')](_0x429cac,function(_0x1f5f15){return{'id':_0x1f5f15[_0xbf27('0x62')],'type':_0x1f5f15['type']};});}else{_0x2692ff[_0xbf27('0x75')]=_[_0xbf27('0x2d')](_0x429cac,function(_0x557069){return _0x557069[_0xbf27('0x62')];});}}_0x5b2250(_0x2692ff);})['catch'](function(_0x40f5c1){_0x4f3b19(_0x40f5c1);});}else{_0x5b2250(null);}});}function getQueryModels(_0x51b9bc,_0x33579f){var _0x2c6c14=_0x51b9bc[_0xbf27('0x84')]();var _0x27ec55={'childModel':undefined,'parentSections':[]};switch(_0x2c6c14){case _0xbf27('0x85'):_0x27ec55['childModel']=_0xbf27('0x86');break;case _0xbf27('0x87'):_0x27ec55[_0xbf27('0x6b')]='SquareOdbc';break;case _0xbf27('0x88'):_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0x89');_0x27ec55['parentSections']=[{'name':_0xbf27('0x8a'),'field':_0xbf27('0x2a'),'foreignKey':_0xbf27('0x8b')}];break;case'projects':_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0x8c');break;case'contacts':_0x27ec55[_0xbf27('0x6b')]='CmContact';_0x27ec55[_0xbf27('0x6d')]=[{'name':'Lists','field':'id','foreignKey':_0xbf27('0x8d')}];break;case _0xbf27('0x8e'):_0x27ec55[_0xbf27('0x6b')]='CmList';break;case'companies':_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0x8f');break;case _0xbf27('0x90'):_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0x91');break;case _0xbf27('0x92'):_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0x93');break;case _0xbf27('0x94'):_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0x95');break;case _0xbf27('0x96'):_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0x97');break;case'faxaccounts':_0x27ec55['childModel']=_0xbf27('0x98');break;case _0xbf27('0x99'):case _0xbf27('0x9a'):case _0xbf27('0x9b'):_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0x9c');break;case _0xbf27('0x9d'):_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0x9e');break;case'voicemails':_0x27ec55[_0xbf27('0x6b')]='VoiceMail';break;case _0xbf27('0x9f'):_0x27ec55['childModel']=_0xbf27('0xa0');_0x27ec55[_0xbf27('0x6d')]=[{'name':'Agents','field':_0xbf27('0x2a'),'foreignKey':_0xbf27('0xa1'),'model':'User','filter':{'field':_0xbf27('0xa2'),'value':[_0xbf27('0xa3')]}},{'name':_0xbf27('0xa4'),'field':_0xbf27('0x2a'),'foreignKey':_0xbf27('0xa1'),'model':_0xbf27('0xa5'),'filter':{'field':_0xbf27('0xa2'),'value':[_0xbf27('0xa6')]}},{'name':_0xbf27('0xa7'),'field':_0xbf27('0x2a'),'foreignKey':_0xbf27('0xa8'),'model':_0xbf27('0xa9'),'filter':{'field':_0xbf27('0x2f'),'value':['inbound']}},{'name':'QueueCampaigns','field':_0xbf27('0x2a'),'foreignKey':_0xbf27('0xa8'),'model':_0xbf27('0xa9'),'filter':{'field':'type','value':[_0xbf27('0xaa')]}}];break;case _0xbf27('0xab'):_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0xac');break;case _0xbf27('0xad'):_0x27ec55['childModel']=_0xbf27('0xae');break;case _0xbf27('0xaf'):_0x27ec55['childModel']=_0xbf27('0xb0');break;case _0xbf27('0xb1'):_0x27ec55[_0xbf27('0x6b')]='Campaign';break;case'mailqueues':_0x27ec55[_0xbf27('0x6b')]='MailQueue';break;case _0xbf27('0xb2'):_0x27ec55['childModel']='MailAccount';break;case _0xbf27('0xb3'):_0x27ec55[_0xbf27('0x6b')]='MailSubstatus';break;case _0xbf27('0xb4'):_0x27ec55['childModel']='OpenchannelQueue';break;case _0xbf27('0xb5'):_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0xb6');break;case _0xbf27('0xb7'):_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0xb8');break;case _0xbf27('0xb9'):_0x27ec55[_0xbf27('0x6b')]='SmsAccount';break;case _0xbf27('0xba'):_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0xbb');break;case _0xbf27('0xbc'):_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0xbd');break;case _0xbf27('0xbe'):_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0xbf');break;case _0xbf27('0xc0'):case'queuecampaigns':_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0xa9');if(_0x33579f){_0x27ec55[_0xbf27('0x6d')]=[{'name':_0xbf27('0xa7')},{'name':_0xbf27('0xc1')}];}break;case'users':case _0xbf27('0xc2'):case _0xbf27('0xc3'):_0x27ec55['childModel']='User';if(_0x33579f){_0x27ec55[_0xbf27('0x6d')]=[{'name':_0xbf27('0xc4'),'filter':{'field':'role','value':[_0xbf27('0xc5'),_0xbf27('0xc6')]},'ignore':!![]},{'name':_0xbf27('0xc7')},{'name':_0xbf27('0xa4')}];}break;case'zendeskaccounts':_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0xc8');break;case _0xbf27('0xc9'):_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0xca');break;case _0xbf27('0xcb'):_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0xcc');break;case'sugarcrmaccounts':_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0xcd');break;case _0xbf27('0xce'):_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0xcf');break;case _0xbf27('0xd0'):_0x27ec55[_0xbf27('0x6b')]='ZohoAccount';break;case'vtigeraccounts':_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0xa5');break;case _0xbf27('0xd1'):_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0xd2');break;case _0xbf27('0xd3'):_0x27ec55['childModel']=_0xbf27('0xd4');break;case _0xbf27('0xd5'):_0x27ec55['childModel']='Dashboard';break;case _0xbf27('0xd6'):_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0xd7');break;case _0xbf27('0xd8'):_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0xd9');break;case _0xbf27('0xda'):_0x27ec55['childModel']=_0xbf27('0xdb');break;case _0xbf27('0xdc'):_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0xdd');break;case _0xbf27('0xde'):_0x27ec55['childModel']=_0xbf27('0x7e');break;case'templates':_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0xdf');break;case'triggers':_0x27ec55[_0xbf27('0x6b')]='Trigger';break;case'trunks':_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0xe0');break;case _0xbf27('0xe1'):_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0xe2');break;case'plugins':_0x27ec55[_0xbf27('0x6b')]='Plugin';break;case _0xbf27('0xe3'):_0x27ec55[_0xbf27('0x6b')]='AnalyticExtractedReport';_0x27ec55[_0xbf27('0x6d')]=[{'name':_0xbf27('0xe4'),'field':'id','foreignKey':_0xbf27('0x7b')}];break;case _0xbf27('0xe5'):_0x27ec55[_0xbf27('0x6b')]='AnalyticMetric';break;case _0xbf27('0xbc'):_0x27ec55[_0xbf27('0x6b')]=_0xbf27('0xbd');break;default:return _0x27ec55;}return _0x27ec55;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 9127667..42d416c 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 _0xe69c=['emit','hasOwnProperty','hook','exports','events','UserProfile','setMaxListeners','save','update','remove'];(function(_0x2445b3,_0x80f4ce){var _0x5a6d7d=function(_0x278051){while(--_0x278051){_0x2445b3['push'](_0x2445b3['shift']());}};_0x5a6d7d(++_0x80f4ce);}(_0xe69c,0x112));var _0xce69=function(_0x5c6923,_0x43d0ec){_0x5c6923=_0x5c6923-0x0;var _0x3483c8=_0xe69c[_0x5c6923];return _0x3483c8;};'use strict';var EventEmitter=require(_0xce69('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xce69('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xce69('0x2')](0x0);var events={'afterCreate':_0xce69('0x3'),'afterUpdate':_0xce69('0x4'),'afterDestroy':_0xce69('0x5')};function emitEvent(_0xda573d){return function(_0x3bcca5,_0x2cb355,_0x13bed9){UserProfileEvents['emit'](_0xda573d+':'+_0x3bcca5['id'],_0x3bcca5);UserProfileEvents[_0xce69('0x6')](_0xda573d,_0x3bcca5);_0x13bed9(null);};}for(var e in events){if(events[_0xce69('0x7')](e)){var event=events[e];UserProfile[_0xce69('0x8')](e,emitEvent(event));}}module[_0xce69('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x7394=['UserProfile','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x174fda,_0x468f03){var _0x47c769=function(_0x52bf14){while(--_0x52bf14){_0x174fda['push'](_0x174fda['shift']());}};_0x47c769(++_0x468f03);}(_0x7394,0x86));var _0x4739=function(_0x3a1379,_0x3a8ee4){_0x3a1379=_0x3a1379-0x0;var _0x380cc5=_0x7394[_0x3a1379];return _0x380cc5;};'use strict';var EventEmitter=require(_0x4739('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x4739('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4739('0x2'),'afterUpdate':_0x4739('0x3'),'afterDestroy':_0x4739('0x4')};function emitEvent(_0x250ab0){return function(_0x1aba4f,_0x4e8fd4,_0x235ce0){UserProfileEvents[_0x4739('0x5')](_0x250ab0+':'+_0x1aba4f['id'],_0x1aba4f);UserProfileEvents['emit'](_0x250ab0,_0x1aba4f);_0x235ce0(null);};}for(var e in events){if(events[_0x4739('0x6')](e)){var event=events[e];UserProfile[_0x4739('0x7')](e,emitEvent(event));}}module[_0x4739('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 69fc774..5b23ce7 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 _0xed9d=['lodash','util','api','bluebird','request-promise','path','rimraf','exports','define','UserProfile'];(function(_0x1fc3e3,_0x5778db){var _0x502b11=function(_0x23b623){while(--_0x23b623){_0x1fc3e3['push'](_0x1fc3e3['shift']());}};_0x502b11(++_0x5778db);}(_0xed9d,0x14a));var _0xded9=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xed9d[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xded9('0x0'));var util=require(_0xded9('0x1'));var logger=require('../../config/logger')(_0xded9('0x2'));var moment=require('moment');var BPromise=require(_0xded9('0x3'));var rp=require(_0xded9('0x4'));var fs=require('fs');var path=require(_0xded9('0x5'));var rimraf=require(_0xded9('0x6'));var config=require('../../config/environment');var attributes=require('./userProfile.attributes');module[_0xded9('0x7')]=function(_0x401c87,_0x40edfa){return _0x401c87[_0xded9('0x8')](_0xded9('0x9'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9756=['../../config/logger','api','moment','request-promise','path','rimraf','./userProfile.attributes','exports','UserProfile','user_profiles','lodash','util'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9756,0x11e));var _0x6975=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x9756[_0x1928c9];return _0x51b5fb;};'use strict';var _=require(_0x6975('0x0'));var util=require(_0x6975('0x1'));var logger=require(_0x6975('0x2'))(_0x6975('0x3'));var moment=require(_0x6975('0x4'));var BPromise=require('bluebird');var rp=require(_0x6975('0x5'));var fs=require('fs');var path=require(_0x6975('0x6'));var rimraf=require(_0x6975('0x7'));var config=require('../../config/environment');var attributes=require(_0x6975('0x8'));module[_0x6975('0x9')]=function(_0x221cd8,_0x4ca5bb){return _0x221cd8['define'](_0x6975('0xa'),attributes,{'tableName':_0x6975('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 1c6c3b3..e6e30ea 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 _0x98a8=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./userProfile.socket','register','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','code','UserProfile,\x20%s,\x20%s'];(function(_0x619753,_0x31dbc4){var _0x14a1bc=function(_0x23ad0e){while(--_0x23ad0e){_0x619753['push'](_0x619753['shift']());}};_0x14a1bc(++_0x31dbc4);}(_0x98a8,0x12c));var _0x898a=function(_0x27a7e7,_0x506c03){_0x27a7e7=_0x27a7e7-0x0;var _0x134061=_0x98a8[_0x27a7e7];return _0x134061;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var moment=require(_0x898a('0x2'));var BPromise=require(_0x898a('0x3'));var rs=require(_0x898a('0x4'));var fs=require('fs');var Redis=require(_0x898a('0x5'));var db=require(_0x898a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x898a('0x7'))(_0x898a('0x8'));var config=require(_0x898a('0x9'));var jayson=require(_0x898a('0xa'));var client=jayson[_0x898a('0xb')]['http']({'port':0x232a});config[_0x898a('0xc')]=_['defaults'](config[_0x898a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x898a('0xd'))(new Redis(config[_0x898a('0xc')]));require(_0x898a('0xe'))[_0x898a('0xf')](socket);function respondWithRpcPromise(_0x3150df,_0x388a47,_0x42faa4){return new BPromise(function(_0x1a92de,_0x3806cb){return client['request'](_0x3150df,_0x42faa4)[_0x898a('0x10')](function(_0x502e95){logger[_0x898a('0x11')]('UserProfile,\x20%s,\x20%s',_0x388a47,_0x898a('0x12'));logger[_0x898a('0x13')](_0x898a('0x14'),_0x388a47,'request\x20sent',JSON['stringify'](_0x502e95));if(_0x502e95['error']){if(_0x502e95[_0x898a('0x15')][_0x898a('0x16')]===0x1f4){logger[_0x898a('0x15')](_0x898a('0x17'),_0x388a47,_0x502e95[_0x898a('0x15')][_0x898a('0x18')]);return _0x3806cb(_0x502e95['error'][_0x898a('0x18')]);}logger['error'](_0x898a('0x17'),_0x388a47,_0x502e95['error'][_0x898a('0x18')]);return _0x1a92de(_0x502e95['error'][_0x898a('0x18')]);}else{logger['info'](_0x898a('0x17'),_0x388a47,_0x898a('0x12'));_0x1a92de(_0x502e95[_0x898a('0x19')]['message']);}})[_0x898a('0x1a')](function(_0x5960e0){logger['error'](_0x898a('0x17'),_0x388a47,_0x5960e0);_0x3806cb(_0x5960e0);});});} \ No newline at end of file +var _0x7217=['then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x7217,0x19e));var _0x7721=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x7217[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});config[_0x7721('0xb')]=_[_0x7721('0xc')](config[_0x7721('0xb')],{'host':_0x7721('0xd'),'port':0x18eb});var socket=require(_0x7721('0xe'))(new Redis(config[_0x7721('0xb')]));require(_0x7721('0xf'))[_0x7721('0x10')](socket);function respondWithRpcPromise(_0x138740,_0x2c3986,_0x578d59){return new BPromise(function(_0x461d1a,_0x29bc8f){return client[_0x7721('0x11')](_0x138740,_0x578d59)[_0x7721('0x12')](function(_0xa8977c){logger[_0x7721('0x13')](_0x7721('0x14'),_0x2c3986,_0x7721('0x15'));logger['debug'](_0x7721('0x16'),_0x2c3986,_0x7721('0x15'),JSON['stringify'](_0xa8977c));if(_0xa8977c[_0x7721('0x17')]){if(_0xa8977c[_0x7721('0x17')][_0x7721('0x18')]===0x1f4){logger[_0x7721('0x17')]('UserProfile,\x20%s,\x20%s',_0x2c3986,_0xa8977c[_0x7721('0x17')][_0x7721('0x19')]);return _0x29bc8f(_0xa8977c['error']['message']);}logger['error'](_0x7721('0x14'),_0x2c3986,_0xa8977c[_0x7721('0x17')][_0x7721('0x19')]);return _0x461d1a(_0xa8977c[_0x7721('0x17')]['message']);}else{logger[_0x7721('0x13')]('UserProfile,\x20%s,\x20%s',_0x2c3986,_0x7721('0x15'));_0x461d1a(_0xa8977c['result'][_0x7721('0x19')]);}})[_0x7721('0x1a')](function(_0x3ab5a5){logger[_0x7721('0x17')](_0x7721('0x14'),_0x2c3986,_0x3ab5a5);_0x29bc8f(_0x3ab5a5);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 9cb60fa..a248026 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 _0x2d10=['save','remove','update','emit','removeListener','register','userProfile:','./userProfile.events'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x2d10,0x15f));var _0x02d1=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x2d10[_0x46e363];return _0x3fb059;};'use strict';var UserProfileEvents=require(_0x02d1('0x0'));var events=[_0x02d1('0x1'),_0x02d1('0x2'),_0x02d1('0x3')];function createListener(_0x33532e,_0x2c01e3){return function(_0x2f355a){_0x2c01e3[_0x02d1('0x4')](_0x33532e,_0x2f355a);};}function removeListener(_0x26068c,_0x145ea6){return function(){UserProfileEvents[_0x02d1('0x5')](_0x26068c,_0x145ea6);};}exports[_0x02d1('0x6')]=function(_0x404db5){for(var _0x2b1050=0x0,_0x1e822d=events['length'];_0x2b1050<_0x1e822d;_0x2b1050++){var _0x3093bf=events[_0x2b1050];var _0x39d5e2=createListener(_0x02d1('0x7')+_0x3093bf,_0x404db5);UserProfileEvents['on'](_0x3093bf,_0x39d5e2);}}; \ No newline at end of file +var _0xbaec=['./userProfile.events','save','remove','update','emit','removeListener','length'];(function(_0x990052,_0x28b108){var _0x36f959=function(_0x41fe71){while(--_0x41fe71){_0x990052['push'](_0x990052['shift']());}};_0x36f959(++_0x28b108);}(_0xbaec,0x16c));var _0xcbae=function(_0x4102a1,_0x2baefd){_0x4102a1=_0x4102a1-0x0;var _0x443434=_0xbaec[_0x4102a1];return _0x443434;};'use strict';var UserProfileEvents=require(_0xcbae('0x0'));var events=[_0xcbae('0x1'),_0xcbae('0x2'),_0xcbae('0x3')];function createListener(_0x5b3735,_0x805c85){return function(_0x409969){_0x805c85[_0xcbae('0x4')](_0x5b3735,_0x409969);};}function removeListener(_0x57e6de,_0x38206b){return function(){UserProfileEvents[_0xcbae('0x5')](_0x57e6de,_0x38206b);};}exports['register']=function(_0x4d8b8e){for(var _0x209f82=0x0,_0x2c3610=events[_0xcbae('0x6')];_0x209f82<_0x2c3610;_0x209f82++){var _0xa092=events[_0x209f82];var _0x47db9f=createListener('userProfile:'+_0xa092,_0x4d8b8e);UserProfileEvents['on'](_0xa092,_0x47db9f);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 645b794..49a3a7b 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 _0xedd0=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xedd0,0x6c));var _0x0edd=function(_0xc902a3,_0x35d2df){_0xc902a3=_0xc902a3-0x0;var _0x20745b=_0xedd0[_0xc902a3];return _0x20745b;};'use strict';var multer=require(_0x0edd('0x0'));var util=require(_0x0edd('0x1'));var path=require(_0x0edd('0x2'));var timeout=require('connect-timeout');var express=require(_0x0edd('0x3'));var router=express[_0x0edd('0x4')]();var auth=require(_0x0edd('0x5'));var interaction=require(_0x0edd('0x6'));var config=require(_0x0edd('0x7'));var controller=require(_0x0edd('0x8'));router[_0x0edd('0x9')]('/',auth[_0x0edd('0xa')](),controller[_0x0edd('0xb')]);router[_0x0edd('0x9')](_0x0edd('0xc'),auth['isAuthenticated'](),controller[_0x0edd('0xd')]);router['get'](_0x0edd('0xe'),auth[_0x0edd('0xa')](),controller[_0x0edd('0xf')]);router['post']('/',auth[_0x0edd('0xa')](),controller[_0x0edd('0x10')]);router[_0x0edd('0x11')]('/:id',auth[_0x0edd('0xa')](),controller[_0x0edd('0x12')]);router[_0x0edd('0x13')](_0x0edd('0xe'),auth[_0x0edd('0xa')](),controller[_0x0edd('0x14')]);module[_0x0edd('0x15')]=router; \ No newline at end of file +var _0xfc8f=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index','isAuthenticated','describe','/:id','show','post','update','delete','destroy','exports'];(function(_0x21b197,_0x48e65d){var _0x5c23df=function(_0x13997e){while(--_0x13997e){_0x21b197['push'](_0x21b197['shift']());}};_0x5c23df(++_0x48e65d);}(_0xfc8f,0xa0));var _0xffc8=function(_0x4eafb6,_0xe76a6c){_0x4eafb6=_0x4eafb6-0x0;var _0x372f6f=_0xfc8f[_0x4eafb6];return _0x372f6f;};'use strict';var multer=require(_0xffc8('0x0'));var util=require(_0xffc8('0x1'));var path=require(_0xffc8('0x2'));var timeout=require(_0xffc8('0x3'));var express=require('express');var router=express[_0xffc8('0x4')]();var auth=require(_0xffc8('0x5'));var interaction=require(_0xffc8('0x6'));var config=require(_0xffc8('0x7'));var controller=require(_0xffc8('0x8'));router[_0xffc8('0x9')]('/',auth['isAuthenticated'](),controller[_0xffc8('0xa')]);router['get']('/describe',auth[_0xffc8('0xb')](),controller[_0xffc8('0xc')]);router[_0xffc8('0x9')](_0xffc8('0xd'),auth['isAuthenticated'](),controller[_0xffc8('0xe')]);router[_0xffc8('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0xffc8('0xb')](),controller[_0xffc8('0x10')]);router[_0xffc8('0x11')](_0xffc8('0xd'),auth[_0xffc8('0xb')](),controller[_0xffc8('0x12')]);module[_0xffc8('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 94a499b..a00586e 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 _0xca3e=['STRING','sequelize','INTEGER'];(function(_0x3b2b8e,_0x1a52c2){var _0x213c00=function(_0x1cd27a){while(--_0x1cd27a){_0x3b2b8e['push'](_0x3b2b8e['shift']());}};_0x213c00(++_0x1a52c2);}(_0xca3e,0x103));var _0xeca3=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xca3e[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0xeca3('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xeca3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xeca3('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xdc75=['exports','INTEGER','STRING','sequelize'];(function(_0x8bca3f,_0x158cf8){var _0x448ab5=function(_0x5b5537){while(--_0x5b5537){_0x8bca3f['push'](_0x8bca3f['shift']());}};_0x448ab5(++_0x158cf8);}(_0xdc75,0x18f));var _0x5dc7=function(_0x3d04d1,_0x184e1f){_0x3d04d1=_0x3d04d1-0x0;var _0x2acc03=_0xdc75[_0x3d04d1];return _0x2acc03;};'use strict';var Sequelize=require(_0x5dc7('0x0'));module[_0x5dc7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x5dc7('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5dc7('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 ea0899a..6cebc2d 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 _0x814b=['../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','then','destroy','error','name','send','index','UserProfileResource','rawAttributes','type','key','map','query','filters','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','includeAll','findAll','rows','catch','show','params','keys','intersection','include','options','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util'];(function(_0x378fd3,_0x3299ec){var _0x200d6f=function(_0x1c6b17){while(--_0x1c6b17){_0x378fd3['push'](_0x378fd3['shift']());}};_0x200d6f(++_0x3299ec);}(_0x814b,0x1a2));var _0xb814=function(_0x17823f,_0xffd807){_0x17823f=_0x17823f-0x0;var _0x51fc21=_0x814b[_0x17823f];return _0x51fc21;};'use strict';var pdf=require(_0xb814('0x0'));var emlformat=require(_0xb814('0x1'));var rimraf=require(_0xb814('0x2'));var zipdir=require(_0xb814('0x3'));var jsonpatch=require(_0xb814('0x4'));var rp=require(_0xb814('0x5'));var moment=require('moment');var BPromise=require(_0xb814('0x6'));var Mustache=require(_0xb814('0x7'));var util=require(_0xb814('0x8'));var path=require(_0xb814('0x9'));var sox=require(_0xb814('0xa'));var csv=require(_0xb814('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xb'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=_0x3a71d6[_0xb814('0x1f')],_0x265a83=_0x303aca['offset'],_0x125ce2=_0x303aca[_0xb814('0x20')]+_0x303aca['limit'],_0x21b73f;if(_0x125ce2>=_0x45e0d0){_0x125ce2=_0x45e0d0;_0x21b73f=0xc8;}else{_0x21b73f=0xce;}_0x39bfcf[_0xb814('0x1c')](_0x21b73f);return _0x39bfcf[_0xb814('0x21')]('Content-Range',_0x265a83+'-'+_0x125ce2+'/'+_0x45e0d0)['json'](_0x3a71d6);}return null;};}function patchUpdates(_0x55d63c){return function(_0x399b43){try{jsonpatch['apply'](_0x399b43,_0x55d63c,!![]);}catch(_0x57c128){return BPromise[_0xb814('0x22')](_0x57c128);}return _0x399b43[_0xb814('0x23')]();};}function saveUpdates(_0x25b6b6,_0x4e139e){return function(_0xf5b8aa){if(_0xf5b8aa){return _0xf5b8aa['update'](_0x25b6b6)[_0xb814('0x24')](function(_0x1808a3){return _0x1808a3;});}return null;};}function removeEntity(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x25')]()[_0xb814('0x24')](function(){_0x3b267e['status'](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0x52b7a3,_0x3f81d0){return function(_0x457dac){if(!_0x457dac){_0x52b7a3[_0xb814('0x1b')](0x194);}return _0x457dac;};}function handleError(_0x208927,_0x1c8a2e){_0x1c8a2e=_0x1c8a2e||0x1f4;return function(_0xb9e57d){logger[_0xb814('0x26')](_0xb9e57d['stack']);if(_0xb9e57d[_0xb814('0x27')]){delete _0xb9e57d[_0xb814('0x27')];}_0x208927[_0xb814('0x1c')](_0x1c8a2e)[_0xb814('0x28')](_0xb9e57d);};}exports[_0xb814('0x29')]=function(_0x1d5965,_0x3f0150){var _0x1e4e89={},_0x5a6291={},_0x271aa8={'count':0x0,'rows':[]};var _0x328a08=_['map'](db[_0xb814('0x2a')][_0xb814('0x2b')],function(_0x530744){return{'name':_0x530744['fieldName'],'type':_0x530744[_0xb814('0x2c')][_0xb814('0x2d')]};});_0x5a6291['model']=_[_0xb814('0x2e')](_0x328a08,'name');_0x5a6291[_0xb814('0x2f')]=_['keys'](_0x1d5965['query']);_0x5a6291[_0xb814('0x30')]=_['intersection'](_0x5a6291[_0xb814('0x31')],_0x5a6291[_0xb814('0x2f')]);_0x1e4e89[_0xb814('0x32')]=_['intersection'](_0x5a6291['model'],qs[_0xb814('0x33')](_0x1d5965[_0xb814('0x2f')]['fields']));_0x1e4e89[_0xb814('0x32')]=_0x1e4e89[_0xb814('0x32')][_0xb814('0x34')]?_0x1e4e89[_0xb814('0x32')]:_0x5a6291[_0xb814('0x31')];if(!_0x1d5965[_0xb814('0x2f')][_0xb814('0x35')]('nolimit')){_0x1e4e89[_0xb814('0x36')]=qs[_0xb814('0x36')](_0x1d5965[_0xb814('0x2f')][_0xb814('0x36')]);_0x1e4e89[_0xb814('0x20')]=qs['offset'](_0x1d5965[_0xb814('0x2f')]['offset']);}_0x1e4e89[_0xb814('0x37')]=qs[_0xb814('0x38')](_0x1d5965[_0xb814('0x2f')]['sort']);_0x1e4e89[_0xb814('0x39')]=qs[_0xb814('0x30')](_['pick'](_0x1d5965[_0xb814('0x2f')],_0x5a6291[_0xb814('0x30')]),_0x328a08);if(_0x1d5965[_0xb814('0x2f')][_0xb814('0x3a')]){_0x1e4e89[_0xb814('0x39')]=_[_0xb814('0x3b')](_0x1e4e89['where'],{'$or':_[_0xb814('0x2e')](_0x328a08,function(_0x4e4684){if(_0x4e4684[_0xb814('0x2c')]!=='VIRTUAL'){var _0x4492ef={};_0x4492ef[_0x4e4684['name']]={'$like':'%'+_0x1d5965[_0xb814('0x2f')][_0xb814('0x3a')]+'%'};return _0x4492ef;}})});}_0x1e4e89=_['merge']({},_0x1e4e89,_0x1d5965['options']);var _0x5dd6bc={'where':_0x1e4e89['where']};return db[_0xb814('0x2a')][_0xb814('0x1f')](_0x5dd6bc)[_0xb814('0x24')](function(_0x42c2ed){_0x271aa8['count']=_0x42c2ed;if(_0x1d5965['query'][_0xb814('0x3c')]){_0x1e4e89['include']=[{'all':!![]}];}return db[_0xb814('0x2a')][_0xb814('0x3d')](_0x1e4e89);})[_0xb814('0x24')](function(_0x3063bf){_0x271aa8[_0xb814('0x3e')]=_0x3063bf;return _0x271aa8;})[_0xb814('0x24')](respondWithFilteredResult(_0x3f0150,_0x1e4e89))[_0xb814('0x3f')](handleError(_0x3f0150,null));};exports[_0xb814('0x40')]=function(_0x31989d,_0x4b6ff8){var _0x544d36={'raw':![],'where':{'id':_0x31989d[_0xb814('0x41')]['id']}},_0x5d26be={};_0x5d26be['model']=_[_0xb814('0x42')](db['UserProfileResource'][_0xb814('0x2b')]);_0x5d26be[_0xb814('0x2f')]=_[_0xb814('0x42')](_0x31989d[_0xb814('0x2f')]);_0x5d26be['filters']=_[_0xb814('0x43')](_0x5d26be[_0xb814('0x31')],_0x5d26be[_0xb814('0x2f')]);_0x544d36[_0xb814('0x32')]=_[_0xb814('0x43')](_0x5d26be[_0xb814('0x31')],qs['fields'](_0x31989d[_0xb814('0x2f')][_0xb814('0x33')]));_0x544d36[_0xb814('0x32')]=_0x544d36[_0xb814('0x32')][_0xb814('0x34')]?_0x544d36[_0xb814('0x32')]:_0x5d26be[_0xb814('0x31')];if(_0x31989d['query']['includeAll']){_0x544d36[_0xb814('0x44')]=[{'all':!![]}];}_0x544d36=_[_0xb814('0x3b')]({},_0x544d36,_0x31989d[_0xb814('0x45')]);return db[_0xb814('0x2a')][_0xb814('0x46')](_0x544d36)[_0xb814('0x24')](handleEntityNotFound(_0x4b6ff8,null))[_0xb814('0x24')](respondWithResult(_0x4b6ff8,null))[_0xb814('0x3f')](handleError(_0x4b6ff8,null));};exports[_0xb814('0x47')]=function(_0x344198,_0xe73300){return db['UserProfileResource'][_0xb814('0x47')](_0x344198[_0xb814('0x48')],{})['then'](respondWithResult(_0xe73300,0xc9))[_0xb814('0x3f')](handleError(_0xe73300,null));};exports['update']=function(_0x2fb0f7,_0x37866f){if(_0x2fb0f7[_0xb814('0x48')]['id']){delete _0x2fb0f7[_0xb814('0x48')]['id'];}return db[_0xb814('0x2a')][_0xb814('0x46')]({'where':{'id':_0x2fb0f7[_0xb814('0x41')]['id']}})[_0xb814('0x24')](handleEntityNotFound(_0x37866f,null))[_0xb814('0x24')](saveUpdates(_0x2fb0f7[_0xb814('0x48')],null))['then'](respondWithResult(_0x37866f,null))['catch'](handleError(_0x37866f,null));};exports[_0xb814('0x25')]=function(_0x30f07b,_0x4156d8){return db[_0xb814('0x2a')][_0xb814('0x46')]({'where':{'id':_0x30f07b[_0xb814('0x41')]['id']}})[_0xb814('0x24')](handleEntityNotFound(_0x4156d8,null))['then'](removeEntity(_0x4156d8,null))[_0xb814('0x3f')](handleError(_0x4156d8,null));};exports[_0xb814('0x49')]=function(_0xf27a6e,_0x5a916d){return db[_0xb814('0x2a')]['describe']()[_0xb814('0x24')](respondWithResult(_0x5a916d,null))['catch'](handleError(_0x5a916d,null));}; \ No newline at end of file +var _0xf2ca=['util','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','set','apply','reject','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','merge','type','filter','options','UserProfileResource','count','includeAll','include','rows','catch','show','params','length','create','body','find','destroy','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0xd4636c,_0x34dbf6){var _0x5ee17d=function(_0x223c38){while(--_0x223c38){_0xd4636c['push'](_0xd4636c['shift']());}};_0x5ee17d(++_0x34dbf6);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x4557dc,_0x3687b2){_0x4557dc=_0x4557dc-0x0;var _0x1377aa=_0xf2ca[_0x4557dc];return _0x1377aa;};'use strict';var pdf=require(_0xaf2c('0x0'));var emlformat=require(_0xaf2c('0x1'));var rimraf=require(_0xaf2c('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf2c('0x3'));var rp=require(_0xaf2c('0x4'));var moment=require(_0xaf2c('0x5'));var BPromise=require(_0xaf2c('0x6'));var Mustache=require(_0xaf2c('0x7'));var util=require(_0xaf2c('0x8'));var path=require('path');var sox=require(_0xaf2c('0x9'));var csv=require(_0xaf2c('0xa'));var ejs=require(_0xaf2c('0xb'));var fs=require('fs');var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0xa'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=_0x6ac8e['count'],_0x26bf7b=_0x1d0633[_0xaf2c('0x1c')],_0x3432e4=_0x1d0633['offset']+_0x1d0633[_0xaf2c('0x1d')],_0x705d09;if(_0x3432e4>=_0x2b4d13){_0x3432e4=_0x2b4d13;_0x705d09=0xc8;}else{_0x705d09=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x705d09);return _0x2119c8[_0xaf2c('0x1e')]('Content-Range',_0x26bf7b+'-'+_0x3432e4+'/'+_0x2b4d13)[_0xaf2c('0x1b')](_0x6ac8e);}return null;};}function patchUpdates(_0x297bcd){return function(_0x1fec4c){try{jsonpatch[_0xaf2c('0x1f')](_0x1fec4c,_0x297bcd,!![]);}catch(_0x3f977c){return BPromise[_0xaf2c('0x20')](_0x3f977c);}return _0x1fec4c['save']();};}function saveUpdates(_0x35e712,_0x164bcb){return function(_0x8ffe13){if(_0x8ffe13){return _0x8ffe13[_0xaf2c('0x21')](_0x35e712)[_0xaf2c('0x22')](function(_0x486de2){return _0x486de2;});}return null;};}function removeEntity(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['destroy']()['then'](function(){_0x396646[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x1cafad,_0x99f78d){return function(_0x591aff){if(!_0x591aff){_0x1cafad[_0xaf2c('0x18')](0x194);}return _0x591aff;};}function handleError(_0xf1a7cf,_0x3a0145){_0x3a0145=_0x3a0145||0x1f4;return function(_0x3c1ae6){logger[_0xaf2c('0x23')](_0x3c1ae6[_0xaf2c('0x24')]);if(_0x3c1ae6[_0xaf2c('0x25')]){delete _0x3c1ae6['name'];}_0xf1a7cf[_0xaf2c('0x19')](_0x3a0145)[_0xaf2c('0x26')](_0x3c1ae6);};}exports[_0xaf2c('0x27')]=function(_0x410536,_0x4b7cf2){var _0x3fb190={},_0x589d47={},_0x38db1b={'count':0x0,'rows':[]};var _0x42f980=_[_0xaf2c('0x28')](db['UserProfileResource'][_0xaf2c('0x29')],function(_0x2ea490){return{'name':_0x2ea490[_0xaf2c('0x2a')],'type':_0x2ea490['type'][_0xaf2c('0x2b')]};});_0x589d47[_0xaf2c('0x2c')]=_[_0xaf2c('0x28')](_0x42f980,_0xaf2c('0x25'));_0x589d47['query']=_[_0xaf2c('0x2d')](_0x410536[_0xaf2c('0x2e')]);_0x589d47[_0xaf2c('0x2f')]=_['intersection'](_0x589d47['model'],_0x589d47[_0xaf2c('0x2e')]);_0x3fb190['attributes']=_[_0xaf2c('0x30')](_0x589d47['model'],qs[_0xaf2c('0x31')](_0x410536[_0xaf2c('0x2e')]['fields']));_0x3fb190[_0xaf2c('0x32')]=_0x3fb190[_0xaf2c('0x32')]['length']?_0x3fb190[_0xaf2c('0x32')]:_0x589d47[_0xaf2c('0x2c')];if(!_0x410536[_0xaf2c('0x2e')][_0xaf2c('0x33')](_0xaf2c('0x34'))){_0x3fb190[_0xaf2c('0x1d')]=qs['limit'](_0x410536[_0xaf2c('0x2e')]['limit']);_0x3fb190[_0xaf2c('0x1c')]=qs['offset'](_0x410536[_0xaf2c('0x2e')]['offset']);}_0x3fb190[_0xaf2c('0x35')]=qs['sort'](_0x410536[_0xaf2c('0x2e')]['sort']);_0x3fb190[_0xaf2c('0x36')]=qs[_0xaf2c('0x2f')](_[_0xaf2c('0x37')](_0x410536[_0xaf2c('0x2e')],_0x589d47[_0xaf2c('0x2f')]),_0x42f980);if(_0x410536['query']['filter']){_0x3fb190[_0xaf2c('0x36')]=_[_0xaf2c('0x38')](_0x3fb190[_0xaf2c('0x36')],{'$or':_[_0xaf2c('0x28')](_0x42f980,function(_0x4eeecf){if(_0x4eeecf[_0xaf2c('0x39')]!=='VIRTUAL'){var _0xa1248e={};_0xa1248e[_0x4eeecf[_0xaf2c('0x25')]]={'$like':'%'+_0x410536['query'][_0xaf2c('0x3a')]+'%'};return _0xa1248e;}})});}_0x3fb190=_[_0xaf2c('0x38')]({},_0x3fb190,_0x410536[_0xaf2c('0x3b')]);var _0x71c597={'where':_0x3fb190[_0xaf2c('0x36')]};return db[_0xaf2c('0x3c')][_0xaf2c('0x3d')](_0x71c597)[_0xaf2c('0x22')](function(_0x296ca8){_0x38db1b[_0xaf2c('0x3d')]=_0x296ca8;if(_0x410536[_0xaf2c('0x2e')][_0xaf2c('0x3e')]){_0x3fb190[_0xaf2c('0x3f')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x3fb190);})['then'](function(_0x189809){_0x38db1b[_0xaf2c('0x40')]=_0x189809;return _0x38db1b;})[_0xaf2c('0x22')](respondWithFilteredResult(_0x4b7cf2,_0x3fb190))[_0xaf2c('0x41')](handleError(_0x4b7cf2,null));};exports[_0xaf2c('0x42')]=function(_0x29460c,_0x51c441){var _0x1d58bd={'raw':![],'where':{'id':_0x29460c[_0xaf2c('0x43')]['id']}},_0x78632a={};_0x78632a['model']=_['keys'](db[_0xaf2c('0x3c')]['rawAttributes']);_0x78632a[_0xaf2c('0x2e')]=_[_0xaf2c('0x2d')](_0x29460c[_0xaf2c('0x2e')]);_0x78632a[_0xaf2c('0x2f')]=_['intersection'](_0x78632a[_0xaf2c('0x2c')],_0x78632a['query']);_0x1d58bd[_0xaf2c('0x32')]=_[_0xaf2c('0x30')](_0x78632a['model'],qs[_0xaf2c('0x31')](_0x29460c['query'][_0xaf2c('0x31')]));_0x1d58bd[_0xaf2c('0x32')]=_0x1d58bd[_0xaf2c('0x32')][_0xaf2c('0x44')]?_0x1d58bd[_0xaf2c('0x32')]:_0x78632a[_0xaf2c('0x2c')];if(_0x29460c[_0xaf2c('0x2e')][_0xaf2c('0x3e')]){_0x1d58bd[_0xaf2c('0x3f')]=[{'all':!![]}];}_0x1d58bd=_['merge']({},_0x1d58bd,_0x29460c['options']);return db[_0xaf2c('0x3c')]['find'](_0x1d58bd)['then'](handleEntityNotFound(_0x51c441,null))['then'](respondWithResult(_0x51c441,null))[_0xaf2c('0x41')](handleError(_0x51c441,null));};exports[_0xaf2c('0x45')]=function(_0x3cabd4,_0x35315e){return db['UserProfileResource'][_0xaf2c('0x45')](_0x3cabd4['body'],{})[_0xaf2c('0x22')](respondWithResult(_0x35315e,0xc9))['catch'](handleError(_0x35315e,null));};exports[_0xaf2c('0x21')]=function(_0x133e8c,_0x2d01b7){if(_0x133e8c[_0xaf2c('0x46')]['id']){delete _0x133e8c[_0xaf2c('0x46')]['id'];}return db['UserProfileResource'][_0xaf2c('0x47')]({'where':{'id':_0x133e8c[_0xaf2c('0x43')]['id']}})['then'](handleEntityNotFound(_0x2d01b7,null))['then'](saveUpdates(_0x133e8c[_0xaf2c('0x46')],null))['then'](respondWithResult(_0x2d01b7,null))[_0xaf2c('0x41')](handleError(_0x2d01b7,null));};exports[_0xaf2c('0x48')]=function(_0x17b9ec,_0x315b9f){return db[_0xaf2c('0x3c')][_0xaf2c('0x47')]({'where':{'id':_0x17b9ec[_0xaf2c('0x43')]['id']}})[_0xaf2c('0x22')](handleEntityNotFound(_0x315b9f,null))[_0xaf2c('0x22')](removeEntity(_0x315b9f,null))[_0xaf2c('0x41')](handleError(_0x315b9f,null));};exports[_0xaf2c('0x49')]=function(_0x5bf349,_0x22919a){return db[_0xaf2c('0x3c')]['describe']()['then'](respondWithResult(_0x22919a,null))['catch'](handleError(_0x22919a,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 3f34249..284d0fe 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 _0xec93=['define','user_profile_has_resources','resourceId','sectionId','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./userProfileResource.attributes'];(function(_0x5cc5bb,_0x52ec59){var _0x3b7cd2=function(_0x2dacd5){while(--_0x2dacd5){_0x5cc5bb['push'](_0x5cc5bb['shift']());}};_0x3b7cd2(++_0x52ec59);}(_0xec93,0x178));var _0x3ec9=function(_0x206808,_0x5b142d){_0x206808=_0x206808-0x0;var _0xac4488=_0xec93[_0x206808];return _0xac4488;};'use strict';var _=require(_0x3ec9('0x0'));var util=require('util');var logger=require(_0x3ec9('0x1'))(_0x3ec9('0x2'));var moment=require(_0x3ec9('0x3'));var BPromise=require(_0x3ec9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ec9('0x5'));var rimraf=require(_0x3ec9('0x6'));var config=require('../../config/environment');var attributes=require(_0x3ec9('0x7'));module['exports']=function(_0x2db922,_0x4fc763){return _0x2db922[_0x3ec9('0x8')]('UserProfileResource',attributes,{'tableName':_0x3ec9('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x3ec9('0xa'),_0x3ec9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x19ad=['request-promise','rimraf','define','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','lodash','util','../../config/logger','api','moment'];(function(_0x43cdd9,_0x531e47){var _0x1d41e8=function(_0x3d1a5e){while(--_0x3d1a5e){_0x43cdd9['push'](_0x43cdd9['shift']());}};_0x1d41e8(++_0x531e47);}(_0x19ad,0xaf));var _0xd19a=function(_0x332005,_0x24edf1){_0x332005=_0x332005-0x0;var _0x4393e1=_0x19ad[_0x332005];return _0x4393e1;};'use strict';var _=require(_0xd19a('0x0'));var util=require(_0xd19a('0x1'));var logger=require(_0xd19a('0x2'))(_0xd19a('0x3'));var moment=require(_0xd19a('0x4'));var BPromise=require('bluebird');var rp=require(_0xd19a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd19a('0x6'));var config=require('../../config/environment');var attributes=require('./userProfileResource.attributes');module['exports']=function(_0x4cbaf1,_0x599e04){return _0x4cbaf1[_0xd19a('0x7')](_0xd19a('0x8'),attributes,{'tableName':_0xd19a('0x9'),'paranoid':![],'indexes':[{'name':_0xd19a('0xa'),'fields':['resourceId',_0xd19a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 51f8a62..99da03f 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 _0x5446=['bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment'];(function(_0x3d4ef1,_0x5a957c){var _0x409423=function(_0x1ab129){while(--_0x1ab129){_0x3d4ef1['push'](_0x3d4ef1['shift']());}};_0x409423(++_0x5a957c);}(_0x5446,0x132));var _0x6544=function(_0x3bfce7,_0xdfbb6b){_0x3bfce7=_0x3bfce7-0x0;var _0x380ba4=_0x5446[_0x3bfce7];return _0x380ba4;};'use strict';var _=require('lodash');var util=require(_0x6544('0x0'));var moment=require(_0x6544('0x1'));var BPromise=require(_0x6544('0x2'));var rs=require(_0x6544('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6544('0x4'));var logger=require(_0x6544('0x5'))(_0x6544('0x6'));var config=require(_0x6544('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6544('0x8')][_0x6544('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4351e8,_0x1ead1d,_0x4adb42){return new BPromise(function(_0x4a75a4,_0x47e05e){return client[_0x6544('0xa')](_0x4351e8,_0x4adb42)[_0x6544('0xb')](function(_0x27ff0b){logger['info'](_0x6544('0xc'),_0x1ead1d,_0x6544('0xd'));logger[_0x6544('0xe')](_0x6544('0xf'),_0x1ead1d,_0x6544('0xd'),JSON[_0x6544('0x10')](_0x27ff0b));if(_0x27ff0b['error']){if(_0x27ff0b[_0x6544('0x11')][_0x6544('0x12')]===0x1f4){logger[_0x6544('0x11')](_0x6544('0xc'),_0x1ead1d,_0x27ff0b[_0x6544('0x11')][_0x6544('0x13')]);return _0x47e05e(_0x27ff0b[_0x6544('0x11')]['message']);}logger['error'](_0x6544('0xc'),_0x1ead1d,_0x27ff0b[_0x6544('0x11')]['message']);return _0x4a75a4(_0x27ff0b[_0x6544('0x11')]['message']);}else{logger[_0x6544('0x14')](_0x6544('0xc'),_0x1ead1d,_0x6544('0xd'));_0x4a75a4(_0x27ff0b['result'][_0x6544('0x13')]);}})[_0x6544('0x15')](function(_0xb527e4){logger[_0x6544('0x11')](_0x6544('0xc'),_0x1ead1d,_0xb527e4);_0x47e05e(_0xb527e4);});});} \ No newline at end of file +var _0xa3e9=['debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','request','then','info','UserProfileResource,\x20%s,\x20%s'];(function(_0x1382c5,_0x26f17c){var _0x4e1933=function(_0x4304b8){while(--_0x4304b8){_0x1382c5['push'](_0x1382c5['shift']());}};_0x4e1933(++_0x26f17c);}(_0xa3e9,0x1e8));var _0x9a3e=function(_0x2b8572,_0x413c43){_0x2b8572=_0x2b8572-0x0;var _0x2314a3=_0xa3e9[_0x2b8572];return _0x2314a3;};'use strict';var _=require('lodash');var util=require(_0x9a3e('0x0'));var moment=require(_0x9a3e('0x1'));var BPromise=require(_0x9a3e('0x2'));var rs=require(_0x9a3e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9a3e('0x4'));var logger=require('../../config/logger')(_0x9a3e('0x5'));var config=require('../../config/environment');var jayson=require(_0x9a3e('0x6'));var client=jayson[_0x9a3e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e4ddc,_0x34b35b,_0x37e714){return new BPromise(function(_0x12d76c,_0x39e8d8){return client[_0x9a3e('0x8')](_0x4e4ddc,_0x37e714)[_0x9a3e('0x9')](function(_0x1dec44){logger[_0x9a3e('0xa')](_0x9a3e('0xb'),_0x34b35b,'request\x20sent');logger[_0x9a3e('0xc')](_0x9a3e('0xd'),_0x34b35b,_0x9a3e('0xe'),JSON[_0x9a3e('0xf')](_0x1dec44));if(_0x1dec44[_0x9a3e('0x10')]){if(_0x1dec44['error'][_0x9a3e('0x11')]===0x1f4){logger[_0x9a3e('0x10')](_0x9a3e('0xb'),_0x34b35b,_0x1dec44[_0x9a3e('0x10')][_0x9a3e('0x12')]);return _0x39e8d8(_0x1dec44['error'][_0x9a3e('0x12')]);}logger[_0x9a3e('0x10')](_0x9a3e('0xb'),_0x34b35b,_0x1dec44[_0x9a3e('0x10')][_0x9a3e('0x12')]);return _0x12d76c(_0x1dec44[_0x9a3e('0x10')][_0x9a3e('0x12')]);}else{logger[_0x9a3e('0xa')](_0x9a3e('0xb'),_0x34b35b,_0x9a3e('0xe'));_0x12d76c(_0x1dec44[_0x9a3e('0x13')][_0x9a3e('0x12')]);}})['catch'](function(_0x21a2b9){logger[_0x9a3e('0x10')](_0x9a3e('0xb'),_0x34b35b,_0x21a2b9);_0x39e8d8(_0x21a2b9);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 662c20d..a4fd6d2 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 _0xba92=['../../components/interaction/service','./userProfileSection.controller','index','get','/describe','isAuthenticated','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x962fc5,_0x58f074){var _0x43667c=function(_0x5e6ec0){while(--_0x5e6ec0){_0x962fc5['push'](_0x962fc5['shift']());}};_0x43667c(++_0x58f074);}(_0xba92,0xe9));var _0x2ba9=function(_0x9406ef,_0x487114){_0x9406ef=_0x9406ef-0x0;var _0x187d54=_0xba92[_0x9406ef];return _0x187d54;};'use strict';var multer=require(_0x2ba9('0x0'));var util=require(_0x2ba9('0x1'));var path=require(_0x2ba9('0x2'));var timeout=require(_0x2ba9('0x3'));var express=require(_0x2ba9('0x4'));var router=express[_0x2ba9('0x5')]();var auth=require(_0x2ba9('0x6'));var interaction=require(_0x2ba9('0x7'));var config=require('../../config/environment');var controller=require(_0x2ba9('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x2ba9('0x9')]);router[_0x2ba9('0xa')](_0x2ba9('0xb'),auth[_0x2ba9('0xc')](),controller['describe']);router[_0x2ba9('0xa')](_0x2ba9('0xd'),auth[_0x2ba9('0xc')](),controller[_0x2ba9('0xe')]);router[_0x2ba9('0xf')]('/',auth[_0x2ba9('0xc')](),controller[_0x2ba9('0x10')]);router[_0x2ba9('0x11')](_0x2ba9('0xd'),auth[_0x2ba9('0xc')](),controller[_0x2ba9('0x12')]);router[_0x2ba9('0x13')](_0x2ba9('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x461d=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./userProfileSection.controller','index','get','/describe','isAuthenticated','describe','show','post','create','/:id','update','delete','exports','multer','util'];(function(_0x3546eb,_0x440f3f){var _0xe660bf=function(_0x282566){while(--_0x282566){_0x3546eb['push'](_0x3546eb['shift']());}};_0xe660bf(++_0x440f3f);}(_0x461d,0x166));var _0xd461=function(_0x5ec01e,_0x3e6fad){_0x5ec01e=_0x5ec01e-0x0;var _0x10c18f=_0x461d[_0x5ec01e];return _0x10c18f;};'use strict';var multer=require(_0xd461('0x0'));var util=require(_0xd461('0x1'));var path=require('path');var timeout=require(_0xd461('0x2'));var express=require(_0xd461('0x3'));var router=express[_0xd461('0x4')]();var auth=require(_0xd461('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd461('0x6'));var controller=require(_0xd461('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd461('0x8')]);router[_0xd461('0x9')](_0xd461('0xa'),auth[_0xd461('0xb')](),controller[_0xd461('0xc')]);router['get']('/:id',auth[_0xd461('0xb')](),controller[_0xd461('0xd')]);router[_0xd461('0xe')]('/',auth[_0xd461('0xb')](),controller[_0xd461('0xf')]);router['put'](_0xd461('0x10'),auth[_0xd461('0xb')](),controller[_0xd461('0x11')]);router[_0xd461('0x12')](_0xd461('0x10'),auth[_0xd461('0xb')](),controller['destroy']);module[_0xd461('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index cbfd38c..52c2f8c 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 _0x217b=['join','crudPermissions','getDataValue','split','exports','STRING','INTEGER','BOOLEAN','setDataValue'];(function(_0x1867e3,_0x589b2d){var _0x4b22aa=function(_0x36a685){while(--_0x36a685){_0x1867e3['push'](_0x1867e3['shift']());}};_0x4b22aa(++_0x589b2d);}(_0x217b,0x199));var _0xb217=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x217b[_0x36884e];return _0x1cc367;};'use strict';var Sequelize=require('sequelize');module[_0xb217('0x0')]={'name':{'type':Sequelize[_0xb217('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xb217('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0xb217('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xb217('0x1')],'set':function(_0x2741be){this[_0xb217('0x4')]('crudPermissions',_0x2741be?_0x2741be[_0xb217('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0xb217('0x6'))?this[_0xb217('0x7')]('crudPermissions')[_0xb217('0x8')](''):[];}}}; \ No newline at end of file +var _0x8135=['split','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','getDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8135,0x99));var _0x5813=function(_0x4701e1,_0x3e0abf){_0x4701e1=_0x4701e1-0x0;var _0x5a524f=_0x8135[_0x4701e1];return _0x5a524f;};'use strict';var Sequelize=require('sequelize');module[_0x5813('0x0')]={'name':{'type':Sequelize[_0x5813('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x5813('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x5813('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x5813('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x5813('0x1')],'set':function(_0xf23c29){this[_0x5813('0x4')](_0x5813('0x5'),_0xf23c29?_0xf23c29['join'](''):[]);},'get':function(){return this['getDataValue'](_0x5813('0x5'))?this[_0x5813('0x6')](_0x5813('0x5'))[_0x5813('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 87e430a..35bfa99 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 _0xe8fc=['to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','UserProfileSection','rawAttributes','model','query','filters','attributes','intersection','fields','length','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox'];(function(_0x1098db,_0x39ba6b){var _0x14f090=function(_0x473ffe){while(--_0x473ffe){_0x1098db['push'](_0x1098db['shift']());}};_0x14f090(++_0x39ba6b);}(_0xe8fc,0x16e));var _0xce8f=function(_0x11f249,_0x4ca4a8){_0x11f249=_0x11f249-0x0;var _0x5c3656=_0xe8fc[_0x11f249];return _0x5c3656;};'use strict';var pdf=require(_0xce8f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xce8f('0x1'));var zipdir=require(_0xce8f('0x2'));var jsonpatch=require(_0xce8f('0x3'));var rp=require('request-promise');var moment=require(_0xce8f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xce8f('0x5'));var util=require(_0xce8f('0x6'));var path=require(_0xce8f('0x7'));var sox=require(_0xce8f('0x8'));var csv=require(_0xce8f('0x9'));var ejs=require(_0xce8f('0xa'));var fs=require('fs');var _=require(_0xce8f('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xce8f('0xc'));var deskjs=require(_0xce8f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xce8f('0xe'));var Papa=require(_0xce8f('0xf'));var Redis=require(_0xce8f('0x10'));var authService=require(_0xce8f('0x11'));var qs=require(_0xce8f('0x12'));var as=require(_0xce8f('0x13'));var hardwareService=require(_0xce8f('0x14'));var logger=require('../../config/logger')(_0xce8f('0x15'));var utils=require(_0xce8f('0x16'));var config=require(_0xce8f('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xce8f('0x18'))['db'];function respondWithStatusCode(_0x5ee92f,_0x251c3e){_0x251c3e=_0x251c3e||0xcc;return function(_0x36e9d3){if(_0x36e9d3){return _0x5ee92f[_0xce8f('0x19')](_0x251c3e);}return _0x5ee92f['status'](_0x251c3e)[_0xce8f('0x1a')]();};}function respondWithResult(_0x325b23,_0x4bc81c){_0x4bc81c=_0x4bc81c||0xc8;return function(_0x15335d){if(_0x15335d){return _0x325b23[_0xce8f('0x1b')](_0x4bc81c)[_0xce8f('0x1c')](_0x15335d);}};}function respondWithFilteredResult(_0x21d63a,_0x1d0340){return function(_0x1d74c3){if(_0x1d74c3){var _0x31ea21=_0x1d74c3[_0xce8f('0x1d')],_0xb5c05f=_0x1d0340[_0xce8f('0x1e')],_0x284022=_0x1d0340[_0xce8f('0x1e')]+_0x1d0340['limit'],_0x1e0341;if(_0x284022>=_0x31ea21){_0x284022=_0x31ea21;_0x1e0341=0xc8;}else{_0x1e0341=0xce;}_0x21d63a['status'](_0x1e0341);return _0x21d63a[_0xce8f('0x1f')](_0xce8f('0x20'),_0xb5c05f+'-'+_0x284022+'/'+_0x31ea21)[_0xce8f('0x1c')](_0x1d74c3);}return null;};}function patchUpdates(_0x1b59f2){return function(_0x148531){try{jsonpatch[_0xce8f('0x21')](_0x148531,_0x1b59f2,!![]);}catch(_0x109cc1){return BPromise[_0xce8f('0x22')](_0x109cc1);}return _0x148531[_0xce8f('0x23')]();};}function saveUpdates(_0x5d791f,_0xe7b498){return function(_0x3154fa){if(_0x3154fa){return _0x3154fa[_0xce8f('0x24')](_0x5d791f)[_0xce8f('0x25')](function(_0x114f3a){return _0x114f3a;});}return null;};}function removeEntity(_0x1541bd,_0x568724){return function(_0x4ebc31){if(_0x4ebc31){return _0x4ebc31[_0xce8f('0x26')]()[_0xce8f('0x25')](function(){_0x1541bd[_0xce8f('0x1b')](0xcc)[_0xce8f('0x1a')]();});}};}function handleEntityNotFound(_0x53d888,_0x5e61e8){return function(_0x7baad7){if(!_0x7baad7){_0x53d888['sendStatus'](0x194);}return _0x7baad7;};}function handleError(_0x1dd289,_0x397326){_0x397326=_0x397326||0x1f4;return function(_0x1f07a3){logger[_0xce8f('0x27')](_0x1f07a3[_0xce8f('0x28')]);if(_0x1f07a3[_0xce8f('0x29')]){delete _0x1f07a3[_0xce8f('0x29')];}_0x1dd289['status'](_0x397326)['send'](_0x1f07a3);};}exports[_0xce8f('0x2a')]=function(_0x33c659,_0x5d3d6b){var _0x2a4862={},_0x47a6c6={},_0x4f8837={'count':0x0,'rows':[]};var _0x1643aa=_[_0xce8f('0x2b')](db[_0xce8f('0x2c')][_0xce8f('0x2d')],function(_0x30f359){return{'name':_0x30f359['fieldName'],'type':_0x30f359['type']['key']};});_0x47a6c6[_0xce8f('0x2e')]=_[_0xce8f('0x2b')](_0x1643aa,_0xce8f('0x29'));_0x47a6c6['query']=_['keys'](_0x33c659[_0xce8f('0x2f')]);_0x47a6c6[_0xce8f('0x30')]=_['intersection'](_0x47a6c6[_0xce8f('0x2e')],_0x47a6c6[_0xce8f('0x2f')]);_0x2a4862[_0xce8f('0x31')]=_[_0xce8f('0x32')](_0x47a6c6[_0xce8f('0x2e')],qs['fields'](_0x33c659[_0xce8f('0x2f')][_0xce8f('0x33')]));_0x2a4862['attributes']=_0x2a4862[_0xce8f('0x31')][_0xce8f('0x34')]?_0x2a4862[_0xce8f('0x31')]:_0x47a6c6[_0xce8f('0x2e')];if(!_0x33c659[_0xce8f('0x2f')]['hasOwnProperty'](_0xce8f('0x35'))){_0x2a4862['limit']=qs[_0xce8f('0x36')](_0x33c659[_0xce8f('0x2f')][_0xce8f('0x36')]);_0x2a4862[_0xce8f('0x1e')]=qs[_0xce8f('0x1e')](_0x33c659[_0xce8f('0x2f')]['offset']);}_0x2a4862['order']=qs[_0xce8f('0x37')](_0x33c659[_0xce8f('0x2f')][_0xce8f('0x37')]);_0x2a4862[_0xce8f('0x38')]=qs[_0xce8f('0x30')](_[_0xce8f('0x39')](_0x33c659[_0xce8f('0x2f')],_0x47a6c6[_0xce8f('0x30')]),_0x1643aa);if(_0x33c659['query'][_0xce8f('0x3a')]){_0x2a4862['where']=_[_0xce8f('0x3b')](_0x2a4862[_0xce8f('0x38')],{'$or':_[_0xce8f('0x2b')](_0x1643aa,function(_0x4626e1){if(_0x4626e1[_0xce8f('0x3c')]!==_0xce8f('0x3d')){var _0x2b9f80={};_0x2b9f80[_0x4626e1[_0xce8f('0x29')]]={'$like':'%'+_0x33c659['query']['filter']+'%'};return _0x2b9f80;}})});}_0x2a4862=_[_0xce8f('0x3b')]({},_0x2a4862,_0x33c659[_0xce8f('0x3e')]);var _0x9a572b={'where':_0x2a4862['where']};return db[_0xce8f('0x2c')][_0xce8f('0x1d')](_0x9a572b)[_0xce8f('0x25')](function(_0x720a45){_0x4f8837[_0xce8f('0x1d')]=_0x720a45;if(_0x33c659[_0xce8f('0x2f')][_0xce8f('0x3f')]){_0x2a4862[_0xce8f('0x40')]=[{'all':!![]}];}return db['UserProfileSection'][_0xce8f('0x41')](_0x2a4862);})[_0xce8f('0x25')](function(_0x286e91){_0x4f8837[_0xce8f('0x42')]=_0x286e91;return _0x4f8837;})[_0xce8f('0x25')](respondWithFilteredResult(_0x5d3d6b,_0x2a4862))[_0xce8f('0x43')](handleError(_0x5d3d6b,null));};exports[_0xce8f('0x44')]=function(_0x5e389d,_0xeb3da9){var _0x441525={'raw':![],'where':{'id':_0x5e389d[_0xce8f('0x45')]['id']}},_0x538834={};_0x538834[_0xce8f('0x2e')]=_['keys'](db[_0xce8f('0x2c')][_0xce8f('0x2d')]);_0x538834[_0xce8f('0x2f')]=_[_0xce8f('0x46')](_0x5e389d[_0xce8f('0x2f')]);_0x538834['filters']=_[_0xce8f('0x32')](_0x538834[_0xce8f('0x2e')],_0x538834[_0xce8f('0x2f')]);_0x441525[_0xce8f('0x31')]=_[_0xce8f('0x32')](_0x538834[_0xce8f('0x2e')],qs[_0xce8f('0x33')](_0x5e389d[_0xce8f('0x2f')][_0xce8f('0x33')]));_0x441525[_0xce8f('0x31')]=_0x441525[_0xce8f('0x31')]['length']?_0x441525[_0xce8f('0x31')]:_0x538834['model'];if(_0x5e389d['query'][_0xce8f('0x3f')]){_0x441525[_0xce8f('0x40')]=[{'all':!![]}];}_0x441525=_[_0xce8f('0x3b')]({},_0x441525,_0x5e389d[_0xce8f('0x3e')]);return db[_0xce8f('0x2c')][_0xce8f('0x47')](_0x441525)[_0xce8f('0x25')](handleEntityNotFound(_0xeb3da9,null))[_0xce8f('0x25')](respondWithResult(_0xeb3da9,null))[_0xce8f('0x43')](handleError(_0xeb3da9,null));};exports[_0xce8f('0x48')]=function(_0x2d2840,_0x5afd4e){return db[_0xce8f('0x2c')][_0xce8f('0x48')](_0x2d2840[_0xce8f('0x49')],{})[_0xce8f('0x25')](respondWithResult(_0x5afd4e,0xc9))['catch'](handleError(_0x5afd4e,null));};exports[_0xce8f('0x24')]=function(_0x20f725,_0x5bd063){if(_0x20f725[_0xce8f('0x49')]['id']){delete _0x20f725[_0xce8f('0x49')]['id'];}return db[_0xce8f('0x2c')][_0xce8f('0x47')]({'where':{'id':_0x20f725[_0xce8f('0x45')]['id']}})[_0xce8f('0x25')](handleEntityNotFound(_0x5bd063,null))[_0xce8f('0x25')](saveUpdates(_0x20f725[_0xce8f('0x49')],null))[_0xce8f('0x25')](respondWithResult(_0x5bd063,null))['catch'](handleError(_0x5bd063,null));};exports[_0xce8f('0x26')]=function(_0x32a6e7,_0x3c5a16){return db[_0xce8f('0x2c')][_0xce8f('0x47')]({'where':{'id':_0x32a6e7['params']['id']}})[_0xce8f('0x25')](handleEntityNotFound(_0x3c5a16,null))[_0xce8f('0x25')](removeEntity(_0x3c5a16,null))['catch'](handleError(_0x3c5a16,null));};exports[_0xce8f('0x4a')]=function(_0x7b487a,_0x58dea0){return db[_0xce8f('0x2c')][_0xce8f('0x4a')]()[_0xce8f('0x25')](respondWithResult(_0x58dea0,null))[_0xce8f('0x43')](handleError(_0x58dea0,null));}; \ No newline at end of file +var _0x033b=['apply','reject','save','then','destroy','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','type','count','includeAll','findAll','rows','catch','show','params','keys','include','options','find','create','body','update','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','ejs','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','status','set','Content-Range'];(function(_0x388caa,_0x7bc7b8){var _0x5ecbe6=function(_0x4b96e5){while(--_0x4b96e5){_0x388caa['push'](_0x388caa['shift']());}};_0x5ecbe6(++_0x7bc7b8);}(_0x033b,0x74));var _0xb033=function(_0x14d896,_0x53578b){_0x14d896=_0x14d896-0x0;var _0x28679a=_0x033b[_0x14d896];return _0x28679a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xb033('0x0'));var rimraf=require(_0xb033('0x1'));var zipdir=require(_0xb033('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb033('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb033('0x4'));var util=require(_0xb033('0x5'));var path=require(_0xb033('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb033('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb033('0x8'));var crypto=require(_0xb033('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xb033('0xa'));var toCsv=require(_0xb033('0xb'));var querystring=require('querystring');var Papa=require(_0xb033('0xc'));var Redis=require(_0xb033('0xd'));var authService=require(_0xb033('0xe'));var qs=require(_0xb033('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb033('0x10'));var logger=require('../../config/logger')(_0xb033('0x11'));var utils=require(_0xb033('0x12'));var config=require(_0xb033('0x13'));var licenseUtil=require(_0xb033('0x14'));var db=require(_0xb033('0x15'))['db'];function respondWithStatusCode(_0x3f3f83,_0x2c97d9){_0x2c97d9=_0x2c97d9||0xcc;return function(_0x4c2102){if(_0x4c2102){return _0x3f3f83[_0xb033('0x16')](_0x2c97d9);}return _0x3f3f83['status'](_0x2c97d9)[_0xb033('0x17')]();};}function respondWithResult(_0x3b9f85,_0x499a86){_0x499a86=_0x499a86||0xc8;return function(_0x5311a9){if(_0x5311a9){return _0x3b9f85['status'](_0x499a86)[_0xb033('0x18')](_0x5311a9);}};}function respondWithFilteredResult(_0x4ab046,_0x3b4320){return function(_0x4a6d52){if(_0x4a6d52){var _0x1aaec1=_0x4a6d52['count'],_0x310c1f=_0x3b4320[_0xb033('0x19')],_0x128d0e=_0x3b4320[_0xb033('0x19')]+_0x3b4320[_0xb033('0x1a')],_0x126287;if(_0x128d0e>=_0x1aaec1){_0x128d0e=_0x1aaec1;_0x126287=0xc8;}else{_0x126287=0xce;}_0x4ab046[_0xb033('0x1b')](_0x126287);return _0x4ab046[_0xb033('0x1c')](_0xb033('0x1d'),_0x310c1f+'-'+_0x128d0e+'/'+_0x1aaec1)[_0xb033('0x18')](_0x4a6d52);}return null;};}function patchUpdates(_0x414a59){return function(_0x30b567){try{jsonpatch[_0xb033('0x1e')](_0x30b567,_0x414a59,!![]);}catch(_0x37e566){return BPromise[_0xb033('0x1f')](_0x37e566);}return _0x30b567[_0xb033('0x20')]();};}function saveUpdates(_0x5ddc3f,_0x38a40a){return function(_0x2495e4){if(_0x2495e4){return _0x2495e4['update'](_0x5ddc3f)[_0xb033('0x21')](function(_0xcce21e){return _0xcce21e;});}return null;};}function removeEntity(_0x591c88,_0x54ad54){return function(_0x5a5d84){if(_0x5a5d84){return _0x5a5d84[_0xb033('0x22')]()['then'](function(){_0x591c88[_0xb033('0x1b')](0xcc)[_0xb033('0x17')]();});}};}function handleEntityNotFound(_0x179d51,_0x368d50){return function(_0x147d74){if(!_0x147d74){_0x179d51[_0xb033('0x16')](0x194);}return _0x147d74;};}function handleError(_0x55bbf9,_0x20c6cb){_0x20c6cb=_0x20c6cb||0x1f4;return function(_0x1cf06d){logger['error'](_0x1cf06d[_0xb033('0x23')]);if(_0x1cf06d[_0xb033('0x24')]){delete _0x1cf06d[_0xb033('0x24')];}_0x55bbf9['status'](_0x20c6cb)[_0xb033('0x25')](_0x1cf06d);};}exports[_0xb033('0x26')]=function(_0x345a9d,_0x449839){var _0x4fdf43={},_0x410bc8={},_0x4ff3c7={'count':0x0,'rows':[]};var _0xf988cc=_[_0xb033('0x27')](db[_0xb033('0x28')][_0xb033('0x29')],function(_0x38af95){return{'name':_0x38af95[_0xb033('0x2a')],'type':_0x38af95['type'][_0xb033('0x2b')]};});_0x410bc8[_0xb033('0x2c')]=_[_0xb033('0x27')](_0xf988cc,_0xb033('0x24'));_0x410bc8[_0xb033('0x2d')]=_['keys'](_0x345a9d[_0xb033('0x2d')]);_0x410bc8[_0xb033('0x2e')]=_['intersection'](_0x410bc8[_0xb033('0x2c')],_0x410bc8[_0xb033('0x2d')]);_0x4fdf43[_0xb033('0x2f')]=_[_0xb033('0x30')](_0x410bc8[_0xb033('0x2c')],qs[_0xb033('0x31')](_0x345a9d[_0xb033('0x2d')]['fields']));_0x4fdf43[_0xb033('0x2f')]=_0x4fdf43[_0xb033('0x2f')][_0xb033('0x32')]?_0x4fdf43[_0xb033('0x2f')]:_0x410bc8['model'];if(!_0x345a9d['query']['hasOwnProperty'](_0xb033('0x33'))){_0x4fdf43[_0xb033('0x1a')]=qs[_0xb033('0x1a')](_0x345a9d['query'][_0xb033('0x1a')]);_0x4fdf43[_0xb033('0x19')]=qs['offset'](_0x345a9d[_0xb033('0x2d')][_0xb033('0x19')]);}_0x4fdf43['order']=qs['sort'](_0x345a9d['query'][_0xb033('0x34')]);_0x4fdf43[_0xb033('0x35')]=qs[_0xb033('0x2e')](_[_0xb033('0x36')](_0x345a9d[_0xb033('0x2d')],_0x410bc8[_0xb033('0x2e')]),_0xf988cc);if(_0x345a9d[_0xb033('0x2d')][_0xb033('0x37')]){_0x4fdf43[_0xb033('0x35')]=_[_0xb033('0x38')](_0x4fdf43[_0xb033('0x35')],{'$or':_['map'](_0xf988cc,function(_0x2a875c){if(_0x2a875c[_0xb033('0x39')]!=='VIRTUAL'){var _0x286715={};_0x286715[_0x2a875c[_0xb033('0x24')]]={'$like':'%'+_0x345a9d['query'][_0xb033('0x37')]+'%'};return _0x286715;}})});}_0x4fdf43=_[_0xb033('0x38')]({},_0x4fdf43,_0x345a9d['options']);var _0x5f2d5a={'where':_0x4fdf43['where']};return db[_0xb033('0x28')]['count'](_0x5f2d5a)[_0xb033('0x21')](function(_0x3a21ca){_0x4ff3c7[_0xb033('0x3a')]=_0x3a21ca;if(_0x345a9d['query'][_0xb033('0x3b')]){_0x4fdf43['include']=[{'all':!![]}];}return db['UserProfileSection'][_0xb033('0x3c')](_0x4fdf43);})[_0xb033('0x21')](function(_0x2e446c){_0x4ff3c7[_0xb033('0x3d')]=_0x2e446c;return _0x4ff3c7;})[_0xb033('0x21')](respondWithFilteredResult(_0x449839,_0x4fdf43))[_0xb033('0x3e')](handleError(_0x449839,null));};exports[_0xb033('0x3f')]=function(_0x2170b2,_0x5b06d4){var _0x3985e3={'raw':![],'where':{'id':_0x2170b2[_0xb033('0x40')]['id']}},_0x4ef99b={};_0x4ef99b['model']=_[_0xb033('0x41')](db[_0xb033('0x28')][_0xb033('0x29')]);_0x4ef99b[_0xb033('0x2d')]=_[_0xb033('0x41')](_0x2170b2[_0xb033('0x2d')]);_0x4ef99b[_0xb033('0x2e')]=_[_0xb033('0x30')](_0x4ef99b[_0xb033('0x2c')],_0x4ef99b[_0xb033('0x2d')]);_0x3985e3[_0xb033('0x2f')]=_[_0xb033('0x30')](_0x4ef99b[_0xb033('0x2c')],qs[_0xb033('0x31')](_0x2170b2[_0xb033('0x2d')][_0xb033('0x31')]));_0x3985e3['attributes']=_0x3985e3[_0xb033('0x2f')]['length']?_0x3985e3['attributes']:_0x4ef99b[_0xb033('0x2c')];if(_0x2170b2[_0xb033('0x2d')][_0xb033('0x3b')]){_0x3985e3[_0xb033('0x42')]=[{'all':!![]}];}_0x3985e3=_[_0xb033('0x38')]({},_0x3985e3,_0x2170b2[_0xb033('0x43')]);return db[_0xb033('0x28')][_0xb033('0x44')](_0x3985e3)[_0xb033('0x21')](handleEntityNotFound(_0x5b06d4,null))['then'](respondWithResult(_0x5b06d4,null))[_0xb033('0x3e')](handleError(_0x5b06d4,null));};exports[_0xb033('0x45')]=function(_0xda1097,_0x4f7669){return db['UserProfileSection'][_0xb033('0x45')](_0xda1097[_0xb033('0x46')],{})['then'](respondWithResult(_0x4f7669,0xc9))['catch'](handleError(_0x4f7669,null));};exports[_0xb033('0x47')]=function(_0x38b845,_0x41a9ac){if(_0x38b845['body']['id']){delete _0x38b845['body']['id'];}return db[_0xb033('0x28')][_0xb033('0x44')]({'where':{'id':_0x38b845[_0xb033('0x40')]['id']}})[_0xb033('0x21')](handleEntityNotFound(_0x41a9ac,null))[_0xb033('0x21')](saveUpdates(_0x38b845[_0xb033('0x46')],null))['then'](respondWithResult(_0x41a9ac,null))[_0xb033('0x3e')](handleError(_0x41a9ac,null));};exports['destroy']=function(_0x140c6c,_0x1ca340){return db[_0xb033('0x28')][_0xb033('0x44')]({'where':{'id':_0x140c6c['params']['id']}})[_0xb033('0x21')](handleEntityNotFound(_0x1ca340,null))[_0xb033('0x21')](removeEntity(_0x1ca340,null))[_0xb033('0x3e')](handleError(_0x1ca340,null));};exports[_0xb033('0x48')]=function(_0xa12b11,_0x316f31){return db[_0xb033('0x28')]['describe']()[_0xb033('0x21')](respondWithResult(_0x316f31,null))[_0xb033('0x3e')](handleError(_0x316f31,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 2256db0..48ce01f 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 _0x4f6f=['user_profile_has_sections','userProfileId','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./userProfileSection.attributes','define'];(function(_0x27763f,_0xc292f6){var _0x5da79a=function(_0xd40c88){while(--_0xd40c88){_0x27763f['push'](_0x27763f['shift']());}};_0x5da79a(++_0xc292f6);}(_0x4f6f,0x157));var _0xf4f6=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0x4f6f[_0x3b150c];return _0x5cd414;};'use strict';var _=require(_0xf4f6('0x0'));var util=require(_0xf4f6('0x1'));var logger=require(_0xf4f6('0x2'))('api');var moment=require(_0xf4f6('0x3'));var BPromise=require('bluebird');var rp=require(_0xf4f6('0x4'));var fs=require('fs');var path=require(_0xf4f6('0x5'));var rimraf=require('rimraf');var config=require(_0xf4f6('0x6'));var attributes=require(_0xf4f6('0x7'));module['exports']=function(_0x31ecb6,_0x1172a6){return _0x31ecb6[_0xf4f6('0x8')]('UserProfileSection',attributes,{'tableName':_0xf4f6('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0xf4f6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7304=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserProfileSection','compositeIndex','userProfileId','lodash','../../config/logger','api'];(function(_0x561771,_0x554760){var _0x54d16e=function(_0x381c1f){while(--_0x381c1f){_0x561771['push'](_0x561771['shift']());}};_0x54d16e(++_0x554760);}(_0x7304,0x169));var _0x4730=function(_0x3a19d4,_0x3f19a4){_0x3a19d4=_0x3a19d4-0x0;var _0x5b858b=_0x7304[_0x3a19d4];return _0x5b858b;};'use strict';var _=require(_0x4730('0x0'));var util=require('util');var logger=require(_0x4730('0x1'))(_0x4730('0x2'));var moment=require(_0x4730('0x3'));var BPromise=require(_0x4730('0x4'));var rp=require(_0x4730('0x5'));var fs=require('fs');var path=require(_0x4730('0x6'));var rimraf=require(_0x4730('0x7'));var config=require(_0x4730('0x8'));var attributes=require('./userProfileSection.attributes');module[_0x4730('0x9')]=function(_0x1c3554,_0x21a3b7){return _0x1c3554[_0x4730('0xa')](_0x4730('0xb'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x4730('0xc'),'fields':['sectionId',_0x4730('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 6932064..94617a7 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 _0xb111=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb111,0x189));var _0x1b11=function(_0x242027,_0x13f270){_0x242027=_0x242027-0x0;var _0xc00b6f=_0xb111[_0x242027];return _0xc00b6f;};'use strict';var _=require(_0x1b11('0x0'));var util=require(_0x1b11('0x1'));var moment=require('moment');var BPromise=require(_0x1b11('0x2'));var rs=require(_0x1b11('0x3'));var fs=require('fs');var Redis=require(_0x1b11('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b11('0x5'));var logger=require(_0x1b11('0x6'))('rpc');var config=require(_0x1b11('0x7'));var jayson=require(_0x1b11('0x8'));var client=jayson[_0x1b11('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18c2dd,_0x1376b1,_0x458870){return new BPromise(function(_0x3dd455,_0x4790ce){return client[_0x1b11('0xa')](_0x18c2dd,_0x458870)[_0x1b11('0xb')](function(_0x19afca){logger[_0x1b11('0xc')](_0x1b11('0xd'),_0x1376b1,_0x1b11('0xe'));logger[_0x1b11('0xf')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x1376b1,_0x1b11('0xe'),JSON[_0x1b11('0x10')](_0x19afca));if(_0x19afca['error']){if(_0x19afca[_0x1b11('0x11')][_0x1b11('0x12')]===0x1f4){logger[_0x1b11('0x11')](_0x1b11('0xd'),_0x1376b1,_0x19afca[_0x1b11('0x11')][_0x1b11('0x13')]);return _0x4790ce(_0x19afca[_0x1b11('0x11')][_0x1b11('0x13')]);}logger[_0x1b11('0x11')](_0x1b11('0xd'),_0x1376b1,_0x19afca[_0x1b11('0x11')][_0x1b11('0x13')]);return _0x3dd455(_0x19afca['error'][_0x1b11('0x13')]);}else{logger[_0x1b11('0xc')](_0x1b11('0xd'),_0x1376b1,_0x1b11('0xe'));_0x3dd455(_0x19afca[_0x1b11('0x14')][_0x1b11('0x13')]);}})[_0x1b11('0x15')](function(_0x516798){logger['error'](_0x1b11('0xd'),_0x1376b1,_0x516798);_0x4790ce(_0x516798);});});} \ No newline at end of file +var _0x1bea=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x115ac5,_0x24271a){var _0x2c13e6=function(_0x1c6641){while(--_0x1c6641){_0x115ac5['push'](_0x115ac5['shift']());}};_0x2c13e6(++_0x24271a);}(_0x1bea,0x18f));var _0xa1be=function(_0x27dd09,_0xd4cda2){_0x27dd09=_0x27dd09-0x0;var _0x513f2e=_0x1bea[_0x27dd09];return _0x513f2e;};'use strict';var _=require(_0xa1be('0x0'));var util=require(_0xa1be('0x1'));var moment=require('moment');var BPromise=require(_0xa1be('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa1be('0x3'));var db=require(_0xa1be('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa1be('0x5'))(_0xa1be('0x6'));var config=require('../../config/environment');var jayson=require(_0xa1be('0x7'));var client=jayson['client'][_0xa1be('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x132c51,_0xb3beae,_0x26a097){return new BPromise(function(_0x457fbe,_0x34ab39){return client[_0xa1be('0x9')](_0x132c51,_0x26a097)['then'](function(_0xf3b5dc){logger[_0xa1be('0xa')](_0xa1be('0xb'),_0xb3beae,_0xa1be('0xc'));logger['debug'](_0xa1be('0xd'),_0xb3beae,'request\x20sent',JSON['stringify'](_0xf3b5dc));if(_0xf3b5dc[_0xa1be('0xe')]){if(_0xf3b5dc[_0xa1be('0xe')][_0xa1be('0xf')]===0x1f4){logger[_0xa1be('0xe')]('UserProfileSection,\x20%s,\x20%s',_0xb3beae,_0xf3b5dc[_0xa1be('0xe')][_0xa1be('0x10')]);return _0x34ab39(_0xf3b5dc[_0xa1be('0xe')][_0xa1be('0x10')]);}logger[_0xa1be('0xe')]('UserProfileSection,\x20%s,\x20%s',_0xb3beae,_0xf3b5dc[_0xa1be('0xe')][_0xa1be('0x10')]);return _0x457fbe(_0xf3b5dc['error'][_0xa1be('0x10')]);}else{logger[_0xa1be('0xa')](_0xa1be('0xb'),_0xb3beae,_0xa1be('0xc'));_0x457fbe(_0xf3b5dc[_0xa1be('0x11')][_0xa1be('0x10')]);}})[_0xa1be('0x12')](function(_0x5f9236){logger[_0xa1be('0xe')](_0xa1be('0xb'),_0xb3beae,_0x5f9236);_0x34ab39(_0x5f9236);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index f3e9649..1a2a09a 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 _0x57f7=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x371366,_0x56f675){var _0xe895b6=function(_0x2200c4){while(--_0x2200c4){_0x371366['push'](_0x371366['shift']());}};_0xe895b6(++_0x56f675);}(_0x57f7,0x1b0));var _0x757f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x57f7[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x757f('0x0'));var util=require('util');var path=require(_0x757f('0x1'));var timeout=require(_0x757f('0x2'));var express=require(_0x757f('0x3'));var router=express[_0x757f('0x4')]();var auth=require(_0x757f('0x5'));var interaction=require(_0x757f('0x6'));var config=require(_0x757f('0x7'));module[_0x757f('0x8')]=router; \ No newline at end of file +var _0x8ac4=['../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout','express'];(function(_0xf57573,_0x3657b8){var _0xc0e1b0=function(_0xb9082){while(--_0xb9082){_0xf57573['push'](_0xf57573['shift']());}};_0xc0e1b0(++_0x3657b8);}(_0x8ac4,0x133));var _0x48ac=function(_0x443134,_0x4a3219){_0x443134=_0x443134-0x0;var _0x1229bc=_0x8ac4[_0x443134];return _0x1229bc;};'use strict';var multer=require(_0x48ac('0x0'));var util=require(_0x48ac('0x1'));var path=require(_0x48ac('0x2'));var timeout=require(_0x48ac('0x3'));var express=require(_0x48ac('0x4'));var router=express['Router']();var auth=require(_0x48ac('0x5'));var interaction=require(_0x48ac('0x6'));var config=require(_0x48ac('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index c9f1aa6..dc6d0fc 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 _0xbaf0=['exports','INTEGER'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x22de84,_0x56142b){var _0x54fc49=function(_0x3be7bc){while(--_0x3be7bc){_0x22de84['push'](_0x22de84['shift']());}};_0x54fc49(++_0x56142b);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 6dade61..3c4369a 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 _0x0639=['exports','define','UserSmsQueue','user_has_sms_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xe58ae2,_0x30a065){var _0x369b69=function(_0xa6a029){while(--_0xa6a029){_0xe58ae2['push'](_0xe58ae2['shift']());}};_0x369b69(++_0x30a065);}(_0x0639,0x184));var _0x9063=function(_0x22b8a3,_0x2a79a7){_0x22b8a3=_0x22b8a3-0x0;var _0x199a0c=_0x0639[_0x22b8a3];return _0x199a0c;};'use strict';var _=require(_0x9063('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9063('0x1'));var moment=require(_0x9063('0x2'));var BPromise=require(_0x9063('0x3'));var rp=require(_0x9063('0x4'));var fs=require('fs');var path=require(_0x9063('0x5'));var rimraf=require(_0x9063('0x6'));var config=require(_0x9063('0x7'));var attributes=require('./userSmsQueue.attributes');module[_0x9063('0x8')]=function(_0x24a610,_0x3a7a7f){return _0x24a610[_0x9063('0x9')](_0x9063('0xa'),attributes,{'tableName':_0x9063('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00f9=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','lodash','util'];(function(_0x244db6,_0x2ebbe5){var _0x32ddea=function(_0x329e70){while(--_0x329e70){_0x244db6['push'](_0x244db6['shift']());}};_0x32ddea(++_0x2ebbe5);}(_0x00f9,0x1c1));var _0x900f=function(_0x5c2a2b,_0x22c94e){_0x5c2a2b=_0x5c2a2b-0x0;var _0x19921f=_0x00f9[_0x5c2a2b];return _0x19921f;};'use strict';var _=require(_0x900f('0x0'));var util=require(_0x900f('0x1'));var logger=require(_0x900f('0x2'))(_0x900f('0x3'));var moment=require(_0x900f('0x4'));var BPromise=require('bluebird');var rp=require(_0x900f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x900f('0x6'));var config=require(_0x900f('0x7'));var attributes=require(_0x900f('0x8'));module[_0x900f('0x9')]=function(_0x17d72c,_0x280217){return _0x17d72c[_0x900f('0xa')]('UserSmsQueue',attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index ba595c1..f3cfed8 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 _0xcad8=['client','http','request','info','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x140202,_0x4245c7){var _0x3037c2=function(_0x525d19){while(--_0x525d19){_0x140202['push'](_0x140202['shift']());}};_0x3037c2(++_0x4245c7);}(_0xcad8,0x108));var _0x8cad=function(_0x4d843f,_0x4a4401){_0x4d843f=_0x4d843f-0x0;var _0x58a99e=_0xcad8[_0x4d843f];return _0x58a99e;};'use strict';var _=require(_0x8cad('0x0'));var util=require(_0x8cad('0x1'));var moment=require('moment');var BPromise=require(_0x8cad('0x2'));var rs=require(_0x8cad('0x3'));var fs=require('fs');var Redis=require(_0x8cad('0x4'));var db=require(_0x8cad('0x5'))['db'];var utils=require(_0x8cad('0x6'));var logger=require(_0x8cad('0x7'))(_0x8cad('0x8'));var config=require(_0x8cad('0x9'));var jayson=require(_0x8cad('0xa'));var client=jayson[_0x8cad('0xb')][_0x8cad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x21b88e,_0x597dfe,_0x3b0e51){return new BPromise(function(_0xfbd49d,_0x4aff9a){return client[_0x8cad('0xd')](_0x21b88e,_0x3b0e51)['then'](function(_0x2fa70f){logger[_0x8cad('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x597dfe,'request\x20sent');logger[_0x8cad('0xf')](_0x8cad('0x10'),_0x597dfe,'request\x20sent',JSON[_0x8cad('0x11')](_0x2fa70f));if(_0x2fa70f[_0x8cad('0x12')]){if(_0x2fa70f[_0x8cad('0x12')][_0x8cad('0x13')]===0x1f4){logger[_0x8cad('0x12')](_0x8cad('0x14'),_0x597dfe,_0x2fa70f[_0x8cad('0x12')][_0x8cad('0x15')]);return _0x4aff9a(_0x2fa70f[_0x8cad('0x12')][_0x8cad('0x15')]);}logger[_0x8cad('0x12')](_0x8cad('0x14'),_0x597dfe,_0x2fa70f[_0x8cad('0x12')][_0x8cad('0x15')]);return _0xfbd49d(_0x2fa70f[_0x8cad('0x12')]['message']);}else{logger[_0x8cad('0xe')](_0x8cad('0x14'),_0x597dfe,_0x8cad('0x16'));_0xfbd49d(_0x2fa70f[_0x8cad('0x17')]['message']);}})[_0x8cad('0x18')](function(_0x2e3bb8){logger[_0x8cad('0x12')](_0x8cad('0x14'),_0x597dfe,_0x2e3bb8);_0x4aff9a(_0x2e3bb8);});});} \ No newline at end of file +var _0x3a26=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x36da11,_0x143011){var _0x1c67ba=function(_0x211711){while(--_0x211711){_0x36da11['push'](_0x36da11['shift']());}};_0x1c67ba(++_0x143011);}(_0x3a26,0x104));var _0x63a2=function(_0x28f024,_0x47aa46){_0x28f024=_0x28f024-0x0;var _0x28c851=_0x3a26[_0x28f024];return _0x28c851;};'use strict';var _=require(_0x63a2('0x0'));var util=require(_0x63a2('0x1'));var moment=require(_0x63a2('0x2'));var BPromise=require(_0x63a2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x63a2('0x4'));var db=require(_0x63a2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x63a2('0x6'))('rpc');var config=require(_0x63a2('0x7'));var jayson=require(_0x63a2('0x8'));var client=jayson['client'][_0x63a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x437506,_0x5478d9,_0x3ac37e){return new BPromise(function(_0x761896,_0x259ec6){return client[_0x63a2('0xa')](_0x437506,_0x3ac37e)[_0x63a2('0xb')](function(_0x54f927){logger['info'](_0x63a2('0xc'),_0x5478d9,_0x63a2('0xd'));logger[_0x63a2('0xe')](_0x63a2('0xf'),_0x5478d9,_0x63a2('0xd'),JSON['stringify'](_0x54f927));if(_0x54f927[_0x63a2('0x10')]){if(_0x54f927[_0x63a2('0x10')][_0x63a2('0x11')]===0x1f4){logger[_0x63a2('0x10')](_0x63a2('0xc'),_0x5478d9,_0x54f927[_0x63a2('0x10')][_0x63a2('0x12')]);return _0x259ec6(_0x54f927[_0x63a2('0x10')][_0x63a2('0x12')]);}logger[_0x63a2('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x5478d9,_0x54f927[_0x63a2('0x10')]['message']);return _0x761896(_0x54f927[_0x63a2('0x10')]['message']);}else{logger[_0x63a2('0x13')](_0x63a2('0xc'),_0x5478d9,_0x63a2('0xd'));_0x761896(_0x54f927['result']['message']);}})['catch'](function(_0x35a804){logger['error'](_0x63a2('0xc'),_0x5478d9,_0x35a804);_0x259ec6(_0x35a804);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 540f21d..43755eb 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 _0x9b8a=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xdbcda0,_0x4ac4e4){var _0x3bdc2b=function(_0x3281c3){while(--_0x3281c3){_0xdbcda0['push'](_0xdbcda0['shift']());}};_0x3bdc2b(++_0x4ac4e4);}(_0x9b8a,0xc4));var _0xa9b8=function(_0x529a0f,_0x328763){_0x529a0f=_0x529a0f-0x0;var _0x187a88=_0x9b8a[_0x529a0f];return _0x187a88;};'use strict';var multer=require('multer');var util=require(_0xa9b8('0x0'));var path=require(_0xa9b8('0x1'));var timeout=require(_0xa9b8('0x2'));var express=require(_0xa9b8('0x3'));var router=express[_0xa9b8('0x4')]();var auth=require(_0xa9b8('0x5'));var interaction=require(_0xa9b8('0x6'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x1596=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path','connect-timeout'];(function(_0x14070a,_0x5bad17){var _0x54643b=function(_0x182ce4){while(--_0x182ce4){_0x14070a['push'](_0x14070a['shift']());}};_0x54643b(++_0x5bad17);}(_0x1596,0xd4));var _0x6159=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x1596[_0x46698a];return _0x356db0;};'use strict';var multer=require(_0x6159('0x0'));var util=require(_0x6159('0x1'));var path=require(_0x6159('0x2'));var timeout=require(_0x6159('0x3'));var express=require('express');var router=express[_0x6159('0x4')]();var auth=require(_0x6159('0x5'));var interaction=require(_0x6159('0x6'));var config=require(_0x6159('0x7'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 63fcda3..c8929cb 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 _0xd8b0=['exports','sequelize'];(function(_0x5098d3,_0x245091){var _0x285389=function(_0x2a32c9){while(--_0x2a32c9){_0x5098d3['push'](_0x5098d3['shift']());}};_0x285389(++_0x245091);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x6a22ed,_0x1a0274){var _0x33ac10=function(_0x5065aa){while(--_0x5065aa){_0x6a22ed['push'](_0x6a22ed['shift']());}};_0x33ac10(++_0x1a0274);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'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 91b61c2..ae8faf6 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 _0x0b78=['util','api','moment','request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','UserVoiceQueue','user_has_voice_queues','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0b78,0x1ad));var _0x80b7=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0b78[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x80b7('0x0'));var util=require(_0x80b7('0x1'));var logger=require('../../config/logger')(_0x80b7('0x2'));var moment=require(_0x80b7('0x3'));var BPromise=require('bluebird');var rp=require(_0x80b7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x80b7('0x5'));var config=require(_0x80b7('0x6'));var attributes=require(_0x80b7('0x7'));module['exports']=function(_0x49bc7f,_0x167ddd){return _0x49bc7f['define'](_0x80b7('0x8'),attributes,{'tableName':_0x80b7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ba7=['user_has_voice_queues','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0x4be9c1,_0x50d844){var _0x7c1002=function(_0x341ef4){while(--_0x341ef4){_0x4be9c1['push'](_0x4be9c1['shift']());}};_0x7c1002(++_0x50d844);}(_0x0ba7,0x16d));var _0x70ba=function(_0x457b7b,_0x5ba98a){_0x457b7b=_0x457b7b-0x0;var _0x28f489=_0x0ba7[_0x457b7b];return _0x28f489;};'use strict';var _=require(_0x70ba('0x0'));var util=require('util');var logger=require(_0x70ba('0x1'))(_0x70ba('0x2'));var moment=require(_0x70ba('0x3'));var BPromise=require(_0x70ba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x70ba('0x5'));var rimraf=require(_0x70ba('0x6'));var config=require(_0x70ba('0x7'));var attributes=require(_0x70ba('0x8'));module[_0x70ba('0x9')]=function(_0x3f9877,_0x17a00c){return _0x3f9877[_0x70ba('0xa')](_0x70ba('0xb'),attributes,{'tableName':_0x70ba('0xc'),'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 2c28738..11b4e75 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 _0xf01c=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x1f590f,_0x10ed81){var _0x9b4f0c=function(_0x2e1967){while(--_0x2e1967){_0x1f590f['push'](_0x1f590f['shift']());}};_0x9b4f0c(++_0x10ed81);}(_0xf01c,0x165));var _0xcf01=function(_0x1cf714,_0x139a56){_0x1cf714=_0x1cf714-0x0;var _0x2d5fed=_0xf01c[_0x1cf714];return _0x2d5fed;};'use strict';var _=require(_0xcf01('0x0'));var util=require(_0xcf01('0x1'));var moment=require(_0xcf01('0x2'));var BPromise=require(_0xcf01('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcf01('0x4'));var db=require(_0xcf01('0x5'))['db'];var utils=require(_0xcf01('0x6'));var logger=require('../../config/logger')(_0xcf01('0x7'));var config=require(_0xcf01('0x8'));var jayson=require(_0xcf01('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x309f6b,_0x347986,_0x468fe9){return new BPromise(function(_0x560eda,_0x1f1257){return client['request'](_0x309f6b,_0x468fe9)['then'](function(_0xbe78fb){logger[_0xcf01('0xa')](_0xcf01('0xb'),_0x347986,'request\x20sent');logger[_0xcf01('0xc')](_0xcf01('0xd'),_0x347986,_0xcf01('0xe'),JSON[_0xcf01('0xf')](_0xbe78fb));if(_0xbe78fb[_0xcf01('0x10')]){if(_0xbe78fb[_0xcf01('0x10')][_0xcf01('0x11')]===0x1f4){logger[_0xcf01('0x10')](_0xcf01('0xb'),_0x347986,_0xbe78fb['error'][_0xcf01('0x12')]);return _0x1f1257(_0xbe78fb[_0xcf01('0x10')][_0xcf01('0x12')]);}logger[_0xcf01('0x10')](_0xcf01('0xb'),_0x347986,_0xbe78fb[_0xcf01('0x10')][_0xcf01('0x12')]);return _0x560eda(_0xbe78fb[_0xcf01('0x10')][_0xcf01('0x12')]);}else{logger[_0xcf01('0xa')](_0xcf01('0xb'),_0x347986,'request\x20sent');_0x560eda(_0xbe78fb[_0xcf01('0x13')]['message']);}})[_0xcf01('0x14')](function(_0x209c31){logger[_0xcf01('0x10')](_0xcf01('0xb'),_0x347986,_0x209c31);_0x1f1257(_0x209c31);});});} \ No newline at end of file +var _0x9ccb=['client','http','request','then','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserVoiceQueue,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x181dfe,_0xf84557){var _0x40c38f=function(_0x3aa818){while(--_0x3aa818){_0x181dfe['push'](_0x181dfe['shift']());}};_0x40c38f(++_0xf84557);}(_0x9ccb,0x117));var _0xb9cc=function(_0x39157f,_0x3d8c1e){_0x39157f=_0x39157f-0x0;var _0x1ae4e2=_0x9ccb[_0x39157f];return _0x1ae4e2;};'use strict';var _=require(_0xb9cc('0x0'));var util=require('util');var moment=require(_0xb9cc('0x1'));var BPromise=require(_0xb9cc('0x2'));var rs=require(_0xb9cc('0x3'));var fs=require('fs');var Redis=require(_0xb9cc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9cc('0x5'));var logger=require(_0xb9cc('0x6'))(_0xb9cc('0x7'));var config=require('../../config/environment');var jayson=require(_0xb9cc('0x8'));var client=jayson[_0xb9cc('0x9')][_0xb9cc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54d58e,_0x532b42,_0x174308){return new BPromise(function(_0x57941d,_0xa4e907){return client[_0xb9cc('0xb')](_0x54d58e,_0x174308)[_0xb9cc('0xc')](function(_0xd8db6e){logger[_0xb9cc('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x532b42,_0xb9cc('0xe'));logger[_0xb9cc('0xf')](_0xb9cc('0x10'),_0x532b42,_0xb9cc('0xe'),JSON[_0xb9cc('0x11')](_0xd8db6e));if(_0xd8db6e[_0xb9cc('0x12')]){if(_0xd8db6e[_0xb9cc('0x12')][_0xb9cc('0x13')]===0x1f4){logger[_0xb9cc('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x532b42,_0xd8db6e[_0xb9cc('0x12')][_0xb9cc('0x14')]);return _0xa4e907(_0xd8db6e['error'][_0xb9cc('0x14')]);}logger[_0xb9cc('0x12')](_0xb9cc('0x15'),_0x532b42,_0xd8db6e['error'][_0xb9cc('0x14')]);return _0x57941d(_0xd8db6e[_0xb9cc('0x12')][_0xb9cc('0x14')]);}else{logger['info'](_0xb9cc('0x15'),_0x532b42,_0xb9cc('0xe'));_0x57941d(_0xd8db6e[_0xb9cc('0x16')]['message']);}})[_0xb9cc('0x17')](function(_0x8a5517){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x532b42,_0x8a5517);_0xa4e907(_0x8a5517);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 9830691..e0ca443 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 _0x6f3b=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util','path','connect-timeout','Router'];(function(_0xe3468d,_0x41d361){var _0x2ff28a=function(_0x1f58b0){while(--_0x1f58b0){_0xe3468d['push'](_0xe3468d['shift']());}};_0x2ff28a(++_0x41d361);}(_0x6f3b,0x9c));var _0xb6f3=function(_0x59db37,_0x14464c){_0x59db37=_0x59db37-0x0;var _0x3a4d97=_0x6f3b[_0x59db37];return _0x3a4d97;};'use strict';var multer=require('multer');var util=require(_0xb6f3('0x0'));var path=require(_0xb6f3('0x1'));var timeout=require(_0xb6f3('0x2'));var express=require('express');var router=express[_0xb6f3('0x3')]();var auth=require(_0xb6f3('0x4'));var interaction=require(_0xb6f3('0x5'));var config=require(_0xb6f3('0x6'));module[_0xb6f3('0x7')]=router; \ No newline at end of file +var _0x6270=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x54baae,_0x3d23bf){var _0x409bc3=function(_0x247c60){while(--_0x247c60){_0x54baae['push'](_0x54baae['shift']());}};_0x409bc3(++_0x3d23bf);}(_0x6270,0x169));var _0x0627=function(_0x28972d,_0x5cd0ba){_0x28972d=_0x28972d-0x0;var _0x302084=_0x6270[_0x28972d];return _0x302084;};'use strict';var multer=require(_0x0627('0x0'));var util=require(_0x0627('0x1'));var path=require(_0x0627('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0627('0x3')]();var auth=require(_0x0627('0x4'));var interaction=require(_0x0627('0x5'));var config=require(_0x0627('0x6'));module[_0x0627('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index ff1a60b..c2cf992 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 _0xe95e=['STRING','queue_interface','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0xab7c07,_0x1cf6ae){var _0x3fbb13=function(_0x3c20b7){while(--_0x3c20b7){_0xab7c07['push'](_0xab7c07['shift']());}};_0x3fbb13(++_0x1cf6ae);}(_0xe95e,0x156));var _0xee95=function(_0x9edfd5,_0x286486){_0x9edfd5=_0x9edfd5-0x0;var _0x330738=_0xe95e[_0x9edfd5];return _0x330738;};'use strict';var Sequelize=require('sequelize');module[_0xee95('0x0')]={'uniqueid':{'type':Sequelize[_0xee95('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xee95('0x2')},'membername':{'type':Sequelize[_0xee95('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xee95('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xee95('0x3')],'allowNull':![],'unique':_0xee95('0x4'),'comment':_0xee95('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xee95('0x3')],'allowNull':![],'unique':_0xee95('0x4'),'comment':_0xee95('0x2')},'penalty':{'type':Sequelize[_0xee95('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xee95('0x1')](0xb),'defaultValue':0x0,'comment':_0xee95('0x2')}}; \ No newline at end of file +var _0x731e=['STRING','INTEGER','queue_interface','Required\x20by\x20Asterisk'];(function(_0x2f5d1c,_0x89bd){var _0x4d1267=function(_0x52403c){while(--_0x52403c){_0x2f5d1c['push'](_0x2f5d1c['shift']());}};_0x4d1267(++_0x89bd);}(_0x731e,0x133));var _0xe731=function(_0x1e7155,_0x114e5a){_0x1e7155=_0x1e7155-0x0;var _0x2e53f4=_0x731e[_0x1e7155];return _0x2e53f4;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xe731('0x0')},'membername':{'type':Sequelize[_0xe731('0x1')],'allowNull':![],'comment':_0xe731('0x0')},'UserId':{'type':Sequelize[_0xe731('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe731('0x3'),'comment':_0xe731('0x0')},'VoiceQueueId':{'type':Sequelize[_0xe731('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xe731('0x1')],'allowNull':![],'unique':_0xe731('0x3'),'comment':_0xe731('0x0')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xe731('0x0')},'paused':{'type':Sequelize[_0xe731('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 12619c6..9f72da9 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 _0x721f=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x1d84b1,_0x599872){var _0x54fa39=function(_0x48ef05){while(--_0x48ef05){_0x1d84b1['push'](_0x1d84b1['shift']());}};_0x54fa39(++_0x599872);}(_0x721f,0x193));var _0xf721=function(_0x4d22a9,_0x2aacdc){_0x4d22a9=_0x4d22a9-0x0;var _0x2a1929=_0x721f[_0x4d22a9];return _0x2a1929;};'use strict';var EventEmitter=require(_0xf721('0x0'));var UserVoiceQueueRt=require(_0xf721('0x1'))['db'][_0xf721('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xf721('0x3')](0x0);var events={'afterCreate':_0xf721('0x4'),'afterUpdate':_0xf721('0x5'),'afterDestroy':_0xf721('0x6')};function emitEvent(_0x1ac514){return function(_0xd17712,_0x1ec648,_0x30e162){UserVoiceQueueRtEvents[_0xf721('0x7')](_0x1ac514+':'+_0xd17712['id'],_0xd17712);UserVoiceQueueRtEvents[_0xf721('0x7')](_0x1ac514,_0xd17712);_0x30e162(null);};}for(var e in events){if(events[_0xf721('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0xf721('0x9')](e,emitEvent(event));}}module[_0xf721('0xa')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xe35a=['UserVoiceQueueRt','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x362de1,_0x222a1b){var _0x550a97=function(_0x49deed){while(--_0x49deed){_0x362de1['push'](_0x362de1['shift']());}};_0x550a97(++_0x222a1b);}(_0xe35a,0x87));var _0xae35=function(_0x52977b,_0xd7d36b){_0x52977b=_0x52977b-0x0;var _0x20cd0a=_0xe35a[_0x52977b];return _0x20cd0a;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xae35('0x0'))['db'][_0xae35('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xae35('0x2'),'afterUpdate':_0xae35('0x3'),'afterDestroy':'remove'};function emitEvent(_0x13ebe2){return function(_0x1737b9,_0x139dc8,_0x266834){UserVoiceQueueRtEvents['emit'](_0x13ebe2+':'+_0x1737b9['id'],_0x1737b9);UserVoiceQueueRtEvents[_0xae35('0x4')](_0x13ebe2,_0x1737b9);_0x266834(null);};}for(var e in events){if(events[_0xae35('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0xae35('0x6')](e,emitEvent(event));}}module[_0xae35('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 3eda29f..17ba28c 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 _0xb277=['user_has_voice_queues_rt','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xb277,0x114));var _0x7b27=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xb277[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x7b27('0x0'));var util=require('util');var logger=require(_0x7b27('0x1'))(_0x7b27('0x2'));var moment=require('moment');var BPromise=require(_0x7b27('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b27('0x4'));var rimraf=require(_0x7b27('0x5'));var config=require(_0x7b27('0x6'));var attributes=require(_0x7b27('0x7'));module[_0x7b27('0x8')]=function(_0x5013c3,_0x1adc4b){return _0x5013c3[_0x7b27('0x9')]('UserVoiceQueueRt',attributes,{'tableName':_0x7b27('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d84=['define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userVoiceQueueRt.attributes','exports'];(function(_0x5a1e9e,_0x40e663){var _0x26ece2=function(_0x31c4f6){while(--_0x31c4f6){_0x5a1e9e['push'](_0x5a1e9e['shift']());}};_0x26ece2(++_0x40e663);}(_0x1d84,0x1f1));var _0x41d8=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1d84[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x41d8('0x0'));var util=require('util');var logger=require(_0x41d8('0x1'))(_0x41d8('0x2'));var moment=require(_0x41d8('0x3'));var BPromise=require(_0x41d8('0x4'));var rp=require(_0x41d8('0x5'));var fs=require('fs');var path=require(_0x41d8('0x6'));var rimraf=require(_0x41d8('0x7'));var config=require('../../config/environment');var attributes=require(_0x41d8('0x8'));module[_0x41d8('0x9')]=function(_0x1998ac,_0x419ac8){return _0x1998ac[_0x41d8('0xa')](_0x41d8('0xb'),attributes,{'tableName':_0x41d8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index cd6cdbc..fa6bdbf 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 _0xfcf3=['jayson/promise','client','http','localhost','socket.io-emitter','redis','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','UserVoiceQueueRt','findAll','options','raw','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfcf3,0xab));var _0x3fcf=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xfcf3[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x3fcf('0x0'));var util=require(_0x3fcf('0x1'));var moment=require(_0x3fcf('0x2'));var BPromise=require(_0x3fcf('0x3'));var rs=require(_0x3fcf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3fcf('0x5'));var logger=require(_0x3fcf('0x6'))(_0x3fcf('0x7'));var config=require(_0x3fcf('0x8'));var jayson=require(_0x3fcf('0x9'));var client=jayson[_0x3fcf('0xa')][_0x3fcf('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x3fcf('0xc'),'port':0x18eb});var socket=require(_0x3fcf('0xd'))(new Redis(config[_0x3fcf('0xe')]));require(_0x3fcf('0xf'))[_0x3fcf('0x10')](socket);function respondWithRpcPromise(_0xed5065,_0x5e71e7,_0x4bb7ad){return new BPromise(function(_0x3b70c4,_0x39dc4f){return client[_0x3fcf('0x11')](_0xed5065,_0x4bb7ad)[_0x3fcf('0x12')](function(_0x5b2e38){logger['info'](_0x3fcf('0x13'),_0x5e71e7,'request\x20sent');logger[_0x3fcf('0x14')](_0x3fcf('0x15'),_0x5e71e7,_0x3fcf('0x16'),JSON[_0x3fcf('0x17')](_0x5b2e38));if(_0x5b2e38[_0x3fcf('0x18')]){if(_0x5b2e38[_0x3fcf('0x18')][_0x3fcf('0x19')]===0x1f4){logger[_0x3fcf('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5e71e7,_0x5b2e38[_0x3fcf('0x18')][_0x3fcf('0x1a')]);return _0x39dc4f(_0x5b2e38[_0x3fcf('0x18')][_0x3fcf('0x1a')]);}logger[_0x3fcf('0x18')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x5e71e7,_0x5b2e38['error'][_0x3fcf('0x1a')]);return _0x3b70c4(_0x5b2e38[_0x3fcf('0x18')]['message']);}else{logger[_0x3fcf('0x1b')](_0x3fcf('0x13'),_0x5e71e7,_0x3fcf('0x16'));_0x3b70c4(_0x5b2e38[_0x3fcf('0x1c')][_0x3fcf('0x1a')]);}})[_0x3fcf('0x1d')](function(_0x361692){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x5e71e7,_0x361692);_0x39dc4f(_0x361692);});});}exports['GetVoiceQueueRtPauses']=function(_0x3d0fd5){var _0x16d759=this;return new Promise(function(_0x1f2250,_0x5474bb){return db[_0x3fcf('0x1e')][_0x3fcf('0x1f')]({'raw':_0x3d0fd5[_0x3fcf('0x20')]?_0x3d0fd5[_0x3fcf('0x20')][_0x3fcf('0x21')]===undefined?!![]:![]:!![],'where':_0x3d0fd5[_0x3fcf('0x20')]?_0x3d0fd5[_0x3fcf('0x20')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`paused`\x20=\x201,\x201,\x20null'))),_0x3fcf('0x22')]]})[_0x3fcf('0x12')](function(_0xca233d){logger[_0x3fcf('0x1b')](_0x3fcf('0x23'),_0x3d0fd5);logger['debug'](_0x3fcf('0x23'),_0x3d0fd5,JSON['stringify'](_0xca233d));_0x1f2250(_0xca233d);})[_0x3fcf('0x1d')](function(_0x57d5be){logger['error'](_0x3fcf('0x23'),_0x57d5be[_0x3fcf('0x1a')],_0x3d0fd5);_0x5474bb(_0x16d759[_0x3fcf('0x18')](0x1f4,_0x57d5be['message']));});});}; \ No newline at end of file +var _0xdd9d=['where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVoiceQueueRtPauses','options'];(function(_0x236092,_0x2f90ba){var _0x353481=function(_0x591807){while(--_0x591807){_0x236092['push'](_0x236092['shift']());}};_0x353481(++_0x2f90ba);}(_0xdd9d,0xfb));var _0xddd9=function(_0x1e356a,_0x509a00){_0x1e356a=_0x1e356a-0x0;var _0x4c35ef=_0xdd9d[_0x1e356a];return _0x4c35ef;};'use strict';var _=require(_0xddd9('0x0'));var util=require(_0xddd9('0x1'));var moment=require(_0xddd9('0x2'));var BPromise=require(_0xddd9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xddd9('0x4'));var db=require(_0xddd9('0x5'))['db'];var utils=require(_0xddd9('0x6'));var logger=require(_0xddd9('0x7'))(_0xddd9('0x8'));var config=require('../../config/environment');var jayson=require(_0xddd9('0x9'));var client=jayson[_0xddd9('0xa')][_0xddd9('0xb')]({'port':0x232a});config[_0xddd9('0xc')]=_[_0xddd9('0xd')](config['redis'],{'host':_0xddd9('0xe'),'port':0x18eb});var socket=require(_0xddd9('0xf'))(new Redis(config[_0xddd9('0xc')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x13d638,_0x3fa68b,_0x16e347){return new BPromise(function(_0x52029f,_0x10a28e){return client[_0xddd9('0x10')](_0x13d638,_0x16e347)[_0xddd9('0x11')](function(_0x31c307){logger[_0xddd9('0x12')](_0xddd9('0x13'),_0x3fa68b,_0xddd9('0x14'));logger[_0xddd9('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x3fa68b,_0xddd9('0x14'),JSON[_0xddd9('0x16')](_0x31c307));if(_0x31c307[_0xddd9('0x17')]){if(_0x31c307[_0xddd9('0x17')][_0xddd9('0x18')]===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x3fa68b,_0x31c307[_0xddd9('0x17')][_0xddd9('0x19')]);return _0x10a28e(_0x31c307[_0xddd9('0x17')][_0xddd9('0x19')]);}logger['error'](_0xddd9('0x13'),_0x3fa68b,_0x31c307[_0xddd9('0x17')][_0xddd9('0x19')]);return _0x52029f(_0x31c307[_0xddd9('0x17')][_0xddd9('0x19')]);}else{logger[_0xddd9('0x12')](_0xddd9('0x13'),_0x3fa68b,_0xddd9('0x14'));_0x52029f(_0x31c307['result'][_0xddd9('0x19')]);}})[_0xddd9('0x1a')](function(_0x1715d8){logger['error'](_0xddd9('0x13'),_0x3fa68b,_0x1715d8);_0x10a28e(_0x1715d8);});});}exports[_0xddd9('0x1b')]=function(_0x306771){var _0x1ddf79=this;return new Promise(function(_0x3dfd41,_0xc4446a){return db['UserVoiceQueueRt']['findAll']({'raw':_0x306771[_0xddd9('0x1c')]?_0x306771[_0xddd9('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x306771[_0xddd9('0x1c')]?_0x306771['options'][_0xddd9('0x1d')]||null:null,'attributes':[[db[_0xddd9('0x1e')]['fn'](_0xddd9('0x1f'),db[_0xddd9('0x1e')]['fn']('IF',db[_0xddd9('0x1e')][_0xddd9('0x20')](_0xddd9('0x21')))),_0xddd9('0x22')]]})['then'](function(_0x30190e){logger[_0xddd9('0x12')](_0xddd9('0x1b'),_0x306771);logger[_0xddd9('0x15')](_0xddd9('0x1b'),_0x306771,JSON[_0xddd9('0x16')](_0x30190e));_0x3dfd41(_0x30190e);})[_0xddd9('0x1a')](function(_0x15e670){logger['error'](_0xddd9('0x1b'),_0x15e670[_0xddd9('0x19')],_0x306771);_0xc4446a(_0x1ddf79[_0xddd9('0x17')](0x1f4,_0x15e670[_0xddd9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index a2205a9..1f91a6d 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 _0x439e=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','removeListener'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0x439e,0x147));var _0xe439=function(_0x4c5087,_0x85f2be){_0x4c5087=_0x4c5087-0x0;var _0x2093c4=_0x439e[_0x4c5087];return _0x2093c4;};'use strict';var UserVoiceQueueRtEvents=require(_0xe439('0x0'));var events=['save',_0xe439('0x1'),'update'];function createListener(_0x5d7fcc,_0x574721){return function(_0x3a1cbf){_0x574721['emit'](_0x5d7fcc,_0x3a1cbf);};}function removeListener(_0x32a470,_0x3c0bbd){return function(){UserVoiceQueueRtEvents[_0xe439('0x2')](_0x32a470,_0x3c0bbd);};}exports[_0xe439('0x3')]=function(_0x4cc238){for(var _0xa3bae3=0x0,_0x595efe=events[_0xe439('0x4')];_0xa3bae3<_0x595efe;_0xa3bae3++){var _0x468a56=events[_0xa3bae3];var _0x28c829=createListener(_0xe439('0x5')+_0x468a56,_0x4cc238);UserVoiceQueueRtEvents['on'](_0x468a56,_0x28c829);}}; \ No newline at end of file +var _0x0f74=['./userVoiceQueueRt.events','update','register','userVoiceQueueRt:'];(function(_0x3dc530,_0x36a642){var _0x5be0c0=function(_0xb5572e){while(--_0xb5572e){_0x3dc530['push'](_0x3dc530['shift']());}};_0x5be0c0(++_0x36a642);}(_0x0f74,0x94));var _0x40f7=function(_0x5bd11c,_0x5b1ae8){_0x5bd11c=_0x5bd11c-0x0;var _0x44f4cc=_0x0f74[_0x5bd11c];return _0x44f4cc;};'use strict';var UserVoiceQueueRtEvents=require(_0x40f7('0x0'));var events=['save','remove',_0x40f7('0x1')];function createListener(_0x35ddda,_0x190c4d){return function(_0x46120c){_0x190c4d['emit'](_0x35ddda,_0x46120c);};}function removeListener(_0x45c1f6,_0x4d40b8){return function(){UserVoiceQueueRtEvents['removeListener'](_0x45c1f6,_0x4d40b8);};}exports[_0x40f7('0x2')]=function(_0x55f451){for(var _0x58b42a=0x0,_0x227d91=events['length'];_0x58b42a<_0x227d91;_0x58b42a++){var _0x1198aa=events[_0x58b42a];var _0x120b0c=createListener(_0x40f7('0x3')+_0x1198aa,_0x55f451);UserVoiceQueueRtEvents['on'](_0x1198aa,_0x120b0c);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 67b45d3..2d2aa03 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 _0xc70a=['Router','../../components/interaction/service','../../config/environment','exports','multer','util','path','express'];(function(_0xd0cd0b,_0x490956){var _0x59cced=function(_0x567251){while(--_0x567251){_0xd0cd0b['push'](_0xd0cd0b['shift']());}};_0x59cced(++_0x490956);}(_0xc70a,0x1ec));var _0xac70=function(_0x55c77a,_0x43ee3d){_0x55c77a=_0x55c77a-0x0;var _0x1c7d13=_0xc70a[_0x55c77a];return _0x1c7d13;};'use strict';var multer=require(_0xac70('0x0'));var util=require(_0xac70('0x1'));var path=require(_0xac70('0x2'));var timeout=require('connect-timeout');var express=require(_0xac70('0x3'));var router=express[_0xac70('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xac70('0x5'));var config=require(_0xac70('0x6'));module[_0xac70('0x7')]=router; \ No newline at end of file +var _0x944d=['multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x6d010f,_0x56388d){var _0x3ee4c9=function(_0x915b1e){while(--_0x915b1e){_0x6d010f['push'](_0x6d010f['shift']());}};_0x3ee4c9(++_0x56388d);}(_0x944d,0xe0));var _0xd944=function(_0x53f68b,_0x46a2be){_0x53f68b=_0x53f68b-0x0;var _0x42932d=_0x944d[_0x53f68b];return _0x42932d;};'use strict';var multer=require(_0xd944('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd944('0x1'));var express=require(_0xd944('0x2'));var router=express['Router']();var auth=require(_0xd944('0x3'));var interaction=require(_0xd944('0x4'));var config=require(_0xd944('0x5'));module[_0xd944('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 9c9bce2..e0057d3 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 _0xd8b0=['exports','sequelize'];(function(_0x5c8827,_0x5bc5d7){var _0x50ffd5=function(_0x4121bc){while(--_0x4121bc){_0x5c8827['push'](_0x5c8827['shift']());}};_0x50ffd5(++_0x5bc5d7);}(_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')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x101094,_0x5d3900){var _0x3d6d75=function(_0x10aa02){while(--_0x10aa02){_0x101094['push'](_0x101094['shift']());}};_0x3d6d75(++_0x5d3900);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index e0e6e0d..957563d 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 _0x4fc2=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util'];(function(_0x35387d,_0x1ba72f){var _0x3aba56=function(_0x42cd08){while(--_0x42cd08){_0x35387d['push'](_0x35387d['shift']());}};_0x3aba56(++_0x1ba72f);}(_0x4fc2,0x111));var _0x24fc=function(_0x427214,_0xaa01af){_0x427214=_0x427214-0x0;var _0x4a9fe0=_0x4fc2[_0x427214];return _0x4a9fe0;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var logger=require(_0x24fc('0x2'))(_0x24fc('0x3'));var moment=require('moment');var BPromise=require(_0x24fc('0x4'));var rp=require(_0x24fc('0x5'));var fs=require('fs');var path=require(_0x24fc('0x6'));var rimraf=require('rimraf');var config=require(_0x24fc('0x7'));var attributes=require(_0x24fc('0x8'));module['exports']=function(_0x26fcc6,_0x12d602){return _0x26fcc6['define'](_0x24fc('0x9'),attributes,{'tableName':_0x24fc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9be=['path','rimraf','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x146123,_0x84cd6c){var _0x58f0f4=function(_0x522c12){while(--_0x522c12){_0x146123['push'](_0x146123['shift']());}};_0x58f0f4(++_0x84cd6c);}(_0xb9be,0xc5));var _0xeb9b=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xb9be[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var logger=require(_0xeb9b('0x2'))(_0xeb9b('0x3'));var moment=require(_0xeb9b('0x4'));var BPromise=require(_0xeb9b('0x5'));var rp=require(_0xeb9b('0x6'));var fs=require('fs');var path=require(_0xeb9b('0x7'));var rimraf=require(_0xeb9b('0x8'));var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0xeb9b('0x9')]=function(_0x181810,_0x2529cb){return _0x181810['define'](_0xeb9b('0xa'),attributes,{'tableName':_0xeb9b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index c97eaed..ca92acc 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 _0xa9e0=['http','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\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(_0x299b1e,_0x360b92){var _0x238c94=function(_0x284d87){while(--_0x284d87){_0x299b1e['push'](_0x299b1e['shift']());}};_0x238c94(++_0x360b92);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\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(_0x2c3f5d,_0x3a6ab1){var _0x2217dd=function(_0x4a7408){while(--_0x4a7408){_0x2c3f5d['push'](_0x2c3f5d['shift']());}};_0x2217dd(++_0x3a6ab1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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/variable/index.js b/server/api/variable/index.js index 0c4a379..e75708b 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 _0xcafa=['isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment'];(function(_0x14f7c2,_0x4276a1){var _0x1df82a=function(_0x5509ca){while(--_0x5509ca){_0x14f7c2['push'](_0x14f7c2['shift']());}};_0x1df82a(++_0x4276a1);}(_0xcafa,0x19e));var _0xacaf=function(_0x12784b,_0x2d1534){_0x12784b=_0x12784b-0x0;var _0x272084=_0xcafa[_0x12784b];return _0x272084;};'use strict';var multer=require(_0xacaf('0x0'));var util=require(_0xacaf('0x1'));var path=require(_0xacaf('0x2'));var timeout=require(_0xacaf('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xacaf('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xacaf('0x5'));var controller=require('./variable.controller');router['get']('/',auth[_0xacaf('0x6')](),controller['index']);router['get'](_0xacaf('0x7'),auth[_0xacaf('0x6')](),controller[_0xacaf('0x8')]);router[_0xacaf('0x9')]('/',auth['isAuthenticated'](),controller[_0xacaf('0xa')]);router[_0xacaf('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xacaf('0xc')]);router[_0xacaf('0xd')](_0xacaf('0x7'),auth[_0xacaf('0x6')](),controller[_0xacaf('0xe')]);module['exports']=router; \ No newline at end of file +var _0x41de=['connect-timeout','express','../../config/environment','isAuthenticated','/:id','show','create','put','update','delete','destroy','multer','util'];(function(_0x266d33,_0x362c40){var _0x3e6e60=function(_0x41e591){while(--_0x41e591){_0x266d33['push'](_0x266d33['shift']());}};_0x3e6e60(++_0x362c40);}(_0x41de,0x10f));var _0xe41d=function(_0x536a13,_0x46acb3){_0x536a13=_0x536a13-0x0;var _0x16f247=_0x41de[_0x536a13];return _0x16f247;};'use strict';var multer=require(_0xe41d('0x0'));var util=require(_0xe41d('0x1'));var path=require('path');var timeout=require(_0xe41d('0x2'));var express=require(_0xe41d('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe41d('0x4'));var controller=require('./variable.controller');router['get']('/',auth[_0xe41d('0x5')](),controller['index']);router['get'](_0xe41d('0x6'),auth[_0xe41d('0x5')](),controller[_0xe41d('0x7')]);router['post']('/',auth[_0xe41d('0x5')](),controller[_0xe41d('0x8')]);router[_0xe41d('0x9')]('/:id',auth[_0xe41d('0x5')](),controller[_0xe41d('0xa')]);router[_0xe41d('0xb')](_0xe41d('0x6'),auth['isAuthenticated'](),controller[_0xe41d('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 0da59a0..cf93d04 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 _0x714b=['name','exports','STRING'];(function(_0x12ae90,_0x1a48e0){var _0x1a11d7=function(_0x557bb4){while(--_0x557bb4){_0x12ae90['push'](_0x12ae90['shift']());}};_0x1a11d7(++_0x1a48e0);}(_0x714b,0x1d8));var _0xb714=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x714b[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require('sequelize');module[_0xb714('0x0')]={'name':{'type':Sequelize[_0xb714('0x1')],'unique':_0xb714('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa976=['name','STRING'];(function(_0x2dc7c9,_0x3a15f8){var _0x3e6536=function(_0x312829){while(--_0x312829){_0x2dc7c9['push'](_0x2dc7c9['shift']());}};_0x3e6536(++_0x3a15f8);}(_0xa976,0xa5));var _0x6a97=function(_0x5a546d,_0x4215b6){_0x5a546d=_0x5a546d-0x0;var _0x582390=_0xa976[_0x5a546d];return _0x582390;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6a97('0x0')],'unique':_0x6a97('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6a97('0x0')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 02372b9..459590c 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 _0xb524=['where','includeAll','include','Variable','findAll','rows','catch','show','fields','create','body','user','role','Variables','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','name','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge'];(function(_0x2529ac,_0x1ca6a5){var _0x448be3=function(_0x3584d1){while(--_0x3584d1){_0x2529ac['push'](_0x2529ac['shift']());}};_0x448be3(++_0x1ca6a5);}(_0xb524,0x194));var _0x4b52=function(_0x13833a,_0x3a3101){_0x13833a=_0x13833a-0x0;var _0xf8b53c=_0xb524[_0x13833a];return _0xf8b53c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4b52('0x0'));var rimraf=require(_0x4b52('0x1'));var zipdir=require(_0x4b52('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4b52('0x3'));var moment=require(_0x4b52('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4b52('0x5'));var util=require(_0x4b52('0x6'));var path=require(_0x4b52('0x7'));var sox=require(_0x4b52('0x8'));var csv=require('to-csv');var ejs=require(_0x4b52('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4b52('0xa'));var jsforce=require(_0x4b52('0xb'));var deskjs=require(_0x4b52('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4b52('0xd'));var Papa=require(_0x4b52('0xe'));var Redis=require(_0x4b52('0xf'));var authService=require(_0x4b52('0x10'));var qs=require(_0x4b52('0x11'));var as=require(_0x4b52('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4b52('0x13'));var utils=require('../../config/utils');var config=require(_0x4b52('0x14'));var licenseUtil=require(_0x4b52('0x15'));var db=require(_0x4b52('0x16'))['db'];function respondWithStatusCode(_0x516ce0,_0x435d98){_0x435d98=_0x435d98||0xcc;return function(_0x5aed23){if(_0x5aed23){return _0x516ce0[_0x4b52('0x17')](_0x435d98);}return _0x516ce0[_0x4b52('0x18')](_0x435d98)[_0x4b52('0x19')]();};}function respondWithResult(_0x1a040d,_0x21895a){_0x21895a=_0x21895a||0xc8;return function(_0x1f5f65){if(_0x1f5f65){return _0x1a040d[_0x4b52('0x18')](_0x21895a)[_0x4b52('0x1a')](_0x1f5f65);}};}function respondWithFilteredResult(_0x48f641,_0x4d133a){return function(_0xb5dd09){if(_0xb5dd09){var _0x88cbb=_0xb5dd09[_0x4b52('0x1b')],_0x312b5d=_0x4d133a[_0x4b52('0x1c')],_0x12b9a6=_0x4d133a['offset']+_0x4d133a[_0x4b52('0x1d')],_0xb7f105;if(_0x12b9a6>=_0x88cbb){_0x12b9a6=_0x88cbb;_0xb7f105=0xc8;}else{_0xb7f105=0xce;}_0x48f641[_0x4b52('0x18')](_0xb7f105);return _0x48f641[_0x4b52('0x1e')](_0x4b52('0x1f'),_0x312b5d+'-'+_0x12b9a6+'/'+_0x88cbb)[_0x4b52('0x1a')](_0xb5dd09);}return null;};}function patchUpdates(_0x39167f){return function(_0x49d762){try{jsonpatch['apply'](_0x49d762,_0x39167f,!![]);}catch(_0x1dab72){return BPromise[_0x4b52('0x20')](_0x1dab72);}return _0x49d762[_0x4b52('0x21')]();};}function saveUpdates(_0x5ed5ee,_0x1211c9){return function(_0x11e122){if(_0x11e122){return _0x11e122[_0x4b52('0x22')](_0x5ed5ee)[_0x4b52('0x23')](function(_0x321299){return _0x321299;});}return null;};}function removeEntity(_0x1be7a3,_0xf43cd2){return function(_0x11502e){if(_0x11502e){return _0x11502e[_0x4b52('0x24')]()['then'](function(){var _0x5142d6=_0x11502e[_0x4b52('0x25')]({'plain':!![]});var _0x4c18a4='Variables';return db[_0x4b52('0x26')][_0x4b52('0x24')]({'where':{'type':_0x4c18a4,'resourceId':_0x5142d6['id']}})[_0x4b52('0x23')](function(){return _0x11502e;});})['then'](function(){_0x1be7a3[_0x4b52('0x18')](0xcc)[_0x4b52('0x19')]();});}};}function handleEntityNotFound(_0x32cb23,_0x453755){return function(_0xcb59b5){if(!_0xcb59b5){_0x32cb23[_0x4b52('0x17')](0x194);}return _0xcb59b5;};}function handleError(_0x378222,_0x1109a8){_0x1109a8=_0x1109a8||0x1f4;return function(_0x39688c){logger[_0x4b52('0x27')](_0x39688c['stack']);if(_0x39688c[_0x4b52('0x28')]){delete _0x39688c[_0x4b52('0x28')];}_0x378222[_0x4b52('0x18')](_0x1109a8)['send'](_0x39688c);};}exports['index']=function(_0xc08f1d,_0x14e21e){var _0xf336c6={},_0x22a4b3={},_0x5efe59={'count':0x0,'rows':[]};var _0x2b2fc2=_[_0x4b52('0x29')](db['Variable']['rawAttributes'],function(_0x1be5d7){return{'name':_0x1be5d7[_0x4b52('0x2a')],'type':_0x1be5d7[_0x4b52('0x2b')][_0x4b52('0x2c')]};});_0x22a4b3[_0x4b52('0x2d')]=_[_0x4b52('0x29')](_0x2b2fc2,_0x4b52('0x28'));_0x22a4b3[_0x4b52('0x2e')]=_[_0x4b52('0x2f')](_0xc08f1d[_0x4b52('0x2e')]);_0x22a4b3[_0x4b52('0x30')]=_[_0x4b52('0x31')](_0x22a4b3[_0x4b52('0x2d')],_0x22a4b3[_0x4b52('0x2e')]);_0xf336c6['attributes']=_[_0x4b52('0x31')](_0x22a4b3[_0x4b52('0x2d')],qs['fields'](_0xc08f1d[_0x4b52('0x2e')]['fields']));_0xf336c6[_0x4b52('0x32')]=_0xf336c6[_0x4b52('0x32')][_0x4b52('0x33')]?_0xf336c6['attributes']:_0x22a4b3[_0x4b52('0x2d')];if(!_0xc08f1d[_0x4b52('0x2e')][_0x4b52('0x34')](_0x4b52('0x35'))){_0xf336c6[_0x4b52('0x1d')]=qs[_0x4b52('0x1d')](_0xc08f1d[_0x4b52('0x2e')]['limit']);_0xf336c6[_0x4b52('0x1c')]=qs['offset'](_0xc08f1d[_0x4b52('0x2e')][_0x4b52('0x1c')]);}_0xf336c6['order']=qs['sort'](_0xc08f1d[_0x4b52('0x2e')][_0x4b52('0x36')]);_0xf336c6['where']=qs[_0x4b52('0x30')](_[_0x4b52('0x37')](_0xc08f1d[_0x4b52('0x2e')],_0x22a4b3[_0x4b52('0x30')]),_0x2b2fc2);if(_0xc08f1d[_0x4b52('0x2e')][_0x4b52('0x38')]){_0xf336c6['where']=_[_0x4b52('0x39')](_0xf336c6[_0x4b52('0x3a')],{'$or':_[_0x4b52('0x29')](_0x2b2fc2,function(_0x749d22){if(_0x749d22[_0x4b52('0x2b')]!=='VIRTUAL'){var _0x48397f={};_0x48397f[_0x749d22['name']]={'$like':'%'+_0xc08f1d[_0x4b52('0x2e')][_0x4b52('0x38')]+'%'};return _0x48397f;}})});}_0xf336c6=_[_0x4b52('0x39')]({},_0xf336c6,_0xc08f1d['options']);var _0x1f06d8={'where':_0xf336c6[_0x4b52('0x3a')]};return db['Variable'][_0x4b52('0x1b')](_0x1f06d8)[_0x4b52('0x23')](function(_0x26f5ac){_0x5efe59[_0x4b52('0x1b')]=_0x26f5ac;if(_0xc08f1d[_0x4b52('0x2e')][_0x4b52('0x3b')]){_0xf336c6[_0x4b52('0x3c')]=[{'all':!![]}];}return db[_0x4b52('0x3d')][_0x4b52('0x3e')](_0xf336c6);})[_0x4b52('0x23')](function(_0x11b10f){_0x5efe59[_0x4b52('0x3f')]=_0x11b10f;return _0x5efe59;})[_0x4b52('0x23')](respondWithFilteredResult(_0x14e21e,_0xf336c6))[_0x4b52('0x40')](handleError(_0x14e21e,null));};exports[_0x4b52('0x41')]=function(_0x1312ba,_0x2314ba){var _0x988e8b={'raw':!![],'where':{'id':_0x1312ba['params']['id']}},_0x5f5383={};_0x5f5383['model']=_['keys'](db[_0x4b52('0x3d')]['rawAttributes']);_0x5f5383[_0x4b52('0x2e')]=_[_0x4b52('0x2f')](_0x1312ba[_0x4b52('0x2e')]);_0x5f5383['filters']=_['intersection'](_0x5f5383['model'],_0x5f5383[_0x4b52('0x2e')]);_0x988e8b[_0x4b52('0x32')]=_[_0x4b52('0x31')](_0x5f5383['model'],qs[_0x4b52('0x42')](_0x1312ba[_0x4b52('0x2e')][_0x4b52('0x42')]));_0x988e8b['attributes']=_0x988e8b[_0x4b52('0x32')][_0x4b52('0x33')]?_0x988e8b[_0x4b52('0x32')]:_0x5f5383['model'];if(_0x1312ba[_0x4b52('0x2e')][_0x4b52('0x3b')]){_0x988e8b[_0x4b52('0x3c')]=[{'all':!![]}];}_0x988e8b=_[_0x4b52('0x39')]({},_0x988e8b,_0x1312ba['options']);return db[_0x4b52('0x3d')]['find'](_0x988e8b)[_0x4b52('0x23')](handleEntityNotFound(_0x2314ba,null))[_0x4b52('0x23')](respondWithResult(_0x2314ba,null))['catch'](handleError(_0x2314ba,null));};exports['create']=function(_0x3b8555,_0xb4fd4b){return db['Variable'][_0x4b52('0x43')](_0x3b8555[_0x4b52('0x44')],{})['then'](function(_0x6d69d){var _0x36c502=_0x3b8555[_0x4b52('0x45')][_0x4b52('0x25')]({'plain':!![]});if(!_0x36c502)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36c502[_0x4b52('0x46')]===_0x4b52('0x45')){var _0x3decad=_0x6d69d[_0x4b52('0x25')]({'plain':!![]});var _0x30bc97=_0x4b52('0x47');return db[_0x4b52('0x48')][_0x4b52('0x49')]({'where':{'name':_0x30bc97,'userProfileId':_0x36c502[_0x4b52('0x4a')]},'raw':!![]})[_0x4b52('0x23')](function(_0x4890fc){if(_0x4890fc&&_0x4890fc['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3decad['name'],'resourceId':_0x3decad['id'],'type':_0x4890fc['name'],'sectionId':_0x4890fc['id']},{})[_0x4b52('0x23')](function(){return _0x6d69d;});}else{return _0x6d69d;}})[_0x4b52('0x40')](function(_0x5e4272){logger[_0x4b52('0x27')](_0x4b52('0x4b'),_0x5e4272);throw _0x5e4272;});}return _0x6d69d;})['then'](respondWithResult(_0xb4fd4b,0xc9))[_0x4b52('0x40')](handleError(_0xb4fd4b,null));};exports[_0x4b52('0x22')]=function(_0xe7476f,_0x12ed21){if(_0xe7476f['body']['id']){delete _0xe7476f['body']['id'];}return db[_0x4b52('0x3d')][_0x4b52('0x49')]({'where':{'id':_0xe7476f[_0x4b52('0x4c')]['id']}})[_0x4b52('0x23')](handleEntityNotFound(_0x12ed21,null))['then'](saveUpdates(_0xe7476f['body'],null))['then'](respondWithResult(_0x12ed21,null))[_0x4b52('0x40')](handleError(_0x12ed21,null));};exports[_0x4b52('0x24')]=function(_0x33150a,_0x50a89b){return db[_0x4b52('0x3d')][_0x4b52('0x49')]({'where':{'id':_0x33150a[_0x4b52('0x4c')]['id']}})['then'](handleEntityNotFound(_0x50a89b,null))[_0x4b52('0x23')](removeEntity(_0x50a89b,null))[_0x4b52('0x40')](handleError(_0x50a89b,null));}; \ No newline at end of file +var _0xd742=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','destroy','then','get','Variables','UserProfileResource','error','stack','name','send','index','map','Variable','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','lodash','squel','crypto','jsforce'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xd742,0x98));var _0x2d74=function(_0x2f2792,_0x1a2e09){_0x2f2792=_0x2f2792-0x0;var _0x482ebe=_0xd742[_0x2f2792];return _0x482ebe;};'use strict';var pdf=require(_0x2d74('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2d74('0x1'));var jsonpatch=require(_0x2d74('0x2'));var rp=require(_0x2d74('0x3'));var moment=require(_0x2d74('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x2d74('0x5'));var sox=require(_0x2d74('0x6'));var csv=require('to-csv');var ejs=require(_0x2d74('0x7'));var fs=require('fs');var _=require(_0x2d74('0x8'));var squel=require(_0x2d74('0x9'));var crypto=require(_0x2d74('0xa'));var jsforce=require(_0x2d74('0xb'));var deskjs=require(_0x2d74('0xc'));var toCsv=require(_0x2d74('0xd'));var querystring=require(_0x2d74('0xe'));var Papa=require(_0x2d74('0xf'));var Redis=require(_0x2d74('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2d74('0x11'));var hardwareService=require(_0x2d74('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x2d74('0x13'));var config=require(_0x2d74('0x14'));var licenseUtil=require(_0x2d74('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52005f,_0x34f492){_0x34f492=_0x34f492||0xcc;return function(_0x1aa776){if(_0x1aa776){return _0x52005f[_0x2d74('0x16')](_0x34f492);}return _0x52005f[_0x2d74('0x17')](_0x34f492)[_0x2d74('0x18')]();};}function respondWithResult(_0x3075ba,_0x890fad){_0x890fad=_0x890fad||0xc8;return function(_0x4d2b98){if(_0x4d2b98){return _0x3075ba[_0x2d74('0x17')](_0x890fad)[_0x2d74('0x19')](_0x4d2b98);}};}function respondWithFilteredResult(_0x2c270a,_0x2ee3b4){return function(_0x544f2f){if(_0x544f2f){var _0x52057e=_0x544f2f['count'],_0x187b71=_0x2ee3b4[_0x2d74('0x1a')],_0x6900b9=_0x2ee3b4[_0x2d74('0x1a')]+_0x2ee3b4[_0x2d74('0x1b')],_0x16c906;if(_0x6900b9>=_0x52057e){_0x6900b9=_0x52057e;_0x16c906=0xc8;}else{_0x16c906=0xce;}_0x2c270a[_0x2d74('0x17')](_0x16c906);return _0x2c270a[_0x2d74('0x1c')]('Content-Range',_0x187b71+'-'+_0x6900b9+'/'+_0x52057e)[_0x2d74('0x19')](_0x544f2f);}return null;};}function patchUpdates(_0x5e68db){return function(_0x1b25f5){try{jsonpatch[_0x2d74('0x1d')](_0x1b25f5,_0x5e68db,!![]);}catch(_0x10280e){return BPromise[_0x2d74('0x1e')](_0x10280e);}return _0x1b25f5[_0x2d74('0x1f')]();};}function saveUpdates(_0x1d5282,_0x259289){return function(_0x4ba743){if(_0x4ba743){return _0x4ba743[_0x2d74('0x20')](_0x1d5282)['then'](function(_0x2bc2f7){return _0x2bc2f7;});}return null;};}function removeEntity(_0x1749ea,_0x51a10b){return function(_0x200eb4){if(_0x200eb4){return _0x200eb4[_0x2d74('0x21')]()[_0x2d74('0x22')](function(){var _0x43855c=_0x200eb4[_0x2d74('0x23')]({'plain':!![]});var _0x22bc04=_0x2d74('0x24');return db[_0x2d74('0x25')][_0x2d74('0x21')]({'where':{'type':_0x22bc04,'resourceId':_0x43855c['id']}})[_0x2d74('0x22')](function(){return _0x200eb4;});})[_0x2d74('0x22')](function(){_0x1749ea[_0x2d74('0x17')](0xcc)[_0x2d74('0x18')]();});}};}function handleEntityNotFound(_0x159282,_0x527a16){return function(_0x4b4da6){if(!_0x4b4da6){_0x159282['sendStatus'](0x194);}return _0x4b4da6;};}function handleError(_0x3cd645,_0x26ce0a){_0x26ce0a=_0x26ce0a||0x1f4;return function(_0x3b31d9){logger[_0x2d74('0x26')](_0x3b31d9[_0x2d74('0x27')]);if(_0x3b31d9['name']){delete _0x3b31d9[_0x2d74('0x28')];}_0x3cd645[_0x2d74('0x17')](_0x26ce0a)[_0x2d74('0x29')](_0x3b31d9);};}exports[_0x2d74('0x2a')]=function(_0x1f7cfb,_0x4a2fd5){var _0x4aaf65={},_0x416e22={},_0x588176={'count':0x0,'rows':[]};var _0x11c7ee=_[_0x2d74('0x2b')](db[_0x2d74('0x2c')]['rawAttributes'],function(_0x562b48){return{'name':_0x562b48[_0x2d74('0x2d')],'type':_0x562b48['type'][_0x2d74('0x2e')]};});_0x416e22[_0x2d74('0x2f')]=_[_0x2d74('0x2b')](_0x11c7ee,_0x2d74('0x28'));_0x416e22[_0x2d74('0x30')]=_['keys'](_0x1f7cfb[_0x2d74('0x30')]);_0x416e22['filters']=_[_0x2d74('0x31')](_0x416e22[_0x2d74('0x2f')],_0x416e22['query']);_0x4aaf65[_0x2d74('0x32')]=_[_0x2d74('0x31')](_0x416e22[_0x2d74('0x2f')],qs['fields'](_0x1f7cfb['query'][_0x2d74('0x33')]));_0x4aaf65[_0x2d74('0x32')]=_0x4aaf65[_0x2d74('0x32')][_0x2d74('0x34')]?_0x4aaf65[_0x2d74('0x32')]:_0x416e22[_0x2d74('0x2f')];if(!_0x1f7cfb[_0x2d74('0x30')][_0x2d74('0x35')](_0x2d74('0x36'))){_0x4aaf65[_0x2d74('0x1b')]=qs['limit'](_0x1f7cfb[_0x2d74('0x30')]['limit']);_0x4aaf65['offset']=qs[_0x2d74('0x1a')](_0x1f7cfb[_0x2d74('0x30')][_0x2d74('0x1a')]);}_0x4aaf65['order']=qs[_0x2d74('0x37')](_0x1f7cfb[_0x2d74('0x30')][_0x2d74('0x37')]);_0x4aaf65['where']=qs[_0x2d74('0x38')](_['pick'](_0x1f7cfb[_0x2d74('0x30')],_0x416e22['filters']),_0x11c7ee);if(_0x1f7cfb[_0x2d74('0x30')][_0x2d74('0x39')]){_0x4aaf65[_0x2d74('0x3a')]=_[_0x2d74('0x3b')](_0x4aaf65[_0x2d74('0x3a')],{'$or':_[_0x2d74('0x2b')](_0x11c7ee,function(_0x5dc06b){if(_0x5dc06b[_0x2d74('0x3c')]!==_0x2d74('0x3d')){var _0x1b1581={};_0x1b1581[_0x5dc06b['name']]={'$like':'%'+_0x1f7cfb[_0x2d74('0x30')]['filter']+'%'};return _0x1b1581;}})});}_0x4aaf65=_[_0x2d74('0x3b')]({},_0x4aaf65,_0x1f7cfb[_0x2d74('0x3e')]);var _0x1c2436={'where':_0x4aaf65[_0x2d74('0x3a')]};return db['Variable']['count'](_0x1c2436)[_0x2d74('0x22')](function(_0x102abd){_0x588176[_0x2d74('0x3f')]=_0x102abd;if(_0x1f7cfb[_0x2d74('0x30')][_0x2d74('0x40')]){_0x4aaf65[_0x2d74('0x41')]=[{'all':!![]}];}return db[_0x2d74('0x2c')][_0x2d74('0x42')](_0x4aaf65);})['then'](function(_0x3f7a9a){_0x588176[_0x2d74('0x43')]=_0x3f7a9a;return _0x588176;})[_0x2d74('0x22')](respondWithFilteredResult(_0x4a2fd5,_0x4aaf65))[_0x2d74('0x44')](handleError(_0x4a2fd5,null));};exports[_0x2d74('0x45')]=function(_0x24ee7f,_0x1054ed){var _0xcefcec={'raw':!![],'where':{'id':_0x24ee7f[_0x2d74('0x46')]['id']}},_0x239498={};_0x239498[_0x2d74('0x2f')]=_[_0x2d74('0x47')](db['Variable'][_0x2d74('0x48')]);_0x239498[_0x2d74('0x30')]=_[_0x2d74('0x47')](_0x24ee7f[_0x2d74('0x30')]);_0x239498[_0x2d74('0x38')]=_['intersection'](_0x239498[_0x2d74('0x2f')],_0x239498[_0x2d74('0x30')]);_0xcefcec[_0x2d74('0x32')]=_[_0x2d74('0x31')](_0x239498[_0x2d74('0x2f')],qs[_0x2d74('0x33')](_0x24ee7f['query']['fields']));_0xcefcec['attributes']=_0xcefcec[_0x2d74('0x32')][_0x2d74('0x34')]?_0xcefcec[_0x2d74('0x32')]:_0x239498[_0x2d74('0x2f')];if(_0x24ee7f[_0x2d74('0x30')][_0x2d74('0x40')]){_0xcefcec['include']=[{'all':!![]}];}_0xcefcec=_[_0x2d74('0x3b')]({},_0xcefcec,_0x24ee7f[_0x2d74('0x3e')]);return db[_0x2d74('0x2c')][_0x2d74('0x49')](_0xcefcec)[_0x2d74('0x22')](handleEntityNotFound(_0x1054ed,null))[_0x2d74('0x22')](respondWithResult(_0x1054ed,null))['catch'](handleError(_0x1054ed,null));};exports['create']=function(_0x434dce,_0x3a3e40){return db[_0x2d74('0x2c')][_0x2d74('0x4a')](_0x434dce[_0x2d74('0x4b')],{})[_0x2d74('0x22')](function(_0x2370c2){var _0x567647=_0x434dce[_0x2d74('0x4c')]['get']({'plain':!![]});if(!_0x567647)throw new Error(_0x2d74('0x4d'));if(_0x567647[_0x2d74('0x4e')]===_0x2d74('0x4c')){var _0x69e825=_0x2370c2['get']({'plain':!![]});var _0x4296f4=_0x2d74('0x24');return db[_0x2d74('0x4f')][_0x2d74('0x49')]({'where':{'name':_0x4296f4,'userProfileId':_0x567647['userProfileId']},'raw':!![]})[_0x2d74('0x22')](function(_0x1f3f7){if(_0x1f3f7&&_0x1f3f7[_0x2d74('0x50')]===0x0){return db['UserProfileResource'][_0x2d74('0x4a')]({'name':_0x69e825[_0x2d74('0x28')],'resourceId':_0x69e825['id'],'type':_0x1f3f7[_0x2d74('0x28')],'sectionId':_0x1f3f7['id']},{})[_0x2d74('0x22')](function(){return _0x2370c2;});}else{return _0x2370c2;}})[_0x2d74('0x44')](function(_0xd9c798){logger[_0x2d74('0x26')](_0x2d74('0x51'),_0xd9c798);throw _0xd9c798;});}return _0x2370c2;})[_0x2d74('0x22')](respondWithResult(_0x3a3e40,0xc9))[_0x2d74('0x44')](handleError(_0x3a3e40,null));};exports['update']=function(_0x189b68,_0x4c4fa8){if(_0x189b68[_0x2d74('0x4b')]['id']){delete _0x189b68[_0x2d74('0x4b')]['id'];}return db[_0x2d74('0x2c')]['find']({'where':{'id':_0x189b68[_0x2d74('0x46')]['id']}})[_0x2d74('0x22')](handleEntityNotFound(_0x4c4fa8,null))['then'](saveUpdates(_0x189b68[_0x2d74('0x4b')],null))[_0x2d74('0x22')](respondWithResult(_0x4c4fa8,null))['catch'](handleError(_0x4c4fa8,null));};exports[_0x2d74('0x21')]=function(_0x5425c4,_0xaf75a1){return db[_0x2d74('0x2c')]['find']({'where':{'id':_0x5425c4[_0x2d74('0x46')]['id']}})[_0x2d74('0x22')](handleEntityNotFound(_0xaf75a1,null))['then'](removeEntity(_0xaf75a1,null))[_0x2d74('0x44')](handleError(_0xaf75a1,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index fbcdd88..2b17689 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 _0xc288=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','tools_variables','lodash'];(function(_0x3ff3c2,_0x43def2){var _0x3b99c1=function(_0xb4c504){while(--_0xb4c504){_0x3ff3c2['push'](_0x3ff3c2['shift']());}};_0x3b99c1(++_0x43def2);}(_0xc288,0x18b));var _0x8c28=function(_0x3bbbee,_0x17c90f){_0x3bbbee=_0x3bbbee-0x0;var _0x56c9ce=_0xc288[_0x3bbbee];return _0x56c9ce;};'use strict';var _=require(_0x8c28('0x0'));var util=require('util');var logger=require(_0x8c28('0x1'))(_0x8c28('0x2'));var moment=require(_0x8c28('0x3'));var BPromise=require(_0x8c28('0x4'));var rp=require(_0x8c28('0x5'));var fs=require('fs');var path=require(_0x8c28('0x6'));var rimraf=require(_0x8c28('0x7'));var config=require(_0x8c28('0x8'));var attributes=require(_0x8c28('0x9'));module[_0x8c28('0xa')]=function(_0x572d7b,_0x3d5973){return _0x572d7b['define']('Variable',attributes,{'tableName':_0x8c28('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x24cd=['util','api','bluebird','request-promise','path','../../config/environment','./variable.attributes','define','Variable','tools_variables','lodash'];(function(_0x22abf4,_0x356ddd){var _0x324670=function(_0x5e70fa){while(--_0x5e70fa){_0x22abf4['push'](_0x22abf4['shift']());}};_0x324670(++_0x356ddd);}(_0x24cd,0x83));var _0xd24c=function(_0x1116c,_0x5c8cb3){_0x1116c=_0x1116c-0x0;var _0x569573=_0x24cd[_0x1116c];return _0x569573;};'use strict';var _=require(_0xd24c('0x0'));var util=require(_0xd24c('0x1'));var logger=require('../../config/logger')(_0xd24c('0x2'));var moment=require('moment');var BPromise=require(_0xd24c('0x3'));var rp=require(_0xd24c('0x4'));var fs=require('fs');var path=require(_0xd24c('0x5'));var rimraf=require('rimraf');var config=require(_0xd24c('0x6'));var attributes=require(_0xd24c('0x7'));module['exports']=function(_0x1c30fc,_0x2721be){return _0x1c30fc[_0xd24c('0x8')](_0xd24c('0x9'),attributes,{'tableName':_0xd24c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 2cbd4d8..7261618 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 _0xa425=['stringify','error','code','message','info','catch','ShowVariable','Variable','options','raw','where','attributes','map','include','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa425,0x145));var _0x5a42=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0xa425[_0x54d4a8];return _0x3b321b;};'use strict';var _=require('lodash');var util=require(_0x5a42('0x0'));var moment=require(_0x5a42('0x1'));var BPromise=require(_0x5a42('0x2'));var rs=require(_0x5a42('0x3'));var fs=require('fs');var Redis=require(_0x5a42('0x4'));var db=require(_0x5a42('0x5'))['db'];var utils=require(_0x5a42('0x6'));var logger=require(_0x5a42('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5a42('0x8'));var client=jayson['client'][_0x5a42('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f8361,_0x16ebaf,_0x4d849c){return new BPromise(function(_0x578bae,_0x3d2589){return client[_0x5a42('0xa')](_0x4f8361,_0x4d849c)[_0x5a42('0xb')](function(_0x311053){logger['info'](_0x5a42('0xc'),_0x16ebaf,_0x5a42('0xd'));logger[_0x5a42('0xe')](_0x5a42('0xf'),_0x16ebaf,_0x5a42('0xd'),JSON[_0x5a42('0x10')](_0x311053));if(_0x311053['error']){if(_0x311053[_0x5a42('0x11')][_0x5a42('0x12')]===0x1f4){logger[_0x5a42('0x11')]('Variable,\x20%s,\x20%s',_0x16ebaf,_0x311053[_0x5a42('0x11')][_0x5a42('0x13')]);return _0x3d2589(_0x311053[_0x5a42('0x11')][_0x5a42('0x13')]);}logger['error'](_0x5a42('0xc'),_0x16ebaf,_0x311053[_0x5a42('0x11')][_0x5a42('0x13')]);return _0x578bae(_0x311053['error'][_0x5a42('0x13')]);}else{logger[_0x5a42('0x14')](_0x5a42('0xc'),_0x16ebaf,_0x5a42('0xd'));_0x578bae(_0x311053['result']['message']);}})[_0x5a42('0x15')](function(_0x39fd1c){logger[_0x5a42('0x11')](_0x5a42('0xc'),_0x16ebaf,_0x39fd1c);_0x3d2589(_0x39fd1c);});});}exports[_0x5a42('0x16')]=function(_0x58386b){var _0x52bd60=this;return new Promise(function(_0x19494a,_0x153c2f){return db[_0x5a42('0x17')]['find']({'raw':_0x58386b[_0x5a42('0x18')]?_0x58386b[_0x5a42('0x18')][_0x5a42('0x19')]===undefined?!![]:![]:!![],'where':_0x58386b[_0x5a42('0x18')]?_0x58386b[_0x5a42('0x18')][_0x5a42('0x1a')]||null:null,'attributes':_0x58386b['options']?_0x58386b[_0x5a42('0x18')][_0x5a42('0x1b')]||null:null,'include':_0x58386b['options']?_0x58386b[_0x5a42('0x18')]['include']?_[_0x5a42('0x1c')](_0x58386b[_0x5a42('0x18')][_0x5a42('0x1d')],function(_0x3763ed){return{'model':db[_0x3763ed[_0x5a42('0x1e')]],'as':_0x3763ed['as'],'attributes':_0x3763ed['attributes'],'include':_0x3763ed['include']?_[_0x5a42('0x1c')](_0x3763ed['include'],function(_0x4eb5f0){return{'model':db[_0x4eb5f0[_0x5a42('0x1e')]],'as':_0x4eb5f0['as'],'attributes':_0x4eb5f0[_0x5a42('0x1b')],'include':_0x4eb5f0[_0x5a42('0x1d')]?_[_0x5a42('0x1c')](_0x4eb5f0[_0x5a42('0x1d')],function(_0x43234b){return{'model':db[_0x43234b['model']],'as':_0x43234b['as'],'attributes':_0x43234b['attributes']};}):[]};}):[]};}):[]:[]})[_0x5a42('0xb')](function(_0x5a75cb){logger['info'](_0x5a42('0x16'),_0x58386b);logger[_0x5a42('0xe')]('ShowVariable',_0x58386b,JSON[_0x5a42('0x10')](_0x5a75cb));_0x19494a(_0x5a75cb);})['catch'](function(_0x2676a4){logger['error'](_0x5a42('0x16'),_0x2676a4['message'],_0x58386b);_0x153c2f(_0x52bd60[_0x5a42('0x11')](0x1f4,_0x2676a4['message']));});});}; \ No newline at end of file +var _0xe91c=['attributes','map','include','model','ShowVariable','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Variable','find','options','where'];(function(_0x5ad2fb,_0x33fce8){var _0x11d00c=function(_0x10c2d3){while(--_0x10c2d3){_0x5ad2fb['push'](_0x5ad2fb['shift']());}};_0x11d00c(++_0x33fce8);}(_0xe91c,0xd1));var _0xce91=function(_0x4adcc9,_0x54e983){_0x4adcc9=_0x4adcc9-0x0;var _0x5de0cf=_0xe91c[_0x4adcc9];return _0x5de0cf;};'use strict';var _=require(_0xce91('0x0'));var util=require('util');var moment=require(_0xce91('0x1'));var BPromise=require(_0xce91('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce91('0x3'));var db=require(_0xce91('0x4'))['db'];var utils=require(_0xce91('0x5'));var logger=require(_0xce91('0x6'))(_0xce91('0x7'));var config=require(_0xce91('0x8'));var jayson=require(_0xce91('0x9'));var client=jayson[_0xce91('0xa')][_0xce91('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4271d4,_0xc85737,_0x291da1){return new BPromise(function(_0x5d7448,_0x29aa38){return client[_0xce91('0xc')](_0x4271d4,_0x291da1)[_0xce91('0xd')](function(_0x319a79){logger[_0xce91('0xe')](_0xce91('0xf'),_0xc85737,_0xce91('0x10'));logger[_0xce91('0x11')](_0xce91('0x12'),_0xc85737,_0xce91('0x10'),JSON[_0xce91('0x13')](_0x319a79));if(_0x319a79[_0xce91('0x14')]){if(_0x319a79[_0xce91('0x14')][_0xce91('0x15')]===0x1f4){logger[_0xce91('0x14')](_0xce91('0xf'),_0xc85737,_0x319a79['error'][_0xce91('0x16')]);return _0x29aa38(_0x319a79[_0xce91('0x14')][_0xce91('0x16')]);}logger[_0xce91('0x14')](_0xce91('0xf'),_0xc85737,_0x319a79['error'][_0xce91('0x16')]);return _0x5d7448(_0x319a79[_0xce91('0x14')]['message']);}else{logger['info'](_0xce91('0xf'),_0xc85737,_0xce91('0x10'));_0x5d7448(_0x319a79[_0xce91('0x17')][_0xce91('0x16')]);}})[_0xce91('0x18')](function(_0x4e0e8e){logger[_0xce91('0x14')](_0xce91('0xf'),_0xc85737,_0x4e0e8e);_0x29aa38(_0x4e0e8e);});});}exports['ShowVariable']=function(_0x1a63c8){var _0xa7f29=this;return new Promise(function(_0x112f18,_0x48ba92){return db[_0xce91('0x19')][_0xce91('0x1a')]({'raw':_0x1a63c8[_0xce91('0x1b')]?_0x1a63c8['options']['raw']===undefined?!![]:![]:!![],'where':_0x1a63c8[_0xce91('0x1b')]?_0x1a63c8[_0xce91('0x1b')][_0xce91('0x1c')]||null:null,'attributes':_0x1a63c8['options']?_0x1a63c8['options'][_0xce91('0x1d')]||null:null,'include':_0x1a63c8[_0xce91('0x1b')]?_0x1a63c8['options']['include']?_[_0xce91('0x1e')](_0x1a63c8[_0xce91('0x1b')][_0xce91('0x1f')],function(_0x15480e){return{'model':db[_0x15480e[_0xce91('0x20')]],'as':_0x15480e['as'],'attributes':_0x15480e['attributes'],'include':_0x15480e[_0xce91('0x1f')]?_[_0xce91('0x1e')](_0x15480e[_0xce91('0x1f')],function(_0xf868dd){return{'model':db[_0xf868dd[_0xce91('0x20')]],'as':_0xf868dd['as'],'attributes':_0xf868dd[_0xce91('0x1d')],'include':_0xf868dd[_0xce91('0x1f')]?_[_0xce91('0x1e')](_0xf868dd[_0xce91('0x1f')],function(_0x185f6f){return{'model':db[_0x185f6f[_0xce91('0x20')]],'as':_0x185f6f['as'],'attributes':_0x185f6f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xa49e06){logger[_0xce91('0xe')](_0xce91('0x21'),_0x1a63c8);logger[_0xce91('0x11')](_0xce91('0x21'),_0x1a63c8,JSON['stringify'](_0xa49e06));_0x112f18(_0xa49e06);})[_0xce91('0x18')](function(_0x3242f2){logger[_0xce91('0x14')](_0xce91('0x21'),_0x3242f2[_0xce91('0x16')],_0x1a63c8);_0x48ba92(_0xa7f29[_0xce91('0x14')](0x1f4,_0x3242f2['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index a6cffd9..131cf34 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 _0x6273=['../../components/auth/service','./version.controller','index','get','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','/restart','restart','/migrations','migrations','Router'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x6273,0x12f));var _0x3627=function(_0x29bef8,_0x27833d){_0x29bef8=_0x29bef8-0x0;var _0x9cc8d8=_0x6273[_0x29bef8];return _0x9cc8d8;};'use strict';var express=require('express');var router=express[_0x3627('0x0')]();var auth=require(_0x3627('0x1'));var controller=require(_0x3627('0x2'));router['get']('/',controller[_0x3627('0x3')]);router[_0x3627('0x4')]('/fetch',auth[_0x3627('0x5')](),auth[_0x3627('0x6')](),controller[_0x3627('0x7')]);router[_0x3627('0x4')](_0x3627('0x8'),auth['isAuthenticated'](),auth[_0x3627('0x6')](),controller[_0x3627('0x9')]);router[_0x3627('0x4')](_0x3627('0xa'),auth[_0x3627('0x5')](),auth[_0x3627('0x6')](),controller[_0x3627('0xb')]);router[_0x3627('0x4')](_0x3627('0xc'),auth[_0x3627('0x5')](),controller[_0x3627('0xd')]);router[_0x3627('0x4')](_0x3627('0xe'),controller[_0x3627('0xf')]);module['exports']=router; \ No newline at end of file +var _0x47c1=['/migrations','migrations','exports','express','../../components/auth/service','./version.controller','get','index','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull'];(function(_0x2459b4,_0x56b89a){var _0xf1caab=function(_0x1b413b){while(--_0x1b413b){_0x2459b4['push'](_0x2459b4['shift']());}};_0xf1caab(++_0x56b89a);}(_0x47c1,0x14d));var _0x147c=function(_0x7d6eca,_0x59d54a){_0x7d6eca=_0x7d6eca-0x0;var _0x128263=_0x47c1[_0x7d6eca];return _0x128263;};'use strict';var express=require(_0x147c('0x0'));var router=express['Router']();var auth=require(_0x147c('0x1'));var controller=require(_0x147c('0x2'));router[_0x147c('0x3')]('/',controller[_0x147c('0x4')]);router[_0x147c('0x3')]('/fetch',auth[_0x147c('0x5')](),auth[_0x147c('0x6')](),controller[_0x147c('0x7')]);router[_0x147c('0x3')](_0x147c('0x8'),auth[_0x147c('0x5')](),auth[_0x147c('0x6')](),controller[_0x147c('0x9')]);router[_0x147c('0x3')](_0x147c('0xa'),auth[_0x147c('0x5')](),auth[_0x147c('0x6')](),controller[_0x147c('0xb')]);router['get']('/restart',auth['isAuthenticated'](),controller['restart']);router[_0x147c('0x3')](_0x147c('0xc'),controller[_0x147c('0xd')]);module[_0x147c('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 2ad6b17..2a6b635 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 _0x195f=['umzug','path','pkginfo','version','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','exports','query','latest','tags','2.0.0','json','status','fetch','origin','master','error','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','info','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','server','length','replace','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date'];(function(_0x30dfa6,_0x582c8d){var _0xecedc4=function(_0x4c2df8){while(--_0x4c2df8){_0x30dfa6['push'](_0x30dfa6['shift']());}};_0xecedc4(++_0x582c8d);}(_0x195f,0x113));var _0xf195=function(_0x322522,_0x4db288){_0x322522=_0x322522-0x0;var _0x293bcf=_0x195f[_0x322522];return _0x293bcf;};'use strict';var Umzug=require(_0xf195('0x0'));var path=require(_0xf195('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xf195('0x2'))(module,_0xf195('0x3'));var compareVersions=require('compare-versions');var exec=require(_0xf195('0x4'))['exec'];var db=require(_0xf195('0x5'))['db'];var config=require(_0xf195('0x6'));var pm2=require(_0xf195('0x7'));var logger=require(_0xf195('0x8'))(_0xf195('0x9'));var git=require(_0xf195('0xa'))(config[_0xf195('0xb')]);exports['index']=function(_0x5eac33,_0x327cc3){var _0x15d465={'current':module[_0xf195('0xc')][_0xf195('0x3')],'phonebar':0x2};if(_0x5eac33[_0xf195('0xd')]&&_0x5eac33[_0xf195('0xd')][_0xf195('0xe')]){return git['fetch']()[_0xf195('0xf')](function(_0x384680,_0x15ee9e){_0x15d465['latest']=(_0x384680?module[_0xf195('0xc')][_0xf195('0x3')]:_0x15ee9e[_0xf195('0xe')])||_0xf195('0x10');return _0x327cc3['status'](0xc8)[_0xf195('0x11')](_0x15d465);});}else{return _0x327cc3[_0xf195('0x12')](0xc8)['json'](_0x15d465);}};exports[_0xf195('0x13')]=function(_0x5db10b,_0x3d06cc){return git[_0xf195('0x13')]([_0xf195('0x14'),_0xf195('0x15')],function(_0x27ac95){if(_0x27ac95){logger[_0xf195('0x16')](_0x27ac95);return _0x3d06cc[_0xf195('0x12')](0x1f4)[_0xf195('0x11')](_0x27ac95);}logger['info']('git\x20fetch');return _0x3d06cc[_0xf195('0x12')](0xc8)[_0xf195('0x11')]({'output':_0xf195('0x17')});});};exports[_0xf195('0x18')]=function(_0x52b7c1,_0x374fc6){return git[_0xf195('0x18')](['--hard',_0xf195('0x19')],function(_0x2c6bfd){if(_0x2c6bfd){logger['error'](_0x2c6bfd);return _0x374fc6[_0xf195('0x12')](0x1f4)[_0xf195('0x11')](_0x2c6bfd);}logger['info'](_0xf195('0x1a'));return _0x374fc6[_0xf195('0x12')](0xc8)[_0xf195('0x11')]({'output':_0xf195('0x1b')});});};exports['pull']=function(_0x5933f0,_0x5cfc82){exec(_0xf195('0x1c'),function(_0x1b2821,_0x388c36,_0x785aae){logger[_0xf195('0x1d')](_0x388c36);logger[_0xf195('0x1d')](_0x785aae);if(_0x1b2821){logger[_0xf195('0x16')](_0x1b2821);return _0x5cfc82[_0xf195('0x12')](0x1f4)[_0xf195('0x11')](_0x1b2821);}return _0x5cfc82[_0xf195('0x12')](0xc8)[_0xf195('0x11')]({'output':_0x388c36});});};exports[_0xf195('0x1e')]=function(_0x4fc393,_0x3a0ad3){return pm2[_0xf195('0x1e')](_0xf195('0x1f'))[_0xf195('0x20')](function(_0x221439){logger[_0xf195('0x1d')](_0xf195('0x21'),_0x221439);return _0x3a0ad3[_0xf195('0x12')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xf195('0x22')](function(_0x37d9e9){logger[_0xf195('0x16')](_0x37d9e9);return _0x3a0ad3[_0xf195('0x12')](0x1f4)[_0xf195('0x11')](_0x37d9e9);});};exports[_0xf195('0x23')]=function(_0x408e3b,_0x3c592e){var _0x5dbca=fs[_0xf195('0x24')](path[_0xf195('0x25')](config[_0xf195('0xb')],_0xf195('0x26'),_0xf195('0x23')));var _0xdb8e93=[];for(var _0x245a06=0x0;_0x245a06<_0x5dbca[_0xf195('0x27')];_0x245a06++){var _0x26f511=_0x5dbca[_0x245a06][_0xf195('0x28')]('.js','');if(compareVersions(module[_0xf195('0xc')][_0xf195('0x3')],_0x26f511)===-0x1){_0xdb8e93[_0xf195('0x29')](_0x26f511);}}if(_0xdb8e93[_0xf195('0x27')]){var _0x31c7ca=_0xdb8e93[_0xf195('0x2a')](compareVersions);var _0x12b169=new Umzug({'storage':_0xf195('0x2b'),'storageOptions':{'model':db[_0xf195('0x2c')],'modelName':_0xf195('0x2c'),'columnName':_0xf195('0x3')},'migrations':{'params':[db[_0xf195('0x2b')][_0xf195('0x2d')](),db[_0xf195('0x2b')][_0xf195('0x2e')],function(){throw new Error(_0xf195('0x2f'));}],'path':path[_0xf195('0x25')](config['root'],_0xf195('0x26'),_0xf195('0x23')),'pattern':/\.js$/}});_0x12b169['up']({'migrations':_[_0xf195('0x30')](_0x31c7ca,function(_0xc0a617){return _0xc0a617+_0xf195('0x31');})})['then'](function(){return _0x3c592e[_0xf195('0x12')](0xc8)[_0xf195('0x11')]({'output':_0xf195('0x32')+module['exports']['version']+_0xf195('0x33')+_[_0xf195('0x34')](_0x31c7ca),'migrations':_[_0xf195('0x25')](_0x31c7ca)});})[_0xf195('0x22')](function(_0x1bb7a3){if(_0x1bb7a3 instanceof db[_0xf195('0x2b')][_0xf195('0x35')]){return _0x3c592e[_0xf195('0x12')](0xc8)[_0xf195('0x11')]({'output':_0xf195('0x36')});}else{return _0x3c592e['status'](0x1f4)['json'](_0x1bb7a3);}});}else{return _0x3c592e[_0xf195('0x12')](0xc8)[_0xf195('0x11')]({'output':_0xf195('0x36')});}}; \ No newline at end of file +var _0x01db=['map','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','pkginfo','version','compare-versions','exec','../../config/pm2','../../config/logger','update','simple-git','root','index','query','latest','fetch','tags','exports','2.0.0','status','json','master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','migrations','join','server','length','replace','.js','push','sort','Migration','getQueryInterface','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.'];(function(_0x1e2581,_0x371c6b){var _0x24e0ea=function(_0x483e02){while(--_0x483e02){_0x1e2581['push'](_0x1e2581['shift']());}};_0x24e0ea(++_0x371c6b);}(_0x01db,0x171));var _0xb01d=function(_0x44be13,_0x5ccafc){_0x44be13=_0x44be13-0x0;var _0x57d3f2=_0x01db[_0x44be13];return _0x57d3f2;};'use strict';var Umzug=require(_0xb01d('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xb01d('0x1'))(module,_0xb01d('0x2'));var compareVersions=require(_0xb01d('0x3'));var exec=require('child_process')[_0xb01d('0x4')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0xb01d('0x5'));var logger=require(_0xb01d('0x6'))(_0xb01d('0x7'));var git=require(_0xb01d('0x8'))(config[_0xb01d('0x9')]);exports[_0xb01d('0xa')]=function(_0x3c45a3,_0x4429dd){var _0x518609={'current':module['exports'][_0xb01d('0x2')],'phonebar':0x2};if(_0x3c45a3[_0xb01d('0xb')]&&_0x3c45a3[_0xb01d('0xb')][_0xb01d('0xc')]){return git[_0xb01d('0xd')]()[_0xb01d('0xe')](function(_0x4eb866,_0x4e5999){_0x518609[_0xb01d('0xc')]=(_0x4eb866?module[_0xb01d('0xf')][_0xb01d('0x2')]:_0x4e5999[_0xb01d('0xc')])||_0xb01d('0x10');return _0x4429dd[_0xb01d('0x11')](0xc8)[_0xb01d('0x12')](_0x518609);});}else{return _0x4429dd['status'](0xc8)['json'](_0x518609);}};exports[_0xb01d('0xd')]=function(_0x5ef36c,_0x246537){return git[_0xb01d('0xd')](['origin',_0xb01d('0x13')],function(_0x34fcf8){if(_0x34fcf8){logger[_0xb01d('0x14')](_0x34fcf8);return _0x246537[_0xb01d('0x11')](0x1f4)['json'](_0x34fcf8);}logger[_0xb01d('0x15')]('git\x20fetch');return _0x246537[_0xb01d('0x11')](0xc8)[_0xb01d('0x12')]({'output':_0xb01d('0x16')});});};exports[_0xb01d('0x17')]=function(_0x566298,_0xe47874){return git[_0xb01d('0x17')]([_0xb01d('0x18'),'FETCH_HEAD'],function(_0x210023){if(_0x210023){logger['error'](_0x210023);return _0xe47874[_0xb01d('0x11')](0x1f4)[_0xb01d('0x12')](_0x210023);}logger[_0xb01d('0x15')](_0xb01d('0x19'));return _0xe47874[_0xb01d('0x11')](0xc8)['json']({'output':_0xb01d('0x1a')});});};exports[_0xb01d('0x1b')]=function(_0x149b50,_0x113d5b){exec(_0xb01d('0x1c'),function(_0x7de0a2,_0x28f643,_0x42064d){logger[_0xb01d('0x15')](_0x28f643);logger[_0xb01d('0x15')](_0x42064d);if(_0x7de0a2){logger[_0xb01d('0x14')](_0x7de0a2);return _0x113d5b[_0xb01d('0x11')](0x1f4)['json'](_0x7de0a2);}return _0x113d5b[_0xb01d('0x11')](0xc8)['json']({'output':_0x28f643});});};exports[_0xb01d('0x1d')]=function(_0x3e541d,_0x17cdf8){return pm2[_0xb01d('0x1d')](_0xb01d('0x1e'))[_0xb01d('0x1f')](function(_0x2a7af0){logger[_0xb01d('0x15')](_0xb01d('0x20'),_0x2a7af0);return _0x17cdf8[_0xb01d('0x11')](0xc8)[_0xb01d('0x12')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xb01d('0x21')](function(_0x37e513){logger[_0xb01d('0x14')](_0x37e513);return _0x17cdf8['status'](0x1f4)[_0xb01d('0x12')](_0x37e513);});};exports[_0xb01d('0x22')]=function(_0x1659fa,_0x58b452){var _0x29b32c=fs['readdirSync'](path[_0xb01d('0x23')](config[_0xb01d('0x9')],_0xb01d('0x24'),'migrations'));var _0x2f3046=[];for(var _0x2f0f7c=0x0;_0x2f0f7c<_0x29b32c[_0xb01d('0x25')];_0x2f0f7c++){var _0x13ea95=_0x29b32c[_0x2f0f7c][_0xb01d('0x26')](_0xb01d('0x27'),'');if(compareVersions(module['exports'][_0xb01d('0x2')],_0x13ea95)===-0x1){_0x2f3046[_0xb01d('0x28')](_0x13ea95);}}if(_0x2f3046[_0xb01d('0x25')]){var _0x5230da=_0x2f3046[_0xb01d('0x29')](compareVersions);var _0x48e238=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xb01d('0x2a')],'modelName':_0xb01d('0x2a'),'columnName':'version'},'migrations':{'params':[db['sequelize'][_0xb01d('0x2b')](),db[_0xb01d('0x2c')][_0xb01d('0x2d')],function(){throw new Error(_0xb01d('0x2e'));}],'path':path[_0xb01d('0x23')](config[_0xb01d('0x9')],_0xb01d('0x24'),_0xb01d('0x22')),'pattern':/\.js$/}});_0x48e238['up']({'migrations':_[_0xb01d('0x2f')](_0x5230da,function(_0x4a31ea){return _0x4a31ea+_0xb01d('0x27');})})[_0xb01d('0x1f')](function(){return _0x58b452[_0xb01d('0x11')](0xc8)[_0xb01d('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0xb01d('0xf')]['version']+_0xb01d('0x30')+_[_0xb01d('0x31')](_0x5230da),'migrations':_[_0xb01d('0x23')](_0x5230da)});})[_0xb01d('0x21')](function(_0x4e5f74){if(_0x4e5f74 instanceof db[_0xb01d('0x2c')][_0xb01d('0x32')]){return _0x58b452[_0xb01d('0x11')](0xc8)[_0xb01d('0x12')]({'output':_0xb01d('0x33')});}else{return _0x58b452['status'](0x1f4)[_0xb01d('0x12')](_0x4e5f74);}});}else{return _0x58b452[_0xb01d('0x11')](0xc8)[_0xb01d('0x12')]({'output':_0xb01d('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 732cc7f..fc04814 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 _0xb4b1=['describe','/:id','show','post','create','put','update','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated','index'];(function(_0x40e12a,_0x18c356){var _0x731ec9=function(_0x5b745f){while(--_0x5b745f){_0x40e12a['push'](_0x40e12a['shift']());}};_0x731ec9(++_0x18c356);}(_0xb4b1,0x128));var _0x1b4b=function(_0x40a51a,_0x1451c8){_0x40a51a=_0x40a51a-0x0;var _0x2adeb3=_0xb4b1[_0x40a51a];return _0x2adeb3;};'use strict';var multer=require(_0x1b4b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1b4b('0x1'));var express=require(_0x1b4b('0x2'));var router=express[_0x1b4b('0x3')]();var auth=require(_0x1b4b('0x4'));var interaction=require(_0x1b4b('0x5'));var config=require('../../config/environment');var controller=require(_0x1b4b('0x6'));router[_0x1b4b('0x7')]('/',auth[_0x1b4b('0x8')](),controller[_0x1b4b('0x9')]);router[_0x1b4b('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x1b4b('0xa')]);router[_0x1b4b('0x7')](_0x1b4b('0xb'),auth[_0x1b4b('0x8')](),controller[_0x1b4b('0xc')]);router[_0x1b4b('0xd')]('/',auth[_0x1b4b('0x8')](),controller[_0x1b4b('0xe')]);router[_0x1b4b('0xf')]('/:id',auth[_0x1b4b('0x8')](),controller[_0x1b4b('0x10')]);router['delete'](_0x1b4b('0xb'),auth[_0x1b4b('0x8')](),controller['destroy']);module[_0x1b4b('0x11')]=router; \ No newline at end of file +var _0x1a34=['/describe','describe','show','post','create','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index','get'];(function(_0x2819cd,_0x1f7703){var _0x47874c=function(_0x523698){while(--_0x523698){_0x2819cd['push'](_0x2819cd['shift']());}};_0x47874c(++_0x1f7703);}(_0x1a34,0x87));var _0x41a3=function(_0x4790c7,_0x12537a){_0x4790c7=_0x4790c7-0x0;var _0x154a0b=_0x1a34[_0x4790c7];return _0x154a0b;};'use strict';var multer=require(_0x41a3('0x0'));var util=require(_0x41a3('0x1'));var path=require('path');var timeout=require(_0x41a3('0x2'));var express=require(_0x41a3('0x3'));var router=express[_0x41a3('0x4')]();var auth=require(_0x41a3('0x5'));var interaction=require(_0x41a3('0x6'));var config=require(_0x41a3('0x7'));var controller=require(_0x41a3('0x8'));router['get']('/',auth[_0x41a3('0x9')](),controller[_0x41a3('0xa')]);router[_0x41a3('0xb')](_0x41a3('0xc'),auth[_0x41a3('0x9')](),controller[_0x41a3('0xd')]);router[_0x41a3('0xb')]('/:id',auth[_0x41a3('0x9')](),controller[_0x41a3('0xe')]);router[_0x41a3('0xf')]('/',auth['isAuthenticated'](),controller[_0x41a3('0x10')]);router['put'](_0x41a3('0x11'),auth['isAuthenticated'](),controller[_0x41a3('0x12')]);router[_0x41a3('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x41a3('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 1a2f92d..6a048f1 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 _0xb4c7=['STRING','DATE','INTEGER','BOOLEAN','sequelize','exports'];(function(_0xe7d07d,_0x52e4e3){var _0x229e46=function(_0x376839){while(--_0x376839){_0xe7d07d['push'](_0xe7d07d['shift']());}};_0x229e46(++_0x52e4e3);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x318ee7,_0x496097){_0x318ee7=_0x318ee7-0x0;var _0x363574=_0xb4c7[_0x318ee7];return _0x363574;};'use strict';var Sequelize=require(_0x7b4c('0x0'));module[_0x7b4c('0x1')]={'type':{'type':Sequelize[_0x7b4c('0x2')]},'uniqueid':{'type':Sequelize[_0x7b4c('0x2')]},'calleridnum':{'type':Sequelize[_0x7b4c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7b4c('0x2')]},'interface':{'type':Sequelize[_0x7b4c('0x2')]},'membername':{'type':Sequelize[_0x7b4c('0x2')]},'agentcalledAt':{'type':Sequelize[_0x7b4c('0x3')]},'agentconnectAt':{'type':Sequelize[_0x7b4c('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x7b4c('0x3')]},'agentdumpAt':{'type':Sequelize[_0x7b4c('0x3')]},'holdtime':{'type':Sequelize[_0x7b4c('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x7b4c('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x7b4c('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x7b4c('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7b4c('0x4')]},'reason':{'type':Sequelize[_0x7b4c('0x2')]},'lastevent':{'type':Sequelize[_0x7b4c('0x2')]},'channel':{'type':Sequelize[_0x7b4c('0x2')]},'channelstate':{'type':Sequelize[_0x7b4c('0x4')]},'channelstatedesc':{'type':Sequelize[_0x7b4c('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7b4c('0x2')]},'connectedlinename':{'type':Sequelize[_0x7b4c('0x2')]},'language':{'type':Sequelize[_0x7b4c('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x7b4c('0x2')]},'priority':{'type':Sequelize[_0x7b4c('0x2')]},'destchannel':{'type':Sequelize[_0x7b4c('0x2')]},'destchannelstate':{'type':Sequelize[_0x7b4c('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x7b4c('0x2')]},'destcalleridnum':{'type':Sequelize[_0x7b4c('0x2')]},'destcalleridname':{'type':Sequelize[_0x7b4c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7b4c('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7b4c('0x2')]},'destlanguage':{'type':Sequelize[_0x7b4c('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x7b4c('0x2')]},'destexten':{'type':Sequelize[_0x7b4c('0x2')]},'destpriority':{'type':Sequelize[_0x7b4c('0x2')]},'destuniqueid':{'type':Sequelize[_0x7b4c('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x7b4c('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x7b4c('0x2')]},'transfer':{'type':Sequelize[_0x7b4c('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7b4c('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x7b4c('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7b4c('0x2')]},'agententerreason':{'type':Sequelize[_0x7b4c('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdc97=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x2030d3,_0x46fcec){var _0x44e2fa=function(_0x534be1){while(--_0x534be1){_0x2030d3['push'](_0x2030d3['shift']());}};_0x44e2fa(++_0x46fcec);}(_0xdc97,0x13b));var _0x7dc9=function(_0x17115b,_0x1a76a2){_0x17115b=_0x17115b-0x0;var _0x30ba4b=_0xdc97[_0x17115b];return _0x30ba4b;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'type':{'type':Sequelize[_0x7dc9('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7dc9('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7dc9('0x2')]},'interface':{'type':Sequelize[_0x7dc9('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x7dc9('0x3')]},'agentconnectAt':{'type':Sequelize[_0x7dc9('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x7dc9('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x7dc9('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x7dc9('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x7dc9('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x7dc9('0x4')]},'agentacw':{'type':Sequelize[_0x7dc9('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7dc9('0x4')]},'reason':{'type':Sequelize[_0x7dc9('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7dc9('0x2')]},'channelstate':{'type':Sequelize[_0x7dc9('0x4')]},'channelstatedesc':{'type':Sequelize[_0x7dc9('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7dc9('0x2')]},'connectedlinename':{'type':Sequelize[_0x7dc9('0x2')]},'language':{'type':Sequelize[_0x7dc9('0x2')]},'accountcode':{'type':Sequelize[_0x7dc9('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x7dc9('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x7dc9('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x7dc9('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7dc9('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7dc9('0x2')]},'destlanguage':{'type':Sequelize[_0x7dc9('0x2')]},'destaccountcode':{'type':Sequelize[_0x7dc9('0x2')]},'destcontext':{'type':Sequelize[_0x7dc9('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7dc9('0x2')]},'destuniqueid':{'type':Sequelize[_0x7dc9('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x7dc9('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x7dc9('0x2')]},'transfer':{'type':Sequelize[_0x7dc9('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x7dc9('0x2')],'comment':_0x7dc9('0x6')},'transferexten':{'type':Sequelize[_0x7dc9('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7dc9('0x2')]},'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 6b5386c..235459f 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 _0x8e58=['moment','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','VoiceAgentReport','rows','show','params','keys','includeAll','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise'];(function(_0x5c5d9f,_0x2603cb){var _0xfb5de9=function(_0x8e829a){while(--_0x8e829a){_0x5c5d9f['push'](_0x5c5d9f['shift']());}};_0xfb5de9(++_0x2603cb);}(_0x8e58,0x1b2));var _0x88e5=function(_0x5c8441,_0x330f9f){_0x5c8441=_0x5c8441-0x0;var _0x5e4c90=_0x8e58[_0x5c8441];return _0x5e4c90;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x88e5('0x0'));var rimraf=require(_0x88e5('0x1'));var zipdir=require(_0x88e5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x88e5('0x3'));var moment=require(_0x88e5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x88e5('0x5'));var path=require(_0x88e5('0x6'));var sox=require(_0x88e5('0x7'));var csv=require(_0x88e5('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x88e5('0x9'));var squel=require(_0x88e5('0xa'));var crypto=require(_0x88e5('0xb'));var jsforce=require(_0x88e5('0xc'));var deskjs=require(_0x88e5('0xd'));var toCsv=require(_0x88e5('0x8'));var querystring=require('querystring');var Papa=require(_0x88e5('0xe'));var Redis=require(_0x88e5('0xf'));var authService=require(_0x88e5('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x88e5('0x11'));var logger=require(_0x88e5('0x12'))('api');var utils=require(_0x88e5('0x13'));var config=require(_0x88e5('0x14'));var licenseUtil=require(_0x88e5('0x15'));var db=require(_0x88e5('0x16'))['db'];function respondWithStatusCode(_0x3da634,_0x12b15a){_0x12b15a=_0x12b15a||0xcc;return function(_0x382f2d){if(_0x382f2d){return _0x3da634[_0x88e5('0x17')](_0x12b15a);}return _0x3da634[_0x88e5('0x18')](_0x12b15a)[_0x88e5('0x19')]();};}function respondWithResult(_0x82150f,_0x12b629){_0x12b629=_0x12b629||0xc8;return function(_0x3c3aab){if(_0x3c3aab){return _0x82150f['status'](_0x12b629)['json'](_0x3c3aab);}};}function respondWithFilteredResult(_0x1eb0da,_0x5ca20b){return function(_0x23e769){if(_0x23e769){var _0x218e54=_0x23e769[_0x88e5('0x1a')],_0x4f7023=_0x5ca20b[_0x88e5('0x1b')],_0x21bf23=_0x5ca20b['offset']+_0x5ca20b[_0x88e5('0x1c')],_0x8c6470;if(_0x21bf23>=_0x218e54){_0x21bf23=_0x218e54;_0x8c6470=0xc8;}else{_0x8c6470=0xce;}_0x1eb0da[_0x88e5('0x18')](_0x8c6470);return _0x1eb0da[_0x88e5('0x1d')]('Content-Range',_0x4f7023+'-'+_0x21bf23+'/'+_0x218e54)[_0x88e5('0x1e')](_0x23e769);}return null;};}function patchUpdates(_0x1cbdd8){return function(_0x30e947){try{jsonpatch[_0x88e5('0x1f')](_0x30e947,_0x1cbdd8,!![]);}catch(_0x517ea1){return BPromise[_0x88e5('0x20')](_0x517ea1);}return _0x30e947['save']();};}function saveUpdates(_0x30dce2,_0x1c1f6c){return function(_0xca8305){if(_0xca8305){return _0xca8305[_0x88e5('0x21')](_0x30dce2)[_0x88e5('0x22')](function(_0x1e1eb1){return _0x1e1eb1;});}return null;};}function removeEntity(_0x58f444,_0x54e7e6){return function(_0x5ee4d3){if(_0x5ee4d3){return _0x5ee4d3[_0x88e5('0x23')]()['then'](function(){_0x58f444[_0x88e5('0x18')](0xcc)[_0x88e5('0x19')]();});}};}function handleEntityNotFound(_0x2f2043,_0x347af7){return function(_0x267d43){if(!_0x267d43){_0x2f2043[_0x88e5('0x17')](0x194);}return _0x267d43;};}function handleError(_0x147a5a,_0x212174){_0x212174=_0x212174||0x1f4;return function(_0x41eedb){logger[_0x88e5('0x24')](_0x41eedb[_0x88e5('0x25')]);if(_0x41eedb[_0x88e5('0x26')]){delete _0x41eedb['name'];}_0x147a5a[_0x88e5('0x18')](_0x212174)[_0x88e5('0x27')](_0x41eedb);};}exports[_0x88e5('0x28')]=function(_0x42273b,_0x46eb2c){var _0xf72cd5={},_0x3e30ca={},_0x291b39={'count':0x0,'rows':[]};var _0x1f3d9d=_[_0x88e5('0x29')](db['VoiceAgentReport'][_0x88e5('0x2a')],function(_0xe6642a){return{'name':_0xe6642a['fieldName'],'type':_0xe6642a[_0x88e5('0x2b')][_0x88e5('0x2c')]};});_0x3e30ca['model']=_[_0x88e5('0x29')](_0x1f3d9d,_0x88e5('0x26'));_0x3e30ca[_0x88e5('0x2d')]=_['keys'](_0x42273b[_0x88e5('0x2d')]);_0x3e30ca['filters']=_[_0x88e5('0x2e')](_0x3e30ca[_0x88e5('0x2f')],_0x3e30ca['query']);_0xf72cd5[_0x88e5('0x30')]=_['intersection'](_0x3e30ca[_0x88e5('0x2f')],qs[_0x88e5('0x31')](_0x42273b[_0x88e5('0x2d')][_0x88e5('0x31')]));_0xf72cd5['attributes']=_0xf72cd5[_0x88e5('0x30')][_0x88e5('0x32')]?_0xf72cd5[_0x88e5('0x30')]:_0x3e30ca[_0x88e5('0x2f')];if(!_0x42273b[_0x88e5('0x2d')][_0x88e5('0x33')](_0x88e5('0x34'))){_0xf72cd5[_0x88e5('0x1c')]=qs[_0x88e5('0x1c')](_0x42273b[_0x88e5('0x2d')][_0x88e5('0x1c')]);_0xf72cd5[_0x88e5('0x1b')]=qs['offset'](_0x42273b[_0x88e5('0x2d')][_0x88e5('0x1b')]);}_0xf72cd5[_0x88e5('0x35')]=qs[_0x88e5('0x36')](_0x42273b[_0x88e5('0x2d')][_0x88e5('0x36')]);_0xf72cd5[_0x88e5('0x37')]=qs[_0x88e5('0x38')](_[_0x88e5('0x39')](_0x42273b[_0x88e5('0x2d')],_0x3e30ca[_0x88e5('0x38')]),_0x1f3d9d);if(_0x42273b[_0x88e5('0x2d')][_0x88e5('0x3a')]){_0xf72cd5[_0x88e5('0x37')]=_[_0x88e5('0x3b')](_0xf72cd5[_0x88e5('0x37')],{'$or':_[_0x88e5('0x29')](_0x1f3d9d,function(_0x319664){if(_0x319664['type']!=='VIRTUAL'){var _0x1e000c={};_0x1e000c[_0x319664[_0x88e5('0x26')]]={'$like':'%'+_0x42273b[_0x88e5('0x2d')]['filter']+'%'};return _0x1e000c;}})});}_0xf72cd5=_[_0x88e5('0x3b')]({},_0xf72cd5,_0x42273b[_0x88e5('0x3c')]);var _0x2b0782={'where':_0xf72cd5['where']};return db[_0x88e5('0x3d')][_0x88e5('0x1a')](_0x2b0782)['then'](function(_0x69c39e){_0x291b39['count']=_0x69c39e;if(_0x42273b[_0x88e5('0x2d')]['includeAll']){_0xf72cd5['include']=[{'all':!![]}];}return db[_0x88e5('0x3d')]['findAll'](_0xf72cd5);})[_0x88e5('0x22')](function(_0x3505ba){_0x291b39[_0x88e5('0x3e')]=_0x3505ba;return _0x291b39;})[_0x88e5('0x22')](respondWithFilteredResult(_0x46eb2c,_0xf72cd5))['catch'](handleError(_0x46eb2c,null));};exports[_0x88e5('0x3f')]=function(_0x32f20d,_0x5fed4f){var _0x11736b={'raw':![],'where':{'id':_0x32f20d[_0x88e5('0x40')]['id']}},_0x5e36b2={};_0x5e36b2[_0x88e5('0x2f')]=_[_0x88e5('0x41')](db[_0x88e5('0x3d')]['rawAttributes']);_0x5e36b2[_0x88e5('0x2d')]=_['keys'](_0x32f20d[_0x88e5('0x2d')]);_0x5e36b2['filters']=_[_0x88e5('0x2e')](_0x5e36b2['model'],_0x5e36b2[_0x88e5('0x2d')]);_0x11736b[_0x88e5('0x30')]=_[_0x88e5('0x2e')](_0x5e36b2[_0x88e5('0x2f')],qs[_0x88e5('0x31')](_0x32f20d[_0x88e5('0x2d')][_0x88e5('0x31')]));_0x11736b[_0x88e5('0x30')]=_0x11736b[_0x88e5('0x30')][_0x88e5('0x32')]?_0x11736b['attributes']:_0x5e36b2[_0x88e5('0x2f')];if(_0x32f20d[_0x88e5('0x2d')][_0x88e5('0x42')]){_0x11736b[_0x88e5('0x43')]=[{'all':!![]}];}_0x11736b=_[_0x88e5('0x3b')]({},_0x11736b,_0x32f20d['options']);return db[_0x88e5('0x3d')][_0x88e5('0x44')](_0x11736b)[_0x88e5('0x22')](handleEntityNotFound(_0x5fed4f,null))[_0x88e5('0x22')](respondWithResult(_0x5fed4f,null))[_0x88e5('0x45')](handleError(_0x5fed4f,null));};exports[_0x88e5('0x46')]=function(_0xc63e8b,_0x149098){return db[_0x88e5('0x3d')][_0x88e5('0x46')](_0xc63e8b['body'],{})[_0x88e5('0x22')](respondWithResult(_0x149098,0xc9))[_0x88e5('0x45')](handleError(_0x149098,null));};exports[_0x88e5('0x21')]=function(_0xc4e361,_0x469acd){if(_0xc4e361['body']['id']){delete _0xc4e361[_0x88e5('0x47')]['id'];}return db[_0x88e5('0x3d')][_0x88e5('0x44')]({'where':{'id':_0xc4e361[_0x88e5('0x40')]['id']}})[_0x88e5('0x22')](handleEntityNotFound(_0x469acd,null))[_0x88e5('0x22')](saveUpdates(_0xc4e361[_0x88e5('0x47')],null))[_0x88e5('0x22')](respondWithResult(_0x469acd,null))['catch'](handleError(_0x469acd,null));};exports[_0x88e5('0x23')]=function(_0x42ad61,_0xb09fc7){return db[_0x88e5('0x3d')][_0x88e5('0x44')]({'where':{'id':_0x42ad61[_0x88e5('0x40')]['id']}})['then'](handleEntityNotFound(_0xb09fc7,null))[_0x88e5('0x22')](removeEntity(_0xb09fc7,null))[_0x88e5('0x45')](handleError(_0xb09fc7,null));};exports['describe']=function(_0x1f63d9,_0x2495a3){return db[_0x88e5('0x3d')][_0x88e5('0x48')]()[_0x88e5('0x22')](respondWithResult(_0x2495a3,null))[_0x88e5('0x45')](handleError(_0x2495a3,null));}; \ No newline at end of file +var _0x446d=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','VoiceAgentReport','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','rawAttributes','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','ejs','squel','crypto','to-csv','querystring','papaparse','../../components/parsers/qs'];(function(_0x9e3666,_0x40d1fc){var _0x5b679f=function(_0x5c66a4){while(--_0x5c66a4){_0x9e3666['push'](_0x9e3666['shift']());}};_0x5b679f(++_0x40d1fc);}(_0x446d,0xc9));var _0xd446=function(_0x370338,_0x4178ec){_0x370338=_0x370338-0x0;var _0x2e10df=_0x446d[_0x370338];return _0x2e10df;};'use strict';var pdf=require(_0xd446('0x0'));var emlformat=require(_0xd446('0x1'));var rimraf=require(_0xd446('0x2'));var zipdir=require(_0xd446('0x3'));var jsonpatch=require(_0xd446('0x4'));var rp=require('request-promise');var moment=require(_0xd446('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd446('0x6'));var util=require('util');var path=require('path');var sox=require(_0xd446('0x7'));var csv=require('to-csv');var ejs=require(_0xd446('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd446('0x9'));var crypto=require(_0xd446('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd446('0xb'));var querystring=require(_0xd446('0xc'));var Papa=require(_0xd446('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd446('0xe'));var as=require(_0xd446('0xf'));var hardwareService=require(_0xd446('0x10'));var logger=require('../../config/logger')(_0xd446('0x11'));var utils=require(_0xd446('0x12'));var config=require(_0xd446('0x13'));var licenseUtil=require(_0xd446('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x519905,_0x23f664){_0x23f664=_0x23f664||0xcc;return function(_0x4c4bd1){if(_0x4c4bd1){return _0x519905[_0xd446('0x15')](_0x23f664);}return _0x519905[_0xd446('0x16')](_0x23f664)[_0xd446('0x17')]();};}function respondWithResult(_0x3d7e8b,_0x2b9b53){_0x2b9b53=_0x2b9b53||0xc8;return function(_0x20f5cf){if(_0x20f5cf){return _0x3d7e8b[_0xd446('0x16')](_0x2b9b53)[_0xd446('0x18')](_0x20f5cf);}};}function respondWithFilteredResult(_0x38e12a,_0x1c8bab){return function(_0xa032f5){if(_0xa032f5){var _0x8576c6=_0xa032f5[_0xd446('0x19')],_0x5a3b29=_0x1c8bab[_0xd446('0x1a')],_0x51541f=_0x1c8bab[_0xd446('0x1a')]+_0x1c8bab[_0xd446('0x1b')],_0x2941f7;if(_0x51541f>=_0x8576c6){_0x51541f=_0x8576c6;_0x2941f7=0xc8;}else{_0x2941f7=0xce;}_0x38e12a[_0xd446('0x16')](_0x2941f7);return _0x38e12a[_0xd446('0x1c')](_0xd446('0x1d'),_0x5a3b29+'-'+_0x51541f+'/'+_0x8576c6)[_0xd446('0x18')](_0xa032f5);}return null;};}function patchUpdates(_0x477fb9){return function(_0x385398){try{jsonpatch[_0xd446('0x1e')](_0x385398,_0x477fb9,!![]);}catch(_0x89dd62){return BPromise[_0xd446('0x1f')](_0x89dd62);}return _0x385398['save']();};}function saveUpdates(_0x14890b,_0x3897c5){return function(_0x1fa9bf){if(_0x1fa9bf){return _0x1fa9bf[_0xd446('0x20')](_0x14890b)[_0xd446('0x21')](function(_0x43ad5f){return _0x43ad5f;});}return null;};}function removeEntity(_0x37883f,_0x5117d0){return function(_0x2e8026){if(_0x2e8026){return _0x2e8026[_0xd446('0x22')]()['then'](function(){_0x37883f[_0xd446('0x16')](0xcc)[_0xd446('0x17')]();});}};}function handleEntityNotFound(_0x500f44,_0x381853){return function(_0x163bc3){if(!_0x163bc3){_0x500f44['sendStatus'](0x194);}return _0x163bc3;};}function handleError(_0xe3bf2c,_0x5f5546){_0x5f5546=_0x5f5546||0x1f4;return function(_0x323a21){logger[_0xd446('0x23')](_0x323a21[_0xd446('0x24')]);if(_0x323a21[_0xd446('0x25')]){delete _0x323a21[_0xd446('0x25')];}_0xe3bf2c['status'](_0x5f5546)[_0xd446('0x26')](_0x323a21);};}exports[_0xd446('0x27')]=function(_0x17699e,_0xf99e37){var _0x5dc8bb={},_0x1b72f9={},_0x46bf73={'count':0x0,'rows':[]};var _0xbd85f1=_[_0xd446('0x28')](db[_0xd446('0x29')]['rawAttributes'],function(_0x35ea70){return{'name':_0x35ea70['fieldName'],'type':_0x35ea70[_0xd446('0x2a')][_0xd446('0x2b')]};});_0x1b72f9[_0xd446('0x2c')]=_[_0xd446('0x28')](_0xbd85f1,_0xd446('0x25'));_0x1b72f9['query']=_['keys'](_0x17699e['query']);_0x1b72f9[_0xd446('0x2d')]=_[_0xd446('0x2e')](_0x1b72f9[_0xd446('0x2c')],_0x1b72f9[_0xd446('0x2f')]);_0x5dc8bb[_0xd446('0x30')]=_[_0xd446('0x2e')](_0x1b72f9[_0xd446('0x2c')],qs[_0xd446('0x31')](_0x17699e['query'][_0xd446('0x31')]));_0x5dc8bb[_0xd446('0x30')]=_0x5dc8bb['attributes'][_0xd446('0x32')]?_0x5dc8bb[_0xd446('0x30')]:_0x1b72f9[_0xd446('0x2c')];if(!_0x17699e[_0xd446('0x2f')][_0xd446('0x33')](_0xd446('0x34'))){_0x5dc8bb[_0xd446('0x1b')]=qs[_0xd446('0x1b')](_0x17699e[_0xd446('0x2f')]['limit']);_0x5dc8bb[_0xd446('0x1a')]=qs['offset'](_0x17699e[_0xd446('0x2f')]['offset']);}_0x5dc8bb[_0xd446('0x35')]=qs['sort'](_0x17699e[_0xd446('0x2f')][_0xd446('0x36')]);_0x5dc8bb['where']=qs[_0xd446('0x2d')](_['pick'](_0x17699e['query'],_0x1b72f9[_0xd446('0x2d')]),_0xbd85f1);if(_0x17699e[_0xd446('0x2f')][_0xd446('0x37')]){_0x5dc8bb[_0xd446('0x38')]=_[_0xd446('0x39')](_0x5dc8bb['where'],{'$or':_[_0xd446('0x28')](_0xbd85f1,function(_0x4eb923){if(_0x4eb923['type']!==_0xd446('0x3a')){var _0x16503c={};_0x16503c[_0x4eb923[_0xd446('0x25')]]={'$like':'%'+_0x17699e[_0xd446('0x2f')]['filter']+'%'};return _0x16503c;}})});}_0x5dc8bb=_['merge']({},_0x5dc8bb,_0x17699e[_0xd446('0x3b')]);var _0x5b073f={'where':_0x5dc8bb[_0xd446('0x38')]};return db[_0xd446('0x29')][_0xd446('0x19')](_0x5b073f)[_0xd446('0x21')](function(_0x447a0f){_0x46bf73[_0xd446('0x19')]=_0x447a0f;if(_0x17699e[_0xd446('0x2f')][_0xd446('0x3c')]){_0x5dc8bb[_0xd446('0x3d')]=[{'all':!![]}];}return db[_0xd446('0x29')][_0xd446('0x3e')](_0x5dc8bb);})[_0xd446('0x21')](function(_0x4e3dad){_0x46bf73['rows']=_0x4e3dad;return _0x46bf73;})[_0xd446('0x21')](respondWithFilteredResult(_0xf99e37,_0x5dc8bb))[_0xd446('0x3f')](handleError(_0xf99e37,null));};exports[_0xd446('0x40')]=function(_0x15edf4,_0x4ecf74){var _0x48e2ad={'raw':![],'where':{'id':_0x15edf4['params']['id']}},_0x3d8b52={};_0x3d8b52['model']=_[_0xd446('0x41')](db[_0xd446('0x29')][_0xd446('0x42')]);_0x3d8b52[_0xd446('0x2f')]=_[_0xd446('0x41')](_0x15edf4[_0xd446('0x2f')]);_0x3d8b52[_0xd446('0x2d')]=_[_0xd446('0x2e')](_0x3d8b52[_0xd446('0x2c')],_0x3d8b52[_0xd446('0x2f')]);_0x48e2ad['attributes']=_[_0xd446('0x2e')](_0x3d8b52[_0xd446('0x2c')],qs['fields'](_0x15edf4[_0xd446('0x2f')][_0xd446('0x31')]));_0x48e2ad['attributes']=_0x48e2ad['attributes']['length']?_0x48e2ad['attributes']:_0x3d8b52['model'];if(_0x15edf4[_0xd446('0x2f')][_0xd446('0x3c')]){_0x48e2ad['include']=[{'all':!![]}];}_0x48e2ad=_[_0xd446('0x39')]({},_0x48e2ad,_0x15edf4[_0xd446('0x3b')]);return db[_0xd446('0x29')][_0xd446('0x43')](_0x48e2ad)[_0xd446('0x21')](handleEntityNotFound(_0x4ecf74,null))['then'](respondWithResult(_0x4ecf74,null))['catch'](handleError(_0x4ecf74,null));};exports[_0xd446('0x44')]=function(_0x182e42,_0x328bce){return db[_0xd446('0x29')][_0xd446('0x44')](_0x182e42['body'],{})[_0xd446('0x21')](respondWithResult(_0x328bce,0xc9))[_0xd446('0x3f')](handleError(_0x328bce,null));};exports[_0xd446('0x20')]=function(_0x55ff0d,_0x47254d){if(_0x55ff0d[_0xd446('0x45')]['id']){delete _0x55ff0d[_0xd446('0x45')]['id'];}return db['VoiceAgentReport']['find']({'where':{'id':_0x55ff0d[_0xd446('0x46')]['id']}})[_0xd446('0x21')](handleEntityNotFound(_0x47254d,null))[_0xd446('0x21')](saveUpdates(_0x55ff0d[_0xd446('0x45')],null))[_0xd446('0x21')](respondWithResult(_0x47254d,null))[_0xd446('0x3f')](handleError(_0x47254d,null));};exports['destroy']=function(_0x2ad91c,_0xcacb1e){return db[_0xd446('0x29')]['find']({'where':{'id':_0x2ad91c['params']['id']}})['then'](handleEntityNotFound(_0xcacb1e,null))[_0xd446('0x21')](removeEntity(_0xcacb1e,null))['catch'](handleError(_0xcacb1e,null));};exports[_0xd446('0x47')]=function(_0x28b5c2,_0x8c9bfc){return db['VoiceAgentReport'][_0xd446('0x47')]()[_0xd446('0x21')](respondWithResult(_0x8c9bfc,null))[_0xd446('0x3f')](handleError(_0x8c9bfc,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index e19aa06..ce050b7 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 _0xe397=['define','VoiceAgentReport','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1b6563,_0x3bf0f1){var _0xdea7b8=function(_0x49e6c6){while(--_0x49e6c6){_0x1b6563['push'](_0x1b6563['shift']());}};_0xdea7b8(++_0x3bf0f1);}(_0xe397,0xac));var _0x7e39=function(_0xddeac9,_0x2ebf8c){_0xddeac9=_0xddeac9-0x0;var _0x65fa72=_0xe397[_0xddeac9];return _0x65fa72;};'use strict';var _=require(_0x7e39('0x0'));var util=require(_0x7e39('0x1'));var logger=require(_0x7e39('0x2'))('api');var moment=require(_0x7e39('0x3'));var BPromise=require(_0x7e39('0x4'));var rp=require(_0x7e39('0x5'));var fs=require('fs');var path=require(_0x7e39('0x6'));var rimraf=require(_0x7e39('0x7'));var config=require(_0x7e39('0x8'));var attributes=require('./voiceAgentReport.attributes');module[_0x7e39('0x9')]=function(_0x55b365,_0x21e4df){return _0x55b365[_0x7e39('0xa')](_0x7e39('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x7e39('0xc'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x99b9=['define','VoiceAgentReport','uniqueid','destuniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceAgentReport.attributes','exports'];(function(_0x1e41bf,_0x3c7361){var _0xbb1f66=function(_0x1f378d){while(--_0x1f378d){_0x1e41bf['push'](_0x1e41bf['shift']());}};_0xbb1f66(++_0x3c7361);}(_0x99b9,0x18c));var _0x999b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x99b9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x999b('0x0'));var util=require('util');var logger=require(_0x999b('0x1'))(_0x999b('0x2'));var moment=require(_0x999b('0x3'));var BPromise=require(_0x999b('0x4'));var rp=require(_0x999b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x999b('0x6'));var config=require(_0x999b('0x7'));var attributes=require(_0x999b('0x8'));module[_0x999b('0x9')]=function(_0x2c27f8,_0x3067d4){return _0x2c27f8[_0x999b('0xa')](_0x999b('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x999b('0xc'),_0x999b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index ce45dfa..567de5f 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 _0xbb41=['create','body','options','raw','UpdateVoiceAgentReport','where','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceAgentReport','VoiceAgentReport'];(function(_0x249d99,_0x16b584){var _0x5bfb05=function(_0x4f4d67){while(--_0x4f4d67){_0x249d99['push'](_0x249d99['shift']());}};_0x5bfb05(++_0x16b584);}(_0xbb41,0x1e3));var _0x1bb4=function(_0x3becd2,_0x4a8124){_0x3becd2=_0x3becd2-0x0;var _0x347cd8=_0xbb41[_0x3becd2];return _0x347cd8;};'use strict';var _=require(_0x1bb4('0x0'));var util=require(_0x1bb4('0x1'));var moment=require(_0x1bb4('0x2'));var BPromise=require('bluebird');var rs=require(_0x1bb4('0x3'));var fs=require('fs');var Redis=require(_0x1bb4('0x4'));var db=require(_0x1bb4('0x5'))['db'];var utils=require(_0x1bb4('0x6'));var logger=require(_0x1bb4('0x7'))(_0x1bb4('0x8'));var config=require('../../config/environment');var jayson=require(_0x1bb4('0x9'));var client=jayson[_0x1bb4('0xa')][_0x1bb4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48efd3,_0xd0b04,_0x4dbc1c){return new BPromise(function(_0x1abd6d,_0x1d59e4){return client[_0x1bb4('0xc')](_0x48efd3,_0x4dbc1c)[_0x1bb4('0xd')](function(_0x21770c){logger[_0x1bb4('0xe')](_0x1bb4('0xf'),_0xd0b04,_0x1bb4('0x10'));logger[_0x1bb4('0x11')](_0x1bb4('0x12'),_0xd0b04,_0x1bb4('0x10'),JSON[_0x1bb4('0x13')](_0x21770c));if(_0x21770c[_0x1bb4('0x14')]){if(_0x21770c['error'][_0x1bb4('0x15')]===0x1f4){logger[_0x1bb4('0x14')](_0x1bb4('0xf'),_0xd0b04,_0x21770c[_0x1bb4('0x14')]['message']);return _0x1d59e4(_0x21770c[_0x1bb4('0x14')][_0x1bb4('0x16')]);}logger['error'](_0x1bb4('0xf'),_0xd0b04,_0x21770c[_0x1bb4('0x14')][_0x1bb4('0x16')]);return _0x1abd6d(_0x21770c[_0x1bb4('0x14')][_0x1bb4('0x16')]);}else{logger[_0x1bb4('0xe')](_0x1bb4('0xf'),_0xd0b04,_0x1bb4('0x10'));_0x1abd6d(_0x21770c[_0x1bb4('0x17')]['message']);}})[_0x1bb4('0x18')](function(_0x55e43b){logger[_0x1bb4('0x14')](_0x1bb4('0xf'),_0xd0b04,_0x55e43b);_0x1d59e4(_0x55e43b);});});}exports[_0x1bb4('0x19')]=function(_0x448aa4){var _0x3119dc=this;return new Promise(function(_0x5b08d6,_0x51148e){return db[_0x1bb4('0x1a')][_0x1bb4('0x1b')](_0x448aa4[_0x1bb4('0x1c')],{'raw':_0x448aa4['options']?_0x448aa4[_0x1bb4('0x1d')][_0x1bb4('0x1e')]===undefined?!![]:![]:!![]})[_0x1bb4('0xd')](function(_0x235e14){logger[_0x1bb4('0xe')](_0x1bb4('0x19'),_0x448aa4);logger['debug']('CreateVoiceAgentReport',_0x448aa4,JSON[_0x1bb4('0x13')](_0x235e14));_0x5b08d6(_0x235e14);})['catch'](function(_0x1f4c86){logger[_0x1bb4('0x14')](_0x1bb4('0x19'),_0x1f4c86[_0x1bb4('0x16')],_0x448aa4);_0x51148e(_0x3119dc['error'](0x1f4,_0x1f4c86[_0x1bb4('0x16')]));});});};exports[_0x1bb4('0x1f')]=function(_0x4ab48b){var _0x5eef39=this;return new Promise(function(_0xc1d312,_0x24a10a){return db[_0x1bb4('0x1a')]['update'](_0x4ab48b[_0x1bb4('0x1c')],{'raw':_0x4ab48b[_0x1bb4('0x1d')]?_0x4ab48b[_0x1bb4('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ab48b[_0x1bb4('0x1d')]?_0x4ab48b['options'][_0x1bb4('0x20')]||null:null,'attributes':_0x4ab48b[_0x1bb4('0x1d')]?_0x4ab48b[_0x1bb4('0x1d')][_0x1bb4('0x21')]||null:null,'limit':_0x4ab48b[_0x1bb4('0x1d')]?_0x4ab48b[_0x1bb4('0x1d')]['limit']||null:null})[_0x1bb4('0xd')](function(_0x386b80){logger['info'](_0x1bb4('0x1f'),_0x4ab48b);logger[_0x1bb4('0x11')](_0x1bb4('0x1f'),_0x4ab48b,JSON[_0x1bb4('0x13')](_0x386b80));_0xc1d312(_0x386b80);})['catch'](function(_0xfb9317){logger['error'](_0x1bb4('0x1f'),_0xfb9317[_0x1bb4('0x16')],_0x4ab48b);_0x24a10a(_0x5eef39[_0x1bb4('0x14')](0x1f4,_0xfb9317[_0x1bb4('0x16')]));});});}; \ No newline at end of file +var _0x2a34=['jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceAgentReport','options','raw','debug','UpdateVoiceAgentReport','VoiceAgentReport','body','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xaf8267,_0x33968b){var _0x20798b=function(_0xaa6732){while(--_0xaa6732){_0xaf8267['push'](_0xaf8267['shift']());}};_0x20798b(++_0x33968b);}(_0x2a34,0x120));var _0x42a3=function(_0x4eb7d6,_0xc3f940){_0x4eb7d6=_0x4eb7d6-0x0;var _0x5c3ea2=_0x2a34[_0x4eb7d6];return _0x5c3ea2;};'use strict';var _=require(_0x42a3('0x0'));var util=require('util');var moment=require(_0x42a3('0x1'));var BPromise=require(_0x42a3('0x2'));var rs=require(_0x42a3('0x3'));var fs=require('fs');var Redis=require(_0x42a3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x42a3('0x5'));var logger=require(_0x42a3('0x6'))(_0x42a3('0x7'));var config=require(_0x42a3('0x8'));var jayson=require(_0x42a3('0x9'));var client=jayson[_0x42a3('0xa')][_0x42a3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58a41f,_0x4e53c1,_0x2f9bc1){return new BPromise(function(_0x2a0de6,_0xed4134){return client[_0x42a3('0xc')](_0x58a41f,_0x2f9bc1)[_0x42a3('0xd')](function(_0x5eb128){logger[_0x42a3('0xe')](_0x42a3('0xf'),_0x4e53c1,_0x42a3('0x10'));logger['debug'](_0x42a3('0x11'),_0x4e53c1,_0x42a3('0x10'),JSON[_0x42a3('0x12')](_0x5eb128));if(_0x5eb128[_0x42a3('0x13')]){if(_0x5eb128[_0x42a3('0x13')][_0x42a3('0x14')]===0x1f4){logger[_0x42a3('0x13')](_0x42a3('0xf'),_0x4e53c1,_0x5eb128[_0x42a3('0x13')][_0x42a3('0x15')]);return _0xed4134(_0x5eb128[_0x42a3('0x13')]['message']);}logger[_0x42a3('0x13')](_0x42a3('0xf'),_0x4e53c1,_0x5eb128[_0x42a3('0x13')][_0x42a3('0x15')]);return _0x2a0de6(_0x5eb128[_0x42a3('0x13')][_0x42a3('0x15')]);}else{logger['info'](_0x42a3('0xf'),_0x4e53c1,'request\x20sent');_0x2a0de6(_0x5eb128['result']['message']);}})[_0x42a3('0x16')](function(_0x5ddbba){logger['error'](_0x42a3('0xf'),_0x4e53c1,_0x5ddbba);_0xed4134(_0x5ddbba);});});}exports[_0x42a3('0x17')]=function(_0xa089b){var _0x3703eb=this;return new Promise(function(_0x9e074b,_0x37db0b){return db['VoiceAgentReport']['create'](_0xa089b['body'],{'raw':_0xa089b[_0x42a3('0x18')]?_0xa089b['options'][_0x42a3('0x19')]===undefined?!![]:![]:!![]})[_0x42a3('0xd')](function(_0x318770){logger['info']('CreateVoiceAgentReport',_0xa089b);logger[_0x42a3('0x1a')]('CreateVoiceAgentReport',_0xa089b,JSON[_0x42a3('0x12')](_0x318770));_0x9e074b(_0x318770);})[_0x42a3('0x16')](function(_0x4d3fd3){logger['error'](_0x42a3('0x17'),_0x4d3fd3[_0x42a3('0x15')],_0xa089b);_0x37db0b(_0x3703eb[_0x42a3('0x13')](0x1f4,_0x4d3fd3[_0x42a3('0x15')]));});});};exports[_0x42a3('0x1b')]=function(_0xa895ac){var _0x3a79a1=this;return new Promise(function(_0x3e0e91,_0x82e528){return db[_0x42a3('0x1c')]['update'](_0xa895ac[_0x42a3('0x1d')],{'raw':_0xa895ac[_0x42a3('0x18')]?_0xa895ac[_0x42a3('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa895ac[_0x42a3('0x18')]?_0xa895ac[_0x42a3('0x18')][_0x42a3('0x1e')]||null:null,'attributes':_0xa895ac['options']?_0xa895ac['options'][_0x42a3('0x1f')]||null:null,'limit':_0xa895ac[_0x42a3('0x18')]?_0xa895ac[_0x42a3('0x18')][_0x42a3('0x20')]||null:null})[_0x42a3('0xd')](function(_0x5253d7){logger[_0x42a3('0xe')](_0x42a3('0x1b'),_0xa895ac);logger[_0x42a3('0x1a')]('UpdateVoiceAgentReport',_0xa895ac,JSON['stringify'](_0x5253d7));_0x3e0e91(_0x5253d7);})[_0x42a3('0x16')](function(_0x57fc95){logger[_0x42a3('0x13')]('UpdateVoiceAgentReport',_0x57fc95['message'],_0xa895ac);_0x82e528(_0x3a79a1[_0x42a3('0x13')](0x1f4,_0x57fc95[_0x42a3('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index a1b94b4..168139a 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 _0xe355=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','destroy','exports','multer'];(function(_0x2a6e19,_0x417f92){var _0x2377ea=function(_0x49979c){while(--_0x49979c){_0x2a6e19['push'](_0x2a6e19['shift']());}};_0x2377ea(++_0x417f92);}(_0xe355,0xd0));var _0x5e35=function(_0x43b5a8,_0x27eeaa){_0x43b5a8=_0x43b5a8-0x0;var _0x48c4d4=_0xe355[_0x43b5a8];return _0x48c4d4;};'use strict';var multer=require(_0x5e35('0x0'));var util=require(_0x5e35('0x1'));var path=require('path');var timeout=require(_0x5e35('0x2'));var express=require(_0x5e35('0x3'));var router=express[_0x5e35('0x4')]();var auth=require(_0x5e35('0x5'));var interaction=require(_0x5e35('0x6'));var config=require(_0x5e35('0x7'));var controller=require(_0x5e35('0x8'));router[_0x5e35('0x9')]('/',auth[_0x5e35('0xa')](),controller[_0x5e35('0xb')]);router[_0x5e35('0x9')]('/describe',auth[_0x5e35('0xa')](),controller[_0x5e35('0xc')]);router[_0x5e35('0x9')](_0x5e35('0xd'),auth[_0x5e35('0xa')](),controller[_0x5e35('0xe')]);router['post']('/',auth[_0x5e35('0xa')](),controller[_0x5e35('0xf')]);router[_0x5e35('0x10')](_0x5e35('0xd'),auth[_0x5e35('0xa')](),controller['update']);router['delete'](_0x5e35('0xd'),auth['isAuthenticated'](),controller[_0x5e35('0x11')]);module[_0x5e35('0x12')]=router; \ No newline at end of file +var _0xca58=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x505684,_0x2c1dc9){var _0x4389b0=function(_0x86b26e){while(--_0x86b26e){_0x505684['push'](_0x505684['shift']());}};_0x4389b0(++_0x2c1dc9);}(_0xca58,0xb6));var _0x8ca5=function(_0x44848e,_0x40fb8f){_0x44848e=_0x44848e-0x0;var _0xb83bc6=_0xca58[_0x44848e];return _0xb83bc6;};'use strict';var multer=require(_0x8ca5('0x0'));var util=require(_0x8ca5('0x1'));var path=require(_0x8ca5('0x2'));var timeout=require(_0x8ca5('0x3'));var express=require(_0x8ca5('0x4'));var router=express[_0x8ca5('0x5')]();var auth=require(_0x8ca5('0x6'));var interaction=require(_0x8ca5('0x7'));var config=require(_0x8ca5('0x8'));var controller=require('./voiceCallReport.controller');router[_0x8ca5('0x9')]('/',auth[_0x8ca5('0xa')](),controller[_0x8ca5('0xb')]);router['get']('/describe',auth[_0x8ca5('0xa')](),controller[_0x8ca5('0xc')]);router[_0x8ca5('0x9')](_0x8ca5('0xd'),auth[_0x8ca5('0xa')](),controller[_0x8ca5('0xe')]);router[_0x8ca5('0xf')]('/',auth[_0x8ca5('0xa')](),controller[_0x8ca5('0x10')]);router[_0x8ca5('0x11')](_0x8ca5('0xd'),auth[_0x8ca5('0xa')](),controller[_0x8ca5('0x12')]);router[_0x8ca5('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8ca5('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index ba3bec7..4d7cf3b 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 _0x277c=['TEXT','DATE','INTEGER','sequelize','STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','dialer'];(function(_0x274852,_0x262c01){var _0x128e5d=function(_0x3e637d){while(--_0x3e637d){_0x274852['push'](_0x274852['shift']());}};_0x128e5d(++_0x262c01);}(_0x277c,0x153));var _0xc277=function(_0x5b0847,_0x3e4b9f){_0x5b0847=_0x5b0847-0x0;var _0x279b7a=_0x277c[_0x5b0847];return _0x279b7a;};'use strict';var Sequelize=require(_0xc277('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xc277('0x1')]},'type':{'type':Sequelize[_0xc277('0x2')](_0xc277('0x3'),_0xc277('0x4'),_0xc277('0x5'),_0xc277('0x6'),_0xc277('0x7'),_0xc277('0x8'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xc277('0x1')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xc277('0x1')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xc277('0x1')]},'destinationchannel':{'type':Sequelize[_0xc277('0x1')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xc277('0x9')]},'starttime':{'type':Sequelize[_0xc277('0xa')]},'systemanswertime':{'type':Sequelize[_0xc277('0xa')]},'answertime':{'type':Sequelize[_0xc277('0xa')]},'endtime':{'type':Sequelize[_0xc277('0xa')]},'duration':{'type':Sequelize[_0xc277('0xb')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc277('0x1')]},'amaflags':{'type':Sequelize[_0xc277('0x1')]},'userfield':{'type':Sequelize[_0xc277('0x1')]},'userDisposition':{'type':Sequelize[_0xc277('0x1')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xc277('0x1')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xc277('0x1')]},'routeid':{'type':Sequelize[_0xc277('0xb')]},'sipcallid':{'type':Sequelize[_0xc277('0x1')]}}; \ No newline at end of file +var _0xcd59=['internal','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound'];(function(_0x21cecb,_0x2872d2){var _0x191984=function(_0x2fee8a){while(--_0x2fee8a){_0x21cecb['push'](_0x21cecb['shift']());}};_0x191984(++_0x2872d2);}(_0xcd59,0x14b));var _0x9cd5=function(_0xa5c63f,_0x2aaaa8){_0xa5c63f=_0xa5c63f-0x0;var _0xf352b1=_0xcd59[_0xa5c63f];return _0xf352b1;};'use strict';var Sequelize=require(_0x9cd5('0x0'));module[_0x9cd5('0x1')]={'uniqueid':{'type':Sequelize[_0x9cd5('0x2')]},'type':{'type':Sequelize[_0x9cd5('0x3')](_0x9cd5('0x4'),_0x9cd5('0x5'),'outbound',_0x9cd5('0x6'),_0x9cd5('0x7'),_0x9cd5('0x8'))},'tag':{'type':Sequelize[_0x9cd5('0x2')]},'accountcode':{'type':Sequelize[_0x9cd5('0x2')]},'source':{'type':Sequelize[_0x9cd5('0x2')]},'destination':{'type':Sequelize[_0x9cd5('0x2')]},'destinationcontext':{'type':Sequelize[_0x9cd5('0x2')]},'callerid':{'type':Sequelize[_0x9cd5('0x2')]},'channel':{'type':Sequelize[_0x9cd5('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x9cd5('0x2')]},'lastdata':{'type':Sequelize[_0x9cd5('0x9')]},'starttime':{'type':Sequelize[_0x9cd5('0xa')]},'systemanswertime':{'type':Sequelize[_0x9cd5('0xa')]},'answertime':{'type':Sequelize[_0x9cd5('0xa')]},'endtime':{'type':Sequelize[_0x9cd5('0xa')]},'duration':{'type':Sequelize[_0x9cd5('0xb')]},'billableseconds':{'type':Sequelize[_0x9cd5('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x9cd5('0x2')]},'amaflags':{'type':Sequelize[_0x9cd5('0x2')]},'userfield':{'type':Sequelize[_0x9cd5('0x2')]},'userDisposition':{'type':Sequelize[_0x9cd5('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9cd5('0x2')]},'prefix':{'type':Sequelize[_0x9cd5('0x2')]},'routeid':{'type':Sequelize[_0x9cd5('0xb')]},'sipcallid':{'type':Sequelize[_0x9cd5('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 421d1fe..c32a280 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 _0xa9e0=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','fullname','User','rows','catch','show','params','keys','options','find','create','describe','body','uniqueid','user','html-pdf'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'attributes':['id',_0x0a9e('0x23'),_0x0a9e('0x3b'),'alias'],'model':db['User'],'as':_0x0a9e('0x3c')}];}return db[_0x0a9e('0x26')]['findAll'](_0x45a1e7);})[_0x0a9e('0x22')](function(_0x1dec2e){_0x1dc186[_0x0a9e('0x3d')]=_0x1dec2e;return _0x1dc186;})['then'](respondWithFilteredResult(_0x479bc4,_0x45a1e7))[_0x0a9e('0x3e')](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3f')]=function(_0x274e8e,_0x43dd5b){var _0x13cb1f={'raw':!![],'where':{'id':_0x274e8e[_0x0a9e('0x40')]['id']}},_0xeaa5e5={};_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x41')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0xeaa5e5[_0x0a9e('0x2b')]=_[_0x0a9e('0x41')](_0x274e8e[_0x0a9e('0x2b')]);_0xeaa5e5[_0x0a9e('0x2c')]=_['intersection'](_0xeaa5e5['model'],_0xeaa5e5[_0x0a9e('0x2b')]);_0x13cb1f[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xeaa5e5[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x274e8e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x13cb1f[_0x0a9e('0x2e')]=_0x13cb1f[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x13cb1f[_0x0a9e('0x2e')]:_0xeaa5e5[_0x0a9e('0x2a')];if(_0x274e8e['query'][_0x0a9e('0x39')]){_0x13cb1f[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x13cb1f=_[_0x0a9e('0x37')]({},_0x13cb1f,_0x274e8e[_0x0a9e('0x42')]);return db[_0x0a9e('0x26')][_0x0a9e('0x43')](_0x13cb1f)[_0x0a9e('0x22')](handleEntityNotFound(_0x43dd5b,null))[_0x0a9e('0x22')](respondWithResult(_0x43dd5b,null))['catch'](handleError(_0x43dd5b,null));};exports[_0x0a9e('0x44')]=function(_0x48fd45,_0x473dc8){return db[_0x0a9e('0x26')][_0x0a9e('0x44')](_0x48fd45['body'],{})[_0x0a9e('0x22')](respondWithResult(_0x473dc8,0xc9))[_0x0a9e('0x3e')](handleError(_0x473dc8,null));};exports[_0x0a9e('0x21')]=function(_0x34aa5a,_0x45c845){return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'id':_0x34aa5a['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x45c845,null))[_0x0a9e('0x22')](removeEntity(_0x45c845,null))[_0x0a9e('0x3e')](handleError(_0x45c845,null));};exports[_0x0a9e('0x45')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x26')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x992c77,null))['catch'](handleError(_0x992c77,null));};exports[_0x0a9e('0x20')]=function(_0x3fe430,_0x4f7240){if(_0x3fe430['body']['uniqueid']){delete _0x3fe430[_0x0a9e('0x46')][_0x0a9e('0x47')];}return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'uniqueid':_0x3fe430[_0x0a9e('0x40')]['id'],'UserId':{'$or':[null,_0x3fe430[_0x0a9e('0x48')]['id']]}}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](saveUpdates(_0x3fe430['body'],null))['then'](respondWithResult(_0x4f7240,null))['catch'](handleError(_0x4f7240,null));}; \ No newline at end of file +var _0xa9e0=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','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','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','name','send','map','VoiceCallReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','count','includeAll','include','fullname','User','rows','catch','show','params','keys','options','find','create','describe','body','uniqueid','user','html-pdf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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=_0x5d0880['count'],_0x519dfd=_0x22dccb[_0x0a9e('0x19')],_0x16033c=_0x22dccb['offset']+_0x22dccb[_0x0a9e('0x1a')],_0x12066b;if(_0x16033c>=_0x1985b6){_0x16033c=_0x1985b6;_0x12066b=0xc8;}else{_0x12066b=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x12066b);return _0x52a03d[_0x0a9e('0x1b')](_0x0a9e('0x1c'),_0x519dfd+'-'+_0x16033c+'/'+_0x1985b6)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x2eb11f){return function(_0x530eb7){try{jsonpatch[_0x0a9e('0x1d')](_0x530eb7,_0x2eb11f,!![]);}catch(_0x1314ae){return BPromise[_0x0a9e('0x1e')](_0x1314ae);}return _0x530eb7[_0x0a9e('0x1f')]();};}function saveUpdates(_0x105080,_0x4bb1e3){return function(_0x2c3407){if(_0x2c3407){return _0x2c3407[_0x0a9e('0x20')](_0x105080)['then'](function(_0x20f109){return _0x20f109;});}return null;};}function removeEntity(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x5a09ef[_0x0a9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb6e48,_0x2fb0e4){return function(_0x3b45bc){if(!_0x3b45bc){_0xfb6e48[_0x0a9e('0x15')](0x194);}return _0x3b45bc;};}function handleError(_0x370d86,_0x42ac8f){_0x42ac8f=_0x42ac8f||0x1f4;return function(_0x16b1ca){logger['error'](_0x16b1ca['stack']);if(_0x16b1ca[_0x0a9e('0x23')]){delete _0x16b1ca[_0x0a9e('0x23')];}_0x370d86[_0x0a9e('0x17')](_0x42ac8f)[_0x0a9e('0x24')](_0x16b1ca);};}exports['index']=function(_0x384319,_0x479bc4){var _0x45a1e7={},_0x5bfb33={},_0x1dc186={'count':0x0,'rows':[]};var _0x34dc65=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x1538a4){return{'name':_0x1538a4[_0x0a9e('0x28')],'type':_0x1538a4[_0x0a9e('0x29')]['key']};});_0x5bfb33[_0x0a9e('0x2a')]=_[_0x0a9e('0x25')](_0x34dc65,_0x0a9e('0x23'));_0x5bfb33[_0x0a9e('0x2b')]=_['keys'](_0x384319[_0x0a9e('0x2b')]);_0x5bfb33[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],_0x5bfb33[_0x0a9e('0x2b')]);_0x45a1e7[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0x5bfb33[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x384319['query'][_0x0a9e('0x2f')]));_0x45a1e7['attributes']=_0x45a1e7[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x45a1e7[_0x0a9e('0x2e')]:_0x5bfb33[_0x0a9e('0x2a')];if(!_0x384319[_0x0a9e('0x2b')]['hasOwnProperty'](_0x0a9e('0x31'))){_0x45a1e7[_0x0a9e('0x1a')]=qs[_0x0a9e('0x1a')](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x1a')]);_0x45a1e7[_0x0a9e('0x19')]=qs[_0x0a9e('0x19')](_0x384319[_0x0a9e('0x2b')]['offset']);}_0x45a1e7[_0x0a9e('0x32')]=qs['sort'](_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x33')]);_0x45a1e7[_0x0a9e('0x34')]=qs[_0x0a9e('0x2c')](_['pick'](_0x384319[_0x0a9e('0x2b')],_0x5bfb33[_0x0a9e('0x2c')]),_0x34dc65);if(_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]){_0x45a1e7['where']=_['merge'](_0x45a1e7[_0x0a9e('0x34')],{'$or':_['map'](_0x34dc65,function(_0x24936a){if(_0x24936a[_0x0a9e('0x29')]!==_0x0a9e('0x36')){var _0x1ef87a={};_0x1ef87a[_0x24936a['name']]={'$like':'%'+_0x384319[_0x0a9e('0x2b')][_0x0a9e('0x35')]+'%'};return _0x1ef87a;}})});}_0x45a1e7=_[_0x0a9e('0x37')]({},_0x45a1e7,_0x384319['options']);var _0x1dbf74={'where':_0x45a1e7[_0x0a9e('0x34')]};return db[_0x0a9e('0x26')]['count'](_0x1dbf74)['then'](function(_0x11b61d){_0x1dc186[_0x0a9e('0x38')]=_0x11b61d;if(_0x384319['query'][_0x0a9e('0x39')]){_0x45a1e7[_0x0a9e('0x3a')]=[{'attributes':['id',_0x0a9e('0x23'),_0x0a9e('0x3b'),'alias'],'model':db['User'],'as':_0x0a9e('0x3c')}];}return db[_0x0a9e('0x26')]['findAll'](_0x45a1e7);})[_0x0a9e('0x22')](function(_0x1dec2e){_0x1dc186[_0x0a9e('0x3d')]=_0x1dec2e;return _0x1dc186;})['then'](respondWithFilteredResult(_0x479bc4,_0x45a1e7))[_0x0a9e('0x3e')](handleError(_0x479bc4,null));};exports[_0x0a9e('0x3f')]=function(_0x274e8e,_0x43dd5b){var _0x13cb1f={'raw':!![],'where':{'id':_0x274e8e[_0x0a9e('0x40')]['id']}},_0xeaa5e5={};_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x41')](db[_0x0a9e('0x26')][_0x0a9e('0x27')]);_0xeaa5e5[_0x0a9e('0x2b')]=_[_0x0a9e('0x41')](_0x274e8e[_0x0a9e('0x2b')]);_0xeaa5e5[_0x0a9e('0x2c')]=_['intersection'](_0xeaa5e5['model'],_0xeaa5e5[_0x0a9e('0x2b')]);_0x13cb1f[_0x0a9e('0x2e')]=_[_0x0a9e('0x2d')](_0xeaa5e5[_0x0a9e('0x2a')],qs[_0x0a9e('0x2f')](_0x274e8e[_0x0a9e('0x2b')][_0x0a9e('0x2f')]));_0x13cb1f[_0x0a9e('0x2e')]=_0x13cb1f[_0x0a9e('0x2e')][_0x0a9e('0x30')]?_0x13cb1f[_0x0a9e('0x2e')]:_0xeaa5e5[_0x0a9e('0x2a')];if(_0x274e8e['query'][_0x0a9e('0x39')]){_0x13cb1f[_0x0a9e('0x3a')]=[{'all':!![]}];}_0x13cb1f=_[_0x0a9e('0x37')]({},_0x13cb1f,_0x274e8e[_0x0a9e('0x42')]);return db[_0x0a9e('0x26')][_0x0a9e('0x43')](_0x13cb1f)[_0x0a9e('0x22')](handleEntityNotFound(_0x43dd5b,null))[_0x0a9e('0x22')](respondWithResult(_0x43dd5b,null))['catch'](handleError(_0x43dd5b,null));};exports[_0x0a9e('0x44')]=function(_0x48fd45,_0x473dc8){return db[_0x0a9e('0x26')][_0x0a9e('0x44')](_0x48fd45['body'],{})[_0x0a9e('0x22')](respondWithResult(_0x473dc8,0xc9))[_0x0a9e('0x3e')](handleError(_0x473dc8,null));};exports[_0x0a9e('0x21')]=function(_0x34aa5a,_0x45c845){return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'id':_0x34aa5a['params']['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x45c845,null))[_0x0a9e('0x22')](removeEntity(_0x45c845,null))[_0x0a9e('0x3e')](handleError(_0x45c845,null));};exports[_0x0a9e('0x45')]=function(_0x409789,_0x992c77){return db[_0x0a9e('0x26')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x992c77,null))['catch'](handleError(_0x992c77,null));};exports[_0x0a9e('0x20')]=function(_0x3fe430,_0x4f7240){if(_0x3fe430['body']['uniqueid']){delete _0x3fe430[_0x0a9e('0x46')][_0x0a9e('0x47')];}return db[_0x0a9e('0x26')][_0x0a9e('0x43')]({'where':{'uniqueid':_0x3fe430[_0x0a9e('0x40')]['id'],'UserId':{'$or':[null,_0x3fe430[_0x0a9e('0x48')]['id']]}}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](saveUpdates(_0x3fe430['body'],null))['then'](respondWithResult(_0x4f7240,null))['catch'](handleError(_0x4f7240,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 490d07d..1bb2568 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 _0x880c=['VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','define'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x880c,0x114));var _0xc880=function(_0xce145a,_0x93108e){_0xce145a=_0xce145a-0x0;var _0x1bb0f6=_0x880c[_0xce145a];return _0x1bb0f6;};'use strict';var _=require(_0xc880('0x0'));var util=require(_0xc880('0x1'));var logger=require(_0xc880('0x2'))(_0xc880('0x3'));var moment=require(_0xc880('0x4'));var BPromise=require('bluebird');var rp=require(_0xc880('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc880('0x6'));var config=require(_0xc880('0x7'));var attributes=require(_0xc880('0x8'));module['exports']=function(_0x21a083,_0x5e4e3f){return _0x21a083[_0xc880('0x9')](_0xc880('0xa'),attributes,{'tableName':_0xc880('0xb'),'paranoid':![],'indexes':[{'fields':[_0xc880('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x72b2=['./voiceCallReport.attributes','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x14b574,_0x2d90f9){var _0x4ce11f=function(_0x647e81){while(--_0x647e81){_0x14b574['push'](_0x14b574['shift']());}};_0x4ce11f(++_0x2d90f9);}(_0x72b2,0xf5));var _0x272b=function(_0x335fa6,_0x4a38b4){_0x335fa6=_0x335fa6-0x0;var _0x3f3b69=_0x72b2[_0x335fa6];return _0x3f3b69;};'use strict';var _=require(_0x272b('0x0'));var util=require(_0x272b('0x1'));var logger=require(_0x272b('0x2'))('api');var moment=require(_0x272b('0x3'));var BPromise=require(_0x272b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x272b('0x5'));var rimraf=require(_0x272b('0x6'));var config=require('../../config/environment');var attributes=require(_0x272b('0x7'));module['exports']=function(_0x54cf0f,_0x11cc79){return _0x54cf0f[_0x272b('0x8')](_0x272b('0x9'),attributes,{'tableName':_0x272b('0xa'),'paranoid':![],'indexes':[{'fields':[_0x272b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 818d9ec..d4c72df 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 _0x699f=['VoiceCallReport','create','update','body','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','options','raw','where','attributes','limit','include','model','map','GetVoiceCallReport','CreateVoiceCallReport'];(function(_0x412c8f,_0x11ec94){var _0x27c005=function(_0x127059){while(--_0x127059){_0x412c8f['push'](_0x412c8f['shift']());}};_0x27c005(++_0x11ec94);}(_0x699f,0xc3));var _0xf699=function(_0x507c81,_0x3e1b56){_0x507c81=_0x507c81-0x0;var _0x368a25=_0x699f[_0x507c81];return _0x368a25;};'use strict';var _=require(_0xf699('0x0'));var util=require(_0xf699('0x1'));var moment=require(_0xf699('0x2'));var BPromise=require(_0xf699('0x3'));var rs=require(_0xf699('0x4'));var fs=require('fs');var Redis=require(_0xf699('0x5'));var db=require(_0xf699('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf699('0x7'))(_0xf699('0x8'));var config=require(_0xf699('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf699('0xa')][_0xf699('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29f037,_0xeaf4c3,_0x4137ca){return new BPromise(function(_0x44f6db,_0x5a8b2e){return client['request'](_0x29f037,_0x4137ca)[_0xf699('0xc')](function(_0x381000){logger[_0xf699('0xd')](_0xf699('0xe'),_0xeaf4c3,_0xf699('0xf'));logger[_0xf699('0x10')](_0xf699('0x11'),_0xeaf4c3,_0xf699('0xf'),JSON[_0xf699('0x12')](_0x381000));if(_0x381000[_0xf699('0x13')]){if(_0x381000[_0xf699('0x13')][_0xf699('0x14')]===0x1f4){logger[_0xf699('0x13')](_0xf699('0xe'),_0xeaf4c3,_0x381000[_0xf699('0x13')][_0xf699('0x15')]);return _0x5a8b2e(_0x381000['error'][_0xf699('0x15')]);}logger[_0xf699('0x13')](_0xf699('0xe'),_0xeaf4c3,_0x381000[_0xf699('0x13')][_0xf699('0x15')]);return _0x44f6db(_0x381000[_0xf699('0x13')][_0xf699('0x15')]);}else{logger[_0xf699('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0xeaf4c3,_0xf699('0xf'));_0x44f6db(_0x381000['result'][_0xf699('0x15')]);}})[_0xf699('0x16')](function(_0x3a9bcd){logger['error'](_0xf699('0xe'),_0xeaf4c3,_0x3a9bcd);_0x5a8b2e(_0x3a9bcd);});});}exports['GetVoiceCallReport']=function(_0x2dd549){var _0x498dc4=this;return new Promise(function(_0x5bc632,_0x2f38dc){return db['VoiceCallReport']['findAll']({'raw':_0x2dd549['options']?_0x2dd549[_0xf699('0x17')][_0xf699('0x18')]===undefined?!![]:![]:!![],'where':_0x2dd549['options']?_0x2dd549[_0xf699('0x17')][_0xf699('0x19')]||null:null,'attributes':_0x2dd549[_0xf699('0x17')]?_0x2dd549[_0xf699('0x17')][_0xf699('0x1a')]||null:null,'limit':_0x2dd549['options']?_0x2dd549['options'][_0xf699('0x1b')]||null:null,'include':_0x2dd549['options']?_0x2dd549[_0xf699('0x17')][_0xf699('0x1c')]?_['map'](_0x2dd549[_0xf699('0x17')][_0xf699('0x1c')],function(_0x565024){return{'model':db[_0x565024[_0xf699('0x1d')]],'as':_0x565024['as'],'attributes':_0x565024[_0xf699('0x1a')],'include':_0x565024[_0xf699('0x1c')]?_[_0xf699('0x1e')](_0x565024['include'],function(_0x214eec){return{'model':db[_0x214eec['model']],'as':_0x214eec['as'],'attributes':_0x214eec[_0xf699('0x1a')],'include':_0x214eec[_0xf699('0x1c')]?_[_0xf699('0x1e')](_0x214eec['include'],function(_0x89c316){return{'model':db[_0x89c316[_0xf699('0x1d')]],'as':_0x89c316['as'],'attributes':_0x89c316[_0xf699('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37ac5f){logger[_0xf699('0xd')](_0xf699('0x1f'),_0x2dd549);logger[_0xf699('0x10')]('GetVoiceCallReport',_0x2dd549,JSON[_0xf699('0x12')](_0x37ac5f));_0x5bc632(_0x37ac5f);})['catch'](function(_0x26cfbc){logger['error']('GetVoiceCallReport',_0x26cfbc[_0xf699('0x15')],_0x2dd549);_0x2f38dc(_0x498dc4[_0xf699('0x13')](0x1f4,_0x26cfbc['message']));});});};exports[_0xf699('0x20')]=function(_0x399572){var _0x1e2a2a=this;return new Promise(function(_0x65d139,_0x3d11c3){return db[_0xf699('0x21')][_0xf699('0x22')](_0x399572['body'],{'raw':_0x399572[_0xf699('0x17')]?_0x399572[_0xf699('0x17')][_0xf699('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x1e6c79){logger[_0xf699('0xd')](_0xf699('0x20'),_0x399572);logger['debug'](_0xf699('0x20'),_0x399572,JSON['stringify'](_0x1e6c79));_0x65d139(_0x1e6c79);})[_0xf699('0x16')](function(_0x53974a){logger[_0xf699('0x13')](_0xf699('0x20'),_0x53974a['message'],_0x399572);_0x3d11c3(_0x1e2a2a[_0xf699('0x13')](0x1f4,_0x53974a[_0xf699('0x15')]));});});};exports['UpdateVoiceCallReport']=function(_0x45da02){var _0x410ba0=this;return new Promise(function(_0x378f3c,_0x182922){return db[_0xf699('0x21')][_0xf699('0x23')](_0x45da02[_0xf699('0x24')],{'raw':_0x45da02[_0xf699('0x17')]?_0x45da02['options'][_0xf699('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45da02['options']?_0x45da02['options'][_0xf699('0x19')]||null:null,'attributes':_0x45da02[_0xf699('0x17')]?_0x45da02[_0xf699('0x17')]['attributes']||null:null,'limit':_0x45da02[_0xf699('0x17')]?_0x45da02['options'][_0xf699('0x1b')]||null:null})['then'](function(_0x5bace0){logger[_0xf699('0xd')]('UpdateVoiceCallReport',_0x45da02);logger[_0xf699('0x10')](_0xf699('0x25'),_0x45da02,JSON[_0xf699('0x12')](_0x5bace0));_0x378f3c(_0x5bace0);})[_0xf699('0x16')](function(_0x1ee655){logger[_0xf699('0x13')](_0xf699('0x25'),_0x1ee655[_0xf699('0x15')],_0x45da02);_0x182922(_0x410ba0['error'](0x1f4,_0x1ee655[_0xf699('0x15')]));});});}; \ No newline at end of file +var _0xe1d9=['map','model','debug','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','catch','GetVoiceCallReport','VoiceCallReport','raw','options','where','attributes','limit','include'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xe1d9,0xc5));var _0x9e1d=function(_0x5107ca,_0x336bde){_0x5107ca=_0x5107ca-0x0;var _0x54010c=_0xe1d9[_0x5107ca];return _0x54010c;};'use strict';var _=require(_0x9e1d('0x0'));var util=require(_0x9e1d('0x1'));var moment=require(_0x9e1d('0x2'));var BPromise=require(_0x9e1d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e1d('0x4'));var db=require(_0x9e1d('0x5'))['db'];var utils=require(_0x9e1d('0x6'));var logger=require(_0x9e1d('0x7'))(_0x9e1d('0x8'));var config=require(_0x9e1d('0x9'));var jayson=require(_0x9e1d('0xa'));var client=jayson[_0x9e1d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44b103,_0x3499b8,_0x5c4ebc){return new BPromise(function(_0x2976c4,_0x1eaa6a){return client[_0x9e1d('0xc')](_0x44b103,_0x5c4ebc)[_0x9e1d('0xd')](function(_0x382d3a){logger[_0x9e1d('0xe')]('VoiceCallReport,\x20%s,\x20%s',_0x3499b8,'request\x20sent');logger['debug'](_0x9e1d('0xf'),_0x3499b8,_0x9e1d('0x10'),JSON[_0x9e1d('0x11')](_0x382d3a));if(_0x382d3a[_0x9e1d('0x12')]){if(_0x382d3a[_0x9e1d('0x12')][_0x9e1d('0x13')]===0x1f4){logger[_0x9e1d('0x12')](_0x9e1d('0x14'),_0x3499b8,_0x382d3a['error'][_0x9e1d('0x15')]);return _0x1eaa6a(_0x382d3a[_0x9e1d('0x12')]['message']);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x3499b8,_0x382d3a[_0x9e1d('0x12')]['message']);return _0x2976c4(_0x382d3a[_0x9e1d('0x12')]['message']);}else{logger[_0x9e1d('0xe')](_0x9e1d('0x14'),_0x3499b8,_0x9e1d('0x10'));_0x2976c4(_0x382d3a['result'][_0x9e1d('0x15')]);}})[_0x9e1d('0x16')](function(_0x5c3cf3){logger[_0x9e1d('0x12')](_0x9e1d('0x14'),_0x3499b8,_0x5c3cf3);_0x1eaa6a(_0x5c3cf3);});});}exports[_0x9e1d('0x17')]=function(_0x1cf25d){var _0x3bb9a0=this;return new Promise(function(_0x9c6e5d,_0x5de04f){return db[_0x9e1d('0x18')]['findAll']({'raw':_0x1cf25d['options']?_0x1cf25d['options'][_0x9e1d('0x19')]===undefined?!![]:![]:!![],'where':_0x1cf25d[_0x9e1d('0x1a')]?_0x1cf25d[_0x9e1d('0x1a')][_0x9e1d('0x1b')]||null:null,'attributes':_0x1cf25d[_0x9e1d('0x1a')]?_0x1cf25d[_0x9e1d('0x1a')][_0x9e1d('0x1c')]||null:null,'limit':_0x1cf25d['options']?_0x1cf25d[_0x9e1d('0x1a')][_0x9e1d('0x1d')]||null:null,'include':_0x1cf25d[_0x9e1d('0x1a')]?_0x1cf25d['options'][_0x9e1d('0x1e')]?_[_0x9e1d('0x1f')](_0x1cf25d[_0x9e1d('0x1a')][_0x9e1d('0x1e')],function(_0x457b8d){return{'model':db[_0x457b8d[_0x9e1d('0x20')]],'as':_0x457b8d['as'],'attributes':_0x457b8d[_0x9e1d('0x1c')],'include':_0x457b8d[_0x9e1d('0x1e')]?_[_0x9e1d('0x1f')](_0x457b8d[_0x9e1d('0x1e')],function(_0x7d9623){return{'model':db[_0x7d9623['model']],'as':_0x7d9623['as'],'attributes':_0x7d9623[_0x9e1d('0x1c')],'include':_0x7d9623[_0x9e1d('0x1e')]?_['map'](_0x7d9623['include'],function(_0x231c95){return{'model':db[_0x231c95[_0x9e1d('0x20')]],'as':_0x231c95['as'],'attributes':_0x231c95[_0x9e1d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9e1d('0xd')](function(_0x826660){logger[_0x9e1d('0xe')]('GetVoiceCallReport',_0x1cf25d);logger[_0x9e1d('0x21')](_0x9e1d('0x17'),_0x1cf25d,JSON[_0x9e1d('0x11')](_0x826660));_0x9c6e5d(_0x826660);})[_0x9e1d('0x16')](function(_0x384b53){logger[_0x9e1d('0x12')](_0x9e1d('0x17'),_0x384b53[_0x9e1d('0x15')],_0x1cf25d);_0x5de04f(_0x3bb9a0['error'](0x1f4,_0x384b53[_0x9e1d('0x15')]));});});};exports[_0x9e1d('0x22')]=function(_0x43f6e8){var _0x3f36db=this;return new Promise(function(_0x480c0b,_0x4d60f4){return db['VoiceCallReport'][_0x9e1d('0x23')](_0x43f6e8[_0x9e1d('0x24')],{'raw':_0x43f6e8[_0x9e1d('0x1a')]?_0x43f6e8[_0x9e1d('0x1a')][_0x9e1d('0x19')]===undefined?!![]:![]:!![]})[_0x9e1d('0xd')](function(_0x1b1a1d){logger['info']('CreateVoiceCallReport',_0x43f6e8);logger[_0x9e1d('0x21')](_0x9e1d('0x22'),_0x43f6e8,JSON['stringify'](_0x1b1a1d));_0x480c0b(_0x1b1a1d);})['catch'](function(_0x4bcc2f){logger['error'](_0x9e1d('0x22'),_0x4bcc2f[_0x9e1d('0x15')],_0x43f6e8);_0x4d60f4(_0x3f36db[_0x9e1d('0x12')](0x1f4,_0x4bcc2f[_0x9e1d('0x15')]));});});};exports[_0x9e1d('0x25')]=function(_0x2f2900){var _0xabc596=this;return new Promise(function(_0x152663,_0x4d163a){return db[_0x9e1d('0x18')]['update'](_0x2f2900[_0x9e1d('0x24')],{'raw':_0x2f2900[_0x9e1d('0x1a')]?_0x2f2900[_0x9e1d('0x1a')][_0x9e1d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f2900[_0x9e1d('0x1a')]?_0x2f2900['options'][_0x9e1d('0x1b')]||null:null,'attributes':_0x2f2900[_0x9e1d('0x1a')]?_0x2f2900[_0x9e1d('0x1a')]['attributes']||null:null,'limit':_0x2f2900[_0x9e1d('0x1a')]?_0x2f2900['options'][_0x9e1d('0x1d')]||null:null})['then'](function(_0x5ed820){logger['info'](_0x9e1d('0x25'),_0x2f2900);logger['debug'](_0x9e1d('0x25'),_0x2f2900,JSON[_0x9e1d('0x11')](_0x5ed820));_0x152663(_0x5ed820);})[_0x9e1d('0x16')](function(_0x54ab66){logger['error'](_0x9e1d('0x25'),_0x54ab66['message'],_0x2f2900);_0x4d163a(_0xabc596[_0x9e1d('0x12')](0x1f4,_0x54ab66['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 947ef4b..b98a0bf 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 _0xd094=['util','path','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','isAuthenticated','post','create','put','update','destroy','exports'];(function(_0x456f8f,_0x2e3ef6){var _0x94831d=function(_0x2402e4){while(--_0x2402e4){_0x456f8f['push'](_0x456f8f['shift']());}};_0x94831d(++_0x2e3ef6);}(_0xd094,0x96));var _0x4d09=function(_0x48d811,_0x350513){_0x48d811=_0x48d811-0x0;var _0x3852cc=_0xd094[_0x48d811];return _0x3852cc;};'use strict';var multer=require('multer');var util=require(_0x4d09('0x0'));var path=require(_0x4d09('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x4d09('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x4d09('0x3'));var controller=require(_0x4d09('0x4'));router[_0x4d09('0x5')]('/',auth['isAuthenticated'](),controller[_0x4d09('0x6')]);router[_0x4d09('0x5')](_0x4d09('0x7'),auth[_0x4d09('0x8')](),controller['show']);router[_0x4d09('0x9')]('/',auth['isAuthenticated'](),controller[_0x4d09('0xa')]);router[_0x4d09('0xb')](_0x4d09('0x7'),auth[_0x4d09('0x8')](),controller[_0x4d09('0xc')]);router['delete'](_0x4d09('0x7'),auth[_0x4d09('0x8')](),controller[_0x4d09('0xd')]);module[_0x4d09('0xe')]=router; \ No newline at end of file +var _0xea04=['/:id','show','post','create','update','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','index'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xea04,0x1d1));var _0x4ea0=function(_0x261d9e,_0x4f0942){_0x261d9e=_0x261d9e-0x0;var _0x3f8a2c=_0xea04[_0x261d9e];return _0x3f8a2c;};'use strict';var multer=require(_0x4ea0('0x0'));var util=require(_0x4ea0('0x1'));var path=require(_0x4ea0('0x2'));var timeout=require(_0x4ea0('0x3'));var express=require('express');var router=express[_0x4ea0('0x4')]();var auth=require(_0x4ea0('0x5'));var interaction=require(_0x4ea0('0x6'));var config=require(_0x4ea0('0x7'));var controller=require(_0x4ea0('0x8'));router['get']('/',auth[_0x4ea0('0x9')](),controller[_0x4ea0('0xa')]);router['get'](_0x4ea0('0xb'),auth['isAuthenticated'](),controller[_0x4ea0('0xc')]);router[_0x4ea0('0xd')]('/',auth[_0x4ea0('0x9')](),controller[_0x4ea0('0xe')]);router['put'](_0x4ea0('0xb'),auth[_0x4ea0('0x9')](),controller[_0x4ea0('0xf')]);router['delete'](_0x4ea0('0xb'),auth[_0x4ea0('0x9')](),controller[_0x4ea0('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 66a38ec..b5bdd8a 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 _0xc13d=['STRING','setDataValue','options','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x3b45d7,_0xbc2848){var _0x4690e8=function(_0x209c3b){while(--_0x209c3b){_0x3b45d7['push'](_0x3b45d7['shift']());}};_0x4690e8(++_0xbc2848);}(_0xc13d,0x166));var _0xdc13=function(_0x444d83,_0x54c255){_0x444d83=_0x444d83-0x0;var _0x20574b=_0xc13d[_0x444d83];return _0x20574b;};'use strict';var Sequelize=require(_0xdc13('0x0'));module[_0xdc13('0x1')]={'name':{'type':Sequelize[_0xdc13('0x2')]},'prefix':{'type':Sequelize[_0xdc13('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x2fc861){this[_0xdc13('0x3')](_0xdc13('0x4'),_0x2fc861?_0x2fc861['join'](''):[]);},'get':function(){return this['getDataValue'](_0xdc13('0x4'))?this[_0xdc13('0x5')](_0xdc13('0x4'))[_0xdc13('0x6')](''):[];}},'auth':{'type':Sequelize[_0xdc13('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xdc13('0x2')]},'record':{'type':Sequelize[_0xdc13('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xdc13('0x2')]},'description':{'type':Sequelize[_0xdc13('0x2')]}}; \ No newline at end of file +var _0x8a6c=['options','BOOLEAN','exports','STRING','name','setDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a6c,0x1e8));var _0xc8a6=function(_0x18a56e,_0x154ddc){_0x18a56e=_0x18a56e-0x0;var _0x32c3ba=_0x8a6c[_0x18a56e];return _0x32c3ba;};'use strict';var Sequelize=require('sequelize');module[_0xc8a6('0x0')]={'name':{'type':Sequelize[_0xc8a6('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':_0xc8a6('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0xc8a6('0x1')],'set':function(_0x1dc4b7){this[_0xc8a6('0x3')](_0xc8a6('0x4'),_0x1dc4b7?_0x1dc4b7['join'](''):[]);},'get':function(){return this['getDataValue'](_0xc8a6('0x4'))?this['getDataValue'](_0xc8a6('0x4'))['split'](''):[];}},'auth':{'type':Sequelize[_0xc8a6('0x5')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xc8a6('0x5')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xc8a6('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index a9a43e6..6ce3afc 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 _0xeb9f=['util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','index','map','VoiceChanSpy','rawAttributes','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache'];(function(_0x470f63,_0x48d80b){var _0x4f09e2=function(_0x3aa3a4){while(--_0x3aa3a4){_0x470f63['push'](_0x470f63['shift']());}};_0x4f09e2(++_0x48d80b);}(_0xeb9f,0x1eb));var _0xfeb9=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xeb9f[_0x1b6186];return _0x186121;};'use strict';var pdf=require(_0xfeb9('0x0'));var emlformat=require(_0xfeb9('0x1'));var rimraf=require(_0xfeb9('0x2'));var zipdir=require(_0xfeb9('0x3'));var jsonpatch=require(_0xfeb9('0x4'));var rp=require(_0xfeb9('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfeb9('0x6'));var util=require(_0xfeb9('0x7'));var path=require(_0xfeb9('0x8'));var sox=require(_0xfeb9('0x9'));var csv=require(_0xfeb9('0xa'));var ejs=require(_0xfeb9('0xb'));var fs=require('fs');var _=require(_0xfeb9('0xc'));var squel=require(_0xfeb9('0xd'));var crypto=require(_0xfeb9('0xe'));var jsforce=require(_0xfeb9('0xf'));var deskjs=require(_0xfeb9('0x10'));var toCsv=require(_0xfeb9('0xa'));var querystring=require(_0xfeb9('0x11'));var Papa=require('papaparse');var Redis=require(_0xfeb9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xfeb9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfeb9('0x14'));var logger=require(_0xfeb9('0x15'))('api');var utils=require(_0xfeb9('0x16'));var config=require(_0xfeb9('0x17'));var licenseUtil=require(_0xfeb9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x214fc6,_0x31e7c3){_0x31e7c3=_0x31e7c3||0xcc;return function(_0x11da46){if(_0x11da46){return _0x214fc6[_0xfeb9('0x19')](_0x31e7c3);}return _0x214fc6[_0xfeb9('0x1a')](_0x31e7c3)[_0xfeb9('0x1b')]();};}function respondWithResult(_0x554c13,_0x582caf){_0x582caf=_0x582caf||0xc8;return function(_0x2c85fb){if(_0x2c85fb){return _0x554c13['status'](_0x582caf)[_0xfeb9('0x1c')](_0x2c85fb);}};}function respondWithFilteredResult(_0x28e35f,_0x184208){return function(_0x3b87ef){if(_0x3b87ef){var _0x159519=_0x3b87ef[_0xfeb9('0x1d')],_0x4d1f81=_0x184208[_0xfeb9('0x1e')],_0x59d152=_0x184208['offset']+_0x184208[_0xfeb9('0x1f')],_0x39df43;if(_0x59d152>=_0x159519){_0x59d152=_0x159519;_0x39df43=0xc8;}else{_0x39df43=0xce;}_0x28e35f[_0xfeb9('0x1a')](_0x39df43);return _0x28e35f[_0xfeb9('0x20')](_0xfeb9('0x21'),_0x4d1f81+'-'+_0x59d152+'/'+_0x159519)[_0xfeb9('0x1c')](_0x3b87ef);}return null;};}function patchUpdates(_0xf657cd){return function(_0x2c12a5){try{jsonpatch[_0xfeb9('0x22')](_0x2c12a5,_0xf657cd,!![]);}catch(_0x52be12){return BPromise[_0xfeb9('0x23')](_0x52be12);}return _0x2c12a5[_0xfeb9('0x24')]();};}function saveUpdates(_0x30c0c7,_0x4aa49d){return function(_0x1d79bd){if(_0x1d79bd){return _0x1d79bd[_0xfeb9('0x25')](_0x30c0c7)[_0xfeb9('0x26')](function(_0xeedae2){return _0xeedae2;});}return null;};}function removeEntity(_0x4f764b,_0x3a40f5){return function(_0x5ebc1d){if(_0x5ebc1d){return _0x5ebc1d['destroy']()[_0xfeb9('0x26')](function(){var _0x637ece=_0x5ebc1d[_0xfeb9('0x27')]({'plain':!![]});var _0xcc5196='ChanSpies';return db[_0xfeb9('0x28')][_0xfeb9('0x29')]({'where':{'type':_0xcc5196,'resourceId':_0x637ece['id']}})['then'](function(){return _0x5ebc1d;});})[_0xfeb9('0x26')](function(){_0x4f764b[_0xfeb9('0x1a')](0xcc)[_0xfeb9('0x1b')]();});}};}function handleEntityNotFound(_0x304b6d,_0x264523){return function(_0x586a95){if(!_0x586a95){_0x304b6d[_0xfeb9('0x19')](0x194);}return _0x586a95;};}function handleError(_0x4beb5e,_0x3e2772){_0x3e2772=_0x3e2772||0x1f4;return function(_0x8f90e){logger[_0xfeb9('0x2a')](_0x8f90e[_0xfeb9('0x2b')]);if(_0x8f90e['name']){delete _0x8f90e[_0xfeb9('0x2c')];}_0x4beb5e['status'](_0x3e2772)['send'](_0x8f90e);};}exports[_0xfeb9('0x2d')]=function(_0x5c806c,_0x295d64){var _0x3ffd01={},_0x3c3c7c={},_0x1728e9={'count':0x0,'rows':[]};var _0x1928de=_[_0xfeb9('0x2e')](db[_0xfeb9('0x2f')][_0xfeb9('0x30')],function(_0x301b2f){return{'name':_0x301b2f['fieldName'],'type':_0x301b2f[_0xfeb9('0x31')][_0xfeb9('0x32')]};});_0x3c3c7c['model']=_[_0xfeb9('0x2e')](_0x1928de,_0xfeb9('0x2c'));_0x3c3c7c[_0xfeb9('0x33')]=_[_0xfeb9('0x34')](_0x5c806c['query']);_0x3c3c7c[_0xfeb9('0x35')]=_['intersection'](_0x3c3c7c[_0xfeb9('0x36')],_0x3c3c7c[_0xfeb9('0x33')]);_0x3ffd01[_0xfeb9('0x37')]=_[_0xfeb9('0x38')](_0x3c3c7c[_0xfeb9('0x36')],qs['fields'](_0x5c806c[_0xfeb9('0x33')][_0xfeb9('0x39')]));_0x3ffd01[_0xfeb9('0x37')]=_0x3ffd01[_0xfeb9('0x37')][_0xfeb9('0x3a')]?_0x3ffd01[_0xfeb9('0x37')]:_0x3c3c7c['model'];if(!_0x5c806c[_0xfeb9('0x33')][_0xfeb9('0x3b')](_0xfeb9('0x3c'))){_0x3ffd01[_0xfeb9('0x1f')]=qs[_0xfeb9('0x1f')](_0x5c806c[_0xfeb9('0x33')][_0xfeb9('0x1f')]);_0x3ffd01[_0xfeb9('0x1e')]=qs[_0xfeb9('0x1e')](_0x5c806c[_0xfeb9('0x33')]['offset']);}_0x3ffd01['order']=qs[_0xfeb9('0x3d')](_0x5c806c[_0xfeb9('0x33')][_0xfeb9('0x3d')]);_0x3ffd01['where']=qs['filters'](_[_0xfeb9('0x3e')](_0x5c806c['query'],_0x3c3c7c[_0xfeb9('0x35')]),_0x1928de);if(_0x5c806c['query']['filter']){_0x3ffd01[_0xfeb9('0x3f')]=_[_0xfeb9('0x40')](_0x3ffd01[_0xfeb9('0x3f')],{'$or':_[_0xfeb9('0x2e')](_0x1928de,function(_0x41de3){if(_0x41de3['type']!==_0xfeb9('0x41')){var _0xb12c17={};_0xb12c17[_0x41de3['name']]={'$like':'%'+_0x5c806c[_0xfeb9('0x33')][_0xfeb9('0x42')]+'%'};return _0xb12c17;}})});}_0x3ffd01=_[_0xfeb9('0x40')]({},_0x3ffd01,_0x5c806c[_0xfeb9('0x43')]);var _0x8a8d1a={'where':_0x3ffd01[_0xfeb9('0x3f')]};return db[_0xfeb9('0x2f')]['count'](_0x8a8d1a)[_0xfeb9('0x26')](function(_0x31392b){_0x1728e9[_0xfeb9('0x1d')]=_0x31392b;if(_0x5c806c[_0xfeb9('0x33')][_0xfeb9('0x44')]){_0x3ffd01[_0xfeb9('0x45')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xfeb9('0x46')](_0x3ffd01);})['then'](function(_0x300aae){_0x1728e9[_0xfeb9('0x47')]=_0x300aae;return _0x1728e9;})['then'](respondWithFilteredResult(_0x295d64,_0x3ffd01))[_0xfeb9('0x48')](handleError(_0x295d64,null));};exports[_0xfeb9('0x49')]=function(_0x263a87,_0x548290){var _0x4bae2e={'raw':![],'where':{'id':_0x263a87['params']['id']}},_0x1dae4b={};_0x1dae4b[_0xfeb9('0x36')]=_['keys'](db[_0xfeb9('0x2f')][_0xfeb9('0x30')]);_0x1dae4b['query']=_[_0xfeb9('0x34')](_0x263a87['query']);_0x1dae4b[_0xfeb9('0x35')]=_[_0xfeb9('0x38')](_0x1dae4b[_0xfeb9('0x36')],_0x1dae4b[_0xfeb9('0x33')]);_0x4bae2e['attributes']=_[_0xfeb9('0x38')](_0x1dae4b[_0xfeb9('0x36')],qs[_0xfeb9('0x39')](_0x263a87[_0xfeb9('0x33')]['fields']));_0x4bae2e['attributes']=_0x4bae2e[_0xfeb9('0x37')]['length']?_0x4bae2e['attributes']:_0x1dae4b['model'];if(_0x263a87['query'][_0xfeb9('0x44')]){_0x4bae2e[_0xfeb9('0x45')]=[{'all':!![]}];}_0x4bae2e=_[_0xfeb9('0x40')]({},_0x4bae2e,_0x263a87['options']);return db[_0xfeb9('0x2f')]['find'](_0x4bae2e)['then'](handleEntityNotFound(_0x548290,null))['then'](respondWithResult(_0x548290,null))[_0xfeb9('0x48')](handleError(_0x548290,null));};exports['create']=function(_0x1edc62,_0x54d6af){return db['VoiceChanSpy'][_0xfeb9('0x4a')](_0x1edc62['body'],{})['then'](function(_0x1f092f){var _0x2c95b2=_0x1edc62[_0xfeb9('0x4b')]['get']({'plain':!![]});if(!_0x2c95b2)throw new Error(_0xfeb9('0x4c'));if(_0x2c95b2[_0xfeb9('0x4d')]===_0xfeb9('0x4b')){var _0x448c43=_0x1f092f[_0xfeb9('0x27')]({'plain':!![]});var _0x25d727='ChanSpies';return db[_0xfeb9('0x4e')][_0xfeb9('0x4f')]({'where':{'name':_0x25d727,'userProfileId':_0x2c95b2['userProfileId']},'raw':!![]})[_0xfeb9('0x26')](function(_0x5f5197){if(_0x5f5197&&_0x5f5197[_0xfeb9('0x50')]===0x0){return db[_0xfeb9('0x28')][_0xfeb9('0x4a')]({'name':_0x448c43[_0xfeb9('0x2c')],'resourceId':_0x448c43['id'],'type':_0x5f5197[_0xfeb9('0x2c')],'sectionId':_0x5f5197['id']},{})['then'](function(){return _0x1f092f;});}else{return _0x1f092f;}})['catch'](function(_0x4b9466){logger[_0xfeb9('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b9466);throw _0x4b9466;});}return _0x1f092f;})[_0xfeb9('0x26')](respondWithResult(_0x54d6af,0xc9))[_0xfeb9('0x48')](handleError(_0x54d6af,null));};exports[_0xfeb9('0x25')]=function(_0x469ca2,_0x295f27){if(_0x469ca2[_0xfeb9('0x51')]['id']){delete _0x469ca2['body']['id'];}return db[_0xfeb9('0x2f')][_0xfeb9('0x4f')]({'where':{'id':_0x469ca2[_0xfeb9('0x52')]['id']}})[_0xfeb9('0x26')](handleEntityNotFound(_0x295f27,null))[_0xfeb9('0x26')](saveUpdates(_0x469ca2[_0xfeb9('0x51')],null))[_0xfeb9('0x26')](respondWithResult(_0x295f27,null))[_0xfeb9('0x48')](handleError(_0x295f27,null));};exports['destroy']=function(_0x39149f,_0x90626d){return db['VoiceChanSpy']['find']({'where':{'id':_0x39149f[_0xfeb9('0x52')]['id']}})[_0xfeb9('0x26')](handleEntityNotFound(_0x90626d,null))[_0xfeb9('0x26')](removeEntity(_0x90626d,null))[_0xfeb9('0x48')](handleError(_0x90626d,null));}; \ No newline at end of file +var _0x8546=['VoiceChanSpy','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','ChanSpies','UserProfileResource','stack','name','send','index'];(function(_0x28c9f2,_0x19cab5){var _0x2333d1=function(_0x15c122){while(--_0x15c122){_0x28c9f2['push'](_0x28c9f2['shift']());}};_0x2333d1(++_0x19cab5);}(_0x8546,0x1ba));var _0x6854=function(_0x24afcd,_0x53b6c7){_0x24afcd=_0x24afcd-0x0;var _0x354540=_0x8546[_0x24afcd];return _0x354540;};'use strict';var pdf=require(_0x6854('0x0'));var emlformat=require(_0x6854('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6854('0x2'));var jsonpatch=require(_0x6854('0x3'));var rp=require(_0x6854('0x4'));var moment=require(_0x6854('0x5'));var BPromise=require(_0x6854('0x6'));var Mustache=require(_0x6854('0x7'));var util=require('util');var path=require(_0x6854('0x8'));var sox=require(_0x6854('0x9'));var csv=require('to-csv');var ejs=require(_0x6854('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6854('0xb'));var crypto=require(_0x6854('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6854('0xd'));var toCsv=require(_0x6854('0xe'));var querystring=require(_0x6854('0xf'));var Papa=require(_0x6854('0x10'));var Redis=require('ioredis');var authService=require(_0x6854('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6854('0x12'));var logger=require(_0x6854('0x13'))(_0x6854('0x14'));var utils=require('../../config/utils');var config=require(_0x6854('0x15'));var licenseUtil=require(_0x6854('0x16'));var db=require(_0x6854('0x17'))['db'];function respondWithStatusCode(_0x33a2bf,_0x26e334){_0x26e334=_0x26e334||0xcc;return function(_0x55f7de){if(_0x55f7de){return _0x33a2bf['sendStatus'](_0x26e334);}return _0x33a2bf[_0x6854('0x18')](_0x26e334)[_0x6854('0x19')]();};}function respondWithResult(_0x4b570d,_0x5346d5){_0x5346d5=_0x5346d5||0xc8;return function(_0x30d3ad){if(_0x30d3ad){return _0x4b570d[_0x6854('0x18')](_0x5346d5)[_0x6854('0x1a')](_0x30d3ad);}};}function respondWithFilteredResult(_0x4fd6cc,_0x426a18){return function(_0x45ede7){if(_0x45ede7){var _0x4b13f8=_0x45ede7['count'],_0x333764=_0x426a18[_0x6854('0x1b')],_0x9e789c=_0x426a18[_0x6854('0x1b')]+_0x426a18[_0x6854('0x1c')],_0x20fc12;if(_0x9e789c>=_0x4b13f8){_0x9e789c=_0x4b13f8;_0x20fc12=0xc8;}else{_0x20fc12=0xce;}_0x4fd6cc[_0x6854('0x18')](_0x20fc12);return _0x4fd6cc[_0x6854('0x1d')](_0x6854('0x1e'),_0x333764+'-'+_0x9e789c+'/'+_0x4b13f8)[_0x6854('0x1a')](_0x45ede7);}return null;};}function patchUpdates(_0x30fe5c){return function(_0x52fd99){try{jsonpatch[_0x6854('0x1f')](_0x52fd99,_0x30fe5c,!![]);}catch(_0x374c06){return BPromise[_0x6854('0x20')](_0x374c06);}return _0x52fd99[_0x6854('0x21')]();};}function saveUpdates(_0x3bea71,_0x4039ab){return function(_0x754558){if(_0x754558){return _0x754558[_0x6854('0x22')](_0x3bea71)['then'](function(_0x985f72){return _0x985f72;});}return null;};}function removeEntity(_0xb0c232,_0x449998){return function(_0xbfa823){if(_0xbfa823){return _0xbfa823[_0x6854('0x23')]()[_0x6854('0x24')](function(){var _0x1301b0=_0xbfa823[_0x6854('0x25')]({'plain':!![]});var _0x1480a9=_0x6854('0x26');return db[_0x6854('0x27')][_0x6854('0x23')]({'where':{'type':_0x1480a9,'resourceId':_0x1301b0['id']}})[_0x6854('0x24')](function(){return _0xbfa823;});})[_0x6854('0x24')](function(){_0xb0c232[_0x6854('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x288b64,_0x24d943){return function(_0x328ff6){if(!_0x328ff6){_0x288b64['sendStatus'](0x194);}return _0x328ff6;};}function handleError(_0x197fac,_0x36e432){_0x36e432=_0x36e432||0x1f4;return function(_0xf9d6f){logger['error'](_0xf9d6f[_0x6854('0x28')]);if(_0xf9d6f[_0x6854('0x29')]){delete _0xf9d6f['name'];}_0x197fac['status'](_0x36e432)[_0x6854('0x2a')](_0xf9d6f);};}exports[_0x6854('0x2b')]=function(_0x1572be,_0x1d226e){var _0x5ea828={},_0x2f6b4e={},_0x4e312e={'count':0x0,'rows':[]};var _0x316d19=_['map'](db[_0x6854('0x2c')][_0x6854('0x2d')],function(_0x52aa9f){return{'name':_0x52aa9f[_0x6854('0x2e')],'type':_0x52aa9f[_0x6854('0x2f')][_0x6854('0x30')]};});_0x2f6b4e[_0x6854('0x31')]=_[_0x6854('0x32')](_0x316d19,_0x6854('0x29'));_0x2f6b4e[_0x6854('0x33')]=_[_0x6854('0x34')](_0x1572be[_0x6854('0x33')]);_0x2f6b4e['filters']=_['intersection'](_0x2f6b4e[_0x6854('0x31')],_0x2f6b4e['query']);_0x5ea828[_0x6854('0x35')]=_[_0x6854('0x36')](_0x2f6b4e['model'],qs['fields'](_0x1572be[_0x6854('0x33')][_0x6854('0x37')]));_0x5ea828[_0x6854('0x35')]=_0x5ea828[_0x6854('0x35')]['length']?_0x5ea828['attributes']:_0x2f6b4e['model'];if(!_0x1572be['query']['hasOwnProperty'](_0x6854('0x38'))){_0x5ea828[_0x6854('0x1c')]=qs['limit'](_0x1572be[_0x6854('0x33')][_0x6854('0x1c')]);_0x5ea828[_0x6854('0x1b')]=qs['offset'](_0x1572be[_0x6854('0x33')][_0x6854('0x1b')]);}_0x5ea828[_0x6854('0x39')]=qs[_0x6854('0x3a')](_0x1572be[_0x6854('0x33')][_0x6854('0x3a')]);_0x5ea828[_0x6854('0x3b')]=qs['filters'](_[_0x6854('0x3c')](_0x1572be['query'],_0x2f6b4e[_0x6854('0x3d')]),_0x316d19);if(_0x1572be[_0x6854('0x33')][_0x6854('0x3e')]){_0x5ea828['where']=_[_0x6854('0x3f')](_0x5ea828[_0x6854('0x3b')],{'$or':_[_0x6854('0x32')](_0x316d19,function(_0x3d059e){if(_0x3d059e['type']!==_0x6854('0x40')){var _0x549621={};_0x549621[_0x3d059e['name']]={'$like':'%'+_0x1572be[_0x6854('0x33')]['filter']+'%'};return _0x549621;}})});}_0x5ea828=_[_0x6854('0x3f')]({},_0x5ea828,_0x1572be[_0x6854('0x41')]);var _0x5bd23f={'where':_0x5ea828['where']};return db[_0x6854('0x2c')][_0x6854('0x42')](_0x5bd23f)[_0x6854('0x24')](function(_0x2fe46a){_0x4e312e[_0x6854('0x42')]=_0x2fe46a;if(_0x1572be[_0x6854('0x33')][_0x6854('0x43')]){_0x5ea828['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0x6854('0x44')](_0x5ea828);})['then'](function(_0x58c38d){_0x4e312e[_0x6854('0x45')]=_0x58c38d;return _0x4e312e;})[_0x6854('0x24')](respondWithFilteredResult(_0x1d226e,_0x5ea828))[_0x6854('0x46')](handleError(_0x1d226e,null));};exports[_0x6854('0x47')]=function(_0x8ea7d6,_0x4d2b9a){var _0x2b7350={'raw':![],'where':{'id':_0x8ea7d6['params']['id']}},_0x5cb85c={};_0x5cb85c[_0x6854('0x31')]=_[_0x6854('0x34')](db['VoiceChanSpy']['rawAttributes']);_0x5cb85c['query']=_['keys'](_0x8ea7d6[_0x6854('0x33')]);_0x5cb85c[_0x6854('0x3d')]=_[_0x6854('0x36')](_0x5cb85c[_0x6854('0x31')],_0x5cb85c[_0x6854('0x33')]);_0x2b7350['attributes']=_[_0x6854('0x36')](_0x5cb85c[_0x6854('0x31')],qs['fields'](_0x8ea7d6['query'][_0x6854('0x37')]));_0x2b7350[_0x6854('0x35')]=_0x2b7350[_0x6854('0x35')]['length']?_0x2b7350['attributes']:_0x5cb85c[_0x6854('0x31')];if(_0x8ea7d6[_0x6854('0x33')]['includeAll']){_0x2b7350[_0x6854('0x48')]=[{'all':!![]}];}_0x2b7350=_['merge']({},_0x2b7350,_0x8ea7d6[_0x6854('0x41')]);return db[_0x6854('0x2c')][_0x6854('0x49')](_0x2b7350)[_0x6854('0x24')](handleEntityNotFound(_0x4d2b9a,null))[_0x6854('0x24')](respondWithResult(_0x4d2b9a,null))[_0x6854('0x46')](handleError(_0x4d2b9a,null));};exports['create']=function(_0x2b84c2,_0x1b3d6b){return db[_0x6854('0x2c')][_0x6854('0x4a')](_0x2b84c2[_0x6854('0x4b')],{})[_0x6854('0x24')](function(_0x2fbf26){var _0x17c4d4=_0x2b84c2['user']['get']({'plain':!![]});if(!_0x17c4d4)throw new Error(_0x6854('0x4c'));if(_0x17c4d4['role']===_0x6854('0x4d')){var _0x27a9e2=_0x2fbf26[_0x6854('0x25')]({'plain':!![]});var _0xba3271=_0x6854('0x26');return db[_0x6854('0x4e')][_0x6854('0x49')]({'where':{'name':_0xba3271,'userProfileId':_0x17c4d4['userProfileId']},'raw':!![]})[_0x6854('0x24')](function(_0x4f5b4a){if(_0x4f5b4a&&_0x4f5b4a[_0x6854('0x4f')]===0x0){return db[_0x6854('0x27')]['create']({'name':_0x27a9e2['name'],'resourceId':_0x27a9e2['id'],'type':_0x4f5b4a[_0x6854('0x29')],'sectionId':_0x4f5b4a['id']},{})[_0x6854('0x24')](function(){return _0x2fbf26;});}else{return _0x2fbf26;}})[_0x6854('0x46')](function(_0x2e67bc){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e67bc);throw _0x2e67bc;});}return _0x2fbf26;})[_0x6854('0x24')](respondWithResult(_0x1b3d6b,0xc9))[_0x6854('0x46')](handleError(_0x1b3d6b,null));};exports[_0x6854('0x22')]=function(_0x4e71fb,_0x15bcbf){if(_0x4e71fb[_0x6854('0x4b')]['id']){delete _0x4e71fb[_0x6854('0x4b')]['id'];}return db[_0x6854('0x2c')][_0x6854('0x49')]({'where':{'id':_0x4e71fb['params']['id']}})[_0x6854('0x24')](handleEntityNotFound(_0x15bcbf,null))['then'](saveUpdates(_0x4e71fb[_0x6854('0x4b')],null))[_0x6854('0x24')](respondWithResult(_0x15bcbf,null))[_0x6854('0x46')](handleError(_0x15bcbf,null));};exports[_0x6854('0x23')]=function(_0x4729a4,_0x32934f){return db[_0x6854('0x2c')][_0x6854('0x49')]({'where':{'id':_0x4729a4[_0x6854('0x50')]['id']}})['then'](handleEntityNotFound(_0x32934f,null))['then'](removeEntity(_0x32934f,null))[_0x6854('0x46')](handleError(_0x32934f,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index fe2caf0..60596d7 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 _0x86dd=['SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','catch','models','VoiceChanSpy','voice_chanspy','then','VoiceExtension','destroy','util','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','push','merge','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','Authenticate','password'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x86dd,0x1ee));var _0xd86d=function(_0x867c05,_0x1aebcc){_0x867c05=_0x867c05-0x0;var _0x342687=_0x86dd[_0x867c05];return _0x342687;};'use strict';var _=require('lodash');var util=require(_0xd86d('0x0'));var BPromise=require('bluebird');var attributes=require(_0xd86d('0x1'));var getUserApplications=function(_0x2cb4b4,_0x287d1d,_0x217373){var _0x17237d=0x1;var _0x30a31c=[];var _0x2e82a9={'context':_0x287d1d[_0xd86d('0x2')]||_0xd86d('0x3'),'exten':util[_0xd86d('0x4')](_0xd86d('0x5'),_0x2cb4b4[_0xd86d('0x6')],_0x217373),'type':'system','isApp':![],'ChanSpyId':_0x2cb4b4['id'],'UserId':_0x287d1d['id']};_0x30a31c[_0xd86d('0x7')](_[_0xd86d('0x8')]({'app':'Set','appdata':util[_0xd86d('0x4')](_0xd86d('0x9'),_0xd86d('0xa')),'priority':_0x17237d++},_0x2e82a9));if(_0x2cb4b4[_0xd86d('0xb')]){_0x30a31c['push'](_[_0xd86d('0x8')]({'app':_0xd86d('0xc'),'appdata':util[_0xd86d('0x4')](_0xd86d('0xd'),_0x2cb4b4['recordingFormat']),'priority':_0x17237d++},_0x2e82a9));}if(_0x2cb4b4['auth']){_0x30a31c[_0xd86d('0x7')](_[_0xd86d('0x8')]({'app':_0xd86d('0xe'),'appdata':_0x2cb4b4[_0xd86d('0xf')],'priority':_0x17237d++},_0x2e82a9));}_0x30a31c[_0xd86d('0x7')](_['merge']({'app':'ChanSpy','appdata':util['format'](_0xd86d('0x10'),_0x287d1d[_0xd86d('0x11')],_0x2cb4b4[_0xd86d('0x12')]?_0x2cb4b4[_0xd86d('0x12')][_0xd86d('0x13')](''):''),'priority':_0x17237d++},_0x2e82a9));if(_0x2cb4b4[_0xd86d('0xb')]){_0x30a31c[_0xd86d('0x7')](_['merge']({'app':_0xd86d('0x14'),'priority':_0x17237d++},_0x2e82a9));}return _0x30a31c;};var getChanSpyApplications=function(_0x2cc4d9,_0x38dc37){var _0x413fb8=[];for(var _0x34ee10=0x0,_0x26f3c4=0x1;_0x34ee10<_0x38dc37[_0xd86d('0x15')];_0x34ee10++,_0x26f3c4=0x1){_0x413fb8=_0x413fb8[_0xd86d('0x16')](getUserApplications(_0x2cc4d9,_0x38dc37[_0x34ee10],_0x38dc37[_0x34ee10][_0xd86d('0x17')]));if(_0x38dc37[_0x34ee10][_0xd86d('0x17')]!=_0x38dc37[_0x34ee10]['name']){_0x413fb8=_0x413fb8['concat'](getUserApplications(_0x2cc4d9,_0x38dc37[_0x34ee10],_0x38dc37[_0x34ee10][_0xd86d('0x11')]));}}return _0x413fb8;};var getChanSpyPromise=function(_0x1966e3,_0xb74a5f){return new BPromise(function(_0x573556,_0x32e816){return _0x1966e3[_0xd86d('0x18')][_0xd86d('0x19')]({'attributes':['id','name',_0xd86d('0x17')],'where':{'role':_0xd86d('0x1a'),'chanspy':!![]},'raw':!![]})['then'](function(_0x384bb3){if(_0x384bb3){return _0x573556(getChanSpyApplications(_0xb74a5f,_0x384bb3));}return _0x573556([]);})[_0xd86d('0x1b')](function(_0x74f57e){_0x32e816(_0x74f57e);});});};module['exports']=function(_0x2faef6,_0x30c0f1){var _0xdc92c1=_0x2faef6[_0xd86d('0x1c')];return _0x2faef6['define'](_0xd86d('0x1d'),attributes,{'tableName':_0xd86d('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5e1ea3,_0x59f60e,_0x5497e5){return getChanSpyPromise(_0xdc92c1,_0x5e1ea3)[_0xd86d('0x1f')](function(_0x5d0e0c){if(_0x5d0e0c&&_0x5d0e0c[_0xd86d('0x15')]){return _0xdc92c1['VoiceExtension']['bulkCreate'](_0x5d0e0c);}})[_0xd86d('0x1f')](function(){_0x5497e5();})[_0xd86d('0x1b')](function(_0x48dd45){_0x5497e5(_0x48dd45);});},'afterUpdate':function(_0x1da491,_0x4ce504,_0x38e4b3){return _0xdc92c1['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x1da491['id']}})['then'](function(){return getChanSpyPromise(_0xdc92c1,_0x1da491);})['then'](function(_0x345bb7){if(_0x345bb7&&_0x345bb7['length']){return _0xdc92c1[_0xd86d('0x20')]['bulkCreate'](_0x345bb7);}})[_0xd86d('0x1f')](function(){_0x38e4b3();})[_0xd86d('0x1b')](function(_0x2626d6){_0x38e4b3(_0x2626d6);});},'afterDestroy':function(_0x320cfa,_0x5e02a9,_0x2be14e){return _0xdc92c1[_0xd86d('0x20')][_0xd86d('0x21')]({'where':{'ChanSpyId':_0x320cfa['id']}})[_0xd86d('0x1f')](function(){_0x2be14e();})[_0xd86d('0x1b')](function(_0x15cbe0){_0x2be14e(_0x15cbe0);});}}});}; \ No newline at end of file +var _0xe706=['Authenticate','password','ChanSpy','options','concat','internal','name','User','findAll','agent','then','catch','exports','models','VoiceChanSpy','length','VoiceExtension','destroy','bulkCreate','lodash','util','bluebird','context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a'];(function(_0x3bab09,_0x217c29){var _0x164376=function(_0x277730){while(--_0x277730){_0x3bab09['push'](_0x3bab09['shift']());}};_0x164376(++_0x217c29);}(_0xe706,0xa3));var _0x6e70=function(_0xcfa2e0,_0x40dd3d){_0xcfa2e0=_0xcfa2e0-0x0;var _0x1dc2b1=_0xe706[_0xcfa2e0];return _0x1dc2b1;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x2cae77,_0x315629,_0x2ca810){var _0x7dfbc3=0x1;var _0x142c27=[];var _0x2164a4={'context':_0x315629[_0x6e70('0x3')]||_0x6e70('0x4'),'exten':util[_0x6e70('0x5')](_0x6e70('0x6'),_0x2cae77[_0x6e70('0x7')],_0x2ca810),'type':_0x6e70('0x8'),'isApp':![],'ChanSpyId':_0x2cae77['id'],'UserId':_0x315629['id']};_0x142c27[_0x6e70('0x9')](_[_0x6e70('0xa')]({'app':_0x6e70('0xb'),'appdata':util[_0x6e70('0x5')](_0x6e70('0xc'),_0x6e70('0xd')),'priority':_0x7dfbc3++},_0x2164a4));if(_0x2cae77[_0x6e70('0xe')]){_0x142c27[_0x6e70('0x9')](_[_0x6e70('0xa')]({'app':_0x6e70('0xf'),'appdata':util[_0x6e70('0x5')](_0x6e70('0x10'),_0x2cae77['recordingFormat']),'priority':_0x7dfbc3++},_0x2164a4));}if(_0x2cae77['auth']){_0x142c27[_0x6e70('0x9')](_[_0x6e70('0xa')]({'app':_0x6e70('0x11'),'appdata':_0x2cae77[_0x6e70('0x12')],'priority':_0x7dfbc3++},_0x2164a4));}_0x142c27[_0x6e70('0x9')](_[_0x6e70('0xa')]({'app':_0x6e70('0x13'),'appdata':util[_0x6e70('0x5')]('SIP/%s,%s',_0x315629['name'],_0x2cae77['options']?_0x2cae77[_0x6e70('0x14')]['join'](''):''),'priority':_0x7dfbc3++},_0x2164a4));if(_0x2cae77['record']){_0x142c27[_0x6e70('0x9')](_[_0x6e70('0xa')]({'app':'StopMixMonitor','priority':_0x7dfbc3++},_0x2164a4));}return _0x142c27;};var getChanSpyApplications=function(_0x24f3ac,_0x5c3fe7){var _0x2efc0f=[];for(var _0x161f23=0x0,_0x4ca554=0x1;_0x161f23<_0x5c3fe7['length'];_0x161f23++,_0x4ca554=0x1){_0x2efc0f=_0x2efc0f[_0x6e70('0x15')](getUserApplications(_0x24f3ac,_0x5c3fe7[_0x161f23],_0x5c3fe7[_0x161f23]['internal']));if(_0x5c3fe7[_0x161f23][_0x6e70('0x16')]!=_0x5c3fe7[_0x161f23][_0x6e70('0x17')]){_0x2efc0f=_0x2efc0f['concat'](getUserApplications(_0x24f3ac,_0x5c3fe7[_0x161f23],_0x5c3fe7[_0x161f23]['name']));}}return _0x2efc0f;};var getChanSpyPromise=function(_0xc238ba,_0x208e21){return new BPromise(function(_0x2368eb,_0x3a9978){return _0xc238ba[_0x6e70('0x18')][_0x6e70('0x19')]({'attributes':['id',_0x6e70('0x17'),_0x6e70('0x16')],'where':{'role':_0x6e70('0x1a'),'chanspy':!![]},'raw':!![]})[_0x6e70('0x1b')](function(_0x4a0cfe){if(_0x4a0cfe){return _0x2368eb(getChanSpyApplications(_0x208e21,_0x4a0cfe));}return _0x2368eb([]);})[_0x6e70('0x1c')](function(_0x344b65){_0x3a9978(_0x344b65);});});};module[_0x6e70('0x1d')]=function(_0x502b2d,_0x3ccd87){var _0xa5d49=_0x502b2d[_0x6e70('0x1e')];return _0x502b2d['define'](_0x6e70('0x1f'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x50aec2,_0x4e97c7,_0x41e352){return getChanSpyPromise(_0xa5d49,_0x50aec2)[_0x6e70('0x1b')](function(_0x51d292){if(_0x51d292&&_0x51d292[_0x6e70('0x20')]){return _0xa5d49[_0x6e70('0x21')]['bulkCreate'](_0x51d292);}})[_0x6e70('0x1b')](function(){_0x41e352();})[_0x6e70('0x1c')](function(_0x2bb231){_0x41e352(_0x2bb231);});},'afterUpdate':function(_0x4a67ac,_0x54a5fe,_0x2c4d37){return _0xa5d49[_0x6e70('0x21')][_0x6e70('0x22')]({'where':{'ChanSpyId':_0x4a67ac['id']}})[_0x6e70('0x1b')](function(){return getChanSpyPromise(_0xa5d49,_0x4a67ac);})[_0x6e70('0x1b')](function(_0x5d772a){if(_0x5d772a&&_0x5d772a[_0x6e70('0x20')]){return _0xa5d49[_0x6e70('0x21')][_0x6e70('0x23')](_0x5d772a);}})[_0x6e70('0x1b')](function(){_0x2c4d37();})[_0x6e70('0x1c')](function(_0x20a225){_0x2c4d37(_0x20a225);});},'afterDestroy':function(_0x3f78d2,_0x24114a,_0x3a0821){return _0xa5d49[_0x6e70('0x21')]['destroy']({'where':{'ChanSpyId':_0x3f78d2['id']}})[_0x6e70('0x1b')](function(){_0x3a0821();})['catch'](function(_0x259486){_0x3a0821(_0x259486);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 660d38f..6ce0b21 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 _0x8129=['request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','VoiceChanSpy,\x20%s,\x20%s'];(function(_0x310000,_0x27c276){var _0xdef369=function(_0x368c6a){while(--_0x368c6a){_0x310000['push'](_0x310000['shift']());}};_0xdef369(++_0x27c276);}(_0x8129,0x171));var _0x9812=function(_0x53cd4b,_0x23a05d){_0x53cd4b=_0x53cd4b-0x0;var _0x554659=_0x8129[_0x53cd4b];return _0x554659;};'use strict';var _=require('lodash');var util=require(_0x9812('0x0'));var moment=require('moment');var BPromise=require(_0x9812('0x1'));var rs=require(_0x9812('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9812('0x3'))['db'];var utils=require(_0x9812('0x4'));var logger=require(_0x9812('0x5'))('rpc');var config=require(_0x9812('0x6'));var jayson=require(_0x9812('0x7'));var client=jayson[_0x9812('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a3c3a,_0x1adc73,_0x30f891){return new BPromise(function(_0x28ca42,_0x4ef567){return client['request'](_0x4a3c3a,_0x30f891)[_0x9812('0x9')](function(_0x228b45){logger['info'](_0x9812('0xa'),_0x1adc73,_0x9812('0xb'));logger[_0x9812('0xc')](_0x9812('0xd'),_0x1adc73,_0x9812('0xb'),JSON[_0x9812('0xe')](_0x228b45));if(_0x228b45[_0x9812('0xf')]){if(_0x228b45[_0x9812('0xf')][_0x9812('0x10')]===0x1f4){logger[_0x9812('0xf')](_0x9812('0xa'),_0x1adc73,_0x228b45[_0x9812('0xf')][_0x9812('0x11')]);return _0x4ef567(_0x228b45[_0x9812('0xf')][_0x9812('0x11')]);}logger[_0x9812('0xf')](_0x9812('0xa'),_0x1adc73,_0x228b45[_0x9812('0xf')]['message']);return _0x28ca42(_0x228b45[_0x9812('0xf')][_0x9812('0x11')]);}else{logger[_0x9812('0x12')](_0x9812('0xa'),_0x1adc73,_0x9812('0xb'));_0x28ca42(_0x228b45['result'][_0x9812('0x11')]);}})[_0x9812('0x13')](function(_0x1e777d){logger[_0x9812('0xf')](_0x9812('0xa'),_0x1adc73,_0x1e777d);_0x4ef567(_0x1e777d);});});} \ No newline at end of file +var _0x83dd=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','info','result'];(function(_0x294d7a,_0x27fcc6){var _0x428212=function(_0x5b50cd){while(--_0x5b50cd){_0x294d7a['push'](_0x294d7a['shift']());}};_0x428212(++_0x27fcc6);}(_0x83dd,0x166));var _0xd83d=function(_0x3d3a9b,_0x26532e){_0x3d3a9b=_0x3d3a9b-0x0;var _0x3f8881=_0x83dd[_0x3d3a9b];return _0x3f8881;};'use strict';var _=require(_0xd83d('0x0'));var util=require('util');var moment=require(_0xd83d('0x1'));var BPromise=require(_0xd83d('0x2'));var rs=require(_0xd83d('0x3'));var fs=require('fs');var Redis=require(_0xd83d('0x4'));var db=require(_0xd83d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd83d('0x6'))(_0xd83d('0x7'));var config=require(_0xd83d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd83d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4373c5,_0x386a1c,_0xd13263){return new BPromise(function(_0x2211ce,_0x3fb0e9){return client[_0xd83d('0xa')](_0x4373c5,_0xd13263)['then'](function(_0xc322f6){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x386a1c,_0xd83d('0xb'));logger['debug'](_0xd83d('0xc'),_0x386a1c,_0xd83d('0xb'),JSON[_0xd83d('0xd')](_0xc322f6));if(_0xc322f6[_0xd83d('0xe')]){if(_0xc322f6['error'][_0xd83d('0xf')]===0x1f4){logger[_0xd83d('0xe')](_0xd83d('0x10'),_0x386a1c,_0xc322f6['error'][_0xd83d('0x11')]);return _0x3fb0e9(_0xc322f6[_0xd83d('0xe')][_0xd83d('0x11')]);}logger[_0xd83d('0xe')](_0xd83d('0x10'),_0x386a1c,_0xc322f6[_0xd83d('0xe')][_0xd83d('0x11')]);return _0x2211ce(_0xc322f6[_0xd83d('0xe')][_0xd83d('0x11')]);}else{logger[_0xd83d('0x12')](_0xd83d('0x10'),_0x386a1c,_0xd83d('0xb'));_0x2211ce(_0xc322f6[_0xd83d('0x13')][_0xd83d('0x11')]);}})[_0xd83d('0x14')](function(_0x513b25){logger[_0xd83d('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x386a1c,_0x513b25);_0x3fb0e9(_0x513b25);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 91e2d26..2ca7a0b 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 _0x0c46=['update','exports','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','get','/:id','show','post','put'];(function(_0x1fa410,_0x236d6a){var _0x1ad4a5=function(_0x1c0f81){while(--_0x1c0f81){_0x1fa410['push'](_0x1fa410['shift']());}};_0x1ad4a5(++_0x236d6a);}(_0x0c46,0x1d0));var _0x60c4=function(_0x1bff18,_0x384e39){_0x1bff18=_0x1bff18-0x0;var _0x24521e=_0x0c46[_0x1bff18];return _0x24521e;};'use strict';var multer=require(_0x60c4('0x0'));var util=require(_0x60c4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x60c4('0x2'));var interaction=require(_0x60c4('0x3'));var config=require(_0x60c4('0x4'));var controller=require(_0x60c4('0x5'));router['get']('/',auth[_0x60c4('0x6')](),controller['index']);router[_0x60c4('0x7')](_0x60c4('0x8'),auth[_0x60c4('0x6')](),controller[_0x60c4('0x9')]);router[_0x60c4('0xa')]('/',auth[_0x60c4('0x6')](),controller['create']);router[_0x60c4('0xb')](_0x60c4('0x8'),auth['isAuthenticated'](),controller[_0x60c4('0xc')]);router['delete'](_0x60c4('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x60c4('0xd')]=router; \ No newline at end of file +var _0x4b04=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create','put','/:id','update','delete','exports','multer','path','express','Router','../../components/auth/service'];(function(_0x591871,_0xb3402d){var _0x2e4d8e=function(_0x481b17){while(--_0x481b17){_0x591871['push'](_0x591871['shift']());}};_0x2e4d8e(++_0xb3402d);}(_0x4b04,0x1b5));var _0x44b0=function(_0xf81a0d,_0x554148){_0xf81a0d=_0xf81a0d-0x0;var _0x19b2fd=_0x4b04[_0xf81a0d];return _0x19b2fd;};'use strict';var multer=require(_0x44b0('0x0'));var util=require('util');var path=require(_0x44b0('0x1'));var timeout=require('connect-timeout');var express=require(_0x44b0('0x2'));var router=express[_0x44b0('0x3')]();var auth=require(_0x44b0('0x4'));var interaction=require(_0x44b0('0x5'));var config=require(_0x44b0('0x6'));var controller=require('./voiceContext.controller');router[_0x44b0('0x7')]('/',auth[_0x44b0('0x8')](),controller[_0x44b0('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x44b0('0xa')]);router['post']('/',auth[_0x44b0('0x8')](),controller[_0x44b0('0xb')]);router[_0x44b0('0xc')](_0x44b0('0xd'),auth['isAuthenticated'](),controller[_0x44b0('0xe')]);router[_0x44b0('0xf')](_0x44b0('0xd'),auth[_0x44b0('0x8')](),controller['destroy']);module[_0x44b0('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 d2484f4..24f2025 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 _0x9c44=['BOOLEAN','STRING','name'];(function(_0x53584f,_0x3f8215){var _0x24507d=function(_0x1cf14a){while(--_0x1cf14a){_0x53584f['push'](_0x53584f['shift']());}};_0x24507d(++_0x3f8215);}(_0x9c44,0x178));var _0x49c4=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x9c44[_0x2b7764];return _0x848dcb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x49c4('0x0')],'unique':_0x49c4('0x1')},'description':{'type':Sequelize[_0x49c4('0x0')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x49c4('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9957=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x3cedd5,_0x4a2c25){var _0x2d1a25=function(_0x2ae55){while(--_0x2ae55){_0x3cedd5['push'](_0x3cedd5['shift']());}};_0x2d1a25(++_0x4a2c25);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7995('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index cbad3cf..1bee227 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 _0x4517=['code','VoiceContext,\x20%s,\x20%s','message','result','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','update','destroy','Contexts','UserProfileResource','stack','name','send','VoiceContext','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','length','find','catch','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','writeFileSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','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/license/util','jayson/promise','client','then','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x4517,0x112));var _0x7451=function(_0x44ab81,_0x42e1c7){_0x44ab81=_0x44ab81-0x0;var _0x3e69b9=_0x4517[_0x44ab81];return _0x3e69b9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x7451('0x0'));var rimraf=require(_0x7451('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7451('0x2'));var rp=require(_0x7451('0x3'));var moment=require(_0x7451('0x4'));var BPromise=require(_0x7451('0x5'));var Mustache=require(_0x7451('0x6'));var util=require(_0x7451('0x7'));var path=require(_0x7451('0x8'));var sox=require(_0x7451('0x9'));var csv=require(_0x7451('0xa'));var ejs=require(_0x7451('0xb'));var fs=require('fs');var _=require(_0x7451('0xc'));var squel=require(_0x7451('0xd'));var crypto=require(_0x7451('0xe'));var jsforce=require(_0x7451('0xf'));var deskjs=require(_0x7451('0x10'));var toCsv=require(_0x7451('0xa'));var querystring=require(_0x7451('0x11'));var Papa=require('papaparse');var Redis=require(_0x7451('0x12'));var authService=require(_0x7451('0x13'));var qs=require(_0x7451('0x14'));var as=require(_0x7451('0x15'));var hardwareService=require(_0x7451('0x16'));var logger=require(_0x7451('0x17'))(_0x7451('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7451('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x7451('0x1a'));var client=jayson[_0x7451('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7cb990,_0x38129d,_0x4dbe5b,_0x46811e){return new BPromise(function(_0x282128,_0x110ed6){var _0x187e87=_0x46811e||client;return _0x187e87['request'](_0x7cb990,_0x4dbe5b)[_0x7451('0x1c')](function(_0x313385){logger[_0x7451('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x38129d,'request\x20sent');logger[_0x7451('0x1e')](_0x7451('0x1f'),_0x38129d,_0x7451('0x20'),JSON[_0x7451('0x21')](_0x313385));if(_0x313385[_0x7451('0x22')]){if(_0x313385[_0x7451('0x22')][_0x7451('0x23')]===0x1f4){logger[_0x7451('0x22')](_0x7451('0x24'),_0x38129d,_0x313385['error'][_0x7451('0x25')]);return _0x110ed6(_0x313385[_0x7451('0x22')][_0x7451('0x25')]);}logger['error'](_0x7451('0x24'),_0x38129d,_0x313385[_0x7451('0x22')][_0x7451('0x25')]);return _0x282128(_0x313385[_0x7451('0x22')][_0x7451('0x25')]);}else{logger[_0x7451('0x1d')](_0x7451('0x24'),_0x38129d,'request\x20sent');_0x282128(_0x313385[_0x7451('0x26')][_0x7451('0x25')]);}})['catch'](function(_0x406b03){logger[_0x7451('0x22')](_0x7451('0x24'),_0x38129d,_0x406b03);_0x110ed6(_0x406b03);});});}function respondWithStatusCode(_0x57cc15,_0x19e33b){_0x19e33b=_0x19e33b||0xcc;return function(_0x21dd67){if(_0x21dd67){return _0x57cc15[_0x7451('0x27')](_0x19e33b);}return _0x57cc15[_0x7451('0x28')](_0x19e33b)[_0x7451('0x29')]();};}function respondWithResult(_0x4650a5,_0x3c56f1){_0x3c56f1=_0x3c56f1||0xc8;return function(_0xdfc7d1){if(_0xdfc7d1){return _0x4650a5[_0x7451('0x28')](_0x3c56f1)['json'](_0xdfc7d1);}};}function respondWithFilteredResult(_0x328d0b,_0x2b8a8b){return function(_0x5df311){if(_0x5df311){var _0x54bef8=_0x5df311[_0x7451('0x2a')],_0xcc793e=_0x2b8a8b[_0x7451('0x2b')],_0x1edcf2=_0x2b8a8b[_0x7451('0x2b')]+_0x2b8a8b['limit'],_0x248d83;if(_0x1edcf2>=_0x54bef8){_0x1edcf2=_0x54bef8;_0x248d83=0xc8;}else{_0x248d83=0xce;}_0x328d0b[_0x7451('0x28')](_0x248d83);return _0x328d0b['set'](_0x7451('0x2c'),_0xcc793e+'-'+_0x1edcf2+'/'+_0x54bef8)[_0x7451('0x2d')](_0x5df311);}return null;};}function patchUpdates(_0x4d99f3){return function(_0x7da05a){try{jsonpatch[_0x7451('0x2e')](_0x7da05a,_0x4d99f3,!![]);}catch(_0x40b6c3){return BPromise[_0x7451('0x2f')](_0x40b6c3);}return _0x7da05a[_0x7451('0x30')]();};}function saveUpdates(_0x4e24f7,_0x2071e5){return function(_0x43d305){if(_0x43d305){return _0x43d305[_0x7451('0x31')](_0x4e24f7)['then'](function(_0x2be408){return _0x2be408;});}return null;};}function removeEntity(_0x4654e7,_0x5dfc5e){return function(_0x4caef4){if(_0x4caef4){return _0x4caef4[_0x7451('0x32')]()[_0x7451('0x1c')](function(){var _0x55a458=_0x4caef4['get']({'plain':!![]});var _0x295a1e=_0x7451('0x33');return db[_0x7451('0x34')][_0x7451('0x32')]({'where':{'type':_0x295a1e,'resourceId':_0x55a458['id']}})[_0x7451('0x1c')](function(){return _0x4caef4;});})[_0x7451('0x1c')](function(){_0x4654e7[_0x7451('0x28')](0xcc)[_0x7451('0x29')]();});}};}function handleEntityNotFound(_0x48f29a,_0x33f1fe){return function(_0x11aead){if(!_0x11aead){_0x48f29a['sendStatus'](0x194);}return _0x11aead;};}function handleError(_0x2f5328,_0x1ee26b){_0x1ee26b=_0x1ee26b||0x1f4;return function(_0x463708){logger[_0x7451('0x22')](_0x463708[_0x7451('0x35')]);if(_0x463708[_0x7451('0x36')]){delete _0x463708['name'];}_0x2f5328[_0x7451('0x28')](_0x1ee26b)[_0x7451('0x37')](_0x463708);};}exports['index']=function(_0x1313e7,_0x143e82){var _0x4e761d={},_0x5820e2={},_0x59393b={'count':0x0,'rows':[]};var _0x54b60f=_['map'](db[_0x7451('0x38')][_0x7451('0x39')],function(_0x3647f8){return{'name':_0x3647f8[_0x7451('0x3a')],'type':_0x3647f8[_0x7451('0x3b')]['key']};});_0x5820e2['model']=_['map'](_0x54b60f,'name');_0x5820e2['query']=_[_0x7451('0x3c')](_0x1313e7[_0x7451('0x3d')]);_0x5820e2[_0x7451('0x3e')]=_[_0x7451('0x3f')](_0x5820e2[_0x7451('0x40')],_0x5820e2[_0x7451('0x3d')]);_0x4e761d[_0x7451('0x41')]=_[_0x7451('0x3f')](_0x5820e2[_0x7451('0x40')],qs[_0x7451('0x42')](_0x1313e7[_0x7451('0x3d')]['fields']));_0x4e761d['attributes']=_0x4e761d[_0x7451('0x41')]['length']?_0x4e761d[_0x7451('0x41')]:_0x5820e2[_0x7451('0x40')];if(!_0x1313e7['query']['hasOwnProperty'](_0x7451('0x43'))){_0x4e761d['limit']=qs[_0x7451('0x44')](_0x1313e7['query'][_0x7451('0x44')]);_0x4e761d[_0x7451('0x2b')]=qs['offset'](_0x1313e7[_0x7451('0x3d')]['offset']);}_0x4e761d[_0x7451('0x45')]=qs[_0x7451('0x46')](_0x1313e7[_0x7451('0x3d')][_0x7451('0x46')]);_0x4e761d[_0x7451('0x47')]=qs[_0x7451('0x3e')](_[_0x7451('0x48')](_0x1313e7[_0x7451('0x3d')],_0x5820e2[_0x7451('0x3e')]),_0x54b60f);if(_0x1313e7[_0x7451('0x3d')][_0x7451('0x49')]){_0x4e761d[_0x7451('0x47')]=_[_0x7451('0x4a')](_0x4e761d[_0x7451('0x47')],{'$or':_['map'](_0x54b60f,function(_0x437f9c){if(_0x437f9c[_0x7451('0x3b')]!==_0x7451('0x4b')){var _0x6aa375={};_0x6aa375[_0x437f9c['name']]={'$like':'%'+_0x1313e7[_0x7451('0x3d')]['filter']+'%'};return _0x6aa375;}})});}_0x4e761d=_['merge']({},_0x4e761d,_0x1313e7['options']);var _0x545685={'where':_0x4e761d['where']};return db[_0x7451('0x38')][_0x7451('0x2a')](_0x545685)[_0x7451('0x1c')](function(_0x489d7d){_0x59393b[_0x7451('0x2a')]=_0x489d7d;if(_0x1313e7[_0x7451('0x3d')][_0x7451('0x4c')]){_0x4e761d[_0x7451('0x4d')]=[{'all':!![]}];}return db[_0x7451('0x38')][_0x7451('0x4e')](_0x4e761d);})[_0x7451('0x1c')](function(_0x875a40){_0x59393b[_0x7451('0x4f')]=_0x875a40;return _0x59393b;})['then'](respondWithFilteredResult(_0x143e82,_0x4e761d))['catch'](handleError(_0x143e82,null));};exports['show']=function(_0xd26beb,_0x3acf1d){var _0x1d4c05={'raw':![],'where':{'id':_0xd26beb['params']['id']}},_0x4c9d33={};_0x4c9d33['model']=_[_0x7451('0x3c')](db['VoiceContext']['rawAttributes']);_0x4c9d33[_0x7451('0x3d')]=_[_0x7451('0x3c')](_0xd26beb[_0x7451('0x3d')]);_0x4c9d33[_0x7451('0x3e')]=_[_0x7451('0x3f')](_0x4c9d33['model'],_0x4c9d33[_0x7451('0x3d')]);_0x1d4c05['attributes']=_[_0x7451('0x3f')](_0x4c9d33[_0x7451('0x40')],qs[_0x7451('0x42')](_0xd26beb[_0x7451('0x3d')][_0x7451('0x42')]));_0x1d4c05[_0x7451('0x41')]=_0x1d4c05[_0x7451('0x41')][_0x7451('0x50')]?_0x1d4c05[_0x7451('0x41')]:_0x4c9d33['model'];if(_0xd26beb['query'][_0x7451('0x4c')]){_0x1d4c05[_0x7451('0x4d')]=[{'all':!![]}];}_0x1d4c05=_['merge']({},_0x1d4c05,_0xd26beb['options']);return db['VoiceContext'][_0x7451('0x51')](_0x1d4c05)[_0x7451('0x1c')](handleEntityNotFound(_0x3acf1d,null))[_0x7451('0x1c')](respondWithResult(_0x3acf1d,null))[_0x7451('0x52')](handleError(_0x3acf1d,null));};exports[_0x7451('0x53')]=function(_0x9f5737,_0x5acbab,_0x1f0886){var _0x4f14e6;return db['VoiceContext']['create'](_0x9f5737[_0x7451('0x54')],{'raw':!![]})[_0x7451('0x1c')](function(_0x2548be){_0x4f14e6=_0x2548be;return db[_0x7451('0x38')][_0x7451('0x4e')]({'raw':!![]});})[_0x7451('0x1c')](function(_0x36add5){var _0x49f320=fs[_0x7451('0x55')](path[_0x7451('0x56')](config[_0x7451('0x57')],_0x7451('0x58')),_0x7451('0x59'));var _0xd943e3=ejs[_0x7451('0x5a')](_0x49f320,{'contexts':_0x36add5||[]});fs['writeFileSync'](_0x7451('0x5b'),_0xd943e3);})[_0x7451('0x1c')](function(){return respondWithRpcPromise(_0x7451('0x5c'),_0x7451('0x53'),{'module':_0x7451('0x5d')});})[_0x7451('0x1c')](function(){var _0x53db81=_0x9f5737[_0x7451('0x5e')]['get']({'plain':!![]});if(!_0x53db81)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x53db81[_0x7451('0x5f')]===_0x7451('0x5e')){var _0xf71422=_0x4f14e6[_0x7451('0x60')]({'plain':!![]});return db[_0x7451('0x61')][_0x7451('0x51')]({'where':{'name':'Contexts','userProfileId':_0x53db81[_0x7451('0x62')]},'raw':!![]})['then'](function(_0x31df11){if(_0x31df11&&_0x31df11[_0x7451('0x63')]===0x0){return db['UserProfileResource']['create']({'name':_0xf71422['name'],'resourceId':_0xf71422['id'],'type':_0x31df11['name'],'sectionId':_0x31df11['id']},{})[_0x7451('0x1c')](function(){return _0x4f14e6;});}else{return _0x4f14e6;}})[_0x7451('0x52')](function(_0x1a78d8){logger[_0x7451('0x22')](_0x7451('0x64'),_0x1a78d8);throw _0x1a78d8;});}return _0x4f14e6;})[_0x7451('0x1c')](respondWithResult(_0x5acbab,0xc9))['catch'](handleError(_0x5acbab,null));};exports[_0x7451('0x31')]=function(_0x49a1c9,_0x3b4548,_0x407e3e){var _0x184574;return db['VoiceContext']['find']({'where':{'id':_0x49a1c9[_0x7451('0x65')]['id']}})[_0x7451('0x1c')](handleEntityNotFound(_0x3b4548,null))[_0x7451('0x1c')](saveUpdates(_0x49a1c9[_0x7451('0x54')],null))[_0x7451('0x1c')](function(_0xefb808){if(_0xefb808){_0x184574=_0xefb808;return db[_0x7451('0x38')][_0x7451('0x4e')]({'raw':!![]});}})[_0x7451('0x1c')](function(_0xe02d16){var _0x491d3a=fs['readFileSync'](path[_0x7451('0x56')](config[_0x7451('0x57')],_0x7451('0x58')),'utf8');var _0x34f507=ejs[_0x7451('0x5a')](_0x491d3a,{'contexts':_0xe02d16||[]});fs[_0x7451('0x66')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x34f507);})[_0x7451('0x1c')](function(){return respondWithRpcPromise(_0x7451('0x5c'),'update',{'module':'chan_sip.so'});})[_0x7451('0x1c')](function(){return _0x184574;})[_0x7451('0x1c')](respondWithResult(_0x3b4548,null))['catch'](handleError(_0x3b4548,null));};exports[_0x7451('0x32')]=function(_0x2870ed,_0x4bb953,_0x574b12){var _0x53e12a;return db[_0x7451('0x38')][_0x7451('0x51')]({'where':{'id':_0x2870ed[_0x7451('0x65')]['id']}})[_0x7451('0x1c')](handleEntityNotFound(_0x4bb953,null))[_0x7451('0x1c')](removeEntity(_0x4bb953,null))[_0x7451('0x1c')](function(){return db[_0x7451('0x38')][_0x7451('0x4e')]({'raw':!![]});})[_0x7451('0x1c')](function(_0x44e656){var _0x2550d4=fs[_0x7451('0x55')](path[_0x7451('0x56')](config['root'],_0x7451('0x58')),_0x7451('0x59'));var _0x212a47=ejs[_0x7451('0x5a')](_0x2550d4,{'contexts':_0x44e656});fs['writeFileSync'](_0x7451('0x5b'),_0x212a47);return respondWithRpcPromise('Reload','destroy',{'module':_0x7451('0x5d')});})[_0x7451('0x52')](handleError(_0x4bb953,null));}; \ No newline at end of file +var _0x639a=['show','params','keys','rawAttributes','find','create','body','findAll','readFileSync','join','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','server/files/templates/context.ejs','writeFileSync','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','end','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','get','Contexts','sendStatus','stack','name','send','index','map','VoiceContext','fieldName','type','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows'];(function(_0x295a92,_0x7d70dc){var _0x3f5dac=function(_0x47b9e8){while(--_0x47b9e8){_0x295a92['push'](_0x295a92['shift']());}};_0x3f5dac(++_0x7d70dc);}(_0x639a,0xec));var _0xa639=function(_0x535656,_0xf9c5e2){_0x535656=_0x535656-0x0;var _0x33899a=_0x639a[_0x535656];return _0x33899a;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa639('0x0'));var rimraf=require(_0xa639('0x1'));var zipdir=require(_0xa639('0x2'));var jsonpatch=require(_0xa639('0x3'));var rp=require(_0xa639('0x4'));var moment=require(_0xa639('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa639('0x6'));var util=require(_0xa639('0x7'));var path=require(_0xa639('0x8'));var sox=require('sox');var csv=require(_0xa639('0x9'));var ejs=require(_0xa639('0xa'));var fs=require('fs');var _=require(_0xa639('0xb'));var squel=require(_0xa639('0xc'));var crypto=require('crypto');var jsforce=require(_0xa639('0xd'));var deskjs=require(_0xa639('0xe'));var toCsv=require(_0xa639('0x9'));var querystring=require(_0xa639('0xf'));var Papa=require(_0xa639('0x10'));var Redis=require(_0xa639('0x11'));var authService=require(_0xa639('0x12'));var qs=require(_0xa639('0x13'));var as=require(_0xa639('0x14'));var hardwareService=require(_0xa639('0x15'));var logger=require(_0xa639('0x16'))(_0xa639('0x17'));var utils=require(_0xa639('0x18'));var config=require(_0xa639('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xa639('0x1a')][_0xa639('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5d0128,_0x4f5220,_0x228143,_0x1bdc46){return new BPromise(function(_0x4d4b66,_0x1df5dd){var _0x2590af=_0x1bdc46||client;return _0x2590af[_0xa639('0x1c')](_0x5d0128,_0x228143)['then'](function(_0xb15138){logger[_0xa639('0x1d')](_0xa639('0x1e'),_0x4f5220,_0xa639('0x1f'));logger[_0xa639('0x20')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x4f5220,_0xa639('0x1f'),JSON['stringify'](_0xb15138));if(_0xb15138[_0xa639('0x21')]){if(_0xb15138[_0xa639('0x21')][_0xa639('0x22')]===0x1f4){logger[_0xa639('0x21')](_0xa639('0x1e'),_0x4f5220,_0xb15138['error']['message']);return _0x1df5dd(_0xb15138[_0xa639('0x21')][_0xa639('0x23')]);}logger[_0xa639('0x21')](_0xa639('0x1e'),_0x4f5220,_0xb15138[_0xa639('0x21')]['message']);return _0x4d4b66(_0xb15138['error'][_0xa639('0x23')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x4f5220,'request\x20sent');_0x4d4b66(_0xb15138[_0xa639('0x24')][_0xa639('0x23')]);}})[_0xa639('0x25')](function(_0x5131a3){logger[_0xa639('0x21')]('VoiceContext,\x20%s,\x20%s',_0x4f5220,_0x5131a3);_0x1df5dd(_0x5131a3);});});}function respondWithStatusCode(_0xe89eb9,_0x351a33){_0x351a33=_0x351a33||0xcc;return function(_0x55189d){if(_0x55189d){return _0xe89eb9['sendStatus'](_0x351a33);}return _0xe89eb9['status'](_0x351a33)[_0xa639('0x26')]();};}function respondWithResult(_0x561b9a,_0x42b5d8){_0x42b5d8=_0x42b5d8||0xc8;return function(_0x3d6e0c){if(_0x3d6e0c){return _0x561b9a[_0xa639('0x27')](_0x42b5d8)[_0xa639('0x28')](_0x3d6e0c);}};}function respondWithFilteredResult(_0x5ded72,_0x314e07){return function(_0x1a0d4e){if(_0x1a0d4e){var _0x16b63a=_0x1a0d4e[_0xa639('0x29')],_0x9187a1=_0x314e07[_0xa639('0x2a')],_0x3a5dcb=_0x314e07[_0xa639('0x2a')]+_0x314e07[_0xa639('0x2b')],_0x398055;if(_0x3a5dcb>=_0x16b63a){_0x3a5dcb=_0x16b63a;_0x398055=0xc8;}else{_0x398055=0xce;}_0x5ded72['status'](_0x398055);return _0x5ded72[_0xa639('0x2c')](_0xa639('0x2d'),_0x9187a1+'-'+_0x3a5dcb+'/'+_0x16b63a)[_0xa639('0x28')](_0x1a0d4e);}return null;};}function patchUpdates(_0x390f30){return function(_0x2f2775){try{jsonpatch['apply'](_0x2f2775,_0x390f30,!![]);}catch(_0xd3b825){return BPromise[_0xa639('0x2e')](_0xd3b825);}return _0x2f2775['save']();};}function saveUpdates(_0x390229,_0x252b62){return function(_0x39abe7){if(_0x39abe7){return _0x39abe7[_0xa639('0x2f')](_0x390229)[_0xa639('0x30')](function(_0x2bb35d){return _0x2bb35d;});}return null;};}function removeEntity(_0x160d88,_0x3eef24){return function(_0x58e826){if(_0x58e826){return _0x58e826[_0xa639('0x31')]()['then'](function(){var _0x455ca7=_0x58e826[_0xa639('0x32')]({'plain':!![]});var _0x487060=_0xa639('0x33');return db['UserProfileResource'][_0xa639('0x31')]({'where':{'type':_0x487060,'resourceId':_0x455ca7['id']}})['then'](function(){return _0x58e826;});})[_0xa639('0x30')](function(){_0x160d88[_0xa639('0x27')](0xcc)[_0xa639('0x26')]();});}};}function handleEntityNotFound(_0x4d7b24,_0x5ef79){return function(_0x2ca1b4){if(!_0x2ca1b4){_0x4d7b24[_0xa639('0x34')](0x194);}return _0x2ca1b4;};}function handleError(_0x2d265f,_0x154e78){_0x154e78=_0x154e78||0x1f4;return function(_0x2c69fa){logger[_0xa639('0x21')](_0x2c69fa[_0xa639('0x35')]);if(_0x2c69fa['name']){delete _0x2c69fa[_0xa639('0x36')];}_0x2d265f['status'](_0x154e78)[_0xa639('0x37')](_0x2c69fa);};}exports[_0xa639('0x38')]=function(_0x4c2828,_0xcf61f8){var _0x41daef={},_0x222e00={},_0x568453={'count':0x0,'rows':[]};var _0x4ce86c=_[_0xa639('0x39')](db[_0xa639('0x3a')]['rawAttributes'],function(_0x52cb0e){return{'name':_0x52cb0e[_0xa639('0x3b')],'type':_0x52cb0e[_0xa639('0x3c')]['key']};});_0x222e00['model']=_['map'](_0x4ce86c,'name');_0x222e00[_0xa639('0x3d')]=_['keys'](_0x4c2828[_0xa639('0x3d')]);_0x222e00[_0xa639('0x3e')]=_[_0xa639('0x3f')](_0x222e00['model'],_0x222e00['query']);_0x41daef[_0xa639('0x40')]=_['intersection'](_0x222e00[_0xa639('0x41')],qs[_0xa639('0x42')](_0x4c2828[_0xa639('0x3d')][_0xa639('0x42')]));_0x41daef[_0xa639('0x40')]=_0x41daef['attributes'][_0xa639('0x43')]?_0x41daef[_0xa639('0x40')]:_0x222e00[_0xa639('0x41')];if(!_0x4c2828[_0xa639('0x3d')][_0xa639('0x44')]('nolimit')){_0x41daef['limit']=qs[_0xa639('0x2b')](_0x4c2828[_0xa639('0x3d')]['limit']);_0x41daef['offset']=qs[_0xa639('0x2a')](_0x4c2828[_0xa639('0x3d')][_0xa639('0x2a')]);}_0x41daef[_0xa639('0x45')]=qs[_0xa639('0x46')](_0x4c2828[_0xa639('0x3d')][_0xa639('0x46')]);_0x41daef[_0xa639('0x47')]=qs[_0xa639('0x3e')](_['pick'](_0x4c2828[_0xa639('0x3d')],_0x222e00[_0xa639('0x3e')]),_0x4ce86c);if(_0x4c2828[_0xa639('0x3d')][_0xa639('0x48')]){_0x41daef[_0xa639('0x47')]=_[_0xa639('0x49')](_0x41daef[_0xa639('0x47')],{'$or':_['map'](_0x4ce86c,function(_0x17865e){if(_0x17865e[_0xa639('0x3c')]!==_0xa639('0x4a')){var _0x51c0ea={};_0x51c0ea[_0x17865e['name']]={'$like':'%'+_0x4c2828['query'][_0xa639('0x48')]+'%'};return _0x51c0ea;}})});}_0x41daef=_['merge']({},_0x41daef,_0x4c2828[_0xa639('0x4b')]);var _0x37074b={'where':_0x41daef[_0xa639('0x47')]};return db[_0xa639('0x3a')][_0xa639('0x29')](_0x37074b)[_0xa639('0x30')](function(_0x1017e7){_0x568453[_0xa639('0x29')]=_0x1017e7;if(_0x4c2828[_0xa639('0x3d')][_0xa639('0x4c')]){_0x41daef[_0xa639('0x4d')]=[{'all':!![]}];}return db[_0xa639('0x3a')]['findAll'](_0x41daef);})[_0xa639('0x30')](function(_0x39966c){_0x568453[_0xa639('0x4e')]=_0x39966c;return _0x568453;})[_0xa639('0x30')](respondWithFilteredResult(_0xcf61f8,_0x41daef))[_0xa639('0x25')](handleError(_0xcf61f8,null));};exports[_0xa639('0x4f')]=function(_0x5b3be2,_0x1532ac){var _0x495643={'raw':![],'where':{'id':_0x5b3be2[_0xa639('0x50')]['id']}},_0x3434be={};_0x3434be['model']=_[_0xa639('0x51')](db['VoiceContext'][_0xa639('0x52')]);_0x3434be[_0xa639('0x3d')]=_[_0xa639('0x51')](_0x5b3be2[_0xa639('0x3d')]);_0x3434be[_0xa639('0x3e')]=_['intersection'](_0x3434be['model'],_0x3434be[_0xa639('0x3d')]);_0x495643['attributes']=_[_0xa639('0x3f')](_0x3434be[_0xa639('0x41')],qs[_0xa639('0x42')](_0x5b3be2['query'][_0xa639('0x42')]));_0x495643[_0xa639('0x40')]=_0x495643[_0xa639('0x40')]['length']?_0x495643[_0xa639('0x40')]:_0x3434be[_0xa639('0x41')];if(_0x5b3be2['query'][_0xa639('0x4c')]){_0x495643[_0xa639('0x4d')]=[{'all':!![]}];}_0x495643=_[_0xa639('0x49')]({},_0x495643,_0x5b3be2[_0xa639('0x4b')]);return db[_0xa639('0x3a')][_0xa639('0x53')](_0x495643)[_0xa639('0x30')](handleEntityNotFound(_0x1532ac,null))[_0xa639('0x30')](respondWithResult(_0x1532ac,null))[_0xa639('0x25')](handleError(_0x1532ac,null));};exports['create']=function(_0x1890d4,_0x300230,_0x188974){var _0x4c5f46;return db[_0xa639('0x3a')][_0xa639('0x54')](_0x1890d4[_0xa639('0x55')],{'raw':!![]})[_0xa639('0x30')](function(_0x533f71){_0x4c5f46=_0x533f71;return db[_0xa639('0x3a')][_0xa639('0x56')]({'raw':!![]});})['then'](function(_0x42eb70){var _0x5468ac=fs[_0xa639('0x57')](path[_0xa639('0x58')](config['root'],'server/files/templates/context.ejs'),_0xa639('0x59'));var _0x787bc9=ejs[_0xa639('0x5a')](_0x5468ac,{'contexts':_0x42eb70||[]});fs['writeFileSync'](_0xa639('0x5b'),_0x787bc9);})[_0xa639('0x30')](function(){return respondWithRpcPromise(_0xa639('0x5c'),_0xa639('0x54'),{'module':'chan_sip.so'});})[_0xa639('0x30')](function(){var _0x2b2c28=_0x1890d4[_0xa639('0x5d')][_0xa639('0x32')]({'plain':!![]});if(!_0x2b2c28)throw new Error(_0xa639('0x5e'));if(_0x2b2c28[_0xa639('0x5f')]==='user'){var _0x582e02=_0x4c5f46['get']({'plain':!![]});return db[_0xa639('0x60')][_0xa639('0x53')]({'where':{'name':'Contexts','userProfileId':_0x2b2c28[_0xa639('0x61')]},'raw':!![]})[_0xa639('0x30')](function(_0x543c64){if(_0x543c64&&_0x543c64[_0xa639('0x62')]===0x0){return db[_0xa639('0x63')][_0xa639('0x54')]({'name':_0x582e02[_0xa639('0x36')],'resourceId':_0x582e02['id'],'type':_0x543c64['name'],'sectionId':_0x543c64['id']},{})['then'](function(){return _0x4c5f46;});}else{return _0x4c5f46;}})['catch'](function(_0x4a8148){logger[_0xa639('0x21')](_0xa639('0x64'),_0x4a8148);throw _0x4a8148;});}return _0x4c5f46;})[_0xa639('0x30')](respondWithResult(_0x300230,0xc9))[_0xa639('0x25')](handleError(_0x300230,null));};exports[_0xa639('0x2f')]=function(_0x33cb0c,_0x39410a,_0x154714){var _0x4bcf3a;return db[_0xa639('0x3a')]['find']({'where':{'id':_0x33cb0c[_0xa639('0x50')]['id']}})['then'](handleEntityNotFound(_0x39410a,null))['then'](saveUpdates(_0x33cb0c[_0xa639('0x55')],null))[_0xa639('0x30')](function(_0x49a2a9){if(_0x49a2a9){_0x4bcf3a=_0x49a2a9;return db[_0xa639('0x3a')][_0xa639('0x56')]({'raw':!![]});}})[_0xa639('0x30')](function(_0x1cc4ab){var _0x1e3a45=fs['readFileSync'](path[_0xa639('0x58')](config[_0xa639('0x65')],_0xa639('0x66')),_0xa639('0x59'));var _0xfb861b=ejs[_0xa639('0x5a')](_0x1e3a45,{'contexts':_0x1cc4ab||[]});fs[_0xa639('0x67')](_0xa639('0x5b'),_0xfb861b);})[_0xa639('0x30')](function(){return respondWithRpcPromise(_0xa639('0x5c'),'update',{'module':_0xa639('0x68')});})[_0xa639('0x30')](function(){return _0x4bcf3a;})['then'](respondWithResult(_0x39410a,null))[_0xa639('0x25')](handleError(_0x39410a,null));};exports['destroy']=function(_0xf9ebb2,_0x331ba9,_0x1649e4){var _0x45723a;return db[_0xa639('0x3a')][_0xa639('0x53')]({'where':{'id':_0xf9ebb2['params']['id']}})['then'](handleEntityNotFound(_0x331ba9,null))['then'](removeEntity(_0x331ba9,null))['then'](function(){return db[_0xa639('0x3a')][_0xa639('0x56')]({'raw':!![]});})[_0xa639('0x30')](function(_0x37b6c8){var _0x696d12=fs[_0xa639('0x57')](path[_0xa639('0x58')](config['root'],_0xa639('0x66')),_0xa639('0x59'));var _0x41a3bb=ejs['render'](_0x696d12,{'contexts':_0x37b6c8});fs[_0xa639('0x67')](_0xa639('0x5b'),_0x41a3bb);return respondWithRpcPromise(_0xa639('0x5c'),_0xa639('0x31'),{'module':_0xa639('0x68')});})[_0xa639('0x25')](handleError(_0x331ba9,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 337e8af..6327776 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 _0x66d2=['VoiceContext','voice_contexts','lodash','util','../../config/logger','moment','../../config/environment','exports','define'];(function(_0x595604,_0x2cc998){var _0x1466f3=function(_0x4e1d9b){while(--_0x4e1d9b){_0x595604['push'](_0x595604['shift']());}};_0x1466f3(++_0x2cc998);}(_0x66d2,0x107));var _0x266d=function(_0x2471df,_0x1d255f){_0x2471df=_0x2471df-0x0;var _0x58af9a=_0x66d2[_0x2471df];return _0x58af9a;};'use strict';var _=require(_0x266d('0x0'));var util=require(_0x266d('0x1'));var logger=require(_0x266d('0x2'))('api');var moment=require(_0x266d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x266d('0x4'));var attributes=require('./voiceContext.attributes');module[_0x266d('0x5')]=function(_0x424c36,_0x17856a){return _0x424c36[_0x266d('0x6')](_0x266d('0x7'),attributes,{'tableName':_0x266d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa01=['moment','bluebird','path','rimraf','../../config/environment','exports','VoiceContext','voice_contexts','lodash','../../config/logger'];(function(_0x593c64,_0x20c8f0){var _0x3abfd5=function(_0x4aab4a){while(--_0x4aab4a){_0x593c64['push'](_0x593c64['shift']());}};_0x3abfd5(++_0x20c8f0);}(_0xfa01,0x9e));var _0x1fa0=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xfa01[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x1fa0('0x0'));var util=require('util');var logger=require(_0x1fa0('0x1'))('api');var moment=require(_0x1fa0('0x2'));var BPromise=require(_0x1fa0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fa0('0x4'));var rimraf=require(_0x1fa0('0x5'));var config=require(_0x1fa0('0x6'));var attributes=require('./voiceContext.attributes');module[_0x1fa0('0x7')]=function(_0x1b50b6,_0x56ed3e){return _0x1b50b6['define'](_0x1fa0('0x8'),attributes,{'tableName':_0x1fa0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 0bea649..f169b0c 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 _0x88b5=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch'];(function(_0x30d04c,_0x5bd2a7){var _0x131ae7=function(_0x39c739){while(--_0x39c739){_0x30d04c['push'](_0x30d04c['shift']());}};_0x131ae7(++_0x5bd2a7);}(_0x88b5,0x17a));var _0x588b=function(_0x5c886a,_0x4e7410){_0x5c886a=_0x5c886a-0x0;var _0x12c5eb=_0x88b5[_0x5c886a];return _0x12c5eb;};'use strict';var _=require(_0x588b('0x0'));var util=require('util');var moment=require(_0x588b('0x1'));var BPromise=require(_0x588b('0x2'));var rs=require(_0x588b('0x3'));var fs=require('fs');var Redis=require(_0x588b('0x4'));var db=require(_0x588b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x588b('0x6'))('rpc');var config=require(_0x588b('0x7'));var jayson=require(_0x588b('0x8'));var client=jayson[_0x588b('0x9')][_0x588b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x534125,_0x173ba,_0x437497){return new BPromise(function(_0x5457b6,_0x57e352){return client[_0x588b('0xb')](_0x534125,_0x437497)['then'](function(_0x24fe7b){logger[_0x588b('0xc')](_0x588b('0xd'),_0x173ba,_0x588b('0xe'));logger[_0x588b('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x173ba,'request\x20sent',JSON[_0x588b('0x10')](_0x24fe7b));if(_0x24fe7b[_0x588b('0x11')]){if(_0x24fe7b['error'][_0x588b('0x12')]===0x1f4){logger['error'](_0x588b('0xd'),_0x173ba,_0x24fe7b[_0x588b('0x11')]['message']);return _0x57e352(_0x24fe7b['error']['message']);}logger[_0x588b('0x11')](_0x588b('0xd'),_0x173ba,_0x24fe7b['error'][_0x588b('0x13')]);return _0x5457b6(_0x24fe7b[_0x588b('0x11')][_0x588b('0x13')]);}else{logger[_0x588b('0xc')](_0x588b('0xd'),_0x173ba,_0x588b('0xe'));_0x5457b6(_0x24fe7b['result'][_0x588b('0x13')]);}})[_0x588b('0x14')](function(_0x1cd47a){logger[_0x588b('0x11')](_0x588b('0xd'),_0x173ba,_0x1cd47a);_0x57e352(_0x1cd47a);});});} \ No newline at end of file +var _0x2cfb=['client','http','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x282f9a,_0x63dff){var _0x52528c=function(_0xcf1c4c){while(--_0xcf1c4c){_0x282f9a['push'](_0x282f9a['shift']());}};_0x52528c(++_0x63dff);}(_0x2cfb,0x1df));var _0xb2cf=function(_0x117007,_0x4d3414){_0x117007=_0x117007-0x0;var _0x2e5522=_0x2cfb[_0x117007];return _0x2e5522;};'use strict';var _=require('lodash');var util=require(_0xb2cf('0x0'));var moment=require(_0xb2cf('0x1'));var BPromise=require(_0xb2cf('0x2'));var rs=require(_0xb2cf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2cf('0x4'))['db'];var utils=require(_0xb2cf('0x5'));var logger=require(_0xb2cf('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb2cf('0x7')][_0xb2cf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5cfb10,_0x45a478,_0x472d71){return new BPromise(function(_0x281e9d,_0x399726){return client['request'](_0x5cfb10,_0x472d71)['then'](function(_0x56824f){logger[_0xb2cf('0x9')](_0xb2cf('0xa'),_0x45a478,_0xb2cf('0xb'));logger[_0xb2cf('0xc')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x45a478,_0xb2cf('0xb'),JSON[_0xb2cf('0xd')](_0x56824f));if(_0x56824f[_0xb2cf('0xe')]){if(_0x56824f[_0xb2cf('0xe')][_0xb2cf('0xf')]===0x1f4){logger['error'](_0xb2cf('0xa'),_0x45a478,_0x56824f['error'][_0xb2cf('0x10')]);return _0x399726(_0x56824f[_0xb2cf('0xe')][_0xb2cf('0x10')]);}logger[_0xb2cf('0xe')](_0xb2cf('0xa'),_0x45a478,_0x56824f['error'][_0xb2cf('0x10')]);return _0x281e9d(_0x56824f['error'][_0xb2cf('0x10')]);}else{logger[_0xb2cf('0x9')]('VoiceContext,\x20%s,\x20%s',_0x45a478,_0xb2cf('0xb'));_0x281e9d(_0x56824f['result']['message']);}})[_0xb2cf('0x11')](function(_0xfb057c){logger[_0xb2cf('0xe')](_0xb2cf('0xa'),_0x45a478,_0xfb057c);_0x399726(_0xfb057c);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index f9a5b3d..75aaa4c 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 _0x87f4=['exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','/describe','describe','get','show','create','put','/:id','update','delete','destroy'];(function(_0x5ca705,_0x1d603d){var _0x34658b=function(_0x10c49f){while(--_0x10c49f){_0x5ca705['push'](_0x5ca705['shift']());}};_0x34658b(++_0x1d603d);}(_0x87f4,0x1a5));var _0x487f=function(_0x19df8e,_0xc8482){_0x19df8e=_0x19df8e-0x0;var _0x378598=_0x87f4[_0x19df8e];return _0x378598;};'use strict';var multer=require(_0x487f('0x0'));var util=require('util');var path=require(_0x487f('0x1'));var timeout=require('connect-timeout');var express=require(_0x487f('0x2'));var router=express[_0x487f('0x3')]();var auth=require(_0x487f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x487f('0x5'));var controller=require(_0x487f('0x6'));router['get']('/',auth[_0x487f('0x7')](),controller[_0x487f('0x8')]);router['get'](_0x487f('0x9'),auth[_0x487f('0x7')](),controller[_0x487f('0xa')]);router[_0x487f('0xb')]('/:id',auth[_0x487f('0x7')](),controller[_0x487f('0xc')]);router['post']('/',auth[_0x487f('0x7')](),controller[_0x487f('0xd')]);router[_0x487f('0xe')](_0x487f('0xf'),auth[_0x487f('0x7')](),controller[_0x487f('0x10')]);router[_0x487f('0x11')](_0x487f('0xf'),auth[_0x487f('0x7')](),controller[_0x487f('0x12')]);module[_0x487f('0x13')]=router; \ No newline at end of file +var _0xbc9e=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','show','post','put','/:id','update','destroy','util','path','connect-timeout','express','Router'];(function(_0x203420,_0x239427){var _0x333a76=function(_0x1f8ad3){while(--_0x1f8ad3){_0x203420['push'](_0x203420['shift']());}};_0x333a76(++_0x239427);}(_0xbc9e,0xc1));var _0xebc9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xbc9e[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require(_0xebc9('0x0'));var path=require(_0xebc9('0x1'));var timeout=require(_0xebc9('0x2'));var express=require(_0xebc9('0x3'));var router=express[_0xebc9('0x4')]();var auth=require(_0xebc9('0x5'));var interaction=require(_0xebc9('0x6'));var config=require(_0xebc9('0x7'));var controller=require('./voiceDialReport.controller');router['get']('/',auth[_0xebc9('0x8')](),controller[_0xebc9('0x9')]);router[_0xebc9('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xebc9('0xb')]);router['get']('/:id',auth[_0xebc9('0x8')](),controller[_0xebc9('0xc')]);router[_0xebc9('0xd')]('/',auth[_0xebc9('0x8')](),controller['create']);router[_0xebc9('0xe')](_0xebc9('0xf'),auth[_0xebc9('0x8')](),controller[_0xebc9('0x10')]);router['delete'](_0xebc9('0xf'),auth[_0xebc9('0x8')](),controller[_0xebc9('0x11')]);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 b8f5094..4fc4b24 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 _0xabce=['DATE','called,connect,complete','sequelize','exports','STRING','INTEGER'];(function(_0x47ce6c,_0x5d347a){var _0x20bf52=function(_0x259c3b){while(--_0x259c3b){_0x47ce6c['push'](_0x47ce6c['shift']());}};_0x20bf52(++_0x5d347a);}(_0xabce,0x68));var _0xeabc=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xabce[_0x3899d1];return _0xeb4a7d;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'privilege':{'type':Sequelize[_0xeabc('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xeabc('0x3')]},'channelstatedesc':{'type':Sequelize[_0xeabc('0x2')]},'calleridnum':{'type':Sequelize[_0xeabc('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xeabc('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xeabc('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xeabc('0x2')]},'exten':{'type':Sequelize[_0xeabc('0x2')]},'priority':{'type':Sequelize[_0xeabc('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xeabc('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xeabc('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xeabc('0x2')]},'destcalleridnum':{'type':Sequelize[_0xeabc('0x2')]},'destcalleridname':{'type':Sequelize[_0xeabc('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xeabc('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xeabc('0x2')]},'destlanguage':{'type':Sequelize[_0xeabc('0x2')]},'destaccountcode':{'type':Sequelize[_0xeabc('0x2')]},'destcontext':{'type':Sequelize[_0xeabc('0x2')]},'destexten':{'type':Sequelize[_0xeabc('0x2')]},'destpriority':{'type':Sequelize[_0xeabc('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0xeabc('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xeabc('0x4')]},'answertime':{'type':Sequelize[_0xeabc('0x4')]},'endtime':{'type':Sequelize[_0xeabc('0x4')]},'lastevent':{'type':Sequelize[_0xeabc('0x2')],'comment':_0xeabc('0x5')},'routeId':{'type':Sequelize[_0xeabc('0x3')]},'duration':{'type':Sequelize[_0xeabc('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x5759=['DATE','called,connect,complete','sequelize','exports','STRING','INTEGER'];(function(_0x211087,_0x354fdd){var _0x2a581f=function(_0x2928fe){while(--_0x2928fe){_0x211087['push'](_0x211087['shift']());}};_0x2a581f(++_0x354fdd);}(_0x5759,0x1ca));var _0x9575=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x5759[_0x5037ab];return _0x512adb;};'use strict';var Sequelize=require(_0x9575('0x0'));module[_0x9575('0x1')]={'privilege':{'type':Sequelize[_0x9575('0x2')]},'channel':{'type':Sequelize[_0x9575('0x2')]},'channelstate':{'type':Sequelize[_0x9575('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x9575('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x9575('0x2')]},'connectedlinename':{'type':Sequelize[_0x9575('0x2')]},'language':{'type':Sequelize[_0x9575('0x2')]},'accountcode':{'type':Sequelize[_0x9575('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x9575('0x2')]},'priority':{'type':Sequelize[_0x9575('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x9575('0x2')]},'destchannel':{'type':Sequelize[_0x9575('0x2')]},'destchannelstate':{'type':Sequelize[_0x9575('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x9575('0x2')]},'destcalleridnum':{'type':Sequelize[_0x9575('0x2')]},'destcalleridname':{'type':Sequelize[_0x9575('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x9575('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x9575('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x9575('0x2')]},'destexten':{'type':Sequelize[_0x9575('0x2')]},'destpriority':{'type':Sequelize[_0x9575('0x3')]},'destuniqueid':{'type':Sequelize[_0x9575('0x2')]},'destlinkedid':{'type':Sequelize[_0x9575('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x9575('0x2')]},'starttime':{'type':Sequelize[_0x9575('0x4')]},'answertime':{'type':Sequelize[_0x9575('0x4')]},'endtime':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x9575('0x2')],'comment':_0x9575('0x5')},'routeId':{'type':Sequelize[_0x9575('0x3')]},'duration':{'type':Sequelize[_0x9575('0x3')]},'holdtime':{'type':Sequelize[_0x9575('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 1f99e12..59dc090 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 _0x3c70=['VoiceDialReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','type','VIRTUAL','then','include','findAll','show','params','options','find','catch','create','update','body','html-pdf','eml-format','rimraf','request-promise','util','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','save','destroy','sendStatus','error','stack','name','send','index','map'];(function(_0x2ab857,_0x31e9b6){var _0x46270e=function(_0x122978){while(--_0x122978){_0x2ab857['push'](_0x2ab857['shift']());}};_0x46270e(++_0x31e9b6);}(_0x3c70,0xf0));var _0x03c7=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x3c70[_0x376b45];return _0x2341b3;};'use strict';var pdf=require(_0x03c7('0x0'));var emlformat=require(_0x03c7('0x1'));var rimraf=require(_0x03c7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x03c7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x03c7('0x4'));var path=require('path');var sox=require(_0x03c7('0x5'));var csv=require(_0x03c7('0x6'));var ejs=require(_0x03c7('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x03c7('0x8'));var crypto=require('crypto');var jsforce=require(_0x03c7('0x9'));var deskjs=require(_0x03c7('0xa'));var toCsv=require(_0x03c7('0x6'));var querystring=require(_0x03c7('0xb'));var Papa=require(_0x03c7('0xc'));var Redis=require('ioredis');var authService=require(_0x03c7('0xd'));var qs=require(_0x03c7('0xe'));var as=require(_0x03c7('0xf'));var hardwareService=require(_0x03c7('0x10'));var logger=require(_0x03c7('0x11'))('api');var utils=require(_0x03c7('0x12'));var config=require(_0x03c7('0x13'));var licenseUtil=require(_0x03c7('0x14'));var db=require(_0x03c7('0x15'))['db'];function respondWithStatusCode(_0xd1fbd8,_0x335d15){_0x335d15=_0x335d15||0xcc;return function(_0x370337){if(_0x370337){return _0xd1fbd8['sendStatus'](_0x335d15);}return _0xd1fbd8[_0x03c7('0x16')](_0x335d15)[_0x03c7('0x17')]();};}function respondWithResult(_0x4ccd0d,_0x57aefa){_0x57aefa=_0x57aefa||0xc8;return function(_0x3ccea4){if(_0x3ccea4){return _0x4ccd0d[_0x03c7('0x16')](_0x57aefa)['json'](_0x3ccea4);}};}function respondWithFilteredResult(_0x5646e1,_0x4db03a){return function(_0x1d6325){if(_0x1d6325){var _0x1ba2d4=_0x1d6325[_0x03c7('0x18')],_0x30e3cb=_0x4db03a[_0x03c7('0x19')],_0x453261=_0x4db03a[_0x03c7('0x19')]+_0x4db03a[_0x03c7('0x1a')],_0x575512;if(_0x453261>=_0x1ba2d4){_0x453261=_0x1ba2d4;_0x575512=0xc8;}else{_0x575512=0xce;}_0x5646e1[_0x03c7('0x16')](_0x575512);return _0x5646e1[_0x03c7('0x1b')](_0x03c7('0x1c'),_0x30e3cb+'-'+_0x453261+'/'+_0x1ba2d4)[_0x03c7('0x1d')](_0x1d6325);}return null;};}function patchUpdates(_0xd4fa66){return function(_0xf090f2){try{jsonpatch[_0x03c7('0x1e')](_0xf090f2,_0xd4fa66,!![]);}catch(_0x310709){return BPromise['reject'](_0x310709);}return _0xf090f2[_0x03c7('0x1f')]();};}function saveUpdates(_0xedbbcd,_0x30b855){return function(_0xe85bdc){if(_0xe85bdc){return _0xe85bdc['update'](_0xedbbcd)['then'](function(_0x3670a0){return _0x3670a0;});}return null;};}function removeEntity(_0x4a1de5,_0xa4a14d){return function(_0x41d7f2){if(_0x41d7f2){return _0x41d7f2[_0x03c7('0x20')]()['then'](function(){_0x4a1de5['status'](0xcc)[_0x03c7('0x17')]();});}};}function handleEntityNotFound(_0x538db2,_0xf4696c){return function(_0x1285a1){if(!_0x1285a1){_0x538db2[_0x03c7('0x21')](0x194);}return _0x1285a1;};}function handleError(_0x4601d1,_0x1db4f1){_0x1db4f1=_0x1db4f1||0x1f4;return function(_0x72b267){logger[_0x03c7('0x22')](_0x72b267[_0x03c7('0x23')]);if(_0x72b267['name']){delete _0x72b267[_0x03c7('0x24')];}_0x4601d1[_0x03c7('0x16')](_0x1db4f1)[_0x03c7('0x25')](_0x72b267);};}exports[_0x03c7('0x26')]=function(_0x3dd313,_0x282ea9){var _0x311c3a={},_0x280155={},_0x5b187c={'count':0x0,'rows':[]};var _0xff70b4=_[_0x03c7('0x27')](db[_0x03c7('0x28')][_0x03c7('0x29')],function(_0x476fe7){return{'name':_0x476fe7[_0x03c7('0x2a')],'type':_0x476fe7['type'][_0x03c7('0x2b')]};});_0x280155[_0x03c7('0x2c')]=_['map'](_0xff70b4,'name');_0x280155[_0x03c7('0x2d')]=_[_0x03c7('0x2e')](_0x3dd313[_0x03c7('0x2d')]);_0x280155[_0x03c7('0x2f')]=_[_0x03c7('0x30')](_0x280155[_0x03c7('0x2c')],_0x280155['query']);_0x311c3a[_0x03c7('0x31')]=_[_0x03c7('0x30')](_0x280155[_0x03c7('0x2c')],qs['fields'](_0x3dd313[_0x03c7('0x2d')][_0x03c7('0x32')]));_0x311c3a['attributes']=_0x311c3a[_0x03c7('0x31')][_0x03c7('0x33')]?_0x311c3a[_0x03c7('0x31')]:_0x280155[_0x03c7('0x2c')];if(!_0x3dd313[_0x03c7('0x2d')]['hasOwnProperty']('nolimit')){_0x311c3a['limit']=qs[_0x03c7('0x1a')](_0x3dd313['query'][_0x03c7('0x1a')]);_0x311c3a['offset']=qs[_0x03c7('0x19')](_0x3dd313[_0x03c7('0x2d')][_0x03c7('0x19')]);}_0x311c3a['order']=qs[_0x03c7('0x34')](_0x3dd313[_0x03c7('0x2d')][_0x03c7('0x34')]);_0x311c3a[_0x03c7('0x35')]=qs[_0x03c7('0x2f')](_[_0x03c7('0x36')](_0x3dd313[_0x03c7('0x2d')],_0x280155['filters']),_0xff70b4);if(_0x3dd313[_0x03c7('0x2d')][_0x03c7('0x37')]){_0x311c3a[_0x03c7('0x35')]=_[_0x03c7('0x38')](_0x311c3a[_0x03c7('0x35')],{'$or':_[_0x03c7('0x27')](_0xff70b4,function(_0x176168){if(_0x176168[_0x03c7('0x39')]!==_0x03c7('0x3a')){var _0x478f80={};_0x478f80[_0x176168[_0x03c7('0x24')]]={'$like':'%'+_0x3dd313['query'][_0x03c7('0x37')]+'%'};return _0x478f80;}})});}_0x311c3a=_[_0x03c7('0x38')]({},_0x311c3a,_0x3dd313['options']);var _0x509b2a={'where':_0x311c3a['where']};return db[_0x03c7('0x28')][_0x03c7('0x18')](_0x509b2a)[_0x03c7('0x3b')](function(_0x1000ab){_0x5b187c[_0x03c7('0x18')]=_0x1000ab;if(_0x3dd313[_0x03c7('0x2d')]['includeAll']){_0x311c3a[_0x03c7('0x3c')]=[{'all':!![]}];}return db[_0x03c7('0x28')][_0x03c7('0x3d')](_0x311c3a);})[_0x03c7('0x3b')](function(_0x51f8b4){_0x5b187c['rows']=_0x51f8b4;return _0x5b187c;})[_0x03c7('0x3b')](respondWithFilteredResult(_0x282ea9,_0x311c3a))['catch'](handleError(_0x282ea9,null));};exports[_0x03c7('0x3e')]=function(_0x511ac3,_0x571f52){var _0x4b4903={'raw':!![],'where':{'id':_0x511ac3[_0x03c7('0x3f')]['id']}},_0x5f02f4={};_0x5f02f4[_0x03c7('0x2c')]=_[_0x03c7('0x2e')](db[_0x03c7('0x28')][_0x03c7('0x29')]);_0x5f02f4[_0x03c7('0x2d')]=_[_0x03c7('0x2e')](_0x511ac3[_0x03c7('0x2d')]);_0x5f02f4[_0x03c7('0x2f')]=_[_0x03c7('0x30')](_0x5f02f4[_0x03c7('0x2c')],_0x5f02f4[_0x03c7('0x2d')]);_0x4b4903['attributes']=_[_0x03c7('0x30')](_0x5f02f4[_0x03c7('0x2c')],qs[_0x03c7('0x32')](_0x511ac3[_0x03c7('0x2d')]['fields']));_0x4b4903[_0x03c7('0x31')]=_0x4b4903[_0x03c7('0x31')][_0x03c7('0x33')]?_0x4b4903[_0x03c7('0x31')]:_0x5f02f4[_0x03c7('0x2c')];if(_0x511ac3[_0x03c7('0x2d')]['includeAll']){_0x4b4903[_0x03c7('0x3c')]=[{'all':!![]}];}_0x4b4903=_[_0x03c7('0x38')]({},_0x4b4903,_0x511ac3[_0x03c7('0x40')]);return db[_0x03c7('0x28')][_0x03c7('0x41')](_0x4b4903)['then'](handleEntityNotFound(_0x571f52,null))[_0x03c7('0x3b')](respondWithResult(_0x571f52,null))[_0x03c7('0x42')](handleError(_0x571f52,null));};exports[_0x03c7('0x43')]=function(_0x187bae,_0x5810f0){return db[_0x03c7('0x28')][_0x03c7('0x43')](_0x187bae['body'],{})[_0x03c7('0x3b')](respondWithResult(_0x5810f0,0xc9))[_0x03c7('0x42')](handleError(_0x5810f0,null));};exports[_0x03c7('0x44')]=function(_0x44c976,_0x50ea0b){if(_0x44c976[_0x03c7('0x45')]['id']){delete _0x44c976['body']['id'];}return db[_0x03c7('0x28')][_0x03c7('0x41')]({'where':{'id':_0x44c976['params']['id']}})[_0x03c7('0x3b')](handleEntityNotFound(_0x50ea0b,null))[_0x03c7('0x3b')](saveUpdates(_0x44c976[_0x03c7('0x45')],null))[_0x03c7('0x3b')](respondWithResult(_0x50ea0b,null))['catch'](handleError(_0x50ea0b,null));};exports[_0x03c7('0x20')]=function(_0x2f6922,_0x1bb89d){return db[_0x03c7('0x28')][_0x03c7('0x41')]({'where':{'id':_0x2f6922[_0x03c7('0x3f')]['id']}})[_0x03c7('0x3b')](handleEntityNotFound(_0x1bb89d,null))[_0x03c7('0x3b')](removeEntity(_0x1bb89d,null))['catch'](handleError(_0x1bb89d,null));};exports['describe']=function(_0x453d88,_0x2f503b){return db[_0x03c7('0x28')]['describe']()[_0x03c7('0x3b')](respondWithResult(_0x2f503b,null))['catch'](handleError(_0x2f503b,null));}; \ No newline at end of file +var _0xc59b=['create','body','describe','html-pdf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','VoiceDialReport','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','rawAttributes','include','find'];(function(_0x1168a1,_0xa0d8c9){var _0xcc5ad8=function(_0x217dc3){while(--_0x217dc3){_0x1168a1['push'](_0x1168a1['shift']());}};_0xcc5ad8(++_0xa0d8c9);}(_0xc59b,0x1c5));var _0xbc59=function(_0x1eeb25,_0x4cb478){_0x1eeb25=_0x1eeb25-0x0;var _0x19a303=_0xc59b[_0x1eeb25];return _0x19a303;};'use strict';var pdf=require(_0xbc59('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbc59('0x1'));var jsonpatch=require(_0xbc59('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbc59('0x3'));var Mustache=require(_0xbc59('0x4'));var util=require(_0xbc59('0x5'));var path=require(_0xbc59('0x6'));var sox=require('sox');var csv=require(_0xbc59('0x7'));var ejs=require(_0xbc59('0x8'));var fs=require('fs');var _=require(_0xbc59('0x9'));var squel=require(_0xbc59('0xa'));var crypto=require(_0xbc59('0xb'));var jsforce=require(_0xbc59('0xc'));var deskjs=require(_0xbc59('0xd'));var toCsv=require(_0xbc59('0x7'));var querystring=require(_0xbc59('0xe'));var Papa=require(_0xbc59('0xf'));var Redis=require(_0xbc59('0x10'));var authService=require(_0xbc59('0x11'));var qs=require(_0xbc59('0x12'));var as=require(_0xbc59('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc59('0x14'))(_0xbc59('0x15'));var utils=require(_0xbc59('0x16'));var config=require(_0xbc59('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xbc59('0x18'))['db'];function respondWithStatusCode(_0x20c637,_0x232cd2){_0x232cd2=_0x232cd2||0xcc;return function(_0x37998a){if(_0x37998a){return _0x20c637[_0xbc59('0x19')](_0x232cd2);}return _0x20c637[_0xbc59('0x1a')](_0x232cd2)[_0xbc59('0x1b')]();};}function respondWithResult(_0x4faa68,_0x19c969){_0x19c969=_0x19c969||0xc8;return function(_0x325a34){if(_0x325a34){return _0x4faa68[_0xbc59('0x1a')](_0x19c969)[_0xbc59('0x1c')](_0x325a34);}};}function respondWithFilteredResult(_0x124a41,_0x42dce9){return function(_0x18d65e){if(_0x18d65e){var _0xbbe022=_0x18d65e[_0xbc59('0x1d')],_0x5cff39=_0x42dce9['offset'],_0x45eaa2=_0x42dce9['offset']+_0x42dce9[_0xbc59('0x1e')],_0x4287f3;if(_0x45eaa2>=_0xbbe022){_0x45eaa2=_0xbbe022;_0x4287f3=0xc8;}else{_0x4287f3=0xce;}_0x124a41[_0xbc59('0x1a')](_0x4287f3);return _0x124a41[_0xbc59('0x1f')](_0xbc59('0x20'),_0x5cff39+'-'+_0x45eaa2+'/'+_0xbbe022)[_0xbc59('0x1c')](_0x18d65e);}return null;};}function patchUpdates(_0xb0a540){return function(_0x4550dd){try{jsonpatch[_0xbc59('0x21')](_0x4550dd,_0xb0a540,!![]);}catch(_0x4863da){return BPromise[_0xbc59('0x22')](_0x4863da);}return _0x4550dd[_0xbc59('0x23')]();};}function saveUpdates(_0xbc31bc,_0x4add82){return function(_0x1659bc){if(_0x1659bc){return _0x1659bc[_0xbc59('0x24')](_0xbc31bc)[_0xbc59('0x25')](function(_0x11dbbe){return _0x11dbbe;});}return null;};}function removeEntity(_0x55571a,_0x1d47bb){return function(_0x394c03){if(_0x394c03){return _0x394c03[_0xbc59('0x26')]()[_0xbc59('0x25')](function(){_0x55571a[_0xbc59('0x1a')](0xcc)[_0xbc59('0x1b')]();});}};}function handleEntityNotFound(_0x528a6f,_0x944249){return function(_0x5c6813){if(!_0x5c6813){_0x528a6f['sendStatus'](0x194);}return _0x5c6813;};}function handleError(_0xc04b1c,_0x1e5359){_0x1e5359=_0x1e5359||0x1f4;return function(_0x349eaa){logger[_0xbc59('0x27')](_0x349eaa[_0xbc59('0x28')]);if(_0x349eaa['name']){delete _0x349eaa['name'];}_0xc04b1c[_0xbc59('0x1a')](_0x1e5359)[_0xbc59('0x29')](_0x349eaa);};}exports[_0xbc59('0x2a')]=function(_0x1ab69c,_0x50cc15){var _0x33c5ef={},_0x4aa907={},_0xbe4826={'count':0x0,'rows':[]};var _0x2a97f6=_[_0xbc59('0x2b')](db[_0xbc59('0x2c')]['rawAttributes'],function(_0x2eac46){return{'name':_0x2eac46['fieldName'],'type':_0x2eac46[_0xbc59('0x2d')]['key']};});_0x4aa907[_0xbc59('0x2e')]=_['map'](_0x2a97f6,'name');_0x4aa907[_0xbc59('0x2f')]=_[_0xbc59('0x30')](_0x1ab69c[_0xbc59('0x2f')]);_0x4aa907[_0xbc59('0x31')]=_[_0xbc59('0x32')](_0x4aa907[_0xbc59('0x2e')],_0x4aa907[_0xbc59('0x2f')]);_0x33c5ef[_0xbc59('0x33')]=_[_0xbc59('0x32')](_0x4aa907[_0xbc59('0x2e')],qs[_0xbc59('0x34')](_0x1ab69c[_0xbc59('0x2f')]['fields']));_0x33c5ef[_0xbc59('0x33')]=_0x33c5ef[_0xbc59('0x33')][_0xbc59('0x35')]?_0x33c5ef[_0xbc59('0x33')]:_0x4aa907[_0xbc59('0x2e')];if(!_0x1ab69c[_0xbc59('0x2f')][_0xbc59('0x36')](_0xbc59('0x37'))){_0x33c5ef[_0xbc59('0x1e')]=qs[_0xbc59('0x1e')](_0x1ab69c[_0xbc59('0x2f')][_0xbc59('0x1e')]);_0x33c5ef[_0xbc59('0x38')]=qs[_0xbc59('0x38')](_0x1ab69c[_0xbc59('0x2f')]['offset']);}_0x33c5ef[_0xbc59('0x39')]=qs[_0xbc59('0x3a')](_0x1ab69c[_0xbc59('0x2f')][_0xbc59('0x3a')]);_0x33c5ef[_0xbc59('0x3b')]=qs[_0xbc59('0x31')](_['pick'](_0x1ab69c[_0xbc59('0x2f')],_0x4aa907[_0xbc59('0x31')]),_0x2a97f6);if(_0x1ab69c[_0xbc59('0x2f')][_0xbc59('0x3c')]){_0x33c5ef[_0xbc59('0x3b')]=_[_0xbc59('0x3d')](_0x33c5ef[_0xbc59('0x3b')],{'$or':_[_0xbc59('0x2b')](_0x2a97f6,function(_0x2116cb){if(_0x2116cb['type']!==_0xbc59('0x3e')){var _0x1c4982={};_0x1c4982[_0x2116cb['name']]={'$like':'%'+_0x1ab69c[_0xbc59('0x2f')][_0xbc59('0x3c')]+'%'};return _0x1c4982;}})});}_0x33c5ef=_['merge']({},_0x33c5ef,_0x1ab69c[_0xbc59('0x3f')]);var _0x506f14={'where':_0x33c5ef[_0xbc59('0x3b')]};return db[_0xbc59('0x2c')][_0xbc59('0x1d')](_0x506f14)[_0xbc59('0x25')](function(_0x32563c){_0xbe4826[_0xbc59('0x1d')]=_0x32563c;if(_0x1ab69c[_0xbc59('0x2f')][_0xbc59('0x40')]){_0x33c5ef['include']=[{'all':!![]}];}return db[_0xbc59('0x2c')][_0xbc59('0x41')](_0x33c5ef);})['then'](function(_0x3f9f64){_0xbe4826[_0xbc59('0x42')]=_0x3f9f64;return _0xbe4826;})[_0xbc59('0x25')](respondWithFilteredResult(_0x50cc15,_0x33c5ef))[_0xbc59('0x43')](handleError(_0x50cc15,null));};exports['show']=function(_0x42aa7c,_0x300601){var _0x1e4669={'raw':!![],'where':{'id':_0x42aa7c[_0xbc59('0x44')]['id']}},_0x2a4b75={};_0x2a4b75[_0xbc59('0x2e')]=_['keys'](db['VoiceDialReport'][_0xbc59('0x45')]);_0x2a4b75['query']=_[_0xbc59('0x30')](_0x42aa7c['query']);_0x2a4b75['filters']=_['intersection'](_0x2a4b75[_0xbc59('0x2e')],_0x2a4b75[_0xbc59('0x2f')]);_0x1e4669[_0xbc59('0x33')]=_[_0xbc59('0x32')](_0x2a4b75[_0xbc59('0x2e')],qs['fields'](_0x42aa7c[_0xbc59('0x2f')][_0xbc59('0x34')]));_0x1e4669[_0xbc59('0x33')]=_0x1e4669[_0xbc59('0x33')][_0xbc59('0x35')]?_0x1e4669[_0xbc59('0x33')]:_0x2a4b75[_0xbc59('0x2e')];if(_0x42aa7c[_0xbc59('0x2f')]['includeAll']){_0x1e4669[_0xbc59('0x46')]=[{'all':!![]}];}_0x1e4669=_[_0xbc59('0x3d')]({},_0x1e4669,_0x42aa7c[_0xbc59('0x3f')]);return db[_0xbc59('0x2c')][_0xbc59('0x47')](_0x1e4669)[_0xbc59('0x25')](handleEntityNotFound(_0x300601,null))['then'](respondWithResult(_0x300601,null))['catch'](handleError(_0x300601,null));};exports['create']=function(_0x4344fb,_0x4a6f51){return db['VoiceDialReport'][_0xbc59('0x48')](_0x4344fb['body'],{})[_0xbc59('0x25')](respondWithResult(_0x4a6f51,0xc9))[_0xbc59('0x43')](handleError(_0x4a6f51,null));};exports['update']=function(_0x1be3cb,_0x2fcc94){if(_0x1be3cb[_0xbc59('0x49')]['id']){delete _0x1be3cb[_0xbc59('0x49')]['id'];}return db[_0xbc59('0x2c')][_0xbc59('0x47')]({'where':{'id':_0x1be3cb[_0xbc59('0x44')]['id']}})[_0xbc59('0x25')](handleEntityNotFound(_0x2fcc94,null))[_0xbc59('0x25')](saveUpdates(_0x1be3cb[_0xbc59('0x49')],null))[_0xbc59('0x25')](respondWithResult(_0x2fcc94,null))[_0xbc59('0x43')](handleError(_0x2fcc94,null));};exports[_0xbc59('0x26')]=function(_0x14c863,_0x47a349){return db[_0xbc59('0x2c')][_0xbc59('0x47')]({'where':{'id':_0x14c863[_0xbc59('0x44')]['id']}})['then'](handleEntityNotFound(_0x47a349,null))[_0xbc59('0x25')](removeEntity(_0x47a349,null))[_0xbc59('0x43')](handleError(_0x47a349,null));};exports[_0xbc59('0x4a')]=function(_0x1b4bfb,_0x584da3){return db[_0xbc59('0x2c')]['describe']()[_0xbc59('0x25')](respondWithResult(_0x584da3,null))[_0xbc59('0x43')](handleError(_0x584da3,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 36660f8..b4fcfd6 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 _0x3cc9=['moment','bluebird','path','rimraf','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api'];(function(_0x5dc5a3,_0x379165){var _0x2e8b59=function(_0x144508){while(--_0x144508){_0x5dc5a3['push'](_0x5dc5a3['shift']());}};_0x2e8b59(++_0x379165);}(_0x3cc9,0x96));var _0x93cc=function(_0x46dc9e,_0xa1ef5e){_0x46dc9e=_0x46dc9e-0x0;var _0x45fff5=_0x3cc9[_0x46dc9e];return _0x45fff5;};'use strict';var _=require(_0x93cc('0x0'));var util=require(_0x93cc('0x1'));var logger=require(_0x93cc('0x2'))(_0x93cc('0x3'));var moment=require(_0x93cc('0x4'));var BPromise=require(_0x93cc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x93cc('0x6'));var rimraf=require(_0x93cc('0x7'));var config=require(_0x93cc('0x8'));var attributes=require(_0x93cc('0x9'));module['exports']=function(_0x504c98,_0x1b9b5d){return _0x504c98[_0x93cc('0xa')](_0x93cc('0xb'),attributes,{'tableName':_0x93cc('0xc'),'paranoid':![],'indexes':[{'fields':[_0x93cc('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6477=['rimraf','../../config/environment','exports','VoiceDialReport','report_dial','uniqueid','lodash','../../config/logger','moment','bluebird','path'];(function(_0x2c66bf,_0xff607){var _0x155f0f=function(_0x1fbde5){while(--_0x1fbde5){_0x2c66bf['push'](_0x2c66bf['shift']());}};_0x155f0f(++_0xff607);}(_0x6477,0x103));var _0x7647=function(_0x4a599b,_0x1d2125){_0x4a599b=_0x4a599b-0x0;var _0x2d53d3=_0x6477[_0x4a599b];return _0x2d53d3;};'use strict';var _=require(_0x7647('0x0'));var util=require('util');var logger=require(_0x7647('0x1'))('api');var moment=require(_0x7647('0x2'));var BPromise=require(_0x7647('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7647('0x4'));var rimraf=require(_0x7647('0x5'));var config=require(_0x7647('0x6'));var attributes=require('./voiceDialReport.attributes');module[_0x7647('0x7')]=function(_0xdc4f1c,_0x2f07b9){return _0xdc4f1c['define'](_0x7647('0x8'),attributes,{'tableName':_0x7647('0x9'),'paranoid':![],'indexes':[{'fields':[_0x7647('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 6f833ab..9e07d28 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 _0xb0b1=['http','request','VoiceDialReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','CreateVoiceDialReport','VoiceDialReport','create','options','then','UpdateVoiceDialReport','update','raw','where','attributes','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x371f28,_0x315fc9){var _0x3b690f=function(_0x4a657a){while(--_0x4a657a){_0x371f28['push'](_0x371f28['shift']());}};_0x3b690f(++_0x315fc9);}(_0xb0b1,0xee));var _0x1b0b=function(_0x53d648,_0x1f877e){_0x53d648=_0x53d648-0x0;var _0x1553c6=_0xb0b1[_0x53d648];return _0x1553c6;};'use strict';var _=require('lodash');var util=require(_0x1b0b('0x0'));var moment=require('moment');var BPromise=require(_0x1b0b('0x1'));var rs=require(_0x1b0b('0x2'));var fs=require('fs');var Redis=require(_0x1b0b('0x3'));var db=require(_0x1b0b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1b0b('0x5'))(_0x1b0b('0x6'));var config=require(_0x1b0b('0x7'));var jayson=require(_0x1b0b('0x8'));var client=jayson[_0x1b0b('0x9')][_0x1b0b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b8365,_0x10dd0c,_0x733cbf){return new BPromise(function(_0x599038,_0x3fe61e){return client[_0x1b0b('0xb')](_0x2b8365,_0x733cbf)['then'](function(_0x5f1a62){logger['info'](_0x1b0b('0xc'),_0x10dd0c,'request\x20sent');logger[_0x1b0b('0xd')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x10dd0c,_0x1b0b('0xe'),JSON[_0x1b0b('0xf')](_0x5f1a62));if(_0x5f1a62[_0x1b0b('0x10')]){if(_0x5f1a62['error']['code']===0x1f4){logger[_0x1b0b('0x10')](_0x1b0b('0xc'),_0x10dd0c,_0x5f1a62[_0x1b0b('0x10')][_0x1b0b('0x11')]);return _0x3fe61e(_0x5f1a62[_0x1b0b('0x10')][_0x1b0b('0x11')]);}logger[_0x1b0b('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x10dd0c,_0x5f1a62[_0x1b0b('0x10')][_0x1b0b('0x11')]);return _0x599038(_0x5f1a62[_0x1b0b('0x10')][_0x1b0b('0x11')]);}else{logger[_0x1b0b('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x10dd0c,'request\x20sent');_0x599038(_0x5f1a62[_0x1b0b('0x13')][_0x1b0b('0x11')]);}})[_0x1b0b('0x14')](function(_0x34eb72){logger['error'](_0x1b0b('0xc'),_0x10dd0c,_0x34eb72);_0x3fe61e(_0x34eb72);});});}exports[_0x1b0b('0x15')]=function(_0x4030b1){var _0x137687=this;return new Promise(function(_0x1dcdb0,_0xcb9eff){return db[_0x1b0b('0x16')][_0x1b0b('0x17')](_0x4030b1['body'],{'raw':_0x4030b1['options']?_0x4030b1[_0x1b0b('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x1b0b('0x19')](function(_0x3858c3){logger[_0x1b0b('0x12')](_0x1b0b('0x15'),_0x4030b1);logger[_0x1b0b('0xd')](_0x1b0b('0x15'),_0x4030b1,JSON[_0x1b0b('0xf')](_0x3858c3));_0x1dcdb0(_0x3858c3);})['catch'](function(_0x1377c3){logger[_0x1b0b('0x10')](_0x1b0b('0x15'),_0x1377c3[_0x1b0b('0x11')],_0x4030b1);_0xcb9eff(_0x137687[_0x1b0b('0x10')](0x1f4,_0x1377c3[_0x1b0b('0x11')]));});});};exports[_0x1b0b('0x1a')]=function(_0x35f7bb){var _0x341b60=this;return new Promise(function(_0x1ef6b9,_0x14ece5){return db[_0x1b0b('0x16')][_0x1b0b('0x1b')](_0x35f7bb['body'],{'raw':_0x35f7bb[_0x1b0b('0x18')]?_0x35f7bb[_0x1b0b('0x18')][_0x1b0b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35f7bb['options']?_0x35f7bb[_0x1b0b('0x18')][_0x1b0b('0x1d')]||null:null,'attributes':_0x35f7bb['options']?_0x35f7bb['options'][_0x1b0b('0x1e')]||null:null,'limit':_0x35f7bb[_0x1b0b('0x18')]?_0x35f7bb[_0x1b0b('0x18')]['limit']||null:null})[_0x1b0b('0x19')](function(_0x525ef4){logger[_0x1b0b('0x12')](_0x1b0b('0x1a'),_0x35f7bb);logger[_0x1b0b('0xd')](_0x1b0b('0x1a'),_0x35f7bb,JSON['stringify'](_0x525ef4));_0x1ef6b9(_0x525ef4);})['catch'](function(_0xe3c691){logger[_0x1b0b('0x10')](_0x1b0b('0x1a'),_0xe3c691[_0x1b0b('0x11')],_0x35f7bb);_0x14ece5(_0x341b60[_0x1b0b('0x10')](0x1f4,_0xe3c691[_0x1b0b('0x11')]));});});}; \ No newline at end of file +var _0xc1d2=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','CreateVoiceDialReport','VoiceDialReport','create','raw','catch','UpdateVoiceDialReport','update','body','options','where','stringify','lodash'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xc1d2,0x1df));var _0x2c1d=function(_0x29317e,_0x24f0ce){_0x29317e=_0x29317e-0x0;var _0x11069e=_0xc1d2[_0x29317e];return _0x11069e;};'use strict';var _=require(_0x2c1d('0x0'));var util=require(_0x2c1d('0x1'));var moment=require('moment');var BPromise=require(_0x2c1d('0x2'));var rs=require(_0x2c1d('0x3'));var fs=require('fs');var Redis=require(_0x2c1d('0x4'));var db=require(_0x2c1d('0x5'))['db'];var utils=require(_0x2c1d('0x6'));var logger=require(_0x2c1d('0x7'))('rpc');var config=require(_0x2c1d('0x8'));var jayson=require(_0x2c1d('0x9'));var client=jayson[_0x2c1d('0xa')][_0x2c1d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3cdaed,_0x4a0a01,_0x29ab76){return new BPromise(function(_0x2aeabb,_0xe835f6){return client[_0x2c1d('0xc')](_0x3cdaed,_0x29ab76)[_0x2c1d('0xd')](function(_0x26fa51){logger[_0x2c1d('0xe')](_0x2c1d('0xf'),_0x4a0a01,_0x2c1d('0x10'));logger[_0x2c1d('0x11')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x4a0a01,_0x2c1d('0x10'),JSON['stringify'](_0x26fa51));if(_0x26fa51['error']){if(_0x26fa51[_0x2c1d('0x12')][_0x2c1d('0x13')]===0x1f4){logger[_0x2c1d('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x4a0a01,_0x26fa51[_0x2c1d('0x12')][_0x2c1d('0x14')]);return _0xe835f6(_0x26fa51[_0x2c1d('0x12')][_0x2c1d('0x14')]);}logger[_0x2c1d('0x12')](_0x2c1d('0xf'),_0x4a0a01,_0x26fa51[_0x2c1d('0x12')]['message']);return _0x2aeabb(_0x26fa51[_0x2c1d('0x12')][_0x2c1d('0x14')]);}else{logger[_0x2c1d('0xe')](_0x2c1d('0xf'),_0x4a0a01,'request\x20sent');_0x2aeabb(_0x26fa51['result'][_0x2c1d('0x14')]);}})['catch'](function(_0xf6209e){logger[_0x2c1d('0x12')](_0x2c1d('0xf'),_0x4a0a01,_0xf6209e);_0xe835f6(_0xf6209e);});});}exports[_0x2c1d('0x15')]=function(_0x3a6fe1){var _0xd2e728=this;return new Promise(function(_0x3b06f9,_0x3c7179){return db[_0x2c1d('0x16')][_0x2c1d('0x17')](_0x3a6fe1['body'],{'raw':_0x3a6fe1['options']?_0x3a6fe1['options'][_0x2c1d('0x18')]===undefined?!![]:![]:!![]})[_0x2c1d('0xd')](function(_0xf7b91e){logger['info'](_0x2c1d('0x15'),_0x3a6fe1);logger[_0x2c1d('0x11')](_0x2c1d('0x15'),_0x3a6fe1,JSON['stringify'](_0xf7b91e));_0x3b06f9(_0xf7b91e);})[_0x2c1d('0x19')](function(_0x2f0b30){logger[_0x2c1d('0x12')](_0x2c1d('0x15'),_0x2f0b30[_0x2c1d('0x14')],_0x3a6fe1);_0x3c7179(_0xd2e728[_0x2c1d('0x12')](0x1f4,_0x2f0b30[_0x2c1d('0x14')]));});});};exports[_0x2c1d('0x1a')]=function(_0x42f836){var _0x89a0c2=this;return new Promise(function(_0x2e32e1,_0x24723f){return db[_0x2c1d('0x16')][_0x2c1d('0x1b')](_0x42f836[_0x2c1d('0x1c')],{'raw':_0x42f836[_0x2c1d('0x1d')]?_0x42f836[_0x2c1d('0x1d')][_0x2c1d('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42f836[_0x2c1d('0x1d')]?_0x42f836[_0x2c1d('0x1d')][_0x2c1d('0x1e')]||null:null,'attributes':_0x42f836['options']?_0x42f836[_0x2c1d('0x1d')]['attributes']||null:null,'limit':_0x42f836[_0x2c1d('0x1d')]?_0x42f836[_0x2c1d('0x1d')]['limit']||null:null})['then'](function(_0x5279df){logger['info'](_0x2c1d('0x1a'),_0x42f836);logger['debug'](_0x2c1d('0x1a'),_0x42f836,JSON[_0x2c1d('0x1f')](_0x5279df));_0x2e32e1(_0x5279df);})[_0x2c1d('0x19')](function(_0x83519){logger[_0x2c1d('0x12')]('UpdateVoiceDialReport',_0x83519['message'],_0x42f836);_0x24723f(_0x89a0c2[_0x2c1d('0x12')](0x1f4,_0x83519[_0x2c1d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 0f6663a..661f203 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 _0x5210=['put','update','delete','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','/:id/applications','addApplications'];(function(_0x31d6c2,_0x422dcd){var _0x295dd0=function(_0x2b5dd1){while(--_0x2b5dd1){_0x31d6c2['push'](_0x31d6c2['shift']());}};_0x295dd0(++_0x422dcd);}(_0x5210,0x1a1));var _0x0521=function(_0x4cc49b,_0x59264d){_0x4cc49b=_0x4cc49b-0x0;var _0x1d8202=_0x5210[_0x4cc49b];return _0x1d8202;};'use strict';var multer=require(_0x0521('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0521('0x1'));var express=require(_0x0521('0x2'));var router=express[_0x0521('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0521('0x4'));var config=require(_0x0521('0x5'));var controller=require(_0x0521('0x6'));router[_0x0521('0x7')]('/',auth[_0x0521('0x8')](),controller[_0x0521('0x9')]);router[_0x0521('0x7')](_0x0521('0xa'),auth[_0x0521('0x8')](),controller[_0x0521('0xb')]);router[_0x0521('0xc')]('/',auth[_0x0521('0x8')](),controller['create']);router[_0x0521('0xc')](_0x0521('0xd'),auth[_0x0521('0x8')](),controller[_0x0521('0xe')]);router[_0x0521('0xf')](_0x0521('0xa'),auth[_0x0521('0x8')](),controller[_0x0521('0x10')]);router[_0x0521('0x11')](_0x0521('0xa'),auth[_0x0521('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa875=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','addApplications','put','/:id','delete','exports','util','path','connect-timeout','express'];(function(_0x2074fb,_0x26707f){var _0x4c71d3=function(_0x4d32ef){while(--_0x4d32ef){_0x2074fb['push'](_0x2074fb['shift']());}};_0x4c71d3(++_0x26707f);}(_0xa875,0x176));var _0x5a87=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xa875[_0x5f1391];return _0x50ebe3;};'use strict';var multer=require('multer');var util=require(_0x5a87('0x0'));var path=require(_0x5a87('0x1'));var timeout=require(_0x5a87('0x2'));var express=require(_0x5a87('0x3'));var router=express[_0x5a87('0x4')]();var auth=require(_0x5a87('0x5'));var interaction=require(_0x5a87('0x6'));var config=require(_0x5a87('0x7'));var controller=require('./voiceExtension.controller');router[_0x5a87('0x8')]('/',auth[_0x5a87('0x9')](),controller[_0x5a87('0xa')]);router[_0x5a87('0x8')]('/:id',auth[_0x5a87('0x9')](),controller['show']);router[_0x5a87('0xb')]('/',auth[_0x5a87('0x9')](),controller[_0x5a87('0xc')]);router['post']('/:id/applications',auth[_0x5a87('0x9')](),controller[_0x5a87('0xd')]);router[_0x5a87('0xe')](_0x5a87('0xf'),auth[_0x5a87('0x9')](),controller['update']);router[_0x5a87('0x10')](_0x5a87('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x5a87('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 47ca82c..44d3416 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 _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0xc38ca1,_0x1f3af1){var _0x4bda81=function(_0x1f76d1){while(--_0x1f76d1){_0xc38ca1['push'](_0xc38ca1['shift']());}};_0x4bda81(++_0x1f3af1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file +var _0xa9e0=['*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','inbound','outbound','internal','system'];(function(_0x1e5a0c,_0x3a16fc){var _0x5cc15b=function(_0x39e08f){while(--_0x39e08f){_0x1e5a0c['push'](_0x1e5a0c['shift']());}};_0x5cc15b(++_0x3a16fc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'context':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0a9e('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x0a9e('0x3')},'tag':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x4')},'appdata':{'type':Sequelize[_0x0a9e('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),'inbound-fax','outbound-fax',_0x0a9e('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'defaultValue':_0x0a9e('0x9')},'IntervalId':{'type':Sequelize[_0x0a9e('0xa')]},'isApp':{'type':Sequelize[_0x0a9e('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x0a9e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0a9e('0xc')],'get':function(_0xd5b662){return this[_0x0a9e('0xd')](_0x0a9e('0xe'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 07df783..00f7eb6 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 _0xc718=['hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','recordingFormat','mandatoryDisposition','addApplications','findOne','VoiceExtensionId','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','ignore','value','find','type','name','UserProfileResource','end','stack','send','index','VoiceExtension','fieldName','key','model','map','query','keys','intersection','attributes','fields','length'];(function(_0x44b7bb,_0x460592){var _0x370e81=function(_0x1c5d02){while(--_0x1c5d02){_0x44b7bb['push'](_0x44b7bb['shift']());}};_0x370e81(++_0x460592);}(_0xc718,0x164));var _0x8c71=function(_0x4b7c00,_0x57dd1a){_0x4b7c00=_0x4b7c00-0x0;var _0x235868=_0xc718[_0x4b7c00];return _0x235868;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8c71('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c71('0x1'));var jsonpatch=require(_0x8c71('0x2'));var rp=require(_0x8c71('0x3'));var moment=require(_0x8c71('0x4'));var BPromise=require(_0x8c71('0x5'));var Mustache=require('mustache');var util=require(_0x8c71('0x6'));var path=require(_0x8c71('0x7'));var sox=require('sox');var csv=require(_0x8c71('0x8'));var ejs=require(_0x8c71('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8c71('0xa'));var crypto=require('crypto');var jsforce=require(_0x8c71('0xb'));var deskjs=require(_0x8c71('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8c71('0xd'));var Papa=require(_0x8c71('0xe'));var Redis=require(_0x8c71('0xf'));var authService=require(_0x8c71('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c71('0x11'));var logger=require(_0x8c71('0x12'))(_0x8c71('0x13'));var utils=require('../../config/utils');var config=require(_0x8c71('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c71('0x15'))['db'];config[_0x8c71('0x16')]=_[_0x8c71('0x17')](config[_0x8c71('0x16')],{'host':_0x8c71('0x18'),'port':0x18eb});var socket=require(_0x8c71('0x19'))(new Redis(config['redis']));require(_0x8c71('0x1a'))[_0x8c71('0x1b')](socket);function respondWithStatusCode(_0x58e397,_0x27cc28){_0x27cc28=_0x27cc28||0xcc;return function(_0x3c3068){if(_0x3c3068){return _0x58e397['sendStatus'](_0x27cc28);}return _0x58e397[_0x8c71('0x1c')](_0x27cc28)['end']();};}function respondWithResult(_0x10c679,_0x2dd532){_0x2dd532=_0x2dd532||0xc8;return function(_0x5d39e6){if(_0x5d39e6){return _0x10c679[_0x8c71('0x1c')](_0x2dd532)['json'](_0x5d39e6);}};}function respondWithFilteredResult(_0x61d6c0,_0x5c9460){return function(_0x5dd2d7){if(_0x5dd2d7){var _0x3aaefd=_0x5dd2d7[_0x8c71('0x1d')],_0x2a6ebb=_0x5c9460[_0x8c71('0x1e')],_0xf543a3=_0x5c9460[_0x8c71('0x1e')]+_0x5c9460[_0x8c71('0x1f')],_0x53e763;if(_0xf543a3>=_0x3aaefd){_0xf543a3=_0x3aaefd;_0x53e763=0xc8;}else{_0x53e763=0xce;}_0x61d6c0[_0x8c71('0x1c')](_0x53e763);return _0x61d6c0[_0x8c71('0x20')](_0x8c71('0x21'),_0x2a6ebb+'-'+_0xf543a3+'/'+_0x3aaefd)[_0x8c71('0x22')](_0x5dd2d7);}return null;};}function patchUpdates(_0x408868){return function(_0x548b49){try{jsonpatch[_0x8c71('0x23')](_0x548b49,_0x408868,!![]);}catch(_0x5ec404){return BPromise[_0x8c71('0x24')](_0x5ec404);}return _0x548b49[_0x8c71('0x25')]();};}function saveUpdates(_0x5bc12f,_0x126cb4){return function(_0x2dd01d){if(_0x2dd01d){return _0x2dd01d[_0x8c71('0x26')](_0x5bc12f)[_0x8c71('0x27')](function(_0x4a7471){return _0x4a7471;});}return null;};}function removeEntity(_0x221b7d,_0x17bd6e){return function(_0x13a95b){if(_0x13a95b){return _0x13a95b[_0x8c71('0x28')]()[_0x8c71('0x27')](function(){var _0x40c9f5=_0x13a95b[_0x8c71('0x29')]({'plain':!![]});var _0x31faa0=[{'name':_0x8c71('0x2a'),'value':'inbound','ignore':![]},{'name':_0x8c71('0x2b'),'value':_0x8c71('0x2c'),'ignore':![]},{'name':_0x8c71('0x2d'),'value':_0x8c71('0x2e'),'ignore':![]}];var _0x1beade=_(_0x31faa0)['filter'](_0x8c71('0x2f'))['map'](_0x8c71('0x30'))['value']();if(_['includes'](_0x1beade,_0x40c9f5['type'])){return;}var _0x57bd90=_[_0x8c71('0x31')](_0x31faa0,[_0x8c71('0x30'),_0x40c9f5[_0x8c71('0x32')]])[_0x8c71('0x33')];return db[_0x8c71('0x34')]['destroy']({'where':{'type':_0x57bd90,'resourceId':_0x40c9f5['id']}})[_0x8c71('0x27')](function(){return _0x13a95b;});})[_0x8c71('0x27')](function(){_0x221b7d[_0x8c71('0x1c')](0xcc)[_0x8c71('0x35')]();});}};}function handleEntityNotFound(_0x7c93f8,_0x3a8823){return function(_0x581149){if(!_0x581149){_0x7c93f8['sendStatus'](0x194);}return _0x581149;};}function handleError(_0x35b045,_0x24a24f){_0x24a24f=_0x24a24f||0x1f4;return function(_0xc612d7){logger['error'](_0xc612d7[_0x8c71('0x36')]);if(_0xc612d7['name']){delete _0xc612d7[_0x8c71('0x33')];}_0x35b045[_0x8c71('0x1c')](_0x24a24f)[_0x8c71('0x37')](_0xc612d7);};}exports[_0x8c71('0x38')]=function(_0x2e015c,_0x530a2e){var _0x133f58={},_0x5129c5={},_0x203ce0={'count':0x0,'rows':[]};var _0x2572ec=_['map'](db[_0x8c71('0x39')]['rawAttributes'],function(_0x303045){return{'name':_0x303045[_0x8c71('0x3a')],'type':_0x303045[_0x8c71('0x32')][_0x8c71('0x3b')]};});_0x5129c5[_0x8c71('0x3c')]=_[_0x8c71('0x3d')](_0x2572ec,_0x8c71('0x33'));_0x5129c5[_0x8c71('0x3e')]=_[_0x8c71('0x3f')](_0x2e015c[_0x8c71('0x3e')]);_0x5129c5['filters']=_[_0x8c71('0x40')](_0x5129c5[_0x8c71('0x3c')],_0x5129c5[_0x8c71('0x3e')]);_0x133f58[_0x8c71('0x41')]=_[_0x8c71('0x40')](_0x5129c5['model'],qs[_0x8c71('0x42')](_0x2e015c[_0x8c71('0x3e')][_0x8c71('0x42')]));_0x133f58[_0x8c71('0x41')]=_0x133f58['attributes'][_0x8c71('0x43')]?_0x133f58['attributes']:_0x5129c5[_0x8c71('0x3c')];if(!_0x2e015c[_0x8c71('0x3e')][_0x8c71('0x44')](_0x8c71('0x45'))){_0x133f58[_0x8c71('0x1f')]=qs['limit'](_0x2e015c[_0x8c71('0x3e')][_0x8c71('0x1f')]);_0x133f58[_0x8c71('0x1e')]=qs[_0x8c71('0x1e')](_0x2e015c['query'][_0x8c71('0x1e')]);}_0x133f58[_0x8c71('0x46')]=qs[_0x8c71('0x47')](_0x2e015c[_0x8c71('0x3e')][_0x8c71('0x47')]);_0x133f58[_0x8c71('0x48')]=qs[_0x8c71('0x49')](_[_0x8c71('0x4a')](_0x2e015c[_0x8c71('0x3e')],_0x5129c5[_0x8c71('0x49')]),_0x2572ec);if(_0x2e015c['query'][_0x8c71('0x4b')]){_0x133f58[_0x8c71('0x48')]=_['merge'](_0x133f58[_0x8c71('0x48')],{'$or':_[_0x8c71('0x3d')](_0x2572ec,function(_0xe472d9){if(_0xe472d9['type']!=='VIRTUAL'){var _0x3979fd={};_0x3979fd[_0xe472d9['name']]={'$like':'%'+_0x2e015c[_0x8c71('0x3e')][_0x8c71('0x4b')]+'%'};return _0x3979fd;}})});}_0x133f58=_[_0x8c71('0x4c')]({},_0x133f58,_0x2e015c[_0x8c71('0x4d')]);var _0x1ab52c={'where':_0x133f58['where']};return db['VoiceExtension'][_0x8c71('0x1d')](_0x1ab52c)[_0x8c71('0x27')](function(_0x19bdf6){_0x203ce0[_0x8c71('0x1d')]=_0x19bdf6;if(_0x2e015c[_0x8c71('0x3e')][_0x8c71('0x4e')]){_0x133f58[_0x8c71('0x4f')]=[{'all':!![]}];}return db[_0x8c71('0x39')][_0x8c71('0x50')](_0x133f58);})[_0x8c71('0x27')](function(_0x391329){_0x203ce0[_0x8c71('0x51')]=_0x391329;return _0x203ce0;})[_0x8c71('0x27')](respondWithFilteredResult(_0x530a2e,_0x133f58))[_0x8c71('0x52')](handleError(_0x530a2e,null));};exports[_0x8c71('0x53')]=function(_0x1a2724,_0x144975){var _0x43a656={'raw':![],'where':{'id':_0x1a2724['params']['id']}},_0x58b969={};_0x58b969[_0x8c71('0x3c')]=_['keys'](db[_0x8c71('0x39')][_0x8c71('0x54')]);_0x58b969[_0x8c71('0x3e')]=_[_0x8c71('0x3f')](_0x1a2724['query']);_0x58b969['filters']=_[_0x8c71('0x40')](_0x58b969[_0x8c71('0x3c')],_0x58b969['query']);_0x43a656[_0x8c71('0x41')]=_['intersection'](_0x58b969[_0x8c71('0x3c')],qs['fields'](_0x1a2724['query'][_0x8c71('0x42')]));_0x43a656[_0x8c71('0x41')]=_0x43a656['attributes']['length']?_0x43a656[_0x8c71('0x41')]:_0x58b969[_0x8c71('0x3c')];if(_0x1a2724['query'][_0x8c71('0x4e')]){_0x43a656['include']=[{'all':!![]}];}_0x43a656=_[_0x8c71('0x4c')]({},_0x43a656,_0x1a2724['options']);return db[_0x8c71('0x39')][_0x8c71('0x31')](_0x43a656)[_0x8c71('0x27')](handleEntityNotFound(_0x144975,null))[_0x8c71('0x27')](respondWithResult(_0x144975,null))['catch'](handleError(_0x144975,null));};exports[_0x8c71('0x28')]=function(_0x548d6b,_0x7a0541){return db[_0x8c71('0x39')][_0x8c71('0x31')]({'where':{'id':_0x548d6b['params']['id']}})[_0x8c71('0x27')](handleEntityNotFound(_0x7a0541,null))[_0x8c71('0x27')](removeEntity(_0x7a0541,null))[_0x8c71('0x52')](handleError(_0x7a0541,null));};exports[_0x8c71('0x55')]=function(_0x238901,_0x341285){if(_0x238901[_0x8c71('0x56')][_0x8c71('0x32')]==='outbound'&&!_[_0x8c71('0x57')](_0x238901[_0x8c71('0x56')]['exten'],'_')){_0x238901['body'][_0x8c71('0x58')]='_'['concat'](_0x238901[_0x8c71('0x56')][_0x8c71('0x58')]);}return db[_0x8c71('0x39')]['create'](_0x238901['body'],{'raw':![]})['then'](function(_0x279189){var _0x7d1878=_0x238901[_0x8c71('0x59')]['get']({'plain':!![]});if(!_0x7d1878)throw new Error(_0x8c71('0x5a'));if(_0x7d1878[_0x8c71('0x5b')]===_0x8c71('0x59')){var _0x501981=_0x279189['get']({'plain':!![]});var _0x15614e=[{'name':_0x8c71('0x2a'),'value':'inbound'},{'name':_0x8c71('0x2b'),'value':_0x8c71('0x2c')},{'name':_0x8c71('0x2d'),'value':'internal'}];var _0x3de349=_[_0x8c71('0x31')](_0x15614e,[_0x8c71('0x30'),_0x501981[_0x8c71('0x32')]])[_0x8c71('0x33')];return db[_0x8c71('0x5c')][_0x8c71('0x31')]({'where':{'name':_0x3de349,'userProfileId':_0x7d1878[_0x8c71('0x5d')]},'raw':!![]})[_0x8c71('0x27')](function(_0xe4d641){if(_0xe4d641&&_0xe4d641[_0x8c71('0x5e')]===0x0){return db[_0x8c71('0x34')][_0x8c71('0x55')]({'name':_0x501981[_0x8c71('0x33')],'resourceId':_0x501981['id'],'type':_0xe4d641[_0x8c71('0x33')],'sectionId':_0xe4d641['id']},{})[_0x8c71('0x27')](function(){return _0x279189;});}else{return _0x279189;}})[_0x8c71('0x52')](function(_0x5d67c4){logger[_0x8c71('0x5f')](_0x8c71('0x60'),_0x5d67c4);throw _0x5d67c4;});}return _0x279189;})['then'](respondWithResult(_0x341285,0xc9))[_0x8c71('0x52')](handleError(_0x341285,null));};exports['update']=function(_0x53534f,_0x5c4402){if(_0x53534f[_0x8c71('0x56')]['id']){delete _0x53534f['body']['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x53534f[_0x8c71('0x61')]['id']}})[_0x8c71('0x27')](handleEntityNotFound(_0x5c4402,null))[_0x8c71('0x27')](function(_0x4ab54d){if(_0x4ab54d){return db[_0x8c71('0x39')]['update'](_[_0x8c71('0x4a')](_0x53534f['body'],['exten','context','description',_0x8c71('0x62'),'cutdigits',_0x8c71('0x63')]),{'where':{'context':_0x4ab54d['context'],'exten':_0x4ab54d[_0x8c71('0x58')]},'individualHooks':!![]})[_0x8c71('0x27')](function(_0x29f31c){return _0x29f31c;});}return null;})[_0x8c71('0x27')](respondWithStatusCode(_0x5c4402,null))[_0x8c71('0x52')](handleError(_0x5c4402,null));};exports[_0x8c71('0x64')]=function(_0x233a6e,_0x11a396,_0x5d9847){return db[_0x8c71('0x39')][_0x8c71('0x65')]({'where':{'id':_0x233a6e[_0x8c71('0x61')]['id']}})['then'](handleEntityNotFound(_0x11a396,null))[_0x8c71('0x27')](function(_0x571a40){if(_0x571a40){return db['sequelize']['transaction'](function(_0x2733b0){return db[_0x8c71('0x39')][_0x8c71('0x28')]({'where':{'VoiceExtensionId':_0x233a6e[_0x8c71('0x61')]['id']},'transaction':_0x2733b0})[_0x8c71('0x27')](function(_0x3cde1e){var _0x2cdc2c=_[_0x8c71('0x3d')](_0x233a6e[_0x8c71('0x56')],function(_0x432ddc){_0x432ddc[_0x8c71('0x66')]=_0x233a6e[_0x8c71('0x61')]['id'];return _0x432ddc;});return db[_0x8c71('0x39')][_0x8c71('0x67')](_0x2cdc2c,{'transaction':_0x2733b0});});})[_0x8c71('0x27')](function(){return db[_0x8c71('0x39')][_0x8c71('0x68')]({'where':{'isApp':!![],'VoiceExtensionId':_0x233a6e[_0x8c71('0x61')]['id']},'order':_0x8c71('0x69')});});}})[_0x8c71('0x27')](respondWithResult(_0x11a396,null))[_0x8c71('0x52')](handleError(_0x11a396,null));}; \ No newline at end of file +var _0x38a9=['stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','startsWith','exten','concat','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','recordingFormat','cutdigits','mandatoryDisposition','context','addApplications','findOne','transaction','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','zip-dir','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','OutboundRoutes','InternalRoutes','internal','map','value','includes','type','name','error'];(function(_0x218a29,_0x4a5911){var _0x351e41=function(_0x1415ab){while(--_0x1415ab){_0x218a29['push'](_0x218a29['shift']());}};_0x351e41(++_0x4a5911);}(_0x38a9,0x101));var _0x938a=function(_0x4aaa52,_0xb6ee4e){_0x4aaa52=_0x4aaa52-0x0;var _0x5c9cd2=_0x38a9[_0x4aaa52];return _0x5c9cd2;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x938a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x938a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x938a('0x2'));var util=require(_0x938a('0x3'));var path=require(_0x938a('0x4'));var sox=require('sox');var csv=require(_0x938a('0x5'));var ejs=require(_0x938a('0x6'));var fs=require('fs');var _=require(_0x938a('0x7'));var squel=require(_0x938a('0x8'));var crypto=require(_0x938a('0x9'));var jsforce=require(_0x938a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x938a('0x5'));var querystring=require(_0x938a('0xb'));var Papa=require(_0x938a('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x938a('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x938a('0xe'));var logger=require(_0x938a('0xf'))('api');var utils=require(_0x938a('0x10'));var config=require(_0x938a('0x11'));var licenseUtil=require(_0x938a('0x12'));var db=require(_0x938a('0x13'))['db'];config[_0x938a('0x14')]=_[_0x938a('0x15')](config[_0x938a('0x14')],{'host':_0x938a('0x16'),'port':0x18eb});var socket=require(_0x938a('0x17'))(new Redis(config[_0x938a('0x14')]));require(_0x938a('0x18'))[_0x938a('0x19')](socket);function respondWithStatusCode(_0x36ca78,_0x54676b){_0x54676b=_0x54676b||0xcc;return function(_0x8b6432){if(_0x8b6432){return _0x36ca78[_0x938a('0x1a')](_0x54676b);}return _0x36ca78['status'](_0x54676b)[_0x938a('0x1b')]();};}function respondWithResult(_0xbeb30b,_0x477a1e){_0x477a1e=_0x477a1e||0xc8;return function(_0x1d504d){if(_0x1d504d){return _0xbeb30b[_0x938a('0x1c')](_0x477a1e)['json'](_0x1d504d);}};}function respondWithFilteredResult(_0x120f36,_0x5bfcac){return function(_0xc598db){if(_0xc598db){var _0x27304c=_0xc598db[_0x938a('0x1d')],_0x10e07e=_0x5bfcac[_0x938a('0x1e')],_0x43b96a=_0x5bfcac['offset']+_0x5bfcac[_0x938a('0x1f')],_0x53114b;if(_0x43b96a>=_0x27304c){_0x43b96a=_0x27304c;_0x53114b=0xc8;}else{_0x53114b=0xce;}_0x120f36[_0x938a('0x1c')](_0x53114b);return _0x120f36[_0x938a('0x20')](_0x938a('0x21'),_0x10e07e+'-'+_0x43b96a+'/'+_0x27304c)[_0x938a('0x22')](_0xc598db);}return null;};}function patchUpdates(_0x44e29b){return function(_0xf270ed){try{jsonpatch[_0x938a('0x23')](_0xf270ed,_0x44e29b,!![]);}catch(_0x136d1d){return BPromise['reject'](_0x136d1d);}return _0xf270ed[_0x938a('0x24')]();};}function saveUpdates(_0x51aff4,_0x3e935b){return function(_0x35355a){if(_0x35355a){return _0x35355a[_0x938a('0x25')](_0x51aff4)[_0x938a('0x26')](function(_0x3bbf95){return _0x3bbf95;});}return null;};}function removeEntity(_0x15e7f7,_0x3d1647){return function(_0x1c0e75){if(_0x1c0e75){return _0x1c0e75[_0x938a('0x27')]()[_0x938a('0x26')](function(){var _0x597983=_0x1c0e75['get']({'plain':!![]});var _0x472d73=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x938a('0x28'),'value':'outbound','ignore':![]},{'name':_0x938a('0x29'),'value':_0x938a('0x2a'),'ignore':![]}];var _0x5275f7=_(_0x472d73)['filter']('ignore')[_0x938a('0x2b')](_0x938a('0x2c'))['value']();if(_[_0x938a('0x2d')](_0x5275f7,_0x597983['type'])){return;}var _0x293534=_['find'](_0x472d73,[_0x938a('0x2c'),_0x597983[_0x938a('0x2e')]])[_0x938a('0x2f')];return db['UserProfileResource'][_0x938a('0x27')]({'where':{'type':_0x293534,'resourceId':_0x597983['id']}})['then'](function(){return _0x1c0e75;});})['then'](function(){_0x15e7f7['status'](0xcc)[_0x938a('0x1b')]();});}};}function handleEntityNotFound(_0x173627,_0x2b0c57){return function(_0x51ed9a){if(!_0x51ed9a){_0x173627[_0x938a('0x1a')](0x194);}return _0x51ed9a;};}function handleError(_0x409f71,_0x5ba317){_0x5ba317=_0x5ba317||0x1f4;return function(_0x2571f1){logger[_0x938a('0x30')](_0x2571f1[_0x938a('0x31')]);if(_0x2571f1[_0x938a('0x2f')]){delete _0x2571f1['name'];}_0x409f71[_0x938a('0x1c')](_0x5ba317)[_0x938a('0x32')](_0x2571f1);};}exports[_0x938a('0x33')]=function(_0x5817d7,_0x49f733){var _0x33788f={},_0x47811e={},_0x1f39b6={'count':0x0,'rows':[]};var _0x462cc1=_[_0x938a('0x2b')](db[_0x938a('0x34')][_0x938a('0x35')],function(_0x3c5d06){return{'name':_0x3c5d06[_0x938a('0x36')],'type':_0x3c5d06['type'][_0x938a('0x37')]};});_0x47811e[_0x938a('0x38')]=_[_0x938a('0x2b')](_0x462cc1,_0x938a('0x2f'));_0x47811e[_0x938a('0x39')]=_[_0x938a('0x3a')](_0x5817d7['query']);_0x47811e[_0x938a('0x3b')]=_[_0x938a('0x3c')](_0x47811e['model'],_0x47811e[_0x938a('0x39')]);_0x33788f[_0x938a('0x3d')]=_['intersection'](_0x47811e[_0x938a('0x38')],qs['fields'](_0x5817d7[_0x938a('0x39')][_0x938a('0x3e')]));_0x33788f[_0x938a('0x3d')]=_0x33788f[_0x938a('0x3d')][_0x938a('0x3f')]?_0x33788f[_0x938a('0x3d')]:_0x47811e[_0x938a('0x38')];if(!_0x5817d7[_0x938a('0x39')][_0x938a('0x40')](_0x938a('0x41'))){_0x33788f[_0x938a('0x1f')]=qs[_0x938a('0x1f')](_0x5817d7[_0x938a('0x39')][_0x938a('0x1f')]);_0x33788f[_0x938a('0x1e')]=qs[_0x938a('0x1e')](_0x5817d7['query'][_0x938a('0x1e')]);}_0x33788f[_0x938a('0x42')]=qs[_0x938a('0x43')](_0x5817d7[_0x938a('0x39')][_0x938a('0x43')]);_0x33788f[_0x938a('0x44')]=qs[_0x938a('0x3b')](_['pick'](_0x5817d7[_0x938a('0x39')],_0x47811e[_0x938a('0x3b')]),_0x462cc1);if(_0x5817d7[_0x938a('0x39')]['filter']){_0x33788f[_0x938a('0x44')]=_[_0x938a('0x45')](_0x33788f['where'],{'$or':_[_0x938a('0x2b')](_0x462cc1,function(_0xd811e6){if(_0xd811e6[_0x938a('0x2e')]!==_0x938a('0x46')){var _0x5df89f={};_0x5df89f[_0xd811e6['name']]={'$like':'%'+_0x5817d7[_0x938a('0x39')]['filter']+'%'};return _0x5df89f;}})});}_0x33788f=_[_0x938a('0x45')]({},_0x33788f,_0x5817d7[_0x938a('0x47')]);var _0x16f65e={'where':_0x33788f[_0x938a('0x44')]};return db[_0x938a('0x34')][_0x938a('0x1d')](_0x16f65e)['then'](function(_0x1598d8){_0x1f39b6[_0x938a('0x1d')]=_0x1598d8;if(_0x5817d7[_0x938a('0x39')][_0x938a('0x48')]){_0x33788f[_0x938a('0x49')]=[{'all':!![]}];}return db[_0x938a('0x34')]['findAll'](_0x33788f);})[_0x938a('0x26')](function(_0x49a6dc){_0x1f39b6[_0x938a('0x4a')]=_0x49a6dc;return _0x1f39b6;})[_0x938a('0x26')](respondWithFilteredResult(_0x49f733,_0x33788f))[_0x938a('0x4b')](handleError(_0x49f733,null));};exports['show']=function(_0x318414,_0x1917c5){var _0x55f74d={'raw':![],'where':{'id':_0x318414[_0x938a('0x4c')]['id']}},_0x3d2b09={};_0x3d2b09[_0x938a('0x38')]=_['keys'](db[_0x938a('0x34')]['rawAttributes']);_0x3d2b09['query']=_['keys'](_0x318414[_0x938a('0x39')]);_0x3d2b09['filters']=_[_0x938a('0x3c')](_0x3d2b09[_0x938a('0x38')],_0x3d2b09[_0x938a('0x39')]);_0x55f74d[_0x938a('0x3d')]=_[_0x938a('0x3c')](_0x3d2b09['model'],qs['fields'](_0x318414[_0x938a('0x39')][_0x938a('0x3e')]));_0x55f74d[_0x938a('0x3d')]=_0x55f74d[_0x938a('0x3d')][_0x938a('0x3f')]?_0x55f74d['attributes']:_0x3d2b09[_0x938a('0x38')];if(_0x318414[_0x938a('0x39')][_0x938a('0x48')]){_0x55f74d[_0x938a('0x49')]=[{'all':!![]}];}_0x55f74d=_[_0x938a('0x45')]({},_0x55f74d,_0x318414[_0x938a('0x47')]);return db[_0x938a('0x34')][_0x938a('0x4d')](_0x55f74d)[_0x938a('0x26')](handleEntityNotFound(_0x1917c5,null))['then'](respondWithResult(_0x1917c5,null))[_0x938a('0x4b')](handleError(_0x1917c5,null));};exports['destroy']=function(_0x18b8ee,_0x28f3df){return db[_0x938a('0x34')][_0x938a('0x4d')]({'where':{'id':_0x18b8ee[_0x938a('0x4c')]['id']}})[_0x938a('0x26')](handleEntityNotFound(_0x28f3df,null))[_0x938a('0x26')](removeEntity(_0x28f3df,null))[_0x938a('0x4b')](handleError(_0x28f3df,null));};exports[_0x938a('0x4e')]=function(_0x24868f,_0x3b0889){if(_0x24868f[_0x938a('0x4f')]['type']==='outbound'&&!_[_0x938a('0x50')](_0x24868f['body']['exten'],'_')){_0x24868f[_0x938a('0x4f')][_0x938a('0x51')]='_'[_0x938a('0x52')](_0x24868f[_0x938a('0x4f')][_0x938a('0x51')]);}return db[_0x938a('0x34')]['create'](_0x24868f[_0x938a('0x4f')],{'raw':![]})[_0x938a('0x26')](function(_0x1f031f){var _0x1c8a54=_0x24868f[_0x938a('0x53')][_0x938a('0x54')]({'plain':!![]});if(!_0x1c8a54)throw new Error(_0x938a('0x55'));if(_0x1c8a54['role']===_0x938a('0x53')){var _0x4a0c2d=_0x1f031f['get']({'plain':!![]});var _0x599ff4=[{'name':'InboundRoutes','value':_0x938a('0x56')},{'name':_0x938a('0x28'),'value':'outbound'},{'name':_0x938a('0x29'),'value':_0x938a('0x2a')}];var _0x2ff0dd=_['find'](_0x599ff4,[_0x938a('0x2c'),_0x4a0c2d['type']])[_0x938a('0x2f')];return db[_0x938a('0x57')][_0x938a('0x4d')]({'where':{'name':_0x2ff0dd,'userProfileId':_0x1c8a54[_0x938a('0x58')]},'raw':!![]})['then'](function(_0x3370cd){if(_0x3370cd&&_0x3370cd[_0x938a('0x59')]===0x0){return db['UserProfileResource'][_0x938a('0x4e')]({'name':_0x4a0c2d[_0x938a('0x2f')],'resourceId':_0x4a0c2d['id'],'type':_0x3370cd[_0x938a('0x2f')],'sectionId':_0x3370cd['id']},{})[_0x938a('0x26')](function(){return _0x1f031f;});}else{return _0x1f031f;}})[_0x938a('0x4b')](function(_0x87a51d){logger[_0x938a('0x30')](_0x938a('0x5a'),_0x87a51d);throw _0x87a51d;});}return _0x1f031f;})[_0x938a('0x26')](respondWithResult(_0x3b0889,0xc9))['catch'](handleError(_0x3b0889,null));};exports[_0x938a('0x25')]=function(_0x156fb6,_0x326cb0){if(_0x156fb6[_0x938a('0x4f')]['id']){delete _0x156fb6[_0x938a('0x4f')]['id'];}return db[_0x938a('0x34')][_0x938a('0x4d')]({'where':{'id':_0x156fb6['params']['id']}})[_0x938a('0x26')](handleEntityNotFound(_0x326cb0,null))['then'](function(_0x597f2e){if(_0x597f2e){return db[_0x938a('0x34')][_0x938a('0x25')](_[_0x938a('0x5b')](_0x156fb6[_0x938a('0x4f')],[_0x938a('0x51'),'context','description',_0x938a('0x5c'),_0x938a('0x5d'),_0x938a('0x5e')]),{'where':{'context':_0x597f2e[_0x938a('0x5f')],'exten':_0x597f2e[_0x938a('0x51')]},'individualHooks':!![]})[_0x938a('0x26')](function(_0x3d7474){return _0x3d7474;});}return null;})['then'](respondWithStatusCode(_0x326cb0,null))[_0x938a('0x4b')](handleError(_0x326cb0,null));};exports[_0x938a('0x60')]=function(_0x239f62,_0x23f023,_0x243db4){return db[_0x938a('0x34')][_0x938a('0x61')]({'where':{'id':_0x239f62[_0x938a('0x4c')]['id']}})['then'](handleEntityNotFound(_0x23f023,null))[_0x938a('0x26')](function(_0x43bf02){if(_0x43bf02){return db['sequelize'][_0x938a('0x62')](function(_0x55f7c8){return db[_0x938a('0x34')][_0x938a('0x27')]({'where':{'VoiceExtensionId':_0x239f62[_0x938a('0x4c')]['id']},'transaction':_0x55f7c8})[_0x938a('0x26')](function(_0x4b5829){var _0x7826d2=_[_0x938a('0x2b')](_0x239f62['body'],function(_0xcc75dc){_0xcc75dc['VoiceExtensionId']=_0x239f62[_0x938a('0x4c')]['id'];return _0xcc75dc;});return db[_0x938a('0x34')][_0x938a('0x63')](_0x7826d2,{'transaction':_0x55f7c8});});})[_0x938a('0x26')](function(){return db[_0x938a('0x34')][_0x938a('0x64')]({'where':{'isApp':!![],'VoiceExtensionId':_0x239f62[_0x938a('0x4c')]['id']},'order':_0x938a('0x65')});});}})[_0x938a('0x26')](respondWithResult(_0x23f023,null))[_0x938a('0x4b')](handleError(_0x23f023,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 3a14f8a..86b5a9e 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 _0xf619=['hook','exports','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x557f81,_0x4f27ca){var _0x412209=function(_0x55b481){while(--_0x55b481){_0x557f81['push'](_0x557f81['shift']());}};_0x412209(++_0x4f27ca);}(_0xf619,0x17a));var _0x9f61=function(_0x1e3272,_0x3a8398){_0x1e3272=_0x1e3272-0x0;var _0x4c4154=_0xf619[_0x1e3272];return _0x4c4154;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x9f61('0x0'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x9f61('0x1')](0x0);var events={'afterCreate':_0x9f61('0x2'),'afterUpdate':_0x9f61('0x3'),'afterDestroy':_0x9f61('0x4')};function emitEvent(_0x5a697c){return function(_0x53a007,_0x3fdaff,_0xcdb370){VoiceExtensionEvents[_0x9f61('0x5')](_0x5a697c+':'+_0x53a007['id'],_0x53a007);VoiceExtensionEvents[_0x9f61('0x5')](_0x5a697c,_0x53a007);_0xcdb370(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x9f61('0x6')](e,emitEvent(event));}}module[_0x9f61('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x9e4a=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x242cb9,_0x1246b0){var _0x599b8e=function(_0x1643ea){while(--_0x1643ea){_0x242cb9['push'](_0x242cb9['shift']());}};_0x599b8e(++_0x1246b0);}(_0x9e4a,0x124));var _0xa9e4=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x9e4a[_0x5c2e3e];return _0x53f64a;};'use strict';var EventEmitter=require(_0xa9e4('0x0'));var VoiceExtension=require(_0xa9e4('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xa9e4('0x2')](0x0);var events={'afterCreate':_0xa9e4('0x3'),'afterUpdate':_0xa9e4('0x4'),'afterDestroy':_0xa9e4('0x5')};function emitEvent(_0x43d661){return function(_0x5ae488,_0x26013f,_0x3fcf93){VoiceExtensionEvents[_0xa9e4('0x6')](_0x43d661+':'+_0x5ae488['id'],_0x5ae488);VoiceExtensionEvents[_0xa9e4('0x6')](_0x43d661,_0x5ae488);_0x3fcf93(null);};}for(var e in events){if(events[_0xa9e4('0x7')](e)){var event=events[e];VoiceExtension[_0xa9e4('0x8')](e,emitEvent(event));}}module[_0xa9e4('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 0391239..c9c1e67 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 _0x2afe=['path','rimraf','../../config/environment','./voiceExtension.attributes','exports','define','voice_extensions','lodash','../../config/logger','request-promise'];(function(_0x469c0b,_0x3f26c3){var _0x462d58=function(_0x418fd3){while(--_0x418fd3){_0x469c0b['push'](_0x469c0b['shift']());}};_0x462d58(++_0x3f26c3);}(_0x2afe,0x15b));var _0xe2af=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x2afe[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xe2af('0x0'));var util=require('util');var logger=require(_0xe2af('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe2af('0x2'));var fs=require('fs');var path=require(_0xe2af('0x3'));var rimraf=require(_0xe2af('0x4'));var config=require(_0xe2af('0x5'));var attributes=require(_0xe2af('0x6'));module[_0xe2af('0x7')]=function(_0x1ad46d,_0x4105b5){return _0x1ad46d[_0xe2af('0x8')]('VoiceExtension',attributes,{'tableName':_0xe2af('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19b2=['exports','define','VoiceExtension','voice_extensions','lodash','../../config/logger','moment','request-promise','path','../../config/environment','./voiceExtension.attributes'];(function(_0x24d92a,_0x5dcc4d){var _0x2d5aed=function(_0x2df528){while(--_0x2df528){_0x24d92a['push'](_0x24d92a['shift']());}};_0x2d5aed(++_0x5dcc4d);}(_0x19b2,0x1b1));var _0x219b=function(_0x4e23e1,_0x21b74c){_0x4e23e1=_0x4e23e1-0x0;var _0x10c917=_0x19b2[_0x4e23e1];return _0x10c917;};'use strict';var _=require(_0x219b('0x0'));var util=require('util');var logger=require(_0x219b('0x1'))('api');var moment=require(_0x219b('0x2'));var BPromise=require('bluebird');var rp=require(_0x219b('0x3'));var fs=require('fs');var path=require(_0x219b('0x4'));var rimraf=require('rimraf');var config=require(_0x219b('0x5'));var attributes=require(_0x219b('0x6'));module[_0x219b('0x7')]=function(_0x1f7f9e,_0x3ef31d){return _0x1f7f9e[_0x219b('0x8')](_0x219b('0x9'),attributes,{'tableName':_0x219b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 6859392..b687507 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 _0x261c=['../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','message','error','result','catch','VoiceExtension','findAll','options','where','attributes','limit','map','include','model','GetVoiceExtension','lodash','util','moment','randomstring','ioredis'];(function(_0x5c35ae,_0xd56d7c){var _0x88a731=function(_0x2733c9){while(--_0x2733c9){_0x5c35ae['push'](_0x5c35ae['shift']());}};_0x88a731(++_0xd56d7c);}(_0x261c,0x136));var _0xc261=function(_0x3a4838,_0x5eb63c){_0x3a4838=_0x3a4838-0x0;var _0x10fc53=_0x261c[_0x3a4838];return _0x10fc53;};'use strict';var _=require(_0xc261('0x0'));var util=require(_0xc261('0x1'));var moment=require(_0xc261('0x2'));var BPromise=require('bluebird');var rs=require(_0xc261('0x3'));var fs=require('fs');var Redis=require(_0xc261('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc261('0x5'))(_0xc261('0x6'));var config=require(_0xc261('0x7'));var jayson=require(_0xc261('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xc261('0x9')]=_[_0xc261('0xa')](config[_0xc261('0x9')],{'host':_0xc261('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc261('0x9')]));require(_0xc261('0xc'))[_0xc261('0xd')](socket);function respondWithRpcPromise(_0x555573,_0x34aa55,_0x32d357){return new BPromise(function(_0x3fef17,_0x4d7e92){return client[_0xc261('0xe')](_0x555573,_0x32d357)[_0xc261('0xf')](function(_0x19eb0e){logger[_0xc261('0x10')](_0xc261('0x11'),_0x34aa55,_0xc261('0x12'));logger[_0xc261('0x13')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x34aa55,'request\x20sent',JSON[_0xc261('0x14')](_0x19eb0e));if(_0x19eb0e['error']){if(_0x19eb0e['error']['code']===0x1f4){logger['error'](_0xc261('0x11'),_0x34aa55,_0x19eb0e['error'][_0xc261('0x15')]);return _0x4d7e92(_0x19eb0e[_0xc261('0x16')][_0xc261('0x15')]);}logger[_0xc261('0x16')](_0xc261('0x11'),_0x34aa55,_0x19eb0e['error'][_0xc261('0x15')]);return _0x3fef17(_0x19eb0e[_0xc261('0x16')][_0xc261('0x15')]);}else{logger[_0xc261('0x10')](_0xc261('0x11'),_0x34aa55,_0xc261('0x12'));_0x3fef17(_0x19eb0e[_0xc261('0x17')][_0xc261('0x15')]);}})[_0xc261('0x18')](function(_0x22af5a){logger['error'](_0xc261('0x11'),_0x34aa55,_0x22af5a);_0x4d7e92(_0x22af5a);});});}exports['GetVoiceExtension']=function(_0x3a0524){var _0x51d053=this;return new Promise(function(_0x4352cc,_0xa5ed70){return db[_0xc261('0x19')][_0xc261('0x1a')]({'raw':_0x3a0524['options']?_0x3a0524[_0xc261('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3a0524[_0xc261('0x1b')]?_0x3a0524[_0xc261('0x1b')][_0xc261('0x1c')]||null:null,'attributes':_0x3a0524[_0xc261('0x1b')]?_0x3a0524['options'][_0xc261('0x1d')]||null:null,'limit':_0x3a0524[_0xc261('0x1b')]?_0x3a0524[_0xc261('0x1b')][_0xc261('0x1e')]||null:null,'include':_0x3a0524[_0xc261('0x1b')]?_0x3a0524[_0xc261('0x1b')]['include']?_[_0xc261('0x1f')](_0x3a0524[_0xc261('0x1b')][_0xc261('0x20')],function(_0x2e12f9){return{'model':db[_0x2e12f9[_0xc261('0x21')]],'as':_0x2e12f9['as'],'attributes':_0x2e12f9[_0xc261('0x1d')],'include':_0x2e12f9['include']?_[_0xc261('0x1f')](_0x2e12f9[_0xc261('0x20')],function(_0x232ba8){return{'model':db[_0x232ba8[_0xc261('0x21')]],'as':_0x232ba8['as'],'attributes':_0x232ba8[_0xc261('0x1d')],'include':_0x232ba8[_0xc261('0x20')]?_['map'](_0x232ba8[_0xc261('0x20')],function(_0x15ade4){return{'model':db[_0x15ade4[_0xc261('0x21')]],'as':_0x15ade4['as'],'attributes':_0x15ade4[_0xc261('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc261('0xf')](function(_0x18eefb){logger[_0xc261('0x10')]('GetVoiceExtension',_0x3a0524);logger[_0xc261('0x13')](_0xc261('0x22'),_0x3a0524,JSON[_0xc261('0x14')](_0x18eefb));_0x4352cc(_0x18eefb);})[_0xc261('0x18')](function(_0x591961){logger['error'](_0xc261('0x22'),_0x591961[_0xc261('0x15')],_0x3a0524);_0xa5ed70(_0x51d053['error'](0x1f4,_0x591961[_0xc261('0x15')]));});});}; \ No newline at end of file +var _0xe440=['VoiceExtension','findAll','options','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVoiceExtension'];(function(_0x5423e6,_0x46a77a){var _0x44f8f2=function(_0x4f9926){while(--_0x4f9926){_0x5423e6['push'](_0x5423e6['shift']());}};_0x44f8f2(++_0x46a77a);}(_0xe440,0x127));var _0x0e44=function(_0x4f49b3,_0x24b41a){_0x4f49b3=_0x4f49b3-0x0;var _0x1af331=_0xe440[_0x4f49b3];return _0x1af331;};'use strict';var _=require(_0x0e44('0x0'));var util=require(_0x0e44('0x1'));var moment=require('moment');var BPromise=require(_0x0e44('0x2'));var rs=require(_0x0e44('0x3'));var fs=require('fs');var Redis=require(_0x0e44('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e44('0x5'));var logger=require(_0x0e44('0x6'))(_0x0e44('0x7'));var config=require(_0x0e44('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0e44('0x9')][_0x0e44('0xa')]({'port':0x232a});config[_0x0e44('0xb')]=_[_0x0e44('0xc')](config[_0x0e44('0xb')],{'host':_0x0e44('0xd'),'port':0x18eb});var socket=require(_0x0e44('0xe'))(new Redis(config[_0x0e44('0xb')]));require(_0x0e44('0xf'))[_0x0e44('0x10')](socket);function respondWithRpcPromise(_0x2ea0d2,_0x2c5c2b,_0x2af608){return new BPromise(function(_0x3b491c,_0x55397a){return client[_0x0e44('0x11')](_0x2ea0d2,_0x2af608)[_0x0e44('0x12')](function(_0x33f38a){logger[_0x0e44('0x13')](_0x0e44('0x14'),_0x2c5c2b,_0x0e44('0x15'));logger[_0x0e44('0x16')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x2c5c2b,'request\x20sent',JSON[_0x0e44('0x17')](_0x33f38a));if(_0x33f38a[_0x0e44('0x18')]){if(_0x33f38a[_0x0e44('0x18')][_0x0e44('0x19')]===0x1f4){logger[_0x0e44('0x18')](_0x0e44('0x14'),_0x2c5c2b,_0x33f38a[_0x0e44('0x18')][_0x0e44('0x1a')]);return _0x55397a(_0x33f38a[_0x0e44('0x18')][_0x0e44('0x1a')]);}logger[_0x0e44('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x2c5c2b,_0x33f38a['error'][_0x0e44('0x1a')]);return _0x3b491c(_0x33f38a[_0x0e44('0x18')][_0x0e44('0x1a')]);}else{logger[_0x0e44('0x13')](_0x0e44('0x14'),_0x2c5c2b,'request\x20sent');_0x3b491c(_0x33f38a['result'][_0x0e44('0x1a')]);}})[_0x0e44('0x1b')](function(_0x46964b){logger[_0x0e44('0x18')](_0x0e44('0x14'),_0x2c5c2b,_0x46964b);_0x55397a(_0x46964b);});});}exports[_0x0e44('0x1c')]=function(_0x484fc5){var _0x7221ac=this;return new Promise(function(_0x15f2e3,_0x2bb3d3){return db[_0x0e44('0x1d')][_0x0e44('0x1e')]({'raw':_0x484fc5[_0x0e44('0x1f')]?_0x484fc5[_0x0e44('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x484fc5[_0x0e44('0x1f')]?_0x484fc5['options']['where']||null:null,'attributes':_0x484fc5['options']?_0x484fc5[_0x0e44('0x1f')][_0x0e44('0x20')]||null:null,'limit':_0x484fc5['options']?_0x484fc5[_0x0e44('0x1f')]['limit']||null:null,'include':_0x484fc5['options']?_0x484fc5[_0x0e44('0x1f')][_0x0e44('0x21')]?_[_0x0e44('0x22')](_0x484fc5['options']['include'],function(_0xf62db5){return{'model':db[_0xf62db5[_0x0e44('0x23')]],'as':_0xf62db5['as'],'attributes':_0xf62db5[_0x0e44('0x20')],'include':_0xf62db5[_0x0e44('0x21')]?_['map'](_0xf62db5[_0x0e44('0x21')],function(_0xe45a05){return{'model':db[_0xe45a05[_0x0e44('0x23')]],'as':_0xe45a05['as'],'attributes':_0xe45a05['attributes'],'include':_0xe45a05[_0x0e44('0x21')]?_[_0x0e44('0x22')](_0xe45a05[_0x0e44('0x21')],function(_0x22ed43){return{'model':db[_0x22ed43[_0x0e44('0x23')]],'as':_0x22ed43['as'],'attributes':_0x22ed43['attributes']};}):[]};}):[]};}):[]:[]})[_0x0e44('0x12')](function(_0x5d14fa){logger[_0x0e44('0x13')](_0x0e44('0x1c'),_0x484fc5);logger['debug'](_0x0e44('0x1c'),_0x484fc5,JSON[_0x0e44('0x17')](_0x5d14fa));_0x15f2e3(_0x5d14fa);})[_0x0e44('0x1b')](function(_0x4e8bbe){logger[_0x0e44('0x18')](_0x0e44('0x1c'),_0x4e8bbe['message'],_0x484fc5);_0x2bb3d3(_0x7221ac[_0x0e44('0x18')](0x1f4,_0x4e8bbe[_0x0e44('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index bb98962..23c8ed3 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 _0x055c=['removeListener','register','length','./voiceExtension.events','save','remove','update'];(function(_0x1857b4,_0x1b6ff0){var _0x19100e=function(_0x322e93){while(--_0x322e93){_0x1857b4['push'](_0x1857b4['shift']());}};_0x19100e(++_0x1b6ff0);}(_0x055c,0x1c3));var _0xc055=function(_0x164af1,_0x3cf772){_0x164af1=_0x164af1-0x0;var _0x5d81a2=_0x055c[_0x164af1];return _0x5d81a2;};'use strict';var VoiceExtensionEvents=require(_0xc055('0x0'));var events=[_0xc055('0x1'),_0xc055('0x2'),_0xc055('0x3')];function createListener(_0x2dfd1f,_0x5e00a8){return function(_0x225b5a){_0x5e00a8['emit'](_0x2dfd1f,_0x225b5a);};}function removeListener(_0x48bc02,_0x2a9fe6){return function(){VoiceExtensionEvents[_0xc055('0x4')](_0x48bc02,_0x2a9fe6);};}exports[_0xc055('0x5')]=function(_0x403364){for(var _0x75bbc3=0x0,_0x1d8baa=events[_0xc055('0x6')];_0x75bbc3<_0x1d8baa;_0x75bbc3++){var _0x2c989f=events[_0x75bbc3];var _0x43c60=createListener('voiceExtension:'+_0x2c989f,_0x403364);VoiceExtensionEvents['on'](_0x2c989f,_0x43c60);}}; \ No newline at end of file +var _0x86be=['./voiceExtension.events','save','update','removeListener','register','length','voiceExtension:'];(function(_0x55bcb4,_0x35ed12){var _0x3ac1b7=function(_0x5d0ee7){while(--_0x5d0ee7){_0x55bcb4['push'](_0x55bcb4['shift']());}};_0x3ac1b7(++_0x35ed12);}(_0x86be,0xe7));var _0xe86b=function(_0x5219e9,_0x3e73fe){_0x5219e9=_0x5219e9-0x0;var _0xa5ff6=_0x86be[_0x5219e9];return _0xa5ff6;};'use strict';var VoiceExtensionEvents=require(_0xe86b('0x0'));var events=[_0xe86b('0x1'),'remove',_0xe86b('0x2')];function createListener(_0x33fddb,_0x2c2254){return function(_0x1818a5){_0x2c2254['emit'](_0x33fddb,_0x1818a5);};}function removeListener(_0x3ef78b,_0x142cb8){return function(){VoiceExtensionEvents[_0xe86b('0x3')](_0x3ef78b,_0x142cb8);};}exports[_0xe86b('0x4')]=function(_0x4f91bd){for(var _0x18e754=0x0,_0x249ed5=events[_0xe86b('0x5')];_0x18e754<_0x249ed5;_0x18e754++){var _0x3ad31f=events[_0x18e754];var _0x328aa4=createListener(_0xe86b('0x6')+_0x3ad31f,_0x4f91bd);VoiceExtensionEvents['on'](_0x3ad31f,_0x328aa4);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index f87a687..8b6bc83 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 _0x6e80=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','update','delete','destroy','exports','multer'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x6e80,0x1cd));var _0x06e8=function(_0x274acb,_0x47715b){_0x274acb=_0x274acb-0x0;var _0x13e2b3=_0x6e80[_0x274acb];return _0x13e2b3;};'use strict';var multer=require(_0x06e8('0x0'));var util=require(_0x06e8('0x1'));var path=require(_0x06e8('0x2'));var timeout=require(_0x06e8('0x3'));var express=require(_0x06e8('0x4'));var router=express['Router']();var auth=require(_0x06e8('0x5'));var interaction=require(_0x06e8('0x6'));var config=require(_0x06e8('0x7'));var controller=require('./voiceMail.controller');router[_0x06e8('0x8')]('/',auth[_0x06e8('0x9')](),controller[_0x06e8('0xa')]);router[_0x06e8('0x8')](_0x06e8('0xb'),auth[_0x06e8('0x9')](),controller[_0x06e8('0xc')]);router['get'](_0x06e8('0xd'),auth[_0x06e8('0x9')](),controller[_0x06e8('0xe')]);router[_0x06e8('0xf')]('/',auth['isAuthenticated'](),controller[_0x06e8('0x10')]);router['put'](_0x06e8('0xb'),auth['isAuthenticated'](),controller[_0x06e8('0x11')]);router[_0x06e8('0x12')](_0x06e8('0xb'),auth['isAuthenticated'](),controller[_0x06e8('0x13')]);module[_0x06e8('0x14')]=router; \ No newline at end of file +var _0x3248=['index','/:id','isAuthenticated','show','/:id/messages','getMessages','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./voiceMail.controller','get'];(function(_0x26c392,_0x4528fe){var _0xc5824d=function(_0x3fb31e){while(--_0x3fb31e){_0x26c392['push'](_0x26c392['shift']());}};_0xc5824d(++_0x4528fe);}(_0x3248,0x1b0));var _0x8324=function(_0x2f36be,_0x3ca82d){_0x2f36be=_0x2f36be-0x0;var _0x247a02=_0x3248[_0x2f36be];return _0x247a02;};'use strict';var multer=require(_0x8324('0x0'));var util=require(_0x8324('0x1'));var path=require(_0x8324('0x2'));var timeout=require(_0x8324('0x3'));var express=require(_0x8324('0x4'));var router=express[_0x8324('0x5')]();var auth=require(_0x8324('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8324('0x7'));router[_0x8324('0x8')]('/',auth['isAuthenticated'](),controller[_0x8324('0x9')]);router[_0x8324('0x8')](_0x8324('0xa'),auth[_0x8324('0xb')](),controller[_0x8324('0xc')]);router['get'](_0x8324('0xd'),auth[_0x8324('0xb')](),controller[_0x8324('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8324('0xf')]);router[_0x8324('0x10')](_0x8324('0xa'),auth['isAuthenticated'](),controller[_0x8324('0x11')]);router[_0x8324('0x12')](_0x8324('0xa'),auth[_0x8324('0xb')](),controller[_0x8324('0x13')]);module[_0x8324('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 0d5f98e..72c7558 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 _0xe5b5=['setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox'];(function(_0x152999,_0x1dd83b){var _0x32ef67=function(_0xe8dc18){while(--_0xe8dc18){_0x152999['push'](_0x152999['shift']());}};_0x32ef67(++_0x1dd83b);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x57b432,_0x1589a0){_0x57b432=_0x57b432-0x0;var _0x2edf2a=_0xe5b5[_0x57b432];return _0x2edf2a;};'use strict';var Sequelize=require(_0x5e5b('0x0'));module[_0x5e5b('0x1')]={'customer_id':{'type':Sequelize[_0x5e5b('0x2')]},'context':{'type':Sequelize[_0x5e5b('0x2')],'defaultValue':_0x5e5b('0x3'),'unique':_0x5e5b('0x4')},'mailbox':{'type':Sequelize[_0x5e5b('0x2')],'defaultValue':'','allowNull':![],'unique':_0x5e5b('0x4')},'password':{'type':Sequelize[_0x5e5b('0x2')]},'fullname':{'type':Sequelize[_0x5e5b('0x2')]},'email':{'type':Sequelize[_0x5e5b('0x2')],'validate':{'isEmail':!![]},'set':function(_0x40bc5b){this[_0x5e5b('0x5')](_0x5e5b('0x6'),typeof _0x40bc5b===_0x5e5b('0x7')&&_0x40bc5b[_0x5e5b('0x8')]()?_0x40bc5b[_0x5e5b('0x8')]():null);}},'pager':{'type':Sequelize[_0x5e5b('0x2')]},'tz':{'type':Sequelize[_0x5e5b('0x2')],'defaultValue':_0x5e5b('0x9')},'attach':{'type':Sequelize[_0x5e5b('0xa')](_0x5e5b('0xb'),'no'),'defaultValue':_0x5e5b('0xb'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x5e5b('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x5e5b('0x2')]},'callback':{'type':Sequelize[_0x5e5b('0x2')]},'review':{'type':Sequelize[_0x5e5b('0xa')](_0x5e5b('0xb'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x5e5b('0xb'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x5e5b('0xa')](_0x5e5b('0xb'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x5e5b('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x5e5b('0xa')](_0x5e5b('0xb'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x5e5b('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x5e5b('0xa')](_0x5e5b('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x5e5b('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x5e5b('0xb'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x5e5b('0xa')](_0x5e5b('0xb'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x5e5b('0xd')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x5e5b('0x2')]},'maxsecs':{'type':Sequelize[_0x5e5b('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x5e5b('0xf')],'get':function(){return this[_0x5e5b('0x10')](_0x5e5b('0x11'))+'\x20-\x20'+this[_0x5e5b('0x10')](_0x5e5b('0x12'));}}}; \ No newline at end of file +var _0xb62e=['central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','sequelize','exports','STRING','contest_mailbox','setDataValue','email','string','trim'];(function(_0x19ec97,_0x4b2bd9){var _0xbff8b7=function(_0x2a99a2){while(--_0x2a99a2){_0x19ec97['push'](_0x19ec97['shift']());}};_0xbff8b7(++_0x4b2bd9);}(_0xb62e,0x1de));var _0xeb62=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xb62e[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0xeb62('0x0'));module[_0xeb62('0x1')]={'customer_id':{'type':Sequelize[_0xeb62('0x2')]},'context':{'type':Sequelize[_0xeb62('0x2')],'defaultValue':'from-voicemail','unique':_0xeb62('0x3')},'mailbox':{'type':Sequelize[_0xeb62('0x2')],'defaultValue':'','allowNull':![],'unique':_0xeb62('0x3')},'password':{'type':Sequelize[_0xeb62('0x2')]},'fullname':{'type':Sequelize[_0xeb62('0x2')]},'email':{'type':Sequelize[_0xeb62('0x2')],'validate':{'isEmail':!![]},'set':function(_0x5bc3c7){this[_0xeb62('0x4')](_0xeb62('0x5'),typeof _0x5bc3c7===_0xeb62('0x6')&&_0x5bc3c7['trim']()?_0x5bc3c7[_0xeb62('0x7')]():null);}},'pager':{'type':Sequelize[_0xeb62('0x2')]},'tz':{'type':Sequelize[_0xeb62('0x2')],'defaultValue':_0xeb62('0x8')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xeb62('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xeb62('0xa')](_0xeb62('0x9'),'no'),'defaultValue':_0xeb62('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xeb62('0x2')]},'callback':{'type':Sequelize[_0xeb62('0x2')]},'review':{'type':Sequelize[_0xeb62('0xa')](_0xeb62('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xeb62('0xa')](_0xeb62('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0xeb62('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xeb62('0xa')](_0xeb62('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xeb62('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xeb62('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xeb62('0xa')](_0xeb62('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xeb62('0x9'),'no'),'defaultValue':_0xeb62('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xeb62('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xeb62('0xa')](_0xeb62('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xeb62('0xa')](_0xeb62('0x9'),'no'),'defaultValue':_0xeb62('0x9'),'allowNull':![]},'stamp':{'type':_0xeb62('0xc')},'emailsubject':{'type':Sequelize[_0xeb62('0x2')]},'emailbody':{'type':Sequelize[_0xeb62('0x2')]},'maxsecs':{'type':Sequelize[_0xeb62('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xeb62('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xeb62('0xe')],'get':function(){return this[_0xeb62('0xf')](_0xeb62('0x10'))+'\x20-\x20'+this[_0xeb62('0xf')](_0xeb62('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 52226aa..8b85af3 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 _0x4639=['VoiceMail','includeAll','include','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','pick','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','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','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','filter','where','merge','type','VIRTUAL','options'];(function(_0x51bfa7,_0x51c8e0){var _0x1cf7ae=function(_0x5e5625){while(--_0x5e5625){_0x51bfa7['push'](_0x51bfa7['shift']());}};_0x1cf7ae(++_0x51c8e0);}(_0x4639,0x115));var _0x9463=function(_0x3a3f6d,_0x42965a){_0x3a3f6d=_0x3a3f6d-0x0;var _0x324bbe=_0x4639[_0x3a3f6d];return _0x324bbe;};'use strict';var pdf=require(_0x9463('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9463('0x1'));var jsonpatch=require(_0x9463('0x2'));var rp=require(_0x9463('0x3'));var moment=require(_0x9463('0x4'));var BPromise=require(_0x9463('0x5'));var Mustache=require(_0x9463('0x6'));var util=require(_0x9463('0x7'));var path=require('path');var sox=require(_0x9463('0x8'));var csv=require(_0x9463('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x9463('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9463('0xb'));var toCsv=require(_0x9463('0x9'));var querystring=require(_0x9463('0xc'));var Papa=require('papaparse');var Redis=require(_0x9463('0xd'));var authService=require(_0x9463('0xe'));var qs=require(_0x9463('0xf'));var as=require(_0x9463('0x10'));var hardwareService=require(_0x9463('0x11'));var logger=require(_0x9463('0x12'))(_0x9463('0x13'));var utils=require(_0x9463('0x14'));var config=require(_0x9463('0x15'));var licenseUtil=require(_0x9463('0x16'));var db=require(_0x9463('0x17'))['db'];function respondWithStatusCode(_0x3b9c65,_0x180cfd){_0x180cfd=_0x180cfd||0xcc;return function(_0x3bb684){if(_0x3bb684){return _0x3b9c65[_0x9463('0x18')](_0x180cfd);}return _0x3b9c65[_0x9463('0x19')](_0x180cfd)[_0x9463('0x1a')]();};}function respondWithResult(_0x24b1ec,_0x14a5e5){_0x14a5e5=_0x14a5e5||0xc8;return function(_0x4a0cd4){if(_0x4a0cd4){return _0x24b1ec[_0x9463('0x19')](_0x14a5e5)['json'](_0x4a0cd4);}};}function respondWithFilteredResult(_0x19259c,_0x281237){return function(_0x1915e5){if(_0x1915e5){var _0x2054a3=_0x1915e5[_0x9463('0x1b')],_0x20c285=_0x281237[_0x9463('0x1c')],_0x5a9e0d=_0x281237['offset']+_0x281237['limit'],_0x3d5a81;if(_0x5a9e0d>=_0x2054a3){_0x5a9e0d=_0x2054a3;_0x3d5a81=0xc8;}else{_0x3d5a81=0xce;}_0x19259c[_0x9463('0x19')](_0x3d5a81);return _0x19259c[_0x9463('0x1d')](_0x9463('0x1e'),_0x20c285+'-'+_0x5a9e0d+'/'+_0x2054a3)[_0x9463('0x1f')](_0x1915e5);}return null;};}function patchUpdates(_0x3655d0){return function(_0x3a6ac2){try{jsonpatch[_0x9463('0x20')](_0x3a6ac2,_0x3655d0,!![]);}catch(_0x77df85){return BPromise[_0x9463('0x21')](_0x77df85);}return _0x3a6ac2[_0x9463('0x22')]();};}function saveUpdates(_0x3d26e4,_0x58d79c){return function(_0x2b9e21){if(_0x2b9e21){return _0x2b9e21[_0x9463('0x23')](_0x3d26e4)[_0x9463('0x24')](function(_0x3aa225){return _0x3aa225;});}return null;};}function removeEntity(_0x545c48,_0x24f85a){return function(_0x44e03d){if(_0x44e03d){return _0x44e03d[_0x9463('0x25')]()[_0x9463('0x24')](function(){var _0x6f0db1=_0x44e03d[_0x9463('0x26')]({'plain':!![]});var _0x214f7e=_0x9463('0x27');return db[_0x9463('0x28')][_0x9463('0x25')]({'where':{'type':_0x214f7e,'resourceId':_0x6f0db1['id']}})[_0x9463('0x24')](function(){return _0x44e03d;});})[_0x9463('0x24')](function(){_0x545c48[_0x9463('0x19')](0xcc)[_0x9463('0x1a')]();});}};}function handleEntityNotFound(_0x62286d,_0x20f9db){return function(_0x41716a){if(!_0x41716a){_0x62286d[_0x9463('0x18')](0x194);}return _0x41716a;};}function handleError(_0x505207,_0x41f190){_0x41f190=_0x41f190||0x1f4;return function(_0x1293fa){logger[_0x9463('0x29')](_0x1293fa[_0x9463('0x2a')]);if(_0x1293fa[_0x9463('0x2b')]){delete _0x1293fa['name'];}_0x505207[_0x9463('0x19')](_0x41f190)['send'](_0x1293fa);};}exports[_0x9463('0x2c')]=function(_0x18723a,_0x1777f7){var _0xb39a03={},_0x196c0b={},_0x26b6a5={'count':0x0,'rows':[]};var _0x18db64=_['map'](db['VoiceMail'][_0x9463('0x2d')],function(_0x23a13f){return{'name':_0x23a13f[_0x9463('0x2e')],'type':_0x23a13f['type'][_0x9463('0x2f')]};});_0x196c0b[_0x9463('0x30')]=_[_0x9463('0x31')](_0x18db64,_0x9463('0x2b'));_0x196c0b[_0x9463('0x32')]=_[_0x9463('0x33')](_0x18723a[_0x9463('0x32')]);_0x196c0b[_0x9463('0x34')]=_[_0x9463('0x35')](_0x196c0b[_0x9463('0x30')],_0x196c0b[_0x9463('0x32')]);_0xb39a03[_0x9463('0x36')]=_[_0x9463('0x35')](_0x196c0b[_0x9463('0x30')],qs[_0x9463('0x37')](_0x18723a[_0x9463('0x32')][_0x9463('0x37')]));_0xb39a03[_0x9463('0x36')]=_0xb39a03[_0x9463('0x36')][_0x9463('0x38')]?_0xb39a03[_0x9463('0x36')]:_0x196c0b['model'];if(!_0x18723a['query']['hasOwnProperty'](_0x9463('0x39'))){_0xb39a03[_0x9463('0x3a')]=qs[_0x9463('0x3a')](_0x18723a[_0x9463('0x32')][_0x9463('0x3a')]);_0xb39a03[_0x9463('0x1c')]=qs[_0x9463('0x1c')](_0x18723a[_0x9463('0x32')][_0x9463('0x1c')]);}_0xb39a03[_0x9463('0x3b')]=qs[_0x9463('0x3c')](_0x18723a[_0x9463('0x32')][_0x9463('0x3c')]);_0xb39a03['where']=qs[_0x9463('0x34')](_['pick'](_0x18723a[_0x9463('0x32')],_0x196c0b['filters']),_0x18db64);if(_0x18723a[_0x9463('0x32')][_0x9463('0x3d')]){_0xb39a03[_0x9463('0x3e')]=_[_0x9463('0x3f')](_0xb39a03[_0x9463('0x3e')],{'$or':_[_0x9463('0x31')](_0x18db64,function(_0x520582){if(_0x520582[_0x9463('0x40')]!==_0x9463('0x41')){var _0x8c74e4={};_0x8c74e4[_0x520582[_0x9463('0x2b')]]={'$like':'%'+_0x18723a[_0x9463('0x32')][_0x9463('0x3d')]+'%'};return _0x8c74e4;}})});}_0xb39a03=_[_0x9463('0x3f')]({},_0xb39a03,_0x18723a[_0x9463('0x42')]);var _0x12f412={'where':_0xb39a03[_0x9463('0x3e')]};return db[_0x9463('0x43')][_0x9463('0x1b')](_0x12f412)[_0x9463('0x24')](function(_0x329e8d){_0x26b6a5[_0x9463('0x1b')]=_0x329e8d;if(_0x18723a[_0x9463('0x32')][_0x9463('0x44')]){_0xb39a03[_0x9463('0x45')]=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0xb39a03);})[_0x9463('0x24')](function(_0x193958){_0x26b6a5[_0x9463('0x46')]=_0x193958;return _0x26b6a5;})[_0x9463('0x24')](respondWithFilteredResult(_0x1777f7,_0xb39a03))['catch'](handleError(_0x1777f7,null));};exports[_0x9463('0x47')]=function(_0x529283,_0x196621){var _0x5aa9c2={'raw':!![],'where':{'id':_0x529283[_0x9463('0x48')]['id']}},_0x3c1d5d={};_0x3c1d5d['model']=_[_0x9463('0x33')](db[_0x9463('0x43')]['rawAttributes']);_0x3c1d5d[_0x9463('0x32')]=_[_0x9463('0x33')](_0x529283[_0x9463('0x32')]);_0x3c1d5d[_0x9463('0x34')]=_[_0x9463('0x35')](_0x3c1d5d[_0x9463('0x30')],_0x3c1d5d[_0x9463('0x32')]);_0x5aa9c2[_0x9463('0x36')]=_[_0x9463('0x35')](_0x3c1d5d[_0x9463('0x30')],qs[_0x9463('0x37')](_0x529283[_0x9463('0x32')][_0x9463('0x37')]));_0x5aa9c2['attributes']=_0x5aa9c2[_0x9463('0x36')]['length']?_0x5aa9c2[_0x9463('0x36')]:_0x3c1d5d[_0x9463('0x30')];if(_0x529283['query']['includeAll']){_0x5aa9c2['include']=[{'all':!![]}];}_0x5aa9c2=_[_0x9463('0x3f')]({},_0x5aa9c2,_0x529283['options']);return db['VoiceMail'][_0x9463('0x49')](_0x5aa9c2)[_0x9463('0x24')](handleEntityNotFound(_0x196621,null))[_0x9463('0x24')](respondWithResult(_0x196621,null))[_0x9463('0x4a')](handleError(_0x196621,null));};exports['create']=function(_0x4b375f,_0x3dd231){return db[_0x9463('0x43')][_0x9463('0x4b')](_0x4b375f[_0x9463('0x4c')],{})[_0x9463('0x24')](function(_0x2b6277){var _0xf6a53e=_0x4b375f[_0x9463('0x4d')][_0x9463('0x26')]({'plain':!![]});if(!_0xf6a53e)throw new Error(_0x9463('0x4e'));if(_0xf6a53e['role']===_0x9463('0x4d')){var _0x465f68=_0x2b6277['get']({'plain':!![]});var _0x400485=_0x9463('0x27');return db[_0x9463('0x4f')]['find']({'where':{'name':_0x400485,'userProfileId':_0xf6a53e[_0x9463('0x50')]},'raw':!![]})[_0x9463('0x24')](function(_0x25385e){if(_0x25385e&&_0x25385e['autoAssociation']===0x0){return db[_0x9463('0x28')][_0x9463('0x4b')]({'name':_0x465f68[_0x9463('0x2b')],'resourceId':_0x465f68['id'],'type':_0x25385e[_0x9463('0x2b')],'sectionId':_0x25385e['id']},{})['then'](function(){return _0x2b6277;});}else{return _0x2b6277;}})[_0x9463('0x4a')](function(_0x1f84f3){logger[_0x9463('0x29')](_0x9463('0x51'),_0x1f84f3);throw _0x1f84f3;});}return _0x2b6277;})[_0x9463('0x24')](respondWithResult(_0x3dd231,0xc9))['catch'](handleError(_0x3dd231,null));};exports[_0x9463('0x23')]=function(_0x1fdc0c,_0x12c50a){if(_0x1fdc0c['body']['id']){delete _0x1fdc0c[_0x9463('0x4c')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0x1fdc0c[_0x9463('0x48')]['id']}})[_0x9463('0x24')](handleEntityNotFound(_0x12c50a,null))['then'](saveUpdates(_0x1fdc0c[_0x9463('0x4c')],null))[_0x9463('0x24')](respondWithResult(_0x12c50a,null))[_0x9463('0x4a')](handleError(_0x12c50a,null));};exports[_0x9463('0x25')]=function(_0x4cc7bb,_0x2b1204){return db[_0x9463('0x43')][_0x9463('0x49')]({'where':{'id':_0x4cc7bb[_0x9463('0x48')]['id']}})[_0x9463('0x24')](handleEntityNotFound(_0x2b1204,null))[_0x9463('0x24')](removeEntity(_0x2b1204,null))['catch'](handleError(_0x2b1204,null));};exports[_0x9463('0x52')]=function(_0x2373bd,_0x248da6,_0x4f0cf2){return db[_0x9463('0x43')][_0x9463('0x53')]({'where':{'id':_0x2373bd[_0x9463('0x48')]['id']}})[_0x9463('0x24')](handleEntityNotFound(_0x248da6,null))['then'](function(_0x52d69b){var _0x5eae1d;var _0x104218={},_0x505e96={};_0x505e96[_0x9463('0x30')]=_[_0x9463('0x33')](db[_0x9463('0x54')]['rawAttributes']);_0x505e96[_0x9463('0x32')]=_[_0x9463('0x33')](_0x2373bd['query']);_0x505e96[_0x9463('0x34')]=_[_0x9463('0x35')](_0x505e96[_0x9463('0x30')],_0x505e96[_0x9463('0x32')]);_0x104218[_0x9463('0x36')]=_[_0x9463('0x35')](_0x505e96[_0x9463('0x30')],qs[_0x9463('0x37')](_0x2373bd['query'][_0x9463('0x37')]));_0x104218[_0x9463('0x36')]=_0x104218[_0x9463('0x36')][_0x9463('0x38')]?_0x104218[_0x9463('0x36')]:_0x505e96['model'];if(!_0x2373bd[_0x9463('0x32')]['hasOwnProperty']('nolimit')){_0x104218[_0x9463('0x3a')]=qs[_0x9463('0x3a')](_0x2373bd[_0x9463('0x32')][_0x9463('0x3a')]);_0x104218[_0x9463('0x1c')]=qs[_0x9463('0x1c')](_0x2373bd[_0x9463('0x32')][_0x9463('0x1c')]);}_0x104218[_0x9463('0x3b')]=qs[_0x9463('0x3c')](_0x2373bd[_0x9463('0x32')][_0x9463('0x3c')]);_0x104218[_0x9463('0x3e')]=qs[_0x9463('0x34')](_[_0x9463('0x55')](_0x2373bd[_0x9463('0x32')],_0x505e96[_0x9463('0x34')]));if(_0x2373bd[_0x9463('0x32')][_0x9463('0x3d')]){_0x104218['where']=_[_0x9463('0x3f')](_0x104218[_0x9463('0x3e')],{'$or':_[_0x9463('0x31')](_0x104218[_0x9463('0x36')],function(_0x1af8ab){var _0x1c76bb={};_0x1c76bb[_0x1af8ab]={'$like':'%'+_0x2373bd[_0x9463('0x32')][_0x9463('0x3d')]+'%'};return _0x1c76bb;})});}_0x104218[_0x9463('0x3e')]=_[_0x9463('0x3f')](_0x104218['where'],{'mailboxuser':_0x52d69b['mailbox']});_0x104218=_[_0x9463('0x3f')]({},_0x104218,_0x2373bd[_0x9463('0x42')]);return db[_0x9463('0x54')]['findAndCountAll'](_0x104218)[_0x9463('0x24')](respondWithFilteredResult(_0x248da6,_0x104218));})[_0x9463('0x4a')](handleError(_0x248da6,null));}; \ No newline at end of file +var _0xd4a2=['keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','count','include','findAll','rows','show','params','rawAttributes','options','find','create','body','user','role','UserProfileSection','userProfileId','catch','getMessages','findOne','VoiceMailMessage','nolimit','pick','mailbox','html-pdf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','map','VoiceMail','fieldName','type','key','model','query'];(function(_0x4bda36,_0xf55fdd){var _0x186e06=function(_0x2cc919){while(--_0x2cc919){_0x4bda36['push'](_0x4bda36['shift']());}};_0x186e06(++_0xf55fdd);}(_0xd4a2,0x173));var _0x2d4a=function(_0x42bb42,_0x3fd19){_0x42bb42=_0x42bb42-0x0;var _0x1079af=_0xd4a2[_0x42bb42];return _0x1079af;};'use strict';var pdf=require(_0x2d4a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2d4a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2d4a('0x2'));var moment=require('moment');var BPromise=require(_0x2d4a('0x3'));var Mustache=require('mustache');var util=require(_0x2d4a('0x4'));var path=require(_0x2d4a('0x5'));var sox=require(_0x2d4a('0x6'));var csv=require(_0x2d4a('0x7'));var ejs=require(_0x2d4a('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2d4a('0x9'));var crypto=require(_0x2d4a('0xa'));var jsforce=require(_0x2d4a('0xb'));var deskjs=require(_0x2d4a('0xc'));var toCsv=require(_0x2d4a('0x7'));var querystring=require(_0x2d4a('0xd'));var Papa=require(_0x2d4a('0xe'));var Redis=require(_0x2d4a('0xf'));var authService=require(_0x2d4a('0x10'));var qs=require(_0x2d4a('0x11'));var as=require(_0x2d4a('0x12'));var hardwareService=require(_0x2d4a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2d4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2d4a('0x15'));var db=require(_0x2d4a('0x16'))['db'];function respondWithStatusCode(_0x45b9fb,_0x5ac803){_0x5ac803=_0x5ac803||0xcc;return function(_0x2f785f){if(_0x2f785f){return _0x45b9fb[_0x2d4a('0x17')](_0x5ac803);}return _0x45b9fb[_0x2d4a('0x18')](_0x5ac803)[_0x2d4a('0x19')]();};}function respondWithResult(_0x544622,_0x4be8b4){_0x4be8b4=_0x4be8b4||0xc8;return function(_0x2a1d0f){if(_0x2a1d0f){return _0x544622['status'](_0x4be8b4)[_0x2d4a('0x1a')](_0x2a1d0f);}};}function respondWithFilteredResult(_0x175bda,_0x11896d){return function(_0x3a3156){if(_0x3a3156){var _0x4c5287=_0x3a3156['count'],_0x5f825d=_0x11896d[_0x2d4a('0x1b')],_0x5a6378=_0x11896d[_0x2d4a('0x1b')]+_0x11896d[_0x2d4a('0x1c')],_0x2838fa;if(_0x5a6378>=_0x4c5287){_0x5a6378=_0x4c5287;_0x2838fa=0xc8;}else{_0x2838fa=0xce;}_0x175bda[_0x2d4a('0x18')](_0x2838fa);return _0x175bda['set']('Content-Range',_0x5f825d+'-'+_0x5a6378+'/'+_0x4c5287)['json'](_0x3a3156);}return null;};}function patchUpdates(_0x12afd7){return function(_0x1966d1){try{jsonpatch[_0x2d4a('0x1d')](_0x1966d1,_0x12afd7,!![]);}catch(_0x419df5){return BPromise[_0x2d4a('0x1e')](_0x419df5);}return _0x1966d1[_0x2d4a('0x1f')]();};}function saveUpdates(_0x56445a,_0x49f378){return function(_0x3eabe5){if(_0x3eabe5){return _0x3eabe5[_0x2d4a('0x20')](_0x56445a)[_0x2d4a('0x21')](function(_0x17d72e){return _0x17d72e;});}return null;};}function removeEntity(_0x1a2d20,_0x2e7736){return function(_0x22dd0b){if(_0x22dd0b){return _0x22dd0b[_0x2d4a('0x22')]()['then'](function(){var _0x26e7b8=_0x22dd0b[_0x2d4a('0x23')]({'plain':!![]});var _0x2c3799=_0x2d4a('0x24');return db[_0x2d4a('0x25')][_0x2d4a('0x22')]({'where':{'type':_0x2c3799,'resourceId':_0x26e7b8['id']}})[_0x2d4a('0x21')](function(){return _0x22dd0b;});})[_0x2d4a('0x21')](function(){_0x1a2d20['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cc7d8,_0x2bb9f0){return function(_0x5029f3){if(!_0x5029f3){_0x5cc7d8[_0x2d4a('0x17')](0x194);}return _0x5029f3;};}function handleError(_0x3a2fd3,_0x3d5558){_0x3d5558=_0x3d5558||0x1f4;return function(_0x1d2fa6){logger[_0x2d4a('0x26')](_0x1d2fa6[_0x2d4a('0x27')]);if(_0x1d2fa6[_0x2d4a('0x28')]){delete _0x1d2fa6[_0x2d4a('0x28')];}_0x3a2fd3['status'](_0x3d5558)[_0x2d4a('0x29')](_0x1d2fa6);};}exports['index']=function(_0x221602,_0x9bac28){var _0xc497ce={},_0x20b87d={},_0x101382={'count':0x0,'rows':[]};var _0x1dfc5d=_[_0x2d4a('0x2a')](db[_0x2d4a('0x2b')]['rawAttributes'],function(_0x45a4fa){return{'name':_0x45a4fa[_0x2d4a('0x2c')],'type':_0x45a4fa[_0x2d4a('0x2d')][_0x2d4a('0x2e')]};});_0x20b87d[_0x2d4a('0x2f')]=_['map'](_0x1dfc5d,_0x2d4a('0x28'));_0x20b87d[_0x2d4a('0x30')]=_[_0x2d4a('0x31')](_0x221602[_0x2d4a('0x30')]);_0x20b87d[_0x2d4a('0x32')]=_['intersection'](_0x20b87d[_0x2d4a('0x2f')],_0x20b87d[_0x2d4a('0x30')]);_0xc497ce[_0x2d4a('0x33')]=_[_0x2d4a('0x34')](_0x20b87d[_0x2d4a('0x2f')],qs[_0x2d4a('0x35')](_0x221602['query'][_0x2d4a('0x35')]));_0xc497ce[_0x2d4a('0x33')]=_0xc497ce[_0x2d4a('0x33')][_0x2d4a('0x36')]?_0xc497ce[_0x2d4a('0x33')]:_0x20b87d['model'];if(!_0x221602[_0x2d4a('0x30')][_0x2d4a('0x37')]('nolimit')){_0xc497ce[_0x2d4a('0x1c')]=qs[_0x2d4a('0x1c')](_0x221602[_0x2d4a('0x30')][_0x2d4a('0x1c')]);_0xc497ce[_0x2d4a('0x1b')]=qs[_0x2d4a('0x1b')](_0x221602['query'][_0x2d4a('0x1b')]);}_0xc497ce[_0x2d4a('0x38')]=qs[_0x2d4a('0x39')](_0x221602[_0x2d4a('0x30')][_0x2d4a('0x39')]);_0xc497ce[_0x2d4a('0x3a')]=qs['filters'](_['pick'](_0x221602[_0x2d4a('0x30')],_0x20b87d['filters']),_0x1dfc5d);if(_0x221602[_0x2d4a('0x30')][_0x2d4a('0x3b')]){_0xc497ce['where']=_[_0x2d4a('0x3c')](_0xc497ce[_0x2d4a('0x3a')],{'$or':_[_0x2d4a('0x2a')](_0x1dfc5d,function(_0x1035b9){if(_0x1035b9[_0x2d4a('0x2d')]!==_0x2d4a('0x3d')){var _0x441837={};_0x441837[_0x1035b9[_0x2d4a('0x28')]]={'$like':'%'+_0x221602[_0x2d4a('0x30')][_0x2d4a('0x3b')]+'%'};return _0x441837;}})});}_0xc497ce=_[_0x2d4a('0x3c')]({},_0xc497ce,_0x221602['options']);var _0x8bc995={'where':_0xc497ce[_0x2d4a('0x3a')]};return db[_0x2d4a('0x2b')][_0x2d4a('0x3e')](_0x8bc995)[_0x2d4a('0x21')](function(_0x483a40){_0x101382['count']=_0x483a40;if(_0x221602['query']['includeAll']){_0xc497ce[_0x2d4a('0x3f')]=[{'all':!![]}];}return db[_0x2d4a('0x2b')][_0x2d4a('0x40')](_0xc497ce);})[_0x2d4a('0x21')](function(_0x4c34da){_0x101382[_0x2d4a('0x41')]=_0x4c34da;return _0x101382;})[_0x2d4a('0x21')](respondWithFilteredResult(_0x9bac28,_0xc497ce))['catch'](handleError(_0x9bac28,null));};exports[_0x2d4a('0x42')]=function(_0x13b0f0,_0x8a9375){var _0x13970c={'raw':!![],'where':{'id':_0x13b0f0[_0x2d4a('0x43')]['id']}},_0x1ad852={};_0x1ad852['model']=_[_0x2d4a('0x31')](db[_0x2d4a('0x2b')][_0x2d4a('0x44')]);_0x1ad852[_0x2d4a('0x30')]=_[_0x2d4a('0x31')](_0x13b0f0[_0x2d4a('0x30')]);_0x1ad852['filters']=_[_0x2d4a('0x34')](_0x1ad852[_0x2d4a('0x2f')],_0x1ad852[_0x2d4a('0x30')]);_0x13970c['attributes']=_[_0x2d4a('0x34')](_0x1ad852['model'],qs[_0x2d4a('0x35')](_0x13b0f0[_0x2d4a('0x30')][_0x2d4a('0x35')]));_0x13970c[_0x2d4a('0x33')]=_0x13970c[_0x2d4a('0x33')]['length']?_0x13970c['attributes']:_0x1ad852[_0x2d4a('0x2f')];if(_0x13b0f0[_0x2d4a('0x30')]['includeAll']){_0x13970c[_0x2d4a('0x3f')]=[{'all':!![]}];}_0x13970c=_['merge']({},_0x13970c,_0x13b0f0[_0x2d4a('0x45')]);return db[_0x2d4a('0x2b')][_0x2d4a('0x46')](_0x13970c)['then'](handleEntityNotFound(_0x8a9375,null))[_0x2d4a('0x21')](respondWithResult(_0x8a9375,null))['catch'](handleError(_0x8a9375,null));};exports[_0x2d4a('0x47')]=function(_0x14eeda,_0x3c7a80){return db[_0x2d4a('0x2b')][_0x2d4a('0x47')](_0x14eeda[_0x2d4a('0x48')],{})[_0x2d4a('0x21')](function(_0x2b2f4b){var _0x1ffb96=_0x14eeda[_0x2d4a('0x49')][_0x2d4a('0x23')]({'plain':!![]});if(!_0x1ffb96)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ffb96[_0x2d4a('0x4a')]===_0x2d4a('0x49')){var _0x3336b2=_0x2b2f4b[_0x2d4a('0x23')]({'plain':!![]});var _0x2d2e24='Voicemails';return db[_0x2d4a('0x4b')][_0x2d4a('0x46')]({'where':{'name':_0x2d2e24,'userProfileId':_0x1ffb96[_0x2d4a('0x4c')]},'raw':!![]})[_0x2d4a('0x21')](function(_0x2f038a){if(_0x2f038a&&_0x2f038a['autoAssociation']===0x0){return db['UserProfileResource'][_0x2d4a('0x47')]({'name':_0x3336b2[_0x2d4a('0x28')],'resourceId':_0x3336b2['id'],'type':_0x2f038a['name'],'sectionId':_0x2f038a['id']},{})[_0x2d4a('0x21')](function(){return _0x2b2f4b;});}else{return _0x2b2f4b;}})[_0x2d4a('0x4d')](function(_0x7f0807){logger[_0x2d4a('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x7f0807);throw _0x7f0807;});}return _0x2b2f4b;})[_0x2d4a('0x21')](respondWithResult(_0x3c7a80,0xc9))['catch'](handleError(_0x3c7a80,null));};exports[_0x2d4a('0x20')]=function(_0x3fe91b,_0x298fed){if(_0x3fe91b[_0x2d4a('0x48')]['id']){delete _0x3fe91b[_0x2d4a('0x48')]['id'];}return db[_0x2d4a('0x2b')][_0x2d4a('0x46')]({'where':{'id':_0x3fe91b[_0x2d4a('0x43')]['id']}})['then'](handleEntityNotFound(_0x298fed,null))[_0x2d4a('0x21')](saveUpdates(_0x3fe91b[_0x2d4a('0x48')],null))[_0x2d4a('0x21')](respondWithResult(_0x298fed,null))[_0x2d4a('0x4d')](handleError(_0x298fed,null));};exports[_0x2d4a('0x22')]=function(_0x334d6a,_0x142b8c){return db[_0x2d4a('0x2b')][_0x2d4a('0x46')]({'where':{'id':_0x334d6a[_0x2d4a('0x43')]['id']}})[_0x2d4a('0x21')](handleEntityNotFound(_0x142b8c,null))[_0x2d4a('0x21')](removeEntity(_0x142b8c,null))[_0x2d4a('0x4d')](handleError(_0x142b8c,null));};exports[_0x2d4a('0x4e')]=function(_0x1ce950,_0x268a2f,_0x1e18a9){return db['VoiceMail'][_0x2d4a('0x4f')]({'where':{'id':_0x1ce950[_0x2d4a('0x43')]['id']}})['then'](handleEntityNotFound(_0x268a2f,null))[_0x2d4a('0x21')](function(_0x343f25){var _0x1f0b2b;var _0x228741={},_0x165c00={};_0x165c00[_0x2d4a('0x2f')]=_[_0x2d4a('0x31')](db[_0x2d4a('0x50')][_0x2d4a('0x44')]);_0x165c00[_0x2d4a('0x30')]=_[_0x2d4a('0x31')](_0x1ce950[_0x2d4a('0x30')]);_0x165c00['filters']=_[_0x2d4a('0x34')](_0x165c00[_0x2d4a('0x2f')],_0x165c00['query']);_0x228741[_0x2d4a('0x33')]=_[_0x2d4a('0x34')](_0x165c00[_0x2d4a('0x2f')],qs[_0x2d4a('0x35')](_0x1ce950[_0x2d4a('0x30')][_0x2d4a('0x35')]));_0x228741[_0x2d4a('0x33')]=_0x228741[_0x2d4a('0x33')][_0x2d4a('0x36')]?_0x228741[_0x2d4a('0x33')]:_0x165c00['model'];if(!_0x1ce950[_0x2d4a('0x30')][_0x2d4a('0x37')](_0x2d4a('0x51'))){_0x228741['limit']=qs[_0x2d4a('0x1c')](_0x1ce950[_0x2d4a('0x30')][_0x2d4a('0x1c')]);_0x228741[_0x2d4a('0x1b')]=qs[_0x2d4a('0x1b')](_0x1ce950[_0x2d4a('0x30')][_0x2d4a('0x1b')]);}_0x228741[_0x2d4a('0x38')]=qs[_0x2d4a('0x39')](_0x1ce950['query'][_0x2d4a('0x39')]);_0x228741[_0x2d4a('0x3a')]=qs[_0x2d4a('0x32')](_[_0x2d4a('0x52')](_0x1ce950[_0x2d4a('0x30')],_0x165c00[_0x2d4a('0x32')]));if(_0x1ce950['query'][_0x2d4a('0x3b')]){_0x228741[_0x2d4a('0x3a')]=_[_0x2d4a('0x3c')](_0x228741['where'],{'$or':_[_0x2d4a('0x2a')](_0x228741[_0x2d4a('0x33')],function(_0x4f4a09){var _0x2b0e4c={};_0x2b0e4c[_0x4f4a09]={'$like':'%'+_0x1ce950[_0x2d4a('0x30')]['filter']+'%'};return _0x2b0e4c;})});}_0x228741[_0x2d4a('0x3a')]=_['merge'](_0x228741['where'],{'mailboxuser':_0x343f25[_0x2d4a('0x53')]});_0x228741=_[_0x2d4a('0x3c')]({},_0x228741,_0x1ce950[_0x2d4a('0x45')]);return db[_0x2d4a('0x50')]['findAndCountAll'](_0x228741)[_0x2d4a('0x21')](respondWithFilteredResult(_0x268a2f,_0x228741));})[_0x2d4a('0x4d')](handleError(_0x268a2f,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 8ed5a3d..e44aed8 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 _0xa9d6=['mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','mailbox_context'];(function(_0x1e6a22,_0x203deb){var _0x3cc6aa=function(_0x2d5cc9){while(--_0x2d5cc9){_0x1e6a22['push'](_0x1e6a22['shift']());}};_0x3cc6aa(++_0x203deb);}(_0xa9d6,0x1ef));var _0x6a9d=function(_0x5cd821,_0x1c58b2){_0x5cd821=_0x5cd821-0x0;var _0x5765e3=_0xa9d6[_0x5cd821];return _0x5765e3;};'use strict';var _=require(_0x6a9d('0x0'));var util=require(_0x6a9d('0x1'));var logger=require(_0x6a9d('0x2'))(_0x6a9d('0x3'));var moment=require(_0x6a9d('0x4'));var BPromise=require(_0x6a9d('0x5'));var rp=require(_0x6a9d('0x6'));var fs=require('fs');var path=require(_0x6a9d('0x7'));var rimraf=require(_0x6a9d('0x8'));var config=require(_0x6a9d('0x9'));var attributes=require(_0x6a9d('0xa'));module[_0x6a9d('0xb')]=function(_0x51b14c,_0x1615aa){return _0x51b14c[_0x6a9d('0xc')](_0x6a9d('0xd'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x6a9d('0xe'),'fields':[_0x6a9d('0xf'),_0x6a9d('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6c99=['define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./voiceMail.attributes'];(function(_0x292a2e,_0x5ddad6){var _0x2646e0=function(_0x3c6e04){while(--_0x3c6e04){_0x292a2e['push'](_0x292a2e['shift']());}};_0x2646e0(++_0x5ddad6);}(_0x6c99,0x19b));var _0x96c9=function(_0xdd82b4,_0x5cd8b8){_0xdd82b4=_0xdd82b4-0x0;var _0x549bb2=_0x6c99[_0xdd82b4];return _0x549bb2;};'use strict';var _=require(_0x96c9('0x0'));var util=require(_0x96c9('0x1'));var logger=require(_0x96c9('0x2'))(_0x96c9('0x3'));var moment=require('moment');var BPromise=require(_0x96c9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x96c9('0x5'));var rimraf=require(_0x96c9('0x6'));var config=require(_0x96c9('0x7'));var attributes=require(_0x96c9('0x8'));module['exports']=function(_0x5f230a,_0x4344fc){return _0x5f230a[_0x96c9('0x9')](_0x96c9('0xa'),attributes,{'tableName':_0x96c9('0xb'),'paranoid':![],'indexes':[{'name':_0x96c9('0xc'),'fields':[_0x96c9('0xd'),_0x96c9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 1c0b064..5255adc 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 _0xd85b=['error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd85b,0x7b));var _0xbd85=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd85b[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xbd85('0x0'));var util=require(_0xbd85('0x1'));var moment=require(_0xbd85('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd85('0x3'));var fs=require('fs');var Redis=require(_0xbd85('0x4'));var db=require(_0xbd85('0x5'))['db'];var utils=require(_0xbd85('0x6'));var logger=require(_0xbd85('0x7'))(_0xbd85('0x8'));var config=require(_0xbd85('0x9'));var jayson=require(_0xbd85('0xa'));var client=jayson[_0xbd85('0xb')][_0xbd85('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x10595e,_0x51c3e5,_0x494a9f){return new BPromise(function(_0x23684a,_0x3d0bab){return client[_0xbd85('0xd')](_0x10595e,_0x494a9f)[_0xbd85('0xe')](function(_0x5445b0){logger[_0xbd85('0xf')](_0xbd85('0x10'),_0x51c3e5,_0xbd85('0x11'));logger[_0xbd85('0x12')](_0xbd85('0x13'),_0x51c3e5,'request\x20sent',JSON[_0xbd85('0x14')](_0x5445b0));if(_0x5445b0['error']){if(_0x5445b0[_0xbd85('0x15')][_0xbd85('0x16')]===0x1f4){logger[_0xbd85('0x15')](_0xbd85('0x10'),_0x51c3e5,_0x5445b0[_0xbd85('0x15')][_0xbd85('0x17')]);return _0x3d0bab(_0x5445b0[_0xbd85('0x15')][_0xbd85('0x17')]);}logger[_0xbd85('0x15')]('VoiceMail,\x20%s,\x20%s',_0x51c3e5,_0x5445b0[_0xbd85('0x15')]['message']);return _0x23684a(_0x5445b0['error'][_0xbd85('0x17')]);}else{logger[_0xbd85('0xf')](_0xbd85('0x10'),_0x51c3e5,_0xbd85('0x11'));_0x23684a(_0x5445b0['result'][_0xbd85('0x17')]);}})['catch'](function(_0x11a39f){logger['error'](_0xbd85('0x10'),_0x51c3e5,_0x11a39f);_0x3d0bab(_0x11a39f);});});} \ No newline at end of file +var _0x0dd2=['message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','info','result'];(function(_0x1c1cdc,_0x5bed74){var _0xf36213=function(_0x58e9ee){while(--_0x58e9ee){_0x1c1cdc['push'](_0x1c1cdc['shift']());}};_0xf36213(++_0x5bed74);}(_0x0dd2,0x120));var _0x20dd=function(_0x491ec2,_0x540c00){_0x491ec2=_0x491ec2-0x0;var _0x1748db=_0x0dd2[_0x491ec2];return _0x1748db;};'use strict';var _=require(_0x20dd('0x0'));var util=require(_0x20dd('0x1'));var moment=require(_0x20dd('0x2'));var BPromise=require(_0x20dd('0x3'));var rs=require(_0x20dd('0x4'));var fs=require('fs');var Redis=require(_0x20dd('0x5'));var db=require(_0x20dd('0x6'))['db'];var utils=require(_0x20dd('0x7'));var logger=require(_0x20dd('0x8'))(_0x20dd('0x9'));var config=require(_0x20dd('0xa'));var jayson=require(_0x20dd('0xb'));var client=jayson[_0x20dd('0xc')][_0x20dd('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x46905a,_0x3fdc9f,_0x2773e6){return new BPromise(function(_0x2b5bec,_0x2f6545){return client['request'](_0x46905a,_0x2773e6)[_0x20dd('0xe')](function(_0x5d2ebd){logger['info'](_0x20dd('0xf'),_0x3fdc9f,_0x20dd('0x10'));logger[_0x20dd('0x11')](_0x20dd('0x12'),_0x3fdc9f,_0x20dd('0x10'),JSON[_0x20dd('0x13')](_0x5d2ebd));if(_0x5d2ebd['error']){if(_0x5d2ebd[_0x20dd('0x14')][_0x20dd('0x15')]===0x1f4){logger[_0x20dd('0x14')](_0x20dd('0xf'),_0x3fdc9f,_0x5d2ebd['error']['message']);return _0x2f6545(_0x5d2ebd[_0x20dd('0x14')]['message']);}logger[_0x20dd('0x14')](_0x20dd('0xf'),_0x3fdc9f,_0x5d2ebd[_0x20dd('0x14')]['message']);return _0x2b5bec(_0x5d2ebd[_0x20dd('0x14')]['message']);}else{logger[_0x20dd('0x16')](_0x20dd('0xf'),_0x3fdc9f,_0x20dd('0x10'));_0x2b5bec(_0x5d2ebd[_0x20dd('0x17')][_0x20dd('0x18')]);}})[_0x20dd('0x19')](function(_0x21fbb6){logger[_0x20dd('0x14')](_0x20dd('0xf'),_0x3fdc9f,_0x21fbb6);_0x2f6545(_0x21fbb6);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index fc50946..9cde170 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 _0xc49d=['express','Router','../../components/auth/service','./voiceMailMessage.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','util','connect-timeout'];(function(_0x40e114,_0x278b52){var _0x2e9542=function(_0x36b70){while(--_0x36b70){_0x40e114['push'](_0x40e114['shift']());}};_0x2e9542(++_0x278b52);}(_0xc49d,0x7e));var _0xdc49=function(_0x439e23,_0x10c26c){_0x439e23=_0x439e23-0x0;var _0x393695=_0xc49d[_0x439e23];return _0x393695;};'use strict';var multer=require('multer');var util=require(_0xdc49('0x0'));var path=require('path');var timeout=require(_0xdc49('0x1'));var express=require(_0xdc49('0x2'));var router=express[_0xdc49('0x3')]();var auth=require(_0xdc49('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xdc49('0x5'));router[_0xdc49('0x6')]('/',auth[_0xdc49('0x7')](),controller['index']);router[_0xdc49('0x6')]('/:id',auth[_0xdc49('0x7')](),controller[_0xdc49('0x8')]);router['get']('/:id/download',auth[_0xdc49('0x7')](),controller['download']);router[_0xdc49('0x9')]('/',auth[_0xdc49('0x7')](),controller[_0xdc49('0xa')]);router[_0xdc49('0xb')](_0xdc49('0xc'),auth[_0xdc49('0x7')](),controller[_0xdc49('0xd')]);router[_0xdc49('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xdc49('0xf')]);module['exports']=router; \ No newline at end of file +var _0x5cbc=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','get','/:id','show','download','create'];(function(_0x27a4fd,_0x58c682){var _0x36da10=function(_0x5ce278){while(--_0x5ce278){_0x27a4fd['push'](_0x27a4fd['shift']());}};_0x36da10(++_0x58c682);}(_0x5cbc,0x11d));var _0xc5cb=function(_0x301b64,_0x19a3f0){_0x301b64=_0x301b64-0x0;var _0x2b30ca=_0x5cbc[_0x301b64];return _0x2b30ca;};'use strict';var multer=require(_0xc5cb('0x0'));var util=require('util');var path=require(_0xc5cb('0x1'));var timeout=require(_0xc5cb('0x2'));var express=require(_0xc5cb('0x3'));var router=express['Router']();var auth=require(_0xc5cb('0x4'));var interaction=require(_0xc5cb('0x5'));var config=require(_0xc5cb('0x6'));var controller=require(_0xc5cb('0x7'));router['get']('/',auth[_0xc5cb('0x8')](),controller[_0xc5cb('0x9')]);router[_0xc5cb('0xa')](_0xc5cb('0xb'),auth['isAuthenticated'](),controller[_0xc5cb('0xc')]);router[_0xc5cb('0xa')]('/:id/download',auth[_0xc5cb('0x8')](),controller[_0xc5cb('0xd')]);router['post']('/',auth[_0xc5cb('0x8')](),controller[_0xc5cb('0xe')]);router[_0xc5cb('0xf')]('/:id',auth[_0xc5cb('0x8')](),controller[_0xc5cb('0x10')]);router[_0xc5cb('0x11')](_0xc5cb('0xb'),auth[_0xc5cb('0x8')](),controller[_0xc5cb('0x12')]);module[_0xc5cb('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 0850a34..b6f43c7 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 _0xba3e=['long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','STRING','BLOB'];(function(_0xc0cf48,_0x4c588d){var _0x1314d8=function(_0x1cebb7){while(--_0x1cebb7){_0xc0cf48['push'](_0xc0cf48['shift']());}};_0x1314d8(++_0x4c588d);}(_0xba3e,0x114));var _0xeba3=function(_0x366d70,_0x147ff8){_0x366d70=_0x366d70-0x0;var _0x1c7be0=_0xba3e[_0x366d70];return _0x1c7be0;};'use strict';var Sequelize=require('sequelize');module[_0xeba3('0x0')]={'name':{'type':Sequelize[_0xeba3('0x1')],'get':function(_0x467a84){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xeba3('0x2')],'defaultValue':''},'context':{'type':Sequelize[_0xeba3('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xeba3('0x2')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xeba3('0x2')],'defaultValue':''},'duration':{'type':Sequelize[_0xeba3('0x2')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xeba3('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xeba3('0x3')](_0xeba3('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0xeba3('0x2')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xeba3('0x2')],'defaultValue':''},'stamp':{'type':_0xeba3('0x5'),'defaultValue':Sequelize[_0xeba3('0x6')](_0xeba3('0x7'))}}; \ No newline at end of file +var _0x4253=['literal','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x4253,0x15f));var _0x3425=function(_0x3c4b35,_0xc2d5af){_0x3c4b35=_0x3c4b35-0x0;var _0x41cf2f=_0x4253[_0x3c4b35];return _0x41cf2f;};'use strict';var Sequelize=require(_0x3425('0x0'));module[_0x3425('0x1')]={'name':{'type':Sequelize[_0x3425('0x2')],'get':function(_0x4043c8){return this[_0x3425('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x3425('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x3425('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x3425('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x3425('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x3425('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x3425('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x3425('0x6')](_0x3425('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x3425('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x3425('0x5')],'defaultValue':''},'stamp':{'type':_0x3425('0x8'),'defaultValue':Sequelize[_0x3425('0x9')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 2cc03d9..be9f94b 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 _0x9738=['rawAttributes','keys','include','find','create','body','params','download','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','.wav\x22','recording','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','save','update','destroy','then','error','stack','name','send','index','map','fieldName','type','differenceBy','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','VoiceMailMessage','findAll','rows','catch'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x9738,0x18b));var _0x8973=function(_0x255ae4,_0x5f51e7){_0x255ae4=_0x255ae4-0x0;var _0x12b51c=_0x9738[_0x255ae4];return _0x12b51c;};'use strict';var pdf=require(_0x8973('0x0'));var emlformat=require(_0x8973('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x8973('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8973('0x3'));var moment=require('moment');var BPromise=require(_0x8973('0x4'));var Mustache=require(_0x8973('0x5'));var util=require('util');var path=require(_0x8973('0x6'));var sox=require('sox');var csv=require(_0x8973('0x7'));var ejs=require(_0x8973('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8973('0x9'));var crypto=require(_0x8973('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8973('0xb'));var toCsv=require(_0x8973('0x7'));var querystring=require('querystring');var Papa=require(_0x8973('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8973('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8973('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x8973('0xf'));var config=require(_0x8973('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x8973('0x11'))['db'];function respondWithStatusCode(_0x4695e8,_0x370efe){_0x370efe=_0x370efe||0xcc;return function(_0x4b8e69){if(_0x4b8e69){return _0x4695e8[_0x8973('0x12')](_0x370efe);}return _0x4695e8[_0x8973('0x13')](_0x370efe)[_0x8973('0x14')]();};}function respondWithResult(_0x423290,_0x5eb756){_0x5eb756=_0x5eb756||0xc8;return function(_0x1cad6e){if(_0x1cad6e){return _0x423290[_0x8973('0x13')](_0x5eb756)[_0x8973('0x15')](_0x1cad6e);}};}function respondWithFilteredResult(_0x94b278,_0x52eca7){return function(_0x383ac0){if(_0x383ac0){var _0x2aaf29=_0x383ac0[_0x8973('0x16')],_0x432051=_0x52eca7[_0x8973('0x17')],_0x4a490a=_0x52eca7[_0x8973('0x17')]+_0x52eca7[_0x8973('0x18')],_0x39f6f8;if(_0x4a490a>=_0x2aaf29){_0x4a490a=_0x2aaf29;_0x39f6f8=0xc8;}else{_0x39f6f8=0xce;}_0x94b278[_0x8973('0x13')](_0x39f6f8);return _0x94b278[_0x8973('0x19')](_0x8973('0x1a'),_0x432051+'-'+_0x4a490a+'/'+_0x2aaf29)[_0x8973('0x15')](_0x383ac0);}return null;};}function patchUpdates(_0x2d35de){return function(_0x307410){try{jsonpatch['apply'](_0x307410,_0x2d35de,!![]);}catch(_0x576e68){return BPromise['reject'](_0x576e68);}return _0x307410[_0x8973('0x1b')]();};}function saveUpdates(_0x4fbfed,_0x1fc294){return function(_0x255432){if(_0x255432){return _0x255432[_0x8973('0x1c')](_0x4fbfed)['then'](function(_0x2926da){return _0x2926da;});}return null;};}function removeEntity(_0x4f3aee,_0x2c8605){return function(_0x56b6da){if(_0x56b6da){return _0x56b6da[_0x8973('0x1d')]()[_0x8973('0x1e')](function(){_0x4f3aee[_0x8973('0x13')](0xcc)[_0x8973('0x14')]();});}};}function handleEntityNotFound(_0x5db971,_0x27adf2){return function(_0x3cb876){if(!_0x3cb876){_0x5db971['sendStatus'](0x194);}return _0x3cb876;};}function handleError(_0x5b8c99,_0x2c5b3d){_0x2c5b3d=_0x2c5b3d||0x1f4;return function(_0x36d3a6){logger[_0x8973('0x1f')](_0x36d3a6[_0x8973('0x20')]);if(_0x36d3a6['name']){delete _0x36d3a6[_0x8973('0x21')];}_0x5b8c99['status'](_0x2c5b3d)[_0x8973('0x22')](_0x36d3a6);};}exports[_0x8973('0x23')]=function(_0x32d36c,_0x21fc8d){var _0x4111a8={},_0x19ea54={},_0x273052={'count':0x0,'rows':[]};var _0x3e9d62=_[_0x8973('0x24')](db['VoiceMailMessage']['rawAttributes'],function(_0xe8d280){return{'name':_0xe8d280[_0x8973('0x25')],'type':_0xe8d280[_0x8973('0x26')]['key']};});_0x19ea54['model']=_[_0x8973('0x27')](_[_0x8973('0x24')](_0x3e9d62,_0x8973('0x21')),[_0x8973('0x21')]);_0x19ea54[_0x8973('0x28')]=_['keys'](_0x32d36c[_0x8973('0x28')]);_0x19ea54[_0x8973('0x29')]=_[_0x8973('0x2a')](_0x19ea54[_0x8973('0x2b')],_0x19ea54[_0x8973('0x28')]);_0x4111a8[_0x8973('0x2c')]=_[_0x8973('0x2a')](_0x19ea54[_0x8973('0x2b')],qs[_0x8973('0x2d')](_0x32d36c[_0x8973('0x28')][_0x8973('0x2d')]));_0x4111a8['attributes']=_0x4111a8['attributes'][_0x8973('0x2e')]?_0x4111a8[_0x8973('0x2c')]:_0x19ea54['model'];if(!_0x32d36c[_0x8973('0x28')][_0x8973('0x2f')]('nolimit')){_0x4111a8[_0x8973('0x18')]=qs[_0x8973('0x18')](_0x32d36c[_0x8973('0x28')][_0x8973('0x18')]);_0x4111a8[_0x8973('0x17')]=qs[_0x8973('0x17')](_0x32d36c[_0x8973('0x28')][_0x8973('0x17')]);}_0x4111a8[_0x8973('0x30')]=qs[_0x8973('0x31')](_0x32d36c[_0x8973('0x28')]['sort']);_0x4111a8[_0x8973('0x32')]=qs['filters'](_[_0x8973('0x33')](_0x32d36c[_0x8973('0x28')],_0x19ea54[_0x8973('0x29')]),_0x3e9d62);if(_0x32d36c['query']['filter']){_0x4111a8[_0x8973('0x32')]=_[_0x8973('0x34')](_0x4111a8[_0x8973('0x32')],{'$or':_[_0x8973('0x24')](_0x3e9d62,function(_0x54654d){if(_0x54654d['type']!==_0x8973('0x35')){var _0xa6f97c={};_0xa6f97c[_0x54654d[_0x8973('0x21')]]={'$like':'%'+_0x32d36c[_0x8973('0x28')][_0x8973('0x36')]+'%'};return _0xa6f97c;}})});}_0x4111a8=_['merge']({},_0x4111a8,_0x32d36c[_0x8973('0x37')]);var _0x58534b={'where':_0x4111a8[_0x8973('0x32')]};return db['VoiceMailMessage'][_0x8973('0x16')](_0x58534b)[_0x8973('0x1e')](function(_0x225da4){_0x273052[_0x8973('0x16')]=_0x225da4;if(_0x32d36c[_0x8973('0x28')][_0x8973('0x38')]){_0x4111a8['include']=[{'all':!![]}];}return db[_0x8973('0x39')][_0x8973('0x3a')](_0x4111a8);})[_0x8973('0x1e')](function(_0x11fc36){_0x273052[_0x8973('0x3b')]=_0x11fc36;return _0x273052;})[_0x8973('0x1e')](respondWithFilteredResult(_0x21fc8d,_0x4111a8))[_0x8973('0x3c')](handleError(_0x21fc8d,null));};exports['show']=function(_0x42dbcd,_0x5cc40c){var _0x39877a={'raw':!![],'where':{'id':_0x42dbcd['params']['id']}},_0x17d4d0={};_0x17d4d0['model']=_['keys'](db[_0x8973('0x39')][_0x8973('0x3d')]);_0x17d4d0[_0x8973('0x28')]=_[_0x8973('0x3e')](_0x42dbcd[_0x8973('0x28')]);_0x17d4d0[_0x8973('0x29')]=_[_0x8973('0x2a')](_0x17d4d0[_0x8973('0x2b')],_0x17d4d0[_0x8973('0x28')]);_0x39877a[_0x8973('0x2c')]=_[_0x8973('0x2a')](_0x17d4d0[_0x8973('0x2b')],qs[_0x8973('0x2d')](_0x42dbcd[_0x8973('0x28')][_0x8973('0x2d')]));_0x39877a[_0x8973('0x2c')]=_0x39877a['attributes']['length']?_0x39877a[_0x8973('0x2c')]:_0x17d4d0[_0x8973('0x2b')];if(_0x42dbcd[_0x8973('0x28')][_0x8973('0x38')]){_0x39877a[_0x8973('0x3f')]=[{'all':!![]}];}_0x39877a=_[_0x8973('0x34')]({},_0x39877a,_0x42dbcd['options']);return db[_0x8973('0x39')][_0x8973('0x40')](_0x39877a)['then'](handleEntityNotFound(_0x5cc40c,null))[_0x8973('0x1e')](respondWithResult(_0x5cc40c,null))['catch'](handleError(_0x5cc40c,null));};exports['create']=function(_0xfdfd53,_0x122229){return db[_0x8973('0x39')][_0x8973('0x41')](_0xfdfd53[_0x8973('0x42')],{})[_0x8973('0x1e')](respondWithResult(_0x122229,0xc9))[_0x8973('0x3c')](handleError(_0x122229,null));};exports['update']=function(_0x143915,_0x3c9912){if(_0x143915['body']['id']){delete _0x143915[_0x8973('0x42')]['id'];}return db[_0x8973('0x39')][_0x8973('0x40')]({'where':{'id':_0x143915[_0x8973('0x43')]['id']}})[_0x8973('0x1e')](handleEntityNotFound(_0x3c9912,null))[_0x8973('0x1e')](saveUpdates(_0x143915[_0x8973('0x42')],null))[_0x8973('0x1e')](respondWithResult(_0x3c9912,null))[_0x8973('0x3c')](handleError(_0x3c9912,null));};exports[_0x8973('0x1d')]=function(_0x4fba90,_0xb0174c){return db['VoiceMailMessage'][_0x8973('0x40')]({'where':{'id':_0x4fba90[_0x8973('0x43')]['id']}})[_0x8973('0x1e')](handleEntityNotFound(_0xb0174c,null))[_0x8973('0x1e')](removeEntity(_0xb0174c,null))[_0x8973('0x3c')](handleError(_0xb0174c,null));};exports[_0x8973('0x44')]=function(_0x4441f8,_0x1b74f5,_0xf15e31){return db['VoiceMailMessage'][_0x8973('0x40')]({'where':{'id':_0x4441f8[_0x8973('0x43')]['id']},'attributes':['id','recording',_0x8973('0x45')]})[_0x8973('0x1e')](handleEntityNotFound(_0x1b74f5,null))[_0x8973('0x1e')](function(_0x291295){if(_0x291295){if(!_0x291295['recording']){throw new db['Sequelize'][(_0x8973('0x46'))](_0x8973('0x47'));}var _0x1ee1e4={'Content-Type':_0x8973('0x48'),'Content-Disposition':_0x8973('0x49')};if(_0x291295[_0x8973('0x45')]){_0x1ee1e4['Content-Disposition']='attachment;\x20filename=\x22'+_0x291295['msg_id']+_0x8973('0x4a');}_0x1b74f5['set'](_0x1ee1e4);return _0x1b74f5[_0x8973('0x22')](new Buffer(_0x291295[_0x8973('0x4b')]));}})[_0x8973('0x3c')](handleError(_0x1b74f5,null));}; \ No newline at end of file +var _0x9154=['count','offset','limit','set','json','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','include','findAll','rows','show','params','keys','includeAll','catch','create','body','update','find','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','.wav\x22','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end'];(function(_0x4b4b0e,_0x6c674){var _0x4c2d91=function(_0x4d440d){while(--_0x4d440d){_0x4b4b0e['push'](_0x4b4b0e['shift']());}};_0x4c2d91(++_0x6c674);}(_0x9154,0xe1));var _0x4915=function(_0x5b81c9,_0x1aeef8){_0x5b81c9=_0x5b81c9-0x0;var _0x2f04a6=_0x9154[_0x5b81c9];return _0x2f04a6;};'use strict';var pdf=require(_0x4915('0x0'));var emlformat=require(_0x4915('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4915('0x2'));var rp=require(_0x4915('0x3'));var moment=require('moment');var BPromise=require(_0x4915('0x4'));var Mustache=require(_0x4915('0x5'));var util=require(_0x4915('0x6'));var path=require('path');var sox=require(_0x4915('0x7'));var csv=require(_0x4915('0x8'));var ejs=require(_0x4915('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4915('0xa'));var crypto=require(_0x4915('0xb'));var jsforce=require(_0x4915('0xc'));var deskjs=require(_0x4915('0xd'));var toCsv=require(_0x4915('0x8'));var querystring=require(_0x4915('0xe'));var Papa=require(_0x4915('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4915('0x10'));var as=require(_0x4915('0x11'));var hardwareService=require(_0x4915('0x12'));var logger=require(_0x4915('0x13'))(_0x4915('0x14'));var utils=require('../../config/utils');var config=require(_0x4915('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x433d23,_0xe36790){_0xe36790=_0xe36790||0xcc;return function(_0x5c3143){if(_0x5c3143){return _0x433d23['sendStatus'](_0xe36790);}return _0x433d23[_0x4915('0x16')](_0xe36790)[_0x4915('0x17')]();};}function respondWithResult(_0x145afb,_0x23c719){_0x23c719=_0x23c719||0xc8;return function(_0x13e831){if(_0x13e831){return _0x145afb['status'](_0x23c719)['json'](_0x13e831);}};}function respondWithFilteredResult(_0x5f3d4d,_0xc4de25){return function(_0x31e8d7){if(_0x31e8d7){var _0x1f594a=_0x31e8d7[_0x4915('0x18')],_0xaf40d0=_0xc4de25[_0x4915('0x19')],_0x41ddad=_0xc4de25[_0x4915('0x19')]+_0xc4de25[_0x4915('0x1a')],_0x5ae77b;if(_0x41ddad>=_0x1f594a){_0x41ddad=_0x1f594a;_0x5ae77b=0xc8;}else{_0x5ae77b=0xce;}_0x5f3d4d[_0x4915('0x16')](_0x5ae77b);return _0x5f3d4d[_0x4915('0x1b')]('Content-Range',_0xaf40d0+'-'+_0x41ddad+'/'+_0x1f594a)[_0x4915('0x1c')](_0x31e8d7);}return null;};}function patchUpdates(_0x31898b){return function(_0x332271){try{jsonpatch[_0x4915('0x1d')](_0x332271,_0x31898b,!![]);}catch(_0x22ea4a){return BPromise[_0x4915('0x1e')](_0x22ea4a);}return _0x332271[_0x4915('0x1f')]();};}function saveUpdates(_0x52bdf9,_0x1cee64){return function(_0x4db9ff){if(_0x4db9ff){return _0x4db9ff['update'](_0x52bdf9)[_0x4915('0x20')](function(_0x342e59){return _0x342e59;});}return null;};}function removeEntity(_0x45606e,_0xff6d74){return function(_0x4ff371){if(_0x4ff371){return _0x4ff371[_0x4915('0x21')]()[_0x4915('0x20')](function(){_0x45606e[_0x4915('0x16')](0xcc)[_0x4915('0x17')]();});}};}function handleEntityNotFound(_0xc47774,_0x3cda70){return function(_0x2f7dd9){if(!_0x2f7dd9){_0xc47774[_0x4915('0x22')](0x194);}return _0x2f7dd9;};}function handleError(_0x4783a9,_0x3a83a6){_0x3a83a6=_0x3a83a6||0x1f4;return function(_0x203339){logger['error'](_0x203339[_0x4915('0x23')]);if(_0x203339[_0x4915('0x24')]){delete _0x203339[_0x4915('0x24')];}_0x4783a9[_0x4915('0x16')](_0x3a83a6)[_0x4915('0x25')](_0x203339);};}exports[_0x4915('0x26')]=function(_0x28062a,_0x38f57a){var _0x50e641={},_0xc8ec47={},_0x5bb068={'count':0x0,'rows':[]};var _0x4163e9=_[_0x4915('0x27')](db[_0x4915('0x28')][_0x4915('0x29')],function(_0x13c45a){return{'name':_0x13c45a[_0x4915('0x2a')],'type':_0x13c45a[_0x4915('0x2b')][_0x4915('0x2c')]};});_0xc8ec47[_0x4915('0x2d')]=_[_0x4915('0x2e')](_['map'](_0x4163e9,'name'),[_0x4915('0x24')]);_0xc8ec47['query']=_['keys'](_0x28062a[_0x4915('0x2f')]);_0xc8ec47[_0x4915('0x30')]=_['intersection'](_0xc8ec47[_0x4915('0x2d')],_0xc8ec47[_0x4915('0x2f')]);_0x50e641['attributes']=_[_0x4915('0x31')](_0xc8ec47[_0x4915('0x2d')],qs['fields'](_0x28062a[_0x4915('0x2f')][_0x4915('0x32')]));_0x50e641[_0x4915('0x33')]=_0x50e641[_0x4915('0x33')][_0x4915('0x34')]?_0x50e641[_0x4915('0x33')]:_0xc8ec47[_0x4915('0x2d')];if(!_0x28062a[_0x4915('0x2f')][_0x4915('0x35')](_0x4915('0x36'))){_0x50e641[_0x4915('0x1a')]=qs['limit'](_0x28062a[_0x4915('0x2f')]['limit']);_0x50e641[_0x4915('0x19')]=qs[_0x4915('0x19')](_0x28062a[_0x4915('0x2f')][_0x4915('0x19')]);}_0x50e641[_0x4915('0x37')]=qs[_0x4915('0x38')](_0x28062a[_0x4915('0x2f')][_0x4915('0x38')]);_0x50e641['where']=qs[_0x4915('0x30')](_[_0x4915('0x39')](_0x28062a[_0x4915('0x2f')],_0xc8ec47['filters']),_0x4163e9);if(_0x28062a[_0x4915('0x2f')]['filter']){_0x50e641[_0x4915('0x3a')]=_[_0x4915('0x3b')](_0x50e641['where'],{'$or':_[_0x4915('0x27')](_0x4163e9,function(_0x5cf6fd){if(_0x5cf6fd[_0x4915('0x2b')]!=='VIRTUAL'){var _0x4b856f={};_0x4b856f[_0x5cf6fd[_0x4915('0x24')]]={'$like':'%'+_0x28062a[_0x4915('0x2f')][_0x4915('0x3c')]+'%'};return _0x4b856f;}})});}_0x50e641=_[_0x4915('0x3b')]({},_0x50e641,_0x28062a[_0x4915('0x3d')]);var _0x23738b={'where':_0x50e641[_0x4915('0x3a')]};return db['VoiceMailMessage']['count'](_0x23738b)[_0x4915('0x20')](function(_0x1a6324){_0x5bb068[_0x4915('0x18')]=_0x1a6324;if(_0x28062a[_0x4915('0x2f')]['includeAll']){_0x50e641[_0x4915('0x3e')]=[{'all':!![]}];}return db[_0x4915('0x28')][_0x4915('0x3f')](_0x50e641);})[_0x4915('0x20')](function(_0x277f42){_0x5bb068[_0x4915('0x40')]=_0x277f42;return _0x5bb068;})[_0x4915('0x20')](respondWithFilteredResult(_0x38f57a,_0x50e641))['catch'](handleError(_0x38f57a,null));};exports[_0x4915('0x41')]=function(_0x307d74,_0x1288c6){var _0x3840ff={'raw':!![],'where':{'id':_0x307d74[_0x4915('0x42')]['id']}},_0x4af28a={};_0x4af28a[_0x4915('0x2d')]=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x4af28a[_0x4915('0x2f')]=_[_0x4915('0x43')](_0x307d74['query']);_0x4af28a[_0x4915('0x30')]=_[_0x4915('0x31')](_0x4af28a[_0x4915('0x2d')],_0x4af28a[_0x4915('0x2f')]);_0x3840ff[_0x4915('0x33')]=_[_0x4915('0x31')](_0x4af28a[_0x4915('0x2d')],qs['fields'](_0x307d74[_0x4915('0x2f')][_0x4915('0x32')]));_0x3840ff['attributes']=_0x3840ff['attributes']['length']?_0x3840ff[_0x4915('0x33')]:_0x4af28a[_0x4915('0x2d')];if(_0x307d74[_0x4915('0x2f')][_0x4915('0x44')]){_0x3840ff[_0x4915('0x3e')]=[{'all':!![]}];}_0x3840ff=_[_0x4915('0x3b')]({},_0x3840ff,_0x307d74[_0x4915('0x3d')]);return db[_0x4915('0x28')]['find'](_0x3840ff)[_0x4915('0x20')](handleEntityNotFound(_0x1288c6,null))['then'](respondWithResult(_0x1288c6,null))[_0x4915('0x45')](handleError(_0x1288c6,null));};exports[_0x4915('0x46')]=function(_0x1de11c,_0x1224ba){return db[_0x4915('0x28')][_0x4915('0x46')](_0x1de11c[_0x4915('0x47')],{})[_0x4915('0x20')](respondWithResult(_0x1224ba,0xc9))['catch'](handleError(_0x1224ba,null));};exports[_0x4915('0x48')]=function(_0x3c666e,_0x382fbe){if(_0x3c666e[_0x4915('0x47')]['id']){delete _0x3c666e[_0x4915('0x47')]['id'];}return db[_0x4915('0x28')][_0x4915('0x49')]({'where':{'id':_0x3c666e['params']['id']}})[_0x4915('0x20')](handleEntityNotFound(_0x382fbe,null))['then'](saveUpdates(_0x3c666e['body'],null))[_0x4915('0x20')](respondWithResult(_0x382fbe,null))[_0x4915('0x45')](handleError(_0x382fbe,null));};exports[_0x4915('0x21')]=function(_0x372838,_0x55e4a8){return db[_0x4915('0x28')]['find']({'where':{'id':_0x372838[_0x4915('0x42')]['id']}})['then'](handleEntityNotFound(_0x55e4a8,null))[_0x4915('0x20')](removeEntity(_0x55e4a8,null))['catch'](handleError(_0x55e4a8,null));};exports['download']=function(_0x2569f8,_0x14eef3,_0x4decc4){return db['VoiceMailMessage'][_0x4915('0x49')]({'where':{'id':_0x2569f8[_0x4915('0x42')]['id']},'attributes':['id','recording',_0x4915('0x4a')]})[_0x4915('0x20')](handleEntityNotFound(_0x14eef3,null))[_0x4915('0x20')](function(_0x23cd1d){if(_0x23cd1d){if(!_0x23cd1d[_0x4915('0x4b')]){throw new db[(_0x4915('0x4c'))][(_0x4915('0x4d'))](_0x4915('0x4e'));}var _0x1a11ca={'Content-Type':_0x4915('0x4f'),'Content-Disposition':_0x4915('0x50')};if(_0x23cd1d[_0x4915('0x4a')]){_0x1a11ca[_0x4915('0x51')]='attachment;\x20filename=\x22'+_0x23cd1d[_0x4915('0x4a')]+_0x4915('0x52');}_0x14eef3['set'](_0x1a11ca);return _0x14eef3[_0x4915('0x25')](new Buffer(_0x23cd1d[_0x4915('0x4b')]));}})[_0x4915('0x45')](handleError(_0x14eef3,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 8807521..960412a 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 _0x5c41=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment'];(function(_0x3b632f,_0x453380){var _0x10e788=function(_0x2228a4){while(--_0x2228a4){_0x3b632f['push'](_0x3b632f['shift']());}};_0x10e788(++_0x453380);}(_0x5c41,0x121));var _0x15c4=function(_0x4cf15f,_0x3f11c7){_0x4cf15f=_0x4cf15f-0x0;var _0x11da5d=_0x5c41[_0x4cf15f];return _0x11da5d;};'use strict';var _=require(_0x15c4('0x0'));var util=require(_0x15c4('0x1'));var logger=require(_0x15c4('0x2'))(_0x15c4('0x3'));var moment=require(_0x15c4('0x4'));var BPromise=require(_0x15c4('0x5'));var rp=require(_0x15c4('0x6'));var fs=require('fs');var path=require(_0x15c4('0x7'));var rimraf=require(_0x15c4('0x8'));var config=require(_0x15c4('0x9'));var attributes=require('./voiceMailMessage.attributes');module[_0x15c4('0xa')]=function(_0x3c793a,_0x309372){return _0x3c793a[_0x15c4('0xb')]('VoiceMailMessage',attributes,{'tableName':_0x15c4('0xc'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x15c4('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xf147=['moment','request-promise','path','rimraf','../../config/environment','exports','define','voice_voicemail_messages','dir','lodash','util','../../config/logger','api'];(function(_0x4edaf1,_0x3c0639){var _0x4c4a2a=function(_0xc7556b){while(--_0xc7556b){_0x4edaf1['push'](_0x4edaf1['shift']());}};_0x4c4a2a(++_0x3c0639);}(_0xf147,0x134));var _0x7f14=function(_0x3c2381,_0x5f2a0c){_0x3c2381=_0x3c2381-0x0;var _0x46c65f=_0xf147[_0x3c2381];return _0x46c65f;};'use strict';var _=require(_0x7f14('0x0'));var util=require(_0x7f14('0x1'));var logger=require(_0x7f14('0x2'))(_0x7f14('0x3'));var moment=require(_0x7f14('0x4'));var BPromise=require('bluebird');var rp=require(_0x7f14('0x5'));var fs=require('fs');var path=require(_0x7f14('0x6'));var rimraf=require(_0x7f14('0x7'));var config=require(_0x7f14('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0x7f14('0x9')]=function(_0x5ec1be,_0x85fdde){return _0x5ec1be[_0x7f14('0xa')]('VoiceMailMessage',attributes,{'tableName':_0x7f14('0xb'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x7f14('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 9ec41fa..8042239 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 _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x5dacdf,_0x21f07f){var _0x238605=function(_0x425afd){while(--_0x425afd){_0x5dacdf['push'](_0x5dacdf['shift']());}};_0x238605(++_0x21f07f);}(_0x1a85,0x178));var _0x51a8=function(_0x7709d5,_0x3a0bc4){_0x7709d5=_0x7709d5-0x0;var _0x36e23c=_0x1a85[_0x7709d5];return _0x36e23c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file +var _0x57ca=['client','http','request','info','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0xacd0ff,_0x1e943f){var _0x1fafd5=function(_0x2a10e1){while(--_0x2a10e1){_0xacd0ff['push'](_0xacd0ff['shift']());}};_0x1fafd5(++_0x1e943f);}(_0x57ca,0x108));var _0xa57c=function(_0x155200,_0x228087){_0x155200=_0x155200-0x0;var _0x354c3a=_0x57ca[_0x155200];return _0x354c3a;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index aebaf1e..2c0ebe6 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 _0x4172=['Router','../../components/auth/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','getSounds','post','/:id/sounds','addSound','put','delete','destroy','removeSound','exports','multer','util','path','connect-timeout','express'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4172,0x145));var _0x2417=function(_0x2f2465,_0x54d379){_0x2f2465=_0x2f2465-0x0;var _0x10c3e7=_0x4172[_0x2f2465];return _0x10c3e7;};'use strict';var multer=require(_0x2417('0x0'));var util=require(_0x2417('0x1'));var path=require(_0x2417('0x2'));var timeout=require(_0x2417('0x3'));var express=require(_0x2417('0x4'));var router=express[_0x2417('0x5')]();var auth=require(_0x2417('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2417('0x7'));router[_0x2417('0x8')]('/',auth[_0x2417('0x9')](),controller[_0x2417('0xa')]);router['get'](_0x2417('0xb'),auth[_0x2417('0x9')](),controller[_0x2417('0xc')]);router['get']('/:id/sounds',auth[_0x2417('0x9')](),controller[_0x2417('0xd')]);router[_0x2417('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x2417('0xf'),auth[_0x2417('0x9')](),controller[_0x2417('0x10')]);router[_0x2417('0x11')](_0x2417('0xb'),auth[_0x2417('0x9')](),controller['update']);router[_0x2417('0x12')](_0x2417('0xb'),auth[_0x2417('0x9')](),controller[_0x2417('0x13')]);router[_0x2417('0x12')]('/:id/sounds/:id2',auth[_0x2417('0x9')](),controller[_0x2417('0x14')]);module[_0x2417('0x15')]=router; \ No newline at end of file +var _0x5c4a=['/:id/sounds/:id2','removeSound','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','update','delete'];(function(_0x66ea11,_0xa8322e){var _0x9c0bc0=function(_0x4f0ffa){while(--_0x4f0ffa){_0x66ea11['push'](_0x66ea11['shift']());}};_0x9c0bc0(++_0xa8322e);}(_0x5c4a,0x10a));var _0xa5c4=function(_0xe3f1a3,_0x36d5f9){_0xe3f1a3=_0xe3f1a3-0x0;var _0x367c19=_0x5c4a[_0xe3f1a3];return _0x367c19;};'use strict';var multer=require(_0xa5c4('0x0'));var util=require('util');var path=require(_0xa5c4('0x1'));var timeout=require('connect-timeout');var express=require(_0xa5c4('0x2'));var router=express[_0xa5c4('0x3')]();var auth=require(_0xa5c4('0x4'));var interaction=require(_0xa5c4('0x5'));var config=require(_0xa5c4('0x6'));var controller=require(_0xa5c4('0x7'));router['get']('/',auth[_0xa5c4('0x8')](),controller[_0xa5c4('0x9')]);router['get'](_0xa5c4('0xa'),auth['isAuthenticated'](),controller[_0xa5c4('0xb')]);router['get'](_0xa5c4('0xc'),auth['isAuthenticated'](),controller[_0xa5c4('0xd')]);router[_0xa5c4('0xe')]('/',auth['isAuthenticated'](),controller[_0xa5c4('0xf')]);router[_0xa5c4('0xe')](_0xa5c4('0xc'),auth[_0xa5c4('0x8')](),controller[_0xa5c4('0x10')]);router[_0xa5c4('0x11')]('/:id',auth[_0xa5c4('0x8')](),controller[_0xa5c4('0x12')]);router[_0xa5c4('0x13')](_0xa5c4('0xa'),auth[_0xa5c4('0x8')](),controller['destroy']);router[_0xa5c4('0x13')](_0xa5c4('0x14'),auth[_0xa5c4('0x8')](),controller[_0xa5c4('0x15')]);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 6cbbc2e..b493835 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 _0x500d=['custom','files','quietmp3nb','quietmp3','mp3','alpha','sequelize','STRING','name','ENUM'];(function(_0x1b0ed4,_0x53b4d5){var _0x272710=function(_0x137557){while(--_0x137557){_0x1b0ed4['push'](_0x1b0ed4['shift']());}};_0x272710(++_0x53b4d5);}(_0x500d,0x146));var _0xd500=function(_0x1d2bbb,_0x202267){_0x1d2bbb=_0x1d2bbb-0x0;var _0x38082b=_0x500d[_0x1d2bbb];return _0x38082b;};'use strict';var Sequelize=require(_0xd500('0x0'));module['exports']={'name':{'type':Sequelize[_0xd500('0x1')],'allowNull':![],'unique':_0xd500('0x2')},'mode':{'type':Sequelize[_0xd500('0x3')](_0xd500('0x4'),_0xd500('0x5'),'mp3nb',_0xd500('0x6'),_0xd500('0x7'),_0xd500('0x8')),'allowNull':!![],'defaultValue':_0xd500('0x5')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xd500('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xd500('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xd500('0x1')],'allowNull':!![],'defaultValue':_0xd500('0x9')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7b2c=['files','quietmp3nb','quietmp3','mp3','BOOLEAN','sequelize','exports','STRING','custom'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7b2c,0x1d9));var _0xc7b2=function(_0x1f4523,_0x4ab2ab){_0x1f4523=_0x1f4523-0x0;var _0x4e07b2=_0x7b2c[_0x1f4523];return _0x4e07b2;};'use strict';var Sequelize=require(_0xc7b2('0x0'));module[_0xc7b2('0x1')]={'name':{'type':Sequelize[_0xc7b2('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0xc7b2('0x3'),_0xc7b2('0x4'),'mp3nb',_0xc7b2('0x5'),_0xc7b2('0x6'),_0xc7b2('0x7')),'allowNull':!![],'defaultValue':_0xc7b2('0x4')},'directory':{'type':Sequelize[_0xc7b2('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xc7b2('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xc7b2('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xc7b2('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xc7b2('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xc7b2('0x8')],'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 16af799..21cc40b 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 _0xf87e=['sequelize','transaction','mode','files','root','server/files/moh','mkdirSync','directory','0777','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','readdirSync','join','rmdirSync','Sequelize','ValidationError','message','addSound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','symlinkSync','removeSound','id2','Sound','unlinkSync','getSounds','order','nolimit','html-pdf','zip-dir','moment','path','sox','ejs','lodash','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','count','offset','limit','Content-Range','apply','reject','save','then','UserProfileResource','destroy','error','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','include','findAll','catch','show','params','keys','includeAll','options','update','body','find','create'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xf87e,0x172));var _0xef87=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xf87e[_0x2642cb];return _0xe6e41;};'use strict';var pdf=require(_0xef87('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xef87('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xef87('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xef87('0x3'));var sox=require(_0xef87('0x4'));var csv=require('to-csv');var ejs=require(_0xef87('0x5'));var fs=require('fs');var _=require(_0xef87('0x6'));var squel=require(_0xef87('0x7'));var crypto=require(_0xef87('0x8'));var jsforce=require(_0xef87('0x9'));var deskjs=require(_0xef87('0xa'));var toCsv=require(_0xef87('0xb'));var querystring=require('querystring');var Papa=require(_0xef87('0xc'));var Redis=require('ioredis');var authService=require(_0xef87('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xef87('0xe'));var hardwareService=require(_0xef87('0xf'));var logger=require(_0xef87('0x10'))(_0xef87('0x11'));var utils=require(_0xef87('0x12'));var config=require(_0xef87('0x13'));var licenseUtil=require(_0xef87('0x14'));var db=require(_0xef87('0x15'))['db'];function respondWithStatusCode(_0x226df4,_0x53c1f2){_0x53c1f2=_0x53c1f2||0xcc;return function(_0x3a4d06){if(_0x3a4d06){return _0x226df4[_0xef87('0x16')](_0x53c1f2);}return _0x226df4[_0xef87('0x17')](_0x53c1f2)[_0xef87('0x18')]();};}function respondWithResult(_0x5ebbb3,_0x1436d8){_0x1436d8=_0x1436d8||0xc8;return function(_0x5c4501){if(_0x5c4501){return _0x5ebbb3[_0xef87('0x17')](_0x1436d8)[_0xef87('0x19')](_0x5c4501);}};}function respondWithFilteredResult(_0x3ad8f2,_0x165815){return function(_0x33fe42){if(_0x33fe42){var _0x166b10=_0x33fe42[_0xef87('0x1a')],_0x1a5497=_0x165815[_0xef87('0x1b')],_0x4a5ed6=_0x165815[_0xef87('0x1b')]+_0x165815[_0xef87('0x1c')],_0x4096ef;if(_0x4a5ed6>=_0x166b10){_0x4a5ed6=_0x166b10;_0x4096ef=0xc8;}else{_0x4096ef=0xce;}_0x3ad8f2[_0xef87('0x17')](_0x4096ef);return _0x3ad8f2['set'](_0xef87('0x1d'),_0x1a5497+'-'+_0x4a5ed6+'/'+_0x166b10)[_0xef87('0x19')](_0x33fe42);}return null;};}function patchUpdates(_0x23830e){return function(_0x2cc32d){try{jsonpatch[_0xef87('0x1e')](_0x2cc32d,_0x23830e,!![]);}catch(_0x336a50){return BPromise[_0xef87('0x1f')](_0x336a50);}return _0x2cc32d[_0xef87('0x20')]();};}function saveUpdates(_0x58bd51,_0x4952c6){return function(_0x498442){if(_0x498442){return _0x498442['update'](_0x58bd51)[_0xef87('0x21')](function(_0x37e3b1){return _0x37e3b1;});}return null;};}function removeEntity(_0x446ac3,_0x49ab36){return function(_0x18770d){if(_0x18770d){return _0x18770d['destroy']()[_0xef87('0x21')](function(){var _0xd1c70b=_0x18770d['get']({'plain':!![]});var _0x2f9843='MusicOnHolds';return db[_0xef87('0x22')][_0xef87('0x23')]({'where':{'type':_0x2f9843,'resourceId':_0xd1c70b['id']}})['then'](function(){return _0x18770d;});})[_0xef87('0x21')](function(){_0x446ac3[_0xef87('0x17')](0xcc)[_0xef87('0x18')]();});}};}function handleEntityNotFound(_0x45b73b,_0x5a55ef){return function(_0x44ff9c){if(!_0x44ff9c){_0x45b73b[_0xef87('0x16')](0x194);}return _0x44ff9c;};}function handleError(_0x2b7f5e,_0x791e75){_0x791e75=_0x791e75||0x1f4;return function(_0x4307a0){logger[_0xef87('0x24')](_0x4307a0['stack']);if(_0x4307a0[_0xef87('0x25')]){delete _0x4307a0[_0xef87('0x25')];}_0x2b7f5e[_0xef87('0x17')](_0x791e75)[_0xef87('0x26')](_0x4307a0);};}exports['index']=function(_0x54e5ea,_0x300784){var _0x4ec85a={},_0x4e8445={},_0x4cdae1={'count':0x0,'rows':[]};var _0x41b3c0=_[_0xef87('0x27')](db[_0xef87('0x28')][_0xef87('0x29')],function(_0x1331e0){return{'name':_0x1331e0[_0xef87('0x2a')],'type':_0x1331e0[_0xef87('0x2b')][_0xef87('0x2c')]};});_0x4e8445['model']=_[_0xef87('0x27')](_0x41b3c0,'name');_0x4e8445[_0xef87('0x2d')]=_['keys'](_0x54e5ea['query']);_0x4e8445[_0xef87('0x2e')]=_[_0xef87('0x2f')](_0x4e8445[_0xef87('0x30')],_0x4e8445[_0xef87('0x2d')]);_0x4ec85a[_0xef87('0x31')]=_[_0xef87('0x2f')](_0x4e8445['model'],qs[_0xef87('0x32')](_0x54e5ea[_0xef87('0x2d')][_0xef87('0x32')]));_0x4ec85a['attributes']=_0x4ec85a[_0xef87('0x31')][_0xef87('0x33')]?_0x4ec85a[_0xef87('0x31')]:_0x4e8445[_0xef87('0x30')];if(!_0x54e5ea[_0xef87('0x2d')][_0xef87('0x34')]('nolimit')){_0x4ec85a[_0xef87('0x1c')]=qs['limit'](_0x54e5ea[_0xef87('0x2d')][_0xef87('0x1c')]);_0x4ec85a[_0xef87('0x1b')]=qs['offset'](_0x54e5ea[_0xef87('0x2d')][_0xef87('0x1b')]);}_0x4ec85a['order']=qs[_0xef87('0x35')](_0x54e5ea[_0xef87('0x2d')][_0xef87('0x35')]);_0x4ec85a['where']=qs[_0xef87('0x2e')](_[_0xef87('0x36')](_0x54e5ea[_0xef87('0x2d')],_0x4e8445[_0xef87('0x2e')]),_0x41b3c0);if(_0x54e5ea[_0xef87('0x2d')][_0xef87('0x37')]){_0x4ec85a[_0xef87('0x38')]=_['merge'](_0x4ec85a[_0xef87('0x38')],{'$or':_[_0xef87('0x27')](_0x41b3c0,function(_0x249052){if(_0x249052[_0xef87('0x2b')]!=='VIRTUAL'){var _0x5995f4={};_0x5995f4[_0x249052[_0xef87('0x25')]]={'$like':'%'+_0x54e5ea['query'][_0xef87('0x37')]+'%'};return _0x5995f4;}})});}_0x4ec85a=_[_0xef87('0x39')]({},_0x4ec85a,_0x54e5ea['options']);var _0x5ef01b={'where':_0x4ec85a[_0xef87('0x38')]};return db['VoiceMusicOnHold'][_0xef87('0x1a')](_0x5ef01b)['then'](function(_0x295692){_0x4cdae1[_0xef87('0x1a')]=_0x295692;if(_0x54e5ea[_0xef87('0x2d')]['includeAll']){_0x4ec85a[_0xef87('0x3a')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xef87('0x3b')](_0x4ec85a);})['then'](function(_0x5bcae7){_0x4cdae1['rows']=_0x5bcae7;return _0x4cdae1;})[_0xef87('0x21')](respondWithFilteredResult(_0x300784,_0x4ec85a))[_0xef87('0x3c')](handleError(_0x300784,null));};exports[_0xef87('0x3d')]=function(_0x18f39c,_0x5ca690){var _0x5b3c94={'raw':![],'where':{'id':_0x18f39c[_0xef87('0x3e')]['id']}},_0x51489d={};_0x51489d[_0xef87('0x30')]=_[_0xef87('0x3f')](db[_0xef87('0x28')]['rawAttributes']);_0x51489d['query']=_[_0xef87('0x3f')](_0x18f39c['query']);_0x51489d[_0xef87('0x2e')]=_[_0xef87('0x2f')](_0x51489d[_0xef87('0x30')],_0x51489d['query']);_0x5b3c94['attributes']=_[_0xef87('0x2f')](_0x51489d['model'],qs[_0xef87('0x32')](_0x18f39c[_0xef87('0x2d')]['fields']));_0x5b3c94[_0xef87('0x31')]=_0x5b3c94[_0xef87('0x31')][_0xef87('0x33')]?_0x5b3c94[_0xef87('0x31')]:_0x51489d[_0xef87('0x30')];if(_0x18f39c[_0xef87('0x2d')][_0xef87('0x40')]){_0x5b3c94[_0xef87('0x3a')]=[{'all':!![]}];}_0x5b3c94=_[_0xef87('0x39')]({},_0x5b3c94,_0x18f39c[_0xef87('0x41')]);return db[_0xef87('0x28')]['find'](_0x5b3c94)[_0xef87('0x21')](handleEntityNotFound(_0x5ca690,null))[_0xef87('0x21')](respondWithResult(_0x5ca690,null))[_0xef87('0x3c')](handleError(_0x5ca690,null));};exports[_0xef87('0x42')]=function(_0x4bee85,_0x1d42e7){if(_0x4bee85[_0xef87('0x43')]['id']){delete _0x4bee85[_0xef87('0x43')]['id'];}return db['VoiceMusicOnHold'][_0xef87('0x44')]({'where':{'id':_0x4bee85[_0xef87('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1d42e7,null))[_0xef87('0x21')](saveUpdates(_0x4bee85[_0xef87('0x43')],null))['then'](respondWithResult(_0x1d42e7,null))[_0xef87('0x3c')](handleError(_0x1d42e7,null));};exports[_0xef87('0x45')]=function(_0x151db6,_0x397f47,_0x26d6d3){return db[_0xef87('0x46')][_0xef87('0x47')](function(_0x9aa416){if(_0x151db6[_0xef87('0x43')][_0xef87('0x48')]===_0xef87('0x49')){_0x151db6['body']['directory']=path['join'](config[_0xef87('0x4a')],_0xef87('0x4b'),_0x151db6['body']['name']);}return db[_0xef87('0x28')][_0xef87('0x45')](_0x151db6[_0xef87('0x43')],{'transaction':_0x9aa416})[_0xef87('0x21')](function(_0xc45507){if(_0x151db6[_0xef87('0x43')][_0xef87('0x48')]===_0xef87('0x49')){fs[_0xef87('0x4c')](_0xc45507[_0xef87('0x4d')],parseInt(_0xef87('0x4e'),0x8));}var _0x1ae51a=_0x151db6[_0xef87('0x4f')][_0xef87('0x50')]({'plain':!![]});if(!_0x1ae51a)throw new Error(_0xef87('0x51'));if(_0x1ae51a[_0xef87('0x52')]===_0xef87('0x4f')){var _0x488229=_0xc45507[_0xef87('0x50')]({'plain':!![]});return db[_0xef87('0x53')][_0xef87('0x44')]({'where':{'name':_0xef87('0x54'),'userProfileId':_0x1ae51a[_0xef87('0x55')]},'raw':!![]})['then'](function(_0x4cfc58){if(_0x4cfc58&&_0x4cfc58[_0xef87('0x56')]===0x0){return db['UserProfileResource'][_0xef87('0x45')]({'name':_0x488229[_0xef87('0x25')],'resourceId':_0x488229['id'],'type':_0x4cfc58[_0xef87('0x25')],'sectionId':_0x4cfc58['id']},{})[_0xef87('0x21')](function(){return _0xc45507;});}else{return _0xc45507;}})[_0xef87('0x3c')](function(_0x118b6d){logger[_0xef87('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x118b6d);});}return _0xc45507;});})[_0xef87('0x21')](respondWithResult(_0x397f47,0xc9))[_0xef87('0x3c')](handleError(_0x397f47,null));};exports['destroy']=function(_0x59db1a,_0x471597,_0x220b3e){var _0x59f643;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x59db1a[_0xef87('0x3e')]['id']}})[_0xef87('0x21')](function(_0x3f3921){if(_0x3f3921){return db[_0xef87('0x46')]['transaction'](function(_0xe6070b){return _0x3f3921['destroy']({'transaction':_0xe6070b,'raw':!![]})[_0xef87('0x21')](function(_0x578d0a){if(_0x578d0a['directory']){fs[_0xef87('0x57')](_0x578d0a[_0xef87('0x4d')])['forEach'](function(_0x30aaf2){fs['unlinkSync'](path[_0xef87('0x58')](_0x578d0a[_0xef87('0x4d')],_0x30aaf2));});fs[_0xef87('0x59')](_0x578d0a['directory']);}return _0x578d0a;});})['catch'](function(_0x36234d){throw new db[(_0xef87('0x5a'))][(_0xef87('0x5b'))](_0x36234d[_0xef87('0x5c')]);});}})[_0xef87('0x21')](handleEntityNotFound(_0x471597,null))[_0xef87('0x21')](removeEntity(_0x471597,null))['catch'](handleError(_0x471597,null));};exports[_0xef87('0x5d')]=function(_0x5b720f,_0x40edb9,_0x187ad1){return db[_0xef87('0x46')][_0xef87('0x47')](function(_0x1ad34c){var _0x240821;return db[_0xef87('0x28')]['find']({'where':{'id':_0x5b720f['params']['id']}})['then'](function(_0x5b2243){if(_0x5b2243){_0x240821=_0x5b2243;return _0x5b2243[_0xef87('0x5d')](_0x5b720f[_0xef87('0x43')]['id'],{'transaction':_0x1ad34c});}})[_0xef87('0x21')](function(_0x18be8a){if(_0x18be8a){return db['Sound'][_0xef87('0x5e')]({'where':{'id':_0x5b720f[_0xef87('0x43')]['id']},'attributes':['id',_0xef87('0x25'),_0xef87('0x5f'),_0xef87('0x60'),_0xef87('0x61')],'raw':!![]});}})[_0xef87('0x21')](function(_0x21cef9){if(_0x21cef9){var _0x2a3813=path[_0xef87('0x58')](config[_0xef87('0x4a')],_0xef87('0x62'),util[_0xef87('0x63')](_0xef87('0x64'),path[_0xef87('0x65')](_0x21cef9['save_name'],path['extname'](_0x21cef9[_0xef87('0x5f')])),_0x21cef9[_0xef87('0x60')]));var _0x192b48=path[_0xef87('0x58')](config[_0xef87('0x4a')],_0xef87('0x4b'),_0x240821[_0xef87('0x25')],util['format'](_0xef87('0x64'),_0x21cef9[_0xef87('0x25')],_0x21cef9[_0xef87('0x60')]));fs[_0xef87('0x66')](_0x2a3813,_0x192b48);return _0x21cef9;}})[_0xef87('0x3c')](function(_0x2b0aa1){throw new db[(_0xef87('0x5a'))][(_0xef87('0x5b'))](_0x2b0aa1[_0xef87('0x5c')]);});})[_0xef87('0x21')](handleEntityNotFound(_0x40edb9,null))['then'](respondWithResult(_0x40edb9,0xc9))[_0xef87('0x3c')](handleError(_0x40edb9,null));};exports[_0xef87('0x67')]=function(_0x20738c,_0x22fff6,_0x342d35){return db[_0xef87('0x46')][_0xef87('0x47')](function(_0x892fbe){var _0x338872;return db[_0xef87('0x28')][_0xef87('0x5e')]({'where':{'id':_0x20738c['params']['id']}})[_0xef87('0x21')](handleEntityNotFound(_0x22fff6,null))[_0xef87('0x21')](function(_0x354a9c){if(_0x354a9c){_0x338872=_0x354a9c;return _0x354a9c[_0xef87('0x67')](_0x20738c['params'][_0xef87('0x68')]);}})[_0xef87('0x21')](function(_0x145fc2){if(_0x145fc2){return db[_0xef87('0x69')][_0xef87('0x5e')]({'where':{'id':_0x20738c[_0xef87('0x3e')][_0xef87('0x68')]},'attributes':['id',_0xef87('0x25'),'save_name',_0xef87('0x60'),_0xef87('0x61')],'raw':!![]});}})[_0xef87('0x21')](function(_0x31b779){if(_0x31b779){fs[_0xef87('0x6a')](path[_0xef87('0x58')](_0x338872[_0xef87('0x4d')],util['format'](_0xef87('0x64'),_0x31b779[_0xef87('0x25')],_0x31b779[_0xef87('0x60')])));return _0x31b779;}})[_0xef87('0x3c')](function(_0x2ebba4){throw new db[(_0xef87('0x5a'))][(_0xef87('0x5b'))](_0x2ebba4[_0xef87('0x5c')]);});})[_0xef87('0x21')](handleEntityNotFound(_0x22fff6,null))[_0xef87('0x21')](respondWithStatusCode(_0x22fff6,0xcc))[_0xef87('0x3c')](handleError(_0x22fff6,null));};exports[_0xef87('0x6b')]=function(_0x49ea70,_0x1d8c9f,_0x290261){var _0x2577c2={};var _0x468db8={};var _0x5356c7;var _0x95589f;return db[_0xef87('0x28')]['findOne']({'where':{'id':_0x49ea70['params']['id']}})['then'](handleEntityNotFound(_0x1d8c9f,null))[_0xef87('0x21')](function(_0x28ff02){if(_0x28ff02){_0x5356c7=_0x28ff02;_0x468db8['model']=_[_0xef87('0x3f')](db[_0xef87('0x69')][_0xef87('0x29')]);_0x468db8['query']=_[_0xef87('0x3f')](_0x49ea70[_0xef87('0x2d')]);_0x468db8[_0xef87('0x2e')]=_['intersection'](_0x468db8[_0xef87('0x30')],_0x468db8[_0xef87('0x2d')]);_0x2577c2['attributes']=_['intersection'](_0x468db8[_0xef87('0x30')],qs['fields'](_0x49ea70[_0xef87('0x2d')][_0xef87('0x32')]));_0x2577c2['attributes']=_0x2577c2['attributes'][_0xef87('0x33')]?_0x2577c2[_0xef87('0x31')]:_0x468db8[_0xef87('0x30')];_0x2577c2[_0xef87('0x6c')]=qs[_0xef87('0x35')](_0x49ea70[_0xef87('0x2d')]['sort']);_0x2577c2[_0xef87('0x38')]=qs[_0xef87('0x2e')](_[_0xef87('0x36')](_0x49ea70[_0xef87('0x2d')],_0x468db8[_0xef87('0x2e')]));if(_0x49ea70[_0xef87('0x2d')][_0xef87('0x37')]){_0x2577c2[_0xef87('0x38')]=_[_0xef87('0x39')](_0x2577c2[_0xef87('0x38')],{'$or':_[_0xef87('0x27')](_0x2577c2[_0xef87('0x31')],function(_0x3e5e8d){var _0x17d899={};_0x17d899[_0x3e5e8d]={'$like':'%'+_0x49ea70[_0xef87('0x2d')][_0xef87('0x37')]+'%'};return _0x17d899;})});}_0x2577c2=_['merge']({},_0x2577c2,_0x49ea70[_0xef87('0x41')]);return _0x5356c7[_0xef87('0x6b')](_0x2577c2);}})[_0xef87('0x21')](function(_0x8cf29){if(_0x8cf29){_0x95589f=_0x8cf29[_0xef87('0x33')];if(!_0x49ea70[_0xef87('0x2d')][_0xef87('0x34')](_0xef87('0x6d'))){_0x2577c2[_0xef87('0x1c')]=qs[_0xef87('0x1c')](_0x49ea70['query'][_0xef87('0x1c')]);_0x2577c2[_0xef87('0x1b')]=qs['offset'](_0x49ea70['query'][_0xef87('0x1b')]);}return _0x5356c7[_0xef87('0x6b')](_0x2577c2);}})[_0xef87('0x21')](function(_0x503738){if(_0x503738){return _0x503738?{'count':_0x95589f,'rows':_0x503738}:null;}})[_0xef87('0x21')](respondWithResult(_0x1d8c9f,null))[_0xef87('0x3c')](handleError(_0x1d8c9f,null));}; \ No newline at end of file +var _0xbbac=['path','sox','to-csv','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','count','offset','limit','json','apply','reject','save','then','MusicOnHolds','stack','name','index','map','VoiceMusicOnHold','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','params','find','catch','body','sequelize','transaction','mode','files','directory','join','root','server/files/moh','create','mkdirSync','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','readdirSync','forEach','unlinkSync','rmdirSync','addSound','Sound','findOne','save_name','converted_format','createdAt','basename','extname','format','%s.%s','symlinkSync','Sequelize','ValidationError','message','removeSound','id2','order','pick','options','getSounds','nolimit','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x46ca56,_0x364acf){var _0x1c75fe=function(_0x4a113f){while(--_0x4a113f){_0x46ca56['push'](_0x46ca56['shift']());}};_0x1c75fe(++_0x364acf);}(_0xbbac,0x69));var _0xcbba=function(_0x240a60,_0x175034){_0x240a60=_0x240a60-0x0;var _0x46bac0=_0xbbac[_0x240a60];return _0x46bac0;};'use strict';var pdf=require(_0xcbba('0x0'));var emlformat=require(_0xcbba('0x1'));var rimraf=require(_0xcbba('0x2'));var zipdir=require(_0xcbba('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcbba('0x4'));var moment=require(_0xcbba('0x5'));var BPromise=require(_0xcbba('0x6'));var Mustache=require(_0xcbba('0x7'));var util=require(_0xcbba('0x8'));var path=require(_0xcbba('0x9'));var sox=require(_0xcbba('0xa'));var csv=require(_0xcbba('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xcbba('0xc'));var crypto=require(_0xcbba('0xd'));var jsforce=require(_0xcbba('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcbba('0xb'));var querystring=require(_0xcbba('0xf'));var Papa=require(_0xcbba('0x10'));var Redis=require(_0xcbba('0x11'));var authService=require(_0xcbba('0x12'));var qs=require(_0xcbba('0x13'));var as=require(_0xcbba('0x14'));var hardwareService=require(_0xcbba('0x15'));var logger=require(_0xcbba('0x16'))(_0xcbba('0x17'));var utils=require(_0xcbba('0x18'));var config=require(_0xcbba('0x19'));var licenseUtil=require(_0xcbba('0x1a'));var db=require(_0xcbba('0x1b'))['db'];function respondWithStatusCode(_0x33bd9c,_0x2a7821){_0x2a7821=_0x2a7821||0xcc;return function(_0x409695){if(_0x409695){return _0x33bd9c[_0xcbba('0x1c')](_0x2a7821);}return _0x33bd9c[_0xcbba('0x1d')](_0x2a7821)[_0xcbba('0x1e')]();};}function respondWithResult(_0x2df196,_0x46f132){_0x46f132=_0x46f132||0xc8;return function(_0x3ff201){if(_0x3ff201){return _0x2df196[_0xcbba('0x1d')](_0x46f132)['json'](_0x3ff201);}};}function respondWithFilteredResult(_0x140b7e,_0x237ae6){return function(_0x362425){if(_0x362425){var _0x833a21=_0x362425[_0xcbba('0x1f')],_0x4cd0df=_0x237ae6['offset'],_0x18519f=_0x237ae6[_0xcbba('0x20')]+_0x237ae6[_0xcbba('0x21')],_0x581199;if(_0x18519f>=_0x833a21){_0x18519f=_0x833a21;_0x581199=0xc8;}else{_0x581199=0xce;}_0x140b7e[_0xcbba('0x1d')](_0x581199);return _0x140b7e['set']('Content-Range',_0x4cd0df+'-'+_0x18519f+'/'+_0x833a21)[_0xcbba('0x22')](_0x362425);}return null;};}function patchUpdates(_0x178937){return function(_0x5cb34f){try{jsonpatch[_0xcbba('0x23')](_0x5cb34f,_0x178937,!![]);}catch(_0x509d1a){return BPromise[_0xcbba('0x24')](_0x509d1a);}return _0x5cb34f[_0xcbba('0x25')]();};}function saveUpdates(_0x14e04c,_0x256f90){return function(_0x5d26e5){if(_0x5d26e5){return _0x5d26e5['update'](_0x14e04c)['then'](function(_0x5870fe){return _0x5870fe;});}return null;};}function removeEntity(_0x49b8a2,_0x442519){return function(_0x20ab4f){if(_0x20ab4f){return _0x20ab4f['destroy']()[_0xcbba('0x26')](function(){var _0x106be4=_0x20ab4f['get']({'plain':!![]});var _0x286576=_0xcbba('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x286576,'resourceId':_0x106be4['id']}})[_0xcbba('0x26')](function(){return _0x20ab4f;});})[_0xcbba('0x26')](function(){_0x49b8a2[_0xcbba('0x1d')](0xcc)[_0xcbba('0x1e')]();});}};}function handleEntityNotFound(_0x57bd0b,_0x3754ef){return function(_0x929137){if(!_0x929137){_0x57bd0b[_0xcbba('0x1c')](0x194);}return _0x929137;};}function handleError(_0xf8d438,_0x296e58){_0x296e58=_0x296e58||0x1f4;return function(_0x100728){logger['error'](_0x100728[_0xcbba('0x28')]);if(_0x100728['name']){delete _0x100728[_0xcbba('0x29')];}_0xf8d438[_0xcbba('0x1d')](_0x296e58)['send'](_0x100728);};}exports[_0xcbba('0x2a')]=function(_0x54a218,_0x11926d){var _0x4086b0={},_0x315111={},_0x36703f={'count':0x0,'rows':[]};var _0x572514=_[_0xcbba('0x2b')](db[_0xcbba('0x2c')][_0xcbba('0x2d')],function(_0x39d74c){return{'name':_0x39d74c[_0xcbba('0x2e')],'type':_0x39d74c['type']['key']};});_0x315111['model']=_[_0xcbba('0x2b')](_0x572514,_0xcbba('0x29'));_0x315111[_0xcbba('0x2f')]=_[_0xcbba('0x30')](_0x54a218[_0xcbba('0x2f')]);_0x315111[_0xcbba('0x31')]=_[_0xcbba('0x32')](_0x315111[_0xcbba('0x33')],_0x315111[_0xcbba('0x2f')]);_0x4086b0[_0xcbba('0x34')]=_[_0xcbba('0x32')](_0x315111[_0xcbba('0x33')],qs['fields'](_0x54a218[_0xcbba('0x2f')][_0xcbba('0x35')]));_0x4086b0[_0xcbba('0x34')]=_0x4086b0[_0xcbba('0x34')][_0xcbba('0x36')]?_0x4086b0['attributes']:_0x315111[_0xcbba('0x33')];if(!_0x54a218[_0xcbba('0x2f')]['hasOwnProperty']('nolimit')){_0x4086b0[_0xcbba('0x21')]=qs['limit'](_0x54a218['query'][_0xcbba('0x21')]);_0x4086b0[_0xcbba('0x20')]=qs[_0xcbba('0x20')](_0x54a218[_0xcbba('0x2f')][_0xcbba('0x20')]);}_0x4086b0['order']=qs[_0xcbba('0x37')](_0x54a218[_0xcbba('0x2f')]['sort']);_0x4086b0['where']=qs['filters'](_['pick'](_0x54a218['query'],_0x315111[_0xcbba('0x31')]),_0x572514);if(_0x54a218['query'][_0xcbba('0x38')]){_0x4086b0[_0xcbba('0x39')]=_[_0xcbba('0x3a')](_0x4086b0[_0xcbba('0x39')],{'$or':_[_0xcbba('0x2b')](_0x572514,function(_0x521c24){if(_0x521c24['type']!==_0xcbba('0x3b')){var _0x5bbb10={};_0x5bbb10[_0x521c24[_0xcbba('0x29')]]={'$like':'%'+_0x54a218[_0xcbba('0x2f')][_0xcbba('0x38')]+'%'};return _0x5bbb10;}})});}_0x4086b0=_['merge']({},_0x4086b0,_0x54a218['options']);var _0x1d0cc6={'where':_0x4086b0[_0xcbba('0x39')]};return db[_0xcbba('0x2c')][_0xcbba('0x1f')](_0x1d0cc6)[_0xcbba('0x26')](function(_0x1a1d44){_0x36703f[_0xcbba('0x1f')]=_0x1a1d44;if(_0x54a218[_0xcbba('0x2f')][_0xcbba('0x3c')]){_0x4086b0[_0xcbba('0x3d')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xcbba('0x3e')](_0x4086b0);})['then'](function(_0x37c325){_0x36703f[_0xcbba('0x3f')]=_0x37c325;return _0x36703f;})[_0xcbba('0x26')](respondWithFilteredResult(_0x11926d,_0x4086b0))['catch'](handleError(_0x11926d,null));};exports['show']=function(_0x5d9aa5,_0x2d31a5){var _0x269b24={'raw':![],'where':{'id':_0x5d9aa5[_0xcbba('0x40')]['id']}},_0x1f4104={};_0x1f4104['model']=_[_0xcbba('0x30')](db[_0xcbba('0x2c')][_0xcbba('0x2d')]);_0x1f4104['query']=_[_0xcbba('0x30')](_0x5d9aa5[_0xcbba('0x2f')]);_0x1f4104['filters']=_[_0xcbba('0x32')](_0x1f4104[_0xcbba('0x33')],_0x1f4104[_0xcbba('0x2f')]);_0x269b24[_0xcbba('0x34')]=_[_0xcbba('0x32')](_0x1f4104[_0xcbba('0x33')],qs['fields'](_0x5d9aa5[_0xcbba('0x2f')][_0xcbba('0x35')]));_0x269b24[_0xcbba('0x34')]=_0x269b24[_0xcbba('0x34')][_0xcbba('0x36')]?_0x269b24[_0xcbba('0x34')]:_0x1f4104[_0xcbba('0x33')];if(_0x5d9aa5['query'][_0xcbba('0x3c')]){_0x269b24[_0xcbba('0x3d')]=[{'all':!![]}];}_0x269b24=_[_0xcbba('0x3a')]({},_0x269b24,_0x5d9aa5['options']);return db[_0xcbba('0x2c')][_0xcbba('0x41')](_0x269b24)[_0xcbba('0x26')](handleEntityNotFound(_0x2d31a5,null))[_0xcbba('0x26')](respondWithResult(_0x2d31a5,null))[_0xcbba('0x42')](handleError(_0x2d31a5,null));};exports['update']=function(_0x4eed9e,_0x2b6573){if(_0x4eed9e[_0xcbba('0x43')]['id']){delete _0x4eed9e[_0xcbba('0x43')]['id'];}return db['VoiceMusicOnHold'][_0xcbba('0x41')]({'where':{'id':_0x4eed9e['params']['id']}})[_0xcbba('0x26')](handleEntityNotFound(_0x2b6573,null))[_0xcbba('0x26')](saveUpdates(_0x4eed9e[_0xcbba('0x43')],null))['then'](respondWithResult(_0x2b6573,null))[_0xcbba('0x42')](handleError(_0x2b6573,null));};exports['create']=function(_0x515e53,_0x16075e,_0x2b769c){return db[_0xcbba('0x44')][_0xcbba('0x45')](function(_0x628b8b){if(_0x515e53['body'][_0xcbba('0x46')]===_0xcbba('0x47')){_0x515e53[_0xcbba('0x43')][_0xcbba('0x48')]=path[_0xcbba('0x49')](config[_0xcbba('0x4a')],_0xcbba('0x4b'),_0x515e53[_0xcbba('0x43')][_0xcbba('0x29')]);}return db[_0xcbba('0x2c')][_0xcbba('0x4c')](_0x515e53['body'],{'transaction':_0x628b8b})['then'](function(_0x408e06){if(_0x515e53[_0xcbba('0x43')][_0xcbba('0x46')]===_0xcbba('0x47')){fs[_0xcbba('0x4d')](_0x408e06[_0xcbba('0x48')],parseInt('0777',0x8));}var _0x36a25f=_0x515e53['user'][_0xcbba('0x4e')]({'plain':!![]});if(!_0x36a25f)throw new Error(_0xcbba('0x4f'));if(_0x36a25f[_0xcbba('0x50')]===_0xcbba('0x51')){var _0x2827cf=_0x408e06[_0xcbba('0x4e')]({'plain':!![]});return db[_0xcbba('0x52')][_0xcbba('0x41')]({'where':{'name':_0xcbba('0x27'),'userProfileId':_0x36a25f[_0xcbba('0x53')]},'raw':!![]})['then'](function(_0xba2cc8){if(_0xba2cc8&&_0xba2cc8[_0xcbba('0x54')]===0x0){return db[_0xcbba('0x55')][_0xcbba('0x4c')]({'name':_0x2827cf[_0xcbba('0x29')],'resourceId':_0x2827cf['id'],'type':_0xba2cc8['name'],'sectionId':_0xba2cc8['id']},{})[_0xcbba('0x26')](function(){return _0x408e06;});}else{return _0x408e06;}})[_0xcbba('0x42')](function(_0x3bc0ab){logger[_0xcbba('0x56')](_0xcbba('0x57'),_0x3bc0ab);});}return _0x408e06;});})[_0xcbba('0x26')](respondWithResult(_0x16075e,0xc9))[_0xcbba('0x42')](handleError(_0x16075e,null));};exports[_0xcbba('0x58')]=function(_0x47d9a0,_0x5b6459,_0x5e2ab1){var _0x467891;return db[_0xcbba('0x2c')][_0xcbba('0x41')]({'where':{'id':_0x47d9a0[_0xcbba('0x40')]['id']}})[_0xcbba('0x26')](function(_0xedb4dc){if(_0xedb4dc){return db[_0xcbba('0x44')][_0xcbba('0x45')](function(_0x3ea640){return _0xedb4dc[_0xcbba('0x58')]({'transaction':_0x3ea640,'raw':!![]})[_0xcbba('0x26')](function(_0x5a007d){if(_0x5a007d[_0xcbba('0x48')]){fs[_0xcbba('0x59')](_0x5a007d['directory'])[_0xcbba('0x5a')](function(_0xa3849d){fs[_0xcbba('0x5b')](path[_0xcbba('0x49')](_0x5a007d[_0xcbba('0x48')],_0xa3849d));});fs[_0xcbba('0x5c')](_0x5a007d[_0xcbba('0x48')]);}return _0x5a007d;});})[_0xcbba('0x42')](function(_0x344749){throw new db['Sequelize']['ValidationError'](_0x344749['message']);});}})[_0xcbba('0x26')](handleEntityNotFound(_0x5b6459,null))[_0xcbba('0x26')](removeEntity(_0x5b6459,null))['catch'](handleError(_0x5b6459,null));};exports[_0xcbba('0x5d')]=function(_0x486740,_0x6dabf5,_0x386d5c){return db['sequelize'][_0xcbba('0x45')](function(_0x11c651){var _0x676103;return db[_0xcbba('0x2c')][_0xcbba('0x41')]({'where':{'id':_0x486740[_0xcbba('0x40')]['id']}})[_0xcbba('0x26')](function(_0x6a65b8){if(_0x6a65b8){_0x676103=_0x6a65b8;return _0x6a65b8[_0xcbba('0x5d')](_0x486740[_0xcbba('0x43')]['id'],{'transaction':_0x11c651});}})[_0xcbba('0x26')](function(_0x1dc427){if(_0x1dc427){return db[_0xcbba('0x5e')][_0xcbba('0x5f')]({'where':{'id':_0x486740['body']['id']},'attributes':['id',_0xcbba('0x29'),_0xcbba('0x60'),_0xcbba('0x61'),_0xcbba('0x62')],'raw':!![]});}})[_0xcbba('0x26')](function(_0x3c63bf){if(_0x3c63bf){var _0x2cdf10=path[_0xcbba('0x49')](config[_0xcbba('0x4a')],'server/files/sounds/converted',util['format']('%s.%s',path[_0xcbba('0x63')](_0x3c63bf['save_name'],path[_0xcbba('0x64')](_0x3c63bf[_0xcbba('0x60')])),_0x3c63bf[_0xcbba('0x61')]));var _0x1f6641=path[_0xcbba('0x49')](config[_0xcbba('0x4a')],_0xcbba('0x4b'),_0x676103[_0xcbba('0x29')],util[_0xcbba('0x65')](_0xcbba('0x66'),_0x3c63bf[_0xcbba('0x29')],_0x3c63bf[_0xcbba('0x61')]));fs[_0xcbba('0x67')](_0x2cdf10,_0x1f6641);return _0x3c63bf;}})[_0xcbba('0x42')](function(_0x184838){throw new db[(_0xcbba('0x68'))][(_0xcbba('0x69'))](_0x184838[_0xcbba('0x6a')]);});})[_0xcbba('0x26')](handleEntityNotFound(_0x6dabf5,null))[_0xcbba('0x26')](respondWithResult(_0x6dabf5,0xc9))[_0xcbba('0x42')](handleError(_0x6dabf5,null));};exports[_0xcbba('0x6b')]=function(_0x451d95,_0x8647fd,_0x5c6b43){return db[_0xcbba('0x44')][_0xcbba('0x45')](function(_0x2f665c){var _0x17a0da;return db['VoiceMusicOnHold'][_0xcbba('0x5f')]({'where':{'id':_0x451d95[_0xcbba('0x40')]['id']}})['then'](handleEntityNotFound(_0x8647fd,null))[_0xcbba('0x26')](function(_0x31efdc){if(_0x31efdc){_0x17a0da=_0x31efdc;return _0x31efdc[_0xcbba('0x6b')](_0x451d95[_0xcbba('0x40')]['id2']);}})[_0xcbba('0x26')](function(_0x396506){if(_0x396506){return db[_0xcbba('0x5e')]['findOne']({'where':{'id':_0x451d95[_0xcbba('0x40')][_0xcbba('0x6c')]},'attributes':['id',_0xcbba('0x29'),_0xcbba('0x60'),_0xcbba('0x61'),_0xcbba('0x62')],'raw':!![]});}})[_0xcbba('0x26')](function(_0x2da88a){if(_0x2da88a){fs['unlinkSync'](path['join'](_0x17a0da['directory'],util[_0xcbba('0x65')](_0xcbba('0x66'),_0x2da88a[_0xcbba('0x29')],_0x2da88a[_0xcbba('0x61')])));return _0x2da88a;}})['catch'](function(_0x2d7d2a){throw new db[(_0xcbba('0x68'))][(_0xcbba('0x69'))](_0x2d7d2a[_0xcbba('0x6a')]);});})['then'](handleEntityNotFound(_0x8647fd,null))['then'](respondWithStatusCode(_0x8647fd,0xcc))[_0xcbba('0x42')](handleError(_0x8647fd,null));};exports['getSounds']=function(_0x58cc7d,_0x3e7042,_0x154eab){var _0x59e06a={};var _0x5eabc5={};var _0xd189ea;var _0x3102bc;return db[_0xcbba('0x2c')]['findOne']({'where':{'id':_0x58cc7d[_0xcbba('0x40')]['id']}})[_0xcbba('0x26')](handleEntityNotFound(_0x3e7042,null))[_0xcbba('0x26')](function(_0x171409){if(_0x171409){_0xd189ea=_0x171409;_0x5eabc5[_0xcbba('0x33')]=_[_0xcbba('0x30')](db[_0xcbba('0x5e')]['rawAttributes']);_0x5eabc5[_0xcbba('0x2f')]=_[_0xcbba('0x30')](_0x58cc7d['query']);_0x5eabc5[_0xcbba('0x31')]=_[_0xcbba('0x32')](_0x5eabc5[_0xcbba('0x33')],_0x5eabc5['query']);_0x59e06a[_0xcbba('0x34')]=_[_0xcbba('0x32')](_0x5eabc5[_0xcbba('0x33')],qs[_0xcbba('0x35')](_0x58cc7d[_0xcbba('0x2f')][_0xcbba('0x35')]));_0x59e06a[_0xcbba('0x34')]=_0x59e06a[_0xcbba('0x34')][_0xcbba('0x36')]?_0x59e06a['attributes']:_0x5eabc5[_0xcbba('0x33')];_0x59e06a[_0xcbba('0x6d')]=qs[_0xcbba('0x37')](_0x58cc7d[_0xcbba('0x2f')]['sort']);_0x59e06a['where']=qs[_0xcbba('0x31')](_[_0xcbba('0x6e')](_0x58cc7d[_0xcbba('0x2f')],_0x5eabc5[_0xcbba('0x31')]));if(_0x58cc7d[_0xcbba('0x2f')][_0xcbba('0x38')]){_0x59e06a[_0xcbba('0x39')]=_[_0xcbba('0x3a')](_0x59e06a[_0xcbba('0x39')],{'$or':_['map'](_0x59e06a[_0xcbba('0x34')],function(_0x462717){var _0x3113c7={};_0x3113c7[_0x462717]={'$like':'%'+_0x58cc7d[_0xcbba('0x2f')]['filter']+'%'};return _0x3113c7;})});}_0x59e06a=_[_0xcbba('0x3a')]({},_0x59e06a,_0x58cc7d[_0xcbba('0x6f')]);return _0xd189ea[_0xcbba('0x70')](_0x59e06a);}})[_0xcbba('0x26')](function(_0x312475){if(_0x312475){_0x3102bc=_0x312475[_0xcbba('0x36')];if(!_0x58cc7d[_0xcbba('0x2f')]['hasOwnProperty'](_0xcbba('0x71'))){_0x59e06a[_0xcbba('0x21')]=qs['limit'](_0x58cc7d[_0xcbba('0x2f')][_0xcbba('0x21')]);_0x59e06a[_0xcbba('0x20')]=qs[_0xcbba('0x20')](_0x58cc7d[_0xcbba('0x2f')]['offset']);}return _0xd189ea['getSounds'](_0x59e06a);}})[_0xcbba('0x26')](function(_0x27ed62){if(_0x27ed62){return _0x27ed62?{'count':_0x3102bc,'rows':_0x27ed62}:null;}})['then'](respondWithResult(_0x3e7042,null))[_0xcbba('0x42')](handleError(_0x3e7042,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index b551be0..ba66520 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 _0x07db=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','define','lodash','util'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x07db,0xcf));var _0xb07d=function(_0x5e6bec,_0x1eb54d){_0x5e6bec=_0x5e6bec-0x0;var _0x5dc5cf=_0x07db[_0x5e6bec];return _0x5dc5cf;};'use strict';var _=require(_0xb07d('0x0'));var util=require(_0xb07d('0x1'));var logger=require(_0xb07d('0x2'))(_0xb07d('0x3'));var moment=require(_0xb07d('0x4'));var BPromise=require(_0xb07d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb07d('0x6'));var rimraf=require(_0xb07d('0x7'));var config=require(_0xb07d('0x8'));var attributes=require(_0xb07d('0x9'));module['exports']=function(_0xa33cc0,_0x1a1142){return _0xa33cc0[_0xb07d('0xa')]('VoiceMusicOnHold',attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51ca=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util'];(function(_0x49b004,_0x3935a5){var _0x29ec13=function(_0xa018ca){while(--_0xa018ca){_0x49b004['push'](_0x49b004['shift']());}};_0x29ec13(++_0x3935a5);}(_0x51ca,0xe8));var _0xa51c=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x51ca[_0x5a9c0c];return _0x53c77d;};'use strict';var _=require(_0xa51c('0x0'));var util=require(_0xa51c('0x1'));var logger=require(_0xa51c('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa51c('0x3'));var rp=require(_0xa51c('0x4'));var fs=require('fs');var path=require(_0xa51c('0x5'));var rimraf=require(_0xa51c('0x6'));var config=require(_0xa51c('0x7'));var attributes=require(_0xa51c('0x8'));module[_0xa51c('0x9')]=function(_0x433683,_0x308514){return _0x433683[_0xa51c('0xa')](_0xa51c('0xb'),attributes,{'tableName':_0xa51c('0xc'),'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 cb82cc2..affeab2 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 _0x9310=['jayson/promise','client','http','request','then','info','request\x20sent','debug','error','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','../../config/logger'];(function(_0x8357df,_0x118d2c){var _0x345f33=function(_0xeeeb9d){while(--_0xeeeb9d){_0x8357df['push'](_0x8357df['shift']());}};_0x345f33(++_0x118d2c);}(_0x9310,0x10b));var _0x0931=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0x9310[_0x3aaf0a];return _0x33e6bc;};'use strict';var _=require(_0x0931('0x0'));var util=require('util');var moment=require(_0x0931('0x1'));var BPromise=require(_0x0931('0x2'));var rs=require(_0x0931('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0931('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0931('0x5'));var client=jayson[_0x0931('0x6')][_0x0931('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x197d09,_0x282517,_0x4abbc1){return new BPromise(function(_0x3e5f64,_0x4d3e3b){return client[_0x0931('0x8')](_0x197d09,_0x4abbc1)[_0x0931('0x9')](function(_0x1dd30c){logger[_0x0931('0xa')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x282517,_0x0931('0xb'));logger[_0x0931('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x282517,_0x0931('0xb'),JSON['stringify'](_0x1dd30c));if(_0x1dd30c[_0x0931('0xd')]){if(_0x1dd30c[_0x0931('0xd')]['code']===0x1f4){logger[_0x0931('0xd')](_0x0931('0xe'),_0x282517,_0x1dd30c[_0x0931('0xd')]['message']);return _0x4d3e3b(_0x1dd30c[_0x0931('0xd')][_0x0931('0xf')]);}logger[_0x0931('0xd')](_0x0931('0xe'),_0x282517,_0x1dd30c[_0x0931('0xd')]['message']);return _0x3e5f64(_0x1dd30c[_0x0931('0xd')]['message']);}else{logger[_0x0931('0xa')](_0x0931('0xe'),_0x282517,'request\x20sent');_0x3e5f64(_0x1dd30c['result'][_0x0931('0xf')]);}})[_0x0931('0x10')](function(_0x4fccc0){logger[_0x0931('0xd')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x282517,_0x4fccc0);_0x4d3e3b(_0x4fccc0);});});} \ No newline at end of file +var _0xb657=['then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\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','client','http','request'];(function(_0x28c97e,_0x309739){var _0x1d3425=function(_0x3fbe20){while(--_0x3fbe20){_0x28c97e['push'](_0x28c97e['shift']());}};_0x1d3425(++_0x309739);}(_0xb657,0x1ce));var _0x7b65=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xb657[_0x32f7d7];return _0x133d09;};'use strict';var _=require(_0x7b65('0x0'));var util=require(_0x7b65('0x1'));var moment=require(_0x7b65('0x2'));var BPromise=require(_0x7b65('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7b65('0x4'));var db=require(_0x7b65('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b65('0x6'))(_0x7b65('0x7'));var config=require(_0x7b65('0x8'));var jayson=require(_0x7b65('0x9'));var client=jayson[_0x7b65('0xa')][_0x7b65('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xe37213,_0xc8fa93,_0x2bc0cb){return new BPromise(function(_0x3e9881,_0x4ff02c){return client[_0x7b65('0xc')](_0xe37213,_0x2bc0cb)[_0x7b65('0xd')](function(_0x3fe09a){logger[_0x7b65('0xe')](_0x7b65('0xf'),_0xc8fa93,_0x7b65('0x10'));logger[_0x7b65('0x11')](_0x7b65('0x12'),_0xc8fa93,'request\x20sent',JSON[_0x7b65('0x13')](_0x3fe09a));if(_0x3fe09a[_0x7b65('0x14')]){if(_0x3fe09a[_0x7b65('0x14')][_0x7b65('0x15')]===0x1f4){logger[_0x7b65('0x14')](_0x7b65('0xf'),_0xc8fa93,_0x3fe09a[_0x7b65('0x14')][_0x7b65('0x16')]);return _0x4ff02c(_0x3fe09a[_0x7b65('0x14')][_0x7b65('0x16')]);}logger[_0x7b65('0x14')](_0x7b65('0xf'),_0xc8fa93,_0x3fe09a[_0x7b65('0x14')][_0x7b65('0x16')]);return _0x3e9881(_0x3fe09a[_0x7b65('0x14')][_0x7b65('0x16')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0xc8fa93,'request\x20sent');_0x3e9881(_0x3fe09a[_0x7b65('0x17')]['message']);}})[_0x7b65('0x18')](function(_0x5ea8cc){logger[_0x7b65('0x14')](_0x7b65('0xf'),_0xc8fa93,_0x5ea8cc);_0x4ff02c(_0x5ea8cc);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index ed566b9..0869293 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 _0xd415=['getAgents','post','/:id','delete','destroy','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./voicePrefix.controller','get','index','isAuthenticated','show','/:id/users'];(function(_0x82f586,_0x382c19){var _0x591ec8=function(_0xe5a055){while(--_0xe5a055){_0x82f586['push'](_0x82f586['shift']());}};_0x591ec8(++_0x382c19);}(_0xd415,0x1e2));var _0x5d41=function(_0xef9322,_0x1597ba){_0xef9322=_0xef9322-0x0;var _0x1632d8=_0xd415[_0xef9322];return _0x1632d8;};'use strict';var multer=require('multer');var util=require(_0x5d41('0x0'));var path=require(_0x5d41('0x1'));var timeout=require(_0x5d41('0x2'));var express=require(_0x5d41('0x3'));var router=express[_0x5d41('0x4')]();var auth=require(_0x5d41('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5d41('0x6'));router[_0x5d41('0x7')]('/',auth['isAuthenticated'](),controller[_0x5d41('0x8')]);router[_0x5d41('0x7')]('/describe',auth[_0x5d41('0x9')](),controller['describe']);router[_0x5d41('0x7')]('/:id',auth[_0x5d41('0x9')](),controller[_0x5d41('0xa')]);router[_0x5d41('0x7')](_0x5d41('0xb'),auth['isAuthenticated'](),controller[_0x5d41('0xc')]);router[_0x5d41('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5d41('0xd')](_0x5d41('0xb'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x5d41('0xe'),auth[_0x5d41('0x9')](),controller['update']);router[_0x5d41('0xf')](_0x5d41('0xe'),auth[_0x5d41('0x9')](),controller[_0x5d41('0x10')]);router[_0x5d41('0xf')]('/:id/users',auth[_0x5d41('0x9')](),controller[_0x5d41('0x11')]);module[_0x5d41('0x12')]=router; \ No newline at end of file +var _0x5ea1=['/:id','show','create','post','/:id/users','put','update','delete','destroy','removeAgents','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','describe'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0x5ea1,0xdc));var _0x15ea=function(_0x5e87e1,_0x3383c8){_0x5e87e1=_0x5e87e1-0x0;var _0xe6f297=_0x5ea1[_0x5e87e1];return _0xe6f297;};'use strict';var multer=require('multer');var util=require(_0x15ea('0x0'));var path=require(_0x15ea('0x1'));var timeout=require('connect-timeout');var express=require(_0x15ea('0x2'));var router=express[_0x15ea('0x3')]();var auth=require(_0x15ea('0x4'));var interaction=require(_0x15ea('0x5'));var config=require('../../config/environment');var controller=require(_0x15ea('0x6'));router[_0x15ea('0x7')]('/',auth[_0x15ea('0x8')](),controller[_0x15ea('0x9')]);router[_0x15ea('0x7')]('/describe',auth[_0x15ea('0x8')](),controller[_0x15ea('0xa')]);router['get'](_0x15ea('0xb'),auth['isAuthenticated'](),controller[_0x15ea('0xc')]);router['get']('/:id/users',auth[_0x15ea('0x8')](),controller['getAgents']);router['post']('/',auth[_0x15ea('0x8')](),controller[_0x15ea('0xd')]);router[_0x15ea('0xe')](_0x15ea('0xf'),auth[_0x15ea('0x8')](),controller['addAgents']);router[_0x15ea('0x10')](_0x15ea('0xb'),auth[_0x15ea('0x8')](),controller[_0x15ea('0x11')]);router[_0x15ea('0x12')](_0x15ea('0xb'),auth[_0x15ea('0x8')](),controller[_0x15ea('0x13')]);router['delete'](_0x15ea('0xf'),auth['isAuthenticated'](),controller[_0x15ea('0x14')]);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 347b727..44c318c 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 _0xd52a=['getDataValue','STRING','exports','name','VIRTUAL'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd52a,0xca));var _0xad52=function(_0x2a5167,_0x430d85){_0x2a5167=_0x2a5167-0x0;var _0x706982=_0xd52a[_0x2a5167];return _0x706982;};'use strict';var Sequelize=require('sequelize');module[_0xad52('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xad52('0x1')},'prefix':{'type':Sequelize[_0xad52('0x2')],'get':function(_0x30b335){return'system-'+this[_0xad52('0x3')](_0xad52('0x1'))+'-';}},'description':{'type':Sequelize[_0xad52('0x4')]},'callerIdAll':{'type':Sequelize[_0xad52('0x4')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x89e7=['getDataValue','name','sequelize','exports','STRING','VIRTUAL','system-'];(function(_0x402aac,_0x1ac1a3){var _0x124ea8=function(_0x3196ca){while(--_0x3196ca){_0x402aac['push'](_0x402aac['shift']());}};_0x124ea8(++_0x1ac1a3);}(_0x89e7,0x1a6));var _0x789e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x89e7[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x789e('0x0'));module[_0x789e('0x1')]={'name':{'type':Sequelize[_0x789e('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x789e('0x3')],'get':function(_0x497594){return _0x789e('0x4')+this[_0x789e('0x5')](_0x789e('0x6'))+'-';}},'description':{'type':Sequelize[_0x789e('0x2')]},'callerIdAll':{'type':Sequelize[_0x789e('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index a536762..a36b47c 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 _0xcb41=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','get','UserProfileResource','error','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','destroy','describe','create','sequelize','body','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','app','description','Voice\x20Prefix\x20Extension','priority','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','push','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','transaction','findById','addAgents','ids','removeAgents','emit','userVoicePrefix:remove','getAgents','findOne','User','pick','nolimit','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api'];(function(_0x484cac,_0x30ad3a){var _0x1d6e77=function(_0x4f5f16){while(--_0x4f5f16){_0x484cac['push'](_0x484cac['shift']());}};_0x1d6e77(++_0x30ad3a);}(_0xcb41,0x1df));var _0x1cb4=function(_0x3342b8,_0x235581){_0x3342b8=_0x3342b8-0x0;var _0x20703e=_0xcb41[_0x3342b8];return _0x20703e;};'use strict';var pdf=require(_0x1cb4('0x0'));var emlformat=require(_0x1cb4('0x1'));var rimraf=require(_0x1cb4('0x2'));var zipdir=require(_0x1cb4('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1cb4('0x4'));var moment=require('moment');var BPromise=require(_0x1cb4('0x5'));var Mustache=require(_0x1cb4('0x6'));var util=require(_0x1cb4('0x7'));var path=require(_0x1cb4('0x8'));var sox=require(_0x1cb4('0x9'));var csv=require(_0x1cb4('0xa'));var ejs=require(_0x1cb4('0xb'));var fs=require('fs');var _=require(_0x1cb4('0xc'));var squel=require('squel');var crypto=require(_0x1cb4('0xd'));var jsforce=require(_0x1cb4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1cb4('0xa'));var querystring=require(_0x1cb4('0xf'));var Papa=require(_0x1cb4('0x10'));var Redis=require('ioredis');var authService=require(_0x1cb4('0x11'));var qs=require(_0x1cb4('0x12'));var as=require(_0x1cb4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1cb4('0x14'));var utils=require('../../config/utils');var config=require(_0x1cb4('0x15'));var licenseUtil=require(_0x1cb4('0x16'));var db=require(_0x1cb4('0x17'))['db'];config[_0x1cb4('0x18')]=_[_0x1cb4('0x19')](config['redis'],{'host':_0x1cb4('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1cb4('0x18')]));require(_0x1cb4('0x1b'))[_0x1cb4('0x1c')](socket);function respondWithStatusCode(_0xb01aec,_0x147d0e){_0x147d0e=_0x147d0e||0xcc;return function(_0x433cfa){if(_0x433cfa){return _0xb01aec[_0x1cb4('0x1d')](_0x147d0e);}return _0xb01aec[_0x1cb4('0x1e')](_0x147d0e)[_0x1cb4('0x1f')]();};}function respondWithResult(_0x1858f1,_0x521b49){_0x521b49=_0x521b49||0xc8;return function(_0xbc72fd){if(_0xbc72fd){return _0x1858f1['status'](_0x521b49)[_0x1cb4('0x20')](_0xbc72fd);}};}function respondWithFilteredResult(_0x10326c,_0x5384db){return function(_0x56d926){if(_0x56d926){var _0x25b120=_0x56d926[_0x1cb4('0x21')],_0x281d36=_0x5384db[_0x1cb4('0x22')],_0xfc93ad=_0x5384db[_0x1cb4('0x22')]+_0x5384db[_0x1cb4('0x23')],_0x3c4493;if(_0xfc93ad>=_0x25b120){_0xfc93ad=_0x25b120;_0x3c4493=0xc8;}else{_0x3c4493=0xce;}_0x10326c['status'](_0x3c4493);return _0x10326c[_0x1cb4('0x24')](_0x1cb4('0x25'),_0x281d36+'-'+_0xfc93ad+'/'+_0x25b120)['json'](_0x56d926);}return null;};}function patchUpdates(_0x33993b){return function(_0x37aa88){try{jsonpatch[_0x1cb4('0x26')](_0x37aa88,_0x33993b,!![]);}catch(_0x19d342){return BPromise['reject'](_0x19d342);}return _0x37aa88[_0x1cb4('0x27')]();};}function saveUpdates(_0x51fc8d,_0x5ca9b5){return function(_0x20afe0){if(_0x20afe0){return _0x20afe0[_0x1cb4('0x28')](_0x51fc8d)[_0x1cb4('0x29')](function(_0x4d93b9){return _0x4d93b9;});}return null;};}function removeEntity(_0x3533e8,_0x33ec9c){return function(_0x2296d3){if(_0x2296d3){return _0x2296d3['destroy']()[_0x1cb4('0x29')](function(){var _0x1e8d9c=_0x2296d3[_0x1cb4('0x2a')]({'plain':!![]});var _0x8f32fb='VoicePrefixes';return db[_0x1cb4('0x2b')]['destroy']({'where':{'type':_0x8f32fb,'resourceId':_0x1e8d9c['id']}})['then'](function(){return _0x2296d3;});})['then'](function(){_0x3533e8[_0x1cb4('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28ac89,_0x17f4e1){return function(_0x569fff){if(!_0x569fff){_0x28ac89['sendStatus'](0x194);}return _0x569fff;};}function handleError(_0x2eced0,_0x32f6fd){_0x32f6fd=_0x32f6fd||0x1f4;return function(_0x1afda3){logger[_0x1cb4('0x2c')](_0x1afda3[_0x1cb4('0x2d')]);if(_0x1afda3[_0x1cb4('0x2e')]){delete _0x1afda3['name'];}_0x2eced0['status'](_0x32f6fd)['send'](_0x1afda3);};}exports[_0x1cb4('0x2f')]=function(_0x24b709,_0x22d82a){var _0xd97190={},_0x454546={},_0xf9a444={'count':0x0,'rows':[]};var _0x46a356=_[_0x1cb4('0x30')](db[_0x1cb4('0x31')][_0x1cb4('0x32')],function(_0x2e0cdb){return{'name':_0x2e0cdb[_0x1cb4('0x33')],'type':_0x2e0cdb[_0x1cb4('0x34')][_0x1cb4('0x35')]};});_0x454546[_0x1cb4('0x36')]=_[_0x1cb4('0x30')](_0x46a356,_0x1cb4('0x2e'));_0x454546[_0x1cb4('0x37')]=_['keys'](_0x24b709[_0x1cb4('0x37')]);_0x454546[_0x1cb4('0x38')]=_[_0x1cb4('0x39')](_0x454546[_0x1cb4('0x36')],_0x454546[_0x1cb4('0x37')]);_0xd97190['attributes']=_[_0x1cb4('0x39')](_0x454546[_0x1cb4('0x36')],qs[_0x1cb4('0x3a')](_0x24b709[_0x1cb4('0x37')][_0x1cb4('0x3a')]));_0xd97190[_0x1cb4('0x3b')]=_0xd97190[_0x1cb4('0x3b')][_0x1cb4('0x3c')]?_0xd97190[_0x1cb4('0x3b')]:_0x454546['model'];if(!_0x24b709['query'][_0x1cb4('0x3d')]('nolimit')){_0xd97190['limit']=qs[_0x1cb4('0x23')](_0x24b709[_0x1cb4('0x37')][_0x1cb4('0x23')]);_0xd97190[_0x1cb4('0x22')]=qs[_0x1cb4('0x22')](_0x24b709[_0x1cb4('0x37')]['offset']);}_0xd97190[_0x1cb4('0x3e')]=qs[_0x1cb4('0x3f')](_0x24b709[_0x1cb4('0x37')][_0x1cb4('0x3f')]);_0xd97190[_0x1cb4('0x40')]=qs[_0x1cb4('0x38')](_['pick'](_0x24b709[_0x1cb4('0x37')],_0x454546[_0x1cb4('0x38')]),_0x46a356);if(_0x24b709[_0x1cb4('0x37')][_0x1cb4('0x41')]){_0xd97190[_0x1cb4('0x40')]=_[_0x1cb4('0x42')](_0xd97190['where'],{'$or':_[_0x1cb4('0x30')](_0x46a356,function(_0xcafc83){if(_0xcafc83[_0x1cb4('0x34')]!=='VIRTUAL'){var _0x23bbbf={};_0x23bbbf[_0xcafc83['name']]={'$like':'%'+_0x24b709[_0x1cb4('0x37')][_0x1cb4('0x41')]+'%'};return _0x23bbbf;}})});}_0xd97190=_['merge']({},_0xd97190,_0x24b709['options']);var _0x565628={'where':_0xd97190[_0x1cb4('0x40')]};return db[_0x1cb4('0x31')][_0x1cb4('0x21')](_0x565628)[_0x1cb4('0x29')](function(_0x1e4616){_0xf9a444['count']=_0x1e4616;if(_0x24b709['query'][_0x1cb4('0x43')]){_0xd97190[_0x1cb4('0x44')]=[{'all':!![]}];}return db[_0x1cb4('0x31')][_0x1cb4('0x45')](_0xd97190);})[_0x1cb4('0x29')](function(_0x23c5f0){_0xf9a444[_0x1cb4('0x46')]=_0x23c5f0;return _0xf9a444;})[_0x1cb4('0x29')](respondWithFilteredResult(_0x22d82a,_0xd97190))[_0x1cb4('0x47')](handleError(_0x22d82a,null));};exports[_0x1cb4('0x48')]=function(_0x1479db,_0x5c6231){var _0x50a5ee={'raw':![],'where':{'id':_0x1479db[_0x1cb4('0x49')]['id']}},_0x3ce3a0={};_0x3ce3a0['model']=_[_0x1cb4('0x4a')](db[_0x1cb4('0x31')][_0x1cb4('0x32')]);_0x3ce3a0[_0x1cb4('0x37')]=_['keys'](_0x1479db[_0x1cb4('0x37')]);_0x3ce3a0[_0x1cb4('0x38')]=_[_0x1cb4('0x39')](_0x3ce3a0[_0x1cb4('0x36')],_0x3ce3a0['query']);_0x50a5ee[_0x1cb4('0x3b')]=_[_0x1cb4('0x39')](_0x3ce3a0['model'],qs['fields'](_0x1479db[_0x1cb4('0x37')]['fields']));_0x50a5ee['attributes']=_0x50a5ee[_0x1cb4('0x3b')][_0x1cb4('0x3c')]?_0x50a5ee[_0x1cb4('0x3b')]:_0x3ce3a0['model'];if(_0x1479db[_0x1cb4('0x37')][_0x1cb4('0x43')]){_0x50a5ee[_0x1cb4('0x44')]=[{'all':!![]}];}_0x50a5ee=_[_0x1cb4('0x42')]({},_0x50a5ee,_0x1479db[_0x1cb4('0x4b')]);return db['VoicePrefix'][_0x1cb4('0x4c')](_0x50a5ee)[_0x1cb4('0x29')](handleEntityNotFound(_0x5c6231,null))[_0x1cb4('0x29')](respondWithResult(_0x5c6231,null))[_0x1cb4('0x47')](handleError(_0x5c6231,null));};exports[_0x1cb4('0x4d')]=function(_0x5b80af,_0x284b5a){return db[_0x1cb4('0x31')][_0x1cb4('0x4c')]({'where':{'id':_0x5b80af[_0x1cb4('0x49')]['id']}})[_0x1cb4('0x29')](handleEntityNotFound(_0x284b5a,null))[_0x1cb4('0x29')](removeEntity(_0x284b5a,null))[_0x1cb4('0x47')](handleError(_0x284b5a,null));};exports[_0x1cb4('0x4e')]=function(_0x24fcb3,_0x4f0e2f){return db[_0x1cb4('0x31')]['describe']()[_0x1cb4('0x29')](respondWithResult(_0x4f0e2f,null))[_0x1cb4('0x47')](handleError(_0x4f0e2f,null));};exports[_0x1cb4('0x4f')]=function(_0x258866,_0x12573){var _0x2c1fb9;return db[_0x1cb4('0x50')]['transaction'](function(_0x2c2974){return db['VoicePrefix']['create'](_0x258866[_0x1cb4('0x51')],{'transaction':_0x2c2974})[_0x1cb4('0x29')](function(_0x65c3aa){_0x2c1fb9=_0x65c3aa[_0x1cb4('0x2a')]({'plain':!![]});return db['VoiceExtension'][_0x1cb4('0x4c')]({'where':{'id':_0x2c1fb9[_0x1cb4('0x52')]},'raw':!![]})[_0x1cb4('0x29')](function(_0x13f5ab){return createVoicePrefixExtensions(_0x2c1fb9,_0x13f5ab,_0x2c2974);});});})[_0x1cb4('0x29')](function(){var _0x441d5c=_0x258866['user'][_0x1cb4('0x2a')]({'plain':!![]});if(!_0x441d5c)throw new Error(_0x1cb4('0x53'));if(_0x441d5c[_0x1cb4('0x54')]===_0x1cb4('0x55')){var _0x17b079=_0x2c1fb9;return db[_0x1cb4('0x56')][_0x1cb4('0x4c')]({'where':{'name':_0x1cb4('0x57'),'userProfileId':_0x441d5c[_0x1cb4('0x58')]},'raw':!![]})['then'](function(_0x93f90){if(_0x93f90&&_0x93f90[_0x1cb4('0x59')]===0x0){return db[_0x1cb4('0x2b')][_0x1cb4('0x4f')]({'name':_0x17b079[_0x1cb4('0x2e')],'resourceId':_0x17b079['id'],'type':_0x93f90[_0x1cb4('0x2e')],'sectionId':_0x93f90['id']},{})['then'](function(){return _0x2c1fb9;});}else{return _0x2c1fb9;}})[_0x1cb4('0x47')](function(_0x29bace){logger[_0x1cb4('0x2c')](_0x1cb4('0x5a'),_0x29bace);throw _0x29bace;});}return _0x2c1fb9;})[_0x1cb4('0x29')](respondWithResult(_0x12573,null))[_0x1cb4('0x47')](handleError(_0x12573,null));};function Extension(_0x2bab90,_0x5eee5d,_0x3829f1,_0x46c9af){this['context']=_0x1cb4('0x5b');this['exten']=_0x2bab90;this[_0x1cb4('0x5c')]=_0x3829f1;this['type']='system';this[_0x1cb4('0x5d')]=_0x1cb4('0x5e');this[_0x1cb4('0x5f')]=_0x5eee5d;this['appdata']=_0x46c9af;}function createVoicePrefixExtensions(_0x5ae1ec,_0x421431,_0x197f9e){return new BPromise(function(_0x16c56c,_0x51aabf){var _0x4ad2a6=new Extension(formatPrefixName(_0x5ae1ec[_0x1cb4('0x60')]),0x1,_0x1cb4('0x61'),_0x1cb4('0x62'));_0x4ad2a6[_0x1cb4('0x63')]=_0x5ae1ec['id'];return db[_0x1cb4('0x64')][_0x1cb4('0x4f')](_0x4ad2a6,{'transaction':_0x197f9e})[_0x1cb4('0x29')](function(_0xb66bf6){var _0x356a1a=_0xb66bf6[_0x1cb4('0x2a')]({'plain':!![]});var _0x202ad6=_[_0x1cb4('0x30')](addVoicePrefixExtensions(_0x5ae1ec,_0x421431),function(_0xaab86e){_0xaab86e[_0x1cb4('0x52')]=_0x356a1a['id'];_0xaab86e['VoicePrefixId']=_0x5ae1ec['id'];return _0xaab86e;});return db[_0x1cb4('0x64')][_0x1cb4('0x65')](_0x202ad6,{'transaction':_0x197f9e})['then'](function(_0x3a941b){if(!_0x3a941b){return _0x51aabf(_0x1cb4('0x66'));}else{return _0x16c56c(_0x3a941b);}})[_0x1cb4('0x47')](function(_0x1f23da){return _0x51aabf(_0x1f23da);});});;});};function addVoicePrefixExtensions(_0x48abd9,_0x39bee1){var _0x285241=[];var _0x588a3d=formatPrefixName(_0x48abd9[_0x1cb4('0x60')]);_0x285241['push'](new Extension(_0x588a3d,0x2,_0x1cb4('0x67'),_0x1cb4('0x68')+_0x48abd9[_0x1cb4('0x2e')]));if(_0x48abd9[_0x1cb4('0x69')]){_0x285241['push'](new Extension(_0x588a3d,0x3,_0x1cb4('0x67'),_0x1cb4('0x6a')+_0x48abd9[_0x1cb4('0x69')]));}else{_0x285241[_0x1cb4('0x6b')](new Extension(_0x588a3d,0x3,'NoOp',_0x1cb4('0x6c')));}_0x285241[_0x1cb4('0x6b')](new Extension(_0x588a3d,0x4,_0x1cb4('0x6d'),_0x39bee1[_0x1cb4('0x6e')]+','+_0x1cb4('0x6f')+(0x8+_0x48abd9[_0x1cb4('0x2e')]['length'])+'}'+','+0x1));return _0x285241;}function formatPrefixName(_0x23adf6){var _0x4bf18c='_';for(var _0xb8fc5a=0x0;_0xb8fc5a<_0x23adf6[_0x1cb4('0x3c')];_0xb8fc5a++){if(_0x23adf6[_0x1cb4('0x70')](_0xb8fc5a)=='-'){_0x4bf18c+=_0x23adf6[_0x1cb4('0x70')](_0xb8fc5a);}else{_0x4bf18c+='['+_0x23adf6[_0x1cb4('0x70')](_0xb8fc5a)+']';}}_0x4bf18c+='.';return _0x4bf18c;}exports[_0x1cb4('0x28')]=function(_0x24e2c2,_0x4fba36,_0x5670a5){var _0x2ff709=_0x24e2c2[_0x1cb4('0x51')];_0x2ff709[_0x1cb4('0x60')]='system-'+_0x2ff709[_0x1cb4('0x2e')]+'-';return db[_0x1cb4('0x50')][_0x1cb4('0x71')](function(_0x293dd7){return db['VoicePrefix']['update'](_0x2ff709,{'where':{'id':_0x2ff709['id']},'transaction':_0x293dd7})[_0x1cb4('0x29')](function(){return db['VoiceExtension'][_0x1cb4('0x4d')]({'where':{'VoicePrefixId':_0x2ff709['id']},'transaction':_0x293dd7})[_0x1cb4('0x29')](function(){return db['VoiceExtension'][_0x1cb4('0x4c')]({'where':{'id':_0x2ff709[_0x1cb4('0x52')]},'raw':!![]})[_0x1cb4('0x29')](function(_0x1cc632){return createVoicePrefixExtensions(_0x2ff709,_0x1cc632,_0x293dd7);});});});})['then'](function(){return db['VoicePrefix'][_0x1cb4('0x72')](_0x2ff709['id']);})[_0x1cb4('0x29')](respondWithResult(_0x4fba36,null))[_0x1cb4('0x47')](handleError(_0x4fba36,null));};exports[_0x1cb4('0x73')]=function(_0x161058,_0x2572cd,_0x36e218){return db[_0x1cb4('0x31')][_0x1cb4('0x4c')]({'where':{'id':_0x161058[_0x1cb4('0x49')]['id']}})[_0x1cb4('0x29')](handleEntityNotFound(_0x2572cd,null))[_0x1cb4('0x29')](function(_0x2cd4f5){if(_0x2cd4f5){return _0x2cd4f5['addAgents'](_0x161058[_0x1cb4('0x51')]['ids'],_['omit'](_0x161058[_0x1cb4('0x51')],['ids','id'])||{})['spread'](function(_0x26eed0){for(var _0x38562a=0x0;_0x38562a<_0x161058[_0x1cb4('0x51')]['ids'][_0x1cb4('0x3c')];_0x38562a+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':_0x161058['body'][_0x1cb4('0x74')][_0x38562a],'VoicePrefixId':_0x161058[_0x1cb4('0x49')]['id']});}return _0x26eed0;});}})[_0x1cb4('0x29')](respondWithResult(_0x2572cd,null))[_0x1cb4('0x47')](handleError(_0x2572cd,null));};exports[_0x1cb4('0x75')]=function(_0x156366,_0x55ec7f,_0x5ca2fa){return db[_0x1cb4('0x31')][_0x1cb4('0x4c')]({'where':{'id':_0x156366[_0x1cb4('0x49')]['id']}})[_0x1cb4('0x29')](handleEntityNotFound(_0x55ec7f,null))[_0x1cb4('0x29')](function(_0x4a48f7){if(_0x4a48f7){return _0x4a48f7[_0x1cb4('0x75')](_0x156366[_0x1cb4('0x37')][_0x1cb4('0x74')])[_0x1cb4('0x29')](function(){if(_['isArray'](_0x156366[_0x1cb4('0x37')][_0x1cb4('0x74')])){for(var _0x18c371=0x0;_0x18c371<_0x156366['query'][_0x1cb4('0x74')][_0x1cb4('0x3c')];_0x18c371+=0x1){socket[_0x1cb4('0x76')](_0x1cb4('0x77'),{'UserId':Number(_0x156366[_0x1cb4('0x37')][_0x1cb4('0x74')][_0x18c371]),'VoicePrefixId':Number(_0x156366['params']['id'])});}}else{socket['emit'](_0x1cb4('0x77'),{'UserId':Number(_0x156366[_0x1cb4('0x37')][_0x1cb4('0x74')]),'VoicePrefixId':Number(_0x156366[_0x1cb4('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x55ec7f,null))[_0x1cb4('0x47')](handleError(_0x55ec7f,null));};exports[_0x1cb4('0x78')]=function(_0x174f02,_0xe5827b,_0x48af58){var _0x1ce4d7={};var _0x7968f2={};var _0x18c1cc;var _0x4eca1b;return db[_0x1cb4('0x31')][_0x1cb4('0x79')]({'where':{'id':_0x174f02[_0x1cb4('0x49')]['id']}})[_0x1cb4('0x29')](handleEntityNotFound(_0xe5827b,null))[_0x1cb4('0x29')](function(_0x1e624f){if(_0x1e624f){_0x18c1cc=_0x1e624f;_0x7968f2['model']=_[_0x1cb4('0x4a')](db[_0x1cb4('0x7a')][_0x1cb4('0x32')]);_0x7968f2[_0x1cb4('0x37')]=_[_0x1cb4('0x4a')](_0x174f02[_0x1cb4('0x37')]);_0x7968f2[_0x1cb4('0x38')]=_[_0x1cb4('0x39')](_0x7968f2[_0x1cb4('0x36')],_0x7968f2[_0x1cb4('0x37')]);_0x1ce4d7[_0x1cb4('0x3b')]=_[_0x1cb4('0x39')](_0x7968f2[_0x1cb4('0x36')],qs['fields'](_0x174f02['query']['fields']));_0x1ce4d7['attributes']=_0x1ce4d7[_0x1cb4('0x3b')]['length']?_0x1ce4d7['attributes']:_0x7968f2[_0x1cb4('0x36')];_0x1ce4d7[_0x1cb4('0x3e')]=qs[_0x1cb4('0x3f')](_0x174f02[_0x1cb4('0x37')][_0x1cb4('0x3f')]);_0x1ce4d7['where']=qs['filters'](_[_0x1cb4('0x7b')](_0x174f02['query'],_0x7968f2['filters']));if(_0x174f02[_0x1cb4('0x37')][_0x1cb4('0x41')]){_0x1ce4d7[_0x1cb4('0x40')]=_[_0x1cb4('0x42')](_0x1ce4d7[_0x1cb4('0x40')],{'$or':_[_0x1cb4('0x30')](_0x1ce4d7[_0x1cb4('0x3b')],function(_0x1eb17d){var _0x4f8035={};_0x4f8035[_0x1eb17d]={'$like':'%'+_0x174f02[_0x1cb4('0x37')][_0x1cb4('0x41')]+'%'};return _0x4f8035;})});}_0x1ce4d7=_[_0x1cb4('0x42')]({},_0x1ce4d7,_0x174f02[_0x1cb4('0x4b')]);return _0x18c1cc[_0x1cb4('0x78')](_0x1ce4d7);}})['then'](function(_0x2e5d2d){if(_0x2e5d2d){_0x4eca1b=_0x2e5d2d[_0x1cb4('0x3c')];if(!_0x174f02[_0x1cb4('0x37')][_0x1cb4('0x3d')](_0x1cb4('0x7c'))){_0x1ce4d7['limit']=qs[_0x1cb4('0x23')](_0x174f02[_0x1cb4('0x37')][_0x1cb4('0x23')]);_0x1ce4d7[_0x1cb4('0x22')]=qs['offset'](_0x174f02[_0x1cb4('0x37')]['offset']);}return _0x18c1cc[_0x1cb4('0x78')](_0x1ce4d7);}})[_0x1cb4('0x29')](function(_0x31acbe){if(_0x31acbe){return _0x31acbe?{'count':_0x4eca1b,'rows':_0x31acbe}:null;}})['then'](respondWithResult(_0xe5827b,null))[_0x1cb4('0x47')](handleError(_0xe5827b,null));}; \ No newline at end of file +var _0xc838=['model','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','describe','create','sequelize','transaction','body','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Set','CDR(prefix)=','push','callerIdAll','goto','charAt','update','system-','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','sort','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./voicePrefix.socket','register','sendStatus','status','json','count','limit','Content-Range','reject','save','then','destroy','get','VoicePrefixes','UserProfileResource','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key'];(function(_0x5442c2,_0x3223cc){var _0x40baac=function(_0x727511){while(--_0x727511){_0x5442c2['push'](_0x5442c2['shift']());}};_0x40baac(++_0x3223cc);}(_0xc838,0xbd));var _0x8c83=function(_0x49ba5c,_0x6d23c2){_0x49ba5c=_0x49ba5c-0x0;var _0x3e9e7b=_0xc838[_0x49ba5c];return _0x3e9e7b;};'use strict';var pdf=require(_0x8c83('0x0'));var emlformat=require(_0x8c83('0x1'));var rimraf=require(_0x8c83('0x2'));var zipdir=require(_0x8c83('0x3'));var jsonpatch=require(_0x8c83('0x4'));var rp=require(_0x8c83('0x5'));var moment=require(_0x8c83('0x6'));var BPromise=require(_0x8c83('0x7'));var Mustache=require(_0x8c83('0x8'));var util=require(_0x8c83('0x9'));var path=require(_0x8c83('0xa'));var sox=require(_0x8c83('0xb'));var csv=require(_0x8c83('0xc'));var ejs=require(_0x8c83('0xd'));var fs=require('fs');var _=require(_0x8c83('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8c83('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8c83('0xc'));var querystring=require(_0x8c83('0x10'));var Papa=require(_0x8c83('0x11'));var Redis=require(_0x8c83('0x12'));var authService=require(_0x8c83('0x13'));var qs=require(_0x8c83('0x14'));var as=require(_0x8c83('0x15'));var hardwareService=require(_0x8c83('0x16'));var logger=require(_0x8c83('0x17'))(_0x8c83('0x18'));var utils=require(_0x8c83('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x8c83('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8c83('0x1b')](config['redis'],{'host':_0x8c83('0x1c'),'port':0x18eb});var socket=require(_0x8c83('0x1d'))(new Redis(config[_0x8c83('0x1e')]));require(_0x8c83('0x1f'))[_0x8c83('0x20')](socket);function respondWithStatusCode(_0x1aaac5,_0x325468){_0x325468=_0x325468||0xcc;return function(_0x295c28){if(_0x295c28){return _0x1aaac5[_0x8c83('0x21')](_0x325468);}return _0x1aaac5[_0x8c83('0x22')](_0x325468)['end']();};}function respondWithResult(_0x2b4027,_0x3d82ca){_0x3d82ca=_0x3d82ca||0xc8;return function(_0x52d916){if(_0x52d916){return _0x2b4027['status'](_0x3d82ca)[_0x8c83('0x23')](_0x52d916);}};}function respondWithFilteredResult(_0x4e3da8,_0x3eada5){return function(_0x535962){if(_0x535962){var _0x47d076=_0x535962[_0x8c83('0x24')],_0x3f4b38=_0x3eada5['offset'],_0x505476=_0x3eada5['offset']+_0x3eada5[_0x8c83('0x25')],_0x3b0106;if(_0x505476>=_0x47d076){_0x505476=_0x47d076;_0x3b0106=0xc8;}else{_0x3b0106=0xce;}_0x4e3da8[_0x8c83('0x22')](_0x3b0106);return _0x4e3da8['set'](_0x8c83('0x26'),_0x3f4b38+'-'+_0x505476+'/'+_0x47d076)[_0x8c83('0x23')](_0x535962);}return null;};}function patchUpdates(_0x4e0b83){return function(_0x34825d){try{jsonpatch['apply'](_0x34825d,_0x4e0b83,!![]);}catch(_0x34fdab){return BPromise[_0x8c83('0x27')](_0x34fdab);}return _0x34825d[_0x8c83('0x28')]();};}function saveUpdates(_0xf7b089,_0x9e56){return function(_0x5f4793){if(_0x5f4793){return _0x5f4793['update'](_0xf7b089)[_0x8c83('0x29')](function(_0x3a21e9){return _0x3a21e9;});}return null;};}function removeEntity(_0x59e6f9,_0x583a89){return function(_0x42b1ad){if(_0x42b1ad){return _0x42b1ad[_0x8c83('0x2a')]()[_0x8c83('0x29')](function(){var _0x5034e1=_0x42b1ad[_0x8c83('0x2b')]({'plain':!![]});var _0x4f7088=_0x8c83('0x2c');return db[_0x8c83('0x2d')][_0x8c83('0x2a')]({'where':{'type':_0x4f7088,'resourceId':_0x5034e1['id']}})[_0x8c83('0x29')](function(){return _0x42b1ad;});})[_0x8c83('0x29')](function(){_0x59e6f9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d728e,_0x41d7be){return function(_0x14c964){if(!_0x14c964){_0x4d728e['sendStatus'](0x194);}return _0x14c964;};}function handleError(_0x106f71,_0x12419a){_0x12419a=_0x12419a||0x1f4;return function(_0x142201){logger['error'](_0x142201['stack']);if(_0x142201[_0x8c83('0x2e')]){delete _0x142201['name'];}_0x106f71[_0x8c83('0x22')](_0x12419a)[_0x8c83('0x2f')](_0x142201);};}exports[_0x8c83('0x30')]=function(_0x178056,_0x232ce4){var _0x748adb={},_0x55739a={},_0xd76c56={'count':0x0,'rows':[]};var _0x5587db=_[_0x8c83('0x31')](db[_0x8c83('0x32')][_0x8c83('0x33')],function(_0x2f386c){return{'name':_0x2f386c[_0x8c83('0x34')],'type':_0x2f386c[_0x8c83('0x35')][_0x8c83('0x36')]};});_0x55739a[_0x8c83('0x37')]=_['map'](_0x5587db,_0x8c83('0x2e'));_0x55739a[_0x8c83('0x38')]=_[_0x8c83('0x39')](_0x178056['query']);_0x55739a[_0x8c83('0x3a')]=_[_0x8c83('0x3b')](_0x55739a['model'],_0x55739a[_0x8c83('0x38')]);_0x748adb[_0x8c83('0x3c')]=_[_0x8c83('0x3b')](_0x55739a[_0x8c83('0x37')],qs[_0x8c83('0x3d')](_0x178056[_0x8c83('0x38')][_0x8c83('0x3d')]));_0x748adb[_0x8c83('0x3c')]=_0x748adb[_0x8c83('0x3c')][_0x8c83('0x3e')]?_0x748adb[_0x8c83('0x3c')]:_0x55739a[_0x8c83('0x37')];if(!_0x178056['query']['hasOwnProperty'](_0x8c83('0x3f'))){_0x748adb[_0x8c83('0x25')]=qs[_0x8c83('0x25')](_0x178056[_0x8c83('0x38')][_0x8c83('0x25')]);_0x748adb['offset']=qs['offset'](_0x178056[_0x8c83('0x38')][_0x8c83('0x40')]);}_0x748adb[_0x8c83('0x41')]=qs['sort'](_0x178056['query']['sort']);_0x748adb['where']=qs[_0x8c83('0x3a')](_[_0x8c83('0x42')](_0x178056[_0x8c83('0x38')],_0x55739a[_0x8c83('0x3a')]),_0x5587db);if(_0x178056[_0x8c83('0x38')][_0x8c83('0x43')]){_0x748adb[_0x8c83('0x44')]=_[_0x8c83('0x45')](_0x748adb['where'],{'$or':_['map'](_0x5587db,function(_0x3e7455){if(_0x3e7455[_0x8c83('0x35')]!==_0x8c83('0x46')){var _0x4908b0={};_0x4908b0[_0x3e7455[_0x8c83('0x2e')]]={'$like':'%'+_0x178056['query'][_0x8c83('0x43')]+'%'};return _0x4908b0;}})});}_0x748adb=_[_0x8c83('0x45')]({},_0x748adb,_0x178056['options']);var _0x43e9ca={'where':_0x748adb['where']};return db['VoicePrefix']['count'](_0x43e9ca)[_0x8c83('0x29')](function(_0x16be78){_0xd76c56[_0x8c83('0x24')]=_0x16be78;if(_0x178056[_0x8c83('0x38')][_0x8c83('0x47')]){_0x748adb[_0x8c83('0x48')]=[{'all':!![]}];}return db[_0x8c83('0x32')]['findAll'](_0x748adb);})['then'](function(_0x83ba3f){_0xd76c56[_0x8c83('0x49')]=_0x83ba3f;return _0xd76c56;})[_0x8c83('0x29')](respondWithFilteredResult(_0x232ce4,_0x748adb))[_0x8c83('0x4a')](handleError(_0x232ce4,null));};exports[_0x8c83('0x4b')]=function(_0xce9b4e,_0x464de0){var _0x50f482={'raw':![],'where':{'id':_0xce9b4e[_0x8c83('0x4c')]['id']}},_0x5dcdba={};_0x5dcdba[_0x8c83('0x37')]=_[_0x8c83('0x39')](db[_0x8c83('0x32')][_0x8c83('0x33')]);_0x5dcdba[_0x8c83('0x38')]=_[_0x8c83('0x39')](_0xce9b4e[_0x8c83('0x38')]);_0x5dcdba[_0x8c83('0x3a')]=_[_0x8c83('0x3b')](_0x5dcdba['model'],_0x5dcdba['query']);_0x50f482[_0x8c83('0x3c')]=_[_0x8c83('0x3b')](_0x5dcdba[_0x8c83('0x37')],qs['fields'](_0xce9b4e[_0x8c83('0x38')][_0x8c83('0x3d')]));_0x50f482[_0x8c83('0x3c')]=_0x50f482['attributes']['length']?_0x50f482['attributes']:_0x5dcdba[_0x8c83('0x37')];if(_0xce9b4e['query']['includeAll']){_0x50f482[_0x8c83('0x48')]=[{'all':!![]}];}_0x50f482=_['merge']({},_0x50f482,_0xce9b4e[_0x8c83('0x4d')]);return db[_0x8c83('0x32')][_0x8c83('0x4e')](_0x50f482)[_0x8c83('0x29')](handleEntityNotFound(_0x464de0,null))['then'](respondWithResult(_0x464de0,null))['catch'](handleError(_0x464de0,null));};exports[_0x8c83('0x2a')]=function(_0x5c2004,_0x1fcb14){return db['VoicePrefix'][_0x8c83('0x4e')]({'where':{'id':_0x5c2004['params']['id']}})[_0x8c83('0x29')](handleEntityNotFound(_0x1fcb14,null))[_0x8c83('0x29')](removeEntity(_0x1fcb14,null))[_0x8c83('0x4a')](handleError(_0x1fcb14,null));};exports[_0x8c83('0x4f')]=function(_0x4d869a,_0x3e39c3){return db['VoicePrefix']['describe']()[_0x8c83('0x29')](respondWithResult(_0x3e39c3,null))[_0x8c83('0x4a')](handleError(_0x3e39c3,null));};exports[_0x8c83('0x50')]=function(_0x3cf250,_0x5548a2){var _0x1a9019;return db[_0x8c83('0x51')][_0x8c83('0x52')](function(_0xd4badb){return db[_0x8c83('0x32')][_0x8c83('0x50')](_0x3cf250[_0x8c83('0x53')],{'transaction':_0xd4badb})[_0x8c83('0x29')](function(_0x5e6d54){_0x1a9019=_0x5e6d54[_0x8c83('0x2b')]({'plain':!![]});return db['VoiceExtension'][_0x8c83('0x4e')]({'where':{'id':_0x1a9019[_0x8c83('0x54')]},'raw':!![]})['then'](function(_0x51b1c8){return createVoicePrefixExtensions(_0x1a9019,_0x51b1c8,_0xd4badb);});});})[_0x8c83('0x29')](function(){var _0x2e6eb5=_0x3cf250['user']['get']({'plain':!![]});if(!_0x2e6eb5)throw new Error(_0x8c83('0x55'));if(_0x2e6eb5[_0x8c83('0x56')]==='user'){var _0x275814=_0x1a9019;return db[_0x8c83('0x57')][_0x8c83('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x2e6eb5[_0x8c83('0x58')]},'raw':!![]})[_0x8c83('0x29')](function(_0x10a783){if(_0x10a783&&_0x10a783['autoAssociation']===0x0){return db[_0x8c83('0x2d')][_0x8c83('0x50')]({'name':_0x275814[_0x8c83('0x2e')],'resourceId':_0x275814['id'],'type':_0x10a783[_0x8c83('0x2e')],'sectionId':_0x10a783['id']},{})[_0x8c83('0x29')](function(){return _0x1a9019;});}else{return _0x1a9019;}})[_0x8c83('0x4a')](function(_0x57a463){logger['error'](_0x8c83('0x59'),_0x57a463);throw _0x57a463;});}return _0x1a9019;})[_0x8c83('0x29')](respondWithResult(_0x5548a2,null))[_0x8c83('0x4a')](handleError(_0x5548a2,null));};function Extension(_0x3c68c3,_0x283de0,_0x130be4,_0x1cda02){this[_0x8c83('0x5a')]=_0x8c83('0x5b');this['exten']=_0x3c68c3;this['app']=_0x130be4;this[_0x8c83('0x35')]=_0x8c83('0x5c');this[_0x8c83('0x5d')]=_0x8c83('0x5e');this[_0x8c83('0x5f')]=_0x283de0;this[_0x8c83('0x60')]=_0x1cda02;}function createVoicePrefixExtensions(_0x32c9f0,_0x32cc99,_0x418c80){return new BPromise(function(_0x1bf058,_0x5ab5c1){var _0x2f5f5c=new Extension(formatPrefixName(_0x32c9f0[_0x8c83('0x61')]),0x1,_0x8c83('0x62'),_0x8c83('0x63'));_0x2f5f5c[_0x8c83('0x64')]=_0x32c9f0['id'];return db[_0x8c83('0x65')][_0x8c83('0x50')](_0x2f5f5c,{'transaction':_0x418c80})[_0x8c83('0x29')](function(_0x2f0a57){var _0x724ecf=_0x2f0a57['get']({'plain':!![]});var _0xc322bd=_['map'](addVoicePrefixExtensions(_0x32c9f0,_0x32cc99),function(_0x2270a9){_0x2270a9[_0x8c83('0x54')]=_0x724ecf['id'];_0x2270a9[_0x8c83('0x64')]=_0x32c9f0['id'];return _0x2270a9;});return db['VoiceExtension'][_0x8c83('0x66')](_0xc322bd,{'transaction':_0x418c80})[_0x8c83('0x29')](function(_0x4c94f5){if(!_0x4c94f5){return _0x5ab5c1('Extensions\x20creation\x20failed');}else{return _0x1bf058(_0x4c94f5);}})['catch'](function(_0x2f0f99){return _0x5ab5c1(_0x2f0f99);});});;});};function addVoicePrefixExtensions(_0x5020f0,_0x38b0ff){var _0x3b03df=[];var _0x48c54d=formatPrefixName(_0x5020f0['prefix']);_0x3b03df['push'](new Extension(_0x48c54d,0x2,_0x8c83('0x67'),_0x8c83('0x68')+_0x5020f0['name']));if(_0x5020f0['callerIdAll']){_0x3b03df[_0x8c83('0x69')](new Extension(_0x48c54d,0x3,_0x8c83('0x67'),'PREFIX-CALLERIDALL='+_0x5020f0[_0x8c83('0x6a')]));}else{_0x3b03df[_0x8c83('0x69')](new Extension(_0x48c54d,0x3,_0x8c83('0x62'),'No\x20callerid\x20available'));}_0x3b03df[_0x8c83('0x69')](new Extension(_0x48c54d,0x4,_0x8c83('0x6b'),_0x38b0ff[_0x8c83('0x5a')]+','+'${EXTEN:'+(0x8+_0x5020f0[_0x8c83('0x2e')]['length'])+'}'+','+0x1));return _0x3b03df;}function formatPrefixName(_0x39af25){var _0xee286='_';for(var _0x2e4237=0x0;_0x2e4237<_0x39af25[_0x8c83('0x3e')];_0x2e4237++){if(_0x39af25['charAt'](_0x2e4237)=='-'){_0xee286+=_0x39af25['charAt'](_0x2e4237);}else{_0xee286+='['+_0x39af25[_0x8c83('0x6c')](_0x2e4237)+']';}}_0xee286+='.';return _0xee286;}exports[_0x8c83('0x6d')]=function(_0x4169b9,_0x54ba39,_0x13eb1c){var _0x5b3fe4=_0x4169b9[_0x8c83('0x53')];_0x5b3fe4[_0x8c83('0x61')]=_0x8c83('0x6e')+_0x5b3fe4[_0x8c83('0x2e')]+'-';return db[_0x8c83('0x51')]['transaction'](function(_0x23f737){return db[_0x8c83('0x32')][_0x8c83('0x6d')](_0x5b3fe4,{'where':{'id':_0x5b3fe4['id']},'transaction':_0x23f737})['then'](function(){return db['VoiceExtension'][_0x8c83('0x2a')]({'where':{'VoicePrefixId':_0x5b3fe4['id']},'transaction':_0x23f737})[_0x8c83('0x29')](function(){return db['VoiceExtension'][_0x8c83('0x4e')]({'where':{'id':_0x5b3fe4['VoiceExtensionId']},'raw':!![]})[_0x8c83('0x29')](function(_0x27a7bb){return createVoicePrefixExtensions(_0x5b3fe4,_0x27a7bb,_0x23f737);});});});})[_0x8c83('0x29')](function(){return db[_0x8c83('0x32')]['findById'](_0x5b3fe4['id']);})['then'](respondWithResult(_0x54ba39,null))[_0x8c83('0x4a')](handleError(_0x54ba39,null));};exports['addAgents']=function(_0x28f1cb,_0x4aae54,_0x552f0a){return db[_0x8c83('0x32')][_0x8c83('0x4e')]({'where':{'id':_0x28f1cb['params']['id']}})['then'](handleEntityNotFound(_0x4aae54,null))[_0x8c83('0x29')](function(_0x1ce904){if(_0x1ce904){return _0x1ce904['addAgents'](_0x28f1cb[_0x8c83('0x53')][_0x8c83('0x6f')],_[_0x8c83('0x70')](_0x28f1cb[_0x8c83('0x53')],[_0x8c83('0x6f'),'id'])||{})[_0x8c83('0x71')](function(_0x4236f8){for(var _0x1bdafe=0x0;_0x1bdafe<_0x28f1cb[_0x8c83('0x53')][_0x8c83('0x6f')][_0x8c83('0x3e')];_0x1bdafe+=0x1){socket[_0x8c83('0x72')](_0x8c83('0x73'),{'UserId':_0x28f1cb[_0x8c83('0x53')][_0x8c83('0x6f')][_0x1bdafe],'VoicePrefixId':_0x28f1cb[_0x8c83('0x4c')]['id']});}return _0x4236f8;});}})[_0x8c83('0x29')](respondWithResult(_0x4aae54,null))['catch'](handleError(_0x4aae54,null));};exports[_0x8c83('0x74')]=function(_0x4894b5,_0x3085e2,_0x4c2822){return db[_0x8c83('0x32')][_0x8c83('0x4e')]({'where':{'id':_0x4894b5[_0x8c83('0x4c')]['id']}})[_0x8c83('0x29')](handleEntityNotFound(_0x3085e2,null))[_0x8c83('0x29')](function(_0x292a0d){if(_0x292a0d){return _0x292a0d['removeAgents'](_0x4894b5[_0x8c83('0x38')][_0x8c83('0x6f')])['then'](function(){if(_[_0x8c83('0x75')](_0x4894b5[_0x8c83('0x38')]['ids'])){for(var _0x10fe62=0x0;_0x10fe62<_0x4894b5[_0x8c83('0x38')][_0x8c83('0x6f')][_0x8c83('0x3e')];_0x10fe62+=0x1){socket[_0x8c83('0x72')](_0x8c83('0x76'),{'UserId':Number(_0x4894b5[_0x8c83('0x38')]['ids'][_0x10fe62]),'VoicePrefixId':Number(_0x4894b5[_0x8c83('0x4c')]['id'])});}}else{socket[_0x8c83('0x72')](_0x8c83('0x76'),{'UserId':Number(_0x4894b5[_0x8c83('0x38')][_0x8c83('0x6f')]),'VoicePrefixId':Number(_0x4894b5[_0x8c83('0x4c')]['id'])});}});}})['then'](respondWithStatusCode(_0x3085e2,null))['catch'](handleError(_0x3085e2,null));};exports[_0x8c83('0x77')]=function(_0xee91c7,_0x274788,_0x29d938){var _0x50ba5e={};var _0x43925e={};var _0x581205;var _0x54bc6d;return db[_0x8c83('0x32')][_0x8c83('0x78')]({'where':{'id':_0xee91c7[_0x8c83('0x4c')]['id']}})[_0x8c83('0x29')](handleEntityNotFound(_0x274788,null))[_0x8c83('0x29')](function(_0x51b61f){if(_0x51b61f){_0x581205=_0x51b61f;_0x43925e[_0x8c83('0x37')]=_[_0x8c83('0x39')](db['User']['rawAttributes']);_0x43925e[_0x8c83('0x38')]=_[_0x8c83('0x39')](_0xee91c7['query']);_0x43925e[_0x8c83('0x3a')]=_['intersection'](_0x43925e[_0x8c83('0x37')],_0x43925e[_0x8c83('0x38')]);_0x50ba5e['attributes']=_[_0x8c83('0x3b')](_0x43925e[_0x8c83('0x37')],qs['fields'](_0xee91c7[_0x8c83('0x38')][_0x8c83('0x3d')]));_0x50ba5e[_0x8c83('0x3c')]=_0x50ba5e[_0x8c83('0x3c')][_0x8c83('0x3e')]?_0x50ba5e['attributes']:_0x43925e['model'];_0x50ba5e[_0x8c83('0x41')]=qs[_0x8c83('0x79')](_0xee91c7[_0x8c83('0x38')]['sort']);_0x50ba5e['where']=qs[_0x8c83('0x3a')](_[_0x8c83('0x42')](_0xee91c7[_0x8c83('0x38')],_0x43925e[_0x8c83('0x3a')]));if(_0xee91c7['query'][_0x8c83('0x43')]){_0x50ba5e[_0x8c83('0x44')]=_[_0x8c83('0x45')](_0x50ba5e[_0x8c83('0x44')],{'$or':_[_0x8c83('0x31')](_0x50ba5e['attributes'],function(_0x4923c1){var _0x267718={};_0x267718[_0x4923c1]={'$like':'%'+_0xee91c7[_0x8c83('0x38')][_0x8c83('0x43')]+'%'};return _0x267718;})});}_0x50ba5e=_[_0x8c83('0x45')]({},_0x50ba5e,_0xee91c7[_0x8c83('0x4d')]);return _0x581205[_0x8c83('0x77')](_0x50ba5e);}})[_0x8c83('0x29')](function(_0x119434){if(_0x119434){_0x54bc6d=_0x119434['length'];if(!_0xee91c7[_0x8c83('0x38')]['hasOwnProperty'](_0x8c83('0x3f'))){_0x50ba5e[_0x8c83('0x25')]=qs[_0x8c83('0x25')](_0xee91c7[_0x8c83('0x38')][_0x8c83('0x25')]);_0x50ba5e[_0x8c83('0x40')]=qs[_0x8c83('0x40')](_0xee91c7[_0x8c83('0x38')]['offset']);}return _0x581205[_0x8c83('0x77')](_0x50ba5e);}})[_0x8c83('0x29')](function(_0xe61675){if(_0xe61675){return _0xe61675?{'count':_0x54bc6d,'rows':_0xe61675}:null;}})[_0x8c83('0x29')](respondWithResult(_0x274788,null))[_0x8c83('0x4a')](handleError(_0x274788,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 30e7dfa..e853ae5 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 _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x2a2d5b,_0x7ac3a5){var _0x503da5=function(_0x5c728e){while(--_0x5c728e){_0x2a2d5b['push'](_0x2a2d5b['shift']());}};_0x503da5(++_0x7ac3a5);}(_0x008c,0x188));var _0xc008=function(_0x28b951,_0x2825b0){_0x28b951=_0x28b951-0x0;var _0x37a82e=_0x008c[_0x28b951];return _0x37a82e;};'use strict';var EventEmitter=require(_0xc008('0x0'));var VoicePrefix=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){VoicePrefixEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);VoicePrefixEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];VoicePrefix[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x34e8=['emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','update','remove'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x34e8,0x12c));var _0x834e=function(_0x51bc3f,_0x279bdb){_0x51bc3f=_0x51bc3f-0x0;var _0x57171d=_0x34e8[_0x51bc3f];return _0x57171d;};'use strict';var EventEmitter=require(_0x834e('0x0'));var VoicePrefix=require(_0x834e('0x1'))['db'][_0x834e('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x834e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x834e('0x4'),'afterDestroy':_0x834e('0x5')};function emitEvent(_0x472111){return function(_0x31bf20,_0x289ef2,_0x19a3e0){VoicePrefixEvents[_0x834e('0x6')](_0x472111+':'+_0x31bf20['id'],_0x31bf20);VoicePrefixEvents['emit'](_0x472111,_0x31bf20);_0x19a3e0(null);};}for(var e in events){if(events[_0x834e('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x834e('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 574aef6..d6be8b5 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 _0x4027=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes'];(function(_0x5375fe,_0x176970){var _0x1b3ea1=function(_0x3f8ca5){while(--_0x3f8ca5){_0x5375fe['push'](_0x5375fe['shift']());}};_0x1b3ea1(++_0x176970);}(_0x4027,0x1ea));var _0x7402=function(_0xe706c6,_0xb1acff){_0xe706c6=_0xe706c6-0x0;var _0x583296=_0x4027[_0xe706c6];return _0x583296;};'use strict';var _=require('lodash');var util=require(_0x7402('0x0'));var logger=require(_0x7402('0x1'))(_0x7402('0x2'));var moment=require(_0x7402('0x3'));var BPromise=require(_0x7402('0x4'));var rp=require(_0x7402('0x5'));var fs=require('fs');var path=require(_0x7402('0x6'));var rimraf=require(_0x7402('0x7'));var config=require(_0x7402('0x8'));var attributes=require(_0x7402('0x9'));module[_0x7402('0xa')]=function(_0x5bb013,_0x506cd5){return _0x5bb013[_0x7402('0xb')](_0x7402('0xc'),attributes,{'tableName':_0x7402('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc12=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash'];(function(_0x423570,_0x5218a5){var _0x18e0da=function(_0x34a0dd){while(--_0x34a0dd){_0x423570['push'](_0x423570['shift']());}};_0x18e0da(++_0x5218a5);}(_0xcc12,0x9b));var _0x2cc1=function(_0x2e56f1,_0x1fadb5){_0x2e56f1=_0x2e56f1-0x0;var _0x440f68=_0xcc12[_0x2e56f1];return _0x440f68;};'use strict';var _=require(_0x2cc1('0x0'));var util=require(_0x2cc1('0x1'));var logger=require(_0x2cc1('0x2'))(_0x2cc1('0x3'));var moment=require('moment');var BPromise=require(_0x2cc1('0x4'));var rp=require(_0x2cc1('0x5'));var fs=require('fs');var path=require(_0x2cc1('0x6'));var rimraf=require('rimraf');var config=require(_0x2cc1('0x7'));var attributes=require(_0x2cc1('0x8'));module[_0x2cc1('0x9')]=function(_0x24955a,_0x5942ac){return _0x24955a[_0x2cc1('0xa')](_0x2cc1('0xb'),attributes,{'tableName':_0x2cc1('0xc'),'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 ea1fe27..1eed1f6 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 _0x5ff9=['util','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash'];(function(_0x571ed1,_0x1b0f17){var _0x412fae=function(_0x38103c){while(--_0x38103c){_0x571ed1['push'](_0x571ed1['shift']());}};_0x412fae(++_0x1b0f17);}(_0x5ff9,0xa0));var _0x95ff=function(_0x3eac36,_0x47a2d1){_0x3eac36=_0x3eac36-0x0;var _0x4319f6=_0x5ff9[_0x3eac36];return _0x4319f6;};'use strict';var _=require(_0x95ff('0x0'));var util=require(_0x95ff('0x1'));var moment=require('moment');var BPromise=require(_0x95ff('0x2'));var rs=require(_0x95ff('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x95ff('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x95ff('0x5'));var jayson=require(_0x95ff('0x6'));var client=jayson['client'][_0x95ff('0x7')]({'port':0x232a});config['redis']=_[_0x95ff('0x8')](config[_0x95ff('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x95ff('0xa'))(new Redis(config['redis']));require(_0x95ff('0xb'))[_0x95ff('0xc')](socket);function respondWithRpcPromise(_0x4807b6,_0x17b39b,_0x1f3e2d){return new BPromise(function(_0x2a1750,_0x4f5bb9){return client[_0x95ff('0xd')](_0x4807b6,_0x1f3e2d)[_0x95ff('0xe')](function(_0x39d786){logger[_0x95ff('0xf')](_0x95ff('0x10'),_0x17b39b,_0x95ff('0x11'));logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x17b39b,_0x95ff('0x11'),JSON[_0x95ff('0x12')](_0x39d786));if(_0x39d786[_0x95ff('0x13')]){if(_0x39d786[_0x95ff('0x13')]['code']===0x1f4){logger[_0x95ff('0x13')](_0x95ff('0x10'),_0x17b39b,_0x39d786['error'][_0x95ff('0x14')]);return _0x4f5bb9(_0x39d786[_0x95ff('0x13')]['message']);}logger['error'](_0x95ff('0x10'),_0x17b39b,_0x39d786[_0x95ff('0x13')][_0x95ff('0x14')]);return _0x2a1750(_0x39d786['error'][_0x95ff('0x14')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x17b39b,_0x95ff('0x11'));_0x2a1750(_0x39d786[_0x95ff('0x15')][_0x95ff('0x14')]);}})[_0x95ff('0x16')](function(_0x5e7132){logger[_0x95ff('0x13')](_0x95ff('0x10'),_0x17b39b,_0x5e7132);_0x4f5bb9(_0x5e7132);});});} \ No newline at end of file +var _0xbc9b=['http','redis','defaults','localhost','./voicePrefix.socket','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3f1937,_0x37d49c){var _0x46733e=function(_0x32e9df){while(--_0x32e9df){_0x3f1937['push'](_0x3f1937['shift']());}};_0x46733e(++_0x37d49c);}(_0xbc9b,0x9e));var _0xbbc9=function(_0x19b897,_0x105e1e){_0x19b897=_0x19b897-0x0;var _0x536392=_0xbc9b[_0x19b897];return _0x536392;};'use strict';var _=require(_0xbbc9('0x0'));var util=require(_0xbbc9('0x1'));var moment=require(_0xbbc9('0x2'));var BPromise=require(_0xbbc9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbbc9('0x4'));var db=require(_0xbbc9('0x5'))['db'];var utils=require(_0xbbc9('0x6'));var logger=require(_0xbbc9('0x7'))(_0xbbc9('0x8'));var config=require('../../config/environment');var jayson=require(_0xbbc9('0x9'));var client=jayson['client'][_0xbbc9('0xa')]({'port':0x232a});config[_0xbbc9('0xb')]=_[_0xbbc9('0xc')](config[_0xbbc9('0xb')],{'host':_0xbbc9('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbbc9('0xb')]));require(_0xbbc9('0xe'))['register'](socket);function respondWithRpcPromise(_0x5ed2dd,_0x19566c,_0x432b0d){return new BPromise(function(_0x4c8661,_0x572953){return client[_0xbbc9('0xf')](_0x5ed2dd,_0x432b0d)[_0xbbc9('0x10')](function(_0x464f44){logger['info'](_0xbbc9('0x11'),_0x19566c,_0xbbc9('0x12'));logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x19566c,'request\x20sent',JSON[_0xbbc9('0x13')](_0x464f44));if(_0x464f44[_0xbbc9('0x14')]){if(_0x464f44['error']['code']===0x1f4){logger[_0xbbc9('0x14')](_0xbbc9('0x11'),_0x19566c,_0x464f44[_0xbbc9('0x14')][_0xbbc9('0x15')]);return _0x572953(_0x464f44[_0xbbc9('0x14')][_0xbbc9('0x15')]);}logger['error'](_0xbbc9('0x11'),_0x19566c,_0x464f44['error']['message']);return _0x4c8661(_0x464f44[_0xbbc9('0x14')][_0xbbc9('0x15')]);}else{logger[_0xbbc9('0x16')](_0xbbc9('0x11'),_0x19566c,'request\x20sent');_0x4c8661(_0x464f44[_0xbbc9('0x17')][_0xbbc9('0x15')]);}})['catch'](function(_0x176788){logger[_0xbbc9('0x14')](_0xbbc9('0x11'),_0x19566c,_0x176788);_0x572953(_0x176788);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 052a6a2..e6024e6 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 _0x9e77=['./voicePrefix.events','save','remove','update','emit','removeListener','register','length','voicePrefix:'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0x9e77,0x168));var _0x79e7=function(_0x4da271,_0x474c0e){_0x4da271=_0x4da271-0x0;var _0x2db6f6=_0x9e77[_0x4da271];return _0x2db6f6;};'use strict';var VoicePrefixEvents=require(_0x79e7('0x0'));var events=[_0x79e7('0x1'),_0x79e7('0x2'),_0x79e7('0x3')];function createListener(_0x438c62,_0x2da217){return function(_0x3633a1){_0x2da217[_0x79e7('0x4')](_0x438c62,_0x3633a1);};}function removeListener(_0x3f59c5,_0x178a52){return function(){VoicePrefixEvents[_0x79e7('0x5')](_0x3f59c5,_0x178a52);};}exports[_0x79e7('0x6')]=function(_0x4f21c9){for(var _0x2594e9=0x0,_0xe833ed=events[_0x79e7('0x7')];_0x2594e9<_0xe833ed;_0x2594e9++){var _0x598f6b=events[_0x2594e9];var _0x2e26d5=createListener(_0x79e7('0x8')+_0x598f6b,_0x4f21c9);VoicePrefixEvents['on'](_0x598f6b,_0x2e26d5);}}; \ No newline at end of file +var _0x7ccc=['save','remove','register'];(function(_0x4c2cda,_0x5945b0){var _0x59c47d=function(_0x1df4c8){while(--_0x1df4c8){_0x4c2cda['push'](_0x4c2cda['shift']());}};_0x59c47d(++_0x5945b0);}(_0x7ccc,0x1d7));var _0xc7cc=function(_0x32a6ea,_0x44e86e){_0x32a6ea=_0x32a6ea-0x0;var _0x898353=_0x7ccc[_0x32a6ea];return _0x898353;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xc7cc('0x0'),_0xc7cc('0x1'),'update'];function createListener(_0x3c771a,_0xd598e4){return function(_0x3fac51){_0xd598e4['emit'](_0x3c771a,_0x3fac51);};}function removeListener(_0x3b1003,_0x39b5f9){return function(){VoicePrefixEvents['removeListener'](_0x3b1003,_0x39b5f9);};}exports[_0xc7cc('0x2')]=function(_0x1bb862){for(var _0x462c26=0x0,_0x1ff629=events['length'];_0x462c26<_0x1ff629;_0x462c26++){var _0x580cda=events[_0x462c26];var _0x49b22d=createListener('voicePrefix:'+_0x580cda,_0x1bb862);VoicePrefixEvents['on'](_0x580cda,_0x49b22d);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 0a5e5cc..0081949 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 _0xecb7=['addBlackLists','put','/:id','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','multer','util','express','Router','../../components/auth/service','./voiceQueue.controller','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','/:id/blacklists'];(function(_0x4951ca,_0x3146d7){var _0x3bf41e=function(_0xaa0673){while(--_0xaa0673){_0x4951ca['push'](_0x4951ca['shift']());}};_0x3bf41e(++_0x3146d7);}(_0xecb7,0x1a4));var _0x7ecb=function(_0x42a791,_0x16ab08){_0x42a791=_0x42a791-0x0;var _0x28349b=_0xecb7[_0x42a791];return _0x28349b;};'use strict';var multer=require(_0x7ecb('0x0'));var util=require(_0x7ecb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7ecb('0x2'));var router=express[_0x7ecb('0x3')]();var auth=require(_0x7ecb('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7ecb('0x5'));router[_0x7ecb('0x6')]('/',auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x8')]);router[_0x7ecb('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x7ecb('0x9')]);router[_0x7ecb('0x6')](_0x7ecb('0xa'),auth[_0x7ecb('0x7')](),controller[_0x7ecb('0xb')]);router[_0x7ecb('0x6')]('/:id/hopper_histories',auth[_0x7ecb('0x7')](),controller[_0x7ecb('0xc')]);router[_0x7ecb('0x6')]('/:id/hopper_finals',auth[_0x7ecb('0x7')](),controller[_0x7ecb('0xd')]);router[_0x7ecb('0x6')](_0x7ecb('0xe'),auth[_0x7ecb('0x7')](),controller[_0x7ecb('0xf')]);router[_0x7ecb('0x6')](_0x7ecb('0x10'),auth[_0x7ecb('0x7')](),controller['getTeams']);router['get'](_0x7ecb('0x11'),auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x12')]);router[_0x7ecb('0x6')](_0x7ecb('0x13'),auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x14')]);router[_0x7ecb('0x6')](_0x7ecb('0x15'),auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x16')]);router[_0x7ecb('0x6')]('/:id/blacklists',auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x17')]);router[_0x7ecb('0x18')]('/',auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x19')]);router['post'](_0x7ecb('0x1a'),auth[_0x7ecb('0x7')](),controller['clone']);router[_0x7ecb('0x18')]('/:id/teams',auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x1b')]);router[_0x7ecb('0x18')](_0x7ecb('0x11'),auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x1c')]);router['post']('/:id/lists',auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x1d')]);router[_0x7ecb('0x18')](_0x7ecb('0x1e'),auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x1f')]);router[_0x7ecb('0x20')](_0x7ecb('0x21'),auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x22')]);router[_0x7ecb('0x23')](_0x7ecb('0x21'),auth['isAuthenticated'](),controller[_0x7ecb('0x24')]);router['delete'](_0x7ecb('0x10'),auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x25')]);router['delete'](_0x7ecb('0x11'),auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x26')]);router[_0x7ecb('0x23')](_0x7ecb('0x15'),auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x27')]);router[_0x7ecb('0x23')](_0x7ecb('0x1e'),auth[_0x7ecb('0x7')](),controller[_0x7ecb('0x28')]);module['exports']=router; \ No newline at end of file +var _0xa9c1=['./voiceQueue.controller','get','isAuthenticated','index','show','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_black','/:id/teams','getTeams','getAgents','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addTeams','/:id/users','addBlackLists','put','/:id','update','destroy','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x2e3107,_0x25f970){var _0x833d69=function(_0x420e78){while(--_0x420e78){_0x2e3107['push'](_0x2e3107['shift']());}};_0x833d69(++_0x25f970);}(_0xa9c1,0x193));var _0x1a9c=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9c1[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x1a9c('0x0'));var util=require('util');var path=require(_0x1a9c('0x1'));var timeout=require(_0x1a9c('0x2'));var express=require(_0x1a9c('0x3'));var router=express[_0x1a9c('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1a9c('0x5'));var config=require(_0x1a9c('0x6'));var controller=require(_0x1a9c('0x7'));router[_0x1a9c('0x8')]('/',auth[_0x1a9c('0x9')](),controller[_0x1a9c('0xa')]);router[_0x1a9c('0x8')]('/:id',auth[_0x1a9c('0x9')](),controller[_0x1a9c('0xb')]);router[_0x1a9c('0x8')](_0x1a9c('0xc'),auth[_0x1a9c('0x9')](),controller[_0x1a9c('0xd')]);router[_0x1a9c('0x8')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x1a9c('0xe')]);router[_0x1a9c('0x8')]('/:id/hopper_finals',auth[_0x1a9c('0x9')](),controller['getHopperFinals']);router[_0x1a9c('0x8')](_0x1a9c('0xf'),auth[_0x1a9c('0x9')](),controller['getHopperBlacks']);router[_0x1a9c('0x8')](_0x1a9c('0x10'),auth[_0x1a9c('0x9')](),controller[_0x1a9c('0x11')]);router[_0x1a9c('0x8')]('/:id/users',auth[_0x1a9c('0x9')](),controller[_0x1a9c('0x12')]);router[_0x1a9c('0x8')](_0x1a9c('0x13'),auth[_0x1a9c('0x9')](),controller[_0x1a9c('0x14')]);router[_0x1a9c('0x8')](_0x1a9c('0x15'),auth[_0x1a9c('0x9')](),controller[_0x1a9c('0x16')]);router[_0x1a9c('0x8')](_0x1a9c('0x17'),auth[_0x1a9c('0x9')](),controller[_0x1a9c('0x18')]);router[_0x1a9c('0x19')]('/',auth[_0x1a9c('0x9')](),controller['create']);router['post'](_0x1a9c('0x1a'),auth[_0x1a9c('0x9')](),controller[_0x1a9c('0x1b')]);router[_0x1a9c('0x19')]('/:id/teams',auth[_0x1a9c('0x9')](),controller[_0x1a9c('0x1c')]);router[_0x1a9c('0x19')](_0x1a9c('0x1d'),auth[_0x1a9c('0x9')](),controller['addAgents']);router[_0x1a9c('0x19')](_0x1a9c('0x15'),auth['isAuthenticated'](),controller['addLists']);router[_0x1a9c('0x19')]('/:id/blacklists',auth[_0x1a9c('0x9')](),controller[_0x1a9c('0x1e')]);router[_0x1a9c('0x1f')](_0x1a9c('0x20'),auth[_0x1a9c('0x9')](),controller[_0x1a9c('0x21')]);router['delete'](_0x1a9c('0x20'),auth[_0x1a9c('0x9')](),controller[_0x1a9c('0x22')]);router[_0x1a9c('0x23')](_0x1a9c('0x10'),auth['isAuthenticated'](),controller[_0x1a9c('0x24')]);router[_0x1a9c('0x23')]('/:id/users',auth['isAuthenticated'](),controller[_0x1a9c('0x25')]);router[_0x1a9c('0x23')](_0x1a9c('0x15'),auth[_0x1a9c('0x9')](),controller[_0x1a9c('0x26')]);router[_0x1a9c('0x23')](_0x1a9c('0x17'),auth[_0x1a9c('0x9')](),controller[_0x1a9c('0x27')]);module[_0x1a9c('0x28')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 6902e96..44b3955 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 _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\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)','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','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0x5be956,_0x33900b){var _0x3de158=function(_0x4780ee){while(--_0x4780ee){_0x5be956['push'](_0x5be956['shift']());}};_0x3de158(++_0x33900b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xa9e0=['getDataValue','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','Random\x20Last\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)','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','mandatoryDisposition','sequelize','exports','STRING','inbound','default','ENUM','leastrecent','fewestcalls','random','wrandom','setDataValue','strategy','rrmemory'];(function(_0xcdfdb2,_0x151157){var _0x21f715=function(_0x23cc1b){while(--_0x23cc1b){_0xcdfdb2['push'](_0xcdfdb2['shift']());}};_0x21f715(++_0x151157);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'outbound'),'allowNull':![],'defaultValue':_0x0a9e('0x3')},'musiconhold':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x4')},'announce':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x0a9e('0x5')]('rr','ringall',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'rrmemory','linear',_0x0a9e('0x9'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x39753a){this[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x39753a?_0x39753a:_0x0a9e('0xc'));},'get':function(){var _0xfeb75b=this[_0x0a9e('0xd')]('type');var _0x50dfb2=this['getDataValue']('dialMethod');var _0x273d4d=this[_0x0a9e('0xd')](_0x0a9e('0xb'));if(_0xfeb75b===_0x0a9e('0x3')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0xe')&&_0x273d4d===_0x0a9e('0xc')||_0x50dfb2==='booked'&&_0x273d4d===_0x0a9e('0xf')){return _0x273d4d;}if(_0x50dfb2===_0x0a9e('0x10')||_0x50dfb2===_0x0a9e('0x11')||_0x50dfb2===_0x0a9e('0x12')){return _0x273d4d;}return null;}},'servicelevel':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x0a9e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':_0x0a9e('0x14')},'autopause':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no',_0x0a9e('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x0a9e('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x0a9e('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x0a9e('0x13')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':_0x0a9e('0x14')},'announce_holdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no',_0x0a9e('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x0a9e('0x5')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x0a9e('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x0a9e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity1':{'type':Sequelize[_0x0a9e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x0a9e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x0a9e('0x2')]},'queue_less_than':{'type':Sequelize[_0x0a9e('0x2')]},'periodic_announce':{'type':Sequelize[_0x0a9e('0x17')],'set':function(_0x5a101a){this[_0x0a9e('0xa')](_0x0a9e('0x18'),_0x5a101a?_0x5a101a[_0x0a9e('0x19')](','):[]);},'get':function(){return this[_0x0a9e('0xd')]('periodic_announce')?this[_0x0a9e('0xd')](_0x0a9e('0x18'))[_0x0a9e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x14'),'set':function(_0x563b45){this[_0x0a9e('0xa')](_0x0a9e('0x1b'),_0x563b45?_0x563b45[_0x0a9e('0x19')](','):undefined);},'get':function(){return this['getDataValue'](_0x0a9e('0x1b'))?this['getDataValue'](_0x0a9e('0x1b'))[_0x0a9e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':'no','set':function(_0x33bdb7){this[_0x0a9e('0xa')]('leavewhenempty',_0x33bdb7?_0x33bdb7[_0x0a9e('0x19')](','):undefined);},'get':function(){return this[_0x0a9e('0xd')](_0x0a9e('0x1c'))?this[_0x0a9e('0xd')](_0x0a9e('0x1c'))[_0x0a9e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize[_0x0a9e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x191e91){this[_0x0a9e('0xa')](_0x0a9e('0x1d'),_0x191e91);if(_0x191e91){if(this[_0x0a9e('0xd')]('wrapuptime')<0x2){this['setDataValue'](_0x0a9e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':_0x0a9e('0x20')},'dialMethod':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x21'),'progressive',_0x0a9e('0x12'),_0x0a9e('0x11'),_0x0a9e('0xe')),'defaultValue':'progressive','comment':_0x0a9e('0x22')},'dialLimitChannel':{'type':Sequelize[_0x0a9e('0x13')](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x0a9e('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x0a9e('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x0a9e('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x0a9e('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x0a9e('0x5')](_0x0a9e('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x0a9e('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x0a9e('0x28')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x0a9e('0x29')},'dialPredictiveInterval':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0a9e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2a')},'dialQueueOptions':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x2b'),'comment':_0x0a9e('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x2d')},'dialQueueProject':{'type':Sequelize[_0x0a9e('0x2')],'comment':_0x0a9e('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x2f')},'dialBusyMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x30')},'dialBusyRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x31')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'comment':_0x0a9e('0x32')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0a9e('0x34')},'dialTimezone':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':_0x0a9e('0x35')},'dialPrefix':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x0a9e('0x36'),'never',_0x0a9e('0x37')),'defaultValue':_0x0a9e('0x36')},'dialAMDActive':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0a9e('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0a9e('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0a9e('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0a9e('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0a9e('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0a9e('0x13')](0x9)[_0x0a9e('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0a9e('0x3e')},'dialRecallMeTimeout':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x0a9e('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0x0a9e('0x40')),'defaultValue':_0x0a9e('0x41')},'dialQueueProject2':{'type':Sequelize[_0x0a9e('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0a9e('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x43')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x44')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x45')},'dialDropRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x46')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0a9e('0x47')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0a9e('0x13')](0x3)[_0x0a9e('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0a9e('0x48')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0a9e('0x13')](0x5)[_0x0a9e('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0a9e('0x13')],'allowNull':!![],'comment':_0x0a9e('0x49')},'mandatoryDisposition':{'type':Sequelize[_0x0a9e('0x1f')],'defaultValue':![],'comment':_0x0a9e('0x4a'),'set':function(_0xb83dfd){if(!_0xb83dfd)this[_0x0a9e('0xa')]('mandatoryDispositionPauseId',null);this[_0x0a9e('0xa')](_0x0a9e('0x4b'),_0xb83dfd);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x0a9e('0x23')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 8ab297c..1e1dbc8 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 _0x5da8=['count','offset','limit','set','json','apply','reject','save','update','then','destroy','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','find','name','UserProfileResource','error','stack','index','VoiceQueue','fieldName','query','keys','filters','intersection','model','attributes','fields','length','sort','where','pick','VIRTUAL','merge','options','findAll','rows','params','rawAttributes','includeAll','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','clone','omit','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','CmHopper','hasOwnProperty','nolimit','order','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','Team','getTeams','addTeams','teams','User','voicePause','interface','flatMap','Agents','penalty','sequelize','TeamVoiceQueue','upsert','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','forEach','userVoiceQueue:save','removeTeams','ids','field','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','transaction','isEmpty','removeAgents','emit','userVoiceQueue:remove','addAgents','spread','online','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ListId','updatedAt','select','NOW()','ContactId','CmListId','createdAt','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','into','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end'];(function(_0x52c604,_0x11af85){var _0x408525=function(_0x1c034e){while(--_0x1c034e){_0x52c604['push'](_0x52c604['shift']());}};_0x408525(++_0x11af85);}(_0x5da8,0x98));var _0x85da=function(_0x1c34a2,_0x5ef5da){_0x1c34a2=_0x1c34a2-0x0;var _0xc003dd=_0x5da8[_0x1c34a2];return _0xc003dd;};'use strict';var pdf=require(_0x85da('0x0'));var emlformat=require(_0x85da('0x1'));var rimraf=require(_0x85da('0x2'));var zipdir=require(_0x85da('0x3'));var jsonpatch=require(_0x85da('0x4'));var rp=require(_0x85da('0x5'));var moment=require(_0x85da('0x6'));var BPromise=require(_0x85da('0x7'));var Mustache=require('mustache');var util=require(_0x85da('0x8'));var path=require(_0x85da('0x9'));var sox=require(_0x85da('0xa'));var csv=require('to-csv');var ejs=require(_0x85da('0xb'));var fs=require('fs');var _=require(_0x85da('0xc'));var squel=require(_0x85da('0xd'));var crypto=require(_0x85da('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x85da('0xf'));var toCsv=require('to-csv');var querystring=require(_0x85da('0x10'));var Papa=require(_0x85da('0x11'));var Redis=require('ioredis');var authService=require(_0x85da('0x12'));var qs=require(_0x85da('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x85da('0x14'));var logger=require('../../config/logger')(_0x85da('0x15'));var utils=require(_0x85da('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x85da('0x17'))['db'];config[_0x85da('0x18')]=_[_0x85da('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x85da('0x1a'))(new Redis(config[_0x85da('0x18')]));require('./voiceQueue.socket')[_0x85da('0x1b')](socket);function respondWithStatusCode(_0x26512a,_0x516e70){_0x516e70=_0x516e70||0xcc;return function(_0x177858){if(_0x177858){return _0x26512a[_0x85da('0x1c')](_0x516e70);}return _0x26512a[_0x85da('0x1d')](_0x516e70)[_0x85da('0x1e')]();};}function respondWithResult(_0x4d702c,_0xec8d83){_0xec8d83=_0xec8d83||0xc8;return function(_0x57e49e){if(_0x57e49e){return _0x4d702c['status'](_0xec8d83)['json'](_0x57e49e);}};}function respondWithFilteredResult(_0x3fad0e,_0x255bd5){return function(_0xba93b2){if(_0xba93b2){var _0x21e3f5=_0xba93b2[_0x85da('0x1f')],_0x567513=_0x255bd5[_0x85da('0x20')],_0x5b8f60=_0x255bd5[_0x85da('0x20')]+_0x255bd5[_0x85da('0x21')],_0x4642eb;if(_0x5b8f60>=_0x21e3f5){_0x5b8f60=_0x21e3f5;_0x4642eb=0xc8;}else{_0x4642eb=0xce;}_0x3fad0e['status'](_0x4642eb);return _0x3fad0e[_0x85da('0x22')]('Content-Range',_0x567513+'-'+_0x5b8f60+'/'+_0x21e3f5)[_0x85da('0x23')](_0xba93b2);}return null;};}function patchUpdates(_0x2f587b){return function(_0x487a59){try{jsonpatch[_0x85da('0x24')](_0x487a59,_0x2f587b,!![]);}catch(_0x1b17b1){return BPromise[_0x85da('0x25')](_0x1b17b1);}return _0x487a59[_0x85da('0x26')]();};}function saveUpdates(_0x8e5a50,_0xae01c8){return function(_0x3cd28e){if(_0x3cd28e){return _0x3cd28e[_0x85da('0x27')](_0x8e5a50)[_0x85da('0x28')](function(_0x2cbe4f){return _0x2cbe4f;});}return null;};}function removeEntity(_0x2fe5cf,_0x231e0c){return function(_0x3839d1){if(_0x3839d1){return _0x3839d1[_0x85da('0x29')]()[_0x85da('0x28')](function(){var _0x4b6301=_0x3839d1['get']({'plain':!![]});var _0x3ebf35=[{'name':_0x85da('0x2a'),'value':_0x85da('0x2b'),'ignore':![]},{'name':_0x85da('0x2c'),'value':_0x85da('0x2d'),'ignore':![]}];var _0x3819f6=_(_0x3ebf35)[_0x85da('0x2e')](_0x85da('0x2f'))[_0x85da('0x30')](_0x85da('0x31'))[_0x85da('0x31')]();if(_['includes'](_0x3819f6,_0x4b6301[_0x85da('0x32')])){return;}var _0xf89f7e=_[_0x85da('0x33')](_0x3ebf35,['value',_0x4b6301[_0x85da('0x32')]])[_0x85da('0x34')];return db[_0x85da('0x35')][_0x85da('0x29')]({'where':{'type':_0xf89f7e,'resourceId':_0x4b6301['id']}})[_0x85da('0x28')](function(){return _0x3839d1;});})[_0x85da('0x28')](function(){_0x2fe5cf[_0x85da('0x1d')](0xcc)[_0x85da('0x1e')]();});}};}function handleEntityNotFound(_0x3980a4,_0x1af6b3){return function(_0x5b116b){if(!_0x5b116b){_0x3980a4[_0x85da('0x1c')](0x194);}return _0x5b116b;};}function handleError(_0x231c6f,_0x1490bc){_0x1490bc=_0x1490bc||0x1f4;return function(_0x1656a9){logger[_0x85da('0x36')](_0x1656a9[_0x85da('0x37')]);if(_0x1656a9['name']){delete _0x1656a9[_0x85da('0x34')];}_0x231c6f[_0x85da('0x1d')](_0x1490bc)['send'](_0x1656a9);};}exports[_0x85da('0x38')]=function(_0x4562a8,_0x9378d){var _0x43aa0d={},_0x24e1c4={},_0x8c6f90={'count':0x0,'rows':[]};var _0x3c6924=_[_0x85da('0x30')](db[_0x85da('0x39')]['rawAttributes'],function(_0x3d0ceb){return{'name':_0x3d0ceb[_0x85da('0x3a')],'type':_0x3d0ceb['type']['key']};});_0x24e1c4['model']=_[_0x85da('0x30')](_0x3c6924,_0x85da('0x34'));_0x24e1c4[_0x85da('0x3b')]=_[_0x85da('0x3c')](_0x4562a8['query']);_0x24e1c4[_0x85da('0x3d')]=_[_0x85da('0x3e')](_0x24e1c4[_0x85da('0x3f')],_0x24e1c4[_0x85da('0x3b')]);_0x43aa0d[_0x85da('0x40')]=_['intersection'](_0x24e1c4[_0x85da('0x3f')],qs[_0x85da('0x41')](_0x4562a8[_0x85da('0x3b')]['fields']));_0x43aa0d[_0x85da('0x40')]=_0x43aa0d['attributes'][_0x85da('0x42')]?_0x43aa0d[_0x85da('0x40')]:_0x24e1c4[_0x85da('0x3f')];if(!_0x4562a8[_0x85da('0x3b')]['hasOwnProperty']('nolimit')){_0x43aa0d[_0x85da('0x21')]=qs[_0x85da('0x21')](_0x4562a8[_0x85da('0x3b')][_0x85da('0x21')]);_0x43aa0d[_0x85da('0x20')]=qs[_0x85da('0x20')](_0x4562a8[_0x85da('0x3b')]['offset']);}_0x43aa0d['order']=qs['sort'](_0x4562a8[_0x85da('0x3b')][_0x85da('0x43')]);_0x43aa0d[_0x85da('0x44')]=qs['filters'](_[_0x85da('0x45')](_0x4562a8[_0x85da('0x3b')],_0x24e1c4[_0x85da('0x3d')]),_0x3c6924);if(_0x4562a8[_0x85da('0x3b')][_0x85da('0x2e')]){_0x43aa0d[_0x85da('0x44')]=_['merge'](_0x43aa0d[_0x85da('0x44')],{'$or':_[_0x85da('0x30')](_0x3c6924,function(_0x5afff9){if(_0x5afff9[_0x85da('0x32')]!==_0x85da('0x46')){var _0x51f7c1={};_0x51f7c1[_0x5afff9[_0x85da('0x34')]]={'$like':'%'+_0x4562a8[_0x85da('0x3b')]['filter']+'%'};return _0x51f7c1;}})});}_0x43aa0d=_[_0x85da('0x47')]({},_0x43aa0d,_0x4562a8[_0x85da('0x48')]);var _0x1b8927={'where':_0x43aa0d[_0x85da('0x44')]};return db['VoiceQueue'][_0x85da('0x1f')](_0x1b8927)[_0x85da('0x28')](function(_0x5af0d1){_0x8c6f90[_0x85da('0x1f')]=_0x5af0d1;if(_0x4562a8['query']['includeAll']){_0x43aa0d['include']=[{'all':!![]}];}return db[_0x85da('0x39')][_0x85da('0x49')](_0x43aa0d);})['then'](function(_0x24cf20){_0x8c6f90[_0x85da('0x4a')]=_0x24cf20;return _0x8c6f90;})[_0x85da('0x28')](respondWithFilteredResult(_0x9378d,_0x43aa0d))['catch'](handleError(_0x9378d,null));};exports['show']=function(_0x1545d2,_0x1d39ec){var _0x291623={'raw':![],'where':{'id':_0x1545d2[_0x85da('0x4b')]['id']}},_0x5011a8={};_0x5011a8[_0x85da('0x3f')]=_[_0x85da('0x3c')](db[_0x85da('0x39')][_0x85da('0x4c')]);_0x5011a8[_0x85da('0x3b')]=_[_0x85da('0x3c')](_0x1545d2[_0x85da('0x3b')]);_0x5011a8[_0x85da('0x3d')]=_[_0x85da('0x3e')](_0x5011a8[_0x85da('0x3f')],_0x5011a8[_0x85da('0x3b')]);_0x291623['attributes']=_['intersection'](_0x5011a8['model'],qs[_0x85da('0x41')](_0x1545d2[_0x85da('0x3b')][_0x85da('0x41')]));_0x291623[_0x85da('0x40')]=_0x291623[_0x85da('0x40')][_0x85da('0x42')]?_0x291623['attributes']:_0x5011a8[_0x85da('0x3f')];if(_0x1545d2[_0x85da('0x3b')][_0x85da('0x4d')]){_0x291623[_0x85da('0x4e')]=[{'all':!![]}];}_0x291623=_['merge']({},_0x291623,_0x1545d2[_0x85da('0x48')]);return db[_0x85da('0x39')][_0x85da('0x33')](_0x291623)[_0x85da('0x28')](handleEntityNotFound(_0x1d39ec,null))[_0x85da('0x28')](respondWithResult(_0x1d39ec,null))['catch'](handleError(_0x1d39ec,null));};exports[_0x85da('0x4f')]=function(_0x2f2d36,_0x580433){return db['VoiceQueue']['create'](_0x2f2d36[_0x85da('0x50')],{})[_0x85da('0x28')](function(_0xf6ac28){var _0x2d7dd0=_0x2f2d36[_0x85da('0x51')][_0x85da('0x52')]({'plain':!![]});if(!_0x2d7dd0)throw new Error(_0x85da('0x53'));if(_0x2d7dd0['role']===_0x85da('0x51')){var _0x5816dc=_0xf6ac28[_0x85da('0x52')]({'plain':!![]});var _0x2bddbd=[{'name':_0x85da('0x2a'),'value':_0x85da('0x2b')},{'name':_0x85da('0x2c'),'value':_0x85da('0x2d')}];var _0x3921b4=_[_0x85da('0x33')](_0x2bddbd,['value',_0x5816dc[_0x85da('0x32')]])[_0x85da('0x34')];return db['UserProfileSection']['find']({'where':{'name':_0x3921b4,'userProfileId':_0x2d7dd0[_0x85da('0x54')]},'raw':!![]})[_0x85da('0x28')](function(_0x338710){if(_0x338710&&_0x338710[_0x85da('0x55')]===0x0){return db[_0x85da('0x35')]['create']({'name':_0x5816dc[_0x85da('0x34')],'resourceId':_0x5816dc['id'],'type':_0x338710[_0x85da('0x34')],'sectionId':_0x338710['id']},{})['then'](function(){return _0xf6ac28;});}else{return _0xf6ac28;}})['catch'](function(_0x369304){logger[_0x85da('0x36')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x369304);throw _0x369304;});}return _0xf6ac28;})['then'](respondWithResult(_0x580433,0xc9))['catch'](handleError(_0x580433,null));};exports[_0x85da('0x56')]=function(_0x334874,_0x1c4caf){var _0x3db759={'where':{'id':_0x334874[_0x85da('0x4b')]['id']}},_0x225596={};_0x225596[_0x85da('0x3f')]=_[_0x85da('0x3c')](db[_0x85da('0x39')]['rawAttributes']);_0x3db759[_0x85da('0x40')]=_[_0x85da('0x3e')](_0x225596['model'],qs[_0x85da('0x41')](_0x334874[_0x85da('0x3b')][_0x85da('0x41')]));_0x3db759[_0x85da('0x40')]=_0x3db759[_0x85da('0x40')][_0x85da('0x42')]?_0x3db759[_0x85da('0x40')]:_0x225596[_0x85da('0x3f')];if(_0x334874['query']['includeAll']){_0x3db759[_0x85da('0x4e')]=[{'all':!![]}];}_0x3db759=_['merge']({},_0x3db759,_0x334874[_0x85da('0x48')]);return db[_0x85da('0x39')][_0x85da('0x33')](_0x3db759)[_0x85da('0x28')](handleEntityNotFound(_0x1c4caf,null))[_0x85da('0x28')](function(_0x7536de){if(_0x7536de){var _0x286913=_0x7536de[_0x85da('0x52')]({'plain':!![]});_0x286913=qs[_0x85da('0x57')](_0x286913,['id','createdAt','updatedAt']);_0x334874[_0x85da('0x50')]=_[_0x85da('0x57')](_0x334874['body'],['id','createdAt','updatedAt']);return db['VoiceQueue'][_0x85da('0x4f')](_[_0x85da('0x47')](_0x286913,_0x334874[_0x85da('0x50')]),{'include':_0x334874[_0x85da('0x3b')][_0x85da('0x4d')]?[{'all':!![]}]:undefined})['then'](function(_0x3442f0){var _0x4dd46a=_0x334874[_0x85da('0x51')][_0x85da('0x52')]({'plain':!![]});if(!_0x4dd46a)throw new Error(_0x85da('0x53'));if(_0x4dd46a['role']==='user'){var _0x3875e6=_0x3442f0[_0x85da('0x52')]({'plain':!![]});var _0x1f09a8=[{'name':_0x85da('0x2a'),'value':_0x85da('0x2b')},{'name':'QueueCampaigns','value':_0x85da('0x2d')}];var _0x5197fc=_[_0x85da('0x33')](_0x1f09a8,[_0x85da('0x31'),_0x3875e6[_0x85da('0x32')]])['name'];return db['UserProfileSection'][_0x85da('0x33')]({'where':{'name':_0x5197fc,'userProfileId':_0x4dd46a[_0x85da('0x54')]},'raw':!![]})[_0x85da('0x28')](function(_0x1ab1b4){if(_0x1ab1b4&&_0x1ab1b4[_0x85da('0x55')]===0x0){return db[_0x85da('0x35')][_0x85da('0x4f')]({'name':_0x3875e6[_0x85da('0x34')],'resourceId':_0x3875e6['id'],'type':_0x1ab1b4[_0x85da('0x34')],'sectionId':_0x1ab1b4['id']},{})[_0x85da('0x28')](function(){return _0x3442f0;});}else{return _0x3442f0;}})[_0x85da('0x58')](function(_0x47fa92){logger['error'](_0x85da('0x59'),_0x47fa92);throw _0x47fa92;});}return _0x3442f0;});}})[_0x85da('0x28')](respondWithResult(_0x1c4caf,0xc9))['catch'](handleError(_0x1c4caf,null));};exports[_0x85da('0x27')]=function(_0x16c202,_0x1f485c){if(_0x16c202[_0x85da('0x50')]['id']){delete _0x16c202[_0x85da('0x50')]['id'];}return db[_0x85da('0x39')][_0x85da('0x33')]({'where':{'id':_0x16c202['params']['id']}})[_0x85da('0x28')](handleEntityNotFound(_0x1f485c,null))[_0x85da('0x28')](saveUpdates(_0x16c202[_0x85da('0x50')],null))[_0x85da('0x28')](respondWithResult(_0x1f485c,null))['catch'](handleError(_0x1f485c,null));};exports[_0x85da('0x29')]=function(_0x5530dd,_0x48acbf){return db[_0x85da('0x39')][_0x85da('0x33')]({'where':{'id':_0x5530dd[_0x85da('0x4b')]['id']}})['then'](handleEntityNotFound(_0x48acbf,null))[_0x85da('0x28')](removeEntity(_0x48acbf,null))['catch'](handleError(_0x48acbf,null));};exports['getHoppers']=function(_0x363db7,_0x41fea9,_0x2b190e){var _0x3a46b2={'raw':![],'where':{}};var _0x31c5cd={};var _0x7b6d23={'count':0x0,'rows':[]};return db[_0x85da('0x39')][_0x85da('0x5a')]({'where':{'id':_0x363db7['params']['id']}})[_0x85da('0x28')](handleEntityNotFound(_0x41fea9,null))['then'](function(_0x1db68f){if(_0x1db68f){_0x31c5cd[_0x85da('0x3f')]=_['keys'](db[_0x85da('0x5b')][_0x85da('0x4c')]);_0x31c5cd['query']=_[_0x85da('0x3c')](_0x363db7[_0x85da('0x3b')]);_0x31c5cd[_0x85da('0x3d')]=_['intersection'](_0x31c5cd['model'],_0x31c5cd[_0x85da('0x3b')]);_0x3a46b2[_0x85da('0x40')]=_[_0x85da('0x3e')](_0x31c5cd[_0x85da('0x3f')],qs[_0x85da('0x41')](_0x363db7[_0x85da('0x3b')][_0x85da('0x41')]));_0x3a46b2[_0x85da('0x40')]=_0x3a46b2[_0x85da('0x40')][_0x85da('0x42')]?_0x3a46b2['attributes']:_0x31c5cd[_0x85da('0x3f')];if(!_0x363db7[_0x85da('0x3b')][_0x85da('0x5c')](_0x85da('0x5d'))){_0x3a46b2[_0x85da('0x21')]=qs[_0x85da('0x21')](_0x363db7[_0x85da('0x3b')][_0x85da('0x21')]);_0x3a46b2[_0x85da('0x20')]=qs['offset'](_0x363db7[_0x85da('0x3b')][_0x85da('0x20')]);}_0x3a46b2[_0x85da('0x5e')]=qs[_0x85da('0x43')](_0x363db7[_0x85da('0x3b')]['sort']);_0x3a46b2[_0x85da('0x44')]=qs['filters'](_[_0x85da('0x45')](_0x363db7['query'],_0x31c5cd[_0x85da('0x3d')]));_0x3a46b2[_0x85da('0x44')][_0x85da('0x5f')]=_0x1db68f['id'];if(_0x363db7[_0x85da('0x3b')][_0x85da('0x2e')]){_0x3a46b2[_0x85da('0x44')]=_[_0x85da('0x47')](_0x3a46b2[_0x85da('0x44')],{'$or':_['map'](_0x3a46b2[_0x85da('0x40')],function(_0x163a34){var _0x36d823={};_0x36d823[_0x163a34]={'$like':'%'+_0x363db7[_0x85da('0x3b')]['filter']+'%'};return _0x36d823;})});}_0x3a46b2=_[_0x85da('0x47')]({},_0x3a46b2,_0x363db7[_0x85da('0x48')]);return db[_0x85da('0x5b')][_0x85da('0x1f')]({'where':_0x3a46b2[_0x85da('0x44')]})[_0x85da('0x28')](function(_0x37325e){_0x7b6d23['count']=_0x37325e;if(_0x363db7[_0x85da('0x3b')]['includeAll']){_0x3a46b2[_0x85da('0x4e')]=[{'all':!![]}];}return db['CmHopper'][_0x85da('0x49')](_0x3a46b2);})['then'](function(_0x357884){_0x7b6d23[_0x85da('0x4a')]=_0x357884;return _0x7b6d23;});}})[_0x85da('0x28')](respondWithFilteredResult(_0x41fea9,_0x3a46b2))[_0x85da('0x58')](handleError(_0x41fea9,null));};exports[_0x85da('0x60')]=function(_0x29f5fd,_0x769182,_0xec70d8){var _0x371c1a={'raw':!![],'where':{}};var _0x1105bd={};var _0xfde6d9={'count':0x0,'rows':[]};return db[_0x85da('0x39')]['findOne']({'where':{'id':_0x29f5fd[_0x85da('0x4b')]['id']}})['then'](handleEntityNotFound(_0x769182,null))[_0x85da('0x28')](function(_0x3b8bd3){if(_0x3b8bd3){_0x1105bd[_0x85da('0x3f')]=_[_0x85da('0x3c')](db[_0x85da('0x61')][_0x85da('0x4c')]);_0x1105bd[_0x85da('0x3b')]=_[_0x85da('0x3c')](_0x29f5fd[_0x85da('0x3b')]);_0x1105bd[_0x85da('0x3d')]=_[_0x85da('0x3e')](_0x1105bd[_0x85da('0x3f')],_0x1105bd['query']);_0x371c1a[_0x85da('0x40')]=_[_0x85da('0x3e')](_0x1105bd[_0x85da('0x3f')],qs[_0x85da('0x41')](_0x29f5fd[_0x85da('0x3b')][_0x85da('0x41')]));_0x371c1a[_0x85da('0x40')]=_0x371c1a[_0x85da('0x40')][_0x85da('0x42')]?_0x371c1a['attributes']:_0x1105bd['model'];if(!_0x29f5fd['query'][_0x85da('0x5c')]('nolimit')){_0x371c1a[_0x85da('0x21')]=qs['limit'](_0x29f5fd[_0x85da('0x3b')][_0x85da('0x21')]);_0x371c1a['offset']=qs[_0x85da('0x20')](_0x29f5fd[_0x85da('0x3b')][_0x85da('0x20')]);}_0x371c1a[_0x85da('0x5e')]=qs[_0x85da('0x43')](_0x29f5fd[_0x85da('0x3b')][_0x85da('0x43')]);_0x371c1a['where']=qs[_0x85da('0x3d')](_[_0x85da('0x45')](_0x29f5fd[_0x85da('0x3b')],_0x1105bd[_0x85da('0x3d')]));_0x371c1a[_0x85da('0x44')]['VoiceQueueId']=_0x3b8bd3['id'];if(_0x29f5fd[_0x85da('0x3b')][_0x85da('0x2e')]){_0x371c1a['where']=_[_0x85da('0x47')](_0x371c1a['where'],{'$or':_['map'](_0x371c1a['attributes'],function(_0x4251c8){var _0x4be232={};_0x4be232[_0x4251c8]={'$like':'%'+_0x29f5fd[_0x85da('0x3b')][_0x85da('0x2e')]+'%'};return _0x4be232;})});}_0x371c1a=_[_0x85da('0x47')]({},_0x371c1a,_0x29f5fd[_0x85da('0x48')]);return db['CmHopperHistory']['count']({'where':_0x371c1a[_0x85da('0x44')]})[_0x85da('0x28')](function(_0x304c01){_0xfde6d9['count']=_0x304c01;if(_0x29f5fd[_0x85da('0x3b')][_0x85da('0x4d')]){_0x371c1a[_0x85da('0x4e')]=[{'all':!![]}];}return db[_0x85da('0x61')][_0x85da('0x49')](_0x371c1a);})[_0x85da('0x28')](function(_0x104457){_0xfde6d9[_0x85da('0x4a')]=_0x104457;return _0xfde6d9;});}})[_0x85da('0x28')](respondWithFilteredResult(_0x769182,_0x371c1a))[_0x85da('0x58')](handleError(_0x769182,null));};exports[_0x85da('0x62')]=function(_0x2e00e3,_0x4ff8dc,_0x486ac8){var _0xe3a031={'raw':!![],'where':{}};var _0x250cb7={};var _0x574be2={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x2e00e3[_0x85da('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4ff8dc,null))[_0x85da('0x28')](function(_0xb7464a){if(_0xb7464a){_0x250cb7[_0x85da('0x3f')]=_[_0x85da('0x3c')](db[_0x85da('0x63')][_0x85da('0x4c')]);_0x250cb7[_0x85da('0x3b')]=_[_0x85da('0x3c')](_0x2e00e3['query']);_0x250cb7[_0x85da('0x3d')]=_[_0x85da('0x3e')](_0x250cb7['model'],_0x250cb7[_0x85da('0x3b')]);_0xe3a031[_0x85da('0x40')]=_[_0x85da('0x3e')](_0x250cb7[_0x85da('0x3f')],qs['fields'](_0x2e00e3[_0x85da('0x3b')]['fields']));_0xe3a031[_0x85da('0x40')]=_0xe3a031['attributes'][_0x85da('0x42')]?_0xe3a031[_0x85da('0x40')]:_0x250cb7['model'];if(!_0x2e00e3[_0x85da('0x3b')]['hasOwnProperty']('nolimit')){_0xe3a031[_0x85da('0x21')]=qs[_0x85da('0x21')](_0x2e00e3['query'][_0x85da('0x21')]);_0xe3a031['offset']=qs['offset'](_0x2e00e3[_0x85da('0x3b')][_0x85da('0x20')]);}_0xe3a031[_0x85da('0x5e')]=qs[_0x85da('0x43')](_0x2e00e3[_0x85da('0x3b')]['sort']);_0xe3a031[_0x85da('0x44')]=qs[_0x85da('0x3d')](_['pick'](_0x2e00e3['query'],_0x250cb7[_0x85da('0x3d')]));_0xe3a031[_0x85da('0x44')]['VoiceQueueId']=_0xb7464a['id'];if(_0x2e00e3[_0x85da('0x3b')][_0x85da('0x2e')]){_0xe3a031['where']=_['merge'](_0xe3a031['where'],{'$or':_[_0x85da('0x30')](_0xe3a031[_0x85da('0x40')],function(_0x11f670){var _0x2f68d0={};_0x2f68d0[_0x11f670]={'$like':'%'+_0x2e00e3[_0x85da('0x3b')][_0x85da('0x2e')]+'%'};return _0x2f68d0;})});}_0xe3a031=_[_0x85da('0x47')]({},_0xe3a031,_0x2e00e3[_0x85da('0x48')]);return db['CmHopperFinal'][_0x85da('0x1f')]({'where':_0xe3a031[_0x85da('0x44')]})['then'](function(_0x52a0bd){_0x574be2['count']=_0x52a0bd;if(_0x2e00e3['query'][_0x85da('0x4d')]){_0xe3a031['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x85da('0x49')](_0xe3a031);})[_0x85da('0x28')](function(_0x9a24b7){_0x574be2[_0x85da('0x4a')]=_0x9a24b7;return _0x574be2;});}})[_0x85da('0x28')](respondWithFilteredResult(_0x4ff8dc,_0xe3a031))[_0x85da('0x58')](handleError(_0x4ff8dc,null));};exports['getHopperBlacks']=function(_0x329812,_0x2008b9,_0x5d3e66){var _0xa72cfe={'raw':!![],'where':{}};var _0xf272c3={};var _0x167c68={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x85da('0x5a')]({'where':{'id':_0x329812['params']['id']}})[_0x85da('0x28')](handleEntityNotFound(_0x2008b9,null))[_0x85da('0x28')](function(_0x101b1a){if(_0x101b1a){_0xf272c3['model']=_[_0x85da('0x3c')](db[_0x85da('0x64')][_0x85da('0x4c')]);_0xf272c3[_0x85da('0x3b')]=_[_0x85da('0x3c')](_0x329812[_0x85da('0x3b')]);_0xf272c3[_0x85da('0x3d')]=_[_0x85da('0x3e')](_0xf272c3[_0x85da('0x3f')],_0xf272c3[_0x85da('0x3b')]);_0xa72cfe[_0x85da('0x40')]=_[_0x85da('0x3e')](_0xf272c3[_0x85da('0x3f')],qs['fields'](_0x329812[_0x85da('0x3b')][_0x85da('0x41')]));_0xa72cfe[_0x85da('0x40')]=_0xa72cfe[_0x85da('0x40')][_0x85da('0x42')]?_0xa72cfe[_0x85da('0x40')]:_0xf272c3[_0x85da('0x3f')];if(!_0x329812['query'][_0x85da('0x5c')]('nolimit')){_0xa72cfe['limit']=qs[_0x85da('0x21')](_0x329812['query'][_0x85da('0x21')]);_0xa72cfe[_0x85da('0x20')]=qs[_0x85da('0x20')](_0x329812[_0x85da('0x3b')][_0x85da('0x20')]);}_0xa72cfe[_0x85da('0x5e')]=qs['sort'](_0x329812['query'][_0x85da('0x43')]);_0xa72cfe['where']=qs['filters'](_[_0x85da('0x45')](_0x329812['query'],_0xf272c3[_0x85da('0x3d')]));_0xa72cfe[_0x85da('0x44')]['VoiceQueueId']=_0x101b1a['id'];if(_0x329812[_0x85da('0x3b')]['filter']){_0xa72cfe['where']=_[_0x85da('0x47')](_0xa72cfe[_0x85da('0x44')],{'$or':_[_0x85da('0x30')](_0xa72cfe['attributes'],function(_0x1c6823){var _0x531aec={};_0x531aec[_0x1c6823]={'$like':'%'+_0x329812[_0x85da('0x3b')][_0x85da('0x2e')]+'%'};return _0x531aec;})});}_0xa72cfe=_[_0x85da('0x47')]({},_0xa72cfe,_0x329812['options']);return db[_0x85da('0x64')]['count']({'where':_0xa72cfe[_0x85da('0x44')]})['then'](function(_0x265d1f){_0x167c68[_0x85da('0x1f')]=_0x265d1f;if(_0x329812['query'][_0x85da('0x4d')]){_0xa72cfe['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0x85da('0x49')](_0xa72cfe);})['then'](function(_0x379515){_0x167c68[_0x85da('0x4a')]=_0x379515;return _0x167c68;});}})[_0x85da('0x28')](respondWithFilteredResult(_0x2008b9,_0xa72cfe))['catch'](handleError(_0x2008b9,null));};exports['getTeams']=function(_0x3cf93a,_0x3a196a,_0x4d7d13){var _0x3d9827={};var _0x5deff1={};var _0x1c5a2f;var _0xf0d9c7;return db[_0x85da('0x39')][_0x85da('0x5a')]({'where':{'id':_0x3cf93a[_0x85da('0x4b')]['id']}})[_0x85da('0x28')](handleEntityNotFound(_0x3a196a,null))['then'](function(_0x484dc7){if(_0x484dc7){_0x1c5a2f=_0x484dc7;_0x5deff1['model']=_[_0x85da('0x3c')](db[_0x85da('0x65')][_0x85da('0x4c')]);_0x5deff1['query']=_[_0x85da('0x3c')](_0x3cf93a['query']);_0x5deff1[_0x85da('0x3d')]=_[_0x85da('0x3e')](_0x5deff1[_0x85da('0x3f')],_0x5deff1[_0x85da('0x3b')]);_0x3d9827[_0x85da('0x40')]=_[_0x85da('0x3e')](_0x5deff1[_0x85da('0x3f')],qs[_0x85da('0x41')](_0x3cf93a['query'][_0x85da('0x41')]));_0x3d9827['attributes']=_0x3d9827[_0x85da('0x40')][_0x85da('0x42')]?_0x3d9827[_0x85da('0x40')]:_0x5deff1['model'];_0x3d9827[_0x85da('0x5e')]=qs[_0x85da('0x43')](_0x3cf93a[_0x85da('0x3b')][_0x85da('0x43')]);_0x3d9827[_0x85da('0x44')]=qs[_0x85da('0x3d')](_[_0x85da('0x45')](_0x3cf93a['query'],_0x5deff1[_0x85da('0x3d')]));if(_0x3cf93a[_0x85da('0x3b')][_0x85da('0x2e')]){_0x3d9827['where']=_[_0x85da('0x47')](_0x3d9827['where'],{'$or':_[_0x85da('0x30')](_0x3d9827['attributes'],function(_0x509f93){var _0x56a3eb={};_0x56a3eb[_0x509f93]={'$like':'%'+_0x3cf93a[_0x85da('0x3b')][_0x85da('0x2e')]+'%'};return _0x56a3eb;})});}_0x3d9827=_['merge']({},_0x3d9827,_0x3cf93a['options']);return _0x1c5a2f['getTeams'](_0x3d9827);}})[_0x85da('0x28')](function(_0x389903){if(_0x389903){_0xf0d9c7=_0x389903[_0x85da('0x42')];if(!_0x3cf93a[_0x85da('0x3b')][_0x85da('0x5c')](_0x85da('0x5d'))){_0x3d9827[_0x85da('0x21')]=qs[_0x85da('0x21')](_0x3cf93a[_0x85da('0x3b')][_0x85da('0x21')]);_0x3d9827[_0x85da('0x20')]=qs[_0x85da('0x20')](_0x3cf93a[_0x85da('0x3b')]['offset']);}return _0x1c5a2f[_0x85da('0x66')](_0x3d9827);}})[_0x85da('0x28')](function(_0x25698d){if(_0x25698d){return _0x25698d?{'count':_0xf0d9c7,'rows':_0x25698d}:null;}})[_0x85da('0x28')](respondWithResult(_0x3a196a,null))['catch'](handleError(_0x3a196a,null));};exports[_0x85da('0x67')]=function(_0x5976e0,_0x6e47c,_0x225583){var _0x15ebce=_0x5976e0[_0x85da('0x50')][_0x85da('0x68')];var _0x41cac2=_['map'](_0x15ebce,'id');return db['Team']['findAll']({'where':{'id':_0x41cac2},'attributes':['id'],'include':[{'model':db[_0x85da('0x69')],'as':'Agents','attributes':['id',_0x85da('0x34'),'online',_0x85da('0x6a'),_0x85da('0x6b')],'raw':!![]}]})[_0x85da('0x28')](function(_0x59f880){if(_0x59f880){var _0x55e070=_[_0x85da('0x6c')](_0x59f880,function(_0x521b9e){var _0x43f36f=_0x521b9e['get']({'plain':!![]});_0x43f36f[_0x85da('0x6d')]['forEach'](function(_0x5adeb7){_0x5adeb7[_0x85da('0x6e')]=_[_0x85da('0x33')](_0x15ebce,{'id':_0x43f36f['id']})['penalty'];});return _0x43f36f[_0x85da('0x6d')];});return db['VoiceQueue'][_0x85da('0x33')]({'where':{'id':_0x5976e0[_0x85da('0x4b')]['id']}})['then'](function(_0x374afc){return db[_0x85da('0x6f')]['transaction'](function(_0x362ffc){return _0x374afc['addTeams'](_0x41cac2,{'transaction':_0x362ffc})[_0x85da('0x28')](function(){return BPromise['each'](_0x15ebce,function(_0x22109a){return db[_0x85da('0x70')][_0x85da('0x71')]({'TeamId':_0x22109a['id'],'VoiceQueueId':_0x5976e0[_0x85da('0x4b')]['id'],'penalty':_0x22109a[_0x85da('0x6e')]},{'transaction':_0x362ffc});});})[_0x85da('0x28')](function(){return BPromise[_0x85da('0x72')](_0x55e070,function(_0x961354){return db[_0x85da('0x73')][_0x85da('0x74')]({'where':{'UserId':_0x961354['id'],'VoiceQueueId':_0x5976e0[_0x85da('0x4b')]['id']},'defaults':{'penalty':_0x961354[_0x85da('0x6e')]},'transaction':_0x362ffc});});})[_0x85da('0x28')](function(){return BPromise[_0x85da('0x72')](_[_0x85da('0x2e')](_0x55e070,{'online':!![]}),function(_0x13e759){return db[_0x85da('0x75')]['upsert']({'membername':_0x13e759[_0x85da('0x34')],'UserId':_0x13e759['id'],'queue_name':_0x374afc[_0x85da('0x34')],'VoiceQueueId':_0x374afc['id'],'interface':_[_0x85da('0x76')](_0x13e759[_0x85da('0x6b')])?util[_0x85da('0x77')](_0x85da('0x78'),_0x13e759[_0x85da('0x34')]):_0x13e759[_0x85da('0x6b')],'paused':_0x13e759[_0x85da('0x6a')]||![],'penalty':_0x13e759[_0x85da('0x6e')]},{'transaction':_0x362ffc});});})['then'](function(){_0x55e070[_0x85da('0x79')](function(_0xe5db93){socket['emit'](_0x85da('0x7a'),{'UserId':_0xe5db93['id'],'VoiceQueueId':_0x374afc['id']});});});});});}})[_0x85da('0x28')](respondWithStatusCode(_0x6e47c,null))[_0x85da('0x58')](handleError(_0x6e47c,null));};exports[_0x85da('0x7b')]=function(_0xf5f86e,_0x5e6a79,_0x3c04a7){return db['Team']['findAll']({'where':{'id':_0xf5f86e[_0x85da('0x3b')][_0x85da('0x7c')]},'attributes':['id'],'include':[{'model':db[_0x85da('0x69')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5e6a79,null))[_0x85da('0x28')](function(_0x27c4bc){var _0xf53081=_[_0x85da('0x30')](_0x27c4bc,'id');var _0x30c787=[];var _0x2d251c=[];var _0x38fd55=squel['select']();_0x38fd55[_0x85da('0x7d')]('tq.TeamId')[_0x85da('0x7e')](_0x85da('0x7f'),'tq')[_0x85da('0x80')](_0x85da('0x81'),'ut',_0x85da('0x82'))[_0x85da('0x44')](_0x85da('0x83'),_0xf5f86e[_0x85da('0x4b')]['id']);for(var _0x3326ed=0x0;_0x3326ed<_0x27c4bc['length'];_0x3326ed+=0x1){let _0x1d339a=_0x27c4bc[_0x3326ed];for(var _0x2ad3dc=0x0;_0x2ad3dc<_0x1d339a[_0x85da('0x6d')][_0x85da('0x42')];_0x2ad3dc+=0x1){let _0x152cb2=_0x1d339a[_0x85da('0x6d')][_0x2ad3dc];var _0x32db8f=_0x38fd55[_0x85da('0x56')]();_0x32db8f[_0x85da('0x44')](_0x85da('0x84'),_0x152cb2['id']);_0x2d251c[_0x85da('0x85')](db['sequelize'][_0x85da('0x3b')](_0x32db8f[_0x85da('0x86')](),{'type':db[_0x85da('0x6f')][_0x85da('0x87')][_0x85da('0x88')]})[_0x85da('0x28')](function(_0x4374b7){if(_0x4374b7['length']===0x1){return _0x152cb2['id'];}else{var _0x5defc2=_[_0x85da('0x89')](_['map'](_0x4374b7,_0x85da('0x8a')),function(_0x4bb437){return _['includes'](_0xf53081,_0x4bb437);});if(_0x5defc2){return _0x152cb2['id'];}}}));}}return BPromise[_0x85da('0x8b')](_0x2d251c)[_0x85da('0x28')](function(_0x4ddc37){_0x30c787=_(_0x30c787)[_0x85da('0x8c')](_0x4ddc37)['compact']()[_0x85da('0x31')]();return db['VoiceQueue']['find']({'where':{'id':_0xf5f86e[_0x85da('0x4b')]['id']}})['then'](function(_0x459a98){return db[_0x85da('0x6f')][_0x85da('0x8d')](function(_0x307ad4){return _0x459a98['removeTeams'](_0xf5f86e[_0x85da('0x3b')][_0x85da('0x7c')],{'transaction':_0x307ad4})[_0x85da('0x28')](function(){if(!_[_0x85da('0x8e')](_0x30c787)){return _0x459a98[_0x85da('0x8f')](_0x30c787,{'transaction':_0x307ad4})[_0x85da('0x28')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0xf5f86e[_0x85da('0x4b')]['id'],'UserId':_0x30c787},'transaction':_0x307ad4});});}})[_0x85da('0x28')](function(){_0x30c787[_0x85da('0x79')](function(_0x465447){socket[_0x85da('0x90')](_0x85da('0x91'),{'UserId':_0x465447,'VoiceQueueId':_0x459a98['id']});});});});});});})[_0x85da('0x28')](respondWithStatusCode(_0x5e6a79,null))[_0x85da('0x58')](handleError(_0x5e6a79,null));};exports[_0x85da('0x92')]=function(_0xaa5f9b,_0x563e78,_0x8e7a4e){var _0x2644f9,_0x417ed8;return db['VoiceQueue'][_0x85da('0x33')]({'where':{'id':_0xaa5f9b[_0x85da('0x4b')]['id']}})['then'](handleEntityNotFound(_0x563e78,null))[_0x85da('0x28')](function(_0x339edf){if(_0x339edf){_0x417ed8=_0x339edf;return _0x339edf[_0x85da('0x92')](_0xaa5f9b[_0x85da('0x50')][_0x85da('0x7c')],_[_0x85da('0x57')](_0xaa5f9b[_0x85da('0x50')],[_0x85da('0x7c'),'id'])||{})[_0x85da('0x93')](function(_0x23981a){for(var _0x555cc9=0x0;_0x555cc9<_0xaa5f9b[_0x85da('0x50')][_0x85da('0x7c')]['length'];_0x555cc9+=0x1){socket[_0x85da('0x90')](_0x85da('0x7a'),{'UserId':_0xaa5f9b[_0x85da('0x50')]['ids'][_0x555cc9],'VoiceQueueId':_0xaa5f9b[_0x85da('0x4b')]['id']});}return _0x23981a;});}})['then'](function(_0x13a7f4){_0x2644f9=_0x13a7f4||[];if(_0x417ed8){return db[_0x85da('0x69')][_0x85da('0x49')]({'where':{'id':_0xaa5f9b['body'][_0x85da('0x7c')]},'attributes':['id',_0x85da('0x34'),_0x85da('0x94'),'voicePause',_0x85da('0x6b')],'raw':!![]});}})[_0x85da('0x28')](function(_0x62f248){if(!_[_0x85da('0x8e')](_0x62f248)){var _0x2fcb91=[];for(var _0x431787=0x0;_0x431787<_0x62f248[_0x85da('0x42')];_0x431787++){if(_0x62f248[_0x431787][_0x85da('0x94')]){_0x2fcb91['push'](db[_0x85da('0x75')]['upsert']({'membername':_0x62f248[_0x431787]['name'],'UserId':_0x62f248[_0x431787]['id'],'queue_name':_0x417ed8['name'],'VoiceQueueId':_0x417ed8['id'],'interface':_[_0x85da('0x76')](_0x62f248[_0x431787][_0x85da('0x6b')])?util[_0x85da('0x77')](_0x85da('0x78'),_0x62f248[_0x431787][_0x85da('0x34')]):_0x62f248[_0x431787][_0x85da('0x6b')],'paused':_0x62f248[_0x431787][_0x85da('0x6a')]||![],'penalty':_0xaa5f9b[_0x85da('0x50')]['penalty']||0x0}));}}return BPromise['all'](_0x2fcb91);}})[_0x85da('0x28')](function(){return _0x2644f9;})['then'](respondWithResult(_0x563e78,null))[_0x85da('0x58')](handleError(_0x563e78,null));};exports['removeAgents']=function(_0x2dbe5a,_0xea0b4a,_0x4bbf4a){return db[_0x85da('0x39')][_0x85da('0x33')]({'where':{'id':_0x2dbe5a[_0x85da('0x4b')]['id']}})[_0x85da('0x28')](handleEntityNotFound(_0xea0b4a,null))[_0x85da('0x28')](function(_0x1eb5a2){if(_0x1eb5a2){return _0x1eb5a2[_0x85da('0x8f')](_0x2dbe5a[_0x85da('0x3b')][_0x85da('0x7c')])[_0x85da('0x28')](function(){if(_[_0x85da('0x95')](_0x2dbe5a[_0x85da('0x3b')]['ids'])){for(var _0x398c4b=0x0;_0x398c4b<_0x2dbe5a[_0x85da('0x3b')]['ids'][_0x85da('0x42')];_0x398c4b+=0x1){socket[_0x85da('0x90')]('userVoiceQueue:remove',{'UserId':Number(_0x2dbe5a[_0x85da('0x3b')][_0x85da('0x7c')][_0x398c4b]),'VoiceQueueId':Number(_0x2dbe5a[_0x85da('0x4b')]['id'])});}}else{socket[_0x85da('0x90')](_0x85da('0x91'),{'UserId':Number(_0x2dbe5a[_0x85da('0x3b')][_0x85da('0x7c')]),'VoiceQueueId':Number(_0x2dbe5a[_0x85da('0x4b')]['id'])});}});}})[_0x85da('0x28')](function(_0x55718f){return db[_0x85da('0x75')][_0x85da('0x29')]({'where':{'VoiceQueueId':_0x2dbe5a[_0x85da('0x4b')]['id'],'UserId':_0x2dbe5a[_0x85da('0x3b')][_0x85da('0x7c')]}})[_0x85da('0x28')](function(){return _0x55718f;});})[_0x85da('0x28')](respondWithStatusCode(_0xea0b4a,null))[_0x85da('0x58')](handleError(_0xea0b4a,null));};exports[_0x85da('0x96')]=function(_0x1379b9,_0x5ba69a,_0x4c3900){var _0x56fc06={};var _0x29f6fc={};var _0x332749;var _0x16c02b;return db['VoiceQueue']['findOne']({'where':{'id':_0x1379b9[_0x85da('0x4b')]['id']}})[_0x85da('0x28')](handleEntityNotFound(_0x5ba69a,null))[_0x85da('0x28')](function(_0x25b15a){if(_0x25b15a){_0x332749=_0x25b15a;_0x29f6fc['model']=_['keys'](db[_0x85da('0x69')]['rawAttributes']);_0x29f6fc[_0x85da('0x3b')]=_[_0x85da('0x3c')](_0x1379b9['query']);_0x29f6fc[_0x85da('0x3d')]=_[_0x85da('0x3e')](_0x29f6fc['model'],_0x29f6fc[_0x85da('0x3b')]);_0x56fc06[_0x85da('0x40')]=_[_0x85da('0x3e')](_0x29f6fc[_0x85da('0x3f')],qs['fields'](_0x1379b9['query']['fields']));_0x56fc06[_0x85da('0x40')]=_0x56fc06['attributes'][_0x85da('0x42')]?_0x56fc06['attributes']:_0x29f6fc['model'];_0x56fc06['order']=qs['sort'](_0x1379b9[_0x85da('0x3b')][_0x85da('0x43')]);_0x56fc06[_0x85da('0x44')]=qs[_0x85da('0x3d')](_['pick'](_0x1379b9['query'],_0x29f6fc['filters']));if(_0x1379b9[_0x85da('0x3b')][_0x85da('0x2e')]){_0x56fc06['where']=_[_0x85da('0x47')](_0x56fc06['where'],{'$or':_[_0x85da('0x30')](_0x56fc06[_0x85da('0x40')],function(_0x5bcc16){var _0x3e8675={};_0x3e8675[_0x5bcc16]={'$like':'%'+_0x1379b9['query'][_0x85da('0x2e')]+'%'};return _0x3e8675;})});}_0x56fc06=_[_0x85da('0x47')]({},_0x56fc06,_0x1379b9[_0x85da('0x48')]);return _0x332749[_0x85da('0x96')](_0x56fc06);}})[_0x85da('0x28')](function(_0xfacd7e){if(_0xfacd7e){_0x16c02b=_0xfacd7e[_0x85da('0x42')];if(!_0x1379b9['query'][_0x85da('0x5c')]('nolimit')){_0x56fc06[_0x85da('0x21')]=qs[_0x85da('0x21')](_0x1379b9[_0x85da('0x3b')][_0x85da('0x21')]);_0x56fc06['offset']=qs['offset'](_0x1379b9[_0x85da('0x3b')][_0x85da('0x20')]);}return _0x332749['getAgents'](_0x56fc06);}})[_0x85da('0x28')](function(_0xf818e){if(_0xf818e){return _0xf818e?{'count':_0x16c02b,'rows':_0xf818e}:null;}})['then'](respondWithResult(_0x5ba69a,null))[_0x85da('0x58')](handleError(_0x5ba69a,null));};exports[_0x85da('0x97')]=function(_0x34447a,_0x53245e,_0x26a521){var _0x5276fc={};var _0x485ea6={};var _0x362529;var _0x5569b7;return db[_0x85da('0x39')][_0x85da('0x5a')]({'where':{'id':_0x34447a[_0x85da('0x4b')]['id']}})[_0x85da('0x28')](handleEntityNotFound(_0x53245e,null))['then'](function(_0x1ac85e){if(_0x1ac85e){_0x362529=_0x1ac85e;_0x485ea6['model']=_[_0x85da('0x3c')](db[_0x85da('0x75')][_0x85da('0x4c')]);_0x485ea6[_0x85da('0x3b')]=_['keys'](_0x34447a['query']);_0x485ea6[_0x85da('0x3d')]=_[_0x85da('0x3e')](_0x485ea6[_0x85da('0x3f')],_0x485ea6[_0x85da('0x3b')]);_0x5276fc[_0x85da('0x40')]=_[_0x85da('0x3e')](_0x485ea6[_0x85da('0x3f')],qs[_0x85da('0x41')](_0x34447a['query'][_0x85da('0x41')]));_0x5276fc[_0x85da('0x40')]=_0x5276fc['attributes'][_0x85da('0x42')]?_0x5276fc[_0x85da('0x40')]:_0x485ea6['model'];_0x5276fc[_0x85da('0x5e')]=qs[_0x85da('0x43')](_0x34447a[_0x85da('0x3b')][_0x85da('0x43')]);_0x5276fc[_0x85da('0x44')]=qs[_0x85da('0x3d')](_[_0x85da('0x45')](_0x34447a[_0x85da('0x3b')],_0x485ea6[_0x85da('0x3d')]));if(_0x34447a['query'][_0x85da('0x2e')]){_0x5276fc['where']=_[_0x85da('0x47')](_0x5276fc['where'],{'$or':_[_0x85da('0x30')](_0x5276fc['attributes'],function(_0x322fcf){var _0x2ba409={};_0x2ba409[_0x322fcf]={'$like':'%'+_0x34447a['query'][_0x85da('0x2e')]+'%'};return _0x2ba409;})});}_0x5276fc=_[_0x85da('0x47')]({},_0x5276fc,_0x34447a['options']);return _0x362529[_0x85da('0x97')](_0x5276fc);}})[_0x85da('0x28')](function(_0x1cd293){if(_0x1cd293){_0x5569b7=_0x1cd293[_0x85da('0x42')];if(!_0x34447a[_0x85da('0x3b')][_0x85da('0x5c')](_0x85da('0x5d'))){_0x5276fc['limit']=qs['limit'](_0x34447a[_0x85da('0x3b')][_0x85da('0x21')]);_0x5276fc[_0x85da('0x20')]=qs[_0x85da('0x20')](_0x34447a[_0x85da('0x3b')]['offset']);}return _0x362529[_0x85da('0x97')](_0x5276fc);}})[_0x85da('0x28')](function(_0x4fe426){return _0x4fe426?{'count':_0x5569b7,'rows':_0x4fe426}:null;})['then'](respondWithResult(_0x53245e,null))[_0x85da('0x58')](handleError(_0x53245e,null));};exports['getLists']=function(_0x55924a,_0x1d1dd5,_0x3ccc2c){var _0x207b3e={};var _0x180674={};var _0x2000db;var _0x1412a8;return db[_0x85da('0x39')][_0x85da('0x5a')]({'where':{'id':_0x55924a[_0x85da('0x4b')]['id']}})[_0x85da('0x28')](handleEntityNotFound(_0x1d1dd5,null))[_0x85da('0x28')](function(_0x4df372){if(_0x4df372){_0x2000db=_0x4df372;_0x180674[_0x85da('0x3f')]=_['keys'](db[_0x85da('0x98')][_0x85da('0x4c')]);_0x180674['query']=_['keys'](_0x55924a[_0x85da('0x3b')]);_0x180674['filters']=_[_0x85da('0x3e')](_0x180674[_0x85da('0x3f')],_0x180674['query']);_0x207b3e[_0x85da('0x40')]=_['intersection'](_0x180674['model'],qs[_0x85da('0x41')](_0x55924a[_0x85da('0x3b')][_0x85da('0x41')]));_0x207b3e['attributes']=_0x207b3e[_0x85da('0x40')][_0x85da('0x42')]?_0x207b3e['attributes']:_0x180674[_0x85da('0x3f')];_0x207b3e['order']=qs[_0x85da('0x43')](_0x55924a['query'][_0x85da('0x43')]);_0x207b3e[_0x85da('0x44')]=qs[_0x85da('0x3d')](_[_0x85da('0x45')](_0x55924a[_0x85da('0x3b')],_0x180674[_0x85da('0x3d')]));if(_0x55924a[_0x85da('0x3b')][_0x85da('0x2e')]){_0x207b3e['where']=_[_0x85da('0x47')](_0x207b3e[_0x85da('0x44')],{'$or':_[_0x85da('0x30')](_0x207b3e[_0x85da('0x40')],function(_0x4fc3a5){var _0x1ef426={};_0x1ef426[_0x4fc3a5]={'$like':'%'+_0x55924a[_0x85da('0x3b')]['filter']+'%'};return _0x1ef426;})});}_0x207b3e=_[_0x85da('0x47')]({},_0x207b3e,_0x55924a[_0x85da('0x48')]);return _0x2000db[_0x85da('0x99')](_0x207b3e);}})['then'](function(_0x13c16f){if(_0x13c16f){_0x1412a8=_0x13c16f[_0x85da('0x42')];if(!_0x55924a['query'][_0x85da('0x5c')](_0x85da('0x5d'))){_0x207b3e['limit']=qs[_0x85da('0x21')](_0x55924a[_0x85da('0x3b')][_0x85da('0x21')]);_0x207b3e['offset']=qs[_0x85da('0x20')](_0x55924a['query'][_0x85da('0x20')]);}return _0x2000db[_0x85da('0x99')](_0x207b3e);}})[_0x85da('0x28')](function(_0x438bb7){if(_0x438bb7){return _0x438bb7?{'count':_0x1412a8,'rows':_0x438bb7}:null;}})[_0x85da('0x28')](respondWithResult(_0x1d1dd5,null))['catch'](handleError(_0x1d1dd5,null));};exports[_0x85da('0x9a')]=function(_0x2aeae7,_0x1ec1e7,_0x5b3a5c){var _0xb85c82,_0x14cf8b;return db[_0x85da('0x39')][_0x85da('0x33')]({'where':{'id':_0x2aeae7['params']['id']}})[_0x85da('0x28')](handleEntityNotFound(_0x1ec1e7,null))[_0x85da('0x28')](function(_0x2b9330){if(_0x2b9330){_0x14cf8b=_0x2b9330;return _0x2b9330[_0x85da('0x9a')](_0x2aeae7[_0x85da('0x50')][_0x85da('0x7c')],_[_0x85da('0x57')](_0x2aeae7[_0x85da('0x50')],[_0x85da('0x7c'),'id'])||{});}return null;})['spread'](function(_0x202396){var _0x405468;_0xb85c82=_0x202396||[];var _0x545385=[];if(_0x202396){for(var _0x1dacee=0x0;_0x1dacee<_0x202396[_0x85da('0x42')];_0x1dacee+=0x1){var _0x4281aa=_0x202396[_0x1dacee][_0x85da('0x52')]({'plain':!![]});_0x14cf8b['dialCheckDuplicateType']=_0x2aeae7['body']['dialCheckDuplicateType']?_0x2aeae7['body'][_0x85da('0x9b')]:_0x14cf8b[_0x85da('0x9b')];switch(_0x14cf8b['dialCheckDuplicateType']){case _0x85da('0x9c'):_0x405468=squel[_0x85da('0x9d')]()['into'](_0x85da('0x9e'))[_0x85da('0x9f')]([_0x85da('0xa0'),_0x85da('0xa1'),'ContactId',_0x85da('0xa2'),'VoiceQueueId','createdAt',_0x85da('0xa3')],squel[_0x85da('0xa4')]()[_0x85da('0x7d')]('phone','phone')[_0x85da('0x7d')](_0x85da('0xa5'),'scheduledAt')[_0x85da('0x7d')]('id',_0x85da('0xa6'))[_0x85da('0x7d')](_0x4281aa[_0x85da('0xa7')][_0x85da('0x86')](),_0x85da('0xa2'))[_0x85da('0x7d')](_0x2aeae7[_0x85da('0x4b')]['id'][_0x85da('0x86')](),'VoiceQueueId')[_0x85da('0x7d')](_0x85da('0xa5'),_0x85da('0xa8'))[_0x85da('0x7d')](_0x85da('0xa5'),'updatedAt')[_0x85da('0x7e')](_0x85da('0xa9'))[_0x85da('0x44')](_0x85da('0xaa'))[_0x85da('0x44')](_0x85da('0xab'),_0x4281aa[_0x85da('0xa7')][_0x85da('0x86')]())[_0x85da('0x44')](_0x85da('0xac'))['where'](_0x85da('0xad'),squel['select']()[_0x85da('0x7d')](_0x85da('0xae'))[_0x85da('0x7e')](_0x85da('0xaf'))[_0x85da('0x44')](_0x85da('0x83'),_0x2aeae7[_0x85da('0x4b')]['id'][_0x85da('0x86')]()))[_0x85da('0x44')](_0x85da('0xad'),squel[_0x85da('0xa4')]()[_0x85da('0x7d')]('COALESCE(phone,\x27\x27)')['from'](_0x85da('0x9e'))[_0x85da('0x44')](_0x85da('0x83'),_0x2aeae7['params']['id']['toString']())))[_0x85da('0x86')]();break;case'onlyIfOpen':_0x405468=squel['insert']()[_0x85da('0xb0')](_0x85da('0x9e'))[_0x85da('0x9f')]([_0x85da('0xa0'),_0x85da('0xa1'),_0x85da('0xa6'),_0x85da('0xa2'),_0x85da('0x5f'),_0x85da('0xa8'),_0x85da('0xa3')],squel[_0x85da('0xa4')]()['field']('phone','phone')[_0x85da('0x7d')](_0x85da('0xa5'),'scheduledAt')['field']('id','ContactId')['field'](_0x4281aa['CmListId']['toString'](),_0x85da('0xa2'))['field'](_0x2aeae7[_0x85da('0x4b')]['id']['toString'](),_0x85da('0x5f'))['field'](_0x85da('0xa5'),_0x85da('0xa8'))[_0x85da('0x7d')](_0x85da('0xa5'),_0x85da('0xa3'))['from'](_0x85da('0xa9'))['where'](_0x85da('0xaa'))[_0x85da('0x44')](_0x85da('0xab'),_0x4281aa[_0x85da('0xa7')][_0x85da('0x86')]())[_0x85da('0x44')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x85da('0xad'),squel[_0x85da('0xa4')]()['field'](_0x85da('0xb1'))['from'](_0x85da('0x9e'))[_0x85da('0x44')](_0x85da('0x83'),_0x2aeae7[_0x85da('0x4b')]['id'][_0x85da('0x86')]())))[_0x85da('0x86')]();break;default:_0x405468=squel[_0x85da('0x9d')]()[_0x85da('0xb0')](_0x85da('0x9e'))[_0x85da('0x9f')]([_0x85da('0xa0'),'scheduledAt',_0x85da('0xa6'),_0x85da('0xa2'),_0x85da('0x5f'),'createdAt',_0x85da('0xa3')],squel[_0x85da('0xa4')]()['field']('phone',_0x85da('0xa0'))[_0x85da('0x7d')](_0x85da('0xa5'),'scheduledAt')[_0x85da('0x7d')]('id',_0x85da('0xa6'))[_0x85da('0x7d')](_0x4281aa[_0x85da('0xa7')]['toString'](),_0x85da('0xa2'))[_0x85da('0x7d')](_0x2aeae7[_0x85da('0x4b')]['id'][_0x85da('0x86')](),_0x85da('0x5f'))[_0x85da('0x7d')](_0x85da('0xa5'),_0x85da('0xa8'))[_0x85da('0x7d')](_0x85da('0xa5'),'updatedAt')['from'](_0x85da('0xa9'))[_0x85da('0x44')](_0x85da('0xaa'))[_0x85da('0x44')](_0x85da('0xab'),_0x4281aa[_0x85da('0xa7')][_0x85da('0x86')]())[_0x85da('0x44')]('phone\x20IS\x20NOT\x20NULL'))[_0x85da('0x86')]();}_0x545385[_0x85da('0x85')](db['sequelize'][_0x85da('0x3b')](_0x405468));}return BPromise[_0x85da('0x8b')](_0x545385);}})['then'](function(){return _0xb85c82;})[_0x85da('0x28')](respondWithResult(_0x1ec1e7,null))[_0x85da('0x58')](handleError(_0x1ec1e7,null));};exports[_0x85da('0xb2')]=function(_0x532bc9,_0x44a285,_0x2cf0c8){return db[_0x85da('0x39')][_0x85da('0x33')]({'where':{'id':_0x532bc9['params']['id']}})[_0x85da('0x28')](handleEntityNotFound(_0x44a285,null))['then'](function(_0xb92395){if(_0xb92395){return _0xb92395[_0x85da('0xb2')](_0x532bc9[_0x85da('0x3b')][_0x85da('0x7c')]);}})['then'](function(_0x1ee068){if(_0x1ee068){return db[_0x85da('0x5b')][_0x85da('0x29')]({'where':{'ListId':_0x532bc9[_0x85da('0x3b')][_0x85da('0x7c')],'VoiceQueueId':_0x532bc9[_0x85da('0x4b')]['id']}})[_0x85da('0x28')](function(){return _0x1ee068;});}})['then'](respondWithStatusCode(_0x44a285,null))[_0x85da('0x58')](handleError(_0x44a285,null));};exports['getBlackLists']=function(_0x2b2137,_0x56ffa1,_0x4d4eb8){var _0x247eac={};var _0x57395b={};var _0x28e454;var _0x5d3d2d;return db[_0x85da('0x39')][_0x85da('0x5a')]({'where':{'id':_0x2b2137[_0x85da('0x4b')]['id']}})[_0x85da('0x28')](handleEntityNotFound(_0x56ffa1,null))['then'](function(_0x4bd3e3){if(_0x4bd3e3){_0x28e454=_0x4bd3e3;_0x57395b['model']=_[_0x85da('0x3c')](db[_0x85da('0x98')]['rawAttributes']);_0x57395b[_0x85da('0x3b')]=_[_0x85da('0x3c')](_0x2b2137['query']);_0x57395b[_0x85da('0x3d')]=_[_0x85da('0x3e')](_0x57395b[_0x85da('0x3f')],_0x57395b[_0x85da('0x3b')]);_0x247eac['attributes']=_[_0x85da('0x3e')](_0x57395b[_0x85da('0x3f')],qs[_0x85da('0x41')](_0x2b2137['query'][_0x85da('0x41')]));_0x247eac[_0x85da('0x40')]=_0x247eac[_0x85da('0x40')]['length']?_0x247eac[_0x85da('0x40')]:_0x57395b[_0x85da('0x3f')];_0x247eac[_0x85da('0x5e')]=qs['sort'](_0x2b2137[_0x85da('0x3b')]['sort']);_0x247eac[_0x85da('0x44')]=qs[_0x85da('0x3d')](_['pick'](_0x2b2137[_0x85da('0x3b')],_0x57395b[_0x85da('0x3d')]));if(_0x2b2137[_0x85da('0x3b')][_0x85da('0x2e')]){_0x247eac[_0x85da('0x44')]=_[_0x85da('0x47')](_0x247eac[_0x85da('0x44')],{'$or':_[_0x85da('0x30')](_0x247eac['attributes'],function(_0x28841c){var _0x263ec8={};_0x263ec8[_0x28841c]={'$like':'%'+_0x2b2137[_0x85da('0x3b')][_0x85da('0x2e')]+'%'};return _0x263ec8;})});}_0x247eac=_[_0x85da('0x47')]({},_0x247eac,_0x2b2137['options']);return _0x28e454[_0x85da('0xb3')](_0x247eac);}})['then'](function(_0x4b63fa){if(_0x4b63fa){_0x5d3d2d=_0x4b63fa[_0x85da('0x42')];if(!_0x2b2137[_0x85da('0x3b')][_0x85da('0x5c')]('nolimit')){_0x247eac[_0x85da('0x21')]=qs[_0x85da('0x21')](_0x2b2137['query'][_0x85da('0x21')]);_0x247eac[_0x85da('0x20')]=qs[_0x85da('0x20')](_0x2b2137[_0x85da('0x3b')][_0x85da('0x20')]);}return _0x28e454[_0x85da('0xb3')](_0x247eac);}})['then'](function(_0x5e3efd){if(_0x5e3efd){return _0x5e3efd?{'count':_0x5d3d2d,'rows':_0x5e3efd}:null;}})[_0x85da('0x28')](respondWithResult(_0x56ffa1,null))[_0x85da('0x58')](handleError(_0x56ffa1,null));};exports['addBlackLists']=function(_0x58d927,_0xdf8d71,_0x131c70){var _0x43cb1d,_0x528cf6;return db[_0x85da('0x39')][_0x85da('0x33')]({'where':{'id':_0x58d927[_0x85da('0x4b')]['id']}})[_0x85da('0x28')](handleEntityNotFound(_0xdf8d71,null))[_0x85da('0x28')](function(_0x43c551){if(_0x43c551){_0x528cf6=_0x43c551;return _0x43c551[_0x85da('0xb4')](_0x58d927[_0x85da('0x50')][_0x85da('0x7c')],_['omit'](_0x58d927[_0x85da('0x50')],[_0x85da('0x7c'),'id'])||{});}return null;})['spread'](function(_0x2fc30c){var _0x1dc7ee;_0x43cb1d=_0x2fc30c||[];var _0x16b514=[];if(_0x2fc30c){for(var _0xc53e8b=0x0;_0xc53e8b<_0x2fc30c[_0x85da('0x42')];_0xc53e8b+=0x1){var _0x16c7e2=_0x2fc30c[_0xc53e8b]['get']({'plain':!![]});_0x1dc7ee=squel[_0x85da('0x9d')]()[_0x85da('0xb0')](_0x85da('0xb5'))[_0x85da('0x9f')]([_0x85da('0xa0'),_0x85da('0xa6'),_0x85da('0xa2'),'VoiceQueueId','createdAt',_0x85da('0xa3')],squel[_0x85da('0xa4')]()[_0x85da('0x7d')](_0x85da('0xa0'),'phone')['field']('id','ContactId')[_0x85da('0x7d')](_0x16c7e2[_0x85da('0xa7')][_0x85da('0x86')](),'ListId')['field'](_0x58d927[_0x85da('0x4b')]['id'][_0x85da('0x86')](),'VoiceQueueId')[_0x85da('0x7d')]('NOW()','createdAt')[_0x85da('0x7d')](_0x85da('0xa5'),_0x85da('0xa3'))[_0x85da('0x7e')]('cm_contacts')[_0x85da('0x44')](_0x85da('0xaa'))['where']('ListId\x20=\x20?',_0x16c7e2['CmListId'][_0x85da('0x86')]())[_0x85da('0x44')]('phone\x20IS\x20NOT\x20NULL'))[_0x85da('0x86')]();_0x16b514['push'](db['sequelize'][_0x85da('0x3b')](_0x1dc7ee));}return BPromise['all'](_0x16b514);}})['then'](function(){return _0x43cb1d;})[_0x85da('0x28')](respondWithResult(_0xdf8d71,null))[_0x85da('0x58')](handleError(_0xdf8d71,null));};exports[_0x85da('0xb6')]=function(_0x5ab6e6,_0x4d9101,_0x1080b4){return db[_0x85da('0x39')][_0x85da('0x33')]({'where':{'id':_0x5ab6e6['params']['id']}})[_0x85da('0x28')](handleEntityNotFound(_0x4d9101,null))['then'](function(_0x5d9095){if(_0x5d9095){return _0x5d9095['removeBlackLists'](_0x5ab6e6[_0x85da('0x3b')][_0x85da('0x7c')]);}})[_0x85da('0x28')](function(_0x5e57d3){if(_0x5e57d3){return db[_0x85da('0x64')][_0x85da('0x29')]({'where':{'ListId':_0x5ab6e6[_0x85da('0x3b')][_0x85da('0x7c')],'VoiceQueueId':_0x5ab6e6[_0x85da('0x4b')]['id']}})[_0x85da('0x28')](function(){return _0x5e57d3;});}})[_0x85da('0x28')](respondWithStatusCode(_0x4d9101,null))[_0x85da('0x58')](handleError(_0x4d9101,null));}; \ No newline at end of file +var _0x775f=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','hasOwnProperty','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','voicePause','interface','flatMap','penalty','sequelize','transaction','each','TeamVoiceQueue','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','ids','select','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','QueryTypes','every','TeamId','all','union','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','online','format','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','fromQuery','scheduledAt','field','phone','NOW()','ContactId','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','into','ListId','removeLists','getBlackLists','addBlackLists','spread','insert','cm_hopper_black','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','defaults','redis','register','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','inbound','QueueCampaigns','outbound','filter','map','value','includes','type','find','name','UserProfileResource','sendStatus','error','stack','send','index','VoiceQueue','rawAttributes','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues'];(function(_0x109b5a,_0x2a2910){var _0x56a07b=function(_0x28264e){while(--_0x28264e){_0x109b5a['push'](_0x109b5a['shift']());}};_0x56a07b(++_0x2a2910);}(_0x775f,0x119));var _0xf775=function(_0x3825a8,_0x2ce1a2){_0x3825a8=_0x3825a8-0x0;var _0xabc9bc=_0x775f[_0x3825a8];return _0xabc9bc;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf775('0x0'));var rp=require(_0xf775('0x1'));var moment=require(_0xf775('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf775('0x3'));var util=require(_0xf775('0x4'));var path=require(_0xf775('0x5'));var sox=require(_0xf775('0x6'));var csv=require(_0xf775('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xf775('0x8'));var crypto=require(_0xf775('0x9'));var jsforce=require(_0xf775('0xa'));var deskjs=require(_0xf775('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf775('0xc'));var Papa=require(_0xf775('0xd'));var Redis=require(_0xf775('0xe'));var authService=require(_0xf775('0xf'));var qs=require(_0xf775('0x10'));var as=require(_0xf775('0x11'));var hardwareService=require(_0xf775('0x12'));var logger=require(_0xf775('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf775('0x14'));var db=require(_0xf775('0x15'))['db'];config['redis']=_[_0xf775('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf775('0x17')]));require('./voiceQueue.socket')[_0xf775('0x18')](socket);function respondWithStatusCode(_0xc86ad8,_0x3dd1d3){_0x3dd1d3=_0x3dd1d3||0xcc;return function(_0x5133aa){if(_0x5133aa){return _0xc86ad8['sendStatus'](_0x3dd1d3);}return _0xc86ad8[_0xf775('0x19')](_0x3dd1d3)[_0xf775('0x1a')]();};}function respondWithResult(_0x1f4934,_0x1018a2){_0x1018a2=_0x1018a2||0xc8;return function(_0x598cb3){if(_0x598cb3){return _0x1f4934['status'](_0x1018a2)[_0xf775('0x1b')](_0x598cb3);}};}function respondWithFilteredResult(_0x398fc5,_0x4cc5ad){return function(_0x160d6e){if(_0x160d6e){var _0x5d32b5=_0x160d6e[_0xf775('0x1c')],_0x59d46b=_0x4cc5ad[_0xf775('0x1d')],_0x4feaf1=_0x4cc5ad['offset']+_0x4cc5ad[_0xf775('0x1e')],_0x151f8f;if(_0x4feaf1>=_0x5d32b5){_0x4feaf1=_0x5d32b5;_0x151f8f=0xc8;}else{_0x151f8f=0xce;}_0x398fc5['status'](_0x151f8f);return _0x398fc5[_0xf775('0x1f')](_0xf775('0x20'),_0x59d46b+'-'+_0x4feaf1+'/'+_0x5d32b5)['json'](_0x160d6e);}return null;};}function patchUpdates(_0x1a42e7){return function(_0x1ad88d){try{jsonpatch[_0xf775('0x21')](_0x1ad88d,_0x1a42e7,!![]);}catch(_0x344b57){return BPromise[_0xf775('0x22')](_0x344b57);}return _0x1ad88d[_0xf775('0x23')]();};}function saveUpdates(_0xf40090,_0x4b464e){return function(_0xd94592){if(_0xd94592){return _0xd94592[_0xf775('0x24')](_0xf40090)[_0xf775('0x25')](function(_0x294ea3){return _0x294ea3;});}return null;};}function removeEntity(_0x3c4ff4,_0xddf005){return function(_0x94dc2d){if(_0x94dc2d){return _0x94dc2d[_0xf775('0x26')]()[_0xf775('0x25')](function(){var _0x13a563=_0x94dc2d[_0xf775('0x27')]({'plain':!![]});var _0xf95536=[{'name':'VoiceQueues','value':_0xf775('0x28'),'ignore':![]},{'name':_0xf775('0x29'),'value':_0xf775('0x2a'),'ignore':![]}];var _0x171a7e=_(_0xf95536)[_0xf775('0x2b')]('ignore')[_0xf775('0x2c')](_0xf775('0x2d'))['value']();if(_[_0xf775('0x2e')](_0x171a7e,_0x13a563[_0xf775('0x2f')])){return;}var _0x1f63bf=_[_0xf775('0x30')](_0xf95536,[_0xf775('0x2d'),_0x13a563['type']])[_0xf775('0x31')];return db[_0xf775('0x32')][_0xf775('0x26')]({'where':{'type':_0x1f63bf,'resourceId':_0x13a563['id']}})[_0xf775('0x25')](function(){return _0x94dc2d;});})[_0xf775('0x25')](function(){_0x3c4ff4[_0xf775('0x19')](0xcc)[_0xf775('0x1a')]();});}};}function handleEntityNotFound(_0x5eca8,_0x220d1e){return function(_0x19a9b6){if(!_0x19a9b6){_0x5eca8[_0xf775('0x33')](0x194);}return _0x19a9b6;};}function handleError(_0x565c1b,_0xbfc863){_0xbfc863=_0xbfc863||0x1f4;return function(_0x5e9fef){logger[_0xf775('0x34')](_0x5e9fef[_0xf775('0x35')]);if(_0x5e9fef[_0xf775('0x31')]){delete _0x5e9fef['name'];}_0x565c1b['status'](_0xbfc863)[_0xf775('0x36')](_0x5e9fef);};}exports[_0xf775('0x37')]=function(_0x3e6168,_0x586e8e){var _0x1e6111={},_0x532b0a={},_0x2f0797={'count':0x0,'rows':[]};var _0x4a090a=_[_0xf775('0x2c')](db[_0xf775('0x38')][_0xf775('0x39')],function(_0x92ed8e){return{'name':_0x92ed8e['fieldName'],'type':_0x92ed8e[_0xf775('0x2f')]['key']};});_0x532b0a[_0xf775('0x3a')]=_['map'](_0x4a090a,'name');_0x532b0a[_0xf775('0x3b')]=_[_0xf775('0x3c')](_0x3e6168[_0xf775('0x3b')]);_0x532b0a[_0xf775('0x3d')]=_['intersection'](_0x532b0a[_0xf775('0x3a')],_0x532b0a[_0xf775('0x3b')]);_0x1e6111[_0xf775('0x3e')]=_[_0xf775('0x3f')](_0x532b0a[_0xf775('0x3a')],qs[_0xf775('0x40')](_0x3e6168[_0xf775('0x3b')][_0xf775('0x40')]));_0x1e6111[_0xf775('0x3e')]=_0x1e6111['attributes'][_0xf775('0x41')]?_0x1e6111[_0xf775('0x3e')]:_0x532b0a['model'];if(!_0x3e6168[_0xf775('0x3b')]['hasOwnProperty'](_0xf775('0x42'))){_0x1e6111[_0xf775('0x1e')]=qs[_0xf775('0x1e')](_0x3e6168['query'][_0xf775('0x1e')]);_0x1e6111[_0xf775('0x1d')]=qs['offset'](_0x3e6168[_0xf775('0x3b')][_0xf775('0x1d')]);}_0x1e6111[_0xf775('0x43')]=qs[_0xf775('0x44')](_0x3e6168['query'][_0xf775('0x44')]);_0x1e6111[_0xf775('0x45')]=qs['filters'](_[_0xf775('0x46')](_0x3e6168[_0xf775('0x3b')],_0x532b0a[_0xf775('0x3d')]),_0x4a090a);if(_0x3e6168[_0xf775('0x3b')]['filter']){_0x1e6111[_0xf775('0x45')]=_[_0xf775('0x47')](_0x1e6111[_0xf775('0x45')],{'$or':_[_0xf775('0x2c')](_0x4a090a,function(_0x5ec966){if(_0x5ec966['type']!==_0xf775('0x48')){var _0x478d98={};_0x478d98[_0x5ec966[_0xf775('0x31')]]={'$like':'%'+_0x3e6168[_0xf775('0x3b')][_0xf775('0x2b')]+'%'};return _0x478d98;}})});}_0x1e6111=_['merge']({},_0x1e6111,_0x3e6168[_0xf775('0x49')]);var _0x533e08={'where':_0x1e6111[_0xf775('0x45')]};return db['VoiceQueue']['count'](_0x533e08)['then'](function(_0x2bdc61){_0x2f0797[_0xf775('0x1c')]=_0x2bdc61;if(_0x3e6168[_0xf775('0x3b')][_0xf775('0x4a')]){_0x1e6111[_0xf775('0x4b')]=[{'all':!![]}];}return db[_0xf775('0x38')][_0xf775('0x4c')](_0x1e6111);})[_0xf775('0x25')](function(_0x70cd2e){_0x2f0797[_0xf775('0x4d')]=_0x70cd2e;return _0x2f0797;})['then'](respondWithFilteredResult(_0x586e8e,_0x1e6111))[_0xf775('0x4e')](handleError(_0x586e8e,null));};exports[_0xf775('0x4f')]=function(_0x213cec,_0x2fa0c3){var _0x75811={'raw':![],'where':{'id':_0x213cec[_0xf775('0x50')]['id']}},_0x13e252={};_0x13e252[_0xf775('0x3a')]=_['keys'](db[_0xf775('0x38')][_0xf775('0x39')]);_0x13e252[_0xf775('0x3b')]=_[_0xf775('0x3c')](_0x213cec[_0xf775('0x3b')]);_0x13e252[_0xf775('0x3d')]=_['intersection'](_0x13e252[_0xf775('0x3a')],_0x13e252['query']);_0x75811['attributes']=_['intersection'](_0x13e252[_0xf775('0x3a')],qs[_0xf775('0x40')](_0x213cec[_0xf775('0x3b')][_0xf775('0x40')]));_0x75811[_0xf775('0x3e')]=_0x75811[_0xf775('0x3e')][_0xf775('0x41')]?_0x75811[_0xf775('0x3e')]:_0x13e252['model'];if(_0x213cec[_0xf775('0x3b')][_0xf775('0x4a')]){_0x75811['include']=[{'all':!![]}];}_0x75811=_[_0xf775('0x47')]({},_0x75811,_0x213cec[_0xf775('0x49')]);return db['VoiceQueue']['find'](_0x75811)['then'](handleEntityNotFound(_0x2fa0c3,null))[_0xf775('0x25')](respondWithResult(_0x2fa0c3,null))[_0xf775('0x4e')](handleError(_0x2fa0c3,null));};exports[_0xf775('0x51')]=function(_0x966474,_0x171364){return db[_0xf775('0x38')][_0xf775('0x51')](_0x966474[_0xf775('0x52')],{})[_0xf775('0x25')](function(_0x118d6f){var _0x157f12=_0x966474[_0xf775('0x53')][_0xf775('0x27')]({'plain':!![]});if(!_0x157f12)throw new Error(_0xf775('0x54'));if(_0x157f12[_0xf775('0x55')]===_0xf775('0x53')){var _0x3dc8ac=_0x118d6f[_0xf775('0x27')]({'plain':!![]});var _0x1d9795=[{'name':_0xf775('0x56'),'value':_0xf775('0x28')},{'name':_0xf775('0x29'),'value':'outbound'}];var _0x196fb5=_[_0xf775('0x30')](_0x1d9795,[_0xf775('0x2d'),_0x3dc8ac['type']])[_0xf775('0x31')];return db[_0xf775('0x57')]['find']({'where':{'name':_0x196fb5,'userProfileId':_0x157f12[_0xf775('0x58')]},'raw':!![]})[_0xf775('0x25')](function(_0x5d6616){if(_0x5d6616&&_0x5d6616[_0xf775('0x59')]===0x0){return db[_0xf775('0x32')]['create']({'name':_0x3dc8ac[_0xf775('0x31')],'resourceId':_0x3dc8ac['id'],'type':_0x5d6616[_0xf775('0x31')],'sectionId':_0x5d6616['id']},{})[_0xf775('0x25')](function(){return _0x118d6f;});}else{return _0x118d6f;}})[_0xf775('0x4e')](function(_0x1c90f4){logger['error'](_0xf775('0x5a'),_0x1c90f4);throw _0x1c90f4;});}return _0x118d6f;})['then'](respondWithResult(_0x171364,0xc9))[_0xf775('0x4e')](handleError(_0x171364,null));};exports[_0xf775('0x5b')]=function(_0x3154a2,_0x5941f1){var _0x236726={'where':{'id':_0x3154a2['params']['id']}},_0x3a7ace={};_0x3a7ace[_0xf775('0x3a')]=_['keys'](db[_0xf775('0x38')][_0xf775('0x39')]);_0x236726['attributes']=_[_0xf775('0x3f')](_0x3a7ace[_0xf775('0x3a')],qs[_0xf775('0x40')](_0x3154a2['query']['fields']));_0x236726[_0xf775('0x3e')]=_0x236726[_0xf775('0x3e')]['length']?_0x236726['attributes']:_0x3a7ace['model'];if(_0x3154a2[_0xf775('0x3b')]['includeAll']){_0x236726['include']=[{'all':!![]}];}_0x236726=_[_0xf775('0x47')]({},_0x236726,_0x3154a2['options']);return db['VoiceQueue']['find'](_0x236726)[_0xf775('0x25')](handleEntityNotFound(_0x5941f1,null))['then'](function(_0x342377){if(_0x342377){var _0x5ccf55=_0x342377['get']({'plain':!![]});_0x5ccf55=qs[_0xf775('0x5c')](_0x5ccf55,['id',_0xf775('0x5d'),'updatedAt']);_0x3154a2[_0xf775('0x52')]=_[_0xf775('0x5c')](_0x3154a2[_0xf775('0x52')],['id','createdAt',_0xf775('0x5e')]);return db['VoiceQueue']['create'](_[_0xf775('0x47')](_0x5ccf55,_0x3154a2[_0xf775('0x52')]),{'include':_0x3154a2[_0xf775('0x3b')]['includeAll']?[{'all':!![]}]:undefined})[_0xf775('0x25')](function(_0x348bca){var _0x330837=_0x3154a2[_0xf775('0x53')][_0xf775('0x27')]({'plain':!![]});if(!_0x330837)throw new Error(_0xf775('0x54'));if(_0x330837[_0xf775('0x55')]===_0xf775('0x53')){var _0x5c548c=_0x348bca[_0xf775('0x27')]({'plain':!![]});var _0x5e3650=[{'name':_0xf775('0x56'),'value':_0xf775('0x28')},{'name':_0xf775('0x29'),'value':_0xf775('0x2a')}];var _0x42c39a=_[_0xf775('0x30')](_0x5e3650,[_0xf775('0x2d'),_0x5c548c['type']])[_0xf775('0x31')];return db[_0xf775('0x57')][_0xf775('0x30')]({'where':{'name':_0x42c39a,'userProfileId':_0x330837[_0xf775('0x58')]},'raw':!![]})[_0xf775('0x25')](function(_0x509cce){if(_0x509cce&&_0x509cce[_0xf775('0x59')]===0x0){return db[_0xf775('0x32')][_0xf775('0x51')]({'name':_0x5c548c[_0xf775('0x31')],'resourceId':_0x5c548c['id'],'type':_0x509cce[_0xf775('0x31')],'sectionId':_0x509cce['id']},{})[_0xf775('0x25')](function(){return _0x348bca;});}else{return _0x348bca;}})['catch'](function(_0x53bf2e){logger[_0xf775('0x34')](_0xf775('0x5a'),_0x53bf2e);throw _0x53bf2e;});}return _0x348bca;});}})[_0xf775('0x25')](respondWithResult(_0x5941f1,0xc9))[_0xf775('0x4e')](handleError(_0x5941f1,null));};exports['update']=function(_0x711458,_0x487e3c){if(_0x711458[_0xf775('0x52')]['id']){delete _0x711458[_0xf775('0x52')]['id'];}return db[_0xf775('0x38')][_0xf775('0x30')]({'where':{'id':_0x711458[_0xf775('0x50')]['id']}})[_0xf775('0x25')](handleEntityNotFound(_0x487e3c,null))['then'](saveUpdates(_0x711458[_0xf775('0x52')],null))[_0xf775('0x25')](respondWithResult(_0x487e3c,null))['catch'](handleError(_0x487e3c,null));};exports[_0xf775('0x26')]=function(_0x282635,_0x546f99){return db['VoiceQueue'][_0xf775('0x30')]({'where':{'id':_0x282635['params']['id']}})[_0xf775('0x25')](handleEntityNotFound(_0x546f99,null))[_0xf775('0x25')](removeEntity(_0x546f99,null))[_0xf775('0x4e')](handleError(_0x546f99,null));};exports[_0xf775('0x5f')]=function(_0x585d58,_0x5eb2f2,_0x599b45){var _0x4b46a4={'raw':![],'where':{}};var _0x2046bf={};var _0x5f7d6d={'count':0x0,'rows':[]};return db[_0xf775('0x38')][_0xf775('0x60')]({'where':{'id':_0x585d58[_0xf775('0x50')]['id']}})[_0xf775('0x25')](handleEntityNotFound(_0x5eb2f2,null))[_0xf775('0x25')](function(_0x16f472){if(_0x16f472){_0x2046bf[_0xf775('0x3a')]=_[_0xf775('0x3c')](db[_0xf775('0x61')][_0xf775('0x39')]);_0x2046bf[_0xf775('0x3b')]=_[_0xf775('0x3c')](_0x585d58[_0xf775('0x3b')]);_0x2046bf[_0xf775('0x3d')]=_[_0xf775('0x3f')](_0x2046bf[_0xf775('0x3a')],_0x2046bf[_0xf775('0x3b')]);_0x4b46a4[_0xf775('0x3e')]=_[_0xf775('0x3f')](_0x2046bf['model'],qs[_0xf775('0x40')](_0x585d58[_0xf775('0x3b')]['fields']));_0x4b46a4['attributes']=_0x4b46a4[_0xf775('0x3e')][_0xf775('0x41')]?_0x4b46a4[_0xf775('0x3e')]:_0x2046bf[_0xf775('0x3a')];if(!_0x585d58[_0xf775('0x3b')][_0xf775('0x62')](_0xf775('0x42'))){_0x4b46a4[_0xf775('0x1e')]=qs['limit'](_0x585d58['query'][_0xf775('0x1e')]);_0x4b46a4[_0xf775('0x1d')]=qs['offset'](_0x585d58[_0xf775('0x3b')][_0xf775('0x1d')]);}_0x4b46a4[_0xf775('0x43')]=qs[_0xf775('0x44')](_0x585d58[_0xf775('0x3b')][_0xf775('0x44')]);_0x4b46a4[_0xf775('0x45')]=qs[_0xf775('0x3d')](_['pick'](_0x585d58['query'],_0x2046bf[_0xf775('0x3d')]));_0x4b46a4[_0xf775('0x45')]['VoiceQueueId']=_0x16f472['id'];if(_0x585d58[_0xf775('0x3b')]['filter']){_0x4b46a4[_0xf775('0x45')]=_['merge'](_0x4b46a4['where'],{'$or':_[_0xf775('0x2c')](_0x4b46a4[_0xf775('0x3e')],function(_0x193733){var _0x263294={};_0x263294[_0x193733]={'$like':'%'+_0x585d58[_0xf775('0x3b')][_0xf775('0x2b')]+'%'};return _0x263294;})});}_0x4b46a4=_[_0xf775('0x47')]({},_0x4b46a4,_0x585d58[_0xf775('0x49')]);return db[_0xf775('0x61')][_0xf775('0x1c')]({'where':_0x4b46a4[_0xf775('0x45')]})[_0xf775('0x25')](function(_0x3b80d5){_0x5f7d6d[_0xf775('0x1c')]=_0x3b80d5;if(_0x585d58[_0xf775('0x3b')][_0xf775('0x4a')]){_0x4b46a4[_0xf775('0x4b')]=[{'all':!![]}];}return db['CmHopper'][_0xf775('0x4c')](_0x4b46a4);})[_0xf775('0x25')](function(_0x4c0186){_0x5f7d6d[_0xf775('0x4d')]=_0x4c0186;return _0x5f7d6d;});}})['then'](respondWithFilteredResult(_0x5eb2f2,_0x4b46a4))[_0xf775('0x4e')](handleError(_0x5eb2f2,null));};exports[_0xf775('0x63')]=function(_0x375b39,_0x3e28a4,_0x40d0fe){var _0x799cf6={'raw':!![],'where':{}};var _0x313bd9={};var _0x5ea159={'count':0x0,'rows':[]};return db[_0xf775('0x38')]['findOne']({'where':{'id':_0x375b39[_0xf775('0x50')]['id']}})['then'](handleEntityNotFound(_0x3e28a4,null))[_0xf775('0x25')](function(_0x376493){if(_0x376493){_0x313bd9[_0xf775('0x3a')]=_['keys'](db[_0xf775('0x64')][_0xf775('0x39')]);_0x313bd9[_0xf775('0x3b')]=_[_0xf775('0x3c')](_0x375b39['query']);_0x313bd9['filters']=_['intersection'](_0x313bd9[_0xf775('0x3a')],_0x313bd9[_0xf775('0x3b')]);_0x799cf6['attributes']=_[_0xf775('0x3f')](_0x313bd9[_0xf775('0x3a')],qs[_0xf775('0x40')](_0x375b39[_0xf775('0x3b')][_0xf775('0x40')]));_0x799cf6[_0xf775('0x3e')]=_0x799cf6[_0xf775('0x3e')][_0xf775('0x41')]?_0x799cf6[_0xf775('0x3e')]:_0x313bd9[_0xf775('0x3a')];if(!_0x375b39[_0xf775('0x3b')][_0xf775('0x62')](_0xf775('0x42'))){_0x799cf6[_0xf775('0x1e')]=qs[_0xf775('0x1e')](_0x375b39[_0xf775('0x3b')]['limit']);_0x799cf6[_0xf775('0x1d')]=qs['offset'](_0x375b39[_0xf775('0x3b')][_0xf775('0x1d')]);}_0x799cf6[_0xf775('0x43')]=qs[_0xf775('0x44')](_0x375b39['query'][_0xf775('0x44')]);_0x799cf6[_0xf775('0x45')]=qs[_0xf775('0x3d')](_[_0xf775('0x46')](_0x375b39['query'],_0x313bd9['filters']));_0x799cf6[_0xf775('0x45')][_0xf775('0x65')]=_0x376493['id'];if(_0x375b39['query'][_0xf775('0x2b')]){_0x799cf6['where']=_['merge'](_0x799cf6[_0xf775('0x45')],{'$or':_[_0xf775('0x2c')](_0x799cf6[_0xf775('0x3e')],function(_0x491298){var _0x30f412={};_0x30f412[_0x491298]={'$like':'%'+_0x375b39[_0xf775('0x3b')][_0xf775('0x2b')]+'%'};return _0x30f412;})});}_0x799cf6=_[_0xf775('0x47')]({},_0x799cf6,_0x375b39[_0xf775('0x49')]);return db['CmHopperHistory'][_0xf775('0x1c')]({'where':_0x799cf6[_0xf775('0x45')]})[_0xf775('0x25')](function(_0x403f78){_0x5ea159['count']=_0x403f78;if(_0x375b39[_0xf775('0x3b')][_0xf775('0x4a')]){_0x799cf6[_0xf775('0x4b')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xf775('0x4c')](_0x799cf6);})[_0xf775('0x25')](function(_0x5a9c22){_0x5ea159[_0xf775('0x4d')]=_0x5a9c22;return _0x5ea159;});}})['then'](respondWithFilteredResult(_0x3e28a4,_0x799cf6))['catch'](handleError(_0x3e28a4,null));};exports[_0xf775('0x66')]=function(_0x5b9404,_0x57835e,_0x1272c6){var _0x55f461={'raw':!![],'where':{}};var _0x5df210={};var _0x23a445={'count':0x0,'rows':[]};return db[_0xf775('0x38')][_0xf775('0x60')]({'where':{'id':_0x5b9404[_0xf775('0x50')]['id']}})[_0xf775('0x25')](handleEntityNotFound(_0x57835e,null))[_0xf775('0x25')](function(_0x5d2b05){if(_0x5d2b05){_0x5df210[_0xf775('0x3a')]=_['keys'](db[_0xf775('0x67')]['rawAttributes']);_0x5df210['query']=_[_0xf775('0x3c')](_0x5b9404[_0xf775('0x3b')]);_0x5df210[_0xf775('0x3d')]=_['intersection'](_0x5df210[_0xf775('0x3a')],_0x5df210[_0xf775('0x3b')]);_0x55f461[_0xf775('0x3e')]=_[_0xf775('0x3f')](_0x5df210['model'],qs[_0xf775('0x40')](_0x5b9404[_0xf775('0x3b')][_0xf775('0x40')]));_0x55f461[_0xf775('0x3e')]=_0x55f461[_0xf775('0x3e')][_0xf775('0x41')]?_0x55f461[_0xf775('0x3e')]:_0x5df210[_0xf775('0x3a')];if(!_0x5b9404[_0xf775('0x3b')]['hasOwnProperty']('nolimit')){_0x55f461['limit']=qs[_0xf775('0x1e')](_0x5b9404[_0xf775('0x3b')]['limit']);_0x55f461['offset']=qs[_0xf775('0x1d')](_0x5b9404[_0xf775('0x3b')]['offset']);}_0x55f461['order']=qs[_0xf775('0x44')](_0x5b9404['query']['sort']);_0x55f461[_0xf775('0x45')]=qs[_0xf775('0x3d')](_['pick'](_0x5b9404[_0xf775('0x3b')],_0x5df210[_0xf775('0x3d')]));_0x55f461[_0xf775('0x45')][_0xf775('0x65')]=_0x5d2b05['id'];if(_0x5b9404[_0xf775('0x3b')][_0xf775('0x2b')]){_0x55f461['where']=_[_0xf775('0x47')](_0x55f461[_0xf775('0x45')],{'$or':_[_0xf775('0x2c')](_0x55f461[_0xf775('0x3e')],function(_0x359743){var _0x1dc4b8={};_0x1dc4b8[_0x359743]={'$like':'%'+_0x5b9404[_0xf775('0x3b')][_0xf775('0x2b')]+'%'};return _0x1dc4b8;})});}_0x55f461=_[_0xf775('0x47')]({},_0x55f461,_0x5b9404['options']);return db[_0xf775('0x67')][_0xf775('0x1c')]({'where':_0x55f461[_0xf775('0x45')]})['then'](function(_0x5d7ea4){_0x23a445[_0xf775('0x1c')]=_0x5d7ea4;if(_0x5b9404[_0xf775('0x3b')][_0xf775('0x4a')]){_0x55f461[_0xf775('0x4b')]=[{'all':!![]}];}return db[_0xf775('0x67')]['findAll'](_0x55f461);})[_0xf775('0x25')](function(_0x260140){_0x23a445[_0xf775('0x4d')]=_0x260140;return _0x23a445;});}})['then'](respondWithFilteredResult(_0x57835e,_0x55f461))[_0xf775('0x4e')](handleError(_0x57835e,null));};exports[_0xf775('0x68')]=function(_0xa5d109,_0x3cf041,_0x346555){var _0x326022={'raw':!![],'where':{}};var _0xdacad4={};var _0x1e432e={'count':0x0,'rows':[]};return db[_0xf775('0x38')][_0xf775('0x60')]({'where':{'id':_0xa5d109[_0xf775('0x50')]['id']}})[_0xf775('0x25')](handleEntityNotFound(_0x3cf041,null))['then'](function(_0xe80089){if(_0xe80089){_0xdacad4[_0xf775('0x3a')]=_[_0xf775('0x3c')](db[_0xf775('0x69')][_0xf775('0x39')]);_0xdacad4[_0xf775('0x3b')]=_['keys'](_0xa5d109[_0xf775('0x3b')]);_0xdacad4[_0xf775('0x3d')]=_[_0xf775('0x3f')](_0xdacad4[_0xf775('0x3a')],_0xdacad4['query']);_0x326022[_0xf775('0x3e')]=_['intersection'](_0xdacad4[_0xf775('0x3a')],qs[_0xf775('0x40')](_0xa5d109[_0xf775('0x3b')][_0xf775('0x40')]));_0x326022['attributes']=_0x326022[_0xf775('0x3e')][_0xf775('0x41')]?_0x326022[_0xf775('0x3e')]:_0xdacad4[_0xf775('0x3a')];if(!_0xa5d109[_0xf775('0x3b')]['hasOwnProperty'](_0xf775('0x42'))){_0x326022[_0xf775('0x1e')]=qs[_0xf775('0x1e')](_0xa5d109[_0xf775('0x3b')][_0xf775('0x1e')]);_0x326022[_0xf775('0x1d')]=qs['offset'](_0xa5d109[_0xf775('0x3b')][_0xf775('0x1d')]);}_0x326022[_0xf775('0x43')]=qs['sort'](_0xa5d109['query']['sort']);_0x326022['where']=qs[_0xf775('0x3d')](_['pick'](_0xa5d109[_0xf775('0x3b')],_0xdacad4[_0xf775('0x3d')]));_0x326022['where'][_0xf775('0x65')]=_0xe80089['id'];if(_0xa5d109[_0xf775('0x3b')][_0xf775('0x2b')]){_0x326022[_0xf775('0x45')]=_[_0xf775('0x47')](_0x326022[_0xf775('0x45')],{'$or':_[_0xf775('0x2c')](_0x326022[_0xf775('0x3e')],function(_0x10e790){var _0x5ddee3={};_0x5ddee3[_0x10e790]={'$like':'%'+_0xa5d109['query']['filter']+'%'};return _0x5ddee3;})});}_0x326022=_[_0xf775('0x47')]({},_0x326022,_0xa5d109[_0xf775('0x49')]);return db['CmHopperBlack'][_0xf775('0x1c')]({'where':_0x326022[_0xf775('0x45')]})[_0xf775('0x25')](function(_0x41e870){_0x1e432e['count']=_0x41e870;if(_0xa5d109[_0xf775('0x3b')][_0xf775('0x4a')]){_0x326022['include']=[{'all':!![]}];}return db[_0xf775('0x69')][_0xf775('0x4c')](_0x326022);})[_0xf775('0x25')](function(_0x914f2d){_0x1e432e['rows']=_0x914f2d;return _0x1e432e;});}})[_0xf775('0x25')](respondWithFilteredResult(_0x3cf041,_0x326022))[_0xf775('0x4e')](handleError(_0x3cf041,null));};exports[_0xf775('0x6a')]=function(_0x2416a4,_0x216601,_0xc9a99b){var _0x265ae6={};var _0x323ff0={};var _0x2ca77f;var _0x221f45;return db['VoiceQueue']['findOne']({'where':{'id':_0x2416a4[_0xf775('0x50')]['id']}})[_0xf775('0x25')](handleEntityNotFound(_0x216601,null))[_0xf775('0x25')](function(_0xc4cbf9){if(_0xc4cbf9){_0x2ca77f=_0xc4cbf9;_0x323ff0['model']=_[_0xf775('0x3c')](db[_0xf775('0x6b')][_0xf775('0x39')]);_0x323ff0['query']=_[_0xf775('0x3c')](_0x2416a4[_0xf775('0x3b')]);_0x323ff0['filters']=_['intersection'](_0x323ff0[_0xf775('0x3a')],_0x323ff0['query']);_0x265ae6[_0xf775('0x3e')]=_['intersection'](_0x323ff0[_0xf775('0x3a')],qs['fields'](_0x2416a4['query'][_0xf775('0x40')]));_0x265ae6['attributes']=_0x265ae6[_0xf775('0x3e')]['length']?_0x265ae6[_0xf775('0x3e')]:_0x323ff0[_0xf775('0x3a')];_0x265ae6[_0xf775('0x43')]=qs[_0xf775('0x44')](_0x2416a4[_0xf775('0x3b')][_0xf775('0x44')]);_0x265ae6[_0xf775('0x45')]=qs[_0xf775('0x3d')](_[_0xf775('0x46')](_0x2416a4[_0xf775('0x3b')],_0x323ff0[_0xf775('0x3d')]));if(_0x2416a4[_0xf775('0x3b')][_0xf775('0x2b')]){_0x265ae6['where']=_[_0xf775('0x47')](_0x265ae6[_0xf775('0x45')],{'$or':_['map'](_0x265ae6[_0xf775('0x3e')],function(_0x3f3bf7){var _0x3a54c={};_0x3a54c[_0x3f3bf7]={'$like':'%'+_0x2416a4[_0xf775('0x3b')][_0xf775('0x2b')]+'%'};return _0x3a54c;})});}_0x265ae6=_[_0xf775('0x47')]({},_0x265ae6,_0x2416a4[_0xf775('0x49')]);return _0x2ca77f['getTeams'](_0x265ae6);}})[_0xf775('0x25')](function(_0x379183){if(_0x379183){_0x221f45=_0x379183[_0xf775('0x41')];if(!_0x2416a4['query']['hasOwnProperty'](_0xf775('0x42'))){_0x265ae6[_0xf775('0x1e')]=qs[_0xf775('0x1e')](_0x2416a4[_0xf775('0x3b')]['limit']);_0x265ae6[_0xf775('0x1d')]=qs[_0xf775('0x1d')](_0x2416a4['query']['offset']);}return _0x2ca77f[_0xf775('0x6a')](_0x265ae6);}})[_0xf775('0x25')](function(_0x2e66e9){if(_0x2e66e9){return _0x2e66e9?{'count':_0x221f45,'rows':_0x2e66e9}:null;}})[_0xf775('0x25')](respondWithResult(_0x216601,null))[_0xf775('0x4e')](handleError(_0x216601,null));};exports[_0xf775('0x6c')]=function(_0x3b6433,_0x4cfb5c,_0x2c9ecd){var _0x13e4b5=_0x3b6433['body'][_0xf775('0x6d')];var _0x39f2da=_[_0xf775('0x2c')](_0x13e4b5,'id');return db[_0xf775('0x6b')][_0xf775('0x4c')]({'where':{'id':_0x39f2da},'attributes':['id'],'include':[{'model':db[_0xf775('0x6e')],'as':_0xf775('0x6f'),'attributes':['id',_0xf775('0x31'),'online',_0xf775('0x70'),_0xf775('0x71')],'raw':!![]}]})[_0xf775('0x25')](function(_0x48158b){if(_0x48158b){var _0x1e8e37=_[_0xf775('0x72')](_0x48158b,function(_0x3bb265){var _0x1ae850=_0x3bb265[_0xf775('0x27')]({'plain':!![]});_0x1ae850['Agents']['forEach'](function(_0x13b38f){_0x13b38f['penalty']=_[_0xf775('0x30')](_0x13e4b5,{'id':_0x1ae850['id']})[_0xf775('0x73')];});return _0x1ae850[_0xf775('0x6f')];});return db[_0xf775('0x38')][_0xf775('0x30')]({'where':{'id':_0x3b6433[_0xf775('0x50')]['id']}})[_0xf775('0x25')](function(_0x43741){return db[_0xf775('0x74')][_0xf775('0x75')](function(_0xcc65b8){return _0x43741['addTeams'](_0x39f2da,{'transaction':_0xcc65b8})[_0xf775('0x25')](function(){return BPromise[_0xf775('0x76')](_0x13e4b5,function(_0x3e336f){return db[_0xf775('0x77')]['upsert']({'TeamId':_0x3e336f['id'],'VoiceQueueId':_0x3b6433[_0xf775('0x50')]['id'],'penalty':_0x3e336f[_0xf775('0x73')]},{'transaction':_0xcc65b8});});})[_0xf775('0x25')](function(){return BPromise['each'](_0x1e8e37,function(_0x14598a){return db[_0xf775('0x78')][_0xf775('0x79')]({'where':{'UserId':_0x14598a['id'],'VoiceQueueId':_0x3b6433[_0xf775('0x50')]['id']},'defaults':{'penalty':_0x14598a['penalty']},'transaction':_0xcc65b8});});})[_0xf775('0x25')](function(){return BPromise[_0xf775('0x76')](_['filter'](_0x1e8e37,{'online':!![]}),function(_0x31ae88){return db[_0xf775('0x7a')][_0xf775('0x7b')]({'membername':_0x31ae88[_0xf775('0x31')],'UserId':_0x31ae88['id'],'queue_name':_0x43741[_0xf775('0x31')],'VoiceQueueId':_0x43741['id'],'interface':_[_0xf775('0x7c')](_0x31ae88[_0xf775('0x71')])?util['format'](_0xf775('0x7d'),_0x31ae88[_0xf775('0x31')]):_0x31ae88[_0xf775('0x71')],'paused':_0x31ae88[_0xf775('0x70')]||![],'penalty':_0x31ae88[_0xf775('0x73')]},{'transaction':_0xcc65b8});});})[_0xf775('0x25')](function(){_0x1e8e37[_0xf775('0x7e')](function(_0x19377f){socket[_0xf775('0x7f')](_0xf775('0x80'),{'UserId':_0x19377f['id'],'VoiceQueueId':_0x43741['id']});});});});});}})['then'](respondWithStatusCode(_0x4cfb5c,null))[_0xf775('0x4e')](handleError(_0x4cfb5c,null));};exports[_0xf775('0x81')]=function(_0x197741,_0x4c3a14,_0x364f88){return db['Team']['findAll']({'where':{'id':_0x197741[_0xf775('0x3b')][_0xf775('0x82')]},'attributes':['id'],'include':[{'model':db[_0xf775('0x6e')],'as':_0xf775('0x6f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4c3a14,null))[_0xf775('0x25')](function(_0x544216){var _0x17e14a=_[_0xf775('0x2c')](_0x544216,'id');var _0x4e2f5e=[];var _0x3f9b13=[];var _0x8d849f=squel[_0xf775('0x83')]();_0x8d849f['field'](_0xf775('0x84'))[_0xf775('0x85')](_0xf775('0x86'),'tq')[_0xf775('0x87')](_0xf775('0x88'),'ut',_0xf775('0x89'))['where'](_0xf775('0x8a'),_0x197741['params']['id']);for(var _0x34fa68=0x0;_0x34fa68<_0x544216['length'];_0x34fa68+=0x1){let _0xaa2e2=_0x544216[_0x34fa68];for(var _0x3b03c7=0x0;_0x3b03c7<_0xaa2e2['Agents']['length'];_0x3b03c7+=0x1){let _0x1b46b9=_0xaa2e2[_0xf775('0x6f')][_0x3b03c7];var _0x24ea17=_0x8d849f['clone']();_0x24ea17[_0xf775('0x45')]('ut.UserId\x20=\x20?',_0x1b46b9['id']);_0x3f9b13[_0xf775('0x8b')](db['sequelize'][_0xf775('0x3b')](_0x24ea17['toString'](),{'type':db[_0xf775('0x74')][_0xf775('0x8c')]['SELECT']})[_0xf775('0x25')](function(_0x1d16d0){if(_0x1d16d0['length']===0x1){return _0x1b46b9['id'];}else{var _0x4de619=_[_0xf775('0x8d')](_[_0xf775('0x2c')](_0x1d16d0,_0xf775('0x8e')),function(_0x4fb361){return _[_0xf775('0x2e')](_0x17e14a,_0x4fb361);});if(_0x4de619){return _0x1b46b9['id'];}}}));}}return BPromise[_0xf775('0x8f')](_0x3f9b13)[_0xf775('0x25')](function(_0x587660){_0x4e2f5e=_(_0x4e2f5e)[_0xf775('0x90')](_0x587660)['compact']()[_0xf775('0x2d')]();return db[_0xf775('0x38')]['find']({'where':{'id':_0x197741[_0xf775('0x50')]['id']}})['then'](function(_0x3b2a28){return db[_0xf775('0x74')][_0xf775('0x75')](function(_0x4d5893){return _0x3b2a28['removeTeams'](_0x197741[_0xf775('0x3b')][_0xf775('0x82')],{'transaction':_0x4d5893})[_0xf775('0x25')](function(){if(!_[_0xf775('0x91')](_0x4e2f5e)){return _0x3b2a28[_0xf775('0x92')](_0x4e2f5e,{'transaction':_0x4d5893})['then'](function(){return db[_0xf775('0x7a')][_0xf775('0x26')]({'where':{'VoiceQueueId':_0x197741['params']['id'],'UserId':_0x4e2f5e},'transaction':_0x4d5893});});}})['then'](function(){_0x4e2f5e[_0xf775('0x7e')](function(_0x35a7d9){socket[_0xf775('0x7f')](_0xf775('0x93'),{'UserId':_0x35a7d9,'VoiceQueueId':_0x3b2a28['id']});});});});});});})[_0xf775('0x25')](respondWithStatusCode(_0x4c3a14,null))[_0xf775('0x4e')](handleError(_0x4c3a14,null));};exports[_0xf775('0x94')]=function(_0x427569,_0x2bbf36,_0x1d0bfd){var _0xe13cc9,_0x3e95c1;return db[_0xf775('0x38')][_0xf775('0x30')]({'where':{'id':_0x427569[_0xf775('0x50')]['id']}})['then'](handleEntityNotFound(_0x2bbf36,null))[_0xf775('0x25')](function(_0x27ae19){if(_0x27ae19){_0x3e95c1=_0x27ae19;return _0x27ae19[_0xf775('0x94')](_0x427569[_0xf775('0x52')]['ids'],_[_0xf775('0x5c')](_0x427569['body'],['ids','id'])||{})['spread'](function(_0x56e1b6){for(var _0x52f774=0x0;_0x52f774<_0x427569['body'][_0xf775('0x82')][_0xf775('0x41')];_0x52f774+=0x1){socket['emit'](_0xf775('0x80'),{'UserId':_0x427569[_0xf775('0x52')][_0xf775('0x82')][_0x52f774],'VoiceQueueId':_0x427569['params']['id']});}return _0x56e1b6;});}})['then'](function(_0x3efdbe){_0xe13cc9=_0x3efdbe||[];if(_0x3e95c1){return db[_0xf775('0x6e')]['findAll']({'where':{'id':_0x427569[_0xf775('0x52')][_0xf775('0x82')]},'attributes':['id',_0xf775('0x31'),_0xf775('0x95'),_0xf775('0x70'),_0xf775('0x71')],'raw':!![]});}})[_0xf775('0x25')](function(_0x28b588){if(!_[_0xf775('0x91')](_0x28b588)){var _0x28122a=[];for(var _0x32100f=0x0;_0x32100f<_0x28b588[_0xf775('0x41')];_0x32100f++){if(_0x28b588[_0x32100f]['online']){_0x28122a[_0xf775('0x8b')](db[_0xf775('0x7a')][_0xf775('0x7b')]({'membername':_0x28b588[_0x32100f][_0xf775('0x31')],'UserId':_0x28b588[_0x32100f]['id'],'queue_name':_0x3e95c1[_0xf775('0x31')],'VoiceQueueId':_0x3e95c1['id'],'interface':_[_0xf775('0x7c')](_0x28b588[_0x32100f][_0xf775('0x71')])?util[_0xf775('0x96')](_0xf775('0x7d'),_0x28b588[_0x32100f][_0xf775('0x31')]):_0x28b588[_0x32100f]['interface'],'paused':_0x28b588[_0x32100f][_0xf775('0x70')]||![],'penalty':_0x427569[_0xf775('0x52')][_0xf775('0x73')]||0x0}));}}return BPromise['all'](_0x28122a);}})[_0xf775('0x25')](function(){return _0xe13cc9;})[_0xf775('0x25')](respondWithResult(_0x2bbf36,null))[_0xf775('0x4e')](handleError(_0x2bbf36,null));};exports[_0xf775('0x92')]=function(_0x26f013,_0x1a3c04,_0xc857ca){return db[_0xf775('0x38')][_0xf775('0x30')]({'where':{'id':_0x26f013[_0xf775('0x50')]['id']}})[_0xf775('0x25')](handleEntityNotFound(_0x1a3c04,null))[_0xf775('0x25')](function(_0x935035){if(_0x935035){return _0x935035[_0xf775('0x92')](_0x26f013['query'][_0xf775('0x82')])[_0xf775('0x25')](function(){if(_[_0xf775('0x97')](_0x26f013[_0xf775('0x3b')][_0xf775('0x82')])){for(var _0x2af614=0x0;_0x2af614<_0x26f013[_0xf775('0x3b')]['ids'][_0xf775('0x41')];_0x2af614+=0x1){socket['emit'](_0xf775('0x93'),{'UserId':Number(_0x26f013['query']['ids'][_0x2af614]),'VoiceQueueId':Number(_0x26f013[_0xf775('0x50')]['id'])});}}else{socket[_0xf775('0x7f')](_0xf775('0x93'),{'UserId':Number(_0x26f013[_0xf775('0x3b')]['ids']),'VoiceQueueId':Number(_0x26f013[_0xf775('0x50')]['id'])});}});}})[_0xf775('0x25')](function(_0x3dc8cb){return db[_0xf775('0x7a')][_0xf775('0x26')]({'where':{'VoiceQueueId':_0x26f013[_0xf775('0x50')]['id'],'UserId':_0x26f013['query'][_0xf775('0x82')]}})[_0xf775('0x25')](function(){return _0x3dc8cb;});})['then'](respondWithStatusCode(_0x1a3c04,null))[_0xf775('0x4e')](handleError(_0x1a3c04,null));};exports[_0xf775('0x98')]=function(_0x3d94c1,_0x399411,_0x149322){var _0x421a49={};var _0xf2f6cd={};var _0x461187;var _0x1ee7f5;return db['VoiceQueue']['findOne']({'where':{'id':_0x3d94c1['params']['id']}})[_0xf775('0x25')](handleEntityNotFound(_0x399411,null))[_0xf775('0x25')](function(_0x17c344){if(_0x17c344){_0x461187=_0x17c344;_0xf2f6cd[_0xf775('0x3a')]=_[_0xf775('0x3c')](db['User'][_0xf775('0x39')]);_0xf2f6cd[_0xf775('0x3b')]=_['keys'](_0x3d94c1['query']);_0xf2f6cd[_0xf775('0x3d')]=_[_0xf775('0x3f')](_0xf2f6cd[_0xf775('0x3a')],_0xf2f6cd['query']);_0x421a49['attributes']=_[_0xf775('0x3f')](_0xf2f6cd['model'],qs[_0xf775('0x40')](_0x3d94c1[_0xf775('0x3b')][_0xf775('0x40')]));_0x421a49[_0xf775('0x3e')]=_0x421a49[_0xf775('0x3e')][_0xf775('0x41')]?_0x421a49['attributes']:_0xf2f6cd[_0xf775('0x3a')];_0x421a49['order']=qs[_0xf775('0x44')](_0x3d94c1[_0xf775('0x3b')][_0xf775('0x44')]);_0x421a49[_0xf775('0x45')]=qs['filters'](_[_0xf775('0x46')](_0x3d94c1[_0xf775('0x3b')],_0xf2f6cd[_0xf775('0x3d')]));if(_0x3d94c1[_0xf775('0x3b')]['filter']){_0x421a49[_0xf775('0x45')]=_['merge'](_0x421a49[_0xf775('0x45')],{'$or':_[_0xf775('0x2c')](_0x421a49[_0xf775('0x3e')],function(_0x2f9314){var _0x385763={};_0x385763[_0x2f9314]={'$like':'%'+_0x3d94c1[_0xf775('0x3b')][_0xf775('0x2b')]+'%'};return _0x385763;})});}_0x421a49=_['merge']({},_0x421a49,_0x3d94c1['options']);return _0x461187['getAgents'](_0x421a49);}})['then'](function(_0xf8c343){if(_0xf8c343){_0x1ee7f5=_0xf8c343[_0xf775('0x41')];if(!_0x3d94c1[_0xf775('0x3b')][_0xf775('0x62')](_0xf775('0x42'))){_0x421a49[_0xf775('0x1e')]=qs['limit'](_0x3d94c1['query'][_0xf775('0x1e')]);_0x421a49[_0xf775('0x1d')]=qs[_0xf775('0x1d')](_0x3d94c1[_0xf775('0x3b')][_0xf775('0x1d')]);}return _0x461187['getAgents'](_0x421a49);}})['then'](function(_0xd5b23f){if(_0xd5b23f){return _0xd5b23f?{'count':_0x1ee7f5,'rows':_0xd5b23f}:null;}})['then'](respondWithResult(_0x399411,null))[_0xf775('0x4e')](handleError(_0x399411,null));};exports['getMembers']=function(_0x19d763,_0x3479d9,_0x1a0fda){var _0xccd4cc={};var _0x100a07={};var _0x13c2b9;var _0x5af580;return db[_0xf775('0x38')][_0xf775('0x60')]({'where':{'id':_0x19d763['params']['id']}})['then'](handleEntityNotFound(_0x3479d9,null))[_0xf775('0x25')](function(_0x5ac55a){if(_0x5ac55a){_0x13c2b9=_0x5ac55a;_0x100a07[_0xf775('0x3a')]=_[_0xf775('0x3c')](db['UserVoiceQueueRt']['rawAttributes']);_0x100a07[_0xf775('0x3b')]=_[_0xf775('0x3c')](_0x19d763[_0xf775('0x3b')]);_0x100a07[_0xf775('0x3d')]=_[_0xf775('0x3f')](_0x100a07[_0xf775('0x3a')],_0x100a07[_0xf775('0x3b')]);_0xccd4cc[_0xf775('0x3e')]=_[_0xf775('0x3f')](_0x100a07['model'],qs[_0xf775('0x40')](_0x19d763['query']['fields']));_0xccd4cc['attributes']=_0xccd4cc[_0xf775('0x3e')][_0xf775('0x41')]?_0xccd4cc['attributes']:_0x100a07[_0xf775('0x3a')];_0xccd4cc[_0xf775('0x43')]=qs[_0xf775('0x44')](_0x19d763[_0xf775('0x3b')][_0xf775('0x44')]);_0xccd4cc[_0xf775('0x45')]=qs[_0xf775('0x3d')](_[_0xf775('0x46')](_0x19d763[_0xf775('0x3b')],_0x100a07[_0xf775('0x3d')]));if(_0x19d763[_0xf775('0x3b')][_0xf775('0x2b')]){_0xccd4cc[_0xf775('0x45')]=_['merge'](_0xccd4cc['where'],{'$or':_[_0xf775('0x2c')](_0xccd4cc['attributes'],function(_0x9459ee){var _0x2ac461={};_0x2ac461[_0x9459ee]={'$like':'%'+_0x19d763[_0xf775('0x3b')]['filter']+'%'};return _0x2ac461;})});}_0xccd4cc=_[_0xf775('0x47')]({},_0xccd4cc,_0x19d763[_0xf775('0x49')]);return _0x13c2b9[_0xf775('0x99')](_0xccd4cc);}})[_0xf775('0x25')](function(_0x1cf127){if(_0x1cf127){_0x5af580=_0x1cf127['length'];if(!_0x19d763[_0xf775('0x3b')][_0xf775('0x62')](_0xf775('0x42'))){_0xccd4cc[_0xf775('0x1e')]=qs[_0xf775('0x1e')](_0x19d763[_0xf775('0x3b')][_0xf775('0x1e')]);_0xccd4cc[_0xf775('0x1d')]=qs[_0xf775('0x1d')](_0x19d763[_0xf775('0x3b')]['offset']);}return _0x13c2b9['getMembers'](_0xccd4cc);}})['then'](function(_0x50b0a2){return _0x50b0a2?{'count':_0x5af580,'rows':_0x50b0a2}:null;})['then'](respondWithResult(_0x3479d9,null))['catch'](handleError(_0x3479d9,null));};exports[_0xf775('0x9a')]=function(_0x5b8b51,_0x4dde87,_0x534bd5){var _0xcd1991={};var _0x25be10={};var _0x144411;var _0x7ae0be;return db[_0xf775('0x38')][_0xf775('0x60')]({'where':{'id':_0x5b8b51[_0xf775('0x50')]['id']}})[_0xf775('0x25')](handleEntityNotFound(_0x4dde87,null))['then'](function(_0xf930e9){if(_0xf930e9){_0x144411=_0xf930e9;_0x25be10[_0xf775('0x3a')]=_[_0xf775('0x3c')](db[_0xf775('0x9b')][_0xf775('0x39')]);_0x25be10[_0xf775('0x3b')]=_[_0xf775('0x3c')](_0x5b8b51[_0xf775('0x3b')]);_0x25be10[_0xf775('0x3d')]=_[_0xf775('0x3f')](_0x25be10[_0xf775('0x3a')],_0x25be10[_0xf775('0x3b')]);_0xcd1991[_0xf775('0x3e')]=_['intersection'](_0x25be10[_0xf775('0x3a')],qs[_0xf775('0x40')](_0x5b8b51[_0xf775('0x3b')][_0xf775('0x40')]));_0xcd1991[_0xf775('0x3e')]=_0xcd1991[_0xf775('0x3e')][_0xf775('0x41')]?_0xcd1991['attributes']:_0x25be10[_0xf775('0x3a')];_0xcd1991[_0xf775('0x43')]=qs[_0xf775('0x44')](_0x5b8b51[_0xf775('0x3b')][_0xf775('0x44')]);_0xcd1991[_0xf775('0x45')]=qs[_0xf775('0x3d')](_[_0xf775('0x46')](_0x5b8b51[_0xf775('0x3b')],_0x25be10[_0xf775('0x3d')]));if(_0x5b8b51[_0xf775('0x3b')][_0xf775('0x2b')]){_0xcd1991[_0xf775('0x45')]=_[_0xf775('0x47')](_0xcd1991[_0xf775('0x45')],{'$or':_[_0xf775('0x2c')](_0xcd1991['attributes'],function(_0x30bded){var _0x2fe332={};_0x2fe332[_0x30bded]={'$like':'%'+_0x5b8b51[_0xf775('0x3b')][_0xf775('0x2b')]+'%'};return _0x2fe332;})});}_0xcd1991=_[_0xf775('0x47')]({},_0xcd1991,_0x5b8b51[_0xf775('0x49')]);return _0x144411[_0xf775('0x9a')](_0xcd1991);}})['then'](function(_0xa471d7){if(_0xa471d7){_0x7ae0be=_0xa471d7[_0xf775('0x41')];if(!_0x5b8b51[_0xf775('0x3b')][_0xf775('0x62')](_0xf775('0x42'))){_0xcd1991[_0xf775('0x1e')]=qs['limit'](_0x5b8b51[_0xf775('0x3b')][_0xf775('0x1e')]);_0xcd1991[_0xf775('0x1d')]=qs[_0xf775('0x1d')](_0x5b8b51[_0xf775('0x3b')][_0xf775('0x1d')]);}return _0x144411[_0xf775('0x9a')](_0xcd1991);}})[_0xf775('0x25')](function(_0x45686c){if(_0x45686c){return _0x45686c?{'count':_0x7ae0be,'rows':_0x45686c}:null;}})[_0xf775('0x25')](respondWithResult(_0x4dde87,null))['catch'](handleError(_0x4dde87,null));};exports[_0xf775('0x9c')]=function(_0xf254b0,_0x4fbeff,_0x26a52e){var _0x5d07b7,_0x45ea1f;return db[_0xf775('0x38')]['find']({'where':{'id':_0xf254b0[_0xf775('0x50')]['id']}})[_0xf775('0x25')](handleEntityNotFound(_0x4fbeff,null))[_0xf775('0x25')](function(_0x52112a){if(_0x52112a){_0x45ea1f=_0x52112a;return _0x52112a[_0xf775('0x9c')](_0xf254b0[_0xf775('0x52')][_0xf775('0x82')],_[_0xf775('0x5c')](_0xf254b0['body'],[_0xf775('0x82'),'id'])||{});}return null;})['spread'](function(_0x4f5b68){var _0xa4848;_0x5d07b7=_0x4f5b68||[];var _0x10eee2=[];if(_0x4f5b68){for(var _0x584014=0x0;_0x584014<_0x4f5b68[_0xf775('0x41')];_0x584014+=0x1){var _0x2b9837=_0x4f5b68[_0x584014][_0xf775('0x27')]({'plain':!![]});_0x45ea1f[_0xf775('0x9d')]=_0xf254b0[_0xf775('0x52')]['dialCheckDuplicateType']?_0xf254b0['body']['dialCheckDuplicateType']:_0x45ea1f[_0xf775('0x9d')];switch(_0x45ea1f[_0xf775('0x9d')]){case'always':_0xa4848=squel['insert']()['into']('cm_hopper')[_0xf775('0x9e')](['phone',_0xf775('0x9f'),'ContactId','ListId',_0xf775('0x65'),_0xf775('0x5d'),_0xf775('0x5e')],squel[_0xf775('0x83')]()[_0xf775('0xa0')](_0xf775('0xa1'),_0xf775('0xa1'))[_0xf775('0xa0')](_0xf775('0xa2'),'scheduledAt')[_0xf775('0xa0')]('id',_0xf775('0xa3'))[_0xf775('0xa0')](_0x2b9837[_0xf775('0xa4')][_0xf775('0xa5')](),'ListId')[_0xf775('0xa0')](_0xf254b0['params']['id'][_0xf775('0xa5')](),_0xf775('0x65'))[_0xf775('0xa0')]('NOW()',_0xf775('0x5d'))[_0xf775('0xa0')](_0xf775('0xa2'),_0xf775('0x5e'))['from'](_0xf775('0xa6'))['where'](_0xf775('0xa7'))[_0xf775('0x45')](_0xf775('0xa8'),_0x2b9837[_0xf775('0xa4')][_0xf775('0xa5')]())[_0xf775('0x45')](_0xf775('0xa9'))[_0xf775('0x45')](_0xf775('0xaa'),squel[_0xf775('0x83')]()['field'](_0xf775('0xab'))[_0xf775('0x85')](_0xf775('0xac'))[_0xf775('0x45')](_0xf775('0x8a'),_0xf254b0[_0xf775('0x50')]['id'][_0xf775('0xa5')]()))[_0xf775('0x45')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xf775('0xa0')](_0xf775('0xad'))[_0xf775('0x85')](_0xf775('0xae'))[_0xf775('0x45')]('VoiceQueueId\x20=\x20?',_0xf254b0['params']['id'][_0xf775('0xa5')]())))[_0xf775('0xa5')]();break;case _0xf775('0xaf'):_0xa4848=squel['insert']()[_0xf775('0xb0')]('cm_hopper')[_0xf775('0x9e')](['phone',_0xf775('0x9f'),'ContactId',_0xf775('0xb1'),'VoiceQueueId','createdAt','updatedAt'],squel[_0xf775('0x83')]()[_0xf775('0xa0')](_0xf775('0xa1'),_0xf775('0xa1'))[_0xf775('0xa0')]('NOW()',_0xf775('0x9f'))[_0xf775('0xa0')]('id',_0xf775('0xa3'))[_0xf775('0xa0')](_0x2b9837['CmListId'][_0xf775('0xa5')](),_0xf775('0xb1'))[_0xf775('0xa0')](_0xf254b0[_0xf775('0x50')]['id'][_0xf775('0xa5')](),_0xf775('0x65'))[_0xf775('0xa0')](_0xf775('0xa2'),'createdAt')[_0xf775('0xa0')](_0xf775('0xa2'),'updatedAt')['from'](_0xf775('0xa6'))[_0xf775('0x45')](_0xf775('0xa7'))[_0xf775('0x45')](_0xf775('0xa8'),_0x2b9837[_0xf775('0xa4')][_0xf775('0xa5')]())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0xf775('0xaa'),squel[_0xf775('0x83')]()[_0xf775('0xa0')](_0xf775('0xad'))['from'](_0xf775('0xae'))[_0xf775('0x45')](_0xf775('0x8a'),_0xf254b0[_0xf775('0x50')]['id'][_0xf775('0xa5')]())))[_0xf775('0xa5')]();break;default:_0xa4848=squel['insert']()['into'](_0xf775('0xae'))[_0xf775('0x9e')]([_0xf775('0xa1'),_0xf775('0x9f'),_0xf775('0xa3'),_0xf775('0xb1'),_0xf775('0x65'),_0xf775('0x5d'),_0xf775('0x5e')],squel[_0xf775('0x83')]()[_0xf775('0xa0')](_0xf775('0xa1'),'phone')[_0xf775('0xa0')]('NOW()','scheduledAt')[_0xf775('0xa0')]('id',_0xf775('0xa3'))[_0xf775('0xa0')](_0x2b9837[_0xf775('0xa4')][_0xf775('0xa5')](),_0xf775('0xb1'))[_0xf775('0xa0')](_0xf254b0[_0xf775('0x50')]['id'][_0xf775('0xa5')](),_0xf775('0x65'))[_0xf775('0xa0')](_0xf775('0xa2'),_0xf775('0x5d'))['field'](_0xf775('0xa2'),_0xf775('0x5e'))[_0xf775('0x85')](_0xf775('0xa6'))[_0xf775('0x45')](_0xf775('0xa7'))[_0xf775('0x45')]('ListId\x20=\x20?',_0x2b9837[_0xf775('0xa4')][_0xf775('0xa5')]())[_0xf775('0x45')]('phone\x20IS\x20NOT\x20NULL'))[_0xf775('0xa5')]();}_0x10eee2['push'](db[_0xf775('0x74')][_0xf775('0x3b')](_0xa4848));}return BPromise[_0xf775('0x8f')](_0x10eee2);}})[_0xf775('0x25')](function(){return _0x5d07b7;})[_0xf775('0x25')](respondWithResult(_0x4fbeff,null))['catch'](handleError(_0x4fbeff,null));};exports[_0xf775('0xb2')]=function(_0x17f0f0,_0xf775f,_0x354348){return db[_0xf775('0x38')][_0xf775('0x30')]({'where':{'id':_0x17f0f0[_0xf775('0x50')]['id']}})[_0xf775('0x25')](handleEntityNotFound(_0xf775f,null))[_0xf775('0x25')](function(_0x507634){if(_0x507634){return _0x507634[_0xf775('0xb2')](_0x17f0f0[_0xf775('0x3b')][_0xf775('0x82')]);}})['then'](function(_0x409f61){if(_0x409f61){return db['CmHopper']['destroy']({'where':{'ListId':_0x17f0f0[_0xf775('0x3b')][_0xf775('0x82')],'VoiceQueueId':_0x17f0f0['params']['id']}})[_0xf775('0x25')](function(){return _0x409f61;});}})[_0xf775('0x25')](respondWithStatusCode(_0xf775f,null))[_0xf775('0x4e')](handleError(_0xf775f,null));};exports[_0xf775('0xb3')]=function(_0x1d731a,_0x52c561,_0x380475){var _0x30b650={};var _0x2e6e11={};var _0x4a41ac;var _0x197b6d;return db[_0xf775('0x38')][_0xf775('0x60')]({'where':{'id':_0x1d731a[_0xf775('0x50')]['id']}})['then'](handleEntityNotFound(_0x52c561,null))[_0xf775('0x25')](function(_0x3371f4){if(_0x3371f4){_0x4a41ac=_0x3371f4;_0x2e6e11[_0xf775('0x3a')]=_[_0xf775('0x3c')](db[_0xf775('0x9b')][_0xf775('0x39')]);_0x2e6e11[_0xf775('0x3b')]=_[_0xf775('0x3c')](_0x1d731a[_0xf775('0x3b')]);_0x2e6e11['filters']=_[_0xf775('0x3f')](_0x2e6e11[_0xf775('0x3a')],_0x2e6e11[_0xf775('0x3b')]);_0x30b650[_0xf775('0x3e')]=_['intersection'](_0x2e6e11[_0xf775('0x3a')],qs['fields'](_0x1d731a[_0xf775('0x3b')][_0xf775('0x40')]));_0x30b650['attributes']=_0x30b650['attributes'][_0xf775('0x41')]?_0x30b650[_0xf775('0x3e')]:_0x2e6e11[_0xf775('0x3a')];_0x30b650[_0xf775('0x43')]=qs[_0xf775('0x44')](_0x1d731a[_0xf775('0x3b')]['sort']);_0x30b650[_0xf775('0x45')]=qs[_0xf775('0x3d')](_['pick'](_0x1d731a[_0xf775('0x3b')],_0x2e6e11[_0xf775('0x3d')]));if(_0x1d731a[_0xf775('0x3b')]['filter']){_0x30b650['where']=_[_0xf775('0x47')](_0x30b650[_0xf775('0x45')],{'$or':_[_0xf775('0x2c')](_0x30b650[_0xf775('0x3e')],function(_0x3112f6){var _0x17e3ba={};_0x17e3ba[_0x3112f6]={'$like':'%'+_0x1d731a[_0xf775('0x3b')][_0xf775('0x2b')]+'%'};return _0x17e3ba;})});}_0x30b650=_['merge']({},_0x30b650,_0x1d731a[_0xf775('0x49')]);return _0x4a41ac[_0xf775('0xb3')](_0x30b650);}})[_0xf775('0x25')](function(_0x4cde2b){if(_0x4cde2b){_0x197b6d=_0x4cde2b[_0xf775('0x41')];if(!_0x1d731a[_0xf775('0x3b')][_0xf775('0x62')]('nolimit')){_0x30b650[_0xf775('0x1e')]=qs['limit'](_0x1d731a['query']['limit']);_0x30b650[_0xf775('0x1d')]=qs[_0xf775('0x1d')](_0x1d731a[_0xf775('0x3b')][_0xf775('0x1d')]);}return _0x4a41ac[_0xf775('0xb3')](_0x30b650);}})[_0xf775('0x25')](function(_0x38a373){if(_0x38a373){return _0x38a373?{'count':_0x197b6d,'rows':_0x38a373}:null;}})['then'](respondWithResult(_0x52c561,null))[_0xf775('0x4e')](handleError(_0x52c561,null));};exports[_0xf775('0xb4')]=function(_0x49e322,_0x46102b,_0x25e7ed){var _0x522047,_0x4453e0;return db[_0xf775('0x38')]['find']({'where':{'id':_0x49e322[_0xf775('0x50')]['id']}})['then'](handleEntityNotFound(_0x46102b,null))[_0xf775('0x25')](function(_0xa6cb86){if(_0xa6cb86){_0x4453e0=_0xa6cb86;return _0xa6cb86[_0xf775('0xb4')](_0x49e322[_0xf775('0x52')][_0xf775('0x82')],_['omit'](_0x49e322['body'],[_0xf775('0x82'),'id'])||{});}return null;})[_0xf775('0xb5')](function(_0x30bdcf){var _0x450d67;_0x522047=_0x30bdcf||[];var _0x505819=[];if(_0x30bdcf){for(var _0x1168de=0x0;_0x1168de<_0x30bdcf[_0xf775('0x41')];_0x1168de+=0x1){var _0x15dc1d=_0x30bdcf[_0x1168de][_0xf775('0x27')]({'plain':!![]});_0x450d67=squel[_0xf775('0xb6')]()[_0xf775('0xb0')](_0xf775('0xb7'))[_0xf775('0x9e')]([_0xf775('0xa1'),_0xf775('0xa3'),_0xf775('0xb1'),_0xf775('0x65'),_0xf775('0x5d'),_0xf775('0x5e')],squel[_0xf775('0x83')]()['field'](_0xf775('0xa1'),'phone')[_0xf775('0xa0')]('id',_0xf775('0xa3'))[_0xf775('0xa0')](_0x15dc1d[_0xf775('0xa4')][_0xf775('0xa5')](),_0xf775('0xb1'))['field'](_0x49e322[_0xf775('0x50')]['id'][_0xf775('0xa5')](),_0xf775('0x65'))[_0xf775('0xa0')](_0xf775('0xa2'),'createdAt')[_0xf775('0xa0')](_0xf775('0xa2'),_0xf775('0x5e'))[_0xf775('0x85')]('cm_contacts')[_0xf775('0x45')](_0xf775('0xa7'))[_0xf775('0x45')](_0xf775('0xa8'),_0x15dc1d['CmListId']['toString']())[_0xf775('0x45')](_0xf775('0xa9')))[_0xf775('0xa5')]();_0x505819['push'](db[_0xf775('0x74')][_0xf775('0x3b')](_0x450d67));}return BPromise[_0xf775('0x8f')](_0x505819);}})[_0xf775('0x25')](function(){return _0x522047;})[_0xf775('0x25')](respondWithResult(_0x46102b,null))['catch'](handleError(_0x46102b,null));};exports['removeBlackLists']=function(_0x5ae3cf,_0x134e45,_0x467d05){return db['VoiceQueue']['find']({'where':{'id':_0x5ae3cf[_0xf775('0x50')]['id']}})['then'](handleEntityNotFound(_0x134e45,null))['then'](function(_0x3b4940){if(_0x3b4940){return _0x3b4940['removeBlackLists'](_0x5ae3cf[_0xf775('0x3b')][_0xf775('0x82')]);}})[_0xf775('0x25')](function(_0x316114){if(_0x316114){return db[_0xf775('0x69')][_0xf775('0x26')]({'where':{'ListId':_0x5ae3cf['query'][_0xf775('0x82')],'VoiceQueueId':_0x5ae3cf[_0xf775('0x50')]['id']}})[_0xf775('0x25')](function(){return _0x316114;});}})[_0xf775('0x25')](respondWithStatusCode(_0x134e45,null))[_0xf775('0x4e')](handleError(_0x134e45,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 338000c..eae29e6 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 _0x29f3=['update','remove','emit','hasOwnProperty','hook','exports','VoiceQueue','setMaxListeners','save'];(function(_0x51bac5,_0x374b6b){var _0x39b0d6=function(_0x36b4d4){while(--_0x36b4d4){_0x51bac5['push'](_0x51bac5['shift']());}};_0x39b0d6(++_0x374b6b);}(_0x29f3,0x1d1));var _0x329f=function(_0x47f063,_0x3f7b29){_0x47f063=_0x47f063-0x0;var _0x31cd21=_0x29f3[_0x47f063];return _0x31cd21;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db'][_0x329f('0x0')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x329f('0x1')](0x0);var events={'afterCreate':_0x329f('0x2'),'afterUpdate':_0x329f('0x3'),'afterDestroy':_0x329f('0x4')};function emitEvent(_0x6df01b){return function(_0x2435b2,_0xa0c829,_0x519b76){VoiceQueueEvents['emit'](_0x6df01b+':'+_0x2435b2['id'],_0x2435b2);VoiceQueueEvents[_0x329f('0x5')](_0x6df01b,_0x2435b2);_0x519b76(null);};}for(var e in events){if(events[_0x329f('0x6')](e)){var event=events[e];VoiceQueue[_0x329f('0x7')](e,emitEvent(event));}}module[_0x329f('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x0c22=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoiceQueue','setMaxListeners','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0c22,0x7d));var _0x20c2=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x0c22[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require(_0x20c2('0x0'));var VoiceQueue=require(_0x20c2('0x1'))['db'][_0x20c2('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x20c2('0x3')](0x0);var events={'afterCreate':_0x20c2('0x4'),'afterUpdate':_0x20c2('0x5'),'afterDestroy':_0x20c2('0x6')};function emitEvent(_0x44cf0b){return function(_0x4ebd49,_0x30be34,_0x4a69f8){VoiceQueueEvents[_0x20c2('0x7')](_0x44cf0b+':'+_0x4ebd49['id'],_0x4ebd49);VoiceQueueEvents[_0x20c2('0x7')](_0x44cf0b,_0x4ebd49);_0x4a69f8(null);};}for(var e in events){if(events[_0x20c2('0x8')](e)){var event=events[e];VoiceQueue[_0x20c2('0x9')](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 ce4db4b..9e45704 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 _0x522a=['../../config/logger','moment','bluebird','path','rimraf','./voiceQueue.attributes','exports','define','VoiceQueue','voice_queues','lodash','util'];(function(_0x461719,_0x51d1f3){var _0x3098b5=function(_0x11a389){while(--_0x11a389){_0x461719['push'](_0x461719['shift']());}};_0x3098b5(++_0x51d1f3);}(_0x522a,0x166));var _0xa522=function(_0x1476fb,_0x467d01){_0x1476fb=_0x1476fb-0x0;var _0x44f57e=_0x522a[_0x1476fb];return _0x44f57e;};'use strict';var _=require(_0xa522('0x0'));var util=require(_0xa522('0x1'));var logger=require(_0xa522('0x2'))('api');var moment=require(_0xa522('0x3'));var BPromise=require(_0xa522('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa522('0x5'));var rimraf=require(_0xa522('0x6'));var config=require('../../config/environment');var attributes=require(_0xa522('0x7'));module[_0xa522('0x8')]=function(_0x8eae0e,_0x404285){return _0x8eae0e[_0xa522('0x9')](_0xa522('0xa'),attributes,{'tableName':_0xa522('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f12=['path','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue','voice_queues','lodash','util','../../config/logger','api','moment'];(function(_0x5b077b,_0x50b707){var _0x16faf7=function(_0x41ba83){while(--_0x41ba83){_0x5b077b['push'](_0x5b077b['shift']());}};_0x16faf7(++_0x50b707);}(_0x9f12,0x145));var _0x29f1=function(_0x319d77,_0x445f72){_0x319d77=_0x319d77-0x0;var _0x1dd41c=_0x9f12[_0x319d77];return _0x1dd41c;};'use strict';var _=require(_0x29f1('0x0'));var util=require(_0x29f1('0x1'));var logger=require(_0x29f1('0x2'))(_0x29f1('0x3'));var moment=require(_0x29f1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x29f1('0x5'));var rimraf=require('rimraf');var config=require(_0x29f1('0x6'));var attributes=require(_0x29f1('0x7'));module[_0x29f1('0x8')]=function(_0x159adf,_0x2bc60b){return _0x159adf['define'](_0x29f1('0x9'),attributes,{'tableName':_0x29f1('0xa'),'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 af87607..eb3d371 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 _0xf711=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','catch','ShowVoiceQueue','lodash','moment'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf711,0xa2));var _0x1f71=function(_0x57bba9,_0x110c12){_0x57bba9=_0x57bba9-0x0;var _0x3e486a=_0xf711[_0x57bba9];return _0x3e486a;};'use strict';var _=require(_0x1f71('0x0'));var util=require('util');var moment=require(_0x1f71('0x1'));var BPromise=require(_0x1f71('0x2'));var rs=require(_0x1f71('0x3'));var fs=require('fs');var Redis=require(_0x1f71('0x4'));var db=require(_0x1f71('0x5'))['db'];var utils=require(_0x1f71('0x6'));var logger=require(_0x1f71('0x7'))(_0x1f71('0x8'));var config=require(_0x1f71('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1f71('0xa')]({'port':0x232a});config[_0x1f71('0xb')]=_[_0x1f71('0xc')](config[_0x1f71('0xb')],{'host':_0x1f71('0xd'),'port':0x18eb});var socket=require(_0x1f71('0xe'))(new Redis(config['redis']));require(_0x1f71('0xf'))[_0x1f71('0x10')](socket);function respondWithRpcPromise(_0x5a9c37,_0x185b61,_0x57ca10){return new BPromise(function(_0x36e959,_0x228b4c){return client[_0x1f71('0x11')](_0x5a9c37,_0x57ca10)['then'](function(_0x372a43){logger[_0x1f71('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x185b61,_0x1f71('0x13'));logger[_0x1f71('0x14')](_0x1f71('0x15'),_0x185b61,'request\x20sent',JSON[_0x1f71('0x16')](_0x372a43));if(_0x372a43[_0x1f71('0x17')]){if(_0x372a43[_0x1f71('0x17')][_0x1f71('0x18')]===0x1f4){logger[_0x1f71('0x17')](_0x1f71('0x19'),_0x185b61,_0x372a43[_0x1f71('0x17')][_0x1f71('0x1a')]);return _0x228b4c(_0x372a43[_0x1f71('0x17')][_0x1f71('0x1a')]);}logger[_0x1f71('0x17')](_0x1f71('0x19'),_0x185b61,_0x372a43[_0x1f71('0x17')]['message']);return _0x36e959(_0x372a43[_0x1f71('0x17')][_0x1f71('0x1a')]);}else{logger[_0x1f71('0x12')](_0x1f71('0x19'),_0x185b61,_0x1f71('0x13'));_0x36e959(_0x372a43['result']['message']);}})['catch'](function(_0x2e2777){logger[_0x1f71('0x17')](_0x1f71('0x19'),_0x185b61,_0x2e2777);_0x228b4c(_0x2e2777);});});}exports[_0x1f71('0x1b')]=function(_0x4c5f5b){var _0x304eed=this;return new Promise(function(_0x1c37c3,_0x217cb0){return db[_0x1f71('0x1c')][_0x1f71('0x1d')]({'raw':_0x4c5f5b[_0x1f71('0x1e')]?_0x4c5f5b[_0x1f71('0x1e')][_0x1f71('0x1f')]===undefined?!![]:![]:!![],'where':_0x4c5f5b[_0x1f71('0x1e')]?_0x4c5f5b[_0x1f71('0x1e')][_0x1f71('0x20')]||null:null,'attributes':_0x4c5f5b[_0x1f71('0x1e')]?_0x4c5f5b[_0x1f71('0x1e')][_0x1f71('0x21')]||null:null,'limit':_0x4c5f5b[_0x1f71('0x1e')]?_0x4c5f5b['options'][_0x1f71('0x22')]||null:null,'include':_0x4c5f5b[_0x1f71('0x1e')]?_0x4c5f5b[_0x1f71('0x1e')][_0x1f71('0x23')]?_[_0x1f71('0x24')](_0x4c5f5b[_0x1f71('0x1e')][_0x1f71('0x23')],function(_0x4c2677){return{'model':db[_0x4c2677['model']],'as':_0x4c2677['as'],'attributes':_0x4c2677['attributes'],'include':_0x4c2677[_0x1f71('0x23')]?_[_0x1f71('0x24')](_0x4c2677[_0x1f71('0x23')],function(_0x10676d){return{'model':db[_0x10676d[_0x1f71('0x25')]],'as':_0x10676d['as'],'attributes':_0x10676d[_0x1f71('0x21')],'include':_0x10676d[_0x1f71('0x23')]?_[_0x1f71('0x24')](_0x10676d['include'],function(_0x2c8b62){return{'model':db[_0x2c8b62[_0x1f71('0x25')]],'as':_0x2c8b62['as'],'attributes':_0x2c8b62[_0x1f71('0x21')]};}):[]};}):[]};}):[]:[]})[_0x1f71('0x26')](function(_0x52cd4d){logger[_0x1f71('0x12')](_0x1f71('0x1b'),_0x4c5f5b);logger[_0x1f71('0x14')](_0x1f71('0x1b'),_0x4c5f5b,JSON[_0x1f71('0x16')](_0x52cd4d));_0x1c37c3(_0x52cd4d);})[_0x1f71('0x27')](function(_0x294482){logger[_0x1f71('0x17')]('GetVoiceQueue',_0x294482[_0x1f71('0x1a')],_0x4c5f5b);_0x217cb0(_0x304eed[_0x1f71('0x17')](0x1f4,_0x294482['message']));});});};exports[_0x1f71('0x28')]=function(_0x107fce){var _0x3ae9d5=this;return new Promise(function(_0x3b9464,_0x567bb6){return db['VoiceQueue']['find']({'raw':_0x107fce[_0x1f71('0x1e')]?_0x107fce[_0x1f71('0x1e')][_0x1f71('0x1f')]===undefined?!![]:![]:!![],'where':_0x107fce[_0x1f71('0x1e')]?_0x107fce[_0x1f71('0x1e')]['where']||null:null,'attributes':_0x107fce[_0x1f71('0x1e')]?_0x107fce[_0x1f71('0x1e')][_0x1f71('0x21')]||null:null,'include':_0x107fce['options']?_0x107fce[_0x1f71('0x1e')][_0x1f71('0x23')]?_['map'](_0x107fce[_0x1f71('0x1e')]['include'],function(_0x29f656){return{'model':db[_0x29f656[_0x1f71('0x25')]],'as':_0x29f656['as'],'attributes':_0x29f656[_0x1f71('0x21')],'include':_0x29f656['include']?_[_0x1f71('0x24')](_0x29f656[_0x1f71('0x23')],function(_0x1aee91){return{'model':db[_0x1aee91[_0x1f71('0x25')]],'as':_0x1aee91['as'],'attributes':_0x1aee91[_0x1f71('0x21')],'include':_0x1aee91[_0x1f71('0x23')]?_[_0x1f71('0x24')](_0x1aee91[_0x1f71('0x23')],function(_0x3c3d4e){return{'model':db[_0x3c3d4e['model']],'as':_0x3c3d4e['as'],'attributes':_0x3c3d4e['attributes']};}):[]};}):[]};}):[]:[]})[_0x1f71('0x26')](function(_0x3fe295){logger[_0x1f71('0x12')](_0x1f71('0x28'),_0x107fce);logger[_0x1f71('0x14')](_0x1f71('0x28'),_0x107fce,JSON[_0x1f71('0x16')](_0x3fe295));_0x3b9464(_0x3fe295);})[_0x1f71('0x27')](function(_0x17bc89){logger[_0x1f71('0x17')](_0x1f71('0x28'),_0x17bc89[_0x1f71('0x1a')],_0x107fce);_0x567bb6(_0x3ae9d5[_0x1f71('0x17')](0x1f4,_0x17bc89['message']));});});}; \ No newline at end of file +var _0x44af=['defaults','redis','socket.io-emitter','./voiceQueue.socket','register','request','then','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','VoiceQueue,\x20%s,\x20%s','message','result','catch','GetVoiceQueue','VoiceQueue','options','where','attributes','limit','include','model','map','stringify','ShowVoiceQueue','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x267372,_0xe20a61){var _0x37eeba=function(_0x593cbf){while(--_0x593cbf){_0x267372['push'](_0x267372['shift']());}};_0x37eeba(++_0xe20a61);}(_0x44af,0x95));var _0xf44a=function(_0x398b3d,_0x2f497e){_0x398b3d=_0x398b3d-0x0;var _0x20b1cf=_0x44af[_0x398b3d];return _0x20b1cf;};'use strict';var _=require('lodash');var util=require(_0xf44a('0x0'));var moment=require(_0xf44a('0x1'));var BPromise=require(_0xf44a('0x2'));var rs=require(_0xf44a('0x3'));var fs=require('fs');var Redis=require(_0xf44a('0x4'));var db=require(_0xf44a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf44a('0x6'))(_0xf44a('0x7'));var config=require(_0xf44a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf44a('0x9')][_0xf44a('0xa')]({'port':0x232a});config['redis']=_[_0xf44a('0xb')](config[_0xf44a('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf44a('0xd'))(new Redis(config[_0xf44a('0xc')]));require(_0xf44a('0xe'))[_0xf44a('0xf')](socket);function respondWithRpcPromise(_0xa5ba65,_0x201b6c,_0x346c17){return new BPromise(function(_0x3bdf9c,_0x4ff461){return client[_0xf44a('0x10')](_0xa5ba65,_0x346c17)[_0xf44a('0x11')](function(_0xbf3467){logger[_0xf44a('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x201b6c,_0xf44a('0x13'));logger[_0xf44a('0x14')](_0xf44a('0x15'),_0x201b6c,_0xf44a('0x13'),JSON['stringify'](_0xbf3467));if(_0xbf3467[_0xf44a('0x16')]){if(_0xbf3467[_0xf44a('0x16')][_0xf44a('0x17')]===0x1f4){logger['error'](_0xf44a('0x18'),_0x201b6c,_0xbf3467[_0xf44a('0x16')][_0xf44a('0x19')]);return _0x4ff461(_0xbf3467['error'][_0xf44a('0x19')]);}logger['error'](_0xf44a('0x18'),_0x201b6c,_0xbf3467[_0xf44a('0x16')]['message']);return _0x3bdf9c(_0xbf3467['error'][_0xf44a('0x19')]);}else{logger[_0xf44a('0x12')](_0xf44a('0x18'),_0x201b6c,_0xf44a('0x13'));_0x3bdf9c(_0xbf3467[_0xf44a('0x1a')]['message']);}})[_0xf44a('0x1b')](function(_0x276c90){logger['error'](_0xf44a('0x18'),_0x201b6c,_0x276c90);_0x4ff461(_0x276c90);});});}exports[_0xf44a('0x1c')]=function(_0x2dd0cc){var _0x423dde=this;return new Promise(function(_0x133af4,_0xa031a3){return db[_0xf44a('0x1d')]['findAll']({'raw':_0x2dd0cc[_0xf44a('0x1e')]?_0x2dd0cc[_0xf44a('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2dd0cc[_0xf44a('0x1e')]?_0x2dd0cc[_0xf44a('0x1e')][_0xf44a('0x1f')]||null:null,'attributes':_0x2dd0cc[_0xf44a('0x1e')]?_0x2dd0cc[_0xf44a('0x1e')][_0xf44a('0x20')]||null:null,'limit':_0x2dd0cc[_0xf44a('0x1e')]?_0x2dd0cc[_0xf44a('0x1e')][_0xf44a('0x21')]||null:null,'include':_0x2dd0cc[_0xf44a('0x1e')]?_0x2dd0cc[_0xf44a('0x1e')][_0xf44a('0x22')]?_['map'](_0x2dd0cc[_0xf44a('0x1e')]['include'],function(_0x4b8e8f){return{'model':db[_0x4b8e8f[_0xf44a('0x23')]],'as':_0x4b8e8f['as'],'attributes':_0x4b8e8f[_0xf44a('0x20')],'include':_0x4b8e8f[_0xf44a('0x22')]?_[_0xf44a('0x24')](_0x4b8e8f[_0xf44a('0x22')],function(_0x483a4e){return{'model':db[_0x483a4e[_0xf44a('0x23')]],'as':_0x483a4e['as'],'attributes':_0x483a4e['attributes'],'include':_0x483a4e[_0xf44a('0x22')]?_[_0xf44a('0x24')](_0x483a4e[_0xf44a('0x22')],function(_0x21d9aa){return{'model':db[_0x21d9aa[_0xf44a('0x23')]],'as':_0x21d9aa['as'],'attributes':_0x21d9aa['attributes']};}):[]};}):[]};}):[]:[]})[_0xf44a('0x11')](function(_0x1d9ffc){logger[_0xf44a('0x12')]('GetVoiceQueue',_0x2dd0cc);logger[_0xf44a('0x14')](_0xf44a('0x1c'),_0x2dd0cc,JSON[_0xf44a('0x25')](_0x1d9ffc));_0x133af4(_0x1d9ffc);})['catch'](function(_0x2ee8aa){logger['error'](_0xf44a('0x1c'),_0x2ee8aa[_0xf44a('0x19')],_0x2dd0cc);_0xa031a3(_0x423dde['error'](0x1f4,_0x2ee8aa[_0xf44a('0x19')]));});});};exports[_0xf44a('0x26')]=function(_0x26fc59){var _0x4e601c=this;return new Promise(function(_0x43b201,_0x16b8ae){return db[_0xf44a('0x1d')]['find']({'raw':_0x26fc59[_0xf44a('0x1e')]?_0x26fc59[_0xf44a('0x1e')][_0xf44a('0x27')]===undefined?!![]:![]:!![],'where':_0x26fc59[_0xf44a('0x1e')]?_0x26fc59[_0xf44a('0x1e')][_0xf44a('0x1f')]||null:null,'attributes':_0x26fc59[_0xf44a('0x1e')]?_0x26fc59['options'][_0xf44a('0x20')]||null:null,'include':_0x26fc59[_0xf44a('0x1e')]?_0x26fc59[_0xf44a('0x1e')][_0xf44a('0x22')]?_[_0xf44a('0x24')](_0x26fc59['options'][_0xf44a('0x22')],function(_0x50b8fd){return{'model':db[_0x50b8fd[_0xf44a('0x23')]],'as':_0x50b8fd['as'],'attributes':_0x50b8fd[_0xf44a('0x20')],'include':_0x50b8fd[_0xf44a('0x22')]?_[_0xf44a('0x24')](_0x50b8fd[_0xf44a('0x22')],function(_0x9e3d33){return{'model':db[_0x9e3d33[_0xf44a('0x23')]],'as':_0x9e3d33['as'],'attributes':_0x9e3d33[_0xf44a('0x20')],'include':_0x9e3d33[_0xf44a('0x22')]?_[_0xf44a('0x24')](_0x9e3d33[_0xf44a('0x22')],function(_0x418d1f){return{'model':db[_0x418d1f[_0xf44a('0x23')]],'as':_0x418d1f['as'],'attributes':_0x418d1f[_0xf44a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf44a('0x11')](function(_0x5a0d94){logger[_0xf44a('0x12')]('ShowVoiceQueue',_0x26fc59);logger[_0xf44a('0x14')](_0xf44a('0x26'),_0x26fc59,JSON[_0xf44a('0x25')](_0x5a0d94));_0x43b201(_0x5a0d94);})[_0xf44a('0x1b')](function(_0x533c71){logger[_0xf44a('0x16')](_0xf44a('0x26'),_0x533c71['message'],_0x26fc59);_0x16b8ae(_0x4e601c[_0xf44a('0x16')](0x1f4,_0x533c71[_0xf44a('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 7dedae1..3d63296 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 _0x0f92=['voiceQueue:','./voiceQueue.events','save','remove','emit','removeListener','register'];(function(_0x4e79b3,_0x54e54b){var _0x54b174=function(_0x1b56cf){while(--_0x1b56cf){_0x4e79b3['push'](_0x4e79b3['shift']());}};_0x54b174(++_0x54e54b);}(_0x0f92,0xfd));var _0x20f9=function(_0x2f0a5c,_0x3ad1d2){_0x2f0a5c=_0x2f0a5c-0x0;var _0x35fd12=_0x0f92[_0x2f0a5c];return _0x35fd12;};'use strict';var VoiceQueueEvents=require(_0x20f9('0x0'));var events=[_0x20f9('0x1'),_0x20f9('0x2'),'update'];function createListener(_0x2b91f1,_0x18b239){return function(_0x2fcd18){_0x18b239[_0x20f9('0x3')](_0x2b91f1,_0x2fcd18);};}function removeListener(_0x134dda,_0x253508){return function(){VoiceQueueEvents[_0x20f9('0x4')](_0x134dda,_0x253508);};}exports[_0x20f9('0x5')]=function(_0x5c1025){for(var _0x35eac1=0x0,_0x3801f5=events['length'];_0x35eac1<_0x3801f5;_0x35eac1++){var _0x29b5cc=events[_0x35eac1];var _0x40cfc7=createListener(_0x20f9('0x6')+_0x29b5cc,_0x5c1025);VoiceQueueEvents['on'](_0x29b5cc,_0x40cfc7);}}; \ No newline at end of file +var _0x7837=['emit','save','remove','update'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7837,0x69));var _0x7783=function(_0x1be9f1,_0x5409e5){_0x1be9f1=_0x1be9f1-0x0;var _0x406756=_0x7837[_0x1be9f1];return _0x406756;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x7783('0x0'),_0x7783('0x1'),_0x7783('0x2')];function createListener(_0x138f22,_0x2d5893){return function(_0x4add2e){_0x2d5893[_0x7783('0x3')](_0x138f22,_0x4add2e);};}function removeListener(_0xafa57e,_0x37ef57){return function(){VoiceQueueEvents['removeListener'](_0xafa57e,_0x37ef57);};}exports['register']=function(_0x311ee6){for(var _0x2da567=0x0,_0x26350c=events['length'];_0x2da567<_0x26350c;_0x2da567++){var _0x472730=events[_0x2da567];var _0x315a86=createListener('voiceQueue:'+_0x472730,_0x311ee6);VoiceQueueEvents['on'](_0x472730,_0x315a86);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index dfd2aea..8fc69d1 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 _0x15ef=['isAuthenticated','/describe','getVoiceQueuesReport','/:id','create','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0xd95342,_0xb75bf6){var _0x54d694=function(_0x1190c1){while(--_0x1190c1){_0xd95342['push'](_0xd95342['shift']());}};_0x54d694(++_0xb75bf6);}(_0x15ef,0x80));var _0xf15e=function(_0x16f0ec,_0x273fa4){_0x16f0ec=_0x16f0ec-0x0;var _0x2a0382=_0x15ef[_0x16f0ec];return _0x2a0382;};'use strict';var multer=require('multer');var util=require(_0xf15e('0x0'));var path=require(_0xf15e('0x1'));var timeout=require('connect-timeout');var express=require(_0xf15e('0x2'));var router=express[_0xf15e('0x3')]();var auth=require(_0xf15e('0x4'));var interaction=require(_0xf15e('0x5'));var config=require(_0xf15e('0x6'));var controller=require('./voiceQueueReport.controller');router[_0xf15e('0x7')]('/',auth[_0xf15e('0x8')](),controller['index']);router['get'](_0xf15e('0x9'),auth[_0xf15e('0x8')](),controller['describe']);router[_0xf15e('0x7')]('/index',auth[_0xf15e('0x8')](),controller[_0xf15e('0xa')]);router[_0xf15e('0x7')](_0xf15e('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xf15e('0x8')](),controller[_0xf15e('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf15e('0xd')]);router[_0xf15e('0xe')](_0xf15e('0xb'),auth['isAuthenticated'](),controller[_0xf15e('0xf')]);module[_0xf15e('0x10')]=router; \ No newline at end of file +var _0x6eed=['update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','post','create'];(function(_0x1e5b67,_0x1aacd7){var _0x1fe947=function(_0x45aebb){while(--_0x45aebb){_0x1e5b67['push'](_0x1e5b67['shift']());}};_0x1fe947(++_0x1aacd7);}(_0x6eed,0xff));var _0xd6ee=function(_0x274016,_0x479562){_0x274016=_0x274016-0x0;var _0x254893=_0x6eed[_0x274016];return _0x254893;};'use strict';var multer=require(_0xd6ee('0x0'));var util=require(_0xd6ee('0x1'));var path=require(_0xd6ee('0x2'));var timeout=require(_0xd6ee('0x3'));var express=require(_0xd6ee('0x4'));var router=express['Router']();var auth=require(_0xd6ee('0x5'));var interaction=require(_0xd6ee('0x6'));var config=require('../../config/environment');var controller=require('./voiceQueueReport.controller');router[_0xd6ee('0x7')]('/',auth[_0xd6ee('0x8')](),controller[_0xd6ee('0x9')]);router[_0xd6ee('0x7')](_0xd6ee('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xd6ee('0x7')]('/index',auth['isAuthenticated'](),controller['getVoiceQueuesReport']);router[_0xd6ee('0x7')](_0xd6ee('0xb'),auth['isAuthenticated'](),controller[_0xd6ee('0xc')]);router[_0xd6ee('0xd')]('/',auth[_0xd6ee('0x8')](),controller[_0xd6ee('0xe')]);router['put'](_0xd6ee('0xb'),auth[_0xd6ee('0x8')](),controller[_0xd6ee('0xf')]);router[_0xd6ee('0x10')](_0xd6ee('0xb'),auth[_0xd6ee('0x8')](),controller['destroy']);module[_0xd6ee('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 70019f3..b5261e7 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 _0xb7e7=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x16e196,_0xc0c10f){var _0xc7dad8=function(_0x1c4c4a){while(--_0x1c4c4a){_0x16e196['push'](_0x16e196['shift']());}};_0xc7dad8(++_0xc0c10f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xb7e7[_0x55abd9];return _0x3e5669;};'use strict';var Sequelize=require(_0x7b7e('0x0'));var moment=require('moment');module[_0x7b7e('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7b7e('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x7b7e('0x3')],'set':function(_0x1d9384){var _0x52047f=moment(_0x1d9384);var _0x53ed64=moment(this[_0x7b7e('0x4')](_0x7b7e('0x5')))[_0x7b7e('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x42b871=_0x52047f[_0x7b7e('0x7')](_0x53ed64,_0x7b7e('0x8'));this[_0x7b7e('0x9')](_0x7b7e('0xa'),_0x1d9384);this[_0x7b7e('0x9')](_0x7b7e('0xb'),_0x42b871||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x7b7e('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexit':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x7b7e('0x2')],'comment':_0x7b7e('0xe')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7b7e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x7b7e('0x2')]},'holdtime':{'type':Sequelize[_0x7b7e('0xc')]},'mohtime':{'type':Sequelize[_0x7b7e('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7b7e('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x7b7e('0xf')},'transferexten':{'type':Sequelize[_0x7b7e('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'disposition':{'type':Sequelize[_0x7b7e('0x2')]},'secondDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x7b7e('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb7e7=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'];(function(_0x289aa4,_0x1a9c15){var _0x46964c=function(_0xa4503f){while(--_0xa4503f){_0x289aa4['push'](_0x289aa4['shift']());}};_0x46964c(++_0x1a9c15);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xb7e7[_0x1ccdf7];return _0x52a0ae;};'use strict';var Sequelize=require(_0x7b7e('0x0'));var moment=require('moment');module[_0x7b7e('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7b7e('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x7b7e('0x3')],'set':function(_0x1d9384){var _0x52047f=moment(_0x1d9384);var _0x53ed64=moment(this[_0x7b7e('0x4')](_0x7b7e('0x5')))[_0x7b7e('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x42b871=_0x52047f[_0x7b7e('0x7')](_0x53ed64,_0x7b7e('0x8'));this[_0x7b7e('0x9')](_0x7b7e('0xa'),_0x1d9384);this[_0x7b7e('0x9')](_0x7b7e('0xb'),_0x42b871||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x7b7e('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexit':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7b7e('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x7b7e('0x2')],'comment':_0x7b7e('0xe')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7b7e('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7b7e('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x7b7e('0x2')]},'holdtime':{'type':Sequelize[_0x7b7e('0xc')]},'mohtime':{'type':Sequelize[_0x7b7e('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7b7e('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7b7e('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x7b7e('0xf')},'transferexten':{'type':Sequelize[_0x7b7e('0x2')]},'transferuniqueid':{'type':Sequelize[_0x7b7e('0x2')]},'disposition':{'type':Sequelize[_0x7b7e('0x2')]},'secondDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'thirdDisposition':{'type':Sequelize[_0x7b7e('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x7b7e('0xc')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 47cc4d0..8a150e4 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 _0xa9e0=['ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','describe','getVoiceQueuesReport','pick','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox'];(function(_0x25cf26,_0x1a0446){var _0x3aaad7=function(_0x80758d){while(--_0x80758d){_0x25cf26['push'](_0x25cf26['shift']());}};_0x3aaad7(++_0x1a0446);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x28')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2b')],'type':_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x28')](_0x3652a7,_0x0a9e('0x25'));_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x140511[_0x0a9e('0x2f')]);_0x14de77['filters']=_[_0x0a9e('0x31')](_0x14de77['model'],_0x14de77[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x14de77[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0x140511['query'][_0x0a9e('0x33')]));_0x11c3b6[_0x0a9e('0x32')]=_0x11c3b6[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x11c3b6[_0x0a9e('0x32')]:_0x14de77[_0x0a9e('0x2e')];if(!_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x35')]('nolimit')){_0x11c3b6[_0x0a9e('0x1d')]=qs['limit'](_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x11c3b6[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x140511['query'][_0x0a9e('0x1c')]);}_0x11c3b6[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x140511[_0x0a9e('0x2f')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x38')](_['pick'](_0x140511[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x38')]),_0x3652a7);if(_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x28')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2c')]!==_0x0a9e('0x3c')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x39')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3a')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x1b')]=_0x5a594b;if(_0x140511[_0x0a9e('0x2f')]['includeAll']){_0x11c3b6[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0x3e')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x3f')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x42')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')]);_0x23b089[_0x0a9e('0x2f')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],_0x23b089[_0x0a9e('0x2f')]);_0x45a9b8[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x33')]));_0x45a9b8[_0x0a9e('0x32')]=_0x45a9b8[_0x0a9e('0x32')]['length']?_0x45a9b8[_0x0a9e('0x32')]:_0x23b089[_0x0a9e('0x2e')];if(_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x43')]){_0x45a9b8[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3a')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x44')]);return db[_0x0a9e('0x29')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x40')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x45')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x8d6dd1[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))[_0x0a9e('0x40')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x20')]=function(_0x45bf7f,_0x5bbcde){if(_0x45bf7f[_0x0a9e('0x46')]['id']){delete _0x45bf7f[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x47')]({'where':{'id':_0x45bf7f[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5bbcde,null))[_0x0a9e('0x22')](saveUpdates(_0x45bf7f[_0x0a9e('0x46')],null))[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,null))['catch'](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x3fe430,_0x4f7240){return db['VoiceQueueReport']['find']({'where':{'id':_0x3fe430[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](removeEntity(_0x4f7240,null))[_0x0a9e('0x40')](handleError(_0x4f7240,null));};exports[_0x0a9e('0x48')]=function(_0x30decb,_0x2e5165){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports[_0x0a9e('0x49')]=function(_0x204173,_0x14d602){var _0x5bb3ed={},_0x2b69d9={},_0x161aa7={'count':0x0,'rows':[]};_0x2b69d9['model']=_['keys'](db[_0x0a9e('0x29')]['rawAttributes']);_0x2b69d9[_0x0a9e('0x2f')]=_['keys'](_0x204173[_0x0a9e('0x2f')]);_0x2b69d9[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x2b69d9['model'],_0x2b69d9[_0x0a9e('0x2f')]);_0x5bb3ed[_0x0a9e('0x32')]=_['intersection'](_0x2b69d9['model'],qs[_0x0a9e('0x33')](_0x204173[_0x0a9e('0x2f')]['fields']));_0x5bb3ed[_0x0a9e('0x32')]=_0x5bb3ed['attributes'][_0x0a9e('0x34')]?_0x5bb3ed['attributes']:_0x2b69d9[_0x0a9e('0x2e')];if(!_0x204173['query']['hasOwnProperty']('nolimit')){_0x5bb3ed[_0x0a9e('0x1d')]=qs['limit'](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x5bb3ed[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1c')]);}_0x5bb3ed[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x204173['query'][_0x0a9e('0x37')]);_0x5bb3ed[_0x0a9e('0x3b')]=qs[_0x0a9e('0x38')](_[_0x0a9e('0x4a')](_0x204173[_0x0a9e('0x2f')],_0x2b69d9[_0x0a9e('0x38')]));if(_0x204173['query'][_0x0a9e('0x39')]){_0x5bb3ed[_0x0a9e('0x3b')]=_['merge'](_0x5bb3ed[_0x0a9e('0x3b')],{'$or':_['map'](_0x5bb3ed[_0x0a9e('0x32')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x204173['query'][_0x0a9e('0x39')]+'%'};return _0x4b3c1a;})});}_0x5bb3ed=_['merge']({},_0x5bb3ed,_0x204173[_0x0a9e('0x44')]);var _0x1fc70e={'where':_0x5bb3ed[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x1fc70e)[_0x0a9e('0x22')](function(_0x49eed0){_0x161aa7[_0x0a9e('0x1b')]=_0x49eed0;if(_0x204173['query'][_0x0a9e('0x43')]){_0x5bb3ed[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x5bb3ed);})[_0x0a9e('0x22')](function(_0x156f1c){_0x161aa7[_0x0a9e('0x3f')]=_0x156f1c;return _0x161aa7;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14d602,_0x5bb3ed,'getVoiceQueuesReport'))[_0x0a9e('0x40')](handleError(_0x14d602,null,_0x0a9e('0x49')));}; \ No newline at end of file +var _0xa9e0=['ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueueReport.socket','register','status','count','offset','limit','set','Content-Range','update','destroy','then','sendStatus','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','includeAll','options','create','body','find','describe','getVoiceQueuesReport','pick','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox'];(function(_0x230229,_0x465a26){var _0x1aa165=function(_0xb0f174){while(--_0xb0f174){_0x230229['push'](_0x230229['shift']());}};_0x1aa165(++_0x465a26);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);function respondWithStatusCode(_0x281129,_0x44dcfd){_0x44dcfd=_0x44dcfd||0xcc;return function(_0x4d5611){if(_0x4d5611){return _0x281129['sendStatus'](_0x44dcfd);}return _0x281129[_0x0a9e('0x1a')](_0x44dcfd)['end']();};}function respondWithResult(_0x1985b6,_0x519dfd){_0x519dfd=_0x519dfd||0xc8;return function(_0x16033c){if(_0x16033c){return _0x1985b6[_0x0a9e('0x1a')](_0x519dfd)['json'](_0x16033c);}};}function respondWithFilteredResult(_0x225616,_0x5a0a06){return function(_0x459eb1){if(_0x459eb1){var _0x478723=_0x459eb1[_0x0a9e('0x1b')],_0x106033=_0x5a0a06[_0x0a9e('0x1c')],_0x205fd6=_0x5a0a06[_0x0a9e('0x1c')]+_0x5a0a06[_0x0a9e('0x1d')],_0x31b1ca;if(_0x205fd6>=_0x478723){_0x205fd6=_0x478723;_0x31b1ca=0xc8;}else{_0x31b1ca=0xce;}_0x225616[_0x0a9e('0x1a')](_0x31b1ca);return _0x225616[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033+'-'+_0x205fd6+'/'+_0x478723)['json'](_0x459eb1);}return null;};}function patchUpdates(_0x2c3407){return function(_0x155cce){try{jsonpatch['apply'](_0x155cce,_0x2c3407,!![]);}catch(_0x20f109){return BPromise['reject'](_0x20f109);}return _0x155cce['save']();};}function saveUpdates(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(_0x38e7c4){return _0x38e7c4[_0x0a9e('0x20')](_0x3a02e1)['then'](function(_0xfb6e48){return _0xfb6e48;});}return null;};}function removeEntity(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){return _0x4d00e6[_0x0a9e('0x21')]()[_0x0a9e('0x22')](function(){_0x2fb0e4[_0x0a9e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59181e,_0x197ec0){return function(_0x3a8e58){if(!_0x3a8e58){_0x59181e[_0x0a9e('0x23')](0x194);}return _0x3a8e58;};}function handleError(_0x33161b,_0x526cf3){_0x526cf3=_0x526cf3||0x1f4;return function(_0x384319){logger['error'](_0x384319[_0x0a9e('0x24')]);if(_0x384319['name']){delete _0x384319[_0x0a9e('0x25')];}_0x33161b[_0x0a9e('0x1a')](_0x526cf3)[_0x0a9e('0x26')](_0x384319);};}exports[_0x0a9e('0x27')]=function(_0x140511,_0x1538a4){var _0x11c3b6={},_0x14de77={},_0x5a101a={'count':0x0,'rows':[]};var _0x3652a7=_[_0x0a9e('0x28')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x2b')],'type':_0x5c877d[_0x0a9e('0x2c')][_0x0a9e('0x2d')]};});_0x14de77[_0x0a9e('0x2e')]=_[_0x0a9e('0x28')](_0x3652a7,_0x0a9e('0x25'));_0x14de77[_0x0a9e('0x2f')]=_[_0x0a9e('0x30')](_0x140511[_0x0a9e('0x2f')]);_0x14de77['filters']=_[_0x0a9e('0x31')](_0x14de77['model'],_0x14de77[_0x0a9e('0x2f')]);_0x11c3b6[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x14de77[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0x140511['query'][_0x0a9e('0x33')]));_0x11c3b6[_0x0a9e('0x32')]=_0x11c3b6[_0x0a9e('0x32')][_0x0a9e('0x34')]?_0x11c3b6[_0x0a9e('0x32')]:_0x14de77[_0x0a9e('0x2e')];if(!_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x35')]('nolimit')){_0x11c3b6[_0x0a9e('0x1d')]=qs['limit'](_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x11c3b6[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x140511['query'][_0x0a9e('0x1c')]);}_0x11c3b6[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x140511[_0x0a9e('0x2f')]['sort']);_0x11c3b6['where']=qs[_0x0a9e('0x38')](_['pick'](_0x140511[_0x0a9e('0x2f')],_0x14de77[_0x0a9e('0x38')]),_0x3652a7);if(_0x140511[_0x0a9e('0x2f')][_0x0a9e('0x39')]){_0x11c3b6['where']=_[_0x0a9e('0x3a')](_0x11c3b6[_0x0a9e('0x3b')],{'$or':_[_0x0a9e('0x28')](_0x3652a7,function(_0x533942){if(_0x533942[_0x0a9e('0x2c')]!==_0x0a9e('0x3c')){var _0x289467={};_0x289467[_0x533942['name']]={'$like':'%'+_0x140511['query'][_0x0a9e('0x39')]+'%'};return _0x289467;}})});}_0x11c3b6=_[_0x0a9e('0x3a')]({},_0x11c3b6,_0x140511['options']);var _0x2b814e={'where':_0x11c3b6[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x2b814e)['then'](function(_0x5a594b){_0x5a101a[_0x0a9e('0x1b')]=_0x5a594b;if(_0x140511[_0x0a9e('0x2f')]['includeAll']){_0x11c3b6[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')][_0x0a9e('0x3e')](_0x11c3b6);})['then'](function(_0x316c8f){_0x5a101a[_0x0a9e('0x3f')]=_0x316c8f;return _0x5a101a;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x1538a4,_0x11c3b6))[_0x0a9e('0x40')](handleError(_0x1538a4,null));};exports[_0x0a9e('0x41')]=function(_0xeaa5e5,_0x2881b3){var _0x45a9b8={'raw':![],'where':{'id':_0xeaa5e5[_0x0a9e('0x42')]['id']}},_0x23b089={};_0x23b089[_0x0a9e('0x2e')]=_[_0x0a9e('0x30')](db[_0x0a9e('0x29')][_0x0a9e('0x2a')]);_0x23b089[_0x0a9e('0x2f')]=_['keys'](_0xeaa5e5['query']);_0x23b089[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],_0x23b089[_0x0a9e('0x2f')]);_0x45a9b8[_0x0a9e('0x32')]=_[_0x0a9e('0x31')](_0x23b089[_0x0a9e('0x2e')],qs[_0x0a9e('0x33')](_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x33')]));_0x45a9b8[_0x0a9e('0x32')]=_0x45a9b8[_0x0a9e('0x32')]['length']?_0x45a9b8[_0x0a9e('0x32')]:_0x23b089[_0x0a9e('0x2e')];if(_0xeaa5e5[_0x0a9e('0x2f')][_0x0a9e('0x43')]){_0x45a9b8[_0x0a9e('0x3d')]=[{'all':!![]}];}_0x45a9b8=_[_0x0a9e('0x3a')]({},_0x45a9b8,_0xeaa5e5[_0x0a9e('0x44')]);return db[_0x0a9e('0x29')]['find'](_0x45a9b8)[_0x0a9e('0x22')](handleEntityNotFound(_0x2881b3,null))['then'](respondWithResult(_0x2881b3,null))[_0x0a9e('0x40')](handleError(_0x2881b3,null));};exports[_0x0a9e('0x45')]=function(_0x8d6dd1,_0x562fb4){return db[_0x0a9e('0x29')][_0x0a9e('0x45')](_0x8d6dd1[_0x0a9e('0x46')],{})[_0x0a9e('0x22')](respondWithResult(_0x562fb4,0xc9))[_0x0a9e('0x40')](handleError(_0x562fb4,null));};exports[_0x0a9e('0x20')]=function(_0x45bf7f,_0x5bbcde){if(_0x45bf7f[_0x0a9e('0x46')]['id']){delete _0x45bf7f[_0x0a9e('0x46')]['id'];}return db[_0x0a9e('0x29')][_0x0a9e('0x47')]({'where':{'id':_0x45bf7f[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x5bbcde,null))[_0x0a9e('0x22')](saveUpdates(_0x45bf7f[_0x0a9e('0x46')],null))[_0x0a9e('0x22')](respondWithResult(_0x5bbcde,null))['catch'](handleError(_0x5bbcde,null));};exports[_0x0a9e('0x21')]=function(_0x3fe430,_0x4f7240){return db['VoiceQueueReport']['find']({'where':{'id':_0x3fe430[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x4f7240,null))[_0x0a9e('0x22')](removeEntity(_0x4f7240,null))[_0x0a9e('0x40')](handleError(_0x4f7240,null));};exports[_0x0a9e('0x48')]=function(_0x30decb,_0x2e5165){return db[_0x0a9e('0x29')]['describe']()['then'](respondWithResult(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports[_0x0a9e('0x49')]=function(_0x204173,_0x14d602){var _0x5bb3ed={},_0x2b69d9={},_0x161aa7={'count':0x0,'rows':[]};_0x2b69d9['model']=_['keys'](db[_0x0a9e('0x29')]['rawAttributes']);_0x2b69d9[_0x0a9e('0x2f')]=_['keys'](_0x204173[_0x0a9e('0x2f')]);_0x2b69d9[_0x0a9e('0x38')]=_[_0x0a9e('0x31')](_0x2b69d9['model'],_0x2b69d9[_0x0a9e('0x2f')]);_0x5bb3ed[_0x0a9e('0x32')]=_['intersection'](_0x2b69d9['model'],qs[_0x0a9e('0x33')](_0x204173[_0x0a9e('0x2f')]['fields']));_0x5bb3ed[_0x0a9e('0x32')]=_0x5bb3ed['attributes'][_0x0a9e('0x34')]?_0x5bb3ed['attributes']:_0x2b69d9[_0x0a9e('0x2e')];if(!_0x204173['query']['hasOwnProperty']('nolimit')){_0x5bb3ed[_0x0a9e('0x1d')]=qs['limit'](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1d')]);_0x5bb3ed[_0x0a9e('0x1c')]=qs[_0x0a9e('0x1c')](_0x204173[_0x0a9e('0x2f')][_0x0a9e('0x1c')]);}_0x5bb3ed[_0x0a9e('0x36')]=qs[_0x0a9e('0x37')](_0x204173['query'][_0x0a9e('0x37')]);_0x5bb3ed[_0x0a9e('0x3b')]=qs[_0x0a9e('0x38')](_[_0x0a9e('0x4a')](_0x204173[_0x0a9e('0x2f')],_0x2b69d9[_0x0a9e('0x38')]));if(_0x204173['query'][_0x0a9e('0x39')]){_0x5bb3ed[_0x0a9e('0x3b')]=_['merge'](_0x5bb3ed[_0x0a9e('0x3b')],{'$or':_['map'](_0x5bb3ed[_0x0a9e('0x32')],function(_0x5ba1f9){var _0x4b3c1a={};_0x4b3c1a[_0x5ba1f9]={'$like':'%'+_0x204173['query'][_0x0a9e('0x39')]+'%'};return _0x4b3c1a;})});}_0x5bb3ed=_['merge']({},_0x5bb3ed,_0x204173[_0x0a9e('0x44')]);var _0x1fc70e={'where':_0x5bb3ed[_0x0a9e('0x3b')]};return db[_0x0a9e('0x29')][_0x0a9e('0x1b')](_0x1fc70e)[_0x0a9e('0x22')](function(_0x49eed0){_0x161aa7[_0x0a9e('0x1b')]=_0x49eed0;if(_0x204173['query'][_0x0a9e('0x43')]){_0x5bb3ed[_0x0a9e('0x3d')]=[{'all':!![]}];}return db[_0x0a9e('0x29')]['findAll'](_0x5bb3ed);})[_0x0a9e('0x22')](function(_0x156f1c){_0x161aa7[_0x0a9e('0x3f')]=_0x156f1c;return _0x161aa7;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14d602,_0x5bb3ed,'getVoiceQueuesReport'))[_0x0a9e('0x40')](handleError(_0x14d602,null,_0x0a9e('0x49')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 0ae5604..edbfca8 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 _0xdd6e=['update','remove','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x989aca,_0x152da2){var _0x1ac5db=function(_0x530807){while(--_0x530807){_0x989aca['push'](_0x989aca['shift']());}};_0x1ac5db(++_0x152da2);}(_0xdd6e,0xdd));var _0xedd6=function(_0x13e79d,_0x383675){_0x13e79d=_0x13e79d-0x0;var _0x195b97=_0xdd6e[_0x13e79d];return _0x195b97;};'use strict';var EventEmitter=require(_0xedd6('0x0'));var VoiceQueueReport=require(_0xedd6('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xedd6('0x2')](0x0);var events={'afterCreate':_0xedd6('0x3'),'afterUpdate':_0xedd6('0x4'),'afterDestroy':_0xedd6('0x5')};function emitEvent(_0x33e1c0){return function(_0x1f9a7c,_0x23c274,_0x1405e6){VoiceQueueReportEvents['emit'](_0x33e1c0+':'+_0x1f9a7c['id'],_0x1f9a7c);VoiceQueueReportEvents['emit'](_0x33e1c0,_0x1f9a7c);_0x1405e6(null);};}for(var e in events){if(events[_0xedd6('0x6')](e)){var event=events[e];VoiceQueueReport[_0xedd6('0x7')](e,emitEvent(event));}}module[_0xedd6('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x59da=['events','../../mysqldb','VoiceQueueReport','update','remove','emit','hasOwnProperty','hook'];(function(_0x317722,_0x9018d9){var _0x12e129=function(_0x59311a){while(--_0x59311a){_0x317722['push'](_0x317722['shift']());}};_0x12e129(++_0x9018d9);}(_0x59da,0xf8));var _0xa59d=function(_0xcc5d53,_0x96d5ea){_0xcc5d53=_0xcc5d53-0x0;var _0x3c5ab9=_0x59da[_0xcc5d53];return _0x3c5ab9;};'use strict';var EventEmitter=require(_0xa59d('0x0'));var VoiceQueueReport=require(_0xa59d('0x1'))['db'][_0xa59d('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa59d('0x3'),'afterDestroy':_0xa59d('0x4')};function emitEvent(_0x5eac5e){return function(_0x22bf17,_0x5d53d2,_0x479de4){VoiceQueueReportEvents['emit'](_0x5eac5e+':'+_0x22bf17['id'],_0x22bf17);VoiceQueueReportEvents[_0xa59d('0x5')](_0x5eac5e,_0x22bf17);_0x479de4(null);};}for(var e in events){if(events[_0xa59d('0x6')](e)){var event=events[e];VoiceQueueReport[_0xa59d('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 086a721..702f5dc 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 _0x5f66=['request-promise','path','../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','api','moment','bluebird'];(function(_0xcebd84,_0x300888){var _0x8b919=function(_0x1c5679){while(--_0x1c5679){_0xcebd84['push'](_0xcebd84['shift']());}};_0x8b919(++_0x300888);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x5f66[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./voiceQueueReport.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[{'fields':[_0x65f6('0xa')]},{'fields':[_0x65f6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0b0e=['calleridnum','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','uniqueid'];(function(_0x2aa2ab,_0xf17b6d){var _0x7ca86b=function(_0x121fca){while(--_0x121fca){_0x2aa2ab['push'](_0x2aa2ab['shift']());}};_0x7ca86b(++_0xf17b6d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5906a5,_0x48af0a){_0x5906a5=_0x5906a5-0x0;var _0x1b9a31=_0x0b0e[_0x5906a5];return _0x1b9a31;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var logger=require(_0xe0b0('0x1'))('api');var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var rp=require(_0xe0b0('0x4'));var fs=require('fs');var path=require(_0xe0b0('0x5'));var rimraf=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var attributes=require(_0xe0b0('0x8'));module[_0xe0b0('0x9')]=function(_0x30e20d,_0x28e40f){return _0x30e20d[_0xe0b0('0xa')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xe0b0('0xb')]},{'fields':[_0xe0b0('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index a7a205e..e57ea01 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 _0x4bdc=['GetVoiceQueueReport','options','where','attributes','include','map','model','then','CreateVoiceQueueReport','VoiceQueueReport','body','raw','catch','UpdateVoiceQueueReport','update','limit','debug','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceQueueReport.socket','register','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x91c951,_0x2988ba){var _0xc454d1=function(_0x1d86e8){while(--_0x1d86e8){_0x91c951['push'](_0x91c951['shift']());}};_0xc454d1(++_0x2988ba);}(_0x4bdc,0x122));var _0xc4bd=function(_0x3ef051,_0x49ea91){_0x3ef051=_0x3ef051-0x0;var _0x5679b3=_0x4bdc[_0x3ef051];return _0x5679b3;};'use strict';var _=require(_0xc4bd('0x0'));var util=require(_0xc4bd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4bd('0x2'));var db=require(_0xc4bd('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc4bd('0x4'))(_0xc4bd('0x5'));var config=require(_0xc4bd('0x6'));var jayson=require(_0xc4bd('0x7'));var client=jayson[_0xc4bd('0x8')][_0xc4bd('0x9')]({'port':0x232a});config[_0xc4bd('0xa')]=_['defaults'](config[_0xc4bd('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xc4bd('0xb'))(new Redis(config[_0xc4bd('0xa')]));require(_0xc4bd('0xc'))[_0xc4bd('0xd')](socket);function respondWithRpcPromise(_0xd16bf4,_0x5af469,_0xdd5b33){return new BPromise(function(_0x3dca37,_0x200be5){return client['request'](_0xd16bf4,_0xdd5b33)['then'](function(_0x4e078c){logger['info'](_0xc4bd('0xe'),_0x5af469,_0xc4bd('0xf'));logger['debug'](_0xc4bd('0x10'),_0x5af469,'request\x20sent',JSON[_0xc4bd('0x11')](_0x4e078c));if(_0x4e078c[_0xc4bd('0x12')]){if(_0x4e078c['error'][_0xc4bd('0x13')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x5af469,_0x4e078c[_0xc4bd('0x12')][_0xc4bd('0x14')]);return _0x200be5(_0x4e078c['error'][_0xc4bd('0x14')]);}logger[_0xc4bd('0x12')](_0xc4bd('0xe'),_0x5af469,_0x4e078c[_0xc4bd('0x12')][_0xc4bd('0x14')]);return _0x3dca37(_0x4e078c[_0xc4bd('0x12')][_0xc4bd('0x14')]);}else{logger[_0xc4bd('0x15')](_0xc4bd('0xe'),_0x5af469,_0xc4bd('0xf'));_0x3dca37(_0x4e078c['result']['message']);}})['catch'](function(_0x55e342){logger[_0xc4bd('0x12')](_0xc4bd('0xe'),_0x5af469,_0x55e342);_0x200be5(_0x55e342);});});}exports[_0xc4bd('0x16')]=function(_0x45d2f8){var _0x3597f0=this;return new Promise(function(_0x5c1716,_0x2fa4a0){return db['VoiceQueueReport']['findAll']({'raw':_0x45d2f8['options']?_0x45d2f8[_0xc4bd('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x45d2f8[_0xc4bd('0x17')]?_0x45d2f8[_0xc4bd('0x17')][_0xc4bd('0x18')]||null:null,'attributes':_0x45d2f8['options']?_0x45d2f8['options'][_0xc4bd('0x19')]||null:null,'limit':_0x45d2f8[_0xc4bd('0x17')]?_0x45d2f8[_0xc4bd('0x17')]['limit']||null:null,'include':_0x45d2f8[_0xc4bd('0x17')]?_0x45d2f8[_0xc4bd('0x17')][_0xc4bd('0x1a')]?_[_0xc4bd('0x1b')](_0x45d2f8[_0xc4bd('0x17')][_0xc4bd('0x1a')],function(_0x45685){return{'model':db[_0x45685[_0xc4bd('0x1c')]],'as':_0x45685['as'],'attributes':_0x45685[_0xc4bd('0x19')],'include':_0x45685[_0xc4bd('0x1a')]?_[_0xc4bd('0x1b')](_0x45685[_0xc4bd('0x1a')],function(_0x460783){return{'model':db[_0x460783[_0xc4bd('0x1c')]],'as':_0x460783['as'],'attributes':_0x460783['attributes'],'include':_0x460783['include']?_[_0xc4bd('0x1b')](_0x460783[_0xc4bd('0x1a')],function(_0xa59a2b){return{'model':db[_0xa59a2b['model']],'as':_0xa59a2b['as'],'attributes':_0xa59a2b[_0xc4bd('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc4bd('0x1d')](function(_0x536ca8){logger[_0xc4bd('0x15')](_0xc4bd('0x16'),_0x45d2f8);logger['debug'](_0xc4bd('0x16'),_0x45d2f8,JSON[_0xc4bd('0x11')](_0x536ca8));_0x5c1716(_0x536ca8);})['catch'](function(_0x35e568){logger[_0xc4bd('0x12')](_0xc4bd('0x16'),_0x35e568[_0xc4bd('0x14')],_0x45d2f8);_0x2fa4a0(_0x3597f0[_0xc4bd('0x12')](0x1f4,_0x35e568[_0xc4bd('0x14')]));});});};exports[_0xc4bd('0x1e')]=function(_0x4f2276){var _0x20ee1d=this;return new Promise(function(_0x25f800,_0x2d44f2){return db[_0xc4bd('0x1f')]['create'](_0x4f2276[_0xc4bd('0x20')],{'raw':_0x4f2276[_0xc4bd('0x17')]?_0x4f2276[_0xc4bd('0x17')][_0xc4bd('0x21')]===undefined?!![]:![]:!![]})[_0xc4bd('0x1d')](function(_0x3fd258){logger[_0xc4bd('0x15')](_0xc4bd('0x1e'),_0x4f2276);logger['debug'](_0xc4bd('0x1e'),_0x4f2276,JSON['stringify'](_0x3fd258));_0x25f800(_0x3fd258);})[_0xc4bd('0x22')](function(_0xe9829){logger[_0xc4bd('0x12')](_0xc4bd('0x1e'),_0xe9829[_0xc4bd('0x14')],_0x4f2276);_0x2d44f2(_0x20ee1d[_0xc4bd('0x12')](0x1f4,_0xe9829[_0xc4bd('0x14')]));});});};exports[_0xc4bd('0x23')]=function(_0xb91736){var _0x2d4c15=this;return new Promise(function(_0x1c7c12,_0x29da8d){return db[_0xc4bd('0x1f')][_0xc4bd('0x24')](_0xb91736[_0xc4bd('0x20')],{'raw':_0xb91736['options']?_0xb91736['options'][_0xc4bd('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb91736[_0xc4bd('0x17')]?_0xb91736[_0xc4bd('0x17')][_0xc4bd('0x18')]||null:null,'attributes':_0xb91736[_0xc4bd('0x17')]?_0xb91736['options'][_0xc4bd('0x19')]||null:null,'limit':_0xb91736[_0xc4bd('0x17')]?_0xb91736[_0xc4bd('0x17')][_0xc4bd('0x25')]||null:null})['then'](function(_0x1f6836){logger['info'](_0xc4bd('0x23'),_0xb91736);logger[_0xc4bd('0x26')](_0xc4bd('0x23'),_0xb91736,JSON['stringify'](_0x1f6836));_0x1c7c12(_0x1f6836);})[_0xc4bd('0x22')](function(_0x1192b1){logger['error'](_0xc4bd('0x23'),_0x1192b1[_0xc4bd('0x14')],_0xb91736);_0x29da8d(_0x2d4c15['error'](0x1f4,_0x1192b1[_0xc4bd('0x14')]));});});}; \ No newline at end of file +var _0xdc98=['then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVoiceQueueReport','VoiceQueueReport','options','where','attributes','limit','include','map','model','stringify','body','raw','CreateVoiceQueueReport','update','UpdateVoiceQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','request'];(function(_0x59e06f,_0x42c0cf){var _0x3606ff=function(_0x32467e){while(--_0x32467e){_0x59e06f['push'](_0x59e06f['shift']());}};_0x3606ff(++_0x42c0cf);}(_0xdc98,0x97));var _0x8dc9=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xdc98[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x8dc9('0x0'));var util=require(_0x8dc9('0x1'));var moment=require(_0x8dc9('0x2'));var BPromise=require(_0x8dc9('0x3'));var rs=require(_0x8dc9('0x4'));var fs=require('fs');var Redis=require(_0x8dc9('0x5'));var db=require(_0x8dc9('0x6'))['db'];var utils=require(_0x8dc9('0x7'));var logger=require('../../config/logger')(_0x8dc9('0x8'));var config=require(_0x8dc9('0x9'));var jayson=require(_0x8dc9('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x8dc9('0xb')](config[_0x8dc9('0xc')],{'host':_0x8dc9('0xd'),'port':0x18eb});var socket=require(_0x8dc9('0xe'))(new Redis(config[_0x8dc9('0xc')]));require(_0x8dc9('0xf'))['register'](socket);function respondWithRpcPromise(_0x2f3fd9,_0x1535a5,_0x449acf){return new BPromise(function(_0xe94d97,_0x39309a){return client[_0x8dc9('0x10')](_0x2f3fd9,_0x449acf)[_0x8dc9('0x11')](function(_0x316b08){logger[_0x8dc9('0x12')](_0x8dc9('0x13'),_0x1535a5,_0x8dc9('0x14'));logger[_0x8dc9('0x15')](_0x8dc9('0x16'),_0x1535a5,_0x8dc9('0x14'),JSON['stringify'](_0x316b08));if(_0x316b08[_0x8dc9('0x17')]){if(_0x316b08['error'][_0x8dc9('0x18')]===0x1f4){logger[_0x8dc9('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x1535a5,_0x316b08[_0x8dc9('0x17')][_0x8dc9('0x19')]);return _0x39309a(_0x316b08[_0x8dc9('0x17')][_0x8dc9('0x19')]);}logger[_0x8dc9('0x17')]('VoiceQueueReport,\x20%s,\x20%s',_0x1535a5,_0x316b08[_0x8dc9('0x17')][_0x8dc9('0x19')]);return _0xe94d97(_0x316b08[_0x8dc9('0x17')]['message']);}else{logger[_0x8dc9('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x1535a5,_0x8dc9('0x14'));_0xe94d97(_0x316b08['result'][_0x8dc9('0x19')]);}})[_0x8dc9('0x1a')](function(_0x4d8794){logger[_0x8dc9('0x17')](_0x8dc9('0x13'),_0x1535a5,_0x4d8794);_0x39309a(_0x4d8794);});});}exports[_0x8dc9('0x1b')]=function(_0x140755){var _0x2724e8=this;return new Promise(function(_0x41f7fc,_0x46dfcc){return db[_0x8dc9('0x1c')]['findAll']({'raw':_0x140755['options']?_0x140755[_0x8dc9('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x140755[_0x8dc9('0x1d')]?_0x140755[_0x8dc9('0x1d')][_0x8dc9('0x1e')]||null:null,'attributes':_0x140755[_0x8dc9('0x1d')]?_0x140755[_0x8dc9('0x1d')][_0x8dc9('0x1f')]||null:null,'limit':_0x140755[_0x8dc9('0x1d')]?_0x140755[_0x8dc9('0x1d')][_0x8dc9('0x20')]||null:null,'include':_0x140755[_0x8dc9('0x1d')]?_0x140755[_0x8dc9('0x1d')][_0x8dc9('0x21')]?_[_0x8dc9('0x22')](_0x140755[_0x8dc9('0x1d')][_0x8dc9('0x21')],function(_0x548ffb){return{'model':db[_0x548ffb[_0x8dc9('0x23')]],'as':_0x548ffb['as'],'attributes':_0x548ffb[_0x8dc9('0x1f')],'include':_0x548ffb[_0x8dc9('0x21')]?_[_0x8dc9('0x22')](_0x548ffb[_0x8dc9('0x21')],function(_0x171512){return{'model':db[_0x171512[_0x8dc9('0x23')]],'as':_0x171512['as'],'attributes':_0x171512[_0x8dc9('0x1f')],'include':_0x171512[_0x8dc9('0x21')]?_[_0x8dc9('0x22')](_0x171512['include'],function(_0x1baceb){return{'model':db[_0x1baceb['model']],'as':_0x1baceb['as'],'attributes':_0x1baceb[_0x8dc9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x8dc9('0x11')](function(_0x554470){logger[_0x8dc9('0x12')](_0x8dc9('0x1b'),_0x140755);logger['debug'](_0x8dc9('0x1b'),_0x140755,JSON[_0x8dc9('0x24')](_0x554470));_0x41f7fc(_0x554470);})[_0x8dc9('0x1a')](function(_0x1ff2ae){logger['error']('GetVoiceQueueReport',_0x1ff2ae[_0x8dc9('0x19')],_0x140755);_0x46dfcc(_0x2724e8[_0x8dc9('0x17')](0x1f4,_0x1ff2ae[_0x8dc9('0x19')]));});});};exports['CreateVoiceQueueReport']=function(_0x3034bd){var _0x18c6a3=this;return new Promise(function(_0xe4b642,_0x3e25b5){return db[_0x8dc9('0x1c')]['create'](_0x3034bd[_0x8dc9('0x25')],{'raw':_0x3034bd['options']?_0x3034bd[_0x8dc9('0x1d')][_0x8dc9('0x26')]===undefined?!![]:![]:!![]})['then'](function(_0x41969e){logger[_0x8dc9('0x12')]('CreateVoiceQueueReport',_0x3034bd);logger['debug'](_0x8dc9('0x27'),_0x3034bd,JSON[_0x8dc9('0x24')](_0x41969e));_0xe4b642(_0x41969e);})[_0x8dc9('0x1a')](function(_0x524dce){logger[_0x8dc9('0x17')](_0x8dc9('0x27'),_0x524dce[_0x8dc9('0x19')],_0x3034bd);_0x3e25b5(_0x18c6a3[_0x8dc9('0x17')](0x1f4,_0x524dce[_0x8dc9('0x19')]));});});};exports['UpdateVoiceQueueReport']=function(_0x56f4b0){var _0x278478=this;return new Promise(function(_0xac6c14,_0x13fe7e){return db['VoiceQueueReport'][_0x8dc9('0x28')](_0x56f4b0[_0x8dc9('0x25')],{'raw':_0x56f4b0[_0x8dc9('0x1d')]?_0x56f4b0['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56f4b0['options']?_0x56f4b0[_0x8dc9('0x1d')][_0x8dc9('0x1e')]||null:null,'attributes':_0x56f4b0[_0x8dc9('0x1d')]?_0x56f4b0['options']['attributes']||null:null,'limit':_0x56f4b0['options']?_0x56f4b0[_0x8dc9('0x1d')]['limit']||null:null})[_0x8dc9('0x11')](function(_0x12f0ac){logger[_0x8dc9('0x12')](_0x8dc9('0x29'),_0x56f4b0);logger['debug'](_0x8dc9('0x29'),_0x56f4b0,JSON[_0x8dc9('0x24')](_0x12f0ac));_0xac6c14(_0x12f0ac);})[_0x8dc9('0x1a')](function(_0x591774){logger[_0x8dc9('0x17')](_0x8dc9('0x29'),_0x591774[_0x8dc9('0x19')],_0x56f4b0);_0x13fe7e(_0x278478['error'](0x1f4,_0x591774[_0x8dc9('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index b03290b..b1a4c8f 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 _0x43b6=['length','./voiceQueueReport.events','update','removeListener'];(function(_0x478e72,_0x564ffe){var _0x2dc54b=function(_0x173a52){while(--_0x173a52){_0x478e72['push'](_0x478e72['shift']());}};_0x2dc54b(++_0x564ffe);}(_0x43b6,0x85));var _0x643b=function(_0xa5d9f9,_0x17c6bf){_0xa5d9f9=_0xa5d9f9-0x0;var _0x40e9f6=_0x43b6[_0xa5d9f9];return _0x40e9f6;};'use strict';var VoiceQueueReportEvents=require(_0x643b('0x0'));var events=['save','remove',_0x643b('0x1')];function createListener(_0x36bf4a,_0x389f58){return function(_0x42a7a7){_0x389f58['emit'](_0x36bf4a,_0x42a7a7);};}function removeListener(_0x51a6c9,_0x46a862){return function(){VoiceQueueReportEvents[_0x643b('0x2')](_0x51a6c9,_0x46a862);};}exports['register']=function(_0x5c6afa){for(var _0x54144b=0x0,_0x18aacd=events[_0x643b('0x3')];_0x54144b<_0x18aacd;_0x54144b++){var _0x213fd7=events[_0x54144b];var _0x29fe82=createListener('voiceQueueReport:'+_0x213fd7,_0x5c6afa);VoiceQueueReportEvents['on'](_0x213fd7,_0x29fe82);}}; \ No newline at end of file +var _0x5b3b=['voiceQueueReport:','./voiceQueueReport.events','save','update','emit','length'];(function(_0x34eafd,_0x1118a3){var _0x3df0ee=function(_0x1ae4c1){while(--_0x1ae4c1){_0x34eafd['push'](_0x34eafd['shift']());}};_0x3df0ee(++_0x1118a3);}(_0x5b3b,0x7f));var _0xb5b3=function(_0x1f9750,_0x351f93){_0x1f9750=_0x1f9750-0x0;var _0x29f18b=_0x5b3b[_0x1f9750];return _0x29f18b;};'use strict';var VoiceQueueReportEvents=require(_0xb5b3('0x0'));var events=[_0xb5b3('0x1'),'remove',_0xb5b3('0x2')];function createListener(_0x5532f2,_0x32775c){return function(_0x431d3e){_0x32775c[_0xb5b3('0x3')](_0x5532f2,_0x431d3e);};}function removeListener(_0x1c2edd,_0xc7bb4b){return function(){VoiceQueueReportEvents['removeListener'](_0x1c2edd,_0xc7bb4b);};}exports['register']=function(_0x44148e){for(var _0x1243d3=0x0,_0xba4d95=events[_0xb5b3('0x4')];_0x1243d3<_0xba4d95;_0x1243d3++){var _0x3020e3=events[_0x1243d3];var _0x6b7535=createListener(_0xb5b3('0x5')+_0x3020e3,_0x44148e);VoiceQueueReportEvents['on'](_0x3020e3,_0x6b7535);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 4d59392..98fa0f9 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 _0x9a04=['create','/:id','update','delete','destroy','exports','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index','isAuthenticated','show','post'];(function(_0x5bc32b,_0x2f1215){var _0x12bd43=function(_0x4d8117){while(--_0x4d8117){_0x5bc32b['push'](_0x5bc32b['shift']());}};_0x12bd43(++_0x2f1215);}(_0x9a04,0x1af));var _0x49a0=function(_0x2da956,_0x16ddff){_0x2da956=_0x2da956-0x0;var _0x461e6d=_0x9a04[_0x2da956];return _0x461e6d;};'use strict';var multer=require('multer');var util=require(_0x49a0('0x0'));var path=require(_0x49a0('0x1'));var timeout=require(_0x49a0('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x49a0('0x3'));var config=require(_0x49a0('0x4'));var controller=require(_0x49a0('0x5'));router[_0x49a0('0x6')]('/',auth['isAuthenticated'](),controller[_0x49a0('0x7')]);router[_0x49a0('0x6')]('/:id',auth[_0x49a0('0x8')](),controller[_0x49a0('0x9')]);router[_0x49a0('0xa')]('/',auth[_0x49a0('0x8')](),controller[_0x49a0('0xb')]);router['put'](_0x49a0('0xc'),auth['isAuthenticated'](),controller[_0x49a0('0xd')]);router[_0x49a0('0xe')](_0x49a0('0xc'),auth[_0x49a0('0x8')](),controller[_0x49a0('0xf')]);module[_0x49a0('0x10')]=router; \ No newline at end of file +var _0xee95=['isAuthenticated','index','/:id','post','put','update','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get'];(function(_0x156c72,_0x2e6358){var _0x453dc7=function(_0x9b5b5b){while(--_0x9b5b5b){_0x156c72['push'](_0x156c72['shift']());}};_0x453dc7(++_0x2e6358);}(_0xee95,0x129));var _0x5ee9=function(_0x58b2fe,_0x264474){_0x58b2fe=_0x58b2fe-0x0;var _0x458a88=_0xee95[_0x58b2fe];return _0x458a88;};'use strict';var multer=require(_0x5ee9('0x0'));var util=require('util');var path=require(_0x5ee9('0x1'));var timeout=require('connect-timeout');var express=require(_0x5ee9('0x2'));var router=express[_0x5ee9('0x3')]();var auth=require(_0x5ee9('0x4'));var interaction=require(_0x5ee9('0x5'));var config=require(_0x5ee9('0x6'));var controller=require(_0x5ee9('0x7'));router[_0x5ee9('0x8')]('/',auth[_0x5ee9('0x9')](),controller[_0x5ee9('0xa')]);router[_0x5ee9('0x8')](_0x5ee9('0xb'),auth[_0x5ee9('0x9')](),controller['show']);router[_0x5ee9('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5ee9('0xd')](_0x5ee9('0xb'),auth[_0x5ee9('0x9')](),controller[_0x5ee9('0xe')]);router['delete'](_0x5ee9('0xb'),auth[_0x5ee9('0x9')](),controller[_0x5ee9('0xf')]);module[_0x5ee9('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 70057e6..c5ded4f 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 _0xc641=['exports','STRING','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xc641,0x13c));var _0x1c64=function(_0x567782,_0x532f02){_0x567782=_0x567782-0x0;var _0x445d6c=_0xc641[_0x567782];return _0x445d6c;};'use strict';var Sequelize=require(_0x1c64('0x0'));var moment=require(_0x1c64('0x1'));module[_0x1c64('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x1c64('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x1c64('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x1c64('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x1c64('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x1c64('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x1c64('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x1c64('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x1c64('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x1c64('0x4')](_0x1c64('0x5'))}}; \ No newline at end of file +var _0xae9e=['DATE','format','sequelize','exports','STRING'];(function(_0x7d4ab0,_0x42c6c9){var _0x28a18b=function(_0x2450ab){while(--_0x2450ab){_0x7d4ab0['push'](_0x7d4ab0['shift']());}};_0x28a18b(++_0x42c6c9);}(_0xae9e,0xb1));var _0xeae9=function(_0x57a7a0,_0x372b65){_0x57a7a0=_0x57a7a0-0x0;var _0x4b4580=_0xae9e[_0x57a7a0];return _0x4b4580;};'use strict';var Sequelize=require(_0xeae9('0x0'));var moment=require('moment');module[_0xeae9('0x1')]={'time':{'type':Sequelize[_0xeae9('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xeae9('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xeae9('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xeae9('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xeae9('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xeae9('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xeae9('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xeae9('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xeae9('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xeae9('0x3')],'allowNull':![],'defaultValue':moment()[_0xeae9('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 112d7e9..68af73b 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 _0x6753=['json','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','pick','where','merge','VIRTUAL','options','includeAll','catch','show','params','include','find','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x5a7d9e,_0x4ae29e){var _0x1b2361=function(_0x5339ee){while(--_0x5339ee){_0x5a7d9e['push'](_0x5a7d9e['shift']());}};_0x1b2361(++_0x4ae29e);}(_0x6753,0x1a0));var _0x3675=function(_0xed37a0,_0x30ccff){_0xed37a0=_0xed37a0-0x0;var _0x271d9c=_0x6753[_0xed37a0];return _0x271d9c;};'use strict';var pdf=require(_0x3675('0x0'));var emlformat=require(_0x3675('0x1'));var rimraf=require(_0x3675('0x2'));var zipdir=require(_0x3675('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3675('0x4'));var moment=require(_0x3675('0x5'));var BPromise=require(_0x3675('0x6'));var Mustache=require(_0x3675('0x7'));var util=require('util');var path=require('path');var sox=require(_0x3675('0x8'));var csv=require(_0x3675('0x9'));var ejs=require(_0x3675('0xa'));var fs=require('fs');var _=require(_0x3675('0xb'));var squel=require(_0x3675('0xc'));var crypto=require(_0x3675('0xd'));var jsforce=require(_0x3675('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3675('0x9'));var querystring=require(_0x3675('0xf'));var Papa=require(_0x3675('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3675('0x11'));var as=require(_0x3675('0x12'));var hardwareService=require(_0x3675('0x13'));var logger=require(_0x3675('0x14'))(_0x3675('0x15'));var utils=require(_0x3675('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3675('0x17'));var db=require(_0x3675('0x18'))['db'];function respondWithStatusCode(_0x1ea1ad,_0x4f5ef9){_0x4f5ef9=_0x4f5ef9||0xcc;return function(_0x4e84e0){if(_0x4e84e0){return _0x1ea1ad[_0x3675('0x19')](_0x4f5ef9);}return _0x1ea1ad[_0x3675('0x1a')](_0x4f5ef9)[_0x3675('0x1b')]();};}function respondWithResult(_0x4c0afd,_0x1ba1c){_0x1ba1c=_0x1ba1c||0xc8;return function(_0x503afb){if(_0x503afb){return _0x4c0afd[_0x3675('0x1a')](_0x1ba1c)[_0x3675('0x1c')](_0x503afb);}};}function respondWithFilteredResult(_0x152458,_0x18c36a){return function(_0x2408bd){if(_0x2408bd){var _0x16f296=_0x2408bd[_0x3675('0x1d')],_0x3b6d70=_0x18c36a[_0x3675('0x1e')],_0x3af5a4=_0x18c36a['offset']+_0x18c36a['limit'],_0x5b63b8;if(_0x3af5a4>=_0x16f296){_0x3af5a4=_0x16f296;_0x5b63b8=0xc8;}else{_0x5b63b8=0xce;}_0x152458[_0x3675('0x1a')](_0x5b63b8);return _0x152458[_0x3675('0x1f')](_0x3675('0x20'),_0x3b6d70+'-'+_0x3af5a4+'/'+_0x16f296)[_0x3675('0x1c')](_0x2408bd);}return null;};}function patchUpdates(_0x5c1dea){return function(_0x4eda6a){try{jsonpatch[_0x3675('0x21')](_0x4eda6a,_0x5c1dea,!![]);}catch(_0x2d4d90){return BPromise[_0x3675('0x22')](_0x2d4d90);}return _0x4eda6a[_0x3675('0x23')]();};}function saveUpdates(_0x24293d,_0x13ef3b){return function(_0x3e33b0){if(_0x3e33b0){return _0x3e33b0[_0x3675('0x24')](_0x24293d)[_0x3675('0x25')](function(_0xe4751c){return _0xe4751c;});}return null;};}function removeEntity(_0x317238,_0x565f14){return function(_0x2ede8c){if(_0x2ede8c){return _0x2ede8c['destroy']()['then'](function(){_0x317238[_0x3675('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40543f,_0x511696){return function(_0x278849){if(!_0x278849){_0x40543f[_0x3675('0x19')](0x194);}return _0x278849;};}function handleError(_0x4de85a,_0x1b12a6){_0x1b12a6=_0x1b12a6||0x1f4;return function(_0x141594){logger[_0x3675('0x26')](_0x141594[_0x3675('0x27')]);if(_0x141594[_0x3675('0x28')]){delete _0x141594['name'];}_0x4de85a[_0x3675('0x1a')](_0x1b12a6)[_0x3675('0x29')](_0x141594);};}exports[_0x3675('0x2a')]=function(_0x2be788,_0x337c17){var _0x2793c9={},_0x4b9226={},_0x2e66af={'count':0x0,'rows':[]};var _0xa4bba4=_[_0x3675('0x2b')](db[_0x3675('0x2c')][_0x3675('0x2d')],function(_0x231bfc){return{'name':_0x231bfc[_0x3675('0x2e')],'type':_0x231bfc[_0x3675('0x2f')][_0x3675('0x30')]};});_0x4b9226[_0x3675('0x31')]=_[_0x3675('0x2b')](_0xa4bba4,'name');_0x4b9226[_0x3675('0x32')]=_[_0x3675('0x33')](_0x2be788[_0x3675('0x32')]);_0x4b9226[_0x3675('0x34')]=_[_0x3675('0x35')](_0x4b9226[_0x3675('0x31')],_0x4b9226['query']);_0x2793c9[_0x3675('0x36')]=_[_0x3675('0x35')](_0x4b9226[_0x3675('0x31')],qs['fields'](_0x2be788[_0x3675('0x32')][_0x3675('0x37')]));_0x2793c9[_0x3675('0x36')]=_0x2793c9[_0x3675('0x36')][_0x3675('0x38')]?_0x2793c9[_0x3675('0x36')]:_0x4b9226['model'];if(!_0x2be788[_0x3675('0x32')][_0x3675('0x39')](_0x3675('0x3a'))){_0x2793c9[_0x3675('0x3b')]=qs['limit'](_0x2be788[_0x3675('0x32')][_0x3675('0x3b')]);_0x2793c9[_0x3675('0x1e')]=qs[_0x3675('0x1e')](_0x2be788[_0x3675('0x32')][_0x3675('0x1e')]);}_0x2793c9[_0x3675('0x3c')]=qs['sort'](_0x2be788[_0x3675('0x32')]['sort']);_0x2793c9['where']=qs[_0x3675('0x34')](_[_0x3675('0x3d')](_0x2be788[_0x3675('0x32')],_0x4b9226['filters']),_0xa4bba4);if(_0x2be788['query']['filter']){_0x2793c9[_0x3675('0x3e')]=_[_0x3675('0x3f')](_0x2793c9[_0x3675('0x3e')],{'$or':_[_0x3675('0x2b')](_0xa4bba4,function(_0x307f35){if(_0x307f35[_0x3675('0x2f')]!==_0x3675('0x40')){var _0x4b7895={};_0x4b7895[_0x307f35[_0x3675('0x28')]]={'$like':'%'+_0x2be788[_0x3675('0x32')]['filter']+'%'};return _0x4b7895;}})});}_0x2793c9=_[_0x3675('0x3f')]({},_0x2793c9,_0x2be788[_0x3675('0x41')]);var _0x43539e={'where':_0x2793c9[_0x3675('0x3e')]};return db[_0x3675('0x2c')]['count'](_0x43539e)[_0x3675('0x25')](function(_0x443d72){_0x2e66af[_0x3675('0x1d')]=_0x443d72;if(_0x2be788['query'][_0x3675('0x42')]){_0x2793c9['include']=[{'all':!![]}];}return db[_0x3675('0x2c')]['findAll'](_0x2793c9);})[_0x3675('0x25')](function(_0x161593){_0x2e66af['rows']=_0x161593;return _0x2e66af;})[_0x3675('0x25')](respondWithFilteredResult(_0x337c17,_0x2793c9))[_0x3675('0x43')](handleError(_0x337c17,null));};exports[_0x3675('0x44')]=function(_0x303235,_0x1b830a){var _0x478e45={'raw':!![],'where':{'id':_0x303235[_0x3675('0x45')]['id']}},_0x292fff={};_0x292fff[_0x3675('0x31')]=_[_0x3675('0x33')](db[_0x3675('0x2c')][_0x3675('0x2d')]);_0x292fff[_0x3675('0x32')]=_[_0x3675('0x33')](_0x303235[_0x3675('0x32')]);_0x292fff[_0x3675('0x34')]=_[_0x3675('0x35')](_0x292fff[_0x3675('0x31')],_0x292fff[_0x3675('0x32')]);_0x478e45[_0x3675('0x36')]=_[_0x3675('0x35')](_0x292fff['model'],qs[_0x3675('0x37')](_0x303235[_0x3675('0x32')][_0x3675('0x37')]));_0x478e45['attributes']=_0x478e45[_0x3675('0x36')]['length']?_0x478e45[_0x3675('0x36')]:_0x292fff[_0x3675('0x31')];if(_0x303235[_0x3675('0x32')][_0x3675('0x42')]){_0x478e45[_0x3675('0x46')]=[{'all':!![]}];}_0x478e45=_['merge']({},_0x478e45,_0x303235['options']);return db[_0x3675('0x2c')][_0x3675('0x47')](_0x478e45)[_0x3675('0x25')](handleEntityNotFound(_0x1b830a,null))[_0x3675('0x25')](respondWithResult(_0x1b830a,null))[_0x3675('0x43')](handleError(_0x1b830a,null));};exports[_0x3675('0x48')]=function(_0x14cd0d,_0x4d5167){return db[_0x3675('0x2c')][_0x3675('0x48')](_0x14cd0d[_0x3675('0x49')],{})[_0x3675('0x25')](respondWithResult(_0x4d5167,0xc9))[_0x3675('0x43')](handleError(_0x4d5167,null));};exports['update']=function(_0x437c6d,_0x2897cd){if(_0x437c6d[_0x3675('0x49')]['id']){delete _0x437c6d[_0x3675('0x49')]['id'];}return db[_0x3675('0x2c')][_0x3675('0x47')]({'where':{'id':_0x437c6d[_0x3675('0x45')]['id']}})['then'](handleEntityNotFound(_0x2897cd,null))['then'](saveUpdates(_0x437c6d[_0x3675('0x49')],null))['then'](respondWithResult(_0x2897cd,null))[_0x3675('0x43')](handleError(_0x2897cd,null));};exports['destroy']=function(_0x15241a,_0x5463ae){return db['VoiceQueuesLog'][_0x3675('0x47')]({'where':{'id':_0x15241a['params']['id']}})['then'](handleEntityNotFound(_0x5463ae,null))['then'](removeEntity(_0x5463ae,null))[_0x3675('0x43')](handleError(_0x5463ae,null));}; \ No newline at end of file +var _0xb7d6=['findAll','rows','catch','show','create','body','find','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','count','offset','status','set','Content-Range','reject','update','destroy','end','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','VoiceQueuesLog','then','includeAll','include'];(function(_0x3e151d,_0x5996b1){var _0x5957db=function(_0x44edb9){while(--_0x44edb9){_0x3e151d['push'](_0x3e151d['shift']());}};_0x5957db(++_0x5996b1);}(_0xb7d6,0x189));var _0x6b7d=function(_0x5d0218,_0x51ccc6){_0x5d0218=_0x5d0218-0x0;var _0x5a1644=_0xb7d6[_0x5d0218];return _0x5a1644;};'use strict';var pdf=require(_0x6b7d('0x0'));var emlformat=require(_0x6b7d('0x1'));var rimraf=require(_0x6b7d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6b7d('0x3'));var rp=require(_0x6b7d('0x4'));var moment=require(_0x6b7d('0x5'));var BPromise=require(_0x6b7d('0x6'));var Mustache=require(_0x6b7d('0x7'));var util=require(_0x6b7d('0x8'));var path=require(_0x6b7d('0x9'));var sox=require(_0x6b7d('0xa'));var csv=require(_0x6b7d('0xb'));var ejs=require(_0x6b7d('0xc'));var fs=require('fs');var _=require(_0x6b7d('0xd'));var squel=require('squel');var crypto=require(_0x6b7d('0xe'));var jsforce=require(_0x6b7d('0xf'));var deskjs=require(_0x6b7d('0x10'));var toCsv=require(_0x6b7d('0xb'));var querystring=require(_0x6b7d('0x11'));var Papa=require('papaparse');var Redis=require(_0x6b7d('0x12'));var authService=require(_0x6b7d('0x13'));var qs=require(_0x6b7d('0x14'));var as=require(_0x6b7d('0x15'));var hardwareService=require(_0x6b7d('0x16'));var logger=require(_0x6b7d('0x17'))(_0x6b7d('0x18'));var utils=require(_0x6b7d('0x19'));var config=require(_0x6b7d('0x1a'));var licenseUtil=require(_0x6b7d('0x1b'));var db=require(_0x6b7d('0x1c'))['db'];function respondWithStatusCode(_0x21d85e,_0x5ad7da){_0x5ad7da=_0x5ad7da||0xcc;return function(_0x1f32d3){if(_0x1f32d3){return _0x21d85e[_0x6b7d('0x1d')](_0x5ad7da);}return _0x21d85e['status'](_0x5ad7da)['end']();};}function respondWithResult(_0x32a183,_0x4f7975){_0x4f7975=_0x4f7975||0xc8;return function(_0x3078b8){if(_0x3078b8){return _0x32a183['status'](_0x4f7975)[_0x6b7d('0x1e')](_0x3078b8);}};}function respondWithFilteredResult(_0x41b31d,_0x5967a3){return function(_0x5dcf2e){if(_0x5dcf2e){var _0x1ead64=_0x5dcf2e[_0x6b7d('0x1f')],_0x318013=_0x5967a3['offset'],_0x4be6ce=_0x5967a3[_0x6b7d('0x20')]+_0x5967a3['limit'],_0x31b031;if(_0x4be6ce>=_0x1ead64){_0x4be6ce=_0x1ead64;_0x31b031=0xc8;}else{_0x31b031=0xce;}_0x41b31d[_0x6b7d('0x21')](_0x31b031);return _0x41b31d[_0x6b7d('0x22')](_0x6b7d('0x23'),_0x318013+'-'+_0x4be6ce+'/'+_0x1ead64)[_0x6b7d('0x1e')](_0x5dcf2e);}return null;};}function patchUpdates(_0x5103af){return function(_0x1cad91){try{jsonpatch['apply'](_0x1cad91,_0x5103af,!![]);}catch(_0x184353){return BPromise[_0x6b7d('0x24')](_0x184353);}return _0x1cad91['save']();};}function saveUpdates(_0x26a7ed,_0x53352a){return function(_0x3b2bdb){if(_0x3b2bdb){return _0x3b2bdb[_0x6b7d('0x25')](_0x26a7ed)['then'](function(_0x44119b){return _0x44119b;});}return null;};}function removeEntity(_0x44d478,_0x38e2ed){return function(_0x4a9189){if(_0x4a9189){return _0x4a9189[_0x6b7d('0x26')]()['then'](function(){_0x44d478['status'](0xcc)[_0x6b7d('0x27')]();});}};}function handleEntityNotFound(_0x482d68,_0x5314aa){return function(_0x56295d){if(!_0x56295d){_0x482d68['sendStatus'](0x194);}return _0x56295d;};}function handleError(_0x3bde04,_0x3b58aa){_0x3b58aa=_0x3b58aa||0x1f4;return function(_0x4ac3ee){logger[_0x6b7d('0x28')](_0x4ac3ee[_0x6b7d('0x29')]);if(_0x4ac3ee[_0x6b7d('0x2a')]){delete _0x4ac3ee[_0x6b7d('0x2a')];}_0x3bde04[_0x6b7d('0x21')](_0x3b58aa)['send'](_0x4ac3ee);};}exports[_0x6b7d('0x2b')]=function(_0x58df03,_0x5640d6){var _0x26f7bc={},_0x42ae4b={},_0x289df4={'count':0x0,'rows':[]};var _0x48edf8=_[_0x6b7d('0x2c')](db['VoiceQueuesLog'][_0x6b7d('0x2d')],function(_0x458fb2){return{'name':_0x458fb2[_0x6b7d('0x2e')],'type':_0x458fb2['type'][_0x6b7d('0x2f')]};});_0x42ae4b[_0x6b7d('0x30')]=_[_0x6b7d('0x2c')](_0x48edf8,_0x6b7d('0x2a'));_0x42ae4b[_0x6b7d('0x31')]=_[_0x6b7d('0x32')](_0x58df03[_0x6b7d('0x31')]);_0x42ae4b['filters']=_[_0x6b7d('0x33')](_0x42ae4b[_0x6b7d('0x30')],_0x42ae4b[_0x6b7d('0x31')]);_0x26f7bc['attributes']=_[_0x6b7d('0x33')](_0x42ae4b[_0x6b7d('0x30')],qs[_0x6b7d('0x34')](_0x58df03['query']['fields']));_0x26f7bc[_0x6b7d('0x35')]=_0x26f7bc[_0x6b7d('0x35')][_0x6b7d('0x36')]?_0x26f7bc[_0x6b7d('0x35')]:_0x42ae4b[_0x6b7d('0x30')];if(!_0x58df03['query']['hasOwnProperty'](_0x6b7d('0x37'))){_0x26f7bc['limit']=qs['limit'](_0x58df03['query']['limit']);_0x26f7bc[_0x6b7d('0x20')]=qs[_0x6b7d('0x20')](_0x58df03[_0x6b7d('0x31')][_0x6b7d('0x20')]);}_0x26f7bc[_0x6b7d('0x38')]=qs[_0x6b7d('0x39')](_0x58df03[_0x6b7d('0x31')][_0x6b7d('0x39')]);_0x26f7bc[_0x6b7d('0x3a')]=qs['filters'](_[_0x6b7d('0x3b')](_0x58df03[_0x6b7d('0x31')],_0x42ae4b['filters']),_0x48edf8);if(_0x58df03[_0x6b7d('0x31')][_0x6b7d('0x3c')]){_0x26f7bc[_0x6b7d('0x3a')]=_[_0x6b7d('0x3d')](_0x26f7bc[_0x6b7d('0x3a')],{'$or':_['map'](_0x48edf8,function(_0x2f7115){if(_0x2f7115[_0x6b7d('0x3e')]!==_0x6b7d('0x3f')){var _0x43ccfe={};_0x43ccfe[_0x2f7115['name']]={'$like':'%'+_0x58df03[_0x6b7d('0x31')][_0x6b7d('0x3c')]+'%'};return _0x43ccfe;}})});}_0x26f7bc=_[_0x6b7d('0x3d')]({},_0x26f7bc,_0x58df03[_0x6b7d('0x40')]);var _0x483105={'where':_0x26f7bc['where']};return db[_0x6b7d('0x41')][_0x6b7d('0x1f')](_0x483105)[_0x6b7d('0x42')](function(_0x1daa43){_0x289df4[_0x6b7d('0x1f')]=_0x1daa43;if(_0x58df03[_0x6b7d('0x31')][_0x6b7d('0x43')]){_0x26f7bc[_0x6b7d('0x44')]=[{'all':!![]}];}return db[_0x6b7d('0x41')][_0x6b7d('0x45')](_0x26f7bc);})[_0x6b7d('0x42')](function(_0x5171bf){_0x289df4[_0x6b7d('0x46')]=_0x5171bf;return _0x289df4;})['then'](respondWithFilteredResult(_0x5640d6,_0x26f7bc))[_0x6b7d('0x47')](handleError(_0x5640d6,null));};exports[_0x6b7d('0x48')]=function(_0x53d116,_0x1a79b9){var _0x310606={'raw':!![],'where':{'id':_0x53d116['params']['id']}},_0xb4aa1c={};_0xb4aa1c[_0x6b7d('0x30')]=_[_0x6b7d('0x32')](db[_0x6b7d('0x41')]['rawAttributes']);_0xb4aa1c[_0x6b7d('0x31')]=_[_0x6b7d('0x32')](_0x53d116[_0x6b7d('0x31')]);_0xb4aa1c['filters']=_[_0x6b7d('0x33')](_0xb4aa1c[_0x6b7d('0x30')],_0xb4aa1c['query']);_0x310606[_0x6b7d('0x35')]=_[_0x6b7d('0x33')](_0xb4aa1c[_0x6b7d('0x30')],qs[_0x6b7d('0x34')](_0x53d116[_0x6b7d('0x31')][_0x6b7d('0x34')]));_0x310606[_0x6b7d('0x35')]=_0x310606[_0x6b7d('0x35')][_0x6b7d('0x36')]?_0x310606[_0x6b7d('0x35')]:_0xb4aa1c[_0x6b7d('0x30')];if(_0x53d116[_0x6b7d('0x31')][_0x6b7d('0x43')]){_0x310606[_0x6b7d('0x44')]=[{'all':!![]}];}_0x310606=_[_0x6b7d('0x3d')]({},_0x310606,_0x53d116[_0x6b7d('0x40')]);return db[_0x6b7d('0x41')]['find'](_0x310606)[_0x6b7d('0x42')](handleEntityNotFound(_0x1a79b9,null))[_0x6b7d('0x42')](respondWithResult(_0x1a79b9,null))[_0x6b7d('0x47')](handleError(_0x1a79b9,null));};exports[_0x6b7d('0x49')]=function(_0x3a35e0,_0x3be7d3){return db['VoiceQueuesLog'][_0x6b7d('0x49')](_0x3a35e0[_0x6b7d('0x4a')],{})['then'](respondWithResult(_0x3be7d3,0xc9))['catch'](handleError(_0x3be7d3,null));};exports[_0x6b7d('0x25')]=function(_0x5800c7,_0x34340e){if(_0x5800c7['body']['id']){delete _0x5800c7['body']['id'];}return db['VoiceQueuesLog'][_0x6b7d('0x4b')]({'where':{'id':_0x5800c7[_0x6b7d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x34340e,null))[_0x6b7d('0x42')](saveUpdates(_0x5800c7[_0x6b7d('0x4a')],null))[_0x6b7d('0x42')](respondWithResult(_0x34340e,null))[_0x6b7d('0x47')](handleError(_0x34340e,null));};exports[_0x6b7d('0x26')]=function(_0x4cf6c6,_0x2229ca){return db[_0x6b7d('0x41')]['find']({'where':{'id':_0x4cf6c6[_0x6b7d('0x4c')]['id']}})[_0x6b7d('0x42')](handleEntityNotFound(_0x2229ca,null))['then'](removeEntity(_0x2229ca,null))['catch'](handleError(_0x2229ca,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 507512a..3614813 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 _0xd3c3=['event','dtm','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd3c3,0x182));var _0x3d3c=function(_0x1a31e9,_0x433ac0){_0x1a31e9=_0x1a31e9-0x0;var _0x87e8a0=_0xd3c3[_0x1a31e9];return _0x87e8a0;};'use strict';var _=require(_0x3d3c('0x0'));var util=require('util');var logger=require(_0x3d3c('0x1'))(_0x3d3c('0x2'));var moment=require(_0x3d3c('0x3'));var BPromise=require(_0x3d3c('0x4'));var rp=require(_0x3d3c('0x5'));var fs=require('fs');var path=require(_0x3d3c('0x6'));var rimraf=require(_0x3d3c('0x7'));var config=require('../../config/environment');var attributes=require(_0x3d3c('0x8'));module[_0x3d3c('0x9')]=function(_0x26c044,_0x1df5da){return _0x26c044[_0x3d3c('0xa')](_0x3d3c('0xb'),attributes,{'tableName':_0x3d3c('0xc'),'paranoid':![],'indexes':[{'name':_0x3d3c('0xd'),'fields':[_0x3d3c('0xe'),_0x3d3c('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x4761=['event_dtm','event','dtm','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','voice_queues_log'];(function(_0x1007dc,_0x480115){var _0x5d0bcf=function(_0x2d6b38){while(--_0x2d6b38){_0x1007dc['push'](_0x1007dc['shift']());}};_0x5d0bcf(++_0x480115);}(_0x4761,0x1bb));var _0x1476=function(_0x1d3694,_0x1ec35c){_0x1d3694=_0x1d3694-0x0;var _0x44361b=_0x4761[_0x1d3694];return _0x44361b;};'use strict';var _=require('lodash');var util=require(_0x1476('0x0'));var logger=require(_0x1476('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1476('0x2'));var rp=require(_0x1476('0x3'));var fs=require('fs');var path=require(_0x1476('0x4'));var rimraf=require(_0x1476('0x5'));var config=require(_0x1476('0x6'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x1a135d,_0x44ef6e){return _0x1a135d['define']('VoiceQueuesLog',attributes,{'tableName':_0x1476('0x7'),'paranoid':![],'indexes':[{'name':_0x1476('0x8'),'fields':[_0x1476('0x9'),_0x1476('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 94ed6a6..eeab05f 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 _0x84a0=['client','http','request','then','info','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x584bcd,_0x59c4b7){var _0x146bc7=function(_0x20b30d){while(--_0x20b30d){_0x584bcd['push'](_0x584bcd['shift']());}};_0x146bc7(++_0x59c4b7);}(_0x84a0,0x66));var _0x084a=function(_0x550c32,_0x38e241){_0x550c32=_0x550c32-0x0;var _0x59e529=_0x84a0[_0x550c32];return _0x59e529;};'use strict';var _=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var moment=require(_0x084a('0x2'));var BPromise=require(_0x084a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x084a('0x4'));var db=require(_0x084a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x084a('0x6'));var config=require(_0x084a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x084a('0x8')][_0x084a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e6810,_0x373d2,_0x2b30bc){return new BPromise(function(_0x58d419,_0x1051a9){return client[_0x084a('0xa')](_0x2e6810,_0x2b30bc)[_0x084a('0xb')](function(_0x2888e3){logger[_0x084a('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x373d2,'request\x20sent');logger[_0x084a('0xd')](_0x084a('0xe'),_0x373d2,_0x084a('0xf'),JSON[_0x084a('0x10')](_0x2888e3));if(_0x2888e3[_0x084a('0x11')]){if(_0x2888e3['error']['code']===0x1f4){logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x2888e3[_0x084a('0x11')][_0x084a('0x13')]);return _0x1051a9(_0x2888e3[_0x084a('0x11')][_0x084a('0x13')]);}logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x2888e3['error'][_0x084a('0x13')]);return _0x58d419(_0x2888e3['error'][_0x084a('0x13')]);}else{logger[_0x084a('0xc')](_0x084a('0x12'),_0x373d2,_0x084a('0xf'));_0x58d419(_0x2888e3[_0x084a('0x14')]['message']);}})[_0x084a('0x15')](function(_0x4abd81){logger[_0x084a('0x11')](_0x084a('0x12'),_0x373d2,_0x4abd81);_0x1051a9(_0x4abd81);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x468fc4,_0x501001){var _0x3704ba=function(_0x2e1966){while(--_0x2e1966){_0x468fc4['push'](_0x468fc4['shift']());}};_0x3704ba(++_0x501001);}(_0xe706,0xa3));var _0x6e70=function(_0x1df79c,_0x5ad8fd){_0x1df79c=_0x1df79c-0x0;var _0x2f23e4=_0xe706[_0x1df79c];return _0x2f23e4;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 7876b65..1e3f78b 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 _0xec94=['connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','update','delete','destroy','exports','multer','util'];(function(_0x36940e,_0x11f338){var _0x3283f2=function(_0x418008){while(--_0x418008){_0x36940e['push'](_0x36940e['shift']());}};_0x3283f2(++_0x11f338);}(_0xec94,0x15c));var _0x4ec9=function(_0x353c02,_0xf0459a){_0x353c02=_0x353c02-0x0;var _0x2ea4cf=_0xec94[_0x353c02];return _0x2ea4cf;};'use strict';var multer=require(_0x4ec9('0x0'));var util=require(_0x4ec9('0x1'));var path=require('path');var timeout=require(_0x4ec9('0x2'));var express=require('express');var router=express[_0x4ec9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4ec9('0x4'));var config=require(_0x4ec9('0x5'));var controller=require(_0x4ec9('0x6'));router[_0x4ec9('0x7')]('/',auth[_0x4ec9('0x8')](),controller[_0x4ec9('0x9')]);router[_0x4ec9('0x7')](_0x4ec9('0xa'),auth[_0x4ec9('0x8')](),controller[_0x4ec9('0xb')]);router['get'](_0x4ec9('0xc'),auth[_0x4ec9('0x8')](),controller[_0x4ec9('0xd')]);router[_0x4ec9('0x7')]('/:id/download',auth[_0x4ec9('0x8')](),controller['download']);router[_0x4ec9('0x7')](_0x4ec9('0xe'),controller[_0x4ec9('0xf')]);router[_0x4ec9('0x7')](_0x4ec9('0x10'),auth[_0x4ec9('0x8')](),controller[_0x4ec9('0x11')]);router[_0x4ec9('0x12')]('/',auth['isAuthenticated'](),controller[_0x4ec9('0x13')]);router[_0x4ec9('0x12')](_0x4ec9('0x10'),auth[_0x4ec9('0x8')](),controller[_0x4ec9('0x14')]);router['put'](_0x4ec9('0xc'),auth['isAuthenticated'](),controller[_0x4ec9('0x15')]);router[_0x4ec9('0x16')](_0x4ec9('0xc'),auth[_0x4ec9('0x8')](),controller[_0x4ec9('0x17')]);module[_0x4ec9('0x18')]=router; \ No newline at end of file +var _0x3883=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','/:id','delete','exports','multer','util','path','express'];(function(_0x4dc8cf,_0x1cb95d){var _0x328380=function(_0x17628f){while(--_0x17628f){_0x4dc8cf['push'](_0x4dc8cf['shift']());}};_0x328380(++_0x1cb95d);}(_0x3883,0xb9));var _0x3388=function(_0x6c153f,_0x43f30e){_0x6c153f=_0x6c153f-0x0;var _0x4dbdad=_0x3883[_0x6c153f];return _0x4dbdad;};'use strict';var multer=require(_0x3388('0x0'));var util=require(_0x3388('0x1'));var path=require(_0x3388('0x2'));var timeout=require('connect-timeout');var express=require(_0x3388('0x3'));var router=express[_0x3388('0x4')]();var auth=require(_0x3388('0x5'));var interaction=require(_0x3388('0x6'));var config=require(_0x3388('0x7'));var controller=require(_0x3388('0x8'));router[_0x3388('0x9')]('/',auth[_0x3388('0xa')](),controller[_0x3388('0xb')]);router[_0x3388('0x9')](_0x3388('0xc'),auth[_0x3388('0xa')](),controller[_0x3388('0xd')]);router['get']('/:id',auth[_0x3388('0xa')](),controller['show']);router[_0x3388('0x9')](_0x3388('0xe'),auth[_0x3388('0xa')](),controller[_0x3388('0xf')]);router[_0x3388('0x9')](_0x3388('0x10'),controller[_0x3388('0x11')]);router[_0x3388('0x9')](_0x3388('0x12'),auth[_0x3388('0xa')](),controller[_0x3388('0x13')]);router[_0x3388('0x14')]('/',auth['isAuthenticated'](),controller[_0x3388('0x15')]);router[_0x3388('0x14')](_0x3388('0x12'),auth[_0x3388('0xa')](),controller[_0x3388('0x16')]);router[_0x3388('0x17')](_0x3388('0x18'),auth[_0x3388('0xa')](),controller['update']);router[_0x3388('0x19')]('/:id',auth[_0x3388('0xa')](),controller['destroy']);module[_0x3388('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 6378075..27a8132 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 _0xaa02=['extname','STRING','setDataValue','channel','split','INTEGER','TEXT','FLOAT','BOOLEAN','DATE','createdAt','format','toString','updatedAt','MM-DD-YYYY\x20HH:mm','sequelize','moment','path','exports','VIRTUAL','getDataValue','value'];(function(_0x1f5eb6,_0x4e9737){var _0x2f37f3=function(_0x1005de){while(--_0x1005de){_0x1f5eb6['push'](_0x1f5eb6['shift']());}};_0x2f37f3(++_0x4e9737);}(_0xaa02,0xbf));var _0x2aa0=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xaa02[_0x5f1391];return _0x50ebe3;};'use strict';var Sequelize=require(_0x2aa0('0x0'));var moment=require(_0x2aa0('0x1'));var path=require(_0x2aa0('0x2'));module[_0x2aa0('0x3')]={'format':{'type':Sequelize[_0x2aa0('0x4')],'get':function(){return this[_0x2aa0('0x5')](_0x2aa0('0x6'))?path[_0x2aa0('0x7')](this[_0x2aa0('0x5')](_0x2aa0('0x6'))):undefined;}},'uniqueid':{'type':Sequelize[_0x2aa0('0x8')]},'channel':{'type':Sequelize[_0x2aa0('0x8')],'set':function(_0x146dfa){if(_0x146dfa){this[_0x2aa0('0x9')](_0x2aa0('0xa'),_0x146dfa);this['setDataValue']('membername',_0x146dfa[_0x2aa0('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2aa0('0x8')]},'connectedlinenum':{'type':Sequelize[_0x2aa0('0x8')]},'connectedlinename':{'type':Sequelize[_0x2aa0('0x8')]},'accountcode':{'type':Sequelize[_0x2aa0('0x8')]},'context':{'type':Sequelize[_0x2aa0('0x8')]},'exten':{'type':Sequelize[_0x2aa0('0x8')]},'value':{'type':Sequelize[_0x2aa0('0x8')]},'type':{'type':Sequelize[_0x2aa0('0x8')]},'rating':{'type':Sequelize[_0x2aa0('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x2aa0('0x8')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0x2aa0('0xd')]},'transcribeName':{'type':Sequelize['STRING']},'transcribeStatus':{'type':Sequelize[_0x2aa0('0x8')],'defaultValue':'NEW'},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x2aa0('0xd')]},'failureReason':{'type':Sequelize['TEXT']},'sentiment':{'type':Sequelize[_0x2aa0('0x8')]},'sPositive':{'type':Sequelize[_0x2aa0('0xe')]},'sNegative':{'type':Sequelize[_0x2aa0('0xe')]},'sNeutral':{'type':Sequelize[_0x2aa0('0xe')]},'sMixed':{'type':Sequelize[_0x2aa0('0xe')]},'tempSentiment':{'type':Sequelize[_0x2aa0('0xf')],'defaultValue':![]},'createdAt':{'type':Sequelize[_0x2aa0('0x10')],'get':function(){return moment(this[_0x2aa0('0x5')](_0x2aa0('0x11')))[_0x2aa0('0x12')]('MM-DD-YYYY\x20HH:mm')[_0x2aa0('0x13')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x2aa0('0x14')))[_0x2aa0('0x12')](_0x2aa0('0x15'))[_0x2aa0('0x13')]();}}}; \ No newline at end of file +var _0x155a=['exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','channel','membername','split','INTEGER','TEXT','NEW','FLOAT','BOOLEAN','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','DATE','updatedAt','sequelize'];(function(_0x49c7bd,_0x1432db){var _0x1ba37d=function(_0x30f525){while(--_0x30f525){_0x49c7bd['push'](_0x49c7bd['shift']());}};_0x1ba37d(++_0x1432db);}(_0x155a,0x175));var _0xa155=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x155a[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xa155('0x0'));var moment=require('moment');var path=require('path');module[_0xa155('0x1')]={'format':{'type':Sequelize[_0xa155('0x2')],'get':function(){return this[_0xa155('0x3')](_0xa155('0x4'))?path[_0xa155('0x5')](this[_0xa155('0x3')]('value')):undefined;}},'uniqueid':{'type':Sequelize[_0xa155('0x6')]},'channel':{'type':Sequelize[_0xa155('0x6')],'set':function(_0x36c124){if(_0x36c124){this[_0xa155('0x7')](_0xa155('0x8'),_0x36c124);this[_0xa155('0x7')](_0xa155('0x9'),_0x36c124[_0xa155('0xa')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xa155('0x6')]},'calleridname':{'type':Sequelize[_0xa155('0x6')]},'connectedlinenum':{'type':Sequelize[_0xa155('0x6')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa155('0x6')]},'context':{'type':Sequelize[_0xa155('0x6')]},'exten':{'type':Sequelize[_0xa155('0x6')]},'value':{'type':Sequelize[_0xa155('0x6')]},'type':{'type':Sequelize[_0xa155('0x6')]},'rating':{'type':Sequelize[_0xa155('0xb')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xa155('0x6')]},'userDisposition':{'type':Sequelize[_0xa155('0x6')]},'userSecondDisposition':{'type':Sequelize[_0xa155('0x6')]},'userThirdDisposition':{'type':Sequelize['STRING']},'location':{'type':Sequelize[_0xa155('0xc')]},'transcribeName':{'type':Sequelize[_0xa155('0x6')]},'transcribeStatus':{'type':Sequelize['STRING'],'defaultValue':_0xa155('0xd')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0xa155('0xc')]},'failureReason':{'type':Sequelize[_0xa155('0xc')]},'sentiment':{'type':Sequelize[_0xa155('0x6')]},'sPositive':{'type':Sequelize['FLOAT']},'sNegative':{'type':Sequelize[_0xa155('0xe')]},'sNeutral':{'type':Sequelize[_0xa155('0xe')]},'sMixed':{'type':Sequelize[_0xa155('0xe')]},'tempSentiment':{'type':Sequelize[_0xa155('0xf')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xa155('0x10')))[_0xa155('0x11')](_0xa155('0x12'))[_0xa155('0x13')]();}},'updatedAt':{'type':Sequelize[_0xa155('0x14')],'get':function(){return moment(this[_0xa155('0x3')](_0xa155('0x15')))[_0xa155('0x11')](_0xa155('0x12'))[_0xa155('0x13')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 2509221..8846aad 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 _0x9067=['Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','desk.js','querystring','papaparse','aws-sdk','uuid/v4','../../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','count','offset','limit','set','apply','reject','save','then','destroy','stack','name','send','map','VoiceRecording','fieldName','type','key','differenceBy','query','keys','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','params','describe','../../components/encryptor','uniqueid','value','format','%s.cypher','secrets','recording','existsSync','Sequelize','VoiceRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','sequelize','MD5','col','token','push','$and','decryptFile','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','listBuckets','createBucket','upload','TranscribeService','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','ValidationError','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets'];(function(_0x4c13b2,_0x371123){var _0x550449=function(_0x343f30){while(--_0x343f30){_0x4c13b2['push'](_0x4c13b2['shift']());}};_0x550449(++_0x371123);}(_0x9067,0x149));var _0x7906=function(_0x68b785,_0x1fdbd3){_0x68b785=_0x68b785-0x0;var _0x11ebd9=_0x9067[_0x68b785];return _0x11ebd9;};'use strict';var pdf=require(_0x7906('0x0'));var emlformat=require(_0x7906('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7906('0x2'));var jsonpatch=require(_0x7906('0x3'));var rp=require(_0x7906('0x4'));var moment=require(_0x7906('0x5'));var BPromise=require(_0x7906('0x6'));var Mustache=require(_0x7906('0x7'));var util=require(_0x7906('0x8'));var path=require(_0x7906('0x9'));var sox=require('sox');var csv=require(_0x7906('0xa'));var ejs=require(_0x7906('0xb'));var fs=require('fs');var _=require(_0x7906('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7906('0xd'));var toCsv=require(_0x7906('0xa'));var querystring=require(_0x7906('0xe'));var Papa=require(_0x7906('0xf'));var AWS=require(_0x7906('0x10'));var uuidv4=require(_0x7906('0x11'));var Redis=require('ioredis');var authService=require(_0x7906('0x12'));var qs=require(_0x7906('0x13'));var as=require(_0x7906('0x14'));var hardwareService=require(_0x7906('0x15'));var logger=require(_0x7906('0x16'))('api');var utils=require(_0x7906('0x17'));var config=require(_0x7906('0x18'));var licenseUtil=require(_0x7906('0x19'));var db=require(_0x7906('0x1a'))['db'];function respondWithStatusCode(_0x5960e7,_0x49bf75){_0x49bf75=_0x49bf75||0xcc;return function(_0xb018){if(_0xb018){return _0x5960e7[_0x7906('0x1b')](_0x49bf75);}return _0x5960e7[_0x7906('0x1c')](_0x49bf75)[_0x7906('0x1d')]();};}function respondWithResult(_0x1f624f,_0x230a1d){_0x230a1d=_0x230a1d||0xc8;return function(_0x11141c){if(_0x11141c){return _0x1f624f[_0x7906('0x1c')](_0x230a1d)[_0x7906('0x1e')](_0x11141c);}};}function respondWithFilteredResult(_0x5e9067,_0x1163d9){return function(_0x27cd84){if(_0x27cd84){var _0x17335e=_0x27cd84[_0x7906('0x1f')],_0x2688f5=_0x1163d9[_0x7906('0x20')],_0x4740fd=_0x1163d9[_0x7906('0x20')]+_0x1163d9[_0x7906('0x21')],_0x35c27d;if(_0x4740fd>=_0x17335e){_0x4740fd=_0x17335e;_0x35c27d=0xc8;}else{_0x35c27d=0xce;}_0x5e9067[_0x7906('0x1c')](_0x35c27d);return _0x5e9067[_0x7906('0x22')]('Content-Range',_0x2688f5+'-'+_0x4740fd+'/'+_0x17335e)[_0x7906('0x1e')](_0x27cd84);}return null;};}function patchUpdates(_0x2bb94e){return function(_0x2acc6f){try{jsonpatch[_0x7906('0x23')](_0x2acc6f,_0x2bb94e,!![]);}catch(_0x4c4d5c){return BPromise[_0x7906('0x24')](_0x4c4d5c);}return _0x2acc6f[_0x7906('0x25')]();};}function saveUpdates(_0x2a9fc0,_0x4bcfb5){return function(_0x19839b){if(_0x19839b){return _0x19839b['update'](_0x2a9fc0)[_0x7906('0x26')](function(_0x4c3820){return _0x4c3820;});}return null;};}function removeEntity(_0xb1ecfa,_0x38c570){return function(_0x5948b1){if(_0x5948b1){return _0x5948b1[_0x7906('0x27')]()['then'](function(){_0xb1ecfa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x191a42,_0x560a94){return function(_0x4c07b4){if(!_0x4c07b4){_0x191a42[_0x7906('0x1b')](0x194);}return _0x4c07b4;};}function handleError(_0x2e9914,_0x5616d1){_0x5616d1=_0x5616d1||0x1f4;return function(_0x454131){logger['error'](_0x454131[_0x7906('0x28')]);if(_0x454131[_0x7906('0x29')]){delete _0x454131[_0x7906('0x29')];}_0x2e9914['status'](_0x5616d1)[_0x7906('0x2a')](_0x454131);};}exports['index']=function(_0x4383e6,_0x46d153){var _0x178a76={},_0x131529={},_0x8da452={'count':0x0,'rows':[]};var _0x3ec6f9=_[_0x7906('0x2b')](db[_0x7906('0x2c')]['rawAttributes'],function(_0x3ddde9){return{'name':_0x3ddde9[_0x7906('0x2d')],'type':_0x3ddde9[_0x7906('0x2e')][_0x7906('0x2f')]};});_0x131529['model']=_[_0x7906('0x30')](_[_0x7906('0x2b')](_0x3ec6f9,_0x7906('0x29')),['format']);_0x131529[_0x7906('0x31')]=_[_0x7906('0x32')](_0x4383e6[_0x7906('0x31')]);_0x131529[_0x7906('0x33')]=_[_0x7906('0x34')](_0x131529[_0x7906('0x35')],_0x131529[_0x7906('0x31')]);_0x178a76['attributes']=_[_0x7906('0x34')](_0x131529[_0x7906('0x35')],qs[_0x7906('0x36')](_0x4383e6[_0x7906('0x31')][_0x7906('0x36')]));_0x178a76['attributes']=_0x178a76['attributes'][_0x7906('0x37')]?_0x178a76[_0x7906('0x38')]:_0x131529[_0x7906('0x35')];if(!_0x4383e6['query'][_0x7906('0x39')](_0x7906('0x3a'))){_0x178a76[_0x7906('0x21')]=qs[_0x7906('0x21')](_0x4383e6['query'][_0x7906('0x21')]);_0x178a76[_0x7906('0x20')]=qs[_0x7906('0x20')](_0x4383e6[_0x7906('0x31')][_0x7906('0x20')]);}_0x178a76[_0x7906('0x3b')]=qs[_0x7906('0x3c')](_0x4383e6['query'][_0x7906('0x3c')]);_0x178a76['where']=qs[_0x7906('0x33')](_[_0x7906('0x3d')](_0x4383e6[_0x7906('0x31')],_0x131529[_0x7906('0x33')]),_0x3ec6f9);if(_0x4383e6['query'][_0x7906('0x3e')]){_0x178a76['where']=_[_0x7906('0x3f')](_0x178a76[_0x7906('0x40')],{'$or':_['map'](_0x3ec6f9,function(_0x520fda){if(_0x520fda[_0x7906('0x2e')]!==_0x7906('0x41')){var _0x3354b3={};_0x3354b3[_0x520fda[_0x7906('0x29')]]={'$like':'%'+_0x4383e6[_0x7906('0x31')][_0x7906('0x3e')]+'%'};return _0x3354b3;}})});}_0x178a76=_['merge']({},_0x178a76,_0x4383e6[_0x7906('0x42')]);var _0x214016={'where':_0x178a76['where']};return db[_0x7906('0x2c')]['count'](_0x214016)[_0x7906('0x26')](function(_0x584273){_0x8da452['count']=_0x584273;if(_0x4383e6['query'][_0x7906('0x43')]){_0x178a76[_0x7906('0x44')]=[{'all':!![]}];}return db[_0x7906('0x2c')]['findAll'](_0x178a76);})[_0x7906('0x26')](function(_0x52d015){_0x8da452[_0x7906('0x45')]=_0x52d015;return _0x8da452;})[_0x7906('0x26')](respondWithFilteredResult(_0x46d153,_0x178a76))[_0x7906('0x46')](handleError(_0x46d153,null));};exports[_0x7906('0x47')]=function(_0x43c4c8,_0x2292d8){var _0x1d4145={'raw':![],'where':{'id':_0x43c4c8['params']['id']}},_0x5c3ecf={};_0x5c3ecf['model']=_['keys'](db['VoiceRecording'][_0x7906('0x48')]);_0x5c3ecf['query']=_[_0x7906('0x32')](_0x43c4c8[_0x7906('0x31')]);_0x5c3ecf['filters']=_['intersection'](_0x5c3ecf[_0x7906('0x35')],_0x5c3ecf[_0x7906('0x31')]);_0x1d4145[_0x7906('0x38')]=_[_0x7906('0x34')](_0x5c3ecf[_0x7906('0x35')],qs[_0x7906('0x36')](_0x43c4c8['query'][_0x7906('0x36')]));_0x1d4145[_0x7906('0x38')]=_0x1d4145[_0x7906('0x38')][_0x7906('0x37')]?_0x1d4145[_0x7906('0x38')]:_0x5c3ecf[_0x7906('0x35')];if(_0x43c4c8[_0x7906('0x31')]['includeAll']){_0x1d4145[_0x7906('0x44')]=[{'all':!![]}];}_0x1d4145=_[_0x7906('0x3f')]({},_0x1d4145,_0x43c4c8[_0x7906('0x42')]);return db[_0x7906('0x2c')][_0x7906('0x49')](_0x1d4145)[_0x7906('0x26')](handleEntityNotFound(_0x2292d8,null))[_0x7906('0x26')](respondWithResult(_0x2292d8,null))[_0x7906('0x46')](handleError(_0x2292d8,null));};exports[_0x7906('0x4a')]=function(_0x4b0554,_0x460a2f){return db[_0x7906('0x2c')][_0x7906('0x4a')](_0x4b0554['body'],{})[_0x7906('0x26')](respondWithResult(_0x460a2f,0xc9))[_0x7906('0x46')](handleError(_0x460a2f,null));};exports['update']=function(_0x61fc48,_0x3e1c87){if(_0x61fc48['body']['id']){delete _0x61fc48[_0x7906('0x4b')]['id'];}return db[_0x7906('0x2c')]['find']({'where':{'id':_0x61fc48[_0x7906('0x4c')]['id']}})[_0x7906('0x26')](handleEntityNotFound(_0x3e1c87,null))[_0x7906('0x26')](saveUpdates(_0x61fc48[_0x7906('0x4b')],null))[_0x7906('0x26')](respondWithResult(_0x3e1c87,null))[_0x7906('0x46')](handleError(_0x3e1c87,null));};exports[_0x7906('0x4d')]=function(_0x3ec92a,_0xcb1975){return db['VoiceRecording'][_0x7906('0x4d')]()[_0x7906('0x26')](respondWithResult(_0xcb1975,null))[_0x7906('0x46')](handleError(_0xcb1975,null));};exports['download']=function(_0x3aac90,_0x336839,_0x94b550){var _0x3b5c7a=require(_0x7906('0x4e'));var _0x45d78f=![];var _0x23c81d={};if(_0x3aac90[_0x7906('0x31')][_0x7906('0x2e')]&&_0x3aac90[_0x7906('0x31')][_0x7906('0x2e')]===_0x7906('0x4f')){_0x23c81d[_0x7906('0x4f')]=_0x3aac90[_0x7906('0x4c')]['id'];}else{_0x23c81d['id']=_0x3aac90[_0x7906('0x4c')]['id'];}return db[_0x7906('0x2c')][_0x7906('0x49')]({'where':_0x23c81d,'attributes':['id',_0x7906('0x50')],'raw':!![]})[_0x7906('0x26')](handleEntityNotFound(_0x336839,null))[_0x7906('0x26')](function(_0x362ef8){if(_0x362ef8){var _0x31b89b=_0x362ef8[_0x7906('0x50')];var _0x378be6=util[_0x7906('0x51')](_0x7906('0x52'),_0x31b89b);if(fs['existsSync'](_0x378be6)){_0x45d78f=!![];return _0x3b5c7a['decryptFile'](_0x378be6,_0x31b89b,config[_0x7906('0x53')][_0x7906('0x54')])['then'](function(){return _0x362ef8;});}return _0x362ef8;}})['then'](function(_0x299c66){if(_0x299c66){var _0x4f372b=_0x299c66[_0x7906('0x50')];if(!fs[_0x7906('0x55')](_0x4f372b)){throw new db[(_0x7906('0x56'))]['ValidationError'](_0x7906('0x57'));}if(_0x299c66[_0x7906('0x58')]){return _0x336839[_0x7906('0x59')](_0x4f372b,_0x299c66[_0x7906('0x58')]+path[_0x7906('0x5a')](_0x4f372b),function(){if(_0x45d78f){fs[_0x7906('0x5b')](_0x4f372b);}});}else{return _0x336839[_0x7906('0x59')](_0x4f372b,function(_0x1914a2){if(_0x45d78f){fs[_0x7906('0x5b')](_0x4f372b);}});}}})[_0x7906('0x46')](function(_0x22998c){if(_0x22998c[_0x7906('0x5c')]===_0x7906('0x57')){_0x336839[_0x7906('0x1c')](0x194)['send'](_0x7906('0x5d'));}else{return handleError(_0x336839,null);}});};exports['downloads']=function(_0xe5e19,_0xca126f,_0x37eb43){var _0x572c08=require('../../components/encryptor');var _0x22758e=![];var _0x2d3ba9={'$and':[db[_0x7906('0x5e')][_0x7906('0x40')](db[_0x7906('0x5e')]['fn'](_0x7906('0x5f'),db[_0x7906('0x5e')][_0x7906('0x60')](_0x7906('0x4f'))),_0xe5e19[_0x7906('0x31')][_0x7906('0x61')])]};if(_0xe5e19[_0x7906('0x31')][_0x7906('0x2e')]&&_0xe5e19[_0x7906('0x31')]['type']===_0x7906('0x4f')){_0x2d3ba9['$and'][_0x7906('0x62')]({'uniqueid':_0xe5e19['params']['id']});}else{_0x2d3ba9[_0x7906('0x63')][_0x7906('0x62')]({'id':_0xe5e19[_0x7906('0x4c')]['id']});}return db[_0x7906('0x2c')][_0x7906('0x49')]({'where':_0x2d3ba9,'attributes':['id',_0x7906('0x50')],'raw':!![]})[_0x7906('0x26')](handleEntityNotFound(_0xca126f,null))['then'](function(_0x460b34){if(_0x460b34){var _0x54c7d0=util['format'](_0x7906('0x52'),_0x460b34[_0x7906('0x50')]);if(fs[_0x7906('0x55')](_0x54c7d0)){_0x22758e=!![];return _0x572c08[_0x7906('0x64')](_0x54c7d0,_0x460b34[_0x7906('0x50')],config['secrets'][_0x7906('0x54')])[_0x7906('0x26')](function(){return _0x460b34;});}return _0x460b34;}})[_0x7906('0x26')](function(_0x44139e){if(_0x44139e){if(!fs[_0x7906('0x55')](_0x44139e['value'])){throw new db['Sequelize']['ValidationError'](_0x7906('0x57'));}if(_0x44139e[_0x7906('0x58')]){return _0xca126f[_0x7906('0x59')](_0x44139e[_0x7906('0x50')],_0x44139e[_0x7906('0x58')]+path['extname'](_0x44139e[_0x7906('0x50')]),function(){if(_0x22758e){fs['unlink'](_0x44139e[_0x7906('0x50')]);}});}else{return _0xca126f['download'](_0x44139e[_0x7906('0x50')],function(_0x2512a3){if(_0x22758e){fs[_0x7906('0x5b')](_0x44139e[_0x7906('0x50')]);}});}}})[_0x7906('0x46')](handleError(_0xca126f,null));};exports[_0x7906('0x27')]=function(_0x74e499,_0x1ef332){return db[_0x7906('0x2c')][_0x7906('0x49')]({'where':{'id':_0x74e499[_0x7906('0x4c')]['id']}})[_0x7906('0x26')](function(_0x4f4ba9){if(!_0x4f4ba9)throw new ReferenceError(_0x7906('0x65'));return _0x4f4ba9;})['then'](function(_0x43be11){var _0x1cf073=_0x43be11['value'];logger[_0x7906('0x66')](_0x7906('0x67'),_0x1cf073);if(!_[_0x7906('0x68')](_0x43be11[_0x7906('0x50')])&&fs[_0x7906('0x55')](_0x1cf073)){logger[_0x7906('0x66')]('File:\x20\x22'+_0x1cf073+_0x7906('0x69'));fs['unlinkSync'](_0x1cf073);}_0x1cf073=_0x1cf073+_0x7906('0x6a');if(!_[_0x7906('0x68')](_0x43be11[_0x7906('0x50')])&&fs[_0x7906('0x55')](_0x1cf073)){logger[_0x7906('0x66')]('File:\x20\x22'+_0x1cf073+_0x7906('0x69'));fs[_0x7906('0x6b')](_0x1cf073);}return _0x43be11;})[_0x7906('0x26')](function(_0x6bccf7){if(!_0x6bccf7)throw new InternalError();return _0x6bccf7[_0x7906('0x27')]();})[_0x7906('0x26')](function(){_0x1ef332[_0x7906('0x1c')](0xcc)[_0x7906('0x1d')]();})[_0x7906('0x46')](handleError(_0x1ef332,null));};function getBucketslist(_0x1016ca,_0x2172c7,_0x26e4ee){return new Promise(function(_0x3b07c8,_0x5ecad1){var _0x2480dc=new AWS['S3']({'accessKeyId':_0x2172c7,'secretAccessKey':_0x1016ca,'region':_0x26e4ee});_0x2480dc[_0x7906('0x6c')]({},function(_0x147911,_0x6979f7){if(_0x147911){return _0x5ecad1(_0x147911);}else{return _0x3b07c8(_0x6979f7);}});});}function createBucket(_0xace48c,_0x5e20f3,_0x26ff6,_0x1b7670){return new Promise(function(_0x277235,_0x2536f9){var _0x5026fb=new AWS['S3']({'accessKeyId':_0x5e20f3,'secretAccessKey':_0xace48c,'region':_0x26ff6});_0x5026fb[_0x7906('0x6d')]({'Bucket':_0x1b7670},function(_0xf43776,_0x52306a){if(_0xf43776){return _0x2536f9(_0xf43776);}else{return _0x277235(_0x52306a);}});});}function uploadFile(_0x3a7715,_0x5c4e98,_0x1fff94,_0x3e0ea0,_0x45181f,_0x1fef19){return new Promise(function(_0x1cc1dd,_0x421805){var _0x2d0ce3=new AWS['S3']({'accessKeyId':_0x5c4e98,'secretAccessKey':_0x3a7715,'region':_0x1fff94});_0x2d0ce3[_0x7906('0x6e')]({'Bucket':_0x3e0ea0,'Key':_0x45181f,'Body':_0x1fef19},function(_0x1e85c4,_0x4efa84){if(_0x1e85c4){return _0x421805(_0x1e85c4);}else{return _0x1cc1dd(_0x4efa84);}});});}function startTranscribe(_0x4d8688,_0x3a6127,_0x273605,_0x112d96,_0xc4cd1f,_0x391f95){return new Promise(function(_0x3e7bf5,_0x4d8b84){var _0x1c47c7=new AWS[(_0x7906('0x6f'))]({'accessKeyId':_0x3a6127,'secretAccessKey':_0x4d8688,'region':_0x273605});_0x1c47c7['startTranscriptionJob']({'TranscriptionJobName':_0x112d96,'LanguageCode':_0xc4cd1f,'Media':{'MediaFileUri':_0x391f95}},function(_0x502cb8,_0x84666d){if(_0x502cb8){return _0x4d8b84(_0x502cb8);}else{return _0x3e7bf5(_0x84666d);}});});}function transcribe(_0x1c3d3b,_0x7bb7ae,_0x4df01b,_0x1d1d24,_0x5c03fd,_0x3e6e45,_0x59791a){return new Promise(function(_0x13d1bb,_0x2b2090){var _0x47cb5b={};logger['info'](util[_0x7906('0x51')](_0x7906('0x70'),_0x1c3d3b,_0x5c03fd));return uploadFile(_0x7bb7ae,_0x4df01b,_0x1d1d24,_0x5c03fd,path[_0x7906('0x71')](_0x3e6e45),fs[_0x7906('0x72')](_0x3e6e45))[_0x7906('0x26')](function(_0x1a78b6){logger[_0x7906('0x66')](util[_0x7906('0x51')](_0x7906('0x73'),_0x1c3d3b,_0x5c03fd,_0x1a78b6[_0x7906('0x74')]));_0x47cb5b[_0x7906('0x75')]=_0x1a78b6[_0x7906('0x76')];_0x47cb5b['location']=_0x1a78b6[_0x7906('0x74')];logger['info'](util['format'](_0x7906('0x77'),_0x1c3d3b));return startTranscribe(_0x7bb7ae,_0x4df01b,_0x1d1d24,uuidv4(),_0x59791a,_0x1a78b6[_0x7906('0x74')]);})[_0x7906('0x26')](function(_0x56edd1){logger[_0x7906('0x66')](util['format'](_0x7906('0x78'),_0x1c3d3b,_0x56edd1[_0x7906('0x79')][_0x7906('0x7a')]));_0x47cb5b[_0x7906('0x7b')]=_0x56edd1[_0x7906('0x79')][_0x7906('0x7a')];_0x47cb5b[_0x7906('0x7c')]=_0x56edd1['TranscriptionJob'][_0x7906('0x7d')];return _0x13d1bb(_0x47cb5b);})['catch'](function(_0xbd07ec){return _0x2b2090(_0xbd07ec);});});}exports[_0x7906('0x7e')]=function(_0x56929f,_0x12cfbf,_0x17ad70){var _0x408d95;var _0x4c2635;var _0x4c9a02;var _0x3735f2=require(_0x7906('0x4e'));return db[_0x7906('0x2c')][_0x7906('0x7f')]({'where':{'id':_0x56929f['params']['id']}})['then'](function(_0x57da1c){if(_0x57da1c){var _0x541531=util[_0x7906('0x51')]('%s.cypher',_0x57da1c[_0x7906('0x50')]);if(fs[_0x7906('0x55')](_0x541531)){cypher=!![];return _0x3735f2[_0x7906('0x64')](_0x541531,_0x57da1c[_0x7906('0x50')],config['secrets']['recording'])[_0x7906('0x26')](function(){return _0x57da1c;});}return _0x57da1c;}})[_0x7906('0x26')](function(_0x976504){if(!_0x976504){throw new db['Sequelize'][(_0x7906('0x80'))](_0x7906('0x81'));}_0x4c2635=_0x976504;return db[_0x7906('0x82')][_0x7906('0x7f')]({'where':{'id':0x1}});})[_0x7906('0x26')](handleEntityNotFound(_0x12cfbf,null))[_0x7906('0x26')](function(_0x4f6583){if(_0x4f6583){_0x408d95=_0x4f6583;if(!_0x408d95[_0x7906('0x83')]||!_0x408d95[_0x7906('0x84')]||!_0x408d95[_0x7906('0x85')]||!_0x408d95[_0x7906('0x86')]||!_0x408d95[_0x7906('0x75')]){throw new db[(_0x7906('0x56'))][(_0x7906('0x80'))]('Transcribe\x20not\x20configured');}if(_0x56929f[_0x7906('0x4b')][_0x7906('0x87')]&&(!_0x408d95['sentiment']||!_0x408d95[_0x7906('0x88')]||!_0x408d95[_0x7906('0x89')]||!_0x408d95['language']||!_0x408d95[_0x7906('0x75')])){throw new db['Sequelize']['ValidationError'](_0x7906('0x8a'));}return db[_0x7906('0x8b')][_0x7906('0x7f')]({'where':{'id':_0x408d95[_0x7906('0x84')]}});}})[_0x7906('0x26')](function(_0xe12186){if(!_0xe12186){throw new db[(_0x7906('0x56'))][(_0x7906('0x80'))](_0x7906('0x8c'));}if(!_0xe12186[_0x7906('0x8d')]||!_0xe12186[_0x7906('0x8e')]){throw new db[(_0x7906('0x56'))][(_0x7906('0x80'))](_0x7906('0x8f'));}_0x4c9a02=_0xe12186;return getBucketslist(_0x4c9a02[_0x7906('0x8d')],_0x4c9a02[_0x7906('0x8e')],_0x408d95[_0x7906('0x85')]);})[_0x7906('0x26')](function(_0x57ad04){if(_0x57ad04&&_0x57ad04[_0x7906('0x90')]){var _0xd01e1=_[_0x7906('0x49')](_0x57ad04[_0x7906('0x90')],function(_0xb2421f){return _0xb2421f[_0x7906('0x91')]===_0x408d95[_0x7906('0x75')];});if(!_0xd01e1){logger[_0x7906('0x66')](util[_0x7906('0x51')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x56929f[_0x7906('0x4c')]['id'],_0x408d95[_0x7906('0x75')]));return createBucket(_0x4c9a02[_0x7906('0x8d')],_0x4c9a02[_0x7906('0x8e')],_0x408d95[_0x7906('0x85')],_0x408d95['bucket']);}logger[_0x7906('0x66')](util['format'](_0x7906('0x92'),_0x56929f[_0x7906('0x4c')]['id'],_0x408d95[_0x7906('0x75')]));return;}})['then'](function(_0x2b1804){if(_0x4c2635[_0x7906('0x7c')]===_0x7906('0x93')){return transcribe(_0x56929f[_0x7906('0x4c')]['id'],_0x4c9a02[_0x7906('0x8d')],_0x4c9a02['data2'],_0x408d95['transcribeRegion'],_0x408d95[_0x7906('0x75')],_0x4c2635[_0x7906('0x50')],_0x408d95[_0x7906('0x86')]);}else{logger[_0x7906('0x66')](util[_0x7906('0x51')](_0x7906('0x94'),_0x56929f[_0x7906('0x4c')]['id']));return{'transcribeStatus':_0x7906('0x95')};}})[_0x7906('0x26')](function(_0x46869e){if(_0x46869e){_0x46869e[_0x7906('0x96')]=_0x56929f['body']['runSentiment'];return _0x4c2635[_0x7906('0x97')](_0x46869e);}})['then'](respondWithResult(_0x12cfbf,null))['catch'](handleError(_0x12cfbf,null));};function writeFile(_0x2d2307,_0x59cf42){return new Promise(function(_0x475910,_0x49683a){fs[_0x7906('0x98')](_0x59cf42,_0x2d2307,function(_0x25d318,_0x144826){if(_0x25d318){return _0x49683a(_0x25d318);}else{return _0x475910(_0x144826);}});});}exports[_0x7906('0x99')]=function(_0x16be28,_0x7ab2e9,_0x271565){return db[_0x7906('0x2c')][_0x7906('0x7f')]({'where':{'id':_0x16be28['params']['id']}})[_0x7906('0x26')](handleEntityNotFound(_0x7ab2e9))[_0x7906('0x26')](function(_0x5e84c4){if(_0x5e84c4&&_0x5e84c4['fileText']){var _0x1bbcc6=_0x5e84c4[_0x7906('0x9a')];var _0x2112b9=config[_0x7906('0x9b')]+'/server/files/transcribes/transcribe_'+_0x5e84c4['id']+_0x7906('0x9c');if(fs[_0x7906('0x55')](_0x2112b9)){return _0x2112b9;}return writeFile(_0x1bbcc6,_0x2112b9)[_0x7906('0x26')](function(){return _0x2112b9;});}else{throw new db[(_0x7906('0x56'))][(_0x7906('0x80'))](_0x7906('0x9d'));}})[_0x7906('0x26')](function(_0x576d0e){return _0x7ab2e9[_0x7906('0x59')](_0x576d0e);})[_0x7906('0x46')](handleError(_0x7ab2e9));}; \ No newline at end of file +var _0x3fe6=['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','limit','set','apply','then','error','name','send','index','VoiceRecording','fieldName','type','model','differenceBy','map','format','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','describe','download','value','%s.cypher','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','../../components/encryptor','sequelize','uniqueid','token','$and','push','existsSync','decryptFile','secrets','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','File:\x20\x22','listBuckets','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','language','runSentiment','sentimentAccountId','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4'];(function(_0x39ae21,_0x1ffcde){var _0x47d8f2=function(_0x2d6729){while(--_0x2d6729){_0x39ae21['push'](_0x39ae21['shift']());}};_0x47d8f2(++_0x1ffcde);}(_0x3fe6,0x11b));var _0x63fe=function(_0x102f97,_0x5bda2f){_0x102f97=_0x102f97-0x0;var _0xd22058=_0x3fe6[_0x102f97];return _0xd22058;};'use strict';var pdf=require(_0x63fe('0x0'));var emlformat=require(_0x63fe('0x1'));var rimraf=require(_0x63fe('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x63fe('0x3'));var rp=require('request-promise');var moment=require(_0x63fe('0x4'));var BPromise=require(_0x63fe('0x5'));var Mustache=require(_0x63fe('0x6'));var util=require(_0x63fe('0x7'));var path=require('path');var sox=require(_0x63fe('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x63fe('0x9'));var squel=require(_0x63fe('0xa'));var crypto=require(_0x63fe('0xb'));var jsforce=require(_0x63fe('0xc'));var deskjs=require(_0x63fe('0xd'));var toCsv=require(_0x63fe('0xe'));var querystring=require(_0x63fe('0xf'));var Papa=require(_0x63fe('0x10'));var AWS=require(_0x63fe('0x11'));var uuidv4=require(_0x63fe('0x12'));var Redis=require(_0x63fe('0x13'));var authService=require(_0x63fe('0x14'));var qs=require(_0x63fe('0x15'));var as=require(_0x63fe('0x16'));var hardwareService=require(_0x63fe('0x17'));var logger=require(_0x63fe('0x18'))(_0x63fe('0x19'));var utils=require(_0x63fe('0x1a'));var config=require(_0x63fe('0x1b'));var licenseUtil=require(_0x63fe('0x1c'));var db=require(_0x63fe('0x1d'))['db'];function respondWithStatusCode(_0x93ace,_0x38fdcf){_0x38fdcf=_0x38fdcf||0xcc;return function(_0x57a3b3){if(_0x57a3b3){return _0x93ace[_0x63fe('0x1e')](_0x38fdcf);}return _0x93ace[_0x63fe('0x1f')](_0x38fdcf)[_0x63fe('0x20')]();};}function respondWithResult(_0x50c992,_0x2368b2){_0x2368b2=_0x2368b2||0xc8;return function(_0x36142b){if(_0x36142b){return _0x50c992[_0x63fe('0x1f')](_0x2368b2)[_0x63fe('0x21')](_0x36142b);}};}function respondWithFilteredResult(_0x522b76,_0x5610b3){return function(_0x5436d1){if(_0x5436d1){var _0x4abba1=_0x5436d1['count'],_0x8215e=_0x5610b3[_0x63fe('0x22')],_0xd337a7=_0x5610b3[_0x63fe('0x22')]+_0x5610b3[_0x63fe('0x23')],_0x532fe8;if(_0xd337a7>=_0x4abba1){_0xd337a7=_0x4abba1;_0x532fe8=0xc8;}else{_0x532fe8=0xce;}_0x522b76[_0x63fe('0x1f')](_0x532fe8);return _0x522b76[_0x63fe('0x24')]('Content-Range',_0x8215e+'-'+_0xd337a7+'/'+_0x4abba1)[_0x63fe('0x21')](_0x5436d1);}return null;};}function patchUpdates(_0x300600){return function(_0x1093a5){try{jsonpatch[_0x63fe('0x25')](_0x1093a5,_0x300600,!![]);}catch(_0x303b85){return BPromise['reject'](_0x303b85);}return _0x1093a5['save']();};}function saveUpdates(_0x25e387,_0x2fef36){return function(_0x2c5c0d){if(_0x2c5c0d){return _0x2c5c0d['update'](_0x25e387)[_0x63fe('0x26')](function(_0xa76d9c){return _0xa76d9c;});}return null;};}function removeEntity(_0x726da5,_0x4b8fa7){return function(_0x1bea37){if(_0x1bea37){return _0x1bea37['destroy']()['then'](function(){_0x726da5['status'](0xcc)[_0x63fe('0x20')]();});}};}function handleEntityNotFound(_0x2cb104,_0x5ccaea){return function(_0x3a7302){if(!_0x3a7302){_0x2cb104[_0x63fe('0x1e')](0x194);}return _0x3a7302;};}function handleError(_0x2e7267,_0x3fefd8){_0x3fefd8=_0x3fefd8||0x1f4;return function(_0x35371b){logger[_0x63fe('0x27')](_0x35371b['stack']);if(_0x35371b[_0x63fe('0x28')]){delete _0x35371b[_0x63fe('0x28')];}_0x2e7267[_0x63fe('0x1f')](_0x3fefd8)[_0x63fe('0x29')](_0x35371b);};}exports[_0x63fe('0x2a')]=function(_0x2558ff,_0x93b61d){var _0x209ec8={},_0x238db2={},_0x276738={'count':0x0,'rows':[]};var _0x3ef78c=_['map'](db[_0x63fe('0x2b')]['rawAttributes'],function(_0x4b9b2e){return{'name':_0x4b9b2e[_0x63fe('0x2c')],'type':_0x4b9b2e[_0x63fe('0x2d')]['key']};});_0x238db2[_0x63fe('0x2e')]=_[_0x63fe('0x2f')](_[_0x63fe('0x30')](_0x3ef78c,_0x63fe('0x28')),[_0x63fe('0x31')]);_0x238db2[_0x63fe('0x32')]=_['keys'](_0x2558ff[_0x63fe('0x32')]);_0x238db2[_0x63fe('0x33')]=_[_0x63fe('0x34')](_0x238db2[_0x63fe('0x2e')],_0x238db2[_0x63fe('0x32')]);_0x209ec8[_0x63fe('0x35')]=_['intersection'](_0x238db2[_0x63fe('0x2e')],qs[_0x63fe('0x36')](_0x2558ff['query']['fields']));_0x209ec8['attributes']=_0x209ec8['attributes'][_0x63fe('0x37')]?_0x209ec8['attributes']:_0x238db2['model'];if(!_0x2558ff['query'][_0x63fe('0x38')](_0x63fe('0x39'))){_0x209ec8['limit']=qs[_0x63fe('0x23')](_0x2558ff[_0x63fe('0x32')][_0x63fe('0x23')]);_0x209ec8['offset']=qs[_0x63fe('0x22')](_0x2558ff[_0x63fe('0x32')][_0x63fe('0x22')]);}_0x209ec8[_0x63fe('0x3a')]=qs['sort'](_0x2558ff[_0x63fe('0x32')][_0x63fe('0x3b')]);_0x209ec8['where']=qs[_0x63fe('0x33')](_[_0x63fe('0x3c')](_0x2558ff[_0x63fe('0x32')],_0x238db2[_0x63fe('0x33')]),_0x3ef78c);if(_0x2558ff[_0x63fe('0x32')][_0x63fe('0x3d')]){_0x209ec8['where']=_[_0x63fe('0x3e')](_0x209ec8[_0x63fe('0x3f')],{'$or':_['map'](_0x3ef78c,function(_0x16b0f0){if(_0x16b0f0[_0x63fe('0x2d')]!==_0x63fe('0x40')){var _0x5d9c3a={};_0x5d9c3a[_0x16b0f0[_0x63fe('0x28')]]={'$like':'%'+_0x2558ff[_0x63fe('0x32')][_0x63fe('0x3d')]+'%'};return _0x5d9c3a;}})});}_0x209ec8=_['merge']({},_0x209ec8,_0x2558ff[_0x63fe('0x41')]);var _0x972e86={'where':_0x209ec8['where']};return db[_0x63fe('0x2b')][_0x63fe('0x42')](_0x972e86)['then'](function(_0x310400){_0x276738[_0x63fe('0x42')]=_0x310400;if(_0x2558ff[_0x63fe('0x32')][_0x63fe('0x43')]){_0x209ec8[_0x63fe('0x44')]=[{'all':!![]}];}return db[_0x63fe('0x2b')][_0x63fe('0x45')](_0x209ec8);})[_0x63fe('0x26')](function(_0x25b938){_0x276738[_0x63fe('0x46')]=_0x25b938;return _0x276738;})[_0x63fe('0x26')](respondWithFilteredResult(_0x93b61d,_0x209ec8))[_0x63fe('0x47')](handleError(_0x93b61d,null));};exports['show']=function(_0x192dfd,_0x2c15c0){var _0x32b8ac={'raw':![],'where':{'id':_0x192dfd[_0x63fe('0x48')]['id']}},_0x2fe35b={};_0x2fe35b[_0x63fe('0x2e')]=_['keys'](db[_0x63fe('0x2b')]['rawAttributes']);_0x2fe35b['query']=_['keys'](_0x192dfd[_0x63fe('0x32')]);_0x2fe35b[_0x63fe('0x33')]=_['intersection'](_0x2fe35b[_0x63fe('0x2e')],_0x2fe35b[_0x63fe('0x32')]);_0x32b8ac[_0x63fe('0x35')]=_[_0x63fe('0x34')](_0x2fe35b[_0x63fe('0x2e')],qs['fields'](_0x192dfd['query'][_0x63fe('0x36')]));_0x32b8ac[_0x63fe('0x35')]=_0x32b8ac[_0x63fe('0x35')]['length']?_0x32b8ac[_0x63fe('0x35')]:_0x2fe35b[_0x63fe('0x2e')];if(_0x192dfd[_0x63fe('0x32')]['includeAll']){_0x32b8ac[_0x63fe('0x44')]=[{'all':!![]}];}_0x32b8ac=_[_0x63fe('0x3e')]({},_0x32b8ac,_0x192dfd['options']);return db[_0x63fe('0x2b')][_0x63fe('0x49')](_0x32b8ac)['then'](handleEntityNotFound(_0x2c15c0,null))['then'](respondWithResult(_0x2c15c0,null))[_0x63fe('0x47')](handleError(_0x2c15c0,null));};exports[_0x63fe('0x4a')]=function(_0x48168c,_0x48f569){return db[_0x63fe('0x2b')][_0x63fe('0x4a')](_0x48168c[_0x63fe('0x4b')],{})[_0x63fe('0x26')](respondWithResult(_0x48f569,0xc9))[_0x63fe('0x47')](handleError(_0x48f569,null));};exports['update']=function(_0x1dee0f,_0x1c5de5){if(_0x1dee0f[_0x63fe('0x4b')]['id']){delete _0x1dee0f['body']['id'];}return db[_0x63fe('0x2b')][_0x63fe('0x49')]({'where':{'id':_0x1dee0f[_0x63fe('0x48')]['id']}})['then'](handleEntityNotFound(_0x1c5de5,null))[_0x63fe('0x26')](saveUpdates(_0x1dee0f[_0x63fe('0x4b')],null))['then'](respondWithResult(_0x1c5de5,null))['catch'](handleError(_0x1c5de5,null));};exports[_0x63fe('0x4c')]=function(_0x1b74f6,_0x10144d){return db[_0x63fe('0x2b')][_0x63fe('0x4c')]()[_0x63fe('0x26')](respondWithResult(_0x10144d,null))[_0x63fe('0x47')](handleError(_0x10144d,null));};exports[_0x63fe('0x4d')]=function(_0x32f4f4,_0x212cf8,_0x361c76){var _0x510cd2=require('../../components/encryptor');var _0x238954=![];var _0x577a67={};if(_0x32f4f4[_0x63fe('0x32')][_0x63fe('0x2d')]&&_0x32f4f4['query'][_0x63fe('0x2d')]==='uniqueid'){_0x577a67['uniqueid']=_0x32f4f4['params']['id'];}else{_0x577a67['id']=_0x32f4f4[_0x63fe('0x48')]['id'];}return db['VoiceRecording'][_0x63fe('0x49')]({'where':_0x577a67,'attributes':['id',_0x63fe('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x212cf8,null))[_0x63fe('0x26')](function(_0x5bca35){if(_0x5bca35){var _0x29ab2c=_0x5bca35[_0x63fe('0x4e')];var _0x38c72c=util[_0x63fe('0x31')](_0x63fe('0x4f'),_0x29ab2c);if(fs['existsSync'](_0x38c72c)){_0x238954=!![];return _0x510cd2['decryptFile'](_0x38c72c,_0x29ab2c,config['secrets'][_0x63fe('0x50')])[_0x63fe('0x26')](function(){return _0x5bca35;});}return _0x5bca35;}})['then'](function(_0x339088){if(_0x339088){var _0x57a4c3=_0x339088[_0x63fe('0x4e')];if(!fs['existsSync'](_0x57a4c3)){throw new db[(_0x63fe('0x51'))][(_0x63fe('0x52'))](_0x63fe('0x53'));}if(_0x339088[_0x63fe('0x54')]){return _0x212cf8['download'](_0x57a4c3,_0x339088[_0x63fe('0x54')]+path[_0x63fe('0x55')](_0x57a4c3),function(){if(_0x238954){fs[_0x63fe('0x56')](_0x57a4c3);}});}else{return _0x212cf8['download'](_0x57a4c3,function(_0x17f817){if(_0x238954){fs[_0x63fe('0x56')](_0x57a4c3);}});}}})[_0x63fe('0x47')](function(_0x28a198){if(_0x28a198[_0x63fe('0x57')]===_0x63fe('0x53')){_0x212cf8[_0x63fe('0x1f')](0x194)[_0x63fe('0x29')](_0x63fe('0x58'));}else{return handleError(_0x212cf8,null);}});};exports[_0x63fe('0x59')]=function(_0x53ddf3,_0xde74b7,_0x5e07d3){var _0xc50ed7=require(_0x63fe('0x5a'));var _0x28506a=![];var _0x4c8346={'$and':[db[_0x63fe('0x5b')][_0x63fe('0x3f')](db['sequelize']['fn']('MD5',db[_0x63fe('0x5b')]['col'](_0x63fe('0x5c'))),_0x53ddf3[_0x63fe('0x32')][_0x63fe('0x5d')])]};if(_0x53ddf3['query'][_0x63fe('0x2d')]&&_0x53ddf3[_0x63fe('0x32')]['type']==='uniqueid'){_0x4c8346[_0x63fe('0x5e')]['push']({'uniqueid':_0x53ddf3[_0x63fe('0x48')]['id']});}else{_0x4c8346['$and'][_0x63fe('0x5f')]({'id':_0x53ddf3['params']['id']});}return db[_0x63fe('0x2b')][_0x63fe('0x49')]({'where':_0x4c8346,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0xde74b7,null))[_0x63fe('0x26')](function(_0x21bde0){if(_0x21bde0){var _0x377375=util['format'](_0x63fe('0x4f'),_0x21bde0[_0x63fe('0x4e')]);if(fs[_0x63fe('0x60')](_0x377375)){_0x28506a=!![];return _0xc50ed7[_0x63fe('0x61')](_0x377375,_0x21bde0[_0x63fe('0x4e')],config[_0x63fe('0x62')][_0x63fe('0x50')])[_0x63fe('0x26')](function(){return _0x21bde0;});}return _0x21bde0;}})['then'](function(_0x3c87b5){if(_0x3c87b5){if(!fs[_0x63fe('0x60')](_0x3c87b5['value'])){throw new db['Sequelize'][(_0x63fe('0x52'))](_0x63fe('0x53'));}if(_0x3c87b5['filename']){return _0xde74b7['download'](_0x3c87b5[_0x63fe('0x4e')],_0x3c87b5[_0x63fe('0x54')]+path['extname'](_0x3c87b5[_0x63fe('0x4e')]),function(){if(_0x28506a){fs['unlink'](_0x3c87b5['value']);}});}else{return _0xde74b7['download'](_0x3c87b5['value'],function(_0x512da1){if(_0x28506a){fs[_0x63fe('0x56')](_0x3c87b5[_0x63fe('0x4e')]);}});}}})[_0x63fe('0x47')](handleError(_0xde74b7,null));};exports[_0x63fe('0x63')]=function(_0x1bfae7,_0x3e768f){return db[_0x63fe('0x2b')]['find']({'where':{'id':_0x1bfae7['params']['id']}})[_0x63fe('0x26')](function(_0x65d838){if(!_0x65d838)throw new ReferenceError(_0x63fe('0x64'));return _0x65d838;})[_0x63fe('0x26')](function(_0x300c2e){var _0x22d363=_0x300c2e[_0x63fe('0x4e')];logger[_0x63fe('0x65')](_0x63fe('0x66'),_0x22d363);if(!_[_0x63fe('0x67')](_0x300c2e[_0x63fe('0x4e')])&&fs[_0x63fe('0x60')](_0x22d363)){logger[_0x63fe('0x65')]('File:\x20\x22'+_0x22d363+_0x63fe('0x68'));fs['unlinkSync'](_0x22d363);}_0x22d363=_0x22d363+_0x63fe('0x69');if(!_['isNil'](_0x300c2e[_0x63fe('0x4e')])&&fs['existsSync'](_0x22d363)){logger[_0x63fe('0x65')](_0x63fe('0x6a')+_0x22d363+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x22d363);}return _0x300c2e;})[_0x63fe('0x26')](function(_0x2f9c64){if(!_0x2f9c64)throw new InternalError();return _0x2f9c64['destroy']();})[_0x63fe('0x26')](function(){_0x3e768f['status'](0xcc)[_0x63fe('0x20')]();})[_0x63fe('0x47')](handleError(_0x3e768f,null));};function getBucketslist(_0x19305e,_0x484a38,_0x7761b5){return new Promise(function(_0x3680e3,_0x43786f){var _0x147796=new AWS['S3']({'accessKeyId':_0x484a38,'secretAccessKey':_0x19305e,'region':_0x7761b5});_0x147796[_0x63fe('0x6b')]({},function(_0x1e0948,_0x2644f4){if(_0x1e0948){return _0x43786f(_0x1e0948);}else{return _0x3680e3(_0x2644f4);}});});}function createBucket(_0x4db94a,_0x439f87,_0x4931ae,_0x43a82c){return new Promise(function(_0x115a1e,_0x2eba3a){var _0x4ed9ed=new AWS['S3']({'accessKeyId':_0x439f87,'secretAccessKey':_0x4db94a,'region':_0x4931ae});_0x4ed9ed[_0x63fe('0x6c')]({'Bucket':_0x43a82c},function(_0x3d1b3c,_0x14c2c1){if(_0x3d1b3c){return _0x2eba3a(_0x3d1b3c);}else{return _0x115a1e(_0x14c2c1);}});});}function uploadFile(_0x58c6de,_0x458b53,_0x15f2c9,_0x34199b,_0x4d3461,_0xe68d1d){return new Promise(function(_0x52128a,_0x561350){var _0xc55c03=new AWS['S3']({'accessKeyId':_0x458b53,'secretAccessKey':_0x58c6de,'region':_0x15f2c9});_0xc55c03['upload']({'Bucket':_0x34199b,'Key':_0x4d3461,'Body':_0xe68d1d},function(_0x55edb8,_0xf5c016){if(_0x55edb8){return _0x561350(_0x55edb8);}else{return _0x52128a(_0xf5c016);}});});}function startTranscribe(_0x4f117f,_0x322279,_0x2496d8,_0x23b817,_0x51f2e4,_0xe783a2){return new Promise(function(_0x265e1c,_0x1b3af7){var _0x2ace0e=new AWS[(_0x63fe('0x6d'))]({'accessKeyId':_0x322279,'secretAccessKey':_0x4f117f,'region':_0x2496d8});_0x2ace0e[_0x63fe('0x6e')]({'TranscriptionJobName':_0x23b817,'LanguageCode':_0x51f2e4,'Media':{'MediaFileUri':_0xe783a2}},function(_0x1bee75,_0x471c94){if(_0x1bee75){return _0x1b3af7(_0x1bee75);}else{return _0x265e1c(_0x471c94);}});});}function transcribe(_0x32e315,_0x48fa07,_0x392b2a,_0x4c6791,_0x453ddf,_0x3ec9c5,_0xab193e){return new Promise(function(_0x5cb09c,_0x563e0b){var _0xaff6ab={};logger['info'](util[_0x63fe('0x31')](_0x63fe('0x6f'),_0x32e315,_0x453ddf));return uploadFile(_0x48fa07,_0x392b2a,_0x4c6791,_0x453ddf,path['basename'](_0x3ec9c5),fs[_0x63fe('0x70')](_0x3ec9c5))[_0x63fe('0x26')](function(_0x12e6cf){logger[_0x63fe('0x65')](util[_0x63fe('0x31')](_0x63fe('0x71'),_0x32e315,_0x453ddf,_0x12e6cf[_0x63fe('0x72')]));_0xaff6ab[_0x63fe('0x73')]=_0x12e6cf[_0x63fe('0x74')];_0xaff6ab[_0x63fe('0x75')]=_0x12e6cf[_0x63fe('0x72')];logger[_0x63fe('0x65')](util['format'](_0x63fe('0x76'),_0x32e315));return startTranscribe(_0x48fa07,_0x392b2a,_0x4c6791,uuidv4(),_0xab193e,_0x12e6cf['Location']);})[_0x63fe('0x26')](function(_0x14404d){logger[_0x63fe('0x65')](util[_0x63fe('0x31')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x32e315,_0x14404d['TranscriptionJob']['TranscriptionJobName']));_0xaff6ab[_0x63fe('0x77')]=_0x14404d[_0x63fe('0x78')]['TranscriptionJobName'];_0xaff6ab[_0x63fe('0x79')]=_0x14404d[_0x63fe('0x78')][_0x63fe('0x7a')];return _0x5cb09c(_0xaff6ab);})['catch'](function(_0x38b919){return _0x563e0b(_0x38b919);});});}exports['runTranscribe']=function(_0x365b1d,_0x37fb39,_0x25cc50){var _0x4c80b5;var _0x1bdde1;var _0x208e6c;var _0x3e4143=require('../../components/encryptor');return db[_0x63fe('0x2b')]['findOne']({'where':{'id':_0x365b1d[_0x63fe('0x48')]['id']}})[_0x63fe('0x26')](function(_0x3d14b6){if(_0x3d14b6){var _0x47ced5=util[_0x63fe('0x31')](_0x63fe('0x4f'),_0x3d14b6[_0x63fe('0x4e')]);if(fs['existsSync'](_0x47ced5)){cypher=!![];return _0x3e4143[_0x63fe('0x61')](_0x47ced5,_0x3d14b6[_0x63fe('0x4e')],config[_0x63fe('0x62')]['recording'])[_0x63fe('0x26')](function(){return _0x3d14b6;});}return _0x3d14b6;}})[_0x63fe('0x26')](function(_0x53fced){if(!_0x53fced){throw new db[(_0x63fe('0x51'))]['ValidationError'](_0x63fe('0x7b'));}_0x1bdde1=_0x53fced;return db[_0x63fe('0x7c')][_0x63fe('0x7d')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x37fb39,null))[_0x63fe('0x26')](function(_0x35d0a3){if(_0x35d0a3){_0x4c80b5=_0x35d0a3;if(!_0x4c80b5[_0x63fe('0x7e')]||!_0x4c80b5[_0x63fe('0x7f')]||!_0x4c80b5[_0x63fe('0x80')]||!_0x4c80b5[_0x63fe('0x81')]||!_0x4c80b5[_0x63fe('0x73')]){throw new db['Sequelize'][(_0x63fe('0x52'))]('Transcribe\x20not\x20configured');}if(_0x365b1d['body'][_0x63fe('0x82')]&&(!_0x4c80b5['sentiment']||!_0x4c80b5[_0x63fe('0x83')]||!_0x4c80b5['sentimentRegion']||!_0x4c80b5['language']||!_0x4c80b5[_0x63fe('0x73')])){throw new db[(_0x63fe('0x51'))][(_0x63fe('0x52'))](_0x63fe('0x84'));}return db['CloudProvider']['findOne']({'where':{'id':_0x4c80b5[_0x63fe('0x7f')]}});}})[_0x63fe('0x26')](function(_0x140e18){if(!_0x140e18){throw new db[(_0x63fe('0x51'))][(_0x63fe('0x52'))](_0x63fe('0x85'));}if(!_0x140e18[_0x63fe('0x86')]||!_0x140e18['data2']){throw new db[(_0x63fe('0x51'))]['ValidationError'](_0x63fe('0x87'));}_0x208e6c=_0x140e18;return getBucketslist(_0x208e6c[_0x63fe('0x86')],_0x208e6c[_0x63fe('0x88')],_0x4c80b5[_0x63fe('0x80')]);})[_0x63fe('0x26')](function(_0x1938fc){if(_0x1938fc&&_0x1938fc['Buckets']){var _0x4465f7=_[_0x63fe('0x49')](_0x1938fc[_0x63fe('0x89')],function(_0x3fb8f9){return _0x3fb8f9[_0x63fe('0x8a')]===_0x4c80b5['bucket'];});if(!_0x4465f7){logger[_0x63fe('0x65')](util[_0x63fe('0x31')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x365b1d[_0x63fe('0x48')]['id'],_0x4c80b5['bucket']));return createBucket(_0x208e6c[_0x63fe('0x86')],_0x208e6c[_0x63fe('0x88')],_0x4c80b5[_0x63fe('0x80')],_0x4c80b5[_0x63fe('0x73')]);}logger['info'](util[_0x63fe('0x31')](_0x63fe('0x8b'),_0x365b1d['params']['id'],_0x4c80b5[_0x63fe('0x73')]));return;}})['then'](function(_0x569192){if(_0x1bdde1[_0x63fe('0x79')]===_0x63fe('0x8c')){return transcribe(_0x365b1d[_0x63fe('0x48')]['id'],_0x208e6c[_0x63fe('0x86')],_0x208e6c[_0x63fe('0x88')],_0x4c80b5[_0x63fe('0x80')],_0x4c80b5['bucket'],_0x1bdde1[_0x63fe('0x4e')],_0x4c80b5[_0x63fe('0x81')]);}else{logger[_0x63fe('0x65')](util[_0x63fe('0x31')](_0x63fe('0x8d'),_0x365b1d[_0x63fe('0x48')]['id']));return{'transcribeStatus':_0x63fe('0x8e')};}})['then'](function(_0x2dcb00){if(_0x2dcb00){_0x2dcb00[_0x63fe('0x8f')]=_0x365b1d[_0x63fe('0x4b')][_0x63fe('0x82')];return _0x1bdde1['updateAttributes'](_0x2dcb00);}})[_0x63fe('0x26')](respondWithResult(_0x37fb39,null))['catch'](handleError(_0x37fb39,null));};function writeFile(_0x1b0419,_0x1f0f41){return new Promise(function(_0x586c22,_0x11f8e8){fs[_0x63fe('0x90')](_0x1f0f41,_0x1b0419,function(_0x8d64a5,_0x246baf){if(_0x8d64a5){return _0x11f8e8(_0x8d64a5);}else{return _0x586c22(_0x246baf);}});});}exports[_0x63fe('0x91')]=function(_0x1f0abe,_0x444482,_0x5779c3){return db[_0x63fe('0x2b')][_0x63fe('0x7d')]({'where':{'id':_0x1f0abe[_0x63fe('0x48')]['id']}})[_0x63fe('0x26')](handleEntityNotFound(_0x444482))[_0x63fe('0x26')](function(_0x3f6db9){if(_0x3f6db9&&_0x3f6db9[_0x63fe('0x92')]){var _0x4704d1=_0x3f6db9[_0x63fe('0x92')];var _0x1b17b0=config[_0x63fe('0x93')]+_0x63fe('0x94')+_0x3f6db9['id']+_0x63fe('0x95');if(fs[_0x63fe('0x60')](_0x1b17b0)){return _0x1b17b0;}return writeFile(_0x4704d1,_0x1b17b0)['then'](function(){return _0x1b17b0;});}else{throw new db[(_0x63fe('0x51'))][(_0x63fe('0x52'))](_0x63fe('0x96'));}})[_0x63fe('0x26')](function(_0x39a473){return _0x444482[_0x63fe('0x4d')](_0x39a473);})[_0x63fe('0x47')](handleError(_0x444482));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 150c297..c54fdf4 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 _0xe447=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe447,0x189));var _0x7e44=function(_0x34533,_0x531aeb){_0x34533=_0x34533-0x0;var _0x5810ff=_0xe447[_0x34533];return _0x5810ff;};'use strict';var _=require(_0x7e44('0x0'));var util=require(_0x7e44('0x1'));var logger=require(_0x7e44('0x2'))(_0x7e44('0x3'));var moment=require('moment');var BPromise=require(_0x7e44('0x4'));var rp=require(_0x7e44('0x5'));var fs=require('fs');var path=require(_0x7e44('0x6'));var rimraf=require(_0x7e44('0x7'));var config=require(_0x7e44('0x8'));var attributes=require(_0x7e44('0x9'));module[_0x7e44('0xa')]=function(_0x4c40b3,_0x5d115b){return _0x4c40b3[_0x7e44('0xb')](_0x7e44('0xc'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x7e44('0xd'),'fields':[_0x7e44('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8846=['api','moment','bluebird','path','../../config/environment','define','VoiceRecording','voice_recordings','uniqueid','../../config/logger'];(function(_0x16da97,_0x3df39e){var _0x4148fd=function(_0x2877a5){while(--_0x2877a5){_0x16da97['push'](_0x16da97['shift']());}};_0x4148fd(++_0x3df39e);}(_0x8846,0x17b));var _0x6884=function(_0x1c3f51,_0x7e8e12){_0x1c3f51=_0x1c3f51-0x0;var _0xcdc3ff=_0x8846[_0x1c3f51];return _0xcdc3ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6884('0x0'))(_0x6884('0x1'));var moment=require(_0x6884('0x2'));var BPromise=require(_0x6884('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6884('0x4'));var rimraf=require('rimraf');var config=require(_0x6884('0x5'));var attributes=require('./voiceRecording.attributes');module['exports']=function(_0x3388d8,_0x4dc325){return _0x3388d8[_0x6884('0x6')](_0x6884('0x7'),attributes,{'tableName':_0x6884('0x8'),'paranoid':![],'indexes':[{'name':_0x6884('0x9'),'fields':[_0x6884('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 882085b..b891da3 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 _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x255c48,_0x2a4449){var _0xaebda3=function(_0x12a04e){while(--_0x12a04e){_0x255c48['push'](_0x255c48['shift']());}};_0xaebda3(++_0x2a4449);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','VoiceRecording','update','body','options','raw','then','UpdateVoiceRecording','stringify','CreateVoiceRecording'];(function(_0x9e48c3,_0x226549){var _0x7fa7b2=function(_0x2a6eac){while(--_0x2a6eac){_0x9e48c3['push'](_0x9e48c3['shift']());}};_0x7fa7b2(++_0x226549);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['UpdateVoiceRecording']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')](_0x459eb1[_0x0a9e('0x16')],{'raw':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')][_0x0a9e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['where']||null:null,'attributes':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1[_0x0a9e('0x17')]['attributes']||null:null,'limit':_0x459eb1[_0x0a9e('0x17')]?_0x459eb1['options']['limit']||null:null})[_0x0a9e('0x19')](function(_0x432e56){logger[_0x0a9e('0xa')](_0x0a9e('0x1a'),_0x459eb1);logger['debug'](_0x0a9e('0x1a'),_0x459eb1,JSON[_0x0a9e('0x1b')](_0x432e56));_0x106033(_0x432e56);})[_0x0a9e('0x13')](function(_0x4d00e6){logger[_0x0a9e('0x10')](_0x0a9e('0x1a'),_0x4d00e6[_0x0a9e('0x11')],_0x459eb1);_0x205fd6(_0x478723['error'](0x1f4,_0x4d00e6['message']));});});};exports[_0x0a9e('0x1c')]=function(_0x3a8e58){var _0x40c424=this;return new Promise(function(_0x33161b,_0x526cf3){var _0x384319=require('../../components/encryptor');var _0x45a1e7;return db['Setting'][_0x0a9e('0x1d')]({'attributes':['id',_0x0a9e('0x1e')],'where':{'id':0x1},'raw':!![]})[_0x0a9e('0x19')](function(_0x14433c){_0x45a1e7=_0x14433c;return db[_0x0a9e('0x14')][_0x0a9e('0x1f')](_0x3a8e58[_0x0a9e('0x16')]);})[_0x0a9e('0x19')](function(_0x5a101a){if(_0x45a1e7[_0x0a9e('0x1e')]&&fs[_0x0a9e('0x20')](_0x5a101a[_0x0a9e('0x21')])){var _0x2ec755=util['format'](_0x0a9e('0x22'),_0x5a101a[_0x0a9e('0x21')]);return _0x384319[_0x0a9e('0x23')](_0x5a101a[_0x0a9e('0x21')],_0x2ec755,config[_0x0a9e('0x24')][_0x0a9e('0x25')])[_0x0a9e('0x19')](function(){fs[_0x0a9e('0x26')](_0x5a101a[_0x0a9e('0x21')]);logger['info'](_0x0a9e('0x27'));return _0x5a101a;});}return _0x5a101a;})['then'](function(_0x2407f9){logger[_0x0a9e('0xa')](_0x0a9e('0x1c'),_0x3a8e58);logger[_0x0a9e('0xd')](_0x0a9e('0x1c'),_0x3a8e58,JSON['stringify'](_0x2407f9));_0x33161b(_0x2407f9);})[_0x0a9e('0x13')](function(_0x46f0a5){logger[_0x0a9e('0x10')](_0x0a9e('0x1c'),_0x46f0a5[_0x0a9e('0x11')],_0x3a8e58);_0x526cf3(_0x40c424[_0x0a9e('0x10')](0x1f4,_0x46f0a5[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 8f4898b..1da0874 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 _0x8eca=['put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create'];(function(_0x3fbd1,_0x55e05a){var _0x192053=function(_0x2cefe3){while(--_0x2cefe3){_0x3fbd1['push'](_0x3fbd1['shift']());}};_0x192053(++_0x55e05a);}(_0x8eca,0x193));var _0xa8ec=function(_0x12bd1e,_0x17a330){_0x12bd1e=_0x12bd1e-0x0;var _0x5caaeb=_0x8eca[_0x12bd1e];return _0x5caaeb;};'use strict';var multer=require(_0xa8ec('0x0'));var util=require(_0xa8ec('0x1'));var path=require(_0xa8ec('0x2'));var timeout=require('connect-timeout');var express=require(_0xa8ec('0x3'));var router=express[_0xa8ec('0x4')]();var auth=require(_0xa8ec('0x5'));var interaction=require(_0xa8ec('0x6'));var config=require(_0xa8ec('0x7'));var controller=require(_0xa8ec('0x8'));router[_0xa8ec('0x9')]('/',auth[_0xa8ec('0xa')](),controller['index']);router[_0xa8ec('0x9')](_0xa8ec('0xb'),auth[_0xa8ec('0xa')](),controller[_0xa8ec('0xc')]);router[_0xa8ec('0x9')](_0xa8ec('0xd'),auth[_0xa8ec('0xa')](),controller[_0xa8ec('0xe')]);router[_0xa8ec('0xf')]('/',auth[_0xa8ec('0xa')](),controller[_0xa8ec('0x10')]);router[_0xa8ec('0x11')](_0xa8ec('0xd'),auth[_0xa8ec('0xa')](),controller['update']);router[_0xa8ec('0x12')](_0xa8ec('0xd'),auth['isAuthenticated'](),controller[_0xa8ec('0x13')]);module[_0xa8ec('0x14')]=router; \ No newline at end of file +var _0x7fb5=['../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','describe','show','create','/:id','update','delete','destroy','multer','util','path','express','Router'];(function(_0x368611,_0x4b8e6f){var _0x3d0da6=function(_0x1c2bd1){while(--_0x1c2bd1){_0x368611['push'](_0x368611['shift']());}};_0x3d0da6(++_0x4b8e6f);}(_0x7fb5,0x13f));var _0x57fb=function(_0x3428b6,_0x2a4168){_0x3428b6=_0x3428b6-0x0;var _0x180563=_0x7fb5[_0x3428b6];return _0x180563;};'use strict';var multer=require(_0x57fb('0x0'));var util=require(_0x57fb('0x1'));var path=require(_0x57fb('0x2'));var timeout=require('connect-timeout');var express=require(_0x57fb('0x3'));var router=express[_0x57fb('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x57fb('0x5'));var config=require(_0x57fb('0x6'));var controller=require(_0x57fb('0x7'));router[_0x57fb('0x8')]('/',auth[_0x57fb('0x9')](),controller[_0x57fb('0xa')]);router[_0x57fb('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x57fb('0xb')]);router[_0x57fb('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x57fb('0xc')]);router['post']('/',auth[_0x57fb('0x9')](),controller[_0x57fb('0xd')]);router['put'](_0x57fb('0xe'),auth[_0x57fb('0x9')](),controller[_0x57fb('0xf')]);router[_0x57fb('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x57fb('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 392a854..099a72c 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 _0xdb59=['sequelize','exports','ENUM','attended','STRING','Yes'];(function(_0x47f41a,_0x34eb17){var _0x8487b7=function(_0xcaf108){while(--_0xcaf108){_0x47f41a['push'](_0x47f41a['shift']());}};_0x8487b7(++_0x34eb17);}(_0xdb59,0x7e));var _0x9db5=function(_0xe30e17,_0xce02be){_0xe30e17=_0xe30e17-0x0;var _0x2342c9=_0xdb59[_0xe30e17];return _0x2342c9;};'use strict';var Sequelize=require(_0x9db5('0x0'));var moment=require('moment');module[_0x9db5('0x1')]={'type':{'type':Sequelize[_0x9db5('0x2')]('blind',_0x9db5('0x3'))},'result':{'type':Sequelize[_0x9db5('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x9db5('0x4')]},'transferercalleridname':{'type':Sequelize[_0x9db5('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x9db5('0x4')]},'transfererexten':{'type':Sequelize[_0x9db5('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x9db5('0x4')]},'transfereechannel':{'type':Sequelize[_0x9db5('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x9db5('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x9db5('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x9db5('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x9db5('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x9db5('0x4')]},'transfereecontext':{'type':Sequelize[_0x9db5('0x4')]},'transfereeexten':{'type':Sequelize[_0x9db5('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x9db5('0x4')]},'isexternal':{'type':Sequelize[_0x9db5('0x2')](_0x9db5('0x5'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x9db5('0x4')]}}; \ No newline at end of file +var _0x0cf0=['blind','attended','STRING','Yes','sequelize','moment','ENUM'];(function(_0x48cda9,_0x575113){var _0xe47e76=function(_0x502303){while(--_0x502303){_0x48cda9['push'](_0x48cda9['shift']());}};_0xe47e76(++_0x575113);}(_0x0cf0,0xc8));var _0x00cf=function(_0x407dbd,_0x2dda7d){_0x407dbd=_0x407dbd-0x0;var _0x3fbce3=_0x0cf0[_0x407dbd];return _0x3fbce3;};'use strict';var Sequelize=require(_0x00cf('0x0'));var moment=require(_0x00cf('0x1'));module['exports']={'type':{'type':Sequelize[_0x00cf('0x2')](_0x00cf('0x3'),_0x00cf('0x4'))},'result':{'type':Sequelize[_0x00cf('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x00cf('0x5')]},'transferercalleridname':{'type':Sequelize[_0x00cf('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x00cf('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x00cf('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x00cf('0x5')]},'transfereechannel':{'type':Sequelize[_0x00cf('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x00cf('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x00cf('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x00cf('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x00cf('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x00cf('0x5')]},'transfereecontext':{'type':Sequelize[_0x00cf('0x5')]},'transfereeexten':{'type':Sequelize[_0x00cf('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM'](_0x00cf('0x6'),'No')},'context':{'type':Sequelize[_0x00cf('0x5')]},'extension':{'type':Sequelize[_0x00cf('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 55ee470..c4acc5d 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 _0x6a3e=['send','index','map','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','VoiceTransferReport','includeAll','include','findAll','rows','catch','show','filters','length','find','create','body','update','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','reject','save','then','destroy','sendStatus','stack','name'];(function(_0x3a91d7,_0x4c9256){var _0x432921=function(_0x4f120b){while(--_0x4f120b){_0x3a91d7['push'](_0x3a91d7['shift']());}};_0x432921(++_0x4c9256);}(_0x6a3e,0x187));var _0xe6a3=function(_0x5a4187,_0x452e26){_0x5a4187=_0x5a4187-0x0;var _0x535681=_0x6a3e[_0x5a4187];return _0x535681;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe6a3('0x0'));var jsonpatch=require(_0xe6a3('0x1'));var rp=require(_0xe6a3('0x2'));var moment=require('moment');var BPromise=require(_0xe6a3('0x3'));var Mustache=require(_0xe6a3('0x4'));var util=require('util');var path=require(_0xe6a3('0x5'));var sox=require(_0xe6a3('0x6'));var csv=require(_0xe6a3('0x7'));var ejs=require(_0xe6a3('0x8'));var fs=require('fs');var _=require(_0xe6a3('0x9'));var squel=require('squel');var crypto=require(_0xe6a3('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe6a3('0xb'));var toCsv=require(_0xe6a3('0x7'));var querystring=require(_0xe6a3('0xc'));var Papa=require(_0xe6a3('0xd'));var Redis=require(_0xe6a3('0xe'));var authService=require(_0xe6a3('0xf'));var qs=require(_0xe6a3('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6a3('0x11'));var logger=require(_0xe6a3('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xe6a3('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xe6a3('0x14'))['db'];function respondWithStatusCode(_0xa5f1ed,_0x483577){_0x483577=_0x483577||0xcc;return function(_0x5005eb){if(_0x5005eb){return _0xa5f1ed['sendStatus'](_0x483577);}return _0xa5f1ed[_0xe6a3('0x15')](_0x483577)[_0xe6a3('0x16')]();};}function respondWithResult(_0x2a2584,_0x16b3db){_0x16b3db=_0x16b3db||0xc8;return function(_0x39112c){if(_0x39112c){return _0x2a2584[_0xe6a3('0x15')](_0x16b3db)['json'](_0x39112c);}};}function respondWithFilteredResult(_0x17d386,_0x1c0ebe){return function(_0x2405a6){if(_0x2405a6){var _0x339ee5=_0x2405a6[_0xe6a3('0x17')],_0x2ebc18=_0x1c0ebe[_0xe6a3('0x18')],_0x3e6665=_0x1c0ebe['offset']+_0x1c0ebe[_0xe6a3('0x19')],_0x18f0d2;if(_0x3e6665>=_0x339ee5){_0x3e6665=_0x339ee5;_0x18f0d2=0xc8;}else{_0x18f0d2=0xce;}_0x17d386[_0xe6a3('0x15')](_0x18f0d2);return _0x17d386[_0xe6a3('0x1a')](_0xe6a3('0x1b'),_0x2ebc18+'-'+_0x3e6665+'/'+_0x339ee5)['json'](_0x2405a6);}return null;};}function patchUpdates(_0x3d99a1){return function(_0x2de773){try{jsonpatch['apply'](_0x2de773,_0x3d99a1,!![]);}catch(_0x569256){return BPromise[_0xe6a3('0x1c')](_0x569256);}return _0x2de773[_0xe6a3('0x1d')]();};}function saveUpdates(_0x316064,_0x4ed636){return function(_0x5322ca){if(_0x5322ca){return _0x5322ca['update'](_0x316064)[_0xe6a3('0x1e')](function(_0x666fe3){return _0x666fe3;});}return null;};}function removeEntity(_0x327a0b,_0x1a8c3e){return function(_0x139959){if(_0x139959){return _0x139959[_0xe6a3('0x1f')]()['then'](function(){_0x327a0b[_0xe6a3('0x15')](0xcc)[_0xe6a3('0x16')]();});}};}function handleEntityNotFound(_0x5c1f1e,_0x2632fb){return function(_0x4b7599){if(!_0x4b7599){_0x5c1f1e[_0xe6a3('0x20')](0x194);}return _0x4b7599;};}function handleError(_0x4c0164,_0x1edcf0){_0x1edcf0=_0x1edcf0||0x1f4;return function(_0x3823d6){logger['error'](_0x3823d6[_0xe6a3('0x21')]);if(_0x3823d6[_0xe6a3('0x22')]){delete _0x3823d6[_0xe6a3('0x22')];}_0x4c0164[_0xe6a3('0x15')](_0x1edcf0)[_0xe6a3('0x23')](_0x3823d6);};}exports[_0xe6a3('0x24')]=function(_0x2e1fd6,_0x2cbdd1){var _0x2e55ec={},_0x2efee7={},_0xd1a280={'count':0x0,'rows':[]};var _0x48ad7b=_[_0xe6a3('0x25')](db['VoiceTransferReport'][_0xe6a3('0x26')],function(_0x583259){return{'name':_0x583259[_0xe6a3('0x27')],'type':_0x583259[_0xe6a3('0x28')]['key']};});_0x2efee7['model']=_[_0xe6a3('0x25')](_0x48ad7b,'name');_0x2efee7[_0xe6a3('0x29')]=_[_0xe6a3('0x2a')](_0x2e1fd6[_0xe6a3('0x29')]);_0x2efee7['filters']=_[_0xe6a3('0x2b')](_0x2efee7[_0xe6a3('0x2c')],_0x2efee7[_0xe6a3('0x29')]);_0x2e55ec[_0xe6a3('0x2d')]=_[_0xe6a3('0x2b')](_0x2efee7[_0xe6a3('0x2c')],qs['fields'](_0x2e1fd6['query'][_0xe6a3('0x2e')]));_0x2e55ec[_0xe6a3('0x2d')]=_0x2e55ec[_0xe6a3('0x2d')]['length']?_0x2e55ec[_0xe6a3('0x2d')]:_0x2efee7[_0xe6a3('0x2c')];if(!_0x2e1fd6['query'][_0xe6a3('0x2f')](_0xe6a3('0x30'))){_0x2e55ec[_0xe6a3('0x19')]=qs[_0xe6a3('0x19')](_0x2e1fd6[_0xe6a3('0x29')][_0xe6a3('0x19')]);_0x2e55ec['offset']=qs[_0xe6a3('0x18')](_0x2e1fd6[_0xe6a3('0x29')][_0xe6a3('0x18')]);}_0x2e55ec[_0xe6a3('0x31')]=qs[_0xe6a3('0x32')](_0x2e1fd6['query'][_0xe6a3('0x32')]);_0x2e55ec['where']=qs['filters'](_[_0xe6a3('0x33')](_0x2e1fd6[_0xe6a3('0x29')],_0x2efee7['filters']),_0x48ad7b);if(_0x2e1fd6[_0xe6a3('0x29')][_0xe6a3('0x34')]){_0x2e55ec[_0xe6a3('0x35')]=_[_0xe6a3('0x36')](_0x2e55ec[_0xe6a3('0x35')],{'$or':_[_0xe6a3('0x25')](_0x48ad7b,function(_0x3aedfd){if(_0x3aedfd[_0xe6a3('0x28')]!==_0xe6a3('0x37')){var _0x4f914a={};_0x4f914a[_0x3aedfd['name']]={'$like':'%'+_0x2e1fd6[_0xe6a3('0x29')][_0xe6a3('0x34')]+'%'};return _0x4f914a;}})});}_0x2e55ec=_['merge']({},_0x2e55ec,_0x2e1fd6[_0xe6a3('0x38')]);var _0x27a4ea={'where':_0x2e55ec[_0xe6a3('0x35')]};return db[_0xe6a3('0x39')][_0xe6a3('0x17')](_0x27a4ea)['then'](function(_0x2b3cdf){_0xd1a280[_0xe6a3('0x17')]=_0x2b3cdf;if(_0x2e1fd6['query'][_0xe6a3('0x3a')]){_0x2e55ec[_0xe6a3('0x3b')]=[{'all':!![]}];}return db[_0xe6a3('0x39')][_0xe6a3('0x3c')](_0x2e55ec);})[_0xe6a3('0x1e')](function(_0x1b6ad4){_0xd1a280[_0xe6a3('0x3d')]=_0x1b6ad4;return _0xd1a280;})[_0xe6a3('0x1e')](respondWithFilteredResult(_0x2cbdd1,_0x2e55ec))[_0xe6a3('0x3e')](handleError(_0x2cbdd1,null));};exports[_0xe6a3('0x3f')]=function(_0x155dab,_0x1a515d){var _0x2a18e3={'raw':!![],'where':{'id':_0x155dab['params']['id']}},_0x43f762={};_0x43f762[_0xe6a3('0x2c')]=_['keys'](db[_0xe6a3('0x39')][_0xe6a3('0x26')]);_0x43f762['query']=_[_0xe6a3('0x2a')](_0x155dab[_0xe6a3('0x29')]);_0x43f762[_0xe6a3('0x40')]=_[_0xe6a3('0x2b')](_0x43f762[_0xe6a3('0x2c')],_0x43f762[_0xe6a3('0x29')]);_0x2a18e3[_0xe6a3('0x2d')]=_[_0xe6a3('0x2b')](_0x43f762[_0xe6a3('0x2c')],qs[_0xe6a3('0x2e')](_0x155dab[_0xe6a3('0x29')]['fields']));_0x2a18e3['attributes']=_0x2a18e3['attributes'][_0xe6a3('0x41')]?_0x2a18e3[_0xe6a3('0x2d')]:_0x43f762[_0xe6a3('0x2c')];if(_0x155dab[_0xe6a3('0x29')]['includeAll']){_0x2a18e3[_0xe6a3('0x3b')]=[{'all':!![]}];}_0x2a18e3=_[_0xe6a3('0x36')]({},_0x2a18e3,_0x155dab[_0xe6a3('0x38')]);return db[_0xe6a3('0x39')][_0xe6a3('0x42')](_0x2a18e3)[_0xe6a3('0x1e')](handleEntityNotFound(_0x1a515d,null))['then'](respondWithResult(_0x1a515d,null))[_0xe6a3('0x3e')](handleError(_0x1a515d,null));};exports[_0xe6a3('0x43')]=function(_0x474a0e,_0x19e214){return db['VoiceTransferReport'][_0xe6a3('0x43')](_0x474a0e[_0xe6a3('0x44')],{})[_0xe6a3('0x1e')](respondWithResult(_0x19e214,0xc9))['catch'](handleError(_0x19e214,null));};exports[_0xe6a3('0x45')]=function(_0x4f729d,_0x10c9b1){if(_0x4f729d[_0xe6a3('0x44')]['id']){delete _0x4f729d[_0xe6a3('0x44')]['id'];}return db['VoiceTransferReport'][_0xe6a3('0x42')]({'where':{'id':_0x4f729d['params']['id']}})[_0xe6a3('0x1e')](handleEntityNotFound(_0x10c9b1,null))[_0xe6a3('0x1e')](saveUpdates(_0x4f729d[_0xe6a3('0x44')],null))[_0xe6a3('0x1e')](respondWithResult(_0x10c9b1,null))[_0xe6a3('0x3e')](handleError(_0x10c9b1,null));};exports[_0xe6a3('0x1f')]=function(_0x1ba6df,_0x11ee16){return db[_0xe6a3('0x39')]['find']({'where':{'id':_0x1ba6df['params']['id']}})['then'](handleEntityNotFound(_0x11ee16,null))[_0xe6a3('0x1e')](removeEntity(_0x11ee16,null))['catch'](handleError(_0x11ee16,null));};exports[_0xe6a3('0x46')]=function(_0x14e949,_0x44503d){return db[_0xe6a3('0x39')][_0xe6a3('0x46')]()[_0xe6a3('0x1e')](respondWithResult(_0x44503d,null))[_0xe6a3('0x3e')](handleError(_0x44503d,null));}; \ No newline at end of file +var _0x1762=['../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','stack','name','index','rawAttributes','type','key','map','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceTransferReport','includeAll','include','findAll','rows','catch','params','keys','length','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0xc897e0,_0x26033e){var _0x55cb0b=function(_0x36bb65){while(--_0x36bb65){_0xc897e0['push'](_0xc897e0['shift']());}};_0x55cb0b(++_0x26033e);}(_0x1762,0xc2));var _0x2176=function(_0xdad1ce,_0x3e95d5){_0xdad1ce=_0xdad1ce-0x0;var _0x4e37d3=_0x1762[_0xdad1ce];return _0x4e37d3;};'use strict';var pdf=require(_0x2176('0x0'));var emlformat=require(_0x2176('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2176('0x2'));var jsonpatch=require(_0x2176('0x3'));var rp=require(_0x2176('0x4'));var moment=require(_0x2176('0x5'));var BPromise=require(_0x2176('0x6'));var Mustache=require(_0x2176('0x7'));var util=require(_0x2176('0x8'));var path=require(_0x2176('0x9'));var sox=require(_0x2176('0xa'));var csv=require(_0x2176('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2176('0xc'));var crypto=require('crypto');var jsforce=require(_0x2176('0xd'));var deskjs=require(_0x2176('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2176('0xf'));var Papa=require(_0x2176('0x10'));var Redis=require(_0x2176('0x11'));var authService=require(_0x2176('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2176('0x13'));var logger=require('../../config/logger')(_0x2176('0x14'));var utils=require(_0x2176('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2176('0x16'));var db=require(_0x2176('0x17'))['db'];function respondWithStatusCode(_0x26f6d6,_0x5ed1a5){_0x5ed1a5=_0x5ed1a5||0xcc;return function(_0x265d79){if(_0x265d79){return _0x26f6d6[_0x2176('0x18')](_0x5ed1a5);}return _0x26f6d6[_0x2176('0x19')](_0x5ed1a5)[_0x2176('0x1a')]();};}function respondWithResult(_0x1146b2,_0x4d2825){_0x4d2825=_0x4d2825||0xc8;return function(_0x59d0f4){if(_0x59d0f4){return _0x1146b2['status'](_0x4d2825)[_0x2176('0x1b')](_0x59d0f4);}};}function respondWithFilteredResult(_0x11b210,_0x1d29ff){return function(_0x34315d){if(_0x34315d){var _0x4826df=_0x34315d[_0x2176('0x1c')],_0x229daf=_0x1d29ff['offset'],_0x17d01c=_0x1d29ff[_0x2176('0x1d')]+_0x1d29ff[_0x2176('0x1e')],_0x324e63;if(_0x17d01c>=_0x4826df){_0x17d01c=_0x4826df;_0x324e63=0xc8;}else{_0x324e63=0xce;}_0x11b210[_0x2176('0x19')](_0x324e63);return _0x11b210['set'](_0x2176('0x1f'),_0x229daf+'-'+_0x17d01c+'/'+_0x4826df)['json'](_0x34315d);}return null;};}function patchUpdates(_0x36851b){return function(_0x3b8141){try{jsonpatch['apply'](_0x3b8141,_0x36851b,!![]);}catch(_0x5c31cb){return BPromise[_0x2176('0x20')](_0x5c31cb);}return _0x3b8141[_0x2176('0x21')]();};}function saveUpdates(_0x1a8a0f,_0x141308){return function(_0x153997){if(_0x153997){return _0x153997[_0x2176('0x22')](_0x1a8a0f)[_0x2176('0x23')](function(_0x1ca757){return _0x1ca757;});}return null;};}function removeEntity(_0x3ad399,_0x70011d){return function(_0x39b5a2){if(_0x39b5a2){return _0x39b5a2['destroy']()[_0x2176('0x23')](function(){_0x3ad399['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x53d44d,_0xec7bac){return function(_0x44fddd){if(!_0x44fddd){_0x53d44d[_0x2176('0x18')](0x194);}return _0x44fddd;};}function handleError(_0x74184,_0x169f61){_0x169f61=_0x169f61||0x1f4;return function(_0x1655e9){logger['error'](_0x1655e9[_0x2176('0x24')]);if(_0x1655e9[_0x2176('0x25')]){delete _0x1655e9['name'];}_0x74184[_0x2176('0x19')](_0x169f61)['send'](_0x1655e9);};}exports[_0x2176('0x26')]=function(_0x460d02,_0x5f4a1a){var _0x433a42={},_0x3ab4cb={},_0x2b25c5={'count':0x0,'rows':[]};var _0x5a261a=_['map'](db['VoiceTransferReport'][_0x2176('0x27')],function(_0x1c2eeb){return{'name':_0x1c2eeb['fieldName'],'type':_0x1c2eeb[_0x2176('0x28')][_0x2176('0x29')]};});_0x3ab4cb['model']=_[_0x2176('0x2a')](_0x5a261a,_0x2176('0x25'));_0x3ab4cb[_0x2176('0x2b')]=_['keys'](_0x460d02[_0x2176('0x2b')]);_0x3ab4cb[_0x2176('0x2c')]=_[_0x2176('0x2d')](_0x3ab4cb[_0x2176('0x2e')],_0x3ab4cb[_0x2176('0x2b')]);_0x433a42['attributes']=_['intersection'](_0x3ab4cb[_0x2176('0x2e')],qs[_0x2176('0x2f')](_0x460d02['query'][_0x2176('0x2f')]));_0x433a42[_0x2176('0x30')]=_0x433a42[_0x2176('0x30')]['length']?_0x433a42['attributes']:_0x3ab4cb[_0x2176('0x2e')];if(!_0x460d02[_0x2176('0x2b')][_0x2176('0x31')]('nolimit')){_0x433a42[_0x2176('0x1e')]=qs[_0x2176('0x1e')](_0x460d02[_0x2176('0x2b')][_0x2176('0x1e')]);_0x433a42[_0x2176('0x1d')]=qs[_0x2176('0x1d')](_0x460d02[_0x2176('0x2b')][_0x2176('0x1d')]);}_0x433a42[_0x2176('0x32')]=qs[_0x2176('0x33')](_0x460d02['query'][_0x2176('0x33')]);_0x433a42[_0x2176('0x34')]=qs['filters'](_[_0x2176('0x35')](_0x460d02[_0x2176('0x2b')],_0x3ab4cb['filters']),_0x5a261a);if(_0x460d02[_0x2176('0x2b')][_0x2176('0x36')]){_0x433a42[_0x2176('0x34')]=_[_0x2176('0x37')](_0x433a42[_0x2176('0x34')],{'$or':_[_0x2176('0x2a')](_0x5a261a,function(_0xfd6841){if(_0xfd6841[_0x2176('0x28')]!==_0x2176('0x38')){var _0x44074b={};_0x44074b[_0xfd6841[_0x2176('0x25')]]={'$like':'%'+_0x460d02[_0x2176('0x2b')]['filter']+'%'};return _0x44074b;}})});}_0x433a42=_[_0x2176('0x37')]({},_0x433a42,_0x460d02[_0x2176('0x39')]);var _0x3d63a7={'where':_0x433a42[_0x2176('0x34')]};return db[_0x2176('0x3a')][_0x2176('0x1c')](_0x3d63a7)['then'](function(_0x58a9a3){_0x2b25c5[_0x2176('0x1c')]=_0x58a9a3;if(_0x460d02[_0x2176('0x2b')][_0x2176('0x3b')]){_0x433a42[_0x2176('0x3c')]=[{'all':!![]}];}return db[_0x2176('0x3a')][_0x2176('0x3d')](_0x433a42);})[_0x2176('0x23')](function(_0x544234){_0x2b25c5[_0x2176('0x3e')]=_0x544234;return _0x2b25c5;})['then'](respondWithFilteredResult(_0x5f4a1a,_0x433a42))[_0x2176('0x3f')](handleError(_0x5f4a1a,null));};exports['show']=function(_0x42eac6,_0x3ffd7d){var _0x57dd4d={'raw':!![],'where':{'id':_0x42eac6[_0x2176('0x40')]['id']}},_0x48ecca={};_0x48ecca['model']=_[_0x2176('0x41')](db[_0x2176('0x3a')][_0x2176('0x27')]);_0x48ecca['query']=_[_0x2176('0x41')](_0x42eac6['query']);_0x48ecca[_0x2176('0x2c')]=_[_0x2176('0x2d')](_0x48ecca['model'],_0x48ecca[_0x2176('0x2b')]);_0x57dd4d[_0x2176('0x30')]=_[_0x2176('0x2d')](_0x48ecca[_0x2176('0x2e')],qs['fields'](_0x42eac6[_0x2176('0x2b')][_0x2176('0x2f')]));_0x57dd4d['attributes']=_0x57dd4d[_0x2176('0x30')][_0x2176('0x42')]?_0x57dd4d[_0x2176('0x30')]:_0x48ecca[_0x2176('0x2e')];if(_0x42eac6[_0x2176('0x2b')][_0x2176('0x3b')]){_0x57dd4d[_0x2176('0x3c')]=[{'all':!![]}];}_0x57dd4d=_['merge']({},_0x57dd4d,_0x42eac6[_0x2176('0x39')]);return db[_0x2176('0x3a')][_0x2176('0x43')](_0x57dd4d)[_0x2176('0x23')](handleEntityNotFound(_0x3ffd7d,null))['then'](respondWithResult(_0x3ffd7d,null))['catch'](handleError(_0x3ffd7d,null));};exports[_0x2176('0x44')]=function(_0x2bdaa0,_0x434430){return db[_0x2176('0x3a')][_0x2176('0x44')](_0x2bdaa0[_0x2176('0x45')],{})[_0x2176('0x23')](respondWithResult(_0x434430,0xc9))[_0x2176('0x3f')](handleError(_0x434430,null));};exports[_0x2176('0x22')]=function(_0x4ad43d,_0x312cd2){if(_0x4ad43d[_0x2176('0x45')]['id']){delete _0x4ad43d[_0x2176('0x45')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x4ad43d[_0x2176('0x40')]['id']}})[_0x2176('0x23')](handleEntityNotFound(_0x312cd2,null))[_0x2176('0x23')](saveUpdates(_0x4ad43d[_0x2176('0x45')],null))[_0x2176('0x23')](respondWithResult(_0x312cd2,null))['catch'](handleError(_0x312cd2,null));};exports['destroy']=function(_0x3c29fb,_0x21398a){return db[_0x2176('0x3a')]['find']({'where':{'id':_0x3c29fb[_0x2176('0x40')]['id']}})['then'](handleEntityNotFound(_0x21398a,null))['then'](removeEntity(_0x21398a,null))[_0x2176('0x3f')](handleError(_0x21398a,null));};exports[_0x2176('0x46')]=function(_0x446acf,_0x593820){return db[_0x2176('0x3a')][_0x2176('0x46')]()[_0x2176('0x23')](respondWithResult(_0x593820,null))['catch'](handleError(_0x593820,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index d479785..dcd6cbf 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 _0x8425=['./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x115621,_0x341cde){var _0x5ef5ce=function(_0x2ca3f2){while(--_0x2ca3f2){_0x115621['push'](_0x115621['shift']());}};_0x5ef5ce(++_0x341cde);}(_0x8425,0x1a5));var _0x5842=function(_0x2b8e48,_0x1d4f1f){_0x2b8e48=_0x2b8e48-0x0;var _0x31f9f0=_0x8425[_0x2b8e48];return _0x31f9f0;};'use strict';var _=require(_0x5842('0x0'));var util=require(_0x5842('0x1'));var logger=require('../../config/logger')(_0x5842('0x2'));var moment=require(_0x5842('0x3'));var BPromise=require(_0x5842('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5842('0x5'));var rimraf=require(_0x5842('0x6'));var config=require(_0x5842('0x7'));var attributes=require(_0x5842('0x8'));module[_0x5842('0x9')]=function(_0x24a672,_0x3db420){return _0x24a672[_0x5842('0xa')](_0x5842('0xb'),attributes,{'tableName':_0x5842('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd868=['VoiceTransferReport','lodash','../../config/logger','api','bluebird','../../config/environment','./voiceTransferReport.attributes','exports','define'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xd868,0xfd));var _0x8d86=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xd868[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x8d86('0x0'));var util=require('util');var logger=require(_0x8d86('0x1'))(_0x8d86('0x2'));var moment=require('moment');var BPromise=require(_0x8d86('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8d86('0x4'));var attributes=require(_0x8d86('0x5'));module[_0x8d86('0x6')]=function(_0x5a78c5,_0x159a83){return _0x5a78c5[_0x8d86('0x7')](_0x8d86('0x8'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index baa23ae..efd72c9 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 _0xffe1=['message','result','catch','VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1af5bb,_0x3640ab){var _0x42a053=function(_0x2c3aff){while(--_0x2c3aff){_0x1af5bb['push'](_0x1af5bb['shift']());}};_0x42a053(++_0x3640ab);}(_0xffe1,0x175));var _0x1ffe=function(_0x1c5f16,_0x23f05f){_0x1c5f16=_0x1c5f16-0x0;var _0x4ced51=_0xffe1[_0x1c5f16];return _0x4ced51;};'use strict';var _=require(_0x1ffe('0x0'));var util=require(_0x1ffe('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1ffe('0x2'));var fs=require('fs');var Redis=require(_0x1ffe('0x3'));var db=require(_0x1ffe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ffe('0x5'))(_0x1ffe('0x6'));var config=require(_0x1ffe('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1ffe('0x8')][_0x1ffe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6bc1ed,_0x26e370,_0xb34112){return new BPromise(function(_0x8eee2b,_0x4d2a28){return client['request'](_0x6bc1ed,_0xb34112)[_0x1ffe('0xa')](function(_0x13556e){logger[_0x1ffe('0xb')](_0x1ffe('0xc'),_0x26e370,'request\x20sent');logger[_0x1ffe('0xd')](_0x1ffe('0xe'),_0x26e370,_0x1ffe('0xf'),JSON[_0x1ffe('0x10')](_0x13556e));if(_0x13556e[_0x1ffe('0x11')]){if(_0x13556e[_0x1ffe('0x11')][_0x1ffe('0x12')]===0x1f4){logger[_0x1ffe('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x26e370,_0x13556e[_0x1ffe('0x11')][_0x1ffe('0x13')]);return _0x4d2a28(_0x13556e['error'][_0x1ffe('0x13')]);}logger[_0x1ffe('0x11')](_0x1ffe('0xc'),_0x26e370,_0x13556e[_0x1ffe('0x11')][_0x1ffe('0x13')]);return _0x8eee2b(_0x13556e['error'][_0x1ffe('0x13')]);}else{logger[_0x1ffe('0xb')](_0x1ffe('0xc'),_0x26e370,'request\x20sent');_0x8eee2b(_0x13556e[_0x1ffe('0x14')]['message']);}})[_0x1ffe('0x15')](function(_0x565922){logger[_0x1ffe('0x11')](_0x1ffe('0xc'),_0x26e370,_0x565922);_0x4d2a28(_0x565922);});});}exports['CreateVoiceTransferReport']=function(_0x561670){var _0x4dbd7f=this;return new Promise(function(_0x42b92c,_0x21950f){return db[_0x1ffe('0x16')][_0x1ffe('0x17')](_0x561670[_0x1ffe('0x18')],{'raw':_0x561670[_0x1ffe('0x19')]?_0x561670[_0x1ffe('0x19')][_0x1ffe('0x1a')]===undefined?!![]:![]:!![]})[_0x1ffe('0xa')](function(_0x38f189){logger[_0x1ffe('0xb')](_0x1ffe('0x1b'),_0x561670);logger['debug']('CreateVoiceTransferReport',_0x561670,JSON[_0x1ffe('0x10')](_0x38f189));_0x42b92c(_0x38f189);})[_0x1ffe('0x15')](function(_0x95071c){logger['error']('CreateVoiceTransferReport',_0x95071c[_0x1ffe('0x13')],_0x561670);_0x21950f(_0x4dbd7f[_0x1ffe('0x11')](0x1f4,_0x95071c[_0x1ffe('0x13')]));});});}; \ No newline at end of file +var _0x2d70=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','options','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x51a0e0,_0x548947){var _0x1df01b=function(_0x349ff1){while(--_0x349ff1){_0x51a0e0['push'](_0x51a0e0['shift']());}};_0x1df01b(++_0x548947);}(_0x2d70,0xd2));var _0x02d7=function(_0xdbe2de,_0x3bdc5a){_0xdbe2de=_0xdbe2de-0x0;var _0x2facd7=_0x2d70[_0xdbe2de];return _0x2facd7;};'use strict';var _=require(_0x02d7('0x0'));var util=require('util');var moment=require(_0x02d7('0x1'));var BPromise=require(_0x02d7('0x2'));var rs=require(_0x02d7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x02d7('0x4'))['db'];var utils=require(_0x02d7('0x5'));var logger=require(_0x02d7('0x6'))(_0x02d7('0x7'));var config=require(_0x02d7('0x8'));var jayson=require(_0x02d7('0x9'));var client=jayson[_0x02d7('0xa')][_0x02d7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25cb04,_0x452704,_0x2bbbe6){return new BPromise(function(_0x3fb1ff,_0x1577d6){return client['request'](_0x25cb04,_0x2bbbe6)[_0x02d7('0xc')](function(_0x20edb3){logger[_0x02d7('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x452704,_0x02d7('0xe'));logger[_0x02d7('0xf')](_0x02d7('0x10'),_0x452704,_0x02d7('0xe'),JSON[_0x02d7('0x11')](_0x20edb3));if(_0x20edb3[_0x02d7('0x12')]){if(_0x20edb3[_0x02d7('0x12')][_0x02d7('0x13')]===0x1f4){logger[_0x02d7('0x12')](_0x02d7('0x14'),_0x452704,_0x20edb3[_0x02d7('0x12')][_0x02d7('0x15')]);return _0x1577d6(_0x20edb3[_0x02d7('0x12')][_0x02d7('0x15')]);}logger['error'](_0x02d7('0x14'),_0x452704,_0x20edb3[_0x02d7('0x12')][_0x02d7('0x15')]);return _0x3fb1ff(_0x20edb3[_0x02d7('0x12')]['message']);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x452704,_0x02d7('0xe'));_0x3fb1ff(_0x20edb3[_0x02d7('0x16')][_0x02d7('0x15')]);}})[_0x02d7('0x17')](function(_0x49f212){logger[_0x02d7('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x452704,_0x49f212);_0x1577d6(_0x49f212);});});}exports[_0x02d7('0x18')]=function(_0x1e5370){var _0x36d35b=this;return new Promise(function(_0x38216f,_0x34cbff){return db[_0x02d7('0x19')]['create'](_0x1e5370['body'],{'raw':_0x1e5370[_0x02d7('0x1a')]?_0x1e5370[_0x02d7('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x02d7('0xc')](function(_0x68f2cc){logger[_0x02d7('0xd')](_0x02d7('0x18'),_0x1e5370);logger[_0x02d7('0xf')](_0x02d7('0x18'),_0x1e5370,JSON[_0x02d7('0x11')](_0x68f2cc));_0x38216f(_0x68f2cc);})[_0x02d7('0x17')](function(_0x5c0b71){logger['error'](_0x02d7('0x18'),_0x5c0b71[_0x02d7('0x15')],_0x1e5370);_0x34cbff(_0x36d35b[_0x02d7('0x12')](0x1f4,_0x5c0b71['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index b74a20e..522246a 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 _0x9b67=['/answer','answer','/hold','/unhold','/calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','isAuthenticated','canUpdate','/hangup','hangup'];(function(_0x314bce,_0x21dc88){var _0x3bfb6c=function(_0x205e92){while(--_0x205e92){_0x314bce['push'](_0x314bce['shift']());}};_0x3bfb6c(++_0x21dc88);}(_0x9b67,0xf6));var _0x79b6=function(_0x44041d,_0x7f04e2){_0x44041d=_0x44041d-0x0;var _0x3c441b=_0x9b67[_0x44041d];return _0x3c441b;};'use strict';var express=require(_0x79b6('0x0'));var router=express[_0x79b6('0x1')]();var auth=require(_0x79b6('0x2'));var controller=require(_0x79b6('0x3'));router[_0x79b6('0x4')]('/originate',auth[_0x79b6('0x5')](),auth[_0x79b6('0x6')](),controller['originate']);router['post'](_0x79b6('0x7'),auth[_0x79b6('0x5')](),auth[_0x79b6('0x6')](),controller[_0x79b6('0x8')]);router[_0x79b6('0x4')](_0x79b6('0x9'),auth[_0x79b6('0x5')](),auth['canUpdate'](),controller[_0x79b6('0xa')]);router[_0x79b6('0x4')](_0x79b6('0xb'),auth[_0x79b6('0x5')](),auth[_0x79b6('0x6')](),controller['hold']);router[_0x79b6('0x4')](_0x79b6('0xc'),auth[_0x79b6('0x5')](),auth[_0x79b6('0x6')](),controller['unhold']);router['post'](_0x79b6('0xd'),auth[_0x79b6('0x5')](),auth[_0x79b6('0x6')](),controller['calls']);router[_0x79b6('0x4')](_0x79b6('0xe'),auth[_0x79b6('0x5')](),auth[_0x79b6('0x6')](),controller[_0x79b6('0xf')]);module[_0x79b6('0x10')]=router; \ No newline at end of file +var _0x65f4=['originate','isAuthenticated','hangup','/answer','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','../../components/auth/service','./webbar.controller','post','canUpdate'];(function(_0x311d29,_0x5edca3){var _0x4eb590=function(_0x51529f){while(--_0x51529f){_0x311d29['push'](_0x311d29['shift']());}};_0x4eb590(++_0x5edca3);}(_0x65f4,0x19a));var _0x465f=function(_0x3d25ce,_0x237816){_0x3d25ce=_0x3d25ce-0x0;var _0x57365f=_0x65f4[_0x3d25ce];return _0x57365f;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x465f('0x0'));var controller=require(_0x465f('0x1'));router[_0x465f('0x2')]('/originate',auth['isAuthenticated'](),auth[_0x465f('0x3')](),controller[_0x465f('0x4')]);router[_0x465f('0x2')]('/hangup',auth[_0x465f('0x5')](),auth[_0x465f('0x3')](),controller[_0x465f('0x6')]);router['post'](_0x465f('0x7'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x465f('0x8')]);router[_0x465f('0x2')](_0x465f('0x9'),auth[_0x465f('0x5')](),auth[_0x465f('0x3')](),controller[_0x465f('0xa')]);router[_0x465f('0x2')](_0x465f('0xb'),auth['isAuthenticated'](),auth[_0x465f('0x3')](),controller[_0x465f('0xc')]);router[_0x465f('0x2')](_0x465f('0xd'),auth[_0x465f('0x5')](),auth[_0x465f('0x3')](),controller[_0x465f('0xe')]);router[_0x465f('0x2')](_0x465f('0xf'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x465f('0x10')]);module[_0x465f('0x11')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 170189d..b2e47ec 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 _0x38df=['path','lodash','../../mysqldb','../../config/environment','util','bluebird','http','../../config/logger','webbarapi','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','format','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber'];(function(_0x1b997f,_0x1c21b8){var _0x195a5d=function(_0x133013){while(--_0x133013){_0x1b997f['push'](_0x1b997f['shift']());}};_0x195a5d(++_0x1c21b8);}(_0x38df,0x144));var _0xf38d=function(_0x29f0d1,_0x329499){_0x29f0d1=_0x29f0d1-0x0;var _0x4560d3=_0x38df[_0x29f0d1];return _0x4560d3;};'use strict';var path=require(_0xf38d('0x0'));var fs=require('fs');var _=require(_0xf38d('0x1'));var db=require(_0xf38d('0x2'))['db'];var config=require(_0xf38d('0x3'));var util=require(_0xf38d('0x4'));var BPromise=require(_0xf38d('0x5'));var jayson=require('jayson/promise');var amiClient=jayson['client'][_0xf38d('0x6')]({'port':0x232a});var logger=require(_0xf38d('0x7'))(_0xf38d('0x8'));var Redis=require('ioredis');config[_0xf38d('0x9')]=_[_0xf38d('0xa')](config[_0xf38d('0x9')],{'host':_0xf38d('0xb'),'port':0x18eb});var io=require(_0xf38d('0xc'))(new Redis(config[_0xf38d('0x9')]));var Schema=require(_0xf38d('0xd'));var originateValidation=new Schema({'userId':{'type':_0xf38d('0xe'),'required':[!![],_0xf38d('0xf')]},'callNumber':{'type':_0xf38d('0x10'),'required':[!![],_0xf38d('0x11')]},'callerId':{'type':_0xf38d('0x10')},'callbackUrl':{'type':_0xf38d('0x10')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf38d('0xf')]},'sessionId':{'type':_0xf38d('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf38d('0xe'),'required':[!![],_0xf38d('0xf')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf38d('0xf')]},'sessionId':{'type':_0xf38d('0x10'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xf38d('0x10'),'required':[!![],_0xf38d('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0xf38d('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf38d('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf38d('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xf38d('0xe'),'required':[!![],_0xf38d('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0xf38d('0xe'),'required':[!![],_0xf38d('0xf')]}});function emit(_0xb42d76,_0x52dffb,_0xef11a2){logger[_0xf38d('0x13')](_0xb42d76,_0x52dffb,JSON[_0xf38d('0x14')](_0xef11a2));io['to'](_0xb42d76)[_0xf38d('0x15')](_0x52dffb,_0xef11a2);}function handleError(_0x299cb6){return function(_0x41fc14){console[_0xf38d('0x16')](_0xf38d('0x17'),_0x41fc14,_0x41fc14 instanceof RangeError);logger[_0xf38d('0x18')](_0x41fc14[_0xf38d('0x19')]);if(_0x41fc14 instanceof RangeError){if(_0x41fc14[_0xf38d('0x1a')]){delete _0x41fc14[_0xf38d('0x1a')];}_0x299cb6[_0xf38d('0x1b')](0x194)[_0xf38d('0x1c')](_0x41fc14);}else{if(_0x41fc14['name']){delete _0x41fc14[_0xf38d('0x1a')];}_0x299cb6[_0xf38d('0x1b')](0x1f4)[_0xf38d('0x1c')](_0x41fc14);}};}function checkError(){return function(_0x362b80){if(!_0x362b80){throw new RangeError(_0xf38d('0x1d'));}return _0x362b80;};}function respondWithRpcPromise(_0x4fad06,_0x4dcbe5){return new BPromise(function(_0x10a45d,_0x581eee){var _0x1269e5=amiClient;return _0x1269e5[_0xf38d('0x1e')](_0x4fad06,_0x4dcbe5)[_0xf38d('0x1f')](function(_0x941f7){if(_0x941f7[_0xf38d('0x18')]){if(_0x941f7[_0xf38d('0x18')][_0xf38d('0x20')]===0x1f4){return _0x581eee(_0x941f7[_0xf38d('0x18')][_0xf38d('0x21')]);}return _0x10a45d(_0x941f7['error']['message']);}else{_0x10a45d(_0x941f7[_0xf38d('0x22')]);}})[_0xf38d('0x23')](function(_0x872ee7){_0x581eee(_0x872ee7);});});}function getAgent(_0x1b2ade){return db[_0xf38d('0x24')][_0xf38d('0x25')]({'where':{'id':_0x1b2ade,'role':_0xf38d('0x26')}})[_0xf38d('0x1f')](checkError());}function getAgentCheckSession(_0x220cbf,_0x57d6b1){return new BPromise(function(_0x1168c8,_0x2eb126){var _0xab53ae=respondWithRpcPromise('VoiceChannels');var _0x32c032=getAgent(_0x220cbf);Promise['all']([_0xab53ae,_0x32c032])[_0xf38d('0x1f')](function(_0x3972a1){var _0x174f0f=_0x3972a1[0x0];var _0x81e997=_0x3972a1[0x1];var _0x52d387=_[_0xf38d('0x27')](_0x174f0f[_0xf38d('0x28')],function(_0x324ec7){return _0x324ec7[_0xf38d('0x29')]==_0x81e997['id']&&_0x324ec7[_0xf38d('0x2a')]==_0x57d6b1;});if(_0x52d387[_0xf38d('0x2b')]==0x1){_0x1168c8(_0x81e997);}else{_0x2eb126(new RangeError(_0xf38d('0x2c')+_0x57d6b1+_0xf38d('0x2d')));}});});}exports[_0xf38d('0x2e')]=function(_0x3447d1,_0x1f0a21){logger[_0xf38d('0x13')](_0xf38d('0x2f'),_0x3447d1[_0xf38d('0x30')]);var _0x558d58=originateValidation[_0xf38d('0xd')](_0x3447d1['body']);if(_0x558d58[_0xf38d('0x2b')]>0x0){return _0x1f0a21[_0xf38d('0x1b')](0x190)[_0xf38d('0x31')](_0x558d58);}var _0x3bc21a=_0x3447d1[_0xf38d('0x30')][_0xf38d('0x32')];var _0x265319=_0x3447d1[_0xf38d('0x30')][_0xf38d('0x33')];var _0x5497fc=_0x3447d1[_0xf38d('0x30')][_0xf38d('0x34')];var _0x44e5ac=_0x3447d1[_0xf38d('0x30')][_0xf38d('0x35')];return getAgent(_0x3bc21a)['then'](function(_0x2795e8){logger[_0xf38d('0x13')](_0xf38d('0x36'),_0x2795e8[_0xf38d('0x1a')]);emit(util['format'](_0xf38d('0x37'),_0x2795e8[_0xf38d('0x1a')]),_0xf38d('0x38'),{'callNumber':_0x265319,'callerId':_0x5497fc,'callbackUrl':_0x44e5ac});return _0x1f0a21['status'](0xc8)[_0xf38d('0x31')]({'error':![],'message':_0xf38d('0x39')});})[_0xf38d('0x23')](handleError(_0x1f0a21));};exports[_0xf38d('0x3a')]=function(_0x404831,_0x32e3c3){logger['info'](_0xf38d('0x3b'),_0x404831['body']);var _0x588ab8=hangupValidation[_0xf38d('0xd')](_0x404831[_0xf38d('0x30')]);if(_0x588ab8[_0xf38d('0x2b')]>0x0){return _0x32e3c3[_0xf38d('0x1b')](0x190)[_0xf38d('0x31')](_0x588ab8);}var _0x1f0a04=_0x404831['body'][_0xf38d('0x32')];var _0x3aa3b3=_0x404831['body'][_0xf38d('0x2a')];return getAgent(_0x1f0a04)[_0xf38d('0x1f')](function(_0x225d7d){logger[_0xf38d('0x13')]('entityFound:',_0x225d7d[_0xf38d('0x1a')]);emit(util[_0xf38d('0x3c')](_0xf38d('0x37'),_0x225d7d['name']),_0xf38d('0x3d'),{'sessionId':_0x3aa3b3});return _0x32e3c3['status'](0xc8)['json']({'error':![],'message':_0xf38d('0x3e')});})[_0xf38d('0x23')](handleError(_0x32e3c3));};exports[_0xf38d('0x3f')]=function(_0x46ae08,_0x3ecdca){logger[_0xf38d('0x13')](_0xf38d('0x40'),_0x46ae08[_0xf38d('0x30')]);var _0x1592b8=answerValidation[_0xf38d('0xd')](_0x46ae08[_0xf38d('0x30')]);if(_0x1592b8[_0xf38d('0x2b')]>0x0){return _0x3ecdca[_0xf38d('0x1b')](0x190)[_0xf38d('0x31')](_0x1592b8);}var _0x33dacb=_0x46ae08['body']['userId'];var _0x261361=_0x46ae08[_0xf38d('0x30')]['sessionId'];return getAgent(_0x33dacb)[_0xf38d('0x1f')](function(_0x1c3326){logger[_0xf38d('0x13')]('entityFound:',_0x1c3326[_0xf38d('0x1a')]);emit(util[_0xf38d('0x3c')](_0xf38d('0x37'),_0x1c3326[_0xf38d('0x1a')]),'webbar:answer',{'sessionId':_0x261361});return _0x3ecdca[_0xf38d('0x1b')](0xc8)[_0xf38d('0x31')]({'error':![],'message':_0xf38d('0x41')});})[_0xf38d('0x23')](handleError(_0x3ecdca));};exports['hold']=function(_0xd43a41,_0x1199a3){logger[_0xf38d('0x13')](_0xf38d('0x42'),_0xd43a41[_0xf38d('0x30')]);var _0x196745=holdValidation[_0xf38d('0xd')](_0xd43a41[_0xf38d('0x30')]);if(_0x196745['length']>0x0){return _0x1199a3['status'](0x190)[_0xf38d('0x31')](_0x196745);}var _0x19d703=_0xd43a41[_0xf38d('0x30')][_0xf38d('0x32')];var _0x11b3b7=_0xd43a41[_0xf38d('0x30')]['sessionId'];return getAgent(_0x19d703)['then'](function(_0x2672e4){logger['info']('entityFound:',_0x2672e4[_0xf38d('0x1a')]);emit(util[_0xf38d('0x3c')](_0xf38d('0x37'),_0x2672e4['name']),_0xf38d('0x43'),{'sessionId':_0x11b3b7});return _0x1199a3[_0xf38d('0x1b')](0xc8)[_0xf38d('0x31')]({'error':![],'message':_0xf38d('0x44')});})[_0xf38d('0x23')](handleError(_0x1199a3));};exports[_0xf38d('0x45')]=function(_0x11ac95,_0x20b803){logger['info']('unhold\x20fired:',_0x11ac95['body']);var _0x4c7123=unholdValidation[_0xf38d('0xd')](_0x11ac95[_0xf38d('0x30')]);if(_0x4c7123[_0xf38d('0x2b')]>0x0){return _0x20b803[_0xf38d('0x1b')](0x190)[_0xf38d('0x31')](_0x4c7123);}var _0x5a26e7=_0x11ac95[_0xf38d('0x30')][_0xf38d('0x32')];var _0x3b319c=_0x11ac95['body'][_0xf38d('0x2a')];return getAgent(_0x5a26e7)['then'](function(_0x15d07b){logger[_0xf38d('0x13')](_0xf38d('0x36'),_0x15d07b[_0xf38d('0x1a')]);emit(util[_0xf38d('0x3c')](_0xf38d('0x37'),_0x15d07b[_0xf38d('0x1a')]),_0xf38d('0x46'),{'sessionId':_0x3b319c});return _0x20b803[_0xf38d('0x1b')](0xc8)[_0xf38d('0x31')]({'error':![],'message':_0xf38d('0x47')});})['catch'](handleError(_0x20b803));};exports[_0xf38d('0x48')]=function(_0x5577b5,_0x23bc78){logger['info'](_0xf38d('0x49'),_0x23bc78[_0xf38d('0x30')]);var _0x1f2ec9=callsValidation[_0xf38d('0xd')](_0x5577b5[_0xf38d('0x30')]);if(_0x1f2ec9[_0xf38d('0x2b')]>0x0){return _0x23bc78[_0xf38d('0x1b')](0x190)[_0xf38d('0x31')](_0x1f2ec9);}var _0x10df7c=_0x5577b5['body'][_0xf38d('0x32')];var _0x6257a=respondWithRpcPromise('VoiceChannels');var _0x12f2ef=getAgent(_0x10df7c);return Promise[_0xf38d('0x4a')]([_0x6257a,_0x12f2ef])['then'](function(_0xbaf3d4){var _0x42c6b7=_0xbaf3d4[0x0];var _0x2bbe32=_0xbaf3d4[0x1];var _0x44a0d5=_[_0xf38d('0x27')](_0x42c6b7[_0xf38d('0x28')],function(_0x3b9195){return _0x3b9195[_0xf38d('0x29')]==_0x2bbe32['id'];});return _0x23bc78[_0xf38d('0x1b')](0xc8)[_0xf38d('0x31')]({'count':_0x44a0d5[_0xf38d('0x2b')],'rows':_0x44a0d5});})[_0xf38d('0x23')](handleError(_0x23bc78));};exports[_0xf38d('0x4b')]=function(_0x47b9be,_0x5c782c){logger[_0xf38d('0x13')](_0xf38d('0x4c'),_0x47b9be['body']);var _0x5c928a=conferenceValidation[_0xf38d('0xd')](_0x47b9be[_0xf38d('0x30')]);if(_0x5c928a[_0xf38d('0x2b')]>0x0){return _0x5c782c[_0xf38d('0x1b')](0x190)['json'](_0x5c928a);}var _0x473481=_0x47b9be[_0xf38d('0x30')][_0xf38d('0x32')];return getAgent(_0x473481)[_0xf38d('0x1f')](function(_0x975bb5){logger[_0xf38d('0x13')]('entityFound:',_0x975bb5[_0xf38d('0x1a')]);emit(util['format'](_0xf38d('0x37'),_0x975bb5[_0xf38d('0x1a')]),_0xf38d('0x4d'));return _0x5c782c[_0xf38d('0x1b')](0xc8)[_0xf38d('0x31')]({'error':![],'message':_0xf38d('0x4e')});})[_0xf38d('0x23')](handleError(_0x5c782c));};exports['transfer']=function(_0xf9ce71,_0x1fbc6d){logger[_0xf38d('0x13')](_0xf38d('0x4f'),_0xf9ce71['body']);var _0x50b7ba=transferValidation[_0xf38d('0xd')](_0xf9ce71[_0xf38d('0x30')]);if(_0x50b7ba[_0xf38d('0x2b')]>0x0){return _0x1fbc6d[_0xf38d('0x1b')](0x190)['json'](_0x50b7ba);}var _0x50017a=_0xf9ce71[_0xf38d('0x30')][_0xf38d('0x32')];var _0x2936da=_0xf9ce71[_0xf38d('0x30')]['sessionId'];var _0x2ef92d=_0xf9ce71[_0xf38d('0x30')][_0xf38d('0x50')];return getAgent(_0x50017a)[_0xf38d('0x1f')](function(_0x268976){logger['info'](_0xf38d('0x36'),_0x268976[_0xf38d('0x1a')]);emit(util[_0xf38d('0x3c')](_0xf38d('0x37'),_0x268976['name']),'webbar:transfer',{'sessionId':_0x2936da,'transferNumber':_0x2ef92d});return _0x1fbc6d['status'](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})[_0xf38d('0x23')](handleError(_0x1fbc6d));}; \ No newline at end of file +var _0x81ef=['VoiceChannels','all','rows','sessionId','sessionId\x20','\x20not\x20found!','body','validate','json','userId','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','length','entityFound:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','hold\x20executed!','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','filter','UserId','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','number','string','callNumber\x20is\x20required','userId\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','handleError:','stack','name','send','status','then','message','error','User','agent'];(function(_0x4d7ff2,_0xa1773f){var _0x3da1b0=function(_0x57b476){while(--_0x57b476){_0x4d7ff2['push'](_0x4d7ff2['shift']());}};_0x3da1b0(++_0xa1773f);}(_0x81ef,0xc3));var _0xf81e=function(_0x3f1247,_0x3c665e){_0x3f1247=_0x3f1247-0x0;var _0x135026=_0x81ef[_0x3f1247];return _0x135026;};'use strict';var path=require(_0xf81e('0x0'));var fs=require('fs');var _=require(_0xf81e('0x1'));var db=require(_0xf81e('0x2'))['db'];var config=require(_0xf81e('0x3'));var util=require(_0xf81e('0x4'));var BPromise=require(_0xf81e('0x5'));var jayson=require(_0xf81e('0x6'));var amiClient=jayson['client']['http']({'port':0x232a});var logger=require(_0xf81e('0x7'))(_0xf81e('0x8'));var Redis=require(_0xf81e('0x9'));config[_0xf81e('0xa')]=_[_0xf81e('0xb')](config[_0xf81e('0xa')],{'host':_0xf81e('0xc'),'port':0x18eb});var io=require(_0xf81e('0xd'))(new Redis(config[_0xf81e('0xa')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xf81e('0xe'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xf81e('0xf'),'required':[!![],_0xf81e('0x10')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xf81e('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xf81e('0xe'),'required':[!![],_0xf81e('0x11')]},'sessionId':{'type':_0xf81e('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xf81e('0xe'),'required':[!![],_0xf81e('0x11')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xf81e('0xe'),'required':[!![],_0xf81e('0x11')]},'sessionId':{'type':_0xf81e('0xf'),'required':[!![],_0xf81e('0x12')]},'transferNumber':{'type':_0xf81e('0xf'),'required':[!![],_0xf81e('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0xf81e('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xf81e('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xf81e('0xe'),'required':[!![],_0xf81e('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0xf81e('0x11')]}});function emit(_0x332aa7,_0x5870b6,_0x1c6aac){logger[_0xf81e('0x14')](_0x332aa7,_0x5870b6,JSON[_0xf81e('0x15')](_0x1c6aac));io['to'](_0x332aa7)[_0xf81e('0x16')](_0x5870b6,_0x1c6aac);}function handleError(_0x4e93fd){return function(_0xbd8404){console['log'](_0xf81e('0x17'),_0xbd8404,_0xbd8404 instanceof RangeError);logger['error'](_0xbd8404[_0xf81e('0x18')]);if(_0xbd8404 instanceof RangeError){if(_0xbd8404['name']){delete _0xbd8404[_0xf81e('0x19')];}_0x4e93fd['status'](0x194)[_0xf81e('0x1a')](_0xbd8404);}else{if(_0xbd8404[_0xf81e('0x19')]){delete _0xbd8404[_0xf81e('0x19')];}_0x4e93fd[_0xf81e('0x1b')](0x1f4)['send'](_0xbd8404);}};}function checkError(){return function(_0x33514a){if(!_0x33514a){throw new RangeError('NotFound');}return _0x33514a;};}function respondWithRpcPromise(_0x3a20af,_0x3a012c){return new BPromise(function(_0x3f8e8d,_0x3e7581){var _0x3ea07b=amiClient;return _0x3ea07b['request'](_0x3a20af,_0x3a012c)[_0xf81e('0x1c')](function(_0x1579ad){if(_0x1579ad['error']){if(_0x1579ad['error']['code']===0x1f4){return _0x3e7581(_0x1579ad['error'][_0xf81e('0x1d')]);}return _0x3f8e8d(_0x1579ad[_0xf81e('0x1e')]['message']);}else{_0x3f8e8d(_0x1579ad['result']);}})['catch'](function(_0x498732){_0x3e7581(_0x498732);});});}function getAgent(_0xcb49a2){return db[_0xf81e('0x1f')]['findOne']({'where':{'id':_0xcb49a2,'role':_0xf81e('0x20')}})[_0xf81e('0x1c')](checkError());}function getAgentCheckSession(_0x1536ea,_0x19eeb4){return new BPromise(function(_0x5d4065,_0x360dcd){var _0x101ae1=respondWithRpcPromise(_0xf81e('0x21'));var _0x3b0599=getAgent(_0x1536ea);Promise[_0xf81e('0x22')]([_0x101ae1,_0x3b0599])['then'](function(_0x29482){var _0x12178e=_0x29482[0x0];var _0x224b1b=_0x29482[0x1];var _0x3e3855=_['filter'](_0x12178e[_0xf81e('0x23')],function(_0x4684bd){return _0x4684bd['UserId']==_0x224b1b['id']&&_0x4684bd[_0xf81e('0x24')]==_0x19eeb4;});if(_0x3e3855['length']==0x1){_0x5d4065(_0x224b1b);}else{_0x360dcd(new RangeError(_0xf81e('0x25')+_0x19eeb4+_0xf81e('0x26')));}});});}exports['originate']=function(_0x111900,_0x11d505){logger[_0xf81e('0x14')]('originate\x20fired:',_0x111900[_0xf81e('0x27')]);var _0x4f3eb7=originateValidation[_0xf81e('0x28')](_0x111900[_0xf81e('0x27')]);if(_0x4f3eb7['length']>0x0){return _0x11d505[_0xf81e('0x1b')](0x190)[_0xf81e('0x29')](_0x4f3eb7);}var _0x2053ef=_0x111900['body'][_0xf81e('0x2a')];var _0x4a0a34=_0x111900['body'][_0xf81e('0x2b')];var _0x219a76=_0x111900[_0xf81e('0x27')][_0xf81e('0x2c')];var _0x318375=_0x111900[_0xf81e('0x27')][_0xf81e('0x2d')];return getAgent(_0x2053ef)['then'](function(_0x5a9950){logger[_0xf81e('0x14')]('entityFound:',_0x5a9950[_0xf81e('0x19')]);emit(util[_0xf81e('0x2e')](_0xf81e('0x2f'),_0x5a9950['name']),_0xf81e('0x30'),{'callNumber':_0x4a0a34,'callerId':_0x219a76,'callbackUrl':_0x318375});return _0x11d505[_0xf81e('0x1b')](0xc8)['json']({'error':![],'message':_0xf81e('0x31')});})[_0xf81e('0x32')](handleError(_0x11d505));};exports[_0xf81e('0x33')]=function(_0x27dcff,_0x4986be){logger[_0xf81e('0x14')](_0xf81e('0x34'),_0x27dcff[_0xf81e('0x27')]);var _0xa93e2b=hangupValidation[_0xf81e('0x28')](_0x27dcff['body']);if(_0xa93e2b[_0xf81e('0x35')]>0x0){return _0x4986be[_0xf81e('0x1b')](0x190)[_0xf81e('0x29')](_0xa93e2b);}var _0x43c6a5=_0x27dcff['body'][_0xf81e('0x2a')];var _0x27314a=_0x27dcff[_0xf81e('0x27')][_0xf81e('0x24')];return getAgent(_0x43c6a5)[_0xf81e('0x1c')](function(_0x104b23){logger[_0xf81e('0x14')](_0xf81e('0x36'),_0x104b23[_0xf81e('0x19')]);emit(util[_0xf81e('0x2e')]('user:%s',_0x104b23[_0xf81e('0x19')]),_0xf81e('0x37'),{'sessionId':_0x27314a});return _0x4986be[_0xf81e('0x1b')](0xc8)[_0xf81e('0x29')]({'error':![],'message':_0xf81e('0x38')});})[_0xf81e('0x32')](handleError(_0x4986be));};exports[_0xf81e('0x39')]=function(_0x946d6b,_0x4eb18f){logger[_0xf81e('0x14')](_0xf81e('0x3a'),_0x946d6b[_0xf81e('0x27')]);var _0x2f9385=answerValidation[_0xf81e('0x28')](_0x946d6b[_0xf81e('0x27')]);if(_0x2f9385[_0xf81e('0x35')]>0x0){return _0x4eb18f['status'](0x190)['json'](_0x2f9385);}var _0xc3178c=_0x946d6b[_0xf81e('0x27')][_0xf81e('0x2a')];var _0x3ae349=_0x946d6b[_0xf81e('0x27')][_0xf81e('0x24')];return getAgent(_0xc3178c)[_0xf81e('0x1c')](function(_0x3cb20e){logger[_0xf81e('0x14')]('entityFound:',_0x3cb20e['name']);emit(util[_0xf81e('0x2e')]('user:%s',_0x3cb20e[_0xf81e('0x19')]),_0xf81e('0x3b'),{'sessionId':_0x3ae349});return _0x4eb18f[_0xf81e('0x1b')](0xc8)[_0xf81e('0x29')]({'error':![],'message':_0xf81e('0x3c')});})[_0xf81e('0x32')](handleError(_0x4eb18f));};exports['hold']=function(_0x328c28,_0x324dca){logger['info'](_0xf81e('0x3d'),_0x328c28[_0xf81e('0x27')]);var _0x410e9f=holdValidation[_0xf81e('0x28')](_0x328c28[_0xf81e('0x27')]);if(_0x410e9f['length']>0x0){return _0x324dca[_0xf81e('0x1b')](0x190)['json'](_0x410e9f);}var _0x461372=_0x328c28[_0xf81e('0x27')][_0xf81e('0x2a')];var _0x33c3eb=_0x328c28[_0xf81e('0x27')]['sessionId'];return getAgent(_0x461372)[_0xf81e('0x1c')](function(_0x1434f6){logger[_0xf81e('0x14')](_0xf81e('0x36'),_0x1434f6[_0xf81e('0x19')]);emit(util[_0xf81e('0x2e')](_0xf81e('0x2f'),_0x1434f6['name']),'webbar:hold',{'sessionId':_0x33c3eb});return _0x324dca[_0xf81e('0x1b')](0xc8)[_0xf81e('0x29')]({'error':![],'message':_0xf81e('0x3e')});})['catch'](handleError(_0x324dca));};exports['unhold']=function(_0x2f2c7b,_0x288f98){logger['info'](_0xf81e('0x3f'),_0x2f2c7b[_0xf81e('0x27')]);var _0x18fc8c=unholdValidation[_0xf81e('0x28')](_0x2f2c7b['body']);if(_0x18fc8c['length']>0x0){return _0x288f98[_0xf81e('0x1b')](0x190)[_0xf81e('0x29')](_0x18fc8c);}var _0x2e7863=_0x2f2c7b[_0xf81e('0x27')][_0xf81e('0x2a')];var _0x2d09c1=_0x2f2c7b[_0xf81e('0x27')][_0xf81e('0x24')];return getAgent(_0x2e7863)[_0xf81e('0x1c')](function(_0x3a9d22){logger['info'](_0xf81e('0x36'),_0x3a9d22[_0xf81e('0x19')]);emit(util[_0xf81e('0x2e')](_0xf81e('0x2f'),_0x3a9d22['name']),'webbar:unhold',{'sessionId':_0x2d09c1});return _0x288f98[_0xf81e('0x1b')](0xc8)[_0xf81e('0x29')]({'error':![],'message':_0xf81e('0x40')});})[_0xf81e('0x32')](handleError(_0x288f98));};exports[_0xf81e('0x41')]=function(_0x8fb8b6,_0x1bf08b){logger[_0xf81e('0x14')](_0xf81e('0x42'),_0x1bf08b[_0xf81e('0x27')]);var _0x501e8d=callsValidation[_0xf81e('0x28')](_0x8fb8b6[_0xf81e('0x27')]);if(_0x501e8d[_0xf81e('0x35')]>0x0){return _0x1bf08b['status'](0x190)[_0xf81e('0x29')](_0x501e8d);}var _0x5af128=_0x8fb8b6[_0xf81e('0x27')][_0xf81e('0x2a')];var _0x208c05=respondWithRpcPromise('VoiceChannels');var _0x2ce3cb=getAgent(_0x5af128);return Promise[_0xf81e('0x22')]([_0x208c05,_0x2ce3cb])[_0xf81e('0x1c')](function(_0x2b54c5){var _0x2c0cf7=_0x2b54c5[0x0];var _0x4f789e=_0x2b54c5[0x1];var _0x4f4327=_[_0xf81e('0x43')](_0x2c0cf7[_0xf81e('0x23')],function(_0x3b502c){return _0x3b502c[_0xf81e('0x44')]==_0x4f789e['id'];});return _0x1bf08b['status'](0xc8)[_0xf81e('0x29')]({'count':_0x4f4327[_0xf81e('0x35')],'rows':_0x4f4327});})[_0xf81e('0x32')](handleError(_0x1bf08b));};exports[_0xf81e('0x45')]=function(_0x3c1aca,_0x84bcf9){logger['info'](_0xf81e('0x46'),_0x3c1aca['body']);var _0x55c0cb=conferenceValidation['validate'](_0x3c1aca[_0xf81e('0x27')]);if(_0x55c0cb[_0xf81e('0x35')]>0x0){return _0x84bcf9[_0xf81e('0x1b')](0x190)[_0xf81e('0x29')](_0x55c0cb);}var _0x378a6d=_0x3c1aca[_0xf81e('0x27')][_0xf81e('0x2a')];return getAgent(_0x378a6d)[_0xf81e('0x1c')](function(_0x509a35){logger[_0xf81e('0x14')](_0xf81e('0x36'),_0x509a35[_0xf81e('0x19')]);emit(util[_0xf81e('0x2e')](_0xf81e('0x2f'),_0x509a35['name']),_0xf81e('0x47'));return _0x84bcf9[_0xf81e('0x1b')](0xc8)['json']({'error':![],'message':_0xf81e('0x48')});})[_0xf81e('0x32')](handleError(_0x84bcf9));};exports[_0xf81e('0x49')]=function(_0x69c60c,_0x1ac5cd){logger[_0xf81e('0x14')]('transfer\x20fired:',_0x69c60c['body']);var _0x45d4c2=transferValidation[_0xf81e('0x28')](_0x69c60c[_0xf81e('0x27')]);if(_0x45d4c2[_0xf81e('0x35')]>0x0){return _0x1ac5cd[_0xf81e('0x1b')](0x190)[_0xf81e('0x29')](_0x45d4c2);}var _0x299ab6=_0x69c60c['body'][_0xf81e('0x2a')];var _0x26d6fc=_0x69c60c[_0xf81e('0x27')]['sessionId'];var _0x42bead=_0x69c60c[_0xf81e('0x27')][_0xf81e('0x4a')];return getAgent(_0x299ab6)['then'](function(_0x778268){logger[_0xf81e('0x14')](_0xf81e('0x36'),_0x778268[_0xf81e('0x19')]);emit(util[_0xf81e('0x2e')](_0xf81e('0x2f'),_0x778268[_0xf81e('0x19')]),_0xf81e('0x4b'),{'sessionId':_0x26d6fc,'transferNumber':_0x42bead});return _0x1ac5cd[_0xf81e('0x1b')](0xc8)[_0xf81e('0x29')]({'error':![],'message':'transfer\x20executed!'});})[_0xf81e('0x32')](handleError(_0x1ac5cd));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 36c3d69..435d395 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 _0x6cb4=['/:id/users','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','getAnswers','getAgents','/:id/applications','post','create','addDisposition','/:id/canned_answers','addAnswer'];(function(_0x2cfeca,_0x41b47c){var _0x3ff1e9=function(_0x148e24){while(--_0x148e24){_0x2cfeca['push'](_0x2cfeca['shift']());}};_0x3ff1e9(++_0x41b47c);}(_0x6cb4,0xff));var _0x46cb=function(_0x58ad95,_0x490059){_0x58ad95=_0x58ad95-0x0;var _0x2330f2=_0x6cb4[_0x58ad95];return _0x2330f2;};'use strict';var multer=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var path=require(_0x46cb('0x2'));var timeout=require(_0x46cb('0x3'));var express=require(_0x46cb('0x4'));var router=express[_0x46cb('0x5')]();var auth=require(_0x46cb('0x6'));var interaction=require(_0x46cb('0x7'));var config=require(_0x46cb('0x8'));var controller=require('./whatsappAccount.controller');router[_0x46cb('0x9')]('/',auth['isAuthenticated'](),controller[_0x46cb('0xa')]);router['get'](_0x46cb('0xb'),auth[_0x46cb('0xc')](),controller[_0x46cb('0xd')]);router[_0x46cb('0x9')](_0x46cb('0xe'),auth[_0x46cb('0xc')](),controller['show']);router[_0x46cb('0x9')](_0x46cb('0xf'),auth['isAuthenticated'](),controller[_0x46cb('0x10')]);router[_0x46cb('0x9')]('/:id/canned_answers',auth[_0x46cb('0xc')](),controller[_0x46cb('0x11')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x46cb('0x12')]);router[_0x46cb('0x9')](_0x46cb('0x13'),auth[_0x46cb('0xc')](),controller['getApplications']);router[_0x46cb('0x14')]('/',auth[_0x46cb('0xc')](),controller[_0x46cb('0x15')]);router[_0x46cb('0x14')](_0x46cb('0xf'),auth[_0x46cb('0xc')](),controller[_0x46cb('0x16')]);router[_0x46cb('0x14')](_0x46cb('0x17'),auth[_0x46cb('0xc')](),controller[_0x46cb('0x18')]);router['post'](_0x46cb('0x19'),auth['isAuthenticated'](),controller[_0x46cb('0x1a')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x46cb('0x1b')]);router[_0x46cb('0x14')](_0x46cb('0x1c'),controller[_0x46cb('0x1d')]);router[_0x46cb('0x14')](_0x46cb('0x1e'),auth[_0x46cb('0xc')](),controller[_0x46cb('0x1f')]);router[_0x46cb('0x20')](_0x46cb('0xe'),auth[_0x46cb('0xc')](),controller[_0x46cb('0x21')]);router[_0x46cb('0x22')](_0x46cb('0xe'),auth[_0x46cb('0xc')](),controller[_0x46cb('0x23')]);router[_0x46cb('0x22')](_0x46cb('0xf'),auth[_0x46cb('0xc')](),controller[_0x46cb('0x24')]);router[_0x46cb('0x22')](_0x46cb('0x17'),auth[_0x46cb('0xc')](),controller[_0x46cb('0x25')]);router[_0x46cb('0x22')]('/:id/users',auth['isAuthenticated'](),controller[_0x46cb('0x26')]);module[_0x46cb('0x27')]=router; \ No newline at end of file +var _0x1399=['notify','send','put','/:id','update','delete','destroy','/:id/dispositions','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','/describe','isAuthenticated','show','getDispositions','getAnswers','/:id/users','post','create','addAnswer','addAgents','addApplications'];(function(_0x132297,_0x5b3e34){var _0x50becb=function(_0x3d8222){while(--_0x3d8222){_0x132297['push'](_0x132297['shift']());}};_0x50becb(++_0x5b3e34);}(_0x1399,0x16c));var _0x9139=function(_0x253ed4,_0x342aca){_0x253ed4=_0x253ed4-0x0;var _0x22df23=_0x1399[_0x253ed4];return _0x22df23;};'use strict';var multer=require(_0x9139('0x0'));var util=require(_0x9139('0x1'));var path=require('path');var timeout=require(_0x9139('0x2'));var express=require('express');var router=express[_0x9139('0x3')]();var auth=require(_0x9139('0x4'));var interaction=require(_0x9139('0x5'));var config=require(_0x9139('0x6'));var controller=require(_0x9139('0x7'));router[_0x9139('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9139('0x8')](_0x9139('0x9'),auth[_0x9139('0xa')](),controller['describe']);router[_0x9139('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x9139('0xb')]);router[_0x9139('0x8')]('/:id/dispositions',auth[_0x9139('0xa')](),controller[_0x9139('0xc')]);router['get']('/:id/canned_answers',auth[_0x9139('0xa')](),controller[_0x9139('0xd')]);router[_0x9139('0x8')](_0x9139('0xe'),auth[_0x9139('0xa')](),controller['getAgents']);router['get']('/:id/applications',auth[_0x9139('0xa')](),controller['getApplications']);router[_0x9139('0xf')]('/',auth[_0x9139('0xa')](),controller[_0x9139('0x10')]);router[_0x9139('0xf')]('/:id/dispositions',auth[_0x9139('0xa')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0x9139('0xa')](),controller[_0x9139('0x11')]);router[_0x9139('0xf')](_0x9139('0xe'),auth[_0x9139('0xa')](),controller[_0x9139('0x12')]);router['post']('/:id/applications',auth[_0x9139('0xa')](),controller[_0x9139('0x13')]);router['post']('/:id/notify',controller[_0x9139('0x14')]);router[_0x9139('0xf')]('/:id/send',auth[_0x9139('0xa')](),controller[_0x9139('0x15')]);router[_0x9139('0x16')](_0x9139('0x17'),auth[_0x9139('0xa')](),controller[_0x9139('0x18')]);router[_0x9139('0x19')](_0x9139('0x17'),auth[_0x9139('0xa')](),controller[_0x9139('0x1a')]);router[_0x9139('0x19')](_0x9139('0x1b'),auth[_0x9139('0xa')](),controller[_0x9139('0x1c')]);router[_0x9139('0x19')](_0x9139('0x1d'),auth[_0x9139('0xa')](),controller[_0x9139('0x1e')]);router[_0x9139('0x19')]('/:id/users',auth[_0x9139('0xa')](),controller[_0x9139('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 4e3baab..eef755b 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 _0xc346=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x2f5665,_0x311ba8){var _0x5027c8=function(_0x72a2f3){while(--_0x72a2f3){_0x2f5665['push'](_0x2f5665['shift']());}};_0x5027c8(++_0x311ba8);}(_0xc346,0x1b8));var _0x6c34=function(_0x5b309e,_0x182513){_0x5b309e=_0x5b309e-0x0;var _0xef06a5=_0xc346[_0x5b309e];return _0xef06a5;};'use strict';var Sequelize=require(_0x6c34('0x0'));var rs=require(_0x6c34('0x1'));module[_0x6c34('0x2')]={'name':{'type':Sequelize[_0x6c34('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x6c34('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x6c34('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x6c34('0x4')]();}},'phone':{'type':Sequelize[_0x6c34('0x3')]},'type':{'type':Sequelize[_0x6c34('0x5')](_0x6c34('0x6'))},'accountSid':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x6c34('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6c34('0x7');}},'notificationSound':{'type':Sequelize[_0x6c34('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x6c34('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6c34('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6c34('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6c34('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6c34('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6c34('0x9')],'comment':_0x6c34('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x6c34('0x8')],'defaultValue':![],'comment':_0x6c34('0xb'),'set':function(_0x102896){if(!_0x102896){this['setDataValue'](_0x6c34('0xc'),null);}this[_0x6c34('0xd')](_0x6c34('0xe'),_0x102896);}},'description':{'type':Sequelize[_0x6c34('0x3')]}}; \ No newline at end of file +var _0x25e9=['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','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name'];(function(_0x54f813,_0x1368eb){var _0x3bc0b1=function(_0x26584a){while(--_0x26584a){_0x54f813['push'](_0x54f813['shift']());}};_0x3bc0b1(++_0x1368eb);}(_0x25e9,0x1a8));var _0x925e=function(_0x48c998,_0x37d255){_0x48c998=_0x48c998-0x0;var _0x59c2a2=_0x25e9[_0x48c998];return _0x59c2a2;};'use strict';var Sequelize=require(_0x925e('0x0'));var rs=require(_0x925e('0x1'));module[_0x925e('0x2')]={'name':{'type':Sequelize[_0x925e('0x3')],'unique':_0x925e('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x925e('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x925e('0x3')]},'type':{'type':Sequelize[_0x925e('0x5')]('twilio')},'accountSid':{'type':Sequelize[_0x925e('0x3')]},'authToken':{'type':Sequelize[_0x925e('0x3')]},'notificationTemplate':{'type':Sequelize[_0x925e('0x6')],'defaultValue':function(){return _0x925e('0x7');}},'notificationSound':{'type':Sequelize[_0x925e('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x925e('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x925e('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x925e('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x925e('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x925e('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x925e('0x9')],'comment':_0x925e('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4f7fc1){if(!_0x4f7fc1){this[_0x925e('0xb')]('mandatoryDispositionPauseId',null);}this[_0x925e('0xb')](_0x925e('0xc'),_0x4f7fc1);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 83c34b5..c316a39 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 _0x69f1=['hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','options','WhatsappAccount','includeAll','include','findAll','rows','show','keys','fields','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','pick','filter','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','User','getAgents','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','applications','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','DESC','Contacts','defaults','contact','WhatsappInteraction','spread','interaction','created','autoclose','push','close','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','waitForTheAssignedAgent','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','send','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','dataValues','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./whatsappAccount.socket','register','client','http','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','WhatsappAccounts','stack','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','filters','attributes','intersection'];(function(_0x15c23e,_0x162305){var _0x4ed7d1=function(_0x3d65e7){while(--_0x3d65e7){_0x15c23e['push'](_0x15c23e['shift']());}};_0x4ed7d1(++_0x162305);}(_0x69f1,0x79));var _0x169f=function(_0x5d1813,_0x546944){_0x5d1813=_0x5d1813-0x0;var _0x4f6c64=_0x69f1[_0x5d1813];return _0x4f6c64;};'use strict';var pdf=require(_0x169f('0x0'));var emlformat=require(_0x169f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x169f('0x2'));var jsonpatch=require(_0x169f('0x3'));var rp=require(_0x169f('0x4'));var moment=require('moment');var BPromise=require(_0x169f('0x5'));var Mustache=require(_0x169f('0x6'));var util=require(_0x169f('0x7'));var path=require(_0x169f('0x8'));var sox=require(_0x169f('0x9'));var csv=require(_0x169f('0xa'));var ejs=require(_0x169f('0xb'));var fs=require('fs');var _=require(_0x169f('0xc'));var squel=require(_0x169f('0xd'));var crypto=require(_0x169f('0xe'));var jsforce=require(_0x169f('0xf'));var deskjs=require(_0x169f('0x10'));var toCsv=require(_0x169f('0xa'));var querystring=require(_0x169f('0x11'));var Papa=require('papaparse');var Redis=require(_0x169f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x169f('0x13'));var as=require(_0x169f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x169f('0x15'))(_0x169f('0x16'));var utils=require(_0x169f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x169f('0x18'));var db=require(_0x169f('0x19'))['db'];config[_0x169f('0x1a')]=_['defaults'](config[_0x169f('0x1a')],{'host':_0x169f('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x169f('0x1a')]));require(_0x169f('0x1c'))[_0x169f('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x169f('0x1e')][_0x169f('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x376098,_0x2ad920,_0x3b5227,_0x2c6df2){return new BPromise(function(_0x494566,_0x3b09a8){var _0xe4b30f=_0x2c6df2||client;return _0xe4b30f[_0x169f('0x20')](_0x376098,_0x3b5227)[_0x169f('0x21')](function(_0x4bf484){logger[_0x169f('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x2ad920,_0x169f('0x23'));logger[_0x169f('0x24')](_0x169f('0x25'),_0x2ad920,'request\x20sent',JSON[_0x169f('0x26')](_0x4bf484));if(_0x4bf484[_0x169f('0x27')]){if(_0x4bf484[_0x169f('0x27')][_0x169f('0x28')]===0x1f4){logger[_0x169f('0x27')](_0x169f('0x29'),_0x2ad920,_0x4bf484[_0x169f('0x27')][_0x169f('0x2a')]);return _0x3b09a8(_0x4bf484[_0x169f('0x27')][_0x169f('0x2a')]);}logger[_0x169f('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x2ad920,_0x4bf484[_0x169f('0x27')][_0x169f('0x2a')]);return _0x494566(_0x4bf484[_0x169f('0x27')][_0x169f('0x2a')]);}else{logger[_0x169f('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x2ad920,_0x169f('0x23'));_0x494566(_0x4bf484[_0x169f('0x2b')]['message']);}})[_0x169f('0x2c')](function(_0x3d4eda){logger[_0x169f('0x27')](_0x169f('0x29'),_0x2ad920,_0x3d4eda);_0x3b09a8(_0x3d4eda);});});}function respondWithStatusCode(_0x2ff684,_0x256f68){_0x256f68=_0x256f68||0xcc;return function(_0x178ca5){if(_0x178ca5){return _0x2ff684[_0x169f('0x2d')](_0x256f68);}return _0x2ff684[_0x169f('0x2e')](_0x256f68)[_0x169f('0x2f')]();};}function respondWithResult(_0x49e778,_0x1ebb03){_0x1ebb03=_0x1ebb03||0xc8;return function(_0x408a94){if(_0x408a94){return _0x49e778['status'](_0x1ebb03)[_0x169f('0x30')](_0x408a94);}};}function respondWithFilteredResult(_0x3acf0c,_0x2a0e44){return function(_0x45f6c5){if(_0x45f6c5){var _0x682e43=_0x45f6c5[_0x169f('0x31')],_0x277277=_0x2a0e44['offset'],_0x492f26=_0x2a0e44[_0x169f('0x32')]+_0x2a0e44[_0x169f('0x33')],_0xe6cf0e;if(_0x492f26>=_0x682e43){_0x492f26=_0x682e43;_0xe6cf0e=0xc8;}else{_0xe6cf0e=0xce;}_0x3acf0c[_0x169f('0x2e')](_0xe6cf0e);return _0x3acf0c[_0x169f('0x34')]('Content-Range',_0x277277+'-'+_0x492f26+'/'+_0x682e43)[_0x169f('0x30')](_0x45f6c5);}return null;};}function patchUpdates(_0x524041){return function(_0x4f0761){try{jsonpatch[_0x169f('0x35')](_0x4f0761,_0x524041,!![]);}catch(_0x41d3e2){return BPromise[_0x169f('0x36')](_0x41d3e2);}return _0x4f0761[_0x169f('0x37')]();};}function saveUpdates(_0x22729e,_0x3352b9){return function(_0x18d534){if(_0x18d534){return _0x18d534[_0x169f('0x38')](_0x22729e)['then'](function(_0x154a50){return _0x154a50;});}return null;};}function removeEntity(_0x9d924e,_0x35ee8f){return function(_0x58ef11){if(_0x58ef11){return _0x58ef11[_0x169f('0x39')]()[_0x169f('0x21')](function(){var _0x3dac33=_0x58ef11['get']({'plain':!![]});var _0x25b19b=_0x169f('0x3a');return db['UserProfileResource'][_0x169f('0x39')]({'where':{'type':_0x25b19b,'resourceId':_0x3dac33['id']}})[_0x169f('0x21')](function(){return _0x58ef11;});})['then'](function(){_0x9d924e[_0x169f('0x2e')](0xcc)[_0x169f('0x2f')]();});}};}function handleEntityNotFound(_0x51ef2b,_0x48726d){return function(_0x12c575){if(!_0x12c575){_0x51ef2b[_0x169f('0x2d')](0x194);}return _0x12c575;};}function handleError(_0x4ee6e9,_0x547a55){_0x547a55=_0x547a55||0x1f4;return function(_0x42955c){logger[_0x169f('0x27')](_0x42955c[_0x169f('0x3b')]);if(_0x42955c['name']){delete _0x42955c[_0x169f('0x3c')];}_0x4ee6e9[_0x169f('0x2e')](_0x547a55)['send'](_0x42955c);};}exports[_0x169f('0x3d')]=function(_0x3b4145,_0x39b709){var _0xbffffc={'include':[{'model':db[_0x169f('0x3e')],'as':_0x169f('0x3f')}]},_0xea5ee5={},_0x416473={'count':0x0,'rows':[]};var _0x59752d=_[_0x169f('0x40')](db['WhatsappAccount'][_0x169f('0x41')],function(_0x4cc0cd){return{'name':_0x4cc0cd[_0x169f('0x42')],'type':_0x4cc0cd['type'][_0x169f('0x43')]};});_0xea5ee5[_0x169f('0x44')]=_[_0x169f('0x40')](_0x59752d,_0x169f('0x3c'));_0xea5ee5[_0x169f('0x45')]=_['keys'](_0x3b4145[_0x169f('0x45')]);_0xea5ee5[_0x169f('0x46')]=_['intersection'](_0xea5ee5['model'],_0xea5ee5[_0x169f('0x45')]);_0xbffffc[_0x169f('0x47')]=_[_0x169f('0x48')](_0xea5ee5[_0x169f('0x44')],qs['fields'](_0x3b4145[_0x169f('0x45')]['fields']));_0xbffffc['attributes']=_0xbffffc['attributes']['length']?_0xbffffc[_0x169f('0x47')]:_0xea5ee5[_0x169f('0x44')];if(!_0x3b4145['query'][_0x169f('0x49')](_0x169f('0x4a'))){_0xbffffc[_0x169f('0x33')]=qs[_0x169f('0x33')](_0x3b4145[_0x169f('0x45')][_0x169f('0x33')]);_0xbffffc[_0x169f('0x32')]=qs[_0x169f('0x32')](_0x3b4145['query']['offset']);}_0xbffffc[_0x169f('0x4b')]=qs[_0x169f('0x4c')](_0x3b4145[_0x169f('0x45')][_0x169f('0x4c')]);_0xbffffc[_0x169f('0x4d')]=qs[_0x169f('0x46')](_['pick'](_0x3b4145['query'],_0xea5ee5[_0x169f('0x46')]),_0x59752d);if(_0x3b4145['query']['filter']){_0xbffffc[_0x169f('0x4d')]=_[_0x169f('0x4e')](_0xbffffc[_0x169f('0x4d')],{'$or':_['map'](_0x59752d,function(_0x94c114){if(_0x94c114[_0x169f('0x4f')]!==_0x169f('0x50')){var _0x1e5401={};_0x1e5401[_0x94c114['name']]={'$like':'%'+_0x3b4145['query']['filter']+'%'};return _0x1e5401;}})});}_0xbffffc=_[_0x169f('0x4e')]({},_0xbffffc,_0x3b4145[_0x169f('0x51')]);var _0x5da674={'where':_0xbffffc['where']};return db[_0x169f('0x52')][_0x169f('0x31')](_0x5da674)[_0x169f('0x21')](function(_0x3dde75){_0x416473['count']=_0x3dde75;if(_0x3b4145[_0x169f('0x45')][_0x169f('0x53')]){_0xbffffc[_0x169f('0x54')]=[{'all':!![]}];}return db[_0x169f('0x52')][_0x169f('0x55')](_0xbffffc);})[_0x169f('0x21')](function(_0x2b99e0){_0x416473[_0x169f('0x56')]=_0x2b99e0;return _0x416473;})[_0x169f('0x21')](respondWithFilteredResult(_0x39b709,_0xbffffc))[_0x169f('0x2c')](handleError(_0x39b709,null));};exports[_0x169f('0x57')]=function(_0x32384d,_0xcb0cb2){var _0x3e44b8={'raw':![],'where':{'id':_0x32384d['params']['id']},'include':[{'model':db[_0x169f('0x3e')],'as':_0x169f('0x3f')}]},_0x3968ae={};_0x3968ae[_0x169f('0x44')]=_[_0x169f('0x58')](db['WhatsappAccount'][_0x169f('0x41')]);_0x3968ae[_0x169f('0x45')]=_[_0x169f('0x58')](_0x32384d[_0x169f('0x45')]);_0x3968ae['filters']=_[_0x169f('0x48')](_0x3968ae['model'],_0x3968ae['query']);_0x3e44b8['attributes']=_[_0x169f('0x48')](_0x3968ae['model'],qs[_0x169f('0x59')](_0x32384d[_0x169f('0x45')][_0x169f('0x59')]));_0x3e44b8[_0x169f('0x47')]=_0x3e44b8[_0x169f('0x47')][_0x169f('0x5a')]?_0x3e44b8['attributes']:_0x3968ae[_0x169f('0x44')];if(_0x32384d[_0x169f('0x45')]['includeAll']){_0x3e44b8[_0x169f('0x54')]=[{'all':!![]}];}_0x3e44b8=_[_0x169f('0x4e')]({},_0x3e44b8,_0x32384d[_0x169f('0x51')]);return db[_0x169f('0x52')][_0x169f('0x5b')](_0x3e44b8)[_0x169f('0x21')](handleEntityNotFound(_0xcb0cb2,null))[_0x169f('0x21')](respondWithResult(_0xcb0cb2,null))[_0x169f('0x2c')](handleError(_0xcb0cb2,null));};exports[_0x169f('0x5c')]=function(_0x27702c,_0x5aa270){return db[_0x169f('0x52')][_0x169f('0x5c')](_0x27702c['body'],{})[_0x169f('0x21')](function(_0x519249){var _0x48d38c=_0x27702c[_0x169f('0x5d')]['get']({'plain':!![]});if(!_0x48d38c)throw new Error(_0x169f('0x5e'));if(_0x48d38c[_0x169f('0x5f')]===_0x169f('0x5d')){var _0x493847=_0x519249[_0x169f('0x60')]({'plain':!![]});var _0x10e9af=_0x169f('0x3a');return db[_0x169f('0x61')][_0x169f('0x5b')]({'where':{'name':_0x10e9af,'userProfileId':_0x48d38c[_0x169f('0x62')]},'raw':!![]})[_0x169f('0x21')](function(_0x30cc6b){if(_0x30cc6b&&_0x30cc6b[_0x169f('0x63')]===0x0){return db[_0x169f('0x64')][_0x169f('0x5c')]({'name':_0x493847[_0x169f('0x3c')],'resourceId':_0x493847['id'],'type':_0x30cc6b[_0x169f('0x3c')],'sectionId':_0x30cc6b['id']},{})[_0x169f('0x21')](function(){return _0x519249;});}else{return _0x519249;}})[_0x169f('0x2c')](function(_0x3a13a0){logger['error'](_0x169f('0x65'),_0x3a13a0);throw _0x3a13a0;});}return _0x519249;})[_0x169f('0x21')](respondWithResult(_0x5aa270,0xc9))[_0x169f('0x2c')](handleError(_0x5aa270,null));};exports[_0x169f('0x38')]=function(_0x3c3f47,_0x2d69f7){if(_0x3c3f47[_0x169f('0x66')]['id']){delete _0x3c3f47['body']['id'];}return db[_0x169f('0x52')][_0x169f('0x5b')]({'where':{'id':_0x3c3f47[_0x169f('0x67')]['id']},'include':[{'model':db[_0x169f('0x3e')],'as':'mandatoryDispositionPause'}]})[_0x169f('0x21')](handleEntityNotFound(_0x2d69f7,null))[_0x169f('0x21')](saveUpdates(_0x3c3f47[_0x169f('0x66')],null))[_0x169f('0x21')](respondWithResult(_0x2d69f7,null))[_0x169f('0x2c')](handleError(_0x2d69f7,null));};exports[_0x169f('0x39')]=function(_0xed05bf,_0x3bde8e){return db[_0x169f('0x52')][_0x169f('0x5b')]({'where':{'id':_0xed05bf[_0x169f('0x67')]['id']}})[_0x169f('0x21')](handleEntityNotFound(_0x3bde8e,null))[_0x169f('0x21')](removeEntity(_0x3bde8e,null))['catch'](handleError(_0x3bde8e,null));};exports[_0x169f('0x68')]=function(_0x2c5271,_0x2f25e4){return db[_0x169f('0x52')][_0x169f('0x68')]()[_0x169f('0x21')](respondWithResult(_0x2f25e4,null))[_0x169f('0x2c')](handleError(_0x2f25e4,null));};exports[_0x169f('0x69')]=function(_0x1f4dfb,_0x3edf9c,_0x1b14f7){if(_0x1f4dfb[_0x169f('0x66')]['id']){delete _0x1f4dfb[_0x169f('0x66')]['id'];}return db[_0x169f('0x52')][_0x169f('0x5b')]({'where':{'id':_0x1f4dfb['params']['id']}})[_0x169f('0x21')](handleEntityNotFound(_0x3edf9c,null))[_0x169f('0x21')](function(_0x1053fa){if(_0x1053fa){_0x1f4dfb['body'][_0x169f('0x6a')]=_0x1053fa['id'];return db[_0x169f('0x6b')][_0x169f('0x5c')](_0x1f4dfb['body']);}})[_0x169f('0x21')](respondWithResult(_0x3edf9c,null))[_0x169f('0x2c')](handleError(_0x3edf9c,null));};exports[_0x169f('0x6c')]=function(_0x1307e1,_0x14ba5c,_0xd81144){var _0x28ccce={'raw':![],'where':{}};var _0x6e4c6c={};var _0x496e40={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x169f('0x6d')]({'where':{'id':_0x1307e1[_0x169f('0x67')]['id']}})[_0x169f('0x21')](handleEntityNotFound(_0x14ba5c,null))[_0x169f('0x21')](function(_0x2efd82){if(_0x2efd82){_0x6e4c6c[_0x169f('0x44')]=_[_0x169f('0x58')](db[_0x169f('0x6b')]['rawAttributes']);_0x6e4c6c[_0x169f('0x45')]=_[_0x169f('0x58')](_0x1307e1[_0x169f('0x45')]);_0x6e4c6c[_0x169f('0x46')]=_[_0x169f('0x48')](_0x6e4c6c[_0x169f('0x44')],_0x6e4c6c['query']);_0x28ccce['attributes']=_[_0x169f('0x48')](_0x6e4c6c['model'],qs[_0x169f('0x59')](_0x1307e1['query']['fields']));_0x28ccce[_0x169f('0x47')]=_0x28ccce[_0x169f('0x47')][_0x169f('0x5a')]?_0x28ccce[_0x169f('0x47')]:_0x6e4c6c[_0x169f('0x44')];if(!_0x1307e1[_0x169f('0x45')][_0x169f('0x49')](_0x169f('0x4a'))){_0x28ccce['limit']=qs[_0x169f('0x33')](_0x1307e1[_0x169f('0x45')][_0x169f('0x33')]);_0x28ccce['offset']=qs[_0x169f('0x32')](_0x1307e1['query']['offset']);}_0x28ccce['order']=qs[_0x169f('0x4c')](_0x1307e1[_0x169f('0x45')][_0x169f('0x4c')]);_0x28ccce[_0x169f('0x4d')]=qs[_0x169f('0x46')](_[_0x169f('0x6e')](_0x1307e1[_0x169f('0x45')],_0x6e4c6c['filters']));_0x28ccce[_0x169f('0x4d')]['WhatsappAccountId']=_0x2efd82['id'];if(_0x1307e1[_0x169f('0x45')][_0x169f('0x6f')]){_0x28ccce[_0x169f('0x4d')]=_[_0x169f('0x4e')](_0x28ccce[_0x169f('0x4d')],{'$or':_['map'](_0x28ccce[_0x169f('0x47')],function(_0x2fd4e6){var _0x400657={};_0x400657[_0x2fd4e6]={'$like':'%'+_0x1307e1[_0x169f('0x45')][_0x169f('0x6f')]+'%'};return _0x400657;})});}_0x28ccce=_['merge']({},_0x28ccce,_0x1307e1['options']);return db[_0x169f('0x6b')][_0x169f('0x31')]({'where':_0x28ccce[_0x169f('0x4d')]})[_0x169f('0x21')](function(_0x5e1c35){_0x496e40[_0x169f('0x31')]=_0x5e1c35;if(_0x1307e1['query'][_0x169f('0x53')]){_0x28ccce['include']=[{'all':!![]}];}return db['Disposition'][_0x169f('0x55')](_0x28ccce);})[_0x169f('0x21')](function(_0x11ac91){_0x496e40[_0x169f('0x56')]=_0x11ac91;return _0x496e40;});}})[_0x169f('0x21')](respondWithFilteredResult(_0x14ba5c,_0x28ccce))[_0x169f('0x2c')](handleError(_0x14ba5c,null));};exports[_0x169f('0x70')]=function(_0x18131e,_0x49258c,_0x27c7ce){return db[_0x169f('0x52')][_0x169f('0x5b')]({'where':{'id':_0x18131e[_0x169f('0x67')]['id']}})[_0x169f('0x21')](handleEntityNotFound(_0x49258c,null))[_0x169f('0x21')](function(_0x213807){if(_0x213807){return _0x213807[_0x169f('0x70')](_0x18131e[_0x169f('0x45')][_0x169f('0x71')]);}})[_0x169f('0x21')](respondWithStatusCode(_0x49258c,null))['catch'](handleError(_0x49258c,null));};exports[_0x169f('0x72')]=function(_0x430c9f,_0x2fd8e7,_0x2f70a9){if(_0x430c9f[_0x169f('0x66')]['id']){delete _0x430c9f[_0x169f('0x66')]['id'];}return db[_0x169f('0x52')][_0x169f('0x5b')]({'where':{'id':_0x430c9f[_0x169f('0x67')]['id']}})[_0x169f('0x21')](handleEntityNotFound(_0x2fd8e7,null))[_0x169f('0x21')](function(_0x1f2fa6){if(_0x1f2fa6){_0x430c9f[_0x169f('0x66')][_0x169f('0x6a')]=_0x1f2fa6['id'];return db['CannedAnswer']['create'](_0x430c9f['body']);}})[_0x169f('0x21')](respondWithResult(_0x2fd8e7,null))['catch'](handleError(_0x2fd8e7,null));};exports[_0x169f('0x73')]=function(_0x3cbef7,_0x46a103,_0x3bd297){var _0x3673ff={'raw':![],'where':{}};var _0x3ab6f2={};var _0x1d8694={'count':0x0,'rows':[]};return db[_0x169f('0x52')][_0x169f('0x6d')]({'where':{'id':_0x3cbef7[_0x169f('0x67')]['id']}})[_0x169f('0x21')](handleEntityNotFound(_0x46a103,null))[_0x169f('0x21')](function(_0x4eba2a){if(_0x4eba2a){_0x3ab6f2['model']=_[_0x169f('0x58')](db['CannedAnswer'][_0x169f('0x41')]);_0x3ab6f2[_0x169f('0x45')]=_[_0x169f('0x58')](_0x3cbef7[_0x169f('0x45')]);_0x3ab6f2[_0x169f('0x46')]=_['intersection'](_0x3ab6f2[_0x169f('0x44')],_0x3ab6f2['query']);_0x3673ff['attributes']=_['intersection'](_0x3ab6f2[_0x169f('0x44')],qs[_0x169f('0x59')](_0x3cbef7['query'][_0x169f('0x59')]));_0x3673ff[_0x169f('0x47')]=_0x3673ff['attributes'][_0x169f('0x5a')]?_0x3673ff[_0x169f('0x47')]:_0x3ab6f2[_0x169f('0x44')];if(!_0x3cbef7['query'][_0x169f('0x49')]('nolimit')){_0x3673ff[_0x169f('0x33')]=qs[_0x169f('0x33')](_0x3cbef7[_0x169f('0x45')][_0x169f('0x33')]);_0x3673ff[_0x169f('0x32')]=qs[_0x169f('0x32')](_0x3cbef7[_0x169f('0x45')]['offset']);}_0x3673ff['order']=qs[_0x169f('0x4c')](_0x3cbef7[_0x169f('0x45')][_0x169f('0x4c')]);_0x3673ff[_0x169f('0x4d')]=qs['filters'](_[_0x169f('0x6e')](_0x3cbef7[_0x169f('0x45')],_0x3ab6f2['filters']));_0x3673ff['where'][_0x169f('0x6a')]=_0x4eba2a['id'];if(_0x3cbef7[_0x169f('0x45')][_0x169f('0x6f')]){_0x3673ff[_0x169f('0x4d')]=_[_0x169f('0x4e')](_0x3673ff[_0x169f('0x4d')],{'$or':_[_0x169f('0x40')](_0x3673ff[_0x169f('0x47')],function(_0x259146){var _0x4f6a6d={};_0x4f6a6d[_0x259146]={'$like':'%'+_0x3cbef7[_0x169f('0x45')][_0x169f('0x6f')]+'%'};return _0x4f6a6d;})});}_0x3673ff=_['merge']({},_0x3673ff,_0x3cbef7['options']);return db['CannedAnswer'][_0x169f('0x31')]({'where':_0x3673ff[_0x169f('0x4d')]})[_0x169f('0x21')](function(_0x11cb87){_0x1d8694[_0x169f('0x31')]=_0x11cb87;if(_0x3cbef7['query'][_0x169f('0x53')]){_0x3673ff[_0x169f('0x54')]=[{'all':!![]}];}return db[_0x169f('0x74')][_0x169f('0x55')](_0x3673ff);})['then'](function(_0x36bf1f){_0x1d8694['rows']=_0x36bf1f;return _0x1d8694;});}})[_0x169f('0x21')](respondWithFilteredResult(_0x46a103,_0x3673ff))[_0x169f('0x2c')](handleError(_0x46a103,null));};exports[_0x169f('0x75')]=function(_0x556b18,_0x4f01b2,_0x36fa05){return db['WhatsappAccount'][_0x169f('0x5b')]({'where':{'id':_0x556b18['params']['id']}})[_0x169f('0x21')](handleEntityNotFound(_0x4f01b2,null))['then'](function(_0x180503){if(_0x180503){return _0x180503['removeAnswers'](_0x556b18[_0x169f('0x45')]['ids']);}})[_0x169f('0x21')](respondWithStatusCode(_0x4f01b2,null))[_0x169f('0x2c')](handleError(_0x4f01b2,null));};exports[_0x169f('0x76')]=function(_0x3c7b64,_0x4b069d,_0x232d7e){return db['WhatsappAccount'][_0x169f('0x5b')]({'where':{'id':_0x3c7b64['params']['id']}})[_0x169f('0x21')](handleEntityNotFound(_0x4b069d,null))[_0x169f('0x21')](function(_0x1b628c){if(_0x1b628c){return _0x1b628c['addAgents'](_0x3c7b64[_0x169f('0x66')][_0x169f('0x71')],_[_0x169f('0x77')](_0x3c7b64[_0x169f('0x66')],[_0x169f('0x71'),'id'])||{})['spread'](function(_0xfbb2df){for(var _0x5a7fca=0x0;_0x5a7fca<_0x3c7b64[_0x169f('0x66')][_0x169f('0x71')][_0x169f('0x5a')];_0x5a7fca+=0x1){socket[_0x169f('0x78')](_0x169f('0x79'),{'UserId':_0x3c7b64['body'][_0x169f('0x71')][_0x5a7fca],'WhatsappAccountId':_0x3c7b64[_0x169f('0x67')]['id']});}return _0xfbb2df;});}})[_0x169f('0x21')](respondWithResult(_0x4b069d,null))[_0x169f('0x2c')](handleError(_0x4b069d,null));};exports[_0x169f('0x7a')]=function(_0x1bf2e7,_0x486bf1,_0x394c76){return db[_0x169f('0x52')][_0x169f('0x5b')]({'where':{'id':_0x1bf2e7[_0x169f('0x67')]['id']}})[_0x169f('0x21')](handleEntityNotFound(_0x486bf1,null))[_0x169f('0x21')](function(_0x4fa91a){if(_0x4fa91a){return _0x4fa91a[_0x169f('0x7a')](_0x1bf2e7[_0x169f('0x45')][_0x169f('0x71')])[_0x169f('0x21')](function(){if(_['isArray'](_0x1bf2e7[_0x169f('0x45')][_0x169f('0x71')])){for(var _0x3ce0c1=0x0;_0x3ce0c1<_0x1bf2e7[_0x169f('0x45')][_0x169f('0x71')]['length'];_0x3ce0c1+=0x1){socket[_0x169f('0x78')](_0x169f('0x7b'),{'UserId':Number(_0x1bf2e7[_0x169f('0x45')][_0x169f('0x71')][_0x3ce0c1]),'WhatsappAccountId':Number(_0x1bf2e7['params']['id'])});}}else{socket[_0x169f('0x78')]('userWhatsappAccount:remove',{'UserId':Number(_0x1bf2e7[_0x169f('0x45')]['ids']),'WhatsappAccountId':Number(_0x1bf2e7['params']['id'])});}});}})[_0x169f('0x21')](respondWithStatusCode(_0x486bf1,null))['catch'](handleError(_0x486bf1,null));};exports['getAgents']=function(_0x245f79,_0x522e41,_0x12dab6){var _0x134815={};var _0x141b04={};var _0x4a1aff;var _0x4b16fe;return db[_0x169f('0x52')][_0x169f('0x6d')]({'where':{'id':_0x245f79[_0x169f('0x67')]['id']}})[_0x169f('0x21')](handleEntityNotFound(_0x522e41,null))[_0x169f('0x21')](function(_0x44c244){if(_0x44c244){_0x4a1aff=_0x44c244;_0x141b04[_0x169f('0x44')]=_[_0x169f('0x58')](db[_0x169f('0x7c')][_0x169f('0x41')]);_0x141b04[_0x169f('0x45')]=_[_0x169f('0x58')](_0x245f79[_0x169f('0x45')]);_0x141b04['filters']=_[_0x169f('0x48')](_0x141b04[_0x169f('0x44')],_0x141b04['query']);_0x134815[_0x169f('0x47')]=_['intersection'](_0x141b04[_0x169f('0x44')],qs[_0x169f('0x59')](_0x245f79[_0x169f('0x45')][_0x169f('0x59')]));_0x134815[_0x169f('0x47')]=_0x134815[_0x169f('0x47')][_0x169f('0x5a')]?_0x134815[_0x169f('0x47')]:_0x141b04[_0x169f('0x44')];_0x134815['order']=qs[_0x169f('0x4c')](_0x245f79[_0x169f('0x45')][_0x169f('0x4c')]);_0x134815[_0x169f('0x4d')]=qs[_0x169f('0x46')](_[_0x169f('0x6e')](_0x245f79[_0x169f('0x45')],_0x141b04[_0x169f('0x46')]));if(_0x245f79['query']['filter']){_0x134815[_0x169f('0x4d')]=_[_0x169f('0x4e')](_0x134815['where'],{'$or':_[_0x169f('0x40')](_0x134815[_0x169f('0x47')],function(_0x3de677){var _0x21677a={};_0x21677a[_0x3de677]={'$like':'%'+_0x245f79['query'][_0x169f('0x6f')]+'%'};return _0x21677a;})});}_0x134815=_[_0x169f('0x4e')]({},_0x134815,_0x245f79[_0x169f('0x51')]);return _0x4a1aff[_0x169f('0x7d')](_0x134815);}})[_0x169f('0x21')](function(_0x58f3b5){if(_0x58f3b5){_0x4b16fe=_0x58f3b5[_0x169f('0x5a')];if(!_0x245f79[_0x169f('0x45')]['hasOwnProperty'](_0x169f('0x4a'))){_0x134815[_0x169f('0x33')]=qs[_0x169f('0x33')](_0x245f79[_0x169f('0x45')][_0x169f('0x33')]);_0x134815['offset']=qs[_0x169f('0x32')](_0x245f79['query'][_0x169f('0x32')]);}return _0x4a1aff[_0x169f('0x7d')](_0x134815);}})[_0x169f('0x21')](function(_0x54b5fd){if(_0x54b5fd){return _0x54b5fd?{'count':_0x4b16fe,'rows':_0x54b5fd}:null;}})[_0x169f('0x21')](respondWithResult(_0x522e41,null))[_0x169f('0x2c')](handleError(_0x522e41,null));};exports[_0x169f('0x7e')]=function(_0x1dedf1,_0x5a9d2d,_0x1d7f00){return db['WhatsappAccount'][_0x169f('0x6d')]({'where':{'id':_0x1dedf1['params']['id']}})[_0x169f('0x21')](handleEntityNotFound(_0x5a9d2d,null))[_0x169f('0x21')](function(_0x5bd455){if(_0x5bd455){return db[_0x169f('0x7f')][_0x169f('0x80')](function(_0x1bbed3){return db[_0x169f('0x81')]['destroy']({'where':{'WhatsappAccountId':_0x1dedf1[_0x169f('0x67')]['id']},'transaction':_0x1bbed3})[_0x169f('0x21')](function(_0x50ff0b){var _0x5fe4d8=_[_0x169f('0x40')](_0x1dedf1['body'],function(_0x1a11bb){_0x1a11bb[_0x169f('0x6a')]=_0x1dedf1[_0x169f('0x67')]['id'];return _0x1a11bb;});return db['WhatsappApplication'][_0x169f('0x82')](_0x5fe4d8,{'transaction':_0x1bbed3});});})['then'](function(){return db[_0x169f('0x81')][_0x169f('0x83')]({'where':{'WhatsappAccountId':_0x1dedf1[_0x169f('0x67')]['id']},'order':_0x169f('0x84')});});}})[_0x169f('0x21')](respondWithResult(_0x5a9d2d,null))['catch'](handleError(_0x5a9d2d,null));};exports['getApplications']=function(_0x105802,_0x253091,_0x20f7a6){var _0x5ff4ca={};var _0x3c7181={};var _0x4a743c;var _0x558043;return db[_0x169f('0x52')][_0x169f('0x6d')]({'where':{'id':_0x105802[_0x169f('0x67')]['id']}})['then'](handleEntityNotFound(_0x253091,null))['then'](function(_0x25ce84){if(_0x25ce84){_0x4a743c=_0x25ce84;_0x3c7181[_0x169f('0x44')]=_[_0x169f('0x58')](db[_0x169f('0x81')][_0x169f('0x41')]);_0x3c7181['query']=_[_0x169f('0x58')](_0x105802[_0x169f('0x45')]);_0x3c7181[_0x169f('0x46')]=_[_0x169f('0x48')](_0x3c7181[_0x169f('0x44')],_0x3c7181['query']);_0x5ff4ca[_0x169f('0x47')]=_[_0x169f('0x48')](_0x3c7181[_0x169f('0x44')],qs[_0x169f('0x59')](_0x105802[_0x169f('0x45')][_0x169f('0x59')]));_0x5ff4ca[_0x169f('0x47')]=_0x5ff4ca[_0x169f('0x47')][_0x169f('0x5a')]?_0x5ff4ca['attributes']:_0x3c7181[_0x169f('0x44')];_0x5ff4ca[_0x169f('0x4b')]=qs[_0x169f('0x4c')](_0x105802[_0x169f('0x45')][_0x169f('0x4c')]);_0x5ff4ca[_0x169f('0x4d')]=qs['filters'](_[_0x169f('0x6e')](_0x105802[_0x169f('0x45')],_0x3c7181[_0x169f('0x46')]));if(_0x105802['query'][_0x169f('0x6f')]){_0x5ff4ca[_0x169f('0x4d')]=_[_0x169f('0x4e')](_0x5ff4ca[_0x169f('0x4d')],{'$or':_[_0x169f('0x40')](_0x5ff4ca[_0x169f('0x47')],function(_0x4038cc){var _0x2defe3={};_0x2defe3[_0x4038cc]={'$like':'%'+_0x105802[_0x169f('0x45')]['filter']+'%'};return _0x2defe3;})});}_0x5ff4ca=_[_0x169f('0x4e')]({},_0x5ff4ca,_0x105802['options']);return _0x4a743c[_0x169f('0x85')](_0x5ff4ca);}})[_0x169f('0x21')](function(_0x564d5b){if(_0x564d5b){_0x558043=_0x564d5b['length'];if(!_0x105802[_0x169f('0x45')][_0x169f('0x49')](_0x169f('0x4a'))){_0x5ff4ca[_0x169f('0x33')]=qs[_0x169f('0x33')](_0x105802[_0x169f('0x45')][_0x169f('0x33')]);_0x5ff4ca['offset']=qs['offset'](_0x105802[_0x169f('0x45')][_0x169f('0x32')]);}return _0x4a743c['getApplications'](_0x5ff4ca);}})['then'](function(_0x384b9e){if(_0x384b9e){return _0x384b9e?{'count':_0x558043,'rows':_0x384b9e}:null;}})[_0x169f('0x21')](respondWithResult(_0x253091,null))[_0x169f('0x2c')](handleError(_0x253091,null));};exports[_0x169f('0x86')]=function(_0x12ab87,_0x202084,_0x30d26a){var _0x3dca4f={'channel':_0x169f('0x87')};var _0x7e544a=[];var _0x40fc43=[];var _0x12219e={};return db['WhatsappAccount']['find']({'where':{'id':_0x12ab87[_0x169f('0x67')]['id']},'include':[{'model':db[_0x169f('0x81')],'as':_0x169f('0x88')}]})[_0x169f('0x21')](handleEntityNotFound(_0x202084,null))[_0x169f('0x21')](function(_0x46d811){_0x3dca4f[_0x169f('0x89')]=_0x46d811;_0x3dca4f[_0x169f('0x8a')]=_['orderBy'](_0x46d811[_0x169f('0x88')],['priority'],[_0x169f('0x8b')]);if(_0x3dca4f[_0x169f('0x89')]['Applications']){delete _0x3dca4f['account'][_0x169f('0x88')];}return db[_0x169f('0x8c')][_0x169f('0x68')]();})[_0x169f('0x21')](function(_0x481c1f){if(!_0x481c1f){throw new db[(_0x169f('0x8d'))][(_0x169f('0x8e'))]('no\x20available\x20attributes');}_0x7e544a=_[_0x169f('0x8f')](_['keys'](_0x481c1f),[_0x169f('0x90'),_0x169f('0x91')]);_0x40fc43=_[_0x169f('0x8f')](_[_0x169f('0x58')](_0x481c1f),[_0x169f('0x90'),_0x169f('0x91'),_0x169f('0x92'),_0x169f('0x93')]);_0x3dca4f['body']={'mapKey':_0x169f('0x94')};if(_0x3dca4f[_0x169f('0x89')][_0x169f('0x4f')]&&_0x3dca4f[_0x169f('0x89')]['type']===_0x169f('0x95')){_0x3dca4f['body'][_0x169f('0x96')]=_0x12ab87[_0x169f('0x66')][_0x169f('0x97')][_0x169f('0x98')](_0x169f('0x99'),'');_0x3dca4f['body']['body']=_0x12ab87[_0x169f('0x66')][_0x169f('0x9a')];_0x3dca4f[_0x169f('0x66')][_0x169f('0x9b')]=_0x12ab87[_0x169f('0x66')][_0x169f('0x9c')];}if(_0x3dca4f['body']['id']){delete _0x3dca4f['body']['id'];}if(_['isNil'](_0x3dca4f[_0x169f('0x66')][_0x169f('0x96')])){throw new db[(_0x169f('0x8d'))][(_0x169f('0x8e'))](_0x169f('0x9d'));}if(_[_0x169f('0x9e')](_0x3dca4f[_0x169f('0x66')][_0x169f('0x66')])||_0x3dca4f[_0x169f('0x66')][_0x169f('0x66')]===''){throw new db[(_0x169f('0x8d'))][(_0x169f('0x8e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x169f('0x9e')](_0x3dca4f['body'][_0x169f('0x9f')])){throw new db[(_0x169f('0x8d'))][(_0x169f('0x8e'))](_0x169f('0xa0')+_0x40fc43);}if(!_[_0x169f('0xa1')](_0x40fc43,_0x3dca4f[_0x169f('0x66')][_0x169f('0x9f')])){throw new db[(_0x169f('0x8d'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x40fc43);}_0x12219e[_0x3dca4f[_0x169f('0x66')][_0x169f('0x9f')]]=_0x3dca4f[_0x169f('0x66')][_0x169f('0x96')];return db[_0x169f('0xa2')][_0x169f('0x5b')]({'where':{'id':_0x3dca4f['account'][_0x169f('0x93')]},'include':[{'model':db[_0x169f('0x8c')],'as':'Contacts','where':_0x12219e,'limit':0x1,'order':[['updatedAt',_0x169f('0xa3')]]}]});})['then'](handleEntityNotFound(_0x202084,null))['then'](function(_0x26b2e5){if(_0x26b2e5){_0x3dca4f['list']=_[_0x169f('0x77')](_0x26b2e5,[_0x169f('0xa4')]);if(_0x26b2e5[_0x169f('0xa4')][_0x169f('0x5a')]){return _0x26b2e5['Contacts'][0x0];}var _0x618d0a=_[_0x169f('0xa5')](_0x3dca4f[_0x169f('0x66')],{'firstName':_0x3dca4f[_0x169f('0x66')][_0x169f('0x96')],'ListId':_0x26b2e5['id']});_0x618d0a[_0x3dca4f[_0x169f('0x66')][_0x169f('0x9f')]]=_0x3dca4f[_0x169f('0x66')][_0x169f('0x96')];return db[_0x169f('0x8c')][_0x169f('0x5c')](_0x618d0a,{'fields':_0x7e544a,'raw':!![]});}})['then'](handleEntityNotFound(_0x202084,null))[_0x169f('0x21')](function(_0x429f83){if(_0x429f83){_0x3dca4f[_0x169f('0xa6')]=_0x429f83;var _0x580cf0={'ContactId':_0x429f83['id'],'phone':_0x3dca4f[_0x169f('0x66')][_0x169f('0x96')],'WhatsappAccountId':_0x12ab87[_0x169f('0x67')]['id']};var _0x3c1fac={'ContactId':_0x429f83['id'],'WhatsappAccountId':_0x12ab87[_0x169f('0x67')]['id'],'closed':![]};return db['WhatsappInteraction']['find']({'where':_0x3c1fac})[_0x169f('0x21')](function(_0x4cc5ac){if(_0x4cc5ac){return[_0x4cc5ac,![]];}return db[_0x169f('0xa7')]['create'](_0x580cf0)['then'](function(_0x5d6730){return[_0x5d6730,!![]];});});}})[_0x169f('0xa8')](function(_0x118e61,_0x163712){_0x3dca4f[_0x169f('0xa9')]=_0x118e61[_0x169f('0x60')]({'plain':!![]});_0x3dca4f[_0x169f('0xa9')][_0x169f('0xaa')]=![];if(_0x163712){if(_0x3dca4f['account'][_0x169f('0xab')]){_0x3dca4f[_0x169f('0x8a')][_0x169f('0xac')]({'id':0x0,'priority':_0x3dca4f[_0x169f('0x8a')][_0x169f('0x5a')]+0x1,'app':_0x169f('0xad'),'appdata':'unmanaged','interval':_0x169f('0xae')});}_0x3dca4f[_0x169f('0xa9')][_0x169f('0xaa')]=!![];}return db[_0x169f('0xaf')][_0x169f('0x5c')]({'phone':_0x3dca4f[_0x169f('0x66')]['from'],'messageId':_0x3dca4f[_0x169f('0x66')][_0x169f('0x9b')],'body':_0x3dca4f[_0x169f('0x66')][_0x169f('0x66')],'WhatsappAccountId':_0x12ab87[_0x169f('0x67')]['id'],'WhatsappInteractionId':_0x118e61['id'],'direction':'in','ContactId':_0x118e61[_0x169f('0xb0')],'AttachmentId':_0x3dca4f['body'][_0x169f('0xb1')]});})[_0x169f('0x21')](function(_0x526b0d){_0x3dca4f[_0x169f('0x2a')]=_0x526b0d;if(_0x3dca4f['interaction']['UserId']){return db[_0x169f('0x7c')][_0x169f('0x5b')]({'attributes':['id',_0x169f('0x3c')],'where':{'id':_0x3dca4f[_0x169f('0xa9')][_0x169f('0xb2')]}})[_0x169f('0x21')](function(_0x42c678){if(_0x42c678){_0x3dca4f[_0x169f('0x8a')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x42c678['name']+','+(_0x3dca4f[_0x169f('0x89')][_0x169f('0xb3')]||0xa),'interval':_0x169f('0xae')});}return respondWithRpcPromise(_0x169f('0xb4'),_0x169f('0xb5'),_0x3dca4f);});}return respondWithRpcPromise(_0x169f('0xb4'),_0x169f('0xb5'),_0x3dca4f);})[_0x169f('0x21')](function(_0xd4bca0){if(_0xd4bca0){var _0x2e6e0a=0xc8;var _0x152c1d='receiveMessage';logger[_0x169f('0x22')](_0x169f('0x25'),_0x152c1d,_0x2e6e0a,'entity\x20found');logger[_0x169f('0x24')](_0x169f('0xb6'),_0x152c1d,_0x2e6e0a,_0x169f('0xb7'),JSON[_0x169f('0x26')](_0xd4bca0));if(_0x3dca4f[_0x169f('0x89')][_0x169f('0x4f')]===_0x169f('0x95')){return _0x202084[_0x169f('0x2e')](_0x2e6e0a)[_0x169f('0x34')](_0x169f('0xb8'),_0x169f('0xb9'))[_0x169f('0xba')](_0x169f('0xbb'));}else{return _0x202084['status'](_0x2e6e0a)[_0x169f('0x30')](_0xd4bca0);}}})[_0x169f('0x2c')](handleError(_0x202084,null));};exports[_0x169f('0xba')]=function(_0x4205ea,_0x32bed5,_0x3fa8cc){var _0x3ebdd3,_0x797702,_0x3275b4;if(_[_0x169f('0x9e')](_0x4205ea['body']['body'])||_0x4205ea[_0x169f('0x66')]['body']===''){throw new db[(_0x169f('0x8d'))][(_0x169f('0x8e'))](_0x169f('0xbc'));}if(_['isNil'](_0x4205ea[_0x169f('0x66')]['to'])){throw new db[(_0x169f('0x8d'))]['ValidationError'](_0x169f('0xbd'));}_0x3ebdd3=_0x4205ea['body']['to'];return db['WhatsappAccount'][_0x169f('0x5b')]({'where':{'id':_0x4205ea[_0x169f('0x67')]['id']},'include':[{'model':db[_0x169f('0xa2')],'as':_0x169f('0xbe'),'include':[{'model':db[_0x169f('0x8c')],'as':_0x169f('0xa4'),'where':{'mobile':_0x3ebdd3},'limit':0x1,'order':[['updatedAt',_0x169f('0xa3')]]}]}]})['then'](handleEntityNotFound(_0x32bed5,null))[_0x169f('0x21')](function(_0x3449aa){if(_0x3449aa&&_0x3449aa['List']){_0x797702=_0x3449aa['get']({'plain':!![]});if(_0x797702['List']&&_0x797702[_0x169f('0xbe')][_0x169f('0xa4')][_0x169f('0x5a')]){return _0x797702[_0x169f('0xbe')][_0x169f('0xa4')][0x0];}return db['CmContact'][_0x169f('0x5c')](_[_0x169f('0xa5')](_0x4205ea[_0x169f('0x66')],{'firstName':_0x3ebdd3,'mobile':_0x3ebdd3,'phone':_0x3ebdd3,'ListId':_0x797702[_0x169f('0x93')]}));}})['then'](handleEntityNotFound(_0x32bed5,null))[_0x169f('0x21')](function(_0x38997a){if(_0x38997a){_0x3275b4=_0x38997a;return db[_0x169f('0xa7')]['find']({'where':{'ContactId':_0x3275b4['id'],'closed':![],'WhatsappAccountId':_0x797702['id']}})[_0x169f('0x21')](function(_0x854140){if(_0x854140){return[_0x854140,![]];}return db[_0x169f('0xa7')][_0x169f('0x5c')]({'UserId':_0x4205ea[_0x169f('0x5d')]['id'],'ContactId':_0x3275b4['id'],'WhatsappAccountId':_0x797702['id'],'phone':_0x3ebdd3,'firstMsgDirection':_0x169f('0xbf'),'Messages':[_[_0x169f('0x4e')](_0x4205ea[_0x169f('0x66')],{'read':![],'body':_0x4205ea[_0x169f('0x66')][_0x169f('0x66')],'phone':_0x3ebdd3,'WhatsappAccountId':_0x797702['id'],'UserId':_0x4205ea[_0x169f('0x5d')]['id'],'ContactId':_0x3275b4['id']})]},{'include':[{'model':db[_0x169f('0xaf')],'as':_0x169f('0xc0')}]})[_0x169f('0x21')](function(_0x1dfd48){return[_0x1dfd48,!![]];});});}})[_0x169f('0xa8')](function(_0x11aaff,_0x29026d){if(_0x29026d){return _0x11aaff;}return db['WhatsappMessage']['create'](_[_0x169f('0x4e')](_0x4205ea[_0x169f('0x66')],{'read':![],'body':_0x4205ea[_0x169f('0x66')][_0x169f('0x66')],'phone':_0x3ebdd3,'WhatsappAccountId':_0x797702['id'],'WhatsappInteractionId':_0x11aaff['id'],'UserId':_0x4205ea[_0x169f('0x5d')]['id'],'ContactId':_0x3275b4['id']}))[_0x169f('0x21')](function(_0x23968c){_0x11aaff[_0x169f('0xc1')][_0x169f('0xc0')]=[];_0x11aaff['dataValues'][_0x169f('0xc0')][_0x169f('0xac')](_0x23968c[_0x169f('0xc1')]);return _0x11aaff;});})[_0x169f('0x21')](respondWithResult(_0x32bed5,null))[_0x169f('0x2c')](handleError(_0x32bed5,null));}; \ No newline at end of file +var _0x61e2=['interaction','created','autoclose','push','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','startRouting','Start','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','out','WhatsappMessage','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','./whatsappAccount.socket','jayson/promise','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','end','count','offset','status','set','Content-Range','json','apply','save','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','map','WhatsappAccount','rawAttributes','fieldName','key','keys','query','filters','intersection','model','fields','length','attributes','nolimit','limit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','mandatoryDispositionPause','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','Pause','describe','addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','pick','WhatsappAccountId','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','destroy','bulkCreate','findAndCountAll','priority','getApplications','notify','account','applications','orderBy','Applications','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','mobile','twilio','from','From','messageId','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','ListId','CmContact','Contacts','DESC','list','contact','WhatsappInteraction'];(function(_0x588cbd,_0x43b872){var _0x571e75=function(_0x12de7b){while(--_0x12de7b){_0x588cbd['push'](_0x588cbd['shift']());}};_0x571e75(++_0x43b872);}(_0x61e2,0xd6));var _0x261e=function(_0x3dcef2,_0x4b7ca6){_0x3dcef2=_0x3dcef2-0x0;var _0x5d3e61=_0x61e2[_0x3dcef2];return _0x5d3e61;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x261e('0x0'));var rimraf=require(_0x261e('0x1'));var zipdir=require(_0x261e('0x2'));var jsonpatch=require(_0x261e('0x3'));var rp=require(_0x261e('0x4'));var moment=require(_0x261e('0x5'));var BPromise=require(_0x261e('0x6'));var Mustache=require(_0x261e('0x7'));var util=require(_0x261e('0x8'));var path=require('path');var sox=require(_0x261e('0x9'));var csv=require(_0x261e('0xa'));var ejs=require(_0x261e('0xb'));var fs=require('fs');var _=require(_0x261e('0xc'));var squel=require(_0x261e('0xd'));var crypto=require(_0x261e('0xe'));var jsforce=require(_0x261e('0xf'));var deskjs=require(_0x261e('0x10'));var toCsv=require(_0x261e('0xa'));var querystring=require(_0x261e('0x11'));var Papa=require(_0x261e('0x12'));var Redis=require(_0x261e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x261e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x261e('0x15'));var logger=require(_0x261e('0x16'))(_0x261e('0x17'));var utils=require(_0x261e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x261e('0x19'));var db=require(_0x261e('0x1a'))['db'];config['redis']=_[_0x261e('0x1b')](config[_0x261e('0x1c')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x261e('0x1c')]));require(_0x261e('0x1d'))['register'](socket);var jayson=require(_0x261e('0x1e'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x2cc5de,_0x4238f4,_0x429394,_0x5ccb7d){return new BPromise(function(_0x4bf786,_0x20a185){var _0x4c69c8=_0x5ccb7d||client;return _0x4c69c8[_0x261e('0x1f')](_0x2cc5de,_0x429394)[_0x261e('0x20')](function(_0x9d3e32){logger[_0x261e('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x4238f4,_0x261e('0x22'));logger[_0x261e('0x23')](_0x261e('0x24'),_0x4238f4,_0x261e('0x22'),JSON[_0x261e('0x25')](_0x9d3e32));if(_0x9d3e32[_0x261e('0x26')]){if(_0x9d3e32[_0x261e('0x26')][_0x261e('0x27')]===0x1f4){logger[_0x261e('0x26')](_0x261e('0x28'),_0x4238f4,_0x9d3e32[_0x261e('0x26')]['message']);return _0x20a185(_0x9d3e32[_0x261e('0x26')][_0x261e('0x29')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x4238f4,_0x9d3e32[_0x261e('0x26')]['message']);return _0x4bf786(_0x9d3e32['error'][_0x261e('0x29')]);}else{logger[_0x261e('0x21')](_0x261e('0x28'),_0x4238f4,_0x261e('0x22'));_0x4bf786(_0x9d3e32['result']['message']);}})['catch'](function(_0x9272c){logger[_0x261e('0x26')](_0x261e('0x28'),_0x4238f4,_0x9272c);_0x20a185(_0x9272c);});});}function respondWithStatusCode(_0x1755c0,_0x274d2a){_0x274d2a=_0x274d2a||0xcc;return function(_0x42b2e6){if(_0x42b2e6){return _0x1755c0['sendStatus'](_0x274d2a);}return _0x1755c0['status'](_0x274d2a)[_0x261e('0x2a')]();};}function respondWithResult(_0x10faa1,_0x50af6d){_0x50af6d=_0x50af6d||0xc8;return function(_0xae691){if(_0xae691){return _0x10faa1['status'](_0x50af6d)['json'](_0xae691);}};}function respondWithFilteredResult(_0x4eac3d,_0x5b7a5d){return function(_0x51c414){if(_0x51c414){var _0xd394ae=_0x51c414[_0x261e('0x2b')],_0x1f4420=_0x5b7a5d[_0x261e('0x2c')],_0xac7593=_0x5b7a5d['offset']+_0x5b7a5d['limit'],_0x37de0f;if(_0xac7593>=_0xd394ae){_0xac7593=_0xd394ae;_0x37de0f=0xc8;}else{_0x37de0f=0xce;}_0x4eac3d[_0x261e('0x2d')](_0x37de0f);return _0x4eac3d[_0x261e('0x2e')](_0x261e('0x2f'),_0x1f4420+'-'+_0xac7593+'/'+_0xd394ae)[_0x261e('0x30')](_0x51c414);}return null;};}function patchUpdates(_0x214c60){return function(_0x555ac3){try{jsonpatch[_0x261e('0x31')](_0x555ac3,_0x214c60,!![]);}catch(_0x1a749e){return BPromise['reject'](_0x1a749e);}return _0x555ac3[_0x261e('0x32')]();};}function saveUpdates(_0x14c6a4,_0x17dc9e){return function(_0x3f3b5f){if(_0x3f3b5f){return _0x3f3b5f['update'](_0x14c6a4)[_0x261e('0x20')](function(_0x5885af){return _0x5885af;});}return null;};}function removeEntity(_0x44e903,_0x576c03){return function(_0x2cb935){if(_0x2cb935){return _0x2cb935['destroy']()[_0x261e('0x20')](function(){var _0x476776=_0x2cb935[_0x261e('0x33')]({'plain':!![]});var _0x1f4eaa=_0x261e('0x34');return db[_0x261e('0x35')]['destroy']({'where':{'type':_0x1f4eaa,'resourceId':_0x476776['id']}})[_0x261e('0x20')](function(){return _0x2cb935;});})[_0x261e('0x20')](function(){_0x44e903['status'](0xcc)[_0x261e('0x2a')]();});}};}function handleEntityNotFound(_0x5d5ccc,_0x643536){return function(_0x1a1132){if(!_0x1a1132){_0x5d5ccc['sendStatus'](0x194);}return _0x1a1132;};}function handleError(_0x36bc40,_0x26f31e){_0x26f31e=_0x26f31e||0x1f4;return function(_0x495faa){logger[_0x261e('0x26')](_0x495faa[_0x261e('0x36')]);if(_0x495faa[_0x261e('0x37')]){delete _0x495faa[_0x261e('0x37')];}_0x36bc40['status'](_0x26f31e)[_0x261e('0x38')](_0x495faa);};}exports[_0x261e('0x39')]=function(_0xef1226,_0x23574d){var _0x5c5ba3={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x2b489d={},_0x1a3594={'count':0x0,'rows':[]};var _0x56d0f9=_[_0x261e('0x3a')](db[_0x261e('0x3b')][_0x261e('0x3c')],function(_0x39cb6c){return{'name':_0x39cb6c[_0x261e('0x3d')],'type':_0x39cb6c['type'][_0x261e('0x3e')]};});_0x2b489d['model']=_['map'](_0x56d0f9,_0x261e('0x37'));_0x2b489d['query']=_[_0x261e('0x3f')](_0xef1226[_0x261e('0x40')]);_0x2b489d[_0x261e('0x41')]=_[_0x261e('0x42')](_0x2b489d[_0x261e('0x43')],_0x2b489d[_0x261e('0x40')]);_0x5c5ba3['attributes']=_['intersection'](_0x2b489d['model'],qs[_0x261e('0x44')](_0xef1226['query'][_0x261e('0x44')]));_0x5c5ba3['attributes']=_0x5c5ba3['attributes'][_0x261e('0x45')]?_0x5c5ba3[_0x261e('0x46')]:_0x2b489d[_0x261e('0x43')];if(!_0xef1226[_0x261e('0x40')]['hasOwnProperty'](_0x261e('0x47'))){_0x5c5ba3[_0x261e('0x48')]=qs[_0x261e('0x48')](_0xef1226[_0x261e('0x40')][_0x261e('0x48')]);_0x5c5ba3[_0x261e('0x2c')]=qs[_0x261e('0x2c')](_0xef1226['query'][_0x261e('0x2c')]);}_0x5c5ba3[_0x261e('0x49')]=qs['sort'](_0xef1226['query'][_0x261e('0x4a')]);_0x5c5ba3[_0x261e('0x4b')]=qs['filters'](_['pick'](_0xef1226[_0x261e('0x40')],_0x2b489d['filters']),_0x56d0f9);if(_0xef1226[_0x261e('0x40')][_0x261e('0x4c')]){_0x5c5ba3[_0x261e('0x4b')]=_[_0x261e('0x4d')](_0x5c5ba3[_0x261e('0x4b')],{'$or':_[_0x261e('0x3a')](_0x56d0f9,function(_0x32c95e){if(_0x32c95e[_0x261e('0x4e')]!==_0x261e('0x4f')){var _0x338131={};_0x338131[_0x32c95e[_0x261e('0x37')]]={'$like':'%'+_0xef1226[_0x261e('0x40')][_0x261e('0x4c')]+'%'};return _0x338131;}})});}_0x5c5ba3=_[_0x261e('0x4d')]({},_0x5c5ba3,_0xef1226[_0x261e('0x50')]);var _0x344672={'where':_0x5c5ba3[_0x261e('0x4b')]};return db['WhatsappAccount'][_0x261e('0x2b')](_0x344672)[_0x261e('0x20')](function(_0x215c7f){_0x1a3594[_0x261e('0x2b')]=_0x215c7f;if(_0xef1226[_0x261e('0x40')][_0x261e('0x51')]){_0x5c5ba3[_0x261e('0x52')]=[{'all':!![]}];}return db[_0x261e('0x3b')][_0x261e('0x53')](_0x5c5ba3);})[_0x261e('0x20')](function(_0x24ed44){_0x1a3594['rows']=_0x24ed44;return _0x1a3594;})['then'](respondWithFilteredResult(_0x23574d,_0x5c5ba3))[_0x261e('0x54')](handleError(_0x23574d,null));};exports['show']=function(_0x557e6e,_0x233efb){var _0x1c9f1e={'raw':![],'where':{'id':_0x557e6e['params']['id']},'include':[{'model':db['Pause'],'as':_0x261e('0x55')}]},_0x160acf={};_0x160acf[_0x261e('0x43')]=_[_0x261e('0x3f')](db['WhatsappAccount'][_0x261e('0x3c')]);_0x160acf['query']=_[_0x261e('0x3f')](_0x557e6e[_0x261e('0x40')]);_0x160acf['filters']=_[_0x261e('0x42')](_0x160acf['model'],_0x160acf['query']);_0x1c9f1e[_0x261e('0x46')]=_[_0x261e('0x42')](_0x160acf[_0x261e('0x43')],qs[_0x261e('0x44')](_0x557e6e['query'][_0x261e('0x44')]));_0x1c9f1e['attributes']=_0x1c9f1e['attributes'][_0x261e('0x45')]?_0x1c9f1e[_0x261e('0x46')]:_0x160acf[_0x261e('0x43')];if(_0x557e6e['query']['includeAll']){_0x1c9f1e['include']=[{'all':!![]}];}_0x1c9f1e=_[_0x261e('0x4d')]({},_0x1c9f1e,_0x557e6e[_0x261e('0x50')]);return db[_0x261e('0x3b')][_0x261e('0x56')](_0x1c9f1e)[_0x261e('0x20')](handleEntityNotFound(_0x233efb,null))['then'](respondWithResult(_0x233efb,null))['catch'](handleError(_0x233efb,null));};exports[_0x261e('0x57')]=function(_0x51d961,_0x2a425b){return db[_0x261e('0x3b')][_0x261e('0x57')](_0x51d961[_0x261e('0x58')],{})[_0x261e('0x20')](function(_0xf64c65){var _0x417dbd=_0x51d961[_0x261e('0x59')][_0x261e('0x33')]({'plain':!![]});if(!_0x417dbd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x417dbd[_0x261e('0x5a')]==='user'){var _0xbfc61d=_0xf64c65[_0x261e('0x33')]({'plain':!![]});var _0x3bd583=_0x261e('0x34');return db[_0x261e('0x5b')]['find']({'where':{'name':_0x3bd583,'userProfileId':_0x417dbd[_0x261e('0x5c')]},'raw':!![]})[_0x261e('0x20')](function(_0x597698){if(_0x597698&&_0x597698[_0x261e('0x5d')]===0x0){return db[_0x261e('0x35')][_0x261e('0x57')]({'name':_0xbfc61d[_0x261e('0x37')],'resourceId':_0xbfc61d['id'],'type':_0x597698[_0x261e('0x37')],'sectionId':_0x597698['id']},{})['then'](function(){return _0xf64c65;});}else{return _0xf64c65;}})[_0x261e('0x54')](function(_0xa77ece){logger['error'](_0x261e('0x5e'),_0xa77ece);throw _0xa77ece;});}return _0xf64c65;})[_0x261e('0x20')](respondWithResult(_0x2a425b,0xc9))[_0x261e('0x54')](handleError(_0x2a425b,null));};exports[_0x261e('0x5f')]=function(_0x5664c7,_0x272955){if(_0x5664c7[_0x261e('0x58')]['id']){delete _0x5664c7['body']['id'];}return db[_0x261e('0x3b')][_0x261e('0x56')]({'where':{'id':_0x5664c7[_0x261e('0x60')]['id']},'include':[{'model':db[_0x261e('0x61')],'as':_0x261e('0x55')}]})['then'](handleEntityNotFound(_0x272955,null))['then'](saveUpdates(_0x5664c7[_0x261e('0x58')],null))[_0x261e('0x20')](respondWithResult(_0x272955,null))[_0x261e('0x54')](handleError(_0x272955,null));};exports['destroy']=function(_0x58752f,_0x49f3b5){return db['WhatsappAccount']['find']({'where':{'id':_0x58752f[_0x261e('0x60')]['id']}})['then'](handleEntityNotFound(_0x49f3b5,null))[_0x261e('0x20')](removeEntity(_0x49f3b5,null))[_0x261e('0x54')](handleError(_0x49f3b5,null));};exports[_0x261e('0x62')]=function(_0x249ac8,_0x143b60){return db[_0x261e('0x3b')][_0x261e('0x62')]()[_0x261e('0x20')](respondWithResult(_0x143b60,null))[_0x261e('0x54')](handleError(_0x143b60,null));};exports[_0x261e('0x63')]=function(_0xb4844b,_0x3bbd68,_0x285538){if(_0xb4844b[_0x261e('0x58')]['id']){delete _0xb4844b[_0x261e('0x58')]['id'];}return db[_0x261e('0x3b')][_0x261e('0x56')]({'where':{'id':_0xb4844b[_0x261e('0x60')]['id']}})['then'](handleEntityNotFound(_0x3bbd68,null))[_0x261e('0x20')](function(_0x151d3e){if(_0x151d3e){_0xb4844b[_0x261e('0x58')]['WhatsappAccountId']=_0x151d3e['id'];return db[_0x261e('0x64')]['create'](_0xb4844b[_0x261e('0x58')]);}})['then'](respondWithResult(_0x3bbd68,null))[_0x261e('0x54')](handleError(_0x3bbd68,null));};exports[_0x261e('0x65')]=function(_0x128e1b,_0x4c5218,_0x9cd2fd){var _0x3f9abd={'raw':![],'where':{}};var _0x2cbfec={};var _0x4a2c7a={'count':0x0,'rows':[]};return db[_0x261e('0x3b')][_0x261e('0x66')]({'where':{'id':_0x128e1b[_0x261e('0x60')]['id']}})[_0x261e('0x20')](handleEntityNotFound(_0x4c5218,null))[_0x261e('0x20')](function(_0x307e14){if(_0x307e14){_0x2cbfec[_0x261e('0x43')]=_[_0x261e('0x3f')](db[_0x261e('0x64')]['rawAttributes']);_0x2cbfec[_0x261e('0x40')]=_[_0x261e('0x3f')](_0x128e1b[_0x261e('0x40')]);_0x2cbfec[_0x261e('0x41')]=_['intersection'](_0x2cbfec[_0x261e('0x43')],_0x2cbfec[_0x261e('0x40')]);_0x3f9abd[_0x261e('0x46')]=_[_0x261e('0x42')](_0x2cbfec['model'],qs[_0x261e('0x44')](_0x128e1b[_0x261e('0x40')]['fields']));_0x3f9abd[_0x261e('0x46')]=_0x3f9abd['attributes'][_0x261e('0x45')]?_0x3f9abd[_0x261e('0x46')]:_0x2cbfec[_0x261e('0x43')];if(!_0x128e1b[_0x261e('0x40')][_0x261e('0x67')](_0x261e('0x47'))){_0x3f9abd[_0x261e('0x48')]=qs['limit'](_0x128e1b['query'][_0x261e('0x48')]);_0x3f9abd[_0x261e('0x2c')]=qs[_0x261e('0x2c')](_0x128e1b[_0x261e('0x40')]['offset']);}_0x3f9abd['order']=qs[_0x261e('0x4a')](_0x128e1b[_0x261e('0x40')][_0x261e('0x4a')]);_0x3f9abd[_0x261e('0x4b')]=qs['filters'](_[_0x261e('0x68')](_0x128e1b[_0x261e('0x40')],_0x2cbfec['filters']));_0x3f9abd['where'][_0x261e('0x69')]=_0x307e14['id'];if(_0x128e1b[_0x261e('0x40')][_0x261e('0x4c')]){_0x3f9abd['where']=_[_0x261e('0x4d')](_0x3f9abd[_0x261e('0x4b')],{'$or':_[_0x261e('0x3a')](_0x3f9abd[_0x261e('0x46')],function(_0x35a68a){var _0x1cceb3={};_0x1cceb3[_0x35a68a]={'$like':'%'+_0x128e1b['query'][_0x261e('0x4c')]+'%'};return _0x1cceb3;})});}_0x3f9abd=_[_0x261e('0x4d')]({},_0x3f9abd,_0x128e1b[_0x261e('0x50')]);return db[_0x261e('0x64')][_0x261e('0x2b')]({'where':_0x3f9abd[_0x261e('0x4b')]})[_0x261e('0x20')](function(_0x184e50){_0x4a2c7a[_0x261e('0x2b')]=_0x184e50;if(_0x128e1b['query'][_0x261e('0x51')]){_0x3f9abd['include']=[{'all':!![]}];}return db[_0x261e('0x64')][_0x261e('0x53')](_0x3f9abd);})[_0x261e('0x20')](function(_0x5b6114){_0x4a2c7a[_0x261e('0x6a')]=_0x5b6114;return _0x4a2c7a;});}})[_0x261e('0x20')](respondWithFilteredResult(_0x4c5218,_0x3f9abd))[_0x261e('0x54')](handleError(_0x4c5218,null));};exports[_0x261e('0x6b')]=function(_0xf95f69,_0x5433ac,_0x41aa8c){return db[_0x261e('0x3b')]['find']({'where':{'id':_0xf95f69[_0x261e('0x60')]['id']}})[_0x261e('0x20')](handleEntityNotFound(_0x5433ac,null))[_0x261e('0x20')](function(_0x5c9200){if(_0x5c9200){return _0x5c9200['removeDispositions'](_0xf95f69[_0x261e('0x40')][_0x261e('0x6c')]);}})[_0x261e('0x20')](respondWithStatusCode(_0x5433ac,null))[_0x261e('0x54')](handleError(_0x5433ac,null));};exports['addAnswer']=function(_0x124b85,_0x4b75d8,_0x317f4a){if(_0x124b85[_0x261e('0x58')]['id']){delete _0x124b85['body']['id'];}return db[_0x261e('0x3b')]['find']({'where':{'id':_0x124b85['params']['id']}})[_0x261e('0x20')](handleEntityNotFound(_0x4b75d8,null))[_0x261e('0x20')](function(_0x1239b1){if(_0x1239b1){_0x124b85['body']['WhatsappAccountId']=_0x1239b1['id'];return db[_0x261e('0x6d')][_0x261e('0x57')](_0x124b85[_0x261e('0x58')]);}})[_0x261e('0x20')](respondWithResult(_0x4b75d8,null))[_0x261e('0x54')](handleError(_0x4b75d8,null));};exports[_0x261e('0x6e')]=function(_0x3f8020,_0x47d264,_0x34d47a){var _0x59b56d={'raw':![],'where':{}};var _0x556f0f={};var _0x581c2b={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x261e('0x66')]({'where':{'id':_0x3f8020[_0x261e('0x60')]['id']}})['then'](handleEntityNotFound(_0x47d264,null))[_0x261e('0x20')](function(_0x3eac7b){if(_0x3eac7b){_0x556f0f[_0x261e('0x43')]=_[_0x261e('0x3f')](db[_0x261e('0x6d')]['rawAttributes']);_0x556f0f['query']=_[_0x261e('0x3f')](_0x3f8020['query']);_0x556f0f[_0x261e('0x41')]=_[_0x261e('0x42')](_0x556f0f['model'],_0x556f0f[_0x261e('0x40')]);_0x59b56d[_0x261e('0x46')]=_[_0x261e('0x42')](_0x556f0f[_0x261e('0x43')],qs[_0x261e('0x44')](_0x3f8020[_0x261e('0x40')][_0x261e('0x44')]));_0x59b56d['attributes']=_0x59b56d[_0x261e('0x46')]['length']?_0x59b56d[_0x261e('0x46')]:_0x556f0f['model'];if(!_0x3f8020[_0x261e('0x40')][_0x261e('0x67')](_0x261e('0x47'))){_0x59b56d['limit']=qs[_0x261e('0x48')](_0x3f8020[_0x261e('0x40')][_0x261e('0x48')]);_0x59b56d['offset']=qs[_0x261e('0x2c')](_0x3f8020[_0x261e('0x40')][_0x261e('0x2c')]);}_0x59b56d[_0x261e('0x49')]=qs['sort'](_0x3f8020[_0x261e('0x40')][_0x261e('0x4a')]);_0x59b56d['where']=qs['filters'](_[_0x261e('0x68')](_0x3f8020['query'],_0x556f0f['filters']));_0x59b56d[_0x261e('0x4b')][_0x261e('0x69')]=_0x3eac7b['id'];if(_0x3f8020[_0x261e('0x40')][_0x261e('0x4c')]){_0x59b56d[_0x261e('0x4b')]=_[_0x261e('0x4d')](_0x59b56d[_0x261e('0x4b')],{'$or':_[_0x261e('0x3a')](_0x59b56d[_0x261e('0x46')],function(_0x25a068){var _0x378cee={};_0x378cee[_0x25a068]={'$like':'%'+_0x3f8020[_0x261e('0x40')][_0x261e('0x4c')]+'%'};return _0x378cee;})});}_0x59b56d=_[_0x261e('0x4d')]({},_0x59b56d,_0x3f8020[_0x261e('0x50')]);return db['CannedAnswer'][_0x261e('0x2b')]({'where':_0x59b56d[_0x261e('0x4b')]})['then'](function(_0x48d5b7){_0x581c2b[_0x261e('0x2b')]=_0x48d5b7;if(_0x3f8020[_0x261e('0x40')][_0x261e('0x51')]){_0x59b56d[_0x261e('0x52')]=[{'all':!![]}];}return db[_0x261e('0x6d')][_0x261e('0x53')](_0x59b56d);})[_0x261e('0x20')](function(_0x1cf54d){_0x581c2b['rows']=_0x1cf54d;return _0x581c2b;});}})[_0x261e('0x20')](respondWithFilteredResult(_0x47d264,_0x59b56d))[_0x261e('0x54')](handleError(_0x47d264,null));};exports[_0x261e('0x6f')]=function(_0x598047,_0x19470f,_0x519b43){return db[_0x261e('0x3b')][_0x261e('0x56')]({'where':{'id':_0x598047['params']['id']}})[_0x261e('0x20')](handleEntityNotFound(_0x19470f,null))[_0x261e('0x20')](function(_0x3307a1){if(_0x3307a1){return _0x3307a1[_0x261e('0x6f')](_0x598047[_0x261e('0x40')]['ids']);}})[_0x261e('0x20')](respondWithStatusCode(_0x19470f,null))[_0x261e('0x54')](handleError(_0x19470f,null));};exports['addAgents']=function(_0x59dc29,_0x491619,_0x206c69){return db[_0x261e('0x3b')][_0x261e('0x56')]({'where':{'id':_0x59dc29['params']['id']}})['then'](handleEntityNotFound(_0x491619,null))['then'](function(_0x5d7510){if(_0x5d7510){return _0x5d7510[_0x261e('0x70')](_0x59dc29[_0x261e('0x58')][_0x261e('0x6c')],_[_0x261e('0x71')](_0x59dc29['body'],[_0x261e('0x6c'),'id'])||{})[_0x261e('0x72')](function(_0x501b5a){for(var _0x20d93c=0x0;_0x20d93c<_0x59dc29[_0x261e('0x58')][_0x261e('0x6c')]['length'];_0x20d93c+=0x1){socket[_0x261e('0x73')](_0x261e('0x74'),{'UserId':_0x59dc29[_0x261e('0x58')][_0x261e('0x6c')][_0x20d93c],'WhatsappAccountId':_0x59dc29[_0x261e('0x60')]['id']});}return _0x501b5a;});}})[_0x261e('0x20')](respondWithResult(_0x491619,null))[_0x261e('0x54')](handleError(_0x491619,null));};exports[_0x261e('0x75')]=function(_0x365826,_0x124bb9,_0x776121){return db[_0x261e('0x3b')]['find']({'where':{'id':_0x365826['params']['id']}})[_0x261e('0x20')](handleEntityNotFound(_0x124bb9,null))['then'](function(_0x1d4ff3){if(_0x1d4ff3){return _0x1d4ff3['removeAgents'](_0x365826[_0x261e('0x40')][_0x261e('0x6c')])[_0x261e('0x20')](function(){if(_[_0x261e('0x76')](_0x365826[_0x261e('0x40')][_0x261e('0x6c')])){for(var _0x395cd0=0x0;_0x395cd0<_0x365826['query'][_0x261e('0x6c')][_0x261e('0x45')];_0x395cd0+=0x1){socket['emit'](_0x261e('0x77'),{'UserId':Number(_0x365826[_0x261e('0x40')][_0x261e('0x6c')][_0x395cd0]),'WhatsappAccountId':Number(_0x365826[_0x261e('0x60')]['id'])});}}else{socket['emit'](_0x261e('0x77'),{'UserId':Number(_0x365826[_0x261e('0x40')][_0x261e('0x6c')]),'WhatsappAccountId':Number(_0x365826[_0x261e('0x60')]['id'])});}});}})[_0x261e('0x20')](respondWithStatusCode(_0x124bb9,null))[_0x261e('0x54')](handleError(_0x124bb9,null));};exports[_0x261e('0x78')]=function(_0x4557be,_0x4e749c,_0x536a45){var _0x3f6ef6={};var _0x2557ca={};var _0x1a2d63;var _0x5ef6dc;return db['WhatsappAccount'][_0x261e('0x66')]({'where':{'id':_0x4557be['params']['id']}})[_0x261e('0x20')](handleEntityNotFound(_0x4e749c,null))[_0x261e('0x20')](function(_0x2362e8){if(_0x2362e8){_0x1a2d63=_0x2362e8;_0x2557ca['model']=_[_0x261e('0x3f')](db[_0x261e('0x79')]['rawAttributes']);_0x2557ca[_0x261e('0x40')]=_[_0x261e('0x3f')](_0x4557be[_0x261e('0x40')]);_0x2557ca[_0x261e('0x41')]=_['intersection'](_0x2557ca[_0x261e('0x43')],_0x2557ca['query']);_0x3f6ef6[_0x261e('0x46')]=_[_0x261e('0x42')](_0x2557ca[_0x261e('0x43')],qs['fields'](_0x4557be['query'][_0x261e('0x44')]));_0x3f6ef6[_0x261e('0x46')]=_0x3f6ef6['attributes'][_0x261e('0x45')]?_0x3f6ef6[_0x261e('0x46')]:_0x2557ca[_0x261e('0x43')];_0x3f6ef6[_0x261e('0x49')]=qs[_0x261e('0x4a')](_0x4557be[_0x261e('0x40')][_0x261e('0x4a')]);_0x3f6ef6[_0x261e('0x4b')]=qs['filters'](_['pick'](_0x4557be[_0x261e('0x40')],_0x2557ca[_0x261e('0x41')]));if(_0x4557be['query'][_0x261e('0x4c')]){_0x3f6ef6[_0x261e('0x4b')]=_[_0x261e('0x4d')](_0x3f6ef6['where'],{'$or':_[_0x261e('0x3a')](_0x3f6ef6['attributes'],function(_0x2ceee2){var _0x54cf3a={};_0x54cf3a[_0x2ceee2]={'$like':'%'+_0x4557be['query']['filter']+'%'};return _0x54cf3a;})});}_0x3f6ef6=_[_0x261e('0x4d')]({},_0x3f6ef6,_0x4557be['options']);return _0x1a2d63[_0x261e('0x78')](_0x3f6ef6);}})[_0x261e('0x20')](function(_0x50e55e){if(_0x50e55e){_0x5ef6dc=_0x50e55e[_0x261e('0x45')];if(!_0x4557be[_0x261e('0x40')]['hasOwnProperty'](_0x261e('0x47'))){_0x3f6ef6[_0x261e('0x48')]=qs[_0x261e('0x48')](_0x4557be['query'][_0x261e('0x48')]);_0x3f6ef6[_0x261e('0x2c')]=qs[_0x261e('0x2c')](_0x4557be[_0x261e('0x40')][_0x261e('0x2c')]);}return _0x1a2d63[_0x261e('0x78')](_0x3f6ef6);}})['then'](function(_0x2c0fb8){if(_0x2c0fb8){return _0x2c0fb8?{'count':_0x5ef6dc,'rows':_0x2c0fb8}:null;}})[_0x261e('0x20')](respondWithResult(_0x4e749c,null))[_0x261e('0x54')](handleError(_0x4e749c,null));};exports[_0x261e('0x7a')]=function(_0x5bff48,_0x5d79da,_0x27c689){return db['WhatsappAccount'][_0x261e('0x66')]({'where':{'id':_0x5bff48[_0x261e('0x60')]['id']}})['then'](handleEntityNotFound(_0x5d79da,null))[_0x261e('0x20')](function(_0xe1a8b8){if(_0xe1a8b8){return db[_0x261e('0x7b')][_0x261e('0x7c')](function(_0x367e58){return db[_0x261e('0x7d')][_0x261e('0x7e')]({'where':{'WhatsappAccountId':_0x5bff48[_0x261e('0x60')]['id']},'transaction':_0x367e58})[_0x261e('0x20')](function(_0x9ad884){var _0xac09bb=_[_0x261e('0x3a')](_0x5bff48[_0x261e('0x58')],function(_0x4893b0){_0x4893b0[_0x261e('0x69')]=_0x5bff48[_0x261e('0x60')]['id'];return _0x4893b0;});return db[_0x261e('0x7d')][_0x261e('0x7f')](_0xac09bb,{'transaction':_0x367e58});});})[_0x261e('0x20')](function(){return db['WhatsappApplication'][_0x261e('0x80')]({'where':{'WhatsappAccountId':_0x5bff48[_0x261e('0x60')]['id']},'order':_0x261e('0x81')});});}})['then'](respondWithResult(_0x5d79da,null))['catch'](handleError(_0x5d79da,null));};exports['getApplications']=function(_0x2c2732,_0x12f1b5,_0x111105){var _0x171482={};var _0x2a27bb={};var _0x4d7145;var _0x8473d0;return db['WhatsappAccount'][_0x261e('0x66')]({'where':{'id':_0x2c2732['params']['id']}})[_0x261e('0x20')](handleEntityNotFound(_0x12f1b5,null))[_0x261e('0x20')](function(_0xf7d245){if(_0xf7d245){_0x4d7145=_0xf7d245;_0x2a27bb[_0x261e('0x43')]=_[_0x261e('0x3f')](db[_0x261e('0x7d')][_0x261e('0x3c')]);_0x2a27bb[_0x261e('0x40')]=_[_0x261e('0x3f')](_0x2c2732['query']);_0x2a27bb['filters']=_[_0x261e('0x42')](_0x2a27bb['model'],_0x2a27bb[_0x261e('0x40')]);_0x171482[_0x261e('0x46')]=_[_0x261e('0x42')](_0x2a27bb[_0x261e('0x43')],qs['fields'](_0x2c2732['query'][_0x261e('0x44')]));_0x171482['attributes']=_0x171482[_0x261e('0x46')][_0x261e('0x45')]?_0x171482['attributes']:_0x2a27bb[_0x261e('0x43')];_0x171482[_0x261e('0x49')]=qs[_0x261e('0x4a')](_0x2c2732[_0x261e('0x40')][_0x261e('0x4a')]);_0x171482[_0x261e('0x4b')]=qs['filters'](_[_0x261e('0x68')](_0x2c2732[_0x261e('0x40')],_0x2a27bb[_0x261e('0x41')]));if(_0x2c2732[_0x261e('0x40')]['filter']){_0x171482[_0x261e('0x4b')]=_[_0x261e('0x4d')](_0x171482[_0x261e('0x4b')],{'$or':_[_0x261e('0x3a')](_0x171482[_0x261e('0x46')],function(_0x2ce6c6){var _0x19dfdd={};_0x19dfdd[_0x2ce6c6]={'$like':'%'+_0x2c2732['query'][_0x261e('0x4c')]+'%'};return _0x19dfdd;})});}_0x171482=_[_0x261e('0x4d')]({},_0x171482,_0x2c2732[_0x261e('0x50')]);return _0x4d7145['getApplications'](_0x171482);}})['then'](function(_0x338920){if(_0x338920){_0x8473d0=_0x338920[_0x261e('0x45')];if(!_0x2c2732[_0x261e('0x40')][_0x261e('0x67')](_0x261e('0x47'))){_0x171482[_0x261e('0x48')]=qs['limit'](_0x2c2732['query'][_0x261e('0x48')]);_0x171482[_0x261e('0x2c')]=qs[_0x261e('0x2c')](_0x2c2732[_0x261e('0x40')][_0x261e('0x2c')]);}return _0x4d7145[_0x261e('0x82')](_0x171482);}})[_0x261e('0x20')](function(_0x2af15c){if(_0x2af15c){return _0x2af15c?{'count':_0x8473d0,'rows':_0x2af15c}:null;}})[_0x261e('0x20')](respondWithResult(_0x12f1b5,null))[_0x261e('0x54')](handleError(_0x12f1b5,null));};exports[_0x261e('0x83')]=function(_0x35e5c2,_0x338946,_0x395cbf){var _0x46a440={'channel':'whatsapp'};var _0x2e40d2=[];var _0x1971bd=[];var _0x23a2bd={};return db[_0x261e('0x3b')][_0x261e('0x56')]({'where':{'id':_0x35e5c2[_0x261e('0x60')]['id']},'include':[{'model':db[_0x261e('0x7d')],'as':'Applications'}]})[_0x261e('0x20')](handleEntityNotFound(_0x338946,null))[_0x261e('0x20')](function(_0x459c72){_0x46a440[_0x261e('0x84')]=_0x459c72;_0x46a440[_0x261e('0x85')]=_[_0x261e('0x86')](_0x459c72[_0x261e('0x87')],[_0x261e('0x81')],[_0x261e('0x88')]);if(_0x46a440[_0x261e('0x84')]['Applications']){delete _0x46a440[_0x261e('0x84')][_0x261e('0x87')];}return db['CmContact'][_0x261e('0x62')]();})[_0x261e('0x20')](function(_0x4e5bc3){if(!_0x4e5bc3){throw new db[(_0x261e('0x89'))][(_0x261e('0x8a'))](_0x261e('0x8b'));}_0x2e40d2=_[_0x261e('0x8c')](_[_0x261e('0x3f')](_0x4e5bc3),['createdAt',_0x261e('0x8d')]);_0x1971bd=_[_0x261e('0x8c')](_[_0x261e('0x3f')](_0x4e5bc3),[_0x261e('0x8e'),_0x261e('0x8d'),_0x261e('0x8f'),'ListId']);_0x46a440[_0x261e('0x58')]={'mapKey':_0x261e('0x90')};if(_0x46a440[_0x261e('0x84')][_0x261e('0x4e')]&&_0x46a440[_0x261e('0x84')][_0x261e('0x4e')]===_0x261e('0x91')){_0x46a440['body'][_0x261e('0x92')]=_0x35e5c2[_0x261e('0x58')][_0x261e('0x93')]['replace']('whatsapp:','');_0x46a440['body'][_0x261e('0x58')]=_0x35e5c2[_0x261e('0x58')]['Body'];_0x46a440[_0x261e('0x58')][_0x261e('0x94')]=_0x35e5c2[_0x261e('0x58')][_0x261e('0x95')];}if(_0x46a440[_0x261e('0x58')]['id']){delete _0x46a440[_0x261e('0x58')]['id'];}if(_[_0x261e('0x96')](_0x46a440[_0x261e('0x58')][_0x261e('0x92')])){throw new db[(_0x261e('0x89'))][(_0x261e('0x8a'))](_0x261e('0x97'));}if(_[_0x261e('0x96')](_0x46a440[_0x261e('0x58')]['body'])||_0x46a440[_0x261e('0x58')][_0x261e('0x58')]===''){throw new db[(_0x261e('0x89'))][(_0x261e('0x8a'))](_0x261e('0x98'));}if(_[_0x261e('0x96')](_0x46a440[_0x261e('0x58')][_0x261e('0x99')])){throw new db[(_0x261e('0x89'))][(_0x261e('0x8a'))](_0x261e('0x9a')+_0x1971bd);}if(!_[_0x261e('0x9b')](_0x1971bd,_0x46a440['body']['mapKey'])){throw new db['Sequelize'][(_0x261e('0x8a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1971bd);}_0x23a2bd[_0x46a440[_0x261e('0x58')]['mapKey']]=_0x46a440[_0x261e('0x58')][_0x261e('0x92')];return db[_0x261e('0x9c')][_0x261e('0x56')]({'where':{'id':_0x46a440[_0x261e('0x84')][_0x261e('0x9d')]},'include':[{'model':db[_0x261e('0x9e')],'as':_0x261e('0x9f'),'where':_0x23a2bd,'limit':0x1,'order':[[_0x261e('0x8d'),_0x261e('0xa0')]]}]});})[_0x261e('0x20')](handleEntityNotFound(_0x338946,null))['then'](function(_0x251d83){if(_0x251d83){_0x46a440[_0x261e('0xa1')]=_[_0x261e('0x71')](_0x251d83,[_0x261e('0x9f')]);if(_0x251d83[_0x261e('0x9f')][_0x261e('0x45')]){return _0x251d83[_0x261e('0x9f')][0x0];}var _0xba8448=_[_0x261e('0x1b')](_0x46a440['body'],{'firstName':_0x46a440[_0x261e('0x58')]['from'],'ListId':_0x251d83['id']});_0xba8448[_0x46a440['body'][_0x261e('0x99')]]=_0x46a440['body']['from'];return db['CmContact']['create'](_0xba8448,{'fields':_0x2e40d2,'raw':!![]});}})[_0x261e('0x20')](handleEntityNotFound(_0x338946,null))[_0x261e('0x20')](function(_0x14673b){if(_0x14673b){_0x46a440[_0x261e('0xa2')]=_0x14673b;var _0x39215d={'ContactId':_0x14673b['id'],'phone':_0x46a440[_0x261e('0x58')][_0x261e('0x92')],'WhatsappAccountId':_0x35e5c2[_0x261e('0x60')]['id']};var _0x3668d9={'ContactId':_0x14673b['id'],'WhatsappAccountId':_0x35e5c2[_0x261e('0x60')]['id'],'closed':![]};return db['WhatsappInteraction']['find']({'where':_0x3668d9})[_0x261e('0x20')](function(_0x4b5882){if(_0x4b5882){return[_0x4b5882,![]];}return db[_0x261e('0xa3')][_0x261e('0x57')](_0x39215d)['then'](function(_0x8c058a){return[_0x8c058a,!![]];});});}})[_0x261e('0x72')](function(_0x22cac7,_0x5c4341){_0x46a440[_0x261e('0xa4')]=_0x22cac7['get']({'plain':!![]});_0x46a440['interaction'][_0x261e('0xa5')]=![];if(_0x5c4341){if(_0x46a440[_0x261e('0x84')][_0x261e('0xa6')]){_0x46a440['applications'][_0x261e('0xa7')]({'id':0x0,'priority':_0x46a440['applications']['length']+0x1,'app':'close','appdata':_0x261e('0xa8'),'interval':_0x261e('0xa9')});}_0x46a440[_0x261e('0xa4')][_0x261e('0xa5')]=!![];}return db['WhatsappMessage'][_0x261e('0x57')]({'phone':_0x46a440[_0x261e('0x58')]['from'],'messageId':_0x46a440['body'][_0x261e('0x94')],'body':_0x46a440[_0x261e('0x58')][_0x261e('0x58')],'WhatsappAccountId':_0x35e5c2[_0x261e('0x60')]['id'],'WhatsappInteractionId':_0x22cac7['id'],'direction':'in','ContactId':_0x22cac7[_0x261e('0xaa')],'AttachmentId':_0x46a440[_0x261e('0x58')][_0x261e('0xab')]});})[_0x261e('0x20')](function(_0x5bfe72){_0x46a440[_0x261e('0x29')]=_0x5bfe72;if(_0x46a440[_0x261e('0xa4')][_0x261e('0xac')]){return db[_0x261e('0x79')]['find']({'attributes':['id',_0x261e('0x37')],'where':{'id':_0x46a440[_0x261e('0xa4')]['UserId']}})[_0x261e('0x20')](function(_0x4c99fa){if(_0x4c99fa){_0x46a440[_0x261e('0x85')][_0x261e('0xad')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4c99fa[_0x261e('0x37')]+','+(_0x46a440[_0x261e('0x84')][_0x261e('0xae')]||0xa),'interval':_0x261e('0xa9')});}return respondWithRpcPromise('Start',_0x261e('0xaf'),_0x46a440);});}return respondWithRpcPromise(_0x261e('0xb0'),'startRouting',_0x46a440);})['then'](function(_0xc3a09c){if(_0xc3a09c){var _0x1462f4=0xc8;var _0x358534=_0x261e('0xb1');logger[_0x261e('0x21')](_0x261e('0x24'),_0x358534,_0x1462f4,'entity\x20found');logger[_0x261e('0x23')](_0x261e('0xb2'),_0x358534,_0x1462f4,_0x261e('0xb3'),JSON[_0x261e('0x25')](_0xc3a09c));if(_0x46a440[_0x261e('0x84')][_0x261e('0x4e')]===_0x261e('0x91')){return _0x338946[_0x261e('0x2d')](_0x1462f4)[_0x261e('0x2e')](_0x261e('0xb4'),_0x261e('0xb5'))[_0x261e('0x38')](_0x261e('0xb6'));}else{return _0x338946['status'](_0x1462f4)[_0x261e('0x30')](_0xc3a09c);}}})[_0x261e('0x54')](handleError(_0x338946,null));};exports[_0x261e('0x38')]=function(_0x14ab26,_0x27802b,_0x56e00a){var _0x30ad4a,_0x41fd84,_0x26a15f;if(_[_0x261e('0x96')](_0x14ab26[_0x261e('0x58')][_0x261e('0x58')])||_0x14ab26[_0x261e('0x58')][_0x261e('0x58')]===''){throw new db['Sequelize'][(_0x261e('0x8a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x261e('0x96')](_0x14ab26['body']['to'])){throw new db[(_0x261e('0x89'))][(_0x261e('0x8a'))](_0x261e('0xb7'));}_0x30ad4a=_0x14ab26[_0x261e('0x58')]['to'];return db[_0x261e('0x3b')][_0x261e('0x56')]({'where':{'id':_0x14ab26['params']['id']},'include':[{'model':db[_0x261e('0x9c')],'as':'List','include':[{'model':db[_0x261e('0x9e')],'as':_0x261e('0x9f'),'where':{'mobile':_0x30ad4a},'limit':0x1,'order':[[_0x261e('0x8d'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x27802b,null))[_0x261e('0x20')](function(_0x473977){if(_0x473977&&_0x473977[_0x261e('0xb8')]){_0x41fd84=_0x473977[_0x261e('0x33')]({'plain':!![]});if(_0x41fd84[_0x261e('0xb8')]&&_0x41fd84['List'][_0x261e('0x9f')][_0x261e('0x45')]){return _0x41fd84[_0x261e('0xb8')][_0x261e('0x9f')][0x0];}return db[_0x261e('0x9e')][_0x261e('0x57')](_[_0x261e('0x1b')](_0x14ab26[_0x261e('0x58')],{'firstName':_0x30ad4a,'mobile':_0x30ad4a,'phone':_0x30ad4a,'ListId':_0x41fd84[_0x261e('0x9d')]}));}})[_0x261e('0x20')](handleEntityNotFound(_0x27802b,null))[_0x261e('0x20')](function(_0xb1037d){if(_0xb1037d){_0x26a15f=_0xb1037d;return db[_0x261e('0xa3')][_0x261e('0x56')]({'where':{'ContactId':_0x26a15f['id'],'closed':![],'WhatsappAccountId':_0x41fd84['id']}})[_0x261e('0x20')](function(_0x4f60e9){if(_0x4f60e9){return[_0x4f60e9,![]];}return db[_0x261e('0xa3')][_0x261e('0x57')]({'UserId':_0x14ab26[_0x261e('0x59')]['id'],'ContactId':_0x26a15f['id'],'WhatsappAccountId':_0x41fd84['id'],'phone':_0x30ad4a,'firstMsgDirection':_0x261e('0xb9'),'Messages':[_['merge'](_0x14ab26[_0x261e('0x58')],{'read':![],'body':_0x14ab26[_0x261e('0x58')][_0x261e('0x58')],'phone':_0x30ad4a,'WhatsappAccountId':_0x41fd84['id'],'UserId':_0x14ab26['user']['id'],'ContactId':_0x26a15f['id']})]},{'include':[{'model':db[_0x261e('0xba')],'as':_0x261e('0xbb')}]})[_0x261e('0x20')](function(_0x5d800c){return[_0x5d800c,!![]];});});}})[_0x261e('0x72')](function(_0x10ab39,_0x5b7c4c){if(_0x5b7c4c){return _0x10ab39;}return db[_0x261e('0xba')]['create'](_[_0x261e('0x4d')](_0x14ab26[_0x261e('0x58')],{'read':![],'body':_0x14ab26['body'][_0x261e('0x58')],'phone':_0x30ad4a,'WhatsappAccountId':_0x41fd84['id'],'WhatsappInteractionId':_0x10ab39['id'],'UserId':_0x14ab26['user']['id'],'ContactId':_0x26a15f['id']}))[_0x261e('0x20')](function(_0x2bc754){_0x10ab39[_0x261e('0xbc')][_0x261e('0xbb')]=[];_0x10ab39[_0x261e('0xbc')][_0x261e('0xbb')][_0x261e('0xa7')](_0x2bc754[_0x261e('0xbc')]);return _0x10ab39;});})[_0x261e('0x20')](respondWithResult(_0x27802b,null))['catch'](handleError(_0x27802b,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 1a1d7a1..34e8c56 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 _0xef17=['update','remove','emit','hook','events','../../mysqldb','WhatsappAccount','setMaxListeners','save'];(function(_0x2128e0,_0x385126){var _0x3ded3f=function(_0x31b239){while(--_0x31b239){_0x2128e0['push'](_0x2128e0['shift']());}};_0x3ded3f(++_0x385126);}(_0xef17,0x136));var _0x7ef1=function(_0x58351d,_0x27d107){_0x58351d=_0x58351d-0x0;var _0x4c3eff=_0xef17[_0x58351d];return _0x4c3eff;};'use strict';var EventEmitter=require(_0x7ef1('0x0'));var WhatsappAccount=require(_0x7ef1('0x1'))['db'][_0x7ef1('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7ef1('0x3')](0x0);var events={'afterCreate':_0x7ef1('0x4'),'afterUpdate':_0x7ef1('0x5'),'afterDestroy':_0x7ef1('0x6')};function emitEvent(_0x19a10d){return function(_0x2daaa6,_0x538a0a,_0x1d2f83){WhatsappAccountEvents['emit'](_0x19a10d+':'+_0x2daaa6['id'],_0x2daaa6);WhatsappAccountEvents[_0x7ef1('0x7')](_0x19a10d,_0x2daaa6);_0x1d2f83(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x7ef1('0x8')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x5d17=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x5d17,0x114));var _0x75d1=function(_0x2f3ca5,_0x3ba4ac){_0x2f3ca5=_0x2f3ca5-0x0;var _0x11cc85=_0x5d17[_0x2f3ca5];return _0x11cc85;};'use strict';var EventEmitter=require(_0x75d1('0x0'));var WhatsappAccount=require(_0x75d1('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x75d1('0x2'),'afterUpdate':_0x75d1('0x3'),'afterDestroy':_0x75d1('0x4')};function emitEvent(_0x5b3267){return function(_0x177460,_0x45d03a,_0x387e35){WhatsappAccountEvents[_0x75d1('0x5')](_0x5b3267+':'+_0x177460['id'],_0x177460);WhatsappAccountEvents['emit'](_0x5b3267,_0x177460);_0x387e35(null);};}for(var e in events){if(events[_0x75d1('0x6')](e)){var event=events[e];WhatsappAccount[_0x75d1('0x7')](e,emitEvent(event));}}module[_0x75d1('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 560be81..0de2f2a 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 _0x0e42=['util','../../config/logger','api','moment','request-promise','rimraf','./whatsappAccount.attributes','exports','define','lodash'];(function(_0x470b53,_0x43aba1){var _0x34d21b=function(_0x56bb31){while(--_0x56bb31){_0x470b53['push'](_0x470b53['shift']());}};_0x34d21b(++_0x43aba1);}(_0x0e42,0xa9));var _0x20e4=function(_0x8de604,_0x2fe19a){_0x8de604=_0x8de604-0x0;var _0x585490=_0x0e42[_0x8de604];return _0x585490;};'use strict';var _=require(_0x20e4('0x0'));var util=require(_0x20e4('0x1'));var logger=require(_0x20e4('0x2'))(_0x20e4('0x3'));var moment=require(_0x20e4('0x4'));var BPromise=require('bluebird');var rp=require(_0x20e4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x20e4('0x6'));var config=require('../../config/environment');var attributes=require(_0x20e4('0x7'));module[_0x20e4('0x8')]=function(_0x1bc5b9,_0x3a35b8){return _0x1bc5b9[_0x20e4('0x9')]('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6a1=['bluebird','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','exports','WhatsappAccount','whatsapp_accounts','../../config/logger','api','moment'];(function(_0x262efa,_0x1c4427){var _0x2ba5b5=function(_0x43b40b){while(--_0x43b40b){_0x262efa['push'](_0x262efa['shift']());}};_0x2ba5b5(++_0x1c4427);}(_0xf6a1,0xef));var _0x1f6a=function(_0x1d71de,_0x2d1f52){_0x1d71de=_0x1d71de-0x0;var _0x349da5=_0xf6a1[_0x1d71de];return _0x349da5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1f6a('0x0'))(_0x1f6a('0x1'));var moment=require(_0x1f6a('0x2'));var BPromise=require(_0x1f6a('0x3'));var rp=require(_0x1f6a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1f6a('0x5'));var config=require(_0x1f6a('0x6'));var attributes=require(_0x1f6a('0x7'));module[_0x1f6a('0x8')]=function(_0x4ddef9,_0x43f8fb){return _0x4ddef9['define'](_0x1f6a('0x9'),attributes,{'tableName':_0x1f6a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 544b0a9..979bf49 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 _0x9483=['attributes','include','map','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','raw','options','where'];(function(_0x586197,_0x2c087b){var _0x2f3ceb=function(_0x186ec3){while(--_0x186ec3){_0x586197['push'](_0x586197['shift']());}};_0x2f3ceb(++_0x2c087b);}(_0x9483,0xc3));var _0x3948=function(_0x3da42f,_0x52d8f3){_0x3da42f=_0x3da42f-0x0;var _0x2ae7c7=_0x9483[_0x3da42f];return _0x2ae7c7;};'use strict';var _=require(_0x3948('0x0'));var util=require(_0x3948('0x1'));var moment=require(_0x3948('0x2'));var BPromise=require(_0x3948('0x3'));var rs=require(_0x3948('0x4'));var fs=require('fs');var Redis=require(_0x3948('0x5'));var db=require(_0x3948('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3948('0x7'))(_0x3948('0x8'));var config=require(_0x3948('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3948('0xa')][_0x3948('0xb')]({'port':0x232a});config[_0x3948('0xc')]=_[_0x3948('0xd')](config[_0x3948('0xc')],{'host':_0x3948('0xe'),'port':0x18eb});var socket=require(_0x3948('0xf'))(new Redis(config[_0x3948('0xc')]));require(_0x3948('0x10'))[_0x3948('0x11')](socket);function respondWithRpcPromise(_0x2b1f44,_0x3a5aeb,_0x471c75){return new BPromise(function(_0x16e15f,_0x5440a8){return client['request'](_0x2b1f44,_0x471c75)[_0x3948('0x12')](function(_0x50e427){logger[_0x3948('0x13')](_0x3948('0x14'),_0x3a5aeb,_0x3948('0x15'));logger['debug'](_0x3948('0x16'),_0x3a5aeb,_0x3948('0x15'),JSON['stringify'](_0x50e427));if(_0x50e427[_0x3948('0x17')]){if(_0x50e427[_0x3948('0x17')]['code']===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x3a5aeb,_0x50e427[_0x3948('0x17')][_0x3948('0x18')]);return _0x5440a8(_0x50e427[_0x3948('0x17')][_0x3948('0x18')]);}logger[_0x3948('0x17')](_0x3948('0x14'),_0x3a5aeb,_0x50e427[_0x3948('0x17')][_0x3948('0x18')]);return _0x16e15f(_0x50e427[_0x3948('0x17')][_0x3948('0x18')]);}else{logger[_0x3948('0x13')](_0x3948('0x14'),_0x3a5aeb,_0x3948('0x15'));_0x16e15f(_0x50e427[_0x3948('0x19')][_0x3948('0x18')]);}})[_0x3948('0x1a')](function(_0x40e92d){logger[_0x3948('0x17')](_0x3948('0x14'),_0x3a5aeb,_0x40e92d);_0x5440a8(_0x40e92d);});});}exports[_0x3948('0x1b')]=function(_0x4026a2){var _0x3a3ed5=this;return new Promise(function(_0x1b4429,_0x3faac1){return db[_0x3948('0x1c')][_0x3948('0x1d')]({'raw':_0x4026a2['options']?_0x4026a2['options'][_0x3948('0x1e')]===undefined?!![]:![]:!![],'where':_0x4026a2[_0x3948('0x1f')]?_0x4026a2['options'][_0x3948('0x20')]||null:null,'attributes':_0x4026a2[_0x3948('0x1f')]?_0x4026a2[_0x3948('0x1f')][_0x3948('0x21')]||null:null,'include':_0x4026a2['options']?_0x4026a2[_0x3948('0x1f')][_0x3948('0x22')]?_[_0x3948('0x23')](_0x4026a2[_0x3948('0x1f')]['include'],function(_0x131645){return{'model':db[_0x131645[_0x3948('0x24')]],'as':_0x131645['as'],'attributes':_0x131645[_0x3948('0x21')],'include':_0x131645[_0x3948('0x22')]?_['map'](_0x131645[_0x3948('0x22')],function(_0x3e3df6){return{'model':db[_0x3e3df6[_0x3948('0x24')]],'as':_0x3e3df6['as'],'attributes':_0x3e3df6[_0x3948('0x21')],'include':_0x3e3df6[_0x3948('0x22')]?_[_0x3948('0x23')](_0x3e3df6[_0x3948('0x22')],function(_0x3ffa8b){return{'model':db[_0x3ffa8b[_0x3948('0x24')]],'as':_0x3ffa8b['as'],'attributes':_0x3ffa8b[_0x3948('0x21')]};}):[]};}):[]};}):[]:[]})[_0x3948('0x12')](function(_0x174c72){logger['info'](_0x3948('0x1b'),_0x4026a2);logger[_0x3948('0x25')]('ShowWhatsappAccount',_0x4026a2,JSON['stringify'](_0x174c72));_0x1b4429(_0x174c72);})['catch'](function(_0x580c43){logger[_0x3948('0x17')](_0x3948('0x1b'),_0x580c43[_0x3948('0x18')],_0x4026a2);_0x3faac1(_0x3a3ed5[_0x3948('0x17')](0x1f4,_0x580c43['message']));});});}; \ No newline at end of file +var _0xb264=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','attributes','include','map','model','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5b7827,_0x3b0cb1){var _0x1a0847=function(_0x2f5ef4){while(--_0x2f5ef4){_0x5b7827['push'](_0x5b7827['shift']());}};_0x1a0847(++_0x3b0cb1);}(_0xb264,0x108));var _0x4b26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb264[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4b26('0x0'));var util=require(_0x4b26('0x1'));var moment=require('moment');var BPromise=require(_0x4b26('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b26('0x3'))['db'];var utils=require(_0x4b26('0x4'));var logger=require(_0x4b26('0x5'))(_0x4b26('0x6'));var config=require(_0x4b26('0x7'));var jayson=require(_0x4b26('0x8'));var client=jayson[_0x4b26('0x9')]['http']({'port':0x232a});config[_0x4b26('0xa')]=_[_0x4b26('0xb')](config['redis'],{'host':_0x4b26('0xc'),'port':0x18eb});var socket=require(_0x4b26('0xd'))(new Redis(config[_0x4b26('0xa')]));require('./whatsappAccount.socket')[_0x4b26('0xe')](socket);function respondWithRpcPromise(_0x408822,_0x1418fe,_0x2d1be3){return new BPromise(function(_0x467589,_0x59fd0f){return client[_0x4b26('0xf')](_0x408822,_0x2d1be3)['then'](function(_0x2cad54){logger[_0x4b26('0x10')](_0x4b26('0x11'),_0x1418fe,_0x4b26('0x12'));logger[_0x4b26('0x13')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1418fe,_0x4b26('0x12'),JSON[_0x4b26('0x14')](_0x2cad54));if(_0x2cad54['error']){if(_0x2cad54['error'][_0x4b26('0x15')]===0x1f4){logger['error'](_0x4b26('0x11'),_0x1418fe,_0x2cad54[_0x4b26('0x16')][_0x4b26('0x17')]);return _0x59fd0f(_0x2cad54['error'][_0x4b26('0x17')]);}logger[_0x4b26('0x16')](_0x4b26('0x11'),_0x1418fe,_0x2cad54[_0x4b26('0x16')][_0x4b26('0x17')]);return _0x467589(_0x2cad54[_0x4b26('0x16')][_0x4b26('0x17')]);}else{logger[_0x4b26('0x10')](_0x4b26('0x11'),_0x1418fe,_0x4b26('0x12'));_0x467589(_0x2cad54[_0x4b26('0x18')]['message']);}})[_0x4b26('0x19')](function(_0x592ddb){logger['error'](_0x4b26('0x11'),_0x1418fe,_0x592ddb);_0x59fd0f(_0x592ddb);});});}exports[_0x4b26('0x1a')]=function(_0x382761){var _0x166cac=this;return new Promise(function(_0x501849,_0xe5f818){return db[_0x4b26('0x1b')][_0x4b26('0x1c')]({'raw':_0x382761[_0x4b26('0x1d')]?_0x382761['options']['raw']===undefined?!![]:![]:!![],'where':_0x382761[_0x4b26('0x1d')]?_0x382761[_0x4b26('0x1d')]['where']||null:null,'attributes':_0x382761[_0x4b26('0x1d')]?_0x382761[_0x4b26('0x1d')][_0x4b26('0x1e')]||null:null,'include':_0x382761[_0x4b26('0x1d')]?_0x382761[_0x4b26('0x1d')][_0x4b26('0x1f')]?_[_0x4b26('0x20')](_0x382761[_0x4b26('0x1d')][_0x4b26('0x1f')],function(_0x3dc821){return{'model':db[_0x3dc821[_0x4b26('0x21')]],'as':_0x3dc821['as'],'attributes':_0x3dc821[_0x4b26('0x1e')],'include':_0x3dc821[_0x4b26('0x1f')]?_[_0x4b26('0x20')](_0x3dc821['include'],function(_0x5914e2){return{'model':db[_0x5914e2['model']],'as':_0x5914e2['as'],'attributes':_0x5914e2[_0x4b26('0x1e')],'include':_0x5914e2[_0x4b26('0x1f')]?_['map'](_0x5914e2[_0x4b26('0x1f')],function(_0x56eb81){return{'model':db[_0x56eb81[_0x4b26('0x21')]],'as':_0x56eb81['as'],'attributes':_0x56eb81[_0x4b26('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x514874){logger[_0x4b26('0x10')](_0x4b26('0x1a'),_0x382761);logger['debug'](_0x4b26('0x1a'),_0x382761,JSON[_0x4b26('0x14')](_0x514874));_0x501849(_0x514874);})[_0x4b26('0x19')](function(_0x23f45e){logger[_0x4b26('0x16')](_0x4b26('0x1a'),_0x23f45e['message'],_0x382761);_0xe5f818(_0x166cac[_0x4b26('0x16')](0x1f4,_0x23f45e[_0x4b26('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index fd80642..bc5192d 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 _0xa048=['removeListener','length','whatsappAccount:','./whatsappAccount.events','remove','update'];(function(_0x32f26d,_0x2c0b5d){var _0x5d9ddc=function(_0x1f0e26){while(--_0x1f0e26){_0x32f26d['push'](_0x32f26d['shift']());}};_0x5d9ddc(++_0x2c0b5d);}(_0xa048,0x16b));var _0x8a04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa048[_0x20a584];return _0x4b41a8;};'use strict';var WhatsappAccountEvents=require(_0x8a04('0x0'));var events=['save',_0x8a04('0x1'),_0x8a04('0x2')];function createListener(_0x38f7cd,_0x5761ee){return function(_0x407b7f){_0x5761ee['emit'](_0x38f7cd,_0x407b7f);};}function removeListener(_0x2d3e97,_0x34940c){return function(){WhatsappAccountEvents[_0x8a04('0x3')](_0x2d3e97,_0x34940c);};}exports['register']=function(_0x54205b){for(var _0xea2fd8=0x0,_0x10b3e1=events[_0x8a04('0x4')];_0xea2fd8<_0x10b3e1;_0xea2fd8++){var _0x4a2604=events[_0xea2fd8];var _0x59f4c4=createListener(_0x8a04('0x5')+_0x4a2604,_0x54205b);WhatsappAccountEvents['on'](_0x4a2604,_0x59f4c4);}}; \ No newline at end of file +var _0xfbc3=['emit','removeListener','length','whatsappAccount:','./whatsappAccount.events','save','update'];(function(_0x548dff,_0x4d066a){var _0x1725b5=function(_0x3f906b){while(--_0x3f906b){_0x548dff['push'](_0x548dff['shift']());}};_0x1725b5(++_0x4d066a);}(_0xfbc3,0x185));var _0x3fbc=function(_0xcc21c1,_0x31fb52){_0xcc21c1=_0xcc21c1-0x0;var _0x31a5f4=_0xfbc3[_0xcc21c1];return _0x31a5f4;};'use strict';var WhatsappAccountEvents=require(_0x3fbc('0x0'));var events=[_0x3fbc('0x1'),'remove',_0x3fbc('0x2')];function createListener(_0x300aaa,_0x47e62a){return function(_0x428ccb){_0x47e62a[_0x3fbc('0x3')](_0x300aaa,_0x428ccb);};}function removeListener(_0x5d9f6b,_0x2ff36a){return function(){WhatsappAccountEvents[_0x3fbc('0x4')](_0x5d9f6b,_0x2ff36a);};}exports['register']=function(_0x5dc6b4){for(var _0x35b8ae=0x0,_0x349046=events[_0x3fbc('0x5')];_0x35b8ae<_0x349046;_0x35b8ae++){var _0x50ac80=events[_0x35b8ae];var _0x3addff=createListener(_0x3fbc('0x6')+_0x50ac80,_0x5dc6b4);WhatsappAccountEvents['on'](_0x50ac80,_0x3addff);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index b5b5917..99d3b31 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 _0x0e87=['update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','create','put'];(function(_0x17022b,_0xd36714){var _0xd620d1=function(_0x1b7b88){while(--_0x1b7b88){_0x17022b['push'](_0x17022b['shift']());}};_0xd620d1(++_0xd36714);}(_0x0e87,0x7c));var _0x70e8=function(_0x5c1866,_0x1fa128){_0x5c1866=_0x5c1866-0x0;var _0x4daff7=_0x0e87[_0x5c1866];return _0x4daff7;};'use strict';var multer=require(_0x70e8('0x0'));var util=require(_0x70e8('0x1'));var path=require(_0x70e8('0x2'));var timeout=require('connect-timeout');var express=require(_0x70e8('0x3'));var router=express[_0x70e8('0x4')]();var auth=require(_0x70e8('0x5'));var interaction=require(_0x70e8('0x6'));var config=require(_0x70e8('0x7'));var controller=require(_0x70e8('0x8'));router[_0x70e8('0x9')]('/',auth[_0x70e8('0xa')](),controller[_0x70e8('0xb')]);router['get'](_0x70e8('0xc'),auth['isAuthenticated'](),controller[_0x70e8('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x70e8('0xe')]);router[_0x70e8('0xf')](_0x70e8('0xc'),auth[_0x70e8('0xa')](),controller[_0x70e8('0x10')]);router[_0x70e8('0x11')](_0x70e8('0xc'),auth[_0x70e8('0xa')](),controller[_0x70e8('0x12')]);module[_0x70e8('0x13')]=router; \ No newline at end of file +var _0xf870=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x2c8b1c,_0xe97206){var _0x13ff00=function(_0x234534){while(--_0x234534){_0x2c8b1c['push'](_0x2c8b1c['shift']());}};_0x13ff00(++_0xe97206);}(_0xf870,0xe6));var _0x0f87=function(_0x2b9757,_0x152cfb){_0x2b9757=_0x2b9757-0x0;var _0x8fef98=_0xf870[_0x2b9757];return _0x8fef98;};'use strict';var multer=require('multer');var util=require(_0x0f87('0x0'));var path=require('path');var timeout=require(_0x0f87('0x1'));var express=require(_0x0f87('0x2'));var router=express[_0x0f87('0x3')]();var auth=require(_0x0f87('0x4'));var interaction=require(_0x0f87('0x5'));var config=require(_0x0f87('0x6'));var controller=require(_0x0f87('0x7'));router[_0x0f87('0x8')]('/',auth[_0x0f87('0x9')](),controller[_0x0f87('0xa')]);router[_0x0f87('0x8')](_0x0f87('0xb'),auth['isAuthenticated'](),controller[_0x0f87('0xc')]);router['post']('/',auth[_0x0f87('0x9')](),controller[_0x0f87('0xd')]);router[_0x0f87('0xe')](_0x0f87('0xb'),auth[_0x0f87('0x9')](),controller['update']);router[_0x0f87('0xf')](_0x0f87('0xb'),auth['isAuthenticated'](),controller[_0x0f87('0x10')]);module[_0x0f87('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 9f3c1c7..3dd99eb 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 _0xeaf0=['noop','TEXT','*,*,*,*','sequelize','STRING'];(function(_0xfd24a8,_0x215709){var _0x22c695=function(_0x4dbc41){while(--_0x4dbc41){_0xfd24a8['push'](_0xfd24a8['shift']());}};_0x22c695(++_0x215709);}(_0xeaf0,0xfd));var _0x0eaf=function(_0x5e1c8a,_0x572954){_0x5e1c8a=_0x5e1c8a-0x0;var _0x5817b6=_0xeaf0[_0x5e1c8a];return _0x5817b6;};'use strict';var Sequelize=require(_0x0eaf('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0eaf('0x1')],'allowNull':![],'defaultValue':_0x0eaf('0x2')},'appdata':{'type':Sequelize[_0x0eaf('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0eaf('0x1')],'defaultValue':_0x0eaf('0x4')}}; \ No newline at end of file +var _0x06fc=['INTEGER','noop','TEXT','STRING','sequelize'];(function(_0x37a79c,_0x2b19f0){var _0x561d89=function(_0x19bee3){while(--_0x19bee3){_0x37a79c['push'](_0x37a79c['shift']());}};_0x561d89(++_0x2b19f0);}(_0x06fc,0x1b2));var _0xc06f=function(_0x4bb70f,_0x5370dc){_0x4bb70f=_0x4bb70f-0x0;var _0x5cf320=_0x06fc[_0x4bb70f];return _0x5cf320;};'use strict';var Sequelize=require(_0xc06f('0x0'));module['exports']={'priority':{'type':Sequelize[_0xc06f('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc06f('0x2')},'appdata':{'type':Sequelize[_0xc06f('0x3')]()},'description':{'type':Sequelize[_0xc06f('0x4')]},'interval':{'type':Sequelize[_0xc06f('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index f9b110e..f82a478 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 _0x11f1=['find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/license/util','end','json','count','offset','limit','status','Content-Range','apply','reject','update','then','sendStatus','error','name','send','WhatsappApplication','fieldName','type','key','model','map','query','filters','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','include','options'];(function(_0x55f867,_0x378f00){var _0x4742e3=function(_0x2dae7e){while(--_0x2dae7e){_0x55f867['push'](_0x55f867['shift']());}};_0x4742e3(++_0x378f00);}(_0x11f1,0x157));var _0x111f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x11f1[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x111f('0x0'));var rimraf=require(_0x111f('0x1'));var zipdir=require(_0x111f('0x2'));var jsonpatch=require(_0x111f('0x3'));var rp=require(_0x111f('0x4'));var moment=require(_0x111f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x111f('0x6'));var util=require(_0x111f('0x7'));var path=require(_0x111f('0x8'));var sox=require(_0x111f('0x9'));var csv=require(_0x111f('0xa'));var ejs=require(_0x111f('0xb'));var fs=require('fs');var _=require(_0x111f('0xc'));var squel=require(_0x111f('0xd'));var crypto=require(_0x111f('0xe'));var jsforce=require(_0x111f('0xf'));var deskjs=require(_0x111f('0x10'));var toCsv=require(_0x111f('0xa'));var querystring=require(_0x111f('0x11'));var Papa=require(_0x111f('0x12'));var Redis=require(_0x111f('0x13'));var authService=require(_0x111f('0x14'));var qs=require(_0x111f('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x111f('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x111f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x556f20,_0x50e81f){_0x50e81f=_0x50e81f||0xcc;return function(_0x8b7e1d){if(_0x8b7e1d){return _0x556f20['sendStatus'](_0x50e81f);}return _0x556f20['status'](_0x50e81f)[_0x111f('0x18')]();};}function respondWithResult(_0x2edeb6,_0x4c78b8){_0x4c78b8=_0x4c78b8||0xc8;return function(_0x373da0){if(_0x373da0){return _0x2edeb6['status'](_0x4c78b8)[_0x111f('0x19')](_0x373da0);}};}function respondWithFilteredResult(_0x56ed22,_0x1437a5){return function(_0x111da0){if(_0x111da0){var _0x4513ca=_0x111da0[_0x111f('0x1a')],_0xa0a199=_0x1437a5[_0x111f('0x1b')],_0x2013f0=_0x1437a5['offset']+_0x1437a5[_0x111f('0x1c')],_0x4a359f;if(_0x2013f0>=_0x4513ca){_0x2013f0=_0x4513ca;_0x4a359f=0xc8;}else{_0x4a359f=0xce;}_0x56ed22[_0x111f('0x1d')](_0x4a359f);return _0x56ed22['set'](_0x111f('0x1e'),_0xa0a199+'-'+_0x2013f0+'/'+_0x4513ca)[_0x111f('0x19')](_0x111da0);}return null;};}function patchUpdates(_0x110474){return function(_0x100105){try{jsonpatch[_0x111f('0x1f')](_0x100105,_0x110474,!![]);}catch(_0x1542ee){return BPromise[_0x111f('0x20')](_0x1542ee);}return _0x100105['save']();};}function saveUpdates(_0x306401,_0x50607b){return function(_0x45ccd8){if(_0x45ccd8){return _0x45ccd8[_0x111f('0x21')](_0x306401)['then'](function(_0x918e21){return _0x918e21;});}return null;};}function removeEntity(_0x46358b,_0xbf8d2e){return function(_0x1dd701){if(_0x1dd701){return _0x1dd701['destroy']()[_0x111f('0x22')](function(){_0x46358b[_0x111f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58b085,_0x2fd51a){return function(_0x5c33b0){if(!_0x5c33b0){_0x58b085[_0x111f('0x23')](0x194);}return _0x5c33b0;};}function handleError(_0x9baaf1,_0x4b2b49){_0x4b2b49=_0x4b2b49||0x1f4;return function(_0x55f7f9){logger[_0x111f('0x24')](_0x55f7f9['stack']);if(_0x55f7f9[_0x111f('0x25')]){delete _0x55f7f9[_0x111f('0x25')];}_0x9baaf1[_0x111f('0x1d')](_0x4b2b49)[_0x111f('0x26')](_0x55f7f9);};}exports['index']=function(_0x5549f4,_0x116bfd){var _0x5689f3={},_0x5a7842={},_0x2589fe={'count':0x0,'rows':[]};var _0x334f65=_['map'](db[_0x111f('0x27')]['rawAttributes'],function(_0x1c3498){return{'name':_0x1c3498[_0x111f('0x28')],'type':_0x1c3498[_0x111f('0x29')][_0x111f('0x2a')]};});_0x5a7842[_0x111f('0x2b')]=_[_0x111f('0x2c')](_0x334f65,'name');_0x5a7842[_0x111f('0x2d')]=_['keys'](_0x5549f4['query']);_0x5a7842[_0x111f('0x2e')]=_['intersection'](_0x5a7842[_0x111f('0x2b')],_0x5a7842['query']);_0x5689f3[_0x111f('0x2f')]=_['intersection'](_0x5a7842[_0x111f('0x2b')],qs[_0x111f('0x30')](_0x5549f4[_0x111f('0x2d')][_0x111f('0x30')]));_0x5689f3[_0x111f('0x2f')]=_0x5689f3[_0x111f('0x2f')][_0x111f('0x31')]?_0x5689f3[_0x111f('0x2f')]:_0x5a7842[_0x111f('0x2b')];if(!_0x5549f4['query']['hasOwnProperty'](_0x111f('0x32'))){_0x5689f3['limit']=qs[_0x111f('0x1c')](_0x5549f4[_0x111f('0x2d')][_0x111f('0x1c')]);_0x5689f3[_0x111f('0x1b')]=qs[_0x111f('0x1b')](_0x5549f4[_0x111f('0x2d')][_0x111f('0x1b')]);}_0x5689f3[_0x111f('0x33')]=qs[_0x111f('0x34')](_0x5549f4['query'][_0x111f('0x34')]);_0x5689f3['where']=qs['filters'](_['pick'](_0x5549f4[_0x111f('0x2d')],_0x5a7842[_0x111f('0x2e')]),_0x334f65);if(_0x5549f4[_0x111f('0x2d')]['filter']){_0x5689f3[_0x111f('0x35')]=_[_0x111f('0x36')](_0x5689f3[_0x111f('0x35')],{'$or':_[_0x111f('0x2c')](_0x334f65,function(_0x747fb3){if(_0x747fb3[_0x111f('0x29')]!==_0x111f('0x37')){var _0x5d6868={};_0x5d6868[_0x747fb3[_0x111f('0x25')]]={'$like':'%'+_0x5549f4[_0x111f('0x2d')]['filter']+'%'};return _0x5d6868;}})});}_0x5689f3=_['merge']({},_0x5689f3,_0x5549f4['options']);var _0x5787ba={'where':_0x5689f3[_0x111f('0x35')]};return db[_0x111f('0x27')][_0x111f('0x1a')](_0x5787ba)[_0x111f('0x22')](function(_0x325a55){_0x2589fe[_0x111f('0x1a')]=_0x325a55;if(_0x5549f4[_0x111f('0x2d')][_0x111f('0x38')]){_0x5689f3['include']=[{'all':!![]}];}return db[_0x111f('0x27')][_0x111f('0x39')](_0x5689f3);})[_0x111f('0x22')](function(_0x1e356b){_0x2589fe[_0x111f('0x3a')]=_0x1e356b;return _0x2589fe;})['then'](respondWithFilteredResult(_0x116bfd,_0x5689f3))[_0x111f('0x3b')](handleError(_0x116bfd,null));};exports[_0x111f('0x3c')]=function(_0x1bf62b,_0xb23f6b){var _0x5f2f7a={'raw':!![],'where':{'id':_0x1bf62b[_0x111f('0x3d')]['id']}},_0x5f3cad={};_0x5f3cad[_0x111f('0x2b')]=_[_0x111f('0x3e')](db[_0x111f('0x27')]['rawAttributes']);_0x5f3cad[_0x111f('0x2d')]=_['keys'](_0x1bf62b[_0x111f('0x2d')]);_0x5f3cad['filters']=_['intersection'](_0x5f3cad['model'],_0x5f3cad[_0x111f('0x2d')]);_0x5f2f7a[_0x111f('0x2f')]=_['intersection'](_0x5f3cad[_0x111f('0x2b')],qs[_0x111f('0x30')](_0x1bf62b[_0x111f('0x2d')][_0x111f('0x30')]));_0x5f2f7a[_0x111f('0x2f')]=_0x5f2f7a[_0x111f('0x2f')][_0x111f('0x31')]?_0x5f2f7a[_0x111f('0x2f')]:_0x5f3cad[_0x111f('0x2b')];if(_0x1bf62b[_0x111f('0x2d')][_0x111f('0x38')]){_0x5f2f7a[_0x111f('0x3f')]=[{'all':!![]}];}_0x5f2f7a=_[_0x111f('0x36')]({},_0x5f2f7a,_0x1bf62b[_0x111f('0x40')]);return db['WhatsappApplication'][_0x111f('0x41')](_0x5f2f7a)[_0x111f('0x22')](handleEntityNotFound(_0xb23f6b,null))[_0x111f('0x22')](respondWithResult(_0xb23f6b,null))[_0x111f('0x3b')](handleError(_0xb23f6b,null));};exports[_0x111f('0x42')]=function(_0x5564ba,_0x52de9d){return db['WhatsappApplication'][_0x111f('0x42')](_0x5564ba[_0x111f('0x43')],{})[_0x111f('0x22')](respondWithResult(_0x52de9d,0xc9))[_0x111f('0x3b')](handleError(_0x52de9d,null));};exports['update']=function(_0x4e49be,_0x280a3c){if(_0x4e49be[_0x111f('0x43')]['id']){delete _0x4e49be['body']['id'];}return db['WhatsappApplication'][_0x111f('0x41')]({'where':{'id':_0x4e49be[_0x111f('0x3d')]['id']}})['then'](handleEntityNotFound(_0x280a3c,null))[_0x111f('0x22')](saveUpdates(_0x4e49be[_0x111f('0x43')],null))[_0x111f('0x22')](respondWithResult(_0x280a3c,null))[_0x111f('0x3b')](handleError(_0x280a3c,null));};exports['destroy']=function(_0x303850,_0x58b08f){return db['WhatsappApplication'][_0x111f('0x41')]({'where':{'id':_0x303850[_0x111f('0x3d')]['id']}})[_0x111f('0x22')](handleEntityNotFound(_0x58b08f,null))[_0x111f('0x22')](removeEntity(_0x58b08f,null))[_0x111f('0x3b')](handleError(_0x58b08f,null));}; \ No newline at end of file +var _0x6202=['filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','WhatsappApplication','findAll','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','type','key','model','query','keys'];(function(_0x114d1f,_0x55548e){var _0x5b91d4=function(_0x358415){while(--_0x358415){_0x114d1f['push'](_0x114d1f['shift']());}};_0x5b91d4(++_0x55548e);}(_0x6202,0xad));var _0x2620=function(_0x3c504b,_0x437693){_0x3c504b=_0x3c504b-0x0;var _0x2e5354=_0x6202[_0x3c504b];return _0x2e5354;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2620('0x0'));var rimraf=require(_0x2620('0x1'));var zipdir=require(_0x2620('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2620('0x3'));var BPromise=require(_0x2620('0x4'));var Mustache=require(_0x2620('0x5'));var util=require(_0x2620('0x6'));var path=require(_0x2620('0x7'));var sox=require(_0x2620('0x8'));var csv=require(_0x2620('0x9'));var ejs=require(_0x2620('0xa'));var fs=require('fs');var _=require(_0x2620('0xb'));var squel=require(_0x2620('0xc'));var crypto=require(_0x2620('0xd'));var jsforce=require(_0x2620('0xe'));var deskjs=require(_0x2620('0xf'));var toCsv=require(_0x2620('0x9'));var querystring=require(_0x2620('0x10'));var Papa=require(_0x2620('0x11'));var Redis=require(_0x2620('0x12'));var authService=require(_0x2620('0x13'));var qs=require(_0x2620('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2620('0x15'));var logger=require(_0x2620('0x16'))('api');var utils=require(_0x2620('0x17'));var config=require(_0x2620('0x18'));var licenseUtil=require(_0x2620('0x19'));var db=require(_0x2620('0x1a'))['db'];function respondWithStatusCode(_0x3bdf19,_0x12491d){_0x12491d=_0x12491d||0xcc;return function(_0xdf2670){if(_0xdf2670){return _0x3bdf19[_0x2620('0x1b')](_0x12491d);}return _0x3bdf19[_0x2620('0x1c')](_0x12491d)[_0x2620('0x1d')]();};}function respondWithResult(_0x495464,_0x474ec2){_0x474ec2=_0x474ec2||0xc8;return function(_0x52729f){if(_0x52729f){return _0x495464[_0x2620('0x1c')](_0x474ec2)[_0x2620('0x1e')](_0x52729f);}};}function respondWithFilteredResult(_0x33b82e,_0x2afb04){return function(_0x36d683){if(_0x36d683){var _0xc3fc68=_0x36d683[_0x2620('0x1f')],_0x4908da=_0x2afb04[_0x2620('0x20')],_0xbd6534=_0x2afb04['offset']+_0x2afb04[_0x2620('0x21')],_0x4febbb;if(_0xbd6534>=_0xc3fc68){_0xbd6534=_0xc3fc68;_0x4febbb=0xc8;}else{_0x4febbb=0xce;}_0x33b82e[_0x2620('0x1c')](_0x4febbb);return _0x33b82e[_0x2620('0x22')](_0x2620('0x23'),_0x4908da+'-'+_0xbd6534+'/'+_0xc3fc68)[_0x2620('0x1e')](_0x36d683);}return null;};}function patchUpdates(_0x2017f8){return function(_0xff7d63){try{jsonpatch[_0x2620('0x24')](_0xff7d63,_0x2017f8,!![]);}catch(_0x2310a2){return BPromise['reject'](_0x2310a2);}return _0xff7d63[_0x2620('0x25')]();};}function saveUpdates(_0x553ebd,_0x26b717){return function(_0x202249){if(_0x202249){return _0x202249[_0x2620('0x26')](_0x553ebd)[_0x2620('0x27')](function(_0xc0fef3){return _0xc0fef3;});}return null;};}function removeEntity(_0x56e078,_0x9cfaa){return function(_0xc3c41){if(_0xc3c41){return _0xc3c41[_0x2620('0x28')]()[_0x2620('0x27')](function(){_0x56e078[_0x2620('0x1c')](0xcc)[_0x2620('0x1d')]();});}};}function handleEntityNotFound(_0x2f5f98,_0x346211){return function(_0x1d3b04){if(!_0x1d3b04){_0x2f5f98[_0x2620('0x1b')](0x194);}return _0x1d3b04;};}function handleError(_0x21e50c,_0x39e275){_0x39e275=_0x39e275||0x1f4;return function(_0x541ee8){logger[_0x2620('0x29')](_0x541ee8[_0x2620('0x2a')]);if(_0x541ee8[_0x2620('0x2b')]){delete _0x541ee8['name'];}_0x21e50c[_0x2620('0x1c')](_0x39e275)[_0x2620('0x2c')](_0x541ee8);};}exports['index']=function(_0x9fdcb8,_0x3cb1d1){var _0x428d0f={},_0x4161ec={},_0x151735={'count':0x0,'rows':[]};var _0x549865=_[_0x2620('0x2d')](db['WhatsappApplication'][_0x2620('0x2e')],function(_0x59ae04){return{'name':_0x59ae04['fieldName'],'type':_0x59ae04[_0x2620('0x2f')][_0x2620('0x30')]};});_0x4161ec[_0x2620('0x31')]=_[_0x2620('0x2d')](_0x549865,_0x2620('0x2b'));_0x4161ec[_0x2620('0x32')]=_[_0x2620('0x33')](_0x9fdcb8[_0x2620('0x32')]);_0x4161ec[_0x2620('0x34')]=_[_0x2620('0x35')](_0x4161ec['model'],_0x4161ec[_0x2620('0x32')]);_0x428d0f[_0x2620('0x36')]=_[_0x2620('0x35')](_0x4161ec[_0x2620('0x31')],qs[_0x2620('0x37')](_0x9fdcb8[_0x2620('0x32')][_0x2620('0x37')]));_0x428d0f[_0x2620('0x36')]=_0x428d0f[_0x2620('0x36')][_0x2620('0x38')]?_0x428d0f[_0x2620('0x36')]:_0x4161ec[_0x2620('0x31')];if(!_0x9fdcb8[_0x2620('0x32')]['hasOwnProperty'](_0x2620('0x39'))){_0x428d0f[_0x2620('0x21')]=qs['limit'](_0x9fdcb8[_0x2620('0x32')][_0x2620('0x21')]);_0x428d0f[_0x2620('0x20')]=qs[_0x2620('0x20')](_0x9fdcb8[_0x2620('0x32')][_0x2620('0x20')]);}_0x428d0f[_0x2620('0x3a')]=qs[_0x2620('0x3b')](_0x9fdcb8[_0x2620('0x32')]['sort']);_0x428d0f[_0x2620('0x3c')]=qs[_0x2620('0x34')](_[_0x2620('0x3d')](_0x9fdcb8[_0x2620('0x32')],_0x4161ec[_0x2620('0x34')]),_0x549865);if(_0x9fdcb8['query'][_0x2620('0x3e')]){_0x428d0f[_0x2620('0x3c')]=_['merge'](_0x428d0f[_0x2620('0x3c')],{'$or':_['map'](_0x549865,function(_0x186aa4){if(_0x186aa4['type']!==_0x2620('0x3f')){var _0x32ca10={};_0x32ca10[_0x186aa4[_0x2620('0x2b')]]={'$like':'%'+_0x9fdcb8[_0x2620('0x32')][_0x2620('0x3e')]+'%'};return _0x32ca10;}})});}_0x428d0f=_[_0x2620('0x40')]({},_0x428d0f,_0x9fdcb8['options']);var _0x3f7e3c={'where':_0x428d0f[_0x2620('0x3c')]};return db['WhatsappApplication']['count'](_0x3f7e3c)[_0x2620('0x27')](function(_0x119d95){_0x151735[_0x2620('0x1f')]=_0x119d95;if(_0x9fdcb8[_0x2620('0x32')][_0x2620('0x41')]){_0x428d0f[_0x2620('0x42')]=[{'all':!![]}];}return db[_0x2620('0x43')][_0x2620('0x44')](_0x428d0f);})[_0x2620('0x27')](function(_0x4dd74c){_0x151735['rows']=_0x4dd74c;return _0x151735;})[_0x2620('0x27')](respondWithFilteredResult(_0x3cb1d1,_0x428d0f))[_0x2620('0x45')](handleError(_0x3cb1d1,null));};exports[_0x2620('0x46')]=function(_0xf5ad61,_0x98a55d){var _0x3f7210={'raw':!![],'where':{'id':_0xf5ad61[_0x2620('0x47')]['id']}},_0x4dce99={};_0x4dce99[_0x2620('0x31')]=_[_0x2620('0x33')](db[_0x2620('0x43')][_0x2620('0x2e')]);_0x4dce99[_0x2620('0x32')]=_[_0x2620('0x33')](_0xf5ad61[_0x2620('0x32')]);_0x4dce99[_0x2620('0x34')]=_[_0x2620('0x35')](_0x4dce99[_0x2620('0x31')],_0x4dce99['query']);_0x3f7210[_0x2620('0x36')]=_['intersection'](_0x4dce99[_0x2620('0x31')],qs['fields'](_0xf5ad61[_0x2620('0x32')]['fields']));_0x3f7210[_0x2620('0x36')]=_0x3f7210['attributes']['length']?_0x3f7210[_0x2620('0x36')]:_0x4dce99[_0x2620('0x31')];if(_0xf5ad61['query'][_0x2620('0x41')]){_0x3f7210['include']=[{'all':!![]}];}_0x3f7210=_[_0x2620('0x40')]({},_0x3f7210,_0xf5ad61['options']);return db['WhatsappApplication'][_0x2620('0x48')](_0x3f7210)[_0x2620('0x27')](handleEntityNotFound(_0x98a55d,null))[_0x2620('0x27')](respondWithResult(_0x98a55d,null))[_0x2620('0x45')](handleError(_0x98a55d,null));};exports['create']=function(_0x2c6292,_0x5af561){return db[_0x2620('0x43')][_0x2620('0x49')](_0x2c6292[_0x2620('0x4a')],{})[_0x2620('0x27')](respondWithResult(_0x5af561,0xc9))['catch'](handleError(_0x5af561,null));};exports[_0x2620('0x26')]=function(_0x2ea95f,_0x2c5679){if(_0x2ea95f[_0x2620('0x4a')]['id']){delete _0x2ea95f[_0x2620('0x4a')]['id'];}return db['WhatsappApplication'][_0x2620('0x48')]({'where':{'id':_0x2ea95f['params']['id']}})[_0x2620('0x27')](handleEntityNotFound(_0x2c5679,null))['then'](saveUpdates(_0x2ea95f['body'],null))['then'](respondWithResult(_0x2c5679,null))['catch'](handleError(_0x2c5679,null));};exports[_0x2620('0x28')]=function(_0x5c2754,_0x12972e){return db[_0x2620('0x43')][_0x2620('0x48')]({'where':{'id':_0x5c2754[_0x2620('0x47')]['id']}})['then'](handleEntityNotFound(_0x12972e,null))[_0x2620('0x27')](removeEntity(_0x12972e,null))[_0x2620('0x45')](handleError(_0x12972e,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 6463947..f14f3ee 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 _0x69c4=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x353995,_0x1c8b51){var _0x21fe70=function(_0x3cf31d){while(--_0x3cf31d){_0x353995['push'](_0x353995['shift']());}};_0x21fe70(++_0x1c8b51);}(_0x69c4,0x6e));var _0x469c=function(_0x235bfd,_0x341c83){_0x235bfd=_0x235bfd-0x0;var _0x4b234a=_0x69c4[_0x235bfd];return _0x4b234a;};'use strict';var _=require(_0x469c('0x0'));var util=require(_0x469c('0x1'));var logger=require(_0x469c('0x2'))(_0x469c('0x3'));var moment=require(_0x469c('0x4'));var BPromise=require(_0x469c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x469c('0x6'));var config=require(_0x469c('0x7'));var attributes=require(_0x469c('0x8'));module[_0x469c('0x9')]=function(_0x285f2e,_0x1bb9af){return _0x285f2e[_0x469c('0xa')](_0x469c('0xb'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x469c('0xc'),'collate':_0x469c('0xd')});}; \ No newline at end of file +var _0xc8b9=['request-promise','path','rimraf','./whatsappApplication.attributes','define','whatsapp_applications','utf8mb4','lodash','util','../../config/logger','bluebird'];(function(_0x5ca52d,_0x3a4a22){var _0x89e54e=function(_0x54bdf4){while(--_0x54bdf4){_0x5ca52d['push'](_0x5ca52d['shift']());}};_0x89e54e(++_0x3a4a22);}(_0xc8b9,0x172));var _0x9c8b=function(_0x92b303,_0x2334a6){_0x92b303=_0x92b303-0x0;var _0x13ad89=_0xc8b9[_0x92b303];return _0x13ad89;};'use strict';var _=require(_0x9c8b('0x0'));var util=require(_0x9c8b('0x1'));var logger=require(_0x9c8b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9c8b('0x3'));var rp=require(_0x9c8b('0x4'));var fs=require('fs');var path=require(_0x9c8b('0x5'));var rimraf=require(_0x9c8b('0x6'));var config=require('../../config/environment');var attributes=require(_0x9c8b('0x7'));module['exports']=function(_0x560010,_0x3b1747){return _0x560010[_0x9c8b('0x8')]('WhatsappApplication',attributes,{'tableName':_0x9c8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9c8b('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 43e7756..4398298 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 _0x979e=['info','WhatsappApplication,\x20%s,\x20%s','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x979e,0x195));var _0xe979=function(_0x15dafa,_0xec8caa){_0x15dafa=_0x15dafa-0x0;var _0x41e2e0=_0x979e[_0x15dafa];return _0x41e2e0;};'use strict';var _=require(_0xe979('0x0'));var util=require(_0xe979('0x1'));var moment=require(_0xe979('0x2'));var BPromise=require(_0xe979('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe979('0x4'));var db=require(_0xe979('0x5'))['db'];var utils=require(_0xe979('0x6'));var logger=require(_0xe979('0x7'))(_0xe979('0x8'));var config=require('../../config/environment');var jayson=require(_0xe979('0x9'));var client=jayson['client'][_0xe979('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13a9ee,_0x441ffe,_0xc63524){return new BPromise(function(_0xc79c06,_0x3bbc32){return client[_0xe979('0xb')](_0x13a9ee,_0xc63524)[_0xe979('0xc')](function(_0x431a91){logger[_0xe979('0xd')](_0xe979('0xe'),_0x441ffe,'request\x20sent');logger[_0xe979('0xf')](_0xe979('0x10'),_0x441ffe,_0xe979('0x11'),JSON['stringify'](_0x431a91));if(_0x431a91[_0xe979('0x12')]){if(_0x431a91[_0xe979('0x12')][_0xe979('0x13')]===0x1f4){logger[_0xe979('0x12')](_0xe979('0xe'),_0x441ffe,_0x431a91[_0xe979('0x12')][_0xe979('0x14')]);return _0x3bbc32(_0x431a91[_0xe979('0x12')]['message']);}logger[_0xe979('0x12')](_0xe979('0xe'),_0x441ffe,_0x431a91[_0xe979('0x12')]['message']);return _0xc79c06(_0x431a91['error'][_0xe979('0x14')]);}else{logger[_0xe979('0xd')](_0xe979('0xe'),_0x441ffe,_0xe979('0x11'));_0xc79c06(_0x431a91['result'][_0xe979('0x14')]);}})[_0xe979('0x15')](function(_0xcb7fa1){logger[_0xe979('0x12')](_0xe979('0xe'),_0x441ffe,_0xcb7fa1);_0x3bbc32(_0xcb7fa1);});});} \ No newline at end of file +var _0x9f02=['request\x20sent','result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','debug','error','message','WhatsappApplication,\x20%s,\x20%s'];(function(_0x54b6e4,_0xfd3201){var _0x5299f3=function(_0x455b20){while(--_0x455b20){_0x54b6e4['push'](_0x54b6e4['shift']());}};_0x5299f3(++_0xfd3201);}(_0x9f02,0x68));var _0x29f0=function(_0x42a12e,_0x299187){_0x42a12e=_0x42a12e-0x0;var _0x5e5e9e=_0x9f02[_0x42a12e];return _0x5e5e9e;};'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')]('WhatsappApplication,\x20%s,\x20%s',_0x53d629,'request\x20sent');logger[_0x29f0('0xb')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x53d629,'request\x20sent',JSON['stringify'](_0x232592));if(_0x232592['error']){if(_0x232592[_0x29f0('0xc')]['code']===0x1f4){logger[_0x29f0('0xc')]('WhatsappApplication,\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')]('WhatsappApplication,\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 diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index dd321ff..43f7be8 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 _0x5e78=['multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','update','/:id','whatsappinteraction:destroy','destroy','delete','exports'];(function(_0x3a06dd,_0x26115c){var _0x5a36a6=function(_0xadc344){while(--_0xadc344){_0x3a06dd['push'](_0x3a06dd['shift']());}};_0x5a36a6(++_0x26115c);}(_0x5e78,0x91));var _0x85e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e78[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x85e7('0x0'));var util=require(_0x85e7('0x1'));var path=require('path');var timeout=require(_0x85e7('0x2'));var express=require(_0x85e7('0x3'));var router=express['Router']();var auth=require(_0x85e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x85e7('0x5'));var controller=require(_0x85e7('0x6'));router[_0x85e7('0x7')]('/',auth[_0x85e7('0x8')](),controller[_0x85e7('0x9')]);router[_0x85e7('0x7')](_0x85e7('0xa'),auth[_0x85e7('0x8')](),controller[_0x85e7('0xb')]);router['get']('/:id',auth[_0x85e7('0x8')](),controller[_0x85e7('0xc')]);router['get']('/:id/messages',auth[_0x85e7('0x8')](),controller['getMessages']);router[_0x85e7('0x7')](_0x85e7('0xd'),auth['isAuthenticated'](),controller[_0x85e7('0xe')]);router[_0x85e7('0xf')]('/',auth[_0x85e7('0x8')](),controller['create']);router[_0x85e7('0xf')]('/:id/messages',auth[_0x85e7('0x8')](),controller[_0x85e7('0x10')]);router[_0x85e7('0xf')](_0x85e7('0x11'),auth[_0x85e7('0x8')](),interaction[_0x85e7('0x12')](_0x85e7('0x13'),_0x85e7('0x14')),controller['addTags']);router[_0x85e7('0x15')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x85e7('0x13'),_0x85e7('0x16')),controller[_0x85e7('0x17')]);router['delete'](_0x85e7('0x18'),auth['isAuthenticated'](),interaction[_0x85e7('0x12')](_0x85e7('0x13'),_0x85e7('0x19')),controller[_0x85e7('0x1a')]);router[_0x85e7('0x1b')](_0x85e7('0x11'),auth[_0x85e7('0x8')](),controller['removeTags']);module[_0x85e7('0x1c')]=router; \ No newline at end of file +var _0xfaea=['show','/:id/messages','getMessages','/:id/download','download','post','create','tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xfaea,0x1e3));var _0xafae=function(_0xf7f60a,_0x15f736){_0xf7f60a=_0xf7f60a-0x0;var _0x2567ad=_0xfaea[_0xf7f60a];return _0x2567ad;};'use strict';var multer=require(_0xafae('0x0'));var util=require(_0xafae('0x1'));var path=require(_0xafae('0x2'));var timeout=require('connect-timeout');var express=require(_0xafae('0x3'));var router=express[_0xafae('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xafae('0x5'));var config=require(_0xafae('0x6'));var controller=require('./whatsappInteraction.controller');router[_0xafae('0x7')]('/',auth[_0xafae('0x8')](),controller[_0xafae('0x9')]);router[_0xafae('0x7')](_0xafae('0xa'),auth[_0xafae('0x8')](),controller[_0xafae('0xb')]);router[_0xafae('0x7')](_0xafae('0xc'),auth['isAuthenticated'](),controller[_0xafae('0xd')]);router[_0xafae('0x7')](_0xafae('0xe'),auth[_0xafae('0x8')](),controller[_0xafae('0xf')]);router['get'](_0xafae('0x10'),auth[_0xafae('0x8')](),controller[_0xafae('0x11')]);router[_0xafae('0x12')]('/',auth[_0xafae('0x8')](),controller[_0xafae('0x13')]);router[_0xafae('0x12')](_0xafae('0xe'),auth[_0xafae('0x8')](),controller['addMessage']);router[_0xafae('0x12')]('/:id/tags',auth[_0xafae('0x8')](),interaction[_0xafae('0x14')](_0xafae('0x15'),_0xafae('0x16')),controller['addTags']);router[_0xafae('0x17')](_0xafae('0xc'),auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0xafae('0x18')),controller[_0xafae('0x19')]);router[_0xafae('0x1a')](_0xafae('0xc'),auth[_0xafae('0x8')](),interaction[_0xafae('0x14')](_0xafae('0x15'),_0xafae('0x1b')),controller[_0xafae('0x1c')]);router['delete'](_0xafae('0x1d'),auth[_0xafae('0x8')](),controller[_0xafae('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 821fd30..4cfe835 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 _0xdcb9=['exports','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0x10b364,_0x425c77){var _0x194772=function(_0x4847a3){while(--_0x4847a3){_0x10b364['push'](_0x10b364['shift']());}};_0x194772(++_0x425c77);}(_0xdcb9,0xa7));var _0x9dcb=function(_0x74a268,_0x1c07d6){_0x74a268=_0x74a268-0x0;var _0x3ad88e=_0xdcb9[_0x74a268];return _0x3ad88e;};'use strict';var Sequelize=require(_0x9dcb('0x0'));var moment=require('moment');module[_0x9dcb('0x1')]={'closed':{'type':Sequelize[_0x9dcb('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x9dcb('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x9dcb('0x3')]},'read1stAt':{'type':Sequelize[_0x9dcb('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x9dcb('0x5')]('in',_0x9dcb('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x9dcb('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xa866=['ENUM','out','sequelize','moment','exports','BOOLEAN','DATE','STRING'];(function(_0x5f553a,_0x772251){var _0x429169=function(_0x39d91f){while(--_0x39d91f){_0x5f553a['push'](_0x5f553a['shift']());}};_0x429169(++_0x772251);}(_0xa866,0x6a));var _0x6a86=function(_0x493d61,_0x67f009){_0x493d61=_0x493d61-0x0;var _0x147baa=_0xa866[_0x493d61];return _0x147baa;};'use strict';var Sequelize=require(_0x6a86('0x0'));var moment=require(_0x6a86('0x1'));module[_0x6a86('0x2')]={'closed':{'type':Sequelize[_0x6a86('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6a86('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x6a86('0x5')]},'thirdDisposition':{'type':Sequelize[_0x6a86('0x5')]},'note':{'type':Sequelize[_0x6a86('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x6a86('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x6a86('0x6')]('in',_0x6a86('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6a86('0x6')]('in',_0x6a86('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index ddd2e39..8a18681 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 _0x524e=['\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','all','rows','params','includeAll','include','options','create','update','describe','addMessage','WhatsappMessage','omit','findOne','WhatsappInteractionId','merge','findAll','addTags','setTags','ids','spread','whatsappInteractionTags:save','removeTags','unix','join','root','files','tmp','server','attachments','format','transcript-%d-%s.zip','firstName','lastName','Messages','direction','secret','Account','User','Owner','get','mkdirSync','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','YYYY-MM-DD\x20HH:mm:ss','disposition','Attachment','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','views','toFile','transcript-','.pdf','download','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','Users','map','fullname','Tags','split','push','catch','index','WhatsappInteraction','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','tools_tags','u.id','u.fullname','from','user_has_whatsapp_interactions','users','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','t.id\x20=\x20it.TagId','search','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','type','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x524e,0x15e));var _0xe524=function(_0x57d822,_0x548911){_0x57d822=_0x57d822-0x0;var _0x2ef50f=_0x524e[_0x57d822];return _0x2ef50f;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe524('0x0'));var zipdir=require(_0xe524('0x1'));var jsonpatch=require(_0xe524('0x2'));var rp=require(_0xe524('0x3'));var moment=require(_0xe524('0x4'));var BPromise=require(_0xe524('0x5'));var Mustache=require(_0xe524('0x6'));var util=require(_0xe524('0x7'));var path=require(_0xe524('0x8'));var sox=require(_0xe524('0x9'));var csv=require('to-csv');var ejs=require(_0xe524('0xa'));var fs=require('fs');var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0xf'));var querystring=require(_0xe524('0x10'));var Papa=require(_0xe524('0x11'));var Redis=require(_0xe524('0x12'));var authService=require(_0xe524('0x13'));var qs=require(_0xe524('0x14'));var as=require(_0xe524('0x15'));var hardwareService=require(_0xe524('0x16'));var logger=require(_0xe524('0x17'))(_0xe524('0x18'));var utils=require(_0xe524('0x19'));var config=require(_0xe524('0x1a'));var licenseUtil=require(_0xe524('0x1b'));var db=require(_0xe524('0x1c'))['db'];config['redis']=_['defaults'](config[_0xe524('0x1d')],{'host':_0xe524('0x1e'),'port':0x18eb});var socket=require(_0xe524('0x1f'))(new Redis(config[_0xe524('0x1d')]));require(_0xe524('0x20'))['register'](socket);function respondWithStatusCode(_0x12ff75,_0x51e9fe){_0x51e9fe=_0x51e9fe||0xcc;return function(_0x19f013){if(_0x19f013){return _0x12ff75[_0xe524('0x21')](_0x51e9fe);}return _0x12ff75['status'](_0x51e9fe)[_0xe524('0x22')]();};}function respondWithResult(_0x488fce,_0x109795){_0x109795=_0x109795||0xc8;return function(_0x538754){if(_0x538754){return _0x488fce[_0xe524('0x23')](_0x109795)['json'](_0x538754);}};}function respondWithFilteredResult(_0x5c8736,_0x5a5c0d){return function(_0x3a4027){if(_0x3a4027){var _0x4f1dfb=_0x3a4027[_0xe524('0x24')],_0x11b2a1=_0x5a5c0d['offset'],_0x238f8f=_0x5a5c0d[_0xe524('0x25')]+_0x5a5c0d[_0xe524('0x26')],_0x278de9;if(_0x238f8f>=_0x4f1dfb){_0x238f8f=_0x4f1dfb;_0x278de9=0xc8;}else{_0x278de9=0xce;}_0x5c8736['status'](_0x278de9);return _0x5c8736[_0xe524('0x27')](_0xe524('0x28'),_0x11b2a1+'-'+_0x238f8f+'/'+_0x4f1dfb)[_0xe524('0x29')](_0x3a4027);}return null;};}function patchUpdates(_0x1dcc0f){return function(_0x1c4194){try{jsonpatch[_0xe524('0x2a')](_0x1c4194,_0x1dcc0f,!![]);}catch(_0xbf059b){return BPromise[_0xe524('0x2b')](_0xbf059b);}return _0x1c4194[_0xe524('0x2c')]();};}function saveUpdates(_0x5c4d21,_0x7d1f92){return function(_0x5bb00b){if(_0x5bb00b){return _0x5bb00b['update'](_0x5c4d21)[_0xe524('0x2d')](function(_0x23df5e){return _0x23df5e;});}return null;};}function removeEntity(_0x1ad106,_0x85fc51){return function(_0x599d5d){if(_0x599d5d){return _0x599d5d[_0xe524('0x2e')]()['then'](function(){_0x1ad106[_0xe524('0x23')](0xcc)[_0xe524('0x22')]();});}};}function handleEntityNotFound(_0xd62772,_0x3cd922){return function(_0x4102d9){if(!_0x4102d9){_0xd62772[_0xe524('0x21')](0x194);}return _0x4102d9;};}function handleError(_0x2141db,_0x583cc3){_0x583cc3=_0x583cc3||0x1f4;return function(_0x58a896){logger[_0xe524('0x2f')](_0x58a896[_0xe524('0x30')]);if(_0x58a896[_0xe524('0x31')]){delete _0x58a896[_0xe524('0x31')];}_0x2141db[_0xe524('0x23')](_0x583cc3)['send'](_0x58a896);};}function getInteractionUsers(_0x52f140,_0x4b1ff){return new BPromise(function(_0x25e7a7,_0x3aedd9){try{if(_0x4b1ff[_0x52f140['id']]){_0x52f140[_0xe524('0x32')]=_[_0xe524('0x33')](_0x4b1ff[_0x52f140['id']],function(_0x517fa0){return{'id':_0x517fa0['id'],'fullname':_0x517fa0[_0xe524('0x34')]};});}}catch(_0x9a7e98){_0x3aedd9(_0x9a7e98);}_0x25e7a7(_0x52f140);});}function getInteractionTags(_0x4a4e15,_0x5b7ded){return new BPromise(function(_0x20688e,_0x376324){try{if(_0x4a4e15['TagIds']){_0x4a4e15[_0xe524('0x35')]=[];_0x4a4e15['TagIds'][_0xe524('0x36')](',')['forEach'](function(_0x315e56){_0x4a4e15[_0xe524('0x35')][_0xe524('0x37')](_0x5b7ded[_0x315e56]);});}delete _0x4a4e15['TagIds'];}catch(_0x2e26d9){_0x376324(_0x2e26d9);}_0x20688e(_0x4a4e15);});}function updateWhatsappInteraction(_0x5238c9,_0xdbdf53,_0x16eff9){return new BPromise(function(_0x276343,_0x502256){return getInteractionUsers(_0x5238c9,_0x16eff9)[_0xe524('0x2d')](function(_0x119cc3){return getInteractionTags(_0x119cc3,_0xdbdf53);})['then'](function(_0x27817e){_0x276343(_0x27817e);})[_0xe524('0x38')](function(_0x10408e){_0x502256(_0x10408e);});});}exports[_0xe524('0x39')]=function(_0x53560d,_0x415450){var _0xcf8060={},_0x615b5e={},_0x13cda8={'count':0x0,'rows':[]};var _0x2522cd=_[_0xe524('0x33')](db[_0xe524('0x3a')][_0xe524('0x3b')],function(_0x4db4b7){return{'name':_0x4db4b7[_0xe524('0x3c')],'type':_0x4db4b7['type'][_0xe524('0x3d')]};});_0x615b5e[_0xe524('0x3e')]=_['map'](_0x2522cd,_0xe524('0x31'));_0x615b5e['query']=_[_0xe524('0x3f')](_0x53560d[_0xe524('0x40')]);_0x615b5e[_0xe524('0x41')]=_[_0xe524('0x42')](_0x615b5e[_0xe524('0x3e')],_0x615b5e[_0xe524('0x40')]);_0xcf8060[_0xe524('0x43')]=_[_0xe524('0x42')](_0x615b5e['model'],qs[_0xe524('0x44')](_0x53560d[_0xe524('0x40')][_0xe524('0x44')]));_0xcf8060[_0xe524('0x43')]=_0xcf8060[_0xe524('0x43')][_0xe524('0x45')]?_0xcf8060[_0xe524('0x43')]:_0x615b5e[_0xe524('0x3e')];if(!_0x53560d['query'][_0xe524('0x46')](_0xe524('0x47'))){_0xcf8060[_0xe524('0x26')]=qs['limit'](_0x53560d[_0xe524('0x40')]['limit']);_0xcf8060[_0xe524('0x25')]=qs[_0xe524('0x25')](_0x53560d[_0xe524('0x40')][_0xe524('0x25')]);}_0xcf8060[_0xe524('0x48')]=qs[_0xe524('0x49')](_0x53560d[_0xe524('0x40')]['sort']);_0xcf8060[_0xe524('0x4a')]=qs[_0xe524('0x41')](_[_0xe524('0x4b')](_0x53560d[_0xe524('0x40')],_0x615b5e[_0xe524('0x41')]),_0x2522cd);var _0x1ae283=[];var _0x4a4a16=squel[_0xe524('0x4c')]()[_0xe524('0x4d')]('id')[_0xe524('0x4d')]('name')[_0xe524('0x4d')]('color')['from'](_0xe524('0x4e'));var _0x33906d=squel['select']()[_0xe524('0x4d')](_0xe524('0x4f'))[_0xe524('0x4d')](_0xe524('0x50'))['field']('ui.WhatsappInteractionId')[_0xe524('0x51')](_0xe524('0x52'),'ui')['left_join'](_0xe524('0x53'),'u','u.id\x20=\x20ui.UserId');var _0x472519=squel[_0xe524('0x4c')]()[_0xe524('0x51')](_0xe524('0x54'),'i')[_0xe524('0x55')](_0xe524('0x56'),'c',_0xe524('0x57'))[_0xe524('0x55')](_0xe524('0x53'),'o',_0xe524('0x58'))[_0xe524('0x55')](_0xe524('0x59'),'a',_0xe524('0x5a'))[_0xe524('0x55')](_0xe524('0x5b'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0xe524('0x55')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xe524('0x55')]('tools_tags','t',_0xe524('0x5c'));var _0x15d7ee=squel['expr']();var _0x20753e=[];var _0x5c1655=squel['expr']();var _0x2fa574;if(_0x53560d[_0xe524('0x40')][_0xe524('0x5d')]){_0x2fa574=as['parseSearch'](_0x53560d['query']['search']);var _0x4e9c3b=_0x2fa574['sqlOperator'];for(var _0x5477ca=0x0;_0x5477ca<_0x2fa574[_0xe524('0x5e')][_0xe524('0x45')];_0x5477ca++){var _0x4f5059=_0x2fa574[_0xe524('0x5e')][_0x5477ca];var _0x40b871='i';var _0x254168=_[_0xe524('0x5f')](_0x2522cd,[_0xe524('0x31'),_0x4f5059['field']]);if(!_0x254168){switch(_0x4f5059[_0xe524('0x4d')]){case _0xe524('0x60'):if(_0x4f5059[_0xe524('0x61')]==0x1){_0x472519['having']('`'+_0x4f5059[_0xe524('0x4d')]+'`\x20=\x200');}else{_0x472519[_0xe524('0x62')]('`'+_0x4f5059[_0xe524('0x4d')]+_0xe524('0x63'));}break;case _0xe524('0x64'):if(_0x4f5059[_0xe524('0x65')]===_0xe524('0x66')){if(_0x4f5059[_0xe524('0x61')][_0xe524('0x36')]('\x20')[_0xe524('0x45')]>0x1){_0x15d7ee[_0x4e9c3b](_0xe524('0x67'),qs[_0xe524('0x68')](_0x4f5059[_0xe524('0x61')]),null);}else{var _0x55a855='%'+_0x4f5059['value']+'%';_0x15d7ee[_0x4e9c3b]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x55a855,_0x55a855,_0x55a855);}}else{_0x254168=_[_0xe524('0x5f')](_0x2522cd,[_0xe524('0x31'),_0xe524('0x69')]);_0x4f5059[_0xe524('0x4d')]=_0xe524('0x69');_0x5343b3=as[_0xe524('0x6a')](_0x40b871,_0x254168[_0xe524('0x6b')],_0x4f5059);_0x15d7ee[_0x4e9c3b](_0x5343b3[_0xe524('0x6c')],_0x5343b3[_0xe524('0x61')][_0xe524('0x6d')],_0x5343b3[_0xe524('0x61')]['end']);}break;case _0xe524('0x6e'):var _0x1f0567=_0x4f5059['value']['split'](',')['map'](function(_0x5c4056){return Number(_0x5c4056);});_0x1f0567[_0xe524('0x6f')](function(_0x12dfce){_0x5c1655['or'](_0xe524('0x70'),'%,'+_0x12dfce+',%');});_0x20753e=_[_0xe524('0x71')](_0x20753e,_0x1f0567);break;case'User':if(_0x4f5059[_0xe524('0x65')]===_0xe524('0x66')){_0x15d7ee[_0x4e9c3b](_0xe524('0x72'),'%'+_0x4f5059[_0xe524('0x61')]+'%',null);}else{_0x254168=_['find'](_0x2522cd,['name','UserId']);_0x4f5059[_0xe524('0x4d')]='UserId';_0x5343b3=as[_0xe524('0x6a')](_0x40b871,_0x254168[_0xe524('0x6b')],_0x4f5059);_0x15d7ee[_0x4e9c3b](_0x5343b3[_0xe524('0x6c')],_0x5343b3[_0xe524('0x61')][_0xe524('0x6d')],_0x5343b3['value']['end']);}break;case _0xe524('0x73'):_0x5343b3=as[_0xe524('0x6a')]('me',null,_0x4f5059);_0x15d7ee[_0x4e9c3b](_0x5343b3[_0xe524('0x6c')],_0x5343b3[_0xe524('0x61')][_0xe524('0x6d')],_0x5343b3[_0xe524('0x61')]['end']);break;}}else{var _0x5343b3=as[_0xe524('0x6a')](_0x40b871,_0x254168[_0xe524('0x6b')],_0x4f5059);_0x15d7ee[_0x4e9c3b](_0x5343b3['text'],_0x5343b3[_0xe524('0x61')][_0xe524('0x6d')],_0x5343b3[_0xe524('0x61')]['end']);}}}else{var _0x4d5c19=_(_0x53560d[_0xe524('0x40')])[_0xe524('0x3f')]()[_0xe524('0x33')](function(_0x428b9d){return _[_0xe524('0x74')](_0x2522cd,['name',_0x428b9d])?_0x428b9d:undefined;})[_0xe524('0x75')]()[_0xe524('0x61')]();if(!_[_0xe524('0x76')](_0x4d5c19)){_0x4d5c19[_0xe524('0x6f')](function(_0x3ce098){if(_0x3ce098===_0xe524('0x77')){_0x472519[_0xe524('0x4a')](_0xe524('0x78'),[][_0xe524('0x79')](_0x53560d[_0xe524('0x40')][_0x3ce098]));}else if(_0x3ce098===_0xe524('0x7a')){var _0x4c69e2=JSON[_0xe524('0x7b')](_0x53560d[_0xe524('0x40')][_0x3ce098])[_0xe524('0x7c')];var _0xfed246=JSON[_0xe524('0x7b')](_0x53560d['query'][_0x3ce098])[_0xe524('0x7d')];_0x472519[_0xe524('0x4a')](_0xe524('0x7e'),_0x4c69e2,_0xfed246);}else{if(_0x53560d[_0xe524('0x40')][_0x3ce098]===_0xe524('0x7f')){_0x472519[_0xe524('0x4a')]('i.'+_0x3ce098+_0xe524('0x80'));}else{_0x472519['where']('i.'+_0x3ce098+_0xe524('0x81'),_0x53560d[_0xe524('0x40')][_0x3ce098]);}}});}if(_0x53560d[_0xe524('0x40')][_0xe524('0x82')]){if(_0x53560d['query'][_0xe524('0x82')]==0x1){_0x472519['having'](_0xe524('0x83'));}else{_0x472519[_0xe524('0x62')](_0xe524('0x84'));}}if(_0x53560d['query'][_0xe524('0x85')]){_0x20753e=_[_0xe524('0x86')](_0x53560d[_0xe524('0x40')][_0xe524('0x85')])?_0x53560d[_0xe524('0x40')]['tag']:new Array(_0x53560d[_0xe524('0x40')][_0xe524('0x85')]);_0x20753e[_0xe524('0x6f')](function(_0x116891){_0x5c1655['or'](_0xe524('0x70'),'%,'+_0x116891+',%');});}if(_0x53560d['query'][_0xe524('0x87')]){var _0x629baa=_0x53560d[_0xe524('0x40')][_0xe524('0x87')][_0xe524('0x88')]('\x5c','\x5c\x5c')[_0xe524('0x88')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x629baa)){_0x15d7ee['or'](_0xe524('0x89'),_0x629baa+'%')['or'](_0xe524('0x8a'),_0x629baa+'%');}else{_0x15d7ee['or'](_0xe524('0x8b'),qs['getFullTextValue'](_0x629baa))['or'](_0xe524('0x8c'),_0x629baa+'%');}}}_0x472519[_0xe524('0x4a')](_0x15d7ee);_0x472519['group'](_0xe524('0x8d'));var _0x1c8e57={'type':db[_0xe524('0x8e')][_0xe524('0x8f')][_0xe524('0x90')],'raw':!![]};var _0xf6934=_0x472519['clone']();_0xf6934[_0xe524('0x4d')](_0xe524('0x8d'));_0xf6934[_0xe524('0x4d')](_0xe524('0x91'),_0xe524('0x60'));if(_0xcf8060[_0xe524('0x48')]){_0xcf8060[_0xe524('0x48')][_0xe524('0x6f')](function(_0x465c3d){var _0x16893f=_0x465c3d[0x0]===_0xe524('0x92')?_0x465c3d[0x0]:'i.'+_0x465c3d[0x0];_0x472519[_0xe524('0x48')](_0x16893f,_0x465c3d[0x1]===_0xe524('0x93')?![]:!![]);});}if(!_[_0xe524('0x76')](_0x20753e)){_0x472519[_0xe524('0x62')](_0x5c1655);_0xf6934['where'](_0xe524('0x94'),_0x20753e);}BPromise[_0xe524('0x95')]()[_0xe524('0x2d')](function(){if(!_0x2fa574){if(_0x53560d['query'][_0xe524('0x77')])return;_0xf6934[_0xe524('0x4a')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x472519['where'](_0xe524('0x96'));return;}if(_0x53560d['user'][_0xe524('0x97')]!=='agent')return;return _0x53560d[_0xe524('0x98')][_0xe524('0x99')]({'attributes':['id'],'raw':!![]})[_0xe524('0x2d')](function(_0xaa9af1){if(_['isEmpty'](_0xaa9af1)){_0xf6934['where'](_0xe524('0x9a'));_0x472519[_0xe524('0x4a')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0xf6934[_0xe524('0x4a')](_0xe524('0x78'),_[_0xe524('0x33')](_0xaa9af1,'id'));_0x472519['where'](_0xe524('0x78'),_[_0xe524('0x33')](_0xaa9af1,'id'));}});})[_0xe524('0x2d')](function(){if(_0x53560d[_0xe524('0x98')][_0xe524('0x97')]===_0xe524('0x9b')&&!_0x2fa574&&!_0x53560d['query']['WhatsappAccountId'])return[];return db[_0xe524('0x9c')]['query'](_0xf6934[_0xe524('0x9d')](),_0x1c8e57);})[_0xe524('0x2d')](function(_0x11bbda){_0x13cda8['count']=_0x11bbda[_0xe524('0x45')];if(_0x13cda8['count']===0x0)return[];return db[_0xe524('0x9c')][_0xe524('0x40')](_0x4a4a16[_0xe524('0x9d')](),_0x1c8e57)[_0xe524('0x2d')](function(_0x382ecc){_0x1ae283=_[_0xe524('0x9e')](_0x382ecc,'id');_0x1c8e57=_['merge'](_0x1c8e57,{'model':db[_0xe524('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x53560d[_0xe524('0x40')][_0xe524('0x44')]){_0xcf8060['attributes'][_0xe524('0x6f')](function(_0x3bdc0f){_0x472519['field']('i.'+_0x3bdc0f);});}else{_0x472519[_0xe524('0x4d')](_0xe524('0x91'),_0xe524('0x60'));_0x472519[_0xe524('0x4d')]('a.key',_0xe524('0x9f'));_0x472519[_0xe524('0x4d')](_0xe524('0xa0'),'Account.mandatoryDisposition');_0x472519[_0xe524('0x4d')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xe524('0x92'));_0x472519[_0xe524('0x4d')](_0xe524('0xa1'));_0x472519['field'](_0xe524('0xa2'),_0xe524('0xa3'));_0x472519[_0xe524('0x4d')]('c.lastName','Contact.lastName');_0x472519[_0xe524('0x4d')]('c.email',_0xe524('0xa4'));_0x472519['field'](_0xe524('0xa5'),_0xe524('0xa6'));_0x472519['field'](_0xe524('0xa7'),_0xe524('0xa8'));_0x472519['field']('c.fax',_0xe524('0xa9'));_0x472519[_0xe524('0x4d')](_0xe524('0xaa'),'Owner.fullname');_0x472519[_0xe524('0x4d')](_0xe524('0xab'),_0xe524('0xac'));_0x472519[_0xe524('0x4d')](_0xe524('0xad'),_0xe524('0xae'));}if(_0xcf8060['limit'])_0x472519[_0xe524('0x26')](_0xcf8060[_0xe524('0x26')]);if(_0xcf8060['offset'])_0x472519['offset'](_0xcf8060[_0xe524('0x25')]);return db[_0xe524('0x9c')][_0xe524('0x40')](_0x472519[_0xe524('0x9d')](),_0x1c8e57);})['then'](function(_0x1584a7){_0x33906d[_0xe524('0x4a')]('ui.WhatsappInteractionId\x20IN\x20?',_['map'](_0x1584a7,'id'));return db[_0xe524('0x9c')][_0xe524('0x40')](_0x33906d[_0xe524('0x9d')](),_0x1c8e57)[_0xe524('0x2d')](function(_0x2a8b4e){var _0x262991=_['groupBy'](_0x2a8b4e,'WhatsappInteractionId');var _0x46883b=[];_0x1584a7[_0xe524('0x6f')](function(_0x589aef){_0x46883b['push'](updateWhatsappInteraction(_0x589aef,_0x1ae283,_0x262991));});return BPromise[_0xe524('0xaf')](_0x46883b);});});})[_0xe524('0x2d')](function(_0x30fa81){_0x13cda8[_0xe524('0xb0')]=_0x30fa81;return _0x13cda8;})[_0xe524('0x2d')](respondWithFilteredResult(_0x415450,_0xcf8060))[_0xe524('0x38')](handleError(_0x415450,null));};exports['show']=function(_0x555801,_0x3e8668){var _0x390093={'raw':![],'where':{'id':_0x555801[_0xe524('0xb1')]['id']}},_0x21b60a={};_0x21b60a[_0xe524('0x3e')]=_[_0xe524('0x3f')](db[_0xe524('0x3a')][_0xe524('0x3b')]);_0x21b60a['query']=_[_0xe524('0x3f')](_0x555801[_0xe524('0x40')]);_0x21b60a[_0xe524('0x41')]=_['intersection'](_0x21b60a['model'],_0x21b60a[_0xe524('0x40')]);_0x390093[_0xe524('0x43')]=_[_0xe524('0x42')](_0x21b60a[_0xe524('0x3e')],qs['fields'](_0x555801[_0xe524('0x40')][_0xe524('0x44')]));_0x390093[_0xe524('0x43')]=_0x390093[_0xe524('0x43')][_0xe524('0x45')]?_0x390093['attributes']:_0x21b60a[_0xe524('0x3e')];if(_0x555801['query'][_0xe524('0xb2')]){_0x390093[_0xe524('0xb3')]=[{'all':!![]}];}_0x390093=_['merge']({},_0x390093,_0x555801[_0xe524('0xb4')]);return db[_0xe524('0x3a')]['find'](_0x390093)[_0xe524('0x2d')](handleEntityNotFound(_0x3e8668,null))['then'](respondWithResult(_0x3e8668,null))[_0xe524('0x38')](handleError(_0x3e8668,null));};exports[_0xe524('0xb5')]=function(_0x1be681,_0x328f84){return db[_0xe524('0x3a')][_0xe524('0xb5')](_0x1be681[_0xe524('0x73')],{})[_0xe524('0x2d')](respondWithResult(_0x328f84,0xc9))['catch'](handleError(_0x328f84,null));};exports[_0xe524('0xb6')]=function(_0x5a5789,_0x4f7bf1){if(_0x5a5789[_0xe524('0x73')]['id']){delete _0x5a5789['body']['id'];}return db[_0xe524('0x3a')][_0xe524('0x5f')]({'where':{'id':_0x5a5789[_0xe524('0xb1')]['id']}})[_0xe524('0x2d')](handleEntityNotFound(_0x4f7bf1,null))[_0xe524('0x2d')](saveUpdates(_0x5a5789[_0xe524('0x73')],null))['then'](respondWithResult(_0x4f7bf1,null))['catch'](handleError(_0x4f7bf1,null));};exports[_0xe524('0x2e')]=function(_0x1b4f38,_0x2fbdb7){return db[_0xe524('0x3a')][_0xe524('0x5f')]({'where':{'id':_0x1b4f38[_0xe524('0xb1')]['id']}})[_0xe524('0x2d')](handleEntityNotFound(_0x2fbdb7,null))[_0xe524('0x2d')](removeEntity(_0x2fbdb7,null))[_0xe524('0x38')](handleError(_0x2fbdb7,null));};exports[_0xe524('0xb7')]=function(_0x5c5ef4,_0x2431b5){return db[_0xe524('0x3a')][_0xe524('0xb7')]()[_0xe524('0x2d')](respondWithResult(_0x2431b5,null))[_0xe524('0x38')](handleError(_0x2431b5,null));};exports[_0xe524('0xb8')]=function(_0x58c1e3,_0x1cc750,_0x43f3bf){return db[_0xe524('0xb9')][_0xe524('0x5f')]({'where':{'id':_0x58c1e3[_0xe524('0xb1')]['id']}})[_0xe524('0x2d')](handleEntityNotFound(_0x1cc750,null))[_0xe524('0x2d')](function(_0x524e9e){if(_0x524e9e){return _0x524e9e['addMessage'](_0x58c1e3['body']['ids'],_[_0xe524('0xba')](_0x58c1e3[_0xe524('0x73')],['ids','id'])||{});}})[_0xe524('0x2d')](respondWithResult(_0x1cc750,null))[_0xe524('0x38')](handleError(_0x1cc750,null));};exports['getMessages']=function(_0x1529ea,_0xf63d29,_0x4ed1a6){var _0x1b3c48={'raw':![],'where':{}};var _0x16f5bc={};var _0x39bc6f={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xe524('0xbb')]({'where':{'id':_0x1529ea[_0xe524('0xb1')]['id']}})[_0xe524('0x2d')](handleEntityNotFound(_0xf63d29,null))['then'](function(_0x1aaeca){if(_0x1aaeca){_0x16f5bc[_0xe524('0x3e')]=_[_0xe524('0x3f')](db[_0xe524('0xb9')]['rawAttributes']);_0x16f5bc['query']=_[_0xe524('0x3f')](_0x1529ea[_0xe524('0x40')]);_0x16f5bc[_0xe524('0x41')]=_[_0xe524('0x42')](_0x16f5bc[_0xe524('0x3e')],_0x16f5bc[_0xe524('0x40')]);_0x1b3c48[_0xe524('0x43')]=_[_0xe524('0x42')](_0x16f5bc[_0xe524('0x3e')],qs[_0xe524('0x44')](_0x1529ea[_0xe524('0x40')][_0xe524('0x44')]));_0x1b3c48[_0xe524('0x43')]=_0x1b3c48['attributes'][_0xe524('0x45')]?_0x1b3c48[_0xe524('0x43')]:_0x16f5bc[_0xe524('0x3e')];if(!_0x1529ea[_0xe524('0x40')][_0xe524('0x46')](_0xe524('0x47'))){_0x1b3c48['limit']=qs['limit'](_0x1529ea[_0xe524('0x40')]['limit']);_0x1b3c48[_0xe524('0x25')]=qs[_0xe524('0x25')](_0x1529ea[_0xe524('0x40')][_0xe524('0x25')]);}_0x1b3c48[_0xe524('0x48')]=qs[_0xe524('0x49')](_0x1529ea[_0xe524('0x40')]['sort']);_0x1b3c48[_0xe524('0x4a')]=qs[_0xe524('0x41')](_[_0xe524('0x4b')](_0x1529ea[_0xe524('0x40')],_0x16f5bc['filters']));_0x1b3c48[_0xe524('0x4a')][_0xe524('0xbc')]=_0x1aaeca['id'];if(_0x1529ea['query'][_0xe524('0x87')]){_0x1b3c48[_0xe524('0x4a')]=_['merge'](_0x1b3c48['where'],{'$or':_[_0xe524('0x33')](_0x1b3c48[_0xe524('0x43')],function(_0x575c14){var _0x5d2a54={};_0x5d2a54[_0x575c14]={'$like':'%'+_0x1529ea[_0xe524('0x40')]['filter']+'%'};return _0x5d2a54;})});}if(_0x1529ea['query']['$gte']){var _0x337e25=_0x1529ea[_0xe524('0x40')][_0xe524('0x7c')][_0xe524('0x36')](',');var _0x5718a6={};_0x5718a6[_0x337e25[0x0]]={'$gte':moment(_0x337e25[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x1b3c48[_0xe524('0x4a')]=_[_0xe524('0xbd')](_0x1b3c48[_0xe524('0x4a')],_0x5718a6);}_0x1b3c48=_[_0xe524('0xbd')]({},_0x1b3c48,_0x1529ea[_0xe524('0xb4')]);return db[_0xe524('0xb9')][_0xe524('0x24')]({'where':_0x1b3c48[_0xe524('0x4a')]})['then'](function(_0x1d57f6){_0x39bc6f[_0xe524('0x24')]=_0x1d57f6;if(_0x1529ea[_0xe524('0x40')][_0xe524('0xb2')]){_0x1b3c48[_0xe524('0xb3')]=[{'all':!![]}];}return db[_0xe524('0xb9')][_0xe524('0xbe')](_0x1b3c48);})[_0xe524('0x2d')](function(_0x117120){_0x39bc6f[_0xe524('0xb0')]=_0x117120;return _0x39bc6f;});}})['then'](respondWithFilteredResult(_0xf63d29,_0x1b3c48))[_0xe524('0x38')](handleError(_0xf63d29,null));};exports[_0xe524('0xbf')]=function(_0xb499ea,_0x188b33,_0x1c59b9){return db[_0xe524('0x3a')][_0xe524('0x5f')]({'where':{'id':_0xb499ea[_0xe524('0xb1')]['id']}})['then'](handleEntityNotFound(_0x188b33,null))[_0xe524('0x2d')](function(_0xbf41a2){if(_0xbf41a2){return _0xbf41a2[_0xe524('0xc0')](_0xb499ea[_0xe524('0x73')][_0xe524('0xc1')],_[_0xe524('0xba')](_0xb499ea[_0xe524('0x73')],[_0xe524('0xc1'),'id'])||{})[_0xe524('0xc2')](function(){return db[_0xe524('0x6e')][_0xe524('0xbe')]({'attributes':['id',_0xe524('0x31'),'color'],'where':{'id':_0xb499ea[_0xe524('0x73')][_0xe524('0xc1')]}});})[_0xe524('0x2d')](function(_0x526082){socket['emit'](_0xe524('0xc3'),{'id':Number(_0xb499ea[_0xe524('0xb1')]['id']),'tags':_0x526082||[]});return{'id':Number(_0xb499ea[_0xe524('0xb1')]['id']),'tags':_0x526082||[]};});}})['then'](respondWithResult(_0x188b33,null))[_0xe524('0x38')](handleError(_0x188b33,null));};exports[_0xe524('0xc4')]=function(_0x339572,_0x541b33,_0x4952b9){return db[_0xe524('0x3a')][_0xe524('0x5f')]({'where':{'id':_0x339572[_0xe524('0xb1')]['id']}})['then'](handleEntityNotFound(_0x541b33,null))[_0xe524('0x2d')](function(_0x37f1ad){if(_0x37f1ad){return _0x37f1ad[_0xe524('0xc4')](_0x339572[_0xe524('0x40')][_0xe524('0xc1')]);}})[_0xe524('0x2d')](respondWithStatusCode(_0x541b33,null))[_0xe524('0x38')](handleError(_0x541b33,null));};exports['download']=function(_0x38a6df,_0x2c2eb2){var _0x20baec=moment()[_0xe524('0xc5')]()[_0xe524('0x9d')]();var _0x4d44a6=path[_0xe524('0xc6')](config[_0xe524('0xc7')],'server',_0xe524('0xc8'),_0xe524('0xc9'));var _0x1013f2=path[_0xe524('0xc6')](config[_0xe524('0xc7')],_0xe524('0xca'),_0xe524('0xc8'),_0xe524('0xcb'));var _0x44e73e=path['join'](_0x4d44a6,_0x20baec);var _0x53eb8d=util[_0xe524('0xcc')](_0xe524('0xcd'),_0x38a6df[_0xe524('0xb1')]['id'],_0x20baec);var _0x2f6b8=path[_0xe524('0xc6')](_0x4d44a6,_0x53eb8d);var _0x427752=[];_0x427752[_0xe524('0x37')]({'model':db['User'],'as':'User','attributes':['id',_0xe524('0x34')],'raw':!![]});_0x427752['push']({'model':db['CmContact'],'as':_0xe524('0x64'),'attributes':['id',_0xe524('0xce'),_0xe524('0xcf')],'raw':!![]});if(_0x38a6df[_0xe524('0x40')][_0xe524('0xcb')]){_0x427752[_0xe524('0x37')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x46e4d8=[{'model':db[_0xe524('0xb9')],'as':_0xe524('0xd0'),'attributes':['id','body',_0xe524('0x7a'),_0xe524('0xd1'),_0xe524('0xd2'),_0xe524('0x82')],'include':_0x427752}];_0x46e4d8['push']({'model':db['WhatsappAccount'],'as':_0xe524('0xd3'),'attributes':['id','name']});_0x46e4d8[_0xe524('0x37')]({'model':db[_0xe524('0xd4')],'as':_0xe524('0xd5'),'attributes':['id',_0xe524('0x34')]});return db[_0xe524('0x3a')][_0xe524('0x5f')]({'where':{'id':_0x38a6df[_0xe524('0xb1')]['id']},'include':_0x46e4d8})[_0xe524('0x2d')](handleEntityNotFound(_0x2c2eb2,null))[_0xe524('0x2d')](function(_0x165241){if(_0x165241){var _0x5f0baa=_0x165241[_0xe524('0xd6')]({'plain':!![]});fs[_0xe524('0xd7')](_0x44e73e);var _0x3a78fe={'format':'A4','border':'10px','header':{'height':_0xe524('0xd8'),'contents':{'first':'\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20'}},'footer':{'height':_0xe524('0xd9'),'contents':{'default':util['format'](_0xe524('0xda'),util['format'](_0xe524('0xdb'),'Whatsapp',_0x5f0baa['id']),moment()[_0xe524('0xcc')]('YYYY-MM-DD')['toString']())}}};var _0x5da172={'channel':'Whatsapp','account':_0x5f0baa[_0xe524('0xd3')][_0xe524('0x31')],'agent':_0x5f0baa[_0xe524('0xd5')]?_0x5f0baa['Owner'][_0xe524('0x34')]:'N.A.','createdAt':moment(_0x5f0baa[_0xe524('0x7a')])[_0xe524('0xcc')](_0xe524('0xdc'))[_0xe524('0x9d')](),'closedAt':_0x5f0baa['closed']?moment(_0x5f0baa['closedAt'])[_0xe524('0xcc')](_0xe524('0xdc'))[_0xe524('0x9d')]():'','disposition':_0x5f0baa[_0xe524('0xdd')],'messages':_(_0x5f0baa[_0xe524('0xd0')])['filter']({'secret':![]})[_0xe524('0x33')](function(_0x3340fa){if(_0x3340fa['Attachment']){var _0x320b6b=path[_0xe524('0xc6')](_0x1013f2,_0x3340fa[_0xe524('0xde')][_0xe524('0xdf')]);if(fs[_0xe524('0xe0')](_0x320b6b)){fs[_0xe524('0xe1')](_0x320b6b)[_0xe524('0xe2')](fs[_0xe524('0xe3')](path[_0xe524('0xc6')](_0x44e73e,_0x3340fa[_0xe524('0xde')][_0xe524('0xdf')])));}}return{'date':moment(_0x3340fa[_0xe524('0x7a')])[_0xe524('0xcc')](_0xe524('0xdc'))['toString'](),'sender':_0x3340fa[_0xe524('0xd1')]===_0xe524('0xe4')?_0x3340fa['User']?_0x3340fa[_0xe524('0xd4')][_0xe524('0x34')]:_0xe524('0xe5'):_0x3340fa[_0xe524('0x64')][_0xe524('0xce')]+(_0x3340fa[_0xe524('0x64')][_0xe524('0xcf')]?'\x20'+_0x3340fa[_0xe524('0x64')]['lastName']:''),'body':_0x3340fa['Attachment']?_0x3340fa[_0xe524('0xde')][_0xe524('0xdf')]:_0x3340fa['body'],'direction':_0x3340fa[_0xe524('0xd1')]===_0xe524('0xe4')?'A':'C','secret':_0x3340fa[_0xe524('0xd2')],'read':_0x3340fa['read'],'attachment':_0x3340fa['Attachment']};})['value']()};return ejs[_0xe524('0xe6')](path[_0xe524('0xc6')](config[_0xe524('0xc7')],'server',_0xe524('0xe7'),'downloadInteraction.html'),{'interaction':_0x5da172})[_0xe524('0x2d')](function(_0x2667bc){return new BPromise(function(_0x4f4cfd,_0x1c8e99){pdf[_0xe524('0xb5')](_0x2667bc,_0x3a78fe)[_0xe524('0xe8')](path[_0xe524('0xc6')](_0x44e73e,_0xe524('0xe9')+_0x5f0baa['id']+'-'+_0x20baec+_0xe524('0xea')),function(_0x2cd25d,_0x4c8cac){if(_0x2cd25d)return _0x1c8e99(_0x2cd25d);_0x4f4cfd(_0x4c8cac);});});})['then'](function(){return new BPromise(function(_0x551b0b,_0x49baca){zipdir(_0x44e73e,{'saveTo':_0x2f6b8},function(_0x297446,_0x1208c4){if(_0x297446)return _0x49baca(_0x297446);return _0x551b0b(_0x1208c4);});})[_0xe524('0x2d')](function(){return new BPromise(function(_0x2288a8,_0x3d56dd){rimraf(_0x44e73e,function(_0x293bed){if(_0x293bed)_0x3d56dd(_0x293bed);return _0x2288a8();});});})['then'](function(){return _0x2c2eb2[_0xe524('0xeb')](_0x2f6b8,_0x53eb8d,function(_0x59cb98){if(_0x59cb98){console[_0xe524('0xec')](_0xe524('0xed'),_0x59cb98);}else{fs[_0xe524('0xee')](_0x2f6b8);}});});});}else{return _0x2c2eb2['sendStatus'](0xc8);}})[_0xe524('0x38')](handleError(_0x2c2eb2,null));}; \ No newline at end of file +var _0x524e=['\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','agent','sequelize','toString','keyBy','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','all','rows','params','includeAll','include','options','create','update','describe','addMessage','WhatsappMessage','omit','findOne','WhatsappInteractionId','merge','findAll','addTags','setTags','ids','spread','whatsappInteractionTags:save','removeTags','unix','join','root','files','tmp','server','attachments','format','transcript-%d-%s.zip','firstName','lastName','Messages','direction','secret','Account','User','Owner','get','mkdirSync','40px','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x0a\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\x20\x20\x20\x20\x20\x20\x20%s\x0a\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\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','YYYY-MM-DD\x20HH:mm:ss','disposition','Attachment','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','views','toFile','transcript-','.pdf','download','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','Users','map','fullname','Tags','split','push','catch','index','WhatsappInteraction','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','tools_tags','u.id','u.fullname','from','user_has_whatsapp_interactions','users','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','t.id\x20=\x20it.TagId','search','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','type','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','body','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x524e,0x15e));var _0xe524=function(_0x4acb4d,_0x82390b){_0x4acb4d=_0x4acb4d-0x0;var _0x34e597=_0x524e[_0x4acb4d];return _0x34e597;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xe524('0x0'));var zipdir=require(_0xe524('0x1'));var jsonpatch=require(_0xe524('0x2'));var rp=require(_0xe524('0x3'));var moment=require(_0xe524('0x4'));var BPromise=require(_0xe524('0x5'));var Mustache=require(_0xe524('0x6'));var util=require(_0xe524('0x7'));var path=require(_0xe524('0x8'));var sox=require(_0xe524('0x9'));var csv=require('to-csv');var ejs=require(_0xe524('0xa'));var fs=require('fs');var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0xf'));var querystring=require(_0xe524('0x10'));var Papa=require(_0xe524('0x11'));var Redis=require(_0xe524('0x12'));var authService=require(_0xe524('0x13'));var qs=require(_0xe524('0x14'));var as=require(_0xe524('0x15'));var hardwareService=require(_0xe524('0x16'));var logger=require(_0xe524('0x17'))(_0xe524('0x18'));var utils=require(_0xe524('0x19'));var config=require(_0xe524('0x1a'));var licenseUtil=require(_0xe524('0x1b'));var db=require(_0xe524('0x1c'))['db'];config['redis']=_['defaults'](config[_0xe524('0x1d')],{'host':_0xe524('0x1e'),'port':0x18eb});var socket=require(_0xe524('0x1f'))(new Redis(config[_0xe524('0x1d')]));require(_0xe524('0x20'))['register'](socket);function respondWithStatusCode(_0x12ff75,_0x51e9fe){_0x51e9fe=_0x51e9fe||0xcc;return function(_0x19f013){if(_0x19f013){return _0x12ff75[_0xe524('0x21')](_0x51e9fe);}return _0x12ff75['status'](_0x51e9fe)[_0xe524('0x22')]();};}function respondWithResult(_0x488fce,_0x109795){_0x109795=_0x109795||0xc8;return function(_0x538754){if(_0x538754){return _0x488fce[_0xe524('0x23')](_0x109795)['json'](_0x538754);}};}function respondWithFilteredResult(_0x5c8736,_0x5a5c0d){return function(_0x3a4027){if(_0x3a4027){var _0x4f1dfb=_0x3a4027[_0xe524('0x24')],_0x11b2a1=_0x5a5c0d['offset'],_0x238f8f=_0x5a5c0d[_0xe524('0x25')]+_0x5a5c0d[_0xe524('0x26')],_0x278de9;if(_0x238f8f>=_0x4f1dfb){_0x238f8f=_0x4f1dfb;_0x278de9=0xc8;}else{_0x278de9=0xce;}_0x5c8736['status'](_0x278de9);return _0x5c8736[_0xe524('0x27')](_0xe524('0x28'),_0x11b2a1+'-'+_0x238f8f+'/'+_0x4f1dfb)[_0xe524('0x29')](_0x3a4027);}return null;};}function patchUpdates(_0x1dcc0f){return function(_0x1c4194){try{jsonpatch[_0xe524('0x2a')](_0x1c4194,_0x1dcc0f,!![]);}catch(_0xbf059b){return BPromise[_0xe524('0x2b')](_0xbf059b);}return _0x1c4194[_0xe524('0x2c')]();};}function saveUpdates(_0x5c4d21,_0x7d1f92){return function(_0x5bb00b){if(_0x5bb00b){return _0x5bb00b['update'](_0x5c4d21)[_0xe524('0x2d')](function(_0x23df5e){return _0x23df5e;});}return null;};}function removeEntity(_0x1ad106,_0x85fc51){return function(_0x599d5d){if(_0x599d5d){return _0x599d5d[_0xe524('0x2e')]()['then'](function(){_0x1ad106[_0xe524('0x23')](0xcc)[_0xe524('0x22')]();});}};}function handleEntityNotFound(_0xd62772,_0x3cd922){return function(_0x4102d9){if(!_0x4102d9){_0xd62772[_0xe524('0x21')](0x194);}return _0x4102d9;};}function handleError(_0x2141db,_0x583cc3){_0x583cc3=_0x583cc3||0x1f4;return function(_0x58a896){logger[_0xe524('0x2f')](_0x58a896[_0xe524('0x30')]);if(_0x58a896[_0xe524('0x31')]){delete _0x58a896[_0xe524('0x31')];}_0x2141db[_0xe524('0x23')](_0x583cc3)['send'](_0x58a896);};}function getInteractionUsers(_0x52f140,_0x4b1ff){return new BPromise(function(_0x25e7a7,_0x3aedd9){try{if(_0x4b1ff[_0x52f140['id']]){_0x52f140[_0xe524('0x32')]=_[_0xe524('0x33')](_0x4b1ff[_0x52f140['id']],function(_0x517fa0){return{'id':_0x517fa0['id'],'fullname':_0x517fa0[_0xe524('0x34')]};});}}catch(_0x9a7e98){_0x3aedd9(_0x9a7e98);}_0x25e7a7(_0x52f140);});}function getInteractionTags(_0x4a4e15,_0x5b7ded){return new BPromise(function(_0x20688e,_0x376324){try{if(_0x4a4e15['TagIds']){_0x4a4e15[_0xe524('0x35')]=[];_0x4a4e15['TagIds'][_0xe524('0x36')](',')['forEach'](function(_0x315e56){_0x4a4e15[_0xe524('0x35')][_0xe524('0x37')](_0x5b7ded[_0x315e56]);});}delete _0x4a4e15['TagIds'];}catch(_0x2e26d9){_0x376324(_0x2e26d9);}_0x20688e(_0x4a4e15);});}function updateWhatsappInteraction(_0x5238c9,_0xdbdf53,_0x16eff9){return new BPromise(function(_0x276343,_0x502256){return getInteractionUsers(_0x5238c9,_0x16eff9)[_0xe524('0x2d')](function(_0x119cc3){return getInteractionTags(_0x119cc3,_0xdbdf53);})['then'](function(_0x27817e){_0x276343(_0x27817e);})[_0xe524('0x38')](function(_0x10408e){_0x502256(_0x10408e);});});}exports[_0xe524('0x39')]=function(_0x53560d,_0x415450){var _0xcf8060={},_0x615b5e={},_0x13cda8={'count':0x0,'rows':[]};var _0x2522cd=_[_0xe524('0x33')](db[_0xe524('0x3a')][_0xe524('0x3b')],function(_0x4db4b7){return{'name':_0x4db4b7[_0xe524('0x3c')],'type':_0x4db4b7['type'][_0xe524('0x3d')]};});_0x615b5e[_0xe524('0x3e')]=_['map'](_0x2522cd,_0xe524('0x31'));_0x615b5e['query']=_[_0xe524('0x3f')](_0x53560d[_0xe524('0x40')]);_0x615b5e[_0xe524('0x41')]=_[_0xe524('0x42')](_0x615b5e[_0xe524('0x3e')],_0x615b5e[_0xe524('0x40')]);_0xcf8060[_0xe524('0x43')]=_[_0xe524('0x42')](_0x615b5e['model'],qs[_0xe524('0x44')](_0x53560d[_0xe524('0x40')][_0xe524('0x44')]));_0xcf8060[_0xe524('0x43')]=_0xcf8060[_0xe524('0x43')][_0xe524('0x45')]?_0xcf8060[_0xe524('0x43')]:_0x615b5e[_0xe524('0x3e')];if(!_0x53560d['query'][_0xe524('0x46')](_0xe524('0x47'))){_0xcf8060[_0xe524('0x26')]=qs['limit'](_0x53560d[_0xe524('0x40')]['limit']);_0xcf8060[_0xe524('0x25')]=qs[_0xe524('0x25')](_0x53560d[_0xe524('0x40')][_0xe524('0x25')]);}_0xcf8060[_0xe524('0x48')]=qs[_0xe524('0x49')](_0x53560d[_0xe524('0x40')]['sort']);_0xcf8060[_0xe524('0x4a')]=qs[_0xe524('0x41')](_[_0xe524('0x4b')](_0x53560d[_0xe524('0x40')],_0x615b5e[_0xe524('0x41')]),_0x2522cd);var _0x1ae283=[];var _0x4a4a16=squel[_0xe524('0x4c')]()[_0xe524('0x4d')]('id')[_0xe524('0x4d')]('name')[_0xe524('0x4d')]('color')['from'](_0xe524('0x4e'));var _0x33906d=squel['select']()[_0xe524('0x4d')](_0xe524('0x4f'))[_0xe524('0x4d')](_0xe524('0x50'))['field']('ui.WhatsappInteractionId')[_0xe524('0x51')](_0xe524('0x52'),'ui')['left_join'](_0xe524('0x53'),'u','u.id\x20=\x20ui.UserId');var _0x472519=squel[_0xe524('0x4c')]()[_0xe524('0x51')](_0xe524('0x54'),'i')[_0xe524('0x55')](_0xe524('0x56'),'c',_0xe524('0x57'))[_0xe524('0x55')](_0xe524('0x53'),'o',_0xe524('0x58'))[_0xe524('0x55')](_0xe524('0x59'),'a',_0xe524('0x5a'))[_0xe524('0x55')](_0xe524('0x5b'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0xe524('0x55')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0xe524('0x55')]('tools_tags','t',_0xe524('0x5c'));var _0x15d7ee=squel['expr']();var _0x20753e=[];var _0x5c1655=squel['expr']();var _0x2fa574;if(_0x53560d[_0xe524('0x40')][_0xe524('0x5d')]){_0x2fa574=as['parseSearch'](_0x53560d['query']['search']);var _0x4e9c3b=_0x2fa574['sqlOperator'];for(var _0x5477ca=0x0;_0x5477ca<_0x2fa574[_0xe524('0x5e')][_0xe524('0x45')];_0x5477ca++){var _0x4f5059=_0x2fa574[_0xe524('0x5e')][_0x5477ca];var _0x40b871='i';var _0x254168=_[_0xe524('0x5f')](_0x2522cd,[_0xe524('0x31'),_0x4f5059['field']]);if(!_0x254168){switch(_0x4f5059[_0xe524('0x4d')]){case _0xe524('0x60'):if(_0x4f5059[_0xe524('0x61')]==0x1){_0x472519['having']('`'+_0x4f5059[_0xe524('0x4d')]+'`\x20=\x200');}else{_0x472519[_0xe524('0x62')]('`'+_0x4f5059[_0xe524('0x4d')]+_0xe524('0x63'));}break;case _0xe524('0x64'):if(_0x4f5059[_0xe524('0x65')]===_0xe524('0x66')){if(_0x4f5059[_0xe524('0x61')][_0xe524('0x36')]('\x20')[_0xe524('0x45')]>0x1){_0x15d7ee[_0x4e9c3b](_0xe524('0x67'),qs[_0xe524('0x68')](_0x4f5059[_0xe524('0x61')]),null);}else{var _0x55a855='%'+_0x4f5059['value']+'%';_0x15d7ee[_0x4e9c3b]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x55a855,_0x55a855,_0x55a855);}}else{_0x254168=_[_0xe524('0x5f')](_0x2522cd,[_0xe524('0x31'),_0xe524('0x69')]);_0x4f5059[_0xe524('0x4d')]=_0xe524('0x69');_0x5343b3=as[_0xe524('0x6a')](_0x40b871,_0x254168[_0xe524('0x6b')],_0x4f5059);_0x15d7ee[_0x4e9c3b](_0x5343b3[_0xe524('0x6c')],_0x5343b3[_0xe524('0x61')][_0xe524('0x6d')],_0x5343b3[_0xe524('0x61')]['end']);}break;case _0xe524('0x6e'):var _0x1f0567=_0x4f5059['value']['split'](',')['map'](function(_0x5c4056){return Number(_0x5c4056);});_0x1f0567[_0xe524('0x6f')](function(_0x12dfce){_0x5c1655['or'](_0xe524('0x70'),'%,'+_0x12dfce+',%');});_0x20753e=_[_0xe524('0x71')](_0x20753e,_0x1f0567);break;case'User':if(_0x4f5059[_0xe524('0x65')]===_0xe524('0x66')){_0x15d7ee[_0x4e9c3b](_0xe524('0x72'),'%'+_0x4f5059[_0xe524('0x61')]+'%',null);}else{_0x254168=_['find'](_0x2522cd,['name','UserId']);_0x4f5059[_0xe524('0x4d')]='UserId';_0x5343b3=as[_0xe524('0x6a')](_0x40b871,_0x254168[_0xe524('0x6b')],_0x4f5059);_0x15d7ee[_0x4e9c3b](_0x5343b3[_0xe524('0x6c')],_0x5343b3[_0xe524('0x61')][_0xe524('0x6d')],_0x5343b3['value']['end']);}break;case _0xe524('0x73'):_0x5343b3=as[_0xe524('0x6a')]('me',null,_0x4f5059);_0x15d7ee[_0x4e9c3b](_0x5343b3[_0xe524('0x6c')],_0x5343b3[_0xe524('0x61')][_0xe524('0x6d')],_0x5343b3[_0xe524('0x61')]['end']);break;}}else{var _0x5343b3=as[_0xe524('0x6a')](_0x40b871,_0x254168[_0xe524('0x6b')],_0x4f5059);_0x15d7ee[_0x4e9c3b](_0x5343b3['text'],_0x5343b3[_0xe524('0x61')][_0xe524('0x6d')],_0x5343b3[_0xe524('0x61')]['end']);}}}else{var _0x4d5c19=_(_0x53560d[_0xe524('0x40')])[_0xe524('0x3f')]()[_0xe524('0x33')](function(_0x428b9d){return _[_0xe524('0x74')](_0x2522cd,['name',_0x428b9d])?_0x428b9d:undefined;})[_0xe524('0x75')]()[_0xe524('0x61')]();if(!_[_0xe524('0x76')](_0x4d5c19)){_0x4d5c19[_0xe524('0x6f')](function(_0x3ce098){if(_0x3ce098===_0xe524('0x77')){_0x472519[_0xe524('0x4a')](_0xe524('0x78'),[][_0xe524('0x79')](_0x53560d[_0xe524('0x40')][_0x3ce098]));}else if(_0x3ce098===_0xe524('0x7a')){var _0x4c69e2=JSON[_0xe524('0x7b')](_0x53560d[_0xe524('0x40')][_0x3ce098])[_0xe524('0x7c')];var _0xfed246=JSON[_0xe524('0x7b')](_0x53560d['query'][_0x3ce098])[_0xe524('0x7d')];_0x472519[_0xe524('0x4a')](_0xe524('0x7e'),_0x4c69e2,_0xfed246);}else{if(_0x53560d[_0xe524('0x40')][_0x3ce098]===_0xe524('0x7f')){_0x472519[_0xe524('0x4a')]('i.'+_0x3ce098+_0xe524('0x80'));}else{_0x472519['where']('i.'+_0x3ce098+_0xe524('0x81'),_0x53560d[_0xe524('0x40')][_0x3ce098]);}}});}if(_0x53560d[_0xe524('0x40')][_0xe524('0x82')]){if(_0x53560d['query'][_0xe524('0x82')]==0x1){_0x472519['having'](_0xe524('0x83'));}else{_0x472519[_0xe524('0x62')](_0xe524('0x84'));}}if(_0x53560d['query'][_0xe524('0x85')]){_0x20753e=_[_0xe524('0x86')](_0x53560d[_0xe524('0x40')][_0xe524('0x85')])?_0x53560d[_0xe524('0x40')]['tag']:new Array(_0x53560d[_0xe524('0x40')][_0xe524('0x85')]);_0x20753e[_0xe524('0x6f')](function(_0x116891){_0x5c1655['or'](_0xe524('0x70'),'%,'+_0x116891+',%');});}if(_0x53560d['query'][_0xe524('0x87')]){var _0x629baa=_0x53560d[_0xe524('0x40')][_0xe524('0x87')][_0xe524('0x88')]('\x5c','\x5c\x5c')[_0xe524('0x88')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x629baa)){_0x15d7ee['or'](_0xe524('0x89'),_0x629baa+'%')['or'](_0xe524('0x8a'),_0x629baa+'%');}else{_0x15d7ee['or'](_0xe524('0x8b'),qs['getFullTextValue'](_0x629baa))['or'](_0xe524('0x8c'),_0x629baa+'%');}}}_0x472519[_0xe524('0x4a')](_0x15d7ee);_0x472519['group'](_0xe524('0x8d'));var _0x1c8e57={'type':db[_0xe524('0x8e')][_0xe524('0x8f')][_0xe524('0x90')],'raw':!![]};var _0xf6934=_0x472519['clone']();_0xf6934[_0xe524('0x4d')](_0xe524('0x8d'));_0xf6934[_0xe524('0x4d')](_0xe524('0x91'),_0xe524('0x60'));if(_0xcf8060[_0xe524('0x48')]){_0xcf8060[_0xe524('0x48')][_0xe524('0x6f')](function(_0x465c3d){var _0x16893f=_0x465c3d[0x0]===_0xe524('0x92')?_0x465c3d[0x0]:'i.'+_0x465c3d[0x0];_0x472519[_0xe524('0x48')](_0x16893f,_0x465c3d[0x1]===_0xe524('0x93')?![]:!![]);});}if(!_[_0xe524('0x76')](_0x20753e)){_0x472519[_0xe524('0x62')](_0x5c1655);_0xf6934['where'](_0xe524('0x94'),_0x20753e);}BPromise[_0xe524('0x95')]()[_0xe524('0x2d')](function(){if(!_0x2fa574){if(_0x53560d['query'][_0xe524('0x77')])return;_0xf6934[_0xe524('0x4a')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x472519['where'](_0xe524('0x96'));return;}if(_0x53560d['user'][_0xe524('0x97')]!=='agent')return;return _0x53560d[_0xe524('0x98')][_0xe524('0x99')]({'attributes':['id'],'raw':!![]})[_0xe524('0x2d')](function(_0xaa9af1){if(_['isEmpty'](_0xaa9af1)){_0xf6934['where'](_0xe524('0x9a'));_0x472519[_0xe524('0x4a')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0xf6934[_0xe524('0x4a')](_0xe524('0x78'),_[_0xe524('0x33')](_0xaa9af1,'id'));_0x472519['where'](_0xe524('0x78'),_[_0xe524('0x33')](_0xaa9af1,'id'));}});})[_0xe524('0x2d')](function(){if(_0x53560d[_0xe524('0x98')][_0xe524('0x97')]===_0xe524('0x9b')&&!_0x2fa574&&!_0x53560d['query']['WhatsappAccountId'])return[];return db[_0xe524('0x9c')]['query'](_0xf6934[_0xe524('0x9d')](),_0x1c8e57);})[_0xe524('0x2d')](function(_0x11bbda){_0x13cda8['count']=_0x11bbda[_0xe524('0x45')];if(_0x13cda8['count']===0x0)return[];return db[_0xe524('0x9c')][_0xe524('0x40')](_0x4a4a16[_0xe524('0x9d')](),_0x1c8e57)[_0xe524('0x2d')](function(_0x382ecc){_0x1ae283=_[_0xe524('0x9e')](_0x382ecc,'id');_0x1c8e57=_['merge'](_0x1c8e57,{'model':db[_0xe524('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x53560d[_0xe524('0x40')][_0xe524('0x44')]){_0xcf8060['attributes'][_0xe524('0x6f')](function(_0x3bdc0f){_0x472519['field']('i.'+_0x3bdc0f);});}else{_0x472519[_0xe524('0x4d')](_0xe524('0x91'),_0xe524('0x60'));_0x472519[_0xe524('0x4d')]('a.key',_0xe524('0x9f'));_0x472519[_0xe524('0x4d')](_0xe524('0xa0'),'Account.mandatoryDisposition');_0x472519[_0xe524('0x4d')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0xe524('0x92'));_0x472519[_0xe524('0x4d')](_0xe524('0xa1'));_0x472519['field'](_0xe524('0xa2'),_0xe524('0xa3'));_0x472519[_0xe524('0x4d')]('c.lastName','Contact.lastName');_0x472519[_0xe524('0x4d')]('c.email',_0xe524('0xa4'));_0x472519['field'](_0xe524('0xa5'),_0xe524('0xa6'));_0x472519['field'](_0xe524('0xa7'),_0xe524('0xa8'));_0x472519['field']('c.fax',_0xe524('0xa9'));_0x472519[_0xe524('0x4d')](_0xe524('0xaa'),'Owner.fullname');_0x472519[_0xe524('0x4d')](_0xe524('0xab'),_0xe524('0xac'));_0x472519[_0xe524('0x4d')](_0xe524('0xad'),_0xe524('0xae'));}if(_0xcf8060['limit'])_0x472519[_0xe524('0x26')](_0xcf8060[_0xe524('0x26')]);if(_0xcf8060['offset'])_0x472519['offset'](_0xcf8060[_0xe524('0x25')]);return db[_0xe524('0x9c')][_0xe524('0x40')](_0x472519[_0xe524('0x9d')](),_0x1c8e57);})['then'](function(_0x1584a7){_0x33906d[_0xe524('0x4a')]('ui.WhatsappInteractionId\x20IN\x20?',_['map'](_0x1584a7,'id'));return db[_0xe524('0x9c')][_0xe524('0x40')](_0x33906d[_0xe524('0x9d')](),_0x1c8e57)[_0xe524('0x2d')](function(_0x2a8b4e){var _0x262991=_['groupBy'](_0x2a8b4e,'WhatsappInteractionId');var _0x46883b=[];_0x1584a7[_0xe524('0x6f')](function(_0x589aef){_0x46883b['push'](updateWhatsappInteraction(_0x589aef,_0x1ae283,_0x262991));});return BPromise[_0xe524('0xaf')](_0x46883b);});});})[_0xe524('0x2d')](function(_0x30fa81){_0x13cda8[_0xe524('0xb0')]=_0x30fa81;return _0x13cda8;})[_0xe524('0x2d')](respondWithFilteredResult(_0x415450,_0xcf8060))[_0xe524('0x38')](handleError(_0x415450,null));};exports['show']=function(_0x555801,_0x3e8668){var _0x390093={'raw':![],'where':{'id':_0x555801[_0xe524('0xb1')]['id']}},_0x21b60a={};_0x21b60a[_0xe524('0x3e')]=_[_0xe524('0x3f')](db[_0xe524('0x3a')][_0xe524('0x3b')]);_0x21b60a['query']=_[_0xe524('0x3f')](_0x555801[_0xe524('0x40')]);_0x21b60a[_0xe524('0x41')]=_['intersection'](_0x21b60a['model'],_0x21b60a[_0xe524('0x40')]);_0x390093[_0xe524('0x43')]=_[_0xe524('0x42')](_0x21b60a[_0xe524('0x3e')],qs['fields'](_0x555801[_0xe524('0x40')][_0xe524('0x44')]));_0x390093[_0xe524('0x43')]=_0x390093[_0xe524('0x43')][_0xe524('0x45')]?_0x390093['attributes']:_0x21b60a[_0xe524('0x3e')];if(_0x555801['query'][_0xe524('0xb2')]){_0x390093[_0xe524('0xb3')]=[{'all':!![]}];}_0x390093=_['merge']({},_0x390093,_0x555801[_0xe524('0xb4')]);return db[_0xe524('0x3a')]['find'](_0x390093)[_0xe524('0x2d')](handleEntityNotFound(_0x3e8668,null))['then'](respondWithResult(_0x3e8668,null))[_0xe524('0x38')](handleError(_0x3e8668,null));};exports[_0xe524('0xb5')]=function(_0x1be681,_0x328f84){return db[_0xe524('0x3a')][_0xe524('0xb5')](_0x1be681[_0xe524('0x73')],{})[_0xe524('0x2d')](respondWithResult(_0x328f84,0xc9))['catch'](handleError(_0x328f84,null));};exports[_0xe524('0xb6')]=function(_0x5a5789,_0x4f7bf1){if(_0x5a5789[_0xe524('0x73')]['id']){delete _0x5a5789['body']['id'];}return db[_0xe524('0x3a')][_0xe524('0x5f')]({'where':{'id':_0x5a5789[_0xe524('0xb1')]['id']}})[_0xe524('0x2d')](handleEntityNotFound(_0x4f7bf1,null))[_0xe524('0x2d')](saveUpdates(_0x5a5789[_0xe524('0x73')],null))['then'](respondWithResult(_0x4f7bf1,null))['catch'](handleError(_0x4f7bf1,null));};exports[_0xe524('0x2e')]=function(_0x1b4f38,_0x2fbdb7){return db[_0xe524('0x3a')][_0xe524('0x5f')]({'where':{'id':_0x1b4f38[_0xe524('0xb1')]['id']}})[_0xe524('0x2d')](handleEntityNotFound(_0x2fbdb7,null))[_0xe524('0x2d')](removeEntity(_0x2fbdb7,null))[_0xe524('0x38')](handleError(_0x2fbdb7,null));};exports[_0xe524('0xb7')]=function(_0x5c5ef4,_0x2431b5){return db[_0xe524('0x3a')][_0xe524('0xb7')]()[_0xe524('0x2d')](respondWithResult(_0x2431b5,null))[_0xe524('0x38')](handleError(_0x2431b5,null));};exports[_0xe524('0xb8')]=function(_0x58c1e3,_0x1cc750,_0x43f3bf){return db[_0xe524('0xb9')][_0xe524('0x5f')]({'where':{'id':_0x58c1e3[_0xe524('0xb1')]['id']}})[_0xe524('0x2d')](handleEntityNotFound(_0x1cc750,null))[_0xe524('0x2d')](function(_0x524e9e){if(_0x524e9e){return _0x524e9e['addMessage'](_0x58c1e3['body']['ids'],_[_0xe524('0xba')](_0x58c1e3[_0xe524('0x73')],['ids','id'])||{});}})[_0xe524('0x2d')](respondWithResult(_0x1cc750,null))[_0xe524('0x38')](handleError(_0x1cc750,null));};exports['getMessages']=function(_0x1529ea,_0xf63d29,_0x4ed1a6){var _0x1b3c48={'raw':![],'where':{}};var _0x16f5bc={};var _0x39bc6f={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xe524('0xbb')]({'where':{'id':_0x1529ea[_0xe524('0xb1')]['id']}})[_0xe524('0x2d')](handleEntityNotFound(_0xf63d29,null))['then'](function(_0x1aaeca){if(_0x1aaeca){_0x16f5bc[_0xe524('0x3e')]=_[_0xe524('0x3f')](db[_0xe524('0xb9')]['rawAttributes']);_0x16f5bc['query']=_[_0xe524('0x3f')](_0x1529ea[_0xe524('0x40')]);_0x16f5bc[_0xe524('0x41')]=_[_0xe524('0x42')](_0x16f5bc[_0xe524('0x3e')],_0x16f5bc[_0xe524('0x40')]);_0x1b3c48[_0xe524('0x43')]=_[_0xe524('0x42')](_0x16f5bc[_0xe524('0x3e')],qs[_0xe524('0x44')](_0x1529ea[_0xe524('0x40')][_0xe524('0x44')]));_0x1b3c48[_0xe524('0x43')]=_0x1b3c48['attributes'][_0xe524('0x45')]?_0x1b3c48[_0xe524('0x43')]:_0x16f5bc[_0xe524('0x3e')];if(!_0x1529ea[_0xe524('0x40')][_0xe524('0x46')](_0xe524('0x47'))){_0x1b3c48['limit']=qs['limit'](_0x1529ea[_0xe524('0x40')]['limit']);_0x1b3c48[_0xe524('0x25')]=qs[_0xe524('0x25')](_0x1529ea[_0xe524('0x40')][_0xe524('0x25')]);}_0x1b3c48[_0xe524('0x48')]=qs[_0xe524('0x49')](_0x1529ea[_0xe524('0x40')]['sort']);_0x1b3c48[_0xe524('0x4a')]=qs[_0xe524('0x41')](_[_0xe524('0x4b')](_0x1529ea[_0xe524('0x40')],_0x16f5bc['filters']));_0x1b3c48[_0xe524('0x4a')][_0xe524('0xbc')]=_0x1aaeca['id'];if(_0x1529ea['query'][_0xe524('0x87')]){_0x1b3c48[_0xe524('0x4a')]=_['merge'](_0x1b3c48['where'],{'$or':_[_0xe524('0x33')](_0x1b3c48[_0xe524('0x43')],function(_0x575c14){var _0x5d2a54={};_0x5d2a54[_0x575c14]={'$like':'%'+_0x1529ea[_0xe524('0x40')]['filter']+'%'};return _0x5d2a54;})});}if(_0x1529ea['query']['$gte']){var _0x337e25=_0x1529ea[_0xe524('0x40')][_0xe524('0x7c')][_0xe524('0x36')](',');var _0x5718a6={};_0x5718a6[_0x337e25[0x0]]={'$gte':moment(_0x337e25[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x1b3c48[_0xe524('0x4a')]=_[_0xe524('0xbd')](_0x1b3c48[_0xe524('0x4a')],_0x5718a6);}_0x1b3c48=_[_0xe524('0xbd')]({},_0x1b3c48,_0x1529ea[_0xe524('0xb4')]);return db[_0xe524('0xb9')][_0xe524('0x24')]({'where':_0x1b3c48[_0xe524('0x4a')]})['then'](function(_0x1d57f6){_0x39bc6f[_0xe524('0x24')]=_0x1d57f6;if(_0x1529ea[_0xe524('0x40')][_0xe524('0xb2')]){_0x1b3c48[_0xe524('0xb3')]=[{'all':!![]}];}return db[_0xe524('0xb9')][_0xe524('0xbe')](_0x1b3c48);})[_0xe524('0x2d')](function(_0x117120){_0x39bc6f[_0xe524('0xb0')]=_0x117120;return _0x39bc6f;});}})['then'](respondWithFilteredResult(_0xf63d29,_0x1b3c48))[_0xe524('0x38')](handleError(_0xf63d29,null));};exports[_0xe524('0xbf')]=function(_0xb499ea,_0x188b33,_0x1c59b9){return db[_0xe524('0x3a')][_0xe524('0x5f')]({'where':{'id':_0xb499ea[_0xe524('0xb1')]['id']}})['then'](handleEntityNotFound(_0x188b33,null))[_0xe524('0x2d')](function(_0xbf41a2){if(_0xbf41a2){return _0xbf41a2[_0xe524('0xc0')](_0xb499ea[_0xe524('0x73')][_0xe524('0xc1')],_[_0xe524('0xba')](_0xb499ea[_0xe524('0x73')],[_0xe524('0xc1'),'id'])||{})[_0xe524('0xc2')](function(){return db[_0xe524('0x6e')][_0xe524('0xbe')]({'attributes':['id',_0xe524('0x31'),'color'],'where':{'id':_0xb499ea[_0xe524('0x73')][_0xe524('0xc1')]}});})[_0xe524('0x2d')](function(_0x526082){socket['emit'](_0xe524('0xc3'),{'id':Number(_0xb499ea[_0xe524('0xb1')]['id']),'tags':_0x526082||[]});return{'id':Number(_0xb499ea[_0xe524('0xb1')]['id']),'tags':_0x526082||[]};});}})['then'](respondWithResult(_0x188b33,null))[_0xe524('0x38')](handleError(_0x188b33,null));};exports[_0xe524('0xc4')]=function(_0x339572,_0x541b33,_0x4952b9){return db[_0xe524('0x3a')][_0xe524('0x5f')]({'where':{'id':_0x339572[_0xe524('0xb1')]['id']}})['then'](handleEntityNotFound(_0x541b33,null))[_0xe524('0x2d')](function(_0x37f1ad){if(_0x37f1ad){return _0x37f1ad[_0xe524('0xc4')](_0x339572[_0xe524('0x40')][_0xe524('0xc1')]);}})[_0xe524('0x2d')](respondWithStatusCode(_0x541b33,null))[_0xe524('0x38')](handleError(_0x541b33,null));};exports['download']=function(_0x38a6df,_0x2c2eb2){var _0x20baec=moment()[_0xe524('0xc5')]()[_0xe524('0x9d')]();var _0x4d44a6=path[_0xe524('0xc6')](config[_0xe524('0xc7')],'server',_0xe524('0xc8'),_0xe524('0xc9'));var _0x1013f2=path[_0xe524('0xc6')](config[_0xe524('0xc7')],_0xe524('0xca'),_0xe524('0xc8'),_0xe524('0xcb'));var _0x44e73e=path['join'](_0x4d44a6,_0x20baec);var _0x53eb8d=util[_0xe524('0xcc')](_0xe524('0xcd'),_0x38a6df[_0xe524('0xb1')]['id'],_0x20baec);var _0x2f6b8=path[_0xe524('0xc6')](_0x4d44a6,_0x53eb8d);var _0x427752=[];_0x427752[_0xe524('0x37')]({'model':db['User'],'as':'User','attributes':['id',_0xe524('0x34')],'raw':!![]});_0x427752['push']({'model':db['CmContact'],'as':_0xe524('0x64'),'attributes':['id',_0xe524('0xce'),_0xe524('0xcf')],'raw':!![]});if(_0x38a6df[_0xe524('0x40')][_0xe524('0xcb')]){_0x427752[_0xe524('0x37')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x46e4d8=[{'model':db[_0xe524('0xb9')],'as':_0xe524('0xd0'),'attributes':['id','body',_0xe524('0x7a'),_0xe524('0xd1'),_0xe524('0xd2'),_0xe524('0x82')],'include':_0x427752}];_0x46e4d8['push']({'model':db['WhatsappAccount'],'as':_0xe524('0xd3'),'attributes':['id','name']});_0x46e4d8[_0xe524('0x37')]({'model':db[_0xe524('0xd4')],'as':_0xe524('0xd5'),'attributes':['id',_0xe524('0x34')]});return db[_0xe524('0x3a')][_0xe524('0x5f')]({'where':{'id':_0x38a6df[_0xe524('0xb1')]['id']},'include':_0x46e4d8})[_0xe524('0x2d')](handleEntityNotFound(_0x2c2eb2,null))[_0xe524('0x2d')](function(_0x165241){if(_0x165241){var _0x5f0baa=_0x165241[_0xe524('0xd6')]({'plain':!![]});fs[_0xe524('0xd7')](_0x44e73e);var _0x3a78fe={'format':'A4','border':'10px','header':{'height':_0xe524('0xd8'),'contents':{'first':'\x0a\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\x20\x20\x20
Interaction\x20Transcript
\x0a\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\x20'}},'footer':{'height':_0xe524('0xd9'),'contents':{'default':util['format'](_0xe524('0xda'),util['format'](_0xe524('0xdb'),'Whatsapp',_0x5f0baa['id']),moment()[_0xe524('0xcc')]('YYYY-MM-DD')['toString']())}}};var _0x5da172={'channel':'Whatsapp','account':_0x5f0baa[_0xe524('0xd3')][_0xe524('0x31')],'agent':_0x5f0baa[_0xe524('0xd5')]?_0x5f0baa['Owner'][_0xe524('0x34')]:'N.A.','createdAt':moment(_0x5f0baa[_0xe524('0x7a')])[_0xe524('0xcc')](_0xe524('0xdc'))[_0xe524('0x9d')](),'closedAt':_0x5f0baa['closed']?moment(_0x5f0baa['closedAt'])[_0xe524('0xcc')](_0xe524('0xdc'))[_0xe524('0x9d')]():'','disposition':_0x5f0baa[_0xe524('0xdd')],'messages':_(_0x5f0baa[_0xe524('0xd0')])['filter']({'secret':![]})[_0xe524('0x33')](function(_0x3340fa){if(_0x3340fa['Attachment']){var _0x320b6b=path[_0xe524('0xc6')](_0x1013f2,_0x3340fa[_0xe524('0xde')][_0xe524('0xdf')]);if(fs[_0xe524('0xe0')](_0x320b6b)){fs[_0xe524('0xe1')](_0x320b6b)[_0xe524('0xe2')](fs[_0xe524('0xe3')](path[_0xe524('0xc6')](_0x44e73e,_0x3340fa[_0xe524('0xde')][_0xe524('0xdf')])));}}return{'date':moment(_0x3340fa[_0xe524('0x7a')])[_0xe524('0xcc')](_0xe524('0xdc'))['toString'](),'sender':_0x3340fa[_0xe524('0xd1')]===_0xe524('0xe4')?_0x3340fa['User']?_0x3340fa[_0xe524('0xd4')][_0xe524('0x34')]:_0xe524('0xe5'):_0x3340fa[_0xe524('0x64')][_0xe524('0xce')]+(_0x3340fa[_0xe524('0x64')][_0xe524('0xcf')]?'\x20'+_0x3340fa[_0xe524('0x64')]['lastName']:''),'body':_0x3340fa['Attachment']?_0x3340fa[_0xe524('0xde')][_0xe524('0xdf')]:_0x3340fa['body'],'direction':_0x3340fa[_0xe524('0xd1')]===_0xe524('0xe4')?'A':'C','secret':_0x3340fa[_0xe524('0xd2')],'read':_0x3340fa['read'],'attachment':_0x3340fa['Attachment']};})['value']()};return ejs[_0xe524('0xe6')](path[_0xe524('0xc6')](config[_0xe524('0xc7')],'server',_0xe524('0xe7'),'downloadInteraction.html'),{'interaction':_0x5da172})[_0xe524('0x2d')](function(_0x2667bc){return new BPromise(function(_0x4f4cfd,_0x1c8e99){pdf[_0xe524('0xb5')](_0x2667bc,_0x3a78fe)[_0xe524('0xe8')](path[_0xe524('0xc6')](_0x44e73e,_0xe524('0xe9')+_0x5f0baa['id']+'-'+_0x20baec+_0xe524('0xea')),function(_0x2cd25d,_0x4c8cac){if(_0x2cd25d)return _0x1c8e99(_0x2cd25d);_0x4f4cfd(_0x4c8cac);});});})['then'](function(){return new BPromise(function(_0x551b0b,_0x49baca){zipdir(_0x44e73e,{'saveTo':_0x2f6b8},function(_0x297446,_0x1208c4){if(_0x297446)return _0x49baca(_0x297446);return _0x551b0b(_0x1208c4);});})[_0xe524('0x2d')](function(){return new BPromise(function(_0x2288a8,_0x3d56dd){rimraf(_0x44e73e,function(_0x293bed){if(_0x293bed)_0x3d56dd(_0x293bed);return _0x2288a8();});});})['then'](function(){return _0x2c2eb2[_0xe524('0xeb')](_0x2f6b8,_0x53eb8d,function(_0x59cb98){if(_0x59cb98){console[_0xe524('0xec')](_0xe524('0xed'),_0x59cb98);}else{fs[_0xe524('0xee')](_0x2f6b8);}});});});}else{return _0x2c2eb2['sendStatus'](0xc8);}})[_0xe524('0x38')](handleError(_0x2c2eb2,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 6f176b4..b0bded5 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 _0x3ee7=['events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','unreadMessages','length','emit','hasOwnProperty','exports'];(function(_0x28fbe3,_0x4ac6f8){var _0x45db6a=function(_0x296ecb){while(--_0x296ecb){_0x28fbe3['push'](_0x28fbe3['shift']());}};_0x45db6a(++_0x4ac6f8);}(_0x3ee7,0xe1));var _0x73ee=function(_0x1e6a20,_0x493dbb){_0x1e6a20=_0x1e6a20-0x0;var _0xfdea1e=_0x3ee7[_0x1e6a20];return _0xfdea1e;};'use strict';var EventEmitter=require(_0x73ee('0x0'));var WhatsappInteraction=require(_0x73ee('0x1'))['db'][_0x73ee('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x73ee('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x73ee('0x4')](0x0);var events={'afterCreate':_0x73ee('0x5'),'afterUpdate':'update','afterDestroy':_0x73ee('0x6')};function emitEvent(_0x5427ef){return function(_0x2bfb20,_0x23d233,_0x302ca1){_0x2bfb20[_0x73ee('0x7')]({'attributes':['id'],'raw':!![]})[_0x73ee('0x8')](function(_0x32d107){_0x2bfb20['setDataValue']('Users',_0x32d107['map'](function(_0x27f40a){return{'id':_0x27f40a['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x2bfb20['id'],'direction':'in','read':![]},'raw':!![]});})[_0x73ee('0x8')](function(_0xc418a){_0x2bfb20[_0x73ee('0x9')](_0x73ee('0xa'),_0xc418a[_0x73ee('0xb')]);WhatsappInteractionEvents[_0x73ee('0xc')](_0x5427ef+':'+_0x2bfb20['id'],_0x2bfb20);WhatsappInteractionEvents[_0x73ee('0xc')](_0x5427ef,_0x2bfb20);_0x302ca1(null);})['catch'](_0x302ca1(null));};}for(var e in events){if(events[_0x73ee('0xd')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x73ee('0xe')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x8332=['catch','hook','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','length','emit'];(function(_0x19fccb,_0x3e95a9){var _0x3d9cd5=function(_0x56efd8){while(--_0x56efd8){_0x19fccb['push'](_0x19fccb['shift']());}};_0x3d9cd5(++_0x3e95a9);}(_0x8332,0x134));var _0x2833=function(_0x1975d,_0x59bbeb){_0x1975d=_0x1975d-0x0;var _0x4451dc=_0x8332[_0x1975d];return _0x4451dc;};'use strict';var EventEmitter=require(_0x2833('0x0'));var WhatsappInteraction=require(_0x2833('0x1'))['db'][_0x2833('0x2')];var WhatsappMessage=require('../../mysqldb')['db'][_0x2833('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x2833('0x4')](0x0);var events={'afterCreate':_0x2833('0x5'),'afterUpdate':_0x2833('0x6'),'afterDestroy':_0x2833('0x7')};function emitEvent(_0x1877a3){return function(_0x47586e,_0x180782,_0x57c98c){_0x47586e[_0x2833('0x8')]({'attributes':['id'],'raw':!![]})[_0x2833('0x9')](function(_0x46240c){_0x47586e[_0x2833('0xa')](_0x2833('0xb'),_0x46240c['map'](function(_0x8e1db){return{'id':_0x8e1db['id']};}));return WhatsappMessage[_0x2833('0xc')]({'where':{'WhatsappInteractionId':_0x47586e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2833('0x9')](function(_0x524d6a){_0x47586e['setDataValue'](_0x2833('0xd'),_0x524d6a[_0x2833('0xe')]);WhatsappInteractionEvents[_0x2833('0xf')](_0x1877a3+':'+_0x47586e['id'],_0x47586e);WhatsappInteractionEvents[_0x2833('0xf')](_0x1877a3,_0x47586e);_0x57c98c(null);})[_0x2833('0x10')](_0x57c98c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x2833('0x11')](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 0e36b10..8647a59 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 _0xe78a=['bluebird','request-promise','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xe78a,0x173));var _0xae78=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe78a[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0xae78('0x0'));var logger=require(_0xae78('0x1'))(_0xae78('0x2'));var moment=require(_0xae78('0x3'));var BPromise=require(_0xae78('0x4'));var rp=require(_0xae78('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xae78('0x6'));module[_0xae78('0x7')]=function(_0xfec8ba,_0x3cc22b){return _0xfec8ba[_0xae78('0x8')](_0xae78('0x9'),attributes,{'tableName':_0xae78('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3f2717,_0x461790,_0xd98322){if(_0x3f2717[_0xae78('0xb')](_0xae78('0xc'))){_0x3f2717[_0xae78('0xd')]=moment()['format'](_0xae78('0xe'));}_0xd98322(null,_0x3f2717);}}});}; \ No newline at end of file +var _0xfa32=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','WhatsappInteraction','whatsapp_interactions'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xfa32,0x105));var _0x2fa3=function(_0x28a1e4,_0x36b53c){_0x28a1e4=_0x28a1e4-0x0;var _0x1c1cca=_0xfa32[_0x28a1e4];return _0x1c1cca;};'use strict';var _=require(_0x2fa3('0x0'));var util=require(_0x2fa3('0x1'));var logger=require('../../config/logger')(_0x2fa3('0x2'));var moment=require('moment');var BPromise=require(_0x2fa3('0x3'));var rp=require(_0x2fa3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2fa3('0x5'));var config=require(_0x2fa3('0x6'));var attributes=require('./whatsappInteraction.attributes');module[_0x2fa3('0x7')]=function(_0x48dac3,_0x405af1){return _0x48dac3[_0x2fa3('0x8')](_0x2fa3('0x9'),attributes,{'tableName':_0x2fa3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x562782,_0x1bcb90,_0xd617bf){if(_0x562782[_0x2fa3('0xb')](_0x2fa3('0xc'))){_0x562782[_0x2fa3('0xd')]=moment()[_0x2fa3('0xe')](_0x2fa3('0xf'));}_0xd617bf(null,_0x562782);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 3079f77..6953d53 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 _0xb2e5=['error','code','message','info','result','WhatsappInteraction','update','body','options','raw','where','attributes','limit','UpdateWhatsappInteraction','catch','AddTagsToWhatsappInteraction','find','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2f4791,_0x8fe6c5){var _0x3b82e1=function(_0x57c6f1){while(--_0x57c6f1){_0x2f4791['push'](_0x2f4791['shift']());}};_0x3b82e1(++_0x8fe6c5);}(_0xb2e5,0x1bc));var _0x5b2e=function(_0x27f82e,_0x2259d7){_0x27f82e=_0x27f82e-0x0;var _0x1e36ef=_0xb2e5[_0x27f82e];return _0x1e36ef;};'use strict';var _=require(_0x5b2e('0x0'));var util=require(_0x5b2e('0x1'));var moment=require(_0x5b2e('0x2'));var BPromise=require(_0x5b2e('0x3'));var rs=require(_0x5b2e('0x4'));var fs=require('fs');var Redis=require(_0x5b2e('0x5'));var db=require(_0x5b2e('0x6'))['db'];var utils=require(_0x5b2e('0x7'));var logger=require('../../config/logger')(_0x5b2e('0x8'));var config=require(_0x5b2e('0x9'));var jayson=require(_0x5b2e('0xa'));var client=jayson[_0x5b2e('0xb')][_0x5b2e('0xc')]({'port':0x232a});config[_0x5b2e('0xd')]=_[_0x5b2e('0xe')](config[_0x5b2e('0xd')],{'host':_0x5b2e('0xf'),'port':0x18eb});var socket=require(_0x5b2e('0x10'))(new Redis(config[_0x5b2e('0xd')]));require(_0x5b2e('0x11'))[_0x5b2e('0x12')](socket);function respondWithRpcPromise(_0x47e838,_0xfcab5,_0x448dd6){return new BPromise(function(_0x16cc6e,_0xa6e5ea){return client[_0x5b2e('0x13')](_0x47e838,_0x448dd6)[_0x5b2e('0x14')](function(_0x577095){logger['info'](_0x5b2e('0x15'),_0xfcab5,_0x5b2e('0x16'));logger[_0x5b2e('0x17')](_0x5b2e('0x18'),_0xfcab5,_0x5b2e('0x16'),JSON[_0x5b2e('0x19')](_0x577095));if(_0x577095[_0x5b2e('0x1a')]){if(_0x577095[_0x5b2e('0x1a')][_0x5b2e('0x1b')]===0x1f4){logger[_0x5b2e('0x1a')](_0x5b2e('0x15'),_0xfcab5,_0x577095[_0x5b2e('0x1a')][_0x5b2e('0x1c')]);return _0xa6e5ea(_0x577095[_0x5b2e('0x1a')][_0x5b2e('0x1c')]);}logger[_0x5b2e('0x1a')](_0x5b2e('0x15'),_0xfcab5,_0x577095['error'][_0x5b2e('0x1c')]);return _0x16cc6e(_0x577095[_0x5b2e('0x1a')][_0x5b2e('0x1c')]);}else{logger[_0x5b2e('0x1d')]('WhatsappInteraction,\x20%s,\x20%s',_0xfcab5,_0x5b2e('0x16'));_0x16cc6e(_0x577095[_0x5b2e('0x1e')][_0x5b2e('0x1c')]);}})['catch'](function(_0x38b457){logger[_0x5b2e('0x1a')]('WhatsappInteraction,\x20%s,\x20%s',_0xfcab5,_0x38b457);_0xa6e5ea(_0x38b457);});});}exports['UpdateWhatsappInteraction']=function(_0x492459){var _0x4cb722=this;return new Promise(function(_0xb76300,_0x1035a6){return db[_0x5b2e('0x1f')][_0x5b2e('0x20')](_0x492459[_0x5b2e('0x21')],{'raw':_0x492459['options']?_0x492459[_0x5b2e('0x22')][_0x5b2e('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x492459[_0x5b2e('0x22')]?_0x492459[_0x5b2e('0x22')][_0x5b2e('0x24')]||null:null,'attributes':_0x492459[_0x5b2e('0x22')]?_0x492459[_0x5b2e('0x22')][_0x5b2e('0x25')]||null:null,'limit':_0x492459['options']?_0x492459['options'][_0x5b2e('0x26')]||null:null})[_0x5b2e('0x14')](function(_0x20cd88){logger['info'](_0x5b2e('0x27'),_0x492459);logger[_0x5b2e('0x17')](_0x5b2e('0x27'),_0x492459,JSON['stringify'](_0x20cd88));_0xb76300(_0x20cd88);})[_0x5b2e('0x28')](function(_0x477a6c){logger[_0x5b2e('0x1a')](_0x5b2e('0x27'),_0x477a6c[_0x5b2e('0x1c')],_0x492459);_0x1035a6(_0x4cb722[_0x5b2e('0x1a')](0x1f4,_0x477a6c[_0x5b2e('0x1c')]));});});};exports[_0x5b2e('0x29')]=function(_0x39fafd){return new Promise(function(_0xa69b50,_0x36a183){return db[_0x5b2e('0x1f')][_0x5b2e('0x2a')]({'where':_0x39fafd[_0x5b2e('0x22')]?_0x39fafd[_0x5b2e('0x22')][_0x5b2e('0x24')]||null:null})[_0x5b2e('0x14')](function(_0x4d756a){if(_0x4d756a){return _0x4d756a[_0x5b2e('0x2b')](_0x39fafd['body']['ids'],_['omit'](_0x39fafd[_0x5b2e('0x21')],[_0x5b2e('0x2c'),'id'])||{});}})[_0x5b2e('0x2d')](function(_0x2885a1){logger[_0x5b2e('0x1d')](_0x5b2e('0x2e'),_0x39fafd);logger[_0x5b2e('0x17')](_0x5b2e('0x2e'),_0x39fafd,JSON[_0x5b2e('0x19')](_0x2885a1));_0xa69b50(_0x2885a1);})[_0x5b2e('0x28')](function(_0x3d30e0){logger['error'](_0x5b2e('0x2e'),_0x3d30e0[_0x5b2e('0x1c')],_0x39fafd);_0x36a183(_this[_0x5b2e('0x1a')](0x1f4,_0x3d30e0[_0x5b2e('0x1c')]));});});}; \ No newline at end of file +var _0x1d07=['omit','spread','AddTags','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','where','attributes','AddTagsToWhatsappInteraction','find','addTags','body','ids'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d07,0x1b1));var _0x71d0=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x1d07[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var util=require(_0x71d0('0x0'));var moment=require('moment');var BPromise=require(_0x71d0('0x1'));var rs=require(_0x71d0('0x2'));var fs=require('fs');var Redis=require(_0x71d0('0x3'));var db=require(_0x71d0('0x4'))['db'];var utils=require(_0x71d0('0x5'));var logger=require(_0x71d0('0x6'))('rpc');var config=require(_0x71d0('0x7'));var jayson=require(_0x71d0('0x8'));var client=jayson[_0x71d0('0x9')][_0x71d0('0xa')]({'port':0x232a});config[_0x71d0('0xb')]=_[_0x71d0('0xc')](config[_0x71d0('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x71d0('0xd'))(new Redis(config[_0x71d0('0xb')]));require(_0x71d0('0xe'))[_0x71d0('0xf')](socket);function respondWithRpcPromise(_0x77f8bf,_0x26630b,_0x191068){return new BPromise(function(_0x514e84,_0x3a2a2a){return client[_0x71d0('0x10')](_0x77f8bf,_0x191068)[_0x71d0('0x11')](function(_0x4e4393){logger[_0x71d0('0x12')](_0x71d0('0x13'),_0x26630b,_0x71d0('0x14'));logger[_0x71d0('0x15')](_0x71d0('0x16'),_0x26630b,'request\x20sent',JSON[_0x71d0('0x17')](_0x4e4393));if(_0x4e4393['error']){if(_0x4e4393[_0x71d0('0x18')][_0x71d0('0x19')]===0x1f4){logger[_0x71d0('0x18')](_0x71d0('0x13'),_0x26630b,_0x4e4393[_0x71d0('0x18')]['message']);return _0x3a2a2a(_0x4e4393[_0x71d0('0x18')][_0x71d0('0x1a')]);}logger[_0x71d0('0x18')]('WhatsappInteraction,\x20%s,\x20%s',_0x26630b,_0x4e4393[_0x71d0('0x18')][_0x71d0('0x1a')]);return _0x514e84(_0x4e4393['error'][_0x71d0('0x1a')]);}else{logger['info'](_0x71d0('0x13'),_0x26630b,_0x71d0('0x14'));_0x514e84(_0x4e4393[_0x71d0('0x1b')][_0x71d0('0x1a')]);}})[_0x71d0('0x1c')](function(_0x46bd3e){logger[_0x71d0('0x18')](_0x71d0('0x13'),_0x26630b,_0x46bd3e);_0x3a2a2a(_0x46bd3e);});});}exports[_0x71d0('0x1d')]=function(_0x4bbd91){var _0xedf5d3=this;return new Promise(function(_0x3d0336,_0x303076){return db[_0x71d0('0x1e')][_0x71d0('0x1f')](_0x4bbd91['body'],{'raw':_0x4bbd91[_0x71d0('0x20')]?_0x4bbd91['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bbd91['options']?_0x4bbd91[_0x71d0('0x20')][_0x71d0('0x21')]||null:null,'attributes':_0x4bbd91['options']?_0x4bbd91[_0x71d0('0x20')][_0x71d0('0x22')]||null:null,'limit':_0x4bbd91['options']?_0x4bbd91[_0x71d0('0x20')]['limit']||null:null})[_0x71d0('0x11')](function(_0x392daa){logger[_0x71d0('0x12')](_0x71d0('0x1d'),_0x4bbd91);logger['debug'](_0x71d0('0x1d'),_0x4bbd91,JSON[_0x71d0('0x17')](_0x392daa));_0x3d0336(_0x392daa);})[_0x71d0('0x1c')](function(_0x21ab1f){logger[_0x71d0('0x18')](_0x71d0('0x1d'),_0x21ab1f[_0x71d0('0x1a')],_0x4bbd91);_0x303076(_0xedf5d3[_0x71d0('0x18')](0x1f4,_0x21ab1f['message']));});});};exports[_0x71d0('0x23')]=function(_0x3d2069){return new Promise(function(_0x32a073,_0xe85fcf){return db[_0x71d0('0x1e')][_0x71d0('0x24')]({'where':_0x3d2069[_0x71d0('0x20')]?_0x3d2069[_0x71d0('0x20')][_0x71d0('0x21')]||null:null})[_0x71d0('0x11')](function(_0x23bf03){if(_0x23bf03){return _0x23bf03[_0x71d0('0x25')](_0x3d2069[_0x71d0('0x26')][_0x71d0('0x27')],_[_0x71d0('0x28')](_0x3d2069['body'],['ids','id'])||{});}})[_0x71d0('0x29')](function(_0x5c0d6d){logger[_0x71d0('0x12')](_0x71d0('0x2a'),_0x3d2069);logger[_0x71d0('0x15')](_0x71d0('0x2a'),_0x3d2069,JSON[_0x71d0('0x17')](_0x5c0d6d));_0x32a073(_0x5c0d6d);})[_0x71d0('0x1c')](function(_0x305e3d){logger['error'](_0x71d0('0x2a'),_0x305e3d[_0x71d0('0x1a')],_0x3d2069);_0xe85fcf(_this[_0x71d0('0x18')](0x1f4,_0x305e3d[_0x71d0('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 6267de7..9855cd8 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 _0xf93f=['remove','update','register','save'];(function(_0x1231d3,_0x2ea4f8){var _0x92313c=function(_0xbf128e){while(--_0xbf128e){_0x1231d3['push'](_0x1231d3['shift']());}};_0x92313c(++_0x2ea4f8);}(_0xf93f,0x12f));var _0xff93=function(_0x153840,_0x4f7893){_0x153840=_0x153840-0x0;var _0x1ddf7f=_0xf93f[_0x153840];return _0x1ddf7f;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0xff93('0x0'),_0xff93('0x1'),_0xff93('0x2')];function createListener(_0x280172,_0x2b4f24){return function(_0x292703){_0x2b4f24['emit'](_0x280172,_0x292703);};}function removeListener(_0x4a09c5,_0x3e8fd3){return function(){WhatsappInteractionEvents['removeListener'](_0x4a09c5,_0x3e8fd3);};}exports[_0xff93('0x3')]=function(_0x259bf1){for(var _0x3b0a28=0x0,_0x30d8fc=events['length'];_0x3b0a28<_0x30d8fc;_0x3b0a28++){var _0x4e3da6=events[_0x3b0a28];var _0x1b4818=createListener('whatsappInteraction:'+_0x4e3da6,_0x259bf1);WhatsappInteractionEvents['on'](_0x4e3da6,_0x1b4818);}}; \ No newline at end of file +var _0x2557=['removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','remove','update','emit'];(function(_0x5541b3,_0x2c8973){var _0x5884aa=function(_0x47fb48){while(--_0x47fb48){_0x5541b3['push'](_0x5541b3['shift']());}};_0x5884aa(++_0x2c8973);}(_0x2557,0x84));var _0x7255=function(_0x1728fa,_0x185b41){_0x1728fa=_0x1728fa-0x0;var _0x3fa837=_0x2557[_0x1728fa];return _0x3fa837;};'use strict';var WhatsappInteractionEvents=require(_0x7255('0x0'));var events=['save',_0x7255('0x1'),_0x7255('0x2')];function createListener(_0x123ae7,_0x237702){return function(_0x453fd5){_0x237702[_0x7255('0x3')](_0x123ae7,_0x453fd5);};}function removeListener(_0x178700,_0x377bfd){return function(){WhatsappInteractionEvents[_0x7255('0x4')](_0x178700,_0x377bfd);};}exports[_0x7255('0x5')]=function(_0x4b7ed5){for(var _0x2eb6a7=0x0,_0x191452=events[_0x7255('0x6')];_0x2eb6a7<_0x191452;_0x2eb6a7++){var _0x38a97d=events[_0x2eb6a7];var _0x2d15c1=createListener(_0x7255('0x7')+_0x38a97d,_0x4b7ed5);WhatsappInteractionEvents['on'](_0x38a97d,_0x2d15c1);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 089a333..8cbc51e 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 _0xabf2=['post','/:id/status','update','put','/:id/accept','accept','/:id/reject','reject','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','index','get','/describe','describe','/:id','isAuthenticated','tracked','create'];(function(_0x1bd5f2,_0x10740c){var _0x242c9a=function(_0x67ca9e){while(--_0x67ca9e){_0x1bd5f2['push'](_0x1bd5f2['shift']());}};_0x242c9a(++_0x10740c);}(_0xabf2,0x8a));var _0x2abf=function(_0x43f3e3,_0x299b71){_0x43f3e3=_0x43f3e3-0x0;var _0x143d4d=_0xabf2[_0x43f3e3];return _0x143d4d;};'use strict';var multer=require(_0x2abf('0x0'));var util=require(_0x2abf('0x1'));var path=require(_0x2abf('0x2'));var timeout=require(_0x2abf('0x3'));var express=require(_0x2abf('0x4'));var router=express[_0x2abf('0x5')]();var auth=require(_0x2abf('0x6'));var interaction=require(_0x2abf('0x7'));var config=require(_0x2abf('0x8'));var controller=require(_0x2abf('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x2abf('0xa')]);router[_0x2abf('0xb')](_0x2abf('0xc'),auth['isAuthenticated'](),controller[_0x2abf('0xd')]);router[_0x2abf('0xb')](_0x2abf('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x2abf('0xf')](),interaction[_0x2abf('0x10')]('whatsapp','whatsappmessage:create'),controller[_0x2abf('0x11')]);router[_0x2abf('0x12')](_0x2abf('0x13'),controller['status']);router['put']('/:id',auth[_0x2abf('0xf')](),controller[_0x2abf('0x14')]);router[_0x2abf('0x15')](_0x2abf('0x16'),auth[_0x2abf('0xf')](),controller[_0x2abf('0x17')]);router[_0x2abf('0x15')](_0x2abf('0x18'),auth[_0x2abf('0xf')](),controller[_0x2abf('0x19')]);router['delete'](_0x2abf('0xe'),auth[_0x2abf('0xf')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x85a2=['whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','whatsapp'];(function(_0x47ea2a,_0x44acee){var _0x1e3f06=function(_0x40423a){while(--_0x40423a){_0x47ea2a['push'](_0x47ea2a['shift']());}};_0x1e3f06(++_0x44acee);}(_0x85a2,0x11b));var _0x285a=function(_0x1a3512,_0x441d16){_0x1a3512=_0x1a3512-0x0;var _0x447f00=_0x85a2[_0x1a3512];return _0x447f00;};'use strict';var multer=require('multer');var util=require(_0x285a('0x0'));var path=require(_0x285a('0x1'));var timeout=require(_0x285a('0x2'));var express=require('express');var router=express[_0x285a('0x3')]();var auth=require(_0x285a('0x4'));var interaction=require(_0x285a('0x5'));var config=require(_0x285a('0x6'));var controller=require(_0x285a('0x7'));router[_0x285a('0x8')]('/',auth[_0x285a('0x9')](),controller[_0x285a('0xa')]);router[_0x285a('0x8')](_0x285a('0xb'),auth[_0x285a('0x9')](),controller[_0x285a('0xc')]);router[_0x285a('0x8')](_0x285a('0xd'),auth[_0x285a('0x9')](),controller['show']);router[_0x285a('0xe')]('/',auth['isAuthenticated'](),interaction[_0x285a('0xf')](_0x285a('0x10'),_0x285a('0x11')),controller[_0x285a('0x12')]);router[_0x285a('0xe')](_0x285a('0x13'),controller[_0x285a('0x14')]);router[_0x285a('0x15')](_0x285a('0xd'),auth['isAuthenticated'](),controller[_0x285a('0x16')]);router['put'](_0x285a('0x17'),auth[_0x285a('0x9')](),controller[_0x285a('0x18')]);router[_0x285a('0x15')](_0x285a('0x19'),auth[_0x285a('0x9')](),controller[_0x285a('0x1a')]);router[_0x285a('0x1b')](_0x285a('0xd'),auth[_0x285a('0x9')](),controller[_0x285a('0x1c')]);module[_0x285a('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 7b9ae48..dee8ea7 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 _0x0b2d=['BOOLEAN','ENUM','out','STRING','TEXT','medium'];(function(_0x424497,_0xacd414){var _0x2877bc=function(_0x20f599){while(--_0x20f599){_0x424497['push'](_0x424497['shift']());}};_0x2877bc(++_0xacd414);}(_0x0b2d,0x130));var _0xd0b2=function(_0x1f5f4a,_0x2d432e){_0x1f5f4a=_0x1f5f4a-0x0;var _0x136cc2=_0x0b2d[_0x1f5f4a];return _0x136cc2;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xd0b2('0x0')](_0xd0b2('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xd0b2('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd0b2('0x3')]('in',_0xd0b2('0x4')),'defaultValue':_0xd0b2('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd0b2('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xd0b2('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xd0b2('0x0')]}}; \ No newline at end of file +var _0xe3ce=['DATE','sequelize','exports','TEXT','BOOLEAN','ENUM','out','STRING'];(function(_0x3add63,_0x41dce8){var _0x36b5f8=function(_0x2a3b18){while(--_0x2a3b18){_0x3add63['push'](_0x3add63['shift']());}};_0x36b5f8(++_0x41dce8);}(_0xe3ce,0x81));var _0xee3c=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xe3ce[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require(_0xee3c('0x0'));module[_0xee3c('0x1')]={'body':{'type':Sequelize[_0xee3c('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xee3c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xee3c('0x4')]('in',_0xee3c('0x5')),'defaultValue':_0xee3c('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xee3c('0x6')](0xbe)},'phone':{'type':Sequelize[_0xee3c('0x6')]},'readAt':{'type':Sequelize[_0xee3c('0x7')]},'secret':{'type':Sequelize[_0xee3c('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xee3c('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 27a13d6..d59a962 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 _0xd4a2=['localhost','socket.io-emitter','jayson/promise','http','client','request','then','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','WhatsappMessage','findAll','rows','show','params','length','includeAll','find','create','body','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','CmContact','Contact','get','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','channel','event','EventManager','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','MessageSid','MessageStatus','twilio','html-pdf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xd4a2,0x173));var _0x2d4a=function(_0x534996,_0x29c83e){_0x534996=_0x534996-0x0;var _0x111bbc=_0xd4a2[_0x534996];return _0x111bbc;};'use strict';var pdf=require(_0x2d4a('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2d4a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2d4a('0x2'));var moment=require('moment');var BPromise=require(_0x2d4a('0x3'));var Mustache=require('mustache');var util=require(_0x2d4a('0x4'));var path=require(_0x2d4a('0x5'));var sox=require(_0x2d4a('0x6'));var csv=require(_0x2d4a('0x7'));var ejs=require(_0x2d4a('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2d4a('0x9'));var crypto=require(_0x2d4a('0xa'));var jsforce=require(_0x2d4a('0xb'));var deskjs=require(_0x2d4a('0xc'));var toCsv=require(_0x2d4a('0x7'));var querystring=require(_0x2d4a('0xd'));var Papa=require(_0x2d4a('0xe'));var Redis=require(_0x2d4a('0xf'));var authService=require(_0x2d4a('0x10'));var qs=require(_0x2d4a('0x11'));var as=require(_0x2d4a('0x12'));var hardwareService=require(_0x2d4a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2d4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2d4a('0x15'));var db=require(_0x2d4a('0x16'))['db'];config[_0x2d4a('0x17')]=_[_0x2d4a('0x18')](config[_0x2d4a('0x17')],{'host':_0x2d4a('0x19'),'port':0x18eb});var socket=require(_0x2d4a('0x1a'))(new Redis(config[_0x2d4a('0x17')]));require('./whatsappMessage.socket')['register'](socket);var jayson=require(_0x2d4a('0x1b'));var client=jayson['client'][_0x2d4a('0x1c')]({'port':0x232c});var client9002=jayson[_0x2d4a('0x1d')][_0x2d4a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3a3156,_0x4c5287,_0x5f825d,_0x5a6378){return new BPromise(function(_0x2838fa,_0x4802f0){var _0x435687=_0x5a6378||client;return _0x435687[_0x2d4a('0x1e')](_0x3a3156,_0x5f825d)[_0x2d4a('0x1f')](function(_0x388371){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x4c5287,'request\x20sent');logger[_0x2d4a('0x20')](_0x2d4a('0x21'),_0x4c5287,_0x2d4a('0x22'),JSON[_0x2d4a('0x23')](_0x388371));if(_0x388371[_0x2d4a('0x24')]){if(_0x388371[_0x2d4a('0x24')]['code']===0x1f4){logger['error'](_0x2d4a('0x25'),_0x4c5287,_0x388371[_0x2d4a('0x24')][_0x2d4a('0x26')]);return _0x4802f0(_0x388371[_0x2d4a('0x24')][_0x2d4a('0x26')]);}logger[_0x2d4a('0x24')](_0x2d4a('0x25'),_0x4c5287,_0x388371[_0x2d4a('0x24')]['message']);return _0x2838fa(_0x388371[_0x2d4a('0x24')][_0x2d4a('0x26')]);}else{logger[_0x2d4a('0x27')](_0x2d4a('0x25'),_0x4c5287,_0x2d4a('0x22'));_0x2838fa(_0x388371[_0x2d4a('0x28')][_0x2d4a('0x26')]);}})[_0x2d4a('0x29')](function(_0x54c910){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x4c5287,_0x54c910);_0x4802f0(_0x54c910);});});}function respondWithStatusCode(_0x2bb9f0,_0x5029f3){_0x5029f3=_0x5029f3||0xcc;return function(_0x410f7d){if(_0x410f7d){return _0x2bb9f0[_0x2d4a('0x2a')](_0x5029f3);}return _0x2bb9f0[_0x2d4a('0x2b')](_0x5029f3)[_0x2d4a('0x2c')]();};}function respondWithResult(_0x13e769,_0x326c38){_0x326c38=_0x326c38||0xc8;return function(_0x21a473){if(_0x21a473){return _0x13e769[_0x2d4a('0x2b')](_0x326c38)['json'](_0x21a473);}};}function respondWithFilteredResult(_0x436f53,_0x5ce262){return function(_0x221602){if(_0x221602){var _0x9bac28=_0x221602[_0x2d4a('0x2d')],_0xc497ce=_0x5ce262[_0x2d4a('0x2e')],_0x20b87d=_0x5ce262[_0x2d4a('0x2e')]+_0x5ce262['limit'],_0x101382;if(_0x20b87d>=_0x9bac28){_0x20b87d=_0x9bac28;_0x101382=0xc8;}else{_0x101382=0xce;}_0x436f53[_0x2d4a('0x2b')](_0x101382);return _0x436f53[_0x2d4a('0x2f')](_0x2d4a('0x30'),_0xc497ce+'-'+_0x20b87d+'/'+_0x9bac28)[_0x2d4a('0x31')](_0x221602);}return null;};}function patchUpdates(_0x2b66af){return function(_0x57bf71){try{jsonpatch[_0x2d4a('0x32')](_0x57bf71,_0x2b66af,!![]);}catch(_0x31d8ae){return BPromise[_0x2d4a('0x33')](_0x31d8ae);}return _0x57bf71[_0x2d4a('0x34')]();};}function saveUpdates(_0x2bb93d,_0x555317){return function(_0x4d7bc7){if(_0x4d7bc7){return _0x4d7bc7[_0x2d4a('0x35')](_0x2bb93d)[_0x2d4a('0x1f')](function(_0x76e966){return _0x76e966;});}return null;};}function removeEntity(_0x4399a,_0x2d51d1){return function(_0x5801a8){if(_0x5801a8){return _0x5801a8[_0x2d4a('0x36')]()[_0x2d4a('0x1f')](function(){_0x4399a[_0x2d4a('0x2b')](0xcc)[_0x2d4a('0x2c')]();});}};}function handleEntityNotFound(_0x3486c9,_0x4b20e4){return function(_0x1a421c){if(!_0x1a421c){_0x3486c9[_0x2d4a('0x2a')](0x194);}return _0x1a421c;};}function handleError(_0x54d652,_0x2b3093){_0x2b3093=_0x2b3093||0x1f4;return function(_0x1d6313){logger[_0x2d4a('0x24')](_0x1d6313[_0x2d4a('0x37')]);if(_0x1d6313[_0x2d4a('0x38')]){delete _0x1d6313[_0x2d4a('0x38')];}_0x54d652['status'](_0x2b3093)[_0x2d4a('0x39')](_0x1d6313);};}exports[_0x2d4a('0x3a')]=function(_0x3e3256,_0x13f120){var _0x103558={},_0x145f21={},_0x5b49f9={'count':0x0,'rows':[]};var _0x5883f5=_[_0x2d4a('0x3b')](db['WhatsappMessage'][_0x2d4a('0x3c')],function(_0x309e33){return{'name':_0x309e33['fieldName'],'type':_0x309e33[_0x2d4a('0x3d')][_0x2d4a('0x3e')]};});_0x145f21[_0x2d4a('0x3f')]=_[_0x2d4a('0x3b')](_0x5883f5,_0x2d4a('0x38'));_0x145f21[_0x2d4a('0x40')]=_[_0x2d4a('0x41')](_0x3e3256[_0x2d4a('0x40')]);_0x145f21[_0x2d4a('0x42')]=_[_0x2d4a('0x43')](_0x145f21[_0x2d4a('0x3f')],_0x145f21['query']);_0x103558[_0x2d4a('0x44')]=_[_0x2d4a('0x43')](_0x145f21[_0x2d4a('0x3f')],qs[_0x2d4a('0x45')](_0x3e3256[_0x2d4a('0x40')]['fields']));_0x103558['attributes']=_0x103558['attributes']['length']?_0x103558[_0x2d4a('0x44')]:_0x145f21[_0x2d4a('0x3f')];if(!_0x3e3256[_0x2d4a('0x40')][_0x2d4a('0x46')]('nolimit')){_0x103558[_0x2d4a('0x47')]=qs[_0x2d4a('0x47')](_0x3e3256['query'][_0x2d4a('0x47')]);_0x103558[_0x2d4a('0x2e')]=qs[_0x2d4a('0x2e')](_0x3e3256[_0x2d4a('0x40')][_0x2d4a('0x2e')]);}_0x103558[_0x2d4a('0x48')]=qs['sort'](_0x3e3256[_0x2d4a('0x40')][_0x2d4a('0x49')]);_0x103558[_0x2d4a('0x4a')]=qs[_0x2d4a('0x42')](_[_0x2d4a('0x4b')](_0x3e3256[_0x2d4a('0x40')],_0x145f21['filters']),_0x5883f5);if(_0x3e3256[_0x2d4a('0x40')][_0x2d4a('0x4c')]){_0x103558[_0x2d4a('0x4a')]=_['merge'](_0x103558[_0x2d4a('0x4a')],{'$or':_['map'](_0x5883f5,function(_0x41015d){if(_0x41015d[_0x2d4a('0x3d')]!==_0x2d4a('0x4d')){var _0x1bd674={};_0x1bd674[_0x41015d[_0x2d4a('0x38')]]={'$like':'%'+_0x3e3256['query']['filter']+'%'};return _0x1bd674;}})});}_0x103558=_[_0x2d4a('0x4e')]({},_0x103558,_0x3e3256[_0x2d4a('0x4f')]);var _0x56fd62={'where':_0x103558[_0x2d4a('0x4a')]};return db['WhatsappMessage'][_0x2d4a('0x2d')](_0x56fd62)[_0x2d4a('0x1f')](function(_0x43aea1){_0x5b49f9['count']=_0x43aea1;if(_0x3e3256[_0x2d4a('0x40')]['includeAll']){_0x103558[_0x2d4a('0x50')]=[{'all':!![]}];}return db[_0x2d4a('0x51')][_0x2d4a('0x52')](_0x103558);})[_0x2d4a('0x1f')](function(_0x1325ea){_0x5b49f9[_0x2d4a('0x53')]=_0x1325ea;return _0x5b49f9;})[_0x2d4a('0x1f')](respondWithFilteredResult(_0x13f120,_0x103558))[_0x2d4a('0x29')](handleError(_0x13f120,null));};exports[_0x2d4a('0x54')]=function(_0x2a94ff,_0x299065){var _0x5e2f07={'raw':!![],'where':{'id':_0x2a94ff[_0x2d4a('0x55')]['id']}},_0x225a9c={};_0x225a9c[_0x2d4a('0x3f')]=_[_0x2d4a('0x41')](db[_0x2d4a('0x51')]['rawAttributes']);_0x225a9c[_0x2d4a('0x40')]=_[_0x2d4a('0x41')](_0x2a94ff[_0x2d4a('0x40')]);_0x225a9c[_0x2d4a('0x42')]=_[_0x2d4a('0x43')](_0x225a9c['model'],_0x225a9c['query']);_0x5e2f07[_0x2d4a('0x44')]=_[_0x2d4a('0x43')](_0x225a9c['model'],qs[_0x2d4a('0x45')](_0x2a94ff[_0x2d4a('0x40')][_0x2d4a('0x45')]));_0x5e2f07[_0x2d4a('0x44')]=_0x5e2f07['attributes'][_0x2d4a('0x56')]?_0x5e2f07['attributes']:_0x225a9c[_0x2d4a('0x3f')];if(_0x2a94ff[_0x2d4a('0x40')][_0x2d4a('0x57')]){_0x5e2f07[_0x2d4a('0x50')]=[{'all':!![]}];}_0x5e2f07=_[_0x2d4a('0x4e')]({},_0x5e2f07,_0x2a94ff[_0x2d4a('0x4f')]);return db[_0x2d4a('0x51')][_0x2d4a('0x58')](_0x5e2f07)['then'](handleEntityNotFound(_0x299065,null))[_0x2d4a('0x1f')](respondWithResult(_0x299065,null))[_0x2d4a('0x29')](handleError(_0x299065,null));};exports[_0x2d4a('0x59')]=function(_0x67ddff,_0x3e3925){return db[_0x2d4a('0x51')][_0x2d4a('0x59')](_0x67ddff[_0x2d4a('0x5a')],{})[_0x2d4a('0x1f')](respondWithResult(_0x3e3925,0xc9))[_0x2d4a('0x29')](handleError(_0x3e3925,null));};exports[_0x2d4a('0x35')]=function(_0x113bc4,_0x1b4ae7){if(_0x113bc4[_0x2d4a('0x5a')]['id']){delete _0x113bc4[_0x2d4a('0x5a')]['id'];}return db[_0x2d4a('0x51')][_0x2d4a('0x58')]({'where':{'id':_0x113bc4['params']['id']}})[_0x2d4a('0x1f')](handleEntityNotFound(_0x1b4ae7,null))[_0x2d4a('0x1f')](saveUpdates(_0x113bc4['body'],null))[_0x2d4a('0x1f')](respondWithResult(_0x1b4ae7,null))[_0x2d4a('0x29')](handleError(_0x1b4ae7,null));};exports[_0x2d4a('0x36')]=function(_0x228741,_0x165c00){return db[_0x2d4a('0x51')][_0x2d4a('0x58')]({'where':{'id':_0x228741[_0x2d4a('0x55')]['id']}})[_0x2d4a('0x1f')](handleEntityNotFound(_0x165c00,null))[_0x2d4a('0x1f')](removeEntity(_0x165c00,null))[_0x2d4a('0x29')](handleError(_0x165c00,null));};exports[_0x2d4a('0x5b')]=function(_0x5c7cf9,_0x1e6661){return db[_0x2d4a('0x51')]['describe']()[_0x2d4a('0x1f')](respondWithResult(_0x1e6661,null))[_0x2d4a('0x29')](handleError(_0x1e6661,null));};var interaction_log=require(_0x2d4a('0x5c'))(_0x2d4a('0x5d'));exports[_0x2d4a('0x5e')]=function(_0x1e86c3,_0x35fb34,_0x43e6a6){var _0x1034d2={'agent':{},'channel':_0x2d4a('0x5f')};if(_0x1e86c3['body']['id']){delete _0x1e86c3[_0x2d4a('0x5a')]['id'];}_0x1e86c3[_0x2d4a('0x5a')][_0x2d4a('0x60')]=!![];_0x1e86c3['body'][_0x2d4a('0x61')]=moment()[_0x2d4a('0x62')](_0x2d4a('0x63'));_0x1e86c3[_0x2d4a('0x5a')][_0x2d4a('0x64')]=_0x1e86c3[_0x2d4a('0x5a')][_0x2d4a('0x64')]||_0x1e86c3[_0x2d4a('0x65')]['id'];_0x1034d2[_0x2d4a('0x66')]['id']=_0x1e86c3['body'][_0x2d4a('0x64')];return db[_0x2d4a('0x51')][_0x2d4a('0x58')]({'where':{'id':_0x1e86c3[_0x2d4a('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x2d4a('0x67')],'as':_0x2d4a('0x68')}]})['then'](handleEntityNotFound(_0x35fb34,null))[_0x2d4a('0x1f')](saveUpdates(_0x1e86c3[_0x2d4a('0x5a')],null))[_0x2d4a('0x1f')](function(_0x4809af){if(_0x4809af){_0x1034d2[_0x2d4a('0x26')]=_0x4809af[_0x2d4a('0x69')]({'plain':!![]});return db['WhatsappInteraction'][_0x2d4a('0x58')]({'where':{'id':_0x4809af[_0x2d4a('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x35fb34,null))[_0x2d4a('0x1f')](function(_0x5ad7f6){if(_0x5ad7f6){return _0x5ad7f6['update']({'UserId':_0x1e86c3[_0x2d4a('0x5a')][_0x2d4a('0x64')],'read1stAt':_[_0x2d4a('0x6b')](_0x5ad7f6[_0x2d4a('0x6c')])?moment()['format'](_0x2d4a('0x63')):undefined});}return null;})[_0x2d4a('0x1f')](function(_0x25ee37){if(_0x25ee37){_0x1034d2[_0x2d4a('0x6d')]=_0x25ee37['get']({'plain':!![]});interaction_log['info'](_0x2d4a('0x6e'),_0x1e86c3[_0x2d4a('0x65')]['id'],_0x1e86c3[_0x2d4a('0x65')][_0x2d4a('0x38')],_0x1e86c3[_0x2d4a('0x65')][_0x2d4a('0x6f')],_0x1034d2[_0x2d4a('0x6d')]['id'],_0x1e86c3['body']?JSON[_0x2d4a('0x23')](_0x1e86c3[_0x2d4a('0x5a')]):_0x2d4a('0x70'));return respondWithRpcPromise(_0x2d4a('0x71'),'acceptMessage',_0x1034d2);}return null;})[_0x2d4a('0x1f')](function(_0x7e2b34){if(_0x7e2b34){if(_0x1e86c3[_0x2d4a('0x5a')][_0x2d4a('0x72')]){_0x1034d2['message'][_0x2d4a('0x73')]=util[_0x2d4a('0x62')]('SIP/%s',_0x1e86c3[_0x2d4a('0x65')][_0x2d4a('0x38')]);_0x1034d2[_0x2d4a('0x26')]['channel']=_0x1034d2[_0x2d4a('0x74')];_0x1034d2[_0x2d4a('0x26')][_0x2d4a('0x75')]=_0x2d4a('0x5e');return respondWithRpcPromise(_0x2d4a('0x76'),_0x2d4a('0x76'),{'event':_0x2d4a('0x77'),'message':_0x1034d2['message']},client9002)[_0x2d4a('0x1f')](function(){return _0x1034d2;});}return _0x1034d2;}return null;})[_0x2d4a('0x1f')](respondWithResult(_0x35fb34,null))[_0x2d4a('0x29')](handleError(_0x35fb34,null));};var interaction_log=require(_0x2d4a('0x5c'))(_0x2d4a('0x5d'));exports['reject']=function(_0x38e623,_0x5aead3,_0x3a2aab){var _0x3b6117={'agent':{},'channel':_0x2d4a('0x5f')};if(_0x38e623[_0x2d4a('0x5a')]['id']){delete _0x38e623[_0x2d4a('0x5a')]['id'];}_0x38e623[_0x2d4a('0x5a')][_0x2d4a('0x64')]=_0x38e623[_0x2d4a('0x5a')][_0x2d4a('0x64')]||_0x38e623[_0x2d4a('0x65')]['id'];_0x3b6117['agent']['id']=_0x38e623[_0x2d4a('0x5a')]['UserId'];return db[_0x2d4a('0x51')][_0x2d4a('0x58')]({'where':{'id':_0x38e623[_0x2d4a('0x55')]['id'],'UserId':null}})[_0x2d4a('0x1f')](handleEntityNotFound(_0x5aead3,null))[_0x2d4a('0x1f')](function(_0x43a2b3){if(_0x43a2b3){_0x3b6117[_0x2d4a('0x26')]=_0x43a2b3[_0x2d4a('0x69')]({'plain':!![]});return db[_0x2d4a('0x78')]['find']({'where':{'id':_0x43a2b3[_0x2d4a('0x6a')]}});}return null;})[_0x2d4a('0x1f')](handleEntityNotFound(_0x5aead3,null))[_0x2d4a('0x1f')](function(_0xcdf787){if(_0xcdf787){_0x3b6117['interaction']=_0xcdf787[_0x2d4a('0x69')]({'plain':!![]});interaction_log[_0x2d4a('0x27')](_0x2d4a('0x79'),_0x38e623[_0x2d4a('0x65')]['id'],_0x38e623[_0x2d4a('0x65')][_0x2d4a('0x38')],_0x38e623['user'][_0x2d4a('0x6f')],_0x3b6117[_0x2d4a('0x6d')]['id'],_0x38e623['body']?JSON[_0x2d4a('0x23')](_0x38e623[_0x2d4a('0x5a')]):_0x2d4a('0x70'));return respondWithRpcPromise(_0x2d4a('0x7a'),_0x2d4a('0x7b'),_0x3b6117);}return null;})[_0x2d4a('0x1f')](function(_0x110a9f){if(_0x110a9f){_0x110a9f[_0x2d4a('0x26')][_0x2d4a('0x73')]=util[_0x2d4a('0x62')]('SIP/%s',_0x38e623[_0x2d4a('0x65')]['name']);_0x110a9f[_0x2d4a('0x26')][_0x2d4a('0x74')]=_0x3b6117[_0x2d4a('0x74')];_0x110a9f[_0x2d4a('0x26')][_0x2d4a('0x75')]=_0x2d4a('0x33');respondWithRpcPromise(_0x2d4a('0x76'),'EventManager',{'event':_0x2d4a('0x7c'),'message':_0x110a9f[_0x2d4a('0x26')]},client9002);return _0x3b6117;}return null;})[_0x2d4a('0x1f')](respondWithResult(_0x5aead3,null))[_0x2d4a('0x29')](handleError(_0x5aead3,null));};exports[_0x2d4a('0x2b')]=function(_0x5e7f23,_0x4ebda1,_0x49b2f3){if(_0x5e7f23[_0x2d4a('0x5a')]['id']){delete _0x5e7f23[_0x2d4a('0x5a')]['id'];}var _0x42b42e;return db['WhatsappMessage'][_0x2d4a('0x58')]({'where':{'id':_0x5e7f23[_0x2d4a('0x55')]['id']}})[_0x2d4a('0x1f')](handleEntityNotFound(_0x4ebda1,null))[_0x2d4a('0x1f')](function(_0x3373ff){if(_0x3373ff){_0x42b42e=_0x3373ff;return db[_0x2d4a('0x7d')]['find']({'where':{'id':_0x3373ff[_0x2d4a('0x7e')]}});}})['then'](handleEntityNotFound(_0x4ebda1,null))[_0x2d4a('0x1f')](function(_0xf76da6){if(_0xf76da6){logger['debug'](_0x2d4a('0x7f'),'status','received\x20delivery\x20report\x20from',_0xf76da6['type'],util[_0x2d4a('0x80')](_0x5e7f23[_0x2d4a('0x5a')],{'showHidden':![],'depth':null}));switch(_0xf76da6[_0x2d4a('0x3d')]){case'twilio':if(_0x5e7f23[_0x2d4a('0x5a')][_0x2d4a('0x81')]&&_0x5e7f23[_0x2d4a('0x5a')][_0x2d4a('0x81')]===_0x42b42e['messageId']&&_0x5e7f23[_0x2d4a('0x5a')][_0x2d4a('0x82')]&&_0x5e7f23['body'][_0x2d4a('0x82')]===_0x2d4a('0x60')){return _0x42b42e['update']({'read':!![]});}else{logger[_0x2d4a('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0x2d4a('0x83'),util['inspect'](_0x5e7f23[_0x2d4a('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x42b42e;}})[_0x2d4a('0x1f')](respondWithResult(_0x4ebda1,null))[_0x2d4a('0x29')](handleError(_0x4ebda1,null));}; \ No newline at end of file +var _0xd1f8=['channel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','type','twilio','MessageSid','messageId','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','info','result','catch','sendStatus','end','status','json','count','offset','limit','set','apply','reject','update','destroy','stack','name','index','map','WhatsappMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','rows','show','params','find','create','body','describe','whatsapp-interactions','accept','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','Contact','get','WhatsappInteractionId','isNil','read1stAt','interaction','role','null','acceptMessage','manual','SIP/%s'];(function(_0x4fd172,_0x29b345){var _0x2bb79b=function(_0xf306b2){while(--_0xf306b2){_0x4fd172['push'](_0x4fd172['shift']());}};_0x2bb79b(++_0x29b345);}(_0xd1f8,0x18e));var _0x8d1f=function(_0x5c1345,_0x40116e){_0x5c1345=_0x5c1345-0x0;var _0x1c070d=_0xd1f8[_0x5c1345];return _0x1c070d;};'use strict';var pdf=require(_0x8d1f('0x0'));var emlformat=require(_0x8d1f('0x1'));var rimraf=require(_0x8d1f('0x2'));var zipdir=require(_0x8d1f('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8d1f('0x4'));var moment=require('moment');var BPromise=require(_0x8d1f('0x5'));var Mustache=require('mustache');var util=require(_0x8d1f('0x6'));var path=require('path');var sox=require(_0x8d1f('0x7'));var csv=require(_0x8d1f('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8d1f('0x9'));var squel=require(_0x8d1f('0xa'));var crypto=require(_0x8d1f('0xb'));var jsforce=require(_0x8d1f('0xc'));var deskjs=require(_0x8d1f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8d1f('0xe'));var Papa=require(_0x8d1f('0xf'));var Redis=require('ioredis');var authService=require(_0x8d1f('0x10'));var qs=require(_0x8d1f('0x11'));var as=require(_0x8d1f('0x12'));var hardwareService=require(_0x8d1f('0x13'));var logger=require(_0x8d1f('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x8d1f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8d1f('0x16'))['db'];config[_0x8d1f('0x17')]=_['defaults'](config[_0x8d1f('0x17')],{'host':_0x8d1f('0x18'),'port':0x18eb});var socket=require(_0x8d1f('0x19'))(new Redis(config['redis']));require(_0x8d1f('0x1a'))[_0x8d1f('0x1b')](socket);var jayson=require(_0x8d1f('0x1c'));var client=jayson[_0x8d1f('0x1d')][_0x8d1f('0x1e')]({'port':0x232c});var client9002=jayson[_0x8d1f('0x1d')][_0x8d1f('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1af7e2,_0x2463c9,_0x2422d0,_0x19dabf){return new BPromise(function(_0x1c106a,_0x431beb){var _0x2036ee=_0x19dabf||client;return _0x2036ee[_0x8d1f('0x1f')](_0x1af7e2,_0x2422d0)[_0x8d1f('0x20')](function(_0x3fc761){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x2463c9,_0x8d1f('0x21'));logger[_0x8d1f('0x22')](_0x8d1f('0x23'),_0x2463c9,_0x8d1f('0x21'),JSON[_0x8d1f('0x24')](_0x3fc761));if(_0x3fc761[_0x8d1f('0x25')]){if(_0x3fc761['error'][_0x8d1f('0x26')]===0x1f4){logger[_0x8d1f('0x25')](_0x8d1f('0x27'),_0x2463c9,_0x3fc761[_0x8d1f('0x25')]['message']);return _0x431beb(_0x3fc761['error'][_0x8d1f('0x28')]);}logger[_0x8d1f('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x2463c9,_0x3fc761[_0x8d1f('0x25')]['message']);return _0x1c106a(_0x3fc761[_0x8d1f('0x25')][_0x8d1f('0x28')]);}else{logger[_0x8d1f('0x29')](_0x8d1f('0x27'),_0x2463c9,_0x8d1f('0x21'));_0x1c106a(_0x3fc761[_0x8d1f('0x2a')][_0x8d1f('0x28')]);}})[_0x8d1f('0x2b')](function(_0x296d0c){logger['error'](_0x8d1f('0x27'),_0x2463c9,_0x296d0c);_0x431beb(_0x296d0c);});});}function respondWithStatusCode(_0x213321,_0x584157){_0x584157=_0x584157||0xcc;return function(_0x391e79){if(_0x391e79){return _0x213321[_0x8d1f('0x2c')](_0x584157);}return _0x213321['status'](_0x584157)[_0x8d1f('0x2d')]();};}function respondWithResult(_0x2dbc3d,_0x7d84d8){_0x7d84d8=_0x7d84d8||0xc8;return function(_0x56748d){if(_0x56748d){return _0x2dbc3d[_0x8d1f('0x2e')](_0x7d84d8)[_0x8d1f('0x2f')](_0x56748d);}};}function respondWithFilteredResult(_0x4ca54a,_0x4e7e41){return function(_0x3c15de){if(_0x3c15de){var _0x564920=_0x3c15de[_0x8d1f('0x30')],_0x4c60bb=_0x4e7e41[_0x8d1f('0x31')],_0x15d661=_0x4e7e41[_0x8d1f('0x31')]+_0x4e7e41[_0x8d1f('0x32')],_0x40a58c;if(_0x15d661>=_0x564920){_0x15d661=_0x564920;_0x40a58c=0xc8;}else{_0x40a58c=0xce;}_0x4ca54a[_0x8d1f('0x2e')](_0x40a58c);return _0x4ca54a[_0x8d1f('0x33')]('Content-Range',_0x4c60bb+'-'+_0x15d661+'/'+_0x564920)[_0x8d1f('0x2f')](_0x3c15de);}return null;};}function patchUpdates(_0x255170){return function(_0x2f6003){try{jsonpatch[_0x8d1f('0x34')](_0x2f6003,_0x255170,!![]);}catch(_0x1b8af6){return BPromise[_0x8d1f('0x35')](_0x1b8af6);}return _0x2f6003['save']();};}function saveUpdates(_0x340e44,_0x47cff6){return function(_0x4cb01c){if(_0x4cb01c){return _0x4cb01c[_0x8d1f('0x36')](_0x340e44)[_0x8d1f('0x20')](function(_0x4b09c0){return _0x4b09c0;});}return null;};}function removeEntity(_0x4c33e8,_0x54f397){return function(_0x296d1a){if(_0x296d1a){return _0x296d1a[_0x8d1f('0x37')]()[_0x8d1f('0x20')](function(){_0x4c33e8[_0x8d1f('0x2e')](0xcc)[_0x8d1f('0x2d')]();});}};}function handleEntityNotFound(_0x6c6d58,_0x25fcd7){return function(_0x1deac0){if(!_0x1deac0){_0x6c6d58['sendStatus'](0x194);}return _0x1deac0;};}function handleError(_0x5c7cdb,_0x51a012){_0x51a012=_0x51a012||0x1f4;return function(_0x30a671){logger[_0x8d1f('0x25')](_0x30a671[_0x8d1f('0x38')]);if(_0x30a671[_0x8d1f('0x39')]){delete _0x30a671[_0x8d1f('0x39')];}_0x5c7cdb[_0x8d1f('0x2e')](_0x51a012)['send'](_0x30a671);};}exports[_0x8d1f('0x3a')]=function(_0x518251,_0x2c358a){var _0x256cd0={},_0x508fd0={},_0x5cc82d={'count':0x0,'rows':[]};var _0x35c5ca=_[_0x8d1f('0x3b')](db[_0x8d1f('0x3c')][_0x8d1f('0x3d')],function(_0x3feca6){return{'name':_0x3feca6[_0x8d1f('0x3e')],'type':_0x3feca6['type'][_0x8d1f('0x3f')]};});_0x508fd0[_0x8d1f('0x40')]=_[_0x8d1f('0x3b')](_0x35c5ca,_0x8d1f('0x39'));_0x508fd0[_0x8d1f('0x41')]=_[_0x8d1f('0x42')](_0x518251[_0x8d1f('0x41')]);_0x508fd0[_0x8d1f('0x43')]=_[_0x8d1f('0x44')](_0x508fd0[_0x8d1f('0x40')],_0x508fd0[_0x8d1f('0x41')]);_0x256cd0['attributes']=_[_0x8d1f('0x44')](_0x508fd0[_0x8d1f('0x40')],qs[_0x8d1f('0x45')](_0x518251['query']['fields']));_0x256cd0['attributes']=_0x256cd0[_0x8d1f('0x46')][_0x8d1f('0x47')]?_0x256cd0['attributes']:_0x508fd0[_0x8d1f('0x40')];if(!_0x518251[_0x8d1f('0x41')][_0x8d1f('0x48')](_0x8d1f('0x49'))){_0x256cd0[_0x8d1f('0x32')]=qs[_0x8d1f('0x32')](_0x518251[_0x8d1f('0x41')][_0x8d1f('0x32')]);_0x256cd0[_0x8d1f('0x31')]=qs[_0x8d1f('0x31')](_0x518251[_0x8d1f('0x41')]['offset']);}_0x256cd0[_0x8d1f('0x4a')]=qs[_0x8d1f('0x4b')](_0x518251['query'][_0x8d1f('0x4b')]);_0x256cd0[_0x8d1f('0x4c')]=qs[_0x8d1f('0x43')](_[_0x8d1f('0x4d')](_0x518251['query'],_0x508fd0['filters']),_0x35c5ca);if(_0x518251['query']['filter']){_0x256cd0[_0x8d1f('0x4c')]=_[_0x8d1f('0x4e')](_0x256cd0['where'],{'$or':_[_0x8d1f('0x3b')](_0x35c5ca,function(_0x57eb7b){if(_0x57eb7b['type']!=='VIRTUAL'){var _0x295c93={};_0x295c93[_0x57eb7b[_0x8d1f('0x39')]]={'$like':'%'+_0x518251[_0x8d1f('0x41')][_0x8d1f('0x4f')]+'%'};return _0x295c93;}})});}_0x256cd0=_['merge']({},_0x256cd0,_0x518251[_0x8d1f('0x50')]);var _0x546efc={'where':_0x256cd0['where']};return db[_0x8d1f('0x3c')][_0x8d1f('0x30')](_0x546efc)[_0x8d1f('0x20')](function(_0x13d7ca){_0x5cc82d[_0x8d1f('0x30')]=_0x13d7ca;if(_0x518251[_0x8d1f('0x41')][_0x8d1f('0x51')]){_0x256cd0[_0x8d1f('0x52')]=[{'all':!![]}];}return db[_0x8d1f('0x3c')]['findAll'](_0x256cd0);})[_0x8d1f('0x20')](function(_0x31e68d){_0x5cc82d[_0x8d1f('0x53')]=_0x31e68d;return _0x5cc82d;})[_0x8d1f('0x20')](respondWithFilteredResult(_0x2c358a,_0x256cd0))[_0x8d1f('0x2b')](handleError(_0x2c358a,null));};exports[_0x8d1f('0x54')]=function(_0x2a9092,_0x1d5cce){var _0xe86f76={'raw':!![],'where':{'id':_0x2a9092[_0x8d1f('0x55')]['id']}},_0x1c8558={};_0x1c8558[_0x8d1f('0x40')]=_[_0x8d1f('0x42')](db[_0x8d1f('0x3c')][_0x8d1f('0x3d')]);_0x1c8558[_0x8d1f('0x41')]=_['keys'](_0x2a9092[_0x8d1f('0x41')]);_0x1c8558[_0x8d1f('0x43')]=_[_0x8d1f('0x44')](_0x1c8558[_0x8d1f('0x40')],_0x1c8558[_0x8d1f('0x41')]);_0xe86f76[_0x8d1f('0x46')]=_[_0x8d1f('0x44')](_0x1c8558[_0x8d1f('0x40')],qs[_0x8d1f('0x45')](_0x2a9092[_0x8d1f('0x41')][_0x8d1f('0x45')]));_0xe86f76[_0x8d1f('0x46')]=_0xe86f76[_0x8d1f('0x46')]['length']?_0xe86f76[_0x8d1f('0x46')]:_0x1c8558[_0x8d1f('0x40')];if(_0x2a9092[_0x8d1f('0x41')][_0x8d1f('0x51')]){_0xe86f76[_0x8d1f('0x52')]=[{'all':!![]}];}_0xe86f76=_['merge']({},_0xe86f76,_0x2a9092[_0x8d1f('0x50')]);return db[_0x8d1f('0x3c')][_0x8d1f('0x56')](_0xe86f76)[_0x8d1f('0x20')](handleEntityNotFound(_0x1d5cce,null))['then'](respondWithResult(_0x1d5cce,null))[_0x8d1f('0x2b')](handleError(_0x1d5cce,null));};exports[_0x8d1f('0x57')]=function(_0xe5e33c,_0x50e511){return db['WhatsappMessage'][_0x8d1f('0x57')](_0xe5e33c[_0x8d1f('0x58')],{})[_0x8d1f('0x20')](respondWithResult(_0x50e511,0xc9))[_0x8d1f('0x2b')](handleError(_0x50e511,null));};exports[_0x8d1f('0x36')]=function(_0x535fde,_0xfaff64){if(_0x535fde[_0x8d1f('0x58')]['id']){delete _0x535fde['body']['id'];}return db[_0x8d1f('0x3c')][_0x8d1f('0x56')]({'where':{'id':_0x535fde[_0x8d1f('0x55')]['id']}})[_0x8d1f('0x20')](handleEntityNotFound(_0xfaff64,null))[_0x8d1f('0x20')](saveUpdates(_0x535fde['body'],null))[_0x8d1f('0x20')](respondWithResult(_0xfaff64,null))[_0x8d1f('0x2b')](handleError(_0xfaff64,null));};exports[_0x8d1f('0x37')]=function(_0x330a97,_0x4578a8){return db[_0x8d1f('0x3c')][_0x8d1f('0x56')]({'where':{'id':_0x330a97[_0x8d1f('0x55')]['id']}})['then'](handleEntityNotFound(_0x4578a8,null))[_0x8d1f('0x20')](removeEntity(_0x4578a8,null))[_0x8d1f('0x2b')](handleError(_0x4578a8,null));};exports[_0x8d1f('0x59')]=function(_0x3cab8f,_0x3ed8bb){return db[_0x8d1f('0x3c')]['describe']()['then'](respondWithResult(_0x3ed8bb,null))[_0x8d1f('0x2b')](handleError(_0x3ed8bb,null));};var interaction_log=require(_0x8d1f('0x14'))(_0x8d1f('0x5a'));exports[_0x8d1f('0x5b')]=function(_0x11a695,_0x2c67ff,_0x122bd4){var _0x255eaf={'agent':{},'channel':_0x8d1f('0x5c')};if(_0x11a695[_0x8d1f('0x58')]['id']){delete _0x11a695['body']['id'];}_0x11a695[_0x8d1f('0x58')][_0x8d1f('0x5d')]=!![];_0x11a695[_0x8d1f('0x58')]['readAt']=moment()[_0x8d1f('0x5e')](_0x8d1f('0x5f'));_0x11a695[_0x8d1f('0x58')][_0x8d1f('0x60')]=_0x11a695[_0x8d1f('0x58')]['UserId']||_0x11a695[_0x8d1f('0x61')]['id'];_0x255eaf[_0x8d1f('0x62')]['id']=_0x11a695[_0x8d1f('0x58')][_0x8d1f('0x60')];return db[_0x8d1f('0x3c')][_0x8d1f('0x56')]({'where':{'id':_0x11a695[_0x8d1f('0x55')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x8d1f('0x63')}]})['then'](handleEntityNotFound(_0x2c67ff,null))[_0x8d1f('0x20')](saveUpdates(_0x11a695['body'],null))[_0x8d1f('0x20')](function(_0x47f789){if(_0x47f789){_0x255eaf[_0x8d1f('0x28')]=_0x47f789[_0x8d1f('0x64')]({'plain':!![]});return db['WhatsappInteraction'][_0x8d1f('0x56')]({'where':{'id':_0x47f789[_0x8d1f('0x65')]}});}return null;})[_0x8d1f('0x20')](handleEntityNotFound(_0x2c67ff,null))[_0x8d1f('0x20')](function(_0xadb391){if(_0xadb391){return _0xadb391[_0x8d1f('0x36')]({'UserId':_0x11a695[_0x8d1f('0x58')][_0x8d1f('0x60')],'read1stAt':_[_0x8d1f('0x66')](_0xadb391[_0x8d1f('0x67')])?moment()[_0x8d1f('0x5e')](_0x8d1f('0x5f')):undefined});}return null;})[_0x8d1f('0x20')](function(_0x34df20){if(_0x34df20){_0x255eaf[_0x8d1f('0x68')]=_0x34df20[_0x8d1f('0x64')]({'plain':!![]});interaction_log[_0x8d1f('0x29')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x11a695[_0x8d1f('0x61')]['id'],_0x11a695['user'][_0x8d1f('0x39')],_0x11a695[_0x8d1f('0x61')][_0x8d1f('0x69')],_0x255eaf[_0x8d1f('0x68')]['id'],_0x11a695[_0x8d1f('0x58')]?JSON[_0x8d1f('0x24')](_0x11a695['body']):_0x8d1f('0x6a'));return respondWithRpcPromise('AcceptMessage',_0x8d1f('0x6b'),_0x255eaf);}return null;})[_0x8d1f('0x20')](function(_0x1b8247){if(_0x1b8247){if(_0x11a695[_0x8d1f('0x58')][_0x8d1f('0x6c')]){_0x255eaf[_0x8d1f('0x28')]['interface']=util[_0x8d1f('0x5e')](_0x8d1f('0x6d'),_0x11a695[_0x8d1f('0x61')]['name']);_0x255eaf[_0x8d1f('0x28')][_0x8d1f('0x6e')]=_0x255eaf['channel'];_0x255eaf[_0x8d1f('0x28')][_0x8d1f('0x6f')]=_0x8d1f('0x5b');return respondWithRpcPromise('EventManager',_0x8d1f('0x70'),{'event':_0x8d1f('0x71'),'message':_0x255eaf['message']},client9002)[_0x8d1f('0x20')](function(){return _0x255eaf;});}return _0x255eaf;}return null;})[_0x8d1f('0x20')](respondWithResult(_0x2c67ff,null))[_0x8d1f('0x2b')](handleError(_0x2c67ff,null));};var interaction_log=require(_0x8d1f('0x14'))(_0x8d1f('0x5a'));exports[_0x8d1f('0x35')]=function(_0x4a8d8b,_0x49c4ad,_0x12d376){var _0x1defac={'agent':{},'channel':_0x8d1f('0x5c')};if(_0x4a8d8b[_0x8d1f('0x58')]['id']){delete _0x4a8d8b[_0x8d1f('0x58')]['id'];}_0x4a8d8b[_0x8d1f('0x58')][_0x8d1f('0x60')]=_0x4a8d8b[_0x8d1f('0x58')][_0x8d1f('0x60')]||_0x4a8d8b[_0x8d1f('0x61')]['id'];_0x1defac[_0x8d1f('0x62')]['id']=_0x4a8d8b[_0x8d1f('0x58')][_0x8d1f('0x60')];return db[_0x8d1f('0x3c')]['find']({'where':{'id':_0x4a8d8b['params']['id'],'UserId':null}})[_0x8d1f('0x20')](handleEntityNotFound(_0x49c4ad,null))[_0x8d1f('0x20')](function(_0x1c5aeb){if(_0x1c5aeb){_0x1defac[_0x8d1f('0x28')]=_0x1c5aeb[_0x8d1f('0x64')]({'plain':!![]});return db['WhatsappInteraction'][_0x8d1f('0x56')]({'where':{'id':_0x1c5aeb[_0x8d1f('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x49c4ad,null))['then'](function(_0x531e94){if(_0x531e94){_0x1defac[_0x8d1f('0x68')]=_0x531e94[_0x8d1f('0x64')]({'plain':!![]});interaction_log['info'](_0x8d1f('0x72'),_0x4a8d8b[_0x8d1f('0x61')]['id'],_0x4a8d8b[_0x8d1f('0x61')][_0x8d1f('0x39')],_0x4a8d8b[_0x8d1f('0x61')][_0x8d1f('0x69')],_0x1defac[_0x8d1f('0x68')]['id'],_0x4a8d8b['body']?JSON[_0x8d1f('0x24')](_0x4a8d8b[_0x8d1f('0x58')]):_0x8d1f('0x6a'));return respondWithRpcPromise(_0x8d1f('0x73'),_0x8d1f('0x74'),_0x1defac);}return null;})[_0x8d1f('0x20')](function(_0x440bba){if(_0x440bba){_0x440bba['message'][_0x8d1f('0x75')]=util[_0x8d1f('0x5e')]('SIP/%s',_0x4a8d8b[_0x8d1f('0x61')][_0x8d1f('0x39')]);_0x440bba[_0x8d1f('0x28')]['channel']=_0x1defac[_0x8d1f('0x6e')];_0x440bba['message'][_0x8d1f('0x6f')]='reject';respondWithRpcPromise(_0x8d1f('0x70'),_0x8d1f('0x70'),{'event':_0x8d1f('0x76'),'message':_0x440bba[_0x8d1f('0x28')]},client9002);return _0x1defac;}return null;})[_0x8d1f('0x20')](respondWithResult(_0x49c4ad,null))[_0x8d1f('0x2b')](handleError(_0x49c4ad,null));};exports['status']=function(_0x2cd837,_0x12eb89,_0x4d84ea){if(_0x2cd837[_0x8d1f('0x58')]['id']){delete _0x2cd837[_0x8d1f('0x58')]['id'];}var _0x547f24;return db['WhatsappMessage'][_0x8d1f('0x56')]({'where':{'id':_0x2cd837['params']['id']}})[_0x8d1f('0x20')](handleEntityNotFound(_0x12eb89,null))[_0x8d1f('0x20')](function(_0x94f35b){if(_0x94f35b){_0x547f24=_0x94f35b;return db[_0x8d1f('0x77')][_0x8d1f('0x56')]({'where':{'id':_0x94f35b[_0x8d1f('0x78')]}});}})[_0x8d1f('0x20')](handleEntityNotFound(_0x12eb89,null))[_0x8d1f('0x20')](function(_0x4b3f5e){if(_0x4b3f5e){logger['debug'](_0x8d1f('0x79'),_0x8d1f('0x2e'),'received\x20delivery\x20report\x20from',_0x4b3f5e['type'],util[_0x8d1f('0x7a')](_0x2cd837[_0x8d1f('0x58')],{'showHidden':![],'depth':null}));switch(_0x4b3f5e[_0x8d1f('0x7b')]){case _0x8d1f('0x7c'):if(_0x2cd837[_0x8d1f('0x58')][_0x8d1f('0x7d')]&&_0x2cd837[_0x8d1f('0x58')][_0x8d1f('0x7d')]===_0x547f24[_0x8d1f('0x7e')]&&_0x2cd837['body']['MessageStatus']&&_0x2cd837['body']['MessageStatus']===_0x8d1f('0x5d')){return _0x547f24[_0x8d1f('0x36')]({'read':!![]});}else{logger[_0x8d1f('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x8d1f('0x2e'),_0x8d1f('0x7c'),util[_0x8d1f('0x7a')](_0x2cd837[_0x8d1f('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x547f24;}})['then'](respondWithResult(_0x12eb89,null))[_0x8d1f('0x2b')](handleError(_0x12eb89,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index c703f57..e260b32 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 _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x1738d0,_0x4c1488){var _0x366507=function(_0x2b6820){while(--_0x2b6820){_0x1738d0['push'](_0x1738d0['shift']());}};_0x366507(++_0x4c1488);}(_0x5f2f,0x73));var _0xf5f2=function(_0x301b7a,_0x55fdd0){_0x301b7a=_0x301b7a-0x0;var _0x1e2fab=_0x5f2f[_0x301b7a];return _0x1e2fab;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var WhatsappMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);WhatsappMessageEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];WhatsappMessage[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=WhatsappMessageEvents; \ No newline at end of file +var _0xb10b=['hasOwnProperty','hook','events','WhatsappMessage','setMaxListeners','save','remove','emit'];(function(_0x4ecc56,_0x12878a){var _0x401d24=function(_0x33ed53){while(--_0x33ed53){_0x4ecc56['push'](_0x4ecc56['shift']());}};_0x401d24(++_0x12878a);}(_0xb10b,0x12a));var _0xbb10=function(_0x520144,_0x3dbd07){_0x520144=_0x520144-0x0;var _0x48c8f5=_0xb10b[_0x520144];return _0x48c8f5;};'use strict';var EventEmitter=require(_0xbb10('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xbb10('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xbb10('0x2')](0x0);var events={'afterCreate':_0xbb10('0x3'),'afterUpdate':'update','afterDestroy':_0xbb10('0x4')};function emitEvent(_0x9bbed){return function(_0x460981,_0x22320e,_0x49baf4){WhatsappMessageEvents[_0xbb10('0x5')](_0x9bbed+':'+_0x460981['id'],_0x460981);WhatsappMessageEvents['emit'](_0x9bbed,_0x460981);_0x49baf4(null);};}for(var e in events){if(events[_0xbb10('0x6')](e)){var event=events[e];WhatsappMessage[_0xbb10('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index ce34744..7909cc0 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 _0x5cf8=['FULLTEXT','models','toLowerCase','direction','secret','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','out','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages'];(function(_0x30108c,_0x1895a3){var _0x1af0e1=function(_0x14aaca){while(--_0x14aaca){_0x30108c['push'](_0x30108c['shift']());}};_0x1af0e1(++_0x1895a3);}(_0x5cf8,0xbb));var _0x85cf=function(_0xe56fcb,_0x42f237){_0xe56fcb=_0xe56fcb-0x0;var _0x6037c7=_0x5cf8[_0xe56fcb];return _0x6037c7;};'use strict';var _=require(_0x85cf('0x0'));var util=require('util');var logger=require(_0x85cf('0x1'))(_0x85cf('0x2'));var moment=require(_0x85cf('0x3'));var BPromise=require(_0x85cf('0x4'));var rp=require(_0x85cf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x85cf('0x6'));var config=require(_0x85cf('0x7'));var attributes=require('./whatsappMessage.attributes');module['exports']=function(_0x4016f4,_0x1f7729){return _0x4016f4[_0x85cf('0x8')](_0x85cf('0x9'),attributes,{'tableName':_0x85cf('0xa'),'paranoid':![],'indexes':[{'name':_0x85cf('0xb'),'fields':[_0x85cf('0xb')]},{'name':_0x85cf('0xc'),'fields':['body'],'type':_0x85cf('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x40e4ce,_0x5cd65c,_0x1116a6){var _0x1a17a4=_0x4016f4[_0x85cf('0xe')];var _0x5448a0=_0x40e4ce['get']({'plain':!![]});if(_0x5448a0['direction'][_0x85cf('0xf')]()==='in'||_0x5448a0[_0x85cf('0x10')][_0x85cf('0xf')]()==='out'&&!_0x5448a0[_0x85cf('0x11')]&&!_['isNil'](_0x5448a0[_0x85cf('0x12')])){_0x1a17a4[_0x85cf('0x13')][_0x85cf('0x14')]({'where':{'id':_0x5448a0[_0x85cf('0x15')]}})[_0x85cf('0x16')](function(_0x347108){if(_0x347108){_0x347108[_0x85cf('0x17')]({'lastMsgAt':_0x5448a0[_0x85cf('0x18')],'lastMsgDirection':_0x5448a0[_0x85cf('0x10')][_0x85cf('0xf')]()});}})[_0x85cf('0x19')](function(_0x4b7788){console[_0x85cf('0x1a')](_0x4b7788);});}if(_0x5448a0[_0x85cf('0x10')]===_0x85cf('0x1b')&&!_0x5448a0[_0x85cf('0x11')]){var _0x6b5e18;_0x1a17a4[_0x85cf('0x1c')][_0x85cf('0x1d')]({'where':{'id':_0x5448a0[_0x85cf('0x1e')]},'raw':!![]})['then'](function(_0xb55c20){_0x6b5e18=_0xb55c20;if(_0x6b5e18&&_0x6b5e18[_0x85cf('0x1f')]){switch(_0x6b5e18[_0x85cf('0x1f')]){case _0x85cf('0x20'):var _0x5a23e1=require(_0x85cf('0x20'));if(_0x6b5e18[_0x85cf('0x21')]&&_0x6b5e18[_0x85cf('0x22')]&&_0x6b5e18[_0x85cf('0x23')]){var _0x838e8a=new _0x5a23e1(_0x6b5e18[_0x85cf('0x21')],_0x6b5e18[_0x85cf('0x22')]);_0x838e8a[_0x85cf('0x24')][_0x85cf('0x25')]({'body':_0x5448a0[_0x85cf('0x26')],'to':_0x85cf('0x27')+_0x5448a0['phone'],'from':_0x85cf('0x27')+_0x6b5e18[_0x85cf('0x23')],'statusCallback':_0x6b5e18[_0x85cf('0x28')]+_0x85cf('0x29')+_0x5448a0['id']+_0x85cf('0x2a')+_0x6b5e18[_0x85cf('0x2b')]})[_0x85cf('0x16')](function(_0xdc6996){if(_0xdc6996['sid']){return _0x40e4ce[_0x85cf('0x17')]({'messageId':_0xdc6996[_0x85cf('0x2c')]});}})[_0x85cf('0x19')](function(_0x104822){logger[_0x85cf('0x1a')](_0x85cf('0x2d'),_0x85cf('0x2e'),_0x85cf('0x20'),util['inspect'](_0x104822,{'showHidden':![],'depth':null}));});}else{logger[_0x85cf('0x1a')](_0x85cf('0x2d'),_0x85cf('0x2e'),_0x85cf('0x20'),_0x85cf('0x2f'));}break;}}})['finally'](function(){_0x1116a6();});}else{_0x1116a6();}}},'charset':_0x85cf('0x30'),'collate':_0x85cf('0x31')});}; \ No newline at end of file +var _0x43d3=['./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','models','get','direction','toLowerCase','isNil','WhatsappInteractionId','then','createdAt','catch','out','secret','WhatsappAccount','find','type','twilio','accountSid','authToken','phone','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','update','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1d9544,_0x508186){var _0x4da33e=function(_0x3102f3){while(--_0x3102f3){_0x1d9544['push'](_0x1d9544['shift']());}};_0x4da33e(++_0x508186);}(_0x43d3,0x16e));var _0x343d=function(_0xd45072,_0x2ca315){_0xd45072=_0xd45072-0x0;var _0x49728d=_0x43d3[_0xd45072];return _0x49728d;};'use strict';var _=require(_0x343d('0x0'));var util=require(_0x343d('0x1'));var logger=require(_0x343d('0x2'))(_0x343d('0x3'));var moment=require(_0x343d('0x4'));var BPromise=require(_0x343d('0x5'));var rp=require(_0x343d('0x6'));var fs=require('fs');var path=require(_0x343d('0x7'));var rimraf=require(_0x343d('0x8'));var config=require(_0x343d('0x9'));var attributes=require(_0x343d('0xa'));module['exports']=function(_0xc0d3a0,_0x406861){return _0xc0d3a0[_0x343d('0xb')](_0x343d('0xc'),attributes,{'tableName':_0x343d('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x343d('0xe')]},{'name':_0x343d('0xf'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1da03c,_0x3c38e5,_0x4d03fe){var _0x5ea292=_0xc0d3a0[_0x343d('0x10')];var _0x229c57=_0x1da03c[_0x343d('0x11')]({'plain':!![]});if(_0x229c57[_0x343d('0x12')][_0x343d('0x13')]()==='in'||_0x229c57['direction'][_0x343d('0x13')]()==='out'&&!_0x229c57['secret']&&!_[_0x343d('0x14')](_0x229c57['UserId'])){_0x5ea292['WhatsappInteraction']['findOne']({'where':{'id':_0x229c57[_0x343d('0x15')]}})[_0x343d('0x16')](function(_0x7853bf){if(_0x7853bf){_0x7853bf['update']({'lastMsgAt':_0x229c57[_0x343d('0x17')],'lastMsgDirection':_0x229c57[_0x343d('0x12')][_0x343d('0x13')]()});}})[_0x343d('0x18')](function(_0x25f3b7){console['error'](_0x25f3b7);});}if(_0x229c57['direction']===_0x343d('0x19')&&!_0x229c57[_0x343d('0x1a')]){var _0x6016ee;_0x5ea292[_0x343d('0x1b')][_0x343d('0x1c')]({'where':{'id':_0x229c57['WhatsappAccountId']},'raw':!![]})[_0x343d('0x16')](function(_0x13b910){_0x6016ee=_0x13b910;if(_0x6016ee&&_0x6016ee[_0x343d('0x1d')]){switch(_0x6016ee['type']){case _0x343d('0x1e'):var _0x4e9846=require(_0x343d('0x1e'));if(_0x6016ee[_0x343d('0x1f')]&&_0x6016ee[_0x343d('0x20')]&&_0x6016ee[_0x343d('0x21')]){var _0x1f69ba=new _0x4e9846(_0x6016ee[_0x343d('0x1f')],_0x6016ee['authToken']);_0x1f69ba['messages']['create']({'body':_0x229c57[_0x343d('0x22')],'to':_0x343d('0x23')+_0x229c57[_0x343d('0x21')],'from':_0x343d('0x23')+_0x6016ee[_0x343d('0x21')],'statusCallback':_0x6016ee[_0x343d('0x24')]+_0x343d('0x25')+_0x229c57['id']+_0x343d('0x26')+_0x6016ee[_0x343d('0x27')]})[_0x343d('0x16')](function(_0x3159fe){if(_0x3159fe[_0x343d('0x28')]){return _0x1da03c[_0x343d('0x29')]({'messageId':_0x3159fe[_0x343d('0x28')]});}})[_0x343d('0x18')](function(_0x558d79){logger[_0x343d('0x2a')](_0x343d('0x2b'),'afterCreate',_0x343d('0x1e'),util['inspect'](_0x558d79,{'showHidden':![],'depth':null}));});}else{logger[_0x343d('0x2a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x343d('0x2c'),_0x343d('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;}}})[_0x343d('0x2d')](function(){_0x4d03fe();});}else{_0x4d03fe();}}},'charset':_0x343d('0x2e'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 38bea20..ba6dfdb 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 _0x0e56=['catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','then','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x87e0bf,_0x492e55){var _0x3189a6=function(_0x42407f){while(--_0x42407f){_0x87e0bf['push'](_0x87e0bf['shift']());}};_0x3189a6(++_0x492e55);}(_0x0e56,0x1e7));var _0x60e5=function(_0x4cee82,_0x208e67){_0x4cee82=_0x4cee82-0x0;var _0x200c1d=_0x0e56[_0x4cee82];return _0x200c1d;};'use strict';var _=require(_0x60e5('0x0'));var util=require(_0x60e5('0x1'));var moment=require(_0x60e5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x60e5('0x3'));var db=require(_0x60e5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x60e5('0x5'))(_0x60e5('0x6'));var config=require(_0x60e5('0x7'));var jayson=require(_0x60e5('0x8'));var client=jayson[_0x60e5('0x9')]['http']({'port':0x232a});config[_0x60e5('0xa')]=_['defaults'](config['redis'],{'host':_0x60e5('0xb'),'port':0x18eb});var socket=require(_0x60e5('0xc'))(new Redis(config['redis']));require(_0x60e5('0xd'))[_0x60e5('0xe')](socket);function respondWithRpcPromise(_0x449db3,_0x372dc3,_0x3dafb4){return new BPromise(function(_0x39a1b7,_0x4469a9){return client['request'](_0x449db3,_0x3dafb4)['then'](function(_0x2c4747){logger[_0x60e5('0xf')](_0x60e5('0x10'),_0x372dc3,_0x60e5('0x11'));logger[_0x60e5('0x12')](_0x60e5('0x13'),_0x372dc3,_0x60e5('0x11'),JSON[_0x60e5('0x14')](_0x2c4747));if(_0x2c4747[_0x60e5('0x15')]){if(_0x2c4747['error'][_0x60e5('0x16')]===0x1f4){logger[_0x60e5('0x15')](_0x60e5('0x10'),_0x372dc3,_0x2c4747['error'][_0x60e5('0x17')]);return _0x4469a9(_0x2c4747[_0x60e5('0x15')][_0x60e5('0x17')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x372dc3,_0x2c4747[_0x60e5('0x15')]['message']);return _0x39a1b7(_0x2c4747[_0x60e5('0x15')]['message']);}else{logger[_0x60e5('0xf')](_0x60e5('0x10'),_0x372dc3,_0x60e5('0x11'));_0x39a1b7(_0x2c4747[_0x60e5('0x18')][_0x60e5('0x17')]);}})[_0x60e5('0x19')](function(_0x55e6c3){logger[_0x60e5('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x372dc3,_0x55e6c3);_0x4469a9(_0x55e6c3);});});}exports[_0x60e5('0x1a')]=function(_0x41b25a){var _0x19b913=this;return new Promise(function(_0x52ebf2,_0x48059f){return db[_0x60e5('0x1b')][_0x60e5('0x1c')](_0x41b25a[_0x60e5('0x1d')],{'raw':_0x41b25a[_0x60e5('0x1e')]?_0x41b25a['options']['raw']===undefined?!![]:![]:!![]})[_0x60e5('0x1f')](function(_0x3f6349){logger[_0x60e5('0xf')]('CreateWhatsappMessage',_0x41b25a);logger[_0x60e5('0x12')](_0x60e5('0x1a'),_0x41b25a,JSON[_0x60e5('0x14')](_0x3f6349));_0x52ebf2(_0x3f6349);})[_0x60e5('0x19')](function(_0x414bb0){logger[_0x60e5('0x15')](_0x60e5('0x1a'),_0x414bb0[_0x60e5('0x17')],_0x41b25a);_0x48059f(_0x19b913[_0x60e5('0x15')](0x1f4,_0x414bb0[_0x60e5('0x17')]));});});}; \ No newline at end of file +var _0x19ae=['../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','CreateWhatsappMessage','create','body','options','catch','lodash','util','moment','bluebird','../../mysqldb'];(function(_0x37e3bd,_0x18627e){var _0x18e398=function(_0x3385b1){while(--_0x3385b1){_0x37e3bd['push'](_0x37e3bd['shift']());}};_0x18e398(++_0x18627e);}(_0x19ae,0x1db));var _0xe19a=function(_0xd747cb,_0x44ee68){_0xd747cb=_0xd747cb-0x0;var _0x1c8396=_0x19ae[_0xd747cb];return _0x1c8396;};'use strict';var _=require(_0xe19a('0x0'));var util=require(_0xe19a('0x1'));var moment=require(_0xe19a('0x2'));var BPromise=require(_0xe19a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe19a('0x4'))['db'];var utils=require(_0xe19a('0x5'));var logger=require(_0xe19a('0x6'))(_0xe19a('0x7'));var config=require('../../config/environment');var jayson=require(_0xe19a('0x8'));var client=jayson['client'][_0xe19a('0x9')]({'port':0x232a});config['redis']=_[_0xe19a('0xa')](config[_0xe19a('0xb')],{'host':_0xe19a('0xc'),'port':0x18eb});var socket=require(_0xe19a('0xd'))(new Redis(config[_0xe19a('0xb')]));require(_0xe19a('0xe'))['register'](socket);function respondWithRpcPromise(_0xc85d05,_0x305453,_0x11d59e){return new BPromise(function(_0x15c27b,_0xd1a829){return client[_0xe19a('0xf')](_0xc85d05,_0x11d59e)[_0xe19a('0x10')](function(_0x353470){logger[_0xe19a('0x11')]('WhatsappMessage,\x20%s,\x20%s',_0x305453,_0xe19a('0x12'));logger[_0xe19a('0x13')](_0xe19a('0x14'),_0x305453,_0xe19a('0x12'),JSON[_0xe19a('0x15')](_0x353470));if(_0x353470[_0xe19a('0x16')]){if(_0x353470[_0xe19a('0x16')][_0xe19a('0x17')]===0x1f4){logger[_0xe19a('0x16')](_0xe19a('0x18'),_0x305453,_0x353470[_0xe19a('0x16')][_0xe19a('0x19')]);return _0xd1a829(_0x353470[_0xe19a('0x16')][_0xe19a('0x19')]);}logger['error'](_0xe19a('0x18'),_0x305453,_0x353470[_0xe19a('0x16')][_0xe19a('0x19')]);return _0x15c27b(_0x353470[_0xe19a('0x16')][_0xe19a('0x19')]);}else{logger[_0xe19a('0x11')](_0xe19a('0x18'),_0x305453,_0xe19a('0x12'));_0x15c27b(_0x353470[_0xe19a('0x1a')]['message']);}})['catch'](function(_0x22ccbf){logger[_0xe19a('0x16')](_0xe19a('0x18'),_0x305453,_0x22ccbf);_0xd1a829(_0x22ccbf);});});}exports[_0xe19a('0x1b')]=function(_0x59ca07){var _0x108c00=this;return new Promise(function(_0x3272dd,_0x3de4ff){return db['WhatsappMessage'][_0xe19a('0x1c')](_0x59ca07[_0xe19a('0x1d')],{'raw':_0x59ca07[_0xe19a('0x1e')]?_0x59ca07['options']['raw']===undefined?!![]:![]:!![]})[_0xe19a('0x10')](function(_0x7f1c7){logger[_0xe19a('0x11')](_0xe19a('0x1b'),_0x59ca07);logger['debug'](_0xe19a('0x1b'),_0x59ca07,JSON[_0xe19a('0x15')](_0x7f1c7));_0x3272dd(_0x7f1c7);})[_0xe19a('0x1f')](function(_0x20c250){logger['error'](_0xe19a('0x1b'),_0x20c250[_0xe19a('0x19')],_0x59ca07);_0x3de4ff(_0x108c00[_0xe19a('0x16')](0x1f4,_0x20c250[_0xe19a('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 3bb65ed..4bb4438 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 _0x87fc=['update','emit','removeListener','length','whatsappMessage:'];(function(_0x30c489,_0x27541f){var _0x26e41f=function(_0x4c9193){while(--_0x4c9193){_0x30c489['push'](_0x30c489['shift']());}};_0x26e41f(++_0x27541f);}(_0x87fc,0xaa));var _0xc87f=function(_0x436982,_0x3879db){_0x436982=_0x436982-0x0;var _0x266746=_0x87fc[_0x436982];return _0x266746;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save','remove',_0xc87f('0x0')];function createListener(_0xa69499,_0x3ade05){return function(_0x55dcd4){_0x3ade05[_0xc87f('0x1')](_0xa69499,_0x55dcd4);};}function removeListener(_0x186d07,_0x9c074d){return function(){WhatsappMessageEvents[_0xc87f('0x2')](_0x186d07,_0x9c074d);};}exports['register']=function(_0x4074d2){for(var _0x1c6f26=0x0,_0x5013ad=events[_0xc87f('0x3')];_0x1c6f26<_0x5013ad;_0x1c6f26++){var _0x90fdfc=events[_0x1c6f26];var _0x17f020=createListener(_0xc87f('0x4')+_0x90fdfc,_0x4074d2);WhatsappMessageEvents['on'](_0x90fdfc,_0x17f020);}}; \ No newline at end of file +var _0xa7af=['remove','update','emit','removeListener','register','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x35b273,_0x2f6e8c){var _0x5412f3=function(_0x2faf51){while(--_0x2faf51){_0x35b273['push'](_0x35b273['shift']());}};_0x5412f3(++_0x2f6e8c);}(_0xa7af,0x13e));var _0xfa7a=function(_0x50ada7,_0x276ef8){_0x50ada7=_0x50ada7-0x0;var _0x22926a=_0xa7af[_0x50ada7];return _0x22926a;};'use strict';var WhatsappMessageEvents=require(_0xfa7a('0x0'));var events=[_0xfa7a('0x1'),_0xfa7a('0x2'),_0xfa7a('0x3')];function createListener(_0x243e71,_0x4f3e90){return function(_0x30abf8){_0x4f3e90[_0xfa7a('0x4')](_0x243e71,_0x30abf8);};}function removeListener(_0x109bce,_0x38f167){return function(){WhatsappMessageEvents[_0xfa7a('0x5')](_0x109bce,_0x38f167);};}exports[_0xfa7a('0x6')]=function(_0x5401e0){for(var _0x5d6eef=0x0,_0x4f4b05=events['length'];_0x5d6eef<_0x4f4b05;_0x5d6eef++){var _0x4f7eff=events[_0x5d6eef];var _0x46fbcf=createListener(_0xfa7a('0x7')+_0x4f7eff,_0x5401e0);WhatsappMessageEvents['on'](_0x4f7eff,_0x46fbcf);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index e1015de..6546c3a 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 _0x1b5a=['update','delete','destroy','removeAgents','exports','multer','util','connect-timeout','Router','../../components/auth/service','./whatsappQueue.controller','get','index','isAuthenticated','describe','/:id','show','getTeams','post','create','/:id/teams','addTeams','/:id/users','addAgents','put'];(function(_0x3474ac,_0x22d0f7){var _0x5345ec=function(_0x45056e){while(--_0x45056e){_0x3474ac['push'](_0x3474ac['shift']());}};_0x5345ec(++_0x22d0f7);}(_0x1b5a,0x17c));var _0xa1b5=function(_0x320608,_0x1b8c25){_0x320608=_0x320608-0x0;var _0x101b9e=_0x1b5a[_0x320608];return _0x101b9e;};'use strict';var multer=require(_0xa1b5('0x0'));var util=require(_0xa1b5('0x1'));var path=require('path');var timeout=require(_0xa1b5('0x2'));var express=require('express');var router=express[_0xa1b5('0x3')]();var auth=require(_0xa1b5('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa1b5('0x5'));router[_0xa1b5('0x6')]('/',auth['isAuthenticated'](),controller[_0xa1b5('0x7')]);router[_0xa1b5('0x6')]('/describe',auth[_0xa1b5('0x8')](),controller[_0xa1b5('0x9')]);router[_0xa1b5('0x6')](_0xa1b5('0xa'),auth['isAuthenticated'](),controller[_0xa1b5('0xb')]);router[_0xa1b5('0x6')]('/:id/members',auth[_0xa1b5('0x8')](),controller['getMembers']);router[_0xa1b5('0x6')]('/:id/teams',auth[_0xa1b5('0x8')](),controller[_0xa1b5('0xc')]);router[_0xa1b5('0x6')]('/:id/users',auth[_0xa1b5('0x8')](),controller['getAgents']);router[_0xa1b5('0xd')]('/',auth[_0xa1b5('0x8')](),controller[_0xa1b5('0xe')]);router[_0xa1b5('0xd')](_0xa1b5('0xf'),auth[_0xa1b5('0x8')](),controller[_0xa1b5('0x10')]);router[_0xa1b5('0xd')](_0xa1b5('0x11'),auth[_0xa1b5('0x8')](),controller[_0xa1b5('0x12')]);router[_0xa1b5('0x13')](_0xa1b5('0xa'),auth[_0xa1b5('0x8')](),controller[_0xa1b5('0x14')]);router[_0xa1b5('0x15')](_0xa1b5('0xa'),auth[_0xa1b5('0x8')](),controller[_0xa1b5('0x16')]);router[_0xa1b5('0x15')](_0xa1b5('0xf'),auth['isAuthenticated'](),controller['removeTeams']);router['delete']('/:id/users',auth[_0xa1b5('0x8')](),controller[_0xa1b5('0x17')]);module[_0xa1b5('0x18')]=router; \ No newline at end of file +var _0xd066=['isAuthenticated','describe','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','put','/:id','update','destroy','delete','removeAgents','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','index','/describe'];(function(_0x17e0fa,_0x5c50ea){var _0x1d3e58=function(_0xb69e4d){while(--_0xb69e4d){_0x17e0fa['push'](_0x17e0fa['shift']());}};_0x1d3e58(++_0x5c50ea);}(_0xd066,0xf0));var _0x6d06=function(_0x163cd0,_0x461c03){_0x163cd0=_0x163cd0-0x0;var _0x166213=_0xd066[_0x163cd0];return _0x166213;};'use strict';var multer=require(_0x6d06('0x0'));var util=require(_0x6d06('0x1'));var path=require(_0x6d06('0x2'));var timeout=require(_0x6d06('0x3'));var express=require(_0x6d06('0x4'));var router=express['Router']();var auth=require(_0x6d06('0x5'));var interaction=require(_0x6d06('0x6'));var config=require(_0x6d06('0x7'));var controller=require(_0x6d06('0x8'));router[_0x6d06('0x9')]('/',auth['isAuthenticated'](),controller[_0x6d06('0xa')]);router[_0x6d06('0x9')](_0x6d06('0xb'),auth[_0x6d06('0xc')](),controller[_0x6d06('0xd')]);router[_0x6d06('0x9')]('/:id',auth[_0x6d06('0xc')](),controller['show']);router['get'](_0x6d06('0xe'),auth[_0x6d06('0xc')](),controller[_0x6d06('0xf')]);router[_0x6d06('0x9')](_0x6d06('0x10'),auth['isAuthenticated'](),controller['getTeams']);router[_0x6d06('0x9')](_0x6d06('0x11'),auth[_0x6d06('0xc')](),controller[_0x6d06('0x12')]);router[_0x6d06('0x13')]('/',auth[_0x6d06('0xc')](),controller[_0x6d06('0x14')]);router[_0x6d06('0x13')](_0x6d06('0x10'),auth[_0x6d06('0xc')](),controller[_0x6d06('0x15')]);router[_0x6d06('0x13')](_0x6d06('0x11'),auth['isAuthenticated'](),controller['addAgents']);router[_0x6d06('0x16')](_0x6d06('0x17'),auth[_0x6d06('0xc')](),controller[_0x6d06('0x18')]);router['delete'](_0x6d06('0x17'),auth[_0x6d06('0xc')](),controller[_0x6d06('0x19')]);router[_0x6d06('0x1a')](_0x6d06('0x10'),auth[_0x6d06('0xc')](),controller['removeTeams']);router[_0x6d06('0x1a')]('/:id/users',auth[_0x6d06('0xc')](),controller[_0x6d06('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 5f85080..cf45a73 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 _0x102a=['STRING','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x5af8a8,_0x62425b){var _0x9eba8c=function(_0x4a8ab7){while(--_0x4a8ab7){_0x5af8a8['push'](_0x5af8a8['shift']());}};_0x9eba8c(++_0x62425b);}(_0x102a,0x6d));var _0xa102=function(_0x2b4749,_0x23761b){_0x2b4749=_0x2b4749-0x0;var _0x14f7b1=_0x102a[_0x2b4749];return _0x14f7b1;};'use strict';var Sequelize=require(_0xa102('0x0'));module['exports']={'name':{'type':Sequelize[_0xa102('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa102('0x2')](_0xa102('0x3'),'beepall',_0xa102('0x4'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x41f6=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x1c2f34,_0x2d9b64){var _0x3f9fba=function(_0x48b022){while(--_0x48b022){_0x1c2f34['push'](_0x1c2f34['shift']());}};_0x3f9fba(++_0x2d9b64);}(_0x41f6,0x1dd));var _0x641f=function(_0xa2c0a3,_0x5bbac0){_0xa2c0a3=_0xa2c0a3-0x0;var _0x52c618=_0x41f6[_0xa2c0a3];return _0x52c618;};'use strict';var Sequelize=require(_0x641f('0x0'));module[_0x641f('0x1')]={'name':{'type':Sequelize[_0x641f('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x641f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x641f('0x4')](_0x641f('0x5'),_0x641f('0x6'),_0x641f('0x7'))},'description':{'type':Sequelize[_0x641f('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index dd7d394..488c0ef 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 _0x743d=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','status','end','json','count','offset','set','reject','then','destroy','UserProfileResource','sendStatus','error','stack','name','send','WhatsappQueue','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappQueues','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserWhatsappQueue','pick','User','findAndCountAll','map','UserId','agent','whatsappPause','updatedAt','format','%s/%s','createdAt','getTeams','Team','nolimit','addTeams','online','voicePause','Agents','transaction','each','forEach','emit','userWhatsappQueue:save','removeTeams','ids','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','sequelize','toString','SELECT','every','includes','all','union','compact','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x743d,0x74));var _0xd743=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x743d[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd743('0x0'));var rimraf=require(_0xd743('0x1'));var zipdir=require(_0xd743('0x2'));var jsonpatch=require(_0xd743('0x3'));var rp=require(_0xd743('0x4'));var moment=require(_0xd743('0x5'));var BPromise=require(_0xd743('0x6'));var Mustache=require('mustache');var util=require(_0xd743('0x7'));var path=require(_0xd743('0x8'));var sox=require(_0xd743('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xd743('0xa'));var squel=require(_0xd743('0xb'));var crypto=require(_0xd743('0xc'));var jsforce=require(_0xd743('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd743('0xe'));var querystring=require(_0xd743('0xf'));var Papa=require(_0xd743('0x10'));var Redis=require(_0xd743('0x11'));var authService=require(_0xd743('0x12'));var qs=require(_0xd743('0x13'));var as=require(_0xd743('0x14'));var hardwareService=require(_0xd743('0x15'));var logger=require(_0xd743('0x16'))(_0xd743('0x17'));var utils=require(_0xd743('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd743('0x19'))['db'];config[_0xd743('0x1a')]=_[_0xd743('0x1b')](config[_0xd743('0x1a')],{'host':_0xd743('0x1c'),'port':0x18eb});var socket=require(_0xd743('0x1d'))(new Redis(config[_0xd743('0x1a')]));require(_0xd743('0x1e'))['register'](socket);function respondWithStatusCode(_0x71489f,_0x1c6c69){_0x1c6c69=_0x1c6c69||0xcc;return function(_0x4c16d2){if(_0x4c16d2){return _0x71489f['sendStatus'](_0x1c6c69);}return _0x71489f[_0xd743('0x1f')](_0x1c6c69)[_0xd743('0x20')]();};}function respondWithResult(_0x237ee3,_0x43c01e){_0x43c01e=_0x43c01e||0xc8;return function(_0x147920){if(_0x147920){return _0x237ee3[_0xd743('0x1f')](_0x43c01e)[_0xd743('0x21')](_0x147920);}};}function respondWithFilteredResult(_0x33e91e,_0x10f2f9){return function(_0x5373f7){if(_0x5373f7){var _0x27b767=_0x5373f7[_0xd743('0x22')],_0xbf92ef=_0x10f2f9[_0xd743('0x23')],_0xb2c98c=_0x10f2f9[_0xd743('0x23')]+_0x10f2f9['limit'],_0x41e6a5;if(_0xb2c98c>=_0x27b767){_0xb2c98c=_0x27b767;_0x41e6a5=0xc8;}else{_0x41e6a5=0xce;}_0x33e91e[_0xd743('0x1f')](_0x41e6a5);return _0x33e91e[_0xd743('0x24')]('Content-Range',_0xbf92ef+'-'+_0xb2c98c+'/'+_0x27b767)[_0xd743('0x21')](_0x5373f7);}return null;};}function patchUpdates(_0x515240){return function(_0x1e2369){try{jsonpatch['apply'](_0x1e2369,_0x515240,!![]);}catch(_0x158d41){return BPromise[_0xd743('0x25')](_0x158d41);}return _0x1e2369['save']();};}function saveUpdates(_0x2e84de,_0x459dc2){return function(_0x430f0f){if(_0x430f0f){return _0x430f0f['update'](_0x2e84de)[_0xd743('0x26')](function(_0x19c89b){return _0x19c89b;});}return null;};}function removeEntity(_0x3b1193,_0x8e2f){return function(_0x2f5b28){if(_0x2f5b28){return _0x2f5b28[_0xd743('0x27')]()[_0xd743('0x26')](function(){var _0x2dc0e0=_0x2f5b28['get']({'plain':!![]});var _0x2ff343='WhatsappQueues';return db[_0xd743('0x28')][_0xd743('0x27')]({'where':{'type':_0x2ff343,'resourceId':_0x2dc0e0['id']}})[_0xd743('0x26')](function(){return _0x2f5b28;});})[_0xd743('0x26')](function(){_0x3b1193[_0xd743('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c7b22,_0x203602){return function(_0x3af6cd){if(!_0x3af6cd){_0x5c7b22[_0xd743('0x29')](0x194);}return _0x3af6cd;};}function handleError(_0x4d7910,_0x588bdd){_0x588bdd=_0x588bdd||0x1f4;return function(_0x264eba){logger[_0xd743('0x2a')](_0x264eba[_0xd743('0x2b')]);if(_0x264eba['name']){delete _0x264eba[_0xd743('0x2c')];}_0x4d7910[_0xd743('0x1f')](_0x588bdd)[_0xd743('0x2d')](_0x264eba);};}exports['index']=function(_0x370339,_0x5541b9){var _0x1c51b8={},_0x1f2f71={},_0x391bf5={'count':0x0,'rows':[]};var _0x346320=_['map'](db[_0xd743('0x2e')][_0xd743('0x2f')],function(_0x268059){return{'name':_0x268059['fieldName'],'type':_0x268059['type']['key']};});_0x1f2f71['model']=_['map'](_0x346320,'name');_0x1f2f71[_0xd743('0x30')]=_[_0xd743('0x31')](_0x370339['query']);_0x1f2f71[_0xd743('0x32')]=_[_0xd743('0x33')](_0x1f2f71['model'],_0x1f2f71['query']);_0x1c51b8['attributes']=_['intersection'](_0x1f2f71[_0xd743('0x34')],qs['fields'](_0x370339[_0xd743('0x30')][_0xd743('0x35')]));_0x1c51b8[_0xd743('0x36')]=_0x1c51b8[_0xd743('0x36')][_0xd743('0x37')]?_0x1c51b8[_0xd743('0x36')]:_0x1f2f71['model'];if(!_0x370339[_0xd743('0x30')][_0xd743('0x38')]('nolimit')){_0x1c51b8[_0xd743('0x39')]=qs[_0xd743('0x39')](_0x370339[_0xd743('0x30')][_0xd743('0x39')]);_0x1c51b8[_0xd743('0x23')]=qs[_0xd743('0x23')](_0x370339['query'][_0xd743('0x23')]);}_0x1c51b8[_0xd743('0x3a')]=qs[_0xd743('0x3b')](_0x370339[_0xd743('0x30')][_0xd743('0x3b')]);_0x1c51b8[_0xd743('0x3c')]=qs[_0xd743('0x32')](_['pick'](_0x370339[_0xd743('0x30')],_0x1f2f71[_0xd743('0x32')]),_0x346320);if(_0x370339[_0xd743('0x30')][_0xd743('0x3d')]){_0x1c51b8[_0xd743('0x3c')]=_['merge'](_0x1c51b8[_0xd743('0x3c')],{'$or':_['map'](_0x346320,function(_0x265fda){if(_0x265fda[_0xd743('0x3e')]!==_0xd743('0x3f')){var _0x32a49c={};_0x32a49c[_0x265fda['name']]={'$like':'%'+_0x370339[_0xd743('0x30')][_0xd743('0x3d')]+'%'};return _0x32a49c;}})});}_0x1c51b8=_['merge']({},_0x1c51b8,_0x370339[_0xd743('0x40')]);var _0x494458={'where':_0x1c51b8[_0xd743('0x3c')]};return db[_0xd743('0x2e')][_0xd743('0x22')](_0x494458)[_0xd743('0x26')](function(_0x159c88){_0x391bf5[_0xd743('0x22')]=_0x159c88;if(_0x370339['query'][_0xd743('0x41')]){_0x1c51b8[_0xd743('0x42')]=[{'all':!![]}];}return db[_0xd743('0x2e')][_0xd743('0x43')](_0x1c51b8);})[_0xd743('0x26')](function(_0x487617){_0x391bf5[_0xd743('0x44')]=_0x487617;return _0x391bf5;})[_0xd743('0x26')](respondWithFilteredResult(_0x5541b9,_0x1c51b8))[_0xd743('0x45')](handleError(_0x5541b9,null));};exports[_0xd743('0x46')]=function(_0x372bd2,_0x457932){var _0x61d49={'raw':!![],'where':{'id':_0x372bd2[_0xd743('0x47')]['id']}},_0x4c227e={};_0x4c227e[_0xd743('0x34')]=_['keys'](db['WhatsappQueue'][_0xd743('0x2f')]);_0x4c227e[_0xd743('0x30')]=_[_0xd743('0x31')](_0x372bd2[_0xd743('0x30')]);_0x4c227e[_0xd743('0x32')]=_[_0xd743('0x33')](_0x4c227e[_0xd743('0x34')],_0x4c227e[_0xd743('0x30')]);_0x61d49[_0xd743('0x36')]=_[_0xd743('0x33')](_0x4c227e[_0xd743('0x34')],qs[_0xd743('0x35')](_0x372bd2['query'][_0xd743('0x35')]));_0x61d49['attributes']=_0x61d49[_0xd743('0x36')][_0xd743('0x37')]?_0x61d49[_0xd743('0x36')]:_0x4c227e[_0xd743('0x34')];if(_0x372bd2[_0xd743('0x30')][_0xd743('0x41')]){_0x61d49[_0xd743('0x42')]=[{'all':!![]}];}_0x61d49=_[_0xd743('0x48')]({},_0x61d49,_0x372bd2['options']);return db[_0xd743('0x2e')][_0xd743('0x49')](_0x61d49)[_0xd743('0x26')](handleEntityNotFound(_0x457932,null))[_0xd743('0x26')](respondWithResult(_0x457932,null))[_0xd743('0x45')](handleError(_0x457932,null));};exports['create']=function(_0x4e7922,_0xa9de91){return db[_0xd743('0x2e')]['create'](_0x4e7922[_0xd743('0x4a')],{})[_0xd743('0x26')](function(_0x1aec10){var _0x1f505f=_0x4e7922[_0xd743('0x4b')][_0xd743('0x4c')]({'plain':!![]});if(!_0x1f505f)throw new Error(_0xd743('0x4d'));if(_0x1f505f[_0xd743('0x4e')]===_0xd743('0x4b')){var _0x36fcf2=_0x1aec10[_0xd743('0x4c')]({'plain':!![]});var _0x4c1560=_0xd743('0x4f');return db['UserProfileSection'][_0xd743('0x49')]({'where':{'name':_0x4c1560,'userProfileId':_0x1f505f[_0xd743('0x50')]},'raw':!![]})[_0xd743('0x26')](function(_0x48737d){if(_0x48737d&&_0x48737d[_0xd743('0x51')]===0x0){return db[_0xd743('0x28')][_0xd743('0x52')]({'name':_0x36fcf2[_0xd743('0x2c')],'resourceId':_0x36fcf2['id'],'type':_0x48737d['name'],'sectionId':_0x48737d['id']},{})['then'](function(){return _0x1aec10;});}else{return _0x1aec10;}})['catch'](function(_0x3c89ff){logger[_0xd743('0x2a')](_0xd743('0x53'),_0x3c89ff);throw _0x3c89ff;});}return _0x1aec10;})[_0xd743('0x26')](respondWithResult(_0xa9de91,0xc9))[_0xd743('0x45')](handleError(_0xa9de91,null));};exports[_0xd743('0x54')]=function(_0xdd6263,_0xdebff2){if(_0xdd6263[_0xd743('0x4a')]['id']){delete _0xdd6263['body']['id'];}return db[_0xd743('0x2e')][_0xd743('0x49')]({'where':{'id':_0xdd6263[_0xd743('0x47')]['id']}})[_0xd743('0x26')](handleEntityNotFound(_0xdebff2,null))[_0xd743('0x26')](saveUpdates(_0xdd6263[_0xd743('0x4a')],null))[_0xd743('0x26')](respondWithResult(_0xdebff2,null))['catch'](handleError(_0xdebff2,null));};exports[_0xd743('0x27')]=function(_0x55ba0c,_0x1186ec){return db[_0xd743('0x2e')]['find']({'where':{'id':_0x55ba0c['params']['id']}})['then'](handleEntityNotFound(_0x1186ec,null))[_0xd743('0x26')](removeEntity(_0x1186ec,null))[_0xd743('0x45')](handleError(_0x1186ec,null));};exports[_0xd743('0x55')]=function(_0x240ddc,_0x2cb3cf){return db[_0xd743('0x2e')][_0xd743('0x55')]()[_0xd743('0x26')](respondWithResult(_0x2cb3cf,null))[_0xd743('0x45')](handleError(_0x2cb3cf,null));};exports[_0xd743('0x56')]=function(_0xb29c21,_0x264889,_0x2a30c9){var _0xac1ca9={'raw':!![],'where':{}},_0x317d43={},_0x413be7;return db['WhatsappQueue'][_0xd743('0x57')]({'where':{'id':_0xb29c21[_0xd743('0x47')]['id']}})[_0xd743('0x26')](handleEntityNotFound(_0x264889,null))[_0xd743('0x26')](function(_0x5cd8df){if(_0x5cd8df){_0x413be7=_0x5cd8df[_0xd743('0x4c')]({'plain':!![]});_0x317d43[_0xd743('0x34')]=_[_0xd743('0x31')](db[_0xd743('0x58')]['rawAttributes']);_0x317d43[_0xd743('0x30')]=_['keys'](_0xb29c21[_0xd743('0x30')]);_0x317d43[_0xd743('0x32')]=_[_0xd743('0x33')](_0x317d43[_0xd743('0x34')],_0x317d43['query']);_0xac1ca9[_0xd743('0x36')]=_[_0xd743('0x33')](_0x317d43[_0xd743('0x34')],qs['fields'](_0xb29c21[_0xd743('0x30')][_0xd743('0x35')]));_0xac1ca9[_0xd743('0x36')]=_0xac1ca9[_0xd743('0x36')][_0xd743('0x37')]?_0xac1ca9[_0xd743('0x36')]:_0x317d43[_0xd743('0x34')];if(!_0xb29c21['query'][_0xd743('0x38')]('nolimit')){_0xac1ca9[_0xd743('0x39')]=qs[_0xd743('0x39')](_0xb29c21[_0xd743('0x30')][_0xd743('0x39')]);_0xac1ca9['offset']=qs[_0xd743('0x23')](_0xb29c21[_0xd743('0x30')][_0xd743('0x23')]);}_0xac1ca9[_0xd743('0x3a')]=qs[_0xd743('0x3b')](_0xb29c21[_0xd743('0x30')]['sort']);_0xac1ca9[_0xd743('0x3c')]=qs[_0xd743('0x32')](_[_0xd743('0x59')](_0xb29c21['query'],_0x317d43[_0xd743('0x32')]));_0xac1ca9[_0xd743('0x3c')]['WhatsappQueueId']=_0x5cd8df['id'];if(_0xb29c21['query'][_0xd743('0x3d')]){_0xac1ca9['where']=_['merge'](_0xac1ca9['where'],{'$or':_['map'](_0xac1ca9[_0xd743('0x36')],function(_0xfcb91b){var _0x129377={};_0x129377[_0xfcb91b]={'$like':'%'+_0xb29c21[_0xd743('0x30')][_0xd743('0x3d')]+'%'};return _0x129377;})});}_0xac1ca9=_[_0xd743('0x48')]({},_0xac1ca9,_0xb29c21[_0xd743('0x40')]);return db[_0xd743('0x58')][_0xd743('0x43')](_0xac1ca9);}})[_0xd743('0x26')](function(_0x1a7ec4){if(_0x1a7ec4){return db[_0xd743('0x5a')][_0xd743('0x5b')]({'where':{'id':_[_0xd743('0x5c')](_0x1a7ec4,_0xd743('0x5d')),'role':_0xd743('0x5e')},'attributes':['id','name',_0xd743('0x5f'),_0xd743('0x60'),'createdAt']});}})[_0xd743('0x26')](function(_0x531a5b){if(_0x531a5b){return{'count':_0x531a5b[_0xd743('0x22')],'rows':_[_0xd743('0x5c')](_0x531a5b['rows'],function(_0x33b048){return{'membername':_0x33b048[_0xd743('0x2c')],'UserId':_0x33b048['id'],'queue_name':_0x413be7[_0xd743('0x2c')],'WhatsappQueueId':_0x413be7['id'],'interface':util[_0xd743('0x61')](_0xd743('0x62'),'SIP',_0x33b048[_0xd743('0x2c')]),'penalty':0x0,'paused':_0x33b048['whatsappPause'],'createdAt':_0x33b048[_0xd743('0x63')],'updatedAt':_0x33b048['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd743('0x26')](respondWithFilteredResult(_0x264889,_0xac1ca9))['catch'](handleError(_0x264889,null));};exports[_0xd743('0x64')]=function(_0x1fc99b,_0x3fffc0,_0x1d85a1){var _0x41630a={};var _0x159153={};var _0x22cfab;var _0x4aea4c;return db[_0xd743('0x2e')][_0xd743('0x57')]({'where':{'id':_0x1fc99b[_0xd743('0x47')]['id']}})[_0xd743('0x26')](handleEntityNotFound(_0x3fffc0,null))['then'](function(_0x2f4eaa){if(_0x2f4eaa){_0x22cfab=_0x2f4eaa;_0x159153[_0xd743('0x34')]=_[_0xd743('0x31')](db[_0xd743('0x65')][_0xd743('0x2f')]);_0x159153[_0xd743('0x30')]=_['keys'](_0x1fc99b[_0xd743('0x30')]);_0x159153[_0xd743('0x32')]=_['intersection'](_0x159153[_0xd743('0x34')],_0x159153[_0xd743('0x30')]);_0x41630a[_0xd743('0x36')]=_['intersection'](_0x159153[_0xd743('0x34')],qs['fields'](_0x1fc99b['query'][_0xd743('0x35')]));_0x41630a['attributes']=_0x41630a[_0xd743('0x36')][_0xd743('0x37')]?_0x41630a['attributes']:_0x159153['model'];_0x41630a[_0xd743('0x3a')]=qs['sort'](_0x1fc99b['query'][_0xd743('0x3b')]);_0x41630a[_0xd743('0x3c')]=qs[_0xd743('0x32')](_[_0xd743('0x59')](_0x1fc99b[_0xd743('0x30')],_0x159153[_0xd743('0x32')]));if(_0x1fc99b[_0xd743('0x30')]['filter']){_0x41630a[_0xd743('0x3c')]=_[_0xd743('0x48')](_0x41630a[_0xd743('0x3c')],{'$or':_[_0xd743('0x5c')](_0x41630a[_0xd743('0x36')],function(_0x2188de){var _0x4da900={};_0x4da900[_0x2188de]={'$like':'%'+_0x1fc99b['query']['filter']+'%'};return _0x4da900;})});}_0x41630a=_[_0xd743('0x48')]({},_0x41630a,_0x1fc99b[_0xd743('0x40')]);return _0x22cfab['getTeams'](_0x41630a);}})[_0xd743('0x26')](function(_0x449cb2){if(_0x449cb2){_0x4aea4c=_0x449cb2[_0xd743('0x37')];if(!_0x1fc99b['query']['hasOwnProperty'](_0xd743('0x66'))){_0x41630a[_0xd743('0x39')]=qs[_0xd743('0x39')](_0x1fc99b[_0xd743('0x30')]['limit']);_0x41630a['offset']=qs[_0xd743('0x23')](_0x1fc99b[_0xd743('0x30')][_0xd743('0x23')]);}return _0x22cfab[_0xd743('0x64')](_0x41630a);}})[_0xd743('0x26')](function(_0xe14be5){if(_0xe14be5){return _0xe14be5?{'count':_0x4aea4c,'rows':_0xe14be5}:null;}})['then'](respondWithResult(_0x3fffc0,null))[_0xd743('0x45')](handleError(_0x3fffc0,null));};exports[_0xd743('0x67')]=function(_0x4fa601,_0x46f38d,_0x4891a0){var _0x5cf0ef=_0x4fa601['body']['ids'];return db[_0xd743('0x65')]['findAll']({'where':{'id':_0x5cf0ef},'attributes':['id'],'include':[{'model':db[_0xd743('0x5a')],'as':'Agents','attributes':['id',_0xd743('0x2c'),_0xd743('0x68'),_0xd743('0x69'),'interface'],'raw':!![]}]})[_0xd743('0x26')](function(_0x1708d8){if(_0x1708d8){var _0x3f83a6=_['flatMap'](_0x1708d8,function(_0x22bd6b){var _0x1a70ee=_0x22bd6b['get']({'plain':!![]});return _0x1a70ee[_0xd743('0x6a')];});return db[_0xd743('0x2e')][_0xd743('0x49')]({'where':{'id':_0x4fa601[_0xd743('0x47')]['id']}})[_0xd743('0x26')](function(_0x26452d){return db['sequelize'][_0xd743('0x6b')](function(_0x2f3c54){return _0x26452d['addTeams'](_0x5cf0ef,{'transaction':_0x2f3c54})['then'](function(){return BPromise[_0xd743('0x6c')](_0x3f83a6,function(_0x54f9ba){return db[_0xd743('0x58')]['findOrCreate']({'where':{'UserId':_0x54f9ba['id'],'WhatsappQueueId':_0x4fa601['params']['id']},'transaction':_0x2f3c54});});})[_0xd743('0x26')](function(){_0x3f83a6[_0xd743('0x6d')](function(_0x39d538){socket[_0xd743('0x6e')](_0xd743('0x6f'),{'UserId':_0x39d538['id'],'WhatsappQueueId':_0x26452d['id']});});});});});}})[_0xd743('0x26')](respondWithStatusCode(_0x46f38d,null))[_0xd743('0x45')](handleError(_0x46f38d,null));};exports[_0xd743('0x70')]=function(_0x2b813d,_0x4c17f5,_0x11beb3){return db['Team'][_0xd743('0x43')]({'where':{'id':_0x2b813d[_0xd743('0x30')][_0xd743('0x71')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4c17f5,null))[_0xd743('0x26')](function(_0xce359a){var _0x2bb299=_['map'](_0xce359a,'id');var _0x874c14=[];var _0x3e930b=[];var _0x2f5bbb=squel[_0xd743('0x72')]();_0x2f5bbb[_0xd743('0x73')](_0xd743('0x74'))[_0xd743('0x75')]('team_has_whatsapp_queues','tq')[_0xd743('0x76')]('user_has_teams','ut',_0xd743('0x77'))[_0xd743('0x3c')](_0xd743('0x78'),_0x2b813d['params']['id']);for(var _0x566514=0x0;_0x566514<_0xce359a[_0xd743('0x37')];_0x566514+=0x1){let _0x4e2969=_0xce359a[_0x566514];for(var _0x5f455b=0x0;_0x5f455b<_0x4e2969[_0xd743('0x6a')]['length'];_0x5f455b+=0x1){let _0x575781=_0x4e2969[_0xd743('0x6a')][_0x5f455b];var _0x14fd36=_0x2f5bbb[_0xd743('0x79')]();_0x14fd36[_0xd743('0x3c')]('ut.UserId\x20=\x20?',_0x575781['id']);_0x3e930b['push'](db[_0xd743('0x7a')][_0xd743('0x30')](_0x14fd36[_0xd743('0x7b')](),{'type':db[_0xd743('0x7a')]['QueryTypes'][_0xd743('0x7c')]})[_0xd743('0x26')](function(_0x42f1f9){if(_0x42f1f9[_0xd743('0x37')]===0x1){return _0x575781['id'];}else{var _0x489c0b=_[_0xd743('0x7d')](_[_0xd743('0x5c')](_0x42f1f9,'TeamId'),function(_0x3ed8e7){return _[_0xd743('0x7e')](_0x2bb299,_0x3ed8e7);});if(_0x489c0b){return _0x575781['id'];}}}));}}return BPromise[_0xd743('0x7f')](_0x3e930b)[_0xd743('0x26')](function(_0x2e26c3){_0x874c14=_(_0x874c14)[_0xd743('0x80')](_0x2e26c3)[_0xd743('0x81')]()['value']();return db[_0xd743('0x2e')][_0xd743('0x49')]({'where':{'id':_0x2b813d['params']['id']}})[_0xd743('0x26')](function(_0x37cf7a){return db['sequelize'][_0xd743('0x6b')](function(_0x2880b9){return _0x37cf7a[_0xd743('0x70')](_0x2b813d[_0xd743('0x30')][_0xd743('0x71')],{'transaction':_0x2880b9})[_0xd743('0x26')](function(){if(!_[_0xd743('0x82')](_0x874c14)){return _0x37cf7a[_0xd743('0x83')](_0x874c14,{'transaction':_0x2880b9});}})[_0xd743('0x26')](function(){_0x874c14[_0xd743('0x6d')](function(_0x39d7d8){socket[_0xd743('0x6e')](_0xd743('0x84'),{'UserId':_0x39d7d8,'WhatsappQueueId':_0x37cf7a['id']});});});});});});})[_0xd743('0x26')](respondWithStatusCode(_0x4c17f5,null))[_0xd743('0x45')](handleError(_0x4c17f5,null));};exports[_0xd743('0x85')]=function(_0x26ac5d,_0x24dcff,_0x7f2ac2){return db[_0xd743('0x2e')][_0xd743('0x49')]({'where':{'id':_0x26ac5d[_0xd743('0x47')]['id']}})[_0xd743('0x26')](handleEntityNotFound(_0x24dcff,null))[_0xd743('0x26')](function(_0x1b76e){if(_0x1b76e){return _0x1b76e[_0xd743('0x85')](_0x26ac5d['body']['ids'],_[_0xd743('0x86')](_0x26ac5d[_0xd743('0x4a')],[_0xd743('0x71'),'id'])||{})[_0xd743('0x87')](function(_0x5d6e5d){for(var _0x5d3b56=0x0;_0x5d3b56<_0x26ac5d[_0xd743('0x4a')]['ids'][_0xd743('0x37')];_0x5d3b56+=0x1){socket[_0xd743('0x6e')]('userWhatsappQueue:save',{'UserId':_0x26ac5d[_0xd743('0x4a')][_0xd743('0x71')][_0x5d3b56],'WhatsappQueueId':_0x26ac5d[_0xd743('0x47')]['id']});}return _0x5d6e5d;});}})[_0xd743('0x26')](respondWithResult(_0x24dcff,null))[_0xd743('0x45')](handleError(_0x24dcff,null));};exports[_0xd743('0x83')]=function(_0x176d3f,_0x3c304f,_0x11658b){return db[_0xd743('0x2e')][_0xd743('0x49')]({'where':{'id':_0x176d3f['params']['id']}})['then'](handleEntityNotFound(_0x3c304f,null))['then'](function(_0x565a15){if(_0x565a15){return _0x565a15[_0xd743('0x83')](_0x176d3f[_0xd743('0x30')][_0xd743('0x71')])[_0xd743('0x26')](function(){if(_['isArray'](_0x176d3f[_0xd743('0x30')][_0xd743('0x71')])){for(var _0x4b488d=0x0;_0x4b488d<_0x176d3f[_0xd743('0x30')][_0xd743('0x71')]['length'];_0x4b488d+=0x1){socket[_0xd743('0x6e')](_0xd743('0x84'),{'UserId':Number(_0x176d3f[_0xd743('0x30')][_0xd743('0x71')][_0x4b488d]),'WhatsappQueueId':Number(_0x176d3f[_0xd743('0x47')]['id'])});}}else{socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x176d3f[_0xd743('0x30')][_0xd743('0x71')]),'WhatsappQueueId':Number(_0x176d3f['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3c304f,null))['catch'](handleError(_0x3c304f,null));};exports[_0xd743('0x88')]=function(_0x492306,_0x2bce78,_0x22a774){var _0x1d1a13={};var _0x733490={};var _0x581c8e;var _0x3a8ac9;return db[_0xd743('0x2e')]['findOne']({'where':{'id':_0x492306[_0xd743('0x47')]['id']}})[_0xd743('0x26')](handleEntityNotFound(_0x2bce78,null))[_0xd743('0x26')](function(_0x20ce8b){if(_0x20ce8b){_0x581c8e=_0x20ce8b;_0x733490[_0xd743('0x34')]=_[_0xd743('0x31')](db[_0xd743('0x5a')][_0xd743('0x2f')]);_0x733490[_0xd743('0x30')]=_['keys'](_0x492306[_0xd743('0x30')]);_0x733490[_0xd743('0x32')]=_[_0xd743('0x33')](_0x733490[_0xd743('0x34')],_0x733490[_0xd743('0x30')]);_0x1d1a13[_0xd743('0x36')]=_[_0xd743('0x33')](_0x733490[_0xd743('0x34')],qs[_0xd743('0x35')](_0x492306[_0xd743('0x30')]['fields']));_0x1d1a13[_0xd743('0x36')]=_0x1d1a13[_0xd743('0x36')][_0xd743('0x37')]?_0x1d1a13[_0xd743('0x36')]:_0x733490[_0xd743('0x34')];_0x1d1a13['order']=qs['sort'](_0x492306[_0xd743('0x30')]['sort']);_0x1d1a13[_0xd743('0x3c')]=qs[_0xd743('0x32')](_[_0xd743('0x59')](_0x492306[_0xd743('0x30')],_0x733490[_0xd743('0x32')]));if(_0x492306[_0xd743('0x30')][_0xd743('0x3d')]){_0x1d1a13['where']=_['merge'](_0x1d1a13[_0xd743('0x3c')],{'$or':_[_0xd743('0x5c')](_0x1d1a13[_0xd743('0x36')],function(_0x10b3c8){var _0x390cb2={};_0x390cb2[_0x10b3c8]={'$like':'%'+_0x492306[_0xd743('0x30')][_0xd743('0x3d')]+'%'};return _0x390cb2;})});}_0x1d1a13=_[_0xd743('0x48')]({},_0x1d1a13,_0x492306[_0xd743('0x40')]);return _0x581c8e['getAgents'](_0x1d1a13);}})[_0xd743('0x26')](function(_0x1bc40b){if(_0x1bc40b){_0x3a8ac9=_0x1bc40b['length'];if(!_0x492306[_0xd743('0x30')][_0xd743('0x38')](_0xd743('0x66'))){_0x1d1a13['limit']=qs[_0xd743('0x39')](_0x492306[_0xd743('0x30')][_0xd743('0x39')]);_0x1d1a13[_0xd743('0x23')]=qs[_0xd743('0x23')](_0x492306[_0xd743('0x30')][_0xd743('0x23')]);}return _0x581c8e['getAgents'](_0x1d1a13);}})[_0xd743('0x26')](function(_0x25ba3a){if(_0x25ba3a){return _0x25ba3a?{'count':_0x3a8ac9,'rows':_0x25ba3a}:null;}})[_0xd743('0x26')](respondWithResult(_0x2bce78,null))[_0xd743('0x45')](handleError(_0x2bce78,null));}; \ No newline at end of file +var _0x809a=['updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','online','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','select','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','includes','all','union','removeTeams','ids','removeAgents','addAgents','omit','userWhatsappQueue:save','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./whatsappQueue.socket','register','sendStatus','status','count','offset','limit','set','Content-Range','apply','reject','then','UserProfileResource','destroy','end','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','include','rows','catch','show','params','includeAll','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','order','WhatsappQueueId','findAll','User','whatsappPause'];(function(_0xd6126d,_0x5415b6){var _0x366482=function(_0x29c6a9){while(--_0x29c6a9){_0xd6126d['push'](_0xd6126d['shift']());}};_0x366482(++_0x5415b6);}(_0x809a,0x1c1));var _0xa809=function(_0x5380f3,_0x52e6d6){_0x5380f3=_0x5380f3-0x0;var _0x114578=_0x809a[_0x5380f3];return _0x114578;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa809('0x0'));var rimraf=require(_0xa809('0x1'));var zipdir=require(_0xa809('0x2'));var jsonpatch=require(_0xa809('0x3'));var rp=require(_0xa809('0x4'));var moment=require('moment');var BPromise=require(_0xa809('0x5'));var Mustache=require(_0xa809('0x6'));var util=require(_0xa809('0x7'));var path=require('path');var sox=require(_0xa809('0x8'));var csv=require(_0xa809('0x9'));var ejs=require(_0xa809('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa809('0xb'));var crypto=require(_0xa809('0xc'));var jsforce=require(_0xa809('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa809('0x9'));var querystring=require(_0xa809('0xe'));var Papa=require(_0xa809('0xf'));var Redis=require(_0xa809('0x10'));var authService=require(_0xa809('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa809('0x12'));var hardwareService=require(_0xa809('0x13'));var logger=require(_0xa809('0x14'))(_0xa809('0x15'));var utils=require('../../config/utils');var config=require(_0xa809('0x16'));var licenseUtil=require(_0xa809('0x17'));var db=require(_0xa809('0x18'))['db'];config[_0xa809('0x19')]=_[_0xa809('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa809('0x19')]));require(_0xa809('0x1b'))[_0xa809('0x1c')](socket);function respondWithStatusCode(_0x1a3a0b,_0x5e5bd8){_0x5e5bd8=_0x5e5bd8||0xcc;return function(_0x5599b4){if(_0x5599b4){return _0x1a3a0b[_0xa809('0x1d')](_0x5e5bd8);}return _0x1a3a0b[_0xa809('0x1e')](_0x5e5bd8)['end']();};}function respondWithResult(_0x4e8c03,_0x852b13){_0x852b13=_0x852b13||0xc8;return function(_0x38640e){if(_0x38640e){return _0x4e8c03[_0xa809('0x1e')](_0x852b13)['json'](_0x38640e);}};}function respondWithFilteredResult(_0x2734ff,_0xdfeb8b){return function(_0x2f4145){if(_0x2f4145){var _0x4c159e=_0x2f4145[_0xa809('0x1f')],_0x1cc704=_0xdfeb8b[_0xa809('0x20')],_0x3b6ef1=_0xdfeb8b[_0xa809('0x20')]+_0xdfeb8b[_0xa809('0x21')],_0x50388e;if(_0x3b6ef1>=_0x4c159e){_0x3b6ef1=_0x4c159e;_0x50388e=0xc8;}else{_0x50388e=0xce;}_0x2734ff[_0xa809('0x1e')](_0x50388e);return _0x2734ff[_0xa809('0x22')](_0xa809('0x23'),_0x1cc704+'-'+_0x3b6ef1+'/'+_0x4c159e)['json'](_0x2f4145);}return null;};}function patchUpdates(_0x46b39d){return function(_0x11ffd3){try{jsonpatch[_0xa809('0x24')](_0x11ffd3,_0x46b39d,!![]);}catch(_0x1b67b7){return BPromise[_0xa809('0x25')](_0x1b67b7);}return _0x11ffd3['save']();};}function saveUpdates(_0x3f9405,_0x8572e7){return function(_0x36448d){if(_0x36448d){return _0x36448d['update'](_0x3f9405)[_0xa809('0x26')](function(_0x3b8af7){return _0x3b8af7;});}return null;};}function removeEntity(_0x18ef0c,_0x4b7482){return function(_0x8d9a4e){if(_0x8d9a4e){return _0x8d9a4e['destroy']()[_0xa809('0x26')](function(){var _0x33b2e0=_0x8d9a4e['get']({'plain':!![]});var _0x57336b='WhatsappQueues';return db[_0xa809('0x27')][_0xa809('0x28')]({'where':{'type':_0x57336b,'resourceId':_0x33b2e0['id']}})[_0xa809('0x26')](function(){return _0x8d9a4e;});})[_0xa809('0x26')](function(){_0x18ef0c[_0xa809('0x1e')](0xcc)[_0xa809('0x29')]();});}};}function handleEntityNotFound(_0x5e1385,_0x162a91){return function(_0x484cfd){if(!_0x484cfd){_0x5e1385[_0xa809('0x1d')](0x194);}return _0x484cfd;};}function handleError(_0x2250a9,_0x5e16e1){_0x5e16e1=_0x5e16e1||0x1f4;return function(_0xe15658){logger[_0xa809('0x2a')](_0xe15658[_0xa809('0x2b')]);if(_0xe15658['name']){delete _0xe15658[_0xa809('0x2c')];}_0x2250a9['status'](_0x5e16e1)[_0xa809('0x2d')](_0xe15658);};}exports[_0xa809('0x2e')]=function(_0x18fa0a,_0x1b98a9){var _0x219fa7={},_0x1b7cb5={},_0x235084={'count':0x0,'rows':[]};var _0x26e2cb=_[_0xa809('0x2f')](db[_0xa809('0x30')][_0xa809('0x31')],function(_0x1c260d){return{'name':_0x1c260d[_0xa809('0x32')],'type':_0x1c260d[_0xa809('0x33')][_0xa809('0x34')]};});_0x1b7cb5[_0xa809('0x35')]=_['map'](_0x26e2cb,_0xa809('0x2c'));_0x1b7cb5[_0xa809('0x36')]=_[_0xa809('0x37')](_0x18fa0a[_0xa809('0x36')]);_0x1b7cb5[_0xa809('0x38')]=_['intersection'](_0x1b7cb5[_0xa809('0x35')],_0x1b7cb5[_0xa809('0x36')]);_0x219fa7[_0xa809('0x39')]=_[_0xa809('0x3a')](_0x1b7cb5[_0xa809('0x35')],qs[_0xa809('0x3b')](_0x18fa0a[_0xa809('0x36')][_0xa809('0x3b')]));_0x219fa7['attributes']=_0x219fa7[_0xa809('0x39')][_0xa809('0x3c')]?_0x219fa7['attributes']:_0x1b7cb5[_0xa809('0x35')];if(!_0x18fa0a[_0xa809('0x36')]['hasOwnProperty'](_0xa809('0x3d'))){_0x219fa7[_0xa809('0x21')]=qs['limit'](_0x18fa0a[_0xa809('0x36')][_0xa809('0x21')]);_0x219fa7[_0xa809('0x20')]=qs[_0xa809('0x20')](_0x18fa0a['query']['offset']);}_0x219fa7['order']=qs[_0xa809('0x3e')](_0x18fa0a['query'][_0xa809('0x3e')]);_0x219fa7['where']=qs[_0xa809('0x38')](_[_0xa809('0x3f')](_0x18fa0a[_0xa809('0x36')],_0x1b7cb5[_0xa809('0x38')]),_0x26e2cb);if(_0x18fa0a[_0xa809('0x36')][_0xa809('0x40')]){_0x219fa7['where']=_['merge'](_0x219fa7[_0xa809('0x41')],{'$or':_['map'](_0x26e2cb,function(_0x4ec628){if(_0x4ec628['type']!==_0xa809('0x42')){var _0x32fd86={};_0x32fd86[_0x4ec628[_0xa809('0x2c')]]={'$like':'%'+_0x18fa0a['query']['filter']+'%'};return _0x32fd86;}})});}_0x219fa7=_[_0xa809('0x43')]({},_0x219fa7,_0x18fa0a[_0xa809('0x44')]);var _0x5fa315={'where':_0x219fa7[_0xa809('0x41')]};return db[_0xa809('0x30')][_0xa809('0x1f')](_0x5fa315)[_0xa809('0x26')](function(_0x8b5136){_0x235084[_0xa809('0x1f')]=_0x8b5136;if(_0x18fa0a[_0xa809('0x36')]['includeAll']){_0x219fa7[_0xa809('0x45')]=[{'all':!![]}];}return db[_0xa809('0x30')]['findAll'](_0x219fa7);})[_0xa809('0x26')](function(_0x1de8e6){_0x235084[_0xa809('0x46')]=_0x1de8e6;return _0x235084;})['then'](respondWithFilteredResult(_0x1b98a9,_0x219fa7))[_0xa809('0x47')](handleError(_0x1b98a9,null));};exports[_0xa809('0x48')]=function(_0x42ab81,_0x5bc82c){var _0x4491f7={'raw':!![],'where':{'id':_0x42ab81[_0xa809('0x49')]['id']}},_0x3923cb={};_0x3923cb['model']=_[_0xa809('0x37')](db[_0xa809('0x30')][_0xa809('0x31')]);_0x3923cb[_0xa809('0x36')]=_[_0xa809('0x37')](_0x42ab81['query']);_0x3923cb[_0xa809('0x38')]=_['intersection'](_0x3923cb[_0xa809('0x35')],_0x3923cb[_0xa809('0x36')]);_0x4491f7[_0xa809('0x39')]=_['intersection'](_0x3923cb[_0xa809('0x35')],qs['fields'](_0x42ab81[_0xa809('0x36')][_0xa809('0x3b')]));_0x4491f7[_0xa809('0x39')]=_0x4491f7[_0xa809('0x39')][_0xa809('0x3c')]?_0x4491f7[_0xa809('0x39')]:_0x3923cb[_0xa809('0x35')];if(_0x42ab81[_0xa809('0x36')][_0xa809('0x4a')]){_0x4491f7[_0xa809('0x45')]=[{'all':!![]}];}_0x4491f7=_[_0xa809('0x43')]({},_0x4491f7,_0x42ab81[_0xa809('0x44')]);return db[_0xa809('0x30')]['find'](_0x4491f7)[_0xa809('0x26')](handleEntityNotFound(_0x5bc82c,null))['then'](respondWithResult(_0x5bc82c,null))[_0xa809('0x47')](handleError(_0x5bc82c,null));};exports[_0xa809('0x4b')]=function(_0x265bab,_0x1e39c5){return db[_0xa809('0x30')][_0xa809('0x4b')](_0x265bab[_0xa809('0x4c')],{})[_0xa809('0x26')](function(_0x4ce692){var _0x51bca1=_0x265bab['user'][_0xa809('0x4d')]({'plain':!![]});if(!_0x51bca1)throw new Error(_0xa809('0x4e'));if(_0x51bca1[_0xa809('0x4f')]===_0xa809('0x50')){var _0x5a810e=_0x4ce692[_0xa809('0x4d')]({'plain':!![]});var _0x50d81c='WhatsappQueues';return db[_0xa809('0x51')]['find']({'where':{'name':_0x50d81c,'userProfileId':_0x51bca1['userProfileId']},'raw':!![]})[_0xa809('0x26')](function(_0x38559c){if(_0x38559c&&_0x38559c[_0xa809('0x52')]===0x0){return db[_0xa809('0x27')][_0xa809('0x4b')]({'name':_0x5a810e[_0xa809('0x2c')],'resourceId':_0x5a810e['id'],'type':_0x38559c[_0xa809('0x2c')],'sectionId':_0x38559c['id']},{})[_0xa809('0x26')](function(){return _0x4ce692;});}else{return _0x4ce692;}})['catch'](function(_0x221170){logger['error'](_0xa809('0x53'),_0x221170);throw _0x221170;});}return _0x4ce692;})[_0xa809('0x26')](respondWithResult(_0x1e39c5,0xc9))[_0xa809('0x47')](handleError(_0x1e39c5,null));};exports['update']=function(_0x1447dc,_0x3ca3e2){if(_0x1447dc[_0xa809('0x4c')]['id']){delete _0x1447dc[_0xa809('0x4c')]['id'];}return db[_0xa809('0x30')][_0xa809('0x54')]({'where':{'id':_0x1447dc[_0xa809('0x49')]['id']}})[_0xa809('0x26')](handleEntityNotFound(_0x3ca3e2,null))[_0xa809('0x26')](saveUpdates(_0x1447dc[_0xa809('0x4c')],null))[_0xa809('0x26')](respondWithResult(_0x3ca3e2,null))[_0xa809('0x47')](handleError(_0x3ca3e2,null));};exports[_0xa809('0x28')]=function(_0x4ab9d9,_0xb7a690){return db[_0xa809('0x30')][_0xa809('0x54')]({'where':{'id':_0x4ab9d9[_0xa809('0x49')]['id']}})[_0xa809('0x26')](handleEntityNotFound(_0xb7a690,null))[_0xa809('0x26')](removeEntity(_0xb7a690,null))['catch'](handleError(_0xb7a690,null));};exports[_0xa809('0x55')]=function(_0x2d5e00,_0x5d1ee4){return db['WhatsappQueue'][_0xa809('0x55')]()['then'](respondWithResult(_0x5d1ee4,null))['catch'](handleError(_0x5d1ee4,null));};exports[_0xa809('0x56')]=function(_0x168b50,_0x223075,_0x4f8754){var _0x1d120c={'raw':!![],'where':{}},_0x51ebf6={},_0x5edc92;return db[_0xa809('0x30')][_0xa809('0x57')]({'where':{'id':_0x168b50[_0xa809('0x49')]['id']}})[_0xa809('0x26')](handleEntityNotFound(_0x223075,null))[_0xa809('0x26')](function(_0x475042){if(_0x475042){_0x5edc92=_0x475042[_0xa809('0x4d')]({'plain':!![]});_0x51ebf6[_0xa809('0x35')]=_[_0xa809('0x37')](db[_0xa809('0x58')]['rawAttributes']);_0x51ebf6[_0xa809('0x36')]=_[_0xa809('0x37')](_0x168b50['query']);_0x51ebf6[_0xa809('0x38')]=_['intersection'](_0x51ebf6[_0xa809('0x35')],_0x51ebf6['query']);_0x1d120c['attributes']=_['intersection'](_0x51ebf6[_0xa809('0x35')],qs[_0xa809('0x3b')](_0x168b50['query'][_0xa809('0x3b')]));_0x1d120c['attributes']=_0x1d120c[_0xa809('0x39')][_0xa809('0x3c')]?_0x1d120c['attributes']:_0x51ebf6[_0xa809('0x35')];if(!_0x168b50[_0xa809('0x36')][_0xa809('0x59')](_0xa809('0x3d'))){_0x1d120c[_0xa809('0x21')]=qs[_0xa809('0x21')](_0x168b50['query'][_0xa809('0x21')]);_0x1d120c[_0xa809('0x20')]=qs[_0xa809('0x20')](_0x168b50[_0xa809('0x36')]['offset']);}_0x1d120c[_0xa809('0x5a')]=qs[_0xa809('0x3e')](_0x168b50['query'][_0xa809('0x3e')]);_0x1d120c['where']=qs[_0xa809('0x38')](_[_0xa809('0x3f')](_0x168b50[_0xa809('0x36')],_0x51ebf6[_0xa809('0x38')]));_0x1d120c[_0xa809('0x41')][_0xa809('0x5b')]=_0x475042['id'];if(_0x168b50[_0xa809('0x36')][_0xa809('0x40')]){_0x1d120c[_0xa809('0x41')]=_['merge'](_0x1d120c[_0xa809('0x41')],{'$or':_['map'](_0x1d120c['attributes'],function(_0x2b08b8){var _0x5a13d9={};_0x5a13d9[_0x2b08b8]={'$like':'%'+_0x168b50[_0xa809('0x36')][_0xa809('0x40')]+'%'};return _0x5a13d9;})});}_0x1d120c=_[_0xa809('0x43')]({},_0x1d120c,_0x168b50[_0xa809('0x44')]);return db[_0xa809('0x58')][_0xa809('0x5c')](_0x1d120c);}})[_0xa809('0x26')](function(_0x230bef){if(_0x230bef){return db[_0xa809('0x5d')]['findAndCountAll']({'where':{'id':_['map'](_0x230bef,'UserId'),'role':'agent'},'attributes':['id',_0xa809('0x2c'),_0xa809('0x5e'),_0xa809('0x5f'),_0xa809('0x60')]});}})[_0xa809('0x26')](function(_0x4d20){if(_0x4d20){return{'count':_0x4d20[_0xa809('0x1f')],'rows':_[_0xa809('0x2f')](_0x4d20[_0xa809('0x46')],function(_0x150c20){return{'membername':_0x150c20[_0xa809('0x2c')],'UserId':_0x150c20['id'],'queue_name':_0x5edc92[_0xa809('0x2c')],'WhatsappQueueId':_0x5edc92['id'],'interface':util[_0xa809('0x61')](_0xa809('0x62'),_0xa809('0x63'),_0x150c20[_0xa809('0x2c')]),'penalty':0x0,'paused':_0x150c20['whatsappPause'],'createdAt':_0x150c20[_0xa809('0x60')],'updatedAt':_0x150c20[_0xa809('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x223075,_0x1d120c))[_0xa809('0x47')](handleError(_0x223075,null));};exports[_0xa809('0x64')]=function(_0x1408ca,_0x21d9ee,_0x18a800){var _0x2258f4={};var _0x988e00={};var _0x1803f7;var _0x212211;return db[_0xa809('0x30')]['findOne']({'where':{'id':_0x1408ca[_0xa809('0x49')]['id']}})[_0xa809('0x26')](handleEntityNotFound(_0x21d9ee,null))['then'](function(_0x31ab36){if(_0x31ab36){_0x1803f7=_0x31ab36;_0x988e00[_0xa809('0x35')]=_[_0xa809('0x37')](db[_0xa809('0x65')][_0xa809('0x31')]);_0x988e00['query']=_[_0xa809('0x37')](_0x1408ca[_0xa809('0x36')]);_0x988e00['filters']=_['intersection'](_0x988e00[_0xa809('0x35')],_0x988e00[_0xa809('0x36')]);_0x2258f4[_0xa809('0x39')]=_[_0xa809('0x3a')](_0x988e00[_0xa809('0x35')],qs[_0xa809('0x3b')](_0x1408ca[_0xa809('0x36')]['fields']));_0x2258f4[_0xa809('0x39')]=_0x2258f4[_0xa809('0x39')][_0xa809('0x3c')]?_0x2258f4[_0xa809('0x39')]:_0x988e00[_0xa809('0x35')];_0x2258f4['order']=qs[_0xa809('0x3e')](_0x1408ca[_0xa809('0x36')][_0xa809('0x3e')]);_0x2258f4['where']=qs['filters'](_[_0xa809('0x3f')](_0x1408ca[_0xa809('0x36')],_0x988e00['filters']));if(_0x1408ca[_0xa809('0x36')]['filter']){_0x2258f4[_0xa809('0x41')]=_[_0xa809('0x43')](_0x2258f4[_0xa809('0x41')],{'$or':_['map'](_0x2258f4[_0xa809('0x39')],function(_0x32435e){var _0x669a41={};_0x669a41[_0x32435e]={'$like':'%'+_0x1408ca[_0xa809('0x36')][_0xa809('0x40')]+'%'};return _0x669a41;})});}_0x2258f4=_[_0xa809('0x43')]({},_0x2258f4,_0x1408ca[_0xa809('0x44')]);return _0x1803f7[_0xa809('0x64')](_0x2258f4);}})[_0xa809('0x26')](function(_0x3f216f){if(_0x3f216f){_0x212211=_0x3f216f['length'];if(!_0x1408ca['query'][_0xa809('0x59')]('nolimit')){_0x2258f4[_0xa809('0x21')]=qs[_0xa809('0x21')](_0x1408ca['query'][_0xa809('0x21')]);_0x2258f4['offset']=qs[_0xa809('0x20')](_0x1408ca[_0xa809('0x36')]['offset']);}return _0x1803f7[_0xa809('0x64')](_0x2258f4);}})[_0xa809('0x26')](function(_0x2db534){if(_0x2db534){return _0x2db534?{'count':_0x212211,'rows':_0x2db534}:null;}})[_0xa809('0x26')](respondWithResult(_0x21d9ee,null))[_0xa809('0x47')](handleError(_0x21d9ee,null));};exports[_0xa809('0x66')]=function(_0x266fdb,_0x3eed66,_0x4b6656){var _0x8d033b=_0x266fdb[_0xa809('0x4c')]['ids'];return db[_0xa809('0x65')][_0xa809('0x5c')]({'where':{'id':_0x8d033b},'attributes':['id'],'include':[{'model':db[_0xa809('0x5d')],'as':'Agents','attributes':['id',_0xa809('0x2c'),_0xa809('0x67'),_0xa809('0x68'),_0xa809('0x69')],'raw':!![]}]})[_0xa809('0x26')](function(_0xcc01e7){if(_0xcc01e7){var _0x26a8cc=_['flatMap'](_0xcc01e7,function(_0x27bcf4){var _0x1d1cb0=_0x27bcf4[_0xa809('0x4d')]({'plain':!![]});return _0x1d1cb0[_0xa809('0x6a')];});return db[_0xa809('0x30')]['find']({'where':{'id':_0x266fdb[_0xa809('0x49')]['id']}})[_0xa809('0x26')](function(_0x4e6236){return db[_0xa809('0x6b')][_0xa809('0x6c')](function(_0x5beb81){return _0x4e6236[_0xa809('0x66')](_0x8d033b,{'transaction':_0x5beb81})[_0xa809('0x26')](function(){return BPromise[_0xa809('0x6d')](_0x26a8cc,function(_0x43b097){return db['UserWhatsappQueue'][_0xa809('0x6e')]({'where':{'UserId':_0x43b097['id'],'WhatsappQueueId':_0x266fdb[_0xa809('0x49')]['id']},'transaction':_0x5beb81});});})[_0xa809('0x26')](function(){_0x26a8cc[_0xa809('0x6f')](function(_0x2d0540){socket[_0xa809('0x70')]('userWhatsappQueue:save',{'UserId':_0x2d0540['id'],'WhatsappQueueId':_0x4e6236['id']});});});});});}})['then'](respondWithStatusCode(_0x3eed66,null))['catch'](handleError(_0x3eed66,null));};exports['removeTeams']=function(_0x4e780f,_0x5a122d,_0x20c0c1){return db[_0xa809('0x65')][_0xa809('0x5c')]({'where':{'id':_0x4e780f[_0xa809('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0xa809('0x5d')],'as':_0xa809('0x6a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a122d,null))[_0xa809('0x26')](function(_0x3982b8){var _0x3f2c8d=_[_0xa809('0x2f')](_0x3982b8,'id');var _0x4a2506=[];var _0xd6dd51=[];var _0x2e8972=squel[_0xa809('0x71')]();_0x2e8972['field'](_0xa809('0x72'))[_0xa809('0x73')](_0xa809('0x74'),'tq')[_0xa809('0x75')](_0xa809('0x76'),'ut',_0xa809('0x77'))[_0xa809('0x41')](_0xa809('0x78'),_0x4e780f['params']['id']);for(var _0x4d2eae=0x0;_0x4d2eae<_0x3982b8['length'];_0x4d2eae+=0x1){let _0x26e477=_0x3982b8[_0x4d2eae];for(var _0x633c03=0x0;_0x633c03<_0x26e477[_0xa809('0x6a')][_0xa809('0x3c')];_0x633c03+=0x1){let _0x4b1618=_0x26e477[_0xa809('0x6a')][_0x633c03];var _0x2dece6=_0x2e8972['clone']();_0x2dece6[_0xa809('0x41')](_0xa809('0x79'),_0x4b1618['id']);_0xd6dd51[_0xa809('0x7a')](db[_0xa809('0x6b')][_0xa809('0x36')](_0x2dece6['toString'](),{'type':db[_0xa809('0x6b')][_0xa809('0x7b')][_0xa809('0x7c')]})[_0xa809('0x26')](function(_0x1ffb31){if(_0x1ffb31[_0xa809('0x3c')]===0x1){return _0x4b1618['id'];}else{var _0x52a1a8=_['every'](_['map'](_0x1ffb31,'TeamId'),function(_0x6f153d){return _[_0xa809('0x7d')](_0x3f2c8d,_0x6f153d);});if(_0x52a1a8){return _0x4b1618['id'];}}}));}}return BPromise[_0xa809('0x7e')](_0xd6dd51)[_0xa809('0x26')](function(_0x3c406d){_0x4a2506=_(_0x4a2506)[_0xa809('0x7f')](_0x3c406d)['compact']()['value']();return db[_0xa809('0x30')][_0xa809('0x54')]({'where':{'id':_0x4e780f['params']['id']}})[_0xa809('0x26')](function(_0x1f2109){return db[_0xa809('0x6b')]['transaction'](function(_0x1e6da4){return _0x1f2109[_0xa809('0x80')](_0x4e780f[_0xa809('0x36')][_0xa809('0x81')],{'transaction':_0x1e6da4})[_0xa809('0x26')](function(){if(!_['isEmpty'](_0x4a2506)){return _0x1f2109[_0xa809('0x82')](_0x4a2506,{'transaction':_0x1e6da4});}})['then'](function(){_0x4a2506[_0xa809('0x6f')](function(_0xc8a162){socket[_0xa809('0x70')]('userWhatsappQueue:remove',{'UserId':_0xc8a162,'WhatsappQueueId':_0x1f2109['id']});});});});});});})['then'](respondWithStatusCode(_0x5a122d,null))[_0xa809('0x47')](handleError(_0x5a122d,null));};exports[_0xa809('0x83')]=function(_0x10632c,_0x3643a5,_0x1d5d37){return db[_0xa809('0x30')][_0xa809('0x54')]({'where':{'id':_0x10632c[_0xa809('0x49')]['id']}})[_0xa809('0x26')](handleEntityNotFound(_0x3643a5,null))[_0xa809('0x26')](function(_0x38f0a9){if(_0x38f0a9){return _0x38f0a9[_0xa809('0x83')](_0x10632c[_0xa809('0x4c')][_0xa809('0x81')],_[_0xa809('0x84')](_0x10632c[_0xa809('0x4c')],[_0xa809('0x81'),'id'])||{})['spread'](function(_0x47254a){for(var _0x5e0b9c=0x0;_0x5e0b9c<_0x10632c[_0xa809('0x4c')]['ids'][_0xa809('0x3c')];_0x5e0b9c+=0x1){socket[_0xa809('0x70')](_0xa809('0x85'),{'UserId':_0x10632c[_0xa809('0x4c')][_0xa809('0x81')][_0x5e0b9c],'WhatsappQueueId':_0x10632c[_0xa809('0x49')]['id']});}return _0x47254a;});}})[_0xa809('0x26')](respondWithResult(_0x3643a5,null))['catch'](handleError(_0x3643a5,null));};exports[_0xa809('0x82')]=function(_0x4e3d06,_0x53d02c,_0x4275b9){return db[_0xa809('0x30')][_0xa809('0x54')]({'where':{'id':_0x4e3d06['params']['id']}})[_0xa809('0x26')](handleEntityNotFound(_0x53d02c,null))[_0xa809('0x26')](function(_0x4daa92){if(_0x4daa92){return _0x4daa92['removeAgents'](_0x4e3d06['query'][_0xa809('0x81')])[_0xa809('0x26')](function(){if(_['isArray'](_0x4e3d06[_0xa809('0x36')]['ids'])){for(var _0x1728cc=0x0;_0x1728cc<_0x4e3d06['query'][_0xa809('0x81')][_0xa809('0x3c')];_0x1728cc+=0x1){socket[_0xa809('0x70')](_0xa809('0x86'),{'UserId':Number(_0x4e3d06[_0xa809('0x36')][_0xa809('0x81')][_0x1728cc]),'WhatsappQueueId':Number(_0x4e3d06[_0xa809('0x49')]['id'])});}}else{socket[_0xa809('0x70')](_0xa809('0x86'),{'UserId':Number(_0x4e3d06[_0xa809('0x36')][_0xa809('0x81')]),'WhatsappQueueId':Number(_0x4e3d06['params']['id'])});}});}})['then'](respondWithStatusCode(_0x53d02c,null))[_0xa809('0x47')](handleError(_0x53d02c,null));};exports[_0xa809('0x87')]=function(_0x4e3f20,_0x3dd313,_0x31b039){var _0x20c9f3={};var _0x2f1c00={};var _0x5b2393;var _0x254a79;return db['WhatsappQueue']['findOne']({'where':{'id':_0x4e3f20[_0xa809('0x49')]['id']}})[_0xa809('0x26')](handleEntityNotFound(_0x3dd313,null))[_0xa809('0x26')](function(_0x349c21){if(_0x349c21){_0x5b2393=_0x349c21;_0x2f1c00[_0xa809('0x35')]=_[_0xa809('0x37')](db[_0xa809('0x5d')]['rawAttributes']);_0x2f1c00[_0xa809('0x36')]=_[_0xa809('0x37')](_0x4e3f20[_0xa809('0x36')]);_0x2f1c00['filters']=_[_0xa809('0x3a')](_0x2f1c00[_0xa809('0x35')],_0x2f1c00[_0xa809('0x36')]);_0x20c9f3['attributes']=_[_0xa809('0x3a')](_0x2f1c00[_0xa809('0x35')],qs[_0xa809('0x3b')](_0x4e3f20[_0xa809('0x36')]['fields']));_0x20c9f3[_0xa809('0x39')]=_0x20c9f3[_0xa809('0x39')][_0xa809('0x3c')]?_0x20c9f3[_0xa809('0x39')]:_0x2f1c00['model'];_0x20c9f3[_0xa809('0x5a')]=qs['sort'](_0x4e3f20[_0xa809('0x36')][_0xa809('0x3e')]);_0x20c9f3[_0xa809('0x41')]=qs[_0xa809('0x38')](_[_0xa809('0x3f')](_0x4e3f20[_0xa809('0x36')],_0x2f1c00['filters']));if(_0x4e3f20[_0xa809('0x36')]['filter']){_0x20c9f3['where']=_[_0xa809('0x43')](_0x20c9f3[_0xa809('0x41')],{'$or':_[_0xa809('0x2f')](_0x20c9f3[_0xa809('0x39')],function(_0x14e453){var _0x46cdb={};_0x46cdb[_0x14e453]={'$like':'%'+_0x4e3f20[_0xa809('0x36')][_0xa809('0x40')]+'%'};return _0x46cdb;})});}_0x20c9f3=_['merge']({},_0x20c9f3,_0x4e3f20[_0xa809('0x44')]);return _0x5b2393['getAgents'](_0x20c9f3);}})[_0xa809('0x26')](function(_0x186643){if(_0x186643){_0x254a79=_0x186643[_0xa809('0x3c')];if(!_0x4e3f20[_0xa809('0x36')][_0xa809('0x59')](_0xa809('0x3d'))){_0x20c9f3[_0xa809('0x21')]=qs[_0xa809('0x21')](_0x4e3f20[_0xa809('0x36')][_0xa809('0x21')]);_0x20c9f3[_0xa809('0x20')]=qs[_0xa809('0x20')](_0x4e3f20[_0xa809('0x36')][_0xa809('0x20')]);}return _0x5b2393[_0xa809('0x87')](_0x20c9f3);}})[_0xa809('0x26')](function(_0x20088d){if(_0x20088d){return _0x20088d?{'count':_0x254a79,'rows':_0x20088d}:null;}})['then'](respondWithResult(_0x3dd313,null))[_0xa809('0x47')](handleError(_0x3dd313,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 18bd599..8897816 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 _0xbfca=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xbfca,0x1a0));var _0xabfc=function(_0x1b9bc2,_0x15952b){_0x1b9bc2=_0x1b9bc2-0x0;var _0x3ee566=_0xbfca[_0x1b9bc2];return _0x3ee566;};'use strict';var EventEmitter=require(_0xabfc('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xabfc('0x1')](0x0);var events={'afterCreate':_0xabfc('0x2'),'afterUpdate':_0xabfc('0x3'),'afterDestroy':_0xabfc('0x4')};function emitEvent(_0x3fe4b9){return function(_0x4f3eff,_0x56328f,_0x4711b4){WhatsappQueueEvents[_0xabfc('0x5')](_0x3fe4b9+':'+_0x4f3eff['id'],_0x4f3eff);WhatsappQueueEvents[_0xabfc('0x5')](_0x3fe4b9,_0x4f3eff);_0x4711b4(null);};}for(var e in events){if(events[_0xabfc('0x6')](e)){var event=events[e];WhatsappQueue[_0xabfc('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x3d59=['save','emit','exports','../../mysqldb','WhatsappQueue'];(function(_0x359956,_0x561680){var _0x4c1ff8=function(_0x5e65f7){while(--_0x5e65f7){_0x359956['push'](_0x359956['shift']());}};_0x4c1ff8(++_0x561680);}(_0x3d59,0x134));var _0x93d5=function(_0x3799f3,_0x19c6d4){_0x3799f3=_0x3799f3-0x0;var _0xa2195b=_0x3d59[_0x3799f3];return _0xa2195b;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x93d5('0x0'))['db'][_0x93d5('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x93d5('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x281f9d){return function(_0x54e26d,_0x70c298,_0x59f38d){WhatsappQueueEvents[_0x93d5('0x3')](_0x281f9d+':'+_0x54e26d['id'],_0x54e26d);WhatsappQueueEvents['emit'](_0x281f9d,_0x54e26d);_0x59f38d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x93d5('0x4')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index ed43b9b..805e438 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 _0xbe43=['define','WhatsappQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','exports'];(function(_0x55ffc8,_0x30aa4e){var _0x58d83d=function(_0x2d7e6e){while(--_0x2d7e6e){_0x55ffc8['push'](_0x55ffc8['shift']());}};_0x58d83d(++_0x30aa4e);}(_0xbe43,0x174));var _0x3be4=function(_0x554e26,_0x54b5d1){_0x554e26=_0x554e26-0x0;var _0x18fdc9=_0xbe43[_0x554e26];return _0x18fdc9;};'use strict';var _=require('lodash');var util=require(_0x3be4('0x0'));var logger=require(_0x3be4('0x1'))(_0x3be4('0x2'));var moment=require(_0x3be4('0x3'));var BPromise=require(_0x3be4('0x4'));var rp=require(_0x3be4('0x5'));var fs=require('fs');var path=require(_0x3be4('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappQueue.attributes');module[_0x3be4('0x7')]=function(_0x6dc5c5,_0x4e19a1){return _0x6dc5c5[_0x3be4('0x8')](_0x3be4('0x9'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x59e0=['./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x1b5bc2,_0x453d84){var _0x1a5382=function(_0x4ffafb){while(--_0x4ffafb){_0x1b5bc2['push'](_0x1b5bc2['shift']());}};_0x1a5382(++_0x453d84);}(_0x59e0,0xca));var _0x059e=function(_0x249337,_0x34991b){_0x249337=_0x249337-0x0;var _0x1e7b83=_0x59e0[_0x249337];return _0x1e7b83;};'use strict';var _=require(_0x059e('0x0'));var util=require('util');var logger=require(_0x059e('0x1'))('api');var moment=require(_0x059e('0x2'));var BPromise=require('bluebird');var rp=require(_0x059e('0x3'));var fs=require('fs');var path=require(_0x059e('0x4'));var rimraf=require(_0x059e('0x5'));var config=require(_0x059e('0x6'));var attributes=require(_0x059e('0x7'));module[_0x059e('0x8')]=function(_0xa21017,_0x38ddf0){return _0xa21017[_0x059e('0x9')]('WhatsappQueue',attributes,{'tableName':_0x059e('0xa'),'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 cbe2d89..c29da52 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 _0xdfa1=['rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','info','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','WhatsappQueue,\x20%s,\x20%s','result','catch','GetWhatsappQueue','raw','options','attributes','limit','map','model','include','then','ShowWhatsappQueue','WhatsappQueue','find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x5b1c50,_0x56e694){var _0x2d379b=function(_0x981b9c){while(--_0x981b9c){_0x5b1c50['push'](_0x5b1c50['shift']());}};_0x2d379b(++_0x56e694);}(_0xdfa1,0x161));var _0x1dfa=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xdfa1[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x1dfa('0x0'));var util=require(_0x1dfa('0x1'));var moment=require(_0x1dfa('0x2'));var BPromise=require(_0x1dfa('0x3'));var rs=require(_0x1dfa('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1dfa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1dfa('0x6'))(_0x1dfa('0x7'));var config=require(_0x1dfa('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1dfa('0x9')][_0x1dfa('0xa')]({'port':0x232a});config[_0x1dfa('0xb')]=_['defaults'](config[_0x1dfa('0xb')],{'host':_0x1dfa('0xc'),'port':0x18eb});var socket=require(_0x1dfa('0xd'))(new Redis(config[_0x1dfa('0xb')]));require(_0x1dfa('0xe'))[_0x1dfa('0xf')](socket);function respondWithRpcPromise(_0x48df8c,_0x43c097,_0x3182aa){return new BPromise(function(_0x53b068,_0x1dd611){return client[_0x1dfa('0x10')](_0x48df8c,_0x3182aa)['then'](function(_0x8ae84a){logger[_0x1dfa('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x43c097,'request\x20sent');logger[_0x1dfa('0x12')](_0x1dfa('0x13'),_0x43c097,_0x1dfa('0x14'),JSON[_0x1dfa('0x15')](_0x8ae84a));if(_0x8ae84a['error']){if(_0x8ae84a[_0x1dfa('0x16')]['code']===0x1f4){logger[_0x1dfa('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x43c097,_0x8ae84a[_0x1dfa('0x16')][_0x1dfa('0x17')]);return _0x1dd611(_0x8ae84a[_0x1dfa('0x16')][_0x1dfa('0x17')]);}logger[_0x1dfa('0x16')](_0x1dfa('0x18'),_0x43c097,_0x8ae84a[_0x1dfa('0x16')][_0x1dfa('0x17')]);return _0x53b068(_0x8ae84a[_0x1dfa('0x16')][_0x1dfa('0x17')]);}else{logger[_0x1dfa('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x43c097,_0x1dfa('0x14'));_0x53b068(_0x8ae84a[_0x1dfa('0x19')][_0x1dfa('0x17')]);}})[_0x1dfa('0x1a')](function(_0x13e16c){logger[_0x1dfa('0x16')](_0x1dfa('0x18'),_0x43c097,_0x13e16c);_0x1dd611(_0x13e16c);});});}exports[_0x1dfa('0x1b')]=function(_0x4dd0c9){var _0x4f0304=this;return new Promise(function(_0x241287,_0x256c5f){return db['WhatsappQueue']['findAll']({'raw':_0x4dd0c9['options']?_0x4dd0c9['options'][_0x1dfa('0x1c')]===undefined?!![]:![]:!![],'where':_0x4dd0c9['options']?_0x4dd0c9[_0x1dfa('0x1d')]['where']||null:null,'attributes':_0x4dd0c9['options']?_0x4dd0c9[_0x1dfa('0x1d')][_0x1dfa('0x1e')]||null:null,'limit':_0x4dd0c9[_0x1dfa('0x1d')]?_0x4dd0c9[_0x1dfa('0x1d')][_0x1dfa('0x1f')]||null:null,'include':_0x4dd0c9[_0x1dfa('0x1d')]?_0x4dd0c9['options']['include']?_[_0x1dfa('0x20')](_0x4dd0c9['options']['include'],function(_0x47172c){return{'model':db[_0x47172c[_0x1dfa('0x21')]],'as':_0x47172c['as'],'attributes':_0x47172c['attributes'],'include':_0x47172c[_0x1dfa('0x22')]?_['map'](_0x47172c['include'],function(_0x971421){return{'model':db[_0x971421['model']],'as':_0x971421['as'],'attributes':_0x971421[_0x1dfa('0x1e')],'include':_0x971421[_0x1dfa('0x22')]?_['map'](_0x971421[_0x1dfa('0x22')],function(_0x2d1ca9){return{'model':db[_0x2d1ca9[_0x1dfa('0x21')]],'as':_0x2d1ca9['as'],'attributes':_0x2d1ca9['attributes']};}):[]};}):[]};}):[]:[]})[_0x1dfa('0x23')](function(_0xcc8aa5){logger['info'](_0x1dfa('0x1b'),_0x4dd0c9);logger[_0x1dfa('0x12')](_0x1dfa('0x1b'),_0x4dd0c9,JSON[_0x1dfa('0x15')](_0xcc8aa5));_0x241287(_0xcc8aa5);})['catch'](function(_0x889db9){logger[_0x1dfa('0x16')](_0x1dfa('0x1b'),_0x889db9[_0x1dfa('0x17')],_0x4dd0c9);_0x256c5f(_0x4f0304['error'](0x1f4,_0x889db9[_0x1dfa('0x17')]));});});};exports[_0x1dfa('0x24')]=function(_0xd55104){var _0x173a9e=this;return new Promise(function(_0x52879c,_0x58e9aa){return db[_0x1dfa('0x25')][_0x1dfa('0x26')]({'raw':_0xd55104[_0x1dfa('0x1d')]?_0xd55104['options'][_0x1dfa('0x1c')]===undefined?!![]:![]:!![],'where':_0xd55104[_0x1dfa('0x1d')]?_0xd55104[_0x1dfa('0x1d')][_0x1dfa('0x27')]||null:null,'attributes':_0xd55104['options']?_0xd55104['options']['attributes']||null:null,'include':_0xd55104[_0x1dfa('0x1d')]?_0xd55104[_0x1dfa('0x1d')][_0x1dfa('0x22')]?_['map'](_0xd55104[_0x1dfa('0x1d')][_0x1dfa('0x22')],function(_0x369168){return{'model':db[_0x369168[_0x1dfa('0x21')]],'as':_0x369168['as'],'attributes':_0x369168[_0x1dfa('0x1e')],'include':_0x369168[_0x1dfa('0x22')]?_['map'](_0x369168[_0x1dfa('0x22')],function(_0x394b30){return{'model':db[_0x394b30['model']],'as':_0x394b30['as'],'attributes':_0x394b30['attributes'],'include':_0x394b30[_0x1dfa('0x22')]?_[_0x1dfa('0x20')](_0x394b30[_0x1dfa('0x22')],function(_0x549f31){return{'model':db[_0x549f31['model']],'as':_0x549f31['as'],'attributes':_0x549f31['attributes']};}):[]};}):[]};}):[]:[]})[_0x1dfa('0x23')](function(_0x287c9d){logger['info']('ShowWhatsappQueue',_0xd55104);logger[_0x1dfa('0x12')](_0x1dfa('0x24'),_0xd55104,JSON[_0x1dfa('0x15')](_0x287c9d));_0x52879c(_0x287c9d);})[_0x1dfa('0x1a')](function(_0x36f37d){logger[_0x1dfa('0x16')](_0x1dfa('0x24'),_0x36f37d[_0x1dfa('0x17')],_0xd55104);_0x58e9aa(_0x173a9e[_0x1dfa('0x16')](0x1f4,_0x36f37d[_0x1dfa('0x17')]));});});}; \ No newline at end of file +var _0x1666=['error','code','WhatsappQueue,\x20%s,\x20%s','message','result','catch','WhatsappQueue','findAll','options','where','attributes','limit','include','model','map','GetWhatsappQueue','ShowWhatsappQueue','find','raw','then','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','register','request','info','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x56eab0,_0x182e8c){var _0x84f9de=function(_0x48693c){while(--_0x48693c){_0x56eab0['push'](_0x56eab0['shift']());}};_0x84f9de(++_0x182e8c);}(_0x1666,0x117));var _0x6166=function(_0x2b897d,_0x52932f){_0x2b897d=_0x2b897d-0x0;var _0x37d13c=_0x1666[_0x2b897d];return _0x37d13c;};'use strict';var _=require(_0x6166('0x0'));var util=require(_0x6166('0x1'));var moment=require(_0x6166('0x2'));var BPromise=require(_0x6166('0x3'));var rs=require(_0x6166('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6166('0x5'));var config=require(_0x6166('0x6'));var jayson=require(_0x6166('0x7'));var client=jayson['client'][_0x6166('0x8')]({'port':0x232a});config[_0x6166('0x9')]=_['defaults'](config[_0x6166('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x6166('0xa'))(new Redis(config[_0x6166('0x9')]));require('./whatsappQueue.socket')[_0x6166('0xb')](socket);function respondWithRpcPromise(_0x5aa176,_0x3cd1eb,_0x2ad07e){return new BPromise(function(_0x5c7517,_0x3e96a3){return client[_0x6166('0xc')](_0x5aa176,_0x2ad07e)['then'](function(_0x2469b7){logger[_0x6166('0xd')]('WhatsappQueue,\x20%s,\x20%s',_0x3cd1eb,'request\x20sent');logger[_0x6166('0xe')](_0x6166('0xf'),_0x3cd1eb,'request\x20sent',JSON[_0x6166('0x10')](_0x2469b7));if(_0x2469b7[_0x6166('0x11')]){if(_0x2469b7['error'][_0x6166('0x12')]===0x1f4){logger[_0x6166('0x11')](_0x6166('0x13'),_0x3cd1eb,_0x2469b7['error'][_0x6166('0x14')]);return _0x3e96a3(_0x2469b7[_0x6166('0x11')][_0x6166('0x14')]);}logger[_0x6166('0x11')](_0x6166('0x13'),_0x3cd1eb,_0x2469b7[_0x6166('0x11')][_0x6166('0x14')]);return _0x5c7517(_0x2469b7[_0x6166('0x11')]['message']);}else{logger[_0x6166('0xd')]('WhatsappQueue,\x20%s,\x20%s',_0x3cd1eb,'request\x20sent');_0x5c7517(_0x2469b7[_0x6166('0x15')][_0x6166('0x14')]);}})[_0x6166('0x16')](function(_0x1f674f){logger[_0x6166('0x11')](_0x6166('0x13'),_0x3cd1eb,_0x1f674f);_0x3e96a3(_0x1f674f);});});}exports['GetWhatsappQueue']=function(_0x43a964){var _0x1835b3=this;return new Promise(function(_0x5b173f,_0x53e43a){return db[_0x6166('0x17')][_0x6166('0x18')]({'raw':_0x43a964[_0x6166('0x19')]?_0x43a964[_0x6166('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x43a964[_0x6166('0x19')]?_0x43a964['options'][_0x6166('0x1a')]||null:null,'attributes':_0x43a964[_0x6166('0x19')]?_0x43a964[_0x6166('0x19')][_0x6166('0x1b')]||null:null,'limit':_0x43a964[_0x6166('0x19')]?_0x43a964[_0x6166('0x19')][_0x6166('0x1c')]||null:null,'include':_0x43a964[_0x6166('0x19')]?_0x43a964[_0x6166('0x19')]['include']?_['map'](_0x43a964[_0x6166('0x19')][_0x6166('0x1d')],function(_0x191f1a){return{'model':db[_0x191f1a[_0x6166('0x1e')]],'as':_0x191f1a['as'],'attributes':_0x191f1a[_0x6166('0x1b')],'include':_0x191f1a[_0x6166('0x1d')]?_[_0x6166('0x1f')](_0x191f1a[_0x6166('0x1d')],function(_0x281cd0){return{'model':db[_0x281cd0[_0x6166('0x1e')]],'as':_0x281cd0['as'],'attributes':_0x281cd0[_0x6166('0x1b')],'include':_0x281cd0[_0x6166('0x1d')]?_[_0x6166('0x1f')](_0x281cd0[_0x6166('0x1d')],function(_0x1b8d28){return{'model':db[_0x1b8d28['model']],'as':_0x1b8d28['as'],'attributes':_0x1b8d28[_0x6166('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41d905){logger[_0x6166('0xd')](_0x6166('0x20'),_0x43a964);logger['debug'](_0x6166('0x20'),_0x43a964,JSON[_0x6166('0x10')](_0x41d905));_0x5b173f(_0x41d905);})[_0x6166('0x16')](function(_0x24c13e){logger[_0x6166('0x11')](_0x6166('0x20'),_0x24c13e['message'],_0x43a964);_0x53e43a(_0x1835b3[_0x6166('0x11')](0x1f4,_0x24c13e[_0x6166('0x14')]));});});};exports[_0x6166('0x21')]=function(_0x24a247){var _0x29e943=this;return new Promise(function(_0x2c6566,_0x212a8c){return db['WhatsappQueue'][_0x6166('0x22')]({'raw':_0x24a247['options']?_0x24a247[_0x6166('0x19')][_0x6166('0x23')]===undefined?!![]:![]:!![],'where':_0x24a247[_0x6166('0x19')]?_0x24a247[_0x6166('0x19')][_0x6166('0x1a')]||null:null,'attributes':_0x24a247[_0x6166('0x19')]?_0x24a247['options'][_0x6166('0x1b')]||null:null,'include':_0x24a247[_0x6166('0x19')]?_0x24a247[_0x6166('0x19')][_0x6166('0x1d')]?_[_0x6166('0x1f')](_0x24a247[_0x6166('0x19')]['include'],function(_0x17cb57){return{'model':db[_0x17cb57[_0x6166('0x1e')]],'as':_0x17cb57['as'],'attributes':_0x17cb57[_0x6166('0x1b')],'include':_0x17cb57[_0x6166('0x1d')]?_[_0x6166('0x1f')](_0x17cb57[_0x6166('0x1d')],function(_0x4058a5){return{'model':db[_0x4058a5['model']],'as':_0x4058a5['as'],'attributes':_0x4058a5['attributes'],'include':_0x4058a5['include']?_[_0x6166('0x1f')](_0x4058a5[_0x6166('0x1d')],function(_0x4669ba){return{'model':db[_0x4669ba[_0x6166('0x1e')]],'as':_0x4669ba['as'],'attributes':_0x4669ba[_0x6166('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6166('0x24')](function(_0x1b140e){logger[_0x6166('0xd')](_0x6166('0x21'),_0x24a247);logger['debug']('ShowWhatsappQueue',_0x24a247,JSON['stringify'](_0x1b140e));_0x2c6566(_0x1b140e);})[_0x6166('0x16')](function(_0x1c3ff0){logger[_0x6166('0x11')](_0x6166('0x21'),_0x1c3ff0[_0x6166('0x14')],_0x24a247);_0x212a8c(_0x29e943[_0x6166('0x11')](0x1f4,_0x1c3ff0[_0x6166('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index fb4a1cf..8d91e58 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 _0x4cdd=['whatsappQueue:','./whatsappQueue.events','save','emit','removeListener'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4cdd,0x1a5));var _0xd4cd=function(_0x132d06,_0x314aad){_0x132d06=_0x132d06-0x0;var _0x3490a4=_0x4cdd[_0x132d06];return _0x3490a4;};'use strict';var WhatsappQueueEvents=require(_0xd4cd('0x0'));var events=[_0xd4cd('0x1'),'remove','update'];function createListener(_0xbbbcd6,_0x29caca){return function(_0x22e410){_0x29caca[_0xd4cd('0x2')](_0xbbbcd6,_0x22e410);};}function removeListener(_0x3ca9af,_0x22249a){return function(){WhatsappQueueEvents[_0xd4cd('0x3')](_0x3ca9af,_0x22249a);};}exports['register']=function(_0x480dbc){for(var _0x558d53=0x0,_0x3c3065=events['length'];_0x558d53<_0x3c3065;_0x558d53++){var _0x24db75=events[_0x558d53];var _0x4a0e74=createListener(_0xd4cd('0x4')+_0x24db75,_0x480dbc);WhatsappQueueEvents['on'](_0x24db75,_0x4a0e74);}}; \ No newline at end of file +var _0x0e39=['length','whatsappQueue:','./whatsappQueue.events','remove','update','removeListener','register'];(function(_0x118829,_0x2d88ae){var _0x1a60c8=function(_0x3f6020){while(--_0x3f6020){_0x118829['push'](_0x118829['shift']());}};_0x1a60c8(++_0x2d88ae);}(_0x0e39,0x1f3));var _0x90e3=function(_0x85b464,_0xb32a20){_0x85b464=_0x85b464-0x0;var _0x75dc19=_0x0e39[_0x85b464];return _0x75dc19;};'use strict';var WhatsappQueueEvents=require(_0x90e3('0x0'));var events=['save',_0x90e3('0x1'),_0x90e3('0x2')];function createListener(_0x2c208d,_0x2d7635){return function(_0x456a75){_0x2d7635['emit'](_0x2c208d,_0x456a75);};}function removeListener(_0x1cc541,_0x2c0720){return function(){WhatsappQueueEvents[_0x90e3('0x3')](_0x1cc541,_0x2c0720);};}exports[_0x90e3('0x4')]=function(_0x2879c4){for(var _0x1d7d0f=0x0,_0x3c91e2=events[_0x90e3('0x5')];_0x1d7d0f<_0x3c91e2;_0x1d7d0f++){var _0x590383=events[_0x1d7d0f];var _0x2a1f49=createListener(_0x90e3('0x6')+_0x590383,_0x2879c4);WhatsappQueueEvents['on'](_0x590383,_0x2a1f49);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index dcae6b1..5019ddb 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 _0xb6a1=['./whatsappQueueReport.controller','isAuthenticated','index','get','/:id','post','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x48ec4c,_0x543fbb){var _0x43cfc1=function(_0xa3830b){while(--_0xa3830b){_0x48ec4c['push'](_0x48ec4c['shift']());}};_0x43cfc1(++_0x543fbb);}(_0xb6a1,0x14d));var _0x1b6a=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xb6a1[_0x122096];return _0x3d1966;};'use strict';var multer=require(_0x1b6a('0x0'));var util=require(_0x1b6a('0x1'));var path=require(_0x1b6a('0x2'));var timeout=require(_0x1b6a('0x3'));var express=require('express');var router=express[_0x1b6a('0x4')]();var auth=require(_0x1b6a('0x5'));var interaction=require(_0x1b6a('0x6'));var config=require('../../config/environment');var controller=require(_0x1b6a('0x7'));router['get']('/',auth[_0x1b6a('0x8')](),controller[_0x1b6a('0x9')]);router[_0x1b6a('0xa')]('/describe',auth[_0x1b6a('0x8')](),controller['describe']);router[_0x1b6a('0xa')](_0x1b6a('0xb'),auth[_0x1b6a('0x8')](),controller['show']);router[_0x1b6a('0xc')]('/',auth[_0x1b6a('0x8')](),controller['create']);router['put'](_0x1b6a('0xb'),auth['isAuthenticated'](),controller[_0x1b6a('0xd')]);router[_0x1b6a('0xe')](_0x1b6a('0xb'),auth['isAuthenticated'](),controller[_0x1b6a('0xf')]);module[_0x1b6a('0x10')]=router; \ No newline at end of file +var _0xb6ba=['create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x37222f,_0x25a5ab){var _0x5c5a6d=function(_0x27218b){while(--_0x27218b){_0x37222f['push'](_0x37222f['shift']());}};_0x5c5a6d(++_0x25a5ab);}(_0xb6ba,0x180));var _0xab6b=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xb6ba[_0x139a3c];return _0x2b375b;};'use strict';var multer=require(_0xab6b('0x0'));var util=require(_0xab6b('0x1'));var path=require(_0xab6b('0x2'));var timeout=require(_0xab6b('0x3'));var express=require(_0xab6b('0x4'));var router=express[_0xab6b('0x5')]();var auth=require(_0xab6b('0x6'));var interaction=require(_0xab6b('0x7'));var config=require(_0xab6b('0x8'));var controller=require(_0xab6b('0x9'));router[_0xab6b('0xa')]('/',auth[_0xab6b('0xb')](),controller['index']);router[_0xab6b('0xa')](_0xab6b('0xc'),auth['isAuthenticated'](),controller[_0xab6b('0xd')]);router['get'](_0xab6b('0xe'),auth[_0xab6b('0xb')](),controller[_0xab6b('0xf')]);router['post']('/',auth[_0xab6b('0xb')](),controller[_0xab6b('0x10')]);router[_0xab6b('0x11')](_0xab6b('0xe'),auth[_0xab6b('0xb')](),controller[_0xab6b('0x12')]);router[_0xab6b('0x13')](_0xab6b('0xe'),auth[_0xab6b('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index b6bcc50..17d6f55 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 _0xf3cd=['STRING','DATE','sequelize','exports'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x74745d,_0x177606){_0x74745d=_0x74745d-0x0;var _0x174ab3=_0xf3cd[_0x74745d];return _0x174ab3;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdf3c('0x2')]},'joinAt':{'type':Sequelize[_0xdf3c('0x3')]},'leaveAt':{'type':Sequelize[_0xdf3c('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xdf3c('0x3')]},'reason':{'type':Sequelize[_0xdf3c('0x2')]}}; \ No newline at end of file +var _0x7fbe=['STRING','DATE'];(function(_0x47ff52,_0x4244f6){var _0x48fb4d=function(_0x419704){while(--_0x419704){_0x47ff52['push'](_0x47ff52['shift']());}};_0x48fb4d(++_0x4244f6);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x115d95,_0x5e7589){_0x115d95=_0x115d95-0x0;var _0x27fe57=_0x7fbe[_0x115d95];return _0x27fe57;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xe7fb('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0xe7fb('0x0')]},'joinAt':{'type':Sequelize[_0xe7fb('0x1')]},'leaveAt':{'type':Sequelize[_0xe7fb('0x1')]},'acceptAt':{'type':Sequelize[_0xe7fb('0x1')]},'exitAt':{'type':Sequelize[_0xe7fb('0x1')]},'reason':{'type':Sequelize[_0xe7fb('0x0')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 9c2f176..662ce8b 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 _0x4fed=['options','create','update','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','reject','then','destroy','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','model','keys','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','includeAll','findAll','catch','show','params','include'];(function(_0x31fa29,_0x44d9a3){var _0x446a06=function(_0x17ecfc){while(--_0x17ecfc){_0x31fa29['push'](_0x31fa29['shift']());}};_0x446a06(++_0x44d9a3);}(_0x4fed,0x1c8));var _0xd4fe=function(_0x27beea,_0x3bc9f4){_0x27beea=_0x27beea-0x0;var _0x122645=_0x4fed[_0x27beea];return _0x122645;};'use strict';var pdf=require(_0xd4fe('0x0'));var emlformat=require(_0xd4fe('0x1'));var rimraf=require(_0xd4fe('0x2'));var zipdir=require(_0xd4fe('0x3'));var jsonpatch=require(_0xd4fe('0x4'));var rp=require('request-promise');var moment=require(_0xd4fe('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd4fe('0x6'));var util=require(_0xd4fe('0x7'));var path=require(_0xd4fe('0x8'));var sox=require(_0xd4fe('0x9'));var csv=require(_0xd4fe('0xa'));var ejs=require(_0xd4fe('0xb'));var fs=require('fs');var _=require(_0xd4fe('0xc'));var squel=require(_0xd4fe('0xd'));var crypto=require('crypto');var jsforce=require(_0xd4fe('0xe'));var deskjs=require(_0xd4fe('0xf'));var toCsv=require(_0xd4fe('0xa'));var querystring=require(_0xd4fe('0x10'));var Papa=require(_0xd4fe('0x11'));var Redis=require(_0xd4fe('0x12'));var authService=require(_0xd4fe('0x13'));var qs=require(_0xd4fe('0x14'));var as=require(_0xd4fe('0x15'));var hardwareService=require(_0xd4fe('0x16'));var logger=require(_0xd4fe('0x17'))(_0xd4fe('0x18'));var utils=require('../../config/utils');var config=require(_0xd4fe('0x19'));var licenseUtil=require(_0xd4fe('0x1a'));var db=require(_0xd4fe('0x1b'))['db'];function respondWithStatusCode(_0x2a95c8,_0x6c8799){_0x6c8799=_0x6c8799||0xcc;return function(_0x387484){if(_0x387484){return _0x2a95c8[_0xd4fe('0x1c')](_0x6c8799);}return _0x2a95c8[_0xd4fe('0x1d')](_0x6c8799)[_0xd4fe('0x1e')]();};}function respondWithResult(_0x3bc19c,_0x33b49e){_0x33b49e=_0x33b49e||0xc8;return function(_0x346b07){if(_0x346b07){return _0x3bc19c[_0xd4fe('0x1d')](_0x33b49e)[_0xd4fe('0x1f')](_0x346b07);}};}function respondWithFilteredResult(_0x48906b,_0xa45502){return function(_0x419b48){if(_0x419b48){var _0x4a99a6=_0x419b48[_0xd4fe('0x20')],_0x42c1ee=_0xa45502['offset'],_0x3e0898=_0xa45502[_0xd4fe('0x21')]+_0xa45502[_0xd4fe('0x22')],_0x41d7f2;if(_0x3e0898>=_0x4a99a6){_0x3e0898=_0x4a99a6;_0x41d7f2=0xc8;}else{_0x41d7f2=0xce;}_0x48906b[_0xd4fe('0x1d')](_0x41d7f2);return _0x48906b['set']('Content-Range',_0x42c1ee+'-'+_0x3e0898+'/'+_0x4a99a6)[_0xd4fe('0x1f')](_0x419b48);}return null;};}function patchUpdates(_0x1a090c){return function(_0x499c0){try{jsonpatch['apply'](_0x499c0,_0x1a090c,!![]);}catch(_0x4bbc6e){return BPromise[_0xd4fe('0x23')](_0x4bbc6e);}return _0x499c0['save']();};}function saveUpdates(_0x485fa7,_0x39311a){return function(_0x16ea57){if(_0x16ea57){return _0x16ea57['update'](_0x485fa7)[_0xd4fe('0x24')](function(_0x2dd180){return _0x2dd180;});}return null;};}function removeEntity(_0x52abbe,_0x27111e){return function(_0x20c264){if(_0x20c264){return _0x20c264[_0xd4fe('0x25')]()[_0xd4fe('0x24')](function(){_0x52abbe[_0xd4fe('0x1d')](0xcc)[_0xd4fe('0x1e')]();});}};}function handleEntityNotFound(_0x8a0ffd,_0x50ccb3){return function(_0x13ac6e){if(!_0x13ac6e){_0x8a0ffd[_0xd4fe('0x1c')](0x194);}return _0x13ac6e;};}function handleError(_0x5e4de0,_0x3eff27){_0x3eff27=_0x3eff27||0x1f4;return function(_0x3c09c6){logger[_0xd4fe('0x26')](_0x3c09c6[_0xd4fe('0x27')]);if(_0x3c09c6[_0xd4fe('0x28')]){delete _0x3c09c6[_0xd4fe('0x28')];}_0x5e4de0['status'](_0x3eff27)[_0xd4fe('0x29')](_0x3c09c6);};}exports[_0xd4fe('0x2a')]=function(_0x5854a6,_0x400773){var _0x471739={},_0x3e6bb0={},_0x5e4500={'count':0x0,'rows':[]};var _0x5a32c1=_[_0xd4fe('0x2b')](db[_0xd4fe('0x2c')][_0xd4fe('0x2d')],function(_0xf5897f){return{'name':_0xf5897f[_0xd4fe('0x2e')],'type':_0xf5897f['type']['key']};});_0x3e6bb0[_0xd4fe('0x2f')]=_[_0xd4fe('0x2b')](_0x5a32c1,_0xd4fe('0x28'));_0x3e6bb0['query']=_[_0xd4fe('0x30')](_0x5854a6[_0xd4fe('0x31')]);_0x3e6bb0['filters']=_[_0xd4fe('0x32')](_0x3e6bb0[_0xd4fe('0x2f')],_0x3e6bb0[_0xd4fe('0x31')]);_0x471739[_0xd4fe('0x33')]=_['intersection'](_0x3e6bb0[_0xd4fe('0x2f')],qs[_0xd4fe('0x34')](_0x5854a6['query']['fields']));_0x471739['attributes']=_0x471739['attributes']['length']?_0x471739[_0xd4fe('0x33')]:_0x3e6bb0[_0xd4fe('0x2f')];if(!_0x5854a6[_0xd4fe('0x31')][_0xd4fe('0x35')]('nolimit')){_0x471739[_0xd4fe('0x22')]=qs[_0xd4fe('0x22')](_0x5854a6['query'][_0xd4fe('0x22')]);_0x471739['offset']=qs[_0xd4fe('0x21')](_0x5854a6[_0xd4fe('0x31')]['offset']);}_0x471739[_0xd4fe('0x36')]=qs[_0xd4fe('0x37')](_0x5854a6[_0xd4fe('0x31')][_0xd4fe('0x37')]);_0x471739[_0xd4fe('0x38')]=qs['filters'](_[_0xd4fe('0x39')](_0x5854a6['query'],_0x3e6bb0[_0xd4fe('0x3a')]),_0x5a32c1);if(_0x5854a6[_0xd4fe('0x31')][_0xd4fe('0x3b')]){_0x471739[_0xd4fe('0x38')]=_[_0xd4fe('0x3c')](_0x471739[_0xd4fe('0x38')],{'$or':_[_0xd4fe('0x2b')](_0x5a32c1,function(_0x1493d0){if(_0x1493d0[_0xd4fe('0x3d')]!==_0xd4fe('0x3e')){var _0x598998={};_0x598998[_0x1493d0[_0xd4fe('0x28')]]={'$like':'%'+_0x5854a6[_0xd4fe('0x31')][_0xd4fe('0x3b')]+'%'};return _0x598998;}})});}_0x471739=_[_0xd4fe('0x3c')]({},_0x471739,_0x5854a6['options']);var _0x576028={'where':_0x471739['where']};return db[_0xd4fe('0x2c')][_0xd4fe('0x20')](_0x576028)[_0xd4fe('0x24')](function(_0x28c1f0){_0x5e4500[_0xd4fe('0x20')]=_0x28c1f0;if(_0x5854a6[_0xd4fe('0x31')][_0xd4fe('0x3f')]){_0x471739['include']=[{'all':!![]}];}return db[_0xd4fe('0x2c')][_0xd4fe('0x40')](_0x471739);})['then'](function(_0x10f804){_0x5e4500['rows']=_0x10f804;return _0x5e4500;})['then'](respondWithFilteredResult(_0x400773,_0x471739))[_0xd4fe('0x41')](handleError(_0x400773,null));};exports[_0xd4fe('0x42')]=function(_0x5cd355,_0x2c9082){var _0x3a96f9={'raw':!![],'where':{'id':_0x5cd355[_0xd4fe('0x43')]['id']}},_0xd46199={};_0xd46199[_0xd4fe('0x2f')]=_['keys'](db['WhatsappQueueReport'][_0xd4fe('0x2d')]);_0xd46199[_0xd4fe('0x31')]=_[_0xd4fe('0x30')](_0x5cd355[_0xd4fe('0x31')]);_0xd46199[_0xd4fe('0x3a')]=_[_0xd4fe('0x32')](_0xd46199[_0xd4fe('0x2f')],_0xd46199[_0xd4fe('0x31')]);_0x3a96f9['attributes']=_[_0xd4fe('0x32')](_0xd46199[_0xd4fe('0x2f')],qs['fields'](_0x5cd355[_0xd4fe('0x31')]['fields']));_0x3a96f9[_0xd4fe('0x33')]=_0x3a96f9[_0xd4fe('0x33')]['length']?_0x3a96f9[_0xd4fe('0x33')]:_0xd46199[_0xd4fe('0x2f')];if(_0x5cd355[_0xd4fe('0x31')]['includeAll']){_0x3a96f9[_0xd4fe('0x44')]=[{'all':!![]}];}_0x3a96f9=_[_0xd4fe('0x3c')]({},_0x3a96f9,_0x5cd355[_0xd4fe('0x45')]);return db['WhatsappQueueReport']['find'](_0x3a96f9)['then'](handleEntityNotFound(_0x2c9082,null))[_0xd4fe('0x24')](respondWithResult(_0x2c9082,null))[_0xd4fe('0x41')](handleError(_0x2c9082,null));};exports[_0xd4fe('0x46')]=function(_0x5c99c5,_0x5b7620){return db[_0xd4fe('0x2c')][_0xd4fe('0x46')](_0x5c99c5['body'],{})['then'](respondWithResult(_0x5b7620,0xc9))[_0xd4fe('0x41')](handleError(_0x5b7620,null));};exports[_0xd4fe('0x47')]=function(_0x3a6b5d,_0x36b860){if(_0x3a6b5d['body']['id']){delete _0x3a6b5d[_0xd4fe('0x48')]['id'];}return db[_0xd4fe('0x2c')][_0xd4fe('0x49')]({'where':{'id':_0x3a6b5d[_0xd4fe('0x43')]['id']}})[_0xd4fe('0x24')](handleEntityNotFound(_0x36b860,null))[_0xd4fe('0x24')](saveUpdates(_0x3a6b5d[_0xd4fe('0x48')],null))[_0xd4fe('0x24')](respondWithResult(_0x36b860,null))['catch'](handleError(_0x36b860,null));};exports[_0xd4fe('0x25')]=function(_0x385a1e,_0x26da96){return db[_0xd4fe('0x2c')][_0xd4fe('0x49')]({'where':{'id':_0x385a1e['params']['id']}})[_0xd4fe('0x24')](handleEntityNotFound(_0x26da96,null))[_0xd4fe('0x24')](removeEntity(_0x26da96,null))['catch'](handleError(_0x26da96,null));};exports[_0xd4fe('0x4a')]=function(_0x5a4cd6,_0x536669){return db[_0xd4fe('0x2c')][_0xd4fe('0x4a')]()[_0xd4fe('0x24')](respondWithResult(_0x536669,null))['catch'](handleError(_0x536669,null));}; \ No newline at end of file +var _0x227e=['json','offset','set','Content-Range','apply','reject','update','then','end','error','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','options','count','includeAll','include','catch','show','params','find','create','body','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x17aa8d,_0x191537){var _0x3e529c=function(_0x1249af){while(--_0x1249af){_0x17aa8d['push'](_0x17aa8d['shift']());}};_0x3e529c(++_0x191537);}(_0x227e,0x1a5));var _0xe227=function(_0xa4df64,_0x5042bb){_0xa4df64=_0xa4df64-0x0;var _0x1835d8=_0x227e[_0xa4df64];return _0x1835d8;};'use strict';var pdf=require(_0xe227('0x0'));var emlformat=require(_0xe227('0x1'));var rimraf=require(_0xe227('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe227('0x3'));var rp=require(_0xe227('0x4'));var moment=require(_0xe227('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe227('0x6'));var util=require(_0xe227('0x7'));var path=require(_0xe227('0x8'));var sox=require(_0xe227('0x9'));var csv=require(_0xe227('0xa'));var ejs=require(_0xe227('0xb'));var fs=require('fs');var _=require(_0xe227('0xc'));var squel=require(_0xe227('0xd'));var crypto=require(_0xe227('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe227('0xf'));var toCsv=require(_0xe227('0xa'));var querystring=require(_0xe227('0x10'));var Papa=require(_0xe227('0x11'));var Redis=require(_0xe227('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe227('0x13'));var as=require(_0xe227('0x14'));var hardwareService=require(_0xe227('0x15'));var logger=require(_0xe227('0x16'))(_0xe227('0x17'));var utils=require('../../config/utils');var config=require(_0xe227('0x18'));var licenseUtil=require(_0xe227('0x19'));var db=require(_0xe227('0x1a'))['db'];function respondWithStatusCode(_0x13a3f5,_0x2f1446){_0x2f1446=_0x2f1446||0xcc;return function(_0x401661){if(_0x401661){return _0x13a3f5[_0xe227('0x1b')](_0x2f1446);}return _0x13a3f5[_0xe227('0x1c')](_0x2f1446)['end']();};}function respondWithResult(_0x1489ba,_0x45a0b4){_0x45a0b4=_0x45a0b4||0xc8;return function(_0x9fba07){if(_0x9fba07){return _0x1489ba[_0xe227('0x1c')](_0x45a0b4)[_0xe227('0x1d')](_0x9fba07);}};}function respondWithFilteredResult(_0x47b3b6,_0x64dfa6){return function(_0x95ab01){if(_0x95ab01){var _0x19e913=_0x95ab01['count'],_0x1da01d=_0x64dfa6[_0xe227('0x1e')],_0x84f392=_0x64dfa6[_0xe227('0x1e')]+_0x64dfa6['limit'],_0x34c2eb;if(_0x84f392>=_0x19e913){_0x84f392=_0x19e913;_0x34c2eb=0xc8;}else{_0x34c2eb=0xce;}_0x47b3b6[_0xe227('0x1c')](_0x34c2eb);return _0x47b3b6[_0xe227('0x1f')](_0xe227('0x20'),_0x1da01d+'-'+_0x84f392+'/'+_0x19e913)['json'](_0x95ab01);}return null;};}function patchUpdates(_0x2ecbe2){return function(_0x364b1f){try{jsonpatch[_0xe227('0x21')](_0x364b1f,_0x2ecbe2,!![]);}catch(_0x41ad2c){return BPromise[_0xe227('0x22')](_0x41ad2c);}return _0x364b1f['save']();};}function saveUpdates(_0x20dd1b,_0x269bc3){return function(_0x1e2e28){if(_0x1e2e28){return _0x1e2e28[_0xe227('0x23')](_0x20dd1b)[_0xe227('0x24')](function(_0x39573d){return _0x39573d;});}return null;};}function removeEntity(_0x453204,_0x5ccb2e){return function(_0x2aef4d){if(_0x2aef4d){return _0x2aef4d['destroy']()[_0xe227('0x24')](function(){_0x453204[_0xe227('0x1c')](0xcc)[_0xe227('0x25')]();});}};}function handleEntityNotFound(_0x46e3f7,_0x525918){return function(_0x29a6c7){if(!_0x29a6c7){_0x46e3f7[_0xe227('0x1b')](0x194);}return _0x29a6c7;};}function handleError(_0xed84a8,_0x57e042){_0x57e042=_0x57e042||0x1f4;return function(_0xcf3e92){logger[_0xe227('0x26')](_0xcf3e92['stack']);if(_0xcf3e92['name']){delete _0xcf3e92[_0xe227('0x27')];}_0xed84a8[_0xe227('0x1c')](_0x57e042)[_0xe227('0x28')](_0xcf3e92);};}exports[_0xe227('0x29')]=function(_0x4e93b8,_0x21e413){var _0x4b211e={},_0x10dcad={},_0x2cd683={'count':0x0,'rows':[]};var _0x46e10f=_[_0xe227('0x2a')](db[_0xe227('0x2b')][_0xe227('0x2c')],function(_0x2cdb40){return{'name':_0x2cdb40[_0xe227('0x2d')],'type':_0x2cdb40[_0xe227('0x2e')][_0xe227('0x2f')]};});_0x10dcad['model']=_['map'](_0x46e10f,'name');_0x10dcad['query']=_[_0xe227('0x30')](_0x4e93b8[_0xe227('0x31')]);_0x10dcad[_0xe227('0x32')]=_[_0xe227('0x33')](_0x10dcad[_0xe227('0x34')],_0x10dcad[_0xe227('0x31')]);_0x4b211e['attributes']=_[_0xe227('0x33')](_0x10dcad['model'],qs[_0xe227('0x35')](_0x4e93b8[_0xe227('0x31')][_0xe227('0x35')]));_0x4b211e['attributes']=_0x4b211e[_0xe227('0x36')][_0xe227('0x37')]?_0x4b211e[_0xe227('0x36')]:_0x10dcad['model'];if(!_0x4e93b8[_0xe227('0x31')][_0xe227('0x38')]('nolimit')){_0x4b211e['limit']=qs[_0xe227('0x39')](_0x4e93b8[_0xe227('0x31')]['limit']);_0x4b211e[_0xe227('0x1e')]=qs[_0xe227('0x1e')](_0x4e93b8[_0xe227('0x31')][_0xe227('0x1e')]);}_0x4b211e[_0xe227('0x3a')]=qs[_0xe227('0x3b')](_0x4e93b8['query'][_0xe227('0x3b')]);_0x4b211e['where']=qs[_0xe227('0x32')](_[_0xe227('0x3c')](_0x4e93b8[_0xe227('0x31')],_0x10dcad[_0xe227('0x32')]),_0x46e10f);if(_0x4e93b8[_0xe227('0x31')][_0xe227('0x3d')]){_0x4b211e[_0xe227('0x3e')]=_[_0xe227('0x3f')](_0x4b211e['where'],{'$or':_[_0xe227('0x2a')](_0x46e10f,function(_0x2adb7d){if(_0x2adb7d[_0xe227('0x2e')]!=='VIRTUAL'){var _0x3f14d0={};_0x3f14d0[_0x2adb7d[_0xe227('0x27')]]={'$like':'%'+_0x4e93b8[_0xe227('0x31')][_0xe227('0x3d')]+'%'};return _0x3f14d0;}})});}_0x4b211e=_[_0xe227('0x3f')]({},_0x4b211e,_0x4e93b8[_0xe227('0x40')]);var _0x464b78={'where':_0x4b211e[_0xe227('0x3e')]};return db[_0xe227('0x2b')][_0xe227('0x41')](_0x464b78)['then'](function(_0x309dd6){_0x2cd683['count']=_0x309dd6;if(_0x4e93b8[_0xe227('0x31')][_0xe227('0x42')]){_0x4b211e[_0xe227('0x43')]=[{'all':!![]}];}return db['WhatsappQueueReport']['findAll'](_0x4b211e);})['then'](function(_0x462dd0){_0x2cd683['rows']=_0x462dd0;return _0x2cd683;})['then'](respondWithFilteredResult(_0x21e413,_0x4b211e))[_0xe227('0x44')](handleError(_0x21e413,null));};exports[_0xe227('0x45')]=function(_0x33eb90,_0x1d5828){var _0x5ec7cc={'raw':!![],'where':{'id':_0x33eb90[_0xe227('0x46')]['id']}},_0x517ea2={};_0x517ea2[_0xe227('0x34')]=_[_0xe227('0x30')](db[_0xe227('0x2b')][_0xe227('0x2c')]);_0x517ea2[_0xe227('0x31')]=_[_0xe227('0x30')](_0x33eb90[_0xe227('0x31')]);_0x517ea2['filters']=_[_0xe227('0x33')](_0x517ea2[_0xe227('0x34')],_0x517ea2[_0xe227('0x31')]);_0x5ec7cc[_0xe227('0x36')]=_[_0xe227('0x33')](_0x517ea2[_0xe227('0x34')],qs[_0xe227('0x35')](_0x33eb90[_0xe227('0x31')][_0xe227('0x35')]));_0x5ec7cc[_0xe227('0x36')]=_0x5ec7cc[_0xe227('0x36')]['length']?_0x5ec7cc[_0xe227('0x36')]:_0x517ea2['model'];if(_0x33eb90['query'][_0xe227('0x42')]){_0x5ec7cc[_0xe227('0x43')]=[{'all':!![]}];}_0x5ec7cc=_[_0xe227('0x3f')]({},_0x5ec7cc,_0x33eb90[_0xe227('0x40')]);return db[_0xe227('0x2b')][_0xe227('0x47')](_0x5ec7cc)['then'](handleEntityNotFound(_0x1d5828,null))[_0xe227('0x24')](respondWithResult(_0x1d5828,null))[_0xe227('0x44')](handleError(_0x1d5828,null));};exports[_0xe227('0x48')]=function(_0x4121ca,_0xc5c2b0){return db[_0xe227('0x2b')][_0xe227('0x48')](_0x4121ca[_0xe227('0x49')],{})[_0xe227('0x24')](respondWithResult(_0xc5c2b0,0xc9))['catch'](handleError(_0xc5c2b0,null));};exports[_0xe227('0x23')]=function(_0x1398b2,_0x187a42){if(_0x1398b2[_0xe227('0x49')]['id']){delete _0x1398b2[_0xe227('0x49')]['id'];}return db['WhatsappQueueReport'][_0xe227('0x47')]({'where':{'id':_0x1398b2[_0xe227('0x46')]['id']}})[_0xe227('0x24')](handleEntityNotFound(_0x187a42,null))[_0xe227('0x24')](saveUpdates(_0x1398b2[_0xe227('0x49')],null))[_0xe227('0x24')](respondWithResult(_0x187a42,null))['catch'](handleError(_0x187a42,null));};exports['destroy']=function(_0x583ce1,_0x25124e){return db['WhatsappQueueReport'][_0xe227('0x47')]({'where':{'id':_0x583ce1[_0xe227('0x46')]['id']}})[_0xe227('0x24')](handleEntityNotFound(_0x25124e,null))[_0xe227('0x24')](removeEntity(_0x25124e,null))['catch'](handleError(_0x25124e,null));};exports[_0xe227('0x4a')]=function(_0x59592a,_0x48678a){return db[_0xe227('0x2b')][_0xe227('0x4a')]()['then'](respondWithResult(_0x48678a,null))[_0xe227('0x44')](handleError(_0x48678a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index ae5e0ba..2df5ff3 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 _0x445a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x14b635,_0x4f2bae){var _0x3f881e=function(_0x416dfe){while(--_0x416dfe){_0x14b635['push'](_0x14b635['shift']());}};_0x3f881e(++_0x4f2bae);}(_0x445a,0x16a));var _0xa445=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x445a[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xa445('0x0'));var util=require('util');var logger=require(_0xa445('0x1'))(_0xa445('0x2'));var moment=require(_0xa445('0x3'));var BPromise=require(_0xa445('0x4'));var rp=require(_0xa445('0x5'));var fs=require('fs');var path=require(_0xa445('0x6'));var rimraf=require(_0xa445('0x7'));var config=require(_0xa445('0x8'));var attributes=require(_0xa445('0x9'));module[_0xa445('0xa')]=function(_0x121621,_0x1a1989){return _0x121621['define'](_0xa445('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xa445('0xc'),'fields':[_0xa445('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x92a0=['uniqueid','util','../../config/logger','api','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport'];(function(_0x43d4ec,_0x4ceb2b){var _0x4d2d07=function(_0x1f1265){while(--_0x1f1265){_0x43d4ec['push'](_0x43d4ec['shift']());}};_0x4d2d07(++_0x4ceb2b);}(_0x92a0,0x1e5));var _0x092a=function(_0x2a3b70,_0x137f86){_0x2a3b70=_0x2a3b70-0x0;var _0x376380=_0x92a0[_0x2a3b70];return _0x376380;};'use strict';var _=require('lodash');var util=require(_0x092a('0x0'));var logger=require(_0x092a('0x1'))(_0x092a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x092a('0x3'));var rimraf=require(_0x092a('0x4'));var config=require(_0x092a('0x5'));var attributes=require(_0x092a('0x6'));module[_0x092a('0x7')]=function(_0x4a4819,_0x43ffcb){return _0x4a4819[_0x092a('0x8')](_0x092a('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x092a('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index a7d99c9..4211e5c 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 _0x7f0c=['request\x20sent','stringify','error','code','message','WhatsappQueueReport,\x20%s,\x20%s','result','CreateWhatsappQueueReport','body','options','raw','catch','UpdateWhatsappQueueReport','update','where','limit','debug','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x7f0c,0x179));var _0xc7f0=function(_0x25bb4c,_0x1a0b53){_0x25bb4c=_0x25bb4c-0x0;var _0x4c78b2=_0x7f0c[_0x25bb4c];return _0x4c78b2;};'use strict';var _=require(_0xc7f0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc7f0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc7f0('0x2'));var db=require(_0xc7f0('0x3'))['db'];var utils=require(_0xc7f0('0x4'));var logger=require(_0xc7f0('0x5'))(_0xc7f0('0x6'));var config=require(_0xc7f0('0x7'));var jayson=require(_0xc7f0('0x8'));var client=jayson[_0xc7f0('0x9')][_0xc7f0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x103df4,_0x331ea5,_0x81364e){return new BPromise(function(_0x113527,_0xd48f92){return client['request'](_0x103df4,_0x81364e)[_0xc7f0('0xb')](function(_0xeabdc1){logger[_0xc7f0('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x331ea5,_0xc7f0('0xd'));logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x331ea5,_0xc7f0('0xd'),JSON[_0xc7f0('0xe')](_0xeabdc1));if(_0xeabdc1[_0xc7f0('0xf')]){if(_0xeabdc1[_0xc7f0('0xf')][_0xc7f0('0x10')]===0x1f4){logger[_0xc7f0('0xf')]('WhatsappQueueReport,\x20%s,\x20%s',_0x331ea5,_0xeabdc1[_0xc7f0('0xf')][_0xc7f0('0x11')]);return _0xd48f92(_0xeabdc1[_0xc7f0('0xf')]['message']);}logger['error'](_0xc7f0('0x12'),_0x331ea5,_0xeabdc1[_0xc7f0('0xf')][_0xc7f0('0x11')]);return _0x113527(_0xeabdc1[_0xc7f0('0xf')][_0xc7f0('0x11')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x331ea5,'request\x20sent');_0x113527(_0xeabdc1[_0xc7f0('0x13')]['message']);}})['catch'](function(_0x4d822f){logger[_0xc7f0('0xf')](_0xc7f0('0x12'),_0x331ea5,_0x4d822f);_0xd48f92(_0x4d822f);});});}exports[_0xc7f0('0x14')]=function(_0x469e8b){var _0x15aa8f=this;return new Promise(function(_0xcd8c5,_0x2b3f99){return db['WhatsappQueueReport']['create'](_0x469e8b[_0xc7f0('0x15')],{'raw':_0x469e8b[_0xc7f0('0x16')]?_0x469e8b[_0xc7f0('0x16')][_0xc7f0('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x35ece0){logger[_0xc7f0('0xc')](_0xc7f0('0x14'),_0x469e8b);logger['debug']('CreateWhatsappQueueReport',_0x469e8b,JSON[_0xc7f0('0xe')](_0x35ece0));_0xcd8c5(_0x35ece0);})[_0xc7f0('0x18')](function(_0x15e64b){logger['error'](_0xc7f0('0x14'),_0x15e64b[_0xc7f0('0x11')],_0x469e8b);_0x2b3f99(_0x15aa8f[_0xc7f0('0xf')](0x1f4,_0x15e64b[_0xc7f0('0x11')]));});});};exports[_0xc7f0('0x19')]=function(_0x1ac32a){var _0x2f78e6=this;return new Promise(function(_0x4552c4,_0x58caba){return db['WhatsappQueueReport'][_0xc7f0('0x1a')](_0x1ac32a[_0xc7f0('0x15')],{'raw':_0x1ac32a[_0xc7f0('0x16')]?_0x1ac32a[_0xc7f0('0x16')][_0xc7f0('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ac32a[_0xc7f0('0x16')]?_0x1ac32a[_0xc7f0('0x16')][_0xc7f0('0x1b')]||null:null,'attributes':_0x1ac32a[_0xc7f0('0x16')]?_0x1ac32a[_0xc7f0('0x16')]['attributes']||null:null,'limit':_0x1ac32a[_0xc7f0('0x16')]?_0x1ac32a['options'][_0xc7f0('0x1c')]||null:null})[_0xc7f0('0xb')](function(_0x10567c){logger[_0xc7f0('0xc')](_0xc7f0('0x19'),_0x1ac32a);logger[_0xc7f0('0x1d')]('UpdateWhatsappQueueReport',_0x1ac32a,JSON[_0xc7f0('0xe')](_0x10567c));_0x4552c4(_0x10567c);})[_0xc7f0('0x18')](function(_0x2bb07c){logger[_0xc7f0('0xf')]('UpdateWhatsappQueueReport',_0x2bb07c[_0xc7f0('0x11')],_0x1ac32a);_0x58caba(_0x2f78e6[_0xc7f0('0xf')](0x1f4,_0x2bb07c[_0xc7f0('0x11')]));});});}; \ No newline at end of file +var _0x4774=['stringify','error','code','message','WhatsappQueueReport,\x20%s,\x20%s','catch','CreateWhatsappQueueReport','WhatsappQueueReport','options','raw','then','UpdateWhatsappQueueReport','update','body','attributes','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s'];(function(_0x2dfedd,_0x1c31e6){var _0x1f697c=function(_0x119f36){while(--_0x119f36){_0x2dfedd['push'](_0x2dfedd['shift']());}};_0x1f697c(++_0x1c31e6);}(_0x4774,0x159));var _0x4477=function(_0x32b1b8,_0x45b5b7){_0x32b1b8=_0x32b1b8-0x0;var _0xccbe98=_0x4774[_0x32b1b8];return _0xccbe98;};'use strict';var _=require(_0x4477('0x0'));var util=require(_0x4477('0x1'));var moment=require('moment');var BPromise=require(_0x4477('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4477('0x3'));var db=require(_0x4477('0x4'))['db'];var utils=require(_0x4477('0x5'));var logger=require(_0x4477('0x6'))('rpc');var config=require(_0x4477('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4477('0x8')][_0x4477('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4786ed,_0x31d2ef,_0x3122ab){return new BPromise(function(_0x5eb649,_0x4a0ddd){return client[_0x4477('0xa')](_0x4786ed,_0x3122ab)['then'](function(_0x4f3fd7){logger[_0x4477('0xb')]('WhatsappQueueReport,\x20%s,\x20%s',_0x31d2ef,_0x4477('0xc'));logger[_0x4477('0xd')](_0x4477('0xe'),_0x31d2ef,_0x4477('0xc'),JSON[_0x4477('0xf')](_0x4f3fd7));if(_0x4f3fd7[_0x4477('0x10')]){if(_0x4f3fd7['error'][_0x4477('0x11')]===0x1f4){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x31d2ef,_0x4f3fd7[_0x4477('0x10')][_0x4477('0x12')]);return _0x4a0ddd(_0x4f3fd7[_0x4477('0x10')][_0x4477('0x12')]);}logger[_0x4477('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x31d2ef,_0x4f3fd7[_0x4477('0x10')][_0x4477('0x12')]);return _0x5eb649(_0x4f3fd7[_0x4477('0x10')]['message']);}else{logger['info'](_0x4477('0x13'),_0x31d2ef,_0x4477('0xc'));_0x5eb649(_0x4f3fd7['result']['message']);}})[_0x4477('0x14')](function(_0x2efb12){logger['error'](_0x4477('0x13'),_0x31d2ef,_0x2efb12);_0x4a0ddd(_0x2efb12);});});}exports[_0x4477('0x15')]=function(_0x3537cb){var _0x1554fc=this;return new Promise(function(_0x2948be,_0x4a718f){return db[_0x4477('0x16')]['create'](_0x3537cb['body'],{'raw':_0x3537cb[_0x4477('0x17')]?_0x3537cb[_0x4477('0x17')][_0x4477('0x18')]===undefined?!![]:![]:!![]})[_0x4477('0x19')](function(_0x2154ae){logger['info'](_0x4477('0x15'),_0x3537cb);logger[_0x4477('0xd')](_0x4477('0x15'),_0x3537cb,JSON['stringify'](_0x2154ae));_0x2948be(_0x2154ae);})['catch'](function(_0x1d2304){logger['error']('CreateWhatsappQueueReport',_0x1d2304['message'],_0x3537cb);_0x4a718f(_0x1554fc['error'](0x1f4,_0x1d2304[_0x4477('0x12')]));});});};exports[_0x4477('0x1a')]=function(_0x5b6ca8){var _0x1c5f38=this;return new Promise(function(_0x50de3d,_0x5bb1ff){return db[_0x4477('0x16')][_0x4477('0x1b')](_0x5b6ca8[_0x4477('0x1c')],{'raw':_0x5b6ca8[_0x4477('0x17')]?_0x5b6ca8[_0x4477('0x17')][_0x4477('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b6ca8['options']?_0x5b6ca8[_0x4477('0x17')]['where']||null:null,'attributes':_0x5b6ca8[_0x4477('0x17')]?_0x5b6ca8[_0x4477('0x17')][_0x4477('0x1d')]||null:null,'limit':_0x5b6ca8[_0x4477('0x17')]?_0x5b6ca8[_0x4477('0x17')]['limit']||null:null})['then'](function(_0x2235ef){logger[_0x4477('0xb')](_0x4477('0x1a'),_0x5b6ca8);logger[_0x4477('0xd')](_0x4477('0x1a'),_0x5b6ca8,JSON[_0x4477('0xf')](_0x2235ef));_0x50de3d(_0x2235ef);})[_0x4477('0x14')](function(_0x239a32){logger[_0x4477('0x10')]('UpdateWhatsappQueueReport',_0x239a32['message'],_0x5b6ca8);_0x5bb1ff(_0x1c5f38[_0x4477('0x10')](0x1f4,_0x239a32[_0x4477('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 66d9af8..294005d 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 _0x4a81=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete'];(function(_0x53671e,_0x493c5e){var _0x55f65d=function(_0x3c1185){while(--_0x3c1185){_0x53671e['push'](_0x53671e['shift']());}};_0x55f65d(++_0x493c5e);}(_0x4a81,0x1e1));var _0x14a8=function(_0x3e1418,_0x3feb88){_0x3e1418=_0x3e1418-0x0;var _0x4e7447=_0x4a81[_0x3e1418];return _0x4e7447;};'use strict';var multer=require(_0x14a8('0x0'));var util=require(_0x14a8('0x1'));var path=require(_0x14a8('0x2'));var timeout=require(_0x14a8('0x3'));var express=require(_0x14a8('0x4'));var router=express['Router']();var auth=require(_0x14a8('0x5'));var interaction=require(_0x14a8('0x6'));var config=require(_0x14a8('0x7'));var controller=require(_0x14a8('0x8'));router[_0x14a8('0x9')]('/',auth[_0x14a8('0xa')](),controller[_0x14a8('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x14a8('0xc')]);router[_0x14a8('0x9')](_0x14a8('0xd'),auth[_0x14a8('0xa')](),controller[_0x14a8('0xe')]);router['post']('/',auth[_0x14a8('0xa')](),controller[_0x14a8('0xf')]);router[_0x14a8('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x14a8('0x11')]);router[_0x14a8('0x12')](_0x14a8('0xd'),auth[_0x14a8('0xa')](),controller['destroy']);module[_0x14a8('0x13')]=router; \ No newline at end of file +var _0xb781=['index','get','/describe','isAuthenticated','describe','post','create','put','/:id','update','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller'];(function(_0x17a2be,_0x40efd4){var _0xe6e5f=function(_0x2494da){while(--_0x2494da){_0x17a2be['push'](_0x17a2be['shift']());}};_0xe6e5f(++_0x40efd4);}(_0xb781,0x138));var _0x1b78=function(_0x3886ea,_0x184c4e){_0x3886ea=_0x3886ea-0x0;var _0x3c6a3f=_0xb781[_0x3886ea];return _0x3c6a3f;};'use strict';var multer=require(_0x1b78('0x0'));var util=require('util');var path=require(_0x1b78('0x1'));var timeout=require('connect-timeout');var express=require(_0x1b78('0x2'));var router=express[_0x1b78('0x3')]();var auth=require(_0x1b78('0x4'));var interaction=require(_0x1b78('0x5'));var config=require(_0x1b78('0x6'));var controller=require(_0x1b78('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1b78('0x8')]);router[_0x1b78('0x9')](_0x1b78('0xa'),auth[_0x1b78('0xb')](),controller[_0x1b78('0xc')]);router[_0x1b78('0x9')]('/:id',auth[_0x1b78('0xb')](),controller['show']);router[_0x1b78('0xd')]('/',auth[_0x1b78('0xb')](),controller[_0x1b78('0xe')]);router[_0x1b78('0xf')](_0x1b78('0x10'),auth[_0x1b78('0xb')](),controller[_0x1b78('0x11')]);router['delete'](_0x1b78('0x10'),auth['isAuthenticated'](),controller[_0x1b78('0x12')]);module[_0x1b78('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index f6c6dcb..d350138 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 _0x757a=['queue','DATE','exports','STRING'];(function(_0x122cc1,_0x5c956e){var _0x1e33af=function(_0x949b75){while(--_0x949b75){_0x122cc1['push'](_0x122cc1['shift']());}};_0x1e33af(++_0x5c956e);}(_0x757a,0xde));var _0xa757=function(_0x52d833,_0x268e88){_0x52d833=_0x52d833-0x0;var _0x54f37b=_0x757a[_0x52d833];return _0x54f37b;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'uniqueid':{'type':Sequelize[_0xa757('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account','agent',_0xa757('0x2')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xa757('0x3')]}}; \ No newline at end of file +var _0xb10b=['ENUM','account','queue','DATE','sequelize','STRING'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xb10b,0x12a));var _0xbb10=function(_0x5e3191,_0x47fe85){_0x5e3191=_0x5e3191-0x0;var _0xc8d5e6=_0xb10b[_0x5e3191];return _0xc8d5e6;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xbb10('0x2')](_0xbb10('0x3'),'agent',_0xbb10('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xbb10('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index a0f9e20..e20b948 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 _0x932e=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','include','show','params','includeAll','find','catch','create','update','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','count','offset','limit','set','json','apply','reject','save','destroy','stack','name','send','index','map','WhatsappTransferReport','rawAttributes'];(function(_0x1d8f20,_0x33486a){var _0xb27b30=function(_0x45b930){while(--_0x45b930){_0x1d8f20['push'](_0x1d8f20['shift']());}};_0xb27b30(++_0x33486a);}(_0x932e,0xfc));var _0xe932=function(_0x21f4cf,_0x1e061e){_0x21f4cf=_0x21f4cf-0x0;var _0x4deb27=_0x932e[_0x21f4cf];return _0x4deb27;};'use strict';var pdf=require(_0xe932('0x0'));var emlformat=require(_0xe932('0x1'));var rimraf=require(_0xe932('0x2'));var zipdir=require(_0xe932('0x3'));var jsonpatch=require(_0xe932('0x4'));var rp=require(_0xe932('0x5'));var moment=require('moment');var BPromise=require(_0xe932('0x6'));var Mustache=require(_0xe932('0x7'));var util=require(_0xe932('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xe932('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe932('0xa'));var squel=require(_0xe932('0xb'));var crypto=require(_0xe932('0xc'));var jsforce=require(_0xe932('0xd'));var deskjs=require(_0xe932('0xe'));var toCsv=require(_0xe932('0x9'));var querystring=require(_0xe932('0xf'));var Papa=require(_0xe932('0x10'));var Redis=require(_0xe932('0x11'));var authService=require(_0xe932('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe932('0x13'));var logger=require(_0xe932('0x14'))('api');var utils=require(_0xe932('0x15'));var config=require(_0xe932('0x16'));var licenseUtil=require(_0xe932('0x17'));var db=require(_0xe932('0x18'))['db'];function respondWithStatusCode(_0x44f40e,_0x300b9e){_0x300b9e=_0x300b9e||0xcc;return function(_0x4db054){if(_0x4db054){return _0x44f40e[_0xe932('0x19')](_0x300b9e);}return _0x44f40e[_0xe932('0x1a')](_0x300b9e)[_0xe932('0x1b')]();};}function respondWithResult(_0xbbe10,_0x17c184){_0x17c184=_0x17c184||0xc8;return function(_0x3b0e00){if(_0x3b0e00){return _0xbbe10[_0xe932('0x1a')](_0x17c184)['json'](_0x3b0e00);}};}function respondWithFilteredResult(_0x33fcd3,_0x3d3d20){return function(_0x2c6bbb){if(_0x2c6bbb){var _0x515961=_0x2c6bbb[_0xe932('0x1c')],_0x3f7cf1=_0x3d3d20[_0xe932('0x1d')],_0x2fe75b=_0x3d3d20[_0xe932('0x1d')]+_0x3d3d20[_0xe932('0x1e')],_0x28c91a;if(_0x2fe75b>=_0x515961){_0x2fe75b=_0x515961;_0x28c91a=0xc8;}else{_0x28c91a=0xce;}_0x33fcd3[_0xe932('0x1a')](_0x28c91a);return _0x33fcd3[_0xe932('0x1f')]('Content-Range',_0x3f7cf1+'-'+_0x2fe75b+'/'+_0x515961)[_0xe932('0x20')](_0x2c6bbb);}return null;};}function patchUpdates(_0x43f71c){return function(_0x47fdff){try{jsonpatch[_0xe932('0x21')](_0x47fdff,_0x43f71c,!![]);}catch(_0x1de74d){return BPromise[_0xe932('0x22')](_0x1de74d);}return _0x47fdff[_0xe932('0x23')]();};}function saveUpdates(_0x13564e,_0x3a3815){return function(_0x512e5e){if(_0x512e5e){return _0x512e5e['update'](_0x13564e)['then'](function(_0x387c19){return _0x387c19;});}return null;};}function removeEntity(_0x416e5c,_0x386d3d){return function(_0x58dc55){if(_0x58dc55){return _0x58dc55[_0xe932('0x24')]()['then'](function(){_0x416e5c[_0xe932('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x70eda8,_0x5d2bfd){return function(_0x57a740){if(!_0x57a740){_0x70eda8[_0xe932('0x19')](0x194);}return _0x57a740;};}function handleError(_0x2dcee1,_0x16000e){_0x16000e=_0x16000e||0x1f4;return function(_0x46de90){logger['error'](_0x46de90[_0xe932('0x25')]);if(_0x46de90[_0xe932('0x26')]){delete _0x46de90[_0xe932('0x26')];}_0x2dcee1[_0xe932('0x1a')](_0x16000e)[_0xe932('0x27')](_0x46de90);};}exports[_0xe932('0x28')]=function(_0x245dcd,_0x38bb02){var _0x1fc235={},_0x342a2a={},_0xf3129d={'count':0x0,'rows':[]};var _0x18e3c7=_[_0xe932('0x29')](db[_0xe932('0x2a')][_0xe932('0x2b')],function(_0x31b1ae){return{'name':_0x31b1ae['fieldName'],'type':_0x31b1ae['type'][_0xe932('0x2c')]};});_0x342a2a[_0xe932('0x2d')]=_[_0xe932('0x29')](_0x18e3c7,_0xe932('0x26'));_0x342a2a[_0xe932('0x2e')]=_[_0xe932('0x2f')](_0x245dcd[_0xe932('0x2e')]);_0x342a2a[_0xe932('0x30')]=_[_0xe932('0x31')](_0x342a2a['model'],_0x342a2a[_0xe932('0x2e')]);_0x1fc235[_0xe932('0x32')]=_['intersection'](_0x342a2a[_0xe932('0x2d')],qs[_0xe932('0x33')](_0x245dcd['query'][_0xe932('0x33')]));_0x1fc235[_0xe932('0x32')]=_0x1fc235['attributes'][_0xe932('0x34')]?_0x1fc235[_0xe932('0x32')]:_0x342a2a[_0xe932('0x2d')];if(!_0x245dcd[_0xe932('0x2e')][_0xe932('0x35')]('nolimit')){_0x1fc235['limit']=qs[_0xe932('0x1e')](_0x245dcd['query'][_0xe932('0x1e')]);_0x1fc235[_0xe932('0x1d')]=qs['offset'](_0x245dcd['query'][_0xe932('0x1d')]);}_0x1fc235[_0xe932('0x36')]=qs['sort'](_0x245dcd[_0xe932('0x2e')][_0xe932('0x37')]);_0x1fc235[_0xe932('0x38')]=qs[_0xe932('0x30')](_[_0xe932('0x39')](_0x245dcd[_0xe932('0x2e')],_0x342a2a['filters']),_0x18e3c7);if(_0x245dcd[_0xe932('0x2e')][_0xe932('0x3a')]){_0x1fc235['where']=_[_0xe932('0x3b')](_0x1fc235['where'],{'$or':_['map'](_0x18e3c7,function(_0x1defa8){if(_0x1defa8[_0xe932('0x3c')]!==_0xe932('0x3d')){var _0x384af={};_0x384af[_0x1defa8['name']]={'$like':'%'+_0x245dcd[_0xe932('0x2e')]['filter']+'%'};return _0x384af;}})});}_0x1fc235=_['merge']({},_0x1fc235,_0x245dcd[_0xe932('0x3e')]);var _0x2f38f4={'where':_0x1fc235['where']};return db['WhatsappTransferReport']['count'](_0x2f38f4)[_0xe932('0x3f')](function(_0x3eb4d9){_0xf3129d[_0xe932('0x1c')]=_0x3eb4d9;if(_0x245dcd['query']['includeAll']){_0x1fc235[_0xe932('0x40')]=[{'all':!![]}];}return db[_0xe932('0x2a')]['findAll'](_0x1fc235);})[_0xe932('0x3f')](function(_0x598131){_0xf3129d['rows']=_0x598131;return _0xf3129d;})['then'](respondWithFilteredResult(_0x38bb02,_0x1fc235))['catch'](handleError(_0x38bb02,null));};exports[_0xe932('0x41')]=function(_0x399dda,_0x2072c6){var _0x11908a={'raw':!![],'where':{'id':_0x399dda[_0xe932('0x42')]['id']}},_0x5eb910={};_0x5eb910[_0xe932('0x2d')]=_[_0xe932('0x2f')](db[_0xe932('0x2a')][_0xe932('0x2b')]);_0x5eb910[_0xe932('0x2e')]=_[_0xe932('0x2f')](_0x399dda[_0xe932('0x2e')]);_0x5eb910[_0xe932('0x30')]=_[_0xe932('0x31')](_0x5eb910[_0xe932('0x2d')],_0x5eb910['query']);_0x11908a[_0xe932('0x32')]=_[_0xe932('0x31')](_0x5eb910[_0xe932('0x2d')],qs[_0xe932('0x33')](_0x399dda['query']['fields']));_0x11908a['attributes']=_0x11908a['attributes']['length']?_0x11908a[_0xe932('0x32')]:_0x5eb910[_0xe932('0x2d')];if(_0x399dda[_0xe932('0x2e')][_0xe932('0x43')]){_0x11908a['include']=[{'all':!![]}];}_0x11908a=_[_0xe932('0x3b')]({},_0x11908a,_0x399dda[_0xe932('0x3e')]);return db[_0xe932('0x2a')][_0xe932('0x44')](_0x11908a)['then'](handleEntityNotFound(_0x2072c6,null))[_0xe932('0x3f')](respondWithResult(_0x2072c6,null))[_0xe932('0x45')](handleError(_0x2072c6,null));};exports['create']=function(_0x1a4edb,_0x1b58e2){return db[_0xe932('0x2a')][_0xe932('0x46')](_0x1a4edb['body'],{})['then'](respondWithResult(_0x1b58e2,0xc9))[_0xe932('0x45')](handleError(_0x1b58e2,null));};exports[_0xe932('0x47')]=function(_0x59e5fe,_0x3a1d87){if(_0x59e5fe[_0xe932('0x48')]['id']){delete _0x59e5fe['body']['id'];}return db[_0xe932('0x2a')]['find']({'where':{'id':_0x59e5fe[_0xe932('0x42')]['id']}})[_0xe932('0x3f')](handleEntityNotFound(_0x3a1d87,null))[_0xe932('0x3f')](saveUpdates(_0x59e5fe[_0xe932('0x48')],null))['then'](respondWithResult(_0x3a1d87,null))[_0xe932('0x45')](handleError(_0x3a1d87,null));};exports[_0xe932('0x24')]=function(_0x419781,_0x365c0c){return db[_0xe932('0x2a')][_0xe932('0x44')]({'where':{'id':_0x419781['params']['id']}})[_0xe932('0x3f')](handleEntityNotFound(_0x365c0c,null))[_0xe932('0x3f')](removeEntity(_0x365c0c,null))[_0xe932('0x45')](handleError(_0x365c0c,null));};exports[_0xe932('0x49')]=function(_0x2eb331,_0x2a9a50){return db[_0xe932('0x2a')]['describe']()[_0xe932('0x3f')](respondWithResult(_0x2a9a50,null))['catch'](handleError(_0x2a9a50,null));}; \ No newline at end of file +var _0xdba7=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','rows','catch','show','include','find','create','body','update','params','describe','html-pdf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x4a573b,_0x35cb05){var _0x6368d1=function(_0x43783f){while(--_0x43783f){_0x4a573b['push'](_0x4a573b['shift']());}};_0x6368d1(++_0x35cb05);}(_0xdba7,0x125));var _0x7dba=function(_0x2044b7,_0x56eac9){_0x2044b7=_0x2044b7-0x0;var _0x315afd=_0xdba7[_0x2044b7];return _0x315afd;};'use strict';var pdf=require(_0x7dba('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7dba('0x1'));var jsonpatch=require(_0x7dba('0x2'));var rp=require(_0x7dba('0x3'));var moment=require('moment');var BPromise=require(_0x7dba('0x4'));var Mustache=require(_0x7dba('0x5'));var util=require(_0x7dba('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x7dba('0x7'));var ejs=require(_0x7dba('0x8'));var fs=require('fs');var _=require(_0x7dba('0x9'));var squel=require(_0x7dba('0xa'));var crypto=require(_0x7dba('0xb'));var jsforce=require(_0x7dba('0xc'));var deskjs=require(_0x7dba('0xd'));var toCsv=require(_0x7dba('0x7'));var querystring=require(_0x7dba('0xe'));var Papa=require(_0x7dba('0xf'));var Redis=require(_0x7dba('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7dba('0x11'));var as=require(_0x7dba('0x12'));var hardwareService=require(_0x7dba('0x13'));var logger=require(_0x7dba('0x14'))(_0x7dba('0x15'));var utils=require(_0x7dba('0x16'));var config=require(_0x7dba('0x17'));var licenseUtil=require(_0x7dba('0x18'));var db=require(_0x7dba('0x19'))['db'];function respondWithStatusCode(_0x25439a,_0x1d3c8d){_0x1d3c8d=_0x1d3c8d||0xcc;return function(_0x17d431){if(_0x17d431){return _0x25439a['sendStatus'](_0x1d3c8d);}return _0x25439a[_0x7dba('0x1a')](_0x1d3c8d)[_0x7dba('0x1b')]();};}function respondWithResult(_0x1fea5c,_0x56ebe4){_0x56ebe4=_0x56ebe4||0xc8;return function(_0x442b92){if(_0x442b92){return _0x1fea5c[_0x7dba('0x1a')](_0x56ebe4)['json'](_0x442b92);}};}function respondWithFilteredResult(_0x13e7d0,_0x1da758){return function(_0x28a92b){if(_0x28a92b){var _0x2a33bb=_0x28a92b[_0x7dba('0x1c')],_0x386ce4=_0x1da758[_0x7dba('0x1d')],_0x3e326d=_0x1da758[_0x7dba('0x1d')]+_0x1da758[_0x7dba('0x1e')],_0xde4a8;if(_0x3e326d>=_0x2a33bb){_0x3e326d=_0x2a33bb;_0xde4a8=0xc8;}else{_0xde4a8=0xce;}_0x13e7d0[_0x7dba('0x1a')](_0xde4a8);return _0x13e7d0[_0x7dba('0x1f')](_0x7dba('0x20'),_0x386ce4+'-'+_0x3e326d+'/'+_0x2a33bb)[_0x7dba('0x21')](_0x28a92b);}return null;};}function patchUpdates(_0x1db6d2){return function(_0x599cf6){try{jsonpatch[_0x7dba('0x22')](_0x599cf6,_0x1db6d2,!![]);}catch(_0x2d3a9e){return BPromise[_0x7dba('0x23')](_0x2d3a9e);}return _0x599cf6[_0x7dba('0x24')]();};}function saveUpdates(_0x3feb49,_0xf6b888){return function(_0x32449c){if(_0x32449c){return _0x32449c['update'](_0x3feb49)[_0x7dba('0x25')](function(_0x478076){return _0x478076;});}return null;};}function removeEntity(_0x1d6543,_0x20b81b){return function(_0x348f6e){if(_0x348f6e){return _0x348f6e[_0x7dba('0x26')]()['then'](function(){_0x1d6543[_0x7dba('0x1a')](0xcc)[_0x7dba('0x1b')]();});}};}function handleEntityNotFound(_0x228cb8,_0x34f964){return function(_0x45b3e3){if(!_0x45b3e3){_0x228cb8['sendStatus'](0x194);}return _0x45b3e3;};}function handleError(_0x55d3de,_0xff985e){_0xff985e=_0xff985e||0x1f4;return function(_0x161283){logger['error'](_0x161283[_0x7dba('0x27')]);if(_0x161283[_0x7dba('0x28')]){delete _0x161283[_0x7dba('0x28')];}_0x55d3de[_0x7dba('0x1a')](_0xff985e)[_0x7dba('0x29')](_0x161283);};}exports[_0x7dba('0x2a')]=function(_0xc56614,_0x3c0209){var _0x4e3f5d={},_0x4959f3={},_0x3e28c2={'count':0x0,'rows':[]};var _0x563421=_[_0x7dba('0x2b')](db[_0x7dba('0x2c')][_0x7dba('0x2d')],function(_0x3ff887){return{'name':_0x3ff887[_0x7dba('0x2e')],'type':_0x3ff887['type'][_0x7dba('0x2f')]};});_0x4959f3[_0x7dba('0x30')]=_[_0x7dba('0x2b')](_0x563421,_0x7dba('0x28'));_0x4959f3[_0x7dba('0x31')]=_[_0x7dba('0x32')](_0xc56614['query']);_0x4959f3[_0x7dba('0x33')]=_[_0x7dba('0x34')](_0x4959f3['model'],_0x4959f3[_0x7dba('0x31')]);_0x4e3f5d['attributes']=_[_0x7dba('0x34')](_0x4959f3[_0x7dba('0x30')],qs[_0x7dba('0x35')](_0xc56614[_0x7dba('0x31')]['fields']));_0x4e3f5d[_0x7dba('0x36')]=_0x4e3f5d[_0x7dba('0x36')][_0x7dba('0x37')]?_0x4e3f5d['attributes']:_0x4959f3['model'];if(!_0xc56614[_0x7dba('0x31')][_0x7dba('0x38')]('nolimit')){_0x4e3f5d[_0x7dba('0x1e')]=qs[_0x7dba('0x1e')](_0xc56614[_0x7dba('0x31')][_0x7dba('0x1e')]);_0x4e3f5d[_0x7dba('0x1d')]=qs[_0x7dba('0x1d')](_0xc56614[_0x7dba('0x31')][_0x7dba('0x1d')]);}_0x4e3f5d[_0x7dba('0x39')]=qs['sort'](_0xc56614[_0x7dba('0x31')][_0x7dba('0x3a')]);_0x4e3f5d[_0x7dba('0x3b')]=qs[_0x7dba('0x33')](_[_0x7dba('0x3c')](_0xc56614[_0x7dba('0x31')],_0x4959f3[_0x7dba('0x33')]),_0x563421);if(_0xc56614['query'][_0x7dba('0x3d')]){_0x4e3f5d[_0x7dba('0x3b')]=_[_0x7dba('0x3e')](_0x4e3f5d[_0x7dba('0x3b')],{'$or':_[_0x7dba('0x2b')](_0x563421,function(_0x5c8354){if(_0x5c8354[_0x7dba('0x3f')]!==_0x7dba('0x40')){var _0x14d050={};_0x14d050[_0x5c8354[_0x7dba('0x28')]]={'$like':'%'+_0xc56614[_0x7dba('0x31')]['filter']+'%'};return _0x14d050;}})});}_0x4e3f5d=_[_0x7dba('0x3e')]({},_0x4e3f5d,_0xc56614[_0x7dba('0x41')]);var _0x4af8db={'where':_0x4e3f5d[_0x7dba('0x3b')]};return db[_0x7dba('0x2c')][_0x7dba('0x1c')](_0x4af8db)[_0x7dba('0x25')](function(_0x456b24){_0x3e28c2['count']=_0x456b24;if(_0xc56614[_0x7dba('0x31')]['includeAll']){_0x4e3f5d['include']=[{'all':!![]}];}return db[_0x7dba('0x2c')][_0x7dba('0x42')](_0x4e3f5d);})[_0x7dba('0x25')](function(_0xa0a0f9){_0x3e28c2[_0x7dba('0x43')]=_0xa0a0f9;return _0x3e28c2;})['then'](respondWithFilteredResult(_0x3c0209,_0x4e3f5d))[_0x7dba('0x44')](handleError(_0x3c0209,null));};exports[_0x7dba('0x45')]=function(_0x10149d,_0x59e269){var _0x4535fd={'raw':!![],'where':{'id':_0x10149d['params']['id']}},_0x89d9d7={};_0x89d9d7[_0x7dba('0x30')]=_[_0x7dba('0x32')](db[_0x7dba('0x2c')][_0x7dba('0x2d')]);_0x89d9d7[_0x7dba('0x31')]=_[_0x7dba('0x32')](_0x10149d[_0x7dba('0x31')]);_0x89d9d7[_0x7dba('0x33')]=_[_0x7dba('0x34')](_0x89d9d7['model'],_0x89d9d7[_0x7dba('0x31')]);_0x4535fd['attributes']=_[_0x7dba('0x34')](_0x89d9d7[_0x7dba('0x30')],qs[_0x7dba('0x35')](_0x10149d['query']['fields']));_0x4535fd[_0x7dba('0x36')]=_0x4535fd[_0x7dba('0x36')][_0x7dba('0x37')]?_0x4535fd['attributes']:_0x89d9d7[_0x7dba('0x30')];if(_0x10149d['query']['includeAll']){_0x4535fd[_0x7dba('0x46')]=[{'all':!![]}];}_0x4535fd=_[_0x7dba('0x3e')]({},_0x4535fd,_0x10149d[_0x7dba('0x41')]);return db[_0x7dba('0x2c')][_0x7dba('0x47')](_0x4535fd)['then'](handleEntityNotFound(_0x59e269,null))[_0x7dba('0x25')](respondWithResult(_0x59e269,null))[_0x7dba('0x44')](handleError(_0x59e269,null));};exports[_0x7dba('0x48')]=function(_0x52a5d1,_0x5a6a8){return db[_0x7dba('0x2c')][_0x7dba('0x48')](_0x52a5d1[_0x7dba('0x49')],{})[_0x7dba('0x25')](respondWithResult(_0x5a6a8,0xc9))[_0x7dba('0x44')](handleError(_0x5a6a8,null));};exports[_0x7dba('0x4a')]=function(_0x46be13,_0x358ac5){if(_0x46be13[_0x7dba('0x49')]['id']){delete _0x46be13[_0x7dba('0x49')]['id'];}return db[_0x7dba('0x2c')][_0x7dba('0x47')]({'where':{'id':_0x46be13[_0x7dba('0x4b')]['id']}})['then'](handleEntityNotFound(_0x358ac5,null))[_0x7dba('0x25')](saveUpdates(_0x46be13[_0x7dba('0x49')],null))[_0x7dba('0x25')](respondWithResult(_0x358ac5,null))[_0x7dba('0x44')](handleError(_0x358ac5,null));};exports[_0x7dba('0x26')]=function(_0x45323e,_0x2a294e){return db[_0x7dba('0x2c')][_0x7dba('0x47')]({'where':{'id':_0x45323e[_0x7dba('0x4b')]['id']}})[_0x7dba('0x25')](handleEntityNotFound(_0x2a294e,null))[_0x7dba('0x25')](removeEntity(_0x2a294e,null))[_0x7dba('0x44')](handleError(_0x2a294e,null));};exports['describe']=function(_0x5de711,_0x3f9f8e){return db[_0x7dba('0x2c')][_0x7dba('0x4c')]()[_0x7dba('0x25')](respondWithResult(_0x3f9f8e,null))['catch'](handleError(_0x3f9f8e,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 38108c9..3343482 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 _0x2178=['../../config/logger','api','moment','bluebird','path','./whatsappTransferReport.attributes','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util'];(function(_0x465b0c,_0x569d90){var _0x502ff0=function(_0x221757){while(--_0x221757){_0x465b0c['push'](_0x465b0c['shift']());}};_0x502ff0(++_0x569d90);}(_0x2178,0x1ab));var _0x8217=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0x2178[_0x2c3255];return _0x282aba;};'use strict';var _=require(_0x8217('0x0'));var util=require(_0x8217('0x1'));var logger=require(_0x8217('0x2'))(_0x8217('0x3'));var moment=require(_0x8217('0x4'));var BPromise=require(_0x8217('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8217('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8217('0x7'));module['exports']=function(_0x53c71b,_0x575e4c){return _0x53c71b['define'](_0x8217('0x8'),attributes,{'tableName':_0x8217('0x9'),'paranoid':![],'indexes':[{'name':_0x8217('0xa'),'fields':[_0x8217('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x252c=['rimraf','../../config/environment','exports','define','WhatsappTransferReport','uniqueid','util','../../config/logger','bluebird','path'];(function(_0x3ad355,_0x3ecbd9){var _0x453dd2=function(_0x195aed){while(--_0x195aed){_0x3ad355['push'](_0x3ad355['shift']());}};_0x453dd2(++_0x3ecbd9);}(_0x252c,0x9c));var _0xc252=function(_0xae125,_0x117cd9){_0xae125=_0xae125-0x0;var _0x28f50a=_0x252c[_0xae125];return _0x28f50a;};'use strict';var _=require('lodash');var util=require(_0xc252('0x0'));var logger=require(_0xc252('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc252('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc252('0x3'));var rimraf=require(_0xc252('0x4'));var config=require(_0xc252('0x5'));var attributes=require('./whatsappTransferReport.attributes');module[_0xc252('0x6')]=function(_0x4acf91,_0x498c80){return _0x4acf91[_0xc252('0x7')](_0xc252('0x8'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xc252('0x9'),'fields':[_0xc252('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 66ab0a3..690f4db 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 _0xa9e0=['http','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\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(_0x18dbae,_0x4db149){var _0x49add9=function(_0x385631){while(--_0x385631){_0x18dbae['push'](_0x18dbae['shift']());}};_0x49add9(++_0x4db149);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\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(_0x493905,_0x52ad25){var _0x13baef=function(_0x286cdc){while(--_0x286cdc){_0x493905['push'](_0x493905['shift']());}};_0x13baef(++_0x52ad25);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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/app.js b/server/app.js index 7a79627..d26b231 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0adf=['join','seedDB','./config/seedDB','default','./config/license','error','exit','lodash','./mysqldb','./rpc','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sequelize','then','listen','info','start','Online\x20apps:','map','online','name','status'];(function(_0x2e1d7c,_0x1742f0){var _0x4508b9=function(_0x1e6442){while(--_0x1e6442){_0x2e1d7c['push'](_0x2e1d7c['shift']());}};_0x4508b9(++_0x1742f0);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x42bba9,_0x5aff7c){_0x42bba9=_0x42bba9-0x0;var _0x2074d3=_0x0adf[_0x42bba9];return _0x2074d3;};'use strict';var _=require(_0xf0ad('0x0'));var mysqldb=require(_0xf0ad('0x1'));var rpc=require(_0xf0ad('0x2'));var config=require('./config/environment');var logger=require(_0xf0ad('0x3'))(_0xf0ad('0x4'));var pm2=require(_0xf0ad('0x5'));var pm2Config=require(_0xf0ad('0x6'));var schedule=require(_0xf0ad('0x7'));var chat=require(_0xf0ad('0x8'));var whatsapp=require(_0xf0ad('0x9'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0xf0ad('0xa')]['sync']()[_0xf0ad('0xb')](function(){return rpc[_0xf0ad('0xc')]();})[_0xf0ad('0xb')](function(_0x41c99d){logger[_0xf0ad('0xd')](_0x41c99d);return chat[_0xf0ad('0xe')]();})[_0xf0ad('0xb')](function(){return whatsapp['start']();})[_0xf0ad('0xb')](function(){return schedule['start']();})[_0xf0ad('0xb')](function(){return transcribe[_0xf0ad('0xe')]();})[_0xf0ad('0xb')](function(_0x2a5d0e){logger[_0xf0ad('0xd')](_0x2a5d0e);return pm2['start'](pm2Config);})['then'](function(_0x13ed94){logger[_0xf0ad('0xd')](_0xf0ad('0xf'),_[_0xf0ad('0x10')](_['filter'](_0x13ed94,{'status':_0xf0ad('0x11')}),_0xf0ad('0x12'))['join']());logger['info']('Offline\x20apps:',_[_0xf0ad('0x10')](_['filter'](_0x13ed94,function(_0x1dad7b){return _0x1dad7b[_0xf0ad('0x13')]!==_0xf0ad('0x11');}),_0xf0ad('0x12'))[_0xf0ad('0x14')]()||'None');config[_0xf0ad('0x15')]&&require(_0xf0ad('0x16'))[_0xf0ad('0x17')]();require(_0xf0ad('0x18'))['default']();})['catch'](function(_0x2466e8){logger[_0xf0ad('0x19')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x2466e8);process[_0xf0ad('0x1a')](0x1);});}main(); \ No newline at end of file +var _0xb515=['sequelize','sync','then','listen','info','start','Online\x20apps:','map','filter','online','join','Offline\x20apps:','status','name','None','seedDB','default','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe'];(function(_0x5aa904,_0x12830d){var _0x126b20=function(_0x50193d){while(--_0x50193d){_0x5aa904['push'](_0x5aa904['shift']());}};_0x126b20(++_0x12830d);}(_0xb515,0x1b8));var _0x5b51=function(_0xed5f9c,_0x5a25cd){_0xed5f9c=_0xed5f9c-0x0;var _0x3a1c43=_0xb515[_0xed5f9c];return _0x3a1c43;};'use strict';var _=require(_0x5b51('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x5b51('0x1'));var config=require(_0x5b51('0x2'));var logger=require(_0x5b51('0x3'))(_0x5b51('0x4'));var pm2=require(_0x5b51('0x5'));var pm2Config=require(_0x5b51('0x6'));var schedule=require(_0x5b51('0x7'));var chat=require(_0x5b51('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x5b51('0x9'));function main(){return mysqldb['db'][_0x5b51('0xa')][_0x5b51('0xb')]()[_0x5b51('0xc')](function(){return rpc[_0x5b51('0xd')]();})[_0x5b51('0xc')](function(_0x1d5082){logger[_0x5b51('0xe')](_0x1d5082);return chat[_0x5b51('0xf')]();})[_0x5b51('0xc')](function(){return whatsapp[_0x5b51('0xf')]();})[_0x5b51('0xc')](function(){return schedule['start']();})[_0x5b51('0xc')](function(){return transcribe[_0x5b51('0xf')]();})[_0x5b51('0xc')](function(_0x172a62){logger[_0x5b51('0xe')](_0x172a62);return pm2[_0x5b51('0xf')](pm2Config);})['then'](function(_0x52e25a){logger['info'](_0x5b51('0x10'),_[_0x5b51('0x11')](_[_0x5b51('0x12')](_0x52e25a,{'status':_0x5b51('0x13')}),'name')[_0x5b51('0x14')]());logger[_0x5b51('0xe')](_0x5b51('0x15'),_[_0x5b51('0x11')](_[_0x5b51('0x12')](_0x52e25a,function(_0x1b45f6){return _0x1b45f6[_0x5b51('0x16')]!==_0x5b51('0x13');}),_0x5b51('0x17'))[_0x5b51('0x14')]()||_0x5b51('0x18'));config[_0x5b51('0x19')]&&require('./config/seedDB')[_0x5b51('0x1a')]();require('./config/license')['default']();})[_0x5b51('0x1b')](function(_0x2142ad){logger['error'](_0x5b51('0x1c'),_0x2142ad);process[_0x5b51('0x1d')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index cd6653f..f2398dd 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 _0xdaf1=['isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blocked','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','validatePasswordHistory','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.','Sequelize','ValidationError','length','splice','unshift','join','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session','role','fullname','internal','email','userpic','md5secret','voicePause','chatPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','allowmessenger','alias','phoneBarAutoAnswer','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','settingsEnabled','isChatInteractionAuthorized','isAuthenticated','user','findOne','params','closed','then','status','disposition','unmanaged','Forbidden.','catch','use','headers','authorization','startsWith','Basic','name','Wrong\x20credentials.','Bearer','json','Unknown\x20authorization\x20format','getUuid','query','apikey','User','find','sub','allowedLoginAttempts','blockDuration'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdaf1,0x125));var _0x1daf=function(_0x47f7ba,_0x426b54){_0x47f7ba=_0x47f7ba-0x0;var _0xc8e7c1=_0xdaf1[_0x47f7ba];return _0xc8e7c1;};'use strict';var db=require(_0x1daf('0x0'))['db'];var config=require(_0x1daf('0x1'));var hardwareConf=require(_0x1daf('0x2'));var licenseUtil=require(_0x1daf('0x3'));var encryptor=require(_0x1daf('0x4'));var _=require(_0x1daf('0x5'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x1daf('0x6'));var compose=require(_0x1daf('0x7'));var basicAuth=require(_0x1daf('0x8'));var crypto=require('crypto');var BPromise=require(_0x1daf('0x9'));var util=require(_0x1daf('0xa'));var moment=require(_0x1daf('0xb'));var validateJwt=expressJwt({'secret':config[_0x1daf('0xc')][_0x1daf('0xd')]});var userAttributes=['id',_0x1daf('0xe'),_0x1daf('0xf'),'name',_0x1daf('0x10'),_0x1daf('0x11'),_0x1daf('0x12'),'permissions',_0x1daf('0x13'),_0x1daf('0x14'),_0x1daf('0x15'),'mailPause',_0x1daf('0x16'),'smsPause',_0x1daf('0x17'),_0x1daf('0x18'),_0x1daf('0x19'),_0x1daf('0x1a'),'lastPauseAt','crudPermissions',_0x1daf('0x1b'),'passwordResetAt',_0x1daf('0x1c'),_0x1daf('0x1d'),'phoneBarAutoAnswerDelay','phoneBarDnd',_0x1daf('0x1e'),_0x1daf('0x1f'),_0x1daf('0x20'),_0x1daf('0x21'),_0x1daf('0x22'),_0x1daf('0x23'),_0x1daf('0x24'),_0x1daf('0x25'),'interface',_0x1daf('0x26'),_0x1daf('0x27')];exports[_0x1daf('0x28')]=function(){return this[_0x1daf('0x29')](!![])['use'](function(_0x2a0e01,_0xaadf9c,_0x5b8930){if(_0x2a0e01[_0x1daf('0x2a')]){_0x5b8930();}else{return db['ChatInteraction'][_0x1daf('0x2b')]({'where':{'id':_0x2a0e01[_0x1daf('0x2c')]['id']},'attributes':['id',_0x1daf('0x2d'),'disposition'],'raw':!![]})[_0x1daf('0x2e')](function(_0x1c83d1){if(_0x1c83d1&&_0x1c83d1[_0x1daf('0x2d')]){return _0xaadf9c[_0x1daf('0x2f')](_0x1c83d1[_0x1daf('0x30')]===_0x1daf('0x31')?0x195:0x193)['json']({'message':_0x1c83d1[_0x1daf('0x30')]===_0x1daf('0x31')?'Unmanaged.':_0x1daf('0x32')});}else{_0x5b8930();}})[_0x1daf('0x33')](function(_0x204987){_0x5b8930(_0x204987);});}});};exports[_0x1daf('0x29')]=function isAuthenticated(_0x328d77){return compose()[_0x1daf('0x34')](function(_0x2723e4,_0x4e6699,_0x23bc72){var _0x1b3acc;if(_0x2723e4[_0x1daf('0x35')][_0x1daf('0x36')]){if(_[_0x1daf('0x37')](_0x2723e4[_0x1daf('0x35')]['authorization'],_0x1daf('0x38'))){var _0xb22170=basicAuth(_0x2723e4);db['User']['find']({'where':{'name':_0xb22170[_0x1daf('0x39')]}})['then'](function(_0xe0df6a){if(!_0xe0df6a||!_0xe0df6a['authenticate'](_0xb22170['pass'])){return _0x4e6699[_0x1daf('0x2f')](0x191)['json']({'message':_0x1daf('0x3a')});}_0x2723e4[_0x1daf('0x2a')]={'id':_0xe0df6a['id']};_0x23bc72();})[_0x1daf('0x33')](function(_0x5818bf){_0x23bc72(_0x5818bf);});}else if(_[_0x1daf('0x37')](_0x2723e4[_0x1daf('0x35')][_0x1daf('0x36')],_0x1daf('0x3b'))){validateJwt(_0x2723e4,_0x4e6699,_0x23bc72);}else{if(_0x328d77){_0x23bc72();}else{return _0x4e6699['status'](0x193)[_0x1daf('0x3c')]({'message':_0x1daf('0x3d')});}}}else if(_0x2723e4['query']['apikey']){try{var _0xf0950b={'audience':hardwareConf[_0x1daf('0x3e')](),'issuer':hardwareConf[_0x1daf('0x3e')]()};verifyJwt(_0x2723e4[_0x1daf('0x3f')][_0x1daf('0x40')],_0xf0950b)[_0x1daf('0x2e')](function(_0x59a40a){return db[_0x1daf('0x41')][_0x1daf('0x42')]({'where':{'id':_0x59a40a[_0x1daf('0x43')]}})[_0x1daf('0x2e')](function(_0x4f0ad1){_0x1b3acc=_0x4f0ad1;return db['Setting'][_0x1daf('0x2b')]({'where':{'id':0x1},'attributes':[_0x1daf('0x44'),_0x1daf('0x45')],'raw':!![]});})[_0x1daf('0x2e')](function(_0x34e2b9){if(!_0x1b3acc||!_[_0x1daf('0x46')](_0x1b3acc[_0x1daf('0x47')],_0x59a40a[_0x1daf('0x48')])){return _0x4e6699[_0x1daf('0x2f')](0x191)[_0x1daf('0x3c')]({'message':_0x1daf('0x49')});}if(_0x1b3acc['disabled']){return _0x4e6699[_0x1daf('0x2f')](0x191)[_0x1daf('0x3c')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x1b3acc[_0x1daf('0x4a')]){if(_0x34e2b9[_0x1daf('0x45')]>0x0){if(moment(_0x1b3acc['blockedAt'])[_0x1daf('0x4b')](_0x34e2b9[_0x1daf('0x45')],_0x1daf('0x4c'))>moment()){return _0x4e6699[_0x1daf('0x2f')](0x191)['json']({'message':_0x1daf('0x4d')});}}else{return _0x4e6699[_0x1daf('0x2f')](0x191)[_0x1daf('0x3c')]({'message':_0x1daf('0x4d')});}}_0x2723e4[_0x1daf('0x2a')]={'id':_0x1b3acc['id']};_0x23bc72();});})['catch'](function(){return _0x4e6699['status'](0x191)[_0x1daf('0x3c')]({'message':_0x1daf('0x4d')});});}catch(_0x55aeff){_0x23bc72(_0x55aeff);}}else if(_0x328d77){_0x23bc72();}else{return _0x4e6699['status'](0x193)[_0x1daf('0x3c')]({'message':_0x1daf('0x3d')});}})['use'](function(_0x500f30,_0x15adf2,_0xeed018){if(_0x500f30[_0x1daf('0x2a')]){db[_0x1daf('0x41')][_0x1daf('0x42')]({'where':{'id':_0x500f30['user']['id']},'attributes':userAttributes})[_0x1daf('0x2e')](function(_0x4f95d4){if(!_0x4f95d4){return _0x15adf2[_0x1daf('0x2f')](0x194)[_0x1daf('0x3c')]({'message':_0x1daf('0x4e')});}_0x500f30[_0x1daf('0x2a')]=_0x4f95d4;_0xeed018();})[_0x1daf('0x33')](function(_0x159728){_0xeed018(_0x159728);});}else if(_0x328d77){_0xeed018();}else{return _0x15adf2[_0x1daf('0x2f')](0x194)[_0x1daf('0x3c')]({'message':_0x1daf('0x4f')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x1daf('0x34')](function(_0x16d5ab,_0x3fefe1,_0x3770c4){return licenseUtil['getLicense']()[_0x1daf('0x2e')](function(_0x4523ba){if(_0x4523ba['update']){_0x3770c4();}else{return _0x3fefe1['status'](0x193)[_0x1daf('0x3c')]({'message':_0x1daf('0x50')});}})[_0x1daf('0x33')](function(_0x24c36d){_0x3770c4(_0x24c36d);});});};exports[_0x1daf('0x51')]=function(_0x337be2,_0x1ee332,_0xbf1ced){_0x337be2[_0x1daf('0x51')]=!![];return _0xbf1ced();};exports[_0x1daf('0x52')]=function signToken(_0x569538){return signJwt(_0x569538);};exports[_0x1daf('0x53')]=function(_0x14a164,_0x5a1e94){if(!_0x14a164[_0x1daf('0x2a')]){return _0x5a1e94[_0x1daf('0x2f')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x55cfd0={'payload':{'id':_0x14a164[_0x1daf('0x2a')]['id'],'role':_0x14a164[_0x1daf('0x2a')][_0x1daf('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x55cfd0)['then'](function(_0x3d37c0){_0x5a1e94[_0x1daf('0x54')](_0x1daf('0x55'),_0x3d37c0);_0x5a1e94[_0x1daf('0x56')](_0x1daf('0x57'));})[_0x1daf('0x33')](function(_0x486f9f){return _0x5a1e94['status'](0x1f4)[_0x1daf('0x58')](_0x486f9f);});};exports[_0x1daf('0x59')]=function(_0x4286b1){if(_[_0x1daf('0x5a')](_0x4286b1[_0x1daf('0x47')])||_[_0x1daf('0x5a')](_0x4286b1['apiKeyIat'])){return null;}else{return createJwt(_0x4286b1);}};exports['generateApiKey']=function(_0x41b7f4){_0x41b7f4[_0x1daf('0x47')]=generateNonce();_0x41b7f4[_0x1daf('0x5b')]=generateIssuedAt();return createJwt(_0x41b7f4);};exports[_0x1daf('0x5c')]=function(_0x10504a,_0x19dc09){var _0x1d2f7d=_0x10504a[_0x1daf('0x3f')][_0x1daf('0x40')];if(_0x1d2f7d){var _0x3219ae={'nonce':_0x19dc09[_0x1daf('0x47')],'iat':_0x19dc09['apiKeyIat'],'audience':hardwareConf[_0x1daf('0x3e')](),'issuer':hardwareConf[_0x1daf('0x3e')]()};return verifyJwt(_0x1d2f7d,_0x3219ae)[_0x1daf('0x2e')](function(){return generateApiKey(_0x19dc09);});}else{throw{'message':_0x1daf('0x5d')};}};exports[_0x1daf('0x5e')]=function(_0x922ec2){var _0x4affc8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x4affc8[_0x1daf('0x5f')](_0x922ec2))throw new db['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~!@#$%^&-_=+[{]}.');return;};exports[_0x1daf('0x60')]=function(_0x2f4300,_0x4ba7c9,_0x284e94){var _0x2ce79b=encryptor[_0x1daf('0x61')](_0x4ba7c9)[_0x1daf('0x62')](',');for(var _0x3c0ae2=0x0;_0x3c0ae2<_0x284e94;_0x3c0ae2++){if(!_0x2ce79b[_0x3c0ae2])break;if(_0x2f4300[_0x1daf('0x63')]()===_0x2ce79b[_0x3c0ae2][_0x1daf('0x63')]()){var _0x4a00b7=util[_0x1daf('0x64')](_0x1daf('0x65'),_0x284e94);if(_0x284e94===0x1){_0x4a00b7=_0x1daf('0x66');}throw new db[(_0x1daf('0x67'))][(_0x1daf('0x68'))](_0x4a00b7);}}return;};exports['updatePasswordsHistory']=function(_0x23f58f,_0x510ecb){var _0x4d2405=_0x510ecb?encryptor['decryptString'](_0x510ecb)['split'](','):[];if(_0x4d2405[_0x1daf('0x69')]===0x5){_0x4d2405[_0x1daf('0x6a')](-0x1,0x1);}_0x4d2405[_0x1daf('0x6b')](_0x23f58f);return encryptor['encryptString'](_0x4d2405[_0x1daf('0x6c')](','));};function signJwt(_0x296bb2){var _0x179cf7=BPromise[_0x1daf('0x6d')](jwt[_0x1daf('0x6e')],{'context':jwt});var _0x229c36=_0x296bb2[_0x1daf('0x6f')]||config[_0x1daf('0xc')]['session'];return new BPromise(function(_0x3d9ec5,_0x28b5c4){_0x179cf7(_0x296bb2[_0x1daf('0x70')],_0x229c36,_0x296bb2[_0x1daf('0x71')])[_0x1daf('0x2e')](function(_0x504afb){_0x3d9ec5(_0x504afb);})['catch'](function(_0x192fb6){_0x28b5c4(_0x192fb6);});});}function verifyJwt(_0x17c141,_0x3f1785,_0x1dce22){var _0x2b1a30=BPromise[_0x1daf('0x6d')](jwt[_0x1daf('0x72')],{'context':jwt});var _0xc4f022=_0x1dce22||config[_0x1daf('0xc')][_0x1daf('0xd')];return new BPromise(function(_0xb92ed1,_0x47c3c4){_0x2b1a30(_0x17c141,_0xc4f022,_0x3f1785)[_0x1daf('0x2e')](function(_0xf0fedb){_0xb92ed1(_0xf0fedb);})[_0x1daf('0x33')](function(_0x53dbf1){_0x47c3c4(_0x53dbf1);});});}function generateNonce(){return crypto[_0x1daf('0x73')](0x10)[_0x1daf('0x74')](_0x1daf('0x75'));}function generateIssuedAt(){return Math[_0x1daf('0x76')](Date[_0x1daf('0x77')]()/0x3e8)[_0x1daf('0x74')]();}function createJwt(_0x4e20a6){var _0x4a44b2={'payload':{'iat':_0x4e20a6[_0x1daf('0x5b')],'nonce':_0x4e20a6[_0x1daf('0x47')]},'options':{'algorithm':_0x1daf('0x78'),'subject':_0x4e20a6['id'][_0x1daf('0x74')](),'issuer':hardwareConf[_0x1daf('0x3e')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x4a44b2)[_0x1daf('0x2e')](function(_0x5679f9){return{'iat':_0x4e20a6[_0x1daf('0x5b')],'nonce':_0x4e20a6[_0x1daf('0x47')],'token':_0x5679f9};});} \ No newline at end of file +var _0xebaf=['unmanaged','Unmanaged.','authorization','startsWith','Basic','User','authenticate','pass','json','catch','headers','Unknown\x20authorization\x20format','query','getUuid','apikey','find','sub','Setting','allowedLoginAttempts','blockDuration','apiKeyNonce','nonce','disabled','blockedAt','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','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','splice','unshift','encryptString','join','promisify','sign','secrets','payload','options','verify','randomBytes','floor','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','lodash','jsonwebtoken','basic-auth','bluebird','util','moment','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarRemoteControl','hotdesk','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','status'];(function(_0x4e6cc2,_0x21f546){var _0x23f9f6=function(_0x12c879){while(--_0x12c879){_0x4e6cc2['push'](_0x4e6cc2['shift']());}};_0x23f9f6(++_0x21f546);}(_0xebaf,0xb1));var _0xfeba=function(_0x12ac72,_0x28355b){_0x12ac72=_0x12ac72-0x0;var _0xa067b9=_0xebaf[_0x12ac72];return _0xa067b9;};'use strict';var db=require(_0xfeba('0x0'))['db'];var config=require(_0xfeba('0x1'));var hardwareConf=require(_0xfeba('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require('../encryptor');var _=require(_0xfeba('0x3'));var jwt=require(_0xfeba('0x4'));var expressJwt=require('express-jwt');var compose=require('composable-middleware');var basicAuth=require(_0xfeba('0x5'));var crypto=require('crypto');var BPromise=require(_0xfeba('0x6'));var util=require(_0xfeba('0x7'));var moment=require(_0xfeba('0x8'));var validateJwt=expressJwt({'secret':config['secrets'][_0xfeba('0x9')]});var userAttributes=['id',_0xfeba('0xa'),_0xfeba('0xb'),_0xfeba('0xc'),_0xfeba('0xd'),_0xfeba('0xe'),_0xfeba('0xf'),_0xfeba('0x10'),_0xfeba('0x11'),_0xfeba('0x12'),_0xfeba('0x13'),_0xfeba('0x14'),_0xfeba('0x15'),'smsPause','openchannelPause',_0xfeba('0x16'),'showWebBar',_0xfeba('0x17'),_0xfeba('0x18'),_0xfeba('0x19'),_0xfeba('0x1a'),_0xfeba('0x1b'),_0xfeba('0x1c'),_0xfeba('0x1d'),_0xfeba('0x1e'),'phoneBarDnd',_0xfeba('0x1f'),_0xfeba('0x20'),_0xfeba('0x21'),'phoneBarExpires','phoneBarPrefixRequired',_0xfeba('0x22'),'phoneBarRemoteControlPort',_0xfeba('0x23'),'interface',_0xfeba('0x24'),'settingsEnabled'];exports[_0xfeba('0x25')]=function(){return this[_0xfeba('0x26')](!![])[_0xfeba('0x27')](function(_0x4195eb,_0x32d016,_0x1bde7d){if(_0x4195eb[_0xfeba('0x28')]){_0x1bde7d();}else{return db[_0xfeba('0x29')][_0xfeba('0x2a')]({'where':{'id':_0x4195eb['params']['id']},'attributes':['id',_0xfeba('0x2b'),_0xfeba('0x2c')],'raw':!![]})[_0xfeba('0x2d')](function(_0x2b25c9){if(_0x2b25c9&&_0x2b25c9[_0xfeba('0x2b')]){return _0x32d016[_0xfeba('0x2e')](_0x2b25c9[_0xfeba('0x2c')]===_0xfeba('0x2f')?0x195:0x193)['json']({'message':_0x2b25c9[_0xfeba('0x2c')]===_0xfeba('0x2f')?_0xfeba('0x30'):'Forbidden.'});}else{_0x1bde7d();}})['catch'](function(_0x832c5){_0x1bde7d(_0x832c5);});}});};exports[_0xfeba('0x26')]=function isAuthenticated(_0xd20aec){return compose()[_0xfeba('0x27')](function(_0x2faec7,_0x3b0ac6,_0x42531c){var _0x3b50cb;if(_0x2faec7['headers'][_0xfeba('0x31')]){if(_[_0xfeba('0x32')](_0x2faec7['headers'][_0xfeba('0x31')],_0xfeba('0x33'))){var _0x388e74=basicAuth(_0x2faec7);db[_0xfeba('0x34')]['find']({'where':{'name':_0x388e74[_0xfeba('0xc')]}})[_0xfeba('0x2d')](function(_0x59a689){if(!_0x59a689||!_0x59a689[_0xfeba('0x35')](_0x388e74[_0xfeba('0x36')])){return _0x3b0ac6[_0xfeba('0x2e')](0x191)[_0xfeba('0x37')]({'message':'Wrong\x20credentials.'});}_0x2faec7[_0xfeba('0x28')]={'id':_0x59a689['id']};_0x42531c();})[_0xfeba('0x38')](function(_0x5e33fc){_0x42531c(_0x5e33fc);});}else if(_[_0xfeba('0x32')](_0x2faec7[_0xfeba('0x39')][_0xfeba('0x31')],'Bearer')){validateJwt(_0x2faec7,_0x3b0ac6,_0x42531c);}else{if(_0xd20aec){_0x42531c();}else{return _0x3b0ac6[_0xfeba('0x2e')](0x193)[_0xfeba('0x37')]({'message':_0xfeba('0x3a')});}}}else if(_0x2faec7[_0xfeba('0x3b')]['apikey']){try{var _0x354480={'audience':hardwareConf[_0xfeba('0x3c')](),'issuer':hardwareConf[_0xfeba('0x3c')]()};verifyJwt(_0x2faec7[_0xfeba('0x3b')][_0xfeba('0x3d')],_0x354480)[_0xfeba('0x2d')](function(_0x36f8b4){return db[_0xfeba('0x34')][_0xfeba('0x3e')]({'where':{'id':_0x36f8b4[_0xfeba('0x3f')]}})[_0xfeba('0x2d')](function(_0xf83a2e){_0x3b50cb=_0xf83a2e;return db[_0xfeba('0x40')]['findOne']({'where':{'id':0x1},'attributes':[_0xfeba('0x41'),_0xfeba('0x42')],'raw':!![]});})[_0xfeba('0x2d')](function(_0x5a1a1f){if(!_0x3b50cb||!_['isEqual'](_0x3b50cb[_0xfeba('0x43')],_0x36f8b4[_0xfeba('0x44')])){return _0x3b0ac6[_0xfeba('0x2e')](0x191)[_0xfeba('0x37')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x3b50cb[_0xfeba('0x45')]){return _0x3b0ac6[_0xfeba('0x2e')](0x191)[_0xfeba('0x37')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x3b50cb['blocked']){if(_0x5a1a1f[_0xfeba('0x42')]>0x0){if(moment(_0x3b50cb[_0xfeba('0x46')])['add'](_0x5a1a1f[_0xfeba('0x42')],'minutes')>moment()){return _0x3b0ac6['status'](0x191)[_0xfeba('0x37')]({'message':_0xfeba('0x47')});}}else{return _0x3b0ac6[_0xfeba('0x2e')](0x191)[_0xfeba('0x37')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x2faec7['user']={'id':_0x3b50cb['id']};_0x42531c();});})[_0xfeba('0x38')](function(){return _0x3b0ac6[_0xfeba('0x2e')](0x191)[_0xfeba('0x37')]({'message':_0xfeba('0x47')});});}catch(_0x4a4bab){_0x42531c(_0x4a4bab);}}else if(_0xd20aec){_0x42531c();}else{return _0x3b0ac6[_0xfeba('0x2e')](0x193)[_0xfeba('0x37')]({'message':_0xfeba('0x3a')});}})['use'](function(_0x506d5c,_0x366260,_0x473408){if(_0x506d5c[_0xfeba('0x28')]){db[_0xfeba('0x34')][_0xfeba('0x3e')]({'where':{'id':_0x506d5c['user']['id']},'attributes':userAttributes})[_0xfeba('0x2d')](function(_0x63f88a){if(!_0x63f88a){return _0x366260[_0xfeba('0x2e')](0x194)[_0xfeba('0x37')]({'message':_0xfeba('0x48')});}_0x506d5c[_0xfeba('0x28')]=_0x63f88a;_0x473408();})[_0xfeba('0x38')](function(_0x229e34){_0x473408(_0x229e34);});}else if(_0xd20aec){_0x473408();}else{return _0x366260[_0xfeba('0x2e')](0x194)[_0xfeba('0x37')]({'message':_0xfeba('0x49')});}});};exports[_0xfeba('0x4a')]=function canUpdate(){return compose()['use'](function(_0x4576c8,_0xec0521,_0x491b58){return licenseUtil[_0xfeba('0x4b')]()[_0xfeba('0x2d')](function(_0x75d75){if(_0x75d75['update']){_0x491b58();}else{return _0xec0521[_0xfeba('0x2e')](0x193)[_0xfeba('0x37')]({'message':'Forbidden'});}})[_0xfeba('0x38')](function(_0x3f0384){_0x491b58(_0x3f0384);});});};exports[_0xfeba('0x4c')]=function(_0x47312a,_0xa1f42e,_0x7133eb){_0x47312a['isMiddleware']=!![];return _0x7133eb();};exports['signToken']=function signToken(_0xd0af91){return signJwt(_0xd0af91);};exports[_0xfeba('0x4d')]=function(_0x3eb5e6,_0x311db8){if(!_0x3eb5e6['user']){return _0x311db8[_0xfeba('0x2e')](0x194)['json']({'message':_0xfeba('0x4e')});}var _0x51eac4={'payload':{'id':_0x3eb5e6[_0xfeba('0x28')]['id'],'role':_0x3eb5e6[_0xfeba('0x28')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x51eac4)[_0xfeba('0x2d')](function(_0x314c39){_0x311db8[_0xfeba('0x4f')](_0xfeba('0x50'),_0x314c39);_0x311db8['redirect']('/dashboards/general');})[_0xfeba('0x38')](function(_0x48064e){return _0x311db8[_0xfeba('0x2e')](0x1f4)[_0xfeba('0x51')](_0x48064e);});};exports[_0xfeba('0x52')]=function(_0x448c17){if(_[_0xfeba('0x53')](_0x448c17['apiKeyNonce'])||_[_0xfeba('0x53')](_0x448c17[_0xfeba('0x54')])){return null;}else{return createJwt(_0x448c17);}};exports['generateApiKey']=function(_0xc4316c){_0xc4316c['apiKeyNonce']=generateNonce();_0xc4316c[_0xfeba('0x54')]=generateIssuedAt();return createJwt(_0xc4316c);};exports[_0xfeba('0x55')]=function(_0x75e0b0,_0x18eaba){var _0x565f45=_0x75e0b0['query'][_0xfeba('0x3d')];if(_0x565f45){var _0x10d247={'nonce':_0x18eaba[_0xfeba('0x43')],'iat':_0x18eaba['apiKeyIat'],'audience':hardwareConf[_0xfeba('0x3c')](),'issuer':hardwareConf[_0xfeba('0x3c')]()};return verifyJwt(_0x565f45,_0x10d247)[_0xfeba('0x2d')](function(){return generateApiKey(_0x18eaba);});}else{throw{'message':_0xfeba('0x56')};}};exports[_0xfeba('0x57')]=function(_0xd46028){var _0x20e8cc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x20e8cc['test'](_0xd46028))throw new db[(_0xfeba('0x58'))][(_0xfeba('0x59'))]('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[_0xfeba('0x5a')]=function(_0x4c5447,_0x1b3158,_0x55cb7f){var _0x3da3ff=encryptor[_0xfeba('0x5b')](_0x1b3158)[_0xfeba('0x5c')](',');for(var _0x27f73e=0x0;_0x27f73e<_0x55cb7f;_0x27f73e++){if(!_0x3da3ff[_0x27f73e])break;if(_0x4c5447['toLowerCase']()===_0x3da3ff[_0x27f73e][_0xfeba('0x5d')]()){var _0x2218d8=util['format'](_0xfeba('0x5e'),_0x55cb7f);if(_0x55cb7f===0x1){_0x2218d8=_0xfeba('0x5f');}throw new db[(_0xfeba('0x58'))][(_0xfeba('0x59'))](_0x2218d8);}}return;};exports[_0xfeba('0x60')]=function(_0x53974f,_0x417b2a){var _0x208107=_0x417b2a?encryptor[_0xfeba('0x5b')](_0x417b2a)['split'](','):[];if(_0x208107['length']===0x5){_0x208107[_0xfeba('0x61')](-0x1,0x1);}_0x208107[_0xfeba('0x62')](_0x53974f);return encryptor[_0xfeba('0x63')](_0x208107[_0xfeba('0x64')](','));};function signJwt(_0x19f3c8){var _0x5ee91f=BPromise[_0xfeba('0x65')](jwt[_0xfeba('0x66')],{'context':jwt});var _0x208977=_0x19f3c8['secret']||config[_0xfeba('0x67')]['session'];return new BPromise(function(_0x221ce0,_0x107f13){_0x5ee91f(_0x19f3c8[_0xfeba('0x68')],_0x208977,_0x19f3c8[_0xfeba('0x69')])['then'](function(_0x5a2af3){_0x221ce0(_0x5a2af3);})[_0xfeba('0x38')](function(_0x366729){_0x107f13(_0x366729);});});}function verifyJwt(_0x446c95,_0x1b165a,_0x17b460){var _0x3c9cfa=BPromise[_0xfeba('0x65')](jwt[_0xfeba('0x6a')],{'context':jwt});var _0x410540=_0x17b460||config[_0xfeba('0x67')][_0xfeba('0x9')];return new BPromise(function(_0x10c2e1,_0x1f5cd0){_0x3c9cfa(_0x446c95,_0x410540,_0x1b165a)[_0xfeba('0x2d')](function(_0x4918cc){_0x10c2e1(_0x4918cc);})[_0xfeba('0x38')](function(_0x1d26ec){_0x1f5cd0(_0x1d26ec);});});}function generateNonce(){return crypto[_0xfeba('0x6b')](0x10)['toString']('hex');}function generateIssuedAt(){return Math[_0xfeba('0x6c')](Date[_0xfeba('0x6d')]()/0x3e8)[_0xfeba('0x6e')]();}function createJwt(_0x10d9a){var _0x3e1b52={'payload':{'iat':_0x10d9a[_0xfeba('0x54')],'nonce':_0x10d9a[_0xfeba('0x43')]},'options':{'algorithm':_0xfeba('0x6f'),'subject':_0x10d9a['id'][_0xfeba('0x6e')](),'issuer':hardwareConf[_0xfeba('0x3c')](),'audience':hardwareConf[_0xfeba('0x3c')]()}};return signJwt(_0x3e1b52)[_0xfeba('0x2d')](function(_0x5e9d2e){return{'iat':_0x10d9a[_0xfeba('0x54')],'nonce':_0x10d9a[_0xfeba('0x43')],'token':_0x5e9d2e};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 263892a..bb1c277 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 _0xdc97=['utf8','base64','decryptString','crypto','bluebird','../../config/environment','session','aes192','hasOwnProperty','createWriteStream','createCipher','algorithm','data','end','binary','write','close','decryptFile','createDecipher','update','final','unlink','encryptString','secret'];(function(_0x226ad1,_0x2858e2){var _0x16b625=function(_0x4dc555){while(--_0x4dc555){_0x226ad1['push'](_0x226ad1['shift']());}};_0x16b625(++_0x2858e2);}(_0xdc97,0x13b));var _0x7dc9=function(_0x1bac43,_0x41c983){_0x1bac43=_0x1bac43-0x0;var _0x245ba6=_0xdc97[_0x1bac43];return _0x245ba6;};'use strict';var crypto=require(_0x7dc9('0x0'));var fs=require('fs');var BPromise=require(_0x7dc9('0x1'));var config=require(_0x7dc9('0x2'));const stringOptions={'secret':config['secrets'][_0x7dc9('0x3')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x7dc9('0x4')};function combineOptions(_0x2b86da){var _0x478a95={};for(var _0x2a77c1 in fileOptions){if(fileOptions[_0x7dc9('0x5')](_0x2a77c1)){_0x478a95[_0x2a77c1]=fileOptions[_0x2a77c1];}}if(_0x2b86da){for(var _0xb15a0b in _0x2b86da){if(_0x2b86da[_0x7dc9('0x5')](_0xb15a0b)){_0x478a95[_0xb15a0b]=_0x2b86da[_0xb15a0b];}}}return _0x478a95;}exports['encryptFile']=function(_0x2636ef,_0x4f91c7,_0x4b3229,_0x2ff923){return new BPromise(function(_0x23737d,_0x3318ea){_0x2ff923=combineOptions(_0x2ff923);var _0x42ec7c=new Buffer(_0x4b3229);var _0x3dd07e=fs['createReadStream'](_0x2636ef);var _0xb2fa2a=fs[_0x7dc9('0x6')](_0x4f91c7);var _0x37dfc=crypto[_0x7dc9('0x7')](_0x2ff923[_0x7dc9('0x8')],_0x42ec7c);_0x3dd07e['on'](_0x7dc9('0x9'),function(_0x1e336a){var _0x4e8e65=new Buffer(_0x37dfc['update'](_0x1e336a),'binary');_0xb2fa2a['write'](_0x4e8e65);});_0x3dd07e['on'](_0x7dc9('0xa'),function(){try{var _0x14e5db=new Buffer(_0x37dfc['final'](_0x7dc9('0xb')),_0x7dc9('0xb'));_0xb2fa2a[_0x7dc9('0xc')](_0x14e5db);_0xb2fa2a[_0x7dc9('0xa')]();_0xb2fa2a['on'](_0x7dc9('0xd'),function(){return _0x23737d(_0x4f91c7);});}catch(_0x11af93){fs['unlink'](_0x4f91c7);return _0x3318ea(_0x11af93);}});});};exports[_0x7dc9('0xe')]=function(_0x278191,_0x1b0aa1,_0x442819,_0x11606f){return new BPromise(function(_0xbe0437,_0x45698c){_0x11606f=combineOptions(_0x11606f);var _0x389d36=new Buffer(_0x442819);var _0x4778d5=fs['createReadStream'](_0x278191);var _0x22577e=fs['createWriteStream'](_0x1b0aa1);var _0x1f5906=crypto[_0x7dc9('0xf')](_0x11606f['algorithm'],_0x389d36);_0x4778d5['on'](_0x7dc9('0x9'),function(_0x3b738a){var _0x12f08d=new Buffer(_0x1f5906[_0x7dc9('0x10')](_0x3b738a),_0x7dc9('0xb'));_0x22577e[_0x7dc9('0xc')](_0x12f08d);});_0x4778d5['on'](_0x7dc9('0xa'),function(){try{var _0x2895f5=new Buffer(_0x1f5906[_0x7dc9('0x11')](_0x7dc9('0xb')),'binary');_0x22577e['write'](_0x2895f5);_0x22577e[_0x7dc9('0xa')]();_0x22577e['on'](_0x7dc9('0xd'),function(){return _0xbe0437(_0x1b0aa1);});}catch(_0x596e0f){fs[_0x7dc9('0x12')](_0x1b0aa1);return _0x45698c(_0x596e0f);}});});};exports[_0x7dc9('0x13')]=function(_0x5e9525,_0xffc080,_0x43d31f){var _0x41110a=_0x43d31f||stringOptions['algorithm'];var _0x424763=_0xffc080||stringOptions[_0x7dc9('0x14')];var _0xf95336=crypto['createCipher'](_0x41110a,_0x424763);var _0x48c6bc=_0xf95336['update'](_0x5e9525,_0x7dc9('0x15'),_0x7dc9('0x16'));_0x48c6bc+=_0xf95336['final']('base64');return _0x48c6bc;};exports[_0x7dc9('0x17')]=function(_0x5afb7d,_0x2d22eb,_0x1c690b){var _0x3a74a0=_0x1c690b||stringOptions[_0x7dc9('0x8')];var _0xa2aaa9=_0x2d22eb||stringOptions[_0x7dc9('0x14')];var _0x236d42=crypto[_0x7dc9('0xf')](_0x3a74a0,_0xa2aaa9);var _0x1fcf0e=_0x236d42[_0x7dc9('0x10')](_0x5afb7d,_0x7dc9('0x16'),_0x7dc9('0x15'));_0x1fcf0e+=_0x236d42['final']('utf8');return _0x1fcf0e;}; \ No newline at end of file +var _0x5496=['update','binary','final','write','end','close','unlink','encryptString','secret','createCipher','base64','decryptString','utf8','crypto','bluebird','../../config/environment','secrets','session','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data'];(function(_0x1a4c0b,_0x315038){var _0x24d5c0=function(_0x150ba2){while(--_0x150ba2){_0x1a4c0b['push'](_0x1a4c0b['shift']());}};_0x24d5c0(++_0x315038);}(_0x5496,0x175));var _0x6549=function(_0x1f5383,_0x24b368){_0x1f5383=_0x1f5383-0x0;var _0x533477=_0x5496[_0x1f5383];return _0x533477;};'use strict';var crypto=require(_0x6549('0x0'));var fs=require('fs');var BPromise=require(_0x6549('0x1'));var config=require(_0x6549('0x2'));const stringOptions={'secret':config[_0x6549('0x3')][_0x6549('0x4')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x6549('0x5')};function combineOptions(_0x4de1db){var _0x2d2155={};for(var _0x8112c5 in fileOptions){if(fileOptions[_0x6549('0x6')](_0x8112c5)){_0x2d2155[_0x8112c5]=fileOptions[_0x8112c5];}}if(_0x4de1db){for(var _0x4d0473 in _0x4de1db){if(_0x4de1db['hasOwnProperty'](_0x4d0473)){_0x2d2155[_0x4d0473]=_0x4de1db[_0x4d0473];}}}return _0x2d2155;}exports[_0x6549('0x7')]=function(_0x1d8cea,_0x4fcffd,_0x1ca8fc,_0x3442c3){return new BPromise(function(_0x1ef2a6,_0x5c47ba){_0x3442c3=combineOptions(_0x3442c3);var _0xa12086=new Buffer(_0x1ca8fc);var _0x35d008=fs[_0x6549('0x8')](_0x1d8cea);var _0x135c2c=fs[_0x6549('0x9')](_0x4fcffd);var _0x3e08a6=crypto['createCipher'](_0x3442c3['algorithm'],_0xa12086);_0x35d008['on'](_0x6549('0xa'),function(_0xac828c){var _0x3c5f9b=new Buffer(_0x3e08a6[_0x6549('0xb')](_0xac828c),_0x6549('0xc'));_0x135c2c['write'](_0x3c5f9b);});_0x35d008['on']('end',function(){try{var _0x3f844f=new Buffer(_0x3e08a6[_0x6549('0xd')]('binary'),_0x6549('0xc'));_0x135c2c[_0x6549('0xe')](_0x3f844f);_0x135c2c[_0x6549('0xf')]();_0x135c2c['on'](_0x6549('0x10'),function(){return _0x1ef2a6(_0x4fcffd);});}catch(_0xc0e859){fs[_0x6549('0x11')](_0x4fcffd);return _0x5c47ba(_0xc0e859);}});});};exports['decryptFile']=function(_0x5db86d,_0x384f75,_0x25da29,_0x47a81a){return new BPromise(function(_0x238a04,_0x67acc0){_0x47a81a=combineOptions(_0x47a81a);var _0x4608fb=new Buffer(_0x25da29);var _0x387e60=fs[_0x6549('0x8')](_0x5db86d);var _0x53b12b=fs['createWriteStream'](_0x384f75);var _0x26a212=crypto['createDecipher'](_0x47a81a['algorithm'],_0x4608fb);_0x387e60['on'](_0x6549('0xa'),function(_0x1e5079){var _0x19c4a6=new Buffer(_0x26a212[_0x6549('0xb')](_0x1e5079),_0x6549('0xc'));_0x53b12b['write'](_0x19c4a6);});_0x387e60['on'](_0x6549('0xf'),function(){try{var _0x4b40c1=new Buffer(_0x26a212[_0x6549('0xd')](_0x6549('0xc')),_0x6549('0xc'));_0x53b12b[_0x6549('0xe')](_0x4b40c1);_0x53b12b[_0x6549('0xf')]();_0x53b12b['on'](_0x6549('0x10'),function(){return _0x238a04(_0x384f75);});}catch(_0x427b47){fs[_0x6549('0x11')](_0x384f75);return _0x67acc0(_0x427b47);}});});};exports[_0x6549('0x12')]=function(_0x6ae00c,_0x40d3f9,_0x1fbfa4){var _0x23c0ba=_0x1fbfa4||stringOptions['algorithm'];var _0x30404e=_0x40d3f9||stringOptions[_0x6549('0x13')];var _0x53bbca=crypto[_0x6549('0x14')](_0x23c0ba,_0x30404e);var _0x29f89e=_0x53bbca[_0x6549('0xb')](_0x6ae00c,'utf8',_0x6549('0x15'));_0x29f89e+=_0x53bbca[_0x6549('0xd')](_0x6549('0x15'));return _0x29f89e;};exports[_0x6549('0x16')]=function(_0x442862,_0x3edf02,_0x2f58f7){var _0xa6c718=_0x2f58f7||stringOptions['algorithm'];var _0x1794bc=_0x3edf02||stringOptions[_0x6549('0x13')];var _0x17fdfb=crypto['createDecipher'](_0xa6c718,_0x1794bc);var _0x3f1502=_0x17fdfb['update'](_0x442862,'base64','utf8');_0x3f1502+=_0x17fdfb[_0x6549('0xd')](_0x6549('0x17'));return _0x3f1502;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 2197928..4ef9db5 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 _0xb4e6=['splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','split','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','length','existsSync','mkdirSync','join','each','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','CSV','inspect','Failed','util','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find'];(function(_0x41ed0b,_0x224822){var _0x4737dd=function(_0x41978a){while(--_0x41978a){_0x41ed0b['push'](_0x41ed0b['shift']());}};_0x4737dd(++_0x224822);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x34b87f,_0x28aef2){_0x34b87f=_0x34b87f-0x0;var _0x449805=_0xb4e6[_0x34b87f];return _0x449805;};'use strict';var util=require(_0x6b4e('0x0'));var path=require('path');var _=require(_0x6b4e('0x1'));var csv=require(_0x6b4e('0x2'));var fs=require('fs');var BPromise=require(_0x6b4e('0x3'));var zipdir=require(_0x6b4e('0x4'));var rimraf=require(_0x6b4e('0x5'));var db=require(_0x6b4e('0x6'))['db'];var dbH=require(_0x6b4e('0x6'))['dbH'];var logger=require(_0x6b4e('0x7'))(_0x6b4e('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x6b4e('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x6b4e('0x9')][0x4];function analyticExtractedReport(_0x570346,_0x4f00be){var _0x2311d9={'status':_0x570346};var _0x48c870={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4f00be){_0x2311d9['savename']=_0x4f00be;}return db[_0x6b4e('0xa')][_0x6b4e('0xb')](_0x2311d9,_0x48c870);}function main(){var _0x1e3bf6=0x1388;var _0x39ed74;logger[_0x6b4e('0xc')](util[_0x6b4e('0xd')](_0x6b4e('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db[_0x6b4e('0xf')][_0x6b4e('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x6b4e('0x11')]})[_0x6b4e('0x12')](function(_0x432399){if(_0x432399){_0x39ed74=_0x432399;_0x1e3bf6=_0x39ed74[_0x6b4e('0x11')]||0x1388;}})[_0x6b4e('0x12')](function(){return dbH[_0x6b4e('0x13')][_0x6b4e('0x14')](util['format'](_0x6b4e('0x15'),QUERY),{'type':dbH[_0x6b4e('0x13')]['QueryTypes'][_0x6b4e('0x16')]});})['then'](function(_0x355f10){if(!_0x355f10[0x0][_0x6b4e('0x17')]){return analyticExtractedReport(_0x6b4e('0x18'));}var _0x42e265=[];var _0x28c3ba=0x0;var _0x135568=!![];if(_0x355f10&&_0x355f10['length']){var _0x5775f4=_0x355f10[0x0][_0x6b4e('0x17')]%(_0x28c3ba+_0x1e3bf6);if(_0x39ed74[_0x6b4e('0x19')]){for(;_0x135568;_0x28c3ba+=_0x1e3bf6,_0x5775f4=_0x355f10[0x0][_0x6b4e('0x17')]%(_0x28c3ba+_0x1e3bf6)){if(_0x5775f4==0x0||_0x5775f4==_0x355f10[0x0][_0x6b4e('0x17')]){_0x135568=![];}_0x42e265[_0x6b4e('0x1a')](dbH[_0x6b4e('0x13')][_0x6b4e('0x14')](util[_0x6b4e('0xd')](_0x6b4e('0x1b'),QUERY,_0x1e3bf6,_0x28c3ba),{'type':dbH[_0x6b4e('0x13')][_0x6b4e('0x1c')]['SELECT']}));}}else{_0x42e265[_0x6b4e('0x1a')](dbH[_0x6b4e('0x13')][_0x6b4e('0x14')](QUERY,{'type':dbH[_0x6b4e('0x13')]['QueryTypes'][_0x6b4e('0x16')]}));}}var _0x507703=path[_0x6b4e('0x1d')](PATH);var _0x163dea=path[_0x6b4e('0x1e')](PATH,_0x6b4e('0x1f'));var _0xa06ccd=_0x39ed74[_0x6b4e('0x19')]&&_0x42e265[_0x6b4e('0x20')]>0x1;var _0x5c33be=[];if(!fs[_0x6b4e('0x21')](path['join'](_0x507703,_0x163dea))&&_0xa06ccd){fs[_0x6b4e('0x22')](path[_0x6b4e('0x23')](_0x507703,_0x163dea));}return BPromise[_0x6b4e('0x24')](_0x42e265,function(_0xdba4fe){_0x5c33be['push'](_0xdba4fe);})[_0x6b4e('0x12')](function(){for(var _0x3f72d7=0x0;_0x3f72d7<_0x5c33be['length'];_0x3f72d7+=0x1){var _0x32102f;var _0x381ff0=_0x5c33be[_0x3f72d7];if(_0xa06ccd){_0x32102f=path[_0x6b4e('0x23')](_0x507703,_0x163dea,util[_0x6b4e('0xd')]('%s%d.%s',_0x163dea,_0x3f72d7,_0x6b4e('0x25')));}else{_0x32102f=path[_0x6b4e('0x23')](_0x507703,util['format'](_0x6b4e('0x26'),_0x163dea,_0x6b4e('0x25')));}fs[_0x6b4e('0x27')](_0x32102f,csv(_0x381ff0));}})[_0x6b4e('0x12')](function(){if(_0xa06ccd){zipdir(path['join'](_0x507703,_0x163dea),{'saveTo':path[_0x6b4e('0x23')](_0x507703,util[_0x6b4e('0xd')]('%s.%s',_0x163dea,_0x6b4e('0x28')))},function(_0x3f9868,_0x37b636){});rimraf(path['join'](_0x507703,_0x163dea),function(){});}})['then'](function(){logger[_0x6b4e('0xc')](util[_0x6b4e('0xd')](_0x6b4e('0x29'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x6b4e('0x2a'),_0xa06ccd?util[_0x6b4e('0xd')](_0x6b4e('0x26'),_0x163dea,_0xa06ccd?'zip':'csv'):null);});})[_0x6b4e('0x2b')](function(_0x4952ef){logger[_0x6b4e('0xc')](util[_0x6b4e('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6b4e('0x2c')),util[_0x6b4e('0x2d')](_0x4952ef,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x6b4e('0x2e'));});}main(); \ No newline at end of file +var _0xf109=['Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','util','path','lodash','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split','splitSizeCsv','then','query','sequelize','QueryTypes','num','length','SELECT','push','basename','.csv','join','mkdirSync','%s%d.%s','csv','%s.%s','writeFileSync'];(function(_0x434ca5,_0x2058fe){var _0x142bf5=function(_0x19c324){while(--_0x19c324){_0x434ca5['push'](_0x434ca5['shift']());}};_0x142bf5(++_0x2058fe);}(_0xf109,0xce));var _0x9f10=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xf109[_0x2070da];return _0x4f9fe1;};'use strict';var util=require(_0x9f10('0x0'));var path=require(_0x9f10('0x1'));var _=require(_0x9f10('0x2'));var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x9f10('0x3'));var db=require(_0x9f10('0x4'))['db'];var dbH=require(_0x9f10('0x4'))[_0x9f10('0x5')];var logger=require(_0x9f10('0x6'))(_0x9f10('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x9f10('0x8')][0x2]);var QUERY=process[_0x9f10('0x8')][0x3];var PATH=process[_0x9f10('0x8')][0x4];function analyticExtractedReport(_0x2a877e,_0x3fd82f){var _0x5c8719={'status':_0x2a877e};var _0x42a8cd={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3fd82f){_0x5c8719[_0x9f10('0x9')]=_0x3fd82f;}return db[_0x9f10('0xa')][_0x9f10('0xb')](_0x5c8719,_0x42a8cd);}function main(){var _0x325f22=0x1388;var _0x5d5f53;logger[_0x9f10('0xc')](util[_0x9f10('0xd')](_0x9f10('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x9f10('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9f10('0x10'),_0x9f10('0x11')]})['then'](function(_0x289164){if(_0x289164){_0x5d5f53=_0x289164;_0x325f22=_0x5d5f53[_0x9f10('0x11')]||0x1388;}})[_0x9f10('0x12')](function(){return dbH['sequelize'][_0x9f10('0x13')](util[_0x9f10('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x9f10('0x14')][_0x9f10('0x15')]['SELECT']});})['then'](function(_0x2b6c4c){if(!_0x2b6c4c[0x0][_0x9f10('0x16')]){return analyticExtractedReport('Empty');}var _0x11154b=[];var _0x5ae255=0x0;var _0x14d3fe=!![];if(_0x2b6c4c&&_0x2b6c4c[_0x9f10('0x17')]){var _0x4b1b8f=_0x2b6c4c[0x0][_0x9f10('0x16')]%(_0x5ae255+_0x325f22);if(_0x5d5f53[_0x9f10('0x10')]){for(;_0x14d3fe;_0x5ae255+=_0x325f22,_0x4b1b8f=_0x2b6c4c[0x0]['num']%(_0x5ae255+_0x325f22)){if(_0x4b1b8f==0x0||_0x4b1b8f==_0x2b6c4c[0x0][_0x9f10('0x16')]){_0x14d3fe=![];}_0x11154b['push'](dbH[_0x9f10('0x14')]['query'](util[_0x9f10('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x325f22,_0x5ae255),{'type':dbH['sequelize'][_0x9f10('0x15')][_0x9f10('0x18')]}));}}else{_0x11154b[_0x9f10('0x19')](dbH[_0x9f10('0x14')][_0x9f10('0x13')](QUERY,{'type':dbH[_0x9f10('0x14')][_0x9f10('0x15')]['SELECT']}));}}var _0x366044=path['dirname'](PATH);var _0x293990=path[_0x9f10('0x1a')](PATH,_0x9f10('0x1b'));var _0x4adbda=_0x5d5f53[_0x9f10('0x10')]&&_0x11154b[_0x9f10('0x17')]>0x1;var _0x213567=[];if(!fs['existsSync'](path[_0x9f10('0x1c')](_0x366044,_0x293990))&&_0x4adbda){fs[_0x9f10('0x1d')](path[_0x9f10('0x1c')](_0x366044,_0x293990));}return BPromise['each'](_0x11154b,function(_0x2ec07d){_0x213567[_0x9f10('0x19')](_0x2ec07d);})[_0x9f10('0x12')](function(){for(var _0x1647c0=0x0;_0x1647c0<_0x213567['length'];_0x1647c0+=0x1){var _0x57539b;var _0x5c1800=_0x213567[_0x1647c0];if(_0x4adbda){_0x57539b=path[_0x9f10('0x1c')](_0x366044,_0x293990,util['format'](_0x9f10('0x1e'),_0x293990,_0x1647c0,_0x9f10('0x1f')));}else{_0x57539b=path[_0x9f10('0x1c')](_0x366044,util[_0x9f10('0xd')](_0x9f10('0x20'),_0x293990,'csv'));}fs[_0x9f10('0x21')](_0x57539b,csv(_0x5c1800));}})[_0x9f10('0x12')](function(){if(_0x4adbda){zipdir(path[_0x9f10('0x1c')](_0x366044,_0x293990),{'saveTo':path[_0x9f10('0x1c')](_0x366044,util[_0x9f10('0xd')](_0x9f10('0x20'),_0x293990,'zip'))},function(_0x358d3f,_0x501ee){});rimraf(path[_0x9f10('0x1c')](_0x366044,_0x293990),function(){});}})[_0x9f10('0x12')](function(){logger['info'](util[_0x9f10('0xd')](_0x9f10('0x22'),EXTRACTED_REPORT_ID,_0x9f10('0x23')));return analyticExtractedReport('Completed',_0x4adbda?util[_0x9f10('0xd')]('%s.%s',_0x293990,_0x4adbda?_0x9f10('0x24'):_0x9f10('0x1f')):null);});})[_0x9f10('0x25')](function(_0x5944e5){logger[_0x9f10('0xc')](util[_0x9f10('0xd')](_0x9f10('0x26'),EXTRACTED_REPORT_ID,_0x9f10('0x23')),util[_0x9f10('0x27')](_0x5944e5,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 0984a4c..cada234 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 _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x402675,_0x4fa7fb){var _0x1b176f=function(_0x73ee8b){while(--_0x73ee8b){_0x402675['push'](_0x402675['shift']());}};_0x1b176f(++_0x4fa7fb);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file +var _0xd8b0=['format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','landscape','black','body','toString','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','pipe','finish','error','log','err','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','lodash','bluebird','pdfmake/src/printer','zip-dir','rimraf','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','splitSizePdf','then','length','push','sequelize','query'];(function(_0x3fc3c2,_0x18d8f5){var _0x12f83e=function(_0x16530e){while(--_0x16530e){_0x3fc3c2['push'](_0x3fc3c2['shift']());}};_0x12f83e(++_0x18d8f5);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var fs=require('fs');var BPromise=require(_0x0d8b('0x1'));var util=require('util');var path=require('path');var moment=require('moment');var PdfPrinter=require(_0x0d8b('0x2'));var zipdir=require(_0x0d8b('0x3'));var rimraf=require(_0x0d8b('0x4'));var db=require(_0x0d8b('0x5'))['db'];var dbH=require(_0x0d8b('0x5'))['dbH'];var logger=require('../../config/logger')(_0x0d8b('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x0d8b('0x7')][0x2]);var QUERY=process[_0x0d8b('0x7')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x0d8b('0x7')][0x5];var FORMAT=_0x0d8b('0x8');var _extractedReport;function analyticExtractedReport(_0x58e4e2,_0x129310){var _0x348e65={'status':_0x58e4e2};var _0x3b027f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x129310){_0x348e65[_0x0d8b('0x9')]=_0x129310;}return db[_0x0d8b('0xa')][_0x0d8b('0xb')](_0x348e65,_0x3b027f);}function getHeader(_0x2c5e9e){var _0x28f87c=[];for(var _0x48fa16 in _0x2c5e9e){if(_0x2c5e9e[_0x0d8b('0xc')](_0x48fa16)){_0x28f87c['push']({'text':_0x48fa16,'style':_0x0d8b('0xd')});}}return _0x28f87c;}function extractReport(_0xc574a3){var _0x340cc4=0x1388;var _0x92cdd8;if(!_0xc574a3[0x0][_0x0d8b('0xe')]){return analyticExtractedReport(_0x0d8b('0xf'));}var _0x15dd0f=[];var _0x31a8cc=0x0;var _0x1d4bbc=!![];var _0x2ce75e=path[_0x0d8b('0x10')](PATH);var _0xe65334=path[_0x0d8b('0x11')](PATH,_0x0d8b('0x12'));var _0x4f6f21=![];var _0x23eb7b=[];return db[_0x0d8b('0x13')][_0x0d8b('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0d8b('0x15'),_0x0d8b('0x16')]})['then'](function(_0x106a01){if(_0x106a01){_0x92cdd8=_0x106a01;_0x340cc4=_0x92cdd8[_0x0d8b('0x16')]||0x3e8;}})[_0x0d8b('0x17')](function(){if(_0xc574a3&&_0xc574a3[_0x0d8b('0x18')]){var _0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4);if(_0x92cdd8[_0x0d8b('0x15')]){for(;_0x1d4bbc;_0x31a8cc+=_0x340cc4,_0x333674=_0xc574a3[0x0][_0x0d8b('0xe')]%(_0x31a8cc+_0x340cc4)){if(_0x333674==0x0||_0x333674==_0xc574a3[0x0]['num']){_0x1d4bbc=![];}_0x15dd0f[_0x0d8b('0x19')](dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')](_0x0d8b('0x1d'),QUERY,_0x340cc4,_0x31a8cc),{'type':dbH[_0x0d8b('0x1a')][_0x0d8b('0x1e')][_0x0d8b('0x1f')]}));}}else{_0x15dd0f['push'](dbH['sequelize'][_0x0d8b('0x1b')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}_0x4f6f21=_0x92cdd8[_0x0d8b('0x15')]&&_0x15dd0f[_0x0d8b('0x18')]>0x1;if(!fs[_0x0d8b('0x20')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334))&&_0x4f6f21){fs[_0x0d8b('0x22')](path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334));}return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4562cb){_0x23eb7b[_0x0d8b('0x19')](_0x4562cb);});})['then'](function(){return BPromise[_0x0d8b('0x23')](_0x15dd0f,function(_0x4463ee,_0x5363e3){var _0xe1ef20;var _0x4a0ae4=util[_0x0d8b('0x1c')](_0x0d8b('0x24'),NAME,_extractedReport[_0x0d8b('0x25')],moment(_extractedReport['startDate'])['format'](FORMAT),moment(_extractedReport[_0x0d8b('0x26')])[_0x0d8b('0x1c')](FORMAT));var _0x4c05ee={'pageSize':'A4','pageOrientation':_0x0d8b('0x27'),'content':[{'text':_0x4a0ae4,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x0d8b('0x28')}}};var _0x4b59e5={'headerRows':0x1,'body':[]};_0x4b59e5[_0x0d8b('0x29')]['push'](getHeader(_0x4463ee[0x0]));var _0x2ab00d;for(var _0x546bf6=0x0;_0x546bf6<_0x4463ee[_0x0d8b('0x18')];_0x546bf6+=0x1){_0x2ab00d=[];for(var _0x544735 in _0x4463ee[_0x546bf6]){if(_0x4463ee[_0x546bf6][_0x0d8b('0xc')](_0x544735)){_0x2ab00d[_0x0d8b('0x19')](_0x4463ee[_0x546bf6][_0x544735]?_[_0x0d8b('0x2a')](_0x4463ee[_0x546bf6][_0x544735]):'');}}_0x4b59e5['body']['push'](_0x2ab00d);}_0x4c05ee['content'][_0x0d8b('0x19')]({'table':_0x4b59e5});return new BPromise(function(_0x5515d2,_0x3cdf3c){var _0x54f6f3=new PdfPrinter({'Roboto':{'normal':__dirname+'/fonts/Roboto-Regular.ttf','bold':__dirname+_0x0d8b('0x2b'),'italics':__dirname+_0x0d8b('0x2c'),'bolditalics':__dirname+_0x0d8b('0x2d')}});var _0xdeee5d=_0x54f6f3[_0x0d8b('0x2e')](_0x4c05ee);if(_0x4f6f21){_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334,util[_0x0d8b('0x1c')](_0x0d8b('0x2f'),_0xe65334,_0x5363e3,'pdf'));}else{_0xe1ef20=path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')]('%s.%s',_0xe65334,_0x0d8b('0x30')));}var _0x23f7f6=_0xdeee5d[_0x0d8b('0x31')](fs['createWriteStream'](_0xe1ef20));_0x23f7f6['on'](_0x0d8b('0x32'),function(){_0x5515d2();});_0x23f7f6['on'](_0x0d8b('0x33'),function(_0x206157){console[_0x0d8b('0x34')](_0x0d8b('0x35'),_0x206157);_0x3cdf3c(_0x206157);});_0xdeee5d['end']();});});})[_0x0d8b('0x17')](function(){if(_0x4f6f21){return new BPromise(function(_0x1649fc,_0x5ad0fe){zipdir(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),{'saveTo':path[_0x0d8b('0x21')](_0x2ce75e,util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x0d8b('0x37')))},function(_0x519088){if(_0x519088){_0x5ad0fe(_0x519088);}else{_0x1649fc();}});});}})['then'](function(){if(_0x4f6f21){rimraf(path[_0x0d8b('0x21')](_0x2ce75e,_0xe65334),function(){});}})['then'](function(){logger['info'](util[_0x0d8b('0x1c')](_0x0d8b('0x38'),EXTRACTED_REPORT_ID,_0x0d8b('0x39')));return analyticExtractedReport(_0x0d8b('0x3a'),_0x4f6f21?util[_0x0d8b('0x1c')](_0x0d8b('0x36'),_0xe65334,_0x4f6f21?'zip':_0x0d8b('0x30')):null);});}function main(){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x3c'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')));return db[_0x0d8b('0xa')][_0x0d8b('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1d06b6){_extractedReport=_0x1d06b6;return dbH[_0x0d8b('0x1a')][_0x0d8b('0x1b')](util[_0x0d8b('0x1c')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0d8b('0x1a')]['QueryTypes'][_0x0d8b('0x1f')]});})[_0x0d8b('0x17')](extractReport)[_0x0d8b('0x3f')](function(_0x26ac10){logger[_0x0d8b('0x3b')](util[_0x0d8b('0x1c')](_0x0d8b('0x40'),EXTRACTED_REPORT_ID,_0x0d8b('0x3d')),util[_0x0d8b('0x41')](_0x26ac10,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x0d8b('0x42'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 8fd4862..b9017df 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 _0x3a20=['binary','%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','path','json2xls','zip-dir','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','%s\x20limit\x20%d\x20OFFSET\x20%d','push','.xlsx','length','existsSync','mkdirSync','join','%s%d.%s','xlsx'];(function(_0xfbc3f6,_0x1bc879){var _0xf94268=function(_0x59aeb9){while(--_0x59aeb9){_0xfbc3f6['push'](_0xfbc3f6['shift']());}};_0xf94268(++_0x1bc879);}(_0x3a20,0xd0));var _0x03a2=function(_0x13c5f8,_0x19c801){_0x13c5f8=_0x13c5f8-0x0;var _0x86fa64=_0x3a20[_0x13c5f8];return _0x86fa64;};'use strict';var util=require('util');var path=require(_0x03a2('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x03a2('0x1'));var BPromise=require('bluebird');var zipdir=require(_0x03a2('0x2'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x03a2('0x3')];var logger=require('../../config/logger')(_0x03a2('0x4'));var EXTRACTED_REPORT_ID=Number(process[_0x03a2('0x5')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x03a2('0x5')][0x4];function analyticExtractedReport(_0x5cd7e5,_0x1e43c1){var _0x1e1a86={'status':_0x5cd7e5};var _0x28a6fe={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1e43c1){_0x1e1a86[_0x03a2('0x6')]=_0x1e43c1;}return db[_0x03a2('0x7')][_0x03a2('0x8')](_0x1e1a86,_0x28a6fe);}function main(){var _0x27a2e8=0x1388;var _0x23d23a;logger[_0x03a2('0x9')](util[_0x03a2('0xa')](_0x03a2('0xb'),EXTRACTED_REPORT_ID,_0x03a2('0xc')));return db[_0x03a2('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x03a2('0xe'),_0x03a2('0xf')]})[_0x03a2('0x10')](function(_0x5e58db){if(_0x5e58db){_0x23d23a=_0x5e58db;_0x27a2e8=_0x23d23a[_0x03a2('0xf')]||0x1388;}})[_0x03a2('0x10')](function(){return dbH[_0x03a2('0x11')][_0x03a2('0x12')](util[_0x03a2('0xa')](_0x03a2('0x13'),QUERY),{'type':dbH[_0x03a2('0x11')][_0x03a2('0x14')][_0x03a2('0x15')]});})['then'](function(_0x2e9bb9){if(!_0x2e9bb9[0x0]['num']){return analyticExtractedReport('Empty');}var _0x388272=[];var _0x4dff43=0x0;var _0x5e137b=!![];if(_0x23d23a['split']){if(_0x2e9bb9&&_0x2e9bb9['length']){var _0x13aa3e=_0x2e9bb9[0x0][_0x03a2('0x16')]%(_0x4dff43+_0x27a2e8);for(;_0x5e137b;_0x4dff43+=_0x27a2e8,_0x13aa3e=_0x2e9bb9[0x0]['num']%(_0x4dff43+_0x27a2e8)){if(_0x13aa3e==0x0||_0x13aa3e==_0x2e9bb9[0x0][_0x03a2('0x16')]){_0x5e137b=![];}_0x388272['push'](dbH[_0x03a2('0x11')][_0x03a2('0x12')](util['format'](_0x03a2('0x17'),QUERY,_0x27a2e8,_0x4dff43),{'type':dbH['sequelize'][_0x03a2('0x14')][_0x03a2('0x15')]}));}}}else{_0x388272[_0x03a2('0x18')](dbH[_0x03a2('0x11')][_0x03a2('0x12')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x03a2('0x15')]}));}var _0x1eb2a2=path['dirname'](PATH);var _0x563770=path['basename'](PATH,_0x03a2('0x19'));var _0x1afc90=_0x23d23a[_0x03a2('0xe')]&&_0x388272[_0x03a2('0x1a')]>0x1;var _0x11d0e2=[];if(!fs[_0x03a2('0x1b')](path['join'](_0x1eb2a2,_0x563770))&&_0x1afc90){fs[_0x03a2('0x1c')](path[_0x03a2('0x1d')](_0x1eb2a2,_0x563770));}return BPromise['each'](_0x388272,function(_0x12b95c){_0x11d0e2[_0x03a2('0x18')](_0x12b95c);})[_0x03a2('0x10')](function(){for(var _0x2cc5a2=0x0;_0x2cc5a2<_0x11d0e2[_0x03a2('0x1a')];_0x2cc5a2+=0x1){var _0x189484;var _0x46233a=_0x11d0e2[_0x2cc5a2];if(_0x1afc90){_0x189484=path[_0x03a2('0x1d')](_0x1eb2a2,_0x563770,util[_0x03a2('0xa')](_0x03a2('0x1e'),_0x563770,_0x2cc5a2,'xlsx'));}else{_0x189484=path[_0x03a2('0x1d')](_0x1eb2a2,util['format']('%s.%s',_0x563770,_0x03a2('0x1f')));}fs['writeFileSync'](_0x189484,json2xls(_0x46233a),_0x03a2('0x20'));}})[_0x03a2('0x10')](function(){if(_0x1afc90){zipdir(path['join'](_0x1eb2a2,_0x563770),{'saveTo':path[_0x03a2('0x1d')](_0x1eb2a2,util[_0x03a2('0xa')](_0x03a2('0x21'),_0x563770,'zip'))},function(_0x63273b,_0xbf4109){});rimraf(path['join'](_0x1eb2a2,_0x563770),function(){});}})[_0x03a2('0x10')](function(){logger[_0x03a2('0x9')](util[_0x03a2('0xa')](_0x03a2('0x22'),EXTRACTED_REPORT_ID,_0x03a2('0xc')));return analyticExtractedReport(_0x03a2('0x23'),_0x1afc90?util['format'](_0x03a2('0x21'),_0x563770,_0x1afc90?_0x03a2('0x24'):'xlsx'):null);});})[_0x03a2('0x25')](function(_0xc17e40){logger[_0x03a2('0x9')](util[_0x03a2('0xa')](_0x03a2('0x26'),EXTRACTED_REPORT_ID,_0x03a2('0xc')),util['inspect'](_0xc17e40,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x03a2('0x27'));});}main(); \ No newline at end of file +var _0xdcd5=['zip','inspect','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','Empty','split','num','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.xlsx','length','join','mkdirSync','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed'];(function(_0x356ad5,_0x45c7dc){var _0x1a68d6=function(_0x4bf17b){while(--_0x4bf17b){_0x356ad5['push'](_0x356ad5['shift']());}};_0x1a68d6(++_0x45c7dc);}(_0xdcd5,0x110));var _0x5dcd=function(_0x413b4d,_0xa3459c){_0x413b4d=_0x413b4d-0x0;var _0x8b810a=_0xdcd5[_0x413b4d];return _0x8b810a;};'use strict';var util=require(_0x5dcd('0x0'));var path=require(_0x5dcd('0x1'));var _=require(_0x5dcd('0x2'));var fs=require('fs');var json2xls=require(_0x5dcd('0x3'));var BPromise=require(_0x5dcd('0x4'));var zipdir=require(_0x5dcd('0x5'));var rimraf=require(_0x5dcd('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0x5dcd('0x7'))[_0x5dcd('0x8')];var logger=require(_0x5dcd('0x9'))(_0x5dcd('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x5dcd('0xb')][0x2]);var QUERY=process[_0x5dcd('0xb')][0x3];var PATH=process[_0x5dcd('0xb')][0x4];function analyticExtractedReport(_0x3273c5,_0x5b70b8){var _0x593f16={'status':_0x3273c5};var _0x1680f9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5b70b8){_0x593f16[_0x5dcd('0xc')]=_0x5b70b8;}return db[_0x5dcd('0xd')]['update'](_0x593f16,_0x1680f9);}function main(){var _0x1e1161=0x1388;var _0x29c3e1;logger[_0x5dcd('0xe')](util[_0x5dcd('0xf')](_0x5dcd('0x10'),EXTRACTED_REPORT_ID,_0x5dcd('0x11')));return db[_0x5dcd('0x12')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x5dcd('0x13')]})[_0x5dcd('0x14')](function(_0x4e213f){if(_0x4e213f){_0x29c3e1=_0x4e213f;_0x1e1161=_0x29c3e1[_0x5dcd('0x13')]||0x1388;}})[_0x5dcd('0x14')](function(){return dbH[_0x5dcd('0x15')][_0x5dcd('0x16')](util[_0x5dcd('0xf')](_0x5dcd('0x17'),QUERY),{'type':dbH[_0x5dcd('0x15')][_0x5dcd('0x18')]['SELECT']});})[_0x5dcd('0x14')](function(_0x2b61bf){if(!_0x2b61bf[0x0]['num']){return analyticExtractedReport(_0x5dcd('0x19'));}var _0x537aed=[];var _0x3a9ab9=0x0;var _0x67a19e=!![];if(_0x29c3e1[_0x5dcd('0x1a')]){if(_0x2b61bf&&_0x2b61bf['length']){var _0x1a4643=_0x2b61bf[0x0][_0x5dcd('0x1b')]%(_0x3a9ab9+_0x1e1161);for(;_0x67a19e;_0x3a9ab9+=_0x1e1161,_0x1a4643=_0x2b61bf[0x0][_0x5dcd('0x1b')]%(_0x3a9ab9+_0x1e1161)){if(_0x1a4643==0x0||_0x1a4643==_0x2b61bf[0x0]['num']){_0x67a19e=![];}_0x537aed[_0x5dcd('0x1c')](dbH[_0x5dcd('0x15')][_0x5dcd('0x16')](util['format'](_0x5dcd('0x1d'),QUERY,_0x1e1161,_0x3a9ab9),{'type':dbH[_0x5dcd('0x15')][_0x5dcd('0x18')][_0x5dcd('0x1e')]}));}}}else{_0x537aed['push'](dbH[_0x5dcd('0x15')][_0x5dcd('0x16')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x5dcd('0x1e')]}));}var _0x380954=path[_0x5dcd('0x1f')](PATH);var _0x8a43fc=path[_0x5dcd('0x20')](PATH,_0x5dcd('0x21'));var _0xe2f1b7=_0x29c3e1[_0x5dcd('0x1a')]&&_0x537aed[_0x5dcd('0x22')]>0x1;var _0x270390=[];if(!fs['existsSync'](path[_0x5dcd('0x23')](_0x380954,_0x8a43fc))&&_0xe2f1b7){fs[_0x5dcd('0x24')](path[_0x5dcd('0x23')](_0x380954,_0x8a43fc));}return BPromise['each'](_0x537aed,function(_0x30fe1f){_0x270390[_0x5dcd('0x1c')](_0x30fe1f);})[_0x5dcd('0x14')](function(){for(var _0x11daa8=0x0;_0x11daa8<_0x270390[_0x5dcd('0x22')];_0x11daa8+=0x1){var _0x5337a3;var _0xf30ac6=_0x270390[_0x11daa8];if(_0xe2f1b7){_0x5337a3=path[_0x5dcd('0x23')](_0x380954,_0x8a43fc,util[_0x5dcd('0xf')](_0x5dcd('0x25'),_0x8a43fc,_0x11daa8,_0x5dcd('0x26')));}else{_0x5337a3=path['join'](_0x380954,util[_0x5dcd('0xf')](_0x5dcd('0x27'),_0x8a43fc,_0x5dcd('0x26')));}fs[_0x5dcd('0x28')](_0x5337a3,json2xls(_0xf30ac6),_0x5dcd('0x29'));}})[_0x5dcd('0x14')](function(){if(_0xe2f1b7){zipdir(path[_0x5dcd('0x23')](_0x380954,_0x8a43fc),{'saveTo':path[_0x5dcd('0x23')](_0x380954,util[_0x5dcd('0xf')](_0x5dcd('0x27'),_0x8a43fc,'zip'))},function(_0x3bed3f,_0x510e49){});rimraf(path['join'](_0x380954,_0x8a43fc),function(){});}})[_0x5dcd('0x14')](function(){logger[_0x5dcd('0xe')](util['format'](_0x5dcd('0x2a'),EXTRACTED_REPORT_ID,_0x5dcd('0x11')));return analyticExtractedReport('Completed',_0xe2f1b7?util[_0x5dcd('0xf')](_0x5dcd('0x27'),_0x8a43fc,_0xe2f1b7?_0x5dcd('0x2b'):_0x5dcd('0x26')):null);});})['catch'](function(_0x522d3e){logger[_0x5dcd('0xe')](util[_0x5dcd('0xf')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util[_0x5dcd('0x2c')](_0x522d3e,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index c8e587f..a460d0c 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 _0x9965=['cutdigits','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','tag','CDR(tag)=','length','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','appType','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','destroy','bulkCreate','error','rewrite','lodash','util','Interval','findAll','then','intervals','models','IntervalId','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','find','push','type','Set','CDR(type)=%s','context','priority','VoiceExtensionId','extension','extensions','CDR(destination)='];(function(_0x25c6f7,_0x16570d){var _0x40572c=function(_0x594c81){while(--_0x594c81){_0x25c6f7['push'](_0x25c6f7['shift']());}};_0x40572c(++_0x16570d);}(_0x9965,0xf4));var _0x5996=function(_0x315e2d,_0x2ae61e){_0x315e2d=_0x315e2d-0x0;var _0x24b5bc=_0x9965[_0x315e2d];return _0x24b5bc;};'use strict';var _=require(_0x5996('0x0'));var util=require(_0x5996('0x1'));function rewrite(_0xd24d63,_0x24fc61){var _0x2bbab2=this;return _0xd24d63['models'][_0x5996('0x2')][_0x5996('0x3')]({'raw':!![]})[_0x5996('0x4')](function(_0x1ed436){_0x2bbab2[_0x5996('0x5')]=_0x1ed436;return _0xd24d63[_0x5996('0x6')]['VoiceExtension'][_0x5996('0x3')]({'where':{'IntervalId':_0x24fc61[_0x5996('0x7')]},'raw':!![]});})[_0x5996('0x4')](function(_0x20491b){return _0xd24d63[_0x5996('0x6')][_0x5996('0x8')][_0x5996('0x3')]({'where':{'exten':{'$in':_[_0x5996('0x9')](_[_0x5996('0xa')](_0x20491b,_0x5996('0xb')))}},'order':[{'raw':_0x5996('0xc')}],'raw':!![]});})['then'](function(_0x1c39ee){var _0x31c7a9=_[_0x5996('0xd')](_0x1c39ee,{'priority':'1'});var _0xde731f=_[_0x5996('0xd')](_0x1c39ee,{'isApp':0x1});var _0x1422b0=_[_0x5996('0xe')](_0xde731f,_0x5996('0xb'));var _0x2e83c9=['queue',_0x5996('0xf')];var _0x25fb76=[];var _0x202d6a=[];for(var _0x1af162 in _0x1422b0){if(_0x1422b0[_0x5996('0x10')](_0x1af162)){_0x2bbab2['priority']=0x2;_0x2bbab2['extensions']=[];_0x2bbab2['extension']=_[_0x5996('0x11')](_0x31c7a9,{'exten':_0x1422b0[_0x1af162][0x0][_0x5996('0xb')]});_0x2bbab2['extensions'][_0x5996('0x12')]({'type':_0x1422b0[_0x1af162][0x0][_0x5996('0x13')],'app':_0x5996('0x14'),'appdata':util['format'](_0x5996('0x15'),_0x1422b0[_0x1af162][0x0]['type']),'context':_0x1422b0[_0x1af162][0x0][_0x5996('0x16')],'exten':_0x1422b0[_0x1af162][0x0][_0x5996('0xb')],'priority':_0x2bbab2[_0x5996('0x17')]++,'VoiceExtensionId':_0x1422b0[_0x1af162][0x0][_0x5996('0x18')]});if(_0x1422b0[_0x1af162][0x0][_0x5996('0x13')]==='outbound'){if(_0x2bbab2[_0x5996('0x19')]){_0x2bbab2[_0x5996('0x1a')]['push']({'type':_0x1422b0[_0x1af162][0x0][_0x5996('0x13')],'app':_0x5996('0x14'),'appdata':_0x5996('0x1b')+(_0x2bbab2[_0x5996('0x19')][_0x5996('0x1c')]?'${EXTEN:'+_0x2bbab2[_0x5996('0x19')][_0x5996('0x1c')]+'}':'${EXTEN}'),'context':_0x1422b0[_0x1af162][0x0][_0x5996('0x16')],'exten':_0x1422b0[_0x1af162][0x0]['exten'],'priority':_0x2bbab2[_0x5996('0x17')]++,'VoiceExtensionId':_0x1422b0[_0x1af162][0x0][_0x5996('0x18')]});}_0x2bbab2[_0x5996('0x1a')]['push']({'type':_0x1422b0[_0x1af162][0x0][_0x5996('0x13')],'app':_0x5996('0x14'),'appdata':_0x5996('0x1d')+_0x1422b0[_0x1af162][0x0][_0x5996('0x18')],'context':_0x1422b0[_0x1af162][0x0][_0x5996('0x16')],'exten':_0x1422b0[_0x1af162][0x0][_0x5996('0xb')],'priority':_0x2bbab2['priority']++,'VoiceExtensionId':_0x1422b0[_0x1af162][0x0][_0x5996('0x18')]});var _0x10c7b5=_0x2bbab2[_0x5996('0x17')]++;_0x2bbab2[_0x5996('0x1a')][_0x5996('0x12')]({'type':_0x1422b0[_0x1af162][0x0][_0x5996('0x13')],'app':_0x5996('0x1e'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x10c7b5+0x2)+_0x5996('0x1f')+(_0x10c7b5+0x1)+')','context':_0x1422b0[_0x1af162][0x0]['context'],'exten':_0x1422b0[_0x1af162][0x0][_0x5996('0xb')],'priority':_0x10c7b5,'VoiceExtensionId':_0x1422b0[_0x1af162][0x0][_0x5996('0x18')]});if(_0x2bbab2[_0x5996('0x19')]){_0x2bbab2[_0x5996('0x1a')][_0x5996('0x12')]({'type':_0x1422b0[_0x1af162][0x0][_0x5996('0x13')],'app':_0x5996('0x14'),'appdata':_0x2bbab2[_0x5996('0x19')][_0x5996('0x1c')]?_0x5996('0x20')+_0x2bbab2[_0x5996('0x19')]['cutdigits']+'}':_0x5996('0x21'),'context':_0x1422b0[_0x1af162][0x0][_0x5996('0x16')],'exten':_0x1422b0[_0x1af162][0x0][_0x5996('0xb')],'priority':_0x2bbab2['priority']++,'VoiceExtensionId':_0x1422b0[_0x1af162][0x0][_0x5996('0x18')]});}_0x2bbab2[_0x5996('0x1a')][_0x5996('0x12')]({'type':_0x1422b0[_0x1af162][0x0][_0x5996('0x13')],'app':'Set','appdata':_0x5996('0x22')+_0x1422b0[_0x1af162][0x0][_0x5996('0x18')],'context':_0x1422b0[_0x1af162][0x0][_0x5996('0x16')],'exten':_0x1422b0[_0x1af162][0x0]['exten'],'priority':_0x2bbab2['priority']++,'VoiceExtensionId':_0x1422b0[_0x1af162][0x0][_0x5996('0x18')]});if(_0x2bbab2[_0x5996('0x19')]&&_0x2bbab2[_0x5996('0x19')][_0x5996('0x10')]('recordingFormat')&&_0x2bbab2[_0x5996('0x19')][_0x5996('0x23')]!==_0x5996('0x24')){_0x2bbab2[_0x5996('0x1a')][_0x5996('0x12')]({'type':_0x1422b0[_0x1af162][0x0][_0x5996('0x13')],'app':_0x5996('0x14'),'appdata':_0x5996('0x25'),'context':_0x1422b0[_0x1af162][0x0][_0x5996('0x16')],'exten':_0x1422b0[_0x1af162][0x0][_0x5996('0xb')],'priority':_0x2bbab2['priority']++,'VoiceExtensionId':_0x1422b0[_0x1af162][0x0][_0x5996('0x18')]});_0x2bbab2[_0x5996('0x1a')][_0x5996('0x12')]({'type':_0x1422b0[_0x1af162][0x0][_0x5996('0x13')],'app':_0x5996('0x14'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x2bbab2[_0x5996('0x19')][_0x5996('0x23')]||_0x5996('0x26'),'context':_0x1422b0[_0x1af162][0x0][_0x5996('0x16')],'exten':_0x1422b0[_0x1af162][0x0][_0x5996('0xb')],'priority':_0x2bbab2['priority']++,'VoiceExtensionId':_0x1422b0[_0x1af162][0x0][_0x5996('0x18')]});}}_0x2bbab2['extensions'][_0x5996('0x12')]({'type':_0x1422b0[_0x1af162][0x0][_0x5996('0x13')],'app':_0x5996('0x14'),'appdata':_0x5996('0x27'),'context':_0x1422b0[_0x1af162][0x0]['context'],'exten':_0x1422b0[_0x1af162][0x0][_0x5996('0xb')],'priority':_0x2bbab2[_0x5996('0x17')]++,'VoiceExtensionId':_0x1422b0[_0x1af162][0x0][_0x5996('0x18')]});_0x2bbab2[_0x5996('0x1a')][_0x5996('0x12')]({'type':_0x1422b0[_0x1af162][0x0][_0x5996('0x13')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1422b0[_0x1af162][0x0][_0x5996('0x16')],'exten':_0x1422b0[_0x1af162][0x0][_0x5996('0xb')],'priority':_0x2bbab2['priority']++,'VoiceExtensionId':_0x1422b0[_0x1af162][0x0][_0x5996('0x18')]});_0x2bbab2['extensions']['push']({'type':_0x1422b0[_0x1af162][0x0][_0x5996('0x13')],'app':_0x5996('0x14'),'appdata':_0x5996('0x28'),'context':_0x1422b0[_0x1af162][0x0][_0x5996('0x16')],'exten':_0x1422b0[_0x1af162][0x0][_0x5996('0xb')],'priority':_0x2bbab2[_0x5996('0x17')]++,'VoiceExtensionId':_0x1422b0[_0x1af162][0x0][_0x5996('0x18')]});for(var _0x200b30=0x0,_0x2c9a0e=0x0;_0x200b30<_0x1422b0[_0x1af162]['length'];_0x200b30+=0x1,_0x2c9a0e=0x0){var _0x23ec71=_0x1422b0[_0x1af162][_0x200b30];if(_0x23ec71['type']){_0x23ec71[_0x5996('0x13')]=_0x23ec71[_0x5996('0x13')][_0x5996('0x29')]();}var _0xf018b0=[];var _0x43c8e0=[];delete _0x23ec71['id'];delete _0x23ec71[_0x5996('0x2a')];delete _0x23ec71[_0x5996('0x2b')];var _0x3adcdc=_0x23ec71[_0x5996('0x2c')]!=='*,*,*,*'?[_0x23ec71[_0x5996('0x2c')]]:_0x23ec71[_0x5996('0x7')]?_['map'](_[_0x5996('0xd')](_0x2bbab2['intervals'],{'IntervalId':_0x23ec71[_0x5996('0x7')]}),_0x5996('0x2c')):[];if(_0x23ec71[_0x5996('0x10')](_0x5996('0x2d'))){if(_0x23ec71[_0x5996('0x2d')]&&_0x23ec71[_0x5996('0x2d')]!=='--'){_0xf018b0[_0x5996('0x12')]({'type':_0x23ec71['type'],'app':'Set','appdata':_0x5996('0x2e')+_0x23ec71[_0x5996('0x2d')],'context':_0x23ec71[_0x5996('0x16')],'exten':_0x23ec71[_0x5996('0xb')],'priority':_0x3adcdc[_0x5996('0x2f')]+_0x2bbab2['priority']+_0x2c9a0e++,'VoiceExtensionId':_0x23ec71[_0x5996('0x18')]});}}if(_0x23ec71['type']===_0x5996('0x30')&&_0x23ec71[_0x5996('0x10')](_0x5996('0x31'))){if(_0x23ec71['callerID']){_0xf018b0[_0x5996('0x12')]({'type':_0x23ec71['type'],'app':_0x5996('0x1e'),'appdata':_0x5996('0x32')+_0x23ec71[_0x5996('0x31')]+')','context':_0x23ec71[_0x5996('0x16')],'exten':_0x23ec71[_0x5996('0xb')],'priority':_0x3adcdc[_0x5996('0x2f')]+_0x2bbab2['priority']+_0x2c9a0e++,'VoiceExtensionId':_0x23ec71[_0x5996('0x18')]});}else{_0xf018b0[_0x5996('0x12')]({'type':_0x23ec71['type'],'app':_0x5996('0x1e'),'appdata':_0x5996('0x33'),'context':_0x23ec71[_0x5996('0x16')],'exten':_0x23ec71[_0x5996('0xb')],'priority':_0x3adcdc[_0x5996('0x2f')]+_0x2bbab2['priority']+_0x2c9a0e++,'VoiceExtensionId':_0x23ec71['VoiceExtensionId']});}}if(_0x23ec71[_0x5996('0x10')](_0x5996('0x34'))){if(_0x2e83c9['indexOf'](_0x23ec71[_0x5996('0x35')][_0x5996('0x29')]())>=0x0&&_0x23ec71[_0x5996('0x36')]!==_0x5996('0x37')){if(_0x23ec71[_0x5996('0x34')]){_0xf018b0[_0x5996('0x12')]({'type':_0x23ec71[_0x5996('0x13')],'app':_0x5996('0x1e'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x23ec71[_0x5996('0x16')],'exten':_0x23ec71[_0x5996('0xb')],'priority':_0x3adcdc[_0x5996('0x2f')]+_0x2bbab2[_0x5996('0x17')]+_0x2c9a0e++,'VoiceExtensionId':_0x23ec71[_0x5996('0x18')]});_0xf018b0[_0x5996('0x12')]({'type':_0x23ec71[_0x5996('0x13')],'app':_0x5996('0x14'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x23ec71[_0x5996('0x16')],'exten':_0x23ec71['exten'],'priority':_0x3adcdc[_0x5996('0x2f')]+_0x2bbab2[_0x5996('0x17')]+_0x2c9a0e++,'VoiceExtensionId':_0x23ec71[_0x5996('0x18')]});}else{_0xf018b0['push']({'type':_0x23ec71[_0x5996('0x13')],'app':_0x5996('0x1e'),'appdata':_0x5996('0x38'),'context':_0x23ec71[_0x5996('0x16')],'exten':_0x23ec71['exten'],'priority':_0x3adcdc[_0x5996('0x2f')]+_0x2bbab2[_0x5996('0x17')]+_0x2c9a0e++,'VoiceExtensionId':_0x23ec71[_0x5996('0x18')]});_0xf018b0[_0x5996('0x12')]({'type':_0x23ec71['type'],'app':_0x5996('0x14'),'appdata':_0x5996('0x39'),'context':_0x23ec71[_0x5996('0x16')],'exten':_0x23ec71['exten'],'priority':_0x3adcdc[_0x5996('0x2f')]+_0x2bbab2[_0x5996('0x17')]+_0x2c9a0e++,'VoiceExtensionId':_0x23ec71[_0x5996('0x18')]});}}}for(var _0x1ebb66=0x0;_0x1ebb66<_0x3adcdc[_0x5996('0x2f')];_0x1ebb66+=0x1){var _0x429f7d=_0x2bbab2['priority']+_0x3adcdc[_0x5996('0x2f')];var _0x56851a=_0x1ebb66===_0x3adcdc['length']-0x1?_0x2bbab2[_0x5996('0x17')]+_0xf018b0['length']+_0x43c8e0[_0x5996('0x2f')]+0x2:_0x2bbab2[_0x5996('0x17')]+_0x1ebb66+0x1;_0xf018b0[_0x5996('0x3a')](_0x1ebb66,0x0,{'type':_0x23ec71['type'],'app':_0x5996('0x3b'),'appdata':_0x3adcdc[_0x1ebb66]+'?'+_0x23ec71['context']+_0x5996('0x3c')+_0x429f7d+':'+_0x23ec71[_0x5996('0x16')]+_0x5996('0x3c')+_0x56851a,'exten':_0x23ec71[_0x5996('0xb')],'context':_0x23ec71['context'],'priority':_0x2bbab2[_0x5996('0x17')]+_0x1ebb66,'VoiceExtensionId':_0x1422b0[_0x1af162][0x0]['VoiceExtensionId']});}_0x23ec71[_0x5996('0x17')]=_0xf018b0[_0x5996('0x2f')]?_[_0x5996('0x3d')](_0xf018b0)[_0x5996('0x17')]+0x1:_0x2bbab2[_0x5996('0x17')];_0x2bbab2[_0x5996('0x17')]=(_0x43c8e0[_0x5996('0x2f')]?_[_0x5996('0x3d')](_0x43c8e0)[_0x5996('0x17')]:_0x23ec71[_0x5996('0x17')])+0x1;_0x2bbab2[_0x5996('0x1a')]=_['concat'](_0x2bbab2['extensions'],_0xf018b0,[_0x23ec71],_0x43c8e0);}_0x2bbab2[_0x5996('0x1a')][_0x5996('0x12')]({'type':_0x1422b0[_0x1af162][0x0][_0x5996('0x13')],'app':_0x5996('0x3e'),'exten':_0x1422b0[_0x1af162][0x0][_0x5996('0xb')],'context':_0x1422b0[_0x1af162][0x0][_0x5996('0x16')],'priority':_0x2bbab2[_0x5996('0x17')],'VoiceExtensionId':_0x1422b0[_0x1af162][0x0][_0x5996('0x18')]});_0x25fb76[_0x5996('0x12')](_0x1422b0[_0x1af162][0x0]['VoiceExtensionId']);_0x202d6a=_[_0x5996('0x3f')](_0x202d6a,_0x2bbab2['extensions']);}}return _0xd24d63['transaction'](function(_0x493ff0){return _0xd24d63['models'][_0x5996('0x8')][_0x5996('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x25fb76}},'transaction':_0x493ff0})['then'](function(_0x37d342){return _0xd24d63[_0x5996('0x6')][_0x5996('0x8')][_0x5996('0x41')](_['sortBy'](_0x202d6a,_0x5996('0x17')),{'transaction':_0x493ff0});});});})['catch'](function(_0x220489){console[_0x5996('0x42')](_0x220489);});}exports[_0x5996('0x43')]=rewrite; \ No newline at end of file +var _0xa5fa=['map','exten','groupBy','queue','hasOwnProperty','priority','extensions','extension','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','createdAt','interval','*,*,*,*','filter','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','toLowerCase','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','bulkCreate','sortBy','catch','error','rewrite','util','Interval','findAll','intervals','models','VoiceExtension','IntervalId','then'];(function(_0xa8b370,_0x2b77db){var _0x643e37=function(_0x1486eb){while(--_0x1486eb){_0xa8b370['push'](_0xa8b370['shift']());}};_0x643e37(++_0x2b77db);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x5e4633,_0x2cf0d0){_0x5e4633=_0x5e4633-0x0;var _0x3edbc0=_0xa5fa[_0x5e4633];return _0x3edbc0;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));function rewrite(_0x343d5b,_0x24d383){var _0x1b7e1d=this;return _0x343d5b['models'][_0xaa5f('0x1')][_0xaa5f('0x2')]({'raw':!![]})['then'](function(_0x233cd6){_0x1b7e1d[_0xaa5f('0x3')]=_0x233cd6;return _0x343d5b[_0xaa5f('0x4')][_0xaa5f('0x5')][_0xaa5f('0x2')]({'where':{'IntervalId':_0x24d383[_0xaa5f('0x6')]},'raw':!![]});})[_0xaa5f('0x7')](function(_0xc326df){return _0x343d5b[_0xaa5f('0x4')][_0xaa5f('0x5')][_0xaa5f('0x2')]({'where':{'exten':{'$in':_['uniq'](_[_0xaa5f('0x8')](_0xc326df,_0xaa5f('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x3fa93f){var _0x4bb69d=_['filter'](_0x3fa93f,{'priority':'1'});var _0x1f3b2e=_['filter'](_0x3fa93f,{'isApp':0x1});var _0x1781e4=_[_0xaa5f('0xa')](_0x1f3b2e,_0xaa5f('0x9'));var _0x9aeae9=[_0xaa5f('0xb'),'playback'];var _0xbd4e10=[];var _0x552c53=[];for(var _0x372881 in _0x1781e4){if(_0x1781e4[_0xaa5f('0xc')](_0x372881)){_0x1b7e1d[_0xaa5f('0xd')]=0x2;_0x1b7e1d[_0xaa5f('0xe')]=[];_0x1b7e1d[_0xaa5f('0xf')]=_['find'](_0x4bb69d,{'exten':_0x1781e4[_0x372881][0x0]['exten']});_0x1b7e1d[_0xaa5f('0xe')][_0xaa5f('0x10')]({'type':_0x1781e4[_0x372881][0x0][_0xaa5f('0x11')],'app':_0xaa5f('0x12'),'appdata':util[_0xaa5f('0x13')](_0xaa5f('0x14'),_0x1781e4[_0x372881][0x0][_0xaa5f('0x11')]),'context':_0x1781e4[_0x372881][0x0][_0xaa5f('0x15')],'exten':_0x1781e4[_0x372881][0x0][_0xaa5f('0x9')],'priority':_0x1b7e1d[_0xaa5f('0xd')]++,'VoiceExtensionId':_0x1781e4[_0x372881][0x0][_0xaa5f('0x16')]});if(_0x1781e4[_0x372881][0x0][_0xaa5f('0x11')]==='outbound'){if(_0x1b7e1d[_0xaa5f('0xf')]){_0x1b7e1d[_0xaa5f('0xe')][_0xaa5f('0x10')]({'type':_0x1781e4[_0x372881][0x0][_0xaa5f('0x11')],'app':_0xaa5f('0x12'),'appdata':_0xaa5f('0x17')+(_0x1b7e1d[_0xaa5f('0xf')][_0xaa5f('0x18')]?_0xaa5f('0x19')+_0x1b7e1d[_0xaa5f('0xf')][_0xaa5f('0x18')]+'}':_0xaa5f('0x1a')),'context':_0x1781e4[_0x372881][0x0][_0xaa5f('0x15')],'exten':_0x1781e4[_0x372881][0x0]['exten'],'priority':_0x1b7e1d[_0xaa5f('0xd')]++,'VoiceExtensionId':_0x1781e4[_0x372881][0x0]['VoiceExtensionId']});}_0x1b7e1d[_0xaa5f('0xe')][_0xaa5f('0x10')]({'type':_0x1781e4[_0x372881][0x0]['type'],'app':_0xaa5f('0x12'),'appdata':_0xaa5f('0x1b')+_0x1781e4[_0x372881][0x0]['VoiceExtensionId'],'context':_0x1781e4[_0x372881][0x0][_0xaa5f('0x15')],'exten':_0x1781e4[_0x372881][0x0][_0xaa5f('0x9')],'priority':_0x1b7e1d[_0xaa5f('0xd')]++,'VoiceExtensionId':_0x1781e4[_0x372881][0x0][_0xaa5f('0x16')]});var _0x1f66c0=_0x1b7e1d[_0xaa5f('0xd')]++;_0x1b7e1d[_0xaa5f('0xe')][_0xaa5f('0x10')]({'type':_0x1781e4[_0x372881][0x0]['type'],'app':_0xaa5f('0x1c'),'appdata':_0xaa5f('0x1d')+(_0x1f66c0+0x2)+_0xaa5f('0x1e')+(_0x1f66c0+0x1)+')','context':_0x1781e4[_0x372881][0x0]['context'],'exten':_0x1781e4[_0x372881][0x0][_0xaa5f('0x9')],'priority':_0x1f66c0,'VoiceExtensionId':_0x1781e4[_0x372881][0x0][_0xaa5f('0x16')]});if(_0x1b7e1d[_0xaa5f('0xf')]){_0x1b7e1d['extensions'][_0xaa5f('0x10')]({'type':_0x1781e4[_0x372881][0x0]['type'],'app':'Set','appdata':_0x1b7e1d[_0xaa5f('0xf')]['cutdigits']?_0xaa5f('0x1f')+_0x1b7e1d['extension']['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x1781e4[_0x372881][0x0][_0xaa5f('0x15')],'exten':_0x1781e4[_0x372881][0x0]['exten'],'priority':_0x1b7e1d[_0xaa5f('0xd')]++,'VoiceExtensionId':_0x1781e4[_0x372881][0x0][_0xaa5f('0x16')]});}_0x1b7e1d['extensions']['push']({'type':_0x1781e4[_0x372881][0x0][_0xaa5f('0x11')],'app':'Set','appdata':_0xaa5f('0x20')+_0x1781e4[_0x372881][0x0][_0xaa5f('0x16')],'context':_0x1781e4[_0x372881][0x0]['context'],'exten':_0x1781e4[_0x372881][0x0][_0xaa5f('0x9')],'priority':_0x1b7e1d[_0xaa5f('0xd')]++,'VoiceExtensionId':_0x1781e4[_0x372881][0x0][_0xaa5f('0x16')]});if(_0x1b7e1d['extension']&&_0x1b7e1d[_0xaa5f('0xf')][_0xaa5f('0xc')]('recordingFormat')&&_0x1b7e1d['extension']['recordingFormat']!=='none'){_0x1b7e1d[_0xaa5f('0xe')][_0xaa5f('0x10')]({'type':_0x1781e4[_0x372881][0x0][_0xaa5f('0x11')],'app':_0xaa5f('0x12'),'appdata':_0xaa5f('0x21'),'context':_0x1781e4[_0x372881][0x0][_0xaa5f('0x15')],'exten':_0x1781e4[_0x372881][0x0][_0xaa5f('0x9')],'priority':_0x1b7e1d['priority']++,'VoiceExtensionId':_0x1781e4[_0x372881][0x0][_0xaa5f('0x16')]});_0x1b7e1d[_0xaa5f('0xe')][_0xaa5f('0x10')]({'type':_0x1781e4[_0x372881][0x0][_0xaa5f('0x11')],'app':_0xaa5f('0x12'),'appdata':_0xaa5f('0x22')+_0x1b7e1d['extension'][_0xaa5f('0x23')]||_0xaa5f('0x24'),'context':_0x1781e4[_0x372881][0x0][_0xaa5f('0x15')],'exten':_0x1781e4[_0x372881][0x0][_0xaa5f('0x9')],'priority':_0x1b7e1d[_0xaa5f('0xd')]++,'VoiceExtensionId':_0x1781e4[_0x372881][0x0]['VoiceExtensionId']});}}_0x1b7e1d['extensions'][_0xaa5f('0x10')]({'type':_0x1781e4[_0x372881][0x0][_0xaa5f('0x11')],'app':_0xaa5f('0x12'),'appdata':_0xaa5f('0x25'),'context':_0x1781e4[_0x372881][0x0]['context'],'exten':_0x1781e4[_0x372881][0x0][_0xaa5f('0x9')],'priority':_0x1b7e1d[_0xaa5f('0xd')]++,'VoiceExtensionId':_0x1781e4[_0x372881][0x0][_0xaa5f('0x16')]});_0x1b7e1d[_0xaa5f('0xe')][_0xaa5f('0x10')]({'type':_0x1781e4[_0x372881][0x0][_0xaa5f('0x11')],'app':_0xaa5f('0x12'),'appdata':_0xaa5f('0x26'),'context':_0x1781e4[_0x372881][0x0][_0xaa5f('0x15')],'exten':_0x1781e4[_0x372881][0x0][_0xaa5f('0x9')],'priority':_0x1b7e1d[_0xaa5f('0xd')]++,'VoiceExtensionId':_0x1781e4[_0x372881][0x0]['VoiceExtensionId']});_0x1b7e1d[_0xaa5f('0xe')][_0xaa5f('0x10')]({'type':_0x1781e4[_0x372881][0x0][_0xaa5f('0x11')],'app':_0xaa5f('0x12'),'appdata':_0xaa5f('0x27'),'context':_0x1781e4[_0x372881][0x0][_0xaa5f('0x15')],'exten':_0x1781e4[_0x372881][0x0][_0xaa5f('0x9')],'priority':_0x1b7e1d[_0xaa5f('0xd')]++,'VoiceExtensionId':_0x1781e4[_0x372881][0x0][_0xaa5f('0x16')]});for(var _0x2dad6f=0x0,_0x5c2339=0x0;_0x2dad6f<_0x1781e4[_0x372881][_0xaa5f('0x28')];_0x2dad6f+=0x1,_0x5c2339=0x0){var _0x5830a8=_0x1781e4[_0x372881][_0x2dad6f];if(_0x5830a8[_0xaa5f('0x11')]){_0x5830a8[_0xaa5f('0x11')]=_0x5830a8[_0xaa5f('0x11')]['toLowerCase']();}var _0x1e535f=[];var _0x641977=[];delete _0x5830a8['id'];delete _0x5830a8[_0xaa5f('0x29')];delete _0x5830a8['updatedAt'];var _0x12a8e4=_0x5830a8[_0xaa5f('0x2a')]!==_0xaa5f('0x2b')?[_0x5830a8[_0xaa5f('0x2a')]]:_0x5830a8['IntervalId']?_[_0xaa5f('0x8')](_[_0xaa5f('0x2c')](_0x1b7e1d[_0xaa5f('0x3')],{'IntervalId':_0x5830a8[_0xaa5f('0x6')]}),_0xaa5f('0x2a')):[];if(_0x5830a8[_0xaa5f('0xc')](_0xaa5f('0x2d'))){if(_0x5830a8[_0xaa5f('0x2d')]&&_0x5830a8['tag']!=='--'){_0x1e535f[_0xaa5f('0x10')]({'type':_0x5830a8['type'],'app':_0xaa5f('0x12'),'appdata':'CDR(tag)='+_0x5830a8[_0xaa5f('0x2d')],'context':_0x5830a8[_0xaa5f('0x15')],'exten':_0x5830a8['exten'],'priority':_0x12a8e4[_0xaa5f('0x28')]+_0x1b7e1d[_0xaa5f('0xd')]+_0x5c2339++,'VoiceExtensionId':_0x5830a8[_0xaa5f('0x16')]});}}if(_0x5830a8['type']==='outbound'&&_0x5830a8['hasOwnProperty'](_0xaa5f('0x2e'))){if(_0x5830a8['callerID']){_0x1e535f[_0xaa5f('0x10')]({'type':_0x5830a8[_0xaa5f('0x11')],'app':_0xaa5f('0x1c'),'appdata':_0xaa5f('0x2f')+_0x5830a8['callerID']+')','context':_0x5830a8[_0xaa5f('0x15')],'exten':_0x5830a8[_0xaa5f('0x9')],'priority':_0x12a8e4[_0xaa5f('0x28')]+_0x1b7e1d[_0xaa5f('0xd')]+_0x5c2339++,'VoiceExtensionId':_0x5830a8[_0xaa5f('0x16')]});}else{_0x1e535f[_0xaa5f('0x10')]({'type':_0x5830a8[_0xaa5f('0x11')],'app':_0xaa5f('0x1c'),'appdata':_0xaa5f('0x30'),'context':_0x5830a8[_0xaa5f('0x15')],'exten':_0x5830a8[_0xaa5f('0x9')],'priority':_0x12a8e4[_0xaa5f('0x28')]+_0x1b7e1d[_0xaa5f('0xd')]+_0x5c2339++,'VoiceExtensionId':_0x5830a8[_0xaa5f('0x16')]});}}if(_0x5830a8[_0xaa5f('0xc')](_0xaa5f('0x31'))){if(_0x9aeae9['indexOf'](_0x5830a8[_0xaa5f('0x32')][_0xaa5f('0x33')]())>=0x0&&_0x5830a8[_0xaa5f('0x34')]!==_0xaa5f('0x35')){if(_0x5830a8[_0xaa5f('0x31')]){_0x1e535f[_0xaa5f('0x10')]({'type':_0x5830a8[_0xaa5f('0x11')],'app':'ExecIf','appdata':_0xaa5f('0x36'),'context':_0x5830a8[_0xaa5f('0x15')],'exten':_0x5830a8[_0xaa5f('0x9')],'priority':_0x12a8e4[_0xaa5f('0x28')]+_0x1b7e1d['priority']+_0x5c2339++,'VoiceExtensionId':_0x5830a8[_0xaa5f('0x16')]});_0x1e535f[_0xaa5f('0x10')]({'type':_0x5830a8[_0xaa5f('0x11')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x5830a8['context'],'exten':_0x5830a8['exten'],'priority':_0x12a8e4['length']+_0x1b7e1d['priority']+_0x5c2339++,'VoiceExtensionId':_0x5830a8[_0xaa5f('0x16')]});}else{_0x1e535f[_0xaa5f('0x10')]({'type':_0x5830a8[_0xaa5f('0x11')],'app':_0xaa5f('0x1c'),'appdata':_0xaa5f('0x37'),'context':_0x5830a8[_0xaa5f('0x15')],'exten':_0x5830a8['exten'],'priority':_0x12a8e4['length']+_0x1b7e1d[_0xaa5f('0xd')]+_0x5c2339++,'VoiceExtensionId':_0x5830a8[_0xaa5f('0x16')]});_0x1e535f['push']({'type':_0x5830a8[_0xaa5f('0x11')],'app':_0xaa5f('0x12'),'appdata':_0xaa5f('0x38'),'context':_0x5830a8[_0xaa5f('0x15')],'exten':_0x5830a8[_0xaa5f('0x9')],'priority':_0x12a8e4[_0xaa5f('0x28')]+_0x1b7e1d[_0xaa5f('0xd')]+_0x5c2339++,'VoiceExtensionId':_0x5830a8['VoiceExtensionId']});}}}for(var _0x47c00d=0x0;_0x47c00d<_0x12a8e4[_0xaa5f('0x28')];_0x47c00d+=0x1){var _0x2ba3e6=_0x1b7e1d['priority']+_0x12a8e4['length'];var _0x495abe=_0x47c00d===_0x12a8e4[_0xaa5f('0x28')]-0x1?_0x1b7e1d['priority']+_0x1e535f[_0xaa5f('0x28')]+_0x641977['length']+0x2:_0x1b7e1d['priority']+_0x47c00d+0x1;_0x1e535f[_0xaa5f('0x39')](_0x47c00d,0x0,{'type':_0x5830a8[_0xaa5f('0x11')],'app':_0xaa5f('0x3a'),'appdata':_0x12a8e4[_0x47c00d]+'?'+_0x5830a8['context']+_0xaa5f('0x3b')+_0x2ba3e6+':'+_0x5830a8[_0xaa5f('0x15')]+_0xaa5f('0x3b')+_0x495abe,'exten':_0x5830a8['exten'],'context':_0x5830a8[_0xaa5f('0x15')],'priority':_0x1b7e1d[_0xaa5f('0xd')]+_0x47c00d,'VoiceExtensionId':_0x1781e4[_0x372881][0x0]['VoiceExtensionId']});}_0x5830a8[_0xaa5f('0xd')]=_0x1e535f[_0xaa5f('0x28')]?_[_0xaa5f('0x3c')](_0x1e535f)[_0xaa5f('0xd')]+0x1:_0x1b7e1d[_0xaa5f('0xd')];_0x1b7e1d[_0xaa5f('0xd')]=(_0x641977[_0xaa5f('0x28')]?_[_0xaa5f('0x3c')](_0x641977)[_0xaa5f('0xd')]:_0x5830a8['priority'])+0x1;_0x1b7e1d[_0xaa5f('0xe')]=_[_0xaa5f('0x3d')](_0x1b7e1d[_0xaa5f('0xe')],_0x1e535f,[_0x5830a8],_0x641977);}_0x1b7e1d[_0xaa5f('0xe')][_0xaa5f('0x10')]({'type':_0x1781e4[_0x372881][0x0][_0xaa5f('0x11')],'app':_0xaa5f('0x3e'),'exten':_0x1781e4[_0x372881][0x0][_0xaa5f('0x9')],'context':_0x1781e4[_0x372881][0x0]['context'],'priority':_0x1b7e1d[_0xaa5f('0xd')],'VoiceExtensionId':_0x1781e4[_0x372881][0x0]['VoiceExtensionId']});_0xbd4e10[_0xaa5f('0x10')](_0x1781e4[_0x372881][0x0][_0xaa5f('0x16')]);_0x552c53=_[_0xaa5f('0x3d')](_0x552c53,_0x1b7e1d[_0xaa5f('0xe')]);}}return _0x343d5b['transaction'](function(_0x45f4f4){return _0x343d5b[_0xaa5f('0x4')][_0xaa5f('0x5')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0xbd4e10}},'transaction':_0x45f4f4})[_0xaa5f('0x7')](function(_0x524f42){return _0x343d5b[_0xaa5f('0x4')]['VoiceExtension'][_0xaa5f('0x3f')](_[_0xaa5f('0x40')](_0x552c53,_0xaa5f('0xd')),{'transaction':_0x45f4f4});});});})[_0xaa5f('0x41')](function(_0x5f08c3){console[_0xaa5f('0x42')](_0x5f08c3);});}exports[_0xaa5f('0x43')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 6227822..7a06818 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 _0x0713=['papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','index','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email\x20format\x20is\x20not\x20valid!','ListId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','fromQuery','phone','scheduledAt','updatedAt','field','NOW()','ContactId','toString','createdAt','from','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','\x20=\x20?','into','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','cm_contacts','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','push','all','CmList','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x3071('0x0'));var fs=require('fs');var squel=require(_0x3071('0x1'));var Papa=require(_0x3071('0x2'));var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));config[_0x3071('0x7')]=_[_0x3071('0x8')](config[_0x3071('0x7')],{'host':_0x3071('0x9'),'port':0x18eb});var socket=require(_0x3071('0xa'))(new Redis(config[_0x3071('0x7')]));require(_0x3071('0xb'))[_0x3071('0xc')](socket);try{if(!process[_0x3071('0xd')][0x2]||process[_0x3071('0xd')][0x2]===_0x3071('0xe')||process['argv'][0x2]===_0x3071('0xf')){throw new Error(_0x3071('0x10'));}var FILEPATH=process[_0x3071('0xd')][0x2];if(!process[_0x3071('0xd')][0x3]||process[_0x3071('0xd')][0x3]==='undefined'||process[_0x3071('0xd')][0x3]===_0x3071('0xf')||!process[_0x3071('0xd')][0x4]||process[_0x3071('0xd')][0x4]===_0x3071('0xe')||process['argv'][0x4]==='null'){throw new Error(_0x3071('0x11'));}var FIELDS=_['zipObject'](process[_0x3071('0xd')][0x3][_0x3071('0x12')](','),process['argv'][0x4][_0x3071('0x12')](','));if(!process['argv'][0x5]||process[_0x3071('0xd')][0x5]===_0x3071('0xe')||process[_0x3071('0xd')][0x5]===_0x3071('0xf')){throw new Error(_0x3071('0x13'));}var LISTID=process[_0x3071('0xd')][0x5];var COMPANYID=process[_0x3071('0xd')][0x6]&&process[_0x3071('0xd')][0x6]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x6]!=='null'?process[_0x3071('0xd')][0x6]:null;var DUPLICATES=process[_0x3071('0xd')][0x7]&&process[_0x3071('0xd')][0x7]!==_0x3071('0xe')&&process[_0x3071('0xd')][0x7]!==_0x3071('0xf')?process[_0x3071('0xd')][0x7]:null;if(!process[_0x3071('0xd')][0x8]||process['argv'][0x8]===_0x3071('0xe')||process[_0x3071('0xd')][0x8]===_0x3071('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x3071('0xd')][0x8];}catch(_0x5cd80d){logger[_0x3071('0x14')](_0x5cd80d);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(_0x43128c,_0x3762d8,_0x457b57,_0x33090c){var _0x34c50e={'message':_0x3762d8};_0x34c50e[_0x43128c]=!![];if(_0x457b57){_0x34c50e[_0x3071('0x15')]=_0x457b57;}if(_0x33090c){_0x34c50e[_0x3071('0x16')]=_0x33090c;}return _0x34c50e;}function isEmail(_0x542646){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'](_0x542646);}function checkRow(_0x2ce48a,_0xb05b1d,_0x412652){return new BPromise(function(_0x13df9f,_0x2793ef){if(_[_0x3071('0x17')](_0x2ce48a)){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x18'),null,_0x412652));}if(_0x2ce48a[_0x3071('0x19')]&&_0x2ce48a['errors'][_0x3071('0x1a')]){var _0x3f1e6e=_[_0x3071('0x1b')](_0x2ce48a['errors'],_0x3071('0x1c'))[_0x3071('0x1d')](';');return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3f1e6e,null,_0x412652));}var _0x950fde={};for(var _0x3fa3b8 in FIELDS){if(FIELDS[_0x3071('0x1e')](_0x3fa3b8)&&FIELDS[_0x3fa3b8]){_0x950fde[_0x3fa3b8]=_0x2ce48a[_0x3071('0x1f')][0x0][FIELDS[_0x3fa3b8]]||_0x2ce48a[_0x3071('0x1f')][0x0]['\ufeff'+FIELDS[_0x3fa3b8]];}}if(!_0x950fde[_0x3071('0x20')]){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x21'),null,_0x412652));}if(!_0x950fde['phone']){return _0x2793ef(handleCheckRowError('error',_0x3071('0x22'),null,_0x412652));}if(_0x950fde[_0x3071('0x23')]){var _0x6ddf96=moment(_0x950fde[_0x3071('0x23')],_0x3071('0x24'));if(!_0x6ddf96[_0x3071('0x25')]()){return _0x2793ef(handleCheckRowError(_0x3071('0x14'),_0x3071('0x26'),null,_0x412652));}}if(_0x950fde['email']){if(!isEmail(_0x950fde['email'])){return _0x2793ef(handleCheckRowError('error',_0x3071('0x27'),null,_0x412652));}}_0x950fde[_0x3071('0x28')]=LISTID;_0x950fde['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){var _0x28747d={};for(var _0x25250e=0x0,_0x13ae2c=DUPLICATES['length'];_0x25250e<_0x13ae2c;_0x25250e+=0x1){_0x28747d[DUPLICATES[_0x25250e]]=_0x950fde[DUPLICATES[_0x25250e]];}var _0x218a82=_[_0x3071('0x29')](_0xb05b1d,_0x28747d);if(_0x218a82){return _0x2793ef(handleCheckRowError(_0x3071('0x2a'),_0x3071('0x2b'),_0x218a82,_0x412652));}}return db[_0x3071('0x2c')][_0x3071('0x2d')](_0x950fde,{'raw':!![],'hooks':![],'fields':_[_0x3071('0x2e')](_0x950fde)})[_0x3071('0x2f')](function(_0x596cc3){if(DUPLICATES&&DUPLICATES[_0x3071('0x1a')]&&_0xb05b1d){_0xb05b1d['push'](_['pick'](_0x950fde,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x596cc3['id'];return _0x13df9f();})[_0x3071('0x30')](function(_0xa3a7ae){return _0x2793ef(handleCheckRowError('error',_0x3071('0x31')+(_0xa3a7ae[_0x3071('0x1c')]||JSON[_0x3071('0x32')](_0xa3a7ae)),null,_0x412652));});});}function checkHopper(){function _0x14ac42(){return function(_0xc60572){logger[_0x3071('0x14')]('cmContact',_0x3071('0x33'),util[_0x3071('0x34')](_0xc60572,{'showHidden':![],'depth':null}));};}var _0x4ce6d4=function(_0x44ad05,_0x5b1392){var _0x28f855=squel[_0x3071('0x35')]()['into']('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),'ContactId',_0x3071('0x28'),_0x5b1392,'createdAt',_0x3071('0x39')],squel['select']()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x44ad05['id'][_0x3071('0x3d')](),_0x5b1392)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),'updatedAt')[_0x3071('0x3f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x3071('0x40'),LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x5b1392+_0x3071('0x46'),_0x44ad05['id'][_0x3071('0x3d')]())))['toString']();return _0x28f855;};var _0x5c93c7=function(_0x1721d0,_0x3c2f5e){var _0x1fe5e0=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')](['phone',_0x3071('0x38'),'ContactId','ListId',_0x3c2f5e,_0x3071('0x3e'),'updatedAt'],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')[_0x3071('0x3a')]('id','ContactId')[_0x3071('0x3a')](LISTID['toString'](),_0x3071('0x28'))[_0x3071('0x3a')](_0x1721d0['id']['toString'](),_0x3c2f5e)[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')](_0x3071('0x40'),LISTID['toString']())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42'))[_0x3071('0x41')](_0x3071('0x43'),squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x4b'))[_0x3071('0x3f')](_0x3071('0x4c'))[_0x3071('0x41')](_0x3c2f5e+_0x3071('0x46'),_0x1721d0['id'][_0x3071('0x3d')]()))[_0x3071('0x41')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x3071('0x3a')]('phone')[_0x3071('0x3f')](_0x3071('0x45'))[_0x3071('0x41')](_0x3c2f5e+'\x20=\x20?',_0x1721d0['id'][_0x3071('0x3d')]())))[_0x3071('0x3d')]();return _0x1fe5e0;};function _0x5bc69e(_0x4b8ec0,_0x1b89ea){var _0x15abc4=squel[_0x3071('0x35')]()[_0x3071('0x47')]('cm_hopper')[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x38'),_0x3071('0x3c'),_0x3071('0x28'),_0x1b89ea,'createdAt',_0x3071('0x39')],squel[_0x3071('0x44')]()[_0x3071('0x3a')](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')](_0x3071('0x3b'),'scheduledAt')['field']('id',_0x3071('0x3c'))['field'](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))['field'](_0x4b8ec0['id'][_0x3071('0x3d')](),_0x1b89ea)[_0x3071('0x3a')]('NOW()',_0x3071('0x3e'))[_0x3071('0x3a')](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')]('cm_contacts')[_0x3071('0x41')](_0x3071('0x48'))[_0x3071('0x41')]('ListId\x20=\x20?',LISTID[_0x3071('0x3d')]())[_0x3071('0x41')](_0x3071('0x49'),squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))[_0x3071('0x3d')]();return _0x15abc4;}function _0x2e39ff(_0x3b47e8,_0x5cb3b3){var _0x5d1316=squel[_0x3071('0x35')]()[_0x3071('0x47')](_0x3071('0x4d'))[_0x3071('0x36')]([_0x3071('0x37'),_0x3071('0x3c'),_0x3071('0x28'),_0x5cb3b3,_0x3071('0x3e'),_0x3071('0x39')],squel[_0x3071('0x44')]()['field'](_0x3071('0x37'),_0x3071('0x37'))[_0x3071('0x3a')]('id',_0x3071('0x3c'))[_0x3071('0x3a')](LISTID[_0x3071('0x3d')](),_0x3071('0x28'))[_0x3071('0x3a')](_0x3b47e8['id']['toString'](),_0x5cb3b3)[_0x3071('0x3a')](_0x3071('0x3b'),'createdAt')['field'](_0x3071('0x3b'),_0x3071('0x39'))[_0x3071('0x3f')](_0x3071('0x4e'))['where']('deletedAt\x20IS\x20NULL')[_0x3071('0x41')]('ListId\x20=\x20?',LISTID['toString']())['where']('id\x20IN\x20?',squel[_0x3071('0x4a')](hopperContacts))[_0x3071('0x41')](_0x3071('0x42')))['toString']();return _0x5d1316;}return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id',_0x3071('0x52')],'include':[{'model':db['CmList'],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x588406){var _0x1b35d3=[];if(_0x588406){var _0x29ee70;for(var _0x388cd1=0x0,_0x40c258;_0x388cd1<_0x588406[_0x3071('0x1a')];_0x388cd1+=0x1){_0x40c258=_0x588406[_0x388cd1][_0x3071('0x54')]({'plain':!![]});switch(_0x40c258[_0x3071('0x52')]){case'always':_0x1b35d3['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x40c258,_0x3071('0x57')))['then'](function(){})['catch'](_0x14ac42()));break;case _0x3071('0x58'):_0x1b35d3[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x40c258,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x1b35d3[_0x3071('0x59')](db['sequelize'][_0x3071('0x56')](_0x5bc69e(_0x40c258,'VoiceQueueId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x1b35d3;})[_0x3071('0x5a')]()[_0x3071('0x2f')](function(){return db[_0x3071('0x4f')][_0x3071('0x50')]({'where':{'type':_0x3071('0x51')},'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x138a94){var _0x1da477=[];if(_0x138a94){var _0x4f06c0;for(var _0x2a2e7a=0x0,_0x22ec7b;_0x2a2e7a<_0x138a94[_0x3071('0x1a')];_0x2a2e7a+=0x1){_0x22ec7b=_0x138a94[_0x2a2e7a]['get']({'plain':!![]});_0x1da477['push'](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x22ec7b,_0x3071('0x57')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}return _0x1da477;})[_0x3071('0x5a')]();})[_0x3071('0x2f')](function(){return db[_0x3071('0x5c')][_0x3071('0x50')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x53'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x3cc937){var _0x98d0fb=[];if(_0x3cc937){for(var _0x1fea60=0x0,_0x435dcb;_0x1fea60<_0x3cc937[_0x3071('0x1a')];_0x1fea60+=0x1){_0x435dcb=_0x3cc937[_0x1fea60]['get']({'plain':!![]});switch(_0x435dcb[_0x3071('0x52')]){case'always':_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x5c93c7(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;case _0x3071('0x58'):_0x98d0fb[_0x3071('0x59')](db[_0x3071('0x55')][_0x3071('0x56')](_0x4ce6d4(_0x435dcb,'CampaignId'))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));break;default:_0x98d0fb['push'](db[_0x3071('0x55')][_0x3071('0x56')](_0x5bc69e(_0x435dcb,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})[_0x3071('0x30')](_0x14ac42()));}}}return _0x98d0fb;})['all']();})['then'](function(){return db[_0x3071('0x5c')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x3071('0x5b')],'as':_0x3071('0x5e'),'where':{'id':LISTID}}]})[_0x3071('0x2f')](function(_0x136278){var _0x22783b=[];if(_0x136278){for(var _0x2f31b7=0x0,_0x568386;_0x2f31b7<_0x136278[_0x3071('0x1a')];_0x2f31b7+=0x1){_0x568386=_0x136278[_0x2f31b7][_0x3071('0x54')]({'plain':!![]});_0x22783b[_0x3071('0x59')](db[_0x3071('0x55')]['query'](_0x2e39ff(_0x568386,_0x3071('0x5d')))[_0x3071('0x2f')](function(){})['catch'](_0x14ac42()));}}return _0x22783b;})[_0x3071('0x5a')]();})[_0x3071('0x30')](function(_0x391887){logger[_0x3071('0x14')](_0x3071('0x5f'),'generalCheckHopper',_0x391887[_0x3071('0x1c')]);});}var processPromises=function(_0x479fe7){return BPromise[_0x3071('0x5a')](promises)[_0x3071('0x2f')](function(_0x39060f){})[_0x3071('0x30')](function(_0x1120ec){logger[_0x3071('0x14')](_0x3071('0x60'),JSON[_0x3071('0x32')](_0x1120ec));})['finally'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x479fe7){return _0x479fe7[_0x3071('0x63')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x3071('0x2f')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x3071('0x61')](_0x3071('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x3071('0x64')](FILEPATH);}catch(_0x5e0cbd){logger[_0x3071('0x14')](_0x3071('0x65'),JSON[_0x3071('0x32')](_0x5e0cbd));}finally{process[_0x3071('0x66')](0x0);}});};process['on'](_0x3071('0x67'),function(){logger[_0x3071('0x68')](_0x3071('0x69'));endCsv();});function main(){return BPromise[_0x3071('0x6a')]()[_0x3071('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x3071('0x2c')][_0x3071('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x3071('0x2f')](function(_0x5b2830){var _0x561030=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x561030,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4eb9e2,_0x8c77b7){total+=0x1;var _0x44b4c9=total;promises['push'](checkRow(_0x4eb9e2,_0x5b2830,_0x44b4c9)[_0x3071('0x2f')](function(){success+=0x1;})[_0x3071('0x30')](function(_0x1f61df){if(_0x1f61df['error']){errors+=0x1;delete _0x1f61df['error'];}else if(_0x1f61df[_0x3071('0x2a')]){duplicates+=0x1;delete _0x1f61df[_0x3071('0x2a')];}rows[_0x3071('0x59')](_0x1f61df);}));if(total%0xc8===0x0){_0x8c77b7[_0x3071('0x6b')]();return processPromises(_0x8c77b7);}},'complete':function(){return processPromises()[_0x3071('0x2f')](function(){logger[_0x3071('0x68')](_0x3071('0x6c'));endCsv();});},'error':function(_0x5eb60d,_0x58b62c){logger[_0x3071('0x68')](_0x3071('0x6d'),JSON[_0x3071('0x32')](_0x5eb60d));endCsv();}});})[_0x3071('0x30')](function(_0x5a3b64){logger[_0x3071('0x14')](_0x3071('0x6e'),JSON[_0x3071('0x32')](_0x5a3b64));});}main(); \ No newline at end of file +var _0xb7e7=['birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select','field','toString','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ContactId','cm_contacts','where','str','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','query','VoiceQueueId','onlyIfOpen','sequelize','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','createReadStream','parse','duplicate','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','papaparse','../../../mysqldb','../../../config/logger','api','redis','localhost','socket.io-emitter','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','error','contact','index','test','isNil','errors','length','map','join','data','phone','phone\x20not\x20specified!'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0xb7e7[_0x1b5aea];return _0x15cfc6;};'use strict';var BPromise=require(_0x7b7e('0x0'));var util=require('util');var _=require(_0x7b7e('0x1'));var fs=require('fs');var squel=require('squel');var Papa=require(_0x7b7e('0x2'));var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var config=require('../../../config/environment');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));config[_0x7b7e('0x6')]=_['defaults'](config['redis'],{'host':_0x7b7e('0x7'),'port':0x18eb});var socket=require(_0x7b7e('0x8'))(new Redis(config[_0x7b7e('0x6')]));require('../../../api/cmContact/cmContact.socket')[_0x7b7e('0x9')](socket);try{if(!process[_0x7b7e('0xa')][0x2]||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x2]===_0x7b7e('0xc')){throw new Error(_0x7b7e('0xd'));}var FILEPATH=process['argv'][0x2];if(!process[_0x7b7e('0xa')][0x3]||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x3]===_0x7b7e('0xc')||!process[_0x7b7e('0xa')][0x4]||process[_0x7b7e('0xa')][0x4]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x4]==='null'){throw new Error(_0x7b7e('0xe'));}var FIELDS=_[_0x7b7e('0xf')](process['argv'][0x3][_0x7b7e('0x10')](','),process['argv'][0x4]['split'](','));if(!process[_0x7b7e('0xa')][0x5]||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x5]===_0x7b7e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x7b7e('0xa')][0x6]&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x6]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x6]:null;var DUPLICATES=process[_0x7b7e('0xa')][0x7]&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xb')&&process[_0x7b7e('0xa')][0x7]!==_0x7b7e('0xc')?process[_0x7b7e('0xa')][0x7]:null;if(!process[_0x7b7e('0xa')][0x8]||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xb')||process[_0x7b7e('0xa')][0x8]===_0x7b7e('0xc')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x7b7e('0xa')][0x8];}catch(_0x43db4f){logger[_0x7b7e('0x11')](_0x43db4f);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(_0x4c0647,_0x313122,_0xbf0cb3,_0x14243b){var _0x200156={'message':_0x313122};_0x200156[_0x4c0647]=!![];if(_0xbf0cb3){_0x200156[_0x7b7e('0x12')]=_0xbf0cb3;}if(_0x14243b){_0x200156[_0x7b7e('0x13')]=_0x14243b;}return _0x200156;}function isEmail(_0x28bf43){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))*$/[_0x7b7e('0x14')](_0x28bf43);}function checkRow(_0x53bbb3,_0x5d6215,_0x4a836a){return new BPromise(function(_0x26ee14,_0x22598e){if(_[_0x7b7e('0x15')](_0x53bbb3)){return _0x22598e(handleCheckRowError('error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x4a836a));}if(_0x53bbb3['errors']&&_0x53bbb3[_0x7b7e('0x16')][_0x7b7e('0x17')]){var _0x16a3c7=_[_0x7b7e('0x18')](_0x53bbb3[_0x7b7e('0x16')],'message')[_0x7b7e('0x19')](';');return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x16a3c7,null,_0x4a836a));}var _0x4c46b8={};for(var _0x57b9da in FIELDS){if(FIELDS['hasOwnProperty'](_0x57b9da)&&FIELDS[_0x57b9da]){_0x4c46b8[_0x57b9da]=_0x53bbb3[_0x7b7e('0x1a')][0x0][FIELDS[_0x57b9da]]||_0x53bbb3[_0x7b7e('0x1a')][0x0]['\ufeff'+FIELDS[_0x57b9da]];}}if(!_0x4c46b8['firstName']){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'firstName\x20not\x20specified!',null,_0x4a836a));}if(!_0x4c46b8[_0x7b7e('0x1b')]){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x1c'),null,_0x4a836a));}if(_0x4c46b8['birthDate']){var _0x3960b8=moment(_0x4c46b8[_0x7b7e('0x1d')],_0x7b7e('0x1e'));if(!_0x3960b8[_0x7b7e('0x1f')]()){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4a836a));}}if(_0x4c46b8[_0x7b7e('0x20')]){if(!isEmail(_0x4c46b8['email'])){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x21'),null,_0x4a836a));}}_0x4c46b8[_0x7b7e('0x22')]=LISTID;_0x4c46b8[_0x7b7e('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){var _0x247ea0={};for(var _0x29cb58=0x0,_0x4bfe7f=DUPLICATES['length'];_0x29cb58<_0x4bfe7f;_0x29cb58+=0x1){_0x247ea0[DUPLICATES[_0x29cb58]]=_0x4c46b8[DUPLICATES[_0x29cb58]];}var _0xebcdbc=_[_0x7b7e('0x24')](_0x5d6215,_0x247ea0);if(_0xebcdbc){return _0x22598e(handleCheckRowError('duplicate',_0x7b7e('0x25'),_0xebcdbc,_0x4a836a));}}return db[_0x7b7e('0x26')][_0x7b7e('0x27')](_0x4c46b8,{'raw':!![],'hooks':![],'fields':_['keys'](_0x4c46b8)})[_0x7b7e('0x28')](function(_0x256908){if(DUPLICATES&&DUPLICATES[_0x7b7e('0x17')]&&_0x5d6215){_0x5d6215[_0x7b7e('0x29')](_[_0x7b7e('0x2a')](_0x4c46b8,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x256908['id'];return _0x26ee14();})[_0x7b7e('0x2b')](function(_0x3e8cf4){return _0x22598e(handleCheckRowError(_0x7b7e('0x11'),_0x7b7e('0x2c')+(_0x3e8cf4[_0x7b7e('0x2d')]||JSON[_0x7b7e('0x2e')](_0x3e8cf4)),null,_0x4a836a));});});}function checkHopper(){function _0x2d0620(){return function(_0x442366){logger[_0x7b7e('0x11')](_0x7b7e('0x2f'),_0x7b7e('0x30'),util['inspect'](_0x442366,{'showHidden':![],'depth':null}));};}var _0x8c80d5=function(_0x156dca,_0xb20532){var _0x242609=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),'ContactId',_0x7b7e('0x22'),_0xb20532,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))[_0x7b7e('0x39')]('NOW()','scheduledAt')[_0x7b7e('0x39')]('id','ContactId')[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x156dca['id'][_0x7b7e('0x3a')](),_0xb20532)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID['toString']())['where'](_0x7b7e('0x3f'))['where'](_0x7b7e('0x40'),squel['select']()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xb20532+_0x7b7e('0x41'),_0x156dca['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x242609;};var _0x37895a=function(_0x3e4f21,_0xccdfc7){var _0x5e8572=squel['insert']()['into'](_0x7b7e('0x33'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x35'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0xccdfc7,'createdAt',_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))['field'](LISTID[_0x7b7e('0x3a')](),'ListId')[_0x7b7e('0x39')](_0x3e4f21['id'][_0x7b7e('0x3a')](),_0xccdfc7)[_0x7b7e('0x39')](_0x7b7e('0x3b'),'createdAt')[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())[_0x7b7e('0x44')]('id\x20IN\x20?',squel[_0x7b7e('0x45')](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f'))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')]('calleridnum')[_0x7b7e('0x3c')]('cm_hopper_final')[_0x7b7e('0x44')](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id']['toString']()))[_0x7b7e('0x44')](_0x7b7e('0x40'),squel[_0x7b7e('0x38')]()[_0x7b7e('0x39')](_0x7b7e('0x1b'))[_0x7b7e('0x3c')](_0x7b7e('0x33'))['where'](_0xccdfc7+_0x7b7e('0x41'),_0x3e4f21['id'][_0x7b7e('0x3a')]())))[_0x7b7e('0x3a')]();return _0x5e8572;};function _0x24481a(_0x5b9ab5,_0x527403){var _0x5bdf1d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x33'))['fromQuery'](['phone',_0x7b7e('0x35'),_0x7b7e('0x42'),'ListId',_0x527403,_0x7b7e('0x36'),_0x7b7e('0x37')],squel[_0x7b7e('0x38')]()['field'](_0x7b7e('0x1b'),_0x7b7e('0x1b'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x35'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID[_0x7b7e('0x3a')](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5b9ab5['id'][_0x7b7e('0x3a')](),_0x527403)['field'](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),_0x7b7e('0x37'))[_0x7b7e('0x3c')]('cm_contacts')[_0x7b7e('0x44')]('deletedAt\x20IS\x20NULL')[_0x7b7e('0x44')](_0x7b7e('0x3e'),LISTID['toString']())[_0x7b7e('0x44')](_0x7b7e('0x46'),squel['str'](hopperContacts))[_0x7b7e('0x44')](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x5bdf1d;}function _0x3b1adb(_0x5eb32c,_0x101896){var _0x73904d=squel[_0x7b7e('0x31')]()[_0x7b7e('0x32')](_0x7b7e('0x47'))[_0x7b7e('0x34')]([_0x7b7e('0x1b'),_0x7b7e('0x42'),_0x7b7e('0x22'),_0x101896,_0x7b7e('0x36'),'updatedAt'],squel[_0x7b7e('0x38')]()['field']('phone',_0x7b7e('0x1b'))[_0x7b7e('0x39')]('id',_0x7b7e('0x42'))[_0x7b7e('0x39')](LISTID['toString'](),_0x7b7e('0x22'))[_0x7b7e('0x39')](_0x5eb32c['id'][_0x7b7e('0x3a')](),_0x101896)[_0x7b7e('0x39')](_0x7b7e('0x3b'),_0x7b7e('0x36'))['field'](_0x7b7e('0x3b'),'updatedAt')['from'](_0x7b7e('0x43'))['where'](_0x7b7e('0x3d'))['where'](_0x7b7e('0x3e'),LISTID[_0x7b7e('0x3a')]())['where'](_0x7b7e('0x46'),squel[_0x7b7e('0x45')](hopperContacts))['where'](_0x7b7e('0x3f')))[_0x7b7e('0x3a')]();return _0x73904d;}return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id',_0x7b7e('0x4b')],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x17e5ba){var _0x589b02=[];if(_0x17e5ba){var _0x59ecf9;for(var _0x34e7df=0x0,_0x46ac1f;_0x34e7df<_0x17e5ba[_0x7b7e('0x17')];_0x34e7df+=0x1){_0x46ac1f=_0x17e5ba[_0x34e7df][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x46ac1f[_0x7b7e('0x4b')]){case _0x7b7e('0x4f'):_0x589b02[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x46ac1f,_0x7b7e('0x51')))['then'](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case _0x7b7e('0x52'):_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x46ac1f,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x589b02[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x46ac1f,'VoiceQueueId'))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x589b02;})[_0x7b7e('0x54')]()[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x48')][_0x7b7e('0x49')]({'where':{'type':_0x7b7e('0x4a')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1eb5ce){var _0x49f0a4=[];if(_0x1eb5ce){var _0x1d6aa4;for(var _0x195ae2=0x0,_0x381ee6;_0x195ae2<_0x1eb5ce[_0x7b7e('0x17')];_0x195ae2+=0x1){_0x381ee6=_0x1eb5ce[_0x195ae2][_0x7b7e('0x4e')]({'plain':!![]});_0x49f0a4['push'](db['sequelize']['query'](_0x3b1adb(_0x381ee6,_0x7b7e('0x51')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}return _0x49f0a4;})['all']();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x7b7e('0x4c')],'as':_0x7b7e('0x4d'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x34a06c){var _0x538c5f=[];if(_0x34a06c){for(var _0x315923=0x0,_0x40b4ae;_0x315923<_0x34a06c[_0x7b7e('0x17')];_0x315923+=0x1){_0x40b4ae=_0x34a06c[_0x315923][_0x7b7e('0x4e')]({'plain':!![]});switch(_0x40b4ae['dialCheckDuplicateType']){case'always':_0x538c5f[_0x7b7e('0x29')](db['sequelize'][_0x7b7e('0x50')](_0x37895a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;case'onlyIfOpen':_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x8c80d5(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));break;default:_0x538c5f[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x24481a(_0x40b4ae,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})[_0x7b7e('0x2b')](_0x2d0620()));}}}return _0x538c5f;})[_0x7b7e('0x54')]();})[_0x7b7e('0x28')](function(){return db[_0x7b7e('0x56')][_0x7b7e('0x49')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x7b7e('0x55'),'where':{'id':LISTID}}]})[_0x7b7e('0x28')](function(_0x1d9e08){var _0xa03d7a=[];if(_0x1d9e08){for(var _0x10c35e=0x0,_0x302462;_0x10c35e<_0x1d9e08[_0x7b7e('0x17')];_0x10c35e+=0x1){_0x302462=_0x1d9e08[_0x10c35e]['get']({'plain':!![]});_0xa03d7a[_0x7b7e('0x29')](db[_0x7b7e('0x53')][_0x7b7e('0x50')](_0x3b1adb(_0x302462,_0x7b7e('0x57')))[_0x7b7e('0x28')](function(){})['catch'](_0x2d0620()));}}return _0xa03d7a;})['all']();})[_0x7b7e('0x2b')](function(_0x110f2b){logger[_0x7b7e('0x11')](_0x7b7e('0x58'),_0x7b7e('0x59'),_0x110f2b[_0x7b7e('0x2d')]);});}var processPromises=function(_0x2c65b8){return BPromise[_0x7b7e('0x54')](promises)[_0x7b7e('0x28')](function(_0x850d0f){})['catch'](function(_0x27402a){logger[_0x7b7e('0x11')](_0x7b7e('0x5a'),JSON[_0x7b7e('0x2e')](_0x27402a));})[_0x7b7e('0x5b')](function(){socket[_0x7b7e('0x5c')](_0x7b7e('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2c65b8){return _0x2c65b8['resume']();}});};var endCsv=function(){return BPromise[_0x7b7e('0x5e')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x7b7e('0x28')](function(){socket[_0x7b7e('0x5c')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7b7e('0x5f')](FILEPATH);}catch(_0x38fd40){logger[_0x7b7e('0x11')](_0x7b7e('0x60'),JSON[_0x7b7e('0x2e')](_0x38fd40));}finally{process['exit'](0x0);}});};process['on'](_0x7b7e('0x61'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x7b7e('0x5e')]()[_0x7b7e('0x28')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x7b7e('0x10')](',');return db[_0x7b7e('0x26')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7b7e('0x28')](function(_0x5cedd4){var _0x25233a=fs[_0x7b7e('0x62')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x7b7e('0x63')](_0x25233a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1e71ab,_0x11d615){total+=0x1;var _0x3afd15=total;promises[_0x7b7e('0x29')](checkRow(_0x1e71ab,_0x5cedd4,_0x3afd15)['then'](function(){success+=0x1;})[_0x7b7e('0x2b')](function(_0x30eeee){if(_0x30eeee['error']){errors+=0x1;delete _0x30eeee[_0x7b7e('0x11')];}else if(_0x30eeee[_0x7b7e('0x64')]){duplicates+=0x1;delete _0x30eeee[_0x7b7e('0x64')];}rows[_0x7b7e('0x29')](_0x30eeee);}));if(total%0xc8===0x0){_0x11d615[_0x7b7e('0x65')]();return processPromises(_0x11d615);}},'complete':function(){return processPromises()[_0x7b7e('0x28')](function(){logger[_0x7b7e('0x66')](_0x7b7e('0x67'));endCsv();});},'error':function(_0x41e2b5,_0x97232d){logger[_0x7b7e('0x66')](_0x7b7e('0x68'),JSON[_0x7b7e('0x2e')](_0x41e2b5));endCsv();}});})[_0x7b7e('0x2b')](function(_0x12d0cb){logger[_0x7b7e('0x11')](_0x7b7e('0x69'),JSON[_0x7b7e('0x2e')](_0x12d0cb));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 3bca80e..69bbca9 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 _0x7ee4=['\x20not\x20specified','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil','scheduledat',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','campaigns','each','finish','affectedRows','unlink','catch','complete','argv','arguments\x20\x20\x20','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','lodash','papaparse','bluebird','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','phone','ContactId','ListId','createdAt','updatedAt','UserId','recallme','select','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.phone','cm_contacts.createdAt','cm_hopper_black','fromQuery','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','field','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','sequelize','query','spread','push','main','stringify','send','start','binding','root','server/files/tmp','.csv','parse','length','hasOwnProperty','data','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNumber','includes','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName'];(function(_0x27662c,_0x2a1fb8){var _0x404352=function(_0x2bae35){while(--_0x2bae35){_0x27662c['push'](_0x27662c['shift']());}};_0x404352(++_0x2a1fb8);}(_0x7ee4,0xac));var _0x47ee=function(_0x552203,_0x530526){_0x552203=_0x552203-0x0;var _0x3dab1e=_0x7ee4[_0x552203];return _0x3dab1e;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x47ee('0x0'));var Papa=require(_0x47ee('0x1'));var util=require('util');var BPromise=require(_0x47ee('0x2'));var moment=require('moment');var squel=require('squel');var Redis=require(_0x47ee('0x3'));var db=require(_0x47ee('0x4'))['db'];var config=require(_0x47ee('0x5'));var logger=require(_0x47ee('0x6'))(_0x47ee('0x7'));config['redis']=_['defaults'](config[_0x47ee('0x8')],{'host':_0x47ee('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47ee('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x47ee('0xa')](_0x47ee('0xb'));function isEmail(_0x39f6dc){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))*$/[_0x47ee('0xc')](_0x39f6dc);}function selectNotIn(_0x45906a,_0x547b9d,_0x253944,_0x4cb1ee,_0x6ea246){return squel['select']()['field']('phone')[_0x47ee('0xd')](_0x4cb1ee)[_0x47ee('0xe')](_0x547b9d,null,_0x547b9d+_0x47ee('0xf')+_0x4cb1ee+'.'+_0x253944)[_0x47ee('0x10')](_0x4cb1ee+'.'+_0x253944+_0x47ee('0x11')+_0x45906a+'.'+_0x253944)['where'](_0x547b9d+_0x47ee('0x12')+_0x6ea246[_0x47ee('0xe')]()+')');}function insertCmHopper(_0x412ebb,_0x5213bf,_0x112d46,_0x57680b,_0x1667f7){var _0x50489a=['cm_contacts.phone',_0x47ee('0x13'),_0x47ee('0x14'),_0x47ee('0x15'),_0x5213bf+'.'+_0x57680b,'cm_contacts.createdAt',_0x47ee('0x16'),'cm_contacts.priority',_0x47ee('0x17'),'\x22'+_0x1667f7+'\x22'];return squel[_0x47ee('0x18')]()[_0x47ee('0x19')](_0x47ee('0x1a'))['fromQuery']([_0x47ee('0x1b'),'scheduledat',_0x47ee('0x1c'),_0x47ee('0x1d'),_0x57680b,_0x47ee('0x1e'),_0x47ee('0x1f'),'priority',_0x47ee('0x20'),_0x47ee('0x21')],squel[_0x47ee('0x22')]()[_0x47ee('0x23')](_0x50489a)[_0x47ee('0xd')](_0x5213bf)[_0x47ee('0xe')](_0x47ee('0x24'),null,'cm_contacts.ListId\x20=\x20'+_0x5213bf+_0x47ee('0x25'))[_0x47ee('0xe')](_0x112d46,null,_0x112d46+_0x47ee('0xf')+_0x5213bf+'.'+_0x57680b)[_0x47ee('0x10')](_0x5213bf+_0x47ee('0x26'),_0x412ebb)['where'](_0x47ee('0x27'),NOW)[_0x47ee('0x10')](_0x47ee('0x28'),selectNotIn(_0x5213bf,_0x112d46,_0x57680b,'cm_hopper',[_0x47ee('0x29'),'\x22onlyIfOpen\x22']))[_0x47ee('0x10')](_0x47ee('0x28'),selectNotIn(_0x5213bf,_0x112d46,_0x57680b,_0x47ee('0x1a'),[_0x47ee('0x29')])))[_0x47ee('0x2a')]();}function insertCmHopperBlack(_0x1defe9,_0x29054d,_0x2a8c01,_0x1411c0){var _0x2c4262=[_0x47ee('0x2b'),_0x47ee('0x14'),_0x47ee('0x15'),_0x29054d+'.'+_0x1411c0,_0x47ee('0x2c'),_0x47ee('0x16')];return squel[_0x47ee('0x18')]()[_0x47ee('0x19')](_0x47ee('0x2d'))[_0x47ee('0x2e')]([_0x47ee('0x1b'),_0x47ee('0x1c'),_0x47ee('0x1d'),_0x1411c0,_0x47ee('0x1e'),_0x47ee('0x1f')],squel[_0x47ee('0x22')]()[_0x47ee('0x23')](_0x2c4262)[_0x47ee('0xd')](_0x29054d)[_0x47ee('0xe')]('cm_contacts',null,_0x47ee('0x2f')+_0x29054d+_0x47ee('0x25'))[_0x47ee('0xe')](_0x2a8c01,null,_0x2a8c01+_0x47ee('0xf')+_0x29054d+'.'+_0x1411c0)[_0x47ee('0x10')](_0x29054d+_0x47ee('0x26'),_0x1defe9)[_0x47ee('0x10')](_0x47ee('0x27'),NOW)[_0x47ee('0x10')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x47ee('0x22')]()['field'](_0x47ee('0x1b'))['from'](_0x47ee('0x2d'))[_0x47ee('0x10')](_0x47ee('0x30'),_0x1defe9)[_0x47ee('0x10')](_0x1411c0+'\x20=\x20?',_0x29054d+'.'+_0x1411c0)))[_0x47ee('0x2a')]();}function insertCmContact(_0x507ddb,_0x3b0ee6,_0x13cad8,_0x2c5530){var _0x5e97bf=_[_0x47ee('0x31')](_[_0x47ee('0x32')](_0x2c5530),[_0x47ee('0x1d'),_0x47ee('0x33'),_0x47ee('0x1e'),_0x47ee('0x1f')]);return squel[_0x47ee('0x18')]()['into'](_0x47ee('0x24'))['fromQuery'](_0x5e97bf,squel[_0x47ee('0x22')]()[_0x47ee('0x23')](_0x5e97bf)[_0x47ee('0xd')](_0x3b0ee6)[_0x47ee('0x10')]('('+_0x13cad8[_0x47ee('0xe')](',')+_0x47ee('0x34'),squel['select']()[_0x47ee('0x23')](_0x13cad8)[_0x47ee('0xd')]('cm_contacts')[_0x47ee('0x10')](_0x47ee('0x30'),_0x507ddb)[_0x47ee('0x10')](_0x47ee('0x35')))['where'](_0x47ee('0x36'),squel[_0x47ee('0x22')]()[_0x47ee('0x37')](_0x47ee('0x38'),_0x47ee('0x39'))[_0x47ee('0xd')](_0x3b0ee6)[_0x47ee('0x3a')](_0x13cad8[_0x47ee('0xe')](','))))[_0x47ee('0x2a')]();}function handleStop(){logger[_0x47ee('0x3b')](_0x47ee('0x3c'));stopped=!![];}function handleUncaughtException(_0x1b4392){logger[_0x47ee('0x3d')](_0x1b4392[_0x47ee('0x3e')]);process[_0x47ee('0x3f')](0x1);}function handleError(_0x5ab98a,_0x3ae2c9){stats[_0x47ee('0x40')]['push']({'name':_0x3ae2c9['code'],'message':_0x3ae2c9[_0x47ee('0x3e')],'row':_0x5ab98a});}function handleQuery(_0x4ca492){logger[_0x47ee('0x3b')](_0x4ca492);return db[_0x47ee('0x41')][_0x47ee('0x42')](_0x4ca492)[_0x47ee('0x43')](function(_0x467778){results[_0x47ee('0x44')](_0x467778);})['catch'](function(_0x1b9ad1){logger[_0x47ee('0x3d')](_0x1b9ad1[_0x47ee('0x3e')]);});}function main(_0x1093ee,_0x2f0ca5,_0xa54ee0,_0x149a36){logger[_0x47ee('0x3b')](_0x47ee('0x45'),_0x1093ee,JSON[_0x47ee('0x46')](_0x2f0ca5));process[_0x47ee('0x47')](_0x47ee('0x48'));var _0x3fc5c5=_0x2f0ca5[_0x47ee('0x49')];var _0x4610ee=_0x2f0ca5['socket_timestamp'];var _0x4c95b4=path[_0x47ee('0xe')](config[_0x47ee('0x4a')],_0x47ee('0x4b'),_0x4610ee+_0x47ee('0x4c'));var _0x53dc0b=_[_0x47ee('0x32')](_0x3fc5c5)[_0x47ee('0xe')]();logger['info']('header',_0x53dc0b);fs['writeFileSync'](_0x4c95b4,_0x53dc0b+'\x0a');Papa[_0x47ee('0x4d')](fs['createReadStream'](_0x1093ee),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2278d8,_0x534168){try{for(var _0x4f9757=0x0,_0x9141e1=[];_0x4f9757<_0x2278d8['data'][_0x47ee('0x4e')];_0x4f9757++){stats['rows']+=0x1;if(_0x2278d8[_0x47ee('0x40')][_0x4f9757]){handleError(_0x2278d8['data'][_0x4f9757],_0x2278d8[_0x47ee('0x40')][_0x4f9757]);}else{var _0x2c4b09=[];for(var _0x37b866 in _0x3fc5c5){if(_0x3fc5c5[_0x47ee('0x4f')](_0x37b866)){if(_0x2278d8[_0x47ee('0x50')][_0x4f9757][_0x3fc5c5[_0x37b866]]){var _0x554978=_[_0x47ee('0x51')](_0x2278d8[_0x47ee('0x50')][_0x4f9757][_0x3fc5c5[_0x37b866]]['replace'](/"/g,'\x27'));switch(_0x37b866){case'scheduledat':var _0x306c11=moment(_0x554978,_0x47ee('0xb'),!![]);if(_0x306c11[_0x47ee('0x52')]()){_0x9141e1[_0x47ee('0x44')]('\x22'+_0x554978+'\x22');}else{_0x2c4b09[_0x47ee('0x44')](_0x47ee('0x53'));}break;case _0x47ee('0x54'):var _0x25935e=parseInt(_0x554978);_0x554978=_['isNaN'](_0x25935e)||_0x25935e<0x0||_0x25935e>0x4?_0x149a36?0x3:0x2:_0x25935e;_0x9141e1[_0x47ee('0x44')]('\x22'+_0x554978+'\x22');break;case _0x47ee('0x20'):var _0x3b7454=parseInt(_0x554978);if(_[_0x47ee('0x55')](_0x3b7454)&&_[_0x47ee('0x56')](_0xa54ee0,_0x3b7454)){_0x9141e1[_0x47ee('0x44')]('\x22'+_0x3b7454+'\x22');}else{_0x2c4b09[_0x47ee('0x44')]('agent\x20not\x20exists');}break;case _0x47ee('0x57'):if(isEmail(_0x554978)){_0x9141e1[_0x47ee('0x44')]('\x22'+_0x554978+'\x22');}else{_0x2c4b09[_0x47ee('0x44')]('email\x20wrong\x20format');}break;case _0x47ee('0x58'):var _0x5186d8=moment(_0x554978,_0x47ee('0x59'),!![]);if(_0x5186d8[_0x47ee('0x52')]()){_0x9141e1['push']('\x22'+_0x554978+'\x22');}else{_0x2c4b09[_0x47ee('0x44')](_0x47ee('0x5a'));}break;default:_0x9141e1[_0x47ee('0x44')]('\x22'+_0x554978+'\x22');}}else{switch(_0x37b866){case _0x47ee('0x5b'):case _0x47ee('0x1b'):_0x2c4b09[_0x47ee('0x44')](_0x37b866+_0x47ee('0x5c'));break;default:_0x9141e1[_0x47ee('0x44')]('\x22\x22');}}}}if(_0x2c4b09['length']){handleError(_0x2278d8[_0x47ee('0x50')][_0x4f9757],{'code':_0x47ee('0x5d'),'message':_0x2c4b09[_0x47ee('0xe')]()});}else{fs[_0x47ee('0x5e')](_0x4c95b4,_0x9141e1[_0x47ee('0xe')]()+'\x0a');}_0x9141e1=[];}if(!(stats[_0x47ee('0x5f')]%0xc8)){socket[_0x47ee('0x60')](_0x47ee('0x61')+_0x4610ee,stats);stats[_0x47ee('0x40')]=[];}}if(stopped){logger['info'](_0x47ee('0x62'));_0x534168[_0x47ee('0x63')]();}}catch(_0x21ed82){handleError(_0x2278d8[_0x47ee('0x50')][_0x4f9757],{'code':_0x47ee('0x64'),'message':_0x21ed82[_0x47ee('0x3e')]});logger[_0x47ee('0x3d')](_0x47ee('0x65'),_0x21ed82[_0x47ee('0x3e')]);}},'complete':function(){try{var _0x3399ef=[];var _0x2b1bcc=_0x47ee('0x24');if(_0x2f0ca5['duplicates']&&_0x2f0ca5[_0x47ee('0x66')][_0x47ee('0x4e')]){_0x2b1bcc=_0x47ee('0x67')+_0x4610ee;_0x3399ef[_0x47ee('0x44')](_0x47ee('0x68')+_0x2b1bcc+'\x20LIKE\x20cm_contacts;');}var _0x35c3f5=util['format'](_0x47ee('0x69'),_0x4c95b4,_0x2b1bcc,_0x53dc0b,_0x2f0ca5[_0x47ee('0x1d')],_0x2f0ca5[_0x47ee('0x33')]||null,NOW,NOW);if(_[_0x47ee('0x6a')](_0x3fc5c5[_0x47ee('0x6b')])){_0x35c3f5+=_0x47ee('0x6c');}_0x3399ef[_0x47ee('0x44')](_0x35c3f5);if(_0x2f0ca5[_0x47ee('0x66')]&&_0x2f0ca5[_0x47ee('0x66')]['length']){_0x3399ef[_0x47ee('0x44')](insertCmContact(_0x2f0ca5[_0x47ee('0x1d')],_0x2b1bcc,_0x2f0ca5[_0x47ee('0x66')],_0x3fc5c5));_0x3399ef[_0x47ee('0x44')](_0x47ee('0x6d')+_0x2b1bcc+';');}_0x3399ef[_0x47ee('0x44')](insertCmHopper(_0x2f0ca5[_0x47ee('0x1d')],_0x47ee('0x6e'),_0x47ee('0x6f'),_0x47ee('0x70'),_0x149a36));_0x3399ef[_0x47ee('0x44')](insertCmHopperBlack(_0x2f0ca5[_0x47ee('0x1d')],_0x47ee('0x71'),_0x47ee('0x6f'),_0x47ee('0x70')));_0x3399ef[_0x47ee('0x44')](insertCmHopper(_0x2f0ca5['ListId'],'campaigns_has_cm_lists','campaigns',_0x47ee('0x72'),_0x149a36));_0x3399ef[_0x47ee('0x44')](insertCmHopperBlack(_0x2f0ca5['ListId'],_0x47ee('0x73'),_0x47ee('0x74'),_0x47ee('0x72')));BPromise[_0x47ee('0x75')](_0x3399ef,handleQuery)['then'](function(_0x4e1e80){stats[_0x47ee('0x76')]=!![];stats[_0x47ee('0x77')]=_0x2f0ca5[_0x47ee('0x66')]&&_0x2f0ca5[_0x47ee('0x66')][_0x47ee('0x4e')]?results[0x2][_0x47ee('0x77')]:results[0x0][_0x47ee('0x77')];socket[_0x47ee('0x60')](_0x47ee('0x61')+_0x4610ee,stats);fs[_0x47ee('0x78')](_0x1093ee);fs[_0x47ee('0x78')](_0x4c95b4);process['exit'](0x0);})[_0x47ee('0x79')](function(_0x229529){logger[_0x47ee('0x3d')](_0x229529[_0x47ee('0x3e')]);process[_0x47ee('0x3f')](0x1);});}catch(_0x321bdc){logger[_0x47ee('0x3d')](_0x47ee('0x7a'),_0x321bdc['message']);process[_0x47ee('0x3f')](0x1);}},'error':function(_0x3be462,_0x583471,_0x34dabc,_0x3d9225){throw new Error(_0x3d9225);}});}function validate(){if(process[_0x47ee('0x7b')]&&process[_0x47ee('0x7b')][_0x47ee('0x4e')]<0x4){throw new Error(_0x47ee('0x7c'));}var _0x554376=path[_0x47ee('0xe')](config[_0x47ee('0x4a')],'server/files/tmp',process[_0x47ee('0x7b')][0x2]);if(!fs['existsSync'](_0x554376)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x1770fe={};try{_0x1770fe=JSON['parse'](process['argv'][0x3]);if(!_0x1770fe[_0x47ee('0x49')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x1770fe['binding'][_0x47ee('0x1b')]){throw new Error(_0x47ee('0x7d'));}if(!_0x1770fe['binding'][_0x47ee('0x5b')]){throw new Error(_0x47ee('0x7e'));}var _0x54c942=0x0;if(_0x1770fe['binding'][_0x47ee('0x20')]){_0x54c942=0x1;}if(!_0x1770fe[_0x47ee('0x1d')]){throw new Error(_0x47ee('0x7f'));}}catch(_0x997427){throw new Error(_0x47ee('0x80'));}var _0x347498=[];try{_0x347498=_[_0x47ee('0x81')](JSON['parse'](process[_0x47ee('0x7b')][0x4]),'id');}catch(_0x23a12a){logger[_0x47ee('0x3b')]('No\x20agent\x20available');}main(_0x554376,_0x1770fe,_0x347498,_0x54c942);}validate();process['on'](_0x47ee('0x82'),handleStop);process['on'](_0x47ee('0x83'),handleUncaughtException); \ No newline at end of file +var _0x1fd7=['message','exit','errors','code','info','sequelize','query','spread','catch','main','stringify','send','root','server/files/tmp','.csv','header','writeFileSync','createReadStream','length','rows','data','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','push','includes','agent\x20not\x20exists','email\x20wrong\x20format','firstName','SystemRow','appendFileSync','emit','Abort\x20parser','abort','SystemError','duplicates','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','lodash','papaparse','util','squel','ioredis','../../../config/environment','../../../config/logger','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_hopper_black','ListId','createdAt','.CmListId\x20=\x20?','toString','keys','CompanyId','updatedAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','Received\x20SIGINT','error'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x1fd7,0x12e));var _0x71fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1fd7[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x71fd('0x0'));var Papa=require(_0x71fd('0x1'));var util=require(_0x71fd('0x2'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0x71fd('0x3'));var Redis=require(_0x71fd('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x71fd('0x5'));var logger=require(_0x71fd('0x6'))('import');config['redis']=_['defaults'](config[_0x71fd('0x7')],{'host':_0x71fd('0x8'),'port':0x18eb});var socket=require(_0x71fd('0x9'))(new Redis(config[_0x71fd('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x71fd('0xa')](_0x71fd('0xb'));function isEmail(_0x5d80bd){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))*$/[_0x71fd('0xc')](_0x5d80bd);}function selectNotIn(_0x5b9fb3,_0x277a01,_0x3a18a2,_0x1c7c57,_0x57587a){return squel[_0x71fd('0xd')]()[_0x71fd('0xe')](_0x71fd('0xf'))[_0x71fd('0x10')](_0x1c7c57)[_0x71fd('0x11')](_0x277a01,null,_0x277a01+_0x71fd('0x12')+_0x1c7c57+'.'+_0x3a18a2)[_0x71fd('0x13')](_0x1c7c57+'.'+_0x3a18a2+_0x71fd('0x14')+_0x5b9fb3+'.'+_0x3a18a2)[_0x71fd('0x13')](_0x277a01+_0x71fd('0x15')+_0x57587a[_0x71fd('0x11')]()+')');}function insertCmHopper(_0x49a4f4,_0x4b7b70,_0x5cb069,_0x118fe7,_0x21a421){var _0x38fdf4=[_0x71fd('0x16'),'cm_contacts.scheduledat',_0x71fd('0x17'),'cm_contacts.ListId',_0x4b7b70+'.'+_0x118fe7,_0x71fd('0x18'),_0x71fd('0x19'),'cm_contacts.priority',_0x71fd('0x1a'),'\x22'+_0x21a421+'\x22'];return squel[_0x71fd('0x1b')]()[_0x71fd('0x1c')](_0x71fd('0x1d'))[_0x71fd('0x1e')]([_0x71fd('0xf'),_0x71fd('0x1f'),_0x71fd('0x20'),'ListId',_0x118fe7,'createdAt','updatedAt',_0x71fd('0x21'),_0x71fd('0x22'),_0x71fd('0x23')],squel[_0x71fd('0xd')]()[_0x71fd('0x24')](_0x38fdf4)['from'](_0x4b7b70)[_0x71fd('0x11')](_0x71fd('0x25'),null,_0x71fd('0x26')+_0x4b7b70+_0x71fd('0x27'))[_0x71fd('0x11')](_0x5cb069,null,_0x5cb069+_0x71fd('0x12')+_0x4b7b70+'.'+_0x118fe7)[_0x71fd('0x13')](_0x4b7b70+'.CmListId\x20=\x20?',_0x49a4f4)['where'](_0x71fd('0x28'),NOW)[_0x71fd('0x13')](_0x71fd('0x29'),selectNotIn(_0x4b7b70,_0x5cb069,_0x118fe7,_0x71fd('0x1d'),[_0x71fd('0x2a'),_0x71fd('0x2b')]))[_0x71fd('0x13')](_0x71fd('0x29'),selectNotIn(_0x4b7b70,_0x5cb069,_0x118fe7,_0x71fd('0x1d'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x5d0149,_0x2841df,_0x1d763c,_0xbed8e8){var _0x557a35=[_0x71fd('0x16'),_0x71fd('0x17'),'cm_contacts.ListId',_0x2841df+'.'+_0xbed8e8,_0x71fd('0x18'),'cm_contacts.updatedAt'];return squel[_0x71fd('0x1b')]()[_0x71fd('0x1c')](_0x71fd('0x2c'))['fromQuery']([_0x71fd('0xf'),_0x71fd('0x20'),_0x71fd('0x2d'),_0xbed8e8,_0x71fd('0x2e'),'updatedAt'],squel[_0x71fd('0xd')]()[_0x71fd('0x24')](_0x557a35)[_0x71fd('0x10')](_0x2841df)['join'](_0x71fd('0x25'),null,_0x71fd('0x26')+_0x2841df+_0x71fd('0x27'))[_0x71fd('0x11')](_0x1d763c,null,_0x1d763c+'.id\x20=\x20'+_0x2841df+'.'+_0xbed8e8)['where'](_0x2841df+_0x71fd('0x2f'),_0x5d0149)[_0x71fd('0x13')](_0x71fd('0x28'),NOW)[_0x71fd('0x13')](_0x71fd('0x29'),squel[_0x71fd('0xd')]()['field'](_0x71fd('0xf'))[_0x71fd('0x10')]('cm_hopper_black')[_0x71fd('0x13')]('ListId\x20=\x20?',_0x5d0149)[_0x71fd('0x13')](_0xbed8e8+'\x20=\x20?',_0x2841df+'.'+_0xbed8e8)))[_0x71fd('0x30')]();}function insertCmContact(_0x410947,_0xbcc14a,_0x308400,_0x307b4f){var _0x3e4322=_['concat'](_[_0x71fd('0x31')](_0x307b4f),[_0x71fd('0x2d'),_0x71fd('0x32'),'createdAt',_0x71fd('0x33')]);return squel[_0x71fd('0x1b')]()[_0x71fd('0x1c')]('cm_contacts')[_0x71fd('0x1e')](_0x3e4322,squel['select']()[_0x71fd('0x24')](_0x3e4322)['from'](_0xbcc14a)['where']('('+_0x308400['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x71fd('0xd')]()[_0x71fd('0x24')](_0x308400)[_0x71fd('0x10')](_0x71fd('0x25'))[_0x71fd('0x13')]('ListId\x20=\x20?',_0x410947)['where'](_0x71fd('0x34')))[_0x71fd('0x13')](_0x71fd('0x35'),squel[_0x71fd('0xd')]()[_0x71fd('0xe')](_0x71fd('0x36'),_0x71fd('0x37'))[_0x71fd('0x10')](_0xbcc14a)['group'](_0x308400[_0x71fd('0x11')](','))))['toString']();}function handleStop(){logger['info'](_0x71fd('0x38'));stopped=!![];}function handleUncaughtException(_0x3aab45){logger[_0x71fd('0x39')](_0x3aab45[_0x71fd('0x3a')]);process[_0x71fd('0x3b')](0x1);}function handleError(_0x55f649,_0x4cc9b7){stats[_0x71fd('0x3c')]['push']({'name':_0x4cc9b7[_0x71fd('0x3d')],'message':_0x4cc9b7['message'],'row':_0x55f649});}function handleQuery(_0xf78eb8){logger[_0x71fd('0x3e')](_0xf78eb8);return db[_0x71fd('0x3f')][_0x71fd('0x40')](_0xf78eb8)[_0x71fd('0x41')](function(_0x135bf5){results['push'](_0x135bf5);})[_0x71fd('0x42')](function(_0x51ff67){logger[_0x71fd('0x39')](_0x51ff67['message']);});}function main(_0x402cbe,_0x473776,_0x20ab41,_0x465faf){logger[_0x71fd('0x3e')](_0x71fd('0x43'),_0x402cbe,JSON[_0x71fd('0x44')](_0x473776));process[_0x71fd('0x45')]('start');var _0x1cb100=_0x473776['binding'];var _0x5632a6=_0x473776['socket_timestamp'];var _0x2d3867=path[_0x71fd('0x11')](config[_0x71fd('0x46')],_0x71fd('0x47'),_0x5632a6+_0x71fd('0x48'));var _0x30d3b1=_[_0x71fd('0x31')](_0x1cb100)[_0x71fd('0x11')]();logger['info'](_0x71fd('0x49'),_0x30d3b1);fs[_0x71fd('0x4a')](_0x2d3867,_0x30d3b1+'\x0a');Papa['parse'](fs[_0x71fd('0x4b')](_0x402cbe),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5c80f3,_0x595574){try{for(var _0x5972ca=0x0,_0x1f9961=[];_0x5972ca<_0x5c80f3['data'][_0x71fd('0x4c')];_0x5972ca++){stats[_0x71fd('0x4d')]+=0x1;if(_0x5c80f3[_0x71fd('0x3c')][_0x5972ca]){handleError(_0x5c80f3[_0x71fd('0x4e')][_0x5972ca],_0x5c80f3['errors'][_0x5972ca]);}else{var _0x1691da=[];for(var _0x42f6a3 in _0x1cb100){if(_0x1cb100['hasOwnProperty'](_0x42f6a3)){if(_0x5c80f3[_0x71fd('0x4e')][_0x5972ca][_0x1cb100[_0x42f6a3]]){var _0x5c9d03=_[_0x71fd('0x4f')](_0x5c80f3[_0x71fd('0x4e')][_0x5972ca][_0x1cb100[_0x42f6a3]]['replace'](/"/g,'\x27'));switch(_0x42f6a3){case'scheduledat':var _0x376f23=moment(_0x5c9d03,_0x71fd('0xb'),!![]);if(_0x376f23[_0x71fd('0x50')]()){_0x1f9961['push']('\x22'+_0x5c9d03+'\x22');}else{_0x1691da['push'](_0x71fd('0x51'));}break;case _0x71fd('0x21'):var _0x56c430=parseInt(_0x5c9d03);_0x5c9d03=_[_0x71fd('0x52')](_0x56c430)||_0x56c430<0x0||_0x56c430>0x4?_0x465faf?0x3:0x2:_0x56c430;_0x1f9961[_0x71fd('0x53')]('\x22'+_0x5c9d03+'\x22');break;case _0x71fd('0x22'):var _0x5d3ca6=parseInt(_0x5c9d03);if(_['isNumber'](_0x5d3ca6)&&_[_0x71fd('0x54')](_0x20ab41,_0x5d3ca6)){_0x1f9961[_0x71fd('0x53')]('\x22'+_0x5d3ca6+'\x22');}else{_0x1691da[_0x71fd('0x53')](_0x71fd('0x55'));}break;case'email':if(isEmail(_0x5c9d03)){_0x1f9961[_0x71fd('0x53')]('\x22'+_0x5c9d03+'\x22');}else{_0x1691da[_0x71fd('0x53')](_0x71fd('0x56'));}break;case'dateOfBirth':var _0x4af076=moment(_0x5c9d03,'YYYY-MM-DD',!![]);if(_0x4af076[_0x71fd('0x50')]()){_0x1f9961['push']('\x22'+_0x5c9d03+'\x22');}else{_0x1691da['push']('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x1f9961[_0x71fd('0x53')]('\x22'+_0x5c9d03+'\x22');}}else{switch(_0x42f6a3){case _0x71fd('0x57'):case'phone':_0x1691da[_0x71fd('0x53')](_0x42f6a3+'\x20not\x20specified');break;default:_0x1f9961['push']('\x22\x22');}}}}if(_0x1691da[_0x71fd('0x4c')]){handleError(_0x5c80f3['data'][_0x5972ca],{'code':_0x71fd('0x58'),'message':_0x1691da[_0x71fd('0x11')]()});}else{fs[_0x71fd('0x59')](_0x2d3867,_0x1f9961[_0x71fd('0x11')]()+'\x0a');}_0x1f9961=[];}if(!(stats[_0x71fd('0x4d')]%0xc8)){socket[_0x71fd('0x5a')]('contact:import:'+_0x5632a6,stats);stats[_0x71fd('0x3c')]=[];}}if(stopped){logger[_0x71fd('0x3e')](_0x71fd('0x5b'));_0x595574[_0x71fd('0x5c')]();}}catch(_0x42b516){handleError(_0x5c80f3[_0x71fd('0x4e')][_0x5972ca],{'code':_0x71fd('0x5d'),'message':_0x42b516[_0x71fd('0x3a')]});logger[_0x71fd('0x39')]('step',_0x42b516[_0x71fd('0x3a')]);}},'complete':function(){try{var _0x2c9e6a=[];var _0x1b3604='cm_contacts';if(_0x473776['duplicates']&&_0x473776[_0x71fd('0x5e')]['length']){_0x1b3604='cm_contacts_'+_0x5632a6;_0x2c9e6a[_0x71fd('0x53')]('CREATE\x20TABLE\x20'+_0x1b3604+_0x71fd('0x5f'));}var _0x215a09=util[_0x71fd('0xa')](_0x71fd('0x60'),_0x2d3867,_0x1b3604,_0x30d3b1,_0x473776[_0x71fd('0x2d')],_0x473776[_0x71fd('0x32')]||null,NOW,NOW);if(_[_0x71fd('0x61')](_0x1cb100[_0x71fd('0x1f')])){_0x215a09+=',\x20scheduledAt\x20=\x20NOW()';}_0x2c9e6a[_0x71fd('0x53')](_0x215a09);if(_0x473776[_0x71fd('0x5e')]&&_0x473776[_0x71fd('0x5e')][_0x71fd('0x4c')]){_0x2c9e6a[_0x71fd('0x53')](insertCmContact(_0x473776[_0x71fd('0x2d')],_0x1b3604,_0x473776['duplicates'],_0x1cb100));_0x2c9e6a[_0x71fd('0x53')]('DROP\x20TABLE\x20'+_0x1b3604+';');}_0x2c9e6a[_0x71fd('0x53')](insertCmHopper(_0x473776[_0x71fd('0x2d')],_0x71fd('0x62'),_0x71fd('0x63'),'VoiceQueueId',_0x465faf));_0x2c9e6a[_0x71fd('0x53')](insertCmHopperBlack(_0x473776['ListId'],_0x71fd('0x64'),'voice_queues','VoiceQueueId'));_0x2c9e6a[_0x71fd('0x53')](insertCmHopper(_0x473776['ListId'],_0x71fd('0x65'),_0x71fd('0x66'),_0x71fd('0x67'),_0x465faf));_0x2c9e6a[_0x71fd('0x53')](insertCmHopperBlack(_0x473776[_0x71fd('0x2d')],_0x71fd('0x68'),_0x71fd('0x66'),'CampaignId'));BPromise[_0x71fd('0x69')](_0x2c9e6a,handleQuery)['then'](function(_0x5947b7){stats['finish']=!![];stats[_0x71fd('0x6a')]=_0x473776[_0x71fd('0x5e')]&&_0x473776[_0x71fd('0x5e')][_0x71fd('0x4c')]?results[0x2]['affectedRows']:results[0x0][_0x71fd('0x6a')];socket['emit']('contact:import:'+_0x5632a6,stats);fs[_0x71fd('0x6b')](_0x402cbe);fs[_0x71fd('0x6b')](_0x2d3867);process[_0x71fd('0x3b')](0x0);})[_0x71fd('0x42')](function(_0x5af218){logger[_0x71fd('0x39')](_0x5af218[_0x71fd('0x3a')]);process[_0x71fd('0x3b')](0x1);});}catch(_0x5dcc58){logger[_0x71fd('0x39')](_0x71fd('0x6c'),_0x5dcc58[_0x71fd('0x3a')]);process[_0x71fd('0x3b')](0x1);}},'error':function(_0x2e28bf,_0x59508b,_0x192e08,_0x53e67f){throw new Error(_0x53e67f);}});}function validate(){if(process[_0x71fd('0x6d')]&&process['argv']['length']<0x4){throw new Error(_0x71fd('0x6e'));}var _0x4f202f=path[_0x71fd('0x11')](config[_0x71fd('0x46')],_0x71fd('0x47'),process[_0x71fd('0x6d')][0x2]);if(!fs[_0x71fd('0x6f')](_0x4f202f)){throw new Error(_0x71fd('0x70'));}var _0x40def5={};try{_0x40def5=JSON[_0x71fd('0x71')](process[_0x71fd('0x6d')][0x3]);if(!_0x40def5['binding']){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x40def5[_0x71fd('0x72')][_0x71fd('0xf')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x40def5[_0x71fd('0x72')][_0x71fd('0x57')]){throw new Error(_0x71fd('0x73'));}var _0x5537ac=0x0;if(_0x40def5['binding'][_0x71fd('0x22')]){_0x5537ac=0x1;}if(!_0x40def5['ListId']){throw new Error(_0x71fd('0x74'));}}catch(_0xf511bf){throw new Error(_0x71fd('0x75'));}var _0x28a17f=[];try{_0x28a17f=_[_0x71fd('0x76')](JSON[_0x71fd('0x71')](process[_0x71fd('0x6d')][0x4]),'id');}catch(_0x1a8ebe){logger[_0x71fd('0x3e')]('No\x20agent\x20available');}main(_0x4f202f,_0x40def5,_0x28a17f,_0x5537ac);}validate();process['on'](_0x71fd('0x77'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 3654d23..97bb039 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfff0=['agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','destcalleridnum','Member\x20Name','membername','uniqueid','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','billableseconds','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','queue','variable','outbound','string','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Name','calleridname','UniqueId','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect'];(function(_0x2eea9a,_0x368daf){var _0x1ec61e=function(_0x1fc2fc){while(--_0x1fc2fc){_0x2eea9a['push'](_0x2eea9a['shift']());}};_0x1ec61e(++_0x368daf);}(_0xfff0,0x139));var _0x0fff=function(_0x4016a3,_0x481628){_0x4016a3=_0x4016a3-0x0;var _0x4680eb=_0xfff0[_0x4016a3];return _0x4680eb;};'use strict';exports['getSubjects']=function(_0x960312,_0x2b95e0){var _0x148db8=[{'type':'string','content':_0x0fff('0x0'),'variableName':null}];switch(_0x960312[_0x0fff('0x1')]()){case _0x0fff('0x2'):switch(_0x2b95e0['toLowerCase']()){case _0x0fff('0x3'):_0x148db8[_0x0fff('0x4')]({'type':'variable','content':'','variableName':_0x0fff('0x5')});_0x148db8[_0x0fff('0x4')]({'type':_0x0fff('0x6'),'content':'','variableName':'calleridnum'});break;case _0x0fff('0x7'):_0x148db8['push']({'type':_0x0fff('0x8'),'content':'Outbound\x20Call','variableName':null});_0x148db8[_0x0fff('0x4')]({'type':_0x0fff('0x6'),'content':'','variableName':'destcalleridnum'});break;}}return _0x148db8;};exports[_0x0fff('0x9')]=function(_0x377b2f,_0x1de923){var _0x289e01=[];switch(_0x377b2f[_0x0fff('0x1')]()){case _0x0fff('0x2'):switch(_0x1de923[_0x0fff('0x1')]()){case _0x0fff('0x3'):_0x289e01=[{'type':_0x0fff('0x8'),'content':_0x0fff('0xa'),'key':null,'keyType':null,'variableName':null},{'type':_0x0fff('0xb'),'content':'','key':'Caller\x20Number','keyType':_0x0fff('0x6'),'variableName':'calleridnum'},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0xc'),'keyType':_0x0fff('0x6'),'variableName':_0x0fff('0xd')},{'type':'keyValue','content':'','key':'Call\x20To','keyType':_0x0fff('0x6'),'variableName':'destexten'},{'type':'keyValue','content':'','key':'Queue','keyType':_0x0fff('0x6'),'variableName':_0x0fff('0x5')},{'type':'keyValue','content':'','key':_0x0fff('0xe'),'keyType':_0x0fff('0x6'),'variableName':'uniqueid'},{'type':'keyValue','content':'','key':'Date','keyType':_0x0fff('0x6'),'variableName':_0x0fff('0xf')},{'type':_0x0fff('0x8'),'content':_0x0fff('0x10'),'key':null,'keyType':null,'variableName':null},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x11'),'keyType':'variable','variableName':_0x0fff('0x12')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x13'),'keyType':'variable','variableName':'destcalleridnum'},{'type':_0x0fff('0x8'),'content':_0x0fff('0x14'),'key':null,'keyType':null,'variableName':null},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x15'),'keyType':'variable','variableName':_0x0fff('0xf')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x16'),'keyType':_0x0fff('0x6'),'variableName':_0x0fff('0x17')},{'type':_0x0fff('0xb'),'content':'','key':'Agent\x20Complete','keyType':_0x0fff('0x6'),'variableName':_0x0fff('0x18')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x19'),'keyType':_0x0fff('0x6'),'variableName':_0x0fff('0x1a')},{'type':'keyValue','content':'','key':_0x0fff('0x1b'),'keyType':_0x0fff('0x6'),'variableName':_0x0fff('0x1c')}];break;case _0x0fff('0x7'):_0x289e01=[{'type':_0x0fff('0x8'),'content':_0x0fff('0xa'),'variableName':null},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x1d'),'keyType':_0x0fff('0x6'),'keyContent':'','variableName':_0x0fff('0x1e')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x1f'),'keyType':'variable','keyContent':'','variableName':_0x0fff('0x20')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0xe'),'keyType':_0x0fff('0x6'),'keyContent':'','variableName':_0x0fff('0x21')},{'type':_0x0fff('0xb'),'content':'','key':'Date','keyType':_0x0fff('0x6'),'keyContent':'','variableName':_0x0fff('0x22')},{'type':_0x0fff('0x8'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x23'),'keyType':'variable','keyContent':'','variableName':_0x0fff('0x24')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x25'),'keyType':_0x0fff('0x6'),'keyContent':'','variableName':_0x0fff('0x26')},{'type':_0x0fff('0xb'),'content':'','key':_0x0fff('0x27'),'keyType':_0x0fff('0x6'),'keyContent':'','variableName':_0x0fff('0x28')},{'type':_0x0fff('0xb'),'content':'','key':'Billable\x20Time','keyType':_0x0fff('0x6'),'keyContent':'','variableName':_0x0fff('0x29')}];break;}}return _0x289e01;}; \ No newline at end of file +var _0xe605=['agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','***\x20Call\x20Info\x20***','Member\x20Name','Date','Answer\x20Time','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','outbound','destcalleridnum','getDescriptions','keyValue','Caller\x20Number','calleridnum','Caller\x20Name','calleridname','Call\x20To','UniqueId','uniqueid','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe605,0x92));var _0x5e60=function(_0x3e5107,_0x2f20d9){_0x3e5107=_0x3e5107-0x0;var _0x1cf41e=_0xe605[_0x3e5107];return _0x1cf41e;};'use strict';exports[_0x5e60('0x0')]=function(_0x455628,_0x5deab2){var _0x36add0=[{'type':_0x5e60('0x1'),'content':_0x5e60('0x2'),'variableName':null}];switch(_0x455628[_0x5e60('0x3')]()){case _0x5e60('0x4'):switch(_0x5deab2[_0x5e60('0x3')]()){case _0x5e60('0x5'):_0x36add0[_0x5e60('0x6')]({'type':_0x5e60('0x7'),'content':'','variableName':_0x5e60('0x8')});_0x36add0[_0x5e60('0x6')]({'type':_0x5e60('0x7'),'content':'','variableName':'calleridnum'});break;case _0x5e60('0x9'):_0x36add0['push']({'type':'string','content':'Outbound\x20Call','variableName':null});_0x36add0[_0x5e60('0x6')]({'type':_0x5e60('0x7'),'content':'','variableName':_0x5e60('0xa')});break;}}return _0x36add0;};exports[_0x5e60('0xb')]=function(_0x331b3e,_0x2cbe4e){var _0x56f05a=[];switch(_0x331b3e[_0x5e60('0x3')]()){case'voice':switch(_0x2cbe4e[_0x5e60('0x3')]()){case _0x5e60('0x5'):_0x56f05a=[{'type':_0x5e60('0x1'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x5e60('0xc'),'content':'','key':_0x5e60('0xd'),'keyType':_0x5e60('0x7'),'variableName':_0x5e60('0xe')},{'type':_0x5e60('0xc'),'content':'','key':_0x5e60('0xf'),'keyType':'variable','variableName':_0x5e60('0x10')},{'type':_0x5e60('0xc'),'content':'','key':_0x5e60('0x11'),'keyType':_0x5e60('0x7'),'variableName':'destexten'},{'type':_0x5e60('0xc'),'content':'','key':'Queue','keyType':_0x5e60('0x7'),'variableName':_0x5e60('0x8')},{'type':'keyValue','content':'','key':_0x5e60('0x12'),'keyType':_0x5e60('0x7'),'variableName':_0x5e60('0x13')},{'type':_0x5e60('0xc'),'content':'','key':'Date','keyType':_0x5e60('0x7'),'variableName':_0x5e60('0x14')},{'type':'string','content':_0x5e60('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0x5e60('0xc'),'content':'','key':_0x5e60('0x16'),'keyType':_0x5e60('0x7'),'variableName':_0x5e60('0x17')},{'type':_0x5e60('0xc'),'content':'','key':_0x5e60('0x18'),'keyType':_0x5e60('0x7'),'variableName':_0x5e60('0xa')},{'type':_0x5e60('0x1'),'content':_0x5e60('0x19'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x5e60('0x1a'),'keyType':'variable','variableName':_0x5e60('0x14')},{'type':_0x5e60('0xc'),'content':'','key':_0x5e60('0x1b'),'keyType':_0x5e60('0x7'),'variableName':_0x5e60('0x1c')},{'type':_0x5e60('0xc'),'content':'','key':_0x5e60('0x1d'),'keyType':'variable','variableName':_0x5e60('0x1e')},{'type':_0x5e60('0xc'),'content':'','key':_0x5e60('0x1f'),'keyType':'variable','variableName':_0x5e60('0x20')},{'type':_0x5e60('0xc'),'content':'','key':_0x5e60('0x21'),'keyType':_0x5e60('0x7'),'variableName':'talktime'}];break;case _0x5e60('0x9'):_0x56f05a=[{'type':'string','content':_0x5e60('0x22'),'variableName':null},{'type':_0x5e60('0xc'),'content':'','key':'Called\x20Number','keyType':_0x5e60('0x7'),'keyContent':'','variableName':_0x5e60('0xa')},{'type':'keyValue','content':'','key':_0x5e60('0x23'),'keyType':_0x5e60('0x7'),'keyContent':'','variableName':'membername'},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0x5e60('0x7'),'keyContent':'','variableName':_0x5e60('0x13')},{'type':_0x5e60('0xc'),'content':'','key':_0x5e60('0x24'),'keyType':_0x5e60('0x7'),'keyContent':'','variableName':'starttime'},{'type':_0x5e60('0x1'),'content':_0x5e60('0x19')},{'type':'keyValue','content':'','key':_0x5e60('0x25'),'keyType':'variable','keyContent':'','variableName':'answertime'},{'type':_0x5e60('0xc'),'content':'','key':_0x5e60('0x26'),'keyType':_0x5e60('0x7'),'keyContent':'','variableName':_0x5e60('0x27')},{'type':_0x5e60('0xc'),'content':'','key':_0x5e60('0x28'),'keyType':_0x5e60('0x7'),'keyContent':'','variableName':_0x5e60('0x29')},{'type':_0x5e60('0xc'),'content':'','key':_0x5e60('0x2a'),'keyType':'variable','keyContent':'','variableName':_0x5e60('0x2b')}];break;}}return _0x56f05a;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index ac821d8..d5c5595 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x23d3=['chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','update','info','catch','error','tracked','user','query','clone','body','omit','html','phone','fax','lodash','../../mysqldb','../../config/logger','mail-interactions','fax-interactions','sms-interactions'];(function(_0x177ade,_0x5e2789){var _0x3d5885=function(_0x2fa948){while(--_0x2fa948){_0x177ade['push'](_0x177ade['shift']());}};_0x3d5885(++_0x5e2789);}(_0x23d3,0xe8));var _0x323d=function(_0x4c978f,_0x2f834e){_0x4c978f=_0x4c978f-0x0;var _0x2af10c=_0x23d3[_0x4c978f];return _0x2af10c;};'use strict';var _=require(_0x323d('0x0'));var db=require(_0x323d('0x1'))['db'];var loggers={'openchannel':require(_0x323d('0x2'))('openchannel-interactions'),'mail':require(_0x323d('0x2'))(_0x323d('0x3')),'fax':require(_0x323d('0x2'))(_0x323d('0x4')),'sms':require(_0x323d('0x2'))(_0x323d('0x5')),'chat':require('../../config/logger')(_0x323d('0x6')),'whatsapp':require(_0x323d('0x2'))(_0x323d('0x7'))};function getInteractionId(_0x1057c2,_0x597de9,_0xbcfbc9){if(_0x1057c2&&_0x1057c2[_[_0x323d('0x8')](_0xbcfbc9)+_0x323d('0x9')]){return _0x1057c2[_['upperFirst'](_0xbcfbc9)+_0x323d('0x9')];}else if(_0x1057c2&&_0x1057c2['id']){return _0x1057c2['id'];}else if(_0x597de9&&_0x597de9['id']){return _0x597de9['id'];}else{return _0x323d('0xa');}}function log(_0x55a1ef,_0x38cb86,_0x1b7cb0,_0xed296d,_0xf11ce4,_0x5df149){loggers[_0xf11ce4[_0x323d('0xb')]()][_0x55a1ef](_0x323d('0xc'),_0x5df149[_0x323d('0xd')](),_0x38cb86?_0x38cb86['id']:null,_0x38cb86?_0x38cb86[_0x323d('0xe')]:null,_0x38cb86?_0x38cb86[_0x323d('0xf')]:null,getInteractionId(_0x1b7cb0,_0xed296d,_0xf11ce4),_0x1b7cb0?JSON[_0x323d('0x10')](_0x1b7cb0):_0x323d('0x11'));}function updateUser(_0x5066f0,_0x3913bd,_0x537c50,_0x2510d8,_0xfb5ad2){db[_[_0x323d('0x8')](_0x2510d8)+_0x323d('0x12')][_0x323d('0x13')]({'where':{'id':getInteractionId(_0x3913bd,_0x537c50,_0x2510d8)}})[_0x323d('0x14')](function(_0x1f376c){if(_0x1f376c){return _0x1f376c[_0x323d('0x15')]({'UserId':_0x5066f0?_0x5066f0['id']:null});}})[_0x323d('0x14')](function(_0x2ba5c0){if(_0x2ba5c0){log(_0x323d('0x16'),_0x5066f0,_0x3913bd,_0x537c50,_0x2510d8,_0xfb5ad2);}})[_0x323d('0x17')](function(){log(_0x323d('0x18'),_0x5066f0,_0x3913bd,_0x537c50,_0x2510d8,_0xfb5ad2);});}exports[_0x323d('0x19')]=function(_0x4db048,_0x344faf){return function(_0x43883b,_0x2388e0,_0xf6ba04){var _0x35b50f=_0x43883b[_0x323d('0x1a')];var _0x275e00={};var _0x54b539=_0x43883b[_0x323d('0x1b')];if(_0x275e00){_0x275e00=_[_0x323d('0x1c')](_0x43883b[_0x323d('0x1d')]);_0x275e00=_[_0x323d('0x1e')](_0x275e00,[_0x323d('0x1d'),_0x323d('0x1f'),_0x323d('0x20'),_0x323d('0x21'),'mobile']);}updateUser(_0x35b50f,_0x275e00,_0x54b539,_0x4db048,_0x344faf);_0xf6ba04(null);};}; \ No newline at end of file +var _0x2428=['html','fax','mobile','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','stringify','null','findOne','then','update','info','tracked','user','query','clone','body','omit'];(function(_0x446208,_0xb483fb){var _0xe49563=function(_0x1d3a21){while(--_0x1d3a21){_0x446208['push'](_0x446208['shift']());}};_0xe49563(++_0xb483fb);}(_0x2428,0xd3));var _0x8242=function(_0x1b13ad,_0x5e5f2a){_0x1b13ad=_0x1b13ad-0x0;var _0x229eb9=_0x2428[_0x1b13ad];return _0x229eb9;};'use strict';var _=require('lodash');var db=require(_0x8242('0x0'))['db'];var loggers={'openchannel':require(_0x8242('0x1'))(_0x8242('0x2')),'mail':require(_0x8242('0x1'))(_0x8242('0x3')),'fax':require(_0x8242('0x1'))(_0x8242('0x4')),'sms':require(_0x8242('0x1'))(_0x8242('0x5')),'chat':require(_0x8242('0x1'))(_0x8242('0x6')),'whatsapp':require('../../config/logger')(_0x8242('0x7'))};function getInteractionId(_0x11da5f,_0x3fb12e,_0x3712f3){if(_0x11da5f&&_0x11da5f[_[_0x8242('0x8')](_0x3712f3)+'InteractionId']){return _0x11da5f[_[_0x8242('0x8')](_0x3712f3)+_0x8242('0x9')];}else if(_0x11da5f&&_0x11da5f['id']){return _0x11da5f['id'];}else if(_0x3fb12e&&_0x3fb12e['id']){return _0x3fb12e['id'];}else{return _0x8242('0xa');}}function log(_0x1dfd76,_0x59ae78,_0x220465,_0x3abaea,_0x4c0267,_0x2b37e0){loggers[_0x4c0267['toLowerCase']()][_0x1dfd76]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2b37e0['toUpperCase'](),_0x59ae78?_0x59ae78['id']:null,_0x59ae78?_0x59ae78['name']:null,_0x59ae78?_0x59ae78['role']:null,getInteractionId(_0x220465,_0x3abaea,_0x4c0267),_0x220465?JSON[_0x8242('0xb')](_0x220465):_0x8242('0xc'));}function updateUser(_0x5bbe1b,_0x4a45f8,_0xfb7cae,_0x32ff14,_0x5dbd95){db[_[_0x8242('0x8')](_0x32ff14)+'Interaction'][_0x8242('0xd')]({'where':{'id':getInteractionId(_0x4a45f8,_0xfb7cae,_0x32ff14)}})[_0x8242('0xe')](function(_0x27f950){if(_0x27f950){return _0x27f950[_0x8242('0xf')]({'UserId':_0x5bbe1b?_0x5bbe1b['id']:null});}})[_0x8242('0xe')](function(_0x15f60c){if(_0x15f60c){log(_0x8242('0x10'),_0x5bbe1b,_0x4a45f8,_0xfb7cae,_0x32ff14,_0x5dbd95);}})['catch'](function(){log('error',_0x5bbe1b,_0x4a45f8,_0xfb7cae,_0x32ff14,_0x5dbd95);});}exports[_0x8242('0x11')]=function(_0x45a325,_0x3e373e){return function(_0xad2711,_0x12b745,_0x473f67){var _0x2de515=_0xad2711[_0x8242('0x12')];var _0x5d4fad={};var _0x1aa763=_0xad2711[_0x8242('0x13')];if(_0x5d4fad){_0x5d4fad=_[_0x8242('0x14')](_0xad2711[_0x8242('0x15')]);_0x5d4fad=_[_0x8242('0x16')](_0x5d4fad,['body',_0x8242('0x17'),'phone',_0x8242('0x18'),_0x8242('0x19')]);}updateUser(_0x2de515,_0x5d4fad,_0x1aa763,_0x45a325,_0x3e373e);_0x473f67(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index abb9110..2ed1b78 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 _0xc06f=['findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','User','admin','user','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','final','hasOwnProperty','License'];(function(_0x4a6cf8,_0x5534ef){var _0x22205e=function(_0x3f4d0d){while(--_0x3f4d0d){_0x4a6cf8['push'](_0x4a6cf8['shift']());}};_0x22205e(++_0x5534ef);}(_0xc06f,0xaa));var _0xfc06=function(_0x936675,_0x2a934f){_0x936675=_0x936675-0x0;var _0x58de4d=_0xc06f[_0x936675];return _0x58de4d;};'use strict';var crypto=require(_0xfc06('0x0'));var util=require(_0xfc06('0x1'));var compose=require(_0xfc06('0x2'));var db=require(_0xfc06('0x3'))['db'];var config=require(_0xfc06('0x4'));function getValueFromLicense(_0x2f4fec,_0x11ba24){if(_0x2f4fec&&_0x11ba24){if(_0x11ba24[_0xfc06('0x5')]&&_0x11ba24[_0xfc06('0x6')]){var _0x720092=_0x11ba24[_0xfc06('0x5')];var _0x210a8f=_0x11ba24[_0xfc06('0x6')];var _0x151d7d=_0x720092[_0xfc06('0x7')]('-')[0x4];var _0x6f0aeb=_0x720092[_0xfc06('0x7')]('-')[0x0];var _0x570d1d=crypto['createDecipher'](_0xfc06('0x8'),util[_0xfc06('0x9')](_0xfc06('0xa'),_0x151d7d,_0x720092,_0x6f0aeb));var _0x5c6c21=_0x570d1d['update'](_0x210a8f,'base64','utf8');_0x5c6c21+=_0x570d1d[_0xfc06('0xb')]('utf8');var _0x282876=JSON['parse'](_0x5c6c21);return _0x282876[_0xfc06('0xc')](_0x2f4fec)?_0x282876[_0x2f4fec]:null;}}return null;}function isLimit(_0x3e4777,_0x2b72ee,_0x3313a9,_0x20d6ea){var _0x4d6e68=_0x2b72ee;return compose()['use'](function(_0x504ddb,_0x292a68,_0x387477){return db[_0xfc06('0xd')][_0xfc06('0xe')]({'where':{'id':0x1},'raw':!![]})[_0xfc06('0xf')](function(_0x26143a){var _0x3bca69=getValueFromLicense(_0x3e4777,_0x26143a);return _0x3bca69?_0x3bca69:_0x4d6e68;})[_0xfc06('0xf')](function(_0x2f4604){_0x4d6e68=_0x2f4604;return _0x3313a9['count'](_0x20d6ea);})['then'](function(_0x20dac4){if(_0x20dac4>=_0x4d6e68){return _0x292a68[_0xfc06('0x10')](0x193)[_0xfc06('0x11')]({'message':util[_0xfc06('0x9')](_0xfc06('0x12'),_0x3e4777)});}_0x387477();})[_0xfc06('0x13')](function(_0x3f6057){_0x387477(_0x3f6057);});});}function isUserLimit(){return isLimit('users',0x1,db[_0xfc06('0x14')],{'where':{'$or':[{'role':_0xfc06('0x15')},{'role':_0xfc06('0x16')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0xc1a0=['final','parse','hasOwnProperty','use','License','then','status','json','catch','users','User','admin','user','isUserLimit','crypto','composable-middleware','../../config/environment','license','data1','split','createDecipher','aes-256-ctr','format','%s:%s:%s','utf8'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0xc1a0,0x153));var _0x0c1a=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0xc1a0[_0x352e09];return _0x1b7094;};'use strict';var crypto=require(_0x0c1a('0x0'));var util=require('util');var compose=require(_0x0c1a('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x0c1a('0x2'));function getValueFromLicense(_0x243400,_0x51a88b){if(_0x243400&&_0x51a88b){if(_0x51a88b['data1']&&_0x51a88b[_0x0c1a('0x3')]){var _0x5cc395=_0x51a88b[_0x0c1a('0x4')];var _0xfc6bac=_0x51a88b['license'];var _0x87851b=_0x5cc395[_0x0c1a('0x5')]('-')[0x4];var _0x36c341=_0x5cc395['split']('-')[0x0];var _0x1434bb=crypto[_0x0c1a('0x6')](_0x0c1a('0x7'),util[_0x0c1a('0x8')](_0x0c1a('0x9'),_0x87851b,_0x5cc395,_0x36c341));var _0x1daeb7=_0x1434bb['update'](_0xfc6bac,'base64',_0x0c1a('0xa'));_0x1daeb7+=_0x1434bb[_0x0c1a('0xb')](_0x0c1a('0xa'));var _0x45ebbe=JSON[_0x0c1a('0xc')](_0x1daeb7);return _0x45ebbe[_0x0c1a('0xd')](_0x243400)?_0x45ebbe[_0x243400]:null;}}return null;}function isLimit(_0x55bf61,_0x5d0d91,_0x28d88a,_0x47d487){var _0x5617c6=_0x5d0d91;return compose()[_0x0c1a('0xe')](function(_0x149ca1,_0x111c51,_0x2241ae){return db[_0x0c1a('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x0c1a('0x10')](function(_0x2dde08){var _0x5db8f5=getValueFromLicense(_0x55bf61,_0x2dde08);return _0x5db8f5?_0x5db8f5:_0x5617c6;})[_0x0c1a('0x10')](function(_0x1ade20){_0x5617c6=_0x1ade20;return _0x28d88a['count'](_0x47d487);})[_0x0c1a('0x10')](function(_0x14d7e4){if(_0x14d7e4>=_0x5617c6){return _0x111c51[_0x0c1a('0x11')](0x193)[_0x0c1a('0x12')]({'message':util[_0x0c1a('0x8')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x55bf61)});}_0x2241ae();})[_0x0c1a('0x13')](function(_0x3821d1){_0x2241ae(_0x3821d1);});});}function isUserLimit(){return isLimit(_0x0c1a('0x14'),0x1,db[_0x0c1a('0x15')],{'where':{'$or':[{'role':_0x0c1a('0x16')},{'role':_0x0c1a('0x17')}]}});}exports[_0x0c1a('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index a8994f5..e3e5f87 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 _0xd7cf=['format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','$in','IN\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','shift','DATE','utcOffset','hours','minutes','add','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','forEach','match','filter','indexOf','conditions','buildExpression','operator','$eq','$between','value','includes','$gt','$lte','days'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xd7cf,0x1c5));var _0xfd7c=function(_0x249565,_0x2a026a){_0x249565=_0x249565-0x0;var _0x43dee8=_0xd7cf[_0x249565];return _0x43dee8;};'use strict';var _=require(_0xfd7c('0x0'));var moment=require(_0xfd7c('0x1'));exports['parseSearch']=function(_0x25e20e){var _0x8329bf={'conditions':[]};_0x8329bf[_0xfd7c('0x2')]=_[_0xfd7c('0x3')](_0x25e20e,_0xfd7c('0x4'))?'or':_0xfd7c('0x5');var _0x4ae844=_0x25e20e[_0xfd7c('0x6')](_0xfd7c('0x7'),'')[_0xfd7c('0x6')](_0xfd7c('0x4'),'')[_0xfd7c('0x8')]('||');for(var _0x33a277=0x0;_0x33a277<_0x4ae844[_0xfd7c('0x9')];_0x33a277++){var _0x4d2fec=_0x4ae844[_0x33a277][_0xfd7c('0x8')](':=');var _0x34e609=_0x4d2fec[0x0];var _0x23171e=_0x4d2fec['slice'](0x1);_0x23171e[_0xfd7c('0xa')](function(_0x9faec1){var _0x115549=_0x9faec1[_0xfd7c('0x8')]('[')['shift']();var _0x50a42c=_0x9faec1[_0xfd7c('0xb')](/\[(.*?)\]/g);_0x50a42c[_0xfd7c('0xa')](function(_0x868189){var _0x2f8806=_0x868189['split']('[')[_0xfd7c('0xc')](function(_0x9d8a49){return _0x9d8a49[_0xfd7c('0xd')](']')>-0x1;})['map'](function(_0x43ec5b){return _0x43ec5b['split'](']')[0x0];})[0x0];_0x8329bf[_0xfd7c('0xe')]['push']({'field':_0x34e609,'operator':_0x115549,'value':_0x2f8806});});});}return _0x8329bf;};exports[_0xfd7c('0xf')]=function(_0x58338b,_0x1bbe64,_0x1bf8cd){var _0x28872a={};if(_0x1bbe64==='DATE'){if(_0x1bf8cd[_0xfd7c('0x10')]===_0xfd7c('0x11')){_0x1bf8cd[_0xfd7c('0x10')]=_0xfd7c('0x12');_0x1bf8cd['value']+=','+_0x1bf8cd[_0xfd7c('0x13')];}else if(_[_0xfd7c('0x14')]([_0xfd7c('0x15'),_0xfd7c('0x16')],_0x1bf8cd[_0xfd7c('0x10')])){_0x1bf8cd[_0xfd7c('0x13')]=moment(_0x1bf8cd[_0xfd7c('0x13')])['add'](0x1,_0xfd7c('0x17'))[_0xfd7c('0x18')](_0xfd7c('0x19'));}}if(_0x1bf8cd[_0xfd7c('0x1a')]){_0x1bbe64=_0x1bf8cd[_0xfd7c('0x1a')];_0x28872a[_0xfd7c('0x1b')]=_0xfd7c('0x1c')+_0x58338b+'.'+_0x1bf8cd[_0xfd7c('0x1d')]+_0xfd7c('0x1e')+_0x1bf8cd[_0xfd7c('0x1a')]+')\x20'+parseOperator(_0x1bf8cd[_0xfd7c('0x10')]);}else{_0x28872a[_0xfd7c('0x1b')]=_0x58338b+'.'+_0x1bf8cd[_0xfd7c('0x1d')]+'\x20'+parseOperator(_0x1bf8cd['operator']);}if(_[_0xfd7c('0x14')]([_0xfd7c('0x1f'),_0xfd7c('0x20')],_0x1bf8cd['operator']))_0x28872a['text']='('+_0x28872a[_0xfd7c('0x1b')]+_0xfd7c('0x21')+_0x58338b+'.'+_0x1bf8cd[_0xfd7c('0x1d')]+'\x20IS\x20NULL)';_0x28872a['value']=parseValue(_0x1bbe64,_0x1bf8cd['operator'],_0x1bf8cd[_0xfd7c('0x13')]);return _0x28872a;};function parseOperator(_0x565386){var _0x32b260;switch(_0x565386){case _0xfd7c('0x22'):_0x32b260=_0xfd7c('0x23');break;case'$notIn':_0x32b260='NOT\x20IN\x20?';break;case _0xfd7c('0x11'):_0x32b260='=\x20?';break;case _0xfd7c('0x1f'):_0x32b260='<>\x20?';break;case _0xfd7c('0x24'):case _0xfd7c('0x25'):case _0xfd7c('0x26'):_0x32b260='LIKE\x20?';break;case _0xfd7c('0x27'):_0x32b260=_0xfd7c('0x28');break;case _0xfd7c('0x15'):_0x32b260=_0xfd7c('0x29');break;case'$lte':_0x32b260=_0xfd7c('0x2a');break;case _0xfd7c('0x2b'):_0x32b260=_0xfd7c('0x2c');break;case _0xfd7c('0x12'):_0x32b260=_0xfd7c('0x2d');break;}return _0x32b260;}function parseValue(_0x257055,_0x467f4d,_0x57717b){var _0x16106f={'start':undefined,'end':undefined};switch(_0x467f4d){case _0xfd7c('0x22'):case'$notIn':_0x16106f[_0xfd7c('0x2e')]=_0x57717b[_0xfd7c('0x8')](',');break;case _0xfd7c('0x24'):_0x16106f[_0xfd7c('0x2e')]='%'+_0x57717b+'%';break;case'$startsWith':_0x16106f[_0xfd7c('0x2e')]=_0x57717b+'%';break;case'$endsWith':_0x16106f['start']='%'+_0x57717b;break;case'$between':var _0x552ac3=_0x57717b['split'](',');var _0x57717b=_0x552ac3[_0xfd7c('0x2f')]();var _0x5005b9=_0x552ac3['pop']();if(_0x257055===_0xfd7c('0x30')){_0x57717b=moment(_0x57717b)[_0xfd7c('0x31')](0x0,!![])[_0xfd7c('0x18')]();_0x5005b9=moment(_0x5005b9)[_0xfd7c('0x31')](0x0,!![])['add'](0x17,_0xfd7c('0x32'))['add'](0x3b,_0xfd7c('0x33'))[_0xfd7c('0x34')](0x3b,'seconds')[_0xfd7c('0x18')]();}_0x16106f={'start':_0x57717b,'end':_0x5005b9};break;default:_0x16106f[_0xfd7c('0x2e')]=_0x57717b;break;}return _0x16106f;} \ No newline at end of file +var _0x7b01=['[$or]','and','replace','[$and]','split','slice','forEach','shift','filter','buildExpression','operator','$eq','value','includes','$gt','$lte','add','days','format','castTo','text','CAST(','field','\x20AS\x20','$ne','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','>=\x20?','$between','BETWEEN\x20?\x20AND\x20?','start','$endsWith','DATE','utcOffset','hours','minutes','seconds','lodash','parseSearch','sqlOperator','startsWith'];(function(_0x51fb95,_0x2eb008){var _0xd0a527=function(_0x212d4b){while(--_0x212d4b){_0x51fb95['push'](_0x51fb95['shift']());}};_0xd0a527(++_0x2eb008);}(_0x7b01,0x105));var _0x17b0=function(_0x35a84c,_0x48508c){_0x35a84c=_0x35a84c-0x0;var _0x15da2c=_0x7b01[_0x35a84c];return _0x15da2c;};'use strict';var _=require(_0x17b0('0x0'));var moment=require('moment');exports[_0x17b0('0x1')]=function(_0x31f390){var _0x449053={'conditions':[]};_0x449053[_0x17b0('0x2')]=_[_0x17b0('0x3')](_0x31f390,_0x17b0('0x4'))?'or':_0x17b0('0x5');var _0x67bbef=_0x31f390[_0x17b0('0x6')](_0x17b0('0x7'),'')['replace']('[$or]','')['split']('||');for(var _0x13db41=0x0;_0x13db41<_0x67bbef['length'];_0x13db41++){var _0x23540b=_0x67bbef[_0x13db41][_0x17b0('0x8')](':=');var _0x20c6ef=_0x23540b[0x0];var _0x15ae7a=_0x23540b[_0x17b0('0x9')](0x1);_0x15ae7a[_0x17b0('0xa')](function(_0xac1db){var _0x4c4b9e=_0xac1db[_0x17b0('0x8')]('[')[_0x17b0('0xb')]();var _0x45e81b=_0xac1db['match'](/\[(.*?)\]/g);_0x45e81b['forEach'](function(_0x2642d6){var _0x46d64f=_0x2642d6[_0x17b0('0x8')]('[')[_0x17b0('0xc')](function(_0xf3e7d8){return _0xf3e7d8['indexOf'](']')>-0x1;})['map'](function(_0x360614){return _0x360614[_0x17b0('0x8')](']')[0x0];})[0x0];_0x449053['conditions']['push']({'field':_0x20c6ef,'operator':_0x4c4b9e,'value':_0x46d64f});});});}return _0x449053;};exports[_0x17b0('0xd')]=function(_0x226a66,_0x4caf59,_0x1ae72a){var _0x4f6e4b={};if(_0x4caf59==='DATE'){if(_0x1ae72a[_0x17b0('0xe')]===_0x17b0('0xf')){_0x1ae72a[_0x17b0('0xe')]='$between';_0x1ae72a['value']+=','+_0x1ae72a[_0x17b0('0x10')];}else if(_[_0x17b0('0x11')]([_0x17b0('0x12'),_0x17b0('0x13')],_0x1ae72a[_0x17b0('0xe')])){_0x1ae72a['value']=moment(_0x1ae72a[_0x17b0('0x10')])[_0x17b0('0x14')](0x1,_0x17b0('0x15'))[_0x17b0('0x16')]('YYYY-MM-DD');}}if(_0x1ae72a[_0x17b0('0x17')]){_0x4caf59=_0x1ae72a[_0x17b0('0x17')];_0x4f6e4b[_0x17b0('0x18')]=_0x17b0('0x19')+_0x226a66+'.'+_0x1ae72a[_0x17b0('0x1a')]+_0x17b0('0x1b')+_0x1ae72a[_0x17b0('0x17')]+')\x20'+parseOperator(_0x1ae72a[_0x17b0('0xe')]);}else{_0x4f6e4b[_0x17b0('0x18')]=_0x226a66+'.'+_0x1ae72a[_0x17b0('0x1a')]+'\x20'+parseOperator(_0x1ae72a[_0x17b0('0xe')]);}if(_[_0x17b0('0x11')]([_0x17b0('0x1c'),'$notIn'],_0x1ae72a['operator']))_0x4f6e4b[_0x17b0('0x18')]='('+_0x4f6e4b[_0x17b0('0x18')]+'\x20OR\x20'+_0x226a66+'.'+_0x1ae72a[_0x17b0('0x1a')]+_0x17b0('0x1d');_0x4f6e4b[_0x17b0('0x10')]=parseValue(_0x4caf59,_0x1ae72a[_0x17b0('0xe')],_0x1ae72a['value']);return _0x4f6e4b;};function parseOperator(_0x50082a){var _0x25275c;switch(_0x50082a){case _0x17b0('0x1e'):_0x25275c=_0x17b0('0x1f');break;case _0x17b0('0x20'):_0x25275c=_0x17b0('0x21');break;case _0x17b0('0xf'):_0x25275c=_0x17b0('0x22');break;case'$ne':_0x25275c=_0x17b0('0x23');break;case _0x17b0('0x24'):case _0x17b0('0x25'):case'$endsWith':_0x25275c=_0x17b0('0x26');break;case _0x17b0('0x27'):_0x25275c=_0x17b0('0x28');break;case _0x17b0('0x12'):_0x25275c=_0x17b0('0x29');break;case _0x17b0('0x13'):_0x25275c='<=\x20?';break;case _0x17b0('0x2a'):_0x25275c=_0x17b0('0x2b');break;case _0x17b0('0x2c'):_0x25275c=_0x17b0('0x2d');break;}return _0x25275c;}function parseValue(_0x52aac0,_0x187453,_0x1326a9){var _0x377118={'start':undefined,'end':undefined};switch(_0x187453){case _0x17b0('0x1e'):case'$notIn':_0x377118[_0x17b0('0x2e')]=_0x1326a9['split'](',');break;case _0x17b0('0x24'):_0x377118[_0x17b0('0x2e')]='%'+_0x1326a9+'%';break;case'$startsWith':_0x377118[_0x17b0('0x2e')]=_0x1326a9+'%';break;case _0x17b0('0x2f'):_0x377118[_0x17b0('0x2e')]='%'+_0x1326a9;break;case'$between':var _0x1af1b9=_0x1326a9['split'](',');var _0x1326a9=_0x1af1b9[_0x17b0('0xb')]();var _0x31693c=_0x1af1b9['pop']();if(_0x52aac0===_0x17b0('0x30')){_0x1326a9=moment(_0x1326a9)[_0x17b0('0x31')](0x0,!![])[_0x17b0('0x16')]();_0x31693c=moment(_0x31693c)[_0x17b0('0x31')](0x0,!![])[_0x17b0('0x14')](0x17,_0x17b0('0x32'))[_0x17b0('0x14')](0x3b,_0x17b0('0x33'))[_0x17b0('0x14')](0x3b,_0x17b0('0x34'))[_0x17b0('0x16')]();}_0x377118={'start':_0x1326a9,'end':_0x31693c};break;default:_0x377118['start']=_0x1326a9;break;}return _0x377118;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index a337cb1..16431ab 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 _0xebed=['name','uniqueid','isArray','split','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','forEach','replace','includes','push','join','lodash','sequelize','moment','fields','filters','isEmpty','forOwn','find','DATE','isPlainObject','parse','utc','format','$lte','YYYY-MM-DD'];(function(_0x337137,_0x1f4327){var _0x26d1f6=function(_0x118930){while(--_0x118930){_0x337137['push'](_0x337137['shift']());}};_0x26d1f6(++_0x1f4327);}(_0xebed,0x1e0));var _0xdebe=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0xebed[_0xbeb808];return _0x5d6909;};'use strict';var _=require(_0xdebe('0x0'));var sequelize=require(_0xdebe('0x1'));var moment=require(_0xdebe('0x2'));var LIMIT_VALUE=0xfa;exports[_0xdebe('0x3')]=function(_0x205b95){var _0x1c2173=null;if(_0x205b95){_0x1c2173=_0x205b95['split'](',');}return _0x1c2173;};exports[_0xdebe('0x4')]=function(_0x4b90c8,_0x324c17){var _0x2d110c={};if(!_[_0xdebe('0x5')](_0x4b90c8)){_[_0xdebe('0x6')](_0x4b90c8,function(_0x2e4f03,_0x56eae9){try{if(_0x324c17){var _0x48231b=_[_0xdebe('0x7')](_0x324c17,{'name':_0x56eae9})||{};if(_0x48231b['type']===_0xdebe('0x8')&&_[_0xdebe('0x9')](_0x2e4f03)){var _0x4eaf2d=JSON[_0xdebe('0xa')](_0x2e4f03);var _0x393463={'$gte':moment(moment(_0x4eaf2d['$gte'])['format']('YYYY-MM-DD'))[_0xdebe('0xb')]()[_0xdebe('0xc')](),'$lte':moment(moment(_0x4eaf2d[_0xdebe('0xd')])[_0xdebe('0xc')](_0xdebe('0xe')))[_0xdebe('0xb')]()['subtract'](0x1,'s')[_0xdebe('0xc')]()};_0x2d110c[_0x56eae9]=_0x393463;}else if(_0x48231b[_0xdebe('0xf')]===_0xdebe('0x10')){_0x2d110c[_0x56eae9]=_0x2e4f03;}else{_0x2d110c[_0x56eae9]=_[_0xdebe('0x11')](_0x2e4f03)?_0x2e4f03:JSON[_0xdebe('0xa')](_0x2e4f03);}}else{_0x2d110c[_0x56eae9]=_[_0xdebe('0x11')](_0x2e4f03)?_0x2e4f03:JSON['parse'](_0x2e4f03);}}catch(_0x615bd2){_0x2d110c[_0x56eae9]=_0x2e4f03[_0xdebe('0x12')](',');}});}return _0x2d110c;};exports[_0xdebe('0x13')]=function(_0x8d4cdc){_0x8d4cdc=parseInt(_0x8d4cdc,0xa);if(!_0x8d4cdc||_0x8d4cdc<0x0){_0x8d4cdc=LIMIT_VALUE;}return _0x8d4cdc;};exports[_0xdebe('0x14')]=function(_0x29f32c){_0x29f32c=parseInt(_0x29f32c,0xa);if(!_0x29f32c||_0x29f32c<0x0){_0x29f32c=0x0;}return _0x29f32c;};exports[_0xdebe('0x15')]=function(_0x2b26c0){var _0x588ccf,_0x3306e5=null;if(_0x2b26c0){_0x588ccf=_0x2b26c0[_0xdebe('0x12')](',');_0x3306e5=_[_0xdebe('0x16')](_0x588ccf,function(_0x2af439){if(_0x2af439[_0xdebe('0x17')]('-')===0x0){return[_0x2af439===_0xdebe('0x18')?sequelize[_0xdebe('0x19')](sequelize[_0xdebe('0x1a')]('priority'),_0xdebe('0x1b')):_0x2af439[_0xdebe('0x1c')](0x1),'DESC'];}else{return[_0x2af439===_0xdebe('0x18')?sequelize['cast'](sequelize['col'](_0xdebe('0x18')),_0xdebe('0x1b')):_0x2af439,'ASC'];}});}return _0x3306e5;};exports[_0xdebe('0x1d')]=function(_0x555abd,_0x531842){if(_['isEmpty'](_0x555abd)){return _0x555abd;}if(_[_0xdebe('0x11')](_0x555abd)){for(var _0x29c4ce=0x0;_0x29c4ce<_0x555abd[_0xdebe('0x1e')];_0x29c4ce+=0x1){_0x555abd[_0x29c4ce]=this[_0xdebe('0x1d')](_0x555abd[_0x29c4ce],_0x531842);}return _0x555abd;}if(!_[_0xdebe('0x1f')](_0x555abd)){return _0x555abd;}if(_[_0xdebe('0x20')](_0x531842)){_0x531842=[_0x531842];}if(!_['isArray'](_0x531842)){return _0x555abd;}for(var _0x47c452=0x0;_0x47c452<_0x531842[_0xdebe('0x1e')];_0x47c452+=0x1){_[_0xdebe('0x21')](_0x555abd,_0x531842[_0x47c452]);}for(var _0x4b3643 in _0x555abd){if(_0x555abd[_0xdebe('0x22')](_0x4b3643)){_0x555abd[_0x4b3643]=this[_0xdebe('0x1d')](_0x555abd[_0x4b3643],_0x531842);}}return _0x555abd;};exports[_0xdebe('0x23')]=function(_0x3d0dbb){return _0x3d0dbb[_0xdebe('0x24')](RegExp(_0xdebe('0x25')))?!![]:![];};exports[_0xdebe('0x26')]=function(_0x2555f2){return _0x2555f2['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xdebe('0x27')]=function(_0x42fbe4){var _0x4c6913=[];_0x42fbe4[_0xdebe('0x12')](/[ ,]+/)[_0xdebe('0x28')](function(_0x9e568d){_0x9e568d=_0x9e568d[_0xdebe('0x29')](/([^:]")"+/g,'$1');_0x9e568d='+'+_0x9e568d+'*';if(_0x9e568d[_0xdebe('0x2a')]('@'))_0x9e568d='\x22'+_0x9e568d+'\x22';_0x4c6913[_0xdebe('0x2b')](_0x9e568d);});return _0x4c6913[_0xdebe('0x2c')]('\x20');}; \ No newline at end of file +var _0x9085=['replace','push','lodash','sequelize','moment','fields','split','filters','isEmpty','forOwn','find','DATE','isPlainObject','parse','$gte','format','utc','$lte','subtract','name','uniqueid','isArray','offset','map','indexOf','priority','cast','col','unsigned','substr','DESC','omit','length','isObject','isString','hasOwnProperty','^[+]?[0-9]*$','isEmail','match','getFullTextValue','forEach'];(function(_0x20eb51,_0x3cec61){var _0x44f27b=function(_0x11928b){while(--_0x11928b){_0x20eb51['push'](_0x20eb51['shift']());}};_0x44f27b(++_0x3cec61);}(_0x9085,0xcf));var _0x5908=function(_0x3ecf95,_0x559a2c){_0x3ecf95=_0x3ecf95-0x0;var _0x3f1e72=_0x9085[_0x3ecf95];return _0x3f1e72;};'use strict';var _=require(_0x5908('0x0'));var sequelize=require(_0x5908('0x1'));var moment=require(_0x5908('0x2'));var LIMIT_VALUE=0xfa;exports[_0x5908('0x3')]=function(_0x2653c5){var _0x2f27cc=null;if(_0x2653c5){_0x2f27cc=_0x2653c5[_0x5908('0x4')](',');}return _0x2f27cc;};exports[_0x5908('0x5')]=function(_0x447da6,_0xc84a36){var _0x17c6e6={};if(!_[_0x5908('0x6')](_0x447da6)){_[_0x5908('0x7')](_0x447da6,function(_0xeb7358,_0x270146){try{if(_0xc84a36){var _0x349d53=_[_0x5908('0x8')](_0xc84a36,{'name':_0x270146})||{};if(_0x349d53['type']===_0x5908('0x9')&&_[_0x5908('0xa')](_0xeb7358)){var _0x14265c=JSON[_0x5908('0xb')](_0xeb7358);var _0x53f642={'$gte':moment(moment(_0x14265c[_0x5908('0xc')])[_0x5908('0xd')]('YYYY-MM-DD'))[_0x5908('0xe')]()[_0x5908('0xd')](),'$lte':moment(moment(_0x14265c[_0x5908('0xf')])[_0x5908('0xd')]('YYYY-MM-DD'))['utc']()[_0x5908('0x10')](0x1,'s')['format']()};_0x17c6e6[_0x270146]=_0x53f642;}else if(_0x349d53[_0x5908('0x11')]===_0x5908('0x12')){_0x17c6e6[_0x270146]=_0xeb7358;}else{_0x17c6e6[_0x270146]=_['isArray'](_0xeb7358)?_0xeb7358:JSON[_0x5908('0xb')](_0xeb7358);}}else{_0x17c6e6[_0x270146]=_[_0x5908('0x13')](_0xeb7358)?_0xeb7358:JSON[_0x5908('0xb')](_0xeb7358);}}catch(_0x2f2fcd){_0x17c6e6[_0x270146]=_0xeb7358[_0x5908('0x4')](',');}});}return _0x17c6e6;};exports['limit']=function(_0x1872af){_0x1872af=parseInt(_0x1872af,0xa);if(!_0x1872af||_0x1872af<0x0){_0x1872af=LIMIT_VALUE;}return _0x1872af;};exports[_0x5908('0x14')]=function(_0x3e989f){_0x3e989f=parseInt(_0x3e989f,0xa);if(!_0x3e989f||_0x3e989f<0x0){_0x3e989f=0x0;}return _0x3e989f;};exports['sort']=function(_0x503fc6){var _0x2c7579,_0x5a3b7a=null;if(_0x503fc6){_0x2c7579=_0x503fc6[_0x5908('0x4')](',');_0x5a3b7a=_[_0x5908('0x15')](_0x2c7579,function(_0x54e17a){if(_0x54e17a[_0x5908('0x16')]('-')===0x0){return[_0x54e17a===_0x5908('0x17')?sequelize[_0x5908('0x18')](sequelize[_0x5908('0x19')](_0x5908('0x17')),_0x5908('0x1a')):_0x54e17a[_0x5908('0x1b')](0x1),_0x5908('0x1c')];}else{return[_0x54e17a===_0x5908('0x17')?sequelize[_0x5908('0x18')](sequelize[_0x5908('0x19')](_0x5908('0x17')),_0x5908('0x1a')):_0x54e17a,'ASC'];}});}return _0x5a3b7a;};exports[_0x5908('0x1d')]=function(_0x119123,_0x4b2974){if(_[_0x5908('0x6')](_0x119123)){return _0x119123;}if(_[_0x5908('0x13')](_0x119123)){for(var _0x32ed9b=0x0;_0x32ed9b<_0x119123[_0x5908('0x1e')];_0x32ed9b+=0x1){_0x119123[_0x32ed9b]=this[_0x5908('0x1d')](_0x119123[_0x32ed9b],_0x4b2974);}return _0x119123;}if(!_[_0x5908('0x1f')](_0x119123)){return _0x119123;}if(_[_0x5908('0x20')](_0x4b2974)){_0x4b2974=[_0x4b2974];}if(!_['isArray'](_0x4b2974)){return _0x119123;}for(var _0x467b04=0x0;_0x467b04<_0x4b2974[_0x5908('0x1e')];_0x467b04+=0x1){_['unset'](_0x119123,_0x4b2974[_0x467b04]);}for(var _0x50441e in _0x119123){if(_0x119123[_0x5908('0x21')](_0x50441e)){_0x119123[_0x50441e]=this[_0x5908('0x1d')](_0x119123[_0x50441e],_0x4b2974);}}return _0x119123;};exports['isNumeric']=function(_0x2c927d){return _0x2c927d['match'](RegExp(_0x5908('0x22')))?!![]:![];};exports[_0x5908('0x23')]=function(_0x57e8ee){return _0x57e8ee[_0x5908('0x24')](/^\S+@\S+$/)?!![]:![];};exports[_0x5908('0x25')]=function(_0x6d96f4){var _0x3d46ab=[];_0x6d96f4['split'](/[ ,]+/)[_0x5908('0x26')](function(_0x4ed523){_0x4ed523=_0x4ed523[_0x5908('0x27')](/([^:]")"+/g,'$1');_0x4ed523='+'+_0x4ed523+'*';if(_0x4ed523['includes']('@'))_0x4ed523='\x22'+_0x4ed523+'\x22';_0x3d46ab[_0x5908('0x28')](_0x4ed523);});return _0x3d46ab['join']('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 08f71fe..e429fb0 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ad8=['initialize','express','body-parser','method-override','errorhandler','path','passport','cors','./environment','../mysqldb','get','env','set','appPath','join','root','test','toISOString','split','use','static','views','/server/views','engine','html','ejs','renderFile','50mb','json'];(function(_0x3ef2d8,_0x4fdf2e){var _0x5c86a5=function(_0x29b702){while(--_0x29b702){_0x3ef2d8['push'](_0x3ef2d8['shift']());}};_0x5c86a5(++_0x4fdf2e);}(_0x3ad8,0x1b4));var _0x83ad=function(_0x1aa2a3,_0x1b5f47){_0x1aa2a3=_0x1aa2a3-0x0;var _0x2ec4a7=_0x3ad8[_0x1aa2a3];return _0x2ec4a7;};'use strict';var express=require(_0x83ad('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0x83ad('0x1'));var methodOverride=require(_0x83ad('0x2'));var cookieParser=require('cookie-parser');var errorHandler=require(_0x83ad('0x3'));var path=require(_0x83ad('0x4'));var passport=require(_0x83ad('0x5'));var cors=require(_0x83ad('0x6'));var moment=require('moment');var config=require(_0x83ad('0x7'));var db=require(_0x83ad('0x8'))['db'];exports['default']=function(_0xfbbb3d){var _0x36afda=_0xfbbb3d[_0x83ad('0x9')](_0x83ad('0xa'));if(_0x36afda==='production'){_0xfbbb3d[_0x83ad('0xb')](_0x83ad('0xc'),path[_0x83ad('0xd')](config[_0x83ad('0xe')],'public'));}if(_0x36afda==='development'||_0x36afda===_0x83ad('0xf')){_0xfbbb3d['set'](_0x83ad('0xc'),path['join'](config[_0x83ad('0xe')],'client'));_0xfbbb3d['use'](errorHandler());}_0xfbbb3d['set']('json\x20replacer',function(_0x4d2445,_0x2fd14e){if(this[_0x4d2445]instanceof Date){_0x2fd14e=this[_0x4d2445][_0x83ad('0x10')]()[_0x83ad('0x11')]('.')[0x0]+'Z';}return _0x2fd14e;});_0xfbbb3d[_0x83ad('0x12')](express[_0x83ad('0x13')](_0xfbbb3d['get'](_0x83ad('0xc'))));_0xfbbb3d['set'](_0x83ad('0x14'),config['root']+_0x83ad('0x15'));_0xfbbb3d[_0x83ad('0x16')](_0x83ad('0x17'),require(_0x83ad('0x18'))[_0x83ad('0x19')]);_0xfbbb3d[_0x83ad('0xb')]('view\x20engine',_0x83ad('0x17'));_0xfbbb3d['use'](bodyParser['urlencoded']({'limit':_0x83ad('0x1a'),'extended':!![]}));_0xfbbb3d[_0x83ad('0x12')](bodyParser[_0x83ad('0x1b')]({'limit':_0x83ad('0x1a')}));_0xfbbb3d[_0x83ad('0x12')](cors());_0xfbbb3d[_0x83ad('0x12')](methodOverride());_0xfbbb3d[_0x83ad('0x12')](cookieParser());_0xfbbb3d[_0x83ad('0x12')](passport[_0x83ad('0x1c')]());}; \ No newline at end of file +var _0xef8b=['default','get','env','production','appPath','public','development','set','join','root','client','use','json\x20replacer','toISOString','split','views','/server/views','engine','html','renderFile','urlencoded','json','50mb','initialize','express','serve-favicon','body-parser','method-override','path','cors','./environment','../mysqldb'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xef8b,0x118));var _0xbef8=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xef8b[_0x17b6e3];return _0x3906f3;};'use strict';var express=require(_0xbef8('0x0'));var favicon=require(_0xbef8('0x1'));var bodyParser=require(_0xbef8('0x2'));var methodOverride=require(_0xbef8('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require('errorhandler');var path=require(_0xbef8('0x4'));var passport=require('passport');var cors=require(_0xbef8('0x5'));var moment=require('moment');var config=require(_0xbef8('0x6'));var db=require(_0xbef8('0x7'))['db'];exports[_0xbef8('0x8')]=function(_0x582bf4){var _0x5e65bf=_0x582bf4[_0xbef8('0x9')](_0xbef8('0xa'));if(_0x5e65bf===_0xbef8('0xb')){_0x582bf4['set'](_0xbef8('0xc'),path['join'](config['root'],_0xbef8('0xd')));}if(_0x5e65bf===_0xbef8('0xe')||_0x5e65bf==='test'){_0x582bf4[_0xbef8('0xf')](_0xbef8('0xc'),path[_0xbef8('0x10')](config[_0xbef8('0x11')],_0xbef8('0x12')));_0x582bf4[_0xbef8('0x13')](errorHandler());}_0x582bf4[_0xbef8('0xf')](_0xbef8('0x14'),function(_0x74794e,_0x2a2241){if(this[_0x74794e]instanceof Date){_0x2a2241=this[_0x74794e][_0xbef8('0x15')]()[_0xbef8('0x16')]('.')[0x0]+'Z';}return _0x2a2241;});_0x582bf4['use'](express['static'](_0x582bf4[_0xbef8('0x9')]('appPath')));_0x582bf4[_0xbef8('0xf')](_0xbef8('0x17'),config[_0xbef8('0x11')]+_0xbef8('0x18'));_0x582bf4[_0xbef8('0x19')](_0xbef8('0x1a'),require('ejs')[_0xbef8('0x1b')]);_0x582bf4[_0xbef8('0xf')]('view\x20engine',_0xbef8('0x1a'));_0x582bf4[_0xbef8('0x13')](bodyParser[_0xbef8('0x1c')]({'limit':'50mb','extended':!![]}));_0x582bf4[_0xbef8('0x13')](bodyParser[_0xbef8('0x1d')]({'limit':_0xbef8('0x1e')}));_0x582bf4[_0xbef8('0x13')](cors());_0x582bf4['use'](methodOverride());_0x582bf4[_0xbef8('0x13')](cookieParser());_0x582bf4[_0xbef8('0x13')](passport[_0xbef8('0x1f')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 9387afd..85ab753 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 _0x1224=['cpus','map','model','join','createHash','md5','update','digest','hex','getUuid','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface'];(function(_0x50b2ff,_0x46ca56){var _0x143efc=function(_0x56bae9){while(--_0x56bae9){_0x50b2ff['push'](_0x50b2ff['shift']());}};_0x143efc(++_0x46ca56);}(_0x1224,0x10d));var _0x4122=function(_0x208c3b,_0x3481c0){_0x208c3b=_0x208c3b-0x0;var _0x1ea841=_0x1224[_0x208c3b];return _0x1ea841;};'use strict';var _=require(_0x4122('0x0'));var os=require('os');var crypto=require(_0x4122('0x1'));var machine=require(_0x4122('0x2'));var exec=require(_0x4122('0x3'))[_0x4122('0x4')];function getInterfaces(){var _0x3d42a9=[];var _0x51632b=os[_0x4122('0x5')]();var _0x1f1533=_[_0x4122('0x6')](_['keys'](_0x51632b));for(var _0x1d39a5=0x0;_0x1d39a5<_0x1f1533[_0x4122('0x7')];_0x1d39a5++){var _0xc6dfaf=_0x51632b[_0x1f1533[_0x1d39a5]][_0x4122('0x8')](function(_0x2a952c){return _0x2a952c[_0x4122('0x9')]===_0x4122('0xa')&&_0x2a952c[_0x4122('0xb')]===![];});_0x3d42a9=_0x3d42a9[_0x4122('0xc')](_0xc6dfaf);}return _0x3d42a9;}function getFirstInterface(){var _0x3e812e=_[_0x4122('0xd')](getInterfaces());return{'macAddress':_0x3e812e&&_0x3e812e[_0x4122('0xe')]?_0x3e812e[_0x4122('0xe')]:_0x4122('0xf'),'ipAddress':_0x3e812e&&_0x3e812e[_0x4122('0x10')]?_0x3e812e[_0x4122('0x10')]:_0x4122('0x11')};}exports[_0x4122('0x12')]=getFirstInterface;function getCPUhash(){var _0x476ed2=_[_0x4122('0x6')](os[_0x4122('0x13')]()[_0x4122('0x14')](function(_0x440ff0){return _0x440ff0[_0x4122('0x15')];}))[_0x4122('0x16')](':');return crypto[_0x4122('0x17')](_0x4122('0x18'))[_0x4122('0x19')](_0x476ed2)[_0x4122('0x1a')](_0x4122('0x1b'));}exports[_0x4122('0x1c')]=function(){switch(os['platform']()){case _0x4122('0x1d'):return exec(_0x4122('0x1e'),{'encoding':_0x4122('0x1f')})[_0x4122('0x20')]('\x0d\x0a','');default:var _0x520300=getFirstInterface();var _0x2e33cf=getCPUhash();var _0x19684e=_0x2e33cf+'|'+os['hostname']()+'|'+_0x520300[_0x4122('0x21')]+'|'+_0x520300[_0x4122('0x22')];var _0x399003=crypto[_0x4122('0x17')](_0x4122('0x18'))[_0x4122('0x19')](_0x19684e)[_0x4122('0x1a')]('hex');return _0x399003['substring'](0x0,0x8)+'-'+_0x399003['substring'](0x8,0xc)+'-'+_0x399003[_0x4122('0x23')](0xc,0x10)+'-'+_0x399003[_0x4122('0x23')](0x10,0x14)+'-'+_0x399003[_0x4122('0x23')](0x14);}}; \ No newline at end of file +var _0xee3c=['lodash','crypto','bimedia-machine-uuid','child_process','execSync','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','md5','getUuid','platform','utf8','hostname','ipAddress','createHash','digest','hex','substring'];(function(_0x438f67,_0x3a4e14){var _0x295fb3=function(_0x39c28f){while(--_0x39c28f){_0x438f67['push'](_0x438f67['shift']());}};_0x295fb3(++_0x3a4e14);}(_0xee3c,0x14a));var _0xcee3=function(_0x41c6dc,_0x3f830a){_0x41c6dc=_0x41c6dc-0x0;var _0x3152c1=_0xee3c[_0x41c6dc];return _0x3152c1;};'use strict';var _=require(_0xcee3('0x0'));var os=require('os');var crypto=require(_0xcee3('0x1'));var machine=require(_0xcee3('0x2'));var exec=require(_0xcee3('0x3'))[_0xcee3('0x4')];function getInterfaces(){var _0x853001=[];var _0x4f216c=os['networkInterfaces']();var _0x435892=_[_0xcee3('0x5')](_[_0xcee3('0x6')](_0x4f216c));for(var _0x2c3409=0x0;_0x2c3409<_0x435892[_0xcee3('0x7')];_0x2c3409++){var _0x44e46f=_0x4f216c[_0x435892[_0x2c3409]][_0xcee3('0x8')](function(_0x97f00e){return _0x97f00e[_0xcee3('0x9')]===_0xcee3('0xa')&&_0x97f00e[_0xcee3('0xb')]===![];});_0x853001=_0x853001[_0xcee3('0xc')](_0x44e46f);}return _0x853001;}function getFirstInterface(){var _0x861421=_[_0xcee3('0xd')](getInterfaces());return{'macAddress':_0x861421&&_0x861421[_0xcee3('0xe')]?_0x861421['mac']:_0xcee3('0xf'),'ipAddress':_0x861421&&_0x861421[_0xcee3('0x10')]?_0x861421[_0xcee3('0x10')]:_0xcee3('0x11')};}exports[_0xcee3('0x12')]=getFirstInterface;function getCPUhash(){var _0x2892ea=_['orderBy'](os[_0xcee3('0x13')]()[_0xcee3('0x14')](function(_0x2db8ff){return _0x2db8ff[_0xcee3('0x15')];}))[_0xcee3('0x16')](':');return crypto['createHash'](_0xcee3('0x17'))['update'](_0x2892ea)['digest']('hex');}exports[_0xcee3('0x18')]=function(){switch(os[_0xcee3('0x19')]()){case'win32':return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xcee3('0x1a')})['replace']('\x0d\x0a','');default:var _0x420b46=getFirstInterface();var _0x56b2cb=getCPUhash();var _0x3471d1=_0x56b2cb+'|'+os[_0xcee3('0x1b')]()+'|'+_0x420b46['macAddress']+'|'+_0x420b46[_0xcee3('0x1c')];var _0x3fe37f=crypto[_0xcee3('0x1d')](_0xcee3('0x17'))['update'](_0x3471d1)[_0xcee3('0x1e')](_0xcee3('0x1f'));return _0x3fe37f[_0xcee3('0x20')](0x0,0x8)+'-'+_0x3fe37f[_0xcee3('0x20')](0x8,0xc)+'-'+_0x3fe37f['substring'](0xc,0x10)+'-'+_0x3fe37f[_0xcee3('0x20')](0x10,0x14)+'-'+_0x3fe37f[_0xcee3('0x20')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index b4afa9a..ccfce41 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 _0xfe9f=['active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','update','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','catch','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','pkginfo','../../components/encryptor','../logger','license','https://www.xcallymotion.com','format','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','get','data1','then'];(function(_0x46aecf,_0x41fb9a){var _0x162300=function(_0x3a8ca3){while(--_0x3a8ca3){_0x46aecf['push'](_0x46aecf['shift']());}};_0x162300(++_0x41fb9a);}(_0xfe9f,0xe5));var _0xffe9=function(_0x2ca4ea,_0x1878d9){_0x2ca4ea=_0x2ca4ea-0x0;var _0x1b2d77=_0xfe9f[_0x2ca4ea];return _0x1b2d77;};'use strict';var util=require(_0xffe9('0x0'));var moment=require(_0xffe9('0x1'));var rp=require(_0xffe9('0x2'));var BPromise=require(_0xffe9('0x3'));var pkginfo=require(_0xffe9('0x4'))(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require(_0xffe9('0x5'));var hardware=require('./hardware');var logger=require(_0xffe9('0x6'))(_0xffe9('0x7'));var HOST=_0xffe9('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x38e9d0){return new BPromise(function(_0x332747,_0x4095fd){var _0x4831e3=util[_0xffe9('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x38e9d0,module[_0xffe9('0xa')][_0xffe9('0xb')]);if(oldToken){_0x4831e3=util[_0xffe9('0x9')](_0xffe9('0xc'),HOST,_0x38e9d0,module[_0xffe9('0xa')][_0xffe9('0xb')],oldToken);}var _0x2159fb={'uri':_0x4831e3,'method':_0xffe9('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x2159fb)['then'](function(_0x115ebf){_0x332747(_0x115ebf);})['catch'](function(_0x5bda8d){_0x4095fd(_0x5bda8d);});});}function manageLicense(_0x288fb0,_0x2ecb94){var _0x51678c=_0x2ecb94[_0xffe9('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x51678c[_0xffe9('0xf')]!==_0x288fb0&&!_0x51678c['data2']){oldToken=_0x51678c[_0xffe9('0xf')];}httpRequest(_0x288fb0)[_0xffe9('0x10')](function(_0x4ff8f5){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4ff8f5[_0xffe9('0x11')]){isOldTokenSent=![];if(!_0x51678c[_0xffe9('0x7')]&&_0x51678c[_0xffe9('0x7')]!=_0x4ff8f5[_0xffe9('0x7')]||_0x51678c[_0xffe9('0x7')]&&_0x51678c['data2']){logger[_0xffe9('0x12')](_0xffe9('0x13'));}if(_0x51678c[_0xffe9('0x7')]&&!_0x51678c[_0xffe9('0x14')]&&_0x51678c[_0xffe9('0x7')]!=_0x4ff8f5[_0xffe9('0x7')]){logger[_0xffe9('0x12')](_0xffe9('0x15'));}if(_0x51678c[_0xffe9('0x7')]&&!_0x51678c[_0xffe9('0x14')]&&_0x51678c['license']==_0x4ff8f5[_0xffe9('0x7')]){return _0x2ecb94;}return _0x2ecb94['update']({'data1':_0x288fb0,'data2':null,'license':_0x4ff8f5[_0xffe9('0x7')]});}else{if(_0x4ff8f5[_0xffe9('0x7')]||_0x51678c['license']){if(!_0x51678c['data2']){if(_0x51678c[_0xffe9('0xf')]==_0x288fb0){GRAY_PERIOD_REASON='Disabled';logger['info'](_0xffe9('0x16'));}else{GRAY_PERIOD_REASON='Changed';logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x51678c[_0xffe9('0xf')],_0x288fb0);}logger[_0xffe9('0x12')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xffe9('0x17')](),moment()[_0xffe9('0x9')](_0xffe9('0x18')));return _0x2ecb94['update']({'data2':encryptor[_0xffe9('0x19')](moment()[_0xffe9('0x9')](_0xffe9('0x18')))});}else{if(moment()[_0xffe9('0x1a')](encryptor[_0xffe9('0x1b')](_0x51678c[_0xffe9('0x14')]),'days')>DAYS){logger['info'](_0xffe9('0x1c'),moment()[_0xffe9('0x9')](_0xffe9('0x18')));isOldTokenSent=![];return _0x2ecb94[_0xffe9('0x1d')]({'data1':_0x288fb0,'data2':null,'license':null});}}}else{if(_0x51678c[_0xffe9('0xf')]!=_0x288fb0){logger[_0xffe9('0x12')](_0xffe9('0x1e'),_0x51678c['data1'],_0x288fb0);return _0x2ecb94[_0xffe9('0x1d')]({'data1':_0x288fb0,'data2':null,'license':null});}}}return _0x2ecb94;})['then'](function(_0x4c83f3){_0x2ecb94=_0x4c83f3;})[_0xffe9('0x1f')](function(_0x186f6f){logger[_0xffe9('0x20')](_0x186f6f[_0xffe9('0x21')]);})[_0xffe9('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0xffe9('0x23')](),_0x2ecb94);},TIME);});}function defaultLicense(){var _0xc057de=hardware['getUuid']();if(_0xc057de){return db[_0xffe9('0x24')][_0xffe9('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0xc057de}})[_0xffe9('0x26')](function(_0x25b5b9,_0x4eabed){logger[_0xffe9('0x12')](_0xffe9('0x27'),_0xc057de);manageLicense(_0xc057de,_0x25b5b9);})[_0xffe9('0x1f')](function(_0x4ef179){logger[_0xffe9('0x20')](_0x4ef179[_0xffe9('0x21')]);});}}exports[_0xffe9('0x28')]=defaultLicense; \ No newline at end of file +var _0xcffc=['message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','catch','get','data2','data1','then','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','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','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xcffc,0xb2));var _0xccff=function(_0x827634,_0x348fb5){_0x827634=_0x827634-0x0;var _0x24a95b=_0xcffc[_0x827634];return _0x24a95b;};'use strict';var util=require(_0xccff('0x0'));var moment=require(_0xccff('0x1'));var rp=require(_0xccff('0x2'));var BPromise=require(_0xccff('0x3'));var pkginfo=require(_0xccff('0x4'))(module,_0xccff('0x5'));var db=require(_0xccff('0x6'))['db'];var encryptor=require(_0xccff('0x7'));var hardware=require(_0xccff('0x8'));var logger=require(_0xccff('0x9'))('license');var HOST=_0xccff('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1c6bd7){return new BPromise(function(_0x538690,_0xbfb818){var _0x12d09f=util[_0xccff('0xb')](_0xccff('0xc'),HOST,_0x1c6bd7,module[_0xccff('0xd')][_0xccff('0x5')]);if(oldToken){_0x12d09f=util[_0xccff('0xb')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x1c6bd7,module['exports'][_0xccff('0x5')],oldToken);}var _0x1cf779={'uri':_0x12d09f,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x1cf779)['then'](function(_0x40ee3c){_0x538690(_0x40ee3c);})[_0xccff('0xe')](function(_0x7449c4){_0xbfb818(_0x7449c4);});});}function manageLicense(_0x5c0a82,_0x34a537){var _0x4b8e41=_0x34a537[_0xccff('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x4b8e41['data1']!==_0x5c0a82&&!_0x4b8e41[_0xccff('0x10')]){oldToken=_0x4b8e41[_0xccff('0x11')];}httpRequest(_0x5c0a82)[_0xccff('0x12')](function(_0x22e470){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x22e470[_0xccff('0x13')]){isOldTokenSent=![];if(!_0x4b8e41[_0xccff('0x14')]&&_0x4b8e41['license']!=_0x22e470[_0xccff('0x14')]||_0x4b8e41[_0xccff('0x14')]&&_0x4b8e41[_0xccff('0x10')]){logger[_0xccff('0x15')](_0xccff('0x16'));}if(_0x4b8e41[_0xccff('0x14')]&&!_0x4b8e41[_0xccff('0x10')]&&_0x4b8e41[_0xccff('0x14')]!=_0x22e470[_0xccff('0x14')]){logger[_0xccff('0x15')](_0xccff('0x17'));}if(_0x4b8e41['license']&&!_0x4b8e41[_0xccff('0x10')]&&_0x4b8e41[_0xccff('0x14')]==_0x22e470[_0xccff('0x14')]){return _0x34a537;}return _0x34a537[_0xccff('0x18')]({'data1':_0x5c0a82,'data2':null,'license':_0x22e470[_0xccff('0x14')]});}else{if(_0x22e470['license']||_0x4b8e41[_0xccff('0x14')]){if(!_0x4b8e41[_0xccff('0x10')]){if(_0x4b8e41[_0xccff('0x11')]==_0x5c0a82){GRAY_PERIOD_REASON=_0xccff('0x19');logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xccff('0x1a');logger[_0xccff('0x15')](_0xccff('0x1b'),_0x4b8e41[_0xccff('0x11')],_0x5c0a82);}logger[_0xccff('0x15')](_0xccff('0x1c'),GRAY_PERIOD_REASON[_0xccff('0x1d')](),moment()[_0xccff('0xb')](_0xccff('0x1e')));return _0x34a537[_0xccff('0x18')]({'data2':encryptor[_0xccff('0x1f')](moment()[_0xccff('0xb')](_0xccff('0x1e')))});}else{if(moment()[_0xccff('0x20')](encryptor[_0xccff('0x21')](_0x4b8e41[_0xccff('0x10')]),_0xccff('0x22'))>DAYS){logger[_0xccff('0x15')](_0xccff('0x23'),moment()[_0xccff('0xb')](_0xccff('0x1e')));isOldTokenSent=![];return _0x34a537[_0xccff('0x18')]({'data1':_0x5c0a82,'data2':null,'license':null});}}}else{if(_0x4b8e41[_0xccff('0x11')]!=_0x5c0a82){logger[_0xccff('0x15')](_0xccff('0x1b'),_0x4b8e41['data1'],_0x5c0a82);return _0x34a537[_0xccff('0x18')]({'data1':_0x5c0a82,'data2':null,'license':null});}}}return _0x34a537;})[_0xccff('0x12')](function(_0x4bde62){_0x34a537=_0x4bde62;})['catch'](function(_0xb9de08){logger[_0xccff('0x24')](_0xb9de08[_0xccff('0x25')]);})[_0xccff('0x26')](function(){setTimeout(function(){manageLicense(hardware[_0xccff('0x27')](),_0x34a537);},TIME);});}function defaultLicense(){var _0x2d2e62=hardware[_0xccff('0x27')]();if(_0x2d2e62){return db['License'][_0xccff('0x28')]({'where':{'id':0x1},'defaults':{'data1':_0x2d2e62}})[_0xccff('0x29')](function(_0x1ab374,_0x2ff9cc){logger['info'](_0xccff('0x2a'),_0x2d2e62);manageLicense(_0x2d2e62,_0x1ab374);})[_0xccff('0xe')](function(_0x308b67){logger[_0xccff('0x24')](_0x308b67[_0xccff('0x25')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 62484da..e49029d 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 _0x97e0=['parse','demo','gray','add','days','grayReason','machineUuid','changed','then','User','findAll','role','sequelize','col','count','admin','user','telephone','users','telephones','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','find','defaults','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','format'];(function(_0x2ae54b,_0x37fb45){var _0xacef56=function(_0x498d67){while(--_0x498d67){_0x2ae54b['push'](_0x2ae54b['shift']());}};_0xacef56(++_0x37fb45);}(_0x97e0,0x145));var _0x097e=function(_0x4498ac,_0x30e301){_0x4498ac=_0x4498ac-0x0;var _0x4bf1b6=_0x97e0[_0x4498ac];return _0x4bf1b6;};'use strict';var util=require(_0x097e('0x0'));var _=require('lodash');var moment=require(_0x097e('0x1'));var BPromise=require(_0x097e('0x2'));var hardware=require('./hardware');var encryptor=require(_0x097e('0x3'));var db=require(_0x097e('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x097e('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x097e('0x6'),'machineUuid':hardware[_0x097e('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x097e('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x097e('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x13d7b0){return new BPromise(function(_0x385890,_0x4f63b3){return db[_0x097e('0x8')][_0x097e('0x9')](_[_0x097e('0xa')](_0x13d7b0,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x126565){return checkLicense(_0x126565,null);})['then'](function(_0x29352d){_0x385890(_0x29352d);return;})[_0x097e('0xb')](function(_0x2ba814){_0x4f63b3(_0x2ba814);});});}function checkLicense(_0x1ad888,_0x2af5f3){if(!_0x1ad888){demoLicense[_0x097e('0xc')]=_0x1ad888[_0x097e('0xd')];return demoLicense;}try{var _0x36f3c6=_0x2af5f3||_0x1ad888[_0x097e('0xe')];if(_[_0x097e('0xf')](_0x36f3c6)){throw new Error(_0x097e('0x10'));}var _0x53bbc2=_0x1ad888[_0x097e('0xd')];var _0x27d10d=_0x1ad888['data2'];var _0x5d3282=_0x53bbc2[_0x097e('0x11')]('-')[0x4];var _0x1a4e31=_0x53bbc2[_0x097e('0x11')]('-')[0x0];var _0x25d0b3=encryptor['decryptString'](_0x36f3c6,util[_0x097e('0x12')]('%s:%s:%s',_0x5d3282,_0x53bbc2,_0x1a4e31));var _0x19a084=JSON[_0x097e('0x13')](_0x25d0b3);_0x19a084[_0x097e('0x14')]=![];_0x19a084[_0x097e('0xc')]=_0x53bbc2;_0x19a084['machineUuid']=hardware[_0x097e('0x7')]();if(_0x27d10d){var _0x236c6b=encryptor['decryptString'](_0x27d10d);_0x19a084[_0x097e('0x15')]=_0x236c6b;_0x19a084['deadline']=moment(_0x236c6b)[_0x097e('0x16')](0x7,_0x097e('0x17'))['format']();_0x19a084[_0x097e('0x18')]=_0x19a084['uuid']!=_0x19a084[_0x097e('0x19')]?_0x097e('0x1a'):'disabled';}return _0x19a084;}catch(_0x4668b5){breakingLicense[_0x097e('0xc')]=_0x1ad888[_0x097e('0xd')];breakingLicense['message']=_0x4668b5['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x58aaf5,_0x3c17c3){getLicense()[_0x097e('0x1b')](function(_0xe61433){return db[_0x097e('0x1c')][_0x097e('0x1d')]({'attributes':[_0x097e('0x1e'),[db[_0x097e('0x1f')]['fn']('COUNT',db[_0x097e('0x1f')][_0x097e('0x20')](_0x097e('0x1e'))),_0x097e('0x21')]],'group':_0x097e('0x1e'),'where':{'role':{'$or':[_0x097e('0x22'),_0x097e('0x23'),_0x097e('0x24')]}},'raw':!![]})[_0x097e('0x1b')](function(_0xd74f57){var _0x123ce1={'user':_0xe61433[_0x097e('0x25')]||0x0,'telephone':_0xe61433[_0x097e('0x26')]||0x0};_0xd74f57['forEach'](function(_0x109940){var _0x182554=_0x109940['role']===_0x097e('0x22')?_0x097e('0x23'):_0x109940[_0x097e('0x1e')];_0x123ce1[_0x182554]-=_0x109940[_0x097e('0x21')];if(_0x123ce1[_0x182554]<0x0)_0x123ce1[_0x182554]=0x0;});_0x58aaf5(_0x123ce1);return;});})['catch'](function(_0x282604){_0x3c17c3(_0x282604);});});}function checkUserLimits(_0x182107){return new BPromise(function(_0x210e05,_0x658c3a){getLimits()['then'](function(_0x444bd3){var _0x43393f=_[_0x097e('0x27')](_['countBy'](_0x182107,'role'),[_0x097e('0x22'),_0x097e('0x23'),_0x097e('0x24')]);var _0x1b9435=(_0x43393f[_0x097e('0x22')]||0x0)+(_0x43393f[_0x097e('0x23')]||0x0);var _0x3c9708=_0x43393f[_0x097e('0x24')]||0x0;if(_0x1b9435>_0x444bd3[_0x097e('0x23')])return _0x658c3a(_0x097e('0x28'));if(_0x3c9708>_0x444bd3[_0x097e('0x24')])return _0x658c3a(_0x097e('0x29'));return _0x210e05();})[_0x097e('0xb')](function(_0x56957c){_0x658c3a(_0x56957c);});});}module[_0x097e('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x3937=['decryptString','format','parse','demo','machineUuid','gray','deadline','add','grayReason','message','findAll','sequelize','COUNT','col','role','count','admin','telephone','users','telephones','user','catch','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','License','defaults','then','uuid','data1','split'];(function(_0x4f8ca6,_0xe0171c){var _0x15918a=function(_0x30265a){while(--_0x30265a){_0x4f8ca6['push'](_0x4f8ca6['shift']());}};_0x15918a(++_0xe0171c);}(_0x3937,0x92));var _0x7393=function(_0xa614e4,_0xb4c667){_0xa614e4=_0xa614e4-0x0;var _0x169c5c=_0x3937[_0xa614e4];return _0x169c5c;};'use strict';var util=require(_0x7393('0x0'));var _=require('lodash');var moment=require('moment');var BPromise=require(_0x7393('0x1'));var hardware=require(_0x7393('0x2'));var encryptor=require(_0x7393('0x3'));var db=require(_0x7393('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7393('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x7393('0x6'),'machineUuid':hardware[_0x7393('0x7')](),'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':'Breaking\x20license','machineUuid':hardware[_0x7393('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x91eab9){return new BPromise(function(_0x4578f3,_0x26f226){return db[_0x7393('0x8')]['find'](_[_0x7393('0x9')](_0x91eab9,{'raw':!![],'where':{'id':0x1}}))[_0x7393('0xa')](function(_0x3f6aad){return checkLicense(_0x3f6aad,null);})[_0x7393('0xa')](function(_0x28494c){_0x4578f3(_0x28494c);return;})['catch'](function(_0x240227){_0x26f226(_0x240227);});});}function checkLicense(_0x475641,_0xc3c4a){if(!_0x475641){demoLicense[_0x7393('0xb')]=_0x475641[_0x7393('0xc')];return demoLicense;}try{var _0x47dbbf=_0xc3c4a||_0x475641['license'];if(_['isEmpty'](_0x47dbbf)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x24e893=_0x475641['data1'];var _0x577baa=_0x475641['data2'];var _0x379c4a=_0x24e893['split']('-')[0x4];var _0x29bd97=_0x24e893[_0x7393('0xd')]('-')[0x0];var _0x444209=encryptor[_0x7393('0xe')](_0x47dbbf,util[_0x7393('0xf')]('%s:%s:%s',_0x379c4a,_0x24e893,_0x29bd97));var _0x9cc2c7=JSON[_0x7393('0x10')](_0x444209);_0x9cc2c7[_0x7393('0x11')]=![];_0x9cc2c7[_0x7393('0xb')]=_0x24e893;_0x9cc2c7[_0x7393('0x12')]=hardware[_0x7393('0x7')]();if(_0x577baa){var _0x1bd24e=encryptor[_0x7393('0xe')](_0x577baa);_0x9cc2c7[_0x7393('0x13')]=_0x1bd24e;_0x9cc2c7[_0x7393('0x14')]=moment(_0x1bd24e)[_0x7393('0x15')](0x7,'days')['format']();_0x9cc2c7[_0x7393('0x16')]=_0x9cc2c7['uuid']!=_0x9cc2c7[_0x7393('0x12')]?'changed':'disabled';}return _0x9cc2c7;}catch(_0x1556cf){breakingLicense[_0x7393('0xb')]=_0x475641[_0x7393('0xc')];breakingLicense[_0x7393('0x17')]=_0x1556cf[_0x7393('0x17')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x17ee4c,_0x36a94f){getLicense()[_0x7393('0xa')](function(_0xff0673){return db['User'][_0x7393('0x18')]({'attributes':['role',[db[_0x7393('0x19')]['fn'](_0x7393('0x1a'),db['sequelize'][_0x7393('0x1b')](_0x7393('0x1c'))),_0x7393('0x1d')]],'group':_0x7393('0x1c'),'where':{'role':{'$or':[_0x7393('0x1e'),'user',_0x7393('0x1f')]}},'raw':!![]})[_0x7393('0xa')](function(_0x4e7505){var _0x14094e={'user':_0xff0673[_0x7393('0x20')]||0x0,'telephone':_0xff0673[_0x7393('0x21')]||0x0};_0x4e7505['forEach'](function(_0x2909ec){var _0x425c83=_0x2909ec[_0x7393('0x1c')]===_0x7393('0x1e')?_0x7393('0x22'):_0x2909ec[_0x7393('0x1c')];_0x14094e[_0x425c83]-=_0x2909ec[_0x7393('0x1d')];if(_0x14094e[_0x425c83]<0x0)_0x14094e[_0x425c83]=0x0;});_0x17ee4c(_0x14094e);return;});})[_0x7393('0x23')](function(_0x459fcc){_0x36a94f(_0x459fcc);});});}function checkUserLimits(_0xa25d84){return new BPromise(function(_0x1455cd,_0x358caf){getLimits()['then'](function(_0x2acb7f){var _0x7d7848=_['pick'](_[_0x7393('0x24')](_0xa25d84,_0x7393('0x1c')),[_0x7393('0x1e'),_0x7393('0x22'),_0x7393('0x1f')]);var _0x5dfce0=(_0x7d7848[_0x7393('0x1e')]||0x0)+(_0x7d7848[_0x7393('0x22')]||0x0);var _0x592a61=_0x7d7848['telephone']||0x0;if(_0x5dfce0>_0x2acb7f[_0x7393('0x22')])return _0x358caf(_0x7393('0x25'));if(_0x592a61>_0x2acb7f['telephone'])return _0x358caf(_0x7393('0x26'));return _0x1455cd();})[_0x7393('0x23')](function(_0x4f6882){_0x358caf(_0x4f6882);});});}module[_0x7393('0x27')]={'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 379cf23..0ebf250 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 _0x4797=['http://localhost:9000','secret'];(function(_0x290fa6,_0x16d017){var _0x47f1f3=function(_0x2b5eb8){while(--_0x2b5eb8){_0x290fa6['push'](_0x290fa6['shift']());}};_0x47f1f3(++_0x16d017);}(_0x4797,0x150));var _0x7479=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4797[_0x321bb2];return _0x9c12ed;};'use strict';module['exports']={'DOMAIN':_0x7479('0x0'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x7479('0x1'),'DEBUG':''}; \ No newline at end of file +var _0xd7d0=['http://localhost:9000','app-id','secret','exports'];(function(_0x4ed4d2,_0x47acf7){var _0x15ae2e=function(_0x3199f0){while(--_0x3199f0){_0x4ed4d2['push'](_0x4ed4d2['shift']());}};_0x15ae2e(++_0x47acf7);}(_0xd7d0,0x113));var _0x0d7d=function(_0x1006d5,_0x31bf70){_0x1006d5=_0x1006d5-0x0;var _0x4513da=_0xd7d0[_0x1006d5];return _0x4513da;};'use strict';module[_0x0d7d('0x0')]={'DOMAIN':_0x0d7d('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x0d7d('0x2'),'GOOGLE_SECRET':_0x0d7d('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index ecdcfff..316a271 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8989=['}}}','replace','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','Logger','transports','File','%s-%s','error','info','Console','env','moment','winston','util','path','INFO','/var','log','xcally','format','message','{{{'];(function(_0x53b133,_0x176261){var _0x5647e0=function(_0x4c62b0){while(--_0x4c62b0){_0x53b133['push'](_0x53b133['shift']());}};_0x5647e0(++_0x176261);}(_0x8989,0x72));var _0x9898=function(_0x1a70e0,_0x5cd0f7){_0x1a70e0=_0x1a70e0-0x0;var _0x4548d3=_0x8989[_0x1a70e0];return _0x4548d3;};'use strict';var moment=require(_0x9898('0x0'));var winston=require(_0x9898('0x1'));var util=require(_0x9898('0x2'));var path=require(_0x9898('0x3'));var debugLevel=_0x9898('0x4');function filename(_0x388a94,_0xfda48){return path['join'](_0x9898('0x5'),_0x9898('0x6'),_0x9898('0x7'),util[_0x9898('0x8')]('%s-%s.log',_0x388a94,_0xfda48));}function formatter(_0x2d2be6,_0x51c09a){_0x51c09a[_0x9898('0x9')]=_0x51c09a[_0x9898('0x9')]['replace'](/@@{/g,_0x9898('0xa'))['replace'](/}@@/g,_0x9898('0xb'))[_0x9898('0xc')](/@{/g,'{{')[_0x9898('0xc')](/}@/g,'}}');return util[_0x9898('0x8')](_0x9898('0xd'),moment()[_0x9898('0x8')](_0x9898('0xe')),_0x51c09a[_0x9898('0xf')][_0x9898('0x10')](),_0x2d2be6,_0x51c09a[_0x9898('0x9')]);}module['exports']=function(_0x1f1b83){return new winston[(_0x9898('0x11'))]({'transports':[new winston[(_0x9898('0x12'))][(_0x9898('0x13'))]({'name':util['format'](_0x9898('0x14'),_0x1f1b83,_0x9898('0x15')),'filename':filename(_0x1f1b83,_0x9898('0x15')),'level':_0x9898('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5cb2){return formatter(_0x1f1b83,_0x5cb2);}}),new winston[(_0x9898('0x12'))][(_0x9898('0x13'))]({'name':util[_0x9898('0x8')]('%s-%s',_0x1f1b83,_0x9898('0x16')),'filename':filename(_0x1f1b83,_0x9898('0x16')),'level':_0x9898('0x16'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x48cca0){return formatter(_0x1f1b83,_0x48cca0);}}),new winston['transports'][(_0x9898('0x17'))]({'level':process[_0x9898('0x18')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x64e843){return formatter(_0x1f1b83,_0x64e843);}})]});}; \ No newline at end of file +var _0x344d=['level','toUpperCase','exports','Logger','transports','%s-%s','error','File','info','Console','env','debugLevel','winston','util','path','INFO','/var','log','xcally','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x674397,_0x2744ff){var _0x3a15df=function(_0x2be1c3){while(--_0x2be1c3){_0x674397['push'](_0x674397['shift']());}};_0x3a15df(++_0x2744ff);}(_0x344d,0xf6));var _0xd344=function(_0x590275,_0x9451d){_0x590275=_0x590275-0x0;var _0x4fc880=_0x344d[_0x590275];return _0x4fc880;};'use strict';var moment=require('moment');var winston=require(_0xd344('0x0'));var util=require(_0xd344('0x1'));var path=require(_0xd344('0x2'));var debugLevel=_0xd344('0x3');function filename(_0x19365e,_0x4d5cba){return path['join'](_0xd344('0x4'),_0xd344('0x5'),_0xd344('0x6'),util[_0xd344('0x7')](_0xd344('0x8'),_0x19365e,_0x4d5cba));}function formatter(_0x146714,_0xc54737){_0xc54737['message']=_0xc54737[_0xd344('0x9')][_0xd344('0xa')](/@@{/g,'{{{')[_0xd344('0xa')](/}@@/g,_0xd344('0xb'))['replace'](/@{/g,'{{')[_0xd344('0xa')](/}@/g,'}}');return util[_0xd344('0x7')](_0xd344('0xc'),moment()[_0xd344('0x7')](_0xd344('0xd')),_0xc54737[_0xd344('0xe')][_0xd344('0xf')](),_0x146714,_0xc54737[_0xd344('0x9')]);}module[_0xd344('0x10')]=function(_0x2bfb55){return new winston[(_0xd344('0x11'))]({'transports':[new winston[(_0xd344('0x12'))]['File']({'name':util[_0xd344('0x7')](_0xd344('0x13'),_0x2bfb55,_0xd344('0x14')),'filename':filename(_0x2bfb55,_0xd344('0x14')),'level':_0xd344('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x6c069a){return formatter(_0x2bfb55,_0x6c069a);}}),new winston['transports'][(_0xd344('0x15'))]({'name':util[_0xd344('0x7')](_0xd344('0x13'),_0x2bfb55,_0xd344('0x16')),'filename':filename(_0x2bfb55,_0xd344('0x16')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1ceb6d){return formatter(_0x2bfb55,_0x1ceb6d);}}),new winston[(_0xd344('0x12'))][(_0xd344('0x17'))]({'level':process[_0xd344('0x18')][_0xd344('0x19')]||debugLevel,'json':![],'formatter':function(_0x479c53){return formatter(_0x2bfb55,_0x479c53);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 9dcc298..93c13d4 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 _0x9d5b=['exports','path','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x9d5b,0x71));var _0xb9d5=function(_0x2e1f57,_0x5e6ed8){_0x2e1f57=_0x2e1f57-0x0;var _0x313a58=_0x9d5b[_0x2e1f57];return _0x313a58;};'use strict';var path=require(_0xb9d5('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0xb9d5('0x1')](__dirname,_0xb9d5('0x2'))},{'name':_0xb9d5('0x3'),'script':path['join'](__dirname,_0xb9d5('0x4'))},{'name':_0xb9d5('0x5'),'script':path['join'](__dirname,_0xb9d5('0x6'))},{'name':_0xb9d5('0x7'),'script':path[_0xb9d5('0x1')](__dirname,_0xb9d5('0x8'))},{'name':_0xb9d5('0x9'),'script':path[_0xb9d5('0x1')](__dirname,_0xb9d5('0xa'))},{'name':_0xb9d5('0xb'),'script':path['join'](__dirname,_0xb9d5('0xc'))}]};module[_0xb9d5('0xd')]=config; \ No newline at end of file +var _0x9bde=['../../services/ami/index.js','agi','../../services/agi/index.js','email','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','express','../../services/express/index.js','join'];(function(_0x96a34a,_0x48b3c6){var _0x4e325e=function(_0x20e343){while(--_0x20e343){_0x96a34a['push'](_0x96a34a['shift']());}};_0x4e325e(++_0x48b3c6);}(_0x9bde,0xe1));var _0xe9bd=function(_0x69e73d,_0x447c58){_0x69e73d=_0x69e73d-0x0;var _0x3e833e=_0x9bde[_0x69e73d];return _0x3e833e;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0xe9bd('0x0'),'script':path['join'](__dirname,_0xe9bd('0x1'))},{'name':'ami','script':path[_0xe9bd('0x2')](__dirname,_0xe9bd('0x3'))},{'name':_0xe9bd('0x4'),'script':path[_0xe9bd('0x2')](__dirname,_0xe9bd('0x5'))},{'name':_0xe9bd('0x6'),'script':path[_0xe9bd('0x2')](__dirname,'../../services/email/index.js')},{'name':_0xe9bd('0x7'),'script':path[_0xe9bd('0x2')](__dirname,_0xe9bd('0x8'))},{'name':_0xe9bd('0x9'),'script':path[_0xe9bd('0x2')](__dirname,_0xe9bd('0xa'))}]};module[_0xe9bd('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 2d9029e..f364984 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 _0x3d94=['./config','connect','then','stop','disconnect','restart','list','describe','delete','dump','saved','bluebird'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3d94,0xd7));var _0x43d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d94[_0x3dd15e];return _0x231fd0;};'use strict';var pm2=require('pm2');var BPromise=require(_0x43d9('0x0'));var config=require(_0x43d9('0x1'));function connect(){return new BPromise(function(_0x3efe3e,_0x596d57){return pm2[_0x43d9('0x2')](function(_0x1a4e73){if(_0x1a4e73){return _0x596d57(_0x1a4e73);}return _0x3efe3e('connected');});});};exports['start']=function(_0x11d27c){return connect()[_0x43d9('0x3')](function(){return new BPromise(function(_0x4a72f4,_0xc6dd85){return pm2['start'](_0x11d27c,function(_0x1301ae,_0x33f4a7){if(_0x1301ae){return _0xc6dd85(_0x1301ae);}pm2['disconnect']();return _0x4a72f4(_0x33f4a7);});});});};exports[_0x43d9('0x4')]=function(_0x30953b){return connect()[_0x43d9('0x3')](function(){return new BPromise(function(_0x355c4a,_0x39e73e){return pm2['stop'](_0x30953b,function(_0x567085,_0x3451c2){if(_0x567085){return _0x39e73e(_0x567085);}pm2[_0x43d9('0x5')]();return _0x355c4a(_0x3451c2);});});});};exports[_0x43d9('0x6')]=function(_0x3534e7){return connect()[_0x43d9('0x3')](function(){return new BPromise(function(_0x38dd5f,_0x1bff1a){return pm2[_0x43d9('0x6')](_0x3534e7,function(_0x1db7f0,_0x57ca24){if(_0x1db7f0){return _0x1bff1a(_0x1db7f0);}pm2[_0x43d9('0x5')]();return _0x38dd5f(_0x57ca24);});});});};exports[_0x43d9('0x7')]=function(){return connect()['then'](function(){return new BPromise(function(_0x2a5d6b,_0xbce76){return pm2[_0x43d9('0x7')](function(_0x37b52b,_0x468439){if(_0x37b52b){return _0xbce76(_0x37b52b);}pm2[_0x43d9('0x5')]();return _0x2a5d6b(_0x468439);});});});};exports[_0x43d9('0x8')]=function(_0x1601cb){return connect()['then'](function(){return new BPromise(function(_0x3ce5e6,_0xd562b8){return pm2[_0x43d9('0x8')](_0x1601cb,function(_0x392704,_0x50c605){if(_0x392704){return _0xd562b8(_0x392704);}pm2[_0x43d9('0x5')]();return _0x3ce5e6(_0x50c605);});});});};exports[_0x43d9('0x9')]=function(_0x3367db){return connect()[_0x43d9('0x3')](function(){return new BPromise(function(_0x2da646,_0x2738d2){return pm2[_0x43d9('0x9')](_0x3367db,function(_0x121d7c,_0x530421){if(_0x121d7c){return _0x2738d2(_0x121d7c);}pm2[_0x43d9('0x5')]();return _0x2da646(_0x530421);});});});};exports[_0x43d9('0xa')]=function(){return connect()[_0x43d9('0x3')](function(){return new BPromise(function(_0x12ea96,_0xc39da0){return pm2[_0x43d9('0xa')](function(_0x41fc1b){if(_0x41fc1b){return _0xc39da0(_0x41fc1b);}return _0x12ea96(_0x43d9('0xb'));});});});}; \ No newline at end of file +var _0x746f=['restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','connected','start','then','disconnect','stop'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x746f,0x9c));var _0xf746=function(_0x49a611,_0x425ba8){_0x49a611=_0x49a611-0x0;var _0x155406=_0x746f[_0x49a611];return _0x155406;};'use strict';var pm2=require(_0xf746('0x0'));var BPromise=require(_0xf746('0x1'));var config=require(_0xf746('0x2'));function connect(){return new BPromise(function(_0x8456e1,_0x333f9b){return pm2[_0xf746('0x3')](function(_0x20344a){if(_0x20344a){return _0x333f9b(_0x20344a);}return _0x8456e1(_0xf746('0x4'));});});};exports[_0xf746('0x5')]=function(_0x150d39){return connect()[_0xf746('0x6')](function(){return new BPromise(function(_0x35ff5f,_0x19d855){return pm2[_0xf746('0x5')](_0x150d39,function(_0x2edb61,_0x3fc620){if(_0x2edb61){return _0x19d855(_0x2edb61);}pm2[_0xf746('0x7')]();return _0x35ff5f(_0x3fc620);});});});};exports[_0xf746('0x8')]=function(_0x37a0f5){return connect()[_0xf746('0x6')](function(){return new BPromise(function(_0x33f5ef,_0x232864){return pm2[_0xf746('0x8')](_0x37a0f5,function(_0xb5d59f,_0xf72dfd){if(_0xb5d59f){return _0x232864(_0xb5d59f);}pm2['disconnect']();return _0x33f5ef(_0xf72dfd);});});});};exports[_0xf746('0x9')]=function(_0x4223f){return connect()[_0xf746('0x6')](function(){return new BPromise(function(_0x47ce05,_0xbd6665){return pm2['restart'](_0x4223f,function(_0xeb95dc,_0x39edcf){if(_0xeb95dc){return _0xbd6665(_0xeb95dc);}pm2[_0xf746('0x7')]();return _0x47ce05(_0x39edcf);});});});};exports[_0xf746('0xa')]=function(){return connect()[_0xf746('0x6')](function(){return new BPromise(function(_0xc58e64,_0x4d30cc){return pm2[_0xf746('0xa')](function(_0x3e4ebd,_0x206b05){if(_0x3e4ebd){return _0x4d30cc(_0x3e4ebd);}pm2['disconnect']();return _0xc58e64(_0x206b05);});});});};exports[_0xf746('0xb')]=function(_0xced60b){return connect()[_0xf746('0x6')](function(){return new BPromise(function(_0xea80a6,_0x336f54){return pm2[_0xf746('0xb')](_0xced60b,function(_0x555886,_0x313a59){if(_0x555886){return _0x336f54(_0x555886);}pm2['disconnect']();return _0xea80a6(_0x313a59);});});});};exports[_0xf746('0xc')]=function(_0xcc782){return connect()['then'](function(){return new BPromise(function(_0x12665a,_0x221d2e){return pm2[_0xf746('0xc')](_0xcc782,function(_0x11d8db,_0x2404a6){if(_0x11d8db){return _0x221d2e(_0x11d8db);}pm2[_0xf746('0x7')]();return _0x12665a(_0x2404a6);});});});};exports['dump']=function(){return connect()[_0xf746('0x6')](function(){return new BPromise(function(_0x486c27,_0x15465c){return pm2[_0xf746('0xd')](function(_0x2f9ab2){if(_0x2f9ab2){return _0x15465c(_0x2f9ab2);}return _0x486c27(_0xf746('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 8273e3b..07fb80b 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 _0xa95c=['ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','length','map','[CHAT]\x20Interactions\x20to\x20close:','update','system','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','chatInteraction:update','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment'];(function(_0x328497,_0x308472){var _0x13e1f0=function(_0x163b4b){while(--_0x163b4b){_0x328497['push'](_0x328497['shift']());}};_0x13e1f0(++_0x308472);}(_0xa95c,0x1cf));var _0xca95=function(_0x10bcf9,_0x347b2c){_0x10bcf9=_0x10bcf9-0x0;var _0x22c37c=_0xa95c[_0x10bcf9];return _0x22c37c;};'use strict';var _=require(_0xca95('0x0'));var moment=require(_0xca95('0x1'));var Redis=require(_0xca95('0x2'));var util=require(_0xca95('0x3'));var config=require(_0xca95('0x4'));var db=require(_0xca95('0x5'))['db'];var logger=require(_0xca95('0x6'))(_0xca95('0x7'));config[_0xca95('0x8')]=_[_0xca95('0x9')](config[_0xca95('0x8')],{'host':_0xca95('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xca95('0x8')]));function closeInteractions(){var _0x3d72fc=0x0;var _0xabded1=[];return db['Setting'][_0xca95('0xb')]({'raw':!![],'attributes':['id',_0xca95('0xc')],'where':{'id':0x1}})[_0xca95('0xd')](function(_0x3ecefa){_0x3d72fc=_0x3ecefa[_0xca95('0xc')];if(_0x3d72fc){return db[_0xca95('0xe')][_0xca95('0xf')]({'raw':!![],'attributes':['id',_0xca95('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xca95('0x11')](_0x3ecefa[_0xca95('0xc')],'minutes')}}});}else{return[];}})[_0xca95('0xd')](function(_0x3a1ffe){if(_0x3a1ffe&&_0x3a1ffe[_0xca95('0x12')]){_0xabded1=_[_0xca95('0x13')](_0x3a1ffe||[],'id');logger['info'](_0xca95('0x14'),_0xabded1['join']());return db['ChatInteraction'][_0xca95('0x15')]({'closeReason':_0xca95('0x16'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0xca95('0x17'))},{'where':{'id':_0xabded1}});}})[_0xca95('0xd')](function(){if(_0xabded1&&_0xabded1[_0xca95('0x12')]){logger['info'](_0xca95('0x18'),_0xabded1[_0xca95('0x19')]());for(var _0x829a94=0x0;_0x829a94<_0xabded1[_0xca95('0x12')];_0x829a94++){io[_0xca95('0x1a')](_0xca95('0x1b'),{'id':_0xabded1[_0x829a94],'closed':!![]});}}})['catch'](function(_0xf73b1){logger['error'](_0xca95('0x1c'),_0xf73b1?util[_0xca95('0x1d')](_0xf73b1,{'showHidden':![],'depth':null}):'');});}exports[_0xca95('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x9e3d=['info','[CHAT]\x20Interactions\x20to\x20close:','join','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','defaults','redis','localhost','Setting','find','then','ChatInteraction','findAll','lastMsgAt','chatTimeout','minutes','length'];(function(_0x1930ee,_0x4dc696){var _0x110756=function(_0x49f0b7){while(--_0x49f0b7){_0x1930ee['push'](_0x1930ee['shift']());}};_0x110756(++_0x4dc696);}(_0x9e3d,0xc6));var _0xd9e3=function(_0x4924d2,_0x503f53){_0x4924d2=_0x4924d2-0x0;var _0x3f7576=_0x9e3d[_0x4924d2];return _0x3f7576;};'use strict';var _=require(_0xd9e3('0x0'));var moment=require(_0xd9e3('0x1'));var Redis=require(_0xd9e3('0x2'));var util=require(_0xd9e3('0x3'));var config=require(_0xd9e3('0x4'));var db=require(_0xd9e3('0x5'))['db'];var logger=require(_0xd9e3('0x6'))('schedule');config['redis']=_[_0xd9e3('0x7')](config[_0xd9e3('0x8')],{'host':_0xd9e3('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd9e3('0x8')]));function closeInteractions(){var _0x1677d8=0x0;var _0x58217a=[];return db[_0xd9e3('0xa')][_0xd9e3('0xb')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xd9e3('0xc')](function(_0x439211){_0x1677d8=_0x439211['chatTimeout'];if(_0x1677d8){return db[_0xd9e3('0xd')][_0xd9e3('0xe')]({'raw':!![],'attributes':['id',_0xd9e3('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x439211[_0xd9e3('0x10')],_0xd9e3('0x11'))}}});}else{return[];}})[_0xd9e3('0xc')](function(_0x4b842c){if(_0x4b842c&&_0x4b842c[_0xd9e3('0x12')]){_0x58217a=_['map'](_0x4b842c||[],'id');logger[_0xd9e3('0x13')](_0xd9e3('0x14'),_0x58217a[_0xd9e3('0x15')]());return db[_0xd9e3('0xd')]['update']({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0xd9e3('0x16')](_0xd9e3('0x17'))},{'where':{'id':_0x58217a}});}})[_0xd9e3('0xc')](function(){if(_0x58217a&&_0x58217a[_0xd9e3('0x12')]){logger[_0xd9e3('0x13')](_0xd9e3('0x18'),_0x58217a[_0xd9e3('0x15')]());for(var _0x41eb86=0x0;_0x41eb86<_0x58217a['length'];_0x41eb86++){io[_0xd9e3('0x19')](_0xd9e3('0x1a'),{'id':_0x58217a[_0x41eb86],'closed':!![]});}}})[_0xd9e3('0x1b')](function(_0x5082a1){logger[_0xd9e3('0x1c')](_0xd9e3('0x1d'),_0x5082a1?util[_0xd9e3('0x1e')](_0x5082a1,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index e180ab2..314b4a0 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 _0xb92e=['run\x20job','cron','active','isBetween','endAt','add\x20cron','stop\x20cron','startAt','update','update\x20cron','run','start','util','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','service','Smtp','host','port','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','name','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','extname','zip','status','Sent','attachments','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','existsSync','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','email\x20sent','catch','error','error\x20mail','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','exec\x20defaul\x20report\x20id:%s','runReport','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll','jobs','map','toString','keyBy','difference','length','exists','stop','deleteJob','delete\x20cron','toRun','my\x20id'];(function(_0x510360,_0x490625){var _0x2fd7a6=function(_0x57f32f){while(--_0x57f32f){_0x510360['push'](_0x510360['shift']());}};_0x2fd7a6(++_0x490625);}(_0xb92e,0x1ba));var _0xeb92=function(_0x1d56fd,_0x36c2d4){_0x1d56fd=_0x1d56fd-0x0;var _0x1f9f71=_0xb92e[_0x1d56fd];return _0x1f9f71;};'use strict';var fs=require('fs');var util=require(_0xeb92('0x0'));var path=require('path');var _=require('lodash');var moment=require(_0xeb92('0x1'));var CronJobManager=require(_0xeb92('0x2'));var jayson=require(_0xeb92('0x3'));var BPromise=require(_0xeb92('0x4'));var logger=require(_0xeb92('0x5'))(_0xeb92('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xeb92('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xeb92('0x8')][_0xeb92('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2f4c47,_0x1fd9c3){return function(){logger[_0xeb92('0xa')](_0xeb92('0xb'),_0x2f4c47[_0xeb92('0xc')]);var _0x1d3b27=!![];var _0xaf47b1={'tls':{'rejectUnauthorized':![]}};if(_0x2f4c47[_0xeb92('0xd')]['Smtp'][_0xeb92('0xe')]){_0xaf47b1[_0xeb92('0xe')]=_0x2f4c47[_0xeb92('0xd')][_0xeb92('0xf')][_0xeb92('0xe')];}else{_0xaf47b1[_0xeb92('0x10')]=_0x2f4c47[_0xeb92('0xd')][_0xeb92('0xf')][_0xeb92('0x10')];_0xaf47b1[_0xeb92('0x11')]=_0x2f4c47[_0xeb92('0xd')][_0xeb92('0xf')][_0xeb92('0x11')];_0xaf47b1[_0xeb92('0x12')]=_0x2f4c47[_0xeb92('0xd')][_0xeb92('0xf')][_0xeb92('0x12')];}if(_0x2f4c47[_0xeb92('0xd')][_0xeb92('0xf')][_0xeb92('0x13')]){_0xaf47b1[_0xeb92('0x14')]={'user':_0x2f4c47['MailAccount'][_0xeb92('0xf')]['user'],'pass':_0x2f4c47[_0xeb92('0xd')][_0xeb92('0xf')][_0xeb92('0x15')]};}var _0x20ed3c={'account':_0xaf47b1,'message':{'from':util[_0xeb92('0x16')](_0xeb92('0x17'),_0x2f4c47[_0xeb92('0xd')][_0xeb92('0x18')],_0x2f4c47[_0xeb92('0xd')][_0xeb92('0xc')]||_0x2f4c47['MailAccount'][_0xeb92('0xf')]['user']),'to':_0x2f4c47['email'],'cc':_0x2f4c47['cc'],'bcc':_0x2f4c47['bcc'],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x1fd9c3[_0xeb92('0x18')],_0x2f4c47[_0xeb92('0x19')],_0x2f4c47[_0xeb92('0x1a')])}};var _0x71f3a5=path[_0xeb92('0x1b')](__dirname,_0xeb92('0x1c'));var _0x2de421=_0x1fd9c3[_0xeb92('0x1d')];var _0x53950c=util[_0xeb92('0x16')](_0xeb92('0x1e'),path['basename'](_0x1fd9c3['savename'],path[_0xeb92('0x1f')](_0x1fd9c3[_0xeb92('0x1d')])),_0xeb92('0x20'));var _0x9b88de=path[_0xeb92('0x1b')](_0x71f3a5,_0x2de421);var _0x1b27cb=path['join'](_0x71f3a5,_0x53950c);if(fs['existsSync'](_0x9b88de)){_0x1fd9c3[_0xeb92('0x21')]=_0xeb92('0x22');_0x20ed3c['message'][_0xeb92('0x23')]=[{'filename':_0x2de421,'path':_0x9b88de}];_0x20ed3c[_0xeb92('0x24')][_0xeb92('0x25')]=util['format'](_0xeb92('0x26'),JSON[_0xeb92('0x27')](_0x1fd9c3,null,0x2));}else if(fs[_0xeb92('0x28')](_0x1b27cb)){_0x1fd9c3[_0xeb92('0x21')]=_0xeb92('0x22');_0x20ed3c[_0xeb92('0x24')][_0xeb92('0x23')]=[{'filename':_0x53950c,'path':_0x1b27cb}];}else{_0x20ed3c[_0xeb92('0x24')][_0xeb92('0x25')]=_0xeb92('0x29');if(!_0x2f4c47['sendIfEmpty']){_0x1d3b27=![];logger[_0xeb92('0xa')](_0xeb92('0x2a'));}}if(_0x1d3b27){return client[_0xeb92('0x2b')](_0xeb92('0x2c'),_0x20ed3c)[_0xeb92('0x2d')](function(_0x4dbf62){if(_0x4dbf62['error']){return logger['error']('error\x20mail',JSON[_0xeb92('0x27')](_0x4dbf62));}return logger['info'](_0xeb92('0x2e'));})[_0xeb92('0x2f')](function(_0xc62752){return logger[_0xeb92('0x30')](_0xeb92('0x31'),JSON[_0xeb92('0x27')](_0xc62752));});}};}function handleError(){return function(_0x1fe282){return logger[_0xeb92('0x30')](JSON[_0xeb92('0x27')](_0x1fe282));};}function handleResult(_0x2f500d){return function(_0xfe1dbf){logger[_0xeb92('0xa')]('data',JSON[_0xeb92('0x27')](_0xfe1dbf));if(_0x2f500d['MailAccount']&&_0x2f500d[_0xeb92('0xd')][_0xeb92('0xf')]&&!_[_0xeb92('0x32')](_0x2f500d[_0xeb92('0xc')])){setTimeout(handleSendEmail(_0x2f500d,_0xfe1dbf),0x3c*0x3e8);}};}function handleJob(_0x276b86){return function(){try{if(_[_0xeb92('0x32')](_0x276b86[_0xeb92('0x19')])){return logger[_0xeb92('0xa')](_0xeb92('0x33'));}if(_['isNil'](_0x276b86[_0xeb92('0x1a')])){return logger[_0xeb92('0xa')]('subtractUnit\x20null\x20or\x20undefined');}var _0x321c52={'startDate':moment()[_0xeb92('0x34')](_0x276b86['subtractNumber'],_0x276b86['subtractUnit'])[_0xeb92('0x16')](_0xeb92('0x35')),'endDate':moment()[_0xeb92('0x16')](_0xeb92('0x35')),'type':'scheduled','output':_0x276b86[_0xeb92('0x36')],'name':_0x276b86[_0xeb92('0x18')]};if(!_[_0xeb92('0x32')](_0x276b86['DefaultReportId'])){logger['info'](_0xeb92('0x37'),_0x276b86['DefaultReportId']);return analyticDefaultReportController[_0xeb92('0x38')]({'id':_0x276b86[_0xeb92('0x39')]},_0x321c52)[_0xeb92('0x2d')](handleResult(_0x276b86))['catch'](handleError());}if(!_[_0xeb92('0x32')](_0x276b86[_0xeb92('0x3a')])){logger[_0xeb92('0xa')](_0xeb92('0x3b'),_0x276b86['CustomReportId']);return analyticCustomReportController[_0xeb92('0x38')]({'id':_0x276b86[_0xeb92('0x3a')]},_0x321c52)[_0xeb92('0x2d')](handleResult(_0x276b86))['catch'](handleError());}}catch(_0xe2ef22){logger[_0xeb92('0x30')](JSON[_0xeb92('0x27')](_0xe2ef22));}return logger[_0xeb92('0xa')](_0xeb92('0x3c'));};}function getJobs(_0x16b9b5){var _0x52eb95={};if(_0x16b9b5){_0x52eb95['id']=_0x16b9b5;}return db['Schedule'][_0xeb92('0x3d')]({'where':_0x52eb95,'include':[{'model':db[_0xeb92('0xd')],'attributes':['id',_0xeb92('0x18'),_0xeb92('0xc')],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]}]})[_0xeb92('0x2d')](function(_0x55648){var _0x37fc41=_['keys'](manager[_0xeb92('0x3e')]);var _0x58ab06=_[_0xeb92('0x3f')](_0x55648,function(_0x2cc2d0){return _0x2cc2d0['id'][_0xeb92('0x40')]();});var _0x5f4a9a=_[_0xeb92('0x41')](_0x55648,function(_0x2656de){return _0x2656de['id'][_0xeb92('0x40')]();});var _0x19bcd3=_0x16b9b5?_0x58ab06:_[_0xeb92('0x42')](_0x58ab06,_0x37fc41);var _0x4b6856=_['intersection'](_0x58ab06,_0x37fc41);var _0x3ccea2=_[_0xeb92('0x42')](_0x37fc41,_0x58ab06);var _0x336329;var _0x5f5b8b;for(_0x336329=0x0;_0x336329<_0x3ccea2[_0xeb92('0x43')]&&!_0x16b9b5;_0x336329+=0x1){_0x5f5b8b=_0x3ccea2[_0x336329][_0xeb92('0x40')]();if(manager[_0xeb92('0x44')](_0x5f5b8b)){manager[_0xeb92('0x45')](_0x5f5b8b);manager[_0xeb92('0x46')](_0x5f5b8b);logger[_0xeb92('0xa')](_0xeb92('0x47'),_0x5f5b8b);}}logger[_0xeb92('0xa')](_0xeb92('0x48'),JSON[_0xeb92('0x27')](_0x19bcd3));for(_0x336329=0x0;_0x336329<_0x19bcd3['length'];_0x336329+=0x1){_0x5f5b8b=_0x19bcd3[_0x336329]['toString']();logger[_0xeb92('0xa')]('index',_0x5f5b8b);if(_0x16b9b5){logger[_0xeb92('0xa')](_0xeb92('0x49'),_0x16b9b5);logger[_0xeb92('0xa')](JSON[_0xeb92('0x27')](_0x5f4a9a[_0x5f5b8b]));BPromise['resolve']()['then'](handleJob(_0x5f4a9a[_0x5f5b8b]));logger[_0xeb92('0xa')](_0xeb92('0x4a'),_0x5f4a9a[_0x5f5b8b][_0xeb92('0x18')],_0x5f4a9a[_0x5f5b8b][_0xeb92('0x4b')]);}else if(_0x5f4a9a[_0x5f5b8b][_0xeb92('0x4b')]&&_0x5f4a9a[_0x5f5b8b][_0xeb92('0x4c')]&&moment()[_0xeb92('0x4d')](_0x5f4a9a[_0x5f5b8b]['startAt'],_0x5f4a9a[_0x5f5b8b][_0xeb92('0x4e')])){manager['add'](_0x5f5b8b,_0x5f4a9a[_0x5f5b8b][_0xeb92('0x4b')],handleJob(_0x5f4a9a[_0x5f5b8b]));manager['start'](_0x5f5b8b);logger[_0xeb92('0xa')](_0xeb92('0x4f'),_0x5f4a9a[_0x5f5b8b][_0xeb92('0x18')],_0x5f4a9a[_0x5f5b8b][_0xeb92('0x4b')]);}else if(manager[_0xeb92('0x44')](_0x5f5b8b)){manager['stop'](_0x5f5b8b);manager['deleteJob'](_0x5f5b8b);logger[_0xeb92('0xa')](_0xeb92('0x50'),_0x5f4a9a[_0x5f5b8b][_0xeb92('0x18')],_0x5f4a9a[_0x5f5b8b][_0xeb92('0x4b')]);}}for(_0x336329=0x0,_0x5f5b8b;_0x336329<_0x4b6856['length']&&!_0x16b9b5;_0x336329+=0x1){_0x5f5b8b=_0x4b6856[_0x336329][_0xeb92('0x40')]();if(manager[_0xeb92('0x44')](_0x5f5b8b)){if(_0x5f4a9a[_0x5f5b8b][_0xeb92('0x4b')]&&_0x5f4a9a[_0x5f5b8b][_0xeb92('0x4c')]&&moment()[_0xeb92('0x4d')](_0x5f4a9a[_0x5f5b8b][_0xeb92('0x51')],_0x5f4a9a[_0x5f5b8b][_0xeb92('0x4e')])){manager[_0xeb92('0x52')](_0x5f5b8b,_0x5f4a9a[_0x5f5b8b][_0xeb92('0x4b')],handleJob(_0x5f4a9a[_0x5f5b8b]));logger[_0xeb92('0xa')](_0xeb92('0x53'),_0x5f4a9a[_0x5f5b8b]['name'],_0x5f4a9a[_0x5f5b8b][_0xeb92('0x4b')]);}else{manager['stop'](_0x5f5b8b);manager[_0xeb92('0x46')](_0x5f5b8b);logger['info'](_0xeb92('0x50'),_0x5f4a9a[_0x5f5b8b][_0xeb92('0x18')],_0x5f4a9a[_0x5f5b8b]['cron']);}}}})['catch'](function(_0x685cf6){logger[_0xeb92('0x30')](JSON[_0xeb92('0x27')](_0x685cf6));});}exports[_0xeb92('0x54')]=function(_0x2c487e){return getJobs(_0x2c487e);};exports[_0xeb92('0x55')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xedd9=['secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','then','error','error\x20mail','email\x20sent','catch','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','Schedule','MailServerOut','keys','jobs','toString','keyBy','intersection','difference','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','run\x20job','cron','active','startAt','endAt','add','start','length','exists','isBetween','update','stop\x20cron','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','email','MailAccount','service','Smtp','host','port'];(function(_0x2355e4,_0x1038eb){var _0x49da50=function(_0x5bdc85){while(--_0x5bdc85){_0x2355e4['push'](_0x2355e4['shift']());}};_0x49da50(++_0x1038eb);}(_0xedd9,0xfd));var _0x9edd=function(_0x150b1f,_0x137c7a){_0x150b1f=_0x150b1f-0x0;var _0x5e2005=_0xedd9[_0x150b1f];return _0x5e2005;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x9edd('0x0'));var _=require(_0x9edd('0x1'));var moment=require(_0x9edd('0x2'));var CronJobManager=require(_0x9edd('0x3'));var jayson=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var logger=require(_0x9edd('0x6'))('schedule');var db=require(_0x9edd('0x7'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x9edd('0x8'));var client=jayson['client'][_0x9edd('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x50fcc3,_0x18393b){return function(){logger[_0x9edd('0xa')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x50fcc3[_0x9edd('0xb')]);var _0x2df025=!![];var _0x3cfd7b={'tls':{'rejectUnauthorized':![]}};if(_0x50fcc3[_0x9edd('0xc')]['Smtp']['service']){_0x3cfd7b[_0x9edd('0xd')]=_0x50fcc3[_0x9edd('0xc')][_0x9edd('0xe')][_0x9edd('0xd')];}else{_0x3cfd7b[_0x9edd('0xf')]=_0x50fcc3[_0x9edd('0xc')][_0x9edd('0xe')][_0x9edd('0xf')];_0x3cfd7b[_0x9edd('0x10')]=_0x50fcc3[_0x9edd('0xc')]['Smtp'][_0x9edd('0x10')];_0x3cfd7b['secure']=_0x50fcc3[_0x9edd('0xc')]['Smtp'][_0x9edd('0x11')];}if(_0x50fcc3[_0x9edd('0xc')][_0x9edd('0xe')][_0x9edd('0x12')]){_0x3cfd7b[_0x9edd('0x13')]={'user':_0x50fcc3['MailAccount'][_0x9edd('0xe')][_0x9edd('0x14')],'pass':_0x50fcc3['MailAccount'][_0x9edd('0xe')][_0x9edd('0x15')]};}var _0x1c647c={'account':_0x3cfd7b,'message':{'from':util[_0x9edd('0x16')](_0x9edd('0x17'),_0x50fcc3[_0x9edd('0xc')][_0x9edd('0x18')],_0x50fcc3[_0x9edd('0xc')]['email']||_0x50fcc3[_0x9edd('0xc')][_0x9edd('0xe')]['user']),'to':_0x50fcc3[_0x9edd('0xb')],'cc':_0x50fcc3['cc'],'bcc':_0x50fcc3[_0x9edd('0x19')],'subject':util[_0x9edd('0x16')](_0x9edd('0x1a'),_0x18393b['name'],_0x50fcc3['subtractNumber'],_0x50fcc3[_0x9edd('0x1b')])}};var _0x5e5ffc=path[_0x9edd('0x1c')](__dirname,_0x9edd('0x1d'));var _0x25e198=_0x18393b[_0x9edd('0x1e')];var _0x572cb1=util['format'](_0x9edd('0x1f'),path[_0x9edd('0x20')](_0x18393b['savename'],path[_0x9edd('0x21')](_0x18393b[_0x9edd('0x1e')])),_0x9edd('0x22'));var _0x5ba340=path[_0x9edd('0x1c')](_0x5e5ffc,_0x25e198);var _0x30fee3=path[_0x9edd('0x1c')](_0x5e5ffc,_0x572cb1);if(fs[_0x9edd('0x23')](_0x5ba340)){_0x18393b[_0x9edd('0x24')]=_0x9edd('0x25');_0x1c647c[_0x9edd('0x26')][_0x9edd('0x27')]=[{'filename':_0x25e198,'path':_0x5ba340}];_0x1c647c[_0x9edd('0x26')]['text']=util[_0x9edd('0x16')](_0x9edd('0x28'),JSON[_0x9edd('0x29')](_0x18393b,null,0x2));}else if(fs[_0x9edd('0x23')](_0x30fee3)){_0x18393b[_0x9edd('0x24')]=_0x9edd('0x25');_0x1c647c[_0x9edd('0x26')][_0x9edd('0x27')]=[{'filename':_0x572cb1,'path':_0x30fee3}];}else{_0x1c647c[_0x9edd('0x26')][_0x9edd('0x2a')]=_0x9edd('0x2b');if(!_0x50fcc3['sendIfEmpty']){_0x2df025=![];logger[_0x9edd('0xa')](_0x9edd('0x2c'));}}if(_0x2df025){return client[_0x9edd('0x2d')]('SendMail',_0x1c647c)[_0x9edd('0x2e')](function(_0x33c29c){if(_0x33c29c[_0x9edd('0x2f')]){return logger['error'](_0x9edd('0x30'),JSON[_0x9edd('0x29')](_0x33c29c));}return logger[_0x9edd('0xa')](_0x9edd('0x31'));})[_0x9edd('0x32')](function(_0x56d8ad){return logger['error'](_0x9edd('0x30'),JSON['stringify'](_0x56d8ad));});}};}function handleError(){return function(_0x2695fb){return logger[_0x9edd('0x2f')](JSON[_0x9edd('0x29')](_0x2695fb));};}function handleResult(_0x2d55c1){return function(_0x39a8f6){logger[_0x9edd('0xa')]('data',JSON[_0x9edd('0x29')](_0x39a8f6));if(_0x2d55c1[_0x9edd('0xc')]&&_0x2d55c1[_0x9edd('0xc')]['Smtp']&&!_[_0x9edd('0x33')](_0x2d55c1[_0x9edd('0xb')])){setTimeout(handleSendEmail(_0x2d55c1,_0x39a8f6),0x3c*0x3e8);}};}function handleJob(_0x4f9dc){return function(){try{if(_['isNil'](_0x4f9dc[_0x9edd('0x34')])){return logger[_0x9edd('0xa')](_0x9edd('0x35'));}if(_['isNil'](_0x4f9dc[_0x9edd('0x1b')])){return logger[_0x9edd('0xa')](_0x9edd('0x36'));}var _0x227165={'startDate':moment()[_0x9edd('0x37')](_0x4f9dc[_0x9edd('0x34')],_0x4f9dc['subtractUnit'])[_0x9edd('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0x9edd('0x38')),'type':_0x9edd('0x39'),'output':_0x4f9dc[_0x9edd('0x3a')],'name':_0x4f9dc[_0x9edd('0x18')]};if(!_['isNil'](_0x4f9dc['DefaultReportId'])){logger[_0x9edd('0xa')](_0x9edd('0x3b'),_0x4f9dc[_0x9edd('0x3c')]);return analyticDefaultReportController['runReport']({'id':_0x4f9dc[_0x9edd('0x3c')]},_0x227165)['then'](handleResult(_0x4f9dc))[_0x9edd('0x32')](handleError());}if(!_[_0x9edd('0x33')](_0x4f9dc[_0x9edd('0x3d')])){logger['info'](_0x9edd('0x3e'),_0x4f9dc['CustomReportId']);return analyticCustomReportController[_0x9edd('0x3f')]({'id':_0x4f9dc[_0x9edd('0x3d')]},_0x227165)[_0x9edd('0x2e')](handleResult(_0x4f9dc))[_0x9edd('0x32')](handleError());}}catch(_0x194395){logger[_0x9edd('0x2f')](JSON['stringify'](_0x194395));}return logger[_0x9edd('0xa')]('no\x20report\x20id');};}function getJobs(_0x420f4b){var _0x14bfa9={};if(_0x420f4b){_0x14bfa9['id']=_0x420f4b;}return db[_0x9edd('0x40')]['findAll']({'where':_0x14bfa9,'include':[{'model':db[_0x9edd('0xc')],'attributes':['id',_0x9edd('0x18'),'email'],'include':[{'model':db[_0x9edd('0x41')],'as':_0x9edd('0xe')}]}]})[_0x9edd('0x2e')](function(_0x477616){var _0x16284a=_[_0x9edd('0x42')](manager[_0x9edd('0x43')]);var _0x11ffd5=_['map'](_0x477616,function(_0x83fc3f){return _0x83fc3f['id'][_0x9edd('0x44')]();});var _0x4047c5=_[_0x9edd('0x45')](_0x477616,function(_0x2c2800){return _0x2c2800['id'][_0x9edd('0x44')]();});var _0x4fca9b=_0x420f4b?_0x11ffd5:_['difference'](_0x11ffd5,_0x16284a);var _0x2664b4=_[_0x9edd('0x46')](_0x11ffd5,_0x16284a);var _0x29a9b9=_[_0x9edd('0x47')](_0x16284a,_0x11ffd5);var _0x1d2c21;var _0x344097;for(_0x1d2c21=0x0;_0x1d2c21<_0x29a9b9['length']&&!_0x420f4b;_0x1d2c21+=0x1){_0x344097=_0x29a9b9[_0x1d2c21]['toString']();if(manager['exists'](_0x344097)){manager[_0x9edd('0x48')](_0x344097);manager[_0x9edd('0x49')](_0x344097);logger['info'](_0x9edd('0x4a'),_0x344097);}}logger['info'](_0x9edd('0x4b'),JSON['stringify'](_0x4fca9b));for(_0x1d2c21=0x0;_0x1d2c21<_0x4fca9b['length'];_0x1d2c21+=0x1){_0x344097=_0x4fca9b[_0x1d2c21][_0x9edd('0x44')]();logger[_0x9edd('0xa')](_0x9edd('0x4c'),_0x344097);if(_0x420f4b){logger[_0x9edd('0xa')](_0x9edd('0x4d'),_0x420f4b);logger[_0x9edd('0xa')](JSON['stringify'](_0x4047c5[_0x344097]));BPromise['resolve']()['then'](handleJob(_0x4047c5[_0x344097]));logger[_0x9edd('0xa')](_0x9edd('0x4e'),_0x4047c5[_0x344097][_0x9edd('0x18')],_0x4047c5[_0x344097][_0x9edd('0x4f')]);}else if(_0x4047c5[_0x344097]['cron']&&_0x4047c5[_0x344097][_0x9edd('0x50')]&&moment()['isBetween'](_0x4047c5[_0x344097][_0x9edd('0x51')],_0x4047c5[_0x344097][_0x9edd('0x52')])){manager[_0x9edd('0x53')](_0x344097,_0x4047c5[_0x344097][_0x9edd('0x4f')],handleJob(_0x4047c5[_0x344097]));manager[_0x9edd('0x54')](_0x344097);logger[_0x9edd('0xa')]('add\x20cron',_0x4047c5[_0x344097][_0x9edd('0x18')],_0x4047c5[_0x344097][_0x9edd('0x4f')]);}else if(manager['exists'](_0x344097)){manager[_0x9edd('0x48')](_0x344097);manager['deleteJob'](_0x344097);logger[_0x9edd('0xa')]('stop\x20cron',_0x4047c5[_0x344097][_0x9edd('0x18')],_0x4047c5[_0x344097][_0x9edd('0x4f')]);}}for(_0x1d2c21=0x0,_0x344097;_0x1d2c21<_0x2664b4[_0x9edd('0x55')]&&!_0x420f4b;_0x1d2c21+=0x1){_0x344097=_0x2664b4[_0x1d2c21]['toString']();if(manager[_0x9edd('0x56')](_0x344097)){if(_0x4047c5[_0x344097]['cron']&&_0x4047c5[_0x344097][_0x9edd('0x50')]&&moment()[_0x9edd('0x57')](_0x4047c5[_0x344097][_0x9edd('0x51')],_0x4047c5[_0x344097][_0x9edd('0x52')])){manager[_0x9edd('0x58')](_0x344097,_0x4047c5[_0x344097][_0x9edd('0x4f')],handleJob(_0x4047c5[_0x344097]));logger[_0x9edd('0xa')]('update\x20cron',_0x4047c5[_0x344097][_0x9edd('0x18')],_0x4047c5[_0x344097][_0x9edd('0x4f')]);}else{manager[_0x9edd('0x48')](_0x344097);manager['deleteJob'](_0x344097);logger[_0x9edd('0xa')](_0x9edd('0x59'),_0x4047c5[_0x344097]['name'],_0x4047c5[_0x344097][_0x9edd('0x4f')]);}}}})[_0x9edd('0x32')](function(_0x2dfec0){logger['error'](JSON[_0x9edd('0x29')](_0x2dfec0));});}exports['run']=function(_0x4baad0){return getJobs(_0x4baad0);};exports[_0x9edd('0x54')]=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 7ff462f..e18d56d 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 _0xc31e=['inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeRegion','transcribeAccountId','forEach','push','all','error','start','request-promise','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data2','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','sentimentAccountId','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data1','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','bucket','findOne','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis'];(function(_0x3a0052,_0x16b700){var _0xb381a4=function(_0x1aeaba){while(--_0x1aeaba){_0x3a0052['push'](_0x3a0052['shift']());}};_0xb381a4(++_0x16b700);}(_0xc31e,0x180));var _0xec31=function(_0x1dbecb,_0x3d1c9a){_0x1dbecb=_0x1dbecb-0x0;var _0x4bcef5=_0xc31e[_0x1dbecb];return _0x4bcef5;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0xec31('0x0'));var util=require('util');var BPromise=require(_0xec31('0x1'));var db=require(_0xec31('0x2'))['db'];var logger=require(_0xec31('0x3'))(_0xec31('0x4'));function getTranscriptionJob(_0x460080,_0xc8b5d7,_0x5577fa,_0x30c1cf){return new Promise(function(_0x172a5c,_0x2b9dc1){var _0x4367ec=new AWS['TranscribeService']({'accessKeyId':_0xc8b5d7,'secretAccessKey':_0x460080,'region':_0x5577fa});_0x4367ec[_0xec31('0x5')]({'TranscriptionJobName':_0x30c1cf},function(_0x1ce7e4,_0x5bd402){if(_0x1ce7e4){return _0x2b9dc1(_0x1ce7e4);}else{return _0x172a5c(_0x5bd402);}});});}function sentiment(_0x419c93,_0x5d2f6f,_0x30f614,_0x16da3d,_0x650cdf){return new Promise(function(_0x352037,_0x3ec71a){var _0x58810d=new AWS[(_0xec31('0x6'))]({'accessKeyId':_0x5d2f6f,'secretAccessKey':_0x419c93,'region':_0x30f614});_0x58810d[_0xec31('0x7')]({'Text':_0x16da3d,'LanguageCode':_0x650cdf[_0xec31('0x8')](0x0,0x2)},function(_0x41d72b,_0x2c0301){if(_0x41d72b){return _0x3ec71a(_0x41d72b);}else{return _0x352037(_0x2c0301);}});});}function checkTranscribeJob(_0x5ba3c0,_0x888e88,_0x57dced){var _0xd7a982;return new BPromise(function(_0x1a9403,_0xc4735e){logger[_0xec31('0x9')](util[_0xec31('0xa')](_0xec31('0xb'),_0x5ba3c0['id'],_0x5ba3c0['transcribeName']));return getTranscriptionJob(_0x57dced['data1'],_0x57dced[_0xec31('0xc')],_0x888e88['transcribeRegion'],_0x5ba3c0[_0xec31('0xd')])[_0xec31('0xe')](function(_0xc7473d){logger[_0xec31('0x9')](util[_0xec31('0xa')](_0xec31('0xf'),_0x5ba3c0['id'],_0x5ba3c0[_0xec31('0xd')],_0xc7473d[_0xec31('0x10')][_0xec31('0x11')]));if(!_0x5ba3c0[_0xec31('0x12')]){switch(_0xc7473d[_0xec31('0x10')]['TranscriptionJobStatus']){case _0xec31('0x13'):var _0x5c3023={'transcribeStatus':_0xc7473d[_0xec31('0x10')]['TranscriptionJobStatus'],'fileUri':_0xc7473d[_0xec31('0x10')][_0xec31('0x14')]['TranscriptFileUri']};logger['info'](util[_0xec31('0xa')](_0xec31('0x15'),_0x5ba3c0['id']));return rp({'uri':_0xc7473d[_0xec31('0x10')][_0xec31('0x14')][_0xec31('0x16')],'json':!![]})[_0xec31('0xe')](function(_0x4b35a9){logger[_0xec31('0x9')](util[_0xec31('0xa')](_0xec31('0x17'),_0x5ba3c0['id']));if(_0x4b35a9&&_0x4b35a9[_0xec31('0x18')]&&_0x4b35a9['results'][_0xec31('0x19')]&&_0x4b35a9[_0xec31('0x18')][_0xec31('0x19')][_0xec31('0x1a')]){_0x5c3023['fileText']='';for(var _0x877426=0x0;_0x877426<_0x4b35a9['results']['transcripts']['length'];_0x877426++){_0x5c3023[_0xec31('0x12')]+=_0x4b35a9[_0xec31('0x18')][_0xec31('0x19')][_0x877426][_0xec31('0x1b')]+'';}}return _0x5ba3c0['update'](_0x5c3023);})[_0xec31('0xe')](function(){logger['info'](util['format'](_0xec31('0x1c'),_0x5ba3c0['id']));if(!_0x5ba3c0[_0xec31('0x1d')]){throw new db[(_0xec31('0x1e'))][(_0xec31('0x1f'))](_0xec31('0x20'));}if(!_0x888e88[_0xec31('0x21')]||!_0x888e88['sentimentAccountId']||!_0x888e88[_0xec31('0x22')]||!_0x888e88['language']||!_0x888e88['bucket']){throw new db[(_0xec31('0x1e'))]['ValidationError'](_0xec31('0x23'));}if(!_0x5c3023[_0xec31('0x12')]){throw new Error('Transcript\x20not\x20available');}if(_0x888e88[_0xec31('0x24')]===_0x57dced['id']){return _0x57dced;}else{return db[_0xec31('0x25')]['findOne']({'where':{'id':_settings[_0xec31('0x24')]}});}})[_0xec31('0xe')](function(_0x4bffce){if(!_0x4bffce){throw new db[(_0xec31('0x1e'))][(_0xec31('0x1f'))](_0xec31('0x26'));}if(!_0x4bffce['data1']||!_0x4bffce[_0xec31('0xc')]){throw new db[(_0xec31('0x1e'))]['ValidationError'](_0xec31('0x27'));}_0xd7a982=_0x4bffce;logger[_0xec31('0x9')](util[_0xec31('0xa')](_0xec31('0x28'),_0x5ba3c0['id']));return sentiment(_0xd7a982[_0xec31('0x29')],_0xd7a982['data2'],_0x888e88[_0xec31('0x22')],_0x5c3023[_0xec31('0x12')],_0x888e88[_0xec31('0x2a')]);})[_0xec31('0xe')](function(_0x4551ba){logger[_0xec31('0x9')](util[_0xec31('0xa')](_0xec31('0x2b'),_0x5ba3c0['id']));return _0x5ba3c0[_0xec31('0x2c')]({'sentiment':_0x4551ba['Sentiment'],'sPositive':_0x4551ba[_0xec31('0x2d')][_0xec31('0x2e')],'sNegative':_0x4551ba[_0xec31('0x2d')][_0xec31('0x2f')],'sMixed':_0x4551ba['SentimentScore'][_0xec31('0x30')],'sNeutral':_0x4551ba[_0xec31('0x2d')][_0xec31('0x31')]});})[_0xec31('0xe')](function(){logger[_0xec31('0x9')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5ba3c0['id']));_0x1a9403();});case _0xec31('0x32'):return _0x5ba3c0['update']({'transcribeStatus':_0xec31('0x32'),'failureReason':_0xc7473d[_0xec31('0x10')][_0xec31('0x33')]})[_0xec31('0xe')](function(){logger[_0xec31('0x9')](util[_0xec31('0xa')](_0xec31('0x1c'),_0x5ba3c0['id']));_0x1a9403();});default:logger[_0xec31('0x9')](util['format'](_0xec31('0x34'),_0x5ba3c0['id']));break;}}else{return BPromise[_0xec31('0x35')]()['then'](function(){if(!_0x5ba3c0[_0xec31('0x1d')]){throw new db[(_0xec31('0x1e'))][(_0xec31('0x1f'))](_0xec31('0x20'));}if(!_0x888e88[_0xec31('0x21')]||!_0x888e88[_0xec31('0x24')]||!_0x888e88['sentimentRegion']||!_0x888e88[_0xec31('0x2a')]||!_0x888e88[_0xec31('0x36')]){throw new db[(_0xec31('0x1e'))][(_0xec31('0x1f'))](_0xec31('0x23'));}if(!_0x5ba3c0[_0xec31('0x12')]){throw new Error('Transcript\x20not\x20available');}if(_0x888e88[_0xec31('0x24')]===_0x57dced['id']){return _0x57dced;}else{return db[_0xec31('0x25')][_0xec31('0x37')]({'where':{'id':_settings[_0xec31('0x24')]}});}})[_0xec31('0xe')](function(_0x264ed1){if(!_0x264ed1){throw new db['Sequelize']['ValidationError'](_0xec31('0x26'));}if(!_0x264ed1['data1']||!_0x264ed1['data2']){throw new db[(_0xec31('0x1e'))][(_0xec31('0x1f'))](_0xec31('0x27'));}_0xd7a982=_0x264ed1;logger['info'](util[_0xec31('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5ba3c0['id']));return sentiment(_0xd7a982['data1'],_0xd7a982[_0xec31('0xc')],_0x888e88[_0xec31('0x22')],_0x5ba3c0[_0xec31('0x12')],_0x888e88[_0xec31('0x2a')]);})[_0xec31('0xe')](function(_0x2ad10d){logger[_0xec31('0x9')](util[_0xec31('0xa')](_0xec31('0x2b'),_0x5ba3c0['id']));return _0x5ba3c0['update']({'sentiment':_0x2ad10d['Sentiment'],'sPositive':_0x2ad10d[_0xec31('0x2d')]['Positive'],'sNegative':_0x2ad10d[_0xec31('0x2d')]['Negative'],'sMixed':_0x2ad10d[_0xec31('0x2d')][_0xec31('0x30')],'sNeutral':_0x2ad10d[_0xec31('0x2d')]['Neutral'],'transcribeStatus':_0xec31('0x13')});})[_0xec31('0xe')](function(){logger[_0xec31('0x9')](util[_0xec31('0xa')](_0xec31('0x1c'),_0x5ba3c0['id']));_0x1a9403();});}})[_0xec31('0x38')](function(_0x3b0cd7){if(_0x3b0cd7){if(!_0x3b0cd7[_0xec31('0x39')]||_0x3b0cd7[_0xec31('0x39')]!==_0xec31('0x3a')){logger['error'](util[_0xec31('0xa')](_0xec31('0x3b'),_0x5ba3c0['id']),util[_0xec31('0x3c')](_0x3b0cd7,{'showHidden':![],'depth':null}));}}_0x1a9403();});});}function checkTranscribe(){var _0x6a7dca;var _0xfbba96;var _0x1e9a81;return db[_0xec31('0x3d')][_0xec31('0x3e')]({'where':{'transcribeStatus':_0xec31('0x3f')}})[_0xec31('0xe')](function(_0x234270){if(!_0x234270||!_0x234270['length']){throw new db['Sequelize'][(_0xec31('0x1f'))](_0xec31('0x40'));}_0x6a7dca=_0x234270;return db[_0xec31('0x41')][_0xec31('0x37')]({'where':{'id':0x1}});})[_0xec31('0xe')](function(_0x4d61ba){if(!_0x4d61ba){throw new db[(_0xec31('0x1e'))]['ValidationError'](_0xec31('0x42'));}_0xfbba96=_0x4d61ba;if(!_0xfbba96['transcribe']||!_0xfbba96['transcribeAccountId']||!_0xfbba96[_0xec31('0x43')]||!_0xfbba96['language']||!_0xfbba96[_0xec31('0x36')]){throw new db[(_0xec31('0x1e'))][(_0xec31('0x1f'))]('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0xec31('0x37')]({'where':{'id':_0xfbba96[_0xec31('0x44')]}});})[_0xec31('0xe')](function(_0x125ff0){if(!_0x125ff0){throw new db[(_0xec31('0x1e'))]['ValidationError'](_0xec31('0x26'));}if(!_0x125ff0[_0xec31('0x29')]||!_0x125ff0[_0xec31('0xc')]){throw new db[(_0xec31('0x1e'))]['ValidationError'](_0xec31('0x27'));}_0x1e9a81=_0x125ff0;var _0x3f9fc5=[];_0x6a7dca[_0xec31('0x45')](function(_0x3d95ef){_0x3f9fc5[_0xec31('0x46')](checkTranscribeJob(_0x3d95ef,_0xfbba96,_0x1e9a81));});return BPromise[_0xec31('0x47')](_0x3f9fc5);})[_0xec31('0x38')](function(_0x535d46){if(_0x535d46){if(!_0x535d46['name']||_0x535d46[_0xec31('0x39')]!==_0xec31('0x3a')){logger[_0xec31('0x48')](util[_0xec31('0x3c')](_0x535d46,{'showHidden':![],'depth':null}));}}});}exports[_0xec31('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x2aae=['bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data2','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeRegion','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','catch','error','start','aws-sdk','request-promise','bluebird','../../config/logger','transcribe','Comprehend','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion'];(function(_0x5c2189,_0x3fd6d2){var _0x110f67=function(_0x2a6d01){while(--_0x2a6d01){_0x5c2189['push'](_0x5c2189['shift']());}};_0x110f67(++_0x3fd6d2);}(_0x2aae,0x18f));var _0xe2aa=function(_0xc92382,_0x419bd9){_0xc92382=_0xc92382-0x0;var _0x277e57=_0x2aae[_0xc92382];return _0x277e57;};var _=require('lodash');var AWS=require(_0xe2aa('0x0'));var rp=require(_0xe2aa('0x1'));var util=require('util');var BPromise=require(_0xe2aa('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xe2aa('0x3'))(_0xe2aa('0x4'));function getTranscriptionJob(_0x7aa48e,_0x34c2a1,_0x160235,_0x2a7632){return new Promise(function(_0x3fb17b,_0x909dff){var _0x54f6c4=new AWS['TranscribeService']({'accessKeyId':_0x34c2a1,'secretAccessKey':_0x7aa48e,'region':_0x160235});_0x54f6c4['getTranscriptionJob']({'TranscriptionJobName':_0x2a7632},function(_0xdcf49e,_0x3a96a0){if(_0xdcf49e){return _0x909dff(_0xdcf49e);}else{return _0x3fb17b(_0x3a96a0);}});});}function sentiment(_0x41338a,_0xf4eba5,_0x2af6cb,_0x897f28,_0x4adb8f){return new Promise(function(_0x1e1802,_0x50e06f){var _0x23f40b=new AWS[(_0xe2aa('0x5'))]({'accessKeyId':_0xf4eba5,'secretAccessKey':_0x41338a,'region':_0x2af6cb});_0x23f40b['detectSentiment']({'Text':_0x897f28,'LanguageCode':_0x4adb8f[_0xe2aa('0x6')](0x0,0x2)},function(_0x513b7b,_0x535b29){if(_0x513b7b){return _0x50e06f(_0x513b7b);}else{return _0x1e1802(_0x535b29);}});});}function checkTranscribeJob(_0xe3b6b,_0x583d91,_0x2c5074){var _0x55c0c7;return new BPromise(function(_0x4153bb,_0x49164d){logger['info'](util[_0xe2aa('0x7')](_0xe2aa('0x8'),_0xe3b6b['id'],_0xe3b6b[_0xe2aa('0x9')]));return getTranscriptionJob(_0x2c5074[_0xe2aa('0xa')],_0x2c5074['data2'],_0x583d91['transcribeRegion'],_0xe3b6b['transcribeName'])[_0xe2aa('0xb')](function(_0x7b389a){logger[_0xe2aa('0xc')](util[_0xe2aa('0x7')](_0xe2aa('0xd'),_0xe3b6b['id'],_0xe3b6b[_0xe2aa('0x9')],_0x7b389a[_0xe2aa('0xe')]['TranscriptionJobStatus']));if(!_0xe3b6b[_0xe2aa('0xf')]){switch(_0x7b389a['TranscriptionJob'][_0xe2aa('0x10')]){case _0xe2aa('0x11'):var _0x1df074={'transcribeStatus':_0x7b389a[_0xe2aa('0xe')][_0xe2aa('0x10')],'fileUri':_0x7b389a['TranscriptionJob'][_0xe2aa('0x12')][_0xe2aa('0x13')]};logger[_0xe2aa('0xc')](util['format'](_0xe2aa('0x14'),_0xe3b6b['id']));return rp({'uri':_0x7b389a[_0xe2aa('0xe')][_0xe2aa('0x12')][_0xe2aa('0x13')],'json':!![]})[_0xe2aa('0xb')](function(_0x435a3d){logger[_0xe2aa('0xc')](util[_0xe2aa('0x7')](_0xe2aa('0x15'),_0xe3b6b['id']));if(_0x435a3d&&_0x435a3d[_0xe2aa('0x16')]&&_0x435a3d[_0xe2aa('0x16')][_0xe2aa('0x17')]&&_0x435a3d[_0xe2aa('0x16')]['transcripts']['length']){_0x1df074[_0xe2aa('0xf')]='';for(var _0x1cea5b=0x0;_0x1cea5b<_0x435a3d[_0xe2aa('0x16')]['transcripts'][_0xe2aa('0x18')];_0x1cea5b++){_0x1df074[_0xe2aa('0xf')]+=_0x435a3d[_0xe2aa('0x16')]['transcripts'][_0x1cea5b]['transcript']+'';}}return _0xe3b6b[_0xe2aa('0x19')](_0x1df074);})[_0xe2aa('0xb')](function(){logger[_0xe2aa('0xc')](util[_0xe2aa('0x7')](_0xe2aa('0x1a'),_0xe3b6b['id']));if(!_0xe3b6b[_0xe2aa('0x1b')]){throw new db[(_0xe2aa('0x1c'))]['ValidationError'](_0xe2aa('0x1d'));}if(!_0x583d91[_0xe2aa('0x1e')]||!_0x583d91[_0xe2aa('0x1f')]||!_0x583d91[_0xe2aa('0x20')]||!_0x583d91['language']||!_0x583d91[_0xe2aa('0x21')]){throw new db[(_0xe2aa('0x1c'))][(_0xe2aa('0x22'))](_0xe2aa('0x23'));}if(!_0x1df074[_0xe2aa('0xf')]){throw new Error(_0xe2aa('0x24'));}if(_0x583d91[_0xe2aa('0x1f')]===_0x2c5074['id']){return _0x2c5074;}else{return db[_0xe2aa('0x25')][_0xe2aa('0x26')]({'where':{'id':_settings[_0xe2aa('0x1f')]}});}})[_0xe2aa('0xb')](function(_0x2ffa2e){if(!_0x2ffa2e){throw new db[(_0xe2aa('0x1c'))][(_0xe2aa('0x22'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2ffa2e[_0xe2aa('0xa')]||!_0x2ffa2e['data2']){throw new db[(_0xe2aa('0x1c'))][(_0xe2aa('0x22'))]('Cloud\x20Provider\x20not\x20configured');}_0x55c0c7=_0x2ffa2e;logger[_0xe2aa('0xc')](util[_0xe2aa('0x7')](_0xe2aa('0x27'),_0xe3b6b['id']));return sentiment(_0x55c0c7[_0xe2aa('0xa')],_0x55c0c7[_0xe2aa('0x28')],_0x583d91[_0xe2aa('0x20')],_0x1df074[_0xe2aa('0xf')],_0x583d91[_0xe2aa('0x29')]);})['then'](function(_0x59fb13){logger['info'](util[_0xe2aa('0x7')](_0xe2aa('0x2a'),_0xe3b6b['id']));return _0xe3b6b[_0xe2aa('0x19')]({'sentiment':_0x59fb13[_0xe2aa('0x2b')],'sPositive':_0x59fb13['SentimentScore'][_0xe2aa('0x2c')],'sNegative':_0x59fb13[_0xe2aa('0x2d')]['Negative'],'sMixed':_0x59fb13[_0xe2aa('0x2d')][_0xe2aa('0x2e')],'sNeutral':_0x59fb13[_0xe2aa('0x2d')][_0xe2aa('0x2f')]});})[_0xe2aa('0xb')](function(){logger[_0xe2aa('0xc')](util[_0xe2aa('0x7')](_0xe2aa('0x1a'),_0xe3b6b['id']));_0x4153bb();});case _0xe2aa('0x30'):return _0xe3b6b[_0xe2aa('0x19')]({'transcribeStatus':'FAILED','failureReason':_0x7b389a['TranscriptionJob'][_0xe2aa('0x31')]})[_0xe2aa('0xb')](function(){logger['info'](util[_0xe2aa('0x7')](_0xe2aa('0x1a'),_0xe3b6b['id']));_0x4153bb();});default:logger[_0xe2aa('0xc')](util[_0xe2aa('0x7')](_0xe2aa('0x32'),_0xe3b6b['id']));break;}}else{return BPromise[_0xe2aa('0x33')]()[_0xe2aa('0xb')](function(){if(!_0xe3b6b['tempSentiment']){throw new db['Sequelize'][(_0xe2aa('0x22'))](_0xe2aa('0x1d'));}if(!_0x583d91['sentiment']||!_0x583d91[_0xe2aa('0x1f')]||!_0x583d91[_0xe2aa('0x20')]||!_0x583d91['language']||!_0x583d91[_0xe2aa('0x21')]){throw new db[(_0xe2aa('0x1c'))][(_0xe2aa('0x22'))](_0xe2aa('0x23'));}if(!_0xe3b6b['fileText']){throw new Error(_0xe2aa('0x24'));}if(_0x583d91[_0xe2aa('0x1f')]===_0x2c5074['id']){return _0x2c5074;}else{return db[_0xe2aa('0x25')][_0xe2aa('0x26')]({'where':{'id':_settings[_0xe2aa('0x1f')]}});}})[_0xe2aa('0xb')](function(_0x13d8f1){if(!_0x13d8f1){throw new db[(_0xe2aa('0x1c'))]['ValidationError'](_0xe2aa('0x34'));}if(!_0x13d8f1[_0xe2aa('0xa')]||!_0x13d8f1[_0xe2aa('0x28')]){throw new db[(_0xe2aa('0x1c'))]['ValidationError'](_0xe2aa('0x35'));}_0x55c0c7=_0x13d8f1;logger['info'](util[_0xe2aa('0x7')](_0xe2aa('0x27'),_0xe3b6b['id']));return sentiment(_0x55c0c7['data1'],_0x55c0c7[_0xe2aa('0x28')],_0x583d91[_0xe2aa('0x20')],_0xe3b6b[_0xe2aa('0xf')],_0x583d91[_0xe2aa('0x29')]);})[_0xe2aa('0xb')](function(_0x10028e){logger['info'](util['format'](_0xe2aa('0x2a'),_0xe3b6b['id']));return _0xe3b6b[_0xe2aa('0x19')]({'sentiment':_0x10028e['Sentiment'],'sPositive':_0x10028e[_0xe2aa('0x2d')][_0xe2aa('0x2c')],'sNegative':_0x10028e[_0xe2aa('0x2d')]['Negative'],'sMixed':_0x10028e['SentimentScore'][_0xe2aa('0x2e')],'sNeutral':_0x10028e[_0xe2aa('0x2d')][_0xe2aa('0x2f')],'transcribeStatus':'COMPLETED'});})['then'](function(){logger['info'](util[_0xe2aa('0x7')](_0xe2aa('0x1a'),_0xe3b6b['id']));_0x4153bb();});}})['catch'](function(_0x4d1d96){if(_0x4d1d96){if(!_0x4d1d96[_0xe2aa('0x36')]||_0x4d1d96[_0xe2aa('0x36')]!==_0xe2aa('0x37')){logger['error'](util[_0xe2aa('0x7')](_0xe2aa('0x38'),_0xe3b6b['id']),util[_0xe2aa('0x39')](_0x4d1d96,{'showHidden':![],'depth':null}));}}_0x4153bb();});});}function checkTranscribe(){var _0x476557;var _0x5f0f67;var _0x2e4836;return db[_0xe2aa('0x3a')][_0xe2aa('0x3b')]({'where':{'transcribeStatus':_0xe2aa('0x3c')}})['then'](function(_0xa8a9ba){if(!_0xa8a9ba||!_0xa8a9ba['length']){throw new db[(_0xe2aa('0x1c'))][(_0xe2aa('0x22'))]('No\x20transcribe\x20job\x20to\x20check');}_0x476557=_0xa8a9ba;return db[_0xe2aa('0x3d')]['findOne']({'where':{'id':0x1}});})[_0xe2aa('0xb')](function(_0x37a84c){if(!_0x37a84c){throw new db[(_0xe2aa('0x1c'))]['ValidationError'](_0xe2aa('0x3e'));}_0x5f0f67=_0x37a84c;if(!_0x5f0f67[_0xe2aa('0x4')]||!_0x5f0f67['transcribeAccountId']||!_0x5f0f67[_0xe2aa('0x3f')]||!_0x5f0f67[_0xe2aa('0x29')]||!_0x5f0f67[_0xe2aa('0x21')]){throw new db[(_0xe2aa('0x1c'))][(_0xe2aa('0x22'))](_0xe2aa('0x40'));}return db[_0xe2aa('0x25')][_0xe2aa('0x26')]({'where':{'id':_0x5f0f67[_0xe2aa('0x41')]}});})[_0xe2aa('0xb')](function(_0x5cf955){if(!_0x5cf955){throw new db['Sequelize']['ValidationError'](_0xe2aa('0x34'));}if(!_0x5cf955[_0xe2aa('0xa')]||!_0x5cf955[_0xe2aa('0x28')]){throw new db[(_0xe2aa('0x1c'))][(_0xe2aa('0x22'))]('Cloud\x20Provider\x20not\x20configured');}_0x2e4836=_0x5cf955;var _0x198732=[];_0x476557[_0xe2aa('0x42')](function(_0x46f97b){_0x198732[_0xe2aa('0x43')](checkTranscribeJob(_0x46f97b,_0x5f0f67,_0x2e4836));});return BPromise[_0xe2aa('0x44')](_0x198732);})[_0xe2aa('0x45')](function(_0x160142){if(_0x160142){if(!_0x160142['name']||_0x160142['name']!==_0xe2aa('0x37')){logger[_0xe2aa('0x46')](util['inspect'](_0x160142,{'showHidden':![],'depth':null}));}}});}exports[_0xe2aa('0x47')]=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 88f5d5c..e01d335 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 _0x1825=['timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','moment','util','../../config/environment','../../mysqldb','schedule','defaults','localhost','socket.io-emitter','redis','WhatsappInteraction','lastMsgAt','hours','then','length','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system'];(function(_0x7a0a4e,_0x5880d2){var _0x13507a=function(_0x1e4713){while(--_0x1e4713){_0x7a0a4e['push'](_0x7a0a4e['shift']());}};_0x13507a(++_0x5880d2);}(_0x1825,0x7e));var _0x5182=function(_0x10463a,_0x1734d9){_0x10463a=_0x10463a-0x0;var _0x45bf8d=_0x1825[_0x10463a];return _0x45bf8d;};'use strict';var _=require(_0x5182('0x0'));var moment=require(_0x5182('0x1'));var Redis=require('ioredis');var util=require(_0x5182('0x2'));var config=require(_0x5182('0x3'));var db=require(_0x5182('0x4'))['db'];var logger=require('../logger')(_0x5182('0x5'));config['redis']=_[_0x5182('0x6')](config['redis'],{'host':_0x5182('0x7'),'port':0x18eb});var io=require(_0x5182('0x8'))(new Redis(config[_0x5182('0x9')]));function closeInteractions(){var _0x594ece=[];return db[_0x5182('0xa')]['findAll']({'raw':!![],'attributes':['id',_0x5182('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0x5182('0xc'))}}})[_0x5182('0xd')](function(_0x388380){if(_0x388380&&_0x388380[_0x5182('0xe')]){_0x594ece=_['map'](_0x388380||[],'id');logger['info'](_0x5182('0xf'),_0x594ece[_0x5182('0x10')]());return db[_0x5182('0xa')][_0x5182('0x11')]({'closeReason':_0x5182('0x12'),'disposition':_0x5182('0x13'),'closed':!![],'closedAt':moment()[_0x5182('0x14')](_0x5182('0x15'))},{'where':{'id':_0x594ece}});}})[_0x5182('0xd')](function(){if(_0x594ece&&_0x594ece[_0x5182('0xe')]){logger[_0x5182('0x16')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x594ece[_0x5182('0x10')]());for(var _0x3bac73=0x0;_0x3bac73<_0x594ece[_0x5182('0xe')];_0x3bac73++){io[_0x5182('0x17')](_0x5182('0x18'),{'id':_0x594ece[_0x3bac73],'closed':!![]});}}})[_0x5182('0x19')](function(_0x351785){logger[_0x5182('0x1a')](_0x5182('0x1b'),_0x351785?util['inspect'](_0x351785,{'showHidden':![],'depth':null}):'');});}exports[_0x5182('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x5fb6=['timeout','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','../../config/environment','../../mysqldb','../logger','redis','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update'];(function(_0x1c646b,_0x136136){var _0x4f2652=function(_0x2793f2){while(--_0x2793f2){_0x1c646b['push'](_0x1c646b['shift']());}};_0x4f2652(++_0x136136);}(_0x5fb6,0xb8));var _0x65fb=function(_0x855caa,_0x5624fa){_0x855caa=_0x855caa-0x0;var _0x25488a=_0x5fb6[_0x855caa];return _0x25488a;};'use strict';var _=require(_0x65fb('0x0'));var moment=require('moment');var Redis=require(_0x65fb('0x1'));var util=require('util');var config=require(_0x65fb('0x2'));var db=require(_0x65fb('0x3'))['db'];var logger=require(_0x65fb('0x4'))('schedule');config[_0x65fb('0x5')]=_['defaults'](config[_0x65fb('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x65fb('0x5')]));function closeInteractions(){var _0x43092e=[];return db[_0x65fb('0x6')][_0x65fb('0x7')]({'raw':!![],'attributes':['id',_0x65fb('0x8')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x65fb('0x9')](0x18,_0x65fb('0xa'))}}})['then'](function(_0x3c5e40){if(_0x3c5e40&&_0x3c5e40[_0x65fb('0xb')]){_0x43092e=_['map'](_0x3c5e40||[],'id');logger[_0x65fb('0xc')](_0x65fb('0xd'),_0x43092e[_0x65fb('0xe')]());return db[_0x65fb('0x6')][_0x65fb('0xf')]({'closeReason':'system','disposition':_0x65fb('0x10'),'closed':!![],'closedAt':moment()['format'](_0x65fb('0x11'))},{'where':{'id':_0x43092e}});}})['then'](function(){if(_0x43092e&&_0x43092e[_0x65fb('0xb')]){logger[_0x65fb('0xc')](_0x65fb('0x12'),_0x43092e[_0x65fb('0xe')]());for(var _0x22bc63=0x0;_0x22bc63<_0x43092e['length'];_0x22bc63++){io['emit'](_0x65fb('0x13'),{'id':_0x43092e[_0x22bc63],'closed':!![]});}}})[_0x65fb('0x14')](function(_0x43c2f4){logger[_0x65fb('0x15')](_0x65fb('0x16'),_0x43c2f4?util[_0x65fb('0x17')](_0x43c2f4,{'showHidden':![],'depth':null}):'');});}exports[_0x65fb('0x18')]=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 947c822..920d858 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7463=['contacts2','catch','util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push','now','CmContact','destroy','then','bulkCreate','finished\x20populating','contacts1','CmHopper','log'];(function(_0x3476c6,_0x249238){var _0x8aa8b3=function(_0x504f2a){while(--_0x504f2a){_0x3476c6['push'](_0x3476c6['shift']());}};_0x8aa8b3(++_0x249238);}(_0x7463,0x92));var _0x3746=function(_0x4191af,_0x5783da){_0x4191af=_0x4191af-0x0;var _0x27bebf=_0x7463[_0x4191af];return _0x27bebf;};'use strict';var util=require(_0x3746('0x0'));var db=require(_0x3746('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x3746('0x2')+i,'lastName':_0x3746('0x3')+i,'phone':0xf879fb460+i,'email':_0x3746('0x4')+i+_0x3746('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x3746('0x6')]({'id':i,'active':![],'scheduledat':Date[_0x3746('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3746('0x7')](),'updatedAt':Date[_0x3746('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x3746('0x6')]({'id':i,'firstName':_0x3746('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x3746('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x3746('0x6')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3746('0x7')](),'updatedAt':Date[_0x3746('0x7')]()});}db[_0x3746('0x8')][_0x3746('0x9')]({'where':{}})[_0x3746('0xa')](function(){return db[_0x3746('0x8')][_0x3746('0xb')](contacts);})[_0x3746('0xa')](function(){console['log'](_0x3746('0xc'),_0x3746('0xd'));return db[_0x3746('0xe')][_0x3746('0x9')]({'where':{}});})['then'](function(){return db[_0x3746('0xe')][_0x3746('0xb')](hopper);})[_0x3746('0xa')](function(){console['log']('finished\x20populating','hopper1');return db[_0x3746('0x8')]['bulkCreate'](contacts2);})['then'](function(){console[_0x3746('0xf')]('finished\x20populating',_0x3746('0x10'));return db[_0x3746('0xe')][_0x3746('0xb')](hopper2);})[_0x3746('0xa')](function(){console['log'](_0x3746('0xc'),'hopper2');})[_0x3746('0x11')](function(_0xe3c4b6){console['log'](_0xe3c4b6);}); \ No newline at end of file +var _0x0b05=['finished\x20populating','contacts1','destroy','then','CmHopper','bulkCreate','contacts2','hopper2','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','log'];(function(_0x5269eb,_0x30c273){var _0x1598b3=function(_0xd46134){while(--_0xd46134){_0x5269eb['push'](_0x5269eb['shift']());}};_0x1598b3(++_0x30c273);}(_0x0b05,0x194));var _0x50b0=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x0b05[_0x5416db];return _0x243e35;};'use strict';var util=require(_0x50b0('0x0'));var db=require(_0x50b0('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x50b0('0x2')]({'id':i,'firstName':_0x50b0('0x3')+i,'lastName':_0x50b0('0x4')+i,'phone':0xf879fb460+i,'email':_0x50b0('0x5')+i+_0x50b0('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x50b0('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x50b0('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x50b0('0x7')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x50b0('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x50b0('0x4')+i,'phone':0xf879fb460+i,'email':_0x50b0('0x5')+i+_0x50b0('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x50b0('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x50b0('0x7')](),'updatedAt':Date['now']()});}db[_0x50b0('0x8')]['destroy']({'where':{}})['then'](function(){return db[_0x50b0('0x8')]['bulkCreate'](contacts);})['then'](function(){console[_0x50b0('0x9')](_0x50b0('0xa'),_0x50b0('0xb'));return db['CmHopper'][_0x50b0('0xc')]({'where':{}});})[_0x50b0('0xd')](function(){return db[_0x50b0('0xe')][_0x50b0('0xf')](hopper);})[_0x50b0('0xd')](function(){console[_0x50b0('0x9')](_0x50b0('0xa'),'hopper1');return db['CmContact'][_0x50b0('0xf')](contacts2);})[_0x50b0('0xd')](function(){console['log'](_0x50b0('0xa'),_0x50b0('0x10'));return db[_0x50b0('0xe')]['bulkCreate'](hopper2);})[_0x50b0('0xd')](function(){console[_0x50b0('0x9')]('finished\x20populating',_0x50b0('0x11'));})['catch'](function(_0xaadfc8){console[_0x50b0('0x9')](_0xaadfc8);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 3011961..4504fce 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf211=['ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss'];(function(_0x2df6bc,_0x40d11c){var _0x1a7616=function(_0xe9e7a9){while(--_0xe9e7a9){_0x2df6bc['push'](_0x2df6bc['shift']());}};_0x1a7616(++_0x40d11c);}(_0xf211,0x1af));var _0x1f21=function(_0xbd3556,_0xe38bfa){_0xbd3556=_0xbd3556-0x0;var _0x4a2e2d=_0xf211[_0xbd3556];return _0x4a2e2d;};'use strict';var util=require(_0x1f21('0x0'));var db=require(_0x1f21('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x1f21('0x2')](_0x1f21('0x3'),'agent',i),'fullname':util['format'](_0x1f21('0x3'),_0x1f21('0x4'),i),'email':util[_0x1f21('0x2')](_0x1f21('0x5'),_0x1f21('0x4'),i),'role':_0x1f21('0x4'),'password':_0x1f21('0x6'),'internal':0xfa0+i,'type':_0x1f21('0x7'),'transport':[_0x1f21('0x8'),'ws',_0x1f21('0x9')],'disallow':['all'],'allow':[_0x1f21('0xa')],'defaultuser':util[_0x1f21('0x2')](_0x1f21('0x3'),'agent',i),'encryption':_0x1f21('0xb'),'avpf':_0x1f21('0xb'),'force_avp':_0x1f21('0xb'),'icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x1f21('0xc'),'dtlsprivatekey':_0x1f21('0xd'),'dtlssetup':_0x1f21('0xe'),'callerid':util[_0x1f21('0x2')](_0x1f21('0xf'),util[_0x1f21('0x2')]('%s%s',_0x1f21('0x4'),i),0xfa0+i)});}db['User'][_0x1f21('0x10')](users)[_0x1f21('0x11')](function(){console[_0x1f21('0x12')](_0x1f21('0x13'));})[_0x1f21('0x14')](function(_0x179e2c){console['log'](_0x179e2c);}); \ No newline at end of file +var _0xe346=['agent','format','%s%s@xcally.com','password','friend','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','util','../mysqldb','push','%s%s'];(function(_0xfaf455,_0x13c0a9){var _0x5aaa60=function(_0x55ce23){while(--_0x55ce23){_0xfaf455['push'](_0xfaf455['shift']());}};_0x5aaa60(++_0x13c0a9);}(_0xe346,0x1e2));var _0x6e34=function(_0x351dbe,_0x3e2a91){_0x351dbe=_0x351dbe-0x0;var _0x4b5863=_0xe346[_0x351dbe];return _0x4b5863;};'use strict';var util=require(_0x6e34('0x0'));var db=require(_0x6e34('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x6e34('0x2')]({'name':util['format']('%s%s','agent',i),'fullname':util['format'](_0x6e34('0x3'),_0x6e34('0x4'),i),'email':util[_0x6e34('0x5')](_0x6e34('0x6'),_0x6e34('0x4'),i),'role':_0x6e34('0x4'),'password':_0x6e34('0x7'),'internal':0xfa0+i,'type':_0x6e34('0x8'),'transport':['udp','ws','wss'],'disallow':['all'],'allow':['ulaw'],'defaultuser':util[_0x6e34('0x5')](_0x6e34('0x3'),_0x6e34('0x4'),i),'encryption':_0x6e34('0x9'),'avpf':_0x6e34('0x9'),'force_avp':_0x6e34('0x9'),'icesupport':_0x6e34('0x9'),'dtlsenable':_0x6e34('0x9'),'dtlsverify':'no','dtlscertfile':_0x6e34('0xa'),'dtlsprivatekey':_0x6e34('0xb'),'dtlssetup':'actpass','callerid':util['format'](_0x6e34('0xc'),util[_0x6e34('0x5')](_0x6e34('0x3'),_0x6e34('0x4'),i),0xfa0+i)});}db[_0x6e34('0xd')]['bulkCreate'](users)[_0x6e34('0xe')](function(){console[_0x6e34('0xf')](_0x6e34('0x10'));})[_0x6e34('0x11')](function(_0x13bc83){console[_0x6e34('0xf')](_0x13bc83);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 98bb4ae..a91caa6 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcdec=['query','find','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','include','push','VoiceQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','user','voice:outbound','ChatQueue','FaxQueues','FaxQueue','OpenchannelQueue','getVoiceQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','user:%s','leave','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','address','request','remoteAddress','remotePort','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','./environment','Agents','User','name','agent','telephone','type','ivr','UserProfileSection','findOne','then','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','role','Campaign','format','%s:queue:%s','length','handshake'];(function(_0x4b2b11,_0x7507cd){var _0x23ebd7=function(_0x22d0c0){while(--_0x22d0c0){_0x4b2b11['push'](_0x4b2b11['shift']());}};_0x23ebd7(++_0x7507cd);}(_0xcdec,0x173));var _0xccde=function(_0x324cd1,_0x388d74){_0x324cd1=_0x324cd1-0x0;var _0x46329d=_0xcdec[_0x324cd1];return _0x46329d;};'use strict';var _=require(_0xccde('0x0'));var util=require(_0xccde('0x1'));var BPromise=require(_0xccde('0x2'));var db=require('../mysqldb')['db'];var config=require(_0xccde('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0xccde('0x4'),'model':db[_0xccde('0x5')],'attributes':['id',_0xccde('0x6'),'role'],'raw':!![],'where':{'role':_0xccde('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xccde('0x6')],'where':{'role':_0xccde('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xccde('0x6')]};var queryAgents={'raw':!![],'attributes':['id',_0xccde('0x6')],'where':{'role':_0xccde('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xccde('0x6'),_0xccde('0x9')],'where':{'type':_0xccde('0xa')}};function getAssociatedResources(_0x54c835,_0x452586,_0x4a7d74){return db[_0xccde('0xb')][_0xccde('0xc')]({'where':{'name':_0x54c835,'userProfileId':_0x452586},'raw':!![]})[_0xccde('0xd')](function(_0x3a4a32){if(_0x3a4a32){if(_0x3a4a32['autoAssociation']){switch(_0x54c835){case'VoiceQueues':case _0xccde('0xe'):case'FaxQueues':case _0xccde('0xf'):case _0xccde('0x10'):case _0xccde('0x11'):case _0xccde('0x12'):return db[_0x4a7d74][_0xccde('0x13')](queryQueues);case _0xccde('0x14'):return db[_0x4a7d74][_0xccde('0x13')](queryTelephones);case _0xccde('0x15'):return db[_0x4a7d74]['findAll'](queryTrunks);case _0xccde('0x16'):return db[_0x4a7d74][_0xccde('0x13')](queryCampaigns);}}else{return db[_0xccde('0x17')][_0xccde('0x13')]({'attributes':[_0xccde('0x18')],'where':{'sectionId':_0x3a4a32['id']},'raw':!![]})[_0xccde('0xd')](function(_0x355516){if(_0x355516){var _0x448d11={'where':{'id':_[_0xccde('0x19')](_0x355516,_0xccde('0x18'))},'raw':!![]};switch(_0x4a7d74){case _0xccde('0x5'):_0x448d11[_0xccde('0x1a')][_0xccde('0x1b')]=_0xccde('0x8');break;case _0xccde('0x1c'):_0x448d11['where'][_0xccde('0x9')]=_0xccde('0xa');break;}return db[_0x4a7d74][_0xccde('0x13')](_0x448d11);}else{return[];}});}}else{return[];}})[_0xccde('0xd')](function(_0xfbef9a){return _0xfbef9a;});}function joinOrLeaveQueues(_0x93282e,_0x2910d6,_0x309188,_0xc9ee93){_0x93282e[_0x2910d6](util[_0xccde('0x1d')](_0xccde('0x1e'),_0x309188,_0xc9ee93[_0xccde('0x6')]));if(_0xc9ee93[_0xccde('0x4')]){for(var _0x461be9=0x0;_0x461be9<_0xc9ee93[_0xccde('0x4')][_0xccde('0x1f')];_0x461be9+=0x1){_0x93282e[_0x2910d6](util[_0xccde('0x1d')]('user:%s',_0xc9ee93[_0xccde('0x4')][_0x461be9][_0xccde('0x6')]));}}}function joinOrLeave(_0x111d12,_0x1dd4a9,_0x3e2f7a){var _0x1dcc19;if(_0x111d12[_0xccde('0x20')][_0xccde('0x21')]['id']){db['User'][_0xccde('0x22')]({'attributes':['id','name','role',_0xccde('0x23')],'where':{'id':_0x111d12[_0xccde('0x20')][_0xccde('0x21')]['id']},'include':[{'model':db[_0xccde('0x24')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xccde('0x25')],'as':_0xccde('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xccde('0x27')],'as':_0xccde('0x28'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xccde('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xccde('0x2a')],'as':_0xccde('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0xccde('0x2c')],'as':_0xccde('0x2d'),'attributes':['id'],'raw':!![]}]})[_0xccde('0xd')](function(_0x6443bf){if(_0x6443bf){_0x1dcc19=_0x6443bf;_0x111d12[_0x1dd4a9](util[_0xccde('0x1d')]('user:%s',_0x6443bf[_0xccde('0x6')]));var _0x3e9334=[];switch(_0x6443bf[_0xccde('0x1b')]){case _0xccde('0x2e'):_0x111d12[_0x1dd4a9](_0xccde('0x2f'));_0x111d12[_0x1dd4a9]('voice:outbound');if(queryQueues['hasOwnProperty'](_0xccde('0x30'))){delete queryQueues[_0xccde('0x30')];}_0x3e9334[_0xccde('0x31')](db[_0xccde('0x32')][_0xccde('0x13')](queryQueues));_0x3e9334[_0xccde('0x31')](db['ChatQueue'][_0xccde('0x13')](queryQueues));_0x3e9334[_0xccde('0x31')](db['FaxQueue'][_0xccde('0x13')](queryQueues));_0x3e9334['push'](db[_0xccde('0x33')][_0xccde('0x13')](queryQueues));_0x3e9334[_0xccde('0x31')](db[_0xccde('0x34')][_0xccde('0x13')](queryQueues));_0x3e9334[_0xccde('0x31')](db['OpenchannelQueue'][_0xccde('0x13')](queryQueues));_0x3e9334[_0xccde('0x31')](db[_0xccde('0x35')][_0xccde('0x13')](queryQueues));_0x3e9334[_0xccde('0x31')](db[_0xccde('0x5')][_0xccde('0x13')](queryTelephones));_0x3e9334[_0xccde('0x31')](db[_0xccde('0x36')][_0xccde('0x13')](queryTrunks));_0x3e9334[_0xccde('0x31')](db['Campaign'][_0xccde('0x13')](queryCampaigns));_0x3e9334[_0xccde('0x31')](db['User'][_0xccde('0x13')](queryAgents));break;case _0xccde('0x37'):_0x111d12[_0x1dd4a9](_0xccde('0x2f'));_0x111d12[_0x1dd4a9](_0xccde('0x38'));_0x3e9334[_0xccde('0x31')](getAssociatedResources('VoiceQueues',_0x6443bf[_0xccde('0x23')],'VoiceQueue'));_0x3e9334['push'](getAssociatedResources(_0xccde('0xe'),_0x6443bf['userProfileId'],_0xccde('0x39')));_0x3e9334['push'](getAssociatedResources(_0xccde('0x3a'),_0x6443bf[_0xccde('0x23')],_0xccde('0x3b')));_0x3e9334[_0xccde('0x31')](getAssociatedResources('SmsQueues',_0x6443bf[_0xccde('0x23')],'SmsQueue'));_0x3e9334['push'](getAssociatedResources('MailQueues',_0x6443bf[_0xccde('0x23')],_0xccde('0x34')));_0x3e9334[_0xccde('0x31')](getAssociatedResources(_0xccde('0x11'),_0x6443bf['userProfileId'],_0xccde('0x3c')));_0x3e9334[_0xccde('0x31')](getAssociatedResources(_0xccde('0x12'),_0x6443bf[_0xccde('0x23')],_0xccde('0x35')));_0x3e9334['push'](getAssociatedResources(_0xccde('0x14'),_0x6443bf[_0xccde('0x23')],_0xccde('0x5')));_0x3e9334[_0xccde('0x31')](getAssociatedResources(_0xccde('0x15'),_0x6443bf[_0xccde('0x23')],_0xccde('0x36')));_0x3e9334['push'](getAssociatedResources(_0xccde('0x16'),_0x6443bf['userProfileId'],'Campaign'));_0x3e9334[_0xccde('0x31')](db[_0xccde('0x5')]['findAll'](queryAgents));break;case _0xccde('0x7'):_0x111d12[_0x1dd4a9](_0xccde('0x2f'));_0x111d12[_0x1dd4a9](_0xccde('0x38'));_0x3e9334[_0xccde('0x31')](_0x6443bf[_0xccde('0x3d')]({'attributes':['id',_0xccde('0x6')]}));_0x3e9334[_0xccde('0x31')](_0x6443bf['getChatQueues']({'attributes':['id',_0xccde('0x6')]}));_0x3e9334['push'](_0x6443bf['getFaxQueues']({'attributes':['id','name']}));_0x3e9334[_0xccde('0x31')](_0x6443bf[_0xccde('0x3e')]({'attributes':['id',_0xccde('0x6')]}));_0x3e9334[_0xccde('0x31')](_0x6443bf[_0xccde('0x3f')]({'attributes':['id',_0xccde('0x6')]}));_0x3e9334[_0xccde('0x31')](_0x6443bf[_0xccde('0x40')]({'attributes':['id',_0xccde('0x6')]}));_0x3e9334[_0xccde('0x31')](_0x6443bf[_0xccde('0x41')]({'attributes':['id',_0xccde('0x6')]}));break;}return BPromise[_0xccde('0x42')](_0x3e9334);}})[_0xccde('0xd')](function(_0x1dbf03){if(_0x1dbf03&&_0x1dbf03['length']){for(var _0x2a3bdf=0x0;_0x2a3bdf<_0x1dbf03[_0xccde('0x1f')];_0x2a3bdf+=0x1){for(var _0x5d3d07=0x0;_0x5d3d07<_0x1dbf03[_0x2a3bdf][_0xccde('0x1f')];_0x5d3d07+=0x1){switch(_0x2a3bdf){case 0x0:joinOrLeaveQueues(_0x111d12,_0x1dd4a9,_0xccde('0x43'),_0x1dbf03[_0x2a3bdf][_0x5d3d07]);break;case 0x1:joinOrLeaveQueues(_0x111d12,_0x1dd4a9,_0xccde('0x44'),_0x1dbf03[_0x2a3bdf][_0x5d3d07]);break;case 0x2:joinOrLeaveQueues(_0x111d12,_0x1dd4a9,_0xccde('0x45'),_0x1dbf03[_0x2a3bdf][_0x5d3d07]);break;case 0x3:joinOrLeaveQueues(_0x111d12,_0x1dd4a9,_0xccde('0x46'),_0x1dbf03[_0x2a3bdf][_0x5d3d07]);break;case 0x4:joinOrLeaveQueues(_0x111d12,_0x1dd4a9,'mail',_0x1dbf03[_0x2a3bdf][_0x5d3d07]);break;case 0x5:joinOrLeaveQueues(_0x111d12,_0x1dd4a9,_0xccde('0x47'),_0x1dbf03[_0x2a3bdf][_0x5d3d07]);break;case 0x6:joinOrLeaveQueues(_0x111d12,_0x1dd4a9,_0xccde('0x48'),_0x1dbf03[_0x2a3bdf][_0x5d3d07]);break;case 0x7:if(_0x1dcc19[_0xccde('0x1b')]!==_0xccde('0x7'))_0x111d12[_0x1dd4a9](util[_0xccde('0x1d')](_0xccde('0x49'),_0x1dbf03[_0x2a3bdf][_0x5d3d07][_0xccde('0x6')]));break;case 0x8:if(_0x1dcc19['role']!==_0xccde('0x7'))_0x111d12[_0x1dd4a9](util[_0xccde('0x1d')](_0xccde('0x4a'),_0x1dbf03[_0x2a3bdf][_0x5d3d07][_0xccde('0x6')]));break;case 0x9:if(_0x1dcc19[_0xccde('0x1b')]!==_0xccde('0x7'))_0x111d12[_0x1dd4a9](util[_0xccde('0x1d')](_0xccde('0x4b'),_0x1dbf03[_0x2a3bdf][_0x5d3d07][_0xccde('0x9')],_0x1dbf03[_0x2a3bdf][_0x5d3d07]['name']));break;case 0xa:_0x111d12[_0x1dd4a9](util[_0xccde('0x1d')](_0xccde('0x4c'),_0x1dbf03[_0x2a3bdf][_0x5d3d07][_0xccde('0x6')]));break;}}}}})[_0xccde('0xd')](function(){if(_0x1dd4a9===_0xccde('0x4d')){var _0x4a01d0=_['map'](_0x1dcc19[_0xccde('0x4e')],'id');return _0x1dcc19[_0xccde('0x4f')](_0x4a01d0)[_0xccde('0xd')](function(){for(var _0x4488a4=0x0;_0x4488a4<_0x4a01d0[_0xccde('0x1f')];_0x4488a4+=0x1){_0x3e2f7a[_0xccde('0x50')](_0xccde('0x51'),{'ChatInteractionId':Number(_0x4a01d0[_0x4488a4]),'UserId':Number(_0x1dcc19['id'])});}});}})['then'](function(){if(_0x1dd4a9===_0xccde('0x4d')){var _0x3f6507=_['map'](_0x1dcc19[_0xccde('0x26')],'id');return _0x1dcc19[_0xccde('0x52')](_0x3f6507)[_0xccde('0xd')](function(){for(var _0x535115=0x0;_0x535115<_0x3f6507[_0xccde('0x1f')];_0x535115+=0x1){_0x3e2f7a['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x3f6507[_0x535115]),'UserId':Number(_0x1dcc19['id'])});}});}})[_0xccde('0xd')](function(){if(_0x1dd4a9===_0xccde('0x4d')){var _0x695d71=_[_0xccde('0x19')](_0x1dcc19[_0xccde('0x28')],'id');return _0x1dcc19['removeFaxInteractions'](_0x695d71)[_0xccde('0xd')](function(){for(var _0x316768=0x0;_0x316768<_0x695d71[_0xccde('0x1f')];_0x316768+=0x1){_0x3e2f7a[_0xccde('0x50')](_0xccde('0x53'),{'FaxInteractionId':Number(_0x695d71[_0x316768]),'UserId':Number(_0x1dcc19['id'])});}});}})[_0xccde('0xd')](function(){if(_0x1dd4a9===_0xccde('0x4d')){var _0x3d7ab3=_[_0xccde('0x19')](_0x1dcc19['SmsInteractions'],'id');return _0x1dcc19['removeSmsInteractions'](_0x3d7ab3)[_0xccde('0xd')](function(){for(var _0x38c05c=0x0;_0x38c05c<_0x3d7ab3['length'];_0x38c05c+=0x1){_0x3e2f7a['emit'](_0xccde('0x54'),{'SmsInteractionId':Number(_0x3d7ab3[_0x38c05c]),'UserId':Number(_0x1dcc19['id'])});}});}})[_0xccde('0xd')](function(){if(_0x1dd4a9===_0xccde('0x4d')){var _0x5da2e0=_[_0xccde('0x19')](_0x1dcc19[_0xccde('0x2b')],'id');return _0x1dcc19['removeOpenchannelInteractions'](_0x5da2e0)[_0xccde('0xd')](function(){for(var _0x5d1667=0x0;_0x5d1667<_0x5da2e0[_0xccde('0x1f')];_0x5d1667+=0x1){_0x3e2f7a[_0xccde('0x50')](_0xccde('0x55'),{'OpenchannelInteractionId':Number(_0x5da2e0[_0x5d1667]),'UserId':Number(_0x1dcc19['id'])});}});}})[_0xccde('0xd')](function(){if(_0x1dd4a9==='leave'){var _0x427874=_[_0xccde('0x19')](_0x1dcc19[_0xccde('0x2d')],'id');return _0x1dcc19[_0xccde('0x56')](_0x427874)['then'](function(){for(var _0xca1299=0x0;_0xca1299<_0x427874[_0xccde('0x1f')];_0xca1299+=0x1){_0x3e2f7a[_0xccde('0x50')](_0xccde('0x57'),{'WhatsappInteractionId':Number(_0x427874[_0xca1299]),'UserId':Number(_0x1dcc19['id'])});}});}})[_0xccde('0x58')](function(_0x444abe){_0x111d12[_0xccde('0x59')](_0x444abe);});}}function onDisconnect(_0xc6dded,_0x3a6f95){joinOrLeave(_0xc6dded,'leave',_0x3a6f95);}function onConnect(_0x29ee52){joinOrLeave(_0x29ee52,_0xccde('0x5a'));}exports['default']=function(_0x3e5d73){_0x3e5d73['on'](_0xccde('0x5b'),function(_0x6a92a7){_0x6a92a7['setMaxListeners'](0x0);_0x6a92a7[_0xccde('0x5c')]=_0x6a92a7[_0xccde('0x5d')]['connection'][_0xccde('0x5e')]+':'+_0x6a92a7['request'][_0xccde('0x5b')][_0xccde('0x5f')];_0x6a92a7['connectedAt']=new Date();_0x6a92a7[_0xccde('0x59')]=function(_0x25e68c){console[_0xccde('0x59')](_0xccde('0x60')+_0x6a92a7[_0xccde('0x61')][_0xccde('0x6')]+'['+_0x6a92a7[_0xccde('0x5c')]+']',_0x25e68c);};_0x6a92a7['on'](_0xccde('0x62'),function(){onDisconnect(_0x6a92a7,_0x3e5d73);_0x6a92a7['log'](_0xccde('0x63'));});onConnect(_0x6a92a7);_0x6a92a7['log'](_0xccde('0x64'));});}; \ No newline at end of file +var _0x9527=['emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','log','join','connection','address','request','remoteAddress','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','name','Agents','User','role','telephone','type','ivr','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','then','map','resourceId','where','Campaign','format','%s:queue:%s','length','user:%s','handshake','userProfileId','query','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','VoiceQueue','push','ChatQueue','MailQueue','Trunk','FaxQueue','SmsQueues','SmsQueue','OpenchannelQueue','WhatsappQueues','WhatsappQueue','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','fax','mail','openchannel','whatsapp','agent','trunk:%s','campaign:%s:%s','leave','removeChatInteractions'];(function(_0x3403b7,_0x2ee62c){var _0x3c6c19=function(_0x3065fd){while(--_0x3065fd){_0x3403b7['push'](_0x3403b7['shift']());}};_0x3c6c19(++_0x2ee62c);}(_0x9527,0x135));var _0x7952=function(_0x6cdf0d,_0x1133f8){_0x6cdf0d=_0x6cdf0d-0x0;var _0x59b19e=_0x9527[_0x6cdf0d];return _0x59b19e;};'use strict';var _=require('lodash');var util=require(_0x7952('0x0'));var BPromise=require(_0x7952('0x1'));var db=require(_0x7952('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x7952('0x3')],'include':[{'as':_0x7952('0x4'),'model':db[_0x7952('0x5')],'attributes':['id',_0x7952('0x3'),_0x7952('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x7952('0x3')],'where':{'role':_0x7952('0x7')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x7952('0x3'),_0x7952('0x8')],'where':{'type':_0x7952('0x9')}};function getAssociatedResources(_0x32d288,_0x2343ff,_0x1619a2){return db['UserProfileSection']['findOne']({'where':{'name':_0x32d288,'userProfileId':_0x2343ff},'raw':!![]})['then'](function(_0x22c131){if(_0x22c131){if(_0x22c131[_0x7952('0xa')]){switch(_0x32d288){case _0x7952('0xb'):case _0x7952('0xc'):case _0x7952('0xd'):case'SmsQueues':case _0x7952('0xe'):case _0x7952('0xf'):case'WhatsappQueues':return db[_0x1619a2][_0x7952('0x10')](queryQueues);case _0x7952('0x11'):return db[_0x1619a2][_0x7952('0x10')](queryTelephones);case _0x7952('0x12'):return db[_0x1619a2]['findAll'](queryTrunks);case _0x7952('0x13'):return db[_0x1619a2]['findAll'](queryCampaigns);}}else{return db[_0x7952('0x14')][_0x7952('0x10')]({'attributes':['resourceId'],'where':{'sectionId':_0x22c131['id']},'raw':!![]})[_0x7952('0x15')](function(_0x351414){if(_0x351414){var _0x197abd={'where':{'id':_[_0x7952('0x16')](_0x351414,_0x7952('0x17'))},'raw':!![]};switch(_0x1619a2){case _0x7952('0x5'):_0x197abd[_0x7952('0x18')][_0x7952('0x6')]=_0x7952('0x7');break;case _0x7952('0x19'):_0x197abd[_0x7952('0x18')][_0x7952('0x8')]=_0x7952('0x9');break;}return db[_0x1619a2][_0x7952('0x10')](_0x197abd);}else{return[];}});}}else{return[];}})[_0x7952('0x15')](function(_0x3d3dbc){return _0x3d3dbc;});}function joinOrLeaveQueues(_0x3b1cbc,_0x2a8fc8,_0x4b2fde,_0x3eaef6){_0x3b1cbc[_0x2a8fc8](util[_0x7952('0x1a')](_0x7952('0x1b'),_0x4b2fde,_0x3eaef6[_0x7952('0x3')]));if(_0x3eaef6[_0x7952('0x4')]){for(var _0x439320=0x0;_0x439320<_0x3eaef6[_0x7952('0x4')][_0x7952('0x1c')];_0x439320+=0x1){_0x3b1cbc[_0x2a8fc8](util['format'](_0x7952('0x1d'),_0x3eaef6[_0x7952('0x4')][_0x439320][_0x7952('0x3')]));}}}function joinOrLeave(_0x4d54f7,_0x29852a,_0x55286d){var _0x191541;if(_0x4d54f7[_0x7952('0x1e')]['query']['id']){db['User']['find']({'attributes':['id',_0x7952('0x3'),'role',_0x7952('0x1f')],'where':{'id':_0x4d54f7['handshake'][_0x7952('0x20')]['id']},'include':[{'model':db[_0x7952('0x21')],'as':_0x7952('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x7952('0x23')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x7952('0x24')],'as':_0x7952('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x7952('0x26')],'as':_0x7952('0x27'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x7952('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x7952('0x29')],'as':_0x7952('0x2a'),'attributes':['id'],'raw':!![]}]})[_0x7952('0x15')](function(_0x1fc40b){if(_0x1fc40b){_0x191541=_0x1fc40b;_0x4d54f7[_0x29852a](util[_0x7952('0x1a')](_0x7952('0x1d'),_0x1fc40b[_0x7952('0x3')]));var _0x5356aa=[];switch(_0x1fc40b['role']){case _0x7952('0x2b'):_0x4d54f7[_0x29852a](_0x7952('0x2c'));_0x4d54f7[_0x29852a](_0x7952('0x2d'));if(queryQueues['hasOwnProperty'](_0x7952('0x2e'))){delete queryQueues[_0x7952('0x2e')];}_0x5356aa['push'](db[_0x7952('0x2f')][_0x7952('0x10')](queryQueues));_0x5356aa[_0x7952('0x30')](db[_0x7952('0x31')][_0x7952('0x10')](queryQueues));_0x5356aa[_0x7952('0x30')](db['FaxQueue'][_0x7952('0x10')](queryQueues));_0x5356aa['push'](db['SmsQueue']['findAll'](queryQueues));_0x5356aa[_0x7952('0x30')](db[_0x7952('0x32')]['findAll'](queryQueues));_0x5356aa[_0x7952('0x30')](db['OpenchannelQueue'][_0x7952('0x10')](queryQueues));_0x5356aa[_0x7952('0x30')](db['WhatsappQueue'][_0x7952('0x10')](queryQueues));_0x5356aa['push'](db[_0x7952('0x5')][_0x7952('0x10')](queryTelephones));_0x5356aa[_0x7952('0x30')](db[_0x7952('0x33')][_0x7952('0x10')](queryTrunks));_0x5356aa[_0x7952('0x30')](db[_0x7952('0x19')]['findAll'](queryCampaigns));_0x5356aa[_0x7952('0x30')](db[_0x7952('0x5')]['findAll'](queryAgents));break;case'user':_0x4d54f7[_0x29852a](_0x7952('0x2c'));_0x4d54f7[_0x29852a](_0x7952('0x2d'));_0x5356aa[_0x7952('0x30')](getAssociatedResources(_0x7952('0xb'),_0x1fc40b['userProfileId'],_0x7952('0x2f')));_0x5356aa[_0x7952('0x30')](getAssociatedResources('ChatQueues',_0x1fc40b[_0x7952('0x1f')],_0x7952('0x31')));_0x5356aa[_0x7952('0x30')](getAssociatedResources('FaxQueues',_0x1fc40b[_0x7952('0x1f')],_0x7952('0x34')));_0x5356aa['push'](getAssociatedResources(_0x7952('0x35'),_0x1fc40b[_0x7952('0x1f')],_0x7952('0x36')));_0x5356aa[_0x7952('0x30')](getAssociatedResources('MailQueues',_0x1fc40b['userProfileId'],_0x7952('0x32')));_0x5356aa[_0x7952('0x30')](getAssociatedResources(_0x7952('0xf'),_0x1fc40b[_0x7952('0x1f')],_0x7952('0x37')));_0x5356aa['push'](getAssociatedResources(_0x7952('0x38'),_0x1fc40b['userProfileId'],_0x7952('0x39')));_0x5356aa[_0x7952('0x30')](getAssociatedResources('Telephones',_0x1fc40b[_0x7952('0x1f')],_0x7952('0x5')));_0x5356aa[_0x7952('0x30')](getAssociatedResources(_0x7952('0x12'),_0x1fc40b[_0x7952('0x1f')],_0x7952('0x33')));_0x5356aa[_0x7952('0x30')](getAssociatedResources(_0x7952('0x13'),_0x1fc40b[_0x7952('0x1f')],_0x7952('0x19')));_0x5356aa[_0x7952('0x30')](db[_0x7952('0x5')][_0x7952('0x10')](queryAgents));break;case'agent':_0x4d54f7[_0x29852a](_0x7952('0x2c'));_0x4d54f7[_0x29852a](_0x7952('0x2d'));_0x5356aa[_0x7952('0x30')](_0x1fc40b[_0x7952('0x3a')]({'attributes':['id',_0x7952('0x3')]}));_0x5356aa[_0x7952('0x30')](_0x1fc40b[_0x7952('0x3b')]({'attributes':['id','name']}));_0x5356aa[_0x7952('0x30')](_0x1fc40b['getFaxQueues']({'attributes':['id',_0x7952('0x3')]}));_0x5356aa[_0x7952('0x30')](_0x1fc40b[_0x7952('0x3c')]({'attributes':['id',_0x7952('0x3')]}));_0x5356aa[_0x7952('0x30')](_0x1fc40b[_0x7952('0x3d')]({'attributes':['id',_0x7952('0x3')]}));_0x5356aa['push'](_0x1fc40b[_0x7952('0x3e')]({'attributes':['id',_0x7952('0x3')]}));_0x5356aa[_0x7952('0x30')](_0x1fc40b[_0x7952('0x3f')]({'attributes':['id',_0x7952('0x3')]}));break;}return BPromise[_0x7952('0x40')](_0x5356aa);}})[_0x7952('0x15')](function(_0xf80832){if(_0xf80832&&_0xf80832[_0x7952('0x1c')]){for(var _0x1b0c26=0x0;_0x1b0c26<_0xf80832[_0x7952('0x1c')];_0x1b0c26+=0x1){for(var _0x52eb76=0x0;_0x52eb76<_0xf80832[_0x1b0c26]['length'];_0x52eb76+=0x1){switch(_0x1b0c26){case 0x0:joinOrLeaveQueues(_0x4d54f7,_0x29852a,_0x7952('0x41'),_0xf80832[_0x1b0c26][_0x52eb76]);break;case 0x1:joinOrLeaveQueues(_0x4d54f7,_0x29852a,'chat',_0xf80832[_0x1b0c26][_0x52eb76]);break;case 0x2:joinOrLeaveQueues(_0x4d54f7,_0x29852a,_0x7952('0x42'),_0xf80832[_0x1b0c26][_0x52eb76]);break;case 0x3:joinOrLeaveQueues(_0x4d54f7,_0x29852a,'sms',_0xf80832[_0x1b0c26][_0x52eb76]);break;case 0x4:joinOrLeaveQueues(_0x4d54f7,_0x29852a,_0x7952('0x43'),_0xf80832[_0x1b0c26][_0x52eb76]);break;case 0x5:joinOrLeaveQueues(_0x4d54f7,_0x29852a,_0x7952('0x44'),_0xf80832[_0x1b0c26][_0x52eb76]);break;case 0x6:joinOrLeaveQueues(_0x4d54f7,_0x29852a,_0x7952('0x45'),_0xf80832[_0x1b0c26][_0x52eb76]);break;case 0x7:if(_0x191541[_0x7952('0x6')]!=='agent')_0x4d54f7[_0x29852a](util[_0x7952('0x1a')]('telephone:%s',_0xf80832[_0x1b0c26][_0x52eb76][_0x7952('0x3')]));break;case 0x8:if(_0x191541[_0x7952('0x6')]!==_0x7952('0x46'))_0x4d54f7[_0x29852a](util[_0x7952('0x1a')](_0x7952('0x47'),_0xf80832[_0x1b0c26][_0x52eb76][_0x7952('0x3')]));break;case 0x9:if(_0x191541[_0x7952('0x6')]!==_0x7952('0x46'))_0x4d54f7[_0x29852a](util[_0x7952('0x1a')](_0x7952('0x48'),_0xf80832[_0x1b0c26][_0x52eb76]['type'],_0xf80832[_0x1b0c26][_0x52eb76][_0x7952('0x3')]));break;case 0xa:_0x4d54f7[_0x29852a](util[_0x7952('0x1a')](_0x7952('0x1d'),_0xf80832[_0x1b0c26][_0x52eb76][_0x7952('0x3')]));break;}}}}})[_0x7952('0x15')](function(){if(_0x29852a===_0x7952('0x49')){var _0x343226=_[_0x7952('0x16')](_0x191541[_0x7952('0x22')],'id');return _0x191541[_0x7952('0x4a')](_0x343226)[_0x7952('0x15')](function(){for(var _0x2d3342=0x0;_0x2d3342<_0x343226[_0x7952('0x1c')];_0x2d3342+=0x1){_0x55286d[_0x7952('0x4b')](_0x7952('0x4c'),{'ChatInteractionId':Number(_0x343226[_0x2d3342]),'UserId':Number(_0x191541['id'])});}});}})[_0x7952('0x15')](function(){if(_0x29852a===_0x7952('0x49')){var _0x114ae9=_[_0x7952('0x16')](_0x191541['MailInteractions'],'id');return _0x191541[_0x7952('0x4d')](_0x114ae9)[_0x7952('0x15')](function(){for(var _0x35b566=0x0;_0x35b566<_0x114ae9[_0x7952('0x1c')];_0x35b566+=0x1){_0x55286d['emit'](_0x7952('0x4e'),{'MailInteractionId':Number(_0x114ae9[_0x35b566]),'UserId':Number(_0x191541['id'])});}});}})[_0x7952('0x15')](function(){if(_0x29852a==='leave'){var _0x7fca71=_[_0x7952('0x16')](_0x191541['FaxInteractions'],'id');return _0x191541['removeFaxInteractions'](_0x7fca71)['then'](function(){for(var _0x471442=0x0;_0x471442<_0x7fca71['length'];_0x471442+=0x1){_0x55286d[_0x7952('0x4b')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x7fca71[_0x471442]),'UserId':Number(_0x191541['id'])});}});}})[_0x7952('0x15')](function(){if(_0x29852a===_0x7952('0x49')){var _0x37d908=_[_0x7952('0x16')](_0x191541[_0x7952('0x27')],'id');return _0x191541[_0x7952('0x4f')](_0x37d908)[_0x7952('0x15')](function(){for(var _0x47f0a1=0x0;_0x47f0a1<_0x37d908[_0x7952('0x1c')];_0x47f0a1+=0x1){_0x55286d['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x37d908[_0x47f0a1]),'UserId':Number(_0x191541['id'])});}});}})[_0x7952('0x15')](function(){if(_0x29852a===_0x7952('0x49')){var _0x348d35=_[_0x7952('0x16')](_0x191541[_0x7952('0x28')],'id');return _0x191541[_0x7952('0x50')](_0x348d35)[_0x7952('0x15')](function(){for(var _0x4de7b9=0x0;_0x4de7b9<_0x348d35[_0x7952('0x1c')];_0x4de7b9+=0x1){_0x55286d['emit'](_0x7952('0x51'),{'OpenchannelInteractionId':Number(_0x348d35[_0x4de7b9]),'UserId':Number(_0x191541['id'])});}});}})[_0x7952('0x15')](function(){if(_0x29852a===_0x7952('0x49')){var _0x41472c=_[_0x7952('0x16')](_0x191541['WhatsappInteractions'],'id');return _0x191541['removeWhatsappInteractions'](_0x41472c)['then'](function(){for(var _0xbf1341=0x0;_0xbf1341<_0x41472c['length'];_0xbf1341+=0x1){_0x55286d['emit'](_0x7952('0x52'),{'WhatsappInteractionId':Number(_0x41472c[_0xbf1341]),'UserId':Number(_0x191541['id'])});}});}})[_0x7952('0x53')](function(_0x7e7316){_0x4d54f7[_0x7952('0x54')](_0x7e7316);});}}function onDisconnect(_0x5127fc,_0x3fd6cc){joinOrLeave(_0x5127fc,_0x7952('0x49'),_0x3fd6cc);}function onConnect(_0xfc819){joinOrLeave(_0xfc819,_0x7952('0x55'));}exports['default']=function(_0x5da0c4){_0x5da0c4['on'](_0x7952('0x56'),function(_0x1af5af){_0x1af5af['setMaxListeners'](0x0);_0x1af5af[_0x7952('0x57')]=_0x1af5af[_0x7952('0x58')][_0x7952('0x56')][_0x7952('0x59')]+':'+_0x1af5af[_0x7952('0x58')][_0x7952('0x56')]['remotePort'];_0x1af5af[_0x7952('0x5a')]=new Date();_0x1af5af['log']=function(_0x5d9fc9){console['log'](_0x7952('0x5b')+_0x1af5af[_0x7952('0x5c')][_0x7952('0x3')]+'['+_0x1af5af['address']+']',_0x5d9fc9);};_0x1af5af['on'](_0x7952('0x5d'),function(){onDisconnect(_0x1af5af,_0x5da0c4);_0x1af5af[_0x7952('0x54')](_0x7952('0x5e'));});onConnect(_0x1af5af);_0x1af5af[_0x7952('0x54')](_0x7952('0x5f'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 04eb31b..5220be2 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 _0xea10=['hook','callback','toLowerCase','condition','util','jayson/promise','../logger','triggers','http','Chat','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','Whatsapp','WhatsappInteraction','Fax','FaxInteraction','FaxMessage','MailInteraction','Mail','MailMessage','OpenchannelInteraction','Openchannel','request','EventManager','then','Trigger,\x20%s','error','code','get','channel','event','direction','UserId','User','find','name','interface','format','SIP/%s','incomingmessage','outgoingmessage','opened','changed','closed','default','length','model'];(function(_0x3affd0,_0x568954){var _0x3035df=function(_0x3a6e15){while(--_0x3a6e15){_0x3affd0['push'](_0x3affd0['shift']());}};_0x3035df(++_0x568954);}(_0xea10,0x10d));var _0x0ea1=function(_0x56ee32,_0x587db1){_0x56ee32=_0x56ee32-0x0;var _0x205357=_0xea10[_0x56ee32];return _0x205357;};'use strict';var util=require(_0x0ea1('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0x0ea1('0x1'));var logger=require(_0x0ea1('0x2'))(_0x0ea1('0x3'));var client=jayson['client'][_0x0ea1('0x4')]({'port':0x232a});var triggers=[{'channel':_0x0ea1('0x5'),'model':'ChatInteraction','event':_0x0ea1('0x6'),'condition':_0x0ea1('0x7'),'callback':afterCreate},{'channel':_0x0ea1('0x5'),'model':'ChatInteraction','event':_0x0ea1('0x8'),'condition':_0x0ea1('0x9'),'callback':afterUpdate},{'channel':'Chat','model':_0x0ea1('0xa'),'event':'afterCreate','condition':_0x0ea1('0xb'),'callback':afterCreateMessage},{'channel':_0x0ea1('0xc'),'model':_0x0ea1('0xd'),'event':_0x0ea1('0x6'),'condition':_0x0ea1('0x7'),'callback':afterCreate},{'channel':'Sms','model':_0x0ea1('0xd'),'event':'afterUpdate','condition':_0x0ea1('0x9'),'callback':afterUpdate},{'channel':_0x0ea1('0xc'),'model':'SmsMessage','event':_0x0ea1('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x0ea1('0xe'),'model':_0x0ea1('0xf'),'event':_0x0ea1('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x0ea1('0xe'),'model':'WhatsappInteraction','event':_0x0ea1('0x8'),'condition':_0x0ea1('0x9'),'callback':afterUpdate},{'channel':_0x0ea1('0xe'),'model':'WhatsappMessage','event':_0x0ea1('0x6'),'condition':_0x0ea1('0xb'),'callback':afterCreateMessage},{'channel':'Fax','model':'FaxInteraction','event':_0x0ea1('0x6'),'condition':_0x0ea1('0x7'),'callback':afterCreate},{'channel':_0x0ea1('0x10'),'model':_0x0ea1('0x11'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x0ea1('0x10'),'model':_0x0ea1('0x12'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Mail','model':_0x0ea1('0x13'),'event':_0x0ea1('0x6'),'condition':_0x0ea1('0x7'),'callback':afterCreate},{'channel':_0x0ea1('0x14'),'model':_0x0ea1('0x13'),'event':_0x0ea1('0x8'),'condition':_0x0ea1('0x9'),'callback':afterUpdate},{'channel':_0x0ea1('0x14'),'model':_0x0ea1('0x15'),'event':_0x0ea1('0x6'),'condition':_0x0ea1('0xb'),'callback':afterCreateMessage},{'channel':'Openchannel','model':'OpenchannelInteraction','event':'afterCreate','condition':_0x0ea1('0x7'),'callback':afterCreate},{'channel':'Openchannel','model':_0x0ea1('0x16'),'event':'afterUpdate','condition':_0x0ea1('0x9'),'callback':afterUpdate},{'channel':_0x0ea1('0x17'),'model':'OpenchannelMessage','event':'afterCreate','condition':_0x0ea1('0xb'),'callback':afterCreateMessage}];function request(_0x18f24f){return client[_0x0ea1('0x18')](_0x0ea1('0x19'),_0x18f24f)[_0x0ea1('0x1a')](function(_0x5b1b7f){logger['info'](_0x0ea1('0x1b'),_0x0ea1('0x19'),_0x5b1b7f);if(_0x5b1b7f[_0x0ea1('0x1c')]){if(_0x5b1b7f[_0x0ea1('0x1c')][_0x0ea1('0x1d')]===0x1f4){logger[_0x0ea1('0x1c')](_0x0ea1('0x1b'),_0x0ea1('0x19'),_0x5b1b7f[_0x0ea1('0x1c')]);}}})['catch'](function(_0x2c444c){logger[_0x0ea1('0x1c')]('Trigger,\x20%s','EventManager',_0x2c444c);});}function afterCreateMessage(_0x2b5635,_0x595036){return function(_0x46a4b1,_0x1dc07a){_0x46a4b1=_0x46a4b1[_0x0ea1('0x1e')]({'plain':!![]});_0x46a4b1[_0x0ea1('0x1f')]=_0x2b5635;_0x46a4b1[_0x0ea1('0x20')]=_0x46a4b1[_0x0ea1('0x21')];if(_0x46a4b1[_0x0ea1('0x22')]){return db[_0x0ea1('0x23')][_0x0ea1('0x24')]({'where':{'id':_0x46a4b1[_0x0ea1('0x22')]},'attributes':['id',_0x0ea1('0x25')],'raw':!![]})[_0x0ea1('0x1a')](function(_0x9550e){_0x46a4b1[_0x0ea1('0x26')]=util[_0x0ea1('0x27')](_0x0ea1('0x28'),_0x9550e[_0x0ea1('0x25')]);_0x46a4b1[_0x0ea1('0x1f')]=_0x2b5635;return request({'event':_0x0ea1('0x29'),'message':_0x46a4b1});})['catch'](function(_0x33d99e){console[_0x0ea1('0x1c')](_0x33d99e);});}else{return request({'event':_0x0ea1('0x2a'),'message':_0x46a4b1});}};}function afterCreate(_0x53db3d,_0x46d42f){return function(_0x5d7f89,_0x24e349){_0x5d7f89=_0x5d7f89[_0x0ea1('0x1e')]({'plain':!![]});_0x5d7f89[_0x0ea1('0x1f')]=_0x53db3d;_0x5d7f89['event']=_0x0ea1('0x2b');return request({'event':_0x46d42f,'message':_0x5d7f89});};}function afterUpdate(_0x5c3c73,_0x4ed298){return function(_0x57f787,_0x36a994){if(_0x57f787[_0x0ea1('0x2c')]('closed')&&_0x57f787[_0x0ea1('0x2d')]){_0x57f787=_0x57f787[_0x0ea1('0x1e')]({'plain':!![]});_0x57f787['channel']=_0x5c3c73;_0x57f787[_0x0ea1('0x20')]=_0x0ea1('0x2d');if(_0x57f787[_0x0ea1('0x22')]){return db['User'][_0x0ea1('0x24')]({'where':{'id':_0x57f787[_0x0ea1('0x22')]},'attributes':['id',_0x0ea1('0x25')],'raw':!![]})['then'](function(_0x2a7dc2){_0x57f787[_0x0ea1('0x26')]=util[_0x0ea1('0x27')](_0x0ea1('0x28'),_0x2a7dc2['name']);return request({'event':_0x4ed298,'message':_0x57f787});})['catch'](function(_0x3cd394){console['error'](_0x3cd394);});}else{return request({'event':_0x4ed298,'message':_0x57f787});}}};}exports[_0x0ea1('0x2e')]=function(){for(var _0x1e0d64=0x0;_0x1e0d64=_0x503bf2[_0x7268('0x14')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x57ffbb(_0x1310db);})[_0x7268('0x15')](function(_0x5357bb){_0x4b6d2b(_0x5357bb);});});}; \ No newline at end of file +var _0xc86a=['getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','./license/util','voice','mail','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','isUndefined','blockedAt','updateAttributes'];(function(_0x210ab9,_0x2292f4){var _0x1de4f1=function(_0x3d679d){while(--_0x3d679d){_0x210ab9['push'](_0x210ab9['shift']());}};_0x1de4f1(++_0x2292f4);}(_0xc86a,0x171));var _0xac86=function(_0x39d39d,_0x5586bd){_0x39d39d=_0x39d39d-0x0;var _0x577ac3=_0xc86a[_0x39d39d];return _0x577ac3;};'use strict';var _=require(_0xac86('0x0'));var BPromise=require(_0xac86('0x1'));var db=require('../mysqldb')['db'];var util=require(_0xac86('0x2'));var channels=[_0xac86('0x3'),_0xac86('0x4'),'chat',_0xac86('0x5'),_0xac86('0x6'),_0xac86('0x7'),_0xac86('0x8')];exports[_0xac86('0x9')]=function(){return channels;};exports[_0xac86('0xa')]=function(_0x3af919){_0x3af919=_0x3af919[_0xac86('0xb')]();return _['includes'](channels,_0x3af919);};exports['clearBlockUser']=function(_0x5adebd,_0x5ed926,_0xcdeaaa,_0x3d7b99){var _0x85cabc={'loginAttempts':_0x5ed926,'blocked':_0xcdeaaa};if(!_[_0xac86('0xc')](_0x3d7b99)){_0x85cabc[_0xac86('0xd')]=_0x3d7b99;}return _0x5adebd[_0xac86('0xe')](_0x85cabc);};exports[_0xac86('0xf')]=function(_0x264680){return new BPromise(function(_0x27ae39,_0x579a3e){var _0x294ae8=0x0;if(_0x264680[_0xac86('0x10')]!==_0xac86('0x11')){_0x27ae39(_0x264680);}db[_0xac86('0x12')][_0xac86('0x13')]({'where':{'role':_0xac86('0x11'),'online':!![],'id':{'$ne':_0x264680['id']}}})[_0xac86('0x14')](function(_0xc478ca){_0x294ae8=_0xc478ca;return util[_0xac86('0xf')]();})['then'](function(_0x30b5ef){if(_0x30b5ef&&_0x30b5ef[_0xac86('0x15')]&&_0x294ae8>=_0x30b5ef[_0xac86('0x15')]){throw Error(_0xac86('0x16'));}_0x27ae39(_0x264680);})[_0xac86('0x17')](function(_0x2f44f4){_0x579a3e(_0x2f44f4);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 2da51f1..a178ff9 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc260=['json','status','render'];(function(_0x543fb4,_0x24b026){var _0x356714=function(_0x3a8ac9){while(--_0x3a8ac9){_0x543fb4['push'](_0x543fb4['shift']());}};_0x356714(++_0x24b026);}(_0xc260,0x14e));var _0x0c26=function(_0x1d63eb,_0x1617c0){_0x1d63eb=_0x1d63eb-0x0;var _0x6542ce=_0xc260[_0x1d63eb];return _0x6542ce;};'use strict';module['exports'][0x194]=function pageNotFound(_0x260f71,_0x4b9b6e){var _0x538acd='404';var _0xb5e7f6=0x194;var _0x311812={'status':_0xb5e7f6};_0x4b9b6e[_0x0c26('0x0')](_0x311812[_0x0c26('0x0')]);_0x4b9b6e[_0x0c26('0x1')](_0x538acd,{},function(_0x64742d,_0x4c34ab){if(_0x64742d){return _0x4b9b6e[_0x0c26('0x0')](_0x311812[_0x0c26('0x0')])[_0x0c26('0x2')](_0x311812);}_0x4b9b6e['send'](_0x4c34ab);});}; \ No newline at end of file +var _0xd40b=['send','404','status','render','json'];(function(_0x58b664,_0xe3f44d){var _0x3211b7=function(_0x2e9e25){while(--_0x2e9e25){_0x58b664['push'](_0x58b664['shift']());}};_0x3211b7(++_0xe3f44d);}(_0xd40b,0x15f));var _0xbd40=function(_0x1c21d1,_0x145e76){_0x1c21d1=_0x1c21d1-0x0;var _0x6630a6=_0xd40b[_0x1c21d1];return _0x6630a6;};'use strict';module['exports'][0x194]=function pageNotFound(_0x51e613,_0x4450d6){var _0x3becbf=_0xbd40('0x0');var _0x43e664=0x194;var _0x5c540e={'status':_0x43e664};_0x4450d6[_0xbd40('0x1')](_0x5c540e[_0xbd40('0x1')]);_0x4450d6[_0xbd40('0x2')](_0x3becbf,{},function(_0x23ed97,_0x23eeab){if(_0x23ed97){return _0x4450d6[_0xbd40('0x1')](_0x5c540e[_0xbd40('0x1')])[_0xbd40('0x3')](_0x5c540e);}_0x4450d6[_0xbd40('0x4')](_0x23eeab);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 8644952..1fdfcde 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9876=['../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowField/intServicenowField.model','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/jscriptyProject/jscriptyProject.model','Setting','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','../api/attachment/attachment.model','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','cascade','HopperFinals','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','CmContact','cm_user_has_contacts','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','MailQueues','ChatQueues','FaxQueue','FaxQueues','OpenchannelQueues','WhatsappQueue','VoicePrefix','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccount','user_has_fax_accounts','MailAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','SpiedAgents','Sounds','VoiceQueue','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceCallReport','QueueCalls','uniqueid','Contact','ContactId','MailAccountId','MailServerOut','Smtp','Dispositions','Answers','MailApplication','Applications','List','ListId','TemplateId','mandatoryDispositionPause','MailMessage','Account','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachment','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','Items','Interactions','Exntensions','FaxMessage','FaxInteractionId','FaxAccountId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatMessage','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','Contacts','CompanyId','ChatInteractions','Company','cm_contact_has_tags','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','DefaultReportId','CustomReportId','Mohs','moh_has_sounds','whatsapp_interaction_has_tags','AllCondition','TriggerAllId','AnyCondition','Actions','TriggerId','Fields','MetricId','SalesforceConfiguration','Configurations','Subjects','SubjectId','Descriptions','DescriptionId','AccountId','Description','Field','FieldId','Variable','VariableId','SugarcrmConfiguration','Subject','ZohoAccount','ZohoField','FreshdeskAccount','FreshdeskConfiguration','ServicenowField','Dynamics365Account','FreshsalesField','FromId','ToId','JscriptyQuestionReport','SessionId','SmsQueueReport','ProjectId','JscriptyProject','VoiceQueues','team_has_mail_queues','team_has_chat_queues','SmsQueues','team_has_whatsapp_queues','WhatsappQueues','TrunkBackup','Lists','campaigns_has_cm_lists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ChatTransferReport','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','ToAccount','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','HopperHistory','Queues','UserProfileSections','Resources','sectionId','WhatsappAccountId','user_has_whatsapp_interactions','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','path','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xC@LL1234','127.0.0.1','name','utf8_general_ci','sequelizeHistory','xcall','mysql','database','password','options','username','User','import','../api/user/user.model','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxMessage/faxMessage.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmContact/cmContact.model','CmHopper','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','Interval','../api/interval/interval.model','Pause','Cdr','VoiceQueuesLog','Schedule','Sound','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport'];(function(_0x34b6e0,_0x229982){var _0x518f9b=function(_0x49064b){while(--_0x49064b){_0x34b6e0['push'](_0x34b6e0['shift']());}};_0x518f9b(++_0x229982);}(_0x9876,0x159));var _0x6987=function(_0x512661,_0xaea976){_0x512661=_0x512661-0x0;var _0x3803e3=_0x9876[_0x512661];return _0x3803e3;};'use strict';var path=require(_0x6987('0x0'));var config=require(_0x6987('0x1'));var Sequelize=require(_0x6987('0x2'));var _=require(_0x6987('0x3'));var jstz=require(_0x6987('0x4'));var timezone=jstz[_0x6987('0x5')]();config[_0x6987('0x2')]=_[_0x6987('0x6')](config[_0x6987('0x2')],{'database':_0x6987('0x7'),'username':'xcall','password':_0x6987('0x8'),'options':{'host':_0x6987('0x9'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x6987('0xa')](),'define':{'charset':'utf8','collate':_0x6987('0xb')}}});config[_0x6987('0xc')]=_[_0x6987('0x6')](config[_0x6987('0xc')],{'database':_0x6987('0x7'),'username':_0x6987('0xd'),'password':_0x6987('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x6987('0xe'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x6987('0xa')](),'define':{'charset':'utf8','collate':_0x6987('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x6987('0xf')],config[_0x6987('0x2')]['username'],config[_0x6987('0x2')][_0x6987('0x10')],config[_0x6987('0x2')][_0x6987('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6987('0xc')]['database'],config[_0x6987('0xc')][_0x6987('0x12')],config[_0x6987('0xc')]['password'],config[_0x6987('0xc')][_0x6987('0x11')])};db[_0x6987('0x13')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x15'));db['VoiceChanSpy']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x16'));db[_0x6987('0x17')]=db['sequelize'][_0x6987('0x14')](_0x6987('0x18'));db['VoiceExtension']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x19'));db[_0x6987('0x1a')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x1b'));db['VoiceQueue']=db[_0x6987('0x2')][_0x6987('0x14')]('../api/voiceQueue/voiceQueue.model');db['VoiceRecording']=db['sequelize']['import'](_0x6987('0x1c'));db[_0x6987('0x1d')]=db['sequelize'][_0x6987('0x14')](_0x6987('0x1e'));db[_0x6987('0x1f')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x20'));db[_0x6987('0x21')]=db[_0x6987('0x2')]['import'](_0x6987('0x22'));db['VoiceCallReport']=db[_0x6987('0x2')]['import'](_0x6987('0x23'));db[_0x6987('0x24')]=db['sequelize'][_0x6987('0x14')](_0x6987('0x25'));db[_0x6987('0x26')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x27'));db[_0x6987('0x28')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x29'));db[_0x6987('0x2a')]=db[_0x6987('0x2')]['import'](_0x6987('0x2b'));db[_0x6987('0x2c')]=db['sequelize']['import'](_0x6987('0x2d'));db['VoiceTransferReport']=db[_0x6987('0x2')]['import']('../api/voiceTransferReport/voiceTransferReport.model');db[_0x6987('0x2e')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x6987('0x2f')]=db['sequelize'][_0x6987('0x14')](_0x6987('0x30'));db[_0x6987('0x31')]=db[_0x6987('0x2')]['import'](_0x6987('0x32'));db[_0x6987('0x33')]=db[_0x6987('0x2')]['import'](_0x6987('0x34'));db[_0x6987('0x35')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x36'));db[_0x6987('0x37')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x38'));db[_0x6987('0x39')]=db['sequelize']['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x6987('0x3a')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x3b'));db[_0x6987('0x3c')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x3d'));db['MailServerOut']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x3e'));db['MailAccount']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x3f'));db[_0x6987('0x40')]=db[_0x6987('0x2')]['import'](_0x6987('0x41'));db[_0x6987('0x42')]=db[_0x6987('0x2')]['import']('../api/mailSubstatus/mailSubstatus.model');db[_0x6987('0x43')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x44'));db['MailMessage']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x45'));db['MailApplication']=db['sequelize'][_0x6987('0x14')]('../api/mailApplication/mailApplication.model');db[_0x6987('0x46')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x47'));db[_0x6987('0x48')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x49'));db[_0x6987('0x4a')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x4b'));db['FaxAccount']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x4c'));db[_0x6987('0x4d')]=db['sequelize']['import'](_0x6987('0x4e'));db[_0x6987('0x4f')]=db[_0x6987('0x2')]['import']('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x50'));db['FaxQueue']=db[_0x6987('0x2')][_0x6987('0x14')]('../api/faxQueue/faxQueue.model');db[_0x6987('0x51')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x52'));db[_0x6987('0x53')]=db[_0x6987('0x2')]['import'](_0x6987('0x54'));db[_0x6987('0x55')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/smsApplication/smsApplication.model');db[_0x6987('0x56')]=db[_0x6987('0x2')]['import']('../api/smsInteraction/smsInteraction.model');db[_0x6987('0x57')]=db['sequelize'][_0x6987('0x14')](_0x6987('0x58'));db[_0x6987('0x59')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x5a'));db[_0x6987('0x5b')]=db[_0x6987('0x2')]['import'](_0x6987('0x5c'));db[_0x6987('0x5d')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x5e'));db[_0x6987('0x5f')]=db[_0x6987('0x2')]['import'](_0x6987('0x60'));db['OpenchannelMessage']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x61'));db[_0x6987('0x62')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x63'));db[_0x6987('0x64')]=db['sequelize'][_0x6987('0x14')](_0x6987('0x65'));db[_0x6987('0x66')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x6987('0x67')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x68'));db[_0x6987('0x69')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x6a'));db['ChatMessage']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x6b'));db[_0x6987('0x6c')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x6d'));db[_0x6987('0x6e')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/chatQueue/chatQueue.model');db[_0x6987('0x6f')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x70'));db[_0x6987('0x71')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x72'));db[_0x6987('0x73')]=db[_0x6987('0x2')]['import']('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x74'));db[_0x6987('0x75')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/cmHopper/cmHopper.model');db[_0x6987('0x76')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0x6987('0x77')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x78'));db[_0x6987('0x79')]=db['sequelize'][_0x6987('0x14')](_0x6987('0x7a'));db[_0x6987('0x7b')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x7c'));db[_0x6987('0x7d')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x7e'));db[_0x6987('0x7f')]=db['sequelize'][_0x6987('0x14')](_0x6987('0x80'));db[_0x6987('0x81')]=db['sequelize'][_0x6987('0x14')]('../api/automation/automation.model');db[_0x6987('0x82')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x83'));db[_0x6987('0x84')]=db[_0x6987('0x2')]['import']('../api/disposition/disposition.model');db[_0x6987('0x85')]=db[_0x6987('0x2')]['import']('../api/condition/condition.model');db[_0x6987('0x86')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x87'));db[_0x6987('0x88')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/pause/pause.model');db[_0x6987('0x89')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/cdr/cdr.model');db[_0x6987('0x8a')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x6987('0x8b')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/schedule/schedule.model');db[_0x6987('0x8c')]=db[_0x6987('0x2')]['import']('../api/sound/sound.model');db[_0x6987('0x8d')]=db['sequelize'][_0x6987('0x14')](_0x6987('0x8e'));db[_0x6987('0x8f')]=db[_0x6987('0x2')]['import'](_0x6987('0x90'));db[_0x6987('0x91')]=db['sequelize'][_0x6987('0x14')]('../api/trigger/trigger.model');db['Variable']=db[_0x6987('0x2')]['import'](_0x6987('0x92'));db[_0x6987('0x93')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x94'));db[_0x6987('0x95')]=db[_0x6987('0x2')]['import'](_0x6987('0x96'));db[_0x6987('0x97')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x98'));db[_0x6987('0x99')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x9a'));db[_0x6987('0x9b')]=db['sequelize'][_0x6987('0x14')](_0x6987('0x9c'));db[_0x6987('0x9d')]=db[_0x6987('0x2')]['import'](_0x6987('0x9e'));db[_0x6987('0x9f')]=db[_0x6987('0x2')]['import']('../api/analyticFieldReport/analyticFieldReport.model');db[_0x6987('0xa0')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x6987('0xa1')]=db['sequelize'][_0x6987('0x14')](_0x6987('0xa2'));db['SalesforceConfiguration']=db['sequelize']['import'](_0x6987('0xa3'));db[_0x6987('0xa4')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/intSalesforceField/intSalesforceField.model');db[_0x6987('0xa5')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xa6'));db['SugarcrmConfiguration']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xa7'));db[_0x6987('0xa8')]=db[_0x6987('0x2')]['import'](_0x6987('0xa9'));db[_0x6987('0xaa')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xab'));db[_0x6987('0xac')]=db['sequelize'][_0x6987('0x14')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0x6987('0xad')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xae'));db['ZohoAccount']=db[_0x6987('0x2')][_0x6987('0x14')]('../api/intZohoAccount/intZohoAccount.model');db[_0x6987('0xaf')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xb0'));db['ZohoField']=db[_0x6987('0x2')][_0x6987('0x14')]('../api/intZohoField/intZohoField.model');db[_0x6987('0xb1')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xb2'));db[_0x6987('0xb3')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xb4'));db[_0x6987('0xb5')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xb6'));db['FreshdeskAccount']=db['sequelize'][_0x6987('0x14')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xb7'));db[_0x6987('0xb8')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xb9'));db[_0x6987('0xba')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xbb'));db[_0x6987('0xbc')]=db['sequelize']['import'](_0x6987('0xbd'));db[_0x6987('0xbe')]=db['sequelize'][_0x6987('0x14')](_0x6987('0xbf'));db[_0x6987('0xc0')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xc1'));db[_0x6987('0xc2')]=db[_0x6987('0x2')]['import']('../api/intServicenowConfiguration/intServicenowConfiguration.model');db['ServicenowField']=db['sequelize'][_0x6987('0x14')](_0x6987('0xc3'));db['Dynamics365Account']=db['sequelize'][_0x6987('0x14')](_0x6987('0xc4'));db[_0x6987('0xc5')]=db[_0x6987('0x2')]['import'](_0x6987('0xc6'));db[_0x6987('0xc7')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xc8'));db[_0x6987('0xc9')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xca'));db[_0x6987('0xcb')]=db['sequelize'][_0x6987('0x14')](_0x6987('0xcc'));db['FreshsalesField']=db['sequelize'][_0x6987('0x14')](_0x6987('0xcd'));db[_0x6987('0x93')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0x94'));db[_0x6987('0xce')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xcf'));db[_0x6987('0xd0')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/chatQueueReport/chatQueueReport.model');db[_0x6987('0xd1')]=db['sequelize'][_0x6987('0x14')](_0x6987('0xd2'));db[_0x6987('0xd3')]=db[_0x6987('0x2')]['import'](_0x6987('0xd4'));db['JscriptyQuestionReport']=db['sequelize'][_0x6987('0x14')](_0x6987('0xd5'));db[_0x6987('0xd6')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xd7'));db['SmsQueueReport']=db['sequelize'][_0x6987('0x14')](_0x6987('0xd8'));db[_0x6987('0xd9')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/squareReport/squareReport.model');db[_0x6987('0xda')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/squareReportDetail/squareReportDetail.model');db['JscriptyProject']=db['sequelize'][_0x6987('0x14')](_0x6987('0xdb'));db[_0x6987('0xdc')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/setting/setting.model');db['SquareOdbc']=db['sequelize'][_0x6987('0x14')](_0x6987('0xdd'));db[_0x6987('0xde')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xdf'));db['SquareRecording']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xe0'));db[_0x6987('0xe1')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xe2'));db[_0x6987('0xe3')]=db['sequelize'][_0x6987('0x14')](_0x6987('0xe4'));db[_0x6987('0xe5')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/license/license.model');db[_0x6987('0xe6')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xe7'));db['Migration']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xe8'));db['Attachment']=db[_0x6987('0x2')]['import'](_0x6987('0xe9'));db['Plugin']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xea'));db['MailTransferReport']=db['sequelize'][_0x6987('0x14')](_0x6987('0xeb'));db['ChatTransferReport']=db[_0x6987('0x2')]['import']('../api/chatTransferReport/chatTransferReport.model');db['FaxTransferReport']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xec'));db[_0x6987('0xed')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xee'));db['SmsTransferReport']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xef'));db[_0x6987('0xf0')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xf1'));db['VoicePrefix']=db[_0x6987('0x2')]['import'](_0x6987('0xf2'));db[_0x6987('0xf3')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/userProfile/userProfile.model');db[_0x6987('0xf4')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xf5'));db['UserProfileResource']=db['sequelize'][_0x6987('0x14')]('../api/userProfileResource/userProfileResource.model');db[_0x6987('0xf6')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xf7'));db[_0x6987('0xf8')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/whatsappAccount/whatsappAccount.model');db[_0x6987('0xf9')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/whatsappApplication/whatsappApplication.model');db['WhatsappInteraction']=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xfa'));db[_0x6987('0xfb')]=db['sequelize']['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x6987('0xfc')]=db['sequelize'][_0x6987('0x14')](_0x6987('0xfd'));db[_0x6987('0xfe')]=db[_0x6987('0x2')][_0x6987('0x14')](_0x6987('0xff'));db['WhatsappQueue']=db['sequelize'][_0x6987('0x14')](_0x6987('0x100'));db[_0x6987('0x101')]=db[_0x6987('0x2')][_0x6987('0x14')]('../api/cloudProvider/cloudProvider.model');db[_0x6987('0x102')]=db['sequelize'][_0x6987('0x14')](_0x6987('0x103'));db[_0x6987('0x13')][_0x6987('0x104')](db['VoiceMail'],{'as':_0x6987('0x1f'),'onDelete':'cascade','foreignKey':_0x6987('0x105')});db['User'][_0x6987('0x106')](db[_0x6987('0x107')],{'as':_0x6987('0x108'),'foreignKey':_0x6987('0x105')});db[_0x6987('0x13')][_0x6987('0x106')](db[_0x6987('0x2e')],{'as':_0x6987('0x109'),'foreignKey':_0x6987('0x105')});db[_0x6987('0x13')][_0x6987('0x106')](db[_0x6987('0x10a')],{'as':_0x6987('0x10b'),'onDelete':_0x6987('0x10c'),'hooks':!![]});db[_0x6987('0x13')]['hasMany'](db['CmHopperFinal'],{'as':_0x6987('0x10d'),'foreignKey':'UserId'});db['User'][_0x6987('0x106')](db[_0x6987('0x79')],{'as':'HopperHistory','foreignKey':_0x6987('0x105')});db['User'][_0x6987('0x106')](db[_0x6987('0x7b')],{'as':_0x6987('0x7b'),'foreignKey':'UserId'});db[_0x6987('0x13')][_0x6987('0x106')](db[_0x6987('0x5f')],{'as':_0x6987('0x10e'),'foreignKey':_0x6987('0x105')});db[_0x6987('0x13')][_0x6987('0x106')](db[_0x6987('0x69')],{'as':'ChatInteractions','foreignKey':_0x6987('0x105')});db[_0x6987('0x13')][_0x6987('0x106')](db[_0x6987('0x56')],{'as':_0x6987('0x10f'),'foreignKey':_0x6987('0x105')});db[_0x6987('0x13')][_0x6987('0x106')](db[_0x6987('0x4f')],{'as':_0x6987('0x110'),'foreignKey':_0x6987('0x105')});db['User'][_0x6987('0x106')](db['MailInteraction'],{'as':_0x6987('0x111'),'foreignKey':_0x6987('0x105')});db[_0x6987('0x13')][_0x6987('0x106')](db[_0x6987('0x112')],{'as':_0x6987('0x113'),'foreignKey':_0x6987('0x105')});db[_0x6987('0x13')]['hasMany'](db[_0x6987('0xf6')],{'as':_0x6987('0x114'),'foreignKey':_0x6987('0x115')});db[_0x6987('0x13')][_0x6987('0x116')](db['UserProfile'],{'as':_0x6987('0xf3'),'foreignKey':_0x6987('0x117')});db[_0x6987('0x13')][_0x6987('0x118')](db[_0x6987('0x6f')],{'as':_0x6987('0x119'),'through':_0x6987('0x11a')});db[_0x6987('0x13')][_0x6987('0x118')](db[_0x6987('0x11b')],{'as':'Contacts','through':_0x6987('0x11c')});db[_0x6987('0x13')][_0x6987('0x118')](db['CmList'],{'as':'Lists','through':_0x6987('0x11d')});db[_0x6987('0x13')][_0x6987('0x118')](db[_0x6987('0xe3')],{'through':_0x6987('0x11e')});db[_0x6987('0x13')][_0x6987('0x118')](db[_0x6987('0x43')],{'as':_0x6987('0x111'),'through':_0x6987('0x11f')});db[_0x6987('0x13')][_0x6987('0x118')](db[_0x6987('0x69')],{'as':'ChatInteractions','through':_0x6987('0x120')});db[_0x6987('0x13')]['belongsToMany'](db['FaxInteraction'],{'as':_0x6987('0x110'),'through':_0x6987('0x121')});db[_0x6987('0x13')]['belongsToMany'](db[_0x6987('0x56')],{'as':_0x6987('0x10f'),'through':_0x6987('0x122')});db['User']['belongsToMany'](db[_0x6987('0x5f')],{'as':_0x6987('0x10e'),'through':'user_has_openchannel_interactions'});db['User'][_0x6987('0x118')](db[_0x6987('0x112')],{'as':_0x6987('0x113'),'through':'user_has_whatsapp_interactions'});db[_0x6987('0x13')]['belongsToMany'](db['VoiceQueue'],{'as':'VoiceQueues','through':'UserVoiceQueue','required':![]});db[_0x6987('0x13')][_0x6987('0x118')](db['MailQueue'],{'as':_0x6987('0x123'),'through':_0x6987('0x33'),'required':![]});db[_0x6987('0x13')][_0x6987('0x118')](db[_0x6987('0x6e')],{'as':_0x6987('0x124'),'through':_0x6987('0x31'),'required':![],'hooks':!![]});db[_0x6987('0x13')]['belongsToMany'](db[_0x6987('0x125')],{'as':_0x6987('0x126'),'through':'UserFaxQueue','required':![]});db[_0x6987('0x13')][_0x6987('0x118')](db['SmsQueue'],{'as':'SmsQueues','through':_0x6987('0x37'),'required':![]});db['User'][_0x6987('0x118')](db[_0x6987('0x62')],{'as':_0x6987('0x127'),'through':_0x6987('0x39'),'required':![]});db[_0x6987('0x13')]['belongsToMany'](db[_0x6987('0x128')],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db[_0x6987('0x13')][_0x6987('0x118')](db[_0x6987('0xf0')],{'through':_0x6987('0x11d')});db['User'][_0x6987('0x118')](db[_0x6987('0x129')],{'as':_0x6987('0x12a'),'through':_0x6987('0x12b'),'required':![]});db[_0x6987('0x13')][_0x6987('0x118')](db[_0x6987('0x64')],{'as':_0x6987('0x12c'),'through':_0x6987('0x12d')});db[_0x6987('0x13')][_0x6987('0x118')](db[_0x6987('0x12e')],{'as':'FaxAccounts','through':_0x6987('0x12f')});db[_0x6987('0x13')]['belongsToMany'](db[_0x6987('0x130')],{'as':'MailAccounts','through':'user_has_mail_accounts'});db[_0x6987('0x13')][_0x6987('0x118')](db[_0x6987('0x5b')],{'as':_0x6987('0x131'),'through':_0x6987('0x132')});db['User'][_0x6987('0x118')](db[_0x6987('0x53')],{'as':_0x6987('0x133'),'through':'user_has_sms_accounts'});db[_0x6987('0x13')]['belongsToMany'](db[_0x6987('0xf8')],{'as':'WhatsappAccounts','through':_0x6987('0x134')});db[_0x6987('0x13')][_0x6987('0x118')](db[_0x6987('0xde')],{'as':_0x6987('0x135'),'through':_0x6987('0x136')});db[_0x6987('0x137')][_0x6987('0x106')](db[_0x6987('0x10a')],{'as':_0x6987('0x138'),'onDelete':'cascade','foreignKey':'ChanSpyId'});db[_0x6987('0x17')][_0x6987('0x106')](db[_0x6987('0x10a')],{'onDelete':_0x6987('0x10c')});db[_0x6987('0x10a')][_0x6987('0x106')](db['VoiceExtension'],{'as':'Applications','onDelete':_0x6987('0x10c')});db['VoiceMusicOnHold'][_0x6987('0x118')](db['Sound'],{'as':_0x6987('0x139'),'through':'moh_has_sounds'});db[_0x6987('0x13a')][_0x6987('0x106')](db[_0x6987('0x2e')],{'as':_0x6987('0x13b'),'foreignKey':_0x6987('0x13c')});db[_0x6987('0x13a')][_0x6987('0x106')](db[_0x6987('0x75')],{'as':_0x6987('0x13d'),'foreignKey':_0x6987('0x13c')});db[_0x6987('0x13a')][_0x6987('0x106')](db['CmHopperFinal'],{'as':_0x6987('0x10d'),'foreignKey':_0x6987('0x13c')});db[_0x6987('0x13a')][_0x6987('0x106')](db['CmHopperHistory'],{'as':_0x6987('0x13e'),'foreignKey':'VoiceQueueId'});db[_0x6987('0x13a')][_0x6987('0x106')](db[_0x6987('0x7b')],{'as':_0x6987('0x7b'),'foreignKey':_0x6987('0x13c')});db[_0x6987('0x13a')]['hasMany'](db['CmHopperBlack'],{'as':_0x6987('0x13f'),'foreignKey':_0x6987('0x13c')});db['VoiceQueue']['hasMany'](db[_0x6987('0xd6')],{'as':_0x6987('0x140'),'foreignKey':_0x6987('0x13c')});db['VoiceQueue'][_0x6987('0x116')](db[_0x6987('0x2c')],{'as':'Trunk','foreignKey':_0x6987('0x141')});db[_0x6987('0x13a')][_0x6987('0x116')](db[_0x6987('0x2c')],{'as':'TrunkBackup','foreignKey':_0x6987('0x142')});db[_0x6987('0x13a')][_0x6987('0x116')](db[_0x6987('0x86')],{'as':'Interval','foreignKey':_0x6987('0x143')});db[_0x6987('0x13a')][_0x6987('0x116')](db[_0x6987('0x88')],{'as':'mandatoryDispositionPause','foreignKey':_0x6987('0x144')});db[_0x6987('0x13a')][_0x6987('0x118')](db[_0x6987('0xf0')],{'as':'Lists','through':_0x6987('0x145')});db[_0x6987('0x13a')]['belongsToMany'](db[_0x6987('0x13')],{'as':_0x6987('0x146'),'through':_0x6987('0x2f')});db[_0x6987('0x13a')][_0x6987('0x118')](db[_0x6987('0xe3')],{'as':_0x6987('0x147'),'through':_0x6987('0x102')});db[_0x6987('0x13a')]['belongsToMany'](db['CmList'],{'as':_0x6987('0x148'),'through':_0x6987('0x149')});db[_0x6987('0x107')][_0x6987('0x116')](db[_0x6987('0x13')],{'as':_0x6987('0x13'),'foreignKey':'UserId'});db[_0x6987('0x1d')][_0x6987('0x116')](db[_0x6987('0x13')],{'as':_0x6987('0x13'),'foreignKey':'UserId'});db[_0x6987('0x1f')][_0x6987('0x106')](db[_0x6987('0x21')],{'as':_0x6987('0x14a'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x14b'),'sourceKey':_0x6987('0x14c')});db[_0x6987('0x21')]['belongsTo'](db[_0x6987('0x1f')],{'foreignKey':_0x6987('0x14b'),'targetKey':_0x6987('0x14c')});db[_0x6987('0x14d')][_0x6987('0x106')](db[_0x6987('0x28')],{'as':_0x6987('0x14e'),'foreignKey':_0x6987('0x14f'),'constraints':![]});db[_0x6987('0x14d')][_0x6987('0x106')](db[_0x6987('0x26')],{'as':'AgentReports','foreignKey':_0x6987('0x14f'),'constraints':![]});db[_0x6987('0x14d')][_0x6987('0x116')](db['User'],{'as':_0x6987('0x13'),'foreignKey':'UserId'});db[_0x6987('0x14d')]['belongsTo'](db[_0x6987('0x11b')],{'as':_0x6987('0x150'),'foreignKey':_0x6987('0x151')});db[_0x6987('0x3c')][_0x6987('0x116')](db[_0x6987('0x130')],{'as':_0x6987('0x130'),'foreignKey':_0x6987('0x152')});db['MailServerOut'][_0x6987('0x116')](db[_0x6987('0x130')],{'as':_0x6987('0x130'),'foreignKey':_0x6987('0x152')});db[_0x6987('0x130')][_0x6987('0x104')](db['MailServerIn'],{'as':'Imap','onDelete':_0x6987('0x10c')});db[_0x6987('0x130')][_0x6987('0x104')](db[_0x6987('0x153')],{'as':_0x6987('0x154'),'onDelete':'cascade'});db['MailAccount'][_0x6987('0x106')](db[_0x6987('0x84')],{'as':_0x6987('0x155'),'foreignKey':_0x6987('0x152')});db[_0x6987('0x130')][_0x6987('0x106')](db[_0x6987('0x82')],{'as':_0x6987('0x156'),'foreignKey':'MailAccountId'});db[_0x6987('0x130')][_0x6987('0x106')](db['MailMessage'],{'as':'Messages','foreignKey':'MailAccountId'});db[_0x6987('0x130')][_0x6987('0x106')](db[_0x6987('0x43')],{'as':'Interactions'});db[_0x6987('0x130')][_0x6987('0x106')](db[_0x6987('0x157')],{'as':_0x6987('0x158')});db['MailAccount']['belongsTo'](db[_0x6987('0xf0')],{'as':_0x6987('0x159'),'foreignKey':_0x6987('0x15a')});db[_0x6987('0x130')][_0x6987('0x116')](db[_0x6987('0x8f')],{'as':_0x6987('0x8f'),'foreignKey':_0x6987('0x15b')});db['MailAccount'][_0x6987('0x116')](db[_0x6987('0x88')],{'as':_0x6987('0x15c'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x6987('0x130')][_0x6987('0x118')](db['User'],{'as':_0x6987('0x146'),'through':'user_has_mail_accounts'});db[_0x6987('0x40')]['belongsToMany'](db[_0x6987('0x13')],{'as':_0x6987('0x146'),'through':'UserMailQueue'});db['MailQueue'][_0x6987('0x118')](db[_0x6987('0xe3')],{'through':'team_has_mail_queues','as':'Teams'});db[_0x6987('0x43')][_0x6987('0x106')](db[_0x6987('0x15d')],{'as':_0x6987('0x14a'),'onDelete':_0x6987('0x10c'),'foreignKey':'MailInteractionId'});db[_0x6987('0x43')][_0x6987('0x116')](db['MailAccount'],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x152')});db[_0x6987('0x43')][_0x6987('0x116')](db[_0x6987('0x11b')],{'as':_0x6987('0x150'),'foreignKey':_0x6987('0x151')});db[_0x6987('0x43')][_0x6987('0x116')](db[_0x6987('0x13')],{'as':_0x6987('0x15f'),'foreignKey':_0x6987('0x105')});db['MailInteraction']['belongsToMany'](db[_0x6987('0x8d')],{'through':_0x6987('0x160'),'as':_0x6987('0x161')});db[_0x6987('0x43')]['belongsToMany'](db['Tag'],{'through':_0x6987('0x160'),'as':_0x6987('0x162')});db[_0x6987('0x43')][_0x6987('0x118')](db['User'],{'as':_0x6987('0x163'),'through':_0x6987('0x11f'),'foreignKey':_0x6987('0x164')});db['MailMessage']['hasMany'](db[_0x6987('0x165')],{'as':_0x6987('0x166'),'onDelete':_0x6987('0x10c')});db[_0x6987('0x15d')][_0x6987('0x116')](db[_0x6987('0x13')],{'as':_0x6987('0x13')});db[_0x6987('0x15d')]['belongsTo'](db[_0x6987('0x11b')],{'onDelete':_0x6987('0x10c'),'as':_0x6987('0x150')});db[_0x6987('0x15d')][_0x6987('0x116')](db[_0x6987('0x43')],{'as':_0x6987('0x167'),'foreignKey':'MailInteractionId'});db[_0x6987('0x15d')][_0x6987('0x116')](db[_0x6987('0x130')],{'as':_0x6987('0x15e'),'foreignKey':'MailAccountId'});db[_0x6987('0x15d')][_0x6987('0x116')](db[_0x6987('0x64')],{'as':_0x6987('0x64'),'foreignKey':_0x6987('0x168')});db[_0x6987('0x15d')][_0x6987('0x116')](db['ChatOfflineMessage'],{'as':_0x6987('0x6c'),'foreignKey':_0x6987('0x169')});db['MailApplication']['belongsTo'](db[_0x6987('0x13')],{'onDelete':_0x6987('0x16a')});db[_0x6987('0x157')][_0x6987('0x116')](db['MailQueue'],{'onDelete':_0x6987('0x16a')});db[_0x6987('0x157')][_0x6987('0x116')](db[_0x6987('0x130')],{'onDelete':_0x6987('0x16a')});db[_0x6987('0x157')]['belongsTo'](db[_0x6987('0x86')],{'onDelete':_0x6987('0x16a'),'foreignKey':_0x6987('0x143')});db['MailApplication']['belongsTo'](db[_0x6987('0x8d')],{'onDelete':_0x6987('0x16a'),'foreignKey':_0x6987('0x16b')});db[_0x6987('0x46')][_0x6987('0x116')](db[_0x6987('0x130')],{});db[_0x6987('0x46')][_0x6987('0x116')](db[_0x6987('0xf0')],{'as':'List','foreignKey':_0x6987('0x15a')});db[_0x6987('0x46')]['belongsTo'](db['CmContact'],{'as':_0x6987('0x150'),'foreignKey':_0x6987('0x151')});db[_0x6987('0x46')][_0x6987('0x116')](db[_0x6987('0x43')],{});db[_0x6987('0x46')][_0x6987('0x116')](db[_0x6987('0x15d')],{});db[_0x6987('0x46')]['belongsTo'](db['User'],{});db[_0x6987('0x46')][_0x6987('0x116')](db[_0x6987('0x40')],{});db[_0x6987('0x48')][_0x6987('0x106')](db['DashboardItem'],{'as':_0x6987('0x16c'),'onDelete':_0x6987('0x10c')});db['FaxAccount'][_0x6987('0x106')](db[_0x6987('0x84')],{'as':_0x6987('0x155'),'foreignKey':'FaxAccountId'});db[_0x6987('0x12e')][_0x6987('0x106')](db['CannedAnswer'],{'as':_0x6987('0x156'),'foreignKey':'FaxAccountId'});db[_0x6987('0x12e')]['hasMany'](db[_0x6987('0x4f')],{'as':_0x6987('0x16d')});db['FaxAccount'][_0x6987('0x106')](db[_0x6987('0x4d')],{'as':_0x6987('0x158')});db['FaxAccount'][_0x6987('0x106')](db[_0x6987('0x10a')],{'as':_0x6987('0x16e'),'onDelete':'cascade'});db[_0x6987('0x12e')]['hasMany'](db['FaxMessage'],{'as':'Messages'});db[_0x6987('0x12e')][_0x6987('0x116')](db[_0x6987('0x2c')],{'as':_0x6987('0x2c')});db[_0x6987('0x12e')][_0x6987('0x116')](db['CmList'],{'as':_0x6987('0x159'),'foreignKey':_0x6987('0x15a')});db[_0x6987('0x12e')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x6987('0x144')});db[_0x6987('0x12e')]['belongsToMany'](db[_0x6987('0x13')],{'as':_0x6987('0x146'),'through':'user_has_fax_accounts'});db[_0x6987('0x4d')][_0x6987('0x116')](db[_0x6987('0x13')],{'onDelete':_0x6987('0x16a')});db[_0x6987('0x4d')][_0x6987('0x116')](db[_0x6987('0x125')],{'onDelete':'restrict'});db[_0x6987('0x4d')]['belongsTo'](db[_0x6987('0x12e')],{'onDelete':_0x6987('0x16a')});db[_0x6987('0x4d')]['belongsTo'](db[_0x6987('0x8d')],{'onDelete':'restrict','foreignKey':_0x6987('0x16b')});db[_0x6987('0x4f')]['hasMany'](db[_0x6987('0x16f')],{'as':_0x6987('0x14a'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x170')});db[_0x6987('0x4f')][_0x6987('0x116')](db['FaxAccount'],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x171')});db['FaxInteraction'][_0x6987('0x116')](db[_0x6987('0x11b')],{'as':'Contact','foreignKey':_0x6987('0x151')});db['FaxInteraction'][_0x6987('0x116')](db[_0x6987('0x13')],{'as':'Owner','foreignKey':_0x6987('0x105')});db['FaxInteraction']['belongsToMany'](db['Tag'],{'through':_0x6987('0x172'),'as':'Tags'});db[_0x6987('0x4f')][_0x6987('0x118')](db[_0x6987('0x8d')],{'through':_0x6987('0x172'),'as':_0x6987('0x162')});db['FaxInteraction'][_0x6987('0x118')](db['User'],{'as':_0x6987('0x163'),'through':'user_has_fax_interactions','foreignKey':_0x6987('0x170')});db['FaxMessage'][_0x6987('0x116')](db[_0x6987('0x13')],{'onDelete':_0x6987('0x10c'),'as':'User'});db[_0x6987('0x16f')][_0x6987('0x116')](db[_0x6987('0x4f')],{'as':'Interaction','foreignKey':_0x6987('0x170')});db[_0x6987('0x16f')][_0x6987('0x116')](db[_0x6987('0x11b')],{'onDelete':_0x6987('0x10c'),'as':_0x6987('0x150')});db[_0x6987('0x16f')][_0x6987('0x116')](db['Attachment'],{'as':_0x6987('0x165'),'foreignKey':_0x6987('0x173')});db[_0x6987('0x16f')]['belongsTo'](db['FaxAccount'],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x171')});db[_0x6987('0x125')][_0x6987('0x118')](db[_0x6987('0x13')],{'as':_0x6987('0x146'),'through':'UserFaxQueue'});db[_0x6987('0x125')][_0x6987('0x118')](db[_0x6987('0xe3')],{'through':_0x6987('0x174'),'as':'Teams'});db[_0x6987('0x51')]['belongsTo'](db[_0x6987('0x12e')],{});db[_0x6987('0x51')][_0x6987('0x116')](db[_0x6987('0xf0')],{'as':_0x6987('0x159'),'foreignKey':_0x6987('0x15a')});db['FaxQueueReport'][_0x6987('0x116')](db['CmContact'],{'as':_0x6987('0x150'),'foreignKey':'ContactId'});db[_0x6987('0x51')]['belongsTo'](db['FaxInteraction'],{});db[_0x6987('0x51')]['belongsTo'](db[_0x6987('0x16f')],{});db['FaxQueueReport'][_0x6987('0x116')](db['User'],{});db[_0x6987('0x51')][_0x6987('0x116')](db[_0x6987('0x125')],{});db[_0x6987('0x53')][_0x6987('0x106')](db[_0x6987('0x84')],{'as':_0x6987('0x155'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0x6987('0x106')](db[_0x6987('0x82')],{'as':'Answers','foreignKey':_0x6987('0x175')});db[_0x6987('0x53')][_0x6987('0x106')](db['SmsMessage'],{'as':_0x6987('0x14a'),'foreignKey':_0x6987('0x175')});db[_0x6987('0x53')][_0x6987('0x106')](db['SmsInteraction'],{'as':_0x6987('0x16d')});db['SmsAccount'][_0x6987('0x106')](db[_0x6987('0x55')],{'as':_0x6987('0x158')});db[_0x6987('0x53')][_0x6987('0x116')](db[_0x6987('0xf0')],{'as':_0x6987('0x159'),'foreignKey':'ListId'});db['SmsAccount'][_0x6987('0x116')](db[_0x6987('0x88')],{'as':_0x6987('0x15c'),'foreignKey':_0x6987('0x144')});db[_0x6987('0x53')]['belongsToMany'](db['User'],{'as':'Agents','through':'user_has_sms_accounts'});db['SmsApplication'][_0x6987('0x116')](db['User'],{'onDelete':_0x6987('0x16a')});db[_0x6987('0x55')]['belongsTo'](db['SmsQueue'],{'onDelete':'restrict'});db[_0x6987('0x55')][_0x6987('0x116')](db[_0x6987('0x53')],{'onDelete':_0x6987('0x16a')});db['SmsApplication'][_0x6987('0x116')](db[_0x6987('0x86')],{'onDelete':_0x6987('0x16a'),'foreignKey':_0x6987('0x143')});db[_0x6987('0x55')][_0x6987('0x116')](db[_0x6987('0x8d')],{'onDelete':_0x6987('0x16a'),'foreignKey':_0x6987('0x16b')});db[_0x6987('0x56')][_0x6987('0x106')](db['SmsMessage'],{'as':_0x6987('0x14a'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x176')});db['SmsInteraction'][_0x6987('0x116')](db[_0x6987('0x53')],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x175')});db[_0x6987('0x56')][_0x6987('0x116')](db[_0x6987('0x11b')],{'as':_0x6987('0x150'),'foreignKey':_0x6987('0x151')});db[_0x6987('0x56')]['belongsTo'](db[_0x6987('0x13')],{'as':_0x6987('0x15f'),'foreignKey':_0x6987('0x105')});db[_0x6987('0x56')][_0x6987('0x118')](db['Tag'],{'through':_0x6987('0x177'),'as':_0x6987('0x161')});db[_0x6987('0x56')][_0x6987('0x118')](db['Tag'],{'through':_0x6987('0x177'),'as':_0x6987('0x162')});db[_0x6987('0x56')][_0x6987('0x118')](db['User'],{'as':_0x6987('0x163'),'through':_0x6987('0x122'),'foreignKey':_0x6987('0x176')});db[_0x6987('0x57')][_0x6987('0x116')](db['User'],{'as':_0x6987('0x13')});db[_0x6987('0x57')][_0x6987('0x116')](db[_0x6987('0x11b')],{'onDelete':_0x6987('0x10c'),'as':_0x6987('0x150')});db['SmsMessage'][_0x6987('0x116')](db[_0x6987('0x56')],{'onDelete':_0x6987('0x10c'),'as':_0x6987('0x167'),'foreignKey':_0x6987('0x176')});db[_0x6987('0x57')][_0x6987('0x116')](db['SmsAccount'],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x175')});db[_0x6987('0x59')][_0x6987('0x118')](db[_0x6987('0x13')],{'as':_0x6987('0x146'),'through':_0x6987('0x37'),'foreignKey':_0x6987('0x178')});db[_0x6987('0x59')][_0x6987('0x118')](db[_0x6987('0xe3')],{'through':_0x6987('0x179'),'as':_0x6987('0x147')});db[_0x6987('0x5b')][_0x6987('0x106')](db[_0x6987('0x84')],{'as':_0x6987('0x155'),'foreignKey':_0x6987('0x17a')});db['OpenchannelAccount'][_0x6987('0x106')](db[_0x6987('0x82')],{'as':_0x6987('0x156'),'foreignKey':'OpenchannelAccountId'});db[_0x6987('0x5b')][_0x6987('0x106')](db['OpenchannelInteraction'],{'as':_0x6987('0x16d'),'foreignKey':_0x6987('0x17a')});db[_0x6987('0x5b')][_0x6987('0x106')](db[_0x6987('0x17b')],{'as':'Messages','foreignKey':_0x6987('0x17a')});db[_0x6987('0x5b')][_0x6987('0x106')](db[_0x6987('0x5d')],{'as':_0x6987('0x158'),'foreignKey':_0x6987('0x17a')});db['OpenchannelAccount'][_0x6987('0x116')](db['CmList'],{'as':_0x6987('0x159'),'foreignKey':'ListId'});db[_0x6987('0x5b')][_0x6987('0x116')](db[_0x6987('0x88')],{'as':_0x6987('0x15c'),'foreignKey':_0x6987('0x144')});db[_0x6987('0x5b')][_0x6987('0x118')](db['User'],{'as':'Agents','through':_0x6987('0x132')});db[_0x6987('0x5d')][_0x6987('0x116')](db[_0x6987('0x13')],{'onDelete':'restrict'});db['OpenchannelApplication']['belongsTo'](db[_0x6987('0x62')],{'onDelete':'restrict','foreignKey':_0x6987('0x17c')});db['OpenchannelApplication']['belongsTo'](db['OpenchannelAccount'],{'onDelete':_0x6987('0x16a'),'foreignKey':_0x6987('0x17a')});db[_0x6987('0x5d')]['belongsTo'](db[_0x6987('0x86')],{'onDelete':'restrict','foreignKey':'IntervalId'});db['OpenchannelApplication'][_0x6987('0x116')](db[_0x6987('0x8d')],{'onDelete':'restrict','foreignKey':'TagId'});db['OpenchannelInteraction'][_0x6987('0x106')](db['OpenchannelMessage'],{'as':'Messages','onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x17d')});db[_0x6987('0x5f')][_0x6987('0x116')](db[_0x6987('0x5b')],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x17a')});db[_0x6987('0x5f')][_0x6987('0x116')](db[_0x6987('0x11b')],{'as':_0x6987('0x150'),'foreignKey':_0x6987('0x151')});db[_0x6987('0x5f')][_0x6987('0x116')](db['User'],{'as':_0x6987('0x15f'),'foreignKey':'UserId'});db[_0x6987('0x5f')]['belongsToMany'](db[_0x6987('0x8d')],{'through':_0x6987('0x17e'),'as':_0x6987('0x161')});db[_0x6987('0x5f')]['belongsToMany'](db['Tag'],{'through':_0x6987('0x17e'),'as':_0x6987('0x162')});db[_0x6987('0x5f')]['belongsToMany'](db['User'],{'as':_0x6987('0x163'),'through':_0x6987('0x17f'),'foreignKey':_0x6987('0x17d')});db[_0x6987('0x17b')][_0x6987('0x116')](db[_0x6987('0x13')],{'onDelete':_0x6987('0x10c'),'as':_0x6987('0x13')});db[_0x6987('0x17b')][_0x6987('0x116')](db[_0x6987('0x11b')],{'onDelete':_0x6987('0x10c'),'as':_0x6987('0x150')});db[_0x6987('0x17b')]['belongsTo'](db['OpenchannelInteraction'],{'onDelete':_0x6987('0x10c'),'as':'Interaction','foreignKey':_0x6987('0x17d')});db['OpenchannelMessage'][_0x6987('0x116')](db[_0x6987('0x165')],{'as':_0x6987('0x165'),'foreignKey':'AttachmentId'});db['OpenchannelMessage']['belongsTo'](db[_0x6987('0x5b')],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x17a')});db[_0x6987('0x62')]['belongsToMany'](db[_0x6987('0x13')],{'as':_0x6987('0x146'),'through':_0x6987('0x39'),'foreignKey':'OpenchannelQueueId'});db[_0x6987('0x62')]['belongsToMany'](db[_0x6987('0xe3')],{'through':_0x6987('0x180'),'as':'Teams'});db[_0x6987('0x64')][_0x6987('0x106')](db[_0x6987('0x84')],{'as':_0x6987('0x155'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite'][_0x6987('0x106')](db[_0x6987('0x82')],{'as':_0x6987('0x156'),'foreignKey':_0x6987('0x168')});db['ChatWebsite']['hasMany'](db[_0x6987('0x71')],{'as':_0x6987('0x181')});db[_0x6987('0x64')][_0x6987('0x106')](db['ChatInteraction'],{'as':_0x6987('0x16d')});db[_0x6987('0x64')][_0x6987('0x106')](db[_0x6987('0x67')],{'as':_0x6987('0x158')});db[_0x6987('0x64')][_0x6987('0x106')](db['ChatMessage'],{'as':_0x6987('0x14a')});db[_0x6987('0x64')]['belongsTo'](db[_0x6987('0xf0')],{'as':_0x6987('0x159'),'foreignKey':'ListId'});db[_0x6987('0x64')]['belongsTo'](db['Interval'],{'as':_0x6987('0x86'),'foreignKey':_0x6987('0x143')});db[_0x6987('0x64')][_0x6987('0x116')](db['MailAccount'],{'as':_0x6987('0x130'),'foreignKey':_0x6987('0x152')});db[_0x6987('0x64')]['belongsTo'](db[_0x6987('0x88')],{'as':'mandatoryDispositionPause','foreignKey':_0x6987('0x144')});db[_0x6987('0x64')][_0x6987('0x118')](db[_0x6987('0x13')],{'as':'Agents','through':'user_has_chat_websites'});db[_0x6987('0x66')][_0x6987('0x116')](db['OpenchannelAccount'],{});db[_0x6987('0x66')]['belongsTo'](db['CmList'],{'as':_0x6987('0x159'),'foreignKey':_0x6987('0x15a')});db[_0x6987('0x66')][_0x6987('0x116')](db[_0x6987('0x11b')],{'as':'Contact','foreignKey':_0x6987('0x151')});db['OpenchannelQueueReport']['belongsTo'](db[_0x6987('0x5f')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x6987('0x17b')],{});db[_0x6987('0x66')][_0x6987('0x116')](db[_0x6987('0x13')],{});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelQueue'],{});db[_0x6987('0x67')][_0x6987('0x116')](db[_0x6987('0x13')],{'as':_0x6987('0x182'),'foreignKey':'UserId','onDelete':_0x6987('0x16a')});db[_0x6987('0x67')][_0x6987('0x116')](db[_0x6987('0x6e')],{'as':_0x6987('0x183'),'foreignKey':_0x6987('0x184'),'onDelete':_0x6987('0x16a')});db[_0x6987('0x67')][_0x6987('0x116')](db[_0x6987('0x64')],{'as':_0x6987('0x185'),'foreignKey':_0x6987('0x168'),'onDelete':'restrict'});db[_0x6987('0x67')][_0x6987('0x116')](db[_0x6987('0x8d')],{'onDelete':_0x6987('0x16a'),'foreignKey':_0x6987('0x16b')});db['ChatInteraction'][_0x6987('0x106')](db[_0x6987('0x186')],{'as':'Messages','onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x187')});db[_0x6987('0x69')][_0x6987('0x116')](db[_0x6987('0x64')],{'as':_0x6987('0x15e'),'foreignKey':'ChatWebsiteId'});db['ChatInteraction'][_0x6987('0x116')](db['CmContact'],{'as':_0x6987('0x150'),'foreignKey':_0x6987('0x151')});db[_0x6987('0x69')][_0x6987('0x116')](db[_0x6987('0x13')],{'as':'Owner','foreignKey':'UserId'});db[_0x6987('0x69')][_0x6987('0x118')](db[_0x6987('0x8d')],{'through':_0x6987('0x188'),'as':_0x6987('0x161')});db[_0x6987('0x69')][_0x6987('0x118')](db[_0x6987('0x8d')],{'through':_0x6987('0x188'),'as':_0x6987('0x162')});db[_0x6987('0x69')][_0x6987('0x118')](db[_0x6987('0x13')],{'as':_0x6987('0x163'),'through':_0x6987('0x120'),'foreignKey':_0x6987('0x187')});db[_0x6987('0x186')]['belongsTo'](db[_0x6987('0x13')],{'onDelete':_0x6987('0x10c'),'as':_0x6987('0x13')});db[_0x6987('0x186')][_0x6987('0x116')](db[_0x6987('0x11b')],{'onDelete':_0x6987('0x10c'),'as':_0x6987('0x150'),'foreignKey':_0x6987('0x151')});db['ChatMessage'][_0x6987('0x116')](db[_0x6987('0x69')],{'onDelete':'cascade','as':_0x6987('0x167'),'foreignKey':_0x6987('0x187')});db[_0x6987('0x186')][_0x6987('0x116')](db[_0x6987('0x165')],{'as':_0x6987('0x165'),'foreignKey':'AttachmentId'});db['ChatMessage'][_0x6987('0x116')](db[_0x6987('0x64')],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x168')});db[_0x6987('0x6c')]['belongsTo'](db[_0x6987('0x11b')],{'onDelete':_0x6987('0x10c'),'as':'Contact','foreignKey':_0x6987('0x151')});db[_0x6987('0x6c')][_0x6987('0x116')](db[_0x6987('0x64')],{'as':_0x6987('0x15e'),'foreignKey':'ChatWebsiteId'});db[_0x6987('0x6e')][_0x6987('0x118')](db[_0x6987('0x13')],{'as':'Agents','through':_0x6987('0x31'),'hooks':!![]});db['ChatQueue']['belongsToMany'](db[_0x6987('0xe3')],{'through':'team_has_chat_queues','as':_0x6987('0x147')});db['ChatGroup'][_0x6987('0x106')](db[_0x6987('0xd1')],{'as':_0x6987('0x14a'),'foreignKey':_0x6987('0x189'),'onDelete':'cascade'});db['ChatGroup'][_0x6987('0x118')](db[_0x6987('0x13')],{'as':_0x6987('0x13b'),'through':_0x6987('0x11a')});db[_0x6987('0x71')]['belongsTo'](db[_0x6987('0x64')],{'as':_0x6987('0x185'),'foreignKey':_0x6987('0x168')});db[_0x6987('0x73')][_0x6987('0x106')](db[_0x6987('0x11b')],{'as':_0x6987('0x18a'),'foreignKey':_0x6987('0x18b')});db['CmContact'][_0x6987('0x106')](db[_0x6987('0x75')],{'as':_0x6987('0x13d'),'foreignKey':_0x6987('0x151')});db['CmContact']['hasMany'](db[_0x6987('0x77')],{'as':_0x6987('0x10d'),'foreignKey':_0x6987('0x151')});db[_0x6987('0x11b')][_0x6987('0x106')](db[_0x6987('0x79')],{'as':_0x6987('0x13e'),'foreignKey':_0x6987('0x151')});db[_0x6987('0x11b')]['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'ContactId'});db[_0x6987('0x11b')][_0x6987('0x106')](db[_0x6987('0xd6')],{'as':_0x6987('0x140'),'foreignKey':_0x6987('0x151')});db[_0x6987('0x11b')]['hasMany'](db[_0x6987('0x5f')],{'as':_0x6987('0x10e'),'foreignKey':_0x6987('0x151'),'onDelete':_0x6987('0x16a')});db['CmContact'][_0x6987('0x106')](db[_0x6987('0x69')],{'as':_0x6987('0x18c'),'foreignKey':'ContactId','onDelete':_0x6987('0x16a')});db[_0x6987('0x11b')][_0x6987('0x106')](db[_0x6987('0x56')],{'as':_0x6987('0x10f'),'foreignKey':_0x6987('0x151'),'onDelete':_0x6987('0x16a')});db[_0x6987('0x11b')]['hasMany'](db['FaxInteraction'],{'as':'FaxInteractions','foreignKey':_0x6987('0x151'),'onDelete':_0x6987('0x16a')});db[_0x6987('0x11b')][_0x6987('0x106')](db[_0x6987('0x43')],{'as':_0x6987('0x111'),'foreignKey':_0x6987('0x151'),'onDelete':_0x6987('0x16a')});db[_0x6987('0x11b')][_0x6987('0x116')](db[_0x6987('0x73')],{'as':_0x6987('0x18d'),'foreignKey':_0x6987('0x18b')});db[_0x6987('0x11b')][_0x6987('0x116')](db[_0x6987('0xf0')],{'as':_0x6987('0x159'),'foreignKey':_0x6987('0x15a'),'onDelete':_0x6987('0x10c')});db[_0x6987('0x11b')][_0x6987('0x118')](db['User'],{'as':_0x6987('0x163'),'through':'cm_user_has_contacts'});db[_0x6987('0x11b')][_0x6987('0x118')](db[_0x6987('0x8d')],{'as':_0x6987('0x161'),'through':_0x6987('0x18e')});db['CmContact'][_0x6987('0x118')](db['Tag'],{'through':_0x6987('0x18e'),'as':_0x6987('0x162')});db[_0x6987('0x75')][_0x6987('0x116')](db[_0x6987('0x11b')],{'as':_0x6987('0x150'),'foreignKey':_0x6987('0x151'),'onDelete':_0x6987('0x10c')});db['CmHopper'][_0x6987('0x116')](db['CmList'],{'as':_0x6987('0x159'),'foreignKey':_0x6987('0x15a'),'onDelete':'cascade'});db[_0x6987('0x75')][_0x6987('0x116')](db[_0x6987('0x13')],{'as':_0x6987('0x182'),'foreignKey':'UserId'});db[_0x6987('0x75')][_0x6987('0x116')](db[_0x6987('0x13a')],{'as':_0x6987('0x183'),'foreignKey':_0x6987('0x13c'),'onDelete':'cascade'});db['CmHopper'][_0x6987('0x116')](db[_0x6987('0xe6')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':'cascade'});db[_0x6987('0x75')][_0x6987('0x116')](db[_0x6987('0x13')],{'as':_0x6987('0x15f'),'foreignKey':'OwnerId'});db[_0x6987('0x76')][_0x6987('0x116')](db[_0x6987('0x11b')],{'as':_0x6987('0x150'),'foreignKey':_0x6987('0x151'),'onDelete':_0x6987('0x10c')});db[_0x6987('0x76')][_0x6987('0x116')](db[_0x6987('0xf0')],{'as':_0x6987('0x159'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x6987('0x76')][_0x6987('0x116')](db['VoiceQueue'],{'as':_0x6987('0x183'),'foreignKey':_0x6987('0x13c'),'onDelete':_0x6987('0x10c')});db[_0x6987('0x76')]['belongsTo'](db['Campaign'],{'as':'Campaign','foreignKey':_0x6987('0x18f'),'onDelete':_0x6987('0x10c')});db[_0x6987('0x81')][_0x6987('0x106')](db['Condition'],{'as':{'plural':_0x6987('0x190'),'singular':_0x6987('0x191')},'foreignKey':_0x6987('0x192'),'onDelete':_0x6987('0x10c'),'hooks':!![]});db['Automation'][_0x6987('0x106')](db['Condition'],{'as':{'plural':_0x6987('0x193'),'singular':_0x6987('0x194')},'foreignKey':_0x6987('0x195'),'onDelete':_0x6987('0x10c'),'hooks':!![]});db['Automation'][_0x6987('0x106')](db[_0x6987('0x7f')],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0x6987('0x10c'),'hooks':!![]});db[_0x6987('0x84')][_0x6987('0x106')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x6987('0x196'),'onDelete':_0x6987('0x10c')});db['Interval'][_0x6987('0x106')](db[_0x6987('0x86')],{'as':_0x6987('0x197'),'foreignKey':_0x6987('0x143'),'onDelete':_0x6987('0x10c'),'hooks':!![],'required':![]});db[_0x6987('0x86')]['hasMany'](db[_0x6987('0x10a')],{'as':'Extensions','foreignKey':_0x6987('0x143'),'onDelete':'restrict'});db[_0x6987('0x86')][_0x6987('0x106')](db[_0x6987('0x157')],{'as':_0x6987('0x198'),'foreignKey':_0x6987('0x143')});db[_0x6987('0x86')][_0x6987('0x106')](db['ChatApplication'],{'as':_0x6987('0x199'),'foreignKey':_0x6987('0x143')});db[_0x6987('0x86')][_0x6987('0x106')](db[_0x6987('0x4d')],{'as':_0x6987('0x19a'),'foreignKey':_0x6987('0x143')});db[_0x6987('0x86')][_0x6987('0x106')](db[_0x6987('0x55')],{'as':'SmsApplications','foreignKey':_0x6987('0x143')});db[_0x6987('0x8b')]['belongsTo'](db['MailAccount'],{});db[_0x6987('0x8b')][_0x6987('0x116')](db['AnalyticDefaultReport'],{'foreignKey':_0x6987('0x19b')});db[_0x6987('0x8b')]['belongsTo'](db[_0x6987('0x97')],{'foreignKey':_0x6987('0x19c')});db['Sound'][_0x6987('0x118')](db[_0x6987('0x1a')],{'as':_0x6987('0x19d'),'through':_0x6987('0x19e'),'onDelete':_0x6987('0x16a')});db[_0x6987('0x8d')][_0x6987('0x118')](db[_0x6987('0x11b')],{'through':_0x6987('0x18e')});db[_0x6987('0x8d')][_0x6987('0x118')](db[_0x6987('0x69')],{'through':_0x6987('0x188')});db[_0x6987('0x8d')][_0x6987('0x118')](db[_0x6987('0x43')],{'through':_0x6987('0x160')});db[_0x6987('0x8d')]['belongsToMany'](db['SmsInteraction'],{'through':_0x6987('0x177')});db['Tag'][_0x6987('0x118')](db[_0x6987('0x4f')],{'through':_0x6987('0x172')});db['Tag'][_0x6987('0x118')](db[_0x6987('0x5f')],{'through':_0x6987('0x17e')});db['Tag'][_0x6987('0x118')](db['WhatsappInteraction'],{'through':_0x6987('0x19f')});db['Trigger']['hasMany'](db[_0x6987('0x85')],{'as':{'plural':'AllConditions','singular':_0x6987('0x1a0')},'foreignKey':_0x6987('0x1a1'),'onDelete':_0x6987('0x10c'),'hooks':!![]});db[_0x6987('0x91')][_0x6987('0x106')](db[_0x6987('0x85')],{'as':{'plural':'AnyConditions','singular':_0x6987('0x1a2')},'foreignKey':'TriggerAnyId','onDelete':_0x6987('0x10c'),'hooks':!![]});db[_0x6987('0x91')][_0x6987('0x106')](db[_0x6987('0x7f')],{'as':_0x6987('0x1a3'),'foreignKey':_0x6987('0x1a4'),'onDelete':_0x6987('0x10c'),'hooks':!![]});db[_0x6987('0x97')][_0x6987('0x106')](db[_0x6987('0x9f')],{'as':_0x6987('0x1a5'),'onDelete':'cascade','foreignKey':_0x6987('0x19c'),'hooks':!![]});db[_0x6987('0x99')]['hasMany'](db[_0x6987('0x9f')],{'as':_0x6987('0x1a5'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x19b')});db[_0x6987('0x9d')]['hasMany'](db[_0x6987('0x9f')],{'as':_0x6987('0x1a5'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1a6')});db[_0x6987('0x9f')]['belongsTo'](db[_0x6987('0x9d')],{'foreignKey':'MetricId'});db[_0x6987('0xa1')][_0x6987('0x106')](db[_0x6987('0x1a7')],{'as':_0x6987('0x1a8'),'onDelete':_0x6987('0x10c'),'foreignKey':'AccountId'});db[_0x6987('0x1a7')][_0x6987('0x106')](db['SalesforceField'],{'as':_0x6987('0x1a9'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0x1a7')][_0x6987('0x106')](db['SalesforceField'],{'as':_0x6987('0x1ab'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1ac')});db[_0x6987('0x1a7')][_0x6987('0x106')](db[_0x6987('0xa4')],{'as':'Fields','onDelete':_0x6987('0x10c'),'foreignKey':'FieldId'});db['SalesforceConfiguration']['belongsTo'](db[_0x6987('0xa1')],{'as':'Account','foreignKey':_0x6987('0x1ad')});db['SalesforceField'][_0x6987('0x106')](db[_0x6987('0xa4')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x6987('0xa4')]['hasMany'](db['SalesforceField'],{'as':_0x6987('0x1ae'),'foreignKey':_0x6987('0x1ac')});db[_0x6987('0xa4')][_0x6987('0x106')](db[_0x6987('0xa4')],{'as':_0x6987('0x1af'),'foreignKey':_0x6987('0x1b0')});db[_0x6987('0xa4')][_0x6987('0x116')](db[_0x6987('0x1b1')],{'as':'Variable','foreignKey':_0x6987('0x1b2')});db[_0x6987('0xa5')][_0x6987('0x106')](db[_0x6987('0x1b3')],{'as':_0x6987('0x1a8'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1ad')});db[_0x6987('0x1b3')][_0x6987('0x106')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0x1b3')]['hasMany'](db[_0x6987('0xa8')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x6987('0x1ac')});db[_0x6987('0x1b3')]['hasMany'](db['SugarcrmField'],{'as':'Fields','onDelete':_0x6987('0x10c'),'foreignKey':'FieldId'});db[_0x6987('0x1b3')][_0x6987('0x116')](db[_0x6987('0xa5')],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x1ad')});db[_0x6987('0xa8')][_0x6987('0x106')](db[_0x6987('0xa8')],{'as':_0x6987('0x1b4'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0xa8')][_0x6987('0x106')](db['SugarcrmField'],{'as':_0x6987('0x1ae'),'foreignKey':_0x6987('0x1ac')});db[_0x6987('0xa8')][_0x6987('0x106')](db['SugarcrmField'],{'as':_0x6987('0x1af'),'foreignKey':_0x6987('0x1b0')});db[_0x6987('0xa8')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0x6987('0x1b2')});db[_0x6987('0xaa')]['hasMany'](db[_0x6987('0xac')],{'as':_0x6987('0x1a8'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1ad')});db[_0x6987('0xac')]['hasMany'](db['DeskField'],{'as':_0x6987('0x1a9'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0xac')][_0x6987('0x106')](db[_0x6987('0xad')],{'as':_0x6987('0x1ab'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x6987('0xac')]['hasMany'](db[_0x6987('0xad')],{'as':_0x6987('0x1a5'),'onDelete':'cascade','foreignKey':_0x6987('0x1b0')});db[_0x6987('0xac')][_0x6987('0x116')](db[_0x6987('0xaa')],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x1ad')});db['DeskConfiguration'][_0x6987('0x118')](db[_0x6987('0x8d')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x6987('0x106')](db[_0x6987('0xad')],{'as':_0x6987('0x1b4'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0xad')][_0x6987('0x106')](db[_0x6987('0xad')],{'as':_0x6987('0x1ae'),'foreignKey':_0x6987('0x1ac')});db[_0x6987('0xad')][_0x6987('0x106')](db[_0x6987('0xad')],{'as':'Field','foreignKey':_0x6987('0x1b0')});db[_0x6987('0xad')]['belongsTo'](db[_0x6987('0x1b1')],{'as':_0x6987('0x1b1'),'foreignKey':_0x6987('0x1b2')});db[_0x6987('0x1b5')][_0x6987('0x106')](db[_0x6987('0xaf')],{'as':_0x6987('0x1a8'),'onDelete':'cascade','foreignKey':_0x6987('0x1ad')});db[_0x6987('0xaf')][_0x6987('0x106')](db[_0x6987('0x1b6')],{'as':_0x6987('0x1a9'),'onDelete':'cascade','foreignKey':_0x6987('0x1aa')});db[_0x6987('0xaf')]['hasMany'](db[_0x6987('0x1b6')],{'as':_0x6987('0x1ab'),'onDelete':'cascade','foreignKey':_0x6987('0x1ac')});db[_0x6987('0xaf')][_0x6987('0x106')](db['ZohoField'],{'as':_0x6987('0x1a5'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1b0')});db[_0x6987('0xaf')][_0x6987('0x116')](db['ZohoAccount'],{'as':_0x6987('0x15e'),'foreignKey':'AccountId'});db[_0x6987('0x1b6')][_0x6987('0x106')](db['ZohoField'],{'as':_0x6987('0x1b4'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0x1b6')][_0x6987('0x106')](db[_0x6987('0x1b6')],{'as':_0x6987('0x1ae'),'foreignKey':'DescriptionId'});db[_0x6987('0x1b6')][_0x6987('0x106')](db[_0x6987('0x1b6')],{'as':'Field','foreignKey':_0x6987('0x1b0')});db[_0x6987('0x1b6')][_0x6987('0x116')](db[_0x6987('0x1b1')],{'as':'Variable','foreignKey':_0x6987('0x1b2')});db[_0x6987('0xb1')]['hasMany'](db[_0x6987('0xb3')],{'as':'Configurations','onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1ad')});db[_0x6987('0xb3')][_0x6987('0x106')](db['ZendeskField'],{'as':'Subjects','foreignKey':_0x6987('0x1aa')});db[_0x6987('0xb3')][_0x6987('0x106')](db[_0x6987('0xb5')],{'as':_0x6987('0x1ab'),'foreignKey':_0x6987('0x1ac')});db[_0x6987('0xb3')][_0x6987('0x106')](db[_0x6987('0xb5')],{'as':_0x6987('0x1a5'),'foreignKey':'FieldId'});db['ZendeskConfiguration'][_0x6987('0x116')](db['ZendeskAccount'],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x1ad')});db[_0x6987('0xb3')]['belongsToMany'](db[_0x6987('0x8d')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0x6987('0x106')](db[_0x6987('0xb5')],{'as':'Subject','foreignKey':_0x6987('0x1aa')});db[_0x6987('0xb5')]['hasMany'](db[_0x6987('0xb5')],{'as':_0x6987('0x1ae'),'foreignKey':_0x6987('0x1ac')});db[_0x6987('0xb5')][_0x6987('0x106')](db[_0x6987('0xb5')],{'as':_0x6987('0x1af'),'foreignKey':_0x6987('0x1b0')});db[_0x6987('0xb5')][_0x6987('0x116')](db[_0x6987('0x1b1')],{'as':_0x6987('0x1b1'),'foreignKey':_0x6987('0x1b2')});db[_0x6987('0x1b7')][_0x6987('0x106')](db['FreshdeskConfiguration'],{'as':_0x6987('0x1a8'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1ad')});db[_0x6987('0x1b8')][_0x6987('0x106')](db[_0x6987('0xb8')],{'as':_0x6987('0x1a9'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0x1b8')][_0x6987('0x106')](db[_0x6987('0xb8')],{'as':_0x6987('0x1ab'),'onDelete':_0x6987('0x10c'),'foreignKey':'DescriptionId'});db['FreshdeskConfiguration'][_0x6987('0x106')](db['FreshdeskField'],{'as':_0x6987('0x1a5'),'onDelete':'cascade','foreignKey':'FieldId'});db['FreshdeskConfiguration'][_0x6987('0x116')](db[_0x6987('0x1b7')],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x1ad')});db['FreshdeskConfiguration'][_0x6987('0x118')](db[_0x6987('0x8d')],{'through':'int_freshdesk_configuration_has_tags'});db[_0x6987('0xb8')][_0x6987('0x106')](db[_0x6987('0xb8')],{'as':'Subject','foreignKey':_0x6987('0x1aa')});db[_0x6987('0xb8')]['hasMany'](db[_0x6987('0xb8')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x6987('0xb8')]['hasMany'](db[_0x6987('0xb8')],{'as':_0x6987('0x1af'),'foreignKey':_0x6987('0x1b0')});db[_0x6987('0xb8')]['belongsTo'](db[_0x6987('0x1b1')],{'as':_0x6987('0x1b1'),'foreignKey':'VariableId'});db['VtigerAccount'][_0x6987('0x106')](db[_0x6987('0xbc')],{'as':_0x6987('0x1a8'),'onDelete':'cascade','foreignKey':_0x6987('0x1ad')});db[_0x6987('0xbc')]['hasMany'](db[_0x6987('0xbe')],{'as':_0x6987('0x1a9'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0xbc')][_0x6987('0x106')](db['VtigerField'],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x6987('0xbc')][_0x6987('0x106')](db[_0x6987('0xbe')],{'as':'Fields','foreignKey':_0x6987('0x1b0')});db[_0x6987('0xbc')][_0x6987('0x116')](db[_0x6987('0xba')],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x1ad')});db[_0x6987('0xbe')][_0x6987('0x106')](db[_0x6987('0xbe')],{'as':_0x6987('0x1b4'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0xbe')][_0x6987('0x106')](db[_0x6987('0xbe')],{'as':'Description','foreignKey':'DescriptionId'});db['VtigerField'][_0x6987('0x106')](db[_0x6987('0xbe')],{'as':_0x6987('0x1af'),'foreignKey':_0x6987('0x1b0')});db[_0x6987('0xbe')]['belongsTo'](db[_0x6987('0x1b1')],{'as':_0x6987('0x1b1'),'foreignKey':_0x6987('0x1b2')});db[_0x6987('0xc0')][_0x6987('0x106')](db[_0x6987('0xc2')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db[_0x6987('0xc2')][_0x6987('0x106')](db[_0x6987('0x1b9')],{'as':_0x6987('0x1a9'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0xc2')][_0x6987('0x106')](db[_0x6987('0x1b9')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x6987('0xc2')][_0x6987('0x106')](db[_0x6987('0x1b9')],{'as':_0x6987('0x1a5'),'foreignKey':_0x6987('0x1b0')});db[_0x6987('0xc2')][_0x6987('0x116')](db[_0x6987('0xc0')],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x1ad')});db[_0x6987('0x1b9')][_0x6987('0x106')](db[_0x6987('0x1b9')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x6987('0x1b9')][_0x6987('0x106')](db[_0x6987('0x1b9')],{'as':_0x6987('0x1ae'),'foreignKey':_0x6987('0x1ac')});db[_0x6987('0x1b9')][_0x6987('0x106')](db[_0x6987('0x1b9')],{'as':_0x6987('0x1af'),'foreignKey':_0x6987('0x1b0')});db[_0x6987('0x1b9')][_0x6987('0x116')](db[_0x6987('0x1b1')],{'as':_0x6987('0x1b1'),'foreignKey':_0x6987('0x1b2')});db['Dynamics365Account'][_0x6987('0x106')](db[_0x6987('0xc5')],{'as':_0x6987('0x1a8'),'onDelete':'cascade','foreignKey':_0x6987('0x1ad')});db[_0x6987('0xc5')][_0x6987('0x106')](db['Dynamics365Field'],{'as':_0x6987('0x1a9'),'onDelete':_0x6987('0x10c'),'foreignKey':'SubjectId'});db[_0x6987('0xc5')][_0x6987('0x106')](db[_0x6987('0xc7')],{'as':'Descriptions','onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1ac')});db[_0x6987('0xc5')][_0x6987('0x106')](db[_0x6987('0xc7')],{'as':_0x6987('0x1a5'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1b0')});db['Dynamics365Configuration'][_0x6987('0x116')](db[_0x6987('0x1ba')],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x1ad')});db[_0x6987('0xc7')][_0x6987('0x106')](db['Dynamics365Field'],{'as':_0x6987('0x1b4'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0xc7')][_0x6987('0x106')](db[_0x6987('0xc7')],{'as':'Description','foreignKey':_0x6987('0x1ac')});db[_0x6987('0xc7')]['hasMany'](db['Dynamics365Field'],{'as':_0x6987('0x1af'),'foreignKey':'FieldId'});db['Dynamics365Field'][_0x6987('0x116')](db[_0x6987('0x1b1')],{'as':_0x6987('0x1b1'),'foreignKey':'VariableId'});db[_0x6987('0xc9')][_0x6987('0x106')](db[_0x6987('0xcb')],{'as':_0x6987('0x1a8'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1ad')});db[_0x6987('0xcb')]['hasMany'](db[_0x6987('0x1bb')],{'as':_0x6987('0x1a9'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0xcb')][_0x6987('0x106')](db[_0x6987('0x1bb')],{'as':_0x6987('0x1ab'),'foreignKey':_0x6987('0x1ac')});db['FreshsalesConfiguration'][_0x6987('0x106')](db[_0x6987('0x1bb')],{'as':'Fields','foreignKey':_0x6987('0x1b0')});db[_0x6987('0xcb')][_0x6987('0x116')](db[_0x6987('0xc9')],{'as':_0x6987('0x15e'),'foreignKey':'AccountId'});db[_0x6987('0x1bb')][_0x6987('0x106')](db[_0x6987('0x1bb')],{'as':_0x6987('0x1b4'),'foreignKey':_0x6987('0x1aa')});db[_0x6987('0x1bb')][_0x6987('0x106')](db[_0x6987('0x1bb')],{'as':_0x6987('0x1ae'),'foreignKey':_0x6987('0x1ac')});db[_0x6987('0x1bb')][_0x6987('0x106')](db[_0x6987('0x1bb')],{'as':_0x6987('0x1af'),'foreignKey':'FieldId'});db[_0x6987('0x1bb')]['belongsTo'](db[_0x6987('0x1b1')],{'as':_0x6987('0x1b1'),'foreignKey':_0x6987('0x1b2')});db[_0x6987('0xd0')]['belongsTo'](db['ChatWebsite'],{});db[_0x6987('0xd0')][_0x6987('0x116')](db[_0x6987('0xf0')],{'as':'List','foreignKey':_0x6987('0x15a')});db[_0x6987('0xd0')][_0x6987('0x116')](db[_0x6987('0x11b')],{'as':_0x6987('0x150'),'foreignKey':_0x6987('0x151')});db[_0x6987('0xd0')][_0x6987('0x116')](db['ChatInteraction'],{});db['ChatQueueReport'][_0x6987('0x116')](db[_0x6987('0x186')],{});db[_0x6987('0xd0')]['belongsTo'](db['User'],{});db['ChatQueueReport'][_0x6987('0x116')](db[_0x6987('0x6e')],{});db['ChatInternalMessage'][_0x6987('0x116')](db['User'],{'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1bc')});db[_0x6987('0xd1')][_0x6987('0x116')](db[_0x6987('0x13')],{'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x1bd')});db['JscriptySessionReport']['hasMany'](db[_0x6987('0x1be')],{'foreignKey':_0x6987('0x1bf'),'onDelete':_0x6987('0x10c')});db[_0x6987('0xd6')][_0x6987('0x106')](db[_0x6987('0xd3')],{'foreignKey':'SessionId','onDelete':_0x6987('0x10c')});db[_0x6987('0x1c0')][_0x6987('0x116')](db[_0x6987('0x53')],{});db['SmsQueueReport'][_0x6987('0x116')](db['CmList'],{'as':_0x6987('0x159'),'foreignKey':_0x6987('0x15a')});db[_0x6987('0x1c0')][_0x6987('0x116')](db['CmContact'],{'as':_0x6987('0x150'),'foreignKey':'ContactId'});db[_0x6987('0x1c0')][_0x6987('0x116')](db[_0x6987('0x56')],{});db[_0x6987('0x1c0')][_0x6987('0x116')](db[_0x6987('0x57')],{});db[_0x6987('0x1c0')][_0x6987('0x116')](db[_0x6987('0x13')],{});db[_0x6987('0x1c0')][_0x6987('0x116')](db[_0x6987('0x59')],{});db['JscriptyProject'][_0x6987('0x106')](db[_0x6987('0xd6')],{'foreignKey':_0x6987('0x1c1')});db[_0x6987('0x1c2')][_0x6987('0x106')](db['JscriptyQuestionReport'],{'foreignKey':_0x6987('0x1c1')});db['JscriptyProject'][_0x6987('0x106')](db[_0x6987('0xd3')],{'foreignKey':_0x6987('0x1c1')});db[_0x6987('0xde')][_0x6987('0x118')](db[_0x6987('0x13')],{'as':_0x6987('0x163'),'through':_0x6987('0x136')});db[_0x6987('0xe3')][_0x6987('0x118')](db[_0x6987('0x13')],{'as':'Agents','through':_0x6987('0x11e')});db[_0x6987('0xe3')][_0x6987('0x118')](db[_0x6987('0x13a')],{'through':_0x6987('0x102'),'as':_0x6987('0x1c3')});db[_0x6987('0xe3')][_0x6987('0x118')](db[_0x6987('0x40')],{'through':_0x6987('0x1c4'),'as':_0x6987('0x123')});db[_0x6987('0xe3')][_0x6987('0x118')](db[_0x6987('0x6e')],{'through':_0x6987('0x1c5'),'as':'ChatQueues'});db[_0x6987('0xe3')][_0x6987('0x118')](db[_0x6987('0x125')],{'through':_0x6987('0x174'),'as':_0x6987('0x126')});db[_0x6987('0xe3')][_0x6987('0x118')](db[_0x6987('0x59')],{'through':_0x6987('0x179'),'as':_0x6987('0x1c6')});db[_0x6987('0xe3')][_0x6987('0x118')](db[_0x6987('0x62')],{'through':_0x6987('0x180'),'as':_0x6987('0x127')});db[_0x6987('0xe3')][_0x6987('0x118')](db['WhatsappQueue'],{'through':_0x6987('0x1c7'),'as':_0x6987('0x1c8')});db[_0x6987('0xe6')][_0x6987('0x106')](db['CmHopper'],{'as':_0x6987('0x13d'),'foreignKey':'CampaignId'});db[_0x6987('0xe6')][_0x6987('0x106')](db[_0x6987('0x77')],{'as':_0x6987('0x10d'),'foreignKey':_0x6987('0x18f')});db[_0x6987('0xe6')][_0x6987('0x106')](db[_0x6987('0x79')],{'as':_0x6987('0x13e'),'foreignKey':_0x6987('0x18f')});db['Campaign'][_0x6987('0x106')](db[_0x6987('0x76')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x6987('0xe6')][_0x6987('0x116')](db[_0x6987('0x2c')],{'as':_0x6987('0x2c'),'foreignKey':_0x6987('0x141')});db['Campaign']['belongsTo'](db['Trunk'],{'as':_0x6987('0x1c9'),'foreignKey':_0x6987('0x142')});db['Campaign'][_0x6987('0x116')](db['Interval'],{'as':'Interval','foreignKey':_0x6987('0x143')});db[_0x6987('0xe6')][_0x6987('0x116')](db[_0x6987('0xde')],{'as':'SquareProject','foreignKey':'SquareProjectId'});db[_0x6987('0xe6')]['belongsToMany'](db[_0x6987('0xf0')],{'as':_0x6987('0x1ca'),'through':_0x6987('0x1cb')});db[_0x6987('0xe6')][_0x6987('0x118')](db[_0x6987('0xf0')],{'as':_0x6987('0x148'),'through':'campaigns_has_cm_blacklists'});db[_0x6987('0x1cc')][_0x6987('0x116')](db[_0x6987('0x15d')],{});db[_0x6987('0x1cc')]['belongsTo'](db[_0x6987('0x43')],{});db[_0x6987('0x1cc')][_0x6987('0x116')](db[_0x6987('0x130')],{'foreignKey':_0x6987('0x1cd'),'as':_0x6987('0x1ce')});db[_0x6987('0x1cc')]['belongsTo'](db[_0x6987('0x13')],{'foreignKey':_0x6987('0x1cf'),'as':_0x6987('0x1d0')});db[_0x6987('0x1cc')][_0x6987('0x116')](db[_0x6987('0x13')],{'foreignKey':_0x6987('0x1d1'),'as':_0x6987('0x1d2')});db['MailTransferReport']['belongsTo'](db[_0x6987('0x40')],{'foreignKey':_0x6987('0x1d3'),'as':_0x6987('0x1d4')});db['MailTransferReport'][_0x6987('0x116')](db[_0x6987('0x130')],{'foreignKey':_0x6987('0x1d5'),'as':'ToAccount'});db[_0x6987('0x1d6')][_0x6987('0x116')](db[_0x6987('0x186')],{});db[_0x6987('0x1d6')][_0x6987('0x116')](db[_0x6987('0x69')],{});db[_0x6987('0x1d6')][_0x6987('0x116')](db[_0x6987('0x64')],{'foreignKey':_0x6987('0x1d7'),'as':_0x6987('0x1ce')});db['ChatTransferReport']['belongsTo'](db[_0x6987('0x13')],{'foreignKey':_0x6987('0x1cf'),'as':_0x6987('0x1d0')});db[_0x6987('0x1d6')]['belongsTo'](db['User'],{'foreignKey':_0x6987('0x1d1'),'as':_0x6987('0x1d2')});db[_0x6987('0x1d6')]['belongsTo'](db['ChatQueue'],{'foreignKey':_0x6987('0x1d8'),'as':_0x6987('0x1d4')});db[_0x6987('0x1d6')]['belongsTo'](db[_0x6987('0x64')],{'foreignKey':_0x6987('0x1d9'),'as':_0x6987('0x1da')});db[_0x6987('0x1db')]['belongsTo'](db[_0x6987('0x16f')],{});db[_0x6987('0x1db')][_0x6987('0x116')](db[_0x6987('0x4f')],{});db['FaxTransferReport'][_0x6987('0x116')](db[_0x6987('0x12e')],{'foreignKey':_0x6987('0x1dc'),'as':_0x6987('0x1ce')});db[_0x6987('0x1db')][_0x6987('0x116')](db['User'],{'foreignKey':_0x6987('0x1cf'),'as':_0x6987('0x1d0')});db[_0x6987('0x1db')][_0x6987('0x116')](db[_0x6987('0x13')],{'foreignKey':_0x6987('0x1d1'),'as':_0x6987('0x1d2')});db[_0x6987('0x1db')][_0x6987('0x116')](db[_0x6987('0x125')],{'foreignKey':_0x6987('0x1dd'),'as':_0x6987('0x1d4')});db[_0x6987('0x1db')][_0x6987('0x116')](db[_0x6987('0x12e')],{'foreignKey':_0x6987('0x1de'),'as':_0x6987('0x1da')});db['OpenchannelTransferReport']['belongsTo'](db[_0x6987('0x17b')],{});db[_0x6987('0xed')][_0x6987('0x116')](db[_0x6987('0x5f')],{});db['OpenchannelTransferReport'][_0x6987('0x116')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db[_0x6987('0xed')]['belongsTo'](db[_0x6987('0x13')],{'foreignKey':_0x6987('0x1cf'),'as':_0x6987('0x1d0')});db['OpenchannelTransferReport'][_0x6987('0x116')](db[_0x6987('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x6987('0xed')][_0x6987('0x116')](db[_0x6987('0x62')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x6987('0xed')][_0x6987('0x116')](db[_0x6987('0x5b')],{'foreignKey':_0x6987('0x1df'),'as':_0x6987('0x1da')});db[_0x6987('0x1e0')][_0x6987('0x116')](db[_0x6987('0x57')],{});db[_0x6987('0x1e0')][_0x6987('0x116')](db[_0x6987('0x56')],{});db[_0x6987('0x1e0')][_0x6987('0x116')](db['SmsAccount'],{'foreignKey':_0x6987('0x1e1'),'as':_0x6987('0x1ce')});db[_0x6987('0x1e0')][_0x6987('0x116')](db['User'],{'foreignKey':_0x6987('0x1cf'),'as':_0x6987('0x1d0')});db[_0x6987('0x1e0')][_0x6987('0x116')](db['User'],{'foreignKey':_0x6987('0x1d1'),'as':_0x6987('0x1d2')});db['SmsTransferReport']['belongsTo'](db[_0x6987('0x59')],{'foreignKey':_0x6987('0x1e2'),'as':_0x6987('0x1d4')});db[_0x6987('0x1e0')][_0x6987('0x116')](db[_0x6987('0x53')],{'foreignKey':_0x6987('0x1e3'),'as':_0x6987('0x1da')});db[_0x6987('0xf0')][_0x6987('0x106')](db[_0x6987('0x84')],{'as':_0x6987('0x155'),'foreignKey':'ListId'});db['CmList'][_0x6987('0x106')](db[_0x6987('0x7d')],{'as':'CustomFields','foreignKey':'ListId'});db[_0x6987('0xf0')][_0x6987('0x106')](db[_0x6987('0x11b')],{'as':_0x6987('0x18a'),'onDelete':_0x6987('0x10c'),'foreignKey':_0x6987('0x15a')});db['CmList']['hasMany'](db[_0x6987('0x77')],{'as':'HopperFinals','foreignKey':_0x6987('0x15a')});db['CmList'][_0x6987('0x106')](db[_0x6987('0x79')],{'as':_0x6987('0x1e4'),'foreignKey':_0x6987('0x15a')});db[_0x6987('0xf0')][_0x6987('0x106')](db[_0x6987('0x7b')],{'as':_0x6987('0x7b'),'foreignKey':_0x6987('0x15a')});db[_0x6987('0xf0')]['belongsToMany'](db[_0x6987('0x13a')],{'as':_0x6987('0x1e5'),'through':_0x6987('0x145')});db[_0x6987('0xf0')][_0x6987('0x118')](db['User'],{'as':'Agents','through':_0x6987('0x11d')});db[_0x6987('0x129')][_0x6987('0x106')](db[_0x6987('0x10a')],{'as':_0x6987('0x10b'),'onDelete':'cascade'});db[_0x6987('0x129')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x6987('0x12b')});db[_0x6987('0xf3')][_0x6987('0x106')](db[_0x6987('0x13')],{'as':_0x6987('0x163'),'foreignKey':_0x6987('0x117')});db[_0x6987('0xf3')][_0x6987('0x106')](db[_0x6987('0xf4')],{'as':_0x6987('0x1e6'),'foreignKey':_0x6987('0x117'),'onDelete':_0x6987('0x10c')});db[_0x6987('0xf4')]['hasMany'](db['UserProfileResource'],{'as':_0x6987('0x1e7'),'foreignKey':_0x6987('0x1e8'),'onDelete':'cascade'});db['WhatsappAccount'][_0x6987('0x106')](db[_0x6987('0x84')],{'as':_0x6987('0x155'),'foreignKey':_0x6987('0x1e9')});db[_0x6987('0xf8')][_0x6987('0x106')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0x6987('0x1e9')});db[_0x6987('0xf8')][_0x6987('0x106')](db[_0x6987('0xfb')],{'as':_0x6987('0x14a'),'foreignKey':_0x6987('0x1e9')});db['WhatsappAccount'][_0x6987('0x106')](db[_0x6987('0x112')],{'as':_0x6987('0x16d')});db[_0x6987('0xf8')]['hasMany'](db['WhatsappApplication'],{'as':_0x6987('0x158')});db[_0x6987('0xf8')][_0x6987('0x116')](db[_0x6987('0xf0')],{'as':'List','foreignKey':_0x6987('0x15a')});db['WhatsappAccount'][_0x6987('0x116')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x6987('0xf8')][_0x6987('0x118')](db[_0x6987('0x13')],{'as':_0x6987('0x146'),'through':'user_has_whatsapp_accounts'});db[_0x6987('0xf9')][_0x6987('0x116')](db[_0x6987('0x13')],{'onDelete':_0x6987('0x16a')});db[_0x6987('0xf9')][_0x6987('0x116')](db[_0x6987('0x128')],{'onDelete':_0x6987('0x16a')});db[_0x6987('0xf9')][_0x6987('0x116')](db[_0x6987('0xf8')],{'onDelete':'restrict'});db[_0x6987('0xf9')][_0x6987('0x116')](db[_0x6987('0x86')],{'onDelete':_0x6987('0x16a'),'foreignKey':'IntervalId'});db[_0x6987('0xf9')][_0x6987('0x116')](db[_0x6987('0x8d')],{'onDelete':'restrict','foreignKey':'TagId'});db['WhatsappInteraction'][_0x6987('0x106')](db[_0x6987('0xfb')],{'as':_0x6987('0x14a'),'onDelete':_0x6987('0x10c'),'foreignKey':'WhatsappInteractionId'});db[_0x6987('0x112')][_0x6987('0x116')](db[_0x6987('0xf8')],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x1e9')});db[_0x6987('0x112')][_0x6987('0x116')](db['CmContact'],{'as':_0x6987('0x150'),'foreignKey':'ContactId'});db['WhatsappInteraction'][_0x6987('0x116')](db['User'],{'as':_0x6987('0x15f'),'foreignKey':_0x6987('0x105')});db['WhatsappInteraction'][_0x6987('0x118')](db['Tag'],{'through':_0x6987('0x19f'),'as':'Tags'});db[_0x6987('0x112')][_0x6987('0x118')](db[_0x6987('0x8d')],{'through':_0x6987('0x19f'),'as':_0x6987('0x162')});db[_0x6987('0x112')][_0x6987('0x118')](db[_0x6987('0x13')],{'as':_0x6987('0x163'),'through':_0x6987('0x1ea'),'foreignKey':_0x6987('0x1eb')});db[_0x6987('0xfb')]['belongsTo'](db[_0x6987('0x13')],{'as':_0x6987('0x13')});db['WhatsappMessage'][_0x6987('0x116')](db[_0x6987('0x11b')],{'onDelete':'cascade','as':_0x6987('0x150')});db[_0x6987('0xfb')]['belongsTo'](db[_0x6987('0x112')],{'onDelete':_0x6987('0x10c'),'as':_0x6987('0x167'),'foreignKey':_0x6987('0x1eb')});db[_0x6987('0xfb')][_0x6987('0x116')](db['WhatsappAccount'],{'as':_0x6987('0x15e'),'foreignKey':_0x6987('0x1e9')});db[_0x6987('0xfc')]['belongsTo'](db[_0x6987('0xf8')],{});db[_0x6987('0xfc')][_0x6987('0x116')](db[_0x6987('0xf0')],{'as':'List','foreignKey':_0x6987('0x15a')});db['WhatsappQueueReport'][_0x6987('0x116')](db['CmContact'],{'as':_0x6987('0x150'),'foreignKey':_0x6987('0x151')});db[_0x6987('0xfc')][_0x6987('0x116')](db[_0x6987('0x112')],{});db[_0x6987('0xfc')][_0x6987('0x116')](db['WhatsappQueue'],{});db['WhatsappQueueReport'][_0x6987('0x116')](db[_0x6987('0xfb')],{});db['WhatsappQueueReport'][_0x6987('0x116')](db[_0x6987('0x13')],{});db[_0x6987('0xfe')][_0x6987('0x116')](db[_0x6987('0xfb')],{});db[_0x6987('0xfe')]['belongsTo'](db[_0x6987('0x112')],{});db[_0x6987('0xfe')][_0x6987('0x116')](db[_0x6987('0xf8')],{'foreignKey':_0x6987('0x1ec'),'as':_0x6987('0x1ce')});db['WhatsappTransferReport']['belongsTo'](db[_0x6987('0xf8')],{'foreignKey':_0x6987('0x1ed'),'as':_0x6987('0x1da')});db[_0x6987('0xfe')]['belongsTo'](db[_0x6987('0x128')],{'foreignKey':_0x6987('0x1ee'),'as':_0x6987('0x1d4')});db[_0x6987('0xfe')][_0x6987('0x116')](db[_0x6987('0x13')],{'foreignKey':_0x6987('0x1cf'),'as':'FromAgent'});db[_0x6987('0xfe')][_0x6987('0x116')](db[_0x6987('0x13')],{'foreignKey':_0x6987('0x1d1'),'as':'ToAgent'});db['WhatsappQueue']['belongsToMany'](db['User'],{'as':_0x6987('0x146'),'through':'UserWhatsappQueue','foreignKey':_0x6987('0x1ef')});db[_0x6987('0x128')][_0x6987('0x118')](db[_0x6987('0xe3')],{'through':_0x6987('0x1c7'),'as':_0x6987('0x147')});module[_0x6987('0x1f0')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x233e=['utf8','utf8_general_ci','sequelizeHistory','mysql','database','username','password','options','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','VoiceMusicOnHold','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','UserSmsQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','SmsInteraction','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','CmContact','CmHopper','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','Interval','Cdr','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Tag','../api/tag/tag.model','../api/template/template.model','Trigger','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskField/intZendeskField.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','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','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','../api/chatInternalMessage/chatInternalMessage.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','User','hasOne','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','belongsTo','Groups','chat_group_has_users','belongsToMany','Contacts','Lists','cm_user_has_lists','user_has_teams','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','VoiceQueue','VoiceQueues','MailQueue','MailQueues','ChatQueue','ChatQueues','FaxQueues','SmsQueue','OpenchannelQueues','UserOpenchannelQueue','UserWhatsappQueue','VoicePrefix','VoicePrefixes','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','user_has_square_projects','ChanSpyId','Applications','Sound','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','Trunk','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','AgentReports','Contact','MailServerIn','MailAccountId','Imap','Interactions','List','Template','TemplateId','mandatoryDispositionPause','team_has_mail_queues','Account','ContactId','Owner','mail_interaction_has_tags','ThroughTags','Users','user_has_mail_interactions','Interaction','MailInteractionId','ChatWebsiteId','ChatOfflineMessageId','MailApplication','restrict','ListId','FaxAccountId','Answers','Exntensions','FaxApplication','TagId','FaxInteractionId','Tags','fax_interaction_has_tags','AttachmentId','Dispositions','SmsAccountId','sms_interaction_has_tags','user_has_sms_interactions','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelAccount','Pause','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','ChatInteraction','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatInternalMessage','Members','CompanyId','Company','cm_user_has_contacts','cm_contact_has_tags','Agent','OwnerId','CampaignId','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','ChatApplications','FaxApplications','DefaultReportId','CustomReportId','Mohs','AllConditions','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','Configurations','AccountId','Subjects','SubjectId','SalesforceField','Descriptions','DescriptionId','FieldId','Subject','Field','Variable','VariableId','SugarcrmConfiguration','int_desk_configuration_has_tags','Description','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskAccount','VtigerField','ServicenowField','FromId','ToId','SessionId','ProjectId','JscriptyAnswerReport','team_has_chat_queues','SmsQueues','WhatsappQueues','HopperHistories','SquareProjectId','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToQueue','ToAccount','FromChatWebsiteId','FromUserId','ToAgent','ToChatQueueId','FromFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','user_has_voice_prefixes','userProfileId','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','whatsapp_interaction_has_tags','WhatsappQueueReport','FromWhatsappAccountId','WhatsappQueueId','exports','../config/environment','sequelize','jstz','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name'];(function(_0x50b651,_0x2ce0c5){var _0x1ec2b0=function(_0x468b6d){while(--_0x468b6d){_0x50b651['push'](_0x50b651['shift']());}};_0x1ec2b0(++_0x2ce0c5);}(_0x233e,0x1dd));var _0xe233=function(_0x19b5e7,_0x2d0cba){_0x19b5e7=_0x19b5e7-0x0;var _0x473f2d=_0x233e[_0x19b5e7];return _0x473f2d;};'use strict';var path=require('path');var config=require(_0xe233('0x0'));var Sequelize=require(_0xe233('0x1'));var _=require('lodash');var jstz=require(_0xe233('0x2'));var timezone=jstz['determine']();config['sequelize']=_[_0xe233('0x3')](config[_0xe233('0x1')],{'database':_0xe233('0x4'),'username':_0xe233('0x5'),'password':_0xe233('0x6'),'options':{'host':_0xe233('0x7'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xe233('0x8')},'logging':![],'timezone':timezone[_0xe233('0x9')](),'define':{'charset':_0xe233('0xa'),'collate':_0xe233('0xb')}}});config[_0xe233('0xc')]=_[_0xe233('0x3')](config[_0xe233('0xc')],{'database':'motion2','username':'xcall','password':_0xe233('0x6'),'options':{'host':_0xe233('0x7'),'port':0xcea,'dialect':_0xe233('0xd'),'dialectOptions':{'charset':_0xe233('0x8')},'logging':![],'timezone':timezone[_0xe233('0x9')](),'define':{'charset':'utf8','collate':_0xe233('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe233('0x1')][_0xe233('0xe')],config[_0xe233('0x1')][_0xe233('0xf')],config[_0xe233('0x1')][_0xe233('0x10')],config[_0xe233('0x1')][_0xe233('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe233('0xc')][_0xe233('0xe')],config[_0xe233('0xc')][_0xe233('0xf')],config[_0xe233('0xc')][_0xe233('0x10')],config[_0xe233('0xc')]['options'])};db['User']=db['sequelize'][_0xe233('0x12')](_0xe233('0x13'));db[_0xe233('0x14')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x15'));db[_0xe233('0x16')]=db['sequelize'][_0xe233('0x12')]('../api/voiceContext/voiceContext.model');db[_0xe233('0x17')]=db['sequelize'][_0xe233('0x12')]('../api/voiceExtension/voiceExtension.model');db[_0xe233('0x18')]=db[_0xe233('0x1')][_0xe233('0x12')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db['VoiceQueue']=db[_0xe233('0x1')][_0xe233('0x12')]('../api/voiceQueue/voiceQueue.model');db[_0xe233('0x19')]=db['sequelize'][_0xe233('0x12')](_0xe233('0x1a'));db['ScreenRecording']=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x1b'));db[_0xe233('0x1c')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x1d'));db[_0xe233('0x1e')]=db['sequelize']['import']('../api/voiceMailMessage/voiceMailMessage.model');db[_0xe233('0x1f')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x20'));db[_0xe233('0x21')]=db[_0xe233('0x1')]['import'](_0xe233('0x22'));db[_0xe233('0x23')]=db[_0xe233('0x1')]['import'](_0xe233('0x24'));db[_0xe233('0x25')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x26'));db[_0xe233('0x27')]=db[_0xe233('0x1')]['import'](_0xe233('0x28'));db['Trunk']=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x29'));db[_0xe233('0x2a')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x2b'));db[_0xe233('0x2c')]=db[_0xe233('0x1')][_0xe233('0x12')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xe233('0x2d')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x2e'));db[_0xe233('0x2f')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x30'));db[_0xe233('0x31')]=db[_0xe233('0x1')][_0xe233('0x12')]('../api/userMailQueue/userMailQueue.model');db[_0xe233('0x32')]=db[_0xe233('0x1')][_0xe233('0x12')]('../api/userFaxQueue/userFaxQueue.model');db[_0xe233('0x33')]=db['sequelize'][_0xe233('0x12')]('../api/userSmsQueue/userSmsQueue.model');db['UserOpenchannelQueue']=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x34'));db['UserWhatsappQueue']=db[_0xe233('0x1')]['import'](_0xe233('0x35'));db['MailServerIn']=db[_0xe233('0x1')][_0xe233('0x12')]('../api/mailServerIn/mailServerIn.model');db[_0xe233('0x36')]=db['sequelize'][_0xe233('0x12')](_0xe233('0x37'));db[_0xe233('0x38')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x39'));db['MailQueue']=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x3a'));db['MailSubstatus']=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x3b'));db[_0xe233('0x3c')]=db['sequelize'][_0xe233('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0xe233('0x3d')]=db[_0xe233('0x1')]['import'](_0xe233('0x3e'));db['MailApplication']=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x3f'));db[_0xe233('0x40')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x41'));db[_0xe233('0x42')]=db['sequelize'][_0xe233('0x12')](_0xe233('0x43'));db[_0xe233('0x44')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x45'));db[_0xe233('0x46')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x47'));db['FaxApplication']=db['sequelize'][_0xe233('0x12')](_0xe233('0x48'));db[_0xe233('0x49')]=db[_0xe233('0x1')]['import'](_0xe233('0x4a'));db[_0xe233('0x4b')]=db[_0xe233('0x1')]['import'](_0xe233('0x4c'));db[_0xe233('0x4d')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x4e'));db[_0xe233('0x4f')]=db[_0xe233('0x1')]['import'](_0xe233('0x50'));db[_0xe233('0x51')]=db[_0xe233('0x1')]['import']('../api/smsAccount/smsAccount.model');db[_0xe233('0x52')]=db[_0xe233('0x1')][_0xe233('0x12')]('../api/smsApplication/smsApplication.model');db[_0xe233('0x53')]=db['sequelize'][_0xe233('0x12')]('../api/smsInteraction/smsInteraction.model');db[_0xe233('0x54')]=db['sequelize'][_0xe233('0x12')](_0xe233('0x55'));db['SmsQueue']=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x56'));db['OpenchannelAccount']=db[_0xe233('0x1')][_0xe233('0x12')]('../api/openchannelAccount/openchannelAccount.model');db[_0xe233('0x57')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x58'));db[_0xe233('0x59')]=db['sequelize']['import'](_0xe233('0x5a'));db[_0xe233('0x5b')]=db[_0xe233('0x1')]['import'](_0xe233('0x5c'));db[_0xe233('0x5d')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x5e'));db['ChatWebsite']=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x5f'));db[_0xe233('0x60')]=db[_0xe233('0x1')][_0xe233('0x12')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xe233('0x61')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x62'));db['ChatInteraction']=db['sequelize'][_0xe233('0x12')]('../api/chatInteraction/chatInteraction.model');db[_0xe233('0x63')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x64'));db[_0xe233('0x65')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x66'));db['ChatQueue']=db['sequelize'][_0xe233('0x12')](_0xe233('0x67'));db[_0xe233('0x68')]=db['sequelize'][_0xe233('0x12')](_0xe233('0x69'));db[_0xe233('0x6a')]=db[_0xe233('0x1')][_0xe233('0x12')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0xe233('0x6b')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x6c'));db[_0xe233('0x6d')]=db[_0xe233('0x1')][_0xe233('0x12')]('../api/cmContact/cmContact.model');db[_0xe233('0x6e')]=db[_0xe233('0x1')]['import']('../api/cmHopper/cmHopper.model');db[_0xe233('0x6f')]=db[_0xe233('0x1')][_0xe233('0x12')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0xe233('0x70')]=db['sequelize']['import'](_0xe233('0x71'));db['CmHopperHistory']=db['sequelize'][_0xe233('0x12')](_0xe233('0x72'));db[_0xe233('0x73')]=db['sequelize'][_0xe233('0x12')](_0xe233('0x74'));db[_0xe233('0x75')]=db[_0xe233('0x1')][_0xe233('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0xe233('0x76')]=db['sequelize'][_0xe233('0x12')]('../api/action/action.model');db[_0xe233('0x77')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x78'));db[_0xe233('0x79')]=db['sequelize'][_0xe233('0x12')](_0xe233('0x7a'));db[_0xe233('0x7b')]=db['sequelize'][_0xe233('0x12')](_0xe233('0x7c'));db[_0xe233('0x7d')]=db['sequelize']['import']('../api/condition/condition.model');db[_0xe233('0x7e')]=db['sequelize']['import']('../api/interval/interval.model');db['Pause']=db[_0xe233('0x1')][_0xe233('0x12')]('../api/pause/pause.model');db[_0xe233('0x7f')]=db[_0xe233('0x1')][_0xe233('0x12')]('../api/cdr/cdr.model');db[_0xe233('0x80')]=db[_0xe233('0x1')]['import']('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0xe233('0x81')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x82'));db['Sound']=db[_0xe233('0x1')][_0xe233('0x12')]('../api/sound/sound.model');db[_0xe233('0x83')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x84'));db['Template']=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x85'));db[_0xe233('0x86')]=db[_0xe233('0x1')][_0xe233('0x12')]('../api/trigger/trigger.model');db['Variable']=db[_0xe233('0x1')]['import']('../api/variable/variable.model');db[_0xe233('0x87')]=db[_0xe233('0x1')]['import'](_0xe233('0x88'));db['IntegrationReport']=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x89'));db[_0xe233('0x8a')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x8b'));db[_0xe233('0x8c')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x8d'));db[_0xe233('0x8e')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x8f'));db[_0xe233('0x90')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x91'));db[_0xe233('0x92')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x93'));db[_0xe233('0x94')]=db[_0xe233('0x1')][_0xe233('0x12')]('../api/analyticTreeReport/analyticTreeReport.model');db['SalesforceAccount']=db[_0xe233('0x1')]['import'](_0xe233('0x95'));db[_0xe233('0x96')]=db['sequelize'][_0xe233('0x12')](_0xe233('0x97'));db['SalesforceField']=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x98'));db[_0xe233('0x99')]=db[_0xe233('0x1')]['import'](_0xe233('0x9a'));db['SugarcrmConfiguration']=db['sequelize'][_0xe233('0x12')](_0xe233('0x9b'));db[_0xe233('0x9c')]=db[_0xe233('0x1')][_0xe233('0x12')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xe233('0x9d')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x9e'));db[_0xe233('0x9f')]=db[_0xe233('0x1')][_0xe233('0x12')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xe233('0xa0')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xa1'));db[_0xe233('0xa2')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xa3'));db[_0xe233('0xa4')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xa5'));db[_0xe233('0xa6')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xa7'));db[_0xe233('0xa8')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xa9'));db[_0xe233('0xaa')]=db[_0xe233('0x1')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xab'));db['FreshdeskAccount']=db[_0xe233('0x1')][_0xe233('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0xe233('0xac')]=db[_0xe233('0x1')]['import'](_0xe233('0xad'));db[_0xe233('0xae')]=db['sequelize'][_0xe233('0x12')](_0xe233('0xaf'));db[_0xe233('0xb0')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xb1'));db[_0xe233('0xb2')]=db[_0xe233('0x1')]['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db['sequelize']['import'](_0xe233('0xb3'));db[_0xe233('0xb4')]=db[_0xe233('0x1')]['import'](_0xe233('0xb5'));db[_0xe233('0xb6')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xb7'));db['ServicenowField']=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xb8'));db[_0xe233('0xb9')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xba'));db[_0xe233('0xbb')]=db['sequelize'][_0xe233('0x12')](_0xe233('0xbc'));db[_0xe233('0xbd')]=db[_0xe233('0x1')]['import'](_0xe233('0xbe'));db[_0xe233('0xbf')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xc0'));db[_0xe233('0xc1')]=db['sequelize'][_0xe233('0x12')](_0xe233('0xc2'));db[_0xe233('0xc3')]=db['sequelize'][_0xe233('0x12')](_0xe233('0xc4'));db[_0xe233('0x87')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x88'));db[_0xe233('0xc5')]=db[_0xe233('0x1')]['import']('../api/network/network.model');db[_0xe233('0xc6')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xc7'));db['ChatInternalMessage']=db['sequelize'][_0xe233('0x12')](_0xe233('0xc8'));db['JscriptyAnswerReport']=db[_0xe233('0x1')][_0xe233('0x12')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0xe233('0xc9')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xca'));db[_0xe233('0xcb')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xcc'));db[_0xe233('0xcd')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xce'));db[_0xe233('0xcf')]=db[_0xe233('0x1')][_0xe233('0x12')]('../api/squareReport/squareReport.model');db[_0xe233('0xd0')]=db[_0xe233('0x1')]['import'](_0xe233('0xd1'));db[_0xe233('0xd2')]=db['sequelize'][_0xe233('0x12')]('../api/jscriptyProject/jscriptyProject.model');db[_0xe233('0xd3')]=db['sequelize'][_0xe233('0x12')](_0xe233('0xd4'));db[_0xe233('0xd5')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xd6'));db[_0xe233('0xd7')]=db['sequelize']['import']('../api/squareProject/squareProject.model');db[_0xe233('0xd8')]=db[_0xe233('0x1')]['import'](_0xe233('0xd9'));db[_0xe233('0xda')]=db['sequelize'][_0xe233('0x12')](_0xe233('0xdb'));db[_0xe233('0xdc')]=db[_0xe233('0x1')]['import'](_0xe233('0xdd'));db[_0xe233('0xde')]=db['sequelize'][_0xe233('0x12')](_0xe233('0xdf'));db[_0xe233('0xe0')]=db[_0xe233('0x1')]['import'](_0xe233('0xe1'));db[_0xe233('0xe2')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xe3'));db[_0xe233('0xe4')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xe5'));db['Plugin']=db['sequelize'][_0xe233('0x12')]('../api/plugin/plugin.model');db['MailTransferReport']=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xe6'));db[_0xe233('0xe7')]=db['sequelize'][_0xe233('0x12')](_0xe233('0xe8'));db[_0xe233('0xe9')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xea'));db['OpenchannelTransferReport']=db['sequelize'][_0xe233('0x12')](_0xe233('0xeb'));db['SmsTransferReport']=db['sequelize'][_0xe233('0x12')](_0xe233('0xec'));db[_0xe233('0xed')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xee'));db['VoicePrefix']=db['sequelize'][_0xe233('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0xe233('0xef')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xf0'));db[_0xe233('0xf1')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xf2'));db['UserProfileResource']=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xf3'));db[_0xe233('0xf4')]=db[_0xe233('0x1')][_0xe233('0x12')]('../api/userNotification/userNotification.model');db['WhatsappAccount']=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xf5'));db[_0xe233('0xf6')]=db['sequelize'][_0xe233('0x12')](_0xe233('0xf7'));db[_0xe233('0xf8')]=db[_0xe233('0x1')][_0xe233('0x12')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0xe233('0xf9')]=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xfa'));db['WhatsappQueueReport']=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0xfb'));db[_0xe233('0xfc')]=db[_0xe233('0x1')]['import'](_0xe233('0xfd'));db[_0xe233('0xfe')]=db[_0xe233('0x1')][_0xe233('0x12')]('../api/whatsappQueue/whatsappQueue.model');db[_0xe233('0xff')]=db[_0xe233('0x1')]['import'](_0xe233('0x100'));db['TeamVoiceQueue']=db[_0xe233('0x1')][_0xe233('0x12')](_0xe233('0x101'));db[_0xe233('0x102')][_0xe233('0x103')](db[_0xe233('0x1c')],{'as':_0xe233('0x1c'),'onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x105')});db[_0xe233('0x102')][_0xe233('0x106')](db[_0xe233('0x19')],{'as':_0xe233('0x107'),'foreignKey':_0xe233('0x105')});db[_0xe233('0x102')][_0xe233('0x106')](db[_0xe233('0x2c')],{'as':_0xe233('0x108'),'foreignKey':_0xe233('0x105')});db[_0xe233('0x102')][_0xe233('0x106')](db[_0xe233('0x17')],{'as':_0xe233('0x109'),'onDelete':_0xe233('0x104'),'hooks':!![]});db[_0xe233('0x102')][_0xe233('0x106')](db['CmHopperFinal'],{'as':_0xe233('0x10a'),'foreignKey':_0xe233('0x105')});db[_0xe233('0x102')]['hasMany'](db[_0xe233('0x10b')],{'as':_0xe233('0x10c'),'foreignKey':_0xe233('0x105')});db[_0xe233('0x102')][_0xe233('0x106')](db[_0xe233('0x73')],{'as':'ReportAgentPreview','foreignKey':_0xe233('0x105')});db[_0xe233('0x102')]['hasMany'](db[_0xe233('0x59')],{'as':_0xe233('0x10d'),'foreignKey':'UserId'});db['User']['hasMany'](db['ChatInteraction'],{'as':_0xe233('0x10e'),'foreignKey':_0xe233('0x105')});db['User'][_0xe233('0x106')](db[_0xe233('0x53')],{'as':_0xe233('0x10f'),'foreignKey':_0xe233('0x105')});db['User'][_0xe233('0x106')](db[_0xe233('0x49')],{'as':_0xe233('0x110'),'foreignKey':_0xe233('0x105')});db['User'][_0xe233('0x106')](db[_0xe233('0x3c')],{'as':_0xe233('0x111'),'foreignKey':_0xe233('0x105')});db[_0xe233('0x102')][_0xe233('0x106')](db[_0xe233('0xf8')],{'as':_0xe233('0x112'),'foreignKey':_0xe233('0x105')});db[_0xe233('0x102')][_0xe233('0x106')](db[_0xe233('0xf4')],{'as':_0xe233('0x113'),'foreignKey':'SenderId'});db[_0xe233('0x102')][_0xe233('0x114')](db['UserProfile'],{'as':_0xe233('0xef'),'foreignKey':'userProfileId'});db['User']['belongsToMany'](db[_0xe233('0x68')],{'as':_0xe233('0x115'),'through':_0xe233('0x116')});db['User'][_0xe233('0x117')](db[_0xe233('0x6d')],{'as':_0xe233('0x118'),'through':'cm_user_has_contacts'});db['User']['belongsToMany'](db[_0xe233('0xed')],{'as':_0xe233('0x119'),'through':_0xe233('0x11a')});db[_0xe233('0x102')]['belongsToMany'](db[_0xe233('0xdc')],{'through':_0xe233('0x11b')});db[_0xe233('0x102')][_0xe233('0x117')](db[_0xe233('0x3c')],{'as':_0xe233('0x111'),'through':'user_has_mail_interactions'});db[_0xe233('0x102')][_0xe233('0x117')](db['ChatInteraction'],{'as':_0xe233('0x10e'),'through':_0xe233('0x11c')});db[_0xe233('0x102')][_0xe233('0x117')](db['FaxInteraction'],{'as':_0xe233('0x110'),'through':_0xe233('0x11d')});db[_0xe233('0x102')][_0xe233('0x117')](db[_0xe233('0x53')],{'as':'SmsInteractions','through':'user_has_sms_interactions'});db[_0xe233('0x102')][_0xe233('0x117')](db[_0xe233('0x59')],{'as':_0xe233('0x10d'),'through':_0xe233('0x11e')});db[_0xe233('0x102')][_0xe233('0x117')](db[_0xe233('0xf8')],{'as':_0xe233('0x112'),'through':'user_has_whatsapp_interactions'});db[_0xe233('0x102')][_0xe233('0x117')](db[_0xe233('0x11f')],{'as':_0xe233('0x120'),'through':'UserVoiceQueue','required':![]});db['User'][_0xe233('0x117')](db[_0xe233('0x121')],{'as':_0xe233('0x122'),'through':'UserMailQueue','required':![]});db[_0xe233('0x102')][_0xe233('0x117')](db[_0xe233('0x123')],{'as':_0xe233('0x124'),'through':'UserChatQueue','required':![],'hooks':!![]});db[_0xe233('0x102')][_0xe233('0x117')](db[_0xe233('0x4d')],{'as':_0xe233('0x125'),'through':_0xe233('0x32'),'required':![]});db[_0xe233('0x102')]['belongsToMany'](db[_0xe233('0x126')],{'as':'SmsQueues','through':_0xe233('0x33'),'required':![]});db[_0xe233('0x102')][_0xe233('0x117')](db[_0xe233('0x5d')],{'as':_0xe233('0x127'),'through':_0xe233('0x128'),'required':![]});db[_0xe233('0x102')][_0xe233('0x117')](db['WhatsappQueue'],{'as':'WhatsappQueues','through':_0xe233('0x129'),'required':![]});db[_0xe233('0x102')][_0xe233('0x117')](db[_0xe233('0xed')],{'through':_0xe233('0x11a')});db[_0xe233('0x102')][_0xe233('0x117')](db[_0xe233('0x12a')],{'as':_0xe233('0x12b'),'through':'user_has_voice_prefixes','required':![]});db[_0xe233('0x102')][_0xe233('0x117')](db[_0xe233('0x12c')],{'as':_0xe233('0x12d'),'through':_0xe233('0x12e')});db[_0xe233('0x102')][_0xe233('0x117')](db[_0xe233('0x46')],{'as':_0xe233('0x12f'),'through':_0xe233('0x130')});db[_0xe233('0x102')][_0xe233('0x117')](db[_0xe233('0x38')],{'as':_0xe233('0x131'),'through':_0xe233('0x132')});db[_0xe233('0x102')][_0xe233('0x117')](db['OpenchannelAccount'],{'as':_0xe233('0x133'),'through':_0xe233('0x134')});db[_0xe233('0x102')][_0xe233('0x117')](db[_0xe233('0x51')],{'as':_0xe233('0x135'),'through':_0xe233('0x136')});db[_0xe233('0x102')][_0xe233('0x117')](db[_0xe233('0x137')],{'as':_0xe233('0x138'),'through':_0xe233('0x139')});db[_0xe233('0x102')][_0xe233('0x117')](db[_0xe233('0xd7')],{'as':'SquareProjects','through':_0xe233('0x13a')});db[_0xe233('0x14')][_0xe233('0x106')](db[_0xe233('0x17')],{'as':'SpiedAgents','onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x13b')});db[_0xe233('0x16')]['hasMany'](db['VoiceExtension'],{'onDelete':_0xe233('0x104')});db[_0xe233('0x17')][_0xe233('0x106')](db[_0xe233('0x17')],{'as':_0xe233('0x13c'),'onDelete':'cascade'});db['VoiceMusicOnHold'][_0xe233('0x117')](db[_0xe233('0x13d')],{'as':'Sounds','through':'moh_has_sounds'});db[_0xe233('0x11f')]['hasMany'](db['UserVoiceQueueRt'],{'as':'Members','foreignKey':_0xe233('0x13e')});db[_0xe233('0x11f')]['hasMany'](db['CmHopper'],{'as':_0xe233('0x13f'),'foreignKey':_0xe233('0x13e')});db[_0xe233('0x11f')][_0xe233('0x106')](db[_0xe233('0x70')],{'as':_0xe233('0x10a'),'foreignKey':_0xe233('0x13e')});db[_0xe233('0x11f')][_0xe233('0x106')](db[_0xe233('0x10b')],{'as':'HopperHistories','foreignKey':_0xe233('0x13e')});db[_0xe233('0x11f')]['hasMany'](db[_0xe233('0x73')],{'as':_0xe233('0x73'),'foreignKey':'VoiceQueueId'});db[_0xe233('0x11f')][_0xe233('0x106')](db[_0xe233('0x6f')],{'as':_0xe233('0x140'),'foreignKey':_0xe233('0x13e')});db[_0xe233('0x11f')][_0xe233('0x106')](db[_0xe233('0xcb')],{'as':_0xe233('0x141'),'foreignKey':_0xe233('0x13e')});db[_0xe233('0x11f')][_0xe233('0x114')](db[_0xe233('0x142')],{'as':_0xe233('0x142'),'foreignKey':_0xe233('0x143')});db[_0xe233('0x11f')][_0xe233('0x114')](db[_0xe233('0x142')],{'as':_0xe233('0x144'),'foreignKey':_0xe233('0x145')});db[_0xe233('0x11f')][_0xe233('0x114')](db[_0xe233('0x7e')],{'as':_0xe233('0x7e'),'foreignKey':_0xe233('0x146')});db['VoiceQueue'][_0xe233('0x114')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xe233('0x147')});db[_0xe233('0x11f')]['belongsToMany'](db[_0xe233('0xed')],{'as':_0xe233('0x119'),'through':_0xe233('0x148')});db[_0xe233('0x11f')][_0xe233('0x117')](db[_0xe233('0x102')],{'as':_0xe233('0x149'),'through':_0xe233('0x2d')});db['VoiceQueue'][_0xe233('0x117')](db['Team'],{'as':_0xe233('0x14a'),'through':_0xe233('0x14b')});db[_0xe233('0x11f')][_0xe233('0x117')](db[_0xe233('0xed')],{'as':_0xe233('0x14c'),'through':_0xe233('0x14d')});db[_0xe233('0x19')]['belongsTo'](db['User'],{'as':'User','foreignKey':'UserId'});db['ScreenRecording'][_0xe233('0x114')](db[_0xe233('0x102')],{'as':_0xe233('0x102'),'foreignKey':_0xe233('0x105')});db[_0xe233('0x1c')][_0xe233('0x106')](db[_0xe233('0x1e')],{'as':_0xe233('0x14e'),'onDelete':'cascade','foreignKey':_0xe233('0x14f'),'sourceKey':_0xe233('0x150')});db[_0xe233('0x1e')][_0xe233('0x114')](db[_0xe233('0x1c')],{'foreignKey':_0xe233('0x14f'),'targetKey':_0xe233('0x150')});db[_0xe233('0x1f')][_0xe233('0x106')](db['VoiceQueueReport'],{'as':_0xe233('0x151'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0xe233('0x106')](db[_0xe233('0x23')],{'as':_0xe233('0x152'),'foreignKey':'uniqueid','constraints':![]});db[_0xe233('0x1f')][_0xe233('0x114')](db['User'],{'as':_0xe233('0x102'),'foreignKey':_0xe233('0x105')});db['VoiceCallReport']['belongsTo'](db['CmContact'],{'as':_0xe233('0x153'),'foreignKey':'ContactId'});db[_0xe233('0x154')][_0xe233('0x114')](db[_0xe233('0x38')],{'as':_0xe233('0x38'),'foreignKey':_0xe233('0x155')});db['MailServerOut'][_0xe233('0x114')](db[_0xe233('0x38')],{'as':_0xe233('0x38'),'foreignKey':_0xe233('0x155')});db[_0xe233('0x38')][_0xe233('0x103')](db[_0xe233('0x154')],{'as':_0xe233('0x156'),'onDelete':_0xe233('0x104')});db[_0xe233('0x38')]['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':'cascade'});db[_0xe233('0x38')]['hasMany'](db[_0xe233('0x7b')],{'as':'Dispositions','foreignKey':'MailAccountId'});db[_0xe233('0x38')][_0xe233('0x106')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xe233('0x155')});db[_0xe233('0x38')]['hasMany'](db['MailMessage'],{'as':_0xe233('0x14e'),'foreignKey':_0xe233('0x155')});db['MailAccount'][_0xe233('0x106')](db[_0xe233('0x3c')],{'as':_0xe233('0x157')});db[_0xe233('0x38')][_0xe233('0x106')](db['MailApplication'],{'as':_0xe233('0x13c')});db['MailAccount']['belongsTo'](db[_0xe233('0xed')],{'as':_0xe233('0x158'),'foreignKey':'ListId'});db[_0xe233('0x38')][_0xe233('0x114')](db['Template'],{'as':_0xe233('0x159'),'foreignKey':_0xe233('0x15a')});db['MailAccount'][_0xe233('0x114')](db['Pause'],{'as':_0xe233('0x15b'),'foreignKey':_0xe233('0x147')});db[_0xe233('0x38')][_0xe233('0x117')](db[_0xe233('0x102')],{'as':_0xe233('0x149'),'through':_0xe233('0x132')});db['MailQueue'][_0xe233('0x117')](db[_0xe233('0x102')],{'as':_0xe233('0x149'),'through':_0xe233('0x31')});db[_0xe233('0x121')][_0xe233('0x117')](db[_0xe233('0xdc')],{'through':_0xe233('0x15c'),'as':_0xe233('0x14a')});db[_0xe233('0x3c')][_0xe233('0x106')](db[_0xe233('0x3d')],{'as':_0xe233('0x14e'),'onDelete':'cascade','foreignKey':'MailInteractionId'});db[_0xe233('0x3c')]['belongsTo'](db[_0xe233('0x38')],{'as':_0xe233('0x15d'),'foreignKey':'MailAccountId'});db[_0xe233('0x3c')][_0xe233('0x114')](db[_0xe233('0x6d')],{'as':_0xe233('0x153'),'foreignKey':_0xe233('0x15e')});db[_0xe233('0x3c')][_0xe233('0x114')](db[_0xe233('0x102')],{'as':_0xe233('0x15f'),'foreignKey':_0xe233('0x105')});db[_0xe233('0x3c')]['belongsToMany'](db[_0xe233('0x83')],{'through':_0xe233('0x160'),'as':'Tags'});db['MailInteraction'][_0xe233('0x117')](db[_0xe233('0x83')],{'through':_0xe233('0x160'),'as':_0xe233('0x161')});db[_0xe233('0x3c')][_0xe233('0x117')](db['User'],{'as':_0xe233('0x162'),'through':_0xe233('0x163'),'foreignKey':'MailInteractionId'});db[_0xe233('0x3d')][_0xe233('0x106')](db[_0xe233('0xe4')],{'as':'Attachments','onDelete':'cascade'});db[_0xe233('0x3d')][_0xe233('0x114')](db[_0xe233('0x102')],{'as':_0xe233('0x102')});db[_0xe233('0x3d')][_0xe233('0x114')](db[_0xe233('0x6d')],{'onDelete':'cascade','as':_0xe233('0x153')});db[_0xe233('0x3d')]['belongsTo'](db[_0xe233('0x3c')],{'as':_0xe233('0x164'),'foreignKey':_0xe233('0x165')});db['MailMessage'][_0xe233('0x114')](db[_0xe233('0x38')],{'as':'Account','foreignKey':'MailAccountId'});db[_0xe233('0x3d')][_0xe233('0x114')](db['ChatWebsite'],{'as':_0xe233('0x12c'),'foreignKey':_0xe233('0x166')});db['MailMessage'][_0xe233('0x114')](db[_0xe233('0x65')],{'as':'ChatOfflineMessage','foreignKey':_0xe233('0x167')});db[_0xe233('0x168')]['belongsTo'](db[_0xe233('0x102')],{'onDelete':'restrict'});db[_0xe233('0x168')][_0xe233('0x114')](db[_0xe233('0x121')],{'onDelete':'restrict'});db[_0xe233('0x168')]['belongsTo'](db[_0xe233('0x38')],{'onDelete':_0xe233('0x169')});db['MailApplication']['belongsTo'](db['Interval'],{'onDelete':_0xe233('0x169'),'foreignKey':'IntervalId'});db['MailApplication']['belongsTo'](db[_0xe233('0x83')],{'onDelete':_0xe233('0x169'),'foreignKey':'TagId'});db[_0xe233('0x40')]['belongsTo'](db[_0xe233('0x38')],{});db[_0xe233('0x40')][_0xe233('0x114')](db['CmList'],{'as':_0xe233('0x158'),'foreignKey':_0xe233('0x16a')});db[_0xe233('0x40')][_0xe233('0x114')](db[_0xe233('0x6d')],{'as':_0xe233('0x153'),'foreignKey':_0xe233('0x15e')});db[_0xe233('0x40')]['belongsTo'](db[_0xe233('0x3c')],{});db['MailQueueReport'][_0xe233('0x114')](db['MailMessage'],{});db[_0xe233('0x40')][_0xe233('0x114')](db[_0xe233('0x102')],{});db[_0xe233('0x40')][_0xe233('0x114')](db[_0xe233('0x121')],{});db[_0xe233('0x42')][_0xe233('0x106')](db[_0xe233('0x44')],{'as':'Items','onDelete':_0xe233('0x104')});db[_0xe233('0x46')][_0xe233('0x106')](db[_0xe233('0x7b')],{'as':'Dispositions','foreignKey':_0xe233('0x16b')});db['FaxAccount'][_0xe233('0x106')](db['CannedAnswer'],{'as':_0xe233('0x16c'),'foreignKey':_0xe233('0x16b')});db['FaxAccount'][_0xe233('0x106')](db[_0xe233('0x49')],{'as':'Interactions'});db[_0xe233('0x46')]['hasMany'](db['FaxApplication'],{'as':'Applications'});db[_0xe233('0x46')][_0xe233('0x106')](db[_0xe233('0x17')],{'as':_0xe233('0x16d'),'onDelete':_0xe233('0x104')});db['FaxAccount'][_0xe233('0x106')](db[_0xe233('0x4b')],{'as':_0xe233('0x14e')});db[_0xe233('0x46')][_0xe233('0x114')](db['Trunk'],{'as':_0xe233('0x142')});db[_0xe233('0x46')][_0xe233('0x114')](db[_0xe233('0xed')],{'as':_0xe233('0x158'),'foreignKey':_0xe233('0x16a')});db[_0xe233('0x46')]['belongsTo'](db['Pause'],{'as':_0xe233('0x15b'),'foreignKey':_0xe233('0x147')});db[_0xe233('0x46')][_0xe233('0x117')](db['User'],{'as':_0xe233('0x149'),'through':_0xe233('0x130')});db[_0xe233('0x16e')]['belongsTo'](db['User'],{'onDelete':_0xe233('0x169')});db[_0xe233('0x16e')][_0xe233('0x114')](db[_0xe233('0x4d')],{'onDelete':_0xe233('0x169')});db[_0xe233('0x16e')][_0xe233('0x114')](db[_0xe233('0x46')],{'onDelete':'restrict'});db['FaxApplication'][_0xe233('0x114')](db['Tag'],{'onDelete':'restrict','foreignKey':_0xe233('0x16f')});db[_0xe233('0x49')][_0xe233('0x106')](db[_0xe233('0x4b')],{'as':_0xe233('0x14e'),'onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x170')});db[_0xe233('0x49')][_0xe233('0x114')](db['FaxAccount'],{'as':_0xe233('0x15d'),'foreignKey':_0xe233('0x16b')});db['FaxInteraction'][_0xe233('0x114')](db[_0xe233('0x6d')],{'as':_0xe233('0x153'),'foreignKey':_0xe233('0x15e')});db[_0xe233('0x49')][_0xe233('0x114')](db[_0xe233('0x102')],{'as':'Owner','foreignKey':'UserId'});db['FaxInteraction']['belongsToMany'](db[_0xe233('0x83')],{'through':'fax_interaction_has_tags','as':_0xe233('0x171')});db['FaxInteraction'][_0xe233('0x117')](db[_0xe233('0x83')],{'through':_0xe233('0x172'),'as':_0xe233('0x161')});db[_0xe233('0x49')]['belongsToMany'](db[_0xe233('0x102')],{'as':'Users','through':'user_has_fax_interactions','foreignKey':_0xe233('0x170')});db[_0xe233('0x4b')][_0xe233('0x114')](db[_0xe233('0x102')],{'onDelete':_0xe233('0x104'),'as':_0xe233('0x102')});db[_0xe233('0x4b')][_0xe233('0x114')](db[_0xe233('0x49')],{'as':'Interaction','foreignKey':_0xe233('0x170')});db[_0xe233('0x4b')][_0xe233('0x114')](db[_0xe233('0x6d')],{'onDelete':'cascade','as':'Contact'});db[_0xe233('0x4b')]['belongsTo'](db[_0xe233('0xe4')],{'as':'Attachment','foreignKey':_0xe233('0x173')});db[_0xe233('0x4b')][_0xe233('0x114')](db[_0xe233('0x46')],{'as':_0xe233('0x15d'),'foreignKey':_0xe233('0x16b')});db['FaxQueue'][_0xe233('0x117')](db[_0xe233('0x102')],{'as':_0xe233('0x149'),'through':'UserFaxQueue'});db[_0xe233('0x4d')][_0xe233('0x117')](db['Team'],{'through':'team_has_fax_queues','as':_0xe233('0x14a')});db[_0xe233('0x4f')][_0xe233('0x114')](db[_0xe233('0x46')],{});db[_0xe233('0x4f')][_0xe233('0x114')](db[_0xe233('0xed')],{'as':_0xe233('0x158'),'foreignKey':'ListId'});db[_0xe233('0x4f')][_0xe233('0x114')](db[_0xe233('0x6d')],{'as':_0xe233('0x153'),'foreignKey':_0xe233('0x15e')});db['FaxQueueReport'][_0xe233('0x114')](db['FaxInteraction'],{});db[_0xe233('0x4f')]['belongsTo'](db[_0xe233('0x4b')],{});db[_0xe233('0x4f')][_0xe233('0x114')](db[_0xe233('0x102')],{});db[_0xe233('0x4f')][_0xe233('0x114')](db[_0xe233('0x4d')],{});db['SmsAccount']['hasMany'](db[_0xe233('0x7b')],{'as':_0xe233('0x174'),'foreignKey':_0xe233('0x175')});db[_0xe233('0x51')]['hasMany'](db[_0xe233('0x79')],{'as':_0xe233('0x16c'),'foreignKey':_0xe233('0x175')});db[_0xe233('0x51')]['hasMany'](db[_0xe233('0x54')],{'as':_0xe233('0x14e'),'foreignKey':_0xe233('0x175')});db[_0xe233('0x51')][_0xe233('0x106')](db[_0xe233('0x53')],{'as':_0xe233('0x157')});db[_0xe233('0x51')][_0xe233('0x106')](db[_0xe233('0x52')],{'as':_0xe233('0x13c')});db[_0xe233('0x51')][_0xe233('0x114')](db[_0xe233('0xed')],{'as':_0xe233('0x158'),'foreignKey':_0xe233('0x16a')});db[_0xe233('0x51')][_0xe233('0x114')](db['Pause'],{'as':_0xe233('0x15b'),'foreignKey':_0xe233('0x147')});db['SmsAccount']['belongsToMany'](db[_0xe233('0x102')],{'as':_0xe233('0x149'),'through':'user_has_sms_accounts'});db[_0xe233('0x52')]['belongsTo'](db['User'],{'onDelete':_0xe233('0x169')});db['SmsApplication'][_0xe233('0x114')](db[_0xe233('0x126')],{'onDelete':_0xe233('0x169')});db[_0xe233('0x52')][_0xe233('0x114')](db[_0xe233('0x51')],{'onDelete':'restrict'});db[_0xe233('0x52')]['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':_0xe233('0x146')});db[_0xe233('0x52')][_0xe233('0x114')](db[_0xe233('0x83')],{'onDelete':_0xe233('0x169'),'foreignKey':_0xe233('0x16f')});db[_0xe233('0x53')][_0xe233('0x106')](db[_0xe233('0x54')],{'as':_0xe233('0x14e'),'onDelete':_0xe233('0x104'),'foreignKey':'SmsInteractionId'});db['SmsInteraction']['belongsTo'](db['SmsAccount'],{'as':_0xe233('0x15d'),'foreignKey':'SmsAccountId'});db[_0xe233('0x53')][_0xe233('0x114')](db[_0xe233('0x6d')],{'as':_0xe233('0x153'),'foreignKey':_0xe233('0x15e')});db[_0xe233('0x53')][_0xe233('0x114')](db['User'],{'as':_0xe233('0x15f'),'foreignKey':_0xe233('0x105')});db[_0xe233('0x53')][_0xe233('0x117')](db[_0xe233('0x83')],{'through':_0xe233('0x176'),'as':_0xe233('0x171')});db['SmsInteraction']['belongsToMany'](db['Tag'],{'through':_0xe233('0x176'),'as':_0xe233('0x161')});db[_0xe233('0x53')][_0xe233('0x117')](db[_0xe233('0x102')],{'as':_0xe233('0x162'),'through':_0xe233('0x177'),'foreignKey':_0xe233('0x178')});db['SmsMessage']['belongsTo'](db['User'],{'as':_0xe233('0x102')});db[_0xe233('0x54')]['belongsTo'](db[_0xe233('0x6d')],{'onDelete':_0xe233('0x104'),'as':_0xe233('0x153')});db[_0xe233('0x54')][_0xe233('0x114')](db[_0xe233('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0xe233('0x178')});db['SmsMessage'][_0xe233('0x114')](db[_0xe233('0x51')],{'as':_0xe233('0x15d'),'foreignKey':_0xe233('0x175')});db[_0xe233('0x126')][_0xe233('0x117')](db[_0xe233('0x102')],{'as':_0xe233('0x149'),'through':_0xe233('0x33'),'foreignKey':_0xe233('0x179')});db['SmsQueue'][_0xe233('0x117')](db['Team'],{'through':_0xe233('0x17a'),'as':'Teams'});db['OpenchannelAccount'][_0xe233('0x106')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xe233('0x17b')});db['OpenchannelAccount'][_0xe233('0x106')](db[_0xe233('0x79')],{'as':_0xe233('0x16c'),'foreignKey':_0xe233('0x17b')});db[_0xe233('0x17c')]['hasMany'](db[_0xe233('0x59')],{'as':_0xe233('0x157'),'foreignKey':'OpenchannelAccountId'});db[_0xe233('0x17c')][_0xe233('0x106')](db[_0xe233('0x5b')],{'as':_0xe233('0x14e'),'foreignKey':'OpenchannelAccountId'});db[_0xe233('0x17c')][_0xe233('0x106')](db['OpenchannelApplication'],{'as':_0xe233('0x13c'),'foreignKey':_0xe233('0x17b')});db[_0xe233('0x17c')]['belongsTo'](db['CmList'],{'as':_0xe233('0x158'),'foreignKey':_0xe233('0x16a')});db[_0xe233('0x17c')][_0xe233('0x114')](db[_0xe233('0x17d')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xe233('0x17c')][_0xe233('0x117')](db[_0xe233('0x102')],{'as':'Agents','through':_0xe233('0x134')});db[_0xe233('0x57')][_0xe233('0x114')](db[_0xe233('0x102')],{'onDelete':_0xe233('0x169')});db['OpenchannelApplication'][_0xe233('0x114')](db[_0xe233('0x5d')],{'onDelete':_0xe233('0x169'),'foreignKey':_0xe233('0x17e')});db[_0xe233('0x57')][_0xe233('0x114')](db[_0xe233('0x17c')],{'onDelete':_0xe233('0x169'),'foreignKey':_0xe233('0x17b')});db[_0xe233('0x57')][_0xe233('0x114')](db[_0xe233('0x7e')],{'onDelete':_0xe233('0x169'),'foreignKey':_0xe233('0x146')});db['OpenchannelApplication'][_0xe233('0x114')](db['Tag'],{'onDelete':_0xe233('0x169'),'foreignKey':_0xe233('0x16f')});db[_0xe233('0x59')]['hasMany'](db[_0xe233('0x5b')],{'as':_0xe233('0x14e'),'onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x17f')});db[_0xe233('0x59')]['belongsTo'](db[_0xe233('0x17c')],{'as':_0xe233('0x15d'),'foreignKey':_0xe233('0x17b')});db[_0xe233('0x59')][_0xe233('0x114')](db[_0xe233('0x6d')],{'as':'Contact','foreignKey':'ContactId'});db['OpenchannelInteraction'][_0xe233('0x114')](db['User'],{'as':'Owner','foreignKey':'UserId'});db['OpenchannelInteraction']['belongsToMany'](db[_0xe233('0x83')],{'through':_0xe233('0x180'),'as':_0xe233('0x171')});db[_0xe233('0x59')][_0xe233('0x117')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0xe233('0x161')});db[_0xe233('0x59')][_0xe233('0x117')](db[_0xe233('0x102')],{'as':_0xe233('0x162'),'through':_0xe233('0x11e'),'foreignKey':_0xe233('0x17f')});db['OpenchannelMessage'][_0xe233('0x114')](db['User'],{'onDelete':_0xe233('0x104'),'as':'User'});db[_0xe233('0x5b')][_0xe233('0x114')](db['CmContact'],{'onDelete':'cascade','as':_0xe233('0x153')});db[_0xe233('0x5b')][_0xe233('0x114')](db['OpenchannelInteraction'],{'onDelete':_0xe233('0x104'),'as':'Interaction','foreignKey':'OpenchannelInteractionId'});db[_0xe233('0x5b')][_0xe233('0x114')](db['Attachment'],{'as':_0xe233('0xe4'),'foreignKey':_0xe233('0x173')});db['OpenchannelMessage'][_0xe233('0x114')](db['OpenchannelAccount'],{'as':_0xe233('0x15d'),'foreignKey':_0xe233('0x17b')});db['OpenchannelQueue'][_0xe233('0x117')](db[_0xe233('0x102')],{'as':_0xe233('0x149'),'through':_0xe233('0x128'),'foreignKey':'OpenchannelQueueId'});db[_0xe233('0x5d')][_0xe233('0x117')](db[_0xe233('0xdc')],{'through':_0xe233('0x181'),'as':_0xe233('0x14a')});db[_0xe233('0x12c')][_0xe233('0x106')](db[_0xe233('0x7b')],{'as':_0xe233('0x174'),'foreignKey':_0xe233('0x166')});db['ChatWebsite'][_0xe233('0x106')](db[_0xe233('0x79')],{'as':_0xe233('0x16c'),'foreignKey':_0xe233('0x166')});db[_0xe233('0x12c')][_0xe233('0x106')](db[_0xe233('0x6a')],{'as':_0xe233('0x182')});db[_0xe233('0x12c')]['hasMany'](db[_0xe233('0x183')],{'as':_0xe233('0x157')});db[_0xe233('0x12c')][_0xe233('0x106')](db[_0xe233('0x61')],{'as':_0xe233('0x13c')});db[_0xe233('0x12c')][_0xe233('0x106')](db[_0xe233('0x63')],{'as':'Messages'});db[_0xe233('0x12c')][_0xe233('0x114')](db['CmList'],{'as':'List','foreignKey':_0xe233('0x16a')});db[_0xe233('0x12c')][_0xe233('0x114')](db['Interval'],{'as':'Interval','foreignKey':'IntervalId'});db[_0xe233('0x12c')]['belongsTo'](db['MailAccount'],{'as':'MailAccount','foreignKey':_0xe233('0x155')});db['ChatWebsite'][_0xe233('0x114')](db[_0xe233('0x17d')],{'as':_0xe233('0x15b'),'foreignKey':_0xe233('0x147')});db[_0xe233('0x12c')][_0xe233('0x117')](db[_0xe233('0x102')],{'as':_0xe233('0x149'),'through':_0xe233('0x12e')});db[_0xe233('0x60')][_0xe233('0x114')](db[_0xe233('0x17c')],{});db[_0xe233('0x60')][_0xe233('0x114')](db[_0xe233('0xed')],{'as':_0xe233('0x158'),'foreignKey':_0xe233('0x16a')});db[_0xe233('0x60')][_0xe233('0x114')](db[_0xe233('0x6d')],{'as':_0xe233('0x153'),'foreignKey':_0xe233('0x15e')});db[_0xe233('0x60')]['belongsTo'](db['OpenchannelInteraction'],{});db['OpenchannelQueueReport'][_0xe233('0x114')](db[_0xe233('0x5b')],{});db[_0xe233('0x60')]['belongsTo'](db[_0xe233('0x102')],{});db[_0xe233('0x60')][_0xe233('0x114')](db['OpenchannelQueue'],{});db['ChatApplication'][_0xe233('0x114')](db[_0xe233('0x102')],{'as':'Agent','foreignKey':'UserId','onDelete':_0xe233('0x169')});db['ChatApplication']['belongsTo'](db[_0xe233('0x123')],{'as':_0xe233('0x184'),'foreignKey':_0xe233('0x185'),'onDelete':_0xe233('0x169')});db[_0xe233('0x61')]['belongsTo'](db['ChatWebsite'],{'as':_0xe233('0x186'),'foreignKey':_0xe233('0x166'),'onDelete':_0xe233('0x169')});db[_0xe233('0x61')]['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0xe233('0x16f')});db[_0xe233('0x183')][_0xe233('0x106')](db[_0xe233('0x63')],{'as':'Messages','onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x187')});db['ChatInteraction'][_0xe233('0x114')](db[_0xe233('0x12c')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0xe233('0x183')]['belongsTo'](db['CmContact'],{'as':_0xe233('0x153'),'foreignKey':_0xe233('0x15e')});db[_0xe233('0x183')]['belongsTo'](db[_0xe233('0x102')],{'as':_0xe233('0x15f'),'foreignKey':_0xe233('0x105')});db[_0xe233('0x183')][_0xe233('0x117')](db[_0xe233('0x83')],{'through':_0xe233('0x188'),'as':_0xe233('0x171')});db[_0xe233('0x183')]['belongsToMany'](db[_0xe233('0x83')],{'through':'chat_interaction_has_tags','as':_0xe233('0x161')});db[_0xe233('0x183')][_0xe233('0x117')](db['User'],{'as':_0xe233('0x162'),'through':'user_has_chat_interactions','foreignKey':_0xe233('0x187')});db['ChatMessage'][_0xe233('0x114')](db[_0xe233('0x102')],{'onDelete':_0xe233('0x104'),'as':_0xe233('0x102')});db[_0xe233('0x63')][_0xe233('0x114')](db['CmContact'],{'onDelete':_0xe233('0x104'),'as':'Contact','foreignKey':'ContactId'});db['ChatMessage']['belongsTo'](db['ChatInteraction'],{'onDelete':'cascade','as':_0xe233('0x164'),'foreignKey':_0xe233('0x187')});db[_0xe233('0x63')]['belongsTo'](db[_0xe233('0xe4')],{'as':_0xe233('0xe4'),'foreignKey':'AttachmentId'});db[_0xe233('0x63')][_0xe233('0x114')](db['ChatWebsite'],{'as':_0xe233('0x15d'),'foreignKey':_0xe233('0x166')});db[_0xe233('0x65')][_0xe233('0x114')](db['CmContact'],{'onDelete':_0xe233('0x104'),'as':'Contact','foreignKey':_0xe233('0x15e')});db[_0xe233('0x65')][_0xe233('0x114')](db['ChatWebsite'],{'as':_0xe233('0x15d'),'foreignKey':_0xe233('0x166')});db[_0xe233('0x123')]['belongsToMany'](db[_0xe233('0x102')],{'as':_0xe233('0x149'),'through':_0xe233('0x2f'),'hooks':!![]});db['ChatQueue'][_0xe233('0x117')](db[_0xe233('0xdc')],{'through':'team_has_chat_queues','as':_0xe233('0x14a')});db[_0xe233('0x68')]['hasMany'](db[_0xe233('0x189')],{'as':_0xe233('0x14e'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db[_0xe233('0x68')][_0xe233('0x117')](db[_0xe233('0x102')],{'as':_0xe233('0x18a'),'through':_0xe233('0x116')});db['ChatProactiveAction'][_0xe233('0x114')](db[_0xe233('0x12c')],{'as':_0xe233('0x186'),'foreignKey':'ChatWebsiteId'});db[_0xe233('0x6b')][_0xe233('0x106')](db['CmContact'],{'as':_0xe233('0x118'),'foreignKey':_0xe233('0x18b')});db[_0xe233('0x6d')][_0xe233('0x106')](db['CmHopper'],{'as':_0xe233('0x13f'),'foreignKey':_0xe233('0x15e')});db[_0xe233('0x6d')][_0xe233('0x106')](db[_0xe233('0x70')],{'as':_0xe233('0x10a'),'foreignKey':'ContactId'});db[_0xe233('0x6d')][_0xe233('0x106')](db[_0xe233('0x10b')],{'as':'HopperHistories','foreignKey':_0xe233('0x15e')});db['CmContact'][_0xe233('0x106')](db[_0xe233('0x73')],{'as':_0xe233('0x73'),'foreignKey':'ContactId'});db[_0xe233('0x6d')]['hasMany'](db['JscriptySessionReport'],{'as':'JscriptySessions','foreignKey':'ContactId'});db[_0xe233('0x6d')][_0xe233('0x106')](db[_0xe233('0x59')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0xe233('0x169')});db[_0xe233('0x6d')][_0xe233('0x106')](db[_0xe233('0x183')],{'as':_0xe233('0x10e'),'foreignKey':_0xe233('0x15e'),'onDelete':_0xe233('0x169')});db[_0xe233('0x6d')][_0xe233('0x106')](db[_0xe233('0x53')],{'as':'SmsInteractions','foreignKey':_0xe233('0x15e'),'onDelete':_0xe233('0x169')});db[_0xe233('0x6d')][_0xe233('0x106')](db[_0xe233('0x49')],{'as':_0xe233('0x110'),'foreignKey':_0xe233('0x15e'),'onDelete':_0xe233('0x169')});db[_0xe233('0x6d')]['hasMany'](db['MailInteraction'],{'as':_0xe233('0x111'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xe233('0x6d')][_0xe233('0x114')](db[_0xe233('0x6b')],{'as':_0xe233('0x18c'),'foreignKey':_0xe233('0x18b')});db['CmContact'][_0xe233('0x114')](db[_0xe233('0xed')],{'as':'List','foreignKey':_0xe233('0x16a'),'onDelete':'cascade'});db[_0xe233('0x6d')][_0xe233('0x117')](db[_0xe233('0x102')],{'as':_0xe233('0x162'),'through':_0xe233('0x18d')});db[_0xe233('0x6d')][_0xe233('0x117')](db[_0xe233('0x83')],{'as':_0xe233('0x171'),'through':_0xe233('0x18e')});db[_0xe233('0x6d')][_0xe233('0x117')](db['Tag'],{'through':_0xe233('0x18e'),'as':'ThroughTags'});db[_0xe233('0x6e')]['belongsTo'](db[_0xe233('0x6d')],{'as':_0xe233('0x153'),'foreignKey':_0xe233('0x15e'),'onDelete':_0xe233('0x104')});db[_0xe233('0x6e')][_0xe233('0x114')](db[_0xe233('0xed')],{'as':'List','foreignKey':'ListId','onDelete':_0xe233('0x104')});db['CmHopper'][_0xe233('0x114')](db['User'],{'as':_0xe233('0x18f'),'foreignKey':_0xe233('0x105')});db[_0xe233('0x6e')][_0xe233('0x114')](db[_0xe233('0x11f')],{'as':_0xe233('0x184'),'foreignKey':'VoiceQueueId','onDelete':_0xe233('0x104')});db['CmHopper'][_0xe233('0x114')](db['Campaign'],{'as':_0xe233('0xe0'),'foreignKey':'CampaignId','onDelete':_0xe233('0x104')});db['CmHopper']['belongsTo'](db[_0xe233('0x102')],{'as':_0xe233('0x15f'),'foreignKey':_0xe233('0x190')});db[_0xe233('0x6f')][_0xe233('0x114')](db[_0xe233('0x6d')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0xe233('0x104')});db[_0xe233('0x6f')][_0xe233('0x114')](db[_0xe233('0xed')],{'as':_0xe233('0x158'),'foreignKey':'ListId','onDelete':_0xe233('0x104')});db[_0xe233('0x6f')][_0xe233('0x114')](db['VoiceQueue'],{'as':_0xe233('0x184'),'foreignKey':_0xe233('0x13e'),'onDelete':_0xe233('0x104')});db[_0xe233('0x6f')][_0xe233('0x114')](db[_0xe233('0xe0')],{'as':'Campaign','foreignKey':_0xe233('0x191'),'onDelete':_0xe233('0x104')});db[_0xe233('0x77')][_0xe233('0x106')](db[_0xe233('0x7d')],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0xe233('0x192'),'onDelete':_0xe233('0x104'),'hooks':!![]});db[_0xe233('0x77')][_0xe233('0x106')](db[_0xe233('0x7d')],{'as':{'plural':_0xe233('0x193'),'singular':_0xe233('0x194')},'foreignKey':_0xe233('0x195'),'onDelete':_0xe233('0x104'),'hooks':!![]});db[_0xe233('0x77')][_0xe233('0x106')](db[_0xe233('0x76')],{'as':_0xe233('0x196'),'foreignKey':_0xe233('0x197'),'onDelete':_0xe233('0x104'),'hooks':!![]});db['Disposition']['hasMany'](db[_0xe233('0x7b')],{'as':_0xe233('0x174'),'foreignKey':_0xe233('0x198'),'onDelete':_0xe233('0x104')});db[_0xe233('0x7e')][_0xe233('0x106')](db[_0xe233('0x7e')],{'as':'Intervals','foreignKey':_0xe233('0x146'),'onDelete':_0xe233('0x104'),'hooks':!![],'required':![]});db[_0xe233('0x7e')][_0xe233('0x106')](db[_0xe233('0x17')],{'as':_0xe233('0x109'),'foreignKey':_0xe233('0x146'),'onDelete':_0xe233('0x169')});db[_0xe233('0x7e')][_0xe233('0x106')](db[_0xe233('0x168')],{'as':'MailApplications','foreignKey':_0xe233('0x146')});db['Interval'][_0xe233('0x106')](db['ChatApplication'],{'as':_0xe233('0x199'),'foreignKey':'IntervalId'});db[_0xe233('0x7e')]['hasMany'](db[_0xe233('0x16e')],{'as':_0xe233('0x19a'),'foreignKey':'IntervalId'});db[_0xe233('0x7e')][_0xe233('0x106')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0xe233('0x146')});db[_0xe233('0x81')][_0xe233('0x114')](db[_0xe233('0x38')],{});db[_0xe233('0x81')][_0xe233('0x114')](db[_0xe233('0x8c')],{'foreignKey':_0xe233('0x19b')});db[_0xe233('0x81')]['belongsTo'](db[_0xe233('0x8a')],{'foreignKey':_0xe233('0x19c')});db[_0xe233('0x13d')][_0xe233('0x117')](db['VoiceMusicOnHold'],{'as':_0xe233('0x19d'),'through':'moh_has_sounds','onDelete':_0xe233('0x169')});db[_0xe233('0x83')][_0xe233('0x117')](db[_0xe233('0x6d')],{'through':_0xe233('0x18e')});db['Tag'][_0xe233('0x117')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db['Tag']['belongsToMany'](db[_0xe233('0x3c')],{'through':_0xe233('0x160')});db[_0xe233('0x83')][_0xe233('0x117')](db['SmsInteraction'],{'through':_0xe233('0x176')});db[_0xe233('0x83')][_0xe233('0x117')](db[_0xe233('0x49')],{'through':_0xe233('0x172')});db[_0xe233('0x83')][_0xe233('0x117')](db[_0xe233('0x59')],{'through':'openchannel_interaction_has_tags'});db[_0xe233('0x83')]['belongsToMany'](db['WhatsappInteraction'],{'through':'whatsapp_interaction_has_tags'});db[_0xe233('0x86')][_0xe233('0x106')](db['Condition'],{'as':{'plural':_0xe233('0x19e'),'singular':_0xe233('0x19f')},'foreignKey':_0xe233('0x1a0'),'onDelete':_0xe233('0x104'),'hooks':!![]});db[_0xe233('0x86')]['hasMany'](db[_0xe233('0x7d')],{'as':{'plural':'AnyConditions','singular':_0xe233('0x1a1')},'foreignKey':_0xe233('0x1a2'),'onDelete':_0xe233('0x104'),'hooks':!![]});db[_0xe233('0x86')]['hasMany'](db[_0xe233('0x76')],{'as':_0xe233('0x196'),'foreignKey':_0xe233('0x1a3'),'onDelete':'cascade','hooks':!![]});db[_0xe233('0x8a')][_0xe233('0x106')](db[_0xe233('0x92')],{'as':'Fields','onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x19c'),'hooks':!![]});db[_0xe233('0x8c')]['hasMany'](db[_0xe233('0x92')],{'as':_0xe233('0x1a4'),'onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x19b')});db[_0xe233('0x90')]['hasMany'](db[_0xe233('0x92')],{'as':_0xe233('0x1a4'),'onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x1a5')});db[_0xe233('0x92')]['belongsTo'](db[_0xe233('0x90')],{'foreignKey':_0xe233('0x1a5')});db['SalesforceAccount'][_0xe233('0x106')](db[_0xe233('0x96')],{'as':_0xe233('0x1a6'),'onDelete':'cascade','foreignKey':_0xe233('0x1a7')});db['SalesforceConfiguration'][_0xe233('0x106')](db['SalesforceField'],{'as':_0xe233('0x1a8'),'onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x1a9')});db[_0xe233('0x96')][_0xe233('0x106')](db[_0xe233('0x1aa')],{'as':_0xe233('0x1ab'),'onDelete':'cascade','foreignKey':_0xe233('0x1ac')});db[_0xe233('0x96')][_0xe233('0x106')](db[_0xe233('0x1aa')],{'as':'Fields','onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x1ad')});db['SalesforceConfiguration'][_0xe233('0x114')](db['SalesforceAccount'],{'as':_0xe233('0x15d'),'foreignKey':_0xe233('0x1a7')});db[_0xe233('0x1aa')][_0xe233('0x106')](db[_0xe233('0x1aa')],{'as':_0xe233('0x1ae'),'foreignKey':'SubjectId'});db[_0xe233('0x1aa')][_0xe233('0x106')](db[_0xe233('0x1aa')],{'as':'Description','foreignKey':_0xe233('0x1ac')});db[_0xe233('0x1aa')][_0xe233('0x106')](db[_0xe233('0x1aa')],{'as':_0xe233('0x1af'),'foreignKey':_0xe233('0x1ad')});db['SalesforceField'][_0xe233('0x114')](db['Variable'],{'as':_0xe233('0x1b0'),'foreignKey':_0xe233('0x1b1')});db[_0xe233('0x99')][_0xe233('0x106')](db[_0xe233('0x1b2')],{'as':_0xe233('0x1a6'),'onDelete':'cascade','foreignKey':_0xe233('0x1a7')});db[_0xe233('0x1b2')][_0xe233('0x106')](db[_0xe233('0x9c')],{'as':_0xe233('0x1a8'),'onDelete':'cascade','foreignKey':_0xe233('0x1a9')});db['SugarcrmConfiguration'][_0xe233('0x106')](db[_0xe233('0x9c')],{'as':_0xe233('0x1ab'),'onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x1ac')});db[_0xe233('0x1b2')][_0xe233('0x106')](db[_0xe233('0x9c')],{'as':_0xe233('0x1a4'),'onDelete':'cascade','foreignKey':_0xe233('0x1ad')});db[_0xe233('0x1b2')][_0xe233('0x114')](db[_0xe233('0x99')],{'as':_0xe233('0x15d'),'foreignKey':'AccountId'});db[_0xe233('0x9c')][_0xe233('0x106')](db[_0xe233('0x9c')],{'as':'Subject','foreignKey':_0xe233('0x1a9')});db[_0xe233('0x9c')][_0xe233('0x106')](db[_0xe233('0x9c')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xe233('0x9c')][_0xe233('0x106')](db[_0xe233('0x9c')],{'as':_0xe233('0x1af'),'foreignKey':_0xe233('0x1ad')});db[_0xe233('0x9c')]['belongsTo'](db[_0xe233('0x1b0')],{'as':_0xe233('0x1b0'),'foreignKey':_0xe233('0x1b1')});db[_0xe233('0x9d')]['hasMany'](db[_0xe233('0x9f')],{'as':_0xe233('0x1a6'),'onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x1a7')});db[_0xe233('0x9f')][_0xe233('0x106')](db[_0xe233('0xa0')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xe233('0x1a9')});db['DeskConfiguration'][_0xe233('0x106')](db[_0xe233('0xa0')],{'as':_0xe233('0x1ab'),'onDelete':'cascade','foreignKey':_0xe233('0x1ac')});db[_0xe233('0x9f')]['hasMany'](db[_0xe233('0xa0')],{'as':_0xe233('0x1a4'),'onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x1ad')});db['DeskConfiguration'][_0xe233('0x114')](db['DeskAccount'],{'as':_0xe233('0x15d'),'foreignKey':_0xe233('0x1a7')});db['DeskConfiguration'][_0xe233('0x117')](db['Tag'],{'through':_0xe233('0x1b3')});db[_0xe233('0xa0')][_0xe233('0x106')](db[_0xe233('0xa0')],{'as':_0xe233('0x1ae'),'foreignKey':_0xe233('0x1a9')});db[_0xe233('0xa0')][_0xe233('0x106')](db[_0xe233('0xa0')],{'as':_0xe233('0x1b4'),'foreignKey':_0xe233('0x1ac')});db[_0xe233('0xa0')][_0xe233('0x106')](db[_0xe233('0xa0')],{'as':_0xe233('0x1af'),'foreignKey':'FieldId'});db['DeskField']['belongsTo'](db[_0xe233('0x1b0')],{'as':_0xe233('0x1b0'),'foreignKey':_0xe233('0x1b1')});db['ZohoAccount'][_0xe233('0x106')](db[_0xe233('0xa4')],{'as':_0xe233('0x1a6'),'onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x1a7')});db[_0xe233('0xa4')][_0xe233('0x106')](db[_0xe233('0xa6')],{'as':_0xe233('0x1a8'),'onDelete':'cascade','foreignKey':'SubjectId'});db['ZohoConfiguration'][_0xe233('0x106')](db['ZohoField'],{'as':_0xe233('0x1ab'),'onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x1ac')});db[_0xe233('0xa4')]['hasMany'](db['ZohoField'],{'as':_0xe233('0x1a4'),'onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x1ad')});db[_0xe233('0xa4')][_0xe233('0x114')](db[_0xe233('0xa2')],{'as':_0xe233('0x15d'),'foreignKey':_0xe233('0x1a7')});db[_0xe233('0xa6')][_0xe233('0x106')](db[_0xe233('0xa6')],{'as':_0xe233('0x1ae'),'foreignKey':'SubjectId'});db[_0xe233('0xa6')][_0xe233('0x106')](db['ZohoField'],{'as':_0xe233('0x1b4'),'foreignKey':'DescriptionId'});db[_0xe233('0xa6')][_0xe233('0x106')](db[_0xe233('0xa6')],{'as':_0xe233('0x1af'),'foreignKey':_0xe233('0x1ad')});db[_0xe233('0xa6')][_0xe233('0x114')](db[_0xe233('0x1b0')],{'as':_0xe233('0x1b0'),'foreignKey':_0xe233('0x1b1')});db[_0xe233('0xa8')][_0xe233('0x106')](db[_0xe233('0xaa')],{'as':_0xe233('0x1a6'),'onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x1a7')});db[_0xe233('0xaa')]['hasMany'](db[_0xe233('0x1b5')],{'as':_0xe233('0x1a8'),'foreignKey':_0xe233('0x1a9')});db[_0xe233('0xaa')][_0xe233('0x106')](db[_0xe233('0x1b5')],{'as':_0xe233('0x1ab'),'foreignKey':_0xe233('0x1ac')});db[_0xe233('0xaa')][_0xe233('0x106')](db['ZendeskField'],{'as':'Fields','foreignKey':_0xe233('0x1ad')});db[_0xe233('0xaa')][_0xe233('0x114')](db['ZendeskAccount'],{'as':_0xe233('0x15d'),'foreignKey':'AccountId'});db[_0xe233('0xaa')][_0xe233('0x117')](db['Tag'],{'through':_0xe233('0x1b6')});db[_0xe233('0x1b5')][_0xe233('0x106')](db[_0xe233('0x1b5')],{'as':_0xe233('0x1ae'),'foreignKey':_0xe233('0x1a9')});db[_0xe233('0x1b5')][_0xe233('0x106')](db[_0xe233('0x1b5')],{'as':_0xe233('0x1b4'),'foreignKey':_0xe233('0x1ac')});db['ZendeskField'][_0xe233('0x106')](db[_0xe233('0x1b5')],{'as':'Field','foreignKey':_0xe233('0x1ad')});db[_0xe233('0x1b5')]['belongsTo'](db[_0xe233('0x1b0')],{'as':'Variable','foreignKey':_0xe233('0x1b1')});db[_0xe233('0x1b7')][_0xe233('0x106')](db[_0xe233('0xac')],{'as':'Configurations','onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x1a7')});db['FreshdeskConfiguration'][_0xe233('0x106')](db[_0xe233('0xae')],{'as':_0xe233('0x1a8'),'onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x1a9')});db[_0xe233('0xac')][_0xe233('0x106')](db[_0xe233('0xae')],{'as':'Descriptions','onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x1ac')});db[_0xe233('0xac')][_0xe233('0x106')](db[_0xe233('0xae')],{'as':'Fields','onDelete':_0xe233('0x104'),'foreignKey':'FieldId'});db['FreshdeskConfiguration'][_0xe233('0x114')](db['FreshdeskAccount'],{'as':_0xe233('0x15d'),'foreignKey':_0xe233('0x1a7')});db[_0xe233('0xac')]['belongsToMany'](db['Tag'],{'through':'int_freshdesk_configuration_has_tags'});db[_0xe233('0xae')][_0xe233('0x106')](db[_0xe233('0xae')],{'as':'Subject','foreignKey':_0xe233('0x1a9')});db[_0xe233('0xae')][_0xe233('0x106')](db[_0xe233('0xae')],{'as':_0xe233('0x1b4'),'foreignKey':_0xe233('0x1ac')});db[_0xe233('0xae')][_0xe233('0x106')](db[_0xe233('0xae')],{'as':'Field','foreignKey':'FieldId'});db['FreshdeskField'][_0xe233('0x114')](db[_0xe233('0x1b0')],{'as':_0xe233('0x1b0'),'foreignKey':'VariableId'});db[_0xe233('0xb0')][_0xe233('0x106')](db[_0xe233('0xb2')],{'as':_0xe233('0x1a6'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xe233('0xb2')][_0xe233('0x106')](db['VtigerField'],{'as':'Subjects','foreignKey':_0xe233('0x1a9')});db['VtigerConfiguration'][_0xe233('0x106')](db[_0xe233('0x1b8')],{'as':_0xe233('0x1ab'),'foreignKey':_0xe233('0x1ac')});db[_0xe233('0xb2')][_0xe233('0x106')](db[_0xe233('0x1b8')],{'as':_0xe233('0x1a4'),'foreignKey':'FieldId'});db[_0xe233('0xb2')][_0xe233('0x114')](db[_0xe233('0xb0')],{'as':_0xe233('0x15d'),'foreignKey':'AccountId'});db[_0xe233('0x1b8')][_0xe233('0x106')](db[_0xe233('0x1b8')],{'as':_0xe233('0x1ae'),'foreignKey':'SubjectId'});db['VtigerField'][_0xe233('0x106')](db[_0xe233('0x1b8')],{'as':_0xe233('0x1b4'),'foreignKey':_0xe233('0x1ac')});db['VtigerField'][_0xe233('0x106')](db[_0xe233('0x1b8')],{'as':'Field','foreignKey':_0xe233('0x1ad')});db[_0xe233('0x1b8')][_0xe233('0x114')](db[_0xe233('0x1b0')],{'as':_0xe233('0x1b0'),'foreignKey':_0xe233('0x1b1')});db[_0xe233('0xb4')][_0xe233('0x106')](db[_0xe233('0xb6')],{'as':_0xe233('0x1a6'),'onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x1a7')});db['ServicenowConfiguration'][_0xe233('0x106')](db[_0xe233('0x1b9')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0xe233('0xb6')][_0xe233('0x106')](db['ServicenowField'],{'as':_0xe233('0x1ab'),'foreignKey':_0xe233('0x1ac')});db[_0xe233('0xb6')]['hasMany'](db[_0xe233('0x1b9')],{'as':_0xe233('0x1a4'),'foreignKey':_0xe233('0x1ad')});db[_0xe233('0xb6')][_0xe233('0x114')](db['ServicenowAccount'],{'as':'Account','foreignKey':_0xe233('0x1a7')});db[_0xe233('0x1b9')][_0xe233('0x106')](db[_0xe233('0x1b9')],{'as':'Subject','foreignKey':_0xe233('0x1a9')});db[_0xe233('0x1b9')]['hasMany'](db[_0xe233('0x1b9')],{'as':_0xe233('0x1b4'),'foreignKey':_0xe233('0x1ac')});db[_0xe233('0x1b9')][_0xe233('0x106')](db[_0xe233('0x1b9')],{'as':_0xe233('0x1af'),'foreignKey':_0xe233('0x1ad')});db[_0xe233('0x1b9')][_0xe233('0x114')](db[_0xe233('0x1b0')],{'as':'Variable','foreignKey':'VariableId'});db[_0xe233('0xb9')][_0xe233('0x106')](db[_0xe233('0xbb')],{'as':'Configurations','onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x1a7')});db['Dynamics365Configuration'][_0xe233('0x106')](db['Dynamics365Field'],{'as':_0xe233('0x1a8'),'onDelete':'cascade','foreignKey':_0xe233('0x1a9')});db[_0xe233('0xbb')][_0xe233('0x106')](db[_0xe233('0xbd')],{'as':_0xe233('0x1ab'),'onDelete':'cascade','foreignKey':_0xe233('0x1ac')});db['Dynamics365Configuration'][_0xe233('0x106')](db[_0xe233('0xbd')],{'as':_0xe233('0x1a4'),'onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x1ad')});db[_0xe233('0xbb')][_0xe233('0x114')](db[_0xe233('0xb9')],{'as':_0xe233('0x15d'),'foreignKey':_0xe233('0x1a7')});db[_0xe233('0xbd')][_0xe233('0x106')](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0xe233('0x1a9')});db['Dynamics365Field'][_0xe233('0x106')](db[_0xe233('0xbd')],{'as':_0xe233('0x1b4'),'foreignKey':'DescriptionId'});db['Dynamics365Field'][_0xe233('0x106')](db[_0xe233('0xbd')],{'as':_0xe233('0x1af'),'foreignKey':_0xe233('0x1ad')});db['Dynamics365Field'][_0xe233('0x114')](db[_0xe233('0x1b0')],{'as':_0xe233('0x1b0'),'foreignKey':_0xe233('0x1b1')});db[_0xe233('0xbf')]['hasMany'](db[_0xe233('0xc1')],{'as':_0xe233('0x1a6'),'onDelete':'cascade','foreignKey':_0xe233('0x1a7')});db['FreshsalesConfiguration']['hasMany'](db[_0xe233('0xc3')],{'as':'Subjects','foreignKey':_0xe233('0x1a9')});db[_0xe233('0xc1')][_0xe233('0x106')](db[_0xe233('0xc3')],{'as':_0xe233('0x1ab'),'foreignKey':_0xe233('0x1ac')});db['FreshsalesConfiguration']['hasMany'](db[_0xe233('0xc3')],{'as':_0xe233('0x1a4'),'foreignKey':_0xe233('0x1ad')});db['FreshsalesConfiguration'][_0xe233('0x114')](db['FreshsalesAccount'],{'as':_0xe233('0x15d'),'foreignKey':_0xe233('0x1a7')});db[_0xe233('0xc3')]['hasMany'](db[_0xe233('0xc3')],{'as':_0xe233('0x1ae'),'foreignKey':_0xe233('0x1a9')});db[_0xe233('0xc3')]['hasMany'](db[_0xe233('0xc3')],{'as':'Description','foreignKey':_0xe233('0x1ac')});db[_0xe233('0xc3')]['hasMany'](db['FreshsalesField'],{'as':_0xe233('0x1af'),'foreignKey':'FieldId'});db[_0xe233('0xc3')]['belongsTo'](db[_0xe233('0x1b0')],{'as':_0xe233('0x1b0'),'foreignKey':_0xe233('0x1b1')});db[_0xe233('0xc6')]['belongsTo'](db[_0xe233('0x12c')],{});db[_0xe233('0xc6')][_0xe233('0x114')](db[_0xe233('0xed')],{'as':_0xe233('0x158'),'foreignKey':_0xe233('0x16a')});db[_0xe233('0xc6')][_0xe233('0x114')](db[_0xe233('0x6d')],{'as':'Contact','foreignKey':_0xe233('0x15e')});db[_0xe233('0xc6')][_0xe233('0x114')](db[_0xe233('0x183')],{});db['ChatQueueReport']['belongsTo'](db[_0xe233('0x63')],{});db[_0xe233('0xc6')][_0xe233('0x114')](db[_0xe233('0x102')],{});db[_0xe233('0xc6')][_0xe233('0x114')](db['ChatQueue'],{});db[_0xe233('0x189')][_0xe233('0x114')](db['User'],{'onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x1ba')});db[_0xe233('0x189')]['belongsTo'](db[_0xe233('0x102')],{'onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x1bb')});db[_0xe233('0xcb')]['hasMany'](db[_0xe233('0xc9')],{'foreignKey':_0xe233('0x1bc'),'onDelete':_0xe233('0x104')});db[_0xe233('0xcb')]['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':_0xe233('0x104')});db[_0xe233('0xcd')][_0xe233('0x114')](db['SmsAccount'],{});db['SmsQueueReport']['belongsTo'](db['CmList'],{'as':_0xe233('0x158'),'foreignKey':_0xe233('0x16a')});db[_0xe233('0xcd')][_0xe233('0x114')](db[_0xe233('0x6d')],{'as':_0xe233('0x153'),'foreignKey':_0xe233('0x15e')});db['SmsQueueReport'][_0xe233('0x114')](db['SmsInteraction'],{});db[_0xe233('0xcd')][_0xe233('0x114')](db[_0xe233('0x54')],{});db[_0xe233('0xcd')][_0xe233('0x114')](db['User'],{});db['SmsQueueReport'][_0xe233('0x114')](db[_0xe233('0x126')],{});db[_0xe233('0xd2')][_0xe233('0x106')](db[_0xe233('0xcb')],{'foreignKey':_0xe233('0x1bd')});db['JscriptyProject'][_0xe233('0x106')](db[_0xe233('0xc9')],{'foreignKey':_0xe233('0x1bd')});db[_0xe233('0xd2')][_0xe233('0x106')](db[_0xe233('0x1be')],{'foreignKey':_0xe233('0x1bd')});db[_0xe233('0xd7')]['belongsToMany'](db[_0xe233('0x102')],{'as':_0xe233('0x162'),'through':_0xe233('0x13a')});db[_0xe233('0xdc')][_0xe233('0x117')](db[_0xe233('0x102')],{'as':'Agents','through':'user_has_teams'});db[_0xe233('0xdc')][_0xe233('0x117')](db[_0xe233('0x11f')],{'through':_0xe233('0x14b'),'as':_0xe233('0x120')});db[_0xe233('0xdc')]['belongsToMany'](db[_0xe233('0x121')],{'through':_0xe233('0x15c'),'as':_0xe233('0x122')});db['Team']['belongsToMany'](db[_0xe233('0x123')],{'through':_0xe233('0x1bf'),'as':_0xe233('0x124')});db['Team'][_0xe233('0x117')](db[_0xe233('0x4d')],{'through':'team_has_fax_queues','as':_0xe233('0x125')});db[_0xe233('0xdc')][_0xe233('0x117')](db['SmsQueue'],{'through':_0xe233('0x17a'),'as':_0xe233('0x1c0')});db[_0xe233('0xdc')][_0xe233('0x117')](db['OpenchannelQueue'],{'through':_0xe233('0x181'),'as':_0xe233('0x127')});db[_0xe233('0xdc')][_0xe233('0x117')](db[_0xe233('0xfe')],{'through':'team_has_whatsapp_queues','as':_0xe233('0x1c1')});db[_0xe233('0xe0')][_0xe233('0x106')](db[_0xe233('0x6e')],{'as':_0xe233('0x13f'),'foreignKey':_0xe233('0x191')});db['Campaign']['hasMany'](db[_0xe233('0x70')],{'as':_0xe233('0x10a'),'foreignKey':'CampaignId'});db[_0xe233('0xe0')][_0xe233('0x106')](db[_0xe233('0x10b')],{'as':_0xe233('0x1c2'),'foreignKey':'CampaignId'});db[_0xe233('0xe0')][_0xe233('0x106')](db[_0xe233('0x6f')],{'as':_0xe233('0x140'),'foreignKey':_0xe233('0x191')});db['Campaign'][_0xe233('0x114')](db[_0xe233('0x142')],{'as':_0xe233('0x142'),'foreignKey':'TrunkId'});db[_0xe233('0xe0')]['belongsTo'](db[_0xe233('0x142')],{'as':_0xe233('0x144'),'foreignKey':_0xe233('0x145')});db['Campaign'][_0xe233('0x114')](db[_0xe233('0x7e')],{'as':'Interval','foreignKey':_0xe233('0x146')});db[_0xe233('0xe0')]['belongsTo'](db[_0xe233('0xd7')],{'as':_0xe233('0xd7'),'foreignKey':_0xe233('0x1c3')});db[_0xe233('0xe0')][_0xe233('0x117')](db[_0xe233('0xed')],{'as':'Lists','through':'campaigns_has_cm_lists'});db['Campaign']['belongsToMany'](db[_0xe233('0xed')],{'as':_0xe233('0x14c'),'through':_0xe233('0x1c4')});db[_0xe233('0x1c5')][_0xe233('0x114')](db[_0xe233('0x3d')],{});db[_0xe233('0x1c5')]['belongsTo'](db[_0xe233('0x3c')],{});db[_0xe233('0x1c5')][_0xe233('0x114')](db[_0xe233('0x38')],{'foreignKey':_0xe233('0x1c6'),'as':_0xe233('0x1c7')});db['MailTransferReport'][_0xe233('0x114')](db[_0xe233('0x102')],{'foreignKey':'FromUserId','as':_0xe233('0x1c8')});db[_0xe233('0x1c5')][_0xe233('0x114')](db[_0xe233('0x102')],{'foreignKey':_0xe233('0x1c9'),'as':'ToAgent'});db['MailTransferReport'][_0xe233('0x114')](db[_0xe233('0x121')],{'foreignKey':'ToMailQueueId','as':_0xe233('0x1ca')});db[_0xe233('0x1c5')][_0xe233('0x114')](db[_0xe233('0x38')],{'foreignKey':'ToMailAccountId','as':_0xe233('0x1cb')});db[_0xe233('0xe7')][_0xe233('0x114')](db[_0xe233('0x63')],{});db[_0xe233('0xe7')]['belongsTo'](db[_0xe233('0x183')],{});db['ChatTransferReport'][_0xe233('0x114')](db[_0xe233('0x12c')],{'foreignKey':_0xe233('0x1cc'),'as':'FromAccount'});db[_0xe233('0xe7')]['belongsTo'](db['User'],{'foreignKey':_0xe233('0x1cd'),'as':'FromAgent'});db[_0xe233('0xe7')][_0xe233('0x114')](db[_0xe233('0x102')],{'foreignKey':_0xe233('0x1c9'),'as':_0xe233('0x1ce')});db[_0xe233('0xe7')][_0xe233('0x114')](db[_0xe233('0x123')],{'foreignKey':_0xe233('0x1cf'),'as':_0xe233('0x1ca')});db[_0xe233('0xe7')][_0xe233('0x114')](db[_0xe233('0x12c')],{'foreignKey':'ToChatWebsiteId','as':_0xe233('0x1cb')});db['FaxTransferReport'][_0xe233('0x114')](db[_0xe233('0x4b')],{});db[_0xe233('0xe9')]['belongsTo'](db[_0xe233('0x49')],{});db['FaxTransferReport'][_0xe233('0x114')](db[_0xe233('0x46')],{'foreignKey':_0xe233('0x1d0'),'as':_0xe233('0x1c7')});db[_0xe233('0xe9')][_0xe233('0x114')](db[_0xe233('0x102')],{'foreignKey':_0xe233('0x1cd'),'as':'FromAgent'});db[_0xe233('0xe9')][_0xe233('0x114')](db[_0xe233('0x102')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xe233('0xe9')][_0xe233('0x114')](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':_0xe233('0x1ca')});db[_0xe233('0xe9')][_0xe233('0x114')](db['FaxAccount'],{'foreignKey':'ToFaxAccountId','as':_0xe233('0x1cb')});db['OpenchannelTransferReport'][_0xe233('0x114')](db['OpenchannelMessage'],{});db[_0xe233('0x1d1')][_0xe233('0x114')](db[_0xe233('0x59')],{});db['OpenchannelTransferReport'][_0xe233('0x114')](db[_0xe233('0x17c')],{'foreignKey':_0xe233('0x1d2'),'as':_0xe233('0x1c7')});db[_0xe233('0x1d1')][_0xe233('0x114')](db[_0xe233('0x102')],{'foreignKey':_0xe233('0x1cd'),'as':_0xe233('0x1c8')});db[_0xe233('0x1d1')]['belongsTo'](db[_0xe233('0x102')],{'foreignKey':_0xe233('0x1c9'),'as':_0xe233('0x1ce')});db['OpenchannelTransferReport'][_0xe233('0x114')](db[_0xe233('0x5d')],{'foreignKey':_0xe233('0x1d3'),'as':_0xe233('0x1ca')});db[_0xe233('0x1d1')][_0xe233('0x114')](db[_0xe233('0x17c')],{'foreignKey':'ToOpenchannelAccountId','as':_0xe233('0x1cb')});db['SmsTransferReport']['belongsTo'](db[_0xe233('0x54')],{});db[_0xe233('0x1d4')][_0xe233('0x114')](db[_0xe233('0x53')],{});db[_0xe233('0x1d4')]['belongsTo'](db[_0xe233('0x51')],{'foreignKey':_0xe233('0x1d5'),'as':_0xe233('0x1c7')});db['SmsTransferReport'][_0xe233('0x114')](db['User'],{'foreignKey':_0xe233('0x1cd'),'as':_0xe233('0x1c8')});db['SmsTransferReport']['belongsTo'](db[_0xe233('0x102')],{'foreignKey':_0xe233('0x1c9'),'as':'ToAgent'});db[_0xe233('0x1d4')]['belongsTo'](db[_0xe233('0x126')],{'foreignKey':_0xe233('0x1d6'),'as':'ToQueue'});db[_0xe233('0x1d4')]['belongsTo'](db[_0xe233('0x51')],{'foreignKey':_0xe233('0x1d7'),'as':'ToAccount'});db[_0xe233('0xed')][_0xe233('0x106')](db[_0xe233('0x7b')],{'as':_0xe233('0x174'),'foreignKey':_0xe233('0x16a')});db[_0xe233('0xed')][_0xe233('0x106')](db[_0xe233('0x75')],{'as':_0xe233('0x1d8'),'foreignKey':_0xe233('0x16a')});db[_0xe233('0xed')]['hasMany'](db[_0xe233('0x6d')],{'as':'Contacts','onDelete':'cascade','foreignKey':_0xe233('0x16a')});db[_0xe233('0xed')][_0xe233('0x106')](db[_0xe233('0x70')],{'as':_0xe233('0x10a'),'foreignKey':_0xe233('0x16a')});db[_0xe233('0xed')][_0xe233('0x106')](db[_0xe233('0x10b')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList']['hasMany'](db[_0xe233('0x73')],{'as':_0xe233('0x73'),'foreignKey':_0xe233('0x16a')});db[_0xe233('0xed')][_0xe233('0x117')](db[_0xe233('0x11f')],{'as':_0xe233('0x1d9'),'through':_0xe233('0x148')});db[_0xe233('0xed')]['belongsToMany'](db[_0xe233('0x102')],{'as':_0xe233('0x149'),'through':_0xe233('0x11a')});db['VoicePrefix'][_0xe233('0x106')](db[_0xe233('0x17')],{'as':_0xe233('0x109'),'onDelete':_0xe233('0x104')});db[_0xe233('0x12a')][_0xe233('0x117')](db[_0xe233('0x102')],{'as':_0xe233('0x149'),'through':_0xe233('0x1da')});db[_0xe233('0xef')][_0xe233('0x106')](db['User'],{'as':_0xe233('0x162'),'foreignKey':_0xe233('0x1db')});db['UserProfile'][_0xe233('0x106')](db[_0xe233('0xf1')],{'as':_0xe233('0x1dc'),'foreignKey':_0xe233('0x1db'),'onDelete':_0xe233('0x104')});db[_0xe233('0xf1')]['hasMany'](db[_0xe233('0x1dd')],{'as':_0xe233('0x1de'),'foreignKey':_0xe233('0x1df'),'onDelete':'cascade'});db[_0xe233('0x137')][_0xe233('0x106')](db['Disposition'],{'as':_0xe233('0x174'),'foreignKey':_0xe233('0x1e0')});db['WhatsappAccount'][_0xe233('0x106')](db[_0xe233('0x79')],{'as':_0xe233('0x16c'),'foreignKey':'WhatsappAccountId'});db[_0xe233('0x137')]['hasMany'](db[_0xe233('0xf9')],{'as':'Messages','foreignKey':_0xe233('0x1e0')});db[_0xe233('0x137')][_0xe233('0x106')](db[_0xe233('0xf8')],{'as':'Interactions'});db['WhatsappAccount']['hasMany'](db[_0xe233('0xf6')],{'as':_0xe233('0x13c')});db[_0xe233('0x137')][_0xe233('0x114')](db[_0xe233('0xed')],{'as':_0xe233('0x158'),'foreignKey':_0xe233('0x16a')});db[_0xe233('0x137')][_0xe233('0x114')](db[_0xe233('0x17d')],{'as':_0xe233('0x15b'),'foreignKey':_0xe233('0x147')});db[_0xe233('0x137')][_0xe233('0x117')](db[_0xe233('0x102')],{'as':'Agents','through':_0xe233('0x139')});db[_0xe233('0xf6')]['belongsTo'](db['User'],{'onDelete':_0xe233('0x169')});db[_0xe233('0xf6')][_0xe233('0x114')](db[_0xe233('0xfe')],{'onDelete':_0xe233('0x169')});db[_0xe233('0xf6')][_0xe233('0x114')](db[_0xe233('0x137')],{'onDelete':_0xe233('0x169')});db['WhatsappApplication'][_0xe233('0x114')](db[_0xe233('0x7e')],{'onDelete':_0xe233('0x169'),'foreignKey':'IntervalId'});db['WhatsappApplication']['belongsTo'](db[_0xe233('0x83')],{'onDelete':'restrict','foreignKey':_0xe233('0x16f')});db[_0xe233('0xf8')]['hasMany'](db['WhatsappMessage'],{'as':'Messages','onDelete':_0xe233('0x104'),'foreignKey':_0xe233('0x1e1')});db[_0xe233('0xf8')]['belongsTo'](db[_0xe233('0x137')],{'as':'Account','foreignKey':_0xe233('0x1e0')});db[_0xe233('0xf8')]['belongsTo'](db[_0xe233('0x6d')],{'as':_0xe233('0x153'),'foreignKey':_0xe233('0x15e')});db[_0xe233('0xf8')]['belongsTo'](db[_0xe233('0x102')],{'as':_0xe233('0x15f'),'foreignKey':_0xe233('0x105')});db[_0xe233('0xf8')][_0xe233('0x117')](db[_0xe233('0x83')],{'through':'whatsapp_interaction_has_tags','as':_0xe233('0x171')});db['WhatsappInteraction'][_0xe233('0x117')](db[_0xe233('0x83')],{'through':_0xe233('0x1e2'),'as':_0xe233('0x161')});db['WhatsappInteraction'][_0xe233('0x117')](db['User'],{'as':_0xe233('0x162'),'through':'user_has_whatsapp_interactions','foreignKey':_0xe233('0x1e1')});db[_0xe233('0xf9')][_0xe233('0x114')](db[_0xe233('0x102')],{'as':_0xe233('0x102')});db[_0xe233('0xf9')][_0xe233('0x114')](db['CmContact'],{'onDelete':'cascade','as':_0xe233('0x153')});db[_0xe233('0xf9')]['belongsTo'](db[_0xe233('0xf8')],{'onDelete':_0xe233('0x104'),'as':'Interaction','foreignKey':'WhatsappInteractionId'});db[_0xe233('0xf9')][_0xe233('0x114')](db[_0xe233('0x137')],{'as':_0xe233('0x15d'),'foreignKey':_0xe233('0x1e0')});db['WhatsappQueueReport'][_0xe233('0x114')](db['WhatsappAccount'],{});db[_0xe233('0x1e3')]['belongsTo'](db[_0xe233('0xed')],{'as':_0xe233('0x158'),'foreignKey':_0xe233('0x16a')});db['WhatsappQueueReport']['belongsTo'](db[_0xe233('0x6d')],{'as':'Contact','foreignKey':'ContactId'});db[_0xe233('0x1e3')][_0xe233('0x114')](db[_0xe233('0xf8')],{});db[_0xe233('0x1e3')][_0xe233('0x114')](db['WhatsappQueue'],{});db[_0xe233('0x1e3')][_0xe233('0x114')](db[_0xe233('0xf9')],{});db['WhatsappQueueReport'][_0xe233('0x114')](db[_0xe233('0x102')],{});db['WhatsappTransferReport'][_0xe233('0x114')](db[_0xe233('0xf9')],{});db[_0xe233('0xfc')]['belongsTo'](db['WhatsappInteraction'],{});db['WhatsappTransferReport'][_0xe233('0x114')](db['WhatsappAccount'],{'foreignKey':_0xe233('0x1e4'),'as':_0xe233('0x1c7')});db[_0xe233('0xfc')]['belongsTo'](db[_0xe233('0x137')],{'foreignKey':'ToWhatsappAccountId','as':_0xe233('0x1cb')});db[_0xe233('0xfc')][_0xe233('0x114')](db[_0xe233('0xfe')],{'foreignKey':'ToQueueId','as':_0xe233('0x1ca')});db[_0xe233('0xfc')][_0xe233('0x114')](db[_0xe233('0x102')],{'foreignKey':'FromUserId','as':_0xe233('0x1c8')});db[_0xe233('0xfc')]['belongsTo'](db[_0xe233('0x102')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xe233('0xfe')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xe233('0x129'),'foreignKey':_0xe233('0x1e5')});db[_0xe233('0xfe')][_0xe233('0x117')](db['Team'],{'through':'team_has_whatsapp_queues','as':'Teams'});module[_0xe233('0x1e6')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index e4f18ba..62f2cae 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb1f=['/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/license','/api/campaigns','./api/campaign','./api/migration','/api/attachments','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/auth/local','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','join','root','/www','static','/demo','snippet','1.0.16','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','password','apiKey','firstName','lastName','street','phone','fax','clientId','clientSecret','code','accessKey','tenantId','channelSecret','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','calleridnum','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','registry','isArray','isPlainObject','isString','@@{','replace','includes','lodash','path','express','express-winston','util','./errors','api','./config/logger','default','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','method','x-forwarded-for','headers','connection','remoteAddress','url','statusCode','responseTime','user','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','name','other','agent_name','test','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceMusicOnHold','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/cmCustomField','/api/actions','./api/action','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/templates','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc'];(function(_0x1e7b2e,_0x400f3e){var _0x4e3afd=function(_0x5d69e4){while(--_0x5d69e4){_0x1e7b2e['push'](_0x1e7b2e['shift']());}};_0x4e3afd(++_0x400f3e);}(_0xbb1f,0x68));var _0xfbb1=function(_0x3145af,_0x53a1d5){_0x3145af=_0x3145af-0x0;var _0x37758a=_0xbb1f[_0x3145af];return _0x37758a;};'use strict';var _=require(_0xfbb1('0x0'));var path=require(_0xfbb1('0x1'));var express=require(_0xfbb1('0x2'));var ewinston=require(_0xfbb1('0x3'));var util=require(_0xfbb1('0x4'));var errors=require(_0xfbb1('0x5'));var config=require('./config/environment');var logger=require('./config/logger')(_0xfbb1('0x6'));var authLogger=require(_0xfbb1('0x7'))('auth');exports[_0xfbb1('0x8')]=function(_0x211722){_0x211722['use'](ewinston[_0xfbb1('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x5f4878,_0x1bd9e1){var _0x59b36a=_0xfbb1('0xa');if(!_[_0xfbb1('0xb')](_0x5f4878[_0xfbb1('0xc')])){_0x59b36a+=_0xfbb1('0xd');var _0x401f5c=_0x5f4878[_0xfbb1('0xc')];maskSensitiveData(_0x401f5c);}return util['format'](_0x59b36a,_0x5f4878[_0xfbb1('0xe')],_0x5f4878['headers'][_0xfbb1('0xf')]?_0x5f4878[_0xfbb1('0x10')][_0xfbb1('0xf')]:_0x5f4878[_0xfbb1('0x11')][_0xfbb1('0x12')]||_0x5f4878['ip'],_0x5f4878[_0xfbb1('0x13')],_0x1bd9e1[_0xfbb1('0x14')],_0x1bd9e1[_0xfbb1('0x15')],_0x5f4878[_0xfbb1('0x16')]?_0x5f4878['user']['id']:null,_0x5f4878[_0xfbb1('0x16')]?_0x5f4878[_0xfbb1('0x16')]['name']:null,_0x5f4878[_0xfbb1('0x16')]?_0x5f4878[_0xfbb1('0x16')][_0xfbb1('0x17')]:null,_0x401f5c?util['inspect'](_0x401f5c,![],null):'');}}));_0x211722['use'](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x18ab61,_0x24e9c4){var _0x56475b=_0xfbb1('0x18');if(_0x18ab61[_0xfbb1('0xc')]&&_0x18ab61['body'][_0xfbb1('0x19')]&&_0x18ab61[_0xfbb1('0xc')][_0xfbb1('0x1a')]){_0x56475b=_0xfbb1('0x1b');}return util[_0xfbb1('0x1c')](_0x56475b,_0x18ab61['method'],_0x18ab61['headers'][_0xfbb1('0xf')]?_0x18ab61[_0xfbb1('0x10')][_0xfbb1('0xf')]:_0x18ab61['connection'][_0xfbb1('0x12')]||_0x18ab61['ip'],_0x18ab61[_0xfbb1('0x13')],_0x24e9c4[_0xfbb1('0x14')],_0x24e9c4[_0xfbb1('0x15')],_0x18ab61[_0xfbb1('0x16')]?_0x18ab61[_0xfbb1('0x16')]['id']:null,_0x18ab61[_0xfbb1('0x16')]?_0x18ab61['user'][_0xfbb1('0x1d')]:null,_0x18ab61['user']?_0x18ab61[_0xfbb1('0x16')][_0xfbb1('0x17')]:null,_0x18ab61[_0xfbb1('0xc')]&&_0x18ab61[_0xfbb1('0xc')][_0xfbb1('0x19')]?_0x18ab61[_0xfbb1('0xc')]['device']:_0xfbb1('0x1e'),_0x18ab61[_0xfbb1('0xc')]&&_0x18ab61[_0xfbb1('0xc')][_0xfbb1('0x1a')]?_0x18ab61[_0xfbb1('0xc')][_0xfbb1('0x1a')]:'',_0x18ab61[_0xfbb1('0xc')]&&_0x18ab61[_0xfbb1('0xc')][_0xfbb1('0x1f')]?_0x18ab61[_0xfbb1('0xc')][_0xfbb1('0x1f')]:'');},'ignoreRoute':function(_0x3971fc){var _0x2e1cbb=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2e1cbb[_0xfbb1('0x20')](_0x3971fc['url']);}}));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x22'),require(_0xfbb1('0x23')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x24'),require(_0xfbb1('0x25')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x26'),require(_0xfbb1('0x27')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x28'),require('./api/voiceExtension'));_0x211722['use']('/api/voice/mohs',require(_0xfbb1('0x29')));_0x211722['use']('/api/voice/queues',require(_0xfbb1('0x2a')));_0x211722[_0xfbb1('0x21')]('/api/voice/recordings',require(_0xfbb1('0x2b')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x2c'),require(_0xfbb1('0x2d')));_0x211722['use'](_0xfbb1('0x2e'),require('./api/voiceMail'));_0x211722[_0xfbb1('0x21')]('/api/voice/mails/messages',require(_0xfbb1('0x2f')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x30'),require(_0xfbb1('0x31')));_0x211722['use']('/api/voice/dials/reports',require(_0xfbb1('0x32')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x33'),require(_0xfbb1('0x34')));_0x211722[_0xfbb1('0x21')]('/api/voice/queues/reports',require(_0xfbb1('0x35')));_0x211722[_0xfbb1('0x21')]('/api/members/reports',require('./api/memberReport'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x36'),require(_0xfbb1('0x37')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x38'),require('./api/voiceTransferReport'));_0x211722[_0xfbb1('0x21')]('/api/mail/out_servers',require(_0xfbb1('0x39')));_0x211722['use']('/api/mail/accounts',require(_0xfbb1('0x3a')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x3b'),require(_0xfbb1('0x3c')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x3d'),require(_0xfbb1('0x3e')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x3f'),require('./api/mailInteraction'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x40'),require('./api/mailMessage'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x41'),require(_0xfbb1('0x42')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x43'),require(_0xfbb1('0x44')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x45'),require(_0xfbb1('0x46')));_0x211722[_0xfbb1('0x21')]('/api/dashboards/items',require(_0xfbb1('0x47')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x48'),require(_0xfbb1('0x49')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x4a'),require(_0xfbb1('0x4b')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x4c'),require(_0xfbb1('0x4d')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x4e'),require(_0xfbb1('0x4f')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x50'),require(_0xfbb1('0x51')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x52'),require(_0xfbb1('0x53')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x54'),require(_0xfbb1('0x55')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x56'),require(_0xfbb1('0x57')));_0x211722['use'](_0xfbb1('0x58'),require(_0xfbb1('0x59')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x5a'),require(_0xfbb1('0x5b')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x5c'),require('./api/smsQueue'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x5d'),require('./api/openchannelAccount'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x5e'),require(_0xfbb1('0x5f')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x60'),require('./api/openchannelInteraction'));_0x211722['use'](_0xfbb1('0x61'),require(_0xfbb1('0x62')));_0x211722['use'](_0xfbb1('0x63'),require(_0xfbb1('0x64')));_0x211722[_0xfbb1('0x21')]('/api/chat/websites',require(_0xfbb1('0x65')));_0x211722['use']('/api/openchannel/reports/queue',require(_0xfbb1('0x66')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x67'),require(_0xfbb1('0x68')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x69'),require(_0xfbb1('0x6a')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x6b'),require(_0xfbb1('0x6c')));_0x211722['use'](_0xfbb1('0x6d'),require(_0xfbb1('0x6e')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x6f'),require(_0xfbb1('0x70')));_0x211722['use'](_0xfbb1('0x71'),require(_0xfbb1('0x72')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x73'),require(_0xfbb1('0x74')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x75'),require(_0xfbb1('0x76')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x77'),require(_0xfbb1('0x78')));_0x211722['use'](_0xfbb1('0x79'),require(_0xfbb1('0x7a')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x7b'),require(_0xfbb1('0x7c')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x7d'),require(_0xfbb1('0x7e')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x7f'),require(_0xfbb1('0x80')));_0x211722[_0xfbb1('0x21')]('/api/cm/custom_fields',require(_0xfbb1('0x81')));_0x211722['use'](_0xfbb1('0x82'),require(_0xfbb1('0x83')));_0x211722['use']('/api/automations',require('./api/automation'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x84'),require('./api/cannedAnswer'));_0x211722['use'](_0xfbb1('0x85'),require(_0xfbb1('0x86')));_0x211722['use'](_0xfbb1('0x87'),require(_0xfbb1('0x88')));_0x211722['use']('/api/intervals',require(_0xfbb1('0x89')));_0x211722['use'](_0xfbb1('0x8a'),require(_0xfbb1('0x8b')));_0x211722[_0xfbb1('0x21')]('/api/cdr',require('./api/cdr'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x8c'),require(_0xfbb1('0x8d')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x8e'),require(_0xfbb1('0x8f')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x90'),require(_0xfbb1('0x91')));_0x211722['use']('/api/tags',require(_0xfbb1('0x92')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x93'),require('./api/template'));_0x211722[_0xfbb1('0x21')]('/api/triggers',require('./api/trigger'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x94'),require(_0xfbb1('0x95')));_0x211722['use'](_0xfbb1('0x96'),require('./api/integration'));_0x211722['use'](_0xfbb1('0x97'),require(_0xfbb1('0x98')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x99'),require(_0xfbb1('0x9a')));_0x211722[_0xfbb1('0x21')]('/api/analytics/default_reports',require('./api/analyticDefaultReport'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x9b'),require(_0xfbb1('0x9c')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x9d'),require(_0xfbb1('0x9e')));_0x211722[_0xfbb1('0x21')]('/api/analytics/field_reports',require('./api/analyticFieldReport'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x9f'),require(_0xfbb1('0xa0')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xa1'),require(_0xfbb1('0xa2')));_0x211722[_0xfbb1('0x21')]('/api/integrations/salesforce/configurations',require(_0xfbb1('0xa3')));_0x211722['use']('/api/integrations/salesforce/fields',require(_0xfbb1('0xa4')));_0x211722['use'](_0xfbb1('0xa5'),require(_0xfbb1('0xa6')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xa7'),require(_0xfbb1('0xa8')));_0x211722['use'](_0xfbb1('0xa9'),require(_0xfbb1('0xaa')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xab'),require('./api/intDeskAccount'));_0x211722[_0xfbb1('0x21')]('/api/integrations/desk/configurations',require(_0xfbb1('0xac')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xad'),require(_0xfbb1('0xae')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xaf'),require('./api/intZohoAccount'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xb0'),require(_0xfbb1('0xb1')));_0x211722[_0xfbb1('0x21')]('/api/integrations/zoho/fields',require(_0xfbb1('0xb2')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xb3'),require(_0xfbb1('0xb4')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xb5'),require(_0xfbb1('0xb6')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xb7'),require('./api/intZendeskField'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xb8'),require(_0xfbb1('0xb9')));_0x211722[_0xfbb1('0x21')]('/api/integrations/freshdesk/configurations',require(_0xfbb1('0xba')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xbb'),require(_0xfbb1('0xbc')));_0x211722[_0xfbb1('0x21')]('/api/integrations/vtiger/accounts',require(_0xfbb1('0xbd')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xbe'),require(_0xfbb1('0xbf')));_0x211722[_0xfbb1('0x21')]('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xc0'),require('./api/intServicenowAccount'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xc1'),require(_0xfbb1('0xc2')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xc3'),require('./api/intServicenowField'));_0x211722['use']('/api/integrations/dynamics365/accounts',require(_0xfbb1('0xc4')));_0x211722[_0xfbb1('0x21')]('/api/integrations/dynamics365/configurations',require(_0xfbb1('0xc5')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xc6'),require(_0xfbb1('0xc7')));_0x211722['use'](_0xfbb1('0xc8'),require('./api/intFreshsalesAccount'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xc9'),require(_0xfbb1('0xca')));_0x211722['use'](_0xfbb1('0xcb'),require('./api/intFreshsalesField'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xcc'),require(_0xfbb1('0xcd')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xce'),require(_0xfbb1('0xcf')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xd0'),require(_0xfbb1('0xd1')));_0x211722['use'](_0xfbb1('0xd2'),require('./api/jscriptyAnswerReport'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xd3'),require(_0xfbb1('0xd4')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xd5'),require(_0xfbb1('0xd6')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xd7'),require(_0xfbb1('0xd8')));_0x211722['use'](_0xfbb1('0xd9'),require(_0xfbb1('0xda')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xdb'),require('./api/squareReportDetail'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xdc'),require(_0xfbb1('0xdd')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xde'),require(_0xfbb1('0xdf')));_0x211722['use'](_0xfbb1('0xe0'),require('./api/squareOdbc'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xe1'),require(_0xfbb1('0xe2')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xe3'),require(_0xfbb1('0xe4')));_0x211722['use'](_0xfbb1('0xe5'),require('./api/squareMessage'));_0x211722['use'](_0xfbb1('0xe6'),require('./api/team'));_0x211722[_0xfbb1('0x21')]('/api/license',require(_0xfbb1('0xe7')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xe8'),require(_0xfbb1('0xe9')));_0x211722[_0xfbb1('0x21')]('/api/migrations',require(_0xfbb1('0xea')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xeb'),require('./api/attachment'));_0x211722['use'](_0xfbb1('0xec'),require(_0xfbb1('0xed')));_0x211722['use']('/api/mail/reports/transfer',require(_0xfbb1('0xee')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xef'),require(_0xfbb1('0xf0')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xf1'),require('./api/faxTransferReport'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xf2'),require('./api/openchannelTransferReport'));_0x211722[_0xfbb1('0x21')]('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x211722[_0xfbb1('0x21')]('/api/cm/lists',require('./api/cmList'));_0x211722[_0xfbb1('0x21')]('/api/voice/prefixes',require(_0xfbb1('0xf3')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xf4'),require(_0xfbb1('0xf5')));_0x211722['use']('/api/userProfile/sections',require(_0xfbb1('0xf6')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xf7'),require(_0xfbb1('0xf8')));_0x211722[_0xfbb1('0x21')]('/api/userNotifications',require(_0xfbb1('0xf9')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xfa'),require('./api/whatsappAccount'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xfb'),require(_0xfbb1('0xfc')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xfd'),require(_0xfbb1('0xfe')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0xff'),require(_0xfbb1('0x100')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x101'),require(_0xfbb1('0x102')));_0x211722[_0xfbb1('0x21')]('/api/whatsapp/reports/transfer',require(_0xfbb1('0x103')));_0x211722['use'](_0xfbb1('0x104'),require('./api/whatsappQueue'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x105'),require(_0xfbb1('0x106')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x107'),require('./api/authLocal'));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x108'),require(_0xfbb1('0x109')));_0x211722['use'](_0xfbb1('0x10a'),require(_0xfbb1('0x10b')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x10c'),require(_0xfbb1('0x10d')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x10e'),require(_0xfbb1('0x10f')));_0x211722[_0xfbb1('0x21')]('/api/system',require(_0xfbb1('0x110')));_0x211722['use'](_0xfbb1('0x111'),require(_0xfbb1('0x112')));_0x211722['use'](_0xfbb1('0x113'),require(_0xfbb1('0x114')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x115'),express['static'](path[_0xfbb1('0x116')](config[_0xfbb1('0x117')],'/apidoc')));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x118'),express[_0xfbb1('0x119')](path[_0xfbb1('0x116')](config[_0xfbb1('0x117')],_0xfbb1('0x118'))));_0x211722[_0xfbb1('0x21')]('/demo',express[_0xfbb1('0x119')](path[_0xfbb1('0x116')](config[_0xfbb1('0x117')],_0xfbb1('0x11a'))));_0x211722[_0xfbb1('0x21')]('/snippet',express['static'](path['join'](config[_0xfbb1('0x117')],_0xfbb1('0x11b'),_0xfbb1('0x11c'))));_0x211722[_0xfbb1('0x21')](_0xfbb1('0x11d'),express[_0xfbb1('0x119')](path['join'](config[_0xfbb1('0x117')],_0xfbb1('0x11e'))));_0x211722[_0xfbb1('0x11f')](_0xfbb1('0x120'))[_0xfbb1('0x121')](errors[0x194]);_0x211722[_0xfbb1('0x11f')]('/*')[_0xfbb1('0x121')](function(_0x10c27a,_0x145d28){_0x145d28[_0xfbb1('0x122')](path[_0xfbb1('0x123')](_0x211722[_0xfbb1('0x121')](_0xfbb1('0x124'))+_0xfbb1('0x125')));});};var sensitiveFields=['username',_0xfbb1('0x126'),'newPassword',_0xfbb1('0x127'),_0xfbb1('0x128'),_0xfbb1('0x129'),_0xfbb1('0x12a'),_0xfbb1('0x12b'),'mobile',_0xfbb1('0x12c'),'email',_0xfbb1('0x12d'),_0xfbb1('0x12e'),'securityToken',_0xfbb1('0x12f'),_0xfbb1('0x130'),_0xfbb1('0x131'),'token',_0xfbb1('0x132'),'accessToken',_0xfbb1('0x133'),'authToken',_0xfbb1('0x134'),_0xfbb1('0x135'),_0xfbb1('0x136'),_0xfbb1('0x137'),_0xfbb1('0x138'),'exten',_0xfbb1('0x139'),_0xfbb1('0x13a'),'privateKey',_0xfbb1('0x13b'),_0xfbb1('0x13c'),_0xfbb1('0x13d'),_0xfbb1('0x16'),_0xfbb1('0x13e'),_0xfbb1('0x13f'),_0xfbb1('0x140'),_0xfbb1('0x141'),'secret',_0xfbb1('0x142'),'oldPassword'];function maskSensitiveData(_0x2c8feb){var _0x18e570=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x2c8feb))return;for(var _0x5e1015 in _0x2c8feb){if(_[_0xfbb1('0x143')](_0x2c8feb[_0x5e1015])){for(var _0xfa8d0=0x0;_0xfa8d0<_0x2c8feb[_0x5e1015]['length'];_0xfa8d0++){maskSensitiveData(_0x2c8feb[_0x5e1015][_0xfa8d0]);}}else if(_[_0xfbb1('0x144')](_0x2c8feb[_0x5e1015])){maskSensitiveData(_0x2c8feb[_0x5e1015]);}else if(_[_0xfbb1('0x145')](_0x2c8feb[_0x5e1015])){_0x2c8feb[_0x5e1015]=_0x2c8feb[_0x5e1015]['replace'](/{{{/g,_0xfbb1('0x146'))[_0xfbb1('0x147')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xfbb1('0x147')](/}}/g,'}@');if(_[_0xfbb1('0x148')](sensitiveFields,_0x5e1015)){_0x2c8feb[_0x5e1015]=_0x2c8feb[_0x5e1015]['replace'](_0x18e570,'*');}}}} \ No newline at end of file +var _0x1be0=['apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','code','accessKey','token','channelSecret','authToken','consumerKey','consumerSecret','calleridname','exten','vidaooApiKey','clientEmail','privateKey','pass','dsn','secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','path','express','express-winston','util','./config/environment','./config/logger','api','default','isEmpty','body','\x20body=%s','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','user','name','role','inspect','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','method','responseTime','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/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/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','./api/mailMessage','./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/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/intervals','./api/interval','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','/api/migrations','/api/attachments','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/cloudProviders','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/auth/google','./api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','root','/www','join','/demo','/snippet','1.0.16','/plugins','/server/files/plugins','get','resolve','appPath','/index.html','password','newPassword'];(function(_0x32a6b6,_0x5b4051){var _0x1f0d46=function(_0x57a315){while(--_0x57a315){_0x32a6b6['push'](_0x32a6b6['shift']());}};_0x1f0d46(++_0x5b4051);}(_0x1be0,0x16b));var _0x01be=function(_0x2353b3,_0x2bffcb){_0x2353b3=_0x2353b3-0x0;var _0x43211a=_0x1be0[_0x2353b3];return _0x43211a;};'use strict';var _=require('lodash');var path=require(_0x01be('0x0'));var express=require(_0x01be('0x1'));var ewinston=require(_0x01be('0x2'));var util=require(_0x01be('0x3'));var errors=require('./errors');var config=require(_0x01be('0x4'));var logger=require(_0x01be('0x5'))(_0x01be('0x6'));var authLogger=require(_0x01be('0x5'))('auth');exports[_0x01be('0x7')]=function(_0x19490d){_0x19490d['use'](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x296168,_0x238aae){var _0xbad158='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x01be('0x8')](_0x296168[_0x01be('0x9')])){_0xbad158+=_0x01be('0xa');var _0x286003=_0x296168['body'];maskSensitiveData(_0x286003);}return util['format'](_0xbad158,_0x296168['method'],_0x296168[_0x01be('0xb')][_0x01be('0xc')]?_0x296168[_0x01be('0xb')][_0x01be('0xc')]:_0x296168[_0x01be('0xd')][_0x01be('0xe')]||_0x296168['ip'],_0x296168[_0x01be('0xf')],_0x238aae[_0x01be('0x10')],_0x238aae['responseTime'],_0x296168['user']?_0x296168[_0x01be('0x11')]['id']:null,_0x296168[_0x01be('0x11')]?_0x296168['user'][_0x01be('0x12')]:null,_0x296168['user']?_0x296168[_0x01be('0x11')][_0x01be('0x13')]:null,_0x286003?util[_0x01be('0x14')](_0x286003,![],null):'');}}));_0x19490d[_0x01be('0x15')](ewinston[_0x01be('0x16')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x126595,_0x138315){var _0x2add7e=_0x01be('0x17');if(_0x126595[_0x01be('0x9')]&&_0x126595[_0x01be('0x9')][_0x01be('0x18')]&&_0x126595[_0x01be('0x9')][_0x01be('0x19')]){_0x2add7e='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x2add7e,_0x126595[_0x01be('0x1a')],_0x126595[_0x01be('0xb')][_0x01be('0xc')]?_0x126595['headers']['x-forwarded-for']:_0x126595[_0x01be('0xd')][_0x01be('0xe')]||_0x126595['ip'],_0x126595[_0x01be('0xf')],_0x138315[_0x01be('0x10')],_0x138315[_0x01be('0x1b')],_0x126595[_0x01be('0x11')]?_0x126595[_0x01be('0x11')]['id']:null,_0x126595[_0x01be('0x11')]?_0x126595[_0x01be('0x11')][_0x01be('0x12')]:null,_0x126595[_0x01be('0x11')]?_0x126595[_0x01be('0x11')][_0x01be('0x13')]:null,_0x126595[_0x01be('0x9')]&&_0x126595[_0x01be('0x9')][_0x01be('0x18')]?_0x126595[_0x01be('0x9')][_0x01be('0x18')]:_0x01be('0x1c'),_0x126595[_0x01be('0x9')]&&_0x126595[_0x01be('0x9')][_0x01be('0x19')]?_0x126595[_0x01be('0x9')][_0x01be('0x19')]:'',_0x126595[_0x01be('0x9')]&&_0x126595[_0x01be('0x9')][_0x01be('0x1d')]?_0x126595[_0x01be('0x9')]['agent_name']:'');},'ignoreRoute':function(_0x311d04){var _0x1303d1=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1303d1[_0x01be('0x1e')](_0x311d04[_0x01be('0xf')]);}}));_0x19490d[_0x01be('0x15')](_0x01be('0x1f'),require(_0x01be('0x20')));_0x19490d[_0x01be('0x15')](_0x01be('0x21'),require('./api/voiceChanSpy'));_0x19490d['use'](_0x01be('0x22'),require(_0x01be('0x23')));_0x19490d[_0x01be('0x15')]('/api/voice/extensions',require(_0x01be('0x24')));_0x19490d['use'](_0x01be('0x25'),require(_0x01be('0x26')));_0x19490d['use'](_0x01be('0x27'),require(_0x01be('0x28')));_0x19490d[_0x01be('0x15')]('/api/voice/recordings',require(_0x01be('0x29')));_0x19490d['use'](_0x01be('0x2a'),require('./api/screenRecording'));_0x19490d[_0x01be('0x15')](_0x01be('0x2b'),require(_0x01be('0x2c')));_0x19490d[_0x01be('0x15')](_0x01be('0x2d'),require(_0x01be('0x2e')));_0x19490d[_0x01be('0x15')](_0x01be('0x2f'),require(_0x01be('0x30')));_0x19490d['use'](_0x01be('0x31'),require(_0x01be('0x32')));_0x19490d['use'](_0x01be('0x33'),require(_0x01be('0x34')));_0x19490d['use'](_0x01be('0x35'),require(_0x01be('0x36')));_0x19490d[_0x01be('0x15')]('/api/members/reports',require(_0x01be('0x37')));_0x19490d[_0x01be('0x15')](_0x01be('0x38'),require(_0x01be('0x39')));_0x19490d[_0x01be('0x15')]('/api/voice/transfers/reports',require(_0x01be('0x3a')));_0x19490d[_0x01be('0x15')]('/api/mail/out_servers',require(_0x01be('0x3b')));_0x19490d[_0x01be('0x15')](_0x01be('0x3c'),require('./api/mailAccount'));_0x19490d['use'](_0x01be('0x3d'),require(_0x01be('0x3e')));_0x19490d[_0x01be('0x15')](_0x01be('0x3f'),require(_0x01be('0x40')));_0x19490d['use'](_0x01be('0x41'),require('./api/mailInteraction'));_0x19490d['use'](_0x01be('0x42'),require(_0x01be('0x43')));_0x19490d['use']('/api/mail/applications',require(_0x01be('0x44')));_0x19490d['use'](_0x01be('0x45'),require(_0x01be('0x46')));_0x19490d[_0x01be('0x15')](_0x01be('0x47'),require(_0x01be('0x48')));_0x19490d[_0x01be('0x15')](_0x01be('0x49'),require(_0x01be('0x4a')));_0x19490d['use'](_0x01be('0x4b'),require(_0x01be('0x4c')));_0x19490d[_0x01be('0x15')](_0x01be('0x4d'),require(_0x01be('0x4e')));_0x19490d['use'](_0x01be('0x4f'),require(_0x01be('0x50')));_0x19490d[_0x01be('0x15')](_0x01be('0x51'),require(_0x01be('0x52')));_0x19490d[_0x01be('0x15')](_0x01be('0x53'),require('./api/faxQueue'));_0x19490d['use'](_0x01be('0x54'),require(_0x01be('0x55')));_0x19490d['use'](_0x01be('0x56'),require(_0x01be('0x57')));_0x19490d[_0x01be('0x15')](_0x01be('0x58'),require('./api/smsApplication'));_0x19490d[_0x01be('0x15')](_0x01be('0x59'),require('./api/smsInteraction'));_0x19490d[_0x01be('0x15')]('/api/sms/messages',require('./api/smsMessage'));_0x19490d[_0x01be('0x15')](_0x01be('0x5a'),require(_0x01be('0x5b')));_0x19490d[_0x01be('0x15')](_0x01be('0x5c'),require(_0x01be('0x5d')));_0x19490d[_0x01be('0x15')](_0x01be('0x5e'),require(_0x01be('0x5f')));_0x19490d[_0x01be('0x15')]('/api/openchannel/interactions',require(_0x01be('0x60')));_0x19490d['use'](_0x01be('0x61'),require('./api/openchannelMessage'));_0x19490d[_0x01be('0x15')](_0x01be('0x62'),require(_0x01be('0x63')));_0x19490d['use'](_0x01be('0x64'),require(_0x01be('0x65')));_0x19490d[_0x01be('0x15')](_0x01be('0x66'),require(_0x01be('0x67')));_0x19490d[_0x01be('0x15')](_0x01be('0x68'),require('./api/chatApplication'));_0x19490d[_0x01be('0x15')](_0x01be('0x69'),require('./api/chatInteraction'));_0x19490d[_0x01be('0x15')]('/api/chat/messages',require(_0x01be('0x6a')));_0x19490d[_0x01be('0x15')](_0x01be('0x6b'),require(_0x01be('0x6c')));_0x19490d['use']('/api/chat/queues',require(_0x01be('0x6d')));_0x19490d['use'](_0x01be('0x6e'),require(_0x01be('0x6f')));_0x19490d[_0x01be('0x15')](_0x01be('0x70'),require(_0x01be('0x71')));_0x19490d[_0x01be('0x15')](_0x01be('0x72'),require('./api/cmCompany'));_0x19490d[_0x01be('0x15')](_0x01be('0x73'),require(_0x01be('0x74')));_0x19490d[_0x01be('0x15')]('/api/cm/hopper',require('./api/cmHopper'));_0x19490d['use'](_0x01be('0x75'),require(_0x01be('0x76')));_0x19490d['use'](_0x01be('0x77'),require(_0x01be('0x78')));_0x19490d[_0x01be('0x15')](_0x01be('0x79'),require(_0x01be('0x7a')));_0x19490d[_0x01be('0x15')](_0x01be('0x7b'),require(_0x01be('0x7c')));_0x19490d[_0x01be('0x15')]('/api/actions',require(_0x01be('0x7d')));_0x19490d['use'](_0x01be('0x7e'),require(_0x01be('0x7f')));_0x19490d['use'](_0x01be('0x80'),require(_0x01be('0x81')));_0x19490d[_0x01be('0x15')](_0x01be('0x82'),require(_0x01be('0x83')));_0x19490d[_0x01be('0x15')]('/api/conditions',require('./api/condition'));_0x19490d['use'](_0x01be('0x84'),require(_0x01be('0x85')));_0x19490d[_0x01be('0x15')]('/api/pauses',require(_0x01be('0x86')));_0x19490d['use']('/api/cdr',require(_0x01be('0x87')));_0x19490d[_0x01be('0x15')](_0x01be('0x88'),require(_0x01be('0x89')));_0x19490d[_0x01be('0x15')](_0x01be('0x8a'),require(_0x01be('0x8b')));_0x19490d['use'](_0x01be('0x8c'),require(_0x01be('0x8d')));_0x19490d[_0x01be('0x15')](_0x01be('0x8e'),require(_0x01be('0x8f')));_0x19490d[_0x01be('0x15')]('/api/templates',require('./api/template'));_0x19490d[_0x01be('0x15')](_0x01be('0x90'),require(_0x01be('0x91')));_0x19490d[_0x01be('0x15')](_0x01be('0x92'),require('./api/variable'));_0x19490d[_0x01be('0x15')](_0x01be('0x93'),require(_0x01be('0x94')));_0x19490d[_0x01be('0x15')](_0x01be('0x95'),require(_0x01be('0x96')));_0x19490d[_0x01be('0x15')](_0x01be('0x97'),require(_0x01be('0x98')));_0x19490d['use'](_0x01be('0x99'),require(_0x01be('0x9a')));_0x19490d['use'](_0x01be('0x9b'),require('./api/analyticExtractedReport'));_0x19490d[_0x01be('0x15')](_0x01be('0x9c'),require(_0x01be('0x9d')));_0x19490d[_0x01be('0x15')](_0x01be('0x9e'),require(_0x01be('0x9f')));_0x19490d[_0x01be('0x15')](_0x01be('0xa0'),require('./api/analyticTreeReport'));_0x19490d[_0x01be('0x15')](_0x01be('0xa1'),require(_0x01be('0xa2')));_0x19490d[_0x01be('0x15')](_0x01be('0xa3'),require(_0x01be('0xa4')));_0x19490d[_0x01be('0x15')](_0x01be('0xa5'),require(_0x01be('0xa6')));_0x19490d[_0x01be('0x15')]('/api/integrations/sugarcrm/accounts',require(_0x01be('0xa7')));_0x19490d[_0x01be('0x15')](_0x01be('0xa8'),require(_0x01be('0xa9')));_0x19490d[_0x01be('0x15')](_0x01be('0xaa'),require(_0x01be('0xab')));_0x19490d[_0x01be('0x15')](_0x01be('0xac'),require(_0x01be('0xad')));_0x19490d[_0x01be('0x15')](_0x01be('0xae'),require('./api/intDeskConfiguration'));_0x19490d[_0x01be('0x15')](_0x01be('0xaf'),require('./api/intDeskField'));_0x19490d[_0x01be('0x15')](_0x01be('0xb0'),require(_0x01be('0xb1')));_0x19490d[_0x01be('0x15')](_0x01be('0xb2'),require('./api/intZohoConfiguration'));_0x19490d['use'](_0x01be('0xb3'),require(_0x01be('0xb4')));_0x19490d[_0x01be('0x15')](_0x01be('0xb5'),require(_0x01be('0xb6')));_0x19490d[_0x01be('0x15')]('/api/integrations/zendesk/configurations',require(_0x01be('0xb7')));_0x19490d['use'](_0x01be('0xb8'),require(_0x01be('0xb9')));_0x19490d[_0x01be('0x15')](_0x01be('0xba'),require(_0x01be('0xbb')));_0x19490d[_0x01be('0x15')](_0x01be('0xbc'),require(_0x01be('0xbd')));_0x19490d[_0x01be('0x15')](_0x01be('0xbe'),require('./api/intFreshdeskField'));_0x19490d[_0x01be('0x15')](_0x01be('0xbf'),require(_0x01be('0xc0')));_0x19490d['use']('/api/integrations/vtiger/configurations',require(_0x01be('0xc1')));_0x19490d[_0x01be('0x15')](_0x01be('0xc2'),require(_0x01be('0xc3')));_0x19490d[_0x01be('0x15')](_0x01be('0xc4'),require('./api/intServicenowAccount'));_0x19490d['use']('/api/integrations/servicenow/configurations',require(_0x01be('0xc5')));_0x19490d[_0x01be('0x15')](_0x01be('0xc6'),require('./api/intServicenowField'));_0x19490d[_0x01be('0x15')](_0x01be('0xc7'),require('./api/intDynamics365Account'));_0x19490d['use'](_0x01be('0xc8'),require(_0x01be('0xc9')));_0x19490d[_0x01be('0x15')]('/api/integrations/dynamics365/fields',require(_0x01be('0xca')));_0x19490d['use']('/api/integrations/freshsales/accounts',require('./api/intFreshsalesAccount'));_0x19490d['use']('/api/integrations/freshsales/configurations',require(_0x01be('0xcb')));_0x19490d[_0x01be('0x15')](_0x01be('0xcc'),require('./api/intFreshsalesField'));_0x19490d[_0x01be('0x15')](_0x01be('0xcd'),require(_0x01be('0xce')));_0x19490d['use'](_0x01be('0xcf'),require(_0x01be('0xd0')));_0x19490d[_0x01be('0x15')](_0x01be('0xd1'),require('./api/chatInternalMessage'));_0x19490d[_0x01be('0x15')](_0x01be('0xd2'),require('./api/jscriptyAnswerReport'));_0x19490d[_0x01be('0x15')](_0x01be('0xd3'),require(_0x01be('0xd4')));_0x19490d[_0x01be('0x15')](_0x01be('0xd5'),require('./api/jscriptySessionReport'));_0x19490d[_0x01be('0x15')](_0x01be('0xd6'),require(_0x01be('0xd7')));_0x19490d[_0x01be('0x15')](_0x01be('0xd8'),require('./api/squareReport'));_0x19490d[_0x01be('0x15')](_0x01be('0xd9'),require(_0x01be('0xda')));_0x19490d[_0x01be('0x15')](_0x01be('0xdb'),require(_0x01be('0xdc')));_0x19490d[_0x01be('0x15')](_0x01be('0xdd'),require(_0x01be('0xde')));_0x19490d[_0x01be('0x15')](_0x01be('0xdf'),require('./api/squareOdbc'));_0x19490d[_0x01be('0x15')](_0x01be('0xe0'),require(_0x01be('0xe1')));_0x19490d[_0x01be('0x15')](_0x01be('0xe2'),require(_0x01be('0xe3')));_0x19490d[_0x01be('0x15')](_0x01be('0xe4'),require(_0x01be('0xe5')));_0x19490d[_0x01be('0x15')](_0x01be('0xe6'),require(_0x01be('0xe7')));_0x19490d[_0x01be('0x15')](_0x01be('0xe8'),require(_0x01be('0xe9')));_0x19490d['use'](_0x01be('0xea'),require('./api/campaign'));_0x19490d[_0x01be('0x15')](_0x01be('0xeb'),require('./api/migration'));_0x19490d[_0x01be('0x15')](_0x01be('0xec'),require('./api/attachment'));_0x19490d['use']('/api/plugins',require(_0x01be('0xed')));_0x19490d[_0x01be('0x15')](_0x01be('0xee'),require(_0x01be('0xef')));_0x19490d[_0x01be('0x15')](_0x01be('0xf0'),require('./api/chatTransferReport'));_0x19490d[_0x01be('0x15')]('/api/fax/reports/transfer',require(_0x01be('0xf1')));_0x19490d[_0x01be('0x15')](_0x01be('0xf2'),require(_0x01be('0xf3')));_0x19490d[_0x01be('0x15')](_0x01be('0xf4'),require(_0x01be('0xf5')));_0x19490d['use'](_0x01be('0xf6'),require(_0x01be('0xf7')));_0x19490d[_0x01be('0x15')](_0x01be('0xf8'),require(_0x01be('0xf9')));_0x19490d[_0x01be('0x15')](_0x01be('0xfa'),require(_0x01be('0xfb')));_0x19490d[_0x01be('0x15')]('/api/userProfile/sections',require(_0x01be('0xfc')));_0x19490d[_0x01be('0x15')](_0x01be('0xfd'),require(_0x01be('0xfe')));_0x19490d['use'](_0x01be('0xff'),require('./api/userNotification'));_0x19490d['use'](_0x01be('0x100'),require('./api/whatsappAccount'));_0x19490d[_0x01be('0x15')](_0x01be('0x101'),require(_0x01be('0x102')));_0x19490d['use'](_0x01be('0x103'),require('./api/whatsappInteraction'));_0x19490d['use'](_0x01be('0x104'),require(_0x01be('0x105')));_0x19490d['use'](_0x01be('0x106'),require(_0x01be('0x107')));_0x19490d[_0x01be('0x15')](_0x01be('0x108'),require(_0x01be('0x109')));_0x19490d['use']('/api/whatsapp/queues',require('./api/whatsappQueue'));_0x19490d[_0x01be('0x15')](_0x01be('0x10a'),require(_0x01be('0x10b')));_0x19490d[_0x01be('0x15')](_0x01be('0x10c'),require(_0x01be('0x10d')));_0x19490d[_0x01be('0x15')](_0x01be('0x10e'),require('./api/authGoogle'));_0x19490d[_0x01be('0x15')]('/api/jira',require(_0x01be('0x10f')));_0x19490d['use'](_0x01be('0x110'),require('./api/rpc'));_0x19490d[_0x01be('0x15')](_0x01be('0x111'),require(_0x01be('0x112')));_0x19490d[_0x01be('0x15')](_0x01be('0x113'),require(_0x01be('0x114')));_0x19490d[_0x01be('0x15')](_0x01be('0x115'),require(_0x01be('0x116')));_0x19490d['use'](_0x01be('0x117'),require(_0x01be('0x118')));_0x19490d[_0x01be('0x15')](_0x01be('0x119'),express[_0x01be('0x11a')](path['join'](config[_0x01be('0x11b')],_0x01be('0x119'))));_0x19490d[_0x01be('0x15')](_0x01be('0x11c'),express[_0x01be('0x11a')](path[_0x01be('0x11d')](config[_0x01be('0x11b')],_0x01be('0x11c'))));_0x19490d[_0x01be('0x15')](_0x01be('0x11e'),express['static'](path[_0x01be('0x11d')](config[_0x01be('0x11b')],_0x01be('0x11e'))));_0x19490d[_0x01be('0x15')](_0x01be('0x11f'),express[_0x01be('0x11a')](path[_0x01be('0x11d')](config['root'],'snippet',_0x01be('0x120'))));_0x19490d['use'](_0x01be('0x121'),express[_0x01be('0x11a')](path['join'](config['root'],_0x01be('0x122'))));_0x19490d['route']('/:url(api|auth|components|app|bower_components|assets)/*')['get'](errors[0x194]);_0x19490d['route']('/*')[_0x01be('0x123')](function(_0xf849a5,_0x117a64){_0x117a64['sendFile'](path[_0x01be('0x124')](_0x19490d[_0x01be('0x123')](_0x01be('0x125'))+_0x01be('0x126')));});};var sensitiveFields=['username',_0x01be('0x127'),_0x01be('0x128'),_0x01be('0x129'),_0x01be('0x12a'),_0x01be('0x12b'),_0x01be('0x12c'),_0x01be('0x12d'),_0x01be('0x12e'),_0x01be('0x12f'),_0x01be('0x130'),_0x01be('0x131'),_0x01be('0x132'),'securityToken',_0x01be('0x133'),_0x01be('0x134'),'tenantId',_0x01be('0x135'),_0x01be('0x136'),'accessToken','accessTokenSecret',_0x01be('0x137'),_0x01be('0x138'),_0x01be('0x139'),'membername',_0x01be('0x13a'),'calleridnum',_0x01be('0x13b'),_0x01be('0x13c'),_0x01be('0x13d'),_0x01be('0x13e'),'accesskeyid','secretaccesskey','key',_0x01be('0x11'),_0x01be('0x13f'),'accountSid','localstationid',_0x01be('0x140'),_0x01be('0x141'),_0x01be('0x142'),'oldPassword'];function maskSensitiveData(_0x1204d3){var _0x2f12ce=/(?!^)[\s\S](?!$)/g;if(!_[_0x01be('0x143')](_0x1204d3))return;for(var _0x1e8c38 in _0x1204d3){if(_[_0x01be('0x144')](_0x1204d3[_0x1e8c38])){for(var _0x4a9934=0x0;_0x4a9934<_0x1204d3[_0x1e8c38][_0x01be('0x145')];_0x4a9934++){maskSensitiveData(_0x1204d3[_0x1e8c38][_0x4a9934]);}}else if(_[_0x01be('0x143')](_0x1204d3[_0x1e8c38])){maskSensitiveData(_0x1204d3[_0x1e8c38]);}else if(_[_0x01be('0x146')](_0x1204d3[_0x1e8c38])){_0x1204d3[_0x1e8c38]=_0x1204d3[_0x1e8c38][_0x01be('0x147')](/{{{/g,_0x01be('0x148'))['replace'](/}}}/g,_0x01be('0x149'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x1e8c38)){_0x1204d3[_0x1e8c38]=_0x1204d3[_0x1e8c38][_0x01be('0x147')](_0x2f12ce,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index be65406..20c858b 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01eb=['server','http','rpc','port','localhost','log','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc'];(function(_0x57978b,_0x8e259b){var _0x578535=function(_0x314e8c){while(--_0x314e8c){_0x57978b['push'](_0x57978b['shift']());}};_0x578535(++_0x8e259b);}(_0x01eb,0x101));var _0xb01e=function(_0xf64500,_0x410815){_0xf64500=_0xf64500-0x0;var _0x58a6e0=_0x01eb[_0xf64500];return _0x58a6e0;};'use strict';var jayson=require(_0xb01e('0x0'));var BPromise=require(_0xb01e('0x1'));var _=require(_0xb01e('0x2'));var config=require(_0xb01e('0x3'));exports[_0xb01e('0x4')]=function(){return new BPromise(function(_0x14eb9b,_0x4034c7){var _0x39c3a3={};_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/user/user.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/voiceExtension/voiceExtension.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x6')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x7')));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x8')));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x9')));_0x39c3a3=_['merge'](_0x39c3a3,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0xa')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0xb')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/trunk/trunk.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0xc')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x39c3a3=_['merge'](_0x39c3a3,require('../api/mailServerIn/mailServerIn.rpc'));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0xd')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/mailQueue/mailQueue.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0xe')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/mailMessage/mailMessage.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0xf')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x10')));_0x39c3a3=_['merge'](_0x39c3a3,require('../api/faxAccount/faxAccount.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x11')));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x12')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/faxMessage/faxMessage.rpc'));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x13')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x14')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/smsAccount/smsAccount.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x15')));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x16')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x17')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x18')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x19')));_0x39c3a3=_['merge'](_0x39c3a3,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x1a')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/chatInteraction/chatInteraction.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x1b')));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x1c')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/cmContact/cmContact.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/cmHopper/cmHopper.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x1d')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x1e')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x1f')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/pause/pause.rpc'));_0x39c3a3=_['merge'](_0x39c3a3,require('../api/sound/sound.rpc'));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x20')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x21')));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x22')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x23')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x24')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x25')));_0x39c3a3=_['merge'](_0x39c3a3,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x26')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x27')));_0x39c3a3=_['merge'](_0x39c3a3,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x28')));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x29')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x2a')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x2b')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/squareOdbc/squareOdbc.rpc'));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/squareProject/squareProject.rpc'));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x2c')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x2d')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x2e')));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x2f')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x30')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x31')));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x32')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x39c3a3=_['merge'](_0x39c3a3,require(_0xb01e('0x33')));_0x39c3a3=_[_0xb01e('0x5')](_0x39c3a3,require(_0xb01e('0x34')));var _0x1614da=jayson[_0xb01e('0x35')](_0x39c3a3)[_0xb01e('0x36')]();var _0x3ecb77=config[_0xb01e('0x37')][_0xb01e('0x38')]||config[_0xb01e('0x38')]+0x1;var _0x2a400e=config[_0xb01e('0x37')]['ip']||_0xb01e('0x39');_0x1614da['on']('error',function(_0x8d3f8a){return _0x4034c7(_0x8d3f8a);});_0x1614da['listen'](_0x3ecb77,_0x2a400e,function(){console[_0xb01e('0x3a')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x2a400e,_0x3ecb77);require(_0xb01e('0x3b'))[_0xb01e('0x3c')]();return _0x14eb9b(_0xb01e('0x3d')+_0x2a400e+':'+_0x3ecb77);});});}; \ No newline at end of file +var _0xd7e0=['../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.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/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','log','../config/triggers','default','RPC\x20listening\x20on\x20','bluebird','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.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/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.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/template/template.rpc','../api/trigger/trigger.rpc'];(function(_0x59dccc,_0x184c1c){var _0xc97bcb=function(_0x1ddbcb){while(--_0x1ddbcb){_0x59dccc['push'](_0x59dccc['shift']());}};_0xc97bcb(++_0x184c1c);}(_0xd7e0,0xee));var _0x0d7e=function(_0x215f4b,_0x557e00){_0x215f4b=_0x215f4b-0x0;var _0x4ca0b7=_0xd7e0[_0x215f4b];return _0x4ca0b7;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x0d7e('0x0'));var _=require('lodash');var config=require(_0x0d7e('0x1'));exports[_0x0d7e('0x2')]=function(){return new BPromise(function(_0x1696f8,_0x4d0d12){var _0x2e1dbd={};_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x4')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require('../api/voiceExtension/voiceExtension.rpc'));_0x2e1dbd=_['merge'](_0x2e1dbd,require(_0x0d7e('0x5')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x6')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x7')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x8')));_0x2e1dbd=_['merge'](_0x2e1dbd,require(_0x0d7e('0x9')));_0x2e1dbd=_['merge'](_0x2e1dbd,require('../api/memberReport/memberReport.rpc'));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0xa')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0xb')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0xc')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0xd')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0xe')));_0x2e1dbd=_['merge'](_0x2e1dbd,require(_0x0d7e('0xf')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x10')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x11')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x12')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x13')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x14')));_0x2e1dbd=_['merge'](_0x2e1dbd,require('../api/faxApplication/faxApplication.rpc'));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require('../api/faxInteraction/faxInteraction.rpc'));_0x2e1dbd=_['merge'](_0x2e1dbd,require(_0x0d7e('0x15')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require('../api/faxQueue/faxQueue.rpc'));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x16')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require('../api/smsAccount/smsAccount.rpc'));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x17')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x18')));_0x2e1dbd=_['merge'](_0x2e1dbd,require(_0x0d7e('0x19')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x1a')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x1b')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x1c')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x1d')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require('../api/chatInteraction/chatInteraction.rpc'));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x1e')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x1f')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x20')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x21')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x22')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x23')));_0x2e1dbd=_['merge'](_0x2e1dbd,require(_0x0d7e('0x24')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x25')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x26')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x27')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x28')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x29')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require('../api/variable/variable.rpc'));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x2e1dbd=_['merge'](_0x2e1dbd,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x2a')));_0x2e1dbd=_['merge'](_0x2e1dbd,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x2b')));_0x2e1dbd=_['merge'](_0x2e1dbd,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x2c')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x2d')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x2e')));_0x2e1dbd=_['merge'](_0x2e1dbd,require(_0x0d7e('0x2f')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x30')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x31')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x32')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x33')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x34')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require('../api/squareProject/squareProject.rpc'));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x35')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x36')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x37')));_0x2e1dbd=_['merge'](_0x2e1dbd,require('../api/attachment/attachment.rpc'));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require('../api/plugin/plugin.rpc'));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x38')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x39')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x3a')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x3b')));_0x2e1dbd=_[_0x0d7e('0x3')](_0x2e1dbd,require(_0x0d7e('0x3c')));var _0x589db6=jayson[_0x0d7e('0x3d')](_0x2e1dbd)[_0x0d7e('0x3e')]();var _0x1ed1c9=config[_0x0d7e('0x3f')][_0x0d7e('0x40')]||config[_0x0d7e('0x40')]+0x1;var _0x279c35=config['rpc']['ip']||_0x0d7e('0x41');_0x589db6['on']('error',function(_0x157f53){return _0x4d0d12(_0x157f53);});_0x589db6[_0x0d7e('0x2')](_0x1ed1c9,_0x279c35,function(){console[_0x0d7e('0x42')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x279c35,_0x1ed1c9);require(_0x0d7e('0x43'))[_0x0d7e('0x44')]();return _0x1696f8(_0x0d7e('0x45')+_0x279c35+':'+_0x1ed1c9);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 90daf6a..8f56dc6 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 _0xedd9=['getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','noop','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','emit','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','destroy','pipe','write','inherits','prototype','command','sync','answer','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','sendRequest','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','GOTO\x20%s\x20%s\x20%s'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xedd9,0xfc));var _0x9edd=function(_0x25fa82,_0xb1dfd7){_0x25fa82=_0x25fa82-0x0;var _0x475404=_0xedd9[_0x25fa82];return _0x475404;};'use strict';var util=require('util');var _=require(_0x9edd('0x0'));var EventEmitter=require(_0x9edd('0x1'))[_0x9edd('0x2')];var AGIReply=require(_0x9edd('0x3'));var AGIError=require(_0x9edd('0x4'));function AGIChannel(_0x127cbe){var _0x3e6d3a=this,_0x36b53f=new AGIReply(),_0x5943b3=![],_0x33679f={};EventEmitter[_0x9edd('0x5')](_0x3e6d3a);_0x127cbe[_0x9edd('0x6')](_0x9edd('0x7'));_0x127cbe['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x36b53f[_0x9edd('0x6')]('utf8');_0x36b53f['on'](_0x9edd('0x8'),function(_0x190185){for(var _0x1355be in _0x190185){_0x3e6d3a[_0x1355be]=_0x190185[_0x1355be];}_0x3e6d3a[_0x9edd('0x9')]('ready');});_0x36b53f['on'](_0x9edd('0xa'),function(_0x5d2f90){if(_0x5d2f90[_0x9edd('0xb')]()==_0x9edd('0xc')){_0x3e6d3a['emit'](_0x9edd('0xc'));return;}if(_0x5d2f90[_0x9edd('0xd')](0x0,0xb)=='520-Invalid'){_0x5943b3=!![];}if(_0x5943b3){_0x33679f['rx']+=_0x5d2f90+'\x0a';if(_0x5d2f90[_0x9edd('0xe')](_0x9edd('0xf'))!=-0x1){_0x5943b3=![];}}else{_0x33679f['rx']=_0x5d2f90;}if(_0x5943b3){return;}if(typeof _0x33679f['cb']==_0x9edd('0x10')){var _0xfd544a=_0x33679f['rx'][_0x9edd('0xd')](0x0,0x3),_0x287ddd=null,_0x3a7b84=null;_0xfd544a=parseInt(_0xfd544a);if(isNaN(_0xfd544a)){_0x33679f['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x9edd('0x11')});return;}if(_0xfd544a!=0xc8){_0x33679f['cb'](null,{'code':_0xfd544a,'result':-0x1,'extra':'KO'});return;}_0x287ddd=_0x33679f['rx']['substring'](0x4)[_0x9edd('0x12')](_0x9edd('0x13'),'');if(_0x287ddd[_0x9edd('0x14')]('\x20')!=-0x1){_0x287ddd=_0x287ddd[_0x9edd('0x15')](0x0,_0x287ddd[_0x9edd('0x14')]('\x20'));}if(_[_0x9edd('0x16')](_0x287ddd,'-1')){_0x287ddd=parseInt(_0x287ddd);}_0x3a7b84=_0x33679f['rx'][_0x9edd('0x17')]('\x20');if(_0x3a7b84[_0x9edd('0x18')]==0x3){_0x3a7b84=_0x3a7b84[0x2]['substring'](0x1,_0x3a7b84[0x2][_0x9edd('0x18')]-0x1);}else if(_0x3a7b84[_0x9edd('0x18')]>0x3){var _0x449cee=/\((.+)\)/;var _0x5acf65=_0x33679f['rx'][_0x9edd('0x19')](_0x449cee);if(_0x5acf65){_0x3a7b84=_0x5acf65[0x1];}else{_0x3a7b84=null;}}else{_0x3a7b84=null;}_0x33679f['cb'](null,{'code':_0xfd544a,'result':_0x287ddd,'extra':_0x3a7b84});}});_0x127cbe['on'](_0x9edd('0x1a'),function(_0x40ba32){_0x3e6d3a['emit'](_0x9edd('0x1a'),new AGIError('E_AGI_SOCKET_ERROR',_0x40ba32[_0x9edd('0x1b')]));});_0x127cbe['on'](_0x9edd('0x1c'),function(){_0x3e6d3a['emit']('close',new AGIError(_0x9edd('0x1d')));});_0x127cbe['on']('timeout',function(){_0x3e6d3a[_0x9edd('0x9')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x127cbe[_0x9edd('0x1e')]();});_0x127cbe[_0x9edd('0x1f')](_0x36b53f);this['command']=function(_0x5823bc,_0x341d67){var _0x5823bc=_0x5823bc||'',_0x341d67=typeof _0x341d67=='function'?_0x341d67:new Function();_0x33679f={'tx':_0x5823bc,'rx':'','cb':_0x341d67};_0x127cbe[_0x9edd('0x20')](_0x5823bc+'\x0a');},this[_0x9edd('0x1c')]=function(){_0x127cbe[_0x9edd('0x1e')]();};}util[_0x9edd('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x9edd('0x22')]['sendRequest']=function(_0x46c383){return this[_0x9edd('0x23')][_0x9edd('0x24')](this,_0x46c383);};AGIChannel[_0x9edd('0x22')][_0x9edd('0x25')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x9edd('0x22')][_0x9edd('0x26')]=function(_0x8d67aa,_0x25e135,_0x3c2227){_0x8d67aa=_0x8d67aa===undefined?'beep':_0x8d67aa;_0x25e135=_0x25e135===undefined?'5':_0x25e135;_0x3c2227=_0x3c2227===undefined?'1':_0x3c2227;return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x28'),_0x8d67aa,_0x25e135*0x3e8,_0x3c2227));};AGIChannel[_0x9edd('0x22')]['noop']=function(_0x238b22){_0x238b22=_0x238b22||_0x9edd('0x29');return this[_0x9edd('0x2a')](util[_0x9edd('0x27')]('VERBOSE\x20\x22%s\x22',_0x238b22));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x2b')]=function(_0xbe87e1,_0x12c1bc){if(_[_0x9edd('0x2c')](_0x12c1bc)){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x2d'),_0xbe87e1,_0x12c1bc[_0x9edd('0x2e')](',')));}return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x2d'),_0xbe87e1,_0x12c1bc));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x2f')]=function(_0x1a6c23){return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x30'),_0x1a6c23));};AGIChannel[_0x9edd('0x22')]['setExtension']=function(_0x2d2f88){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x31'),_0x2d2f88));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x32')]=function(_0x473068){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x33'),_0x473068));};AGIChannel[_0x9edd('0x22')][_0x9edd('0xc')]=function(){return this[_0x9edd('0x2a')](_0x9edd('0x34'));};AGIChannel['prototype'][_0x9edd('0x35')]=function(_0x5ed62d,_0x968303){var _0x148630=_[_0x9edd('0x36')](_0x968303)||_[_0x9edd('0x37')](_0x968303)?_0x968303[_0x9edd('0x38')]():_0x968303;return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x39'),_0x5ed62d,_0x148630?_0x148630[_0x9edd('0x38')]()[_0x9edd('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x3a')]=function(_0x5c0627,_0x1cbbac){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')]('SAY\x20NUMBER\x20%s\x20%s',_0x5c0627,_0x1cbbac));};AGIChannel[_0x9edd('0x22')]['sayDigits']=function(_0x3ef1d5,_0x5658d6){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x3b'),_0x3ef1d5,_0x5658d6));};AGIChannel['prototype'][_0x9edd('0x3c')]=function(_0xcbd0ef,_0x2f8f61){return this['sendRequest'](util[_0x9edd('0x27')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0xcbd0ef,_0x2f8f61));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x3d')]=function(_0x50be2c,_0x315f52,_0x40fdfb){_0x315f52=_0x315f52||this[_0x9edd('0x3e')];_0x40fdfb=_0x40fdfb||0x1;this[_0x9edd('0x2f')](_0x50be2c);this['setExtension'](_0x315f52);this[_0x9edd('0x32')](_0x40fdfb);return this['noop'](util[_0x9edd('0x27')](_0x9edd('0x3f'),_0x50be2c,_0x315f52,_0x40fdfb));};AGIChannel['prototype'][_0x9edd('0x40')]=function(_0x49a128){return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x41'),_0x49a128));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x42')]=function(_0x25e6ec,_0x4737ae,_0x3ff512,_0x75efbe,_0x18c149,_0x2b081a){_0x4737ae=_0x4737ae||_0x9edd('0x43');_0x3ff512=_0x3ff512||'';_0x75efbe=_0x75efbe===undefined?-0x1:_0x75efbe==='-1'?-0x1:_0x75efbe*0x3e8;_0x18c149=_0x18c149===undefined?'':'s='+_0x18c149;_0x2b081a=_0x2b081a?_0x9edd('0x44'):'';return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x45'),_0x25e6ec,_0x4737ae,_0x3ff512,_0x75efbe,_0x2b081a,_0x18c149));};AGIChannel['prototype'][_0x9edd('0x46')]=function(_0x2570e3,_0x2231c1){_0x2231c1=_0x2231c1||'';return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x47'),_0x2570e3,_0x2231c1));};AGIChannel[_0x9edd('0x22')]['agi']=function(_0x4a4656){return this['exec'](_0x9edd('0x48'),_0x4a4656);};AGIChannel['prototype'][_0x9edd('0x49')]=function(_0x19b56b){return this[_0x9edd('0x2b')](_0x9edd('0x4a'),_0x19b56b);};AGIChannel[_0x9edd('0x22')]['error']=function(_0x387fb8,_0x35e63c){this[_0x9edd('0x4b')](util['format'](_0x9edd('0x4c'),_0x387fb8['id'],_0x387fb8[_0x9edd('0x4d')],_0x35e63c));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x9edd('0x4e')]=AGIChannel; \ No newline at end of file +var _0xedd9=['getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','noop','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','emit','line','toLowerCase','hangup','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','destroy','pipe','write','inherits','prototype','command','sync','answer','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','sendRequest','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','GOTO\x20%s\x20%s\x20%s'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xedd9,0xfc));var _0x9edd=function(_0x571c01,_0x164042){_0x571c01=_0x571c01-0x0;var _0x9acf6a=_0xedd9[_0x571c01];return _0x9acf6a;};'use strict';var util=require('util');var _=require(_0x9edd('0x0'));var EventEmitter=require(_0x9edd('0x1'))[_0x9edd('0x2')];var AGIReply=require(_0x9edd('0x3'));var AGIError=require(_0x9edd('0x4'));function AGIChannel(_0x127cbe){var _0x3e6d3a=this,_0x36b53f=new AGIReply(),_0x5943b3=![],_0x33679f={};EventEmitter[_0x9edd('0x5')](_0x3e6d3a);_0x127cbe[_0x9edd('0x6')](_0x9edd('0x7'));_0x127cbe['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x36b53f[_0x9edd('0x6')]('utf8');_0x36b53f['on'](_0x9edd('0x8'),function(_0x190185){for(var _0x1355be in _0x190185){_0x3e6d3a[_0x1355be]=_0x190185[_0x1355be];}_0x3e6d3a[_0x9edd('0x9')]('ready');});_0x36b53f['on'](_0x9edd('0xa'),function(_0x5d2f90){if(_0x5d2f90[_0x9edd('0xb')]()==_0x9edd('0xc')){_0x3e6d3a['emit'](_0x9edd('0xc'));return;}if(_0x5d2f90[_0x9edd('0xd')](0x0,0xb)=='520-Invalid'){_0x5943b3=!![];}if(_0x5943b3){_0x33679f['rx']+=_0x5d2f90+'\x0a';if(_0x5d2f90[_0x9edd('0xe')](_0x9edd('0xf'))!=-0x1){_0x5943b3=![];}}else{_0x33679f['rx']=_0x5d2f90;}if(_0x5943b3){return;}if(typeof _0x33679f['cb']==_0x9edd('0x10')){var _0xfd544a=_0x33679f['rx'][_0x9edd('0xd')](0x0,0x3),_0x287ddd=null,_0x3a7b84=null;_0xfd544a=parseInt(_0xfd544a);if(isNaN(_0xfd544a)){_0x33679f['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x9edd('0x11')});return;}if(_0xfd544a!=0xc8){_0x33679f['cb'](null,{'code':_0xfd544a,'result':-0x1,'extra':'KO'});return;}_0x287ddd=_0x33679f['rx']['substring'](0x4)[_0x9edd('0x12')](_0x9edd('0x13'),'');if(_0x287ddd[_0x9edd('0x14')]('\x20')!=-0x1){_0x287ddd=_0x287ddd[_0x9edd('0x15')](0x0,_0x287ddd[_0x9edd('0x14')]('\x20'));}if(_[_0x9edd('0x16')](_0x287ddd,'-1')){_0x287ddd=parseInt(_0x287ddd);}_0x3a7b84=_0x33679f['rx'][_0x9edd('0x17')]('\x20');if(_0x3a7b84[_0x9edd('0x18')]==0x3){_0x3a7b84=_0x3a7b84[0x2]['substring'](0x1,_0x3a7b84[0x2][_0x9edd('0x18')]-0x1);}else if(_0x3a7b84[_0x9edd('0x18')]>0x3){var _0x449cee=/\((.+)\)/;var _0x5acf65=_0x33679f['rx'][_0x9edd('0x19')](_0x449cee);if(_0x5acf65){_0x3a7b84=_0x5acf65[0x1];}else{_0x3a7b84=null;}}else{_0x3a7b84=null;}_0x33679f['cb'](null,{'code':_0xfd544a,'result':_0x287ddd,'extra':_0x3a7b84});}});_0x127cbe['on'](_0x9edd('0x1a'),function(_0x40ba32){_0x3e6d3a['emit'](_0x9edd('0x1a'),new AGIError('E_AGI_SOCKET_ERROR',_0x40ba32[_0x9edd('0x1b')]));});_0x127cbe['on'](_0x9edd('0x1c'),function(){_0x3e6d3a['emit']('close',new AGIError(_0x9edd('0x1d')));});_0x127cbe['on']('timeout',function(){_0x3e6d3a[_0x9edd('0x9')]('timeout',new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x127cbe[_0x9edd('0x1e')]();});_0x127cbe[_0x9edd('0x1f')](_0x36b53f);this['command']=function(_0x5823bc,_0x341d67){var _0x5823bc=_0x5823bc||'',_0x341d67=typeof _0x341d67=='function'?_0x341d67:new Function();_0x33679f={'tx':_0x5823bc,'rx':'','cb':_0x341d67};_0x127cbe[_0x9edd('0x20')](_0x5823bc+'\x0a');},this[_0x9edd('0x1c')]=function(){_0x127cbe[_0x9edd('0x1e')]();};}util[_0x9edd('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x9edd('0x22')]['sendRequest']=function(_0x46c383){return this[_0x9edd('0x23')][_0x9edd('0x24')](this,_0x46c383);};AGIChannel[_0x9edd('0x22')][_0x9edd('0x25')]=function(){return this['sendRequest']('ANSWER');};AGIChannel[_0x9edd('0x22')][_0x9edd('0x26')]=function(_0x8d67aa,_0x25e135,_0x3c2227){_0x8d67aa=_0x8d67aa===undefined?'beep':_0x8d67aa;_0x25e135=_0x25e135===undefined?'5':_0x25e135;_0x3c2227=_0x3c2227===undefined?'1':_0x3c2227;return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x28'),_0x8d67aa,_0x25e135*0x3e8,_0x3c2227));};AGIChannel[_0x9edd('0x22')]['noop']=function(_0x238b22){_0x238b22=_0x238b22||_0x9edd('0x29');return this[_0x9edd('0x2a')](util[_0x9edd('0x27')]('VERBOSE\x20\x22%s\x22',_0x238b22));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x2b')]=function(_0xbe87e1,_0x12c1bc){if(_[_0x9edd('0x2c')](_0x12c1bc)){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x2d'),_0xbe87e1,_0x12c1bc[_0x9edd('0x2e')](',')));}return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x2d'),_0xbe87e1,_0x12c1bc));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x2f')]=function(_0x1a6c23){return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x30'),_0x1a6c23));};AGIChannel[_0x9edd('0x22')]['setExtension']=function(_0x2d2f88){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x31'),_0x2d2f88));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x32')]=function(_0x473068){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x33'),_0x473068));};AGIChannel[_0x9edd('0x22')][_0x9edd('0xc')]=function(){return this[_0x9edd('0x2a')](_0x9edd('0x34'));};AGIChannel['prototype'][_0x9edd('0x35')]=function(_0x5ed62d,_0x968303){var _0x148630=_[_0x9edd('0x36')](_0x968303)||_[_0x9edd('0x37')](_0x968303)?_0x968303[_0x9edd('0x38')]():_0x968303;return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x39'),_0x5ed62d,_0x148630?_0x148630[_0x9edd('0x38')]()[_0x9edd('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x3a')]=function(_0x5c0627,_0x1cbbac){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')]('SAY\x20NUMBER\x20%s\x20%s',_0x5c0627,_0x1cbbac));};AGIChannel[_0x9edd('0x22')]['sayDigits']=function(_0x3ef1d5,_0x5658d6){return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x3b'),_0x3ef1d5,_0x5658d6));};AGIChannel['prototype'][_0x9edd('0x3c')]=function(_0xcbd0ef,_0x2f8f61){return this['sendRequest'](util[_0x9edd('0x27')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0xcbd0ef,_0x2f8f61));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x3d')]=function(_0x50be2c,_0x315f52,_0x40fdfb){_0x315f52=_0x315f52||this[_0x9edd('0x3e')];_0x40fdfb=_0x40fdfb||0x1;this[_0x9edd('0x2f')](_0x50be2c);this['setExtension'](_0x315f52);this[_0x9edd('0x32')](_0x40fdfb);return this['noop'](util[_0x9edd('0x27')](_0x9edd('0x3f'),_0x50be2c,_0x315f52,_0x40fdfb));};AGIChannel['prototype'][_0x9edd('0x40')]=function(_0x49a128){return this['sendRequest'](util[_0x9edd('0x27')](_0x9edd('0x41'),_0x49a128));};AGIChannel[_0x9edd('0x22')][_0x9edd('0x42')]=function(_0x25e6ec,_0x4737ae,_0x3ff512,_0x75efbe,_0x18c149,_0x2b081a){_0x4737ae=_0x4737ae||_0x9edd('0x43');_0x3ff512=_0x3ff512||'';_0x75efbe=_0x75efbe===undefined?-0x1:_0x75efbe==='-1'?-0x1:_0x75efbe*0x3e8;_0x18c149=_0x18c149===undefined?'':'s='+_0x18c149;_0x2b081a=_0x2b081a?_0x9edd('0x44'):'';return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x45'),_0x25e6ec,_0x4737ae,_0x3ff512,_0x75efbe,_0x2b081a,_0x18c149));};AGIChannel['prototype'][_0x9edd('0x46')]=function(_0x2570e3,_0x2231c1){_0x2231c1=_0x2231c1||'';return this[_0x9edd('0x2a')](util[_0x9edd('0x27')](_0x9edd('0x47'),_0x2570e3,_0x2231c1));};AGIChannel[_0x9edd('0x22')]['agi']=function(_0x4a4656){return this['exec'](_0x9edd('0x48'),_0x4a4656);};AGIChannel['prototype'][_0x9edd('0x49')]=function(_0x19b56b){return this[_0x9edd('0x2b')](_0x9edd('0x4a'),_0x19b56b);};AGIChannel[_0x9edd('0x22')]['error']=function(_0x387fb8,_0x35e63c){this[_0x9edd('0x4b')](util['format'](_0x9edd('0x4c'),_0x387fb8['id'],_0x387fb8[_0x9edd('0x4d')],_0x35e63c));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x9edd('0x4e')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index e296428..41152b8 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 _0x5a52=['E_AGI_UNDEFINED','push','message','name','exports','util','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x5a52,0x18d));var _0x25a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a52[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x25a5('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x25a5('0x1'),'E_AGI_SERVER_MAXCONNECTION':_0x25a5('0x2'),'E_AGI_SERVER_VOICE_DISABLED':_0x25a5('0x3'),'E_AGI_SOCKET_ERROR':_0x25a5('0x4'),'E_AGI_SOCKET_CLOSE':_0x25a5('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x25a5('0x6'),'E_AGI_COMMAND_EMPTY':_0x25a5('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x25a5('0x8'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x2c210a){var _0x2c210a=_0x2c210a||null,_0x2c4b31=_0x2c4b31||[],_0x2d8920=0x1,_0x31a0a='';if(!error[_0x2c210a]){_0x2c210a=_0x25a5('0x9');}_0x2c4b31[_0x25a5('0xa')](error[_0x2c210a]);while(arguments[_0x2d8920]){_0x2c4b31[_0x25a5('0xa')](arguments[_0x2d8920]);_0x2d8920++;}_0x31a0a=util['format']['apply'](util,_0x2c4b31);this[_0x25a5('0xb')]=_0x31a0a;this[_0x25a5('0xc')]=_0x2c210a;}module[_0x25a5('0xd')]=AGIError; \ No newline at end of file +var _0x279d=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x279d,0x1d8));var _0xd279=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x279d[_0x220f3f];return _0x1f170e;};'use strict';var util=require(_0xd279('0x0'));var error={'E_AGI_UNDEFINED':_0xd279('0x1'),'E_AGI_ARGUMENT_PORT':_0xd279('0x2'),'E_AGI_SERVER_ERROR':_0xd279('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xd279('0x4'),'E_AGI_SOCKET_ERROR':_0xd279('0x5'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xd279('0x6'),'E_AGI_COMMAND_EMPTY':_0xd279('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xd279('0x8'),'E_AGI_IVR_ENTRY':_0xd279('0x9')};function AGIError(_0x1d340c){var _0x1d340c=_0x1d340c||null,_0x32938a=_0x32938a||[],_0x5f164e=0x1,_0x3cd28e='';if(!error[_0x1d340c]){_0x1d340c=_0xd279('0xa');}_0x32938a[_0xd279('0xb')](error[_0x1d340c]);while(arguments[_0x5f164e]){_0x32938a[_0xd279('0xb')](arguments[_0x5f164e]);_0x5f164e++;}_0x3cd28e=util[_0xd279('0xc')][_0xd279('0xd')](util,_0x32938a);this[_0xd279('0xe')]=_0x3cd28e;this[_0xd279('0xf')]=_0x1d340c;}module[_0xd279('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 0b72cd4..8d18567 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 _0x253d=['vertices','edges','numberOfEdges','prototype','addEdge','push','relations','getVertex','info','no\x20edge/s\x20available','length','condition','vswitch','target','default','menu','invalid','traverseBFS','agicommand','condition\x20not\x20found','exports','lodash','getsecretdigits'];(function(_0x562001,_0x57f30e){var _0x4f4add=function(_0x216c16){while(--_0x216c16){_0x562001['push'](_0x562001['shift']());}};_0x4f4add(++_0x57f30e);}(_0x253d,0x1b3));var _0xd253=function(_0x29ffa9,_0x5655cd){_0x29ffa9=_0x29ffa9-0x0;var _0x2736eb=_0x253d[_0x29ffa9];return _0x2736eb;};'use strict';var _=require(_0xd253('0x0'));var logger=require('../../../config/logger')('agi');var verticesWithRetry=['menu','getdigits',_0xd253('0x1')];var Graph=function(){this[_0xd253('0x2')]={};this[_0xd253('0x3')]={};this[_0xd253('0x4')]=0x0;};Graph[_0xd253('0x5')]['addVertex']=function(_0x2d03f8){this[_0xd253('0x2')][_0x2d03f8['id']]=_0x2d03f8;this[_0xd253('0x3')][_0x2d03f8['id']]=[];};Graph[_0xd253('0x5')][_0xd253('0x6')]=function(_0x487f4e,_0x2c4de4,_0x712c81){this[_0xd253('0x3')][_0x487f4e][_0xd253('0x7')]({'target':_0x2c4de4,'condition':_0x712c81});this[_0xd253('0x4')]+=0x1;};Graph[_0xd253('0x5')]['size']=function(){return _['size'](this[_0xd253('0x2')]);};Graph['prototype'][_0xd253('0x8')]=function(){return this[_0xd253('0x4')];};Graph[_0xd253('0x5')][_0xd253('0x9')]=function(_0xe041e7){return this[_0xd253('0x2')][_0xe041e7];};Graph['prototype']['traverseBFS']=function(_0x195cdd,_0x1f6480){if(!this[_0xd253('0x2')][_0x195cdd]){return logger['info']('no\x20vertex\x20found');}var _0x3a4c2e=_0x1f6480(this[_0xd253('0x2')][_0x195cdd]);if(!_0x3a4c2e){return logger[_0xd253('0xa')]('stop\x20traverse');}if(this[_0xd253('0x3')][_0x195cdd]['length']===0x0){return logger[_0xd253('0xa')](_0xd253('0xb'));}for(var _0x24fa24=0x0,_0x5196a3=[],_0x1b7ed1=![];_0x24fa24\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','mxGraphModel','root','agicommand','hasOwnProperty','maxRetry','retry','addVertex','mxCell','isArray','source','target','addEdge','value','then','catch','createSquareReport','substring','inspect','debug','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','hangup','production','start','YYYY-MM-DD\x20HH:mm:ss','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','vertex','gotoc','context','extension','priority','code','result','response','isUndefined','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense'];(function(_0x1c9c51,_0x5b5acf){var _0x34fd64=function(_0x557106){while(--_0x557106){_0x1c9c51['push'](_0x1c9c51['shift']());}};_0x34fd64(++_0x5b5acf);}(_0x5178,0x171));var _0x8517=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5178[_0x2dafbe];return _0x58a45a;};'use strict';var parser=require('xml2json');var _=require(_0x8517('0x0'));var syncho=require(_0x8517('0x1'));var util=require(_0x8517('0x2'));var moment=require(_0x8517('0x3'));var config=require(_0x8517('0x4'));var logger=require('../../config/logger')('agi');var utilLicense=require(_0x8517('0x5'));var rpc=require(_0x8517('0x6'));var mailRpc=require('./mailRpc');var Graph=require(_0x8517('0x7'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x8517('0x8')]=_[_0x8517('0x9')](config[_0x8517('0x8')],{'ip':_0x8517('0xa'),'port':0x11dd});function connectionHandler(_0x25146d){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x25146d);agiHandler(_0x25146d);}catch(_0x46f6aa){logger['error'](_0x46f6aa['stack']);}});});}function listeningHandler(){console[_0x8517('0xb')](_0x8517('0xc'),config['agi'][_0x8517('0xd')]);logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x10'),config[_0x8517('0x8')]['ip'],config[_0x8517('0x8')][_0x8517('0xd')]));}function errorHandler(_0x12388f){if(_0x12388f&&_0x12388f['name']&&_0x12388f[_0x8517('0x11')]){logger[_0x8517('0x12')](util[_0x8517('0xf')](_0x8517('0x13'),_0x12388f[_0x8517('0x14')],_0x12388f['message']));}else{logger[_0x8517('0x12')](util[_0x8517('0xf')](_0x8517('0x15'),_0x12388f[_0x8517('0x16')]));}}function closeHandler(){logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x17'),this[_0x8517('0x18')],this[_0x8517('0x19')],this[_0x8517('0x1a')],this[_0x8517('0x1b')],this[_0x8517('0x1c')]));try{createSquareReport(this);}catch(_0x50e2de){logger[_0x8517('0x12')](_0x50e2de[_0x8517('0x16')]);}}function timeoutHandler(){logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x1d'),this[_0x8517('0x18')],this[_0x8517('0x19')],this['callerid'],this[_0x8517('0x1b')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0x8517('0xf')](_0x8517('0x1e'),this[_0x8517('0x18')],this[_0x8517('0x19')],this[_0x8517('0x1a')],this[_0x8517('0x1b')],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x2dd1df){return parser[_0x8517('0x1f')](_0x2dd1df,{'object':!![]})[_0x8517('0x20')][_0x8517('0x21')];}function addVertex(_0x3a5f0b,_0x2e6e47,_0x5f02ee){_0x2e6e47[_0x8517('0x22')]=_0x5f02ee;if(_0x2e6e47[_0x8517('0x23')]('retry')){_0x2e6e47[_0x8517('0x24')]=parseInt(_0x2e6e47[_0x8517('0x25')],0xa);}_0x3a5f0b[_0x8517('0x26')](_['omit'](_0x2e6e47,_0x8517('0x27')));}function initGraph(_0x572ce4,_0x2880b6){var _0x2a2b7e=new Graph();for(var _0x448211 in _0x572ce4){if(_0x572ce4[_0x8517('0x23')](_0x448211)){if(_[_0x8517('0x28')](_0x572ce4[_0x448211])){for(var _0x300e3f=0x0;_0x300e3f<_0x572ce4[_0x448211]['length'];_0x300e3f+=0x1){addVertex(_0x2a2b7e,_0x572ce4[_0x448211][_0x300e3f],_0x448211);}}else{addVertex(_0x2a2b7e,_0x572ce4[_0x448211],_0x448211);}}}for(var _0x39764e=0x0;_0x39764e<_0x2880b6['length'];_0x39764e+=0x1){if(_0x2880b6[_0x39764e][_0x8517('0x29')]&&_0x2880b6[_0x39764e][_0x8517('0x2a')]){_0x2a2b7e[_0x8517('0x2b')](_0x2880b6[_0x39764e][_0x8517('0x29')],_0x2880b6[_0x39764e][_0x8517('0x2a')],_0x2880b6[_0x39764e][_0x8517('0x2c')]);}}return _0x2a2b7e;}function getSquareProject(_0x4c691f,_0x20ec0a){rpc['getSquareProject'](_0x4c691f)[_0x8517('0x2d')](function(_0x4b9983){_0x20ec0a(null,_0x4b9983);})[_0x8517('0x2e')](function(_0x2d360c){_0x20ec0a(null,_0x2d360c);});}function createSquareReport(_0x3cf945,_0x14eb04){rpc[_0x8517('0x2f')](_0x3cf945)[_0x8517('0x2d')](function(_0x647d81){if(_0x14eb04){_0x14eb04(null,_0x647d81);}})['catch'](function(_0x3e8f81){if(_0x14eb04){_0x14eb04(null,_0x3e8f81);}});}function setChannelVariables(_0x1031b3){for(var _0x773e3c in _0x1031b3){if(_0x1031b3['hasOwnProperty'](_0x773e3c)){if(_0x773e3c['indexOf']('agi_')===0x0){_0x1031b3[_0x773e3c[_0x8517('0x30')](0x4)]=_0x1031b3[_0x773e3c];delete _0x1031b3[_0x773e3c];}}}}function getLogFromObject(_0x4102b4){return util[_0x8517('0x31')](_0x4102b4,{'showHidden':![],'depth':null});}function agiHandler(_0x2abad4){var _0x5ed2a9,_0x254566,_0x5d9d04,_0x19dd26,_0x234da4;logger[_0x8517('0x32')]('variables',JSON[_0x8517('0x33')](_0x2abad4,null,0x2));logger['info'](util[_0x8517('0xf')](_0x8517('0x34'),_0x2abad4['arg_1'],_0x2abad4['calleridname'],_0x2abad4[_0x8517('0x1a')],_0x2abad4[_0x8517('0x1b')],_0x2abad4[_0x8517('0x1c')]));_0x2abad4['on'](_0x8517('0x12'),errorHandler);_0x2abad4['on']('close',closeHandler);_0x2abad4['on']('timeout',timeoutHandler);_0x2abad4[_0x8517('0x35')]=![];_0x2abad4['on'](_0x8517('0x36'),hangupHandler);var _0x1835ac=getSquareProject['sync'](null,_0x2abad4[_0x8517('0x18')]);if(_0x1835ac){if(_0x1835ac[_0x8517('0x37')]){_0x5ed2a9=getRoot(_0x1835ac['production']);if(_0x5ed2a9&&_0x5ed2a9[_0x8517('0x38')]){logger[_0x8517('0x32')](_0x8517('0x21'),JSON[_0x8517('0x33')](_0x5ed2a9,null,0x2));_0x2abad4['joinAt']=moment()[_0x8517('0xf')](_0x8517('0x39'));_0x254566=initGraph(_[_0x8517('0x3a')](_0x5ed2a9,_0x8517('0x27')),_0x5ed2a9[_0x8517('0x27')]);_0x5d9d04=new Vertices(_0x2abad4,rpc,mailRpc);logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x3b'),_0x2abad4[_0x8517('0x18')],_0x2abad4[_0x8517('0x19')],_0x2abad4[_0x8517('0x1a')],_0x2abad4[_0x8517('0x1b')],_0x2abad4[_0x8517('0x1c')]));_0x254566['traverseBFS'](_0x5ed2a9['start']['id'],function(_0x3f1219){try{_0x3f1219=_0x5d9d04[_0x8517('0x3c')](_0x3f1219);logger[_0x8517('0x32')](_0x8517('0x3d'),JSON[_0x8517('0x33')](_0x3f1219,null,0x2));if(_0x3f1219['agicommand']===_0x8517('0x3e')){logger[_0x8517('0xe')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x2abad4[_0x8517('0x3f')]=_0x3f1219[_0x8517('0x3f')]||_0x2abad4[_0x8517('0x3f')];_0x2abad4[_0x8517('0x40')]=_0x3f1219['extension'];_0x2abad4[_0x8517('0x41')]=_0x3f1219[_0x8517('0x41')]?_0x3f1219['priority']-0x1:0x1;return null;}else if(_0x3f1219&&_0x5d9d04[_0x3f1219[_0x8517('0x22')]]){_0x234da4=_0x5d9d04[_0x3f1219[_0x8517('0x22')]](_0x3f1219);logger[_0x8517('0xe')]('response',JSON[_0x8517('0x33')](_0x234da4,null,0x2));if(_0x234da4&&_0x234da4[_0x8517('0x42')]===AGI_CODE_SUCCESS&&_0x234da4[_0x8517('0x43')]!==AGI_RESULT_ERROR&&!_0x2abad4[_0x8517('0x35')]){logger[_0x8517('0x32')](_0x8517('0x44'),getLogFromObject(_0x234da4));return _[_0x8517('0x45')](_0x234da4['result'])?null:_0x234da4[_0x8517('0x43')][_0x8517('0x46')]();}else{logger['error'](_0x8517('0x44'),getLogFromObject(_0x234da4));return null;}}else{logger[_0x8517('0x12')](_0x8517('0x47'));return null;}}catch(_0x333553){logger[_0x8517('0x12')](_0x333553[_0x8517('0x16')]);return null;}});if(_0x5ed2a9['finally']){logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x48'),_0x2abad4['arg_1'],_0x2abad4[_0x8517('0x19')],_0x2abad4[_0x8517('0x1a')],_0x2abad4['dnid'],_0x2abad4[_0x8517('0x1c')]));_0x254566[_0x8517('0x49')](_0x5ed2a9['finally']['id'],function(_0x54b346){try{_0x54b346=_0x5d9d04['clear'](_0x54b346);logger[_0x8517('0x32')](_0x8517('0x3d'),JSON['stringify'](_0x54b346,null,0x2));if(_0x54b346&&_0x5d9d04[_0x54b346[_0x8517('0x22')]]){_0x234da4=_0x5d9d04[_0x54b346['agicommand']](_0x54b346);if(_0x234da4){logger['debug'](_0x8517('0x44'),getLogFromObject(_0x234da4));return _[_0x8517('0x45')](_0x234da4[_0x8517('0x43')])?null:_0x234da4[_0x8517('0x43')]['toString']();}else{logger[_0x8517('0x12')](_0x8517('0x44'),getLogFromObject(_0x234da4));return null;}}else{logger[_0x8517('0x12')]('agicommand\x20not\x20found');return null;}}catch(_0x15102f){logger[_0x8517('0x12')](_0x15102f[_0x8517('0x16')]);return null;}});}logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x4a'),_0x2abad4[_0x8517('0x18')],_0x2abad4['calleridname'],_0x2abad4[_0x8517('0x1a')],_0x2abad4['dnid'],_0x2abad4['uniqueid']));logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x4b'),_0x2abad4[_0x8517('0x3f')],_0x2abad4['extension'],parseInt(_0x2abad4[_0x8517('0x41')],0xa)+0x1));_0x2abad4[_0x8517('0x4c')](_0x2abad4['context'],_0x2abad4['extension'],parseInt(_0x2abad4[_0x8517('0x41')],0xa)+0x1);_0x2abad4[_0x8517('0x4d')]();}}else{logger[_0x8517('0x12')](util['format'](_0x8517('0x4e'),_0x2abad4['arg_1']));_0x2abad4[_0x8517('0x4c')](_0x2abad4[_0x8517('0x3f')],_0x2abad4[_0x8517('0x40')],parseInt(_0x2abad4[_0x8517('0x41')],0xa)+0x1);_0x2abad4[_0x8517('0x4d')]();}}else{logger[_0x8517('0x12')](util[_0x8517('0xf')](_0x8517('0x4f'),_0x2abad4[_0x8517('0x18')]));_0x2abad4['continueAt'](_0x2abad4['context'],_0x2abad4[_0x8517('0x40')],parseInt(_0x2abad4[_0x8517('0x41')],0xa)+0x1);_0x2abad4[_0x8517('0x4d')]();}}function main(){var _0x5e82ab;return utilLicense[_0x8517('0x50')]()[_0x8517('0x2d')](function(_0x445f9b){if(_0x445f9b){if(_0x445f9b['voice']){if(_0x445f9b['callysquare']&&_0x445f9b[_0x8517('0x51')]>0x0){logger[_0x8517('0xe')](util[_0x8517('0xf')](_0x8517('0x52'),_0x445f9b[_0x8517('0x51')]));_0x5e82ab=_0x445f9b[_0x8517('0x51')];}else{logger[_0x8517('0xe')](_0x8517('0x53'));}}else{logger[_0x8517('0xe')](_0x8517('0x54'));_0x5e82ab=-0x1;}}})[_0x8517('0x2e')](function(_0x3c5462){logger[_0x8517('0x12')](_0x8517('0x55'),_0x3c5462[_0x8517('0x16')]);})[_0x8517('0x56')](function(){var _0x5c3932=require(_0x8517('0x57'))(config[_0x8517('0x8')][_0x8517('0xd')],config[_0x8517('0x8')]['ip'],_0x5e82ab);_0x5c3932['on'](_0x8517('0x12'),errorHandler);_0x5c3932['on'](_0x8517('0x58'),listeningHandler);_0x5c3932['on'](_0x8517('0x59'),connectionHandler);_0x5c3932['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0xafdd=['addEdge','source','value','catch','createSquareReport','then','indexOf','agi_','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','vertex','gotoc','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]','listening','connection','xml2json','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','defaults','nextTick','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','[%s]\x20%s','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','error','arg_1','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','target'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xafdd,0x19a));var _0xdafd=function(_0x225e28,_0x174249){_0x225e28=_0x225e28-0x0;var _0x238680=_0xafdd[_0x225e28];return _0x238680;};'use strict';var parser=require(_0xdafd('0x0'));var _=require(_0xdafd('0x1'));var syncho=require(_0xdafd('0x2'));var util=require(_0xdafd('0x3'));var moment=require(_0xdafd('0x4'));var config=require(_0xdafd('0x5'));var logger=require(_0xdafd('0x6'))(_0xdafd('0x7'));var utilLicense=require('../../config/license/util');var rpc=require(_0xdafd('0x8'));var mailRpc=require(_0xdafd('0x9'));var Graph=require(_0xdafd('0xa'));var Vertices=require(_0xdafd('0xb'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xdafd('0x7')]=_[_0xdafd('0xc')](config[_0xdafd('0x7')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x9b9c6b){process[_0xdafd('0xd')](function(){syncho(function(){try{setChannelVariables(_0x9b9c6b);agiHandler(_0x9b9c6b);}catch(_0x7a279f){logger['error'](_0x7a279f[_0xdafd('0xe')]);}});});}function listeningHandler(){console[_0xdafd('0xf')](_0xdafd('0x10'),config[_0xdafd('0x7')]['port']);logger[_0xdafd('0x11')](util[_0xdafd('0x12')](_0xdafd('0x13'),config[_0xdafd('0x7')]['ip'],config[_0xdafd('0x7')][_0xdafd('0x14')]));}function errorHandler(_0x56ad21){if(_0x56ad21&&_0x56ad21[_0xdafd('0x15')]&&_0x56ad21['message']){logger['error'](util[_0xdafd('0x12')](_0xdafd('0x16'),_0x56ad21['name'],_0x56ad21[_0xdafd('0x17')]));}else{logger['error'](util['format'](_0xdafd('0x18'),_0x56ad21[_0xdafd('0xe')]));}}function closeHandler(){logger[_0xdafd('0x11')](util[_0xdafd('0x12')](_0xdafd('0x19'),this['arg_1'],this[_0xdafd('0x1a')],this[_0xdafd('0x1b')],this[_0xdafd('0x1c')],this['uniqueid']));try{createSquareReport(this);}catch(_0xb382ca){logger[_0xdafd('0x1d')](_0xb382ca['stack']);}}function timeoutHandler(){logger['info'](util[_0xdafd('0x12')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xdafd('0x1e')],this[_0xdafd('0x1a')],this[_0xdafd('0x1b')],this[_0xdafd('0x1c')],this[_0xdafd('0x1f')]));}function hangupHandler(){logger[_0xdafd('0x11')](util[_0xdafd('0x12')](_0xdafd('0x20'),this[_0xdafd('0x1e')],this[_0xdafd('0x1a')],this[_0xdafd('0x1b')],this[_0xdafd('0x1c')],this[_0xdafd('0x1f')]));this[_0xdafd('0x21')]=!![];}function getRoot(_0x491d96){return parser[_0xdafd('0x22')](_0x491d96,{'object':!![]})['mxGraphModel'][_0xdafd('0x23')];}function addVertex(_0x5e96cc,_0x439bbf,_0x35ef78){_0x439bbf[_0xdafd('0x24')]=_0x35ef78;if(_0x439bbf[_0xdafd('0x25')](_0xdafd('0x26'))){_0x439bbf[_0xdafd('0x27')]=parseInt(_0x439bbf[_0xdafd('0x26')],0xa);}_0x5e96cc[_0xdafd('0x28')](_[_0xdafd('0x29')](_0x439bbf,'mxCell'));}function initGraph(_0x26349d,_0x2ab575){var _0x18554c=new Graph();for(var _0x1feb5b in _0x26349d){if(_0x26349d[_0xdafd('0x25')](_0x1feb5b)){if(_[_0xdafd('0x2a')](_0x26349d[_0x1feb5b])){for(var _0x383845=0x0;_0x383845<_0x26349d[_0x1feb5b][_0xdafd('0x2b')];_0x383845+=0x1){addVertex(_0x18554c,_0x26349d[_0x1feb5b][_0x383845],_0x1feb5b);}}else{addVertex(_0x18554c,_0x26349d[_0x1feb5b],_0x1feb5b);}}}for(var _0x1c7083=0x0;_0x1c7083<_0x2ab575[_0xdafd('0x2b')];_0x1c7083+=0x1){if(_0x2ab575[_0x1c7083]['source']&&_0x2ab575[_0x1c7083][_0xdafd('0x2c')]){_0x18554c[_0xdafd('0x2d')](_0x2ab575[_0x1c7083][_0xdafd('0x2e')],_0x2ab575[_0x1c7083][_0xdafd('0x2c')],_0x2ab575[_0x1c7083][_0xdafd('0x2f')]);}}return _0x18554c;}function getSquareProject(_0x324f0f,_0x5199e1){rpc['getSquareProject'](_0x324f0f)['then'](function(_0xcca4f){_0x5199e1(null,_0xcca4f);})[_0xdafd('0x30')](function(_0x568996){_0x5199e1(null,_0x568996);});}function createSquareReport(_0x4f6cb1,_0x4172ea){rpc[_0xdafd('0x31')](_0x4f6cb1)[_0xdafd('0x32')](function(_0x243b1c){if(_0x4172ea){_0x4172ea(null,_0x243b1c);}})[_0xdafd('0x30')](function(_0xa8b2ac){if(_0x4172ea){_0x4172ea(null,_0xa8b2ac);}});}function setChannelVariables(_0x3e1287){for(var _0x5cc406 in _0x3e1287){if(_0x3e1287[_0xdafd('0x25')](_0x5cc406)){if(_0x5cc406[_0xdafd('0x33')](_0xdafd('0x34'))===0x0){_0x3e1287[_0x5cc406['substring'](0x4)]=_0x3e1287[_0x5cc406];delete _0x3e1287[_0x5cc406];}}}}function getLogFromObject(_0xc187e0){return util[_0xdafd('0x35')](_0xc187e0,{'showHidden':![],'depth':null});}function agiHandler(_0x5e0995){var _0x5e785a,_0x331044,_0x192ed3,_0x4a46a9,_0x41cf77;logger[_0xdafd('0x36')](_0xdafd('0x37'),JSON[_0xdafd('0x38')](_0x5e0995,null,0x2));logger[_0xdafd('0x11')](util[_0xdafd('0x12')](_0xdafd('0x39'),_0x5e0995['arg_1'],_0x5e0995[_0xdafd('0x1a')],_0x5e0995[_0xdafd('0x1b')],_0x5e0995[_0xdafd('0x1c')],_0x5e0995[_0xdafd('0x1f')]));_0x5e0995['on'](_0xdafd('0x1d'),errorHandler);_0x5e0995['on']('close',closeHandler);_0x5e0995['on'](_0xdafd('0x3a'),timeoutHandler);_0x5e0995[_0xdafd('0x21')]=![];_0x5e0995['on']('hangup',hangupHandler);var _0x3dbdb1=getSquareProject[_0xdafd('0x3b')](null,_0x5e0995[_0xdafd('0x1e')]);if(_0x3dbdb1){if(_0x3dbdb1[_0xdafd('0x3c')]){_0x5e785a=getRoot(_0x3dbdb1[_0xdafd('0x3c')]);if(_0x5e785a&&_0x5e785a[_0xdafd('0x3d')]){logger[_0xdafd('0x36')](_0xdafd('0x23'),JSON[_0xdafd('0x38')](_0x5e785a,null,0x2));_0x5e0995[_0xdafd('0x3e')]=moment()[_0xdafd('0x12')](_0xdafd('0x3f'));_0x331044=initGraph(_[_0xdafd('0x29')](_0x5e785a,_0xdafd('0x40')),_0x5e785a[_0xdafd('0x40')]);_0x192ed3=new Vertices(_0x5e0995,rpc,mailRpc);logger[_0xdafd('0x11')](util[_0xdafd('0x12')](_0xdafd('0x41'),_0x5e0995[_0xdafd('0x1e')],_0x5e0995[_0xdafd('0x1a')],_0x5e0995[_0xdafd('0x1b')],_0x5e0995[_0xdafd('0x1c')],_0x5e0995[_0xdafd('0x1f')]));_0x331044[_0xdafd('0x42')](_0x5e785a[_0xdafd('0x3d')]['id'],function(_0x21d43d){try{_0x21d43d=_0x192ed3['clear'](_0x21d43d);logger['debug'](_0xdafd('0x43'),JSON['stringify'](_0x21d43d,null,0x2));if(_0x21d43d[_0xdafd('0x24')]===_0xdafd('0x44')){logger['info']('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x5e0995[_0xdafd('0x45')]=_0x21d43d[_0xdafd('0x45')]||_0x5e0995[_0xdafd('0x45')];_0x5e0995[_0xdafd('0x46')]=_0x21d43d[_0xdafd('0x46')];_0x5e0995[_0xdafd('0x47')]=_0x21d43d[_0xdafd('0x47')]?_0x21d43d[_0xdafd('0x47')]-0x1:0x1;return null;}else if(_0x21d43d&&_0x192ed3[_0x21d43d[_0xdafd('0x24')]]){_0x41cf77=_0x192ed3[_0x21d43d['agicommand']](_0x21d43d);logger['info'](_0xdafd('0x48'),JSON[_0xdafd('0x38')](_0x41cf77,null,0x2));if(_0x41cf77&&_0x41cf77[_0xdafd('0x49')]===AGI_CODE_SUCCESS&&_0x41cf77[_0xdafd('0x4a')]!==AGI_RESULT_ERROR&&!_0x5e0995[_0xdafd('0x21')]){logger[_0xdafd('0x36')](_0xdafd('0x48'),getLogFromObject(_0x41cf77));return _[_0xdafd('0x4b')](_0x41cf77[_0xdafd('0x4a')])?null:_0x41cf77[_0xdafd('0x4a')][_0xdafd('0x4c')]();}else{logger[_0xdafd('0x1d')](_0xdafd('0x48'),getLogFromObject(_0x41cf77));return null;}}else{logger['error'](_0xdafd('0x4d'));return null;}}catch(_0x536227){logger[_0xdafd('0x1d')](_0x536227['stack']);return null;}});if(_0x5e785a[_0xdafd('0x4e')]){logger[_0xdafd('0x11')](util[_0xdafd('0x12')](_0xdafd('0x4f'),_0x5e0995[_0xdafd('0x1e')],_0x5e0995[_0xdafd('0x1a')],_0x5e0995['callerid'],_0x5e0995[_0xdafd('0x1c')],_0x5e0995[_0xdafd('0x1f')]));_0x331044[_0xdafd('0x42')](_0x5e785a[_0xdafd('0x4e')]['id'],function(_0x462aa6){try{_0x462aa6=_0x192ed3['clear'](_0x462aa6);logger['debug'](_0xdafd('0x43'),JSON[_0xdafd('0x38')](_0x462aa6,null,0x2));if(_0x462aa6&&_0x192ed3[_0x462aa6[_0xdafd('0x24')]]){_0x41cf77=_0x192ed3[_0x462aa6[_0xdafd('0x24')]](_0x462aa6);if(_0x41cf77){logger[_0xdafd('0x36')](_0xdafd('0x48'),getLogFromObject(_0x41cf77));return _[_0xdafd('0x4b')](_0x41cf77[_0xdafd('0x4a')])?null:_0x41cf77[_0xdafd('0x4a')]['toString']();}else{logger[_0xdafd('0x1d')](_0xdafd('0x48'),getLogFromObject(_0x41cf77));return null;}}else{logger[_0xdafd('0x1d')](_0xdafd('0x4d'));return null;}}catch(_0x4f204a){logger[_0xdafd('0x1d')](_0x4f204a[_0xdafd('0xe')]);return null;}});}logger[_0xdafd('0x11')](util[_0xdafd('0x12')](_0xdafd('0x50'),_0x5e0995['arg_1'],_0x5e0995['calleridname'],_0x5e0995[_0xdafd('0x1b')],_0x5e0995[_0xdafd('0x1c')],_0x5e0995['uniqueid']));logger['info'](util[_0xdafd('0x12')](_0xdafd('0x51'),_0x5e0995['context'],_0x5e0995[_0xdafd('0x46')],parseInt(_0x5e0995[_0xdafd('0x47')],0xa)+0x1));_0x5e0995[_0xdafd('0x52')](_0x5e0995['context'],_0x5e0995['extension'],parseInt(_0x5e0995[_0xdafd('0x47')],0xa)+0x1);_0x5e0995[_0xdafd('0x53')]();}}else{logger['error'](util[_0xdafd('0x12')]('Project\x20%s\x20not\x20published',_0x5e0995['arg_1']));_0x5e0995[_0xdafd('0x52')](_0x5e0995[_0xdafd('0x45')],_0x5e0995[_0xdafd('0x46')],parseInt(_0x5e0995[_0xdafd('0x47')],0xa)+0x1);_0x5e0995[_0xdafd('0x53')]();}}else{logger[_0xdafd('0x1d')](util[_0xdafd('0x12')](_0xdafd('0x54'),_0x5e0995['arg_1']));_0x5e0995[_0xdafd('0x52')](_0x5e0995[_0xdafd('0x45')],_0x5e0995['extension'],parseInt(_0x5e0995[_0xdafd('0x47')],0xa)+0x1);_0x5e0995[_0xdafd('0x53')]();}}function main(){var _0x264afd;return utilLicense[_0xdafd('0x55')]()[_0xdafd('0x32')](function(_0x556f7e){if(_0x556f7e){if(_0x556f7e[_0xdafd('0x56')]){if(_0x556f7e[_0xdafd('0x57')]&&_0x556f7e[_0xdafd('0x57')]>0x0){logger[_0xdafd('0x11')](util[_0xdafd('0x12')]('[LICENSE]\x20CHANNELS:\x20%s',_0x556f7e[_0xdafd('0x57')]));_0x264afd=_0x556f7e[_0xdafd('0x57')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xdafd('0x11')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x264afd=-0x1;}}})[_0xdafd('0x30')](function(_0x4a8ca1){logger[_0xdafd('0x1d')](_0xdafd('0x58'),_0x4a8ca1[_0xdafd('0xe')]);})['finally'](function(){var _0xf2f551=require('./server')(config[_0xdafd('0x7')][_0xdafd('0x14')],config['agi']['ip'],_0x264afd);_0xf2f551['on'](_0xdafd('0x1d'),errorHandler);_0xf2f551['on'](_0xdafd('0x59'),listeningHandler);_0xf2f551['on'](_0xdafd('0x5a'),connectionHandler);_0xf2f551['on'](_0xdafd('0x53'),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 3e1d946..21a387e 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 _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x20bde8,_0x5a58d4){var _0x5f9432=function(_0x2f854c){while(--_0x2f854c){_0x20bde8['push'](_0x20bde8['shift']());}};_0x5f9432(++_0x5a58d4);}(_0x814b,0x1a2));var _0xb814=function(_0x31880d,_0x4f0ff3){_0x31880d=_0x31880d-0x0;var _0x423823=_0x814b[_0x31880d];return _0x423823;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0x57d22b,_0x5b6f8a){var _0x4e92c1=function(_0x410f6e){while(--_0x410f6e){_0x57d22b['push'](_0x57d22b['shift']());}};_0x4e92c1(++_0x5b6f8a);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index c05e169..0effcd3 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 _0x7a54=['substring','length','split','indexOf','slice','trim','emit','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody'];(function(_0x3005bb,_0xe9520d){var _0x2f866b=function(_0x10c253){while(--_0x10c253){_0x3005bb['push'](_0x3005bb['shift']());}};_0x2f866b(++_0xe9520d);}(_0x7a54,0x106));var _0x47a5=function(_0x11b83a,_0x1909db){_0x11b83a=_0x11b83a-0x0;var _0x4f686f=_0x7a54[_0x11b83a];return _0x4f686f;};'use strict';var util=require(_0x47a5('0x0'));var Transform=require(_0x47a5('0x1'))[_0x47a5('0x2')];function AGIReply(_0x58157c){Transform[_0x47a5('0x3')](this,_0x58157c);this[_0x47a5('0x4')]='';this['_inBody']=![];}util[_0x47a5('0x5')](AGIReply,Transform);AGIReply[_0x47a5('0x6')][_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){var _0x3d5629='\x0a',_0x59199c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x343372=-0x1,_0x30e405=-0x1,_0x506eda='',_0x194fb0=0x0,_0x5077f3='',_0x5d90b3='';this[_0x47a5('0x4')]+=_0x3717e1[_0x47a5('0x8')]();_0x5077f3=this['_localBuffer'];if(!this[_0x47a5('0x9')]){_0x194fb0=0x0;while(_0x59199c[_0x194fb0]){while((_0x30e405=_0x5077f3['indexOf'](_0x59199c[_0x194fb0]))!=-0x1){_0x506eda=_0x59199c[_0x194fb0];_0x5d90b3=_0x5077f3['substring'](0x0,_0x30e405);_0x5077f3=_0x5077f3[_0x47a5('0xa')](_0x30e405+_0x506eda[_0x47a5('0xb')]);var _0x2f399b=_0x5d90b3[_0x47a5('0xc')](_0x3d5629),_0x250fad=0x0,_0xd612dd={},_0xd308b8='',_0x1eae59='',_0x5beb89=-0x1;while(_0x2f399b[_0x250fad]){_0x5beb89=_0x2f399b[_0x250fad][_0x47a5('0xd')](':');if(_0x5beb89!=-0x1){_0xd308b8=_0x2f399b[_0x250fad][_0x47a5('0xe')](0x0,_0x5beb89)[_0x47a5('0xf')]();_0x1eae59=_0x2f399b[_0x250fad][_0x47a5('0xe')](_0x5beb89+0x1)[_0x47a5('0xf')]();if(_0xd308b8[_0x47a5('0xb')]>0x0){_0xd612dd[_0xd308b8]=_0x1eae59;}}else{}_0x250fad++;}this[_0x47a5('0x10')]('headers',_0xd612dd);this[_0x47a5('0x9')]=!![];}_0x194fb0++;}this[_0x47a5('0x4')]=_0x5077f3;}else{while((_0x343372=_0x5077f3[_0x47a5('0xd')](_0x3d5629))!=-0x1){_0x5d90b3=_0x5077f3[_0x47a5('0xa')](0x0,_0x343372);this[_0x47a5('0x10')]('line',_0x5d90b3);_0x5077f3=_0x5077f3['substring'](_0x343372+_0x3d5629[_0x47a5('0xb')]);}this['_localBuffer']=_0x5077f3;}_0x545a97();};module['exports']=AGIReply; \ No newline at end of file +var _0xb10b=['call','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','indexOf','substring','split','trim','slice','length','emit','headers','line','exports','util','Transform'];(function(_0x565d0a,_0x4927cc){var _0x24c211=function(_0x18ae2b){while(--_0x18ae2b){_0x565d0a['push'](_0x565d0a['shift']());}};_0x24c211(++_0x4927cc);}(_0xb10b,0x12a));var _0xbb10=function(_0x569970,_0x16f028){_0x569970=_0x569970-0x0;var _0x13cc81=_0xb10b[_0x569970];return _0x13cc81;};'use strict';var util=require(_0xbb10('0x0'));var Transform=require('stream')[_0xbb10('0x1')];function AGIReply(_0x35bc5f){Transform[_0xbb10('0x2')](this,_0x35bc5f);this['_localBuffer']='';this[_0xbb10('0x3')]=![];}util[_0xbb10('0x4')](AGIReply,Transform);AGIReply[_0xbb10('0x5')][_0xbb10('0x6')]=function(_0x49baf4,_0x312b72,_0x481979){var _0x328583='\x0a',_0x3cdd53=['\x0a\x0a',_0xbb10('0x7')],_0x513741=-0x1,_0x1b9e94=-0x1,_0x3fb675='',_0x21370f=0x0,_0x1c3ee5='',_0x2353ef='';this[_0xbb10('0x8')]+=_0x49baf4[_0xbb10('0x9')]();_0x1c3ee5=this['_localBuffer'];if(!this['_inBody']){_0x21370f=0x0;while(_0x3cdd53[_0x21370f]){while((_0x1b9e94=_0x1c3ee5[_0xbb10('0xa')](_0x3cdd53[_0x21370f]))!=-0x1){_0x3fb675=_0x3cdd53[_0x21370f];_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x1b9e94);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x1b9e94+_0x3fb675['length']);var _0x408248=_0x2353ef[_0xbb10('0xc')](_0x328583),_0x5be7e0=0x0,_0x44fb19={},_0x916a32='',_0x285009='',_0x193a27=-0x1;while(_0x408248[_0x5be7e0]){_0x193a27=_0x408248[_0x5be7e0][_0xbb10('0xa')](':');if(_0x193a27!=-0x1){_0x916a32=_0x408248[_0x5be7e0]['slice'](0x0,_0x193a27)[_0xbb10('0xd')]();_0x285009=_0x408248[_0x5be7e0][_0xbb10('0xe')](_0x193a27+0x1)[_0xbb10('0xd')]();if(_0x916a32[_0xbb10('0xf')]>0x0){_0x44fb19[_0x916a32]=_0x285009;}}else{}_0x5be7e0++;}this[_0xbb10('0x10')](_0xbb10('0x11'),_0x44fb19);this[_0xbb10('0x3')]=!![];}_0x21370f++;}this[_0xbb10('0x8')]=_0x1c3ee5;}else{while((_0x513741=_0x1c3ee5[_0xbb10('0xa')](_0x328583))!=-0x1){_0x2353ef=_0x1c3ee5[_0xbb10('0xb')](0x0,_0x513741);this['emit'](_0xbb10('0x12'),_0x2353ef);_0x1c3ee5=_0x1c3ee5[_0xbb10('0xb')](_0x513741+_0x328583[_0xbb10('0xf')]);}this[_0xbb10('0x8')]=_0x1c3ee5;}_0x481979();};module[_0xbb10('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 7026a98..7b0c523 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 _0xf603=['moment','lodash','jayson/promise','client','http','error','message','result','catch','getSquareProject','ShowSquareProject','production','ShowMailAccount','MailServerOut','Smtp','email','getSquareProjectById','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','then','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','bluebird'];(function(_0x2636db,_0x3ca186){var _0x5b2acf=function(_0x3b290e){while(--_0x3b290e){_0x2636db['push'](_0x2636db['shift']());}};_0x5b2acf(++_0x3ca186);}(_0xf603,0xeb));var _0x3f60=function(_0xca1f0e,_0x2713d5){_0xca1f0e=_0xca1f0e-0x0;var _0x35e4ef=_0xf603[_0xca1f0e];return _0x35e4ef;};'use strict';var BPromise=require(_0x3f60('0x0'));var moment=require(_0x3f60('0x1'));var _=require(_0x3f60('0x2'));var util=require('util');var jayson=require(_0x3f60('0x3'));var client=jayson[_0x3f60('0x4')][_0x3f60('0x5')]({'port':0x2329});function request(_0x112cf5,_0x24aafb){return new BPromise(function(_0x553e8b,_0x1b914a){return client['request'](_0x112cf5,_0x24aafb)['then'](function(_0x2910c7){if(_0x2910c7[_0x3f60('0x6')]){return _0x1b914a(_0x2910c7[_0x3f60('0x6')][_0x3f60('0x7')]);}else{return _0x553e8b(_0x2910c7[_0x3f60('0x8')]);}})[_0x3f60('0x9')](function(_0x59b737){return _0x1b914a(_0x59b737);});});}exports[_0x3f60('0xa')]=function(_0x33dcc8){return request(_0x3f60('0xb'),{'options':{'raw':![],'where':{'name':_0x33dcc8},'attributes':[_0x3f60('0xc')]}});};exports['getMailAccountById']=function(_0x54f45d){return request(_0x3f60('0xd'),{'options':{'raw':![],'where':{'id':_0x54f45d},'include':[{'model':_0x3f60('0xe'),'as':_0x3f60('0xf')}],'attributes':['id','name',_0x3f60('0x10')]}});};exports[_0x3f60('0x11')]=function(_0xad12ff){return request('ShowSquareProject',{'options':{'where':{'id':_0xad12ff},'attributes':[_0x3f60('0x12')]}});};exports[_0x3f60('0x13')]=function(_0x77961f){return request(_0x3f60('0x14'),{'options':{'where':{'id':_0x77961f},'attributes':[_0x3f60('0x12')]}});};exports[_0x3f60('0x15')]=function(_0x17b9c8){return request(_0x3f60('0x16'),{'options':{'where':{'id':_0x17b9c8},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x596e4d){return request(_0x3f60('0x17'),{'options':{'where':{'id':_0x596e4d},'attributes':[_0x3f60('0x18')]}});};exports[_0x3f60('0x19')]=function(_0x23c96e){return request(_0x3f60('0x1a'),{'options':{'where':{'id':_0x23c96e},'attributes':[_0x3f60('0x12')]}});};exports[_0x3f60('0x1b')]=function(_0x163b55){return request(_0x3f60('0x1c'),{'options':{'where':{'id':_0x163b55},'attributes':['name']}});};exports[_0x3f60('0x1d')]=function(_0x2996d9){return request(_0x3f60('0x1e'),{'options':{'where':{'id':_0x2996d9},'attributes':[_0x3f60('0x1f')]}});};exports['getIntervalById']=function(_0x48b0cf){return request(_0x3f60('0x20'),{'options':{'raw':![],'where':{'id':_0x48b0cf},'include':[{'model':_0x3f60('0x21'),'as':_0x3f60('0x22')}]}});};exports[_0x3f60('0x23')]=function(_0x4af884){return request(_0x3f60('0x24'),{'options':{'where':{'id':_0x4af884},'attributes':['id',_0x3f60('0x12')]}});};exports['createSmsMessage']=function(_0x5b08a3){return request(_0x3f60('0x25'),{'body':_0x5b08a3});};exports[_0x3f60('0x26')]=function(_0x13c089){return request(_0x3f60('0x27'),{'body':_0x13c089});};exports['createSquareReport']=function(_0x448603){return request(_0x3f60('0x28'),{'body':_[_0x3f60('0x29')](_0x448603,{'project_name':_0x448603[_0x3f60('0x2a')],'prev_project_name':_0x448603[_0x3f60('0x2b')]||'','is_subproject':_0x448603[_0x3f60('0x2b')]?!![]:![],'leaveAt':moment()[_0x3f60('0x2c')](_0x3f60('0x2d'))})});};exports[_0x3f60('0x2e')]=function(_0xca67ed){return request('CreateSquareRecording',{'body':_0xca67ed});};exports[_0x3f60('0x2f')]=function(_0x37aafb){return request(_0x3f60('0x30'),{'body':_0x37aafb});};exports[_0x3f60('0x31')]=function(_0x42dc63){return request(_0x3f60('0x32'),{'options':{'raw':![],'where':{'phone':_0x42dc63['phone'],'ListId':_0x42dc63[_0x3f60('0x33')]}}})[_0x3f60('0x34')](function(_0x44ea75){if(_0x44ea75){return _0x44ea75;}return request('CreateCmContact',{'body':_0x42dc63});});};exports['getPauseById']=function(_0x4a7243){return request('ShowPause',{'options':{'where':{'id':_0x4a7243},'attributes':[_0x3f60('0x12')]}});};exports[_0x3f60('0x35')]=function(_0x175fad,_0x40deab){return request(_0x3f60('0x36'),{'body':{'interface':_0x40deab},'options':{'where':_0x175fad}});};exports[_0x3f60('0x37')]=function(_0x52d88b,_0x46271a,_0x4e0fd0){return request(_0x3f60('0x38'),{'body':{'type':_0x46271a,'uniqueid':_0x4e0fd0},'options':{'where':_0x52d88b}});};exports[_0x3f60('0x39')]=function(_0x345e25){return request(_0x3f60('0x3a'),{'body':{},'options':{'where':_0x345e25}});};exports['agentLogout']=function(_0xc0198b){return request('LogoutUser',{'body':{},'options':{'where':_0xc0198b}});}; \ No newline at end of file +var _0x1f65=['getMailAccountById','ShowMailAccount','getSquareProjectById','ShowSquareProject','name','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','ShowSound','getIntervalById','Interval','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','jayson/promise','http','then','error','message','result','catch'];(function(_0x530b0f,_0x15487e){var _0x368e92=function(_0x4a4b7b){while(--_0x4a4b7b){_0x530b0f['push'](_0x530b0f['shift']());}};_0x368e92(++_0x15487e);}(_0x1f65,0x185));var _0x51f6=function(_0x573fdf,_0x16cc8f){_0x573fdf=_0x573fdf-0x0;var _0x269299=_0x1f65[_0x573fdf];return _0x269299;};'use strict';var BPromise=require(_0x51f6('0x0'));var moment=require(_0x51f6('0x1'));var _=require(_0x51f6('0x2'));var util=require('util');var jayson=require(_0x51f6('0x3'));var client=jayson['client'][_0x51f6('0x4')]({'port':0x2329});function request(_0x1d37ba,_0x149d38){return new BPromise(function(_0x31f9b7,_0x4026d1){return client['request'](_0x1d37ba,_0x149d38)[_0x51f6('0x5')](function(_0x5b4c0e){if(_0x5b4c0e[_0x51f6('0x6')]){return _0x4026d1(_0x5b4c0e['error'][_0x51f6('0x7')]);}else{return _0x31f9b7(_0x5b4c0e[_0x51f6('0x8')]);}})[_0x51f6('0x9')](function(_0x51df7a){return _0x4026d1(_0x51df7a);});});}exports['getSquareProject']=function(_0x3bf3cf){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x3bf3cf},'attributes':['production']}});};exports[_0x51f6('0xa')]=function(_0x5a4331){return request(_0x51f6('0xb'),{'options':{'raw':![],'where':{'id':_0x5a4331},'include':[{'model':'MailServerOut','as':'Smtp'}],'attributes':['id','name','email']}});};exports[_0x51f6('0xc')]=function(_0x147b5f){return request(_0x51f6('0xd'),{'options':{'where':{'id':_0x147b5f},'attributes':[_0x51f6('0xe')]}});};exports['getVoiceQueueById']=function(_0x1fb727){return request(_0x51f6('0xf'),{'options':{'where':{'id':_0x1fb727},'attributes':[_0x51f6('0xe')]}});};exports[_0x51f6('0x10')]=function(_0x42f6ed){return request(_0x51f6('0x11'),{'options':{'where':{'id':_0x42f6ed},'attributes':['name']}});};exports[_0x51f6('0x12')]=function(_0x373ca3){return request(_0x51f6('0x13'),{'options':{'where':{'id':_0x373ca3},'attributes':[_0x51f6('0x14')]}});};exports[_0x51f6('0x15')]=function(_0x277e25){return request(_0x51f6('0x16'),{'options':{'where':{'id':_0x277e25},'attributes':[_0x51f6('0xe')]}});};exports[_0x51f6('0x17')]=function(_0x4183c4){return request(_0x51f6('0x18'),{'options':{'where':{'id':_0x4183c4},'attributes':[_0x51f6('0xe')]}});};exports['getSoundById']=function(_0x54bcb2){return request(_0x51f6('0x19'),{'options':{'where':{'id':_0x54bcb2},'attributes':['save_name']}});};exports[_0x51f6('0x1a')]=function(_0x5c600d){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x5c600d},'include':[{'model':_0x51f6('0x1b'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x5672f9){return request(_0x51f6('0x1c'),{'options':{'where':{'id':_0x5672f9},'attributes':['id','name']}});};exports[_0x51f6('0x1d')]=function(_0xa91bc5){return request(_0x51f6('0x1e'),{'body':_0xa91bc5});};exports[_0x51f6('0x1f')]=function(_0x762a3a){return request(_0x51f6('0x20'),{'body':_0x762a3a});};exports[_0x51f6('0x21')]=function(_0x560fc5){return request(_0x51f6('0x22'),{'body':_[_0x51f6('0x23')](_0x560fc5,{'project_name':_0x560fc5[_0x51f6('0x24')],'prev_project_name':_0x560fc5['arg_2']||'','is_subproject':_0x560fc5[_0x51f6('0x25')]?!![]:![],'leaveAt':moment()[_0x51f6('0x26')](_0x51f6('0x27'))})});};exports[_0x51f6('0x28')]=function(_0x1d0fff){return request(_0x51f6('0x29'),{'body':_0x1d0fff});};exports[_0x51f6('0x2a')]=function(_0x33e0ce){return request(_0x51f6('0x2b'),{'body':_0x33e0ce});};exports[_0x51f6('0x2c')]=function(_0x4cc505){return request(_0x51f6('0x2d'),{'options':{'raw':![],'where':{'phone':_0x4cc505[_0x51f6('0x2e')],'ListId':_0x4cc505[_0x51f6('0x2f')]}}})[_0x51f6('0x5')](function(_0x29fe8d){if(_0x29fe8d){return _0x29fe8d;}return request(_0x51f6('0x30'),{'body':_0x4cc505});});};exports[_0x51f6('0x31')]=function(_0xcff165){return request(_0x51f6('0x32'),{'options':{'where':{'id':_0xcff165},'attributes':[_0x51f6('0xe')]}});};exports[_0x51f6('0x33')]=function(_0x3eb338,_0x584933){return request(_0x51f6('0x34'),{'body':{'interface':_0x584933},'options':{'where':_0x3eb338}});};exports['agentPause']=function(_0x9982fd,_0x48062b,_0x11fb83){return request(_0x51f6('0x35'),{'body':{'type':_0x48062b,'uniqueid':_0x11fb83},'options':{'where':_0x9982fd}});};exports['agentUnpause']=function(_0x401296){return request(_0x51f6('0x36'),{'body':{},'options':{'where':_0x401296}});};exports[_0x51f6('0x37')]=function(_0x4a61da){return request(_0x51f6('0x38'),{'body':{},'options':{'where':_0x4a61da}});}; \ 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 b169e3f..d5ae618 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 _0x8ce3=['./lex','./polly'];(function(_0x5a609d,_0x5ceef8){var _0x184849=function(_0x4db0dc){while(--_0x4db0dc){_0x5a609d['push'](_0x5a609d['shift']());}};_0x184849(++_0x5ceef8);}(_0x8ce3,0xc3));var _0x38ce=function(_0x2338ae,_0x1896f8){_0x2338ae=_0x2338ae-0x0;var _0x4adad9=_0x8ce3[_0x2338ae];return _0x4adad9;};var polly=require(_0x38ce('0x0'));var lex=require(_0x38ce('0x1'));module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x4d9e=['./polly'];(function(_0x2c6c33,_0x57884e){var _0x370632=function(_0x2455bc){while(--_0x2455bc){_0x2c6c33['push'](_0x2c6c33['shift']());}};_0x370632(++_0x57884e);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x3fc1a4,_0x2eb116){_0x3fc1a4=_0x3fc1a4-0x0;var _0x5a1eca=_0x4d9e[_0x3fc1a4];return _0x5a1eca;};var polly=require(_0xe4d9('0x0'));var lex=require('./lex');module['exports']={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index bab5cba..6661a0c 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x5407e7,_0xeeb808,_0x22ce4b,_0x2a6255,_0x913595,_0xbe8efc){return lex(_0x5407e7,_0xeeb808,_0x22ce4b,_0x2a6255,_0x913595,_0xbe8efc);}; \ No newline at end of file +var _0x6737=['exports'];(function(_0x4b1665,_0xb0c095){var _0x5850c0=function(_0x44b7a4){while(--_0x44b7a4){_0x4b1665['push'](_0x4b1665['shift']());}};_0x5850c0(++_0xb0c095);}(_0x6737,0xe2));var _0x7673=function(_0x276f06,_0x11e347){_0x276f06=_0x276f06-0x0;var _0x106a42=_0x6737[_0x276f06];return _0x106a42;};'use strict';var lex=require('./lib/api');module[_0x7673('0x0')]=function(_0x2634c4,_0x5aa730,_0x2f05d4,_0x2a9cd0,_0x43ee27,_0x12efff){return lex(_0x2634c4,_0x5aa730,_0x2f05d4,_0x2a9cd0,_0x43ee27,_0x12efff);}; \ 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 898b318..b8ebf91 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 _0x93a2=['slots','hasOwnProperty','exports','LexRuntime','$LATEST','bluebird'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x93a2,0x13d));var _0x293a=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x93a2[_0x28611e];return _0x530f69;};'use strict';var BPromise=require(_0x293a('0x0'));var AWS=require('aws-sdk');function lexResult(_0x5ca4dd,_0x238621){return new BPromise(function(_0x2c781c,_0x436a9d){_0x5ca4dd['postText'](_0x238621,function(_0x40734e,_0x51f421){if(_0x40734e){_0x436a9d(_0x40734e);}if(_0x51f421[_0x293a('0x1')]){for(const _0x16a9c3 in _0x51f421[_0x293a('0x1')]){if(_0x51f421[_0x293a('0x1')][_0x293a('0x2')](_0x16a9c3)){var _0xad014a=_0x51f421[_0x293a('0x1')][_0x16a9c3];_0x51f421['slot_'+_0x16a9c3]=_0xad014a;}}}_0x2c781c(_0x51f421);});});}module[_0x293a('0x3')]=function(_0x147663,_0x1570e3,_0x54e8ce,_0x449a4f,_0x174027,_0x6fd9f4){var _0x2d16b3=new AWS[(_0x293a('0x4'))]({'accessKeyId':_0x1570e3,'secretAccessKey':_0x54e8ce,'region':_0x449a4f});var _0x3f96b1={'botAlias':_0x293a('0x5'),'botName':_0x6fd9f4,'inputText':_0x174027,'userId':_0x147663};return lexResult(_0x2d16b3,_0x3f96b1);}; \ No newline at end of file +var _0x26d2=['exports','LexRuntime','$LATEST','aws-sdk','slots','hasOwnProperty','slot_'];(function(_0x41c088,_0x155e0f){var _0x273b77=function(_0x1ba82f){while(--_0x1ba82f){_0x41c088['push'](_0x41c088['shift']());}};_0x273b77(++_0x155e0f);}(_0x26d2,0x153));var _0x226d=function(_0x3a07c1,_0x34d57f){_0x3a07c1=_0x3a07c1-0x0;var _0x2bbe15=_0x26d2[_0x3a07c1];return _0x2bbe15;};'use strict';var BPromise=require('bluebird');var AWS=require(_0x226d('0x0'));function lexResult(_0x4bccd9,_0x5741f7){return new BPromise(function(_0x399ba9,_0x5dbe94){_0x4bccd9['postText'](_0x5741f7,function(_0x3a40e6,_0x24bce3){if(_0x3a40e6){_0x5dbe94(_0x3a40e6);}if(_0x24bce3[_0x226d('0x1')]){for(const _0x45a16b in _0x24bce3[_0x226d('0x1')]){if(_0x24bce3[_0x226d('0x1')][_0x226d('0x2')](_0x45a16b)){var _0x2cce55=_0x24bce3[_0x226d('0x1')][_0x45a16b];_0x24bce3[_0x226d('0x3')+_0x45a16b]=_0x2cce55;}}}_0x399ba9(_0x24bce3);});});}module[_0x226d('0x4')]=function(_0x536ace,_0x2b3ca1,_0x50daca,_0x5be306,_0x4a974a,_0x3f07e3){var _0x608e55=new AWS[(_0x226d('0x5'))]({'accessKeyId':_0x2b3ca1,'secretAccessKey':_0x50daca,'region':_0x5be306});var _0x324735={'botAlias':_0x226d('0x6'),'botName':_0x3f07e3,'inputText':_0x4a974a,'userId':_0x536ace};return lexResult(_0x608e55,_0x324735);}; \ 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 c2e1b37..7c3c401 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 _0xe36c=['exports'];(function(_0x561bd5,_0x51e9c6){var _0x2d3adb=function(_0x9fe150){while(--_0x9fe150){_0x561bd5['push'](_0x561bd5['shift']());}};_0x2d3adb(++_0x51e9c6);}(_0xe36c,0x155));var _0xce36=function(_0x5aac46,_0xea7e9){_0x5aac46=_0x5aac46-0x0;var _0xe31595=_0xe36c[_0x5aac46];return _0xe31595;};'use strict';var polly=require('./lib/api');module[_0xce36('0x0')]=function(_0x247ba5,_0x2648e3,_0x14904e,_0x176b0b,_0x54854f,_0x426147,_0x39656b){return polly(_0x247ba5,_0x2648e3,_0x14904e,_0x176b0b,_0x54854f,_0x426147,_0x39656b);}; \ No newline at end of file +var _0x7304=['exports','./lib/api'];(function(_0x456852,_0x39b320){var _0x25b8cb=function(_0x1eff44){while(--_0x1eff44){_0x456852['push'](_0x456852['shift']());}};_0x25b8cb(++_0x39b320);}(_0x7304,0x71));var _0x4730=function(_0x1b8e60,_0x21b885){_0x1b8e60=_0x1b8e60-0x0;var _0x363363=_0x7304[_0x1b8e60];return _0x363363;};'use strict';var polly=require(_0x4730('0x0'));module[_0x4730('0x1')]=function(_0x561bc8,_0x474132,_0x273aea,_0x39712e,_0x1d6f3f,_0x42f8a2,_0x35e8f2){return polly(_0x561bc8,_0x474132,_0x273aea,_0x39712e,_0x1d6f3f,_0x42f8a2,_0x35e8f2);}; \ 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 462579e..8e91ba1 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 _0x90ae=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x4aa750,_0x38fd9e){var _0x88a245=function(_0x1bc27a){while(--_0x1bc27a){_0x4aa750['push'](_0x4aa750['shift']());}};_0x88a245(++_0x38fd9e);}(_0x90ae,0xca));var _0xe90a=function(_0x253810,_0x40726e){_0x253810=_0x253810-0x0;var _0x1b440d=_0x90ae[_0x253810];return _0x1b440d;};'use strict';var fs=require('fs');var path=require(_0xe90a('0x0'));var BPromise=require(_0xe90a('0x1'));var rs=require(_0xe90a('0x2'));var AWS=require(_0xe90a('0x3'));function pollyResult(_0x34a9bb,_0x5873d7,_0x4e88d3){return new BPromise(function(_0x58bff2,_0x1a8db4){_0x34a9bb[_0xe90a('0x4')](_0x5873d7,function(_0x44084b,_0x12a6d5){if(_0x44084b){_0x1a8db4(_0x44084b);}else if(_0x12a6d5){if(_0x12a6d5[_0xe90a('0x5')]instanceof Buffer){fs[_0xe90a('0x6')](_0x4e88d3,_0x12a6d5['AudioStream'],function(_0x370a3e){if(_0x370a3e){_0x1a8db4(_0x370a3e);}else{_0x58bff2();}});}else{_0x1a8db4(new Error(_0xe90a('0x7')));}}else{_0x1a8db4(new Error(_0xe90a('0x8')));}});});}module[_0xe90a('0x9')]=function(_0x4a9f18,_0x5475f9,_0x55ecad,_0xa1d1b3,_0x2b9ca5,_0x427221,_0xb66e1a){var _0x558ac5=new AWS[(_0xe90a('0xa'))]({'accessKeyId':_0x4a9f18,'secretAccessKey':_0x5475f9,'region':_0x55ecad});var _0x25b679={'Text':_0x2b9ca5,'TextType':_0x427221||_0xe90a('0xb'),'OutputFormat':_0xe90a('0xc'),'VoiceId':_0xa1d1b3};return pollyResult(_0x558ac5,_0x25b679,_0xb66e1a);}; \ No newline at end of file +var _0x2131=['aws-sdk','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path','randomstring'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0x2131,0x134));var _0x1213=function(_0x467e9e,_0x4a6888){_0x467e9e=_0x467e9e-0x0;var _0x10376a=_0x2131[_0x467e9e];return _0x10376a;};'use strict';var fs=require('fs');var path=require(_0x1213('0x0'));var BPromise=require('bluebird');var rs=require(_0x1213('0x1'));var AWS=require(_0x1213('0x2'));function pollyResult(_0x3a274d,_0x354362,_0x47e10c){return new BPromise(function(_0x440971,_0x2cfe85){_0x3a274d[_0x1213('0x3')](_0x354362,function(_0x3ebf86,_0x21c1cd){if(_0x3ebf86){_0x2cfe85(_0x3ebf86);}else if(_0x21c1cd){if(_0x21c1cd[_0x1213('0x4')]instanceof Buffer){fs[_0x1213('0x5')](_0x47e10c,_0x21c1cd[_0x1213('0x4')],function(_0x17ccb0){if(_0x17ccb0){_0x2cfe85(_0x17ccb0);}else{_0x440971();}});}else{_0x2cfe85(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x2cfe85(new Error(_0x1213('0x6')));}});});}module[_0x1213('0x7')]=function(_0x381a38,_0x29ae07,_0x1579d1,_0x4ff775,_0x146a75,_0xd21651,_0x3d7171){var _0x27fd6b=new AWS[(_0x1213('0x8'))]({'accessKeyId':_0x381a38,'secretAccessKey':_0x29ae07,'region':_0x1579d1});var _0x39662a={'Text':_0x146a75,'TextType':_0xd21651||_0x1213('0x9'),'OutputFormat':'mp3','VoiceId':_0x4ff775};return pollyResult(_0x27fd6b,_0x39662a,_0x3d7171);}; \ 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 6a78e61..c50cc88 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 _0x4b3f=['exports'];(function(_0x680821,_0x23e67f){var _0x3f132c=function(_0x1bbcea){while(--_0x1bbcea){_0x680821['push'](_0x680821['shift']());}};_0x3f132c(++_0x23e67f);}(_0x4b3f,0x155));var _0xf4b3=function(_0x495bba,_0x565d63){_0x495bba=_0x495bba-0x0;var _0x3bb5ea=_0x4b3f[_0x495bba];return _0x3bb5ea;};'use strict';var asr=require('./lib/api');module[_0xf4b3('0x0')]=function(_0x3f6ac3,_0x2b0729,_0x33b94e,_0x4cba07){return asr(_0x3f6ac3,_0x2b0729,_0x33b94e);}; \ No newline at end of file +var _0xf0be=['./lib/api','exports'];(function(_0x592198,_0x2b77c1){var _0x348e0b=function(_0x5c2c3f){while(--_0x5c2c3f){_0x592198['push'](_0x592198['shift']());}};_0x348e0b(++_0x2b77c1);}(_0xf0be,0x146));var _0xef0b=function(_0x23bafa,_0x3761e8){_0x23bafa=_0x23bafa-0x0;var _0xbce7f1=_0xf0be[_0x23bafa];return _0xbce7f1;};'use strict';var asr=require(_0xef0b('0x0'));module[_0xef0b('0x1')]=function(_0x2c1323,_0x36363a,_0x5b2425,_0x4754af){return asr(_0x2c1323,_0x36363a,_0x5b2425);}; \ 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 47c843d..47d6167 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 _0x74e1=['bluebird','https://speech.googleapis.com','exports','string','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x74e1,0x193));var _0x174e=function(_0x333c95,_0x3cd7d8){_0x333c95=_0x333c95-0x0;var _0x231487=_0x74e1[_0x333c95];return _0x231487;};'use strict';var url=require('url');var BPromise=require(_0x174e('0x0'));var fs=require('fs');var host=_0x174e('0x1');module[_0x174e('0x2')]=function(_0x5e419b,_0x320151,_0x13f530){return new BPromise(function(_0x1e32bf,_0x4d7b1b){var _0x12250e;if(typeof _0x5e419b!==_0x174e('0x3')||_0x5e419b['length']===0x0){return _0x4d7b1b(_0x174e('0x4'));}if(typeof _0x320151!==_0x174e('0x3')||_0x320151['length']===0x0){return _0x4d7b1b(_0x174e('0x5'));}if(typeof _0x13f530!==_0x174e('0x6')&&(typeof _0x13f530!==_0x174e('0x3')||_0x13f530['length']===0x0)){return _0x4d7b1b(_0x174e('0x7'));}try{_0x12250e=fs['readFileSync'](_0x5e419b)[_0x174e('0x8')](_0x174e('0x9'));}catch(_0x3c9e43){return _0x4d7b1b(_0x3c9e43);}return _0x1e32bf({'method':'POST','uri':host+_0x174e('0xa')+_0x320151,'body':{'config':{'encoding':_0x174e('0xb'),'sampleRateHertz':_0x174e('0xc'),'languageCode':_0x13f530},'audio':{'content':_0x12250e}},'json':!![]});});}; \ No newline at end of file +var _0x7c54=['lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7c54,0x103));var _0x47c5=function(_0x2697d9,_0x26806a){_0x2697d9=_0x2697d9-0x0;var _0x25e6ae=_0x7c54[_0x2697d9];return _0x25e6ae;};'use strict';var url=require('url');var BPromise=require(_0x47c5('0x0'));var fs=require('fs');var host=_0x47c5('0x1');module[_0x47c5('0x2')]=function(_0x5ae437,_0x47c297,_0xbd14b5){return new BPromise(function(_0x226577,_0x32127d){var _0x30898d;if(typeof _0x5ae437!==_0x47c5('0x3')||_0x5ae437[_0x47c5('0x4')]===0x0){return _0x32127d(_0x47c5('0x5'));}if(typeof _0x47c297!==_0x47c5('0x3')||_0x47c297[_0x47c5('0x4')]===0x0){return _0x32127d(_0x47c5('0x6'));}if(typeof _0xbd14b5!=='undefined'&&(typeof _0xbd14b5!==_0x47c5('0x3')||_0xbd14b5[_0x47c5('0x4')]===0x0)){return _0x32127d(_0x47c5('0x7'));}try{_0x30898d=fs[_0x47c5('0x8')](_0x5ae437)[_0x47c5('0x9')](_0x47c5('0xa'));}catch(_0xcb0a6a){return _0x32127d(_0xcb0a6a);}return _0x226577({'method':'POST','uri':host+_0x47c5('0xb')+_0x47c297,'body':{'config':{'encoding':_0x47c5('0xc'),'sampleRateHertz':_0x47c5('0xd'),'languageCode':_0xbd14b5},'audio':{'content':_0x30898d}},'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 81d9054..9a93077 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 _0x4feb=['./asr','exports'];(function(_0x4b5d20,_0x57e93b){var _0x2600c8=function(_0x43786d){while(--_0x43786d){_0x4b5d20['push'](_0x4b5d20['shift']());}};_0x2600c8(++_0x57e93b);}(_0x4feb,0x190));var _0xb4fe=function(_0x171ca6,_0x2f8f9d){_0x171ca6=_0x171ca6-0x0;var _0x244768=_0x4feb[_0x171ca6];return _0x244768;};var asr=require(_0xb4fe('0x0'));module[_0xb4fe('0x1')]={'asr':asr}; \ No newline at end of file +var _0x68bc=['./asr'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x68bc,0xbc));var _0xc68b=function(_0x107235,_0x4c5753){_0x107235=_0x107235-0x0;var _0x1b2dda=_0x68bc[_0x107235];return _0x1b2dda;};var asr=require(_0xc68b('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index aa18d19..3de89ee 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 _0xe3bb=['finish\x20to\x20convert','start','resolve','tmp','.wav','writeFileSync','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','audioConfig','MP3','text:synthesize','generate','.mp3','from','audioContent','base64','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','googleASR','asr','uri','results','map','alternatives','transcript','confidence','join','googleASR\x20transcription','googleASR\x20confidence','[%s]\x20%s:%s','name','message','googleDialogflow','result','source','resolvedQuery','action','status','code','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','intent','displayName','isFallback','languageCode','queryText','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','freeform=3','sestekNDA','nda','channelData','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','path','querystring','randomstring','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','info','finish\x20download\x20file','unlink','pipe','end','protocol','data','transcode','wav'];(function(_0x4933a4,_0x4d91b7){var _0x122350=function(_0x20e855){while(--_0x20e855){_0x4933a4['push'](_0x4933a4['shift']());}};_0x122350(++_0x4d91b7);}(_0xe3bb,0x16a));var _0xbe3b=function(_0xe9a431,_0x1e7009){_0xe9a431=_0xe9a431-0x0;var _0x591b10=_0xe3bb[_0xe9a431];return _0x591b10;};'use strict';var apiai=require(_0xbe3b('0x0'));var BPromise=require(_0xbe3b('0x1'));var dialogflow=require(_0xbe3b('0x2'));var fs=require('fs');var http=require(_0xbe3b('0x3'));var https=require(_0xbe3b('0x4'));var md5=require('md5');var path=require(_0xbe3b('0x5'));var querystring=require(_0xbe3b('0x6'));var rp=require('request-promise');var rs=require(_0xbe3b('0x7'));var sox=require('sox');var tts=require(_0xbe3b('0x8'));var urlParse=require(_0xbe3b('0x9'))[_0xbe3b('0xa')];var util=require(_0xbe3b('0xb'));var aws=require(_0xbe3b('0xc'));var google=require(_0xbe3b('0xd'));var sestek=require(_0xbe3b('0xe'));var tilde=require(_0xbe3b('0xf'));var logger=require(_0xbe3b('0x10'))(_0xbe3b('0x11'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x55cd26,_0x34cd01){return new BPromise(function(_0x590abb,_0x356c36){var _0x28f10a=urlParse(_0x55cd26);var _0x5c1bab=_0x28f10a['protocol']===_0xbe3b('0x12')?https:http;var _0x146d8e={'host':_0x28f10a[_0xbe3b('0x13')],'path':_0x28f10a[_0xbe3b('0x5')],'headers':{'user-agent':_0xbe3b('0x14')}};_0x5c1bab[_0xbe3b('0x15')](_0x146d8e,function(_0x570480){if(_0x570480[_0xbe3b('0x16')]!==0xc8){logger[_0xbe3b('0x17')](_0xbe3b('0x18')+_0x55cd26+'\x20failed,\x20status\x20code\x20=\x20'+_0x570480[_0xbe3b('0x16')]+'\x20('+_0x570480[_0xbe3b('0x19')]+')');_0x356c36(new Error(_0xbe3b('0x18')+_0x55cd26+_0xbe3b('0x1a')+_0x570480['statusCode']+'\x20('+_0x570480[_0xbe3b('0x19')]+')'));return;}var _0x1418e9=fs[_0xbe3b('0x1b')](_0x34cd01);_0x1418e9['on']('finish',function(){logger[_0xbe3b('0x1c')](_0xbe3b('0x1d'));_0x1418e9['close'](_0x590abb);});_0x1418e9['on'](_0xbe3b('0x17'),function(_0x5950ec){fs[_0xbe3b('0x1e')](_0x34cd01);logger[_0xbe3b('0x17')]('download\x20error',_0x5950ec);_0x356c36(_0x5950ec);});_0x570480[_0xbe3b('0x1f')](_0x1418e9);})['on'](_0xbe3b('0x17'),function(_0x15efa3){logger[_0xbe3b('0x17')](_0x15efa3);_0x356c36(_0x15efa3);})[_0xbe3b('0x20')]();});}function uploadFile(_0x5d923f){return new BPromise(function(_0x2a3bbf,_0xf3a233){var _0x21ffba=urlParse(_0x5d923f);var _0x10255d=_0x21ffba[_0xbe3b('0x21')]===_0xbe3b('0x12')?https:http;var _0xb6bf36={'host':_0x21ffba[_0xbe3b('0x13')],'path':_0x21ffba[_0xbe3b('0x5')],'headers':{'user-agent':_0xbe3b('0x14')}};_0x10255d[_0xbe3b('0x15')](_0xb6bf36,function(_0xab744f){if(_0xab744f['statusCode']!==0xc8){_0xf3a233(new Error('request\x20to\x20'+_0x5d923f+_0xbe3b('0x1a')+_0xab744f[_0xbe3b('0x16')]+'\x20('+_0xab744f[_0xbe3b('0x19')]+')'));return;}var _0x2edd50='';_0xab744f['on'](_0xbe3b('0x22'),function(_0x478c67){_0x2edd50+=_0x478c67;});_0xab744f['on']('end',function(){_0x2a3bbf(_0x2edd50);});})['on']('error',function(_0x35df00){_0xf3a233(_0x35df00);})[_0xbe3b('0x20')]();});}function convertFile(_0x23e018,_0x4be6d2){return new BPromise(function(_0x2f3d92,_0x3ee9f7){var _0x1a9ffd=sox[_0xbe3b('0x23')](_0x23e018,_0x4be6d2,{'sampleRate':0x1f40,'format':_0xbe3b('0x24'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1a9ffd['on'](_0xbe3b('0x17'),function(_0x406f32){logger['error']('error\x20convert',_0x406f32);_0x3ee9f7(_0x406f32);});_0x1a9ffd['on'](_0xbe3b('0x20'),function(){logger[_0xbe3b('0x1c')](_0xbe3b('0x25'));_0x2f3d92();});_0x1a9ffd[_0xbe3b('0x26')]();});}function base64Decode(_0x3c5e05,_0x1ded44){var _0x3bf90c=path[_0xbe3b('0x27')](__dirname,_0xbe3b('0x28'),rs['generate'](0x4)+_0xbe3b('0x29'));fs[_0xbe3b('0x2a')](_0x3bf90c,_0x3c5e05,'base64');return convertFile(_0x3bf90c,_0x1ded44)[_0xbe3b('0x2b')](function(){try{fs[_0xbe3b('0x1e')](_0x3bf90c);fs[_0xbe3b('0x2c')](_0x1ded44,_0xbe3b('0x2d'));}catch(_0x42194a){logger[_0xbe3b('0x17')](_0x42194a);}return _0x1ded44[_0xbe3b('0x2e')]('.')[0x0];});}function base64Encode(_0x5505c7){var _0x1e8398=fs[_0xbe3b('0x2f')](_0x5505c7);return new Buffer(_0x1e8398)[_0xbe3b('0x30')]('base64');}exports[_0xbe3b('0x31')]=function(_0x3cb2fe,_0x29cd08,_0x3f3177,_0x176a39,_0x31f4f9,_0x2d5f33){var _0x2019ec,_0x572ede;var _0x74773=_0xbe3b('0x32');var _0x2549ac=_0xbe3b('0x33')+_0x3cb2fe;var _0x4528ff={};if(_0x29cd08===_0xbe3b('0x34')){_0x4528ff[_0xbe3b('0x35')]={'ssml':_0x3f3177};}else{_0x4528ff[_0xbe3b('0x35')]={'text':_0x3f3177};};_0x4528ff['voice']={'languageCode':_0x176a39,'ssmlGender':_0x31f4f9};_0x4528ff[_0xbe3b('0x36')]={'audioEncoding':_0xbe3b('0x37'),'sampleRateHertz':0x1f40};var _0x503c41={'url':_0x74773+_0xbe3b('0x38')+_0x2549ac,'method':'POST','json':!![],'body':_0x4528ff};return rp(_0x503c41)[_0xbe3b('0x2b')](function(_0x5e8ab1){return new BPromise(function(_0x2d413e,_0x57a15c){_0x2019ec=path[_0xbe3b('0x27')](__dirname,_0xbe3b('0x28'),rs[_0xbe3b('0x39')](0x4)+_0xbe3b('0x3a'));var _0x58a982=Buffer[_0xbe3b('0x3b')](_0x5e8ab1[_0xbe3b('0x3c')],_0xbe3b('0x3d'));return fs['writeFile'](_0x2019ec,_0x58a982,function(_0x258ea9){_0x57a15c(_0x258ea9);},function(_0x5ea704){fs[_0xbe3b('0x2c')](_0x2019ec,'777');_0x2d413e(_0x5ea704);});});})['then'](function(_0x10704d){_0x572ede=path[_0xbe3b('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0xbe3b('0x29'));return convertFile(_0x2019ec,_0x572ede);})[_0xbe3b('0x2b')](function(){try{fs[_0xbe3b('0x1e')](_0x2019ec);fs[_0xbe3b('0x2c')](_0x572ede,_0xbe3b('0x2d'));}catch(_0x3ec291){logger[_0xbe3b('0x17')](_0x3ec291);}logger[_0xbe3b('0x1c')](_0xbe3b('0x3e'),_0x572ede['split']('.')[0x0]);return _0x572ede['split']('.')[0x0];});};exports[_0xbe3b('0x3f')]=function(_0x5a5162,_0x37a62d){var _0x8022fc=_0xbe3b('0x40');var _0x50c9d1,_0x2c109a;var _0x54aced;var _0x128e55={'encoding':_0xbe3b('0x41'),'method':_0xbe3b('0x42'),'timeout':0x2710,'url':_0x8022fc,'headers':{'Content-Type':_0xbe3b('0x43')},'body':_0xbe3b('0x44')+encodeURIComponent(JSON[_0xbe3b('0x45')]([[['jQ1olc',JSON['stringify']([_0x5a5162,_0x37a62d||'en',![],_0xbe3b('0x46')]),null,_0xbe3b('0x47')]]]))};return rp(_0x128e55)[_0xbe3b('0x2b')](function(_0x2be5b3){try{_0x54aced=eval(_0x2be5b3[_0xbe3b('0x48')](0x5))[0x0][0x2];}catch(_0x54b823){throw new Error('parse\x20response\x20failed:\x0a'+_0x2be5b3[_0xbe3b('0x22')]);}if(!_0x54aced){if(_0x5a5162[_0xbe3b('0x49')]>0xc8){throw new Error(_0xbe3b('0x4a'));}else{throw new Error('lang\x20\x22'+_0x37a62d+_0xbe3b('0x4b'));}}try{_0x54aced=eval(_0x54aced)[0x0];}catch(_0x499a86){throw new Error(_0xbe3b('0x4c')+res[_0xbe3b('0x22')]);}const _0x2b7ae0=_0x54aced;_0x50c9d1=path[_0xbe3b('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0xbe3b('0x3a'));fs['writeFileSync'](_0x50c9d1,_0x54aced,{'encoding':'base64'});_0x2c109a=path[_0xbe3b('0x27')](__dirname,_0xbe3b('0x28'),rs[_0xbe3b('0x39')](0x4)+'.wav');return convertFile(_0x50c9d1,_0x2c109a);})['then'](function(){try{fs[_0xbe3b('0x1e')](_0x50c9d1);fs[_0xbe3b('0x2c')](_0x2c109a,_0xbe3b('0x2d'));}catch(_0x2f1f98){logger[_0xbe3b('0x17')](_0x2f1f98);}logger[_0xbe3b('0x1c')]('goggleTTS\x20path',_0x2c109a[_0xbe3b('0x2e')]('.')[0x0]);return _0x2c109a['split']('.')[0x0];});};exports[_0xbe3b('0x4d')]=function(_0x5e4581,_0x24d1d7,_0x3bba5c){return google[_0xbe3b('0x4e')](_0x5e4581,_0x24d1d7,_0x3bba5c)['then'](function(_0x10305c){logger[_0xbe3b('0x1c')](_0x10305c[_0xbe3b('0x4f')]);return rp(_0x10305c);})['then'](function(_0x224a48){var _0x159428='';var _0x5b750b=0x0;try{fs['unlink'](_0x5e4581);}catch(_0x32b66f){logger['error'](_0x32b66f);}if(_0x224a48&&_0x224a48[_0xbe3b('0x50')]){_0x159428=_0x224a48['results'][_0xbe3b('0x51')](function(_0x7d6f){return _0x7d6f&&_0x7d6f[_0xbe3b('0x52')][0x0]&&_0x7d6f['alternatives'][0x0][_0xbe3b('0x53')]?_0x7d6f[_0xbe3b('0x52')][0x0][_0xbe3b('0x53')]:'';})['join']('\x0a');_0x5b750b=_0x224a48['results'][_0xbe3b('0x51')](function(_0x7f0f9a){return _0x7f0f9a&&_0x7f0f9a[_0xbe3b('0x52')][0x0]&&_0x7f0f9a[_0xbe3b('0x52')][0x0][_0xbe3b('0x54')]?_0x7f0f9a[_0xbe3b('0x52')][0x0][_0xbe3b('0x54')]:0x0;})[_0xbe3b('0x55')]('\x0a');}logger[_0xbe3b('0x1c')](_0xbe3b('0x56'),_0x159428);logger['info'](_0xbe3b('0x57'),_0x5b750b);return{'transcript':_0x159428,'confidence':_0x5b750b};})['catch'](function(_0x5d1e5f){logger['error'](_0xbe3b('0x58'),_0x5d1e5f[_0xbe3b('0x16')],_0x5d1e5f[_0xbe3b('0x59')],_0x5d1e5f[_0xbe3b('0x5a')]);});};exports[_0xbe3b('0x5b')]=function(_0x30354a,_0x4ddbe1,_0x3b5014,_0x1122f5){var _0x2240de=apiai(_0x4ddbe1,{'language':_0x1122f5||'en'});return _0x2240de['textRequest'](_0x3b5014,{'sessionId':md5(_0x30354a)})[_0xbe3b('0x2b')](function(_0x1f6ea3){logger['info'](JSON[_0xbe3b('0x45')](_0x1f6ea3));return{'source':_0x1f6ea3[_0xbe3b('0x5c')][_0xbe3b('0x5d')],'resolvedQuery':_0x1f6ea3[_0xbe3b('0x5c')][_0xbe3b('0x5e')],'action':_0x1f6ea3['result'][_0xbe3b('0x5f')],'actionIncomplete':_0x1f6ea3[_0xbe3b('0x5c')]['actionIncomplete'],'speech':_0x1f6ea3[_0xbe3b('0x5c')]['fulfillment']['speech'],'score':_0x1f6ea3[_0xbe3b('0x5c')]['score'],'statusCode':_0x1f6ea3[_0xbe3b('0x60')][_0xbe3b('0x61')],'endConversation':_0x1f6ea3[_0xbe3b('0x5c')][_0xbe3b('0x62')]['endConversation']||![],'isFallbackIntent':_0x1f6ea3[_0xbe3b('0x5c')][_0xbe3b('0x62')][_0xbe3b('0x63')]};});};exports[_0xbe3b('0x64')]=function(_0x4ad4d5,_0x37f3be,_0x318247,_0x4a0c48,_0x44c7a5,_0x12b1ca){var _0x150852=_0x4a0c48[_0xbe3b('0x65')](/\\n/g,'\x0a');var _0xbd7ec6={'credentials':{'private_key':_0x150852,'client_email':_0x318247}};var _0x32c8c6=new dialogflow[(_0xbe3b('0x66'))](_0xbd7ec6);var _0x53862b=_0x32c8c6[_0xbe3b('0x67')](_0x37f3be,md5(_0x4ad4d5));var _0x5936a4={'session':_0x53862b,'queryInput':{'text':{'text':_0x44c7a5,'languageCode':_0x12b1ca}}};return _0x32c8c6[_0xbe3b('0x68')](_0x5936a4)[_0xbe3b('0x2b')](function(_0x14e073){if(_0x14e073&&_0x14e073['length']){logger[_0xbe3b('0x1c')](_0xbe3b('0x69'),JSON[_0xbe3b('0x45')](_0x14e073));var _0x41929e=_0x14e073[0x0];if(_0x41929e){var _0x50fa1b={'action':_0x41929e[_0xbe3b('0x6a')][_0xbe3b('0x5f')],'allRequiredParamsPresent':_0x41929e[_0xbe3b('0x6a')][_0xbe3b('0x6b')],'endConversation':_0x41929e[_0xbe3b('0x6a')][_0xbe3b('0x6c')]&&_0x41929e['queryResult'][_0xbe3b('0x6c')][_0xbe3b('0x6d')]?_0x41929e[_0xbe3b('0x6a')][_0xbe3b('0x6c')][_0xbe3b('0x6d')]['end_conversation']['boolValue']:![],'fulfillmentText':_0x41929e[_0xbe3b('0x6a')]['fulfillmentText'],'intentName':_0x41929e[_0xbe3b('0x6a')][_0xbe3b('0x6e')][_0xbe3b('0x59')],'intentDisplayName':_0x41929e[_0xbe3b('0x6a')][_0xbe3b('0x6e')][_0xbe3b('0x6f')],'isFallbackIntent':_0x41929e['queryResult']['intent'][_0xbe3b('0x70')],'languageCode':_0x41929e[_0xbe3b('0x6a')][_0xbe3b('0x71')],'queryText':_0x41929e[_0xbe3b('0x6a')][_0xbe3b('0x72')],'responseId':_0x41929e[_0xbe3b('0x73')],'score':_0x41929e[_0xbe3b('0x6a')]['intentDetectionConfidence'],'speech':_0x41929e['queryResult']['fulfillmentText'],'providerResponse':JSON[_0xbe3b('0x45')](_0x14e073)};return _0x50fa1b;}}});};exports[_0xbe3b('0x74')]=function(_0x21ecce,_0x4611aa,_0x53a2c2,_0x5cf0d9){return tilde['asr'](_0x21ecce,_0x4611aa,_0x53a2c2,_0x5cf0d9)[_0xbe3b('0x2b')](function(_0x18250c){try{fs[_0xbe3b('0x1e')](_0x21ecce);}catch(_0x1b0a4e){logger[_0xbe3b('0x17')](_0x1b0a4e);}logger[_0xbe3b('0x1c')](_0xbe3b('0x75'),_0x18250c['transcript']);logger[_0xbe3b('0x1c')](_0xbe3b('0x76'),_0x18250c[_0xbe3b('0x54')]);return _0x18250c;});};exports[_0xbe3b('0x77')]=function(_0x552668,_0x2c0f02,_0x2a10b5,_0x2f9f34,_0x5401cc,_0x1bbc70){var _0x5466af=path[_0xbe3b('0x27')](__dirname,'tmp',rs[_0xbe3b('0x39')](0x4)+'.mp3');var _0x4c1461;return aws[_0xbe3b('0x78')](_0x552668,_0x2c0f02,_0x2a10b5,_0x2f9f34,_0x5401cc,_0x1bbc70,_0x5466af)['then'](function(){_0x4c1461=path[_0xbe3b('0x27')](__dirname,_0xbe3b('0x28'),rs[_0xbe3b('0x39')](0x4)+_0xbe3b('0x29'));return convertFile(_0x5466af,_0x4c1461);})[_0xbe3b('0x2b')](function(){try{fs['unlink'](_0x5466af);fs[_0xbe3b('0x2c')](_0x4c1461,_0xbe3b('0x2d'));}catch(_0x50b25f){logger[_0xbe3b('0x17')](_0x50b25f);}return _0x4c1461[_0xbe3b('0x2e')]('.')[0x0];});};exports[_0xbe3b('0x79')]=function(_0x3362df,_0x71198a,_0x51157c,_0x5b3403,_0x4ea5d0,_0x3f0219){return aws['lex'](_0x3362df,_0x71198a,_0x51157c,_0x5b3403,_0x4ea5d0,_0x3f0219)['then'](function(_0x3b5e76){logger[_0xbe3b('0x1c')](JSON[_0xbe3b('0x45')](_0x3b5e76));return _0x3b5e76;});};exports['ispeechTTS']=function(_0x5d32ec,_0x34e0a6,_0x5b6e6c,_0x41d076){var _0x13b380=util[_0xbe3b('0x7a')](_0xbe3b('0x7b'),ISPEECH_API,_0x5d32ec,encodeURIComponent(_0x34e0a6),_0x5b6e6c,_0x41d076);var _0x2a453a=path[_0xbe3b('0x27')](__dirname,_0xbe3b('0x28'),rs['generate'](0x4)+_0xbe3b('0x3a'));var _0x2b2568;return downloadFile(_0x13b380,_0x2a453a)['then'](function(){_0x2b2568=path[_0xbe3b('0x27')](__dirname,_0xbe3b('0x28'),rs['generate'](0x4)+_0xbe3b('0x29'));return convertFile(_0x2a453a,_0x2b2568);})['then'](function(){try{fs[_0xbe3b('0x1e')](_0x2a453a);fs[_0xbe3b('0x2c')](_0x2b2568,_0xbe3b('0x2d'));}catch(_0x59fd0f){logger[_0xbe3b('0x17')](_0x59fd0f);}return _0x2b2568[_0xbe3b('0x2e')]('.')[0x0];});};exports[_0xbe3b('0x7c')]=function(_0x2dcc12,_0x2008fc,_0x39a9ec,_0x1ce423){var _0xb0795d=util[_0xbe3b('0x7a')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x2008fc,_0x39a9ec,base64Encode(_0x2dcc12),_0x1ce423?util[_0xbe3b('0x7a')]('model=%s',encodeURIComponent(_0x1ce423)):_0xbe3b('0x7d'));return uploadFile(_0xb0795d)[_0xbe3b('0x2b')](function(_0x18b6af){return querystring[_0xbe3b('0xa')](_0x18b6af);});};exports[_0xbe3b('0x7e')]=function(_0x483f76,_0x535ea4){return sestek[_0xbe3b('0x7f')](_0x483f76,_0x535ea4)['then'](function(_0x423f15){logger[_0xbe3b('0x1c')](JSON[_0xbe3b('0x45')](_0x423f15));var _0x2ebdf9={'speech':_0x423f15['text'],'action':_0x423f15[_0xbe3b('0x80')]?_0x423f15[_0xbe3b('0x80')]['CustomAction']:undefined,'actiondata':_0x423f15[_0xbe3b('0x80')]?_0x423f15['channelData'][_0xbe3b('0x81')]:undefined};if(_0x423f15[_0xbe3b('0x80')]&&_0x423f15['channelData'][_0xbe3b('0x82')]){return base64Decode(_0x423f15[_0xbe3b('0x80')][_0xbe3b('0x82')]['Data'],path[_0xbe3b('0x27')](__dirname,'tmp',rs[_0xbe3b('0x39')](0x4)+'.wav'))[_0xbe3b('0x2b')](function(_0x3a1160){_0x2ebdf9[_0xbe3b('0x83')]=_0x3a1160;return _0x2ebdf9;});}return _0x2ebdf9;});};exports[_0xbe3b('0x84')]=function(){return __dirname;}; \ No newline at end of file +var _0x2a0c=['info','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','end','https:','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','writeFileSync','base64','then','chmodSync','split','readFileSync','googleCloudTTS','?key=','ssml','input','text:synthesize','POST','.mp3','from','audioContent','777','.wav','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','googleASR','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','stringify','result','resolvedQuery','action','actionIncomplete','speech','score','status','code','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','allRequiredParamsPresent','diagnosticInfo','fields','queryResult','end_conversation','boolValue','fulfillmentText','displayName','intent','isFallback','languageCode','queryText','responseId','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','Data','audiofile','dirName','bluebird','dialogflow','http','https','md5','querystring','request-promise','randomstring','sox','google-tts-api','parse','./aws','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','path','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish'];(function(_0x281e5e,_0xf320e2){var _0x5a22d2=function(_0x405ff9){while(--_0x405ff9){_0x281e5e['push'](_0x281e5e['shift']());}};_0x5a22d2(++_0xf320e2);}(_0x2a0c,0x72));var _0xc2a0=function(_0x591eda,_0x48f626){_0x591eda=_0x591eda-0x0;var _0x22523a=_0x2a0c[_0x591eda];return _0x22523a;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xc2a0('0x0'));var dialogflow=require(_0xc2a0('0x1'));var fs=require('fs');var http=require(_0xc2a0('0x2'));var https=require(_0xc2a0('0x3'));var md5=require(_0xc2a0('0x4'));var path=require('path');var querystring=require(_0xc2a0('0x5'));var rp=require(_0xc2a0('0x6'));var rs=require(_0xc2a0('0x7'));var sox=require(_0xc2a0('0x8'));var tts=require(_0xc2a0('0x9'));var urlParse=require('url')[_0xc2a0('0xa')];var util=require('util');var aws=require(_0xc2a0('0xb'));var google=require('./google');var sestek=require(_0xc2a0('0xc'));var tilde=require('./tilde');var logger=require(_0xc2a0('0xd'))(_0xc2a0('0xe'));var ISPEECH_API=_0xc2a0('0xf');function downloadFile(_0x4328e2,_0x8cf1a){return new BPromise(function(_0x10c45c,_0x122a88){var _0x357720=urlParse(_0x4328e2);var _0xf63c01=_0x357720[_0xc2a0('0x10')]==='https:'?https:http;var _0xa9ce94={'host':_0x357720['host'],'path':_0x357720[_0xc2a0('0x11')],'headers':{'user-agent':_0xc2a0('0x12')}};_0xf63c01[_0xc2a0('0x13')](_0xa9ce94,function(_0x306221){if(_0x306221[_0xc2a0('0x14')]!==0xc8){logger['error'](_0xc2a0('0x15')+_0x4328e2+_0xc2a0('0x16')+_0x306221['statusCode']+'\x20('+_0x306221[_0xc2a0('0x17')]+')');_0x122a88(new Error(_0xc2a0('0x15')+_0x4328e2+_0xc2a0('0x16')+_0x306221[_0xc2a0('0x14')]+'\x20('+_0x306221[_0xc2a0('0x17')]+')'));return;}var _0x1a5da6=fs[_0xc2a0('0x18')](_0x8cf1a);_0x1a5da6['on'](_0xc2a0('0x19'),function(){logger[_0xc2a0('0x1a')](_0xc2a0('0x1b'));_0x1a5da6[_0xc2a0('0x1c')](_0x10c45c);});_0x1a5da6['on'](_0xc2a0('0x1d'),function(_0x1d1fa4){fs[_0xc2a0('0x1e')](_0x8cf1a);logger[_0xc2a0('0x1d')](_0xc2a0('0x1f'),_0x1d1fa4);_0x122a88(_0x1d1fa4);});_0x306221[_0xc2a0('0x20')](_0x1a5da6);})['on'](_0xc2a0('0x1d'),function(_0x36ff6b){logger[_0xc2a0('0x1d')](_0x36ff6b);_0x122a88(_0x36ff6b);})[_0xc2a0('0x21')]();});}function uploadFile(_0x2bedf9){return new BPromise(function(_0x5887a3,_0x56eec0){var _0x318536=urlParse(_0x2bedf9);var _0x9f1184=_0x318536[_0xc2a0('0x10')]===_0xc2a0('0x22')?https:http;var _0xce7924={'host':_0x318536['host'],'path':_0x318536[_0xc2a0('0x11')],'headers':{'user-agent':_0xc2a0('0x12')}};_0x9f1184[_0xc2a0('0x13')](_0xce7924,function(_0xba919a){if(_0xba919a[_0xc2a0('0x14')]!==0xc8){_0x56eec0(new Error(_0xc2a0('0x15')+_0x2bedf9+'\x20failed,\x20status\x20code\x20=\x20'+_0xba919a[_0xc2a0('0x14')]+'\x20('+_0xba919a[_0xc2a0('0x17')]+')'));return;}var _0x195bf='';_0xba919a['on'](_0xc2a0('0x23'),function(_0x3670ac){_0x195bf+=_0x3670ac;});_0xba919a['on'](_0xc2a0('0x21'),function(){_0x5887a3(_0x195bf);});})['on']('error',function(_0x186cc1){_0x56eec0(_0x186cc1);})['end']();});}function convertFile(_0xc4eadf,_0x2c0c0f){return new BPromise(function(_0x50552e,_0x875be7){var _0x55640c=sox[_0xc2a0('0x24')](_0xc4eadf,_0x2c0c0f,{'sampleRate':0x1f40,'format':_0xc2a0('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x55640c['on'](_0xc2a0('0x1d'),function(_0x26ef98){logger[_0xc2a0('0x1d')](_0xc2a0('0x26'),_0x26ef98);_0x875be7(_0x26ef98);});_0x55640c['on']('end',function(){logger['info'](_0xc2a0('0x27'));_0x50552e();});_0x55640c[_0xc2a0('0x28')]();});}function base64Decode(_0x2f36da,_0x213049){var _0x45fb6b=path[_0xc2a0('0x29')](__dirname,_0xc2a0('0x2a'),rs[_0xc2a0('0x2b')](0x4)+'.wav');fs[_0xc2a0('0x2c')](_0x45fb6b,_0x2f36da,_0xc2a0('0x2d'));return convertFile(_0x45fb6b,_0x213049)[_0xc2a0('0x2e')](function(){try{fs['unlink'](_0x45fb6b);fs[_0xc2a0('0x2f')](_0x213049,'777');}catch(_0x4c9902){logger[_0xc2a0('0x1d')](_0x4c9902);}return _0x213049[_0xc2a0('0x30')]('.')[0x0];});}function base64Encode(_0x4221bf){var _0x23ec2e=fs[_0xc2a0('0x31')](_0x4221bf);return new Buffer(_0x23ec2e)['toString'](_0xc2a0('0x2d'));}exports[_0xc2a0('0x32')]=function(_0x50b48a,_0x1a0bf3,_0x2e7389,_0x1a5c06,_0x5dbf65,_0x212004){var _0x39b8ec,_0x115d29;var _0x534e8a='https://texttospeech.googleapis.com/v1/';var _0x5b25ed=_0xc2a0('0x33')+_0x50b48a;var _0x14cdab={};if(_0x1a0bf3===_0xc2a0('0x34')){_0x14cdab[_0xc2a0('0x35')]={'ssml':_0x2e7389};}else{_0x14cdab[_0xc2a0('0x35')]={'text':_0x2e7389};};_0x14cdab['voice']={'languageCode':_0x1a5c06,'ssmlGender':_0x5dbf65};_0x14cdab['audioConfig']={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x33b0d0={'url':_0x534e8a+_0xc2a0('0x36')+_0x5b25ed,'method':_0xc2a0('0x37'),'json':!![],'body':_0x14cdab};return rp(_0x33b0d0)[_0xc2a0('0x2e')](function(_0x5cb376){return new BPromise(function(_0x2b0cf2,_0x5a630b){_0x39b8ec=path[_0xc2a0('0x29')](__dirname,_0xc2a0('0x2a'),rs[_0xc2a0('0x2b')](0x4)+_0xc2a0('0x38'));var _0x49cbd2=Buffer[_0xc2a0('0x39')](_0x5cb376[_0xc2a0('0x3a')],_0xc2a0('0x2d'));return fs['writeFile'](_0x39b8ec,_0x49cbd2,function(_0x56c5f0){_0x5a630b(_0x56c5f0);},function(_0xc6c752){fs[_0xc2a0('0x2f')](_0x39b8ec,_0xc2a0('0x3b'));_0x2b0cf2(_0xc6c752);});});})[_0xc2a0('0x2e')](function(_0x5b9594){_0x115d29=path[_0xc2a0('0x29')](__dirname,_0xc2a0('0x2a'),rs[_0xc2a0('0x2b')](0x4)+_0xc2a0('0x3c'));return convertFile(_0x39b8ec,_0x115d29);})[_0xc2a0('0x2e')](function(){try{fs[_0xc2a0('0x1e')](_0x39b8ec);fs[_0xc2a0('0x2f')](_0x115d29,_0xc2a0('0x3b'));}catch(_0x39af12){logger['error'](_0x39af12);}logger[_0xc2a0('0x1a')](_0xc2a0('0x3d'),_0x115d29[_0xc2a0('0x30')]('.')[0x0]);return _0x115d29[_0xc2a0('0x30')]('.')[0x0];});};exports[_0xc2a0('0x3e')]=function(_0x38c7f7,_0x40cd47){var _0x238a29=_0xc2a0('0x3f');var _0x244d7f,_0x5d3518;var _0x56b1e9;var _0x17379e={'encoding':_0xc2a0('0x40'),'method':_0xc2a0('0x37'),'timeout':0x2710,'url':_0x238a29,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0xc2a0('0x41')+encodeURIComponent(JSON['stringify']([[[_0xc2a0('0x42'),JSON['stringify']([_0x38c7f7,_0x40cd47||'en',![],_0xc2a0('0x43')]),null,_0xc2a0('0x44')]]]))};return rp(_0x17379e)[_0xc2a0('0x2e')](function(_0x38c536){try{_0x56b1e9=eval(_0x38c536[_0xc2a0('0x45')](0x5))[0x0][0x2];}catch(_0x331212){throw new Error(_0xc2a0('0x46')+_0x38c536['data']);}if(!_0x56b1e9){if(_0x38c7f7[_0xc2a0('0x47')]>0xc8){throw new Error(_0xc2a0('0x48'));}else{throw new Error(_0xc2a0('0x49')+_0x40cd47+_0xc2a0('0x4a'));}}try{_0x56b1e9=eval(_0x56b1e9)[0x0];}catch(_0x379323){throw new Error(_0xc2a0('0x46')+res['data']);}const _0x274624=_0x56b1e9;_0x244d7f=path[_0xc2a0('0x29')](__dirname,_0xc2a0('0x2a'),rs['generate'](0x4)+_0xc2a0('0x38'));fs[_0xc2a0('0x2c')](_0x244d7f,_0x56b1e9,{'encoding':_0xc2a0('0x2d')});_0x5d3518=path[_0xc2a0('0x29')](__dirname,_0xc2a0('0x2a'),rs[_0xc2a0('0x2b')](0x4)+_0xc2a0('0x3c'));return convertFile(_0x244d7f,_0x5d3518);})[_0xc2a0('0x2e')](function(){try{fs[_0xc2a0('0x1e')](_0x244d7f);fs[_0xc2a0('0x2f')](_0x5d3518,_0xc2a0('0x3b'));}catch(_0x1c339e){logger[_0xc2a0('0x1d')](_0x1c339e);}logger[_0xc2a0('0x1a')]('goggleTTS\x20path',_0x5d3518[_0xc2a0('0x30')]('.')[0x0]);return _0x5d3518[_0xc2a0('0x30')]('.')[0x0];});};exports[_0xc2a0('0x4b')]=function(_0x17398a,_0x424d9e,_0x3af7c9){return google[_0xc2a0('0x4c')](_0x17398a,_0x424d9e,_0x3af7c9)[_0xc2a0('0x2e')](function(_0x35358b){logger[_0xc2a0('0x1a')](_0x35358b[_0xc2a0('0x4d')]);return rp(_0x35358b);})[_0xc2a0('0x2e')](function(_0x36f297){var _0x246510='';var _0x43dd59=0x0;try{fs[_0xc2a0('0x1e')](_0x17398a);}catch(_0x918eb1){logger[_0xc2a0('0x1d')](_0x918eb1);}if(_0x36f297&&_0x36f297[_0xc2a0('0x4e')]){_0x246510=_0x36f297[_0xc2a0('0x4e')]['map'](function(_0xd088cb){return _0xd088cb&&_0xd088cb[_0xc2a0('0x4f')][0x0]&&_0xd088cb[_0xc2a0('0x4f')][0x0]['transcript']?_0xd088cb['alternatives'][0x0][_0xc2a0('0x50')]:'';})[_0xc2a0('0x51')]('\x0a');_0x43dd59=_0x36f297[_0xc2a0('0x4e')][_0xc2a0('0x52')](function(_0x4c2e9a){return _0x4c2e9a&&_0x4c2e9a[_0xc2a0('0x4f')][0x0]&&_0x4c2e9a[_0xc2a0('0x4f')][0x0][_0xc2a0('0x53')]?_0x4c2e9a[_0xc2a0('0x4f')][0x0][_0xc2a0('0x53')]:0x0;})[_0xc2a0('0x51')]('\x0a');}logger[_0xc2a0('0x1a')](_0xc2a0('0x54'),_0x246510);logger[_0xc2a0('0x1a')]('googleASR\x20confidence',_0x43dd59);return{'transcript':_0x246510,'confidence':_0x43dd59};})['catch'](function(_0xd911cd){logger[_0xc2a0('0x1d')](_0xc2a0('0x55'),_0xd911cd[_0xc2a0('0x14')],_0xd911cd[_0xc2a0('0x56')],_0xd911cd[_0xc2a0('0x57')]);});};exports[_0xc2a0('0x58')]=function(_0x154efd,_0x2206e8,_0xbfb73e,_0x31fe78){var _0x4a1885=apiai(_0x2206e8,{'language':_0x31fe78||'en'});return _0x4a1885[_0xc2a0('0x59')](_0xbfb73e,{'sessionId':md5(_0x154efd)})[_0xc2a0('0x2e')](function(_0x2e24fa){logger[_0xc2a0('0x1a')](JSON[_0xc2a0('0x5a')](_0x2e24fa));return{'source':_0x2e24fa[_0xc2a0('0x5b')]['source'],'resolvedQuery':_0x2e24fa['result'][_0xc2a0('0x5c')],'action':_0x2e24fa[_0xc2a0('0x5b')][_0xc2a0('0x5d')],'actionIncomplete':_0x2e24fa[_0xc2a0('0x5b')][_0xc2a0('0x5e')],'speech':_0x2e24fa[_0xc2a0('0x5b')]['fulfillment'][_0xc2a0('0x5f')],'score':_0x2e24fa[_0xc2a0('0x5b')][_0xc2a0('0x60')],'statusCode':_0x2e24fa[_0xc2a0('0x61')][_0xc2a0('0x62')],'endConversation':_0x2e24fa['result'][_0xc2a0('0x63')]['endConversation']||![],'isFallbackIntent':_0x2e24fa[_0xc2a0('0x5b')][_0xc2a0('0x63')][_0xc2a0('0x64')]};});};exports[_0xc2a0('0x65')]=function(_0x43e844,_0x55ed4a,_0xe30188,_0x3f2d18,_0x3ddf52,_0x54a676){var _0x6e26a3=_0x3f2d18[_0xc2a0('0x66')](/\\n/g,'\x0a');var _0x2604d5={'credentials':{'private_key':_0x6e26a3,'client_email':_0xe30188}};var _0x527d06=new dialogflow[(_0xc2a0('0x67'))](_0x2604d5);var _0x2d0013=_0x527d06[_0xc2a0('0x68')](_0x55ed4a,md5(_0x43e844));var _0x165139={'session':_0x2d0013,'queryInput':{'text':{'text':_0x3ddf52,'languageCode':_0x54a676}}};return _0x527d06[_0xc2a0('0x69')](_0x165139)[_0xc2a0('0x2e')](function(_0x2540d2){if(_0x2540d2&&_0x2540d2[_0xc2a0('0x47')]){logger[_0xc2a0('0x1a')](_0xc2a0('0x6a'),JSON[_0xc2a0('0x5a')](_0x2540d2));var _0x417f59=_0x2540d2[0x0];if(_0x417f59){var _0x324679={'action':_0x417f59['queryResult'][_0xc2a0('0x5d')],'allRequiredParamsPresent':_0x417f59['queryResult'][_0xc2a0('0x6b')],'endConversation':_0x417f59['queryResult'][_0xc2a0('0x6c')]&&_0x417f59['queryResult']['diagnosticInfo'][_0xc2a0('0x6d')]?_0x417f59[_0xc2a0('0x6e')][_0xc2a0('0x6c')][_0xc2a0('0x6d')][_0xc2a0('0x6f')][_0xc2a0('0x70')]:![],'fulfillmentText':_0x417f59[_0xc2a0('0x6e')][_0xc2a0('0x71')],'intentName':_0x417f59[_0xc2a0('0x6e')]['intent']['name'],'intentDisplayName':_0x417f59['queryResult']['intent'][_0xc2a0('0x72')],'isFallbackIntent':_0x417f59['queryResult'][_0xc2a0('0x73')][_0xc2a0('0x74')],'languageCode':_0x417f59[_0xc2a0('0x6e')][_0xc2a0('0x75')],'queryText':_0x417f59['queryResult'][_0xc2a0('0x76')],'responseId':_0x417f59[_0xc2a0('0x77')],'score':_0x417f59[_0xc2a0('0x6e')]['intentDetectionConfidence'],'speech':_0x417f59[_0xc2a0('0x6e')][_0xc2a0('0x71')],'providerResponse':JSON['stringify'](_0x2540d2)};return _0x324679;}}});};exports['tildeASR']=function(_0x22cfea,_0x56d14f,_0x3c2da1,_0x295fd3){return tilde[_0xc2a0('0x4c')](_0x22cfea,_0x56d14f,_0x3c2da1,_0x295fd3)[_0xc2a0('0x2e')](function(_0x22136d){try{fs['unlink'](_0x22cfea);}catch(_0x26c445){logger[_0xc2a0('0x1d')](_0x26c445);}logger[_0xc2a0('0x1a')]('Tilde\x20ASR\x20transcription',_0x22136d[_0xc2a0('0x50')]);logger[_0xc2a0('0x1a')](_0xc2a0('0x78'),_0x22136d['confidence']);return _0x22136d;});};exports[_0xc2a0('0x79')]=function(_0x44f79c,_0x391920,_0x5c78b1,_0x5cee16,_0x91178e,_0xf5e3da){var _0x390ab5=path[_0xc2a0('0x29')](__dirname,_0xc2a0('0x2a'),rs[_0xc2a0('0x2b')](0x4)+_0xc2a0('0x38'));var _0x400543;return aws[_0xc2a0('0x7a')](_0x44f79c,_0x391920,_0x5c78b1,_0x5cee16,_0x91178e,_0xf5e3da,_0x390ab5)[_0xc2a0('0x2e')](function(){_0x400543=path['resolve'](__dirname,_0xc2a0('0x2a'),rs[_0xc2a0('0x2b')](0x4)+_0xc2a0('0x3c'));return convertFile(_0x390ab5,_0x400543);})['then'](function(){try{fs[_0xc2a0('0x1e')](_0x390ab5);fs['chmodSync'](_0x400543,_0xc2a0('0x3b'));}catch(_0x2caa88){logger[_0xc2a0('0x1d')](_0x2caa88);}return _0x400543['split']('.')[0x0];});};exports[_0xc2a0('0x7b')]=function(_0x30859f,_0x2002a9,_0x45958e,_0x4dbf02,_0x3ee5ff,_0x43220e){return aws[_0xc2a0('0x7c')](_0x30859f,_0x2002a9,_0x45958e,_0x4dbf02,_0x3ee5ff,_0x43220e)[_0xc2a0('0x2e')](function(_0x2ee456){logger['info'](JSON[_0xc2a0('0x5a')](_0x2ee456));return _0x2ee456;});};exports[_0xc2a0('0x7d')]=function(_0x2788c7,_0x57d7f1,_0x96e12d,_0x19e936){var _0x2af47a=util[_0xc2a0('0x7e')](_0xc2a0('0x7f'),ISPEECH_API,_0x2788c7,encodeURIComponent(_0x57d7f1),_0x96e12d,_0x19e936);var _0x1f3429=path[_0xc2a0('0x29')](__dirname,_0xc2a0('0x2a'),rs[_0xc2a0('0x2b')](0x4)+_0xc2a0('0x38'));var _0x1ea4e0;return downloadFile(_0x2af47a,_0x1f3429)[_0xc2a0('0x2e')](function(){_0x1ea4e0=path[_0xc2a0('0x29')](__dirname,_0xc2a0('0x2a'),rs[_0xc2a0('0x2b')](0x4)+_0xc2a0('0x3c'));return convertFile(_0x1f3429,_0x1ea4e0);})[_0xc2a0('0x2e')](function(){try{fs['unlink'](_0x1f3429);fs[_0xc2a0('0x2f')](_0x1ea4e0,_0xc2a0('0x3b'));}catch(_0x14e9d6){logger['error'](_0x14e9d6);}return _0x1ea4e0[_0xc2a0('0x30')]('.')[0x0];});};exports[_0xc2a0('0x80')]=function(_0x2e01af,_0x3362b7,_0x26dc12,_0x5a38e0){var _0x4fb945=util[_0xc2a0('0x7e')](_0xc2a0('0x81'),ISPEECH_API,_0x3362b7,_0x26dc12,base64Encode(_0x2e01af),_0x5a38e0?util[_0xc2a0('0x7e')](_0xc2a0('0x82'),encodeURIComponent(_0x5a38e0)):'freeform=3');return uploadFile(_0x4fb945)[_0xc2a0('0x2e')](function(_0x1e114b){return querystring[_0xc2a0('0xa')](_0x1e114b);});};exports[_0xc2a0('0x83')]=function(_0x5f23b0,_0x58c5c8){return sestek[_0xc2a0('0x84')](_0x5f23b0,_0x58c5c8)[_0xc2a0('0x2e')](function(_0x2805d5){logger[_0xc2a0('0x1a')](JSON[_0xc2a0('0x5a')](_0x2805d5));var _0x34d00f={'speech':_0x2805d5[_0xc2a0('0x85')],'action':_0x2805d5[_0xc2a0('0x86')]?_0x2805d5[_0xc2a0('0x86')][_0xc2a0('0x87')]:undefined,'actiondata':_0x2805d5[_0xc2a0('0x86')]?_0x2805d5[_0xc2a0('0x86')][_0xc2a0('0x88')]:undefined};if(_0x2805d5[_0xc2a0('0x86')]&&_0x2805d5[_0xc2a0('0x86')]['AudioFromTts']){return base64Decode(_0x2805d5[_0xc2a0('0x86')]['AudioFromTts'][_0xc2a0('0x89')],path[_0xc2a0('0x29')](__dirname,_0xc2a0('0x2a'),rs[_0xc2a0('0x2b')](0x4)+_0xc2a0('0x3c')))['then'](function(_0x4cc85b){_0x34d00f[_0xc2a0('0x8a')]=_0x4cc85b;return _0x34d00f;});}return _0x34d00f;});};exports[_0xc2a0('0x8b')]=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 7cf8ca4..d32f3f9 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 _0x61ac=['./nda'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x61ac,0x1c4));var _0xc61a=function(_0x3116d6,_0x2d574f){_0x3116d6=_0x3116d6-0x0;var _0x18729d=_0x61ac[_0x3116d6];return _0x18729d;};var nda=require(_0xc61a('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x3eb6=['exports','./nda'];(function(_0x5bb540,_0xd23af0){var _0x77a07=function(_0x4abd6c){while(--_0x4abd6c){_0x5bb540['push'](_0x5bb540['shift']());}};_0x77a07(++_0xd23af0);}(_0x3eb6,0x17b));var _0x63eb=function(_0x4470c0,_0x5b9cd1){_0x4470c0=_0x4470c0-0x0;var _0x2c079a=_0x3eb6[_0x4470c0];return _0x2c079a;};var nda=require(_0x63eb('0x0'));module[_0x63eb('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 34d75a7..1581ef5 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 _0xc1c7=['message','Nda','uniqueid','calleridname','dnid','text','Bearer\x20','access_token','channelData','ProjectName','project','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','body','CustomActionData','info','request-promise','../../../../../config/logger','POST','resolve','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run'];(function(_0x54e672,_0x250030){var _0x4b18f7=function(_0x1a4ce8){while(--_0x1a4ce8){_0x54e672['push'](_0x54e672['shift']());}};_0x4b18f7(++_0x250030);}(_0xc1c7,0x1c6));var _0x7c1c=function(_0x505977,_0x3bdddd){_0x505977=_0x505977-0x0;var _0x1a55e4=_0xc1c7[_0x505977];return _0x1a55e4;};'use strict';var rp=require(_0x7c1c('0x0'));var url=require('url');var logger=require(_0x7c1c('0x1'))('agi');module['exports']=function(_0x327cef,_0x2de404){var _0x52237c={'method':_0x7c1c('0x2'),'uri':url[_0x7c1c('0x3')](_0x2de404['ndauth_url'],_0x7c1c('0x4')),'form':{'grant_type':_0x7c1c('0x5'),'username':_0x2de404[_0x7c1c('0x6')],'password':_0x2de404['password']},'json':!![]};return rp(_0x52237c)[_0x7c1c('0x7')](function(_0x509daa){var _0x3d0dda={'method':_0x7c1c('0x2'),'uri':url['resolve'](_0x2de404[_0x7c1c('0x8')],_0x7c1c('0x9')),'body':{'type':_0x2de404['ndaactivity_type']||_0x7c1c('0xa'),'channelId':_0x7c1c('0xb'),'conversation':{'id':_0x327cef[_0x7c1c('0xc')]},'from':{'id':_0x327cef['callerid'],'name':_0x327cef[_0x7c1c('0xd')]},'recipient':{'id':_0x327cef[_0x7c1c('0xe')],'name':_0x327cef['extension']},'text':_0x2de404[_0x7c1c('0xf')],'channelData':{}},'headers':{'Authorization':_0x7c1c('0x10')+_0x509daa[_0x7c1c('0x11')]},'json':!![]};if(_0x2de404['project']){_0x3d0dda['body'][_0x7c1c('0x12')][_0x7c1c('0x13')]=_0x2de404[_0x7c1c('0x14')];}if(_0x2de404['ndagenerate_audio']=='1'){_0x3d0dda['body'][_0x7c1c('0x12')][_0x7c1c('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x7c1c('0x16')};}if(_0x2de404['custom_action']){_0x3d0dda['body'][_0x7c1c('0x12')][_0x7c1c('0x17')]=_0x2de404[_0x7c1c('0x18')];if(_0x2de404[_0x7c1c('0x19')]){_0x3d0dda[_0x7c1c('0x1a')][_0x7c1c('0x12')][_0x7c1c('0x1b')]=_0x2de404[_0x7c1c('0x19')];}}logger[_0x7c1c('0x1c')](JSON['stringify'](_0x3d0dda));return rp(_0x3d0dda);});}; \ No newline at end of file +var _0xc778=['agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','ndaactivity_type','message','uniqueid','calleridname','dnid','extension','text','access_token','project','channelData','ProjectName','AudioOutputSettings','audio/wav','custom_action','body','CustomAction','custom_action_data','CustomActionData','info','request-promise','url','../../../../../config/logger'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xc778,0xbd));var _0x8c77=function(_0x497f02,_0x4bb9e8){_0x497f02=_0x497f02-0x0;var _0x685c1c=_0xc778[_0x497f02];return _0x685c1c;};'use strict';var rp=require(_0x8c77('0x0'));var url=require(_0x8c77('0x1'));var logger=require(_0x8c77('0x2'))(_0x8c77('0x3'));module[_0x8c77('0x4')]=function(_0x27d79a,_0x3d8cce){var _0xf3e345={'method':_0x8c77('0x5'),'uri':url[_0x8c77('0x6')](_0x3d8cce[_0x8c77('0x7')],_0x8c77('0x8')),'form':{'grant_type':_0x8c77('0x9'),'username':_0x3d8cce[_0x8c77('0xa')],'password':_0x3d8cce[_0x8c77('0x9')]},'json':!![]};return rp(_0xf3e345)[_0x8c77('0xb')](function(_0x51b6a8){var _0xa49024={'method':_0x8c77('0x5'),'uri':url[_0x8c77('0x6')](_0x3d8cce[_0x8c77('0xc')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x3d8cce[_0x8c77('0xd')]||_0x8c77('0xe'),'channelId':'Nda','conversation':{'id':_0x27d79a[_0x8c77('0xf')]},'from':{'id':_0x27d79a['callerid'],'name':_0x27d79a[_0x8c77('0x10')]},'recipient':{'id':_0x27d79a[_0x8c77('0x11')],'name':_0x27d79a[_0x8c77('0x12')]},'text':_0x3d8cce[_0x8c77('0x13')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x51b6a8[_0x8c77('0x14')]},'json':!![]};if(_0x3d8cce[_0x8c77('0x15')]){_0xa49024['body'][_0x8c77('0x16')][_0x8c77('0x17')]=_0x3d8cce[_0x8c77('0x15')];}if(_0x3d8cce['ndagenerate_audio']=='1'){_0xa49024['body']['channelData'][_0x8c77('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x8c77('0x19')};}if(_0x3d8cce[_0x8c77('0x1a')]){_0xa49024[_0x8c77('0x1b')]['channelData'][_0x8c77('0x1c')]=_0x3d8cce[_0x8c77('0x1a')];if(_0x3d8cce[_0x8c77('0x1d')]){_0xa49024[_0x8c77('0x1b')][_0x8c77('0x16')][_0x8c77('0x1e')]=_0x3d8cce['custom_action_data'];}}logger[_0x8c77('0x1f')](JSON['stringify'](_0xa49024));return rp(_0xa49024);});}; \ 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 b585920..831f87a 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 _0x9ed6=['./lib/api','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9ed6,0x9a));var _0x69ed=function(_0x450c0e,_0x12ebac){_0x450c0e=_0x450c0e-0x0;var _0xb60092=_0x9ed6[_0x450c0e];return _0xb60092;};'use strict';var asr=require(_0x69ed('0x0'));module[_0x69ed('0x1')]=function(_0x37d2d5,_0x2bf51e,_0x2a5ed3,_0xa9327){return asr(_0x37d2d5,_0x2bf51e,_0x2a5ed3,_0xa9327);}; \ No newline at end of file +var _0x60b3=['./lib/api','exports'];(function(_0x2486e6,_0x39ce8f){var _0x168fc1=function(_0x8d0da9){while(--_0x8d0da9){_0x2486e6['push'](_0x2486e6['shift']());}};_0x168fc1(++_0x39ce8f);}(_0x60b3,0x80));var _0x360b=function(_0x1510b9,_0x2b0346){_0x1510b9=_0x1510b9-0x0;var _0x380390=_0x60b3[_0x1510b9];return _0x380390;};'use strict';var asr=require(_0x360b('0x0'));module[_0x360b('0x1')]=function(_0x5d0d52,_0x143b09,_0x54969d,_0x1f8ccb){return asr(_0x5d0d52,_0x143b09,_0x54969d,_0x1f8ccb);}; \ 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 0e53c9a..b9ef43f 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 _0x74ae=['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','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','moment','crypto','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x74ae,0x7c));var _0xe74a=function(_0x2ad228,_0x16483a){_0x2ad228=_0x2ad228-0x0;var _0x512c22=_0x74ae[_0x2ad228];return _0x512c22;};'use strict';var BPromise=require(_0xe74a('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xe74a('0x1'));var crypto=require(_0xe74a('0x2'));var logger=require(_0xe74a('0x3'))('agi');module[_0xe74a('0x4')]=function(_0x274250,_0x4d126e,_0xf68193,_0x425197){return new BPromise(function(_0x5dbb8a,_0x39985b){logger[_0xe74a('0x5')](_0xe74a('0x6'),_0x425197||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x4b7ea9=new WebSocket(_0x425197||_0xe74a('0x7'),{'perMessageDeflate':![]});var _0xaf5a75='';var _0x50f458='0';var _0x5c29ee='1';var _0x55256a=_0xe74a('0x8');function _0x15018a(_0x5177a7){var _0xdb5252=crypto['createHash']('sha1');_0xdb5252[_0xe74a('0x9')](_0x5177a7);return _0xdb5252['digest'](_0xe74a('0xa'));}function _0x336c8c(){try{logger[_0xe74a('0x5')](_0xe74a('0xb'));var _0x470b57=moment()[_0xe74a('0xc')]();var _0x384b35=_0x15018a(_0x470b57+_0x4d126e+_0xf68193);_0x4b7ea9[_0xe74a('0xd')](JSON[_0xe74a('0xe')]({'appID':_0x4d126e,'timestamp':_0x470b57,'appKey':_0x384b35}));var _0x3ce096=fs[_0xe74a('0xf')](_0x274250);_0x3ce096['on']('data',function(_0x5b809f){_0x4b7ea9[_0xe74a('0xd')](_0x5b809f);});_0x3ce096['on'](_0xe74a('0x10'),function(){_0x4b7ea9['send'](_0xe74a('0x11'));});}catch(_0x5cd2e1){logger[_0xe74a('0x12')](_0xe74a('0x13'),JSON[_0xe74a('0xe')](_0x5cd2e1));_0x4b7ea9[_0xe74a('0x14')]();}}function _0x59df3f(_0xcd62b5){try{if(_0xcd62b5){var _0x2cf0f4=JSON[_0xe74a('0x15')](_0xcd62b5);switch(_0x2cf0f4[_0xe74a('0x16')]){case 0x0:if(_0x2cf0f4['result']){if(_0x2cf0f4[_0xe74a('0x17')][_0xe74a('0x18')]){logger['info'](_0xe74a('0x19'),JSON[_0xe74a('0xe')](_0x2cf0f4[_0xe74a('0x17')][_0xe74a('0x1a')]));_0xaf5a75=_0x2cf0f4[_0xe74a('0x17')]['hypotheses'][0x0][_0xe74a('0x1b')];_0x50f458=_0x2cf0f4['result'][_0xe74a('0x1a')][0x0]['likelihood'];_0x5c29ee='0';_0x55256a=_0xe74a('0x1c');_0x4b7ea9[_0xe74a('0x14')]();}}break;case 0x1:logger[_0xe74a('0x5')](_0xe74a('0x8'));_0x5c29ee='1';_0x55256a=_0xe74a('0x8');break;case 0x2:logger[_0xe74a('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x5c29ee='2';_0x55256a=_0xe74a('0x1d');break;case 0x9:logger[_0xe74a('0x5')](_0xe74a('0x1e'));_0x5c29ee='9';_0x55256a=_0xe74a('0x1e');break;case 0xa:logger[_0xe74a('0x5')](_0xe74a('0x1f'));_0x5c29ee='10';_0x55256a='Authentication\x20failed.';break;case 0xb:logger[_0xe74a('0x5')](_0xe74a('0x20'));_0x5c29ee='11';_0x55256a=_0xe74a('0x20');}}}catch(_0x518c6d){logger['error'](_0xe74a('0x21'),JSON[_0xe74a('0xe')](_0x518c6d));_0x4b7ea9['terminate']();}}function _0x39aa2c(){logger[_0xe74a('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x5dbb8a({'transcript':_0xaf5a75,'confidence':_0x50f458,'status':_0x5c29ee,'status_message':_0x55256a});}function _0x5b5a21(_0x82af72){logger[_0xe74a('0x12')](_0xe74a('0x22'));if(!_[_0xe74a('0x23')](_0x82af72)){logger['error'](_['isObject'](_0x82af72)?JSON[_0xe74a('0xe')](_0x82af72):_0x82af72);}}_0x4b7ea9['on'](_0xe74a('0x24'),_0x336c8c);_0x4b7ea9['on'](_0xe74a('0x25'),_0x59df3f);_0x4b7ea9['on']('close',_0x39aa2c);_0x4b7ea9['on'](_0xe74a('0x12'),_0x5b5a21);});}; \ No newline at end of file +var _0x8ce8=['../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','createReadStream','data','send','error','Tilde\x20ASR\x20send\x20error','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','stringify','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','close','bluebird','moment','crypto'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x8ce8,0x115));var _0x88ce=function(_0x40af92,_0x22abf7){_0x40af92=_0x40af92-0x0;var _0x4b92ee=_0x8ce8[_0x40af92];return _0x4b92ee;};'use strict';var BPromise=require(_0x88ce('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x88ce('0x1'));var crypto=require(_0x88ce('0x2'));var logger=require(_0x88ce('0x3'))('agi');module[_0x88ce('0x4')]=function(_0x26e310,_0x1c9b05,_0x4bff8e,_0x20e79b){return new BPromise(function(_0x351948,_0x42129c){logger[_0x88ce('0x5')](_0x88ce('0x6'),_0x20e79b||_0x88ce('0x7'));var _0x3740b7=new WebSocket(_0x20e79b||_0x88ce('0x7'),{'perMessageDeflate':![]});var _0x1e1ab7='';var _0x27cfbd='0';var _0x49cd20='1';var _0x31f7ed=_0x88ce('0x8');function _0x144e13(_0x2472a8){var _0x57db49=crypto[_0x88ce('0x9')]('sha1');_0x57db49[_0x88ce('0xa')](_0x2472a8);return _0x57db49[_0x88ce('0xb')](_0x88ce('0xc'));}function _0x52d6c4(){try{logger[_0x88ce('0x5')](_0x88ce('0xd'));var _0x452aec=moment()[_0x88ce('0xe')]();var _0x20456a=_0x144e13(_0x452aec+_0x1c9b05+_0x4bff8e);_0x3740b7['send'](JSON['stringify']({'appID':_0x1c9b05,'timestamp':_0x452aec,'appKey':_0x20456a}));var _0x17b3d6=fs[_0x88ce('0xf')](_0x26e310);_0x17b3d6['on'](_0x88ce('0x10'),function(_0x38c7ec){_0x3740b7[_0x88ce('0x11')](_0x38c7ec);});_0x17b3d6['on']('close',function(){_0x3740b7[_0x88ce('0x11')]('EOS');});}catch(_0x207c6f){logger[_0x88ce('0x12')](_0x88ce('0x13'),JSON['stringify'](_0x207c6f));_0x3740b7[_0x88ce('0x14')]();}}function _0x1e9626(_0xa730e0){try{if(_0xa730e0){var _0x1d6aee=JSON['parse'](_0xa730e0);switch(_0x1d6aee[_0x88ce('0x15')]){case 0x0:if(_0x1d6aee[_0x88ce('0x16')]){if(_0x1d6aee[_0x88ce('0x16')][_0x88ce('0x17')]){logger['info'](_0x88ce('0x18'),JSON[_0x88ce('0x19')](_0x1d6aee['result'][_0x88ce('0x1a')]));_0x1e1ab7=_0x1d6aee[_0x88ce('0x16')]['hypotheses'][0x0][_0x88ce('0x1b')];_0x27cfbd=_0x1d6aee['result'][_0x88ce('0x1a')][0x0][_0x88ce('0x1c')];_0x49cd20='0';_0x31f7ed=_0x88ce('0x1d');_0x3740b7[_0x88ce('0x14')]();}}break;case 0x1:logger[_0x88ce('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x49cd20='1';_0x31f7ed='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x88ce('0x5')](_0x88ce('0x1e'));_0x49cd20='2';_0x31f7ed=_0x88ce('0x1e');break;case 0x9:logger[_0x88ce('0x5')](_0x88ce('0x1f'));_0x49cd20='9';_0x31f7ed=_0x88ce('0x1f');break;case 0xa:logger['info'](_0x88ce('0x20'));_0x49cd20='10';_0x31f7ed=_0x88ce('0x20');break;case 0xb:logger['info'](_0x88ce('0x21'));_0x49cd20='11';_0x31f7ed=_0x88ce('0x21');}}}catch(_0x393a92){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON[_0x88ce('0x19')](_0x393a92));_0x3740b7[_0x88ce('0x14')]();}}function _0x4f35b9(){logger[_0x88ce('0x5')](_0x88ce('0x22'));_0x351948({'transcript':_0x1e1ab7,'confidence':_0x27cfbd,'status':_0x49cd20,'status_message':_0x31f7ed});}function _0xfae0af(_0x317dd5){logger[_0x88ce('0x12')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x88ce('0x23')](_0x317dd5)){logger[_0x88ce('0x12')](_[_0x88ce('0x24')](_0x317dd5)?JSON['stringify'](_0x317dd5):_0x317dd5);}}_0x3740b7['on'](_0x88ce('0x25'),_0x52d6c4);_0x3740b7['on'](_0x88ce('0x26'),_0x1e9626);_0x3740b7['on'](_0x88ce('0x27'),_0x4f35b9);_0x3740b7['on']('error',_0xfae0af);});}; \ 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 054362b..aa7fdd0 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 _0x21fd=['./asr','exports'];(function(_0x539ce4,_0x1d0195){var _0x35b55b=function(_0x19491d){while(--_0x19491d){_0x539ce4['push'](_0x539ce4['shift']());}};_0x35b55b(++_0x1d0195);}(_0x21fd,0x1e2));var _0xd21f=function(_0x2fa150,_0x57ec48){_0x2fa150=_0x2fa150-0x0;var _0x3a67e6=_0x21fd[_0x2fa150];return _0x3a67e6;};var asr=require(_0xd21f('0x0'));module[_0xd21f('0x1')]={'asr':asr}; \ No newline at end of file +var _0xb5b2=['exports','./asr'];(function(_0x527f0e,_0x2dde4a){var _0x4e1dde=function(_0x4f2d6c){while(--_0x4f2d6c){_0x527f0e['push'](_0x527f0e['shift']());}};_0x4e1dde(++_0x2dde4a);}(_0xb5b2,0x10f));var _0x2b5b=function(_0x5a20d9,_0x7070d7){_0x5a20d9=_0x5a20d9-0x0;var _0x1817a5=_0xb5b2[_0x5a20d9];return _0x1817a5;};var asr=require(_0x2b5b('0x0'));module[_0x2b5b('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 97bab5c..f8fa4ff 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 _0x7ec2=['listening','connection','getConnections','E_AGI_SERVER_ERROR','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','nextTick','inherits','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen'];(function(_0x5e76d9,_0x480643){var _0x391309=function(_0x351622){while(--_0x351622){_0x5e76d9['push'](_0x5e76d9['shift']());}};_0x391309(++_0x480643);}(_0x7ec2,0x15c));var _0x27ec=function(_0x1d8ff0,_0x16ef8f){_0x1d8ff0=_0x1d8ff0-0x0;var _0x3f572e=_0x7ec2[_0x1d8ff0];return _0x3f572e;};'use strict';var util=require(_0x27ec('0x0'));var net=require(_0x27ec('0x1'));var EventEmitter=require(_0x27ec('0x2'))['EventEmitter'];var AGIError=require(_0x27ec('0x3'));var AGIChannel=require(_0x27ec('0x4'));var AGIServer=function(_0x53ad30,_0x45b293,_0x340231){var _0x3e1120=this,_0x53ad30=_0x53ad30||0x11dd,_0x45b293=_0x45b293||_0x27ec('0x5'),_0x2f5fcb=null,_0x2ac546=0x0;EventEmitter[_0x27ec('0x6')](_0x3e1120);function _0x1ad634(){if(!_0x53ad30){_0x3e1120[_0x27ec('0x7')](_0x27ec('0x8'),new AGIError(_0x27ec('0x9')));return![];}_0x2f5fcb=net[_0x27ec('0xa')]();_0x2f5fcb[_0x27ec('0xb')](_0x53ad30,_0x45b293);_0x2f5fcb['on'](_0x27ec('0xc'),function(){_0x3e1120[_0x27ec('0x7')](_0x27ec('0xc'));});_0x2f5fcb['on'](_0x27ec('0xd'),function(_0x2abdc6){_0x2f5fcb[_0x27ec('0xe')](function(_0x56c2af,_0x21952a){if(_0x56c2af){_0x3e1120[_0x27ec('0x7')](_0x27ec('0x8'),new AGIError(_0x27ec('0xf'),_0x56c2af));}else if(_0x340231&&_0x340231<0x0){_0x3e1120['emit'](_0x27ec('0x8'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x2abdc6[_0x27ec('0x10')]();}else if(_0x340231&&_0x340231>0x0&&_0x340231<_0x21952a){_0x2ac546+=0x1;_0x3e1120[_0x27ec('0x7')](_0x27ec('0x8'),new AGIError(_0x27ec('0x11'),_0x2ac546));_0x2abdc6[_0x27ec('0x10')]();}else{var _0x14cde9=new AGIChannel(_0x2abdc6);_0x14cde9['on'](_0x27ec('0x12'),function(){_0x3e1120['emit'](_0x27ec('0xd'),_0x14cde9);});}});});_0x2f5fcb['on'](_0x27ec('0x8'),function(_0x486dae){_0x3e1120['emit'](_0x27ec('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x486dae[_0x27ec('0x13')]));});_0x2f5fcb['on'](_0x27ec('0x14'),function(){_0x3e1120[_0x27ec('0x7')](_0x27ec('0x14'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x27ec('0x15')](function(){_0x1ad634();});};util[_0x27ec('0x16')](AGIServer,EventEmitter);module[_0x27ec('0x17')]=function(_0x5ac6cd,_0x37210b,_0x16dc74){return new AGIServer(_0x5ac6cd,_0x37210b,_0x16dc74);}; \ No newline at end of file +var _0x36f1=['E_AGI_SERVER_ERROR','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','util','events','./error','./channel','call','emit','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','error'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x36f1,0xb0));var _0x136f=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x36f1[_0xbca1b1];return _0x4e1686;};'use strict';var util=require(_0x136f('0x0'));var net=require('net');var EventEmitter=require(_0x136f('0x1'))['EventEmitter'];var AGIError=require(_0x136f('0x2'));var AGIChannel=require(_0x136f('0x3'));var AGIServer=function(_0x5a7bbe,_0x1bf6b5,_0x3c8abd){var _0x46dc4d=this,_0x5a7bbe=_0x5a7bbe||0x11dd,_0x1bf6b5=_0x1bf6b5||'127.0.0.1',_0x5b00b5=null,_0x430433=0x0;EventEmitter[_0x136f('0x4')](_0x46dc4d);function _0x29e9c5(){if(!_0x5a7bbe){_0x46dc4d[_0x136f('0x5')]('error',new AGIError(_0x136f('0x6')));return![];}_0x5b00b5=net[_0x136f('0x7')]();_0x5b00b5[_0x136f('0x8')](_0x5a7bbe,_0x1bf6b5);_0x5b00b5['on'](_0x136f('0x9'),function(){_0x46dc4d['emit']('listening');});_0x5b00b5['on'](_0x136f('0xa'),function(_0x41cbeb){_0x5b00b5[_0x136f('0xb')](function(_0x57dfb5,_0x4829aa){if(_0x57dfb5){_0x46dc4d[_0x136f('0x5')](_0x136f('0xc'),new AGIError(_0x136f('0xd'),_0x57dfb5));}else if(_0x3c8abd&&_0x3c8abd<0x0){_0x46dc4d[_0x136f('0x5')](_0x136f('0xc'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x41cbeb['destroy']();}else if(_0x3c8abd&&_0x3c8abd>0x0&&_0x3c8abd<_0x4829aa){_0x430433+=0x1;_0x46dc4d[_0x136f('0x5')](_0x136f('0xc'),new AGIError(_0x136f('0xe'),_0x430433));_0x41cbeb['destroy']();}else{var _0x43fca8=new AGIChannel(_0x41cbeb);_0x43fca8['on'](_0x136f('0xf'),function(){_0x46dc4d[_0x136f('0x5')](_0x136f('0xa'),_0x43fca8);});}});});_0x5b00b5['on'](_0x136f('0xc'),function(_0x685a22){_0x46dc4d[_0x136f('0x5')](_0x136f('0xc'),new AGIError('E_AGI_SERVER_ERROR',_0x685a22[_0x136f('0x10')]));});_0x5b00b5['on'](_0x136f('0x11'),function(){_0x46dc4d[_0x136f('0x5')](_0x136f('0x11'),new AGIError(_0x136f('0x12')));});}process[_0x136f('0x13')](function(){_0x29e9c5();});};util['inherits'](AGIServer,EventEmitter);module[_0x136f('0x14')]=function(_0x34b44d,_0x58ceb6,_0x3722c2){return new AGIServer(_0x34b44d,_0x58ceb6,_0x3722c2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 4822fc7..e8b51ed 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 _0x289e=['number','includes','POST','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','parse','render','stringify','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clear','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isArray','length','isPlainObject','saveRestApiResult','%s.%s','setVariable','split','extra','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','sync','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_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','scheduledAt','delay','phone','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','DIAL','SIP/%s','opts','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','toUpperCase','speech','dialogflow','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','out','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','appid','no\x20appsecret\x20configured','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','getPause','pause_id','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','record','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','no\x20url\x20configured','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','user','subject','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','createSmsMessage','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','subproject','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','AGI','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','unlink','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','googleTTS','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','success','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','replaceAll','exports','path','util','shelljs','odbc','randomstring','mustache','request-promise','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','rpc','mailRpc','getVariable','getVariableById','name','catch','prototype','getVoiceQueue','then','getSquareProjectById','getSquareOdbcById','getUser','getUserById','getTrunk','getSound','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','google_tts_language','url','method','timeout'];(function(_0x578b5f,_0xcdfbb0){var _0x521772=function(_0x75a9e9){while(--_0x75a9e9){_0x578b5f['push'](_0x578b5f['shift']());}};_0x521772(++_0xcdfbb0);}(_0x289e,0x160));var _0xe289=function(_0x64aff8,_0x106082){_0x64aff8=_0x64aff8-0x0;var _0x5488a3=_0x289e[_0x64aff8];return _0x5488a3;};'use strict';var fs=require('fs');var path=require(_0xe289('0x0'));var util=require(_0xe289('0x1'));var _=require('lodash');var sh=require(_0xe289('0x2'));var odbc=require(_0xe289('0x3'))();var rs=require(_0xe289('0x4'));var moment=require('moment');var Mustache=require(_0xe289('0x5'));var rp=require(_0xe289('0x6'));var logger=require(_0xe289('0x7'))(_0xe289('0x8'));var config=require('../../config/environment');var scripts=require(_0xe289('0x9'));var FILES_PATH=_0xe289('0xa');var recursiveMapAttributes=[_0xe289('0xb'),_0xe289('0xc')];var verticesWithRetry=[_0xe289('0xd'),_0xe289('0xe'),_0xe289('0xf')];var AGIVertices=function(_0x384249,_0x2bbc45,_0x28d925){this['channel']=_0x384249;this[_0xe289('0x10')]=_0x2bbc45;this[_0xe289('0x11')]=_0x28d925;};AGIVertices['prototype'][_0xe289('0x12')]=function(_0x3ed099,_0x3f621b){this[_0xe289('0x10')][_0xe289('0x13')](_0x3ed099)['then'](function(_0x41ef2c){_0x3f621b(null,_0x41ef2c?_0x41ef2c[_0xe289('0x14')]:![]);})[_0xe289('0x15')](function(_0x4895fd){_0x3f621b(_0x4895fd);});};AGIVertices[_0xe289('0x16')][_0xe289('0x17')]=function(_0x4a770d,_0x31355b){this[_0xe289('0x10')]['getVoiceQueueById'](_0x4a770d)[_0xe289('0x18')](function(_0x182fa7){_0x31355b(null,_0x182fa7?_0x182fa7[_0xe289('0x14')]:![]);})[_0xe289('0x15')](function(_0x363e69){_0x31355b(_0x363e69);});};AGIVertices['prototype']['getSquareProject']=function(_0x49476b,_0xc6a2b2){this[_0xe289('0x10')][_0xe289('0x19')](_0x49476b)[_0xe289('0x18')](function(_0x189f2f){_0xc6a2b2(null,_0x189f2f?_0x189f2f['name']:![]);})['catch'](function(_0x26d7dc){_0xc6a2b2(_0x26d7dc);});};AGIVertices[_0xe289('0x16')]['getSquareOdbc']=function(_0x42c030,_0x3b8328){this[_0xe289('0x10')][_0xe289('0x1a')](_0x42c030)[_0xe289('0x18')](function(_0x56f15b){_0x3b8328(null,_0x56f15b?_0x56f15b['dsn']:![]);})[_0xe289('0x15')](function(_0x57cd7a){_0x3b8328(_0x57cd7a);});};AGIVertices[_0xe289('0x16')][_0xe289('0x1b')]=function(_0x337e2a,_0x4fe2f3){this[_0xe289('0x10')][_0xe289('0x1c')](_0x337e2a)[_0xe289('0x18')](function(_0x427d6c){_0x4fe2f3(null,_0x427d6c?_0x427d6c[_0xe289('0x14')]:![]);})['catch'](function(_0x5a2c49){_0x4fe2f3(_0x5a2c49);});};AGIVertices[_0xe289('0x16')][_0xe289('0x1d')]=function(_0x403d81,_0x3e3a1c){this[_0xe289('0x10')]['getTrunkById'](_0x403d81)[_0xe289('0x18')](function(_0x1ab93c){_0x3e3a1c(null,_0x1ab93c?_0x1ab93c[_0xe289('0x14')]:![]);})[_0xe289('0x15')](function(_0x31e444){_0x3e3a1c(_0x31e444);});};AGIVertices[_0xe289('0x16')][_0xe289('0x1e')]=function(_0x286f1f,_0x52c099){var _0x2ea5a3=this;this[_0xe289('0x10')]['getSoundById'](_0x286f1f)[_0xe289('0x18')](function(_0x4fb6c9){_0x52c099(null,_0x4fb6c9?_0x2ea5a3[_0xe289('0x1f')](_0x4fb6c9[_0xe289('0x20')]):![]);})[_0xe289('0x15')](function(_0x4a86f1){_0x52c099(_0x4a86f1);});};AGIVertices[_0xe289('0x16')][_0xe289('0x21')]=function(_0x438b7a,_0x33b58c){this['rpc']['getMailAccountById'](_0x438b7a)[_0xe289('0x18')](function(_0x145227){_0x33b58c(null,_0x145227?_0x145227:![]);})['catch'](function(_0x4ab22d){_0x33b58c(_0x4ab22d);});};AGIVertices[_0xe289('0x16')]['sendMailMessage']=function(_0x595938,_0x596b7a,_0x16ade9){this[_0xe289('0x11')][_0xe289('0x22')](_0x595938,_0x596b7a)[_0xe289('0x18')](function(){_0x16ade9(null);})[_0xe289('0x15')](function(_0x535d82){_0x16ade9(_0x535d82);});};AGIVertices[_0xe289('0x16')][_0xe289('0x23')]=function(_0x309d0c,_0x48e873){this[_0xe289('0x10')][_0xe289('0x24')](_0x309d0c)[_0xe289('0x18')](function(_0x39f3bd){if(_0x39f3bd){if(_0x39f3bd[_0xe289('0x25')]){_0x48e873(null,[_0x39f3bd[_0xe289('0x26')]]);}else{_0x48e873(null,_[_0xe289('0x27')](_0x39f3bd[_0xe289('0x28')],_0xe289('0x26')));}}else{_0x48e873(null,![]);}})[_0xe289('0x15')](function(_0x33345d){_0x48e873(_0x33345d);});};AGIVertices[_0xe289('0x16')]['getSoundPath']=function(_0x3a0a14){return util[_0xe289('0x29')](_0xe289('0x2a'),FILES_PATH,_0x3a0a14);};AGIVertices[_0xe289('0x16')][_0xe289('0x2b')]=function(_0x5a9e52,_0x467255,_0x310bb8){odbc[_0xe289('0x2c')](_0x5a9e52,function(_0x24b1b7){if(_0x24b1b7){logger[_0xe289('0x2d')](_0xe289('0x2e'),_0x24b1b7);_0x310bb8(_0x24b1b7);}else{logger[_0xe289('0x2f')](_0xe289('0x30'));odbc[_0xe289('0x31')](_0x467255,function(_0x3d90e6,_0x33fa0a){if(_0x3d90e6){logger[_0xe289('0x2f')](_0xe289('0x32'),_0x467255);_0x310bb8(_0x3d90e6);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x467255);odbc[_0xe289('0x33')](function(_0x113850){if(_0x113850){logger[_0xe289('0x2d')](_0xe289('0x34'),_0x113850);}_0x310bb8(null,_0x33fa0a);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x225917,_0x22baa8){this[_0xe289('0x10')][_0xe289('0x35')](_0x225917)[_0xe289('0x18')](function(_0x481796){_0x22baa8(null,_0x481796?_0x481796:![]);})[_0xe289('0x15')](function(_0x35850e){_0x22baa8(_0x35850e);});};AGIVertices['prototype']['createSmsMessage']=function(_0x3580b2,_0xa79d5c){this['rpc']['createSmsMessage'](_0x3580b2)['then'](function(_0x4da425){_0xa79d5c(null,_0x4da425);})[_0xe289('0x15')](function(_0x3e8267){_0xa79d5c(_0x3e8267);});};AGIVertices[_0xe289('0x16')][_0xe289('0x36')]=function(_0x1c9be7,_0x460664,_0x79387a){this[_0xe289('0x10')]['createSquareDetailsReport']({'uniqueid':this[_0xe289('0x37')][_0xe289('0x38')],'node':_0x1c9be7[_0xe289('0x39')],'application':_0x1c9be7[_0xe289('0x3a')],'data':_0x460664||null,'project_name':this[_0xe289('0x37')][_0xe289('0x3b')],'callerid':this[_0xe289('0x37')][_0xe289('0x3c')]})[_0xe289('0x18')](function(_0x53c4ed){if(_0x79387a){_0x79387a(null,_0x53c4ed);}})[_0xe289('0x15')](function(_0x36e872){if(_0x79387a){_0x79387a(_0x36e872);}});};AGIVertices['prototype'][_0xe289('0x3d')]=function(_0x4ac6bd,_0x36af32,_0x25fe27,_0xc2b81d){this[_0xe289('0x10')]['createSquareRecording']({'uniqueid':this[_0xe289('0x37')][_0xe289('0x38')],'callerid':this[_0xe289('0x37')]['callerid'],'calleridname':this[_0xe289('0x37')]['calleridname'],'context':this[_0xe289('0x37')][_0xe289('0x3e')],'extension':this[_0xe289('0x37')][_0xe289('0x3f')],'priority':this[_0xe289('0x37')][_0xe289('0x40')],'accountcode':this[_0xe289('0x37')][_0xe289('0x41')],'dnid':this['channel'][_0xe289('0x42')],'projectName':this[_0xe289('0x37')]['arg_1'],'saveName':_0x36af32,'filename':_0x4ac6bd[_0xe289('0x43')]||_0x36af32,'savePath':_0x25fe27})[_0xe289('0x18')](function(_0x534fd9){_0xc2b81d(null,_0x534fd9);})[_0xe289('0x15')](function(_0x443c77){_0xc2b81d(_0x443c77);});};AGIVertices[_0xe289('0x16')][_0xe289('0x44')]=function(_0x176699,_0x505c80,_0x1cab48,_0x44e976,_0x25aa3c){this[_0xe289('0x10')][_0xe289('0x44')]({'uniqueid':this['channel'][_0xe289('0x38')],'body':_0x176699,'direction':_0x505c80,'providerName':_0x1cab48,'providerResponse':_0x44e976})[_0xe289('0x18')](function(_0x451b21){if(_0x25aa3c){_0x25aa3c(null,_0x451b21);}})[_0xe289('0x15')](function(_0x4a80d4){if(_0x25aa3c){_0x25aa3c(_0x4a80d4);}});};AGIVertices[_0xe289('0x16')]['createCmContact']=function(_0x5bd0e9,_0x517d1c){this[_0xe289('0x10')][_0xe289('0x45')]({'firstName':_[_0xe289('0x46')](_0x5bd0e9[_0xe289('0x14')])||_[_0xe289('0x47')](_0x5bd0e9[_0xe289('0x14')])?_0xe289('0x48')+Math[_0xe289('0x49')]():_0x5bd0e9[_0xe289('0x14')],'lastName':_[_0xe289('0x46')](_0x5bd0e9['lastName'])||_['isNil'](_0x5bd0e9[_0xe289('0x4a')])?null:_0x5bd0e9[_0xe289('0x4a')],'phone':_0x5bd0e9['phone'],'ListId':_0x5bd0e9['list_id'],'scheduledat':_0x5bd0e9['scheduledAt'],'callbackUniqueid':this[_0xe289('0x37')][_0xe289('0x38')],'tags':_0xe289('0x4b'),'description':_0xe289('0x4c')+_0x5bd0e9['scheduledAt']['toString'](),'priority':_0x5bd0e9[_0xe289('0x4d')]})[_0xe289('0x18')](function(_0x1348aa){_0x517d1c(null,_0x1348aa);})[_0xe289('0x15')](function(_0x428e40){_0x517d1c(_0x428e40);});};AGIVertices[_0xe289('0x16')]['getPause']=function(_0x292eaf,_0x1fba16){this[_0xe289('0x10')][_0xe289('0x4e')](_0x292eaf)[_0xe289('0x18')](function(_0x407358){_0x1fba16(null,_0x407358?_0x407358[_0xe289('0x14')]:![]);})[_0xe289('0x15')](function(_0x2668e8){_0x1fba16(_0x2668e8);});};AGIVertices[_0xe289('0x16')]['agentPause']=function(_0x9df78c,_0x2874f5,_0x264137){var _0x59e83c={'role':_0xe289('0x4f')};_0x59e83c[_0x9df78c]=this[_0xe289('0x37')][_0xe289('0x3c')];this[_0xe289('0x10')][_0xe289('0x50')](_0x59e83c,_0x2874f5,this[_0xe289('0x37')][_0xe289('0x38')])['then'](function(_0x31fbe1){_0x264137(null,_[_0xe289('0x47')](_0x31fbe1)?![]:!![]);})[_0xe289('0x15')](function(_0x2a3b79){logger[_0xe289('0x2d')](_0x2a3b79);_0x264137(null,![]);});};AGIVertices['prototype'][_0xe289('0x51')]=function(_0x188b99,_0x4a14d8){var _0x2e15a7={'role':_0xe289('0x4f')};_0x2e15a7[_0x188b99]=this[_0xe289('0x37')][_0xe289('0x3c')];this[_0xe289('0x10')][_0xe289('0x51')](_0x2e15a7)['then'](function(_0x25e4ea){_0x4a14d8(null,_['isNil'](_0x25e4ea)?![]:!![]);})[_0xe289('0x15')](function(_0x26043b){logger[_0xe289('0x2d')](_0x26043b);_0x4a14d8(null,![]);});};AGIVertices['prototype'][_0xe289('0x52')]=function(_0x2e864d,_0x3415a4){var _0x420202={'role':_0xe289('0x4f')};_0x420202[_0x2e864d]=this['channel'][_0xe289('0x3c')];this[_0xe289('0x10')][_0xe289('0x52')](_0x420202)['then'](function(_0x43242b){_0x3415a4(null,_[_0xe289('0x47')](_0x43242b)?![]:!![]);})[_0xe289('0x15')](function(_0x335c87){logger[_0xe289('0x2d')](_0x335c87);_0x3415a4(null,![]);});};AGIVertices[_0xe289('0x16')][_0xe289('0x53')]=function(_0x4860c6,_0x2276c2){var _0x2cad94={'role':_0xe289('0x4f')};_0x2cad94[_0x4860c6]=this[_0xe289('0x37')][_0xe289('0x3c')];var _0x133790=_0x4860c6!=_0xe289('0x54')?util['format'](_0xe289('0x55'),_0xe289('0x56'),this['channel'][_0xe289('0x3c')]):undefined;this[_0xe289('0x10')]['agentLogin'](_0x2cad94,_0x133790)[_0xe289('0x18')](function(_0x5d1114){_0x2276c2(null,_['isNil'](_0x5d1114)?![]:!![]);})[_0xe289('0x15')](function(_0x2b3ad4){logger[_0xe289('0x2d')](_0x2b3ad4);_0x2276c2(null,![]);});};AGIVertices[_0xe289('0x16')][_0xe289('0x57')]=function(_0x594013,_0x580f91){sh[_0xe289('0x58')](_[_0xe289('0x59')](_0x594013),function(_0x132cc3,_0x455d18){var _0x1f9f4f=_0x455d18[_0xe289('0x5a')](/(\r\n|\n|\r)/gm,'');_0x580f91(null,_0x1f9f4f);});};AGIVertices['prototype'][_0xe289('0x5b')]=function(_0x714569,_0x19fa27){scripts[_0xe289('0x5b')](_0x714569['apiKey'],_0x714569['google_cloud_tts_text_type']||_0xe289('0x5c'),_0x714569[_0xe289('0x5c')],_0x714569[_0xe289('0x5d')]||_0xe289('0x5e'),_0x714569[_0xe289('0x5f')]||'MALE',_0x714569[_0xe289('0x60')]||_0xe289('0x61'))[_0xe289('0x18')](function(_0x1d0da3){_0x19fa27(null,_0x1d0da3);})[_0xe289('0x15')](function(_0x2d149f){_0x19fa27(_0x2d149f);});};AGIVertices[_0xe289('0x16')]['googleTTS']=function(_0x58d976,_0x251dee){scripts['googleTTS'](_0x58d976[_0xe289('0x5c')],_0x58d976[_0xe289('0x62')]||'en',0x1)['then'](function(_0x124d8c){_0x251dee(null,_0x124d8c);})['catch'](function(_0xce1e2b){_0x251dee(_0xce1e2b);});};AGIVertices[_0xe289('0x16')]['restAPI']=function(_0x4a1864,_0x2c1240){var _0x3f45df={'uri':_0x4a1864[_0xe289('0x63')],'method':_0x4a1864[_0xe289('0x64')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4a1864[_0xe289('0x65')])===_0xe289('0x66')&&parseInt(_0x4a1864['timeout'])>=0x1?parseInt(_0x4a1864[_0xe289('0x65')])*0x3e8:0x5*0x3e8};if(_[_0xe289('0x67')]([_0xe289('0x68'),'PUT'],_0x3f45df[_0xe289('0x64')]['toUpperCase']())){try{_0x3f45df[_0xe289('0x69')]=_0x4a1864[_0xe289('0xc')]?JSON['parse'](_0x4a1864['rawBody']):{};}catch(_0x1fba0b){logger[_0xe289('0x2d')](_0xe289('0x6a'),_0x1fba0b);}}try{_0x3f45df[_0xe289('0x6b')]=_0x4a1864[_0xe289('0xb')]?JSON['parse'](_0x4a1864[_0xe289('0xb')]):{};}catch(_0x52b84b){logger[_0xe289('0x2d')](_0xe289('0x6c'),_0x52b84b);}if(_0x4a1864[_0xe289('0x6d')]){try{var _0x1254e0=require(_0x4a1864['computedVariables'])['sync'](this,_0x3f45df);_0x3f45df[_0xe289('0x6e')]=Mustache['render'](_0x4a1864[_0xe289('0x63')],_0x1254e0,{},['$$','$$']);if(_0x3f45df[_0xe289('0x6b')]){_0x3f45df[_0xe289('0x6b')]=JSON[_0xe289('0x6f')](Mustache[_0xe289('0x70')](JSON[_0xe289('0x71')](_0x3f45df[_0xe289('0x6b')]),_0x1254e0,{},['$$','$$']));}if(_0x3f45df[_0xe289('0x69')]){_0x3f45df[_0xe289('0x69')]=JSON[_0xe289('0x6f')](Mustache[_0xe289('0x70')](JSON[_0xe289('0x71')](_0x3f45df[_0xe289('0x69')]),_0x1254e0,{},['$$','$$']));}}catch(_0x22800f){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x22800f);}}rp(_0x3f45df)[_0xe289('0x18')](function(_0x1862dc){var _0x100975={'statusCode':_0x1862dc[_0xe289('0x72')]||0xc8,'statusMessage':_0x1862dc['statusMessage']||'OK','headers':_0x1862dc[_0xe289('0x6b')]||{},'body':_0x1862dc['body']||{}};_0x2c1240(null,_0x100975);})[_0xe289('0x15')](function(_0x326b68){var _0x425a3a={'statusCode':_0x326b68[_0xe289('0x72')]||0x1f4,'statusMessage':_0x326b68[_0xe289('0x73')]||_0xe289('0x74'),'headers':_0x326b68[_0xe289('0x75')][_0xe289('0x6b')]||{},'body':_0x326b68['options'][_0xe289('0x69')]||{}};_0x2c1240(null,_0x425a3a);});};AGIVertices[_0xe289('0x16')][_0xe289('0x76')]=function(_0x3a82cb,_0xff2df){scripts['googleDialogflow'](this[_0xe289('0x37')][_0xe289('0x38')],_0x3a82cb[_0xe289('0x77')],_0x3a82cb[_0xe289('0x5c')],_0x3a82cb['dialogflow_language']||'en')[_0xe289('0x18')](function(_0x5e2ef0){_0xff2df(null,_0x5e2ef0);})['catch'](function(_0x2eb1dc){_0xff2df(_0x2eb1dc);});};AGIVertices[_0xe289('0x16')][_0xe289('0x78')]=function(_0x1e9a76,_0x35cacb){scripts['googleDialogflowV2'](this[_0xe289('0x37')][_0xe289('0x38')],_0x1e9a76[_0xe289('0x79')],_0x1e9a76[_0xe289('0x7a')],_0x1e9a76[_0xe289('0x7b')],_0x1e9a76[_0xe289('0x5c')],_0x1e9a76[_0xe289('0x7c')]||'en')[_0xe289('0x18')](function(_0x51b561){_0x35cacb(null,_0x51b561);})[_0xe289('0x15')](function(_0x4cd98d){_0x35cacb(_0x4cd98d);});};AGIVertices['prototype'][_0xe289('0x7d')]=function(_0x3bebf8,_0x5ac4bc){scripts[_0xe289('0x7d')](this[_0xe289('0x37')],_0x3bebf8)[_0xe289('0x18')](function(_0x1cece1){_0x5ac4bc(null,_0x1cece1);})['catch'](function(_0x1fa4d4){_0x5ac4bc(_0x1fa4d4);});};AGIVertices[_0xe289('0x16')][_0xe289('0x7e')]=function(_0x175ad6,_0xcc00f9){scripts[_0xe289('0x7e')](_0x175ad6[_0xe289('0x77')],_0x175ad6[_0xe289('0x5c')],_0x175ad6[_0xe289('0x7f')]||_0xe289('0x5e'),_0x175ad6[_0xe289('0x80')])[_0xe289('0x18')](function(_0x32a5c0){_0xcc00f9(null,_0x32a5c0);})[_0xe289('0x15')](function(_0x157d41){_0xcc00f9(_0x157d41);});};AGIVertices[_0xe289('0x16')][_0xe289('0x81')]=function(_0x21c249,_0x5c822c,_0x39d2af){scripts[_0xe289('0x81')](_0x5c822c,_0x21c249[_0xe289('0x77')],_0x21c249[_0xe289('0x82')]||_0xe289('0x5e'),this[_0xe289('0x83')](_0x21c249['model'])?_0x21c249[_0xe289('0x84')]:undefined)['then'](function(_0x15aedb){_0x39d2af(null,_0x15aedb);})[_0xe289('0x15')](function(_0x1011f9){_0x39d2af(_0x1011f9);});};AGIVertices[_0xe289('0x16')][_0xe289('0x85')]=function(_0x45b902,_0x387942){scripts[_0xe289('0x85')](_0x45b902[_0xe289('0x86')],_0x45b902[_0xe289('0x87')],_0x45b902['aws_polly_region'],_0x45b902[_0xe289('0x88')]||_0xe289('0x89'),_0x45b902['text'],_0x45b902[_0xe289('0x8a')]||_0xe289('0x5c'))[_0xe289('0x18')](function(_0xefcf15){_0x387942(null,_0xefcf15);})[_0xe289('0x15')](function(_0x5ab3ff){_0x387942(_0x5ab3ff);});};AGIVertices[_0xe289('0x16')][_0xe289('0x8b')]=function(_0x577890,_0x3da7f9){scripts[_0xe289('0x8b')](this[_0xe289('0x37')][_0xe289('0x38')],_0x577890['aws_access_key_id'],_0x577890[_0xe289('0x87')],_0x577890[_0xe289('0x8c')],_0x577890[_0xe289('0x5c')],_0x577890[_0xe289('0x8d')])[_0xe289('0x18')](function(_0x3934a4){_0x3da7f9(null,_0x3934a4);})['catch'](function(_0x22d2fc){_0x3da7f9(_0x22d2fc);});};AGIVertices[_0xe289('0x16')]['googleASR']=function(_0xfce37b,_0x28c4b1,_0x2fdd98){scripts[_0xe289('0x8e')](_0x28c4b1,_0xfce37b[_0xe289('0x77')],_0xfce37b[_0xe289('0x8f')]||_0xe289('0x5e'))['then'](function(_0x182b88){_0x2fdd98(null,_0x182b88);})[_0xe289('0x15')](function(_0x507ab5){_0x2fdd98(_0x507ab5);});};AGIVertices[_0xe289('0x16')][_0xe289('0x90')]=function(_0x21ffa5,_0x143afc,_0x423730){scripts['tildeASR'](_0x143afc,_0x21ffa5['appid'],_0x21ffa5[_0xe289('0x91')],_0x21ffa5[_0xe289('0x6e')])['then'](function(_0x39b4c5){_0x423730(null,_0x39b4c5);})['catch'](function(_0x34a04e){_0x423730(_0x34a04e);});};AGIVertices['prototype'][_0xe289('0x92')]=function(_0x43a52f){var _0x3c7891=_[_0xe289('0x67')](verticesWithRetry,_0x43a52f['agicommand'])?_0x43a52f:_['clone'](_0x43a52f);for(var _0x23f2df in _0x3c7891){if(_0x3c7891[_0xe289('0x93')](_0x23f2df)){if(_0x3c7891[_0x23f2df]&&_[_0xe289('0x94')](_0x3c7891[_0x23f2df])){if(_['includes'](recursiveMapAttributes,_0x23f2df)){_0x3c7891[_0x23f2df]=this['replaceObjectAllVariables'](_0x3c7891[_0x23f2df]);}else{_0x3c7891[_0x23f2df]=this[_0xe289('0x95')](_0x3c7891[_0x23f2df]);}}}}return _0x3c7891;};AGIVertices[_0xe289('0x16')][_0xe289('0x96')]=function(_0x3f997c){for(var _0x497b63 in _0x3f997c){if(_0x3f997c[_0xe289('0x93')](_0x497b63)){if(_['isPlainObject'](_0x3f997c[_0x497b63])){this[_0xe289('0x96')](_0x3f997c[_0x497b63]);}else if(_[_0xe289('0x97')](_0x3f997c[_0x497b63])){for(var _0x430152=0x0;_0x430152<_0x3f997c[_0x497b63][_0xe289('0x98')];_0x430152++){this[_0xe289('0x96')](_0x3f997c[_0x497b63][_0x430152]);}}else if(_[_0xe289('0x94')](_0x3f997c[_0x497b63])){_0x3f997c[_0x497b63]=this[_0xe289('0x95')](_0x3f997c[_0x497b63]);}}}};AGIVertices[_0xe289('0x16')]['saveRestApiResult']=function(_0x2d6386,_0x2ca8dd){for(var _0x20b089 in _0x2d6386){if(_0x2d6386['hasOwnProperty'](_0x20b089)){if(_[_0xe289('0x99')](_0x2d6386[_0x20b089])){if(!_[_0xe289('0x46')](_0x2d6386[_0x20b089])){this[_0xe289('0x9a')](_0x2d6386[_0x20b089],util[_0xe289('0x29')]('%s.%s',_0x2ca8dd,_0x20b089));}}else if(_[_0xe289('0x97')](_0x2d6386[_0x20b089])){for(var _0x251192=0x0;_0x251192<_0x2d6386[_0x20b089][_0xe289('0x98')];_0x251192++){this[_0xe289('0x9a')](_0x2d6386[_0x20b089][_0x251192],util[_0xe289('0x29')](_0xe289('0x9b'),_0x2ca8dd,_0x20b089+'['+_0x251192+']'));}}else{if(!_[_0xe289('0x47')](_0x2d6386[_0x20b089])){this[_0xe289('0x37')][_0xe289('0x9c')](util[_0xe289('0x29')]('%s.%s',_0x2ca8dd,_0x20b089),_0x2d6386[_0x20b089]);}}}}};AGIVertices[_0xe289('0x16')]['replaceObjectAllVariables']=function(_0x59fdd1){try{var _0x31d98c=JSON[_0xe289('0x6f')](_0x59fdd1);this[_0xe289('0x96')](_0x31d98c);return JSON[_0xe289('0x71')](_0x31d98c);}catch(_0x1ab593){return this['replaceAllVariables'](_0x59fdd1);}};AGIVertices[_0xe289('0x16')]['replaceAllVariables']=function(_0x4fe2d4){var _0x1a973f=_0x4fe2d4['split']('{');for(var _0x6fe901=0x1;_0x6fe901<_0x1a973f['length'];_0x6fe901+=0x1){var _0xeea03c=_0x1a973f[_0x6fe901][_0xe289('0x9d')]('}');if(_0xeea03c[_0xe289('0x98')]>0x1){_0x4fe2d4=_0x4fe2d4['replaceAll']('{'+_0xeea03c[0x0]+'}',this[_0xe289('0x37')][_0xe289('0x12')](_0xeea03c[0x0])[_0xe289('0x9e')]||_0xeea03c[0x0]);}}if(_0x1a973f[_0xe289('0x98')]===0x1){return _0x4fe2d4[_0xe289('0x9f')]();}return this['replaceAllVariables'](_0x4fe2d4);};AGIVertices[_0xe289('0x16')][_0xe289('0xa0')]=function(_0x13b589,_0x113608){var _0x25e7bf=this[_0xe289('0x37')][_0xe289('0x12')](_0x13b589);if(_0x25e7bf[_0xe289('0xa1')]===-0x1){return _0x25e7bf;}logger['info'](util[_0xe289('0x29')](_0xe289('0xa2'),_0x113608,_0x25e7bf[_0xe289('0x9e')]));return this[_0xe289('0x37')][_0xe289('0x9c')](_0x113608,_0x25e7bf[_0xe289('0x9e')]);};AGIVertices[_0xe289('0x16')][_0xe289('0x83')]=function(_0x3beedc){return _0x3beedc&&_0x3beedc!=='0'&&_0x3beedc!=='-1'&&_0x3beedc!=='';};AGIVertices['prototype'][_0xe289('0xa3')]=function(_0x48843a){this[_0xe289('0x36')][_0xe289('0xa4')](this,_0x48843a,'-');_0x48843a[_0xe289('0xa5')]=_0x48843a[_0xe289('0xa3')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x5ee0e9){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0xa6'),_0x5ee0e9[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x5ee0e9[_0xe289('0x5c')])){return this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0xa8'));}var _0x5bf5ca='\x22'+_0x5ee0e9[_0xe289('0x5c')]+'\x22';if(this[_0xe289('0x83')](_0x5ee0e9[_0xe289('0x75')])){_0x5bf5ca+=','+_0x5ee0e9[_0xe289('0x75')];}var _0x384436=this[_0xe289('0x37')]['exec'](_0xe289('0xa9'),_0x5bf5ca);if(_0x384436[_0xe289('0xa1')]===-0x1){return _0x384436;}return this[_0xe289('0x37')]['noop'](util[_0xe289('0x29')](_0xe289('0xaa'),_0x5bf5ca));};AGIVertices[_0xe289('0x16')][_0xe289('0xab')]=function(_0x535fa0){logger[_0xe289('0x2f')](util[_0xe289('0x29')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x535fa0[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x535fa0['grammar'])){return this[_0xe289('0x37')][_0xe289('0xa7')]('no\x20grammar\x20configured');}var _0x10c910=_0x535fa0[_0xe289('0xac')];if(this[_0xe289('0x83')](_0x535fa0[_0xe289('0x75')])){_0x10c910+=','+_0x535fa0['options'];}var _0x223b46=this['channel'][_0xe289('0x58')](_0xe289('0xad'),_0x10c910);if(_0x223b46[_0xe289('0xa1')]===-0x1){return _0x223b46;}var _0x3bbbbc=this[_0xe289('0xa0')](_0xe289('0xae'),_0xe289('0xaf'));if(_0x3bbbbc['result']===-0x1){return _0x3bbbbc;}var _0x412b78=this['getAndSetVariable'](_0xe289('0xb0'),_0xe289('0xb1'));if(_0x412b78[_0xe289('0xa1')]===-0x1){return _0x412b78;}var _0x565f2c=this[_0xe289('0xa0')](_0xe289('0xb2'),_0xe289('0xb3'));if(_0x565f2c[_0xe289('0xa1')]===-0x1){return _0x565f2c;}return this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0xb4'),_0x10c910));};AGIVertices['prototype'][_0xe289('0x8')]=function(_0x7cc5f6){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0xb5'),_0x7cc5f6[_0xe289('0x39')]));return this[_0xe289('0x37')]['agi']([_0x7cc5f6[_0xe289('0xb6')],_0x7cc5f6[_0xe289('0xb7')]]);};AGIVertices[_0xe289('0x16')][_0xe289('0xb8')]=function(_0xe51a0d){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0xb9'),_0xe51a0d[_0xe289('0x39')]));if(this['isConfigured'](_0xe51a0d[_0xe289('0x65')])){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0xba'),_0xe51a0d['timeout']));var _0x3eb117=this[_0xe289('0x37')][_0xe289('0xbb')](_0xe51a0d[_0xe289('0x65')]);if(_0x3eb117[_0xe289('0xa1')]===-0x1){return _0x3eb117;}}return this[_0xe289('0x37')]['answer']();};AGIVertices[_0xe289('0x16')][_0xe289('0x4b')]=function(_0x51ea1f){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0xbc'),_0x51ea1f[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x51ea1f['list_id'])){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x51ea1f,'no\x20list\x20selected');}_0x51ea1f[_0xe289('0xbd')]=moment();if(this[_0xe289('0x83')](_0x51ea1f[_0xe289('0xbe')])){_0x51ea1f['scheduledAt']=moment()['add'](_0x51ea1f[_0xe289('0xbe')],'minutes');}if(!this[_0xe289('0x83')](_0x51ea1f[_0xe289('0x4d')])){_0x51ea1f[_0xe289('0x4d')]=0x2;}this['createCmContact'][_0xe289('0xa4')](this,_0x51ea1f);return this[_0xe289('0x37')][_0xe289('0xa7')](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x51ea1f[_0xe289('0xbf')],_0x51ea1f['list_id'],_0x51ea1f[_0xe289('0xbd')]));};AGIVertices[_0xe289('0x16')]['custom_app']=function(_0x4c7c9a){logger[_0xe289('0x2f')](util[_0xe289('0x29')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x4c7c9a['label']));var _0x296611=this['channel'][_0xe289('0x58')](_0x4c7c9a[_0xe289('0xc0')],_0x4c7c9a[_0xe289('0x75')]);if(_0x296611[_0xe289('0xa1')]===-0x1){return _0x296611;}return this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')]('Executed\x20command\x20%s\x20%s',_0x4c7c9a[_0xe289('0xc0')],_0x4c7c9a['options']));};AGIVertices['prototype'][_0xe289('0xc1')]=function(_0x14a739){logger[_0xe289('0x2f')](util['format'](_0xe289('0xc2'),_0x14a739[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x14a739[_0xe289('0x5c')])){return this[_0xe289('0x37')][_0xe289('0xa7')]('no\x20text\x20configured');}var _0x5ed5d4='\x22'+_0x14a739['text']+'\x22';if(this['isConfigured'](_0x14a739[_0xe289('0x75')])){_0x5ed5d4+=','+_0x14a739[_0xe289('0x75')];}var _0x23938d=this[_0xe289('0x37')][_0xe289('0x58')](_0xe289('0xa9'),_0x5ed5d4);if(_0x23938d['result']===-0x1){return _0x23938d;}return this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0xaa'),_0x5ed5d4));};AGIVertices[_0xe289('0x16')][_0xe289('0xc3')]=function(_0x2ac707){logger[_0xe289('0x2f')](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x2ac707[_0xe289('0x39')]));if(!this['isConfigured'](_0x2ac707['text'])){return this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0xa8'));}var _0x293b77='\x22'+_0x2ac707[_0xe289('0x5c')]+'\x22';if(this[_0xe289('0x83')](_0x2ac707['options'])){_0x293b77+=','+_0x2ac707[_0xe289('0x75')];}var _0x21be04=this[_0xe289('0x37')]['exec'](_0xe289('0xa9'),_0x293b77);if(_0x21be04[_0xe289('0xa1')]===-0x1){return _0x21be04;}return this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0xaa'),_0x293b77));};AGIVertices[_0xe289('0x16')][_0xe289('0xc4')]=function(_0x32e39c){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0xc5'),_0x32e39c[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x32e39c[_0xe289('0xac')])){return this['channel']['noop'](_0xe289('0xc6'));}var _0x3fb2f1=_0x32e39c[_0xe289('0xac')];if(this[_0xe289('0x83')](_0x32e39c[_0xe289('0x75')])){_0x3fb2f1+=','+_0x32e39c[_0xe289('0x75')];}var _0x51ed36=this['channel'][_0xe289('0x58')]('MRCPRecog',_0x3fb2f1);if(_0x51ed36[_0xe289('0xa1')]===-0x1){return _0x51ed36;}var _0x47260b=this[_0xe289('0xa0')](_0xe289('0xae'),_0xe289('0xc7'));if(_0x47260b[_0xe289('0xa1')]===-0x1){return _0x47260b;}var _0x29ef76=this[_0xe289('0xa0')]('RECOG_INPUT()',_0xe289('0xc8'));if(_0x29ef76[_0xe289('0xa1')]===-0x1){return _0x29ef76;}var _0x2b8607=this['getAndSetVariable'](_0xe289('0xb2'),_0xe289('0xc9'));if(_0x2b8607[_0xe289('0xa1')]===-0x1){return _0x2b8607;}return this[_0xe289('0x37')]['noop'](util[_0xe289('0x29')](_0xe289('0xb4'),_0x3fb2f1));};AGIVertices['prototype']['sestekasr']=function(_0x20987e){logger[_0xe289('0x2f')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x20987e[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x20987e[_0xe289('0xac')])){return this['channel'][_0xe289('0xa7')](_0xe289('0xc6'));}var _0x1fb119=_0x20987e['grammar'];if(this[_0xe289('0x83')](_0x20987e[_0xe289('0x75')])){_0x1fb119+=','+_0x20987e[_0xe289('0x75')];}var _0x364410=this[_0xe289('0x37')]['exec'](_0xe289('0xad'),_0x1fb119);if(_0x364410[_0xe289('0xa1')]===-0x1){return _0x364410;}var _0x5ddeef=this[_0xe289('0xa0')](_0xe289('0xae'),_0xe289('0xca'));if(_0x5ddeef[_0xe289('0xa1')]===-0x1){return _0x5ddeef;}var _0x52943f=this[_0xe289('0xa0')](_0xe289('0xb0'),_0xe289('0xcb'));if(_0x52943f['result']===-0x1){return _0x52943f;}var _0x438977=this[_0xe289('0xa0')](_0xe289('0xb2'),_0xe289('0xcc'));if(_0x438977[_0xe289('0xa1')]===-0x1){return _0x438977;}return this['channel'][_0xe289('0xa7')](util[_0xe289('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1fb119));};AGIVertices[_0xe289('0x16')][_0xe289('0xcd')]=function(_0x53de89){logger[_0xe289('0x2f')](util['format']('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x53de89[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x53de89[_0xe289('0xce')])){return this['channel'][_0xe289('0x2d')](_0x53de89,_0xe289('0xcf'));}var _0x56d7ed=this[_0xe289('0xd0')][_0xe289('0xa4')](this,_0x53de89[_0xe289('0xce')]);if(!_0x56d7ed){return this[_0xe289('0x37')]['error'](_0x53de89,_0xe289('0xd1'));}if(!this[_0xe289('0x83')](_0x53de89[_0xe289('0x31')])){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x53de89,'no\x20query\x20configured');}var _0x2cda0b=_0x53de89[_0xe289('0x31')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')]('query:\x20%s',_0x2cda0b));var _0x301a0a=this['getQueryOdbc'][_0xe289('0xa4')](this,_0x56d7ed,_0x2cda0b);this[_0xe289('0x36')][_0xe289('0xa4')](this,_0x53de89,_0x2cda0b);if(!this[_0xe289('0x83')](_0x53de89[_0xe289('0xd2')])){return this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0xd3'));}var _0x2135b7=this['getVariable'][_0xe289('0xa4')](this,_0x53de89[_0xe289('0xd2')]);if(!_0x2135b7){return this[_0xe289('0x37')]['error'](_0x53de89,_0xe289('0xd4'));}var _0x1434df=this;_0x301a0a[_0xe289('0xd5')](function(_0x43f4c6,_0x426e0c){Object[_0xe289('0xd6')](_0x43f4c6)[_0xe289('0xd5')](function(_0xca47b6){_0x1434df[_0xe289('0x37')][_0xe289('0x9c')](util['format'](_0xe289('0xd7'),_0x2135b7,_0x426e0c,_0xca47b6),_0x43f4c6[_0xca47b6]);});});this[_0xe289('0x37')][_0xe289('0x9c')](util[_0xe289('0x29')](_0xe289('0xd8'),_0x2135b7),_0x301a0a[_0xe289('0x98')]);return this[_0xe289('0x37')]['noop'](util[_0xe289('0x29')]('variable\x20%s\x20set',_0x2135b7));};AGIVertices[_0xe289('0x16')][_0xe289('0xd9')]=function(_0x4cb226){logger[_0xe289('0xda')](util[_0xe289('0x29')](_0xe289('0xdb'),_0x4cb226[_0xe289('0x39')]));if(!this['isConfigured'](_0x4cb226[_0xe289('0xdc')])){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x4cb226,'no\x20user\x20selected');}var _0x2672c9=this[_0xe289('0x1b')]['sync'](this,_0x4cb226['sip_id']);if(!_0x2672c9){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x4cb226,'no\x20user\x20found');}var _0x32b09f=this[_0xe289('0x37')][_0xe289('0x58')](_0xe289('0xdd'),[util[_0xe289('0x29')](_0xe289('0xde'),_0x2672c9),_0x4cb226[_0xe289('0x65')],_0x4cb226[_0xe289('0xdf')],_0x4cb226['url']]);if(_0x32b09f[_0xe289('0xa1')]===-0x1){return _0x32b09f;}return this['channel']['noop'](util[_0xe289('0x29')]('Executed\x20command\x20%s',_0xe289('0xdd')));};AGIVertices[_0xe289('0x16')]['dialogflow']=function(_0x240ec0){logger[_0xe289('0x2f')](util['format'](_0xe289('0xe0'),_0x240ec0[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x240ec0[_0xe289('0x77')])){return this['channel'][_0xe289('0xa7')](_0xe289('0xe1'));}if(!this[_0xe289('0x83')](_0x240ec0[_0xe289('0x5c')])){return this['channel'][_0xe289('0xa7')](_0xe289('0xa8'));}this['channel'][_0xe289('0xe2')]=!![];this[_0xe289('0x36')](_0x240ec0);this[_0xe289('0x44')](_0x240ec0[_0xe289('0x5c')],'in','','');this[_0xe289('0x37')]['noop'](util['format']('Trying\x20Dialogflow:\x20%s',_0x240ec0[_0xe289('0x5c')]));var _0x538daa=this[_0xe289('0x76')][_0xe289('0xa4')](this,_0x240ec0);if(_0x538daa){for(var _0x35e9ef in _0x538daa){if(_0x538daa[_0xe289('0x93')](_0x35e9ef)){this['channel'][_0xe289('0x9c')](util[_0xe289('0x29')](_0xe289('0xe3'),_0x35e9ef[_0xe289('0xe4')]()),_0x538daa[_0x35e9ef]);}}this[_0xe289('0x44')](_0x538daa[_0xe289('0xe5')],'out',_0xe289('0xe6'),'');return this[_0xe289('0x37')]['noop'](util['format'](_0xe289('0xe7'),_0x538daa['speech']));}return this[_0xe289('0x37')][_0xe289('0x2d')](_0x240ec0,'Dialogflow\x20is\x20unreachable');};AGIVertices['prototype'][_0xe289('0xe8')]=function(_0x28dcbe){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0xe9'),_0x28dcbe[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x28dcbe['dialogflowV2_project_id'])){return this[_0xe289('0x37')]['noop']('no\x20project_id\x20configured');}if(!this[_0xe289('0x83')](_0x28dcbe['client_email'])){return this['channel'][_0xe289('0xa7')](_0xe289('0xea'));}if(!this['isConfigured'](_0x28dcbe[_0xe289('0x7b')])){return this['channel'][_0xe289('0xa7')](_0xe289('0xeb'));}if(!this[_0xe289('0x83')](_0x28dcbe[_0xe289('0x7c')])){return this['channel'][_0xe289('0xa7')](_0xe289('0xec'));}if(!this['isConfigured'](_0x28dcbe[_0xe289('0x5c')])){return this[_0xe289('0x37')][_0xe289('0xa7')]('no\x20text\x20configured');}this[_0xe289('0x37')][_0xe289('0xe2')]=!![];this[_0xe289('0x36')](_0x28dcbe);this[_0xe289('0x44')](_0x28dcbe[_0xe289('0x5c')],'in','','');this[_0xe289('0x37')][_0xe289('0xa7')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x28dcbe[_0xe289('0x5c')]));var _0x2e3a9d=this[_0xe289('0x78')][_0xe289('0xa4')](this,_0x28dcbe);if(_0x2e3a9d){for(var _0x46e283 in _0x2e3a9d){if(_0x2e3a9d[_0xe289('0x93')](_0x46e283)){if(_0x46e283!==_0xe289('0xed')){this[_0xe289('0x37')][_0xe289('0x9c')](util[_0xe289('0x29')]('DIALOGFLOW_%s',_0x46e283['toUpperCase']()),_0x2e3a9d[_0x46e283]);}}}this[_0xe289('0x44')](_0x2e3a9d['speech'],'out',_0xe289('0xe8'),_0x2e3a9d[_0xe289('0xed')]);return this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0xee'),_0x2e3a9d[_0xe289('0xe5')]));}return this['channel'][_0xe289('0x2d')](_0x28dcbe,_0xe289('0xef'));};AGIVertices[_0xe289('0x16')][_0xe289('0xf0')]=function(_0xaee5a0){logger['info'](util[_0xe289('0x29')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0xaee5a0['label']));if(!this[_0xe289('0x83')](_0xaee5a0[_0xe289('0xf1')])){return this[_0xe289('0x37')][_0xe289('0xa7')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xe289('0x83')](_0xaee5a0['username'])){return this[_0xe289('0x37')]['noop']('no\x20username\x20configured');}if(!this[_0xe289('0x83')](_0xaee5a0['password'])){return this['channel'][_0xe289('0xa7')](_0xe289('0xf2'));}if(!this[_0xe289('0x83')](_0xaee5a0[_0xe289('0xf3')])){return this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0xa8'));}this[_0xe289('0x37')][_0xe289('0xe2')]=!![];this[_0xe289('0x36')](_0xaee5a0);this[_0xe289('0x44')](_0xaee5a0['text'],'in','','');this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0xf4'),_0xaee5a0[_0xe289('0x5c')]));var _0x1a86ea=this[_0xe289('0x7d')]['sync'](this,_0xaee5a0);if(_0x1a86ea){for(var _0xf31b7d in _0x1a86ea){if(_0x1a86ea[_0xe289('0x93')](_0xf31b7d)){this[_0xe289('0x37')][_0xe289('0x9c')](util[_0xe289('0x29')]('SESTEK_NDA_%s',_0xf31b7d['toUpperCase']()),_0x1a86ea[_0xf31b7d]);}}this[_0xe289('0x44')](_0x1a86ea[_0xe289('0xe5')],_0xe289('0xf5'),_0xe289('0xf0'),'');if(_0x1a86ea['audiofile']){this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0xf6'),_0x1a86ea[_0xe289('0xf7')]));var _0x5ef00d=this[_0xe289('0x37')][_0xe289('0xf8')](_0x1a86ea[_0xe289('0xf7')]);try{fs['unlink'](_0x1a86ea[_0xe289('0xf7')]+_0xe289('0xf9'));}catch(_0xd65aad){logger['error'](_0xd65aad);}return _0x5ef00d;}else{return this[_0xe289('0x37')]['noop'](util[_0xe289('0x29')](_0xe289('0xfa'),_0x1a86ea[_0xe289('0xe5')]));}}return this['channel']['error'](_0xaee5a0,_0xe289('0xfb'));};AGIVertices[_0xe289('0x16')][_0xe289('0xfc')]=function(_0x23d021){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0xfd'),_0x23d021[_0xe289('0x39')]));return this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0xfc'));};AGIVertices[_0xe289('0x16')][_0xe289('0xfe')]=function(_0x231f80){logger['info'](util[_0xe289('0x29')](_0xe289('0xff'),_0x231f80[_0xe289('0x39')]));var _0x1bed74='';if(_0x231f80[_0xe289('0x100')]){if(!this[_0xe289('0x83')](_0x231f80[_0xe289('0x100')])){return this[_0xe289('0x37')]['error'](_0x231f80,'no\x20trunk\x20selected');}else{var _0x2f7948=parseInt(_0x231f80[_0xe289('0x100')],0xa);if(isNaN(_0x2f7948)){_0x1bed74=_0x231f80[_0xe289('0x100')];}else{_0x1bed74=this[_0xe289('0x1d')][_0xe289('0xa4')](this,_0x231f80['trunk_id']);if(!_0x1bed74){return this['channel']['error'](_0x231f80,_0xe289('0x101'));}}}}else if(_0x231f80[_0xe289('0x102')]){_0x1bed74=_0x231f80[_0xe289('0x102')];}else{return this[_0xe289('0x37')][_0xe289('0x2d')](_0x231f80,_0xe289('0x103'));}var _0x38f16d=this['channel']['exec'](_0xe289('0xdd'),[util[_0xe289('0x29')](_0xe289('0x104'),_0x1bed74,_0x231f80[_0xe289('0xbf')]),_0x231f80[_0xe289('0x65')],_0x231f80[_0xe289('0xdf')],_0x231f80['url']]);if(_0x38f16d[_0xe289('0xa1')]===-0x1){return _0x38f16d;}return this[_0xe289('0x37')]['noop'](util[_0xe289('0x29')](_0xe289('0x105'),'DIAL'));};AGIVertices['prototype'][_0xe289('0x106')]=function(_0x56346f){logger['info'](util[_0xe289('0x29')](_0xe289('0x107'),_0x56346f[_0xe289('0x39')]));return this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0x106'));};AGIVertices[_0xe289('0x16')][_0xe289('0xe')]=function(_0x17168d){logger['info'](util[_0xe289('0x29')](_0xe289('0x108'),_0x17168d[_0xe289('0x39')]));if(_0x17168d[_0xe289('0xa5')]===0x0){return this[_0xe289('0xa3')](_0x17168d);}_0x17168d[_0xe289('0xa5')]-=0x1;if(!this[_0xe289('0x83')](_0x17168d[_0xe289('0x109')])){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x17168d,_0xe289('0x10a'));}var _0x1e873a=this[_0xe289('0x1e')][_0xe289('0xa4')](this,_0x17168d[_0xe289('0x109')]);if(!_0x1e873a){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x17168d,_0xe289('0x10b'));}if(!this[_0xe289('0x83')](_0x17168d[_0xe289('0xd2')])){return this[_0xe289('0x37')][_0xe289('0x2d')](_0xe289('0xd3'));}var _0x1591d2=this[_0xe289('0x37')][_0xe289('0x10c')](_0x1e873a,_0x17168d[_0xe289('0x10d')],_0x17168d[_0xe289('0x10e')]);var _0x2b1f66=_0x1591d2[_0xe289('0xa1')]?_0x1591d2[_0xe289('0xa1')]['toString']():'';logger[_0xe289('0x2f')](_0xe289('0x10f'),JSON[_0xe289('0x71')](_0x1591d2));if(_0x1591d2[_0xe289('0xa1')]===-0x1){this['createSquareDetailsReport'][_0xe289('0xa4')](this,_0x17168d,_0x2b1f66);return _0x1591d2;}else if(_0x1591d2[_0xe289('0x9e')]===_0xe289('0x65')){_0x1591d2[_0xe289('0xa1')]=_0x2b1f66['length']>=parseInt(_0x17168d[_0xe289('0x110')])?'x':'i';}else{_0x1591d2[_0xe289('0xa1')]=_0x2b1f66[_0xe289('0x98')]>=parseInt(_0x17168d[_0xe289('0x110')])&&_0x2b1f66[_0xe289('0x98')]<=parseInt(_0x17168d['maxdigit'])?'x':'i';}var _0x5b038d=this[_0xe289('0x12')][_0xe289('0xa4')](this,_0x17168d[_0xe289('0xd2')]);if(!_0x5b038d){return this['channel']['error'](_0x17168d,_0xe289('0xd4'));}this[_0xe289('0x37')][_0xe289('0x9c')](_0x5b038d,_0x2b1f66);if(this[_0xe289('0x83')](_0x17168d[_0xe289('0x111')])){var _0x33d5a5=parseInt(_0x17168d[_0xe289('0x111')],0xa);var _0x3c4ca4=rs[_0xe289('0x112')]({'charset':'*','length':_0x33d5a5});var _0x333774=_0x2b1f66[_0xe289('0x98')];if(_0x333774>0x0){if(_0x333774>_0x33d5a5){this[_0xe289('0x36')][_0xe289('0xa4')](this,_0x17168d,_0x17168d[_0xe289('0x113')]===_0xe289('0x114')?_0x3c4ca4+_0x2b1f66[_0xe289('0x115')](_0x33d5a5):_0x2b1f66['substr'](0x0,_0x333774-_0x33d5a5)+_0x3c4ca4);}else{this[_0xe289('0x36')][_0xe289('0xa4')](this,_0x17168d,rs[_0xe289('0x112')]({'charset':'*','length':_0x333774}));}}else{this['createSquareDetailsReport'][_0xe289('0xa4')](this,_0x17168d,'');}}else{this[_0xe289('0x36')]['sync'](this,_0x17168d,_0x2b1f66);}return _0x1591d2;};AGIVertices[_0xe289('0x16')][_0xe289('0xf')]=function(_0x377e7a){logger[_0xe289('0x2f')](util[_0xe289('0x29')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x377e7a[_0xe289('0x39')]));return this[_0xe289('0xe')](_0x377e7a);};AGIVertices[_0xe289('0x16')][_0xe289('0x116')]=function(_0x325d26){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x117'),_0x325d26[_0xe289('0x39')]));this['createSquareDetailsReport'][_0xe289('0xa4')](this,_0x325d26,_0x325d26[_0xe289('0x118')]);return this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')]('GOAL\x20%s',_0x325d26[_0xe289('0x118')]));};AGIVertices[_0xe289('0x16')]['awspolly']=function(_0x4ead22){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x119'),_0x4ead22[_0xe289('0x39')]));if(!this['isConfigured'](_0x4ead22['aws_access_key_id'])||!this[_0xe289('0x83')](_0x4ead22['aws_secret_access_key'])){return this[_0xe289('0x37')]['noop'](_0xe289('0x11a'));}if(!this[_0xe289('0x83')](_0x4ead22[_0xe289('0x5c')])){return this['channel'][_0xe289('0xa7')]('no\x20text\x20configured');}this[_0xe289('0x37')]['noop'](util['format'](_0xe289('0x11b'),_0x4ead22[_0xe289('0x5c')]));var _0x4d6f38=this[_0xe289('0x85')][_0xe289('0xa4')](this,_0x4ead22);if(_0x4d6f38){this[_0xe289('0x37')]['noop'](util[_0xe289('0x29')](_0xe289('0x11c'),_0x4d6f38));var _0x889302=this[_0xe289('0x37')]['streamFile'](_0x4d6f38);try{fs['unlink'](_0x4d6f38+_0xe289('0xf9'));}catch(_0x1fb301){logger[_0xe289('0x2d')](_0x1fb301);}return _0x889302;}return this['channel']['error'](_0x4ead22,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xe289('0x16')][_0xe289('0x11d')]=function(_0x55ea8a){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x11e'),_0x55ea8a[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x55ea8a[_0xe289('0x86')])||!this['isConfigured'](_0x55ea8a[_0xe289('0x87')])){return this[_0xe289('0x37')]['noop'](_0xe289('0x11a'));}if(!this[_0xe289('0x83')](_0x55ea8a[_0xe289('0x8d')])){return this['channel'][_0xe289('0xa7')]('no\x20bot\x20name\x20configured');}if(!this[_0xe289('0x83')](_0x55ea8a['text'])){return this['channel'][_0xe289('0xa7')](_0xe289('0xa8'));}this[_0xe289('0x37')][_0xe289('0xe2')]=!![];this['createSquareDetailsReport'](_0x55ea8a);this[_0xe289('0x44')](_0x55ea8a['text'],'in','','');this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x11f'),_0x55ea8a[_0xe289('0x5c')]));var _0x41d44a=this[_0xe289('0x8b')][_0xe289('0xa4')](this,_0x55ea8a);if(_0x41d44a){for(var _0xcbc06f in _0x41d44a){if(_0x41d44a[_0xe289('0x93')](_0xcbc06f)&&_[_0xe289('0x94')](_0x41d44a[_0xcbc06f])){this['channel'][_0xe289('0x9c')](util[_0xe289('0x29')]('AWS_LEX_%s',_0xcbc06f[_0xe289('0xe4')]()),_0x41d44a[_0xcbc06f]);}}if(_[_0xe289('0x47')](_0x41d44a['message'])){return this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0x120'));}else{this['createSquareMessage'](_0x41d44a[_0xe289('0x73')],'out','amazonlex','');return this['channel'][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x121'),_0x41d44a[_0xe289('0x73')]));}}return this[_0xe289('0x37')]['error'](_0x55ea8a,_0xe289('0x122'));};AGIVertices[_0xe289('0x16')][_0xe289('0x123')]=function(_0x1ba456){logger['info'](util[_0xe289('0x29')](_0xe289('0x124'),_0x1ba456[_0xe289('0x39')],_0x1ba456[_0xe289('0x65')]));if(!this['isConfigured'](_0x1ba456['key'])){return this['channel']['noop'](_0xe289('0xe1'));}var _0x363287=_0xe289('0x125');var _0x460903=util['format'](_0xe289('0x126'),FILES_PATH,rs[_0xe289('0x112')](0x4));var _0xf5a473=util[_0xe289('0x29')](_0xe289('0x9b'),_0x460903,_0x363287);var _0x43e3d2=!![];if(_0x1ba456['beep']===_0xe289('0x127')){_0x43e3d2=![];}var _0x923d48=this[_0xe289('0x37')][_0xe289('0x128')](_0x460903,_0x363287,_0x1ba456['intKey'],_0x1ba456[_0xe289('0x65')],undefined,_0x43e3d2);if(_0x923d48[_0xe289('0xa1')]!==-0x1){this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x129'),_0xf5a473));var _0x683aae=this['googleASR'][_0xe289('0xa4')](this,_0x1ba456,_0xf5a473);if(_0x683aae){for(var _0x3b7f51 in _0x683aae){if(_0x683aae[_0xe289('0x93')](_0x3b7f51)){this[_0xe289('0x37')]['setVariable'](util[_0xe289('0x29')](_0xe289('0x12a'),_0x3b7f51[_0xe289('0xe4')]()),_0x683aae[_0x3b7f51]);}}return this['channel'][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x12b'),JSON[_0xe289('0x71')](_0x683aae)));}}return _0x923d48;};AGIVertices['prototype']['tildeasr']=function(_0x3f3a06){logger[_0xe289('0x2f')](util[_0xe289('0x29')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x3f3a06[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x3f3a06[_0xe289('0x12c')])){return this['channel']['noop']('no\x20appid\x20configured');}if(!this[_0xe289('0x83')](_0x3f3a06[_0xe289('0x91')])){return this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0x12d'));}var _0x569197='wav';var _0x32d2c1=util[_0xe289('0x29')](_0xe289('0x126'),FILES_PATH,rs[_0xe289('0x112')](0x4));var _0x10dd2b=util[_0xe289('0x29')]('%s.%s',_0x32d2c1,_0x569197);var _0x3b6bfd=!![];if(_0x3f3a06['beep']===_0xe289('0x127')){_0x3b6bfd=![];}var _0x45720e=this[_0xe289('0x37')][_0xe289('0x128')](_0x32d2c1,_0x569197,_0x3f3a06[_0xe289('0x12e')],_0x3f3a06[_0xe289('0x65')],undefined,_0x3b6bfd);if(_0x45720e[_0xe289('0xa1')]!==-0x1){this[_0xe289('0x37')][_0xe289('0xa7')](util['format'](_0xe289('0x12f'),_0x10dd2b));var _0xeed44e=this[_0xe289('0x90')][_0xe289('0xa4')](this,_0x3f3a06,_0x10dd2b);if(_0xeed44e){for(var _0x2b1ad0 in _0xeed44e){if(_0xeed44e['hasOwnProperty'](_0x2b1ad0)){this['channel']['setVariable'](util[_0xe289('0x29')](_0xe289('0x130'),_0x2b1ad0['toUpperCase']()),_0xeed44e[_0x2b1ad0]);}}return this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x131'),JSON[_0xe289('0x71')](_0xeed44e)));}}return _0x45720e;};AGIVertices[_0xe289('0x16')][_0xe289('0x132')]=function(_0x1adb55){logger[_0xe289('0x2f')](util['format'](_0xe289('0x133'),_0x1adb55['label']));return this['channel']['continueAt'](_0x1adb55['context'],_0x1adb55['extension'],_0x1adb55['priority']);};AGIVertices[_0xe289('0x16')][_0xe289('0x134')]=function(_0x4c489f){logger['info'](util[_0xe289('0x29')](_0xe289('0x135'),_0x4c489f['label']));if(!this[_0xe289('0x83')](_0x4c489f[_0xe289('0x136')])){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x4c489f,_0xe289('0x137'));}try{var _0x1df61b=eval(_0x4c489f[_0xe289('0x136')])?_0xe289('0x138'):_0xe289('0x139');this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')]('EVAL\x20CONDITION\x20%s\x20%s',_0x4c489f[_0xe289('0x136')],_0x1df61b));return{'code':0xc8,'result':_0x1df61b};}catch(_0x188c8f){return{'code':0xc8,'result':_0xe289('0x139')};}};AGIVertices[_0xe289('0x16')][_0xe289('0x13a')]=function(_0xe9ee3e){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x13b'),_0xe9ee3e[_0xe289('0x39')]));if(!this['isConfigured'](_0xe9ee3e[_0xe289('0x13c')])){return this['channel'][_0xe289('0x2d')](_0xe9ee3e,_0xe289('0x13d'));}var _0x3fc40f=this[_0xe289('0x23')][_0xe289('0xa4')](this,_0xe9ee3e[_0xe289('0x13c')]);if(!_0x3fc40f){return this[_0xe289('0x37')]['error'](_0xe9ee3e,_0xe289('0x13e'));}for(var _0x19174b=0x0;_0x19174b<_0x3fc40f[_0xe289('0x98')];_0x19174b+=0x1){var _0x1e8b82=this[_0xe289('0x37')]['getVariable'](util[_0xe289('0x29')](_0xe289('0x13f'),_0x3fc40f[_0x19174b]));if(_0x1e8b82['result']===-0x1){return _0x1e8b82;}logger['info'](util[_0xe289('0x29')]('IFTIME\x20%s\x20%s',_0x3fc40f[_0x19174b],_0x1e8b82[_0xe289('0x9e')]));if(_0x1e8b82[_0xe289('0x9e')]==='true'){logger[_0xe289('0x2f')](util[_0xe289('0x29')]('IFTIME\x20%s\x20%s',_0x3fc40f[_0x19174b],_0xe289('0x138')));this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')]('IFTIME\x20%s\x20%s',_0x3fc40f[_0x19174b],_0xe289('0x138')));return{'code':0xc8,'result':'true'};}else{logger[_0xe289('0x2f')](util['format'](_0xe289('0x140'),_0x3fc40f[_0x19174b],_0xe289('0x139')));this[_0xe289('0x37')]['noop'](util['format']('IFTIME\x20%s\x20%s',_0x3fc40f[_0x19174b],_0xe289('0x139')));}}return{'code':0xc8,'result':_0xe289('0x139')};};AGIVertices[_0xe289('0x16')][_0xe289('0x141')]=function(_0x525dd8){logger[_0xe289('0x2f')](util[_0xe289('0x29')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x525dd8[_0xe289('0x39')]));return this[_0xe289('0x37')][_0xe289('0x141')]();};AGIVertices['prototype'][_0xe289('0x142')]=function(_0x3c86cd){logger[_0xe289('0x2f')](util['format'](_0xe289('0x143'),_0x3c86cd[_0xe289('0x39')]));if(!this['isConfigured'](_0x3c86cd[_0xe289('0x77')])){return this['channel'][_0xe289('0xa7')](_0xe289('0xe1'));}var _0x432486=_0xe289('0x125');var _0x3ac4d4=util[_0xe289('0x29')](_0xe289('0x126'),FILES_PATH,rs[_0xe289('0x112')](0x4));var _0x4ae58b=util[_0xe289('0x29')](_0xe289('0x9b'),_0x3ac4d4,_0x432486);var _0x2d3bb0=!![];if(_0x3c86cd['beep']===_0xe289('0x127')){_0x2d3bb0=![];}var _0x5d3acf=this[_0xe289('0x37')][_0xe289('0x128')](_0x3ac4d4,_0x432486,_0x3c86cd['intKey'],_0x3c86cd[_0xe289('0x65')],undefined,_0x2d3bb0);if(_0x5d3acf[_0xe289('0xa1')]!==-0x1){this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x144'),_0x4ae58b));var _0x347f33=this[_0xe289('0x81')][_0xe289('0xa4')](this,_0x3c86cd,_0x4ae58b);if(_0x347f33){for(var _0x36cb0e in _0x347f33){if(_0x347f33[_0xe289('0x93')](_0x36cb0e)){this[_0xe289('0x37')][_0xe289('0x9c')](util[_0xe289('0x29')]('ISPEECH_ASR_%s',_0x36cb0e['toUpperCase']()),_0x347f33[_0x36cb0e]);}}return this[_0xe289('0x37')][_0xe289('0xa7')](util['format'](_0xe289('0x145'),JSON[_0xe289('0x71')](_0x347f33)));}}return _0x5d3acf;};AGIVertices[_0xe289('0x16')][_0xe289('0x146')]=function(_0x1d9857){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x147'),_0x1d9857[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x1d9857['key'])){return this[_0xe289('0x37')][_0xe289('0xa7')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x1d9857[_0xe289('0x5c')])){return this[_0xe289('0x37')][_0xe289('0xa7')]('no\x20text\x20configured');}this['channel'][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x148'),_0x1d9857[_0xe289('0x5c')]));var _0x5c18a7=this['ispeechTTS'][_0xe289('0xa4')](this,_0x1d9857);if(_0x5c18a7){this[_0xe289('0x37')][_0xe289('0xa7')](util['format'](_0xe289('0x144'),_0x5c18a7));var _0x5620c2=this[_0xe289('0x37')][_0xe289('0xf8')](_0x5c18a7,_0x1d9857[_0xe289('0x12e')]);try{fs['unlink'](_0x5c18a7+_0xe289('0xf9'));}catch(_0x42d38b){logger[_0xe289('0x2d')](_0x42d38b);}return _0x5620c2;}return this[_0xe289('0x37')]['error'](_0x1d9857,_0xe289('0x149'));};AGIVertices[_0xe289('0x16')][_0xe289('0x14a')]=function(_0x22d49f){logger[_0xe289('0x2f')](util['format'](_0xe289('0x14b'),_0x22d49f['label']));if(!this[_0xe289('0x83')](_0x22d49f[_0xe289('0x14c')])){return this['channel'][_0xe289('0x2d')](_0x22d49f,_0xe289('0x14d'));}logger['info'](util[_0xe289('0x29')](_0xe289('0x14e'),this[_0xe289('0x37')][_0xe289('0x3c')],_0x22d49f[_0xe289('0x14c')]));var _0x4b45ee=this['agentLogin'][_0xe289('0xa4')](this,_0x22d49f[_0xe289('0x14c')]);if(_0x4b45ee){logger[_0xe289('0x2f')](util['format'](_0xe289('0x14f'),this[_0xe289('0x37')][_0xe289('0x3c')],_0x22d49f[_0xe289('0x14c')]));this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe289('0x37')][_0xe289('0x3c')],_0x22d49f['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xe289('0x2f')](util['format'](_0xe289('0x150'),this[_0xe289('0x37')][_0xe289('0x3c')],_0x22d49f['findBy']));this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x150'),this['channel'][_0xe289('0x3c')],_0x22d49f[_0xe289('0x14c')]));return{'code':0xc8,'result':_0xe289('0x151')};}};AGIVertices[_0xe289('0x16')]['logout']=function(_0x537081){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x152'),_0x537081['label']));if(!this[_0xe289('0x83')](_0x537081['findBy'])){return this[_0xe289('0x37')]['error'](_0x537081,_0xe289('0x14d'));}logger[_0xe289('0x2f')](util['format'](_0xe289('0x14e'),this[_0xe289('0x37')][_0xe289('0x3c')],_0x537081[_0xe289('0x14c')]));var _0x280ea3=this[_0xe289('0x52')][_0xe289('0xa4')](this,_0x537081[_0xe289('0x14c')]);if(_0x280ea3){logger['info'](util['format'](_0xe289('0x14f'),this[_0xe289('0x37')][_0xe289('0x3c')],_0x537081[_0xe289('0x14c')]));this[_0xe289('0x37')][_0xe289('0xa7')](util['format'](_0xe289('0x14f'),this[_0xe289('0x37')][_0xe289('0x3c')],_0x537081['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xe289('0x2f')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe289('0x37')][_0xe289('0x3c')],_0x537081[_0xe289('0x14c')]));this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x150'),this[_0xe289('0x37')][_0xe289('0x3c')],_0x537081['findBy']));return{'code':0xc8,'result':_0xe289('0x151')};}};AGIVertices[_0xe289('0x16')][_0xe289('0x153')]=function(_0xac151){logger[_0xe289('0x2f')](util[_0xe289('0x29')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0xac151[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0xac151[_0xe289('0x154')])){return this[_0xe289('0x37')][_0xe289('0x2d')](_0xac151,_0xe289('0x155'));}this['channel'][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x156'),_0xac151[_0xe289('0x154')]));var _0x14c71b=eval(_0xac151[_0xe289('0x154')]);if(!this[_0xe289('0x83')](_0xac151[_0xe289('0xd2')])){return this[_0xe289('0x37')]['noop'](_0xe289('0xd3'));}var _0x1ea3cc=this[_0xe289('0x12')][_0xe289('0xa4')](this,_0xac151[_0xe289('0xd2')]);if(!_0x1ea3cc){return this[_0xe289('0x37')][_0xe289('0x2d')](_0xac151,'no\x20variable\x20found');}if(_[_0xe289('0x97')](_0x14c71b)){var _0x31733a=this;_0x14c71b[_0xe289('0xd5')](function(_0x34d629,_0x4db5fc){_0x31733a[_0xe289('0x37')][_0xe289('0x9c')](util[_0xe289('0x29')](_0xe289('0x157'),_0x1ea3cc,_0x4db5fc),_0x34d629);});return this['channel'][_0xe289('0xa7')](util['format'](_0xe289('0x158'),_0x1ea3cc));}else{return this[_0xe289('0x37')]['setVariable'](_0x1ea3cc,_0x14c71b);}};AGIVertices['prototype'][_0xe289('0xd')]=function(_0x5cf548){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x159'),_0x5cf548['label']));if(_0x5cf548[_0xe289('0xa5')]===0x0){return this[_0xe289('0xa3')](_0x5cf548);}_0x5cf548[_0xe289('0xa5')]-=0x1;if(!this[_0xe289('0x83')](_0x5cf548[_0xe289('0x109')])){return this['channel'][_0xe289('0x2d')](_0x5cf548,_0xe289('0x10a'));}var _0x29f7bc=this[_0xe289('0x1e')][_0xe289('0xa4')](this,_0x5cf548[_0xe289('0x109')]);if(!_0x29f7bc){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x5cf548,_0xe289('0x10b'));}var _0xadf18=this[_0xe289('0x37')]['getData'](_0x29f7bc,_0x5cf548[_0xe289('0x10d')],_0x5cf548[_0xe289('0x15a')]);var _0x3a05e3=_0xadf18[_0xe289('0xa1')];if(_0xadf18[_0xe289('0xa1')]===-0x1){this[_0xe289('0x36')][_0xe289('0xa4')](this,_0x5cf548,'-1');return _0xadf18;}else if(_0xadf18['extra']===_0xe289('0x65')){_0xadf18['result']=_0xadf18[_0xe289('0xa1')]['length']>0x0?_0xadf18[_0xe289('0xa1')]:'t';}else if(_[_0xe289('0x46')](_0xadf18['result'])){_0xadf18[_0xe289('0xa1')]='#';_0x3a05e3='#';}if(!this['isConfigured'](_0x5cf548[_0xe289('0xd2')])){this['channel'][_0xe289('0xa7')](_0xe289('0xd3'));}else{var _0x3810fb=this['getVariable'][_0xe289('0xa4')](this,_0x5cf548[_0xe289('0xd2')]);if(!_0x3810fb){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x5cf548,'no\x20variable\x20found');}this[_0xe289('0x37')][_0xe289('0x9c')](_0x3810fb,_0x3a05e3);}this['createSquareDetailsReport'][_0xe289('0xa4')](this,_0x5cf548,_0x3a05e3);return _0xadf18;};AGIVertices[_0xe289('0x16')][_0xe289('0xa7')]=function(_0x2d2b5d){logger['info'](util[_0xe289('0x29')](_0xe289('0x15b'),_0x2d2b5d['label']));return this[_0xe289('0x37')][_0xe289('0xa7')](_0x2d2b5d[_0xe289('0x15c')]||_0x2d2b5d['label']);};AGIVertices[_0xe289('0x16')]['pause']=function(_0x4a7d13){logger[_0xe289('0x2f')](util[_0xe289('0x29')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x4a7d13[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x4a7d13[_0xe289('0x14c')])){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x4a7d13,_0xe289('0x14d'));}logger['info'](util[_0xe289('0x29')](_0xe289('0x14e'),this[_0xe289('0x37')][_0xe289('0x3c')],_0x4a7d13['findBy']));var _0x165452=this[_0xe289('0x15d')][_0xe289('0xa4')](this,_0x4a7d13[_0xe289('0x15e')]);var _0x55f572=this[_0xe289('0x50')][_0xe289('0xa4')](this,_0x4a7d13['findBy'],_0x165452);if(_0x55f572){logger['info'](util[_0xe289('0x29')](_0xe289('0x14f'),this[_0xe289('0x37')][_0xe289('0x3c')],_0x4a7d13[_0xe289('0x14c')]));this['channel'][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x14f'),this['channel'][_0xe289('0x3c')],_0x4a7d13[_0xe289('0x14c')]));return{'code':0xc8,'result':'success'};}else{logger[_0xe289('0x2f')](util[_0xe289('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xe289('0x37')][_0xe289('0x3c')],_0x4a7d13[_0xe289('0x14c')]));this['channel'][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x14f'),this[_0xe289('0x37')][_0xe289('0x3c')],_0x4a7d13[_0xe289('0x14c')]));return{'code':0xc8,'result':_0xe289('0x151')};}};AGIVertices[_0xe289('0x16')]['playback']=function(_0x14f809){logger[_0xe289('0x2f')](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x14f809[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x14f809[_0xe289('0x109')])){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x14f809,'no\x20file\x20audio\x20selected');}var _0x278e70=this[_0xe289('0x1e')][_0xe289('0xa4')](this,_0x14f809[_0xe289('0x109')]);if(!_0x278e70){return this['channel'][_0xe289('0x2d')](_0x14f809,_0xe289('0x10b'));}var _0x35690b=this[_0xe289('0x37')][_0xe289('0x58')](_0xe289('0x15f'),[_0x278e70,_0x14f809[_0xe289('0xdf')]]);if(_0x35690b[_0xe289('0xa1')]===-0x1){return _0x35690b;}return this['channel']['noop'](util[_0xe289('0x29')](_0xe289('0x160'),_0xe289('0x15f'),_0x278e70));};AGIVertices['prototype'][_0xe289('0x161')]=function(_0x16c453){logger[_0xe289('0x2f')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x16c453[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x16c453[_0xe289('0x162')])){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x16c453,_0xe289('0x163'));}var _0x54f97b='';var _0x45e87f=parseInt(_0x16c453[_0xe289('0x162')],0xa);if(isNaN(_0x45e87f)){_0x54f97b=_0x16c453[_0xe289('0x162')];}else{_0x54f97b=this[_0xe289('0x17')][_0xe289('0xa4')](this,_0x16c453[_0xe289('0x162')]);if(!_0x54f97b){return this['channel'][_0xe289('0x2d')](_0x16c453,_0xe289('0x164'));}}var _0x1a5522='';if(this[_0xe289('0x83')](_0x16c453[_0xe289('0x109')])){var _0x506e7a=this[_0xe289('0x1e')][_0xe289('0xa4')](this,_0x16c453[_0xe289('0x109')]);if(_0x506e7a){_0x1a5522=_0x506e7a;}}this[_0xe289('0x36')][_0xe289('0xa4')](this,_0x16c453,_0x54f97b);if(_0x16c453[_0xe289('0xdf')][_0xe289('0x165')]('x')<0x0){_0x16c453[_0xe289('0xdf')]+='x';}if(_0x16c453[_0xe289('0xdf')][_0xe289('0x165')]('X')<0x0){_0x16c453['opts']+='X';}this['channel'][_0xe289('0x9c')](_0xe289('0x166'),_0x54f97b?_0x54f97b[_0xe289('0x167')]():'');var _0x1e382e=this[_0xe289('0x37')][_0xe289('0x58')](_0xe289('0x168'),[_0x54f97b,_0x16c453[_0xe289('0xdf')],_0x16c453[_0xe289('0x63')],_0x1a5522,_0x16c453[_0xe289('0x65')],_0x16c453[_0xe289('0x8')],_0x16c453['macro'],_0x16c453[_0xe289('0x169')],'',_0x16c453[_0xe289('0x16a')]]);if(_0x1e382e[_0xe289('0xa1')]===-0x1){return _0x1e382e;}return this[_0xe289('0x37')]['noop'](util[_0xe289('0x29')](_0xe289('0x160'),_0xe289('0x168'),_0x54f97b));};AGIVertices[_0xe289('0x16')][_0xe289('0x16b')]=function(_0x1108d8){logger['info'](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x1108d8['label']));var _0xa9486a=_0x1108d8['recordingFormat']||'wav';var _0x3c5dd9=util[_0xe289('0x29')](_0xe289('0x16c'),this['channel']['uniqueid'],rs[_0xe289('0x112')](0x5));var _0x8ce89c=util[_0xe289('0x29')](_0xe289('0x16d'),FILES_PATH,_0x3c5dd9,_0xa9486a);var _0x5da923=util[_0xe289('0x29')](_0xe289('0x126'),FILES_PATH,_0x3c5dd9);this[_0xe289('0x3d')][_0xe289('0xa4')](this,_0x1108d8,_0x3c5dd9,_0x8ce89c);this[_0xe289('0x37')][_0xe289('0x9c')]('RECORDING_SAVENAME',_0x3c5dd9);logger[_0xe289('0x2f')](_0xe289('0x16e'),_0x5da923,_0xa9486a,_0x1108d8[_0xe289('0x16f')],_0x1108d8['timeout']);return this[_0xe289('0x37')][_0xe289('0x128')](_0x5da923,_0xa9486a,_0x1108d8[_0xe289('0x16f')],_0x1108d8[_0xe289('0x65')],undefined,!![]);};AGIVertices[_0xe289('0x16')]['restapi']=function(_0x1639eb){logger['info'](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x1639eb[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x1639eb[_0xe289('0x63')])){return this['channel']['noop'](_0xe289('0x170'));}var _0x18ab88=this[_0xe289('0x171')][_0xe289('0xa4')](this,_0x1639eb);logger[_0xe289('0x2f')](util['format'](_0xe289('0x172'),util[_0xe289('0x173')](_0x18ab88,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x1639eb['variable_id'])){return this['channel'][_0xe289('0xa7')](_0xe289('0x174'));}var _0x169d33=this[_0xe289('0x12')][_0xe289('0xa4')](this,_0x1639eb['variable_id']);if(!_0x169d33){return this['channel'][_0xe289('0x2d')](_0x1639eb,_0xe289('0xd4'));}this[_0xe289('0x37')][_0xe289('0x9c')](util[_0xe289('0x29')](_0xe289('0x175'),_0x169d33),_0x18ab88[_0xe289('0x72')]?_0x18ab88['statusCode']:'200');this[_0xe289('0x37')][_0xe289('0x9c')](util[_0xe289('0x29')](_0xe289('0x176'),_0x169d33),_0x18ab88[_0xe289('0x177')]?_0x18ab88[_0xe289('0x177')]:'OK');if(_0x18ab88[_0xe289('0x69')]){try{this[_0xe289('0x9a')](_0x18ab88[_0xe289('0x69')],_0x169d33);}catch(_0xff0942){logger['error'](util[_0xe289('0x29')](_0xe289('0x178'),_0x169d33));}}return this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x179'),_0x169d33));};AGIVertices['prototype'][_0xe289('0x17a')]=function(_0xdde782){logger['info'](util[_0xe289('0x29')](_0xe289('0x17b'),_0xdde782['label']));return this[_0xe289('0x37')]['sayDigits'](_0xdde782['digits'][_0xe289('0x5a')](/\s+/g,''),_0xdde782[_0xe289('0x16f')]);};AGIVertices['prototype'][_0xe289('0x17c')]=function(_0x3dc2d2){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x17d'),_0x3dc2d2[_0xe289('0x39')]));return this[_0xe289('0x37')]['sayNumber'](_0x3dc2d2[_0xe289('0x66')][_0xe289('0x5a')](/\s+/g,''),_0x3dc2d2[_0xe289('0x16f')]);};AGIVertices['prototype'][_0xe289('0x17e')]=function(_0x48b132){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x17f'),_0x48b132['label']));return this[_0xe289('0x37')][_0xe289('0x180')](_0x48b132[_0xe289('0x5c')],_0x48b132[_0xe289('0x16f')]);};AGIVertices['prototype'][_0xe289('0x181')]=function(_0x3369ba){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x182'),_0x3369ba['label']));if(!this['isConfigured'](_0x3369ba[_0xe289('0x183')])){return this['channel']['noop'](_0xe289('0x184'));}var _0x3f8f5c=this['getMailAccount'][_0xe289('0xa4')](this,_0x3369ba[_0xe289('0x183')]);if(!_0x3f8f5c||!_0x3f8f5c[_0xe289('0x185')]){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x3369ba,_0xe289('0x186'));}var _0x1f1ff4={'from':util[_0xe289('0x29')]('\x22%s\x22\x20<%s>',_0x3f8f5c[_0xe289('0x14')],_0x3f8f5c[_0xe289('0x187')]||_0x3f8f5c['Smtp'][_0xe289('0x188')]),'to':_0x3369ba['to']||'','cc':_0x3369ba['cc']||'','bcc':_0x3369ba['bcc']||'','subject':_0x3369ba[_0xe289('0x189')],'html':_0x3369ba[_0xe289('0x5c')],'text':_0x3369ba[_0xe289('0x5c')]};var _0x45e8a2={'tls':{'rejectUnauthorized':![]}};if(_0x3f8f5c[_0xe289('0x185')][_0xe289('0x18a')]){_0x45e8a2[_0xe289('0x18a')]=_0x3f8f5c[_0xe289('0x185')][_0xe289('0x18a')];}else{_0x45e8a2[_0xe289('0x18b')]=_0x3f8f5c['Smtp'][_0xe289('0x18b')];_0x45e8a2[_0xe289('0x18c')]=_0x3f8f5c['Smtp'][_0xe289('0x18c')];_0x45e8a2[_0xe289('0x18d')]=_0x3f8f5c[_0xe289('0x185')][_0xe289('0x18d')];}if(_0x3f8f5c[_0xe289('0x185')][_0xe289('0x18e')]){_0x45e8a2[_0xe289('0x18f')]={'user':_0x3f8f5c[_0xe289('0x185')][_0xe289('0x188')],'pass':_0x3f8f5c[_0xe289('0x185')][_0xe289('0x190')]};}if(this[_0xe289('0x83')](_0x3369ba[_0xe289('0x191')])){}logger[_0xe289('0xda')](_0xe289('0x192'),JSON['stringify'](_0x1f1ff4));this[_0xe289('0x36')]['sync'](this,_0x3369ba,_0x3369ba[_0xe289('0x183')]);this[_0xe289('0x37')]['noop'](util[_0xe289('0x29')](_0xe289('0x193'),_0x3f8f5c[_0xe289('0x14')]));this[_0xe289('0x22')][_0xe289('0xa4')](this,_0x45e8a2,_0x1f1ff4);return this['channel'][_0xe289('0xa7')](_0xe289('0x194'));};AGIVertices['prototype'][_0xe289('0x195')]=function(_0x33712b){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x196'),_0x33712b[_0xe289('0x39')]));return this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0x197'));};AGIVertices[_0xe289('0x16')]['sendSMS']=function(_0x32a999){logger[_0xe289('0x2f')](util[_0xe289('0x29')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x32a999[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x32a999[_0xe289('0x198')])){return this[_0xe289('0x37')][_0xe289('0xa7')]('no\x20sms\x20account\x20configured');}var _0x45314a=this['getSmsAccount'][_0xe289('0xa4')](this,_0x32a999[_0xe289('0x198')]);if(!_0x45314a){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x32a999,_0xe289('0x199'));}var _0x1c25bf={'body':_0x32a999[_0xe289('0x19a')],'phone':_0x32a999['to']||'','SmsAccountId':_0x45314a['id']};logger[_0xe289('0xda')](_0xe289('0x19b'),JSON['stringify'](_0x1c25bf));this[_0xe289('0x36')][_0xe289('0xa4')](this,_0x32a999,_0x32a999[_0xe289('0x198')]);this[_0xe289('0x37')]['noop'](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x45314a[_0xe289('0x14')]));this[_0xe289('0x19c')][_0xe289('0xa4')](this,_0x1c25bf);return this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0x19d'));};AGIVertices['prototype'][_0xe289('0x19e')]=function(_0x6dadab){logger['info'](util[_0xe289('0x29')](_0xe289('0x19f'),_0x6dadab[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x6dadab[_0xe289('0xd2')])){return this[_0xe289('0x37')]['error'](_0x6dadab,_0xe289('0x1a0'));}var _0x28e084=this[_0xe289('0x12')][_0xe289('0xa4')](this,_0x6dadab[_0xe289('0xd2')]);if(!_0x28e084){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x6dadab,_0xe289('0xd4'));}return this[_0xe289('0x37')][_0xe289('0x9c')](_0x28e084,_0x6dadab['variable_value']);};AGIVertices[_0xe289('0x16')][_0xe289('0x1a1')]=function(_0xd3d408){logger['info'](util[_0xe289('0x29')](_0xe289('0x1a2'),_0xd3d408[_0xe289('0x39')]));this[_0xe289('0x37')][_0xe289('0xa7')]('START\x20CALLY\x20SQUARE');if(_0xd3d408[_0xe289('0xb8')]===_0xe289('0x1a3')){this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0x1a4'));return this[_0xe289('0x37')][_0xe289('0xb8')]();}return this[_0xe289('0x37')][_0xe289('0xa7')]('Skipped\x20Answer');};AGIVertices[_0xe289('0x16')][_0xe289('0x1a5')]=function(_0x218b83){logger[_0xe289('0x2f')](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x218b83[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x218b83[_0xe289('0x1a6')])){return this['channel'][_0xe289('0x2d')](_0x218b83,_0xe289('0x1a7'));}var _0x77be02=this[_0xe289('0x1a8')]['sync'](this,_0x218b83['project_id']);if(!this[_0xe289('0x83')](_0x77be02)){return this[_0xe289('0x37')]['error'](_0x218b83,util['format'](_0xe289('0x1a9'),_0x218b83[_0xe289('0x1a6')]));}if(_0x77be02===this[_0xe289('0x37')][_0xe289('0x3b')]){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x218b83,_0xe289('0x1aa'));}this[_0xe289('0x36')][_0xe289('0xa4')](this,_0x218b83,_0x77be02);var _0x5dc587=this['channel'][_0xe289('0x58')]('AGI',util[_0xe289('0x29')](_0xe289('0x1ab'),config[_0xe289('0x8')][_0xe289('0x18b')]||_0xe289('0x1ac'),_0x77be02,this[_0xe289('0x37')][_0xe289('0x3b')]));if(_0x5dc587['result']===-0x1){return _0x5dc587;}return this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x160'),_0xe289('0x1ad'),_0x77be02));};AGIVertices[_0xe289('0x16')]['system']=function(_0x1621fb){logger[_0xe289('0x2f')](util['format'](_0xe289('0x1ae'),_0x1621fb[_0xe289('0x39')]));var _0x2d5d51=this[_0xe289('0x57')][_0xe289('0xa4')](this,_0x1621fb[_0xe289('0xb6')]);this[_0xe289('0x36')][_0xe289('0xa4')](this,_0x1621fb,_0x1621fb[_0xe289('0xb6')]);if(this[_0xe289('0x83')](_0x1621fb[_0xe289('0xd2')])){var _0x5a0862=this[_0xe289('0x12')][_0xe289('0xa4')](this,_0x1621fb[_0xe289('0xd2')]);if(_0x5a0862){this[_0xe289('0x37')][_0xe289('0x9c')](_0x5a0862,_0x2d5d51);return this[_0xe289('0x37')][_0xe289('0xa7')](util['format'](_0xe289('0x1af'),_0x1621fb[_0xe289('0xb6')],_0x5a0862));}}return this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x1b0'),_0x1621fb['command']));};AGIVertices[_0xe289('0x16')]['google_cloud_tts']=function(_0x4ddab6){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x1b1'),_0x4ddab6[_0xe289('0x39')]));_0x4ddab6[_0xe289('0x5c')]=_0x4ddab6[_0xe289('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x4ddab6[_0xe289('0x1b2')])){return this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0x1b3'));}if(!this[_0xe289('0x83')](_0x4ddab6[_0xe289('0x5c')])){return this[_0xe289('0x37')][_0xe289('0xa7')](_0xe289('0xa8'));}this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x1b4'),_0x4ddab6[_0xe289('0x5c')]));var _0x1d8fd8=this[_0xe289('0x5b')][_0xe289('0xa4')](this,_0x4ddab6);if(_0x1d8fd8){this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x1b5'),_0x1d8fd8));var _0x121c21=this[_0xe289('0x37')][_0xe289('0xf8')](_0x1d8fd8);try{fs[_0xe289('0x1b6')](_0x1d8fd8+_0xe289('0xf9'));}catch(_0x3ce53d){logger['error'](_0x3ce53d);}return _0x121c21;}return this[_0xe289('0x37')][_0xe289('0x2d')](_0x4ddab6,_0xe289('0x1b7'));};AGIVertices[_0xe289('0x16')][_0xe289('0x1b8')]=function(_0x5b82e2){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x1b9'),_0x5b82e2[_0xe289('0x39')]));_0x5b82e2[_0xe289('0x5c')]=_0x5b82e2[_0xe289('0x5c')][_0xe289('0x5a')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe289('0x83')](_0x5b82e2[_0xe289('0x5c')])){return this[_0xe289('0x37')]['noop'](_0xe289('0xa8'));}this[_0xe289('0x37')][_0xe289('0xa7')](util['format'](_0xe289('0x1ba'),_0x5b82e2[_0xe289('0x5c')]));var _0x490199=this[_0xe289('0x1bb')]['sync'](this,_0x5b82e2);if(_0x490199){this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x1bc'),_0x490199));var _0x36ba9b=this['channel'][_0xe289('0xf8')](_0x490199);try{fs['unlink'](_0x490199+_0xe289('0xf9'));}catch(_0x2adf1a){logger[_0xe289('0x2d')](_0x2adf1a);}return _0x36ba9b;}return this[_0xe289('0x37')][_0xe289('0x2d')](_0x5b82e2,_0xe289('0x1bd'));};AGIVertices['prototype'][_0xe289('0x1be')]=function(_0x1f3209){logger[_0xe289('0x2f')](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x1f3209[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x1f3209['findBy'])){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x1f3209,_0xe289('0x14d'));}logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x14e'),this['channel']['callerid'],_0x1f3209[_0xe289('0x14c')]));var _0x586185=this[_0xe289('0x51')][_0xe289('0xa4')](this,_0x1f3209[_0xe289('0x14c')]);if(_0x586185){logger['info'](util[_0xe289('0x29')](_0xe289('0x14f'),this['channel']['callerid'],_0x1f3209[_0xe289('0x14c')]));this[_0xe289('0x37')][_0xe289('0xa7')](util[_0xe289('0x29')](_0xe289('0x14f'),this[_0xe289('0x37')][_0xe289('0x3c')],_0x1f3209[_0xe289('0x14c')]));return{'code':0xc8,'result':_0xe289('0x1bf')};}else{logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x150'),this[_0xe289('0x37')]['callerid'],_0x1f3209[_0xe289('0x14c')]));this[_0xe289('0x37')][_0xe289('0xa7')](util['format'](_0xe289('0x150'),this[_0xe289('0x37')]['callerid'],_0x1f3209[_0xe289('0x14c')]));return{'code':0xc8,'result':_0xe289('0x151')};}};AGIVertices[_0xe289('0x16')]['voicemail']=function(_0x283fb5){logger[_0xe289('0x2f')](util[_0xe289('0x29')](_0xe289('0x1c0'),_0x283fb5[_0xe289('0x39')]));var _0x3fee81=this[_0xe289('0x37')][_0xe289('0x58')](_0xe289('0x1c1'),[_0x283fb5[_0xe289('0x1c2')],_0x283fb5[_0xe289('0x75')]]);if(_0x3fee81['result']===-0x1){return _0x3fee81;}return this[_0xe289('0x37')][_0xe289('0xa7')](util['format'](_0xe289('0x160'),_0xe289('0x1c1'),_0x283fb5['mailbox']));};AGIVertices[_0xe289('0x16')][_0xe289('0x1c3')]=function(_0x2b9b4a){logger[_0xe289('0x2f')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x2b9b4a[_0xe289('0x39')]));if(!this[_0xe289('0x83')](_0x2b9b4a[_0xe289('0xd2')])){return this['channel'][_0xe289('0x2d')](_0x2b9b4a,'no\x20variable\x20selected');}var _0x35d246=this['getVariable'][_0xe289('0xa4')](this,_0x2b9b4a[_0xe289('0xd2')]);if(!_0x35d246){return this[_0xe289('0x37')][_0xe289('0x2d')](_0x2b9b4a,_0xe289('0xd4'));}var _0x192b5d=this[_0xe289('0x37')][_0xe289('0x12')](_0x35d246);return{'code':0xc8,'result':_0x192b5d[_0xe289('0x9e')]?_0x192b5d[_0xe289('0x9e')]:'-'};};String['prototype'][_0xe289('0x1c4')]=function(_0x34b72e,_0x2e7121){return this[_0xe289('0x9d')](_0x34b72e)['join'](_0x2e7121);};module[_0xe289('0x1c5')]=AGIVertices; \ No newline at end of file +var _0x1b3a=['no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','path','util','shelljs','odbc','moment','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawBody','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunkById','getSound','getSoundById','getSoundPath','save_name','mailRpc','sendMailMessage','getIntervals','IntervalId','interval','map','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','context','extension','priority','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','callback','scheduledAt','toString','callback_priority','getPauseById','agent','agentPause','agentUnpause','agentLogout','internal','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','text','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isArray','length','isString','saveRestApiResult','isPlainObject','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','maxRetry','retry','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','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','sesteknda','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','response','maxdigit','test','hiddendigitsnum','hiddendigitspos','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','ispeechtts','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','AGENT\x20%s\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','toLowerCase','gosub','position','QUEUE','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','\x22%s\x22\x20<%s>','email','bcc','subject','service','host','port','secure','authentication','auth','user','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','getSquareProject','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b3a,0x1db));var _0xa1b3=function(_0x386118,_0x625d3a){_0x386118=_0x386118-0x0;var _0x3b240e=_0x1b3a[_0x386118];return _0x3b240e;};'use strict';var fs=require('fs');var path=require(_0xa1b3('0x0'));var util=require(_0xa1b3('0x1'));var _=require('lodash');var sh=require(_0xa1b3('0x2'));var odbc=require(_0xa1b3('0x3'))();var rs=require('randomstring');var moment=require(_0xa1b3('0x4'));var Mustache=require('mustache');var rp=require(_0xa1b3('0x5'));var logger=require(_0xa1b3('0x6'))(_0xa1b3('0x7'));var config=require(_0xa1b3('0x8'));var scripts=require(_0xa1b3('0x9'));var FILES_PATH=_0xa1b3('0xa');var recursiveMapAttributes=['rawHeaders',_0xa1b3('0xb')];var verticesWithRetry=['menu','getdigits',_0xa1b3('0xc')];var AGIVertices=function(_0x547c3c,_0x9020b0,_0x5c6808){this[_0xa1b3('0xd')]=_0x547c3c;this[_0xa1b3('0xe')]=_0x9020b0;this['mailRpc']=_0x5c6808;};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x10')]=function(_0x1dbdcb,_0x3198df){this[_0xa1b3('0xe')][_0xa1b3('0x11')](_0x1dbdcb)[_0xa1b3('0x12')](function(_0xce6000){_0x3198df(null,_0xce6000?_0xce6000[_0xa1b3('0x13')]:![]);})[_0xa1b3('0x14')](function(_0x1c7b0b){_0x3198df(_0x1c7b0b);});};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x15')]=function(_0x4b7c87,_0x515489){this['rpc'][_0xa1b3('0x16')](_0x4b7c87)[_0xa1b3('0x12')](function(_0x13aa0d){_0x515489(null,_0x13aa0d?_0x13aa0d[_0xa1b3('0x13')]:![]);})[_0xa1b3('0x14')](function(_0x3e02db){_0x515489(_0x3e02db);});};AGIVertices[_0xa1b3('0xf')]['getSquareProject']=function(_0x422aaa,_0x3d5c91){this['rpc']['getSquareProjectById'](_0x422aaa)[_0xa1b3('0x12')](function(_0x1b4799){_0x3d5c91(null,_0x1b4799?_0x1b4799[_0xa1b3('0x13')]:![]);})[_0xa1b3('0x14')](function(_0x1c890f){_0x3d5c91(_0x1c890f);});};AGIVertices['prototype'][_0xa1b3('0x17')]=function(_0xf6d3e0,_0x328116){this['rpc'][_0xa1b3('0x18')](_0xf6d3e0)[_0xa1b3('0x12')](function(_0x2c1f72){_0x328116(null,_0x2c1f72?_0x2c1f72['dsn']:![]);})[_0xa1b3('0x14')](function(_0x29b9f3){_0x328116(_0x29b9f3);});};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x19')]=function(_0x36fe17,_0x163634){this['rpc'][_0xa1b3('0x1a')](_0x36fe17)[_0xa1b3('0x12')](function(_0x44a9ab){_0x163634(null,_0x44a9ab?_0x44a9ab[_0xa1b3('0x13')]:![]);})['catch'](function(_0x384e58){_0x163634(_0x384e58);});};AGIVertices[_0xa1b3('0xf')]['getTrunk']=function(_0xd80813,_0x53ad7a){this[_0xa1b3('0xe')][_0xa1b3('0x1b')](_0xd80813)[_0xa1b3('0x12')](function(_0x35f76a){_0x53ad7a(null,_0x35f76a?_0x35f76a[_0xa1b3('0x13')]:![]);})['catch'](function(_0x3b67aa){_0x53ad7a(_0x3b67aa);});};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x1c')]=function(_0x584937,_0x5dfecd){var _0x1f4990=this;this[_0xa1b3('0xe')][_0xa1b3('0x1d')](_0x584937)[_0xa1b3('0x12')](function(_0x308d01){_0x5dfecd(null,_0x308d01?_0x1f4990[_0xa1b3('0x1e')](_0x308d01[_0xa1b3('0x1f')]):![]);})[_0xa1b3('0x14')](function(_0x425841){_0x5dfecd(_0x425841);});};AGIVertices['prototype']['getMailAccount']=function(_0x117bf6,_0x2e7069){this[_0xa1b3('0xe')]['getMailAccountById'](_0x117bf6)['then'](function(_0x4a4bd8){_0x2e7069(null,_0x4a4bd8?_0x4a4bd8:![]);})['catch'](function(_0x44ec51){_0x2e7069(_0x44ec51);});};AGIVertices[_0xa1b3('0xf')]['sendMailMessage']=function(_0x5ccdb1,_0x1a0adb,_0x50bc3f){this[_0xa1b3('0x20')][_0xa1b3('0x21')](_0x5ccdb1,_0x1a0adb)[_0xa1b3('0x12')](function(){_0x50bc3f(null);})[_0xa1b3('0x14')](function(_0xc7cdfb){_0x50bc3f(_0xc7cdfb);});};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x22')]=function(_0x44dd9b,_0x2477c0){this[_0xa1b3('0xe')]['getIntervalById'](_0x44dd9b)['then'](function(_0x497ae2){if(_0x497ae2){if(_0x497ae2[_0xa1b3('0x23')]){_0x2477c0(null,[_0x497ae2[_0xa1b3('0x24')]]);}else{_0x2477c0(null,_[_0xa1b3('0x25')](_0x497ae2['Intervals'],'interval'));}}else{_0x2477c0(null,![]);}})['catch'](function(_0xf04ed2){_0x2477c0(_0xf04ed2);});};AGIVertices[_0xa1b3('0xf')]['getSoundPath']=function(_0x18f739){return util[_0xa1b3('0x26')](_0xa1b3('0x27'),FILES_PATH,_0x18f739);};AGIVertices['prototype']['getQueryOdbc']=function(_0xfc2eef,_0x5c1b58,_0xc2bad5){odbc[_0xa1b3('0x28')](_0xfc2eef,function(_0x4dde77){if(_0x4dde77){logger[_0xa1b3('0x29')](_0xa1b3('0x2a'),_0x4dde77);_0xc2bad5(_0x4dde77);}else{logger[_0xa1b3('0x2b')](_0xa1b3('0x2c'));odbc['query'](_0x5c1b58,function(_0x36a66c,_0x12df35){if(_0x36a66c){logger[_0xa1b3('0x2b')](_0xa1b3('0x2d'),_0x5c1b58);_0xc2bad5(_0x36a66c);}else{logger[_0xa1b3('0x2b')]('Query\x20executed\x20correctly\x20%s',_0x5c1b58);odbc[_0xa1b3('0x2e')](function(_0x40ca68){if(_0x40ca68){logger[_0xa1b3('0x29')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x40ca68);}_0xc2bad5(null,_0x12df35);});}});}});};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x2f')]=function(_0x4f3104,_0x143eec){this[_0xa1b3('0xe')][_0xa1b3('0x30')](_0x4f3104)[_0xa1b3('0x12')](function(_0x581ce6){_0x143eec(null,_0x581ce6?_0x581ce6:![]);})[_0xa1b3('0x14')](function(_0x1d69e3){_0x143eec(_0x1d69e3);});};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x31')]=function(_0x2b1961,_0xbf8f0){this[_0xa1b3('0xe')][_0xa1b3('0x31')](_0x2b1961)[_0xa1b3('0x12')](function(_0x4c3e37){_0xbf8f0(null,_0x4c3e37);})['catch'](function(_0x5b4494){_0xbf8f0(_0x5b4494);});};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x32')]=function(_0x203dd4,_0x1d9a0d,_0x360f32){this['rpc'][_0xa1b3('0x32')]({'uniqueid':this[_0xa1b3('0xd')][_0xa1b3('0x33')],'node':_0x203dd4[_0xa1b3('0x34')],'application':_0x203dd4[_0xa1b3('0x35')],'data':_0x1d9a0d||null,'project_name':this[_0xa1b3('0xd')]['arg_1'],'callerid':this[_0xa1b3('0xd')][_0xa1b3('0x36')]})[_0xa1b3('0x12')](function(_0x215e7e){if(_0x360f32){_0x360f32(null,_0x215e7e);}})['catch'](function(_0x5907c4){if(_0x360f32){_0x360f32(_0x5907c4);}});};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x37')]=function(_0x565653,_0x2012f8,_0x2f8b41,_0x16ea49){this[_0xa1b3('0xe')]['createSquareRecording']({'uniqueid':this[_0xa1b3('0xd')][_0xa1b3('0x33')],'callerid':this[_0xa1b3('0xd')][_0xa1b3('0x36')],'calleridname':this['channel']['calleridname'],'context':this[_0xa1b3('0xd')][_0xa1b3('0x38')],'extension':this[_0xa1b3('0xd')][_0xa1b3('0x39')],'priority':this[_0xa1b3('0xd')][_0xa1b3('0x3a')],'accountcode':this['channel']['accountcode'],'dnid':this[_0xa1b3('0xd')][_0xa1b3('0x3b')],'projectName':this[_0xa1b3('0xd')][_0xa1b3('0x3c')],'saveName':_0x2012f8,'filename':_0x565653[_0xa1b3('0x3d')]||_0x2012f8,'savePath':_0x2f8b41})[_0xa1b3('0x12')](function(_0x182abc){_0x16ea49(null,_0x182abc);})[_0xa1b3('0x14')](function(_0x2904ec){_0x16ea49(_0x2904ec);});};AGIVertices['prototype'][_0xa1b3('0x3e')]=function(_0x17a7e7,_0x2a8ea1,_0x53dedf,_0x300a59,_0xbd8e8d){this[_0xa1b3('0xe')][_0xa1b3('0x3e')]({'uniqueid':this['channel'][_0xa1b3('0x33')],'body':_0x17a7e7,'direction':_0x2a8ea1,'providerName':_0x53dedf,'providerResponse':_0x300a59})['then'](function(_0x1f643b){if(_0xbd8e8d){_0xbd8e8d(null,_0x1f643b);}})[_0xa1b3('0x14')](function(_0x176627){if(_0xbd8e8d){_0xbd8e8d(_0x176627);}});};AGIVertices[_0xa1b3('0xf')]['createCmContact']=function(_0x5ef5cd,_0x2b6fe8){this['rpc'][_0xa1b3('0x3f')]({'firstName':_[_0xa1b3('0x40')](_0x5ef5cd[_0xa1b3('0x13')])||_[_0xa1b3('0x41')](_0x5ef5cd[_0xa1b3('0x13')])?_0xa1b3('0x42')+Math['random']():_0x5ef5cd[_0xa1b3('0x13')],'lastName':_[_0xa1b3('0x40')](_0x5ef5cd['lastName'])||_[_0xa1b3('0x41')](_0x5ef5cd[_0xa1b3('0x43')])?null:_0x5ef5cd['lastName'],'phone':_0x5ef5cd[_0xa1b3('0x44')],'ListId':_0x5ef5cd[_0xa1b3('0x45')],'scheduledat':_0x5ef5cd['scheduledAt'],'callbackUniqueid':this['channel'][_0xa1b3('0x33')],'tags':_0xa1b3('0x46'),'description':'Callback\x20scheduled\x20at\x20'+_0x5ef5cd[_0xa1b3('0x47')][_0xa1b3('0x48')](),'priority':_0x5ef5cd[_0xa1b3('0x49')]})[_0xa1b3('0x12')](function(_0x242e3f){_0x2b6fe8(null,_0x242e3f);})[_0xa1b3('0x14')](function(_0x2b8988){_0x2b6fe8(_0x2b8988);});};AGIVertices[_0xa1b3('0xf')]['getPause']=function(_0x43b421,_0x282b11){this[_0xa1b3('0xe')][_0xa1b3('0x4a')](_0x43b421)[_0xa1b3('0x12')](function(_0x55d684){_0x282b11(null,_0x55d684?_0x55d684[_0xa1b3('0x13')]:![]);})['catch'](function(_0x52520b){_0x282b11(_0x52520b);});};AGIVertices[_0xa1b3('0xf')]['agentPause']=function(_0x425a87,_0x155c4d,_0x3952f2){var _0x3d7472={'role':_0xa1b3('0x4b')};_0x3d7472[_0x425a87]=this[_0xa1b3('0xd')][_0xa1b3('0x36')];this[_0xa1b3('0xe')][_0xa1b3('0x4c')](_0x3d7472,_0x155c4d,this[_0xa1b3('0xd')][_0xa1b3('0x33')])[_0xa1b3('0x12')](function(_0x13f276){_0x3952f2(null,_[_0xa1b3('0x41')](_0x13f276)?![]:!![]);})[_0xa1b3('0x14')](function(_0x24d100){logger['error'](_0x24d100);_0x3952f2(null,![]);});};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x4d')]=function(_0xa83d70,_0x2d9860){var _0x5babe7={'role':'agent'};_0x5babe7[_0xa83d70]=this[_0xa1b3('0xd')]['callerid'];this['rpc']['agentUnpause'](_0x5babe7)[_0xa1b3('0x12')](function(_0x1cb46c){_0x2d9860(null,_[_0xa1b3('0x41')](_0x1cb46c)?![]:!![]);})['catch'](function(_0x1cac46){logger[_0xa1b3('0x29')](_0x1cac46);_0x2d9860(null,![]);});};AGIVertices['prototype'][_0xa1b3('0x4e')]=function(_0x78661a,_0x5eeec7){var _0xebc2be={'role':_0xa1b3('0x4b')};_0xebc2be[_0x78661a]=this[_0xa1b3('0xd')][_0xa1b3('0x36')];this[_0xa1b3('0xe')][_0xa1b3('0x4e')](_0xebc2be)[_0xa1b3('0x12')](function(_0x5beb46){_0x5eeec7(null,_[_0xa1b3('0x41')](_0x5beb46)?![]:!![]);})[_0xa1b3('0x14')](function(_0x3b4e88){logger[_0xa1b3('0x29')](_0x3b4e88);_0x5eeec7(null,![]);});};AGIVertices[_0xa1b3('0xf')]['agentLogin']=function(_0x3e2c08,_0x5cb5f1){var _0x63e19b={'role':_0xa1b3('0x4b')};_0x63e19b[_0x3e2c08]=this[_0xa1b3('0xd')][_0xa1b3('0x36')];var _0x450222=_0x3e2c08!=_0xa1b3('0x4f')?util['format']('%s/%s@from-sip/n',_0xa1b3('0x50'),this['channel']['callerid']):undefined;this[_0xa1b3('0xe')][_0xa1b3('0x51')](_0x63e19b,_0x450222)['then'](function(_0x29ca57){_0x5cb5f1(null,_[_0xa1b3('0x41')](_0x29ca57)?![]:!![]);})[_0xa1b3('0x14')](function(_0x43092f){logger[_0xa1b3('0x29')](_0x43092f);_0x5cb5f1(null,![]);});};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x52')]=function(_0x2c4aad,_0x1fea52){sh[_0xa1b3('0x53')](_[_0xa1b3('0x54')](_0x2c4aad),function(_0x41d10d,_0x342dea){var _0x34c8b5=_0x342dea[_0xa1b3('0x55')](/(\r\n|\n|\r)/gm,'');_0x1fea52(null,_0x34c8b5);});};AGIVertices['prototype'][_0xa1b3('0x56')]=function(_0x55391b,_0x338e10){scripts[_0xa1b3('0x56')](_0x55391b[_0xa1b3('0x57')],_0x55391b[_0xa1b3('0x58')]||'text',_0x55391b['text'],_0x55391b[_0xa1b3('0x59')]||_0xa1b3('0x5a'),_0x55391b[_0xa1b3('0x5b')]||_0xa1b3('0x5c'),_0x55391b[_0xa1b3('0x5d')]||_0xa1b3('0x5e'))[_0xa1b3('0x12')](function(_0x29a14c){_0x338e10(null,_0x29a14c);})[_0xa1b3('0x14')](function(_0x504661){_0x338e10(_0x504661);});};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x5f')]=function(_0x586286,_0x13853e){scripts[_0xa1b3('0x5f')](_0x586286[_0xa1b3('0x60')],_0x586286[_0xa1b3('0x61')]||'en',0x1)['then'](function(_0x4871cf){_0x13853e(null,_0x4871cf);})['catch'](function(_0x254828){_0x13853e(_0x254828);});};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x62')]=function(_0x158ca0,_0x3e07e1){var _0x1b04f7={'uri':_0x158ca0[_0xa1b3('0x63')],'method':_0x158ca0[_0xa1b3('0x64')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x158ca0[_0xa1b3('0x65')])===_0xa1b3('0x66')&&parseInt(_0x158ca0[_0xa1b3('0x65')])>=0x1?parseInt(_0x158ca0[_0xa1b3('0x65')])*0x3e8:0x5*0x3e8};if(_[_0xa1b3('0x67')]([_0xa1b3('0x68'),_0xa1b3('0x69')],_0x1b04f7[_0xa1b3('0x64')][_0xa1b3('0x6a')]())){try{_0x1b04f7[_0xa1b3('0x6b')]=_0x158ca0[_0xa1b3('0xb')]?JSON['parse'](_0x158ca0['rawBody']):{};}catch(_0x4d40e4){logger[_0xa1b3('0x29')](_0xa1b3('0x6c'),_0x4d40e4);}}try{_0x1b04f7[_0xa1b3('0x6d')]=_0x158ca0[_0xa1b3('0x6e')]?JSON[_0xa1b3('0x6f')](_0x158ca0[_0xa1b3('0x6e')]):{};}catch(_0xd51a04){logger[_0xa1b3('0x29')](_0xa1b3('0x70'),_0xd51a04);}if(_0x158ca0[_0xa1b3('0x71')]){try{var _0x22db8f=require(_0x158ca0[_0xa1b3('0x71')])[_0xa1b3('0x72')](this,_0x1b04f7);_0x1b04f7[_0xa1b3('0x73')]=Mustache['render'](_0x158ca0[_0xa1b3('0x63')],_0x22db8f,{},['$$','$$']);if(_0x1b04f7[_0xa1b3('0x6d')]){_0x1b04f7[_0xa1b3('0x6d')]=JSON[_0xa1b3('0x6f')](Mustache[_0xa1b3('0x74')](JSON[_0xa1b3('0x75')](_0x1b04f7[_0xa1b3('0x6d')]),_0x22db8f,{},['$$','$$']));}if(_0x1b04f7['body']){_0x1b04f7[_0xa1b3('0x6b')]=JSON[_0xa1b3('0x6f')](Mustache['render'](JSON['stringify'](_0x1b04f7[_0xa1b3('0x6b')]),_0x22db8f,{},['$$','$$']));}}catch(_0x3bc264){logger[_0xa1b3('0x29')](_0xa1b3('0x76'),_0x3bc264);}}rp(_0x1b04f7)[_0xa1b3('0x12')](function(_0x166e45){var _0x41e538={'statusCode':_0x166e45[_0xa1b3('0x77')]||0xc8,'statusMessage':_0x166e45[_0xa1b3('0x78')]||'OK','headers':_0x166e45[_0xa1b3('0x6d')]||{},'body':_0x166e45['body']||{}};_0x3e07e1(null,_0x41e538);})[_0xa1b3('0x14')](function(_0x44bb05){var _0x21bfa7={'statusCode':_0x44bb05[_0xa1b3('0x77')]||0x1f4,'statusMessage':_0x44bb05[_0xa1b3('0x79')]||_0xa1b3('0x7a'),'headers':_0x44bb05[_0xa1b3('0x7b')][_0xa1b3('0x6d')]||{},'body':_0x44bb05[_0xa1b3('0x7b')][_0xa1b3('0x6b')]||{}};_0x3e07e1(null,_0x21bfa7);});};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x7c')]=function(_0x1ad432,_0x3500df){scripts[_0xa1b3('0x7c')](this[_0xa1b3('0xd')]['uniqueid'],_0x1ad432[_0xa1b3('0x7d')],_0x1ad432[_0xa1b3('0x60')],_0x1ad432[_0xa1b3('0x7e')]||'en')[_0xa1b3('0x12')](function(_0x9909af){_0x3500df(null,_0x9909af);})['catch'](function(_0x412aca){_0x3500df(_0x412aca);});};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x7f')]=function(_0x1ed137,_0x461555){scripts[_0xa1b3('0x7f')](this[_0xa1b3('0xd')][_0xa1b3('0x33')],_0x1ed137[_0xa1b3('0x80')],_0x1ed137['client_email'],_0x1ed137[_0xa1b3('0x81')],_0x1ed137['text'],_0x1ed137['dialogflowV2_language']||'en')['then'](function(_0x5c3095){_0x461555(null,_0x5c3095);})[_0xa1b3('0x14')](function(_0x7c5a1b){_0x461555(_0x7c5a1b);});};AGIVertices['prototype'][_0xa1b3('0x82')]=function(_0x54c5b6,_0x423719){scripts['sestekNDA'](this['channel'],_0x54c5b6)['then'](function(_0x296c7d){_0x423719(null,_0x296c7d);})['catch'](function(_0x3b14cb){_0x423719(_0x3b14cb);});};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x83')]=function(_0x4f4b38,_0x27762b){scripts['ispeechTTS'](_0x4f4b38[_0xa1b3('0x7d')],_0x4f4b38[_0xa1b3('0x60')],_0x4f4b38[_0xa1b3('0x84')]||_0xa1b3('0x5a'),_0x4f4b38[_0xa1b3('0x85')])['then'](function(_0xff1851){_0x27762b(null,_0xff1851);})[_0xa1b3('0x14')](function(_0x1bc6b0){_0x27762b(_0x1bc6b0);});};AGIVertices[_0xa1b3('0xf')]['ispeechASR']=function(_0x3d6ed1,_0x1eddf5,_0x597f8d){scripts[_0xa1b3('0x86')](_0x1eddf5,_0x3d6ed1[_0xa1b3('0x7d')],_0x3d6ed1[_0xa1b3('0x87')]||_0xa1b3('0x5a'),this[_0xa1b3('0x88')](_0x3d6ed1[_0xa1b3('0x89')])?_0x3d6ed1['model']:undefined)[_0xa1b3('0x12')](function(_0x55fdc4){_0x597f8d(null,_0x55fdc4);})[_0xa1b3('0x14')](function(_0xb7d893){_0x597f8d(_0xb7d893);});};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x8a')]=function(_0x5574d3,_0x4d81c9){scripts[_0xa1b3('0x8a')](_0x5574d3[_0xa1b3('0x8b')],_0x5574d3[_0xa1b3('0x8c')],_0x5574d3[_0xa1b3('0x8d')],_0x5574d3[_0xa1b3('0x8e')]||_0xa1b3('0x8f'),_0x5574d3[_0xa1b3('0x60')],_0x5574d3[_0xa1b3('0x90')]||_0xa1b3('0x60'))[_0xa1b3('0x12')](function(_0x280291){_0x4d81c9(null,_0x280291);})['catch'](function(_0xfdaa5d){_0x4d81c9(_0xfdaa5d);});};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x91')]=function(_0x41af85,_0x12f636){scripts[_0xa1b3('0x91')](this[_0xa1b3('0xd')][_0xa1b3('0x33')],_0x41af85['aws_access_key_id'],_0x41af85[_0xa1b3('0x8c')],_0x41af85['aws_lex_region'],_0x41af85[_0xa1b3('0x60')],_0x41af85[_0xa1b3('0x92')])[_0xa1b3('0x12')](function(_0x53df8b){_0x12f636(null,_0x53df8b);})[_0xa1b3('0x14')](function(_0x3e52a6){_0x12f636(_0x3e52a6);});};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x93')]=function(_0x5c7884,_0x1305bb,_0x1f76ec){scripts[_0xa1b3('0x93')](_0x1305bb,_0x5c7884[_0xa1b3('0x7d')],_0x5c7884[_0xa1b3('0x94')]||_0xa1b3('0x5a'))[_0xa1b3('0x12')](function(_0x371c4e){_0x1f76ec(null,_0x371c4e);})['catch'](function(_0x16811f){_0x1f76ec(_0x16811f);});};AGIVertices['prototype']['tildeASR']=function(_0x422616,_0x20bc35,_0x78b73){scripts[_0xa1b3('0x95')](_0x20bc35,_0x422616[_0xa1b3('0x96')],_0x422616[_0xa1b3('0x97')],_0x422616[_0xa1b3('0x73')])['then'](function(_0x25b076){_0x78b73(null,_0x25b076);})['catch'](function(_0x3d8f2d){_0x78b73(_0x3d8f2d);});};AGIVertices['prototype'][_0xa1b3('0x98')]=function(_0x204045){var _0x2755cf=_['includes'](verticesWithRetry,_0x204045[_0xa1b3('0x35')])?_0x204045:_['clone'](_0x204045);for(var _0x466bbd in _0x2755cf){if(_0x2755cf[_0xa1b3('0x99')](_0x466bbd)){if(_0x2755cf[_0x466bbd]&&_['isString'](_0x2755cf[_0x466bbd])){if(_[_0xa1b3('0x67')](recursiveMapAttributes,_0x466bbd)){_0x2755cf[_0x466bbd]=this[_0xa1b3('0x9a')](_0x2755cf[_0x466bbd]);}else{_0x2755cf[_0x466bbd]=this[_0xa1b3('0x9b')](_0x2755cf[_0x466bbd]);}}}}return _0x2755cf;};AGIVertices[_0xa1b3('0xf')]['recursiveNodeIndex']=function(_0x354c89){for(var _0x3af85a in _0x354c89){if(_0x354c89['hasOwnProperty'](_0x3af85a)){if(_['isPlainObject'](_0x354c89[_0x3af85a])){this[_0xa1b3('0x9c')](_0x354c89[_0x3af85a]);}else if(_[_0xa1b3('0x9d')](_0x354c89[_0x3af85a])){for(var _0x3f0de9=0x0;_0x3f0de9<_0x354c89[_0x3af85a][_0xa1b3('0x9e')];_0x3f0de9++){this[_0xa1b3('0x9c')](_0x354c89[_0x3af85a][_0x3f0de9]);}}else if(_[_0xa1b3('0x9f')](_0x354c89[_0x3af85a])){_0x354c89[_0x3af85a]=this[_0xa1b3('0x9b')](_0x354c89[_0x3af85a]);}}}};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0xa0')]=function(_0x2d8120,_0x52d5b0){for(var _0x36f4e7 in _0x2d8120){if(_0x2d8120[_0xa1b3('0x99')](_0x36f4e7)){if(_[_0xa1b3('0xa1')](_0x2d8120[_0x36f4e7])){if(!_['isEmpty'](_0x2d8120[_0x36f4e7])){this[_0xa1b3('0xa0')](_0x2d8120[_0x36f4e7],util[_0xa1b3('0x26')](_0xa1b3('0xa2'),_0x52d5b0,_0x36f4e7));}}else if(_[_0xa1b3('0x9d')](_0x2d8120[_0x36f4e7])){for(var _0x4e2a40=0x0;_0x4e2a40<_0x2d8120[_0x36f4e7]['length'];_0x4e2a40++){this[_0xa1b3('0xa0')](_0x2d8120[_0x36f4e7][_0x4e2a40],util[_0xa1b3('0x26')](_0xa1b3('0xa2'),_0x52d5b0,_0x36f4e7+'['+_0x4e2a40+']'));}}else{if(!_['isNil'](_0x2d8120[_0x36f4e7])){this[_0xa1b3('0xd')][_0xa1b3('0xa3')](util['format'](_0xa1b3('0xa2'),_0x52d5b0,_0x36f4e7),_0x2d8120[_0x36f4e7]);}}}}};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x9a')]=function(_0x12690b){try{var _0x5d25f8=JSON[_0xa1b3('0x6f')](_0x12690b);this[_0xa1b3('0x9c')](_0x5d25f8);return JSON[_0xa1b3('0x75')](_0x5d25f8);}catch(_0x5ec047){return this[_0xa1b3('0x9b')](_0x12690b);}};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x9b')]=function(_0x15d63d){var _0x197025=_0x15d63d[_0xa1b3('0xa4')]('{');for(var _0x501d31=0x1;_0x501d31<_0x197025['length'];_0x501d31+=0x1){var _0x311310=_0x197025[_0x501d31][_0xa1b3('0xa4')]('}');if(_0x311310[_0xa1b3('0x9e')]>0x1){_0x15d63d=_0x15d63d[_0xa1b3('0xa5')]('{'+_0x311310[0x0]+'}',this[_0xa1b3('0xd')][_0xa1b3('0x10')](_0x311310[0x0])[_0xa1b3('0xa6')]||_0x311310[0x0]);}}if(_0x197025[_0xa1b3('0x9e')]===0x1){return _0x15d63d[_0xa1b3('0x48')]();}return this['replaceAllVariables'](_0x15d63d);};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0xa7')]=function(_0x17774e,_0x2daa00){var _0x1ee7cf=this[_0xa1b3('0xd')][_0xa1b3('0x10')](_0x17774e);if(_0x1ee7cf[_0xa1b3('0xa8')]===-0x1){return _0x1ee7cf;}logger['info'](util[_0xa1b3('0x26')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x2daa00,_0x1ee7cf[_0xa1b3('0xa6')]));return this[_0xa1b3('0xd')][_0xa1b3('0xa3')](_0x2daa00,_0x1ee7cf[_0xa1b3('0xa6')]);};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x88')]=function(_0x51293f){return _0x51293f&&_0x51293f!=='0'&&_0x51293f!=='-1'&&_0x51293f!=='';};AGIVertices['prototype'][_0xa1b3('0xa9')]=function(_0x430f7b){this[_0xa1b3('0x32')]['sync'](this,_0x430f7b,'-');_0x430f7b[_0xa1b3('0xaa')]=_0x430f7b[_0xa1b3('0xa9')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xa1b3('0xf')]['mrcpsynth']=function(_0x5219ea){logger[_0xa1b3('0x2b')](util['format'](_0xa1b3('0xab'),_0x5219ea['label']));if(!this['isConfigured'](_0x5219ea[_0xa1b3('0x60')])){return this[_0xa1b3('0xd')][_0xa1b3('0xac')](_0xa1b3('0xad'));}var _0x36229e='\x22'+_0x5219ea['text']+'\x22';if(this[_0xa1b3('0x88')](_0x5219ea[_0xa1b3('0x7b')])){_0x36229e+=','+_0x5219ea[_0xa1b3('0x7b')];}var _0x3d05ec=this['channel'][_0xa1b3('0x53')](_0xa1b3('0xae'),_0x36229e);if(_0x3d05ec[_0xa1b3('0xa8')]===-0x1){return _0x3d05ec;}return this['channel'][_0xa1b3('0xac')](util['format'](_0xa1b3('0xaf'),_0x36229e));};AGIVertices['prototype'][_0xa1b3('0xb0')]=function(_0x507e97){logger['info'](util[_0xa1b3('0x26')](_0xa1b3('0xb1'),_0x507e97['label']));if(!this['isConfigured'](_0x507e97[_0xa1b3('0xb2')])){return this[_0xa1b3('0xd')][_0xa1b3('0xac')]('no\x20grammar\x20configured');}var _0x34205a=_0x507e97[_0xa1b3('0xb2')];if(this[_0xa1b3('0x88')](_0x507e97[_0xa1b3('0x7b')])){_0x34205a+=','+_0x507e97['options'];}var _0xfaa973=this[_0xa1b3('0xd')][_0xa1b3('0x53')](_0xa1b3('0xb3'),_0x34205a);if(_0xfaa973[_0xa1b3('0xa8')]===-0x1){return _0xfaa973;}var _0x2cfd2c=this[_0xa1b3('0xa7')](_0xa1b3('0xb4'),_0xa1b3('0xb5'));if(_0x2cfd2c[_0xa1b3('0xa8')]===-0x1){return _0x2cfd2c;}var _0x145694=this[_0xa1b3('0xa7')](_0xa1b3('0xb6'),_0xa1b3('0xb7'));if(_0x145694[_0xa1b3('0xa8')]===-0x1){return _0x145694;}var _0x5e1dbc=this[_0xa1b3('0xa7')](_0xa1b3('0xb8'),_0xa1b3('0xb9'));if(_0x5e1dbc['result']===-0x1){return _0x5e1dbc;}return this[_0xa1b3('0xd')][_0xa1b3('0xac')](util[_0xa1b3('0x26')](_0xa1b3('0xba'),_0x34205a));};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x7')]=function(_0x3f7ab3){logger[_0xa1b3('0x2b')](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x3f7ab3['label']));return this[_0xa1b3('0xd')][_0xa1b3('0x7')]([_0x3f7ab3[_0xa1b3('0xbb')],_0x3f7ab3[_0xa1b3('0xbc')]]);};AGIVertices['prototype'][_0xa1b3('0xbd')]=function(_0x16e21c){logger[_0xa1b3('0x2b')](util['format'](_0xa1b3('0xbe'),_0x16e21c['label']));if(this[_0xa1b3('0x88')](_0x16e21c[_0xa1b3('0x65')])){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0xbf'),_0x16e21c[_0xa1b3('0x65')]));var _0x14b00d=this[_0xa1b3('0xd')]['wait'](_0x16e21c['timeout']);if(_0x14b00d[_0xa1b3('0xa8')]===-0x1){return _0x14b00d;}}return this['channel'][_0xa1b3('0xbd')]();};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x46')]=function(_0x1e12ba){logger[_0xa1b3('0x2b')](util['format'](_0xa1b3('0xc0'),_0x1e12ba[_0xa1b3('0x34')]));if(!this['isConfigured'](_0x1e12ba[_0xa1b3('0x45')])){return this[_0xa1b3('0xd')]['error'](_0x1e12ba,_0xa1b3('0xc1'));}_0x1e12ba[_0xa1b3('0x47')]=moment();if(this[_0xa1b3('0x88')](_0x1e12ba[_0xa1b3('0xc2')])){_0x1e12ba[_0xa1b3('0x47')]=moment()[_0xa1b3('0xc3')](_0x1e12ba['delay'],_0xa1b3('0xc4'));}if(!this[_0xa1b3('0x88')](_0x1e12ba[_0xa1b3('0x49')])){_0x1e12ba[_0xa1b3('0x49')]=0x2;}this['createCmContact'][_0xa1b3('0x72')](this,_0x1e12ba);return this[_0xa1b3('0xd')]['noop'](util[_0xa1b3('0x26')](_0xa1b3('0xc5'),_0x1e12ba[_0xa1b3('0x44')],_0x1e12ba[_0xa1b3('0x45')],_0x1e12ba['scheduledAt']));};AGIVertices[_0xa1b3('0xf')]['custom_app']=function(_0x24c7b9){logger['info'](util[_0xa1b3('0x26')](_0xa1b3('0xc6'),_0x24c7b9[_0xa1b3('0x34')]));var _0x5a3603=this[_0xa1b3('0xd')]['exec'](_0x24c7b9[_0xa1b3('0xc7')],_0x24c7b9[_0xa1b3('0x7b')]);if(_0x5a3603[_0xa1b3('0xa8')]===-0x1){return _0x5a3603;}return this[_0xa1b3('0xd')][_0xa1b3('0xac')](util[_0xa1b3('0x26')](_0xa1b3('0xc8'),_0x24c7b9['application'],_0x24c7b9['options']));};AGIVertices['prototype'][_0xa1b3('0xc9')]=function(_0x1b35ee){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x1b35ee[_0xa1b3('0x34')]));if(!this[_0xa1b3('0x88')](_0x1b35ee['text'])){return this[_0xa1b3('0xd')][_0xa1b3('0xac')](_0xa1b3('0xad'));}var _0x3b42e2='\x22'+_0x1b35ee[_0xa1b3('0x60')]+'\x22';if(this[_0xa1b3('0x88')](_0x1b35ee['options'])){_0x3b42e2+=','+_0x1b35ee['options'];}var _0x55849e=this[_0xa1b3('0xd')][_0xa1b3('0x53')](_0xa1b3('0xae'),_0x3b42e2);if(_0x55849e[_0xa1b3('0xa8')]===-0x1){return _0x55849e;}return this['channel'][_0xa1b3('0xac')](util[_0xa1b3('0x26')](_0xa1b3('0xaf'),_0x3b42e2));};AGIVertices['prototype'][_0xa1b3('0xca')]=function(_0x336f44){logger['info'](util[_0xa1b3('0x26')](_0xa1b3('0xcb'),_0x336f44[_0xa1b3('0x34')]));if(!this['isConfigured'](_0x336f44[_0xa1b3('0x60')])){return this[_0xa1b3('0xd')][_0xa1b3('0xac')](_0xa1b3('0xad'));}var _0x4dad32='\x22'+_0x336f44['text']+'\x22';if(this[_0xa1b3('0x88')](_0x336f44[_0xa1b3('0x7b')])){_0x4dad32+=','+_0x336f44[_0xa1b3('0x7b')];}var _0x508042=this['channel'][_0xa1b3('0x53')]('MRCPSynth',_0x4dad32);if(_0x508042['result']===-0x1){return _0x508042;}return this['channel'][_0xa1b3('0xac')](util[_0xa1b3('0x26')](_0xa1b3('0xaf'),_0x4dad32));};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0xcc')]=function(_0x44cf06){logger['info'](util[_0xa1b3('0x26')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x44cf06['label']));if(!this[_0xa1b3('0x88')](_0x44cf06[_0xa1b3('0xb2')])){return this['channel'][_0xa1b3('0xac')](_0xa1b3('0xcd'));}var _0x55670f=_0x44cf06[_0xa1b3('0xb2')];if(this[_0xa1b3('0x88')](_0x44cf06[_0xa1b3('0x7b')])){_0x55670f+=','+_0x44cf06[_0xa1b3('0x7b')];}var _0x31eddf=this[_0xa1b3('0xd')]['exec'](_0xa1b3('0xb3'),_0x55670f);if(_0x31eddf[_0xa1b3('0xa8')]===-0x1){return _0x31eddf;}var _0x55e102=this['getAndSetVariable'](_0xa1b3('0xb4'),_0xa1b3('0xce'));if(_0x55e102[_0xa1b3('0xa8')]===-0x1){return _0x55e102;}var _0x24fadd=this[_0xa1b3('0xa7')](_0xa1b3('0xb6'),_0xa1b3('0xcf'));if(_0x24fadd[_0xa1b3('0xa8')]===-0x1){return _0x24fadd;}var _0x3e0948=this[_0xa1b3('0xa7')](_0xa1b3('0xb8'),_0xa1b3('0xd0'));if(_0x3e0948['result']===-0x1){return _0x3e0948;}return this[_0xa1b3('0xd')]['noop'](util[_0xa1b3('0x26')](_0xa1b3('0xba'),_0x55670f));};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0xd1')]=function(_0x263879){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x263879[_0xa1b3('0x34')]));if(!this[_0xa1b3('0x88')](_0x263879[_0xa1b3('0xb2')])){return this[_0xa1b3('0xd')][_0xa1b3('0xac')](_0xa1b3('0xcd'));}var _0x88508f=_0x263879[_0xa1b3('0xb2')];if(this[_0xa1b3('0x88')](_0x263879[_0xa1b3('0x7b')])){_0x88508f+=','+_0x263879[_0xa1b3('0x7b')];}var _0x5e3866=this[_0xa1b3('0xd')]['exec'](_0xa1b3('0xb3'),_0x88508f);if(_0x5e3866[_0xa1b3('0xa8')]===-0x1){return _0x5e3866;}var _0x7e4ff6=this[_0xa1b3('0xa7')](_0xa1b3('0xb4'),_0xa1b3('0xd2'));if(_0x7e4ff6[_0xa1b3('0xa8')]===-0x1){return _0x7e4ff6;}var _0x536ee7=this[_0xa1b3('0xa7')](_0xa1b3('0xb6'),_0xa1b3('0xd3'));if(_0x536ee7[_0xa1b3('0xa8')]===-0x1){return _0x536ee7;}var _0x4bf9b0=this[_0xa1b3('0xa7')](_0xa1b3('0xb8'),'SESTEK_ASR_INSTANCE');if(_0x4bf9b0[_0xa1b3('0xa8')]===-0x1){return _0x4bf9b0;}return this[_0xa1b3('0xd')]['noop'](util['format'](_0xa1b3('0xba'),_0x88508f));};AGIVertices[_0xa1b3('0xf')]['database']=function(_0x569651){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x569651[_0xa1b3('0x34')]));if(!this[_0xa1b3('0x88')](_0x569651[_0xa1b3('0xd4')])){return this['channel']['error'](_0x569651,_0xa1b3('0xd5'));}var _0x3459f1=this[_0xa1b3('0x17')]['sync'](this,_0x569651[_0xa1b3('0xd4')]);if(!_0x3459f1){return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x569651,_0xa1b3('0xd6'));}if(!this['isConfigured'](_0x569651[_0xa1b3('0xd7')])){return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x569651,_0xa1b3('0xd8'));}var _0x2df3fe=_0x569651[_0xa1b3('0xd7')][_0xa1b3('0x55')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xa1b3('0xac')](util[_0xa1b3('0x26')](_0xa1b3('0xd9'),_0x2df3fe));var _0x2cb477=this[_0xa1b3('0xda')]['sync'](this,_0x3459f1,_0x2df3fe);this[_0xa1b3('0x32')][_0xa1b3('0x72')](this,_0x569651,_0x2df3fe);if(!this[_0xa1b3('0x88')](_0x569651[_0xa1b3('0xdb')])){return this[_0xa1b3('0xd')][_0xa1b3('0xac')](_0xa1b3('0xdc'));}var _0x228502=this['getVariable']['sync'](this,_0x569651[_0xa1b3('0xdb')]);if(!_0x228502){return this[_0xa1b3('0xd')]['error'](_0x569651,_0xa1b3('0xdd'));}var _0x3409c3=this;_0x2cb477[_0xa1b3('0xde')](function(_0x20dbf2,_0x4d22c1){Object[_0xa1b3('0xdf')](_0x20dbf2)['forEach'](function(_0x4fd4fc){_0x3409c3[_0xa1b3('0xd')][_0xa1b3('0xa3')](util[_0xa1b3('0x26')](_0xa1b3('0xe0'),_0x228502,_0x4d22c1,_0x4fd4fc),_0x20dbf2[_0x4fd4fc]);});});this[_0xa1b3('0xd')][_0xa1b3('0xa3')](util[_0xa1b3('0x26')](_0xa1b3('0xe1'),_0x228502),_0x2cb477[_0xa1b3('0x9e')]);return this['channel'][_0xa1b3('0xac')](util[_0xa1b3('0x26')](_0xa1b3('0xe2'),_0x228502));};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0xe3')]=function(_0x2ee25a){logger[_0xa1b3('0xe4')](util[_0xa1b3('0x26')](_0xa1b3('0xe5'),_0x2ee25a[_0xa1b3('0x34')]));if(!this[_0xa1b3('0x88')](_0x2ee25a['sip_id'])){return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x2ee25a,'no\x20user\x20selected');}var _0x3ae326=this[_0xa1b3('0x19')]['sync'](this,_0x2ee25a[_0xa1b3('0xe6')]);if(!_0x3ae326){return this['channel'][_0xa1b3('0x29')](_0x2ee25a,'no\x20user\x20found');}var _0xd4f57c=this['channel'][_0xa1b3('0x53')](_0xa1b3('0xe7'),[util[_0xa1b3('0x26')]('SIP/%s',_0x3ae326),_0x2ee25a['timeout'],_0x2ee25a[_0xa1b3('0xe8')],_0x2ee25a[_0xa1b3('0x63')]]);if(_0xd4f57c[_0xa1b3('0xa8')]===-0x1){return _0xd4f57c;}return this[_0xa1b3('0xd')][_0xa1b3('0xac')](util[_0xa1b3('0x26')](_0xa1b3('0xe9'),'DIAL'));};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0xea')]=function(_0x3baf8b){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0xeb'),_0x3baf8b[_0xa1b3('0x34')]));if(!this[_0xa1b3('0x88')](_0x3baf8b[_0xa1b3('0x7d')])){return this['channel'][_0xa1b3('0xac')](_0xa1b3('0xec'));}if(!this[_0xa1b3('0x88')](_0x3baf8b[_0xa1b3('0x60')])){return this[_0xa1b3('0xd')][_0xa1b3('0xac')]('no\x20text\x20configured');}this[_0xa1b3('0xd')][_0xa1b3('0xed')]=!![];this[_0xa1b3('0x32')](_0x3baf8b);this[_0xa1b3('0x3e')](_0x3baf8b[_0xa1b3('0x60')],'in','','');this[_0xa1b3('0xd')]['noop'](util[_0xa1b3('0x26')](_0xa1b3('0xee'),_0x3baf8b[_0xa1b3('0x60')]));var _0x22f63e=this[_0xa1b3('0x7c')][_0xa1b3('0x72')](this,_0x3baf8b);if(_0x22f63e){for(var _0x1b42a0 in _0x22f63e){if(_0x22f63e[_0xa1b3('0x99')](_0x1b42a0)){this[_0xa1b3('0xd')][_0xa1b3('0xa3')](util[_0xa1b3('0x26')](_0xa1b3('0xef'),_0x1b42a0[_0xa1b3('0x6a')]()),_0x22f63e[_0x1b42a0]);}}this[_0xa1b3('0x3e')](_0x22f63e[_0xa1b3('0xf0')],_0xa1b3('0xf1'),'dialogflow','');return this[_0xa1b3('0xd')][_0xa1b3('0xac')](util[_0xa1b3('0x26')](_0xa1b3('0xf2'),_0x22f63e['speech']));}return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x3baf8b,_0xa1b3('0xf3'));};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0xf4')]=function(_0x5b0c87){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0xf5'),_0x5b0c87[_0xa1b3('0x34')]));if(!this['isConfigured'](_0x5b0c87[_0xa1b3('0x80')])){return this[_0xa1b3('0xd')][_0xa1b3('0xac')](_0xa1b3('0xf6'));}if(!this[_0xa1b3('0x88')](_0x5b0c87[_0xa1b3('0xf7')])){return this[_0xa1b3('0xd')][_0xa1b3('0xac')](_0xa1b3('0xf8'));}if(!this[_0xa1b3('0x88')](_0x5b0c87[_0xa1b3('0x81')])){return this['channel'][_0xa1b3('0xac')](_0xa1b3('0xf9'));}if(!this[_0xa1b3('0x88')](_0x5b0c87[_0xa1b3('0xfa')])){return this[_0xa1b3('0xd')][_0xa1b3('0xac')](_0xa1b3('0xfb'));}if(!this[_0xa1b3('0x88')](_0x5b0c87[_0xa1b3('0x60')])){return this[_0xa1b3('0xd')][_0xa1b3('0xac')]('no\x20text\x20configured');}this[_0xa1b3('0xd')][_0xa1b3('0xed')]=!![];this[_0xa1b3('0x32')](_0x5b0c87);this[_0xa1b3('0x3e')](_0x5b0c87[_0xa1b3('0x60')],'in','','');this['channel']['noop'](util[_0xa1b3('0x26')](_0xa1b3('0xfc'),_0x5b0c87['text']));var _0x5ea554=this[_0xa1b3('0x7f')][_0xa1b3('0x72')](this,_0x5b0c87);if(_0x5ea554){for(var _0x5b7ee3 in _0x5ea554){if(_0x5ea554[_0xa1b3('0x99')](_0x5b7ee3)){if(_0x5b7ee3!==_0xa1b3('0xfd')){this[_0xa1b3('0xd')]['setVariable'](util[_0xa1b3('0x26')](_0xa1b3('0xef'),_0x5b7ee3[_0xa1b3('0x6a')]()),_0x5ea554[_0x5b7ee3]);}}}this[_0xa1b3('0x3e')](_0x5ea554['speech'],_0xa1b3('0xf1'),_0xa1b3('0xf4'),_0x5ea554[_0xa1b3('0xfd')]);return this[_0xa1b3('0xd')][_0xa1b3('0xac')](util[_0xa1b3('0x26')](_0xa1b3('0xfe'),_0x5ea554[_0xa1b3('0xf0')]));}return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x5b0c87,_0xa1b3('0xff'));};AGIVertices[_0xa1b3('0xf')]['sesteknda']=function(_0x132cee){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x132cee[_0xa1b3('0x34')]));if(!this[_0xa1b3('0x88')](_0x132cee[_0xa1b3('0x100')])){return this[_0xa1b3('0xd')][_0xa1b3('0xac')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xa1b3('0x88')](_0x132cee[_0xa1b3('0x101')])){return this['channel'][_0xa1b3('0xac')](_0xa1b3('0x102'));}if(!this[_0xa1b3('0x88')](_0x132cee[_0xa1b3('0x103')])){return this[_0xa1b3('0xd')][_0xa1b3('0xac')](_0xa1b3('0x104'));}if(!this[_0xa1b3('0x88')](_0x132cee[_0xa1b3('0x105')])){return this['channel'][_0xa1b3('0xac')]('no\x20text\x20configured');}this[_0xa1b3('0xd')][_0xa1b3('0xed')]=!![];this[_0xa1b3('0x32')](_0x132cee);this['createSquareMessage'](_0x132cee[_0xa1b3('0x60')],'in','','');this['channel']['noop'](util[_0xa1b3('0x26')]('Trying\x20SestekNDA:\x20%s',_0x132cee[_0xa1b3('0x60')]));var _0x1513c8=this[_0xa1b3('0x82')]['sync'](this,_0x132cee);if(_0x1513c8){for(var _0x5e0db9 in _0x1513c8){if(_0x1513c8[_0xa1b3('0x99')](_0x5e0db9)){this[_0xa1b3('0xd')][_0xa1b3('0xa3')](util[_0xa1b3('0x26')](_0xa1b3('0x106'),_0x5e0db9[_0xa1b3('0x6a')]()),_0x1513c8[_0x5e0db9]);}}this[_0xa1b3('0x3e')](_0x1513c8[_0xa1b3('0xf0')],'out',_0xa1b3('0x107'),'');if(_0x1513c8['audiofile']){this[_0xa1b3('0xd')][_0xa1b3('0xac')](util[_0xa1b3('0x26')](_0xa1b3('0x108'),_0x1513c8['audiofile']));var _0x4d4e4d=this[_0xa1b3('0xd')]['streamFile'](_0x1513c8[_0xa1b3('0x109')]);try{fs[_0xa1b3('0x10a')](_0x1513c8[_0xa1b3('0x109')]+_0xa1b3('0x10b'));}catch(_0x10eb23){logger['error'](_0x10eb23);}return _0x4d4e4d;}else{return this[_0xa1b3('0xd')][_0xa1b3('0xac')](util['format'](_0xa1b3('0x10c'),_0x1513c8[_0xa1b3('0xf0')]));}}return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x132cee,_0xa1b3('0x10d'));};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x10e')]=function(_0x1a7ae8){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')]('Enter\x20in\x20END\x20(%s)\x20block',_0x1a7ae8[_0xa1b3('0x34')]));return this[_0xa1b3('0xd')][_0xa1b3('0xac')](_0xa1b3('0x10e'));};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x10f')]=function(_0x35ccf9){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x110'),_0x35ccf9[_0xa1b3('0x34')]));var _0x1fbf84='';if(_0x35ccf9[_0xa1b3('0x111')]){if(!this[_0xa1b3('0x88')](_0x35ccf9[_0xa1b3('0x111')])){return this['channel'][_0xa1b3('0x29')](_0x35ccf9,'no\x20trunk\x20selected');}else{var _0x34bcb5=parseInt(_0x35ccf9[_0xa1b3('0x111')],0xa);if(isNaN(_0x34bcb5)){_0x1fbf84=_0x35ccf9[_0xa1b3('0x111')];}else{_0x1fbf84=this['getTrunk'][_0xa1b3('0x72')](this,_0x35ccf9[_0xa1b3('0x111')]);if(!_0x1fbf84){return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x35ccf9,_0xa1b3('0x112'));}}}}else if(_0x35ccf9[_0xa1b3('0x113')]){_0x1fbf84=_0x35ccf9[_0xa1b3('0x113')];}else{return this['channel']['error'](_0x35ccf9,_0xa1b3('0x114'));}var _0x34de02=this[_0xa1b3('0xd')][_0xa1b3('0x53')](_0xa1b3('0xe7'),[util[_0xa1b3('0x26')](_0xa1b3('0x115'),_0x1fbf84,_0x35ccf9['phone']),_0x35ccf9[_0xa1b3('0x65')],_0x35ccf9[_0xa1b3('0xe8')],_0x35ccf9[_0xa1b3('0x63')]]);if(_0x34de02[_0xa1b3('0xa8')]===-0x1){return _0x34de02;}return this[_0xa1b3('0xd')][_0xa1b3('0xac')](util[_0xa1b3('0x26')]('Executed\x20command\x20%s',_0xa1b3('0xe7')));};AGIVertices[_0xa1b3('0xf')]['finally']=function(_0x19d1d9){logger['info'](util[_0xa1b3('0x26')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x19d1d9[_0xa1b3('0x34')]));return this[_0xa1b3('0xd')][_0xa1b3('0xac')](_0xa1b3('0x116'));};AGIVertices['prototype'][_0xa1b3('0x117')]=function(_0x1a80be){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x118'),_0x1a80be['label']));if(_0x1a80be[_0xa1b3('0xaa')]===0x0){return this['maxRetry'](_0x1a80be);}_0x1a80be['retry']-=0x1;if(!this['isConfigured'](_0x1a80be[_0xa1b3('0x119')])){return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x1a80be,_0xa1b3('0x11a'));}var _0x3214ec=this[_0xa1b3('0x1c')][_0xa1b3('0x72')](this,_0x1a80be[_0xa1b3('0x119')]);if(!_0x3214ec){return this['channel'][_0xa1b3('0x29')](_0x1a80be,_0xa1b3('0x11b'));}if(!this[_0xa1b3('0x88')](_0x1a80be[_0xa1b3('0xdb')])){return this['channel']['error'](_0xa1b3('0xdc'));}var _0x4118e7=this[_0xa1b3('0xd')]['getData'](_0x3214ec,_0x1a80be[_0xa1b3('0x11c')],_0x1a80be[_0xa1b3('0x11d')]);var _0x466758=_0x4118e7[_0xa1b3('0xa8')]?_0x4118e7[_0xa1b3('0xa8')][_0xa1b3('0x48')]():'';logger[_0xa1b3('0x2b')](_0xa1b3('0x11e'),JSON[_0xa1b3('0x75')](_0x4118e7));if(_0x4118e7[_0xa1b3('0xa8')]===-0x1){this[_0xa1b3('0x32')][_0xa1b3('0x72')](this,_0x1a80be,_0x466758);return _0x4118e7;}else if(_0x4118e7[_0xa1b3('0xa6')]===_0xa1b3('0x65')){_0x4118e7['result']=_0x466758['length']>=parseInt(_0x1a80be['mindigit'])?'x':'i';}else{_0x4118e7[_0xa1b3('0xa8')]=_0x466758['length']>=parseInt(_0x1a80be['mindigit'])&&_0x466758[_0xa1b3('0x9e')]<=parseInt(_0x1a80be[_0xa1b3('0x11d')])?'x':'i';}var _0x2dff26=this[_0xa1b3('0x10')][_0xa1b3('0x72')](this,_0x1a80be[_0xa1b3('0xdb')]);if(!_0x2dff26){return this[_0xa1b3('0xd')]['error'](_0x1a80be,_0xa1b3('0xdd'));}this[_0xa1b3('0xd')][_0xa1b3('0xa3')](_0x2dff26,_0x466758);if(this['isConfigured'](_0x1a80be['hiddendigitsnum'])){var _0x5503cd=parseInt(_0x1a80be[_0xa1b3('0x11f')],0xa);var _0x2d3904=rs['generate']({'charset':'*','length':_0x5503cd});var _0x173c9b=_0x466758[_0xa1b3('0x9e')];if(_0x173c9b>0x0){if(_0x173c9b>_0x5503cd){this[_0xa1b3('0x32')][_0xa1b3('0x72')](this,_0x1a80be,_0x1a80be[_0xa1b3('0x120')]==='first'?_0x2d3904+_0x466758[_0xa1b3('0x121')](_0x5503cd):_0x466758[_0xa1b3('0x121')](0x0,_0x173c9b-_0x5503cd)+_0x2d3904);}else{this['createSquareDetailsReport'][_0xa1b3('0x72')](this,_0x1a80be,rs[_0xa1b3('0x122')]({'charset':'*','length':_0x173c9b}));}}else{this[_0xa1b3('0x32')][_0xa1b3('0x72')](this,_0x1a80be,'');}}else{this[_0xa1b3('0x32')]['sync'](this,_0x1a80be,_0x466758);}return _0x4118e7;};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0xc')]=function(_0x4359b1){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x123'),_0x4359b1['label']));return this[_0xa1b3('0x117')](_0x4359b1);};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x124')]=function(_0x2b269e){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x125'),_0x2b269e[_0xa1b3('0x34')]));this[_0xa1b3('0x32')][_0xa1b3('0x72')](this,_0x2b269e,_0x2b269e[_0xa1b3('0x126')]);return this['channel'][_0xa1b3('0xac')](util[_0xa1b3('0x26')]('GOAL\x20%s',_0x2b269e[_0xa1b3('0x126')]));};AGIVertices['prototype'][_0xa1b3('0x127')]=function(_0x570623){logger['info'](util['format'](_0xa1b3('0x128'),_0x570623[_0xa1b3('0x34')]));if(!this[_0xa1b3('0x88')](_0x570623[_0xa1b3('0x8b')])||!this['isConfigured'](_0x570623['aws_secret_access_key'])){return this[_0xa1b3('0xd')][_0xa1b3('0xac')](_0xa1b3('0x129'));}if(!this[_0xa1b3('0x88')](_0x570623[_0xa1b3('0x60')])){return this[_0xa1b3('0xd')][_0xa1b3('0xac')](_0xa1b3('0xad'));}this[_0xa1b3('0xd')][_0xa1b3('0xac')](util[_0xa1b3('0x26')](_0xa1b3('0x12a'),_0x570623[_0xa1b3('0x60')]));var _0x514833=this['awsPolly']['sync'](this,_0x570623);if(_0x514833){this[_0xa1b3('0xd')][_0xa1b3('0xac')](util[_0xa1b3('0x26')](_0xa1b3('0x12b'),_0x514833));var _0xa0cb55=this[_0xa1b3('0xd')][_0xa1b3('0x12c')](_0x514833);try{fs[_0xa1b3('0x10a')](_0x514833+_0xa1b3('0x10b'));}catch(_0x322271){logger['error'](_0x322271);}return _0xa0cb55;}return this['channel'][_0xa1b3('0x29')](_0x570623,_0xa1b3('0x12d'));};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x12e')]=function(_0x24752f){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x12f'),_0x24752f['label']));if(!this['isConfigured'](_0x24752f[_0xa1b3('0x8b')])||!this[_0xa1b3('0x88')](_0x24752f[_0xa1b3('0x8c')])){return this[_0xa1b3('0xd')][_0xa1b3('0xac')](_0xa1b3('0x129'));}if(!this['isConfigured'](_0x24752f['aws_bot_name'])){return this[_0xa1b3('0xd')]['noop'](_0xa1b3('0x130'));}if(!this[_0xa1b3('0x88')](_0x24752f['text'])){return this[_0xa1b3('0xd')][_0xa1b3('0xac')]('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0xa1b3('0x32')](_0x24752f);this[_0xa1b3('0x3e')](_0x24752f[_0xa1b3('0x60')],'in','','');this['channel'][_0xa1b3('0xac')](util[_0xa1b3('0x26')]('Trying\x20Amazon\x20Lex:\x20%s',_0x24752f['text']));var _0xb0e978=this[_0xa1b3('0x91')][_0xa1b3('0x72')](this,_0x24752f);if(_0xb0e978){for(var _0x5cc1af in _0xb0e978){if(_0xb0e978[_0xa1b3('0x99')](_0x5cc1af)&&_[_0xa1b3('0x9f')](_0xb0e978[_0x5cc1af])){this[_0xa1b3('0xd')][_0xa1b3('0xa3')](util['format'](_0xa1b3('0x131'),_0x5cc1af[_0xa1b3('0x6a')]()),_0xb0e978[_0x5cc1af]);}}if(_[_0xa1b3('0x41')](_0xb0e978[_0xa1b3('0x79')])){return this[_0xa1b3('0xd')][_0xa1b3('0xac')](_0xa1b3('0x132'));}else{this['createSquareMessage'](_0xb0e978[_0xa1b3('0x79')],'out','amazonlex','');return this[_0xa1b3('0xd')][_0xa1b3('0xac')](util[_0xa1b3('0x26')](_0xa1b3('0x133'),_0xb0e978['message']));}}return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x24752f,_0xa1b3('0x134'));};AGIVertices[_0xa1b3('0xf')]['googleasr']=function(_0x52e76c){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x52e76c[_0xa1b3('0x34')],_0x52e76c[_0xa1b3('0x65')]));if(!this[_0xa1b3('0x88')](_0x52e76c['key'])){return this[_0xa1b3('0xd')]['noop'](_0xa1b3('0xec'));}var _0x483e8a='wav';var _0x9956bf=util[_0xa1b3('0x26')](_0xa1b3('0x135'),FILES_PATH,rs[_0xa1b3('0x122')](0x4));var _0x56887d=util[_0xa1b3('0x26')](_0xa1b3('0xa2'),_0x9956bf,_0x483e8a);var _0x40a0b9=!![];if(_0x52e76c[_0xa1b3('0x136')]===_0xa1b3('0x137')){_0x40a0b9=![];}var _0x21d8f7=this[_0xa1b3('0xd')][_0xa1b3('0x138')](_0x9956bf,_0x483e8a,_0x52e76c[_0xa1b3('0x139')],_0x52e76c[_0xa1b3('0x65')],undefined,_0x40a0b9);if(_0x21d8f7[_0xa1b3('0xa8')]!==-0x1){this['channel'][_0xa1b3('0xac')](util['format']('google\x20%s\x20file\x20created',_0x56887d));var _0x2638aa=this['googleASR'][_0xa1b3('0x72')](this,_0x52e76c,_0x56887d);if(_0x2638aa){for(var _0x255b71 in _0x2638aa){if(_0x2638aa[_0xa1b3('0x99')](_0x255b71)){this[_0xa1b3('0xd')]['setVariable'](util['format'](_0xa1b3('0x13a'),_0x255b71[_0xa1b3('0x6a')]()),_0x2638aa[_0x255b71]);}}return this[_0xa1b3('0xd')]['noop'](util[_0xa1b3('0x26')]('GoogleASR\x20Result\x20%s',JSON[_0xa1b3('0x75')](_0x2638aa)));}}return _0x21d8f7;};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x13b')]=function(_0x1ba20f){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x13c'),_0x1ba20f[_0xa1b3('0x34')]));if(!this[_0xa1b3('0x88')](_0x1ba20f[_0xa1b3('0x96')])){return this[_0xa1b3('0xd')][_0xa1b3('0xac')](_0xa1b3('0x13d'));}if(!this[_0xa1b3('0x88')](_0x1ba20f[_0xa1b3('0x97')])){return this[_0xa1b3('0xd')]['noop'](_0xa1b3('0x13e'));}var _0x5026f1=_0xa1b3('0x13f');var _0x193a57=util[_0xa1b3('0x26')](_0xa1b3('0x135'),FILES_PATH,rs[_0xa1b3('0x122')](0x4));var _0x33d431=util[_0xa1b3('0x26')]('%s.%s',_0x193a57,_0x5026f1);var _0x1adba7=!![];if(_0x1ba20f[_0xa1b3('0x136')]===_0xa1b3('0x137')){_0x1adba7=![];}var _0x452fc1=this['channel'][_0xa1b3('0x138')](_0x193a57,_0x5026f1,_0x1ba20f[_0xa1b3('0x139')],_0x1ba20f[_0xa1b3('0x65')],undefined,_0x1adba7);if(_0x452fc1['result']!==-0x1){this[_0xa1b3('0xd')][_0xa1b3('0xac')](util[_0xa1b3('0x26')](_0xa1b3('0x140'),_0x33d431));var _0x51eb99=this[_0xa1b3('0x95')][_0xa1b3('0x72')](this,_0x1ba20f,_0x33d431);if(_0x51eb99){for(var _0x32a4d3 in _0x51eb99){if(_0x51eb99[_0xa1b3('0x99')](_0x32a4d3)){this[_0xa1b3('0xd')]['setVariable'](util[_0xa1b3('0x26')](_0xa1b3('0x141'),_0x32a4d3[_0xa1b3('0x6a')]()),_0x51eb99[_0x32a4d3]);}}return this['channel']['noop'](util[_0xa1b3('0x26')](_0xa1b3('0x142'),JSON['stringify'](_0x51eb99)));}}return _0x452fc1;};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x143')]=function(_0x43b0da){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x144'),_0x43b0da[_0xa1b3('0x34')]));return this[_0xa1b3('0xd')][_0xa1b3('0x145')](_0x43b0da[_0xa1b3('0x38')],_0x43b0da[_0xa1b3('0x39')],_0x43b0da['priority']);};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x146')]=function(_0x5d62f9){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x5d62f9[_0xa1b3('0x34')]));if(!this[_0xa1b3('0x88')](_0x5d62f9[_0xa1b3('0x147')])){return this[_0xa1b3('0xd')]['error'](_0x5d62f9,_0xa1b3('0x148'));}try{var _0x1430b8=eval(_0x5d62f9[_0xa1b3('0x147')])?_0xa1b3('0x149'):'false';this['channel']['noop'](util[_0xa1b3('0x26')](_0xa1b3('0x14a'),_0x5d62f9[_0xa1b3('0x147')],_0x1430b8));return{'code':0xc8,'result':_0x1430b8};}catch(_0x3c0c1c){return{'code':0xc8,'result':_0xa1b3('0x14b')};}};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x14c')]=function(_0x4b364f){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x14d'),_0x4b364f[_0xa1b3('0x34')]));if(!this[_0xa1b3('0x88')](_0x4b364f['interval_id'])){return this[_0xa1b3('0xd')]['error'](_0x4b364f,_0xa1b3('0x14e'));}var _0x3c94db=this[_0xa1b3('0x22')][_0xa1b3('0x72')](this,_0x4b364f[_0xa1b3('0x14f')]);if(!_0x3c94db){return this['channel']['error'](_0x4b364f,_0xa1b3('0x150'));}for(var _0x5f380b=0x0;_0x5f380b<_0x3c94db[_0xa1b3('0x9e')];_0x5f380b+=0x1){var _0x3f4cff=this[_0xa1b3('0xd')][_0xa1b3('0x10')](util['format'](_0xa1b3('0x151'),_0x3c94db[_0x5f380b]));if(_0x3f4cff['result']===-0x1){return _0x3f4cff;}logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x152'),_0x3c94db[_0x5f380b],_0x3f4cff['extra']));if(_0x3f4cff['extra']===_0xa1b3('0x149')){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x152'),_0x3c94db[_0x5f380b],_0xa1b3('0x149')));this[_0xa1b3('0xd')][_0xa1b3('0xac')](util[_0xa1b3('0x26')](_0xa1b3('0x152'),_0x3c94db[_0x5f380b],_0xa1b3('0x149')));return{'code':0xc8,'result':_0xa1b3('0x149')};}else{logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x152'),_0x3c94db[_0x5f380b],_0xa1b3('0x14b')));this[_0xa1b3('0xd')]['noop'](util['format']('IFTIME\x20%s\x20%s',_0x3c94db[_0x5f380b],'false'));}}return{'code':0xc8,'result':_0xa1b3('0x14b')};};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x153')]=function(_0x7872ce){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x154'),_0x7872ce['label']));return this[_0xa1b3('0xd')][_0xa1b3('0x153')]();};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x155')]=function(_0x35007a){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x156'),_0x35007a[_0xa1b3('0x34')]));if(!this['isConfigured'](_0x35007a['key'])){return this[_0xa1b3('0xd')][_0xa1b3('0xac')](_0xa1b3('0xec'));}var _0x6a0c76=_0xa1b3('0x13f');var _0x1afe3c=util[_0xa1b3('0x26')](_0xa1b3('0x135'),FILES_PATH,rs[_0xa1b3('0x122')](0x4));var _0x3da32d=util[_0xa1b3('0x26')](_0xa1b3('0xa2'),_0x1afe3c,_0x6a0c76);var _0x18ab1a=!![];if(_0x35007a[_0xa1b3('0x136')]===_0xa1b3('0x137')){_0x18ab1a=![];}var _0xa2c2fc=this['channel'][_0xa1b3('0x138')](_0x1afe3c,_0x6a0c76,_0x35007a[_0xa1b3('0x139')],_0x35007a[_0xa1b3('0x65')],undefined,_0x18ab1a);if(_0xa2c2fc[_0xa1b3('0xa8')]!==-0x1){this[_0xa1b3('0xd')][_0xa1b3('0xac')](util[_0xa1b3('0x26')]('ispeech\x20%s\x20file\x20created',_0x3da32d));var _0x57da16=this[_0xa1b3('0x86')][_0xa1b3('0x72')](this,_0x35007a,_0x3da32d);if(_0x57da16){for(var _0x12f946 in _0x57da16){if(_0x57da16[_0xa1b3('0x99')](_0x12f946)){this[_0xa1b3('0xd')][_0xa1b3('0xa3')](util['format'](_0xa1b3('0x157'),_0x12f946[_0xa1b3('0x6a')]()),_0x57da16[_0x12f946]);}}return this[_0xa1b3('0xd')][_0xa1b3('0xac')](util['format']('IspeechASR\x20Result\x20%s',JSON[_0xa1b3('0x75')](_0x57da16)));}}return _0xa2c2fc;};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x158')]=function(_0x470035){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x470035[_0xa1b3('0x34')]));if(!this[_0xa1b3('0x88')](_0x470035[_0xa1b3('0x7d')])){return this[_0xa1b3('0xd')]['noop'](_0xa1b3('0xec'));}if(!this[_0xa1b3('0x88')](_0x470035[_0xa1b3('0x60')])){return this[_0xa1b3('0xd')]['noop'](_0xa1b3('0xad'));}this[_0xa1b3('0xd')][_0xa1b3('0xac')](util['format'](_0xa1b3('0x159'),_0x470035[_0xa1b3('0x60')]));var _0x352f0d=this[_0xa1b3('0x83')][_0xa1b3('0x72')](this,_0x470035);if(_0x352f0d){this['channel'][_0xa1b3('0xac')](util[_0xa1b3('0x26')]('ispeech\x20%s\x20file\x20created',_0x352f0d));var _0x2f92d0=this['channel']['streamFile'](_0x352f0d,_0x470035[_0xa1b3('0x139')]);try{fs[_0xa1b3('0x10a')](_0x352f0d+'.wav');}catch(_0x116be5){logger[_0xa1b3('0x29')](_0x116be5);}return _0x2f92d0;}return this['channel']['error'](_0x470035,_0xa1b3('0x15a'));};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x15b')]=function(_0x2ebe8d){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x2ebe8d['label']));if(!this[_0xa1b3('0x88')](_0x2ebe8d[_0xa1b3('0x15c')])){return this['channel'][_0xa1b3('0x29')](_0x2ebe8d,_0xa1b3('0x15d'));}logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x15e'),this[_0xa1b3('0xd')][_0xa1b3('0x36')],_0x2ebe8d[_0xa1b3('0x15c')]));var _0x4d9ed3=this[_0xa1b3('0x51')][_0xa1b3('0x72')](this,_0x2ebe8d['findBy']);if(_0x4d9ed3){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xa1b3('0x36')],_0x2ebe8d[_0xa1b3('0x15c')]));this[_0xa1b3('0xd')]['noop'](util[_0xa1b3('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xa1b3('0x36')],_0x2ebe8d[_0xa1b3('0x15c')]));return{'code':0xc8,'result':_0xa1b3('0x15f')};}else{logger[_0xa1b3('0x2b')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa1b3('0xd')][_0xa1b3('0x36')],_0x2ebe8d[_0xa1b3('0x15c')]));this[_0xa1b3('0xd')][_0xa1b3('0xac')](util[_0xa1b3('0x26')](_0xa1b3('0x160'),this[_0xa1b3('0xd')][_0xa1b3('0x36')],_0x2ebe8d['findBy']));return{'code':0xc8,'result':_0xa1b3('0x161')};}};AGIVertices['prototype'][_0xa1b3('0x162')]=function(_0x207e0f){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x207e0f[_0xa1b3('0x34')]));if(!this[_0xa1b3('0x88')](_0x207e0f[_0xa1b3('0x15c')])){return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x207e0f,_0xa1b3('0x15d'));}logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x15e'),this[_0xa1b3('0xd')][_0xa1b3('0x36')],_0x207e0f['findBy']));var _0x441c04=this[_0xa1b3('0x4e')][_0xa1b3('0x72')](this,_0x207e0f['findBy']);if(_0x441c04){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa1b3('0xd')][_0xa1b3('0x36')],_0x207e0f[_0xa1b3('0x15c')]));this[_0xa1b3('0xd')]['noop'](util[_0xa1b3('0x26')](_0xa1b3('0x163'),this[_0xa1b3('0xd')]['callerid'],_0x207e0f[_0xa1b3('0x15c')]));return{'code':0xc8,'result':_0xa1b3('0x15f')};}else{logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x207e0f['findBy']));this[_0xa1b3('0xd')][_0xa1b3('0xac')](util[_0xa1b3('0x26')](_0xa1b3('0x160'),this[_0xa1b3('0xd')][_0xa1b3('0x36')],_0x207e0f[_0xa1b3('0x15c')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0xa1b3('0x164')]=function(_0x4d2e47){logger['info'](util['format'](_0xa1b3('0x165'),_0x4d2e47[_0xa1b3('0x34')]));if(!this[_0xa1b3('0x88')](_0x4d2e47['operation'])){return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x4d2e47,_0xa1b3('0x166'));}this[_0xa1b3('0xd')]['noop'](util[_0xa1b3('0x26')](_0xa1b3('0x167'),_0x4d2e47[_0xa1b3('0x168')]));var _0x4b7518=eval(_0x4d2e47[_0xa1b3('0x168')]);if(!this['isConfigured'](_0x4d2e47['variable_id'])){return this[_0xa1b3('0xd')][_0xa1b3('0xac')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0xf749a=this['getVariable']['sync'](this,_0x4d2e47['variable_id']);if(!_0xf749a){return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x4d2e47,_0xa1b3('0xdd'));}if(_[_0xa1b3('0x9d')](_0x4b7518)){var _0x560094=this;_0x4b7518[_0xa1b3('0xde')](function(_0x164b05,_0x25d042){_0x560094['channel'][_0xa1b3('0xa3')](util[_0xa1b3('0x26')](_0xa1b3('0x169'),_0xf749a,_0x25d042),_0x164b05);});return this[_0xa1b3('0xd')][_0xa1b3('0xac')](util['format'](_0xa1b3('0x16a'),_0xf749a));}else{return this[_0xa1b3('0xd')][_0xa1b3('0xa3')](_0xf749a,_0x4b7518);}};AGIVertices['prototype']['menu']=function(_0x1be72b){logger[_0xa1b3('0x2b')](util['format'](_0xa1b3('0x16b'),_0x1be72b[_0xa1b3('0x34')]));if(_0x1be72b['retry']===0x0){return this[_0xa1b3('0xa9')](_0x1be72b);}_0x1be72b[_0xa1b3('0xaa')]-=0x1;if(!this[_0xa1b3('0x88')](_0x1be72b[_0xa1b3('0x119')])){return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x1be72b,'no\x20file\x20audio\x20selected');}var _0x5a58e5=this[_0xa1b3('0x1c')][_0xa1b3('0x72')](this,_0x1be72b[_0xa1b3('0x119')]);if(!_0x5a58e5){return this[_0xa1b3('0xd')]['error'](_0x1be72b,_0xa1b3('0x11b'));}var _0x44e629=this['channel'][_0xa1b3('0x16c')](_0x5a58e5,_0x1be72b[_0xa1b3('0x11c')],_0x1be72b[_0xa1b3('0x16d')]);var _0x5003c1=_0x44e629[_0xa1b3('0xa8')];if(_0x44e629[_0xa1b3('0xa8')]===-0x1){this[_0xa1b3('0x32')][_0xa1b3('0x72')](this,_0x1be72b,'-1');return _0x44e629;}else if(_0x44e629[_0xa1b3('0xa6')]===_0xa1b3('0x65')){_0x44e629[_0xa1b3('0xa8')]=_0x44e629[_0xa1b3('0xa8')][_0xa1b3('0x9e')]>0x0?_0x44e629[_0xa1b3('0xa8')]:'t';}else if(_['isEmpty'](_0x44e629[_0xa1b3('0xa8')])){_0x44e629[_0xa1b3('0xa8')]='#';_0x5003c1='#';}if(!this['isConfigured'](_0x1be72b[_0xa1b3('0xdb')])){this[_0xa1b3('0xd')][_0xa1b3('0xac')](_0xa1b3('0xdc'));}else{var _0x2b6998=this[_0xa1b3('0x10')][_0xa1b3('0x72')](this,_0x1be72b[_0xa1b3('0xdb')]);if(!_0x2b6998){return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x1be72b,_0xa1b3('0xdd'));}this['channel'][_0xa1b3('0xa3')](_0x2b6998,_0x5003c1);}this[_0xa1b3('0x32')][_0xa1b3('0x72')](this,_0x1be72b,_0x5003c1);return _0x44e629;};AGIVertices[_0xa1b3('0xf')]['noop']=function(_0x5aaf1e){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x16e'),_0x5aaf1e[_0xa1b3('0x34')]));return this[_0xa1b3('0xd')][_0xa1b3('0xac')](_0x5aaf1e['output']||_0x5aaf1e[_0xa1b3('0x34')]);};AGIVertices['prototype']['pause']=function(_0x12ca65){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x16f'),_0x12ca65[_0xa1b3('0x34')]));if(!this[_0xa1b3('0x88')](_0x12ca65[_0xa1b3('0x15c')])){return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x12ca65,_0xa1b3('0x15d'));}logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x15e'),this['channel']['callerid'],_0x12ca65['findBy']));var _0x563012=this['getPause']['sync'](this,_0x12ca65[_0xa1b3('0x170')]);var _0x21aa92=this['agentPause']['sync'](this,_0x12ca65['findBy'],_0x563012);if(_0x21aa92){logger[_0xa1b3('0x2b')](util['format'](_0xa1b3('0x163'),this[_0xa1b3('0xd')][_0xa1b3('0x36')],_0x12ca65[_0xa1b3('0x15c')]));this[_0xa1b3('0xd')][_0xa1b3('0xac')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xa1b3('0xd')][_0xa1b3('0x36')],_0x12ca65[_0xa1b3('0x15c')]));return{'code':0xc8,'result':_0xa1b3('0x15f')};}else{logger[_0xa1b3('0x2b')](util['format'](_0xa1b3('0x160'),this['channel'][_0xa1b3('0x36')],_0x12ca65[_0xa1b3('0x15c')]));this['channel']['noop'](util[_0xa1b3('0x26')](_0xa1b3('0x163'),this[_0xa1b3('0xd')][_0xa1b3('0x36')],_0x12ca65[_0xa1b3('0x15c')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x171')]=function(_0x310b91){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x172'),_0x310b91[_0xa1b3('0x34')]));if(!this[_0xa1b3('0x88')](_0x310b91['file_id'])){return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x310b91,'no\x20file\x20audio\x20selected');}var _0x20f01c=this['getSound'][_0xa1b3('0x72')](this,_0x310b91['file_id']);if(!_0x20f01c){return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x310b91,_0xa1b3('0x11b'));}var _0x4d3e1e=this['channel']['exec'](_0xa1b3('0x173'),[_0x20f01c,_0x310b91[_0xa1b3('0xe8')]]);if(_0x4d3e1e[_0xa1b3('0xa8')]===-0x1){return _0x4d3e1e;}return this[_0xa1b3('0xd')][_0xa1b3('0xac')](util['format'](_0xa1b3('0xc8'),_0xa1b3('0x173'),_0x20f01c));};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x174')]=function(_0x3be43c){logger[_0xa1b3('0x2b')](util['format'](_0xa1b3('0x175'),_0x3be43c['label']));if(!this['isConfigured'](_0x3be43c['queue_id'])){return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x3be43c,'no\x20queue\x20selected');}var _0x1787ac='';var _0x47db92=parseInt(_0x3be43c[_0xa1b3('0x176')],0xa);if(isNaN(_0x47db92)){_0x1787ac=_0x3be43c[_0xa1b3('0x176')];}else{_0x1787ac=this['getVoiceQueue'][_0xa1b3('0x72')](this,_0x3be43c[_0xa1b3('0x176')]);if(!_0x1787ac){return this['channel'][_0xa1b3('0x29')](_0x3be43c,_0xa1b3('0x177'));}}var _0x55b02c='';if(this[_0xa1b3('0x88')](_0x3be43c[_0xa1b3('0x119')])){var _0x5becab=this['getSound'][_0xa1b3('0x72')](this,_0x3be43c['file_id']);if(_0x5becab){_0x55b02c=_0x5becab;}}this[_0xa1b3('0x32')][_0xa1b3('0x72')](this,_0x3be43c,_0x1787ac);if(_0x3be43c[_0xa1b3('0xe8')]['indexOf']('x')<0x0){_0x3be43c['opts']+='x';}if(_0x3be43c[_0xa1b3('0xe8')][_0xa1b3('0x178')]('X')<0x0){_0x3be43c['opts']+='X';}this[_0xa1b3('0xd')][_0xa1b3('0xa3')]('XMCS-QUEUE',_0x1787ac?_0x1787ac[_0xa1b3('0x179')]():'');var _0x18ff34=this[_0xa1b3('0xd')][_0xa1b3('0x53')]('QUEUE',[_0x1787ac,_0x3be43c[_0xa1b3('0xe8')],_0x3be43c[_0xa1b3('0x63')],_0x55b02c,_0x3be43c[_0xa1b3('0x65')],_0x3be43c[_0xa1b3('0x7')],_0x3be43c['macro'],_0x3be43c[_0xa1b3('0x17a')],'',_0x3be43c[_0xa1b3('0x17b')]]);if(_0x18ff34['result']===-0x1){return _0x18ff34;}return this[_0xa1b3('0xd')][_0xa1b3('0xac')](util['format']('Executed\x20command\x20%s\x20%s',_0xa1b3('0x17c'),_0x1787ac));};AGIVertices[_0xa1b3('0xf')]['record']=function(_0x38780a){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x17d'),_0x38780a[_0xa1b3('0x34')]));var _0x2a8689=_0x38780a['recordingFormat']||_0xa1b3('0x13f');var _0x44dd8a=util[_0xa1b3('0x26')](_0xa1b3('0x17e'),this[_0xa1b3('0xd')][_0xa1b3('0x33')],rs[_0xa1b3('0x122')](0x5));var _0x2cba5c=util['format'](_0xa1b3('0x17f'),FILES_PATH,_0x44dd8a,_0x2a8689);var _0xc7bdf9=util[_0xa1b3('0x26')](_0xa1b3('0x135'),FILES_PATH,_0x44dd8a);this[_0xa1b3('0x37')][_0xa1b3('0x72')](this,_0x38780a,_0x44dd8a,_0x2cba5c);this[_0xa1b3('0xd')]['setVariable']('RECORDING_SAVENAME',_0x44dd8a);logger[_0xa1b3('0x2b')]('Recording\x20%s\x20%s\x20%s\x20%s',_0xc7bdf9,_0x2a8689,_0x38780a[_0xa1b3('0x180')],_0x38780a[_0xa1b3('0x65')]);return this['channel'][_0xa1b3('0x138')](_0xc7bdf9,_0x2a8689,_0x38780a['escape_digits'],_0x38780a[_0xa1b3('0x65')],undefined,!![]);};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x181')]=function(_0x3476c3){logger['info'](util[_0xa1b3('0x26')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x3476c3[_0xa1b3('0x34')]));if(!this[_0xa1b3('0x88')](_0x3476c3[_0xa1b3('0x63')])){return this[_0xa1b3('0xd')]['noop'](_0xa1b3('0x182'));}var _0x3b313d=this[_0xa1b3('0x62')][_0xa1b3('0x72')](this,_0x3476c3);logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x183'),util[_0xa1b3('0x184')](_0x3b313d,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x3476c3[_0xa1b3('0xdb')])){return this[_0xa1b3('0xd')][_0xa1b3('0xac')](_0xa1b3('0x185'));}var _0x51d657=this[_0xa1b3('0x10')][_0xa1b3('0x72')](this,_0x3476c3[_0xa1b3('0xdb')]);if(!_0x51d657){return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x3476c3,_0xa1b3('0xdd'));}this[_0xa1b3('0xd')][_0xa1b3('0xa3')](util['format'](_0xa1b3('0x186'),_0x51d657),_0x3b313d['statusCode']?_0x3b313d[_0xa1b3('0x77')]:'200');this['channel']['setVariable'](util[_0xa1b3('0x26')](_0xa1b3('0x187'),_0x51d657),_0x3b313d[_0xa1b3('0x78')]?_0x3b313d[_0xa1b3('0x78')]:'OK');if(_0x3b313d['body']){try{this[_0xa1b3('0xa0')](_0x3b313d[_0xa1b3('0x6b')],_0x51d657);}catch(_0x1b72b0){logger[_0xa1b3('0x29')](util[_0xa1b3('0x26')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x51d657));}}return this['channel'][_0xa1b3('0xac')](util[_0xa1b3('0x26')](_0xa1b3('0xe2'),_0x51d657));};AGIVertices['prototype']['saydigits']=function(_0x8f205b){logger[_0xa1b3('0x2b')](util['format'](_0xa1b3('0x188'),_0x8f205b[_0xa1b3('0x34')]));return this[_0xa1b3('0xd')]['sayDigits'](_0x8f205b[_0xa1b3('0x189')][_0xa1b3('0x55')](/\s+/g,''),_0x8f205b['escape_digits']);};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x18a')]=function(_0x5a3992){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x18b'),_0x5a3992['label']));return this[_0xa1b3('0xd')]['sayNumber'](_0x5a3992['number'][_0xa1b3('0x55')](/\s+/g,''),_0x5a3992['escape_digits']);};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x18c')]=function(_0x1c8358){logger['info'](util[_0xa1b3('0x26')](_0xa1b3('0x18d'),_0x1c8358['label']));return this[_0xa1b3('0xd')][_0xa1b3('0x18e')](_0x1c8358[_0xa1b3('0x60')],_0x1c8358[_0xa1b3('0x180')]);};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x18f')]=function(_0x3e3b2b){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x190'),_0x3e3b2b['label']));if(!this['isConfigured'](_0x3e3b2b[_0xa1b3('0x191')])){return this['channel'][_0xa1b3('0xac')](_0xa1b3('0x192'));}var _0x3ddfd8=this[_0xa1b3('0x193')][_0xa1b3('0x72')](this,_0x3e3b2b[_0xa1b3('0x191')]);if(!_0x3ddfd8||!_0x3ddfd8[_0xa1b3('0x194')]){return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x3e3b2b,'no\x20mail\x20account\x20found');}var _0x31d0c6={'from':util[_0xa1b3('0x26')](_0xa1b3('0x195'),_0x3ddfd8['name'],_0x3ddfd8[_0xa1b3('0x196')]||_0x3ddfd8['Smtp']['user']),'to':_0x3e3b2b['to']||'','cc':_0x3e3b2b['cc']||'','bcc':_0x3e3b2b[_0xa1b3('0x197')]||'','subject':_0x3e3b2b[_0xa1b3('0x198')],'html':_0x3e3b2b[_0xa1b3('0x60')],'text':_0x3e3b2b[_0xa1b3('0x60')]};var _0x352562={'tls':{'rejectUnauthorized':![]}};if(_0x3ddfd8[_0xa1b3('0x194')][_0xa1b3('0x199')]){_0x352562[_0xa1b3('0x199')]=_0x3ddfd8[_0xa1b3('0x194')][_0xa1b3('0x199')];}else{_0x352562[_0xa1b3('0x19a')]=_0x3ddfd8[_0xa1b3('0x194')]['host'];_0x352562[_0xa1b3('0x19b')]=_0x3ddfd8[_0xa1b3('0x194')][_0xa1b3('0x19b')];_0x352562[_0xa1b3('0x19c')]=_0x3ddfd8['Smtp'][_0xa1b3('0x19c')];}if(_0x3ddfd8['Smtp'][_0xa1b3('0x19d')]){_0x352562[_0xa1b3('0x19e')]={'user':_0x3ddfd8[_0xa1b3('0x194')][_0xa1b3('0x19f')],'pass':_0x3ddfd8[_0xa1b3('0x194')][_0xa1b3('0x1a0')]};}if(this[_0xa1b3('0x88')](_0x3e3b2b[_0xa1b3('0x1a1')])){}logger[_0xa1b3('0xe4')](_0xa1b3('0x1a2'),JSON['stringify'](_0x31d0c6));this['createSquareDetailsReport'][_0xa1b3('0x72')](this,_0x3e3b2b,_0x3e3b2b[_0xa1b3('0x191')]);this[_0xa1b3('0xd')]['noop'](util['format'](_0xa1b3('0x1a3'),_0x3ddfd8[_0xa1b3('0x13')]));this[_0xa1b3('0x21')][_0xa1b3('0x72')](this,_0x352562,_0x31d0c6);return this['channel'][_0xa1b3('0xac')](_0xa1b3('0x1a4'));};AGIVertices[_0xa1b3('0xf')]['sendFax']=function(_0x549704){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x549704[_0xa1b3('0x34')]));return this['channel'][_0xa1b3('0xac')](_0xa1b3('0x1a5'));};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x1a6')]=function(_0x3ec380){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x1a7'),_0x3ec380['label']));if(!this[_0xa1b3('0x88')](_0x3ec380[_0xa1b3('0x1a8')])){return this[_0xa1b3('0xd')][_0xa1b3('0xac')]('no\x20sms\x20account\x20configured');}var _0x41055c=this[_0xa1b3('0x2f')][_0xa1b3('0x72')](this,_0x3ec380[_0xa1b3('0x1a8')]);if(!_0x41055c){return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x3ec380,_0xa1b3('0x1a9'));}var _0xf28ecc={'body':_0x3ec380['sms_text'],'phone':_0x3ec380['to']||'','SmsAccountId':_0x41055c['id']};logger[_0xa1b3('0xe4')]('sendSMS\x20message',JSON['stringify'](_0xf28ecc));this[_0xa1b3('0x32')]['sync'](this,_0x3ec380,_0x3ec380[_0xa1b3('0x1a8')]);this[_0xa1b3('0xd')]['noop'](util[_0xa1b3('0x26')](_0xa1b3('0x1aa'),_0x41055c['name']));this[_0xa1b3('0x31')][_0xa1b3('0x72')](this,_0xf28ecc);return this['channel'][_0xa1b3('0xac')](_0xa1b3('0x1ab'));};AGIVertices[_0xa1b3('0xf')]['set']=function(_0x534a17){logger[_0xa1b3('0x2b')](util['format'](_0xa1b3('0x1ac'),_0x534a17['label']));if(!this['isConfigured'](_0x534a17[_0xa1b3('0xdb')])){return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x534a17,_0xa1b3('0x1ad'));}var _0x19eeea=this[_0xa1b3('0x10')][_0xa1b3('0x72')](this,_0x534a17[_0xa1b3('0xdb')]);if(!_0x19eeea){return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x534a17,'no\x20variable\x20found');}return this[_0xa1b3('0xd')][_0xa1b3('0xa3')](_0x19eeea,_0x534a17['variable_value']);};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x1ae')]=function(_0x2d0421){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x1af'),_0x2d0421[_0xa1b3('0x34')]));this[_0xa1b3('0xd')]['noop'](_0xa1b3('0x1b0'));if(_0x2d0421['answer']==='yes'){this[_0xa1b3('0xd')][_0xa1b3('0xac')]('Answer');return this['channel']['answer']();}return this[_0xa1b3('0xd')][_0xa1b3('0xac')]('Skipped\x20Answer');};AGIVertices['prototype'][_0xa1b3('0x1b1')]=function(_0x3ae6ba){logger['info'](util[_0xa1b3('0x26')](_0xa1b3('0x1b2'),_0x3ae6ba['label']));if(!this[_0xa1b3('0x88')](_0x3ae6ba['project_id'])){return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x3ae6ba,_0xa1b3('0x1b3'));}var _0x10e64c=this[_0xa1b3('0x1b4')][_0xa1b3('0x72')](this,_0x3ae6ba['project_id']);if(!this[_0xa1b3('0x88')](_0x10e64c)){return this['channel'][_0xa1b3('0x29')](_0x3ae6ba,util[_0xa1b3('0x26')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x3ae6ba['project_id']));}if(_0x10e64c===this[_0xa1b3('0xd')][_0xa1b3('0x3c')]){return this[_0xa1b3('0xd')]['error'](_0x3ae6ba,_0xa1b3('0x1b5'));}this[_0xa1b3('0x32')][_0xa1b3('0x72')](this,_0x3ae6ba,_0x10e64c);var _0x101192=this[_0xa1b3('0xd')][_0xa1b3('0x53')](_0xa1b3('0x1b6'),util['format'](_0xa1b3('0x1b7'),config[_0xa1b3('0x7')]['host']||_0xa1b3('0x1b8'),_0x10e64c,this['channel']['arg_1']));if(_0x101192['result']===-0x1){return _0x101192;}return this[_0xa1b3('0xd')][_0xa1b3('0xac')](util['format'](_0xa1b3('0xc8'),_0xa1b3('0x1b6'),_0x10e64c));};AGIVertices['prototype'][_0xa1b3('0x1b9')]=function(_0xbd81b2){logger['info'](util[_0xa1b3('0x26')](_0xa1b3('0x1ba'),_0xbd81b2[_0xa1b3('0x34')]));var _0x2457c5=this[_0xa1b3('0x52')]['sync'](this,_0xbd81b2[_0xa1b3('0xbb')]);this[_0xa1b3('0x32')]['sync'](this,_0xbd81b2,_0xbd81b2['command']);if(this[_0xa1b3('0x88')](_0xbd81b2[_0xa1b3('0xdb')])){var _0x364aa0=this[_0xa1b3('0x10')][_0xa1b3('0x72')](this,_0xbd81b2[_0xa1b3('0xdb')]);if(_0x364aa0){this['channel'][_0xa1b3('0xa3')](_0x364aa0,_0x2457c5);return this[_0xa1b3('0xd')][_0xa1b3('0xac')](util[_0xa1b3('0x26')](_0xa1b3('0x1bb'),_0xbd81b2[_0xa1b3('0xbb')],_0x364aa0));}}return this[_0xa1b3('0xd')][_0xa1b3('0xac')](util['format'](_0xa1b3('0x1bc'),_0xbd81b2[_0xa1b3('0xbb')]));};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x1bd')]=function(_0x2e80c8){logger['info'](util['format'](_0xa1b3('0x1be'),_0x2e80c8['label']));_0x2e80c8[_0xa1b3('0x60')]=_0x2e80c8[_0xa1b3('0x60')][_0xa1b3('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa1b3('0x88')](_0x2e80c8[_0xa1b3('0x57')])){return this[_0xa1b3('0xd')][_0xa1b3('0xac')](_0xa1b3('0x1bf'));}if(!this[_0xa1b3('0x88')](_0x2e80c8[_0xa1b3('0x60')])){return this[_0xa1b3('0xd')][_0xa1b3('0xac')]('no\x20text\x20configured');}this[_0xa1b3('0xd')][_0xa1b3('0xac')](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x2e80c8[_0xa1b3('0x60')]));var _0x210e52=this[_0xa1b3('0x56')]['sync'](this,_0x2e80c8);if(_0x210e52){this[_0xa1b3('0xd')][_0xa1b3('0xac')](util[_0xa1b3('0x26')](_0xa1b3('0x1c0'),_0x210e52));var _0x51de44=this[_0xa1b3('0xd')][_0xa1b3('0x12c')](_0x210e52);try{fs[_0xa1b3('0x10a')](_0x210e52+_0xa1b3('0x10b'));}catch(_0xc3011c){logger['error'](_0xc3011c);}return _0x51de44;}return this['channel']['error'](_0x2e80c8,_0xa1b3('0x1c1'));};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x1c2')]=function(_0x25c199){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x1c3'),_0x25c199[_0xa1b3('0x34')]));_0x25c199[_0xa1b3('0x60')]=_0x25c199[_0xa1b3('0x60')][_0xa1b3('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa1b3('0x88')](_0x25c199['text'])){return this['channel'][_0xa1b3('0xac')](_0xa1b3('0xad'));}this[_0xa1b3('0xd')]['noop'](util[_0xa1b3('0x26')](_0xa1b3('0x1c4'),_0x25c199['text']));var _0x5e4d03=this[_0xa1b3('0x5f')]['sync'](this,_0x25c199);if(_0x5e4d03){this[_0xa1b3('0xd')][_0xa1b3('0xac')](util['format'](_0xa1b3('0x1c5'),_0x5e4d03));var _0x3673bb=this[_0xa1b3('0xd')]['streamFile'](_0x5e4d03);try{fs[_0xa1b3('0x10a')](_0x5e4d03+'.wav');}catch(_0x919c3){logger[_0xa1b3('0x29')](_0x919c3);}return _0x3673bb;}return this[_0xa1b3('0xd')]['error'](_0x25c199,_0xa1b3('0x1c6'));};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x1c7')]=function(_0x582714){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x1c8'),_0x582714[_0xa1b3('0x34')]));if(!this[_0xa1b3('0x88')](_0x582714[_0xa1b3('0x15c')])){return this[_0xa1b3('0xd')]['error'](_0x582714,'no\x20find\x20by\x20configured');}logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x15e'),this[_0xa1b3('0xd')][_0xa1b3('0x36')],_0x582714['findBy']));var _0x2885b0=this[_0xa1b3('0x4d')]['sync'](this,_0x582714['findBy']);if(_0x2885b0){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x163'),this[_0xa1b3('0xd')][_0xa1b3('0x36')],_0x582714[_0xa1b3('0x15c')]));this[_0xa1b3('0xd')][_0xa1b3('0xac')](util[_0xa1b3('0x26')](_0xa1b3('0x163'),this[_0xa1b3('0xd')][_0xa1b3('0x36')],_0x582714[_0xa1b3('0x15c')]));return{'code':0xc8,'result':_0xa1b3('0x15f')};}else{logger['info'](util[_0xa1b3('0x26')](_0xa1b3('0x160'),this[_0xa1b3('0xd')][_0xa1b3('0x36')],_0x582714[_0xa1b3('0x15c')]));this[_0xa1b3('0xd')][_0xa1b3('0xac')](util[_0xa1b3('0x26')](_0xa1b3('0x160'),this[_0xa1b3('0xd')][_0xa1b3('0x36')],_0x582714[_0xa1b3('0x15c')]));return{'code':0xc8,'result':_0xa1b3('0x161')};}};AGIVertices[_0xa1b3('0xf')]['voicemail']=function(_0x20d8f6){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x20d8f6[_0xa1b3('0x34')]));var _0x47effc=this[_0xa1b3('0xd')]['exec']('VOICEMAIL',[_0x20d8f6[_0xa1b3('0x1c9')],_0x20d8f6[_0xa1b3('0x7b')]]);if(_0x47effc[_0xa1b3('0xa8')]===-0x1){return _0x47effc;}return this['channel'][_0xa1b3('0xac')](util[_0xa1b3('0x26')](_0xa1b3('0xc8'),'VOICEMAIL',_0x20d8f6['mailbox']));};AGIVertices[_0xa1b3('0xf')][_0xa1b3('0x1ca')]=function(_0x250919){logger[_0xa1b3('0x2b')](util[_0xa1b3('0x26')](_0xa1b3('0x1cb'),_0x250919[_0xa1b3('0x34')]));if(!this[_0xa1b3('0x88')](_0x250919['variable_id'])){return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x250919,'no\x20variable\x20selected');}var _0x3b8552=this[_0xa1b3('0x10')]['sync'](this,_0x250919['variable_id']);if(!_0x3b8552){return this[_0xa1b3('0xd')][_0xa1b3('0x29')](_0x250919,_0xa1b3('0xdd'));}var _0x2eccc2=this[_0xa1b3('0xd')][_0xa1b3('0x10')](_0x3b8552);return{'code':0xc8,'result':_0x2eccc2[_0xa1b3('0xa6')]?_0x2eccc2['extra']:'-'};};String[_0xa1b3('0xf')][_0xa1b3('0xa5')]=function(_0x53ed4e,_0x2fbf50){return this[_0xa1b3('0xa4')](_0x53ed4e)[_0xa1b3('0x1cc')](_0x2fbf50);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 777e6a9..ba9d75a 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 _0xf3cd=['../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','message','stopAcw','[TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami'];(function(_0x2af026,_0x1c7509){var _0x274528=function(_0x363d85){while(--_0x363d85){_0x2af026['push'](_0x2af026['shift']());}};_0x274528(++_0x1c7509);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x5a1a51,_0x144c79){_0x5a1a51=_0x5a1a51-0x0;var _0x47edd7=_0xf3cd[_0x5a1a51];return _0x47edd7;};'use strict';var util=require(_0xdf3c('0x0'));var _=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var ami=require(_0xdf3c('0x3'));var logger=require(_0xdf3c('0x4'))(_0xdf3c('0x5'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xdf3c('0x6'));function Acw(_0x71b446){this[_0xdf3c('0x7')]=_0x71b446['voiceQueues'];this[_0xdf3c('0x8')]=_0x71b446[_0xdf3c('0x8')];this[_0xdf3c('0x9')]=_0x71b446[_0xdf3c('0x9')];this[_0xdf3c('0xa')]={};ami['on'](_0xdf3c('0xb'),this['syncAgentConnect'][_0xdf3c('0xc')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0xdf3c('0xc')](this));ami['on'](_0xdf3c('0xd'),this['syncHangup'][_0xdf3c('0xc')](this));ami['on'](_0xdf3c('0xe'),this[_0xdf3c('0xf')][_0xdf3c('0xc')](this));ami['on'](_0xdf3c('0x10'),this[_0xdf3c('0x11')][_0xdf3c('0xc')](this));ami['on'](_0xdf3c('0x12'),this['syncBlindTransfer'][_0xdf3c('0xc')](this));ami['on'](_0xdf3c('0x13'),this[_0xdf3c('0x14')][_0xdf3c('0xc')](this));}function getDiff(_0x59e431){var _0x2ae4ad=moment()[_0xdf3c('0x15')](0x0);var _0x13ea5f=moment(_0x59e431)['milliseconds'](0x0);return _0x2ae4ad[_0xdf3c('0x16')](_0x13ea5f,_0xdf3c('0x17'));}Acw[_0xdf3c('0x18')][_0xdf3c('0x19')]=function(_0x21e587){try{var _0x1a7a5a=this;var _0x305ea5=this[_0xdf3c('0xa')][_0x21e587][_0xdf3c('0x1a')];var _0x5d3991=this['channels'][_0x21e587][_0xdf3c('0x1b')];var _0x465e7d=this[_0xdf3c('0x7')][_0x5d3991];var _0x18d4ec=![];var _0x1e2690=_0xdf3c('0x1c');if(_0x465e7d[_0xdf3c('0x1d')]){if(_0x465e7d[_0xdf3c('0x1e')][_0xdf3c('0x1f')]){_0x18d4ec=!![];_0x1e2690=_0x465e7d[_0xdf3c('0x1e')][_0xdf3c('0x1f')];}}ami[_0xdf3c('0x20')]({'action':_0xdf3c('0x21'),'interface':_0x305ea5,'paused':!![],'reason':_0x1e2690})['then'](function(_0x4d620f){if(_0x1a7a5a[_0xdf3c('0x8')][_0x305ea5]){return RpcUser['getAgent'](_0x1a7a5a[_0xdf3c('0x8')][_0x305ea5]['id'])[_0xdf3c('0x22')](function(_0x36552e){if(_0x36552e&&!_0x36552e[_0xdf3c('0x23')]){logger[_0xdf3c('0x24')](_0xdf3c('0x25'),_0x21e587,_0x305ea5,_0x5d3991);var _0x50d8ca=_0x1a7a5a[_0xdf3c('0xa')][_0x21e587][_0xdf3c('0x26')]&&_0x1a7a5a[_0xdf3c('0xa')][_0x21e587][_0xdf3c('0x27')]?_0x1a7a5a[_0xdf3c('0xa')][_0x21e587][_0xdf3c('0x27')]:_0x21e587;return RpcUser[_0xdf3c('0x28')](_0x1a7a5a[_0xdf3c('0x8')][_0x305ea5],_0x1e2690,_0x50d8ca)[_0xdf3c('0x22')](function(_0x1adee4){if(!_0x18d4ec){_0x1a7a5a['timers'][_0x305ea5]={};logger[_0xdf3c('0x24')](_0xdf3c('0x29'),_0x21e587,_0x1a7a5a['voiceQueues'][_0x5d3991][_0xdf3c('0x2a')],_0x305ea5,_0x5d3991);_0x1a7a5a['timers'][_0x305ea5]['timer']=setTimeout(_0x1a7a5a['stopAcw'][_0xdf3c('0xc')](_0x1a7a5a,_0x305ea5),_0x1a7a5a[_0xdf3c('0x7')][_0x5d3991]['acwTimeout']*0x3e8);_0x1a7a5a['timers'][_0x305ea5][_0xdf3c('0x2b')]=moment()[_0xdf3c('0x2c')](_0xdf3c('0x2d'));_0x1a7a5a[_0xdf3c('0x9')][_0x305ea5]['uniqueid']=_0x21e587;_0x1a7a5a[_0xdf3c('0x9')][_0x305ea5][_0xdf3c('0x1b')]=_0x5d3991;_0x1a7a5a['timers'][_0x305ea5]['updateAcw']=function(){var _0x1f1d8a=getDiff(_0x1a7a5a[_0xdf3c('0x9')][_0x305ea5][_0xdf3c('0x2b')]);clearTimeout(_0x1a7a5a['timers'][_0x305ea5][_0xdf3c('0x2e')]);_0x1a7a5a[_0xdf3c('0x9')][_0x305ea5][_0xdf3c('0x2e')]=![];RpcVoiceAgentReport[_0xdf3c('0x2f')]({'acwtime':_0x1f1d8a},_0x1a7a5a['timers'][_0x305ea5][_0xdf3c('0x30')],_0x305ea5)[_0xdf3c('0x22')](function(_0x522e5f){logger[_0xdf3c('0x24')](_0xdf3c('0x31'),_0x21e587,_0x1f1d8a,_0x522e5f);})[_0xdf3c('0x32')](function(_0x2287f){logger['error'](_0xdf3c('0x33'),_0x21e587,_0x2287f);});delete _0x1a7a5a[_0xdf3c('0x9')][_0x305ea5];};}});}else{logger[_0xdf3c('0x24')](_0xdf3c('0x34'),_0x21e587,_0x305ea5,_0x5d3991);}});}})['catch'](function(_0x474564){logger[_0xdf3c('0x35')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x21e587,_0x1a7a5a['voiceQueues'][_0x5d3991][_0xdf3c('0x2a')],_0x305ea5,_0x5d3991);})['finally'](function(){delete _0x1a7a5a[_0xdf3c('0xa')][_0x21e587];});}catch(_0x5e8130){logger['error']('[ACW][START]\x20%s',_0x5e8130[_0xdf3c('0x36')]);}};Acw[_0xdf3c('0x18')][_0xdf3c('0x37')]=function(_0x29b5b7){try{var _0x54c25f=this;if(_0x54c25f['timers'][_0x29b5b7]){_0x54c25f[_0xdf3c('0x9')][_0x29b5b7]['timer']=![];var _0x46e40f=_0x54c25f[_0xdf3c('0x9')][_0x29b5b7][_0xdf3c('0x30')];var _0xcdd731=_0x54c25f[_0xdf3c('0x9')][_0x29b5b7][_0xdf3c('0x1b')];var _0x1c7335=_0x54c25f[_0xdf3c('0x7')][_0xcdd731][_0xdf3c('0x2a')];logger['info'](_0xdf3c('0x38'),_0x29b5b7);RpcUser['saveUnpause'](this['agents'][_0x29b5b7]);RpcVoiceAgentReport[_0xdf3c('0x2f')]({'acwtime':_0x1c7335,'agentacw':!![]},_0x46e40f,_0x29b5b7)['then'](function(_0xccce51){logger['info'](_0xdf3c('0x31'),_0x46e40f,_0x1c7335,_0xccce51);})[_0xdf3c('0x32')](function(_0x1c6dee){logger[_0xdf3c('0x35')](_0xdf3c('0x33'),_0x46e40f,_0x1c6dee);});}else{logger[_0xdf3c('0x35')](_0xdf3c('0x39'),_0x29b5b7);if(_0x54c25f[_0xdf3c('0x9')]){logger[_0xdf3c('0x24')](_0xdf3c('0x3a'),JSON[_0xdf3c('0x3b')](_0x54c25f[_0xdf3c('0x9')]));}}}catch(_0x57e0ab){logger['error'](_0xdf3c('0x3c'),_0x57e0ab['message']);}};Acw[_0xdf3c('0x18')][_0xdf3c('0x3d')]=function(_0x46194d){try{if(this[_0xdf3c('0x7')][_0x46194d['queue']]&&(this['voiceQueues'][_0x46194d[_0xdf3c('0x1b')]][_0xdf3c('0x5')]||this[_0xdf3c('0x7')][_0x46194d['queue']][_0xdf3c('0x1d')])){if(this[_0xdf3c('0x8')][_0x46194d[_0xdf3c('0x1a')]]){this[_0xdf3c('0xa')][_0x46194d['uniqueid']]={'queue':_0x46194d[_0xdf3c('0x1b')],'interface':_0x46194d[_0xdf3c('0x1a')],'destlinkedid':_0x46194d[_0xdf3c('0x27')]};}}}catch(_0x3f4d7f){logger[_0xdf3c('0x35')]('[ACW][syncAgentConnect]\x20%s',_0x3f4d7f[_0xdf3c('0x36')]);}};Acw[_0xdf3c('0x18')][_0xdf3c('0x14')]=function(_0x2456cf){try{if(this[_0xdf3c('0x7')][_0x2456cf[_0xdf3c('0x1b')]]&&(this['voiceQueues'][_0x2456cf['queue']][_0xdf3c('0x5')]||this[_0xdf3c('0x7')][_0x2456cf['queue']]['mandatoryDisposition'])){if(this[_0xdf3c('0x8')][_0x2456cf[_0xdf3c('0x1a')]]){this[_0xdf3c('0xa')][_0x2456cf[_0xdf3c('0x30')]]={'queue':_0x2456cf[_0xdf3c('0x1b')],'interface':_0x2456cf[_0xdf3c('0x1a')]};}}}catch(_0x466ea1){logger[_0xdf3c('0x35')](_0xdf3c('0x3e'),_0x466ea1['message']);}};Acw[_0xdf3c('0x18')][_0xdf3c('0x3f')]=function(_0x1c293d){try{if(this[_0xdf3c('0xa')][_0x1c293d[_0xdf3c('0x30')]]&&_[_0xdf3c('0x40')](this[_0xdf3c('0xa')][_0x1c293d['uniqueid']][_0xdf3c('0x26')])){logger['info'](_0xdf3c('0x41'),_0x1c293d['uniqueid']);this[_0xdf3c('0x19')](_0x1c293d[_0xdf3c('0x30')]);}else if(this[_0xdf3c('0xa')][_0x1c293d[_0xdf3c('0x42')]]&&_['isUndefined'](this['channels'][_0x1c293d['linkedid']][_0xdf3c('0x26')])){logger['info'](_0xdf3c('0x43'),_0x1c293d[_0xdf3c('0x42')]);this[_0xdf3c('0x19')](_0x1c293d[_0xdf3c('0x42')]);}}catch(_0x3b17d9){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x3b17d9[_0xdf3c('0x36')]);}};Acw[_0xdf3c('0x18')]['syncHangup']=function(_0x3b215d){try{if(this[_0xdf3c('0xa')][_0x3b215d[_0xdf3c('0x30')]]&&this[_0xdf3c('0xa')][_0x3b215d[_0xdf3c('0x30')]][_0xdf3c('0x26')]){logger[_0xdf3c('0x24')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x3b215d['uniqueid']);this[_0xdf3c('0x19')](_0x3b215d[_0xdf3c('0x30')]);}else if(this[_0xdf3c('0xa')][_0x3b215d[_0xdf3c('0x42')]]&&this[_0xdf3c('0xa')][_0x3b215d[_0xdf3c('0x42')]][_0xdf3c('0x26')]){logger[_0xdf3c('0x24')](_0xdf3c('0x44'),_0x3b215d[_0xdf3c('0x42')]);this[_0xdf3c('0x19')](_0x3b215d['linkedid']);}}catch(_0x1eebcf){logger['error']('[ACW][syncHangup]\x20%s',_0x1eebcf['message']);}};Acw['prototype']['syncAttendedTransfer']=function(_0x1afc6c){try{if(!_[_0xdf3c('0x45')](this['channels'][_0x1afc6c[_0xdf3c('0x46')]])){this[_0xdf3c('0x19')](_0x1afc6c['transfereeuniqueid']);if(this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x47')]]){this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x47')]][_0xdf3c('0x26')]=!![];this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x48')]]=this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x47')]];delete this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x47')]];}}else if(!_['isNil'](this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x48')]])){this[_0xdf3c('0x19')](_0x1afc6c['transfertargetuniqueid']);if(this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x49')]]){this[_0xdf3c('0xa')][_0x1afc6c['origtransfereruniqueid']][_0xdf3c('0x26')]=!![];this[_0xdf3c('0xa')][_0x1afc6c['transfereeuniqueid']]=this[_0xdf3c('0xa')][_0x1afc6c['origtransfereruniqueid']];delete this[_0xdf3c('0xa')][_0x1afc6c[_0xdf3c('0x49')]];}}}catch(_0x163adc){logger[_0xdf3c('0x35')](_0xdf3c('0x4a'),_0x163adc[_0xdf3c('0x36')]);}};Acw[_0xdf3c('0x18')][_0xdf3c('0x4b')]=function(_0x2922d8){try{if(this[_0xdf3c('0xa')][_0x2922d8[_0xdf3c('0x4c')]]){logger[_0xdf3c('0x24')](_0xdf3c('0x4d'),JSON[_0xdf3c('0x3b')](_0x2922d8[_0xdf3c('0x4c')]));this[_0xdf3c('0x19')](_0x2922d8[_0xdf3c('0x4c')]);}else if(this['channels'][_0x2922d8['transfererlinkedid']]){logger[_0xdf3c('0x24')](_0xdf3c('0x4e'),JSON[_0xdf3c('0x3b')](_0x2922d8['transfererlinkedid']));this[_0xdf3c('0x19')](_0x2922d8['transfererlinkedid']);}}catch(_0x574852){logger[_0xdf3c('0x35')](_0xdf3c('0x4f'),_0x574852[_0xdf3c('0x36')]);}};Acw[_0xdf3c('0x18')][_0xdf3c('0xf')]=function(_0x9b7034){try{if(this[_0xdf3c('0x7')][_0x9b7034[_0xdf3c('0x1b')]]&&this[_0xdf3c('0x7')][_0x9b7034[_0xdf3c('0x1b')]][_0xdf3c('0x50')]===_0xdf3c('0x51')){if(this[_0xdf3c('0x8')][_0x9b7034['interface']]){logger[_0xdf3c('0x24')](_0xdf3c('0x52'),_0x9b7034[_0xdf3c('0x30')],_0x9b7034[_0xdf3c('0x1a')],_0x9b7034[_0xdf3c('0x1b')]);return RpcUser['savePause'](this[_0xdf3c('0x8')][_0x9b7034[_0xdf3c('0x1a')]],_0xdf3c('0x53'),_0x9b7034[_0xdf3c('0x30')]);}}}catch(_0x1efa9c){logger[_0xdf3c('0x35')](_0xdf3c('0x54'),_0x1efa9c[_0xdf3c('0x36')]);}};module[_0xdf3c('0x55')]=Acw; \ No newline at end of file +var _0xe14d=['agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','channels','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','Action','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format','uniqueid','updateAcw','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','[ACW][START]\x20%s','message','saveUnpause','update','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','startAcw','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','util','lodash','moment','../ami','acw','../rpc/user','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup'];(function(_0xbcf490,_0x4bab76){var _0x496417=function(_0x3ca2f2){while(--_0x3ca2f2){_0xbcf490['push'](_0xbcf490['shift']());}};_0x496417(++_0x4bab76);}(_0xe14d,0x1ee));var _0xde14=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xe14d[_0x56482c];return _0x5aae7a;};'use strict';var util=require(_0xde14('0x0'));var _=require(_0xde14('0x1'));var moment=require(_0xde14('0x2'));var ami=require(_0xde14('0x3'));var logger=require('../../../config/logger')(_0xde14('0x4'));var RpcUser=require(_0xde14('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x1c3e94){this[_0xde14('0x6')]=_0x1c3e94[_0xde14('0x6')];this[_0xde14('0x7')]=_0x1c3e94[_0xde14('0x7')];this[_0xde14('0x8')]=_0x1c3e94['timers'];this['channels']={};ami['on'](_0xde14('0x9'),this[_0xde14('0xa')][_0xde14('0xb')](this));ami['on'](_0xde14('0xc'),this[_0xde14('0xd')][_0xde14('0xb')](this));ami['on'](_0xde14('0xe'),this[_0xde14('0xf')]['bind'](this));ami['on'](_0xde14('0x10'),this[_0xde14('0x11')][_0xde14('0xb')](this));ami['on'](_0xde14('0x12'),this[_0xde14('0x13')][_0xde14('0xb')](this));ami['on'](_0xde14('0x14'),this[_0xde14('0x15')][_0xde14('0xb')](this));ami['on'](_0xde14('0x16'),this[_0xde14('0x17')][_0xde14('0xb')](this));}function getDiff(_0x3521d4){var _0x281c54=moment()[_0xde14('0x18')](0x0);var _0x54c58b=moment(_0x3521d4)['milliseconds'](0x0);return _0x281c54[_0xde14('0x19')](_0x54c58b,_0xde14('0x1a'));}Acw[_0xde14('0x1b')]['startAcw']=function(_0x16aa55){try{var _0x31adb3=this;var _0x257390=this[_0xde14('0x1c')][_0x16aa55][_0xde14('0x1d')];var _0x1b9d4b=this[_0xde14('0x1c')][_0x16aa55][_0xde14('0x1e')];var _0x3cc317=this[_0xde14('0x6')][_0x1b9d4b];var _0x590a8b=![];var _0x3f5fcf=_0xde14('0x1f');if(_0x3cc317[_0xde14('0x20')]){if(_0x3cc317[_0xde14('0x21')]['name']){_0x590a8b=!![];_0x3f5fcf=_0x3cc317[_0xde14('0x21')]['name'];}}ami[_0xde14('0x22')]({'action':'QueuePause','interface':_0x257390,'paused':!![],'reason':_0x3f5fcf})[_0xde14('0x23')](function(_0x30fcf1){if(_0x31adb3[_0xde14('0x7')][_0x257390]){return RpcUser[_0xde14('0x24')](_0x31adb3[_0xde14('0x7')][_0x257390]['id'])[_0xde14('0x23')](function(_0x40b648){if(_0x40b648&&!_0x40b648[_0xde14('0x25')]){logger[_0xde14('0x26')](_0xde14('0x27'),_0x16aa55,_0x257390,_0x1b9d4b);var _0x475f2f=_0x31adb3[_0xde14('0x1c')][_0x16aa55][_0xde14('0x28')]&&_0x31adb3['channels'][_0x16aa55][_0xde14('0x29')]?_0x31adb3[_0xde14('0x1c')][_0x16aa55][_0xde14('0x29')]:_0x16aa55;return RpcUser[_0xde14('0x2a')](_0x31adb3[_0xde14('0x7')][_0x257390],_0x3f5fcf,_0x475f2f)[_0xde14('0x23')](function(_0x310d75){if(!_0x590a8b){_0x31adb3[_0xde14('0x8')][_0x257390]={};logger[_0xde14('0x26')](_0xde14('0x2b'),_0x16aa55,_0x31adb3['voiceQueues'][_0x1b9d4b][_0xde14('0x2c')],_0x257390,_0x1b9d4b);_0x31adb3[_0xde14('0x8')][_0x257390][_0xde14('0x2d')]=setTimeout(_0x31adb3[_0xde14('0x2e')]['bind'](_0x31adb3,_0x257390),_0x31adb3[_0xde14('0x6')][_0x1b9d4b][_0xde14('0x2c')]*0x3e8);_0x31adb3[_0xde14('0x8')][_0x257390]['lastPauseAt']=moment()[_0xde14('0x2f')]('YYYY-MM-DD\x20HH:mm:ss');_0x31adb3[_0xde14('0x8')][_0x257390][_0xde14('0x30')]=_0x16aa55;_0x31adb3[_0xde14('0x8')][_0x257390][_0xde14('0x1e')]=_0x1b9d4b;_0x31adb3[_0xde14('0x8')][_0x257390][_0xde14('0x31')]=function(){var _0xae9dca=getDiff(_0x31adb3[_0xde14('0x8')][_0x257390]['lastPauseAt']);clearTimeout(_0x31adb3[_0xde14('0x8')][_0x257390][_0xde14('0x2d')]);_0x31adb3['timers'][_0x257390][_0xde14('0x2d')]=![];RpcVoiceAgentReport['update']({'acwtime':_0xae9dca},_0x31adb3[_0xde14('0x8')][_0x257390][_0xde14('0x30')],_0x257390)[_0xde14('0x23')](function(_0x21a916){logger[_0xde14('0x26')]('[%s][UPDATE][ACWTIME:%s]',_0x16aa55,_0xae9dca,_0x21a916);})[_0xde14('0x32')](function(_0x57b98b){logger['error'](_0xde14('0x33'),_0x16aa55,_0x57b98b);});delete _0x31adb3[_0xde14('0x8')][_0x257390];};}});}else{logger[_0xde14('0x26')](_0xde14('0x34'),_0x16aa55,_0x257390,_0x1b9d4b);}});}})[_0xde14('0x32')](function(_0xa41c1e){logger[_0xde14('0x35')](_0xde14('0x2b'),_0x16aa55,_0x31adb3[_0xde14('0x6')][_0x1b9d4b]['acwTimeout'],_0x257390,_0x1b9d4b);})['finally'](function(){delete _0x31adb3[_0xde14('0x1c')][_0x16aa55];});}catch(_0x403007){logger[_0xde14('0x35')](_0xde14('0x36'),_0x403007[_0xde14('0x37')]);}};Acw[_0xde14('0x1b')][_0xde14('0x2e')]=function(_0x2b0bc4){try{var _0x2ac7ba=this;if(_0x2ac7ba['timers'][_0x2b0bc4]){_0x2ac7ba[_0xde14('0x8')][_0x2b0bc4]['timer']=![];var _0x4a363c=_0x2ac7ba['timers'][_0x2b0bc4][_0xde14('0x30')];var _0x258759=_0x2ac7ba[_0xde14('0x8')][_0x2b0bc4][_0xde14('0x1e')];var _0x1228d8=_0x2ac7ba[_0xde14('0x6')][_0x258759][_0xde14('0x2c')];logger[_0xde14('0x26')]('[TIMER][STOP][AGENT:%s]',_0x2b0bc4);RpcUser[_0xde14('0x38')](this[_0xde14('0x7')][_0x2b0bc4]);RpcVoiceAgentReport[_0xde14('0x39')]({'acwtime':_0x1228d8,'agentacw':!![]},_0x4a363c,_0x2b0bc4)[_0xde14('0x23')](function(_0x346566){logger[_0xde14('0x26')](_0xde14('0x3a'),_0x4a363c,_0x1228d8,_0x346566);})[_0xde14('0x32')](function(_0x50db0d){logger[_0xde14('0x35')](_0xde14('0x33'),_0x4a363c,_0x50db0d);});}else{logger[_0xde14('0x35')](_0xde14('0x3b'),_0x2b0bc4);if(_0x2ac7ba['timers']){logger['info'](_0xde14('0x3c'),JSON[_0xde14('0x3d')](_0x2ac7ba[_0xde14('0x8')]));}}}catch(_0x171080){logger[_0xde14('0x35')]('[ACW][STOP]\x20%s',_0x171080[_0xde14('0x37')]);}};Acw[_0xde14('0x1b')][_0xde14('0xa')]=function(_0x595fd5){try{if(this[_0xde14('0x6')][_0x595fd5['queue']]&&(this[_0xde14('0x6')][_0x595fd5['queue']][_0xde14('0x4')]||this[_0xde14('0x6')][_0x595fd5[_0xde14('0x1e')]][_0xde14('0x20')])){if(this[_0xde14('0x7')][_0x595fd5[_0xde14('0x1d')]]){this[_0xde14('0x1c')][_0x595fd5[_0xde14('0x30')]]={'queue':_0x595fd5['queue'],'interface':_0x595fd5[_0xde14('0x1d')],'destlinkedid':_0x595fd5['destlinkedid']};}}}catch(_0x430b22){logger['error'](_0xde14('0x3e'),_0x430b22[_0xde14('0x37')]);}};Acw[_0xde14('0x1b')][_0xde14('0x17')]=function(_0x40e7ae){try{if(this[_0xde14('0x6')][_0x40e7ae[_0xde14('0x1e')]]&&(this[_0xde14('0x6')][_0x40e7ae['queue']][_0xde14('0x4')]||this[_0xde14('0x6')][_0x40e7ae[_0xde14('0x1e')]][_0xde14('0x20')])){if(this['agents'][_0x40e7ae[_0xde14('0x1d')]]){this[_0xde14('0x1c')][_0x40e7ae[_0xde14('0x30')]]={'queue':_0x40e7ae[_0xde14('0x1e')],'interface':_0x40e7ae[_0xde14('0x1d')]};}}}catch(_0x19e12c){logger['error'](_0xde14('0x3f'),_0x19e12c['message']);}};Acw[_0xde14('0x1b')][_0xde14('0xd')]=function(_0x48a677){try{if(this[_0xde14('0x1c')][_0x48a677[_0xde14('0x30')]]&&_[_0xde14('0x40')](this[_0xde14('0x1c')][_0x48a677[_0xde14('0x30')]][_0xde14('0x28')])){logger[_0xde14('0x26')]('[%s][HANGUP:UNIQUEID]',_0x48a677[_0xde14('0x30')]);this['startAcw'](_0x48a677[_0xde14('0x30')]);}else if(this[_0xde14('0x1c')][_0x48a677[_0xde14('0x41')]]&&_[_0xde14('0x40')](this[_0xde14('0x1c')][_0x48a677[_0xde14('0x41')]][_0xde14('0x28')])){logger[_0xde14('0x26')](_0xde14('0x42'),_0x48a677[_0xde14('0x41')]);this['startAcw'](_0x48a677[_0xde14('0x41')]);}}catch(_0x1688c6){logger[_0xde14('0x35')](_0xde14('0x43'),_0x1688c6[_0xde14('0x37')]);}};Acw['prototype'][_0xde14('0xf')]=function(_0x4dc2e3){try{if(this[_0xde14('0x1c')][_0x4dc2e3[_0xde14('0x30')]]&&this[_0xde14('0x1c')][_0x4dc2e3[_0xde14('0x30')]][_0xde14('0x28')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x4dc2e3[_0xde14('0x30')]);this['startAcw'](_0x4dc2e3[_0xde14('0x30')]);}else if(this[_0xde14('0x1c')][_0x4dc2e3[_0xde14('0x41')]]&&this[_0xde14('0x1c')][_0x4dc2e3[_0xde14('0x41')]][_0xde14('0x28')]){logger[_0xde14('0x26')](_0xde14('0x44'),_0x4dc2e3[_0xde14('0x41')]);this['startAcw'](_0x4dc2e3[_0xde14('0x41')]);}}catch(_0x2c972b){logger[_0xde14('0x35')](_0xde14('0x45'),_0x2c972b[_0xde14('0x37')]);}};Acw['prototype'][_0xde14('0x13')]=function(_0x58790d){try{if(!_[_0xde14('0x46')](this[_0xde14('0x1c')][_0x58790d[_0xde14('0x47')]])){this[_0xde14('0x48')](_0x58790d[_0xde14('0x47')]);if(this[_0xde14('0x1c')][_0x58790d[_0xde14('0x49')]]){this[_0xde14('0x1c')][_0x58790d['secondtransfereruniqueid']]['attended']=!![];this['channels'][_0x58790d[_0xde14('0x4a')]]=this['channels'][_0x58790d['secondtransfereruniqueid']];delete this[_0xde14('0x1c')][_0x58790d[_0xde14('0x49')]];}}else if(!_[_0xde14('0x46')](this[_0xde14('0x1c')][_0x58790d[_0xde14('0x4a')]])){this[_0xde14('0x48')](_0x58790d[_0xde14('0x4a')]);if(this[_0xde14('0x1c')][_0x58790d[_0xde14('0x4b')]]){this['channels'][_0x58790d[_0xde14('0x4b')]][_0xde14('0x28')]=!![];this[_0xde14('0x1c')][_0x58790d['transfereeuniqueid']]=this[_0xde14('0x1c')][_0x58790d['origtransfereruniqueid']];delete this[_0xde14('0x1c')][_0x58790d[_0xde14('0x4b')]];}}}catch(_0x40ab83){logger[_0xde14('0x35')](_0xde14('0x4c'),_0x40ab83[_0xde14('0x37')]);}};Acw[_0xde14('0x1b')]['syncBlindTransfer']=function(_0x3a357a){try{if(this[_0xde14('0x1c')][_0x3a357a[_0xde14('0x4d')]]){logger[_0xde14('0x26')](_0xde14('0x4e'),JSON[_0xde14('0x3d')](_0x3a357a[_0xde14('0x4d')]));this['startAcw'](_0x3a357a['transfereruniqueid']);}else if(this[_0xde14('0x1c')][_0x3a357a[_0xde14('0x4f')]]){logger[_0xde14('0x26')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xde14('0x3d')](_0x3a357a[_0xde14('0x4f')]));this[_0xde14('0x48')](_0x3a357a[_0xde14('0x4f')]);}}catch(_0x51e8ca){logger['error'](_0xde14('0x50'),_0x51e8ca[_0xde14('0x37')]);}};Acw[_0xde14('0x1b')][_0xde14('0x11')]=function(_0x136c21){try{if(this[_0xde14('0x6')][_0x136c21[_0xde14('0x1e')]]&&this[_0xde14('0x6')][_0x136c21[_0xde14('0x1e')]][_0xde14('0x51')]===_0xde14('0x52')){if(this[_0xde14('0x7')][_0x136c21[_0xde14('0x1d')]]){logger[_0xde14('0x26')](_0xde14('0x53'),_0x136c21[_0xde14('0x30')],_0x136c21[_0xde14('0x1d')],_0x136c21[_0xde14('0x1e')]);return RpcUser[_0xde14('0x2a')](this[_0xde14('0x7')][_0x136c21[_0xde14('0x1d')]],_0xde14('0x54'),_0x136c21[_0xde14('0x30')]);}}}catch(_0x4809fa){logger[_0xde14('0x35')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x4809fa[_0xde14('0x37')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index f485f02..dd22f06 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 _0x5585=['Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','actionSipShowRegistry','actionQueueSummary','catch','close','moment','util','lodash','../../config/logger','ami','asterisk','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','sipshowregistry','actionSipPeerStatus','sippeerstatus','actionCoreShowChannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','shutdown','info'];(function(_0x713492,_0x33a7fc){var _0x55eab8=function(_0x233a06){while(--_0x233a06){_0x713492['push'](_0x713492['shift']());}};_0x55eab8(++_0x33a7fc);}(_0x5585,0x173));var _0x5558=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5585[_0x13d07a];return _0x5ee0ee;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var moment=require(_0x5558('0x0'));var util=require(_0x5558('0x1'));var _=require(_0x5558('0x2'));var logger=require(_0x5558('0x3'))(_0x5558('0x4'));var config=require('../../config/environment');var ami=new Manager(config[_0x5558('0x5')]['port'],config['asterisk']['ip'],config[_0x5558('0x5')][_0x5558('0x6')],config[_0x5558('0x5')][_0x5558('0x7')],!![]);ami[_0x5558('0x8')]();ami[_0x5558('0x9')]=BPromise[_0x5558('0xa')](ami[_0x5558('0xb')]);function error(_0x2a5329){logger[_0x5558('0xc')](util[_0x5558('0xd')](_0x5558('0xe'),config['asterisk']['username'],config[_0x5558('0x5')]['ip'],config[_0x5558('0x5')][_0x5558('0xf')],util[_0x5558('0x10')](_0x2a5329,![],null)));}function close(){logger[_0x5558('0xc')](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config['asterisk'][_0x5558('0x6')],config['asterisk']['ip'],config[_0x5558('0x5')][_0x5558('0xf')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x5558('0x9')]({'action':_0x5558('0x11')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x5558('0x9')]({'action':'devicestatelist'});};};ami[_0x5558('0x12')]=function(){return function(){return ami[_0x5558('0x9')]({'action':_0x5558('0x13')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami[_0x5558('0x14')]=function(){return function(){return ami[_0x5558('0x9')]({'action':'coreshowchannels'});};};function connect(_0x4077c2){logger['info'](util['format'](_0x5558('0x15'),config[_0x5558('0x5')][_0x5558('0x6')],config['asterisk']['ip'],config[_0x5558('0x5')][_0x5558('0xf')]));ami[_0x5558('0x16')](_0x5558('0xc'),error);ami[_0x5558('0x16')]('close',close);}ami['on']('connect',connect);ami['on'](_0x5558('0x17'),function(_0x201725){logger[_0x5558('0x18')](util[_0x5558('0xd')](_0x5558('0x19'),config[_0x5558('0x5')][_0x5558('0x6')],config[_0x5558('0x5')]['ip'],config[_0x5558('0x5')][_0x5558('0xf')],util[_0x5558('0x10')](_0x201725,![],null)));});ami['on'](_0x5558('0x1a'),function(_0x3f643d){logger['info'](util[_0x5558('0xd')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x5558('0x5')][_0x5558('0x6')],config[_0x5558('0x5')]['ip'],config[_0x5558('0x5')][_0x5558('0xf')]));return BPromise[_0x5558('0x1b')]()[_0x5558('0x1c')](ami[_0x5558('0x1d')]())[_0x5558('0x1c')](ami['actionDeviceStateList']())[_0x5558('0x1c')](ami['actionSipPeerStatus']())[_0x5558('0x1c')](ami[_0x5558('0x1e')]())[_0x5558('0x1c')](ami['actionCoreShowChannels']())[_0x5558('0x1f')](function(_0x122447){console['log'](_0x122447);});});ami[_0x5558('0x16')]('error',error);ami['once'](_0x5558('0x20'),close);module['exports']=ami; \ No newline at end of file +var _0xbec1=['error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','port','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','actionCoreShowChannels','info','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','log','asterisk-manager','moment','util','lodash','../../config/logger','ami','../../config/environment','asterisk','username','password','keepConnected','Action','promisify','action'];(function(_0x2b3a8b,_0x1aab75){var _0x42af3d=function(_0xfc5f44){while(--_0xfc5f44){_0x2b3a8b['push'](_0x2b3a8b['shift']());}};_0x42af3d(++_0x1aab75);}(_0xbec1,0x122));var _0x1bec=function(_0x16e3fd,_0x451368){_0x16e3fd=_0x16e3fd-0x0;var _0x3df2ce=_0xbec1[_0x16e3fd];return _0x3df2ce;};'use strict';var Manager=require(_0x1bec('0x0'));var BPromise=require('bluebird');var moment=require(_0x1bec('0x1'));var util=require(_0x1bec('0x2'));var _=require(_0x1bec('0x3'));var logger=require(_0x1bec('0x4'))(_0x1bec('0x5'));var config=require(_0x1bec('0x6'));var ami=new Manager(config['asterisk']['port'],config[_0x1bec('0x7')]['ip'],config[_0x1bec('0x7')][_0x1bec('0x8')],config[_0x1bec('0x7')][_0x1bec('0x9')],!![]);ami[_0x1bec('0xa')]();ami[_0x1bec('0xb')]=BPromise[_0x1bec('0xc')](ami[_0x1bec('0xd')]);function error(_0x42957d){logger[_0x1bec('0xe')](util[_0x1bec('0xf')](_0x1bec('0x10'),config[_0x1bec('0x7')][_0x1bec('0x8')],config['asterisk']['ip'],config['asterisk']['port'],util[_0x1bec('0x11')](_0x42957d,![],null)));}function close(){logger[_0x1bec('0xe')](util[_0x1bec('0xf')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x1bec('0x7')][_0x1bec('0x8')],config[_0x1bec('0x7')]['ip'],config[_0x1bec('0x7')][_0x1bec('0x12')]));}ami[_0x1bec('0x13')]=function(){return function(){return ami['Action']({'action':_0x1bec('0x14')});};};ami[_0x1bec('0x15')]=function(){return function(){return ami['Action']({'action':_0x1bec('0x16')});};};ami[_0x1bec('0x17')]=function(){return function(){return ami[_0x1bec('0xb')]({'action':_0x1bec('0x18')});};};ami[_0x1bec('0x19')]=function(){return function(){return ami[_0x1bec('0xb')]({'action':'queuesummary'});};};ami[_0x1bec('0x1a')]=function(){return function(){return ami['Action']({'action':'coreshowchannels'});};};function connect(_0x579cda){logger[_0x1bec('0x1b')](util[_0x1bec('0xf')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk'][_0x1bec('0x8')],config['asterisk']['ip'],config[_0x1bec('0x7')][_0x1bec('0x12')]));ami[_0x1bec('0x1c')](_0x1bec('0xe'),error);ami[_0x1bec('0x1c')](_0x1bec('0x1d'),close);}ami['on'](_0x1bec('0x1e'),connect);ami['on']('shutdown',function(_0xff97b2){logger[_0x1bec('0x1b')](util[_0x1bec('0xf')](_0x1bec('0x1f'),config[_0x1bec('0x7')][_0x1bec('0x8')],config[_0x1bec('0x7')]['ip'],config[_0x1bec('0x7')][_0x1bec('0x12')],util[_0x1bec('0x11')](_0xff97b2,![],null)));});ami['on'](_0x1bec('0x20'),function(_0x442312){logger[_0x1bec('0x1b')](util[_0x1bec('0xf')](_0x1bec('0x21'),config[_0x1bec('0x7')][_0x1bec('0x8')],config[_0x1bec('0x7')]['ip'],config[_0x1bec('0x7')][_0x1bec('0x12')]));return BPromise[_0x1bec('0x22')]()[_0x1bec('0x23')](ami['actionSipShowRegistry']())[_0x1bec('0x23')](ami['actionDeviceStateList']())[_0x1bec('0x23')](ami[_0x1bec('0x17')]())[_0x1bec('0x23')](ami[_0x1bec('0x19')]())[_0x1bec('0x23')](ami[_0x1bec('0x1a')]())[_0x1bec('0x24')](function(_0x204e58){console[_0x1bec('0x25')](_0x204e58);});});ami[_0x1bec('0x1c')](_0x1bec('0xe'),error);ami[_0x1bec('0x1c')](_0x1bec('0x1d'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 2cd2225..0ad24b3 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 _0x0305=['http','Request','request','then','debug','memberReport','error','rpc','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','ami','client'];(function(_0x34b51e,_0x1c88fb){var _0x1c3756=function(_0x55a07f){while(--_0x55a07f){_0x34b51e['push'](_0x34b51e['shift']());}};_0x1c3756(++_0x1c88fb);}(_0x0305,0x171));var _0x5030=function(_0x138d06,_0x33edf2){_0x138d06=_0x138d06-0x0;var _0x1a01eb=_0x0305[_0x138d06];return _0x1a01eb;};'use strict';var jayson=require(_0x5030('0x0'));var BPromise=require(_0x5030('0x1'));var logger=require(_0x5030('0x2'))(_0x5030('0x3'));var client=jayson[_0x5030('0x4')][_0x5030('0x5')]({'port':0x2329});client[_0x5030('0x6')]=function(_0x3ec1e0,_0x42f192){return new BPromise(function(_0x527ab4,_0x3e369b){return client[_0x5030('0x7')](_0x3ec1e0,_0x42f192)[_0x5030('0x8')](function(_0x4f359f){logger[_0x5030('0x9')]('rpc',_0x5030('0xa'),_0x3ec1e0,_0x42f192,_0x4f359f);if(_0x4f359f[_0x5030('0xb')]){logger[_0x5030('0xb')](_0x5030('0xc'),'memberReport',_0x3ec1e0,_0x4f359f[_0x5030('0xb')][_0x5030('0xd')],_0x42f192);return _0x3e369b(_0x4f359f[_0x5030('0xb')][_0x5030('0xd')]);}else{return _0x527ab4(_0x4f359f[_0x5030('0xe')]);}})[_0x5030('0xf')](function(_0x1ab29c){logger['error']('rpc',_0x5030('0xa'),_0x3ec1e0,_0x1ab29c,_0x42f192);return _0x3e369b(_0x1ab29c);});});};module[_0x5030('0x10')]=client; \ No newline at end of file +var _0xc9b7=['bluebird','../../config/logger','ami','client','http','request','then','debug','rpc','memberReport','error','message','result','exports','jayson/promise'];(function(_0x179c54,_0xa57fb7){var _0x5b3380=function(_0x557994){while(--_0x557994){_0x179c54['push'](_0x179c54['shift']());}};_0x5b3380(++_0xa57fb7);}(_0xc9b7,0xb3));var _0x7c9b=function(_0x12d79d,_0x3c4f12){_0x12d79d=_0x12d79d-0x0;var _0x5cbe01=_0xc9b7[_0x12d79d];return _0x5cbe01;};'use strict';var jayson=require(_0x7c9b('0x0'));var BPromise=require(_0x7c9b('0x1'));var logger=require(_0x7c9b('0x2'))(_0x7c9b('0x3'));var client=jayson[_0x7c9b('0x4')][_0x7c9b('0x5')]({'port':0x2329});client['Request']=function(_0x218961,_0x116d4c){return new BPromise(function(_0x2d83c5,_0x217351){return client[_0x7c9b('0x6')](_0x218961,_0x116d4c)[_0x7c9b('0x7')](function(_0x54e94e){logger[_0x7c9b('0x8')](_0x7c9b('0x9'),_0x7c9b('0xa'),_0x218961,_0x116d4c,_0x54e94e);if(_0x54e94e[_0x7c9b('0xb')]){logger['error'](_0x7c9b('0x9'),_0x7c9b('0xa'),_0x218961,_0x54e94e[_0x7c9b('0xb')][_0x7c9b('0xc')],_0x116d4c);return _0x217351(_0x54e94e['error'][_0x7c9b('0xc')]);}else{return _0x2d83c5(_0x54e94e[_0x7c9b('0xd')]);}})['catch'](function(_0x52e583){logger[_0x7c9b('0xb')](_0x7c9b('0x9'),_0x7c9b('0xa'),_0x218961,_0x52e583,_0x116d4c);return _0x217351(_0x52e583);});});};module[_0x7c9b('0xe')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 07a33ab..accca20 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8093=['\x22%s\x22\x20<%s>','dialCutDigit','substring','prototype','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum'];(function(_0x2e5ed9,_0x1c8dd3){var _0x5d5cdb=function(_0x48bab8){while(--_0x48bab8){_0x2e5ed9['push'](_0x2e5ed9['shift']());}};_0x5d5cdb(++_0x1c8dd3);}(_0x8093,0xa9));var _0x3809=function(_0x71c2ac,_0x32eb1f){_0x71c2ac=_0x71c2ac-0x0;var _0x47582e=_0x8093[_0x71c2ac];return _0x47582e;};'use strict';var util=require(_0x3809('0x0'));var _=require(_0x3809('0x1'));var moment=require(_0x3809('0x2'));function checkNameSurname(_0xdce24e,_0x315a70,_0x2150f9){var _0x50ee50='';if(!_[_0x3809('0x3')](_0x315a70)&&_0x3809('0x4')===typeof _0x315a70){_0x50ee50+=_0x315a70;}if(!_[_0x3809('0x3')](_0x2150f9)&&_0x3809('0x4')===typeof _0x2150f9){_0x50ee50+='\x20'+_0x2150f9;}if(_0x50ee50!==''){return _0x50ee50;}return _0xdce24e;}function Action(_0x349776,_0x17ab0b,_0x29d5dc){this[_0x3809('0x5')]=_0x349776;this[_0x3809('0x6')]=_0x29d5dc||undefined;this[_0x3809('0x7')]=checkNameSurname(_0x17ab0b[_0x3809('0x8')][_0x3809('0x9')],_0x17ab0b['Contact'][_0x3809('0xa')],_0x17ab0b[_0x3809('0x8')][_0x3809('0xb')]);this[_0x3809('0xc')]=_0x17ab0b['Contact']['phone'];this[_0x3809('0xd')]=_0x349776['name'];this[_0x3809('0xe')]=_0x17ab0b['active']||![];this['type']=_0x349776[_0x3809('0xf')];this[_0x3809('0x10')]=_0x349776[_0x3809('0x10')]||0x3;this['scheduledat']=_0x17ab0b[_0x3809('0x11')];this[_0x3809('0x12')]=_0x17ab0b[_0x3809('0x12')];this['countcongestionretry']=_0x17ab0b['countcongestionretry'];this['countnoanswerretry']=_0x17ab0b[_0x3809('0x13')];this[_0x3809('0x14')]=_0x17ab0b[_0x3809('0x14')];this['countdropretry']=_0x17ab0b[_0x3809('0x15')];this['countabandonedretry']=_0x17ab0b[_0x3809('0x16')];this[_0x3809('0x17')]=_0x17ab0b[_0x3809('0x17')];this[_0x3809('0x18')]=_0x17ab0b[_0x3809('0x18')];this[_0x3809('0x19')]=_0x17ab0b['ContactId'];this['ListId']=_0x17ab0b['ListId'];this['UserId']=_0x17ab0b['UserId'];this['VoiceQueueId']=_0x17ab0b['VoiceQueueId'];this[_0x3809('0x1a')]=_0x17ab0b['CampaignId'];this[_0x3809('0x1b')]=_0x17ab0b['id'];this['ContactFirstName']=_0x17ab0b[_0x3809('0x8')][_0x3809('0xa')]||'';this[_0x3809('0x1c')]=moment()[_0x3809('0x1d')](_0x3809('0x1e'));this['callback']=_0x17ab0b[_0x3809('0x1f')];this[_0x3809('0x20')]=_0x17ab0b[_0x3809('0x20')];this[_0x3809('0x21')]=_0x17ab0b[_0x3809('0x21')];this[_0x3809('0x22')]=_0x17ab0b[_0x3809('0x22')];this[_0x3809('0x23')]='';this['originatecalleridname']='';}Action['prototype']['getCaller']=function(){return util[_0x3809('0x1d')](_0x3809('0x24'),this[_0x3809('0x7')],this['voiceQueue'][_0x3809('0x25')]>0x0?this['number'][_0x3809('0x26')](this[_0x3809('0x5')][_0x3809('0x25')]):this[_0x3809('0xc')]);};Action[_0x3809('0x27')]['getQueue']=function(){return this['queue'];};module[_0x3809('0x28')]=Action; \ No newline at end of file +var _0xd6d8=['Contact','phone','firstName','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','lodash','moment','isNil','voiceQueue','name'];(function(_0x4bd254,_0x347d7a){var _0x3dcead=function(_0x4b5594){while(--_0x4b5594){_0x4bd254['push'](_0x4bd254['shift']());}};_0x3dcead(++_0x347d7a);}(_0xd6d8,0x1a8));var _0x8d6d=function(_0x3b53b0,_0x23dc58){_0x3b53b0=_0x3b53b0-0x0;var _0x4eddc6=_0xd6d8[_0x3b53b0];return _0x4eddc6;};'use strict';var util=require(_0x8d6d('0x0'));var _=require(_0x8d6d('0x1'));var moment=require(_0x8d6d('0x2'));function checkNameSurname(_0x290d40,_0x3d2f0f,_0x32234c){var _0x5bae34='';if(!_[_0x8d6d('0x3')](_0x3d2f0f)&&'string'===typeof _0x3d2f0f){_0x5bae34+=_0x3d2f0f;}if(!_[_0x8d6d('0x3')](_0x32234c)&&'string'===typeof _0x32234c){_0x5bae34+='\x20'+_0x32234c;}if(_0x5bae34!==''){return _0x5bae34;}return _0x290d40;}function Action(_0x2428d9,_0x5dd862,_0x3b26b6){this[_0x8d6d('0x4')]=_0x2428d9;this['uniqueid']=_0x3b26b6||undefined;this[_0x8d6d('0x5')]=checkNameSurname(_0x5dd862[_0x8d6d('0x6')][_0x8d6d('0x7')],_0x5dd862[_0x8d6d('0x6')][_0x8d6d('0x8')],_0x5dd862[_0x8d6d('0x6')][_0x8d6d('0x9')]);this[_0x8d6d('0xa')]=_0x5dd862['Contact'][_0x8d6d('0x7')];this[_0x8d6d('0xb')]=_0x2428d9[_0x8d6d('0x5')];this[_0x8d6d('0xc')]=_0x5dd862[_0x8d6d('0xc')]||![];this[_0x8d6d('0xd')]=_0x2428d9['type'];this[_0x8d6d('0xe')]=_0x2428d9[_0x8d6d('0xe')]||0x3;this[_0x8d6d('0xf')]=_0x5dd862['scheduledat'];this['countbusyretry']=_0x5dd862[_0x8d6d('0x10')];this[_0x8d6d('0x11')]=_0x5dd862['countcongestionretry'];this['countnoanswerretry']=_0x5dd862[_0x8d6d('0x12')];this[_0x8d6d('0x13')]=_0x5dd862['countnosuchnumberretry'];this[_0x8d6d('0x14')]=_0x5dd862['countdropretry'];this[_0x8d6d('0x15')]=_0x5dd862[_0x8d6d('0x15')];this[_0x8d6d('0x16')]=_0x5dd862['countmachineretry'];this[_0x8d6d('0x17')]=_0x5dd862[_0x8d6d('0x17')];this['ContactId']=_0x5dd862[_0x8d6d('0x18')];this[_0x8d6d('0x19')]=_0x5dd862[_0x8d6d('0x19')];this[_0x8d6d('0x1a')]=_0x5dd862[_0x8d6d('0x1a')];this[_0x8d6d('0x1b')]=_0x5dd862[_0x8d6d('0x1b')];this['CampaignId']=_0x5dd862[_0x8d6d('0x1c')];this[_0x8d6d('0x1d')]=_0x5dd862['id'];this['ContactFirstName']=_0x5dd862['Contact'][_0x8d6d('0x8')]||'';this[_0x8d6d('0x1e')]=moment()[_0x8d6d('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8d6d('0x20')]=_0x5dd862[_0x8d6d('0x20')];this[_0x8d6d('0x21')]=_0x5dd862[_0x8d6d('0x21')];this[_0x8d6d('0x22')]=_0x5dd862[_0x8d6d('0x22')];this[_0x8d6d('0x23')]=_0x5dd862[_0x8d6d('0x23')];this[_0x8d6d('0x24')]='';this['originatecalleridname']='';}Action['prototype'][_0x8d6d('0x25')]=function(){return util['format'](_0x8d6d('0x26'),this['name'],this[_0x8d6d('0x4')][_0x8d6d('0x27')]>0x0?this['number'][_0x8d6d('0x28')](this['voiceQueue'][_0x8d6d('0x27')]):this['number']);};Action['prototype'][_0x8d6d('0x29')]=function(){return this[_0x8d6d('0xb')];};module[_0x8d6d('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index b1cef90..370fb1d 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1816=['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','ringtime','holdtime','talktime','queue','membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','state','statedesc','scheduledat','type','campaigntype'];(function(_0x512a0a,_0x1f89e3){var _0x521fdf=function(_0x4d6ed0){while(--_0x4d6ed0){_0x512a0a['push'](_0x512a0a['shift']());}};_0x521fdf(++_0x1f89e3);}(_0x1816,0xb2));var _0x6181=function(_0x205134,_0x902ca4){_0x205134=_0x205134-0x0;var _0x43ed74=_0x1816[_0x205134];return _0x43ed74;};'use strict';var util=require(_0x6181('0x0'));var _=require(_0x6181('0x1'));var moment=require(_0x6181('0x2'));function getSeconds(_0x2e53c2,_0x3cecb5){var _0x2c7fd8=moment(_0x2e53c2)['milliseconds'](0x0);var _0x4be4a5=moment(_0x3cecb5)[_0x6181('0x3')](0x0);return _0x2c7fd8[_0x6181('0x4')](_0x4be4a5,'seconds');}function AgentComplete(_0x4c6d9b,_0x288003){this[_0x6181('0x5')]=0x4;this[_0x6181('0x6')]='Answer';this[_0x6181('0x7')]=_0x4c6d9b['scheduledat'];this[_0x6181('0x8')]=_0x4c6d9b[_0x6181('0x8')];this[_0x6181('0x9')]=_0x4c6d9b[_0x6181('0x8')]==='outbound'?'queue':_0x4c6d9b[_0x6181('0x8')];this['countbusyretry']=_0x4c6d9b[_0x6181('0xa')];this[_0x6181('0xb')]=_0x4c6d9b['countcongestionretry'];this['countnoanswerretry']=_0x4c6d9b[_0x6181('0xc')];this[_0x6181('0xd')]=_0x4c6d9b[_0x6181('0xa')]+_0x4c6d9b[_0x6181('0xb')]+_0x4c6d9b[_0x6181('0xc')]+_0x4c6d9b[_0x6181('0xe')]+_0x4c6d9b[_0x6181('0xf')]+_0x4c6d9b[_0x6181('0x10')]+_0x4c6d9b[_0x6181('0x11')]+_0x4c6d9b[_0x6181('0x12')];this[_0x6181('0xe')]=_0x4c6d9b[_0x6181('0xe')];this[_0x6181('0xf')]=_0x4c6d9b['countdropretry'];this[_0x6181('0x10')]=_0x4c6d9b[_0x6181('0x10')];this[_0x6181('0x11')]=_0x4c6d9b['countmachineretry'];this[_0x6181('0x12')]=_0x4c6d9b[_0x6181('0x12')];this[_0x6181('0x13')]=_0x288003[_0x6181('0x13')];this[_0x6181('0x14')]=_0x4c6d9b[_0x6181('0x15')];this[_0x6181('0x16')]=_0x4c6d9b[_0x6181('0x17')];this[_0x6181('0x18')]=_0x4c6d9b[_0x6181('0x18')];this[_0x6181('0x19')]=_0x4c6d9b['responsetime'];this['answertime']=_0x4c6d9b[_0x6181('0x1a')];this[_0x6181('0x1b')]=moment()[_0x6181('0x1c')](_0x6181('0x1d'));this[_0x6181('0x1e')]=getSeconds(_0x4c6d9b['responsetime'],_0x4c6d9b[_0x6181('0x18')]);this[_0x6181('0x1f')]=getSeconds(_0x4c6d9b['answertime'],_0x4c6d9b[_0x6181('0x19')]);this[_0x6181('0x20')]=getSeconds(this[_0x6181('0x1b')],_0x4c6d9b[_0x6181('0x1a')]);this['queue']=_0x288003[_0x6181('0x21')];this[_0x6181('0x22')]=_0x288003['membername'];this[_0x6181('0x23')]=_0x288003[_0x6181('0x23')];this['callback']=_0x4c6d9b['callback'];this[_0x6181('0x24')]=_0x4c6d9b[_0x6181('0x24')];this[_0x6181('0x25')]=_0x4c6d9b[_0x6181('0x25')];this[_0x6181('0x26')]=_0x4c6d9b['recallme'];this[_0x6181('0x27')]=_0x4c6d9b[_0x6181('0x27')];this[_0x6181('0x28')]=_0x4c6d9b['ListId'];this[_0x6181('0x29')]=_0x4c6d9b[_0x6181('0x29')];this[_0x6181('0x2a')]=_0x4c6d9b['VoiceQueueId'];this[_0x6181('0x2b')]=_0x4c6d9b['CampaignId'];this[_0x6181('0x2c')]=_0x4c6d9b[_0x6181('0x2c')]||'';this[_0x6181('0x2d')]=_0x4c6d9b['originatecalleridname']||'';}module[_0x6181('0x2e')]=AgentComplete; \ No newline at end of file +var _0x006f=['countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','state','statedesc','Answer','scheduledat','campaigntype','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x006f,0xd8));var _0xf006=function(_0x666b75,_0x441b8c){_0x666b75=_0x666b75-0x0;var _0x1f09b5=_0x006f[_0x666b75];return _0x1f09b5;};'use strict';var util=require(_0xf006('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x2b8ae4,_0x4835be){var _0x5d793b=moment(_0x2b8ae4)[_0xf006('0x1')](0x0);var _0x449f21=moment(_0x4835be)['milliseconds'](0x0);return _0x5d793b['diff'](_0x449f21,'seconds');}function AgentComplete(_0x5d9df6,_0x29979a){this[_0xf006('0x2')]=0x4;this[_0xf006('0x3')]=_0xf006('0x4');this[_0xf006('0x5')]=_0x5d9df6[_0xf006('0x5')];this['type']=_0x5d9df6['type'];this[_0xf006('0x6')]=_0x5d9df6[_0xf006('0x7')]===_0xf006('0x8')?_0xf006('0x9'):_0x5d9df6[_0xf006('0x7')];this[_0xf006('0xa')]=_0x5d9df6[_0xf006('0xa')];this[_0xf006('0xb')]=_0x5d9df6[_0xf006('0xb')];this[_0xf006('0xc')]=_0x5d9df6[_0xf006('0xc')];this[_0xf006('0xd')]=_0x5d9df6[_0xf006('0xa')]+_0x5d9df6['countcongestionretry']+_0x5d9df6[_0xf006('0xc')]+_0x5d9df6[_0xf006('0xe')]+_0x5d9df6[_0xf006('0xf')]+_0x5d9df6['countabandonedretry']+_0x5d9df6[_0xf006('0x10')]+_0x5d9df6[_0xf006('0x11')];this[_0xf006('0xe')]=_0x5d9df6['countnosuchnumberretry'];this[_0xf006('0xf')]=_0x5d9df6['countdropretry'];this[_0xf006('0x12')]=_0x5d9df6['countabandonedretry'];this[_0xf006('0x10')]=_0x5d9df6['countmachineretry'];this['countagentrejectretry']=_0x5d9df6['countagentrejectretry'];this[_0xf006('0x13')]=_0x29979a[_0xf006('0x13')];this['calleridname']=_0x5d9df6[_0xf006('0x14')];this[_0xf006('0x15')]=_0x5d9df6[_0xf006('0x16')];this[_0xf006('0x17')]=_0x5d9df6['starttime'];this['responsetime']=_0x5d9df6[_0xf006('0x18')];this[_0xf006('0x19')]=_0x5d9df6[_0xf006('0x19')];this[_0xf006('0x1a')]=moment()[_0xf006('0x1b')](_0xf006('0x1c'));this[_0xf006('0x1d')]=getSeconds(_0x5d9df6[_0xf006('0x18')],_0x5d9df6[_0xf006('0x17')]);this[_0xf006('0x1e')]=getSeconds(_0x5d9df6[_0xf006('0x19')],_0x5d9df6['responsetime']);this[_0xf006('0x1f')]=getSeconds(this[_0xf006('0x1a')],_0x5d9df6['answertime']);this[_0xf006('0x9')]=_0x29979a[_0xf006('0x9')];this[_0xf006('0x20')]=_0x29979a[_0xf006('0x20')];this[_0xf006('0x21')]=_0x29979a[_0xf006('0x21')];this[_0xf006('0x22')]=_0x5d9df6[_0xf006('0x22')];this[_0xf006('0x23')]=_0x5d9df6[_0xf006('0x23')];this[_0xf006('0x24')]=_0x5d9df6[_0xf006('0x24')];this[_0xf006('0x25')]=_0x5d9df6['recallme'];this[_0xf006('0x26')]=_0x5d9df6['ContactId'];this[_0xf006('0x27')]=_0x5d9df6[_0xf006('0x27')];this[_0xf006('0x28')]=_0x5d9df6[_0xf006('0x28')];this[_0xf006('0x29')]=_0x5d9df6[_0xf006('0x29')];this[_0xf006('0x2a')]=_0x5d9df6[_0xf006('0x2a')];this[_0xf006('0x2b')]=_0x5d9df6[_0xf006('0x2b')]||'';this[_0xf006('0x2c')]=_0x5d9df6[_0xf006('0x2c')]||'';}module[_0xf006('0x2d')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 2a1cc82..544984a 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed5a=['CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countcongestionretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x53b165,_0x2ab643){var _0x5c416e=function(_0x702bfa){while(--_0x702bfa){_0x53b165['push'](_0x53b165['shift']());}};_0x5c416e(++_0x2ab643);}(_0xed5a,0xed));var _0xaed5=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0xed5a[_0x2e8418];return _0x548fe6;};'use strict';var util=require(_0xaed5('0x0'));var _=require(_0xaed5('0x1'));var moment=require(_0xaed5('0x2'));function getSeconds(_0x50c9dd,_0x97fd83){var _0x1bb6ea=moment(_0x50c9dd)[_0xaed5('0x3')](0x0);var _0x396006=moment(_0x97fd83)[_0xaed5('0x3')](0x0);return _0x1bb6ea[_0xaed5('0x4')](_0x396006,_0xaed5('0x5'));}function Final(_0x57dd57){this[_0xaed5('0x6')]=_0x57dd57[_0xaed5('0x6')];this[_0xaed5('0x7')]=_0x57dd57[_0xaed5('0x7')];this[_0xaed5('0x8')]=_0x57dd57[_0xaed5('0x8')];this[_0xaed5('0x9')]=_0x57dd57['type']===_0xaed5('0xa')?_0xaed5('0xb'):_0x57dd57[_0xaed5('0x8')];this[_0xaed5('0xc')]=_0x57dd57[_0xaed5('0xc')];this['countcongestionretry']=_0x57dd57['countcongestionretry'];this[_0xaed5('0xd')]=_0x57dd57[_0xaed5('0xd')];this['countglobal']=_0x57dd57['countbusyretry']+_0x57dd57[_0xaed5('0xe')]+_0x57dd57[_0xaed5('0xd')]+_0x57dd57[_0xaed5('0xf')]+_0x57dd57[_0xaed5('0x10')]+_0x57dd57['countabandonedretry']+_0x57dd57['countmachineretry']+_0x57dd57[_0xaed5('0x11')];this[_0xaed5('0xf')]=_0x57dd57[_0xaed5('0xf')];this['countdropretry']=_0x57dd57['countdropretry'];this['countabandonedretry']=_0x57dd57[_0xaed5('0x12')];this[_0xaed5('0x13')]=_0x57dd57['countmachineretry'];this['countagentrejectretry']=_0x57dd57[_0xaed5('0x11')];this[_0xaed5('0xb')]=_0x57dd57[_0xaed5('0xb')];this[_0xaed5('0x14')]=_0x57dd57[_0xaed5('0x14')];this['calleridnum']=_0x57dd57[_0xaed5('0x15')];this[_0xaed5('0x16')]=_0x57dd57[_0xaed5('0x16')];this[_0xaed5('0x17')]=_0x57dd57[_0xaed5('0x17')];this[_0xaed5('0x18')]=_0x57dd57['responsetime'];this[_0xaed5('0x19')]=_0x57dd57['ringtime']||0x0;this[_0xaed5('0x1a')]=_0x57dd57[_0xaed5('0x1a')]||0x0;this[_0xaed5('0x1b')]=_0x57dd57[_0xaed5('0x1b')]||0x0;this[_0xaed5('0x1c')]=_0x57dd57[_0xaed5('0x1c')];this[_0xaed5('0x1d')]=_0x57dd57['callbackuniqueid'];this[_0xaed5('0x1e')]=_0x57dd57[_0xaed5('0x1e')];this[_0xaed5('0x1f')]=_0x57dd57[_0xaed5('0x1f')];this[_0xaed5('0x20')]=_0x57dd57[_0xaed5('0x20')];this[_0xaed5('0x21')]=_0x57dd57[_0xaed5('0x21')];this[_0xaed5('0x22')]=_0x57dd57[_0xaed5('0x22')];this[_0xaed5('0x23')]=_0x57dd57[_0xaed5('0x23')];this[_0xaed5('0x24')]=_0x57dd57['CampaignId'];this[_0xaed5('0x25')]=_0x57dd57[_0xaed5('0x25')]||'';this['originatecalleridname']=_0x57dd57[_0xaed5('0x26')]||'';}module['exports']=Final; \ No newline at end of file +var _0xb57c=['countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry'];(function(_0x56b424,_0x2cf37c){var _0x319161=function(_0x65b854){while(--_0x65b854){_0x56b424['push'](_0x56b424['shift']());}};_0x319161(++_0x2cf37c);}(_0xb57c,0xb4));var _0xcb57=function(_0x3f31c6,_0xe407d0){_0x3f31c6=_0x3f31c6-0x0;var _0x20e0e6=_0xb57c[_0x3f31c6];return _0x20e0e6;};'use strict';var util=require('util');var _=require(_0xcb57('0x0'));var moment=require(_0xcb57('0x1'));function getSeconds(_0x331c5d,_0x36f1de){var _0x4f9876=moment(_0x331c5d)[_0xcb57('0x2')](0x0);var _0x240ecd=moment(_0x36f1de)[_0xcb57('0x2')](0x0);return _0x4f9876[_0xcb57('0x3')](_0x240ecd,_0xcb57('0x4'));}function Final(_0x2deafc){this['uniqueid']=_0x2deafc['uniqueid'];this[_0xcb57('0x5')]=_0x2deafc['scheduledat'];this[_0xcb57('0x6')]=_0x2deafc[_0xcb57('0x6')];this[_0xcb57('0x7')]=_0x2deafc[_0xcb57('0x6')]===_0xcb57('0x8')?_0xcb57('0x9'):_0x2deafc[_0xcb57('0x6')];this[_0xcb57('0xa')]=_0x2deafc[_0xcb57('0xa')];this['countcongestionretry']=_0x2deafc[_0xcb57('0xb')];this['countnoanswerretry']=_0x2deafc[_0xcb57('0xc')];this[_0xcb57('0xd')]=_0x2deafc[_0xcb57('0xa')]+_0x2deafc[_0xcb57('0xb')]+_0x2deafc[_0xcb57('0xc')]+_0x2deafc['countnosuchnumberretry']+_0x2deafc[_0xcb57('0xe')]+_0x2deafc[_0xcb57('0xf')]+_0x2deafc[_0xcb57('0x10')]+_0x2deafc[_0xcb57('0x11')];this[_0xcb57('0x12')]=_0x2deafc[_0xcb57('0x12')];this['countdropretry']=_0x2deafc['countdropretry'];this[_0xcb57('0xf')]=_0x2deafc['countabandonedretry'];this['countmachineretry']=_0x2deafc[_0xcb57('0x10')];this[_0xcb57('0x11')]=_0x2deafc[_0xcb57('0x11')];this['queue']=_0x2deafc[_0xcb57('0x9')];this[_0xcb57('0x13')]=_0x2deafc[_0xcb57('0x13')];this[_0xcb57('0x14')]=_0x2deafc[_0xcb57('0x14')];this[_0xcb57('0x15')]=_0x2deafc[_0xcb57('0x15')];this[_0xcb57('0x16')]=_0x2deafc[_0xcb57('0x16')];this[_0xcb57('0x17')]=_0x2deafc[_0xcb57('0x16')];this[_0xcb57('0x18')]=_0x2deafc[_0xcb57('0x18')]||0x0;this[_0xcb57('0x19')]=_0x2deafc[_0xcb57('0x19')]||0x0;this[_0xcb57('0x1a')]=_0x2deafc[_0xcb57('0x1a')]||0x0;this[_0xcb57('0x1b')]=_0x2deafc[_0xcb57('0x1b')];this['callbackuniqueid']=_0x2deafc[_0xcb57('0x1c')];this[_0xcb57('0x1d')]=_0x2deafc['callbackat'];this[_0xcb57('0x1e')]=_0x2deafc[_0xcb57('0x1e')];this[_0xcb57('0x1f')]=_0x2deafc[_0xcb57('0x1f')];this[_0xcb57('0x20')]=_0x2deafc['ListId'];this[_0xcb57('0x21')]=_0x2deafc[_0xcb57('0x21')];this[_0xcb57('0x22')]=_0x2deafc[_0xcb57('0x22')];this[_0xcb57('0x23')]=_0x2deafc[_0xcb57('0x23')];this[_0xcb57('0x24')]=_0x2deafc['originatecalleridnum']||'';this[_0xcb57('0x25')]=_0x2deafc['originatecalleridname']||'';}module[_0xcb57('0x26')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 635a54d..e3e7e51 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa6e8=['exports','lodash','moment','milliseconds','diff','seconds','state','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId'];(function(_0x3fc09b,_0x5ddd34){var _0x2d8977=function(_0xa9246c){while(--_0xa9246c){_0x3fc09b['push'](_0x3fc09b['shift']());}};_0x2d8977(++_0x5ddd34);}(_0xa6e8,0x161));var _0x8a6e=function(_0x52f873,_0x18faef){_0x52f873=_0x52f873-0x0;var _0x361912=_0xa6e8[_0x52f873];return _0x361912;};'use strict';var util=require('util');var _=require(_0x8a6e('0x0'));var moment=require(_0x8a6e('0x1'));function getSeconds(_0x9915a1,_0x512ebc){var _0x5c1adf=moment(_0x9915a1)[_0x8a6e('0x2')](0x0);var _0x5f4b99=moment(_0x512ebc)[_0x8a6e('0x2')](0x0);return _0x5c1adf[_0x8a6e('0x3')](_0x5f4b99,_0x8a6e('0x4'));}function Hangup(_0x217270,_0x549ee5){this[_0x8a6e('0x5')]=0x4;this['statedesc']=_0x8a6e('0x6');this[_0x8a6e('0x7')]=_0x217270['scheduledat'];this[_0x8a6e('0x8')]=_0x217270['type'];this[_0x8a6e('0x9')]=_0x217270[_0x8a6e('0x8')]===_0x8a6e('0xa')?_0x8a6e('0xb'):_0x217270[_0x8a6e('0x8')];this[_0x8a6e('0xc')]=_0x217270['countbusyretry'];this[_0x8a6e('0xd')]=_0x217270[_0x8a6e('0xd')];this['countnoanswerretry']=_0x217270[_0x8a6e('0xe')];this[_0x8a6e('0xf')]=_0x217270[_0x8a6e('0xc')]+_0x217270[_0x8a6e('0xd')]+_0x217270[_0x8a6e('0xe')]+_0x217270['countnosuchnumberretry']+_0x217270[_0x8a6e('0x10')]+_0x217270[_0x8a6e('0x11')]+_0x217270[_0x8a6e('0x12')]+_0x217270[_0x8a6e('0x13')];this[_0x8a6e('0x14')]=_0x217270[_0x8a6e('0x14')];this['countdropretry']=_0x217270[_0x8a6e('0x10')];this['countabandonedretry']=_0x217270[_0x8a6e('0x11')];this[_0x8a6e('0x12')]=_0x217270[_0x8a6e('0x12')];this[_0x8a6e('0x13')]=_0x217270[_0x8a6e('0x13')];this['uniqueid']=_0x549ee5[_0x8a6e('0x15')];this[_0x8a6e('0x16')]=_0x217270[_0x8a6e('0x17')];this[_0x8a6e('0x18')]=_0x217270[_0x8a6e('0x19')];this[_0x8a6e('0x1a')]=_0x217270['starttime'];this['responsetime']=_0x217270[_0x8a6e('0x1b')];this[_0x8a6e('0x1c')]=moment()[_0x8a6e('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8a6e('0x1e')]=getSeconds(_0x217270[_0x8a6e('0x1b')],_0x217270[_0x8a6e('0x1a')]);this[_0x8a6e('0x1f')]=0x0;this[_0x8a6e('0x20')]=getSeconds(this[_0x8a6e('0x1c')],_0x217270[_0x8a6e('0x1b')]);this[_0x8a6e('0xb')]=_0x217270[_0x8a6e('0xb')];this[_0x8a6e('0x21')]='IVR';this[_0x8a6e('0x22')]=_0x549ee5['cause-txt'];this['callback']=_0x217270[_0x8a6e('0x23')];this[_0x8a6e('0x24')]=_0x217270[_0x8a6e('0x24')];this[_0x8a6e('0x25')]=_0x217270[_0x8a6e('0x25')];this[_0x8a6e('0x26')]=_0x217270[_0x8a6e('0x26')];this[_0x8a6e('0x27')]=_0x217270[_0x8a6e('0x27')];this['ListId']=_0x217270[_0x8a6e('0x28')];this[_0x8a6e('0x29')]=_0x217270[_0x8a6e('0x29')];this['VoiceQueueId']=_0x217270['VoiceQueueId'];this['CampaignId']=_0x217270[_0x8a6e('0x2a')];}module[_0x8a6e('0x2b')]=Hangup; \ No newline at end of file +var _0x22cd=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','exports','util','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x54927e,_0x4cc483){var _0x21a73d=function(_0x1e1d1d){while(--_0x1e1d1d){_0x54927e['push'](_0x54927e['shift']());}};_0x21a73d(++_0x4cc483);}(_0x22cd,0x1c9));var _0xd22c=function(_0x17dcd1,_0x3b7ccb){_0x17dcd1=_0x17dcd1-0x0;var _0x12af77=_0x22cd[_0x17dcd1];return _0x12af77;};'use strict';var util=require(_0xd22c('0x0'));var _=require('lodash');var moment=require(_0xd22c('0x1'));function getSeconds(_0x10edb4,_0x4eaba6){var _0xd69370=moment(_0x10edb4)['milliseconds'](0x0);var _0x2bd1b4=moment(_0x4eaba6)[_0xd22c('0x2')](0x0);return _0xd69370[_0xd22c('0x3')](_0x2bd1b4,_0xd22c('0x4'));}function Hangup(_0x392316,_0x2247e7){this[_0xd22c('0x5')]=0x4;this[_0xd22c('0x6')]='Answer';this[_0xd22c('0x7')]=_0x392316[_0xd22c('0x7')];this['type']=_0x392316[_0xd22c('0x8')];this['campaigntype']=_0x392316[_0xd22c('0x8')]===_0xd22c('0x9')?_0xd22c('0xa'):_0x392316[_0xd22c('0x8')];this[_0xd22c('0xb')]=_0x392316[_0xd22c('0xb')];this['countcongestionretry']=_0x392316[_0xd22c('0xc')];this[_0xd22c('0xd')]=_0x392316[_0xd22c('0xd')];this[_0xd22c('0xe')]=_0x392316[_0xd22c('0xb')]+_0x392316[_0xd22c('0xc')]+_0x392316[_0xd22c('0xd')]+_0x392316[_0xd22c('0xf')]+_0x392316[_0xd22c('0x10')]+_0x392316[_0xd22c('0x11')]+_0x392316[_0xd22c('0x12')]+_0x392316[_0xd22c('0x13')];this['countnosuchnumberretry']=_0x392316[_0xd22c('0xf')];this['countdropretry']=_0x392316[_0xd22c('0x10')];this[_0xd22c('0x11')]=_0x392316[_0xd22c('0x11')];this['countmachineretry']=_0x392316[_0xd22c('0x12')];this[_0xd22c('0x13')]=_0x392316[_0xd22c('0x13')];this[_0xd22c('0x14')]=_0x2247e7[_0xd22c('0x14')];this[_0xd22c('0x15')]=_0x392316['name'];this[_0xd22c('0x16')]=_0x392316['number'];this[_0xd22c('0x17')]=_0x392316[_0xd22c('0x17')];this['responsetime']=_0x392316[_0xd22c('0x18')];this[_0xd22c('0x19')]=moment()[_0xd22c('0x1a')](_0xd22c('0x1b'));this[_0xd22c('0x1c')]=getSeconds(_0x392316[_0xd22c('0x18')],_0x392316[_0xd22c('0x17')]);this[_0xd22c('0x1d')]=0x0;this[_0xd22c('0x1e')]=getSeconds(this[_0xd22c('0x19')],_0x392316[_0xd22c('0x18')]);this[_0xd22c('0xa')]=_0x392316[_0xd22c('0xa')];this['membername']=_0xd22c('0x1f');this[_0xd22c('0x20')]=_0x2247e7[_0xd22c('0x21')];this[_0xd22c('0x22')]=_0x392316[_0xd22c('0x22')];this[_0xd22c('0x23')]=_0x392316['callbackuniqueid'];this[_0xd22c('0x24')]=_0x392316[_0xd22c('0x24')];this[_0xd22c('0x25')]=_0x392316[_0xd22c('0x25')];this[_0xd22c('0x26')]=_0x392316[_0xd22c('0x26')];this[_0xd22c('0x27')]=_0x392316['ListId'];this['UserId']=_0x392316[_0xd22c('0x28')];this[_0xd22c('0x29')]=_0x392316[_0xd22c('0x29')];this['CampaignId']=_0x392316['CampaignId'];}module[_0xd22c('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index c1a8cc6..d13150c 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9dc3=['countmachineretry','countagentrejectretry','countdropretry','calleridname','name','number','starttime','responsetime','endtime','ringtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry'];(function(_0x385413,_0x10110a){var _0x3edf85=function(_0x33861c){while(--_0x33861c){_0x385413['push'](_0x385413['shift']());}};_0x3edf85(++_0x10110a);}(_0x9dc3,0xa5));var _0x39dc=function(_0x21e708,_0x1808ea){_0x21e708=_0x21e708-0x0;var _0x2ead69=_0x9dc3[_0x21e708];return _0x2ead69;};'use strict';var util=require(_0x39dc('0x0'));var _=require(_0x39dc('0x1'));var moment=require(_0x39dc('0x2'));function getSeconds(_0x5719f8,_0x5682d4){var _0x9bfb49=moment(_0x5719f8)[_0x39dc('0x3')](0x0);var _0x3a05cc=moment(_0x5682d4)[_0x39dc('0x3')](0x0);return _0x9bfb49[_0x39dc('0x4')](_0x3a05cc,_0x39dc('0x5'));}function History(_0x5104f3){this[_0x39dc('0x6')]=_0x5104f3[_0x39dc('0x6')];this[_0x39dc('0x7')]=_0x5104f3[_0x39dc('0x7')]||undefined;this[_0x39dc('0x8')]=_0x5104f3[_0x39dc('0x8')];this['campaigntype']=_0x5104f3['type']==='outbound'?_0x39dc('0x9'):_0x5104f3[_0x39dc('0x8')];this[_0x39dc('0xa')]=_0x5104f3[_0x39dc('0xa')];this[_0x39dc('0xb')]=_0x5104f3[_0x39dc('0xb')];this[_0x39dc('0xc')]=_0x5104f3[_0x39dc('0xc')];this['countglobal']=_0x5104f3[_0x39dc('0xa')]+_0x5104f3[_0x39dc('0xb')]+_0x5104f3[_0x39dc('0xc')]+_0x5104f3[_0x39dc('0xd')]+_0x5104f3['countdropretry']+_0x5104f3[_0x39dc('0xe')]+_0x5104f3[_0x39dc('0xf')]+_0x5104f3[_0x39dc('0x10')];this['countnosuchnumberretry']=_0x5104f3[_0x39dc('0xd')];this[_0x39dc('0x11')]=_0x5104f3[_0x39dc('0x11')];this[_0x39dc('0xe')]=_0x5104f3[_0x39dc('0xe')];this['countmachineretry']=_0x5104f3[_0x39dc('0xf')];this[_0x39dc('0x10')]=_0x5104f3[_0x39dc('0x10')];this[_0x39dc('0x9')]=_0x5104f3[_0x39dc('0x9')];this[_0x39dc('0x12')]=_0x5104f3[_0x39dc('0x13')];this['calleridnum']=_0x5104f3[_0x39dc('0x14')];this[_0x39dc('0x15')]=_0x5104f3['starttime'];this['responsetime']=_0x5104f3[_0x39dc('0x16')];this[_0x39dc('0x17')]=_0x5104f3[_0x39dc('0x16')];this[_0x39dc('0x18')]=getSeconds(_0x5104f3['responsetime'],_0x5104f3[_0x39dc('0x15')]);this['holdtime']=0x0;this['talktime']=0x0;this[_0x39dc('0x19')]=_0x5104f3[_0x39dc('0x19')];this[_0x39dc('0x1a')]=_0x5104f3[_0x39dc('0x1a')];this[_0x39dc('0x1b')]=_0x5104f3[_0x39dc('0x1b')];this[_0x39dc('0x1c')]=_0x5104f3[_0x39dc('0x1c')];this['ContactId']=_0x5104f3[_0x39dc('0x1d')];this['ListId']=_0x5104f3[_0x39dc('0x1e')];this[_0x39dc('0x1f')]=_0x5104f3['UserId'];this[_0x39dc('0x20')]=_0x5104f3[_0x39dc('0x20')];this[_0x39dc('0x21')]=_0x5104f3[_0x39dc('0x21')];this[_0x39dc('0x22')]=_0x5104f3[_0x39dc('0x22')]||'';this[_0x39dc('0x23')]=_0x5104f3[_0x39dc('0x23')]||'';}module['exports']=History; \ No newline at end of file +var _0x5a24=['CampaignId','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','name','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x43b08,_0x15f967){var _0x5e05f4=function(_0x4bb0cb){while(--_0x4bb0cb){_0x43b08['push'](_0x43b08['shift']());}};_0x5e05f4(++_0x15f967);}(_0x5a24,0x6f));var _0x45a2=function(_0x92df55,_0x50e1db){_0x92df55=_0x92df55-0x0;var _0x4786a6=_0x5a24[_0x92df55];return _0x4786a6;};'use strict';var util=require(_0x45a2('0x0'));var _=require(_0x45a2('0x1'));var moment=require(_0x45a2('0x2'));function getSeconds(_0xd559a0,_0x478c8e){var _0x3cd41b=moment(_0xd559a0)['milliseconds'](0x0);var _0x100d2c=moment(_0x478c8e)[_0x45a2('0x3')](0x0);return _0x3cd41b['diff'](_0x100d2c,_0x45a2('0x4'));}function History(_0x119296){this[_0x45a2('0x5')]=_0x119296[_0x45a2('0x5')];this[_0x45a2('0x6')]=_0x119296[_0x45a2('0x6')]||undefined;this[_0x45a2('0x7')]=_0x119296['type'];this[_0x45a2('0x8')]=_0x119296['type']==='outbound'?'queue':_0x119296[_0x45a2('0x7')];this[_0x45a2('0x9')]=_0x119296[_0x45a2('0x9')];this[_0x45a2('0xa')]=_0x119296[_0x45a2('0xa')];this[_0x45a2('0xb')]=_0x119296[_0x45a2('0xb')];this[_0x45a2('0xc')]=_0x119296['countbusyretry']+_0x119296['countcongestionretry']+_0x119296[_0x45a2('0xb')]+_0x119296[_0x45a2('0xd')]+_0x119296[_0x45a2('0xe')]+_0x119296[_0x45a2('0xf')]+_0x119296[_0x45a2('0x10')]+_0x119296['countagentrejectretry'];this[_0x45a2('0xd')]=_0x119296['countnosuchnumberretry'];this[_0x45a2('0xe')]=_0x119296[_0x45a2('0xe')];this[_0x45a2('0xf')]=_0x119296['countabandonedretry'];this[_0x45a2('0x10')]=_0x119296['countmachineretry'];this[_0x45a2('0x11')]=_0x119296[_0x45a2('0x11')];this[_0x45a2('0x12')]=_0x119296[_0x45a2('0x12')];this['calleridname']=_0x119296[_0x45a2('0x13')];this['calleridnum']=_0x119296['number'];this['starttime']=_0x119296[_0x45a2('0x14')];this[_0x45a2('0x15')]=_0x119296[_0x45a2('0x15')];this[_0x45a2('0x16')]=_0x119296[_0x45a2('0x15')];this[_0x45a2('0x17')]=getSeconds(_0x119296[_0x45a2('0x15')],_0x119296[_0x45a2('0x14')]);this['holdtime']=0x0;this[_0x45a2('0x18')]=0x0;this[_0x45a2('0x19')]=_0x119296[_0x45a2('0x19')];this['callbackuniqueid']=_0x119296[_0x45a2('0x1a')];this['callbackat']=_0x119296[_0x45a2('0x1b')];this[_0x45a2('0x1c')]=_0x119296['recallme'];this[_0x45a2('0x1d')]=_0x119296['ContactId'];this[_0x45a2('0x1e')]=_0x119296[_0x45a2('0x1e')];this[_0x45a2('0x1f')]=_0x119296[_0x45a2('0x1f')];this['VoiceQueueId']=_0x119296[_0x45a2('0x20')];this[_0x45a2('0x21')]=_0x119296[_0x45a2('0x21')];this['originatecalleridnum']=_0x119296['originatecalleridnum']||'';this[_0x45a2('0x22')]=_0x119296[_0x45a2('0x22')]||'';}module[_0x45a2('0x23')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 25afff5..a4ed595 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 _0xfb4f=['XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','substring','dialCutDigit','from-sip','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','callProgressDetecting','[callProgressDetecting]','outboundNoSuchCallsDay','custom:agentnosuchnumber','buildObj','nosuchnumber','reason\x200\x20no\x20such\x20number....','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','predictiveIntervalMaxThreshold','round','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','outboundQueuePauses','predictiveIntervalDroppedCallsCallersExit','[CatchErlangB]','busyFactor','one\x20call\x20every:','[handlePredictive]','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','[actionOriginate]\x20','[actionOriginateIvr]\x20','[getContactCampaign2]','floor','dialLimitQueue','not_inuse','dialOrderByScheduledAt','RUNNING','Contact.phone','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/logger','dialer','booked','predictive','syncQueueSummary','../ami','redis','defaults','localhost','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','callerid','ivr','format','campaign:ivr:%s','campaign:save','isEmpty','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','handlePredictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','talking','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','statedesc','endtime','starttime','prototype','clearZombieChannels','actions','isNil','Action','status','channel','catch','updateOriginated','queue','[Dialer][checkChannel][ivr]','countReScheduled','then','[countReScheduled]\x20','checkIsBlackList','resolve','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','pick','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','SIP/%s','reachable','unmonitored','saveInDb','uniqueid','variable','amdstatus','exten','dialAMDActive','HANGUP','HangupInAMD','membername','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','state','AMD','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','Machine','countbusyretry','countcongestionretry','stateGlobal','ContactId','[syncHangupIvr]','AnswerAGI','AGI','[syncHangupIvr][createHistory]','dialQueueProject','Unknow','reason','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','queueCallerAbandonCreateState','droptime','responsetime','dialQueueTimeout','Drop','dropreason','TIMEOUT','dialDropMaxRetry','[rescheduleContact][Drop]','calleridname','calleridnum','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','paused','stateinterface','locked','idHopper','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','timezones','content','push','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','handleIvr','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','[syncQueueSummary]','[syncCampaigns]','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','Contact','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','tags','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber'];(function(_0x4accb7,_0x282f2b){var _0x167b88=function(_0xea568d){while(--_0xea568d){_0x4accb7['push'](_0x4accb7['shift']());}};_0x167b88(++_0x282f2b);}(_0xfb4f,0x8c));var _0xffb4=function(_0x1e65bf,_0x1fdc3c){_0x1e65bf=_0x1e65bf-0x0;var _0x852b7a=_0xfb4f[_0x1e65bf];return _0x852b7a;};'use strict';var util=require(_0xffb4('0x0'));var _=require(_0xffb4('0x1'));var BPromise=require(_0xffb4('0x2'));var uuid=require(_0xffb4('0x3'));var moment=require(_0xffb4('0x4'));var rr=require('rr');var md5=require(_0xffb4('0x5'));var Redis=require(_0xffb4('0x6'));var ut=require(_0xffb4('0x7'));var config=require('../../../config/environment/');var logger=require(_0xffb4('0x8'))(_0xffb4('0x9'));var loggerBooked=require(_0xffb4('0x8'))(_0xffb4('0xa'));var loggerPredictive=require('../../../config/logger')(_0xffb4('0xb'));var loggerPredictiveCalls=require(_0xffb4('0x8'))('predictiveCalls');var loggerSyncQueueSummary=require(_0xffb4('0x8'))(_0xffb4('0xc'));var ami=require(_0xffb4('0xd'));config[_0xffb4('0xe')]=_[_0xffb4('0xf')](config[_0xffb4('0xe')],{'host':_0xffb4('0x10'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xffb4('0xe')]));var cmHopper=require(_0xffb4('0x11'));var cmHopperHistory=require(_0xffb4('0x12'));var cmHopperBlack=require(_0xffb4('0x13'));var voiceQueueRt=require(_0xffb4('0x14'));var Action=require(_0xffb4('0x15'));var History=require(_0xffb4('0x16'));var Final=require('./final');var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0xffb4('0x17'));var Hangup=require(_0xffb4('0x18'));var ipAgi=process[_0xffb4('0x19')][_0xffb4('0x1a')]||_0xffb4('0x1b');var strategy={'rrmemory':_0xffb4('0x1c'),'roundrobin':_0xffb4('0x1d')};var Sequence=function(){};Sequence['prototype'][_0xffb4('0x1e')]=function(_0x1bde87){this['tail']=this[_0xffb4('0x1f')]?this[_0xffb4('0x1f')][_0xffb4('0x20')](_0x1bde87):_0x1bde87();};function Dialer(_0x38381d,_0x42c9b8){this[_0xffb4('0x21')]=new Sequence();this[_0xffb4('0x22')]=_0x42c9b8;this[_0xffb4('0x23')]=_0x38381d[_0xffb4('0x23')];this['campaigns']=_0x38381d[_0xffb4('0x24')];this[_0xffb4('0x25')]=_0x38381d[_0xffb4('0x25')];this[_0xffb4('0x26')]=_0x38381d[_0xffb4('0x26')];this[_0xffb4('0x27')]=config['maxNumberOriginate']||0x2;this[_0xffb4('0x28')]={};this['actions']={};this['contactsId']={};this[_0xffb4('0x29')]={};this['optionPredictive']={};this[_0xffb4('0x2a')]={};this[_0xffb4('0x2b')]={};this[_0xffb4('0x2c')]={};this[_0xffb4('0x2d')]={};this[_0xffb4('0x2e')]={};ami['on'](_0xffb4('0x2f'),this['syncAgentConnect'][_0xffb4('0x30')](this));ami['on'](_0xffb4('0x31'),this[_0xffb4('0x32')][_0xffb4('0x30')](this));ami['on'](_0xffb4('0x33'),this[_0xffb4('0x34')][_0xffb4('0x30')](this));ami['on'](_0xffb4('0x35'),this['syncAgentComplete'][_0xffb4('0x30')](this));ami['on'](_0xffb4('0x36'),this[_0xffb4('0xc')][_0xffb4('0x30')](this));ami['on'](_0xffb4('0x37'),this[_0xffb4('0x38')]['bind'](this));ami['on'](_0xffb4('0x39'),this[_0xffb4('0x3a')][_0xffb4('0x30')](this));ami['on'](_0xffb4('0x3b'),this[_0xffb4('0x3c')][_0xffb4('0x30')](this));ami['on'](_0xffb4('0x3d'),this[_0xffb4('0x3e')][_0xffb4('0x30')](this));ami['on'](_0xffb4('0x3f'),this[_0xffb4('0x40')]['bind'](this));this[_0xffb4('0x41')]();this[_0xffb4('0x42')]();}function isNotNull(_0x71b359){return _0x71b359!==null&&!_[_0xffb4('0x43')](_0x71b359);}function checkIsLoggedIn(_0x1d2af3,_0x527d14){return function(){if(_0x527d14<=0x0){_0x1d2af3[_0xffb4('0x44')]='AGENTS_NOT_LOGGED';throw _0x1d2af3[_0xffb4('0x45')]+_0xffb4('0x46');}};}function isActive(_0x193318){return _0x193318;}function checkIsActive(_0x459020,_0x3fed71){return function(){if(!isActive(_0x3fed71)){_0x459020['message']=_0xffb4('0x47');throw _0x459020[_0xffb4('0x45')]+'\x20NOT\x20Active';}};}function checkInterval(_0x1e7feb){return function(){if(!isNotNull(_0x1e7feb[_0xffb4('0x48')])){_0x1e7feb['message']=_0xffb4('0x49');throw _0x1e7feb['name']+_0xffb4('0x4a');}if(!isNotNull(_0x1e7feb[_0xffb4('0x48')][_0xffb4('0x4b')])){_0x1e7feb[_0xffb4('0x44')]='INTERVAL_IS_NULL';throw _0x1e7feb[_0xffb4('0x45')]+_0xffb4('0x4a');}if(!isNotNull(_['isEmpty'](_0x1e7feb['Interval'][_0xffb4('0x4b')]))){_0x1e7feb[_0xffb4('0x44')]=_0xffb4('0x49');throw _0x1e7feb['name']+_0xffb4('0x4a');}};}function msgResponse(_0x333ad2,_0x591bbb,_0xb7dc11){return{'action':_0x333ad2,'response':_0x591bbb,'message':_0xb7dc11,'stack':_0xb7dc11};}function myreject(_0x337a48){return function(_0x4f80e7){return _0x337a48(msgResponse('[ifTime][Action]',_0xffb4('0x4c'),JSON[_0xffb4('0x4d')](_0x4f80e7)));};}function getSeconds(_0x295271,_0x25adbc){var _0x13991c=moment(_0x295271)[_0xffb4('0x4e')](0x0);var _0x2daf07=moment(_0x25adbc)['milliseconds'](0x0);return _0x13991c[_0xffb4('0x4f')](_0x2daf07,_0xffb4('0x50'));}function emit(_0x429832,_0x4b4ee1,_0x4c4368){io['to'](_0x429832)[_0xffb4('0x51')](_0x4b4ee1,_0x4c4368);}function emitVoiceQueueSummary(_0x1e5fc5){if(_0x1e5fc5[_0xffb4('0x52')]===_0xffb4('0x53')){var _0x43982e={'id':_0x1e5fc5['id'],'name':_0x1e5fc5[_0xffb4('0x45')],'strategy':_0x1e5fc5[_0xffb4('0x54')],'answered':_0x1e5fc5[_0xffb4('0x55')],'available':_0x1e5fc5[_0xffb4('0x56')],'loggedIn':_0x1e5fc5[_0xffb4('0x57')],'pTalking':_0x1e5fc5[_0xffb4('0x58')],'sumBillable':_0x1e5fc5[_0xffb4('0x59')],'sumDuration':_0x1e5fc5['sumDuration'],'sumHoldTime':_0x1e5fc5[_0xffb4('0x5a')]||0x0,'talking':_0x1e5fc5['talking'],'total':_0x1e5fc5[_0xffb4('0x5b')],'type':_0x1e5fc5['type'],'unmanaged':_0x1e5fc5[_0xffb4('0x5c')],'abandoned':_0x1e5fc5[_0xffb4('0x5d')],'waiting':_0x1e5fc5[_0xffb4('0x5e')],'loggedInDb':_0x1e5fc5[_0xffb4('0x5f')],'dialActive':_0x1e5fc5[_0xffb4('0x60')],'dialMethod':_0x1e5fc5[_0xffb4('0x61')],'dialOriginateCallerIdName':_0x1e5fc5[_0xffb4('0x62')],'dialOriginateCallerIdNumber':_0x1e5fc5[_0xffb4('0x63')],'dialOriginateTimeout':_0x1e5fc5[_0xffb4('0x64')],'dialPrefix':_0x1e5fc5[_0xffb4('0x65')],'outboundAnswerAgiCallsDay':_0x1e5fc5[_0xffb4('0x66')],'outboundAnswerCallsDay':_0x1e5fc5[_0xffb4('0x67')],'outboundBlacklistCallsDay':_0x1e5fc5[_0xffb4('0x68')],'outboundBusyCallsDay':_0x1e5fc5['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x1e5fc5[_0xffb4('0x69')],'outboundDropCallsDayACS':_0x1e5fc5['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x1e5fc5[_0xffb4('0x6a')],'outboundDropCallsDayTimeout':_0x1e5fc5[_0xffb4('0x6b')],'outboundNoAnswerCallsDay':_0x1e5fc5[_0xffb4('0x6c')],'outboundNoSuchCallsDay':_0x1e5fc5['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x1e5fc5['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x1e5fc5[_0xffb4('0x6d')],'outboundRejectCallsDay':_0x1e5fc5['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x1e5fc5[_0xffb4('0x6e')],'predictiveIntervalAnsweredCalls':_0x1e5fc5[_0xffb4('0x6f')],'predictiveIntervalAvgHoldtime':_0x1e5fc5[_0xffb4('0x70')],'predictiveIntervalAvgTalktime':_0x1e5fc5['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x1e5fc5['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x1e5fc5['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x1e5fc5[_0xffb4('0x71')],'predictiveIntervalErlangCallsDroppedCalls':_0x1e5fc5[_0xffb4('0x72')],'predictiveIntervalHitRate':_0x1e5fc5[_0xffb4('0x73')],'predictiveIntervalMultiplicativeFactor':_0x1e5fc5[_0xffb4('0x74')],'predictiveIntervalPauses':_0x1e5fc5[_0xffb4('0x75')],'predictiveIntervalAvailable':_0x1e5fc5[_0xffb4('0x76')],'predictiveIntervalTotalCalls':_0x1e5fc5[_0xffb4('0x77')],'message':_0x1e5fc5[_0xffb4('0x44')],'originated':_0x1e5fc5[_0xffb4('0x78')],'erlangCalls':_0x1e5fc5[_0xffb4('0x79')],'erlangCallToSecond':_0x1e5fc5[_0xffb4('0x7a')],'erlangAbandonmentRate':_0x1e5fc5[_0xffb4('0x7b')],'erlangBusyFactor':_0x1e5fc5[_0xffb4('0x7c')],'startPredictive':_0x1e5fc5[_0xffb4('0x2a')],'startProgressive':_0x1e5fc5['startProgressive']};if(_0x1e5fc5['Trunk']){_0x43982e[_0xffb4('0x7d')]={'id':_0x1e5fc5[_0xffb4('0x7d')]['id'],'name':_0x1e5fc5[_0xffb4('0x7d')]['name'],'active':_0x1e5fc5['Trunk']['active'],'callerid':_0x1e5fc5[_0xffb4('0x7d')][_0xffb4('0x7e')]};}if(_0x1e5fc5[_0xffb4('0x48')]){_0x43982e[_0xffb4('0x48')]={'id':_0x1e5fc5['Interval']['id'],'name':_0x1e5fc5[_0xffb4('0x48')][_0xffb4('0x45')]};}var _0x1f46cc=md5(JSON[_0xffb4('0x4d')](_0x43982e));if(_0x1e5fc5[_0xffb4('0x5')]!==_0x1f46cc){_0x1e5fc5[_0xffb4('0x5')]=_0x1f46cc;emit(util['format']('voice:queue:%s',_0x43982e[_0xffb4('0x45')]),'voice_queue:save',_0x43982e);}}}function emitCampaignSummary(_0x293dd3){if(_0x293dd3['type']===_0xffb4('0x7f')){emit(util[_0xffb4('0x80')](_0xffb4('0x81'),_0x293dd3[_0xffb4('0x45')]),_0xffb4('0x82'),_0x293dd3);}}function checkGetDataPredictive(_0x529baa){if(isNotNull(_0x529baa)&&!_[_0xffb4('0x83')](_0x529baa)){loggerPredictive['info'](_0xffb4('0x84'));loggerPredictive[_0xffb4('0x85')](_0xffb4('0x86'),_0x529baa['predictiveIntervalTotalCalls']);loggerPredictive[_0xffb4('0x85')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x529baa['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xffb4('0x85')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x529baa[_0xffb4('0x87')]);loggerPredictive[_0xffb4('0x85')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x529baa['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0xffb4('0x85')](_0xffb4('0x88'),_0x529baa[_0xffb4('0x70')]);loggerPredictive[_0xffb4('0x85')](_0xffb4('0x89'),_0x529baa['predictiveIntervalAvgTalktime']);loggerPredictive['info'](_0xffb4('0x8a'));if(_0x529baa[_0xffb4('0x77')]>0x0){if(!_['isUndefined'](_0x529baa['predictiveIntervalAvgTalktime'])&&_0x529baa[_0xffb4('0x8b')]>0x0){return!![];}loggerPredictive['info'](_0xffb4('0x8c'));if(!_[_0xffb4('0x43')](_0x529baa[_0xffb4('0x70')])&&_0x529baa['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0xffb4('0x85')](_0xffb4('0x8d'));}else{loggerPredictive[_0xffb4('0x85')](_0xffb4('0x8e'));}}else{loggerPredictive[_0xffb4('0x85')](_0xffb4('0x8f'));}return![];}function mergeDataErlangB(_0x20f964){return function(_0x1748c7){loggerPredictive[_0xffb4('0x85')](_0xffb4('0x90'));loggerPredictive[_0xffb4('0x85')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1748c7['erlangCalls']);loggerPredictive[_0xffb4('0x85')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1748c7[_0xffb4('0x7a')]);loggerPredictive[_0xffb4('0x85')](_0xffb4('0x91'),_0x1748c7['erlangAbandonmentRate']);loggerPredictive[_0xffb4('0x85')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1748c7['erlangBusyFactor']);loggerPredictive['info'](_0xffb4('0x91'),_0x1748c7[_0xffb4('0x7b')]);loggerPredictive[_0xffb4('0x85')](_0xffb4('0x8a'));_[_0xffb4('0x92')](_0x20f964,_0x1748c7);};}function getDiff(_0x432446){var _0x3f98f6=moment()['milliseconds'](0x0);var _0x3fb291=moment(_0x432446)[_0xffb4('0x4e')](0x0);return _0x3f98f6['diff'](_0x3fb291,_0xffb4('0x50'));}function ifInterval(_0x35fe6d,_0x2956a5){if(_[_0xffb4('0x43')](_0x2956a5)){return![];}return getDiff(_0x2956a5)<_0x35fe6d*0x3c;}function freeVariablesPredictive(_0x32e2c1){if(isNotNull(_0x32e2c1)){if(!_[_0xffb4('0x43')](_0x32e2c1[_0xffb4('0x2b')])){_0x32e2c1[_0xffb4('0x2b')]=undefined;loggerPredictive[_0xffb4('0x85')](_0x32e2c1[_0xffb4('0x45')],_0xffb4('0x93'));}if(!_['isUndefined'](_0x32e2c1[_0xffb4('0x2a')])){_0x32e2c1[_0xffb4('0x2a')]=undefined;loggerPredictive[_0xffb4('0x85')](_0x32e2c1[_0xffb4('0x45')],'clearing\x20variable\x20start\x20predictive');}if(!_['isUndefined'](_0x32e2c1[_0xffb4('0x94')])){clearInterval(_0x32e2c1['handlePredictive']);_0x32e2c1[_0xffb4('0x94')]=undefined;loggerPredictive[_0xffb4('0x85')](_0x32e2c1[_0xffb4('0x45')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x20b0da,_0x33226a){if(_0x33226a===0x0){return 0x0;}var _0xb37c2e=0x1;for(var _0x4fc781=0x1;_0x4fc781<=_0x33226a;_0x4fc781+=0x1){_0xb37c2e=0x1+_0xb37c2e*_0x4fc781/_0x20b0da;}return 0x1/_0xb37c2e;}function isVoiceQueueOutbound(_0x32f8d2){return _0x32f8d2===_0xffb4('0x53');}function isNotPreview(_0x5ec851){return _0x5ec851!==_0xffb4('0x22');}function isCampaignIvr(_0x5cad72){return _0x5cad72===_0xffb4('0x7f');}function getCallerId(_0x2fe574,_0x5b4b7d,_0x1705d5){if(!_[_0xffb4('0x43')](_0x1705d5)&&typeof _0x1705d5===_0xffb4('0x95')&&!_[_0xffb4('0x83')](_0x1705d5)){if(!_[_0xffb4('0x43')](_0x5b4b7d)&&typeof _0x5b4b7d===_0xffb4('0x95')&&!_[_0xffb4('0x83')](_0x5b4b7d)){return util[_0xffb4('0x80')](_0xffb4('0x96'),_0x5b4b7d,_0x1705d5);}return util[_0xffb4('0x80')](_0xffb4('0x96'),_0x1705d5,_0x1705d5);}if(!_[_0xffb4('0x43')](_0x2fe574)&&typeof _0x2fe574===_0xffb4('0x95')&&!_[_0xffb4('0x83')](_0x2fe574)){return _0x2fe574;}return _0xffb4('0x97');}function loggerCatchQueueSummary(_0x268afb,_0x261cb9){return function(_0x414064){freeVariablesPredictive(_0x261cb9);emitVoiceQueueSummary(_0x261cb9);emitCampaignSummary(_0x261cb9);loggerSyncQueueSummary[_0xffb4('0x98')](_0x268afb,util[_0xffb4('0x99')](_0x414064,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x5d513f,_0x3b29b9){return function(_0xe17e86){loggerPredictive[_0xffb4('0x98')](_0x3b29b9['name'],_0x5d513f);loggerPredictive[_0xffb4('0x98')](_0xe17e86[_0xffb4('0x9a')]);freeVariablesPredictive(_0x3b29b9);};}function loggerCatch(_0xe102f1){return function(_0x8e8088){logger['error'](_0xe102f1,util['inspect'](_0x8e8088,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x35bbfe){return _0x35bbfe&&!_[_0xffb4('0x43')](_0x35bbfe)&&_0x35bbfe[_0xffb4('0x9b')]>0x0;}function decremetOriginate(_0x3b6567){if(!_['isUndefined'](_0x3b6567)&&_0x3b6567!==null){if(typeof _0x3b6567[_0xffb4('0x78')]!==_0xffb4('0x9c')){if(_0x3b6567[_0xffb4('0x78')]>0x0){_0x3b6567[_0xffb4('0x78')]-=0x1;}else{logger[_0xffb4('0x98')](_0xffb4('0x9d'));}}}else{logger[_0xffb4('0x98')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x4afb0d,_0x48ea84,_0x41cd17){if(_0x48ea84>_0x41cd17){for(var _0x4f30c4=0x0;_0x4f30c4<_0x48ea84-_0x41cd17;_0x4f30c4+=0x1){decremetOriginate(_0x4afb0d);}}}function loggerGetContactDialer(_0x4f92b2,_0xac9c8,_0x340166){return function(_0x52454c){checkContactLowerLimitOriginate(_0xac9c8,_0x340166,0x0);logger[_0xffb4('0x98')](_0x4f92b2,util[_0xffb4('0x99')](_0x52454c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x27c2c0){return function(_0x24a2fe){if(isNotNull(_0x24a2fe)&&isNotNull(_0x24a2fe[0x0])){if(_0x24a2fe[0x0][_0xffb4('0x9e')]>0x0){_0x27c2c0[_0xffb4('0x44')]='RESCHEDULED_CONTACTS';logger[_0xffb4('0x85')](_0xffb4('0x9f')+_0x27c2c0['name'],_0x24a2fe[0x0]['contactsRescheduled'],_0xffb4('0xa0'));}else{_0x27c2c0['message']=_0xffb4('0xa1');logger[_0xffb4('0x85')]('[getContactDialer2][Empty]'+_0x27c2c0['name']);}}};}function notSendMessagesQueue(_0x21cf5a){if(_0x21cf5a[_0xffb4('0xa2')]){freeVariablesPredictive(_0x21cf5a);if(_0x21cf5a['originated']===0x0&&_0x21cf5a[_0xffb4('0xa3')]===0x0&&_0x21cf5a[_0xffb4('0x5e')]===0x0&&(_0x21cf5a['pTalking']||0x0)===0x0){_0x21cf5a[_0xffb4('0xa2')]=![];_0x21cf5a[_0xffb4('0x56')]=0x0;_0x21cf5a[_0xffb4('0x44')]=_0xffb4('0x47');loggerSyncQueueSummary[_0xffb4('0x98')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x21cf5a[_0xffb4('0x45')],_0xffb4('0xa4'));}else{_0x21cf5a[_0xffb4('0x44')]=_0xffb4('0xa5');loggerSyncQueueSummary[_0xffb4('0x98')](_0xffb4('0xa6'),_0x21cf5a['name'],'is\x20disactive');}emitVoiceQueueSummary(_0x21cf5a);}}function notSendMessagesCampaign(_0x235fbf){if(_0x235fbf[_0xffb4('0xa2')]){if(_0x235fbf[_0xffb4('0x78')]===0x0){_0x235fbf['sendMessageOneNotActive']=![];_0x235fbf['message']=_0xffb4('0x47');loggerSyncQueueSummary['error'](_0xffb4('0xa7'),_0x235fbf[_0xffb4('0x45')],'is\x20not\x20active');}else{_0x235fbf[_0xffb4('0x44')]=_0xffb4('0xa5');loggerSyncQueueSummary['error'](_0xffb4('0xa7'),_0x235fbf[_0xffb4('0x45')],_0xffb4('0xa8'));}emitCampaignSummary(_0x235fbf);}}function createObjHistory(_0x266bf3,_0x1efc58,_0x1b66ea,_0x4f11d7,_0x28aa24){_0x266bf3[_0xffb4('0x44')]=_0x1b66ea;var _0x2c4d96=new Action(_0x266bf3,_0x1efc58);var _0x1c6244=new History(_0x2c4d96);_0x1c6244['state']=_0x4f11d7;_0x1c6244[_0xffb4('0xa9')]=_0x28aa24;_0x1c6244[_0xffb4('0xaa')]=_0x2c4d96[_0xffb4('0xab')];return _0x1c6244;}Dialer[_0xffb4('0xac')][_0xffb4('0x42')]=function(){var _0x32ae97=this;setInterval(function(){_0x32ae97[_0xffb4('0xad')](_0x32ae97['uniqueId'],'[uniqueid]');_0x32ae97['clearZombieChannels'](_0x32ae97[_0xffb4('0xae')],'[actions]');},0x32c8);};Dialer[_0xffb4('0xac')][_0xffb4('0xad')]=function(_0x3a828b,_0x1fa4b0){var _0x49e184=this;for(var _0xe1c1b7 in _0x3a828b){if(typeof _0x3a828b[_0xe1c1b7]!==_0xffb4('0x9c')){this[_0xffb4('0x21')][_0xffb4('0x1e')](function(){if(!_[_0xffb4('0xaf')](_0x3a828b[_0xe1c1b7])){return ami[_0xffb4('0xb0')]({'action':_0xffb4('0xb1'),'channel':_0x3a828b[_0xe1c1b7][_0xffb4('0xb2')]})[_0xffb4('0xb3')](function(_0x1e35b6){if(_0x1e35b6['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x3a828b[_0xe1c1b7]&&_0x3a828b[_0xe1c1b7]['type']!==_0xffb4('0x7f')){_0x49e184[_0xffb4('0xb4')](_0x49e184[_0xffb4('0x23')][_0x3a828b[_0xe1c1b7][_0xffb4('0xb5')]]);logger['error']('[Dialer][checkChannel]',_0x1fa4b0,_0xe1c1b7,_0x3a828b[_0xe1c1b7][_0xffb4('0xb5')]);delete _0x3a828b[_0xe1c1b7];}if(_0x3a828b[_0xe1c1b7]&&_0x3a828b[_0xe1c1b7][_0xffb4('0x52')]==='ivr'){_0x49e184['updateOriginated'](_0x49e184[_0xffb4('0x24')][_0x3a828b[_0xe1c1b7][_0xffb4('0xb5')]]);logger[_0xffb4('0x98')](_0xffb4('0xb6'),_0x1fa4b0,_0xe1c1b7,_0x3a828b[_0xe1c1b7][_0xffb4('0xb5')]);delete _0x3a828b[_0xe1c1b7];}},0x2328);}});}});}}};Dialer[_0xffb4('0xac')][_0xffb4('0xb7')]=function(_0x47af1f){return BPromise['resolve']()[_0xffb4('0xb8')](cmHopper[_0xffb4('0xb7')](_0x47af1f))[_0xffb4('0xb3')](loggerCatch(_0xffb4('0xb9')));};Dialer[_0xffb4('0xac')][_0xffb4('0xba')]=function(_0x58e393){return BPromise[_0xffb4('0xbb')]()[_0xffb4('0xb8')](cmHopperBlack[_0xffb4('0xba')](_0x58e393))[_0xffb4('0xb3')](loggerCatch(_0xffb4('0xbc')));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x51d675){return BPromise['resolve']()['then'](cmHopperBlack[_0xffb4('0xbd')](_0x51d675))[_0xffb4('0xb3')](loggerCatch(_0xffb4('0xbe')));};Dialer['prototype'][_0xffb4('0xbf')]=function(_0xacdeea){return BPromise['resolve']()[_0xffb4('0xb8')](cmHopperHistory[_0xffb4('0xc0')](_0xacdeea))[_0xffb4('0xb3')](loggerCatch(_0xffb4('0xc1')));};Dialer[_0xffb4('0xac')][_0xffb4('0xc2')]=function(_0x436ffd){return BPromise['resolve']()[_0xffb4('0xb8')](cmHopper[_0xffb4('0xc2')](_0x436ffd))[_0xffb4('0xb3')](loggerCatch(_0xffb4('0xc3')));};Dialer['prototype'][_0xffb4('0xc4')]=function(_0x4a4c1a,_0x575e83,_0x6cf15a){return BPromise[_0xffb4('0xbb')]()[_0xffb4('0xb8')](cmHopper[_0xffb4('0xc4')](_0x4a4c1a,_0x575e83,_0x6cf15a))[_0xffb4('0xb3')](loggerCatch('[unlockContact]\x20'));};Dialer[_0xffb4('0xac')][_0xffb4('0xc5')]=function(_0x28024a,_0x2b96ee,_0x206376,_0x4f5b0a){return BPromise[_0xffb4('0xbb')]()['then'](cmHopper[_0xffb4('0xc5')](_0x28024a,_0x2b96ee,_0x206376,_0x4f5b0a))[_0xffb4('0xb3')](loggerCatch(_0xffb4('0xc6')));};Dialer[_0xffb4('0xac')][_0xffb4('0xc7')]=function(_0x19333e,_0x19dbea,_0x245f0e){return BPromise[_0xffb4('0xbb')]()['then'](cmHopper[_0xffb4('0xc7')](_0x19333e,_0x19dbea,_0x245f0e))[_0xffb4('0xb3')](loggerCatch(_0xffb4('0xc6')));};Dialer[_0xffb4('0xac')][_0xffb4('0xc8')]=function(_0x44a522){return BPromise[_0xffb4('0xbb')]()['then'](voiceQueueRt[_0xffb4('0xc8')](_0x44a522))[_0xffb4('0xb3')](loggerCatch(_0xffb4('0xc9')));};Dialer[_0xffb4('0xac')][_0xffb4('0xca')]=function(_0x4b67f2){return BPromise[_0xffb4('0xbb')]()['then'](cmHopper[_0xffb4('0xca')](_0x4b67f2))[_0xffb4('0xb3')](loggerCatch(_0xffb4('0xcb')));};Dialer[_0xffb4('0xac')][_0xffb4('0xcc')]=function(_0x4cc73a){return BPromise['resolve']()[_0xffb4('0xb8')](cmHopperHistory[_0xffb4('0xcc')](_0x4cc73a))[_0xffb4('0xb3')](loggerCatch(_0xffb4('0xcd')));};Dialer[_0xffb4('0xac')][_0xffb4('0xb4')]=function(_0x132cae){if(!_[_0xffb4('0x43')](_0x132cae)&&_0x132cae!==null){if(typeof _0x132cae[_0xffb4('0x78')]!==_0xffb4('0x9c')){if(_0x132cae['originated']>0x0){_0x132cae[_0xffb4('0x78')]-=0x1;}else{logger[_0xffb4('0x98')](_0xffb4('0xce'));}}}else{logger['error'](_0xffb4('0xcf'));}};Dialer[_0xffb4('0xac')][_0xffb4('0xd0')]=function(_0x40a372,_0xa72f17){var _0x2eba89=this;return function(_0x2e319f){_0x2eba89[_0xffb4('0xb4')](_0xa72f17);logger['error'](_0x40a372,util[_0xffb4('0x99')](_0x2e319f,{'showHidden':![],'depth':null}));};};Dialer[_0xffb4('0xac')][_0xffb4('0xd1')]=function(_0x1cc701,_0x237eae,_0x5ca9be){var _0x15c9c4={'state':0x19,'statedesc':_0xffb4('0xd2')};this[_0xffb4('0xb4')](_0x237eae);this['saveInDb'](_['merge'](_0x15c9c4,_[_0xffb4('0xd3')](_0x5ca9be,['ContactId',_0xffb4('0xd4'),_0xffb4('0xd5'),_0xffb4('0xd6'),_0xffb4('0xd7')])),_0xffb4('0xd8'),_0xffb4('0xd9'));logger['error'](_0x1cc701);};Dialer['prototype'][_0xffb4('0xda')]=function(_0x38945f){return _0x38945f===_0xffb4('0xdb');};Dialer[_0xffb4('0xac')][_0xffb4('0xdc')]=function(_0x23fe4c){return!_[_0xffb4('0x43')](_0x23fe4c)&&_0x23fe4c&&!_[_0xffb4('0x43')](_0x23fe4c[_0xffb4('0x45')])&&!_[_0xffb4('0x43')](_0x23fe4c[_0xffb4('0xdd')])&&_0x23fe4c[_0xffb4('0xdd')]&&(this[_0xffb4('0x26')][util[_0xffb4('0x80')](_0xffb4('0xde'),_0x23fe4c['name'])]['status']===_0xffb4('0xdf')||this[_0xffb4('0x26')][util['format'](_0xffb4('0xde'),_0x23fe4c['name'])][_0xffb4('0xb1')]===_0xffb4('0xe0'));};Dialer[_0xffb4('0xac')][_0xffb4('0xe1')]=function(_0x4a4052,_0x1bebaa,_0x3a7174){this['createHistory'](_0x4a4052)['catch'](loggerCatch(_0x1bebaa));this[_0xffb4('0xca')](_0x4a4052)[_0xffb4('0xb3')](loggerCatch(_0x3a7174));};Dialer[_0xffb4('0xac')][_0xffb4('0x3c')]=function(_0x17638f){var _0x312f47=this['uniqueId'][_0x17638f[_0xffb4('0xe2')]];var _0x5c5624;if(!_[_0xffb4('0xaf')](_0x17638f)&&!_['isNil'](_0x17638f['variable'])&&!_[_0xffb4('0xaf')](_0x17638f[_0xffb4('0xe3')][_0xffb4('0xe4')])&&_0x17638f[_0xffb4('0xe5')]==='xcally-motion-dialer'&&_0x312f47){if(_0x312f47[_0xffb4('0x52')]!==_0xffb4('0x7f')&&this[_0xffb4('0x23')][_0x312f47['queue']][_0xffb4('0xe6')]&&_0x17638f['value']===_0xffb4('0xe7')){delete this[_0xffb4('0x29')][_0x17638f[_0xffb4('0xe2')]];this[_0xffb4('0xb4')](this[_0xffb4('0x23')][_0x312f47[_0xffb4('0xb5')]]);this[_0xffb4('0x23')][_0x312f47[_0xffb4('0xb5')]][_0xffb4('0x67')]+=0x1;this[_0xffb4('0x23')][_0x312f47[_0xffb4('0xb5')]][_0xffb4('0x66')]+=0x1;_0x5c5624=new Hangup(_0x312f47,_0x17638f);_0x5c5624['state']=0x12;_0x5c5624['statedesc']=_0xffb4('0xe8');_0x5c5624[_0xffb4('0xe9')]='AMD';this[_0xffb4('0xe1')](_0x5c5624,_0xffb4('0xea'),_0xffb4('0xeb'));}if(_0x312f47[_0xffb4('0x52')]!==_0xffb4('0x7f')&&this[_0xffb4('0x23')][_0x312f47[_0xffb4('0xb5')]][_0xffb4('0xe6')]&&_0x17638f[_0xffb4('0xec')]===_0xffb4('0xed')){var _0x3be4d3=this;return new BPromise(function(_0x3b7638,_0x2ac7a8){delete _0x3be4d3[_0xffb4('0x29')][_0x17638f[_0xffb4('0xe2')]];_0x3be4d3['updateOriginated'](_0x3be4d3[_0xffb4('0x23')][_0x312f47[_0xffb4('0xb5')]]);_0x3be4d3[_0xffb4('0x23')][_0x312f47[_0xffb4('0xb5')]]['outboundAnswerCallsDay']+=0x1;_0x3be4d3['voiceQueues'][_0x312f47[_0xffb4('0xb5')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x31797c=_0x3be4d3[_0xffb4('0x23')][_0x312f47['queue']];var _0x5dc29e=new Hangup(_0x312f47,_0x17638f);_0x5dc29e[_0xffb4('0xee')]=0x13;_0x5dc29e[_0xffb4('0xa9')]='Machine';_0x5dc29e[_0xffb4('0xe9')]=_0xffb4('0xef');_0x5dc29e[_0xffb4('0xf0')]+=0x1;_0x5dc29e[_0xffb4('0xf1')]+=0x1;_0x5dc29e[_0xffb4('0xf2')]=!![];_0x3be4d3['createHistory'](_0x5dc29e)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0xf3')));if(_0x5dc29e['countbusyretry']+_0x5dc29e['countcongestionretry']+_0x5dc29e[_0xffb4('0xf4')]+_0x5dc29e[_0xffb4('0xf5')]+_0x5dc29e[_0xffb4('0xf6')]+_0x5dc29e[_0xffb4('0xf7')]+_0x5dc29e[_0xffb4('0xf0')]+_0x5dc29e[_0xffb4('0xf8')]>=_0x31797c[_0xffb4('0xf9')]){_0x3be4d3['stateGlobal'](_0x5dc29e,_0x3b7638,_0x2ac7a8,_0xffb4('0xfa'));}else{if(_0x5dc29e[_0xffb4('0xf0')]>=_0x31797c[_0xffb4('0xfb')]){_0x3be4d3[_0xffb4('0xfc')](_0x5dc29e,_0x3b7638,_0x2ac7a8,_0xffb4('0xfd'));}else{_0x3be4d3['rescheduleContact']({'active':![],'countmachineretry':_0x5dc29e['countmachineretry'],'scheduledat':moment()[_0xffb4('0xfe')](_0x31797c[_0xffb4('0xff')],_0xffb4('0x100'))['format'](_0xffb4('0x101')),'ContactId':_0x5dc29e['ContactId'],'ListId':_0x5dc29e[_0xffb4('0xd4')],'VoiceQueueId':_0x5dc29e[_0xffb4('0xd6')]||undefined,'CampaignId':_0x5dc29e['CampaignId']||undefined})[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x102')));_0x3b7638({'reschedule':0x1});}}});}if(_0x312f47[_0xffb4('0x52')]===_0xffb4('0x7f')&&this['campaigns'][_0x312f47[_0xffb4('0xb5')]]['dialAMDActive']&&_0x17638f[_0xffb4('0xec')]===_0xffb4('0xe7')){delete this[_0xffb4('0x29')][_0x17638f['uniqueid']];this[_0xffb4('0xb4')](this['campaigns'][_0x312f47['queue']]);_0x5c5624=new Hangup(_0x312f47,_0x17638f);_0x5c5624[_0xffb4('0xee')]=0x12;_0x5c5624[_0xffb4('0xa9')]=_0xffb4('0xe8');_0x5c5624[_0xffb4('0xe9')]=_0xffb4('0xef');this[_0xffb4('0xe1')](_0x5c5624,'[syncHangupInAMDIvr][createHistory]',_0xffb4('0x103'));}if(_0x312f47[_0xffb4('0x52')]===_0xffb4('0x7f')&&this[_0xffb4('0x24')][_0x312f47[_0xffb4('0xb5')]]['dialAMDActive']&&_0x17638f[_0xffb4('0xec')]===_0xffb4('0xed')){var _0x3be4d3=this;return new BPromise(function(_0x1b4e75,_0x490fad){delete _0x3be4d3[_0xffb4('0x29')][_0x17638f['uniqueid']];_0x3be4d3['updateOriginated'](_0x3be4d3[_0xffb4('0x24')][_0x312f47[_0xffb4('0xb5')]]);_0x3be4d3[_0xffb4('0x24')][_0x312f47[_0xffb4('0xb5')]][_0xffb4('0x67')]+=0x1;_0x3be4d3[_0xffb4('0x24')][_0x312f47['queue']][_0xffb4('0x66')]+=0x1;var _0xbff707=_0x3be4d3[_0xffb4('0x24')][_0x312f47['queue']];var _0x3070e2=new Hangup(_0x312f47,_0x17638f);_0x3070e2[_0xffb4('0xee')]=0x13;_0x3070e2[_0xffb4('0xa9')]=_0xffb4('0x104');_0x3070e2[_0xffb4('0xe9')]='AMD';_0x3070e2[_0xffb4('0xf0')]+=0x1;_0x3070e2[_0xffb4('0xf1')]+=0x1;_0x3070e2['amd']=!![];_0x3be4d3[_0xffb4('0xcc')](_0x3070e2)['catch'](loggerCatch(_0xffb4('0xf3')));if(_0x3070e2[_0xffb4('0x105')]+_0x3070e2[_0xffb4('0x106')]+_0x3070e2['countnoanswerretry']+_0x3070e2[_0xffb4('0xf5')]+_0x3070e2[_0xffb4('0xf6')]+_0x3070e2['countabandonedretry']+_0x3070e2[_0xffb4('0xf0')]+_0x3070e2[_0xffb4('0xf8')]>=_0xbff707['dialGlobalMaxRetry']){_0x3be4d3[_0xffb4('0x107')](_0x3070e2,_0x1b4e75,_0x490fad,_0xffb4('0xfa'));}else{if(_0x3070e2['countmachineretry']>=_0xbff707[_0xffb4('0xfb')]){_0x3be4d3[_0xffb4('0xfc')](_0x3070e2,_0x1b4e75,_0x490fad,_0xffb4('0xfd'));}else{_0x3be4d3[_0xffb4('0xc2')]({'active':![],'countmachineretry':_0x3070e2[_0xffb4('0xf0')],'scheduledat':moment()[_0xffb4('0xfe')](_0xbff707[_0xffb4('0xff')],_0xffb4('0x100'))['format'](_0xffb4('0x101')),'ContactId':_0x3070e2[_0xffb4('0x108')],'ListId':_0x3070e2[_0xffb4('0xd4')],'VoiceQueueId':_0x3070e2[_0xffb4('0xd6')]||undefined,'CampaignId':_0x3070e2[_0xffb4('0xd7')]||undefined})['catch'](loggerCatch(_0xffb4('0x102')));_0x1b4e75({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xffb4('0x38')]=function(_0xfe6a40){var _0x586e9a=this[_0xffb4('0x29')][_0xfe6a40[_0xffb4('0xe2')]];var _0x50cdd6=this;var _0x1ba099;if(_0x586e9a&&_0x586e9a['type']===_0xffb4('0x7f')){delete this['uniqueId'][_0xfe6a40['uniqueid']];this[_0xffb4('0xb4')](this[_0xffb4('0x24')][_0x586e9a['queue']]);this[_0xffb4('0x24')][_0x586e9a['queue']]['ivrAnswerCallsDay']+=0x1;_0x1ba099=new Hangup(_0x586e9a,_0xfe6a40);this[_0xffb4('0xcc')](_0x1ba099)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xffb4('0xca')](_0x1ba099)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x109')));}if(_0x586e9a&&_0x586e9a[_0xffb4('0x52')]!=='ivr'&&isNotNull(this[_0xffb4('0x23')][_0x586e9a[_0xffb4('0xb5')]]['dialQueueProject'])){delete this[_0xffb4('0x29')][_0xfe6a40[_0xffb4('0xe2')]];this[_0xffb4('0xb4')](this['voiceQueues'][_0x586e9a[_0xffb4('0xb5')]]);this['voiceQueues'][_0x586e9a[_0xffb4('0xb5')]][_0xffb4('0x67')]+=0x1;this[_0xffb4('0x23')][_0x586e9a[_0xffb4('0xb5')]][_0xffb4('0x66')]+=0x1;_0x1ba099=new Hangup(_0x586e9a,_0xfe6a40);_0x1ba099['state']=0x10;_0x1ba099[_0xffb4('0xa9')]=_0xffb4('0x10a');_0x1ba099[_0xffb4('0xe9')]=_0xffb4('0x10b');this[_0xffb4('0xcc')](_0x1ba099)['catch'](loggerCatch(_0xffb4('0x10c')));this['moveContactManagedDialer'](_0x1ba099)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x109')));}if(_0x586e9a&&_0x586e9a[_0xffb4('0x52')]!=='ivr'&&!isNotNull(this['voiceQueues'][_0x586e9a[_0xffb4('0xb5')]][_0xffb4('0x10d')])){delete this[_0xffb4('0x29')][_0xfe6a40[_0xffb4('0xe2')]];this[_0xffb4('0xb4')](this[_0xffb4('0x23')][_0x586e9a[_0xffb4('0xb5')]]);this['voiceQueues'][_0x586e9a[_0xffb4('0xb5')]][_0xffb4('0x6e')]+=0x1;_0x1ba099=new Hangup(_0x586e9a,_0xfe6a40);_0x1ba099[_0xffb4('0xee')]=0xc;_0x1ba099[_0xffb4('0xa9')]=_0xfe6a40['cause-txt'];_0x1ba099[_0xffb4('0xe9')]=_0xffb4('0x10e');this[_0xffb4('0xcc')](_0x1ba099)[_0xffb4('0xb3')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xffb4('0xca')](_0x1ba099)['catch'](loggerCatch(_0xffb4('0x109')));}};Dialer[_0xffb4('0xac')]['syncAgentComplete']=function(_0x1401ce){var _0x5a3916=this[_0xffb4('0x29')][_0x1401ce['uniqueid']];var _0xfaf477=this;if(this['voiceQueues'][_0x1401ce[_0xffb4('0xb5')]]){if(_0x5a3916&&_0x5a3916[_0xffb4('0x52')]!==_0xffb4('0x7f')){delete this[_0xffb4('0x29')][_0x1401ce[_0xffb4('0xe2')]];this['voiceQueues'][_0x1401ce[_0xffb4('0xb5')]]['outboundAnswerCallsDay']+=0x1;var _0x422cb4=new AgentComplete(_0x5a3916,_0x1401ce);if(_0x1401ce[_0xffb4('0x10f')]==='agent'){_0x422cb4[_0xffb4('0x110')]=this[_0xffb4('0x23')][_0x1401ce[_0xffb4('0xb5')]][_0xffb4('0x111')]&&this[_0xffb4('0x23')][_0x1401ce[_0xffb4('0xb5')]]['dialAgiAfterHangupAgent']?moment()[_0xffb4('0x80')](_0xffb4('0x101')):undefined;}this['createHistory'](_0x422cb4)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x112')));this['moveContactManagedDialer'](_0x422cb4)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x113')));}}};Dialer[_0xffb4('0xac')][_0xffb4('0x114')]=function(_0x67f66d){if(this['voiceQueues'][_0x67f66d[_0xffb4('0xb5')]]){if(this[_0xffb4('0x29')][_0x67f66d['uniqueid']]&&this[_0xffb4('0x29')][_0x67f66d['uniqueid']]['type']!=='ivr'){this[_0xffb4('0xb4')](this[_0xffb4('0x23')][_0x67f66d[_0xffb4('0xb5')]]);this[_0xffb4('0x29')][_0x67f66d[_0xffb4('0xe2')]]['answertime']=moment()['format'](_0xffb4('0x101'));}}};Dialer['prototype'][_0xffb4('0x115')]=function(_0x58db6c){this[_0xffb4('0xcc')](_0x58db6c)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x112')));this[_0xffb4('0xca')](_0x58db6c)[_0xffb4('0xb3')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0xffb4('0xac')][_0xffb4('0x32')]=function(_0x442e8a){var _0xc444ec=this['uniqueId'][_0x442e8a[_0xffb4('0xe2')]];var _0x1ee99d=this;if(this['voiceQueues'][_0x442e8a['queue']]){if(_0xc444ec&&_0xc444ec[_0xffb4('0x52')]!==_0xffb4('0x7f')){delete this[_0xffb4('0x29')][_0x442e8a[_0xffb4('0xe2')]];this[_0xffb4('0xb4')](this['voiceQueues'][_0x442e8a['queue']]);_0xc444ec[_0xffb4('0x116')]=moment()['format'](_0xffb4('0x101'));var _0x55e7f7=new QueueCallerAbandon(_0xc444ec,_0x442e8a);if(getSeconds(_0xc444ec['droptime'],_0xc444ec[_0xffb4('0x117')])>=_0xc444ec[_0xffb4('0x118')]){this[_0xffb4('0x23')][_0x442e8a[_0xffb4('0xb5')]][_0xffb4('0x87')]+=0x1;this[_0xffb4('0x23')][_0x442e8a['queue']][_0xffb4('0x6b')]+=0x1;this[_0xffb4('0x23')][_0x442e8a[_0xffb4('0xb5')]][_0xffb4('0x72')]+=0x1;_0x55e7f7['state']=0xa;_0x55e7f7[_0xffb4('0xa9')]=_0xffb4('0x119');_0x55e7f7[_0xffb4('0x11a')]=_0xffb4('0x11b');_0x55e7f7[_0xffb4('0x110')]=this[_0xffb4('0x23')][_0x442e8a[_0xffb4('0xb5')]]['dialQueueProject2']?moment()[_0xffb4('0x80')](_0xffb4('0x101')):undefined;_0x55e7f7['countdropretry']+=0x1;_0x55e7f7[_0xffb4('0xf1')]+=0x1;if(_0x55e7f7[_0xffb4('0xf6')]>=this[_0xffb4('0x23')][_0x442e8a[_0xffb4('0xb5')]][_0xffb4('0x11c')]){this[_0xffb4('0x115')](_0x55e7f7);}else{this[_0xffb4('0xc2')]({'active':![],'countdropretry':_0x55e7f7[_0xffb4('0xf6')],'scheduledat':moment()['add'](this[_0xffb4('0x23')][_0x442e8a['queue']]['dialDropRetryFrequency'],_0xffb4('0x100'))['format'](_0xffb4('0x101')),'ContactId':_0xc444ec[_0xffb4('0x108')],'ListId':_0xc444ec[_0xffb4('0xd4')],'VoiceQueueId':_0xc444ec[_0xffb4('0xd6')]||undefined,'CampaignId':_0xc444ec[_0xffb4('0xd7')]||undefined})[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x11d')));var _0x57b260=new History(_0x55e7f7);_0x57b260[_0xffb4('0xee')]=0xa;_0x57b260[_0xffb4('0xa9')]='Drop';_0x57b260[_0xffb4('0xab')]=moment()[_0xffb4('0x80')](_0xffb4('0x101'));_0x57b260['endtime']=_0x57b260[_0xffb4('0xab')];_0x57b260['calleridname']=_0x55e7f7[_0xffb4('0x11e')];_0x57b260[_0xffb4('0x11f')]=_0x55e7f7[_0xffb4('0x11f')];this[_0xffb4('0xcc')](_0x57b260)[_0xffb4('0xb3')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xffb4('0x23')][_0x442e8a[_0xffb4('0xb5')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xffb4('0x23')][_0x442e8a[_0xffb4('0xb5')]][_0xffb4('0x6a')]+=0x1;_0x55e7f7[_0xffb4('0xee')]=0xb;_0x55e7f7[_0xffb4('0xa9')]=_0xffb4('0x120');_0x55e7f7[_0xffb4('0x11a')]=_0xffb4('0x121');_0x55e7f7[_0xffb4('0xf7')]+=0x1;_0x55e7f7[_0xffb4('0xf1')]+=0x1;if(_0x55e7f7[_0xffb4('0xf7')]>=this[_0xffb4('0x23')][_0x442e8a[_0xffb4('0xb5')]][_0xffb4('0x122')]){this[_0xffb4('0x115')](_0x55e7f7);}else{this[_0xffb4('0xc2')]({'active':![],'countabandonedretry':_0x55e7f7[_0xffb4('0xf7')],'scheduledat':moment()['add'](this[_0xffb4('0x23')][_0x442e8a[_0xffb4('0xb5')]][_0xffb4('0x123')],_0xffb4('0x100'))[_0xffb4('0x80')](_0xffb4('0x101')),'ContactId':_0xc444ec['ContactId'],'ListId':_0xc444ec[_0xffb4('0xd4')],'VoiceQueueId':_0xc444ec['VoiceQueueId']||undefined,'CampaignId':_0xc444ec['CampaignId']||undefined})[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x124')));var _0x57b260=new History(_0x55e7f7);_0x57b260[_0xffb4('0xee')]=0xb;_0x57b260[_0xffb4('0xa9')]=_0xffb4('0x120');_0x57b260[_0xffb4('0xab')]=moment()[_0xffb4('0x80')]('YYYY-MM-DD\x20HH:mm:ss');_0x57b260['endtime']=_0x57b260[_0xffb4('0xab')];_0x57b260['calleridname']=_0x55e7f7[_0xffb4('0x11e')];_0x57b260[_0xffb4('0x11f')]=_0x55e7f7['calleridnum'];this[_0xffb4('0xcc')](_0x57b260)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x125')));}}}}};Dialer[_0xffb4('0xac')][_0xffb4('0x3a')]=function(_0x2f40ee){if(this[_0xffb4('0xae')][_0x2f40ee[_0xffb4('0xe2')]]){this[_0xffb4('0xae')][_0x2f40ee[_0xffb4('0xe2')]][_0xffb4('0xb2')]=_0x2f40ee['channel'];}if(this[_0xffb4('0x29')][_0x2f40ee['uniqueid']]){this['uniqueId'][_0x2f40ee[_0xffb4('0xe2')]]['channel']=_0x2f40ee[_0xffb4('0xb2')];}};Dialer[_0xffb4('0xac')][_0xffb4('0x3e')]=function(_0x5e9edf){if(strategy[this[_0xffb4('0x23')][this[_0xffb4('0xae')][_0x5e9edf[_0xffb4('0x126')]]['queue']][_0xffb4('0x54')]]===_0xffb4('0x1d')){if(this[_0xffb4('0xae')][_0x5e9edf[_0xffb4('0x126')]]&&_[_0xffb4('0xaf')](this[_0xffb4('0xae')][_0x5e9edf['actionid']]['locked'])&&_0x5e9edf['status']==='1'&&_0x5e9edf[_0xffb4('0x127')]==='0'){if(this[_0xffb4('0x25')][_0x5e9edf[_0xffb4('0x128')]]){if(!this[_0xffb4('0x25')][_0x5e9edf['stateinterface']][_0xffb4('0x129')]){this['agents'][_0x5e9edf[_0xffb4('0x128')]][_0xffb4('0x129')]=!![];this[_0xffb4('0xae')][_0x5e9edf['actionid']][_0xffb4('0x129')]=!![];this[_0xffb4('0xae')][_0x5e9edf[_0xffb4('0x126')]][_0xffb4('0x128')]=_0x5e9edf[_0xffb4('0x128')];}}}}else if((strategy[this[_0xffb4('0x23')][this[_0xffb4('0xae')][_0x5e9edf[_0xffb4('0x126')]][_0xffb4('0xb5')]][_0xffb4('0x54')]]||_0xffb4('0x1c'))===_0xffb4('0x1c')){if(this[_0xffb4('0xae')][_0x5e9edf[_0xffb4('0x126')]]){if(this['agents'][_0x5e9edf[_0xffb4('0x128')]]){this[_0xffb4('0xae')][_0x5e9edf[_0xffb4('0x126')]]['stateinterface']=_0x5e9edf[_0xffb4('0x128')];if(_[_0xffb4('0xaf')](this[_0xffb4('0x2d')][this[_0xffb4('0xae')][_0x5e9edf[_0xffb4('0x126')]][_0xffb4('0xb5')]])){this['queueBooked'][this[_0xffb4('0xae')][_0x5e9edf['actionid']][_0xffb4('0xb5')]]=[];}this['queueBooked'][this['actions'][_0x5e9edf[_0xffb4('0x126')]]['queue']]['push'](_[_0xffb4('0x92')](_[_0xffb4('0xd3')](this['actions'][_0x5e9edf[_0xffb4('0x126')]],[_0xffb4('0x12a'),'stateinterface']),{'status':_0x5e9edf['status'],'paused':_0x5e9edf[_0xffb4('0x127')]}));}}}};function unlockQueueStatus(_0x549dd3,_0x17de1f){setTimeout(function(){if(_[_0xffb4('0x43')](_0x549dd3['queueStatusComplete'])){loggerBooked['error'](_0xffb4('0x12b'),_0x17de1f);}_0x549dd3[_0xffb4('0x12c')]=!![];loggerBooked[_0xffb4('0x85')](_0xffb4('0x12d'),_0x17de1f,JSON[_0xffb4('0x4d')](_[_0xffb4('0xd3')](_0x549dd3,[_0xffb4('0x45'),'queueStatusComplete'])));},0x1f3);}Dialer[_0xffb4('0xac')][_0xffb4('0x40')]=function(_0x1e9947){var _0x4f49b1=this;var _0x5d0e38=_0x4f49b1['voiceQueues'][_0x4f49b1[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xb5')]];if(strategy[this['voiceQueues'][this[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xb5')]][_0xffb4('0x54')]]===_0xffb4('0x1d')){if(this[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]]&&this[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0x128')]){this[_0xffb4('0x22')][_0xffb4('0x12e')](this[_0xffb4('0xae')][_0x1e9947['actionid']][_0xffb4('0x12a')],this[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0x128')])[_0xffb4('0xb3')](function(_0x17f793){logger[_0xffb4('0x98')](_0xffb4('0x12f'),util[_0xffb4('0x99')](_0x17f793,{'showHidden':![],'depth':null}));})['finally'](function(){_0x4f49b1[_0xffb4('0xb4')](_0x4f49b1[_0xffb4('0x23')][_0x4f49b1[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xb5')]]);_0x4f49b1[_0xffb4('0x25')][_0x4f49b1[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]]['stateinterface']][_0xffb4('0x129')]=![];delete _0x4f49b1[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]];unlockQueueStatus(_0x5d0e38);});}else{this[_0xffb4('0xb4')](this[_0xffb4('0x23')][this['actions'][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xb5')]]);this[_0xffb4('0xc2')]({'active':![],'ContactId':this[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0x108')],'ListId':this[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xd4')],'VoiceQueueId':this['actions'][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xd6')]||undefined,'CampaignId':this[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xd7')]||undefined})['catch'](loggerCatch(_0xffb4('0x130')));delete this['actions'][_0x1e9947[_0xffb4('0x126')]];unlockQueueStatus(_0x5d0e38);}}else if((strategy[this['voiceQueues'][this['actions'][_0x1e9947['actionid']]['queue']][_0xffb4('0x54')]]||'rrmemory')===_0xffb4('0x1c')){var _0x5e8e13;if(this[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]]&&!_[_0xffb4('0x83')](this[_0xffb4('0x2d')][this[_0xffb4('0xae')][_0x1e9947['actionid']][_0xffb4('0xb5')]])){if(this[_0xffb4('0x2e')][_0x4f49b1[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xb5')]]){this[_0xffb4('0x2e')][_0x4f49b1['actions'][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xb5')]]=this[_0xffb4('0x2e')][this[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xb5')]]?this['queueBookedRR'][this[_0xffb4('0xae')][_0x1e9947['actionid']][_0xffb4('0xb5')]]:this[_0xffb4('0x2d')][this[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xb5')]]?this[_0xffb4('0x2d')][this['actions'][_0x1e9947['actionid']][_0xffb4('0xb5')]][_0xffb4('0x131')]||0x0:0x0;}this[_0xffb4('0x2d')][this['actions'][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xb5')]][_0xffb4('0x131')]=this['queueBookedRR'][this[_0xffb4('0xae')][_0x1e9947[_0xffb4('0x126')]][_0xffb4('0xb5')]];for(var _0x254478=0x0;_0x254478=0x0;})['catch'](myreject(_0x4334de)));}}else{_0x4f06d6[_0xffb4('0x14c')](ami[_0xffb4('0xb0')]({'action':_0xffb4('0x147'),'command':util['format'](_0xffb4('0x148'),_0x5aed26,!_[_0xffb4('0x43')](config['timezones'][_0xda15c9])?_0xda15c9:'')})[_0xffb4('0xb8')](function(_0x460590){return _0x460590[_0xffb4('0x14b')][_0xffb4('0x14d')](_0xffb4('0x14e'))>=0x0;})['catch'](myreject(_0x4334de)));}BPromise[_0xffb4('0x14f')](_0x4f06d6)[_0xffb4('0xb8')](function(_0x45f475){var _0x376aee=_[_0xffb4('0x150')](_0x45f475);if(_0x376aee){return _0xee19db(_0x376aee);}else{_0xa4d956[_0xffb4('0x44')]=_0x336625?_0xffb4('0x151'):_0xffb4('0x152');return _0x4334de(msgResponse('[ifTime][promiseAll]',_0xffb4('0x140'),'Global:\x20'+_0x336625+'\x20'+_0x388e3e+_0xffb4('0x153')+util[_0xffb4('0x99')](_0x5aed26,{'showHidden':![],'depth':null})+_0xffb4('0x154')+_0xda15c9));}})[_0xffb4('0xb3')](function(_0xc86a26){return _0x4334de(msgResponse(_0xffb4('0x13f'),_0xffb4('0x140'),JSON['stringify'](_0xc86a26)));});});};Dialer[_0xffb4('0xac')][_0xffb4('0x155')]=function(_0x306618){var _0x4154c2=this;return function(){switch(_0x306618[_0xffb4('0x61')]){case _0xffb4('0x156'):freeVariablesPredictive(_0x306618);_0x4154c2[_0xffb4('0x157')](_0x306618,0x1);break;case _0xffb4('0x158'):freeVariablesPredictive(_0x306618);_0x4154c2[_0xffb4('0x157')](_0x306618,_0x306618[_0xffb4('0x159')]);break;case _0xffb4('0xb'):_0x4154c2[_0xffb4('0xb')](_0x306618);break;case _0xffb4('0xa'):freeVariablesPredictive(_0x306618);_0x4154c2[_0xffb4('0x157')](_0x306618,0x1);break;default:freeVariablesPredictive(_0x306618);logger['error'](_0xffb4('0x15a'),_0x306618[_0xffb4('0x45')],_0xffb4('0x15b'));}};};Dialer['prototype']['launchHandleIvr']=function(_0x1e0a2e){var _0x57c357=this;return function(){_0x57c357[_0xffb4('0x15c')](_0x1e0a2e);};};Dialer[_0xffb4('0xac')][_0xffb4('0xc')]=function(_0x37f0c8){var _0x84258=this;if(isNotPreview(_0x37f0c8[_0xffb4('0x61')])){if(isVoiceQueueOutbound(_0x37f0c8[_0xffb4('0x52')])&&isActive(_0x37f0c8[_0xffb4('0x60')])){_0x37f0c8['sendMessageOneNotActive']=!![];BPromise[_0xffb4('0xbb')]()[_0xffb4('0xb8')](checkIsLoggedIn(_0x37f0c8,_0x37f0c8[_0xffb4('0x57')]))[_0xffb4('0xb8')](checkIsActive(_0x37f0c8,_0x37f0c8[_0xffb4('0x60')]))['then'](checkInterval(_0x37f0c8))[_0xffb4('0xb8')](_0x84258[_0xffb4('0x13b')](_0x37f0c8))['then'](_0x84258['checkIfTime'](_0x37f0c8[_0xffb4('0x15d')],_0x37f0c8[_0xffb4('0x15e')],_0x37f0c8[_0xffb4('0x45')],_0x37f0c8))[_0xffb4('0xb8')](_0x84258[_0xffb4('0x15f')](_0x37f0c8[_0xffb4('0x48')],_0x37f0c8[_0xffb4('0x15e')],_0x37f0c8[_0xffb4('0x45')],_0x37f0c8))[_0xffb4('0xb8')](_0x84258[_0xffb4('0x155')](_0x37f0c8))['catch'](loggerCatchQueueSummary(_0xffb4('0x160'),_0x37f0c8));}else{notSendMessagesQueue(_0x37f0c8);}}else{freeVariablesPredictive(_0x37f0c8);}};Dialer[_0xffb4('0xac')][_0xffb4('0x13a')]=function(){var _0x8e05db=this;var _0x2f50a7;for(var _0x495823 in this[_0xffb4('0x24')]){if(typeof this[_0xffb4('0x24')][_0x495823]!==_0xffb4('0x9c')){_0x2f50a7=this['campaigns'][_0x495823];if(isCampaignIvr(_0x2f50a7[_0xffb4('0x52')])&&isActive(_0x2f50a7[_0xffb4('0xdd')])){_0x2f50a7[_0xffb4('0xa2')]=!![];BPromise[_0xffb4('0xbb')]()[_0xffb4('0xb8')](checkIsActive(_0x2f50a7,_0x2f50a7['active']))[_0xffb4('0xb8')](checkInterval(_0x2f50a7))[_0xffb4('0xb8')](_0x8e05db[_0xffb4('0x13b')](_0x2f50a7))[_0xffb4('0xb8')](_0x8e05db['checkIfTime'](_0x2f50a7[_0xffb4('0x15d')],_0x2f50a7[_0xffb4('0x15e')],_0x2f50a7[_0xffb4('0x45')],_0x2f50a7))['then'](_0x8e05db[_0xffb4('0x15f')](_0x2f50a7[_0xffb4('0x48')],_0x2f50a7[_0xffb4('0x15e')],_0x2f50a7[_0xffb4('0x45')],_0x2f50a7))[_0xffb4('0xb8')](_0x8e05db['launchHandleIvr'](_0x2f50a7))[_0xffb4('0xb3')](loggerCatchQueueSummary(_0xffb4('0x161'),_0x2f50a7));}else{notSendMessagesCampaign(_0x2f50a7);}}}};function getCallerIdRandom(_0x198664,_0x518aac){var _0x273bc3;var _0x124080;var _0x20c64c;if(_0x518aac<=0x0){_0x518aac=0x1;}_0x273bc3=new RegExp('\x5cw{0,'+_0x518aac+'}$');_0x124080=Math['pow'](0xa,_0x518aac-0x1);_0x20c64c=Math[_0xffb4('0x162')](0xa,_0x518aac)-0x1;return util[_0xffb4('0x80')]('%s',_[_0xffb4('0x163')](_0x198664,_0x273bc3,_[_0xffb4('0x164')](_0x124080,_0x20c64c)));}function extractCalleridName(_0x89c6ac){var _0x5e8050=_0x89c6ac['match'](/"(.*?)"/);return _0x5e8050?_0x5e8050[0x1]:_0x89c6ac;}function extractCalleridNumber(_0x133892){var _0x255b68=_0x133892[_0xffb4('0x165')](/<(.*?)>/);return _0x255b68?_0x255b68[0x1]:_0x133892;}Dialer[_0xffb4('0xac')][_0xffb4('0x166')]=function(_0x4f49b3,_0x1aaf03){var _0x2152a4=this;var _0x3d4b97=uuid['v4']();this['actions'][_0x3d4b97]=new Action(_0x4f49b3,_0x1aaf03,_0x3d4b97);return new BPromise(function(_0x55e7d3,_0x48c2bd){if(_[_0xffb4('0x43')](_0x4f49b3)&&typeof _0x4f49b3!==_0xffb4('0x167')){return _0x48c2bd(msgResponse(_0xffb4('0x168'),_0xffb4('0x140'),_0xffb4('0x169')));}if(_[_0xffb4('0x43')](_0x1aaf03['Contact'][_0xffb4('0x16a')])||_0x1aaf03[_0xffb4('0x16b')]['phone']===null){return _0x48c2bd(msgResponse(_0xffb4('0x168'),_0xffb4('0x140'),_0xffb4('0x16c')));}var _0x227bcd={'XMD-CALLERID':_0x2152a4[_0xffb4('0xae')][_0x3d4b97][_0xffb4('0x16d')](),'XMD-AGI':_0x4f49b3['dialQueueProject']?util['format'](_0xffb4('0x16e'),ipAgi,_0x4f49b3[_0xffb4('0x10d')]):_0xffb4('0x16f'),'XMD-AGIAFTER':_0x4f49b3['dialQueueProject2']?util[_0xffb4('0x80')](_0xffb4('0x16e'),ipAgi,_0x4f49b3['dialQueueProject2']):_0xffb4('0x16f'),'XMD-QUEUE':_0x4f49b3['type']==='outbound'?util[_0xffb4('0x80')](_0xffb4('0x170'),_0x4f49b3[_0xffb4('0x45')],_0x4f49b3[_0xffb4('0x171')]||'',_0x4f49b3[_0xffb4('0x172')]?'c':'',_0x4f49b3[_0xffb4('0x118')]||0x3):_0xffb4('0x16f'),'XMD-CONTACTID':_0x1aaf03[_0xffb4('0x108')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x2152a4['actions'][_0x3d4b97][_0xffb4('0x16d')](),'XMD-AMD':_0x4f49b3[_0xffb4('0xe6')]?_0xffb4('0x173'):_0xffb4('0x16f'),'XMD-DESTINATION':_0xffb4('0x174')};if(_0x4f49b3[_0xffb4('0xe6')]){_0x227bcd[_0xffb4('0x175')]=_0x4f49b3[_0xffb4('0x176')]||0x9c4;_0x227bcd['XMD-AMDGREETING']=_0x4f49b3[_0xffb4('0x177')]||0x5dc;_0x227bcd[_0xffb4('0x178')]=_0x4f49b3[_0xffb4('0x179')]||0x320;_0x227bcd[_0xffb4('0x17a')]=_0x4f49b3[_0xffb4('0x17b')]||0x1388;_0x227bcd[_0xffb4('0x17c')]=_0x4f49b3[_0xffb4('0x17d')]||0x64;_0x227bcd[_0xffb4('0x17e')]=_0x4f49b3[_0xffb4('0x17f')]||0x32;_0x227bcd[_0xffb4('0x180')]=_0x4f49b3[_0xffb4('0x181')]||0x3;_0x227bcd[_0xffb4('0x182')]=_0x4f49b3[_0xffb4('0x183')]||0x100;_0x227bcd[_0xffb4('0x184')]=_0x4f49b3[_0xffb4('0x185')]||0x1388;}if(_0x4f49b3[_0xffb4('0x52')]===_0xffb4('0x53')){_0x227bcd[_0xffb4('0x186')]=_0x1aaf03['VoiceQueueId'];}else{_0x227bcd['XMD-CAMPAIGNID']=_0x1aaf03[_0xffb4('0xd7')];}for(var _0x5e57a5 in _0x1aaf03[_0xffb4('0x16b')]){if(typeof _0x1aaf03[_0xffb4('0x16b')][_0x5e57a5]!=='undefined'){if(isNotNull(_0x1aaf03[_0xffb4('0x16b')][_0x5e57a5])&&_0x5e57a5!=='id'&&_0x5e57a5!==_0xffb4('0x187')&&_0x5e57a5!=='createdAt'&&_0x5e57a5!==_0xffb4('0x188')){_0x227bcd[util[_0xffb4('0x80')](_0xffb4('0x189'),_0xffb4('0x18a'),_[_0xffb4('0x18b')](_0x5e57a5))]=_0x1aaf03['Contact'][_0x5e57a5];}}}var _0x69a293=_0x2152a4['isTrunkReachable'](_0x4f49b3['Trunk'])?getCallerId(_0x4f49b3['Trunk']['callerid'],_0x4f49b3[_0xffb4('0x62')],_0x4f49b3['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x4f49b3[_0xffb4('0x63')],_0x4f49b3['dialRandomLastDigitCallerIdNumber']):_0x4f49b3['dialOriginateCallerIdNumber']):getCallerId(_[_0xffb4('0xaf')](_0x4f49b3['TrunkBackup'])?_0x4f49b3[_0xffb4('0x7d')]['callerid']:_0x4f49b3['TrunkBackup']['callerid'],_0x4f49b3[_0xffb4('0x62')],_0x4f49b3[_0xffb4('0x18c')]>0x0?getCallerIdRandom(_0x4f49b3[_0xffb4('0x63')],_0x4f49b3['dialRandomLastDigitCallerIdNumber']):_0x4f49b3[_0xffb4('0x63')]);if(_0x69a293){_0x227bcd['XMD-ORIGINATECALLERIDNAME']=_0x2152a4[_0xffb4('0xae')][_0x3d4b97]['originatecalleridname']=extractCalleridName(_0x69a293);_0x227bcd[_0xffb4('0x18d')]=_0x2152a4['actions'][_0x3d4b97][_0xffb4('0x18e')]=extractCalleridNumber(_0x69a293);}return ami[_0xffb4('0xb0')]({'actionid':_0x3d4b97,'action':_0xffb4('0x168'),'channel':_0x2152a4[_0xffb4('0xdc')](_0x4f49b3[_0xffb4('0x7d')])?util['format'](_0xffb4('0x18f'),_0x4f49b3['Trunk'][_0xffb4('0x45')],isNotNull(_0x4f49b3['dialPrefix'])?_0x4f49b3[_0xffb4('0x65')][_0xffb4('0x190')]()||'':'',_0x4f49b3['dialCutDigit']>0x0?_0x1aaf03['Contact'][_0xffb4('0x16a')][_0xffb4('0x191')](_0x4f49b3[_0xffb4('0x192')]):_0x1aaf03[_0xffb4('0x16b')][_0xffb4('0x16a')]):util[_0xffb4('0x80')](_0xffb4('0x18f'),_[_0xffb4('0xaf')](_0x4f49b3[_0xffb4('0x13c')])?_0x4f49b3[_0xffb4('0x7d')][_0xffb4('0x45')]:_0x4f49b3[_0xffb4('0x13c')][_0xffb4('0x45')],isNotNull(_0x4f49b3[_0xffb4('0x65')])?_0x4f49b3[_0xffb4('0x65')][_0xffb4('0x190')]()||'':'',_0x4f49b3[_0xffb4('0x192')]>0x0?_0x1aaf03[_0xffb4('0x16b')][_0xffb4('0x16a')][_0xffb4('0x191')](_0x4f49b3[_0xffb4('0x192')]):_0x1aaf03[_0xffb4('0x16b')][_0xffb4('0x16a')]),'callerid':_0x69a293,'Exten':_0xffb4('0x174'),'Context':_0xffb4('0x193'),'Priority':'1','variable':_0x227bcd,'timeout':(_0x4f49b3[_0xffb4('0x64')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3d4b97})[_0xffb4('0xb8')](function(_0xea328){return _0x55e7d3(_0xea328);})['catch'](function(_0x5742ad){_0x4f49b3[_0xffb4('0x194')]+=0x1;var _0x47bda0=new History(_0x2152a4['actions'][_0x3d4b97]);logger[_0xffb4('0x98')](util[_0xffb4('0x80')]('[originateError]:\x20%s',JSON[_0xffb4('0x4d')](_0x5742ad)));_0x47bda0[_0xffb4('0xee')]=0xe;_0x47bda0[_0xffb4('0xa9')]=_0xffb4('0x195');_0x47bda0[_0xffb4('0xab')]=moment()[_0xffb4('0x80')](_0xffb4('0x101'));_0x47bda0[_0xffb4('0xaa')]=_0x47bda0[_0xffb4('0xab')];_0x2152a4[_0xffb4('0xcc')](_0x47bda0)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x196')));_0x2152a4['moveContactManagedDialer'](_0x47bda0)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x196')))[_0xffb4('0x20')](function(){delete _0x2152a4[_0xffb4('0xae')][_0x3d4b97];return _0x48c2bd(msgResponse(_0xffb4('0x168'),_0xffb4('0x4c'),_0xffb4('0x197')));});});});};Dialer['prototype'][_0xffb4('0x34')]=function(_0x5df423){var _0x171dfa=this['actions'][_0x5df423['actionid']];if(_0x171dfa){delete this['actions'][_0x5df423[_0xffb4('0x126')]];_0x171dfa[_0xffb4('0x117')]=moment()[_0xffb4('0x80')](_0xffb4('0x101'));var _0x46ca3c=_0x171dfa[_0xffb4('0x52')]==='ivr'?this[_0xffb4('0x24')][_0x171dfa['queue']]:this[_0xffb4('0x23')][_0x171dfa[_0xffb4('0x198')]()];if(!this[_0xffb4('0xda')](_0x5df423[_0xffb4('0x199')])){this['updateOriginated'](_0x46ca3c);return this['callProgressDetecting'](_0x171dfa,_0x46ca3c,_0x5df423)[_0xffb4('0xb3')](loggerCatch('[callProgressDetecting]\x20'));}this[_0xffb4('0x29')][_0x5df423[_0xffb4('0xe2')]]=_0x171dfa;}};Dialer['prototype'][_0xffb4('0x19a')]=function(_0x116eef,_0x23f342,_0x5b7731){var _0x186a87=new History(_0x23f342);if(_0x186a87[_0xffb4('0x105')]+_0x186a87[_0xffb4('0x106')]+_0x186a87['countnoanswerretry']+_0x186a87[_0xffb4('0xf5')]+_0x186a87[_0xffb4('0xf6')]+_0x186a87[_0xffb4('0xf7')]+_0x186a87[_0xffb4('0xf0')]+_0x186a87[_0xffb4('0xf8')]>=_0x5b7731['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x116eef){case 0x3:if(_0x186a87[_0xffb4('0xf4')]>=_0x5b7731[_0xffb4('0x19b')]-0x1){return!![];}this[_0xffb4('0xc2')]({'active':![],'countnoanswerretry':_0x186a87[_0xffb4('0xf4')]+=0x1,'scheduledat':moment()['add'](_0x5b7731[_0xffb4('0x19c')],_0xffb4('0x100'))[_0xffb4('0x80')](_0xffb4('0x101')),'ContactId':_0x186a87[_0xffb4('0x108')],'ListId':_0x186a87['ListId'],'VoiceQueueId':_0x186a87[_0xffb4('0xd6')]||undefined,'CampaignId':_0x186a87[_0xffb4('0xd7')]||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x186a87[_0xffb4('0x105')]>=_0x5b7731[_0xffb4('0x19d')]-0x1){return!![];}this[_0xffb4('0xc2')]({'active':![],'countbusyretry':_0x186a87[_0xffb4('0x105')]+=0x1,'scheduledat':moment()[_0xffb4('0xfe')](_0x5b7731[_0xffb4('0x19e')],'minutes')[_0xffb4('0x80')](_0xffb4('0x101')),'ContactId':_0x186a87[_0xffb4('0x108')],'ListId':_0x186a87[_0xffb4('0xd4')],'VoiceQueueId':_0x186a87[_0xffb4('0xd6')]||undefined,'CampaignId':_0x186a87[_0xffb4('0xd7')]||undefined})[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x19f')));break;case 0x8:if(_0x186a87['countcongestionretry']>=_0x5b7731[_0xffb4('0x1a0')]-0x1){return!![];}this[_0xffb4('0xc2')]({'active':![],'countcongestionretry':_0x186a87[_0xffb4('0x106')]+=0x1,'scheduledat':moment()[_0xffb4('0xfe')](_0x5b7731[_0xffb4('0x1a1')],_0xffb4('0x100'))[_0xffb4('0x80')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x186a87[_0xffb4('0x108')],'ListId':_0x186a87['ListId'],'VoiceQueueId':_0x186a87['VoiceQueueId']||undefined,'CampaignId':_0x186a87[_0xffb4('0xd7')]||undefined})[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x1a2')));break;case 0x0:if(_0x186a87[_0xffb4('0xf5')]>=_0x5b7731[_0xffb4('0x1a3')]-0x1){return!![];}else{this[_0xffb4('0xc2')]({'active':![],'countnosuchnumberretry':_0x186a87[_0xffb4('0xf5')]+=0x1,'scheduledat':moment()[_0xffb4('0xfe')](_0x5b7731[_0xffb4('0x1a4')],'minutes')[_0xffb4('0x80')](_0xffb4('0x101')),'ContactId':_0x186a87['ContactId'],'ListId':_0x186a87[_0xffb4('0xd4')],'VoiceQueueId':_0x186a87[_0xffb4('0xd6')]||undefined,'CampaignId':_0x186a87[_0xffb4('0xd7')]||undefined})['catch'](loggerCatch(_0xffb4('0x1a5')));}break;case 0xa:if(_0x186a87['countdropretry']>=_0x5b7731['dialDropMaxRetry']-0x1){return!![];}this[_0xffb4('0xc2')]({'active':![],'countdropretry':_0x186a87['countdropretry']+=0x1,'scheduledat':moment()[_0xffb4('0xfe')](_0x5b7731[_0xffb4('0x1a6')],'minutes')[_0xffb4('0x80')](_0xffb4('0x101')),'ContactId':_0x186a87[_0xffb4('0x108')],'ListId':_0x186a87[_0xffb4('0xd4')],'VoiceQueueId':_0x186a87['VoiceQueueId']||undefined,'CampaignId':_0x186a87[_0xffb4('0xd7')]||undefined})[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x11d')));break;case 0xb:if(_0x186a87[_0xffb4('0xf7')]>=_0x5b7731[_0xffb4('0x122')]-0x1){return!![];}this[_0xffb4('0xc2')]({'active':![],'countabandonedretry':_0x186a87[_0xffb4('0xf7')]+=0x1,'scheduledat':moment()[_0xffb4('0xfe')](_0x5b7731['dialAbandonedRetryFrequency'],_0xffb4('0x100'))[_0xffb4('0x80')](_0xffb4('0x101')),'ContactId':_0x186a87[_0xffb4('0x108')],'ListId':_0x186a87[_0xffb4('0xd4')],'VoiceQueueId':_0x186a87[_0xffb4('0xd6')]||undefined,'CampaignId':_0x186a87['CampaignId']||undefined})[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x124')));break;case 0x13:if(_0x186a87[_0xffb4('0xf0')]>=_0x5b7731[_0xffb4('0xfb')]-0x1){return!![];}this[_0xffb4('0xc2')]({'active':![],'countmachineretry':_0x186a87[_0xffb4('0xf0')]+=0x1,'scheduledat':moment()[_0xffb4('0xfe')](_0x5b7731['dialMachineRetryFrequency'],_0xffb4('0x100'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x186a87[_0xffb4('0x108')],'ListId':_0x186a87['ListId'],'VoiceQueueId':_0x186a87['VoiceQueueId']||undefined,'CampaignId':_0x186a87[_0xffb4('0xd7')]||undefined})[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x102')));break;case 0x14:if(_0x186a87['countagentrejectretry']>=_0x5b7731['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0xffb4('0xc2')]({'active':![],'countagentrejectretry':_0x186a87[_0xffb4('0xf8')]+=0x1,'scheduledat':moment()[_0xffb4('0xfe')](_0x5b7731[_0xffb4('0x1a7')],_0xffb4('0x100'))[_0xffb4('0x80')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x186a87[_0xffb4('0x108')],'ListId':_0x186a87[_0xffb4('0xd4')],'VoiceQueueId':_0x186a87['VoiceQueueId']||undefined,'CampaignId':_0x186a87[_0xffb4('0xd7')]||undefined})[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x1a8')));break;default:return!![];}};Dialer['prototype'][_0xffb4('0x1a9')]=function(_0x215805,_0x1d58dd,_0x46ba7d){var _0x1b8082=this;var _0x47e28f=new History(_0x215805);return new BPromise(function(_0x475ea3,_0x46712a){if(_['isUndefined'](_0x1d58dd)&&typeof _0x1d58dd!==_0xffb4('0x167')){return _0x46712a(msgResponse('[callProgressDetecting]','Failure','entity\x20is\x20undefine'));}if(_[_0xffb4('0x43')](_0x46ba7d)&&typeof _0x46ba7d!==_0xffb4('0x167')){return _0x46712a(msgResponse(_0xffb4('0x1aa'),_0xffb4('0x140'),'evt\x20is\x20undefine'));}switch(_0x46ba7d['reason']){case'0':_0x1d58dd[_0xffb4('0x1ab')]+=0x1;_0x47e28f[_0xffb4('0xee')]=0x0;_0x47e28f[_0xffb4('0xa9')]='NoSuchNumber';_0x47e28f['countnosuchnumberretry']+=0x1;_0x47e28f[_0xffb4('0xf1')]+=0x1;ami[_0xffb4('0x51')](_0xffb4('0x1ac'),ut[_0xffb4('0x1ad')](_0x215805,_0xffb4('0x1ae')));_0x1b8082['createHistory'](_0x47e28f)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0xf3')));if(_0x1b8082[_0xffb4('0x19a')](0x0,_0x215805,_0x1d58dd)){if(_0x47e28f[_0xffb4('0xf5')]>=_0x1d58dd[_0xffb4('0x1a3')]){_0x1b8082['createStateFinal'](_0x47e28f,_0x475ea3,_0x46712a,_0xffb4('0x1af'));}else{_0x1b8082[_0xffb4('0x107')](_0x47e28f,_0x475ea3,_0x46712a,_0xffb4('0x1af'));}}break;case'3':_0x1d58dd[_0xffb4('0x6c')]+=0x1;_0x47e28f[_0xffb4('0xee')]=0x3;_0x47e28f['statedesc']='NoAnswer';_0x47e28f[_0xffb4('0xf4')]+=0x1;_0x47e28f[_0xffb4('0xf1')]+=0x1;ami[_0xffb4('0x51')]('custom:agentnoanswer',ut['buildObj'](_0x215805,_0xffb4('0x1b0')));_0x1b8082[_0xffb4('0xcc')](_0x47e28f)['catch'](loggerCatch(_0xffb4('0x1b1')));if(_0x1b8082[_0xffb4('0x19a')](0x3,_0x215805,_0x1d58dd)){if(_0x47e28f['countnoanswerretry']>=_0x1d58dd[_0xffb4('0x19b')]){_0x1b8082[_0xffb4('0xfc')](_0x47e28f,_0x475ea3,_0x46712a,_0xffb4('0x1b2'));}else{_0x1b8082[_0xffb4('0x107')](_0x47e28f,_0x475ea3,_0x46712a,_0xffb4('0x1b2'));}}break;case'5':_0x1d58dd[_0xffb4('0x1b3')]+=0x1;_0x47e28f[_0xffb4('0xee')]=0x5;_0x47e28f[_0xffb4('0xa9')]=_0xffb4('0x1b4');_0x47e28f[_0xffb4('0x105')]+=0x1;_0x47e28f['countglobal']+=0x1;ami[_0xffb4('0x51')](_0xffb4('0x1b5'),ut[_0xffb4('0x1ad')](_0x215805,_0xffb4('0x1b6')));_0x1b8082[_0xffb4('0xcc')](_0x47e28f)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x1b7')));if(_0x1b8082[_0xffb4('0x19a')](0x5,_0x215805,_0x1d58dd)){if(_0x47e28f[_0xffb4('0x105')]>=_0x1d58dd[_0xffb4('0x19d')]){_0x1b8082[_0xffb4('0xfc')](_0x47e28f,_0x475ea3,_0x46712a,_0xffb4('0x1b8'));}else{_0x1b8082[_0xffb4('0x107')](_0x47e28f,_0x475ea3,_0x46712a,_0xffb4('0x1b8'));}}break;case'8':_0x1d58dd[_0xffb4('0x69')]+=0x1;_0x47e28f[_0xffb4('0xee')]=0x8;_0x47e28f[_0xffb4('0xa9')]='Congestion';_0x47e28f[_0xffb4('0x106')]+=0x1;_0x47e28f[_0xffb4('0xf1')]+=0x1;ami[_0xffb4('0x51')]('custom:agentcongestion',ut[_0xffb4('0x1ad')](_0x215805,'congestion'));_0x1b8082[_0xffb4('0xcc')](_0x47e28f)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x1b9')));if(_0x1b8082[_0xffb4('0x19a')](0x8,_0x215805,_0x1d58dd)){if(_0x47e28f[_0xffb4('0x106')]>=_0x1d58dd[_0xffb4('0x1a0')]){_0x1b8082[_0xffb4('0xfc')](_0x47e28f,_0x475ea3,_0x46712a,_0xffb4('0x1ba'));}else{_0x1b8082[_0xffb4('0x107')](_0x47e28f,_0x475ea3,_0x46712a,'reason\x208\x20congestion');}}break;case'11':_0x1d58dd['outboundAbandonedCallsDay']+=0x1;_0x47e28f[_0xffb4('0xee')]=0xb;_0x47e28f['statedesc']=_0xffb4('0x120');_0x47e28f[_0xffb4('0xf7')]+=0x1;_0x47e28f['countglobal']+=0x1;_0x1b8082[_0xffb4('0xcc')](_0x47e28f)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x125')));if(_0x1b8082['checkRetriveMax'](0xb,_0x215805,_0x1d58dd)){if(_0x47e28f[_0xffb4('0xf7')]>=_0x1d58dd[_0xffb4('0x122')]){_0x1b8082[_0xffb4('0xfc')](_0x47e28f,_0x475ea3,_0x46712a,_0xffb4('0x1bb'));}else{_0x1b8082[_0xffb4('0x107')](_0x47e28f,_0x475ea3,_0x46712a,_0xffb4('0x1bb'));}}break;case'20':_0x1d58dd[_0xffb4('0x1bc')]+=0x1;_0x47e28f[_0xffb4('0xee')]=0x14;_0x47e28f[_0xffb4('0xa9')]=_0xffb4('0x1bd');_0x47e28f['countagentrejectretry']+=0x1;_0x47e28f[_0xffb4('0xf1')]+=0x1;ami[_0xffb4('0x51')]('custom:agentreject',ut['buildObj'](_0x215805,_0xffb4('0x1be')));_0x1b8082[_0xffb4('0xcc')](_0x47e28f)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x1b8082[_0xffb4('0x19a')](0x14,_0x215805,_0x1d58dd)){if(_0x47e28f[_0xffb4('0xf8')]>=_0x1d58dd['dialAgentRejectMaxRetry']){_0x1b8082['createStateFinal'](_0x47e28f,_0x475ea3,_0x46712a,_0xffb4('0x1bf'));}else{_0x1b8082[_0xffb4('0x107')](_0x47e28f,_0x475ea3,_0x46712a,_0xffb4('0x1bf'));}}break;default:_0x1d58dd['outboundUnknownCallsDay']+=0x1;_0x47e28f[_0xffb4('0xee')]=0xc;_0x47e28f[_0xffb4('0xa9')]=_0x46ba7d['reason'];_0x1b8082[_0xffb4('0xcc')](_0x47e28f)[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x1c0')));if(_0x1b8082[_0xffb4('0x19a')](_0x46ba7d[_0xffb4('0x10f')],_0x215805,_0x1d58dd)){if(_0x47e28f[_0xffb4('0x105')]+_0x47e28f['countcongestionretry']+_0x47e28f[_0xffb4('0xf4')]+_0x47e28f['countnosuchnumberretry']+_0x47e28f[_0xffb4('0xf6')]+_0x47e28f['countabandonedretry']+_0x47e28f['countmachineretry']+_0x47e28f['countagentrejectretry']>=_0x1d58dd[_0xffb4('0xf9')]){_0x1b8082['stateGlobal'](_0x47e28f,_0x475ea3,_0x46712a,_0x46ba7d[_0xffb4('0x10f')]);}else{_0x1b8082[_0xffb4('0xfc')](_0x47e28f,_0x475ea3,_0x46712a,_0x46ba7d[_0xffb4('0x10f')]);}}}});};Dialer[_0xffb4('0xac')]['stateGlobal']=function(_0x37540d,_0xd4fe1f,_0x4d32d9,_0x4872dd){var _0x47b3d7=new Final(_0x37540d);_0x47b3d7[_0xffb4('0xee')]=0xf;_0x47b3d7[_0xffb4('0xa9')]=_0xffb4('0x1c1');this[_0xffb4('0xfc')](_0x47b3d7,_0xd4fe1f,_0x4d32d9,_0x4872dd);};Dialer['prototype'][_0xffb4('0xfc')]=function(_0x398ce7,_0x3660cd,_0x2383df,_0x26c3bd){this['moveContactManagedDialer'](_0x398ce7)['then'](function(){return _0x3660cd(msgResponse(_0xffb4('0x1aa'),'Success',_0x26c3bd));})[_0xffb4('0xb3')](function(){return _0x2383df(msgResponse(_0xffb4('0x1c2'),_0xffb4('0x140'),_0xffb4('0x1c3')));});};Dialer[_0xffb4('0xac')][_0xffb4('0xb')]=function(_0x94073d){var _0x52b9d8=_0x94073d['dialPredictiveOptimizationPercentage']/0x64;var _0x4134e2=_0x94073d['outboundDropCallsDayTimeout']/(_0x94073d[_0xffb4('0x6b')]+_0x94073d[_0xffb4('0x67')]);var _0x1e00a8=Math['round'](_0x94073d[_0xffb4('0x76')]*(_0x94073d[_0xffb4('0x1c4')]/0x64));var _0x203a3f=Math[_0xffb4('0x1c5')](_0x94073d['predictiveIntervalAvailable']*(_0x94073d['predictiveIntervalMinThreshold']/0x64));var _0x1427bb=_0x94073d[_0xffb4('0x56')]+_0x94073d[_0xffb4('0xa3')];var _0x3ecdc=Math['floor'](_0x94073d[_0xffb4('0x79')]*_0x94073d[_0xffb4('0x7b')]*_0x94073d[_0xffb4('0x73')]*_0x94073d[_0xffb4('0x74')]);if(_[_0xffb4('0x43')](_0x94073d['startProgressive'])){if(!_[_0xffb4('0x43')](_0x94073d[_0xffb4('0x2a')])){_0x94073d[_0xffb4('0x2a')]=undefined;loggerPredictive[_0xffb4('0x98')](_0xffb4('0x1c6'),_0xffb4('0x1c7'));}if(!_['isUndefined'](_0x94073d[_0xffb4('0x94')])){loggerPredictive[_0xffb4('0x98')](_0xffb4('0x1c6'),_0xffb4('0x1c8'));clearInterval(_0x94073d[_0xffb4('0x94')]);_0x94073d[_0xffb4('0x94')]=undefined;}_0x94073d[_0xffb4('0x2b')]=moment()['format'](_0xffb4('0x101'));loggerPredictive['info'](_0x94073d[_0xffb4('0x45')],'collection\x20data\x20in\x20progressive\x20at',_0x94073d['startProgressive']);this['handlePower'](_0x94073d,0x1);}else if(ifInterval(_0x94073d[_0xffb4('0x1c9')],_0x94073d[_0xffb4('0x2b')])){this['handlePower'](_0x94073d,0x1);loggerPredictiveCalls[_0xffb4('0x85')]('[startMethodPredictive][StartProgressive][Loop]',_0x94073d[_0xffb4('0x2b')],_0x94073d[_0xffb4('0x45')]);_0x94073d[_0xffb4('0x79')]=0x0;_0x94073d[_0xffb4('0x72')]=0x0;}else if(_0x52b9d8<_0x4134e2&&_0x94073d[_0xffb4('0x1ca')]===_0xffb4('0x1cb')){freeVariablesPredictive(_0x94073d);loggerPredictive[_0xffb4('0x85')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0xffb4('0x1cc'),_0x4134e2,_0xffb4('0x2b'),_0x94073d[_0xffb4('0x45')]);}else if(_0x3ecdc<_0x94073d[_0xffb4('0x72')]&&_0x94073d[_0xffb4('0x1ca')]===_0xffb4('0x1cb')){freeVariablesPredictive(_0x94073d);loggerPredictive['info'](_0xffb4('0x1cd'),_0xffb4('0x1ce'),_0x3ecdc,_0xffb4('0x1cf'),_0x94073d[_0xffb4('0x72')],_0xffb4('0x2b'),_0x94073d['name']);}else if(!ifInterval(_0x94073d['dialPredictiveInterval'],_0x94073d[_0xffb4('0x2b')])&&_[_0xffb4('0x43')](_0x94073d['startPredictive'])&&!_[_0xffb4('0x43')](_0x94073d[_0xffb4('0x2b')])){_0x94073d[_0xffb4('0x2a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xffb4('0x85')](_0x94073d[_0xffb4('0x45')],'started\x20in\x20predictive\x20at',_0x94073d[_0xffb4('0x2a')]);this['averageHandleTime'](_0x94073d['dialPredictiveInterval'])[_0xffb4('0xb8')](this[_0xffb4('0x1d0')](_0x94073d))[_0xffb4('0xb8')](mergeDataErlangB(_0x94073d))[_0xffb4('0xb8')](this[_0xffb4('0x1d1')](_0x94073d))[_0xffb4('0xb3')](loggerCatchPredictive(_0xffb4('0x1d2'),_0x94073d));}else if(!ifInterval(_0x94073d['dialPredictiveInterval'],_0x94073d[_0xffb4('0x2a')])){_0x94073d[_0xffb4('0x72')]=0x0;_0x94073d['startPredictive']=moment()[_0xffb4('0x80')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xffb4('0x85')](_0x94073d[_0xffb4('0x45')],'recalculate\x20predictive\x20at',_0x94073d['startPredictive']);clearInterval(_0x94073d[_0xffb4('0x94')]);_0x94073d[_0xffb4('0x94')]=undefined;this['averageHandleTime'](_0x94073d[_0xffb4('0x1c9')])['then'](this[_0xffb4('0x1d0')](_0x94073d))['then'](mergeDataErlangB(_0x94073d))['then'](this[_0xffb4('0x1d1')](_0x94073d))[_0xffb4('0xb3')](loggerCatchPredictive(_0xffb4('0x1d3'),_0x94073d));}else if(_0x94073d[_0xffb4('0x76')]&&_0x1427bb<_0x94073d[_0xffb4('0x76')]-_0x203a3f){freeVariablesPredictive(_0x94073d);loggerPredictive[_0xffb4('0x85')](_0x94073d[_0xffb4('0x45')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x1427bb,_0xffb4('0x1d4'),_0x94073d[_0xffb4('0x76')],'-',_0x203a3f,'=',_0x94073d[_0xffb4('0x76')]-_0x203a3f,')');}else if(_0x94073d[_0xffb4('0x76')]&&_0x1427bb>_0x94073d[_0xffb4('0x76')]+_0x1e00a8){freeVariablesPredictive(_0x94073d);loggerPredictive[_0xffb4('0x85')](_0x94073d[_0xffb4('0x45')],_0xffb4('0x1d5'),_0x1427bb,_0xffb4('0x1d6'),_0x94073d[_0xffb4('0x76')],'+',_0x1e00a8,'=',_0x94073d[_0xffb4('0x76')]+_0x1e00a8,')');}};Dialer['prototype']['getDataPredictive']=function(_0x2fc3fa){var _0x5124f8=this;return function(_0xf43be4){return new BPromise(function(_0xf97f17,_0x57669d){_[_0xffb4('0x92')](_0x2fc3fa,_0xf43be4[0x0]);if(checkGetDataPredictive(_0xf43be4[0x0])){var _0x3ff149=_0x2fc3fa[_0xffb4('0x76')]=_0x2fc3fa['talking']+_0x2fc3fa[_0xffb4('0x56')];var _0x43ce66=_0x2fc3fa[_0xffb4('0x1c9')]*0x3c;var _0x4a618c=_0xf43be4[0x0]['predictiveIntervalAvgTalktime']+_0xf43be4[0x0][_0xffb4('0x70')];var _0x16b8f2=(_0xf43be4[0x0][_0xffb4('0x6f')]+_0xf43be4[0x0][_0xffb4('0x87')]+_0xf43be4[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xf43be4[0x0]['predictiveIntervalTotalCalls'];_0x2fc3fa[_0xffb4('0x73')]=_0x16b8f2>0x0?_0x16b8f2:0x1;switch(_0x2fc3fa['dialPredictiveOptimization']){case _0xffb4('0x1cb'):var _0x2a0091=_0x2fc3fa[_0xffb4('0x1d7')]/0x64;return _0x5124f8[_0xffb4('0x1d8')](_0x3ff149,_0x43ce66,_0x4a618c,_0x16b8f2,_0x2a0091)['then'](function(_0x549708){return _0xf97f17(_0x549708);});case _0xffb4('0x1d9'):var _0xcd8e3e=_0x2fc3fa['dialPredictiveOptimizationPercentage']/0x64;return _0x5124f8['busyFactor'](_0x3ff149,_0x43ce66,_0x4a618c,_0x16b8f2,_0xcd8e3e)[_0xffb4('0xb8')](function(_0x2e472f){return _0xf97f17(_0x2e472f);});default:return _0x57669d(msgResponse(_0xffb4('0x1da'),_0xffb4('0x140'),_0xffb4('0x1db')));}}else{return _0x57669d(msgResponse(_0xffb4('0x1da'),_0xffb4('0x140'),_0xffb4('0x1dc')));}});};};Dialer[_0xffb4('0xac')]['getDataPredictiveOld']=function(_0x3d7e96){var _0x44a408=this;return function(_0x1a4c1d){return new BPromise(function(_0x3176df,_0x24a498){_['merge'](_0x3d7e96,_0x1a4c1d[0x0]);if(checkGetDataPredictive(_0x1a4c1d[0x0])){loggerPredictive['info'](JSON[_0xffb4('0x4d')](_0x1a4c1d[0x0]));if(_0x3d7e96[_0xffb4('0x1ca')]===_0xffb4('0x1cb')){return _0x44a408[_0xffb4('0xc8')](_0x3d7e96['id'])[_0xffb4('0xb8')](function(_0x56e108){var _0x46bdff=_0x3d7e96[_0xffb4('0x57')]-_0x56e108[0x0][_0xffb4('0x1dd')];var _0x310f79=_0x3d7e96[_0xffb4('0x1c9')]*0x3c;var _0x157051=_0x1a4c1d[0x0][_0xffb4('0x8b')]+_0x1a4c1d[0x0][_0xffb4('0x70')];var _0x3d814f=(_0x1a4c1d[0x0][_0xffb4('0x6f')]+_0x1a4c1d[0x0][_0xffb4('0x87')]+_0x1a4c1d[0x0][_0xffb4('0x1de')])/_0x1a4c1d[0x0]['predictiveIntervalTotalCalls'];var _0x23666e=_0x3d7e96[_0xffb4('0x1d7')]/0x64;_0x3d7e96[_0xffb4('0x75')]=_0x56e108[0x0][_0xffb4('0x1dd')]||0x0;_0x3d7e96[_0xffb4('0x73')]=_0x3d814f>0x0?_0x3d814f:0x1;return _0x44a408[_0xffb4('0x1d8')](_0x46bdff,_0x310f79,_0x157051,_0x3d814f,_0x23666e);})['then'](function(_0xa646d4){return _0x3176df(_0xa646d4);})['catch'](function(_0xc86205){return _0x24a498(msgResponse(_0xffb4('0x1df'),_0xffb4('0x140'),JSON[_0xffb4('0x4d')](_0xc86205)));});}if(_0x3d7e96['dialPredictiveOptimization']===_0xffb4('0x1d9')){return _0x44a408[_0xffb4('0xc8')](_0x3d7e96['id'])[_0xffb4('0xb8')](function(_0x15dde8){var _0x9b0278=_0x3d7e96[_0xffb4('0x57')]-_0x15dde8[0x0]['outboundQueuePauses'];var _0x4fc42a=_0x3d7e96['dialPredictiveInterval']*0x3c;var _0x4f4eb9=_0x1a4c1d[0x0][_0xffb4('0x8b')]+_0x1a4c1d[0x0][_0xffb4('0x70')];var _0x1cc9cd=(_0x1a4c1d[0x0][_0xffb4('0x6f')]+_0x1a4c1d[0x0][_0xffb4('0x87')]+_0x1a4c1d[0x0][_0xffb4('0x1de')])/_0x1a4c1d[0x0][_0xffb4('0x77')];var _0x5bcb77=_0x3d7e96[_0xffb4('0x1d7')]/0x64;_0x3d7e96[_0xffb4('0x75')]=_0x15dde8[0x0][_0xffb4('0x1dd')]||0x0;_0x3d7e96['predictiveIntervalHitRate']=_0x1cc9cd>0x0?_0x1cc9cd:0x1;return _0x44a408[_0xffb4('0x1e0')](_0x9b0278,_0x4fc42a,_0x4f4eb9,_0x1cc9cd,_0x5bcb77);})[_0xffb4('0xb8')](function(_0x1a2fa1){return _0x3176df(_0x1a2fa1);})[_0xffb4('0xb3')](function(_0x6d652){return _0x24a498(msgResponse('[CatchErlangB]','Failure',JSON[_0xffb4('0x4d')](_0x6d652)));});}}else{return _0x24a498(msgResponse(_0xffb4('0x1da'),'Failure',_0xffb4('0x1dc')));}});};};Dialer[_0xffb4('0xac')]['startMethodPredictive']=function(_0x568eb8){var _0x414555=this;return function(){var _0x2f58b1=0x0;var _0x362af4=Math['floor'](_0x568eb8['erlangCallToSecond']*0x3e8);if(_0x362af4>0x0){_0x362af4=_0x362af4<0x64?0x64:_0x362af4;loggerPredictive['info'](_0x568eb8['name'],_0xffb4('0x1e1'),_0x362af4,_0xffb4('0x4e'));_0x568eb8[_0xffb4('0x94')]=setInterval(function(){_0x414555[_0xffb4('0x94')](_0x568eb8);loggerPredictiveCalls[_0xffb4('0x85')](_0xffb4('0x1e2'),_0x2f58b1+=0x1);},_0x362af4);}else{loggerPredictive[_0xffb4('0x85')](_0x568eb8[_0xffb4('0x45')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xffb4('0xac')][_0xffb4('0x1e3')]=function(_0x3aab60,_0x14586b){var _0x12acde=this;return function(_0x1b26d8){if(_['isEmpty'](_0x1b26d8)){if(_['isNil'](_0x14586b[_0xffb4('0xd5')])||!_0x14586b[_0xffb4('0x1e4')]){if(_0x3aab60[_0xffb4('0x61')]===_0xffb4('0xa')){_0x3aab60['queueStatusComplete']=_['isUndefined'](_0x3aab60[_0xffb4('0x12c')])?!![]:_0x3aab60[_0xffb4('0x12c')];var _0x20c7ed=uuid['v4']();_0x12acde[_0xffb4('0xae')][_0x20c7ed]=new Action(_0x3aab60,_0x14586b,_0x20c7ed);loggerBooked[_0xffb4('0x85')](_0xffb4('0x1e5'),_0x20c7ed,_0xffb4('0x1e6'),JSON['stringify'](_0x3aab60[_0xffb4('0x12c')]),_0xffb4('0x1e7'),_0x3aab60[_0xffb4('0x45')]);if(_0x3aab60[_0xffb4('0x12c')]){_0x3aab60[_0xffb4('0x12c')]=![];_0x12acde['queueBooked'][_0x12acde[_0xffb4('0xae')][_0x20c7ed][_0xffb4('0xb5')]]=[];ami['Action']({'actionid':_0x20c7ed,'action':_0xffb4('0x1e8'),'queue':_0x3aab60[_0xffb4('0x45')]})[_0xffb4('0xb3')](function(){_0x12acde[_0xffb4('0xb4')](_0x3aab60);_0x12acde[_0xffb4('0xc2')]({'active':![],'ContactId':_0x12acde['actions'][_0x20c7ed][_0xffb4('0x108')],'ListId':_0x12acde['actions'][_0x20c7ed][_0xffb4('0xd4')],'VoiceQueueId':_0x12acde['actions'][_0x20c7ed][_0xffb4('0xd6')]||undefined,'CampaignId':_0x12acde[_0xffb4('0xae')][_0x20c7ed]['CampaignId']||undefined})[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x1e9')));delete _0x12acde[_0xffb4('0xae')][_0x20c7ed];});}else{loggerBooked[_0xffb4('0x85')](_0xffb4('0x1ea'),JSON[_0xffb4('0x4d')](_0x3aab60[_0xffb4('0x12c')]),_0xffb4('0x1e7'),_0x3aab60[_0xffb4('0x45')]);_0x12acde['updateOriginated'](_0x3aab60);_0x12acde[_0xffb4('0xc2')]({'active':![],'ContactId':_0x12acde[_0xffb4('0xae')][_0x20c7ed][_0xffb4('0x108')],'ListId':_0x12acde[_0xffb4('0xae')][_0x20c7ed][_0xffb4('0xd4')],'VoiceQueueId':_0x12acde[_0xffb4('0xae')][_0x20c7ed][_0xffb4('0xd6')]||undefined,'CampaignId':_0x12acde['actions'][_0x20c7ed][_0xffb4('0xd7')]||undefined})[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x1e9')));delete _0x12acde[_0xffb4('0xae')][_0x20c7ed];}}else{return _0x12acde[_0xffb4('0x166')](_0x3aab60,_0x14586b);}}else{if(getDiff(_0x14586b[_0xffb4('0x1eb')])<_0x3aab60[_0xffb4('0x1ec')]*0x3c){if(_0x14586b[_0xffb4('0x1ed')]&&!_0x14586b['Agent'][_0xffb4('0x1ee')]){_0x12acde['preview'][_0xffb4('0x12e')](_0x14586b['id'])['finally'](function(){_0x12acde[_0xffb4('0xb4')](_0x3aab60);});}else{_0x12acde[_0xffb4('0xc4')]({'active':![]},_0x14586b['id'],0x1)['finally'](function(){_0x12acde[_0xffb4('0xb4')](_0x3aab60);});}}else{_0x3aab60[_0xffb4('0x6d')]+=0x1;_0x12acde[_0xffb4('0xb4')](_0x3aab60);if(_0x3aab60[_0xffb4('0x1ef')]){_0x12acde[_0xffb4('0xc2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x14586b['ContactId'],'ListId':_0x14586b['ListId'],'VoiceQueueId':_0x14586b['VoiceQueueId']||undefined,'CampaignId':_0x14586b[_0xffb4('0xd7')]||undefined})[_0xffb4('0xb3')](loggerCatch(_0xffb4('0x1f0')));_0x12acde['createHistory'](createObjHistory(_0x3aab60,_0x14586b,_0xffb4('0x1f1'),0x17,_0xffb4('0x1f2')))['catch'](loggerCatch(_0xffb4('0x1f3')));}else{_0x12acde['saveInDb'](createObjHistory(_0x3aab60,_0x14586b,_0xffb4('0x1f4'),0x16,'RecallFailedTimeout'),_0xffb4('0x1f5'),'[Originate][HistoryRecallClose]');}}}}else{_0x3aab60[_0xffb4('0x68')]+=0x1;_0x12acde['saveInDb'](createObjHistory(_0x3aab60,_0x14586b,_0xffb4('0x1f6'),0xd,_0xffb4('0x1f7')),'[Originate][historyBlacklist]',_0xffb4('0x1f8'));throw _0xffb4('0x1f9');}};};Dialer[_0xffb4('0xac')][_0xffb4('0x15c')]=function(_0x493431){var _0x266125=this;var _0x14615b=_0x493431[_0xffb4('0x1fa')]-_0x493431[_0xffb4('0x78')]-_0x493431['temp'];emitCampaignSummary(_0x493431);if(_0x14615b>0x0){if(_0x14615b>this[_0xffb4('0x27')]){_0x14615b=this[_0xffb4('0x27')];}_0x493431['temp']+=_0x14615b;this['getContactDialerIvr'](_0x493431['id'],_0x14615b,_0x493431['dialOrderByScheduledAt'])[_0xffb4('0xb8')](function(_0x5cd013){_0x493431[_0xffb4('0x1fb')]-=_0x14615b;_0x493431['temp']=_0x493431['temp']>0x0?_0x493431[_0xffb4('0x1fb')]:0x0;if(!checkContactEmpty(_0x5cd013)){_0x493431[_0xffb4('0x44')]='AVAILABLE_CONTACTS_FINISHED';logger['info']('[getContactCampaign2][Empty]'+_0x493431[_0xffb4('0x45')]);}else{_0x493431[_0xffb4('0x78')]+=_0x5cd013[_0xffb4('0x9b')];_0x493431['message']='RUNNING';for(var _0x133cff=0x0;_0x133cff<_0x5cd013[_0xffb4('0x9b')];_0x133cff+=0x1){_0x493431['ivrTotalCallsDays']+=0x1;if(_[_0xffb4('0xaf')](_0x5cd013[_0x133cff])||_[_0xffb4('0xaf')](_0x5cd013[_0x133cff][_0xffb4('0x16b')])||_[_0xffb4('0xaf')](_0x5cd013[_0x133cff][_0xffb4('0x16b')]['phone'])){_0x266125['emptyContact'](_0xffb4('0x1fc'),_0x493431,_0x5cd013[_0x133cff]);}else{_0x266125['checkIsBlackListIvr'](_[_0xffb4('0xd3')](_0x5cd013[_0x133cff],['CampaignId','Contact.phone']))['then'](_0x266125[_0xffb4('0x1e3')](_0x493431,_0x5cd013[_0x133cff]))[_0xffb4('0xb3')](_0x266125[_0xffb4('0xd0')](_0xffb4('0x1fd'),_0x493431));}}}})[_0xffb4('0xb3')](loggerGetContactDialer(_0xffb4('0x1fe'),_0x493431,_0x14615b));}};Dialer[_0xffb4('0xac')][_0xffb4('0x157')]=function(_0x1f1397,_0x29f4cd){var _0x983b7b=this;var _0x3ce9fa=[];var _0x8a8a9e=_0x29f4cd>=0x1?_0x29f4cd:0x1;if(_0x1f1397[_0xffb4('0x61')]===_0xffb4('0xa')){_0x8a8a9e=0x1;}var _0x217789=Math[_0xffb4('0x1ff')](_0x1f1397[_0xffb4('0x56')]*_0x8a8a9e)-_0x1f1397[_0xffb4('0x78')]-_0x1f1397['temp'];emitVoiceQueueSummary(_0x1f1397);if(_0x1f1397['dialLimitQueue']>0x0){var _0x50166d=_0x1f1397[_0xffb4('0x200')]-_0x1f1397[_0xffb4('0x78')]-_0x1f1397[_0xffb4('0xa3')]-_0x1f1397[_0xffb4('0x1fb')]-_0x1f1397[_0xffb4('0x58')];if(_0x217789>_0x50166d){_0x217789=_0x50166d;}}if(_0x217789>0x0){if(_0x1f1397['dialMethod']==='booked'){_0x217789=0x1;}if(_0x217789>this[_0xffb4('0x27')]){_0x217789=this[_0xffb4('0x27')];}_0x1f1397[_0xffb4('0x1fb')]+=_0x217789;for(var _0x18a7ef in this[_0xffb4('0x25')]){if(typeof this[_0xffb4('0x25')][_0x18a7ef]!=='undefined'){if(this[_0xffb4('0x25')][_0x18a7ef]['state']===_0xffb4('0x201')&&this[_0xffb4('0x25')][_0x18a7ef][_0xffb4('0xb1')]===_0xffb4('0xdf')){_0x3ce9fa['push'](this['agents'][_0x18a7ef]['id']);}}}this['getContactDialer'](_0x1f1397['id'],_0x3ce9fa,_0x217789,_0x1f1397[_0xffb4('0x202')])[_0xffb4('0xb8')](function(_0x594574){_0x1f1397[_0xffb4('0x1fb')]-=_0x217789;_0x1f1397[_0xffb4('0x1fb')]=_0x1f1397[_0xffb4('0x1fb')]>0x0?_0x1f1397[_0xffb4('0x1fb')]:0x0;if(!checkContactEmpty(_0x594574)){_0x983b7b[_0xffb4('0xb7')](_0x1f1397)[_0xffb4('0xb8')](sendMessageReschedule(_0x1f1397))[_0xffb4('0xb3')](loggerCatch('[countReScheduled]\x20'));}else{_0x1f1397[_0xffb4('0x78')]+=_0x594574[_0xffb4('0x9b')];_0x1f1397[_0xffb4('0x44')]=_0x1f1397[_0xffb4('0x61')]==='booked'?_0xffb4('0x173'):_0xffb4('0x203');for(var _0x970c0e=0x0;_0x970c0e<_0x594574[_0xffb4('0x9b')];_0x970c0e+=0x1){if(_[_0xffb4('0xaf')](_0x594574[_0x970c0e])||_['isNil'](_0x594574[_0x970c0e][_0xffb4('0x16b')])||_[_0xffb4('0xaf')](_0x594574[_0x970c0e][_0xffb4('0x16b')][_0xffb4('0x16a')])){_0x983b7b[_0xffb4('0xd1')](_0xffb4('0x1fc'),_0x1f1397,_0x594574[_0x970c0e]);}else{_0x983b7b[_0xffb4('0xba')](_[_0xffb4('0xd3')](_0x594574[_0x970c0e],[_0xffb4('0xd6'),_0xffb4('0x204')]))[_0xffb4('0xb8')](_0x983b7b['checkContactBlack'](_0x1f1397,_0x594574[_0x970c0e]))[_0xffb4('0xb3')](_0x983b7b[_0xffb4('0xd0')](_0xffb4('0x1fc'),_0x1f1397));}}}})[_0xffb4('0xb3')](loggerGetContactDialer(_0xffb4('0x205'),_0x1f1397,_0x217789));}};Dialer['prototype'][_0xffb4('0x94')]=function(_0x395e84){if(_0x395e84[_0xffb4('0x200')]>0x0){var _0x4ad42d=_0x395e84[_0xffb4('0x200')]-_0x395e84[_0xffb4('0x78')]-_0x395e84[_0xffb4('0xa3')];if(_0x4ad42d>0x0){this['tryOriginatePredictive'](_0x395e84);}else{loggerPredictiveCalls['info'](_0xffb4('0x206'));}}else{this[_0xffb4('0x207')](_0x395e84);}};Dialer['prototype'][_0xffb4('0x207')]=function(_0x50c0aa){var _0x161445=this;var _0x14fc4b=[];_0x50c0aa[_0xffb4('0x78')]+=0x1;for(var _0xa82467 in this['agents']){if(typeof this[_0xffb4('0x25')][_0xa82467]!==_0xffb4('0x9c')){if(this[_0xffb4('0x25')][_0xa82467]['state']===_0xffb4('0x201')&&this[_0xffb4('0x25')][_0xa82467][_0xffb4('0xb1')]===_0xffb4('0xdf')){_0x14fc4b[_0xffb4('0x14c')](this[_0xffb4('0x25')][_0xa82467]['id']);}}}this[_0xffb4('0xc5')](_0x50c0aa['id'],_0x14fc4b,0x1,_0x50c0aa[_0xffb4('0x202')])['then'](function(_0x55348d){if(!checkContactEmpty(_0x55348d)){checkContactLowerLimitOriginate(_0x50c0aa,0x1,0x0);_0x161445[_0xffb4('0xb7')](_0x50c0aa)[_0xffb4('0xb8')](sendMessageReschedule(_0x50c0aa))['catch'](loggerCatch(_0xffb4('0xb9')));}else{_0x50c0aa[_0xffb4('0x44')]=_0xffb4('0x203');if(_[_0xffb4('0xaf')](_0x55348d[0x0])||_[_0xffb4('0xaf')](_0x55348d[0x0][_0xffb4('0x16b')])||_[_0xffb4('0xaf')](_0x55348d[0x0][_0xffb4('0x16b')][_0xffb4('0x16a')])){_0x161445[_0xffb4('0xd1')](_0xffb4('0x1fc'),_0x50c0aa,_0x55348d[0x0]);}else{_0x161445[_0xffb4('0xba')](_['pick'](_0x55348d[0x0],[_0xffb4('0xd6'),'Contact.phone']))[_0xffb4('0xb8')](_0x161445[_0xffb4('0x1e3')](_0x50c0aa,_0x55348d[0x0]))['catch'](_0x161445['loggerHandler'](_0xffb4('0x208'),_0x50c0aa));}}})[_0xffb4('0xb3')](loggerGetContactDialer(_0xffb4('0x209'),_0x50c0aa,0x1));emitVoiceQueueSummary(_0x50c0aa);};Dialer[_0xffb4('0xac')]['abandonmentRate']=function(_0xa38edf,_0x9dfdaa,_0x4b451b,_0x15738b,_0xab1b23,_0x4fe162){loggerPredictive[_0xffb4('0x85')](_0xffb4('0x20a'));loggerPredictive[_0xffb4('0x85')](_0xffb4('0x20b'),_0xa38edf);loggerPredictive[_0xffb4('0x85')](_0xffb4('0x20c'),_0x9dfdaa);loggerPredictive['info'](_0xffb4('0x20d'),_0x4b451b);loggerPredictive[_0xffb4('0x85')]('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',_0x15738b);loggerPredictive[_0xffb4('0x85')](_0xffb4('0x20e'),_0xab1b23);loggerPredictive[_0xffb4('0x85')](_0xffb4('0x8a'));return new BPromise(function(_0x4d2e07,_0x2ac770){if(_0xa38edf<=0x0||isNaN(_0xa38edf)){return _0x2ac770(msgResponse(_0xffb4('0x20f'),'Error','m\x20=\x20'+_0xa38edf));}if(_0x4b451b<=0x0||isNaN(_0x4b451b)){return _0x2ac770(msgResponse(_0xffb4('0x20f'),'Error',_0xffb4('0x210')+_0x4b451b));}if(_0x15738b<=0x0||isNaN(_0x15738b)){return _0x2ac770(msgResponse(_0xffb4('0x20f'),_0xffb4('0x4c'),_0xffb4('0x211')+_0x15738b));}if(_0x9dfdaa<=0x0||isNaN(_0x9dfdaa)){return _0x2ac770(msgResponse(_0xffb4('0x20f'),_0xffb4('0x4c'),_0xffb4('0x212')+_0x9dfdaa));}if(_0xab1b23<=0x0||isNaN(_0xab1b23)){return _0x2ac770(msgResponse(_0xffb4('0x20f'),_0xffb4('0x4c'),'Amax\x20=\x20'+_0xab1b23));}_0x4fe162=_0x4fe162||0x0;var _0x1cbc0d=0x1/_0x4b451b;var _0x120c7a=0x0;var _0x51b0a4=0x0;var _0x11a96b=0x0;var _0xeb759c=0x0;for(var _0x1de0a3=0x0;_0x11a96b<_0xab1b23;_0x1de0a3+=0x1){_0x51b0a4=_0x1de0a3/_0x9dfdaa;_0x120c7a=(_0x15738b*_0x51b0a4+_0x4fe162)/_0x1cbc0d;_0x11a96b=erlangb(_0x120c7a,_0xa38edf);_0xeb759c=_0x120c7a/_0xa38edf*(0x1-erlangb(_0x120c7a,_0xa38edf));}return _0x4d2e07({'erlangCalls':_0x1de0a3,'erlangCallToSecond':_0x9dfdaa/_0x1de0a3,'erlangAbandonmentRate':_0x11a96b,'erlangBusyFactor':_0xeb759c});});};Dialer[_0xffb4('0xac')][_0xffb4('0x1e0')]=function(_0x52627e,_0x70593f,_0x1e141e,_0x48bd0b,_0x36fb66,_0x57e5da){loggerPredictive[_0xffb4('0x85')](_0xffb4('0x213'));loggerPredictive[_0xffb4('0x85')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x52627e);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x70593f);loggerPredictive['info'](_0xffb4('0x20d'),_0x1e141e);loggerPredictive[_0xffb4('0x85')](_0xffb4('0x214'),_0x48bd0b);loggerPredictive[_0xffb4('0x85')](_0xffb4('0x215'),_0x36fb66);loggerPredictive[_0xffb4('0x85')](_0xffb4('0x8a'));return new BPromise(function(_0x45aebc,_0x5603bd){if(_0x52627e<=0x0||isNaN(_0x52627e)){return _0x5603bd(msgResponse(_0xffb4('0x216'),_0xffb4('0x4c'),'m\x20=\x20'+_0x52627e));}if(_0x1e141e<=0x0||isNaN(_0x1e141e)){return _0x5603bd(msgResponse(_0xffb4('0x216'),'Error','Ts\x20=\x20'+_0x1e141e));}if(_0x48bd0b<=0x0||isNaN(_0x48bd0b)){return _0x5603bd(msgResponse(_0xffb4('0x216'),_0xffb4('0x4c'),_0xffb4('0x211')+_0x48bd0b));}if(_0x70593f<=0x0||isNaN(_0x70593f)){return _0x5603bd(msgResponse(_0xffb4('0x216'),'Error',_0xffb4('0x212')+_0x70593f));}if(_0x36fb66<=0x0||isNaN(_0x36fb66)){return _0x5603bd(msgResponse('[busyFactor]',_0xffb4('0x4c'),_0xffb4('0x217')+_0x36fb66));}_0x57e5da=_0x57e5da||0x0;var _0x30a466=0x1/_0x1e141e;var _0xadc7f6=0x0;var _0x23e1bc=0x0;var _0x2a194f=0x0;var _0x303b31=0x0;for(var _0x5bb3e3=0x0;_0x303b31<_0x36fb66;_0x5bb3e3+=0x1){_0x23e1bc=_0x5bb3e3/_0x70593f;_0xadc7f6=(_0x48bd0b*_0x23e1bc+_0x57e5da)/_0x30a466;_0x2a194f=erlangb(_0xadc7f6,_0x52627e);_0x303b31=_0xadc7f6/_0x52627e*(0x1-erlangb(_0xadc7f6,_0x52627e));}return _0x45aebc({'erlangCalls':_0x5bb3e3,'erlangCallToSecond':_0x70593f/_0x5bb3e3,'erlangAbandonmentRate':_0x2a194f,'erlangBusyFactor':_0x303b31});});};module[_0xffb4('0x218')]=Dialer; \ No newline at end of file +var _0xd71e=['dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','talking','agentBusyFactor','busyFactor','[getDataPredictive]','loggedIn','outboundQueuePauses','abandonmentRate','[handlePredictive]','fail\x20to\x20scheduled\x20calls','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','inBlackList','temp','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','dialOrderByScheduledAt','[countReScheduled]\x20','checkContactBlack','[actionOriginate]\x20','[getContactDialer2]','[handlePredictive][limitChannel]','tryOriginatePredictive','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','p\x20=\x20','Amax\x20=\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','exports','util','uuid','moment','md5','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictiveCalls','syncQueueSummary','redis','defaults','../rpc/cmHopper','../rpc/cmHopperHistory','./action','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','rrmemory','roundrobin','prototype','tail','finally','preview','voiceQueues','campaigns','agents','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','queueBooked','bind','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','stringify','milliseconds','type','outbound','strategy','answered','pTalking','sumBillable','sumDuration','sumHoldTime','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','callerid','Interval','format','voice:queue:%s','ivr','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','error','inspect','stack','length','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','sequence','enqueue','isNil','Action','status','channel','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','then','countReScheduled','checkIsBlackList','resolve','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','merge','pick','ContactId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','trunks','SIP/%s','reachable','uniqueid','variable','amdstatus','exten','dialAMDActive','HANGUP','state','HangupInAMD','membername','AMD','[syncHangupInAMD]','value','MACHINE','Machine','countmachineretry','countglobal','amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countbusyretry','dialMachineRetryFrequency','CampaignId','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','agiafterat','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','queueCallerAbandonCreateState','droptime','responsetime','dialQueueTimeout','dropreason','TIMEOUT','dialDropRetryFrequency','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','interval','timezones','content','indexOf','true','push','iftime\x20%s,%s','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','predictive','booked','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','checkIfTime','dialGlobalInterval','dialTimezone','[syncQueueSummary]','syncCampaigns','[syncCampaigns]','\x5cw{0,','pow','replace','random','actionOriginate','object','Contact','phone','originate','\x22agi://%s/square,%s\x22','dialQueueProject2','dialQueueOptions','getCaller','ACTIVE','NONE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','dialOriginateTimeout','OriginateError','[originate][error]','Error','originate\x20action\x20Error','syncOriginateResponse','getQueue','callProgressDetecting','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','evt\x20is\x20undefine','reason','NoSuchNumber','emit','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','buildObj','noanswer','[syncAgentComplete][createHistory][3]'];(function(_0x4b1665,_0xb0c095){var _0x5850c0=function(_0x44b7a4){while(--_0x44b7a4){_0x4b1665['push'](_0x4b1665['shift']());}};_0x5850c0(++_0xb0c095);}(_0xd71e,0x6c));var _0xed71=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xd71e[_0x9cd4c3];return _0x4c9025;};'use strict';var util=require(_0xed71('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0xed71('0x1'));var moment=require(_0xed71('0x2'));var rr=require('rr');var md5=require(_0xed71('0x3'));var Redis=require('ioredis');var ut=require(_0xed71('0x4'));var config=require(_0xed71('0x5'));var logger=require(_0xed71('0x6'))(_0xed71('0x7'));var loggerBooked=require(_0xed71('0x6'))('booked');var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require(_0xed71('0x6'))(_0xed71('0x8'));var loggerSyncQueueSummary=require(_0xed71('0x6'))(_0xed71('0x9'));var ami=require('../ami');config[_0xed71('0xa')]=_[_0xed71('0xb')](config[_0xed71('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xed71('0xa')]));var cmHopper=require(_0xed71('0xc'));var cmHopperHistory=require(_0xed71('0xd'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0xed71('0xe'));var History=require('./history');var Final=require('./final');var AgentComplete=require(_0xed71('0xf'));var QueueCallerAbandon=require(_0xed71('0x10'));var Hangup=require(_0xed71('0x11'));var ipAgi=process['env'][_0xed71('0x12')]||'127.0.0.1';var strategy={'rrmemory':_0xed71('0x13'),'roundrobin':_0xed71('0x14')};var Sequence=function(){};Sequence[_0xed71('0x15')]['enqueue']=function(_0x113885){this[_0xed71('0x16')]=this[_0xed71('0x16')]?this[_0xed71('0x16')][_0xed71('0x17')](_0x113885):_0x113885();};function Dialer(_0x19ec2d,_0x1ebd7c){this['sequence']=new Sequence();this[_0xed71('0x18')]=_0x1ebd7c;this[_0xed71('0x19')]=_0x19ec2d[_0xed71('0x19')];this[_0xed71('0x1a')]=_0x19ec2d[_0xed71('0x1a')];this['agents']=_0x19ec2d[_0xed71('0x1b')];this['trunks']=_0x19ec2d['trunks'];this[_0xed71('0x1c')]=config[_0xed71('0x1c')]||0x2;this[_0xed71('0x1d')]={};this[_0xed71('0x1e')]={};this[_0xed71('0x1f')]={};this[_0xed71('0x20')]={};this[_0xed71('0x21')]={};this['startPredictive']={};this[_0xed71('0x22')]={};this['ivrOriginated']={};this[_0xed71('0x23')]={};this['queueBookedRR']={};ami['on']('agentconnect',this['syncAgentConnect'][_0xed71('0x24')](this));ami['on'](_0xed71('0x25'),this[_0xed71('0x26')][_0xed71('0x24')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0xed71('0x24')](this));ami['on'](_0xed71('0x27'),this[_0xed71('0x28')][_0xed71('0x24')](this));ami['on']('custom:queuesummary',this[_0xed71('0x9')][_0xed71('0x24')](this));ami['on'](_0xed71('0x29'),this[_0xed71('0x2a')][_0xed71('0x24')](this));ami['on'](_0xed71('0x2b'),this[_0xed71('0x2c')]['bind'](this));ami['on'](_0xed71('0x2d'),this[_0xed71('0x2e')][_0xed71('0x24')](this));ami['on'](_0xed71('0x2f'),this[_0xed71('0x30')]['bind'](this));ami['on'](_0xed71('0x31'),this[_0xed71('0x32')][_0xed71('0x24')](this));this[_0xed71('0x33')]();this[_0xed71('0x34')]();}function isNotNull(_0x4fe07d){return _0x4fe07d!==null&&!_[_0xed71('0x35')](_0x4fe07d);}function checkIsLoggedIn(_0x3aae7d,_0x490bc6){return function(){if(_0x490bc6<=0x0){_0x3aae7d[_0xed71('0x36')]=_0xed71('0x37');throw _0x3aae7d[_0xed71('0x38')]+_0xed71('0x39');}};}function isActive(_0x2506e6){return _0x2506e6;}function checkIsActive(_0x14a7f7,_0x423255){return function(){if(!isActive(_0x423255)){_0x14a7f7[_0xed71('0x36')]=_0xed71('0x3a');throw _0x14a7f7[_0xed71('0x38')]+_0xed71('0x3b');}};}function checkInterval(_0x2f1fc2){return function(){if(!isNotNull(_0x2f1fc2['Interval'])){_0x2f1fc2['message']=_0xed71('0x3c');throw _0x2f1fc2[_0xed71('0x38')]+_0xed71('0x3d');}if(!isNotNull(_0x2f1fc2['Interval'][_0xed71('0x3e')])){_0x2f1fc2[_0xed71('0x36')]=_0xed71('0x3c');throw _0x2f1fc2[_0xed71('0x38')]+_0xed71('0x3d');}if(!isNotNull(_[_0xed71('0x3f')](_0x2f1fc2['Interval'][_0xed71('0x3e')]))){_0x2f1fc2[_0xed71('0x36')]=_0xed71('0x3c');throw _0x2f1fc2['name']+_0xed71('0x3d');}};}function msgResponse(_0x5927de,_0x1d4cac,_0x1d5301){return{'action':_0x5927de,'response':_0x1d4cac,'message':_0x1d5301,'stack':_0x1d5301};}function myreject(_0x383433){return function(_0x5b674a){return _0x383433(msgResponse(_0xed71('0x40'),'Error',JSON[_0xed71('0x41')](_0x5b674a)));};}function getSeconds(_0x208db1,_0xf3b909){var _0x4e04bf=moment(_0x208db1)['milliseconds'](0x0);var _0x285cea=moment(_0xf3b909)[_0xed71('0x42')](0x0);return _0x4e04bf['diff'](_0x285cea,'seconds');}function emit(_0x15c0d5,_0x8d98e9,_0x11e000){io['to'](_0x15c0d5)['emit'](_0x8d98e9,_0x11e000);}function emitVoiceQueueSummary(_0x131aba){if(_0x131aba[_0xed71('0x43')]===_0xed71('0x44')){var _0x2a02f0={'id':_0x131aba['id'],'name':_0x131aba[_0xed71('0x38')],'strategy':_0x131aba[_0xed71('0x45')],'answered':_0x131aba[_0xed71('0x46')],'available':_0x131aba['available'],'loggedIn':_0x131aba['loggedIn'],'pTalking':_0x131aba[_0xed71('0x47')],'sumBillable':_0x131aba[_0xed71('0x48')],'sumDuration':_0x131aba[_0xed71('0x49')],'sumHoldTime':_0x131aba[_0xed71('0x4a')]||0x0,'talking':_0x131aba['talking'],'total':_0x131aba[_0xed71('0x4b')],'type':_0x131aba['type'],'unmanaged':_0x131aba[_0xed71('0x4c')],'abandoned':_0x131aba['abandoned'],'waiting':_0x131aba[_0xed71('0x4d')],'loggedInDb':_0x131aba[_0xed71('0x4e')],'dialActive':_0x131aba[_0xed71('0x4f')],'dialMethod':_0x131aba[_0xed71('0x50')],'dialOriginateCallerIdName':_0x131aba[_0xed71('0x51')],'dialOriginateCallerIdNumber':_0x131aba['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x131aba['dialOriginateTimeout'],'dialPrefix':_0x131aba[_0xed71('0x52')],'outboundAnswerAgiCallsDay':_0x131aba[_0xed71('0x53')],'outboundAnswerCallsDay':_0x131aba[_0xed71('0x54')],'outboundBlacklistCallsDay':_0x131aba['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x131aba[_0xed71('0x55')],'outboundCongestionCallsDay':_0x131aba[_0xed71('0x56')],'outboundDropCallsDayACS':_0x131aba['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x131aba[_0xed71('0x57')],'outboundDropCallsDayTimeout':_0x131aba[_0xed71('0x58')],'outboundNoAnswerCallsDay':_0x131aba[_0xed71('0x59')],'outboundNoSuchCallsDay':_0x131aba[_0xed71('0x5a')],'outboundOriginateFailureCallsDay':_0x131aba[_0xed71('0x5b')],'outboundReCallsDay':_0x131aba[_0xed71('0x5c')],'outboundRejectCallsDay':_0x131aba['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x131aba[_0xed71('0x5d')],'predictiveIntervalAnsweredCalls':_0x131aba[_0xed71('0x5e')],'predictiveIntervalAvgHoldtime':_0x131aba[_0xed71('0x5f')],'predictiveIntervalAvgTalktime':_0x131aba[_0xed71('0x60')],'predictiveIntervalDroppedCallsCallersExit':_0x131aba[_0xed71('0x61')],'predictiveIntervalDroppedCallsTimeout':_0x131aba[_0xed71('0x62')],'predictiveIntervalErlangCalls':_0x131aba[_0xed71('0x63')],'predictiveIntervalErlangCallsDroppedCalls':_0x131aba[_0xed71('0x64')],'predictiveIntervalHitRate':_0x131aba[_0xed71('0x65')],'predictiveIntervalMultiplicativeFactor':_0x131aba['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x131aba[_0xed71('0x66')],'predictiveIntervalAvailable':_0x131aba[_0xed71('0x67')],'predictiveIntervalTotalCalls':_0x131aba[_0xed71('0x68')],'message':_0x131aba[_0xed71('0x36')],'originated':_0x131aba['originated'],'erlangCalls':_0x131aba[_0xed71('0x69')],'erlangCallToSecond':_0x131aba[_0xed71('0x6a')],'erlangAbandonmentRate':_0x131aba[_0xed71('0x6b')],'erlangBusyFactor':_0x131aba[_0xed71('0x6c')],'startPredictive':_0x131aba[_0xed71('0x6d')],'startProgressive':_0x131aba[_0xed71('0x22')]};if(_0x131aba[_0xed71('0x6e')]){_0x2a02f0[_0xed71('0x6e')]={'id':_0x131aba['Trunk']['id'],'name':_0x131aba[_0xed71('0x6e')][_0xed71('0x38')],'active':_0x131aba[_0xed71('0x6e')]['active'],'callerid':_0x131aba[_0xed71('0x6e')][_0xed71('0x6f')]};}if(_0x131aba['Interval']){_0x2a02f0['Interval']={'id':_0x131aba[_0xed71('0x70')]['id'],'name':_0x131aba[_0xed71('0x70')][_0xed71('0x38')]};}var _0x16cbf3=md5(JSON[_0xed71('0x41')](_0x2a02f0));if(_0x131aba[_0xed71('0x3')]!==_0x16cbf3){_0x131aba[_0xed71('0x3')]=_0x16cbf3;emit(util[_0xed71('0x71')](_0xed71('0x72'),_0x2a02f0[_0xed71('0x38')]),'voice_queue:save',_0x2a02f0);}}}function emitCampaignSummary(_0x5e02a4){if(_0x5e02a4['type']===_0xed71('0x73')){emit(util[_0xed71('0x71')](_0xed71('0x74'),_0x5e02a4[_0xed71('0x38')]),_0xed71('0x75'),_0x5e02a4);}}function checkGetDataPredictive(_0x4075e3){if(isNotNull(_0x4075e3)&&!_['isEmpty'](_0x4075e3)){loggerPredictive[_0xed71('0x76')](_0xed71('0x77'));loggerPredictive[_0xed71('0x76')](_0xed71('0x78'),_0x4075e3['predictiveIntervalTotalCalls']);loggerPredictive[_0xed71('0x76')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4075e3['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0xed71('0x79'),_0x4075e3[_0xed71('0x62')]);loggerPredictive[_0xed71('0x76')](_0xed71('0x7a'),_0x4075e3[_0xed71('0x61')]);loggerPredictive[_0xed71('0x76')](_0xed71('0x7b'),_0x4075e3[_0xed71('0x5f')]);loggerPredictive[_0xed71('0x76')](_0xed71('0x7c'),_0x4075e3[_0xed71('0x60')]);loggerPredictive['info'](_0xed71('0x7d'));if(_0x4075e3[_0xed71('0x68')]>0x0){if(!_[_0xed71('0x35')](_0x4075e3[_0xed71('0x60')])&&_0x4075e3[_0xed71('0x60')]>0x0){return!![];}loggerPredictive[_0xed71('0x76')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0xed71('0x35')](_0x4075e3[_0xed71('0x5f')])&&_0x4075e3[_0xed71('0x5f')]>0x0){return!![];}loggerPredictive[_0xed71('0x76')](_0xed71('0x7e'));}else{loggerPredictive['info'](_0xed71('0x7f'));}}else{loggerPredictive[_0xed71('0x76')](_0xed71('0x80'));}return![];}function mergeDataErlangB(_0xbbd770){return function(_0x2193e1){loggerPredictive[_0xed71('0x76')](_0xed71('0x81'));loggerPredictive[_0xed71('0x76')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2193e1[_0xed71('0x69')]);loggerPredictive[_0xed71('0x76')](_0xed71('0x82'),_0x2193e1[_0xed71('0x6a')]);loggerPredictive[_0xed71('0x76')](_0xed71('0x83'),_0x2193e1[_0xed71('0x6b')]);loggerPredictive[_0xed71('0x76')](_0xed71('0x84'),_0x2193e1[_0xed71('0x6c')]);loggerPredictive[_0xed71('0x76')](_0xed71('0x83'),_0x2193e1[_0xed71('0x6b')]);loggerPredictive[_0xed71('0x76')](_0xed71('0x7d'));_['merge'](_0xbbd770,_0x2193e1);};}function getDiff(_0xc778f6){var _0x31e11e=moment()[_0xed71('0x42')](0x0);var _0x33a7fe=moment(_0xc778f6)[_0xed71('0x42')](0x0);return _0x31e11e['diff'](_0x33a7fe,'seconds');}function ifInterval(_0x134bc1,_0x5d8962){if(_[_0xed71('0x35')](_0x5d8962)){return![];}return getDiff(_0x5d8962)<_0x134bc1*0x3c;}function freeVariablesPredictive(_0xd49943){if(isNotNull(_0xd49943)){if(!_[_0xed71('0x35')](_0xd49943[_0xed71('0x22')])){_0xd49943['startProgressive']=undefined;loggerPredictive[_0xed71('0x76')](_0xd49943[_0xed71('0x38')],_0xed71('0x85'));}if(!_['isUndefined'](_0xd49943[_0xed71('0x6d')])){_0xd49943['startPredictive']=undefined;loggerPredictive['info'](_0xd49943['name'],_0xed71('0x86'));}if(!_['isUndefined'](_0xd49943['handlePredictive'])){clearInterval(_0xd49943[_0xed71('0x87')]);_0xd49943[_0xed71('0x87')]=undefined;loggerPredictive[_0xed71('0x76')](_0xd49943[_0xed71('0x38')],_0xed71('0x88'));}}}function erlangb(_0x2d5078,_0x166170){if(_0x166170===0x0){return 0x0;}var _0x489625=0x1;for(var _0x3a7f95=0x1;_0x3a7f95<=_0x166170;_0x3a7f95+=0x1){_0x489625=0x1+_0x489625*_0x3a7f95/_0x2d5078;}return 0x1/_0x489625;}function isVoiceQueueOutbound(_0x437a1d){return _0x437a1d===_0xed71('0x44');}function isNotPreview(_0x3ca544){return _0x3ca544!==_0xed71('0x18');}function isCampaignIvr(_0x4ea94a){return _0x4ea94a===_0xed71('0x73');}function getCallerId(_0x5ead9d,_0x424990,_0x5b051c){if(!_['isUndefined'](_0x5b051c)&&typeof _0x5b051c===_0xed71('0x89')&&!_[_0xed71('0x3f')](_0x5b051c)){if(!_[_0xed71('0x35')](_0x424990)&&typeof _0x424990==='string'&&!_['isEmpty'](_0x424990)){return util[_0xed71('0x71')](_0xed71('0x8a'),_0x424990,_0x5b051c);}return util[_0xed71('0x71')](_0xed71('0x8a'),_0x5b051c,_0x5b051c);}if(!_[_0xed71('0x35')](_0x5ead9d)&&typeof _0x5ead9d==='string'&&!_['isEmpty'](_0x5ead9d)){return _0x5ead9d;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x264f31,_0x41873c){return function(_0x4d0e8d){freeVariablesPredictive(_0x41873c);emitVoiceQueueSummary(_0x41873c);emitCampaignSummary(_0x41873c);loggerSyncQueueSummary[_0xed71('0x8b')](_0x264f31,util[_0xed71('0x8c')](_0x4d0e8d,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x1e8d19,_0xa988d1){return function(_0x19c5c3){loggerPredictive[_0xed71('0x8b')](_0xa988d1[_0xed71('0x38')],_0x1e8d19);loggerPredictive[_0xed71('0x8b')](_0x19c5c3[_0xed71('0x8d')]);freeVariablesPredictive(_0xa988d1);};}function loggerCatch(_0x29499a){return function(_0x14735e){logger['error'](_0x29499a,util[_0xed71('0x8c')](_0x14735e,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x486532){return _0x486532&&!_[_0xed71('0x35')](_0x486532)&&_0x486532[_0xed71('0x8e')]>0x0;}function decremetOriginate(_0x4e794c){if(!_[_0xed71('0x35')](_0x4e794c)&&_0x4e794c!==null){if(typeof _0x4e794c[_0xed71('0x8f')]!==_0xed71('0x90')){if(_0x4e794c['originated']>0x0){_0x4e794c[_0xed71('0x8f')]-=0x1;}else{logger['error'](_0xed71('0x91'));}}}else{logger[_0xed71('0x8b')](_0xed71('0x92'));}}function checkContactLowerLimitOriginate(_0x51e6d8,_0x3b51a5,_0xbae741){if(_0x3b51a5>_0xbae741){for(var _0x362254=0x0;_0x362254<_0x3b51a5-_0xbae741;_0x362254+=0x1){decremetOriginate(_0x51e6d8);}}}function loggerGetContactDialer(_0xbc0ce9,_0xa1d024,_0x5e27b0){return function(_0x4ebae6){checkContactLowerLimitOriginate(_0xa1d024,_0x5e27b0,0x0);logger['error'](_0xbc0ce9,util[_0xed71('0x8c')](_0x4ebae6,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2c51cd){return function(_0x3a64b8){if(isNotNull(_0x3a64b8)&&isNotNull(_0x3a64b8[0x0])){if(_0x3a64b8[0x0][_0xed71('0x93')]>0x0){_0x2c51cd[_0xed71('0x36')]=_0xed71('0x94');logger[_0xed71('0x76')](_0xed71('0x95')+_0x2c51cd[_0xed71('0x38')],_0x3a64b8[0x0][_0xed71('0x93')],_0xed71('0x96'));}else{_0x2c51cd['message']=_0xed71('0x97');logger[_0xed71('0x76')](_0xed71('0x98')+_0x2c51cd['name']);}}};}function notSendMessagesQueue(_0x5c4b4f){if(_0x5c4b4f[_0xed71('0x99')]){freeVariablesPredictive(_0x5c4b4f);if(_0x5c4b4f[_0xed71('0x8f')]===0x0&&_0x5c4b4f['talking']===0x0&&_0x5c4b4f['waiting']===0x0&&(_0x5c4b4f['pTalking']||0x0)===0x0){_0x5c4b4f[_0xed71('0x99')]=![];_0x5c4b4f[_0xed71('0x9a')]=0x0;_0x5c4b4f[_0xed71('0x36')]=_0xed71('0x3a');loggerSyncQueueSummary['error'](_0xed71('0x9b'),_0x5c4b4f[_0xed71('0x38')],_0xed71('0x9c'));}else{_0x5c4b4f[_0xed71('0x36')]=_0xed71('0x9d');loggerSyncQueueSummary['error'](_0xed71('0x9b'),_0x5c4b4f['name'],_0xed71('0x9e'));}emitVoiceQueueSummary(_0x5c4b4f);}}function notSendMessagesCampaign(_0x1ed531){if(_0x1ed531[_0xed71('0x99')]){if(_0x1ed531[_0xed71('0x8f')]===0x0){_0x1ed531[_0xed71('0x99')]=![];_0x1ed531[_0xed71('0x36')]=_0xed71('0x3a');loggerSyncQueueSummary[_0xed71('0x8b')](_0xed71('0x9f'),_0x1ed531[_0xed71('0x38')],_0xed71('0x9c'));}else{_0x1ed531[_0xed71('0x36')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xed71('0x8b')](_0xed71('0x9f'),_0x1ed531[_0xed71('0x38')],_0xed71('0x9e'));}emitCampaignSummary(_0x1ed531);}}function createObjHistory(_0x58dd22,_0x2ee69e,_0x4703ca,_0x33d94f,_0x18f98d){_0x58dd22['message']=_0x4703ca;var _0x7f0401=new Action(_0x58dd22,_0x2ee69e);var _0x472040=new History(_0x7f0401);_0x472040['state']=_0x33d94f;_0x472040[_0xed71('0xa0')]=_0x18f98d;_0x472040[_0xed71('0xa1')]=_0x7f0401[_0xed71('0xa2')];return _0x472040;}Dialer[_0xed71('0x15')][_0xed71('0x34')]=function(){var _0x40c774=this;setInterval(function(){_0x40c774[_0xed71('0xa3')](_0x40c774[_0xed71('0x20')],_0xed71('0xa4'));_0x40c774[_0xed71('0xa3')](_0x40c774[_0xed71('0x1e')],_0xed71('0xa5'));},0x32c8);};Dialer[_0xed71('0x15')][_0xed71('0xa3')]=function(_0x43ee10,_0xf41e6c){var _0x5073db=this;for(var _0x56acf1 in _0x43ee10){if(typeof _0x43ee10[_0x56acf1]!==_0xed71('0x90')){this[_0xed71('0xa6')][_0xed71('0xa7')](function(){if(!_[_0xed71('0xa8')](_0x43ee10[_0x56acf1])){return ami[_0xed71('0xa9')]({'action':_0xed71('0xaa'),'channel':_0x43ee10[_0x56acf1][_0xed71('0xab')]})[_0xed71('0xac')](function(_0x4cd26d){if(_0x4cd26d['message']===_0xed71('0xad')){setTimeout(function(){if(_0x43ee10[_0x56acf1]&&_0x43ee10[_0x56acf1]['type']!=='ivr'){_0x5073db['updateOriginated'](_0x5073db['voiceQueues'][_0x43ee10[_0x56acf1][_0xed71('0xae')]]);logger[_0xed71('0x8b')](_0xed71('0xaf'),_0xf41e6c,_0x56acf1,_0x43ee10[_0x56acf1]['queue']);delete _0x43ee10[_0x56acf1];}if(_0x43ee10[_0x56acf1]&&_0x43ee10[_0x56acf1]['type']==='ivr'){_0x5073db[_0xed71('0xb0')](_0x5073db[_0xed71('0x1a')][_0x43ee10[_0x56acf1][_0xed71('0xae')]]);logger[_0xed71('0x8b')]('[Dialer][checkChannel][ivr]',_0xf41e6c,_0x56acf1,_0x43ee10[_0x56acf1][_0xed71('0xae')]);delete _0x43ee10[_0x56acf1];}},0x2328);}});}});}}};Dialer['prototype']['countReScheduled']=function(_0x5b78e5){return BPromise['resolve']()[_0xed71('0xb1')](cmHopper[_0xed71('0xb2')](_0x5b78e5))[_0xed71('0xac')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xed71('0x15')][_0xed71('0xb3')]=function(_0x29643d){return BPromise[_0xed71('0xb4')]()['then'](cmHopperBlack[_0xed71('0xb3')](_0x29643d))[_0xed71('0xac')](loggerCatch(_0xed71('0xb5')));};Dialer[_0xed71('0x15')][_0xed71('0xb6')]=function(_0x4b457c){return BPromise[_0xed71('0xb4')]()[_0xed71('0xb1')](cmHopperBlack[_0xed71('0xb6')](_0x4b457c))[_0xed71('0xac')](loggerCatch(_0xed71('0xb7')));};Dialer['prototype'][_0xed71('0xb8')]=function(_0x52617c){return BPromise[_0xed71('0xb4')]()[_0xed71('0xb1')](cmHopperHistory[_0xed71('0xb9')](_0x52617c))['catch'](loggerCatch(_0xed71('0xba')));};Dialer['prototype'][_0xed71('0xbb')]=function(_0x5646e3){return BPromise['resolve']()[_0xed71('0xb1')](cmHopper[_0xed71('0xbb')](_0x5646e3))[_0xed71('0xac')](loggerCatch(_0xed71('0xbc')));};Dialer['prototype']['unlockContact']=function(_0x46cb69,_0x584c8e,_0x5914d0){return BPromise[_0xed71('0xb4')]()['then'](cmHopper[_0xed71('0xbd')](_0x46cb69,_0x584c8e,_0x5914d0))[_0xed71('0xac')](loggerCatch(_0xed71('0xbe')));};Dialer[_0xed71('0x15')][_0xed71('0xbf')]=function(_0x4dc171,_0x3b419b,_0x1c5c17,_0x3a15df){return BPromise[_0xed71('0xb4')]()[_0xed71('0xb1')](cmHopper['getContactDialer'](_0x4dc171,_0x3b419b,_0x1c5c17,_0x3a15df))[_0xed71('0xac')](loggerCatch(_0xed71('0xc0')));};Dialer[_0xed71('0x15')][_0xed71('0xc1')]=function(_0x52a8ab,_0xb61273,_0x51743f){return BPromise['resolve']()[_0xed71('0xb1')](cmHopper[_0xed71('0xc1')](_0x52a8ab,_0xb61273,_0x51743f))['catch'](loggerCatch(_0xed71('0xc0')));};Dialer[_0xed71('0x15')]['getVoiceQueueRtPauses']=function(_0x46e77f){return BPromise[_0xed71('0xb4')]()[_0xed71('0xb1')](voiceQueueRt[_0xed71('0xc2')](_0x46e77f))[_0xed71('0xac')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xed71('0x15')][_0xed71('0xc3')]=function(_0x53c961){return BPromise[_0xed71('0xb4')]()[_0xed71('0xb1')](cmHopper[_0xed71('0xc3')](_0x53c961))[_0xed71('0xac')](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer['prototype'][_0xed71('0xc4')]=function(_0x4b75a9){return BPromise[_0xed71('0xb4')]()[_0xed71('0xb1')](cmHopperHistory[_0xed71('0xc4')](_0x4b75a9))[_0xed71('0xac')](loggerCatch('[createHistory]\x20'));};Dialer[_0xed71('0x15')][_0xed71('0xb0')]=function(_0x1a3595){if(!_[_0xed71('0x35')](_0x1a3595)&&_0x1a3595!==null){if(typeof _0x1a3595[_0xed71('0x8f')]!=='undefined'){if(_0x1a3595[_0xed71('0x8f')]>0x0){_0x1a3595['originated']-=0x1;}else{logger[_0xed71('0x8b')](_0xed71('0xc5'));}}}else{logger['error'](_0xed71('0xc6'));}};Dialer['prototype'][_0xed71('0xc7')]=function(_0xecfaf6,_0x5611f2){var _0x2e0999=this;return function(_0x2799ba){_0x2e0999['updateOriginated'](_0x5611f2);logger[_0xed71('0x8b')](_0xecfaf6,util[_0xed71('0x8c')](_0x2799ba,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0xed71('0xc8')]=function(_0x4e21da,_0x3d6b83,_0xe77972){var _0x1b1e4d={'state':0x19,'statedesc':_0xed71('0xc9')};this[_0xed71('0xb0')](_0x3d6b83);this[_0xed71('0xca')](_[_0xed71('0xcb')](_0x1b1e4d,_[_0xed71('0xcc')](_0xe77972,[_0xed71('0xcd'),'ListId',_0xed71('0xce'),_0xed71('0xcf'),'CampaignId'])),_0xed71('0xd0'),_0xed71('0xd1'));logger[_0xed71('0x8b')](_0x4e21da);};Dialer[_0xed71('0x15')][_0xed71('0xd2')]=function(_0x583d97){return _0x583d97===_0xed71('0xd3');};Dialer[_0xed71('0x15')][_0xed71('0xd4')]=function(_0x6977a6){return!_[_0xed71('0x35')](_0x6977a6)&&_0x6977a6&&!_['isUndefined'](_0x6977a6[_0xed71('0x38')])&&!_['isUndefined'](_0x6977a6[_0xed71('0xd5')])&&_0x6977a6[_0xed71('0xd5')]&&(this[_0xed71('0xd6')][util[_0xed71('0x71')](_0xed71('0xd7'),_0x6977a6[_0xed71('0x38')])]['status']===_0xed71('0xd8')||this[_0xed71('0xd6')][util['format'](_0xed71('0xd7'),_0x6977a6['name'])]['status']==='unmonitored');};Dialer[_0xed71('0x15')][_0xed71('0xca')]=function(_0x11b778,_0x142e3b,_0x14df37){this[_0xed71('0xc4')](_0x11b778)[_0xed71('0xac')](loggerCatch(_0x142e3b));this['moveContactManagedDialer'](_0x11b778)[_0xed71('0xac')](loggerCatch(_0x14df37));};Dialer[_0xed71('0x15')][_0xed71('0x2e')]=function(_0x5eb844){var _0x5a5d48=this['uniqueId'][_0x5eb844[_0xed71('0xd9')]];var _0x16ba72;if(!_[_0xed71('0xa8')](_0x5eb844)&&!_[_0xed71('0xa8')](_0x5eb844[_0xed71('0xda')])&&!_['isNil'](_0x5eb844[_0xed71('0xda')][_0xed71('0xdb')])&&_0x5eb844[_0xed71('0xdc')]==='xcally-motion-dialer'&&_0x5a5d48){if(_0x5a5d48[_0xed71('0x43')]!=='ivr'&&this['voiceQueues'][_0x5a5d48[_0xed71('0xae')]][_0xed71('0xdd')]&&_0x5eb844['value']===_0xed71('0xde')){delete this['uniqueId'][_0x5eb844[_0xed71('0xd9')]];this[_0xed71('0xb0')](this[_0xed71('0x19')][_0x5a5d48[_0xed71('0xae')]]);this[_0xed71('0x19')][_0x5a5d48['queue']][_0xed71('0x54')]+=0x1;this[_0xed71('0x19')][_0x5a5d48['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0x16ba72=new Hangup(_0x5a5d48,_0x5eb844);_0x16ba72[_0xed71('0xdf')]=0x12;_0x16ba72[_0xed71('0xa0')]=_0xed71('0xe0');_0x16ba72[_0xed71('0xe1')]=_0xed71('0xe2');this[_0xed71('0xca')](_0x16ba72,'[syncHangupInAMD][createHistory]',_0xed71('0xe3'));}if(_0x5a5d48['type']!=='ivr'&&this[_0xed71('0x19')][_0x5a5d48[_0xed71('0xae')]][_0xed71('0xdd')]&&_0x5eb844[_0xed71('0xe4')]===_0xed71('0xe5')){var _0x4f9d35=this;return new BPromise(function(_0x270921,_0x3a0e0a){delete _0x4f9d35['uniqueId'][_0x5eb844['uniqueid']];_0x4f9d35[_0xed71('0xb0')](_0x4f9d35[_0xed71('0x19')][_0x5a5d48[_0xed71('0xae')]]);_0x4f9d35['voiceQueues'][_0x5a5d48['queue']][_0xed71('0x54')]+=0x1;_0x4f9d35[_0xed71('0x19')][_0x5a5d48['queue']][_0xed71('0x53')]+=0x1;var _0x4289fa=_0x4f9d35[_0xed71('0x19')][_0x5a5d48[_0xed71('0xae')]];var _0x2eaf0a=new Hangup(_0x5a5d48,_0x5eb844);_0x2eaf0a[_0xed71('0xdf')]=0x13;_0x2eaf0a['statedesc']=_0xed71('0xe6');_0x2eaf0a[_0xed71('0xe1')]=_0xed71('0xe2');_0x2eaf0a[_0xed71('0xe7')]+=0x1;_0x2eaf0a[_0xed71('0xe8')]+=0x1;_0x2eaf0a[_0xed71('0xe9')]=!![];_0x4f9d35['createHistory'](_0x2eaf0a)[_0xed71('0xac')](loggerCatch(_0xed71('0xea')));if(_0x2eaf0a['countbusyretry']+_0x2eaf0a[_0xed71('0xeb')]+_0x2eaf0a[_0xed71('0xec')]+_0x2eaf0a[_0xed71('0xed')]+_0x2eaf0a[_0xed71('0xee')]+_0x2eaf0a['countabandonedretry']+_0x2eaf0a[_0xed71('0xe7')]+_0x2eaf0a[_0xed71('0xef')]>=_0x4289fa[_0xed71('0xf0')]){_0x4f9d35[_0xed71('0xf1')](_0x2eaf0a,_0x270921,_0x3a0e0a,_0xed71('0xf2'));}else{if(_0x2eaf0a[_0xed71('0xe7')]>=_0x4289fa[_0xed71('0xf3')]){_0x4f9d35[_0xed71('0xf4')](_0x2eaf0a,_0x270921,_0x3a0e0a,_0xed71('0xf5'));}else{_0x4f9d35[_0xed71('0xbb')]({'active':![],'countmachineretry':_0x2eaf0a[_0xed71('0xe7')],'scheduledat':moment()[_0xed71('0xf6')](_0x4289fa['dialMachineRetryFrequency'],_0xed71('0xf7'))[_0xed71('0x71')](_0xed71('0xf8')),'ContactId':_0x2eaf0a[_0xed71('0xcd')],'ListId':_0x2eaf0a[_0xed71('0xf9')],'VoiceQueueId':_0x2eaf0a[_0xed71('0xcf')]||undefined,'CampaignId':_0x2eaf0a['CampaignId']||undefined})[_0xed71('0xac')](loggerCatch(_0xed71('0xfa')));_0x270921({'reschedule':0x1});}}});}if(_0x5a5d48[_0xed71('0x43')]===_0xed71('0x73')&&this['campaigns'][_0x5a5d48[_0xed71('0xae')]][_0xed71('0xdd')]&&_0x5eb844[_0xed71('0xe4')]===_0xed71('0xde')){delete this[_0xed71('0x20')][_0x5eb844[_0xed71('0xd9')]];this['updateOriginated'](this['campaigns'][_0x5a5d48['queue']]);_0x16ba72=new Hangup(_0x5a5d48,_0x5eb844);_0x16ba72[_0xed71('0xdf')]=0x12;_0x16ba72[_0xed71('0xa0')]=_0xed71('0xe0');_0x16ba72[_0xed71('0xe1')]=_0xed71('0xe2');this[_0xed71('0xca')](_0x16ba72,_0xed71('0xfb'),_0xed71('0xfc'));}if(_0x5a5d48[_0xed71('0x43')]===_0xed71('0x73')&&this[_0xed71('0x1a')][_0x5a5d48[_0xed71('0xae')]]['dialAMDActive']&&_0x5eb844[_0xed71('0xe4')]===_0xed71('0xe5')){var _0x4f9d35=this;return new BPromise(function(_0x65947d,_0x11cc94){delete _0x4f9d35[_0xed71('0x20')][_0x5eb844['uniqueid']];_0x4f9d35['updateOriginated'](_0x4f9d35['campaigns'][_0x5a5d48['queue']]);_0x4f9d35[_0xed71('0x1a')][_0x5a5d48[_0xed71('0xae')]]['outboundAnswerCallsDay']+=0x1;_0x4f9d35[_0xed71('0x1a')][_0x5a5d48[_0xed71('0xae')]][_0xed71('0x53')]+=0x1;var _0x5df2d1=_0x4f9d35[_0xed71('0x1a')][_0x5a5d48['queue']];var _0x46b723=new Hangup(_0x5a5d48,_0x5eb844);_0x46b723[_0xed71('0xdf')]=0x13;_0x46b723[_0xed71('0xa0')]=_0xed71('0xe6');_0x46b723[_0xed71('0xe1')]=_0xed71('0xe2');_0x46b723[_0xed71('0xe7')]+=0x1;_0x46b723[_0xed71('0xe8')]+=0x1;_0x46b723['amd']=!![];_0x4f9d35['createHistory'](_0x46b723)[_0xed71('0xac')](loggerCatch(_0xed71('0xea')));if(_0x46b723[_0xed71('0xfd')]+_0x46b723[_0xed71('0xeb')]+_0x46b723[_0xed71('0xec')]+_0x46b723['countnosuchnumberretry']+_0x46b723[_0xed71('0xee')]+_0x46b723['countabandonedretry']+_0x46b723['countmachineretry']+_0x46b723[_0xed71('0xef')]>=_0x5df2d1[_0xed71('0xf0')]){_0x4f9d35[_0xed71('0xf1')](_0x46b723,_0x65947d,_0x11cc94,_0xed71('0xf2'));}else{if(_0x46b723[_0xed71('0xe7')]>=_0x5df2d1[_0xed71('0xf3')]){_0x4f9d35['createStateFinal'](_0x46b723,_0x65947d,_0x11cc94,_0xed71('0xf5'));}else{_0x4f9d35[_0xed71('0xbb')]({'active':![],'countmachineretry':_0x46b723[_0xed71('0xe7')],'scheduledat':moment()[_0xed71('0xf6')](_0x5df2d1[_0xed71('0xfe')],'minutes')[_0xed71('0x71')](_0xed71('0xf8')),'ContactId':_0x46b723[_0xed71('0xcd')],'ListId':_0x46b723[_0xed71('0xf9')],'VoiceQueueId':_0x46b723[_0xed71('0xcf')]||undefined,'CampaignId':_0x46b723[_0xed71('0xff')]||undefined})[_0xed71('0xac')](loggerCatch('[rescheduleContact][Machine]'));_0x65947d({'reschedule':0x1});}}});}}};Dialer[_0xed71('0x15')]['syncHangup']=function(_0x1bf251){var _0x303fbc=this[_0xed71('0x20')][_0x1bf251[_0xed71('0xd9')]];var _0x332d24=this;var _0x1ce9cf;if(_0x303fbc&&_0x303fbc[_0xed71('0x43')]===_0xed71('0x73')){delete this[_0xed71('0x20')][_0x1bf251[_0xed71('0xd9')]];this[_0xed71('0xb0')](this[_0xed71('0x1a')][_0x303fbc[_0xed71('0xae')]]);this[_0xed71('0x1a')][_0x303fbc[_0xed71('0xae')]]['ivrAnswerCallsDay']+=0x1;_0x1ce9cf=new Hangup(_0x303fbc,_0x1bf251);this['createHistory'](_0x1ce9cf)[_0xed71('0xac')](loggerCatch(_0xed71('0x100')));this[_0xed71('0xc3')](_0x1ce9cf)[_0xed71('0xac')](loggerCatch(_0xed71('0x101')));}if(_0x303fbc&&_0x303fbc[_0xed71('0x43')]!==_0xed71('0x73')&&isNotNull(this[_0xed71('0x19')][_0x303fbc[_0xed71('0xae')]][_0xed71('0x102')])){delete this[_0xed71('0x20')][_0x1bf251[_0xed71('0xd9')]];this[_0xed71('0xb0')](this['voiceQueues'][_0x303fbc['queue']]);this[_0xed71('0x19')][_0x303fbc[_0xed71('0xae')]][_0xed71('0x54')]+=0x1;this[_0xed71('0x19')][_0x303fbc[_0xed71('0xae')]][_0xed71('0x53')]+=0x1;_0x1ce9cf=new Hangup(_0x303fbc,_0x1bf251);_0x1ce9cf[_0xed71('0xdf')]=0x10;_0x1ce9cf[_0xed71('0xa0')]=_0xed71('0x103');_0x1ce9cf[_0xed71('0xe1')]=_0xed71('0x104');this[_0xed71('0xc4')](_0x1ce9cf)[_0xed71('0xac')](loggerCatch(_0xed71('0x100')));this['moveContactManagedDialer'](_0x1ce9cf)[_0xed71('0xac')](loggerCatch(_0xed71('0x101')));}if(_0x303fbc&&_0x303fbc[_0xed71('0x43')]!==_0xed71('0x73')&&!isNotNull(this[_0xed71('0x19')][_0x303fbc['queue']][_0xed71('0x102')])){delete this[_0xed71('0x20')][_0x1bf251[_0xed71('0xd9')]];this['updateOriginated'](this[_0xed71('0x19')][_0x303fbc['queue']]);this['voiceQueues'][_0x303fbc[_0xed71('0xae')]][_0xed71('0x5d')]+=0x1;_0x1ce9cf=new Hangup(_0x303fbc,_0x1bf251);_0x1ce9cf[_0xed71('0xdf')]=0xc;_0x1ce9cf[_0xed71('0xa0')]=_0x1bf251[_0xed71('0x105')];_0x1ce9cf[_0xed71('0xe1')]=_0xed71('0x106');this[_0xed71('0xc4')](_0x1ce9cf)[_0xed71('0xac')](loggerCatch(_0xed71('0x100')));this[_0xed71('0xc3')](_0x1ce9cf)['catch'](loggerCatch(_0xed71('0x101')));}};Dialer[_0xed71('0x15')][_0xed71('0x28')]=function(_0x492642){var _0x3c1417=this[_0xed71('0x20')][_0x492642[_0xed71('0xd9')]];var _0x349ce1=this;if(this[_0xed71('0x19')][_0x492642[_0xed71('0xae')]]){if(_0x3c1417&&_0x3c1417['type']!==_0xed71('0x73')){delete this[_0xed71('0x20')][_0x492642['uniqueid']];this[_0xed71('0x19')][_0x492642[_0xed71('0xae')]][_0xed71('0x54')]+=0x1;var _0x46893a=new AgentComplete(_0x3c1417,_0x492642);if(_0x492642['reason']==='agent'){_0x46893a[_0xed71('0x107')]=this[_0xed71('0x19')][_0x492642[_0xed71('0xae')]]['dialQueueProject2']&&this[_0xed71('0x19')][_0x492642[_0xed71('0xae')]]['dialAgiAfterHangupAgent']?moment()[_0xed71('0x71')](_0xed71('0xf8')):undefined;}this['createHistory'](_0x46893a)['catch'](loggerCatch(_0xed71('0x108')));this['moveContactManagedDialer'](_0x46893a)['catch'](loggerCatch(_0xed71('0x109')));}}};Dialer[_0xed71('0x15')][_0xed71('0x10a')]=function(_0x1edb19){if(this[_0xed71('0x19')][_0x1edb19[_0xed71('0xae')]]){if(this[_0xed71('0x20')][_0x1edb19['uniqueid']]&&this[_0xed71('0x20')][_0x1edb19['uniqueid']][_0xed71('0x43')]!==_0xed71('0x73')){this[_0xed71('0xb0')](this[_0xed71('0x19')][_0x1edb19[_0xed71('0xae')]]);this['uniqueId'][_0x1edb19[_0xed71('0xd9')]]['answertime']=moment()[_0xed71('0x71')](_0xed71('0xf8'));}}};Dialer[_0xed71('0x15')][_0xed71('0x10b')]=function(_0x2ac3eb){this[_0xed71('0xc4')](_0x2ac3eb)[_0xed71('0xac')](loggerCatch(_0xed71('0x108')));this['moveContactManagedDialer'](_0x2ac3eb)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0xed71('0x15')][_0xed71('0x26')]=function(_0x31a95e){var _0x531ec9=this['uniqueId'][_0x31a95e[_0xed71('0xd9')]];var _0x17fd09=this;if(this['voiceQueues'][_0x31a95e['queue']]){if(_0x531ec9&&_0x531ec9[_0xed71('0x43')]!=='ivr'){delete this['uniqueId'][_0x31a95e[_0xed71('0xd9')]];this[_0xed71('0xb0')](this[_0xed71('0x19')][_0x31a95e[_0xed71('0xae')]]);_0x531ec9[_0xed71('0x10c')]=moment()[_0xed71('0x71')](_0xed71('0xf8'));var _0x11f03a=new QueueCallerAbandon(_0x531ec9,_0x31a95e);if(getSeconds(_0x531ec9['droptime'],_0x531ec9[_0xed71('0x10d')])>=_0x531ec9[_0xed71('0x10e')]){this[_0xed71('0x19')][_0x31a95e[_0xed71('0xae')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x31a95e[_0xed71('0xae')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xed71('0x19')][_0x31a95e[_0xed71('0xae')]][_0xed71('0x64')]+=0x1;_0x11f03a[_0xed71('0xdf')]=0xa;_0x11f03a[_0xed71('0xa0')]='Drop';_0x11f03a[_0xed71('0x10f')]=_0xed71('0x110');_0x11f03a[_0xed71('0x107')]=this[_0xed71('0x19')][_0x31a95e[_0xed71('0xae')]]['dialQueueProject2']?moment()[_0xed71('0x71')](_0xed71('0xf8')):undefined;_0x11f03a[_0xed71('0xee')]+=0x1;_0x11f03a['countglobal']+=0x1;if(_0x11f03a[_0xed71('0xee')]>=this[_0xed71('0x19')][_0x31a95e[_0xed71('0xae')]]['dialDropMaxRetry']){this[_0xed71('0x10b')](_0x11f03a);}else{this[_0xed71('0xbb')]({'active':![],'countdropretry':_0x11f03a['countdropretry'],'scheduledat':moment()[_0xed71('0xf6')](this['voiceQueues'][_0x31a95e[_0xed71('0xae')]][_0xed71('0x111')],'minutes')[_0xed71('0x71')](_0xed71('0xf8')),'ContactId':_0x531ec9[_0xed71('0xcd')],'ListId':_0x531ec9['ListId'],'VoiceQueueId':_0x531ec9[_0xed71('0xcf')]||undefined,'CampaignId':_0x531ec9[_0xed71('0xff')]||undefined})[_0xed71('0xac')](loggerCatch(_0xed71('0x112')));var _0x181fe0=new History(_0x11f03a);_0x181fe0[_0xed71('0xdf')]=0xa;_0x181fe0[_0xed71('0xa0')]=_0xed71('0x113');_0x181fe0[_0xed71('0xa2')]=moment()[_0xed71('0x71')](_0xed71('0xf8'));_0x181fe0[_0xed71('0xa1')]=_0x181fe0[_0xed71('0xa2')];_0x181fe0[_0xed71('0x114')]=_0x11f03a[_0xed71('0x114')];_0x181fe0[_0xed71('0x115')]=_0x11f03a[_0xed71('0x115')];this['createHistory'](_0x181fe0)[_0xed71('0xac')](loggerCatch(_0xed71('0x116')));}}else{this[_0xed71('0x19')][_0x31a95e[_0xed71('0xae')]][_0xed71('0x61')]+=0x1;this['voiceQueues'][_0x31a95e[_0xed71('0xae')]][_0xed71('0x57')]+=0x1;_0x11f03a[_0xed71('0xdf')]=0xb;_0x11f03a['statedesc']=_0xed71('0x117');_0x11f03a[_0xed71('0x10f')]=_0xed71('0x118');_0x11f03a[_0xed71('0x119')]+=0x1;_0x11f03a['countglobal']+=0x1;if(_0x11f03a[_0xed71('0x119')]>=this['voiceQueues'][_0x31a95e['queue']][_0xed71('0x11a')]){this[_0xed71('0x10b')](_0x11f03a);}else{this[_0xed71('0xbb')]({'active':![],'countabandonedretry':_0x11f03a[_0xed71('0x119')],'scheduledat':moment()['add'](this[_0xed71('0x19')][_0x31a95e[_0xed71('0xae')]][_0xed71('0x11b')],_0xed71('0xf7'))[_0xed71('0x71')](_0xed71('0xf8')),'ContactId':_0x531ec9[_0xed71('0xcd')],'ListId':_0x531ec9[_0xed71('0xf9')],'VoiceQueueId':_0x531ec9[_0xed71('0xcf')]||undefined,'CampaignId':_0x531ec9[_0xed71('0xff')]||undefined})[_0xed71('0xac')](loggerCatch(_0xed71('0x11c')));var _0x181fe0=new History(_0x11f03a);_0x181fe0['state']=0xb;_0x181fe0[_0xed71('0xa0')]=_0xed71('0x117');_0x181fe0[_0xed71('0xa2')]=moment()[_0xed71('0x71')](_0xed71('0xf8'));_0x181fe0[_0xed71('0xa1')]=_0x181fe0['starttime'];_0x181fe0[_0xed71('0x114')]=_0x11f03a[_0xed71('0x114')];_0x181fe0[_0xed71('0x115')]=_0x11f03a[_0xed71('0x115')];this['createHistory'](_0x181fe0)['catch'](loggerCatch(_0xed71('0x11d')));}}}}};Dialer[_0xed71('0x15')][_0xed71('0x2c')]=function(_0x4ba550){if(this[_0xed71('0x1e')][_0x4ba550[_0xed71('0xd9')]]){this[_0xed71('0x1e')][_0x4ba550[_0xed71('0xd9')]][_0xed71('0xab')]=_0x4ba550[_0xed71('0xab')];}if(this[_0xed71('0x20')][_0x4ba550[_0xed71('0xd9')]]){this[_0xed71('0x20')][_0x4ba550[_0xed71('0xd9')]][_0xed71('0xab')]=_0x4ba550[_0xed71('0xab')];}};Dialer['prototype'][_0xed71('0x30')]=function(_0x527d50){if(strategy[this[_0xed71('0x19')][this['actions'][_0x527d50['actionid']]['queue']]['strategy']]===_0xed71('0x14')){if(this[_0xed71('0x1e')][_0x527d50[_0xed71('0x11e')]]&&_[_0xed71('0xa8')](this['actions'][_0x527d50[_0xed71('0x11e')]][_0xed71('0x11f')])&&_0x527d50[_0xed71('0xaa')]==='1'&&_0x527d50[_0xed71('0x120')]==='0'){if(this[_0xed71('0x1b')][_0x527d50[_0xed71('0x121')]]){if(!this[_0xed71('0x1b')][_0x527d50[_0xed71('0x121')]][_0xed71('0x11f')]){this[_0xed71('0x1b')][_0x527d50[_0xed71('0x121')]][_0xed71('0x11f')]=!![];this['actions'][_0x527d50[_0xed71('0x11e')]][_0xed71('0x11f')]=!![];this['actions'][_0x527d50[_0xed71('0x11e')]]['stateinterface']=_0x527d50['stateinterface'];}}}}else if((strategy[this[_0xed71('0x19')][this['actions'][_0x527d50[_0xed71('0x11e')]][_0xed71('0xae')]][_0xed71('0x45')]]||_0xed71('0x13'))===_0xed71('0x13')){if(this['actions'][_0x527d50['actionid']]){if(this[_0xed71('0x1b')][_0x527d50['stateinterface']]){this[_0xed71('0x1e')][_0x527d50[_0xed71('0x11e')]]['stateinterface']=_0x527d50[_0xed71('0x121')];if(_[_0xed71('0xa8')](this[_0xed71('0x23')][this[_0xed71('0x1e')][_0x527d50[_0xed71('0x11e')]]['queue']])){this[_0xed71('0x23')][this['actions'][_0x527d50['actionid']][_0xed71('0xae')]]=[];}this[_0xed71('0x23')][this[_0xed71('0x1e')][_0x527d50[_0xed71('0x11e')]][_0xed71('0xae')]]['push'](_[_0xed71('0xcb')](_[_0xed71('0xcc')](this[_0xed71('0x1e')][_0x527d50[_0xed71('0x11e')]],[_0xed71('0x122'),_0xed71('0x121')]),{'status':_0x527d50[_0xed71('0xaa')],'paused':_0x527d50[_0xed71('0x120')]}));}}}};function unlockQueueStatus(_0x3bd2a9,_0x378786){setTimeout(function(){if(_[_0xed71('0x35')](_0x3bd2a9[_0xed71('0x123')])){loggerBooked[_0xed71('0x8b')](_0xed71('0x124'),_0x378786);}_0x3bd2a9['queueStatusComplete']=!![];loggerBooked[_0xed71('0x76')](_0xed71('0x125'),_0x378786,JSON[_0xed71('0x41')](_[_0xed71('0xcc')](_0x3bd2a9,[_0xed71('0x38'),_0xed71('0x123')])));},0x1f3);}Dialer[_0xed71('0x15')][_0xed71('0x32')]=function(_0x48b721){var _0x21a4df=this;var _0x40465c=_0x21a4df['voiceQueues'][_0x21a4df[_0xed71('0x1e')][_0x48b721[_0xed71('0x11e')]][_0xed71('0xae')]];if(strategy[this['voiceQueues'][this[_0xed71('0x1e')][_0x48b721[_0xed71('0x11e')]]['queue']][_0xed71('0x45')]]===_0xed71('0x14')){if(this[_0xed71('0x1e')][_0x48b721['actionid']]&&this[_0xed71('0x1e')][_0x48b721[_0xed71('0x11e')]][_0xed71('0x121')]){this[_0xed71('0x18')][_0xed71('0x126')](this[_0xed71('0x1e')][_0x48b721[_0xed71('0x11e')]][_0xed71('0x122')],this[_0xed71('0x1e')][_0x48b721[_0xed71('0x11e')]][_0xed71('0x121')])['catch'](function(_0x4b44e0){logger[_0xed71('0x8b')](_0xed71('0x127'),util[_0xed71('0x8c')](_0x4b44e0,{'showHidden':![],'depth':null}));})['finally'](function(){_0x21a4df[_0xed71('0xb0')](_0x21a4df['voiceQueues'][_0x21a4df[_0xed71('0x1e')][_0x48b721[_0xed71('0x11e')]][_0xed71('0xae')]]);_0x21a4df[_0xed71('0x1b')][_0x21a4df[_0xed71('0x1e')][_0x48b721[_0xed71('0x11e')]][_0xed71('0x121')]][_0xed71('0x11f')]=![];delete _0x21a4df[_0xed71('0x1e')][_0x48b721[_0xed71('0x11e')]];unlockQueueStatus(_0x40465c);});}else{this[_0xed71('0xb0')](this[_0xed71('0x19')][this[_0xed71('0x1e')][_0x48b721[_0xed71('0x11e')]][_0xed71('0xae')]]);this[_0xed71('0xbb')]({'active':![],'ContactId':this[_0xed71('0x1e')][_0x48b721[_0xed71('0x11e')]][_0xed71('0xcd')],'ListId':this[_0xed71('0x1e')][_0x48b721['actionid']][_0xed71('0xf9')],'VoiceQueueId':this[_0xed71('0x1e')][_0x48b721['actionid']][_0xed71('0xcf')]||undefined,'CampaignId':this[_0xed71('0x1e')][_0x48b721['actionid']][_0xed71('0xff')]||undefined})[_0xed71('0xac')](loggerCatch(_0xed71('0x128')));delete this[_0xed71('0x1e')][_0x48b721['actionid']];unlockQueueStatus(_0x40465c);}}else if((strategy[this[_0xed71('0x19')][this['actions'][_0x48b721[_0xed71('0x11e')]][_0xed71('0xae')]][_0xed71('0x45')]]||'rrmemory')===_0xed71('0x13')){var _0x5c8127;if(this['actions'][_0x48b721[_0xed71('0x11e')]]&&!_[_0xed71('0x3f')](this[_0xed71('0x23')][this['actions'][_0x48b721[_0xed71('0x11e')]][_0xed71('0xae')]])){if(this[_0xed71('0x129')][_0x21a4df[_0xed71('0x1e')][_0x48b721[_0xed71('0x11e')]][_0xed71('0xae')]]){this[_0xed71('0x129')][_0x21a4df['actions'][_0x48b721[_0xed71('0x11e')]][_0xed71('0xae')]]=this['queueBookedRR'][this[_0xed71('0x1e')][_0x48b721[_0xed71('0x11e')]]['queue']]?this['queueBookedRR'][this[_0xed71('0x1e')][_0x48b721[_0xed71('0x11e')]][_0xed71('0xae')]]:this[_0xed71('0x23')][this[_0xed71('0x1e')][_0x48b721[_0xed71('0x11e')]][_0xed71('0xae')]]?this['queueBooked'][this[_0xed71('0x1e')][_0x48b721['actionid']][_0xed71('0xae')]]['_rr']||0x0:0x0;}this[_0xed71('0x23')][this[_0xed71('0x1e')][_0x48b721[_0xed71('0x11e')]][_0xed71('0xae')]][_0xed71('0x12a')]=this[_0xed71('0x129')][this['actions'][_0x48b721[_0xed71('0x11e')]][_0xed71('0xae')]];for(var _0x29ea9b=0x0;_0x29ea9b=0x0;})[_0xed71('0xac')](myreject(_0x2ea538)));}}else{_0x55d431[_0xed71('0x145')](ami[_0xed71('0xa9')]({'action':_0xed71('0x13f'),'command':util[_0xed71('0x71')](_0xed71('0x146'),_0x4696ea,!_['isUndefined'](config['timezones'][_0x15a996])?_0x15a996:'')})[_0xed71('0xb1')](function(_0x2b63fe){return _0x2b63fe[_0xed71('0x142')][_0xed71('0x143')](_0xed71('0x144'))>=0x0;})['catch'](myreject(_0x2ea538)));}BPromise[_0xed71('0x147')](_0x55d431)[_0xed71('0xb1')](function(_0x52e266){var _0x4c8f22=_[_0xed71('0x148')](_0x52e266);if(_0x4c8f22){return _0x297fb5(_0x4c8f22);}else{_0x5c0421['message']=_0x4ef7ae?_0xed71('0x149'):'INTERVAL_IS_OVERTIME';return _0x2ea538(msgResponse(_0xed71('0x14a'),_0xed71('0x138'),_0xed71('0x14b')+_0x4ef7ae+'\x20'+_0x2e2a22+_0xed71('0x14c')+util[_0xed71('0x8c')](_0x4696ea,{'showHidden':![],'depth':null})+_0xed71('0x14d')+_0x15a996));}})['catch'](function(_0xf28d9a){return _0x2ea538(msgResponse(_0xed71('0x137'),'Failure',JSON[_0xed71('0x41')](_0xf28d9a)));});});};Dialer[_0xed71('0x15')][_0xed71('0x14e')]=function(_0x2dba61){var _0x27cd26=this;return function(){switch(_0x2dba61['dialMethod']){case _0xed71('0x14f'):freeVariablesPredictive(_0x2dba61);_0x27cd26[_0xed71('0x150')](_0x2dba61,0x1);break;case _0xed71('0x151'):freeVariablesPredictive(_0x2dba61);_0x27cd26[_0xed71('0x150')](_0x2dba61,_0x2dba61['dialPowerLevel']);break;case'predictive':_0x27cd26[_0xed71('0x152')](_0x2dba61);break;case _0xed71('0x153'):freeVariablesPredictive(_0x2dba61);_0x27cd26[_0xed71('0x150')](_0x2dba61,0x1);break;default:freeVariablesPredictive(_0x2dba61);logger[_0xed71('0x8b')](_0xed71('0x154'),_0x2dba61[_0xed71('0x38')],_0xed71('0x155'));}};};Dialer['prototype'][_0xed71('0x156')]=function(_0x141791){var _0x363621=this;return function(){_0x363621[_0xed71('0x157')](_0x141791);};};Dialer[_0xed71('0x15')][_0xed71('0x9')]=function(_0x13bdb9){var _0x3d0d91=this;if(isNotPreview(_0x13bdb9[_0xed71('0x50')])){if(isVoiceQueueOutbound(_0x13bdb9[_0xed71('0x43')])&&isActive(_0x13bdb9[_0xed71('0x4f')])){_0x13bdb9[_0xed71('0x99')]=!![];BPromise[_0xed71('0xb4')]()[_0xed71('0xb1')](checkIsLoggedIn(_0x13bdb9,_0x13bdb9['loggedIn']))['then'](checkIsActive(_0x13bdb9,_0x13bdb9[_0xed71('0x4f')]))[_0xed71('0xb1')](checkInterval(_0x13bdb9))[_0xed71('0xb1')](_0x3d0d91['checkIsTrunkReachable'](_0x13bdb9))[_0xed71('0xb1')](_0x3d0d91[_0xed71('0x158')](_0x13bdb9[_0xed71('0x159')],_0x13bdb9['dialTimezone'],_0x13bdb9[_0xed71('0x38')],_0x13bdb9))[_0xed71('0xb1')](_0x3d0d91[_0xed71('0x136')](_0x13bdb9[_0xed71('0x70')],_0x13bdb9[_0xed71('0x15a')],_0x13bdb9[_0xed71('0x38')],_0x13bdb9))[_0xed71('0xb1')](_0x3d0d91['checkDialMethod'](_0x13bdb9))['catch'](loggerCatchQueueSummary(_0xed71('0x15b'),_0x13bdb9));}else{notSendMessagesQueue(_0x13bdb9);}}else{freeVariablesPredictive(_0x13bdb9);}};Dialer[_0xed71('0x15')][_0xed71('0x15c')]=function(){var _0x364122=this;var _0x8fe0c8;for(var _0x154071 in this[_0xed71('0x1a')]){if(typeof this[_0xed71('0x1a')][_0x154071]!==_0xed71('0x90')){_0x8fe0c8=this['campaigns'][_0x154071];if(isCampaignIvr(_0x8fe0c8['type'])&&isActive(_0x8fe0c8[_0xed71('0xd5')])){_0x8fe0c8[_0xed71('0x99')]=!![];BPromise[_0xed71('0xb4')]()[_0xed71('0xb1')](checkIsActive(_0x8fe0c8,_0x8fe0c8[_0xed71('0xd5')]))[_0xed71('0xb1')](checkInterval(_0x8fe0c8))[_0xed71('0xb1')](_0x364122[_0xed71('0x133')](_0x8fe0c8))[_0xed71('0xb1')](_0x364122[_0xed71('0x158')](_0x8fe0c8['dialGlobalInterval'],_0x8fe0c8[_0xed71('0x15a')],_0x8fe0c8[_0xed71('0x38')],_0x8fe0c8))['then'](_0x364122[_0xed71('0x136')](_0x8fe0c8[_0xed71('0x70')],_0x8fe0c8[_0xed71('0x15a')],_0x8fe0c8[_0xed71('0x38')],_0x8fe0c8))[_0xed71('0xb1')](_0x364122[_0xed71('0x156')](_0x8fe0c8))[_0xed71('0xac')](loggerCatchQueueSummary(_0xed71('0x15d'),_0x8fe0c8));}else{notSendMessagesCampaign(_0x8fe0c8);}}}};function getCallerIdRandom(_0x2883ac,_0x5c288c){var _0x216b7d;var _0x426053;var _0x2e90a5;if(_0x5c288c<=0x0){_0x5c288c=0x1;}_0x216b7d=new RegExp(_0xed71('0x15e')+_0x5c288c+'}$');_0x426053=Math['pow'](0xa,_0x5c288c-0x1);_0x2e90a5=Math[_0xed71('0x15f')](0xa,_0x5c288c)-0x1;return util[_0xed71('0x71')]('%s',_[_0xed71('0x160')](_0x2883ac,_0x216b7d,_[_0xed71('0x161')](_0x426053,_0x2e90a5)));}function extractCalleridName(_0x393de2){var _0x6bdf06=_0x393de2['match'](/"(.*?)"/);return _0x6bdf06?_0x6bdf06[0x1]:_0x393de2;}function extractCalleridNumber(_0x57462a){var _0x3f70ff=_0x57462a['match'](/<(.*?)>/);return _0x3f70ff?_0x3f70ff[0x1]:_0x57462a;}Dialer[_0xed71('0x15')][_0xed71('0x162')]=function(_0x450b27,_0x14ec58){var _0x518b2f=this;var _0x18384c=uuid['v4']();this['actions'][_0x18384c]=new Action(_0x450b27,_0x14ec58,_0x18384c);return new BPromise(function(_0x140c1c,_0x2b4337){if(_[_0xed71('0x35')](_0x450b27)&&typeof _0x450b27!==_0xed71('0x163')){return _0x2b4337(msgResponse('originate','Failure','voiceQueue\x20is\x20undefine'));}if(_[_0xed71('0x35')](_0x14ec58[_0xed71('0x164')][_0xed71('0x165')])||_0x14ec58[_0xed71('0x164')][_0xed71('0x165')]===null){return _0x2b4337(msgResponse(_0xed71('0x166'),_0xed71('0x138'),'contact\x20is\x20undefine'));}var _0x5aae2b={'XMD-CALLERID':_0x518b2f[_0xed71('0x1e')][_0x18384c]['getCaller'](),'XMD-AGI':_0x450b27['dialQueueProject']?util['format'](_0xed71('0x167'),ipAgi,_0x450b27[_0xed71('0x102')]):'NONE','XMD-AGIAFTER':_0x450b27[_0xed71('0x168')]?util['format'](_0xed71('0x167'),ipAgi,_0x450b27[_0xed71('0x168')]):'NONE','XMD-QUEUE':_0x450b27[_0xed71('0x43')]==='outbound'?util[_0xed71('0x71')]('\x22%s,%s%s,,,%s\x22',_0x450b27[_0xed71('0x38')],_0x450b27[_0xed71('0x169')]||'',_0x450b27['dialAgiAfterHangupAgent']?'c':'',_0x450b27[_0xed71('0x10e')]||0x3):'NONE','XMD-CONTACTID':_0x14ec58['ContactId'],'XMD-CDRTYPE':_0xed71('0x7'),'CALLERID(all)':_0x518b2f[_0xed71('0x1e')][_0x18384c][_0xed71('0x16a')](),'XMD-AMD':_0x450b27[_0xed71('0xdd')]?_0xed71('0x16b'):_0xed71('0x16c'),'XMD-DESTINATION':_0xed71('0x16d')};if(_0x450b27[_0xed71('0xdd')]){_0x5aae2b[_0xed71('0x16e')]=_0x450b27[_0xed71('0x16f')]||0x9c4;_0x5aae2b[_0xed71('0x170')]=_0x450b27['dialAMDGreeting']||0x5dc;_0x5aae2b[_0xed71('0x171')]=_0x450b27[_0xed71('0x172')]||0x320;_0x5aae2b[_0xed71('0x173')]=_0x450b27['dialAMDTotalAnalysisTime']||0x1388;_0x5aae2b['XMD-AMDMINWORDLENGTH']=_0x450b27[_0xed71('0x174')]||0x64;_0x5aae2b['XMD-AMDBETWEENWORDSSILENCE']=_0x450b27[_0xed71('0x175')]||0x32;_0x5aae2b[_0xed71('0x176')]=_0x450b27[_0xed71('0x177')]||0x3;_0x5aae2b[_0xed71('0x178')]=_0x450b27['dialAMDSilenceThreshold']||0x100;_0x5aae2b['XMD-AMDMAXIMUMWORDLENGTH']=_0x450b27[_0xed71('0x179')]||0x1388;}if(_0x450b27[_0xed71('0x43')]===_0xed71('0x44')){_0x5aae2b[_0xed71('0x17a')]=_0x14ec58[_0xed71('0xcf')];}else{_0x5aae2b[_0xed71('0x17b')]=_0x14ec58[_0xed71('0xff')];}for(var _0x20352e in _0x14ec58[_0xed71('0x164')]){if(typeof _0x14ec58['Contact'][_0x20352e]!=='undefined'){if(isNotNull(_0x14ec58[_0xed71('0x164')][_0x20352e])&&_0x20352e!=='id'&&_0x20352e!==_0xed71('0x17c')&&_0x20352e!==_0xed71('0x17d')&&_0x20352e!==_0xed71('0x17e')){_0x5aae2b[util[_0xed71('0x71')]('%s%s','XMD-',_['toUpper'](_0x20352e))]=_0x14ec58[_0xed71('0x164')][_0x20352e];}}}var _0x3f27d7=_0x518b2f['isTrunkReachable'](_0x450b27[_0xed71('0x6e')])?getCallerId(_0x450b27[_0xed71('0x6e')]['callerid'],_0x450b27[_0xed71('0x51')],_0x450b27[_0xed71('0x17f')]>0x0?getCallerIdRandom(_0x450b27[_0xed71('0x180')],_0x450b27[_0xed71('0x17f')]):_0x450b27['dialOriginateCallerIdNumber']):getCallerId(_[_0xed71('0xa8')](_0x450b27['TrunkBackup'])?_0x450b27[_0xed71('0x6e')][_0xed71('0x6f')]:_0x450b27[_0xed71('0x134')][_0xed71('0x6f')],_0x450b27['dialOriginateCallerIdName'],_0x450b27[_0xed71('0x17f')]>0x0?getCallerIdRandom(_0x450b27['dialOriginateCallerIdNumber'],_0x450b27[_0xed71('0x17f')]):_0x450b27[_0xed71('0x180')]);if(_0x3f27d7){_0x5aae2b[_0xed71('0x181')]=_0x518b2f[_0xed71('0x1e')][_0x18384c][_0xed71('0x182')]=extractCalleridName(_0x3f27d7);_0x5aae2b[_0xed71('0x183')]=_0x518b2f[_0xed71('0x1e')][_0x18384c][_0xed71('0x184')]=extractCalleridNumber(_0x3f27d7);}return ami[_0xed71('0xa9')]({'actionid':_0x18384c,'action':_0xed71('0x166'),'channel':_0x518b2f[_0xed71('0xd4')](_0x450b27['Trunk'])?util[_0xed71('0x71')](_0xed71('0x185'),_0x450b27[_0xed71('0x6e')][_0xed71('0x38')],isNotNull(_0x450b27[_0xed71('0x52')])?_0x450b27[_0xed71('0x52')][_0xed71('0x186')]()||'':'',_0x450b27[_0xed71('0x187')]>0x0?_0x14ec58[_0xed71('0x164')][_0xed71('0x165')][_0xed71('0x188')](_0x450b27[_0xed71('0x187')]):_0x14ec58[_0xed71('0x164')]['phone']):util[_0xed71('0x71')](_0xed71('0x185'),_[_0xed71('0xa8')](_0x450b27['TrunkBackup'])?_0x450b27[_0xed71('0x6e')][_0xed71('0x38')]:_0x450b27['TrunkBackup'][_0xed71('0x38')],isNotNull(_0x450b27['dialPrefix'])?_0x450b27[_0xed71('0x52')][_0xed71('0x186')]()||'':'',_0x450b27[_0xed71('0x187')]>0x0?_0x14ec58['Contact'][_0xed71('0x165')][_0xed71('0x188')](_0x450b27[_0xed71('0x187')]):_0x14ec58['Contact'][_0xed71('0x165')]),'callerid':_0x3f27d7,'Exten':_0xed71('0x16d'),'Context':'from-sip','Priority':'1','variable':_0x5aae2b,'timeout':(_0x450b27[_0xed71('0x189')]||0x1e)*0x3e8,'async':!![],'channelid':_0x18384c})[_0xed71('0xb1')](function(_0x4a45fb){return _0x140c1c(_0x4a45fb);})[_0xed71('0xac')](function(_0x485b96){_0x450b27[_0xed71('0x5b')]+=0x1;var _0x4f7b29=new History(_0x518b2f[_0xed71('0x1e')][_0x18384c]);logger[_0xed71('0x8b')](util['format']('[originateError]:\x20%s',JSON[_0xed71('0x41')](_0x485b96)));_0x4f7b29[_0xed71('0xdf')]=0xe;_0x4f7b29[_0xed71('0xa0')]=_0xed71('0x18a');_0x4f7b29[_0xed71('0xa2')]=moment()[_0xed71('0x71')](_0xed71('0xf8'));_0x4f7b29['endtime']=_0x4f7b29[_0xed71('0xa2')];_0x518b2f[_0xed71('0xc4')](_0x4f7b29)[_0xed71('0xac')](loggerCatch('[originate][error]'));_0x518b2f['moveContactManagedDialer'](_0x4f7b29)[_0xed71('0xac')](loggerCatch(_0xed71('0x18b')))[_0xed71('0x17')](function(){delete _0x518b2f[_0xed71('0x1e')][_0x18384c];return _0x2b4337(msgResponse('originate',_0xed71('0x18c'),_0xed71('0x18d')));});});});};Dialer[_0xed71('0x15')][_0xed71('0x18e')]=function(_0x1f8e95){var _0x287a13=this['actions'][_0x1f8e95[_0xed71('0x11e')]];if(_0x287a13){delete this[_0xed71('0x1e')][_0x1f8e95[_0xed71('0x11e')]];_0x287a13['responsetime']=moment()[_0xed71('0x71')](_0xed71('0xf8'));var _0xe46026=_0x287a13[_0xed71('0x43')]==='ivr'?this[_0xed71('0x1a')][_0x287a13[_0xed71('0xae')]]:this[_0xed71('0x19')][_0x287a13[_0xed71('0x18f')]()];if(!this['isSuccess'](_0x1f8e95['response'])){this['updateOriginated'](_0xe46026);return this[_0xed71('0x190')](_0x287a13,_0xe46026,_0x1f8e95)[_0xed71('0xac')](loggerCatch('[callProgressDetecting]\x20'));}this[_0xed71('0x20')][_0x1f8e95[_0xed71('0xd9')]]=_0x287a13;}};Dialer[_0xed71('0x15')][_0xed71('0x191')]=function(_0x4acb7e,_0x39f92a,_0x3f3f06){var _0x156add=new History(_0x39f92a);if(_0x156add['countbusyretry']+_0x156add[_0xed71('0xeb')]+_0x156add['countnoanswerretry']+_0x156add[_0xed71('0xed')]+_0x156add['countdropretry']+_0x156add[_0xed71('0x119')]+_0x156add[_0xed71('0xe7')]+_0x156add['countagentrejectretry']>=_0x3f3f06['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x4acb7e){case 0x3:if(_0x156add[_0xed71('0xec')]>=_0x3f3f06['dialNoAnswerMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x156add[_0xed71('0xec')]+=0x1,'scheduledat':moment()[_0xed71('0xf6')](_0x3f3f06[_0xed71('0x192')],_0xed71('0xf7'))[_0xed71('0x71')](_0xed71('0xf8')),'ContactId':_0x156add[_0xed71('0xcd')],'ListId':_0x156add[_0xed71('0xf9')],'VoiceQueueId':_0x156add[_0xed71('0xcf')]||undefined,'CampaignId':_0x156add['CampaignId']||undefined})['catch'](loggerCatch(_0xed71('0x193')));break;case 0x5:if(_0x156add[_0xed71('0xfd')]>=_0x3f3f06[_0xed71('0x194')]-0x1){return!![];}this[_0xed71('0xbb')]({'active':![],'countbusyretry':_0x156add[_0xed71('0xfd')]+=0x1,'scheduledat':moment()[_0xed71('0xf6')](_0x3f3f06[_0xed71('0x195')],'minutes')[_0xed71('0x71')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x156add[_0xed71('0xcd')],'ListId':_0x156add[_0xed71('0xf9')],'VoiceQueueId':_0x156add[_0xed71('0xcf')]||undefined,'CampaignId':_0x156add[_0xed71('0xff')]||undefined})[_0xed71('0xac')](loggerCatch(_0xed71('0x196')));break;case 0x8:if(_0x156add['countcongestionretry']>=_0x3f3f06[_0xed71('0x197')]-0x1){return!![];}this[_0xed71('0xbb')]({'active':![],'countcongestionretry':_0x156add['countcongestionretry']+=0x1,'scheduledat':moment()[_0xed71('0xf6')](_0x3f3f06[_0xed71('0x198')],_0xed71('0xf7'))[_0xed71('0x71')](_0xed71('0xf8')),'ContactId':_0x156add[_0xed71('0xcd')],'ListId':_0x156add[_0xed71('0xf9')],'VoiceQueueId':_0x156add['VoiceQueueId']||undefined,'CampaignId':_0x156add[_0xed71('0xff')]||undefined})[_0xed71('0xac')](loggerCatch(_0xed71('0x199')));break;case 0x0:if(_0x156add[_0xed71('0xed')]>=_0x3f3f06[_0xed71('0x19a')]-0x1){return!![];}else{this[_0xed71('0xbb')]({'active':![],'countnosuchnumberretry':_0x156add[_0xed71('0xed')]+=0x1,'scheduledat':moment()[_0xed71('0xf6')](_0x3f3f06[_0xed71('0x19b')],'minutes')[_0xed71('0x71')](_0xed71('0xf8')),'ContactId':_0x156add[_0xed71('0xcd')],'ListId':_0x156add[_0xed71('0xf9')],'VoiceQueueId':_0x156add[_0xed71('0xcf')]||undefined,'CampaignId':_0x156add[_0xed71('0xff')]||undefined})[_0xed71('0xac')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x156add[_0xed71('0xee')]>=_0x3f3f06[_0xed71('0x19c')]-0x1){return!![];}this[_0xed71('0xbb')]({'active':![],'countdropretry':_0x156add[_0xed71('0xee')]+=0x1,'scheduledat':moment()[_0xed71('0xf6')](_0x3f3f06[_0xed71('0x111')],_0xed71('0xf7'))[_0xed71('0x71')](_0xed71('0xf8')),'ContactId':_0x156add['ContactId'],'ListId':_0x156add[_0xed71('0xf9')],'VoiceQueueId':_0x156add[_0xed71('0xcf')]||undefined,'CampaignId':_0x156add[_0xed71('0xff')]||undefined})['catch'](loggerCatch(_0xed71('0x112')));break;case 0xb:if(_0x156add[_0xed71('0x119')]>=_0x3f3f06['dialAbandonedMaxRetry']-0x1){return!![];}this[_0xed71('0xbb')]({'active':![],'countabandonedretry':_0x156add['countabandonedretry']+=0x1,'scheduledat':moment()[_0xed71('0xf6')](_0x3f3f06['dialAbandonedRetryFrequency'],_0xed71('0xf7'))['format'](_0xed71('0xf8')),'ContactId':_0x156add[_0xed71('0xcd')],'ListId':_0x156add[_0xed71('0xf9')],'VoiceQueueId':_0x156add['VoiceQueueId']||undefined,'CampaignId':_0x156add[_0xed71('0xff')]||undefined})[_0xed71('0xac')](loggerCatch(_0xed71('0x11c')));break;case 0x13:if(_0x156add['countmachineretry']>=_0x3f3f06['dialMachineMaxRetry']-0x1){return!![];}this[_0xed71('0xbb')]({'active':![],'countmachineretry':_0x156add[_0xed71('0xe7')]+=0x1,'scheduledat':moment()[_0xed71('0xf6')](_0x3f3f06[_0xed71('0xfe')],_0xed71('0xf7'))[_0xed71('0x71')](_0xed71('0xf8')),'ContactId':_0x156add[_0xed71('0xcd')],'ListId':_0x156add['ListId'],'VoiceQueueId':_0x156add[_0xed71('0xcf')]||undefined,'CampaignId':_0x156add[_0xed71('0xff')]||undefined})[_0xed71('0xac')](loggerCatch(_0xed71('0xfa')));break;case 0x14:if(_0x156add[_0xed71('0xef')]>=_0x3f3f06['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0xed71('0xbb')]({'active':![],'countagentrejectretry':_0x156add[_0xed71('0xef')]+=0x1,'scheduledat':moment()['add'](_0x3f3f06[_0xed71('0x19d')],_0xed71('0xf7'))[_0xed71('0x71')](_0xed71('0xf8')),'ContactId':_0x156add['ContactId'],'ListId':_0x156add[_0xed71('0xf9')],'VoiceQueueId':_0x156add[_0xed71('0xcf')]||undefined,'CampaignId':_0x156add[_0xed71('0xff')]||undefined})[_0xed71('0xac')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xed71('0x15')]['callProgressDetecting']=function(_0x2897e2,_0x5adcae,_0x29df98){var _0x12760f=this;var _0x334df0=new History(_0x2897e2);return new BPromise(function(_0x431a5b,_0x2480f2){if(_['isUndefined'](_0x5adcae)&&typeof _0x5adcae!==_0xed71('0x163')){return _0x2480f2(msgResponse(_0xed71('0x19e'),_0xed71('0x138'),'entity\x20is\x20undefine'));}if(_[_0xed71('0x35')](_0x29df98)&&typeof _0x29df98!==_0xed71('0x163')){return _0x2480f2(msgResponse(_0xed71('0x19e'),_0xed71('0x138'),_0xed71('0x19f')));}switch(_0x29df98[_0xed71('0x1a0')]){case'0':_0x5adcae[_0xed71('0x5a')]+=0x1;_0x334df0[_0xed71('0xdf')]=0x0;_0x334df0[_0xed71('0xa0')]=_0xed71('0x1a1');_0x334df0[_0xed71('0xed')]+=0x1;_0x334df0['countglobal']+=0x1;ami[_0xed71('0x1a2')](_0xed71('0x1a3'),ut['buildObj'](_0x2897e2,_0xed71('0x1a4')));_0x12760f[_0xed71('0xc4')](_0x334df0)[_0xed71('0xac')](loggerCatch(_0xed71('0xea')));if(_0x12760f[_0xed71('0x191')](0x0,_0x2897e2,_0x5adcae)){if(_0x334df0[_0xed71('0xed')]>=_0x5adcae[_0xed71('0x19a')]){_0x12760f['createStateFinal'](_0x334df0,_0x431a5b,_0x2480f2,_0xed71('0x1a5'));}else{_0x12760f[_0xed71('0xf1')](_0x334df0,_0x431a5b,_0x2480f2,_0xed71('0x1a5'));}}break;case'3':_0x5adcae['outboundNoAnswerCallsDay']+=0x1;_0x334df0[_0xed71('0xdf')]=0x3;_0x334df0[_0xed71('0xa0')]=_0xed71('0x1a6');_0x334df0[_0xed71('0xec')]+=0x1;_0x334df0[_0xed71('0xe8')]+=0x1;ami[_0xed71('0x1a2')]('custom:agentnoanswer',ut[_0xed71('0x1a7')](_0x2897e2,_0xed71('0x1a8')));_0x12760f[_0xed71('0xc4')](_0x334df0)[_0xed71('0xac')](loggerCatch(_0xed71('0x1a9')));if(_0x12760f[_0xed71('0x191')](0x3,_0x2897e2,_0x5adcae)){if(_0x334df0[_0xed71('0xec')]>=_0x5adcae[_0xed71('0x1aa')]){_0x12760f[_0xed71('0xf4')](_0x334df0,_0x431a5b,_0x2480f2,'reason\x203\x20ringing\x20no\x20answer');}else{_0x12760f[_0xed71('0xf1')](_0x334df0,_0x431a5b,_0x2480f2,_0xed71('0x1ab'));}}break;case'5':_0x5adcae[_0xed71('0x55')]+=0x1;_0x334df0['state']=0x5;_0x334df0['statedesc']=_0xed71('0x1ac');_0x334df0[_0xed71('0xfd')]+=0x1;_0x334df0['countglobal']+=0x1;ami[_0xed71('0x1a2')](_0xed71('0x1ad'),ut['buildObj'](_0x2897e2,_0xed71('0x1ae')));_0x12760f[_0xed71('0xc4')](_0x334df0)[_0xed71('0xac')](loggerCatch(_0xed71('0x1af')));if(_0x12760f[_0xed71('0x191')](0x5,_0x2897e2,_0x5adcae)){if(_0x334df0['countbusyretry']>=_0x5adcae[_0xed71('0x194')]){_0x12760f[_0xed71('0xf4')](_0x334df0,_0x431a5b,_0x2480f2,'reason\x205\x20busy');}else{_0x12760f[_0xed71('0xf1')](_0x334df0,_0x431a5b,_0x2480f2,_0xed71('0x1b0'));}}break;case'8':_0x5adcae[_0xed71('0x56')]+=0x1;_0x334df0[_0xed71('0xdf')]=0x8;_0x334df0[_0xed71('0xa0')]=_0xed71('0x1b1');_0x334df0['countcongestionretry']+=0x1;_0x334df0[_0xed71('0xe8')]+=0x1;ami['emit']('custom:agentcongestion',ut[_0xed71('0x1a7')](_0x2897e2,_0xed71('0x1b2')));_0x12760f[_0xed71('0xc4')](_0x334df0)[_0xed71('0xac')](loggerCatch(_0xed71('0x1b3')));if(_0x12760f[_0xed71('0x191')](0x8,_0x2897e2,_0x5adcae)){if(_0x334df0[_0xed71('0xeb')]>=_0x5adcae[_0xed71('0x197')]){_0x12760f[_0xed71('0xf4')](_0x334df0,_0x431a5b,_0x2480f2,_0xed71('0x1b4'));}else{_0x12760f[_0xed71('0xf1')](_0x334df0,_0x431a5b,_0x2480f2,_0xed71('0x1b4'));}}break;case'11':_0x5adcae[_0xed71('0x1b5')]+=0x1;_0x334df0[_0xed71('0xdf')]=0xb;_0x334df0[_0xed71('0xa0')]=_0xed71('0x117');_0x334df0[_0xed71('0x119')]+=0x1;_0x334df0[_0xed71('0xe8')]+=0x1;_0x12760f[_0xed71('0xc4')](_0x334df0)[_0xed71('0xac')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x12760f[_0xed71('0x191')](0xb,_0x2897e2,_0x5adcae)){if(_0x334df0[_0xed71('0x119')]>=_0x5adcae[_0xed71('0x11a')]){_0x12760f[_0xed71('0xf4')](_0x334df0,_0x431a5b,_0x2480f2,_0xed71('0x1b6'));}else{_0x12760f[_0xed71('0xf1')](_0x334df0,_0x431a5b,_0x2480f2,_0xed71('0x1b6'));}}break;case'20':_0x5adcae[_0xed71('0x1b7')]+=0x1;_0x334df0['state']=0x14;_0x334df0[_0xed71('0xa0')]=_0xed71('0x1b8');_0x334df0[_0xed71('0xef')]+=0x1;_0x334df0[_0xed71('0xe8')]+=0x1;ami[_0xed71('0x1a2')](_0xed71('0x1b9'),ut[_0xed71('0x1a7')](_0x2897e2,_0xed71('0x1ba')));_0x12760f[_0xed71('0xc4')](_0x334df0)[_0xed71('0xac')](loggerCatch(_0xed71('0x1bb')));if(_0x12760f[_0xed71('0x191')](0x14,_0x2897e2,_0x5adcae)){if(_0x334df0[_0xed71('0xef')]>=_0x5adcae[_0xed71('0x1bc')]){_0x12760f[_0xed71('0xf4')](_0x334df0,_0x431a5b,_0x2480f2,_0xed71('0x1bd'));}else{_0x12760f[_0xed71('0xf1')](_0x334df0,_0x431a5b,_0x2480f2,_0xed71('0x1bd'));}}break;default:_0x5adcae['outboundUnknownCallsDay']+=0x1;_0x334df0['state']=0xc;_0x334df0[_0xed71('0xa0')]=_0x29df98[_0xed71('0x1a0')];_0x12760f[_0xed71('0xc4')](_0x334df0)[_0xed71('0xac')](loggerCatch(_0xed71('0x1be')));if(_0x12760f['checkRetriveMax'](_0x29df98[_0xed71('0x1a0')],_0x2897e2,_0x5adcae)){if(_0x334df0[_0xed71('0xfd')]+_0x334df0[_0xed71('0xeb')]+_0x334df0[_0xed71('0xec')]+_0x334df0['countnosuchnumberretry']+_0x334df0['countdropretry']+_0x334df0[_0xed71('0x119')]+_0x334df0[_0xed71('0xe7')]+_0x334df0['countagentrejectretry']>=_0x5adcae['dialGlobalMaxRetry']){_0x12760f['stateGlobal'](_0x334df0,_0x431a5b,_0x2480f2,_0x29df98[_0xed71('0x1a0')]);}else{_0x12760f[_0xed71('0xf4')](_0x334df0,_0x431a5b,_0x2480f2,_0x29df98[_0xed71('0x1a0')]);}}}});};Dialer[_0xed71('0x15')][_0xed71('0xf1')]=function(_0x593197,_0x4292eb,_0x26340d,_0x1c12df){var _0x3f0cac=new Final(_0x593197);_0x3f0cac['state']=0xf;_0x3f0cac[_0xed71('0xa0')]=_0xed71('0x1bf');this[_0xed71('0xf4')](_0x3f0cac,_0x4292eb,_0x26340d,_0x1c12df);};Dialer[_0xed71('0x15')][_0xed71('0xf4')]=function(_0xd1f412,_0x40bf66,_0x5037f3,_0x3bb4d1){this[_0xed71('0xc3')](_0xd1f412)[_0xed71('0xb1')](function(){return _0x40bf66(msgResponse(_0xed71('0x19e'),_0xed71('0xd3'),_0x3bb4d1));})[_0xed71('0xac')](function(){return _0x5037f3(msgResponse(_0xed71('0x1c0'),_0xed71('0x138'),'contact\x20not\x20moved'));});};Dialer[_0xed71('0x15')]['predictive']=function(_0x305a89){var _0x50d709=_0x305a89[_0xed71('0x1c1')]/0x64;var _0x4342cd=_0x305a89[_0xed71('0x58')]/(_0x305a89[_0xed71('0x58')]+_0x305a89['outboundAnswerCallsDay']);var _0x6b1602=Math[_0xed71('0x1c2')](_0x305a89[_0xed71('0x67')]*(_0x305a89['predictiveIntervalMaxThreshold']/0x64));var _0x4de2b4=Math[_0xed71('0x1c2')](_0x305a89['predictiveIntervalAvailable']*(_0x305a89[_0xed71('0x1c3')]/0x64));var _0x4c9203=_0x305a89[_0xed71('0x9a')]+_0x305a89['talking'];var _0x2c8693=Math[_0xed71('0x1c4')](_0x305a89[_0xed71('0x69')]*_0x305a89[_0xed71('0x6b')]*_0x305a89[_0xed71('0x65')]*_0x305a89[_0xed71('0x1c5')]);if(_[_0xed71('0x35')](_0x305a89[_0xed71('0x22')])){if(!_[_0xed71('0x35')](_0x305a89['startPredictive'])){_0x305a89[_0xed71('0x6d')]=undefined;loggerPredictive[_0xed71('0x8b')](_0xed71('0x1c6'),_0xed71('0x1c7'));}if(!_[_0xed71('0x35')](_0x305a89[_0xed71('0x87')])){loggerPredictive['error'](_0xed71('0x1c6'),_0xed71('0x1c8'));clearInterval(_0x305a89[_0xed71('0x87')]);_0x305a89[_0xed71('0x87')]=undefined;}_0x305a89['startProgressive']=moment()[_0xed71('0x71')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x305a89['name'],'collection\x20data\x20in\x20progressive\x20at',_0x305a89['startProgressive']);this[_0xed71('0x150')](_0x305a89,0x1);}else if(ifInterval(_0x305a89[_0xed71('0x1c9')],_0x305a89[_0xed71('0x22')])){this[_0xed71('0x150')](_0x305a89,0x1);loggerPredictiveCalls[_0xed71('0x76')](_0xed71('0x1ca'),_0x305a89[_0xed71('0x22')],_0x305a89['name']);_0x305a89[_0xed71('0x69')]=0x0;_0x305a89[_0xed71('0x64')]=0x0;}else if(_0x50d709<_0x4342cd&&_0x305a89[_0xed71('0x1cb')]===_0xed71('0x1cc')){freeVariablesPredictive(_0x305a89);loggerPredictive[_0xed71('0x76')](_0xed71('0x1cd'),_0xed71('0x1ce'),_0x4342cd,_0xed71('0x22'),_0x305a89[_0xed71('0x38')]);}else if(_0x2c8693<_0x305a89[_0xed71('0x64')]&&_0x305a89[_0xed71('0x1cb')]===_0xed71('0x1cc')){freeVariablesPredictive(_0x305a89);loggerPredictive[_0xed71('0x76')](_0xed71('0x1cf'),'Max\x20Drop\x20',_0x2c8693,_0xed71('0x1d0'),_0x305a89[_0xed71('0x64')],_0xed71('0x22'),_0x305a89[_0xed71('0x38')]);}else if(!ifInterval(_0x305a89[_0xed71('0x1c9')],_0x305a89[_0xed71('0x22')])&&_['isUndefined'](_0x305a89[_0xed71('0x6d')])&&!_[_0xed71('0x35')](_0x305a89[_0xed71('0x22')])){_0x305a89[_0xed71('0x6d')]=moment()[_0xed71('0x71')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xed71('0x76')](_0x305a89['name'],_0xed71('0x1d1'),_0x305a89['startPredictive']);this[_0xed71('0xb8')](_0x305a89[_0xed71('0x1c9')])[_0xed71('0xb1')](this[_0xed71('0x1d2')](_0x305a89))[_0xed71('0xb1')](mergeDataErlangB(_0x305a89))[_0xed71('0xb1')](this['startMethodPredictive'](_0x305a89))[_0xed71('0xac')](loggerCatchPredictive(_0xed71('0x1d3'),_0x305a89));}else if(!ifInterval(_0x305a89['dialPredictiveInterval'],_0x305a89[_0xed71('0x6d')])){_0x305a89[_0xed71('0x64')]=0x0;_0x305a89[_0xed71('0x6d')]=moment()[_0xed71('0x71')](_0xed71('0xf8'));loggerPredictive[_0xed71('0x76')](_0x305a89[_0xed71('0x38')],_0xed71('0x1d4'),_0x305a89['startPredictive']);clearInterval(_0x305a89[_0xed71('0x87')]);_0x305a89['handlePredictive']=undefined;this[_0xed71('0xb8')](_0x305a89[_0xed71('0x1c9')])['then'](this[_0xed71('0x1d2')](_0x305a89))[_0xed71('0xb1')](mergeDataErlangB(_0x305a89))[_0xed71('0xb1')](this[_0xed71('0x1d5')](_0x305a89))[_0xed71('0xac')](loggerCatchPredictive(_0xed71('0x1d6'),_0x305a89));}else if(_0x305a89['predictiveIntervalAvailable']&&_0x4c9203<_0x305a89[_0xed71('0x67')]-_0x4de2b4){freeVariablesPredictive(_0x305a89);loggerPredictive[_0xed71('0x76')](_0x305a89[_0xed71('0x38')],_0xed71('0x1d7'),_0x4c9203,_0xed71('0x1d8'),_0x305a89['predictiveIntervalAvailable'],'-',_0x4de2b4,'=',_0x305a89[_0xed71('0x67')]-_0x4de2b4,')');}else if(_0x305a89['predictiveIntervalAvailable']&&_0x4c9203>_0x305a89[_0xed71('0x67')]+_0x6b1602){freeVariablesPredictive(_0x305a89);loggerPredictive[_0xed71('0x76')](_0x305a89[_0xed71('0x38')],_0xed71('0x1d7'),_0x4c9203,')\x20are\x20more\x20than\x20threshold\x20(',_0x305a89[_0xed71('0x67')],'+',_0x6b1602,'=',_0x305a89[_0xed71('0x67')]+_0x6b1602,')');}};Dialer[_0xed71('0x15')][_0xed71('0x1d2')]=function(_0x4cccfd){var _0x5e8705=this;return function(_0x3d6df2){return new BPromise(function(_0x5ce1b,_0x41dc93){_[_0xed71('0xcb')](_0x4cccfd,_0x3d6df2[0x0]);if(checkGetDataPredictive(_0x3d6df2[0x0])){var _0x21bc88=_0x4cccfd['predictiveIntervalAvailable']=_0x4cccfd[_0xed71('0x1d9')]+_0x4cccfd[_0xed71('0x9a')];var _0x6aeedf=_0x4cccfd[_0xed71('0x1c9')]*0x3c;var _0x3238de=_0x3d6df2[0x0]['predictiveIntervalAvgTalktime']+_0x3d6df2[0x0][_0xed71('0x5f')];var _0x231bc5=(_0x3d6df2[0x0][_0xed71('0x5e')]+_0x3d6df2[0x0][_0xed71('0x62')]+_0x3d6df2[0x0][_0xed71('0x61')])/_0x3d6df2[0x0][_0xed71('0x68')];_0x4cccfd[_0xed71('0x65')]=_0x231bc5>0x0?_0x231bc5:0x1;switch(_0x4cccfd[_0xed71('0x1cb')]){case _0xed71('0x1cc'):var _0x5e3deb=_0x4cccfd[_0xed71('0x1c1')]/0x64;return _0x5e8705['abandonmentRate'](_0x21bc88,_0x6aeedf,_0x3238de,_0x231bc5,_0x5e3deb)['then'](function(_0x35abd4){return _0x5ce1b(_0x35abd4);});case _0xed71('0x1da'):var _0x497bac=_0x4cccfd[_0xed71('0x1c1')]/0x64;return _0x5e8705[_0xed71('0x1db')](_0x21bc88,_0x6aeedf,_0x3238de,_0x231bc5,_0x497bac)[_0xed71('0xb1')](function(_0x4d864c){return _0x5ce1b(_0x4d864c);});default:return _0x41dc93(msgResponse(_0xed71('0x1dc'),_0xed71('0x138'),'Unknown\x20Predictive'));}}else{return _0x41dc93(msgResponse(_0xed71('0x1dc'),_0xed71('0x138'),'check\x20failure'));}});};};Dialer[_0xed71('0x15')]['getDataPredictiveOld']=function(_0x465528){var _0x33ef21=this;return function(_0x3b82d1){return new BPromise(function(_0x72553d,_0x48440c){_[_0xed71('0xcb')](_0x465528,_0x3b82d1[0x0]);if(checkGetDataPredictive(_0x3b82d1[0x0])){loggerPredictive['info'](JSON[_0xed71('0x41')](_0x3b82d1[0x0]));if(_0x465528[_0xed71('0x1cb')]===_0xed71('0x1cc')){return _0x33ef21[_0xed71('0xc2')](_0x465528['id'])[_0xed71('0xb1')](function(_0xf5fa2e){var _0x514baf=_0x465528[_0xed71('0x1dd')]-_0xf5fa2e[0x0][_0xed71('0x1de')];var _0x3c55de=_0x465528[_0xed71('0x1c9')]*0x3c;var _0x3d27ad=_0x3b82d1[0x0]['predictiveIntervalAvgTalktime']+_0x3b82d1[0x0][_0xed71('0x5f')];var _0x1c07f2=(_0x3b82d1[0x0]['predictiveIntervalAnsweredCalls']+_0x3b82d1[0x0][_0xed71('0x62')]+_0x3b82d1[0x0][_0xed71('0x61')])/_0x3b82d1[0x0][_0xed71('0x68')];var _0x35f18a=_0x465528[_0xed71('0x1c1')]/0x64;_0x465528['predictiveIntervalPauses']=_0xf5fa2e[0x0][_0xed71('0x1de')]||0x0;_0x465528[_0xed71('0x65')]=_0x1c07f2>0x0?_0x1c07f2:0x1;return _0x33ef21[_0xed71('0x1df')](_0x514baf,_0x3c55de,_0x3d27ad,_0x1c07f2,_0x35f18a);})[_0xed71('0xb1')](function(_0x2dd7df){return _0x72553d(_0x2dd7df);})[_0xed71('0xac')](function(_0x2a6d15){return _0x48440c(msgResponse('[CatchErlangB]',_0xed71('0x138'),JSON[_0xed71('0x41')](_0x2a6d15)));});}if(_0x465528['dialPredictiveOptimization']===_0xed71('0x1da')){return _0x33ef21[_0xed71('0xc2')](_0x465528['id'])[_0xed71('0xb1')](function(_0x132404){var _0x2cc6b3=_0x465528['loggedIn']-_0x132404[0x0][_0xed71('0x1de')];var _0x560b3d=_0x465528['dialPredictiveInterval']*0x3c;var _0x540a15=_0x3b82d1[0x0]['predictiveIntervalAvgTalktime']+_0x3b82d1[0x0]['predictiveIntervalAvgHoldtime'];var _0x4ce9a7=(_0x3b82d1[0x0][_0xed71('0x5e')]+_0x3b82d1[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x3b82d1[0x0][_0xed71('0x61')])/_0x3b82d1[0x0]['predictiveIntervalTotalCalls'];var _0x1128ff=_0x465528[_0xed71('0x1c1')]/0x64;_0x465528[_0xed71('0x66')]=_0x132404[0x0][_0xed71('0x1de')]||0x0;_0x465528[_0xed71('0x65')]=_0x4ce9a7>0x0?_0x4ce9a7:0x1;return _0x33ef21[_0xed71('0x1db')](_0x2cc6b3,_0x560b3d,_0x540a15,_0x4ce9a7,_0x1128ff);})[_0xed71('0xb1')](function(_0x53fb83){return _0x72553d(_0x53fb83);})[_0xed71('0xac')](function(_0x511056){return _0x48440c(msgResponse('[CatchErlangB]',_0xed71('0x138'),JSON[_0xed71('0x41')](_0x511056)));});}}else{return _0x48440c(msgResponse(_0xed71('0x1dc'),_0xed71('0x138'),'check\x20failure'));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x4bac86){var _0x127265=this;return function(){var _0xc013d4=0x0;var _0x199026=Math[_0xed71('0x1c4')](_0x4bac86[_0xed71('0x6a')]*0x3e8);if(_0x199026>0x0){_0x199026=_0x199026<0x64?0x64:_0x199026;loggerPredictive['info'](_0x4bac86[_0xed71('0x38')],'one\x20call\x20every:',_0x199026,_0xed71('0x42'));_0x4bac86['handlePredictive']=setInterval(function(){_0x127265[_0xed71('0x87')](_0x4bac86);loggerPredictiveCalls[_0xed71('0x76')](_0xed71('0x1e0'),_0xc013d4+=0x1);},_0x199026);}else{loggerPredictive[_0xed71('0x76')](_0x4bac86['name'],_0xed71('0x1e1'));}};};Dialer[_0xed71('0x15')]['checkContactBlack']=function(_0xb37f45,_0x5980c6){var _0x25c5d0=this;return function(_0x4fdcac){if(_[_0xed71('0x3f')](_0x4fdcac)){if(_[_0xed71('0xa8')](_0x5980c6[_0xed71('0xce')])||!_0x5980c6['recallme']){if(_0xb37f45['dialMethod']==='booked'){_0xb37f45[_0xed71('0x123')]=_[_0xed71('0x35')](_0xb37f45[_0xed71('0x123')])?!![]:_0xb37f45[_0xed71('0x123')];var _0x9ca04f=uuid['v4']();_0x25c5d0[_0xed71('0x1e')][_0x9ca04f]=new Action(_0xb37f45,_0x5980c6,_0x9ca04f);loggerBooked['info']('[booked][checkContactBlack]',_0x9ca04f,_0xed71('0x1e2'),JSON[_0xed71('0x41')](_0xb37f45[_0xed71('0x123')]),'Queue:\x20',_0xb37f45['name']);if(_0xb37f45[_0xed71('0x123')]){_0xb37f45[_0xed71('0x123')]=![];_0x25c5d0[_0xed71('0x23')][_0x25c5d0['actions'][_0x9ca04f][_0xed71('0xae')]]=[];ami[_0xed71('0xa9')]({'actionid':_0x9ca04f,'action':_0xed71('0x1e3'),'queue':_0xb37f45['name']})[_0xed71('0xac')](function(){_0x25c5d0[_0xed71('0xb0')](_0xb37f45);_0x25c5d0['rescheduleContact']({'active':![],'ContactId':_0x25c5d0[_0xed71('0x1e')][_0x9ca04f][_0xed71('0xcd')],'ListId':_0x25c5d0[_0xed71('0x1e')][_0x9ca04f][_0xed71('0xf9')],'VoiceQueueId':_0x25c5d0[_0xed71('0x1e')][_0x9ca04f][_0xed71('0xcf')]||undefined,'CampaignId':_0x25c5d0[_0xed71('0x1e')][_0x9ca04f]['CampaignId']||undefined})[_0xed71('0xac')](loggerCatch(_0xed71('0x1e4')));delete _0x25c5d0[_0xed71('0x1e')][_0x9ca04f];});}else{loggerBooked[_0xed71('0x76')](_0xed71('0x1e5'),JSON[_0xed71('0x41')](_0xb37f45[_0xed71('0x123')]),_0xed71('0x1e6'),_0xb37f45[_0xed71('0x38')]);_0x25c5d0['updateOriginated'](_0xb37f45);_0x25c5d0[_0xed71('0xbb')]({'active':![],'ContactId':_0x25c5d0[_0xed71('0x1e')][_0x9ca04f][_0xed71('0xcd')],'ListId':_0x25c5d0['actions'][_0x9ca04f][_0xed71('0xf9')],'VoiceQueueId':_0x25c5d0[_0xed71('0x1e')][_0x9ca04f][_0xed71('0xcf')]||undefined,'CampaignId':_0x25c5d0[_0xed71('0x1e')][_0x9ca04f]['CampaignId']||undefined})[_0xed71('0xac')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x25c5d0['actions'][_0x9ca04f];}}else{return _0x25c5d0[_0xed71('0x162')](_0xb37f45,_0x5980c6);}}else{if(getDiff(_0x5980c6['scheduledat'])<_0xb37f45['dialRecallMeTimeout']*0x3c){if(_0x5980c6[_0xed71('0x1e7')]&&!_0x5980c6[_0xed71('0x1e7')][_0xed71('0x1e8')]){_0x25c5d0[_0xed71('0x18')][_0xed71('0x126')](_0x5980c6['id'])[_0xed71('0x17')](function(){_0x25c5d0[_0xed71('0xb0')](_0xb37f45);});}else{_0x25c5d0[_0xed71('0xbd')]({'active':![]},_0x5980c6['id'],0x1)[_0xed71('0x17')](function(){_0x25c5d0[_0xed71('0xb0')](_0xb37f45);});}}else{_0xb37f45['outboundReCallsDay']+=0x1;_0x25c5d0[_0xed71('0xb0')](_0xb37f45);if(_0xb37f45[_0xed71('0x1e9')]){_0x25c5d0[_0xed71('0xbb')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5980c6['ContactId'],'ListId':_0x5980c6[_0xed71('0xf9')],'VoiceQueueId':_0x5980c6[_0xed71('0xcf')]||undefined,'CampaignId':_0x5980c6[_0xed71('0xff')]||undefined})[_0xed71('0xac')](loggerCatch(_0xed71('0x1ea')));_0x25c5d0[_0xed71('0xc4')](createObjHistory(_0xb37f45,_0x5980c6,_0xed71('0x1eb'),0x17,_0xed71('0x1ec')))[_0xed71('0xac')](loggerCatch(_0xed71('0x1ed')));}else{_0x25c5d0[_0xed71('0xca')](createObjHistory(_0xb37f45,_0x5980c6,_0xed71('0x1ee'),0x16,_0xed71('0x1ef')),_0xed71('0x1f0'),_0xed71('0x1f1'));}}}}else{_0xb37f45[_0xed71('0x1f2')]+=0x1;_0x25c5d0[_0xed71('0xca')](createObjHistory(_0xb37f45,_0x5980c6,_0xed71('0x1f3'),0xd,_0xed71('0x1f4')),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw _0xed71('0x1f5');}};};Dialer[_0xed71('0x15')][_0xed71('0x157')]=function(_0x45d6c2){var _0x1d7f2a=this;var _0x131358=_0x45d6c2['limitCalls']-_0x45d6c2[_0xed71('0x8f')]-_0x45d6c2[_0xed71('0x1f6')];emitCampaignSummary(_0x45d6c2);if(_0x131358>0x0){if(_0x131358>this[_0xed71('0x1c')]){_0x131358=this[_0xed71('0x1c')];}_0x45d6c2[_0xed71('0x1f6')]+=_0x131358;this['getContactDialerIvr'](_0x45d6c2['id'],_0x131358,_0x45d6c2['dialOrderByScheduledAt'])['then'](function(_0x15646a){_0x45d6c2[_0xed71('0x1f6')]-=_0x131358;_0x45d6c2[_0xed71('0x1f6')]=_0x45d6c2[_0xed71('0x1f6')]>0x0?_0x45d6c2[_0xed71('0x1f6')]:0x0;if(!checkContactEmpty(_0x15646a)){_0x45d6c2[_0xed71('0x36')]=_0xed71('0x97');logger[_0xed71('0x76')](_0xed71('0x1f7')+_0x45d6c2[_0xed71('0x38')]);}else{_0x45d6c2['originated']+=_0x15646a[_0xed71('0x8e')];_0x45d6c2[_0xed71('0x36')]=_0xed71('0x1f8');for(var _0x44414e=0x0;_0x44414e<_0x15646a[_0xed71('0x8e')];_0x44414e+=0x1){_0x45d6c2[_0xed71('0x1f9')]+=0x1;if(_[_0xed71('0xa8')](_0x15646a[_0x44414e])||_[_0xed71('0xa8')](_0x15646a[_0x44414e][_0xed71('0x164')])||_['isNil'](_0x15646a[_0x44414e][_0xed71('0x164')]['phone'])){_0x1d7f2a[_0xed71('0xc8')]('[actionOriginate]\x20',_0x45d6c2,_0x15646a[_0x44414e]);}else{_0x1d7f2a[_0xed71('0xb6')](_['pick'](_0x15646a[_0x44414e],['CampaignId',_0xed71('0x1fa')]))[_0xed71('0xb1')](_0x1d7f2a['checkContactBlack'](_0x45d6c2,_0x15646a[_0x44414e]))[_0xed71('0xac')](_0x1d7f2a[_0xed71('0xc7')](_0xed71('0x1fb'),_0x45d6c2));}}}})[_0xed71('0xac')](loggerGetContactDialer(_0xed71('0x1fc'),_0x45d6c2,_0x131358));}};Dialer[_0xed71('0x15')][_0xed71('0x150')]=function(_0x5e880d,_0x5f133f){var _0x7f9999=this;var _0x2337b2=[];var _0x33acbd=_0x5f133f>=0x1?_0x5f133f:0x1;if(_0x5e880d[_0xed71('0x50')]===_0xed71('0x153')){_0x33acbd=0x1;}var _0x3d7a50=Math[_0xed71('0x1c4')](_0x5e880d['available']*_0x33acbd)-_0x5e880d['originated']-_0x5e880d[_0xed71('0x1f6')];emitVoiceQueueSummary(_0x5e880d);if(_0x5e880d[_0xed71('0x1fd')]>0x0){var _0x10a5ba=_0x5e880d[_0xed71('0x1fd')]-_0x5e880d[_0xed71('0x8f')]-_0x5e880d['talking']-_0x5e880d[_0xed71('0x1f6')]-_0x5e880d['pTalking'];if(_0x3d7a50>_0x10a5ba){_0x3d7a50=_0x10a5ba;}}if(_0x3d7a50>0x0){if(_0x5e880d[_0xed71('0x50')]===_0xed71('0x153')){_0x3d7a50=0x1;}if(_0x3d7a50>this[_0xed71('0x1c')]){_0x3d7a50=this['maxNumberOriginate'];}_0x5e880d[_0xed71('0x1f6')]+=_0x3d7a50;for(var _0x4f2989 in this['agents']){if(typeof this[_0xed71('0x1b')][_0x4f2989]!==_0xed71('0x90')){if(this[_0xed71('0x1b')][_0x4f2989]['state']==='not_inuse'&&this[_0xed71('0x1b')][_0x4f2989]['status']==='reachable'){_0x2337b2[_0xed71('0x145')](this[_0xed71('0x1b')][_0x4f2989]['id']);}}}this[_0xed71('0xbf')](_0x5e880d['id'],_0x2337b2,_0x3d7a50,_0x5e880d[_0xed71('0x1fe')])['then'](function(_0x3cbbc1){_0x5e880d[_0xed71('0x1f6')]-=_0x3d7a50;_0x5e880d['temp']=_0x5e880d[_0xed71('0x1f6')]>0x0?_0x5e880d[_0xed71('0x1f6')]:0x0;if(!checkContactEmpty(_0x3cbbc1)){_0x7f9999['countReScheduled'](_0x5e880d)[_0xed71('0xb1')](sendMessageReschedule(_0x5e880d))[_0xed71('0xac')](loggerCatch(_0xed71('0x1ff')));}else{_0x5e880d[_0xed71('0x8f')]+=_0x3cbbc1[_0xed71('0x8e')];_0x5e880d[_0xed71('0x36')]=_0x5e880d[_0xed71('0x50')]===_0xed71('0x153')?_0xed71('0x16b'):_0xed71('0x1f8');for(var _0x3adc0=0x0;_0x3adc0<_0x3cbbc1[_0xed71('0x8e')];_0x3adc0+=0x1){if(_['isNil'](_0x3cbbc1[_0x3adc0])||_[_0xed71('0xa8')](_0x3cbbc1[_0x3adc0][_0xed71('0x164')])||_[_0xed71('0xa8')](_0x3cbbc1[_0x3adc0][_0xed71('0x164')][_0xed71('0x165')])){_0x7f9999[_0xed71('0xc8')]('[actionOriginate]\x20',_0x5e880d,_0x3cbbc1[_0x3adc0]);}else{_0x7f9999[_0xed71('0xb3')](_[_0xed71('0xcc')](_0x3cbbc1[_0x3adc0],[_0xed71('0xcf'),_0xed71('0x1fa')]))[_0xed71('0xb1')](_0x7f9999[_0xed71('0x200')](_0x5e880d,_0x3cbbc1[_0x3adc0]))[_0xed71('0xac')](_0x7f9999[_0xed71('0xc7')](_0xed71('0x201'),_0x5e880d));}}}})['catch'](loggerGetContactDialer(_0xed71('0x202'),_0x5e880d,_0x3d7a50));}};Dialer[_0xed71('0x15')][_0xed71('0x87')]=function(_0x31fc76){if(_0x31fc76['dialLimitQueue']>0x0){var _0x2a589e=_0x31fc76[_0xed71('0x1fd')]-_0x31fc76[_0xed71('0x8f')]-_0x31fc76[_0xed71('0x1d9')];if(_0x2a589e>0x0){this['tryOriginatePredictive'](_0x31fc76);}else{loggerPredictiveCalls['info'](_0xed71('0x203'));}}else{this['tryOriginatePredictive'](_0x31fc76);}};Dialer['prototype'][_0xed71('0x204')]=function(_0x1fa96f){var _0x1bed13=this;var _0x108151=[];_0x1fa96f['originated']+=0x1;for(var _0x3ddd04 in this[_0xed71('0x1b')]){if(typeof this[_0xed71('0x1b')][_0x3ddd04]!==_0xed71('0x90')){if(this['agents'][_0x3ddd04][_0xed71('0xdf')]===_0xed71('0x205')&&this['agents'][_0x3ddd04]['status']===_0xed71('0xd8')){_0x108151['push'](this['agents'][_0x3ddd04]['id']);}}}this[_0xed71('0xbf')](_0x1fa96f['id'],_0x108151,0x1,_0x1fa96f['dialOrderByScheduledAt'])['then'](function(_0x1f2481){if(!checkContactEmpty(_0x1f2481)){checkContactLowerLimitOriginate(_0x1fa96f,0x1,0x0);_0x1bed13[_0xed71('0xb2')](_0x1fa96f)[_0xed71('0xb1')](sendMessageReschedule(_0x1fa96f))['catch'](loggerCatch(_0xed71('0x1ff')));}else{_0x1fa96f[_0xed71('0x36')]=_0xed71('0x1f8');if(_[_0xed71('0xa8')](_0x1f2481[0x0])||_[_0xed71('0xa8')](_0x1f2481[0x0][_0xed71('0x164')])||_[_0xed71('0xa8')](_0x1f2481[0x0][_0xed71('0x164')][_0xed71('0x165')])){_0x1bed13[_0xed71('0xc8')]('[actionOriginate]\x20',_0x1fa96f,_0x1f2481[0x0]);}else{_0x1bed13[_0xed71('0xb3')](_['pick'](_0x1f2481[0x0],[_0xed71('0xcf'),_0xed71('0x1fa')]))[_0xed71('0xb1')](_0x1bed13[_0xed71('0x200')](_0x1fa96f,_0x1f2481[0x0]))[_0xed71('0xac')](_0x1bed13['loggerHandler'](_0xed71('0x206'),_0x1fa96f));}}})[_0xed71('0xac')](loggerGetContactDialer(_0xed71('0x207'),_0x1fa96f,0x1));emitVoiceQueueSummary(_0x1fa96f);};Dialer['prototype']['abandonmentRate']=function(_0x1572eb,_0x49de14,_0x639d9c,_0x41d26a,_0x514e82,_0x335395){loggerPredictive['info'](_0xed71('0x208'));loggerPredictive[_0xed71('0x76')](_0xed71('0x209'),_0x1572eb);loggerPredictive[_0xed71('0x76')](_0xed71('0x20a'),_0x49de14);loggerPredictive[_0xed71('0x76')](_0xed71('0x20b'),_0x639d9c);loggerPredictive['info'](_0xed71('0x20c'),_0x41d26a);loggerPredictive[_0xed71('0x76')](_0xed71('0x20d'),_0x514e82);loggerPredictive[_0xed71('0x76')](_0xed71('0x7d'));return new BPromise(function(_0x4783f4,_0x19dace){if(_0x1572eb<=0x0||isNaN(_0x1572eb)){return _0x19dace(msgResponse('[abandonmentRate]',_0xed71('0x18c'),_0xed71('0x20e')+_0x1572eb));}if(_0x639d9c<=0x0||isNaN(_0x639d9c)){return _0x19dace(msgResponse(_0xed71('0x20f'),_0xed71('0x18c'),'Ts\x20=\x20'+_0x639d9c));}if(_0x41d26a<=0x0||isNaN(_0x41d26a)){return _0x19dace(msgResponse(_0xed71('0x20f'),_0xed71('0x18c'),_0xed71('0x210')+_0x41d26a));}if(_0x49de14<=0x0||isNaN(_0x49de14)){return _0x19dace(msgResponse(_0xed71('0x20f'),_0xed71('0x18c'),'interval\x20=\x20'+_0x49de14));}if(_0x514e82<=0x0||isNaN(_0x514e82)){return _0x19dace(msgResponse(_0xed71('0x20f'),_0xed71('0x18c'),_0xed71('0x211')+_0x514e82));}_0x335395=_0x335395||0x0;var _0x25b10f=0x1/_0x639d9c;var _0x20630d=0x0;var _0x447f96=0x0;var _0x290c5f=0x0;var _0x5e1849=0x0;for(var _0x1114c1=0x0;_0x290c5f<_0x514e82;_0x1114c1+=0x1){_0x447f96=_0x1114c1/_0x49de14;_0x20630d=(_0x41d26a*_0x447f96+_0x335395)/_0x25b10f;_0x290c5f=erlangb(_0x20630d,_0x1572eb);_0x5e1849=_0x20630d/_0x1572eb*(0x1-erlangb(_0x20630d,_0x1572eb));}return _0x4783f4({'erlangCalls':_0x1114c1,'erlangCallToSecond':_0x49de14/_0x1114c1,'erlangAbandonmentRate':_0x290c5f,'erlangBusyFactor':_0x5e1849});});};Dialer[_0xed71('0x15')][_0xed71('0x1db')]=function(_0x444da8,_0x676208,_0x5f28b1,_0x1b43cb,_0x29530a,_0x19ee20){loggerPredictive[_0xed71('0x76')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive['info'](_0xed71('0x209'),_0x444da8);loggerPredictive[_0xed71('0x76')](_0xed71('0x20a'),_0x676208);loggerPredictive[_0xed71('0x76')](_0xed71('0x20b'),_0x5f28b1);loggerPredictive[_0xed71('0x76')]('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',_0x1b43cb);loggerPredictive[_0xed71('0x76')](_0xed71('0x212'),_0x29530a);loggerPredictive[_0xed71('0x76')]('---------------------------');return new BPromise(function(_0x48123b,_0x5cc745){if(_0x444da8<=0x0||isNaN(_0x444da8)){return _0x5cc745(msgResponse(_0xed71('0x213'),_0xed71('0x18c'),_0xed71('0x20e')+_0x444da8));}if(_0x5f28b1<=0x0||isNaN(_0x5f28b1)){return _0x5cc745(msgResponse('[busyFactor]','Error',_0xed71('0x214')+_0x5f28b1));}if(_0x1b43cb<=0x0||isNaN(_0x1b43cb)){return _0x5cc745(msgResponse(_0xed71('0x213'),'Error',_0xed71('0x210')+_0x1b43cb));}if(_0x676208<=0x0||isNaN(_0x676208)){return _0x5cc745(msgResponse(_0xed71('0x213'),_0xed71('0x18c'),'interval\x20=\x20'+_0x676208));}if(_0x29530a<=0x0||isNaN(_0x29530a)){return _0x5cc745(msgResponse(_0xed71('0x213'),'Error','Umin\x20=\x20'+_0x29530a));}_0x19ee20=_0x19ee20||0x0;var _0x109e04=0x1/_0x5f28b1;var _0x376944=0x0;var _0x3c7680=0x0;var _0x325c8b=0x0;var _0x501d4a=0x0;for(var _0x4e0ad9=0x0;_0x501d4a<_0x29530a;_0x4e0ad9+=0x1){_0x3c7680=_0x4e0ad9/_0x676208;_0x376944=(_0x1b43cb*_0x3c7680+_0x19ee20)/_0x109e04;_0x325c8b=erlangb(_0x376944,_0x444da8);_0x501d4a=_0x376944/_0x444da8*(0x1-erlangb(_0x376944,_0x444da8));}return _0x48123b({'erlangCalls':_0x4e0ad9,'erlangCallToSecond':_0x676208/_0x4e0ad9,'erlangAbandonmentRate':_0x325c8b,'erlangBusyFactor':_0x501d4a});});};module[_0xed71('0x215')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index f7fee9b..53ffff4 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb905=['countabandonedretry','countdropretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','droptime','ringtime','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x4ac2d2,_0x547088){var _0x175eda=function(_0x2afeeb){while(--_0x2afeeb){_0x4ac2d2['push'](_0x4ac2d2['shift']());}};_0x175eda(++_0x547088);}(_0xb905,0x174));var _0x5b90=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb905[_0x397e5f];return _0x5302b8;};'use strict';var util=require('util');var _=require(_0x5b90('0x0'));var moment=require(_0x5b90('0x1'));function getSeconds(_0xae0d6a,_0x287d3c){var _0x36eb0f=moment(_0xae0d6a)[_0x5b90('0x2')](0x0);var _0x1b21c5=moment(_0x287d3c)[_0x5b90('0x2')](0x0);return _0x36eb0f[_0x5b90('0x3')](_0x1b21c5,_0x5b90('0x4'));}function QueueCallerAbandon(_0xe42da0,_0x3eacef){this[_0x5b90('0x5')]=_0xe42da0[_0x5b90('0x5')];this[_0x5b90('0x6')]=_0xe42da0['type'];this[_0x5b90('0x7')]=_0xe42da0[_0x5b90('0x6')]===_0x5b90('0x8')?_0x5b90('0x9'):_0xe42da0[_0x5b90('0x6')];this[_0x5b90('0xa')]=_0xe42da0[_0x5b90('0xa')];this[_0x5b90('0xb')]=_0xe42da0['countcongestionretry'];this[_0x5b90('0xc')]=_0xe42da0[_0x5b90('0xc')];this[_0x5b90('0xd')]=_0xe42da0['countbusyretry']+_0xe42da0[_0x5b90('0xb')]+_0xe42da0['countnoanswerretry']+_0xe42da0[_0x5b90('0xe')]+_0xe42da0['countdropretry']+_0xe42da0[_0x5b90('0xf')]+_0xe42da0['countmachineretry']+_0xe42da0['countagentrejectretry'];this['countnosuchnumberretry']=_0xe42da0[_0x5b90('0xe')];this[_0x5b90('0x10')]=_0xe42da0[_0x5b90('0x10')];this[_0x5b90('0xf')]=_0xe42da0[_0x5b90('0xf')];this[_0x5b90('0x11')]=_0xe42da0[_0x5b90('0x11')];this[_0x5b90('0x12')]=_0xe42da0[_0x5b90('0x12')];this[_0x5b90('0x13')]=_0x3eacef[_0x5b90('0x13')];this[_0x5b90('0x14')]=_0xe42da0['name'];this[_0x5b90('0x15')]=_0xe42da0[_0x5b90('0x16')];this[_0x5b90('0x17')]=_0xe42da0[_0x5b90('0x17')];this[_0x5b90('0x18')]=_0xe42da0[_0x5b90('0x18')];this[_0x5b90('0x19')]=_0xe42da0['droptime'];this['endtime']=this[_0x5b90('0x19')];this[_0x5b90('0x1a')]=getSeconds(_0xe42da0[_0x5b90('0x18')],_0xe42da0[_0x5b90('0x17')]);this[_0x5b90('0x1b')]=getSeconds(this['droptime'],_0xe42da0[_0x5b90('0x18')]);this[_0x5b90('0x1c')]=0x0;this[_0x5b90('0x9')]=_0x3eacef[_0x5b90('0x9')];this['membername']=_0x3eacef[_0x5b90('0x1d')];this['reason']=_0x3eacef[_0x5b90('0x1e')];this[_0x5b90('0x1f')]=_0xe42da0[_0x5b90('0x1f')];this[_0x5b90('0x20')]=_0xe42da0['callbackuniqueid'];this['callbackat']=_0xe42da0[_0x5b90('0x21')];this['recallme']=_0xe42da0[_0x5b90('0x22')];this[_0x5b90('0x23')]=_0xe42da0[_0x5b90('0x23')];this[_0x5b90('0x24')]=_0xe42da0[_0x5b90('0x24')];this['UserId']=_0xe42da0[_0x5b90('0x25')];this['VoiceQueueId']=_0xe42da0[_0x5b90('0x26')];this[_0x5b90('0x27')]=_0xe42da0[_0x5b90('0x27')];this[_0x5b90('0x28')]=_0xe42da0[_0x5b90('0x28')]||'';this[_0x5b90('0x29')]=_0xe42da0['originatecalleridname']||'';}module[_0x5b90('0x2a')]=QueueCallerAbandon; \ No newline at end of file +var _0xeb65=['diff','seconds','scheduledat','type','outbound','countbusyretry','countnoanswerretry','countcongestionretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','uniqueid','calleridname','starttime','responsetime','droptime','endtime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds'];(function(_0x3d1194,_0x3d5f55){var _0x2eb376=function(_0x1d56ea){while(--_0x1d56ea){_0x3d1194['push'](_0x3d1194['shift']());}};_0x2eb376(++_0x3d5f55);}(_0xeb65,0x144));var _0x5eb6=function(_0x336b69,_0x5d1e16){_0x336b69=_0x336b69-0x0;var _0x5abc63=_0xeb65[_0x336b69];return _0x5abc63;};'use strict';var util=require(_0x5eb6('0x0'));var _=require(_0x5eb6('0x1'));var moment=require(_0x5eb6('0x2'));function getSeconds(_0x804b2c,_0x2123e8){var _0x49a92a=moment(_0x804b2c)[_0x5eb6('0x3')](0x0);var _0x5c1a6e=moment(_0x2123e8)['milliseconds'](0x0);return _0x49a92a[_0x5eb6('0x4')](_0x5c1a6e,_0x5eb6('0x5'));}function QueueCallerAbandon(_0x323194,_0x1dd583){this[_0x5eb6('0x6')]=_0x323194[_0x5eb6('0x6')];this[_0x5eb6('0x7')]=_0x323194[_0x5eb6('0x7')];this['campaigntype']=_0x323194[_0x5eb6('0x7')]===_0x5eb6('0x8')?'queue':_0x323194[_0x5eb6('0x7')];this[_0x5eb6('0x9')]=_0x323194[_0x5eb6('0x9')];this['countcongestionretry']=_0x323194['countcongestionretry'];this[_0x5eb6('0xa')]=_0x323194[_0x5eb6('0xa')];this['countglobal']=_0x323194[_0x5eb6('0x9')]+_0x323194[_0x5eb6('0xb')]+_0x323194[_0x5eb6('0xa')]+_0x323194[_0x5eb6('0xc')]+_0x323194['countdropretry']+_0x323194[_0x5eb6('0xd')]+_0x323194['countmachineretry']+_0x323194[_0x5eb6('0xe')];this[_0x5eb6('0xc')]=_0x323194[_0x5eb6('0xc')];this[_0x5eb6('0xf')]=_0x323194[_0x5eb6('0xf')];this[_0x5eb6('0xd')]=_0x323194[_0x5eb6('0xd')];this[_0x5eb6('0x10')]=_0x323194['countmachineretry'];this[_0x5eb6('0xe')]=_0x323194[_0x5eb6('0xe')];this['uniqueid']=_0x1dd583[_0x5eb6('0x11')];this[_0x5eb6('0x12')]=_0x323194['name'];this['calleridnum']=_0x323194['number'];this['starttime']=_0x323194[_0x5eb6('0x13')];this[_0x5eb6('0x14')]=_0x323194['responsetime'];this[_0x5eb6('0x15')]=_0x323194[_0x5eb6('0x15')];this[_0x5eb6('0x16')]=this[_0x5eb6('0x15')];this[_0x5eb6('0x17')]=getSeconds(_0x323194[_0x5eb6('0x14')],_0x323194[_0x5eb6('0x13')]);this[_0x5eb6('0x18')]=getSeconds(this['droptime'],_0x323194[_0x5eb6('0x14')]);this[_0x5eb6('0x19')]=0x0;this['queue']=_0x1dd583['queue'];this[_0x5eb6('0x1a')]=_0x1dd583[_0x5eb6('0x1b')];this[_0x5eb6('0x1c')]=_0x1dd583['reason'];this[_0x5eb6('0x1d')]=_0x323194[_0x5eb6('0x1d')];this[_0x5eb6('0x1e')]=_0x323194[_0x5eb6('0x1e')];this[_0x5eb6('0x1f')]=_0x323194[_0x5eb6('0x1f')];this['recallme']=_0x323194[_0x5eb6('0x20')];this[_0x5eb6('0x21')]=_0x323194[_0x5eb6('0x21')];this[_0x5eb6('0x22')]=_0x323194['ListId'];this[_0x5eb6('0x23')]=_0x323194[_0x5eb6('0x23')];this[_0x5eb6('0x24')]=_0x323194['VoiceQueueId'];this[_0x5eb6('0x25')]=_0x323194['CampaignId'];this[_0x5eb6('0x26')]=_0x323194['originatecalleridnum']||'';this[_0x5eb6('0x27')]=_0x323194[_0x5eb6('0x27')]||'';}module[_0x5eb6('0x28')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 216e38b..120f2d0 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 _0xd13f=['exports','util','lodash','moment','uniqueid','channel','tech','Trunk','fax','localstationid','headerinfo','path','AttachmentId'];(function(_0x19685f,_0x15e119){var _0x25c05d=function(_0xe56243){while(--_0xe56243){_0x19685f['push'](_0x19685f['shift']());}};_0x25c05d(++_0x15e119);}(_0xd13f,0x1a1));var _0xfd13=function(_0x2f11b9,_0x235692){_0x2f11b9=_0x2f11b9-0x0;var _0x49397c=_0xd13f[_0x2f11b9];return _0x49397c;};'use strict';var util=require(_0xfd13('0x0'));var _=require(_0xfd13('0x1'));var moment=require(_0xfd13('0x2'));function Action(_0x3091a1,_0x491cec,_0x49c5a3){this[_0xfd13('0x3')]=_0x3091a1||undefined;this[_0xfd13('0x4')]=util['format']('%s/%s/%s',_0x491cec[_0xfd13('0x5')],_0x491cec[_0xfd13('0x6')]['name'],_0x49c5a3[_0xfd13('0x7')]);this[_0xfd13('0x8')]=_0x491cec['localstationid'];this[_0xfd13('0x9')]=_0x491cec[_0xfd13('0x9')];this['path']=_0x49c5a3[_0xfd13('0xa')];this[_0xfd13('0xb')]=_0x49c5a3[_0xfd13('0xb')];}module[_0xfd13('0xc')]=Action; \ No newline at end of file +var _0x064d=['tech','Trunk','localstationid','headerinfo','path','AttachmentId','util','lodash','moment','uniqueid','format','%s/%s/%s'];(function(_0x59d546,_0x107f05){var _0x41fbdb=function(_0x413e68){while(--_0x413e68){_0x59d546['push'](_0x59d546['shift']());}};_0x41fbdb(++_0x107f05);}(_0x064d,0xd2));var _0xd064=function(_0x18a465,_0x5a90fa){_0x18a465=_0x18a465-0x0;var _0x21346f=_0x064d[_0x18a465];return _0x21346f;};'use strict';var util=require(_0xd064('0x0'));var _=require(_0xd064('0x1'));var moment=require(_0xd064('0x2'));function Action(_0x1cbde8,_0xeee0e8,_0x6f5bc7){this[_0xd064('0x3')]=_0x1cbde8||undefined;this['channel']=util[_0xd064('0x4')](_0xd064('0x5'),_0xeee0e8[_0xd064('0x6')],_0xeee0e8[_0xd064('0x7')]['name'],_0x6f5bc7['fax']);this[_0xd064('0x8')]=_0xeee0e8['localstationid'];this[_0xd064('0x9')]=_0xeee0e8[_0xd064('0x9')];this[_0xd064('0xa')]=_0x6f5bc7[_0xd064('0xa')];this[_0xd064('0xb')]=_0x6f5bc7[_0xd064('0xb')];}module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index ef885aa..acd706f 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 _0xbb48=['pick','reason','update','AttachmentId','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','syncHangup','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','format','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20path','Is\x20Valid','util','lodash','bluebird','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','syncNewState','faxstatus','syncReceiveFax','hangup','originateresponse','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable','channelstate','channelstatedesc','syncNewExten','value','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','syncOriginateResponse'];(function(_0x2f981b,_0x3283b8){var _0x61f72e=function(_0x18249d){while(--_0x18249d){_0x2f981b['push'](_0x2f981b['shift']());}};_0x61f72e(++_0x3283b8);}(_0xbb48,0x1ee));var _0x8bb4=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xbb48[_0x17d9e3];return _0x14192d;};'use strict';var util=require(_0x8bb4('0x0'));var _=require(_0x8bb4('0x1'));var BPromise=require(_0x8bb4('0x2'));var uuid=require('uuid');var moment=require('moment');var path=require(_0x8bb4('0x3'));var tiff2pdf=require(_0x8bb4('0x4'));var gs=require('./util/gs');var logger=require(_0x8bb4('0x5'))(_0x8bb4('0x6'));var ami=require(_0x8bb4('0x7'));var rpcDb=require(_0x8bb4('0x8'));var Channel=require(_0x8bb4('0x9'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0x8bb4('0xa'));var attachment=require(_0x8bb4('0xb'));var faxMessage=require(_0x8bb4('0xc'));function Fax(_0x481f2e){this[_0x8bb4('0xd')]={};this['faxAccounts']=_0x481f2e[_0x8bb4('0xe')];this[_0x8bb4('0xf')]=_0x481f2e[_0x8bb4('0xf')];this[_0x8bb4('0x10')]={};ami['on']('newchannel',this[_0x8bb4('0x11')][_0x8bb4('0x12')](this));ami['on'](_0x8bb4('0x13'),this[_0x8bb4('0x14')][_0x8bb4('0x12')](this));ami['on']('newstate',this[_0x8bb4('0x15')][_0x8bb4('0x12')](this));ami['on']('newexten',this['syncNewExten'][_0x8bb4('0x12')](this));ami['on'](_0x8bb4('0x16'),this['syncFaxStatus']['bind'](this));ami['on']('receivefax',this[_0x8bb4('0x17')]['bind'](this));ami['on'](_0x8bb4('0x18'),this['syncHangup'][_0x8bb4('0x12')](this));ami['on'](_0x8bb4('0x19'),this['syncOriginateResponse'][_0x8bb4('0x12')](this));}Fax['prototype'][_0x8bb4('0x11')]=function(_0x136b35){if(_0x136b35[_0x8bb4('0x1a')]===_0x8bb4('0x1b')){for(var _0x16b5db in this[_0x8bb4('0xe')]){if(this['faxAccounts'][_0x8bb4('0x1c')](_0x16b5db)){if(_0x136b35[_0x8bb4('0x1d')]===this[_0x8bb4('0xe')][_0x16b5db][_0x8bb4('0x1e')]){this['channels'][_0x136b35[_0x8bb4('0x1f')]]={};this[_0x8bb4('0xd')][_0x136b35[_0x8bb4('0x1f')]][_0x8bb4('0x20')]=_0x136b35[_0x8bb4('0x20')];this['channels'][_0x136b35[_0x8bb4('0x1f')]]['id']=this[_0x8bb4('0xe')][_0x16b5db]['id'];this[_0x8bb4('0xd')][_0x136b35[_0x8bb4('0x1f')]][_0x8bb4('0x21')]=this[_0x8bb4('0xe')][_0x16b5db][_0x8bb4('0x21')];logger[_0x8bb4('0x22')](_0x136b35['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x136b35['uniqueid']]){this[_0x8bb4('0xd')][_0x136b35[_0x8bb4('0x1f')]]={};this[_0x8bb4('0xd')][_0x136b35['uniqueid']]['channel']=_0x136b35[_0x8bb4('0x20')];logger[_0x8bb4('0x22')](_0x136b35[_0x8bb4('0x1f')],_0x8bb4('0x23'));}};Fax[_0x8bb4('0x24')][_0x8bb4('0x14')]=function(_0x19167f){if(this[_0x8bb4('0xd')][_0x19167f[_0x8bb4('0x1f')]]){for(var _0x79064b in _0x19167f[_0x8bb4('0x25')]){if(_0x19167f[_0x8bb4('0x25')][_0x8bb4('0x1c')](_0x79064b)){this[_0x8bb4('0xd')][_0x19167f[_0x8bb4('0x1f')]][_0x79064b]=_0x19167f['value'];}}}};Fax[_0x8bb4('0x24')]['syncNewState']=function(_0x44e601){if(this[_0x8bb4('0xd')][_0x44e601[_0x8bb4('0x1f')]]){this[_0x8bb4('0xd')][_0x44e601[_0x8bb4('0x1f')]]['channelstate']=_0x44e601[_0x8bb4('0x26')];this[_0x8bb4('0xd')][_0x44e601[_0x8bb4('0x1f')]][_0x8bb4('0x27')]=_0x44e601[_0x8bb4('0x27')];}};Fax[_0x8bb4('0x24')][_0x8bb4('0x28')]=function(_0x3cc63b){if(this[_0x8bb4('0xd')][_0x3cc63b[_0x8bb4('0x1f')]]){for(var _0x10cb8b in _0x3cc63b[_0x8bb4('0x25')]){if(_0x3cc63b[_0x8bb4('0x25')][_0x8bb4('0x1c')](_0x10cb8b)){this[_0x8bb4('0xd')][_0x3cc63b[_0x8bb4('0x1f')]][_0x10cb8b]=_0x3cc63b[_0x8bb4('0x29')];}}}};Fax['prototype'][_0x8bb4('0x2a')]=function(_0xfdefb2){if(this[_0x8bb4('0xd')][_0xfdefb2['uniqueid']]){this[_0x8bb4('0xd')][_0xfdefb2['uniqueid']][_0x8bb4('0x2b')]=_0xfdefb2[_0x8bb4('0x2b')];this['channels'][_0xfdefb2[_0x8bb4('0x1f')]][_0x8bb4('0x2c')]=_0xfdefb2[_0x8bb4('0x2c')];this['channels'][_0xfdefb2[_0x8bb4('0x1f')]][_0x8bb4('0x1e')]=_0xfdefb2['localstationid'];this[_0x8bb4('0xd')][_0xfdefb2[_0x8bb4('0x1f')]][_0x8bb4('0x2d')]=_0xfdefb2[_0x8bb4('0x2d')];logger[_0x8bb4('0x22')](_0xfdefb2[_0x8bb4('0x1f')],_0x8bb4('0x2e'));}};Fax[_0x8bb4('0x24')][_0x8bb4('0x17')]=function(_0x1b9abb){var _0x4d1906=this;if(this[_0x8bb4('0xd')][_0x1b9abb[_0x8bb4('0x1f')]]){var _0x63ff7a=this[_0x8bb4('0xd')][_0x1b9abb[_0x8bb4('0x1f')]]['id'];this[_0x8bb4('0xd')][_0x1b9abb[_0x8bb4('0x1f')]]['remotestationid']=_0x1b9abb['remotestationid'];this[_0x8bb4('0xd')][_0x1b9abb[_0x8bb4('0x1f')]][_0x8bb4('0x2f')]=_0x1b9abb[_0x8bb4('0x2f')];this[_0x8bb4('0xd')][_0x1b9abb[_0x8bb4('0x1f')]][_0x8bb4('0x1e')]=_0x1b9abb[_0x8bb4('0x1e')];this['channels'][_0x1b9abb[_0x8bb4('0x1f')]][_0x8bb4('0x30')]=_0x1b9abb['resolution'];this[_0x8bb4('0xd')][_0x1b9abb[_0x8bb4('0x1f')]][_0x8bb4('0x31')]=_0x1b9abb[_0x8bb4('0x31')];this[_0x8bb4('0xd')][_0x1b9abb['uniqueid']][_0x8bb4('0x2d')]=_0x1b9abb[_0x8bb4('0x2d')];this['channels'][_0x1b9abb[_0x8bb4('0x1f')]][_0x8bb4('0x32')]=_0x1b9abb['calleridnum'];if(this['channels'][_0x1b9abb[_0x8bb4('0x1f')]][_0x8bb4('0x2f')]>0x0){tiff2pdf(_0x1b9abb[_0x8bb4('0x2d')],_0x8bb4('0x33'),function(_0x3d8d1e){logger[_0x8bb4('0x22')](_0x1b9abb[_0x8bb4('0x1f')],_0x8bb4('0x34'),_0x3d8d1e[_0x8bb4('0x35')]);attachment[_0x8bb4('0x36')]({'name':path[_0x8bb4('0x37')](_0x1b9abb[_0x8bb4('0x2d')])[_0x8bb4('0x21')],'basename':path[_0x8bb4('0x37')](_0x1b9abb['filename'])['name']+_0x8bb4('0x38'),'type':_0x8bb4('0x39')})[_0x8bb4('0x3a')](function(_0xc4db04){faxAccount[_0x8bb4('0x3b')](_0x63ff7a,{'from':_0x1b9abb[_0x8bb4('0x32')],'mapKey':_0x8bb4('0x6'),'body':path[_0x8bb4('0x37')](_0x1b9abb[_0x8bb4('0x2d')])[_0x8bb4('0x21')]+_0x8bb4('0x38'),'AttachmentId':_0xc4db04['id']})[_0x8bb4('0x3c')](function(_0xa67980){logger[_0x8bb4('0x3d')](_0x1b9abb[_0x8bb4('0x1f')],_0x8bb4('0x3e'),JSON[_0x8bb4('0x3f')](_0xa67980));});})[_0x8bb4('0x3c')](function(_0x5acaa4){logger[_0x8bb4('0x3d')](_0x1b9abb['uniqueid'],_0x8bb4('0x40'),JSON['stringify'](_0x5acaa4));});});}logger[_0x8bb4('0x22')](_0x1b9abb[_0x8bb4('0x1f')],_0x8bb4('0x40'));}};Fax['prototype'][_0x8bb4('0x41')]=function(_0x46f96c){if(this['actions'][_0x46f96c[_0x8bb4('0x1f')]]){_['merge'](this['channels'][_0x46f96c['uniqueid']],_[_0x8bb4('0x42')](_0x46f96c,['response',_0x8bb4('0x43')]));}};function updateStatus(_0xed2af0){if(_0xed2af0['AttachmentId']){faxMessage[_0x8bb4('0x44')](_0xed2af0[_0x8bb4('0x45')],{'failMessage':_0x8bb4('0x46')})['then'](function(_0x181a5a){ut['logger'](_0x8bb4('0x47'),_0x181a5a);})[_0x8bb4('0x3c')](function(_0x314ae6){ut[_0x8bb4('0x48')](_0x8bb4('0x49'),_0x314ae6);});}else{ut[_0x8bb4('0x48')](_0x8bb4('0x4a'));}}Fax[_0x8bb4('0x24')][_0x8bb4('0x4b')]=function(_0x4cfa41,_0x45d5de,_0x18c48d){var _0x34a05c=this;var _0x4e88fd={};if(_0x45d5de){_0x4e88fd={'read':_0x45d5de};}else{_0x4e88fd={'failMessage':_0x18c48d};}if(this['actions'][_0x4cfa41][_0x8bb4('0x45')]){faxMessage[_0x8bb4('0x44')](this['actions'][_0x4cfa41][_0x8bb4('0x45')],_0x4e88fd)[_0x8bb4('0x3a')](function(_0x393501){ut['logger'](_0x8bb4('0x4c'),_0x393501);})['catch'](function(_0x279aeb){ut[_0x8bb4('0x48')](_0x8bb4('0x4d'),_0x279aeb);})['finally'](function(){delete _0x34a05c[_0x8bb4('0xd')][_0x4cfa41];delete _0x34a05c[_0x8bb4('0x10')][_0x4cfa41];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this[_0x8bb4('0xd')][_0x4cfa41];delete this[_0x8bb4('0x10')][_0x4cfa41];}};Fax[_0x8bb4('0x24')][_0x8bb4('0x4e')]=function(_0x439b41){var _0x1d8c63=this;if(this[_0x8bb4('0xd')][_0x439b41[_0x8bb4('0x1f')]]){if(this[_0x8bb4('0x10')][_0x439b41[_0x8bb4('0x1f')]]){this['channels'][_0x439b41[_0x8bb4('0x1f')]]['id']=this[_0x8bb4('0x10')][_0x439b41[_0x8bb4('0x1f')]]['id'];this['channels'][_0x439b41[_0x8bb4('0x1f')]]['name']=this[_0x8bb4('0x10')][_0x439b41[_0x8bb4('0x1f')]][_0x8bb4('0x21')];}logger[_0x8bb4('0x22')](_0x439b41[_0x8bb4('0x1f')],this[_0x8bb4('0x10')][_0x439b41['uniqueid']]?'\x20hangup\x20sendFile\x20':_0x8bb4('0x4f'),JSON[_0x8bb4('0x3f')](this[_0x8bb4('0xd')][_0x439b41[_0x8bb4('0x1f')]]));if(this['actions'][_0x439b41[_0x8bb4('0x1f')]]){if(this[_0x8bb4('0xd')][_0x439b41['uniqueid']]['faxpages']>0x0&&this[_0x8bb4('0xd')][_0x439b41['uniqueid']][_0x8bb4('0x16')]===_0x8bb4('0x50')){this[_0x8bb4('0x4b')](_0x439b41['uniqueid'],!![]);}else{this['updateStatus'](_0x439b41[_0x8bb4('0x1f')],![],this[_0x8bb4('0xd')][_0x439b41[_0x8bb4('0x1f')]][_0x8bb4('0x51')]?_0x8bb4('0x52')+this[_0x8bb4('0xd')][_0x439b41[_0x8bb4('0x1f')]]['faxstatusstring']:_0x8bb4('0x53'));}}}};Fax[_0x8bb4('0x24')][_0x8bb4('0x54')]=function(_0x4942b9){var _0x227047=this;return new BPromise(function(_0x265ee0,_0xceaffc){_0x227047[_0x8bb4('0x55')](_0x4942b9,_0x227047[_0x8bb4('0xe')][_0x4942b9[_0x8bb4('0x56')]])[_0x8bb4('0x3a')](function(_0x2a5164){ut[_0x8bb4('0x48')]('[Fax][execOriginate][success]',_0x2a5164);_0x265ee0(ut['message'](_0x8bb4('0x57')));})[_0x8bb4('0x3c')](function(_0x256978){ut['logger'](_0x8bb4('0x58'),_0x256978);updateStatus(_0x4942b9);_0xceaffc(ut[_0x8bb4('0x35')](_0x8bb4('0x59')));});});};Fax[_0x8bb4('0x24')]['checkAfterSend']=function(_0x134222){var _0x1a8ef3=this;return new BPromise(function(_0xafd00d,_0x1c366f){var _0x249571=_0x1a8ef3[_0x8bb4('0x5a')](_0x1a8ef3[_0x8bb4('0xe')][_0x134222[_0x8bb4('0x56')]][_0x8bb4('0x5b')],_0x134222);if(_0x249571[_0x8bb4('0x5c')]){_0xafd00d(ut[_0x8bb4('0x35')]('Trunk\x20Reachable'));}else{_0x1c366f(ut[_0x8bb4('0x35')](_0x249571[_0x8bb4('0x35')]));}});};function originate(_0x404670,_0x5161ec,_0x497630){return new BPromise(function(_0x40c88e,_0x3e6303){if(_0x497630){var _0x563d7b=util['format'](_0x8bb4('0x5d'),path[_0x8bb4('0x37')](_0x404670[_0x8bb4('0x3')])[_0x8bb4('0x21')],_0x404670[_0x8bb4('0x3')]);gs[_0x8bb4('0x5e')](_0x563d7b)[_0x8bb4('0x3a')](function(){_0x404670['path']=util['format'](_0x8bb4('0x5f'),path[_0x8bb4('0x37')](_0x404670[_0x8bb4('0x3')])['dir'],path[_0x8bb4('0x37')](_0x404670[_0x8bb4('0x3')])['name']);_0x5161ec['XMF-PATH']=_0x404670[_0x8bb4('0x3')];ut[_0x8bb4('0x48')](_0x8bb4('0x60'),'');ami[_0x8bb4('0x61')](ut[_0x8bb4('0x62')](_0x404670,_0x5161ec))[_0x8bb4('0x3a')](function(_0x151ddd){_0x40c88e(_0x151ddd);})[_0x8bb4('0x3c')](function(_0x11cdfd){_0x3e6303(_0x11cdfd);});})['catch'](function(_0x2e886f){_0x3e6303(_0x2e886f);});}else{ami[_0x8bb4('0x61')](ut[_0x8bb4('0x62')](_0x404670,_0x5161ec))[_0x8bb4('0x3a')](function(_0x5189a9){_0x40c88e(_0x5189a9);})[_0x8bb4('0x3c')](function(_0x3d4d5e){_0x3e6303(_0x3d4d5e);});}});}Fax[_0x8bb4('0x24')][_0x8bb4('0x55')]=function(_0x25878d,_0x4833ff){var _0x3bf833=this;return new BPromise(function(_0x57f3f6,_0x11b510){var _0x374de5=uuid['v4']();var _0x42353c=ut[_0x8bb4('0x63')](_0x25878d,_0x4833ff);_0x3bf833['actions'][_0x374de5]=new Action(_0x374de5,_0x4833ff,_0x25878d);var _0xfed03=_0x3bf833['actions'][_0x374de5];if(path[_0x8bb4('0x37')](_0x25878d['path'])['ext']===_0x8bb4('0x38')){originate(_0xfed03,_0x42353c,!![])[_0x8bb4('0x3a')](function(_0x3bc257){_0x57f3f6(_0x3bc257);})[_0x8bb4('0x3c')](function(_0x5024b6){_0x11b510(_0x5024b6);});}else{originate(_0xfed03,_0x42353c,![])[_0x8bb4('0x3a')](function(_0x131db8){_0x57f3f6(_0x131db8);})['catch'](function(_0x3f49c8){_0x11b510(_0x3f49c8);});}});};Fax[_0x8bb4('0x24')][_0x8bb4('0x64')]=function(_0x1c0131){return!_['isNil'](_0x1c0131)&&!_[_0x8bb4('0x65')](_0x1c0131[_0x8bb4('0x21')])&&!_['isNil'](_0x1c0131[_0x8bb4('0x66')])&&_0x1c0131['active']&&!_[_0x8bb4('0x65')](this[_0x8bb4('0xf')][util['format']('SIP/%s',_0x1c0131[_0x8bb4('0x21')])])&&!_[_0x8bb4('0x65')](this[_0x8bb4('0xf')][util[_0x8bb4('0x67')]('SIP/%s',_0x1c0131[_0x8bb4('0x21')])]['status'])&&(this[_0x8bb4('0xf')][util[_0x8bb4('0x67')](_0x8bb4('0x68'),_0x1c0131['name'])][_0x8bb4('0x2c')]==='reachable'||this[_0x8bb4('0xf')][util['format'](_0x8bb4('0x68'),_0x1c0131[_0x8bb4('0x21')])][_0x8bb4('0x2c')]===_0x8bb4('0x69'));};Fax[_0x8bb4('0x24')][_0x8bb4('0x5a')]=function(_0x187cff,_0x1356cb){if(!this[_0x8bb4('0x64')](_0x187cff)){ut['logger'](_0x8bb4('0x6a'),_[_0x8bb4('0x65')](_0x187cff)?'':_0x187cff[_0x8bb4('0x21')]+_0x8bb4('0x6b'));return{'isValid':![],'message':_0x8bb4('0x6c')};}if(_['isNil'](_0x1356cb[_0x8bb4('0x6')])){ut[_0x8bb4('0x48')](_0x8bb4('0x6d'),JSON[_0x8bb4('0x3f')](_0x1356cb));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x8bb4('0x65')](_0x1356cb['path'])){ut[_0x8bb4('0x48')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x8bb4('0x3f')](_0x1356cb));return{'isValid':![],'message':_0x8bb4('0x6e')};}return{'isValid':!![],'message':_0x8bb4('0x6f')};};module['exports']=Fax; \ No newline at end of file +var _0xf6c7=['format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','checkTrunk','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','exports','util','lodash','uuid','moment','path','tiff2pdf','../../../config/logger','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','trunks','actions','newchannel','bind','varset','syncVarSet','newstate','syncNewExten','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','from-voip-provider','faxAccounts','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','hasOwnProperty','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','notify','calleridnum','fax','catch','\x20notify\x20','stringify','\x20receiveFax\x20','response','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','isValid','Trunk\x20Reachable'];(function(_0x3bac2b,_0x137306){var _0xbadf45=function(_0xddb85a){while(--_0xddb85a){_0x3bac2b['push'](_0x3bac2b['shift']());}};_0xbadf45(++_0x137306);}(_0xf6c7,0x17b));var _0x7f6c=function(_0x41f5e0,_0x3fa3ed){_0x41f5e0=_0x41f5e0-0x0;var _0x23876c=_0xf6c7[_0x41f5e0];return _0x23876c;};'use strict';var util=require(_0x7f6c('0x0'));var _=require(_0x7f6c('0x1'));var BPromise=require('bluebird');var uuid=require(_0x7f6c('0x2'));var moment=require(_0x7f6c('0x3'));var path=require(_0x7f6c('0x4'));var tiff2pdf=require(_0x7f6c('0x5'));var gs=require('./util/gs');var logger=require(_0x7f6c('0x6'))('fax');var ami=require(_0x7f6c('0x7'));var rpcDb=require(_0x7f6c('0x8'));var Channel=require(_0x7f6c('0x9'));var ut=require(_0x7f6c('0xa'));var Action=require(_0x7f6c('0xb'));var faxAccount=require(_0x7f6c('0xc'));var attachment=require(_0x7f6c('0xd'));var faxMessage=require(_0x7f6c('0xe'));function Fax(_0x76e979){this[_0x7f6c('0xf')]={};this['faxAccounts']=_0x76e979['faxAccounts'];this['trunks']=_0x76e979[_0x7f6c('0x10')];this[_0x7f6c('0x11')]={};ami['on'](_0x7f6c('0x12'),this['syncNewchannel'][_0x7f6c('0x13')](this));ami['on'](_0x7f6c('0x14'),this[_0x7f6c('0x15')][_0x7f6c('0x13')](this));ami['on'](_0x7f6c('0x16'),this['syncNewState'][_0x7f6c('0x13')](this));ami['on']('newexten',this[_0x7f6c('0x17')][_0x7f6c('0x13')](this));ami['on']('faxstatus',this[_0x7f6c('0x18')][_0x7f6c('0x13')](this));ami['on']('receivefax',this[_0x7f6c('0x19')][_0x7f6c('0x13')](this));ami['on'](_0x7f6c('0x1a'),this[_0x7f6c('0x1b')]['bind'](this));ami['on'](_0x7f6c('0x1c'),this[_0x7f6c('0x1d')]['bind'](this));}Fax[_0x7f6c('0x1e')]['syncNewchannel']=function(_0x3a59b4){if(_0x3a59b4['context']===_0x7f6c('0x1f')){for(var _0x497336 in this[_0x7f6c('0x20')]){if(this[_0x7f6c('0x20')]['hasOwnProperty'](_0x497336)){if(_0x3a59b4['exten']===this[_0x7f6c('0x20')][_0x497336][_0x7f6c('0x21')]){this[_0x7f6c('0xf')][_0x3a59b4[_0x7f6c('0x22')]]={};this['channels'][_0x3a59b4[_0x7f6c('0x22')]][_0x7f6c('0x23')]=_0x3a59b4[_0x7f6c('0x23')];this[_0x7f6c('0xf')][_0x3a59b4[_0x7f6c('0x22')]]['id']=this[_0x7f6c('0x20')][_0x497336]['id'];this['channels'][_0x3a59b4[_0x7f6c('0x22')]][_0x7f6c('0x24')]=this['faxAccounts'][_0x497336]['name'];logger[_0x7f6c('0x25')](_0x3a59b4['uniqueid'],_0x7f6c('0x26'));}}}}if(this['actions'][_0x3a59b4[_0x7f6c('0x22')]]){this[_0x7f6c('0xf')][_0x3a59b4[_0x7f6c('0x22')]]={};this[_0x7f6c('0xf')][_0x3a59b4[_0x7f6c('0x22')]][_0x7f6c('0x23')]=_0x3a59b4[_0x7f6c('0x23')];logger[_0x7f6c('0x25')](_0x3a59b4[_0x7f6c('0x22')],'\x20syncNewchannel\x20');}};Fax[_0x7f6c('0x1e')]['syncVarSet']=function(_0x273619){if(this['channels'][_0x273619[_0x7f6c('0x22')]]){for(var _0x25a40c in _0x273619[_0x7f6c('0x27')]){if(_0x273619[_0x7f6c('0x27')]['hasOwnProperty'](_0x25a40c)){this[_0x7f6c('0xf')][_0x273619[_0x7f6c('0x22')]][_0x25a40c]=_0x273619[_0x7f6c('0x28')];}}}};Fax[_0x7f6c('0x1e')]['syncNewState']=function(_0x23f5e4){if(this[_0x7f6c('0xf')][_0x23f5e4[_0x7f6c('0x22')]]){this[_0x7f6c('0xf')][_0x23f5e4[_0x7f6c('0x22')]][_0x7f6c('0x29')]=_0x23f5e4[_0x7f6c('0x29')];this[_0x7f6c('0xf')][_0x23f5e4[_0x7f6c('0x22')]][_0x7f6c('0x2a')]=_0x23f5e4[_0x7f6c('0x2a')];}};Fax[_0x7f6c('0x1e')][_0x7f6c('0x17')]=function(_0x3b4d9b){if(this[_0x7f6c('0xf')][_0x3b4d9b[_0x7f6c('0x22')]]){for(var _0x24b940 in _0x3b4d9b[_0x7f6c('0x27')]){if(_0x3b4d9b[_0x7f6c('0x27')][_0x7f6c('0x2b')](_0x24b940)){this[_0x7f6c('0xf')][_0x3b4d9b[_0x7f6c('0x22')]][_0x24b940]=_0x3b4d9b[_0x7f6c('0x28')];}}}};Fax[_0x7f6c('0x1e')][_0x7f6c('0x18')]=function(_0x51d165){if(this[_0x7f6c('0xf')][_0x51d165['uniqueid']]){this[_0x7f6c('0xf')][_0x51d165[_0x7f6c('0x22')]]['operation']=_0x51d165[_0x7f6c('0x2c')];this['channels'][_0x51d165['uniqueid']]['status']=_0x51d165[_0x7f6c('0x2d')];this[_0x7f6c('0xf')][_0x51d165[_0x7f6c('0x22')]][_0x7f6c('0x21')]=_0x51d165['localstationid'];this[_0x7f6c('0xf')][_0x51d165['uniqueid']][_0x7f6c('0x2e')]=_0x51d165['filename'];logger[_0x7f6c('0x25')](_0x51d165[_0x7f6c('0x22')],_0x7f6c('0x2f'));}};Fax[_0x7f6c('0x1e')][_0x7f6c('0x19')]=function(_0x581997){var _0x1ffdc8=this;if(this['channels'][_0x581997[_0x7f6c('0x22')]]){var _0x24e62f=this[_0x7f6c('0xf')][_0x581997[_0x7f6c('0x22')]]['id'];this[_0x7f6c('0xf')][_0x581997[_0x7f6c('0x22')]][_0x7f6c('0x30')]=_0x581997['remotestationid'];this['channels'][_0x581997[_0x7f6c('0x22')]][_0x7f6c('0x31')]=_0x581997[_0x7f6c('0x31')];this[_0x7f6c('0xf')][_0x581997[_0x7f6c('0x22')]]['localstationid']=_0x581997[_0x7f6c('0x21')];this['channels'][_0x581997[_0x7f6c('0x22')]][_0x7f6c('0x32')]=_0x581997[_0x7f6c('0x32')];this[_0x7f6c('0xf')][_0x581997['uniqueid']][_0x7f6c('0x33')]=_0x581997['transferrate'];this[_0x7f6c('0xf')][_0x581997[_0x7f6c('0x22')]][_0x7f6c('0x2e')]=_0x581997[_0x7f6c('0x2e')];this[_0x7f6c('0xf')][_0x581997[_0x7f6c('0x22')]]['calleridnum']=_0x581997['calleridnum'];if(this[_0x7f6c('0xf')][_0x581997[_0x7f6c('0x22')]][_0x7f6c('0x31')]>0x0){tiff2pdf(_0x581997[_0x7f6c('0x2e')],'/var/opt/motion2/server/files/attachments/',function(_0x414743){logger[_0x7f6c('0x25')](_0x581997['uniqueid'],_0x7f6c('0x34'),_0x414743[_0x7f6c('0x35')]);attachment[_0x7f6c('0x36')]({'name':path[_0x7f6c('0x37')](_0x581997['filename'])[_0x7f6c('0x24')],'basename':path['parse'](_0x581997[_0x7f6c('0x2e')])['name']+_0x7f6c('0x38'),'type':'application/pdf'})[_0x7f6c('0x39')](function(_0x532a22){faxAccount[_0x7f6c('0x3a')](_0x24e62f,{'from':_0x581997[_0x7f6c('0x3b')],'mapKey':_0x7f6c('0x3c'),'body':path[_0x7f6c('0x37')](_0x581997[_0x7f6c('0x2e')])[_0x7f6c('0x24')]+'.pdf','AttachmentId':_0x532a22['id']})[_0x7f6c('0x3d')](function(_0x377525){logger['error'](_0x581997[_0x7f6c('0x22')],_0x7f6c('0x3e'),JSON[_0x7f6c('0x3f')](_0x377525));});})[_0x7f6c('0x3d')](function(_0x54a621){logger['error'](_0x581997[_0x7f6c('0x22')],_0x7f6c('0x40'),JSON[_0x7f6c('0x3f')](_0x54a621));});});}logger[_0x7f6c('0x25')](_0x581997['uniqueid'],_0x7f6c('0x40'));}};Fax['prototype'][_0x7f6c('0x1d')]=function(_0x3aa300){if(this[_0x7f6c('0x11')][_0x3aa300[_0x7f6c('0x22')]]){_['merge'](this['channels'][_0x3aa300['uniqueid']],_['pick'](_0x3aa300,[_0x7f6c('0x41'),'reason']));}};function updateStatus(_0x591aa9){if(_0x591aa9[_0x7f6c('0x42')]){faxMessage[_0x7f6c('0x43')](_0x591aa9['AttachmentId'],{'failMessage':_0x7f6c('0x44')})[_0x7f6c('0x39')](function(_0x26af88){ut[_0x7f6c('0x45')](_0x7f6c('0x46'),_0x26af88);})[_0x7f6c('0x3d')](function(_0x567e43){ut['logger'](_0x7f6c('0x47'),_0x567e43);});}else{ut[_0x7f6c('0x45')](_0x7f6c('0x48'));}}Fax[_0x7f6c('0x1e')]['updateStatus']=function(_0x5c9a4e,_0x178a18,_0x2c37fb){var _0x288d1c=this;var _0x3d0d9f={};if(_0x178a18){_0x3d0d9f={'read':_0x178a18};}else{_0x3d0d9f={'failMessage':_0x2c37fb};}if(this[_0x7f6c('0x11')][_0x5c9a4e]['AttachmentId']){faxMessage[_0x7f6c('0x43')](this[_0x7f6c('0x11')][_0x5c9a4e][_0x7f6c('0x42')],_0x3d0d9f)[_0x7f6c('0x39')](function(_0x3acd75){ut['logger'](_0x7f6c('0x49'),_0x3acd75);})[_0x7f6c('0x3d')](function(_0x33fc6b){ut[_0x7f6c('0x45')](_0x7f6c('0x4a'),_0x33fc6b);})[_0x7f6c('0x4b')](function(){delete _0x288d1c[_0x7f6c('0xf')][_0x5c9a4e];delete _0x288d1c[_0x7f6c('0x11')][_0x5c9a4e];});}else{ut['logger'](_0x7f6c('0x4c'));delete this[_0x7f6c('0xf')][_0x5c9a4e];delete this['actions'][_0x5c9a4e];}};Fax[_0x7f6c('0x1e')]['syncHangup']=function(_0x11b9cf){var _0x593560=this;if(this[_0x7f6c('0xf')][_0x11b9cf[_0x7f6c('0x22')]]){if(this['actions'][_0x11b9cf[_0x7f6c('0x22')]]){this['channels'][_0x11b9cf['uniqueid']]['id']=this[_0x7f6c('0x11')][_0x11b9cf[_0x7f6c('0x22')]]['id'];this[_0x7f6c('0xf')][_0x11b9cf['uniqueid']]['name']=this[_0x7f6c('0x11')][_0x11b9cf[_0x7f6c('0x22')]]['name'];}logger[_0x7f6c('0x25')](_0x11b9cf['uniqueid'],this['actions'][_0x11b9cf[_0x7f6c('0x22')]]?'\x20hangup\x20sendFile\x20':_0x7f6c('0x4d'),JSON[_0x7f6c('0x3f')](this[_0x7f6c('0xf')][_0x11b9cf[_0x7f6c('0x22')]]));if(this[_0x7f6c('0x11')][_0x11b9cf[_0x7f6c('0x22')]]){if(this[_0x7f6c('0xf')][_0x11b9cf[_0x7f6c('0x22')]][_0x7f6c('0x4e')]>0x0&&this['channels'][_0x11b9cf[_0x7f6c('0x22')]][_0x7f6c('0x4f')]==='SUCCESS'){this[_0x7f6c('0x50')](_0x11b9cf[_0x7f6c('0x22')],!![]);}else{this[_0x7f6c('0x50')](_0x11b9cf['uniqueid'],![],this[_0x7f6c('0xf')][_0x11b9cf[_0x7f6c('0x22')]][_0x7f6c('0x51')]?_0x7f6c('0x52')+this['channels'][_0x11b9cf['uniqueid']][_0x7f6c('0x51')]:'SENDING\x20FAILED');}}}};Fax['prototype'][_0x7f6c('0x53')]=function(_0x2ddb7d){var _0x3548e2=this;return new BPromise(function(_0xd89733,_0x166e95){_0x3548e2['execOriginate'](_0x2ddb7d,_0x3548e2[_0x7f6c('0x20')][_0x2ddb7d[_0x7f6c('0x54')]])[_0x7f6c('0x39')](function(_0xe6aa30){ut[_0x7f6c('0x45')](_0x7f6c('0x55'),_0xe6aa30);_0xd89733(ut[_0x7f6c('0x35')](_0x7f6c('0x56')));})[_0x7f6c('0x3d')](function(_0x422a52){ut[_0x7f6c('0x45')](_0x7f6c('0x57'),_0x422a52);updateStatus(_0x2ddb7d);_0x166e95(ut[_0x7f6c('0x35')](_0x7f6c('0x58')));});});};Fax['prototype'][_0x7f6c('0x59')]=function(_0x36bc0b){var _0x83e31f=this;return new BPromise(function(_0x5a4bfa,_0x1d809b){var _0x55b789=_0x83e31f['checkTrunk'](_0x83e31f[_0x7f6c('0x20')][_0x36bc0b['FaxAccountId']][_0x7f6c('0x5a')],_0x36bc0b);if(_0x55b789[_0x7f6c('0x5b')]){_0x5a4bfa(ut[_0x7f6c('0x35')](_0x7f6c('0x5c')));}else{_0x1d809b(ut[_0x7f6c('0x35')](_0x55b789[_0x7f6c('0x35')]));}});};function originate(_0x42bf5c,_0x1ff308,_0x238a8c){return new BPromise(function(_0x2dc958,_0x445121){if(_0x238a8c){var _0x5eb604=util[_0x7f6c('0x5d')](_0x7f6c('0x5e'),path[_0x7f6c('0x37')](_0x42bf5c[_0x7f6c('0x4')])[_0x7f6c('0x24')],_0x42bf5c[_0x7f6c('0x4')]);gs[_0x7f6c('0x5f')](_0x5eb604)[_0x7f6c('0x39')](function(){_0x42bf5c[_0x7f6c('0x4')]=util['format'](_0x7f6c('0x60'),path['parse'](_0x42bf5c[_0x7f6c('0x4')])[_0x7f6c('0x61')],path[_0x7f6c('0x37')](_0x42bf5c[_0x7f6c('0x4')])[_0x7f6c('0x24')]);_0x1ff308[_0x7f6c('0x62')]=_0x42bf5c['path'];ut[_0x7f6c('0x45')](_0x7f6c('0x63'),'');ami['Action'](ut['variablesAction'](_0x42bf5c,_0x1ff308))[_0x7f6c('0x39')](function(_0x2636fc){_0x2dc958(_0x2636fc);})[_0x7f6c('0x3d')](function(_0x240714){_0x445121(_0x240714);});})[_0x7f6c('0x3d')](function(_0xb6577d){_0x445121(_0xb6577d);});}else{ami[_0x7f6c('0x64')](ut[_0x7f6c('0x65')](_0x42bf5c,_0x1ff308))['then'](function(_0x52a99a){_0x2dc958(_0x52a99a);})['catch'](function(_0x5922b2){_0x445121(_0x5922b2);});}});}Fax[_0x7f6c('0x1e')][_0x7f6c('0x66')]=function(_0x466414,_0x14509c){var _0x1cef97=this;return new BPromise(function(_0x391b60,_0x400417){var _0x1931ae=uuid['v4']();var _0x1c7e68=ut[_0x7f6c('0x67')](_0x466414,_0x14509c);_0x1cef97[_0x7f6c('0x11')][_0x1931ae]=new Action(_0x1931ae,_0x14509c,_0x466414);var _0x4b269c=_0x1cef97[_0x7f6c('0x11')][_0x1931ae];if(path[_0x7f6c('0x37')](_0x466414[_0x7f6c('0x4')])[_0x7f6c('0x68')]==='.pdf'){originate(_0x4b269c,_0x1c7e68,!![])[_0x7f6c('0x39')](function(_0x1f8f9c){_0x391b60(_0x1f8f9c);})[_0x7f6c('0x3d')](function(_0x29bb20){_0x400417(_0x29bb20);});}else{originate(_0x4b269c,_0x1c7e68,![])['then'](function(_0x3ee1b1){_0x391b60(_0x3ee1b1);})['catch'](function(_0x369d8a){_0x400417(_0x369d8a);});}});};Fax[_0x7f6c('0x1e')][_0x7f6c('0x69')]=function(_0x24ff67){return!_['isNil'](_0x24ff67)&&!_[_0x7f6c('0x6a')](_0x24ff67[_0x7f6c('0x24')])&&!_[_0x7f6c('0x6a')](_0x24ff67[_0x7f6c('0x6b')])&&_0x24ff67['active']&&!_[_0x7f6c('0x6a')](this['trunks'][util[_0x7f6c('0x5d')](_0x7f6c('0x6c'),_0x24ff67[_0x7f6c('0x24')])])&&!_[_0x7f6c('0x6a')](this[_0x7f6c('0x10')][util[_0x7f6c('0x5d')](_0x7f6c('0x6c'),_0x24ff67['name'])][_0x7f6c('0x2d')])&&(this[_0x7f6c('0x10')][util[_0x7f6c('0x5d')]('SIP/%s',_0x24ff67[_0x7f6c('0x24')])][_0x7f6c('0x2d')]===_0x7f6c('0x6d')||this['trunks'][util[_0x7f6c('0x5d')](_0x7f6c('0x6c'),_0x24ff67['name'])][_0x7f6c('0x2d')]===_0x7f6c('0x6e'));};Fax[_0x7f6c('0x1e')][_0x7f6c('0x6f')]=function(_0x58d1e0,_0xabae4b){if(!this[_0x7f6c('0x69')](_0x58d1e0)){ut[_0x7f6c('0x45')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x7f6c('0x6a')](_0x58d1e0)?'':_0x58d1e0[_0x7f6c('0x24')]+_0x7f6c('0x70'));return{'isValid':![],'message':_0x7f6c('0x71')};}if(_[_0x7f6c('0x6a')](_0xabae4b[_0x7f6c('0x3c')])){ut[_0x7f6c('0x45')](_0x7f6c('0x72'),JSON[_0x7f6c('0x3f')](_0xabae4b));return{'isValid':![],'message':_0x7f6c('0x73')};}if(_['isNil'](_0xabae4b[_0x7f6c('0x4')])){ut[_0x7f6c('0x45')](_0x7f6c('0x74'),JSON['stringify'](_0xabae4b));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x7f6c('0x75')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 0a962ec..0d41bdf 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 _0x25ff=['[Notify]\x20','util','bluebird','../../../config/logger','preview','error','inspect','notify','then','catch'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x25ff,0x19b));var _0xf25f=function(_0x4ec96f,_0x56b6c1){_0x4ec96f=_0x4ec96f-0x0;var _0x1790ab=_0x25ff[_0x4ec96f];return _0x1790ab;};'use strict';var util=require(_0xf25f('0x0'));var BPromise=require(_0xf25f('0x1'));var logger=require(_0xf25f('0x2'))(_0xf25f('0x3'));var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x477a57){return function(_0x1d7422){logger[_0xf25f('0x4')](_0x477a57,util[_0xf25f('0x5')](_0x1d7422,{'showHidden':![],'depth':null}));};}exports[_0xf25f('0x6')]=function(_0x288778,_0x4a58ff){return BPromise['resolve']()[_0xf25f('0x7')](faxAccount[_0xf25f('0x6')](_0x288778,_0x4a58ff))[_0xf25f('0x8')](loggerCatch(_0xf25f('0x9')));}; \ No newline at end of file +var _0x67f6=['then','[Notify]\x20','util','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve'];(function(_0x4997a8,_0x23fe1c){var _0x497ab7=function(_0x319171){while(--_0x319171){_0x4997a8['push'](_0x4997a8['shift']());}};_0x497ab7(++_0x23fe1c);}(_0x67f6,0x1a4));var _0x667f=function(_0x5bf5f8,_0x3a7f77){_0x5bf5f8=_0x5bf5f8-0x0;var _0x3f786b=_0x67f6[_0x5bf5f8];return _0x3f786b;};'use strict';var util=require(_0x667f('0x0'));var BPromise=require('bluebird');var logger=require(_0x667f('0x1'))(_0x667f('0x2'));var _=require(_0x667f('0x3'));var faxAccount=require(_0x667f('0x4'));function loggerCatch(_0x2f6042){return function(_0x478797){logger[_0x667f('0x5')](_0x2f6042,util[_0x667f('0x6')](_0x478797,{'showHidden':![],'depth':null}));};}exports[_0x667f('0x7')]=function(_0x36e9ae,_0x13d660){return BPromise[_0x667f('0x8')]()[_0x667f('0x9')](faxAccount[_0x667f('0x7')](_0x36e9ae,_0x13d660))['catch'](loggerCatch(_0x667f('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 9e52248..47af8e1 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 _0xf015=['child_process','exec','Exec\x20gs','info','\x20Error\x20:','inspect','util','fax'];(function(_0x491a7f,_0x28bb80){var _0x3d8f44=function(_0xdaa716){while(--_0xdaa716){_0x491a7f['push'](_0x491a7f['shift']());}};_0x3d8f44(++_0x28bb80);}(_0xf015,0xde));var _0x5f01=function(_0x2178ce,_0x1432f4){_0x2178ce=_0x2178ce-0x0;var _0x21b3f4=_0xf015[_0x2178ce];return _0x21b3f4;};'use strict';var util=require(_0x5f01('0x0'));var logger=require('../../../../config/logger')(_0x5f01('0x1'));var BPromise=require('bluebird');var exec=require(_0x5f01('0x2'))[_0x5f01('0x3')];exports['execute']=function(_0x4c2556){return new BPromise(function(_0x3c1fa6,_0x4fb9e0){exec(_0x4c2556,function(_0x2176c9,_0x460efc,_0xb0ecd6){logger['info'](_0x5f01('0x4'),_0x460efc);if(_0x2176c9){logger[_0x5f01('0x5')]('Exec\x20gs',_0x5f01('0x6'),util[_0x5f01('0x7')](_0x2176c9,{'showHidden':![],'depth':null}),_0x460efc,_0xb0ecd6);_0x4fb9e0(_0x2176c9);}_0x3c1fa6(_0x460efc);});});}; \ No newline at end of file +var _0x361e=['fax','bluebird','child_process','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x5d7f0f,_0x3140c6){var _0x5dd403=function(_0x4f7177){while(--_0x4f7177){_0x5d7f0f['push'](_0x5d7f0f['shift']());}};_0x5dd403(++_0x3140c6);}(_0x361e,0x134));var _0xe361=function(_0x5e3a67,_0x132b2c){_0x5e3a67=_0x5e3a67-0x0;var _0xa9604d=_0x361e[_0x5e3a67];return _0xa9604d;};'use strict';var util=require(_0xe361('0x0'));var logger=require(_0xe361('0x1'))(_0xe361('0x2'));var BPromise=require(_0xe361('0x3'));var exec=require(_0xe361('0x4'))['exec'];exports[_0xe361('0x5')]=function(_0x444823){return new BPromise(function(_0x2d6d9e,_0x222b9b){exec(_0x444823,function(_0x4dcb0b,_0xfd7d59,_0x4f0d4a){logger[_0xe361('0x6')](_0xe361('0x7'),_0xfd7d59);if(_0x4dcb0b){logger[_0xe361('0x6')](_0xe361('0x7'),_0xe361('0x8'),util[_0xe361('0x9')](_0x4dcb0b,{'showHidden':![],'depth':null}),_0xfd7d59,_0x4f0d4a);_0x222b9b(_0x4dcb0b);}_0x2d6d9e(_0xfd7d59);});});}; \ 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 4cf3c58..f12e41c 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 _0xbb53=['modem','faxdetect','path','variablesAction','originate','from-sip','\x22%s\x22\x20<%s>','headerinfo','localstationid','util','lodash','moment','../../../../config/logger','fax','message','logger','addVariables','ecm','format','\x22%s\x22'];(function(_0x10f85c,_0x380466){var _0x5c7bf9=function(_0x4ee701){while(--_0x4ee701){_0x10f85c['push'](_0x10f85c['shift']());}};_0x5c7bf9(++_0x380466);}(_0xbb53,0x121));var _0x3bb5=function(_0x298a45,_0xcd5946){_0x298a45=_0x298a45-0x0;var _0x3182f0=_0xbb53[_0x298a45];return _0x3182f0;};'use strict';var util=require(_0x3bb5('0x0'));var _=require(_0x3bb5('0x1'));var moment=require(_0x3bb5('0x2'));var logger=require(_0x3bb5('0x3'))(_0x3bb5('0x4'));exports[_0x3bb5('0x5')]=function(_0x414da7){return{'message':_0x414da7};};exports[_0x3bb5('0x6')]=function(_0x83e44b,_0x450d9e){logger['info'](_0x83e44b,util['inspect'](_0x450d9e,{'showHidden':![],'depth':null}));};exports[_0x3bb5('0x7')]=function(_0x2460b0,_0x28aa7d){var _0x157e04={'XMF-ECM':_0x28aa7d[_0x3bb5('0x8')],'XMF-HEADERINFO':_0x28aa7d['headerinfo'],'XMF-MINRATE':_0x28aa7d['minrate'],'XMF-MAXRATE':_0x28aa7d['maxrate'],'XMF-MODEM':util[_0x3bb5('0x9')](_0x3bb5('0xa'),_0x28aa7d[_0x3bb5('0xb')]),'XMF-GATEWAY':_0x28aa7d['gateway'],'XMF-FAXDETECT':_0x28aa7d[_0x3bb5('0xc')],'XMF-T38TIMEOUT':_0x28aa7d['t38timeout'],'XMF-LOCALSTATIONID':_0x28aa7d['localstationid'],'XMF-PATH':_0x2460b0[_0x3bb5('0xd')]};return _0x157e04;};exports[_0x3bb5('0xe')]=function(_0x5cfc6b,_0xe00ace){return{'actionid':_0x5cfc6b['uniqueid'],'action':_0x3bb5('0xf'),'channel':_0x5cfc6b['channel'],'Exten':'xcally-motion-fax','Context':_0x3bb5('0x10'),'Priority':'1','callerid':util[_0x3bb5('0x9')](_0x3bb5('0x11'),_0x5cfc6b['headerinfo']?_0x5cfc6b[_0x3bb5('0x12')]:'',_0x5cfc6b[_0x3bb5('0x13')]),'variable':_0xe00ace,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5cfc6b['uniqueid']};}; \ No newline at end of file +var _0xf290=['xcally-motion-fax','from-sip','lodash','../../../../config/logger','message','logger','inspect','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','uniqueid','originate','channel'];(function(_0x2896f9,_0x1728d3){var _0x241814=function(_0x492fec){while(--_0x492fec){_0x2896f9['push'](_0x2896f9['shift']());}};_0x241814(++_0x1728d3);}(_0xf290,0xde));var _0x0f29=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xf290[_0x3ff085];return _0x2b68c3;};'use strict';var util=require('util');var _=require(_0x0f29('0x0'));var moment=require('moment');var logger=require(_0x0f29('0x1'))('fax');exports[_0x0f29('0x2')]=function(_0x1b4f85){return{'message':_0x1b4f85};};exports[_0x0f29('0x3')]=function(_0x28b644,_0xfdab92){logger['info'](_0x28b644,util[_0x0f29('0x4')](_0xfdab92,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x2d5350,_0x1c45ec){var _0x355e21={'XMF-ECM':_0x1c45ec[_0x0f29('0x5')],'XMF-HEADERINFO':_0x1c45ec[_0x0f29('0x6')],'XMF-MINRATE':_0x1c45ec[_0x0f29('0x7')],'XMF-MAXRATE':_0x1c45ec[_0x0f29('0x8')],'XMF-MODEM':util[_0x0f29('0x9')](_0x0f29('0xa'),_0x1c45ec[_0x0f29('0xb')]),'XMF-GATEWAY':_0x1c45ec[_0x0f29('0xc')],'XMF-FAXDETECT':_0x1c45ec[_0x0f29('0xd')],'XMF-T38TIMEOUT':_0x1c45ec[_0x0f29('0xe')],'XMF-LOCALSTATIONID':_0x1c45ec[_0x0f29('0xf')],'XMF-PATH':_0x2d5350[_0x0f29('0x10')]};return _0x355e21;};exports['variablesAction']=function(_0x38eb8f,_0x5f4796){return{'actionid':_0x38eb8f[_0x0f29('0x11')],'action':_0x0f29('0x12'),'channel':_0x38eb8f[_0x0f29('0x13')],'Exten':_0x0f29('0x14'),'Context':_0x0f29('0x15'),'Priority':'1','callerid':util[_0x0f29('0x9')]('\x22%s\x22\x20<%s>',_0x38eb8f[_0x0f29('0x6')]?_0x38eb8f[_0x0f29('0x6')]:'',_0x38eb8f[_0x0f29('0xf')]),'variable':_0x5f4796,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x38eb8f[_0x0f29('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 8c9eb5d..63ce0a3 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 _0xa362=['initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','initSettings','catch','log','sync','bluebird','util','moment','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates'];(function(_0xac7190,_0x3afa96){var _0x20e3b8=function(_0x2b5802){while(--_0x2b5802){_0xac7190['push'](_0xac7190['shift']());}};_0x20e3b8(++_0x3afa96);}(_0xa362,0x195));var _0x2a36=function(_0x19120a,_0x2495bf){_0x19120a=_0x19120a-0x0;var _0x18a3da=_0xa362[_0x19120a];return _0x18a3da;};'use strict';var BPromise=require(_0x2a36('0x0'));var util=require(_0x2a36('0x1'));var moment=require(_0x2a36('0x2'));var server=require('./server');var Realtime=require('./realtime');var Report=require(_0x2a36('0x3'));var Acw=require(_0x2a36('0x4'));var Trigger=require(_0x2a36('0x5'));var Dialer=require(_0x2a36('0x6'));var Preview=require(_0x2a36('0x7'));var Fax=require('./fax');var user=require(_0x2a36('0x8'));var voiceQueue=require(_0x2a36('0x9'));var voiceQueueReport=require(_0x2a36('0xa'));var voiceCallReport=require(_0x2a36('0xb'));var trunk=require('./rpc/trunk');var trigger=require(_0x2a36('0xc'));var template=require(_0x2a36('0xd'));var cmHopperHistory=require(_0x2a36('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x2a36('0xf'));var setting=require('./rpc/setting');var zendesk=require(_0x2a36('0x10'));var salesforce=require(_0x2a36('0x11'));var sugarcrm=require(_0x2a36('0x12'));var freshdesk=require(_0x2a36('0x13'));var desk=require(_0x2a36('0x14'));var zoho=require(_0x2a36('0x15'));var vtiger=require(_0x2a36('0x16'));var freshsales=require(_0x2a36('0x17'));var servicenow=require(_0x2a36('0x18'));var dynamics365=require(_0x2a36('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x2a36('0x1a')](_0x2a36('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x2a36('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x2a36('0x1c')](user[_0x2a36('0x1d')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x1e')]())[_0x2a36('0x1c')](user[_0x2a36('0x1f')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x20')]())[_0x2a36('0x1c')](trunk['getTrunks']())[_0x2a36('0x1c')](realtime[_0x2a36('0x21')]())[_0x2a36('0x1c')](voiceQueue[_0x2a36('0x22')]())['then'](realtime[_0x2a36('0x23')]())[_0x2a36('0x1c')](trigger[_0x2a36('0x24')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x25')]())[_0x2a36('0x1c')](template[_0x2a36('0x26')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x27')]())['then'](zendesk[_0x2a36('0x28')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x29')]())['then'](salesforce[_0x2a36('0x2a')]())['then'](realtime[_0x2a36('0x2b')]())[_0x2a36('0x1c')](sugarcrm[_0x2a36('0x2c')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x2d')]())[_0x2a36('0x1c')](freshdesk['getFreshdeskAccounts']())[_0x2a36('0x1c')](realtime[_0x2a36('0x2e')]())[_0x2a36('0x1c')](desk[_0x2a36('0x2f')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x30')]())[_0x2a36('0x1c')](zoho[_0x2a36('0x31')]())['then'](realtime['initZohoAccounts']())[_0x2a36('0x1c')](vtiger[_0x2a36('0x32')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x33')]())[_0x2a36('0x1c')](freshsales[_0x2a36('0x34')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x35')]())[_0x2a36('0x1c')](servicenow[_0x2a36('0x36')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x37')]())[_0x2a36('0x1c')](dynamics365[_0x2a36('0x38')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x39')]())[_0x2a36('0x1c')](campaign[_0x2a36('0x3a')]())[_0x2a36('0x1c')](realtime['initCampaigns']())[_0x2a36('0x1c')](voiceExtension[_0x2a36('0x3b')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x3c')]())['then'](faxAccount[_0x2a36('0x3d')]())[_0x2a36('0x1c')](realtime['initFaxAccounts']())[_0x2a36('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0x2a36('0x3e')]()[_0x2a36('0x1c')](voiceQueueReport[_0x2a36('0x3f')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x40')]())['then'](cmHopperHistory[_0x2a36('0x41')]())['then'](realtime[_0x2a36('0x42')]())[_0x2a36('0x1c')](cmHopperHistory[_0x2a36('0x43')]())['then'](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0x2a36('0x44')]())[_0x2a36('0x1c')](realtime[_0x2a36('0x45')]())['then'](setting['getSettings']())[_0x2a36('0x1c')](realtime[_0x2a36('0x46')]())[_0x2a36('0x1c')](function(_0xc46fd1){})[_0x2a36('0x47')](function(_0xe9127b){console[_0x2a36('0x48')](_0xe9127b);});}function main(){return server['listen'](realtime,preview,fax)[_0x2a36('0x1c')](function(_0x2584bf){return initRealtime();})['then'](function(){return initParams();})[_0x2a36('0x1c')](function(){report[_0x2a36('0x49')]();setInterval(initRealtime,0x1388);})[_0x2a36('0x47')](function(_0x595c4b){console['log'](_0x595c4b);});}main(); \ No newline at end of file +var _0x5efa=['getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','getSettings','initSettings','log','listen','sync','catch','bluebird','util','moment','./server','./realtime','./acw','./dialer','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/setting','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','get','hour','resolve','getAgents','then','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory'];(function(_0x3ec122,_0x55150a){var _0x4ecf41=function(_0x1709cd){while(--_0x1709cd){_0x3ec122['push'](_0x3ec122['shift']());}};_0x4ecf41(++_0x55150a);}(_0x5efa,0x11e));var _0xa5ef=function(_0x1fdfcd,_0x23c5af){_0x1fdfcd=_0x1fdfcd-0x0;var _0x4c77c7=_0x5efa[_0x1fdfcd];return _0x4c77c7;};'use strict';var BPromise=require(_0xa5ef('0x0'));var util=require(_0xa5ef('0x1'));var moment=require(_0xa5ef('0x2'));var server=require(_0xa5ef('0x3'));var Realtime=require(_0xa5ef('0x4'));var Report=require('./report');var Acw=require(_0xa5ef('0x5'));var Trigger=require('./trigger');var Dialer=require(_0xa5ef('0x6'));var Preview=require('./preview');var Fax=require('./fax');var user=require(_0xa5ef('0x7'));var voiceQueue=require(_0xa5ef('0x8'));var voiceQueueReport=require(_0xa5ef('0x9'));var voiceCallReport=require(_0xa5ef('0xa'));var trunk=require(_0xa5ef('0xb'));var trigger=require(_0xa5ef('0xc'));var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xa5ef('0xd'));var voiceExtension=require(_0xa5ef('0xe'));var faxAccount=require(_0xa5ef('0xf'));var setting=require(_0xa5ef('0x10'));var zendesk=require(_0xa5ef('0x11'));var salesforce=require(_0xa5ef('0x12'));var sugarcrm=require(_0xa5ef('0x13'));var freshdesk=require(_0xa5ef('0x14'));var desk=require(_0xa5ef('0x15'));var zoho=require(_0xa5ef('0x16'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xa5ef('0x17'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xa5ef('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xa5ef('0x19')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xa5ef('0x19')](_0xa5ef('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xa5ef('0x1b')]()['then'](user[_0xa5ef('0x1c')]())[_0xa5ef('0x1d')](realtime[_0xa5ef('0x1e')]())[_0xa5ef('0x1d')](user[_0xa5ef('0x1f')]())['then'](realtime[_0xa5ef('0x20')]())[_0xa5ef('0x1d')](trunk['getTrunks']())[_0xa5ef('0x1d')](realtime[_0xa5ef('0x21')]())[_0xa5ef('0x1d')](voiceQueue[_0xa5ef('0x22')]())[_0xa5ef('0x1d')](realtime[_0xa5ef('0x23')]())['then'](trigger[_0xa5ef('0x24')]())[_0xa5ef('0x1d')](realtime[_0xa5ef('0x25')]())['then'](template['getTemplates']())[_0xa5ef('0x1d')](realtime[_0xa5ef('0x26')]())[_0xa5ef('0x1d')](zendesk['getZendeskAccounts']())[_0xa5ef('0x1d')](realtime[_0xa5ef('0x27')]())['then'](salesforce[_0xa5ef('0x28')]())['then'](realtime[_0xa5ef('0x29')]())['then'](sugarcrm[_0xa5ef('0x2a')]())[_0xa5ef('0x1d')](realtime[_0xa5ef('0x2b')]())[_0xa5ef('0x1d')](freshdesk[_0xa5ef('0x2c')]())[_0xa5ef('0x1d')](realtime[_0xa5ef('0x2d')]())[_0xa5ef('0x1d')](desk[_0xa5ef('0x2e')]())[_0xa5ef('0x1d')](realtime[_0xa5ef('0x2f')]())[_0xa5ef('0x1d')](zoho[_0xa5ef('0x30')]())[_0xa5ef('0x1d')](realtime['initZohoAccounts']())[_0xa5ef('0x1d')](vtiger[_0xa5ef('0x31')]())['then'](realtime['initVtigerAccounts']())[_0xa5ef('0x1d')](freshsales['getFreshsalesAccounts']())['then'](realtime[_0xa5ef('0x32')]())[_0xa5ef('0x1d')](servicenow['getServicenowAccounts']())[_0xa5ef('0x1d')](realtime[_0xa5ef('0x33')]())['then'](dynamics365[_0xa5ef('0x34')]())['then'](realtime['initDynamics365Accounts']())[_0xa5ef('0x1d')](campaign[_0xa5ef('0x35')]())[_0xa5ef('0x1d')](realtime['initCampaigns']())[_0xa5ef('0x1d')](voiceExtension['getVoiceExtensions']())['then'](realtime[_0xa5ef('0x36')]())[_0xa5ef('0x1d')](faxAccount['getFaxAccounts']())[_0xa5ef('0x1d')](realtime[_0xa5ef('0x37')]())[_0xa5ef('0x1d')](function(){return realtime;});}function initParams(){return BPromise[_0xa5ef('0x1b')]()['then'](voiceQueueReport[_0xa5ef('0x38')]())[_0xa5ef('0x1d')](realtime[_0xa5ef('0x39')]())[_0xa5ef('0x1d')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0xa5ef('0x1d')](realtime[_0xa5ef('0x3a')]())[_0xa5ef('0x1d')](cmHopperHistory[_0xa5ef('0x3b')]())[_0xa5ef('0x1d')](realtime[_0xa5ef('0x3c')]())['then'](voiceCallReport[_0xa5ef('0x3d')]())[_0xa5ef('0x1d')](realtime[_0xa5ef('0x3e')]())['then'](setting[_0xa5ef('0x3f')]())[_0xa5ef('0x1d')](realtime[_0xa5ef('0x40')]())['then'](function(_0x136aaf){})['catch'](function(_0x3cb8fe){console[_0xa5ef('0x41')](_0x3cb8fe);});}function main(){return server[_0xa5ef('0x42')](realtime,preview,fax)[_0xa5ef('0x1d')](function(_0xcd1b5c){return initRealtime();})['then'](function(){return initParams();})[_0xa5ef('0x1d')](function(){report[_0xa5ef('0x43')]();setInterval(initRealtime,0x1388);})[_0xa5ef('0x44')](function(_0x855bd9){console[_0xa5ef('0x41')](_0x855bd9);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 1248675..5b71a02 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 _0x516b=['localhost','name','email','accountcode','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','md5','prototype','updateStatusRealtime','toLowerCase','not_inuse','talking','statePause','toNumber','format','fullname','stringify','emit','user:save','user:presence','exports','lodash','util','ioredis','../../../config/environment','redis'];(function(_0x6dfbaa,_0x31eede){var _0xfbe02=function(_0x4adcaf){while(--_0x4adcaf){_0x6dfbaa['push'](_0x6dfbaa['shift']());}};_0xfbe02(++_0x31eede);}(_0x516b,0x181));var _0xb516=function(_0x83c6f5,_0x3b1182){_0x83c6f5=_0x83c6f5-0x0;var _0x37b68c=_0x516b[_0x83c6f5];return _0x37b68c;};'use strict';var _=require(_0xb516('0x0'));var util=require(_0xb516('0x1'));var moment=require('moment');var md5=require('md5');var Redis=require(_0xb516('0x2'));var config=require(_0xb516('0x3'));config[_0xb516('0x4')]=_['defaults'](config[_0xb516('0x4')],{'host':_0xb516('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb516('0x4')]));function Agent(_0x3c0d45){this['id']=_0x3c0d45['id']||0x0;this[_0xb516('0x6')]=_0x3c0d45[_0xb516('0x6')]||'';this[_0xb516('0x7')]=_0x3c0d45[_0xb516('0x7')]||'';this['accountcode']=_0x3c0d45[_0xb516('0x8')]||'';this['fullname']=_0x3c0d45['fullname']||'';this[_0xb516('0x9')]=_0xb516('0xa');this[_0xb516('0xb')]=0x0;this[_0xb516('0xc')]=_0xb516('0xa');this[_0xb516('0xd')]='';this[_0xb516('0xe')]='';this[_0xb516('0xf')]='';this[_0xb516('0x10')]='';this[_0xb516('0x11')]=_0x3c0d45[_0xb516('0x11')]||![];this[_0xb516('0x12')]=_0xb516('0xa');this[_0xb516('0x13')]=0x0;this[_0xb516('0x14')]='';this[_0xb516('0x15')]='';this[_0xb516('0x16')]=![];this[_0xb516('0x17')]=![];this[_0xb516('0x18')]='';}Agent[_0xb516('0x19')][_0xb516('0x1a')]=function(_0x4f5716){var _0x589f5b;if(_0x4f5716&&_0x4f5716['state']){_0x589f5b=_0x4f5716[_0xb516('0x9')][_0xb516('0x1b')]();switch(_0x589f5b){case _0xb516('0x1c'):_0x589f5b='idle';break;case'inuse':_0x589f5b=_0xb516('0x1d');break;}}if(_0x589f5b&&this[_0xb516('0x12')]!==_0x589f5b||_0x4f5716[_0xb516('0x1e')]){this[_0xb516('0x13')]=_[_0xb516('0x1f')](moment()[_0xb516('0x20')]('x'));}if(_0x589f5b){this[_0xb516('0x12')]=_0x589f5b;}var _0x29d6d1={'id':this['id'],'name':this[_0xb516('0x6')],'email':this[_0xb516('0x7')],'accountcode':this[_0xb516('0x8')],'fullname':this[_0xb516('0x21')],'state':this[_0xb516('0x9')],'stateTime':this[_0xb516('0xb')],'status':this['status'],'address':this[_0xb516('0xd')],'online':this[_0xb516('0x11')],'voiceStatus':this[_0xb516('0x12')],'voiceStatusTime':this[_0xb516('0x13')],'voiceStatusCallerIdNumber':this[_0xb516('0x14')],'voiceStatusQueue':this[_0xb516('0x15')],'interface':this[_0xb516('0x10')],'onhold':this[_0xb516('0x16')]};var _0x4c12f9=md5(JSON[_0xb516('0x22')](_0x29d6d1));if(this[_0xb516('0x18')]!==_0x4c12f9){this[_0xb516('0x18')]=_0x4c12f9;io['to'](util[_0xb516('0x20')]('user:%s',_0x29d6d1[_0xb516('0x6')]))[_0xb516('0x23')](_0xb516('0x24'),_0x29d6d1);io['emit'](_0xb516('0x25'),_0x29d6d1);}};module[_0xb516('0x26')]=Agent; \ No newline at end of file +var _0x0d10=['name','voiceStatusCallerIdNumber','stringify','user:%s','user:save','emit','user:presence','lodash','util','moment','md5','redis','localhost','email','accountcode','fullname','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','state','toLowerCase','idle','inuse','statePause','toNumber','format'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x0d10,0x1a9));var _0x00d1=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x0d10[_0x40a825];return _0x273a54;};'use strict';var _=require(_0x00d1('0x0'));var util=require(_0x00d1('0x1'));var moment=require(_0x00d1('0x2'));var md5=require(_0x00d1('0x3'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x00d1('0x4')]=_['defaults'](config[_0x00d1('0x4')],{'host':_0x00d1('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x19ca99){this['id']=_0x19ca99['id']||0x0;this['name']=_0x19ca99['name']||'';this[_0x00d1('0x6')]=_0x19ca99[_0x00d1('0x6')]||'';this['accountcode']=_0x19ca99[_0x00d1('0x7')]||'';this['fullname']=_0x19ca99[_0x00d1('0x8')]||'';this['state']=_0x00d1('0x9');this[_0x00d1('0xa')]=0x0;this[_0x00d1('0xb')]=_0x00d1('0x9');this[_0x00d1('0xc')]='';this[_0x00d1('0xd')]='';this[_0x00d1('0xe')]='';this[_0x00d1('0xf')]='';this[_0x00d1('0x10')]=_0x19ca99[_0x00d1('0x10')]||![];this[_0x00d1('0x11')]=_0x00d1('0x9');this[_0x00d1('0x12')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x00d1('0x13')]='';this[_0x00d1('0x14')]=![];this[_0x00d1('0x15')]=![];this[_0x00d1('0x3')]='';}Agent[_0x00d1('0x16')][_0x00d1('0x17')]=function(_0xdea813){var _0x194a07;if(_0xdea813&&_0xdea813[_0x00d1('0x18')]){_0x194a07=_0xdea813[_0x00d1('0x18')][_0x00d1('0x19')]();switch(_0x194a07){case'not_inuse':_0x194a07=_0x00d1('0x1a');break;case _0x00d1('0x1b'):_0x194a07='talking';break;}}if(_0x194a07&&this[_0x00d1('0x11')]!==_0x194a07||_0xdea813[_0x00d1('0x1c')]){this['voiceStatusTime']=_[_0x00d1('0x1d')](moment()[_0x00d1('0x1e')]('x'));}if(_0x194a07){this[_0x00d1('0x11')]=_0x194a07;}var _0x1a7260={'id':this['id'],'name':this[_0x00d1('0x1f')],'email':this[_0x00d1('0x6')],'accountcode':this[_0x00d1('0x7')],'fullname':this['fullname'],'state':this[_0x00d1('0x18')],'stateTime':this[_0x00d1('0xa')],'status':this[_0x00d1('0xb')],'address':this[_0x00d1('0xc')],'online':this['online'],'voiceStatus':this[_0x00d1('0x11')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x00d1('0x20')],'voiceStatusQueue':this[_0x00d1('0x13')],'interface':this[_0x00d1('0xf')],'onhold':this[_0x00d1('0x14')]};var _0x197191=md5(JSON[_0x00d1('0x21')](_0x1a7260));if(this[_0x00d1('0x3')]!==_0x197191){this[_0x00d1('0x3')]=_0x197191;io['to'](util[_0x00d1('0x1e')](_0x00d1('0x22'),_0x1a7260[_0x00d1('0x1f')]))['emit'](_0x00d1('0x23'),_0x1a7260);io[_0x00d1('0x24')](_0x00d1('0x25'),_0x1a7260);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 63137d8..8f069c9 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 _0x724c=['dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject'];(function(_0x39b7d8,_0xa44989){var _0x42d6dd=function(_0x2922ab){while(--_0x2922ab){_0x39b7d8['push'](_0x39b7d8['shift']());}};_0x42d6dd(++_0xa44989);}(_0x724c,0x10a));var _0xc724=function(_0x19f985,_0x45960b){_0x19f985=_0x19f985-0x0;var _0x3bb1a1=_0x724c[_0x19f985];return _0x3bb1a1;};'use strict';function Campaign(_0x325063){this['id']=_0x325063['id']||0x0;this[_0xc724('0x0')]=_0x325063['name']||'';this[_0xc724('0x1')]=_0x325063[_0xc724('0x1')]||_0xc724('0x2');this[_0xc724('0x3')]=0x0;this[_0xc724('0x4')]=0x0;this[_0xc724('0x5')]=0x0;this[_0xc724('0x6')]=0x0;this['message']='';this[_0xc724('0x7')]=!![];this[_0xc724('0x8')]=_0x325063[_0xc724('0x8')];this[_0xc724('0x9')]=_0x325063[_0xc724('0x9')];this[_0xc724('0xa')]=_0x325063[_0xc724('0xa')]||null;this[_0xc724('0xb')]=_0x325063[_0xc724('0xb')]?_0x325063[_0xc724('0xb')]:null;this[_0xc724('0xc')]=_0x325063[_0xc724('0xc')];this[_0xc724('0xd')]=_0x325063[_0xc724('0xd')];this['dialOriginateTimeout']=_0x325063[_0xc724('0xe')]||0x1e;this[_0xc724('0xf')]=_0x325063[_0xc724('0xf')];this[_0xc724('0x10')]=_0x325063[_0xc724('0x10')];this[_0xc724('0x11')]=_0x325063[_0xc724('0x11')];this['dialBusyRetryFrequency']=_0x325063['dialBusyRetryFrequency'];this[_0xc724('0x12')]=_0x325063[_0xc724('0x12')];this[_0xc724('0x13')]=_0x325063[_0xc724('0x13')];this[_0xc724('0x14')]=_0x325063[_0xc724('0x14')];this['dialNoSuchNumberMaxRetry']=_0x325063[_0xc724('0x15')]||0x3;this[_0xc724('0x16')]=_0x325063[_0xc724('0x16')]||0x96;this[_0xc724('0x17')]=_0x325063[_0xc724('0x17')]||0x3;this[_0xc724('0x18')]=_0x325063['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x325063[_0xc724('0x19')]||0x3;this[_0xc724('0x1a')]=_0x325063[_0xc724('0x1a')]||0x96;this[_0xc724('0x1b')]=_0x325063[_0xc724('0x1b')]||0x3;this[_0xc724('0x1c')]=_0x325063['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x325063[_0xc724('0x1d')]||0x3;this[_0xc724('0x1e')]=_0x325063['dialAgentRejectRetryFrequency']||0x96;this[_0xc724('0x1f')]=_0x325063[_0xc724('0x1f')]||_0xc724('0x20');this[_0xc724('0x21')]=_0x325063[_0xc724('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x325063[_0xc724('0x22')]||undefined;this['dialCutDigit']=_0x325063[_0xc724('0x23')]||undefined;this[_0xc724('0x24')]=_0x325063['TrunkBackup']?_0x325063[_0xc724('0x24')]:undefined;this[_0xc724('0x25')]=_0x325063[_0xc724('0x25')]?_0x325063[_0xc724('0x25')]:undefined;this[_0xc724('0x26')]=_0x325063[_0xc724('0x26')]?_0x325063[_0xc724('0x26')]:undefined;this[_0xc724('0x27')]=_0x325063['SquareProject']?_0x325063[_0xc724('0x27')]:undefined;this['dialQueueProject']=_0x325063['SquareProject']?_0x325063[_0xc724('0x27')]['name']:undefined;this[_0xc724('0x28')]=_0x325063[_0xc724('0x28')]||![];this[_0xc724('0x29')]=_0x325063[_0xc724('0x29')];this[_0xc724('0x2a')]=_0x325063[_0xc724('0x2a')];this[_0xc724('0x2b')]=_0x325063['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x325063[_0xc724('0x2c')];this['dialAMDMinWordLength']=_0x325063[_0xc724('0x2d')];this['dialAMDBetweenWordsSilence']=_0x325063[_0xc724('0x2e')];this[_0xc724('0x2f')]=_0x325063[_0xc724('0x2f')];this[_0xc724('0x30')]=_0x325063['dialAMDSilenceThreshold'];this[_0xc724('0x31')]=_0x325063['dialAMDMaximumWordLength'];}module[_0xc724('0x32')]=Campaign; \ No newline at end of file +var _0x6eb3=['originated','temp','ivrTotalCallsDays','sendMessageOneNotActive','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign'];(function(_0x461055,_0x24fc86){var _0x154008=function(_0x581156){while(--_0x581156){_0x461055['push'](_0x461055['shift']());}};_0x154008(++_0x24fc86);}(_0x6eb3,0x11d));var _0x36eb=function(_0x51107b,_0x1db2ba){_0x51107b=_0x51107b-0x0;var _0x141a58=_0x6eb3[_0x51107b];return _0x141a58;};'use strict';function Campaign(_0x54baa5){this['id']=_0x54baa5['id']||0x0;this[_0x36eb('0x0')]=_0x54baa5[_0x36eb('0x0')]||'';this[_0x36eb('0x1')]=_0x54baa5['type']||_0x36eb('0x2');this[_0x36eb('0x3')]=0x0;this[_0x36eb('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x36eb('0x5')]=0x0;this['message']='';this[_0x36eb('0x6')]=!![];this['active']=_0x54baa5['active'];this[_0x36eb('0x7')]=_0x54baa5[_0x36eb('0x7')];this[_0x36eb('0x8')]=_0x54baa5[_0x36eb('0x8')]||null;this['dialGlobalInterval']=_0x54baa5[_0x36eb('0x9')]?_0x54baa5[_0x36eb('0x9')]:null;this['dialOriginateCallerIdName']=_0x54baa5[_0x36eb('0xa')];this['dialOriginateCallerIdNumber']=_0x54baa5[_0x36eb('0xb')];this[_0x36eb('0xc')]=_0x54baa5[_0x36eb('0xc')]||0x1e;this[_0x36eb('0xd')]=_0x54baa5[_0x36eb('0xd')];this[_0x36eb('0xe')]=_0x54baa5[_0x36eb('0xe')];this[_0x36eb('0xf')]=_0x54baa5[_0x36eb('0xf')];this[_0x36eb('0x10')]=_0x54baa5[_0x36eb('0x10')];this[_0x36eb('0x11')]=_0x54baa5[_0x36eb('0x11')];this[_0x36eb('0x12')]=_0x54baa5['dialNoAnswerRetryFrequency'];this[_0x36eb('0x13')]=_0x54baa5[_0x36eb('0x13')];this[_0x36eb('0x14')]=_0x54baa5[_0x36eb('0x14')]||0x3;this[_0x36eb('0x15')]=_0x54baa5[_0x36eb('0x15')]||0x96;this[_0x36eb('0x16')]=_0x54baa5[_0x36eb('0x16')]||0x3;this[_0x36eb('0x17')]=_0x54baa5[_0x36eb('0x17')]||0x96;this[_0x36eb('0x18')]=_0x54baa5['dialAbandonedMaxRetry']||0x3;this[_0x36eb('0x19')]=_0x54baa5[_0x36eb('0x19')]||0x96;this[_0x36eb('0x1a')]=_0x54baa5['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x54baa5['dialMachineRetryFrequency']||0x96;this[_0x36eb('0x1b')]=_0x54baa5['dialAgentRejectMaxRetry']||0x3;this[_0x36eb('0x1c')]=_0x54baa5[_0x36eb('0x1c')]||0x96;this[_0x36eb('0x1d')]=_0x54baa5['dialOrderByScheduledAt']||_0x36eb('0x1e');this[_0x36eb('0x1f')]=_0x54baa5[_0x36eb('0x1f')]||undefined;this[_0x36eb('0x20')]=_0x54baa5[_0x36eb('0x20')]||undefined;this[_0x36eb('0x21')]=_0x54baa5['dialCutDigit']||undefined;this[_0x36eb('0x22')]=_0x54baa5['TrunkBackup']?_0x54baa5[_0x36eb('0x22')]:undefined;this['Trunk']=_0x54baa5[_0x36eb('0x23')]?_0x54baa5['Trunk']:undefined;this['Interval']=_0x54baa5[_0x36eb('0x24')]?_0x54baa5[_0x36eb('0x24')]:undefined;this[_0x36eb('0x25')]=_0x54baa5[_0x36eb('0x25')]?_0x54baa5[_0x36eb('0x25')]:undefined;this[_0x36eb('0x26')]=_0x54baa5[_0x36eb('0x25')]?_0x54baa5[_0x36eb('0x25')][_0x36eb('0x0')]:undefined;this[_0x36eb('0x27')]=_0x54baa5[_0x36eb('0x27')]||![];this[_0x36eb('0x28')]=_0x54baa5[_0x36eb('0x28')];this['dialAMDGreeting']=_0x54baa5['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x54baa5['dialAMDAfterGreetingSilence'];this[_0x36eb('0x29')]=_0x54baa5[_0x36eb('0x29')];this[_0x36eb('0x2a')]=_0x54baa5[_0x36eb('0x2a')];this['dialAMDBetweenWordsSilence']=_0x54baa5[_0x36eb('0x2b')];this[_0x36eb('0x2c')]=_0x54baa5['dialAMDMaximumNumberOfWords'];this[_0x36eb('0x2d')]=_0x54baa5[_0x36eb('0x2d')];this['dialAMDMaximumWordLength']=_0x54baa5[_0x36eb('0x2e')];}module[_0x36eb('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 548beec..bbea210 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 _0x7a2c=['transfercalleridnum','transferType','mohtime','exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','exten','answered','abandoned','lastapplication','lastdata','duration','holdtime','type','tag','monitor','queue','monitors'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x293aab,_0x3cc42c){_0x293aab=_0x293aab-0x0;var _0x3ee752=_0x7a2c[_0x293aab];return _0x3ee752;};'use strict';function Channel(){this[_0xc7a2('0x0')]=null;this['channel']='';this[_0xc7a2('0x1')]='';this[_0xc7a2('0x2')]=0x0;this[_0xc7a2('0x3')]='';this[_0xc7a2('0x4')]=undefined;this[_0xc7a2('0x5')]=undefined;this[_0xc7a2('0x6')]=0x0;this[_0xc7a2('0x7')]='';this[_0xc7a2('0x8')]=0x0;this['linkedid']=0x0;this[_0xc7a2('0x9')]=0x0;this[_0xc7a2('0xa')]=![];this['answertime']=null;this['endtime']=null;this['unmanaged']=![];this[_0xc7a2('0xb')]=![];this[_0xc7a2('0xc')]='';this[_0xc7a2('0xd')]='';this[_0xc7a2('0xe')]=0x0;this['billableseconds']=0x0;this[_0xc7a2('0xf')]=0x0;this[_0xc7a2('0x10')]=null;this[_0xc7a2('0x11')]=null;this['disposition']=null;this[_0xc7a2('0x12')]=![];this['monitorFilename']=null;this[_0xc7a2('0x13')]=null;this[_0xc7a2('0x14')]=[];this[_0xc7a2('0x15')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xc7a2('0x16')]=undefined;this[_0xc7a2('0x17')]=0x0;}module[_0xc7a2('0x18')]=Channel; \ No newline at end of file +var _0x6931=['transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','tag','disposition','monitor','queue','monitors'];(function(_0x37adfe,_0x42699e){var _0x21a812=function(_0x352b4d){while(--_0x352b4d){_0x37adfe['push'](_0x37adfe['shift']());}};_0x21a812(++_0x42699e);}(_0x6931,0x8c));var _0x1693=function(_0x190758,_0x42e633){_0x190758=_0x190758-0x0;var _0x3d13a2=_0x6931[_0x190758];return _0x3d13a2;};'use strict';function Channel(){this[_0x1693('0x0')]=null;this[_0x1693('0x1')]='';this[_0x1693('0x2')]='';this['calleridnum']=0x0;this['calleridname']='';this[_0x1693('0x3')]=undefined;this[_0x1693('0x4')]=undefined;this[_0x1693('0x5')]=0x0;this[_0x1693('0x6')]='';this[_0x1693('0x7')]=0x0;this[_0x1693('0x8')]=0x0;this[_0x1693('0x9')]=0x0;this['answered']=![];this['answertime']=null;this['endtime']=null;this[_0x1693('0xa')]=![];this[_0x1693('0xb')]=![];this[_0x1693('0xc')]='';this[_0x1693('0xd')]='';this[_0x1693('0xe')]=0x0;this[_0x1693('0xf')]=0x0;this[_0x1693('0x10')]=0x0;this['type']=null;this[_0x1693('0x11')]=null;this[_0x1693('0x12')]=null;this[_0x1693('0x13')]=![];this['monitorFilename']=null;this[_0x1693('0x14')]=null;this[_0x1693('0x15')]=[];this[_0x1693('0x16')]=undefined;this[_0x1693('0x17')]=undefined;this[_0x1693('0x18')]=undefined;this[_0x1693('0x19')]=0x0;}module[_0x1693('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 3e6c2c9..177ae29 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 _0xea81=['exports','name','username','remoteUri','authType','password','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x1d06a5,_0x4fc577){var _0xbaab59=function(_0x458664){while(--_0x458664){_0x1d06a5['push'](_0x1d06a5['shift']());}};_0xbaab59(++_0x4fc577);}(_0xea81,0x1ed));var _0x1ea8=function(_0x2a8079,_0x1ebafd){_0x2a8079=_0x2a8079-0x0;var _0x25e337=_0xea81[_0x2a8079];return _0x25e337;};'use strict';function DeskAccount(_0x202267){this['id']=_0x202267['id']||0x0;this[_0x1ea8('0x0')]=_0x202267[_0x1ea8('0x0')]||'';this[_0x1ea8('0x1')]=_0x202267['username']||'';this['remoteUri']=_0x202267[_0x1ea8('0x2')]||'';this[_0x1ea8('0x3')]=_0x202267[_0x1ea8('0x3')]||'';this[_0x1ea8('0x4')]=_0x202267[_0x1ea8('0x4')]||'';this['consumerKey']=_0x202267['consumerKey']||'';this['consumerSecret']=_0x202267[_0x1ea8('0x5')]||'';this[_0x1ea8('0x6')]=_0x202267[_0x1ea8('0x6')]||'';this[_0x1ea8('0x7')]=_0x202267['tokenSecret']||'';this[_0x1ea8('0x8')]=_0x202267[_0x1ea8('0x8')]||'';this[_0x1ea8('0x9')]=_0x202267[_0x1ea8('0x9')]||'';this[_0x1ea8('0xa')]=_0x202267['Configurations']||{};}module[_0x1ea8('0xb')]=DeskAccount; \ No newline at end of file +var _0x0bde=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri','authType'];(function(_0x17f242,_0x11253b){var _0x427e19=function(_0x322a9c){while(--_0x322a9c){_0x17f242['push'](_0x17f242['shift']());}};_0x427e19(++_0x11253b);}(_0x0bde,0x110));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';function DeskAccount(_0x3ee8c6){this['id']=_0x3ee8c6['id']||0x0;this['name']=_0x3ee8c6[_0xe0bd('0x0')]||'';this[_0xe0bd('0x1')]=_0x3ee8c6['username']||'';this[_0xe0bd('0x2')]=_0x3ee8c6[_0xe0bd('0x2')]||'';this[_0xe0bd('0x3')]=_0x3ee8c6['authType']||'';this[_0xe0bd('0x4')]=_0x3ee8c6[_0xe0bd('0x4')]||'';this[_0xe0bd('0x5')]=_0x3ee8c6[_0xe0bd('0x5')]||'';this[_0xe0bd('0x6')]=_0x3ee8c6[_0xe0bd('0x6')]||'';this[_0xe0bd('0x7')]=_0x3ee8c6[_0xe0bd('0x7')]||'';this[_0xe0bd('0x8')]=_0x3ee8c6[_0xe0bd('0x8')]||'';this[_0xe0bd('0x9')]=_0x3ee8c6[_0xe0bd('0x9')]||'';this[_0xe0bd('0xa')]=_0x3ee8c6['serverUrl']||'';this[_0xe0bd('0xb')]=_0x3ee8c6[_0xe0bd('0xb')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index ed4211b..9ae6782 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 _0x8c90=['name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports'];(function(_0x328f92,_0x5cf212){var _0x2ff6e2=function(_0x49d9cf){while(--_0x49d9cf){_0x328f92['push'](_0x328f92['shift']());}};_0x2ff6e2(++_0x5cf212);}(_0x8c90,0x14a));var _0x08c9=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x8c90[_0x56482c];return _0x5aae7a;};'use strict';function Dynamics365Account(_0x282d86){this['id']=_0x282d86['id']||0x0;this['name']=_0x282d86[_0x08c9('0x0')]||'';this[_0x08c9('0x1')]=_0x282d86['username']||'';this[_0x08c9('0x2')]=_0x282d86[_0x08c9('0x2')]||'';this[_0x08c9('0x3')]=_0x282d86['remoteUri']||'';this[_0x08c9('0x4')]=_0x282d86[_0x08c9('0x4')]||'';this[_0x08c9('0x5')]=_0x282d86[_0x08c9('0x5')]||'';this[_0x08c9('0x6')]=_0x282d86[_0x08c9('0x6')]||{};this[_0x08c9('0x7')]=_0x282d86[_0x08c9('0x7')]||'';this[_0x08c9('0x8')]=_0x282d86[_0x08c9('0x8')]||{};}module[_0x08c9('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x251d=['serverUrl','Configurations','exports','name','username','password','remoteUri','tenantId','clientSecret'];(function(_0x3a6bef,_0x357765){var _0x5b54b6=function(_0x114712){while(--_0x114712){_0x3a6bef['push'](_0x3a6bef['shift']());}};_0x5b54b6(++_0x357765);}(_0x251d,0x111));var _0xd251=function(_0x5314be,_0xe0f24f){_0x5314be=_0x5314be-0x0;var _0x15ad29=_0x251d[_0x5314be];return _0x15ad29;};'use strict';function Dynamics365Account(_0x2181e4){this['id']=_0x2181e4['id']||0x0;this[_0xd251('0x0')]=_0x2181e4[_0xd251('0x0')]||'';this[_0xd251('0x1')]=_0x2181e4[_0xd251('0x1')]||'';this['password']=_0x2181e4[_0xd251('0x2')]||'';this[_0xd251('0x3')]=_0x2181e4['remoteUri']||'';this[_0xd251('0x4')]=_0x2181e4['tenantId']||'';this['clientId']=_0x2181e4['clientId']||'';this[_0xd251('0x5')]=_0x2181e4[_0xd251('0x5')]||{};this[_0xd251('0x6')]=_0x2181e4[_0xd251('0x6')]||'';this[_0xd251('0x7')]=_0x2181e4[_0xd251('0x7')]||{};}module[_0xd251('0x8')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 2ef71ff..911e97b 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 _0x2901=['description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name'];(function(_0x5ac527,_0x33fe40){var _0x91a28f=function(_0x4755ec){while(--_0x4755ec){_0x5ac527['push'](_0x5ac527['shift']());}};_0x91a28f(++_0x33fe40);}(_0x2901,0xfe));var _0x1290=function(_0x146a3f,_0x53a76f){_0x146a3f=_0x146a3f-0x0;var _0x10e034=_0x2901[_0x146a3f];return _0x10e034;};'use strict';function FaxAccount(_0x3bde33){this['id']=_0x3bde33['id']||0x0;this[_0x1290('0x0')]=_0x3bde33[_0x1290('0x0')]||'';this[_0x1290('0x1')]=_0x3bde33[_0x1290('0x1')];this[_0x1290('0x2')]=_0x3bde33[_0x1290('0x2')];this[_0x1290('0x3')]=_0x3bde33[_0x1290('0x3')];this[_0x1290('0x4')]=_0x3bde33[_0x1290('0x4')];this[_0x1290('0x5')]=_0x3bde33['minrate']||0x960;this[_0x1290('0x6')]=_0x3bde33[_0x1290('0x6')]||0x3840;this[_0x1290('0x7')]=_0x3bde33[_0x1290('0x7')]||_0x1290('0x8');this[_0x1290('0x9')]=_0x3bde33[_0x1290('0x9')]||'no';this[_0x1290('0xa')]=_0x3bde33[_0x1290('0xa')]||'no';this[_0x1290('0xb')]=_0x3bde33[_0x1290('0xb')]||0x1388;this[_0x1290('0xc')]=_0x3bde33[_0x1290('0xc')]||_0x1290('0xd');this[_0x1290('0xe')]=_0x3bde33[_0x1290('0xe')]?_0x3bde33['Trunk']:undefined;this[_0x1290('0xf')]=_0x3bde33[_0x1290('0xf')];this[_0x1290('0x10')]=_0x3bde33['key'];}module['exports']=FaxAccount; \ No newline at end of file +var _0x9127=['gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x9127,0x1b9));var _0x7912=function(_0x146484,_0x27a7f0){_0x146484=_0x146484-0x0;var _0x4c7aa3=_0x9127[_0x146484];return _0x4c7aa3;};'use strict';function FaxAccount(_0x38898c){this['id']=_0x38898c['id']||0x0;this[_0x7912('0x0')]=_0x38898c[_0x7912('0x0')]||'';this[_0x7912('0x1')]=_0x38898c['description'];this[_0x7912('0x2')]=_0x38898c['ecm'];this[_0x7912('0x3')]=_0x38898c[_0x7912('0x3')];this[_0x7912('0x4')]=_0x38898c['localstationid'];this[_0x7912('0x5')]=_0x38898c[_0x7912('0x5')]||0x960;this[_0x7912('0x6')]=_0x38898c[_0x7912('0x6')]||0x3840;this[_0x7912('0x7')]=_0x38898c['modem']||_0x7912('0x8');this['gateway']=_0x38898c[_0x7912('0x9')]||'no';this['faxdetect']=_0x38898c[_0x7912('0xa')]||'no';this[_0x7912('0xb')]=_0x38898c['t38timeout']||0x1388;this[_0x7912('0xc')]=_0x38898c['tech']||_0x7912('0xd');this['Trunk']=_0x38898c['Trunk']?_0x38898c[_0x7912('0xe')]:undefined;this['ListId']=_0x38898c[_0x7912('0xf')];this[_0x7912('0x10')]=_0x38898c[_0x7912('0x10')];}module[_0x7912('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index f3118ab..0880112 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 _0x932c=['username','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x383cb6,_0x2dcf05){var _0x577362=function(_0x4160eb){while(--_0x4160eb){_0x383cb6['push'](_0x383cb6['shift']());}};_0x577362(++_0x2dcf05);}(_0x932c,0xad));var _0xc932=function(_0x2a4fe2,_0x3ec53a){_0x2a4fe2=_0x2a4fe2-0x0;var _0x225c4a=_0x932c[_0x2a4fe2];return _0x225c4a;};'use strict';function FreshdeskAccount(_0x1a3372){this['id']=_0x1a3372['id']||0x0;this['name']=_0x1a3372[_0xc932('0x0')]||'';this['username']=_0x1a3372[_0xc932('0x1')]||'';this['apiKey']=_0x1a3372['token']||'';this[_0xc932('0x2')]=_0x1a3372[_0xc932('0x2')]||'';this[_0xc932('0x3')]=_0x1a3372['serverUrl']||'';this[_0xc932('0x4')]=_0x1a3372[_0xc932('0x4')]||{};}module[_0xc932('0x5')]=FreshdeskAccount; \ No newline at end of file +var _0x8bd4=['username','apiKey','token','remoteUri','serverUrl','Configurations','name'];(function(_0x2a7d55,_0x36bd70){var _0x137989=function(_0x51246a){while(--_0x51246a){_0x2a7d55['push'](_0x2a7d55['shift']());}};_0x137989(++_0x36bd70);}(_0x8bd4,0x8b));var _0x48bd=function(_0x578316,_0x29b332){_0x578316=_0x578316-0x0;var _0x20b0bc=_0x8bd4[_0x578316];return _0x20b0bc;};'use strict';function FreshdeskAccount(_0x546ddf){this['id']=_0x546ddf['id']||0x0;this[_0x48bd('0x0')]=_0x546ddf[_0x48bd('0x0')]||'';this[_0x48bd('0x1')]=_0x546ddf[_0x48bd('0x1')]||'';this[_0x48bd('0x2')]=_0x546ddf[_0x48bd('0x3')]||'';this[_0x48bd('0x4')]=_0x546ddf[_0x48bd('0x4')]||'';this[_0x48bd('0x5')]=_0x546ddf[_0x48bd('0x5')]||'';this[_0x48bd('0x6')]=_0x546ddf[_0x48bd('0x6')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 2578e20..666a1f2 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 _0x7715=['serverUrl','Configurations','name','username','apiKey','token','remoteUri'];(function(_0x54adc4,_0x16e4fc){var _0xe49111=function(_0x451f2b){while(--_0x451f2b){_0x54adc4['push'](_0x54adc4['shift']());}};_0xe49111(++_0x16e4fc);}(_0x7715,0x1de));var _0x5771=function(_0x15f3ae,_0x433f70){_0x15f3ae=_0x15f3ae-0x0;var _0x5c6fc9=_0x7715[_0x15f3ae];return _0x5c6fc9;};'use strict';function FreshsalesAccount(_0x55bab4){this['id']=_0x55bab4['id']||0x0;this[_0x5771('0x0')]=_0x55bab4[_0x5771('0x0')]||'';this['username']=_0x55bab4[_0x5771('0x1')]||'';this[_0x5771('0x2')]=_0x55bab4[_0x5771('0x3')]||'';this[_0x5771('0x4')]=_0x55bab4['remoteUri']||'';this[_0x5771('0x5')]=_0x55bab4[_0x5771('0x5')]||'';this[_0x5771('0x6')]=_0x55bab4['Configurations']||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xfaa3=['token','Configurations','name','username','apiKey'];(function(_0x4036c9,_0x4259db){var _0x53c483=function(_0x5f4cf2){while(--_0x5f4cf2){_0x4036c9['push'](_0x4036c9['shift']());}};_0x53c483(++_0x4259db);}(_0xfaa3,0x110));var _0x3faa=function(_0x4c8977,_0x5485d7){_0x4c8977=_0x4c8977-0x0;var _0x2308b3=_0xfaa3[_0x4c8977];return _0x2308b3;};'use strict';function FreshsalesAccount(_0x15613c){this['id']=_0x15613c['id']||0x0;this[_0x3faa('0x0')]=_0x15613c[_0x3faa('0x0')]||'';this['username']=_0x15613c[_0x3faa('0x1')]||'';this[_0x3faa('0x2')]=_0x15613c[_0x3faa('0x3')]||'';this['remoteUri']=_0x15613c['remoteUri']||'';this['serverUrl']=_0x15613c['serverUrl']||'';this[_0x3faa('0x4')]=_0x15613c[_0x3faa('0x4')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 1b6109e..09f049d 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 _0xa57c=['connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','type','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum'];(function(_0xd0fcb0,_0x289863){var _0x38f584=function(_0x9d108f){while(--_0x9d108f){_0xd0fcb0['push'](_0xd0fcb0['shift']());}};_0x38f584(++_0x289863);}(_0xa57c,0x150));var _0xca57=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xa57c[_0x1cc8fe];return _0x230054;};'use strict';function QueueReport(){this[_0xca57('0x0')]=_0xca57('0x1');this[_0xca57('0x2')]='';this['calleridnum']='';this[_0xca57('0x3')]='';this[_0xca57('0x4')]='';this[_0xca57('0x5')]=null;this['queuecallerleaveAt']=null;this[_0xca57('0x6')]=0x1;this[_0xca57('0x7')]=0x1;this['queuecallerabandon']=![];this[_0xca57('0x8')]=null;this['queuecallercomplete']=![];this[_0xca57('0x9')]=null;this[_0xca57('0xa')]=![];this[_0xca57('0xb')]=null;this['originalposition']=0x1;this[_0xca57('0xc')]='';this[_0xca57('0xd')]='';this[_0xca57('0xe')]='';this[_0xca57('0xf')]='';this[_0xca57('0x10')]='';this[_0xca57('0x11')]='';this[_0xca57('0x12')]='';this[_0xca57('0x13')]=0x0;this[_0xca57('0x14')]=![];this[_0xca57('0x15')]='';this[_0xca57('0x16')]=0x0;this[_0xca57('0x17')]={};}module[_0xca57('0x18')]=QueueReport; \ No newline at end of file +var _0x866e=['queuecallerexitAt','originalposition','channel','connectedlinenum','context','exten','holdtime','assigned','lastAssignedTo','mohtime','variables','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x866e,0x113));var _0xe866=function(_0x470968,_0x39fe8d){_0x470968=_0x470968-0x0;var _0x22dc8e=_0x866e[_0x470968];return _0x22dc8e;};'use strict';function QueueReport(){this[_0xe866('0x0')]='inbound';this[_0xe866('0x1')]='';this[_0xe866('0x2')]='';this[_0xe866('0x3')]='';this[_0xe866('0x4')]='';this[_0xe866('0x5')]=null;this[_0xe866('0x6')]=null;this[_0xe866('0x7')]=0x1;this[_0xe866('0x8')]=0x1;this[_0xe866('0x9')]=![];this[_0xe866('0xa')]=null;this['queuecallercomplete']=![];this[_0xe866('0xb')]=null;this[_0xe866('0xc')]=![];this[_0xe866('0xd')]=null;this[_0xe866('0xe')]=0x1;this[_0xe866('0xf')]='';this[_0xe866('0x10')]='';this['connectedlinename']='';this['accountcode']='';this[_0xe866('0x11')]='';this[_0xe866('0x12')]='';this['priority']='';this[_0xe866('0x13')]=0x0;this[_0xe866('0x14')]=![];this[_0xe866('0x15')]='';this[_0xe866('0x16')]=0x0;this[_0xe866('0x17')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index fe686a3..d05c774 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 _0x3913=['securityToken','type','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x3913,0xcb));var _0x3391=function(_0x25b8d4,_0x45283){_0x25b8d4=_0x25b8d4-0x0;var _0x1273c2=_0x3913[_0x25b8d4];return _0x1273c2;};'use strict';function SalesforceAccount(_0x1ffec6){this['id']=_0x1ffec6['id']||0x0;this['name']=_0x1ffec6[_0x3391('0x0')]||'';this[_0x3391('0x1')]=_0x1ffec6['username']||'';this[_0x3391('0x2')]=_0x1ffec6['remoteUri']||'';this[_0x3391('0x3')]=_0x1ffec6[_0x3391('0x3')]||'';this[_0x3391('0x4')]=_0x1ffec6['clientId']||'';this['clientSecret']=_0x1ffec6[_0x3391('0x5')]||'';this['securityToken']=_0x1ffec6[_0x3391('0x6')]||'';this[_0x3391('0x7')]=_0x1ffec6[_0x3391('0x7')]||'integrationTab';this[_0x3391('0x8')]=_0x1ffec6[_0x3391('0x8')]||'';this[_0x3391('0x9')]=_0x1ffec6['Configurations']||{};}module[_0x3391('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x68c9=['type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret','securityToken'];(function(_0x257a11,_0x2100c9){var _0x1e8b43=function(_0x474062){while(--_0x474062){_0x257a11['push'](_0x257a11['shift']());}};_0x1e8b43(++_0x2100c9);}(_0x68c9,0xeb));var _0x968c=function(_0x349b69,_0x1477ba){_0x349b69=_0x349b69-0x0;var _0x58c2f8=_0x68c9[_0x349b69];return _0x58c2f8;};'use strict';function SalesforceAccount(_0x3c9709){this['id']=_0x3c9709['id']||0x0;this['name']=_0x3c9709[_0x968c('0x0')]||'';this[_0x968c('0x1')]=_0x3c9709[_0x968c('0x1')]||'';this[_0x968c('0x2')]=_0x3c9709[_0x968c('0x2')]||'';this[_0x968c('0x3')]=_0x3c9709['password']||'';this[_0x968c('0x4')]=_0x3c9709['clientId']||'';this[_0x968c('0x5')]=_0x3c9709[_0x968c('0x5')]||'';this[_0x968c('0x6')]=_0x3c9709['securityToken']||'';this[_0x968c('0x7')]=_0x3c9709[_0x968c('0x7')]||_0x968c('0x8');this[_0x968c('0x9')]=_0x3c9709['serverUrl']||'';this[_0x968c('0xa')]=_0x3c9709[_0x968c('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index ca4245f..b8eeac7 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 _0xec83=['password','remoteUri','serverUrl','Configurations','name','username'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xec83,0xfa));var _0x3ec8=function(_0x39609a,_0x28a563){_0x39609a=_0x39609a-0x0;var _0xecd92=_0xec83[_0x39609a];return _0xecd92;};'use strict';function ServicenowAccount(_0x154387){this['id']=_0x154387['id']||0x0;this[_0x3ec8('0x0')]=_0x154387[_0x3ec8('0x0')]||'';this[_0x3ec8('0x1')]=_0x154387[_0x3ec8('0x1')]||'';this[_0x3ec8('0x2')]=_0x154387[_0x3ec8('0x2')]||'';this[_0x3ec8('0x3')]=_0x154387[_0x3ec8('0x3')]||'';this[_0x3ec8('0x4')]=_0x154387[_0x3ec8('0x4')]||'';this[_0x3ec8('0x5')]=_0x154387['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x26b3=['remoteUri','serverUrl','Configurations','name','username','password'];(function(_0x27c2f8,_0x5e43fc){var _0x2cc757=function(_0x47813c){while(--_0x47813c){_0x27c2f8['push'](_0x27c2f8['shift']());}};_0x2cc757(++_0x5e43fc);}(_0x26b3,0x1e3));var _0x326b=function(_0x4e5f35,_0x2b96c3){_0x4e5f35=_0x4e5f35-0x0;var _0x2b4b26=_0x26b3[_0x4e5f35];return _0x2b4b26;};'use strict';function ServicenowAccount(_0x4d32d9){this['id']=_0x4d32d9['id']||0x0;this[_0x326b('0x0')]=_0x4d32d9[_0x326b('0x0')]||'';this[_0x326b('0x1')]=_0x4d32d9[_0x326b('0x1')]||'';this[_0x326b('0x2')]=_0x4d32d9[_0x326b('0x2')]||'';this[_0x326b('0x3')]=_0x4d32d9[_0x326b('0x3')]||'';this[_0x326b('0x4')]=_0x4d32d9[_0x326b('0x4')]||'';this[_0x326b('0x5')]=_0x4d32d9[_0x326b('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index c14558c..7505514 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 _0xfbcc=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x2248b5,_0x3174ad){var _0x2d88e6=function(_0x34e698){while(--_0x34e698){_0x2248b5['push'](_0x2248b5['shift']());}};_0x2d88e6(++_0x3174ad);}(_0xfbcc,0x11c));var _0xcfbc=function(_0x28f1de,_0x355054){_0x28f1de=_0x28f1de-0x0;var _0x5b5dad=_0xfbcc[_0x28f1de];return _0x5b5dad;};'use strict';function SugarcrmAccount(_0x3700ad){this['id']=_0x3700ad['id']||0x0;this[_0xcfbc('0x0')]=_0x3700ad[_0xcfbc('0x0')]||'';this[_0xcfbc('0x1')]=_0x3700ad[_0xcfbc('0x1')]||'';this[_0xcfbc('0x2')]=_0x3700ad['password']||'';this[_0xcfbc('0x3')]=_0x3700ad[_0xcfbc('0x3')]||'';this['serverUrl']=_0x3700ad[_0xcfbc('0x4')]||'';this['Configurations']=_0x3700ad[_0xcfbc('0x5')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file +var _0x25cd=['name','username','serverUrl','Configurations'];(function(_0x1447a0,_0x2ff19e){var _0x10b0ac=function(_0x12b8e5){while(--_0x12b8e5){_0x1447a0['push'](_0x1447a0['shift']());}};_0x10b0ac(++_0x2ff19e);}(_0x25cd,0x140));var _0xd25c=function(_0x56ed09,_0x47abc8){_0x56ed09=_0x56ed09-0x0;var _0x1d5fae=_0x25cd[_0x56ed09];return _0x1d5fae;};'use strict';function SugarcrmAccount(_0x2cb490){this['id']=_0x2cb490['id']||0x0;this[_0xd25c('0x0')]=_0x2cb490[_0xd25c('0x0')]||'';this[_0xd25c('0x1')]=_0x2cb490[_0xd25c('0x1')]||'';this['password']=_0x2cb490['password']||'';this['remoteUri']=_0x2cb490['remoteUri']||'';this[_0xd25c('0x2')]=_0x2cb490[_0xd25c('0x2')]||'';this[_0xd25c('0x3')]=_0x2cb490[_0xd25c('0x3')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index f62dff8..ebc127e 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 _0x3165=['exports','name','accountcode','unknown','status'];(function(_0x5f50b5,_0xa8db83){var _0x54c383=function(_0x381334){while(--_0x381334){_0x5f50b5['push'](_0x5f50b5['shift']());}};_0x54c383(++_0xa8db83);}(_0x3165,0x15a));var _0x5316=function(_0x3c5016,_0x4a2958){_0x3c5016=_0x3c5016-0x0;var _0x291b45=_0x3165[_0x3c5016];return _0x291b45;};'use strict';function Telephone(_0x4317df){this['id']=_0x4317df['id']||0x0;this[_0x5316('0x0')]=_0x4317df[_0x5316('0x0')]||'';this[_0x5316('0x1')]=_0x4317df[_0x5316('0x1')]||'';this['state']=_0x5316('0x2');this['stateTime']=0x0;this[_0x5316('0x3')]=_0x5316('0x2');this['address']='';}module[_0x5316('0x4')]=Telephone; \ No newline at end of file +var _0xc79e=['stateTime','status','address','name','accountcode','state','unknown'];(function(_0x3b8ceb,_0x363b0d){var _0x3b0d6d=function(_0x6dfa28){while(--_0x6dfa28){_0x3b8ceb['push'](_0x3b8ceb['shift']());}};_0x3b0d6d(++_0x363b0d);}(_0xc79e,0x81));var _0xec79=function(_0x1faa61,_0x1bd7e2){_0x1faa61=_0x1faa61-0x0;var _0x3f0e58=_0xc79e[_0x1faa61];return _0x3f0e58;};'use strict';function Telephone(_0x1dccde){this['id']=_0x1dccde['id']||0x0;this[_0xec79('0x0')]=_0x1dccde[_0xec79('0x0')]||'';this[_0xec79('0x1')]=_0x1dccde[_0xec79('0x1')]||'';this[_0xec79('0x2')]=_0xec79('0x3');this[_0xec79('0x4')]=0x0;this[_0xec79('0x5')]=_0xec79('0x3');this[_0xec79('0x6')]='';}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 fa80bf4..38e4abe 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 _0x665c=['html','exports','name'];(function(_0x493628,_0x489b08){var _0x418e5d=function(_0x47c83d){while(--_0x47c83d){_0x493628['push'](_0x493628['shift']());}};_0x418e5d(++_0x489b08);}(_0x665c,0x1a9));var _0xc665=function(_0x37c814,_0x1a1e55){_0x37c814=_0x37c814-0x0;var _0x48a3ca=_0x665c[_0x37c814];return _0x48a3ca;};'use strict';function template(_0x3d3c5b){this['id']=_0x3d3c5b['id']||0x0;this[_0xc665('0x0')]=_0x3d3c5b[_0xc665('0x0')]||'';this[_0xc665('0x1')]=_0x3d3c5b[_0xc665('0x1')]||'';}module[_0xc665('0x2')]=template; \ No newline at end of file +var _0xeb84=['html','exports','name'];(function(_0x685d05,_0x847f4c){var _0x56eb3d=function(_0x2c8c8e){while(--_0x2c8c8e){_0x685d05['push'](_0x685d05['shift']());}};_0x56eb3d(++_0x847f4c);}(_0xeb84,0x194));var _0x4eb8=function(_0xcaf223,_0xd39f07){_0xcaf223=_0xcaf223-0x0;var _0x17e00d=_0xeb84[_0xcaf223];return _0x17e00d;};'use strict';function template(_0x2e59a2){this['id']=_0x2e59a2['id']||0x0;this[_0x4eb8('0x0')]=_0x2e59a2[_0x4eb8('0x0')]||'';this[_0x4eb8('0x1')]=_0x2e59a2['html']||'';}module[_0x4eb8('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 1172080..7aa55ba 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 _0x34e8=['channel','voice','status','AllConditions','AnyConditions','Actions','name'];(function(_0x25ad66,_0x46e4dc){var _0x141bc4=function(_0x3a7f8e){while(--_0x3a7f8e){_0x25ad66['push'](_0x25ad66['shift']());}};_0x141bc4(++_0x46e4dc);}(_0x34e8,0x12c));var _0x834e=function(_0x53b8d0,_0x4c310){_0x53b8d0=_0x53b8d0-0x0;var _0x1afd17=_0x34e8[_0x53b8d0];return _0x1afd17;};'use strict';function Trigger(_0x26715f){this['id']=_0x26715f['id']||0x0;this[_0x834e('0x0')]=_0x26715f[_0x834e('0x0')]||'';this[_0x834e('0x1')]=_0x26715f['channel']||_0x834e('0x2');this[_0x834e('0x3')]=_0x26715f[_0x834e('0x3')]||![];this[_0x834e('0x4')]=_0x26715f[_0x834e('0x4')]||[];this[_0x834e('0x5')]=_0x26715f[_0x834e('0x5')]||[];this['Actions']=_0x26715f[_0x834e('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0x00bb=['status','AllConditions','AnyConditions','exports','name','channel'];(function(_0x35469f,_0x1b968f){var _0x773682=function(_0x2dd377){while(--_0x2dd377){_0x35469f['push'](_0x35469f['shift']());}};_0x773682(++_0x1b968f);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x00bb[_0x1ac595];return _0x455fff;};'use strict';function Trigger(_0x4b870b){this['id']=_0x4b870b['id']||0x0;this[_0xb00b('0x0')]=_0x4b870b[_0xb00b('0x0')]||'';this['channel']=_0x4b870b[_0xb00b('0x1')]||'voice';this[_0xb00b('0x2')]=_0x4b870b[_0xb00b('0x2')]||![];this['AllConditions']=_0x4b870b[_0xb00b('0x3')]||[];this[_0xb00b('0x4')]=_0x4b870b['AnyConditions']||[];this['Actions']=_0x4b870b['Actions']||[];}module[_0xb00b('0x5')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 6608355..d43cfc8 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 _0x96dd=['indexOf','split','host','port','domain','refresh','registrationtime','address','exports','active','name','state','unknown','status','registry'];(function(_0x453a05,_0x102018){var _0xc42c7d=function(_0x39f5a3){while(--_0x39f5a3){_0x453a05['push'](_0x453a05['shift']());}};_0xc42c7d(++_0x102018);}(_0x96dd,0x162));var _0xd96d=function(_0x1a9a45,_0x1739c5){_0x1a9a45=_0x1a9a45-0x0;var _0xf20875=_0x96dd[_0x1a9a45];return _0xf20875;};'use strict';function Trunk(_0x4cdd11){this['id']=_0x4cdd11['id']||0x0;this[_0xd96d('0x0')]=_0x4cdd11[_0xd96d('0x0')]||![];this[_0xd96d('0x1')]=_0x4cdd11[_0xd96d('0x1')]||'';this[_0xd96d('0x2')]=_0xd96d('0x3');this['stateTime']=0x0;this[_0xd96d('0x4')]='unknown';this[_0xd96d('0x5')]=_0x4cdd11['registry']&&_0x4cdd11['registry'][_0xd96d('0x6')](':')?_0x4cdd11[_0xd96d('0x5')][_0xd96d('0x7')](':')[0x0]:'';this[_0xd96d('0x8')]='';this[_0xd96d('0x9')]='';this[_0xd96d('0xa')]='';this['domainport']='';this[_0xd96d('0xb')]='';this['stateRegistry']=_0xd96d('0x3');this[_0xd96d('0xc')]='';this[_0xd96d('0xd')]='';}module[_0xd96d('0xe')]=Trunk; \ No newline at end of file +var _0x0c24=['registry','indexOf','split','host','port','domainport','refresh','stateRegistry','registrationtime','address','exports','active','name','state','status','unknown'];(function(_0x500989,_0x3eac0d){var _0x4d8eb5=function(_0xef5241){while(--_0xef5241){_0x500989['push'](_0x500989['shift']());}};_0x4d8eb5(++_0x3eac0d);}(_0x0c24,0x13b));var _0x40c2=function(_0x57d500,_0xf52c67){_0x57d500=_0x57d500-0x0;var _0x142c14=_0x0c24[_0x57d500];return _0x142c14;};'use strict';function Trunk(_0x4336e9){this['id']=_0x4336e9['id']||0x0;this['active']=_0x4336e9[_0x40c2('0x0')]||![];this[_0x40c2('0x1')]=_0x4336e9['name']||'';this[_0x40c2('0x2')]='unknown';this['stateTime']=0x0;this[_0x40c2('0x3')]=_0x40c2('0x4');this[_0x40c2('0x5')]=_0x4336e9['registry']&&_0x4336e9[_0x40c2('0x5')][_0x40c2('0x6')](':')?_0x4336e9[_0x40c2('0x5')][_0x40c2('0x7')](':')[0x0]:'';this[_0x40c2('0x8')]='';this[_0x40c2('0x9')]='';this['domain']='';this[_0x40c2('0xa')]='';this[_0x40c2('0xb')]='';this[_0x40c2('0xc')]=_0x40c2('0x4');this[_0x40c2('0xd')]='';this[_0x40c2('0xe')]='';}module[_0x40c2('0xf')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 4f5da8a..df4ab79 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 _0x3d87=['recordingFormat','exten'];(function(_0x2a4eab,_0x3b3089){var _0x55af80=function(_0x1d22da){while(--_0x1d22da){_0x2a4eab['push'](_0x2a4eab['shift']());}};_0x55af80(++_0x3b3089);}(_0x3d87,0x191));var _0x73d8=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x3d87[_0x550d12];return _0x12103d;};'use strict';function voiceExtension(_0x4e450a){this['id']=_0x4e450a['id']||0x0;this[_0x73d8('0x0')]=_0x4e450a[_0x73d8('0x0')]||'';this[_0x73d8('0x1')]=_0x4e450a[_0x73d8('0x1')]||'none';this['mandatoryDisposition']=_0x4e450a['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x514b=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x22b70f,_0x4c853f){var _0x100985=function(_0x18628e){while(--_0x18628e){_0x22b70f['push'](_0x22b70f['shift']());}};_0x100985(++_0x4c853f);}(_0x514b,0x66));var _0xb514=function(_0x143fb3,_0x56382f){_0x143fb3=_0x143fb3-0x0;var _0x21ac49=_0x514b[_0x143fb3];return _0x21ac49;};'use strict';function voiceExtension(_0x304e46){this['id']=_0x304e46['id']||0x0;this[_0xb514('0x0')]=_0x304e46['exten']||'';this[_0xb514('0x1')]=_0x304e46[_0xb514('0x1')]||_0xb514('0x2');this[_0xb514('0x3')]=_0x304e46[_0xb514('0x3')]||![];}module[_0xb514('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 1a9258a..951b054 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 _0x325b=['outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumBillable','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay'];(function(_0xc82d1a,_0x145c50){var _0x32fad2=function(_0x232731){while(--_0x232731){_0xc82d1a['push'](_0xc82d1a['shift']());}};_0x32fad2(++_0x145c50);}(_0x325b,0x11f));var _0xb325=function(_0x6040a,_0x22c596){_0x6040a=_0x6040a-0x0;var _0x1fd1cf=_0x325b[_0x6040a];return _0x1fd1cf;};'use strict';var statusDesc=[_0xb325('0x0'),'not_inuse','inuse','busy',_0xb325('0x1'),_0xb325('0x2'),_0xb325('0x3'),_0xb325('0x4'),_0xb325('0x5')];var monitorFormat={'wav':_0xb325('0x6'),'wav49':_0xb325('0x7'),'gsm':_0xb325('0x8')};var strategy={'rrmemory':_0xb325('0x9'),'roundrobin':_0xb325('0xa')};function VoiceQueue(_0x4110b0){this['id']=_0x4110b0['id']||0x0;this[_0xb325('0xb')]=_0x4110b0[_0xb325('0xb')]||'';this[_0xb325('0xc')]=_0x4110b0['monitor_format']||'';this[_0xb325('0xd')]=_0x4110b0[_0xb325('0xd')]||_0xb325('0xe');this[_0xb325('0xf')]=0x0;this[_0xb325('0x10')]=0x0;this[_0xb325('0x11')]=0x0;this[_0xb325('0x12')]=0x0;this[_0xb325('0x13')]=0x0;this['sumHoldTime']=0x0;this[_0xb325('0x14')]=0x0;this['unmanaged']=0x0;this['abandoned']=0x0;this[_0xb325('0x15')]=0x0;this[_0xb325('0x16')]=0x0;this[_0xb325('0x17')]=_0x4110b0[_0xb325('0x17')]||![];this['acwTimeout']=_0x4110b0[_0xb325('0x18')]||0xa;this['autopause']=_0x4110b0[_0xb325('0x19')]||'no';this[_0xb325('0x1a')]=!![];this[_0xb325('0x1b')]='';this[_0xb325('0x1c')]=0x0;this[_0xb325('0x1d')]=0x0;this['dialTimezone']=_0x4110b0['dialTimezone']||null;this['dialGlobalInterval']=_0x4110b0[_0xb325('0x1e')]?_0x4110b0[_0xb325('0x1e')]:null;this[_0xb325('0x1f')]=_0x4110b0[_0xb325('0x1f')];this[_0xb325('0x20')]=_0x4110b0[_0xb325('0x20')]||_0xb325('0x21');this[_0xb325('0x22')]=_0x4110b0['dialLimitChannel']||0x0;this[_0xb325('0x23')]=_0x4110b0[_0xb325('0x23')]||0x0;this[_0xb325('0x24')]=_0x4110b0[_0xb325('0x24')]||0x1;this[_0xb325('0x25')]=_0x4110b0[_0xb325('0x25')]||_0xb325('0x26');this[_0xb325('0x27')]=_0x4110b0[_0xb325('0x27')]||0.03;this[_0xb325('0x28')]=_0x4110b0[_0xb325('0x28')]||0x258;this[_0xb325('0x29')]=_0x4110b0[_0xb325('0x29')]||'anonymous';this[_0xb325('0x2a')]=_0x4110b0[_0xb325('0x2a')]||'anonymous';this[_0xb325('0x2b')]=_0x4110b0['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x4110b0['dialQueueOptions']||_0xb325('0x2c');this[_0xb325('0x2d')]=_0x4110b0[_0xb325('0x2d')]||0x3;this[_0xb325('0x2e')]=_0x4110b0[_0xb325('0x2e')]||undefined;this[_0xb325('0x2f')]=_0x4110b0[_0xb325('0x2f')]||0x3;this['dialCongestionRetryFrequency']=_0x4110b0['dialCongestionRetryFrequency']||0x96;this[_0xb325('0x30')]=_0x4110b0['dialBusyMaxRetry']||0x3;this[_0xb325('0x31')]=_0x4110b0['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x4110b0[_0xb325('0x32')]||0x3;this['dialNoAnswerRetryFrequency']=_0x4110b0[_0xb325('0x33')]||0x96;this[_0xb325('0x34')]=_0x4110b0[_0xb325('0x34')]||0x3;this[_0xb325('0x35')]=_0x4110b0[_0xb325('0x35')]||0x96;this[_0xb325('0x36')]=_0x4110b0[_0xb325('0x36')]||0x3;this[_0xb325('0x37')]=_0x4110b0[_0xb325('0x37')]||0x96;this['dialAbandonedMaxRetry']=_0x4110b0[_0xb325('0x38')]||0x3;this[_0xb325('0x39')]=_0x4110b0['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x4110b0[_0xb325('0x3a')]||0x3;this[_0xb325('0x3b')]=_0x4110b0[_0xb325('0x3b')]||0x96;this['dialAgentRejectMaxRetry']=_0x4110b0[_0xb325('0x3c')]||0x3;this[_0xb325('0x3d')]=_0x4110b0[_0xb325('0x3d')]||0x96;this[_0xb325('0x3e')]=_0x4110b0[_0xb325('0x3e')]||0x4;this[_0xb325('0x3f')]=_0x4110b0[_0xb325('0x3f')]?_0x4110b0['Trunk']:undefined;this[_0xb325('0x40')]=_0x4110b0[_0xb325('0x40')]?_0x4110b0['TrunkBackup']:undefined;this[_0xb325('0x41')]=_0x4110b0[_0xb325('0x41')]||undefined;this['Interval']=_0x4110b0[_0xb325('0x42')]?_0x4110b0['Interval']:undefined;this[_0xb325('0x43')]=_0x4110b0[_0xb325('0x43')]||_0xb325('0x44');this[_0xb325('0x45')]=_0x4110b0[_0xb325('0x45')]||undefined;this[_0xb325('0x46')]=_0x4110b0[_0xb325('0x46')]||undefined;this['strategy']=strategy[_0x4110b0[_0xb325('0x47')]]||'rrmemory';this[_0xb325('0x48')]=!![];this[_0xb325('0x49')]=_0x4110b0['dialAMDActive']||![];this[_0xb325('0x4a')]=_0x4110b0[_0xb325('0x4a')];this['dialAMDGreeting']=_0x4110b0[_0xb325('0x4b')];this[_0xb325('0x4c')]=_0x4110b0['dialAMDAfterGreetingSilence'];this[_0xb325('0x4d')]=_0x4110b0[_0xb325('0x4d')];this['dialAMDMinWordLength']=_0x4110b0['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x4110b0[_0xb325('0x4e')];this[_0xb325('0x4f')]=_0x4110b0['dialAMDMaximumNumberOfWords'];this[_0xb325('0x50')]=_0x4110b0[_0xb325('0x50')];this[_0xb325('0x51')]=_0x4110b0[_0xb325('0x51')];this['outboundRejectCallsDay']=0x0;this[_0xb325('0x52')]=0x0;this[_0xb325('0x53')]=_0x4110b0[_0xb325('0x53')];this[_0xb325('0x54')]=0x0;this[_0xb325('0x55')]=0x0;this[_0xb325('0x56')]=0x0;this[_0xb325('0x57')]=0x0;this[_0xb325('0x58')]=0x0;this[_0xb325('0x59')]=0x0;this[_0xb325('0x5a')]=0x0;this[_0xb325('0x5b')]=0x0;this[_0xb325('0x5c')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xb325('0x5d')]=0x0;this[_0xb325('0x5e')]=0x0;this[_0xb325('0x5f')]=0x0;this[_0xb325('0x60')]=0x0;this[_0xb325('0x61')]=undefined;this['startPredictive']=undefined;this[_0xb325('0x62')]=undefined;this[_0xb325('0x63')]=1.05;this[_0xb325('0x64')]=0x0;this[_0xb325('0x65')]=0x0;this[_0xb325('0x66')]=0x0;this[_0xb325('0x67')]=0x0;this[_0xb325('0x68')]=0x0;this[_0xb325('0x69')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xb325('0x6a')]=0x0;this[_0xb325('0x6b')]=_0x4110b0['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xb325('0x6c')]=_0x4110b0[_0xb325('0x6d')]||0xa;this[_0xb325('0x6e')]=0x0;this[_0xb325('0x6f')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xb325('0x70')]=0x0;this[_0xb325('0x71')]=0x0;this[_0xb325('0x72')]=0x0;this[_0xb325('0x73')]=0x0;this[_0xb325('0x74')]=_0x4110b0[_0xb325('0x74')]||0x1e;this['dialRecallInQueue']=_0x4110b0[_0xb325('0x75')]||![];this[_0xb325('0x76')]=_0x4110b0['dialQueueProject2']||undefined;this[_0xb325('0x77')]=_0x4110b0['dialAgiAfterHangupClient']||![];this[_0xb325('0x78')]=_0x4110b0[_0xb325('0x78')]||![];this[_0xb325('0xc')]=monitorFormat[_0x4110b0[_0xb325('0xc')]]?monitorFormat[_0x4110b0[_0xb325('0xc')]]:undefined;this[_0xb325('0x79')]=_0x4110b0[_0xb325('0x79')]||![];this['mandatoryDispositionPause']=_0x4110b0[_0xb325('0x7a')]?_0x4110b0['mandatoryDispositionPause']:undefined;}module[_0xb325('0x7b')]=VoiceQueue; \ No newline at end of file +var _0x9bf6=['unavailable','ringing','ringinuse','onhold','wav','wav49','rrmemory','name','monitor_format','type','talking','sumHoldTime','unmanaged','abandoned','loggedIn','available','acwTimeout','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','erlangCalls','erlangCallToSecond','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','unknown','not_inuse','inuse','busy','invalid'];(function(_0x3e3ef8,_0x5679e5){var _0x3d0d69=function(_0x570028){while(--_0x570028){_0x3e3ef8['push'](_0x3e3ef8['shift']());}};_0x3d0d69(++_0x5679e5);}(_0x9bf6,0x1b7));var _0x69bf=function(_0x51932f,_0x5c63dc){_0x51932f=_0x51932f-0x0;var _0x1f94ab=_0x9bf6[_0x51932f];return _0x1f94ab;};'use strict';var statusDesc=[_0x69bf('0x0'),_0x69bf('0x1'),_0x69bf('0x2'),_0x69bf('0x3'),_0x69bf('0x4'),_0x69bf('0x5'),_0x69bf('0x6'),_0x69bf('0x7'),_0x69bf('0x8')];var monitorFormat={'wav':_0x69bf('0x9'),'wav49':_0x69bf('0xa'),'gsm':'gsm'};var strategy={'rrmemory':_0x69bf('0xb'),'roundrobin':'roundrobin'};function VoiceQueue(_0x2d7c25){this['id']=_0x2d7c25['id']||0x0;this[_0x69bf('0xc')]=_0x2d7c25['name']||'';this['monitor_format']=_0x2d7c25[_0x69bf('0xd')]||'';this[_0x69bf('0xe')]=_0x2d7c25[_0x69bf('0xe')]||'inbound';this['waiting']=0x0;this[_0x69bf('0xf')]=0x0;this['total']=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0x69bf('0x10')]=0x0;this['sumBillable']=0x0;this[_0x69bf('0x11')]=0x0;this[_0x69bf('0x12')]=0x0;this[_0x69bf('0x13')]=0x0;this[_0x69bf('0x14')]=0x0;this['acw']=_0x2d7c25['acw']||![];this[_0x69bf('0x15')]=_0x2d7c25[_0x69bf('0x15')]||0xa;this['autopause']=_0x2d7c25['autopause']||'no';this[_0x69bf('0x16')]=!![];this['message']='';this[_0x69bf('0x17')]=0x0;this[_0x69bf('0x18')]=0x0;this['dialTimezone']=_0x2d7c25[_0x69bf('0x19')]||null;this['dialGlobalInterval']=_0x2d7c25[_0x69bf('0x1a')]?_0x2d7c25[_0x69bf('0x1a')]:null;this['dialActive']=_0x2d7c25[_0x69bf('0x1b')];this[_0x69bf('0x1c')]=_0x2d7c25['dialMethod']||_0x69bf('0x1d');this[_0x69bf('0x1e')]=_0x2d7c25['dialLimitChannel']||0x0;this[_0x69bf('0x1f')]=_0x2d7c25[_0x69bf('0x1f')]||0x0;this[_0x69bf('0x20')]=_0x2d7c25[_0x69bf('0x20')]||0x1;this[_0x69bf('0x21')]=_0x2d7c25[_0x69bf('0x21')]||'dropRate';this[_0x69bf('0x22')]=_0x2d7c25[_0x69bf('0x22')]||0.03;this[_0x69bf('0x23')]=_0x2d7c25['dialPredictiveInterval']||0x258;this[_0x69bf('0x24')]=_0x2d7c25[_0x69bf('0x24')]||_0x69bf('0x25');this[_0x69bf('0x26')]=_0x2d7c25['dialOriginateCallerIdNumber']||_0x69bf('0x25');this[_0x69bf('0x27')]=_0x2d7c25[_0x69bf('0x27')]||0x1e;this[_0x69bf('0x28')]=_0x2d7c25[_0x69bf('0x28')]||_0x69bf('0x29');this['dialQueueTimeout']=_0x2d7c25[_0x69bf('0x2a')]||0x3;this[_0x69bf('0x2b')]=_0x2d7c25[_0x69bf('0x2b')]||undefined;this[_0x69bf('0x2c')]=_0x2d7c25[_0x69bf('0x2c')]||0x3;this[_0x69bf('0x2d')]=_0x2d7c25['dialCongestionRetryFrequency']||0x96;this[_0x69bf('0x2e')]=_0x2d7c25[_0x69bf('0x2e')]||0x3;this[_0x69bf('0x2f')]=_0x2d7c25[_0x69bf('0x2f')]||0x96;this[_0x69bf('0x30')]=_0x2d7c25[_0x69bf('0x30')]||0x3;this[_0x69bf('0x31')]=_0x2d7c25['dialNoAnswerRetryFrequency']||0x96;this[_0x69bf('0x32')]=_0x2d7c25[_0x69bf('0x32')]||0x3;this[_0x69bf('0x33')]=_0x2d7c25[_0x69bf('0x33')]||0x96;this['dialDropMaxRetry']=_0x2d7c25['dialDropMaxRetry']||0x3;this[_0x69bf('0x34')]=_0x2d7c25[_0x69bf('0x34')]||0x96;this[_0x69bf('0x35')]=_0x2d7c25[_0x69bf('0x35')]||0x3;this['dialAbandonedRetryFrequency']=_0x2d7c25[_0x69bf('0x36')]||0x96;this[_0x69bf('0x37')]=_0x2d7c25[_0x69bf('0x37')]||0x3;this['dialMachineRetryFrequency']=_0x2d7c25[_0x69bf('0x38')]||0x96;this[_0x69bf('0x39')]=_0x2d7c25[_0x69bf('0x39')]||0x3;this[_0x69bf('0x3a')]=_0x2d7c25[_0x69bf('0x3a')]||0x96;this[_0x69bf('0x3b')]=_0x2d7c25[_0x69bf('0x3b')]||0x4;this['Trunk']=_0x2d7c25[_0x69bf('0x3c')]?_0x2d7c25[_0x69bf('0x3c')]:undefined;this[_0x69bf('0x3d')]=_0x2d7c25[_0x69bf('0x3d')]?_0x2d7c25['TrunkBackup']:undefined;this[_0x69bf('0x3e')]=_0x2d7c25['dialPrefix']||undefined;this[_0x69bf('0x3f')]=_0x2d7c25['Interval']?_0x2d7c25[_0x69bf('0x3f')]:undefined;this[_0x69bf('0x40')]=_0x2d7c25[_0x69bf('0x40')]||_0x69bf('0x41');this['dialRandomLastDigitCallerIdNumber']=_0x2d7c25[_0x69bf('0x42')]||undefined;this[_0x69bf('0x43')]=_0x2d7c25['dialCutDigit']||undefined;this[_0x69bf('0x44')]=strategy[_0x2d7c25[_0x69bf('0x44')]]||_0x69bf('0xb');this[_0x69bf('0x45')]=!![];this['dialAMDActive']=_0x2d7c25['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x2d7c25[_0x69bf('0x46')];this[_0x69bf('0x47')]=_0x2d7c25[_0x69bf('0x47')];this[_0x69bf('0x48')]=_0x2d7c25[_0x69bf('0x48')];this['dialAMDTotalAnalysisTime']=_0x2d7c25['dialAMDTotalAnalysisTime'];this[_0x69bf('0x49')]=_0x2d7c25[_0x69bf('0x49')];this['dialAMDBetweenWordsSilence']=_0x2d7c25['dialAMDBetweenWordsSilence'];this[_0x69bf('0x4a')]=_0x2d7c25[_0x69bf('0x4a')];this[_0x69bf('0x4b')]=_0x2d7c25[_0x69bf('0x4b')];this[_0x69bf('0x4c')]=_0x2d7c25[_0x69bf('0x4c')];this[_0x69bf('0x4d')]=0x0;this['pTalking']=0x0;this[_0x69bf('0x4e')]=_0x2d7c25[_0x69bf('0x4e')];this[_0x69bf('0x4f')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x69bf('0x50')]=0x0;this[_0x69bf('0x51')]=0x0;this[_0x69bf('0x52')]=0x0;this[_0x69bf('0x53')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x69bf('0x54')]=0x0;this[_0x69bf('0x55')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x69bf('0x56')]=0x0;this[_0x69bf('0x57')]=0x0;this[_0x69bf('0x58')]=0x0;this[_0x69bf('0x59')]=undefined;this[_0x69bf('0x5a')]=undefined;this[_0x69bf('0x5b')]=undefined;this[_0x69bf('0x5c')]=1.05;this[_0x69bf('0x5d')]=0x0;this[_0x69bf('0x5e')]=0x0;this[_0x69bf('0x5f')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x69bf('0x60')]=0x0;this[_0x69bf('0x61')]=0x0;this[_0x69bf('0x62')]=0x0;this[_0x69bf('0x63')]=_0x2d7c25[_0x69bf('0x64')]||0x14;this[_0x69bf('0x65')]=_0x2d7c25[_0x69bf('0x64')]||0xa;this[_0x69bf('0x66')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x69bf('0x67')]=0x0;this[_0x69bf('0x68')]=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this[_0x69bf('0x69')]=_0x2d7c25[_0x69bf('0x69')]||0x1e;this[_0x69bf('0x6a')]=_0x2d7c25['dialRecallInQueue']||![];this[_0x69bf('0x6b')]=_0x2d7c25[_0x69bf('0x6b')]||undefined;this[_0x69bf('0x6c')]=_0x2d7c25['dialAgiAfterHangupClient']||![];this[_0x69bf('0x6d')]=_0x2d7c25[_0x69bf('0x6d')]||![];this['monitor_format']=monitorFormat[_0x2d7c25[_0x69bf('0xd')]]?monitorFormat[_0x2d7c25[_0x69bf('0xd')]]:undefined;this['mandatoryDisposition']=_0x2d7c25['mandatoryDisposition']||![];this[_0x69bf('0x6e')]=_0x2d7c25[_0x69bf('0x6e')]?_0x2d7c25['mandatoryDispositionPause']:undefined;}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 8303023..9388e39 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 _0x02be=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x14a513,_0x3239f){var _0x47236c=function(_0x394191){while(--_0x394191){_0x14a513['push'](_0x14a513['shift']());}};_0x47236c(++_0x3239f);}(_0x02be,0xfe));var _0xe02b=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x02be[_0x2d7f0e];return _0x110b07;};'use strict';function VtigerAccount(_0x15abad){this['id']=_0x15abad['id']||0x0;this[_0xe02b('0x0')]=_0x15abad[_0xe02b('0x0')]||'';this['username']=_0x15abad[_0xe02b('0x1')]||'';this['accessKey']=_0x15abad[_0xe02b('0x2')]||'';this[_0xe02b('0x3')]=_0x15abad['remoteUri']||'';this[_0xe02b('0x4')]=_0x15abad[_0xe02b('0x4')]||'';this['Configurations']=_0x15abad[_0xe02b('0x5')]||{};}module[_0xe02b('0x6')]=VtigerAccount; \ No newline at end of file +var _0x09e7=['Configurations','exports','name','username','accessKey','remoteUri','serverUrl'];(function(_0x3f1e7a,_0x3628a0){var _0x10f486=function(_0x3be63d){while(--_0x3be63d){_0x3f1e7a['push'](_0x3f1e7a['shift']());}};_0x10f486(++_0x3628a0);}(_0x09e7,0x159));var _0x709e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x09e7[_0x92c450];return _0x2a9599;};'use strict';function VtigerAccount(_0x31c391){this['id']=_0x31c391['id']||0x0;this[_0x709e('0x0')]=_0x31c391[_0x709e('0x0')]||'';this[_0x709e('0x1')]=_0x31c391[_0x709e('0x1')]||'';this[_0x709e('0x2')]=_0x31c391[_0x709e('0x2')]||'';this[_0x709e('0x3')]=_0x31c391[_0x709e('0x3')]||'';this[_0x709e('0x4')]=_0x31c391[_0x709e('0x4')]||'';this[_0x709e('0x5')]=_0x31c391[_0x709e('0x5')]||{};}module[_0x709e('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 da49cf5..d2b91ac 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 _0x0b0e=['exports','name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0x0b0e,0x187));var _0xe0b0=function(_0x249565,_0x2a026a){_0x249565=_0x249565-0x0;var _0x43dee8=_0x0b0e[_0x249565];return _0x43dee8;};'use strict';function ZendeskAccount(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['username']=_0x29cd1e[_0xe0b0('0x1')]||'';this[_0xe0b0('0x2')]=_0x29cd1e[_0xe0b0('0x2')]||'';this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||'';this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||'';this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||'';this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||'integrationTab';this['serverUrl']=_0x29cd1e[_0xe0b0('0x7')]||'';this[_0xe0b0('0x8')]=_0x29cd1e[_0xe0b0('0x8')]||{};}module[_0xe0b0('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x5f2f=['authType','type','integrationTab','serverUrl','Configurations','name','username','password','token','remoteUri'];(function(_0xc89183,_0x17cd9e){var _0x155657=function(_0x32c052){while(--_0x32c052){_0xc89183['push'](_0xc89183['shift']());}};_0x155657(++_0x17cd9e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x12efc5,_0x49d4c4){_0x12efc5=_0x12efc5-0x0;var _0xf2ad40=_0x5f2f[_0x12efc5];return _0xf2ad40;};'use strict';function ZendeskAccount(_0x7c86d8){this['id']=_0x7c86d8['id']||0x0;this[_0xf5f2('0x0')]=_0x7c86d8[_0xf5f2('0x0')]||'';this[_0xf5f2('0x1')]=_0x7c86d8[_0xf5f2('0x1')]||'';this[_0xf5f2('0x2')]=_0x7c86d8[_0xf5f2('0x2')]||'';this[_0xf5f2('0x3')]=_0x7c86d8['token']||'';this['remoteUri']=_0x7c86d8[_0xf5f2('0x4')]||'';this[_0xf5f2('0x5')]=_0x7c86d8[_0xf5f2('0x5')]||'';this[_0xf5f2('0x6')]=_0x7c86d8[_0xf5f2('0x6')]||_0xf5f2('0x7');this['serverUrl']=_0x7c86d8[_0xf5f2('0x8')]||'';this[_0xf5f2('0x9')]=_0x7c86d8[_0xf5f2('0x9')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index a138a1e..18cc45c 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 _0xbbbc=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host','zone'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x2ba5b7,_0x5d9343){_0x2ba5b7=_0x2ba5b7-0x0;var _0x1f334e=_0xbbbc[_0x2ba5b7];return _0x1f334e;};'use strict';function ZohoAccount(_0x372caa){this['id']=_0x372caa['id']||0x0;this[_0xcbbb('0x0')]=_0x372caa[_0xcbbb('0x0')]||'';this[_0xcbbb('0x1')]=_0x372caa[_0xcbbb('0x1')]||'';this[_0xcbbb('0x2')]=_0x372caa[_0xcbbb('0x2')]||'';this['zone']=_0x372caa[_0xcbbb('0x3')]||'';this[_0xcbbb('0x4')]=_0x372caa[_0xcbbb('0x4')]||'';this[_0xcbbb('0x5')]=_0x372caa[_0xcbbb('0x5')]||'';this['serverUrl']=_0x372caa[_0xcbbb('0x6')]||'';this[_0xcbbb('0x7')]=_0x372caa[_0xcbbb('0x7')]||'';this[_0xcbbb('0x8')]=_0x372caa[_0xcbbb('0x8')]||'';this[_0xcbbb('0x9')]=_0x372caa[_0xcbbb('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x6c00=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x4cc7f4,_0x3580a6){var _0x5ed8db=function(_0x3ade6){while(--_0x3ade6){_0x4cc7f4['push'](_0x4cc7f4['shift']());}};_0x5ed8db(++_0x3580a6);}(_0x6c00,0x1a9));var _0x06c0=function(_0x3005d5,_0xf588c7){_0x3005d5=_0x3005d5-0x0;var _0x547c7e=_0x6c00[_0x3005d5];return _0x547c7e;};'use strict';function ZohoAccount(_0x554b5d){this['id']=_0x554b5d['id']||0x0;this[_0x06c0('0x0')]=_0x554b5d[_0x06c0('0x0')]||'';this['description']=_0x554b5d[_0x06c0('0x1')]||'';this[_0x06c0('0x2')]=_0x554b5d[_0x06c0('0x2')]||'';this[_0x06c0('0x3')]=_0x554b5d['zone']||'';this[_0x06c0('0x4')]=_0x554b5d[_0x06c0('0x4')]||'';this[_0x06c0('0x5')]=_0x554b5d[_0x06c0('0x5')]||'';this[_0x06c0('0x6')]=_0x554b5d['serverUrl']||'';this['code']=_0x554b5d[_0x06c0('0x7')]||'';this[_0x06c0('0x8')]=_0x554b5d['refreshToken']||'';this[_0x06c0('0x9')]=_0x554b5d[_0x06c0('0x9')]||{};}module[_0x06c0('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 e225098..1cd8124 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 _0x2de9=['countnosuchnumberretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','channelAgent','format','SIP/%s','phone','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry'];(function(_0x1b7d4c,_0x3ef822){var _0xaf9bc6=function(_0xb3ea5d){while(--_0xb3ea5d){_0x1b7d4c['push'](_0x1b7d4c['shift']());}};_0xaf9bc6(++_0x3ef822);}(_0x2de9,0x1c7));var _0x92de=function(_0x22eb92,_0x4740d0){_0x22eb92=_0x22eb92-0x0;var _0x5917e7=_0x2de9[_0x22eb92];return _0x5917e7;};'use strict';var util=require('util');var _=require(_0x92de('0x0'));var moment=require(_0x92de('0x1'));function checkNameSurname(_0x1ca732,_0x162738,_0x3017f9){var _0x2c9326='';if(!_['isNil'](_0x162738)&&'string'===typeof _0x162738){_0x2c9326+=_0x162738;}if(!_[_0x92de('0x2')](_0x3017f9)&&_0x92de('0x3')===typeof _0x3017f9){_0x2c9326+='\x20'+_0x3017f9;}if(_0x2c9326!==''){return _0x2c9326;}return _0x1ca732;}function Action(_0x3be062,_0x2b3a2a,_0x2b5606,_0x5c81ca,_0x132382){this[_0x92de('0x4')]=_0x2b5606||undefined;this[_0x92de('0x5')]=_0x3be062['id'];this[_0x92de('0x6')]=_0x2b3a2a[_0x92de('0x7')];this[_0x92de('0x8')]=_0x2b3a2a[_0x92de('0x8')];this[_0x92de('0x9')]=_0x92de('0x6');this['dialAnswer']=![];this[_0x92de('0xa')]=_[_0x92de('0x2')](_0x3be062[_0x92de('0xb')])?undefined:_0x3be062[_0x92de('0xb')]['name'];this[_0x92de('0xc')]=this[_0x92de('0xa')]?util[_0x92de('0xd')](_0x92de('0xe'),this[_0x92de('0xa')]):_0x5c81ca||undefined;this['calleridname']=checkNameSurname(_0x3be062['Contact'][_0x92de('0xf')],_0x3be062[_0x92de('0x10')][_0x92de('0x11')],_0x3be062[_0x92de('0x10')][_0x92de('0x12')]);this[_0x92de('0x13')]=_0x3be062[_0x92de('0x13')]||![];this[_0x92de('0x14')]=_0x3be062[_0x92de('0x10')][_0x92de('0xf')];this[_0x92de('0x15')]=_0x3be062[_0x92de('0x15')];this['countbusyretry']=_0x3be062[_0x92de('0x16')]||0x0;this[_0x92de('0x17')]=_0x3be062[_0x92de('0x17')]||0x0;this['countnoanswerretry']=_0x3be062[_0x92de('0x18')]||0x0;this[_0x92de('0x19')]=(_0x3be062[_0x92de('0x16')]||0x0)+(_0x3be062[_0x92de('0x17')]||0x0)+(_0x3be062['countnoanswerretry']||0x0)+(_0x3be062['countnosuchnumberretry']||0x0)+(_0x3be062[_0x92de('0x1a')]||0x0)+(_0x3be062['countabandonedretry']||0x0)+(_0x3be062[_0x92de('0x1b')]||0x0)+(_0x3be062[_0x92de('0x1c')]||0x0);this[_0x92de('0x1d')]=_0x3be062[_0x92de('0x1d')]||0x0;this['countdropretry']=_0x3be062['countdropretry']||0x0;this[_0x92de('0x1e')]=_0x3be062['countabandonedretry']||0x0;this[_0x92de('0x1b')]=_0x3be062['countmachineretry']||0x0;this[_0x92de('0x1c')]=_0x3be062[_0x92de('0x1c')]||0x0;this[_0x92de('0x1f')]=_0x3be062[_0x92de('0x1f')];this[_0x92de('0x20')]=_0x3be062[_0x92de('0x20')];this['callbackat']=_0x3be062[_0x92de('0x21')];this[_0x92de('0x22')]=_0x3be062[_0x92de('0x22')];this[_0x92de('0x23')]=_0x3be062['ContactId'];this[_0x92de('0x24')]=_0x3be062[_0x92de('0x24')];this[_0x92de('0x25')]=_['isNil'](_0x3be062[_0x92de('0xb')])?_0x3be062['UserId']:_0x3be062[_0x92de('0xb')]['id'];this[_0x92de('0x26')]=_0x3be062[_0x92de('0x26')];this[_0x92de('0x27')]='';this['originatecalleridname']='';}Action[_0x92de('0x28')][_0x92de('0x29')]=function(){return util[_0x92de('0xd')](_0x92de('0x2a'),this[_0x92de('0x2b')],this['number']);};module['exports']=Action; \ No newline at end of file +var _0x00da=['callbackuniqueid','callbackat','recallme','ListId','UserId','originatecalleridnum','originatecalleridname','prototype','getCaller','format','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','name','type','campaigntype','queue','membername','Agent','channelAgent','SIP/%s','calleridname','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback'];(function(_0x46f494,_0x5fdef1){var _0x51368d=function(_0x13fc7c){while(--_0x13fc7c){_0x46f494['push'](_0x46f494['shift']());}};_0x51368d(++_0x5fdef1);}(_0x00da,0xc0));var _0xa00d=function(_0x8053d4,_0x50058a){_0x8053d4=_0x8053d4-0x0;var _0x285b64=_0x00da[_0x8053d4];return _0x285b64;};'use strict';var util=require(_0xa00d('0x0'));var _=require(_0xa00d('0x1'));var moment=require(_0xa00d('0x2'));function checkNameSurname(_0x3c46e2,_0x1fd937,_0x3b91a0){var _0x495343='';if(!_[_0xa00d('0x3')](_0x1fd937)&&_0xa00d('0x4')===typeof _0x1fd937){_0x495343+=_0x1fd937;}if(!_[_0xa00d('0x3')](_0x3b91a0)&&_0xa00d('0x4')===typeof _0x3b91a0){_0x495343+='\x20'+_0x3b91a0;}if(_0x495343!==''){return _0x495343;}return _0x3c46e2;}function Action(_0x119bee,_0xeee273,_0x29425a,_0x241a14,_0x2e1878){this[_0xa00d('0x5')]=_0x29425a||undefined;this[_0xa00d('0x6')]=_0x119bee['id'];this['queue']=_0xeee273[_0xa00d('0x7')];this['type']=_0xeee273[_0xa00d('0x8')];this[_0xa00d('0x9')]=_0xa00d('0xa');this['dialAnswer']=![];this[_0xa00d('0xb')]=_[_0xa00d('0x3')](_0x119bee[_0xa00d('0xc')])?undefined:_0x119bee[_0xa00d('0xc')]['name'];this[_0xa00d('0xd')]=this['membername']?util['format'](_0xa00d('0xe'),this[_0xa00d('0xb')]):_0x241a14||undefined;this[_0xa00d('0xf')]=checkNameSurname(_0x119bee[_0xa00d('0x10')]['phone'],_0x119bee['Contact'][_0xa00d('0x11')],_0x119bee[_0xa00d('0x10')][_0xa00d('0x12')]);this[_0xa00d('0x13')]=_0x119bee[_0xa00d('0x13')]||![];this[_0xa00d('0x14')]=_0x119bee[_0xa00d('0x10')][_0xa00d('0x15')];this[_0xa00d('0x16')]=_0x119bee[_0xa00d('0x16')];this[_0xa00d('0x17')]=_0x119bee[_0xa00d('0x17')]||0x0;this[_0xa00d('0x18')]=_0x119bee[_0xa00d('0x18')]||0x0;this[_0xa00d('0x19')]=_0x119bee[_0xa00d('0x19')]||0x0;this[_0xa00d('0x1a')]=(_0x119bee[_0xa00d('0x17')]||0x0)+(_0x119bee['countcongestionretry']||0x0)+(_0x119bee[_0xa00d('0x19')]||0x0)+(_0x119bee['countnosuchnumberretry']||0x0)+(_0x119bee[_0xa00d('0x1b')]||0x0)+(_0x119bee[_0xa00d('0x1c')]||0x0)+(_0x119bee[_0xa00d('0x1d')]||0x0)+(_0x119bee[_0xa00d('0x1e')]||0x0);this['countnosuchnumberretry']=_0x119bee[_0xa00d('0x1f')]||0x0;this[_0xa00d('0x1b')]=_0x119bee[_0xa00d('0x1b')]||0x0;this[_0xa00d('0x1c')]=_0x119bee[_0xa00d('0x1c')]||0x0;this[_0xa00d('0x1d')]=_0x119bee[_0xa00d('0x1d')]||0x0;this['countagentrejectretry']=_0x119bee[_0xa00d('0x1e')]||0x0;this[_0xa00d('0x20')]=_0x119bee[_0xa00d('0x20')];this['callbackuniqueid']=_0x119bee[_0xa00d('0x21')];this[_0xa00d('0x22')]=_0x119bee[_0xa00d('0x22')];this[_0xa00d('0x23')]=_0x119bee['recallme'];this['ContactId']=_0x119bee['ContactId'];this[_0xa00d('0x24')]=_0x119bee[_0xa00d('0x24')];this[_0xa00d('0x25')]=_[_0xa00d('0x3')](_0x119bee['Agent'])?_0x119bee[_0xa00d('0x25')]:_0x119bee['Agent']['id'];this['VoiceQueueId']=_0x119bee['VoiceQueueId'];this[_0xa00d('0x26')]='';this[_0xa00d('0x27')]='';}Action[_0xa00d('0x28')][_0xa00d('0x29')]=function(){return util[_0xa00d('0x2a')]('\x22%s\x22\x20<%s>',this[_0xa00d('0xf')],this[_0xa00d('0x2b')]);};module[_0xa00d('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 522b898..3db3f00 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 _0xd48e=['dialBusyMaxRetry','scheduledAt','unlockAgent','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','dialGlobalMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','[callProgressDetectingCustomer][logCongestion]','dialBusyRetryFrequency','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','active','SIP/%s','reachable','unmonitored','run','execRun','unlock','disableContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','phone','substring','dialCutDigit','SIP/%s/%s%s','trim','getCallerId','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','actionid','logLookAgent','clone','responsetime','isFailure','unlockContact','custom:agentringnoanswer','rejected','[syncHangup][talking]','[syncHangup][talking][cause]','cause','statedesc','dialQueueProject','channelstate','transfer','destlinkedid','syncHangupRequest','addVariable','variables','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','exports','lodash','bluebird','uuid','moment','md5','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./util/util','redis','socket.io-emitter','prototype','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','syncHangup','hanguprequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','outbound','name','strategy','answered','available','pTalking','sumDuration','sumHoldTime','talking','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_presence:remove','sendMessageOneNotActive','originated','paused','message','NOT_ACTIVE','logger','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','type','clearZombieChannels','setMessage','recallMe','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','getContactRecallMe','isNil','getDiff','scheduledat','Agent','voicePause','then','logger2','[RecallMe]','catch','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','cloneAction','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','countnosuchnumberretry','activeContact','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','[syncHangup][talking][decrement]','linkedid','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','Global'];(function(_0x516a57,_0xcdc773){var _0x597896=function(_0x240636){while(--_0x240636){_0x516a57['push'](_0x516a57['shift']());}};_0x597896(++_0xcdc773);}(_0xd48e,0x93));var _0xed48=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xd48e[_0x2064e5];return _0x21a233;};'use strict';var util=require('util');var _=require(_0xed48('0x0'));var BPromise=require(_0xed48('0x1'));var uuid=require(_0xed48('0x2'));var moment=require(_0xed48('0x3'));var md5=require(_0xed48('0x4'));var Redis=require('ioredis');var config=require(_0xed48('0x5'));var logger=require(_0xed48('0x6'))(_0xed48('0x7'));var loggerAction=require('../../../config/logger')(_0xed48('0x8'));var ami=require(_0xed48('0x9'));var rpcDb=require(_0xed48('0xa'));var Action=require('./action');var ut=require(_0xed48('0xb'));config[_0xed48('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xed48('0xd'))(new Redis(config[_0xed48('0xc')]));var Sequence=function(){};Sequence[_0xed48('0xe')]['enqueue']=function(_0x4864aa){this[_0xed48('0xf')]=this[_0xed48('0xf')]?this[_0xed48('0xf')]['finally'](_0x4864aa):_0x4864aa();};function Preview(_0x23b0fb){this[_0xed48('0x10')]=new Sequence();this[_0xed48('0x11')]=_0x23b0fb[_0xed48('0x12')];this[_0xed48('0x13')]=_0x23b0fb[_0xed48('0x13')];this[_0xed48('0x14')]={};this[_0xed48('0x15')]=_0x23b0fb[_0xed48('0x15')];this[_0xed48('0x16')]=0x0;ami['on'](_0xed48('0x17'),this[_0xed48('0x18')][_0xed48('0x19')](this));ami['on']('hangup',this[_0xed48('0x1a')]['bind'](this));ami['on'](_0xed48('0x1b'),this['syncHangupRequest']['bind'](this));ami['on'](_0xed48('0x1c'),this[_0xed48('0x1d')][_0xed48('0x19')](this));ami['on'](_0xed48('0x1e'),this[_0xed48('0x1f')]['bind'](this));ami['on'](_0xed48('0x20'),this['syncVarSet'][_0xed48('0x19')](this));ami['on']('attendedtransfer',this[_0xed48('0x21')][_0xed48('0x19')](this));ami['on'](_0xed48('0x22'),this['syncBlindTransfer']['bind'](this));this[_0xed48('0x23')](this[_0xed48('0x11')]);}function emit(_0x225d0f,_0x54288f,_0x216906){io['to'](_0x225d0f)[_0xed48('0x24')](_0x54288f,_0x216906);}function emitCampaignPreview(_0x19d897){if(_0x19d897['type']===_0xed48('0x25')){var _0x1bda45={'id':_0x19d897['id'],'name':_0x19d897[_0xed48('0x26')],'strategy':_0x19d897[_0xed48('0x27')],'answered':_0x19d897[_0xed48('0x28')],'available':_0x19d897[_0xed48('0x29')],'loggedIn':_0x19d897['loggedIn'],'pTalking':_0x19d897[_0xed48('0x2a')],'sumBillable':_0x19d897['sumBillable'],'sumDuration':_0x19d897[_0xed48('0x2b')],'sumHoldTime':_0x19d897[_0xed48('0x2c')]||0x0,'talking':_0x19d897[_0xed48('0x2d')],'total':_0x19d897['total'],'type':_0x19d897['type'],'unmanaged':_0x19d897[_0xed48('0x2e')],'abandoned':_0x19d897[_0xed48('0x2f')],'waiting':_0x19d897[_0xed48('0x30')],'loggedInDb':_0x19d897[_0xed48('0x31')],'dialActive':_0x19d897[_0xed48('0x32')],'dialMethod':_0x19d897[_0xed48('0x33')],'dialOriginateCallerIdName':_0x19d897[_0xed48('0x34')],'dialOriginateCallerIdNumber':_0x19d897['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x19d897[_0xed48('0x35')],'dialPrefix':_0x19d897[_0xed48('0x36')],'outboundAnswerAgiCallsDay':_0x19d897[_0xed48('0x37')],'outboundAnswerCallsDay':_0x19d897['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x19d897[_0xed48('0x38')],'outboundBusyCallsDay':_0x19d897[_0xed48('0x39')],'outboundCongestionCallsDay':_0x19d897['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x19d897[_0xed48('0x3a')],'outboundDropCallsDayCallersExit':_0x19d897['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x19d897['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x19d897[_0xed48('0x3b')],'outboundNoSuchCallsDay':_0x19d897['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x19d897['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x19d897[_0xed48('0x3c')],'outboundRejectCallsDay':_0x19d897[_0xed48('0x3d')],'outboundUnknownCallsDay':_0x19d897[_0xed48('0x3e')],'outboundAbandonedCallsDay':_0x19d897['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x19d897[_0xed48('0x3f')],'predictiveIntervalAvgHoldtime':_0x19d897[_0xed48('0x40')],'predictiveIntervalAvgTalktime':_0x19d897[_0xed48('0x41')],'predictiveIntervalDroppedCallsCallersExit':_0x19d897[_0xed48('0x42')],'predictiveIntervalDroppedCallsTimeout':_0x19d897['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x19d897['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x19d897[_0xed48('0x43')],'predictiveIntervalHitRate':_0x19d897['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x19d897[_0xed48('0x44')],'predictiveIntervalPauses':_0x19d897[_0xed48('0x45')],'predictiveIntervalAvailable':_0x19d897[_0xed48('0x46')],'predictiveIntervalTotalCalls':_0x19d897[_0xed48('0x47')],'message':_0x19d897['message'],'originated':_0x19d897['originated'],'erlangCalls':_0x19d897[_0xed48('0x48')],'erlangCallToSecond':_0x19d897[_0xed48('0x49')],'erlangAbandonmentRate':_0x19d897[_0xed48('0x4a')],'erlangBusyFactor':_0x19d897[_0xed48('0x4b')],'startPredictive':_0x19d897[_0xed48('0x4c')],'startProgressive':_0x19d897[_0xed48('0x4d')]};if(_0x19d897[_0xed48('0x4e')]){_0x1bda45[_0xed48('0x4e')]={'id':_0x19d897[_0xed48('0x4e')]['id'],'name':_0x19d897[_0xed48('0x4e')][_0xed48('0x26')],'active':_0x19d897[_0xed48('0x4e')]['active'],'callerid':_0x19d897[_0xed48('0x4e')][_0xed48('0x4f')]};}if(_0x19d897[_0xed48('0x50')]){_0x1bda45[_0xed48('0x50')]={'id':_0x19d897[_0xed48('0x50')]['id'],'name':_0x19d897[_0xed48('0x50')][_0xed48('0x26')]};}var _0x170936=md5(JSON[_0xed48('0x51')](_0x1bda45));if(_0x19d897[_0xed48('0x4')]!==_0x170936){_0x19d897['md5']=_0x170936;emit(util[_0xed48('0x52')](_0xed48('0x53'),_0x1bda45[_0xed48('0x26')]),_0xed48('0x54'),_0x1bda45);}}}function emitVoiceQueueChannelRemove(_0x5426c4){logger[_0xed48('0x55')](_0xed48('0x56'),JSON['stringify'](_0x5426c4));emit(util[_0xed48('0x52')](_0xed48('0x53'),_0x5426c4[_0xed48('0x26')]),'voice_queue_channel:remove',_0x5426c4);this['emit'](_0xed48('0x57'),_0x5426c4);}function notSendMessagesQueue(_0x47e3ed){if(_0x47e3ed[_0xed48('0x58')]){if(_0x47e3ed[_0xed48('0x59')]===0x0&&_0x47e3ed[_0xed48('0x2a')]===0x0){_0x47e3ed[_0xed48('0x58')]=![];_0x47e3ed[_0xed48('0x29')]=0x0;_0x47e3ed[_0xed48('0x5a')]=0x0;_0x47e3ed[_0xed48('0x5b')]=_0xed48('0x5c');ut[_0xed48('0x5d')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x47e3ed[_0xed48('0x26')]+_0xed48('0x5e'));}else{_0x47e3ed[_0xed48('0x5b')]=_0xed48('0x5f');ut[_0xed48('0x5d')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x47e3ed[_0xed48('0x26')]+_0xed48('0x60'));}emitCampaignPreview(_0x47e3ed);}}Preview[_0xed48('0xe')][_0xed48('0x23')]=function(){var _0x1a3c55=this;setInterval(function(){_0x1a3c55[_0xed48('0x61')]();},0x7cf);};Preview[_0xed48('0xe')][_0xed48('0x61')]=function(){var _0x1d4d1d=this[_0xed48('0x11')];this[_0xed48('0x16')]+=0x1;for(var _0x3f7239 in _0x1d4d1d){if(_0x1d4d1d[_0xed48('0x62')](_0x3f7239)&&(_0x1d4d1d[_0x3f7239][_0xed48('0x33')]===_0xed48('0x7')||_0x1d4d1d[_0x3f7239][_0xed48('0x33')]===_0xed48('0x63'))&&_0x1d4d1d[_0x3f7239][_0xed48('0x64')]==='outbound'){if(this[_0xed48('0x16')]>0x7){this[_0xed48('0x16')]=0x0;this[_0xed48('0x65')]();}}if(_0x1d4d1d[_0xed48('0x62')](_0x3f7239)&&_0x1d4d1d[_0x3f7239][_0xed48('0x33')]===_0xed48('0x7')&&_0x1d4d1d[_0x3f7239]['type']===_0xed48('0x25')){if(_0x1d4d1d[_0x3f7239]['dialActive']){this[_0xed48('0x66')](_0x1d4d1d[_0x3f7239]);this[_0xed48('0x67')](_0x1d4d1d[_0x3f7239]);}else{notSendMessagesQueue(_0x1d4d1d[_0x3f7239]);}}}};Preview['prototype']['clearZombieChannel']=function(_0x26da97){var _0x5950c3=this;this[_0xed48('0x10')]['enqueue'](function(){if(!_['isNil'](_0x5950c3['actions'][_0x26da97])){loggerAction[_0xed48('0x55')](_0xed48('0x68'),_0x26da97,_0xed48('0x69'),_0x5950c3[_0xed48('0x14')][_0x26da97][_0xed48('0x6a')],_0xed48('0x6b'),JSON['stringify'](_0x5950c3['campaignsPreview'][_0x5950c3[_0xed48('0x14')][_0x26da97][_0xed48('0x6a')]][_0xed48('0x59')]),_0xed48('0x6c'),JSON[_0xed48('0x51')](_0x5950c3[_0xed48('0x11')][_0x5950c3['actions'][_0x26da97][_0xed48('0x6a')]]['pTalking']),JSON['stringify'](_0x5950c3['actions'][_0x26da97][_0xed48('0x6d')]),JSON[_0xed48('0x51')](_[_0xed48('0x6e')](_0x5950c3[_0xed48('0x14')][_0x26da97],[_0xed48('0x6f'),_0xed48('0x70'),_0xed48('0x71'),_0xed48('0x72')])));return ami[_0xed48('0x73')]({'action':_0xed48('0x74'),'channel':_0x5950c3[_0xed48('0x14')][_0x26da97][_0xed48('0x75')]})['catch'](function(_0x3f7deb){if(_0x3f7deb[_0xed48('0x5b')]===_0xed48('0x76')){setTimeout(function(){if(_0x5950c3[_0xed48('0x14')][_0x26da97]){ut[_0xed48('0x77')](_0x5950c3[_0xed48('0x11')][_0x5950c3[_0xed48('0x14')][_0x26da97][_0xed48('0x6a')]],_0xed48('0x78'));if(_0x5950c3[_0xed48('0x14')][_0x26da97][_0xed48('0x6d')]===!![]){ut[_0xed48('0x79')](_0x5950c3[_0xed48('0x11')][_0x5950c3[_0xed48('0x14')][_0x26da97]['queue']],'[clearZombieChannel]');ut['loggerError'](_0xed48('0x7a')+_0x26da97,_0x5950c3[_0xed48('0x14')][_0x26da97][_0xed48('0x6a')]);}ut[_0xed48('0x7b')](_0xed48('0x7c')+_0x26da97,_0x5950c3['actions'][_0x26da97]['queue']);delete _0x5950c3[_0xed48('0x14')][_0x26da97];}},0x2328);}});}});};Preview[_0xed48('0xe')][_0xed48('0x65')]=function(){var _0x59c282=this;loggerAction[_0xed48('0x55')](_0xed48('0x7d'),_[_0xed48('0x7e')](this[_0xed48('0x14')]));for(var _0x15503d in this['actions']){if(_0x59c282[_0xed48('0x14')]['hasOwnProperty'](_0x15503d)){_0x59c282[_0xed48('0x7f')](_0x15503d);}}};Preview[_0xed48('0xe')][_0xed48('0x67')]=function(_0x448061){var _0x47263d=this;rpcDb[_0xed48('0x80')](_0x448061['id'],ut['agentReadyId'](this[_0xed48('0x15')]))['then'](function(_0x405aca){if(!_[_0xed48('0x81')](_0x405aca)){for(var _0x27746e=0x0;_0x27746e<_0x405aca['length'];_0x27746e+=0x1){if(ut[_0xed48('0x82')](_0x405aca[_0x27746e][_0xed48('0x83')])<_0x448061['dialRecallMeTimeout']*0x3c){if(_0x405aca[_0x27746e][_0xed48('0x84')]&&!_0x405aca[_0x27746e]['Agent'][_0xed48('0x85')]){_0x47263d['run'](_0x405aca[_0x27746e]['id'])[_0xed48('0x86')](ut[_0xed48('0x87')](_0xed48('0x88')))[_0xed48('0x89')](ut['logger2'](_0xed48('0x88')));}else{rpcDb['disableContact'](_0x405aca[_0x27746e]['id']);}}else{var _0x1ac814=new Action(_0x405aca[_0x27746e],_0x448061);_0x1ac814[_0xed48('0x8a')]=moment()[_0xed48('0x52')](_0xed48('0x8b'));_0x448061[_0xed48('0x3c')]+=0x1;ut[_0xed48('0x8c')](_0x1ac814,0x17,_0xed48('0x8d'));if(_0x448061[_0xed48('0x8e')]){rpcDb['rescheduleContactInQueue'](ut[_0xed48('0x8f')](_0x405aca[_0x27746e]));rpcDb['createCustomerHistory'](_0x1ac814,_0xed48('0x90'));}else{ut['logCustomer'](_0x1ac814,0x16,_0xed48('0x91'));rpcDb[_0xed48('0x92')](_0x1ac814,_0xed48('0x93'));rpcDb[_0xed48('0x94')](_0x1ac814,_0xed48('0x93'));}}}}})[_0xed48('0x89')](ut['logger2']('[getContactRecallMe]'));};Preview['prototype'][_0xed48('0x66')]=function(_0x51abc3){_0x51abc3['sendMessageOneNotActive']=!![];if(ut[_0xed48('0x95')](_0x51abc3['loggedIn'])){_0x51abc3[_0xed48('0x5b')]=_0xed48('0x96');}else if(!ut[_0xed48('0x97')](_0x51abc3[_0xed48('0x32')])){_0x51abc3['message']='NOT_ACTIVE';}else if(!this[_0xed48('0x98')](_0x51abc3['Trunk'])){if(!this[_0xed48('0x98')](_0x51abc3['TrunkBackup'])){_0x51abc3[_0xed48('0x5b')]=_0xed48('0x99');}else{_0x51abc3['message']=_0xed48('0x9a');}}else{_0x51abc3['message']=_0xed48('0x9a');}emitCampaignPreview(_0x51abc3);};Preview[_0xed48('0xe')][_0xed48('0x9b')]=function(_0x9a7dcc,_0x7440f9,_0x34cf18){var _0x14b452=this;var _0x22a7d8=this['actions'][_0x7440f9];var _0x55d50c=this[_0xed48('0x11')][_0x22a7d8[_0xed48('0x6a')]];var _0x146bbe;if(_0x55d50c){switch(_0x34cf18){case'1':_0x55d50c[_0xed48('0x9c')]+=0x1;_0x22a7d8['countnosuchnumberretry']+=0x1;_0x22a7d8[_0xed48('0x9d')]=ut[_0xed48('0x9e')](_0x22a7d8);ut[_0xed48('0x8c')](_0x22a7d8,0x0,'NoSuchNumber');ami[_0xed48('0x24')](_0xed48('0x9f'),ut[_0xed48('0xa0')](_0x22a7d8,'nosuchnumber'));rpcDb['createCustomerHistory'](_0x22a7d8,_0xed48('0xa1'));if(ut[_0xed48('0x9e')](_0x22a7d8)>=_0x55d50c['dialGlobalMaxRetry']){_0x146bbe=ut[_0xed48('0xa2')](_0x22a7d8,0xf,'Global');rpcDb['createCustomerFinal'](_0x146bbe,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x22a7d8['countnosuchnumberretry']>=_0x55d50c[_0xed48('0xa3')]){rpcDb[_0xed48('0x94')](_0x22a7d8,_0xed48('0xa4'));}else{rpcDb[_0xed48('0xa5')](ut['scheduledAt'](_0x22a7d8,_0xed48('0xa6'),_0x55d50c['dialNoSuchNumberRetryFrequency']),_0x22a7d8['unlockAgent'],_0x22a7d8[_0xed48('0xa7')]);}}delete this[_0xed48('0x14')][_0x9a7dcc['linkedid']];break;case'ANSWER':var _0x350391=moment()[_0xed48('0x52')](_0xed48('0x8b'));_0x22a7d8['responsetime']=_0x350391;_0x22a7d8[_0xed48('0xa8')]=_0x350391;_0x22a7d8['dialAnswer']=!![];_0x55d50c[_0xed48('0x2a')]+=0x1;logger[_0xed48('0x55')](_0xed48('0xa9'),_0x22a7d8[_0xed48('0xaa')],_0xed48('0xab'),_0x55d50c[_0xed48('0x26')],'pTalking:\x20',_0x55d50c[_0xed48('0x2a')]);ami[_0xed48('0x24')](_0xed48('0xac'),ut[_0xed48('0xa0')](_0x22a7d8,_0xed48('0xad'),this['campaignsPreview'][_0x22a7d8[_0xed48('0x6a')]]));if(_0x55d50c[_0xed48('0xae')]){ami['emit']('custom:agentConnectPreview',ut[_0xed48('0xaf')](_0x22a7d8));}break;case'16':ami[_0xed48('0x24')](_0xed48('0xb0'),ut[_0xed48('0xa0')](_0x22a7d8,_0xed48('0xb1'),this[_0xed48('0x11')][_0x22a7d8['queue']]));emitVoiceQueueChannelRemove(ut[_0xed48('0xa0')](_0x22a7d8,_0xed48('0xb1')));_0x55d50c[_0xed48('0xb2')]+=0x1;_0x55d50c['total']+=0x1;_0x55d50c['answered']+=0x1;ut['decrementTalkink'](_0x55d50c,_0xed48('0xb3'));_0x22a7d8['countglobal']=ut[_0xed48('0x9e')](_0x22a7d8);ut['logCustomer'](_0x22a7d8,0x4,_0xed48('0xb4'));rpcDb[_0xed48('0x92')](_0x22a7d8,_0xed48('0xb5'));rpcDb[_0xed48('0x94')](_0x22a7d8,_0xed48('0xb6'));rpcDb['crateCustomerReportQueue'](_0x22a7d8);_0x55d50c['sumDuration']+=_0x22a7d8['talktime'];_0x55d50c['sumBillable']+=_0x22a7d8['talktime'];logger['info'](_0xed48('0xb7'),_0x22a7d8['uniqueid'],_0xed48('0xab'),_0x55d50c[_0xed48('0x26')],_0xed48('0x6c'),_0x55d50c[_0xed48('0x2a')]);delete this[_0xed48('0x14')][_0x9a7dcc[_0xed48('0xb8')]];break;case'BUSY':_0x55d50c[_0xed48('0x39')]+=0x1;_0x22a7d8[_0xed48('0xb9')]+=0x1;_0x22a7d8[_0xed48('0x9d')]=ut['totalGlobal'](_0x22a7d8);ut[_0xed48('0x8c')](_0x22a7d8,0x5,_0xed48('0xba'));ami[_0xed48('0x24')](_0xed48('0xbb'),ut[_0xed48('0xa0')](_0x22a7d8,'busy'));rpcDb[_0xed48('0x92')](_0x22a7d8,_0xed48('0xbc'));if(ut[_0xed48('0x9e')](_0x22a7d8)>=_0x55d50c['dialGlobalMaxRetry']){_0x146bbe=ut[_0xed48('0xa2')](_0x22a7d8,0xf,_0xed48('0xbd'));rpcDb[_0xed48('0x94')](_0x146bbe,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x22a7d8['countbusyretry']>=_0x55d50c[_0xed48('0xbe')]){rpcDb['createCustomerFinal'](_0x22a7d8,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut[_0xed48('0xbf')](_0x22a7d8,_0xed48('0xb9'),_0x55d50c['dialBusyRetryFrequency']),_0x22a7d8[_0xed48('0xc0')],_0x22a7d8[_0xed48('0xa7')]);}}break;case _0xed48('0xc1'):_0x55d50c[_0xed48('0x3b')]+=0x1;_0x22a7d8[_0xed48('0xc2')]+=0x1;_0x22a7d8['countglobal']=ut[_0xed48('0x9e')](_0x22a7d8);ut[_0xed48('0x8c')](_0x22a7d8,0x3,_0xed48('0xc3'));ami[_0xed48('0x24')](_0xed48('0xc4'),ut[_0xed48('0xa0')](_0x22a7d8,_0xed48('0xc5')));rpcDb[_0xed48('0x92')](_0x22a7d8,_0xed48('0xc6'));if(ut[_0xed48('0x9e')](_0x22a7d8)>=_0x55d50c[_0xed48('0xc7')]){_0x146bbe=ut[_0xed48('0xa2')](_0x22a7d8,0xf,'Global');rpcDb[_0xed48('0x94')](_0x146bbe,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x22a7d8[_0xed48('0xc2')]>=_0x55d50c[_0xed48('0xc8')]){rpcDb[_0xed48('0x94')](_0x22a7d8,_0xed48('0xc6'));}else{rpcDb['rescheduleContact'](ut[_0xed48('0xbf')](_0x22a7d8,_0xed48('0xc2'),_0x55d50c[_0xed48('0xc9')]),_0x22a7d8[_0xed48('0xc0')],_0x22a7d8[_0xed48('0xa7')]);}}break;case'CONGESTION':_0x55d50c[_0xed48('0xca')]+=0x1;_0x22a7d8[_0xed48('0xcb')]+=0x1;_0x22a7d8[_0xed48('0x9d')]=ut[_0xed48('0x9e')](_0x22a7d8);ut[_0xed48('0x8c')](_0x22a7d8,0x8,_0xed48('0xcc'));ami['emit'](_0xed48('0xcd'),ut['buildObj'](_0x22a7d8,_0xed48('0xce')));rpcDb[_0xed48('0x92')](_0x22a7d8,'[callProgressDetectingCustomer][logCongestion]');if(ut[_0xed48('0x9e')](_0x22a7d8)>=_0x55d50c[_0xed48('0xc7')]){_0x146bbe=ut[_0xed48('0xa2')](_0x22a7d8,0xf,_0xed48('0xbd'));rpcDb[_0xed48('0x94')](_0x146bbe,_0xed48('0xcf'));}else{if(_0x22a7d8[_0xed48('0xcb')]>=_0x55d50c['dialCongestionMaxRetry']){rpcDb[_0xed48('0x94')](_0x22a7d8,_0xed48('0xd0'));}else{rpcDb['rescheduleContact'](ut[_0xed48('0xbf')](_0x22a7d8,_0xed48('0xcb'),_0x55d50c[_0xed48('0xd1')]),_0x22a7d8['unlockAgent'],_0x22a7d8[_0xed48('0xa7')]);}}break;case _0xed48('0xd2'):_0x55d50c[_0xed48('0x3d')]+=0x1;_0x22a7d8[_0xed48('0xd3')]+=0x1;_0x22a7d8[_0xed48('0x9d')]=ut[_0xed48('0x9e')](_0x22a7d8);ut['logCustomer'](_0x22a7d8,0x14,'AgentReject');ami[_0xed48('0x24')](_0xed48('0xd4'),ut[_0xed48('0xa0')](_0x22a7d8,_0xed48('0xd5')));rpcDb[_0xed48('0x92')](_0x22a7d8,_0xed48('0xd6'));if(ut['totalGlobal'](_0x22a7d8)>=_0x55d50c[_0xed48('0xc7')]){_0x146bbe=ut[_0xed48('0xa2')](_0x22a7d8,0x14,_0xed48('0xd7'));rpcDb[_0xed48('0x94')](_0x146bbe,_0xed48('0xd8'));}else{if(_0x22a7d8[_0xed48('0xd3')]>=_0x55d50c[_0xed48('0xd9')]){rpcDb[_0xed48('0x94')](_0x22a7d8,_0xed48('0xd8'));}else{rpcDb['rescheduleContact'](ut[_0xed48('0xbf')](_0x22a7d8,_0xed48('0xd3'),_0x55d50c[_0xed48('0xda')]),_0x22a7d8[_0xed48('0xc0')],_0x22a7d8[_0xed48('0xa7')]);}}break;case _0xed48('0xdb'):_0x55d50c[_0xed48('0xdc')]+=0x1;_0x22a7d8[_0xed48('0xdd')]+=0x1;_0x22a7d8[_0xed48('0x9d')]=ut['totalGlobal'](_0x22a7d8);ut['logCustomer'](_0x22a7d8,0xb,_0xed48('0xde'));rpcDb['createCustomerHistory'](_0x22a7d8,_0xed48('0xdf'));if(ut[_0xed48('0x9e')](_0x22a7d8)>=_0x55d50c[_0xed48('0xc7')]){_0x146bbe=ut['cloneAction'](_0x22a7d8,0xf,'Global');rpcDb[_0xed48('0x94')](_0x146bbe,_0xed48('0xdf'));}else{if(_0x22a7d8['countabandonedetry']>=_0x55d50c[_0xed48('0xe0')]){rpcDb[_0xed48('0x94')](_0x22a7d8,_0xed48('0xdf'));}else{rpcDb[_0xed48('0xa5')](ut['scheduledAt'](_0x22a7d8,_0xed48('0xdd'),_0x55d50c[_0xed48('0xe1')]),_0x22a7d8[_0xed48('0xc0')],_0x22a7d8[_0xed48('0xa7')]);}}break;default:if(_0x22a7d8[_0xed48('0x6d')]){ut[_0xed48('0x79')](_0x55d50c,_0xed48('0xe2'));ut[_0xed48('0x7b')](_0xed48('0xe3')+_0x55d50c['name'],_0x9a7dcc);}_0x55d50c['outboundUnknownCallsDay']+=0x1;_0x22a7d8[_0xed48('0x9d')]=ut[_0xed48('0x9e')](_0x22a7d8);ut[_0xed48('0x8c')](_0x22a7d8,0xc,_0x9a7dcc['cause-txt']||_0x9a7dcc[_0xed48('0xe4')]);rpcDb[_0xed48('0x92')](_0x22a7d8,_0xed48('0xe5'));if(ut[_0xed48('0x9e')](_0x22a7d8)>=_0x55d50c[_0xed48('0xc7')]){_0x146bbe=ut[_0xed48('0xa2')](_0x22a7d8,0xf,_0xed48('0xbd'));rpcDb['createCustomerFinal'](_0x146bbe,_0xed48('0xe6'));}else{rpcDb['createCustomerFinal'](_0x22a7d8,_0xed48('0xe6'));}delete this['actions'][_0x9a7dcc['linkedid']];}if(!(_0x22a7d8[_0xed48('0x6d')]&&_0x34cf18==='16')){ut[_0xed48('0x77')](_0x55d50c,'[callProgressDetectingCustomer]');logger[_0xed48('0x55')](_0xed48('0xe7'),_0x22a7d8['uniqueid'],_0xed48('0xab'),_0x55d50c['name'],'originated:\x20',_0x55d50c[_0xed48('0x59')]);}if(_0x34cf18!=='ANSWER'){delete this[_0xed48('0x14')][_0x9a7dcc[_0xed48('0xb8')]];delete this[_0xed48('0x14')][_0x9a7dcc['destlinkedid']];}}};Preview[_0xed48('0xe')][_0xed48('0xe8')]=function(_0x48c7ae,_0x196e92,_0x476e7e){if(_[_0xed48('0xe9')](_0x196e92)&&_0xed48('0xea')!==typeof _0x196e92){return;}if(_[_0xed48('0xe9')](_0x476e7e)&&_0xed48('0xea')!==typeof _0x476e7e){return;}switch(_0x476e7e[_0xed48('0xeb')]){case'0':ut[_0xed48('0xec')](_0x48c7ae,0x0,_0xed48('0xed'));rpcDb[_0xed48('0xee')](_0x48c7ae,_0xed48('0xef'));break;case'3':ut['logAgent'](_0x48c7ae,0x3,_0xed48('0xc3'));rpcDb[_0xed48('0xee')](_0x48c7ae,_0xed48('0xf0'));break;case'5':ut['logAgent'](_0x48c7ae,0x5,'Busy');rpcDb[_0xed48('0xee')](_0x48c7ae,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0xed48('0xec')](_0x48c7ae,0x8,_0xed48('0xcc'));rpcDb['createAgentHistory'](_0x48c7ae,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xed48('0xec')](_0x48c7ae,0x16,_0xed48('0xf1'));rpcDb[_0xed48('0xee')](_0x48c7ae,_0xed48('0xf2'));break;default:ut[_0xed48('0xec')](_0x48c7ae,0xc,_0x476e7e[_0xed48('0xeb')]);rpcDb['createAgentHistory'](_0x48c7ae,_0xed48('0xf3'));}ut['updateOriginated'](_0x196e92,_0xed48('0xf4'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x48c7ae['uniqueid'],_0xed48('0xab'),_0x196e92[_0xed48('0x26')],_0xed48('0x6b'),_0x196e92['originated']);delete this['actions'][_0x48c7ae[_0xed48('0xaa')]];};Preview[_0xed48('0xe')][_0xed48('0xf5')]=function(_0x271f65,_0x4e77ff,_0x33695e,_0x4ac284,_0x1d8999){var _0x15e0d8=this;return new BPromise(function(_0x36955c,_0x56f6c8){if(_[_0xed48('0x81')](_0x4e77ff)||_[_0xed48('0x81')](_0x4e77ff['Contact'])||_[_0xed48('0x81')](_0x4e77ff[_0xed48('0xf6')]['phone'])||_[_0xed48('0x81')](_0x4e77ff[_0xed48('0x71')])){_0x56f6c8(ut['message'](_0xed48('0xf7'),_0x4ac284,_0x1d8999));return;}var _0x457267=uuid['v4']();var _0x1b9deb=_0x15e0d8['campaignsPreview'][_0x4e77ff[_0xed48('0x69')][_0xed48('0x26')]];var _0x1d9279=_0x33695e?_0x15e0d8['agents'][_0x33695e]['id']:undefined;_0x15e0d8[_0xed48('0x14')][_0x457267]=new Action(_0x4e77ff,_0x1b9deb,_0x457267,_0x33695e,_0x1d9279);var _0x439916=_0x15e0d8[_0xed48('0x14')][_0x457267];_0x439916['unlockAgent']=_0x4ac284;_0x439916[_0xed48('0xa7')]=_0x1d8999;_0x439916[_0xed48('0xf8')]=_0x33695e;if(_[_0xed48('0xf9')](_0x271f65)){_0x15e0d8[_0xed48('0xfa')](_0x439916,_0x1b9deb,_0x4e77ff,_0x33695e)['then'](function(_0x4b92a1){logger[_0xed48('0x55')](_0xed48('0xfb'),_0xed48('0xfc')+_0x439916[_0xed48('0x6a')]+_0xed48('0xfd')+_0x439916[_0xed48('0xfe')],JSON[_0xed48('0x51')](_0x4b92a1));ami['emit'](_0xed48('0xff'),ut[_0xed48('0xa0')](_0x439916,'called',_0x15e0d8[_0xed48('0x11')][_0x439916[_0xed48('0x6a')]]));_0x36955c(ut[_0xed48('0x5b')](_0xed48('0x100')));})[_0xed48('0x89')](function(_0x361103){ut['logger'](_0xed48('0x101'),_0x361103);_0x56f6c8(ut['message']('Call\x20failed',_0x4ac284,_0x1d8999));});}else{_0x1b9deb[_0xed48('0x38')]+=0x1;ut[_0xed48('0x102')](_0x439916);rpcDb[_0xed48('0x103')](_0x439916,_0xed48('0x104'));delete _0x15e0d8[_0xed48('0x14')][_0x457267];_0x56f6c8(ut[_0xed48('0x5b')]('Contact\x20in\x20black\x20List',_0x4ac284,_0x1d8999));}});};Preview[_0xed48('0xe')]['isTrunkReachable']=function(_0x53787a){return!_['isNil'](_0x53787a)&&!_[_0xed48('0x81')](_0x53787a[_0xed48('0x26')])&&!_[_0xed48('0x81')](_0x53787a[_0xed48('0x105')])&&_0x53787a[_0xed48('0x105')]&&!_['isNil'](this['trunks'][util[_0xed48('0x52')](_0xed48('0x106'),_0x53787a['name'])])&&!_[_0xed48('0x81')](this[_0xed48('0x13')][util[_0xed48('0x52')](_0xed48('0x106'),_0x53787a[_0xed48('0x26')])]['status'])&&(this[_0xed48('0x13')][util[_0xed48('0x52')](_0xed48('0x106'),_0x53787a[_0xed48('0x26')])][_0xed48('0x74')]===_0xed48('0x107')||this[_0xed48('0x13')][util[_0xed48('0x52')](_0xed48('0x106'),_0x53787a[_0xed48('0x26')])][_0xed48('0x74')]===_0xed48('0x108'));};Preview[_0xed48('0xe')][_0xed48('0x109')]=function(_0x2cc591,_0x1e14db){var _0xce3c3e=this;return new BPromise(function(_0x3e9fa1,_0x4380e9){_0xce3c3e[_0xed48('0x10a')](_0x2cc591,_0x1e14db)[_0xed48('0x86')](function(_0x241a4c){_0x3e9fa1(_[_0xed48('0x6e')](_0x241a4c,['message']));})[_0xed48('0x89')](function(_0x164e46){if(_0x164e46[_0xed48('0x10b')]){rpcDb['unlockContact'](_0x2cc591);}if(_0x164e46[_0xed48('0x105')]){rpcDb[_0xed48('0x10c')](_0x2cc591);}_0x4380e9(_[_0xed48('0x6e')](_0x164e46,[_0xed48('0x5b')]));});});};Preview[_0xed48('0xe')]['execRun']=function(_0xe30c1e,_0x47d0b6){var _0xbac73a=this;return new BPromise(function(_0x240355,_0x5c43ce){var _0x8dfdfa,_0x56463e;rpcDb[_0xed48('0x10d')](_0xe30c1e)['then'](function(_0x1cf341){if(!_[_0xed48('0x81')](_0x1cf341[0x0])){_0x56463e=_0x1cf341[0x0][_0xed48('0x10e')]?![]:!![];_0x8dfdfa=_0x1cf341[0x0][_0xed48('0x10e')]?!![]:![];_0x8dfdfa=_0x47d0b6?!![]:_0x8dfdfa;}var _0x18b6a4=_0xbac73a[_0xed48('0x10f')](_0x1cf341);if(_0x18b6a4[_0xed48('0x110')]){rpcDb[_0xed48('0x111')](_[_0xed48('0x6e')](_0x1cf341[0x0],[_0xed48('0x71'),_0xed48('0x112')]))['then'](function(_0x5db77b){_0xbac73a[_0xed48('0xf5')](_0x5db77b,_0x1cf341[0x0],_0x47d0b6,_0x56463e,_0x8dfdfa)[_0xed48('0x86')](function(_0x3b438b){_0x240355(_0x3b438b);})[_0xed48('0x89')](function(_0x5cd9f7){_0x5c43ce(_0x5cd9f7);});})['catch'](function(_0x3e2644){ut[_0xed48('0x5d')](_0xed48('0x113'),_0x3e2644);_0x5c43ce(ut[_0xed48('0x5b')](_0xed48('0x114'),_0x56463e,_0x8dfdfa));});}else{_0x5c43ce(ut[_0xed48('0x5b')](_0x18b6a4['message'],_0x56463e,_0x8dfdfa));}})[_0xed48('0x89')](function(_0x491863){ut[_0xed48('0x5d')](_0xed48('0x115'),_0x491863);_0x5c43ce(ut[_0xed48('0x5b')](_0xed48('0x114'),![],!![]));});});};Preview[_0xed48('0xe')][_0xed48('0x10f')]=function(_0x1ad89f){if(_['isNil'](_0x1ad89f)||_[_0xed48('0xf9')](_0x1ad89f)||!_[_0xed48('0x81')](_0x1ad89f[0x0][_0xed48('0x84')])&&_[_0xed48('0x81')](_0x1ad89f[0x0][_0xed48('0x84')][_0xed48('0x26')])){ut['logger'](_0xed48('0x116'),_0x1ad89f);return{'isValid':![],'message':_0xed48('0x117')};}var _0x7f6a36=this[_0xed48('0x11')][_0x1ad89f[0x0]['Queue'][_0xed48('0x26')]];_0x7f6a36['message']=_0xed48('0x9a');if(_[_0xed48('0x81')](_0x7f6a36)){ut[_0xed48('0x5d')](_0xed48('0x118'),_0x7f6a36);return{'isValid':![],'message':_0xed48('0x119')};}if(!this[_0xed48('0x98')](_0x7f6a36[_0xed48('0x4e')])){ut[_0xed48('0x5d')](_0xed48('0x11a'),_0xed48('0x11b')+_0x7f6a36[_0xed48('0x26')]+_0xed48('0x11c'));if(!this['isTrunkReachable'](_0x7f6a36[_0xed48('0x11d')])){ut[_0xed48('0x5d')](_0xed48('0x11a'),_0x7f6a36[_0xed48('0x26')]+_0xed48('0x11e'));return{'isValid':![],'message':_0xed48('0x11f')};}}if(!ut[_0xed48('0x97')](_0x7f6a36[_0xed48('0x32')])){ut['logger']('[Preview][validateContact][Campaign\x20Active]',_0x7f6a36[_0xed48('0x26')]+_0xed48('0x120'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x7f6a36[_0xed48('0x26')]+_0xed48('0x120')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xed48('0xe')][_0xed48('0xfa')]=function(_0x5c2c0e,_0x5ae624,_0x54c72e,_0x573eca){var _0x4ec06c=this;return new BPromise(function(_0x10e7b8,_0x3ae977){var _0x42ecfa=_0x5c2c0e[_0xed48('0xaa')];var _0x121030=_0x4ec06c[_0xed48('0x98')](_0x5ae624[_0xed48('0x4e')])?util[_0xed48('0x52')]('SIP/%s/%s%s',_0x5ae624[_0xed48('0x4e')]['name'],_['isNil'](_0x5ae624['dialPrefix'])?'':_0x5ae624['dialPrefix']['trim']()||'',_0x5ae624['dialCutDigit']>0x0?_0x54c72e[_0xed48('0xf6')][_0xed48('0x121')][_0xed48('0x122')](_0x5ae624[_0xed48('0x123')]):_0x54c72e['Contact'][_0xed48('0x121')]):util['format'](_0xed48('0x124'),_[_0xed48('0x81')](_0x5ae624['TrunkBackup'])?_0x5ae624['Trunk'][_0xed48('0x26')]:_0x5ae624['TrunkBackup'][_0xed48('0x26')],_['isNil'](_0x5ae624[_0xed48('0x36')])?'':_0x5ae624[_0xed48('0x36')][_0xed48('0x125')]()||'',_0x5ae624['dialCutDigit']>0x0?_0x54c72e['Contact'][_0xed48('0x121')]['substring'](_0x5ae624['dialCutDigit']):_0x54c72e[_0xed48('0xf6')][_0xed48('0x121')]);var _0x34feb8=_0x4ec06c[_0xed48('0x98')](_0x5ae624['Trunk'])?ut[_0xed48('0x126')](_0x5ae624[_0xed48('0x4e')][_0xed48('0x4f')],_0x5ae624[_0xed48('0x34')],_0x5ae624[_0xed48('0x127')]>0x0?ut['getCallerIdRandom'](_0x5ae624['dialOriginateCallerIdNumber'],_0x5ae624[_0xed48('0x127')]):_0x5ae624[_0xed48('0x128')]):ut[_0xed48('0x126')](_[_0xed48('0x81')](_0x5ae624['TrunkBackup'])?_0x5ae624[_0xed48('0x4e')][_0xed48('0x4f')]:_0x5ae624[_0xed48('0x11d')][_0xed48('0x4f')],_0x5ae624['dialOriginateCallerIdName'],_0x5ae624[_0xed48('0x127')]>0x0?ut['getCallerIdRandom'](_0x5ae624[_0xed48('0x128')],_0x5ae624[_0xed48('0x127')]):_0x5ae624[_0xed48('0x128')]);if(_0x34feb8){_0x5c2c0e[_0xed48('0x129')]=ut['extractCalleridName'](_0x34feb8);_0x5c2c0e[_0xed48('0x12a')]=ut[_0xed48('0x12b')](_0x34feb8);}var _0x515719=ut[_0xed48('0x12c')](_0x5ae624,_0x54c72e,_0x121030,_0x34feb8,_0x42ecfa,_0x5c2c0e);_[_0xed48('0x12d')](_0x5c2c0e,ut[_0xed48('0x12e')](_0x515719));_0x5c2c0e[_0xed48('0x8a')]=moment()[_0xed48('0x52')](_0xed48('0x8b'));ami['Action'](ut[_0xed48('0x12f')](_0x5c2c0e,_0x5ae624,_0x515719,_0x5c2c0e[_0xed48('0xa7')],_0x573eca))['then'](function(_0x19a090){_0x5ae624['originated']+=0x1;logger[_0xed48('0x55')](_0xed48('0x130'),_0x42ecfa,_0xed48('0xab'),_0x5ae624[_0xed48('0x26')],_0xed48('0x6b'),_0x5ae624[_0xed48('0x59')]);_0x10e7b8(_0x19a090);})['catch'](function(_0x181825){ut['logAgent'](_0x5c2c0e,0xe,_0xed48('0x131'));rpcDb[_0xed48('0xee')](_0x5c2c0e,'[originateFailure][logOriginateFailure]');_0x3ae977(_0x181825);});});};Preview['prototype'][_0xed48('0x1f')]=function(_0x356efb){if(this['actions'][_0x356efb['linkedid']]){this[_0xed48('0x14')][_0x356efb['linkedid']][_0xed48('0x75')]=_0x356efb[_0xed48('0x75')];}};Preview[_0xed48('0xe')][_0xed48('0x18')]=function(_0x24ad35){var _0x1910c4=this;var _0x587748=this['actions'][_0x24ad35[_0xed48('0x132')]];if(_0x587748){if(_0x587748[_0xed48('0xf8')]&&this[_0xed48('0x15')][_0x587748[_0xed48('0xf8')]]){ut[_0xed48('0x133')](_0x587748,this[_0xed48('0x15')][_0x587748[_0xed48('0xf8')]][_0xed48('0x26')],this[_0xed48('0x15')][_0x587748[_0xed48('0xf8')]]['id']);}var _0x381d3a=_[_0xed48('0x134')](_0x587748);_0x381d3a[_0xed48('0x135')]=moment()[_0xed48('0x52')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2ec9f1=_0x1910c4[_0xed48('0x11')][_0x587748[_0xed48('0x6a')]];if(ut[_0xed48('0x136')](_0x24ad35['response'])){if(_0x587748[_0xed48('0xc0')]){rpcDb[_0xed48('0x137')](_0x587748[_0xed48('0xfe')]);}if(_0x587748['activeContact']){rpcDb[_0xed48('0x10c')](_0x587748['idContact']);}ami[_0xed48('0x24')](_0xed48('0x138'),ut[_0xed48('0xa0')](_0x587748,_0xed48('0x139'),this[_0xed48('0x11')][_0x587748['queue']]));this['callProgressDetectingAgent'](_0x381d3a,_0x2ec9f1,_0x24ad35);}else{_0x587748['starttime']=moment()[_0xed48('0x52')](_0xed48('0x8b'));ut[_0xed48('0xec')](_0x381d3a,0x4,_0xed48('0xb4'));rpcDb[_0xed48('0xee')](_0x381d3a,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0xed48('0xe')][_0xed48('0x1a')]=function(_0x47550e){var _0x160712=this;var _0x2d250c=this['actions'][_0x47550e['linkedid']];var _0x5e3cd9;if(_0x2d250c){_0x5e3cd9=this['campaignsPreview'][_0x2d250c[_0xed48('0x6a')]];logger[_0xed48('0x55')](_0xed48('0x13a'),_0x47550e[_0xed48('0xb8')],'\x20Queue',_0x5e3cd9[_0xed48('0x26')],_0xed48('0x6c'),_0x5e3cd9[_0xed48('0x2a')]);}if(this[_0xed48('0x14')][_0x47550e[_0xed48('0xb8')]]&&_0x47550e[_0xed48('0xb8')]!==_0x47550e['uniqueid']){if(_0x47550e['cause']==='16'&&this[_0xed48('0x14')][_0x47550e[_0xed48('0xb8')]]['dialAnswer']){this[_0xed48('0x9b')](_0x47550e,_0x47550e[_0xed48('0xb8')],_0x47550e['cause']);}else if(this[_0xed48('0x14')][_0x47550e[_0xed48('0xb8')]]['dialAnswer']){logger[_0xed48('0x55')](_0xed48('0x13b'),_0x47550e[_0xed48('0xb8')],_0x47550e[_0xed48('0x13c')],'\x20Queue',_0x5e3cd9['name'],_0xed48('0x6c'),_0x5e3cd9[_0xed48('0x2a')]);this[_0xed48('0x9b')](_0x47550e,_0x47550e[_0xed48('0xb8')],_0x47550e['cause']);}}else if(_0x2d250c&&_[_0xed48('0x81')](_0x2d250c[_0xed48('0x13d')])&&_0x5e3cd9[_0xed48('0x13e')]&&_0x47550e[_0xed48('0xb8')]===_0x47550e[_0xed48('0xaa')]&&_[_0xed48('0x81')](_0x47550e[_0xed48('0xeb')])&&_0x47550e[_0xed48('0x13c')]==='16'&&_0x47550e[_0xed48('0x13f')]==='6'&&_['isUndefined'](_0x2d250c[_0xed48('0x140')])){if(_0x2d250c[_0xed48('0xc0')]){rpcDb[_0xed48('0x137')](_0x2d250c[_0xed48('0xfe')]);}if(_0x2d250c[_0xed48('0xa7')]){rpcDb[_0xed48('0x10c')](_0x2d250c['idContact']);}_0x47550e[_0xed48('0xeb')]='22';this['callProgressDetectingAgent'](_0x2d250c,_0x5e3cd9,_0x47550e);}else if(_0x2d250c&&_0x2d250c[_0xed48('0x140')]){if(_0x47550e['cause']==='16'&&this[_0xed48('0x14')][_0x47550e[_0xed48('0xb8')]][_0xed48('0x6d')]){logger['info']('[syncHangup][talking][transfer]',_0x47550e[_0xed48('0xb8')],_0x47550e[_0xed48('0x13c')],_0xed48('0xab'),_0x5e3cd9['name'],_0xed48('0x6c'),_0x5e3cd9[_0xed48('0x2a')]);this[_0xed48('0x9b')](_0x47550e,_0x47550e[_0xed48('0xb8')],_0x47550e[_0xed48('0x13c')]);}else if(this[_0xed48('0x14')][_0x47550e['linkedid']]['dialAnswer']){logger[_0xed48('0x55')](_0xed48('0x13b'),_0x47550e[_0xed48('0xb8')],_0x47550e[_0xed48('0x13c')],_0xed48('0xab'),_0x5e3cd9[_0xed48('0x26')],_0xed48('0x6c'),_0x5e3cd9[_0xed48('0x2a')]);this[_0xed48('0x9b')](_0x47550e,_0x47550e[_0xed48('0xb8')],_0x47550e['cause']);}}};Preview[_0xed48('0xe')][_0xed48('0x1d')]=function(_0x573434){if(this[_0xed48('0x14')][_0x573434[_0xed48('0x141')]]&&_0x573434[_0xed48('0x141')]!==_0x573434['destuniqueid']){this[_0xed48('0x9b')](_0x573434,_0x573434[_0xed48('0x141')],_0x573434[_0xed48('0xe4')]);}};Preview[_0xed48('0xe')][_0xed48('0x142')]=function(_0x387f8d){if(this[_0xed48('0x14')][_0x387f8d['linkedid']]&&_0x387f8d[_0xed48('0xb8')]!==_0x387f8d[_0xed48('0xaa')]&&!this[_0xed48('0x14')][_0x387f8d[_0xed48('0xb8')]][_0xed48('0x6d')]){if(_0x387f8d[_0xed48('0x13c')]==='1'){this[_0xed48('0x9b')](_0x387f8d,_0x387f8d[_0xed48('0xb8')],_0x387f8d['cause']);}}};Preview['prototype'][_0xed48('0x143')]=function(_0x576da0,_0x55cbec,_0x5acc37){if(this[_0xed48('0x14')][_0x576da0]){if(_['isNil'](this[_0xed48('0x14')][_0x576da0][_0xed48('0x144')])){this[_0xed48('0x14')][_0x576da0][_0xed48('0x144')]={};}this[_0xed48('0x14')][_0x576da0][_0xed48('0x144')][_0x55cbec]=_0x5acc37;}};Preview['prototype'][_0xed48('0x145')]=function(_0x57f8d8){try{if(!_['isNil'](_0x57f8d8)){if(ut[_0xed48('0x146')](_[_0xed48('0x147')](_0x57f8d8[_0xed48('0x148')])[0x0])){this[_0xed48('0x143')](_0x57f8d8[_0xed48('0xaa')],_['keys'](_0x57f8d8['variable'])[0x0],_0x57f8d8[_0xed48('0x149')]);}}}catch(_0xdb8bdb){logger[_0xed48('0x14a')](_0xed48('0x14b'),util[_0xed48('0x14c')](_0xdb8bdb,{'showHidden':![],'depth':null}));}};Preview[_0xed48('0xe')]['syncAttendedTransfer']=function(_0x1b3a3e){if(_0x1b3a3e){if(this[_0xed48('0x14')][_0x1b3a3e[_0xed48('0x14d')]]){this[_0xed48('0x14')][_0x1b3a3e[_0xed48('0x14d')]][_0xed48('0x140')]=!![];}}};Preview[_0xed48('0xe')][_0xed48('0x14e')]=function(_0x5682d3){if(_0x5682d3){if(this[_0xed48('0x14')][_0x5682d3[_0xed48('0x14f')]]){this['actions'][_0x5682d3[_0xed48('0x14f')]]['transfer']=!![];}}};module[_0xed48('0x150')]=Preview; \ No newline at end of file +var _0x4732=['Call\x20unsuccessful','validateContact','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','extractCalleridName','originatecalleridnum','addVariables','merge','starttime','[originated][increment]','OriginateError','actionid','clone','response','idContact','custom:agentringnoanswer','callProgressDetectingAgent','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','reason','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfer','transfererlinkedid','util','bluebird','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','../ami','./rpcDb','defaults','redis','localhost','socket.io-emitter','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','type','name','answered','available','loggedIn','pTalking','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','Trunk','active','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','prototype','loopCampaigns','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','booked','clearZombieChannels','outbound','setMessage','recallMe','clearZombieChannel','isNil','[clearZombieChannels][talking]','Queue','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','scheduledat','Agent','voicePause','run','logger2','[RecallMe]','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isTrunkReachable','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','[callProgressDetectingCustomer][logNoSuch]','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentConnectPreview','custom:agentcomplete','complete','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','Busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','cloneAction','dialBusyMaxRetry','countbusyretry','NOANSWER','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','dialBusyRetryFrequency','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','destlinkedid','isUndefined','object','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','unlock','unlockContact','disableContact','execRun','getContactPreview','recallme','isValid','[Preview][checkIsBlackList]'];(function(_0x42bc78,_0x4e6484){var _0x58fb8f=function(_0x3f4eb6){while(--_0x3f4eb6){_0x42bc78['push'](_0x42bc78['shift']());}};_0x58fb8f(++_0x4e6484);}(_0x4732,0x17d));var _0x2473=function(_0x2a3c0a,_0x163f5c){_0x2a3c0a=_0x2a3c0a-0x0;var _0x1703a2=_0x4732[_0x2a3c0a];return _0x1703a2;};'use strict';var util=require(_0x2473('0x0'));var _=require('lodash');var BPromise=require(_0x2473('0x1'));var uuid=require('uuid');var moment=require(_0x2473('0x2'));var md5=require(_0x2473('0x3'));var Redis=require(_0x2473('0x4'));var config=require(_0x2473('0x5'));var logger=require(_0x2473('0x6'))(_0x2473('0x7'));var loggerAction=require(_0x2473('0x6'))('actionPreview');var ami=require(_0x2473('0x8'));var rpcDb=require(_0x2473('0x9'));var Action=require('./action');var ut=require('./util/util');config['redis']=_[_0x2473('0xa')](config[_0x2473('0xb')],{'host':_0x2473('0xc'),'port':0x18eb});var io=require(_0x2473('0xd'))(new Redis(config[_0x2473('0xb')]));var Sequence=function(){};Sequence['prototype'][_0x2473('0xe')]=function(_0x551f47){this[_0x2473('0xf')]=this[_0x2473('0xf')]?this['tail']['finally'](_0x551f47):_0x551f47();};function Preview(_0x104e30){this[_0x2473('0x10')]=new Sequence();this[_0x2473('0x11')]=_0x104e30[_0x2473('0x12')];this['trunks']=_0x104e30[_0x2473('0x13')];this[_0x2473('0x14')]={};this[_0x2473('0x15')]=_0x104e30[_0x2473('0x15')];this['clockClearZombieChannels']=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0x2473('0x16')](this));ami['on'](_0x2473('0x17'),this[_0x2473('0x18')][_0x2473('0x16')](this));ami['on'](_0x2473('0x19'),this[_0x2473('0x1a')]['bind'](this));ami['on'](_0x2473('0x1b'),this[_0x2473('0x1c')][_0x2473('0x16')](this));ami['on'](_0x2473('0x1d'),this[_0x2473('0x1e')][_0x2473('0x16')](this));ami['on'](_0x2473('0x1f'),this['syncVarSet'][_0x2473('0x16')](this));ami['on'](_0x2473('0x20'),this[_0x2473('0x21')][_0x2473('0x16')](this));ami['on'](_0x2473('0x22'),this[_0x2473('0x23')][_0x2473('0x16')](this));this['loopCampaigns'](this[_0x2473('0x11')]);}function emit(_0x3a8111,_0xc4b4d3,_0x485a52){io['to'](_0x3a8111)[_0x2473('0x24')](_0xc4b4d3,_0x485a52);}function emitCampaignPreview(_0xe73ba5){if(_0xe73ba5[_0x2473('0x25')]==='outbound'){var _0x132878={'id':_0xe73ba5['id'],'name':_0xe73ba5[_0x2473('0x26')],'strategy':_0xe73ba5['strategy'],'answered':_0xe73ba5[_0x2473('0x27')],'available':_0xe73ba5[_0x2473('0x28')],'loggedIn':_0xe73ba5[_0x2473('0x29')],'pTalking':_0xe73ba5[_0x2473('0x2a')],'sumBillable':_0xe73ba5['sumBillable'],'sumDuration':_0xe73ba5['sumDuration'],'sumHoldTime':_0xe73ba5[_0x2473('0x2b')]||0x0,'talking':_0xe73ba5[_0x2473('0x2c')],'total':_0xe73ba5[_0x2473('0x2d')],'type':_0xe73ba5[_0x2473('0x25')],'unmanaged':_0xe73ba5[_0x2473('0x2e')],'abandoned':_0xe73ba5[_0x2473('0x2f')],'waiting':_0xe73ba5[_0x2473('0x30')],'loggedInDb':_0xe73ba5[_0x2473('0x31')],'dialActive':_0xe73ba5[_0x2473('0x32')],'dialMethod':_0xe73ba5['dialMethod'],'dialOriginateCallerIdName':_0xe73ba5[_0x2473('0x33')],'dialOriginateCallerIdNumber':_0xe73ba5[_0x2473('0x34')],'dialOriginateTimeout':_0xe73ba5['dialOriginateTimeout'],'dialPrefix':_0xe73ba5[_0x2473('0x35')],'outboundAnswerAgiCallsDay':_0xe73ba5[_0x2473('0x36')],'outboundAnswerCallsDay':_0xe73ba5[_0x2473('0x37')],'outboundBlacklistCallsDay':_0xe73ba5['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0xe73ba5[_0x2473('0x38')],'outboundCongestionCallsDay':_0xe73ba5[_0x2473('0x39')],'outboundDropCallsDayACS':_0xe73ba5[_0x2473('0x3a')],'outboundDropCallsDayCallersExit':_0xe73ba5['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0xe73ba5[_0x2473('0x3b')],'outboundNoAnswerCallsDay':_0xe73ba5['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0xe73ba5[_0x2473('0x3c')],'outboundOriginateFailureCallsDay':_0xe73ba5[_0x2473('0x3d')],'outboundReCallsDay':_0xe73ba5['outboundReCallsDay'],'outboundRejectCallsDay':_0xe73ba5[_0x2473('0x3e')],'outboundUnknownCallsDay':_0xe73ba5[_0x2473('0x3f')],'outboundAbandonedCallsDay':_0xe73ba5['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0xe73ba5['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0xe73ba5[_0x2473('0x40')],'predictiveIntervalAvgTalktime':_0xe73ba5[_0x2473('0x41')],'predictiveIntervalDroppedCallsCallersExit':_0xe73ba5[_0x2473('0x42')],'predictiveIntervalDroppedCallsTimeout':_0xe73ba5[_0x2473('0x43')],'predictiveIntervalErlangCalls':_0xe73ba5[_0x2473('0x44')],'predictiveIntervalErlangCallsDroppedCalls':_0xe73ba5['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0xe73ba5[_0x2473('0x45')],'predictiveIntervalMultiplicativeFactor':_0xe73ba5[_0x2473('0x46')],'predictiveIntervalPauses':_0xe73ba5[_0x2473('0x47')],'predictiveIntervalAvailable':_0xe73ba5[_0x2473('0x48')],'predictiveIntervalTotalCalls':_0xe73ba5[_0x2473('0x49')],'message':_0xe73ba5[_0x2473('0x4a')],'originated':_0xe73ba5[_0x2473('0x4b')],'erlangCalls':_0xe73ba5['erlangCalls'],'erlangCallToSecond':_0xe73ba5[_0x2473('0x4c')],'erlangAbandonmentRate':_0xe73ba5[_0x2473('0x4d')],'erlangBusyFactor':_0xe73ba5[_0x2473('0x4e')],'startPredictive':_0xe73ba5['startPredictive'],'startProgressive':_0xe73ba5[_0x2473('0x4f')]};if(_0xe73ba5[_0x2473('0x50')]){_0x132878[_0x2473('0x50')]={'id':_0xe73ba5['Trunk']['id'],'name':_0xe73ba5[_0x2473('0x50')][_0x2473('0x26')],'active':_0xe73ba5[_0x2473('0x50')][_0x2473('0x51')],'callerid':_0xe73ba5[_0x2473('0x50')]['callerid']};}if(_0xe73ba5[_0x2473('0x52')]){_0x132878[_0x2473('0x52')]={'id':_0xe73ba5[_0x2473('0x52')]['id'],'name':_0xe73ba5['Interval']['name']};}var _0x596cd1=md5(JSON[_0x2473('0x53')](_0x132878));if(_0xe73ba5['md5']!==_0x596cd1){_0xe73ba5[_0x2473('0x3')]=_0x596cd1;emit(util[_0x2473('0x54')](_0x2473('0x55'),_0x132878[_0x2473('0x26')]),_0x2473('0x56'),_0x132878);}}}function emitVoiceQueueChannelRemove(_0x2d114f){logger[_0x2473('0x57')](_0x2473('0x58'),JSON[_0x2473('0x53')](_0x2d114f));emit(util[_0x2473('0x54')]('voice:queue:%s',_0x2d114f[_0x2473('0x26')]),_0x2473('0x59'),_0x2d114f);this[_0x2473('0x24')](_0x2473('0x5a'),_0x2d114f);}function notSendMessagesQueue(_0x9ea883){if(_0x9ea883[_0x2473('0x5b')]){if(_0x9ea883[_0x2473('0x4b')]===0x0&&_0x9ea883['pTalking']===0x0){_0x9ea883['sendMessageOneNotActive']=![];_0x9ea883[_0x2473('0x28')]=0x0;_0x9ea883['paused']=0x0;_0x9ea883[_0x2473('0x4a')]=_0x2473('0x5c');ut[_0x2473('0x5d')](_0x2473('0x5e'),_0x9ea883[_0x2473('0x26')]+_0x2473('0x5f'));}else{_0x9ea883[_0x2473('0x4a')]='IS_DISACTIVED';ut[_0x2473('0x5d')](_0x2473('0x5e'),_0x9ea883[_0x2473('0x26')]+'\x20is\x20disactive');}emitCampaignPreview(_0x9ea883);}}Preview[_0x2473('0x60')][_0x2473('0x61')]=function(){var _0x5403c0=this;setInterval(function(){_0x5403c0[_0x2473('0x62')]();},0x7cf);};Preview[_0x2473('0x60')][_0x2473('0x62')]=function(){var _0x31537d=this[_0x2473('0x11')];this[_0x2473('0x63')]+=0x1;for(var _0x252c9d in _0x31537d){if(_0x31537d[_0x2473('0x64')](_0x252c9d)&&(_0x31537d[_0x252c9d][_0x2473('0x65')]==='preview'||_0x31537d[_0x252c9d][_0x2473('0x65')]===_0x2473('0x66'))&&_0x31537d[_0x252c9d]['type']==='outbound'){if(this[_0x2473('0x63')]>0x7){this[_0x2473('0x63')]=0x0;this[_0x2473('0x67')]();}}if(_0x31537d[_0x2473('0x64')](_0x252c9d)&&_0x31537d[_0x252c9d][_0x2473('0x65')]===_0x2473('0x7')&&_0x31537d[_0x252c9d][_0x2473('0x25')]===_0x2473('0x68')){if(_0x31537d[_0x252c9d][_0x2473('0x32')]){this[_0x2473('0x69')](_0x31537d[_0x252c9d]);this[_0x2473('0x6a')](_0x31537d[_0x252c9d]);}else{notSendMessagesQueue(_0x31537d[_0x252c9d]);}}}};Preview['prototype'][_0x2473('0x6b')]=function(_0x4f3b1d){var _0x5278ab=this;this['sequence'][_0x2473('0xe')](function(){if(!_[_0x2473('0x6c')](_0x5278ab['actions'][_0x4f3b1d])){loggerAction[_0x2473('0x57')](_0x2473('0x6d'),_0x4f3b1d,_0x2473('0x6e'),_0x5278ab[_0x2473('0x14')][_0x4f3b1d][_0x2473('0x6f')],'originated:\x20',JSON[_0x2473('0x53')](_0x5278ab[_0x2473('0x11')][_0x5278ab[_0x2473('0x14')][_0x4f3b1d][_0x2473('0x6f')]][_0x2473('0x4b')]),_0x2473('0x70'),JSON[_0x2473('0x53')](_0x5278ab[_0x2473('0x11')][_0x5278ab[_0x2473('0x14')][_0x4f3b1d][_0x2473('0x6f')]][_0x2473('0x2a')]),JSON[_0x2473('0x53')](_0x5278ab[_0x2473('0x14')][_0x4f3b1d][_0x2473('0x71')]),JSON[_0x2473('0x53')](_[_0x2473('0x72')](_0x5278ab[_0x2473('0x14')][_0x4f3b1d],[_0x2473('0x73'),_0x2473('0x74'),'VoiceQueueId',_0x2473('0x75')])));return ami[_0x2473('0x76')]({'action':_0x2473('0x77'),'channel':_0x5278ab[_0x2473('0x14')][_0x4f3b1d][_0x2473('0x78')]})[_0x2473('0x79')](function(_0x26912c){if(_0x26912c[_0x2473('0x4a')]===_0x2473('0x7a')){setTimeout(function(){if(_0x5278ab[_0x2473('0x14')][_0x4f3b1d]){ut[_0x2473('0x7b')](_0x5278ab[_0x2473('0x11')][_0x5278ab[_0x2473('0x14')][_0x4f3b1d]['queue']],'[clearZombieChannel]');if(_0x5278ab[_0x2473('0x14')][_0x4f3b1d]['dialAnswer']===!![]){ut[_0x2473('0x7c')](_0x5278ab['campaignsPreview'][_0x5278ab[_0x2473('0x14')][_0x4f3b1d][_0x2473('0x6f')]],_0x2473('0x7d'));ut[_0x2473('0x7e')](_0x2473('0x7f')+_0x4f3b1d,_0x5278ab[_0x2473('0x14')][_0x4f3b1d]['queue']);}ut['loggerError'](_0x2473('0x80')+_0x4f3b1d,_0x5278ab[_0x2473('0x14')][_0x4f3b1d][_0x2473('0x6f')]);delete _0x5278ab[_0x2473('0x14')][_0x4f3b1d];}},0x2328);}});}});};Preview['prototype'][_0x2473('0x67')]=function(){var _0x57a6ef=this;loggerAction[_0x2473('0x57')](_0x2473('0x81'),_[_0x2473('0x82')](this[_0x2473('0x14')]));for(var _0x4c8cf5 in this[_0x2473('0x14')]){if(_0x57a6ef['actions']['hasOwnProperty'](_0x4c8cf5)){_0x57a6ef[_0x2473('0x6b')](_0x4c8cf5);}}};Preview[_0x2473('0x60')]['recallMe']=function(_0x47f4ad){var _0x45615d=this;rpcDb[_0x2473('0x83')](_0x47f4ad['id'],ut[_0x2473('0x84')](this[_0x2473('0x15')]))[_0x2473('0x85')](function(_0x4aa06c){if(!_['isNil'](_0x4aa06c)){for(var _0x55cf30=0x0;_0x55cf30<_0x4aa06c['length'];_0x55cf30+=0x1){if(ut['getDiff'](_0x4aa06c[_0x55cf30][_0x2473('0x86')])<_0x47f4ad['dialRecallMeTimeout']*0x3c){if(_0x4aa06c[_0x55cf30][_0x2473('0x87')]&&!_0x4aa06c[_0x55cf30]['Agent'][_0x2473('0x88')]){_0x45615d[_0x2473('0x89')](_0x4aa06c[_0x55cf30]['id'])[_0x2473('0x85')](ut[_0x2473('0x8a')]('[RecallMe]'))[_0x2473('0x79')](ut['logger2'](_0x2473('0x8b')));}else{rpcDb['disableContact'](_0x4aa06c[_0x55cf30]['id']);}}else{var _0x12940b=new Action(_0x4aa06c[_0x55cf30],_0x47f4ad);_0x12940b['starttime']=moment()[_0x2473('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x47f4ad[_0x2473('0x8c')]+=0x1;ut[_0x2473('0x8d')](_0x12940b,0x17,_0x2473('0x8e'));if(_0x47f4ad[_0x2473('0x8f')]){rpcDb[_0x2473('0x90')](ut[_0x2473('0x91')](_0x4aa06c[_0x55cf30]));rpcDb[_0x2473('0x92')](_0x12940b,_0x2473('0x93'));}else{ut[_0x2473('0x8d')](_0x12940b,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x12940b,_0x2473('0x94'));rpcDb[_0x2473('0x95')](_0x12940b,'[HistoryRecallClose]');}}}}})[_0x2473('0x79')](ut[_0x2473('0x8a')](_0x2473('0x96')));};Preview[_0x2473('0x60')][_0x2473('0x69')]=function(_0x11a150){_0x11a150[_0x2473('0x5b')]=!![];if(ut[_0x2473('0x97')](_0x11a150[_0x2473('0x29')])){_0x11a150['message']=_0x2473('0x98');}else if(!ut['isActive'](_0x11a150[_0x2473('0x32')])){_0x11a150[_0x2473('0x4a')]=_0x2473('0x5c');}else if(!this[_0x2473('0x99')](_0x11a150[_0x2473('0x50')])){if(!this['isTrunkReachable'](_0x11a150['TrunkBackup'])){_0x11a150[_0x2473('0x4a')]=_0x2473('0x9a');}else{_0x11a150[_0x2473('0x4a')]=_0x2473('0x9b');}}else{_0x11a150[_0x2473('0x4a')]=_0x2473('0x9b');}emitCampaignPreview(_0x11a150);};Preview[_0x2473('0x60')][_0x2473('0x9c')]=function(_0x3247b1,_0x230518,_0x40c0a5){var _0x5435f0=this;var _0x2e3570=this['actions'][_0x230518];var _0x34252f=this['campaignsPreview'][_0x2e3570[_0x2473('0x6f')]];var _0x4f025e;if(_0x34252f){switch(_0x40c0a5){case'1':_0x34252f[_0x2473('0x3c')]+=0x1;_0x2e3570[_0x2473('0x9d')]+=0x1;_0x2e3570['countglobal']=ut[_0x2473('0x9e')](_0x2e3570);ut[_0x2473('0x8d')](_0x2e3570,0x0,_0x2473('0x9f'));ami[_0x2473('0x24')](_0x2473('0xa0'),ut[_0x2473('0xa1')](_0x2e3570,'nosuchnumber'));rpcDb[_0x2473('0x92')](_0x2e3570,_0x2473('0xa2'));if(ut[_0x2473('0x9e')](_0x2e3570)>=_0x34252f['dialGlobalMaxRetry']){_0x4f025e=ut['cloneAction'](_0x2e3570,0xf,_0x2473('0xa3'));rpcDb[_0x2473('0x95')](_0x4f025e,_0x2473('0xa4'));}else{if(_0x2e3570[_0x2473('0x9d')]>=_0x34252f['dialNoSuchNumberMaxRetry']){rpcDb[_0x2473('0x95')](_0x2e3570,_0x2473('0xa4'));}else{rpcDb[_0x2473('0xa5')](ut[_0x2473('0xa6')](_0x2e3570,'countnosuchnumberretry',_0x34252f[_0x2473('0xa7')]),_0x2e3570[_0x2473('0xa8')],_0x2e3570[_0x2473('0xa9')]);}}delete this[_0x2473('0x14')][_0x3247b1[_0x2473('0xaa')]];break;case _0x2473('0xab'):var _0x2eac8d=moment()[_0x2473('0x54')](_0x2473('0xac'));_0x2e3570['responsetime']=_0x2eac8d;_0x2e3570[_0x2473('0xad')]=_0x2eac8d;_0x2e3570['dialAnswer']=!![];_0x34252f[_0x2473('0x2a')]+=0x1;logger['info'](_0x2473('0xae'),_0x2e3570[_0x2473('0xaf')],_0x2473('0xb0'),_0x34252f[_0x2473('0x26')],'pTalking:\x20',_0x34252f['pTalking']);ami['emit']('custom:agentconnect',ut[_0x2473('0xa1')](_0x2e3570,'connect',this['campaignsPreview'][_0x2e3570[_0x2473('0x6f')]]));if(_0x34252f['acw']){ami[_0x2473('0x24')](_0x2473('0xb1'),ut['buildAcw'](_0x2e3570));}break;case'16':ami[_0x2473('0x24')](_0x2473('0xb2'),ut[_0x2473('0xa1')](_0x2e3570,_0x2473('0xb3'),this[_0x2473('0x11')][_0x2e3570[_0x2473('0x6f')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x2e3570,_0x2473('0xb3')));_0x34252f[_0x2473('0x37')]+=0x1;_0x34252f['total']+=0x1;_0x34252f[_0x2473('0x27')]+=0x1;ut['decrementTalkink'](_0x34252f,_0x2473('0xb4'));_0x2e3570[_0x2473('0xb5')]=ut[_0x2473('0x9e')](_0x2e3570);ut[_0x2473('0x8d')](_0x2e3570,0x4,_0x2473('0xb6'));rpcDb[_0x2473('0x92')](_0x2e3570,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x2473('0x95')](_0x2e3570,_0x2473('0xb7'));rpcDb['crateCustomerReportQueue'](_0x2e3570);_0x34252f['sumDuration']+=_0x2e3570[_0x2473('0xb8')];_0x34252f[_0x2473('0xb9')]+=_0x2e3570['talktime'];logger[_0x2473('0x57')](_0x2473('0xba'),_0x2e3570[_0x2473('0xaf')],_0x2473('0xb0'),_0x34252f['name'],'pTalking:\x20',_0x34252f['pTalking']);delete this[_0x2473('0x14')][_0x3247b1[_0x2473('0xaa')]];break;case _0x2473('0xbb'):_0x34252f[_0x2473('0x38')]+=0x1;_0x2e3570['countbusyretry']+=0x1;_0x2e3570['countglobal']=ut[_0x2473('0x9e')](_0x2e3570);ut[_0x2473('0x8d')](_0x2e3570,0x5,_0x2473('0xbc'));ami['emit']('custom:agentbusy',ut[_0x2473('0xa1')](_0x2e3570,'busy'));rpcDb[_0x2473('0x92')](_0x2e3570,_0x2473('0xbd'));if(ut[_0x2473('0x9e')](_0x2e3570)>=_0x34252f[_0x2473('0xbe')]){_0x4f025e=ut[_0x2473('0xbf')](_0x2e3570,0xf,_0x2473('0xa3'));rpcDb[_0x2473('0x95')](_0x4f025e,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x2e3570['countbusyretry']>=_0x34252f[_0x2473('0xc0')]){rpcDb[_0x2473('0x95')](_0x2e3570,_0x2473('0xbd'));}else{rpcDb[_0x2473('0xa5')](ut[_0x2473('0xa6')](_0x2e3570,_0x2473('0xc1'),_0x34252f['dialBusyRetryFrequency']),_0x2e3570[_0x2473('0xa8')],_0x2e3570[_0x2473('0xa9')]);}}break;case _0x2473('0xc2'):_0x34252f['outboundNoAnswerCallsDay']+=0x1;_0x2e3570['countnoanswerretry']+=0x1;_0x2e3570[_0x2473('0xb5')]=ut[_0x2473('0x9e')](_0x2e3570);ut[_0x2473('0x8d')](_0x2e3570,0x3,_0x2473('0xc3'));ami[_0x2473('0x24')](_0x2473('0xc4'),ut[_0x2473('0xa1')](_0x2e3570,_0x2473('0xc5')));rpcDb['createCustomerHistory'](_0x2e3570,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x2473('0x9e')](_0x2e3570)>=_0x34252f[_0x2473('0xbe')]){_0x4f025e=ut[_0x2473('0xbf')](_0x2e3570,0xf,_0x2473('0xa3'));rpcDb['createCustomerFinal'](_0x4f025e,_0x2473('0xc6'));}else{if(_0x2e3570[_0x2473('0xc7')]>=_0x34252f[_0x2473('0xc8')]){rpcDb[_0x2473('0x95')](_0x2e3570,_0x2473('0xc9'));}else{rpcDb[_0x2473('0xa5')](ut['scheduledAt'](_0x2e3570,'countnoanswerretry',_0x34252f[_0x2473('0xca')]),_0x2e3570['unlockAgent'],_0x2e3570[_0x2473('0xa9')]);}}break;case _0x2473('0xcb'):_0x34252f[_0x2473('0x39')]+=0x1;_0x2e3570[_0x2473('0xcc')]+=0x1;_0x2e3570[_0x2473('0xb5')]=ut['totalGlobal'](_0x2e3570);ut[_0x2473('0x8d')](_0x2e3570,0x8,'Congestion');ami[_0x2473('0x24')](_0x2473('0xcd'),ut[_0x2473('0xa1')](_0x2e3570,_0x2473('0xce')));rpcDb[_0x2473('0x92')](_0x2e3570,_0x2473('0xcf'));if(ut[_0x2473('0x9e')](_0x2e3570)>=_0x34252f[_0x2473('0xbe')]){_0x4f025e=ut[_0x2473('0xbf')](_0x2e3570,0xf,_0x2473('0xa3'));rpcDb[_0x2473('0x95')](_0x4f025e,_0x2473('0xd0'));}else{if(_0x2e3570[_0x2473('0xcc')]>=_0x34252f[_0x2473('0xd1')]){rpcDb[_0x2473('0x95')](_0x2e3570,_0x2473('0xcf'));}else{rpcDb[_0x2473('0xa5')](ut[_0x2473('0xa6')](_0x2e3570,'countcongestionretry',_0x34252f[_0x2473('0xd2')]),_0x2e3570[_0x2473('0xa8')],_0x2e3570['activeContact']);}}break;case _0x2473('0xd3'):_0x34252f[_0x2473('0x3e')]+=0x1;_0x2e3570[_0x2473('0xd4')]+=0x1;_0x2e3570[_0x2473('0xb5')]=ut[_0x2473('0x9e')](_0x2e3570);ut[_0x2473('0x8d')](_0x2e3570,0x14,'AgentReject');ami[_0x2473('0x24')](_0x2473('0xd5'),ut[_0x2473('0xa1')](_0x2e3570,_0x2473('0xd6')));rpcDb[_0x2473('0x92')](_0x2e3570,_0x2473('0xd7'));if(ut[_0x2473('0x9e')](_0x2e3570)>=_0x34252f[_0x2473('0xbe')]){_0x4f025e=ut['cloneAction'](_0x2e3570,0x14,'AgentReject');rpcDb[_0x2473('0x95')](_0x4f025e,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x2e3570[_0x2473('0xd4')]>=_0x34252f[_0x2473('0xd8')]){rpcDb[_0x2473('0x95')](_0x2e3570,_0x2473('0xd9'));}else{rpcDb['rescheduleContact'](ut[_0x2473('0xa6')](_0x2e3570,'countagentrejectretry',_0x34252f[_0x2473('0xda')]),_0x2e3570[_0x2473('0xa8')],_0x2e3570[_0x2473('0xa9')]);}}break;case _0x2473('0xdb'):_0x34252f['outboundAbandonedCallsDay']+=0x1;_0x2e3570['countabandonedretry']+=0x1;_0x2e3570[_0x2473('0xb5')]=ut['totalGlobal'](_0x2e3570);ut[_0x2473('0x8d')](_0x2e3570,0xb,_0x2473('0xdc'));rpcDb[_0x2473('0x92')](_0x2e3570,'[callProgressDetectingCustomer][logAbandoned]');if(ut['totalGlobal'](_0x2e3570)>=_0x34252f[_0x2473('0xbe')]){_0x4f025e=ut[_0x2473('0xbf')](_0x2e3570,0xf,_0x2473('0xa3'));rpcDb[_0x2473('0x95')](_0x4f025e,_0x2473('0xdd'));}else{if(_0x2e3570[_0x2473('0xde')]>=_0x34252f[_0x2473('0xdf')]){rpcDb[_0x2473('0x95')](_0x2e3570,_0x2473('0xdd'));}else{rpcDb['rescheduleContact'](ut[_0x2473('0xa6')](_0x2e3570,_0x2473('0xe0'),_0x34252f[_0x2473('0xe1')]),_0x2e3570[_0x2473('0xa8')],_0x2e3570[_0x2473('0xa9')]);}}break;default:if(_0x2e3570[_0x2473('0x71')]){ut[_0x2473('0x7c')](_0x34252f,_0x2473('0xe2'));ut['loggerError'](_0x2473('0xe3')+_0x34252f[_0x2473('0x26')],_0x3247b1);}_0x34252f[_0x2473('0x3f')]+=0x1;_0x2e3570[_0x2473('0xb5')]=ut[_0x2473('0x9e')](_0x2e3570);ut['logCustomer'](_0x2e3570,0xc,_0x3247b1[_0x2473('0xe4')]||_0x3247b1[_0x2473('0xe5')]);rpcDb[_0x2473('0x92')](_0x2e3570,_0x2473('0xe6'));if(ut[_0x2473('0x9e')](_0x2e3570)>=_0x34252f['dialGlobalMaxRetry']){_0x4f025e=ut[_0x2473('0xbf')](_0x2e3570,0xf,'Global');rpcDb[_0x2473('0x95')](_0x4f025e,_0x2473('0xe7'));}else{rpcDb['createCustomerFinal'](_0x2e3570,_0x2473('0xe7'));}delete this['actions'][_0x3247b1[_0x2473('0xaa')]];}if(!(_0x2e3570[_0x2473('0x71')]&&_0x40c0a5==='16')){ut[_0x2473('0x7b')](_0x34252f,_0x2473('0xe8'));logger[_0x2473('0x57')](_0x2473('0xe9'),_0x2e3570[_0x2473('0xaf')],'\x20Queue',_0x34252f[_0x2473('0x26')],_0x2473('0xea'),_0x34252f[_0x2473('0x4b')]);}if(_0x40c0a5!==_0x2473('0xab')){delete this[_0x2473('0x14')][_0x3247b1[_0x2473('0xaa')]];delete this[_0x2473('0x14')][_0x3247b1[_0x2473('0xeb')]];}}};Preview[_0x2473('0x60')]['callProgressDetectingAgent']=function(_0x18bc71,_0x116490,_0x266c4b){if(_[_0x2473('0xec')](_0x116490)&&'object'!==typeof _0x116490){return;}if(_[_0x2473('0xec')](_0x266c4b)&&_0x2473('0xed')!==typeof _0x266c4b){return;}switch(_0x266c4b['reason']){case'0':ut[_0x2473('0xee')](_0x18bc71,0x0,_0x2473('0x9f'));rpcDb['createAgentHistory'](_0x18bc71,_0x2473('0xef'));break;case'3':ut[_0x2473('0xee')](_0x18bc71,0x3,_0x2473('0xc3'));rpcDb[_0x2473('0xf0')](_0x18bc71,_0x2473('0xf1'));break;case'5':ut[_0x2473('0xee')](_0x18bc71,0x5,_0x2473('0xbc'));rpcDb['createAgentHistory'](_0x18bc71,_0x2473('0xf2'));break;case'8':ut[_0x2473('0xee')](_0x18bc71,0x8,_0x2473('0xf3'));rpcDb[_0x2473('0xf0')](_0x18bc71,_0x2473('0xf4'));break;case'22':ut[_0x2473('0xee')](_0x18bc71,0x16,_0x2473('0xf5'));rpcDb[_0x2473('0xf0')](_0x18bc71,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x2473('0xee')](_0x18bc71,0xc,_0x266c4b['reason']);rpcDb[_0x2473('0xf0')](_0x18bc71,_0x2473('0xf4'));}ut['updateOriginated'](_0x116490,_0x2473('0xf6'));logger['info'](_0x2473('0xf7'),_0x18bc71[_0x2473('0xaf')],_0x2473('0xb0'),_0x116490[_0x2473('0x26')],_0x2473('0xea'),_0x116490[_0x2473('0x4b')]);delete this[_0x2473('0x14')][_0x18bc71[_0x2473('0xaf')]];};Preview['prototype'][_0x2473('0xf8')]=function(_0x70a181,_0x55c346,_0x261459,_0x3af85d,_0x2d0637){var _0x22fe07=this;return new BPromise(function(_0x16dcb6,_0x5ab49e){if(_[_0x2473('0x6c')](_0x55c346)||_[_0x2473('0x6c')](_0x55c346[_0x2473('0xf9')])||_[_0x2473('0x6c')](_0x55c346[_0x2473('0xf9')][_0x2473('0xfa')])||_[_0x2473('0x6c')](_0x55c346[_0x2473('0xfb')])){_0x5ab49e(ut[_0x2473('0x4a')](_0x2473('0xfc'),_0x3af85d,_0x2d0637));return;}var _0x1d6e53=uuid['v4']();var _0x33e5e5=_0x22fe07[_0x2473('0x11')][_0x55c346['Queue'][_0x2473('0x26')]];var _0x2253a9=_0x261459?_0x22fe07[_0x2473('0x15')][_0x261459]['id']:undefined;_0x22fe07['actions'][_0x1d6e53]=new Action(_0x55c346,_0x33e5e5,_0x1d6e53,_0x261459,_0x2253a9);var _0x1b6bc8=_0x22fe07[_0x2473('0x14')][_0x1d6e53];_0x1b6bc8[_0x2473('0xa8')]=_0x3af85d;_0x1b6bc8[_0x2473('0xa9')]=_0x2d0637;_0x1b6bc8[_0x2473('0xfd')]=_0x261459;if(_[_0x2473('0xfe')](_0x70a181)){_0x22fe07[_0x2473('0xff')](_0x1b6bc8,_0x33e5e5,_0x55c346,_0x261459)[_0x2473('0x85')](function(_0xd21088){logger[_0x2473('0x57')](_0x2473('0x100'),_0x2473('0x101')+_0x1b6bc8[_0x2473('0x6f')]+_0x2473('0x102')+_0x1b6bc8['idContact'],JSON[_0x2473('0x53')](_0xd21088));ami['emit']('custom:agentcalled',ut[_0x2473('0xa1')](_0x1b6bc8,'called',_0x22fe07[_0x2473('0x11')][_0x1b6bc8['queue']]));_0x16dcb6(ut[_0x2473('0x4a')]('Calling'));})[_0x2473('0x79')](function(_0x33f565){ut[_0x2473('0x5d')](_0x2473('0x103'),_0x33f565);_0x5ab49e(ut[_0x2473('0x4a')](_0x2473('0x104'),_0x3af85d,_0x2d0637));});}else{_0x33e5e5[_0x2473('0x105')]+=0x1;ut[_0x2473('0x106')](_0x1b6bc8);rpcDb[_0x2473('0x107')](_0x1b6bc8,_0x2473('0x108'));delete _0x22fe07['actions'][_0x1d6e53];_0x5ab49e(ut[_0x2473('0x4a')](_0x2473('0x109'),_0x3af85d,_0x2d0637));}});};Preview[_0x2473('0x60')][_0x2473('0x99')]=function(_0x43d452){return!_['isNil'](_0x43d452)&&!_['isNil'](_0x43d452['name'])&&!_[_0x2473('0x6c')](_0x43d452[_0x2473('0x51')])&&_0x43d452[_0x2473('0x51')]&&!_['isNil'](this[_0x2473('0x13')][util[_0x2473('0x54')](_0x2473('0x10a'),_0x43d452['name'])])&&!_[_0x2473('0x6c')](this['trunks'][util[_0x2473('0x54')](_0x2473('0x10a'),_0x43d452[_0x2473('0x26')])][_0x2473('0x77')])&&(this['trunks'][util[_0x2473('0x54')](_0x2473('0x10a'),_0x43d452[_0x2473('0x26')])][_0x2473('0x77')]===_0x2473('0x10b')||this[_0x2473('0x13')][util['format']('SIP/%s',_0x43d452[_0x2473('0x26')])]['status']===_0x2473('0x10c'));};Preview['prototype']['run']=function(_0xae77fc,_0x3c1df8){var _0x327950=this;return new BPromise(function(_0x1e4762,_0x3cbe63){_0x327950['execRun'](_0xae77fc,_0x3c1df8)[_0x2473('0x85')](function(_0x5ab5e4){_0x1e4762(_[_0x2473('0x72')](_0x5ab5e4,[_0x2473('0x4a')]));})[_0x2473('0x79')](function(_0x1f69cb){if(_0x1f69cb[_0x2473('0x10d')]){rpcDb[_0x2473('0x10e')](_0xae77fc);}if(_0x1f69cb[_0x2473('0x51')]){rpcDb[_0x2473('0x10f')](_0xae77fc);}_0x3cbe63(_['pick'](_0x1f69cb,['message']));});});};Preview[_0x2473('0x60')][_0x2473('0x110')]=function(_0x2f3321,_0x12d47c){var _0x440684=this;return new BPromise(function(_0x157ac2,_0x5daaa0){var _0x593edd,_0x3eb205;rpcDb[_0x2473('0x111')](_0x2f3321)['then'](function(_0x4b1265){if(!_[_0x2473('0x6c')](_0x4b1265[0x0])){_0x3eb205=_0x4b1265[0x0][_0x2473('0x112')]?![]:!![];_0x593edd=_0x4b1265[0x0][_0x2473('0x112')]?!![]:![];_0x593edd=_0x12d47c?!![]:_0x593edd;}var _0x6c4b3e=_0x440684['validateContact'](_0x4b1265);if(_0x6c4b3e[_0x2473('0x113')]){rpcDb['checkIsBlackList'](_[_0x2473('0x72')](_0x4b1265[0x0],[_0x2473('0xfb'),'Contact.phone']))[_0x2473('0x85')](function(_0xe73a5e){_0x440684[_0x2473('0xf8')](_0xe73a5e,_0x4b1265[0x0],_0x12d47c,_0x3eb205,_0x593edd)[_0x2473('0x85')](function(_0x2e9967){_0x157ac2(_0x2e9967);})[_0x2473('0x79')](function(_0x259c17){_0x5daaa0(_0x259c17);});})[_0x2473('0x79')](function(_0x45c79f){ut[_0x2473('0x5d')](_0x2473('0x114'),_0x45c79f);_0x5daaa0(ut[_0x2473('0x4a')](_0x2473('0x115'),_0x3eb205,_0x593edd));});}else{_0x5daaa0(ut[_0x2473('0x4a')](_0x6c4b3e[_0x2473('0x4a')],_0x3eb205,_0x593edd));}})[_0x2473('0x79')](function(_0x48a775){ut['logger']('[Preview][getContactPreview]',_0x48a775);_0x5daaa0(ut[_0x2473('0x4a')](_0x2473('0x115'),![],!![]));});});};Preview[_0x2473('0x60')][_0x2473('0x116')]=function(_0x382931){if(_[_0x2473('0x6c')](_0x382931)||_['isEmpty'](_0x382931)||!_[_0x2473('0x6c')](_0x382931[0x0][_0x2473('0x87')])&&_['isNil'](_0x382931[0x0][_0x2473('0x87')][_0x2473('0x26')])){ut['logger'](_0x2473('0x117'),_0x382931);return{'isValid':![],'message':_0x2473('0x118')};}var _0x1d00b8=this[_0x2473('0x11')][_0x382931[0x0][_0x2473('0x6e')][_0x2473('0x26')]];_0x1d00b8[_0x2473('0x4a')]='ACTIVE';if(_[_0x2473('0x6c')](_0x1d00b8)){ut[_0x2473('0x5d')](_0x2473('0x119'),_0x1d00b8);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0x2473('0x99')](_0x1d00b8[_0x2473('0x50')])){ut[_0x2473('0x5d')](_0x2473('0x11a'),_0x2473('0x11b')+_0x1d00b8[_0x2473('0x26')]+_0x2473('0x11c'));if(!this[_0x2473('0x99')](_0x1d00b8[_0x2473('0x11d')])){ut['logger'](_0x2473('0x11a'),_0x1d00b8[_0x2473('0x26')]+_0x2473('0x11e'));return{'isValid':![],'message':_0x2473('0x11f')};}}if(!ut['isActive'](_0x1d00b8[_0x2473('0x32')])){ut[_0x2473('0x5d')]('[Preview][validateContact][Campaign\x20Active]',_0x1d00b8['name']+'\x20Not\x20Active');return{'isValid':![],'message':_0x2473('0x11b')+_0x1d00b8[_0x2473('0x26')]+_0x2473('0x120')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x2473('0x60')][_0x2473('0xff')]=function(_0x19f1ae,_0x34c3b5,_0x19b82a,_0x41c228){var _0x30dff3=this;return new BPromise(function(_0x383825,_0x3d2201){var _0x1b2370=_0x19f1ae[_0x2473('0xaf')];var _0xcfafe4=_0x30dff3[_0x2473('0x99')](_0x34c3b5['Trunk'])?util[_0x2473('0x54')](_0x2473('0x121'),_0x34c3b5['Trunk'][_0x2473('0x26')],_[_0x2473('0x6c')](_0x34c3b5[_0x2473('0x35')])?'':_0x34c3b5[_0x2473('0x35')][_0x2473('0x122')]()||'',_0x34c3b5[_0x2473('0x123')]>0x0?_0x19b82a[_0x2473('0xf9')]['phone']['substring'](_0x34c3b5[_0x2473('0x123')]):_0x19b82a[_0x2473('0xf9')][_0x2473('0xfa')]):util['format'](_0x2473('0x121'),_['isNil'](_0x34c3b5['TrunkBackup'])?_0x34c3b5['Trunk'][_0x2473('0x26')]:_0x34c3b5['TrunkBackup'][_0x2473('0x26')],_[_0x2473('0x6c')](_0x34c3b5[_0x2473('0x35')])?'':_0x34c3b5['dialPrefix'][_0x2473('0x122')]()||'',_0x34c3b5[_0x2473('0x123')]>0x0?_0x19b82a[_0x2473('0xf9')][_0x2473('0xfa')][_0x2473('0x124')](_0x34c3b5[_0x2473('0x123')]):_0x19b82a[_0x2473('0xf9')]['phone']);var _0x225946=_0x30dff3[_0x2473('0x99')](_0x34c3b5[_0x2473('0x50')])?ut[_0x2473('0x125')](_0x34c3b5[_0x2473('0x50')][_0x2473('0x126')],_0x34c3b5[_0x2473('0x33')],_0x34c3b5[_0x2473('0x127')]>0x0?ut['getCallerIdRandom'](_0x34c3b5[_0x2473('0x34')],_0x34c3b5[_0x2473('0x127')]):_0x34c3b5[_0x2473('0x34')]):ut[_0x2473('0x125')](_[_0x2473('0x6c')](_0x34c3b5[_0x2473('0x11d')])?_0x34c3b5['Trunk'][_0x2473('0x126')]:_0x34c3b5[_0x2473('0x11d')]['callerid'],_0x34c3b5[_0x2473('0x33')],_0x34c3b5[_0x2473('0x127')]>0x0?ut[_0x2473('0x128')](_0x34c3b5[_0x2473('0x34')],_0x34c3b5[_0x2473('0x127')]):_0x34c3b5['dialOriginateCallerIdNumber']);if(_0x225946){_0x19f1ae['originatecalleridname']=ut[_0x2473('0x129')](_0x225946);_0x19f1ae[_0x2473('0x12a')]=ut['extractCalleridNumber'](_0x225946);}var _0x3f62d3=ut[_0x2473('0x12b')](_0x34c3b5,_0x19b82a,_0xcfafe4,_0x225946,_0x1b2370,_0x19f1ae);_[_0x2473('0x12c')](_0x19f1ae,ut['toLowerVariables'](_0x3f62d3));_0x19f1ae[_0x2473('0x12d')]=moment()[_0x2473('0x54')](_0x2473('0xac'));ami['Action'](ut['variablesAction'](_0x19f1ae,_0x34c3b5,_0x3f62d3,_0x19f1ae['activeContact'],_0x41c228))[_0x2473('0x85')](function(_0x1fb32b){_0x34c3b5[_0x2473('0x4b')]+=0x1;logger[_0x2473('0x57')](_0x2473('0x12e'),_0x1b2370,_0x2473('0xb0'),_0x34c3b5['name'],_0x2473('0xea'),_0x34c3b5[_0x2473('0x4b')]);_0x383825(_0x1fb32b);})['catch'](function(_0x58da10){ut[_0x2473('0xee')](_0x19f1ae,0xe,_0x2473('0x12f'));rpcDb['createAgentHistory'](_0x19f1ae,'[originateFailure][logOriginateFailure]');_0x3d2201(_0x58da10);});});};Preview[_0x2473('0x60')][_0x2473('0x1e')]=function(_0xfc7830){if(this['actions'][_0xfc7830[_0x2473('0xaa')]]){this['actions'][_0xfc7830['linkedid']][_0x2473('0x78')]=_0xfc7830[_0x2473('0x78')];}};Preview[_0x2473('0x60')]['syncOriginateResponse']=function(_0x4dd293){var _0x324683=this;var _0x877e06=this['actions'][_0x4dd293[_0x2473('0x130')]];if(_0x877e06){if(_0x877e06[_0x2473('0xfd')]&&this['agents'][_0x877e06[_0x2473('0xfd')]]){ut['logLookAgent'](_0x877e06,this[_0x2473('0x15')][_0x877e06['lookAgent']][_0x2473('0x26')],this[_0x2473('0x15')][_0x877e06[_0x2473('0xfd')]]['id']);}var _0x2876d4=_[_0x2473('0x131')](_0x877e06);_0x2876d4['responsetime']=moment()[_0x2473('0x54')]('YYYY-MM-DD\x20HH:mm:ss');var _0x37ce89=_0x324683['campaignsPreview'][_0x877e06[_0x2473('0x6f')]];if(ut['isFailure'](_0x4dd293[_0x2473('0x132')])){if(_0x877e06[_0x2473('0xa8')]){rpcDb[_0x2473('0x10e')](_0x877e06[_0x2473('0x133')]);}if(_0x877e06['activeContact']){rpcDb[_0x2473('0x10f')](_0x877e06[_0x2473('0x133')]);}ami[_0x2473('0x24')](_0x2473('0x134'),ut['buildObj'](_0x877e06,'rejected',this[_0x2473('0x11')][_0x877e06['queue']]));this[_0x2473('0x135')](_0x2876d4,_0x37ce89,_0x4dd293);}else{_0x877e06['starttime']=moment()[_0x2473('0x54')](_0x2473('0xac'));ut['logAgent'](_0x2876d4,0x4,_0x2473('0xb6'));rpcDb[_0x2473('0xf0')](_0x2876d4,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x2473('0x60')]['syncHangup']=function(_0x153fbe){var _0x25172a=this;var _0x4b4419=this[_0x2473('0x14')][_0x153fbe['linkedid']];var _0x468955;if(_0x4b4419){_0x468955=this[_0x2473('0x11')][_0x4b4419[_0x2473('0x6f')]];logger[_0x2473('0x57')]('[syncHangup][talking]',_0x153fbe['linkedid'],_0x2473('0xb0'),_0x468955['name'],_0x2473('0x70'),_0x468955[_0x2473('0x2a')]);}if(this[_0x2473('0x14')][_0x153fbe['linkedid']]&&_0x153fbe[_0x2473('0xaa')]!==_0x153fbe[_0x2473('0xaf')]){if(_0x153fbe['cause']==='16'&&this[_0x2473('0x14')][_0x153fbe['linkedid']][_0x2473('0x71')]){this[_0x2473('0x9c')](_0x153fbe,_0x153fbe[_0x2473('0xaa')],_0x153fbe[_0x2473('0x136')]);}else if(this[_0x2473('0x14')][_0x153fbe[_0x2473('0xaa')]][_0x2473('0x71')]){logger[_0x2473('0x57')](_0x2473('0x137'),_0x153fbe['linkedid'],_0x153fbe[_0x2473('0x136')],_0x2473('0xb0'),_0x468955[_0x2473('0x26')],_0x2473('0x70'),_0x468955['pTalking']);this['callProgressDetectingCustomer'](_0x153fbe,_0x153fbe[_0x2473('0xaa')],_0x153fbe[_0x2473('0x136')]);}}else if(_0x4b4419&&_['isNil'](_0x4b4419[_0x2473('0x138')])&&_0x468955[_0x2473('0x139')]&&_0x153fbe['linkedid']===_0x153fbe[_0x2473('0xaf')]&&_[_0x2473('0x6c')](_0x153fbe['reason'])&&_0x153fbe[_0x2473('0x136')]==='16'&&_0x153fbe[_0x2473('0x13a')]==='6'&&_[_0x2473('0xec')](_0x4b4419['transfer'])){if(_0x4b4419[_0x2473('0xa8')]){rpcDb[_0x2473('0x10e')](_0x4b4419[_0x2473('0x133')]);}if(_0x4b4419[_0x2473('0xa9')]){rpcDb[_0x2473('0x10f')](_0x4b4419[_0x2473('0x133')]);}_0x153fbe[_0x2473('0x13b')]='22';this[_0x2473('0x135')](_0x4b4419,_0x468955,_0x153fbe);}else if(_0x4b4419&&_0x4b4419['transfer']){if(_0x153fbe[_0x2473('0x136')]==='16'&&this[_0x2473('0x14')][_0x153fbe[_0x2473('0xaa')]][_0x2473('0x71')]){logger['info']('[syncHangup][talking][transfer]',_0x153fbe[_0x2473('0xaa')],_0x153fbe[_0x2473('0x136')],'\x20Queue',_0x468955[_0x2473('0x26')],_0x2473('0x70'),_0x468955[_0x2473('0x2a')]);this['callProgressDetectingCustomer'](_0x153fbe,_0x153fbe['linkedid'],_0x153fbe['cause']);}else if(this[_0x2473('0x14')][_0x153fbe['linkedid']][_0x2473('0x71')]){logger[_0x2473('0x57')](_0x2473('0x137'),_0x153fbe[_0x2473('0xaa')],_0x153fbe[_0x2473('0x136')],_0x2473('0xb0'),_0x468955[_0x2473('0x26')],_0x2473('0x70'),_0x468955['pTalking']);this[_0x2473('0x9c')](_0x153fbe,_0x153fbe['linkedid'],_0x153fbe[_0x2473('0x136')]);}}};Preview[_0x2473('0x60')][_0x2473('0x1c')]=function(_0x48e8af){if(this[_0x2473('0x14')][_0x48e8af[_0x2473('0xeb')]]&&_0x48e8af[_0x2473('0xeb')]!==_0x48e8af[_0x2473('0x13c')]){this['callProgressDetectingCustomer'](_0x48e8af,_0x48e8af[_0x2473('0xeb')],_0x48e8af[_0x2473('0xe5')]);}};Preview['prototype'][_0x2473('0x1a')]=function(_0x17d864){if(this[_0x2473('0x14')][_0x17d864['linkedid']]&&_0x17d864['linkedid']!==_0x17d864[_0x2473('0xaf')]&&!this['actions'][_0x17d864[_0x2473('0xaa')]][_0x2473('0x71')]){if(_0x17d864[_0x2473('0x136')]==='1'){this[_0x2473('0x9c')](_0x17d864,_0x17d864[_0x2473('0xaa')],_0x17d864[_0x2473('0x136')]);}}};Preview[_0x2473('0x60')][_0x2473('0x13d')]=function(_0x511326,_0x1057ae,_0x2daa31){if(this[_0x2473('0x14')][_0x511326]){if(_[_0x2473('0x6c')](this[_0x2473('0x14')][_0x511326][_0x2473('0x13e')])){this[_0x2473('0x14')][_0x511326][_0x2473('0x13e')]={};}this['actions'][_0x511326][_0x2473('0x13e')][_0x1057ae]=_0x2daa31;}};Preview[_0x2473('0x60')]['syncVarSet']=function(_0x2d7be8){try{if(!_[_0x2473('0x6c')](_0x2d7be8)){if(ut[_0x2473('0x13f')](_[_0x2473('0x140')](_0x2d7be8[_0x2473('0x141')])[0x0])){this[_0x2473('0x13d')](_0x2d7be8[_0x2473('0xaf')],_['keys'](_0x2d7be8[_0x2473('0x141')])[0x0],_0x2d7be8[_0x2473('0x142')]);}}}catch(_0x477760){logger[_0x2473('0x143')](_0x2473('0x144'),util[_0x2473('0x145')](_0x477760,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x2473('0x21')]=function(_0x9adb03){if(_0x9adb03){if(this['actions'][_0x9adb03['transfertargetlinkedid']]){this['actions'][_0x9adb03[_0x2473('0x146')]][_0x2473('0x147')]=!![];}}};Preview[_0x2473('0x60')][_0x2473('0x23')]=function(_0x173d7d){if(_0x173d7d){if(this[_0x2473('0x14')][_0x173d7d[_0x2473('0x148')]]){this['actions'][_0x173d7d[_0x2473('0x148')]]['transfer']=!![];}}};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 ded0878..e0db9d5 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 _0x5089=['rescheduleContactInQueue','rescheduleContact','[rescheduleContactInQueue]\x20','util','bluebird','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/voiceQueueReport','inspect','then','createHistory','[createHistory]\x20','resolve','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','from-sip','exten','xcally-motion-preview','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20'];(function(_0x4ca796,_0x10dc47){var _0x171f87=function(_0x198d29){while(--_0x198d29){_0x4ca796['push'](_0x4ca796['shift']());}};_0x171f87(++_0x10dc47);}(_0x5089,0x1bb));var _0x9508=function(_0x2a8860,_0x2da926){_0x2a8860=_0x2a8860-0x0;var _0x2f47a4=_0x5089[_0x2a8860];return _0x2f47a4;};'use strict';var util=require(_0x9508('0x0'));var BPromise=require(_0x9508('0x1'));var logger=require('../../../config/logger')(_0x9508('0x2'));var _=require(_0x9508('0x3'));var cmHopper=require(_0x9508('0x4'));var cmHopperFinal=require(_0x9508('0x5'));var cmHopperHistory=require(_0x9508('0x6'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x9508('0x7'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x9508('0x8'));function loggerCatch(_0x4538dd){return function(_0x257318){logger['error'](_0x4538dd,util[_0x9508('0x9')](_0x257318,{'showHidden':![],'depth':null}));};}function create(_0x42d13a){return BPromise['resolve']()[_0x9508('0xa')](cmHopperHistory[_0x9508('0xb')](_0x42d13a))['catch'](loggerCatch(_0x9508('0xc')));}function createAgent(_0x5c9dc9){return BPromise[_0x9508('0xd')]()[_0x9508('0xa')](agentReportPreview[_0x9508('0xb')](_0x5c9dc9))[_0x9508('0xe')](loggerCatch(_0x9508('0xc')));}function moveContact(_0x317f6e){return BPromise['resolve']()[_0x9508('0xa')](cmHopper['moveContactManagedDialer'](_0x317f6e,!![]))[_0x9508('0xe')](loggerCatch(_0x9508('0xf')));}exports['checkIsBlackList']=function(_0x11dc7f){return BPromise[_0x9508('0xd')]()[_0x9508('0xa')](cmHopperBlack[_0x9508('0x10')](_0x11dc7f))['catch'](loggerCatch(_0x9508('0x11')));};exports[_0x9508('0x12')]=function(_0x51c80b){return BPromise[_0x9508('0xd')]()['then'](cmHopper[_0x9508('0x12')](_0x51c80b))[_0x9508('0xe')](loggerCatch(_0x9508('0x13')));};exports[_0x9508('0xb')]=function(_0x127340,_0x343802){create(_0x127340)[_0x9508('0xe')](loggerCatch(_0x343802));moveContact(_0x127340)[_0x9508('0xe')](loggerCatch(_0x343802));};exports['createAgentHistory']=function(_0x22ba9c,_0x378749){createAgent(_0x22ba9c)[_0x9508('0xe')](loggerCatch(_0x378749));};exports[_0x9508('0x14')]=function(_0x23c30e,_0x22a9fe){create(_0x23c30e)['catch'](loggerCatch(_0x22a9fe));};exports['createCustomerFinal']=function(_0x17e43c,_0x47f7a2){moveContact(_0x17e43c)[_0x9508('0xe')](loggerCatch(_0x47f7a2));};exports['rescheduleContact']=function(_0x3ba927,_0x22ff69,_0x226f29){if(_0x22ff69){_0x3ba927[_0x9508('0x15')]=null;}if(_0x226f29){_0x3ba927[_0x9508('0x16')]=![];}return BPromise[_0x9508('0xd')]()[_0x9508('0xa')](cmHopper['rescheduleContact'](_0x3ba927))['catch'](loggerCatch(_0x9508('0x17')));};exports[_0x9508('0x18')]=function(_0x39e6b0){return BPromise[_0x9508('0xd')]()[_0x9508('0xa')](cmHopper[_0x9508('0x18')](_0x39e6b0))['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0x9508('0x19')]=function(_0x55cc4d){return BPromise['resolve']()[_0x9508('0xa')](cmHopper['unlockContact']({'UserId':null},_0x55cc4d,0x1))['catch'](loggerCatch(_0x9508('0x1a')));};exports[_0x9508('0x1b')]=function(_0x57c7ae){return BPromise[_0x9508('0xd')]()[_0x9508('0xa')](cmHopper[_0x9508('0x19')]({'active':![]},_0x57c7ae,0x1))[_0x9508('0xe')](loggerCatch(_0x9508('0x1c')));};exports[_0x9508('0x1d')]=function(_0x15c32e){var _0x1daca0={};_0x1daca0[_0x9508('0x1e')]=_0x15c32e[_0x9508('0x1e')];_0x1daca0[_0x9508('0x1f')]=_0x15c32e['uniqueid'];_0x1daca0[_0x9508('0x20')]=_0x15c32e[_0x9508('0x20')];_0x1daca0[_0x9508('0x21')]=_0x15c32e['calleridname'];_0x1daca0[_0x9508('0x22')]=_0x15c32e[_0x9508('0x22')];_0x1daca0['queuecallerjoinAt']=_0x15c32e[_0x9508('0x23')];_0x1daca0[_0x9508('0x24')]=_0x15c32e['answertime'];_0x1daca0[_0x9508('0x25')]=0x1;_0x1daca0[_0x9508('0x26')]=_0x15c32e[_0x9508('0x27')];_0x1daca0[_0x9508('0x28')]=_0x15c32e['membername'];_0x1daca0['context']=_0x9508('0x29');_0x1daca0[_0x9508('0x2a')]=_0x9508('0x2b');_0x1daca0['holdtime']=0x0;_0x1daca0['assigned']=0x1;_0x1daca0[_0x9508('0x2c')]=_0x15c32e[_0x9508('0x2d')];_0x1daca0[_0x9508('0x2e')]=_0x9508('0x2f');return BPromise[_0x9508('0xd')]()[_0x9508('0xa')](voiceQueueReport[_0x9508('0x30')](_0x1daca0))[_0x9508('0xe')](loggerCatch(_0x9508('0x31')));};exports[_0x9508('0x32')]=function(_0x4a34d2,_0x17ca13){return BPromise[_0x9508('0xd')]()['then'](cmHopper[_0x9508('0x32')](_0x4a34d2,_0x17ca13))[_0x9508('0xe')](loggerCatch(_0x9508('0x33')));};exports[_0x9508('0x34')]=function(_0x282f83){return BPromise[_0x9508('0xd')]()[_0x9508('0xa')](cmHopper[_0x9508('0x35')](_0x282f83,!![],!![]))[_0x9508('0xe')](loggerCatch(_0x9508('0x36')));}; \ No newline at end of file +var _0xee14=['uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','inspect','resolve','then','createHistory','[createHistory]\x20','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','[unlockContact]\x20','disableContact','unlockContact','[activeContact]\x20','type'];(function(_0x17a892,_0x633513){var _0x50de65=function(_0x3a047e){while(--_0x3a047e){_0x17a892['push'](_0x17a892['shift']());}};_0x50de65(++_0x633513);}(_0xee14,0x13a));var _0x4ee1=function(_0x4d29a2,_0x55f6eb){_0x4d29a2=_0x4d29a2-0x0;var _0xa20395=_0xee14[_0x4d29a2];return _0xa20395;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x4ee1('0x0'))(_0x4ee1('0x1'));var _=require(_0x4ee1('0x2'));var cmHopper=require(_0x4ee1('0x3'));var cmHopperFinal=require(_0x4ee1('0x4'));var cmHopperHistory=require(_0x4ee1('0x5'));var cmHopperBlack=require(_0x4ee1('0x6'));var voiceQueueRt=require(_0x4ee1('0x7'));var agentReportPreview=require(_0x4ee1('0x8'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0xba6d36){return function(_0x573700){logger[_0x4ee1('0x9')](_0xba6d36,util[_0x4ee1('0xa')](_0x573700,{'showHidden':![],'depth':null}));};}function create(_0x187656){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopperHistory[_0x4ee1('0xd')](_0x187656))['catch'](loggerCatch(_0x4ee1('0xe')));}function createAgent(_0x38be25){return BPromise['resolve']()[_0x4ee1('0xc')](agentReportPreview[_0x4ee1('0xd')](_0x38be25))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0xe')));}function moveContact(_0x5cbcb0){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper[_0x4ee1('0x10')](_0x5cbcb0,!![]))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x11')));}exports[_0x4ee1('0x12')]=function(_0x5616d6){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopperBlack[_0x4ee1('0x12')](_0x5616d6))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x13')));};exports[_0x4ee1('0x14')]=function(_0x2ffb2d){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper['getContactPreview'](_0x2ffb2d))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x15')));};exports[_0x4ee1('0xd')]=function(_0x1b1e0e,_0x123c5e){create(_0x1b1e0e)[_0x4ee1('0xf')](loggerCatch(_0x123c5e));moveContact(_0x1b1e0e)[_0x4ee1('0xf')](loggerCatch(_0x123c5e));};exports[_0x4ee1('0x16')]=function(_0x360056,_0x3a0967){createAgent(_0x360056)[_0x4ee1('0xf')](loggerCatch(_0x3a0967));};exports['createCustomerHistory']=function(_0x236215,_0x3db827){create(_0x236215)[_0x4ee1('0xf')](loggerCatch(_0x3db827));};exports[_0x4ee1('0x17')]=function(_0x43f9a2,_0x383ab0){moveContact(_0x43f9a2)['catch'](loggerCatch(_0x383ab0));};exports[_0x4ee1('0x18')]=function(_0x333e96,_0x46611a,_0x3f0d59){if(_0x46611a){_0x333e96[_0x4ee1('0x19')]=null;}if(_0x3f0d59){_0x333e96[_0x4ee1('0x1a')]=![];}return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper[_0x4ee1('0x18')](_0x333e96))[_0x4ee1('0xf')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x14110c){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper[_0x4ee1('0x1b')](_0x14110c))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x1c')));};exports['unlockContact']=function(_0x5cc0b5){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper['unlockContact']({'UserId':null},_0x5cc0b5,0x1))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x1d')));};exports[_0x4ee1('0x1e')]=function(_0x215949){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper[_0x4ee1('0x1f')]({'active':![]},_0x215949,0x1))['catch'](loggerCatch(_0x4ee1('0x20')));};exports['crateCustomerReportQueue']=function(_0x4746c2){var _0x4ec408={};_0x4ec408[_0x4ee1('0x21')]=_0x4746c2[_0x4ee1('0x21')];_0x4ec408[_0x4ee1('0x22')]=_0x4746c2[_0x4ee1('0x22')];_0x4ec408[_0x4ee1('0x23')]=_0x4746c2['calleridnum'];_0x4ec408[_0x4ee1('0x24')]=_0x4746c2['calleridname'];_0x4ec408[_0x4ee1('0x25')]=_0x4746c2[_0x4ee1('0x25')];_0x4ec408[_0x4ee1('0x26')]=_0x4746c2[_0x4ee1('0x27')];_0x4ec408[_0x4ee1('0x28')]=_0x4746c2['answertime'];_0x4ec408[_0x4ee1('0x29')]=0x1;_0x4ec408[_0x4ee1('0x2a')]=_0x4746c2[_0x4ee1('0x2b')];_0x4ec408[_0x4ee1('0x2c')]=_0x4746c2[_0x4ee1('0x2d')];_0x4ec408[_0x4ee1('0x2e')]='from-sip';_0x4ec408['exten']=_0x4ee1('0x2f');_0x4ec408[_0x4ee1('0x30')]=0x0;_0x4ec408[_0x4ee1('0x31')]=0x1;_0x4ec408['lastAssignedTo']=_0x4746c2[_0x4ee1('0x2d')];_0x4ec408[_0x4ee1('0x32')]=_0x4ee1('0x33');return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](voiceQueueReport[_0x4ee1('0x34')](_0x4ec408))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x35')));};exports[_0x4ee1('0x36')]=function(_0x3cc595,_0x4445d0){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper['getContactRecallMe'](_0x3cc595,_0x4445d0))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x37')));};exports[_0x4ee1('0x38')]=function(_0x50539f){return BPromise['resolve']()[_0x4ee1('0xc')](cmHopper[_0x4ee1('0x18')](_0x50539f,!![],!![]))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x39')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 81a3cda..71b3f92 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 _0xc9c3=['NONE','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','updatedAt','%s%s','XMD-','toUpper','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','logAgent','statedesc','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','variablesAction','calleridname','uniqueid','channelAgent','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','scheduledat','add','minutes','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','name','queue','interface','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','reachable','getDiff','createBody','idContact','dialAnswer','active','countglobal','callback','callbackuniqueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosjitterbridged','bridgepeer','\x5cw{0,','pow','replace','match','extractCalleridNumber','lodash','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','logger','info','inspect','loggerError','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isNil','Queue','calleridnum','ContactId','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialQueueProject','\x22agi://%s/square,%s\x22'];(function(_0x4ceeb9,_0x43ffe0){var _0x8f988e=function(_0x55df27){while(--_0x55df27){_0x4ceeb9['push'](_0x4ceeb9['shift']());}};_0x8f988e(++_0x43ffe0);}(_0xc9c3,0x159));var _0x3c9c=function(_0x4d4df3,_0xd59407){_0x4d4df3=_0x4d4df3-0x0;var _0x3af292=_0xc9c3[_0x4d4df3];return _0x3af292;};'use strict';var util=require('util');var _=require(_0x3c9c('0x0'));var moment=require(_0x3c9c('0x1'));var logger=require(_0x3c9c('0x2'))('preview');var ipAgi=process[_0x3c9c('0x3')][_0x3c9c('0x4')]||_0x3c9c('0x5');function getSeconds(_0x33af29,_0x599f49){var _0xb5ccc=moment(_0x33af29)['milliseconds'](0x0);var _0x15df8f=moment(_0x599f49)[_0x3c9c('0x6')](0x0);return _0xb5ccc[_0x3c9c('0x7')](_0x15df8f,_0x3c9c('0x8'));}exports[_0x3c9c('0x9')]=function(_0x2f564e){return function(_0x426d37){logger[_0x3c9c('0xa')](_0x2f564e,util['inspect'](_0x426d37,{'showHidden':![],'depth':null}));};};exports[_0x3c9c('0xb')]=function(_0x5359c5,_0x1619f2){logger[_0x3c9c('0xc')](_0x5359c5,util[_0x3c9c('0xd')](_0x1619f2,{'showHidden':![],'depth':null}));};exports[_0x3c9c('0xe')]=function(_0x398b98,_0x1c1129){logger[_0x3c9c('0xa')](_0x398b98,util[_0x3c9c('0xd')](_0x1c1129,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x102b8e){return function(_0x34befb){logger['info'](_0x102b8e,util[_0x3c9c('0xd')](_0x34befb,{'showHidden':![],'depth':null}));};};exports[_0x3c9c('0xf')]=function(_0x3f7803,_0x51f4c8,_0x40d10b){return{'message':_0x3f7803,'unlock':_0x51f4c8,'active':_0x40d10b};};exports[_0x3c9c('0x10')]=function(_0x4a1e4f,_0x8ae2eb,_0x2e6003){if(!_[_0x3c9c('0x11')](_0x2e6003)&&_0x3c9c('0x12')===typeof _0x2e6003&&!_['isEmpty'](_0x2e6003)){if(!_[_0x3c9c('0x11')](_0x8ae2eb)&&_0x3c9c('0x12')===typeof _0x8ae2eb&&!_[_0x3c9c('0x13')](_0x8ae2eb)){return util[_0x3c9c('0x14')](_0x3c9c('0x15'),_0x8ae2eb,_0x2e6003);}return util[_0x3c9c('0x14')](_0x3c9c('0x15'),_0x2e6003,_0x2e6003);}if(!_[_0x3c9c('0x11')](_0x4a1e4f)&&'string'===typeof _0x4a1e4f&&!_[_0x3c9c('0x13')](_0x4a1e4f)){return _0x4a1e4f;}return'\x22\x22\x20<>';};exports['isActive']=function(_0xdfa957){if(_[_0x3c9c('0x16')](_0xdfa957)){return![];}return _0xdfa957;};exports['addVariables']=function(_0x273930,_0x33bf38,_0x4911a5,_0xa6ea8d,_0x482668,_0x50df03){var _0x39b41f={'XMD-QUEUE':_0x33bf38[_0x3c9c('0x17')]?_0x33bf38[_0x3c9c('0x17')]['name']:'','XMD-CALLERID':_0xa6ea8d,'XMD-CALLERID-PREVIEW':_0x50df03?util['format'](_0x3c9c('0x15'),_0x50df03['calleridname'],_0x50df03[_0x3c9c('0x18')]):_0xa6ea8d,'XMD-DIALID':_0x482668,'XMD-CONTACTID':_0x33bf38[_0x3c9c('0x19')],'XMD-CDRTYPE':_0x3c9c('0x1a'),'CALLERID(all)':_0xa6ea8d,'XMD-VOICEQUEUEID':_0x33bf38[_0x3c9c('0x1b')],'XMD-DIALCHANNEL':_0x4911a5,'XMD-DIALTIMEOUT':_0x273930['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format'](_0x3c9c('0x1c'),_0x273930[_0x3c9c('0x1d')]?'g':'',_[_0x3c9c('0x13')](_0x273930[_0x3c9c('0x1e')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x273930['dialPreviewUrl']||'','XMD-AGI':_0x273930[_0x3c9c('0x1f')]?util[_0x3c9c('0x14')](_0x3c9c('0x20'),ipAgi,_0x273930[_0x3c9c('0x1f')]):_0x3c9c('0x21'),'XMD-AGIAFTER':_0x273930['dialQueueProject2']?util[_0x3c9c('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x273930[_0x3c9c('0x1d')]):_0x3c9c('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x50df03?_0x50df03['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x50df03?_0x50df03[_0x3c9c('0x22')]:'','XMD-DESTINATION':_0x3c9c('0x23')};if(!_['isEmpty'](_0x273930[_0x3c9c('0x1e')])){_0x39b41f[util['format']('%s',_0x3c9c('0x24'))]=_0x273930['monitor_format'];_0x39b41f[util['format']('%s',_0x3c9c('0x25'))]=_0x482668;}if(_0x33bf38&&_0x33bf38[_0x3c9c('0x26')]){for(var _0x15d533 in _0x33bf38[_0x3c9c('0x26')]){if(_0x33bf38[_0x3c9c('0x26')][_0x3c9c('0x27')](_0x15d533)){if(!_[_0x3c9c('0x16')](_0x33bf38[_0x3c9c('0x26')][_0x15d533])&&_0x15d533!=='id'&&_0x15d533!=='tags'&&_0x15d533!=='createdAt'&&_0x15d533!==_0x3c9c('0x28')){_0x39b41f[util[_0x3c9c('0x14')](_0x3c9c('0x29'),_0x3c9c('0x2a'),_[_0x3c9c('0x2b')](_0x15d533))]=_0x33bf38['Contact'][_0x15d533];}}}}return _0x39b41f;};exports['toLowerVariables']=function(_0x55f86){var _0x1d6c50={};for(var _0x1d4fc0 in _0x55f86){if(_0x55f86['hasOwnProperty'](_0x1d4fc0)){_0x1d6c50[util[_0x3c9c('0x14')]('%s',_[_0x3c9c('0x2c')](_0x1d4fc0))]=_0x55f86[_0x1d4fc0];}}return{'variables':_0x1d6c50};};exports[_0x3c9c('0x2d')]=function(_0x260ea9,_0x2933c0){if(!_[_0x3c9c('0x16')](_0x260ea9)){if(_0x260ea9[_0x3c9c('0x27')](_0x3c9c('0x2e'))){if(_0x260ea9[_0x3c9c('0x2e')]>0x0){_0x260ea9['originated']-=0x1;}else{logger[_0x3c9c('0xa')](_0x3c9c('0x2f'),_0x2933c0);}}}else{logger[_0x3c9c('0xa')](_0x3c9c('0x30'),_0x2933c0);}};exports[_0x3c9c('0x31')]=function(_0x304a1d){var _0x299ba2=moment()[_0x3c9c('0x14')](_0x3c9c('0x32'));_0x304a1d[_0x3c9c('0x33')]=0xd;_0x304a1d['statedesc']=_0x3c9c('0x34');_0x304a1d[_0x3c9c('0x35')]=_0x299ba2;_0x304a1d[_0x3c9c('0x36')]=_0x299ba2;_0x304a1d[_0x3c9c('0x37')]=_0x299ba2;};exports[_0x3c9c('0x38')]=function(_0x4e7529,_0x178361,_0xe29dd8){var _0x5e3fcb=moment()[_0x3c9c('0x14')](_0x3c9c('0x32'));_0x4e7529['state']=_0x178361;_0x4e7529[_0x3c9c('0x39')]=_0xe29dd8;_0x4e7529[_0x3c9c('0x36')]=_0x5e3fcb;_0x4e7529[_0x3c9c('0x3a')]=getSeconds(_0x4e7529['responsetime'],_0x4e7529[_0x3c9c('0x35')]);};exports[_0x3c9c('0x3b')]=function(_0x6c1c6a,_0x312fd9,_0x4b169f){_0x6c1c6a[_0x3c9c('0x3c')]=_0x312fd9;_0x6c1c6a[_0x3c9c('0x3d')]=_0x4b169f;};exports[_0x3c9c('0x3e')]=function(_0x5bd6fb,_0x525712,_0x1062ba){var _0x13592a=moment()[_0x3c9c('0x14')](_0x3c9c('0x32'));_0x5bd6fb[_0x3c9c('0x33')]=_0x525712;_0x5bd6fb[_0x3c9c('0x39')]=_0x1062ba;_0x5bd6fb['responsetime']=_0x5bd6fb[_0x3c9c('0x36')]?_0x5bd6fb[_0x3c9c('0x36')]:_0x13592a;_0x5bd6fb[_0x3c9c('0x37')]=_0x5bd6fb[_0x3c9c('0x37')]?_0x5bd6fb[_0x3c9c('0x37')]:_0x13592a;_0x5bd6fb[_0x3c9c('0x3a')]=getSeconds(_0x5bd6fb[_0x3c9c('0x36')]||0x0,_0x5bd6fb[_0x3c9c('0x35')]||0x0);_0x5bd6fb[_0x3c9c('0x3f')]=_0x5bd6fb[_0x3c9c('0x40')]?getSeconds(_0x5bd6fb[_0x3c9c('0x37')],_0x5bd6fb[_0x3c9c('0x40')]):0x0;};exports['isFailure']=function(_0xc5db8b){return _0xc5db8b==='Failure';};exports[_0x3c9c('0x41')]=function(_0x2b55cd,_0x1a67c8,_0x4f1788,_0x222e0d,_0x4fbd0d){var _0x13e29e=_0x222e0d?'RECALL':_0x2b55cd[_0x3c9c('0x42')];_0x13e29e=_0x4fbd0d?'BOOKED':_0x13e29e;return{'actionid':_0x2b55cd[_0x3c9c('0x43')],'action':'originate','channel':_0x2b55cd[_0x3c9c('0x44')],'callerid':util[_0x3c9c('0x14')]('\x22%s\x22\x20<%s>',_0x13e29e,_0x2b55cd[_0x3c9c('0x18')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x4f1788,'timeout':(_0x1a67c8['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x2b55cd[_0x3c9c('0x43')]};};exports[_0x3c9c('0x45')]=function(_0x3d75bb){return _0x3d75bb[_0x3c9c('0x46')]+_0x3d75bb[_0x3c9c('0x47')]+_0x3d75bb[_0x3c9c('0x48')]+_0x3d75bb[_0x3c9c('0x49')]+_0x3d75bb[_0x3c9c('0x4a')];};exports[_0x3c9c('0x4b')]=function(_0x4f4769){var _0x4bfd01=_[_0x3c9c('0x4c')](_0x4f4769);_0x4bfd01['state']=0xf;_0x4bfd01[_0x3c9c('0x39')]=_0x3c9c('0x4d');return _0x4bfd01;};exports[_0x3c9c('0x4e')]=function(_0x3478c7,_0x332f4d,_0x4258b9){var _0x15c6bb={};_0x15c6bb[_0x332f4d]=_0x3478c7[_0x332f4d];_0x15c6bb['active']=![];_0x15c6bb[_0x3c9c('0x4f')]=moment()[_0x3c9c('0x50')](_0x4258b9,_0x3c9c('0x51'))['format'](_0x3c9c('0x32'));_0x15c6bb['ContactId']=_0x3478c7[_0x3c9c('0x19')];_0x15c6bb[_0x3c9c('0x52')]=_0x3478c7[_0x3c9c('0x52')];_0x15c6bb[_0x3c9c('0x1b')]=_0x3478c7['VoiceQueueId']||undefined;return _0x15c6bb;};exports['decrementTalkink']=function(_0x54df41,_0x2eae62){if(!_[_0x3c9c('0x16')](_0x54df41)){if(_0x54df41[_0x3c9c('0x53')]>0x0){_0x54df41['pTalking']-=0x1;}else{logger[_0x3c9c('0xa')](_0x2eae62,_0x3c9c('0x54'));}}else{logger[_0x3c9c('0xa')](_0x2eae62,_0x3c9c('0x55'));}};exports['IsNotLoggedIn']=function(_0x5d3d44){if(_0x5d3d44<=0x0){return!![];}return![];};exports['buildObj']=function(_0x19c4aa,_0x4fc6ee,_0x218c30){_0x19c4aa['lastevent']=_0x4fc6ee;_0x19c4aa[_0x3c9c('0x56')]=_0x19c4aa[_0x3c9c('0x57')];_0x19c4aa[_0x3c9c('0x58')]=_0x19c4aa[_0x3c9c('0x44')];if(_0x218c30){_0x19c4aa[_0x3c9c('0x59')]=_0x218c30[_0x3c9c('0x59')];}return _0x19c4aa;};exports[_0x3c9c('0x5a')]=function(_0x540ef6){var _0x36b578={};_0x36b578['queue']=_0x540ef6[_0x3c9c('0x57')];_0x36b578[_0x3c9c('0x58')]=_0x540ef6[_0x3c9c('0x44')];_0x36b578[_0x3c9c('0x43')]=_0x540ef6[_0x3c9c('0x43')];return _0x36b578;};exports[_0x3c9c('0x5b')]=function(_0x1cb2d5){var _0x20606c=[];for(var _0x3a6537 in _0x1cb2d5){if(_0x1cb2d5[_0x3c9c('0x27')](_0x3a6537)){if(!_[_0x3c9c('0x16')](_0x1cb2d5[_0x3a6537])&&_0x1cb2d5[_0x3a6537][_0x3c9c('0x33')]===_0x3c9c('0x5c')&&_0x1cb2d5[_0x3a6537]['status']===_0x3c9c('0x5d')){_0x20606c['push'](_0x1cb2d5[_0x3a6537]['id']);}}}return _0x20606c;};exports[_0x3c9c('0x5e')]=function(_0x591d0f){var _0x1bec2c=moment()['milliseconds'](0x0);var _0x1bb534=moment(_0x591d0f)[_0x3c9c('0x6')](0x0);return _0x1bec2c[_0x3c9c('0x7')](_0x1bb534,'seconds');};exports[_0x3c9c('0x5f')]=function(_0x191316){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x191316['ContactId'],'ListId':_0x191316[_0x3c9c('0x52')],'VoiceQueueId':_0x191316['VoiceQueueId']||undefined,'CampaignId':_0x191316['CampaignId']||undefined};};exports['filterKey']=function(_0x26dbb4){if(_0x26dbb4==='uniqueid'||_0x26dbb4===_0x3c9c('0x60')||_0x26dbb4==='queue'||_0x26dbb4==='type'||_0x26dbb4==='campaigntype'||_0x26dbb4===_0x3c9c('0x61')||_0x26dbb4===_0x3c9c('0x3c')||_0x26dbb4===_0x3c9c('0x44')||_0x26dbb4===_0x3c9c('0x42')||_0x26dbb4===_0x3c9c('0x62')||_0x26dbb4===_0x3c9c('0x18')||_0x26dbb4===_0x3c9c('0x4f')||_0x26dbb4===_0x3c9c('0x46')||_0x26dbb4===_0x3c9c('0x47')||_0x26dbb4===_0x3c9c('0x48')||_0x26dbb4===_0x3c9c('0x63')||_0x26dbb4===_0x3c9c('0x64')||_0x26dbb4===_0x3c9c('0x65')||_0x26dbb4==='callbackat'||_0x26dbb4==='recallme'||_0x26dbb4===_0x3c9c('0x19')||_0x26dbb4==='ListId'||_0x26dbb4===_0x3c9c('0x3d')||_0x26dbb4===_0x3c9c('0x1b')||_0x26dbb4==='sipcallid'||_0x26dbb4==='xmd-voicequeueid'||_0x26dbb4===_0x3c9c('0x66')||_0x26dbb4===_0x3c9c('0x67')||_0x26dbb4===_0x3c9c('0x68')||_0x26dbb4===_0x3c9c('0x69')||_0x26dbb4===_0x3c9c('0x6a')||_0x26dbb4==='xmd-dialoptions'||_0x26dbb4===_0x3c9c('0x6b')||_0x26dbb4===_0x3c9c('0x6c')||_0x26dbb4===_0x3c9c('0x6d')||_0x26dbb4===_0x3c9c('0x6e')||_0x26dbb4===_0x3c9c('0x6f')||_0x26dbb4===_0x3c9c('0x70')||_0x26dbb4==='xmd-agi'||_0x26dbb4==='rtpaudioqos'||_0x26dbb4===_0x3c9c('0x71')||_0x26dbb4===_0x3c9c('0x72')||_0x26dbb4==='rtpaudioqosjitterbridged'||_0x26dbb4===_0x3c9c('0x73')||_0x26dbb4==='rtpaudioqoslossbridged'||_0x26dbb4===_0x3c9c('0x74')||_0x26dbb4===_0x3c9c('0x75')||_0x26dbb4===_0x3c9c('0x76')||_0x26dbb4===_0x3c9c('0x71')||_0x26dbb4===_0x3c9c('0x72')||_0x26dbb4===_0x3c9c('0x77')||_0x26dbb4==='rtpaudioqosloss'||_0x26dbb4==='rtpaudioqoslossbridged'||_0x26dbb4===_0x3c9c('0x74')||_0x26dbb4===_0x3c9c('0x75')||_0x26dbb4===_0x3c9c('0x78')||_0x26dbb4==='bridgepvtcallid'||_0x26dbb4===_0x3c9c('0x33')||_0x26dbb4===_0x3c9c('0x39')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x3f4a8e,_0x5c7e08){var _0xbb9e99,_0x572863,_0x246c97;if(_0x5c7e08<=0x0){_0x5c7e08=0x1;}_0xbb9e99=new RegExp(_0x3c9c('0x79')+_0x5c7e08+'}$');_0x572863=Math[_0x3c9c('0x7a')](0xa,_0x5c7e08-0x1);_0x246c97=Math[_0x3c9c('0x7a')](0xa,_0x5c7e08)-0x1;return util[_0x3c9c('0x14')]('%s',_[_0x3c9c('0x7b')](_0x3f4a8e,_0xbb9e99,_['random'](_0x572863,_0x246c97)));};exports['extractCalleridName']=function(_0x10240c){var _0x233006=_0x10240c[_0x3c9c('0x7c')](/"(.*?)"/);return _0x233006?_0x233006[0x1]:_0x10240c;};exports[_0x3c9c('0x7d')]=function(_0x41e091){var _0x35ee24=_0x41e091[_0x3c9c('0x7c')](/<(.*?)>/);return _0x35ee24?_0x35ee24[0x1]:_0x41e091;}; \ No newline at end of file +var _0xa762=['rtpaudioqosrtt','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','replace','random','match','extractCalleridNumber','util','lodash','preview','env','127.0.0.1','milliseconds','seconds','loggerCatch','info','loggerError','error','inspect','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','updatedAt','%s%s','XMD-','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','UserId','logCustomer','state','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','ListId','VoiceQueueId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','queue','interface','mandatoryDisposition','buildAcw','agentReadyId','not_inuse','reachable','getDiff','diff','createBody','filterKey','idContact','type','campaigntype','membername','countglobal','callbackuniqueid','callbackat','sipcallid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqoslossbridged'];(function(_0x12b7fb,_0x4ffbdb){var _0x21a6e2=function(_0x40a525){while(--_0x40a525){_0x12b7fb['push'](_0x12b7fb['shift']());}};_0x21a6e2(++_0x4ffbdb);}(_0xa762,0x1ae));var _0x2a76=function(_0x1d7e36,_0x27765f){_0x1d7e36=_0x1d7e36-0x0;var _0x3009c8=_0xa762[_0x1d7e36];return _0x3009c8;};'use strict';var util=require(_0x2a76('0x0'));var _=require(_0x2a76('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0x2a76('0x2'));var ipAgi=process[_0x2a76('0x3')]['XCALLY_IP_AGI']||_0x2a76('0x4');function getSeconds(_0x310bb4,_0x2b8c43){var _0x5ccf9f=moment(_0x310bb4)[_0x2a76('0x5')](0x0);var _0x1f8eac=moment(_0x2b8c43)['milliseconds'](0x0);return _0x5ccf9f['diff'](_0x1f8eac,_0x2a76('0x6'));}exports[_0x2a76('0x7')]=function(_0x344347){return function(_0x26ff93){logger['error'](_0x344347,util['inspect'](_0x26ff93,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x9d271,_0x22c376){logger[_0x2a76('0x8')](_0x9d271,util['inspect'](_0x22c376,{'showHidden':![],'depth':null}));};exports[_0x2a76('0x9')]=function(_0xf1e31e,_0x5c428a){logger[_0x2a76('0xa')](_0xf1e31e,util[_0x2a76('0xb')](_0x5c428a,{'showHidden':![],'depth':null}));};exports[_0x2a76('0xc')]=function(_0xc73a3c){return function(_0x3b099c){logger[_0x2a76('0x8')](_0xc73a3c,util[_0x2a76('0xb')](_0x3b099c,{'showHidden':![],'depth':null}));};};exports[_0x2a76('0xd')]=function(_0x367b61,_0x2c3355,_0x3e189e){return{'message':_0x367b61,'unlock':_0x2c3355,'active':_0x3e189e};};exports[_0x2a76('0xe')]=function(_0x3f0c0c,_0x2cfbef,_0x53ed8b){if(!_[_0x2a76('0xf')](_0x53ed8b)&&_0x2a76('0x10')===typeof _0x53ed8b&&!_[_0x2a76('0x11')](_0x53ed8b)){if(!_[_0x2a76('0xf')](_0x2cfbef)&&_0x2a76('0x10')===typeof _0x2cfbef&&!_[_0x2a76('0x11')](_0x2cfbef)){return util[_0x2a76('0x12')](_0x2a76('0x13'),_0x2cfbef,_0x53ed8b);}return util[_0x2a76('0x12')](_0x2a76('0x13'),_0x53ed8b,_0x53ed8b);}if(!_['isUndefined'](_0x3f0c0c)&&_0x2a76('0x10')===typeof _0x3f0c0c&&!_[_0x2a76('0x11')](_0x3f0c0c)){return _0x3f0c0c;}return _0x2a76('0x14');};exports[_0x2a76('0x15')]=function(_0x4230cb){if(_[_0x2a76('0x16')](_0x4230cb)){return![];}return _0x4230cb;};exports[_0x2a76('0x17')]=function(_0x5af4e0,_0x518f4c,_0x44ea30,_0x249a37,_0x4ae78d,_0x58bfe2){var _0x14c001={'XMD-QUEUE':_0x518f4c[_0x2a76('0x18')]?_0x518f4c['Queue'][_0x2a76('0x19')]:'','XMD-CALLERID':_0x249a37,'XMD-CALLERID-PREVIEW':_0x58bfe2?util['format'](_0x2a76('0x13'),_0x58bfe2[_0x2a76('0x1a')],_0x58bfe2[_0x2a76('0x1b')]):_0x249a37,'XMD-DIALID':_0x4ae78d,'XMD-CONTACTID':_0x518f4c[_0x2a76('0x1c')],'XMD-CDRTYPE':_0x2a76('0x1d'),'CALLERID(all)':_0x249a37,'XMD-VOICEQUEUEID':_0x518f4c['VoiceQueueId'],'XMD-DIALCHANNEL':_0x44ea30,'XMD-DIALTIMEOUT':_0x5af4e0[_0x2a76('0x1e')]||0x1e,'XMD-DIALOPTIONS':util[_0x2a76('0x12')](_0x2a76('0x1f'),_0x5af4e0[_0x2a76('0x20')]?'g':'',_[_0x2a76('0x11')](_0x5af4e0[_0x2a76('0x21')])?'':_0x2a76('0x22')),'XMD-DIALURL':_0x5af4e0[_0x2a76('0x23')]||'','XMD-AGI':_0x5af4e0['dialQueueProject']?util[_0x2a76('0x12')](_0x2a76('0x24'),ipAgi,_0x5af4e0[_0x2a76('0x25')]):_0x2a76('0x26'),'XMD-AGIAFTER':_0x5af4e0['dialQueueProject2']?util['format'](_0x2a76('0x24'),ipAgi,_0x5af4e0['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x58bfe2?_0x58bfe2['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x58bfe2?_0x58bfe2[_0x2a76('0x27')]:'','XMD-DESTINATION':_0x2a76('0x28')};if(!_[_0x2a76('0x11')](_0x5af4e0[_0x2a76('0x21')])){_0x14c001[util[_0x2a76('0x12')]('%s',_0x2a76('0x29'))]=_0x5af4e0[_0x2a76('0x21')];_0x14c001[util[_0x2a76('0x12')]('%s',_0x2a76('0x2a'))]=_0x4ae78d;}if(_0x518f4c&&_0x518f4c[_0x2a76('0x2b')]){for(var _0x4f8803 in _0x518f4c[_0x2a76('0x2b')]){if(_0x518f4c[_0x2a76('0x2b')][_0x2a76('0x2c')](_0x4f8803)){if(!_[_0x2a76('0x16')](_0x518f4c[_0x2a76('0x2b')][_0x4f8803])&&_0x4f8803!=='id'&&_0x4f8803!=='tags'&&_0x4f8803!=='createdAt'&&_0x4f8803!==_0x2a76('0x2d')){_0x14c001[util[_0x2a76('0x12')](_0x2a76('0x2e'),_0x2a76('0x2f'),_['toUpper'](_0x4f8803))]=_0x518f4c[_0x2a76('0x2b')][_0x4f8803];}}}}return _0x14c001;};exports[_0x2a76('0x30')]=function(_0x4e5b6a){var _0x5ef311={};for(var _0xbbca84 in _0x4e5b6a){if(_0x4e5b6a['hasOwnProperty'](_0xbbca84)){_0x5ef311[util[_0x2a76('0x12')]('%s',_[_0x2a76('0x31')](_0xbbca84))]=_0x4e5b6a[_0xbbca84];}}return{'variables':_0x5ef311};};exports[_0x2a76('0x32')]=function(_0xdb9de,_0x1557f8){if(!_[_0x2a76('0x16')](_0xdb9de)){if(_0xdb9de[_0x2a76('0x2c')](_0x2a76('0x33'))){if(_0xdb9de[_0x2a76('0x33')]>0x0){_0xdb9de[_0x2a76('0x33')]-=0x1;}else{logger['error'](_0x2a76('0x34'),_0x1557f8);}}}else{logger[_0x2a76('0xa')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x1557f8);}};exports[_0x2a76('0x35')]=function(_0x253575){var _0x4c1531=moment()[_0x2a76('0x12')](_0x2a76('0x36'));_0x253575['state']=0xd;_0x253575[_0x2a76('0x37')]='Blacklist';_0x253575[_0x2a76('0x38')]=_0x4c1531;_0x253575[_0x2a76('0x39')]=_0x4c1531;_0x253575[_0x2a76('0x3a')]=_0x4c1531;};exports[_0x2a76('0x3b')]=function(_0x28d451,_0xeaf219,_0x5ee365){var _0x10c808=moment()['format'](_0x2a76('0x36'));_0x28d451['state']=_0xeaf219;_0x28d451[_0x2a76('0x37')]=_0x5ee365;_0x28d451[_0x2a76('0x39')]=_0x10c808;_0x28d451[_0x2a76('0x3c')]=getSeconds(_0x28d451[_0x2a76('0x39')],_0x28d451['starttime']);};exports[_0x2a76('0x3d')]=function(_0x2ff3fc,_0x3cb7ee,_0x18bc1b){_0x2ff3fc['membername']=_0x3cb7ee;_0x2ff3fc[_0x2a76('0x3e')]=_0x18bc1b;};exports[_0x2a76('0x3f')]=function(_0x508ec0,_0x48b4f9,_0x31831c){var _0xeeff5a=moment()[_0x2a76('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x508ec0[_0x2a76('0x40')]=_0x48b4f9;_0x508ec0[_0x2a76('0x37')]=_0x31831c;_0x508ec0[_0x2a76('0x39')]=_0x508ec0[_0x2a76('0x39')]?_0x508ec0[_0x2a76('0x39')]:_0xeeff5a;_0x508ec0[_0x2a76('0x3a')]=_0x508ec0[_0x2a76('0x3a')]?_0x508ec0[_0x2a76('0x3a')]:_0xeeff5a;_0x508ec0[_0x2a76('0x3c')]=getSeconds(_0x508ec0[_0x2a76('0x39')]||0x0,_0x508ec0[_0x2a76('0x38')]||0x0);_0x508ec0[_0x2a76('0x41')]=_0x508ec0[_0x2a76('0x42')]?getSeconds(_0x508ec0[_0x2a76('0x3a')],_0x508ec0[_0x2a76('0x42')]):0x0;};exports[_0x2a76('0x43')]=function(_0x56c621){return _0x56c621===_0x2a76('0x44');};exports[_0x2a76('0x45')]=function(_0x4af27d,_0x11b83a,_0x5439f3,_0x13f3bd,_0x2498d6){var _0x5c763f=_0x13f3bd?_0x2a76('0x46'):_0x4af27d['calleridname'];_0x5c763f=_0x2498d6?_0x2a76('0x47'):_0x5c763f;return{'actionid':_0x4af27d[_0x2a76('0x48')],'action':_0x2a76('0x49'),'channel':_0x4af27d[_0x2a76('0x4a')],'callerid':util[_0x2a76('0x12')](_0x2a76('0x13'),_0x5c763f,_0x4af27d[_0x2a76('0x1b')]),'Exten':_0x2a76('0x28'),'Context':_0x2a76('0x4b'),'Priority':'1','variable':_0x5439f3,'timeout':(_0x11b83a[_0x2a76('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4af27d[_0x2a76('0x48')]};};exports[_0x2a76('0x4d')]=function(_0x3dc17d){return _0x3dc17d[_0x2a76('0x4e')]+_0x3dc17d[_0x2a76('0x4f')]+_0x3dc17d[_0x2a76('0x50')]+_0x3dc17d[_0x2a76('0x51')]+_0x3dc17d[_0x2a76('0x52')];};exports[_0x2a76('0x53')]=function(_0x559f51){var _0x4341e0=_[_0x2a76('0x54')](_0x559f51);_0x4341e0[_0x2a76('0x40')]=0xf;_0x4341e0[_0x2a76('0x37')]=_0x2a76('0x55');return _0x4341e0;};exports[_0x2a76('0x56')]=function(_0x27b670,_0x5cb483,_0x27a4b6){var _0x2b2ac2={};_0x2b2ac2[_0x5cb483]=_0x27b670[_0x5cb483];_0x2b2ac2[_0x2a76('0x57')]=![];_0x2b2ac2[_0x2a76('0x58')]=moment()[_0x2a76('0x59')](_0x27a4b6,'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2b2ac2[_0x2a76('0x1c')]=_0x27b670[_0x2a76('0x1c')];_0x2b2ac2[_0x2a76('0x5a')]=_0x27b670[_0x2a76('0x5a')];_0x2b2ac2['VoiceQueueId']=_0x27b670[_0x2a76('0x5b')]||undefined;return _0x2b2ac2;};exports['decrementTalkink']=function(_0x4bde8f,_0x2ffca3){if(!_[_0x2a76('0x16')](_0x4bde8f)){if(_0x4bde8f['pTalking']>0x0){_0x4bde8f[_0x2a76('0x5c')]-=0x1;}else{logger['error'](_0x2ffca3,_0x2a76('0x5d'));}}else{logger[_0x2a76('0xa')](_0x2ffca3,_0x2a76('0x5e'));}};exports['IsNotLoggedIn']=function(_0x3c9885){if(_0x3c9885<=0x0){return!![];}return![];};exports['buildObj']=function(_0x3ab9e2,_0xbe9d4b,_0xe8eec6){_0x3ab9e2['lastevent']=_0xbe9d4b;_0x3ab9e2[_0x2a76('0x19')]=_0x3ab9e2[_0x2a76('0x5f')];_0x3ab9e2[_0x2a76('0x60')]=_0x3ab9e2['channelAgent'];if(_0xe8eec6){_0x3ab9e2[_0x2a76('0x61')]=_0xe8eec6[_0x2a76('0x61')];}return _0x3ab9e2;};exports[_0x2a76('0x62')]=function(_0x24675c){var _0x3f9c45={};_0x3f9c45[_0x2a76('0x5f')]=_0x24675c['queue'];_0x3f9c45[_0x2a76('0x60')]=_0x24675c[_0x2a76('0x4a')];_0x3f9c45[_0x2a76('0x48')]=_0x24675c[_0x2a76('0x48')];return _0x3f9c45;};exports[_0x2a76('0x63')]=function(_0x17ce35){var _0x5bde81=[];for(var _0x56407c in _0x17ce35){if(_0x17ce35[_0x2a76('0x2c')](_0x56407c)){if(!_['isNil'](_0x17ce35[_0x56407c])&&_0x17ce35[_0x56407c][_0x2a76('0x40')]===_0x2a76('0x64')&&_0x17ce35[_0x56407c]['status']===_0x2a76('0x65')){_0x5bde81['push'](_0x17ce35[_0x56407c]['id']);}}}return _0x5bde81;};exports[_0x2a76('0x66')]=function(_0x2d55a3){var _0x5b06d0=moment()['milliseconds'](0x0);var _0x2e84d9=moment(_0x2d55a3)[_0x2a76('0x5')](0x0);return _0x5b06d0[_0x2a76('0x67')](_0x2e84d9,_0x2a76('0x6'));};exports[_0x2a76('0x68')]=function(_0x4d475d){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4d475d[_0x2a76('0x1c')],'ListId':_0x4d475d[_0x2a76('0x5a')],'VoiceQueueId':_0x4d475d[_0x2a76('0x5b')]||undefined,'CampaignId':_0x4d475d['CampaignId']||undefined};};exports[_0x2a76('0x69')]=function(_0x514bd3){if(_0x514bd3==='uniqueid'||_0x514bd3===_0x2a76('0x6a')||_0x514bd3==='queue'||_0x514bd3===_0x2a76('0x6b')||_0x514bd3===_0x2a76('0x6c')||_0x514bd3==='dialAnswer'||_0x514bd3===_0x2a76('0x6d')||_0x514bd3===_0x2a76('0x4a')||_0x514bd3===_0x2a76('0x1a')||_0x514bd3===_0x2a76('0x57')||_0x514bd3===_0x2a76('0x1b')||_0x514bd3===_0x2a76('0x58')||_0x514bd3==='countbusyretry'||_0x514bd3===_0x2a76('0x4f')||_0x514bd3==='countnoanswerretry'||_0x514bd3===_0x2a76('0x6e')||_0x514bd3==='callback'||_0x514bd3===_0x2a76('0x6f')||_0x514bd3===_0x2a76('0x70')||_0x514bd3==='recallme'||_0x514bd3===_0x2a76('0x1c')||_0x514bd3===_0x2a76('0x5a')||_0x514bd3==='UserId'||_0x514bd3===_0x2a76('0x5b')||_0x514bd3===_0x2a76('0x71')||_0x514bd3==='xmd-voicequeueid'||_0x514bd3==='xmd-queue'||_0x514bd3===_0x2a76('0x72')||_0x514bd3===_0x2a76('0x73')||_0x514bd3===_0x2a76('0x74')||_0x514bd3===_0x2a76('0x75')||_0x514bd3===_0x2a76('0x76')||_0x514bd3===_0x2a76('0x77')||_0x514bd3===_0x2a76('0x78')||_0x514bd3==='xmd-contactid'||_0x514bd3===_0x2a76('0x79')||_0x514bd3==='xmd-callerid'||_0x514bd3===_0x2a76('0x7a')||_0x514bd3==='xmd-agi'||_0x514bd3===_0x2a76('0x7b')||_0x514bd3==='rtpaudioqosbridged'||_0x514bd3==='rtpaudioqosjitter'||_0x514bd3===_0x2a76('0x7c')||_0x514bd3==='rtpaudioqosloss'||_0x514bd3===_0x2a76('0x7d')||_0x514bd3===_0x2a76('0x7e')||_0x514bd3==='rtpaudioqosrttbridged'||_0x514bd3===_0x2a76('0x7b')||_0x514bd3===_0x2a76('0x7f')||_0x514bd3===_0x2a76('0x80')||_0x514bd3===_0x2a76('0x7c')||_0x514bd3===_0x2a76('0x81')||_0x514bd3===_0x2a76('0x7d')||_0x514bd3===_0x2a76('0x7e')||_0x514bd3===_0x2a76('0x82')||_0x514bd3===_0x2a76('0x83')||_0x514bd3===_0x2a76('0x84')||_0x514bd3==='state'||_0x514bd3===_0x2a76('0x37')){return![];}return!![];};exports[_0x2a76('0x85')]=function(_0x4894df,_0x1e3f4c){var _0x32fe30,_0x8eebbe,_0x307d83;if(_0x1e3f4c<=0x0){_0x1e3f4c=0x1;}_0x32fe30=new RegExp('\x5cw{0,'+_0x1e3f4c+'}$');_0x8eebbe=Math['pow'](0xa,_0x1e3f4c-0x1);_0x307d83=Math[_0x2a76('0x86')](0xa,_0x1e3f4c)-0x1;return util[_0x2a76('0x12')]('%s',_[_0x2a76('0x87')](_0x4894df,_0x32fe30,_[_0x2a76('0x88')](_0x8eebbe,_0x307d83)));};exports['extractCalleridName']=function(_0x255b3b){var _0x456ff4=_0x255b3b[_0x2a76('0x89')](/"(.*?)"/);return _0x456ff4?_0x456ff4[0x1]:_0x255b3b;};exports[_0x2a76('0x8a')]=function(_0x52f5b5){var _0x355f94=_0x52f5b5[_0x2a76('0x89')](/<(.*?)>/);return _0x355f94?_0x355f94[0x1]:_0x52f5b5;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index a0344ea..398ba12 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 _0x7a54=['number','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x5c46ee,_0x44af29){var _0x56eb24=function(_0x3b124f){while(--_0x3b124f){_0x5c46ee['push'](_0x5c46ee['shift']());}};_0x56eb24(++_0x44af29);}(_0x7a54,0x106));var _0x47a5=function(_0x1e27df,_0x156d10){_0x1e27df=_0x1e27df-0x0;var _0x31cb10=_0x7a54[_0x1e27df];return _0x31cb10;};'use strict';exports[_0x47a5('0x0')]={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x47a5('0x2'),'required':![]},'paused':{'type':_0x47a5('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]}};exports[_0x47a5('0x4')]={'interface':{'type':_0x47a5('0x1'),'required':!![]},'paused':{'type':_0x47a5('0x3')},'reason':{'type':'string','required':![]}};exports[_0x47a5('0x5')]={'module':{'type':'string','required':![]}};exports[_0x47a5('0x6')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x47a5('0x7')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x1792a7,_0x423111){var _0x4ed138=function(_0x3080fd){while(--_0x3080fd){_0x1792a7['push'](_0x1792a7['shift']());}};_0x4ed138(++_0x423111);}(_0x5f2f,0x73));var _0xf5f2=function(_0x27c4e3,_0x3ce966){_0x27c4e3=_0x27c4e3-0x0;var _0x9d7008=_0x5f2f[_0x27c4e3];return _0x9d7008;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 49cf161..2f9095c 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 _0x7fd6=['groupBy','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','queuecallercompleteAt','queuecallerexitAt','seconds','diff','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','initSettings','bluebird','lodash','moment','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','campaigns','templates','outbound','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','isNil','initTelephones','length','isUndefined','trunks','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initZohoAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x7fd6,0x157));var _0x67fd=function(_0x2ccc66,_0x313d87){_0x2ccc66=_0x2ccc66-0x0;var _0x3fa5a0=_0x7fd6[_0x2ccc66];return _0x3fa5a0;};'use strict';var BPromise=require(_0x67fd('0x0'));var util=require('util');var _=require(_0x67fd('0x1'));var moment=require(_0x67fd('0x2'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require(_0x67fd('0x3'));var VoiceQueue=require(_0x67fd('0x4'));var Trigger=require(_0x67fd('0x5'));var Template=require('../model/template');var Campaign=require(_0x67fd('0x6'));var VoiceExtension=require(_0x67fd('0x7'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0x67fd('0x8'));var FreshdeskAccount=require(_0x67fd('0x9'));var SugarcrmAccount=require(_0x67fd('0xa'));var ZohoAccount=require(_0x67fd('0xb'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x67fd('0xc'));var ServicenowAccount=require(_0x67fd('0xd'));var Dynamics365Account=require(_0x67fd('0xe'));var FreshsalesAccount=require(_0x67fd('0xf'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x67fd('0x10')]={};this[_0x67fd('0x11')]={};this['trunks']={};this[_0x67fd('0x12')]={};this[_0x67fd('0x13')]={};this[_0x67fd('0x14')]={};this[_0x67fd('0x15')]={};this[_0x67fd('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this['channels']={};this[_0x67fd('0x17')]={};this[_0x67fd('0x18')]={};this[_0x67fd('0x19')]={};this[_0x67fd('0x1a')]={};this[_0x67fd('0x1b')]={};this[_0x67fd('0x1c')]={};this[_0x67fd('0x1d')]={};this[_0x67fd('0x1e')]={};this[_0x67fd('0x1f')]={};this[_0x67fd('0x20')]={};this[_0x67fd('0x21')]={};this[_0x67fd('0x22')]={};this[_0x67fd('0x23')]={};this[_0x67fd('0x24')]={};this['faxAccounts']={};};function freeIsNotKey(_0x5f7748,_0x2f24dd,_0x38c3cf){var _0x1c2d61=_[_0x67fd('0x25')](_0x5f7748,function(_0x5de0c3,_0x2c3b8a){return _0x5de0c3[_0x38c3cf];});for(var _0x4db317 in _0x2f24dd){if(_0x2f24dd['hasOwnProperty'](_0x4db317)){if(!_0x1c2d61[_0x4db317]){delete _0x2f24dd[_0x4db317];}}}}function freeIsNotKeySip(_0x5b82b4,_0x1de592){var _0x4a6378=_[_0x67fd('0x25')](_0x5b82b4,function(_0x1c6b7d,_0x2b71b8){return util[_0x67fd('0x26')](_0x67fd('0x27'),_0x1c6b7d[_0x67fd('0x28')]);});for(var _0x2d26c0 in _0x1de592){if(_0x1de592[_0x67fd('0x29')](_0x2d26c0)){if(!_0x4a6378[_0x2d26c0]){delete _0x1de592[_0x2d26c0];}}}}function freeIsNotKeyAgent(_0x37c28c,_0x1dc53f){var _0xba1eb8=_[_0x67fd('0x25')](_0x37c28c,function(_0x3cf29e,_0x22c08d){var _0x11113e=_['isNil'](_0x3cf29e[_0x67fd('0x2a')])?util[_0x67fd('0x26')](_0x67fd('0x27'),_0x3cf29e['name']):_0x3cf29e[_0x67fd('0x2a')];return _0x11113e;});for(var _0x26c642 in _0x1dc53f){if(_0x1dc53f[_0x67fd('0x29')](_0x26c642)){if(!_0xba1eb8[_0x26c642]){delete _0x1dc53f[_0x26c642];}}}}function clearVoiceCallReports(_0x30c49e){_0x30c49e[_0x67fd('0x2b')]=0x0;_0x30c49e[_0x67fd('0x2c')]=0x0;_0x30c49e[_0x67fd('0x2d')]=0x0;_0x30c49e[_0x67fd('0x2e')]=0x0;_0x30c49e[_0x67fd('0x2f')]=0x0;}function clearCampaigns(_0x52e638){if(!_['isEmpty'](_0x52e638)){for(var _0x37e83e in _0x52e638){if(_0x52e638[_0x67fd('0x29')](_0x37e83e)){_0x52e638[_0x37e83e]['ivrTotalCallsDays']=0x0;_0x52e638[_0x37e83e]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x49c080){if(!_[_0x67fd('0x30')](_0x49c080)){for(var _0x177966 in _0x49c080){if(_0x49c080[_0x67fd('0x29')](_0x177966)){_0x49c080[_0x177966][_0x67fd('0x2b')]=0x0;_0x49c080[_0x177966][_0x67fd('0x2c')]=0x0;_0x49c080[_0x177966]['unmanaged']=0x0;_0x49c080[_0x177966][_0x67fd('0x31')]=0x0;_0x49c080[_0x177966][_0x67fd('0x2d')]=0x0;_0x49c080[_0x177966][_0x67fd('0x2e')]=0x0;_0x49c080[_0x177966][_0x67fd('0x2f')]=0x0;_0x49c080[_0x177966][_0x67fd('0x32')]=0x0;_0x49c080[_0x177966][_0x67fd('0x33')]=0x0;_0x49c080[_0x177966][_0x67fd('0x34')]=0x0;_0x49c080[_0x177966]['outboundCongestionCallsDay']=0x0;_0x49c080[_0x177966]['outboundNoSuchCallsDay']=0x0;_0x49c080[_0x177966][_0x67fd('0x35')]=0x0;_0x49c080[_0x177966]['outboundDropCallsDayTimeout']=0x0;_0x49c080[_0x177966][_0x67fd('0x36')]=0x0;_0x49c080[_0x177966][_0x67fd('0x37')]=0x0;_0x49c080[_0x177966][_0x67fd('0x38')]=0x0;_0x49c080[_0x177966][_0x67fd('0x39')]=0x0;_0x49c080[_0x177966][_0x67fd('0x3a')]=0x0;_0x49c080[_0x177966]['outboundAnswerAgiCallsDay']=0x0;_0x49c080[_0x177966]['outboundAnswerCallsDay']=0x0;_0x49c080[_0x177966][_0x67fd('0x3b')]=!![];}}}}Realtime['prototype'][_0x67fd('0x3c')]=function(_0x1e12bd,_0x4c45ec){for(var _0x4af7fb in _0x4c45ec){if(_0x1e12bd[_0x67fd('0x29')](_0x4af7fb)){_0x1e12bd[_0x4af7fb]=_0x4c45ec[_0x4af7fb];}}};Realtime[_0x67fd('0x3d')][_0x67fd('0x3e')]=function(){var _0x183f83=this;return function(_0x80c441){if(_0x80c441){freeIsNotKeyAgent(_0x80c441,_0x183f83[_0x67fd('0x10')]);for(var _0x596ec4=0x0,_0x5883eb={},_0x36b1fc={};_0x596ec4<_0x80c441['length'];_0x596ec4+=0x1){_0x5883eb=_0x80c441[_0x596ec4];var _0x1d0223=_[_0x67fd('0x3f')](_0x5883eb[_0x67fd('0x2a')])?util[_0x67fd('0x26')]('SIP/%s',_0x5883eb[_0x67fd('0x28')]):_0x5883eb[_0x67fd('0x2a')];if(_['isUndefined'](_0x183f83['agents'][_0x1d0223])){_0x183f83[_0x67fd('0x10')][_0x1d0223]=new Agent(_0x5883eb);}else{_0x183f83[_0x67fd('0x3c')](_0x183f83[_0x67fd('0x10')][_0x1d0223],_0x5883eb);}}}return _0x183f83[_0x67fd('0x10')];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x40')]=function(){var _0x2e9ab9=this;return function(_0x2aeb2f){if(_0x2aeb2f){freeIsNotKeySip(_0x2aeb2f,_0x2e9ab9[_0x67fd('0x11')]);for(var _0x45a87e=0x0,_0x1d31c8={},_0xaae7df={};_0x45a87e<_0x2aeb2f[_0x67fd('0x41')];_0x45a87e+=0x1){_0x1d31c8=_0x2aeb2f[_0x45a87e];if(_[_0x67fd('0x42')](_0x2e9ab9[_0x67fd('0x11')][util['format']('SIP/%s',_0x1d31c8[_0x67fd('0x28')])])){_0x2e9ab9[_0x67fd('0x11')][util['format']('SIP/%s',_0x1d31c8[_0x67fd('0x28')])]=new Telephone(_0x1d31c8);}else{_0x2e9ab9[_0x67fd('0x3c')](_0x2e9ab9[_0x67fd('0x11')][util['format']('SIP/%s',_0x1d31c8[_0x67fd('0x28')])],_0x1d31c8);}}}return _0x2e9ab9['telephones'];};};Realtime[_0x67fd('0x3d')]['initTrunks']=function(){var _0x2310fc=this;return function(_0x40e15f){if(_0x40e15f){freeIsNotKeySip(_0x40e15f,_0x2310fc[_0x67fd('0x43')]);for(var _0x198d6a=0x0,_0x3651bb={},_0x122ddc={};_0x198d6a<_0x40e15f['length'];_0x198d6a+=0x1){_0x3651bb=_0x40e15f[_0x198d6a];if(_['isUndefined'](_0x2310fc[_0x67fd('0x43')][util[_0x67fd('0x26')](_0x67fd('0x27'),_0x3651bb[_0x67fd('0x28')])])){_0x2310fc[_0x67fd('0x43')][util[_0x67fd('0x26')](_0x67fd('0x27'),_0x3651bb[_0x67fd('0x28')])]=new Trunk(_0x3651bb);}else{_0x2310fc[_0x67fd('0x3c')](_0x2310fc[_0x67fd('0x43')][util[_0x67fd('0x26')](_0x67fd('0x27'),_0x3651bb[_0x67fd('0x28')])],_0x3651bb);}}}return _0x2310fc['trunks'];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x44')]=function(){var _0x4ed13a=this;return function(_0x5aa153){if(_0x5aa153){freeIsNotKey(_0x5aa153,_0x4ed13a[_0x67fd('0x12')],_0x67fd('0x28'));for(var _0x21d49d=0x0,_0x4ac874={},_0x1ed8fc={};_0x21d49d<_0x5aa153['length'];_0x21d49d+=0x1){_0x4ac874=_0x5aa153[_0x21d49d];if(_[_0x67fd('0x42')](_0x4ed13a[_0x67fd('0x12')][_0x4ac874[_0x67fd('0x28')]])){_0x4ed13a[_0x67fd('0x12')][_0x4ac874[_0x67fd('0x28')]]=new VoiceQueue(_0x4ac874);}else{_0x4ed13a[_0x67fd('0x3c')](_0x4ed13a['voiceQueues'][_0x4ac874[_0x67fd('0x28')]],_0x4ac874);}}}return _0x4ed13a[_0x67fd('0x12')];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x45')]=function(){var _0x21edf2=this;return function(_0xa0effa){if(_0xa0effa){freeIsNotKey(_0xa0effa,_0x21edf2[_0x67fd('0x13')],'id');for(var _0x53600c=0x0,_0x327217={},_0x221eef={};_0x53600c<_0xa0effa[_0x67fd('0x41')];_0x53600c+=0x1){_0x327217=_0xa0effa[_0x53600c];if(_[_0x67fd('0x42')](_0x21edf2['triggers'][_0x327217['id']])){_0x21edf2[_0x67fd('0x13')][_0x327217['id']]=new Trigger(_0x327217);}else{_0x21edf2['mergeFromDatabase'](_0x21edf2[_0x67fd('0x13')][_0x327217['id']],_0x327217);}}}return _0x21edf2['triggers'];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x46')]=function(){var _0x2fd995=this;return function(_0x105acd){if(_0x105acd){freeIsNotKey(_0x105acd,_0x2fd995[_0x67fd('0x15')],'id');for(var _0x38ad78=0x0,_0x4c5101={},_0x501baf={};_0x38ad78<_0x105acd[_0x67fd('0x41')];_0x38ad78+=0x1){_0x4c5101=_0x105acd[_0x38ad78];if(_[_0x67fd('0x42')](_0x2fd995[_0x67fd('0x15')][_0x4c5101['id']])){_0x2fd995[_0x67fd('0x15')][_0x4c5101['id']]=new Template(_0x4c5101);}else{_0x2fd995[_0x67fd('0x3c')](_0x2fd995[_0x67fd('0x15')][_0x4c5101['id']],_0x4c5101);}}}return _0x2fd995['templates'];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x47')]=function(){var _0x57fceb=this;return function(_0x1fb6b9){if(_0x1fb6b9){freeIsNotKey(_0x1fb6b9,_0x57fceb[_0x67fd('0x1b')],'id');for(var _0x23a9e4=0x0,_0x3ab0e7={},_0x27dda0={};_0x23a9e4<_0x1fb6b9[_0x67fd('0x41')];_0x23a9e4+=0x1){_0x3ab0e7=_0x1fb6b9[_0x23a9e4];if(_[_0x67fd('0x42')](_0x57fceb[_0x67fd('0x1b')][_0x3ab0e7['id']])){_0x57fceb['zendeskAccounts'][_0x3ab0e7['id']]=new ZendeskAccount(_0x3ab0e7);}else{_0x57fceb[_0x67fd('0x3c')](_0x57fceb[_0x67fd('0x1b')][_0x3ab0e7['id']],_0x3ab0e7);}}}return _0x57fceb[_0x67fd('0x1b')];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x48')]=function(){var _0x2a8854=this;return function(_0x51724c){if(_0x51724c){freeIsNotKey(_0x51724c,_0x2a8854[_0x67fd('0x1c')],'id');for(var _0x50fc88=0x0,_0x50b0a5={},_0x124bb7={};_0x50fc88<_0x51724c['length'];_0x50fc88+=0x1){_0x50b0a5=_0x51724c[_0x50fc88];if(_[_0x67fd('0x42')](_0x2a8854['salesforceAccounts'][_0x50b0a5['id']])){_0x2a8854['salesforceAccounts'][_0x50b0a5['id']]=new SalesforceAccount(_0x50b0a5);}else{_0x2a8854[_0x67fd('0x3c')](_0x2a8854[_0x67fd('0x1c')][_0x50b0a5['id']],_0x50b0a5);}}}return _0x2a8854[_0x67fd('0x1c')];};};Realtime[_0x67fd('0x3d')]['initFreshdeskAccounts']=function(){var _0x55c6f1=this;return function(_0xb6dfa0){if(_0xb6dfa0){freeIsNotKey(_0xb6dfa0,_0x55c6f1[_0x67fd('0x1e')],'id');for(var _0x4c2da1=0x0,_0x51060f={},_0x2c4acb={};_0x4c2da1<_0xb6dfa0['length'];_0x4c2da1+=0x1){_0x51060f=_0xb6dfa0[_0x4c2da1];if(_['isUndefined'](_0x55c6f1[_0x67fd('0x1e')][_0x51060f['id']])){_0x55c6f1[_0x67fd('0x1e')][_0x51060f['id']]=new FreshdeskAccount(_0x51060f);}else{_0x55c6f1['mergeFromDatabase'](_0x55c6f1['freshdeskAccounts'][_0x51060f['id']],_0x51060f);}}}return _0x55c6f1[_0x67fd('0x1e')];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x49')]=function(){var _0x5b5311=this;return function(_0x1286b4){if(_0x1286b4){freeIsNotKey(_0x1286b4,_0x5b5311[_0x67fd('0x1f')],'id');for(var _0x1dfecd=0x0,_0x2b270f={},_0x2b4185={};_0x1dfecd<_0x1286b4[_0x67fd('0x41')];_0x1dfecd+=0x1){_0x2b270f=_0x1286b4[_0x1dfecd];if(_[_0x67fd('0x42')](_0x5b5311[_0x67fd('0x1f')][_0x2b270f['id']])){_0x5b5311[_0x67fd('0x1f')][_0x2b270f['id']]=new ZohoAccount(_0x2b270f);}else{_0x5b5311[_0x67fd('0x3c')](_0x5b5311[_0x67fd('0x1f')][_0x2b270f['id']],_0x2b270f);}}}return _0x5b5311[_0x67fd('0x1f')];};};Realtime[_0x67fd('0x3d')]['initDeskAccounts']=function(){var _0x3cccb2=this;return function(_0x31c78e){if(_0x31c78e){freeIsNotKey(_0x31c78e,_0x3cccb2['deskAccounts'],'id');for(var _0x486a5a=0x0,_0xd5b81a={},_0x428d6f={};_0x486a5a<_0x31c78e[_0x67fd('0x41')];_0x486a5a+=0x1){_0xd5b81a=_0x31c78e[_0x486a5a];if(_[_0x67fd('0x42')](_0x3cccb2['deskAccounts'][_0xd5b81a['id']])){_0x3cccb2[_0x67fd('0x20')][_0xd5b81a['id']]=new DeskAccount(_0xd5b81a);}else{_0x3cccb2[_0x67fd('0x3c')](_0x3cccb2['deskAccounts'][_0xd5b81a['id']],_0xd5b81a);}}}return _0x3cccb2['deskAccounts'];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x4a')]=function(){var _0x25e5e8=this;return function(_0x143399){if(_0x143399){freeIsNotKey(_0x143399,_0x25e5e8[_0x67fd('0x1d')],'id');for(var _0x50ccc6=0x0,_0x598bd4={},_0x3db679={};_0x50ccc6<_0x143399[_0x67fd('0x41')];_0x50ccc6+=0x1){_0x598bd4=_0x143399[_0x50ccc6];if(_[_0x67fd('0x42')](_0x25e5e8[_0x67fd('0x1d')][_0x598bd4['id']])){_0x25e5e8['sugarcrmAccounts'][_0x598bd4['id']]=new SugarcrmAccount(_0x598bd4);}else{_0x25e5e8['mergeFromDatabase'](_0x25e5e8[_0x67fd('0x1d')][_0x598bd4['id']],_0x598bd4);}}}return _0x25e5e8['sugarcrmAccounts'];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x4b')]=function(){var _0x18e701=this;return function(_0x12a71d){if(_0x12a71d){freeIsNotKey(_0x12a71d,_0x18e701[_0x67fd('0x21')],'id');for(var _0x50ac0c=0x0,_0x497861={},_0x3ce042={};_0x50ac0c<_0x12a71d[_0x67fd('0x41')];_0x50ac0c+=0x1){_0x497861=_0x12a71d[_0x50ac0c];if(_[_0x67fd('0x42')](_0x18e701['vtigerAccounts'][_0x497861['id']])){_0x18e701[_0x67fd('0x21')][_0x497861['id']]=new VtigerAccount(_0x497861);}else{_0x18e701['mergeFromDatabase'](_0x18e701['vtigerAccounts'][_0x497861['id']],_0x497861);}}}return _0x18e701[_0x67fd('0x21')];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x4c')]=function(){var _0x515e8a=this;return function(_0x4633d6){if(_0x4633d6){freeIsNotKey(_0x4633d6,_0x515e8a[_0x67fd('0x22')],'id');for(var _0x9a5c20=0x0,_0x46f78a={},_0x39770b={};_0x9a5c20<_0x4633d6['length'];_0x9a5c20+=0x1){_0x46f78a=_0x4633d6[_0x9a5c20];if(_[_0x67fd('0x42')](_0x515e8a[_0x67fd('0x22')][_0x46f78a['id']])){_0x515e8a[_0x67fd('0x22')][_0x46f78a['id']]=new ServicenowAccount(_0x46f78a);}else{_0x515e8a[_0x67fd('0x3c')](_0x515e8a[_0x67fd('0x22')][_0x46f78a['id']],_0x46f78a);}}}return _0x515e8a[_0x67fd('0x22')];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x4d')]=function(){var _0x640ef8=this;return function(_0x429eae){if(_0x429eae){freeIsNotKey(_0x429eae,_0x640ef8[_0x67fd('0x23')],'id');for(var _0x5caed1=0x0,_0x502644={},_0x3d4aba={};_0x5caed1<_0x429eae[_0x67fd('0x41')];_0x5caed1+=0x1){_0x502644=_0x429eae[_0x5caed1];if(_['isUndefined'](_0x640ef8['dynamics365Accounts'][_0x502644['id']])){_0x640ef8[_0x67fd('0x23')][_0x502644['id']]=new Dynamics365Account(_0x502644);}else{_0x640ef8[_0x67fd('0x3c')](_0x640ef8[_0x67fd('0x23')][_0x502644['id']],_0x502644);}}}return _0x640ef8[_0x67fd('0x23')];};};Realtime[_0x67fd('0x3d')]['initFreshsalesAccounts']=function(){var _0x366b96=this;return function(_0x1aef0f){if(_0x1aef0f){freeIsNotKey(_0x1aef0f,_0x366b96[_0x67fd('0x24')],'id');for(var _0x369737=0x0,_0x46b8f1={},_0x2be1b5={};_0x369737<_0x1aef0f['length'];_0x369737+=0x1){_0x46b8f1=_0x1aef0f[_0x369737];if(_[_0x67fd('0x42')](_0x366b96['freshsalesAccounts'][_0x46b8f1['id']])){_0x366b96[_0x67fd('0x24')][_0x46b8f1['id']]=new FreshsalesAccount(_0x46b8f1);}else{_0x366b96[_0x67fd('0x3c')](_0x366b96['freshsalesAccounts'][_0x46b8f1['id']],_0x46b8f1);}}}return _0x366b96[_0x67fd('0x24')];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x4e')]=function(){var _0xd8c0a0=this;return function(_0x2625e8){for(var _0x49b775=0x0;_0x49b775<_0x2625e8['length'];_0x49b775+=0x1){_[_0x67fd('0x4f')](_0xd8c0a0[_0x67fd('0x12')][_0x2625e8[_0x49b775][_0x67fd('0x28')]],_0x2625e8[_0x49b775]);}return _0xd8c0a0[_0x67fd('0x12')];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x50')]=function(){var _0x454405=this;return function(_0x370d23){clearVoiceQueues(_0x454405[_0x67fd('0x12')]);if(_0x370d23){_0x370d23=_[_0x67fd('0x51')](_0x370d23,'uniqueid');for(var _0x23288b in _0x370d23){if(_0x370d23[_0x67fd('0x29')](_0x23288b)){var _0x5dae2f={};for(var _0x568a98=0x0;_0x568a98<_0x370d23[_0x23288b][_0x67fd('0x41')];_0x568a98+=0x1){var _0x3ca737=_0x370d23[_0x23288b][_0x568a98][_0x67fd('0x52')];if(_0x454405[_0x67fd('0x12')][_0x3ca737]){if(_0x370d23[_0x23288b][_0x568a98][_0x67fd('0x53')]){_0x454405[_0x67fd('0x12')][_0x3ca737][_0x67fd('0x54')]+=0x1;}if(_0x370d23[_0x23288b][_0x568a98][_0x67fd('0x55')]){_0x454405[_0x67fd('0x12')][_0x3ca737][_0x67fd('0x31')]+=0x1;}_0x454405[_0x67fd('0x12')][_0x3ca737][_0x67fd('0x2d')]+=moment(_0x370d23[_0x23288b][_0x568a98][_0x67fd('0x56')])['diff'](moment(_0x370d23[_0x23288b][_0x568a98][_0x67fd('0x57')]),'seconds')||0x0;if(_0x568a98===_0x370d23[_0x23288b][_0x67fd('0x41')]-0x1){_0x454405[_0x67fd('0x12')][_0x3ca737][_0x67fd('0x2e')]+=moment(_0x370d23[_0x23288b][_0x568a98][_0x67fd('0x58')]||_0x370d23[_0x23288b][_0x568a98]['queuecallerabandonAt']||_0x370d23[_0x23288b][_0x568a98][_0x67fd('0x59')])['diff'](moment(_0x370d23[_0x23288b][_0x568a98][_0x67fd('0x57')]),_0x67fd('0x5a'))||0x0;_0x454405[_0x67fd('0x12')][_0x3ca737]['total']+=0x1;if(_0x370d23[_0x23288b][_0x568a98]['queuecallercomplete']){_0x454405[_0x67fd('0x12')][_0x3ca737][_0x67fd('0x2c')]+=0x1;_0x454405['voiceQueues'][_0x3ca737][_0x67fd('0x2f')]+=moment(_0x370d23[_0x23288b][_0x568a98]['queuecallercompleteAt'])[_0x67fd('0x5b')](moment(_0x370d23[_0x23288b][_0x568a98][_0x67fd('0x56')]),_0x67fd('0x5a'))||0x0;}}else{_0x454405[_0x67fd('0x12')][_0x3ca737][_0x67fd('0x2e')]+=_0x454405[_0x67fd('0x12')][_0x3ca737][_0x67fd('0x2d')]||0x0;}}}}}}return _0x454405['voiceQueues'];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x5c')]=function(){var _0x269624=this;return function(_0x3c22c9){clearVoiceCallReports(_0x269624[_0x67fd('0x16')]);if(_0x3c22c9){for(var _0x4a6f80=0x0;_0x4a6f80<_0x3c22c9[_0x67fd('0x41')];_0x4a6f80+=0x1){_0x269624[_0x67fd('0x16')][_0x67fd('0x2b')]+=0x1;_0x269624[_0x67fd('0x16')][_0x67fd('0x2e')]+=_0x3c22c9[_0x4a6f80][_0x67fd('0x5d')];if(_0x3c22c9[_0x4a6f80][_0x67fd('0x5e')]===_0x67fd('0x5f')){_0x269624[_0x67fd('0x16')][_0x67fd('0x2c')]+=0x1;_0x269624['outbound'][_0x67fd('0x2d')]+=_0x3c22c9[_0x4a6f80][_0x67fd('0x5d')]-_0x3c22c9[_0x4a6f80]['billableseconds']||0x0;_0x269624[_0x67fd('0x16')][_0x67fd('0x2f')]+=_0x3c22c9[_0x4a6f80][_0x67fd('0x60')];}}}return _0x269624[_0x67fd('0x16')];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x61')]=function(){var _0xeda87c=this;return function(_0x19feb3){if(_0x19feb3){freeIsNotKey(_0x19feb3,_0xeda87c[_0x67fd('0x14')],'name');for(var _0x58e10d=0x0,_0x48b5f8={};_0x58e10d<_0x19feb3[_0x67fd('0x41')];_0x58e10d+=0x1){_0x48b5f8=_0x19feb3[_0x58e10d];if(_['isUndefined'](_0xeda87c['campaigns'][_0x48b5f8[_0x67fd('0x28')]])){_0xeda87c[_0x67fd('0x14')][_0x48b5f8[_0x67fd('0x28')]]=new Campaign(_0x48b5f8);}else{_0xeda87c[_0x67fd('0x3c')](_0xeda87c[_0x67fd('0x14')][_0x48b5f8[_0x67fd('0x28')]],_0x48b5f8);_0xeda87c[_0x67fd('0x14')][_0x48b5f8[_0x67fd('0x28')]][_0x67fd('0x62')]=_0x48b5f8['SquareProject']?_0x48b5f8[_0x67fd('0x63')][_0x67fd('0x28')]:undefined;}}}return _0xeda87c['campaigns'];};};Realtime['prototype'][_0x67fd('0x64')]=function(){var _0x597b07=this;return function(_0x55f5af){if(_0x55f5af){freeIsNotKey(_0x55f5af,_0x597b07['voiceExtensions'],'id');for(var _0x2d56bb=0x0,_0x13ad54={};_0x2d56bb<_0x55f5af['length'];_0x2d56bb+=0x1){_0x13ad54=_0x55f5af[_0x2d56bb];if(_['isUndefined'](_0x597b07[_0x67fd('0x65')][_0x13ad54['id']])){_0x597b07['voiceExtensions'][_0x13ad54['id']]=new VoiceExtension(_0x13ad54);}else{_0x597b07[_0x67fd('0x3c')](_0x597b07[_0x67fd('0x65')][_0x13ad54['id']],_0x13ad54);}}}return _0x597b07[_0x67fd('0x65')];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x66')]=function(){var _0xea1750=this;return function(_0x18366e){clearCampaigns(_0xea1750[_0x67fd('0x14')]);for(var _0x29814e=0x0;_0x29814e<_0x18366e[_0x67fd('0x41')];_0x29814e+=0x1){_[_0x67fd('0x4f')](_0xea1750[_0x67fd('0x14')][_0x18366e[_0x29814e][_0x67fd('0x28')]],_0x18366e[_0x29814e]);}return _0xea1750[_0x67fd('0x14')];};};Realtime[_0x67fd('0x3d')][_0x67fd('0x67')]=function(){var _0x48670e=this;return function(_0x1518bf){if(_0x1518bf){freeIsNotKey(_0x1518bf,_0x48670e[_0x67fd('0x68')],'id');for(var _0x51dd5d=0x0,_0x1b297c={},_0x4bb5d1={};_0x51dd5d<_0x1518bf[_0x67fd('0x41')];_0x51dd5d+=0x1){_0x1b297c=_0x1518bf[_0x51dd5d];if(_[_0x67fd('0x42')](_0x48670e[_0x67fd('0x68')][_0x1b297c['id']])){_0x48670e[_0x67fd('0x68')][_0x1b297c['id']]=new FaxAccount(_0x1b297c);}else{_0x48670e[_0x67fd('0x3c')](_0x48670e[_0x67fd('0x68')][_0x1b297c['id']],_0x1b297c);}}}return _0x48670e[_0x67fd('0x68')];};};Realtime['prototype'][_0x67fd('0x69')]=function(){var _0x566d2f=this;return function(_0x10a896){_0x566d2f[_0x67fd('0x1a')]=_0x10a896;return _0x566d2f[_0x67fd('0x1a')];};};module['exports']=Realtime; \ No newline at end of file +var _0x6eb8=['../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/freshsalesAccount','agents','telephones','trunks','triggers','campaigns','templates','voiceExtensions','channels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','initAgents','length','isUndefined','mergeFromDatabase','initTrunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','uniqueid','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','initSettings','exports','bluebird','util','lodash','moment','../model/agent','../model/trunk','../model/voiceQueue'];(function(_0x1318c3,_0x344d93){var _0x27bfd6=function(_0xa56ff6){while(--_0xa56ff6){_0x1318c3['push'](_0x1318c3['shift']());}};_0x27bfd6(++_0x344d93);}(_0x6eb8,0x69));var _0x86eb=function(_0x224d4f,_0x4dfb75){_0x224d4f=_0x224d4f-0x0;var _0x4cf0f3=_0x6eb8[_0x224d4f];return _0x4cf0f3;};'use strict';var BPromise=require(_0x86eb('0x0'));var util=require(_0x86eb('0x1'));var _=require(_0x86eb('0x2'));var moment=require(_0x86eb('0x3'));var Agent=require(_0x86eb('0x4'));var Telephone=require('../model/telephone');var Trunk=require(_0x86eb('0x5'));var VoiceQueue=require(_0x86eb('0x6'));var Trigger=require(_0x86eb('0x7'));var Template=require(_0x86eb('0x8'));var Campaign=require(_0x86eb('0x9'));var VoiceExtension=require(_0x86eb('0xa'));var ZendeskAccount=require(_0x86eb('0xb'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x86eb('0xc'));var SugarcrmAccount=require(_0x86eb('0xd'));var ZohoAccount=require(_0x86eb('0xe'));var DeskAccount=require(_0x86eb('0xf'));var VtigerAccount=require(_0x86eb('0x10'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x86eb('0x11'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x86eb('0x12')]={};this[_0x86eb('0x13')]={};this[_0x86eb('0x14')]={};this['voiceQueues']={};this[_0x86eb('0x15')]={};this[_0x86eb('0x16')]={};this[_0x86eb('0x17')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x86eb('0x18')]={};this[_0x86eb('0x19')]={};this['queueChannels']={};this['outboundChannels']={};this['timers']={};this[_0x86eb('0x1a')]={};this[_0x86eb('0x1b')]={};this[_0x86eb('0x1c')]={};this[_0x86eb('0x1d')]={};this[_0x86eb('0x1e')]={};this[_0x86eb('0x1f')]={};this[_0x86eb('0x20')]={};this['vtigerAccounts']={};this[_0x86eb('0x21')]={};this['dynamics365Accounts']={};this['freshsalesAccounts']={};this['faxAccounts']={};};function freeIsNotKey(_0x25d0d1,_0x3dc3ed,_0x249a2f){var _0x5ca5c0=_[_0x86eb('0x22')](_0x25d0d1,function(_0x28bfd5,_0x4f694d){return _0x28bfd5[_0x249a2f];});for(var _0x55b181 in _0x3dc3ed){if(_0x3dc3ed[_0x86eb('0x23')](_0x55b181)){if(!_0x5ca5c0[_0x55b181]){delete _0x3dc3ed[_0x55b181];}}}}function freeIsNotKeySip(_0x370d8d,_0x103045){var _0x4a54e7=_[_0x86eb('0x22')](_0x370d8d,function(_0x244b2c,_0x23676a){return util[_0x86eb('0x24')](_0x86eb('0x25'),_0x244b2c[_0x86eb('0x26')]);});for(var _0x171867 in _0x103045){if(_0x103045[_0x86eb('0x23')](_0x171867)){if(!_0x4a54e7[_0x171867]){delete _0x103045[_0x171867];}}}}function freeIsNotKeyAgent(_0x968a7d,_0x205f90){var _0x8061ef=_[_0x86eb('0x22')](_0x968a7d,function(_0xcc901a,_0x3bf20e){var _0x22a36b=_[_0x86eb('0x27')](_0xcc901a[_0x86eb('0x28')])?util[_0x86eb('0x24')](_0x86eb('0x25'),_0xcc901a['name']):_0xcc901a[_0x86eb('0x28')];return _0x22a36b;});for(var _0x5dfa91 in _0x205f90){if(_0x205f90['hasOwnProperty'](_0x5dfa91)){if(!_0x8061ef[_0x5dfa91]){delete _0x205f90[_0x5dfa91];}}}}function clearVoiceCallReports(_0x35dbf3){_0x35dbf3[_0x86eb('0x29')]=0x0;_0x35dbf3[_0x86eb('0x2a')]=0x0;_0x35dbf3[_0x86eb('0x2b')]=0x0;_0x35dbf3['sumDuration']=0x0;_0x35dbf3[_0x86eb('0x2c')]=0x0;}function clearCampaigns(_0x3c2bde){if(!_[_0x86eb('0x2d')](_0x3c2bde)){for(var _0x23295e in _0x3c2bde){if(_0x3c2bde[_0x86eb('0x23')](_0x23295e)){_0x3c2bde[_0x23295e][_0x86eb('0x2e')]=0x0;_0x3c2bde[_0x23295e][_0x86eb('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x212c94){if(!_['isEmpty'](_0x212c94)){for(var _0x322da4 in _0x212c94){if(_0x212c94['hasOwnProperty'](_0x322da4)){_0x212c94[_0x322da4][_0x86eb('0x29')]=0x0;_0x212c94[_0x322da4][_0x86eb('0x2a')]=0x0;_0x212c94[_0x322da4]['unmanaged']=0x0;_0x212c94[_0x322da4][_0x86eb('0x30')]=0x0;_0x212c94[_0x322da4][_0x86eb('0x2b')]=0x0;_0x212c94[_0x322da4][_0x86eb('0x31')]=0x0;_0x212c94[_0x322da4][_0x86eb('0x2c')]=0x0;_0x212c94[_0x322da4][_0x86eb('0x32')]=0x0;_0x212c94[_0x322da4][_0x86eb('0x33')]=0x0;_0x212c94[_0x322da4][_0x86eb('0x34')]=0x0;_0x212c94[_0x322da4][_0x86eb('0x35')]=0x0;_0x212c94[_0x322da4][_0x86eb('0x36')]=0x0;_0x212c94[_0x322da4][_0x86eb('0x37')]=0x0;_0x212c94[_0x322da4][_0x86eb('0x38')]=0x0;_0x212c94[_0x322da4][_0x86eb('0x39')]=0x0;_0x212c94[_0x322da4][_0x86eb('0x3a')]=0x0;_0x212c94[_0x322da4][_0x86eb('0x3b')]=0x0;_0x212c94[_0x322da4]['outboundRejectCallsDay']=0x0;_0x212c94[_0x322da4][_0x86eb('0x3c')]=0x0;_0x212c94[_0x322da4]['outboundAnswerAgiCallsDay']=0x0;_0x212c94[_0x322da4][_0x86eb('0x3d')]=0x0;_0x212c94[_0x322da4]['queueStatusComplete']=!![];}}}}Realtime[_0x86eb('0x3e')]['mergeFromDatabase']=function(_0x1892a6,_0x1cb126){for(var _0x73f5bb in _0x1cb126){if(_0x1892a6[_0x86eb('0x23')](_0x73f5bb)){_0x1892a6[_0x73f5bb]=_0x1cb126[_0x73f5bb];}}};Realtime['prototype'][_0x86eb('0x3f')]=function(){var _0xec17b0=this;return function(_0x18beab){if(_0x18beab){freeIsNotKeyAgent(_0x18beab,_0xec17b0[_0x86eb('0x12')]);for(var _0x3489b7=0x0,_0x1820a6={},_0x48c55a={};_0x3489b7<_0x18beab[_0x86eb('0x40')];_0x3489b7+=0x1){_0x1820a6=_0x18beab[_0x3489b7];var _0x311ada=_['isNil'](_0x1820a6[_0x86eb('0x28')])?util[_0x86eb('0x24')](_0x86eb('0x25'),_0x1820a6[_0x86eb('0x26')]):_0x1820a6[_0x86eb('0x28')];if(_[_0x86eb('0x41')](_0xec17b0[_0x86eb('0x12')][_0x311ada])){_0xec17b0['agents'][_0x311ada]=new Agent(_0x1820a6);}else{_0xec17b0[_0x86eb('0x42')](_0xec17b0[_0x86eb('0x12')][_0x311ada],_0x1820a6);}}}return _0xec17b0[_0x86eb('0x12')];};};Realtime[_0x86eb('0x3e')]['initTelephones']=function(){var _0x1e9121=this;return function(_0xbe9592){if(_0xbe9592){freeIsNotKeySip(_0xbe9592,_0x1e9121['telephones']);for(var _0x43a473=0x0,_0x206ef1={},_0x1da39c={};_0x43a473<_0xbe9592[_0x86eb('0x40')];_0x43a473+=0x1){_0x206ef1=_0xbe9592[_0x43a473];if(_[_0x86eb('0x41')](_0x1e9121['telephones'][util[_0x86eb('0x24')](_0x86eb('0x25'),_0x206ef1['name'])])){_0x1e9121[_0x86eb('0x13')][util[_0x86eb('0x24')](_0x86eb('0x25'),_0x206ef1[_0x86eb('0x26')])]=new Telephone(_0x206ef1);}else{_0x1e9121[_0x86eb('0x42')](_0x1e9121['telephones'][util[_0x86eb('0x24')]('SIP/%s',_0x206ef1[_0x86eb('0x26')])],_0x206ef1);}}}return _0x1e9121[_0x86eb('0x13')];};};Realtime[_0x86eb('0x3e')][_0x86eb('0x43')]=function(){var _0x14844b=this;return function(_0x47bf17){if(_0x47bf17){freeIsNotKeySip(_0x47bf17,_0x14844b[_0x86eb('0x14')]);for(var _0x400fd6=0x0,_0x4a9fa2={},_0xe98f14={};_0x400fd6<_0x47bf17[_0x86eb('0x40')];_0x400fd6+=0x1){_0x4a9fa2=_0x47bf17[_0x400fd6];if(_[_0x86eb('0x41')](_0x14844b[_0x86eb('0x14')][util['format']('SIP/%s',_0x4a9fa2[_0x86eb('0x26')])])){_0x14844b['trunks'][util['format'](_0x86eb('0x25'),_0x4a9fa2[_0x86eb('0x26')])]=new Trunk(_0x4a9fa2);}else{_0x14844b[_0x86eb('0x42')](_0x14844b[_0x86eb('0x14')][util[_0x86eb('0x24')]('SIP/%s',_0x4a9fa2['name'])],_0x4a9fa2);}}}return _0x14844b[_0x86eb('0x14')];};};Realtime[_0x86eb('0x3e')][_0x86eb('0x44')]=function(){var _0x32926b=this;return function(_0x3776f1){if(_0x3776f1){freeIsNotKey(_0x3776f1,_0x32926b['voiceQueues'],'name');for(var _0x56df8d=0x0,_0x2f9026={},_0x301515={};_0x56df8d<_0x3776f1[_0x86eb('0x40')];_0x56df8d+=0x1){_0x2f9026=_0x3776f1[_0x56df8d];if(_[_0x86eb('0x41')](_0x32926b['voiceQueues'][_0x2f9026[_0x86eb('0x26')]])){_0x32926b['voiceQueues'][_0x2f9026[_0x86eb('0x26')]]=new VoiceQueue(_0x2f9026);}else{_0x32926b[_0x86eb('0x42')](_0x32926b[_0x86eb('0x45')][_0x2f9026['name']],_0x2f9026);}}}return _0x32926b[_0x86eb('0x45')];};};Realtime[_0x86eb('0x3e')][_0x86eb('0x46')]=function(){var _0x15c582=this;return function(_0x4e44b7){if(_0x4e44b7){freeIsNotKey(_0x4e44b7,_0x15c582['triggers'],'id');for(var _0x4747d5=0x0,_0x23a8e8={},_0x32db6b={};_0x4747d5<_0x4e44b7[_0x86eb('0x40')];_0x4747d5+=0x1){_0x23a8e8=_0x4e44b7[_0x4747d5];if(_[_0x86eb('0x41')](_0x15c582[_0x86eb('0x15')][_0x23a8e8['id']])){_0x15c582['triggers'][_0x23a8e8['id']]=new Trigger(_0x23a8e8);}else{_0x15c582['mergeFromDatabase'](_0x15c582[_0x86eb('0x15')][_0x23a8e8['id']],_0x23a8e8);}}}return _0x15c582[_0x86eb('0x15')];};};Realtime[_0x86eb('0x3e')][_0x86eb('0x47')]=function(){var _0x2f04ec=this;return function(_0x15fd57){if(_0x15fd57){freeIsNotKey(_0x15fd57,_0x2f04ec[_0x86eb('0x17')],'id');for(var _0x50d5d7=0x0,_0x4a0e1f={},_0x3d8cee={};_0x50d5d7<_0x15fd57[_0x86eb('0x40')];_0x50d5d7+=0x1){_0x4a0e1f=_0x15fd57[_0x50d5d7];if(_[_0x86eb('0x41')](_0x2f04ec['templates'][_0x4a0e1f['id']])){_0x2f04ec['templates'][_0x4a0e1f['id']]=new Template(_0x4a0e1f);}else{_0x2f04ec[_0x86eb('0x42')](_0x2f04ec[_0x86eb('0x17')][_0x4a0e1f['id']],_0x4a0e1f);}}}return _0x2f04ec[_0x86eb('0x17')];};};Realtime[_0x86eb('0x3e')][_0x86eb('0x48')]=function(){var _0x1715fd=this;return function(_0x43969){if(_0x43969){freeIsNotKey(_0x43969,_0x1715fd['zendeskAccounts'],'id');for(var _0x49d336=0x0,_0x1c307a={},_0x456661={};_0x49d336<_0x43969[_0x86eb('0x40')];_0x49d336+=0x1){_0x1c307a=_0x43969[_0x49d336];if(_[_0x86eb('0x41')](_0x1715fd['zendeskAccounts'][_0x1c307a['id']])){_0x1715fd[_0x86eb('0x1b')][_0x1c307a['id']]=new ZendeskAccount(_0x1c307a);}else{_0x1715fd[_0x86eb('0x42')](_0x1715fd['zendeskAccounts'][_0x1c307a['id']],_0x1c307a);}}}return _0x1715fd[_0x86eb('0x1b')];};};Realtime[_0x86eb('0x3e')][_0x86eb('0x49')]=function(){var _0xe18bdb=this;return function(_0x3bd27a){if(_0x3bd27a){freeIsNotKey(_0x3bd27a,_0xe18bdb[_0x86eb('0x1c')],'id');for(var _0x3cb122=0x0,_0x1d4f46={},_0x2047c4={};_0x3cb122<_0x3bd27a[_0x86eb('0x40')];_0x3cb122+=0x1){_0x1d4f46=_0x3bd27a[_0x3cb122];if(_[_0x86eb('0x41')](_0xe18bdb[_0x86eb('0x1c')][_0x1d4f46['id']])){_0xe18bdb['salesforceAccounts'][_0x1d4f46['id']]=new SalesforceAccount(_0x1d4f46);}else{_0xe18bdb['mergeFromDatabase'](_0xe18bdb[_0x86eb('0x1c')][_0x1d4f46['id']],_0x1d4f46);}}}return _0xe18bdb['salesforceAccounts'];};};Realtime[_0x86eb('0x3e')][_0x86eb('0x4a')]=function(){var _0x2b5f3b=this;return function(_0x33edea){if(_0x33edea){freeIsNotKey(_0x33edea,_0x2b5f3b[_0x86eb('0x1e')],'id');for(var _0x40e3b2=0x0,_0xea4760={},_0x381798={};_0x40e3b2<_0x33edea[_0x86eb('0x40')];_0x40e3b2+=0x1){_0xea4760=_0x33edea[_0x40e3b2];if(_['isUndefined'](_0x2b5f3b[_0x86eb('0x1e')][_0xea4760['id']])){_0x2b5f3b[_0x86eb('0x1e')][_0xea4760['id']]=new FreshdeskAccount(_0xea4760);}else{_0x2b5f3b[_0x86eb('0x42')](_0x2b5f3b['freshdeskAccounts'][_0xea4760['id']],_0xea4760);}}}return _0x2b5f3b[_0x86eb('0x1e')];};};Realtime[_0x86eb('0x3e')]['initZohoAccounts']=function(){var _0xe9c906=this;return function(_0x715f64){if(_0x715f64){freeIsNotKey(_0x715f64,_0xe9c906['zohoAccounts'],'id');for(var _0x1038b7=0x0,_0x20a976={},_0x2df46e={};_0x1038b7<_0x715f64[_0x86eb('0x40')];_0x1038b7+=0x1){_0x20a976=_0x715f64[_0x1038b7];if(_['isUndefined'](_0xe9c906['zohoAccounts'][_0x20a976['id']])){_0xe9c906[_0x86eb('0x1f')][_0x20a976['id']]=new ZohoAccount(_0x20a976);}else{_0xe9c906[_0x86eb('0x42')](_0xe9c906[_0x86eb('0x1f')][_0x20a976['id']],_0x20a976);}}}return _0xe9c906[_0x86eb('0x1f')];};};Realtime[_0x86eb('0x3e')][_0x86eb('0x4b')]=function(){var _0xcea43d=this;return function(_0x5a1c53){if(_0x5a1c53){freeIsNotKey(_0x5a1c53,_0xcea43d[_0x86eb('0x20')],'id');for(var _0x831598=0x0,_0x50255c={},_0x51ce6a={};_0x831598<_0x5a1c53[_0x86eb('0x40')];_0x831598+=0x1){_0x50255c=_0x5a1c53[_0x831598];if(_['isUndefined'](_0xcea43d['deskAccounts'][_0x50255c['id']])){_0xcea43d[_0x86eb('0x20')][_0x50255c['id']]=new DeskAccount(_0x50255c);}else{_0xcea43d[_0x86eb('0x42')](_0xcea43d['deskAccounts'][_0x50255c['id']],_0x50255c);}}}return _0xcea43d[_0x86eb('0x20')];};};Realtime[_0x86eb('0x3e')][_0x86eb('0x4c')]=function(){var _0x5e9a49=this;return function(_0x13d26e){if(_0x13d26e){freeIsNotKey(_0x13d26e,_0x5e9a49[_0x86eb('0x1d')],'id');for(var _0x21dcce=0x0,_0x2352df={},_0x4e7b6b={};_0x21dcce<_0x13d26e['length'];_0x21dcce+=0x1){_0x2352df=_0x13d26e[_0x21dcce];if(_[_0x86eb('0x41')](_0x5e9a49[_0x86eb('0x1d')][_0x2352df['id']])){_0x5e9a49[_0x86eb('0x1d')][_0x2352df['id']]=new SugarcrmAccount(_0x2352df);}else{_0x5e9a49[_0x86eb('0x42')](_0x5e9a49[_0x86eb('0x1d')][_0x2352df['id']],_0x2352df);}}}return _0x5e9a49['sugarcrmAccounts'];};};Realtime['prototype'][_0x86eb('0x4d')]=function(){var _0x381e88=this;return function(_0x832ab1){if(_0x832ab1){freeIsNotKey(_0x832ab1,_0x381e88[_0x86eb('0x4e')],'id');for(var _0x5b64b8=0x0,_0x55a118={},_0x2c8764={};_0x5b64b8<_0x832ab1[_0x86eb('0x40')];_0x5b64b8+=0x1){_0x55a118=_0x832ab1[_0x5b64b8];if(_[_0x86eb('0x41')](_0x381e88[_0x86eb('0x4e')][_0x55a118['id']])){_0x381e88['vtigerAccounts'][_0x55a118['id']]=new VtigerAccount(_0x55a118);}else{_0x381e88[_0x86eb('0x42')](_0x381e88[_0x86eb('0x4e')][_0x55a118['id']],_0x55a118);}}}return _0x381e88[_0x86eb('0x4e')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x2d4dfd=this;return function(_0x52fc74){if(_0x52fc74){freeIsNotKey(_0x52fc74,_0x2d4dfd[_0x86eb('0x21')],'id');for(var _0x53aa02=0x0,_0x262fc2={},_0x5ecdb4={};_0x53aa02<_0x52fc74[_0x86eb('0x40')];_0x53aa02+=0x1){_0x262fc2=_0x52fc74[_0x53aa02];if(_[_0x86eb('0x41')](_0x2d4dfd[_0x86eb('0x21')][_0x262fc2['id']])){_0x2d4dfd[_0x86eb('0x21')][_0x262fc2['id']]=new ServicenowAccount(_0x262fc2);}else{_0x2d4dfd[_0x86eb('0x42')](_0x2d4dfd['servicenowAccounts'][_0x262fc2['id']],_0x262fc2);}}}return _0x2d4dfd[_0x86eb('0x21')];};};Realtime[_0x86eb('0x3e')][_0x86eb('0x4f')]=function(){var _0x512680=this;return function(_0x5de166){if(_0x5de166){freeIsNotKey(_0x5de166,_0x512680[_0x86eb('0x50')],'id');for(var _0x3d60ec=0x0,_0x5a2d82={},_0x596af7={};_0x3d60ec<_0x5de166['length'];_0x3d60ec+=0x1){_0x5a2d82=_0x5de166[_0x3d60ec];if(_[_0x86eb('0x41')](_0x512680[_0x86eb('0x50')][_0x5a2d82['id']])){_0x512680[_0x86eb('0x50')][_0x5a2d82['id']]=new Dynamics365Account(_0x5a2d82);}else{_0x512680[_0x86eb('0x42')](_0x512680[_0x86eb('0x50')][_0x5a2d82['id']],_0x5a2d82);}}}return _0x512680[_0x86eb('0x50')];};};Realtime['prototype'][_0x86eb('0x51')]=function(){var _0x1c5c84=this;return function(_0x261277){if(_0x261277){freeIsNotKey(_0x261277,_0x1c5c84[_0x86eb('0x52')],'id');for(var _0x4dc9fa=0x0,_0x21c56e={},_0x150751={};_0x4dc9fa<_0x261277['length'];_0x4dc9fa+=0x1){_0x21c56e=_0x261277[_0x4dc9fa];if(_[_0x86eb('0x41')](_0x1c5c84[_0x86eb('0x52')][_0x21c56e['id']])){_0x1c5c84[_0x86eb('0x52')][_0x21c56e['id']]=new FreshsalesAccount(_0x21c56e);}else{_0x1c5c84['mergeFromDatabase'](_0x1c5c84[_0x86eb('0x52')][_0x21c56e['id']],_0x21c56e);}}}return _0x1c5c84[_0x86eb('0x52')];};};Realtime[_0x86eb('0x3e')][_0x86eb('0x53')]=function(){var _0x5739b4=this;return function(_0x1be306){for(var _0x43b139=0x0;_0x43b139<_0x1be306['length'];_0x43b139+=0x1){_[_0x86eb('0x54')](_0x5739b4[_0x86eb('0x45')][_0x1be306[_0x43b139]['name']],_0x1be306[_0x43b139]);}return _0x5739b4[_0x86eb('0x45')];};};Realtime[_0x86eb('0x3e')][_0x86eb('0x55')]=function(){var _0xa0ecf3=this;return function(_0xb7266e){clearVoiceQueues(_0xa0ecf3[_0x86eb('0x45')]);if(_0xb7266e){_0xb7266e=_['groupBy'](_0xb7266e,_0x86eb('0x56'));for(var _0x43f1e7 in _0xb7266e){if(_0xb7266e['hasOwnProperty'](_0x43f1e7)){var _0x59d1d7={};for(var _0x27ce29=0x0;_0x27ce29<_0xb7266e[_0x43f1e7][_0x86eb('0x40')];_0x27ce29+=0x1){var _0xad96c3=_0xb7266e[_0x43f1e7][_0x27ce29][_0x86eb('0x57')];if(_0xa0ecf3[_0x86eb('0x45')][_0xad96c3]){if(_0xb7266e[_0x43f1e7][_0x27ce29][_0x86eb('0x58')]){_0xa0ecf3[_0x86eb('0x45')][_0xad96c3][_0x86eb('0x59')]+=0x1;}if(_0xb7266e[_0x43f1e7][_0x27ce29][_0x86eb('0x5a')]){_0xa0ecf3['voiceQueues'][_0xad96c3]['abandoned']+=0x1;}_0xa0ecf3[_0x86eb('0x45')][_0xad96c3]['sumHoldTime']+=moment(_0xb7266e[_0x43f1e7][_0x27ce29][_0x86eb('0x5b')])[_0x86eb('0x5c')](moment(_0xb7266e[_0x43f1e7][_0x27ce29][_0x86eb('0x5d')]),_0x86eb('0x5e'))||0x0;if(_0x27ce29===_0xb7266e[_0x43f1e7][_0x86eb('0x40')]-0x1){_0xa0ecf3[_0x86eb('0x45')][_0xad96c3][_0x86eb('0x31')]+=moment(_0xb7266e[_0x43f1e7][_0x27ce29]['queuecallercompleteAt']||_0xb7266e[_0x43f1e7][_0x27ce29][_0x86eb('0x5f')]||_0xb7266e[_0x43f1e7][_0x27ce29][_0x86eb('0x60')])[_0x86eb('0x5c')](moment(_0xb7266e[_0x43f1e7][_0x27ce29][_0x86eb('0x5d')]),_0x86eb('0x5e'))||0x0;_0xa0ecf3[_0x86eb('0x45')][_0xad96c3]['total']+=0x1;if(_0xb7266e[_0x43f1e7][_0x27ce29]['queuecallercomplete']){_0xa0ecf3[_0x86eb('0x45')][_0xad96c3][_0x86eb('0x2a')]+=0x1;_0xa0ecf3[_0x86eb('0x45')][_0xad96c3][_0x86eb('0x2c')]+=moment(_0xb7266e[_0x43f1e7][_0x27ce29]['queuecallercompleteAt'])[_0x86eb('0x5c')](moment(_0xb7266e[_0x43f1e7][_0x27ce29][_0x86eb('0x5b')]),_0x86eb('0x5e'))||0x0;}}else{_0xa0ecf3[_0x86eb('0x45')][_0xad96c3][_0x86eb('0x31')]+=_0xa0ecf3[_0x86eb('0x45')][_0xad96c3][_0x86eb('0x2b')]||0x0;}}}}}}return _0xa0ecf3[_0x86eb('0x45')];};};Realtime[_0x86eb('0x3e')][_0x86eb('0x61')]=function(){var _0x29ea90=this;return function(_0x479120){clearVoiceCallReports(_0x29ea90[_0x86eb('0x62')]);if(_0x479120){for(var _0x168b14=0x0;_0x168b14<_0x479120[_0x86eb('0x40')];_0x168b14+=0x1){_0x29ea90[_0x86eb('0x62')]['total']+=0x1;_0x29ea90[_0x86eb('0x62')][_0x86eb('0x31')]+=_0x479120[_0x168b14][_0x86eb('0x63')];if(_0x479120[_0x168b14][_0x86eb('0x64')]===_0x86eb('0x65')){_0x29ea90['outbound']['answered']+=0x1;_0x29ea90[_0x86eb('0x62')]['sumHoldTime']+=_0x479120[_0x168b14][_0x86eb('0x63')]-_0x479120[_0x168b14][_0x86eb('0x66')]||0x0;_0x29ea90['outbound'][_0x86eb('0x2c')]+=_0x479120[_0x168b14][_0x86eb('0x66')];}}}return _0x29ea90[_0x86eb('0x62')];};};Realtime[_0x86eb('0x3e')][_0x86eb('0x67')]=function(){var _0x7d5f3e=this;return function(_0x2d0300){if(_0x2d0300){freeIsNotKey(_0x2d0300,_0x7d5f3e['campaigns'],_0x86eb('0x26'));for(var _0x2be374=0x0,_0x40d005={};_0x2be374<_0x2d0300[_0x86eb('0x40')];_0x2be374+=0x1){_0x40d005=_0x2d0300[_0x2be374];if(_[_0x86eb('0x41')](_0x7d5f3e['campaigns'][_0x40d005['name']])){_0x7d5f3e[_0x86eb('0x16')][_0x40d005[_0x86eb('0x26')]]=new Campaign(_0x40d005);}else{_0x7d5f3e[_0x86eb('0x42')](_0x7d5f3e[_0x86eb('0x16')][_0x40d005['name']],_0x40d005);_0x7d5f3e['campaigns'][_0x40d005['name']][_0x86eb('0x68')]=_0x40d005[_0x86eb('0x69')]?_0x40d005[_0x86eb('0x69')][_0x86eb('0x26')]:undefined;}}}return _0x7d5f3e[_0x86eb('0x16')];};};Realtime[_0x86eb('0x3e')][_0x86eb('0x6a')]=function(){var _0x3c3ad7=this;return function(_0x4f3d21){if(_0x4f3d21){freeIsNotKey(_0x4f3d21,_0x3c3ad7[_0x86eb('0x18')],'id');for(var _0xb9e87=0x0,_0xe6c416={};_0xb9e87<_0x4f3d21[_0x86eb('0x40')];_0xb9e87+=0x1){_0xe6c416=_0x4f3d21[_0xb9e87];if(_[_0x86eb('0x41')](_0x3c3ad7['voiceExtensions'][_0xe6c416['id']])){_0x3c3ad7[_0x86eb('0x18')][_0xe6c416['id']]=new VoiceExtension(_0xe6c416);}else{_0x3c3ad7[_0x86eb('0x42')](_0x3c3ad7[_0x86eb('0x18')][_0xe6c416['id']],_0xe6c416);}}}return _0x3c3ad7['voiceExtensions'];};};Realtime['prototype'][_0x86eb('0x6b')]=function(){var _0x4d0877=this;return function(_0x3837c9){clearCampaigns(_0x4d0877[_0x86eb('0x16')]);for(var _0xfd1dd1=0x0;_0xfd1dd1<_0x3837c9[_0x86eb('0x40')];_0xfd1dd1+=0x1){_[_0x86eb('0x54')](_0x4d0877[_0x86eb('0x16')][_0x3837c9[_0xfd1dd1][_0x86eb('0x26')]],_0x3837c9[_0xfd1dd1]);}return _0x4d0877['campaigns'];};};Realtime['prototype'][_0x86eb('0x6c')]=function(){var _0x116d06=this;return function(_0x21292c){if(_0x21292c){freeIsNotKey(_0x21292c,_0x116d06[_0x86eb('0x6d')],'id');for(var _0xdba7ec=0x0,_0x50c7b8={},_0xa7ba3d={};_0xdba7ec<_0x21292c[_0x86eb('0x40')];_0xdba7ec+=0x1){_0x50c7b8=_0x21292c[_0xdba7ec];if(_[_0x86eb('0x41')](_0x116d06[_0x86eb('0x6d')][_0x50c7b8['id']])){_0x116d06['faxAccounts'][_0x50c7b8['id']]=new FaxAccount(_0x50c7b8);}else{_0x116d06[_0x86eb('0x42')](_0x116d06[_0x86eb('0x6d')][_0x50c7b8['id']],_0x50c7b8);}}}return _0x116d06[_0x86eb('0x6d')];};};Realtime[_0x86eb('0x3e')][_0x86eb('0x6e')]=function(){var _0x2d9c1c=this;return function(_0x396b3e){_0x2d9c1c[_0x86eb('0x1a')]=_0x396b3e;return _0x2d9c1c['settings'];};};module[_0x86eb('0x6f')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index c0bfebd..445f785 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 _0x690c=['util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','telephones','prototype','sync','xdr','disabled','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','agents','accountcode','isNil','interface','format','SIP/%s','name','length','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','destination','type','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview','calleridnum','channel','destinationchannel','originatecalleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','monitor','monitors','monitorFilename','createdAt','exten','connectedlinename','membername','xcally-motion-dialer','voiceAgentReport','isArray','forEach','substring','indexOf','mobile','phone','lastIndexOf','exports','lodash','moment'];(function(_0x36a88a,_0x190ec7){var _0x57200c=function(_0x4302c4){while(--_0x4302c4){_0x36a88a['push'](_0x36a88a['shift']());}};_0x57200c(++_0x190ec7);}(_0x690c,0x1b6));var _0xc690=function(_0x3bb5b4,_0x128455){_0x3bb5b4=_0x3bb5b4-0x0;var _0x586c60=_0x690c[_0x3bb5b4];return _0x586c60;};'use strict';var _=require(_0xc690('0x0'));var moment=require(_0xc690('0x1'));var util=require(_0xc690('0x2'));var config=require(_0xc690('0x3'));var ami=require(_0xc690('0x4'));var RpcVoiceAgentReport=require(_0xc690('0x5'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xc690('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xc690('0x7'));var RpcVoiceRecording=require(_0xc690('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xc690('0x9'));var VoiceCallReport=require(_0xc690('0xa'));var VoiceAgentReport=require(_0xc690('0xb'));var VoiceDialReport=require(_0xc690('0xc'));var UserReport=require(_0xc690('0xd'));function Report(_0x54e284){this[_0xc690('0xe')]=_0x54e284;this['agents']=_0x54e284['agents'];this[_0xc690('0xf')]=_0x54e284[_0xc690('0xf')];}Report[_0xc690('0x10')][_0xc690('0x11')]=function(_0x574b80){var _0xdc0391=new VoiceQueueReport(this[_0xc690('0xe')]);var _0x22f7eb=new VoiceAgentReport(this[_0xc690('0xe')]);var _0x3738c6=new VoiceDialReport(this[_0xc690('0xe')]);var _0xf8e87f=new VoiceCallReport(this[_0xc690('0xe')]);var _0x27029e=new UserReport(this[_0xc690('0xe')]);if(config['xdr']&&config[_0xc690('0x12')][_0xc690('0x13')]){ami['on']('custom:voiceQueueReport',this[_0xc690('0x14')]['bind'](this));ami['on'](_0xc690('0x15'),this[_0xc690('0x16')][_0xc690('0x17')](this));ami['on'](_0xc690('0x18'),this['voiceAgentReport'][_0xc690('0x17')](this));ami['on']('custom:voiceDialReport',this[_0xc690('0x19')][_0xc690('0x17')](this));ami['on'](_0xc690('0x1a'),this[_0xc690('0x1b')][_0xc690('0x17')](this));ami['on'](_0xc690('0x1c'),this[_0xc690('0x1d')][_0xc690('0x17')](this));}};Report[_0xc690('0x10')][_0xc690('0x1e')]=function(_0x27b239){var _0x2133e9;_0x2133e9=_[_0xc690('0x1f')](this[_0xc690('0x20')],function(_0x4d3568){return _0x4d3568[_0xc690('0x21')]==_0x27b239||_0x4d3568['name']==_0x27b239;});if(_[_0xc690('0x22')](_0x2133e9)){var _0x10e146=_['find'](this[_0xc690('0xf')],function(_0x1d26b0){return _0x1d26b0['accountcode']==_0x27b239||_0x1d26b0['name']==_0x27b239;});if(_0x10e146){_0x2133e9=_[_0xc690('0x1f')](this[_0xc690('0x20')],function(_0x116bc7){return _0x116bc7[_0xc690('0x23')]==util[_0xc690('0x24')](_0xc690('0x25'),_0x10e146[_0xc690('0x26')]);});}}return _0x2133e9;};Report[_0xc690('0x10')][_0xc690('0x14')]=function(_0x509892){for(var _0x5c3476=0x0;_0x5c3476<_0x509892[_0xc690('0x27')];_0x5c3476+=0x1){var _0x4bfb46=this[_0xc690('0x1e')](_0x509892[_0x5c3476][_0xc690('0x28')]);if(_0x4bfb46){_0x509892[_0x5c3476][_0xc690('0x21')]=_0x4bfb46[_0xc690('0x21')];_0x509892[_0x5c3476][_0xc690('0x29')]=!![];_0x509892[_0x5c3476][_0xc690('0x2a')]=_0x4bfb46[_0xc690('0x26')];_0x509892[_0x5c3476]['interface']=_[_0xc690('0x22')](_0x4bfb46['interface'])?util['format'](_0xc690('0x25'),_0x4bfb46[_0xc690('0x26')]):_0x4bfb46[_0xc690('0x23')];if(_0x509892[_0x5c3476][_0xc690('0x2b')]){_0x509892[_0x5c3476][_0xc690('0x2c')]=moment()[_0xc690('0x24')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x509892[_0x5c3476][_0xc690('0x2d')]){_0x509892[_0x5c3476][_0xc690('0x2e')]=moment()[_0xc690('0x24')](_0xc690('0x2f'));}RpcMemberReport[_0xc690('0x14')](_0x509892[_0x5c3476]);}RpcVoiceQueueReport[_0xc690('0x30')](_0x509892[_0x5c3476]);}};function extractCalleridNumber(_0x104705){var _0x190dbd=_0x104705[_0xc690('0x31')](/<(.*?)>/);return _0x190dbd?_0x190dbd[0x1]:_0x104705;}Report[_0xc690('0x10')][_0xc690('0x16')]=function(_0x3475af){_0x3475af['destination']=_0x3475af[_0xc690('0x32')]||_0x3475af['exten'];if(_0x3475af[_0xc690('0x33')]=='dialer'){_0x3475af['lastapplication']=_0xc690('0x34');_0x3475af[_0xc690('0x35')]=_0x3475af[_0xc690('0x34')];if(_0x3475af[_0xc690('0x36')]==_0xc690('0x37')){_0x3475af[_0xc690('0x21')]='';_0x3475af[_0xc690('0x32')]=extractCalleridNumber(_0x3475af[_0xc690('0x38')]);}else if(_0x3475af[_0xc690('0x36')]==_0xc690('0x39')){if(_0x3475af[_0xc690('0x32')]==_0xc690('0x3a')){_0x3475af[_0xc690('0x32')]=extractCalleridNumber(_0x3475af[_0xc690('0x3b')]);_0x3475af[_0xc690('0x3c')]=_0x3475af['originatecalleridnum'];_0x3475af['destinationchannel']=[_0x3475af[_0xc690('0x3d')],_0x3475af[_0xc690('0x3d')]=_0x3475af[_0xc690('0x3e')]][0x0];_0x3475af[_0xc690('0x38')]=_0x3475af[_0xc690('0x3b')];}else{_0x3475af[_0xc690('0x32')]=_0x3475af[_0xc690('0x3c')];_0x3475af[_0xc690('0x3c')]=_0x3475af[_0xc690('0x3f')];if(_0x3475af[_0xc690('0x40')]==_0xc690('0x41')){_0x3475af[_0xc690('0x21')]=_0x3475af['connectedlinenum'];}else{_0x3475af[_0xc690('0x21')]='';}}}}else{_0x3475af['callerid']=util[_0xc690('0x24')](_0xc690('0x42'),_0x3475af[_0xc690('0x43')],_0x3475af[_0xc690('0x3c')]);}if(RpcVoiceTransferReport[_0xc690('0x44')][_0x3475af[_0xc690('0x45')]]){var _0x2b9666=RpcVoiceTransferReport[_0xc690('0x44')][_0x3475af[_0xc690('0x45')]];_0x2b9666[_0xc690('0x46')]=_0x3475af['uniqueid'];RpcVoiceTransferReport[_0xc690('0x1b')](_0x2b9666);delete RpcVoiceTransferReport['transfers'][_0x3475af['linkedid']];}RpcVoiceCallReport[_0xc690('0x30')](_0x3475af);if(_0x3475af[_0xc690('0x47')]){for(var _0x5f2d5d=0x0;_0x5f2d5d<_0x3475af[_0xc690('0x48')][_0xc690('0x27')];_0x5f2d5d+=0x1){_0x3475af[_0xc690('0x49')]=_0x3475af['monitors'][_0x5f2d5d]['filename'];_0x3475af[_0xc690('0x4a')]=_0x3475af['monitors'][_0x5f2d5d][_0xc690('0x4a')];if(_0x3475af[_0xc690('0x4b')]=='xcally-motion-preview'){_0x3475af[_0xc690('0x3c')]=_0x3475af[_0xc690('0x28')];_0x3475af['calleridname']=_0x3475af[_0xc690('0x4c')];_0x3475af[_0xc690('0x28')]=_0x3475af[_0xc690('0x21')];_0x3475af[_0xc690('0x4c')]=_0x3475af[_0xc690('0x4d')];_0x3475af[_0xc690('0x4b')]=_0x3475af[_0xc690('0x3f')];}else if(_0x3475af[_0xc690('0x4b')]==_0xc690('0x4e')){_0x3475af[_0xc690('0x3c')]=_0x3475af['destination'];_0x3475af[_0xc690('0x4b')]=_0x3475af[_0xc690('0x3f')];}RpcVoiceRecording['create'](_0x3475af);}}};Report['prototype'][_0xc690('0x4f')]=function(_0x1e6407){if(_[_0xc690('0x50')](_0x1e6407)){_0x1e6407[_0xc690('0x51')](function(_0x285f8d){RpcVoiceAgentReport[_0xc690('0x30')](_0x285f8d);});}else{RpcVoiceAgentReport[_0xc690('0x30')](_0x1e6407);}};Report[_0xc690('0x10')][_0xc690('0x19')]=function(_0x50b8f3){RpcVoiceDialReport[_0xc690('0x30')](_0x50b8f3);var _0x2a065c;var _0x3be6ff;var _0x24d581=_0x50b8f3[_0xc690('0x3d')];if(_['startsWith'](_0x24d581,'Local')){_0x3be6ff=_0x24d581[_0xc690('0x52')](_0x24d581['indexOf']('/')+0x1,_0x24d581[_0xc690('0x53')]('@'));_0x2a065c=_['find'](this[_0xc690('0x20')],function(_0x1bd2d6){return _0x1bd2d6[_0xc690('0x54')]==_0x3be6ff||_0x1bd2d6[_0xc690('0x55')]==_0x3be6ff||_0x1bd2d6[_0xc690('0x21')]==_0x3be6ff;});}else{_0x3be6ff=_0x24d581['substring'](_0x24d581['indexOf']('/')+0x1,_0x24d581[_0xc690('0x56')]('-'));_0x2a065c=this['findAgent'](_0x3be6ff);}if(_0x2a065c){_0x50b8f3[_0xc690('0x23')]=_['isNil'](_0x2a065c[_0xc690('0x23')])?util['format'](_0xc690('0x25'),_0x2a065c[_0xc690('0x26')]):_0x2a065c[_0xc690('0x23')];_0x50b8f3[_0xc690('0x4d')]=_0x2a065c[_0xc690('0x26')];_0x50b8f3[_0xc690('0x21')]=_0x2a065c['accountcode'];RpcMemberReport[_0xc690('0x19')](_0x50b8f3);}};Report[_0xc690('0x10')]['blindTransfer']=function(_0x3431e0){RpcVoiceTransferReport['transfers'][_0x3431e0['transfererlinkedid']]=_0x3431e0;};Report[_0xc690('0x10')][_0xc690('0x1d')]=function(_0x29e5ec){RpcVoiceTransferReport[_0xc690('0x1d')](_0x29e5ec);};module[_0xc690('0x57')]=Report; \ No newline at end of file +var _0x8d8b=['accountcode','interface','format','length','connectedlinenum','assigned','lastAssignedTo','SIP/%s','queuecallercomplete','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','voiceCallReport','destination','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','destinationchannel','channel','calleridpreview','calleridnum','originatecalleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','uniqueid','monitor','monitorFilename','monitors','createdAt','exten','membername','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','indexOf','mobile','lastIndexOf','transfererlinkedid','attendedTransfer','exports','lodash','moment','../ami','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindTransfer','attendedtransfer','findAgent','find','name','isNil'];(function(_0x28cfe4,_0x5e7410){var _0x1283b2=function(_0x2a6d15){while(--_0x2a6d15){_0x28cfe4['push'](_0x28cfe4['shift']());}};_0x1283b2(++_0x5e7410);}(_0x8d8b,0xe3));var _0xb8d8=function(_0x2f6aa4,_0x26e7de){_0x2f6aa4=_0x2f6aa4-0x0;var _0x2e435a=_0x8d8b[_0x2f6aa4];return _0x2e435a;};'use strict';var _=require(_0xb8d8('0x0'));var moment=require(_0xb8d8('0x1'));var util=require('util');var config=require('../../../config/environment');var ami=require(_0xb8d8('0x2'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xb8d8('0x3'));var RpcMemberReport=require(_0xb8d8('0x4'));var RpcVoiceQueueReport=require(_0xb8d8('0x5'));var RpcVoiceRecording=require(_0xb8d8('0x6'));var RpcVoiceTransferReport=require(_0xb8d8('0x7'));var VoiceQueueReport=require(_0xb8d8('0x8'));var VoiceCallReport=require(_0xb8d8('0x9'));var VoiceAgentReport=require(_0xb8d8('0xa'));var VoiceDialReport=require(_0xb8d8('0xb'));var UserReport=require('./userReport');function Report(_0x261fa9){this[_0xb8d8('0xc')]=_0x261fa9;this['agents']=_0x261fa9[_0xb8d8('0xd')];this['telephones']=_0x261fa9[_0xb8d8('0xe')];}Report[_0xb8d8('0xf')][_0xb8d8('0x10')]=function(_0x5ad2b2){var _0x292907=new VoiceQueueReport(this[_0xb8d8('0xc')]);var _0xcb21d6=new VoiceAgentReport(this['realtime']);var _0x4662a7=new VoiceDialReport(this[_0xb8d8('0xc')]);var _0x1f1d5e=new VoiceCallReport(this[_0xb8d8('0xc')]);var _0x49b3b9=new UserReport(this[_0xb8d8('0xc')]);if(config[_0xb8d8('0x11')]&&config[_0xb8d8('0x11')][_0xb8d8('0x12')]){ami['on'](_0xb8d8('0x13'),this[_0xb8d8('0x14')][_0xb8d8('0x15')](this));ami['on']('custom:voiceCallReport',this['voiceCallReport'][_0xb8d8('0x15')](this));ami['on']('custom:voiceAgentReport',this[_0xb8d8('0x16')][_0xb8d8('0x15')](this));ami['on'](_0xb8d8('0x17'),this[_0xb8d8('0x18')][_0xb8d8('0x15')](this));ami['on']('blindtransfer',this[_0xb8d8('0x19')]['bind'](this));ami['on'](_0xb8d8('0x1a'),this['attendedTransfer']['bind'](this));}};Report[_0xb8d8('0xf')][_0xb8d8('0x1b')]=function(_0xb222f8){var _0x302bc5;_0x302bc5=_[_0xb8d8('0x1c')](this[_0xb8d8('0xd')],function(_0x48b972){return _0x48b972['accountcode']==_0xb222f8||_0x48b972[_0xb8d8('0x1d')]==_0xb222f8;});if(_[_0xb8d8('0x1e')](_0x302bc5)){var _0x2a93c4=_[_0xb8d8('0x1c')](this['telephones'],function(_0x10fc64){return _0x10fc64[_0xb8d8('0x1f')]==_0xb222f8||_0x10fc64[_0xb8d8('0x1d')]==_0xb222f8;});if(_0x2a93c4){_0x302bc5=_['find'](this[_0xb8d8('0xd')],function(_0x206c59){return _0x206c59[_0xb8d8('0x20')]==util[_0xb8d8('0x21')]('SIP/%s',_0x2a93c4[_0xb8d8('0x1d')]);});}}return _0x302bc5;};Report[_0xb8d8('0xf')][_0xb8d8('0x14')]=function(_0x4d1291){for(var _0x5ba913=0x0;_0x5ba913<_0x4d1291[_0xb8d8('0x22')];_0x5ba913+=0x1){var _0x33e829=this[_0xb8d8('0x1b')](_0x4d1291[_0x5ba913][_0xb8d8('0x23')]);if(_0x33e829){_0x4d1291[_0x5ba913][_0xb8d8('0x1f')]=_0x33e829['accountcode'];_0x4d1291[_0x5ba913][_0xb8d8('0x24')]=!![];_0x4d1291[_0x5ba913][_0xb8d8('0x25')]=_0x33e829[_0xb8d8('0x1d')];_0x4d1291[_0x5ba913]['interface']=_[_0xb8d8('0x1e')](_0x33e829[_0xb8d8('0x20')])?util['format'](_0xb8d8('0x26'),_0x33e829[_0xb8d8('0x1d')]):_0x33e829[_0xb8d8('0x20')];if(_0x4d1291[_0x5ba913][_0xb8d8('0x27')]){_0x4d1291[_0x5ba913]['queuecallercompleteAt']=moment()[_0xb8d8('0x21')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4d1291[_0x5ba913]['queuecallerexit']){_0x4d1291[_0x5ba913][_0xb8d8('0x28')]=moment()[_0xb8d8('0x21')](_0xb8d8('0x29'));}RpcMemberReport[_0xb8d8('0x14')](_0x4d1291[_0x5ba913]);}RpcVoiceQueueReport[_0xb8d8('0x2a')](_0x4d1291[_0x5ba913]);}};function extractCalleridNumber(_0x552a85){var _0x1fd1a3=_0x552a85[_0xb8d8('0x2b')](/<(.*?)>/);return _0x1fd1a3?_0x1fd1a3[0x1]:_0x552a85;}Report[_0xb8d8('0xf')][_0xb8d8('0x2c')]=function(_0x3c9609){_0x3c9609[_0xb8d8('0x2d')]=_0x3c9609[_0xb8d8('0x2d')]||_0x3c9609['exten'];if(_0x3c9609[_0xb8d8('0x2e')]==_0xb8d8('0x2f')){_0x3c9609[_0xb8d8('0x30')]=_0xb8d8('0x31');_0x3c9609[_0xb8d8('0x32')]=_0x3c9609[_0xb8d8('0x31')];if(_0x3c9609[_0xb8d8('0x33')]==_0xb8d8('0x34')){_0x3c9609['accountcode']='';_0x3c9609[_0xb8d8('0x2d')]=extractCalleridNumber(_0x3c9609[_0xb8d8('0x35')]);}else if(_0x3c9609[_0xb8d8('0x33')]==_0xb8d8('0x36')){if(_0x3c9609[_0xb8d8('0x2d')]==_0xb8d8('0x37')){_0x3c9609[_0xb8d8('0x2d')]=extractCalleridNumber(_0x3c9609['calleridpreview']);_0x3c9609['calleridnum']=_0x3c9609['originatecalleridnum'];_0x3c9609[_0xb8d8('0x38')]=[_0x3c9609[_0xb8d8('0x39')],_0x3c9609[_0xb8d8('0x39')]=_0x3c9609['destinationchannel']][0x0];_0x3c9609[_0xb8d8('0x35')]=_0x3c9609[_0xb8d8('0x3a')];}else{_0x3c9609[_0xb8d8('0x2d')]=_0x3c9609[_0xb8d8('0x3b')];_0x3c9609[_0xb8d8('0x3b')]=_0x3c9609[_0xb8d8('0x3c')];if(_0x3c9609[_0xb8d8('0x3d')]==_0xb8d8('0x3e')){_0x3c9609[_0xb8d8('0x1f')]=_0x3c9609[_0xb8d8('0x23')];}else{_0x3c9609[_0xb8d8('0x1f')]='';}}}}else{_0x3c9609[_0xb8d8('0x35')]=util['format'](_0xb8d8('0x3f'),_0x3c9609[_0xb8d8('0x40')],_0x3c9609[_0xb8d8('0x3b')]);}if(RpcVoiceTransferReport[_0xb8d8('0x41')][_0x3c9609[_0xb8d8('0x42')]]){var _0x6e166b=RpcVoiceTransferReport[_0xb8d8('0x41')][_0x3c9609[_0xb8d8('0x42')]];_0x6e166b['transfereelinkedid']=_0x3c9609[_0xb8d8('0x43')];RpcVoiceTransferReport[_0xb8d8('0x19')](_0x6e166b);delete RpcVoiceTransferReport['transfers'][_0x3c9609[_0xb8d8('0x42')]];}RpcVoiceCallReport['create'](_0x3c9609);if(_0x3c9609[_0xb8d8('0x44')]){for(var _0x179fe3=0x0;_0x179fe3<_0x3c9609['monitors'][_0xb8d8('0x22')];_0x179fe3+=0x1){_0x3c9609[_0xb8d8('0x45')]=_0x3c9609[_0xb8d8('0x46')][_0x179fe3]['filename'];_0x3c9609['createdAt']=_0x3c9609[_0xb8d8('0x46')][_0x179fe3][_0xb8d8('0x47')];if(_0x3c9609[_0xb8d8('0x48')]==_0xb8d8('0x37')){_0x3c9609[_0xb8d8('0x3b')]=_0x3c9609[_0xb8d8('0x23')];_0x3c9609[_0xb8d8('0x40')]=_0x3c9609['connectedlinename'];_0x3c9609['connectedlinenum']=_0x3c9609[_0xb8d8('0x1f')];_0x3c9609['connectedlinename']=_0x3c9609[_0xb8d8('0x49')];_0x3c9609[_0xb8d8('0x48')]=_0x3c9609[_0xb8d8('0x3c')];}else if(_0x3c9609[_0xb8d8('0x48')]==_0xb8d8('0x4a')){_0x3c9609['calleridnum']=_0x3c9609[_0xb8d8('0x2d')];_0x3c9609[_0xb8d8('0x48')]=_0x3c9609[_0xb8d8('0x3c')];}RpcVoiceRecording[_0xb8d8('0x2a')](_0x3c9609);}}};Report[_0xb8d8('0xf')][_0xb8d8('0x16')]=function(_0x5ba6e1){if(_[_0xb8d8('0x4b')](_0x5ba6e1)){_0x5ba6e1[_0xb8d8('0x4c')](function(_0x4dc063){RpcVoiceAgentReport['create'](_0x4dc063);});}else{RpcVoiceAgentReport[_0xb8d8('0x2a')](_0x5ba6e1);}};Report[_0xb8d8('0xf')][_0xb8d8('0x18')]=function(_0x10d618){RpcVoiceDialReport['create'](_0x10d618);var _0xce983b;var _0x2e3ba8;var _0x559e78=_0x10d618['channel'];if(_[_0xb8d8('0x4d')](_0x559e78,_0xb8d8('0x4e'))){_0x2e3ba8=_0x559e78[_0xb8d8('0x4f')](_0x559e78[_0xb8d8('0x50')]('/')+0x1,_0x559e78[_0xb8d8('0x50')]('@'));_0xce983b=_[_0xb8d8('0x1c')](this[_0xb8d8('0xd')],function(_0x478dd0){return _0x478dd0[_0xb8d8('0x51')]==_0x2e3ba8||_0x478dd0['phone']==_0x2e3ba8||_0x478dd0['accountcode']==_0x2e3ba8;});}else{_0x2e3ba8=_0x559e78[_0xb8d8('0x4f')](_0x559e78[_0xb8d8('0x50')]('/')+0x1,_0x559e78[_0xb8d8('0x52')]('-'));_0xce983b=this[_0xb8d8('0x1b')](_0x2e3ba8);}if(_0xce983b){_0x10d618[_0xb8d8('0x20')]=_[_0xb8d8('0x1e')](_0xce983b[_0xb8d8('0x20')])?util[_0xb8d8('0x21')](_0xb8d8('0x26'),_0xce983b[_0xb8d8('0x1d')]):_0xce983b['interface'];_0x10d618[_0xb8d8('0x49')]=_0xce983b['name'];_0x10d618[_0xb8d8('0x1f')]=_0xce983b[_0xb8d8('0x1f')];RpcMemberReport['voiceDialReport'](_0x10d618);}};Report['prototype']['blindTransfer']=function(_0x5372bb){RpcVoiceTransferReport[_0xb8d8('0x41')][_0x5372bb[_0xb8d8('0x53')]]=_0x5372bb;};Report['prototype']['attendedTransfer']=function(_0xaca32a){RpcVoiceTransferReport[_0xb8d8('0x54')](_0xaca32a);};module[_0xb8d8('0x55')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 73ae194..1446043 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf89=['resolve','then','catch','inspect','actionDeviceStateList','error','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isUndefined','emit','syncRegistry','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','stateRegistry','omit','event','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','[userReport][devicestatechange]','device','local','inuse','toLowerCase','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','find','mobile','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','lodash','moment','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','registryentry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow'];(function(_0x237c45,_0x55cf99){var _0x2942f6=function(_0x45a615){while(--_0x45a615){_0x237c45['push'](_0x237c45['shift']());}};_0x2942f6(++_0x55cf99);}(_0xdf89,0x19c));var _0x9df8=function(_0x13c686,_0x3b87f1){_0x13c686=_0x13c686-0x0;var _0x137fc0=_0xdf89[_0x13c686];return _0x137fc0;};'use strict';var _=require(_0x9df8('0x0'));var moment=require(_0x9df8('0x1'));var util=require('util');var Redis=require(_0x9df8('0x2'));var BPromise=require('bluebird');var config=require(_0x9df8('0x3'));var logger=require(_0x9df8('0x4'))('ami');var ami=require(_0x9df8('0x5'));config[_0x9df8('0x6')]=_[_0x9df8('0x7')](config[_0x9df8('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x9df8('0x8'))(new Redis(config['redis']));function UserReport(_0xe6bb35){this[_0x9df8('0x9')]=_0xe6bb35[_0x9df8('0x9')];this[_0x9df8('0xa')]=_0xe6bb35[_0x9df8('0xa')];this[_0x9df8('0xb')]=_0xe6bb35[_0x9df8('0xb')];ami['on'](_0x9df8('0xc'),this['syncRegistry'][_0x9df8('0xd')](this));ami['on'](_0x9df8('0xe'),this['syncRegistry'][_0x9df8('0xd')](this));ami['on'](_0x9df8('0xf'),this[_0x9df8('0x10')]['bind'](this));ami['on'](_0x9df8('0x11'),this[_0x9df8('0x12')]['bind'](this));return this[_0x9df8('0x13')]();}function showSipRegistrations(){Promise[_0x9df8('0x14')]()[_0x9df8('0x15')](ami['actionSipShowRegistry']())[_0x9df8('0x16')](function(_0x31d0b7){logger['error']('[userReport][sipshowregistry]',util[_0x9df8('0x17')](_0x31d0b7,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x9df8('0x14')]()[_0x9df8('0x15')](ami[_0x9df8('0x18')]())[_0x9df8('0x16')](function(_0x457aa9){logger[_0x9df8('0x19')](_0x9df8('0x1a'),util[_0x9df8('0x17')](_0x457aa9,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x9df8('0x14')]()[_0x9df8('0x15')](ami[_0x9df8('0x1b')]())[_0x9df8('0x16')](function(_0x2d7162){logger[_0x9df8('0x19')](_0x9df8('0x1c'),util[_0x9df8('0x17')](_0x2d7162,{'showHidden':![],'depth':null}));});}UserReport[_0x9df8('0x1d')][_0x9df8('0x13')]=function(){setInterval(function(){BPromise[_0x9df8('0x14')]()[_0x9df8('0x15')](showSipRegistrations())['then'](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x5f49d5){return _0x5f49d5!==null&&!_[_0x9df8('0x1e')](_0x5f49d5);};UserReport[_0x9df8('0x1d')][_0x9df8('0x1f')]=function(_0x346c81,_0x23bd59,_0x4bfe62){io['to'](_0x346c81)[_0x9df8('0x1f')](_0x23bd59,_0x4bfe62);};UserReport[_0x9df8('0x1d')][_0x9df8('0x20')]=function(_0x217b48){try{if(this[_0x9df8('0x21')](_0x217b48)){logger[_0x9df8('0x22')](_0x9df8('0x23'),_0x217b48[_0x9df8('0x24')],_0x217b48[_0x9df8('0x25')]);logger['debug']('[userReport][registry]',util[_0x9df8('0x17')](_0x217b48,{'showHidden':![],'depth':null}));var _0x2cf770=_['find'](this[_0x9df8('0x9')],{'registry':_0x217b48[_0x9df8('0x24')]});if(_0x2cf770){_0x217b48[_0x9df8('0x26')]=_0x217b48[_0x9df8('0x25')];_['merge'](_0x2cf770,_[_0x9df8('0x27')](_0x217b48,[_0x9df8('0x28'),'actionid',_0x9df8('0x24'),_0x9df8('0x25')]));logger[_0x9df8('0x29')](_0x9df8('0x2a'),util[_0x9df8('0x17')](_0x2cf770,{'showHidden':![],'depth':null}));this[_0x9df8('0x1f')](util[_0x9df8('0x2b')](_0x9df8('0x2c'),_0x2cf770[_0x9df8('0x2d')]),_0x9df8('0x2e'),_0x2cf770);}}}catch(_0x187f7e){logger[_0x9df8('0x19')]('[userReport][registry]',util[_0x9df8('0x17')](_0x187f7e,{'showHidden':![],'depth':null}));}};UserReport[_0x9df8('0x1d')][_0x9df8('0x10')]=function(_0x23bd71){try{if(this[_0x9df8('0x21')](_0x23bd71)){logger[_0x9df8('0x22')](_0x9df8('0x2f'),_0x23bd71['device'],_0x23bd71[_0x9df8('0x25')]);logger[_0x9df8('0x29')](_0x9df8('0x30'),util[_0x9df8('0x17')](_0x23bd71,{'showHidden':![],'depth':null}));if(this['agents'][_0x23bd71[_0x9df8('0x31')]]){if(!this[_0x9df8('0xa')][_0x23bd71[_0x9df8('0x31')]][_0x9df8('0x32')]||_0x23bd71[_0x9df8('0x25')]['toLowerCase']()==_0x9df8('0x33')){this[_0x9df8('0xa')][_0x23bd71[_0x9df8('0x31')]][_0x9df8('0x32')]=![];if(this[_0x9df8('0xa')][_0x23bd71[_0x9df8('0x31')]][_0x9df8('0x25')]!==_0x23bd71[_0x9df8('0x25')][_0x9df8('0x34')]()){this['agents'][_0x23bd71[_0x9df8('0x31')]][_0x9df8('0x35')]=_[_0x9df8('0x36')](moment()[_0x9df8('0x2b')]('x'));}this['agents'][_0x23bd71[_0x9df8('0x31')]][_0x9df8('0x25')]=_0x23bd71[_0x9df8('0x25')][_0x9df8('0x34')]();this['agents'][_0x23bd71[_0x9df8('0x31')]][_0x9df8('0x37')](_0x23bd71);}}else if(this['telephones'][_0x23bd71['device']]){if(this[_0x9df8('0xb')][_0x23bd71['device']]['state']!==_0x23bd71[_0x9df8('0x25')][_0x9df8('0x34')]()){this[_0x9df8('0xb')][_0x23bd71[_0x9df8('0x31')]][_0x9df8('0x35')]=_[_0x9df8('0x36')](moment()[_0x9df8('0x2b')]('x'));}this[_0x9df8('0xb')][_0x23bd71['device']][_0x9df8('0x25')]=_0x23bd71['state'][_0x9df8('0x34')]();logger['debug'](_0x9df8('0x38'),util[_0x9df8('0x17')](this['telephones'][_0x23bd71[_0x9df8('0x31')]],{'showHidden':![],'depth':null}));this[_0x9df8('0x1f')](util['format']('telephone:%s',this[_0x9df8('0xb')][_0x23bd71[_0x9df8('0x31')]][_0x9df8('0x2d')]),_0x9df8('0x39'),this[_0x9df8('0xb')][_0x23bd71['device']]);}else if(this['trunks'][_0x23bd71[_0x9df8('0x31')]]){if(this[_0x9df8('0x9')][_0x23bd71[_0x9df8('0x31')]]['state']!==_0x23bd71['state'][_0x9df8('0x34')]()){this[_0x9df8('0x9')][_0x23bd71[_0x9df8('0x31')]][_0x9df8('0x35')]=_[_0x9df8('0x36')](moment()[_0x9df8('0x2b')]('x'));}this[_0x9df8('0x9')][_0x23bd71[_0x9df8('0x31')]][_0x9df8('0x25')]=_0x23bd71[_0x9df8('0x25')]['toLowerCase']();logger[_0x9df8('0x29')](_0x9df8('0x3a'),util[_0x9df8('0x17')](this[_0x9df8('0x9')][_0x23bd71[_0x9df8('0x31')]],{'showHidden':![],'depth':null}));this[_0x9df8('0x1f')](util[_0x9df8('0x2b')](_0x9df8('0x2c'),this[_0x9df8('0x9')][_0x23bd71[_0x9df8('0x31')]][_0x9df8('0x2d')]),_0x9df8('0x2e'),this[_0x9df8('0x9')][_0x23bd71['device']]);}else if(_[_0x9df8('0x3b')](_0x23bd71[_0x9df8('0x31')],_0x9df8('0x3c'))){var _0x4ee054=_0x23bd71[_0x9df8('0x31')];var _0x4a0e2c=_0x4ee054[_0x9df8('0x3d')](_0x4ee054[_0x9df8('0x3e')]('/')+0x1,_0x4ee054['indexOf']('@'));var _0x19472d=_[_0x9df8('0x3f')](this['agents'],function(_0x2bafc5){return _0x2bafc5[_0x9df8('0x40')]==_0x4a0e2c||_0x2bafc5['phone']==_0x4a0e2c||_0x2bafc5[_0x9df8('0x41')]==_0x4a0e2c;});if(_0x19472d){if(_0x19472d[_0x9df8('0x25')]!==_0x23bd71['state'][_0x9df8('0x34')]()){_0x19472d[_0x9df8('0x35')]=_['toNumber'](moment()['format']('x'));}_0x19472d['state']=_0x23bd71[_0x9df8('0x25')][_0x9df8('0x34')]();_0x19472d[_0x9df8('0x32')]=!![];_0x19472d['updateStatusRealtime'](_0x23bd71);}}}}catch(_0x2c938a){logger['error'](_0x9df8('0x30'),util['inspect'](_0x2c938a,{'showHidden':![],'depth':null}));}};UserReport[_0x9df8('0x1d')][_0x9df8('0x12')]=function(_0x458b3f){try{if(this[_0x9df8('0x21')](_0x458b3f)&&this[_0x9df8('0x21')](_0x458b3f[_0x9df8('0x11')])){logger[_0x9df8('0x22')](_0x9df8('0x42'),_0x458b3f[_0x9df8('0x43')],_0x458b3f[_0x9df8('0x44')],_0x458b3f[_0x9df8('0x11')]);logger[_0x9df8('0x29')](_0x9df8('0x45'),util[_0x9df8('0x17')](_0x458b3f,{'showHidden':![],'depth':null}));if(this[_0x9df8('0xa')][_0x458b3f['peer']]){if(!this['agents'][_0x458b3f[_0x9df8('0x43')]][_0x9df8('0x32')]||_0x458b3f[_0x9df8('0x11')][_0x9df8('0x34')]()=='registered'){this[_0x9df8('0xa')][_0x458b3f[_0x9df8('0x43')]][_0x9df8('0x32')]=![];this[_0x9df8('0xa')][_0x458b3f[_0x9df8('0x43')]][_0x9df8('0x46')]=_0x458b3f['peerstatus'][_0x9df8('0x34')]();this[_0x9df8('0xa')][_0x458b3f[_0x9df8('0x43')]]['address']=_0x458b3f['address'];this[_0x9df8('0xa')][_0x458b3f[_0x9df8('0x43')]][_0x9df8('0x37')](_0x458b3f);}}else if(this[_0x9df8('0xb')][_0x458b3f[_0x9df8('0x43')]]){this['telephones'][_0x458b3f[_0x9df8('0x43')]][_0x9df8('0x46')]=_0x458b3f[_0x9df8('0x11')]['toLowerCase']();this[_0x9df8('0xb')][_0x458b3f[_0x9df8('0x43')]][_0x9df8('0x44')]=_0x458b3f[_0x9df8('0x44')];logger[_0x9df8('0x29')](_0x9df8('0x47'),util[_0x9df8('0x17')](this[_0x9df8('0xb')][_0x458b3f[_0x9df8('0x43')]],{'showHidden':![],'depth':null}));this[_0x9df8('0x1f')](util['format']('telephone:%s',this[_0x9df8('0xb')][_0x458b3f[_0x9df8('0x43')]][_0x9df8('0x2d')]),_0x9df8('0x39'),this[_0x9df8('0xb')][_0x458b3f[_0x9df8('0x43')]]);}else if(this[_0x9df8('0x9')][_0x458b3f[_0x9df8('0x43')]]){this['trunks'][_0x458b3f[_0x9df8('0x43')]]['status']=_0x458b3f[_0x9df8('0x11')][_0x9df8('0x34')]();this[_0x9df8('0x9')][_0x458b3f[_0x9df8('0x43')]]['address']=_0x458b3f[_0x9df8('0x44')];logger[_0x9df8('0x29')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0x9df8('0x17')](this['trunks'][_0x458b3f[_0x9df8('0x43')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x9df8('0x2b')](_0x9df8('0x2c'),this[_0x9df8('0x9')][_0x458b3f[_0x9df8('0x43')]][_0x9df8('0x2d')]),_0x9df8('0x2e'),this[_0x9df8('0x9')][_0x458b3f[_0x9df8('0x43')]]);}}}catch(_0x6f540d){logger[_0x9df8('0x19')](_0x9df8('0x45'),util[_0x9df8('0x17')](_0x6f540d,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0x6659=['telephones','registryentry','syncRegistry','bind','registry','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','resolve','isNotNull','isUndefined','emit','info','username','state','debug','stateRegistry','merge','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','trunk:save','[userReport][registry]','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','name','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','Local','substring','indexOf','phone','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','[userReport][peerstatus]','peer','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','trunks','agents'];(function(_0x29501f,_0x2a7ac7){var _0x5c3d03=function(_0x52fc81){while(--_0x52fc81){_0x29501f['push'](_0x29501f['shift']());}};_0x5c3d03(++_0x2a7ac7);}(_0x6659,0x169));var _0x9665=function(_0x357c27,_0x6bf84d){_0x357c27=_0x357c27-0x0;var _0x1dad7c=_0x6659[_0x357c27];return _0x1dad7c;};'use strict';var _=require(_0x9665('0x0'));var moment=require(_0x9665('0x1'));var util=require(_0x9665('0x2'));var Redis=require(_0x9665('0x3'));var BPromise=require(_0x9665('0x4'));var config=require(_0x9665('0x5'));var logger=require(_0x9665('0x6'))(_0x9665('0x7'));var ami=require('../ami');config[_0x9665('0x8')]=_[_0x9665('0x9')](config[_0x9665('0x8')],{'host':_0x9665('0xa'),'port':0x18eb});var io=require(_0x9665('0xb'))(new Redis(config[_0x9665('0x8')]));function UserReport(_0x585ec6){this[_0x9665('0xc')]=_0x585ec6[_0x9665('0xc')];this[_0x9665('0xd')]=_0x585ec6[_0x9665('0xd')];this[_0x9665('0xe')]=_0x585ec6[_0x9665('0xe')];ami['on'](_0x9665('0xf'),this[_0x9665('0x10')][_0x9665('0x11')](this));ami['on'](_0x9665('0x12'),this[_0x9665('0x10')][_0x9665('0x11')](this));ami['on']('devicestatechange',this[_0x9665('0x13')]['bind'](this));ami['on'](_0x9665('0x14'),this[_0x9665('0x15')][_0x9665('0x11')](this));return this[_0x9665('0x16')]();}function showSipRegistrations(){Promise['resolve']()[_0x9665('0x17')](ami[_0x9665('0x18')]())[_0x9665('0x19')](function(_0x3ec904){logger[_0x9665('0x1a')](_0x9665('0x1b'),util[_0x9665('0x1c')](_0x3ec904,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0x9665('0x17')](ami['actionDeviceStateList']())[_0x9665('0x19')](function(_0x5479f8){logger['error'](_0x9665('0x1d'),util['inspect'](_0x5479f8,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()[_0x9665('0x17')](ami[_0x9665('0x1e')]())['catch'](function(_0x532ac9){logger[_0x9665('0x1a')](_0x9665('0x1f'),util[_0x9665('0x1c')](_0x532ac9,{'showHidden':![],'depth':null}));});}UserReport[_0x9665('0x20')][_0x9665('0x16')]=function(){setInterval(function(){BPromise[_0x9665('0x21')]()[_0x9665('0x17')](showSipRegistrations())[_0x9665('0x17')](listDeviceStates())[_0x9665('0x17')](showPeersStatus());},0x32c8);};UserReport['prototype'][_0x9665('0x22')]=function(_0x30f53b){return _0x30f53b!==null&&!_[_0x9665('0x23')](_0x30f53b);};UserReport[_0x9665('0x20')][_0x9665('0x24')]=function(_0x1e52de,_0x5effbb,_0x286d6d){io['to'](_0x1e52de)[_0x9665('0x24')](_0x5effbb,_0x286d6d);};UserReport[_0x9665('0x20')][_0x9665('0x10')]=function(_0x3bff19){try{if(this[_0x9665('0x22')](_0x3bff19)){logger[_0x9665('0x25')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x3bff19[_0x9665('0x26')],_0x3bff19[_0x9665('0x27')]);logger[_0x9665('0x28')]('[userReport][registry]',util[_0x9665('0x1c')](_0x3bff19,{'showHidden':![],'depth':null}));var _0x2f7ff5=_['find'](this['trunks'],{'registry':_0x3bff19[_0x9665('0x26')]});if(_0x2f7ff5){_0x3bff19[_0x9665('0x29')]=_0x3bff19[_0x9665('0x27')];_[_0x9665('0x2a')](_0x2f7ff5,_['omit'](_0x3bff19,[_0x9665('0x2b'),_0x9665('0x2c'),'username',_0x9665('0x27')]));logger[_0x9665('0x28')](_0x9665('0x2d'),util[_0x9665('0x1c')](_0x2f7ff5,{'showHidden':![],'depth':null}));this[_0x9665('0x24')](util[_0x9665('0x2e')](_0x9665('0x2f'),_0x2f7ff5['name']),_0x9665('0x30'),_0x2f7ff5);}}}catch(_0x109e25){logger['error'](_0x9665('0x31'),util[_0x9665('0x1c')](_0x109e25,{'showHidden':![],'depth':null}));}};UserReport[_0x9665('0x20')][_0x9665('0x13')]=function(_0x128006){try{if(this[_0x9665('0x22')](_0x128006)){logger[_0x9665('0x25')](_0x9665('0x32'),_0x128006[_0x9665('0x33')],_0x128006[_0x9665('0x27')]);logger[_0x9665('0x28')](_0x9665('0x34'),util[_0x9665('0x1c')](_0x128006,{'showHidden':![],'depth':null}));if(this[_0x9665('0xd')][_0x128006[_0x9665('0x33')]]){if(!this[_0x9665('0xd')][_0x128006[_0x9665('0x33')]][_0x9665('0x35')]||_0x128006['state'][_0x9665('0x36')]()=='inuse'){this[_0x9665('0xd')][_0x128006[_0x9665('0x33')]][_0x9665('0x35')]=![];if(this[_0x9665('0xd')][_0x128006[_0x9665('0x33')]][_0x9665('0x27')]!==_0x128006['state'][_0x9665('0x36')]()){this[_0x9665('0xd')][_0x128006[_0x9665('0x33')]][_0x9665('0x37')]=_[_0x9665('0x38')](moment()['format']('x'));}this[_0x9665('0xd')][_0x128006['device']][_0x9665('0x27')]=_0x128006[_0x9665('0x27')][_0x9665('0x36')]();this[_0x9665('0xd')][_0x128006[_0x9665('0x33')]][_0x9665('0x39')](_0x128006);}}else if(this[_0x9665('0xe')][_0x128006[_0x9665('0x33')]]){if(this[_0x9665('0xe')][_0x128006[_0x9665('0x33')]][_0x9665('0x27')]!==_0x128006['state'][_0x9665('0x36')]()){this[_0x9665('0xe')][_0x128006[_0x9665('0x33')]][_0x9665('0x37')]=_[_0x9665('0x38')](moment()[_0x9665('0x2e')]('x'));}this['telephones'][_0x128006[_0x9665('0x33')]][_0x9665('0x27')]=_0x128006[_0x9665('0x27')][_0x9665('0x36')]();logger['debug'](_0x9665('0x3a'),util[_0x9665('0x1c')](this['telephones'][_0x128006['device']],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x9665('0x3b'),this[_0x9665('0xe')][_0x128006[_0x9665('0x33')]][_0x9665('0x3c')]),'telephone:save',this[_0x9665('0xe')][_0x128006['device']]);}else if(this[_0x9665('0xc')][_0x128006[_0x9665('0x33')]]){if(this[_0x9665('0xc')][_0x128006[_0x9665('0x33')]][_0x9665('0x27')]!==_0x128006[_0x9665('0x27')]['toLowerCase']()){this[_0x9665('0xc')][_0x128006['device']][_0x9665('0x37')]=_[_0x9665('0x38')](moment()[_0x9665('0x2e')]('x'));}this[_0x9665('0xc')][_0x128006[_0x9665('0x33')]][_0x9665('0x27')]=_0x128006['state'][_0x9665('0x36')]();logger[_0x9665('0x28')](_0x9665('0x3d'),util['inspect'](this[_0x9665('0xc')][_0x128006['device']],{'showHidden':![],'depth':null}));this[_0x9665('0x24')](util[_0x9665('0x2e')](_0x9665('0x2f'),this['trunks'][_0x128006[_0x9665('0x33')]]['name']),_0x9665('0x30'),this['trunks'][_0x128006['device']]);}else if(_['startsWith'](_0x128006[_0x9665('0x33')],_0x9665('0x3e'))){var _0x2a18c1=_0x128006[_0x9665('0x33')];var _0x369b21=_0x2a18c1[_0x9665('0x3f')](_0x2a18c1[_0x9665('0x40')]('/')+0x1,_0x2a18c1['indexOf']('@'));var _0x37d44e=_['find'](this['agents'],function(_0x4fab0e){return _0x4fab0e['mobile']==_0x369b21||_0x4fab0e[_0x9665('0x41')]==_0x369b21||_0x4fab0e['accountcode']==_0x369b21;});if(_0x37d44e){if(_0x37d44e['state']!==_0x128006[_0x9665('0x27')][_0x9665('0x36')]()){_0x37d44e['stateTime']=_[_0x9665('0x38')](moment()[_0x9665('0x2e')]('x'));}_0x37d44e[_0x9665('0x27')]=_0x128006[_0x9665('0x27')][_0x9665('0x36')]();_0x37d44e['local']=!![];_0x37d44e['updateStatusRealtime'](_0x128006);}}}}catch(_0x147205){logger[_0x9665('0x1a')](_0x9665('0x34'),util[_0x9665('0x1c')](_0x147205,{'showHidden':![],'depth':null}));}};UserReport[_0x9665('0x20')]['syncPeerStatus']=function(_0x4f95b4){try{if(this['isNotNull'](_0x4f95b4)&&this[_0x9665('0x22')](_0x4f95b4[_0x9665('0x14')])){logger[_0x9665('0x25')](_0x9665('0x42'),_0x4f95b4['peer'],_0x4f95b4[_0x9665('0x43')],_0x4f95b4[_0x9665('0x14')]);logger[_0x9665('0x28')](_0x9665('0x44'),util[_0x9665('0x1c')](_0x4f95b4,{'showHidden':![],'depth':null}));if(this['agents'][_0x4f95b4[_0x9665('0x45')]]){if(!this[_0x9665('0xd')][_0x4f95b4[_0x9665('0x45')]][_0x9665('0x35')]||_0x4f95b4['peerstatus']['toLowerCase']()==_0x9665('0x46')){this['agents'][_0x4f95b4[_0x9665('0x45')]][_0x9665('0x35')]=![];this[_0x9665('0xd')][_0x4f95b4[_0x9665('0x45')]][_0x9665('0x47')]=_0x4f95b4[_0x9665('0x14')][_0x9665('0x36')]();this['agents'][_0x4f95b4[_0x9665('0x45')]][_0x9665('0x43')]=_0x4f95b4[_0x9665('0x43')];this[_0x9665('0xd')][_0x4f95b4['peer']]['updateStatusRealtime'](_0x4f95b4);}}else if(this[_0x9665('0xe')][_0x4f95b4['peer']]){this[_0x9665('0xe')][_0x4f95b4['peer']][_0x9665('0x47')]=_0x4f95b4[_0x9665('0x14')][_0x9665('0x36')]();this['telephones'][_0x4f95b4[_0x9665('0x45')]]['address']=_0x4f95b4[_0x9665('0x43')];logger[_0x9665('0x28')](_0x9665('0x48'),util[_0x9665('0x1c')](this[_0x9665('0xe')][_0x4f95b4['peer']],{'showHidden':![],'depth':null}));this['emit'](util[_0x9665('0x2e')](_0x9665('0x3b'),this['telephones'][_0x4f95b4['peer']][_0x9665('0x3c')]),'telephone:save',this[_0x9665('0xe')][_0x4f95b4['peer']]);}else if(this['trunks'][_0x4f95b4[_0x9665('0x45')]]){this['trunks'][_0x4f95b4['peer']]['status']=_0x4f95b4[_0x9665('0x14')][_0x9665('0x36')]();this[_0x9665('0xc')][_0x4f95b4[_0x9665('0x45')]][_0x9665('0x43')]=_0x4f95b4[_0x9665('0x43')];logger[_0x9665('0x28')](_0x9665('0x49'),util['inspect'](this[_0x9665('0xc')][_0x4f95b4['peer']],{'showHidden':![],'depth':null}));this[_0x9665('0x24')](util['format'](_0x9665('0x2f'),this[_0x9665('0xc')][_0x4f95b4['peer']][_0x9665('0x3c')]),_0x9665('0x30'),this['trunks'][_0x4f95b4[_0x9665('0x45')]]);}}}catch(_0x44841e){logger[_0x9665('0x1a')](_0x9665('0x44'),util['inspect'](_0x44841e,{'showHidden':![],'depth':null}));}};module[_0x9665('0x4a')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 3cefbcc..e240f2e 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd01f=['agentringnoanswerAt','answeredelsewheredestinationuniqueid','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','moment','util','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','syncAgentCalled','agentconnect','syncAgentConnect','bind','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','user:%s','user:called','error','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere'];(function(_0xeba30e,_0x1526dc){var _0x55d491=function(_0x226e04){while(--_0x226e04){_0xeba30e['push'](_0xeba30e['shift']());}};_0x55d491(++_0x1526dc);}(_0xd01f,0x17b));var _0xfd01=function(_0xb1bd,_0x48532c){_0xb1bd=_0xb1bd-0x0;var _0x18c10a=_0xd01f[_0xb1bd];return _0x18c10a;};'use strict';var _=require('lodash');var moment=require(_0xfd01('0x0'));var util=require(_0xfd01('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xfd01('0x2'))(_0xfd01('0x3'));var ami=require(_0xfd01('0x4'));config[_0xfd01('0x5')]=_[_0xfd01('0x6')](config[_0xfd01('0x5')],{'host':_0xfd01('0x7'),'port':0x18eb});var io=require(_0xfd01('0x8'))(new Redis(config['redis']));function VoiceAgentReport(_0x15072b){this[_0xfd01('0x9')]={};this[_0xfd01('0xa')]=_0x15072b[_0xfd01('0xa')];this[_0xfd01('0xb')]=_0x15072b[_0xfd01('0xb')];this[_0xfd01('0xc')]={};ami['on']('agentcalled',this[_0xfd01('0xd')]['bind'](this));ami['on'](_0xfd01('0xe'),this[_0xfd01('0xf')][_0xfd01('0x10')](this));ami['on'](_0xfd01('0x11'),this['syncAgentRingNoAnswer'][_0xfd01('0x10')](this));ami['on'](_0xfd01('0x12'),this[_0xfd01('0x13')]['bind'](this));ami['on'](_0xfd01('0x14'),this[_0xfd01('0x15')][_0xfd01('0x10')](this));ami['on'](_0xfd01('0x16'),this['syncVarSet']['bind'](this));ami['on'](_0xfd01('0x17'),this[_0xfd01('0x18')]['bind'](this));ami['on'](_0xfd01('0x19'),this[_0xfd01('0x1a')]['bind'](this));ami['on'](_0xfd01('0x1b'),this[_0xfd01('0x1c')][_0xfd01('0x10')](this));ami['on'](_0xfd01('0x1d'),this['syncAttendedTransfer'][_0xfd01('0x10')](this));ami['on'](_0xfd01('0x1e'),this[_0xfd01('0x1f')][_0xfd01('0x10')](this));}VoiceAgentReport[_0xfd01('0x20')]['emit']=function(_0x53f97e,_0x5344fd,_0x59e61e){io['to'](_0x53f97e)[_0xfd01('0x21')](_0x5344fd,_0x59e61e);};VoiceAgentReport[_0xfd01('0x20')][_0xfd01('0x22')]=function(_0x557828){return _0x557828!==null&&!_[_0xfd01('0x23')](_0x557828);};VoiceAgentReport[_0xfd01('0x20')][_0xfd01('0xd')]=function(_0x5a11ec){try{if(this['isNotNull'](_0x5a11ec)){logger[_0xfd01('0x24')](_0xfd01('0x25'),_0x5a11ec[_0xfd01('0x26')],_0x5a11ec[_0xfd01('0x27')],_0x5a11ec['destuniqueid']);logger['debug'](_0xfd01('0x28'),_0x5a11ec[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x5a11ec,{'showHidden':![],'depth':null}));if(_[_0xfd01('0x23')](this[_0xfd01('0x9')][_0x5a11ec[_0xfd01('0x26')]])){this[_0xfd01('0x9')][_0x5a11ec[_0xfd01('0x26')]]={};}if(_[_0xfd01('0x23')](this[_0xfd01('0x9')][_0x5a11ec[_0xfd01('0x26')]][_0x5a11ec[_0xfd01('0x2a')]])){this[_0xfd01('0x9')][_0x5a11ec[_0xfd01('0x26')]][_0x5a11ec[_0xfd01('0x2a')]]={'agentcalledAt':moment()[_0xfd01('0x2b')](_0xfd01('0x2c')),'lastevent':_0xfd01('0x2d'),'mandatoryDisposition':this[_0xfd01('0xa')][_0x5a11ec[_0xfd01('0x2e')]]?this['voiceQueues'][_0x5a11ec[_0xfd01('0x2e')]][_0xfd01('0x2f')]||![]:![],'type':this[_0xfd01('0xa')][_0x5a11ec[_0xfd01('0x2e')]]?this[_0xfd01('0xa')][_0x5a11ec[_0xfd01('0x2e')]][_0xfd01('0x30')]||_0xfd01('0x31'):_0xfd01('0x31'),'variables':this[_0xfd01('0xc')][_0x5a11ec[_0xfd01('0x26')]]};}_[_0xfd01('0x32')](this[_0xfd01('0x9')][_0x5a11ec[_0xfd01('0x26')]][_0x5a11ec[_0xfd01('0x2a')]],_[_0xfd01('0x33')](_0x5a11ec,[_0xfd01('0x34'),_0xfd01('0x35')]));logger[_0xfd01('0x36')](_0xfd01('0x37'),_0x5a11ec[_0xfd01('0x26')],util[_0xfd01('0x29')](this[_0xfd01('0x9')][_0x5a11ec[_0xfd01('0x26')]][_0x5a11ec['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xfd01('0x21')](_0xfd01('0x38'),this[_0xfd01('0x9')][_0x5a11ec[_0xfd01('0x26')]][_0x5a11ec[_0xfd01('0x2a')]]);logger[_0xfd01('0x36')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x5a11ec[_0xfd01('0x26')],util['inspect'](this[_0xfd01('0x9')][_0x5a11ec['uniqueid']][_0x5a11ec['destuniqueid']],{'showHidden':![],'depth':null}));this[_0xfd01('0x21')](util[_0xfd01('0x2b')](_0xfd01('0x39'),_0x5a11ec[_0xfd01('0x27')]),_0xfd01('0x3a'),this['channels'][_0x5a11ec[_0xfd01('0x26')]][_0x5a11ec[_0xfd01('0x2a')]]);}}catch(_0x2fb37f){logger[_0xfd01('0x3b')]('[%s][voiceAgentReport][agentcalled]',_0x5a11ec[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x2fb37f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfd01('0x20')][_0xfd01('0xf')]=function(_0x40e856){try{if(this['isNotNull'](_0x40e856)){if(this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]]){logger[_0xfd01('0x36')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x40e856['uniqueid'],util[_0xfd01('0x29')](_0x40e856,{'showHidden':![],'depth':null}));for(var _0x376212 in this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]]){if(this[_0xfd01('0x9')][_0x40e856['uniqueid']][_0xfd01('0x3c')](_0x376212)){if(_0x40e856[_0xfd01('0x2a')]===_0x376212){logger['info'](_0xfd01('0x3d'),_0x40e856[_0xfd01('0x26')],_0x40e856[_0xfd01('0x27')],_0x40e856[_0xfd01('0x2a')]);this[_0xfd01('0x9')][_0x40e856['uniqueid']][_0x376212][_0xfd01('0x3e')]=moment()['format'](_0xfd01('0x2c'));this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212][_0xfd01('0x3f')]=_0x40e856[_0xfd01('0x3f')];this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212][_0xfd01('0x40')]=_0x40e856[_0xfd01('0x40')];this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212]['destchannelstate']=_0x40e856[_0xfd01('0x41')];this['channels'][_0x40e856[_0xfd01('0x26')]][_0x376212]['destchannelstatedesc']=_0x40e856[_0xfd01('0x42')];this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212][_0xfd01('0x43')]=_0x40e856[_0xfd01('0x43')];this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212][_0xfd01('0x44')]=_0xfd01('0x45');_[_0xfd01('0x32')](this[_0xfd01('0xb')][_0x40e856[_0xfd01('0x46')]],_[_0xfd01('0x47')](_0x40e856,[_0xfd01('0x2e'),_0xfd01('0x48')]));logger[_0xfd01('0x36')](_0xfd01('0x49'),_0x40e856['uniqueid'],util[_0xfd01('0x29')](this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x40e856[_0xfd01('0x2a')]],{'showHidden':![],'depth':null}));ami['emit']('custom:agentconnect',this['channels'][_0x40e856[_0xfd01('0x26')]][_0x40e856[_0xfd01('0x2a')]]);logger[_0xfd01('0x36')](_0xfd01('0x4a'),_0x40e856[_0xfd01('0x26')],util[_0xfd01('0x29')](this[_0xfd01('0x9')][_0x40e856['uniqueid']][_0x40e856[_0xfd01('0x2a')]],{'showHidden':![],'depth':null}));this[_0xfd01('0x21')](util['format'](_0xfd01('0x39'),_0x40e856[_0xfd01('0x27')]),_0xfd01('0x4b'),this[_0xfd01('0x9')][_0x40e856['uniqueid']][_0x40e856[_0xfd01('0x2a')]]);}else if(!this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212]['agentringnoanswer']&&!this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212][_0xfd01('0x14')]){logger[_0xfd01('0x24')](_0xfd01('0x4c'),_0x40e856[_0xfd01('0x26')],this['channels'][_0x40e856['uniqueid']][_0x376212][_0xfd01('0x27')],_0x376212);this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212][_0xfd01('0x11')]=!![];this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212][_0xfd01('0x4d')]=moment()[_0xfd01('0x2b')](_0xfd01('0x2c'));this['channels'][_0x40e856['uniqueid']][_0x376212][_0xfd01('0x4e')]=_0x40e856[_0xfd01('0x2a')];this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212]['answeredelsewheremembername']=_0x40e856['membername'];this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212][_0xfd01('0x44')]=_0xfd01('0x4f');this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212][_0xfd01('0x50')]='answered_elsewhere';logger[_0xfd01('0x36')](_0xfd01('0x51'),_0x40e856[_0xfd01('0x26')],util[_0xfd01('0x29')](this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212],{'showHidden':![],'depth':null}));ami[_0xfd01('0x21')]('custom:agentansweredelsewhere',this[_0xfd01('0x9')][_0x40e856[_0xfd01('0x26')]][_0x376212]);}}}}}}catch(_0x3aa6eb){logger[_0xfd01('0x3b')](_0xfd01('0x52'),_0x40e856[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x3aa6eb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfd01('0x20')][_0xfd01('0x53')]=function(_0x1e98d7){try{if(this[_0xfd01('0x22')](_0x1e98d7)){logger[_0xfd01('0x36')](_0xfd01('0x54'),_0x1e98d7[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x1e98d7,{'showHidden':![],'depth':null}));if(this[_0xfd01('0x9')][_0x1e98d7[_0xfd01('0x26')]]&&this[_0xfd01('0x9')][_0x1e98d7[_0xfd01('0x26')]][_0x1e98d7['destuniqueid']]){logger[_0xfd01('0x24')](_0xfd01('0x55'),_0x1e98d7[_0xfd01('0x26')],_0x1e98d7[_0xfd01('0x27')],_0x1e98d7[_0xfd01('0x2a')]);this['channels'][_0x1e98d7[_0xfd01('0x26')]][_0x1e98d7[_0xfd01('0x2a')]][_0xfd01('0x11')]=!![];this['channels'][_0x1e98d7[_0xfd01('0x26')]][_0x1e98d7[_0xfd01('0x2a')]][_0xfd01('0x4d')]=moment()[_0xfd01('0x2b')](_0xfd01('0x2c'));this['channels'][_0x1e98d7[_0xfd01('0x26')]][_0x1e98d7['destuniqueid']]['lastevent']=_0xfd01('0x56');this[_0xfd01('0x9')][_0x1e98d7['uniqueid']][_0x1e98d7[_0xfd01('0x2a')]][_0xfd01('0x50')]=_0xfd01('0x56');logger[_0xfd01('0x36')](_0xfd01('0x57'),_0x1e98d7[_0xfd01('0x26')],util[_0xfd01('0x29')](this[_0xfd01('0x9')][_0x1e98d7[_0xfd01('0x26')]][_0x1e98d7['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xfd01('0x21')](_0xfd01('0x58'),this['channels'][_0x1e98d7[_0xfd01('0x26')]][_0x1e98d7[_0xfd01('0x2a')]]);}}}catch(_0xb35248){logger[_0xfd01('0x3b')](_0xfd01('0x59'),_0x1e98d7[_0xfd01('0x26')],util[_0xfd01('0x29')](_0xb35248,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfd01('0x20')][_0xfd01('0x13')]=function(_0x1e1328){try{if(this[_0xfd01('0x22')](_0x1e1328)){logger[_0xfd01('0x36')](_0xfd01('0x5a'),_0x1e1328[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x1e1328,{'showHidden':![],'depth':null}));if(this['channels'][_0x1e1328[_0xfd01('0x26')]]){for(var _0x4286ad in this[_0xfd01('0x9')][_0x1e1328['uniqueid']]){if(this[_0xfd01('0x9')][_0x1e1328['uniqueid']][_0xfd01('0x3c')](_0x4286ad)&&!this[_0xfd01('0x9')][_0x1e1328[_0xfd01('0x26')]][_0x4286ad][_0xfd01('0x11')]&&!this[_0xfd01('0x9')][_0x1e1328[_0xfd01('0x26')]][_0x4286ad]['agentcomplete']){logger[_0xfd01('0x24')](_0xfd01('0x5b'),_0x1e1328[_0xfd01('0x26')],this[_0xfd01('0x9')][_0x1e1328[_0xfd01('0x26')]][_0x4286ad][_0xfd01('0x27')],_0x4286ad);this['channels'][_0x1e1328[_0xfd01('0x26')]][_0x4286ad][_0xfd01('0x11')]=!![];this[_0xfd01('0x9')][_0x1e1328[_0xfd01('0x26')]][_0x4286ad]['agentringnoanswerAt']=moment()[_0xfd01('0x2b')](_0xfd01('0x2c'));this[_0xfd01('0x9')][_0x1e1328[_0xfd01('0x26')]][_0x4286ad]['lastevent']=_0xfd01('0x5c');this['channels'][_0x1e1328[_0xfd01('0x26')]][_0x4286ad][_0xfd01('0x50')]=_0xfd01('0x5c');logger[_0xfd01('0x36')](_0xfd01('0x5d'),_0x1e1328['uniqueid'],util[_0xfd01('0x29')](this[_0xfd01('0x9')][_0x1e1328['uniqueid']][_0x4286ad],{'showHidden':![],'depth':null}));ami[_0xfd01('0x21')]('custom:agentqueuecallerabandon',this['channels'][_0x1e1328[_0xfd01('0x26')]][_0x4286ad]);}}}}}catch(_0x57cd1c){logger[_0xfd01('0x3b')](_0xfd01('0x5e'),_0x1e1328[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x57cd1c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfd01('0x20')][_0xfd01('0x15')]=function(_0xc1f6e0){try{if(this['isNotNull'](_0xc1f6e0)){logger[_0xfd01('0x36')](_0xfd01('0x5f'),_0xc1f6e0[_0xfd01('0x26')],util[_0xfd01('0x29')](_0xc1f6e0,{'showHidden':![],'depth':null}));if(this['channels'][_0xc1f6e0[_0xfd01('0x26')]]){for(var _0x1a6755 in this[_0xfd01('0x9')][_0xc1f6e0[_0xfd01('0x26')]]){if(this['channels'][_0xc1f6e0[_0xfd01('0x26')]][_0xfd01('0x3c')](_0x1a6755)){if(this['channels'][_0xc1f6e0[_0xfd01('0x26')]][_0x1a6755][_0xfd01('0x3e')]&&!this['channels'][_0xc1f6e0[_0xfd01('0x26')]][_0x1a6755]['agentcomplete']){logger[_0xfd01('0x24')](_0xfd01('0x60'),_0xc1f6e0[_0xfd01('0x26')],this['channels'][_0xc1f6e0[_0xfd01('0x26')]][_0x1a6755][_0xfd01('0x27')],_0x1a6755);this['channels'][_0xc1f6e0[_0xfd01('0x26')]][_0x1a6755][_0xfd01('0x14')]=!![];this[_0xfd01('0x9')][_0xc1f6e0[_0xfd01('0x26')]][_0x1a6755][_0xfd01('0x61')]=moment()[_0xfd01('0x2b')](_0xfd01('0x2c'));this[_0xfd01('0x9')][_0xc1f6e0[_0xfd01('0x26')]][_0x1a6755][_0xfd01('0x44')]=_0xfd01('0x62');this[_0xfd01('0x9')][_0xc1f6e0[_0xfd01('0x26')]][_0x1a6755]['reason']=_0xc1f6e0[_0xfd01('0x50')]==_0xfd01('0x63')?'agent':_0xc1f6e0[_0xfd01('0x50')];this['channels'][_0xc1f6e0[_0xfd01('0x26')]][_0x1a6755]['talktime']=_0xc1f6e0[_0xfd01('0x64')];if(this[_0xfd01('0xa')][_0xc1f6e0[_0xfd01('0x2e')]]&&this['voiceQueues'][_0xc1f6e0['queue']][_0xfd01('0x65')]){this[_0xfd01('0x9')][_0xc1f6e0[_0xfd01('0x26')]][_0x1a6755][_0xfd01('0x66')]=this[_0xfd01('0xa')][_0xc1f6e0[_0xfd01('0x2e')]][_0xfd01('0x67')];this[_0xfd01('0x9')][_0xc1f6e0['uniqueid']][_0x1a6755][_0xfd01('0x68')]=!![];}this['agents'][_0xc1f6e0['interface']]=_[_0xfd01('0x33')](this[_0xfd01('0xb')][_0xc1f6e0['interface']],[_0xfd01('0x2e'),_0xfd01('0x48')]);logger['debug'](_0xfd01('0x69'),_0xc1f6e0[_0xfd01('0x26')],util[_0xfd01('0x29')](this[_0xfd01('0x9')][_0xc1f6e0['uniqueid']][_0x1a6755],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0xfd01('0x9')][_0xc1f6e0[_0xfd01('0x26')]][_0x1a6755]);logger[_0xfd01('0x36')](_0xfd01('0x6a'),_0xc1f6e0['uniqueid'],util[_0xfd01('0x29')](this[_0xfd01('0x9')][_0xc1f6e0[_0xfd01('0x26')]][_0x1a6755],{'showHidden':![],'depth':null}));this[_0xfd01('0x21')](util['format'](_0xfd01('0x39'),_0xc1f6e0[_0xfd01('0x27')]),_0xfd01('0x6b'),this[_0xfd01('0x9')][_0xc1f6e0[_0xfd01('0x26')]][_0x1a6755]);}}}}}}catch(_0x1b21fb){logger[_0xfd01('0x3b')](_0xfd01('0x6c'),_0xc1f6e0[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x1b21fb,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncVarSet']=function(_0x62d054){try{if(this[_0xfd01('0x22')](_0x62d054)){logger['debug'](_0xfd01('0x6d'),_0x62d054[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x62d054,{'showHidden':![],'depth':null}));this[_0xfd01('0x6e')](_0x62d054[_0xfd01('0x26')],_[_0xfd01('0x6f')](_0x62d054[_0xfd01('0x70')])[0x0],_0x62d054[_0xfd01('0x71')]);if(this['channels'][_0x62d054[_0xfd01('0x26')]]){for(var _0x21214d in this[_0xfd01('0x9')][_0x62d054['uniqueid']]){if(this['channels'][_0x62d054[_0xfd01('0x26')]][_0xfd01('0x3c')](_0x21214d)){logger['info'](_0xfd01('0x72'),_0x62d054['uniqueid'],_0x21214d,_[_0xfd01('0x6f')](_0x62d054['variable'])[0x0],_0x62d054[_0xfd01('0x71')]);if(_['isUndefined'](this[_0xfd01('0x9')][_0x62d054[_0xfd01('0x26')]][_0x21214d]['variables'])){this['channels'][_0x62d054[_0xfd01('0x26')]][_0x21214d]['variables']={};}this[_0xfd01('0x9')][_0x62d054[_0xfd01('0x26')]][_0x21214d][_0xfd01('0xc')]=this[_0xfd01('0xc')][_0x62d054[_0xfd01('0x26')]];}}}}}catch(_0xab6eaa){logger[_0xfd01('0x3b')]('[%s][voiceAgentReport][varset]',_0x62d054[_0xfd01('0x26')],util[_0xfd01('0x29')](_0xab6eaa,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfd01('0x20')][_0xfd01('0x6e')]=function(_0x2fae98,_0x1e5db4,_0x29cdb5){var _0x30cc0e=[_0xfd01('0x73'),'rtpaudioqosbridged','rtpaudioqosjitter',_0xfd01('0x74'),_0xfd01('0x75'),'rtpaudioqoslossbridged',_0xfd01('0x76'),_0xfd01('0x77'),_0xfd01('0x78'),_0xfd01('0x79'),'bridgepeer','bridgepvtcallid',_0xfd01('0x7a'),_0xfd01('0x7b'),_0xfd01('0x7c'),_0xfd01('0x7d'),_0xfd01('0x27'),_0xfd01('0x7e'),'memberrealtime'];if(!_['isNil'](_0x1e5db4)&&!_[_0xfd01('0x7f')](_0x30cc0e,_0x1e5db4)){if(_['isUndefined'](this[_0xfd01('0xc')][_0x2fae98])){this['variables'][_0x2fae98]={};}this[_0xfd01('0xc')][_0x2fae98][_0x1e5db4]=_0x29cdb5;}};VoiceAgentReport['prototype'][_0xfd01('0x18')]=function(_0x56f3bf){try{if(this[_0xfd01('0x22')](_0x56f3bf)){logger['debug'](_0xfd01('0x80'),_0x56f3bf['uniqueid'],util[_0xfd01('0x29')](_0x56f3bf,{'showHidden':![],'depth':null}));if(this[_0xfd01('0x9')][_0x56f3bf['uniqueid']]){for(var _0x1740ff in this[_0xfd01('0x9')][_0x56f3bf[_0xfd01('0x26')]]){if(this[_0xfd01('0x9')][_0x56f3bf[_0xfd01('0x26')]][_0xfd01('0x3c')](_0x1740ff)){if(this[_0xfd01('0x9')][_0x56f3bf[_0xfd01('0x26')]][_0x1740ff][_0xfd01('0x50')]=='transfer'&&this[_0xfd01('0x9')][_0x56f3bf['uniqueid']][_0x1740ff]['agentcomplete']){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x56f3bf[_0xfd01('0x26')],_0x1740ff);this[_0xfd01('0x9')][_0x56f3bf[_0xfd01('0x26')]][_0x1740ff][_0xfd01('0x61')]=moment()['format'](_0xfd01('0x2c'));}}}logger[_0xfd01('0x36')](_0xfd01('0x81'),_0x56f3bf['uniqueid'],util[_0xfd01('0x29')](_[_0xfd01('0x82')](this[_0xfd01('0x9')][_0x56f3bf['uniqueid']]),{'showHidden':![],'depth':null}));ami['emit'](_0xfd01('0x83'),_[_0xfd01('0x82')](this['channels'][_0x56f3bf[_0xfd01('0x26')]]));delete this[_0xfd01('0x9')][_0x56f3bf[_0xfd01('0x26')]];}if(this[_0xfd01('0xc')][_0x56f3bf[_0xfd01('0x26')]]){delete this[_0xfd01('0xc')][_0x56f3bf['uniqueid']];}}}catch(_0x1c3bc3){logger[_0xfd01('0x3b')](_0xfd01('0x84'),_0x56f3bf[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x1c3bc3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfd01('0x20')][_0xfd01('0x85')]=function(_0x1facce){try{if(this[_0xfd01('0x22')](_0x1facce)){logger[_0xfd01('0x36')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x1facce[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x1facce,{'showHidden':![],'depth':null}));if(this[_0xfd01('0x9')][_0x1facce['transfereeuniqueid']]){for(var _0x14d07c in this[_0xfd01('0x9')][_0x1facce[_0xfd01('0x86')]]){if(this[_0xfd01('0x9')][_0x1facce[_0xfd01('0x86')]][_0xfd01('0x3c')](_0x14d07c)){if(_0x1facce[_0xfd01('0x87')]===_0x14d07c){logger[_0xfd01('0x24')](_0xfd01('0x88'),_0x1facce[_0xfd01('0x26')],this[_0xfd01('0x9')][_0x1facce['transfereeuniqueid']][_0x14d07c][_0xfd01('0x27')],_0x14d07c);var _0x24ed82=moment();this['channels'][_0x1facce[_0xfd01('0x86')]][_0x14d07c][_0xfd01('0x14')]=!![];this[_0xfd01('0x9')][_0x1facce[_0xfd01('0x86')]][_0x14d07c][_0xfd01('0x61')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x1facce[_0xfd01('0x86')]][_0x14d07c]['lastevent']=_0xfd01('0x62');this[_0xfd01('0x9')][_0x1facce[_0xfd01('0x86')]][_0x14d07c][_0xfd01('0x50')]='transfer';this[_0xfd01('0x9')][_0x1facce[_0xfd01('0x86')]][_0x14d07c][_0xfd01('0x64')]=_0x24ed82[_0xfd01('0x89')](this['channels'][_0x1facce[_0xfd01('0x86')]][_0x14d07c][_0xfd01('0x3e')],_0xfd01('0x8a'));}}}}if(this[_0xfd01('0x9')][_0x1facce['secondtransfereruniqueid']]){var _0x8ea67a=this['channels'][_0x1facce[_0xfd01('0x8b')]];this[_0xfd01('0x9')][_0x1facce[_0xfd01('0x8b')]]=this[_0xfd01('0x9')][_0x1facce[_0xfd01('0x86')]];this[_0xfd01('0x9')][_0x1facce[_0xfd01('0x86')]]=_0x8ea67a;}}}catch(_0x37abcf){logger[_0xfd01('0x3b')]('[%s][voiceAgentReport][attendedtransfer]',_0x1facce[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x37abcf,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfd01('0x20')]['syncBlindTransfer']=function(_0x2b3323){try{if(this[_0xfd01('0x22')](_0x2b3323)){logger[_0xfd01('0x36')](_0xfd01('0x8c'),_0x2b3323[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x2b3323,{'showHidden':![],'depth':null}));if(this[_0xfd01('0x9')][_0x2b3323[_0xfd01('0x86')]]){for(var _0x55871f in this[_0xfd01('0x9')][_0x2b3323[_0xfd01('0x86')]]){if(this[_0xfd01('0x9')][_0x2b3323[_0xfd01('0x86')]][_0xfd01('0x3c')](_0x55871f)){if(_0x2b3323[_0xfd01('0x8d')]===_0x55871f){logger[_0xfd01('0x24')](_0xfd01('0x8e'),_0x2b3323[_0xfd01('0x26')],this[_0xfd01('0x9')][_0x2b3323[_0xfd01('0x86')]][_0x55871f]['membername'],_0x55871f);var _0x40c828=moment();this[_0xfd01('0x9')][_0x2b3323[_0xfd01('0x86')]][_0x55871f][_0xfd01('0x14')]=!![];this[_0xfd01('0x9')][_0x2b3323[_0xfd01('0x86')]][_0x55871f][_0xfd01('0x61')]=_0x40c828;this[_0xfd01('0x9')][_0x2b3323[_0xfd01('0x86')]][_0x55871f][_0xfd01('0x44')]=_0xfd01('0x62');this[_0xfd01('0x9')][_0x2b3323['transfereeuniqueid']][_0x55871f][_0xfd01('0x50')]='transfer';this[_0xfd01('0x9')][_0x2b3323[_0xfd01('0x86')]][_0x55871f][_0xfd01('0x64')]=_0x40c828[_0xfd01('0x89')](this[_0xfd01('0x9')][_0x2b3323[_0xfd01('0x86')]][_0x55871f][_0xfd01('0x3e')],_0xfd01('0x8a'));}}}}}}catch(_0x3b9233){logger[_0xfd01('0x3b')]('[%s][voiceAgentReport][blindtransfer]',_0x2b3323[_0xfd01('0x26')],util['inspect'](_0x3b9233,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xfd01('0x20')][_0xfd01('0x1a')]=function(_0x535e39){var _0x5c3cbd='';try{if(this['isNotNull'](_0x535e39)){logger['debug'](_0xfd01('0x8f'),_0x535e39['uniqueid'],util['inspect'](_0x535e39,{'showHidden':![],'depth':null}));if(_0x535e39[_0xfd01('0x90')]){_0x5c3cbd=_0x535e39[_0xfd01('0x90')][_0xfd01('0x91')](0x0,_0x535e39[_0xfd01('0x90')][_0xfd01('0x92')]('-'));if(this[_0xfd01('0xb')][_0x5c3cbd]){logger[_0xfd01('0x24')](_0xfd01('0x93'),_0x535e39[_0xfd01('0x26')],_0x5c3cbd);this[_0xfd01('0xb')][_0x5c3cbd][_0xfd01('0x94')]=!![];}}}}catch(_0x5c87d4){logger[_0xfd01('0x3b')](_0xfd01('0x95'),_0x535e39['uniqueid'],util[_0xfd01('0x29')](_0x5c87d4,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xfd01('0x1c')]=function(_0x2ae576){var _0x5a458d='';try{if(this[_0xfd01('0x22')](_0x2ae576)){logger[_0xfd01('0x36')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x2ae576[_0xfd01('0x26')],util[_0xfd01('0x29')](_0x2ae576,{'showHidden':![],'depth':null}));if(_0x2ae576['channel']){_0x5a458d=_0x2ae576['channel']['substring'](0x0,_0x2ae576[_0xfd01('0x90')][_0xfd01('0x92')]('-'));if(this['agents'][_0x5a458d]){logger[_0xfd01('0x24')](_0xfd01('0x96'),_0x2ae576[_0xfd01('0x26')],_0x5a458d);this[_0xfd01('0xb')][_0x5a458d][_0xfd01('0x94')]=![];}}}}catch(_0x28eb0b){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0x2ae576['uniqueid'],util[_0xfd01('0x29')](_0x28eb0b,{'showHidden':![],'depth':null}));}};module[_0xfd01('0x97')]=VoiceAgentReport; \ No newline at end of file +var _0x97f5=['connect','interface','pick','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberpenalty','memberrealtime','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','agentcompleteAt','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','localhost','socket.io-emitter','redis','channels','voiceQueues','agents','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','isUndefined','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','variables','merge','omit','event','privilege','custom:agentcalled','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','info','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent'];(function(_0x4a1794,_0x5c4c1f){var _0x46858a=function(_0x183b8d){while(--_0x183b8d){_0x4a1794['push'](_0x4a1794['shift']());}};_0x46858a(++_0x5c4c1f);}(_0x97f5,0x18c));var _0x597f=function(_0x1a2309,_0x1e494d){_0x1a2309=_0x1a2309-0x0;var _0x3ce47f=_0x97f5[_0x1a2309];return _0x3ce47f;};'use strict';var _=require(_0x597f('0x0'));var moment=require('moment');var util=require(_0x597f('0x1'));var Redis=require(_0x597f('0x2'));var config=require(_0x597f('0x3'));var logger=require(_0x597f('0x4'))(_0x597f('0x5'));var ami=require(_0x597f('0x6'));config['redis']=_['defaults'](config['redis'],{'host':_0x597f('0x7'),'port':0x18eb});var io=require(_0x597f('0x8'))(new Redis(config[_0x597f('0x9')]));function VoiceAgentReport(_0x565521){this[_0x597f('0xa')]={};this[_0x597f('0xb')]=_0x565521[_0x597f('0xb')];this[_0x597f('0xc')]=_0x565521[_0x597f('0xc')];this['variables']={};ami['on'](_0x597f('0xd'),this[_0x597f('0xe')][_0x597f('0xf')](this));ami['on'](_0x597f('0x10'),this[_0x597f('0x11')][_0x597f('0xf')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x597f('0xf')](this));ami['on'](_0x597f('0x12'),this[_0x597f('0x13')][_0x597f('0xf')](this));ami['on'](_0x597f('0x14'),this[_0x597f('0x15')][_0x597f('0xf')](this));ami['on'](_0x597f('0x16'),this[_0x597f('0x17')][_0x597f('0xf')](this));ami['on'](_0x597f('0x18'),this[_0x597f('0x19')][_0x597f('0xf')](this));ami['on'](_0x597f('0x1a'),this[_0x597f('0x1b')][_0x597f('0xf')](this));ami['on'](_0x597f('0x1c'),this[_0x597f('0x1d')][_0x597f('0xf')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0x597f('0x1e'),this[_0x597f('0x1f')][_0x597f('0xf')](this));}VoiceAgentReport[_0x597f('0x20')]['emit']=function(_0x4bf2d2,_0x4e5aed,_0x2a3bd8){io['to'](_0x4bf2d2)[_0x597f('0x21')](_0x4e5aed,_0x2a3bd8);};VoiceAgentReport[_0x597f('0x20')][_0x597f('0x22')]=function(_0x57a5f0){return _0x57a5f0!==null&&!_['isUndefined'](_0x57a5f0);};VoiceAgentReport[_0x597f('0x20')][_0x597f('0xe')]=function(_0x407f68){try{if(this[_0x597f('0x22')](_0x407f68)){logger['info']('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x407f68[_0x597f('0x23')],_0x407f68[_0x597f('0x24')],_0x407f68[_0x597f('0x25')]);logger[_0x597f('0x26')](_0x597f('0x27'),_0x407f68[_0x597f('0x23')],util[_0x597f('0x28')](_0x407f68,{'showHidden':![],'depth':null}));if(_[_0x597f('0x29')](this['channels'][_0x407f68[_0x597f('0x23')]])){this[_0x597f('0xa')][_0x407f68[_0x597f('0x23')]]={};}if(_['isUndefined'](this[_0x597f('0xa')][_0x407f68[_0x597f('0x23')]][_0x407f68[_0x597f('0x25')]])){this[_0x597f('0xa')][_0x407f68[_0x597f('0x23')]][_0x407f68['destuniqueid']]={'agentcalledAt':moment()[_0x597f('0x2a')](_0x597f('0x2b')),'lastevent':_0x597f('0x2c'),'mandatoryDisposition':this[_0x597f('0xb')][_0x407f68[_0x597f('0x2d')]]?this[_0x597f('0xb')][_0x407f68[_0x597f('0x2d')]][_0x597f('0x2e')]||![]:![],'type':this[_0x597f('0xb')][_0x407f68['queue']]?this[_0x597f('0xb')][_0x407f68[_0x597f('0x2d')]][_0x597f('0x2f')]||_0x597f('0x30'):_0x597f('0x30'),'variables':this[_0x597f('0x31')][_0x407f68[_0x597f('0x23')]]};}_[_0x597f('0x32')](this[_0x597f('0xa')][_0x407f68[_0x597f('0x23')]][_0x407f68[_0x597f('0x25')]],_[_0x597f('0x33')](_0x407f68,[_0x597f('0x34'),_0x597f('0x35')]));logger[_0x597f('0x26')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:',_0x407f68[_0x597f('0x23')],util['inspect'](this[_0x597f('0xa')][_0x407f68['uniqueid']][_0x407f68['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x597f('0x21')](_0x597f('0x36'),this['channels'][_0x407f68[_0x597f('0x23')]][_0x407f68[_0x597f('0x25')]]);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x407f68[_0x597f('0x23')],util[_0x597f('0x28')](this['channels'][_0x407f68[_0x597f('0x23')]][_0x407f68[_0x597f('0x25')]],{'showHidden':![],'depth':null}));this[_0x597f('0x21')](util[_0x597f('0x2a')](_0x597f('0x37'),_0x407f68['membername']),_0x597f('0x38'),this[_0x597f('0xa')][_0x407f68['uniqueid']][_0x407f68['destuniqueid']]);}}catch(_0x3f7bc4){logger[_0x597f('0x39')](_0x597f('0x3a'),_0x407f68[_0x597f('0x23')],util[_0x597f('0x28')](_0x3f7bc4,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x597f('0x11')]=function(_0x378722){try{if(this[_0x597f('0x22')](_0x378722)){if(this[_0x597f('0xa')][_0x378722['uniqueid']]){logger['debug'](_0x597f('0x3b'),_0x378722[_0x597f('0x23')],util[_0x597f('0x28')](_0x378722,{'showHidden':![],'depth':null}));for(var _0x5b6099 in this['channels'][_0x378722[_0x597f('0x23')]]){if(this[_0x597f('0xa')][_0x378722[_0x597f('0x23')]][_0x597f('0x3c')](_0x5b6099)){if(_0x378722['destuniqueid']===_0x5b6099){logger[_0x597f('0x3d')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x378722['uniqueid'],_0x378722[_0x597f('0x24')],_0x378722[_0x597f('0x25')]);this[_0x597f('0xa')][_0x378722[_0x597f('0x23')]][_0x5b6099][_0x597f('0x3e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x378722['uniqueid']][_0x5b6099][_0x597f('0x3f')]=_0x378722[_0x597f('0x3f')];this['channels'][_0x378722[_0x597f('0x23')]][_0x5b6099]['connectedlinenum']=_0x378722[_0x597f('0x40')];this[_0x597f('0xa')][_0x378722[_0x597f('0x23')]][_0x5b6099][_0x597f('0x41')]=_0x378722[_0x597f('0x41')];this[_0x597f('0xa')][_0x378722[_0x597f('0x23')]][_0x5b6099][_0x597f('0x42')]=_0x378722[_0x597f('0x42')];this['channels'][_0x378722[_0x597f('0x23')]][_0x5b6099][_0x597f('0x43')]=_0x378722[_0x597f('0x43')];this['channels'][_0x378722[_0x597f('0x23')]][_0x5b6099][_0x597f('0x44')]=_0x597f('0x45');_[_0x597f('0x32')](this[_0x597f('0xc')][_0x378722[_0x597f('0x46')]],_[_0x597f('0x47')](_0x378722,[_0x597f('0x2d'),'destconnectedlinenum']));logger[_0x597f('0x26')](_0x597f('0x48'),_0x378722[_0x597f('0x23')],util['inspect'](this[_0x597f('0xa')][_0x378722['uniqueid']][_0x378722['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x597f('0x21')](_0x597f('0x49'),this[_0x597f('0xa')][_0x378722[_0x597f('0x23')]][_0x378722[_0x597f('0x25')]]);logger[_0x597f('0x26')](_0x597f('0x4a'),_0x378722[_0x597f('0x23')],util['inspect'](this['channels'][_0x378722[_0x597f('0x23')]][_0x378722['destuniqueid']],{'showHidden':![],'depth':null}));this[_0x597f('0x21')](util[_0x597f('0x2a')](_0x597f('0x37'),_0x378722[_0x597f('0x24')]),_0x597f('0x4b'),this[_0x597f('0xa')][_0x378722['uniqueid']][_0x378722[_0x597f('0x25')]]);}else if(!this['channels'][_0x378722[_0x597f('0x23')]][_0x5b6099][_0x597f('0x4c')]&&!this[_0x597f('0xa')][_0x378722[_0x597f('0x23')]][_0x5b6099][_0x597f('0x14')]){logger[_0x597f('0x3d')](_0x597f('0x4d'),_0x378722['uniqueid'],this[_0x597f('0xa')][_0x378722[_0x597f('0x23')]][_0x5b6099][_0x597f('0x24')],_0x5b6099);this[_0x597f('0xa')][_0x378722[_0x597f('0x23')]][_0x5b6099][_0x597f('0x4c')]=!![];this['channels'][_0x378722[_0x597f('0x23')]][_0x5b6099][_0x597f('0x4e')]=moment()[_0x597f('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x597f('0xa')][_0x378722[_0x597f('0x23')]][_0x5b6099][_0x597f('0x4f')]=_0x378722[_0x597f('0x25')];this[_0x597f('0xa')][_0x378722[_0x597f('0x23')]][_0x5b6099][_0x597f('0x50')]=_0x378722[_0x597f('0x24')];this['channels'][_0x378722[_0x597f('0x23')]][_0x5b6099][_0x597f('0x44')]=_0x597f('0x51');this[_0x597f('0xa')][_0x378722[_0x597f('0x23')]][_0x5b6099][_0x597f('0x52')]=_0x597f('0x51');logger[_0x597f('0x26')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x378722[_0x597f('0x23')],util[_0x597f('0x28')](this['channels'][_0x378722[_0x597f('0x23')]][_0x5b6099],{'showHidden':![],'depth':null}));ami[_0x597f('0x21')](_0x597f('0x53'),this[_0x597f('0xa')][_0x378722[_0x597f('0x23')]][_0x5b6099]);}}}}}}catch(_0x5d6a81){logger[_0x597f('0x39')](_0x597f('0x54'),_0x378722['uniqueid'],util[_0x597f('0x28')](_0x5d6a81,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x597f('0x20')]['syncAgentRingNoAnswer']=function(_0x51a3f4){try{if(this[_0x597f('0x22')](_0x51a3f4)){logger[_0x597f('0x26')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x51a3f4[_0x597f('0x23')],util[_0x597f('0x28')](_0x51a3f4,{'showHidden':![],'depth':null}));if(this['channels'][_0x51a3f4[_0x597f('0x23')]]&&this['channels'][_0x51a3f4['uniqueid']][_0x51a3f4[_0x597f('0x25')]]){logger[_0x597f('0x3d')](_0x597f('0x55'),_0x51a3f4[_0x597f('0x23')],_0x51a3f4[_0x597f('0x24')],_0x51a3f4[_0x597f('0x25')]);this[_0x597f('0xa')][_0x51a3f4['uniqueid']][_0x51a3f4['destuniqueid']]['agentringnoanswer']=!![];this[_0x597f('0xa')][_0x51a3f4[_0x597f('0x23')]][_0x51a3f4['destuniqueid']][_0x597f('0x4e')]=moment()[_0x597f('0x2a')](_0x597f('0x2b'));this['channels'][_0x51a3f4[_0x597f('0x23')]][_0x51a3f4['destuniqueid']][_0x597f('0x44')]=_0x597f('0x56');this[_0x597f('0xa')][_0x51a3f4[_0x597f('0x23')]][_0x51a3f4[_0x597f('0x25')]][_0x597f('0x52')]=_0x597f('0x56');logger[_0x597f('0x26')](_0x597f('0x57'),_0x51a3f4[_0x597f('0x23')],util['inspect'](this['channels'][_0x51a3f4[_0x597f('0x23')]][_0x51a3f4['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x597f('0x21')](_0x597f('0x58'),this[_0x597f('0xa')][_0x51a3f4[_0x597f('0x23')]][_0x51a3f4[_0x597f('0x25')]]);}}}catch(_0x1d357c){logger['error'](_0x597f('0x59'),_0x51a3f4[_0x597f('0x23')],util['inspect'](_0x1d357c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x597f('0x20')][_0x597f('0x13')]=function(_0x18c5c6){try{if(this[_0x597f('0x22')](_0x18c5c6)){logger[_0x597f('0x26')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x18c5c6['uniqueid'],util[_0x597f('0x28')](_0x18c5c6,{'showHidden':![],'depth':null}));if(this[_0x597f('0xa')][_0x18c5c6[_0x597f('0x23')]]){for(var _0x3cdc63 in this[_0x597f('0xa')][_0x18c5c6[_0x597f('0x23')]]){if(this[_0x597f('0xa')][_0x18c5c6[_0x597f('0x23')]][_0x597f('0x3c')](_0x3cdc63)&&!this[_0x597f('0xa')][_0x18c5c6['uniqueid']][_0x3cdc63][_0x597f('0x4c')]&&!this[_0x597f('0xa')][_0x18c5c6['uniqueid']][_0x3cdc63][_0x597f('0x14')]){logger['info'](_0x597f('0x5a'),_0x18c5c6['uniqueid'],this[_0x597f('0xa')][_0x18c5c6[_0x597f('0x23')]][_0x3cdc63]['membername'],_0x3cdc63);this[_0x597f('0xa')][_0x18c5c6['uniqueid']][_0x3cdc63][_0x597f('0x4c')]=!![];this['channels'][_0x18c5c6['uniqueid']][_0x3cdc63][_0x597f('0x4e')]=moment()[_0x597f('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x18c5c6[_0x597f('0x23')]][_0x3cdc63][_0x597f('0x44')]=_0x597f('0x5b');this[_0x597f('0xa')][_0x18c5c6['uniqueid']][_0x3cdc63][_0x597f('0x52')]=_0x597f('0x5b');logger[_0x597f('0x26')](_0x597f('0x5c'),_0x18c5c6[_0x597f('0x23')],util['inspect'](this['channels'][_0x18c5c6[_0x597f('0x23')]][_0x3cdc63],{'showHidden':![],'depth':null}));ami[_0x597f('0x21')](_0x597f('0x5d'),this[_0x597f('0xa')][_0x18c5c6[_0x597f('0x23')]][_0x3cdc63]);}}}}}catch(_0x194690){logger[_0x597f('0x39')](_0x597f('0x5e'),_0x18c5c6[_0x597f('0x23')],util[_0x597f('0x28')](_0x194690,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x597f('0x20')][_0x597f('0x15')]=function(_0x41e47f){try{if(this['isNotNull'](_0x41e47f)){logger[_0x597f('0x26')](_0x597f('0x5f'),_0x41e47f[_0x597f('0x23')],util[_0x597f('0x28')](_0x41e47f,{'showHidden':![],'depth':null}));if(this[_0x597f('0xa')][_0x41e47f[_0x597f('0x23')]]){for(var _0x54716c in this[_0x597f('0xa')][_0x41e47f[_0x597f('0x23')]]){if(this[_0x597f('0xa')][_0x41e47f[_0x597f('0x23')]][_0x597f('0x3c')](_0x54716c)){if(this[_0x597f('0xa')][_0x41e47f[_0x597f('0x23')]][_0x54716c][_0x597f('0x3e')]&&!this['channels'][_0x41e47f[_0x597f('0x23')]][_0x54716c]['agentcomplete']){logger[_0x597f('0x3d')](_0x597f('0x60'),_0x41e47f[_0x597f('0x23')],this['channels'][_0x41e47f[_0x597f('0x23')]][_0x54716c][_0x597f('0x24')],_0x54716c);this[_0x597f('0xa')][_0x41e47f[_0x597f('0x23')]][_0x54716c]['agentcomplete']=!![];this[_0x597f('0xa')][_0x41e47f[_0x597f('0x23')]][_0x54716c]['agentcompleteAt']=moment()[_0x597f('0x2a')](_0x597f('0x2b'));this[_0x597f('0xa')][_0x41e47f[_0x597f('0x23')]][_0x54716c][_0x597f('0x44')]=_0x597f('0x61');this[_0x597f('0xa')][_0x41e47f[_0x597f('0x23')]][_0x54716c][_0x597f('0x52')]=_0x41e47f[_0x597f('0x52')]==_0x597f('0x62')?_0x597f('0x63'):_0x41e47f[_0x597f('0x52')];this[_0x597f('0xa')][_0x41e47f[_0x597f('0x23')]][_0x54716c][_0x597f('0x64')]=_0x41e47f['talktime'];if(this[_0x597f('0xb')][_0x41e47f['queue']]&&this[_0x597f('0xb')][_0x41e47f[_0x597f('0x2d')]][_0x597f('0x65')]){this[_0x597f('0xa')][_0x41e47f[_0x597f('0x23')]][_0x54716c][_0x597f('0x66')]=this['voiceQueues'][_0x41e47f['queue']][_0x597f('0x67')];this[_0x597f('0xa')][_0x41e47f[_0x597f('0x23')]][_0x54716c][_0x597f('0x68')]=!![];}this['agents'][_0x41e47f[_0x597f('0x46')]]=_[_0x597f('0x33')](this['agents'][_0x41e47f['interface']],[_0x597f('0x2d'),'destconnectedlinenum']);logger[_0x597f('0x26')](_0x597f('0x69'),_0x41e47f[_0x597f('0x23')],util[_0x597f('0x28')](this['channels'][_0x41e47f[_0x597f('0x23')]][_0x54716c],{'showHidden':![],'depth':null}));ami[_0x597f('0x21')](_0x597f('0x6a'),this['channels'][_0x41e47f[_0x597f('0x23')]][_0x54716c]);logger[_0x597f('0x26')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x41e47f['uniqueid'],util['inspect'](this[_0x597f('0xa')][_0x41e47f[_0x597f('0x23')]][_0x54716c],{'showHidden':![],'depth':null}));this[_0x597f('0x21')](util[_0x597f('0x2a')]('user:%s',_0x41e47f['membername']),_0x597f('0x6b'),this['channels'][_0x41e47f[_0x597f('0x23')]][_0x54716c]);}}}}}}catch(_0x247ead){logger[_0x597f('0x39')](_0x597f('0x6c'),_0x41e47f['uniqueid'],util[_0x597f('0x28')](_0x247ead,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x597f('0x20')][_0x597f('0x17')]=function(_0x2fd91e){try{if(this['isNotNull'](_0x2fd91e)){logger[_0x597f('0x26')](_0x597f('0x6d'),_0x2fd91e[_0x597f('0x23')],util[_0x597f('0x28')](_0x2fd91e,{'showHidden':![],'depth':null}));this[_0x597f('0x6e')](_0x2fd91e[_0x597f('0x23')],_['keys'](_0x2fd91e['variable'])[0x0],_0x2fd91e['value']);if(this[_0x597f('0xa')][_0x2fd91e['uniqueid']]){for(var _0xf85004 in this['channels'][_0x2fd91e[_0x597f('0x23')]]){if(this[_0x597f('0xa')][_0x2fd91e[_0x597f('0x23')]]['hasOwnProperty'](_0xf85004)){logger[_0x597f('0x3d')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x2fd91e[_0x597f('0x23')],_0xf85004,_[_0x597f('0x6f')](_0x2fd91e[_0x597f('0x70')])[0x0],_0x2fd91e['value']);if(_[_0x597f('0x29')](this[_0x597f('0xa')][_0x2fd91e['uniqueid']][_0xf85004][_0x597f('0x31')])){this[_0x597f('0xa')][_0x2fd91e[_0x597f('0x23')]][_0xf85004][_0x597f('0x31')]={};}this[_0x597f('0xa')][_0x2fd91e[_0x597f('0x23')]][_0xf85004][_0x597f('0x31')]=this['variables'][_0x2fd91e[_0x597f('0x23')]];}}}}}catch(_0x11e65c){logger[_0x597f('0x39')](_0x597f('0x71'),_0x2fd91e[_0x597f('0x23')],util['inspect'](_0x11e65c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x597f('0x20')][_0x597f('0x6e')]=function(_0x246e7c,_0x271a99,_0x50f05a){var _0x440bf2=['rtpaudioqos',_0x597f('0x72'),_0x597f('0x73'),_0x597f('0x74'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x597f('0x75'),_0x597f('0x76'),_0x597f('0x77'),_0x597f('0x78'),_0x597f('0x79'),'bridgepvtcallid',_0x597f('0x7a'),_0x597f('0x7b'),'memberinterface','memberlastcall',_0x597f('0x24'),_0x597f('0x7c'),_0x597f('0x7d')];if(!_['isNil'](_0x271a99)&&!_[_0x597f('0x7e')](_0x440bf2,_0x271a99)){if(_[_0x597f('0x29')](this[_0x597f('0x31')][_0x246e7c])){this[_0x597f('0x31')][_0x246e7c]={};}this[_0x597f('0x31')][_0x246e7c][_0x271a99]=_0x50f05a;}};VoiceAgentReport[_0x597f('0x20')][_0x597f('0x19')]=function(_0x1d70aa){try{if(this['isNotNull'](_0x1d70aa)){logger[_0x597f('0x26')](_0x597f('0x7f'),_0x1d70aa[_0x597f('0x23')],util['inspect'](_0x1d70aa,{'showHidden':![],'depth':null}));if(this[_0x597f('0xa')][_0x1d70aa['uniqueid']]){for(var _0x1634e1 in this['channels'][_0x1d70aa[_0x597f('0x23')]]){if(this[_0x597f('0xa')][_0x1d70aa[_0x597f('0x23')]]['hasOwnProperty'](_0x1634e1)){if(this[_0x597f('0xa')][_0x1d70aa[_0x597f('0x23')]][_0x1634e1]['reason']==_0x597f('0x62')&&this[_0x597f('0xa')][_0x1d70aa[_0x597f('0x23')]][_0x1634e1][_0x597f('0x14')]){logger['info'](_0x597f('0x80'),_0x1d70aa[_0x597f('0x23')],_0x1634e1);this[_0x597f('0xa')][_0x1d70aa[_0x597f('0x23')]][_0x1634e1][_0x597f('0x81')]=moment()['format'](_0x597f('0x2b'));}}}logger['debug'](_0x597f('0x82'),_0x1d70aa[_0x597f('0x23')],util[_0x597f('0x28')](_[_0x597f('0x83')](this[_0x597f('0xa')][_0x1d70aa['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x597f('0x21')](_0x597f('0x84'),_['values'](this[_0x597f('0xa')][_0x1d70aa[_0x597f('0x23')]]));delete this[_0x597f('0xa')][_0x1d70aa[_0x597f('0x23')]];}if(this[_0x597f('0x31')][_0x1d70aa[_0x597f('0x23')]]){delete this['variables'][_0x1d70aa[_0x597f('0x23')]];}}}catch(_0x1493a6){logger[_0x597f('0x39')](_0x597f('0x85'),_0x1d70aa['uniqueid'],util[_0x597f('0x28')](_0x1493a6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x597f('0x20')][_0x597f('0x86')]=function(_0x468868){try{if(this['isNotNull'](_0x468868)){logger[_0x597f('0x26')](_0x597f('0x87'),_0x468868['uniqueid'],util['inspect'](_0x468868,{'showHidden':![],'depth':null}));if(this[_0x597f('0xa')][_0x468868['transfereeuniqueid']]){for(var _0x4e565 in this['channels'][_0x468868[_0x597f('0x88')]]){if(this[_0x597f('0xa')][_0x468868[_0x597f('0x88')]][_0x597f('0x3c')](_0x4e565)){if(_0x468868['origtransfereruniqueid']===_0x4e565){logger[_0x597f('0x3d')](_0x597f('0x89'),_0x468868[_0x597f('0x23')],this[_0x597f('0xa')][_0x468868[_0x597f('0x88')]][_0x4e565][_0x597f('0x24')],_0x4e565);var _0x2715b8=moment();this[_0x597f('0xa')][_0x468868[_0x597f('0x88')]][_0x4e565][_0x597f('0x14')]=!![];this[_0x597f('0xa')][_0x468868[_0x597f('0x88')]][_0x4e565][_0x597f('0x81')]=moment()[_0x597f('0x2a')](_0x597f('0x2b'));this['channels'][_0x468868[_0x597f('0x88')]][_0x4e565]['lastevent']=_0x597f('0x61');this[_0x597f('0xa')][_0x468868['transfereeuniqueid']][_0x4e565]['reason']=_0x597f('0x62');this[_0x597f('0xa')][_0x468868[_0x597f('0x88')]][_0x4e565][_0x597f('0x64')]=_0x2715b8[_0x597f('0x8a')](this[_0x597f('0xa')][_0x468868[_0x597f('0x88')]][_0x4e565]['agentconnectAt'],_0x597f('0x8b'));}}}}if(this[_0x597f('0xa')][_0x468868[_0x597f('0x8c')]]){var _0x49134d=this['channels'][_0x468868['secondtransfereruniqueid']];this['channels'][_0x468868[_0x597f('0x8c')]]=this['channels'][_0x468868[_0x597f('0x88')]];this[_0x597f('0xa')][_0x468868[_0x597f('0x88')]]=_0x49134d;}}}catch(_0x1b3411){logger['error'](_0x597f('0x8d'),_0x468868[_0x597f('0x23')],util['inspect'](_0x1b3411,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x597f('0x20')][_0x597f('0x1f')]=function(_0x319a08){try{if(this[_0x597f('0x22')](_0x319a08)){logger['debug']('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x319a08[_0x597f('0x23')],util['inspect'](_0x319a08,{'showHidden':![],'depth':null}));if(this[_0x597f('0xa')][_0x319a08['transfereeuniqueid']]){for(var _0x15ec75 in this[_0x597f('0xa')][_0x319a08['transfereeuniqueid']]){if(this[_0x597f('0xa')][_0x319a08[_0x597f('0x88')]][_0x597f('0x3c')](_0x15ec75)){if(_0x319a08[_0x597f('0x8e')]===_0x15ec75){logger[_0x597f('0x3d')](_0x597f('0x8f'),_0x319a08[_0x597f('0x23')],this[_0x597f('0xa')][_0x319a08[_0x597f('0x88')]][_0x15ec75][_0x597f('0x24')],_0x15ec75);var _0x380d8e=moment();this[_0x597f('0xa')][_0x319a08[_0x597f('0x88')]][_0x15ec75]['agentcomplete']=!![];this[_0x597f('0xa')][_0x319a08[_0x597f('0x88')]][_0x15ec75][_0x597f('0x81')]=_0x380d8e;this[_0x597f('0xa')][_0x319a08['transfereeuniqueid']][_0x15ec75][_0x597f('0x44')]=_0x597f('0x61');this[_0x597f('0xa')][_0x319a08[_0x597f('0x88')]][_0x15ec75][_0x597f('0x52')]=_0x597f('0x62');this[_0x597f('0xa')][_0x319a08[_0x597f('0x88')]][_0x15ec75][_0x597f('0x64')]=_0x380d8e['diff'](this[_0x597f('0xa')][_0x319a08[_0x597f('0x88')]][_0x15ec75][_0x597f('0x3e')],_0x597f('0x8b'));}}}}}}catch(_0x536a2c){logger[_0x597f('0x39')](_0x597f('0x90'),_0x319a08['uniqueid'],util[_0x597f('0x28')](_0x536a2c,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x597f('0x1b')]=function(_0x3de63a){var _0x328906='';try{if(this['isNotNull'](_0x3de63a)){logger['debug'](_0x597f('0x91'),_0x3de63a[_0x597f('0x23')],util[_0x597f('0x28')](_0x3de63a,{'showHidden':![],'depth':null}));if(_0x3de63a[_0x597f('0x92')]){_0x328906=_0x3de63a[_0x597f('0x92')][_0x597f('0x93')](0x0,_0x3de63a['channel'][_0x597f('0x94')]('-'));if(this[_0x597f('0xc')][_0x328906]){logger[_0x597f('0x3d')](_0x597f('0x95'),_0x3de63a['uniqueid'],_0x328906);this[_0x597f('0xc')][_0x328906][_0x597f('0x96')]=!![];}}}}catch(_0x305267){logger['error'](_0x597f('0x97'),_0x3de63a[_0x597f('0x23')],util[_0x597f('0x28')](_0x305267,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x597f('0x20')][_0x597f('0x1d')]=function(_0x283445){var _0x1d35e5='';try{if(this[_0x597f('0x22')](_0x283445)){logger[_0x597f('0x26')](_0x597f('0x98'),_0x283445[_0x597f('0x23')],util[_0x597f('0x28')](_0x283445,{'showHidden':![],'depth':null}));if(_0x283445[_0x597f('0x92')]){_0x1d35e5=_0x283445[_0x597f('0x92')][_0x597f('0x93')](0x0,_0x283445[_0x597f('0x92')][_0x597f('0x94')]('-'));if(this[_0x597f('0xc')][_0x1d35e5]){logger[_0x597f('0x3d')](_0x597f('0x99'),_0x283445[_0x597f('0x23')],_0x1d35e5);this[_0x597f('0xc')][_0x1d35e5][_0x597f('0x96')]=![];}}}}catch(_0x4b1d5f){logger[_0x597f('0x39')](_0x597f('0x9a'),_0x283445[_0x597f('0x23')],util[_0x597f('0x28')](_0x4b1d5f,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index b849a23..cbba6c4 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x77d4=['[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfererchannel','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','not_inuse','inuse','busy','invalid','ringing','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','ANSWERED','BUSY','FAILED','redis','localhost','socket.io-emitter','channels','agents','settings','blindTransfers','syncNewExten','bind','newexten','syncNewChannel','newstate','syncNewState','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','info','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','prototype','isNotNull','emit','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','inspect','linkedid','isUndefined','merge','pick','keys','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','context','split','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','user:agentconnect','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','starttime','subtract','duration','seconds','disposition','includes','lastapplication','startsWith','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinename','destinationchannel','UserId','membername','name','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','.WAV','monitors','push','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','type','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','then','stopRecordingOnTransfer','transferType','undefined','isEmpty','Action','catch','finally','webbar:stopmonitors','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum'];(function(_0x1363e7,_0x1e578b){var _0x1498c6=function(_0x481f13){while(--_0x481f13){_0x1363e7['push'](_0x1363e7['shift']());}};_0x1498c6(++_0x1e578b);}(_0x77d4,0x197));var _0x477d=function(_0x16b51e,_0x30cb17){_0x16b51e=_0x16b51e-0x0;var _0x27b91a=_0x77d4[_0x16b51e];return _0x27b91a;};'use strict';var BPromise=require(_0x477d('0x0'));var _=require(_0x477d('0x1'));var moment=require(_0x477d('0x2'));var util=require(_0x477d('0x3'));var path=require(_0x477d('0x4'));var Redis=require(_0x477d('0x5'));var config=require(_0x477d('0x6'));var logger=require(_0x477d('0x7'))(_0x477d('0x8'));var ami=require(_0x477d('0x9'));var Channel=require(_0x477d('0xa'));var statusDesc=['unknown',_0x477d('0xb'),_0x477d('0xc'),_0x477d('0xd'),_0x477d('0xe'),'unavailable',_0x477d('0xf'),'ringinuse','onhold'];var applications=[_0x477d('0x10'),_0x477d('0x11'),_0x477d('0x12'),_0x477d('0x13'),_0x477d('0x14'),_0x477d('0x15')];var dispositions=['NO\x20ANSWER','FAILED','FAILED',_0x477d('0x16'),'NO\x20ANSWER',_0x477d('0x16'),_0x477d('0x17'),_0x477d('0x18'),_0x477d('0x19'),_0x477d('0x19'),_0x477d('0x19')];var actions={};config[_0x477d('0x1a')]=_['defaults'](config[_0x477d('0x1a')],{'host':_0x477d('0x1b'),'port':0x18eb});var io=require(_0x477d('0x1c'))(new Redis(config['redis']));function VoiceCallReport(_0x343b3c){this[_0x477d('0x1d')]=_0x343b3c[_0x477d('0x1d')];this[_0x477d('0x1e')]=_0x343b3c[_0x477d('0x1e')];this[_0x477d('0x1f')]=_0x343b3c['settings'];this[_0x477d('0x20')]={};ami['on']('coreshowchannel',this[_0x477d('0x21')][_0x477d('0x22')](this));ami['on'](_0x477d('0x23'),this['syncNewExten']['bind'](this));ami['on']('newchannel',this[_0x477d('0x24')][_0x477d('0x22')](this));ami['on'](_0x477d('0x25'),this[_0x477d('0x26')]['bind'](this));ami['on']('varset',this['syncVarSet'][_0x477d('0x22')](this));ami['on']('hangup',this[_0x477d('0x27')][_0x477d('0x22')](this));ami['on'](_0x477d('0x28'),this['syncNewCallerId'][_0x477d('0x22')](this));ami['on'](_0x477d('0x29'),this[_0x477d('0x2a')][_0x477d('0x22')](this));ami['on'](_0x477d('0x2b'),this[_0x477d('0x2c')][_0x477d('0x22')](this));ami['on'](_0x477d('0x2d'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0x477d('0x2e'),this['syncMusicOnHoldStop'][_0x477d('0x22')](this));try{logger[_0x477d('0x2f')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0x477d('0x30')]();}catch(_0x46e58c){logger[_0x477d('0x31')](_0x477d('0x32'),util['inspect'](_0x46e58c,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x477d('0x33')][_0x477d('0x34')]=function(_0x53aefa){return _0x53aefa!==null&&!_['isUndefined'](_0x53aefa);};VoiceCallReport[_0x477d('0x33')]['emit']=function(_0x3a30ae,_0x12254e,_0x2aea57){io['to'](_0x3a30ae)[_0x477d('0x35')](_0x12254e,_0x2aea57);};VoiceCallReport[_0x477d('0x33')][_0x477d('0x36')]=function(_0x1ceffa){try{if(this[_0x477d('0x34')](_0x1ceffa)){logger['info'](_0x477d('0x37'),_0x1ceffa[_0x477d('0x38')],_0x1ceffa[_0x477d('0x39')],_0x1ceffa[_0x477d('0x3a')]);logger[_0x477d('0x3b')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x1ceffa[_0x477d('0x38')],util[_0x477d('0x3c')](_0x1ceffa,{'showHidden':![],'depth':null}));if(_0x1ceffa[_0x477d('0x38')]===_0x1ceffa[_0x477d('0x3d')]){if(!_[_0x477d('0x3e')](this[_0x477d('0x1d')][_0x1ceffa[_0x477d('0x38')]])){_[_0x477d('0x3f')](this[_0x477d('0x1d')][_0x1ceffa[_0x477d('0x38')]],_[_0x477d('0x40')](_0x1ceffa,_[_0x477d('0x41')](this[_0x477d('0x1d')][_0x1ceffa['uniqueid']])));}}}}catch(_0x495da9){logger[_0x477d('0x31')](_0x477d('0x42'),_0x1ceffa[_0x477d('0x38')],util[_0x477d('0x3c')](_0x495da9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x477d('0x33')][_0x477d('0x24')]=function(_0x26c926){try{if(this[_0x477d('0x34')](_0x26c926)){logger[_0x477d('0x3b')](_0x477d('0x43'),_0x26c926['uniqueid'],util[_0x477d('0x3c')](_0x26c926,{'showHidden':![],'depth':null}));if(_0x26c926[_0x477d('0x38')]===_0x26c926['linkedid']&&_0x26c926[_0x477d('0x44')]!=_0x477d('0x45')){if(_[_0x477d('0x3e')](this[_0x477d('0x1d')][_0x26c926[_0x477d('0x38')]])){logger['info'](_0x477d('0x46'),_0x26c926[_0x477d('0x38')],_0x26c926['context'],_0x26c926[_0x477d('0x47')]);this[_0x477d('0x1d')][_0x26c926['uniqueid']]=new Channel();this[_0x477d('0x1d')][_0x26c926[_0x477d('0x38')]]['starttime']=moment()[_0x477d('0x48')](_0x477d('0x49'));this[_0x477d('0x1d')][_0x26c926[_0x477d('0x38')]]['disposition']=dispositions[_[_0x477d('0x4a')](_0x26c926[_0x477d('0x4b')])];_[_0x477d('0x3f')](this['channels'][_0x26c926[_0x477d('0x38')]],_[_0x477d('0x40')](_0x26c926,_['keys'](this['channels'][_0x26c926[_0x477d('0x38')]])));if(_0x26c926[_0x477d('0x4c')]==='from-sip'){if(this[_0x477d('0x1e')][_0x26c926[_0x477d('0x44')][_0x477d('0x4d')]('-')[0x0]]){this['agents'][_0x26c926[_0x477d('0x44')]['split']('-')[0x0]]['destconnectedlinenum']=_0x26c926[_0x477d('0x47')];logger['debug'](_0x477d('0x4e'),_0x26c926[_0x477d('0x38')],util[_0x477d('0x3c')]({'destaccountcode':this[_0x477d('0x1e')][_0x26c926[_0x477d('0x44')][_0x477d('0x4d')]('-')[0x0]][_0x477d('0x4f')],'destconnectedlinenum':_0x26c926[_0x477d('0x47')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x477d('0x48')](_0x477d('0x50'),this[_0x477d('0x1e')][_0x26c926[_0x477d('0x44')][_0x477d('0x4d')]('-')[0x0]]['name']),_0x477d('0x51'),{'destaccountcode':this[_0x477d('0x1e')][_0x26c926[_0x477d('0x44')][_0x477d('0x4d')]('-')[0x0]][_0x477d('0x4f')],'destconnectedlinenum':_0x26c926[_0x477d('0x47')]});}}}}}}catch(_0xd664c3){logger['error'](_0x477d('0x52'),_0x26c926[_0x477d('0x38')],util['inspect'](_0xd664c3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x477d('0x33')][_0x477d('0x21')]=function(_0x170a0b){try{if(this['isNotNull'](_0x170a0b)){logger[_0x477d('0x3b')](_0x477d('0x53'),_0x170a0b[_0x477d('0x38')],util[_0x477d('0x3c')](_0x170a0b,{'showHidden':![],'depth':null}));if(_0x170a0b[_0x477d('0x38')]===_0x170a0b[_0x477d('0x3d')]&&_0x170a0b['exten']!='h'&&_0x170a0b['channel']!=_0x477d('0x45')){_0x170a0b[_0x477d('0x54')]=_0x170a0b[_0x477d('0x54')][_0x477d('0x55')]();_0x170a0b[_0x477d('0x56')]=(_0x170a0b['appdata']||_0x170a0b['applicationdata'])[_0x477d('0x55')]();logger[_0x477d('0x2f')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x170a0b[_0x477d('0x38')],_0x170a0b['application'],_0x170a0b[_0x477d('0x56')]);if(_[_0x477d('0x3e')](this[_0x477d('0x1d')][_0x170a0b[_0x477d('0x38')]])){this[_0x477d('0x1d')][_0x170a0b['uniqueid']]=new Channel();this[_0x477d('0x1d')][_0x170a0b[_0x477d('0x38')]][_0x477d('0x57')]=_0x170a0b['duration']?moment()[_0x477d('0x58')](moment[_0x477d('0x59')](_0x170a0b[_0x477d('0x59')])[_0x477d('0x5a')](),_0x477d('0x5a'))['format']('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x477d('0x48')](_0x477d('0x49'));this[_0x477d('0x1d')][_0x170a0b[_0x477d('0x38')]][_0x477d('0x5b')]='NO\x20ANSWER';}_['merge'](this[_0x477d('0x1d')][_0x170a0b[_0x477d('0x38')]],_[_0x477d('0x40')](_0x170a0b,_[_0x477d('0x41')](this['channels'][_0x170a0b['uniqueid']])));if(_[_0x477d('0x5c')](applications,_0x170a0b[_0x477d('0x54')])){this[_0x477d('0x1d')][_0x170a0b[_0x477d('0x38')]][_0x477d('0x5d')]=_0x170a0b['application'];this[_0x477d('0x1d')][_0x170a0b[_0x477d('0x38')]]['lastdata']=_0x170a0b[_0x477d('0x56')];if(_0x170a0b['application']===_0x477d('0x10')&&_[_0x477d('0x5e')](_0x170a0b[_0x477d('0x56')],_0x477d('0x5f'))){var _0x218e81=_0x170a0b['applicationdata']['split']('=');var _0x1194fa=_0x218e81[0x0][_0x477d('0x60')](/cdr\((.*)\)/);if(_0x1194fa){this['channels'][_0x170a0b[_0x477d('0x38')]][_0x1194fa[0x1]]=_0x218e81[0x1];}}else if(_0x170a0b[_0x477d('0x54')]===_0x477d('0x11')){this[_0x477d('0x1d')][_0x170a0b[_0x477d('0x38')]]['queue']=_0x170a0b[_0x477d('0x56')][_0x477d('0x4d')](',')[0x0];}}}}}catch(_0x4504e8){logger[_0x477d('0x31')](_0x477d('0x61'),_0x170a0b[_0x477d('0x38')],util[_0x477d('0x3c')](_0x4504e8,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x477d('0x26')]=function(_0x54eb9b){try{if(this[_0x477d('0x34')](_0x54eb9b)){logger[_0x477d('0x2f')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x54eb9b[_0x477d('0x38')],_0x54eb9b[_0x477d('0x3d')],_0x54eb9b[_0x477d('0x39')],_0x54eb9b['calleridnum']);logger[_0x477d('0x3b')](_0x477d('0x62'),_0x54eb9b['uniqueid'],util['inspect'](_0x54eb9b,{'showHidden':![],'depth':null}));if(_0x54eb9b['uniqueid']!==_0x54eb9b['linkedid']){if(this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x3d')]]){if(_0x54eb9b[_0x477d('0x4b')]==='6'){if(!this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x3d')]][_0x477d('0x63')]){var _0x2ca1b3=moment();this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x3d')]][_0x477d('0x63')]=!![];this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x3d')]][_0x477d('0x64')]=_0x2ca1b3[_0x477d('0x48')](_0x477d('0x49'));if(this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x3d')]]['starttime']){this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x3d')]][_0x477d('0x65')]=_0x2ca1b3[_0x477d('0x66')](this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x3d')]]['starttime'],'seconds');}}this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x3d')]]['linkedid']=_0x54eb9b[_0x477d('0x38')];if(_0x54eb9b['calleridnum']!=='xcally-motion-preview'){this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x3d')]]['connectedlinenum']=_0x54eb9b['calleridnum'];}this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x3d')]][_0x477d('0x67')]=_0x54eb9b[_0x477d('0x39')];this['channels'][_0x54eb9b['linkedid']][_0x477d('0x68')]=_0x54eb9b[_0x477d('0x44')];this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x3d')]][_0x477d('0x5b')]=dispositions[_[_0x477d('0x4a')](_0x54eb9b[_0x477d('0x4b')])];if(this[_0x477d('0x1e')][_0x54eb9b['channel'][_0x477d('0x4d')]('-')[0x0]]){this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x3d')]][_0x477d('0x69')]=this[_0x477d('0x1e')][_0x54eb9b['channel'][_0x477d('0x4d')]('-')[0x0]]['id'];this['channels'][_0x54eb9b[_0x477d('0x3d')]][_0x477d('0x6a')]=this[_0x477d('0x1e')][_0x54eb9b[_0x477d('0x44')]['split']('-')[0x0]][_0x477d('0x6b')];}}}}else{if(this['channels'][_0x54eb9b[_0x477d('0x38')]]){if(_0x54eb9b[_0x477d('0x4b')]==='6'){if(this[_0x477d('0x1e')][_0x54eb9b['channel'][_0x477d('0x4d')]('-')[0x0]]){this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x38')]]['UserId']=this[_0x477d('0x1e')][_0x54eb9b['channel'][_0x477d('0x4d')]('-')[0x0]]['id'];this[_0x477d('0x1d')][_0x54eb9b[_0x477d('0x38')]]['membername']=this['agents'][_0x54eb9b[_0x477d('0x44')][_0x477d('0x4d')]('-')[0x0]][_0x477d('0x6b')];}}}}}}catch(_0x2c5221){logger['error'](_0x477d('0x6c'),_0x54eb9b[_0x477d('0x38')],util['inspect'](_0x2c5221,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x477d('0x33')][_0x477d('0x6d')]=function(_0x51047e,_0x2ebbfd){try{if(this[_0x477d('0x1d')][_0x51047e]){logger[_0x477d('0x2f')](_0x477d('0x6e'),_0x51047e,_0x2ebbfd);this[_0x477d('0x1d')][_0x51047e][_0x477d('0x6f')]=!![];if(_[_0x477d('0x70')](_0x2ebbfd,_0x477d('0x71'))){_0x2ebbfd=_0x2ebbfd['replace'](_0x477d('0x71'),_0x477d('0x72'));}this[_0x477d('0x1d')][_0x51047e]['monitorFilename']=_0x2ebbfd;var _0x49319d=_['find'](this[_0x477d('0x1d')][_0x51047e][_0x477d('0x73')],{'filename':_0x2ebbfd});if(_['isNil'](_0x49319d)){this[_0x477d('0x1d')][_0x51047e][_0x477d('0x73')][_0x477d('0x74')]({'filename':_0x2ebbfd,'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':'rec'});}}}catch(_0x241c49){logger[_0x477d('0x31')](_0x477d('0x75'),_0x51047e,util[_0x477d('0x3c')](_0x241c49,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x477d('0x33')][_0x477d('0x76')]=function(_0x80e4e0){try{if(this[_0x477d('0x34')](_0x80e4e0)){logger[_0x477d('0x3b')](_0x477d('0x77'),_0x80e4e0[_0x477d('0x38')],util[_0x477d('0x3c')](_0x80e4e0,{'showHidden':![],'depth':null}));if(this[_0x477d('0x1d')][_0x80e4e0[_0x477d('0x38')]]&&_0x80e4e0['channel']!=_0x477d('0x45')){if(this[_0x477d('0x34')](_0x80e4e0[_0x477d('0x78')])){if(this[_0x477d('0x34')](_0x80e4e0[_0x477d('0x78')][_0x477d('0x79')])){logger[_0x477d('0x2f')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x80e4e0[_0x477d('0x38')],_0x80e4e0[_0x477d('0x7a')]);this[_0x477d('0x6d')](_0x80e4e0[_0x477d('0x38')],_0x80e4e0[_0x477d('0x7a')]);}else if(this['isNotNull'](_0x80e4e0[_0x477d('0x78')][_0x477d('0x7b')])){logger[_0x477d('0x2f')](_0x477d('0x7c'),_0x80e4e0[_0x477d('0x38')],_0x80e4e0[_0x477d('0x7a')]);this[_0x477d('0x1d')][_0x80e4e0[_0x477d('0x38')]][_0x477d('0x3a')]=_0x80e4e0[_0x477d('0x7a')];}else if(this[_0x477d('0x34')](_0x80e4e0[_0x477d('0x78')][_0x477d('0x7d')])){logger['info'](_0x477d('0x7e'),_0x80e4e0[_0x477d('0x38')],_0x80e4e0[_0x477d('0x7a')]);this[_0x477d('0x1d')][_0x80e4e0[_0x477d('0x38')]][_0x477d('0x7f')]=_0x80e4e0[_0x477d('0x7a')];}else if(this[_0x477d('0x34')](_0x80e4e0['variable'][_0x477d('0x80')])){logger[_0x477d('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x80e4e0[_0x477d('0x38')],_0x80e4e0[_0x477d('0x7a')]);this[_0x477d('0x1d')][_0x80e4e0['uniqueid']][_0x477d('0x81')]=_0x80e4e0[_0x477d('0x7a')];}else if(this[_0x477d('0x34')](_0x80e4e0[_0x477d('0x78')]['xmd-queue'])){logger[_0x477d('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x80e4e0[_0x477d('0x38')],_0x80e4e0[_0x477d('0x7a')][_0x477d('0x4d')](',')[0x0]);this[_0x477d('0x1d')][_0x80e4e0[_0x477d('0x38')]][_0x477d('0x11')]=_0x80e4e0[_0x477d('0x7a')]['split'](',')[0x0];}else if(this[_0x477d('0x34')](_0x80e4e0['variable']['xmd-originatecalleridnum'])){logger[_0x477d('0x2f')](_0x477d('0x82'),_0x80e4e0[_0x477d('0x38')],_0x80e4e0['value']);this['channels'][_0x80e4e0[_0x477d('0x38')]]['originatecalleridnum']=_0x80e4e0[_0x477d('0x7a')];}else if(this[_0x477d('0x34')](_0x80e4e0[_0x477d('0x78')][_0x477d('0x83')])){logger[_0x477d('0x2f')](_0x477d('0x84'),_0x80e4e0['uniqueid'],_0x80e4e0['value']);this[_0x477d('0x1d')][_0x80e4e0[_0x477d('0x38')]][_0x477d('0x85')]=_0x80e4e0[_0x477d('0x7a')];}else if(this[_0x477d('0x34')](_0x80e4e0[_0x477d('0x78')][_0x477d('0x86')])){logger['info'](_0x477d('0x87'),_0x80e4e0[_0x477d('0x38')],_0x80e4e0[_0x477d('0x7a')]);this[_0x477d('0x1d')][_0x80e4e0['uniqueid']][_0x477d('0x88')]=_0x80e4e0[_0x477d('0x7a')];}else if(this[_0x477d('0x34')](_0x80e4e0[_0x477d('0x78')][_0x477d('0x89')])){logger[_0x477d('0x2f')](_0x477d('0x8a'),_0x80e4e0[_0x477d('0x38')],_0x80e4e0['value']);this['channels'][_0x80e4e0[_0x477d('0x38')]]['queue']=_0x80e4e0[_0x477d('0x7a')];}else if(this[_0x477d('0x34')](_0x80e4e0[_0x477d('0x78')][_0x477d('0x8b')])){logger['info'](_0x477d('0x8c'),_0x80e4e0['uniqueid'],_0x80e4e0[_0x477d('0x7a')]);this['channels'][_0x80e4e0['uniqueid']]['sipcalluniqueid']=_0x80e4e0['value'];}}}else if(this[_0x477d('0x34')](_0x80e4e0[_0x477d('0x78')][_0x477d('0x79')])){if(_0x80e4e0[_0x477d('0x7a')]){var _0x34c30c=path[_0x477d('0x8d')](_0x80e4e0[_0x477d('0x7a')])[_0x477d('0x6b')];logger['info'](_0x477d('0x8e'),_0x34c30c,_0x80e4e0[_0x477d('0x7a')]);this['syncMixMonitorFilename'](_0x34c30c,_0x80e4e0[_0x477d('0x7a')]);}}else if(this[_0x477d('0x1d')][_0x80e4e0['linkedid']]){if(this[_0x477d('0x34')](_0x80e4e0[_0x477d('0x78')])){if(this[_0x477d('0x34')](_0x80e4e0['variable'][_0x477d('0x8b')])){logger[_0x477d('0x2f')](_0x477d('0x8c'),_0x80e4e0['linkedid'],_0x80e4e0[_0x477d('0x7a')]);this['channels'][_0x80e4e0[_0x477d('0x3d')]][_0x477d('0x8f')]=_0x80e4e0[_0x477d('0x7a')];}}}}}catch(_0x581fc8){logger[_0x477d('0x31')](_0x477d('0x90'),_0x80e4e0['uniqueid'],util['inspect'](_0x581fc8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x477d('0x33')][_0x477d('0x27')]=function(_0x183aa8){try{if(this[_0x477d('0x34')](_0x183aa8)){logger[_0x477d('0x3b')](_0x477d('0x91'),_0x183aa8[_0x477d('0x38')],util[_0x477d('0x3c')](_0x183aa8,{'showHidden':![],'depth':null}));if(this[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]]){logger[_0x477d('0x2f')](_0x477d('0x92'),_0x183aa8[_0x477d('0x38')],_0x183aa8[_0x477d('0x93')]);var _0xc5b6d4=moment();this[_0x477d('0x1d')][_0x183aa8['uniqueid']]['endtime']=_0xc5b6d4[_0x477d('0x48')](_0x477d('0x49'));this['channels'][_0x183aa8[_0x477d('0x38')]][_0x477d('0x59')]=_0xc5b6d4[_0x477d('0x66')](this[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]][_0x477d('0x57')],_0x477d('0x5a'));if(this[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]]['answered']){this[_0x477d('0x1d')][_0x183aa8['uniqueid']]['billableseconds']=_0xc5b6d4[_0x477d('0x66')](this[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]][_0x477d('0x64')],_0x477d('0x5a'));this[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]][_0x477d('0x65')]=this[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]][_0x477d('0x59')]-this['channels'][_0x183aa8[_0x477d('0x38')]]['billableseconds'];}if(_0x183aa8[_0x477d('0x4c')]==='from-sip'){if(this[_0x477d('0x1e')][_0x183aa8['channel'][_0x477d('0x4d')]('-')[0x0]]){this[_0x477d('0x1e')][_0x183aa8[_0x477d('0x44')][_0x477d('0x4d')]('-')[0x0]]=_[_0x477d('0x94')](this['agents'][_0x183aa8[_0x477d('0x44')][_0x477d('0x4d')]('-')[0x0]],['destconnectedlinenum']);logger['debug'](_0x477d('0x95'),_0x183aa8['uniqueid'],util[_0x477d('0x3c')]({'destaccountcode':this['agents'][_0x183aa8[_0x477d('0x44')][_0x477d('0x4d')]('-')[0x0]][_0x477d('0x4f')]},{'showHidden':![],'depth':null}));this[_0x477d('0x35')](util[_0x477d('0x48')]('user:%s',this['agents'][_0x183aa8['channel'][_0x477d('0x4d')]('-')[0x0]][_0x477d('0x6b')]),'user:agentcomplete',{'destaccountcode':this[_0x477d('0x1e')][_0x183aa8[_0x477d('0x44')][_0x477d('0x4d')]('-')[0x0]]['accountcode']});}}var _0x5a3428=this;Promise['resolve']()[_0x477d('0x96')](function(){if(!_0x5a3428[_0x477d('0x1f')][_0x477d('0x97')])return;var _0x751702=_0x5a3428[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]];if(typeof _0x751702[_0x477d('0x98')]===_0x477d('0x99'))return;if(_[_0x477d('0x9a')](_0x751702['monitors']))return;return ami[_0x477d('0x9b')]({'action':'StopMixMonitor','channel':_0x751702[_0x477d('0x68')]})[_0x477d('0x9c')](function(){})[_0x477d('0x9d')](function(){io[_0x477d('0x35')](_0x477d('0x9e'),{'agentId':_0x5a3428[_0x477d('0x1e')][_0x751702[_0x477d('0x68')]['split']('-')[0x0]]['id'],'uniqueid':_0x751702[_0x477d('0x38')]});});})[_0x477d('0x96')](function(){if(_0x183aa8['event']===_0x477d('0x9f')){_0x5a3428[_0x477d('0x20')][_0x183aa8[_0x477d('0x38')]]=_0x5a3428[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]];}else{if(_0x5a3428[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]]['type']===_0x477d('0xa0')&&_0x5a3428[_0x477d('0x20')][_0x183aa8[_0x477d('0x38')]]){_0x5a3428[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]]['uniqueid']=[_0x5a3428[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]][_0x477d('0x3d')],_0x5a3428[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]][_0x477d('0x3d')]=_0x5a3428['channels'][_0x183aa8[_0x477d('0x38')]][_0x477d('0x38')]][0x0];delete _0x5a3428[_0x477d('0x20')][_0x183aa8[_0x477d('0x38')]];}}logger[_0x477d('0x3b')](_0x477d('0xa1'),_0x183aa8['uniqueid'],util[_0x477d('0x3c')](_0x5a3428[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]],{'showHidden':![],'depth':null}));ami['emit'](_0x477d('0xa2'),_0x5a3428[_0x477d('0x1d')][_0x183aa8[_0x477d('0x38')]]);delete _0x5a3428[_0x477d('0x1d')][_0x183aa8['uniqueid']];});}}}catch(_0x219e38){logger[_0x477d('0x31')](_0x477d('0xa3'),_0x183aa8['uniqueid'],util[_0x477d('0x3c')](_0x219e38,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x477d('0x2a')]=function(_0x1c6f04){try{if(this[_0x477d('0x34')](_0x1c6f04)){logger['info'](_0x477d('0xa4'),_0x1c6f04[_0x477d('0x38')],_0x1c6f04['origtransferercalleridnum'],_0x1c6f04[_0x477d('0xa5')]);logger[_0x477d('0x3b')](_0x477d('0xa6'),_0x1c6f04[_0x477d('0x38')],util[_0x477d('0x3c')](_0x1c6f04,{'showHidden':![],'depth':null}));if(this[_0x477d('0x1d')][_0x1c6f04[_0x477d('0xa7')]]){this['channels'][_0x1c6f04[_0x477d('0xa7')]][_0x477d('0xa8')]=_0x1c6f04[_0x477d('0xa9')];this['channels'][_0x1c6f04[_0x477d('0xa7')]][_0x477d('0xaa')]=_0x1c6f04[_0x477d('0xa5')];if(this[_0x477d('0x1d')][_0x1c6f04[_0x477d('0xab')]]){var _0x3435ad=this[_0x477d('0x1d')][_0x1c6f04[_0x477d('0xab')]];this[_0x477d('0x1d')][_0x1c6f04['secondtransfereruniqueid']]=this[_0x477d('0x1d')][_0x1c6f04[_0x477d('0xa7')]];this[_0x477d('0x1d')][_0x1c6f04[_0x477d('0xa7')]]=_0x3435ad;}}else if(this[_0x477d('0x1d')][_0x1c6f04[_0x477d('0xac')]]){this[_0x477d('0x1d')][_0x1c6f04[_0x477d('0xac')]]['transfercalleridnum']=_0x1c6f04[_0x477d('0xa9')];this[_0x477d('0x1d')][_0x1c6f04[_0x477d('0xac')]][_0x477d('0xaa')]=_0x1c6f04[_0x477d('0xa5')];if(this[_0x477d('0x1d')][_0x1c6f04['origtransfereruniqueid']]){var _0x3435ad=this['channels'][_0x1c6f04[_0x477d('0xad')]];this['channels'][_0x1c6f04['origtransfereruniqueid']]=this['channels'][_0x1c6f04[_0x477d('0xac')]];this[_0x477d('0x1d')][_0x1c6f04['transfertargetuniqueid']]=_0x3435ad;}}if(this[_0x477d('0x1d')][_0x1c6f04[_0x477d('0xad')]]&&this[_0x477d('0x1d')][_0x1c6f04['secondtransfereruniqueid']]){var _0x2a2f7c=_['some']([this['channels'][_0x1c6f04[_0x477d('0xad')]],this[_0x477d('0x1d')][_0x1c6f04[_0x477d('0xab')]]],function(_0x5f56a7){return _0x5f56a7[_0x477d('0x81')]===_0x477d('0xa0')&&_0x5f56a7[_0x477d('0xae')];});if(_0x2a2f7c){if(this[_0x477d('0x1d')][_0x1c6f04[_0x477d('0xad')]][_0x477d('0x81')]!==_0x477d('0xa0'))this['channels'][_0x1c6f04['origtransfereruniqueid']]['transferType']=_0x477d('0xaf');if(this[_0x477d('0x1d')][_0x1c6f04['secondtransfereruniqueid']][_0x477d('0x81')]!=='outbound')this[_0x477d('0x1d')][_0x1c6f04[_0x477d('0xab')]][_0x477d('0x98')]='ATTENDED';}}}}catch(_0x1d1d39){logger[_0x477d('0x31')](_0x477d('0xb0'),_0x1c6f04['uniqueid'],util[_0x477d('0x3c')](_0x1d1d39,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x477d('0x33')][_0x477d('0x2c')]=function(_0x43ff47){try{if(this['isNotNull'](_0x43ff47)){logger[_0x477d('0x2f')](_0x477d('0xb1'),_0x43ff47['uniqueid'],_0x43ff47[_0x477d('0xb2')],_0x43ff47[_0x477d('0xb3')]);logger[_0x477d('0x3b')](_0x477d('0xb4'),_0x43ff47['uniqueid'],util[_0x477d('0x3c')](_0x43ff47,{'showHidden':![],'depth':null}));if(this['channels'][_0x43ff47[_0x477d('0xa7')]]){this[_0x477d('0x1d')][_0x43ff47[_0x477d('0xa7')]][_0x477d('0xa8')]=_0x43ff47[_0x477d('0xb2')];this[_0x477d('0x1d')][_0x43ff47[_0x477d('0xa7')]][_0x477d('0xaa')]=_0x43ff47[_0x477d('0xb3')];this[_0x477d('0x1d')][_0x43ff47[_0x477d('0xa7')]][_0x477d('0x98')]=_0x477d('0xb5');this[_0x477d('0x27')]({'event':_0x477d('0x9f'),'uniqueid':_0x43ff47[_0x477d('0xa7')],'context':_0x43ff47[_0x477d('0x4c')],'channel':_0x43ff47[_0x477d('0xb6')]});}else{this['channels'][_0x43ff47['transfereruniqueid']][_0x477d('0x98')]='BLIND';}}}catch(_0x2a26a0){logger['error'](_0x477d('0xb7'),_0x43ff47[_0x477d('0x38')],util['inspect'](_0x2a26a0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x477d('0x33')][_0x477d('0xb8')]=function(_0x5f0054){try{if(this['isNotNull'](_0x5f0054)){logger[_0x477d('0x3b')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x5f0054[_0x477d('0x38')],util[_0x477d('0x3c')](_0x5f0054,{'showHidden':![],'depth':null}));if(this['channels'][_0x5f0054[_0x477d('0x38')]]){if(!_['isNil'](this[_0x477d('0x1d')][_0x5f0054[_0x477d('0x38')]][_0x477d('0x64')])){this['channels'][_0x5f0054['uniqueid']][_0x477d('0xb9')]=moment()[_0x477d('0x48')]('YYYY-MM-DD\x20HH:mm:ss');logger['info'](_0x477d('0xba'),_0x5f0054[_0x477d('0x38')],this[_0x477d('0x1d')][_0x5f0054['uniqueid']][_0x477d('0xb9')]);}}}}catch(_0x5f45ef){logger['error'](_0x477d('0xbb'),_0x5f0054[_0x477d('0x38')],util['inspect'](_0x5f45ef,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x477d('0x33')][_0x477d('0xbc')]=function(_0x7e4b9b){try{if(this[_0x477d('0x34')](_0x7e4b9b)){logger[_0x477d('0x3b')]('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x7e4b9b[_0x477d('0x38')],util[_0x477d('0x3c')](_0x7e4b9b,{'showHidden':![],'depth':null}));if(this[_0x477d('0x1d')][_0x7e4b9b[_0x477d('0x38')]]){if(!_['isNil'](this['channels'][_0x7e4b9b['uniqueid']]['mohstarttime'])){this['channels'][_0x7e4b9b[_0x477d('0x38')]][_0x477d('0xbd')]+=moment()['milliseconds'](0x0)[_0x477d('0x66')](this['channels'][_0x7e4b9b[_0x477d('0x38')]][_0x477d('0xb9')],'seconds');logger[_0x477d('0x2f')](_0x477d('0xbe'),_0x7e4b9b['uniqueid'],this[_0x477d('0x1d')][_0x7e4b9b[_0x477d('0x38')]][_0x477d('0xbd')]);delete this[_0x477d('0x1d')][_0x7e4b9b[_0x477d('0x38')]][_0x477d('0xb9')];}}}}catch(_0x5d07da){logger[_0x477d('0x31')]('[%s][voiceCallReport][musiconholdstop]',_0x7e4b9b[_0x477d('0x38')],util['inspect'](_0x5d07da,{'showHidden':![],'depth':null}));}};module['exports']=VoiceCallReport; \ No newline at end of file +var _0x326f=['custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','some','routeid','ATTENDED','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','inuse','busy','invalid','ringing','ringinuse','onhold','set','queue','dial','voicemail','FAILED','NO\x20ANSWER','ANSWERED','redis','localhost','socket.io-emitter','channels','agents','settings','blindTransfers','syncNewExten','bind','newexten','newchannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','syncNewCallerId','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','[%s][voiceCallReport][newcallerid]','syncNewChannel','[%s][voiceCallReport][newchannel]\x20event:','channel','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','keys','split','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','accountcode','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','includes','lastdata','startsWith','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinenum','connectedlinename','membername','name','UserId','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','replace','.WAV','monitorFilename','monitors','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','from-sip','destconnectedlinenum','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','stopRecordingOnTransfer','transferType','undefined','Action','StopMixMonitor','destinationchannel','catch','finally','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:'];(function(_0x2b63a0,_0x14fc48){var _0x4f0434=function(_0x8cba9e){while(--_0x8cba9e){_0x2b63a0['push'](_0x2b63a0['shift']());}};_0x4f0434(++_0x14fc48);}(_0x326f,0x1a1));var _0xf326=function(_0x573baa,_0x1fc38c){_0x573baa=_0x573baa-0x0;var _0x2fd1cc=_0x326f[_0x573baa];return _0x2fd1cc;};'use strict';var BPromise=require('bluebird');var _=require(_0xf326('0x0'));var moment=require(_0xf326('0x1'));var util=require(_0xf326('0x2'));var path=require(_0xf326('0x3'));var Redis=require('ioredis');var config=require(_0xf326('0x4'));var logger=require(_0xf326('0x5'))(_0xf326('0x6'));var ami=require(_0xf326('0x7'));var Channel=require(_0xf326('0x8'));var statusDesc=['unknown','not_inuse',_0xf326('0x9'),_0xf326('0xa'),_0xf326('0xb'),'unavailable',_0xf326('0xc'),_0xf326('0xd'),_0xf326('0xe')];var applications=[_0xf326('0xf'),_0xf326('0x10'),'agi',_0xf326('0x11'),'playback',_0xf326('0x12')];var dispositions=['NO\x20ANSWER',_0xf326('0x13'),_0xf326('0x13'),_0xf326('0x14'),'NO\x20ANSWER','NO\x20ANSWER',_0xf326('0x15'),'BUSY','FAILED',_0xf326('0x13'),'FAILED'];var actions={};config[_0xf326('0x16')]=_['defaults'](config[_0xf326('0x16')],{'host':_0xf326('0x17'),'port':0x18eb});var io=require(_0xf326('0x18'))(new Redis(config[_0xf326('0x16')]));function VoiceCallReport(_0x44243c){this[_0xf326('0x19')]=_0x44243c[_0xf326('0x19')];this[_0xf326('0x1a')]=_0x44243c[_0xf326('0x1a')];this['settings']=_0x44243c[_0xf326('0x1b')];this[_0xf326('0x1c')]={};ami['on']('coreshowchannel',this[_0xf326('0x1d')][_0xf326('0x1e')](this));ami['on'](_0xf326('0x1f'),this[_0xf326('0x1d')]['bind'](this));ami['on'](_0xf326('0x20'),this['syncNewChannel'][_0xf326('0x1e')](this));ami['on'](_0xf326('0x21'),this[_0xf326('0x22')][_0xf326('0x1e')](this));ami['on'](_0xf326('0x23'),this[_0xf326('0x24')]['bind'](this));ami['on'](_0xf326('0x25'),this[_0xf326('0x26')][_0xf326('0x1e')](this));ami['on']('newcallerid',this[_0xf326('0x27')][_0xf326('0x1e')](this));ami['on']('attendedtransfer',this[_0xf326('0x28')][_0xf326('0x1e')](this));ami['on'](_0xf326('0x29'),this[_0xf326('0x2a')]['bind'](this));ami['on'](_0xf326('0x2b'),this[_0xf326('0x2c')][_0xf326('0x1e')](this));ami['on'](_0xf326('0x2d'),this[_0xf326('0x2e')][_0xf326('0x1e')](this));try{logger[_0xf326('0x2f')]('[voiceCallReport][coreshowchannels]\x20started');ami['actionCoreShowChannels']();}catch(_0x1d9eeb){logger[_0xf326('0x30')](_0xf326('0x31'),util[_0xf326('0x32')](_0x1d9eeb,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xf326('0x33')][_0xf326('0x34')]=function(_0xf51329){return _0xf51329!==null&&!_[_0xf326('0x35')](_0xf51329);};VoiceCallReport[_0xf326('0x33')]['emit']=function(_0x166d9d,_0x6b8543,_0x4b6164){io['to'](_0x166d9d)[_0xf326('0x36')](_0x6b8543,_0x4b6164);};VoiceCallReport[_0xf326('0x33')][_0xf326('0x27')]=function(_0x314bfa){try{if(this[_0xf326('0x34')](_0x314bfa)){logger['info'](_0xf326('0x37'),_0x314bfa[_0xf326('0x38')],_0x314bfa[_0xf326('0x39')],_0x314bfa[_0xf326('0x3a')]);logger[_0xf326('0x3b')](_0xf326('0x3c'),_0x314bfa['uniqueid'],util[_0xf326('0x32')](_0x314bfa,{'showHidden':![],'depth':null}));if(_0x314bfa[_0xf326('0x38')]===_0x314bfa[_0xf326('0x3d')]){if(!_[_0xf326('0x35')](this['channels'][_0x314bfa[_0xf326('0x38')]])){_[_0xf326('0x3e')](this['channels'][_0x314bfa[_0xf326('0x38')]],_[_0xf326('0x3f')](_0x314bfa,_['keys'](this[_0xf326('0x19')][_0x314bfa[_0xf326('0x38')]])));}}}}catch(_0x1865b0){logger[_0xf326('0x30')](_0xf326('0x40'),_0x314bfa['uniqueid'],util[_0xf326('0x32')](_0x1865b0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf326('0x33')][_0xf326('0x41')]=function(_0x56b09f){try{if(this['isNotNull'](_0x56b09f)){logger[_0xf326('0x3b')](_0xf326('0x42'),_0x56b09f['uniqueid'],util[_0xf326('0x32')](_0x56b09f,{'showHidden':![],'depth':null}));if(_0x56b09f[_0xf326('0x38')]===_0x56b09f[_0xf326('0x3d')]&&_0x56b09f[_0xf326('0x43')]!='OutgoingSpoolFailed'){if(_[_0xf326('0x35')](this[_0xf326('0x19')][_0x56b09f[_0xf326('0x38')]])){logger[_0xf326('0x2f')](_0xf326('0x44'),_0x56b09f['uniqueid'],_0x56b09f[_0xf326('0x45')],_0x56b09f[_0xf326('0x46')]);this[_0xf326('0x19')][_0x56b09f[_0xf326('0x38')]]=new Channel();this[_0xf326('0x19')][_0x56b09f[_0xf326('0x38')]][_0xf326('0x47')]=moment()[_0xf326('0x48')](_0xf326('0x49'));this[_0xf326('0x19')][_0x56b09f['uniqueid']][_0xf326('0x4a')]=dispositions[_[_0xf326('0x4b')](_0x56b09f['channelstate'])];_[_0xf326('0x3e')](this['channels'][_0x56b09f[_0xf326('0x38')]],_[_0xf326('0x3f')](_0x56b09f,_[_0xf326('0x4c')](this[_0xf326('0x19')][_0x56b09f[_0xf326('0x38')]])));if(_0x56b09f[_0xf326('0x45')]==='from-sip'){if(this['agents'][_0x56b09f['channel'][_0xf326('0x4d')]('-')[0x0]]){this[_0xf326('0x1a')][_0x56b09f['channel']['split']('-')[0x0]]['destconnectedlinenum']=_0x56b09f[_0xf326('0x46')];logger[_0xf326('0x3b')](_0xf326('0x4e'),_0x56b09f['uniqueid'],util[_0xf326('0x32')]({'destaccountcode':this['agents'][_0x56b09f['channel'][_0xf326('0x4d')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x56b09f[_0xf326('0x46')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xf326('0x48')]('user:%s',this['agents'][_0x56b09f[_0xf326('0x43')][_0xf326('0x4d')]('-')[0x0]]['name']),_0xf326('0x4f'),{'destaccountcode':this[_0xf326('0x1a')][_0x56b09f[_0xf326('0x43')]['split']('-')[0x0]][_0xf326('0x50')],'destconnectedlinenum':_0x56b09f[_0xf326('0x46')]});}}}}}}catch(_0x5e096c){logger[_0xf326('0x30')](_0xf326('0x51'),_0x56b09f[_0xf326('0x38')],util['inspect'](_0x5e096c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf326('0x1d')]=function(_0x2b4c6a){try{if(this[_0xf326('0x34')](_0x2b4c6a)){logger[_0xf326('0x3b')](_0xf326('0x52'),_0x2b4c6a[_0xf326('0x38')],util[_0xf326('0x32')](_0x2b4c6a,{'showHidden':![],'depth':null}));if(_0x2b4c6a[_0xf326('0x38')]===_0x2b4c6a[_0xf326('0x3d')]&&_0x2b4c6a[_0xf326('0x46')]!='h'&&_0x2b4c6a[_0xf326('0x43')]!='OutgoingSpoolFailed'){_0x2b4c6a[_0xf326('0x53')]=_0x2b4c6a[_0xf326('0x53')]['toLowerCase']();_0x2b4c6a[_0xf326('0x54')]=(_0x2b4c6a[_0xf326('0x55')]||_0x2b4c6a['applicationdata'])['toLowerCase']();logger[_0xf326('0x2f')](_0xf326('0x56'),_0x2b4c6a[_0xf326('0x38')],_0x2b4c6a[_0xf326('0x53')],_0x2b4c6a[_0xf326('0x54')]);if(_['isUndefined'](this[_0xf326('0x19')][_0x2b4c6a[_0xf326('0x38')]])){this[_0xf326('0x19')][_0x2b4c6a[_0xf326('0x38')]]=new Channel();this['channels'][_0x2b4c6a[_0xf326('0x38')]]['starttime']=_0x2b4c6a['duration']?moment()[_0xf326('0x57')](moment[_0xf326('0x58')](_0x2b4c6a[_0xf326('0x58')])[_0xf326('0x59')](),_0xf326('0x59'))[_0xf326('0x48')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0xf326('0x48')](_0xf326('0x49'));this[_0xf326('0x19')][_0x2b4c6a['uniqueid']]['disposition']=_0xf326('0x14');}_[_0xf326('0x3e')](this[_0xf326('0x19')][_0x2b4c6a[_0xf326('0x38')]],_[_0xf326('0x3f')](_0x2b4c6a,_[_0xf326('0x4c')](this[_0xf326('0x19')][_0x2b4c6a[_0xf326('0x38')]])));if(_[_0xf326('0x5a')](applications,_0x2b4c6a[_0xf326('0x53')])){this['channels'][_0x2b4c6a[_0xf326('0x38')]]['lastapplication']=_0x2b4c6a['application'];this[_0xf326('0x19')][_0x2b4c6a[_0xf326('0x38')]][_0xf326('0x5b')]=_0x2b4c6a['applicationdata'];if(_0x2b4c6a['application']==='set'&&_[_0xf326('0x5c')](_0x2b4c6a[_0xf326('0x54')],'cdr(')){var _0x16adfa=_0x2b4c6a[_0xf326('0x54')][_0xf326('0x4d')]('=');var _0x45ae8d=_0x16adfa[0x0][_0xf326('0x5d')](/cdr\((.*)\)/);if(_0x45ae8d){this[_0xf326('0x19')][_0x2b4c6a[_0xf326('0x38')]][_0x45ae8d[0x1]]=_0x16adfa[0x1];}}else if(_0x2b4c6a['application']==='queue'){this[_0xf326('0x19')][_0x2b4c6a[_0xf326('0x38')]][_0xf326('0x10')]=_0x2b4c6a[_0xf326('0x54')][_0xf326('0x4d')](',')[0x0];}}}}}catch(_0x2aa7d0){logger['error'](_0xf326('0x5e'),_0x2b4c6a[_0xf326('0x38')],util[_0xf326('0x32')](_0x2aa7d0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf326('0x33')][_0xf326('0x22')]=function(_0x2868c1){try{if(this['isNotNull'](_0x2868c1)){logger[_0xf326('0x2f')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x2868c1[_0xf326('0x38')],_0x2868c1['linkedid'],_0x2868c1['calleridname'],_0x2868c1[_0xf326('0x3a')]);logger[_0xf326('0x3b')](_0xf326('0x5f'),_0x2868c1[_0xf326('0x38')],util['inspect'](_0x2868c1,{'showHidden':![],'depth':null}));if(_0x2868c1[_0xf326('0x38')]!==_0x2868c1['linkedid']){if(this['channels'][_0x2868c1[_0xf326('0x3d')]]){if(_0x2868c1[_0xf326('0x60')]==='6'){if(!this['channels'][_0x2868c1[_0xf326('0x3d')]]['answered']){var _0x5db789=moment();this[_0xf326('0x19')][_0x2868c1['linkedid']][_0xf326('0x61')]=!![];this[_0xf326('0x19')][_0x2868c1[_0xf326('0x3d')]][_0xf326('0x62')]=_0x5db789[_0xf326('0x48')](_0xf326('0x49'));if(this['channels'][_0x2868c1[_0xf326('0x3d')]][_0xf326('0x47')]){this[_0xf326('0x19')][_0x2868c1[_0xf326('0x3d')]][_0xf326('0x63')]=_0x5db789[_0xf326('0x64')](this['channels'][_0x2868c1[_0xf326('0x3d')]][_0xf326('0x47')],_0xf326('0x59'));}}this['channels'][_0x2868c1['linkedid']][_0xf326('0x3d')]=_0x2868c1[_0xf326('0x38')];if(_0x2868c1[_0xf326('0x3a')]!==_0xf326('0x65')){this[_0xf326('0x19')][_0x2868c1[_0xf326('0x3d')]][_0xf326('0x66')]=_0x2868c1[_0xf326('0x3a')];}this[_0xf326('0x19')][_0x2868c1['linkedid']][_0xf326('0x67')]=_0x2868c1[_0xf326('0x39')];this[_0xf326('0x19')][_0x2868c1[_0xf326('0x3d')]]['destinationchannel']=_0x2868c1[_0xf326('0x43')];this[_0xf326('0x19')][_0x2868c1[_0xf326('0x3d')]][_0xf326('0x4a')]=dispositions[_['toNumber'](_0x2868c1['channelstate'])];if(this[_0xf326('0x1a')][_0x2868c1[_0xf326('0x43')][_0xf326('0x4d')]('-')[0x0]]){this[_0xf326('0x19')][_0x2868c1[_0xf326('0x3d')]]['UserId']=this[_0xf326('0x1a')][_0x2868c1[_0xf326('0x43')]['split']('-')[0x0]]['id'];this[_0xf326('0x19')][_0x2868c1[_0xf326('0x3d')]][_0xf326('0x68')]=this[_0xf326('0x1a')][_0x2868c1[_0xf326('0x43')]['split']('-')[0x0]][_0xf326('0x69')];}}}}else{if(this[_0xf326('0x19')][_0x2868c1[_0xf326('0x38')]]){if(_0x2868c1[_0xf326('0x60')]==='6'){if(this['agents'][_0x2868c1[_0xf326('0x43')]['split']('-')[0x0]]){this[_0xf326('0x19')][_0x2868c1[_0xf326('0x38')]][_0xf326('0x6a')]=this['agents'][_0x2868c1['channel'][_0xf326('0x4d')]('-')[0x0]]['id'];this[_0xf326('0x19')][_0x2868c1['uniqueid']][_0xf326('0x68')]=this[_0xf326('0x1a')][_0x2868c1[_0xf326('0x43')]['split']('-')[0x0]][_0xf326('0x69')];}}}}}}catch(_0xb2ba6e){logger[_0xf326('0x30')](_0xf326('0x6b'),_0x2868c1['uniqueid'],util['inspect'](_0xb2ba6e,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf326('0x6c')]=function(_0x4b31b6,_0x4bdb5c){try{if(this[_0xf326('0x19')][_0x4b31b6]){logger[_0xf326('0x2f')](_0xf326('0x6d'),_0x4b31b6,_0x4bdb5c);this['channels'][_0x4b31b6][_0xf326('0x6e')]=!![];if(_[_0xf326('0x6f')](_0x4bdb5c,'.wav49')){_0x4bdb5c=_0x4bdb5c[_0xf326('0x70')]('.wav49',_0xf326('0x71'));}this[_0xf326('0x19')][_0x4b31b6][_0xf326('0x72')]=_0x4bdb5c;var _0x270158=_['find'](this[_0xf326('0x19')][_0x4b31b6][_0xf326('0x73')],{'filename':_0x4bdb5c});if(_[_0xf326('0x74')](_0x270158)){this[_0xf326('0x19')][_0x4b31b6][_0xf326('0x73')][_0xf326('0x75')]({'filename':_0x4bdb5c,'createdAt':moment()[_0xf326('0x48')](_0xf326('0x49')),'mixmonitorid':'','status':_0xf326('0x76')});}}}catch(_0x352472){logger['error'](_0xf326('0x77'),_0x4b31b6,util['inspect'](_0x352472,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf326('0x33')][_0xf326('0x24')]=function(_0x59076b){try{if(this[_0xf326('0x34')](_0x59076b)){logger[_0xf326('0x3b')]('[%s][voiceCallReport][varset]\x20event:',_0x59076b['uniqueid'],util[_0xf326('0x32')](_0x59076b,{'showHidden':![],'depth':null}));if(this['channels'][_0x59076b['uniqueid']]&&_0x59076b[_0xf326('0x43')]!='OutgoingSpoolFailed'){if(this['isNotNull'](_0x59076b[_0xf326('0x78')])){if(this[_0xf326('0x34')](_0x59076b[_0xf326('0x78')][_0xf326('0x79')])){logger[_0xf326('0x2f')](_0xf326('0x7a'),_0x59076b[_0xf326('0x38')],_0x59076b[_0xf326('0x7b')]);this['syncMixMonitorFilename'](_0x59076b[_0xf326('0x38')],_0x59076b[_0xf326('0x7b')]);}else if(this[_0xf326('0x34')](_0x59076b[_0xf326('0x78')]['xmd-phone'])){logger[_0xf326('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x59076b[_0xf326('0x38')],_0x59076b[_0xf326('0x7b')]);this[_0xf326('0x19')][_0x59076b[_0xf326('0x38')]][_0xf326('0x3a')]=_0x59076b[_0xf326('0x7b')];}else if(this[_0xf326('0x34')](_0x59076b[_0xf326('0x78')]['xmd-callerid'])){logger['info'](_0xf326('0x7c'),_0x59076b[_0xf326('0x38')],_0x59076b[_0xf326('0x7b')]);this[_0xf326('0x19')][_0x59076b[_0xf326('0x38')]]['callerid']=_0x59076b[_0xf326('0x7b')];}else if(this[_0xf326('0x34')](_0x59076b[_0xf326('0x78')][_0xf326('0x7d')])){logger[_0xf326('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x59076b[_0xf326('0x38')],_0x59076b['value']);this[_0xf326('0x19')][_0x59076b['uniqueid']][_0xf326('0x7e')]=_0x59076b[_0xf326('0x7b')];}else if(this[_0xf326('0x34')](_0x59076b[_0xf326('0x78')][_0xf326('0x7f')])){logger[_0xf326('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x59076b[_0xf326('0x38')],_0x59076b['value'][_0xf326('0x4d')](',')[0x0]);this['channels'][_0x59076b[_0xf326('0x38')]][_0xf326('0x10')]=_0x59076b[_0xf326('0x7b')][_0xf326('0x4d')](',')[0x0];}else if(this[_0xf326('0x34')](_0x59076b[_0xf326('0x78')][_0xf326('0x80')])){logger['info'](_0xf326('0x81'),_0x59076b[_0xf326('0x38')],_0x59076b[_0xf326('0x7b')]);this[_0xf326('0x19')][_0x59076b['uniqueid']][_0xf326('0x82')]=_0x59076b['value'];}else if(this[_0xf326('0x34')](_0x59076b[_0xf326('0x78')][_0xf326('0x83')])){logger[_0xf326('0x2f')](_0xf326('0x84'),_0x59076b['uniqueid'],_0x59076b[_0xf326('0x7b')]);this[_0xf326('0x19')][_0x59076b['uniqueid']][_0xf326('0x85')]=_0x59076b[_0xf326('0x7b')];}else if(this['isNotNull'](_0x59076b[_0xf326('0x78')][_0xf326('0x86')])){logger[_0xf326('0x2f')](_0xf326('0x87'),_0x59076b[_0xf326('0x38')],_0x59076b[_0xf326('0x7b')]);this[_0xf326('0x19')][_0x59076b[_0xf326('0x38')]]['calleridpreview']=_0x59076b[_0xf326('0x7b')];}else if(this[_0xf326('0x34')](_0x59076b['variable'][_0xf326('0x88')])){logger[_0xf326('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x59076b['uniqueid'],_0x59076b[_0xf326('0x7b')]);this[_0xf326('0x19')][_0x59076b[_0xf326('0x38')]]['queue']=_0x59076b['value'];}else if(this[_0xf326('0x34')](_0x59076b[_0xf326('0x78')][_0xf326('0x89')])){logger[_0xf326('0x2f')](_0xf326('0x8a'),_0x59076b[_0xf326('0x38')],_0x59076b[_0xf326('0x7b')]);this[_0xf326('0x19')][_0x59076b[_0xf326('0x38')]]['sipcalluniqueid']=_0x59076b[_0xf326('0x7b')];}}}else if(this[_0xf326('0x34')](_0x59076b[_0xf326('0x78')][_0xf326('0x79')])){if(_0x59076b[_0xf326('0x7b')]){var _0x1da165=path[_0xf326('0x8b')](_0x59076b[_0xf326('0x7b')])[_0xf326('0x69')];logger[_0xf326('0x2f')](_0xf326('0x7a'),_0x1da165,_0x59076b[_0xf326('0x7b')]);this[_0xf326('0x6c')](_0x1da165,_0x59076b[_0xf326('0x7b')]);}}else if(this[_0xf326('0x19')][_0x59076b[_0xf326('0x3d')]]){if(this['isNotNull'](_0x59076b['variable'])){if(this[_0xf326('0x34')](_0x59076b[_0xf326('0x78')][_0xf326('0x89')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x59076b[_0xf326('0x3d')],_0x59076b['value']);this[_0xf326('0x19')][_0x59076b[_0xf326('0x3d')]][_0xf326('0x8c')]=_0x59076b[_0xf326('0x7b')];}}}}}catch(_0x44fef3){logger[_0xf326('0x30')](_0xf326('0x8d'),_0x59076b[_0xf326('0x38')],util[_0xf326('0x32')](_0x44fef3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf326('0x33')][_0xf326('0x26')]=function(_0x5ab74f){try{if(this[_0xf326('0x34')](_0x5ab74f)){logger[_0xf326('0x3b')](_0xf326('0x8e'),_0x5ab74f[_0xf326('0x38')],util[_0xf326('0x32')](_0x5ab74f,{'showHidden':![],'depth':null}));if(this[_0xf326('0x19')][_0x5ab74f['uniqueid']]){logger[_0xf326('0x2f')](_0xf326('0x8f'),_0x5ab74f['uniqueid'],_0x5ab74f[_0xf326('0x90')]);var _0x297700=moment();this[_0xf326('0x19')][_0x5ab74f['uniqueid']][_0xf326('0x91')]=_0x297700[_0xf326('0x48')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xf326('0x19')][_0x5ab74f[_0xf326('0x38')]]['duration']=_0x297700[_0xf326('0x64')](this[_0xf326('0x19')][_0x5ab74f['uniqueid']][_0xf326('0x47')],'seconds');if(this[_0xf326('0x19')][_0x5ab74f[_0xf326('0x38')]][_0xf326('0x61')]){this[_0xf326('0x19')][_0x5ab74f[_0xf326('0x38')]][_0xf326('0x92')]=_0x297700[_0xf326('0x64')](this[_0xf326('0x19')][_0x5ab74f['uniqueid']]['answertime'],_0xf326('0x59'));this[_0xf326('0x19')][_0x5ab74f['uniqueid']][_0xf326('0x63')]=this[_0xf326('0x19')][_0x5ab74f[_0xf326('0x38')]][_0xf326('0x58')]-this[_0xf326('0x19')][_0x5ab74f[_0xf326('0x38')]][_0xf326('0x92')];}if(_0x5ab74f[_0xf326('0x45')]===_0xf326('0x93')){if(this[_0xf326('0x1a')][_0x5ab74f[_0xf326('0x43')]['split']('-')[0x0]]){this[_0xf326('0x1a')][_0x5ab74f[_0xf326('0x43')][_0xf326('0x4d')]('-')[0x0]]=_['omit'](this['agents'][_0x5ab74f[_0xf326('0x43')][_0xf326('0x4d')]('-')[0x0]],[_0xf326('0x94')]);logger['debug'](_0xf326('0x95'),_0x5ab74f[_0xf326('0x38')],util[_0xf326('0x32')]({'destaccountcode':this[_0xf326('0x1a')][_0x5ab74f['channel'][_0xf326('0x4d')]('-')[0x0]][_0xf326('0x50')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xf326('0x48')]('user:%s',this[_0xf326('0x1a')][_0x5ab74f[_0xf326('0x43')][_0xf326('0x4d')]('-')[0x0]][_0xf326('0x69')]),_0xf326('0x96'),{'destaccountcode':this[_0xf326('0x1a')][_0x5ab74f[_0xf326('0x43')]['split']('-')[0x0]][_0xf326('0x50')]});}}var _0x46f94d=this;Promise[_0xf326('0x97')]()[_0xf326('0x98')](function(){if(!_0x46f94d['settings'][_0xf326('0x99')])return;var _0x45a1ef=_0x46f94d['channels'][_0x5ab74f[_0xf326('0x38')]];if(typeof _0x45a1ef[_0xf326('0x9a')]===_0xf326('0x9b'))return;if(_['isEmpty'](_0x45a1ef['monitors']))return;return ami[_0xf326('0x9c')]({'action':_0xf326('0x9d'),'channel':_0x45a1ef[_0xf326('0x9e')]})[_0xf326('0x9f')](function(){})[_0xf326('0xa0')](function(){io[_0xf326('0x36')]('webbar:stopmonitors',{'agentId':_0x46f94d[_0xf326('0x1a')][_0x45a1ef[_0xf326('0x9e')][_0xf326('0x4d')]('-')[0x0]]['id'],'uniqueid':_0x45a1ef[_0xf326('0x38')]});});})[_0xf326('0x98')](function(){if(_0x5ab74f[_0xf326('0xa1')]===_0xf326('0xa2')){_0x46f94d[_0xf326('0x1c')][_0x5ab74f['uniqueid']]=_0x46f94d[_0xf326('0x19')][_0x5ab74f['uniqueid']];}else{if(_0x46f94d[_0xf326('0x19')][_0x5ab74f[_0xf326('0x38')]]['type']===_0xf326('0xa3')&&_0x46f94d[_0xf326('0x1c')][_0x5ab74f[_0xf326('0x38')]]){_0x46f94d['channels'][_0x5ab74f[_0xf326('0x38')]][_0xf326('0x38')]=[_0x46f94d[_0xf326('0x19')][_0x5ab74f[_0xf326('0x38')]][_0xf326('0x3d')],_0x46f94d[_0xf326('0x19')][_0x5ab74f['uniqueid']]['linkedid']=_0x46f94d['channels'][_0x5ab74f['uniqueid']]['uniqueid']][0x0];delete _0x46f94d[_0xf326('0x1c')][_0x5ab74f[_0xf326('0x38')]];}}logger[_0xf326('0x3b')](_0xf326('0xa4'),_0x5ab74f[_0xf326('0x38')],util[_0xf326('0x32')](_0x46f94d[_0xf326('0x19')][_0x5ab74f[_0xf326('0x38')]],{'showHidden':![],'depth':null}));ami[_0xf326('0x36')](_0xf326('0xa5'),_0x46f94d[_0xf326('0x19')][_0x5ab74f['uniqueid']]);delete _0x46f94d[_0xf326('0x19')][_0x5ab74f[_0xf326('0x38')]];});}}}catch(_0x1cf3c1){logger[_0xf326('0x30')](_0xf326('0xa6'),_0x5ab74f['uniqueid'],util['inspect'](_0x1cf3c1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf326('0x33')]['syncAttendedTransfer']=function(_0x50ec64){try{if(this[_0xf326('0x34')](_0x50ec64)){logger['info'](_0xf326('0xa7'),_0x50ec64[_0xf326('0x38')],_0x50ec64[_0xf326('0xa8')],_0x50ec64['transfertargetcalleridnum']);logger['debug'](_0xf326('0xa9'),_0x50ec64['uniqueid'],util[_0xf326('0x32')](_0x50ec64,{'showHidden':![],'depth':null}));if(this[_0xf326('0x19')][_0x50ec64[_0xf326('0xaa')]]){this[_0xf326('0x19')][_0x50ec64[_0xf326('0xaa')]][_0xf326('0xab')]=_0x50ec64[_0xf326('0xa8')];this['channels'][_0x50ec64[_0xf326('0xaa')]][_0xf326('0xac')]=_0x50ec64[_0xf326('0xad')];if(this[_0xf326('0x19')][_0x50ec64[_0xf326('0xae')]]){var _0x1df37b=this[_0xf326('0x19')][_0x50ec64['secondtransfereruniqueid']];this[_0xf326('0x19')][_0x50ec64[_0xf326('0xae')]]=this['channels'][_0x50ec64[_0xf326('0xaa')]];this['channels'][_0x50ec64['transfereeuniqueid']]=_0x1df37b;}}else if(this[_0xf326('0x19')][_0x50ec64[_0xf326('0xaf')]]){this['channels'][_0x50ec64['transfertargetuniqueid']][_0xf326('0xab')]=_0x50ec64[_0xf326('0xa8')];this[_0xf326('0x19')][_0x50ec64[_0xf326('0xaf')]]['transferconnectedlinenum']=_0x50ec64['transfertargetcalleridnum'];if(this['channels'][_0x50ec64['origtransfereruniqueid']]){var _0x1df37b=this[_0xf326('0x19')][_0x50ec64[_0xf326('0xb0')]];this['channels'][_0x50ec64[_0xf326('0xb0')]]=this[_0xf326('0x19')][_0x50ec64[_0xf326('0xaf')]];this[_0xf326('0x19')][_0x50ec64[_0xf326('0xaf')]]=_0x1df37b;}}if(this[_0xf326('0x19')][_0x50ec64[_0xf326('0xb0')]]&&this[_0xf326('0x19')][_0x50ec64[_0xf326('0xae')]]){var _0x113051=_[_0xf326('0xb1')]([this[_0xf326('0x19')][_0x50ec64[_0xf326('0xb0')]],this[_0xf326('0x19')][_0x50ec64[_0xf326('0xae')]]],function(_0x3e1b7f){return _0x3e1b7f[_0xf326('0x7e')]===_0xf326('0xa3')&&_0x3e1b7f[_0xf326('0xb2')];});if(_0x113051){if(this['channels'][_0x50ec64[_0xf326('0xb0')]][_0xf326('0x7e')]!==_0xf326('0xa3'))this['channels'][_0x50ec64['origtransfereruniqueid']][_0xf326('0x9a')]=_0xf326('0xb3');if(this[_0xf326('0x19')][_0x50ec64[_0xf326('0xae')]]['type']!==_0xf326('0xa3'))this[_0xf326('0x19')][_0x50ec64[_0xf326('0xae')]][_0xf326('0x9a')]=_0xf326('0xb3');}}}}catch(_0x3f1bcd){logger[_0xf326('0x30')]('[%s][voiceCallReport][attendedtransfer]',_0x50ec64['uniqueid'],util[_0xf326('0x32')](_0x3f1bcd,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncBlindTransfer']=function(_0x14785f){try{if(this[_0xf326('0x34')](_0x14785f)){logger['info'](_0xf326('0xb4'),_0x14785f[_0xf326('0x38')],_0x14785f[_0xf326('0xb5')],_0x14785f[_0xf326('0xb6')]);logger[_0xf326('0x3b')](_0xf326('0xb7'),_0x14785f[_0xf326('0x38')],util['inspect'](_0x14785f,{'showHidden':![],'depth':null}));if(this[_0xf326('0x19')][_0x14785f['transfereeuniqueid']]){this['channels'][_0x14785f[_0xf326('0xaa')]][_0xf326('0xab')]=_0x14785f[_0xf326('0xb5')];this[_0xf326('0x19')][_0x14785f[_0xf326('0xaa')]]['transferconnectedlinenum']=_0x14785f['extension'];this['channels'][_0x14785f[_0xf326('0xaa')]]['transferType']=_0xf326('0xb8');this[_0xf326('0x26')]({'event':'BlindTransfer','uniqueid':_0x14785f[_0xf326('0xaa')],'context':_0x14785f[_0xf326('0x45')],'channel':_0x14785f[_0xf326('0xb9')]});}else{this[_0xf326('0x19')][_0x14785f[_0xf326('0xba')]][_0xf326('0x9a')]='BLIND';}}}catch(_0x59f10d){logger[_0xf326('0x30')]('[%s][voiceCallReport][blindtransfer]',_0x14785f['uniqueid'],util[_0xf326('0x32')](_0x59f10d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf326('0x33')][_0xf326('0x2c')]=function(_0x2dd055){try{if(this[_0xf326('0x34')](_0x2dd055)){logger[_0xf326('0x3b')](_0xf326('0xbb'),_0x2dd055['uniqueid'],util['inspect'](_0x2dd055,{'showHidden':![],'depth':null}));if(this['channels'][_0x2dd055[_0xf326('0x38')]]){if(!_[_0xf326('0x74')](this['channels'][_0x2dd055[_0xf326('0x38')]][_0xf326('0x62')])){this[_0xf326('0x19')][_0x2dd055['uniqueid']]['mohstarttime']=moment()[_0xf326('0x48')](_0xf326('0x49'));logger['info']('[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s',_0x2dd055[_0xf326('0x38')],this['channels'][_0x2dd055[_0xf326('0x38')]][_0xf326('0xbc')]);}}}}catch(_0x2f7eb8){logger[_0xf326('0x30')](_0xf326('0xbd'),_0x2dd055[_0xf326('0x38')],util[_0xf326('0x32')](_0x2f7eb8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf326('0x33')]['syncMusicOnHoldStop']=function(_0xddab19){try{if(this[_0xf326('0x34')](_0xddab19)){logger[_0xf326('0x3b')](_0xf326('0xbe'),_0xddab19['uniqueid'],util[_0xf326('0x32')](_0xddab19,{'showHidden':![],'depth':null}));if(this[_0xf326('0x19')][_0xddab19['uniqueid']]){if(!_[_0xf326('0x74')](this[_0xf326('0x19')][_0xddab19['uniqueid']][_0xf326('0xbc')])){this['channels'][_0xddab19[_0xf326('0x38')]][_0xf326('0xbf')]+=moment()['milliseconds'](0x0)['diff'](this[_0xf326('0x19')][_0xddab19[_0xf326('0x38')]][_0xf326('0xbc')],_0xf326('0x59'));logger[_0xf326('0x2f')]('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0xddab19['uniqueid'],this[_0xf326('0x19')][_0xddab19[_0xf326('0x38')]]['mohtime']);delete this['channels'][_0xddab19[_0xf326('0x38')]]['mohstarttime'];}}}}catch(_0x43e5af){logger[_0xf326('0x30')](_0xf326('0xc0'),_0xddab19['uniqueid'],util[_0xf326('0x32')](_0x43e5af,{'showHidden':![],'depth':null}));}};module[_0xf326('0xc1')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index d6c9ea1..9a981ef 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa6c9=['[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','exports','lodash','util','ioredis','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','emit','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','lastIndexOf','substring','omit','event','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','value','variable','outboundrouteid','isUndefined','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','complete','total','holdtime','sumBillable','billableseconds','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','voice_outbound:save'];(function(_0x3f8d65,_0x10e95c){var _0x29031d=function(_0x4edad5){while(--_0x4edad5){_0x3f8d65['push'](_0x3f8d65['shift']());}};_0x29031d(++_0x10e95c);}(_0xa6c9,0x1b0));var _0x9a6c=function(_0x222502,_0x57f0b4){_0x222502=_0x222502-0x0;var _0x6bbafd=_0xa6c9[_0x222502];return _0x6bbafd;};'use strict';var _=require(_0x9a6c('0x0'));var moment=require('moment');var util=require(_0x9a6c('0x1'));var Redis=require(_0x9a6c('0x2'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('ami');var ami=require(_0x9a6c('0x3'));config[_0x9a6c('0x4')]=_[_0x9a6c('0x5')](config[_0x9a6c('0x4')],{'host':_0x9a6c('0x6'),'port':0x18eb});var io=require(_0x9a6c('0x7'))(new Redis(config[_0x9a6c('0x4')]));function VoiceDialReport(_0x4e68d3){this[_0x9a6c('0x8')]=_0x4e68d3[_0x9a6c('0x9')];this[_0x9a6c('0xa')]=_0x4e68d3['outbound'];this[_0x9a6c('0xb')]={};ami['on'](_0x9a6c('0xc'),this[_0x9a6c('0xd')][_0x9a6c('0xe')](this));ami['on'](_0x9a6c('0xf'),this[_0x9a6c('0x10')][_0x9a6c('0xe')](this));ami['on'](_0x9a6c('0x11'),this[_0x9a6c('0x12')][_0x9a6c('0xe')](this));ami['on'](_0x9a6c('0x13'),this[_0x9a6c('0x14')][_0x9a6c('0xe')](this));}VoiceDialReport[_0x9a6c('0x15')][_0x9a6c('0x16')]=function(_0x2dbafc){return _0x2dbafc!==null&&!_['isUndefined'](_0x2dbafc);};VoiceDialReport[_0x9a6c('0x15')][_0x9a6c('0x17')]=function(_0x4ff88b,_0x4e6434,_0x4886ee){io['to'](_0x4ff88b)[_0x9a6c('0x17')](_0x4e6434,_0x4886ee);};VoiceDialReport[_0x9a6c('0x15')]['syncDialBegin']=function(_0x4079b3){try{if(this[_0x9a6c('0x16')](_0x4079b3)){logger['debug']('[%s][voiceDialReport][dialbegin]\x20event:',_0x4079b3[_0x9a6c('0x18')],util['inspect'](_0x4079b3,{'showHidden':![],'depth':null}));if(this[_0x9a6c('0x8')][_0x4079b3['uniqueid']]){_[_0x9a6c('0x19')](this[_0x9a6c('0x8')][_0x4079b3[_0x9a6c('0x18')]],{'starttime':moment()[_0x9a6c('0x1a')](_0x9a6c('0x1b')),'lastevent':'called','interface':_0x4079b3['channel']['substring'](0x0,_0x4079b3[_0x9a6c('0x1c')][_0x9a6c('0x1d')]('-')),'membername':_0x4079b3[_0x9a6c('0x1c')][_0x9a6c('0x1e')](_0x4079b3[_0x9a6c('0x1c')][_0x9a6c('0x1d')]('/')+0x1,_0x4079b3['channel'][_0x9a6c('0x1d')]('-'))},_[_0x9a6c('0x1f')](_0x4079b3,[_0x9a6c('0x20'),'privilege']));logger[_0x9a6c('0x21')](_0x9a6c('0x22'),_0x4079b3['uniqueid'],this['channels'][_0x4079b3['uniqueid']]['membername'],this['channels'][_0x4079b3[_0x9a6c('0x18')]][_0x9a6c('0x23')]);logger[_0x9a6c('0x24')](_0x9a6c('0x25'),_0x4079b3[_0x9a6c('0x18')],util[_0x9a6c('0x26')](this[_0x9a6c('0x8')][_0x4079b3[_0x9a6c('0x18')]],{'showHidden':![],'depth':null}));this['emit'](_0x9a6c('0x27'),_0x9a6c('0x28'),this['channels'][_0x4079b3[_0x9a6c('0x18')]]);logger[_0x9a6c('0x24')](_0x9a6c('0x29'),_0x4079b3['uniqueid'],util[_0x9a6c('0x26')](this[_0x9a6c('0x8')][_0x4079b3[_0x9a6c('0x18')]],{'showHidden':![],'depth':null}));ami[_0x9a6c('0x17')](_0x9a6c('0x2a'),this[_0x9a6c('0x8')][_0x4079b3[_0x9a6c('0x18')]]);}}}catch(_0x3ee54d){logger[_0x9a6c('0x2b')](_0x9a6c('0x2c'),_0x4079b3[_0x9a6c('0x18')],util[_0x9a6c('0x26')](_0x3ee54d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9a6c('0x15')]['syncDialEnd']=function(_0x2cc9ed){try{if(this[_0x9a6c('0x16')](_0x2cc9ed)){logger[_0x9a6c('0x24')](_0x9a6c('0x2d'),_0x2cc9ed[_0x9a6c('0x18')],util[_0x9a6c('0x26')](_0x2cc9ed,{'showHidden':![],'depth':null}));if(this['channels'][_0x2cc9ed['uniqueid']]){this[_0x9a6c('0x8')][_0x2cc9ed[_0x9a6c('0x18')]][_0x9a6c('0x2e')]=_0x2cc9ed[_0x9a6c('0x2e')];if(_0x2cc9ed['dialstatus']===_0x9a6c('0x2f')){this[_0x9a6c('0x8')][_0x2cc9ed[_0x9a6c('0x18')]]['connectedlinenum']=_0x2cc9ed['connectedlinenum'];this[_0x9a6c('0x8')][_0x2cc9ed[_0x9a6c('0x18')]]['connectedlinename']=_0x2cc9ed['connectedlinename'];this['channels'][_0x2cc9ed[_0x9a6c('0x18')]][_0x9a6c('0x30')]=moment()[_0x9a6c('0x1a')](_0x9a6c('0x1b'));this['channels'][_0x2cc9ed[_0x9a6c('0x18')]][_0x9a6c('0x31')]=_0x9a6c('0x32');logger[_0x9a6c('0x21')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x2cc9ed['uniqueid'],_0x2cc9ed[_0x9a6c('0x1c')]['substring'](_0x2cc9ed[_0x9a6c('0x1c')][_0x9a6c('0x1d')]('/')+0x1,_0x2cc9ed[_0x9a6c('0x1c')][_0x9a6c('0x1d')]('-')));logger[_0x9a6c('0x24')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x2cc9ed['uniqueid'],util[_0x9a6c('0x26')](this[_0x9a6c('0x8')][_0x2cc9ed[_0x9a6c('0x18')]],{'showHidden':![],'depth':null}));ami['emit']('custom:dialconnect',this[_0x9a6c('0x8')][_0x2cc9ed[_0x9a6c('0x18')]]);}logger[_0x9a6c('0x24')](_0x9a6c('0x33'),_0x2cc9ed['uniqueid'],util[_0x9a6c('0x26')](this['channels'][_0x2cc9ed[_0x9a6c('0x18')]],{'showHidden':![],'depth':null}));this[_0x9a6c('0x17')](_0x9a6c('0x27'),_0x9a6c('0x28'),this[_0x9a6c('0x8')][_0x2cc9ed[_0x9a6c('0x18')]]);}}}catch(_0x345557){logger['error'](_0x9a6c('0x34'),_0x2cc9ed[_0x9a6c('0x18')],util[_0x9a6c('0x26')](_0x345557,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9a6c('0x15')][_0x9a6c('0x12')]=function(_0x425894){try{if(this['isNotNull'](_0x425894)){logger['debug'](_0x9a6c('0x35'),_0x425894['uniqueid'],util[_0x9a6c('0x26')](_0x425894,{'showHidden':![],'depth':null}));this['addVariable'](_0x425894[_0x9a6c('0x18')],_['keys'](_0x425894['variable'])[0x0],_0x425894[_0x9a6c('0x36')]);if(this[_0x9a6c('0x16')](_0x425894[_0x9a6c('0x37')])&&this[_0x9a6c('0x16')](_0x425894[_0x9a6c('0x37')][_0x9a6c('0x38')])){if(_[_0x9a6c('0x39')](this[_0x9a6c('0x8')][_0x425894['uniqueid']])){this[_0x9a6c('0x8')][_0x425894[_0x9a6c('0x18')]]={'routeId':_0x425894[_0x9a6c('0x36')],'variables':this[_0x9a6c('0xb')][_0x425894['uniqueid']]};logger['info'](_0x9a6c('0x3a'),_0x425894[_0x9a6c('0x18')],_0x425894[_0x9a6c('0x37')][_0x9a6c('0x38')],_['keys'](_0x425894[_0x9a6c('0x37')])[0x0],_0x425894[_0x9a6c('0x36')]);logger[_0x9a6c('0x24')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x425894[_0x9a6c('0x18')],util[_0x9a6c('0x26')](this['channels'][_0x425894[_0x9a6c('0x18')]],{'showHidden':![],'depth':null}));this[_0x9a6c('0x17')](_0x9a6c('0x27'),_0x9a6c('0x28'),this['channels'][_0x425894[_0x9a6c('0x18')]]);}}}}catch(_0x168c41){logger[_0x9a6c('0x2b')](_0x9a6c('0x3b'),_0x425894[_0x9a6c('0x18')],util[_0x9a6c('0x26')](_0x168c41,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x9a6c('0x15')][_0x9a6c('0x3c')]=function(_0x363b7a,_0x398976,_0x4a9adf){var _0x2770c5=[_0x9a6c('0x3d'),_0x9a6c('0x3e'),_0x9a6c('0x3f'),_0x9a6c('0x40'),_0x9a6c('0x41'),_0x9a6c('0x42'),_0x9a6c('0x43'),_0x9a6c('0x44'),_0x9a6c('0x45'),_0x9a6c('0x46'),_0x9a6c('0x47'),_0x9a6c('0x48'),_0x9a6c('0x49'),_0x9a6c('0x4a'),_0x9a6c('0x4b'),_0x9a6c('0x4c'),_0x9a6c('0x4d'),'memberpenalty',_0x9a6c('0x4e')];if(!_[_0x9a6c('0x4f')](_0x398976)&&!_[_0x9a6c('0x50')](_0x2770c5,_0x398976)){if(_['isUndefined'](this[_0x9a6c('0xb')][_0x363b7a])){this[_0x9a6c('0xb')][_0x363b7a]={};}this[_0x9a6c('0xb')][_0x363b7a][_0x398976]=_0x4a9adf;}};VoiceDialReport[_0x9a6c('0x15')][_0x9a6c('0x14')]=function(_0x110a11){try{if(this[_0x9a6c('0x16')](_0x110a11)){logger[_0x9a6c('0x24')](_0x9a6c('0x51'),_0x110a11[_0x9a6c('0x18')],util[_0x9a6c('0x26')](_0x110a11,{'showHidden':![],'depth':null}));if(this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]]){logger[_0x9a6c('0x21')](_0x9a6c('0x52'),_0x110a11[_0x9a6c('0x18')],_0x110a11[_0x9a6c('0x53')]);this[_0x9a6c('0x8')][_0x110a11['uniqueid']][_0x9a6c('0x54')]=moment()[_0x9a6c('0x1a')](_0x9a6c('0x1b'));this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]][_0x9a6c('0x55')]=moment(this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]]['endtime'])[_0x9a6c('0x56')](this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]][_0x9a6c('0x57')],_0x9a6c('0x58'));this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]][_0x9a6c('0x31')]=_0x9a6c('0x59');this[_0x9a6c('0xa')][_0x9a6c('0x5a')]+=0x1;if(this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]][_0x9a6c('0x30')]){this['outbound']['answered']+=0x1;this['channels'][_0x110a11[_0x9a6c('0x18')]][_0x9a6c('0x5b')]=moment(this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]][_0x9a6c('0x30')])[_0x9a6c('0x56')](this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]][_0x9a6c('0x57')],_0x9a6c('0x58'));this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]]['billableseconds']=moment(this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]]['endtime'])[_0x9a6c('0x56')](this['channels'][_0x110a11['uniqueid']][_0x9a6c('0x30')],_0x9a6c('0x58'));this['outbound']['sumHoldTime']+=this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]][_0x9a6c('0x5b')]||0x0;this['outbound'][_0x9a6c('0x5c')]+=this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]][_0x9a6c('0x5d')];}this[_0x9a6c('0xa')]['sumDuration']+=this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]][_0x9a6c('0x55')];logger[_0x9a6c('0x24')](_0x9a6c('0x5e'),_0x110a11[_0x9a6c('0x18')],util[_0x9a6c('0x26')](this['channels'][_0x110a11['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x9a6c('0x17')](_0x9a6c('0x5f'),this['channels'][_0x110a11['uniqueid']]);logger[_0x9a6c('0x24')](_0x9a6c('0x60'),_0x110a11[_0x9a6c('0x18')],util[_0x9a6c('0x26')](this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]],{'showHidden':![],'depth':null}));ami[_0x9a6c('0x17')]('custom:dialend',this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]]);logger[_0x9a6c('0x24')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x110a11[_0x9a6c('0x18')],util[_0x9a6c('0x26')](this['channels'][_0x110a11['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0x9a6c('0x27'),_0x9a6c('0x61'),this[_0x9a6c('0xa')]);logger[_0x9a6c('0x21')](_0x9a6c('0x62'),JSON[_0x9a6c('0x63')](this[_0x9a6c('0x8')][_0x110a11['uniqueid']]));logger['debug'](_0x9a6c('0x64'),_0x110a11[_0x9a6c('0x18')],util[_0x9a6c('0x26')](this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]],{'showHidden':![],'depth':null}));this['emit'](_0x9a6c('0x27'),_0x9a6c('0x65'),this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]]);delete this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x18')]];}else if(this['channels'][_0x110a11[_0x9a6c('0x66')]]){this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x66')]]['uniqueid']=this[_0x9a6c('0x8')][_0x110a11[_0x9a6c('0x66')]][_0x9a6c('0x67')];}if(this[_0x9a6c('0xb')][_0x110a11[_0x9a6c('0x18')]]){delete this[_0x9a6c('0xb')][_0x110a11[_0x9a6c('0x18')]];}}}catch(_0x36a15a){logger[_0x9a6c('0x2b')](_0x9a6c('0x68'),_0x110a11[_0x9a6c('0x18')],util[_0x9a6c('0x26')](_0x36a15a,{'showHidden':![],'depth':null}));}};module[_0x9a6c('0x69')]=VoiceDialReport; \ No newline at end of file +var _0x3c36=['connectedlinename','answertime','format','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','value','variable','outboundrouteid','isUndefined','variables','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','membername','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','duration','endtime','diff','starttime','seconds','outbound','total','answered','holdtime','billableseconds','sumHoldTime','sumBillable','sumDuration','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','stringify','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','defaults','localhost','socket.io-emitter','redis','channels','outboundChannels','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','syncHangup','isNotNull','prototype','emit','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','YYYY-MM-DD\x20HH:mm:ss','called','substring','channel','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','debug','voice:outbound','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x3c36,0x10c));var _0x63c3=function(_0x6f30c1,_0x5a391d){_0x6f30c1=_0x6f30c1-0x0;var _0x52c429=_0x3c36[_0x6f30c1];return _0x52c429;};'use strict';var _=require(_0x63c3('0x0'));var moment=require(_0x63c3('0x1'));var util=require(_0x63c3('0x2'));var Redis=require(_0x63c3('0x3'));var config=require(_0x63c3('0x4'));var logger=require(_0x63c3('0x5'))(_0x63c3('0x6'));var ami=require('../ami');config['redis']=_[_0x63c3('0x7')](config['redis'],{'host':_0x63c3('0x8'),'port':0x18eb});var io=require(_0x63c3('0x9'))(new Redis(config[_0x63c3('0xa')]));function VoiceDialReport(_0x423e17){this[_0x63c3('0xb')]=_0x423e17[_0x63c3('0xc')];this['outbound']=_0x423e17['outbound'];this['variables']={};ami['on'](_0x63c3('0xd'),this[_0x63c3('0xe')][_0x63c3('0xf')](this));ami['on'](_0x63c3('0x10'),this[_0x63c3('0x11')][_0x63c3('0xf')](this));ami['on'](_0x63c3('0x12'),this[_0x63c3('0x13')]['bind'](this));ami['on']('hangup',this[_0x63c3('0x14')][_0x63c3('0xf')](this));}VoiceDialReport['prototype'][_0x63c3('0x15')]=function(_0x3f9c7a){return _0x3f9c7a!==null&&!_['isUndefined'](_0x3f9c7a);};VoiceDialReport[_0x63c3('0x16')][_0x63c3('0x17')]=function(_0x2c9e25,_0x18ebb9,_0x5f1b87){io['to'](_0x2c9e25)[_0x63c3('0x17')](_0x18ebb9,_0x5f1b87);};VoiceDialReport[_0x63c3('0x16')][_0x63c3('0xe')]=function(_0x1d23ea){try{if(this[_0x63c3('0x15')](_0x1d23ea)){logger['debug'](_0x63c3('0x18'),_0x1d23ea[_0x63c3('0x19')],util[_0x63c3('0x1a')](_0x1d23ea,{'showHidden':![],'depth':null}));if(this['channels'][_0x1d23ea[_0x63c3('0x19')]]){_['merge'](this[_0x63c3('0xb')][_0x1d23ea['uniqueid']],{'starttime':moment()['format'](_0x63c3('0x1b')),'lastevent':_0x63c3('0x1c'),'interface':_0x1d23ea['channel'][_0x63c3('0x1d')](0x0,_0x1d23ea[_0x63c3('0x1e')][_0x63c3('0x1f')]('-')),'membername':_0x1d23ea[_0x63c3('0x1e')][_0x63c3('0x1d')](_0x1d23ea[_0x63c3('0x1e')]['lastIndexOf']('/')+0x1,_0x1d23ea['channel'][_0x63c3('0x1f')]('-'))},_[_0x63c3('0x20')](_0x1d23ea,[_0x63c3('0x21'),_0x63c3('0x22')]));logger[_0x63c3('0x23')](_0x63c3('0x24'),_0x1d23ea[_0x63c3('0x19')],this[_0x63c3('0xb')][_0x1d23ea[_0x63c3('0x19')]]['membername'],this['channels'][_0x1d23ea[_0x63c3('0x19')]][_0x63c3('0x25')]);logger[_0x63c3('0x26')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x1d23ea[_0x63c3('0x19')],util[_0x63c3('0x1a')](this[_0x63c3('0xb')][_0x1d23ea[_0x63c3('0x19')]],{'showHidden':![],'depth':null}));this[_0x63c3('0x17')](_0x63c3('0x27'),'voice_outbound_channel:save',this[_0x63c3('0xb')][_0x1d23ea[_0x63c3('0x19')]]);logger[_0x63c3('0x26')](_0x63c3('0x28'),_0x1d23ea[_0x63c3('0x19')],util[_0x63c3('0x1a')](this['channels'][_0x1d23ea[_0x63c3('0x19')]],{'showHidden':![],'depth':null}));ami[_0x63c3('0x17')](_0x63c3('0x29'),this[_0x63c3('0xb')][_0x1d23ea['uniqueid']]);}}}catch(_0x1d7063){logger[_0x63c3('0x2a')]('[%s][voiceDialReport][dialbegin]',_0x1d23ea['uniqueid'],util[_0x63c3('0x1a')](_0x1d7063,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x63c3('0x16')][_0x63c3('0x11')]=function(_0x5997cc){try{if(this[_0x63c3('0x15')](_0x5997cc)){logger[_0x63c3('0x26')](_0x63c3('0x2b'),_0x5997cc[_0x63c3('0x19')],util[_0x63c3('0x1a')](_0x5997cc,{'showHidden':![],'depth':null}));if(this[_0x63c3('0xb')][_0x5997cc['uniqueid']]){this[_0x63c3('0xb')][_0x5997cc['uniqueid']]['dialstatus']=_0x5997cc['dialstatus'];if(_0x5997cc[_0x63c3('0x2c')]===_0x63c3('0x2d')){this[_0x63c3('0xb')][_0x5997cc['uniqueid']][_0x63c3('0x2e')]=_0x5997cc[_0x63c3('0x2e')];this[_0x63c3('0xb')][_0x5997cc['uniqueid']][_0x63c3('0x2f')]=_0x5997cc[_0x63c3('0x2f')];this[_0x63c3('0xb')][_0x5997cc[_0x63c3('0x19')]][_0x63c3('0x30')]=moment()[_0x63c3('0x31')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5997cc['uniqueid']]['lastevent']=_0x63c3('0x32');logger[_0x63c3('0x23')](_0x63c3('0x33'),_0x5997cc[_0x63c3('0x19')],_0x5997cc[_0x63c3('0x1e')][_0x63c3('0x1d')](_0x5997cc[_0x63c3('0x1e')][_0x63c3('0x1f')]('/')+0x1,_0x5997cc[_0x63c3('0x1e')]['lastIndexOf']('-')));logger[_0x63c3('0x26')](_0x63c3('0x34'),_0x5997cc[_0x63c3('0x19')],util[_0x63c3('0x1a')](this[_0x63c3('0xb')][_0x5997cc[_0x63c3('0x19')]],{'showHidden':![],'depth':null}));ami[_0x63c3('0x17')](_0x63c3('0x35'),this['channels'][_0x5997cc[_0x63c3('0x19')]]);}logger['debug'](_0x63c3('0x36'),_0x5997cc['uniqueid'],util[_0x63c3('0x1a')](this['channels'][_0x5997cc[_0x63c3('0x19')]],{'showHidden':![],'depth':null}));this[_0x63c3('0x17')](_0x63c3('0x27'),_0x63c3('0x37'),this[_0x63c3('0xb')][_0x5997cc[_0x63c3('0x19')]]);}}}catch(_0x14a46a){logger[_0x63c3('0x2a')](_0x63c3('0x38'),_0x5997cc[_0x63c3('0x19')],util['inspect'](_0x14a46a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x63c3('0x16')]['syncVarSet']=function(_0x11f5a7){try{if(this[_0x63c3('0x15')](_0x11f5a7)){logger[_0x63c3('0x26')](_0x63c3('0x39'),_0x11f5a7['uniqueid'],util[_0x63c3('0x1a')](_0x11f5a7,{'showHidden':![],'depth':null}));this[_0x63c3('0x3a')](_0x11f5a7[_0x63c3('0x19')],_[_0x63c3('0x3b')](_0x11f5a7['variable'])[0x0],_0x11f5a7[_0x63c3('0x3c')]);if(this[_0x63c3('0x15')](_0x11f5a7[_0x63c3('0x3d')])&&this[_0x63c3('0x15')](_0x11f5a7[_0x63c3('0x3d')][_0x63c3('0x3e')])){if(_[_0x63c3('0x3f')](this[_0x63c3('0xb')][_0x11f5a7[_0x63c3('0x19')]])){this[_0x63c3('0xb')][_0x11f5a7[_0x63c3('0x19')]]={'routeId':_0x11f5a7['value'],'variables':this[_0x63c3('0x40')][_0x11f5a7[_0x63c3('0x19')]]};logger[_0x63c3('0x23')](_0x63c3('0x41'),_0x11f5a7[_0x63c3('0x19')],_0x11f5a7[_0x63c3('0x3d')][_0x63c3('0x3e')],_[_0x63c3('0x3b')](_0x11f5a7['variable'])[0x0],_0x11f5a7[_0x63c3('0x3c')]);logger[_0x63c3('0x26')](_0x63c3('0x42'),_0x11f5a7[_0x63c3('0x19')],util['inspect'](this['channels'][_0x11f5a7['uniqueid']],{'showHidden':![],'depth':null}));this[_0x63c3('0x17')](_0x63c3('0x27'),_0x63c3('0x37'),this['channels'][_0x11f5a7[_0x63c3('0x19')]]);}}}}catch(_0x44cc07){logger['error'](_0x63c3('0x43'),_0x11f5a7['uniqueid'],util[_0x63c3('0x1a')](_0x44cc07,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x63c3('0x16')][_0x63c3('0x3a')]=function(_0x567b19,_0x257099,_0x12aaef){var _0x24564f=[_0x63c3('0x44'),_0x63c3('0x45'),_0x63c3('0x46'),'rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid',_0x63c3('0x47'),_0x63c3('0x48'),_0x63c3('0x49'),_0x63c3('0x4a'),_0x63c3('0x4b'),_0x63c3('0x4c'),'memberlastcall',_0x63c3('0x4d'),_0x63c3('0x4e'),_0x63c3('0x4f')];if(!_[_0x63c3('0x50')](_0x257099)&&!_[_0x63c3('0x51')](_0x24564f,_0x257099)){if(_['isUndefined'](this['variables'][_0x567b19])){this[_0x63c3('0x40')][_0x567b19]={};}this['variables'][_0x567b19][_0x257099]=_0x12aaef;}};VoiceDialReport[_0x63c3('0x16')][_0x63c3('0x14')]=function(_0x4a19ea){try{if(this[_0x63c3('0x15')](_0x4a19ea)){logger['debug']('[%s][voiceDialReport][hangup]\x20event:',_0x4a19ea[_0x63c3('0x19')],util[_0x63c3('0x1a')](_0x4a19ea,{'showHidden':![],'depth':null}));if(this['channels'][_0x4a19ea[_0x63c3('0x19')]]){logger[_0x63c3('0x23')](_0x63c3('0x52'),_0x4a19ea[_0x63c3('0x19')],_0x4a19ea[_0x63c3('0x53')]);this[_0x63c3('0xb')][_0x4a19ea[_0x63c3('0x19')]]['endtime']=moment()[_0x63c3('0x31')](_0x63c3('0x1b'));this['channels'][_0x4a19ea[_0x63c3('0x19')]][_0x63c3('0x54')]=moment(this['channels'][_0x4a19ea[_0x63c3('0x19')]][_0x63c3('0x55')])[_0x63c3('0x56')](this[_0x63c3('0xb')][_0x4a19ea[_0x63c3('0x19')]][_0x63c3('0x57')],_0x63c3('0x58'));this[_0x63c3('0xb')][_0x4a19ea[_0x63c3('0x19')]]['lastevent']='complete';this[_0x63c3('0x59')][_0x63c3('0x5a')]+=0x1;if(this[_0x63c3('0xb')][_0x4a19ea[_0x63c3('0x19')]][_0x63c3('0x30')]){this['outbound'][_0x63c3('0x5b')]+=0x1;this[_0x63c3('0xb')][_0x4a19ea[_0x63c3('0x19')]][_0x63c3('0x5c')]=moment(this['channels'][_0x4a19ea[_0x63c3('0x19')]][_0x63c3('0x30')])['diff'](this[_0x63c3('0xb')][_0x4a19ea['uniqueid']][_0x63c3('0x57')],_0x63c3('0x58'));this[_0x63c3('0xb')][_0x4a19ea['uniqueid']][_0x63c3('0x5d')]=moment(this['channels'][_0x4a19ea[_0x63c3('0x19')]][_0x63c3('0x55')])[_0x63c3('0x56')](this[_0x63c3('0xb')][_0x4a19ea[_0x63c3('0x19')]][_0x63c3('0x30')],_0x63c3('0x58'));this[_0x63c3('0x59')][_0x63c3('0x5e')]+=this[_0x63c3('0xb')][_0x4a19ea[_0x63c3('0x19')]][_0x63c3('0x5c')]||0x0;this[_0x63c3('0x59')][_0x63c3('0x5f')]+=this[_0x63c3('0xb')][_0x4a19ea[_0x63c3('0x19')]]['billableseconds'];}this['outbound'][_0x63c3('0x60')]+=this[_0x63c3('0xb')][_0x4a19ea['uniqueid']][_0x63c3('0x54')];logger[_0x63c3('0x26')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x4a19ea[_0x63c3('0x19')],util[_0x63c3('0x1a')](this[_0x63c3('0xb')][_0x4a19ea[_0x63c3('0x19')]],{'showHidden':![],'depth':null}));ami[_0x63c3('0x17')](_0x63c3('0x61'),this[_0x63c3('0xb')][_0x4a19ea[_0x63c3('0x19')]]);logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x4a19ea['uniqueid'],util[_0x63c3('0x1a')](this[_0x63c3('0xb')][_0x4a19ea['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x63c3('0x17')](_0x63c3('0x62'),this['channels'][_0x4a19ea[_0x63c3('0x19')]]);logger['debug'](_0x63c3('0x63'),_0x4a19ea['uniqueid'],util[_0x63c3('0x1a')](this[_0x63c3('0xb')][_0x4a19ea[_0x63c3('0x19')]],{'showHidden':![],'depth':null}));this[_0x63c3('0x17')]('voice:outbound','voice_outbound:save',this['outbound']);logger[_0x63c3('0x23')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x63c3('0x64')](this[_0x63c3('0xb')][_0x4a19ea[_0x63c3('0x19')]]));logger[_0x63c3('0x26')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x4a19ea['uniqueid'],util[_0x63c3('0x1a')](this[_0x63c3('0xb')][_0x4a19ea['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0x63c3('0x27'),_0x63c3('0x65'),this[_0x63c3('0xb')][_0x4a19ea[_0x63c3('0x19')]]);delete this[_0x63c3('0xb')][_0x4a19ea[_0x63c3('0x19')]];}else if(this['channels'][_0x4a19ea[_0x63c3('0x66')]]){this['channels'][_0x4a19ea[_0x63c3('0x66')]][_0x63c3('0x19')]=this[_0x63c3('0xb')][_0x4a19ea[_0x63c3('0x66')]][_0x63c3('0x67')];}if(this[_0x63c3('0x40')][_0x4a19ea[_0x63c3('0x19')]]){delete this[_0x63c3('0x40')][_0x4a19ea[_0x63c3('0x19')]];}}}catch(_0x1e1acf){logger[_0x63c3('0x2a')](_0x63c3('0x68'),_0x4a19ea[_0x63c3('0x19')],util[_0x63c3('0x1a')](_0x1e1acf,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index b309da6..9d3e36c 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x97a2=['../../../config/logger','ami','../ami','../model/queueReport','defaults','redis','localhost','socket.io-emitter','prototype','tail','finally','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','bind','syncQueueCallerJoin','syncQueueCallerAbandon','syncQueueCallerLeave','agentcomplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','clearZombieChannels','sequence','isNil','Action','status','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','queueReports','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','debug','uniqueid','voice:queue:%s','name','emit','voice_queue_presence:save','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:remove\x20event:','voice_queue_channel:remove','type','inbound','answered','available','sumBillable','sumDuration','sumHoldTime','unmanaged','abandoned','Trunk','active','Interval','stringify','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','format','voice_queue:save','isNotNull','isUndefined','queues','[voiceQueueReport][queues]','queue','countBy','toNumber','callers','loggedIn','loggedin','emitVoiceQueueSummary','custom:queuesummary','[voiceQueueReport][queuesummary]','syncQueueSummaryComplete','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','pick','keys','last','queuecallercomplete','originalposition','queuecallerabandon','queuecallerexitreason','lastAssignedTo','info','[%s][voiceQueueReport][queuecallerabandon]','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleave','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','syncAgentComplete','[%s][voiceQueueReport][agentcomplete]','queuecallerabandonAt','membername','holdtime','queuecallerexit','queuecallerexitAt','transfer','reason','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','destexten','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberpenalty','memberrealtime','[%s][voiceQueueReport][hangup]','length','diff','milliseconds','total','queuecallercompleteAt','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerabandon','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','syncAttendedTransfer','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','transferexten','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transferuniqueid','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][blindtransfer]','BLIND','extension','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','mohtime','exports','lodash','util','md5','ioredis','../../../config/environment'];(function(_0xb3f390,_0x2c7ad7){var _0x59f302=function(_0x338a07){while(--_0x338a07){_0xb3f390['push'](_0xb3f390['shift']());}};_0x59f302(++_0x2c7ad7);}(_0x97a2,0x1b1));var _0x297a=function(_0x49cebd,_0x28fe36){_0x49cebd=_0x49cebd-0x0;var _0x2a7b27=_0x97a2[_0x49cebd];return _0x2a7b27;};'use strict';var _=require(_0x297a('0x0'));var moment=require('moment');var util=require(_0x297a('0x1'));var md5=require(_0x297a('0x2'));var Redis=require(_0x297a('0x3'));var config=require(_0x297a('0x4'));var logger=require(_0x297a('0x5'))(_0x297a('0x6'));var ami=require(_0x297a('0x7'));var QueueReport=require(_0x297a('0x8'));config['redis']=_[_0x297a('0x9')](config[_0x297a('0xa')],{'host':_0x297a('0xb'),'port':0x18eb});var io=require(_0x297a('0xc'))(new Redis(config[_0x297a('0xa')]));var Sequence=function(){};Sequence[_0x297a('0xd')]['enqueue']=function(_0x38b066){this[_0x297a('0xe')]=this[_0x297a('0xe')]?this[_0x297a('0xe')][_0x297a('0xf')](_0x38b066):_0x38b066();};function VoiceQueueReport(_0x2fcead){this['sequence']=new Sequence();this['queueReports']={};this['agents']=_0x2fcead[_0x297a('0x10')];this[_0x297a('0x11')]=_0x2fcead[_0x297a('0x12')];this[_0x297a('0x13')]=_0x2fcead['voiceQueues'];this[_0x297a('0x14')]=!![];this[_0x297a('0x15')]=_0x2fcead[_0x297a('0x15')];this[_0x297a('0x16')]={};ami['on'](_0x297a('0x17'),this[_0x297a('0x18')][_0x297a('0x19')](this));ami['on']('queuesummarycomplete',this['syncQueueSummaryComplete'][_0x297a('0x19')](this));ami['on']('queuecallerjoin',this[_0x297a('0x1a')][_0x297a('0x19')](this));ami['on']('queuecallerabandon',this[_0x297a('0x1b')][_0x297a('0x19')](this));ami['on']('queuecallerleave',this[_0x297a('0x1c')][_0x297a('0x19')](this));ami['on'](_0x297a('0x1d'),this['syncAgentComplete'][_0x297a('0x19')](this));ami['on'](_0x297a('0x1e'),this[_0x297a('0x1f')]['bind'](this));ami['on'](_0x297a('0x20'),this[_0x297a('0x21')]['bind'](this));ami['on'](_0x297a('0x22'),this[_0x297a('0x23')][_0x297a('0x19')](this));ami['on'](_0x297a('0x24'),this[_0x297a('0x25')][_0x297a('0x19')](this));ami['on'](_0x297a('0x26'),this[_0x297a('0x27')][_0x297a('0x19')](this));ami['on'](_0x297a('0x28'),this[_0x297a('0x29')][_0x297a('0x19')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0x297a('0x2a'),this[_0x297a('0x2b')]['bind'](this));this[_0x297a('0x2c')]();this[_0x297a('0x2d')]();}function clearChannels(_0x2de036){if(!_[_0x297a('0x2e')](_0x2de036)){for(var _0x519f3b in _0x2de036){if(_0x2de036[_0x297a('0x2f')](_0x519f3b)){delete _0x2de036[_0x519f3b];}}}}function clearCampaigns(_0x3267eb){if(!_[_0x297a('0x2e')](_0x3267eb)){for(var _0x4cc530 in _0x3267eb){if(_0x3267eb[_0x297a('0x2f')](_0x4cc530)){_0x3267eb[_0x4cc530][_0x297a('0x30')]=0x0;}}}}function clearVoiceQueues(_0xbe22aa){if(!_[_0x297a('0x2e')](_0xbe22aa)){for(var _0x1ece0b in _0xbe22aa){if(_0xbe22aa[_0x297a('0x2f')](_0x1ece0b)){_0xbe22aa[_0x1ece0b][_0x297a('0x30')]=0x0;_0xbe22aa[_0x1ece0b][_0x297a('0x31')]=0x0;_0xbe22aa[_0x1ece0b][_0x297a('0x32')]=0x0;_0xbe22aa[_0x1ece0b][_0x297a('0x33')]=0x0;_0xbe22aa[_0x1ece0b][_0x297a('0x34')]=!![];}}}}function clearAgentBooked(_0x57327a){if(!_[_0x297a('0x2e')](_0x57327a)){for(var _0x1204b4 in _0x57327a){if(_0x57327a[_0x297a('0x2f')](_0x1204b4)){_0x57327a[_0x1204b4]['unlockRR']=!![];}}}}VoiceQueueReport['prototype'][_0x297a('0x35')]=function(){var _0x204af9=this;for(var _0x40cc4d in this[_0x297a('0x11')]){if(this[_0x297a('0x11')][_0x297a('0x2f')](_0x40cc4d)&&!this['channels'][_0x40cc4d]['switch']){this[_0x297a('0x36')]['enqueue'](function(){if(!_[_0x297a('0x37')](_0x204af9[_0x297a('0x11')][_0x40cc4d])){return ami[_0x297a('0x38')]({'action':_0x297a('0x39'),'channel':_0x204af9[_0x297a('0x11')][_0x40cc4d]['channel']})[_0x297a('0x3a')](function(_0x2b3c19){if(_0x2b3c19[_0x297a('0x3b')]===_0x297a('0x3c')){setTimeout(function(){if(_0x204af9[_0x297a('0x11')][_0x40cc4d]){delete _0x204af9[_0x297a('0x11')][_0x40cc4d];logger[_0x297a('0x3d')](_0x297a('0x3e'),_0x40cc4d,util[_0x297a('0x3f')](_0x2b3c19,{'showHidden':![],'depth':null}));}if(_0x204af9['queueReports'][_0x40cc4d]){delete _0x204af9[_0x297a('0x40')][_0x40cc4d];logger['error'](_0x297a('0x41'),_0x40cc4d,util[_0x297a('0x3f')](_0x2b3c19,{'showHidden':![],'depth':null}));}if(_0x204af9[_0x297a('0x16')][_0x40cc4d]){delete _0x204af9[_0x297a('0x16')][_0x40cc4d];logger['error'](_0x297a('0x42'),_0x40cc4d,util['inspect'](_0x2b3c19,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x297a('0xd')][_0x297a('0x25')]=function(){logger['error'](_0x297a('0x43'));clearChannels(this[_0x297a('0x11')]);this[_0x297a('0x44')](this['queueReports']);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0x297a('0x13')]);clearCampaigns(this[_0x297a('0x15')]);};VoiceQueueReport[_0x297a('0xd')]['clearQueueReport']=function(_0x10da7e){var _0x40cbae=this;if(!_[_0x297a('0x2e')](_0x10da7e)){for(var _0x4770ff in _0x10da7e){if(_0x10da7e[_0x297a('0x2f')](_0x4770ff)){_0x40cbae[_0x297a('0x45')](_0x10da7e[_0x4770ff],'clearqueuereport');delete _0x10da7e[_0x4770ff];}}}};VoiceQueueReport[_0x297a('0xd')]['emit']=function(_0x2c3eb2,_0x5f410a,_0x25c663){io['to'](_0x2c3eb2)['emit'](_0x5f410a,_0x25c663);};VoiceQueueReport[_0x297a('0xd')]['emitVoiceQueueChannelSave']=function(_0x2f3a87,_0x11c9a1){logger[_0x297a('0x46')]('[%s][voiceQueueReport]['+_0x11c9a1+']\x20sending\x20voice_queue_channel:save\x20event:',_0x2f3a87[_0x297a('0x47')],util['inspect'](_0x2f3a87,{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x297a('0x48'),_0x2f3a87[_0x297a('0x49')]),'voice_queue_channel:save',_0x2f3a87);io[_0x297a('0x4a')](_0x297a('0x4b'),_0x2f3a87);};VoiceQueueReport[_0x297a('0xd')]['emitVoiceQueueChannelRemove']=function(_0x411bf0,_0x17fbb){logger[_0x297a('0x46')](_0x297a('0x4c')+_0x17fbb+_0x297a('0x4d'),_0x411bf0['uniqueid'],util[_0x297a('0x3f')](_0x411bf0,{'showHidden':![],'depth':null}));this['emit'](util['format']('voice:queue:%s',_0x411bf0[_0x297a('0x49')]),_0x297a('0x4e'),_0x411bf0);io[_0x297a('0x4a')]('voice_queue_presence:remove',_0x411bf0);};VoiceQueueReport[_0x297a('0xd')]['emitVoiceQueueSummary']=function(_0x10e4fe,_0x35646b){if(_0x10e4fe[_0x297a('0x4f')]===_0x297a('0x50')){var _0x2cecb3={'id':_0x10e4fe['id'],'name':_0x10e4fe[_0x297a('0x49')],'strategy':_0x10e4fe['strategy'],'answered':_0x10e4fe[_0x297a('0x51')],'available':_0x10e4fe[_0x297a('0x52')],'loggedIn':_0x10e4fe['loggedIn'],'pTalking':_0x10e4fe[_0x297a('0x32')],'sumBillable':_0x10e4fe[_0x297a('0x53')],'sumDuration':_0x10e4fe[_0x297a('0x54')],'sumHoldTime':_0x10e4fe[_0x297a('0x55')]||0x0,'talking':_0x10e4fe[_0x297a('0x31')],'total':_0x10e4fe['total'],'type':_0x10e4fe[_0x297a('0x4f')],'unmanaged':_0x10e4fe[_0x297a('0x56')],'abandoned':_0x10e4fe[_0x297a('0x57')],'waiting':_0x10e4fe[_0x297a('0x33')]};if(_0x10e4fe[_0x297a('0x58')]){_0x2cecb3[_0x297a('0x58')]={'id':_0x10e4fe[_0x297a('0x58')]['id'],'name':_0x10e4fe[_0x297a('0x58')]['name'],'active':_0x10e4fe['Trunk'][_0x297a('0x59')],'callerid':_0x10e4fe[_0x297a('0x58')]['callerid']};}if(_0x10e4fe['Interval']){_0x2cecb3[_0x297a('0x5a')]={'id':_0x10e4fe[_0x297a('0x5a')]['id'],'name':_0x10e4fe[_0x297a('0x5a')][_0x297a('0x49')]};}var _0x4baed0=md5(JSON[_0x297a('0x5b')](_0x2cecb3));if(_0x10e4fe[_0x297a('0x2')]!==_0x4baed0){_0x10e4fe[_0x297a('0x2')]=_0x4baed0;logger[_0x297a('0x46')](_0x297a('0x5c')+_0x35646b+_0x297a('0x5d'),util[_0x297a('0x3f')](_0x2cecb3,{'showHidden':![],'depth':null}));this[_0x297a('0x4a')](util[_0x297a('0x5e')](_0x297a('0x48'),_0x2cecb3['name']),_0x297a('0x5f'),_0x2cecb3);}}};VoiceQueueReport[_0x297a('0xd')][_0x297a('0x60')]=function(_0x190934){return _0x190934!==null&&!_[_0x297a('0x61')](_0x190934);};VoiceQueueReport['prototype'][_0x297a('0x2d')]=function(){var _0x424c70=this;setInterval(function(){_0x424c70[_0x297a('0x35')]();ami[_0x297a('0x38')]({'action':_0x297a('0x62')})[_0x297a('0x3a')](function(_0x2d0eda){logger[_0x297a('0x3d')](_0x297a('0x63'),util['inspect'](_0x2d0eda,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x297a('0xd')][_0x297a('0x2c')]=function(){var _0x3c0d1e=this;setInterval(function(){if(_0x3c0d1e[_0x297a('0x14')]){return ami[_0x297a('0x38')]({'action':_0x297a('0x17')})['then'](function(_0x5f32f5){_0x3c0d1e[_0x297a('0x14')]=![];})[_0x297a('0x3a')](function(_0x2625de){logger[_0x297a('0x3d')]('[voiceQueueReport][queuesummary]',util['inspect'](_0x2625de,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x297a('0xd')][_0x297a('0x18')]=function(_0x149b75){try{if(this[_0x297a('0x60')](_0x149b75)&&this[_0x297a('0x60')](_0x149b75[_0x297a('0x64')])){logger[_0x297a('0x46')]('[voiceQueueReport][queuesummary]\x20event:',util['inspect'](_0x149b75,{'showHidden':![],'depth':null}));if(this[_0x297a('0x13')][_0x149b75['queue']]){logger['info']('[voiceQueueReport][queuesummary]\x20name:%s',_0x149b75[_0x297a('0x64')]);var _0x535270=_[_0x297a('0x65')](this[_0x297a('0x11')],_0x297a('0x64'))[_0x149b75['queue']]||0x0;var _0x4d3930=_0x535270-_0x149b75['callers'];if(this[_0x297a('0x13')][_0x149b75[_0x297a('0x64')]][_0x297a('0x33')]!==_[_0x297a('0x66')](_0x149b75[_0x297a('0x67')])||this['voiceQueues'][_0x149b75['queue']][_0x297a('0x68')]!==_[_0x297a('0x66')](_0x149b75['loggedin'])||this[_0x297a('0x13')][_0x149b75[_0x297a('0x64')]][_0x297a('0x52')]!==_[_0x297a('0x66')](_0x149b75[_0x297a('0x52')])||this[_0x297a('0x13')][_0x149b75['queue']]['talking']!==_0x4d3930){this[_0x297a('0x13')][_0x149b75[_0x297a('0x64')]]['waiting']=_[_0x297a('0x66')](_0x149b75[_0x297a('0x67')]);this['voiceQueues'][_0x149b75[_0x297a('0x64')]][_0x297a('0x68')]=_[_0x297a('0x66')](_0x149b75['loggedin']);this[_0x297a('0x13')][_0x149b75['queue']][_0x297a('0x52')]=_['toNumber'](_0x149b75['available']);this[_0x297a('0x13')][_0x149b75['queue']][_0x297a('0x31')]=_0x4d3930>0x0?_0x4d3930:0x0;this[_0x297a('0x13')][_0x149b75[_0x297a('0x64')]][_0x297a('0x31')]=this['voiceQueues'][_0x149b75[_0x297a('0x64')]][_0x297a('0x31')]>_[_0x297a('0x66')](_0x149b75['loggedin'])?_['toNumber'](_0x149b75[_0x297a('0x69')]):this['voiceQueues'][_0x149b75['queue']][_0x297a('0x31')];this[_0x297a('0x6a')](this[_0x297a('0x13')][_0x149b75[_0x297a('0x64')]],_0x297a('0x17'));}logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x297a('0x3f')](this[_0x297a('0x13')][_0x149b75[_0x297a('0x64')]],{'showHidden':![],'depth':null}));ami[_0x297a('0x4a')](_0x297a('0x6b'),this[_0x297a('0x13')][_0x149b75[_0x297a('0x64')]]);}}}catch(_0x5aa1f1){logger[_0x297a('0x3d')](_0x297a('0x6c'),util[_0x297a('0x3f')](_0x5aa1f1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x297a('0xd')][_0x297a('0x6d')]=function(_0x56af63){logger[_0x297a('0x46')](_0x297a('0x6e'),util[_0x297a('0x3f')](_0x56af63,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0x297a('0xd')][_0x297a('0x1a')]=function(_0x584c17){try{if(this[_0x297a('0x60')](_0x584c17)){logger[_0x297a('0x46')](_0x297a('0x6f'),_0x584c17[_0x297a('0x47')],util[_0x297a('0x3f')](_0x584c17,{'showHidden':![],'depth':null}));if(_[_0x297a('0x61')](this[_0x297a('0x40')][_0x584c17[_0x297a('0x47')]])){this['queueReports'][_0x584c17[_0x297a('0x47')]]=[];this[_0x297a('0x11')][_0x584c17['uniqueid']]={};}var _0x260cdc=new QueueReport();_0x260cdc['name']=_0x584c17[_0x297a('0x64')];_0x260cdc[_0x297a('0x4f')]=this[_0x297a('0x13')][_0x260cdc[_0x297a('0x49')]]&&this['voiceQueues'][_0x260cdc[_0x297a('0x49')]]['type']?this['voiceQueues'][_0x260cdc[_0x297a('0x49')]]['type']||_0x297a('0x50'):_0x297a('0x50');_0x260cdc['queue']=_0x584c17['queue'];_0x260cdc[_0x297a('0x70')]=moment()[_0x297a('0x5e')](_0x297a('0x71'));_0x260cdc[_0x297a('0x72')]=_0x584c17[_0x297a('0x72')];_0x260cdc[_0x297a('0x73')]=_0x584c17['count'];_0x260cdc[_0x297a('0x47')]=_0x584c17['uniqueid'];logger['info'](_0x297a('0x74'),_0x260cdc[_0x297a('0x49')],_0x260cdc[_0x297a('0x4f')]);_[_0x297a('0x75')](_0x260cdc,_[_0x297a('0x76')](_0x584c17,_[_0x297a('0x77')](_0x260cdc)));this[_0x297a('0x40')][_0x584c17[_0x297a('0x47')]]['push'](_0x260cdc);this[_0x297a('0x11')][_0x584c17[_0x297a('0x47')]]=_0x260cdc;this['emitVoiceQueueChannelSave'](_0x260cdc,'queuecallerjoin');}}catch(_0x5bb15b){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x584c17['uniqueid'],util[_0x297a('0x3f')](_0x5bb15b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x297a('0xd')][_0x297a('0x1b')]=function(_0x5ba0d8){try{if(this[_0x297a('0x60')](_0x5ba0d8)){logger[_0x297a('0x46')]('[%s][voiceQueueReport][queuecallerabandon]',_0x5ba0d8[_0x297a('0x47')],util['inspect'](_0x5ba0d8,{'showHidden':![],'depth':null}));if(this[_0x297a('0x40')][_0x5ba0d8[_0x297a('0x47')]]){var _0x5915f1=_[_0x297a('0x78')](this[_0x297a('0x40')][_0x5ba0d8['uniqueid']]);_0x5915f1[_0x297a('0x79')]=![];_0x5915f1['queuecallercompleteAt']=null;_0x5915f1['holdtime']=_0x5ba0d8['holdtime'];_0x5915f1[_0x297a('0x7a')]=_0x5ba0d8[_0x297a('0x7a')];_0x5915f1[_0x297a('0x7b')]=!![];_0x5915f1['queuecallerabandonAt']=moment()[_0x297a('0x5e')](_0x297a('0x71'));_0x5915f1[_0x297a('0x7c')]='ABANDONED';_0x5915f1[_0x297a('0x7d')]=null;logger[_0x297a('0x7e')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x5915f1['name'],_0x5915f1[_0x297a('0x4f')]);this[_0x297a('0x11')][_0x5ba0d8[_0x297a('0x47')]]=_0x5915f1;this[_0x297a('0x45')](_0x5915f1,'queuecallerabandon');}}}catch(_0x445f52){logger[_0x297a('0x3d')](_0x297a('0x7f'),_0x5ba0d8[_0x297a('0x47')],util[_0x297a('0x3f')](_0x445f52,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x297a('0xd')]['syncQueueCallerLeave']=function(_0x3ac2b9){try{if(this[_0x297a('0x60')](_0x3ac2b9)){logger['debug'](_0x297a('0x80'),_0x3ac2b9[_0x297a('0x47')],util[_0x297a('0x3f')](_0x3ac2b9,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3ac2b9[_0x297a('0x47')]]){var _0x1ec354=_[_0x297a('0x78')](this[_0x297a('0x40')][_0x3ac2b9[_0x297a('0x47')]]);_0x1ec354[_0x297a('0x81')]=moment()[_0x297a('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1ec354[_0x297a('0x82')]=_0x3ac2b9[_0x297a('0x82')];_0x1ec354['connectedlinename']=_0x3ac2b9[_0x297a('0x83')];logger[_0x297a('0x7e')](_0x297a('0x84'),_0x1ec354[_0x297a('0x49')],_0x1ec354[_0x297a('0x4f')],_0x3ac2b9[_0x297a('0x82')],_0x3ac2b9[_0x297a('0x83')]);this[_0x297a('0x11')][_0x3ac2b9[_0x297a('0x47')]]=_0x1ec354;this['emitVoiceQueueChannelSave'](_0x1ec354,_0x297a('0x85'));}}}catch(_0x1e83ed){logger['error'](_0x297a('0x80'),_0x3ac2b9[_0x297a('0x47')],util[_0x297a('0x3f')](_0x1e83ed,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x297a('0xd')]['syncAgentConnect']=function(_0x5c7c83){try{if(this[_0x297a('0x60')](_0x5c7c83)){logger[_0x297a('0x46')](_0x297a('0x86'),_0x5c7c83['uniqueid'],util['inspect'](_0x5c7c83,{'showHidden':![],'depth':null}));if(this[_0x297a('0x40')][_0x5c7c83[_0x297a('0x47')]]){var _0x4dcbe3=_[_0x297a('0x78')](this[_0x297a('0x40')][_0x5c7c83[_0x297a('0x47')]]);_0x4dcbe3[_0x297a('0x79')]=!![];_0x4dcbe3[_0x297a('0x7c')]=_0x297a('0x87');logger[_0x297a('0x7e')](_0x297a('0x88'),_0x4dcbe3[_0x297a('0x49')],_0x4dcbe3[_0x297a('0x4f')]);}}}catch(_0x44ca94){logger[_0x297a('0x3d')](_0x297a('0x86'),_0x5c7c83[_0x297a('0x47')],util[_0x297a('0x3f')](_0x44ca94,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x297a('0x89')]=function(_0x75cf07){try{if(this['isNotNull'](_0x75cf07)){logger[_0x297a('0x46')](_0x297a('0x8a'),_0x75cf07[_0x297a('0x47')],util[_0x297a('0x3f')](_0x75cf07,{'showHidden':![],'depth':null}));if(this[_0x297a('0x40')][_0x75cf07[_0x297a('0x47')]]){var _0x269901=_[_0x297a('0x78')](this[_0x297a('0x40')][_0x75cf07[_0x297a('0x47')]]);_0x269901[_0x297a('0x7b')]=![];_0x269901[_0x297a('0x8b')]=null;_0x269901['assigned']=!![];_0x269901[_0x297a('0x7d')]=_0x75cf07[_0x297a('0x8c')];_0x269901[_0x297a('0x8d')]=_0x75cf07[_0x297a('0x8d')];_0x269901[_0x297a('0x79')]=!![];_0x269901[_0x297a('0x8e')]=![];_0x269901[_0x297a('0x8f')]=null;if(!_0x269901[_0x297a('0x90')]){if(_0x75cf07[_0x297a('0x91')]==_0x297a('0x90')){_0x269901['queuecallerexitreason']='COMPLETED';logger[_0x297a('0x7e')](_0x297a('0x92'),_0x269901[_0x297a('0x49')],_0x269901[_0x297a('0x4f')]);}else{if(_[_0x297a('0x93')](_0x75cf07['channel'][_0x297a('0x94')](),_0x297a('0x95'))){if(this[_0x297a('0x40')][_0x75cf07[_0x297a('0x96')]]){var _0x1fae6b=_['last'](this['queueReports'][_0x75cf07[_0x297a('0x96')]]);_0x1fae6b[_0x297a('0x79')]=![];_0x1fae6b['queuecallerexit']=!![];_0x1fae6b[_0x297a('0x8f')]=moment(_0x269901[_0x297a('0x70')])[_0x297a('0x97')](_0x75cf07['holdtime'],_0x297a('0x98'))[_0x297a('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1fae6b[_0x297a('0x7c')]=_0x297a('0x99');_0x1fae6b['transfer']=!![];_0x1fae6b[_0x297a('0x9a')]=_0x297a('0x9b');_0x1fae6b['transferexten']=_0x75cf07[_0x297a('0x9c')];_0x1fae6b['transferuniqueid']=_0x75cf07[_0x297a('0x47')];logger[_0x297a('0x7e')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x1fae6b[_0x297a('0x49')],_0x1fae6b[_0x297a('0x4f')]);var _0x4dc2d0=this[_0x297a('0x40')][_0x75cf07[_0x297a('0x96')]];this[_0x297a('0x40')][_0x75cf07[_0x297a('0x96')]]=this[_0x297a('0x40')][_0x75cf07['uniqueid']];this[_0x297a('0x40')][_0x75cf07[_0x297a('0x47')]]=_0x4dc2d0;}}else{_0x269901[_0x297a('0x7c')]='COMPLETEDBY'+_0x75cf07[_0x297a('0x91')][_0x297a('0x9d')]();logger['info'](_0x297a('0x9e'),_0x269901['name'],_0x269901[_0x297a('0x4f')],_0x269901[_0x297a('0x7c')]);}}}this[_0x297a('0x11')][_0x75cf07[_0x297a('0x47')]]=_0x269901;this[_0x297a('0x45')](_0x269901,_0x297a('0x1d'));}}}catch(_0x24a40a){logger['error'](_0x297a('0x8a'),_0x75cf07[_0x297a('0x47')],util[_0x297a('0x3f')](_0x24a40a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x297a('0xd')]['syncVarSet']=function(_0x2296b0){try{if(this[_0x297a('0x60')](_0x2296b0)){logger[_0x297a('0x46')](_0x297a('0x9f'),_0x2296b0[_0x297a('0x47')],util[_0x297a('0x3f')](_0x2296b0,{'showHidden':![],'depth':null}));this[_0x297a('0xa0')](_0x2296b0[_0x297a('0x47')],_['keys'](_0x2296b0[_0x297a('0xa1')])[0x0],_0x2296b0[_0x297a('0xa2')]);if(this[_0x297a('0x40')][_0x2296b0[_0x297a('0x47')]]){var _0x366e1a=_['last'](this[_0x297a('0x40')][_0x2296b0[_0x297a('0x47')]]);if(_0x366e1a){if(this[_0x297a('0x60')](_0x2296b0[_0x297a('0xa1')])&&this[_0x297a('0x60')](_0x2296b0[_0x297a('0xa1')]['queuestatus'])){switch(_0x2296b0[_0x297a('0xa2')]){case _0x297a('0xa3'):_0x366e1a['queuecallerexit']=![];_0x366e1a[_0x297a('0x8f')]=null;break;case _0x297a('0xa4'):_0x366e1a[_0x297a('0xa5')]=_0x297a('0xa6');_0x366e1a[_0x297a('0x8e')]=!![];_0x366e1a['queuecallerexitAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x366e1a['queuecallerleaveAt']=moment()[_0x297a('0x5e')](_0x297a('0x71'));logger[_0x297a('0x46')](_0x297a('0xa7'),_0x2296b0[_0x297a('0x47')],util[_0x297a('0x3f')](_0x366e1a,{'showHidden':![],'depth':null}));ami[_0x297a('0x4a')]('custom:timeout',_0x366e1a);break;default:_0x366e1a[_0x297a('0x8e')]=!![];_0x366e1a[_0x297a('0x8f')]=moment()['format'](_0x297a('0x71'));_0x366e1a[_0x297a('0x81')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x366e1a['queuecallerabandon']=![];_0x366e1a['queuecallerabandonAt']=null;_0x366e1a[_0x297a('0x7c')]=_0x2296b0[_0x297a('0xa2')];this['channels'][_0x2296b0[_0x297a('0x47')]]=_0x366e1a;this['emitVoiceQueueChannelRemove'](_0x366e1a,_0x297a('0x20'));}else if(this['isNotNull'](_0x2296b0[_0x297a('0xa1')])&&this[_0x297a('0x60')](_0x2296b0[_0x297a('0xa1')][_0x297a('0xa8')])){if(!_0x366e1a[_0x297a('0x7b')]){_0x366e1a[_0x297a('0x8e')]=!![];_0x366e1a[_0x297a('0x8f')]=moment()[_0x297a('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x366e1a[_0x297a('0x7c')]=_0x297a('0xa9');_0x366e1a[_0x297a('0x81')]=moment()[_0x297a('0x5e')](_0x297a('0x71'));this[_0x297a('0x11')][_0x2296b0[_0x297a('0x47')]]=_0x366e1a;}}logger[_0x297a('0x7e')](_0x297a('0xaa'),_0x2296b0[_0x297a('0x47')],_0x366e1a[_0x297a('0x49')],_0x366e1a[_0x297a('0x4f')],_[_0x297a('0x77')](_0x2296b0[_0x297a('0xa1')])[0x0],_0x2296b0['value']);_0x366e1a[_0x297a('0x16')]=this[_0x297a('0x16')][_0x2296b0['uniqueid']];}}}}catch(_0x1093be){logger[_0x297a('0x3d')](_0x297a('0x9f'),_0x2296b0[_0x297a('0x47')],util[_0x297a('0x3f')](_0x1093be,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x297a('0xd')][_0x297a('0xa0')]=function(_0x13d639,_0x4083b7,_0x280545){var _0x472050=['rtpaudioqos',_0x297a('0xab'),_0x297a('0xac'),_0x297a('0xad'),_0x297a('0xae'),'rtpaudioqoslossbridged',_0x297a('0xaf'),_0x297a('0xb0'),_0x297a('0xb1'),'sipuri',_0x297a('0xb2'),_0x297a('0xb3'),_0x297a('0xb4'),'memberdynamic',_0x297a('0xb5'),'memberlastcall',_0x297a('0x8c'),_0x297a('0xb6'),_0x297a('0xb7')];if(!_[_0x297a('0x37')](_0x4083b7)&&!_['includes'](_0x472050,_0x4083b7)){if(_[_0x297a('0x61')](this[_0x297a('0x16')][_0x13d639])){this[_0x297a('0x16')][_0x13d639]={};}this[_0x297a('0x16')][_0x13d639][_0x4083b7]=_0x280545;}};VoiceQueueReport['prototype'][_0x297a('0x23')]=function(_0x4052a7){try{if(this[_0x297a('0x60')](_0x4052a7)){logger['debug'](_0x297a('0xb8'),_0x4052a7['uniqueid'],util[_0x297a('0x3f')](_0x4052a7,{'showHidden':![],'depth':null}));if(this[_0x297a('0x40')][_0x4052a7[_0x297a('0x47')]]){for(var _0x219f63=0x0,_0x531f8a={};_0x219f630x0?_0x1640df:0x0;this['voiceQueues'][_0x1fb661['queue']][_0x2571('0x30')]=this['voiceQueues'][_0x1fb661[_0x2571('0x67')]][_0x2571('0x30')]>_[_0x2571('0x6d')](_0x1fb661[_0x2571('0x6e')])?_[_0x2571('0x6d')](_0x1fb661[_0x2571('0x6e')]):this[_0x2571('0x14')][_0x1fb661[_0x2571('0x67')]][_0x2571('0x30')];this[_0x2571('0x6f')](this[_0x2571('0x14')][_0x1fb661[_0x2571('0x67')]],'queuesummary');}logger[_0x2571('0x45')](_0x2571('0x70'),util['inspect'](this[_0x2571('0x14')][_0x1fb661['queue']],{'showHidden':![],'depth':null}));ami[_0x2571('0x43')]('custom:queuesummary',this[_0x2571('0x14')][_0x1fb661[_0x2571('0x67')]]);}}}catch(_0x1cfc43){logger[_0x2571('0x3a')](_0x2571('0x71'),util[_0x2571('0x3b')](_0x1cfc43,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2571('0xc')][_0x2571('0x1b')]=function(_0x1af561){logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x2571('0x3b')](_0x1af561,{'showHidden':![],'depth':null}));this[_0x2571('0x66')]=!![];};VoiceQueueReport[_0x2571('0xc')]['syncQueueCallerJoin']=function(_0x24e306){try{if(this[_0x2571('0x60')](_0x24e306)){logger[_0x2571('0x45')]('[%s][voiceQueueReport][queuecallerjoin]',_0x24e306['uniqueid'],util[_0x2571('0x3b')](_0x24e306,{'showHidden':![],'depth':null}));if(_[_0x2571('0x72')](this[_0x2571('0x10')][_0x24e306[_0x2571('0x47')]])){this[_0x2571('0x10')][_0x24e306['uniqueid']]=[];this['channels'][_0x24e306[_0x2571('0x47')]]={};}var _0x45d33e=new QueueReport();_0x45d33e['name']=_0x24e306[_0x2571('0x67')];_0x45d33e[_0x2571('0x55')]=this[_0x2571('0x14')][_0x45d33e[_0x2571('0x49')]]&&this['voiceQueues'][_0x45d33e[_0x2571('0x49')]][_0x2571('0x55')]?this['voiceQueues'][_0x45d33e['name']]['type']||_0x2571('0x73'):'inbound';_0x45d33e['queue']=_0x24e306[_0x2571('0x67')];_0x45d33e[_0x2571('0x74')]=moment()[_0x2571('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x45d33e[_0x2571('0x75')]=_0x24e306[_0x2571('0x75')];_0x45d33e[_0x2571('0x76')]=_0x24e306[_0x2571('0x76')];_0x45d33e[_0x2571('0x47')]=_0x24e306[_0x2571('0x47')];logger[_0x2571('0x69')](_0x2571('0x77'),_0x45d33e['name'],_0x45d33e['type']);_[_0x2571('0x78')](_0x45d33e,_['pick'](_0x24e306,_['keys'](_0x45d33e)));this[_0x2571('0x10')][_0x24e306['uniqueid']][_0x2571('0x79')](_0x45d33e);this[_0x2571('0x12')][_0x24e306[_0x2571('0x47')]]=_0x45d33e;this['emitVoiceQueueChannelSave'](_0x45d33e,_0x2571('0x1c'));}}catch(_0x13427a){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x24e306['uniqueid'],util[_0x2571('0x3b')](_0x13427a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2571('0xc')][_0x2571('0x1e')]=function(_0x3a3821){try{if(this[_0x2571('0x60')](_0x3a3821)){logger[_0x2571('0x45')]('[%s][voiceQueueReport][queuecallerabandon]',_0x3a3821[_0x2571('0x47')],util[_0x2571('0x3b')](_0x3a3821,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3a3821[_0x2571('0x47')]]){var _0x3d2813=_[_0x2571('0x7a')](this[_0x2571('0x10')][_0x3a3821[_0x2571('0x47')]]);_0x3d2813['queuecallercomplete']=![];_0x3d2813[_0x2571('0x7b')]=null;_0x3d2813[_0x2571('0x7c')]=_0x3a3821['holdtime'];_0x3d2813['originalposition']=_0x3a3821[_0x2571('0x7d')];_0x3d2813[_0x2571('0x7e')]=!![];_0x3d2813[_0x2571('0x7f')]=moment()[_0x2571('0x4d')](_0x2571('0x80'));_0x3d2813[_0x2571('0x81')]=_0x2571('0x82');_0x3d2813['lastAssignedTo']=null;logger[_0x2571('0x69')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x3d2813[_0x2571('0x49')],_0x3d2813['type']);this[_0x2571('0x12')][_0x3a3821[_0x2571('0x47')]]=_0x3d2813;this[_0x2571('0x41')](_0x3d2813,_0x2571('0x7e'));}}}catch(_0x1fb866){logger[_0x2571('0x3a')](_0x2571('0x83'),_0x3a3821['uniqueid'],util[_0x2571('0x3b')](_0x1fb866,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2571('0xc')][_0x2571('0x84')]=function(_0x2a9884){try{if(this[_0x2571('0x60')](_0x2a9884)){logger[_0x2571('0x45')](_0x2571('0x85'),_0x2a9884['uniqueid'],util[_0x2571('0x3b')](_0x2a9884,{'showHidden':![],'depth':null}));if(this[_0x2571('0x10')][_0x2a9884[_0x2571('0x47')]]){var _0x2f8625=_[_0x2571('0x7a')](this[_0x2571('0x10')][_0x2a9884[_0x2571('0x47')]]);_0x2f8625['queuecallerleaveAt']=moment()[_0x2571('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x2f8625[_0x2571('0x86')]=_0x2a9884[_0x2571('0x86')];_0x2f8625[_0x2571('0x87')]=_0x2a9884[_0x2571('0x87')];logger[_0x2571('0x69')](_0x2571('0x88'),_0x2f8625[_0x2571('0x49')],_0x2f8625[_0x2571('0x55')],_0x2a9884[_0x2571('0x86')],_0x2a9884['connectedlinename']);this[_0x2571('0x12')][_0x2a9884[_0x2571('0x47')]]=_0x2f8625;this[_0x2571('0x44')](_0x2f8625,_0x2571('0x89'));}}}catch(_0x188392){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x2a9884['uniqueid'],util[_0x2571('0x3b')](_0x188392,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2571('0xc')]['syncAgentConnect']=function(_0x3509be){try{if(this['isNotNull'](_0x3509be)){logger[_0x2571('0x45')](_0x2571('0x8a'),_0x3509be[_0x2571('0x47')],util[_0x2571('0x3b')](_0x3509be,{'showHidden':![],'depth':null}));if(this[_0x2571('0x10')][_0x3509be[_0x2571('0x47')]]){var _0x226c08=_['last'](this[_0x2571('0x10')][_0x3509be['uniqueid']]);_0x226c08[_0x2571('0x8b')]=!![];_0x226c08[_0x2571('0x81')]=_0x2571('0x8c');logger['info'](_0x2571('0x8d'),_0x226c08['name'],_0x226c08[_0x2571('0x55')]);}}}catch(_0x5b90da){logger[_0x2571('0x3a')](_0x2571('0x8a'),_0x3509be[_0x2571('0x47')],util[_0x2571('0x3b')](_0x5b90da,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2571('0xc')]['syncAgentComplete']=function(_0x30bec3){try{if(this[_0x2571('0x60')](_0x30bec3)){logger[_0x2571('0x45')](_0x2571('0x8e'),_0x30bec3[_0x2571('0x47')],util[_0x2571('0x3b')](_0x30bec3,{'showHidden':![],'depth':null}));if(this[_0x2571('0x10')][_0x30bec3[_0x2571('0x47')]]){var _0x32f9a3=_[_0x2571('0x7a')](this[_0x2571('0x10')][_0x30bec3['uniqueid']]);_0x32f9a3['queuecallerabandon']=![];_0x32f9a3[_0x2571('0x7f')]=null;_0x32f9a3[_0x2571('0x8f')]=!![];_0x32f9a3[_0x2571('0x90')]=_0x30bec3[_0x2571('0x91')];_0x32f9a3[_0x2571('0x7c')]=_0x30bec3[_0x2571('0x7c')];_0x32f9a3[_0x2571('0x8b')]=!![];_0x32f9a3['queuecallerexit']=![];_0x32f9a3[_0x2571('0x92')]=null;if(!_0x32f9a3['transfer']){if(_0x30bec3['reason']==_0x2571('0x93')){_0x32f9a3[_0x2571('0x81')]='COMPLETED';logger[_0x2571('0x69')](_0x2571('0x94'),_0x32f9a3[_0x2571('0x49')],_0x32f9a3[_0x2571('0x55')]);}else{if(_[_0x2571('0x95')](_0x30bec3['channel'][_0x2571('0x96')](),'local/')){if(this[_0x2571('0x10')][_0x30bec3[_0x2571('0x97')]]){var _0x494c96=_[_0x2571('0x7a')](this['queueReports'][_0x30bec3[_0x2571('0x97')]]);_0x494c96[_0x2571('0x8b')]=![];_0x494c96[_0x2571('0x98')]=!![];_0x494c96[_0x2571('0x92')]=moment(_0x32f9a3[_0x2571('0x74')])[_0x2571('0x99')](_0x30bec3[_0x2571('0x7c')],_0x2571('0x9a'))[_0x2571('0x4d')](_0x2571('0x80'));_0x494c96[_0x2571('0x81')]=_0x2571('0x9b');_0x494c96[_0x2571('0x93')]=!![];_0x494c96[_0x2571('0x9c')]=_0x2571('0x9d');_0x494c96[_0x2571('0x9e')]=_0x30bec3[_0x2571('0x9f')];_0x494c96[_0x2571('0xa0')]=_0x30bec3[_0x2571('0x47')];logger[_0x2571('0x69')](_0x2571('0xa1'),_0x494c96[_0x2571('0x49')],_0x494c96[_0x2571('0x55')]);var _0x19abf9=this['queueReports'][_0x30bec3[_0x2571('0x97')]];this[_0x2571('0x10')][_0x30bec3[_0x2571('0x97')]]=this[_0x2571('0x10')][_0x30bec3['uniqueid']];this[_0x2571('0x10')][_0x30bec3[_0x2571('0x47')]]=_0x19abf9;}}else{_0x32f9a3[_0x2571('0x81')]='COMPLETEDBY'+_0x30bec3['reason'][_0x2571('0xa2')]();logger[_0x2571('0x69')](_0x2571('0xa3'),_0x32f9a3[_0x2571('0x49')],_0x32f9a3[_0x2571('0x55')],_0x32f9a3[_0x2571('0x81')]);}}}this[_0x2571('0x12')][_0x30bec3['uniqueid']]=_0x32f9a3;this[_0x2571('0x41')](_0x32f9a3,'agentcomplete');}}}catch(_0x47e970){logger['error'](_0x2571('0x8e'),_0x30bec3[_0x2571('0x47')],util[_0x2571('0x3b')](_0x47e970,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2571('0xc')][_0x2571('0xa4')]=function(_0x50b0b5){try{if(this['isNotNull'](_0x50b0b5)){logger[_0x2571('0x45')]('[%s][voiceQueueReport][varset]',_0x50b0b5[_0x2571('0x47')],util[_0x2571('0x3b')](_0x50b0b5,{'showHidden':![],'depth':null}));this['addVariable'](_0x50b0b5[_0x2571('0x47')],_[_0x2571('0xa5')](_0x50b0b5[_0x2571('0xa6')])[0x0],_0x50b0b5['value']);if(this[_0x2571('0x10')][_0x50b0b5[_0x2571('0x47')]]){var _0x3983d4=_[_0x2571('0x7a')](this[_0x2571('0x10')][_0x50b0b5[_0x2571('0x47')]]);if(_0x3983d4){if(this[_0x2571('0x60')](_0x50b0b5[_0x2571('0xa6')])&&this[_0x2571('0x60')](_0x50b0b5[_0x2571('0xa6')]['queuestatus'])){switch(_0x50b0b5[_0x2571('0xa7')]){case _0x2571('0xa8'):_0x3983d4[_0x2571('0x98')]=![];_0x3983d4[_0x2571('0x92')]=null;break;case'TIMEOUT':_0x3983d4[_0x2571('0xa9')]='timeout';_0x3983d4[_0x2571('0x98')]=!![];_0x3983d4[_0x2571('0x92')]=moment()[_0x2571('0x4d')](_0x2571('0x80'));_0x3983d4[_0x2571('0xaa')]=moment()[_0x2571('0x4d')](_0x2571('0x80'));logger['debug'](_0x2571('0xab'),_0x50b0b5['uniqueid'],util['inspect'](_0x3983d4,{'showHidden':![],'depth':null}));ami[_0x2571('0x43')]('custom:timeout',_0x3983d4);break;default:_0x3983d4[_0x2571('0x98')]=!![];_0x3983d4[_0x2571('0x92')]=moment()[_0x2571('0x4d')](_0x2571('0x80'));_0x3983d4[_0x2571('0xaa')]=moment()[_0x2571('0x4d')](_0x2571('0x80'));}_0x3983d4[_0x2571('0x7e')]=![];_0x3983d4['queuecallerabandonAt']=null;_0x3983d4[_0x2571('0x81')]=_0x50b0b5['value'];this[_0x2571('0x12')][_0x50b0b5['uniqueid']]=_0x3983d4;this[_0x2571('0x41')](_0x3983d4,_0x2571('0x22'));}else if(this[_0x2571('0x60')](_0x50b0b5[_0x2571('0xa6')])&&this['isNotNull'](_0x50b0b5[_0x2571('0xa6')]['queueposition'])){if(!_0x3983d4[_0x2571('0x7e')]){_0x3983d4['queuecallerexit']=!![];_0x3983d4['queuecallerexitAt']=moment()['format'](_0x2571('0x80'));_0x3983d4[_0x2571('0x81')]=_0x2571('0xac');_0x3983d4[_0x2571('0xaa')]=moment()[_0x2571('0x4d')](_0x2571('0x80'));this[_0x2571('0x12')][_0x50b0b5[_0x2571('0x47')]]=_0x3983d4;}}logger[_0x2571('0x69')](_0x2571('0xad'),_0x50b0b5[_0x2571('0x47')],_0x3983d4[_0x2571('0x49')],_0x3983d4[_0x2571('0x55')],_[_0x2571('0xa5')](_0x50b0b5['variable'])[0x0],_0x50b0b5[_0x2571('0xa7')]);_0x3983d4['variables']=this[_0x2571('0x16')][_0x50b0b5['uniqueid']];}}}}catch(_0x5b14f2){logger[_0x2571('0x3a')](_0x2571('0xae'),_0x50b0b5[_0x2571('0x47')],util[_0x2571('0x3b')](_0x5b14f2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x2571('0xc')][_0x2571('0xaf')]=function(_0x1649ce,_0x32f8af,_0x253b68){var _0x4991f8=[_0x2571('0xb0'),'rtpaudioqosbridged',_0x2571('0xb1'),'rtpaudioqosjitterbridged',_0x2571('0xb2'),_0x2571('0xb3'),_0x2571('0xb4'),'rtpaudioqosrttbridged',_0x2571('0xb5'),_0x2571('0xb6'),'bridgepeer',_0x2571('0xb7'),'membercalls','memberdynamic','memberinterface','memberlastcall',_0x2571('0x91'),'memberpenalty','memberrealtime'];if(!_[_0x2571('0x36')](_0x32f8af)&&!_[_0x2571('0xb8')](_0x4991f8,_0x32f8af)){if(_[_0x2571('0x72')](this[_0x2571('0x16')][_0x1649ce])){this[_0x2571('0x16')][_0x1649ce]={};}this[_0x2571('0x16')][_0x1649ce][_0x32f8af]=_0x253b68;}};VoiceQueueReport[_0x2571('0xc')][_0x2571('0x24')]=function(_0x27bc12){try{if(this[_0x2571('0x60')](_0x27bc12)){logger[_0x2571('0x45')](_0x2571('0xb9'),_0x27bc12[_0x2571('0x47')],util[_0x2571('0x3b')](_0x27bc12,{'showHidden':![],'depth':null}));if(this[_0x2571('0x10')][_0x27bc12[_0x2571('0x47')]]){for(var _0x315ad7=0x0,_0x2da955={};_0x315ad7=0x0?moment(_0x628c61[_0xa7c4('0x19')])[_0xa7c4('0xe')](_0x628c61[_0xa7c4('0x18')],'seconds'):null,'data1':_0xa7c4('0x1a'),'data2':_0x628c61['accountcode'],'data3':_0x628c61[_0xa7c4('0x12')],'data4':_0x628c61[_0xa7c4('0x1b')]||null,'role':_0xa7c4('0x14'),'internal':_0x628c61['accountcode']?_['toNumber'](_0x628c61[_0xa7c4('0x15')]):undefined,'uniqueid':_0x628c61[_0xa7c4('0x17')]},'log':_0xa7c4('0x5')});}; \ No newline at end of file +var _0x3716=['agent','toNumber','accountcode','uniqueid','voiceDialReport','membername','endtime','starttime','dialstring','moment','lodash','../client','voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','SIP/%s','queuecallerleaveAt','diff','inbound','exten'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x3716,0x1a9));var _0x6371=function(_0x4c321c,_0x3e9da0){_0x4c321c=_0x4c321c-0x0;var _0x25accb=_0x3716[_0x4c321c];return _0x25accb;};'use strict';var moment=require(_0x6371('0x0'));var _=require(_0x6371('0x1'));var util=require('util');var client=require(_0x6371('0x2'));exports[_0x6371('0x3')]=function(_0x55c9f6){var _0x5543a9=_0x55c9f6[_0x6371('0x4')]||_0x55c9f6['queuecallerexitAt'];return client[_0x6371('0x5')](_0x6371('0x6'),{'body':{'channel':_0x6371('0x7'),'membername':_0x55c9f6[_0x6371('0x8')],'interface':_[_0x6371('0x9')](_0x55c9f6[_0x6371('0xa')])?util[_0x6371('0xb')](_0x6371('0xc'),_0x55c9f6[_0x6371('0x8')]):_0x55c9f6[_0x6371('0xa')],'type':'TALKING','enterAt':_0x55c9f6[_0x6371('0xd')],'exitAt':_0x5543a9,'duration':moment(_0x5543a9)[_0x6371('0xe')](_0x55c9f6[_0x6371('0xd')],'seconds'),'data1':_0x6371('0xf'),'data2':_0x55c9f6['calleridnum'],'data3':_0x55c9f6[_0x6371('0x10')],'data4':null,'data5':_0x55c9f6['queue'],'role':_0x6371('0x11'),'internal':_0x55c9f6['accountcode']?_[_0x6371('0x12')](_0x55c9f6[_0x6371('0x13')]):undefined,'uniqueid':_0x55c9f6[_0x6371('0x14')]},'log':_0x6371('0x6')});};exports[_0x6371('0x15')]=function(_0x1fbfc2){return client[_0x6371('0x5')](_0x6371('0x6'),{'body':{'channel':_0x6371('0x7'),'membername':_0x1fbfc2[_0x6371('0x16')],'interface':_0x1fbfc2[_0x6371('0xa')],'type':'TALKING','enterAt':_0x1fbfc2['starttime'],'exitAt':_0x1fbfc2['endtime'],'duration':moment(_0x1fbfc2[_0x6371('0x17')])[_0x6371('0xe')](_0x1fbfc2[_0x6371('0x18')],'seconds')>=0x0?moment(_0x1fbfc2[_0x6371('0x17')])[_0x6371('0xe')](_0x1fbfc2[_0x6371('0x18')],'seconds'):null,'data1':'outbound','data2':_0x1fbfc2[_0x6371('0x13')],'data3':_0x1fbfc2[_0x6371('0x10')],'data4':_0x1fbfc2[_0x6371('0x19')]||null,'role':_0x6371('0x11'),'internal':_0x1fbfc2[_0x6371('0x13')]?_[_0x6371('0x12')](_0x1fbfc2[_0x6371('0x13')]):undefined,'uniqueid':_0x1fbfc2['uniqueid']},'log':_0x6371('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 2ee5b55..3e6d97b 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 _0x5a72=['Request','ShowSetting','stopRecordingOnTransfer','GetSettings','getSettings'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5a72,0x68));var _0x25a7=function(_0x5f3ca5,_0x33cb82){_0x5f3ca5=_0x5f3ca5-0x0;var _0x216633=_0x5a72[_0x5f3ca5];return _0x216633;};'use strict';var client=require('../client');exports[_0x25a7('0x0')]=function(){return function(){return client[_0x25a7('0x1')](_0x25a7('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x25a7('0x3')]},'log':_0x25a7('0x4')});};}; \ No newline at end of file +var _0x471d=['stopRecordingOnTransfer','GetSettings','getSettings','ShowSetting'];(function(_0x38ff1e,_0x3b9385){var _0x3755d4=function(_0x6e6692){while(--_0x6e6692){_0x38ff1e['push'](_0x38ff1e['shift']());}};_0x3755d4(++_0x3b9385);}(_0x471d,0xe2));var _0xd471=function(_0x40db11,_0x2b4d41){_0x40db11=_0x40db11-0x0;var _0x1460db=_0x471d[_0x40db11];return _0x1460db;};'use strict';var client=require('../client');exports[_0xd471('0x0')]=function(){return function(){return client['Request'](_0xd471('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xd471('0x2')]},'log':_0xd471('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index d84e9ff..81f082b 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 _0x9c2c=['../client','getTemplates','GetTemplate','html'];(function(_0x5b9bbb,_0x2bdece){var _0x2a0245=function(_0x5c1751){while(--_0x5c1751){_0x5b9bbb['push'](_0x5b9bbb['shift']());}};_0x2a0245(++_0x2bdece);}(_0x9c2c,0x1c0));var _0xc9c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c2c[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xc9c2('0x0'));exports[_0xc9c2('0x1')]=function(_0x4ac695){return function(_0x507004){return client['Request'](_0xc9c2('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0xc9c2('0x3')]},'log':_0xc9c2('0x2')});};}; \ No newline at end of file +var _0x13f6=['GetTemplate','name','../client','getTemplates','Request'];(function(_0x18f3b1,_0x39fae3){var _0x29a5a9=function(_0x5cc545){while(--_0x5cc545){_0x18f3b1['push'](_0x18f3b1['shift']());}};_0x29a5a9(++_0x39fae3);}(_0x13f6,0x124));var _0x613f=function(_0x1f59c6,_0x254444){_0x1f59c6=_0x1f59c6-0x0;var _0x1b89a5=_0x13f6[_0x1f59c6];return _0x1b89a5;};'use strict';var client=require(_0x613f('0x0'));exports[_0x613f('0x1')]=function(_0x5f1b3e){return function(_0x563492){return client[_0x613f('0x2')](_0x613f('0x3'),{'options':{'raw':!![],'attributes':['id',_0x613f('0x4'),'html']},'log':_0x613f('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 452fc23..bfe9614 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 _0x450c=['operator','Condition','Action','Actions','action','data1','data2','data6','data7','../client','getTriggers','Request','name','channel','field'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x450c,0x90));var _0xc450=function(_0x2eedc9,_0x152395){_0x2eedc9=_0x2eedc9-0x0;var _0x4fd912=_0x450c[_0x2eedc9];return _0x4fd912;};'use strict';var client=require(_0xc450('0x0'));exports[_0xc450('0x1')]=function(_0x2b807d){return function(_0x26b4ff){return client[_0xc450('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xc450('0x3'),_0xc450('0x4'),'status'],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0xc450('0x5'),_0xc450('0x6'),'value']},{'model':_0xc450('0x7'),'as':'AnyConditions','attributes':['id','field','operator','value']},{'model':_0xc450('0x8'),'as':_0xc450('0x9'),'attributes':['id',_0xc450('0xa'),_0xc450('0xb'),_0xc450('0xc'),'data3','data4','data5',_0xc450('0xd'),_0xc450('0xe')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xad9f=['value','AnyConditions','Action','Actions','action','data1','data2','data3','data4','data5','data6','data7','getTriggers','Request','name','channel','Condition','AllConditions','field','operator'];(function(_0x2afb44,_0x249a57){var _0x15ccc2=function(_0x180748){while(--_0x180748){_0x2afb44['push'](_0x2afb44['shift']());}};_0x15ccc2(++_0x249a57);}(_0xad9f,0x98));var _0xfad9=function(_0x509d6e,_0x46f0f3){_0x509d6e=_0x509d6e-0x0;var _0x2da7be=_0xad9f[_0x509d6e];return _0x2da7be;};'use strict';var client=require('../client');exports[_0xfad9('0x0')]=function(_0x39e649){return function(_0xba5c12){return client[_0xfad9('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xfad9('0x2'),_0xfad9('0x3'),'status'],'include':[{'model':_0xfad9('0x4'),'as':_0xfad9('0x5'),'attributes':['id',_0xfad9('0x6'),_0xfad9('0x7'),_0xfad9('0x8')]},{'model':_0xfad9('0x4'),'as':_0xfad9('0x9'),'attributes':['id',_0xfad9('0x6'),_0xfad9('0x7'),'value']},{'model':_0xfad9('0xa'),'as':_0xfad9('0xb'),'attributes':['id',_0xfad9('0xc'),_0xfad9('0xd'),_0xfad9('0xe'),_0xfad9('0xf'),_0xfad9('0x10'),_0xfad9('0x11'),_0xfad9('0x12'),_0xfad9('0x13')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 1eae14d..7829ce7 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 _0x3b7d=['GetTrunk','name','registry','../client'];(function(_0x2daa31,_0x53da57){var _0x38d78f=function(_0x263d5f){while(--_0x263d5f){_0x2daa31['push'](_0x2daa31['shift']());}};_0x38d78f(++_0x53da57);}(_0x3b7d,0x7f));var _0xd3b7=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x3b7d[_0x3947c9];return _0x2e7871;};'use strict';var client=require(_0xd3b7('0x0'));exports['getTrunks']=function(_0x31ac89){return function(_0x44e77a){return client['Request'](_0xd3b7('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xd3b7('0x2'),_0xd3b7('0x3')]},'log':_0xd3b7('0x1')});};}; \ No newline at end of file +var _0x25d6=['Request','GetTrunk','name','registry','../client'];(function(_0x3a415b,_0x2bb263){var _0xe723f4=function(_0x18137d){while(--_0x18137d){_0x3a415b['push'](_0x3a415b['shift']());}};_0xe723f4(++_0x2bb263);}(_0x25d6,0x68));var _0x625d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d6[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x625d('0x0'));exports['getTrunks']=function(_0x2f58f1){return function(_0x459e04){return client[_0x625d('0x1')](_0x625d('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x625d('0x3'),_0x625d('0x4')]},'log':_0x625d('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 8254c7b..dee6663 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 _0xfe96=['mobile','interface','getTelephones','telephone','savePause','PauseUser','saveUnpause','getAgent','ShowUser','../client','Request','GetUser','agent','name','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone'];(function(_0x220b45,_0x4da80f){var _0x2e1a55=function(_0x250ccd){while(--_0x250ccd){_0x220b45['push'](_0x220b45['shift']());}};_0x2e1a55(++_0x4da80f);}(_0xfe96,0xe5));var _0x6fe9=function(_0x11aeb9,_0x531c0a){_0x11aeb9=_0x11aeb9-0x0;var _0x1c4e08=_0xfe96[_0x11aeb9];return _0x1c4e08;};'use strict';var client=require(_0x6fe9('0x0'));exports['getAgents']=function(){return function(){return client[_0x6fe9('0x1')](_0x6fe9('0x2'),{'options':{'raw':![],'where':{'role':_0x6fe9('0x3')},'attributes':['id',_0x6fe9('0x4'),'email',_0x6fe9('0x5'),_0x6fe9('0x6'),_0x6fe9('0x7'),_0x6fe9('0x8'),_0x6fe9('0x9'),_0x6fe9('0xa'),_0x6fe9('0xb'),_0x6fe9('0xc'),_0x6fe9('0xd'),_0x6fe9('0xe')]},'log':'getAgents'});};};exports[_0x6fe9('0xf')]=function(){return function(){return client[_0x6fe9('0x1')](_0x6fe9('0x2'),{'options':{'raw':!![],'where':{'role':_0x6fe9('0x10')},'attributes':['id',_0x6fe9('0x4'),_0x6fe9('0x5'),'internal']},'log':'getTelephones'});};};exports[_0x6fe9('0x11')]=function(_0x53b685,_0x31685b,_0x586a0e){return client[_0x6fe9('0x1')](_0x6fe9('0x12'),{'body':{'type':_0x31685b,'uniqueid':_0x586a0e},'options':{'where':{'id':_0x53b685['id']}},'log':_0x6fe9('0x11')});};exports[_0x6fe9('0x13')]=function(_0x1c5805){return client['Request']('UnpauseUser',{'body':{},'options':{'where':{'id':_0x1c5805['id']}},'log':_0x6fe9('0x11')});};exports[_0x6fe9('0x14')]=function(_0xd504dc){return client['Request'](_0x6fe9('0x15'),{'options':{'raw':![],'where':{'role':'agent','id':_0xd504dc},'attributes':['id',_0x6fe9('0x4'),'email',_0x6fe9('0x5'),_0x6fe9('0x6'),_0x6fe9('0x7'),_0x6fe9('0x8'),_0x6fe9('0x9'),_0x6fe9('0xa'),_0x6fe9('0xb'),_0x6fe9('0xe')]},'log':_0x6fe9('0x14')});}; \ No newline at end of file +var _0xbbb6=['GetUser','agent','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','mobile','getTelephones','internal','savePause','saveUnpause','UnpauseUser','getAgent','ShowUser','online','pauseType','voicePause','getAgents','Request'];(function(_0x5e4fb9,_0x45caf4){var _0x4189b4=function(_0x486bfa){while(--_0x486bfa){_0x5e4fb9['push'](_0x5e4fb9['shift']());}};_0x4189b4(++_0x45caf4);}(_0xbbb6,0x1b7));var _0x6bbb=function(_0x44b865,_0x20ed9b){_0x44b865=_0x44b865-0x0;var _0x5e7b13=_0xbbb6[_0x44b865];return _0x5e7b13;};'use strict';var client=require('../client');exports[_0x6bbb('0x0')]=function(){return function(){return client[_0x6bbb('0x1')](_0x6bbb('0x2'),{'options':{'raw':![],'where':{'role':_0x6bbb('0x3')},'attributes':['id',_0x6bbb('0x4'),_0x6bbb('0x5'),_0x6bbb('0x6'),_0x6bbb('0x7'),'online',_0x6bbb('0x8'),'pauseType',_0x6bbb('0x9'),'voicePause','phone',_0x6bbb('0xa'),'interface']},'log':_0x6bbb('0x0')});};};exports[_0x6bbb('0xb')]=function(){return function(){return client[_0x6bbb('0x1')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x6bbb('0x4'),'accountcode',_0x6bbb('0xc')]},'log':_0x6bbb('0xb')});};};exports[_0x6bbb('0xd')]=function(_0x51000c,_0x40d281,_0x130a7f){return client[_0x6bbb('0x1')]('PauseUser',{'body':{'type':_0x40d281,'uniqueid':_0x130a7f},'options':{'where':{'id':_0x51000c['id']}},'log':_0x6bbb('0xd')});};exports[_0x6bbb('0xe')]=function(_0x5cb69e){return client[_0x6bbb('0x1')](_0x6bbb('0xf'),{'body':{},'options':{'where':{'id':_0x5cb69e['id']}},'log':_0x6bbb('0xd')});};exports[_0x6bbb('0x10')]=function(_0x134668){return client[_0x6bbb('0x1')](_0x6bbb('0x11'),{'options':{'raw':![],'where':{'role':_0x6bbb('0x3'),'id':_0x134668},'attributes':['id','name',_0x6bbb('0x5'),_0x6bbb('0x6'),_0x6bbb('0x7'),_0x6bbb('0x12'),_0x6bbb('0x8'),_0x6bbb('0x13'),_0x6bbb('0x9'),_0x6bbb('0x14'),'interface']},'log':_0x6bbb('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index cf04904..38245a5 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 _0x16d2=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x90f34f,_0x404021){var _0x4b18cf=function(_0x25112d){while(--_0x25112d){_0x90f34f['push'](_0x90f34f['shift']());}};_0x4b18cf(++_0x404021);}(_0x16d2,0x123));var _0x216d=function(_0x5471ec,_0x1ce81a){_0x5471ec=_0x5471ec-0x0;var _0x121d4c=_0x16d2[_0x5471ec];return _0x121d4c;};'use strict';var client=require(_0x216d('0x0'));exports[_0x216d('0x1')]=function(_0x398c34){return client[_0x216d('0x2')](_0x216d('0x3'),{'body':_0x398c34,'log':_0x216d('0x3')});};exports[_0x216d('0x4')]=function(_0x239b49,_0xfd7306,_0x593bb0){return client[_0x216d('0x2')](_0x216d('0x5'),{'body':_0x239b49,'options':{'where':{'uniqueid':_0xfd7306,'interface':_0x593bb0,'agentcomplete':!![]}},'log':_0x216d('0x5')});}; \ No newline at end of file +var _0x63c9=['Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x5d4531,_0x522b9d){var _0x19422=function(_0x4dfbe7){while(--_0x4dfbe7){_0x5d4531['push'](_0x5d4531['shift']());}};_0x19422(++_0x522b9d);}(_0x63c9,0x140));var _0x963c=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x63c9[_0x47fd36];return _0x21a0fc;};'use strict';var client=require('../client');exports['create']=function(_0x1e58d0){return client[_0x963c('0x0')](_0x963c('0x1'),{'body':_0x1e58d0,'log':_0x963c('0x1')});};exports[_0x963c('0x2')]=function(_0x52f000,_0x34a39f,_0x4ada0a){return client[_0x963c('0x0')](_0x963c('0x3'),{'body':_0x52f000,'options':{'where':{'uniqueid':_0x34a39f,'interface':_0x4ada0a,'agentcomplete':!![]}},'log':_0x963c('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index c73c46b..b3e7e12 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 _0x8ba0=['CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','Request','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','billableseconds','GetVoiceCallReports','moment','lodash','create'];(function(_0x44c50c,_0x3a42bf){var _0xcdf0aa=function(_0x40fdfb){while(--_0x40fdfb){_0x44c50c['push'](_0x44c50c['shift']());}};_0xcdf0aa(++_0x3a42bf);}(_0x8ba0,0x1b6));var _0x08ba=function(_0x590425,_0x11c129){_0x590425=_0x590425-0x0;var _0x5d4b80=_0x8ba0[_0x590425];return _0x5d4b80;};'use strict';var moment=require(_0x08ba('0x0'));var util=require('util');var _=require(_0x08ba('0x1'));var client=require('../client');exports[_0x08ba('0x2')]=function(_0x437885){return client['Request'](_0x08ba('0x3'),{'body':_[_0x08ba('0x4')](_0x437885,{'source':_0x437885[_0x08ba('0x5')],'destinationcontext':_0x437885[_0x08ba('0x6')],'callerid':_0x437885[_0x08ba('0x7')],'amaflags':_0x08ba('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0x08ba('0x9')]=function(){return function(){return client[_0x08ba('0xa')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x08ba('0xb')],'createdAt':{'$between':[moment()[_0x08ba('0xc')](_0x08ba('0xd'))[_0x08ba('0xe')](_0x08ba('0xf')),moment()[_0x08ba('0x10')]('day')[_0x08ba('0xe')](_0x08ba('0xf'))]}},'attributes':[_0x08ba('0x11'),_0x08ba('0x12'),'duration',_0x08ba('0x13')]},'log':_0x08ba('0x14')});};}; \ No newline at end of file +var _0x9796=['endOf','day','type','disposition','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','DOCUMENTATION','GetVoiceCallReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x95a80,_0x1dd45d){var _0x2241b7=function(_0x120b1b){while(--_0x120b1b){_0x95a80['push'](_0x95a80['shift']());}};_0x2241b7(++_0x1dd45d);}(_0x9796,0x132));var _0x6979=function(_0x6527e5,_0x43400f){_0x6527e5=_0x6527e5-0x0;var _0x5c5c6c=_0x9796[_0x6527e5];return _0x5c5c6c;};'use strict';var moment=require(_0x6979('0x0'));var util=require(_0x6979('0x1'));var _=require(_0x6979('0x2'));var client=require(_0x6979('0x3'));exports[_0x6979('0x4')]=function(_0x5949b4){return client[_0x6979('0x5')](_0x6979('0x6'),{'body':_[_0x6979('0x7')](_0x5949b4,{'source':_0x5949b4[_0x6979('0x8')],'destinationcontext':_0x5949b4['context'],'callerid':_0x5949b4['callerid'],'amaflags':_0x6979('0x9')}),'log':_0x6979('0x6')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0x6979('0xa'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x6979('0xb')]('day')[_0x6979('0xc')](_0x6979('0xd')),moment()[_0x6979('0xe')](_0x6979('0xf'))[_0x6979('0xc')](_0x6979('0xd'))]}},'attributes':[_0x6979('0x10'),_0x6979('0x11'),'duration',_0x6979('0x12')]},'log':_0x6979('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index d6bdfcc..f6cd87c 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 _0x1747=['CreateVoiceDialReport','../client','create','Request'];(function(_0x5d4115,_0x12d1c5){var _0x254730=function(_0x7f7d3f){while(--_0x7f7d3f){_0x5d4115['push'](_0x5d4115['shift']());}};_0x254730(++_0x12d1c5);}(_0x1747,0xf5));var _0x7174=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x1747[_0xbf8ebe];return _0x1e25e8;};'use strict';var client=require(_0x7174('0x0'));exports[_0x7174('0x1')]=function(_0x1cc7af){return client[_0x7174('0x2')](_0x7174('0x3'),{'body':_0x1cc7af,'log':_0x7174('0x3')});}; \ No newline at end of file +var _0xcb76=['CreateVoiceDialReport','../client','create','Request'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcb76,0x95));var _0x6cb7=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xcb76[_0x10004e];return _0x5af990;};'use strict';var client=require(_0x6cb7('0x0'));exports[_0x6cb7('0x1')]=function(_0x3d44bb){return client[_0x6cb7('0x2')](_0x6cb7('0x3'),{'body':_0x3d44bb,'log':_0x6cb7('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 170c572..a2f36ea 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 _0xd1f1=['GetVoiceExtension','exten','../client','getVoiceExtensions','Request'];(function(_0x4739d1,_0x24792e){var _0x47e494=function(_0x3678c2){while(--_0x3678c2){_0x4739d1['push'](_0x4739d1['shift']());}};_0x47e494(++_0x24792e);}(_0xd1f1,0x84));var _0x1d1f=function(_0x3c6310,_0x13601d){_0x3c6310=_0x3c6310-0x0;var _0x320122=_0xd1f1[_0x3c6310];return _0x320122;};'use strict';var client=require(_0x1d1f('0x0'));exports[_0x1d1f('0x1')]=function(){return function(){return client[_0x1d1f('0x2')](_0x1d1f('0x3'),{'options':{'raw':!![],'attributes':['id',_0x1d1f('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x1d1f('0x1')});};}; \ No newline at end of file +var _0xb16f=['recordingFormat','../client','getVoiceExtensions','Request','exten'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0xb16f,0xf6));var _0xfb16=function(_0x3cdcbe,_0x450f7b){_0x3cdcbe=_0x3cdcbe-0x0;var _0x5846a1=_0xb16f[_0x3cdcbe];return _0x5846a1;};'use strict';var client=require(_0xfb16('0x0'));exports[_0xfb16('0x1')]=function(){return function(){return client[_0xfb16('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xfb16('0x3'),_0xfb16('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xfb16('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 05b2c12..1caf7b3 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 _0x1007=['dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','../client','getVoiceQueues','Request','name','autopause','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength'];(function(_0x38c4bf,_0xcde6f){var _0x46f923=function(_0x3709b2){while(--_0x3709b2){_0x38c4bf['push'](_0x38c4bf['shift']());}};_0x46f923(++_0xcde6f);}(_0x1007,0x1b9));var _0x7100=function(_0x407765,_0x239591){_0x407765=_0x407765-0x0;var _0x42887b=_0x1007[_0x407765];return _0x42887b;};'use strict';var client=require(_0x7100('0x0'));exports[_0x7100('0x1')]=function(){return function(){return client[_0x7100('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x7100('0x3'),'acw','acwTimeout',_0x7100('0x4'),_0x7100('0x5'),_0x7100('0x6'),_0x7100('0x7'),_0x7100('0x8'),'dialLimitChannel',_0x7100('0x9'),'dialPowerLevel','dialPredictiveOptimization',_0x7100('0xa'),_0x7100('0xb'),_0x7100('0xc'),_0x7100('0xd'),'dialOriginateTimeout',_0x7100('0xe'),'dialQueueTimeout',_0x7100('0xf'),_0x7100('0x10'),'dialCongestionRetryFrequency',_0x7100('0x11'),'dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0x7100('0x12'),_0x7100('0x13'),'dialTimezone','dialGlobalInterval','dialPrefix',_0x7100('0x14'),_0x7100('0x15'),_0x7100('0x16'),'dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime',_0x7100('0x17'),_0x7100('0x18'),_0x7100('0x19'),'dialAMDSilenceThreshold',_0x7100('0x1a'),'timeout',_0x7100('0x1b'),_0x7100('0x1c'),_0x7100('0x1d'),_0x7100('0x1e'),_0x7100('0x1f'),_0x7100('0x20'),_0x7100('0x5'),_0x7100('0x21'),_0x7100('0x22'),_0x7100('0x23'),_0x7100('0x24'),'dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0x7100('0x25'),_0x7100('0x26'),_0x7100('0x27'),_0x7100('0x28'),_0x7100('0x29'),_0x7100('0x2a'),'dialAgentRejectRetryFrequency',_0x7100('0x2b'),_0x7100('0x2c'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0x7100('0x2d'),'as':'Trunk','attributes':['id',_0x7100('0x3'),_0x7100('0x2e'),_0x7100('0x2f')]},{'model':_0x7100('0x30'),'as':_0x7100('0x31'),'attributes':['id',_0x7100('0x3')]},{'model':_0x7100('0x2d'),'as':_0x7100('0x32'),'attributes':['id',_0x7100('0x3'),_0x7100('0x2e'),_0x7100('0x2f')]},{'model':_0x7100('0x33'),'as':'Interval','attributes':['id',_0x7100('0x3')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x7100('0x3'),'interval']}]}]},'log':_0x7100('0x1')});};}; \ No newline at end of file +var _0x40c7=['dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','Pause','mandatoryDispositionPause','TrunkBackup','callerid','active','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','monitor_format','type','dialActive'];(function(_0x104b47,_0x491eff){var _0x34a3f1=function(_0x467a15){while(--_0x467a15){_0x104b47['push'](_0x104b47['shift']());}};_0x34a3f1(++_0x491eff);}(_0x40c7,0xe3));var _0x740c=function(_0x4b1bb0,_0x7dc32b){_0x4b1bb0=_0x4b1bb0-0x0;var _0x549407=_0x40c7[_0x4b1bb0];return _0x549407;};'use strict';var client=require(_0x740c('0x0'));exports[_0x740c('0x1')]=function(){return function(){return client[_0x740c('0x2')](_0x740c('0x3'),{'options':{'raw':![],'attributes':['id',_0x740c('0x4'),_0x740c('0x5'),'acwTimeout','autopause',_0x740c('0x6'),_0x740c('0x7'),_0x740c('0x8'),_0x740c('0x9'),_0x740c('0xa'),_0x740c('0xb'),_0x740c('0xc'),_0x740c('0xd'),'dialPredictiveOptimizationPercentage',_0x740c('0xe'),_0x740c('0xf'),'dialOriginateCallerIdNumber',_0x740c('0x10'),'dialQueueOptions',_0x740c('0x11'),_0x740c('0x12'),_0x740c('0x13'),'dialCongestionRetryFrequency',_0x740c('0x14'),'dialBusyRetryFrequency',_0x740c('0x15'),_0x740c('0x16'),_0x740c('0x17'),'dialTimezone',_0x740c('0x18'),_0x740c('0x19'),_0x740c('0x1a'),_0x740c('0x1b'),'dialAMDInitialSilence',_0x740c('0x1c'),'dialAMDAfterGreetingSilence',_0x740c('0x1d'),'dialAMDMinWordLength',_0x740c('0x1e'),_0x740c('0x1f'),'dialAMDSilenceThreshold',_0x740c('0x20'),_0x740c('0x21'),_0x740c('0x22'),_0x740c('0x23'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent',_0x740c('0x24'),_0x740c('0x25'),'monitor_format',_0x740c('0x26'),_0x740c('0x27'),_0x740c('0x28'),_0x740c('0x29'),_0x740c('0x2a'),_0x740c('0x2b'),_0x740c('0x2c'),_0x740c('0x2d'),_0x740c('0x2e'),_0x740c('0x2f'),_0x740c('0x30'),_0x740c('0x31'),_0x740c('0x32'),'mandatoryDisposition',_0x740c('0x33'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x740c('0x4'),'callerid','active']},{'model':_0x740c('0x34'),'as':_0x740c('0x35'),'attributes':['id',_0x740c('0x4')]},{'model':'Trunk','as':_0x740c('0x36'),'attributes':['id','name',_0x740c('0x37'),_0x740c('0x38')]},{'model':_0x740c('0x39'),'as':'Interval','attributes':['id','name'],'include':[{'model':_0x740c('0x39'),'as':'Intervals','attributes':['id',_0x740c('0x4'),_0x740c('0x3a')]}]}]},'log':_0x740c('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index f28171c..6a663c5 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 _0x2129=['queuecallercompleteAt','queuecallerexit','queuecallerexitAt','GetVoiceQueueReports','lodash','../client','Request','CreateVoiceQueueReport','GetVoiceQueueReport','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete'];(function(_0x2053aa,_0x3df40e){var _0x30f5bb=function(_0x1b3f36){while(--_0x1b3f36){_0x2053aa['push'](_0x2053aa['shift']());}};_0x30f5bb(++_0x3df40e);}(_0x2129,0x1ea));var _0x9212=function(_0x480812,_0x54a455){_0x480812=_0x480812-0x0;var _0x112ce4=_0x2129[_0x480812];return _0x112ce4;};'use strict';var moment=require('moment');var _=require(_0x9212('0x0'));var client=require(_0x9212('0x1'));exports['create']=function(_0x1cc3c4){return client[_0x9212('0x2')](_0x9212('0x3'),{'body':_0x1cc3c4,'log':'CreateVoiceQueueReport'});};exports['getVoiceQueueReports']=function(){return function(){return client[_0x9212('0x2')](_0x9212('0x4'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x9212('0x5')](_0x9212('0x6'))[_0x9212('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x9212('0x8')](_0x9212('0x6'))[_0x9212('0x7')](_0x9212('0x9'))]}},'attributes':['uniqueid',_0x9212('0xa'),_0x9212('0xb'),_0x9212('0xc'),_0x9212('0xd'),_0x9212('0xe'),_0x9212('0xf'),_0x9212('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':_0x9212('0x11')});};}; \ No newline at end of file +var _0x7ebe=['GetVoiceQueueReports','moment','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','format','endOf','day','YYYY-MM-DD\x20HH:mm:ss','queuecallerjoinAt','queuecallerleaveAt','queuecallercompleteAt','queuecallerexit','queuecallerabandonAt'];(function(_0xe34efd,_0x4818cd){var _0x3c4c86=function(_0x30ff2b){while(--_0x30ff2b){_0xe34efd['push'](_0xe34efd['shift']());}};_0x3c4c86(++_0x4818cd);}(_0x7ebe,0x1e1));var _0xe7eb=function(_0x2f9247,_0x207c32){_0x2f9247=_0x2f9247-0x0;var _0x30109a=_0x7ebe[_0x2f9247];return _0x30109a;};'use strict';var moment=require(_0xe7eb('0x0'));var _=require('lodash');var client=require(_0xe7eb('0x1'));exports['create']=function(_0xd7aa33){return client[_0xe7eb('0x2')](_0xe7eb('0x3'),{'body':_0xd7aa33,'log':'CreateVoiceQueueReport'});};exports[_0xe7eb('0x4')]=function(){return function(){return client['Request']('GetVoiceQueueReport',{'options':{'where':{'createdAt':{'$between':[moment()['startOf']('day')[_0xe7eb('0x5')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xe7eb('0x6')](_0xe7eb('0x7'))[_0xe7eb('0x5')](_0xe7eb('0x8'))]}},'attributes':['uniqueid','queue',_0xe7eb('0x9'),_0xe7eb('0xa'),'queuecallercomplete',_0xe7eb('0xb'),_0xe7eb('0xc'),'queuecallerexitAt','queuecallerabandon',_0xe7eb('0xd')]},'log':_0xe7eb('0xe')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index d67ea4b..8ec6cb0 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 _0xc47a=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xc47a,0x1ab));var _0xac47=function(_0x31c086,_0x48979e){_0x31c086=_0x31c086-0x0;var _0xe6a4e8=_0xc47a[_0x31c086];return _0xe6a4e8;};'use strict';var client=require(_0xac47('0x0'));exports[_0xac47('0x1')]=function(_0x52be44){return function(){return client[_0xac47('0x2')](_0xac47('0x3'),{'options':{'where':{'VoiceQueueId':_0x52be44,'paused':!![]},'raw':!![]},'log':_0xac47('0x1')});};}; \ No newline at end of file +var _0x3346=['../client','getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x15b7e9,_0x27a54d){var _0x56476d=function(_0x1f90cb){while(--_0x1f90cb){_0x15b7e9['push'](_0x15b7e9['shift']());}};_0x56476d(++_0x27a54d);}(_0x3346,0x1bf));var _0x6334=function(_0x11fc5b,_0x5a5477){_0x11fc5b=_0x11fc5b-0x0;var _0x5083bb=_0x3346[_0x11fc5b];return _0x5083bb;};'use strict';var client=require(_0x6334('0x0'));exports[_0x6334('0x1')]=function(_0x40274a){return function(){return client['Request'](_0x6334('0x2'),{'options':{'where':{'VoiceQueueId':_0x40274a,'paused':!![]},'raw':!![]},'log':_0x6334('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index e6d8ce9..a8a1cda 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 _0xc7c8=['create','Request','CreateVoiceRecording','merge','monitorFilename','lodash','../client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc7c8,0xc2));var _0x8c7c=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc7c8[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x8c7c('0x0'));var client=require(_0x8c7c('0x1'));exports[_0x8c7c('0x2')]=function(_0x4cfe35){return client[_0x8c7c('0x3')](_0x8c7c('0x4'),{'body':_[_0x8c7c('0x5')](_0x4cfe35,{'value':_0x4cfe35[_0x8c7c('0x6')]}),'log':'CreateVoiceRecording'});}; \ No newline at end of file +var _0xf9e4=['CreateVoiceRecording','merge','lodash','Request'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xf9e4,0x142));var _0x4f9e=function(_0xecd3d9,_0x3d30fb){_0xecd3d9=_0xecd3d9-0x0;var _0x4c5dc7=_0xf9e4[_0xecd3d9];return _0x4c5dc7;};'use strict';var _=require(_0x4f9e('0x0'));var client=require('../client');exports['create']=function(_0x4dcc7b){return client[_0x4f9e('0x1')](_0x4f9e('0x2'),{'body':_[_0x4f9e('0x3')](_0x4dcc7b,{'value':_0x4dcc7b['monitorFilename']}),'log':_0x4f9e('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index a14a796..ef84f18 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 _0x221f=['origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','isexternal','extension','blind','attendedTransfer','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename'];(function(_0x4d5d28,_0x26bd9b){var _0x2026b1=function(_0x1fe42c){while(--_0x1fe42c){_0x4d5d28['push'](_0x4d5d28['shift']());}};_0x2026b1(++_0x26bd9b);}(_0x221f,0x1b1));var _0xf221=function(_0x33e4a7,_0x2e80a2){_0x33e4a7=_0x33e4a7-0x0;var _0x598620=_0x221f[_0x33e4a7];return _0x598620;};'use strict';var client=require(_0xf221('0x0'));exports['transfers']={};exports['blindTransfer']=function(_0x3d2465){return client[_0xf221('0x1')](_0xf221('0x2'),{'body':{'result':_0x3d2465['result'],'transfererchannel':_0x3d2465[_0xf221('0x3')],'transferercalleridnum':_0x3d2465['transferercalleridnum'],'transferercalleridname':_0x3d2465[_0xf221('0x4')],'transfererconnectedlinenum':_0x3d2465['transfererconnectedlinenum'],'transfererconnectedlinename':_0x3d2465[_0xf221('0x5')],'transfereraccountcode':_0x3d2465[_0xf221('0x6')],'transferercontext':_0x3d2465[_0xf221('0x7')],'transfererexten':_0x3d2465[_0xf221('0x8')],'transfererlinkedid':_0x3d2465[_0xf221('0x9')],'transfereechannel':_0x3d2465[_0xf221('0xa')],'transfereecalleridnum':_0x3d2465[_0xf221('0xb')],'transfereecalleridname':_0x3d2465[_0xf221('0xc')],'transfereeconnectedlinenum':_0x3d2465[_0xf221('0xd')],'transfereeconnectedlinename':_0x3d2465['transfereeconnectedlinename'],'transfereeaccountcode':_0x3d2465[_0xf221('0xe')],'transfereecontext':_0x3d2465[_0xf221('0xf')],'transfereeexten':_0x3d2465['transfereeexten'],'transfereelinkedid':_0x3d2465['transfereelinkedid'],'isexternal':_0x3d2465[_0xf221('0x10')],'context':_0x3d2465['context'],'extension':_0x3d2465[_0xf221('0x11')],'type':_0xf221('0x12')},'log':_0xf221('0x2')});};exports[_0xf221('0x13')]=function(_0x44be4d){return client[_0xf221('0x1')](_0xf221('0x2'),{'body':{'result':_0x44be4d['result'],'transfererchannel':_0x44be4d[_0xf221('0x14')],'transferercalleridnum':_0x44be4d['origtransferercalleridnum'],'transferercalleridname':_0x44be4d['origtransferercalleridname'],'transfererconnectedlinenum':_0x44be4d[_0xf221('0x15')],'transfererconnectedlinename':_0x44be4d[_0xf221('0x16')],'transfereraccountcode':_0x44be4d[_0xf221('0x17')],'transferercontext':_0x44be4d[_0xf221('0x18')],'transfererexten':_0x44be4d[_0xf221('0x19')],'transfererlinkedid':_0x44be4d[_0xf221('0x1a')],'transfereechannel':_0x44be4d[_0xf221('0x1b')],'transfereecalleridnum':_0x44be4d[_0xf221('0x1c')],'transfereecalleridname':_0x44be4d[_0xf221('0x1d')],'transfereeconnectedlinenum':_0x44be4d[_0xf221('0x1e')],'transfereeconnectedlinename':_0x44be4d[_0xf221('0x1f')],'transfereeaccountcode':_0x44be4d[_0xf221('0x20')],'transfereecontext':_0x44be4d['transfertargetcontext'],'transfereeexten':_0x44be4d[_0xf221('0x21')],'transfereelinkedid':_0x44be4d[_0xf221('0x22')],'isexternal':_0x44be4d[_0xf221('0x10')],'context':_0x44be4d[_0xf221('0x23')],'extension':_0x44be4d[_0xf221('0x24')],'type':_0xf221('0x25')},'log':_0xf221('0x2')});}; \ No newline at end of file +var _0x1806=['transferercontext','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','isexternal','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','blindTransfer','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1806,0x94));var _0x6180=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x1806[_0x5ddb1c];return _0x354adc;};'use strict';var client=require('../client');exports['transfers']={};exports[_0x6180('0x0')]=function(_0x285cff){return client[_0x6180('0x1')]('CreateVoiceTransferReport',{'body':{'result':_0x285cff[_0x6180('0x2')],'transfererchannel':_0x285cff[_0x6180('0x3')],'transferercalleridnum':_0x285cff[_0x6180('0x4')],'transferercalleridname':_0x285cff[_0x6180('0x5')],'transfererconnectedlinenum':_0x285cff[_0x6180('0x6')],'transfererconnectedlinename':_0x285cff['transfererconnectedlinename'],'transfereraccountcode':_0x285cff[_0x6180('0x7')],'transferercontext':_0x285cff[_0x6180('0x8')],'transfererexten':_0x285cff['transfererexten'],'transfererlinkedid':_0x285cff[_0x6180('0x9')],'transfereechannel':_0x285cff['transfereechannel'],'transfereecalleridnum':_0x285cff[_0x6180('0xa')],'transfereecalleridname':_0x285cff[_0x6180('0xb')],'transfereeconnectedlinenum':_0x285cff[_0x6180('0xc')],'transfereeconnectedlinename':_0x285cff[_0x6180('0xd')],'transfereeaccountcode':_0x285cff[_0x6180('0xe')],'transfereecontext':_0x285cff['transfereecontext'],'transfereeexten':_0x285cff[_0x6180('0xf')],'transfereelinkedid':_0x285cff['transfereelinkedid'],'isexternal':_0x285cff[_0x6180('0x10')],'context':_0x285cff[_0x6180('0x11')],'extension':_0x285cff[_0x6180('0x12')],'type':_0x6180('0x13')},'log':_0x6180('0x14')});};exports[_0x6180('0x15')]=function(_0x32d769){return client[_0x6180('0x1')](_0x6180('0x14'),{'body':{'result':_0x32d769['result'],'transfererchannel':_0x32d769[_0x6180('0x16')],'transferercalleridnum':_0x32d769['origtransferercalleridnum'],'transferercalleridname':_0x32d769[_0x6180('0x17')],'transfererconnectedlinenum':_0x32d769[_0x6180('0x18')],'transfererconnectedlinename':_0x32d769[_0x6180('0x19')],'transfereraccountcode':_0x32d769[_0x6180('0x1a')],'transferercontext':_0x32d769[_0x6180('0x1b')],'transfererexten':_0x32d769[_0x6180('0x1c')],'transfererlinkedid':_0x32d769['origtransfererlinkedid'],'transfereechannel':_0x32d769[_0x6180('0x1d')],'transfereecalleridnum':_0x32d769['transfertargetcalleridnum'],'transfereecalleridname':_0x32d769[_0x6180('0x1e')],'transfereeconnectedlinenum':_0x32d769[_0x6180('0x1f')],'transfereeconnectedlinename':_0x32d769['transfertargetconnectedlinename'],'transfereeaccountcode':_0x32d769[_0x6180('0x20')],'transfereecontext':_0x32d769[_0x6180('0x21')],'transfereeexten':_0x32d769[_0x6180('0x22')],'transfereelinkedid':_0x32d769[_0x6180('0x23')],'isexternal':_0x32d769['isexternal'],'context':_0x32d769[_0x6180('0x24')],'extension':_0x32d769[_0x6180('0x25')],'type':_0x6180('0x26')},'log':_0x6180('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 5746101..cc63ca3 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 _0x7585=['rec','MixMonitor\x20Success','catch','Channel\x20doesn\x27t\x20exist','StopMixMonitor','stop','wav','status','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','updateAcw','agents','updateStatusRealtime','pause','QueuePause','asterisk','username','join','pick','keys','module','action','Reload','Action','message','error','isConnected','ami\x20disconnected','command','Command','then','content','hasOwnProperty','voiceQueues','available','pTalking','sumBillable','talking','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','callerid','Interval','push','length','values','channels','voicechannel','map','uniqueid','channel','ai(mixmonitorid)','find','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7585,0x1b0));var _0x5758=function(_0x1655cd,_0x18e34f){_0x1655cd=_0x1655cd-0x0;var _0x6c6065=_0x7585[_0x1655cd];return _0x6c6065;};'use strict';var _=require('lodash');var util=require(_0x5758('0x0'));var jayson=require(_0x5758('0x1'));var schema=require(_0x5758('0x2'));var BPromise=require(_0x5758('0x3'));var moment=require(_0x5758('0x4'));var config=require(_0x5758('0x5'));var properties=require(_0x5758('0x6'));var ami=require(_0x5758('0x7'));exports[_0x5758('0x8')]=function(_0x195a6c,_0x55ee6c,_0x1fedfd){return new BPromise(function(_0x518696,_0x40c99c){var _0x1cd473={'QueuePause':function(_0x43e4d2){return new Promise(function(_0x55fccc,_0x5da05d){var _0x6d2daa=util[_0x5758('0x9')](_0x5758('0xa'),_0x5758('0xb'),_0x43e4d2[_0x5758('0xc')]);if(_0x195a6c[_0x5758('0xd')]&&_0x195a6c[_0x5758('0xd')][_0x6d2daa]&&_0x195a6c[_0x5758('0xd')][_0x6d2daa]['timer']){_0x195a6c[_0x5758('0xd')][_0x6d2daa][_0x5758('0xe')]();}if(_0x195a6c[_0x5758('0xf')][_0x6d2daa]){_0x195a6c[_0x5758('0xf')][_0x6d2daa][_0x5758('0x10')]({'statePause':_0x43e4d2[_0x5758('0x11')]?!![]:![]});}_0x55fccc({'code':0xc8,'message':_0x5758('0x12')});});},'Reload':function(_0x1a93f9){var _0x430eb6=this;return new Promise(function(_0x1c2510,_0x1247b0){if(ami['isConnected']()==![]){return _0x1247b0(_0x430eb6['error'](0x1f4,[config[_0x5758('0x13')]['ip'],config[_0x5758('0x13')][_0x5758('0x14')],'ami\x20disconnected'][_0x5758('0x15')]('\x20')));}_0x1a93f9=_[_0x5758('0x16')](_0x1a93f9,_[_0x5758('0x17')](properties[_0x5758('0x18')]));_0x1a93f9[_0x5758('0x19')]=_0x5758('0x1a');return ami[_0x5758('0x1b')](_0x1a93f9)['then'](function(_0x335cd5){_0x1c2510({'code':0xc8,'message':_0x335cd5[_0x5758('0x1c')]});})['catch'](function(_0x24616e){_0x1247b0(_0x430eb6[_0x5758('0x1d')](0x1f5,_0x24616e[_0x5758('0x1c')]));});});},'Command':function(_0x4a3e40){var _0x3444fd=this;return new Promise(function(_0x3bc22f,_0x45e2b2){if(ami[_0x5758('0x1e')]()==![]){return _0x45e2b2(_0x3444fd[_0x5758('0x1d')](0x1f4,[config['asterisk']['ip'],config[_0x5758('0x13')]['username'],_0x5758('0x1f')]['join']('\x20')));}_0x4a3e40=_['pick'](_0x4a3e40,_0x5758('0x20'));_0x4a3e40[_0x5758('0x19')]=_0x5758('0x21');return ami[_0x5758('0x1b')](_0x4a3e40)[_0x5758('0x22')](function(_0x1c5f9e){_0x3bc22f({'code':0xc8,'message':_0x1c5f9e[_0x5758('0x23')]});})['catch'](function(_0x50a691){_0x45e2b2(_0x3444fd[_0x5758('0x1d')](0x1f5,_0x50a691['message']));});});},'VoiceQueues':function(_0xc7bbb5){return new Promise(function(_0x2907d6,_0x15dce7){var _0xf36fce=[];for(var _0x3c9b99 in _0x195a6c['voiceQueues']){if(_0x195a6c['voiceQueues'][_0x5758('0x24')](_0x3c9b99)){var _0x461092=_0x195a6c[_0x5758('0x25')][_0x3c9b99];var _0x1ba7aa={'id':_0x461092['id'],'name':_0x461092[_0x5758('0xc')],'strategy':_0x461092['strategy'],'answered':_0x461092['answered'],'available':_0x461092[_0x5758('0x26')],'loggedIn':_0x461092['loggedIn'],'pTalking':_0x461092[_0x5758('0x27')],'sumBillable':_0x461092[_0x5758('0x28')],'sumDuration':_0x461092['sumDuration'],'sumHoldTime':_0x461092['sumHoldTime']||0x0,'talking':_0x461092[_0x5758('0x29')],'total':_0x461092['total'],'type':_0x461092[_0x5758('0x2a')],'unmanaged':_0x461092[_0x5758('0x2b')],'abandoned':_0x461092[_0x5758('0x2c')],'waiting':_0x461092[_0x5758('0x2d')],'loggedInDb':_0x461092[_0x5758('0x2e')]};if(_0x461092[_0x5758('0x2a')]==='outbound'){_0x1ba7aa[_0x5758('0x2f')]=_0x461092[_0x5758('0x2f')];_0x1ba7aa[_0x5758('0x30')]=_0x461092[_0x5758('0x30')];_0x1ba7aa[_0x5758('0x31')]=_0x461092[_0x5758('0x31')];_0x1ba7aa['dialOriginateCallerIdNumber']=_0x461092['dialOriginateCallerIdNumber'];_0x1ba7aa['dialOriginateTimeout']=_0x461092[_0x5758('0x32')];_0x1ba7aa[_0x5758('0x33')]=_0x461092[_0x5758('0x33')];_0x1ba7aa['outboundAnswerAgiCallsDay']=_0x461092[_0x5758('0x34')];_0x1ba7aa['outboundAnswerCallsDay']=_0x461092[_0x5758('0x35')];_0x1ba7aa[_0x5758('0x36')]=_0x461092['outboundBlacklistCallsDay'];_0x1ba7aa[_0x5758('0x37')]=_0x461092['outboundBusyCallsDay'];_0x1ba7aa[_0x5758('0x38')]=_0x461092['outboundCongestionCallsDay'];_0x1ba7aa[_0x5758('0x39')]=_0x461092[_0x5758('0x39')];_0x1ba7aa['outboundDropCallsDayCallersExit']=_0x461092[_0x5758('0x3a')];_0x1ba7aa['outboundDropCallsDayTimeout']=_0x461092['outboundDropCallsDayTimeout'];_0x1ba7aa['outboundNoAnswerCallsDay']=_0x461092[_0x5758('0x3b')];_0x1ba7aa['outboundNoSuchCallsDay']=_0x461092['outboundNoSuchCallsDay'];_0x1ba7aa[_0x5758('0x3c')]=_0x461092['outboundOriginateFailureCallsDay'];_0x1ba7aa[_0x5758('0x3d')]=_0x461092[_0x5758('0x3d')];_0x1ba7aa[_0x5758('0x3e')]=_0x461092[_0x5758('0x3e')];_0x1ba7aa['outboundUnknownCallsDay']=_0x461092[_0x5758('0x3f')];_0x1ba7aa[_0x5758('0x40')]=_0x461092[_0x5758('0x40')];_0x1ba7aa[_0x5758('0x41')]=_0x461092[_0x5758('0x41')];_0x1ba7aa[_0x5758('0x42')]=_0x461092[_0x5758('0x42')];_0x1ba7aa[_0x5758('0x43')]=_0x461092['predictiveIntervalDroppedCallsCallersExit'];_0x1ba7aa[_0x5758('0x44')]=_0x461092[_0x5758('0x44')];_0x1ba7aa[_0x5758('0x45')]=_0x461092[_0x5758('0x45')];_0x1ba7aa['predictiveIntervalErlangCallsDroppedCalls']=_0x461092['predictiveIntervalErlangCallsDroppedCalls'];_0x1ba7aa[_0x5758('0x46')]=_0x461092[_0x5758('0x46')];_0x1ba7aa[_0x5758('0x47')]=_0x461092[_0x5758('0x47')];_0x1ba7aa[_0x5758('0x48')]=_0x461092['predictiveIntervalPauses'];_0x1ba7aa[_0x5758('0x49')]=_0x461092[_0x5758('0x49')];_0x1ba7aa[_0x5758('0x4a')]=_0x461092[_0x5758('0x4a')];_0x1ba7aa[_0x5758('0x1c')]=_0x461092['message'];_0x1ba7aa[_0x5758('0x4b')]=_0x461092['originated'];_0x1ba7aa[_0x5758('0x4c')]=_0x461092[_0x5758('0x4c')];_0x1ba7aa[_0x5758('0x4d')]=_0x461092['erlangCallToSecond'];_0x1ba7aa[_0x5758('0x4e')]=_0x461092[_0x5758('0x4e')];_0x1ba7aa[_0x5758('0x4f')]=_0x461092[_0x5758('0x4f')];_0x1ba7aa[_0x5758('0x50')]=_0x461092[_0x5758('0x50')];_0x1ba7aa['startProgressive']=_0x461092['startProgressive'];}if(_0x461092['Trunk']){_0x1ba7aa[_0x5758('0x51')]={'id':_0x461092['Trunk']['id'],'name':_0x461092['Trunk'][_0x5758('0xc')],'active':_0x461092[_0x5758('0x51')]['active'],'callerid':_0x461092[_0x5758('0x51')][_0x5758('0x52')]};}if(_0x461092[_0x5758('0x53')]){_0x1ba7aa[_0x5758('0x53')]={'id':_0x461092['Interval']['id'],'name':_0x461092[_0x5758('0x53')][_0x5758('0xc')]};}_0xf36fce[_0x5758('0x54')](_0x1ba7aa);}}_0x2907d6({'count':_0xf36fce[_0x5758('0x55')],'rows':_0xf36fce});});},'VoiceChannels':function(_0x3602cd){return new Promise(function(_0x214161,_0x9abb98){var _0x5113bd=_[_0x5758('0x56')](_0x195a6c[_0x5758('0x57')]);_0x214161({'count':_0x5113bd['length'],'rows':_0x5113bd});});},'VoiceChannelMixMonitor':function(_0x4f115e){var _0x40364f=this;return new Promise(function(_0x288fc3,_0x5ca527){if(ami[_0x5758('0x1e')]()==![]){return _0x5ca527(_0x40364f[_0x5758('0x1d')](0x1f4,[config['asterisk']['ip'],config[_0x5758('0x13')][_0x5758('0x14')],_0x5758('0x1f')][_0x5758('0x15')]('\x20')));}var _0x3fed37=schema(properties[_0x5758('0x58')])[_0x5758('0x2')](_0x4f115e);if(_0x3fed37[_0x5758('0x55')]>0x0){return _0x5ca527(_0x40364f['error'](0x1f4,_[_0x5758('0x59')](_0x3fed37,'message')[_0x5758('0x15')](',\x20')));}var _0x25e6c3=_['find'](_0x195a6c[_0x5758('0x57')],{'uniqueid':_0x4f115e[_0x5758('0x5a')]});if(_0x25e6c3&&_0x25e6c3[_0x5758('0x5b')]){var _0x319423=util[_0x5758('0x9')]('%s.%s',_0x4f115e['filename']||_0x4f115e[_0x5758('0x5a')],_0x4f115e[_0x5758('0x9')]||'wav');return ami[_0x5758('0x1b')]({'action':'MixMonitor','channel':_0x25e6c3[_0x5758('0x5b')],'file':_0x319423,'options':_0x5758('0x5c')})[_0x5758('0x22')](function(_0x2b990a){var _0x5558f1=_[_0x5758('0x5d')](_0x25e6c3[_0x5758('0x5e')],{'filename':_0x5758('0x5f')+_0x319423[_0x5758('0x60')]()});if(_[_0x5758('0x61')](_0x5558f1)){_0x25e6c3[_0x5758('0x5e')][_0x5758('0x54')]({'filename':_0x5758('0x5f')+_0x319423['toLowerCase'](),'createdAt':moment()['format'](_0x5758('0x62')),'mixmonitorid':_0x2b990a[_0x5758('0x63')],'status':_0x5758('0x64')});}else{_0x5558f1[_0x5758('0x63')]=_0x2b990a[_0x5758('0x63')];_0x5558f1['status']=_0x5758('0x64');}_0x288fc3({'code':0xc8,'message':[_0x4f115e[_0x5758('0x5a')],_0x5758('0x65'),_0x2b990a[_0x5758('0x63')]][_0x5758('0x15')]('\x20'),'mixmonitorid':_0x2b990a[_0x5758('0x63')]});})[_0x5758('0x66')](function(_0x1c639b){_0x5ca527(_0x40364f['error'](0x1f5,[_0x4f115e[_0x5758('0x5a')],_0x1c639b[_0x5758('0x1c')][_0x5758('0x60')]()][_0x5758('0x15')]('\x20')));});}else{return _0x5ca527(_0x40364f['error'](0x1f5,_0x5758('0x67')));}});},'VoiceChannelStopMixMonitor':function(_0x4ef7ed){var _0x194b23=this;return new Promise(function(_0x28c45d,_0x32d907){if(ami['isConnected']()==![]){return _0x32d907(_0x194b23[_0x5758('0x1d')](0x1f4,[config[_0x5758('0x13')]['ip'],config['asterisk']['username'],_0x5758('0x1f')][_0x5758('0x15')]('\x20')));}var _0x41c7bf=schema(properties['voicechannel'])[_0x5758('0x2')](_0x4ef7ed);if(_0x41c7bf['length']>0x0){return _0x32d907(_0x194b23[_0x5758('0x1d')](0x1f4,_[_0x5758('0x59')](_0x41c7bf,_0x5758('0x1c'))[_0x5758('0x15')](',\x20')));}var _0x13579a=_[_0x5758('0x5d')](_0x195a6c['channels'],{'uniqueid':_0x4ef7ed['uniqueid']});if(_0x13579a){return BPromise['resolve']()[_0x5758('0x22')](function(){if(_0x13579a[_0x5758('0x5b')]){return ami[_0x5758('0x1b')]({'action':_0x5758('0x68'),'channel':_0x13579a[_0x5758('0x5b')],'mixmonitorid':_0x4ef7ed[_0x5758('0x63')]})['catch'](function(_0xf0ecac){});}})[_0x5758('0x22')](function(){if(_0x13579a['destinationchannel']){return ami['Action']({'action':_0x5758('0x68'),'channel':_0x13579a['destinationchannel'],'mixmonitorid':_0x4ef7ed[_0x5758('0x63')]})[_0x5758('0x66')](function(_0x4f66fd){});}})[_0x5758('0x22')](function(_0x438f9f){var _0x19ecdb=_[_0x5758('0x5d')](_0x13579a['monitors'],{'mixmonitorid':_0x4ef7ed['mixmonitorid']});if(_0x19ecdb){_0x19ecdb['status']=_0x5758('0x69');}})[_0x5758('0x22')](function(){var _0x495f59=util[_0x5758('0x9')]('%s.%s',_0x4ef7ed['filename']||_0x4ef7ed[_0x5758('0x5a')],_0x4ef7ed[_0x5758('0x9')]||_0x5758('0x6a'));var _0x1f4958=_[_0x5758('0x5d')](_0x13579a['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x495f59['toLowerCase']()});if(_0x1f4958){_0x1f4958[_0x5758('0x6b')]=_0x5758('0x69');}})[_0x5758('0x22')](function(){_0x28c45d({'code':0xc8,'message':[_0x4ef7ed[_0x5758('0x5a')],_0x5758('0x6c')][_0x5758('0x15')]('\x20')});})[_0x5758('0x66')](function(_0x344495){_0x32d907(_0x194b23[_0x5758('0x1d')](0x1f5,[_0x4ef7ed[_0x5758('0x5a')],_0x344495[_0x5758('0x1c')][_0x5758('0x60')]()]['join']('\x20')));});}else{return _0x32d907(_0x194b23[_0x5758('0x1d')](0x1f5,_0x5758('0x67')));}});},'VoiceQueuesChannels':function(_0xd1a1b6){return new Promise(function(_0x507785,_0x36b170){var _0x2c1667=_[_0x5758('0x56')](_0x195a6c[_0x5758('0x6d')]);_0x507785({'count':_0x2c1667[_0x5758('0x55')],'rows':_0x2c1667});});},'VoiceQueuesChannel':function(_0x57f529){var _0x4a7a94=this;return new Promise(function(_0x2acc93,_0x105f9f){var _0x113c77=schema(properties[_0x5758('0x6e')])[_0x5758('0x2')](_0x57f529);if(_0x113c77[_0x5758('0x55')]>0x0){return _0x105f9f(_0x4a7a94[_0x5758('0x1d')](0x1f4,_[_0x5758('0x59')](_0x113c77,_0x5758('0x1c'))['join'](',\x20')));}var _0x5eea5f=_[_0x5758('0x5d')](_0x195a6c[_0x5758('0x6d')],{'uniqueid':_0x57f529['uniqueid']});if(_0x5eea5f){_0x2acc93(_0x5eea5f);}else{return _0x105f9f(_0x4a7a94[_0x5758('0x1d')](0x1f5,_0x5758('0x67')));}});},'VoiceQueuesChannelHangup':function(_0x39d47f){var _0x465a5f=this;return new Promise(function(_0x39bc2d,_0x4d0570){if(ami[_0x5758('0x1e')]()==![]){return _0x4d0570(_0x465a5f[_0x5758('0x1d')](0x1f4,[config[_0x5758('0x13')]['ip'],config[_0x5758('0x13')][_0x5758('0x14')],'ami\x20disconnected'][_0x5758('0x15')]('\x20')));}var _0x36f051=schema(properties[_0x5758('0x6f')])['validate'](_0x39d47f);if(_0x36f051[_0x5758('0x55')]>0x0){return _0x4d0570(_0x465a5f[_0x5758('0x1d')](0x1f4,_[_0x5758('0x59')](_0x36f051,_0x5758('0x1c'))[_0x5758('0x15')](',\x20')));}var _0x3a1d3a=_[_0x5758('0x5d')](_0x195a6c['queueChannels'],{'uniqueid':_0x39d47f[_0x5758('0x5a')]});if(_0x3a1d3a&&_0x3a1d3a['channel']){return ami[_0x5758('0x1b')]({'action':_0x5758('0x70'),'channel':_0x3a1d3a[_0x5758('0x5b')]})[_0x5758('0x22')](function(_0x2c8d82){_0x39bc2d({'code':0xc8,'message':[_0x39d47f[_0x5758('0x5a')],_0x2c8d82['message'][_0x5758('0x60')]()]['join']('\x20')});})['catch'](function(_0x5a10f3){_0x4d0570(_0x465a5f['error'](0x1f5,[_0x39d47f[_0x5758('0x5a')],_0x5a10f3[_0x5758('0x1c')][_0x5758('0x60')]()]['join']('\x20')));});}else{return _0x4d0570(_0x465a5f[_0x5758('0x1d')](0x1f5,_0x5758('0x67')));}});},'VoiceQueuesChannelRedirect':function(_0x15fd6b){var _0x40c6d7=this;return new Promise(function(_0x5583b3,_0x4875ef){if(ami['isConnected']()==![]){return _0x4875ef(_0x40c6d7[_0x5758('0x1d')](0x1f4,[config[_0x5758('0x13')]['ip'],config[_0x5758('0x13')][_0x5758('0x14')],_0x5758('0x1f')][_0x5758('0x15')]('\x20')));}var _0x26b52f=schema(properties[_0x5758('0x71')])[_0x5758('0x2')](_0x15fd6b);if(_0x26b52f[_0x5758('0x55')]>0x0){return _0x4875ef(_0x40c6d7[_0x5758('0x1d')](0x1f4,_[_0x5758('0x59')](_0x26b52f,_0x5758('0x1c'))[_0x5758('0x15')](',\x20')));}var _0x10e090=_['find'](_0x195a6c[_0x5758('0x6d')],{'uniqueid':_0x15fd6b['uniqueid']});if(_0x10e090&&_0x10e090[_0x5758('0x5b')]){return ami['Action']({'action':_0x5758('0x72'),'channel':_0x10e090[_0x5758('0x5b')],'exten':_0x15fd6b[_0x5758('0x73')],'context':_0x15fd6b['context']||_0x10e090[_0x5758('0x74')],'priority':0x1})[_0x5758('0x22')](function(_0x5517a3){_0x5583b3({'code':0xc8,'message':[_0x15fd6b[_0x5758('0x5a')],_0x5517a3[_0x5758('0x1c')][_0x5758('0x60')]()]['join']('\x20')});})[_0x5758('0x66')](function(_0x1435e1){_0x4875ef(_0x40c6d7[_0x5758('0x1d')](0x1f5,[_0x15fd6b[_0x5758('0x5a')],_0x1435e1[_0x5758('0x1c')][_0x5758('0x60')]()]['join']('\x20')));});}else{return _0x4875ef(_0x40c6d7['error'](0x1f5,_0x5758('0x67')));}});},'Agents':function(_0x489bc2){return new Promise(function(_0x388a42,_0x881e2c){var _0x592050=_[_0x5758('0x56')](_0x195a6c[_0x5758('0xf')]);_0x388a42({'count':_0x592050[_0x5758('0x55')],'rows':_0x592050});});},'Telephones':function(_0x339b83){return new Promise(function(_0x5c653a,_0x3c6580){var _0x325e6f=_[_0x5758('0x56')](_0x195a6c[_0x5758('0x75')]);_0x5c653a({'count':_0x325e6f['length'],'rows':_0x325e6f});});},'Trunks':function(_0xbbc3ac){return new Promise(function(_0x589999,_0x3cd24d){var _0x3ae096=_['values'](_0x195a6c[_0x5758('0x76')]);_0x589999({'count':_0x3ae096[_0x5758('0x55')],'rows':_0x3ae096});});},'OutboundChannels':function(_0x240a14){return new Promise(function(_0x3cef47,_0xa5ac16){var _0x1df9dc=_[_0x5758('0x56')](_0x195a6c[_0x5758('0x77')]);_0x3cef47({'count':_0x1df9dc['length'],'rows':_0x1df9dc});});},'Outbound':function(_0x17c7e8){return new Promise(function(_0x23cce6,_0x578516){_0x23cce6(_0x195a6c['outbound']);});},'Campaigns':function(_0x2e4229){return new Promise(function(_0x481ef0,_0x47c6df){var _0x4c58b1=_[_0x5758('0x56')](_0x195a6c[_0x5758('0x78')]);_0x481ef0({'count':_0x4c58b1[_0x5758('0x55')],'rows':_0x4c58b1});});},'VoiceQueuesPreview':function(_0x41d24a){var _0x30eb9a=this;return new Promise(function(_0x111349,_0x43c811){_0x55ee6c[_0x5758('0x79')](_0x41d24a['id'])[_0x5758('0x22')](function(_0x3859a4){_0x111349({'code':0xc8,'message':_0x3859a4[_0x5758('0x1c')]});})['catch'](function(_0x587db1){_0x43c811(_0x30eb9a[_0x5758('0x1d')](0x1f4,_0x587db1[_0x5758('0x1c')]));});});},'EventManager':function(_0x50697a){var _0x3c0ca4=this;return new Promise(function(_0x3958bc,_0x2af14b){if(!_0x50697a[_0x5758('0x7a')]){return _0x2af14b(_0x3c0ca4[_0x5758('0x1d')](0x1f4,_0x5758('0x7b')));}ami[_0x5758('0x7c')](_0x5758('0x7d')+_0x50697a[_0x5758('0x7a')],_0x50697a['message']);_0x3958bc({'code':0xc8,'message':_0x50697a});});},'FaxAccounts':function(_0x4dd9fd){return new Promise(function(_0x1f2667,_0x3d2438){var _0x501099=_[_0x5758('0x56')](_0x195a6c[_0x5758('0x7e')]);_0x1f2667({'count':_0x501099[_0x5758('0x55')],'rows':_0x501099});});},'SendFax':function(_0x5b4f68){var _0x383368=this;return new Promise(function(_0x26b9c0,_0xc3a0bd){_0x1fedfd[_0x5758('0x7f')](_0x5b4f68)[_0x5758('0x22')](function(_0x1d2de8){_0x26b9c0({'code':0xc8,'message':_0x1d2de8[_0x5758('0x1c')]});})[_0x5758('0x66')](function(_0x139dd2){_0xc3a0bd(_0x383368['error'](0x1f4,_0x139dd2[_0x5758('0x1c')]));});});},'CheckAfterSend':function(_0x10ea21){var _0x5cb9bc=this;return new Promise(function(_0x358386,_0x40c657){_0x1fedfd[_0x5758('0x80')](_0x10ea21)['then'](function(_0x5f10cc){_0x358386({'code':0xc8,'message':_0x5f10cc['message']});})[_0x5758('0x66')](function(_0x3a07af){_0x40c657(_0x5cb9bc[_0x5758('0x1d')](0x1f4,_0x3a07af[_0x5758('0x1c')]));});});}};var _0x3e5b58=jayson['server'](_0x1cd473)[_0x5758('0x81')]();_0x3e5b58['on'](_0x5758('0x1d'),function(_0x2254cc){return _0x40c99c(_0x2254cc);});_0x3e5b58[_0x5758('0x8')](0x232a,'127.0.0.1',function(){console[_0x5758('0x82')](_0x5758('0x83'),0x232a);return _0x518696(_0x5758('0x84')+0x232a);});});}; \ No newline at end of file +var _0x0941=['outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','push','length','values','validate','find','channels','uniqueid','channel','%s.%s','filename','MixMonitor','ai(mixmonitorid)','monitors','toLowerCase','/var/spool/asterisk/monitor/','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicechannel','map','resolve','StopMixMonitor','destinationchannel','stop','wav','queueChannels','voicequeuechannel','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','send','checkAfterSend','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','jayson/promise','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Action','message','catch','command','Command','then','content','hasOwnProperty','voiceQueues','strategy','answered','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout'];(function(_0x5282a6,_0x2d937e){var _0x1b7783=function(_0x160825){while(--_0x160825){_0x5282a6['push'](_0x5282a6['shift']());}};_0x1b7783(++_0x2d937e);}(_0x0941,0xd7));var _0x1094=function(_0x290417,_0x68e571){_0x290417=_0x290417-0x0;var _0x90b1bf=_0x0941[_0x290417];return _0x90b1bf;};'use strict';var _=require(_0x1094('0x0'));var util=require('util');var jayson=require(_0x1094('0x1'));var schema=require('validate');var BPromise=require(_0x1094('0x2'));var moment=require(_0x1094('0x3'));var config=require(_0x1094('0x4'));var properties=require(_0x1094('0x5'));var ami=require(_0x1094('0x6'));exports[_0x1094('0x7')]=function(_0x127993,_0x284007,_0x4050cf){return new BPromise(function(_0x3cd366,_0x128cfb){var _0x14f4ee={'QueuePause':function(_0x238315){return new Promise(function(_0x13d5f0,_0x4dd146){var _0x5df388=util[_0x1094('0x8')]('%s/%s','SIP',_0x238315['name']);if(_0x127993['timers']&&_0x127993[_0x1094('0x9')][_0x5df388]&&_0x127993[_0x1094('0x9')][_0x5df388][_0x1094('0xa')]){_0x127993[_0x1094('0x9')][_0x5df388][_0x1094('0xb')]();}if(_0x127993[_0x1094('0xc')][_0x5df388]){_0x127993['agents'][_0x5df388][_0x1094('0xd')]({'statePause':_0x238315[_0x1094('0xe')]?!![]:![]});}_0x13d5f0({'code':0xc8,'message':_0x1094('0xf')});});},'Reload':function(_0x2ddabc){var _0x2dc1b2=this;return new Promise(function(_0x5173e8,_0x5787bc){if(ami[_0x1094('0x10')]()==![]){return _0x5787bc(_0x2dc1b2[_0x1094('0x11')](0x1f4,[config[_0x1094('0x12')]['ip'],config[_0x1094('0x12')][_0x1094('0x13')],_0x1094('0x14')][_0x1094('0x15')]('\x20')));}_0x2ddabc=_[_0x1094('0x16')](_0x2ddabc,_[_0x1094('0x17')](properties[_0x1094('0x18')]));_0x2ddabc[_0x1094('0x19')]='Reload';return ami[_0x1094('0x1a')](_0x2ddabc)['then'](function(_0x58fbdf){_0x5173e8({'code':0xc8,'message':_0x58fbdf[_0x1094('0x1b')]});})[_0x1094('0x1c')](function(_0x3dd0fe){_0x5787bc(_0x2dc1b2['error'](0x1f5,_0x3dd0fe[_0x1094('0x1b')]));});});},'Command':function(_0x50d455){var _0x478e48=this;return new Promise(function(_0x47d81b,_0x2cc24f){if(ami['isConnected']()==![]){return _0x2cc24f(_0x478e48[_0x1094('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x1094('0x12')][_0x1094('0x13')],_0x1094('0x14')][_0x1094('0x15')]('\x20')));}_0x50d455=_[_0x1094('0x16')](_0x50d455,_0x1094('0x1d'));_0x50d455['action']=_0x1094('0x1e');return ami[_0x1094('0x1a')](_0x50d455)[_0x1094('0x1f')](function(_0x24cdea){_0x47d81b({'code':0xc8,'message':_0x24cdea[_0x1094('0x20')]});})['catch'](function(_0xe677b1){_0x2cc24f(_0x478e48['error'](0x1f5,_0xe677b1[_0x1094('0x1b')]));});});},'VoiceQueues':function(_0x5b7f59){return new Promise(function(_0x32fd99,_0x2cb585){var _0x44539b=[];for(var _0x847f30 in _0x127993['voiceQueues']){if(_0x127993['voiceQueues'][_0x1094('0x21')](_0x847f30)){var _0x239501=_0x127993[_0x1094('0x22')][_0x847f30];var _0x4bacb5={'id':_0x239501['id'],'name':_0x239501['name'],'strategy':_0x239501[_0x1094('0x23')],'answered':_0x239501[_0x1094('0x24')],'available':_0x239501['available'],'loggedIn':_0x239501['loggedIn'],'pTalking':_0x239501[_0x1094('0x25')],'sumBillable':_0x239501[_0x1094('0x26')],'sumDuration':_0x239501[_0x1094('0x27')],'sumHoldTime':_0x239501[_0x1094('0x28')]||0x0,'talking':_0x239501[_0x1094('0x29')],'total':_0x239501[_0x1094('0x2a')],'type':_0x239501[_0x1094('0x2b')],'unmanaged':_0x239501[_0x1094('0x2c')],'abandoned':_0x239501[_0x1094('0x2d')],'waiting':_0x239501[_0x1094('0x2e')],'loggedInDb':_0x239501[_0x1094('0x2f')]};if(_0x239501[_0x1094('0x2b')]===_0x1094('0x30')){_0x4bacb5[_0x1094('0x31')]=_0x239501[_0x1094('0x31')];_0x4bacb5[_0x1094('0x32')]=_0x239501['dialMethod'];_0x4bacb5[_0x1094('0x33')]=_0x239501[_0x1094('0x33')];_0x4bacb5[_0x1094('0x34')]=_0x239501[_0x1094('0x34')];_0x4bacb5[_0x1094('0x35')]=_0x239501[_0x1094('0x35')];_0x4bacb5[_0x1094('0x36')]=_0x239501[_0x1094('0x36')];_0x4bacb5[_0x1094('0x37')]=_0x239501[_0x1094('0x37')];_0x4bacb5[_0x1094('0x38')]=_0x239501[_0x1094('0x38')];_0x4bacb5[_0x1094('0x39')]=_0x239501['outboundBlacklistCallsDay'];_0x4bacb5[_0x1094('0x3a')]=_0x239501['outboundBusyCallsDay'];_0x4bacb5[_0x1094('0x3b')]=_0x239501[_0x1094('0x3b')];_0x4bacb5[_0x1094('0x3c')]=_0x239501['outboundDropCallsDayACS'];_0x4bacb5[_0x1094('0x3d')]=_0x239501[_0x1094('0x3d')];_0x4bacb5[_0x1094('0x3e')]=_0x239501['outboundDropCallsDayTimeout'];_0x4bacb5[_0x1094('0x3f')]=_0x239501[_0x1094('0x3f')];_0x4bacb5['outboundNoSuchCallsDay']=_0x239501[_0x1094('0x40')];_0x4bacb5[_0x1094('0x41')]=_0x239501[_0x1094('0x41')];_0x4bacb5[_0x1094('0x42')]=_0x239501[_0x1094('0x42')];_0x4bacb5[_0x1094('0x43')]=_0x239501[_0x1094('0x43')];_0x4bacb5[_0x1094('0x44')]=_0x239501[_0x1094('0x44')];_0x4bacb5[_0x1094('0x45')]=_0x239501['predictiveIntervalAnsweredCalls'];_0x4bacb5[_0x1094('0x46')]=_0x239501[_0x1094('0x46')];_0x4bacb5[_0x1094('0x47')]=_0x239501[_0x1094('0x47')];_0x4bacb5['predictiveIntervalDroppedCallsCallersExit']=_0x239501[_0x1094('0x48')];_0x4bacb5[_0x1094('0x49')]=_0x239501[_0x1094('0x49')];_0x4bacb5[_0x1094('0x4a')]=_0x239501['predictiveIntervalErlangCalls'];_0x4bacb5['predictiveIntervalErlangCallsDroppedCalls']=_0x239501[_0x1094('0x4b')];_0x4bacb5[_0x1094('0x4c')]=_0x239501[_0x1094('0x4c')];_0x4bacb5[_0x1094('0x4d')]=_0x239501[_0x1094('0x4d')];_0x4bacb5[_0x1094('0x4e')]=_0x239501['predictiveIntervalPauses'];_0x4bacb5[_0x1094('0x4f')]=_0x239501[_0x1094('0x4f')];_0x4bacb5['predictiveIntervalTotalCalls']=_0x239501[_0x1094('0x50')];_0x4bacb5[_0x1094('0x1b')]=_0x239501[_0x1094('0x1b')];_0x4bacb5['originated']=_0x239501[_0x1094('0x51')];_0x4bacb5[_0x1094('0x52')]=_0x239501[_0x1094('0x52')];_0x4bacb5['erlangCallToSecond']=_0x239501['erlangCallToSecond'];_0x4bacb5[_0x1094('0x53')]=_0x239501[_0x1094('0x53')];_0x4bacb5[_0x1094('0x54')]=_0x239501[_0x1094('0x54')];_0x4bacb5[_0x1094('0x55')]=_0x239501[_0x1094('0x55')];_0x4bacb5['startProgressive']=_0x239501[_0x1094('0x56')];}if(_0x239501[_0x1094('0x57')]){_0x4bacb5[_0x1094('0x57')]={'id':_0x239501[_0x1094('0x57')]['id'],'name':_0x239501[_0x1094('0x57')][_0x1094('0x58')],'active':_0x239501[_0x1094('0x57')][_0x1094('0x59')],'callerid':_0x239501[_0x1094('0x57')][_0x1094('0x5a')]};}if(_0x239501[_0x1094('0x5b')]){_0x4bacb5[_0x1094('0x5b')]={'id':_0x239501[_0x1094('0x5b')]['id'],'name':_0x239501['Interval'][_0x1094('0x58')]};}_0x44539b[_0x1094('0x5c')](_0x4bacb5);}}_0x32fd99({'count':_0x44539b[_0x1094('0x5d')],'rows':_0x44539b});});},'VoiceChannels':function(_0xd97e26){return new Promise(function(_0x51e991,_0x2a801b){var _0x4b412c=_[_0x1094('0x5e')](_0x127993['channels']);_0x51e991({'count':_0x4b412c[_0x1094('0x5d')],'rows':_0x4b412c});});},'VoiceChannelMixMonitor':function(_0x2c55e8){var _0x34d1a2=this;return new Promise(function(_0x4911f9,_0x5e5d37){if(ami['isConnected']()==![]){return _0x5e5d37(_0x34d1a2[_0x1094('0x11')](0x1f4,[config[_0x1094('0x12')]['ip'],config['asterisk'][_0x1094('0x13')],'ami\x20disconnected'][_0x1094('0x15')]('\x20')));}var _0x234d8e=schema(properties['voicechannel'])[_0x1094('0x5f')](_0x2c55e8);if(_0x234d8e['length']>0x0){return _0x5e5d37(_0x34d1a2[_0x1094('0x11')](0x1f4,_['map'](_0x234d8e,_0x1094('0x1b'))['join'](',\x20')));}var _0x746aa7=_[_0x1094('0x60')](_0x127993[_0x1094('0x61')],{'uniqueid':_0x2c55e8[_0x1094('0x62')]});if(_0x746aa7&&_0x746aa7[_0x1094('0x63')]){var _0x6bd585=util[_0x1094('0x8')](_0x1094('0x64'),_0x2c55e8[_0x1094('0x65')]||_0x2c55e8['uniqueid'],_0x2c55e8[_0x1094('0x8')]||'wav');return ami[_0x1094('0x1a')]({'action':_0x1094('0x66'),'channel':_0x746aa7[_0x1094('0x63')],'file':_0x6bd585,'options':_0x1094('0x67')})[_0x1094('0x1f')](function(_0x9cc0d4){var _0x51b306=_[_0x1094('0x60')](_0x746aa7[_0x1094('0x68')],{'filename':'/var/spool/asterisk/monitor/'+_0x6bd585[_0x1094('0x69')]()});if(_['isNil'](_0x51b306)){_0x746aa7[_0x1094('0x68')][_0x1094('0x5c')]({'filename':_0x1094('0x6a')+_0x6bd585['toLowerCase'](),'createdAt':moment()[_0x1094('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x9cc0d4[_0x1094('0x6b')],'status':_0x1094('0x6c')});}else{_0x51b306[_0x1094('0x6b')]=_0x9cc0d4['mixmonitorid'];_0x51b306[_0x1094('0x6d')]=_0x1094('0x6c');}_0x4911f9({'code':0xc8,'message':[_0x2c55e8[_0x1094('0x62')],_0x1094('0x6e'),_0x9cc0d4[_0x1094('0x6b')]][_0x1094('0x15')]('\x20'),'mixmonitorid':_0x9cc0d4['mixmonitorid']});})[_0x1094('0x1c')](function(_0x341055){_0x5e5d37(_0x34d1a2[_0x1094('0x11')](0x1f5,[_0x2c55e8['uniqueid'],_0x341055[_0x1094('0x1b')]['toLowerCase']()][_0x1094('0x15')]('\x20')));});}else{return _0x5e5d37(_0x34d1a2[_0x1094('0x11')](0x1f5,_0x1094('0x6f')));}});},'VoiceChannelStopMixMonitor':function(_0x4f6d65){var _0x6893e3=this;return new Promise(function(_0x249d65,_0x51c18b){if(ami[_0x1094('0x10')]()==![]){return _0x51c18b(_0x6893e3[_0x1094('0x11')](0x1f4,[config[_0x1094('0x12')]['ip'],config[_0x1094('0x12')][_0x1094('0x13')],_0x1094('0x14')][_0x1094('0x15')]('\x20')));}var _0x486d75=schema(properties[_0x1094('0x70')])[_0x1094('0x5f')](_0x4f6d65);if(_0x486d75[_0x1094('0x5d')]>0x0){return _0x51c18b(_0x6893e3[_0x1094('0x11')](0x1f4,_[_0x1094('0x71')](_0x486d75,_0x1094('0x1b'))[_0x1094('0x15')](',\x20')));}var _0x38f367=_[_0x1094('0x60')](_0x127993[_0x1094('0x61')],{'uniqueid':_0x4f6d65[_0x1094('0x62')]});if(_0x38f367){return BPromise[_0x1094('0x72')]()['then'](function(){if(_0x38f367[_0x1094('0x63')]){return ami[_0x1094('0x1a')]({'action':_0x1094('0x73'),'channel':_0x38f367[_0x1094('0x63')],'mixmonitorid':_0x4f6d65[_0x1094('0x6b')]})['catch'](function(_0x5da5db){});}})[_0x1094('0x1f')](function(){if(_0x38f367[_0x1094('0x74')]){return ami[_0x1094('0x1a')]({'action':_0x1094('0x73'),'channel':_0x38f367[_0x1094('0x74')],'mixmonitorid':_0x4f6d65[_0x1094('0x6b')]})[_0x1094('0x1c')](function(_0x23d18d){});}})[_0x1094('0x1f')](function(_0x2b0647){var _0xe9736f=_[_0x1094('0x60')](_0x38f367['monitors'],{'mixmonitorid':_0x4f6d65[_0x1094('0x6b')]});if(_0xe9736f){_0xe9736f[_0x1094('0x6d')]=_0x1094('0x75');}})[_0x1094('0x1f')](function(){var _0x46ac0e=util['format'](_0x1094('0x64'),_0x4f6d65['filename']||_0x4f6d65[_0x1094('0x62')],_0x4f6d65['format']||_0x1094('0x76'));var _0x5921df=_[_0x1094('0x60')](_0x38f367['monitors'],{'filename':_0x1094('0x6a')+_0x46ac0e['toLowerCase']()});if(_0x5921df){_0x5921df[_0x1094('0x6d')]='stop';}})[_0x1094('0x1f')](function(){_0x249d65({'code':0xc8,'message':[_0x4f6d65[_0x1094('0x62')],'StopMixMonitor\x20Success'][_0x1094('0x15')]('\x20')});})['catch'](function(_0x4d323d){_0x51c18b(_0x6893e3[_0x1094('0x11')](0x1f5,[_0x4f6d65[_0x1094('0x62')],_0x4d323d[_0x1094('0x1b')][_0x1094('0x69')]()][_0x1094('0x15')]('\x20')));});}else{return _0x51c18b(_0x6893e3['error'](0x1f5,_0x1094('0x6f')));}});},'VoiceQueuesChannels':function(_0x415019){return new Promise(function(_0x449d26,_0x216255){var _0x4b9769=_[_0x1094('0x5e')](_0x127993[_0x1094('0x77')]);_0x449d26({'count':_0x4b9769[_0x1094('0x5d')],'rows':_0x4b9769});});},'VoiceQueuesChannel':function(_0x59e13d){var _0x3a6dc5=this;return new Promise(function(_0x159059,_0x134f81){var _0x48307b=schema(properties[_0x1094('0x78')])[_0x1094('0x5f')](_0x59e13d);if(_0x48307b['length']>0x0){return _0x134f81(_0x3a6dc5[_0x1094('0x11')](0x1f4,_['map'](_0x48307b,'message')['join'](',\x20')));}var _0x2ea4d1=_[_0x1094('0x60')](_0x127993[_0x1094('0x77')],{'uniqueid':_0x59e13d[_0x1094('0x62')]});if(_0x2ea4d1){_0x159059(_0x2ea4d1);}else{return _0x134f81(_0x3a6dc5[_0x1094('0x11')](0x1f5,_0x1094('0x6f')));}});},'VoiceQueuesChannelHangup':function(_0x5a8051){var _0x5a28a9=this;return new Promise(function(_0x299165,_0x411228){if(ami[_0x1094('0x10')]()==![]){return _0x411228(_0x5a28a9[_0x1094('0x11')](0x1f4,[config[_0x1094('0x12')]['ip'],config[_0x1094('0x12')]['username'],'ami\x20disconnected'][_0x1094('0x15')]('\x20')));}var _0x3a53f2=schema(properties['voicequeuechannelhangup'])[_0x1094('0x5f')](_0x5a8051);if(_0x3a53f2[_0x1094('0x5d')]>0x0){return _0x411228(_0x5a28a9[_0x1094('0x11')](0x1f4,_['map'](_0x3a53f2,_0x1094('0x1b'))[_0x1094('0x15')](',\x20')));}var _0x3179d7=_['find'](_0x127993['queueChannels'],{'uniqueid':_0x5a8051['uniqueid']});if(_0x3179d7&&_0x3179d7['channel']){return ami[_0x1094('0x1a')]({'action':'Hangup','channel':_0x3179d7['channel']})[_0x1094('0x1f')](function(_0x5783f2){_0x299165({'code':0xc8,'message':[_0x5a8051[_0x1094('0x62')],_0x5783f2[_0x1094('0x1b')][_0x1094('0x69')]()][_0x1094('0x15')]('\x20')});})[_0x1094('0x1c')](function(_0x386abe){_0x411228(_0x5a28a9[_0x1094('0x11')](0x1f5,[_0x5a8051['uniqueid'],_0x386abe[_0x1094('0x1b')][_0x1094('0x69')]()][_0x1094('0x15')]('\x20')));});}else{return _0x411228(_0x5a28a9[_0x1094('0x11')](0x1f5,_0x1094('0x6f')));}});},'VoiceQueuesChannelRedirect':function(_0x1bed15){var _0x54ab0e=this;return new Promise(function(_0x43e5dd,_0x52c3b4){if(ami[_0x1094('0x10')]()==![]){return _0x52c3b4(_0x54ab0e[_0x1094('0x11')](0x1f4,[config[_0x1094('0x12')]['ip'],config[_0x1094('0x12')][_0x1094('0x13')],'ami\x20disconnected']['join']('\x20')));}var _0x37104f=schema(properties[_0x1094('0x79')])[_0x1094('0x5f')](_0x1bed15);if(_0x37104f['length']>0x0){return _0x52c3b4(_0x54ab0e[_0x1094('0x11')](0x1f4,_[_0x1094('0x71')](_0x37104f,_0x1094('0x1b'))['join'](',\x20')));}var _0x22a21b=_[_0x1094('0x60')](_0x127993[_0x1094('0x77')],{'uniqueid':_0x1bed15[_0x1094('0x62')]});if(_0x22a21b&&_0x22a21b['channel']){return ami['Action']({'action':_0x1094('0x7a'),'channel':_0x22a21b[_0x1094('0x63')],'exten':_0x1bed15[_0x1094('0x7b')],'context':_0x1bed15[_0x1094('0x7c')]||_0x22a21b['context'],'priority':0x1})[_0x1094('0x1f')](function(_0x6a6dbe){_0x43e5dd({'code':0xc8,'message':[_0x1bed15[_0x1094('0x62')],_0x6a6dbe[_0x1094('0x1b')][_0x1094('0x69')]()][_0x1094('0x15')]('\x20')});})[_0x1094('0x1c')](function(_0x489723){_0x52c3b4(_0x54ab0e[_0x1094('0x11')](0x1f5,[_0x1bed15[_0x1094('0x62')],_0x489723[_0x1094('0x1b')][_0x1094('0x69')]()][_0x1094('0x15')]('\x20')));});}else{return _0x52c3b4(_0x54ab0e['error'](0x1f5,_0x1094('0x6f')));}});},'Agents':function(_0x31b1b7){return new Promise(function(_0x58bebd,_0x1385ea){var _0x50e51e=_[_0x1094('0x5e')](_0x127993['agents']);_0x58bebd({'count':_0x50e51e[_0x1094('0x5d')],'rows':_0x50e51e});});},'Telephones':function(_0x3203d9){return new Promise(function(_0x325bad,_0x3bfad3){var _0x5312c0=_[_0x1094('0x5e')](_0x127993[_0x1094('0x7d')]);_0x325bad({'count':_0x5312c0[_0x1094('0x5d')],'rows':_0x5312c0});});},'Trunks':function(_0x29e742){return new Promise(function(_0x18017d,_0x48ee4c){var _0x31cfa8=_['values'](_0x127993[_0x1094('0x7e')]);_0x18017d({'count':_0x31cfa8[_0x1094('0x5d')],'rows':_0x31cfa8});});},'OutboundChannels':function(_0x23f118){return new Promise(function(_0x3588fe,_0x4043e4){var _0x2d8b0a=_[_0x1094('0x5e')](_0x127993[_0x1094('0x7f')]);_0x3588fe({'count':_0x2d8b0a['length'],'rows':_0x2d8b0a});});},'Outbound':function(_0x583738){return new Promise(function(_0x568c9e,_0x2301a2){_0x568c9e(_0x127993[_0x1094('0x30')]);});},'Campaigns':function(_0x22a825){return new Promise(function(_0x3c9d67,_0xbb86e9){var _0x38db28=_[_0x1094('0x5e')](_0x127993['campaigns']);_0x3c9d67({'count':_0x38db28[_0x1094('0x5d')],'rows':_0x38db28});});},'VoiceQueuesPreview':function(_0x382e58){var _0xaefbfc=this;return new Promise(function(_0xe83290,_0xa4b659){_0x284007[_0x1094('0x80')](_0x382e58['id'])['then'](function(_0x92a54b){_0xe83290({'code':0xc8,'message':_0x92a54b[_0x1094('0x1b')]});})['catch'](function(_0x49f278){_0xa4b659(_0xaefbfc['error'](0x1f4,_0x49f278[_0x1094('0x1b')]));});});},'EventManager':function(_0x2379c8){var _0x4f3261=this;return new Promise(function(_0x54d26b,_0x1f59be){if(!_0x2379c8['event']){return _0x1f59be(_0x4f3261['error'](0x1f4,_0x1094('0x81')));}ami[_0x1094('0x82')](_0x1094('0x83')+_0x2379c8[_0x1094('0x84')],_0x2379c8[_0x1094('0x1b')]);_0x54d26b({'code':0xc8,'message':_0x2379c8});});},'FaxAccounts':function(_0xb59954){return new Promise(function(_0x4549fb,_0x120375){var _0x91776=_[_0x1094('0x5e')](_0x127993[_0x1094('0x85')]);_0x4549fb({'count':_0x91776[_0x1094('0x5d')],'rows':_0x91776});});},'SendFax':function(_0x53b15d){var _0x371818=this;return new Promise(function(_0x1c61fd,_0x20f108){_0x4050cf[_0x1094('0x86')](_0x53b15d)[_0x1094('0x1f')](function(_0x119b01){_0x1c61fd({'code':0xc8,'message':_0x119b01['message']});})[_0x1094('0x1c')](function(_0x52b988){_0x20f108(_0x371818[_0x1094('0x11')](0x1f4,_0x52b988['message']));});});},'CheckAfterSend':function(_0x458386){var _0x2cef06=this;return new Promise(function(_0x5f19a0,_0x499a87){_0x4050cf[_0x1094('0x87')](_0x458386)['then'](function(_0x38cba6){_0x5f19a0({'code':0xc8,'message':_0x38cba6[_0x1094('0x1b')]});})[_0x1094('0x1c')](function(_0x3df808){_0x499a87(_0x2cef06[_0x1094('0x11')](0x1f4,_0x3df808[_0x1094('0x1b')]));});});}};var _0x5d02a1=jayson['server'](_0x14f4ee)[_0x1094('0x88')]();_0x5d02a1['on'](_0x1094('0x11'),function(_0x27bd30){return _0x128cfb(_0x27bd30);});_0x5d02a1[_0x1094('0x7')](0x232a,'127.0.0.1',function(){console[_0x1094('0x89')](_0x1094('0x8a'),0x232a);return _0x3cd366('RPC\x20listening\x20on\x20port:'+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 6d2bfd8..9757349 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 _0x5221=['mobile','fax','ListId','updatedAt','union','resolve','getContacts','then','isEmpty','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridnum','calleridname','Unknown','firstName','destcalleridname','','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','toLowerCase','length','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid','data3','split','phone','map','routeId','destcalleridnum','lastName'];(function(_0x444bd5,_0x1150da){var _0x3fe6c7=function(_0x2336da){while(--_0x2336da){_0x444bd5['push'](_0x444bd5['shift']());}};_0x3fe6c7(++_0x1150da);}(_0x5221,0x1f0));var _0x1522=function(_0x5f1332,_0x4d2792){_0x5f1332=_0x5f1332-0x0;var _0x5d3947=_0x5221[_0x5f1332];return _0x5d3947;};'use strict';var _=require(_0x1522('0x0'));var BPromise=require(_0x1522('0x1'));var Redis=require(_0x1522('0x2'));var util=require(_0x1522('0x3'));var config=require(_0x1522('0x4'));var logger=require(_0x1522('0x5'))(_0x1522('0x6'));var cmContactRpc=require('../../rpc/cmContact');config[_0x1522('0x7')]=_[_0x1522('0x8')](config[_0x1522('0x7')],{'host':_0x1522('0x9'),'port':0x18eb});var io=require(_0x1522('0xa'))(new Redis(config['redis']));function emit(_0x23077a,_0x190e49,_0xd25db0,_0x307c31,_0xb8b723){logger[_0x1522('0xb')](_0x1522('0xc'),_0x23077a,_0x190e49['id'],_0xd25db0,_0x307c31,JSON[_0x1522('0xd')](_0xb8b723));io['to'](_0xd25db0)[_0x1522('0xe')](_0x307c31,_0xb8b723);}exports[_0x1522('0xf')]=function(_0xca9cf0,_0x132029,_0x35829f,_0x1f5c80){var _0x132317,_0x3966aa;var _0x1b71a7={};var _0x5cd81f=Number(_0x35829f[_0x1522('0x10')]);var _0x3e5060=_0x35829f[_0x1522('0x11')]?Boolean(Number(_0x35829f['data2'])):![];var _0x3e4f0b;if(_0x1f5c80[_0x1522('0x12')]){_0x1b71a7['id']=_0x1f5c80['xmd-contactid'];}if(!_0x1b71a7['id']){_0x1b71a7['ListId']=_0x5cd81f;_0x3e4f0b=_0x35829f['data3']&&_0x35829f[_0x1522('0x13')]!=='0'?_0x35829f[_0x1522('0x13')][_0x1522('0x14')](','):[_0x1522('0x15')];_0x1b71a7['$or']=_[_0x1522('0x16')](_0x3e4f0b,function(_0x4c43d9){var _0x2b0c21={};_0x2b0c21[_0x4c43d9]=_0x1f5c80[_0x1522('0x17')]?_0x1f5c80[_0x1522('0x18')]:_0x1f5c80['calleridnum'];return _0x2b0c21;});}var _0x5c4fba=['id','firstName',_0x1522('0x19'),_0x1522('0x15'),_0x1522('0x1a'),_0x1522('0x1b'),_0x1522('0x1c'),'createdAt','scheduledAt',_0x1522('0x1d')];var _0x319b92=_[_0x1522('0x1e')](_0x5c4fba,_0x3e4f0b);BPromise[_0x1522('0x1f')]()['then'](cmContactRpc[_0x1522('0x20')]({'attributes':_0x319b92,'where':_0x1b71a7}))[_0x1522('0x21')](function(_0x75ee5b){_0x3966aa=_0x75ee5b;if(!_[_0x1522('0x22')](_0x3966aa)){if(_0x3966aa['length']===0x1){_0x132317=_0x3966aa[0x0];logger[_0x1522('0xb')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x1f5c80[_0x1522('0x23')],_0x132029['id'],_0x132317['id']);}else{logger[_0x1522('0xb')](_0x1522('0x24'),_0x1f5c80['uniqueid'],_0x132029['id'],_[_0x1522('0x16')](_0x3966aa,'id')[_0x1522('0x25')](','));}return;}else{logger[_0x1522('0xb')](_0x1522('0x26'),_0x1f5c80[_0x1522('0x23')],_0x132029['id']);var _0x23b9cd={'ListId':_0x5cd81f};var _0x1bdbf8=_0x35829f['data4']&&_0x35829f['data4']!=='0'?_0x35829f[_0x1522('0x27')]:_0x1522('0x15');if(_0x3e5060){logger[_0x1522('0xb')](_0x1522('0x28'),_0x1f5c80[_0x1522('0x23')],_0x132029['id']);_0x23b9cd[_0x1bdbf8]=_[_0x1522('0x29')](_0x1f5c80[_0x1522('0x17')])?_0x1f5c80[_0x1522('0x2a')]:_0x1f5c80[_0x1522('0x18')];if(_['isNil'](_0x1f5c80[_0x1522('0x17')])){_0x23b9cd['firstName']=_0x1f5c80[_0x1522('0x2b')]&&_0x1f5c80[_0x1522('0x2b')]!==''?_0x1f5c80['calleridname']:_0x1522('0x2c');}else{_0x23b9cd[_0x1522('0x2d')]=_0x1f5c80[_0x1522('0x2e')]&&_0x1f5c80['destcalleridname']!==_0x1522('0x2f')?_0x1f5c80[_0x1522('0x2e')]:_0x1522('0x2c');}return BPromise['resolve']()['then'](cmContactRpc['createContact'](_0x23b9cd))[_0x1522('0x21')](function(_0x2087e1){_0x132317=_0x2087e1;_0x3966aa[_0x1522('0x30')](_0x2087e1);if(_0x132317){logger[_0x1522('0xb')](_0x1522('0x31'),_0x1f5c80['uniqueid'],_0x132029['id'],_0x132317['id']);}return;});}else{logger['info'](_0x1522('0x32'),_0x1f5c80[_0x1522('0x23')],_0x132029['id']);_0x23b9cd[_0x1bdbf8]=_['isNil'](_0x1f5c80['routeId'])?_0x1f5c80[_0x1522('0x2a')]:_0x1f5c80['destcalleridnum'];if(_[_0x1522('0x29')](_0x1f5c80[_0x1522('0x17')])){_0x23b9cd['firstName']=_0x1f5c80['calleridname']&&_0x1f5c80[_0x1522('0x2b')]!==_0x1522('0x2f')?_0x1f5c80['calleridname']:_0x1522('0x2c');}else{_0x23b9cd['firstName']=_0x1f5c80['destcalleridname']&&_0x1f5c80[_0x1522('0x2e')]!==_0x1522('0x2f')?_0x1f5c80[_0x1522('0x2e')]:'Unknown';}_0x132317=_0x23b9cd;_0x3966aa[_0x1522('0x30')](_0x23b9cd);return;}}})[_0x1522('0x21')](function(){if(_0xca9cf0){emit(_0x1f5c80[_0x1522('0x23')],_0x132029,util[_0x1522('0x33')](_0x1522('0x34'),_0xca9cf0[_0x1522('0x35')]),util['format'](_0x1522('0x36'),_0x35829f[_0x1522('0x37')][_0x1522('0x38')]()),{'evt':_['merge'](_0x1f5c80,{'autoCreate':_0x3e5060}),'contact':_0x132317===undefined?{}:_0x132317,'contacts':_0x3966aa[_0x1522('0x39')]===0x0?undefined:_0x3966aa});}});}; \ No newline at end of file +var _0x6084=['uniqueid','info','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridnum','destcalleridnum','firstName','calleridname','','Unknown','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','destcalleridname','format','name','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','length'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6084,0x1df));var _0x4608=function(_0x553d07,_0x3c6c49){_0x553d07=_0x553d07-0x0;var _0x34aec8=_0x6084[_0x553d07];return _0x34aec8;};'use strict';var _=require(_0x4608('0x0'));var BPromise=require(_0x4608('0x1'));var Redis=require(_0x4608('0x2'));var util=require(_0x4608('0x3'));var config=require('../../../../config/environment');var logger=require(_0x4608('0x4'))('trigger');var cmContactRpc=require('../../rpc/cmContact');config[_0x4608('0x5')]=_[_0x4608('0x6')](config[_0x4608('0x5')],{'host':_0x4608('0x7'),'port':0x18eb});var io=require(_0x4608('0x8'))(new Redis(config[_0x4608('0x5')]));function emit(_0x245d83,_0x264d31,_0x2b0e33,_0x5dd98d,_0x171492){logger['info'](_0x4608('0x9'),_0x245d83,_0x264d31['id'],_0x2b0e33,_0x5dd98d,JSON[_0x4608('0xa')](_0x171492));io['to'](_0x2b0e33)[_0x4608('0xb')](_0x5dd98d,_0x171492);}exports[_0x4608('0xc')]=function(_0x358e04,_0x5cb3b0,_0x1eb188,_0xdb93f5){var _0x311323,_0x3bc332;var _0x5a5ffc={};var _0x48a061=Number(_0x1eb188[_0x4608('0xd')]);var _0x415284=_0x1eb188[_0x4608('0xe')]?Boolean(Number(_0x1eb188[_0x4608('0xe')])):![];var _0x48c951;if(_0xdb93f5[_0x4608('0xf')]){_0x5a5ffc['id']=_0xdb93f5['xmd-contactid'];}if(!_0x5a5ffc['id']){_0x5a5ffc[_0x4608('0x10')]=_0x48a061;_0x48c951=_0x1eb188[_0x4608('0x11')]&&_0x1eb188[_0x4608('0x11')]!=='0'?_0x1eb188[_0x4608('0x11')][_0x4608('0x12')](','):[_0x4608('0x13')];_0x5a5ffc[_0x4608('0x14')]=_[_0x4608('0x15')](_0x48c951,function(_0x3f1788){var _0x1001e3={};_0x1001e3[_0x3f1788]=_0xdb93f5[_0x4608('0x16')]?_0xdb93f5['destcalleridnum']:_0xdb93f5['calleridnum'];return _0x1001e3;});}var _0x6815f=['id','firstName',_0x4608('0x17'),_0x4608('0x13'),_0x4608('0x18'),_0x4608('0x19'),_0x4608('0x10'),_0x4608('0x1a'),_0x4608('0x1b'),_0x4608('0x1c')];var _0x1b0a3d=_[_0x4608('0x1d')](_0x6815f,_0x48c951);BPromise[_0x4608('0x1e')]()[_0x4608('0x1f')](cmContactRpc[_0x4608('0x20')]({'attributes':_0x1b0a3d,'where':_0x5a5ffc}))[_0x4608('0x1f')](function(_0x3f79ea){_0x3bc332=_0x3f79ea;if(!_['isEmpty'](_0x3bc332)){if(_0x3bc332[_0x4608('0x21')]===0x1){_0x311323=_0x3bc332[0x0];logger['info']('[CM][%s][%s]\x20Contact\x20found:%s',_0xdb93f5[_0x4608('0x22')],_0x5cb3b0['id'],_0x311323['id']);}else{logger[_0x4608('0x23')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0xdb93f5[_0x4608('0x22')],_0x5cb3b0['id'],_[_0x4608('0x15')](_0x3bc332,'id')[_0x4608('0x24')](','));}return;}else{logger['info'](_0x4608('0x25'),_0xdb93f5[_0x4608('0x22')],_0x5cb3b0['id']);var _0x19f3c8={'ListId':_0x48a061};var _0x3a91da=_0x1eb188[_0x4608('0x26')]&&_0x1eb188[_0x4608('0x26')]!=='0'?_0x1eb188[_0x4608('0x26')]:_0x4608('0x13');if(_0x415284){logger[_0x4608('0x23')](_0x4608('0x27'),_0xdb93f5[_0x4608('0x22')],_0x5cb3b0['id']);_0x19f3c8[_0x3a91da]=_[_0x4608('0x28')](_0xdb93f5['routeId'])?_0xdb93f5[_0x4608('0x29')]:_0xdb93f5[_0x4608('0x2a')];if(_[_0x4608('0x28')](_0xdb93f5['routeId'])){_0x19f3c8[_0x4608('0x2b')]=_0xdb93f5['calleridname']&&_0xdb93f5[_0x4608('0x2c')]!==_0x4608('0x2d')?_0xdb93f5['calleridname']:_0x4608('0x2e');}else{_0x19f3c8[_0x4608('0x2b')]=_0xdb93f5['destcalleridname']&&_0xdb93f5['destcalleridname']!==_0x4608('0x2d')?_0xdb93f5['destcalleridname']:_0x4608('0x2e');}return BPromise[_0x4608('0x1e')]()[_0x4608('0x1f')](cmContactRpc['createContact'](_0x19f3c8))[_0x4608('0x1f')](function(_0xf32621){_0x311323=_0xf32621;_0x3bc332[_0x4608('0x2f')](_0xf32621);if(_0x311323){logger['info'](_0x4608('0x30'),_0xdb93f5[_0x4608('0x22')],_0x5cb3b0['id'],_0x311323['id']);}return;});}else{logger[_0x4608('0x23')](_0x4608('0x31'),_0xdb93f5['uniqueid'],_0x5cb3b0['id']);_0x19f3c8[_0x3a91da]=_[_0x4608('0x28')](_0xdb93f5[_0x4608('0x16')])?_0xdb93f5[_0x4608('0x29')]:_0xdb93f5[_0x4608('0x2a')];if(_['isNil'](_0xdb93f5['routeId'])){_0x19f3c8[_0x4608('0x2b')]=_0xdb93f5[_0x4608('0x2c')]&&_0xdb93f5[_0x4608('0x2c')]!==''?_0xdb93f5[_0x4608('0x2c')]:_0x4608('0x2e');}else{_0x19f3c8[_0x4608('0x2b')]=_0xdb93f5[_0x4608('0x32')]&&_0xdb93f5[_0x4608('0x32')]!==''?_0xdb93f5[_0x4608('0x32')]:_0x4608('0x2e');}_0x311323=_0x19f3c8;_0x3bc332[_0x4608('0x2f')](_0x19f3c8);return;}}})[_0x4608('0x1f')](function(){if(_0x358e04){emit(_0xdb93f5[_0x4608('0x22')],_0x5cb3b0,util[_0x4608('0x33')]('user:%s',_0x358e04[_0x4608('0x34')]),util[_0x4608('0x33')](_0x4608('0x35'),_0x1eb188[_0x4608('0x36')][_0x4608('0x37')]()),{'evt':_[_0x4608('0x38')](_0xdb93f5,{'autoCreate':_0x415284}),'contact':_0x311323===undefined?{}:_0x311323,'contacts':_0x3bc332[_0x4608('0x21')]===0x0?undefined:_0x3bc332});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 7e28af2..314bac7 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 _0x9494=['data2','render','template\x20not\x20found','url','uri','buildUri','isNil','data3','data4','location','windowWidth','data5','windowHeight','data6','600','winArguments','user:%s','trigger:%s:%s','action','format','trigger:%s','exec','integration','accounts','routeId','urlforward','script','search','AllConditions','every','checkConditions','channel','AnyConditions','some','field','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','message','event','queue','membername','lastevent','exports','util','lodash','mustache','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentreject','custom:queuecallerabandon','custom:timeout','custom:dialbegin','custom:dialconnect','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','emit','info','stringify','clone','checkTriggers','prototype','interface','hasOwnProperty','status','merge','variables','Actions','length','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId'];(function(_0x22addf,_0x3e211a){var _0x2b3f5b=function(_0x3188d6){while(--_0x3188d6){_0x22addf['push'](_0x22addf['shift']());}};_0x2b3f5b(++_0x3e211a);}(_0x9494,0x185));var _0x4949=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9494[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x4949('0x0'));var _=require(_0x4949('0x1'));var url=require('url');var Mustache=require(_0x4949('0x2'));var Redis=require('ioredis');var urlforward=require(_0x4949('0x3'));var integration=require(_0x4949('0x4'));var cmContact=require(_0x4949('0x5'));var script=require(_0x4949('0x6'));var config=require(_0x4949('0x7'));var logger=require(_0x4949('0x8'))('trigger');var ami=require('../ami');config[_0x4949('0x9')]=_[_0x4949('0xa')](config[_0x4949('0x9')],{'host':_0x4949('0xb'),'port':0x18eb});var io=require(_0x4949('0xc'))(new Redis(config[_0x4949('0x9')]));var operators={'equals':function(_0x2150d0,_0x3f9682){return _0x2150d0==_0x3f9682;},'not_equals':function(_0x3b0484,_0x1162e2){return _0x3b0484!=_0x1162e2;}};var barAndWebActions=['popup','url',_0x4949('0xd')];function Trigger(_0x10f5d1){this[_0x4949('0xe')]=_0x10f5d1[_0x4949('0xe')];this[_0x4949('0xf')]=_0x10f5d1[_0x4949('0xf')];this[_0x4949('0x10')]=_0x10f5d1[_0x4949('0x10')];this[_0x4949('0x11')]=_0x10f5d1[_0x4949('0x11')];this[_0x4949('0x12')]=_0x10f5d1['voiceExtensions'];this[_0x4949('0x13')]=_0x10f5d1[_0x4949('0x13')];this[_0x4949('0x14')]=_0x10f5d1[_0x4949('0x14')];this['salesforceAccounts']=_0x10f5d1[_0x4949('0x15')];this['sugarcrmAccounts']=_0x10f5d1[_0x4949('0x16')];this[_0x4949('0x17')]=_0x10f5d1['zohoAccounts'];this[_0x4949('0x18')]=_0x10f5d1[_0x4949('0x18')];this['vtigerAccounts']=_0x10f5d1[_0x4949('0x19')];this[_0x4949('0x1a')]=_0x10f5d1[_0x4949('0x1a')];this[_0x4949('0x1b')]=_0x10f5d1[_0x4949('0x1b')];this['freshsalesAccounts']=_0x10f5d1[_0x4949('0x1c')];this['accounts']={'zendesk':this[_0x4949('0x13')],'salesforce':this[_0x4949('0x15')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0x4949('0x17')],'desk':this[_0x4949('0x18')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x4949('0x1b')],'freshsales':this[_0x4949('0x1c')],'servicenow':this['servicenowAccounts']};ami['on'](_0x4949('0x1d'),this[_0x4949('0x1e')][_0x4949('0x1f')](this));ami['on']('custom:agentconnect',this[_0x4949('0x1e')][_0x4949('0x1f')](this));ami['on']('custom:agentringnoanswer',this[_0x4949('0x1e')][_0x4949('0x1f')](this));ami['on'](_0x4949('0x20'),this[_0x4949('0x1e')][_0x4949('0x1f')](this));ami['on'](_0x4949('0x21'),this['syncCustomEvent'][_0x4949('0x1f')](this));ami['on'](_0x4949('0x22'),this[_0x4949('0x1e')]['bind'](this));ami['on'](_0x4949('0x23'),this['syncCustomEvent']['bind'](this));ami['on']('custom:agentcongestion',this[_0x4949('0x1e')]['bind'](this));ami['on'](_0x4949('0x24'),this[_0x4949('0x1e')][_0x4949('0x1f')](this));ami['on'](_0x4949('0x25'),this[_0x4949('0x1e')]['bind'](this));ami['on'](_0x4949('0x26'),this[_0x4949('0x1e')][_0x4949('0x1f')](this));ami['on'](_0x4949('0x27'),this['syncAgentDial'][_0x4949('0x1f')](this));ami['on'](_0x4949('0x28'),this[_0x4949('0x29')][_0x4949('0x1f')](this));ami['on'](_0x4949('0x2a'),this[_0x4949('0x29')][_0x4949('0x1f')](this));ami['on'](_0x4949('0x2b'),this[_0x4949('0x1e')][_0x4949('0x1f')](this));ami['on'](_0x4949('0x2c'),this[_0x4949('0x1e')][_0x4949('0x1f')](this));ami['on']('custom:incomingmessage',this[_0x4949('0x1e')][_0x4949('0x1f')](this));ami['on'](_0x4949('0x2d'),this[_0x4949('0x1e')][_0x4949('0x1f')](this));ami['on'](_0x4949('0x2e'),this[_0x4949('0x1e')]['bind'](this));ami['on'](_0x4949('0x2f'),this[_0x4949('0x1e')][_0x4949('0x1f')](this));}Trigger['prototype'][_0x4949('0x30')]=function(_0x3d5a7d,_0x3b877d,_0x1c56c3){logger[_0x4949('0x31')](_0x3d5a7d,_0x3b877d,JSON[_0x4949('0x32')](_0x1c56c3));io['to'](_0x3d5a7d)[_0x4949('0x30')](_0x3b877d,_0x1c56c3);};Trigger['prototype'][_0x4949('0x1e')]=function(_0x2e1647){var _0x3eba97=_[_0x4949('0x33')](_0x2e1647);this[_0x4949('0x34')](_0x3eba97);};Trigger[_0x4949('0x35')][_0x4949('0x29')]=function(_0x401954){if(this['agents'][_0x401954[_0x4949('0x36')]]){this['syncCustomEvent'](_0x401954);}};Trigger['prototype']['checkTriggers']=function(_0x38b1ba){var _0x44a801;for(var _0x2d1eec in this['triggers']){if(this['triggers'][_0x4949('0x37')](_0x2d1eec)){if(this[_0x4949('0xe')][_0x2d1eec][_0x4949('0x38')]){_0x44a801=this['checkTrigger'](this[_0x4949('0xe')][_0x2d1eec],_0x38b1ba);if(_0x44a801){_[_0x4949('0x39')](_0x38b1ba,_0x38b1ba[_0x4949('0x3a')]);for(var _0x5edf19=0x0,_0xb2217f,_0x5f252d,_0x2341be;_0x5edf190x0){_0x5d186f=_[_0xc27d('0x29')](_0x111495,_0x43164a);}return _0x5d186f;}function getCustomFields(_0x4ae993,_0x576b9a){var _0xa707bf=[];var _0x277eb2={'custom_fields':{}};if(_0x4ae993[_0xc27d('0x28')]>0x0){_['forEach'](_0x4ae993,function(_0xbf0fcb){if(_[_0xc27d('0x2a')](['string',_0xc27d('0x2b')],_0xbf0fcb[_0xc27d('0x2c')])&&_0xbf0fcb[_0xc27d('0x2d')]&&!_0xbf0fcb[_0xc27d('0x2e')]){_0x277eb2[_0xbf0fcb['nameField']['toLowerCase']()]=_0xbf0fcb[_0xc27d('0x2f')]['toString']();}else if(_['includes']([_0xc27d('0x30'),_0xc27d('0x2b')],_0xbf0fcb[_0xc27d('0x2c')])&&_0xbf0fcb[_0xc27d('0x31')]&&_0xbf0fcb[_0xc27d('0x2e')]){_0x277eb2['custom_fields'][_0xbf0fcb[_0xc27d('0x31')]]=_0xbf0fcb['content'][_0xc27d('0x22')]();}else if(_0xbf0fcb[_0xc27d('0x2c')]===_0xc27d('0x32')&&_0xbf0fcb[_0xc27d('0x33')]&&_0xbf0fcb[_0xc27d('0x31')]&&_0xbf0fcb[_0xc27d('0x2e')]){_0x576b9a[_0xbf0fcb['variableName']]&&(_0x277eb2[_0xc27d('0x34')][_0xbf0fcb[_0xc27d('0x31')]]=_0x576b9a[_0xbf0fcb[_0xc27d('0x33')]]['toString']());}else if(_0xbf0fcb[_0xc27d('0x2c')]===_0xc27d('0x35')&&_0xbf0fcb[_0xc27d('0x36')]&&_0xbf0fcb[_0xc27d('0x36')]['name']&&_0xbf0fcb[_0xc27d('0x31')]&&_0xbf0fcb[_0xc27d('0x2e')]){_0x576b9a[_0xbf0fcb['Variable']['name'][_0xc27d('0x37')]()]&&(_0x277eb2[_0xc27d('0x34')][_0xbf0fcb['idField']]=_0x576b9a[_0xbf0fcb[_0xc27d('0x36')][_0xc27d('0x38')][_0xc27d('0x37')]()][_0xc27d('0x22')]());}});}if(_0x277eb2[_0xc27d('0x39')]){_0x277eb2[_0xc27d('0x39')]=Number(_0x277eb2['priority']);}return _0x277eb2;}function getTicket(_0x379102,_0x174641,_0x442eda,_0x9250a3,_0x3fce6e){logger[_0xc27d('0xf')](_0xc27d('0x3a'));var _0x4159c4=_[_0xc27d('0x3b')]({'subject':intUtil[_0xc27d('0x3c')](_0x9250a3['Subjects'],_0x3fce6e,'\x20'),'type':_0xc27d('0x3d'),'status':_0xc27d('0x3e'),'labels':[_0xc27d('0x3f'),_0xc27d('0x40'),'CTI'][_0xc27d('0x41')](getTags(_0x9250a3[_0xc27d('0x42')],_0xc27d('0x38'))),'description':intUtil['getString'](_0x9250a3[_0xc27d('0x43')],_0x3fce6e,'\x0a'),'_links':{'assigned_user':{'href':util['format']('/api/v2/users/%d',_0x174641['id']),'class':_0xc27d('0x44')}},'message':{'direction':'in','body':intUtil[_0xc27d('0x3c')](_0x9250a3[_0xc27d('0x43')],_0x3fce6e,'\x0a')}},getCustomFields(_0x9250a3[_0xc27d('0x45')],_0x3fce6e));return request({'uri':util[_0xc27d('0x18')](_0xc27d('0x46'),_0x379102[_0xc27d('0x11')],_0x442eda['id']),'method':_0xc27d('0x26'),'body':_0x4159c4});}exports[_0xc27d('0x47')]=function(_0x559202,_0x2ccd2e,_0x179d32,_0x36f775,_0x2a551a,_0x433b5e){var _0x32b582,_0x3ae39d;_0x433b5e[_0xc27d('0x11')]=intUtil[_0xc27d('0x48')](_0x433b5e[_0xc27d('0x11')]);_0x433b5e[_0xc27d('0x49')]=intUtil[_0xc27d('0x48')](_0x433b5e[_0xc27d('0x49')]);if(_0x2a551a&&_0x2a551a[_0xc27d('0x4a')]){logger[_0xc27d('0xf')](_0xc27d('0x4b'),'Recording\x20is\x20enabled!');_0x2ccd2e[_0xc27d('0x4c')]=util[_0xc27d('0x18')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x433b5e[_0xc27d('0x49')],_0x2ccd2e[_0xc27d('0x4d')],md5(_0x2ccd2e[_0xc27d('0x4d')]));}else{_0x2ccd2e[_0xc27d('0x4c')]='';}headers['Authorization']=getAuth(_0x433b5e);return getUser(_0x433b5e,_0x36f775[_0xc27d('0x4e')])[_0xc27d('0x12')](function(_0x2847e7){_0x32b582=_0x2847e7;logger[_0xc27d('0xf')](_0xc27d('0x4f'),_0x32b582['id']);return getEndUser(_0x433b5e,_0x2ccd2e[_0xc27d('0x50')],_0x2ccd2e[_0xc27d('0x51')]);})[_0xc27d('0x12')](function(_0x2c65aa){_0x3ae39d=_0x2c65aa;logger['info']('The\x20Enduser\x20ID\x20is:',_0x3ae39d['id']);return getTicket(_0x433b5e,_0x32b582,_0x3ae39d,_0x179d32,_0x2ccd2e);})['then'](function(_0x34f43e){if(_0x34f43e){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x34f43e['id']);switch(_0x433b5e[_0xc27d('0x2c')]){case _0xc27d('0x52'):logger[_0xc27d('0xf')](_0xc27d('0x4b'),_0xc27d('0x53'));emit(util['format'](_0xc27d('0x54'),_0x36f775['name']),_0xc27d('0x55'),{'recordId':_0x34f43e['id']});break;case _0xc27d('0x56'):logger['info'](_0xc27d('0x4b'),_0xc27d('0x57'));emit(util[_0xc27d('0x18')](_0xc27d('0x54'),_0x36f775[_0xc27d('0x38')]),'trigger:browser:url',{'uri':util[_0xc27d('0x18')](_0xc27d('0x58'),_0x34f43e['id'])});break;default:logger[_0xc27d('0x59')](_0xc27d('0x4b'),_0xc27d('0x5a'));}}})[_0xc27d('0x5b')](function(_0x54581c){console[_0xc27d('0x59')](_0x54581c);logger['error'](_0xc27d('0x4b'),JSON[_0xc27d('0x5c')](_0x54581c));});};exports['outbound']=function(_0x296b16,_0x86ad8,_0x14175a,_0x55c4b6,_0x240d14,_0x5e421c,_0x2a8437){var _0xfc3145,_0x59713e;_0x5e421c[_0xc27d('0x11')]=intUtil[_0xc27d('0x48')](_0x5e421c[_0xc27d('0x11')]);_0x5e421c[_0xc27d('0x49')]=intUtil['stripTrailingSlash'](_0x5e421c[_0xc27d('0x49')]);if(_0x2a8437&&_0x2a8437[_0xc27d('0x5d')]&&_0x2a8437[_0xc27d('0x5d')]!==_0xc27d('0x5e')){logger[_0xc27d('0xf')]('[OUTBOUND]',_0xc27d('0x5f'));_0x86ad8[_0xc27d('0x4c')]=util[_0xc27d('0x18')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5e421c[_0xc27d('0x49')],_0x86ad8[_0xc27d('0x4d')],md5(_0x86ad8[_0xc27d('0x4d')]));}headers[_0xc27d('0x60')]=getAuth(_0x5e421c);return getUser(_0x5e421c,_0x55c4b6['email'])[_0xc27d('0x12')](function(_0x18e147){_0xfc3145=_0x18e147;logger['info']('The\x20User\x20ID\x20is:',_0xfc3145['id']);return getEndUser(_0x5e421c,_0x86ad8['destcalleridname'],_0x86ad8[_0xc27d('0x61')]);})['then'](function(_0x479f80){_0x59713e=_0x479f80;logger[_0xc27d('0xf')](_0xc27d('0x62'),_0x59713e['id']);return getTicket(_0x5e421c,_0xfc3145,_0x59713e,_0x14175a,_0x86ad8);})[_0xc27d('0x12')](function(_0x4dc8f3){if(_0x4dc8f3){logger[_0xc27d('0xf')](_0xc27d('0x63'));logger[_0xc27d('0xf')](_0xc27d('0x64'),_0x4dc8f3['id']);switch(_0x5e421c['type']){case _0xc27d('0x52'):logger[_0xc27d('0xf')](_0xc27d('0x4b'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xc27d('0x18')](_0xc27d('0x54'),_0x55c4b6[_0xc27d('0x38')]),_0xc27d('0x55'),{'recordId':_0x4dc8f3['id']});break;case _0xc27d('0x56'):logger[_0xc27d('0xf')](_0xc27d('0x4b'),_0xc27d('0x57'));emit(util['format']('user:%s',_0x55c4b6[_0xc27d('0x38')]),_0xc27d('0x65'),{'uri':util[_0xc27d('0x18')](_0xc27d('0x66'),_0x5e421c['remoteUri'],_0x4dc8f3['id'])});break;default:logger[_0xc27d('0x59')](_0xc27d('0x67'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xc27d('0x5b')](function(_0x4f547f){logger[_0xc27d('0x59')]('[OUTBOUND]',JSON[_0xc27d('0x5c')](_0x4f547f));});};exports[_0xc27d('0x68')]=function(_0x4cf3bf,_0x143c72,_0x4fd085,_0x568aac,_0x104415,_0x56476c){var _0x188cb6,_0x4807b0;_0x56476c[_0xc27d('0x11')]=intUtil['stripTrailingSlash'](_0x56476c[_0xc27d('0x11')]);_0x56476c[_0xc27d('0x49')]=intUtil[_0xc27d('0x48')](_0x56476c[_0xc27d('0x49')]);if(_0x104415&&_0x104415[_0xc27d('0x4a')]){logger[_0xc27d('0xf')]('['+_0x143c72[_0xc27d('0x69')][_0xc27d('0x6a')]()+']',_0xc27d('0x5f'));_0x143c72[_0xc27d('0x4c')]=util[_0xc27d('0x18')](_0xc27d('0x6b'),_0x56476c[_0xc27d('0x49')],_0x143c72['uniqueid'],md5(_0x143c72['uniqueid']));}else{_0x143c72[_0xc27d('0x4c')]='';}headers['Authorization']=getAuth(_0x56476c);return getUser(_0x56476c)[_0xc27d('0x12')](function(_0x1d60ea){_0x188cb6=_0x1d60ea;logger[_0xc27d('0xf')](_0xc27d('0x4f'),_0x188cb6['id']);return getEndUser(_0x56476c,_0x143c72[_0xc27d('0x50')],_0x143c72[_0xc27d('0x51')]);})[_0xc27d('0x12')](function(_0x2dff1c){_0x4807b0=_0x2dff1c;logger[_0xc27d('0xf')](_0xc27d('0x62'),_0x4807b0['id']);return getTicket(_0x56476c,_0x188cb6,_0x4807b0,_0x4fd085,_0x143c72);})[_0xc27d('0x12')](function(_0x5befe5){if(_0x5befe5){logger[_0xc27d('0xf')]('Ticket\x20created!');logger[_0xc27d('0xf')]('The\x20Ticket\x20ID\x20is:',_0x5befe5['id']);}})[_0xc27d('0x5b')](function(_0x1fbf4d){logger[_0xc27d('0x59')]('['+_0x143c72['lastevent'][_0xc27d('0x6a')]()+']',JSON['stringify'](_0x1fbf4d));});}; \ No newline at end of file +var _0xa53a=['outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','Authorization','destcalleridname','integrationTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','socket.io-emitter','emit','application/json','info','format','%s/users','remoteUri','then','total_entries','_embedded','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','stringify','GET','authType','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','length','map','forEach','includes','string','type','nameField','customField','toLowerCase','content','idField','custom_fields','variable','variableName','Variable','name','priority','Creating\x20new\x20ticket...','merge','Subjects','phone','new','xCALLY','Motion','concat','Tags','getString','Descriptions','/api/v2/users/%d','%s/customers/%d/cases','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','catch'];(function(_0x320b9e,_0x1f892f){var _0x5e4416=function(_0x160fcc){while(--_0x160fcc){_0x320b9e['push'](_0x320b9e['shift']());}};_0x5e4416(++_0x1f892f);}(_0xa53a,0x1b5));var _0xaa53=function(_0x20db29,_0x5ca31e){_0x20db29=_0x20db29-0x0;var _0x2a247c=_0xa53a[_0x20db29];return _0x2a247c;};'use strict';var _=require(_0xaa53('0x0'));var rp=require(_0xaa53('0x1'));var md5=require(_0xaa53('0x2'));var util=require(_0xaa53('0x3'));var Redis=require(_0xaa53('0x4'));var intUtil=require(_0xaa53('0x5'));var config=require(_0xaa53('0x6'));var logger=require(_0xaa53('0x7'))('desk');config[_0xaa53('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xaa53('0x9'))(new Redis(config[_0xaa53('0x8')]));function emit(_0x60b483,_0x43beea,_0x39018d){io['to'](_0x60b483)[_0xaa53('0xa')](_0x43beea,_0x39018d);}var headers={'Content-Type':_0xaa53('0xb'),'Accept':'application/json'};function getUser(_0x543082,_0x162d58){if(intUtil['validateEmail'](_0x162d58)===!![]){logger[_0xaa53('0xc')]('Getting\x20agent\x20with\x20email',_0x162d58);return request({'uri':util[_0xaa53('0xd')](_0xaa53('0xe'),_0x543082[_0xaa53('0xf')])})[_0xaa53('0x10')](function(_0x3b2974){if(_0x3b2974[_0xaa53('0x11')]){return _['find'](_0x3b2974[_0xaa53('0x12')][_0xaa53('0x13')],{'email':_0x162d58});}})['then'](function(_0x24b87f){if(_0x24b87f){logger[_0xaa53('0xc')]('Agent\x20found!');return _0x24b87f;}else{logger[_0xaa53('0xc')](_0xaa53('0x14'));return request({'uri':util[_0xaa53('0xd')](_0xaa53('0x15'),_0x543082['remoteUri'])});}});}else{logger[_0xaa53('0xc')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xaa53('0xd')](_0xaa53('0x15'),_0x543082[_0xaa53('0xf')])});}}function request(_0x25b875){logger[_0xaa53('0x16')](_0xaa53('0x17'),JSON[_0xaa53('0x18')](_0x25b875));return rp(_['defaults'](_0x25b875,{'method':_0xaa53('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x4ae54a){var _0x20f40a;if(_0x4ae54a[_0xaa53('0x1a')]==='basic'){_0x20f40a=util[_0xaa53('0xd')](_0xaa53('0x1b'),_0x4ae54a[_0xaa53('0x1c')],_0x4ae54a[_0xaa53('0x1d')]);}else if(_0x4ae54a[_0xaa53('0x1a')]===_0xaa53('0x1e')){_0x20f40a=util['format']('%s/token:%s',_0x4ae54a[_0xaa53('0x1c')],_0x4ae54a[_0xaa53('0x1e')]);}return util[_0xaa53('0xd')](_0xaa53('0x1f'),new Buffer(_0x20f40a)[_0xaa53('0x20')](_0xaa53('0x21')));}function getEndUser(_0x3e8f1c,_0x2321a8,_0xf990e5){logger[_0xaa53('0xc')](_0xaa53('0x22'),_0xf990e5);return request({'uri':util['format'](_0xaa53('0x23'),_0x3e8f1c[_0xaa53('0xf')]),'qs':{'phone':_0xf990e5}})[_0xaa53('0x10')](function(_0x416cf0){if(_0x416cf0['total_entries']){logger[_0xaa53('0xc')](_0xaa53('0x24'));return _0x416cf0[_0xaa53('0x12')]['entries'][0x0];}else{logger[_0xaa53('0xc')](_0xaa53('0x25'));return request({'uri':util[_0xaa53('0xd')](_0xaa53('0x26'),_0x3e8f1c['remoteUri']),'method':_0xaa53('0x27'),'body':{'first_name':_0x2321a8,'title':_0x2321a8,'phone_numbers':[{'type':_0xaa53('0x28'),'value':_0xf990e5}]}});}});}function getTags(_0x432cb6,_0x5a9f84){var _0x505894=[];if(_0x432cb6&&_0x432cb6[_0xaa53('0x29')]>0x0){_0x505894=_[_0xaa53('0x2a')](_0x432cb6,_0x5a9f84);}return _0x505894;}function getCustomFields(_0x3dddbb,_0x267fdc){var _0x2f5537=[];var _0xabb48={'custom_fields':{}};if(_0x3dddbb[_0xaa53('0x29')]>0x0){_[_0xaa53('0x2b')](_0x3dddbb,function(_0x508f48){if(_[_0xaa53('0x2c')]([_0xaa53('0x2d'),'picklist'],_0x508f48[_0xaa53('0x2e')])&&_0x508f48[_0xaa53('0x2f')]&&!_0x508f48[_0xaa53('0x30')]){_0xabb48[_0x508f48[_0xaa53('0x2f')][_0xaa53('0x31')]()]=_0x508f48[_0xaa53('0x32')][_0xaa53('0x20')]();}else if(_[_0xaa53('0x2c')]([_0xaa53('0x2d'),'picklist'],_0x508f48[_0xaa53('0x2e')])&&_0x508f48[_0xaa53('0x33')]&&_0x508f48[_0xaa53('0x30')]){_0xabb48[_0xaa53('0x34')][_0x508f48[_0xaa53('0x33')]]=_0x508f48[_0xaa53('0x32')][_0xaa53('0x20')]();}else if(_0x508f48[_0xaa53('0x2e')]===_0xaa53('0x35')&&_0x508f48[_0xaa53('0x36')]&&_0x508f48[_0xaa53('0x33')]&&_0x508f48[_0xaa53('0x30')]){_0x267fdc[_0x508f48[_0xaa53('0x36')]]&&(_0xabb48['custom_fields'][_0x508f48[_0xaa53('0x33')]]=_0x267fdc[_0x508f48['variableName']][_0xaa53('0x20')]());}else if(_0x508f48[_0xaa53('0x2e')]==='customVariable'&&_0x508f48[_0xaa53('0x37')]&&_0x508f48[_0xaa53('0x37')][_0xaa53('0x38')]&&_0x508f48[_0xaa53('0x33')]&&_0x508f48[_0xaa53('0x30')]){_0x267fdc[_0x508f48[_0xaa53('0x37')][_0xaa53('0x38')][_0xaa53('0x31')]()]&&(_0xabb48[_0xaa53('0x34')][_0x508f48[_0xaa53('0x33')]]=_0x267fdc[_0x508f48[_0xaa53('0x37')][_0xaa53('0x38')][_0xaa53('0x31')]()]['toString']());}});}if(_0xabb48[_0xaa53('0x39')]){_0xabb48[_0xaa53('0x39')]=Number(_0xabb48[_0xaa53('0x39')]);}return _0xabb48;}function getTicket(_0x44ab71,_0x2f2753,_0x3a5287,_0x11e10a,_0x438b94){logger['info'](_0xaa53('0x3a'));var _0x14c9dc=_[_0xaa53('0x3b')]({'subject':intUtil['getString'](_0x11e10a[_0xaa53('0x3c')],_0x438b94,'\x20'),'type':_0xaa53('0x3d'),'status':_0xaa53('0x3e'),'labels':[_0xaa53('0x3f'),_0xaa53('0x40'),'CTI'][_0xaa53('0x41')](getTags(_0x11e10a[_0xaa53('0x42')],_0xaa53('0x38'))),'description':intUtil[_0xaa53('0x43')](_0x11e10a[_0xaa53('0x44')],_0x438b94,'\x0a'),'_links':{'assigned_user':{'href':util[_0xaa53('0xd')](_0xaa53('0x45'),_0x2f2753['id']),'class':'user'}},'message':{'direction':'in','body':intUtil[_0xaa53('0x43')](_0x11e10a[_0xaa53('0x44')],_0x438b94,'\x0a')}},getCustomFields(_0x11e10a['Fields'],_0x438b94));return request({'uri':util[_0xaa53('0xd')](_0xaa53('0x46'),_0x44ab71[_0xaa53('0xf')],_0x3a5287['id']),'method':_0xaa53('0x27'),'body':_0x14c9dc});}exports['queue']=function(_0x511f66,_0x133150,_0x403770,_0x542465,_0x3501dd,_0x249a75){var _0x1937b,_0x4ce0ef;_0x249a75['remoteUri']=intUtil[_0xaa53('0x47')](_0x249a75[_0xaa53('0xf')]);_0x249a75[_0xaa53('0x48')]=intUtil[_0xaa53('0x47')](_0x249a75[_0xaa53('0x48')]);if(_0x3501dd&&_0x3501dd[_0xaa53('0x49')]){logger[_0xaa53('0xc')](_0xaa53('0x4a'),'Recording\x20is\x20enabled!');_0x133150['recordingURL']=util[_0xaa53('0xd')](_0xaa53('0x4b'),_0x249a75[_0xaa53('0x48')],_0x133150[_0xaa53('0x4c')],md5(_0x133150[_0xaa53('0x4c')]));}else{_0x133150[_0xaa53('0x4d')]='';}headers['Authorization']=getAuth(_0x249a75);return getUser(_0x249a75,_0x542465[_0xaa53('0x4e')])[_0xaa53('0x10')](function(_0x586769){_0x1937b=_0x586769;logger[_0xaa53('0xc')](_0xaa53('0x4f'),_0x1937b['id']);return getEndUser(_0x249a75,_0x133150[_0xaa53('0x50')],_0x133150[_0xaa53('0x51')]);})[_0xaa53('0x10')](function(_0x4ecf00){_0x4ce0ef=_0x4ecf00;logger[_0xaa53('0xc')](_0xaa53('0x52'),_0x4ce0ef['id']);return getTicket(_0x249a75,_0x1937b,_0x4ce0ef,_0x403770,_0x133150);})[_0xaa53('0x10')](function(_0x356b1f){if(_0x356b1f){logger[_0xaa53('0xc')](_0xaa53('0x53'));logger['info'](_0xaa53('0x54'),_0x356b1f['id']);switch(_0x249a75[_0xaa53('0x2e')]){case'integrationTab':logger[_0xaa53('0xc')]('[QUEUE]',_0xaa53('0x55'));emit(util[_0xaa53('0xd')](_0xaa53('0x56'),_0x542465['name']),_0xaa53('0x57'),{'recordId':_0x356b1f['id']});break;case _0xaa53('0x58'):logger[_0xaa53('0xc')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xaa53('0xd')](_0xaa53('0x56'),_0x542465[_0xaa53('0x38')]),_0xaa53('0x59'),{'uri':util[_0xaa53('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x356b1f['id'])});break;default:logger[_0xaa53('0x5a')](_0xaa53('0x4a'),_0xaa53('0x5b'));}}})[_0xaa53('0x5c')](function(_0x474d4e){console[_0xaa53('0x5a')](_0x474d4e);logger[_0xaa53('0x5a')](_0xaa53('0x4a'),JSON[_0xaa53('0x18')](_0x474d4e));});};exports[_0xaa53('0x5d')]=function(_0x532ac5,_0x1b9bba,_0x1d500c,_0x27a8ef,_0xc900b,_0x10ea5b,_0x464ca5){var _0x3e0ef0,_0x52df91;_0x10ea5b['remoteUri']=intUtil[_0xaa53('0x47')](_0x10ea5b[_0xaa53('0xf')]);_0x10ea5b[_0xaa53('0x48')]=intUtil[_0xaa53('0x47')](_0x10ea5b[_0xaa53('0x48')]);if(_0x464ca5&&_0x464ca5['recordingFormat']&&_0x464ca5[_0xaa53('0x5e')]!==_0xaa53('0x5f')){logger[_0xaa53('0xc')](_0xaa53('0x60'),_0xaa53('0x61'));_0x1b9bba[_0xaa53('0x4d')]=util[_0xaa53('0xd')](_0xaa53('0x4b'),_0x10ea5b[_0xaa53('0x48')],_0x1b9bba[_0xaa53('0x4c')],md5(_0x1b9bba[_0xaa53('0x4c')]));}headers[_0xaa53('0x62')]=getAuth(_0x10ea5b);return getUser(_0x10ea5b,_0x27a8ef[_0xaa53('0x4e')])[_0xaa53('0x10')](function(_0x3a8e87){_0x3e0ef0=_0x3a8e87;logger[_0xaa53('0xc')](_0xaa53('0x4f'),_0x3e0ef0['id']);return getEndUser(_0x10ea5b,_0x1b9bba[_0xaa53('0x63')],_0x1b9bba['destcalleridnum']);})[_0xaa53('0x10')](function(_0x3e39a9){_0x52df91=_0x3e39a9;logger[_0xaa53('0xc')]('The\x20Enduser\x20ID\x20is:',_0x52df91['id']);return getTicket(_0x10ea5b,_0x3e0ef0,_0x52df91,_0x1d500c,_0x1b9bba);})[_0xaa53('0x10')](function(_0x1e8592){if(_0x1e8592){logger[_0xaa53('0xc')](_0xaa53('0x53'));logger[_0xaa53('0xc')]('The\x20Ticket\x20ID\x20is:',_0x1e8592['id']);switch(_0x10ea5b[_0xaa53('0x2e')]){case _0xaa53('0x64'):logger['info'](_0xaa53('0x4a'),_0xaa53('0x55'));emit(util[_0xaa53('0xd')](_0xaa53('0x56'),_0x27a8ef['name']),'trigger:desk:display',{'recordId':_0x1e8592['id']});break;case _0xaa53('0x58'):logger[_0xaa53('0xc')]('[QUEUE]',_0xaa53('0x65'));emit(util['format'](_0xaa53('0x56'),_0x27a8ef[_0xaa53('0x38')]),_0xaa53('0x59'),{'uri':util[_0xaa53('0xd')](_0xaa53('0x66'),_0x10ea5b['remoteUri'],_0x1e8592['id'])});break;default:logger[_0xaa53('0x5a')](_0xaa53('0x60'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0xaa53('0x5c')](function(_0x1e6e23){logger[_0xaa53('0x5a')](_0xaa53('0x60'),JSON[_0xaa53('0x18')](_0x1e6e23));});};exports[_0xaa53('0x67')]=function(_0x2042b5,_0x483452,_0x4d9283,_0x480492,_0x46a41a,_0x4bec85){var _0x5eeaf5,_0x9b6652;_0x4bec85[_0xaa53('0xf')]=intUtil[_0xaa53('0x47')](_0x4bec85['remoteUri']);_0x4bec85[_0xaa53('0x48')]=intUtil[_0xaa53('0x47')](_0x4bec85['serverUrl']);if(_0x46a41a&&_0x46a41a[_0xaa53('0x49')]){logger[_0xaa53('0xc')]('['+_0x483452[_0xaa53('0x68')][_0xaa53('0x69')]()+']',_0xaa53('0x61'));_0x483452[_0xaa53('0x4d')]=util['format'](_0xaa53('0x4b'),_0x4bec85[_0xaa53('0x48')],_0x483452[_0xaa53('0x4c')],md5(_0x483452[_0xaa53('0x4c')]));}else{_0x483452[_0xaa53('0x4d')]='';}headers[_0xaa53('0x62')]=getAuth(_0x4bec85);return getUser(_0x4bec85)[_0xaa53('0x10')](function(_0x51eda9){_0x5eeaf5=_0x51eda9;logger['info']('The\x20User\x20ID\x20is:',_0x5eeaf5['id']);return getEndUser(_0x4bec85,_0x483452[_0xaa53('0x50')],_0x483452[_0xaa53('0x51')]);})[_0xaa53('0x10')](function(_0x32ddf1){_0x9b6652=_0x32ddf1;logger[_0xaa53('0xc')](_0xaa53('0x52'),_0x9b6652['id']);return getTicket(_0x4bec85,_0x5eeaf5,_0x9b6652,_0x4d9283,_0x483452);})[_0xaa53('0x10')](function(_0x808c09){if(_0x808c09){logger[_0xaa53('0xc')](_0xaa53('0x53'));logger[_0xaa53('0xc')](_0xaa53('0x54'),_0x808c09['id']);}})[_0xaa53('0x5c')](function(_0x2bd1ed){logger['error']('['+_0x483452[_0xaa53('0x68')][_0xaa53('0x69')]()+']',JSON[_0xaa53('0x18')](_0x2bd1ed));});}; \ 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 978e10e..11b8994 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 _0x2e88=['type','nameField','customField','idField','indexOf','content','ticketType','incidents','getString','Fields','phonecall','phonecalls','assign','Subjects','Descriptions','/contacts(','queue','callDirection','format','user:%s','emit','stripTrailingSlash','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','recordingURL','none','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','ticketId','error',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','bluebird','request-promise','util','./util','md5','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','email','length','internalemailaddress','isdisabled','systemuserid','userId','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','Bearer\x20','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','telephone1',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x2e88,0x95));var _0x82e8=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0x2e88[_0x184759];return _0xf26d5f;};'use strict';var _=require(_0x82e8('0x0'));var BPromise=require(_0x82e8('0x1'));var rp=require(_0x82e8('0x2'));var util=require(_0x82e8('0x3'));var intUtil=require(_0x82e8('0x4'));var md5=require(_0x82e8('0x5'));var Redis=require('ioredis');var logger=require(_0x82e8('0x6'))(_0x82e8('0x7'));var config=require('../../../../config/environment');config[_0x82e8('0x8')]=_[_0x82e8('0x9')](config['redis'],{'host':_0x82e8('0xa'),'port':0x18eb});var io=require(_0x82e8('0xb'))(new Redis(config[_0x82e8('0x8')]));function getAuthToken(_0x27df44,_0x393c2c,_0x1ecc8f){var _0x1a7d8c={'method':_0x82e8('0xc'),'uri':_0x393c2c,'form':{'client_id':_0x27df44[_0x82e8('0xd')],'resource':_0x27df44[_0x82e8('0xe')],'username':_0x27df44[_0x82e8('0xf')],'password':_0x27df44['password'],'grant_type':_0x82e8('0x10'),'client_secret':_0x27df44[_0x82e8('0x11')]},'json':!![]};return rp(_0x1a7d8c)[_0x82e8('0x12')](function(_0x1f5626){return _0x1f5626[_0x82e8('0x13')];})[_0x82e8('0x14')](function(_0x359489){logger['error']('['+[_0x1ecc8f[_0x82e8('0x15')]()]+_0x82e8('0x16'));return _0x359489[_0x82e8('0x17')];});}function getUser(_0x2cfe6b,_0x192914,_0x5eb2ca,_0x3353e0,_0x2c9569,_0xad6055){return new BPromise(function(_0x46e01e,_0x539d82){return getAuthToken(_0x192914,_0x3353e0,_0xad6055)[_0x82e8('0x12')](function(_0x461744){var _0x3253d2={'method':_0x82e8('0x18'),'uri':_0x2c9569+_0x82e8('0x19'),'headers':{'Authorization':'Bearer\x20'+_0x461744,'OData-Version':_0x82e8('0x1a')},'json':!![]};return rp(_0x3253d2);})[_0x82e8('0x12')](function(_0x574ba2){var _0x1a776d=_0x574ba2[_0x82e8('0x1b')];var _0x16cb41=![];var _0x380f44=null;if(!_[_0x82e8('0x1c')](_0x5eb2ca)){if(intUtil[_0x82e8('0x1d')](_0x5eb2ca[_0x82e8('0x1e')])){_0x2cfe6b['userEmail']=_0x5eb2ca[_0x82e8('0x1e')];for(_0x380f44=0x0;_0x380f44<_0x1a776d[_0x82e8('0x1f')];_0x380f44++){if(_0x1a776d[_0x380f44][_0x82e8('0x20')]===_0x5eb2ca[_0x82e8('0x1e')]&&!_0x1a776d[_0x380f44][_0x82e8('0x21')]){_0x16cb41=!![];logger['info']('['+[_0xad6055[_0x82e8('0x15')]()]+']\x20Agent\x20found\x20'+_0x1a776d[_0x380f44][_0x82e8('0x22')]+'!');_0x2cfe6b[_0x82e8('0x23')]=_0x1a776d[_0x380f44][_0x82e8('0x22')];}}}}if(!_0x16cb41){logger[_0x82e8('0x24')]('['+[_0xad6055[_0x82e8('0x15')]()]+_0x82e8('0x25'));_0x2cfe6b[_0x82e8('0x26')]=_0x192914['username'];for(_0x380f44=0x0;_0x380f44<_0x1a776d[_0x82e8('0x1f')];_0x380f44++){if(_0x1a776d[_0x380f44]['internalemailaddress']===_0x192914['username']){_0x2cfe6b['userId']=_0x1a776d[_0x380f44][_0x82e8('0x22')];}}}_0x46e01e(_0x2cfe6b);})['catch'](function(_0x1ebc4e){_0x539d82(_0x1ebc4e[_0x82e8('0x17')]);});});}function createEndUser(_0xeff996,_0x488b06,_0x2751e1,_0x476602,_0x336015,_0x2400c5){return new BPromise(function(_0x247096,_0x5b2833){return getAuthToken(_0x488b06,_0x2751e1,_0x2400c5)['then'](function(_0x220d51){var _0xe5ea6f=_0x2400c5[_0x82e8('0x27')]()===_0x82e8('0x28')?_0x336015[_0x82e8('0x29')]:_0x336015[_0x82e8('0x2a')];var _0x14450e={'method':_0x82e8('0xc'),'uri':_0x476602+_0x82e8('0x2b'),'body':{'telephone1':_0xe5ea6f,'fullname':_0xe5ea6f,'firstname':_0xe5ea6f,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x82e8('0x2c')+_0xeff996[_0x82e8('0x23')]+')'},'headers':{'Authorization':_0x82e8('0x2d')+_0x220d51,'OData-Version':_0x82e8('0x1a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x14450e);})['then'](function(_0x435b62){var _0x3ff82d=_0x435b62[_0x82e8('0x2e')][_0x82e8('0x2f')];var _0x27bbfc=_0x3ff82d[_0x82e8('0x30')](_0x3ff82d[_0x82e8('0x31')]('(')+0x1,_0x3ff82d[_0x82e8('0x31')](')'));_0xeff996[_0x82e8('0x32')]=_0x27bbfc;_0x247096(_0xeff996);})[_0x82e8('0x14')](function(_0x1ed0f5){_0x5b2833(_0x1ed0f5['message']);});});}function getEndUser(_0x3e4548,_0x305d86,_0x19ed65,_0x3453ba,_0x472875,_0x18ee10){return new BPromise(function(_0xa88631,_0x25a944){return getAuthToken(_0x305d86,_0x19ed65,_0x18ee10)['then'](function(_0x42bcac){var _0x4aa077={'method':_0x82e8('0x18'),'uri':_0x3453ba+_0x82e8('0x33'),'headers':{'Authorization':'Bearer\x20'+_0x42bcac,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4aa077);})[_0x82e8('0x12')](function(_0x49c21f){var _0x1b78b9=null;if(_0x49c21f){var _0x1a35a8=_0x49c21f[_0x82e8('0x1b')];var _0x1c95a3=![];for(_0x1b78b9=0x0;_0x1b78b9<_0x1a35a8[_0x82e8('0x1f')];_0x1b78b9++){var _0x14f4b5=_0x18ee10[_0x82e8('0x27')]()===_0x82e8('0x28')?_0x472875[_0x82e8('0x29')]:_0x472875[_0x82e8('0x2a')];if(_0x1a35a8[_0x1b78b9][_0x82e8('0x34')]===_0x14f4b5){_0x1c95a3=!![];_0x3e4548[_0x82e8('0x32')]=_0x1a35a8[_0x1b78b9]['contactid'];}}if(_0x1c95a3){_0xa88631(_0x3e4548);}else{return createEndUser(_0x3e4548,_0x305d86,_0x19ed65,_0x3453ba,_0x472875,_0x18ee10)[_0x82e8('0x12')](function(_0x12a7fd){logger[_0x82e8('0x24')]('['+[_0x18ee10['toUpperCase']()]+_0x82e8('0x35'),_0x12a7fd[_0x82e8('0x32')]);_0xa88631(_0x12a7fd);});}}else{return createEndUser(_0x3e4548,_0x305d86,_0x19ed65,_0x3453ba,_0x472875,_0x18ee10)[_0x82e8('0x12')](function(_0x4e67ac){logger[_0x82e8('0x24')]('['+[_0x18ee10[_0x82e8('0x15')]()]+_0x82e8('0x36'),_0x4e67ac[_0x82e8('0x32')]);_0xa88631(_0x4e67ac);});}});});}function getCustomFields(_0x2ed217,_0x1d2208,_0xd480b){var _0x4a5522={};if(_0x2ed217[_0x82e8('0x1f')]>0x0){_[_0x82e8('0x37')](_0x2ed217,function(_0x137525){if(_[_0x82e8('0x38')]([_0x82e8('0x39'),_0x82e8('0x3a')],_0x137525[_0x82e8('0x3b')])&&_0x137525[_0x82e8('0x3c')]&&!_0x137525[_0x82e8('0x3d')]){var _0x795b3a=_0x137525[_0x82e8('0x3e')][_0x82e8('0x27')]();var _0xa3f746=_0x795b3a[_0x82e8('0x30')](0x0,_0x795b3a[_0x82e8('0x3f')]('_'));var _0x4fba12=_0x795b3a[_0x82e8('0x30')](_0x795b3a['indexOf']('_')+0x1);if(_0xa3f746===_0xd480b){_0x4a5522[_0x4fba12]=_0x137525[_0x82e8('0x40')];}}});}return _0x4a5522;}function getTicket(_0x2da19b,_0x8428e1,_0xc996f7,_0x3ff396,_0x3643a9,_0x57ea58,_0x3882c2){return new BPromise(function(_0x58a619,_0xa47699){var _0xe86921;return getAuthToken(_0x8428e1,_0xc996f7,_0x3882c2)[_0x82e8('0x12')](function(_0x3b6996){if(_0x57ea58[_0x82e8('0x41')]==='incident'){_0xe86921={'method':'POST','uri':_0x3ff396+_0x82e8('0x42'),'body':Object['assign']({},{'title':intUtil[_0x82e8('0x43')](_0x57ea58['Subjects'],_0x3643a9,'\x20'),'description':intUtil['getString'](_0x57ea58['Descriptions'],_0x3643a9,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x2da19b[_0x82e8('0x32')]+')','ownerid@odata.bind':_0x82e8('0x2c')+_0x2da19b['userId']+')','caseorigincode':'1'},getCustomFields(_0x57ea58[_0x82e8('0x44')],_0x3643a9,_0x57ea58[_0x82e8('0x41')])),'headers':{'Authorization':'Bearer\x20'+_0x3b6996,'OData-Version':_0x82e8('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x57ea58['ticketType']===_0x82e8('0x45')){_0xe86921={'method':_0x82e8('0xc'),'uri':_0x3ff396+_0x82e8('0x46'),'body':Object[_0x82e8('0x47')]({},{'subject':intUtil[_0x82e8('0x43')](_0x57ea58[_0x82e8('0x48')],_0x3643a9,'\x20'),'phonenumber':String(_0x3643a9['calleridnum']),'description':intUtil[_0x82e8('0x43')](_0x57ea58[_0x82e8('0x49')],_0x3643a9,'\x0a'),'regardingobjectid_contact@odata.bind':_0x82e8('0x4a')+_0x2da19b[_0x82e8('0x32')]+')','ownerid@odata.bind':'/systemusers('+_0x2da19b[_0x82e8('0x23')]+')','directioncode':_0x2da19b['callDirection']===_0x82e8('0x4b')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x2da19b[_0x82e8('0x23')]+')','participationtypemask':_0x2da19b[_0x82e8('0x4c')]===_0x82e8('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x2da19b[_0x82e8('0x32')]+')','participationtypemask':_0x2da19b['callDirection']==='queue'?0x1:0x2}]},getCustomFields(_0x57ea58[_0x82e8('0x44')],_0x3643a9,_0x57ea58[_0x82e8('0x41')])),'headers':{'Authorization':_0x82e8('0x2d')+_0x3b6996,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xe86921);})[_0x82e8('0x12')](function(_0x529ac8){var _0x5735a2=_0x529ac8['headers']['odata-entityid'];var _0x386cea=_0x5735a2[_0x82e8('0x30')](_0x5735a2[_0x82e8('0x31')]('(')+0x1,_0x5735a2[_0x82e8('0x31')](')'));_0x2da19b['ticketId']=_0x386cea;_0x58a619(_0x2da19b);})[_0x82e8('0x14')](function(_0x7b1c26){_0xa47699(_0x7b1c26[_0x82e8('0x17')]);});});}function emit(_0x3017ee,_0x2a9e89,_0xcc763c,_0x51714e){var _0x2aab48={'uri':util[_0x82e8('0x4d')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x3017ee,_0xcc763c,_0x51714e)};io['to'](util['format'](_0x82e8('0x4e'),_0x2a9e89))[_0x82e8('0x4f')]('trigger:browser:url',_0x2aab48);}exports['cs']=function(_0x11f04e,_0x400274,_0x4be0aa,_0x26ca3d,_0x473129,_0x4a8497,_0x1334c9,_0x5958b5){var _0x44b89f={};_0x4a8497['remoteUri']=intUtil[_0x82e8('0x50')](_0x4a8497[_0x82e8('0xe')]);_0x4a8497['serverUrl']=intUtil[_0x82e8('0x50')](_0x4a8497['serverUrl']);_0x44b89f[_0x82e8('0x4c')]=_0x5958b5==='queue'||_0x5958b5===_0x82e8('0x51')?'queue':_0x82e8('0x28');var _0x19d645=util['format'](_0x82e8('0x52'),_0x4a8497[_0x82e8('0xe')]);var _0x56b579=util['format'](_0x82e8('0x53'),_0x4a8497['tenantId']);var _0x26a7e7=util[_0x82e8('0x4d')](_0x82e8('0x54'),_0x4a8497[_0x82e8('0x55')],_0x400274[_0x82e8('0x56')],md5(_0x400274[_0x82e8('0x56')]));if(_0x473129&&_0x473129[_0x82e8('0x57')]){logger[_0x82e8('0x24')](_0x82e8('0x58'),'Recording\x20is\x20enabled!');_0x400274[_0x82e8('0x59')]=_0x26a7e7;}else if(_0x1334c9&&_0x1334c9['recordingFormat']&&_0x1334c9['recordingFormat']!==_0x82e8('0x5a')){logger[_0x82e8('0x24')](_0x82e8('0x5b'),_0x82e8('0x5c'));_0x400274['recordingURL']=_0x26a7e7;}else{_0x400274[_0x82e8('0x59')]='';}return getUser(_0x44b89f,_0x4a8497,_0x26ca3d,_0x56b579,_0x19d645,_0x5958b5)[_0x82e8('0x12')](function(_0x404deb){logger[_0x82e8('0x24')]('['+_0x5958b5[_0x82e8('0x15')]()+_0x82e8('0x5d'),_0x404deb[_0x82e8('0x23')]);logger[_0x82e8('0x24')]('['+_0x5958b5[_0x82e8('0x15')]()+_0x82e8('0x5e'),_0x404deb[_0x82e8('0x26')]);return getEndUser(_0x404deb,_0x4a8497,_0x56b579,_0x19d645,_0x400274,_0x5958b5);})[_0x82e8('0x12')](function(_0x169cb0){logger[_0x82e8('0x24')]('['+_0x5958b5[_0x82e8('0x15')]()+_0x82e8('0x5f'),_0x169cb0['enduserId']);logger[_0x82e8('0x24')]('['+_0x5958b5[_0x82e8('0x15')]()+_0x82e8('0x60'),_0x400274[_0x82e8('0x2a')]);return getTicket(_0x169cb0,_0x4a8497,_0x56b579,_0x19d645,_0x400274,_0x4be0aa,_0x5958b5);})[_0x82e8('0x12')](function(_0x1a5d62){logger[_0x82e8('0x24')](util[_0x82e8('0x4d')]('['+_0x5958b5[_0x82e8('0x15')]()+_0x82e8('0x61'),_0x4be0aa[_0x82e8('0x41')],_0x1a5d62['ticketId']));logger[_0x82e8('0x24')](util[_0x82e8('0x4d')]('['+_0x5958b5[_0x82e8('0x15')]()+_0x82e8('0x62'),_0x5958b5));if(_0x5958b5!==_0x82e8('0x51')){logger[_0x82e8('0x24')]('['+_0x5958b5[_0x82e8('0x15')]()+']',_0x82e8('0x63'));emit(_0x4a8497[_0x82e8('0xe')],_0x26ca3d[_0x82e8('0x64')],_0x4be0aa[_0x82e8('0x41')],_0x1a5d62[_0x82e8('0x65')]);}})[_0x82e8('0x14')](function(_0xcc79cb){logger[_0x82e8('0x66')]('['+_0x5958b5[_0x82e8('0x15')]()+_0x82e8('0x67'),util['inspect'](_0xcc79cb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7278=['userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','toLowerCase','destcalleridnum','calleridnum','POST','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','contacts?$select=telephone1','outbound','telephone1','enduserId','contactid',']\x20Enduser\x20Created!','forEach','string','picklist','type','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','phonecall','phonecalls','/contacts(','callDirection','queue','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','util','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','socket.io-emitter','remoteUri','username','password','clientSecret','then','access_token','error','toUpperCase','message','GET','Bearer\x20','4.0','value','isNil','email'];(function(_0xc9275e,_0x4cc1ba){var _0x5162d4=function(_0x52ef80){while(--_0x52ef80){_0xc9275e['push'](_0xc9275e['shift']());}};_0x5162d4(++_0x4cc1ba);}(_0x7278,0x161));var _0x8727=function(_0x4e60bf,_0x5e86c4){_0x4e60bf=_0x4e60bf-0x0;var _0x3b231d=_0x7278[_0x4e60bf];return _0x3b231d;};'use strict';var _=require(_0x8727('0x0'));var BPromise=require(_0x8727('0x1'));var rp=require(_0x8727('0x2'));var util=require(_0x8727('0x3'));var intUtil=require(_0x8727('0x4'));var md5=require('md5');var Redis=require(_0x8727('0x5'));var logger=require(_0x8727('0x6'))(_0x8727('0x7'));var config=require(_0x8727('0x8'));config[_0x8727('0x9')]=_[_0x8727('0xa')](config[_0x8727('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x8727('0xb'))(new Redis(config[_0x8727('0x9')]));function getAuthToken(_0xffd783,_0x435911,_0x4160c3){var _0x4c5b50={'method':'POST','uri':_0x435911,'form':{'client_id':_0xffd783['clientId'],'resource':_0xffd783[_0x8727('0xc')],'username':_0xffd783[_0x8727('0xd')],'password':_0xffd783[_0x8727('0xe')],'grant_type':_0x8727('0xe'),'client_secret':_0xffd783[_0x8727('0xf')]},'json':!![]};return rp(_0x4c5b50)[_0x8727('0x10')](function(_0x550796){return _0x550796[_0x8727('0x11')];})['catch'](function(_0x2c382d){logger[_0x8727('0x12')]('['+[_0x4160c3[_0x8727('0x13')]()]+']\x20Wrong\x20credentials!');return _0x2c382d[_0x8727('0x14')];});}function getUser(_0x40f5c7,_0x58e6f3,_0xbcde13,_0x3aa1b,_0x47c29d,_0x2185e5){return new BPromise(function(_0x2ea789,_0x3d84db){return getAuthToken(_0x58e6f3,_0x3aa1b,_0x2185e5)[_0x8727('0x10')](function(_0x1916f7){var _0x11c828={'method':_0x8727('0x15'),'uri':_0x47c29d+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x8727('0x16')+_0x1916f7,'OData-Version':_0x8727('0x17')},'json':!![]};return rp(_0x11c828);})[_0x8727('0x10')](function(_0x2f6e1d){var _0x112f04=_0x2f6e1d[_0x8727('0x18')];var _0x533e6d=![];var _0x575d29=null;if(!_[_0x8727('0x19')](_0xbcde13)){if(intUtil['validateEmail'](_0xbcde13[_0x8727('0x1a')])){_0x40f5c7[_0x8727('0x1b')]=_0xbcde13[_0x8727('0x1a')];for(_0x575d29=0x0;_0x575d29<_0x112f04[_0x8727('0x1c')];_0x575d29++){if(_0x112f04[_0x575d29][_0x8727('0x1d')]===_0xbcde13['email']&&!_0x112f04[_0x575d29][_0x8727('0x1e')]){_0x533e6d=!![];logger[_0x8727('0x1f')]('['+[_0x2185e5[_0x8727('0x13')]()]+_0x8727('0x20')+_0x112f04[_0x575d29][_0x8727('0x21')]+'!');_0x40f5c7[_0x8727('0x22')]=_0x112f04[_0x575d29][_0x8727('0x21')];}}}}if(!_0x533e6d){logger[_0x8727('0x1f')]('['+[_0x2185e5[_0x8727('0x13')]()]+_0x8727('0x23'));_0x40f5c7[_0x8727('0x1b')]=_0x58e6f3[_0x8727('0xd')];for(_0x575d29=0x0;_0x575d29<_0x112f04['length'];_0x575d29++){if(_0x112f04[_0x575d29][_0x8727('0x1d')]===_0x58e6f3[_0x8727('0xd')]){_0x40f5c7['userId']=_0x112f04[_0x575d29]['systemuserid'];}}}_0x2ea789(_0x40f5c7);})[_0x8727('0x24')](function(_0x318684){_0x3d84db(_0x318684[_0x8727('0x14')]);});});}function createEndUser(_0x5de6fa,_0x98261b,_0x4cacf2,_0x267008,_0x440ff5,_0x2c8cd5){return new BPromise(function(_0xf33348,_0x262f36){return getAuthToken(_0x98261b,_0x4cacf2,_0x2c8cd5)[_0x8727('0x10')](function(_0x5d03f2){var _0x243f15=_0x2c8cd5[_0x8727('0x25')]()==='outbound'?_0x440ff5[_0x8727('0x26')]:_0x440ff5[_0x8727('0x27')];var _0x3ecd6a={'method':_0x8727('0x28'),'uri':_0x267008+_0x8727('0x29'),'body':{'telephone1':_0x243f15,'fullname':_0x243f15,'firstname':_0x243f15,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x8727('0x2a')+_0x5de6fa['userId']+')'},'headers':{'Authorization':_0x8727('0x16')+_0x5d03f2,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x3ecd6a);})[_0x8727('0x10')](function(_0x47e9f9){var _0x44ed83=_0x47e9f9[_0x8727('0x2b')][_0x8727('0x2c')];var _0x2322ab=_0x44ed83[_0x8727('0x2d')](_0x44ed83[_0x8727('0x2e')]('(')+0x1,_0x44ed83[_0x8727('0x2e')](')'));_0x5de6fa['enduserId']=_0x2322ab;_0xf33348(_0x5de6fa);})[_0x8727('0x24')](function(_0x3af17e){_0x262f36(_0x3af17e[_0x8727('0x14')]);});});}function getEndUser(_0x1b047a,_0x3374e8,_0x180674,_0x1626ff,_0x3070bd,_0x1661e9){return new BPromise(function(_0x4435c9,_0x14cfdc){return getAuthToken(_0x3374e8,_0x180674,_0x1661e9)[_0x8727('0x10')](function(_0x54bff3){var _0x4a0467={'method':_0x8727('0x15'),'uri':_0x1626ff+_0x8727('0x2f'),'headers':{'Authorization':_0x8727('0x16')+_0x54bff3,'If-None-Match':null,'OData-Version':_0x8727('0x17')},'json':!![]};return rp(_0x4a0467);})['then'](function(_0xf8f9e2){var _0x42f6dd=null;if(_0xf8f9e2){var _0x3276d5=_0xf8f9e2[_0x8727('0x18')];var _0x11d420=![];for(_0x42f6dd=0x0;_0x42f6dd<_0x3276d5['length'];_0x42f6dd++){var _0x30212d=_0x1661e9[_0x8727('0x25')]()===_0x8727('0x30')?_0x3070bd[_0x8727('0x26')]:_0x3070bd[_0x8727('0x27')];if(_0x3276d5[_0x42f6dd][_0x8727('0x31')]===_0x30212d){_0x11d420=!![];_0x1b047a[_0x8727('0x32')]=_0x3276d5[_0x42f6dd][_0x8727('0x33')];}}if(_0x11d420){_0x4435c9(_0x1b047a);}else{return createEndUser(_0x1b047a,_0x3374e8,_0x180674,_0x1626ff,_0x3070bd,_0x1661e9)[_0x8727('0x10')](function(_0x1a607a){logger[_0x8727('0x1f')]('['+[_0x1661e9[_0x8727('0x13')]()]+']\x20Enduser\x20created!',_0x1a607a[_0x8727('0x32')]);_0x4435c9(_0x1a607a);});}}else{return createEndUser(_0x1b047a,_0x3374e8,_0x180674,_0x1626ff,_0x3070bd,_0x1661e9)[_0x8727('0x10')](function(_0x3f56df){logger[_0x8727('0x1f')]('['+[_0x1661e9[_0x8727('0x13')]()]+_0x8727('0x34'),_0x3f56df[_0x8727('0x32')]);_0x4435c9(_0x3f56df);});}});});}function getCustomFields(_0x41b08e,_0x42d767,_0x2a1bd8){var _0xc05477={};if(_0x41b08e[_0x8727('0x1c')]>0x0){_[_0x8727('0x35')](_0x41b08e,function(_0x7e3454){if(_['includes']([_0x8727('0x36'),_0x8727('0x37')],_0x7e3454[_0x8727('0x38')])&&_0x7e3454['nameField']&&!_0x7e3454[_0x8727('0x39')]){var _0x1a4563=_0x7e3454[_0x8727('0x3a')][_0x8727('0x25')]();var _0x57817f=_0x1a4563[_0x8727('0x2d')](0x0,_0x1a4563[_0x8727('0x3b')]('_'));var _0x1b90e3=_0x1a4563[_0x8727('0x2d')](_0x1a4563[_0x8727('0x3b')]('_')+0x1);if(_0x57817f===_0x2a1bd8){_0xc05477[_0x1b90e3]=_0x7e3454[_0x8727('0x3c')];}}});}return _0xc05477;}function getTicket(_0x2fe40d,_0x15b764,_0x3aac97,_0x2b5ba7,_0x51e3fa,_0x307785,_0x24ae2d){return new BPromise(function(_0x21bfe8,_0x338f43){var _0x125de2;return getAuthToken(_0x15b764,_0x3aac97,_0x24ae2d)['then'](function(_0x161200){if(_0x307785[_0x8727('0x3d')]===_0x8727('0x3e')){_0x125de2={'method':'POST','uri':_0x2b5ba7+_0x8727('0x3f'),'body':Object[_0x8727('0x40')]({},{'title':intUtil[_0x8727('0x41')](_0x307785[_0x8727('0x42')],_0x51e3fa,'\x20'),'description':intUtil[_0x8727('0x41')](_0x307785[_0x8727('0x43')],_0x51e3fa,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x2fe40d[_0x8727('0x32')]+')','ownerid@odata.bind':_0x8727('0x2a')+_0x2fe40d[_0x8727('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x307785['Fields'],_0x51e3fa,_0x307785[_0x8727('0x3d')])),'headers':{'Authorization':_0x8727('0x16')+_0x161200,'OData-Version':_0x8727('0x17')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x307785[_0x8727('0x3d')]===_0x8727('0x44')){_0x125de2={'method':_0x8727('0x28'),'uri':_0x2b5ba7+_0x8727('0x45'),'body':Object['assign']({},{'subject':intUtil[_0x8727('0x41')](_0x307785[_0x8727('0x42')],_0x51e3fa,'\x20'),'phonenumber':String(_0x51e3fa[_0x8727('0x27')]),'description':intUtil[_0x8727('0x41')](_0x307785[_0x8727('0x43')],_0x51e3fa,'\x0a'),'regardingobjectid_contact@odata.bind':_0x8727('0x46')+_0x2fe40d[_0x8727('0x32')]+')','ownerid@odata.bind':'/systemusers('+_0x2fe40d[_0x8727('0x22')]+')','directioncode':_0x2fe40d[_0x8727('0x47')]===_0x8727('0x48')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x2fe40d[_0x8727('0x22')]+')','participationtypemask':_0x2fe40d[_0x8727('0x47')]===_0x8727('0x48')?0x2:0x1},{'partyid_contact@odata.bind':_0x8727('0x46')+_0x2fe40d[_0x8727('0x32')]+')','participationtypemask':_0x2fe40d[_0x8727('0x47')]===_0x8727('0x48')?0x1:0x2}]},getCustomFields(_0x307785['Fields'],_0x51e3fa,_0x307785[_0x8727('0x3d')])),'headers':{'Authorization':'Bearer\x20'+_0x161200,'OData-Version':_0x8727('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x125de2);})[_0x8727('0x10')](function(_0x594b9f){var _0x133973=_0x594b9f[_0x8727('0x2b')][_0x8727('0x2c')];var _0x5436a3=_0x133973['substring'](_0x133973[_0x8727('0x2e')]('(')+0x1,_0x133973[_0x8727('0x2e')](')'));_0x2fe40d[_0x8727('0x49')]=_0x5436a3;_0x21bfe8(_0x2fe40d);})['catch'](function(_0x102daf){_0x338f43(_0x102daf[_0x8727('0x14')]);});});}function emit(_0x1a4432,_0x23c062,_0x45527c,_0x962610){var _0x3fc503={'uri':util[_0x8727('0x4a')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x1a4432,_0x45527c,_0x962610)};io['to'](util[_0x8727('0x4a')](_0x8727('0x4b'),_0x23c062))[_0x8727('0x4c')](_0x8727('0x4d'),_0x3fc503);}exports['cs']=function(_0x4a19a6,_0x35a086,_0xeac48c,_0x257b4c,_0x8e0080,_0x37ab97,_0xfab21f,_0x28b9c0){var _0x38739f={};_0x37ab97['remoteUri']=intUtil[_0x8727('0x4e')](_0x37ab97[_0x8727('0xc')]);_0x37ab97[_0x8727('0x4f')]=intUtil['stripTrailingSlash'](_0x37ab97[_0x8727('0x4f')]);_0x38739f['callDirection']=_0x28b9c0===_0x8727('0x48')||_0x28b9c0==='unmanaged'?_0x8727('0x48'):_0x8727('0x30');var _0x5f4908=util[_0x8727('0x4a')](_0x8727('0x50'),_0x37ab97[_0x8727('0xc')]);var _0x5b0ee9=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x37ab97['tenantId']);var _0x3ac29a=util[_0x8727('0x4a')](_0x8727('0x51'),_0x37ab97[_0x8727('0x4f')],_0x35a086[_0x8727('0x52')],md5(_0x35a086['uniqueid']));if(_0x8e0080&&_0x8e0080['monitor_format']){logger[_0x8727('0x1f')](_0x8727('0x53'),_0x8727('0x54'));_0x35a086[_0x8727('0x55')]=_0x3ac29a;}else if(_0xfab21f&&_0xfab21f[_0x8727('0x56')]&&_0xfab21f[_0x8727('0x56')]!==_0x8727('0x57')){logger[_0x8727('0x1f')](_0x8727('0x58'),_0x8727('0x54'));_0x35a086[_0x8727('0x55')]=_0x3ac29a;}else{_0x35a086[_0x8727('0x55')]='';}return getUser(_0x38739f,_0x37ab97,_0x257b4c,_0x5b0ee9,_0x5f4908,_0x28b9c0)['then'](function(_0x178025){logger[_0x8727('0x1f')]('['+_0x28b9c0['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0x178025['userId']);logger['info']('['+_0x28b9c0[_0x8727('0x13')]()+_0x8727('0x59'),_0x178025['userEmail']);return getEndUser(_0x178025,_0x37ab97,_0x5b0ee9,_0x5f4908,_0x35a086,_0x28b9c0);})[_0x8727('0x10')](function(_0x39d962){logger[_0x8727('0x1f')]('['+_0x28b9c0[_0x8727('0x13')]()+_0x8727('0x5a'),_0x39d962['enduserId']);logger[_0x8727('0x1f')]('['+_0x28b9c0[_0x8727('0x13')]()+_0x8727('0x5b'),_0x35a086[_0x8727('0x27')]);return getTicket(_0x39d962,_0x37ab97,_0x5b0ee9,_0x5f4908,_0x35a086,_0xeac48c,_0x28b9c0);})[_0x8727('0x10')](function(_0x139cc7){logger[_0x8727('0x1f')](util[_0x8727('0x4a')]('['+_0x28b9c0[_0x8727('0x13')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0xeac48c[_0x8727('0x3d')],_0x139cc7[_0x8727('0x49')]));logger[_0x8727('0x1f')](util['format']('['+_0x28b9c0[_0x8727('0x13')]()+']\x20Call\x20direction:\x20%s',_0x28b9c0));if(_0x28b9c0!==_0x8727('0x5c')){logger[_0x8727('0x1f')]('['+_0x28b9c0[_0x8727('0x13')]()+']',_0x8727('0x5d'));emit(_0x37ab97[_0x8727('0xc')],_0x257b4c['name'],_0xeac48c['ticketType'],_0x139cc7[_0x8727('0x49')]);}})[_0x8727('0x24')](function(_0x19cda5){logger[_0x8727('0x12')]('['+_0x28b9c0[_0x8727('0x13')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x8727('0x5e')](_0x19cda5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index b73bab7..4f303c7 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 _0x6ce1=['user:%s','%s/helpdesk/tickets/%d','error','unmanaged','lastevent','Authorization','Ticket\x20created!','toUpperCase','request-promise','md5','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
','Tags','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','then','%s/api/v2/agents','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','POST','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','variable','variableName','push','Variable','name','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:'];(function(_0x469f30,_0x1c9d41){var _0x5b131d=function(_0x58f0d3){while(--_0x58f0d3){_0x469f30['push'](_0x469f30['shift']());}};_0x5b131d(++_0x1c9d41);}(_0x6ce1,0xca));var _0x16ce=function(_0x2203da,_0xc38ef3){_0x2203da=_0x2203da-0x0;var _0x3af6e4=_0x6ce1[_0x2203da];return _0x3af6e4;};'use strict';var _=require('lodash');var rp=require(_0x16ce('0x0'));var md5=require(_0x16ce('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x16ce('0x2'));var config=require(_0x16ce('0x3'));var logger=require(_0x16ce('0x4'))(_0x16ce('0x5'));config[_0x16ce('0x6')]=_[_0x16ce('0x7')](config[_0x16ce('0x6')],{'host':_0x16ce('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x16ce('0x6')]));var headers={'Content-Type':_0x16ce('0x9'),'Accept':_0x16ce('0x9')};function emit(_0x4845d9,_0x3d812e,_0x190192){io['to'](_0x4845d9)[_0x16ce('0xa')](_0x3d812e,_0x190192);}function getTicket(_0x266296,_0x29c8c,_0x4af52b,_0x51b4ce,_0x460287){logger[_0x16ce('0xb')](_0x16ce('0xc'));var _0x4ed6fa=_[_0x16ce('0xd')]({'responder_id':_0x29c8c['id'],'requester_id':_0x4af52b['id'],'name':util[_0x16ce('0xe')](_0x16ce('0xf'),_0x460287['calleridname']),'phone':_0x460287[_0x16ce('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x16ce('0x11')](_0x51b4ce[_0x16ce('0x12')],_0x460287,'\x20'),'description':intUtil['getString'](_0x51b4ce[_0x16ce('0x13')],_0x460287,_0x16ce('0x14')),'tags':getTags(_0x51b4ce[_0x16ce('0x15')],'name')},getCustomFields(_0x51b4ce[_0x16ce('0x16')],_0x460287));_0x4ed6fa[_0x16ce('0x17')]=_[_0x16ce('0x18')](_[_0x16ce('0x19')](_0x4ed6fa[_0x16ce('0x17')],'id'),_0x16ce('0x1a'));return request({'uri':util[_0x16ce('0xe')](_0x16ce('0x1b'),_0x266296[_0x16ce('0x1c')]),'method':'POST','body':_0x4ed6fa})[_0x16ce('0x1d')](function(_0x3b4f10){logger[_0x16ce('0xb')]('Ticket\x20created!');return _0x3b4f10;});}function getUser(_0x2fca85,_0x2305cd){if(intUtil['validateEmail'](_0x2305cd)){return request({'uri':util['format'](_0x16ce('0x1e'),_0x2fca85[_0x16ce('0x1c')]),'qs':{'email':_0x2305cd}})[_0x16ce('0x1d')](function(_0x269e79){if(_0x269e79['length']){logger[_0x16ce('0xb')](_0x16ce('0x1f'));return _[_0x16ce('0x20')](_0x269e79,function(_0x412a3b){return _0x412a3b[_0x16ce('0x21')]['email']===_0x2305cd;});}else{logger[_0x16ce('0xb')](_0x16ce('0x22'));return request({'uri':util[_0x16ce('0xe')](_0x16ce('0x23'),_0x2fca85['remoteUri'])})['then'](function(_0x433b61){logger[_0x16ce('0xb')](_0x16ce('0x24'));return _0x433b61;});}});}else{logger[_0x16ce('0xb')](_0x16ce('0x25'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x2fca85[_0x16ce('0x1c')])})[_0x16ce('0x1d')](function(_0x1a8330){logger[_0x16ce('0xb')](_0x16ce('0x24'));return _0x1a8330;});}}function getEndUser(_0x118bac,_0x9e1135,_0xd37af2){logger[_0x16ce('0xb')](_0x16ce('0x26'),_0xd37af2);return request({'uri':util[_0x16ce('0xe')]('%s/api/v2/contacts',_0x118bac[_0x16ce('0x1c')]),'qs':{'phone':_0xd37af2}})['then'](function(_0x15fe7a){if(_0x15fe7a[_0x16ce('0x27')]){logger['info'](_0x16ce('0x28'));return _[_0x16ce('0x20')](_0x15fe7a,{'phone':_0xd37af2});}else{logger['info'](_0x16ce('0x29'));return request({'uri':util[_0x16ce('0xe')](_0x16ce('0x2a'),_0x118bac[_0x16ce('0x1c')]),'method':_0x16ce('0x2b'),'body':{'name':_0x9e1135,'phone':_0xd37af2}})['then'](function(_0x22a677){logger['info'](_0x16ce('0x2c'));return _0x22a677;});}});}function getAuth(_0x43da6b){return util['format'](_0x16ce('0x2d'),new Buffer(_0x43da6b[_0x16ce('0x2e')]+':X')[_0x16ce('0x2f')](_0x16ce('0x30')));}function request(_0x29bbf2){logger[_0x16ce('0x31')](_0x16ce('0x32'),JSON[_0x16ce('0x33')](_0x29bbf2));return rp(_['defaults'](_0x29bbf2,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x38f0f7,_0x1d1994){var _0x3e8c82=[];if(_0x38f0f7&&_0x38f0f7['length']>0x0){_0x3e8c82=_[_0x16ce('0x34')](_0x38f0f7,_0x1d1994);}return _0x3e8c82;}function getCustomFields(_0x565482,_0x3a23a8){var _0x331f3e=[];var _0x51cf97={'custom_fields':[]};if(_0x565482[_0x16ce('0x27')]>0x0){_[_0x16ce('0x35')](_0x565482,function(_0x32e28b){if(_[_0x16ce('0x36')]([_0x16ce('0x37'),_0x16ce('0x38')],_0x32e28b[_0x16ce('0x39')])&&_0x32e28b[_0x16ce('0x3a')]&&!_0x32e28b[_0x16ce('0x3b')]){_0x51cf97[_0x32e28b[_0x16ce('0x3a')][_0x16ce('0x3c')]()]=_0x32e28b[_0x16ce('0x3d')][_0x16ce('0x2f')]();}else if(_[_0x16ce('0x36')]([_0x16ce('0x37'),_0x16ce('0x38')],_0x32e28b[_0x16ce('0x39')])&&_0x32e28b[_0x16ce('0x3e')]&&_0x32e28b[_0x16ce('0x3b')]){_0x51cf97[_0x16ce('0x17')]['push']({'id':_0x32e28b['idField'],'value':_0x32e28b['content'][_0x16ce('0x2f')]()});}else if(_0x32e28b['type']===_0x16ce('0x3f')&&_0x32e28b[_0x16ce('0x40')]&&_0x32e28b[_0x16ce('0x3e')]&&_0x32e28b[_0x16ce('0x3b')]){_0x3a23a8[_0x32e28b[_0x16ce('0x40')]]&&_0x51cf97[_0x16ce('0x17')][_0x16ce('0x41')]({'id':_0x32e28b[_0x16ce('0x3e')],'value':_0x3a23a8[_0x32e28b[_0x16ce('0x40')]][_0x16ce('0x2f')]()});}else if(_0x32e28b['type']==='customVariable'&&_0x32e28b[_0x16ce('0x42')]&&_0x32e28b[_0x16ce('0x42')][_0x16ce('0x43')]&&_0x32e28b['idField']&&_0x32e28b[_0x16ce('0x3b')]){_0x3a23a8[_0x32e28b[_0x16ce('0x42')][_0x16ce('0x43')][_0x16ce('0x3c')]()]&&_0x51cf97[_0x16ce('0x17')][_0x16ce('0x41')]({'id':_0x32e28b['idField'],'value':_0x3a23a8[_0x32e28b[_0x16ce('0x42')]['name'][_0x16ce('0x3c')]()]['toString']()});}});}return _0x51cf97;}exports['queue']=function(_0x653e48,_0x440198,_0x16b73b,_0x427bc1,_0x79ed06,_0x2c3f8c){var _0x1d9667,_0x398010;_0x2c3f8c[_0x16ce('0x1c')]=intUtil[_0x16ce('0x44')](_0x2c3f8c[_0x16ce('0x1c')]);_0x2c3f8c[_0x16ce('0x45')]=intUtil[_0x16ce('0x44')](_0x2c3f8c[_0x16ce('0x45')]);if(_0x79ed06&&_0x79ed06['monitor_format']){logger[_0x16ce('0xb')](_0x16ce('0x46'),_0x16ce('0x47'));_0x440198[_0x16ce('0x48')]=util['format'](_0x16ce('0x49'),_0x2c3f8c[_0x16ce('0x45')],_0x440198[_0x16ce('0x4a')],md5(_0x440198[_0x16ce('0x4a')]));}else{_0x440198[_0x16ce('0x48')]='';}headers['Authorization']=getAuth(_0x2c3f8c);return getUser(_0x2c3f8c,_0x427bc1['email'])[_0x16ce('0x1d')](function(_0x240612){_0x1d9667=_0x240612;logger[_0x16ce('0xb')](_0x16ce('0x4b'),_0x1d9667['id']);return getEndUser(_0x2c3f8c,_0x440198[_0x16ce('0x4c')],_0x440198[_0x16ce('0x10')]);})['then'](function(_0x3e700f){_0x398010=_0x3e700f;logger[_0x16ce('0xb')]('The\x20Enduser\x20ID\x20is:',_0x398010['id']);return getTicket(_0x2c3f8c,_0x1d9667,_0x398010,_0x16b73b,_0x440198);})[_0x16ce('0x1d')](function(_0x4ca98b){if(_0x4ca98b&&_0x4ca98b['id']){logger[_0x16ce('0xb')]('Ticket\x20created!');logger[_0x16ce('0xb')](_0x16ce('0x4d'),_0x4ca98b['id']);logger[_0x16ce('0xb')](_0x16ce('0x46'),_0x16ce('0x4e'));emit(util[_0x16ce('0xe')]('user:%s',_0x427bc1[_0x16ce('0x43')]),_0x16ce('0x4f'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x2c3f8c[_0x16ce('0x1c')],_0x4ca98b['id'])});}})[_0x16ce('0x50')](function(_0x4cda15){logger['error'](_0x16ce('0x46'),JSON['stringify'](_0x4cda15));});};exports[_0x16ce('0x51')]=function(_0x4a3caa,_0x32f60a,_0x310cf6,_0x32cbcf,_0x5a4b98,_0x2e498c,_0x2b4b9f){var _0x3ee88a,_0x5e2f79;_0x2e498c[_0x16ce('0x1c')]=intUtil['stripTrailingSlash'](_0x2e498c[_0x16ce('0x1c')]);_0x2e498c[_0x16ce('0x45')]=intUtil['stripTrailingSlash'](_0x2e498c[_0x16ce('0x45')]);if(_0x2b4b9f&&_0x2b4b9f['recordingFormat']&&_0x2b4b9f[_0x16ce('0x52')]!==_0x16ce('0x53')){logger[_0x16ce('0xb')](_0x16ce('0x54'),'Recording\x20is\x20enabled!');_0x32f60a[_0x16ce('0x48')]=util[_0x16ce('0xe')](_0x16ce('0x49'),_0x2e498c[_0x16ce('0x45')],_0x32f60a[_0x16ce('0x4a')],md5(_0x32f60a['uniqueid']));}headers['Authorization']=getAuth(_0x2e498c);return getUser(_0x2e498c,_0x32cbcf[_0x16ce('0x55')])[_0x16ce('0x1d')](function(_0x1759ad){_0x3ee88a=_0x1759ad;logger[_0x16ce('0xb')](_0x16ce('0x4b'),_0x3ee88a['id']);return getEndUser(_0x2e498c,_0x32f60a[_0x16ce('0x56')],_0x32f60a[_0x16ce('0x57')]);})[_0x16ce('0x1d')](function(_0x272a10){_0x5e2f79=_0x272a10;logger[_0x16ce('0xb')](_0x16ce('0x58'),_0x5e2f79['id']);return getTicket(_0x2e498c,_0x3ee88a,_0x5e2f79,_0x310cf6,_0x32f60a);})['then'](function(_0x41449b){if(_0x41449b&&_0x41449b['id']){logger[_0x16ce('0xb')]('Ticket\x20created!');logger[_0x16ce('0xb')](_0x16ce('0x4d'),_0x41449b['id']);logger[_0x16ce('0xb')](_0x16ce('0x54'),_0x16ce('0x4e'));emit(util[_0x16ce('0xe')](_0x16ce('0x59'),_0x32cbcf['name']),_0x16ce('0x4f'),{'uri':util[_0x16ce('0xe')](_0x16ce('0x5a'),_0x2e498c['remoteUri'],_0x41449b['id'])});}})[_0x16ce('0x50')](function(_0x1c838a){logger[_0x16ce('0x5b')](_0x16ce('0x54'),JSON[_0x16ce('0x33')](_0x1c838a));});};exports[_0x16ce('0x5c')]=function(_0x1aca85,_0x11f96f,_0x568351,_0x22fe19,_0x3d15fe,_0x507c2e){var _0x153ba7,_0x4ff78b;_0x507c2e[_0x16ce('0x1c')]=intUtil['stripTrailingSlash'](_0x507c2e[_0x16ce('0x1c')]);_0x507c2e['serverUrl']=intUtil['stripTrailingSlash'](_0x507c2e['serverUrl']);if(_0x3d15fe&&_0x3d15fe['monitor_format']){logger[_0x16ce('0xb')]('['+_0x11f96f[_0x16ce('0x5d')]['toUpperCase']()+']',_0x16ce('0x47'));_0x11f96f[_0x16ce('0x48')]=util[_0x16ce('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x507c2e[_0x16ce('0x45')],_0x11f96f['uniqueid'],md5(_0x11f96f[_0x16ce('0x4a')]));}else{_0x11f96f[_0x16ce('0x48')]='';}headers[_0x16ce('0x5e')]=getAuth(_0x507c2e);return getUser(_0x507c2e,'')[_0x16ce('0x1d')](function(_0x40829a){_0x153ba7=_0x40829a;logger[_0x16ce('0xb')](_0x16ce('0x4b'),_0x153ba7['id']);return getEndUser(_0x507c2e,_0x11f96f['calleridname'],_0x11f96f[_0x16ce('0x10')]);})[_0x16ce('0x1d')](function(_0x416127){_0x4ff78b=_0x416127;logger['info'](_0x16ce('0x58'),_0x4ff78b['id']);return getTicket(_0x507c2e,_0x153ba7,_0x4ff78b,_0x568351,_0x11f96f);})[_0x16ce('0x1d')](function(_0x168e83){if(_0x168e83){logger['info'](_0x16ce('0x5f'));logger['info'](_0x16ce('0x4d'),_0x168e83['id']);}})[_0x16ce('0x50')](function(_0x3e75f0){logger[_0x16ce('0x5b')]('['+_0x11f96f[_0x16ce('0x5d')][_0x16ce('0x60')]()+']',JSON[_0x16ce('0x33')](_0x3e75f0));});}; \ No newline at end of file +var _0xefac=['includes','string','picklist','customField','toLowerCase','content','idField','push','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','unmanaged','lastevent','toUpperCase','request-promise','md5','util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','Subjects','getString','Descriptions','name','Fields','custom_fields','mapValues','value','%s/api/v2/tickets','remoteUri','then','Ticket\x20created!','length','Agent\x20found!','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','toString','base64','debug','[HTTP]','GET','map','forEach'];(function(_0x33f5de,_0x5e4f9e){var _0x1add2f=function(_0x21c199){while(--_0x21c199){_0x33f5de['push'](_0x33f5de['shift']());}};_0x1add2f(++_0x5e4f9e);}(_0xefac,0x192));var _0xcefa=function(_0x2f9731,_0xe348cb){_0x2f9731=_0x2f9731-0x0;var _0x377a3f=_0xefac[_0x2f9731];return _0x377a3f;};'use strict';var _=require('lodash');var rp=require(_0xcefa('0x0'));var md5=require(_0xcefa('0x1'));var util=require(_0xcefa('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xcefa('0x3'));var logger=require(_0xcefa('0x4'))(_0xcefa('0x5'));config[_0xcefa('0x6')]=_[_0xcefa('0x7')](config[_0xcefa('0x6')],{'host':_0xcefa('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcefa('0x6')]));var headers={'Content-Type':_0xcefa('0x9'),'Accept':_0xcefa('0x9')};function emit(_0x3d02da,_0x13d496,_0x2f7bab){io['to'](_0x3d02da)[_0xcefa('0xa')](_0x13d496,_0x2f7bab);}function getTicket(_0x5818a6,_0x1955a9,_0x4088cf,_0x2f9ed9,_0x5f89cf){logger[_0xcefa('0xb')](_0xcefa('0xc'));var _0x4bd435=_[_0xcefa('0xd')]({'responder_id':_0x1955a9['id'],'requester_id':_0x4088cf['id'],'name':util[_0xcefa('0xe')](_0xcefa('0xf'),_0x5f89cf['calleridname']),'phone':_0x5f89cf['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x2f9ed9[_0xcefa('0x10')],_0x5f89cf,'\x20'),'description':intUtil[_0xcefa('0x11')](_0x2f9ed9[_0xcefa('0x12')],_0x5f89cf,'
'),'tags':getTags(_0x2f9ed9['Tags'],_0xcefa('0x13'))},getCustomFields(_0x2f9ed9[_0xcefa('0x14')],_0x5f89cf));_0x4bd435[_0xcefa('0x15')]=_[_0xcefa('0x16')](_['keyBy'](_0x4bd435[_0xcefa('0x15')],'id'),_0xcefa('0x17'));return request({'uri':util[_0xcefa('0xe')](_0xcefa('0x18'),_0x5818a6[_0xcefa('0x19')]),'method':'POST','body':_0x4bd435})[_0xcefa('0x1a')](function(_0x17c5fc){logger[_0xcefa('0xb')](_0xcefa('0x1b'));return _0x17c5fc;});}function getUser(_0x720a20,_0x19479b){if(intUtil['validateEmail'](_0x19479b)){return request({'uri':util['format']('%s/api/v2/agents',_0x720a20[_0xcefa('0x19')]),'qs':{'email':_0x19479b}})[_0xcefa('0x1a')](function(_0x55027d){if(_0x55027d[_0xcefa('0x1c')]){logger[_0xcefa('0xb')](_0xcefa('0x1d'));return _[_0xcefa('0x1e')](_0x55027d,function(_0x5e4223){return _0x5e4223['contact']['email']===_0x19479b;});}else{logger[_0xcefa('0xb')](_0xcefa('0x1f'));return request({'uri':util[_0xcefa('0xe')](_0xcefa('0x20'),_0x720a20[_0xcefa('0x19')])})[_0xcefa('0x1a')](function(_0x1aea00){logger[_0xcefa('0xb')]('Admin\x20account\x20selected.');return _0x1aea00;});}});}else{logger[_0xcefa('0xb')](_0xcefa('0x21'));return request({'uri':util[_0xcefa('0xe')](_0xcefa('0x20'),_0x720a20['remoteUri'])})[_0xcefa('0x1a')](function(_0x3a8dee){logger['info'](_0xcefa('0x22'));return _0x3a8dee;});}}function getEndUser(_0x235ae3,_0x3c7546,_0x3ebba2){logger[_0xcefa('0xb')](_0xcefa('0x23'),_0x3ebba2);return request({'uri':util[_0xcefa('0xe')](_0xcefa('0x24'),_0x235ae3['remoteUri']),'qs':{'phone':_0x3ebba2}})[_0xcefa('0x1a')](function(_0x3914c4){if(_0x3914c4['length']){logger[_0xcefa('0xb')](_0xcefa('0x25'));return _[_0xcefa('0x1e')](_0x3914c4,{'phone':_0x3ebba2});}else{logger[_0xcefa('0xb')](_0xcefa('0x26'));return request({'uri':util['format'](_0xcefa('0x24'),_0x235ae3['remoteUri']),'method':'POST','body':{'name':_0x3c7546,'phone':_0x3ebba2}})[_0xcefa('0x1a')](function(_0x465841){logger['info'](_0xcefa('0x27'));return _0x465841;});}});}function getAuth(_0x11198d){return util[_0xcefa('0xe')](_0xcefa('0x28'),new Buffer(_0x11198d['apiKey']+':X')[_0xcefa('0x29')](_0xcefa('0x2a')));}function request(_0x2736da){logger[_0xcefa('0x2b')](_0xcefa('0x2c'),JSON['stringify'](_0x2736da));return rp(_['defaults'](_0x2736da,{'method':_0xcefa('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0x965c9e,_0x134c48){var _0x4aae2b=[];if(_0x965c9e&&_0x965c9e[_0xcefa('0x1c')]>0x0){_0x4aae2b=_[_0xcefa('0x2e')](_0x965c9e,_0x134c48);}return _0x4aae2b;}function getCustomFields(_0x950f1d,_0x34a41d){var _0xed3ef4=[];var _0x46c7a6={'custom_fields':[]};if(_0x950f1d[_0xcefa('0x1c')]>0x0){_[_0xcefa('0x2f')](_0x950f1d,function(_0xfc2257){if(_[_0xcefa('0x30')]([_0xcefa('0x31'),_0xcefa('0x32')],_0xfc2257['type'])&&_0xfc2257['nameField']&&!_0xfc2257[_0xcefa('0x33')]){_0x46c7a6[_0xfc2257['nameField'][_0xcefa('0x34')]()]=_0xfc2257[_0xcefa('0x35')][_0xcefa('0x29')]();}else if(_[_0xcefa('0x30')]([_0xcefa('0x31'),_0xcefa('0x32')],_0xfc2257['type'])&&_0xfc2257[_0xcefa('0x36')]&&_0xfc2257[_0xcefa('0x33')]){_0x46c7a6[_0xcefa('0x15')][_0xcefa('0x37')]({'id':_0xfc2257[_0xcefa('0x36')],'value':_0xfc2257['content'][_0xcefa('0x29')]()});}else if(_0xfc2257['type']==='variable'&&_0xfc2257[_0xcefa('0x38')]&&_0xfc2257['idField']&&_0xfc2257[_0xcefa('0x33')]){_0x34a41d[_0xfc2257[_0xcefa('0x38')]]&&_0x46c7a6[_0xcefa('0x15')]['push']({'id':_0xfc2257['idField'],'value':_0x34a41d[_0xfc2257[_0xcefa('0x38')]][_0xcefa('0x29')]()});}else if(_0xfc2257['type']===_0xcefa('0x39')&&_0xfc2257[_0xcefa('0x3a')]&&_0xfc2257[_0xcefa('0x3a')][_0xcefa('0x13')]&&_0xfc2257[_0xcefa('0x36')]&&_0xfc2257[_0xcefa('0x33')]){_0x34a41d[_0xfc2257[_0xcefa('0x3a')][_0xcefa('0x13')][_0xcefa('0x34')]()]&&_0x46c7a6[_0xcefa('0x15')][_0xcefa('0x37')]({'id':_0xfc2257[_0xcefa('0x36')],'value':_0x34a41d[_0xfc2257['Variable']['name'][_0xcefa('0x34')]()][_0xcefa('0x29')]()});}});}return _0x46c7a6;}exports[_0xcefa('0x3b')]=function(_0x230a3c,_0x2eac74,_0x172a84,_0x22fa39,_0x4d0b38,_0x57f0d7){var _0x44cadb,_0x3774ab;_0x57f0d7[_0xcefa('0x19')]=intUtil[_0xcefa('0x3c')](_0x57f0d7['remoteUri']);_0x57f0d7['serverUrl']=intUtil[_0xcefa('0x3c')](_0x57f0d7[_0xcefa('0x3d')]);if(_0x4d0b38&&_0x4d0b38[_0xcefa('0x3e')]){logger[_0xcefa('0xb')]('[QUEUE]',_0xcefa('0x3f'));_0x2eac74[_0xcefa('0x40')]=util['format'](_0xcefa('0x41'),_0x57f0d7['serverUrl'],_0x2eac74[_0xcefa('0x42')],md5(_0x2eac74[_0xcefa('0x42')]));}else{_0x2eac74['recordingURL']='';}headers['Authorization']=getAuth(_0x57f0d7);return getUser(_0x57f0d7,_0x22fa39[_0xcefa('0x43')])[_0xcefa('0x1a')](function(_0x11862f){_0x44cadb=_0x11862f;logger[_0xcefa('0xb')](_0xcefa('0x44'),_0x44cadb['id']);return getEndUser(_0x57f0d7,_0x2eac74[_0xcefa('0x45')],_0x2eac74[_0xcefa('0x46')]);})[_0xcefa('0x1a')](function(_0x34560c){_0x3774ab=_0x34560c;logger[_0xcefa('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3774ab['id']);return getTicket(_0x57f0d7,_0x44cadb,_0x3774ab,_0x172a84,_0x2eac74);})[_0xcefa('0x1a')](function(_0x1bbd12){if(_0x1bbd12&&_0x1bbd12['id']){logger[_0xcefa('0xb')](_0xcefa('0x1b'));logger[_0xcefa('0xb')](_0xcefa('0x47'),_0x1bbd12['id']);logger[_0xcefa('0xb')](_0xcefa('0x48'),_0xcefa('0x49'));emit(util['format'](_0xcefa('0x4a'),_0x22fa39[_0xcefa('0x13')]),_0xcefa('0x4b'),{'uri':util['format'](_0xcefa('0x4c'),_0x57f0d7[_0xcefa('0x19')],_0x1bbd12['id'])});}})[_0xcefa('0x4d')](function(_0x4e3acf){logger[_0xcefa('0x4e')](_0xcefa('0x48'),JSON[_0xcefa('0x4f')](_0x4e3acf));});};exports[_0xcefa('0x50')]=function(_0x22b3ab,_0x525d43,_0x1170c4,_0xab4a4e,_0x380b3d,_0x4552d4,_0x336140){var _0xf38b56,_0x41671f;_0x4552d4['remoteUri']=intUtil[_0xcefa('0x3c')](_0x4552d4[_0xcefa('0x19')]);_0x4552d4[_0xcefa('0x3d')]=intUtil['stripTrailingSlash'](_0x4552d4['serverUrl']);if(_0x336140&&_0x336140[_0xcefa('0x51')]&&_0x336140[_0xcefa('0x51')]!=='none'){logger[_0xcefa('0xb')](_0xcefa('0x52'),_0xcefa('0x3f'));_0x525d43[_0xcefa('0x40')]=util[_0xcefa('0xe')](_0xcefa('0x41'),_0x4552d4[_0xcefa('0x3d')],_0x525d43[_0xcefa('0x42')],md5(_0x525d43[_0xcefa('0x42')]));}headers[_0xcefa('0x53')]=getAuth(_0x4552d4);return getUser(_0x4552d4,_0xab4a4e[_0xcefa('0x43')])[_0xcefa('0x1a')](function(_0x199abf){_0xf38b56=_0x199abf;logger['info']('The\x20User\x20ID\x20is:',_0xf38b56['id']);return getEndUser(_0x4552d4,_0x525d43[_0xcefa('0x54')],_0x525d43[_0xcefa('0x55')]);})['then'](function(_0xdba0ca){_0x41671f=_0xdba0ca;logger[_0xcefa('0xb')](_0xcefa('0x56'),_0x41671f['id']);return getTicket(_0x4552d4,_0xf38b56,_0x41671f,_0x1170c4,_0x525d43);})['then'](function(_0x350d18){if(_0x350d18&&_0x350d18['id']){logger['info']('Ticket\x20created!');logger[_0xcefa('0xb')](_0xcefa('0x47'),_0x350d18['id']);logger[_0xcefa('0xb')]('[OUTBOUND]',_0xcefa('0x49'));emit(util[_0xcefa('0xe')](_0xcefa('0x4a'),_0xab4a4e[_0xcefa('0x13')]),_0xcefa('0x4b'),{'uri':util[_0xcefa('0xe')](_0xcefa('0x4c'),_0x4552d4[_0xcefa('0x19')],_0x350d18['id'])});}})[_0xcefa('0x4d')](function(_0x33f3d2){logger[_0xcefa('0x4e')](_0xcefa('0x52'),JSON['stringify'](_0x33f3d2));});};exports[_0xcefa('0x57')]=function(_0x50d639,_0x16de2f,_0x341803,_0x2aa563,_0x238087,_0x437b83){var _0x2f1a1d,_0x833cac;_0x437b83['remoteUri']=intUtil[_0xcefa('0x3c')](_0x437b83['remoteUri']);_0x437b83[_0xcefa('0x3d')]=intUtil[_0xcefa('0x3c')](_0x437b83['serverUrl']);if(_0x238087&&_0x238087[_0xcefa('0x3e')]){logger[_0xcefa('0xb')]('['+_0x16de2f[_0xcefa('0x58')][_0xcefa('0x59')]()+']',_0xcefa('0x3f'));_0x16de2f[_0xcefa('0x40')]=util['format'](_0xcefa('0x41'),_0x437b83[_0xcefa('0x3d')],_0x16de2f[_0xcefa('0x42')],md5(_0x16de2f[_0xcefa('0x42')]));}else{_0x16de2f['recordingURL']='';}headers[_0xcefa('0x53')]=getAuth(_0x437b83);return getUser(_0x437b83,'')[_0xcefa('0x1a')](function(_0x584d14){_0x2f1a1d=_0x584d14;logger[_0xcefa('0xb')](_0xcefa('0x44'),_0x2f1a1d['id']);return getEndUser(_0x437b83,_0x16de2f[_0xcefa('0x45')],_0x16de2f[_0xcefa('0x46')]);})['then'](function(_0x4730ce){_0x833cac=_0x4730ce;logger[_0xcefa('0xb')](_0xcefa('0x56'),_0x833cac['id']);return getTicket(_0x437b83,_0x2f1a1d,_0x833cac,_0x341803,_0x16de2f);})[_0xcefa('0x1a')](function(_0x1d0293){if(_0x1d0293){logger[_0xcefa('0xb')]('Ticket\x20created!');logger['info'](_0xcefa('0x47'),_0x1d0293['id']);}})[_0xcefa('0x4d')](function(_0x2432b5){logger['error']('['+_0x16de2f[_0xcefa('0x58')]['toUpperCase']()+']',JSON[_0xcefa('0x4f')](_0x2432b5));});}; \ 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 8e3df5e..9b73174 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 _0x9efe=['add','Task\x20created:','ticketId','/contacts/','user:%s','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','message','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','error','/api/lookup?q=','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','headers','contact','toUpperCase','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9efe,0xca));var _0xe9ef=function(_0x3653c7,_0xadb356){_0x3653c7=_0x3653c7-0x0;var _0x58a021=_0x9efe[_0x3653c7];return _0x58a021;};'use strict';var _=require('lodash');var rp=require(_0xe9ef('0x0'));var md5=require(_0xe9ef('0x1'));var util=require(_0xe9ef('0x2'));var moment=require(_0xe9ef('0x3'));var Promise=require(_0xe9ef('0x4'));var Redis=require('ioredis');var intUtil=require(_0xe9ef('0x5'));var config=require(_0xe9ef('0x6'));var logger=require(_0xe9ef('0x7'))(_0xe9ef('0x8'));config[_0xe9ef('0x9')]=_[_0xe9ef('0xa')](config[_0xe9ef('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x40ffdc,_0x2f7280,_0x39dfc9,_0x502e42){return new Promise(function(_0x51b634,_0x55d349){var _0x4f4122=![];var _0x341d45={'method':_0xe9ef('0xb'),'uri':_0x502e42+_0xe9ef('0xc'),'json':!![]};_0x341d45['headers']=_0x39dfc9;logger[_0xe9ef('0xd')](_0xe9ef('0xe'));return rp(_0x341d45)[_0xe9ef('0xf')](function(_0x42184b){if(_0x42184b){var _0x245811=_0x42184b[_0xe9ef('0x10')];var _0x58df0a=null;for(_0x58df0a=0x0;_0x58df0a<_0x245811[_0xe9ef('0x11')];_0x58df0a++){if(_0x245811[_0x58df0a][_0xe9ef('0x12')]===_0x40ffdc[_0xe9ef('0x13')]){_0x40ffdc[_0xe9ef('0x14')]=_0x245811[_0x58df0a]['id'];_0x4f4122=!![];}}if(_0x4f4122){logger[_0xe9ef('0xd')]('Admin\x20found:',_0x40ffdc[_0xe9ef('0x14')]);_0x51b634(_0x40ffdc);}else{_0x55d349({'statusCode':0x194,'message':_0xe9ef('0x15')});}}else{_0x55d349({'statusCode':0x194,'message':_0xe9ef('0x15')});}})[_0xe9ef('0x16')](function(_0x2c7f15){logger['error']('['+[_0x2f7280['toUpperCase']()]+']',_0x2c7f15[_0xe9ef('0x17')]);_0x55d349(_0x2c7f15);});});}function getUser(_0x5b9d02,_0x8ed5e3,_0x168f62){return function(_0x3c94c3){return new Promise(function(_0x50a8d7,_0x104f82){var _0x1f1fad={'method':_0xe9ef('0xb'),'uri':_0x168f62+_0xe9ef('0xc'),'json':!![]};_0x1f1fad['headers']=_0x8ed5e3;logger[_0xe9ef('0xd')]('Getting\x20user\x20list');return rp(_0x1f1fad)['then'](function(_0x17a46b){if(_0x17a46b){var _0x446728=_0x17a46b['users'];var _0x3d4780=![];var _0x275012=null;if(_0x3c94c3[_0xe9ef('0x18')]!==null){logger['info'](_0xe9ef('0x19'),_0x3c94c3[_0xe9ef('0x18')]);_0x3c94c3[_0xe9ef('0x1a')]=_0x3c94c3[_0xe9ef('0x18')];for(_0x275012=0x0;_0x275012<_0x446728[_0xe9ef('0x11')];_0x275012++){if(_0x446728[_0x275012]['email']===_0x3c94c3[_0xe9ef('0x18')]){_0x3d4780=!![];_0x3c94c3[_0xe9ef('0x1b')]=_0x446728[_0x275012]['id'];logger[_0xe9ef('0xd')](_0xe9ef('0x1c'),_0x3c94c3[_0xe9ef('0x1b')]);}}}if(!_0x3d4780){logger[_0xe9ef('0xd')](_0xe9ef('0x1d'));_0x3c94c3['userEmail']=_0x3c94c3[_0xe9ef('0x13')];_0x3c94c3['userId']=_0x3c94c3['adminId'];_0x3d4780=!![];}if(_0x3d4780){_0x50a8d7(_0x3c94c3);}else{_0x104f82({'statusCode':0x194,'message':_0xe9ef('0x15')});}}else{_0x104f82({'statusCode':0x194,'message':_0xe9ef('0x15')});}})[_0xe9ef('0x16')](function(_0x13a500){logger[_0xe9ef('0x1e')]('['+[_0x5b9d02['toUpperCase']()]+']',_0x13a500[_0xe9ef('0x17')]);_0x104f82(_0x13a500);});});};}function searchContact(_0x3bedc4,_0x368a5d,_0x2da474,_0x1ea8af){return new Promise(function(_0x31d562,_0x3866c){var _0x837724={'method':_0xe9ef('0xb'),'headers':_0x368a5d,'uri':_0x3bedc4+_0xe9ef('0x1f')+_0x1ea8af+_0xe9ef('0x20')+_0x2da474+_0xe9ef('0x21'),'json':!![]};rp(_0x837724)['then'](function(_0x2f5e2e){var _0x5ad8d5=_[_0xe9ef('0x22')](_0x2f5e2e[_0xe9ef('0x23')][_0xe9ef('0x23')],[_0x2da474,_0x1ea8af]);_0x31d562(_0x5ad8d5);})[_0xe9ef('0x16')](function(_0x3175bd){_0x3866c(_0x3175bd);});});}function getEndUser(_0x2ff42b,_0x11acab,_0x3509bc){return function(_0x302904){return new Promise(function(_0x517eec,_0x1a963f){logger['info'](util['format'](_0xe9ef('0x24'),_0x302904[_0xe9ef('0x25')]));searchContact(_0x3509bc,_0x11acab,_0xe9ef('0x26'),_0x302904[_0xe9ef('0x25')])[_0xe9ef('0xf')](function(_0x1fa509){if(_0x1fa509){_0x302904[_0xe9ef('0x27')]=_0x1fa509['id'];logger[_0xe9ef('0xd')](_0xe9ef('0x28'),_0x302904[_0xe9ef('0x27')]);return _0x517eec(_0x302904);}searchContact(_0x3509bc,_0x11acab,_0xe9ef('0x29'),_0x302904[_0xe9ef('0x25')])['then'](function(_0x80cddb){if(_0x80cddb){_0x302904[_0xe9ef('0x27')]=_0x80cddb['id'];logger[_0xe9ef('0xd')](_0xe9ef('0x2a'),_0x302904['endUserId']);return _0x517eec(_0x302904);}createEndUser(_0x302904,_0x2ff42b,_0x11acab,_0x3509bc)[_0xe9ef('0xf')](function(_0x3d28ac){logger[_0xe9ef('0xd')](_0xe9ef('0x2b'),_0x3d28ac[_0xe9ef('0x27')]);return _0x517eec(_0x3d28ac);});});})[_0xe9ef('0x16')](function(_0x10b3c6){_0x1a963f(_0x10b3c6);});});};}function createEndUser(_0x17de02,_0x201ec3,_0xf0b690,_0x4325c3){return new Promise(function(_0x10c487,_0x3ea6c0){var _0x439dca=moment();var _0x2617ca={'method':_0xe9ef('0x2c'),'uri':_0x4325c3+_0xe9ef('0x2d'),'body':{'contact':{'last_name':_0x17de02[_0xe9ef('0x25')],'work_number':_0x17de02[_0xe9ef('0x25')],'mobile_number':_0x17de02[_0xe9ef('0x25')],'owner_id':_0x17de02[_0xe9ef('0x1b')],'created_at':_0x439dca[_0xe9ef('0x2e')](_0xe9ef('0x2f'))}},'json':!![]};_0x2617ca[_0xe9ef('0x30')]=_0xf0b690;logger[_0xe9ef('0xd')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x2617ca)[_0xe9ef('0xf')](function(_0x3d3ff7){_0x17de02['endUserId']=_0x3d3ff7[_0xe9ef('0x31')]['id'];_0x10c487(_0x17de02);})['catch'](function(_0x3db316){logger[_0xe9ef('0x1e')]('['+[_0x201ec3[_0xe9ef('0x32')]()]+']',_0x3db316[_0xe9ef('0x17')]);_0x3ea6c0(_0x3db316['message']);});});}function getTicket(_0x326733,_0xa80c48,_0xa34665,_0x125fb7,_0x287fbd){return function(_0x4a4124){logger['info'](_0xe9ef('0x33'));return new Promise(function(_0x6c7258,_0x4021f8){var _0x22b0c8=moment();var _0x366e1c={'method':_0xe9ef('0x2c'),'uri':_0xa34665+_0xe9ef('0x34'),'body':{'title':intUtil[_0xe9ef('0x35')](_0x125fb7['Subjects'],_0x287fbd,'\x20'),'description':intUtil[_0xe9ef('0x35')](_0x125fb7[_0xe9ef('0x36')],_0x287fbd,'\x0a'),'owner_id':_0x4a4124['userId'],'creater_id':_0x4a4124[_0xe9ef('0x14')],'targetable_id':_0x4a4124[_0xe9ef('0x27')],'targetable_type':_0xe9ef('0x37'),'created_at':_0x22b0c8[_0xe9ef('0x2e')](_0xe9ef('0x2f')),'due_date':_0x22b0c8[_0xe9ef('0x38')](0x1e,'m')[_0xe9ef('0x2e')](_0xe9ef('0x2f'))},'json':!![]};_0x366e1c[_0xe9ef('0x30')]=_0xa80c48;return rp(_0x366e1c)[_0xe9ef('0xf')](function(_0x5c930e){_0x4a4124['ticketId']=_0x5c930e['task']['id'];logger[_0xe9ef('0xd')](_0xe9ef('0x39'),_0x4a4124[_0xe9ef('0x3a')]);_0x6c7258(_0x4a4124);})['catch'](function(_0x50beaa){logger[_0xe9ef('0x1e')]('['+[_0x326733['toUpperCase']()]+']',_0x50beaa[_0xe9ef('0x17')]);_0x4021f8(_0x50beaa['message']);});});};}function emit(_0xf9ba94,_0x1f843a,_0x352240){var _0x880370={'uri':_0xf9ba94+_0xe9ef('0x3b')+_0x352240};io['to'](util[_0xe9ef('0x2e')](_0xe9ef('0x3c'),_0x1f843a))['emit']('trigger:browser:url',_0x880370);}exports['cs']=function(_0x55becf,_0x2c5b67,_0x5862bd,_0x2aac75,_0x58dc05,_0x3f4f04,_0x17735b,_0x358c3c){var _0x29ed7d={};var _0x30759e={'Authorization':_0xe9ef('0x3d')+_0x3f4f04[_0xe9ef('0x3e')]};_0x3f4f04['remoteUri']=intUtil['stripTrailingSlash'](_0x3f4f04[_0xe9ef('0x3f')]);_0x3f4f04[_0xe9ef('0x40')]=intUtil[_0xe9ef('0x41')](_0x3f4f04[_0xe9ef('0x40')]);var _0xae54b0=_0x3f4f04[_0xe9ef('0x3f')];_0x29ed7d[_0xe9ef('0x13')]=_0x3f4f04[_0xe9ef('0x42')];_0x29ed7d['contactNumber']=_0x358c3c[_0xe9ef('0x43')]()===_0xe9ef('0x44')?_0x2c5b67[_0xe9ef('0x45')]:_0x2c5b67[_0xe9ef('0x46')];_0x29ed7d[_0xe9ef('0x47')]=_0x358c3c===_0xe9ef('0x48')||_0x358c3c==='unmanaged'?_0xe9ef('0x48'):_0xe9ef('0x44');if(_0x2aac75){_0x29ed7d[_0xe9ef('0x18')]=_0x2aac75[_0xe9ef('0x12')];}var _0x2e5a3a=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3f4f04[_0xe9ef('0x40')],_0x2c5b67[_0xe9ef('0x49')],md5(_0x2c5b67[_0xe9ef('0x49')]));if(_0x58dc05&&_0x58dc05[_0xe9ef('0x4a')]){logger[_0xe9ef('0xd')]('[QUEUE]',_0xe9ef('0x4b'));_0x2c5b67[_0xe9ef('0x4c')]=_0x2e5a3a;}else if(_0x17735b&&_0x17735b[_0xe9ef('0x4d')]&&_0x17735b[_0xe9ef('0x4d')]!==_0xe9ef('0x4e')){logger[_0xe9ef('0xd')](_0xe9ef('0x4f'),_0xe9ef('0x4b'));_0x2c5b67[_0xe9ef('0x4c')]=_0x2e5a3a;}else{_0x2c5b67['recordingURL']='';}return getAdminId(_0x29ed7d,_0x358c3c,_0x30759e,_0xae54b0)[_0xe9ef('0xf')](getUser(_0x358c3c,_0x30759e,_0xae54b0))['then'](getEndUser(_0x358c3c,_0x30759e,_0xae54b0))[_0xe9ef('0xf')](getTicket(_0x358c3c,_0x30759e,_0xae54b0,_0x5862bd,_0x2c5b67))[_0xe9ef('0xf')](function(_0x4e7f6a){logger[_0xe9ef('0xd')](util['format'](_0xe9ef('0x50'),_0x4e7f6a[_0xe9ef('0x3a')]));if(_0x358c3c!==_0xe9ef('0x51')){logger[_0xe9ef('0xd')]('['+[_0x358c3c['toUpperCase']()]+']',_0xe9ef('0x52'));emit(_0xae54b0,_0x2aac75[_0xe9ef('0x53')],_0x4e7f6a['endUserId']);}})[_0xe9ef('0x16')](function(_0x5bd0b5){logger[_0xe9ef('0x1e')]('['+[_0x358c3c[_0xe9ef('0x32')]()]+_0xe9ef('0x54'),util[_0xe9ef('0x55')](_0x5bd0b5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6c84=['contact','/api/tasks','getString','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','destcalleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','md5','util','moment','ioredis','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','GET','users','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','adminEmail','error','/api/lookup?q=','&entities=contact','contacts','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact'];(function(_0x16f0bd,_0x1e57aa){var _0x5b3636=function(_0x3b32d7){while(--_0x3b32d7){_0x16f0bd['push'](_0x16f0bd['shift']());}};_0x5b3636(++_0x1e57aa);}(_0x6c84,0x112));var _0x46c8=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x6c84[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x46c8('0x0'));var rp=require(_0x46c8('0x1'));var md5=require(_0x46c8('0x2'));var util=require(_0x46c8('0x3'));var moment=require(_0x46c8('0x4'));var Promise=require('bluebird');var Redis=require(_0x46c8('0x5'));var intUtil=require('./util');var config=require(_0x46c8('0x6'));var logger=require('../../../../config/logger')('freshsales');config[_0x46c8('0x7')]=_[_0x46c8('0x8')](config[_0x46c8('0x7')],{'host':_0x46c8('0x9'),'port':0x18eb});var io=require(_0x46c8('0xa'))(new Redis(config[_0x46c8('0x7')]));function getAdminId(_0xfe26c8,_0x1727f4,_0x5c0684,_0x27c1a5){return new Promise(function(_0x561c61,_0x5a3cbf){var _0x527efe=![];var _0x1a56f0={'method':'GET','uri':_0x27c1a5+_0x46c8('0xb'),'json':!![]};_0x1a56f0[_0x46c8('0xc')]=_0x5c0684;logger[_0x46c8('0xd')](_0x46c8('0xe'));return rp(_0x1a56f0)[_0x46c8('0xf')](function(_0x2c336b){if(_0x2c336b){var _0x28cbca=_0x2c336b['users'];var _0x58c2c2=null;for(_0x58c2c2=0x0;_0x58c2c2<_0x28cbca['length'];_0x58c2c2++){if(_0x28cbca[_0x58c2c2][_0x46c8('0x10')]===_0xfe26c8['adminEmail']){_0xfe26c8[_0x46c8('0x11')]=_0x28cbca[_0x58c2c2]['id'];_0x527efe=!![];}}if(_0x527efe){logger[_0x46c8('0xd')](_0x46c8('0x12'),_0xfe26c8[_0x46c8('0x11')]);_0x561c61(_0xfe26c8);}else{_0x5a3cbf({'statusCode':0x194,'message':_0x46c8('0x13')});}}else{_0x5a3cbf({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x46c8('0x14')](function(_0x26ab24){logger['error']('['+[_0x1727f4[_0x46c8('0x15')]()]+']',_0x26ab24[_0x46c8('0x16')]);_0x5a3cbf(_0x26ab24);});});}function getUser(_0x5b7b2e,_0x488eb5,_0x2d24b2){return function(_0x255a0e){return new Promise(function(_0x29b28f,_0x2036be){var _0x21918f={'method':_0x46c8('0x17'),'uri':_0x2d24b2+_0x46c8('0xb'),'json':!![]};_0x21918f[_0x46c8('0xc')]=_0x488eb5;logger[_0x46c8('0xd')]('Getting\x20user\x20list');return rp(_0x21918f)[_0x46c8('0xf')](function(_0x7425f6){if(_0x7425f6){var _0x44b600=_0x7425f6[_0x46c8('0x18')];var _0x3d3c31=![];var _0x5af964=null;if(_0x255a0e[_0x46c8('0x19')]!==null){logger[_0x46c8('0xd')]('Getting\x20user\x20with\x20email',_0x255a0e['agentEmail']);_0x255a0e[_0x46c8('0x1a')]=_0x255a0e[_0x46c8('0x19')];for(_0x5af964=0x0;_0x5af964<_0x44b600['length'];_0x5af964++){if(_0x44b600[_0x5af964][_0x46c8('0x10')]===_0x255a0e['agentEmail']){_0x3d3c31=!![];_0x255a0e[_0x46c8('0x1b')]=_0x44b600[_0x5af964]['id'];logger[_0x46c8('0xd')](_0x46c8('0x1c'),_0x255a0e[_0x46c8('0x1b')]);}}}if(!_0x3d3c31){logger[_0x46c8('0xd')](_0x46c8('0x1d'));_0x255a0e[_0x46c8('0x1a')]=_0x255a0e[_0x46c8('0x1e')];_0x255a0e[_0x46c8('0x1b')]=_0x255a0e[_0x46c8('0x11')];_0x3d3c31=!![];}if(_0x3d3c31){_0x29b28f(_0x255a0e);}else{_0x2036be({'statusCode':0x194,'message':_0x46c8('0x13')});}}else{_0x2036be({'statusCode':0x194,'message':_0x46c8('0x13')});}})[_0x46c8('0x14')](function(_0x4da906){logger[_0x46c8('0x1f')]('['+[_0x5b7b2e[_0x46c8('0x15')]()]+']',_0x4da906[_0x46c8('0x16')]);_0x2036be(_0x4da906);});});};}function searchContact(_0x35effc,_0x21f6d9,_0x55a5f7,_0x2c78f9){return new Promise(function(_0x2603f9,_0x840dac){var _0x1744bd={'method':_0x46c8('0x17'),'headers':_0x21f6d9,'uri':_0x35effc+_0x46c8('0x20')+_0x2c78f9+'&f='+_0x55a5f7+_0x46c8('0x21'),'json':!![]};rp(_0x1744bd)[_0x46c8('0xf')](function(_0x1ef79a){var _0x5c0ce0=_['find'](_0x1ef79a[_0x46c8('0x22')][_0x46c8('0x22')],[_0x55a5f7,_0x2c78f9]);_0x2603f9(_0x5c0ce0);})[_0x46c8('0x14')](function(_0x404335){_0x840dac(_0x404335);});});}function getEndUser(_0x3d3988,_0x10484f,_0x762292){return function(_0x2ddfa5){return new Promise(function(_0x24e0ab,_0x226535){logger['info'](util['format'](_0x46c8('0x23'),_0x2ddfa5['contactNumber']));searchContact(_0x762292,_0x10484f,_0x46c8('0x24'),_0x2ddfa5[_0x46c8('0x25')])[_0x46c8('0xf')](function(_0x12d579){if(_0x12d579){_0x2ddfa5[_0x46c8('0x26')]=_0x12d579['id'];logger[_0x46c8('0xd')]('Contact\x20found\x20mobile_number:',_0x2ddfa5[_0x46c8('0x26')]);return _0x24e0ab(_0x2ddfa5);}searchContact(_0x762292,_0x10484f,_0x46c8('0x27'),_0x2ddfa5[_0x46c8('0x25')])[_0x46c8('0xf')](function(_0x2e1c2f){if(_0x2e1c2f){_0x2ddfa5[_0x46c8('0x26')]=_0x2e1c2f['id'];logger['info'](_0x46c8('0x28'),_0x2ddfa5['endUserId']);return _0x24e0ab(_0x2ddfa5);}createEndUser(_0x2ddfa5,_0x3d3988,_0x10484f,_0x762292)[_0x46c8('0xf')](function(_0x20cfdf){logger[_0x46c8('0xd')](_0x46c8('0x29'),_0x20cfdf[_0x46c8('0x26')]);return _0x24e0ab(_0x20cfdf);});});})[_0x46c8('0x14')](function(_0x60b630){_0x226535(_0x60b630);});});};}function createEndUser(_0x2019db,_0x5e86c4,_0x3a9fdc,_0x400437){return new Promise(function(_0x13b17c,_0x2b6ea9){var _0x5818aa=moment();var _0x3afd19={'method':_0x46c8('0x2a'),'uri':_0x400437+'/api/contacts','body':{'contact':{'last_name':_0x2019db[_0x46c8('0x25')],'work_number':_0x2019db[_0x46c8('0x25')],'mobile_number':_0x2019db[_0x46c8('0x25')],'owner_id':_0x2019db['userId'],'created_at':_0x5818aa[_0x46c8('0x2b')](_0x46c8('0x2c'))}},'json':!![]};_0x3afd19[_0x46c8('0xc')]=_0x3a9fdc;logger[_0x46c8('0xd')](_0x46c8('0x2d'));return rp(_0x3afd19)[_0x46c8('0xf')](function(_0x2f5fe0){_0x2019db[_0x46c8('0x26')]=_0x2f5fe0[_0x46c8('0x2e')]['id'];_0x13b17c(_0x2019db);})['catch'](function(_0x52cc7b){logger[_0x46c8('0x1f')]('['+[_0x5e86c4[_0x46c8('0x15')]()]+']',_0x52cc7b[_0x46c8('0x16')]);_0x2b6ea9(_0x52cc7b[_0x46c8('0x16')]);});});}function getTicket(_0xd3b2ba,_0x22f58a,_0x249784,_0xd206a3,_0x505ee8){return function(_0x104064){logger[_0x46c8('0xd')]('Creating\x20new\x20task');return new Promise(function(_0x3eb39d,_0x521f5b){var _0x15560d=moment();var _0x3adf95={'method':_0x46c8('0x2a'),'uri':_0x249784+_0x46c8('0x2f'),'body':{'title':intUtil[_0x46c8('0x30')](_0xd206a3['Subjects'],_0x505ee8,'\x20'),'description':intUtil[_0x46c8('0x30')](_0xd206a3['Descriptions'],_0x505ee8,'\x0a'),'owner_id':_0x104064[_0x46c8('0x1b')],'creater_id':_0x104064[_0x46c8('0x11')],'targetable_id':_0x104064[_0x46c8('0x26')],'targetable_type':_0x46c8('0x31'),'created_at':_0x15560d['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x15560d[_0x46c8('0x32')](0x1e,'m')['format'](_0x46c8('0x2c'))},'json':!![]};_0x3adf95[_0x46c8('0xc')]=_0x22f58a;return rp(_0x3adf95)['then'](function(_0x30f215){_0x104064[_0x46c8('0x33')]=_0x30f215[_0x46c8('0x34')]['id'];logger[_0x46c8('0xd')](_0x46c8('0x35'),_0x104064[_0x46c8('0x33')]);_0x3eb39d(_0x104064);})['catch'](function(_0x2d04cb){logger[_0x46c8('0x1f')]('['+[_0xd3b2ba[_0x46c8('0x15')]()]+']',_0x2d04cb[_0x46c8('0x16')]);_0x521f5b(_0x2d04cb[_0x46c8('0x16')]);});});};}function emit(_0x365858,_0x4a1b89,_0x56aa02){var _0x591be5={'uri':_0x365858+_0x46c8('0x36')+_0x56aa02};io['to'](util['format'](_0x46c8('0x37'),_0x4a1b89))[_0x46c8('0x38')](_0x46c8('0x39'),_0x591be5);}exports['cs']=function(_0x5d19ed,_0xd6d0cd,_0x271661,_0x4b00de,_0x41e382,_0x2f71e2,_0x3a15f4,_0x344231){var _0x1f66c8={};var _0x324ec5={'Authorization':_0x46c8('0x3a')+_0x2f71e2[_0x46c8('0x3b')]};_0x2f71e2[_0x46c8('0x3c')]=intUtil[_0x46c8('0x3d')](_0x2f71e2[_0x46c8('0x3c')]);_0x2f71e2[_0x46c8('0x3e')]=intUtil[_0x46c8('0x3d')](_0x2f71e2['serverUrl']);var _0x51b5be=_0x2f71e2[_0x46c8('0x3c')];_0x1f66c8['adminEmail']=_0x2f71e2[_0x46c8('0x3f')];_0x1f66c8[_0x46c8('0x25')]=_0x344231['toLowerCase']()===_0x46c8('0x40')?_0xd6d0cd[_0x46c8('0x41')]:_0xd6d0cd['calleridnum'];_0x1f66c8[_0x46c8('0x42')]=_0x344231===_0x46c8('0x43')||_0x344231==='unmanaged'?_0x46c8('0x43'):_0x46c8('0x40');if(_0x4b00de){_0x1f66c8['agentEmail']=_0x4b00de['email'];}var _0x457dce=util['format'](_0x46c8('0x44'),_0x2f71e2[_0x46c8('0x3e')],_0xd6d0cd['uniqueid'],md5(_0xd6d0cd['uniqueid']));if(_0x41e382&&_0x41e382['monitor_format']){logger[_0x46c8('0xd')](_0x46c8('0x45'),'Recording\x20is\x20enabled!');_0xd6d0cd['recordingURL']=_0x457dce;}else if(_0x3a15f4&&_0x3a15f4[_0x46c8('0x46')]&&_0x3a15f4[_0x46c8('0x46')]!==_0x46c8('0x47')){logger[_0x46c8('0xd')](_0x46c8('0x48'),_0x46c8('0x49'));_0xd6d0cd[_0x46c8('0x4a')]=_0x457dce;}else{_0xd6d0cd[_0x46c8('0x4a')]='';}return getAdminId(_0x1f66c8,_0x344231,_0x324ec5,_0x51b5be)[_0x46c8('0xf')](getUser(_0x344231,_0x324ec5,_0x51b5be))[_0x46c8('0xf')](getEndUser(_0x344231,_0x324ec5,_0x51b5be))['then'](getTicket(_0x344231,_0x324ec5,_0x51b5be,_0x271661,_0xd6d0cd))[_0x46c8('0xf')](function(_0x52405a){logger['info'](util['format'](_0x46c8('0x4b'),_0x52405a[_0x46c8('0x33')]));if(_0x344231!==_0x46c8('0x4c')){logger['info']('['+[_0x344231['toUpperCase']()]+']',_0x46c8('0x4d'));emit(_0x51b5be,_0x4b00de[_0x46c8('0x4e')],_0x52405a[_0x46c8('0x26')]);}})[_0x46c8('0x14')](function(_0x436da2){logger[_0x46c8('0x1f')]('['+[_0x344231[_0x46c8('0x15')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x46c8('0x4f')](_0x436da2,{'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 5bbdfb8..694fadf 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 _0x0b0e=['./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','desk','vtiger','dynamics365','freshsales','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','outbound','log','unmanaged','freshdesk','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./sugarcrm','./freshdesk','./zoho'];(function(_0x404aac,_0x5a1a38){var _0x35a7e4=function(_0x1781fa){while(--_0x1781fa){_0x404aac['push'](_0x404aac['shift']());}};_0x35a7e4(++_0x5a1a38);}(_0x0b0e,0x187));var _0xe0b0=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0x0b0e[_0x5ce3c8];return _0xa76867;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var zendesk=require(_0xe0b0('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0xe0b0('0x2'));var freshdesk=require(_0xe0b0('0x3'));var zoho=require(_0xe0b0('0x4'));var desk=require(_0xe0b0('0x5'));var vtiger=require(_0xe0b0('0x6'));var servicenow=require(_0xe0b0('0x7'));var dynamics365=require(_0xe0b0('0x8'));var freshsales=require(_0xe0b0('0x9'));var integrations=[_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'freshdesk','zoho',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'servicenow'];exports[_0xe0b0('0x11')]=function(_0x1dd3b8,_0x553d4f,_0x1fef28,_0x2f32b6,_0x574d96,_0x399320){if(_0x1fef28){if(_[_0xe0b0('0x12')](integrations,_0x1dd3b8[_0xe0b0('0x13')]['toLowerCase']())){try{var _0x3068c0=null;var _0x1c358a='';var _0x3cc19a=_0x1fef28[_0x1dd3b8[_0xe0b0('0x13')][_0xe0b0('0x14')]()];if(_0x3cc19a){var _0x4d2bf7=_0x3cc19a[_0x1dd3b8[_0xe0b0('0x15')]];if(_0x4d2bf7){var _0x154de6=_[_0xe0b0('0x16')](_0x4d2bf7[_0xe0b0('0x17')],{'id':parseInt(_0x1dd3b8[_0xe0b0('0x18')],0xa)});if(_0x154de6){if(_0x2f32b6){if(_0x574d96&&_0x553d4f['queue']){_0x1c358a=_0xe0b0('0x19');}else if(_0x553d4f['routeId']){_0x1c358a=_0xe0b0('0x1a');}else{console[_0xe0b0('0x1b')]('EVENT\x20UNKNOWN',_0x553d4f);}}else{_0x1c358a=_0xe0b0('0x1c');}switch(_0x1dd3b8['data1'][_0xe0b0('0x14')]()){case _0xe0b0('0xa'):zendesk[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case'salesforce':salesforce[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case'sugarcrm':sugarcrm[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case _0xe0b0('0x1d'):freshdesk[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case'zoho':zoho[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case'desk':desk[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case'vtiger':vtiger[_0x1c358a](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320);break;case _0xe0b0('0x10'):freshsales['cs'](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320,_0x1c358a);break;case'servicenow':servicenow['cs'](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320,_0x1c358a);break;case'dynamics365':dynamics365['cs'](_0x1dd3b8,_0x553d4f,_0x154de6,_0x2f32b6,_0x574d96,_0x4d2bf7,_0x399320,_0x1c358a);break;default:console[_0xe0b0('0x1b')]('unknown\x20integration');}}else{_0x3068c0=require(_0xe0b0('0x1e'))(_0x1dd3b8['data1'][_0xe0b0('0x14')]());_0x3068c0[_0xe0b0('0x1f')](_0xe0b0('0x20'),util[_0xe0b0('0x21')](_0xe0b0('0x22'),_0x1dd3b8['data1']['toLowerCase'](),_0x1dd3b8[_0xe0b0('0x18')]));}}else{_0x3068c0=require('../../../../config/logger')(_0x1dd3b8[_0xe0b0('0x13')][_0xe0b0('0x14')]());_0x3068c0['error'](_0xe0b0('0x20'),util['format'](_0xe0b0('0x23'),_0x1dd3b8['data1'][_0xe0b0('0x14')](),_0x1dd3b8['data2']));}}else{}}catch(_0x3e5c88){console['error'](_0x3e5c88);}}}}; \ No newline at end of file +var _0x8952=['log','EVENT\x20UNKNOWN','unmanaged','sugarcrm','freshdesk','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data2','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','zoho','desk','vtiger','dynamics365','freshsales','exec','includes','data1','toLowerCase','find','data3','queue','routeId','outbound'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x8952,0x17e));var _0x2895=function(_0x1a3c79,_0x1fe731){_0x1a3c79=_0x1a3c79-0x0;var _0x155caf=_0x8952[_0x1a3c79];return _0x155caf;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var zendesk=require(_0x2895('0x1'));var salesforce=require(_0x2895('0x2'));var sugarcrm=require(_0x2895('0x3'));var freshdesk=require(_0x2895('0x4'));var zoho=require('./zoho');var desk=require(_0x2895('0x5'));var vtiger=require(_0x2895('0x6'));var servicenow=require(_0x2895('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0x2895('0x8'));var integrations=[_0x2895('0x9'),_0x2895('0xa'),'sugarcrm','freshdesk',_0x2895('0xb'),_0x2895('0xc'),_0x2895('0xd'),_0x2895('0xe'),_0x2895('0xf'),'servicenow'];exports[_0x2895('0x10')]=function(_0x5f2632,_0x428772,_0x5af454,_0x5e66fc,_0x56c5b9,_0x9bb58c){if(_0x5af454){if(_[_0x2895('0x11')](integrations,_0x5f2632[_0x2895('0x12')]['toLowerCase']())){try{var _0x981298=null;var _0x3924be='';var _0x4b1342=_0x5af454[_0x5f2632[_0x2895('0x12')][_0x2895('0x13')]()];if(_0x4b1342){var _0x5abb23=_0x4b1342[_0x5f2632['data2']];if(_0x5abb23){var _0x1d1493=_[_0x2895('0x14')](_0x5abb23['Configurations'],{'id':parseInt(_0x5f2632[_0x2895('0x15')],0xa)});if(_0x1d1493){if(_0x5e66fc){if(_0x56c5b9&&_0x428772[_0x2895('0x16')]){_0x3924be=_0x2895('0x16');}else if(_0x428772[_0x2895('0x17')]){_0x3924be=_0x2895('0x18');}else{console[_0x2895('0x19')](_0x2895('0x1a'),_0x428772);}}else{_0x3924be=_0x2895('0x1b');}switch(_0x5f2632[_0x2895('0x12')][_0x2895('0x13')]()){case _0x2895('0x9'):zendesk[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0xa'):salesforce[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0x1c'):sugarcrm[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0x1d'):freshdesk[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0xb'):zoho[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0xc'):desk[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0xd'):vtiger[_0x3924be](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c);break;case _0x2895('0xf'):freshsales['cs'](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c,_0x3924be);break;case'servicenow':servicenow['cs'](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c,_0x3924be);break;case'dynamics365':dynamics365['cs'](_0x5f2632,_0x428772,_0x1d1493,_0x5e66fc,_0x56c5b9,_0x5abb23,_0x9bb58c,_0x3924be);break;default:console['log'](_0x2895('0x1e'));}}else{_0x981298=require(_0x2895('0x1f'))(_0x5f2632[_0x2895('0x12')]['toLowerCase']());_0x981298[_0x2895('0x20')](_0x2895('0x21'),util[_0x2895('0x22')](_0x2895('0x23'),_0x5f2632[_0x2895('0x12')]['toLowerCase'](),_0x5f2632[_0x2895('0x15')]));}}else{_0x981298=require(_0x2895('0x1f'))(_0x5f2632['data1'][_0x2895('0x13')]());_0x981298[_0x2895('0x20')](_0x2895('0x21'),util['format']('%s\x20account\x20#%s\x20not\x20found',_0x5f2632[_0x2895('0x12')][_0x2895('0x13')](),_0x5f2632[_0x2895('0x24')]));}}else{}}catch(_0x4a21cf){console[_0x2895('0x20')](_0x4a21cf);}}}}; \ 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 3389b1f..2dc7d01 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 _0xe542=['Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','Lead','contact','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','moduleCreate','lead','Company','No\x20Company','upperFirst','includes','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','concat','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','user:%s','trigger:browser:url','%s/%s/e','error','stringify','outbound','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','[OUTBOUND]','unmanaged','lastevent','isNil','Fields',']\x20Ticket\x20%s\x20created.','toUpperCase',']\x20Integration\x20account\x20type\x20%s.','catch','request-promise','moment','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','ticketType','Task','assign','getString','Subjects','Descriptions','WhoId','Case','sobject','create','validateEmail','User','execute','length','find','Email','info','Agent\x20%s\x20found.','resolve'];(function(_0x2dc880,_0x213c94){var _0x2bb284=function(_0x4f59a2){while(--_0x4f59a2){_0x2dc880['push'](_0x2dc880['shift']());}};_0x2bb284(++_0x213c94);}(_0xe542,0x131));var _0x2e54=function(_0x2d51cc,_0x2ca3e2){_0x2d51cc=_0x2d51cc-0x0;var _0x3dc46b=_0xe542[_0x2d51cc];return _0x3dc46b;};'use strict';var _=require('lodash');var rp=require(_0x2e54('0x0'));var moment=require(_0x2e54('0x1'));var BPromise=require(_0x2e54('0x2'));var md5=require(_0x2e54('0x3'));var jsforce=require('jsforce');var util=require(_0x2e54('0x4'));var Redis=require(_0x2e54('0x5'));var intUtil=require(_0x2e54('0x6'));var config=require(_0x2e54('0x7'));var logger=require(_0x2e54('0x8'))(_0x2e54('0x9'));config[_0x2e54('0xa')]=_[_0x2e54('0xb')](config[_0x2e54('0xa')],{'host':_0x2e54('0xc'),'port':0x18eb});var io=require(_0x2e54('0xd'))(new Redis(config['redis']));function emit(_0x3c8219,_0x49391d,_0xb6998f){io['to'](_0x3c8219)[_0x2e54('0xe')](_0x49391d,_0xb6998f);}function getTicket(_0x26b137,_0x4af3d7,_0x41c8f1,_0x2780bf,_0x49acc4,_0x2938f1,_0x50a05c,_0x53c0ff){var _0x1bff02={};if(_0x2780bf[_0x2e54('0xf')]===_0x2e54('0x10')){_0x1bff02=Object[_0x2e54('0x11')]({},{'OwnerId':_0x4af3d7['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x2e54('0x12')](_0x2780bf[_0x2e54('0x13')],_0x49acc4,'\x20'),'Description':intUtil['getString'](_0x2780bf[_0x2e54('0x14')],_0x49acc4,'\x0a')},getCustomFields(_0x2938f1,_0x49acc4));if(_0x41c8f1){_0x1bff02[_0x2e54('0x15')]=_0x41c8f1['id'];}}else if(_0x2780bf[_0x2e54('0xf')]===_0x2e54('0x16')){_0x1bff02=Object[_0x2e54('0x11')]({},{'OwnerId':_0x4af3d7['id'],'Subject':intUtil[_0x2e54('0x12')](_0x2780bf[_0x2e54('0x13')],_0x49acc4,'\x20'),'Description':intUtil[_0x2e54('0x12')](_0x2780bf[_0x2e54('0x14')],_0x49acc4,'\x0a')},getCustomFields(_0x2938f1,_0x49acc4));if(_0x41c8f1){_0x1bff02['ContactId']=_0x41c8f1['id'];}}return _0x50a05c[_0x2e54('0x17')](_0x2780bf['ticketType'])[_0x2e54('0x18')](_0x1bff02);}function getUser(_0x722e9e,_0x25bc4f,_0x418260){if(!_['isNil'](_0x25bc4f)&&intUtil[_0x2e54('0x19')](_0x25bc4f)){var _0xe76170={'Email':_0x25bc4f};var _0x19d88b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x418260[_0x2e54('0x17')](_0x2e54('0x1a'))['find'](_0xe76170,_0x19d88b)[_0x2e54('0x1b')]()['then'](function(_0x47fd69){if(_0x47fd69[_0x2e54('0x1c')]){var _0x1843c0=_[_0x2e54('0x1d')](_0x47fd69,function(_0x40e48b){return _0x40e48b[_0x2e54('0x1e')]===_0x25bc4f;});if(_0x1843c0){logger[_0x2e54('0x1f')](_0x2e54('0x20'),_0x25bc4f);return BPromise[_0x2e54('0x21')]({'id':_0x1843c0['Id'],'name':_0x1843c0[_0x2e54('0x22')]});}}else{logger[_0x2e54('0x1f')](_0x2e54('0x23'),_0x25bc4f);return _0x418260[_0x2e54('0x24')]()[_0x2e54('0x25')](function(_0xa7a1c){return BPromise[_0x2e54('0x21')]({'id':_0xa7a1c['user_id'],'name':_0xa7a1c[_0x2e54('0x26')]});});}});}else{logger[_0x2e54('0x1f')](_0x2e54('0x23'),_0x25bc4f);return _0x418260[_0x2e54('0x24')]()[_0x2e54('0x25')](function(_0x289ab3){return BPromise[_0x2e54('0x21')]({'id':_0x289ab3['user_id'],'name':_0x289ab3[_0x2e54('0x26')]});});}}function getEndUser(_0x432c6e,_0x5e63ef,_0x51d94a,_0x36ff37,_0x53d858){var _0x30e685={'Phone':_0x36ff37};var _0x75e884={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x2e54('0x21')]()[_0x2e54('0x25')](function(){if(_0x5e63ef[_0x2e54('0xf')]===_0x2e54('0x10')){logger['info'](_0x2e54('0x27'),_0x36ff37,_0x5e63ef[_0x2e54('0x28')]);switch(_0x5e63ef[_0x2e54('0x28')]){case _0x2e54('0x29'):return _0x53d858[_0x2e54('0x17')](_0x2e54('0x2a'))[_0x2e54('0x1d')](_0x30e685,_0x75e884)['execute']()['then'](function(_0x3911f8){if(_0x3911f8&&_0x3911f8[_0x2e54('0x1c')]){return _0x3911f8;}else{return _0x53d858['sobject'](_0x2e54('0x2b'))[_0x2e54('0x1d')](_0x30e685,_0x75e884);}});case _0x2e54('0x2c'):return _0x53d858[_0x2e54('0x17')](_0x2e54('0x2a'))[_0x2e54('0x1d')](_0x30e685,_0x75e884)['execute']();case'lead':return _0x53d858['sobject'](_0x2e54('0x2b'))[_0x2e54('0x1d')](_0x30e685,_0x75e884);default:return null;}}else if(_0x5e63ef[_0x2e54('0xf')]===_0x2e54('0x16')){logger[_0x2e54('0x1f')](_0x2e54('0x27'),_0x36ff37,_0x2e54('0x2c'));return _0x53d858['sobject'](_0x2e54('0x2a'))[_0x2e54('0x1d')](_0x30e685,_0x75e884)['execute']();}})['then'](function(_0x22fa9b){if(_0x22fa9b&&_0x22fa9b[_0x2e54('0x1c')]){var _0x53ee23=_[_0x2e54('0x1d')](_0x22fa9b,function(_0x14a429){return _0x14a429['Phone']===_0x36ff37;});if(_0x53ee23){return BPromise['resolve']({'id':_0x53ee23['Id'],'name':_0x53ee23[_0x2e54('0x22')],'phone':_0x53ee23[_0x2e54('0x2d')]});}}})[_0x2e54('0x25')](function(_0x5d45e6){if(_0x5d45e6){logger[_0x2e54('0x1f')](_0x2e54('0x2e'),_0x36ff37);return BPromise[_0x2e54('0x21')](_0x5d45e6);}else{logger[_0x2e54('0x1f')](_0x2e54('0x2f'),_0x36ff37);var _0x4b686a={'LastName':_0x51d94a!==''?_0x51d94a:util[_0x2e54('0x30')](_0x2e54('0x31'),_0x36ff37),'Phone':_0x36ff37};if(_0x5e63ef['moduleCreate']){if(_0x5e63ef['moduleCreate']===_0x2e54('0x2c')){logger[_0x2e54('0x1f')](_0x2e54('0x32'),_0x36ff37,_0x5e63ef['moduleCreate']);}else if(_0x5e63ef[_0x2e54('0x33')]===_0x2e54('0x34')&&_0x5e63ef[_0x2e54('0xf')]===_0x2e54('0x10')){logger[_0x2e54('0x1f')](_0x2e54('0x32'),_0x36ff37,_0x5e63ef[_0x2e54('0x33')]);_0x4b686a[_0x2e54('0x35')]=_0x2e54('0x36');}else{return null;}}return _0x53d858[_0x2e54('0x17')](_[_0x2e54('0x37')](_0x5e63ef[_0x2e54('0x33')]))[_0x2e54('0x18')](_0x4b686a);}});}function getCustomFields(_0x2dc8e8,_0x616499){var _0x3b16f2={};if(_0x2dc8e8[_0x2e54('0x1c')]>0x0){_['forEach'](_0x2dc8e8,function(_0x4ce88f){if(_[_0x2e54('0x38')](['string',_0x2e54('0x39')],_0x4ce88f['type'])&&_0x4ce88f[_0x2e54('0x3a')]){_0x3b16f2[_0x4ce88f[_0x2e54('0x3a')]]=_0x4ce88f[_0x2e54('0x3b')]['toString']();}else if(_0x4ce88f[_0x2e54('0x3c')]===_0x2e54('0x3d')&&_0x4ce88f['variableName']&&_0x4ce88f['idField']){_0x616499[_0x4ce88f[_0x2e54('0x3e')]]&&(_0x3b16f2[_0x4ce88f['idField']]=_0x616499[_0x4ce88f[_0x2e54('0x3e')]][_0x2e54('0x3f')]());}else if(_0x4ce88f[_0x2e54('0x3c')]===_0x2e54('0x40')&&_0x4ce88f['Variable']&&_0x4ce88f[_0x2e54('0x41')][_0x2e54('0x42')]&&_0x4ce88f[_0x2e54('0x3a')]){_0x616499[_0x4ce88f['Variable'][_0x2e54('0x42')][_0x2e54('0x43')]()]&&(_0x3b16f2[_0x4ce88f[_0x2e54('0x3a')]]=_0x616499[_0x4ce88f[_0x2e54('0x41')]['name']['toLowerCase']()][_0x2e54('0x3f')]());}});}return _0x3b16f2;}function getConnection(_0xf5a2ba){var _0x395c67=_0xf5a2ba[_0x2e54('0x44')][_0x2e54('0x45')](_0xf5a2ba['securityToken']);var _0x11be13=new jsforce[(_0x2e54('0x46'))]({'oauth2':{'loginUrl':_0xf5a2ba[_0x2e54('0x47')]||_0x2e54('0x48'),'clientId':_0xf5a2ba['clientId'],'clientSecret':_0xf5a2ba[_0x2e54('0x49')]}});return _0x11be13[_0x2e54('0x4a')](_0xf5a2ba[_0x2e54('0x4b')],_0x395c67)['then'](function(){logger['info'](_0x2e54('0x4c'));return _0x11be13;});}exports[_0x2e54('0x4d')]=function(_0xbbdf6,_0xa6535e,_0x1996bc,_0x20e092,_0x2b5a9d,_0x48eabe){var _0x21e2d2,_0x4eaf40,_0x537bf1,_0x5b8ce4;_0x48eabe['serverUrl']=intUtil[_0x2e54('0x4e')](_0x48eabe[_0x2e54('0x4f')]);_0x48eabe[_0x2e54('0x47')]=intUtil[_0x2e54('0x4e')](_0x48eabe[_0x2e54('0x47')]);if(_0x2b5a9d&&_0x2b5a9d[_0x2e54('0x50')]){logger[_0x2e54('0x1f')](_0x2e54('0x51'),_0x2e54('0x52'));_0xa6535e[_0x2e54('0x53')]=util[_0x2e54('0x30')](_0x2e54('0x54'),_0x48eabe[_0x2e54('0x4f')],_0xa6535e[_0x2e54('0x55')],md5(_0xa6535e[_0x2e54('0x55')]));}else{_0xa6535e['recordingURL']='';}return getConnection(_0x48eabe)['then'](function(_0x3c1f06){_0x5b8ce4=_0x3c1f06;return getUser(_0x48eabe,_0x20e092[_0x2e54('0x56')],_0x5b8ce4);})[_0x2e54('0x25')](function(_0x4bba65){_0x21e2d2=_0x4bba65;return getEndUser(_0x48eabe,_0x1996bc,_0xa6535e[_0x2e54('0x57')],_0xa6535e[_0x2e54('0x58')],_0x5b8ce4);})[_0x2e54('0x25')](function(_0xabaa69){_0x4eaf40=_0xabaa69;return getTicket(_0x48eabe,_0x21e2d2,_0x4eaf40,_0x1996bc,_0xa6535e,_0x1996bc['Fields'],_0x5b8ce4,_0x2e54('0x4d'));})[_0x2e54('0x25')](function(_0xf82753){_0x537bf1=_0xf82753;logger['info'](_0x2e54('0x59'),_0x537bf1['id']);logger[_0x2e54('0x1f')](_0x2e54('0x5a'),_0x537bf1['id'],_0x20e092[_0x2e54('0x42')],_0x48eabe[_0x2e54('0x3c')]);switch(_0x48eabe[_0x2e54('0x3c')]){case'integrationTab':emit(util[_0x2e54('0x30')]('user:%s',_0x20e092[_0x2e54('0x42')]),_0x2e54('0x5b'),{'recordId':_0x537bf1['id']});break;case'newTab':emit(util[_0x2e54('0x30')](_0x2e54('0x5c'),_0x20e092['name']),_0x2e54('0x5d'),{'uri':util[_0x2e54('0x30')](_0x2e54('0x5e'),_0x5b8ce4['instanceUrl'],_0x537bf1['id'])});break;default:logger[_0x2e54('0x5f')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})['catch'](function(_0x5ce74e){logger[_0x2e54('0x5f')](_0x2e54('0x51'),JSON[_0x2e54('0x60')](_0x5ce74e));});};exports[_0x2e54('0x61')]=function(_0x3e31cc,_0xb1be16,_0xef587b,_0x2d76c0,_0xc902c,_0x5dd1da,_0x4cc4a7){var _0x37aa3a,_0x2a96d8,_0x4bd924,_0x583360;_0x5dd1da['serverUrl']=intUtil[_0x2e54('0x4e')](_0x5dd1da[_0x2e54('0x4f')]);_0x5dd1da['remoteUri']=intUtil['stripTrailingSlash'](_0x5dd1da[_0x2e54('0x47')]);if(_0x4cc4a7&&_0x4cc4a7[_0x2e54('0x62')]&&_0x4cc4a7[_0x2e54('0x62')]!==_0x2e54('0x63')){logger[_0x2e54('0x1f')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0xb1be16[_0x2e54('0x53')]=util['format'](_0x2e54('0x54'),_0x5dd1da['serverUrl'],_0xb1be16[_0x2e54('0x55')],md5(_0xb1be16[_0x2e54('0x55')]));}return getConnection(_0x5dd1da)[_0x2e54('0x25')](function(_0x501515){_0x583360=_0x501515;return getUser(_0x5dd1da,_0x2d76c0['email'],_0x583360);})[_0x2e54('0x25')](function(_0x1d1bd0){_0x37aa3a=_0x1d1bd0;return getEndUser(_0x5dd1da,_0xef587b,_0xb1be16[_0x2e54('0x64')],_0xb1be16[_0x2e54('0x65')],_0x583360);})[_0x2e54('0x25')](function(_0xfa99d9){_0x2a96d8=_0xfa99d9;return getTicket(_0x5dd1da,_0x37aa3a,_0x2a96d8,_0xef587b,_0xb1be16,_0xef587b['Fields'],_0x583360,_0x2e54('0x61'));})['then'](function(_0x2ffd1d){_0x4bd924=_0x2ffd1d;logger[_0x2e54('0x1f')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x4bd924['id']);logger[_0x2e54('0x1f')](_0x2e54('0x66'),_0x4bd924['id'],_0x2d76c0[_0x2e54('0x42')],_0x5dd1da['type']);switch(_0x5dd1da['type']){case'integrationTab':emit(util[_0x2e54('0x30')](_0x2e54('0x5c'),_0x2d76c0[_0x2e54('0x42')]),_0x2e54('0x5b'),{'recordId':_0x4bd924['id']});break;case _0x2e54('0x67'):emit(util['format'](_0x2e54('0x5c'),_0x2d76c0[_0x2e54('0x42')]),_0x2e54('0x5d'),{'uri':util[_0x2e54('0x30')](_0x2e54('0x5e'),_0x583360['instanceUrl'],_0x4bd924['id'])});break;default:logger[_0x2e54('0x5f')](_0x2e54('0x68'),'Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x2a2e51){logger[_0x2e54('0x5f')]('[OUTBOUND]',JSON[_0x2e54('0x60')](_0x2a2e51));});};exports[_0x2e54('0x69')]=function(_0x1788d3,_0x39fa20,_0x57ad0f,_0x1126ef,_0x43f6fe,_0x3c44b6){var _0x4793b8,_0x4c9ad9,_0x58e44f,_0x32de8a;_0x3c44b6[_0x2e54('0x4f')]=intUtil[_0x2e54('0x4e')](_0x3c44b6[_0x2e54('0x4f')]);_0x3c44b6[_0x2e54('0x47')]=intUtil[_0x2e54('0x4e')](_0x3c44b6[_0x2e54('0x47')]);if(_0x43f6fe&&_0x43f6fe[_0x2e54('0x50')]){logger[_0x2e54('0x1f')]('['+_0x39fa20[_0x2e54('0x6a')]['toUpperCase']()+']',_0x2e54('0x52'));_0x39fa20[_0x2e54('0x53')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c44b6[_0x2e54('0x4f')],_0x39fa20[_0x2e54('0x55')],md5(_0x39fa20[_0x2e54('0x55')]));}else{_0x39fa20[_0x2e54('0x53')]='';}return getConnection(_0x3c44b6)['then'](function(_0x1ed586){_0x32de8a=_0x1ed586;if(!_[_0x2e54('0x6b')](_0x1126ef)){return getUser(_0x3c44b6,_0x1126ef[_0x2e54('0x42')],_0x32de8a);}else{return getUser(_0x3c44b6,null,_0x32de8a);}})[_0x2e54('0x25')](function(_0x56e19e){_0x4793b8=_0x56e19e;return getEndUser(_0x3c44b6,_0x57ad0f,_0x39fa20[_0x2e54('0x57')],_0x39fa20[_0x2e54('0x58')],_0x32de8a);})[_0x2e54('0x25')](function(_0x18e541){_0x4c9ad9=_0x18e541;return getTicket(_0x3c44b6,_0x4793b8,_0x4c9ad9,_0x57ad0f,_0x39fa20,_0x57ad0f[_0x2e54('0x6c')],_0x32de8a);})['then'](function(_0x24d6e9){_0x58e44f=_0x24d6e9;logger[_0x2e54('0x1f')]('['+_0x39fa20[_0x2e54('0x6a')]['toUpperCase']()+_0x2e54('0x6d'),_0x58e44f['id']);logger[_0x2e54('0x1f')]('['+_0x39fa20[_0x2e54('0x6a')][_0x2e54('0x6e')]()+_0x2e54('0x6f'),_0x3c44b6[_0x2e54('0x3c')]);})[_0x2e54('0x70')](function(_0xe78992){logger['error']('['+_0x39fa20[_0x2e54('0x6a')][_0x2e54('0x6e')]()+']',JSON['stringify'](_0xe78992));});}; \ No newline at end of file +var _0x128e=['[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl','error','[OUTBOUND]','unmanaged','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','md5','jsforce','ioredis','../../../../config/environment','../../../../config/logger','salesforce','defaults','redis','localhost','socket.io-emitter','ticketType','Task','utc','getString','Subjects','Descriptions','WhoId','Case','ContactId','sobject','create','isNil','User','find','then','length','resolve','Name','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','Contact','execute','Lead','lead','contact','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','format','Caller\x20-\x20%s','moduleCreate','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','concat','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','email','destcalleridname','Fields','outbound'];(function(_0x53e3fa,_0x50c5f2){var _0xe8584a=function(_0x1771a5){while(--_0x1771a5){_0x53e3fa['push'](_0x53e3fa['shift']());}};_0xe8584a(++_0x50c5f2);}(_0x128e,0x78));var _0xe128=function(_0x53c824,_0x176710){_0x53c824=_0x53c824-0x0;var _0x4ab032=_0x128e[_0x53c824];return _0x4ab032;};'use strict';var _=require('lodash');var rp=require(_0xe128('0x0'));var moment=require(_0xe128('0x1'));var BPromise=require('bluebird');var md5=require(_0xe128('0x2'));var jsforce=require(_0xe128('0x3'));var util=require('util');var Redis=require(_0xe128('0x4'));var intUtil=require('./util');var config=require(_0xe128('0x5'));var logger=require(_0xe128('0x6'))(_0xe128('0x7'));config['redis']=_[_0xe128('0x8')](config[_0xe128('0x9')],{'host':_0xe128('0xa'),'port':0x18eb});var io=require(_0xe128('0xb'))(new Redis(config['redis']));function emit(_0x54625a,_0xecd498,_0x494a64){io['to'](_0x54625a)['emit'](_0xecd498,_0x494a64);}function getTicket(_0x2ad122,_0x254bba,_0x5774a6,_0x2ed792,_0x1de387,_0x4d98a8,_0x51b511,_0x4a11ee){var _0x113f7c={};if(_0x2ed792[_0xe128('0xc')]===_0xe128('0xd')){_0x113f7c=Object['assign']({},{'OwnerId':_0x254bba['id'],'ActivityDate':moment[_0xe128('0xe')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xe128('0xf')](_0x2ed792[_0xe128('0x10')],_0x1de387,'\x20'),'Description':intUtil[_0xe128('0xf')](_0x2ed792[_0xe128('0x11')],_0x1de387,'\x0a')},getCustomFields(_0x4d98a8,_0x1de387));if(_0x5774a6){_0x113f7c[_0xe128('0x12')]=_0x5774a6['id'];}}else if(_0x2ed792['ticketType']===_0xe128('0x13')){_0x113f7c=Object['assign']({},{'OwnerId':_0x254bba['id'],'Subject':intUtil[_0xe128('0xf')](_0x2ed792[_0xe128('0x10')],_0x1de387,'\x20'),'Description':intUtil[_0xe128('0xf')](_0x2ed792[_0xe128('0x11')],_0x1de387,'\x0a')},getCustomFields(_0x4d98a8,_0x1de387));if(_0x5774a6){_0x113f7c[_0xe128('0x14')]=_0x5774a6['id'];}}return _0x51b511[_0xe128('0x15')](_0x2ed792[_0xe128('0xc')])[_0xe128('0x16')](_0x113f7c);}function getUser(_0x2433da,_0x5f1764,_0x57f590){if(!_[_0xe128('0x17')](_0x5f1764)&&intUtil['validateEmail'](_0x5f1764)){var _0x2752d7={'Email':_0x5f1764};var _0x339962={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x57f590[_0xe128('0x15')](_0xe128('0x18'))[_0xe128('0x19')](_0x2752d7,_0x339962)['execute']()[_0xe128('0x1a')](function(_0xc41b7e){if(_0xc41b7e[_0xe128('0x1b')]){var _0xca4569=_[_0xe128('0x19')](_0xc41b7e,function(_0x104b38){return _0x104b38['Email']===_0x5f1764;});if(_0xca4569){logger['info']('Agent\x20%s\x20found.',_0x5f1764);return BPromise[_0xe128('0x1c')]({'id':_0xca4569['Id'],'name':_0xca4569[_0xe128('0x1d')]});}}else{logger[_0xe128('0x1e')](_0xe128('0x1f'),_0x5f1764);return _0x57f590[_0xe128('0x20')]()[_0xe128('0x1a')](function(_0x19193d){return BPromise['resolve']({'id':_0x19193d[_0xe128('0x21')],'name':_0x19193d[_0xe128('0x22')]});});}});}else{logger['info'](_0xe128('0x1f'),_0x5f1764);return _0x57f590[_0xe128('0x20')]()[_0xe128('0x1a')](function(_0xa6e5ac){return BPromise[_0xe128('0x1c')]({'id':_0xa6e5ac[_0xe128('0x21')],'name':_0xa6e5ac[_0xe128('0x22')]});});}}function getEndUser(_0x579382,_0x6dc377,_0x39ce46,_0x327e3a,_0x1f7267){var _0x2e8780={'Phone':_0x327e3a};var _0x380a34={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xe128('0x1a')](function(){if(_0x6dc377[_0xe128('0xc')]===_0xe128('0xd')){logger[_0xe128('0x1e')](_0xe128('0x23'),_0x327e3a,_0x6dc377['moduleSearch']);switch(_0x6dc377['moduleSearch']){case'contact_lead':return _0x1f7267[_0xe128('0x15')](_0xe128('0x24'))[_0xe128('0x19')](_0x2e8780,_0x380a34)[_0xe128('0x25')]()[_0xe128('0x1a')](function(_0x560da9){if(_0x560da9&&_0x560da9['length']){return _0x560da9;}else{return _0x1f7267[_0xe128('0x15')](_0xe128('0x26'))[_0xe128('0x19')](_0x2e8780,_0x380a34);}});case'contact':return _0x1f7267[_0xe128('0x15')](_0xe128('0x24'))[_0xe128('0x19')](_0x2e8780,_0x380a34)['execute']();case _0xe128('0x27'):return _0x1f7267[_0xe128('0x15')](_0xe128('0x26'))['find'](_0x2e8780,_0x380a34);default:return null;}}else if(_0x6dc377[_0xe128('0xc')]==='Case'){logger['info'](_0xe128('0x23'),_0x327e3a,_0xe128('0x28'));return _0x1f7267[_0xe128('0x15')]('Contact')[_0xe128('0x19')](_0x2e8780,_0x380a34)[_0xe128('0x25')]();}})[_0xe128('0x1a')](function(_0x1321df){if(_0x1321df&&_0x1321df['length']){var _0x4aeffc=_['find'](_0x1321df,function(_0x1d8cd6){return _0x1d8cd6[_0xe128('0x29')]===_0x327e3a;});if(_0x4aeffc){return BPromise[_0xe128('0x1c')]({'id':_0x4aeffc['Id'],'name':_0x4aeffc['Name'],'phone':_0x4aeffc[_0xe128('0x29')]});}}})[_0xe128('0x1a')](function(_0x32bc89){if(_0x32bc89){logger[_0xe128('0x1e')](_0xe128('0x2a'),_0x327e3a);return BPromise[_0xe128('0x1c')](_0x32bc89);}else{logger[_0xe128('0x1e')](_0xe128('0x2b'),_0x327e3a);var _0x26050c={'LastName':_0x39ce46!==''?_0x39ce46:util[_0xe128('0x2c')](_0xe128('0x2d'),_0x327e3a),'Phone':_0x327e3a};if(_0x6dc377[_0xe128('0x2e')]){if(_0x6dc377[_0xe128('0x2e')]===_0xe128('0x28')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x327e3a,_0x6dc377[_0xe128('0x2e')]);}else if(_0x6dc377[_0xe128('0x2e')]===_0xe128('0x27')&&_0x6dc377[_0xe128('0xc')]===_0xe128('0xd')){logger[_0xe128('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x327e3a,_0x6dc377[_0xe128('0x2e')]);_0x26050c[_0xe128('0x2f')]=_0xe128('0x30');}else{return null;}}return _0x1f7267[_0xe128('0x15')](_[_0xe128('0x31')](_0x6dc377[_0xe128('0x2e')]))['create'](_0x26050c);}});}function getCustomFields(_0x336296,_0x48e25a){var _0x38050a={};if(_0x336296[_0xe128('0x1b')]>0x0){_[_0xe128('0x32')](_0x336296,function(_0x573522){if(_[_0xe128('0x33')]([_0xe128('0x34'),_0xe128('0x35')],_0x573522[_0xe128('0x36')])&&_0x573522[_0xe128('0x37')]){_0x38050a[_0x573522[_0xe128('0x37')]]=_0x573522[_0xe128('0x38')][_0xe128('0x39')]();}else if(_0x573522['type']===_0xe128('0x3a')&&_0x573522[_0xe128('0x3b')]&&_0x573522['idField']){_0x48e25a[_0x573522['variableName']]&&(_0x38050a[_0x573522[_0xe128('0x37')]]=_0x48e25a[_0x573522['variableName']][_0xe128('0x39')]());}else if(_0x573522['type']==='customVariable'&&_0x573522['Variable']&&_0x573522[_0xe128('0x3c')][_0xe128('0x3d')]&&_0x573522[_0xe128('0x37')]){_0x48e25a[_0x573522[_0xe128('0x3c')][_0xe128('0x3d')][_0xe128('0x3e')]()]&&(_0x38050a[_0x573522['idField']]=_0x48e25a[_0x573522[_0xe128('0x3c')]['name'][_0xe128('0x3e')]()][_0xe128('0x39')]());}});}return _0x38050a;}function getConnection(_0x1115ce){var _0x12e2af=_0x1115ce['password'][_0xe128('0x3f')](_0x1115ce[_0xe128('0x40')]);var _0x4e1c53=new jsforce[(_0xe128('0x41'))]({'oauth2':{'loginUrl':_0x1115ce['remoteUri']||_0xe128('0x42'),'clientId':_0x1115ce[_0xe128('0x43')],'clientSecret':_0x1115ce[_0xe128('0x44')]}});return _0x4e1c53[_0xe128('0x45')](_0x1115ce[_0xe128('0x46')],_0x12e2af)[_0xe128('0x1a')](function(){logger[_0xe128('0x1e')]('Connection\x20established.');return _0x4e1c53;});}exports[_0xe128('0x47')]=function(_0x13364a,_0x29ba3c,_0x516cca,_0x3c6d63,_0x1b52fd,_0x56b21f){var _0x30dcd9,_0x202cf6,_0x4d3e10,_0x2e88a3;_0x56b21f[_0xe128('0x48')]=intUtil[_0xe128('0x49')](_0x56b21f[_0xe128('0x48')]);_0x56b21f['remoteUri']=intUtil[_0xe128('0x49')](_0x56b21f[_0xe128('0x4a')]);if(_0x1b52fd&&_0x1b52fd[_0xe128('0x4b')]){logger[_0xe128('0x1e')](_0xe128('0x4c'),_0xe128('0x4d'));_0x29ba3c[_0xe128('0x4e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x56b21f[_0xe128('0x48')],_0x29ba3c[_0xe128('0x4f')],md5(_0x29ba3c[_0xe128('0x4f')]));}else{_0x29ba3c[_0xe128('0x4e')]='';}return getConnection(_0x56b21f)[_0xe128('0x1a')](function(_0x3febdc){_0x2e88a3=_0x3febdc;return getUser(_0x56b21f,_0x3c6d63['email'],_0x2e88a3);})['then'](function(_0x3a3fdd){_0x30dcd9=_0x3a3fdd;return getEndUser(_0x56b21f,_0x516cca,_0x29ba3c[_0xe128('0x50')],_0x29ba3c['calleridnum'],_0x2e88a3);})[_0xe128('0x1a')](function(_0x36e4aa){_0x202cf6=_0x36e4aa;return getTicket(_0x56b21f,_0x30dcd9,_0x202cf6,_0x516cca,_0x29ba3c,_0x516cca['Fields'],_0x2e88a3,_0xe128('0x47'));})[_0xe128('0x1a')](function(_0x407b4a){_0x4d3e10=_0x407b4a;logger[_0xe128('0x1e')](_0xe128('0x51'),_0x4d3e10['id']);logger[_0xe128('0x1e')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x4d3e10['id'],_0x3c6d63[_0xe128('0x3d')],_0x56b21f['type']);switch(_0x56b21f['type']){case _0xe128('0x52'):emit(util[_0xe128('0x2c')]('user:%s',_0x3c6d63['name']),_0xe128('0x53'),{'recordId':_0x4d3e10['id']});break;case _0xe128('0x54'):emit(util[_0xe128('0x2c')](_0xe128('0x55'),_0x3c6d63[_0xe128('0x3d')]),_0xe128('0x56'),{'uri':util['format'](_0xe128('0x57'),_0x2e88a3['instanceUrl'],_0x4d3e10['id'])});break;default:logger['error'](_0xe128('0x58'));}})[_0xe128('0x59')](function(_0x1e4a39){logger['error'](_0xe128('0x4c'),JSON[_0xe128('0x5a')](_0x1e4a39));});};exports['outbound']=function(_0x3057e3,_0xb07fd2,_0x5296e6,_0x27aeef,_0x4a0c4b,_0x1fa1ac,_0x23c0f9){var _0x42d2bb,_0xa81a7c,_0x36d492,_0xdaf243;_0x1fa1ac['serverUrl']=intUtil['stripTrailingSlash'](_0x1fa1ac[_0xe128('0x48')]);_0x1fa1ac[_0xe128('0x4a')]=intUtil[_0xe128('0x49')](_0x1fa1ac[_0xe128('0x4a')]);if(_0x23c0f9&&_0x23c0f9['recordingFormat']&&_0x23c0f9[_0xe128('0x5b')]!==_0xe128('0x5c')){logger[_0xe128('0x1e')]('[OUTBOUND]',_0xe128('0x4d'));_0xb07fd2[_0xe128('0x4e')]=util[_0xe128('0x2c')](_0xe128('0x5d'),_0x1fa1ac[_0xe128('0x48')],_0xb07fd2[_0xe128('0x4f')],md5(_0xb07fd2[_0xe128('0x4f')]));}return getConnection(_0x1fa1ac)[_0xe128('0x1a')](function(_0x5ae8cf){_0xdaf243=_0x5ae8cf;return getUser(_0x1fa1ac,_0x27aeef[_0xe128('0x5e')],_0xdaf243);})[_0xe128('0x1a')](function(_0x2d97d1){_0x42d2bb=_0x2d97d1;return getEndUser(_0x1fa1ac,_0x5296e6,_0xb07fd2[_0xe128('0x5f')],_0xb07fd2['destcalleridnum'],_0xdaf243);})[_0xe128('0x1a')](function(_0x482b8a){_0xa81a7c=_0x482b8a;return getTicket(_0x1fa1ac,_0x42d2bb,_0xa81a7c,_0x5296e6,_0xb07fd2,_0x5296e6[_0xe128('0x60')],_0xdaf243,_0xe128('0x61'));})[_0xe128('0x1a')](function(_0x57dc72){_0x36d492=_0x57dc72;logger[_0xe128('0x1e')](_0xe128('0x62'),_0x36d492['id']);logger[_0xe128('0x1e')](_0xe128('0x63'),_0x36d492['id'],_0x27aeef[_0xe128('0x3d')],_0x1fa1ac[_0xe128('0x36')]);switch(_0x1fa1ac[_0xe128('0x36')]){case _0xe128('0x52'):emit(util['format'](_0xe128('0x55'),_0x27aeef[_0xe128('0x3d')]),_0xe128('0x53'),{'recordId':_0x36d492['id']});break;case _0xe128('0x54'):emit(util['format']('user:%s',_0x27aeef[_0xe128('0x3d')]),'trigger:browser:url',{'uri':util[_0xe128('0x2c')](_0xe128('0x57'),_0xdaf243[_0xe128('0x64')],_0x36d492['id'])});break;default:logger[_0xe128('0x65')](_0xe128('0x66'),'Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x39119b){logger[_0xe128('0x65')]('[OUTBOUND]',JSON[_0xe128('0x5a')](_0x39119b));});};exports[_0xe128('0x67')]=function(_0xc07fe6,_0x500167,_0xc63bf5,_0x410b22,_0x420bf9,_0x2bdb8e){var _0x31725b,_0x2ad6ae,_0xfe8693,_0x5d3e61;_0x2bdb8e[_0xe128('0x48')]=intUtil[_0xe128('0x49')](_0x2bdb8e[_0xe128('0x48')]);_0x2bdb8e[_0xe128('0x4a')]=intUtil[_0xe128('0x49')](_0x2bdb8e[_0xe128('0x4a')]);if(_0x420bf9&&_0x420bf9[_0xe128('0x4b')]){logger[_0xe128('0x1e')]('['+_0x500167[_0xe128('0x68')][_0xe128('0x69')]()+']','Recording\x20is\x20enabled!');_0x500167['recordingURL']=util[_0xe128('0x2c')](_0xe128('0x5d'),_0x2bdb8e[_0xe128('0x48')],_0x500167[_0xe128('0x4f')],md5(_0x500167[_0xe128('0x4f')]));}else{_0x500167[_0xe128('0x4e')]='';}return getConnection(_0x2bdb8e)[_0xe128('0x1a')](function(_0x37183f){_0x5d3e61=_0x37183f;if(!_[_0xe128('0x17')](_0x410b22)){return getUser(_0x2bdb8e,_0x410b22[_0xe128('0x3d')],_0x5d3e61);}else{return getUser(_0x2bdb8e,null,_0x5d3e61);}})[_0xe128('0x1a')](function(_0x4b5883){_0x31725b=_0x4b5883;return getEndUser(_0x2bdb8e,_0xc63bf5,_0x500167['calleridname'],_0x500167[_0xe128('0x6a')],_0x5d3e61);})['then'](function(_0x1105a6){_0x2ad6ae=_0x1105a6;return getTicket(_0x2bdb8e,_0x31725b,_0x2ad6ae,_0xc63bf5,_0x500167,_0xc63bf5[_0xe128('0x60')],_0x5d3e61);})['then'](function(_0x5e4338){_0xfe8693=_0x5e4338;logger[_0xe128('0x1e')]('['+_0x500167['lastevent'][_0xe128('0x69')]()+_0xe128('0x6b'),_0xfe8693['id']);logger[_0xe128('0x1e')]('['+_0x500167[_0xe128('0x68')]['toUpperCase']()+_0xe128('0x6c'),_0x2bdb8e['type']);})[_0xe128('0x59')](function(_0x5e8172){logger[_0xe128('0x65')]('['+_0x500167['lastevent'][_0xe128('0x69')]()+']',JSON[_0xe128('0x5a')](_0x5e8172));});}; \ 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 a847be7..8aef20c 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 _0x1775=['number','label','label_entry','incident','Incident','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','true','userId','userEmail','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','System','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','type','nameField','customField','toLowerCase','content','toString','picklist','idField','variable','variableName','customVariable','Variable','name','outbound','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x1775,0x1db));var _0x5177=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x1775[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var Promise=require(_0x5177('0x0'));var rp=require(_0x5177('0x1'));var util=require(_0x5177('0x2'));var md5=require(_0x5177('0x3'));var Redis=require(_0x5177('0x4'));var intUtil=require(_0x5177('0x5'));var config=require(_0x5177('0x6'));var logger=require(_0x5177('0x7'))(_0x5177('0x8'));config[_0x5177('0x9')]=_[_0x5177('0xa')](config[_0x5177('0x9')],{'host':_0x5177('0xb'),'port':0x18eb});var io=require(_0x5177('0xc'))(new Redis(config[_0x5177('0x9')]));function getAdminUser(_0x245c12,_0x363611,_0x3ce288,_0x16e7a7,_0x2e5a3b,_0x2c23d8){return new Promise(function(_0x206035,_0x5bdca9){var _0x4ae3d2={'method':_0x5177('0xd'),'uri':_0x16e7a7+_0x5177('0xe')+'&'+_0x2e5a3b+'&'+_0x2c23d8,'auth':_0x363611,'json':!![]};return rp(_0x4ae3d2)[_0x5177('0xf')](function(_0x227316){if(_0x227316[_0x5177('0x10')]['length']>0x0){_0x3ce288[_0x5177('0x11')]=_0x227316[_0x5177('0x10')][0x0][_0x5177('0x12')];}logger[_0x5177('0x13')]('['+[_0x245c12[_0x5177('0x14')]()]+_0x5177('0x15'),_0x3ce288);_0x206035(_0x3ce288);})[_0x5177('0x16')](function(_0x2ec90f){logger[_0x5177('0x17')]('['+[_0x245c12[_0x5177('0x14')]()]+']',_0x2ec90f[_0x5177('0x18')]);_0x5bdca9(_0x2ec90f[_0x5177('0x18')]);});});}function getUser(_0x29cd2c,_0x31aff8,_0x1b32e6,_0x175ca6,_0x2ab5e5){return function(_0x7dba6f){logger[_0x5177('0x13')]('['+[_0x29cd2c['toUpperCase']()]+_0x5177('0x19'),_0x7dba6f);return new Promise(function(_0x41e687,_0x3f5ab5){if(intUtil[_0x5177('0x1a')](_0x7dba6f['userEmail'])){var _0x3e6944={'method':_0x5177('0xd'),'uri':_0x1b32e6+_0x5177('0x1b')+_0x7dba6f['userEmail']+'&'+_0x175ca6+'&'+_0x2ab5e5,'auth':_0x31aff8,'json':!![]};logger[_0x5177('0x13')]('['+[_0x29cd2c['toUpperCase']()]+_0x5177('0x1c'),_0x3e6944);return rp(_0x3e6944)[_0x5177('0xf')](function(_0x219744){logger[_0x5177('0x13')]('['+[_0x29cd2c[_0x5177('0x14')]()]+_0x5177('0x1d'),_0x219744);if(_0x219744[_0x5177('0x10')][_0x5177('0x1e')]>0x0&&String(_0x219744[_0x5177('0x10')][0x0][_0x5177('0x1f')])===_0x5177('0x20')){_0x7dba6f[_0x5177('0x21')]=_0x219744['result'][0x0][_0x5177('0x12')];}else{_0x7dba6f['userId']=_0x7dba6f[_0x5177('0x11')];_0x7dba6f[_0x5177('0x22')]=_0x7dba6f[_0x5177('0x23')];}logger[_0x5177('0x13')]('['+[_0x29cd2c['toUpperCase']()]+_0x5177('0x24'),_0x7dba6f);_0x41e687(_0x7dba6f);})['catch'](function(_0x564139){logger[_0x5177('0x17')]('['+[_0x29cd2c[_0x5177('0x14')]()]+']',_0x564139['message']);_0x3f5ab5(_0x564139[_0x5177('0x18')]);});}else{logger['info']('['+[_0x29cd2c[_0x5177('0x14')]()]+_0x5177('0x25'));_0x7dba6f['userId']=_0x7dba6f[_0x5177('0x11')];_0x7dba6f[_0x5177('0x22')]=_0x7dba6f[_0x5177('0x23')];_0x41e687(_0x7dba6f);}});};}function createEndUser(_0x7f86e,_0xe98ff1,_0x1cef5d,_0x5577bb,_0x498fcd){logger[_0x5177('0x13')]('['+[_0x7f86e[_0x5177('0x14')]()]+_0x5177('0x26'),_0x1cef5d);return new Promise(function(_0x174f7a,_0x2e1985){var _0x8134f9={'method':_0x5177('0x27'),'uri':_0x5577bb+_0x5177('0x28')+_0x498fcd,'body':{'user_name':_0x1cef5d['endUserNumber'],'roles':_0x5177('0x29'),'first_name':_0x1cef5d[_0x5177('0x2a')],'active':'true','date_format':_0x5177('0x2b'),'phone':_0x1cef5d['endUserNumber']},'auth':_0xe98ff1,'json':!![]};return rp(_0x8134f9)[_0x5177('0xf')](function(_0x1a2c46){logger[_0x5177('0x13')]('['+[_0x7f86e['toUpperCase']()]+'],\x20EndUser\x20schema',_0x1a2c46[_0x5177('0x10')]);_0x1cef5d[_0x5177('0x2c')]=_0x1a2c46[_0x5177('0x10')][_0x5177('0x12')];_0x174f7a(_0x1cef5d);})[_0x5177('0x16')](function(_0x282ed9){logger[_0x5177('0x17')]('['+[_0x7f86e[_0x5177('0x14')]()]+']',_0x282ed9['message']);_0x2e1985(_0x282ed9[_0x5177('0x18')]);});});}function getEndUser(_0x1d9afe,_0x570522,_0xa0851d,_0x2a26fc,_0x172196){return function(_0x8727c6){logger[_0x5177('0x13')]('['+[_0x1d9afe[_0x5177('0x14')]()]+'],\x20getEndUser\x20input\x20crm',_0x8727c6);return new Promise(function(_0x40c607,_0x1cb4a0){var _0x28b1d5={'method':_0x5177('0xd'),'uri':_0xa0851d+_0x5177('0x2d')+_0x8727c6[_0x5177('0x2a')]+'&'+_0x2a26fc+'&'+_0x172196,'auth':_0x570522,'json':!![]};return rp(_0x28b1d5)[_0x5177('0xf')](function(_0x5a5a33){if(_0x5a5a33[_0x5177('0x10')][_0x5177('0x1e')]>0x0){_0x8727c6['endUserId']=_0x5a5a33['result'][0x0][_0x5177('0x12')];logger[_0x5177('0x13')]('['+[_0x1d9afe[_0x5177('0x14')]()]+_0x5177('0x2e'),_0x8727c6);_0x40c607(_0x8727c6);}else{return createEndUser(_0x1d9afe,_0x570522,_0x8727c6,_0xa0851d,_0x2a26fc)[_0x5177('0xf')](function(_0x1ea3be){logger[_0x5177('0x13')]('['+[_0x1d9afe[_0x5177('0x14')]()]+_0x5177('0x2f'),_0x1ea3be);_0x40c607(_0x1ea3be);});}})[_0x5177('0x16')](function(_0x16fabc){logger[_0x5177('0x17')]('['+[_0x1d9afe[_0x5177('0x14')]()]+']',_0x16fabc['message']);_0x1cb4a0(_0x16fabc[_0x5177('0x18')]);});});};}function getCustomFields(_0x2a4db1,_0x4e3677){var _0x7341c0={};if(_0x2a4db1['length']>0x0){_[_0x5177('0x30')](_0x2a4db1,function(_0x77e8e3){if(_[_0x5177('0x31')](['string','picklist'],_0x77e8e3[_0x5177('0x32')])&&_0x77e8e3[_0x5177('0x33')]&&!_0x77e8e3[_0x5177('0x34')]){_0x7341c0[_0x77e8e3[_0x5177('0x33')][_0x5177('0x35')]()]=_0x77e8e3[_0x5177('0x36')][_0x5177('0x37')]();}else if(_[_0x5177('0x31')](['string',_0x5177('0x38')],_0x77e8e3['type'])&&_0x77e8e3['idField']&&_0x77e8e3[_0x5177('0x34')]){_0x7341c0[_0x77e8e3[_0x5177('0x39')]['toLowerCase']()]=_0x77e8e3[_0x5177('0x36')]['toString']();}else if(_0x77e8e3['type']===_0x5177('0x3a')&&_0x77e8e3[_0x5177('0x3b')]&&_0x77e8e3[_0x5177('0x39')]&&_0x77e8e3[_0x5177('0x34')]){_0x7341c0[_0x77e8e3[_0x5177('0x39')][_0x5177('0x35')]()]=_0x4e3677[_0x77e8e3[_0x5177('0x3b')]]['toString']();}else if(_0x77e8e3['type']===_0x5177('0x3c')&&_0x77e8e3['Variable']&&_0x77e8e3[_0x5177('0x3d')][_0x5177('0x3e')]&&_0x77e8e3[_0x5177('0x39')]&&_0x77e8e3[_0x5177('0x34')]){_0x7341c0[_0x77e8e3['idField'][_0x5177('0x35')]()]=_0x4e3677[_0x77e8e3[_0x5177('0x3d')][_0x5177('0x3e')][_0x5177('0x35')]()][_0x5177('0x37')]();}});}return _0x7341c0;}function getTicket(_0x10b370,_0x18ff35,_0xa24b4d,_0x1ada68,_0x296a98,_0x3fec49){return function(_0x5e796d){logger[_0x5177('0x13')]('['+[_0x10b370['toUpperCase']()]+']\x20getTicket\x20input\x20crm',_0x5e796d);return new Promise(function(_0x5bda8a,_0x2f9ff9){var _0x2ce71a=_0x10b370['toLowerCase']()===_0x5177('0x3f')?_0x5e796d[_0x5177('0x21')]:_0x5e796d[_0x5177('0x2c')];var _0x4891fe={'method':_0x5177('0x27'),'uri':_0xa24b4d+'incident'+'?'+_0x3fec49,'body':Object['assign']({},{'active':'true','caller_id':_0x2ce71a,'assigned_to':_0x5e796d[_0x5177('0x21')],'short_description':intUtil[_0x5177('0x40')](_0x1ada68[_0x5177('0x41')],_0x296a98,'\x20'),'description':intUtil['getString'](_0x1ada68['Descriptions'],_0x296a98,'\x0a')},getCustomFields(_0x1ada68[_0x5177('0x42')],_0x296a98)),'auth':_0x18ff35,'json':!![]};return rp(_0x4891fe)['then'](function(_0x262ac4){logger[_0x5177('0x13')]('['+[_0x10b370[_0x5177('0x14')]()]+_0x5177('0x43'),_0x262ac4[_0x5177('0x10')]);_0x5e796d[_0x5177('0x44')]=_0x262ac4[_0x5177('0x10')][_0x5177('0x12')];_0x5e796d[_0x5177('0x45')]=_0x262ac4[_0x5177('0x10')][_0x5177('0x46')];logger[_0x5177('0x13')]('['+[_0x10b370[_0x5177('0x14')]()]+']\x20getTicket\x20crm',_0x5e796d);_0x5bda8a(_0x5e796d);})['catch'](function(_0x29ff0f){logger['error']('['+[_0x10b370[_0x5177('0x14')]()]+']',_0x29ff0f['message']);_0x2f9ff9(_0x29ff0f[_0x5177('0x18')]);});});};}function createRemoteTag(_0x24cb5e,_0x1e838a,_0x55a0b6,_0x5be224){return new Promise(function(_0x19884e,_0x43b5b9){var _0x2eb560={'method':_0x5177('0x27'),'uri':_0x55a0b6+'label'+'?'+_0x5be224,'body':{'short_description':_0x24cb5e,'global':!![],'active':!![],'name':_0x24cb5e},'auth':_0x1e838a,'json':!![]};return rp(_0x2eb560)['then'](function(_0x3f0e89){var _0x131da7=_0x3f0e89[_0x5177('0x10')][_0x5177('0x12')];_0x19884e(_0x131da7);});});}function getRemoteTag(_0x4ad742,_0xc3c118,_0x143aff,_0x3a18ad,_0x589da8){return new Promise(function(_0x2b39ba,_0xe0f87b){var _0x3a39b5={'method':'GET','uri':_0x143aff+_0x5177('0x47')+'?sysparm_query=name%3D'+_0x4ad742+'&'+_0x3a18ad,'auth':_0xc3c118,'json':!![]};return rp(_0x3a39b5)[_0x5177('0xf')](function(_0x39fb92){if(_0x39fb92[_0x5177('0x10')]['length']>0x0){var _0x169a04=_0x39fb92[_0x5177('0x10')][0x0][_0x5177('0x12')];_0x2b39ba(_0x169a04);}else{return createRemoteTag(_0x4ad742,_0xc3c118,_0x143aff,_0x3a18ad)[_0x5177('0xf')](function(_0xc7a59e){_0x2b39ba(_0xc7a59e);});}});});}function assignTagToIncident(_0x74589e,_0x37380c,_0x267599,_0x5ceed2,_0x5d96ce){return new Promise(function(_0x4b5b6b,_0x3bc60b){var _0x18222f={'method':_0x5177('0x27'),'uri':_0x267599+_0x5177('0x48')+'?'+_0x5d96ce,'body':{'label':_0x74589e,'table':_0x5177('0x49'),'id_type':_0x5177('0x4a'),'table_key':_0x5ceed2['ticketId'],'title':'Incident\x20-\x20'+_0x5ceed2[_0x5177('0x45')],'id_display':_0x5ceed2[_0x5177('0x45')]},'auth':_0x37380c,'json':!![]};return rp(_0x18222f)[_0x5177('0xf')](function(_0x336017){_0x4b5b6b();})[_0x5177('0x16')](function(){_0x4b5b6b();});});}function manageTags(_0x1b1778,_0x2d1745,_0xd9c1db,_0xbfb3d7,_0x4d3e8d,_0x25034b,_0x25a0be){return new Promise(function(_0x57e199,_0x194978){var _0x4481b6=[];_0x2d1745['forEach'](function(_0x69c264){_0x4481b6[_0x5177('0x4b')](getRemoteTag(_0x69c264,_0xd9c1db,_0xbfb3d7,_0x25034b,_0x25a0be));});return Promise[_0x5177('0x4c')](_0x4481b6)['then'](function(_0x23b246){if(_0x23b246[_0x5177('0x1e')]){logger['info']('['+[_0x1b1778['toUpperCase']()]+_0x5177('0x4d'),_0x23b246);var _0x4f76d7=[];_0x23b246[_0x5177('0x30')](function(_0x53f599){_0x4f76d7[_0x5177('0x4b')](assignTagToIncident(_0x53f599,_0xd9c1db,_0xbfb3d7,_0x4d3e8d,_0x25034b));});return Promise[_0x5177('0x4c')](_0x4f76d7)['then'](function(){_0x57e199();})[_0x5177('0x16')](function(){_0x57e199();});}else{_0x57e199();}});});}function getTags(_0x3b090d,_0x1975a3,_0x46b63d,_0x41c380,_0x2bf11b,_0x20d476){return function(_0x58ebdd){return new Promise(function(_0x26b733,_0x54aabd){var _0x54c301=[];var _0x94bb14=_0x41c380[_0x5177('0x4e')];if(_0x94bb14&&_0x94bb14['length']>0x0){_0x54c301=_[_0x5177('0x4f')](_0x94bb14,_0x5177('0x3e'));}if(_0x54c301[_0x5177('0x1e')]>0x0){return manageTags(_0x3b090d,_0x54c301,_0x1975a3,_0x46b63d,_0x58ebdd,_0x2bf11b,_0x20d476)[_0x5177('0xf')](function(){_0x26b733(_0x58ebdd);});}else{_0x26b733(_0x58ebdd);}});};}function emit(_0x19b587,_0x128cab,_0xe22e2a){var _0x3b26f4='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x5177('0x50')+_0x5177('0x51');var _0x260475={'uri':_0x19b587+_0x5177('0x52')+_0xe22e2a+_0x3b26f4};io['to'](util[_0x5177('0x53')](_0x5177('0x54'),_0x128cab))['emit'](_0x5177('0x55'),_0x260475);}exports['cs']=function(_0x397b75,_0x36ab31,_0x46d72e,_0x4aa151,_0x2e26c6,_0x95f83a,_0x124935,_0x22da9d){var _0x282cbc={};var _0x5130e6={'user':_0x95f83a[_0x5177('0x56')],'pass':_0x95f83a['password']};var _0x1a6499=_0x5177('0x57');var _0x5e3554=_0x5177('0x58');_0x95f83a[_0x5177('0x59')]=intUtil[_0x5177('0x5a')](_0x95f83a[_0x5177('0x59')]);_0x95f83a['serverUrl']=intUtil[_0x5177('0x5a')](_0x95f83a[_0x5177('0x5b')]);var _0x5b9ba8=util[_0x5177('0x53')]('%s/api/now/table/',_0x95f83a[_0x5177('0x59')]);_0x282cbc[_0x5177('0x22')]=!_[_0x5177('0x5c')](_0x4aa151)?_0x4aa151['email']:null;_0x282cbc['adminEmail']=_0x95f83a[_0x5177('0x5d')];_0x282cbc[_0x5177('0x2a')]=_0x22da9d[_0x5177('0x35')]()===_0x5177('0x3f')?_0x36ab31[_0x5177('0x5e')]:_0x36ab31[_0x5177('0x5f')];_0x282cbc[_0x5177('0x60')]=_0x22da9d===_0x5177('0x61')||_0x22da9d===_0x5177('0x62')?'queue':'outbound';var _0x597a84=util[_0x5177('0x53')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x95f83a[_0x5177('0x5b')],_0x36ab31[_0x5177('0x63')],md5(_0x36ab31[_0x5177('0x63')]));if(_0x2e26c6&&_0x2e26c6[_0x5177('0x64')]){logger[_0x5177('0x13')]('[QUEUE]',_0x5177('0x65'));_0x36ab31[_0x5177('0x66')]=_0x597a84;}else if(_0x124935&&_0x124935[_0x5177('0x67')]&&_0x124935['recordingFormat']!==_0x5177('0x68')){logger['info'](_0x5177('0x69'),_0x5177('0x65'));_0x36ab31['recordingURL']=_0x597a84;}else{_0x36ab31[_0x5177('0x66')]='';}return getAdminUser(_0x22da9d,_0x5130e6,_0x282cbc,_0x5b9ba8,_0x5e3554,_0x1a6499)[_0x5177('0xf')](getUser(_0x22da9d,_0x5130e6,_0x5b9ba8,_0x5e3554,_0x1a6499))['then'](getEndUser(_0x22da9d,_0x5130e6,_0x5b9ba8,_0x5e3554,_0x1a6499))['then'](getTicket(_0x22da9d,_0x5130e6,_0x5b9ba8,_0x46d72e,_0x36ab31,_0x5e3554))[_0x5177('0xf')](function(_0x5ea2aa){logger[_0x5177('0x13')](util[_0x5177('0x53')]('The\x20ticket\x20ID\x20is:\x20%s',_0x5ea2aa[_0x5177('0x44')]));logger[_0x5177('0x13')](util[_0x5177('0x53')](_0x5177('0x6a'),_0x22da9d));if(_0x22da9d!==_0x5177('0x62')){logger[_0x5177('0x13')]('['+[_0x22da9d[_0x5177('0x14')]()]+']',_0x5177('0x6b'));emit(_0x95f83a['remoteUri'],_0x4aa151[_0x5177('0x3e')],_0x5ea2aa['ticketId']);}})[_0x5177('0x16')](function(_0x339d5d){logger[_0x5177('0x17')]('['+[_0x22da9d[_0x5177('0x14')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x5177('0x6c')](_0x339d5d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xefda=['ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','outbound','destcalleridnum','calleridnum','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','ticketId','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','util','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','],\x20getAdminUser\x20crm','error','toUpperCase','message','validateEmail','userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','userId','],\x20getUser\x20crm','adminEmail','POST','sys_user?','true','System','],\x20EndUser\x20schema','endUserId','catch','],\x20getEndUser\x20input\x20crm','endUserNumber','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','type','nameField','customField','content','toString','picklist','idField','toLowerCase','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema'];(function(_0x5aa141,_0x2d6e3a){var _0x446d2f=function(_0x11bb05){while(--_0x11bb05){_0x5aa141['push'](_0x5aa141['shift']());}};_0x446d2f(++_0x2d6e3a);}(_0xefda,0x96));var _0xaefd=function(_0x3557e0,_0x4ab9cc){_0x3557e0=_0x3557e0-0x0;var _0x566e77=_0xefda[_0x3557e0];return _0x566e77;};'use strict';var _=require(_0xaefd('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0xaefd('0x1'));var md5=require(_0xaefd('0x2'));var Redis=require('ioredis');var intUtil=require(_0xaefd('0x3'));var config=require(_0xaefd('0x4'));var logger=require(_0xaefd('0x5'))(_0xaefd('0x6'));config[_0xaefd('0x7')]=_[_0xaefd('0x8')](config['redis'],{'host':_0xaefd('0x9'),'port':0x18eb});var io=require(_0xaefd('0xa'))(new Redis(config[_0xaefd('0x7')]));function getAdminUser(_0x1d76f3,_0x4ce248,_0x15193c,_0xbb04fb,_0x463ce7,_0x4d44ed){return new Promise(function(_0x48a255,_0x54a3b1){var _0xa6239d={'method':_0xaefd('0xb'),'uri':_0xbb04fb+_0xaefd('0xc')+'&'+_0x463ce7+'&'+_0x4d44ed,'auth':_0x4ce248,'json':!![]};return rp(_0xa6239d)[_0xaefd('0xd')](function(_0x10272a){if(_0x10272a[_0xaefd('0xe')][_0xaefd('0xf')]>0x0){_0x15193c[_0xaefd('0x10')]=_0x10272a[_0xaefd('0xe')][0x0][_0xaefd('0x11')];}logger[_0xaefd('0x12')]('['+[_0x1d76f3['toUpperCase']()]+_0xaefd('0x13'),_0x15193c);_0x48a255(_0x15193c);})['catch'](function(_0xd88c7c){logger[_0xaefd('0x14')]('['+[_0x1d76f3[_0xaefd('0x15')]()]+']',_0xd88c7c[_0xaefd('0x16')]);_0x54a3b1(_0xd88c7c['message']);});});}function getUser(_0x16e4f4,_0x13492c,_0x41f345,_0x411701,_0x10ee28){return function(_0x32f75e){logger[_0xaefd('0x12')]('['+[_0x16e4f4[_0xaefd('0x15')]()]+'],\x20getUser\x20input\x20crm',_0x32f75e);return new Promise(function(_0x9d9c29,_0x109604){if(intUtil[_0xaefd('0x17')](_0x32f75e[_0xaefd('0x18')])){var _0x2db61b={'method':_0xaefd('0xb'),'uri':_0x41f345+'sys_user?sysparm_query=email%3D'+_0x32f75e[_0xaefd('0x18')]+'&'+_0x411701+'&'+_0x10ee28,'auth':_0x13492c,'json':!![]};logger[_0xaefd('0x12')]('['+[_0x16e4f4[_0xaefd('0x15')]()]+_0xaefd('0x19'),_0x2db61b);return rp(_0x2db61b)[_0xaefd('0xd')](function(_0x1f302c){logger['info']('['+[_0x16e4f4[_0xaefd('0x15')]()]+_0xaefd('0x1a'),_0x1f302c);if(_0x1f302c[_0xaefd('0xe')][_0xaefd('0xf')]>0x0&&String(_0x1f302c[_0xaefd('0xe')][0x0]['active'])==='true'){_0x32f75e['userId']=_0x1f302c[_0xaefd('0xe')][0x0][_0xaefd('0x11')];}else{_0x32f75e[_0xaefd('0x1b')]=_0x32f75e['adminId'];_0x32f75e[_0xaefd('0x18')]=_0x32f75e['adminEmail'];}logger[_0xaefd('0x12')]('['+[_0x16e4f4[_0xaefd('0x15')]()]+_0xaefd('0x1c'),_0x32f75e);_0x9d9c29(_0x32f75e);})['catch'](function(_0x435413){logger[_0xaefd('0x14')]('['+[_0x16e4f4[_0xaefd('0x15')]()]+']',_0x435413[_0xaefd('0x16')]);_0x109604(_0x435413[_0xaefd('0x16')]);});}else{logger['info']('['+[_0x16e4f4[_0xaefd('0x15')]()]+']\x20using\x20admin\x20profile');_0x32f75e[_0xaefd('0x1b')]=_0x32f75e[_0xaefd('0x10')];_0x32f75e['userEmail']=_0x32f75e[_0xaefd('0x1d')];_0x9d9c29(_0x32f75e);}});};}function createEndUser(_0x2a8fa8,_0x521839,_0xbeb1b8,_0x114ec0,_0x36b6b7){logger['info']('['+[_0x2a8fa8[_0xaefd('0x15')]()]+'],\x20createEndUser\x20input\x20crm',_0xbeb1b8);return new Promise(function(_0x109e19,_0x5c5639){var _0x4a1acb={'method':_0xaefd('0x1e'),'uri':_0x114ec0+_0xaefd('0x1f')+_0x36b6b7,'body':{'user_name':_0xbeb1b8['endUserNumber'],'roles':'user','first_name':_0xbeb1b8['endUserNumber'],'active':_0xaefd('0x20'),'date_format':_0xaefd('0x21'),'phone':_0xbeb1b8['endUserNumber']},'auth':_0x521839,'json':!![]};return rp(_0x4a1acb)['then'](function(_0x62ef86){logger[_0xaefd('0x12')]('['+[_0x2a8fa8[_0xaefd('0x15')]()]+_0xaefd('0x22'),_0x62ef86['result']);_0xbeb1b8[_0xaefd('0x23')]=_0x62ef86[_0xaefd('0xe')][_0xaefd('0x11')];_0x109e19(_0xbeb1b8);})[_0xaefd('0x24')](function(_0x26a727){logger[_0xaefd('0x14')]('['+[_0x2a8fa8[_0xaefd('0x15')]()]+']',_0x26a727[_0xaefd('0x16')]);_0x5c5639(_0x26a727[_0xaefd('0x16')]);});});}function getEndUser(_0x234780,_0x3744a5,_0x195571,_0x304d34,_0x26a6bd){return function(_0x1ffec4){logger[_0xaefd('0x12')]('['+[_0x234780['toUpperCase']()]+_0xaefd('0x25'),_0x1ffec4);return new Promise(function(_0xcb4be8,_0x353a0b){var _0x59aec9={'method':_0xaefd('0xb'),'uri':_0x195571+'sys_user?sysparm_query=phone%3D'+_0x1ffec4[_0xaefd('0x26')]+'&'+_0x304d34+'&'+_0x26a6bd,'auth':_0x3744a5,'json':!![]};return rp(_0x59aec9)[_0xaefd('0xd')](function(_0x99a883){if(_0x99a883[_0xaefd('0xe')][_0xaefd('0xf')]>0x0){_0x1ffec4[_0xaefd('0x23')]=_0x99a883[_0xaefd('0xe')][0x0][_0xaefd('0x11')];logger[_0xaefd('0x12')]('['+[_0x234780[_0xaefd('0x15')]()]+_0xaefd('0x27'),_0x1ffec4);_0xcb4be8(_0x1ffec4);}else{return createEndUser(_0x234780,_0x3744a5,_0x1ffec4,_0x195571,_0x304d34)[_0xaefd('0xd')](function(_0x1233a9){logger[_0xaefd('0x12')]('['+[_0x234780['toUpperCase']()]+_0xaefd('0x28'),_0x1233a9);_0xcb4be8(_0x1233a9);});}})['catch'](function(_0xf869a1){logger[_0xaefd('0x14')]('['+[_0x234780[_0xaefd('0x15')]()]+']',_0xf869a1[_0xaefd('0x16')]);_0x353a0b(_0xf869a1[_0xaefd('0x16')]);});});};}function getCustomFields(_0x3c9331,_0xa98181){var _0x145e9e={};if(_0x3c9331[_0xaefd('0xf')]>0x0){_[_0xaefd('0x29')](_0x3c9331,function(_0x53f693){if(_[_0xaefd('0x2a')]([_0xaefd('0x2b'),'picklist'],_0x53f693[_0xaefd('0x2c')])&&_0x53f693[_0xaefd('0x2d')]&&!_0x53f693[_0xaefd('0x2e')]){_0x145e9e[_0x53f693['nameField']['toLowerCase']()]=_0x53f693[_0xaefd('0x2f')][_0xaefd('0x30')]();}else if(_[_0xaefd('0x2a')]([_0xaefd('0x2b'),_0xaefd('0x31')],_0x53f693[_0xaefd('0x2c')])&&_0x53f693[_0xaefd('0x32')]&&_0x53f693[_0xaefd('0x2e')]){_0x145e9e[_0x53f693['idField'][_0xaefd('0x33')]()]=_0x53f693[_0xaefd('0x2f')][_0xaefd('0x30')]();}else if(_0x53f693[_0xaefd('0x2c')]===_0xaefd('0x34')&&_0x53f693[_0xaefd('0x35')]&&_0x53f693[_0xaefd('0x32')]&&_0x53f693[_0xaefd('0x2e')]){_0x145e9e[_0x53f693['idField']['toLowerCase']()]=_0xa98181[_0x53f693[_0xaefd('0x35')]][_0xaefd('0x30')]();}else if(_0x53f693['type']==='customVariable'&&_0x53f693[_0xaefd('0x36')]&&_0x53f693[_0xaefd('0x36')][_0xaefd('0x37')]&&_0x53f693[_0xaefd('0x32')]&&_0x53f693[_0xaefd('0x2e')]){_0x145e9e[_0x53f693[_0xaefd('0x32')][_0xaefd('0x33')]()]=_0xa98181[_0x53f693[_0xaefd('0x36')][_0xaefd('0x37')]['toLowerCase']()][_0xaefd('0x30')]();}});}return _0x145e9e;}function getTicket(_0x3ff08c,_0x29457e,_0x2f0cc6,_0x224613,_0x2cb72f,_0xf54e83){return function(_0x5039ac){logger[_0xaefd('0x12')]('['+[_0x3ff08c['toUpperCase']()]+_0xaefd('0x38'),_0x5039ac);return new Promise(function(_0x374845,_0x16c664){var _0x18cb30=_0x3ff08c['toLowerCase']()==='outbound'?_0x5039ac[_0xaefd('0x1b')]:_0x5039ac[_0xaefd('0x23')];var _0x179b8b={'method':'POST','uri':_0x2f0cc6+_0xaefd('0x39')+'?'+_0xf54e83,'body':Object[_0xaefd('0x3a')]({},{'active':'true','caller_id':_0x18cb30,'assigned_to':_0x5039ac[_0xaefd('0x1b')],'short_description':intUtil[_0xaefd('0x3b')](_0x224613[_0xaefd('0x3c')],_0x2cb72f,'\x20'),'description':intUtil[_0xaefd('0x3b')](_0x224613[_0xaefd('0x3d')],_0x2cb72f,'\x0a')},getCustomFields(_0x224613[_0xaefd('0x3e')],_0x2cb72f)),'auth':_0x29457e,'json':!![]};return rp(_0x179b8b)[_0xaefd('0xd')](function(_0x3d5b7d){logger['info']('['+[_0x3ff08c['toUpperCase']()]+_0xaefd('0x3f'),_0x3d5b7d[_0xaefd('0xe')]);_0x5039ac['ticketId']=_0x3d5b7d[_0xaefd('0xe')]['sys_id'];_0x5039ac[_0xaefd('0x40')]=_0x3d5b7d[_0xaefd('0xe')][_0xaefd('0x41')];logger[_0xaefd('0x12')]('['+[_0x3ff08c[_0xaefd('0x15')]()]+_0xaefd('0x42'),_0x5039ac);_0x374845(_0x5039ac);})['catch'](function(_0x56e180){logger[_0xaefd('0x14')]('['+[_0x3ff08c[_0xaefd('0x15')]()]+']',_0x56e180['message']);_0x16c664(_0x56e180[_0xaefd('0x16')]);});});};}function createRemoteTag(_0x3d8844,_0x392117,_0x23fee9,_0x4a883b){return new Promise(function(_0x583caa,_0x2b0d8e){var _0x41ef40={'method':_0xaefd('0x1e'),'uri':_0x23fee9+_0xaefd('0x43')+'?'+_0x4a883b,'body':{'short_description':_0x3d8844,'global':!![],'active':!![],'name':_0x3d8844},'auth':_0x392117,'json':!![]};return rp(_0x41ef40)[_0xaefd('0xd')](function(_0x47cac9){var _0x377c28=_0x47cac9[_0xaefd('0xe')]['sys_id'];_0x583caa(_0x377c28);});});}function getRemoteTag(_0xbeca29,_0x11543f,_0x5f2925,_0x108e35,_0x367944){return new Promise(function(_0x46be93,_0x4a5ddf){var _0x444c05={'method':_0xaefd('0xb'),'uri':_0x5f2925+'label'+_0xaefd('0x44')+_0xbeca29+'&'+_0x108e35,'auth':_0x11543f,'json':!![]};return rp(_0x444c05)[_0xaefd('0xd')](function(_0x14b472){if(_0x14b472[_0xaefd('0xe')]['length']>0x0){var _0x5daf75=_0x14b472[_0xaefd('0xe')][0x0][_0xaefd('0x11')];_0x46be93(_0x5daf75);}else{return createRemoteTag(_0xbeca29,_0x11543f,_0x5f2925,_0x108e35)[_0xaefd('0xd')](function(_0x3e1673){_0x46be93(_0x3e1673);});}});});}function assignTagToIncident(_0x4189c4,_0x8ab9e7,_0x314660,_0x368fd3,_0x1e519e){return new Promise(function(_0x133c4f,_0x48636d){var _0x4fc1f9={'method':_0xaefd('0x1e'),'uri':_0x314660+_0xaefd('0x45')+'?'+_0x1e519e,'body':{'label':_0x4189c4,'table':_0xaefd('0x39'),'id_type':_0xaefd('0x46'),'table_key':_0x368fd3['ticketId'],'title':_0xaefd('0x47')+_0x368fd3[_0xaefd('0x40')],'id_display':_0x368fd3[_0xaefd('0x40')]},'auth':_0x8ab9e7,'json':!![]};return rp(_0x4fc1f9)[_0xaefd('0xd')](function(_0x16c227){_0x133c4f();})[_0xaefd('0x24')](function(){_0x133c4f();});});}function manageTags(_0x241e93,_0x2c1004,_0x5c521f,_0x2c36c7,_0x3339e6,_0xb44fd9,_0x2456a6){return new Promise(function(_0x5c7988,_0x9eb909){var _0x53888d=[];_0x2c1004[_0xaefd('0x29')](function(_0x22cf9d){_0x53888d['push'](getRemoteTag(_0x22cf9d,_0x5c521f,_0x2c36c7,_0xb44fd9,_0x2456a6));});return Promise['all'](_0x53888d)[_0xaefd('0xd')](function(_0x524b1e){if(_0x524b1e['length']){logger['info']('['+[_0x241e93[_0xaefd('0x15')]()]+_0xaefd('0x48'),_0x524b1e);var _0x27fcb4=[];_0x524b1e[_0xaefd('0x29')](function(_0x442b49){_0x27fcb4[_0xaefd('0x49')](assignTagToIncident(_0x442b49,_0x5c521f,_0x2c36c7,_0x3339e6,_0xb44fd9));});return Promise['all'](_0x27fcb4)['then'](function(){_0x5c7988();})['catch'](function(){_0x5c7988();});}else{_0x5c7988();}});});}function getTags(_0x5c7220,_0x14f9a2,_0x4ea16c,_0x18c20c,_0x481e3a,_0x2fd43e){return function(_0x32dc0d){return new Promise(function(_0x416241,_0xa128f9){var _0x25c018=[];var _0x399a4c=_0x18c20c[_0xaefd('0x4a')];if(_0x399a4c&&_0x399a4c['length']>0x0){_0x25c018=_[_0xaefd('0x4b')](_0x399a4c,_0xaefd('0x37'));}if(_0x25c018[_0xaefd('0xf')]>0x0){return manageTags(_0x5c7220,_0x25c018,_0x14f9a2,_0x4ea16c,_0x32dc0d,_0x481e3a,_0x2fd43e)[_0xaefd('0xd')](function(){_0x416241(_0x32dc0d);});}else{_0x416241(_0x32dc0d);}});};}function emit(_0x56eccc,_0x145907,_0x5b1e67){var _0x28db3a=_0xaefd('0x4c')+_0xaefd('0x4d')+_0xaefd('0x4e')+_0xaefd('0x4f');var _0xa918d3={'uri':_0x56eccc+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x5b1e67+_0x28db3a};io['to'](util[_0xaefd('0x50')](_0xaefd('0x51'),_0x145907))['emit'](_0xaefd('0x52'),_0xa918d3);}exports['cs']=function(_0x279ad4,_0x547101,_0x3a2b63,_0x2a472f,_0x4247d9,_0x46a793,_0x2c4ba7,_0x406c6d){var _0x2d8283={};var _0x6f99b0={'user':_0x46a793[_0xaefd('0x53')],'pass':_0x46a793[_0xaefd('0x54')]};var _0x3b3d90=_0xaefd('0x55');var _0x11a068=_0xaefd('0x56');_0x46a793[_0xaefd('0x57')]=intUtil[_0xaefd('0x58')](_0x46a793[_0xaefd('0x57')]);_0x46a793['serverUrl']=intUtil[_0xaefd('0x58')](_0x46a793[_0xaefd('0x59')]);var _0xfaf117=util['format'](_0xaefd('0x5a'),_0x46a793[_0xaefd('0x57')]);_0x2d8283[_0xaefd('0x18')]=!_[_0xaefd('0x5b')](_0x2a472f)?_0x2a472f['email']:null;_0x2d8283[_0xaefd('0x1d')]=_0x46a793['email'];_0x2d8283[_0xaefd('0x26')]=_0x406c6d['toLowerCase']()===_0xaefd('0x5c')?_0x547101[_0xaefd('0x5d')]:_0x547101[_0xaefd('0x5e')];_0x2d8283['callDirection']=_0x406c6d==='queue'||_0x406c6d===_0xaefd('0x5f')?_0xaefd('0x60'):_0xaefd('0x5c');var _0x99f17b=util[_0xaefd('0x50')](_0xaefd('0x61'),_0x46a793['serverUrl'],_0x547101['uniqueid'],md5(_0x547101['uniqueid']));if(_0x4247d9&&_0x4247d9['monitor_format']){logger['info'](_0xaefd('0x62'),_0xaefd('0x63'));_0x547101[_0xaefd('0x64')]=_0x99f17b;}else if(_0x2c4ba7&&_0x2c4ba7[_0xaefd('0x65')]&&_0x2c4ba7['recordingFormat']!==_0xaefd('0x66')){logger[_0xaefd('0x12')]('[OUTBOUND]',_0xaefd('0x63'));_0x547101['recordingURL']=_0x99f17b;}else{_0x547101[_0xaefd('0x64')]='';}return getAdminUser(_0x406c6d,_0x6f99b0,_0x2d8283,_0xfaf117,_0x11a068,_0x3b3d90)['then'](getUser(_0x406c6d,_0x6f99b0,_0xfaf117,_0x11a068,_0x3b3d90))[_0xaefd('0xd')](getEndUser(_0x406c6d,_0x6f99b0,_0xfaf117,_0x11a068,_0x3b3d90))['then'](getTicket(_0x406c6d,_0x6f99b0,_0xfaf117,_0x3a2b63,_0x547101,_0x11a068))[_0xaefd('0xd')](function(_0x543eb4){logger[_0xaefd('0x12')](util[_0xaefd('0x50')]('The\x20ticket\x20ID\x20is:\x20%s',_0x543eb4[_0xaefd('0x67')]));logger[_0xaefd('0x12')](util[_0xaefd('0x50')]('call\x20direction:\x20%s',_0x406c6d));if(_0x406c6d!==_0xaefd('0x5f')){logger[_0xaefd('0x12')]('['+[_0x406c6d[_0xaefd('0x15')]()]+']',_0xaefd('0x68'));emit(_0x46a793[_0xaefd('0x57')],_0x2a472f['name'],_0x543eb4[_0xaefd('0x67')]);}})[_0xaefd('0x24')](function(_0x4ebd3e){logger[_0xaefd('0x14')]('['+[_0x406c6d[_0xaefd('0x15')]()]+_0xaefd('0x69'),util[_0xaefd('0x6a')](_0x4ebd3e,{'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 de038c2..a1f3d2b 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 _0x6c54=['../../../../config/environment','sugarcrm','defaults','redis','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','description','Descriptions','toISOString','slice','duration_hours','parent_id','parent_type','parent_name','length','forEach','variableName','push','idField','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','get_server_info','isNil','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','then','entry_list','find','name_value_list','user_name','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','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!','Contacts','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','map','type','string','nameField','customField','toLowerCase','content','custom_fields','Variable','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','uri','%s/service/v4_1/rest.php','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','stripTrailingSlash','recordingFormat','The\x20User\x20ID\x20is:','destcalleridnum','Outbound','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','lastevent','toUpperCase','catch','lodash','request-promise','bluebird','md5','util','./util'];(function(_0x17886b,_0x1a26c0){var _0x2f59f6=function(_0x4e8c39){while(--_0x4e8c39){_0x17886b['push'](_0x17886b['shift']());}};_0x2f59f6(++_0x1a26c0);}(_0x6c54,0xe4));var _0x46c5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6c54[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x46c5('0x0'));var rp=require(_0x46c5('0x1'));var BPromise=require(_0x46c5('0x2'));var md5=require(_0x46c5('0x3'));var util=require(_0x46c5('0x4'));var Redis=require('ioredis');var intUtil=require(_0x46c5('0x5'));var config=require(_0x46c5('0x6'));var logger=require('../../../../config/logger')(_0x46c5('0x7'));config['redis']=_[_0x46c5('0x8')](config[_0x46c5('0x9')],{'host':_0x46c5('0xa'),'port':0x18eb});var io=require(_0x46c5('0xb'))(new Redis(config[_0x46c5('0x9')]));var def={'method':_0x46c5('0xc'),'json':!![]};function emit(_0x1cd663,_0x5ec9a6,_0x29a76c){io['to'](_0x1cd663)[_0x46c5('0xd')](_0x5ec9a6,_0x29a76c);}function getTicket(_0x28bf02,_0x425611,_0x3988c0,_0x37b3ec,_0x19d73b,_0x368625,_0x36207f,_0x39a703){logger['info'](_0x46c5('0xe'));var _0x4ed004=new Date();var _0x30f025=[{'name':_0x46c5('0xf'),'value':intUtil[_0x46c5('0x10')](_0x37b3ec[_0x46c5('0x11')],_0x19d73b,'\x20')},{'name':_0x46c5('0x12'),'value':_0x425611['id']},{'name':'created_by','value':_0x425611['id']},{'name':_0x46c5('0x13'),'value':intUtil[_0x46c5('0x10')](_0x37b3ec[_0x46c5('0x14')],_0x19d73b,'\x0a')},{'name':'date_start','value':_0x4ed004[_0x46c5('0x15')]()[_0x46c5('0x16')](0x0,0x13)['replace']('T','\x20')},{'name':_0x46c5('0x17'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x46c5('0x18'),'value':_0x3988c0['id']},{'name':_0x46c5('0x19'),'value':'Contacts'},{'name':_0x46c5('0x1a'),'value':_0x3988c0['name']},{'name':'direction','value':_0x39a703}];if(_0x368625[_0x46c5('0x1b')]){_[_0x46c5('0x1c')](_0x368625,function(_0x144800){if(_0x19d73b[_0x144800[_0x46c5('0x1d')]]){_0x30f025[_0x46c5('0x1e')]({'name':_0x144800[_0x46c5('0x1f')],'value':_0x19d73b[_0x144800[_0x46c5('0x1d')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x46c5('0x20'),'response_type':_0x46c5('0x20'),'rest_data':JSON[_0x46c5('0x21')]({'session':_0x36207f['id'],'module_name':_0x46c5('0x22'),'name_value_list':_0x30f025})}});}function getAuth(_0x419ce1){return util[_0x46c5('0x23')](_0x46c5('0x24'),new Buffer(_0x419ce1[_0x46c5('0x25')]+':X')[_0x46c5('0x26')]('base64'));}function getServerInfo(_0x38517f){return request({'form':{'method':_0x46c5('0x27'),'input_type':_0x46c5('0x20'),'response_type':_0x46c5('0x20'),'rest_data':JSON[_0x46c5('0x21')]({'session':_0x38517f['id']})}});}function getUser(_0x19f38c,_0xf19b9c,_0x2ff10f){if(!_[_0x46c5('0x28')](_0xf19b9c)){logger[_0x46c5('0x29')](_0x46c5('0x2a'),_0xf19b9c);return request({'form':{'method':_0x46c5('0x2b'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x46c5('0x21')]({'session':_0x2ff10f['id'],'module_name':_0x46c5('0x2c'),'query':util[_0x46c5('0x23')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0xf19b9c),'order_by':'','offset':'0','select_fields':['id',_0x46c5('0xf'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x46c5('0x2d')](function(_0x44cf3e){if(_0x44cf3e[_0x46c5('0x2e')][_0x46c5('0x1b')]){var _0x17a469=_[_0x46c5('0x2f')](_0x44cf3e[_0x46c5('0x2e')],function(_0x3ae6b7){return _0x3ae6b7[_0x46c5('0x30')][_0x46c5('0x31')][_0x46c5('0x32')]===_0xf19b9c;});if(_0x17a469){logger[_0x46c5('0x29')](_0x46c5('0x33'));return BPromise['resolve']({'id':_0x17a469[_0x46c5('0x30')]['id'][_0x46c5('0x32')],'name':_0x17a469['name_value_list'][_0x46c5('0xf')][_0x46c5('0x32')]});}}logger[_0x46c5('0x29')](_0x46c5('0x34'));return BPromise[_0x46c5('0x35')]({'id':_0x2ff10f['name_value_list'][_0x46c5('0x36')][_0x46c5('0x32')],'name':_0x2ff10f['name_value_list'][_0x46c5('0x31')][_0x46c5('0x32')]});});}else{logger[_0x46c5('0x29')](_0x46c5('0x37'));return BPromise[_0x46c5('0x35')]({'id':_0x2ff10f[_0x46c5('0x30')][_0x46c5('0x36')][_0x46c5('0x32')],'name':_0x2ff10f[_0x46c5('0x30')]['user_name']['value']});}}function getEndUser(_0x13b6d2,_0x3cb723,_0x2b2f28,_0x41080b){logger['info'](_0x46c5('0x38'),_0x2b2f28);return request({'form':{'method':_0x46c5('0x2b'),'input_type':'JSON','response_type':_0x46c5('0x20'),'rest_data':JSON['stringify']({'session':_0x41080b['id'],'module_name':'Contacts','query':util[_0x46c5('0x23')](_0x46c5('0x39'),_0x2b2f28),'order_by':'','offset':'0','select_fields':['id',_0x46c5('0xf'),_0x46c5('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x46c5('0x2d')](function(_0x2a9845){if(_0x2a9845['entry_list'][_0x46c5('0x1b')]){var _0xb2a8ce=_['find'](_0x2a9845[_0x46c5('0x2e')],function(_0xbf13de){return _0xbf13de[_0x46c5('0x30')]['phone_home']['value']===_0x2b2f28;});if(_0xb2a8ce){logger[_0x46c5('0x29')]('Enduser\x20found!');return BPromise['resolve']({'id':_0xb2a8ce[_0x46c5('0x30')]['id'][_0x46c5('0x32')],'name':_0xb2a8ce[_0x46c5('0x30')][_0x46c5('0xf')][_0x46c5('0x32')],'phone':_0xb2a8ce[_0x46c5('0x30')][_0x46c5('0x3a')][_0x46c5('0x32')]});}}else{logger[_0x46c5('0x29')](_0x46c5('0x3b'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0x46c5('0x20'),'rest_data':JSON['stringify']({'session':_0x41080b['id'],'module_name':_0x46c5('0x3c'),'name_value_list':[{'name':_0x46c5('0x3d'),'value':_0x3cb723!==_0x46c5('0x3e')?_0x3cb723:util[_0x46c5('0x23')](_0x46c5('0x3f'),_0x2b2f28)},{'name':_0x46c5('0x3a'),'value':_0x2b2f28}]})}})[_0x46c5('0x2d')](function(_0x51c788){logger[_0x46c5('0x29')](_0x46c5('0x40'));return BPromise[_0x46c5('0x35')]({'id':_0x51c788['id'],'name':_0x51c788['entry_list']['first_name'][_0x46c5('0x32')],'phone':_0x51c788[_0x46c5('0x2e')][_0x46c5('0x3a')][_0x46c5('0x32')]});});}});}function request(_0x244407){logger[_0x46c5('0x41')](_0x46c5('0x42'),JSON[_0x46c5('0x21')](_0x244407));return rp(_['merge'](def,_0x244407));}function getTags(_0xd4d0fd,_0x4199db){var _0x9db277=[];if(_0xd4d0fd&&_0xd4d0fd['length']>0x0){_0x9db277=_[_0x46c5('0x43')](_0xd4d0fd,_0x4199db);}return _0x9db277;}function getCustomFields(_0x29a252,_0x4e946e){var _0x46af60=[];var _0x2ce23f={'custom_fields':[]};if(_0x29a252[_0x46c5('0x1b')]>0x0){_[_0x46c5('0x1c')](_0x29a252,function(_0x14446d){if(_0x14446d[_0x46c5('0x44')]===_0x46c5('0x45')&&_0x14446d[_0x46c5('0x46')]&&!_0x14446d[_0x46c5('0x47')]){_0x2ce23f[_0x14446d[_0x46c5('0x46')][_0x46c5('0x48')]()]=_0x14446d[_0x46c5('0x49')][_0x46c5('0x26')]();}else if(_0x14446d[_0x46c5('0x44')]===_0x46c5('0x45')&&_0x14446d[_0x46c5('0x1f')]&&_0x14446d['customField']){_0x2ce23f[_0x46c5('0x4a')][_0x46c5('0x1e')]({'id':_0x14446d[_0x46c5('0x1f')],'value':_0x14446d[_0x46c5('0x49')][_0x46c5('0x26')]()});}else if(_0x14446d['type']==='variable'&&_0x14446d['variableName']&&_0x14446d['idField']&&_0x14446d[_0x46c5('0x47')]){_0x4e946e[_0x14446d['variableName']]&&_0x2ce23f[_0x46c5('0x4a')]['push']({'id':_0x14446d['idField'],'value':_0x4e946e[_0x14446d['variableName']]['toString']()});}else if(_0x14446d[_0x46c5('0x44')]==='customVariable'&&_0x14446d['Variable']&&_0x14446d[_0x46c5('0x4b')][_0x46c5('0xf')]&&_0x14446d[_0x46c5('0x1f')]&&_0x14446d[_0x46c5('0x47')]){_0x4e946e[_0x14446d[_0x46c5('0x4b')][_0x46c5('0xf')][_0x46c5('0x48')]()]&&_0x2ce23f[_0x46c5('0x4a')]['push']({'id':_0x14446d['idField'],'value':_0x4e946e[_0x14446d[_0x46c5('0x4b')][_0x46c5('0xf')][_0x46c5('0x48')]()][_0x46c5('0x26')]()});}});}return _0x2ce23f;}function getConnection(_0x34d206){return request({'method':_0x46c5('0xc'),'form':{'method':_0x46c5('0x4c'),'input_type':_0x46c5('0x20'),'response_type':_0x46c5('0x20'),'rest_data':JSON[_0x46c5('0x21')]({'user_auth':{'user_name':_0x34d206[_0x46c5('0x4d')],'password':_0x34d206['password'],'encryption':_0x46c5('0x4e')},'application':_0x46c5('0x4f')})}})[_0x46c5('0x2d')](function(_0x33ab6d){var _0x630573=_0x33ab6d;if(_0x630573['id']){def[_0x46c5('0x50')]=_0x630573['id'];return BPromise['resolve'](_0x630573);}else{throw new Error(util[_0x46c5('0x23')]('Account\x20%d\x20is\x20not\x20valid',_0x34d206['id']));}});}function setRelationship(_0x482cf7,_0x104c53,_0x58ff64,_0x22f552){return request({'form':{'method':'set_relationship','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x46c5('0x21')]({'session':_0x482cf7['id'],'module_name':'Calls','module_id':_0x58ff64['id'],'link_field_name':_0x22f552,'related_ids':[_0x104c53['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x19f8e9,_0x3dc55c,_0x5a3e0c,_0x190b3b,_0x25a88b,_0x1331c0){var _0x5d68c8,_0x38ba03,_0x14b509,_0xee389c;_0x1331c0['remoteUri']=intUtil['stripTrailingSlash'](_0x1331c0['remoteUri']);_0x1331c0['serverUrl']=intUtil['stripTrailingSlash'](_0x1331c0['serverUrl']);def[_0x46c5('0x51')]=util[_0x46c5('0x23')](_0x46c5('0x52'),_0x1331c0[_0x46c5('0x53')]);if(_0x25a88b&&_0x25a88b[_0x46c5('0x54')]){logger['info'](_0x46c5('0x55'),_0x46c5('0x56'));_0x3dc55c[_0x46c5('0x57')]=util[_0x46c5('0x23')](_0x46c5('0x58'),_0x1331c0[_0x46c5('0x59')],_0x3dc55c[_0x46c5('0x5a')],md5(_0x3dc55c[_0x46c5('0x5a')]));}else{_0x3dc55c[_0x46c5('0x57')]='';}return getConnection(_0x1331c0)['then'](function(_0x21bbb5){_0xee389c=_0x21bbb5;return getUser(_0x1331c0,_0x190b3b['name'],_0xee389c);})['then'](function(_0x4aae7d){_0x5d68c8=_0x4aae7d;logger[_0x46c5('0x29')]('The\x20User\x20ID\x20is:',_0x5d68c8['id']);return getEndUser(_0x1331c0,_0x3dc55c['calleridname'],_0x3dc55c[_0x46c5('0x5b')],_0xee389c);})['then'](function(_0x3f1348){_0x38ba03=_0x3f1348;logger[_0x46c5('0x29')](_0x46c5('0x5c'),_0x38ba03['id']);return getTicket(_0x1331c0,_0x5d68c8,_0x38ba03,_0x5a3e0c,_0x3dc55c,_0x5a3e0c[_0x46c5('0x5d')],_0xee389c,_0x46c5('0x5e'));})[_0x46c5('0x2d')](function(_0x2007b8){_0x14b509=_0x2007b8;logger[_0x46c5('0x29')](_0x46c5('0x5f'));logger['info'](_0x46c5('0x60'),_0x14b509['id']);return setRelationship(_0xee389c,_0x5d68c8,_0x14b509,_0x46c5('0x61'));})[_0x46c5('0x2d')](function(){return setRelationship(_0xee389c,_0x38ba03,_0x14b509,_0x46c5('0x62'));})['then'](function(){return getServerInfo(_0xee389c);})['then'](function(_0x40d160){var _0x429dc9=parseInt(_0x40d160[_0x46c5('0x63')]['charAt'](0x0));var _0x205fab=util[_0x46c5('0x23')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x1331c0[_0x46c5('0x53')],_0x14b509['id']);if(_0x429dc9>0x6){_0x205fab=util[_0x46c5('0x23')](_0x46c5('0x64'),_0x1331c0[_0x46c5('0x53')],_0x14b509['id']);}logger[_0x46c5('0x29')](_0x46c5('0x55'),_0x46c5('0x65'));emit(util[_0x46c5('0x23')](_0x46c5('0x66'),_0x190b3b['name']),_0x46c5('0x67'),{'uri':_0x205fab});})['catch'](function(_0x267fb7){logger[_0x46c5('0x68')](_0x46c5('0x55'),JSON[_0x46c5('0x21')](_0x267fb7));});};exports[_0x46c5('0x69')]=function(_0x489e3b,_0x4e8a6d,_0x1e7324,_0x2c1658,_0x1dd1a7,_0x2279e0,_0x444dd1){var _0x16befd,_0x55725b,_0x9cd1d5,_0x2450b4;_0x2279e0[_0x46c5('0x53')]=intUtil[_0x46c5('0x6a')](_0x2279e0[_0x46c5('0x53')]);_0x2279e0[_0x46c5('0x59')]=intUtil['stripTrailingSlash'](_0x2279e0[_0x46c5('0x59')]);def[_0x46c5('0x51')]=util[_0x46c5('0x23')](_0x46c5('0x52'),_0x2279e0['remoteUri']);if(_0x444dd1&&_0x444dd1['recordingFormat']&&_0x444dd1[_0x46c5('0x6b')]!=='none'){logger[_0x46c5('0x29')]('[OUTBOUND]',_0x46c5('0x56'));_0x4e8a6d['recordingURL']=util[_0x46c5('0x23')](_0x46c5('0x58'),_0x2279e0[_0x46c5('0x59')],_0x4e8a6d['uniqueid'],md5(_0x4e8a6d[_0x46c5('0x5a')]));}return getConnection(_0x2279e0)[_0x46c5('0x2d')](function(_0x3aaf6f){_0x2450b4=_0x3aaf6f;return getUser(_0x2279e0,_0x2c1658[_0x46c5('0xf')],_0x2450b4);})['then'](function(_0x2844b1){_0x16befd=_0x2844b1;logger[_0x46c5('0x29')](_0x46c5('0x6c'),_0x16befd['id']);return getEndUser(_0x2279e0,_0x4e8a6d['destcalleridname'],_0x4e8a6d[_0x46c5('0x6d')],_0x2450b4);})[_0x46c5('0x2d')](function(_0x3e5f10){_0x55725b=_0x3e5f10;logger[_0x46c5('0x29')](_0x46c5('0x5c'),_0x55725b['id']);return getTicket(_0x2279e0,_0x16befd,_0x55725b,_0x1e7324,_0x4e8a6d,_0x1e7324[_0x46c5('0x5d')],_0x2450b4,_0x46c5('0x6e'));})[_0x46c5('0x2d')](function(_0x1f1936){_0x9cd1d5=_0x1f1936;logger[_0x46c5('0x29')](_0x46c5('0x5f'));logger[_0x46c5('0x29')](_0x46c5('0x60'),_0x9cd1d5['id']);return setRelationship(_0x2450b4,_0x16befd,_0x9cd1d5,'users');})[_0x46c5('0x2d')](function(){return setRelationship(_0x2450b4,_0x55725b,_0x9cd1d5,_0x46c5('0x62'));})[_0x46c5('0x2d')](function(){return getServerInfo(_0x2450b4);})[_0x46c5('0x2d')](function(_0x4e89c3){var _0x16da6c=parseInt(_0x4e89c3[_0x46c5('0x63')][_0x46c5('0x6f')](0x0));var _0x9781ff=util[_0x46c5('0x23')](_0x46c5('0x70'),_0x2279e0[_0x46c5('0x53')],_0x9cd1d5['id']);if(_0x16da6c>0x6){_0x9781ff=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x2279e0[_0x46c5('0x53')],_0x9cd1d5['id']);}logger['info'](_0x46c5('0x71'),_0x46c5('0x65'));emit(util['format'](_0x46c5('0x66'),_0x2c1658[_0x46c5('0xf')]),'trigger:browser:url',{'uri':_0x9781ff});})['catch'](function(_0x2b74ea){logger[_0x46c5('0x68')]('[OUTBOUND]',JSON[_0x46c5('0x21')](_0x2b74ea));});};exports['unmanaged']=function(_0x5f2ee1,_0x2a7baa,_0x44787c,_0x14c21b,_0x527664,_0x38dc98){var _0x309e36,_0x3589d7,_0x4eb008,_0x2ad57a;_0x38dc98[_0x46c5('0x53')]=intUtil['stripTrailingSlash'](_0x38dc98['remoteUri']);_0x38dc98[_0x46c5('0x59')]=intUtil[_0x46c5('0x6a')](_0x38dc98['serverUrl']);def[_0x46c5('0x51')]=util['format'](_0x46c5('0x52'),_0x38dc98['remoteUri']);if(_0x527664&&_0x527664[_0x46c5('0x54')]){logger[_0x46c5('0x29')]('['+_0x2a7baa[_0x46c5('0x72')][_0x46c5('0x73')]()+']',_0x46c5('0x56'));_0x2a7baa[_0x46c5('0x57')]=util[_0x46c5('0x23')](_0x46c5('0x58'),_0x38dc98[_0x46c5('0x59')],_0x2a7baa['uniqueid'],md5(_0x2a7baa[_0x46c5('0x5a')]));}else{_0x2a7baa['recordingURL']='';}return getConnection(_0x38dc98)[_0x46c5('0x2d')](function(_0x4cc3cb){_0x2ad57a=_0x4cc3cb;if(!_[_0x46c5('0x28')](_0x14c21b)){return getUser(_0x38dc98,_0x14c21b[_0x46c5('0xf')],_0x2ad57a);}else{return getUser(_0x38dc98,null,_0x2ad57a);}})[_0x46c5('0x2d')](function(_0x11a2c6){_0x309e36=_0x11a2c6;logger[_0x46c5('0x29')](_0x46c5('0x6c'),_0x309e36['id']);return getEndUser(_0x38dc98,_0x2a7baa['calleridname'],_0x2a7baa[_0x46c5('0x5b')],_0x2ad57a);})[_0x46c5('0x2d')](function(_0x1e41d1){_0x3589d7=_0x1e41d1;logger[_0x46c5('0x29')](_0x46c5('0x5c'),_0x3589d7['id']);return getTicket(_0x38dc98,_0x309e36,_0x3589d7,_0x44787c,_0x2a7baa,_0x44787c[_0x46c5('0x5d')],_0x2ad57a,_0x46c5('0x5e'));})['then'](function(_0x2aaf3d){_0x4eb008=_0x2aaf3d;logger[_0x46c5('0x29')](_0x46c5('0x5f'));logger[_0x46c5('0x29')](_0x46c5('0x60'),_0x4eb008['id']);return setRelationship(_0x2ad57a,_0x309e36,_0x4eb008,_0x46c5('0x61'));})['then'](function(){return setRelationship(_0x2ad57a,_0x3589d7,_0x4eb008,_0x46c5('0x62'));})[_0x46c5('0x2d')](function(){return getServerInfo(_0x2ad57a);})[_0x46c5('0x74')](function(_0x28804f){logger[_0x46c5('0x68')]('['+_0x2a7baa[_0x46c5('0x72')][_0x46c5('0x73')]()+']',JSON[_0x46c5('0x21')](_0x28804f));});}; \ No newline at end of file +var _0x1c52=['unmanaged','monitor_format','toUpperCase','calleridnum','contacts','lastevent','lodash','request-promise','bluebird','md5','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','POST','emit','info','Creating\x20new\x20ticket...','getString','assigned_user_id','created_by','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','length','variableName','idField','set_entry','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','JSON','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','name','user_name','then','find','entry_list','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','','Caller\x20-\x20%s','first_name','debug','merge','forEach','string','nameField','customField','toLowerCase','content','type','push','variable','custom_fields','customVariable','Variable','login','username','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','uri','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Outbound','version','[OUTBOUND]'];(function(_0x69f6df,_0x57d995){var _0x25f8fe=function(_0x12862b){while(--_0x12862b){_0x69f6df['push'](_0x69f6df['shift']());}};_0x25f8fe(++_0x57d995);}(_0x1c52,0x7c));var _0x21c5=function(_0x4e6b89,_0x5da1a9){_0x4e6b89=_0x4e6b89-0x0;var _0x5842c8=_0x1c52[_0x4e6b89];return _0x5842c8;};'use strict';var _=require(_0x21c5('0x0'));var rp=require(_0x21c5('0x1'));var BPromise=require(_0x21c5('0x2'));var md5=require(_0x21c5('0x3'));var util=require('util');var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x21c5('0x4'));var logger=require(_0x21c5('0x5'))('sugarcrm');config[_0x21c5('0x6')]=_[_0x21c5('0x7')](config[_0x21c5('0x6')],{'host':_0x21c5('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x21c5('0x6')]));var def={'method':_0x21c5('0x9'),'json':!![]};function emit(_0x4c5a4f,_0xd34da2,_0x16e6bf){io['to'](_0x4c5a4f)[_0x21c5('0xa')](_0xd34da2,_0x16e6bf);}function getTicket(_0x27389f,_0x54a640,_0x38a038,_0x1561e8,_0x3e2da5,_0x532b56,_0x378ec7,_0x48ed61){logger[_0x21c5('0xb')](_0x21c5('0xc'));var _0x377983=new Date();var _0x2dc212=[{'name':'name','value':intUtil[_0x21c5('0xd')](_0x1561e8['Subjects'],_0x3e2da5,'\x20')},{'name':_0x21c5('0xe'),'value':_0x54a640['id']},{'name':_0x21c5('0xf'),'value':_0x54a640['id']},{'name':'description','value':intUtil[_0x21c5('0xd')](_0x1561e8['Descriptions'],_0x3e2da5,'\x0a')},{'name':'date_start','value':_0x377983[_0x21c5('0x10')]()[_0x21c5('0x11')](0x0,0x13)[_0x21c5('0x12')]('T','\x20')},{'name':_0x21c5('0x13'),'value':'0'},{'name':_0x21c5('0x14'),'value':'15'},{'name':_0x21c5('0x15'),'value':_0x38a038['id']},{'name':_0x21c5('0x16'),'value':'Contacts'},{'name':_0x21c5('0x17'),'value':_0x38a038['name']},{'name':'direction','value':_0x48ed61}];if(_0x532b56[_0x21c5('0x18')]){_['forEach'](_0x532b56,function(_0x4daf4d){if(_0x3e2da5[_0x4daf4d[_0x21c5('0x19')]]){_0x2dc212['push']({'name':_0x4daf4d[_0x21c5('0x1a')],'value':_0x3e2da5[_0x4daf4d['variableName']]});}});}return request({'form':{'method':_0x21c5('0x1b'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x21c5('0x1c')]({'session':_0x378ec7['id'],'module_name':_0x21c5('0x1d'),'name_value_list':_0x2dc212})}});}function getAuth(_0x2840b7){return util[_0x21c5('0x1e')](_0x21c5('0x1f'),new Buffer(_0x2840b7[_0x21c5('0x20')]+':X')[_0x21c5('0x21')](_0x21c5('0x22')));}function getServerInfo(_0x1905a9){return request({'form':{'method':'get_server_info','input_type':_0x21c5('0x23'),'response_type':_0x21c5('0x23'),'rest_data':JSON[_0x21c5('0x1c')]({'session':_0x1905a9['id']})}});}function getUser(_0x1aa54e,_0x123a7a,_0x4bf186){if(!_[_0x21c5('0x24')](_0x123a7a)){logger[_0x21c5('0xb')](_0x21c5('0x25'),_0x123a7a);return request({'form':{'method':_0x21c5('0x26'),'input_type':_0x21c5('0x23'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x4bf186['id'],'module_name':_0x21c5('0x27'),'query':util[_0x21c5('0x1e')](_0x21c5('0x28'),_0x123a7a),'order_by':'','offset':'0','select_fields':['id',_0x21c5('0x29'),_0x21c5('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x21c5('0x2b')](function(_0x531cf4){if(_0x531cf4['entry_list']['length']){var _0x12ca14=_[_0x21c5('0x2c')](_0x531cf4[_0x21c5('0x2d')],function(_0x3f056f){return _0x3f056f['name_value_list'][_0x21c5('0x2a')][_0x21c5('0x2e')]===_0x123a7a;});if(_0x12ca14){logger[_0x21c5('0xb')](_0x21c5('0x2f'));return BPromise[_0x21c5('0x30')]({'id':_0x12ca14['name_value_list']['id']['value'],'name':_0x12ca14[_0x21c5('0x31')][_0x21c5('0x29')][_0x21c5('0x2e')]});}}logger[_0x21c5('0xb')](_0x21c5('0x32'));return BPromise[_0x21c5('0x30')]({'id':_0x4bf186[_0x21c5('0x31')][_0x21c5('0x33')][_0x21c5('0x2e')],'name':_0x4bf186[_0x21c5('0x31')]['user_name']['value']});});}else{logger[_0x21c5('0xb')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x21c5('0x30')]({'id':_0x4bf186[_0x21c5('0x31')][_0x21c5('0x33')][_0x21c5('0x2e')],'name':_0x4bf186['name_value_list'][_0x21c5('0x2a')]['value']});}}function getEndUser(_0x2feee9,_0x5a3308,_0x41419a,_0x1471f4){logger[_0x21c5('0xb')]('Searching\x20enduser\x20with\x20phone',_0x41419a);return request({'form':{'method':_0x21c5('0x26'),'input_type':'JSON','response_type':_0x21c5('0x23'),'rest_data':JSON[_0x21c5('0x1c')]({'session':_0x1471f4['id'],'module_name':_0x21c5('0x34'),'query':util['format'](_0x21c5('0x35'),_0x41419a),'order_by':'','offset':'0','select_fields':['id','name','phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x21c5('0x2b')](function(_0x42ea7c){if(_0x42ea7c[_0x21c5('0x2d')][_0x21c5('0x18')]){var _0x4a0e5d=_[_0x21c5('0x2c')](_0x42ea7c[_0x21c5('0x2d')],function(_0x23ca5d){return _0x23ca5d[_0x21c5('0x31')][_0x21c5('0x36')][_0x21c5('0x2e')]===_0x41419a;});if(_0x4a0e5d){logger[_0x21c5('0xb')](_0x21c5('0x37'));return BPromise['resolve']({'id':_0x4a0e5d[_0x21c5('0x31')]['id'][_0x21c5('0x2e')],'name':_0x4a0e5d[_0x21c5('0x31')]['name'][_0x21c5('0x2e')],'phone':_0x4a0e5d[_0x21c5('0x31')][_0x21c5('0x36')][_0x21c5('0x2e')]});}}else{logger[_0x21c5('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x21c5('0x1b'),'input_type':_0x21c5('0x23'),'response_type':_0x21c5('0x23'),'rest_data':JSON[_0x21c5('0x1c')]({'session':_0x1471f4['id'],'module_name':_0x21c5('0x34'),'name_value_list':[{'name':'first_name','value':_0x5a3308!==_0x21c5('0x38')?_0x5a3308:util[_0x21c5('0x1e')](_0x21c5('0x39'),_0x41419a)},{'name':_0x21c5('0x36'),'value':_0x41419a}]})}})['then'](function(_0x247bdc){logger[_0x21c5('0xb')]('Enduser\x20created.');return BPromise[_0x21c5('0x30')]({'id':_0x247bdc['id'],'name':_0x247bdc[_0x21c5('0x2d')][_0x21c5('0x3a')]['value'],'phone':_0x247bdc[_0x21c5('0x2d')][_0x21c5('0x36')][_0x21c5('0x2e')]});});}});}function request(_0x56547e){logger[_0x21c5('0x3b')]('[HTTP]',JSON[_0x21c5('0x1c')](_0x56547e));return rp(_[_0x21c5('0x3c')](def,_0x56547e));}function getTags(_0x383893,_0x3e915a){var _0x208d1b=[];if(_0x383893&&_0x383893['length']>0x0){_0x208d1b=_['map'](_0x383893,_0x3e915a);}return _0x208d1b;}function getCustomFields(_0x503ffa,_0x12da6a){var _0x555736=[];var _0x13c281={'custom_fields':[]};if(_0x503ffa[_0x21c5('0x18')]>0x0){_[_0x21c5('0x3d')](_0x503ffa,function(_0x108b7e){if(_0x108b7e['type']===_0x21c5('0x3e')&&_0x108b7e[_0x21c5('0x3f')]&&!_0x108b7e[_0x21c5('0x40')]){_0x13c281[_0x108b7e[_0x21c5('0x3f')][_0x21c5('0x41')]()]=_0x108b7e[_0x21c5('0x42')][_0x21c5('0x21')]();}else if(_0x108b7e[_0x21c5('0x43')]===_0x21c5('0x3e')&&_0x108b7e['idField']&&_0x108b7e[_0x21c5('0x40')]){_0x13c281['custom_fields'][_0x21c5('0x44')]({'id':_0x108b7e[_0x21c5('0x1a')],'value':_0x108b7e[_0x21c5('0x42')][_0x21c5('0x21')]()});}else if(_0x108b7e[_0x21c5('0x43')]===_0x21c5('0x45')&&_0x108b7e[_0x21c5('0x19')]&&_0x108b7e[_0x21c5('0x1a')]&&_0x108b7e[_0x21c5('0x40')]){_0x12da6a[_0x108b7e[_0x21c5('0x19')]]&&_0x13c281[_0x21c5('0x46')][_0x21c5('0x44')]({'id':_0x108b7e['idField'],'value':_0x12da6a[_0x108b7e['variableName']]['toString']()});}else if(_0x108b7e[_0x21c5('0x43')]===_0x21c5('0x47')&&_0x108b7e[_0x21c5('0x48')]&&_0x108b7e['Variable'][_0x21c5('0x29')]&&_0x108b7e[_0x21c5('0x1a')]&&_0x108b7e[_0x21c5('0x40')]){_0x12da6a[_0x108b7e['Variable']['name'][_0x21c5('0x41')]()]&&_0x13c281[_0x21c5('0x46')][_0x21c5('0x44')]({'id':_0x108b7e[_0x21c5('0x1a')],'value':_0x12da6a[_0x108b7e['Variable'][_0x21c5('0x29')][_0x21c5('0x41')]()][_0x21c5('0x21')]()});}});}return _0x13c281;}function getConnection(_0x13528c){return request({'method':'POST','form':{'method':_0x21c5('0x49'),'input_type':_0x21c5('0x23'),'response_type':_0x21c5('0x23'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x13528c[_0x21c5('0x4a')],'password':_0x13528c['password'],'encryption':'PLAIN'},'application':_0x21c5('0x4b')})}})[_0x21c5('0x2b')](function(_0x26007f){var _0x4550dc=_0x26007f;if(_0x4550dc['id']){def[_0x21c5('0x4c')]=_0x4550dc['id'];return BPromise['resolve'](_0x4550dc);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x13528c['id']));}});}function setRelationship(_0x84c5af,_0x106cc6,_0x573a1b,_0x25347e){return request({'form':{'method':_0x21c5('0x4d'),'input_type':_0x21c5('0x23'),'response_type':_0x21c5('0x23'),'rest_data':JSON['stringify']({'session':_0x84c5af['id'],'module_name':_0x21c5('0x1d'),'module_id':_0x573a1b['id'],'link_field_name':_0x25347e,'related_ids':[_0x106cc6['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x21c5('0x4e')]=function(_0x1b467f,_0x8a9485,_0x253781,_0x49cec3,_0x55d6c0,_0x2de46c){var _0x3d7144,_0x100f02,_0xc3fa2,_0x37aa16;_0x2de46c['remoteUri']=intUtil[_0x21c5('0x4f')](_0x2de46c[_0x21c5('0x50')]);_0x2de46c['serverUrl']=intUtil[_0x21c5('0x4f')](_0x2de46c[_0x21c5('0x51')]);def['uri']=util[_0x21c5('0x1e')]('%s/service/v4_1/rest.php',_0x2de46c[_0x21c5('0x50')]);if(_0x55d6c0&&_0x55d6c0['monitor_format']){logger[_0x21c5('0xb')](_0x21c5('0x52'),_0x21c5('0x53'));_0x8a9485[_0x21c5('0x54')]=util[_0x21c5('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2de46c[_0x21c5('0x51')],_0x8a9485['uniqueid'],md5(_0x8a9485[_0x21c5('0x55')]));}else{_0x8a9485['recordingURL']='';}return getConnection(_0x2de46c)[_0x21c5('0x2b')](function(_0x35ee5f){_0x37aa16=_0x35ee5f;return getUser(_0x2de46c,_0x49cec3[_0x21c5('0x29')],_0x37aa16);})[_0x21c5('0x2b')](function(_0x22118f){_0x3d7144=_0x22118f;logger[_0x21c5('0xb')](_0x21c5('0x56'),_0x3d7144['id']);return getEndUser(_0x2de46c,_0x8a9485[_0x21c5('0x57')],_0x8a9485['calleridnum'],_0x37aa16);})[_0x21c5('0x2b')](function(_0x5cf26e){_0x100f02=_0x5cf26e;logger[_0x21c5('0xb')](_0x21c5('0x58'),_0x100f02['id']);return getTicket(_0x2de46c,_0x3d7144,_0x100f02,_0x253781,_0x8a9485,_0x253781[_0x21c5('0x59')],_0x37aa16,_0x21c5('0x5a'));})[_0x21c5('0x2b')](function(_0x57fde0){_0xc3fa2=_0x57fde0;logger['info'](_0x21c5('0x5b'));logger[_0x21c5('0xb')](_0x21c5('0x5c'),_0xc3fa2['id']);return setRelationship(_0x37aa16,_0x3d7144,_0xc3fa2,_0x21c5('0x5d'));})[_0x21c5('0x2b')](function(){return setRelationship(_0x37aa16,_0x100f02,_0xc3fa2,'contacts');})[_0x21c5('0x2b')](function(){return getServerInfo(_0x37aa16);})[_0x21c5('0x2b')](function(_0x4bf7ff){var _0x39949b=parseInt(_0x4bf7ff['version'][_0x21c5('0x5e')](0x0));var _0x2d79e9=util[_0x21c5('0x1e')](_0x21c5('0x5f'),_0x2de46c[_0x21c5('0x50')],_0xc3fa2['id']);if(_0x39949b>0x6){_0x2d79e9=util['format'](_0x21c5('0x60'),_0x2de46c[_0x21c5('0x50')],_0xc3fa2['id']);}logger[_0x21c5('0xb')]('[QUEUE]',_0x21c5('0x61'));emit(util['format'](_0x21c5('0x62'),_0x49cec3['name']),_0x21c5('0x63'),{'uri':_0x2d79e9});})[_0x21c5('0x64')](function(_0x69be3e){logger[_0x21c5('0x65')](_0x21c5('0x52'),JSON['stringify'](_0x69be3e));});};exports[_0x21c5('0x66')]=function(_0x171a51,_0x5a38d8,_0x289844,_0x254d32,_0xd7bf30,_0x5382e9,_0xc2c339){var _0x2a4bc9,_0x1ebc0d,_0x2f549d,_0x1d4498;_0x5382e9['remoteUri']=intUtil[_0x21c5('0x4f')](_0x5382e9[_0x21c5('0x50')]);_0x5382e9['serverUrl']=intUtil[_0x21c5('0x4f')](_0x5382e9[_0x21c5('0x51')]);def[_0x21c5('0x67')]=util[_0x21c5('0x1e')]('%s/service/v4_1/rest.php',_0x5382e9[_0x21c5('0x50')]);if(_0xc2c339&&_0xc2c339[_0x21c5('0x68')]&&_0xc2c339[_0x21c5('0x68')]!==_0x21c5('0x69')){logger['info']('[OUTBOUND]',_0x21c5('0x53'));_0x5a38d8['recordingURL']=util['format'](_0x21c5('0x6a'),_0x5382e9[_0x21c5('0x51')],_0x5a38d8[_0x21c5('0x55')],md5(_0x5a38d8[_0x21c5('0x55')]));}return getConnection(_0x5382e9)['then'](function(_0x181636){_0x1d4498=_0x181636;return getUser(_0x5382e9,_0x254d32['name'],_0x1d4498);})[_0x21c5('0x2b')](function(_0xb605f7){_0x2a4bc9=_0xb605f7;logger[_0x21c5('0xb')](_0x21c5('0x56'),_0x2a4bc9['id']);return getEndUser(_0x5382e9,_0x5a38d8[_0x21c5('0x6b')],_0x5a38d8[_0x21c5('0x6c')],_0x1d4498);})[_0x21c5('0x2b')](function(_0x2906f0){_0x1ebc0d=_0x2906f0;logger[_0x21c5('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1ebc0d['id']);return getTicket(_0x5382e9,_0x2a4bc9,_0x1ebc0d,_0x289844,_0x5a38d8,_0x289844['Fields'],_0x1d4498,_0x21c5('0x6d'));})['then'](function(_0x2ecb29){_0x2f549d=_0x2ecb29;logger['info'](_0x21c5('0x5b'));logger[_0x21c5('0xb')](_0x21c5('0x5c'),_0x2f549d['id']);return setRelationship(_0x1d4498,_0x2a4bc9,_0x2f549d,'users');})['then'](function(){return setRelationship(_0x1d4498,_0x1ebc0d,_0x2f549d,'contacts');})[_0x21c5('0x2b')](function(){return getServerInfo(_0x1d4498);})[_0x21c5('0x2b')](function(_0x317127){var _0x1f4513=parseInt(_0x317127[_0x21c5('0x6e')][_0x21c5('0x5e')](0x0));var _0x562f42=util['format'](_0x21c5('0x5f'),_0x5382e9['remoteUri'],_0x2f549d['id']);if(_0x1f4513>0x6){_0x562f42=util[_0x21c5('0x1e')](_0x21c5('0x60'),_0x5382e9['remoteUri'],_0x2f549d['id']);}logger[_0x21c5('0xb')](_0x21c5('0x6f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x21c5('0x1e')](_0x21c5('0x62'),_0x254d32[_0x21c5('0x29')]),_0x21c5('0x63'),{'uri':_0x562f42});})[_0x21c5('0x64')](function(_0x36257f){logger[_0x21c5('0x65')](_0x21c5('0x6f'),JSON[_0x21c5('0x1c')](_0x36257f));});};exports[_0x21c5('0x70')]=function(_0x50bdea,_0x447a53,_0x2fc046,_0x3cdeda,_0x571bd6,_0x6d2617){var _0x1a3125,_0x2180e6,_0x1cb3c4,_0x6dce8f;_0x6d2617[_0x21c5('0x50')]=intUtil['stripTrailingSlash'](_0x6d2617[_0x21c5('0x50')]);_0x6d2617[_0x21c5('0x51')]=intUtil[_0x21c5('0x4f')](_0x6d2617['serverUrl']);def['uri']=util[_0x21c5('0x1e')]('%s/service/v4_1/rest.php',_0x6d2617['remoteUri']);if(_0x571bd6&&_0x571bd6[_0x21c5('0x71')]){logger[_0x21c5('0xb')]('['+_0x447a53['lastevent'][_0x21c5('0x72')]()+']',_0x21c5('0x53'));_0x447a53[_0x21c5('0x54')]=util[_0x21c5('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x6d2617[_0x21c5('0x51')],_0x447a53[_0x21c5('0x55')],md5(_0x447a53[_0x21c5('0x55')]));}else{_0x447a53[_0x21c5('0x54')]='';}return getConnection(_0x6d2617)['then'](function(_0x2ecf77){_0x6dce8f=_0x2ecf77;if(!_[_0x21c5('0x24')](_0x3cdeda)){return getUser(_0x6d2617,_0x3cdeda['name'],_0x6dce8f);}else{return getUser(_0x6d2617,null,_0x6dce8f);}})[_0x21c5('0x2b')](function(_0x13f77f){_0x1a3125=_0x13f77f;logger['info']('The\x20User\x20ID\x20is:',_0x1a3125['id']);return getEndUser(_0x6d2617,_0x447a53['calleridname'],_0x447a53[_0x21c5('0x73')],_0x6dce8f);})[_0x21c5('0x2b')](function(_0x1be31d){_0x2180e6=_0x1be31d;logger[_0x21c5('0xb')](_0x21c5('0x58'),_0x2180e6['id']);return getTicket(_0x6d2617,_0x1a3125,_0x2180e6,_0x2fc046,_0x447a53,_0x2fc046[_0x21c5('0x59')],_0x6dce8f,_0x21c5('0x5a'));})[_0x21c5('0x2b')](function(_0x297be9){_0x1cb3c4=_0x297be9;logger[_0x21c5('0xb')](_0x21c5('0x5b'));logger[_0x21c5('0xb')](_0x21c5('0x5c'),_0x1cb3c4['id']);return setRelationship(_0x6dce8f,_0x1a3125,_0x1cb3c4,_0x21c5('0x5d'));})[_0x21c5('0x2b')](function(){return setRelationship(_0x6dce8f,_0x2180e6,_0x1cb3c4,_0x21c5('0x74'));})['then'](function(){return getServerInfo(_0x6dce8f);})[_0x21c5('0x64')](function(_0x2d9654){logger[_0x21c5('0x65')]('['+_0x447a53[_0x21c5('0x75')]['toUpperCase']()+']',JSON['stringify'](_0x2d9654));});}; \ 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 e52341d..61ccc7e 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 _0xa9dc=['push','content','type','variable','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','string','key','format','%s:\x20%s','keyContent','customVariable','join','slice','substring','lastIndexOf','validateEmail','isNil','test','length','sortBy'];(function(_0x2e2051,_0x2a998b){var _0x4dd8e6=function(_0x5b4b90){while(--_0x5b4b90){_0x2e2051['push'](_0x2e2051['shift']());}};_0x4dd8e6(++_0x2a998b);}(_0xa9dc,0x136));var _0xca9d=function(_0x591cfd,_0x501204){_0x591cfd=_0x591cfd-0x0;var _0x4d0100=_0xa9dc[_0x591cfd];return _0x4d0100;};'use strict';var _=require('lodash');var util=require('util');exports['getString']=function(_0x16c505,_0x3bf543,_0x1cf5c2){var _0x1d122f=[];if(_0x16c505[_0xca9d('0x0')]>0x0){var _0x58d6bb=_[_0xca9d('0x1')](_0x16c505,['id']);for(var _0xef114e=0x0;_0xef114e<_0x58d6bb[_0xca9d('0x0')];_0xef114e++){var _0xa1755e=_0x58d6bb[_0xef114e];if(_0xa1755e['type']==='string'){_0x1d122f[_0xca9d('0x2')](_0xa1755e[_0xca9d('0x3')]);}else if(_0xa1755e[_0xca9d('0x4')]===_0xca9d('0x5')&&_0xa1755e[_0xca9d('0x6')]){_0x3bf543[_0xa1755e[_0xca9d('0x6')]]&&_0x1d122f[_0xca9d('0x2')](_0x3bf543[_0xa1755e[_0xca9d('0x6')]][_0xca9d('0x7')]());}else if(_0xa1755e[_0xca9d('0x4')]==='customVariable'&&_0xa1755e[_0xca9d('0x8')]&&_0xa1755e[_0xca9d('0x8')]['name']){_0x3bf543[_0xa1755e['Variable'][_0xca9d('0x9')][_0xca9d('0xa')]()]&&_0x1d122f[_0xca9d('0x2')](_0x3bf543[_0xa1755e['Variable'][_0xca9d('0x9')][_0xca9d('0xa')]()][_0xca9d('0x7')]());}else if(_0xa1755e[_0xca9d('0x4')]===_0xca9d('0xb')){if(_0xa1755e[_0xca9d('0xc')]===_0xca9d('0xd')&&_0xa1755e[_0xca9d('0xe')]){_0x1d122f[_0xca9d('0x2')](util[_0xca9d('0xf')](_0xca9d('0x10'),_0xa1755e[_0xca9d('0xe')],_0xa1755e[_0xca9d('0x11')]));}else if(_0xa1755e[_0xca9d('0xc')]===_0xca9d('0x5')&&_0xa1755e['variableName']&&_0xa1755e[_0xca9d('0xe')]){_0x3bf543[_0xa1755e['variableName']]&&_0x1d122f[_0xca9d('0x2')](util[_0xca9d('0xf')](_0xca9d('0x10'),_0xa1755e['key'],_0x3bf543[_0xa1755e[_0xca9d('0x6')]]));}else if(_0xa1755e['keyType']===_0xca9d('0x12')&&_0xa1755e[_0xca9d('0x8')]&&_0xa1755e['Variable'][_0xca9d('0x9')]&&_0xa1755e[_0xca9d('0xe')]){_0x3bf543[_0xa1755e['Variable'][_0xca9d('0x9')][_0xca9d('0xa')]()]&&_0x1d122f[_0xca9d('0x2')](util[_0xca9d('0xf')]('%s:\x20%s',_0xa1755e[_0xca9d('0xe')],_0x3bf543[_0xa1755e['Variable']['name'][_0xca9d('0xa')]()]));}}}}return _0x1d122f[_0xca9d('0x13')](_0x1cf5c2);};exports['stripTrailingSlash']=function(_0x579dd1){var _0x32967e=_0x579dd1[_0xca9d('0x14')](-0x1);if(_0x32967e==='/'){_0x579dd1=_0x579dd1[_0xca9d('0x15')](0x0,_0x579dd1[_0xca9d('0x16')](_0x32967e));}return _0x579dd1;};exports[_0xca9d('0x17')]=function(_0x2294cf){if(!_[_0xca9d('0x18')](_0x2294cf)&&_0x2294cf!==''){var _0x2f08a8=/^(([^<>()\[\]\\.,;:\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 _0x2f08a8[_0xca9d('0x19')](String(_0x2294cf)[_0xca9d('0xa')]());}else{return![];}}; \ No newline at end of file +var _0xe5ae=['variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','%s:\x20%s','format','join','stripTrailingSlash','slice','substring','validateEmail','isNil','test','lodash','util','sortBy','length','string','push','content','type','variable'];(function(_0xe6e1e8,_0xd07451){var _0x2cd649=function(_0x1c2073){while(--_0x1c2073){_0xe6e1e8['push'](_0xe6e1e8['shift']());}};_0x2cd649(++_0xd07451);}(_0xe5ae,0x99));var _0xee5a=function(_0x1e1020,_0xd64a27){_0x1e1020=_0x1e1020-0x0;var _0x464719=_0xe5ae[_0x1e1020];return _0x464719;};'use strict';var _=require(_0xee5a('0x0'));var util=require(_0xee5a('0x1'));exports['getString']=function(_0x81a2b4,_0xa473b4,_0x1cc612){var _0x372e4f=[];if(_0x81a2b4['length']>0x0){var _0x3a8d38=_[_0xee5a('0x2')](_0x81a2b4,['id']);for(var _0x37366b=0x0;_0x37366b<_0x3a8d38[_0xee5a('0x3')];_0x37366b++){var _0x189cd4=_0x3a8d38[_0x37366b];if(_0x189cd4['type']===_0xee5a('0x4')){_0x372e4f[_0xee5a('0x5')](_0x189cd4[_0xee5a('0x6')]);}else if(_0x189cd4[_0xee5a('0x7')]===_0xee5a('0x8')&&_0x189cd4[_0xee5a('0x9')]){_0xa473b4[_0x189cd4[_0xee5a('0x9')]]&&_0x372e4f['push'](_0xa473b4[_0x189cd4['variableName']][_0xee5a('0xa')]());}else if(_0x189cd4[_0xee5a('0x7')]===_0xee5a('0xb')&&_0x189cd4['Variable']&&_0x189cd4[_0xee5a('0xc')][_0xee5a('0xd')]){_0xa473b4[_0x189cd4['Variable'][_0xee5a('0xd')]['toLowerCase']()]&&_0x372e4f['push'](_0xa473b4[_0x189cd4['Variable'][_0xee5a('0xd')][_0xee5a('0xe')]()]['toString']());}else if(_0x189cd4[_0xee5a('0x7')]===_0xee5a('0xf')){if(_0x189cd4[_0xee5a('0x10')]==='string'&&_0x189cd4[_0xee5a('0x11')]){_0x372e4f[_0xee5a('0x5')](util['format'](_0xee5a('0x12'),_0x189cd4[_0xee5a('0x11')],_0x189cd4['keyContent']));}else if(_0x189cd4[_0xee5a('0x10')]===_0xee5a('0x8')&&_0x189cd4['variableName']&&_0x189cd4[_0xee5a('0x11')]){_0xa473b4[_0x189cd4[_0xee5a('0x9')]]&&_0x372e4f[_0xee5a('0x5')](util['format'](_0xee5a('0x12'),_0x189cd4[_0xee5a('0x11')],_0xa473b4[_0x189cd4[_0xee5a('0x9')]]));}else if(_0x189cd4['keyType']===_0xee5a('0xb')&&_0x189cd4[_0xee5a('0xc')]&&_0x189cd4[_0xee5a('0xc')]['name']&&_0x189cd4['key']){_0xa473b4[_0x189cd4[_0xee5a('0xc')][_0xee5a('0xd')]['toLowerCase']()]&&_0x372e4f[_0xee5a('0x5')](util[_0xee5a('0x13')]('%s:\x20%s',_0x189cd4[_0xee5a('0x11')],_0xa473b4[_0x189cd4[_0xee5a('0xc')][_0xee5a('0xd')]['toLowerCase']()]));}}}}return _0x372e4f[_0xee5a('0x14')](_0x1cc612);};exports[_0xee5a('0x15')]=function(_0x273d64){var _0x47b6b4=_0x273d64[_0xee5a('0x16')](-0x1);if(_0x47b6b4==='/'){_0x273d64=_0x273d64[_0xee5a('0x17')](0x0,_0x273d64['lastIndexOf'](_0x47b6b4));}return _0x273d64;};exports[_0xee5a('0x18')]=function(_0x5f0a0d){if(!_[_0xee5a('0x19')](_0x5f0a0d)&&_0x5f0a0d!==''){var _0x28617b=/^(([^<>()\[\]\\.,;:\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 _0x28617b[_0xee5a('0x1a')](String(_0x5f0a0d)[_0xee5a('0xe')]());}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 711c2fe..32a8e85 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 _0xeb3b=['outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Fields','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','../../../../config/environment','vTiger','defaults','redis','localhost','socket.io-emitter','emit','length','forEach','includes','string','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','info','Open','getString','Subjects','Descriptions','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','catch','createTicket','remoteUri','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','[vTiger],\x20%s,\x20%s,\x20%s','getUser','statusCode','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!','POST','Enduser\x20created.','phone','GET','getchallenge','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','monitor_format','[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:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url'];(function(_0x4d4b5d,_0x125422){var _0x43a9c2=function(_0x244967){while(--_0x244967){_0x4d4b5d['push'](_0x4d4b5d['shift']());}};_0x43a9c2(++_0x125422);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x45977c,_0x7eaed0){_0x45977c=_0x45977c-0x0;var _0x399413=_0xeb3b[_0x45977c];return _0x399413;};'use strict';var _=require(_0xbeb3('0x0'));var rp=require(_0xbeb3('0x1'));var BPromise=require(_0xbeb3('0x2'));var md5=require(_0xbeb3('0x3'));var util=require(_0xbeb3('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xbeb3('0x5'));var logger=require('../../../../config/logger')(_0xbeb3('0x6'));config['redis']=_[_0xbeb3('0x7')](config[_0xbeb3('0x8')],{'host':_0xbeb3('0x9'),'port':0x18eb});var io=require(_0xbeb3('0xa'))(new Redis(config[_0xbeb3('0x8')]));function emit(_0x143255,_0x5a6a06,_0x241dbb){io['to'](_0x143255)[_0xbeb3('0xb')](_0x5a6a06,_0x241dbb);}function getCustomFields(_0x2a029e,_0x3b61ac){var _0x443396={};if(_0x2a029e[_0xbeb3('0xc')]>0x0){_[_0xbeb3('0xd')](_0x2a029e,function(_0x567333){if(_[_0xbeb3('0xe')]([_0xbeb3('0xf'),'picklist'],_0x567333[_0xbeb3('0x10')])&&_0x567333[_0xbeb3('0x11')]){_0x443396[_0x567333[_0xbeb3('0x11')]]=_0x567333[_0xbeb3('0x12')][_0xbeb3('0x13')]();}else if(_0x567333[_0xbeb3('0x10')]==='variable'&&_0x567333['variableName']&&_0x567333[_0xbeb3('0x11')]&&_0x3b61ac[_0x567333[_0xbeb3('0x14')]]){_0x443396[_0x567333['idField']]=_0x3b61ac[_0x567333['variableName']][_0xbeb3('0x13')]();}else if(_0x567333[_0xbeb3('0x10')]===_0xbeb3('0x15')&&_0x567333[_0xbeb3('0x16')]&&_0x567333[_0xbeb3('0x16')]['name']&&_0x567333[_0xbeb3('0x11')]&&_0x3b61ac[_0x567333['Variable'][_0xbeb3('0x17')]['toLowerCase']()]){_0x443396[_0x567333['idField']]=_0x3b61ac[_0x567333['Variable'][_0xbeb3('0x17')][_0xbeb3('0x18')]()][_0xbeb3('0x13')]();}});}return _0x443396;}function createTicket(_0x10b15d,_0x5d0689,_0x233a62,_0x821d92,_0xe2cc47,_0x495c0a,_0x4af96f){logger[_0xbeb3('0x19')]('Creating\x20new\x20ticket...');var _0x1d917b=_['merge']({'parent_id':'','assigned_user_id':_0x5d0689['id'],'ticketpriorities':'Normal','ticketstatus':_0xbeb3('0x1a'),'ticket_title':intUtil[_0xbeb3('0x1b')](_0x821d92[_0xbeb3('0x1c')],_0xe2cc47,'\x20'),'description':intUtil['getString'](_0x821d92[_0xbeb3('0x1d')],_0xe2cc47,'\x0a'),'contact_id':_0x233a62['id']},getCustomFields(_0x495c0a,_0xe2cc47));var _0x18ea0f={'method':'POST','uri':util[_0xbeb3('0x1e')](_0xbeb3('0x1f'),_0x10b15d['remoteUri']),'form':{'operation':_0xbeb3('0x20'),'username':_0x10b15d[_0xbeb3('0x21')],'sessionName':_0x4af96f[_0xbeb3('0x22')],'elementType':_0xbeb3('0x23'),'element':JSON[_0xbeb3('0x24')](_0x1d917b)},'json':!![]};return request(_0x18ea0f)[_0xbeb3('0x25')](function(_0x84921a){if(_0x84921a[_0xbeb3('0x26')]){return BPromise[_0xbeb3('0x27')]({'id':_0x84921a['result']['id']});}else{throw new Error(util['format'](_0xbeb3('0x28'),JSON['stringify'](_0x84921a[_0xbeb3('0x29')])));}})[_0xbeb3('0x2a')](function(_0x138adf){var _0x400f65=_0x138adf['statusCode']||0x1f4;logger[_0xbeb3('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xbeb3('0x2b'),_0x400f65,JSON[_0xbeb3('0x24')](_0x138adf));});}function getUser(_0x5bd93d,_0x483198,_0x9b8f13){if(intUtil['validateEmail'](_0x483198)){logger['info']('Getting\x20agent\x20with\x20email',_0x483198);return request({'method':'GET','uri':util[_0xbeb3('0x1e')]('%s/webservice.php',_0x5bd93d[_0xbeb3('0x2c')]),'qs':{'operation':_0xbeb3('0x2d'),'username':_0x5bd93d[_0xbeb3('0x21')],'sessionName':_0x9b8f13[_0xbeb3('0x22')],'query':util[_0xbeb3('0x1e')](_0xbeb3('0x2e'),_0x483198)},'json':!![]})[_0xbeb3('0x25')](function(_0x30fcd4){if(_0x30fcd4[_0xbeb3('0x26')]&&_0x30fcd4[_0xbeb3('0x2f')]['length']){logger[_0xbeb3('0x19')](_0xbeb3('0x30'));return BPromise['resolve']({'id':_0x30fcd4[_0xbeb3('0x2f')][0x0]['id'],'email':_0x30fcd4[_0xbeb3('0x2f')][0x0][_0xbeb3('0x31')],'name':_0x30fcd4[_0xbeb3('0x2f')][0x0]['first_name']+'\x20'+_0x30fcd4[_0xbeb3('0x2f')][_0xbeb3('0x32')]});}else{logger[_0xbeb3('0x19')](_0xbeb3('0x33'));return BPromise[_0xbeb3('0x27')]({'id':_0x9b8f13[_0xbeb3('0x34')],'email':_0x5bd93d[_0xbeb3('0x21')],'name':_0xbeb3('0x35')});}})[_0xbeb3('0x2a')](function(_0x4d0cf3){var _0x106629=_0x4d0cf3['statusCode']||0x1f4;logger[_0xbeb3('0x29')](_0xbeb3('0x36'),_0xbeb3('0x37'),_0x106629,JSON[_0xbeb3('0x24')](_0x4d0cf3));});}else{logger[_0xbeb3('0x19')](_0xbeb3('0x33'));return BPromise[_0xbeb3('0x27')]({'id':_0x9b8f13[_0xbeb3('0x34')],'email':_0x5bd93d['username'],'name':_0xbeb3('0x35')})['catch'](function(_0x59e6df){var _0x547275=_0x59e6df[_0xbeb3('0x38')]||0x1f4;logger[_0xbeb3('0x29')](_0xbeb3('0x36'),_0xbeb3('0x37'),_0x547275,JSON[_0xbeb3('0x24')](_0x59e6df));});}}function getEndUser(_0x40f166,_0x4aefe0,_0x32db2d,_0x40de8d){logger[_0xbeb3('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x32db2d);return request({'method':'GET','uri':util['format'](_0xbeb3('0x1f'),_0x40f166[_0xbeb3('0x2c')]),'qs':{'operation':_0xbeb3('0x2d'),'username':_0x40f166['username'],'sessionName':_0x40de8d[_0xbeb3('0x22')],'query':util['format'](_0xbeb3('0x39'),_0x32db2d,_0x32db2d,_0x32db2d,_0x32db2d,_0x32db2d)},'json':!![]})[_0xbeb3('0x25')](function(_0x12156b){if(_0x12156b[_0xbeb3('0x26')]&&_0x12156b['result']['length']){logger[_0xbeb3('0x19')](_0xbeb3('0x3a'));return BPromise[_0xbeb3('0x27')]({'id':_0x12156b[_0xbeb3('0x2f')][0x0]['id'],'name':_0x12156b[_0xbeb3('0x2f')][0x0][_0xbeb3('0x3b')]+'\x20'+_0x12156b[_0xbeb3('0x2f')][0x0][_0xbeb3('0x3c')],'phone':_0x32db2d});}else{logger['info'](_0xbeb3('0x3d'));return request({'method':_0xbeb3('0x3e'),'uri':util[_0xbeb3('0x1e')](_0xbeb3('0x1f'),_0x40f166[_0xbeb3('0x2c')]),'form':{'operation':_0xbeb3('0x20'),'sessionName':_0x40de8d[_0xbeb3('0x22')],'elementType':'Contacts','element':JSON[_0xbeb3('0x24')]({'lastname':_0x4aefe0,'phone':_0x32db2d,'assigned_user_id':'\x20'})},'json':!![]})[_0xbeb3('0x25')](function(_0x10a356){logger[_0xbeb3('0x19')](_0xbeb3('0x3f'));return BPromise[_0xbeb3('0x27')]({'id':_0x10a356[_0xbeb3('0x2f')]['id'],'name':_0x10a356[_0xbeb3('0x2f')][_0xbeb3('0x3c')],'phone':_0x10a356[_0xbeb3('0x2f')][_0xbeb3('0x40')]});})[_0xbeb3('0x2a')](function(_0x2a229c){var _0x4d14a6=_0x2a229c[_0xbeb3('0x38')]||0x1f4;logger[_0xbeb3('0x29')](_0xbeb3('0x36'),'getEndUser',_0x4d14a6,JSON['stringify'](_0x2a229c));});}});}function getConnection(_0x7985d3){var _0x472adf=_0x7985d3[_0xbeb3('0x21')];var _0xf0fcd6=_0x7985d3['accessKey'];return request({'method':_0xbeb3('0x41'),'uri':util['format']('%s/webservice.php',_0x7985d3[_0xbeb3('0x2c')]),'qs':{'operation':_0xbeb3('0x42'),'username':_0x472adf},'json':!![]})[_0xbeb3('0x25')](function(_0x8eaebd){if(_0x8eaebd['success']){return request({'method':_0xbeb3('0x3e'),'uri':util[_0xbeb3('0x1e')](_0xbeb3('0x1f'),_0x7985d3['remoteUri']),'form':{'operation':_0xbeb3('0x43'),'username':_0x472adf,'accessKey':md5(_0x8eaebd['result']['token']+_0xf0fcd6)},'json':!![]});}})[_0xbeb3('0x25')](function(_0xf8e19d){if(_0xf8e19d[_0xbeb3('0x26')]){return BPromise['resolve'](_0xf8e19d[_0xbeb3('0x2f')]);}else{throw new Error(util[_0xbeb3('0x1e')](_0xbeb3('0x44'),_0x7985d3['id']));}})['catch'](function(_0x2cda0d){var _0x4e74bc=_0x2cda0d[_0xbeb3('0x38')]||0x1f4;logger['error'](_0xbeb3('0x36'),_0xbeb3('0x45'),_0x4e74bc,JSON[_0xbeb3('0x24')](_0x2cda0d));});}function request(_0x3b48e2){logger[_0xbeb3('0x19')](_0xbeb3('0x46'),JSON[_0xbeb3('0x24')](_0x3b48e2));return rp(_0x3b48e2);}exports[_0xbeb3('0x47')]=function(_0x49fded,_0xde022c,_0x2416c0,_0xa852bb,_0x459452,_0x5dd175){var _0x2771e3,_0x17aa74,_0x3f30eb,_0x2c677d;_0x5dd175['remoteUri']=intUtil[_0xbeb3('0x48')](_0x5dd175['remoteUri']);if(_0x459452&&_0x459452[_0xbeb3('0x49')]){logger[_0xbeb3('0x19')](_0xbeb3('0x4a'),'Recording\x20is\x20enabled!');_0xde022c[_0xbeb3('0x4b')]=util[_0xbeb3('0x1e')](_0xbeb3('0x4c'),_0x5dd175[_0xbeb3('0x4d')],_0xde022c[_0xbeb3('0x4e')],md5(_0xde022c[_0xbeb3('0x4e')]));}else{_0xde022c[_0xbeb3('0x4b')]='';}return getConnection(_0x5dd175)[_0xbeb3('0x25')](function(_0x27024e){_0x2c677d=_0x27024e;return getUser(_0x5dd175,_0xa852bb[_0xbeb3('0x4f')],_0x2c677d);})['then'](function(_0x1fcc40){_0x2771e3=_0x1fcc40;logger[_0xbeb3('0x19')](_0xbeb3('0x50'),_0x2771e3['id']);return getEndUser(_0x5dd175,_0xde022c[_0xbeb3('0x51')],_0xde022c[_0xbeb3('0x52')],_0x2c677d);})['then'](function(_0x556550){_0x17aa74=_0x556550;logger[_0xbeb3('0x19')](_0xbeb3('0x53'),_0x17aa74['id']);return createTicket(_0x5dd175,_0x2771e3,_0x17aa74,_0x2416c0,_0xde022c,_0x2416c0['Fields'],_0x2c677d);})[_0xbeb3('0x25')](function(_0x405354){_0x3f30eb=_0x405354;logger[_0xbeb3('0x19')](_0xbeb3('0x54'));logger[_0xbeb3('0x19')](_0xbeb3('0x55'),_0x3f30eb['id']);var _0x15128c=util['format'](_0xbeb3('0x56'),_0x5dd175[_0xbeb3('0x2c')],_[_0xbeb3('0x57')](_0x3f30eb['id'],'x')[0x1]);logger['info'](_0xbeb3('0x4a'),_0xbeb3('0x58'));emit(util['format'](_0xbeb3('0x59'),_0xa852bb[_0xbeb3('0x17')]),_0xbeb3('0x5a'),{'uri':_0x15128c});})[_0xbeb3('0x2a')](function(_0x49f941){logger['error'](_0xbeb3('0x4a'),JSON['stringify'](_0x49f941));});};exports[_0xbeb3('0x5b')]=function(_0x59f2e3,_0x2d36cb,_0x381b28,_0x2ce380,_0x1d9f1a,_0x9d523b,_0x1a53bd){var _0x394406,_0x448fe6,_0xc78a7a,_0x17718a;_0x9d523b[_0xbeb3('0x2c')]=intUtil[_0xbeb3('0x48')](_0x9d523b[_0xbeb3('0x2c')]);_0x9d523b[_0xbeb3('0x4d')]=intUtil[_0xbeb3('0x48')](_0x9d523b[_0xbeb3('0x4d')]);if(_0x1a53bd&&_0x1a53bd[_0xbeb3('0x5c')]&&_0x1a53bd[_0xbeb3('0x5c')]!=='none'){logger[_0xbeb3('0x19')](_0xbeb3('0x5d'),_0xbeb3('0x5e'));_0x2d36cb[_0xbeb3('0x4b')]=util[_0xbeb3('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x9d523b[_0xbeb3('0x4d')],_0x2d36cb['uniqueid'],md5(_0x2d36cb[_0xbeb3('0x4e')]));}return getConnection(_0x9d523b)[_0xbeb3('0x25')](function(_0x2c14d2){_0x17718a=_0x2c14d2;return getUser(_0x9d523b,_0x2ce380[_0xbeb3('0x4f')],_0x17718a);})[_0xbeb3('0x25')](function(_0x394524){_0x394406=_0x394524;logger[_0xbeb3('0x19')](_0xbeb3('0x50'),_0x394406['id']);return getEndUser(_0x9d523b,_0x2d36cb[_0xbeb3('0x5f')],_0x2d36cb[_0xbeb3('0x60')],_0x17718a);})[_0xbeb3('0x25')](function(_0x37a17e){_0x448fe6=_0x37a17e;logger[_0xbeb3('0x19')](_0xbeb3('0x53'),_0x448fe6['id']);return createTicket(_0x9d523b,_0x394406,_0x448fe6,_0x381b28,_0x2d36cb,_0x381b28[_0xbeb3('0x61')],_0x17718a);})[_0xbeb3('0x25')](function(_0x250ada){_0xc78a7a=_0x250ada;logger[_0xbeb3('0x19')](_0xbeb3('0x54'));logger[_0xbeb3('0x19')](_0xbeb3('0x55'),_0xc78a7a['id']);var _0x1dc478=util[_0xbeb3('0x1e')](_0xbeb3('0x56'),_0x9d523b[_0xbeb3('0x2c')],_[_0xbeb3('0x57')](_0xc78a7a['id'],'x')[0x1]);logger[_0xbeb3('0x19')](_0xbeb3('0x5d'),_0xbeb3('0x58'));emit(util[_0xbeb3('0x1e')](_0xbeb3('0x59'),_0x2ce380[_0xbeb3('0x17')]),_0xbeb3('0x5a'),{'uri':_0x1dc478});})[_0xbeb3('0x2a')](function(_0x29865f){logger[_0xbeb3('0x29')]('[OUTBOUND]',JSON[_0xbeb3('0x24')](_0x29865f));});};exports[_0xbeb3('0x62')]=function(_0x519dd9,_0x769a06,_0x1ad47f,_0x3a8eb3,_0x4cc279,_0x5cba9d){var _0x2c2784,_0x32c0ef,_0x30c796,_0xebc0bc;_0x5cba9d[_0xbeb3('0x2c')]=intUtil['stripTrailingSlash'](_0x5cba9d[_0xbeb3('0x2c')]);_0x5cba9d[_0xbeb3('0x4d')]=intUtil[_0xbeb3('0x48')](_0x5cba9d[_0xbeb3('0x4d')]);if(_0x4cc279&&_0x4cc279[_0xbeb3('0x49')]){logger['info']('['+_0x769a06[_0xbeb3('0x63')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x769a06[_0xbeb3('0x4b')]=util['format'](_0xbeb3('0x4c'),_0x5cba9d[_0xbeb3('0x4d')],_0x769a06[_0xbeb3('0x4e')],md5(_0x769a06[_0xbeb3('0x4e')]));}else{_0x769a06[_0xbeb3('0x4b')]='';}return getConnection(_0x5cba9d)[_0xbeb3('0x25')](function(_0x942394){_0xebc0bc=_0x942394;return getUser(_0x5cba9d,'',_0xebc0bc);})['then'](function(_0x28d9ea){_0x2c2784=_0x28d9ea;logger[_0xbeb3('0x19')](_0xbeb3('0x50'),_0x2c2784['id']);return getEndUser(_0x5cba9d,_0x769a06['calleridname'],_0x769a06['calleridnum'],_0xebc0bc);})[_0xbeb3('0x25')](function(_0x48da15){_0x32c0ef=_0x48da15;logger['info']('The\x20Enduser\x20ID\x20is:',_0x32c0ef['id']);return createTicket(_0x5cba9d,_0x2c2784,_0x32c0ef,_0x1ad47f,_0x769a06,_0x1ad47f[_0xbeb3('0x61')],_0xebc0bc);})[_0xbeb3('0x25')](function(_0x9df1c1){_0x30c796=_0x9df1c1;logger[_0xbeb3('0x19')]('Ticket\x20created!');logger['info'](_0xbeb3('0x55'),_0x30c796['id']);})[_0xbeb3('0x2a')](function(_0xa1fe36){logger['error']('['+_0x769a06['lastevent'][_0xbeb3('0x64')]()+']',JSON[_0xbeb3('0x24')](_0xa1fe36));});}; \ No newline at end of file +var _0xddaa=['calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Fields','toUpperCase','lastevent','lodash','bluebird','util','ioredis','./util','../../../../config/logger','vTiger','redis','defaults','localhost','emit','length','forEach','picklist','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','HelpDesk','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','stringify','error','catch','[vTiger],\x20%s,\x20%s,\x20%s','Getting\x20agent\x20with\x20email','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','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;','firstname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','getEndUser','GET','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','calleridname'];(function(_0x17a057,_0x51ef19){var _0x5b34d2=function(_0x3f69f0){while(--_0x3f69f0){_0x17a057['push'](_0x17a057['shift']());}};_0x5b34d2(++_0x51ef19);}(_0xddaa,0xd0));var _0xadda=function(_0xa633ff,_0x1e6ed4){_0xa633ff=_0xa633ff-0x0;var _0x10edb3=_0xddaa[_0xa633ff];return _0x10edb3;};'use strict';var _=require(_0xadda('0x0'));var rp=require('request-promise');var BPromise=require(_0xadda('0x1'));var md5=require('md5');var util=require(_0xadda('0x2'));var Redis=require(_0xadda('0x3'));var intUtil=require(_0xadda('0x4'));var config=require('../../../../config/environment');var logger=require(_0xadda('0x5'))(_0xadda('0x6'));config[_0xadda('0x7')]=_[_0xadda('0x8')](config[_0xadda('0x7')],{'host':_0xadda('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xadda('0x7')]));function emit(_0x3d5277,_0x4056c7,_0x5e2ee9){io['to'](_0x3d5277)[_0xadda('0xa')](_0x4056c7,_0x5e2ee9);}function getCustomFields(_0x6b003e,_0x4a2303){var _0x1d7f14={};if(_0x6b003e[_0xadda('0xb')]>0x0){_[_0xadda('0xc')](_0x6b003e,function(_0x3ed313){if(_['includes'](['string',_0xadda('0xd')],_0x3ed313[_0xadda('0xe')])&&_0x3ed313[_0xadda('0xf')]){_0x1d7f14[_0x3ed313['idField']]=_0x3ed313[_0xadda('0x10')][_0xadda('0x11')]();}else if(_0x3ed313['type']===_0xadda('0x12')&&_0x3ed313[_0xadda('0x13')]&&_0x3ed313[_0xadda('0xf')]&&_0x4a2303[_0x3ed313[_0xadda('0x13')]]){_0x1d7f14[_0x3ed313[_0xadda('0xf')]]=_0x4a2303[_0x3ed313[_0xadda('0x13')]][_0xadda('0x11')]();}else if(_0x3ed313[_0xadda('0xe')]==='customVariable'&&_0x3ed313[_0xadda('0x14')]&&_0x3ed313[_0xadda('0x14')][_0xadda('0x15')]&&_0x3ed313[_0xadda('0xf')]&&_0x4a2303[_0x3ed313['Variable'][_0xadda('0x15')]['toLowerCase']()]){_0x1d7f14[_0x3ed313['idField']]=_0x4a2303[_0x3ed313[_0xadda('0x14')][_0xadda('0x15')][_0xadda('0x16')]()][_0xadda('0x11')]();}});}return _0x1d7f14;}function createTicket(_0x1a0f0b,_0x5033d3,_0x488101,_0x3789b0,_0x1ced27,_0x1d6ca7,_0x464360){logger[_0xadda('0x17')](_0xadda('0x18'));var _0x553e66=_[_0xadda('0x19')]({'parent_id':'','assigned_user_id':_0x5033d3['id'],'ticketpriorities':_0xadda('0x1a'),'ticketstatus':_0xadda('0x1b'),'ticket_title':intUtil[_0xadda('0x1c')](_0x3789b0[_0xadda('0x1d')],_0x1ced27,'\x20'),'description':intUtil[_0xadda('0x1c')](_0x3789b0['Descriptions'],_0x1ced27,'\x0a'),'contact_id':_0x488101['id']},getCustomFields(_0x1d6ca7,_0x1ced27));var _0x4af969={'method':_0xadda('0x1e'),'uri':util[_0xadda('0x1f')](_0xadda('0x20'),_0x1a0f0b[_0xadda('0x21')]),'form':{'operation':_0xadda('0x22'),'username':_0x1a0f0b[_0xadda('0x23')],'sessionName':_0x464360['sessionName'],'elementType':_0xadda('0x24'),'element':JSON['stringify'](_0x553e66)},'json':!![]};return request(_0x4af969)[_0xadda('0x25')](function(_0x292b9e){if(_0x292b9e[_0xadda('0x26')]){return BPromise[_0xadda('0x27')]({'id':_0x292b9e['result']['id']});}else{throw new Error(util['format'](_0xadda('0x28'),JSON[_0xadda('0x29')](_0x292b9e[_0xadda('0x2a')])));}})[_0xadda('0x2b')](function(_0x28d80d){var _0x1b36b4=_0x28d80d['statusCode']||0x1f4;logger[_0xadda('0x2a')](_0xadda('0x2c'),'createTicket',_0x1b36b4,JSON[_0xadda('0x29')](_0x28d80d));});}function getUser(_0x1943dd,_0x422ab7,_0x37d62d){if(intUtil['validateEmail'](_0x422ab7)){logger[_0xadda('0x17')](_0xadda('0x2d'),_0x422ab7);return request({'method':'GET','uri':util[_0xadda('0x1f')](_0xadda('0x20'),_0x1943dd[_0xadda('0x21')]),'qs':{'operation':_0xadda('0x2e'),'username':_0x1943dd[_0xadda('0x23')],'sessionName':_0x37d62d[_0xadda('0x2f')],'query':util[_0xadda('0x1f')](_0xadda('0x30'),_0x422ab7)},'json':!![]})['then'](function(_0x126b7f){if(_0x126b7f[_0xadda('0x26')]&&_0x126b7f[_0xadda('0x31')][_0xadda('0xb')]){logger[_0xadda('0x17')](_0xadda('0x32'));return BPromise[_0xadda('0x27')]({'id':_0x126b7f[_0xadda('0x31')][0x0]['id'],'email':_0x126b7f['result'][0x0]['email1'],'name':_0x126b7f[_0xadda('0x31')][0x0][_0xadda('0x33')]+'\x20'+_0x126b7f[_0xadda('0x31')][_0xadda('0x34')]});}else{logger[_0xadda('0x17')](_0xadda('0x35'));return BPromise[_0xadda('0x27')]({'id':_0x37d62d[_0xadda('0x36')],'email':_0x1943dd[_0xadda('0x23')],'name':_0xadda('0x37')});}})[_0xadda('0x2b')](function(_0x827c11){var _0x2d4953=_0x827c11[_0xadda('0x38')]||0x1f4;logger[_0xadda('0x2a')](_0xadda('0x2c'),_0xadda('0x39'),_0x2d4953,JSON[_0xadda('0x29')](_0x827c11));});}else{logger[_0xadda('0x17')](_0xadda('0x35'));return BPromise[_0xadda('0x27')]({'id':_0x37d62d[_0xadda('0x36')],'email':_0x1943dd[_0xadda('0x23')],'name':_0xadda('0x37')})[_0xadda('0x2b')](function(_0x461d9a){var _0x4ea2c9=_0x461d9a[_0xadda('0x38')]||0x1f4;logger[_0xadda('0x2a')](_0xadda('0x2c'),_0xadda('0x39'),_0x4ea2c9,JSON[_0xadda('0x29')](_0x461d9a));});}}function getEndUser(_0x5677fe,_0xef84ba,_0x3643e3,_0x5c2dfb){logger[_0xadda('0x17')]('Searching\x20end\x20user\x20with\x20phone',_0x3643e3);return request({'method':'GET','uri':util[_0xadda('0x1f')](_0xadda('0x20'),_0x5677fe['remoteUri']),'qs':{'operation':_0xadda('0x2e'),'username':_0x5677fe[_0xadda('0x23')],'sessionName':_0x5c2dfb['sessionName'],'query':util['format'](_0xadda('0x3a'),_0x3643e3,_0x3643e3,_0x3643e3,_0x3643e3,_0x3643e3)},'json':!![]})['then'](function(_0x2bea23){if(_0x2bea23['success']&&_0x2bea23['result'][_0xadda('0xb')]){logger[_0xadda('0x17')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x2bea23[_0xadda('0x31')][0x0]['id'],'name':_0x2bea23[_0xadda('0x31')][0x0][_0xadda('0x3b')]+'\x20'+_0x2bea23['result'][0x0]['lastname'],'phone':_0x3643e3});}else{logger[_0xadda('0x17')](_0xadda('0x3c'));return request({'method':_0xadda('0x1e'),'uri':util[_0xadda('0x1f')](_0xadda('0x20'),_0x5677fe[_0xadda('0x21')]),'form':{'operation':'create','sessionName':_0x5c2dfb[_0xadda('0x2f')],'elementType':'Contacts','element':JSON[_0xadda('0x29')]({'lastname':_0xef84ba,'phone':_0x3643e3,'assigned_user_id':'\x20'})},'json':!![]})[_0xadda('0x25')](function(_0x47b03e){logger[_0xadda('0x17')]('Enduser\x20created.');return BPromise[_0xadda('0x27')]({'id':_0x47b03e[_0xadda('0x31')]['id'],'name':_0x47b03e[_0xadda('0x31')]['lastname'],'phone':_0x47b03e['result']['phone']});})[_0xadda('0x2b')](function(_0x3390f3){var _0xe59321=_0x3390f3['statusCode']||0x1f4;logger[_0xadda('0x2a')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xadda('0x3d'),_0xe59321,JSON['stringify'](_0x3390f3));});}});}function getConnection(_0x3315ec){var _0x35b04c=_0x3315ec[_0xadda('0x23')];var _0x38329e=_0x3315ec['accessKey'];return request({'method':_0xadda('0x3e'),'uri':util[_0xadda('0x1f')](_0xadda('0x20'),_0x3315ec[_0xadda('0x21')]),'qs':{'operation':_0xadda('0x3f'),'username':_0x35b04c},'json':!![]})[_0xadda('0x25')](function(_0x44c9f1){if(_0x44c9f1[_0xadda('0x26')]){return request({'method':_0xadda('0x1e'),'uri':util['format'](_0xadda('0x20'),_0x3315ec[_0xadda('0x21')]),'form':{'operation':'login','username':_0x35b04c,'accessKey':md5(_0x44c9f1['result'][_0xadda('0x40')]+_0x38329e)},'json':!![]});}})[_0xadda('0x25')](function(_0x2569bc){if(_0x2569bc['success']){return BPromise[_0xadda('0x27')](_0x2569bc[_0xadda('0x31')]);}else{throw new Error(util[_0xadda('0x1f')](_0xadda('0x41'),_0x3315ec['id']));}})['catch'](function(_0x48baf9){var _0x1a44e0=_0x48baf9['statusCode']||0x1f4;logger[_0xadda('0x2a')](_0xadda('0x2c'),_0xadda('0x42'),_0x1a44e0,JSON[_0xadda('0x29')](_0x48baf9));});}function request(_0x466c49){logger[_0xadda('0x17')](_0xadda('0x43'),JSON[_0xadda('0x29')](_0x466c49));return rp(_0x466c49);}exports['queue']=function(_0x17b509,_0x37a254,_0x154c02,_0x4cc742,_0x14c7a6,_0x300112){var _0x4f235b,_0x327f1b,_0x42782c,_0x5afc12;_0x300112[_0xadda('0x21')]=intUtil[_0xadda('0x44')](_0x300112['remoteUri']);if(_0x14c7a6&&_0x14c7a6['monitor_format']){logger[_0xadda('0x17')](_0xadda('0x45'),_0xadda('0x46'));_0x37a254[_0xadda('0x47')]=util[_0xadda('0x1f')](_0xadda('0x48'),_0x300112[_0xadda('0x49')],_0x37a254[_0xadda('0x4a')],md5(_0x37a254['uniqueid']));}else{_0x37a254[_0xadda('0x47')]='';}return getConnection(_0x300112)[_0xadda('0x25')](function(_0x2403f2){_0x5afc12=_0x2403f2;return getUser(_0x300112,_0x4cc742[_0xadda('0x4b')],_0x5afc12);})[_0xadda('0x25')](function(_0x316461){_0x4f235b=_0x316461;logger['info']('The\x20User\x20ID\x20is:',_0x4f235b['id']);return getEndUser(_0x300112,_0x37a254[_0xadda('0x4c')],_0x37a254[_0xadda('0x4d')],_0x5afc12);})[_0xadda('0x25')](function(_0x434208){_0x327f1b=_0x434208;logger[_0xadda('0x17')](_0xadda('0x4e'),_0x327f1b['id']);return createTicket(_0x300112,_0x4f235b,_0x327f1b,_0x154c02,_0x37a254,_0x154c02['Fields'],_0x5afc12);})[_0xadda('0x25')](function(_0x2a0ad7){_0x42782c=_0x2a0ad7;logger[_0xadda('0x17')](_0xadda('0x4f'));logger[_0xadda('0x17')](_0xadda('0x50'),_0x42782c['id']);var _0x3f11ba=util[_0xadda('0x1f')](_0xadda('0x51'),_0x300112['remoteUri'],_[_0xadda('0x52')](_0x42782c['id'],'x')[0x1]);logger[_0xadda('0x17')](_0xadda('0x45'),_0xadda('0x53'));emit(util['format'](_0xadda('0x54'),_0x4cc742[_0xadda('0x15')]),_0xadda('0x55'),{'uri':_0x3f11ba});})[_0xadda('0x2b')](function(_0x1d6aeb){logger[_0xadda('0x2a')](_0xadda('0x45'),JSON[_0xadda('0x29')](_0x1d6aeb));});};exports['outbound']=function(_0x301a46,_0xe7dc43,_0x5ebbd9,_0x4f4912,_0x495ea2,_0x1ebe4f,_0x31c623){var _0x2d4dfc,_0x481525,_0x1815b9,_0x50b683;_0x1ebe4f[_0xadda('0x21')]=intUtil['stripTrailingSlash'](_0x1ebe4f['remoteUri']);_0x1ebe4f[_0xadda('0x49')]=intUtil[_0xadda('0x44')](_0x1ebe4f['serverUrl']);if(_0x31c623&&_0x31c623[_0xadda('0x56')]&&_0x31c623[_0xadda('0x56')]!==_0xadda('0x57')){logger[_0xadda('0x17')](_0xadda('0x58'),_0xadda('0x46'));_0xe7dc43['recordingURL']=util['format'](_0xadda('0x48'),_0x1ebe4f['serverUrl'],_0xe7dc43[_0xadda('0x4a')],md5(_0xe7dc43[_0xadda('0x4a')]));}return getConnection(_0x1ebe4f)[_0xadda('0x25')](function(_0x5ebe55){_0x50b683=_0x5ebe55;return getUser(_0x1ebe4f,_0x4f4912[_0xadda('0x4b')],_0x50b683);})[_0xadda('0x25')](function(_0x2351fc){_0x2d4dfc=_0x2351fc;logger[_0xadda('0x17')](_0xadda('0x59'),_0x2d4dfc['id']);return getEndUser(_0x1ebe4f,_0xe7dc43[_0xadda('0x5a')],_0xe7dc43[_0xadda('0x5b')],_0x50b683);})['then'](function(_0x384f8b){_0x481525=_0x384f8b;logger[_0xadda('0x17')](_0xadda('0x4e'),_0x481525['id']);return createTicket(_0x1ebe4f,_0x2d4dfc,_0x481525,_0x5ebbd9,_0xe7dc43,_0x5ebbd9[_0xadda('0x5c')],_0x50b683);})[_0xadda('0x25')](function(_0x18e4ef){_0x1815b9=_0x18e4ef;logger[_0xadda('0x17')](_0xadda('0x4f'));logger[_0xadda('0x17')](_0xadda('0x50'),_0x1815b9['id']);var _0x451253=util[_0xadda('0x1f')](_0xadda('0x51'),_0x1ebe4f[_0xadda('0x21')],_[_0xadda('0x52')](_0x1815b9['id'],'x')[0x1]);logger[_0xadda('0x17')](_0xadda('0x58'),_0xadda('0x53'));emit(util[_0xadda('0x1f')](_0xadda('0x54'),_0x4f4912[_0xadda('0x15')]),_0xadda('0x55'),{'uri':_0x451253});})[_0xadda('0x2b')](function(_0x3cf81c){logger[_0xadda('0x2a')](_0xadda('0x58'),JSON[_0xadda('0x29')](_0x3cf81c));});};exports['unmanaged']=function(_0xbbbdba,_0x239cd5,_0x2f06bb,_0x5b268d,_0x2cc112,_0x426ac4){var _0x1edf9e,_0x1c2ee2,_0x77e2ab,_0x50ef75;_0x426ac4['remoteUri']=intUtil['stripTrailingSlash'](_0x426ac4[_0xadda('0x21')]);_0x426ac4[_0xadda('0x49')]=intUtil['stripTrailingSlash'](_0x426ac4[_0xadda('0x49')]);if(_0x2cc112&&_0x2cc112['monitor_format']){logger['info']('['+_0x239cd5['lastevent'][_0xadda('0x5d')]()+']',_0xadda('0x46'));_0x239cd5['recordingURL']=util[_0xadda('0x1f')](_0xadda('0x48'),_0x426ac4['serverUrl'],_0x239cd5['uniqueid'],md5(_0x239cd5[_0xadda('0x4a')]));}else{_0x239cd5[_0xadda('0x47')]='';}return getConnection(_0x426ac4)[_0xadda('0x25')](function(_0xfb44da){_0x50ef75=_0xfb44da;return getUser(_0x426ac4,'',_0x50ef75);})[_0xadda('0x25')](function(_0x24b020){_0x1edf9e=_0x24b020;logger[_0xadda('0x17')](_0xadda('0x59'),_0x1edf9e['id']);return getEndUser(_0x426ac4,_0x239cd5['calleridname'],_0x239cd5['calleridnum'],_0x50ef75);})[_0xadda('0x25')](function(_0x1367e9){_0x1c2ee2=_0x1367e9;logger['info'](_0xadda('0x4e'),_0x1c2ee2['id']);return createTicket(_0x426ac4,_0x1edf9e,_0x1c2ee2,_0x2f06bb,_0x239cd5,_0x2f06bb[_0xadda('0x5c')],_0x50ef75);})[_0xadda('0x25')](function(_0x44cff0){_0x77e2ab=_0x44cff0;logger[_0xadda('0x17')](_0xadda('0x4f'));logger[_0xadda('0x17')](_0xadda('0x50'),_0x77e2ab['id']);})['catch'](function(_0x50d2f6){logger[_0xadda('0x2a')]('['+_0x239cd5[_0xadda('0x5e')][_0xadda('0x5d')]()+']',JSON[_0xadda('0x29')](_0x50d2f6));});}; \ 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 80e84dc..654d334 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 _0x89ce=['Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','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','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','password','%s:%s','username','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','string','nameField','customField','toLowerCase','content','includes','picklist','type','idField','custom_fields','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','integrationTab','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','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','[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','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','calleridnum','\x20Error\x20running\x20Zendesk\x20integration','inspect','lodash','util','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail'];(function(_0x39475e,_0x4894c1){var _0x1fbaf0=function(_0x26c932){while(--_0x26c932){_0x39475e['push'](_0x39475e['shift']());}};_0x1fbaf0(++_0x4894c1);}(_0x89ce,0x139));var _0xe89c=function(_0x2721e3,_0x58af68){_0x2721e3=_0x2721e3-0x0;var _0x1489cd=_0x89ce[_0x2721e3];return _0x1489cd;};'use strict';var _=require(_0xe89c('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xe89c('0x1'));var Redis=require('ioredis');var intUtil=require(_0xe89c('0x2'));var config=require(_0xe89c('0x3'));var logger=require('../../../../config/logger')('zendesk');config[_0xe89c('0x4')]=_[_0xe89c('0x5')](config[_0xe89c('0x4')],{'host':_0xe89c('0x6'),'port':0x18eb});var io=require(_0xe89c('0x7'))(new Redis(config[_0xe89c('0x4')]));function emit(_0x1d7246,_0x2d5b02,_0x54e057){io['to'](_0x1d7246)[_0xe89c('0x8')](_0x2d5b02,_0x54e057);}var headers={'Content-Type':_0xe89c('0x9'),'Accept':'application/json'};function getTicket(_0x1bd180,_0x4ada3e,_0x3b4c97,_0x544b86,_0x281562){logger[_0xe89c('0xa')](_0xe89c('0xb'));return request({'uri':util[_0xe89c('0xc')](_0xe89c('0xd'),_0x1bd180[_0xe89c('0xe')]),'method':_0xe89c('0xf'),'body':{'ticket':_[_0xe89c('0x10')]({'requester_id':_0x3b4c97['id'],'submitter_id':_0x4ada3e?_0x4ada3e['id']:undefined,'assignee_id':_0x4ada3e?_0x4ada3e['id']:undefined,'tags':getTags(_0x544b86[_0xe89c('0x11')],_0xe89c('0x12')),'subject':intUtil[_0xe89c('0x13')](_0x544b86['Subjects'],_0x281562,'\x20'),'description':intUtil[_0xe89c('0x13')](_0x544b86[_0xe89c('0x14')],_0x281562,'\x0a'),'comment':{'public':![],'body':intUtil[_0xe89c('0x13')](_0x544b86[_0xe89c('0x14')],_0x281562,'\x0a')}},getCustomFields(_0x544b86[_0xe89c('0x15')],_0x281562))}})[_0xe89c('0x16')](function(_0x4be266){logger[_0xe89c('0xa')](_0xe89c('0x17'));return _0x4be266[_0xe89c('0x18')];});}function getUser(_0x139707,_0x1270d7){if(intUtil[_0xe89c('0x19')](_0x1270d7)){logger['info'](_0xe89c('0x1a'),_0x1270d7);return request({'uri':util['format'](_0xe89c('0x1b'),_0x139707['remoteUri']),'qs':{'query':util['format'](_0xe89c('0x1c'),_0x1270d7)}})[_0xe89c('0x16')](function(_0x46bd4e){if(_0x46bd4e[_0xe89c('0x1d')]){logger['info']('Agent\x20found!');return _[_0xe89c('0x1e')](_0x46bd4e[_0xe89c('0x1f')],{'email':_0x1270d7,'role':_0xe89c('0x20')});}else{logger[_0xe89c('0xa')](_0xe89c('0x21'));return request({'uri':util[_0xe89c('0xc')](_0xe89c('0x22'),_0x139707[_0xe89c('0xe')])})[_0xe89c('0x16')](function(_0x2ece87){logger[_0xe89c('0xa')](_0xe89c('0x23'));return _0x2ece87[_0xe89c('0x24')];});}});}else{logger[_0xe89c('0xa')](_0xe89c('0x21'));return request({'uri':util['format']('%s/users/me.json',_0x139707[_0xe89c('0xe')])})['then'](function(_0x29fb18){logger['info']('Admin\x20account\x20selected.');return _0x29fb18[_0xe89c('0x24')];});}}function getEndUser(_0x1c4e7a,_0x1250a5,_0x7ae96d){logger['info'](_0xe89c('0x25'),_0x7ae96d);return request({'uri':util[_0xe89c('0xc')](_0xe89c('0x1b'),_0x1c4e7a[_0xe89c('0xe')]),'qs':{'query':util[_0xe89c('0xc')](_0xe89c('0x26'),_0x7ae96d)}})[_0xe89c('0x16')](function(_0x31cc06){var _0x4c5e4c;if(_0x31cc06[_0xe89c('0x1f')][_0xe89c('0x27')]){_0x31cc06[_0xe89c('0x1f')]=_[_0xe89c('0x28')](_0x31cc06[_0xe89c('0x1f')],{'suspended':![],'role':_0xe89c('0x29')});if(_0x31cc06[_0xe89c('0x1f')]['length']){_0x4c5e4c=_['first'](_0x31cc06[_0xe89c('0x1f')]);}}if(_0x4c5e4c){logger[_0xe89c('0xa')](_0xe89c('0x2a'));return _0x4c5e4c;}else{logger['info'](_0xe89c('0x2b'));return request({'uri':util[_0xe89c('0xc')](_0xe89c('0x2c'),_0x1c4e7a['remoteUri']),'method':_0xe89c('0xf'),'body':{'user':{'role':_0xe89c('0x29'),'name':util[_0xe89c('0xc')]('Caller\x20-\x20%s',_0x1250a5||_0x7ae96d),'phone':_0x7ae96d}}})['then'](function(_0x2211d5){logger[_0xe89c('0xa')](_0xe89c('0x2d'));return _0x2211d5['user'];});}});}function getAuth(_0x2914a8){var _0x108d62;if(_0x2914a8[_0xe89c('0x2e')]===_0xe89c('0x2f')){_0x108d62=util['format'](_0xe89c('0x30'),_0x2914a8[_0xe89c('0x31')],_0x2914a8[_0xe89c('0x2f')]);}else if(_0x2914a8[_0xe89c('0x2e')]==='token'){_0x108d62=util[_0xe89c('0xc')](_0xe89c('0x32'),_0x2914a8[_0xe89c('0x31')],_0x2914a8['token']);}return util[_0xe89c('0xc')](_0xe89c('0x33'),new Buffer(_0x108d62)[_0xe89c('0x34')](_0xe89c('0x35')));}function request(_0x512e2a){logger[_0xe89c('0x36')](_0xe89c('0x37'),JSON[_0xe89c('0x38')](_0x512e2a));return rp(_[_0xe89c('0x5')](_0x512e2a,{'method':_0xe89c('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x3ba8d7,_0x859163){var _0x306aa3=[];if(_0x3ba8d7&&_0x3ba8d7[_0xe89c('0x27')]>0x0){_0x306aa3=_[_0xe89c('0x3a')](_0x3ba8d7,_0x859163);}return _0x306aa3;}function getCustomFields(_0x91cc8b,_0x46c417){var _0x21b97e=[];var _0xdde40={'custom_fields':[]};if(_0x91cc8b['length']>0x0){_['forEach'](_0x91cc8b,function(_0x3f31eb){if(_['includes']([_0xe89c('0x3b'),'picklist'],_0x3f31eb['type'])&&_0x3f31eb[_0xe89c('0x3c')]&&!_0x3f31eb[_0xe89c('0x3d')]){_0xdde40[_0x3f31eb[_0xe89c('0x3c')][_0xe89c('0x3e')]()]=_0x3f31eb[_0xe89c('0x3f')][_0xe89c('0x34')]();}else if(_[_0xe89c('0x40')]([_0xe89c('0x3b'),_0xe89c('0x41')],_0x3f31eb[_0xe89c('0x42')])&&_0x3f31eb[_0xe89c('0x43')]&&_0x3f31eb[_0xe89c('0x3d')]){_0xdde40[_0xe89c('0x44')]['push']({'id':_0x3f31eb[_0xe89c('0x43')],'value':_0x3f31eb[_0xe89c('0x3f')][_0xe89c('0x34')]()});}else if(_0x3f31eb['type']===_0xe89c('0x45')&&_0x3f31eb[_0xe89c('0x46')]&&_0x3f31eb[_0xe89c('0x43')]&&_0x3f31eb[_0xe89c('0x3d')]){_0x46c417[_0x3f31eb[_0xe89c('0x46')]]&&_0xdde40['custom_fields'][_0xe89c('0x47')]({'id':_0x3f31eb['idField'],'value':_0x46c417[_0x3f31eb[_0xe89c('0x46')]][_0xe89c('0x34')]()});}else if(_0x3f31eb[_0xe89c('0x42')]===_0xe89c('0x48')&&_0x3f31eb[_0xe89c('0x49')]&&_0x3f31eb[_0xe89c('0x49')][_0xe89c('0x12')]&&_0x3f31eb[_0xe89c('0x43')]&&_0x3f31eb[_0xe89c('0x3d')]){_0x46c417[_0x3f31eb[_0xe89c('0x49')][_0xe89c('0x12')][_0xe89c('0x3e')]()]&&_0xdde40['custom_fields'][_0xe89c('0x47')]({'id':_0x3f31eb['idField'],'value':_0x46c417[_0x3f31eb[_0xe89c('0x49')]['name']['toLowerCase']()][_0xe89c('0x34')]()});}});}return _0xdde40;}exports[_0xe89c('0x4a')]=function(_0x43d0ea,_0x31b550,_0x1bfa4d,_0x233502,_0x5ecbb0,_0x1fd47c){var _0x186f6b,_0x44a5b7;_0x1fd47c[_0xe89c('0xe')]=intUtil[_0xe89c('0x4b')](_0x1fd47c[_0xe89c('0xe')]);_0x1fd47c[_0xe89c('0x4c')]=intUtil[_0xe89c('0x4b')](_0x1fd47c[_0xe89c('0x4c')]);if(_0x5ecbb0&&_0x5ecbb0[_0xe89c('0x4d')]){logger[_0xe89c('0xa')](_0xe89c('0x4e'),_0xe89c('0x4f'));_0x31b550[_0xe89c('0x50')]=util[_0xe89c('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1fd47c[_0xe89c('0x4c')],_0x31b550[_0xe89c('0x51')],md5(_0x31b550[_0xe89c('0x51')]));}else{_0x31b550[_0xe89c('0x50')]='';}headers[_0xe89c('0x52')]=getAuth(_0x1fd47c);return getUser(_0x1fd47c,_0x233502[_0xe89c('0x53')])['then'](function(_0x502f17){_0x186f6b=_0x502f17;logger[_0xe89c('0xa')](_0xe89c('0x54'),_0x186f6b['id']);return getEndUser(_0x1fd47c,_0x31b550[_0xe89c('0x55')],_0x31b550['calleridnum']);})[_0xe89c('0x16')](function(_0x59498f){_0x44a5b7=_0x59498f;logger[_0xe89c('0xa')](_0xe89c('0x56'),_0x44a5b7['id']);return getTicket(_0x1fd47c,_0x186f6b,_0x44a5b7,_0x1bfa4d,_0x31b550);})[_0xe89c('0x16')](function(_0x3fa13f){if(_0x3fa13f){logger[_0xe89c('0xa')]('The\x20Ticket\x20ID\x20is:',_0x3fa13f['id']);switch(_0x1fd47c[_0xe89c('0x42')]){case _0xe89c('0x57'):logger[_0xe89c('0xa')](_0xe89c('0x4e'),_0xe89c('0x58'));return request({'uri':util[_0xe89c('0xc')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1fd47c[_0xe89c('0xe')],_0x186f6b['id'],_0x3fa13f['id']),'method':_0xe89c('0xf')});case _0xe89c('0x59'):logger['info'](_0xe89c('0x4e'),_0xe89c('0x5a'));emit(util['format'](_0xe89c('0x5b'),_0x233502[_0xe89c('0x12')]),_0xe89c('0x5c'),{'uri':util['format'](_0xe89c('0x5d'),_0x1fd47c[_0xe89c('0xe')][_0xe89c('0x5e')](_0xe89c('0x5f'),''),_0x3fa13f['id'])});break;default:logger[_0xe89c('0x60')](_0xe89c('0x4e'),_0xe89c('0x61'));}}})[_0xe89c('0x62')](function(_0x1437bb){logger[_0xe89c('0x60')](_0xe89c('0x63'),util['inspect'](_0x1437bb,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x556470,_0x50ce77,_0x548ea3,_0x1c72c0,_0x523bb5,_0x4885fd,_0xd2cf3){var _0x27d59b,_0x18dafd;_0x4885fd['remoteUri']=intUtil[_0xe89c('0x4b')](_0x4885fd[_0xe89c('0xe')]);_0x4885fd['serverUrl']=intUtil[_0xe89c('0x4b')](_0x4885fd[_0xe89c('0x4c')]);if(_0xd2cf3&&_0xd2cf3[_0xe89c('0x64')]&&_0xd2cf3[_0xe89c('0x64')]!=='none'){logger[_0xe89c('0xa')](_0xe89c('0x65'),_0xe89c('0x4f'));_0x50ce77[_0xe89c('0x50')]=util[_0xe89c('0xc')](_0xe89c('0x66'),_0x4885fd[_0xe89c('0x4c')],_0x50ce77[_0xe89c('0x51')],md5(_0x50ce77[_0xe89c('0x51')]));}headers[_0xe89c('0x52')]=getAuth(_0x4885fd);return getUser(_0x4885fd,_0x1c72c0['email'])[_0xe89c('0x16')](function(_0x1d6d4d){_0x27d59b=_0x1d6d4d;logger['info']('The\x20User\x20ID\x20is:',_0x27d59b['id']);return getEndUser(_0x4885fd,_0x50ce77['destcalleridname'],_0x50ce77[_0xe89c('0x67')]);})[_0xe89c('0x16')](function(_0x30e534){_0x18dafd=_0x30e534;logger['info']('The\x20Enduser\x20ID\x20is:',_0x18dafd['id']);return getTicket(_0x4885fd,_0x27d59b,_0x18dafd,_0x548ea3,_0x50ce77);})['then'](function(_0x286ab3){if(_0x286ab3){logger[_0xe89c('0xa')](_0xe89c('0x68'),_0x286ab3['id']);switch(_0x4885fd[_0xe89c('0x42')]){case _0xe89c('0x57'):logger[_0xe89c('0xa')](_0xe89c('0x65'),_0xe89c('0x58'));return request({'uri':util['format'](_0xe89c('0x69'),_0x4885fd[_0xe89c('0xe')],_0x27d59b['id'],_0x286ab3['id']),'method':_0xe89c('0xf')});case _0xe89c('0x59'):logger[_0xe89c('0xa')](_0xe89c('0x65'),_0xe89c('0x5a'));emit(util[_0xe89c('0xc')]('user:%s',_0x1c72c0[_0xe89c('0x12')]),'trigger:browser:url',{'uri':util[_0xe89c('0xc')]('%s/agent/tickets/%s',_0x4885fd[_0xe89c('0xe')][_0xe89c('0x5e')](_0xe89c('0x5f'),''),_0x286ab3['id'])});break;default:logger[_0xe89c('0x60')](_0xe89c('0x65'),_0xe89c('0x61'));}}})[_0xe89c('0x62')](function(_0x38a312){logger[_0xe89c('0x60')](_0xe89c('0x6a'),util['inspect'](_0x38a312,{'showHidden':!![],'depth':null}));});};exports[_0xe89c('0x6b')]=function(_0x3eb8c1,_0x20eeff,_0x39077e,_0x6f983d,_0x388604,_0x508e2c){var _0x2bbe3e,_0x149e9c;_0x508e2c[_0xe89c('0xe')]=intUtil['stripTrailingSlash'](_0x508e2c['remoteUri']);_0x508e2c['serverUrl']=intUtil[_0xe89c('0x4b')](_0x508e2c[_0xe89c('0x4c')]);if(_0x388604&&_0x388604[_0xe89c('0x4d')]){logger['info']('['+_0x20eeff[_0xe89c('0x6c')][_0xe89c('0x6d')]()+']',_0xe89c('0x4f'));_0x20eeff[_0xe89c('0x50')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x508e2c['serverUrl'],_0x20eeff[_0xe89c('0x51')],md5(_0x20eeff[_0xe89c('0x51')]));}else{_0x20eeff['recordingURL']='';}headers[_0xe89c('0x52')]=getAuth(_0x508e2c);return getUser(_0x508e2c)['then'](function(_0x10d378){_0x2bbe3e=_0x10d378;logger[_0xe89c('0xa')](_0xe89c('0x54'),_0x2bbe3e['id']);return getEndUser(_0x508e2c,_0x20eeff[_0xe89c('0x55')],_0x20eeff[_0xe89c('0x6e')]);})[_0xe89c('0x16')](function(_0x5ec23c){_0x149e9c=_0x5ec23c;logger['info'](_0xe89c('0x56'),_0x149e9c['id']);return getTicket(_0x508e2c,_0x2bbe3e,_0x149e9c,_0x39077e,_0x20eeff);})[_0xe89c('0x16')](function(_0x162726){if(_0x162726){logger[_0xe89c('0xa')](_0xe89c('0x68'),_0x162726['id']);}})['catch'](function(_0x3430e1){logger['error']('['+_0x20eeff[_0xe89c('0x6c')][_0xe89c('0x6d')]()+']'+_0xe89c('0x6f'),util[_0xe89c('0x70')](_0x3430e1,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x36bc=['[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','/api/v2','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','error','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','toUpperCase','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','zendesk','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','merge','name','Subjects','Descriptions','getString','Fields','then','Ticket\x20created!','ticket','validateEmail','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','end-user','Enduser\x20created.','authType','password','token','%s/token:%s','username','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','nameField','content','idField','customField','custom_fields','type','variable','variableName','push','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl'];(function(_0x18a35d,_0x441952){var _0x3f5592=function(_0x267b25){while(--_0x267b25){_0x18a35d['push'](_0x18a35d['shift']());}};_0x3f5592(++_0x441952);}(_0x36bc,0x109));var _0xc36b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x36bc[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xc36b('0x0'));var rp=require(_0xc36b('0x1'));var md5=require(_0xc36b('0x2'));var util=require('util');var Redis=require(_0xc36b('0x3'));var intUtil=require(_0xc36b('0x4'));var config=require(_0xc36b('0x5'));var logger=require('../../../../config/logger')(_0xc36b('0x6'));config['redis']=_[_0xc36b('0x7')](config[_0xc36b('0x8')],{'host':_0xc36b('0x9'),'port':0x18eb});var io=require(_0xc36b('0xa'))(new Redis(config['redis']));function emit(_0x3ad9e8,_0x2f185c,_0x37679e){io['to'](_0x3ad9e8)[_0xc36b('0xb')](_0x2f185c,_0x37679e);}var headers={'Content-Type':_0xc36b('0xc'),'Accept':_0xc36b('0xc')};function getTicket(_0x8fad17,_0x488f3c,_0x1ea4e7,_0x45903b,_0x51a10e){logger[_0xc36b('0xd')](_0xc36b('0xe'));return request({'uri':util['format'](_0xc36b('0xf'),_0x8fad17[_0xc36b('0x10')]),'method':_0xc36b('0x11'),'body':{'ticket':_[_0xc36b('0x12')]({'requester_id':_0x1ea4e7['id'],'submitter_id':_0x488f3c?_0x488f3c['id']:undefined,'assignee_id':_0x488f3c?_0x488f3c['id']:undefined,'tags':getTags(_0x45903b['Tags'],_0xc36b('0x13')),'subject':intUtil['getString'](_0x45903b[_0xc36b('0x14')],_0x51a10e,'\x20'),'description':intUtil['getString'](_0x45903b[_0xc36b('0x15')],_0x51a10e,'\x0a'),'comment':{'public':![],'body':intUtil[_0xc36b('0x16')](_0x45903b[_0xc36b('0x15')],_0x51a10e,'\x0a')}},getCustomFields(_0x45903b[_0xc36b('0x17')],_0x51a10e))}})[_0xc36b('0x18')](function(_0x218d43){logger[_0xc36b('0xd')](_0xc36b('0x19'));return _0x218d43[_0xc36b('0x1a')];});}function getUser(_0x156438,_0x1e4953){if(intUtil[_0xc36b('0x1b')](_0x1e4953)){logger['info']('Getting\x20agent\x20with\x20email',_0x1e4953);return request({'uri':util[_0xc36b('0x1c')](_0xc36b('0x1d'),_0x156438[_0xc36b('0x10')]),'qs':{'query':util[_0xc36b('0x1c')](_0xc36b('0x1e'),_0x1e4953)}})[_0xc36b('0x18')](function(_0x45fca7){if(_0x45fca7[_0xc36b('0x1f')]){logger[_0xc36b('0xd')](_0xc36b('0x20'));return _['find'](_0x45fca7[_0xc36b('0x21')],{'email':_0x1e4953,'role':'agent'});}else{logger['info'](_0xc36b('0x22'));return request({'uri':util[_0xc36b('0x1c')](_0xc36b('0x23'),_0x156438[_0xc36b('0x10')])})['then'](function(_0x4524b4){logger['info'](_0xc36b('0x24'));return _0x4524b4[_0xc36b('0x25')];});}});}else{logger['info'](_0xc36b('0x22'));return request({'uri':util[_0xc36b('0x1c')](_0xc36b('0x23'),_0x156438[_0xc36b('0x10')])})[_0xc36b('0x18')](function(_0x494171){logger[_0xc36b('0xd')]('Admin\x20account\x20selected.');return _0x494171[_0xc36b('0x25')];});}}function getEndUser(_0x54e727,_0x43ec59,_0x568573){logger[_0xc36b('0xd')](_0xc36b('0x26'),_0x568573);return request({'uri':util['format'](_0xc36b('0x1d'),_0x54e727[_0xc36b('0x10')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x568573)}})['then'](function(_0x10faca){var _0x1d81a8;if(_0x10faca[_0xc36b('0x21')][_0xc36b('0x27')]){_0x10faca[_0xc36b('0x21')]=_[_0xc36b('0x28')](_0x10faca['results'],{'suspended':![],'role':'end-user'});if(_0x10faca[_0xc36b('0x21')][_0xc36b('0x27')]){_0x1d81a8=_[_0xc36b('0x29')](_0x10faca['results']);}}if(_0x1d81a8){logger['info'](_0xc36b('0x2a'));return _0x1d81a8;}else{logger[_0xc36b('0xd')](_0xc36b('0x2b'));return request({'uri':util[_0xc36b('0x1c')]('%s/users.json',_0x54e727[_0xc36b('0x10')]),'method':_0xc36b('0x11'),'body':{'user':{'role':_0xc36b('0x2c'),'name':util[_0xc36b('0x1c')]('Caller\x20-\x20%s',_0x43ec59||_0x568573),'phone':_0x568573}}})[_0xc36b('0x18')](function(_0xa52f05){logger[_0xc36b('0xd')](_0xc36b('0x2d'));return _0xa52f05[_0xc36b('0x25')];});}});}function getAuth(_0x41a350){var _0x4e358a;if(_0x41a350[_0xc36b('0x2e')]===_0xc36b('0x2f')){_0x4e358a=util['format']('%s:%s',_0x41a350['username'],_0x41a350[_0xc36b('0x2f')]);}else if(_0x41a350['authType']===_0xc36b('0x30')){_0x4e358a=util[_0xc36b('0x1c')](_0xc36b('0x31'),_0x41a350[_0xc36b('0x32')],_0x41a350[_0xc36b('0x30')]);}return util[_0xc36b('0x1c')]('Basic\x20%s',new Buffer(_0x4e358a)[_0xc36b('0x33')](_0xc36b('0x34')));}function request(_0x23926f){logger[_0xc36b('0x35')](_0xc36b('0x36'),JSON[_0xc36b('0x37')](_0x23926f));return rp(_[_0xc36b('0x7')](_0x23926f,{'method':_0xc36b('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x56da1c,_0x203b24){var _0x926f13=[];if(_0x56da1c&&_0x56da1c[_0xc36b('0x27')]>0x0){_0x926f13=_[_0xc36b('0x39')](_0x56da1c,_0x203b24);}return _0x926f13;}function getCustomFields(_0x251bad,_0x60b093){var _0x18a841=[];var _0x3d1181={'custom_fields':[]};if(_0x251bad['length']>0x0){_[_0xc36b('0x3a')](_0x251bad,function(_0x4c8ce2){if(_[_0xc36b('0x3b')]([_0xc36b('0x3c'),_0xc36b('0x3d')],_0x4c8ce2['type'])&&_0x4c8ce2[_0xc36b('0x3e')]&&!_0x4c8ce2['customField']){_0x3d1181[_0x4c8ce2[_0xc36b('0x3e')]['toLowerCase']()]=_0x4c8ce2[_0xc36b('0x3f')][_0xc36b('0x33')]();}else if(_[_0xc36b('0x3b')]([_0xc36b('0x3c'),_0xc36b('0x3d')],_0x4c8ce2['type'])&&_0x4c8ce2[_0xc36b('0x40')]&&_0x4c8ce2[_0xc36b('0x41')]){_0x3d1181[_0xc36b('0x42')]['push']({'id':_0x4c8ce2[_0xc36b('0x40')],'value':_0x4c8ce2[_0xc36b('0x3f')][_0xc36b('0x33')]()});}else if(_0x4c8ce2[_0xc36b('0x43')]===_0xc36b('0x44')&&_0x4c8ce2[_0xc36b('0x45')]&&_0x4c8ce2['idField']&&_0x4c8ce2[_0xc36b('0x41')]){_0x60b093[_0x4c8ce2['variableName']]&&_0x3d1181[_0xc36b('0x42')][_0xc36b('0x46')]({'id':_0x4c8ce2[_0xc36b('0x40')],'value':_0x60b093[_0x4c8ce2['variableName']][_0xc36b('0x33')]()});}else if(_0x4c8ce2[_0xc36b('0x43')]===_0xc36b('0x47')&&_0x4c8ce2[_0xc36b('0x48')]&&_0x4c8ce2['Variable'][_0xc36b('0x13')]&&_0x4c8ce2[_0xc36b('0x40')]&&_0x4c8ce2[_0xc36b('0x41')]){_0x60b093[_0x4c8ce2[_0xc36b('0x48')]['name'][_0xc36b('0x49')]()]&&_0x3d1181['custom_fields'][_0xc36b('0x46')]({'id':_0x4c8ce2[_0xc36b('0x40')],'value':_0x60b093[_0x4c8ce2[_0xc36b('0x48')]['name'][_0xc36b('0x49')]()]['toString']()});}});}return _0x3d1181;}exports[_0xc36b('0x4a')]=function(_0x2939e5,_0x180f3f,_0x153bab,_0x57ba7d,_0x1070e7,_0x789f77){var _0x48e5aa,_0x6bcf05;_0x789f77[_0xc36b('0x10')]=intUtil[_0xc36b('0x4b')](_0x789f77[_0xc36b('0x10')]);_0x789f77[_0xc36b('0x4c')]=intUtil[_0xc36b('0x4b')](_0x789f77[_0xc36b('0x4c')]);if(_0x1070e7&&_0x1070e7['monitor_format']){logger[_0xc36b('0xd')](_0xc36b('0x4d'),_0xc36b('0x4e'));_0x180f3f[_0xc36b('0x4f')]=util[_0xc36b('0x1c')](_0xc36b('0x50'),_0x789f77[_0xc36b('0x4c')],_0x180f3f['uniqueid'],md5(_0x180f3f[_0xc36b('0x51')]));}else{_0x180f3f[_0xc36b('0x4f')]='';}headers[_0xc36b('0x52')]=getAuth(_0x789f77);return getUser(_0x789f77,_0x57ba7d[_0xc36b('0x53')])[_0xc36b('0x18')](function(_0x23c168){_0x48e5aa=_0x23c168;logger[_0xc36b('0xd')]('The\x20User\x20ID\x20is:',_0x48e5aa['id']);return getEndUser(_0x789f77,_0x180f3f[_0xc36b('0x54')],_0x180f3f[_0xc36b('0x55')]);})[_0xc36b('0x18')](function(_0x3241e4){_0x6bcf05=_0x3241e4;logger['info'](_0xc36b('0x56'),_0x6bcf05['id']);return getTicket(_0x789f77,_0x48e5aa,_0x6bcf05,_0x153bab,_0x180f3f);})[_0xc36b('0x18')](function(_0x48fe28){if(_0x48fe28){logger['info'](_0xc36b('0x57'),_0x48fe28['id']);switch(_0x789f77['type']){case _0xc36b('0x58'):logger[_0xc36b('0xd')](_0xc36b('0x4d'),_0xc36b('0x59'));return request({'uri':util[_0xc36b('0x1c')](_0xc36b('0x5a'),_0x789f77['remoteUri'],_0x48e5aa['id'],_0x48fe28['id']),'method':_0xc36b('0x11')});case _0xc36b('0x5b'):logger[_0xc36b('0xd')](_0xc36b('0x4d'),_0xc36b('0x5c'));emit(util[_0xc36b('0x1c')](_0xc36b('0x5d'),_0x57ba7d['name']),_0xc36b('0x5e'),{'uri':util['format']('%s/agent/tickets/%s',_0x789f77[_0xc36b('0x10')][_0xc36b('0x5f')](_0xc36b('0x60'),''),_0x48fe28['id'])});break;default:logger['error']('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xc36b('0x61')](function(_0x45fd7b){logger['error'](_0xc36b('0x62'),util[_0xc36b('0x63')](_0x45fd7b,{'showHidden':!![],'depth':null}));});};exports[_0xc36b('0x64')]=function(_0x1868ca,_0x34847e,_0x535417,_0x43e153,_0x5b39df,_0x179946,_0x4dd656){var _0x4a833e,_0x533f54;_0x179946[_0xc36b('0x10')]=intUtil[_0xc36b('0x4b')](_0x179946[_0xc36b('0x10')]);_0x179946[_0xc36b('0x4c')]=intUtil['stripTrailingSlash'](_0x179946[_0xc36b('0x4c')]);if(_0x4dd656&&_0x4dd656[_0xc36b('0x65')]&&_0x4dd656[_0xc36b('0x65')]!==_0xc36b('0x66')){logger[_0xc36b('0xd')](_0xc36b('0x67'),_0xc36b('0x4e'));_0x34847e[_0xc36b('0x4f')]=util[_0xc36b('0x1c')](_0xc36b('0x50'),_0x179946[_0xc36b('0x4c')],_0x34847e[_0xc36b('0x51')],md5(_0x34847e['uniqueid']));}headers[_0xc36b('0x52')]=getAuth(_0x179946);return getUser(_0x179946,_0x43e153[_0xc36b('0x53')])[_0xc36b('0x18')](function(_0x8b1a37){_0x4a833e=_0x8b1a37;logger[_0xc36b('0xd')](_0xc36b('0x68'),_0x4a833e['id']);return getEndUser(_0x179946,_0x34847e[_0xc36b('0x69')],_0x34847e[_0xc36b('0x6a')]);})['then'](function(_0x4e656b){_0x533f54=_0x4e656b;logger[_0xc36b('0xd')](_0xc36b('0x56'),_0x533f54['id']);return getTicket(_0x179946,_0x4a833e,_0x533f54,_0x535417,_0x34847e);})[_0xc36b('0x18')](function(_0x4c7b78){if(_0x4c7b78){logger[_0xc36b('0xd')]('The\x20Ticket\x20ID\x20is:',_0x4c7b78['id']);switch(_0x179946[_0xc36b('0x43')]){case _0xc36b('0x58'):logger[_0xc36b('0xd')](_0xc36b('0x67'),_0xc36b('0x59'));return request({'uri':util[_0xc36b('0x1c')](_0xc36b('0x5a'),_0x179946['remoteUri'],_0x4a833e['id'],_0x4c7b78['id']),'method':'POST'});case'newTab':logger['info'](_0xc36b('0x67'),_0xc36b('0x5c'));emit(util[_0xc36b('0x1c')](_0xc36b('0x5d'),_0x43e153['name']),'trigger:browser:url',{'uri':util[_0xc36b('0x1c')]('%s/agent/tickets/%s',_0x179946[_0xc36b('0x10')][_0xc36b('0x5f')]('/api/v2',''),_0x4c7b78['id'])});break;default:logger[_0xc36b('0x6b')](_0xc36b('0x67'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x5d1b1a){logger[_0xc36b('0x6b')](_0xc36b('0x6c'),util[_0xc36b('0x63')](_0x5d1b1a,{'showHidden':!![],'depth':null}));});};exports[_0xc36b('0x6d')]=function(_0x565d4b,_0x3ff62f,_0x4e3163,_0x4de908,_0x39f6fd,_0x324356){var _0x323b91,_0x442322;_0x324356[_0xc36b('0x10')]=intUtil[_0xc36b('0x4b')](_0x324356[_0xc36b('0x10')]);_0x324356[_0xc36b('0x4c')]=intUtil[_0xc36b('0x4b')](_0x324356[_0xc36b('0x4c')]);if(_0x39f6fd&&_0x39f6fd[_0xc36b('0x6e')]){logger[_0xc36b('0xd')]('['+_0x3ff62f['lastevent'][_0xc36b('0x6f')]()+']',_0xc36b('0x4e'));_0x3ff62f[_0xc36b('0x4f')]=util[_0xc36b('0x1c')](_0xc36b('0x50'),_0x324356[_0xc36b('0x4c')],_0x3ff62f['uniqueid'],md5(_0x3ff62f[_0xc36b('0x51')]));}else{_0x3ff62f[_0xc36b('0x4f')]='';}headers[_0xc36b('0x52')]=getAuth(_0x324356);return getUser(_0x324356)[_0xc36b('0x18')](function(_0x34e83e){_0x323b91=_0x34e83e;logger['info'](_0xc36b('0x68'),_0x323b91['id']);return getEndUser(_0x324356,_0x3ff62f[_0xc36b('0x54')],_0x3ff62f[_0xc36b('0x55')]);})[_0xc36b('0x18')](function(_0x4a3831){_0x442322=_0x4a3831;logger['info']('The\x20Enduser\x20ID\x20is:',_0x442322['id']);return getTicket(_0x324356,_0x323b91,_0x442322,_0x4e3163,_0x3ff62f);})[_0xc36b('0x18')](function(_0x33ad11){if(_0x33ad11){logger[_0xc36b('0xd')]('The\x20Ticket\x20ID\x20is:',_0x33ad11['id']);}})[_0xc36b('0x61')](function(_0x38fd88){logger[_0xc36b('0x6b')]('['+_0x3ff62f[_0xc36b('0x70')][_0xc36b('0x6f')]()+']'+_0xc36b('0x71'),util[_0xc36b('0x63')](_0x38fd88,{'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 fbdba5d..a741418 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 _0x6f7a=['type','variableName','Variable','name','toLowerCase','indexOf','split','isNil','expires_in','access_token','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','refreshToken','clientSecret','refresh_token','then','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','user','Administrator','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','catch','data','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','enduserType','log','CREATE\x20ERROR','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','lead','Leads','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','Description','getString','Who_Id','First_Name','Last_Name','Full_Name','$se_module','Call_Duration','talktime','mm:ss','answertime','utc','endtime','diff','YYYY-MM-DDTHH:mm:ss','lastevent','Call_Result','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','Call\x20created!','details','err','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridname','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','zoho.eu','destcalleridname','destcalleridnum','[OUTBOUND]','unmanaged','monitor_format','toUpperCase','calleridnum','lodash','request-promise','md5','util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','length','includes','string','picklist','idField','content','toString'];(function(_0x537e0e,_0x5b1ff6){var _0x34166d=function(_0x5edacb){while(--_0x5edacb){_0x537e0e['push'](_0x537e0e['shift']());}};_0x34166d(++_0x5b1ff6);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0xcc11cd,_0x1a1f78){_0xcc11cd=_0xcc11cd-0x0;var _0x1545af=_0x6f7a[_0xcc11cd];return _0x1545af;};'use strict';var _=require(_0xa6f7('0x0'));var rp=require(_0xa6f7('0x1'));var md5=require(_0xa6f7('0x2'));var util=require(_0xa6f7('0x3'));var intUtil=require('./util');var moment=require(_0xa6f7('0x4'));var Redis=require(_0xa6f7('0x5'));var BPromise=require(_0xa6f7('0x6'));var config=require(_0xa6f7('0x7'));var logger=require(_0xa6f7('0x8'))(_0xa6f7('0x9'));config[_0xa6f7('0xa')]=_[_0xa6f7('0xb')](config[_0xa6f7('0xa')],{'host':_0xa6f7('0xc'),'port':0x18eb});var io=require(_0xa6f7('0xd'))(new Redis(config['redis']));function emit(_0x4b4f9e,_0x30f2a7,_0x2674c9){io['to'](_0x4b4f9e)[_0xa6f7('0xe')](_0x30f2a7,_0x2674c9);}function request(_0x362404){logger[_0xa6f7('0xf')]('[HTTP]',JSON['stringify'](_0x362404));return rp(_0x362404);}function getCustomFields(_0x2fd1d0,_0x225da4){var _0x4e30bc={};if(_0x2fd1d0[_0xa6f7('0x10')]>0x0){_['forEach'](_0x2fd1d0,function(_0x315096){if(_[_0xa6f7('0x11')]([_0xa6f7('0x12'),_0xa6f7('0x13')],_0x315096['type'])&&_0x315096[_0xa6f7('0x14')]){_0x4e30bc[_0x315096['idField']]=_0x315096[_0xa6f7('0x15')][_0xa6f7('0x16')]();}else if(_0x315096[_0xa6f7('0x17')]==='variable'&&_0x315096[_0xa6f7('0x18')]&&_0x315096['idField']&&_0x225da4[_0x315096[_0xa6f7('0x18')]]){_0x4e30bc[_0x315096['idField']]=_0x225da4[_0x315096[_0xa6f7('0x18')]][_0xa6f7('0x16')]();}else if(_0x315096[_0xa6f7('0x17')]==='customVariable'&&_0x315096[_0xa6f7('0x19')]&&_0x315096[_0xa6f7('0x19')][_0xa6f7('0x1a')]&&_0x315096[_0xa6f7('0x14')]&&_0x225da4[_0x315096['Variable']['name'][_0xa6f7('0x1b')]()]){_0x4e30bc[_0x315096['idField']]=_0x225da4[_0x315096[_0xa6f7('0x19')][_0xa6f7('0x1a')]['toLowerCase']()][_0xa6f7('0x16')]();}});}return _0x4e30bc;}function getName(_0xb2cfaa){if(_0xb2cfaa[_0xa6f7('0x1c')]('\x20')>0x0){var _0x35891a=_0xb2cfaa[_0xa6f7('0x1d')](/ (.+)/);if(_0x35891a[0x1]){return _0x35891a;}}return[_0xb2cfaa,_0xb2cfaa];}var accountsTokens={};function getAccessToken(_0x1aa8dc){return new Promise(function(_0x4887ad,_0x3c0c55){if(!_[_0xa6f7('0x1e')](accountsTokens[_0x1aa8dc['id']])&&!_['isNil'](accountsTokens[_0x1aa8dc['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x1aa8dc['id']][_0xa6f7('0x1f')])){_0x4887ad(accountsTokens[_0x1aa8dc['id']][_0xa6f7('0x20')]);}}var _0x566b63;switch(_0x1aa8dc['zone']){case'US':_0x566b63='https://accounts.zoho.com';break;case'AU':_0x566b63=_0xa6f7('0x21');break;case'EU':_0x566b63=_0xa6f7('0x22');break;case'IN':_0x566b63=_0xa6f7('0x23');break;case'CN':_0x566b63='https://accounts.zoho.com.cn';break;default:_0x566b63='https://accounts.zoho.eu';break;}var _0x2f4907={'method':'POST','uri':_0x566b63+'/oauth/v2/token','qs':{'refresh_token':_0x1aa8dc[_0xa6f7('0x24')],'client_id':_0x1aa8dc['clientId'],'client_secret':_0x1aa8dc[_0xa6f7('0x25')],'grant_type':_0xa6f7('0x26')},'json':!![]};return rp(_0x2f4907)[_0xa6f7('0x27')](function(_0x2b4c6c){accountsTokens[_0x1aa8dc['id']]={'access_token':_0x2b4c6c[_0xa6f7('0x20')],'expires_in':moment()['add'](_0x2b4c6c['expires_in'],_0xa6f7('0x28'))};_0x4887ad(_0x2b4c6c[_0xa6f7('0x20')]);})['catch'](function(_0x267917){logger[_0xa6f7('0x29')](_0xa6f7('0x2a'),_0x267917[_0xa6f7('0x2b')]);_0x3c0c55(_0x267917);});});}function getUser(_0x224f5a,_0x10bf77,_0x353de8,_0x54f72c){logger[_0xa6f7('0x2c')](_0xa6f7('0x2d'));return request({'method':_0xa6f7('0x2e'),'uri':util[_0xa6f7('0x2f')]('https://www.zohoapis.%s/crm/v2/users',_0x10bf77),'qs':{'type':_0xa6f7('0x30')},'headers':{'Authorization':_0xa6f7('0x31')+_0x224f5a},'json':!![]})['then'](function(_0xd6304f){if(_0xd6304f[_0xa6f7('0x32')]){var _0x4d79d8=-0x1;if(_['isArrayLikeObject'](_0xd6304f[_0xa6f7('0x32')])){if(!_[_0xa6f7('0x1e')](_0x54f72c)){_0x4d79d8=_[_0xa6f7('0x33')](_0xd6304f[_0xa6f7('0x32')],function(_0x1e25e0){return _0x1e25e0['email']===_0x54f72c;});}if(_0x4d79d8>=0x0){logger['info'](_0xa6f7('0x34'));}else{logger['info'](_0xa6f7('0x35'));_0x4d79d8=_[_0xa6f7('0x33')](_0xd6304f[_0xa6f7('0x32')],function(_0x237e5d){return _0x237e5d[_0xa6f7('0x36')][_0xa6f7('0x1a')]==='Administrator';});}return _0xd6304f[_0xa6f7('0x32')][_0x4d79d8];}else{if(_0xd6304f[_0xa6f7('0x37')][_0xa6f7('0x36')]['name']===_0xa6f7('0x38')){logger['info'](_0xa6f7('0x35'));user=_0xd6304f[_0xa6f7('0x37')];return user;}else{logger[_0xa6f7('0x29')]('The\x20failing\x20result\x20is',JSON[_0xa6f7('0x39')](_0xd6304f));throw new Error(_0xa6f7('0x3a')+JSON[_0xa6f7('0x39')](_0xd6304f));}}}else{logger[_0xa6f7('0x29')](_0xa6f7('0x3b'),JSON[_0xa6f7('0x39')](_0xd6304f));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xa6f7('0x39')](_0xd6304f));}})[_0xa6f7('0x3c')](function(_0xc25a1b){console[_0xa6f7('0x29')](_0xc25a1b);});}function getZohoUser(_0x18d18c,_0x56a773){return new BPromise(function(_0x45acdd,_0x12d966){request(_0x18d18c)['then'](function(_0x1b5213){var _0x33bbd9=null;if(_0x1b5213){_0x33bbd9=_0x1b5213[_0xa6f7('0x3d')][0x0];_0x33bbd9['enduserType']=_0x56a773;}_0x45acdd(_0x33bbd9);})[_0xa6f7('0x3c')](function(_0x36330b){_0x12d966(_0x36330b);});});}function createEndUser(_0x589d94,_0x39349a,_0x13c7c4,_0x3ecb88,_0x14d532,_0x40aaf5){var _0x13c7c4=getName(_0x13c7c4);return request({'method':_0xa6f7('0x3e'),'uri':_0xa6f7('0x3f')+_0x39349a+_0xa6f7('0x40')+_[_0xa6f7('0x41')](_0x40aaf5[_0xa6f7('0x42')])+'s','body':{'data':[{'Last_Name':_0x13c7c4[0x1],'First_Name':_0x13c7c4[0x0],'Phone':_0x3ecb88,'Owner':{'name':!_[_0xa6f7('0x1e')](_0x14d532[_0xa6f7('0x43')][_0xa6f7('0x1a')])?_0x14d532['role']['name']:!_[_0xa6f7('0x1e')](_0x14d532[_0xa6f7('0x44')])?_0x14d532[_0xa6f7('0x44')]+'\x20'+_0x14d532[_0xa6f7('0x45')]:_0x14d532[_0xa6f7('0x45')],'id':_0x14d532['id']}}]},'headers':{'Authorization':_0xa6f7('0x31')+_0x589d94},'json':!![]})[_0xa6f7('0x27')](function(_0x404552){if(_0x404552&&_0x404552[_0xa6f7('0x3d')][0x0][_0xa6f7('0x46')]==='SUCCESS'){var _0x41917c=_0x404552[_0xa6f7('0x3d')][0x0]['details'];_0x41917c[_0xa6f7('0x47')]=_[_0xa6f7('0x41')](_0x40aaf5[_0xa6f7('0x42')])+'s';return _0x41917c;}logger[_0xa6f7('0x29')]('The\x20failing\x20result\x20is',JSON[_0xa6f7('0x39')](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0xa6f7('0x3c')](function(_0x1ea7e1){console[_0xa6f7('0x48')](_0xa6f7('0x49'),_0x1ea7e1);});}function getEndUser(_0x386200,_0x1313dc,_0x979a33,_0x5a9e9e,_0x17d934,_0x40dbe6,_0x55cb70){var _0x2026a9={'method':_0xa6f7('0x2e'),'uri':'','headers':{'Authorization':_0xa6f7('0x31')+_0x386200},'json':!![]};switch(_0x55cb70['moduleSearch']){case _0xa6f7('0x4a'):_0x2026a9['uri']=_0xa6f7('0x3f')+_0x1313dc+_0xa6f7('0x4b')+_0x17d934+'))';return getZohoUser(_0x2026a9,_0xa6f7('0x4c'))['then'](function(_0x5df564){if(_0x5df564)return _0x5df564;_0x2026a9[_0xa6f7('0x4d')]='https://www.zohoapis.'+_0x1313dc+_0xa6f7('0x4e')+_0x17d934+'))';return getZohoUser(_0x2026a9,'Leads')['then'](function(_0x1e7089){if(_0x1e7089)return _0x1e7089;if(_0x55cb70[_0xa6f7('0x42')]!=_0xa6f7('0x4f')){return createEndUser(_0x386200,_0x1313dc,_0x5a9e9e,_0x17d934,_0x40dbe6,_0x55cb70);}else{return{};}});});break;case _0xa6f7('0x50'):_0x2026a9[_0xa6f7('0x4d')]=_0xa6f7('0x3f')+_0x1313dc+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x17d934+'))';return getZohoUser(_0x2026a9,_0xa6f7('0x4c'))[_0xa6f7('0x27')](function(_0x58080f){if(_0x58080f)return _0x58080f;if(_0x55cb70[_0xa6f7('0x42')]!='nothing'){return createEndUser(_0x386200,_0x1313dc,_0x5a9e9e,_0x17d934,_0x40dbe6,_0x55cb70);}else{return{};}});break;case _0xa6f7('0x51'):_0x2026a9['uri']='https://www.zohoapis.'+_0x1313dc+_0xa6f7('0x4e')+_0x17d934+'))';return getZohoUser(_0x2026a9,_0xa6f7('0x52'))[_0xa6f7('0x27')](function(_0x2b3de2){if(_0x2b3de2)return _0x2b3de2;if(_0x55cb70[_0xa6f7('0x42')]!='nothing'){return createEndUser(_0x386200,_0x1313dc,_0x5a9e9e,_0x17d934,_0x40dbe6,_0x55cb70);}else{return{};}});break;}}function getCall(_0x340d3f,_0x34de29,_0x5cddc9,_0x4b83f6,_0x5991f9,_0x1d7bcd,_0x1c2099,_0x134dd7){logger['info'](_0xa6f7('0x53'));var _0x5dab05={};_0x5dab05[_0xa6f7('0x54')]={'name':!_[_0xa6f7('0x1e')](_0x4b83f6[_0xa6f7('0x43')][_0xa6f7('0x1a')])&&!_[_0xa6f7('0x1e')](_0x4b83f6['profile']['name'])&&_0x4b83f6[_0xa6f7('0x36')][_0xa6f7('0x1a')]===_0xa6f7('0x55')?_0x4b83f6[_0xa6f7('0x43')]['name']:!_[_0xa6f7('0x1e')](_0x4b83f6[_0xa6f7('0x44')])?_0x4b83f6[_0xa6f7('0x44')]+'\x20'+_0x4b83f6[_0xa6f7('0x45')]:_0x4b83f6[_0xa6f7('0x45')],'id':_0x4b83f6['id']};_0x5dab05[_0xa6f7('0x56')]=intUtil['getString'](_0x1d7bcd[_0xa6f7('0x57')],_0x1c2099,'\x20');_0x5dab05[_0xa6f7('0x58')]=intUtil[_0xa6f7('0x59')](_0x1d7bcd['Descriptions'],_0x1c2099,'\x0a');if(_0x5991f9[_0xa6f7('0x47')]===_0xa6f7('0x4c')){_0x5dab05[_0xa6f7('0x5a')]={'name':!_[_0xa6f7('0x1e')](_0x5991f9['Full_Name'])?_0x5991f9['Full_Name']:!_[_0xa6f7('0x1e')](_0x5991f9[_0xa6f7('0x5b')])?_0x5991f9[_0xa6f7('0x5b')]+'\x20'+_0x5991f9[_0xa6f7('0x5c')]:_0x5991f9[_0xa6f7('0x5c')],'id':_0x5991f9['id']};}if(_0x5991f9[_0xa6f7('0x47')]===_0xa6f7('0x52')){_0x5dab05['What_Id']={'name':!_[_0xa6f7('0x1e')](_0x5991f9[_0xa6f7('0x5d')])?_0x5991f9[_0xa6f7('0x5d')]:!_[_0xa6f7('0x1e')](_0x5991f9[_0xa6f7('0x5b')])?_0x5991f9[_0xa6f7('0x5b')]+'\x20'+_0x5991f9[_0xa6f7('0x5c')]:_0x5991f9[_0xa6f7('0x5c')],'id':_0x5991f9['id']};_0x5dab05[_0xa6f7('0x5e')]=_[_0xa6f7('0x41')](_0x5991f9[_0xa6f7('0x47')]);}if(_0x1c2099['talktime']){_0x5dab05[_0xa6f7('0x5f')]=moment['utc'](parseInt(_0x1c2099[_0xa6f7('0x60')])*0x3e8)['format'](_0xa6f7('0x61'));}else if(_0x1c2099[_0xa6f7('0x62')]&&_0x1c2099['endtime']){_0x5dab05[_0xa6f7('0x5f')]=moment[_0xa6f7('0x63')](moment(_0x1c2099[_0xa6f7('0x64')],'YYYY-MM-DDTHH:mm:ss')[_0xa6f7('0x65')](moment(_0x1c2099['starttime'],_0xa6f7('0x66'))))[_0xa6f7('0x2f')]('mm:ss');}switch(_0x1c2099[_0xa6f7('0x67')]){case'called':_0x5dab05[_0xa6f7('0x68')]='Called';break;case _0xa6f7('0x69'):case _0xa6f7('0x6a'):_0x5dab05[_0xa6f7('0x68')]=_0xa6f7('0x6b');break;case _0xa6f7('0x6c'):_0x5dab05[_0xa6f7('0x68')]=_0xa6f7('0x6d');break;case _0xa6f7('0x6e'):_0x5dab05[_0xa6f7('0x68')]=_0xa6f7('0x6f');break;case _0xa6f7('0x70'):_0x5dab05[_0xa6f7('0x68')]='Timeout';default:}_0x5dab05[_0xa6f7('0x71')]=(_0x134dd7===_0xa6f7('0x72')?moment(_0x1c2099[_0xa6f7('0x73')])[_0xa6f7('0x2f')](_0xa6f7('0x66')):moment(_0x1c2099[_0xa6f7('0x74')])[_0xa6f7('0x2f')](_0xa6f7('0x66')))||moment()['format'](_0xa6f7('0x66'));_0x5dab05[_0xa6f7('0x75')]=_0x134dd7||_0xa6f7('0x76');_0x5dab05=_['merge'](_0x5dab05,getCustomFields(_0x1d7bcd[_0xa6f7('0x77')],_0x1c2099));return request({'method':_0xa6f7('0x3e'),'uri':_0xa6f7('0x3f')+_0x34de29+_0xa6f7('0x78'),'headers':{'Authorization':_0xa6f7('0x31')+_0x340d3f},'body':{'data':[_0x5dab05]},'json':!![]})[_0xa6f7('0x27')](function(_0xe97f85){if(_0xe97f85&&_0xe97f85[_0xa6f7('0x3d')][0x0]['code']==='SUCCESS'){logger[_0xa6f7('0x2c')](_0xa6f7('0x79'));return{'id':_0xe97f85['data'][0x0][_0xa6f7('0x7a')]['id']};}})[_0xa6f7('0x3c')](function(_0x1bec76){logger['info'](_0xa6f7('0x7b'),_0x1bec76['stack']);console['log']('err',_0x1bec76);});}exports['queue']=function(_0x522e5d,_0x39ba3d,_0x3502b3,_0x41dc51,_0x5f00a7,_0x849412){var _0x1d3241,_0x40a70c,_0x69c173;_0x849412[_0xa6f7('0x7c')]=intUtil[_0xa6f7('0x7d')](_0x849412[_0xa6f7('0x7c')]);_0x849412[_0xa6f7('0x7e')]=intUtil[_0xa6f7('0x7d')](_0x849412[_0xa6f7('0x7e')]);if(_0x5f00a7&&_0x5f00a7['monitor_format']){logger[_0xa6f7('0x2c')](_0xa6f7('0x7f'),_0xa6f7('0x80'));_0x39ba3d[_0xa6f7('0x81')]=_0x849412[_0xa6f7('0x7e')]+_0xa6f7('0x82')+_0x39ba3d[_0xa6f7('0x83')]+_0xa6f7('0x84')+md5(_0x39ba3d[_0xa6f7('0x83')]);}else{_0x39ba3d[_0xa6f7('0x81')]='';}var _0x5bd6a9=_0x849412['host']==='zoho.eu'?'eu':_0xa6f7('0x85');return getAccessToken(_0x849412)[_0xa6f7('0x27')](function(_0x3ba166){_0x69c173=_0x3ba166;return getUser(_0x69c173,_0x5bd6a9,_0x849412,_0x41dc51['email']);})[_0xa6f7('0x27')](function(_0x36decb){_0x1d3241=_0x36decb;logger['info'](_0xa6f7('0x86'),_0x1d3241['id']);return getEndUser(_0x69c173,_0x5bd6a9,_0x849412,_0x39ba3d[_0xa6f7('0x87')],_0x39ba3d['calleridnum'],_0x1d3241,_0x3502b3);})['then'](function(_0xadf749){_0x40a70c=_0xadf749;return getCall(_0x69c173,_0x5bd6a9,_0x849412,_0x1d3241,_0x40a70c,_0x3502b3,_0x39ba3d,'Inbound');})[_0xa6f7('0x27')](function(_0x1959cb){if(_0x1959cb){logger['info']('The\x20Call\x20ID\x20is:',_0x1959cb['id']);logger[_0xa6f7('0x2c')](_0xa6f7('0x7f'),_0xa6f7('0x88'));emit(util['format'](_0xa6f7('0x89'),_0x41dc51[_0xa6f7('0x1a')]),_0xa6f7('0x8a'),{'uri':_0xa6f7('0x8b')+_0x849412[_0xa6f7('0x7c')]+_0xa6f7('0x8c')+_0x1959cb['id']});}})[_0xa6f7('0x3c')](function(_0x3b03ab){logger[_0xa6f7('0x29')](_0xa6f7('0x7f'),JSON[_0xa6f7('0x39')](_0x3b03ab));});};exports['outbound']=function(_0x426f6e,_0x24de88,_0x2f6866,_0x1f3f99,_0x46e6c4,_0xdf6850,_0x5f0f84){var _0x446ba4,_0x1f0c90,_0x346c8f;_0xdf6850[_0xa6f7('0x7c')]=intUtil[_0xa6f7('0x7d')](_0xdf6850[_0xa6f7('0x7c')]);_0xdf6850['serverUrl']=intUtil['stripTrailingSlash'](_0xdf6850[_0xa6f7('0x7e')]);if(_0x5f0f84&&_0x5f0f84[_0xa6f7('0x8d')]&&_0x5f0f84[_0xa6f7('0x8d')]!==_0xa6f7('0x8e')){logger[_0xa6f7('0x2c')]('[OUTBOUND]',_0xa6f7('0x80'));_0x24de88['recordingURL']=_0xdf6850[_0xa6f7('0x7e')]+_0xa6f7('0x82')+_0x24de88['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x24de88[_0xa6f7('0x83')]);}var _0x4e97fd=_0xdf6850['host']===_0xa6f7('0x8f')?'eu':_0xa6f7('0x85');return getAccessToken(_0xdf6850)[_0xa6f7('0x27')](function(_0x1d43eb){_0x346c8f=_0x1d43eb;return getUser(_0x346c8f,_0x4e97fd,_0xdf6850,_0x1f3f99['email']);})[_0xa6f7('0x27')](function(_0xd2a739){_0x446ba4=_0xd2a739;logger[_0xa6f7('0x2c')](_0xa6f7('0x86'),_0x446ba4['id']);return getEndUser(_0x346c8f,_0x4e97fd,_0xdf6850,_0x24de88[_0xa6f7('0x90')],_0x24de88[_0xa6f7('0x91')],_0x446ba4,_0x2f6866);})['then'](function(_0x3e1f98){_0x1f0c90=_0x3e1f98;return getCall(_0x346c8f,_0x4e97fd,_0xdf6850,_0x446ba4,_0x1f0c90,_0x2f6866,_0x24de88,'Outbound');})['then'](function(_0x1d5e15){if(_0x1d5e15){logger[_0xa6f7('0x2c')]('The\x20Call\x20ID\x20is:',_0x1d5e15['id']);logger[_0xa6f7('0x2c')](_0xa6f7('0x92'),_0xa6f7('0x88'));emit(util['format'](_0xa6f7('0x89'),_0x1f3f99['name']),_0xa6f7('0x8a'),{'uri':_0xa6f7('0x8b')+_0xdf6850['host']+_0xa6f7('0x8c')+_0x1d5e15['id']});}})['catch'](function(_0x1dcf76){logger[_0xa6f7('0x29')]('[OUTBOUND]',JSON[_0xa6f7('0x39')](_0x1dcf76));});};exports[_0xa6f7('0x93')]=function(_0x1afd68,_0x3aa798,_0xb23da6,_0x486eee,_0x6590a0,_0x37b898){var _0x1ecef6,_0x13219e,_0x5c66e6;_0x37b898[_0xa6f7('0x7c')]=intUtil[_0xa6f7('0x7d')](_0x37b898[_0xa6f7('0x7c')]);_0x37b898[_0xa6f7('0x7e')]=intUtil[_0xa6f7('0x7d')](_0x37b898[_0xa6f7('0x7e')]);if(_0x6590a0&&_0x6590a0[_0xa6f7('0x94')]){logger[_0xa6f7('0x2c')]('['+_0x3aa798['lastevent'][_0xa6f7('0x95')]()+']',_0xa6f7('0x80'));_0x3aa798['recordingURL']=_0x37b898[_0xa6f7('0x7e')]+'/api/voice/recordings/'+_0x3aa798[_0xa6f7('0x83')]+_0xa6f7('0x84')+md5(_0x3aa798[_0xa6f7('0x83')]);}else{_0x3aa798[_0xa6f7('0x81')]='';}var _0x1c1884=_0x37b898[_0xa6f7('0x7c')]===_0xa6f7('0x8f')?'eu':_0xa6f7('0x85');return getAccessToken(_0x37b898)['then'](function(_0x5d3f32){_0x5c66e6=_0x5d3f32;return getUser(_0x5c66e6,_0x1c1884,_0x37b898);})[_0xa6f7('0x27')](function(_0x1b79a1){_0x1ecef6=_0x1b79a1;logger[_0xa6f7('0x2c')](_0xa6f7('0x86'),_0x1ecef6['id']);return getEndUser(_0x5c66e6,_0x1c1884,_0x37b898,_0x3aa798['calleridname'],_0x3aa798[_0xa6f7('0x96')],_0x1ecef6,_0xb23da6);})[_0xa6f7('0x27')](function(_0x5b87be){_0x13219e=_0x5b87be;return getCall(_0x5c66e6,_0x1c1884,_0x37b898,_0x1ecef6,_0x13219e,_0xb23da6,_0x3aa798,'Inbound');})[_0xa6f7('0x27')](function(_0x3b8deb){if(_0x3b8deb){logger['info']('The\x20Call\x20ID\x20is:',_0x3b8deb['id']);}})[_0xa6f7('0x3c')](function(_0x2309e0){logger['error']('['+_0x3aa798[_0xa6f7('0x67')]['toUpperCase']()+']',JSON[_0xa6f7('0x39')](_0x2309e0));});}; \ No newline at end of file +var _0x2547=['https://crm.','none','[OUTBOUND]','/api/voice/recordings/','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','unmanaged','calleridnum','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','zoho','redis','defaults','socket.io-emitter','[HTTP]','stringify','length','string','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','then','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','Agent\x20found!','info','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','details','Error:\x20','log','moduleSearch','uri','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Leads','Creating\x20new\x20call...','Owner','getString','Description','Descriptions','Contacts','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','utc','format','mm:ss','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','merge','/crm/v2/Calls','SUCCESS','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','Inbound','The\x20Call\x20ID\x20is:','user:%s'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2547,0x1cd));var _0x7254=function(_0x254f56,_0x2e70dd){_0x254f56=_0x254f56-0x0;var _0x1ca6c3=_0x2547[_0x254f56];return _0x1ca6c3;};'use strict';var _=require('lodash');var rp=require(_0x7254('0x0'));var md5=require(_0x7254('0x1'));var util=require(_0x7254('0x2'));var intUtil=require(_0x7254('0x3'));var moment=require(_0x7254('0x4'));var Redis=require(_0x7254('0x5'));var BPromise=require(_0x7254('0x6'));var config=require(_0x7254('0x7'));var logger=require('../../../../config/logger')(_0x7254('0x8'));config[_0x7254('0x9')]=_[_0x7254('0xa')](config[_0x7254('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x7254('0xb'))(new Redis(config[_0x7254('0x9')]));function emit(_0x395913,_0x5da1ec,_0x2a2f82){io['to'](_0x395913)['emit'](_0x5da1ec,_0x2a2f82);}function request(_0x50925f){logger['debug'](_0x7254('0xc'),JSON[_0x7254('0xd')](_0x50925f));return rp(_0x50925f);}function getCustomFields(_0x31d5a5,_0x310c21){var _0x6828b6={};if(_0x31d5a5[_0x7254('0xe')]>0x0){_['forEach'](_0x31d5a5,function(_0x3275bd){if(_['includes']([_0x7254('0xf'),'picklist'],_0x3275bd[_0x7254('0x10')])&&_0x3275bd[_0x7254('0x11')]){_0x6828b6[_0x3275bd[_0x7254('0x11')]]=_0x3275bd[_0x7254('0x12')][_0x7254('0x13')]();}else if(_0x3275bd[_0x7254('0x10')]===_0x7254('0x14')&&_0x3275bd[_0x7254('0x15')]&&_0x3275bd[_0x7254('0x11')]&&_0x310c21[_0x3275bd[_0x7254('0x15')]]){_0x6828b6[_0x3275bd[_0x7254('0x11')]]=_0x310c21[_0x3275bd[_0x7254('0x15')]][_0x7254('0x13')]();}else if(_0x3275bd['type']===_0x7254('0x16')&&_0x3275bd[_0x7254('0x17')]&&_0x3275bd[_0x7254('0x17')][_0x7254('0x18')]&&_0x3275bd[_0x7254('0x11')]&&_0x310c21[_0x3275bd[_0x7254('0x17')][_0x7254('0x18')]['toLowerCase']()]){_0x6828b6[_0x3275bd[_0x7254('0x11')]]=_0x310c21[_0x3275bd[_0x7254('0x17')][_0x7254('0x18')][_0x7254('0x19')]()][_0x7254('0x13')]();}});}return _0x6828b6;}function getName(_0x301f00){if(_0x301f00[_0x7254('0x1a')]('\x20')>0x0){var _0x43b152=_0x301f00[_0x7254('0x1b')](/ (.+)/);if(_0x43b152[0x1]){return _0x43b152;}}return[_0x301f00,_0x301f00];}var accountsTokens={};function getAccessToken(_0x3b6cb6){return new Promise(function(_0x2594b8,_0x24bc73){if(!_[_0x7254('0x1c')](accountsTokens[_0x3b6cb6['id']])&&!_[_0x7254('0x1c')](accountsTokens[_0x3b6cb6['id']][_0x7254('0x1d')])){if(moment()[_0x7254('0x1e')](accountsTokens[_0x3b6cb6['id']][_0x7254('0x1f')])){_0x2594b8(accountsTokens[_0x3b6cb6['id']][_0x7254('0x1d')]);}}var _0x195fd2;switch(_0x3b6cb6[_0x7254('0x20')]){case'US':_0x195fd2=_0x7254('0x21');break;case'AU':_0x195fd2='https://accounts.zoho.com.au';break;case'EU':_0x195fd2='https://accounts.zoho.eu';break;case'IN':_0x195fd2=_0x7254('0x22');break;case'CN':_0x195fd2=_0x7254('0x23');break;default:_0x195fd2=_0x7254('0x24');break;}var _0x54dace={'method':_0x7254('0x25'),'uri':_0x195fd2+_0x7254('0x26'),'qs':{'refresh_token':_0x3b6cb6[_0x7254('0x27')],'client_id':_0x3b6cb6['clientId'],'client_secret':_0x3b6cb6[_0x7254('0x28')],'grant_type':_0x7254('0x29')},'json':!![]};return rp(_0x54dace)[_0x7254('0x2a')](function(_0x494cdb){accountsTokens[_0x3b6cb6['id']]={'access_token':_0x494cdb[_0x7254('0x1d')],'expires_in':moment()['add'](_0x494cdb[_0x7254('0x1f')],_0x7254('0x2b'))};_0x2594b8(_0x494cdb['access_token']);})[_0x7254('0x2c')](function(_0x158356){logger['error'](_0x7254('0x2d'),_0x158356[_0x7254('0x2e')]);_0x24bc73(_0x158356);});});}function getUser(_0x37cb5c,_0xb9198b,_0x43bf02,_0xfe02ea){logger['info'](_0x7254('0x2f'));return request({'method':_0x7254('0x30'),'uri':util['format'](_0x7254('0x31'),_0xb9198b),'qs':{'type':_0x7254('0x32')},'headers':{'Authorization':_0x7254('0x33')+_0x37cb5c},'json':!![]})['then'](function(_0x3261fb){if(_0x3261fb[_0x7254('0x34')]){var _0x354305=-0x1;if(_[_0x7254('0x35')](_0x3261fb[_0x7254('0x34')])){if(!_[_0x7254('0x1c')](_0xfe02ea)){_0x354305=_[_0x7254('0x36')](_0x3261fb['users'],function(_0x276db8){return _0x276db8['email']===_0xfe02ea;});}if(_0x354305>=0x0){logger['info'](_0x7254('0x37'));}else{logger[_0x7254('0x38')](_0x7254('0x39'));_0x354305=_[_0x7254('0x36')](_0x3261fb[_0x7254('0x34')],function(_0x430420){return _0x430420[_0x7254('0x3a')][_0x7254('0x18')]===_0x7254('0x3b');});}return _0x3261fb[_0x7254('0x34')][_0x354305];}else{if(_0x3261fb[_0x7254('0x3c')][_0x7254('0x3a')][_0x7254('0x18')]===_0x7254('0x3b')){logger['info'](_0x7254('0x39'));user=_0x3261fb[_0x7254('0x3c')];return user;}else{logger[_0x7254('0x3d')](_0x7254('0x3e'),JSON[_0x7254('0xd')](_0x3261fb));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x7254('0xd')](_0x3261fb));}}}else{logger['error'](_0x7254('0x3e'),JSON[_0x7254('0xd')](_0x3261fb));throw new Error(_0x7254('0x3f')+JSON[_0x7254('0xd')](_0x3261fb));}})[_0x7254('0x2c')](function(_0x4e6213){console[_0x7254('0x3d')](_0x4e6213);});}function getZohoUser(_0x5e95b1,_0x1c03c5){return new BPromise(function(_0x12bd3b,_0x49ea48){request(_0x5e95b1)[_0x7254('0x2a')](function(_0x3c5bf4){var _0x20ea94=null;if(_0x3c5bf4){_0x20ea94=_0x3c5bf4[_0x7254('0x40')][0x0];_0x20ea94[_0x7254('0x41')]=_0x1c03c5;}_0x12bd3b(_0x20ea94);})[_0x7254('0x2c')](function(_0x4f01bf){_0x49ea48(_0x4f01bf);});});}function createEndUser(_0x23cc50,_0x102d87,_0x105b8c,_0x4eca7a,_0x3fbad7,_0x3bccc8){var _0x105b8c=getName(_0x105b8c);return request({'method':'POST','uri':_0x7254('0x42')+_0x102d87+_0x7254('0x43')+_[_0x7254('0x44')](_0x3bccc8[_0x7254('0x45')])+'s','body':{'data':[{'Last_Name':_0x105b8c[0x1],'First_Name':_0x105b8c[0x0],'Phone':_0x4eca7a,'Owner':{'name':!_[_0x7254('0x1c')](_0x3fbad7['role']['name'])?_0x3fbad7[_0x7254('0x46')][_0x7254('0x18')]:!_[_0x7254('0x1c')](_0x3fbad7[_0x7254('0x47')])?_0x3fbad7['first_name']+'\x20'+_0x3fbad7['last_name']:_0x3fbad7[_0x7254('0x48')],'id':_0x3fbad7['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x23cc50},'json':!![]})[_0x7254('0x2a')](function(_0x3187b0){if(_0x3187b0&&_0x3187b0[_0x7254('0x40')][0x0][_0x7254('0x49')]==='SUCCESS'){var _0x4adf34=_0x3187b0[_0x7254('0x40')][0x0][_0x7254('0x4a')];_0x4adf34[_0x7254('0x41')]=_[_0x7254('0x44')](_0x3bccc8[_0x7254('0x45')])+'s';return _0x4adf34;}logger['error']('The\x20failing\x20result\x20is',JSON[_0x7254('0xd')](data));throw new Error(_0x7254('0x4b')+JSON[_0x7254('0xd')](data));})['catch'](function(_0x32b4ea){console[_0x7254('0x4c')]('CREATE\x20ERROR',_0x32b4ea);});}function getEndUser(_0x1dd18f,_0x36e987,_0x53701f,_0x10c3b7,_0x553917,_0x345811,_0x348bff){var _0x5b7332={'method':_0x7254('0x30'),'uri':'','headers':{'Authorization':_0x7254('0x33')+_0x1dd18f},'json':!![]};switch(_0x348bff[_0x7254('0x4d')]){case'contact_lead':_0x5b7332[_0x7254('0x4e')]=_0x7254('0x42')+_0x36e987+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x553917+'))';return getZohoUser(_0x5b7332,'Contacts')[_0x7254('0x2a')](function(_0x54c792){if(_0x54c792)return _0x54c792;_0x5b7332[_0x7254('0x4e')]=_0x7254('0x42')+_0x36e987+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x553917+'))';return getZohoUser(_0x5b7332,'Leads')[_0x7254('0x2a')](function(_0xc40bc5){if(_0xc40bc5)return _0xc40bc5;if(_0x348bff[_0x7254('0x45')]!=_0x7254('0x4f')){return createEndUser(_0x1dd18f,_0x36e987,_0x10c3b7,_0x553917,_0x345811,_0x348bff);}else{return{};}});});break;case _0x7254('0x50'):_0x5b7332[_0x7254('0x4e')]='https://www.zohoapis.'+_0x36e987+_0x7254('0x51')+_0x553917+'))';return getZohoUser(_0x5b7332,'Contacts')[_0x7254('0x2a')](function(_0x279e0e){if(_0x279e0e)return _0x279e0e;if(_0x348bff[_0x7254('0x45')]!='nothing'){return createEndUser(_0x1dd18f,_0x36e987,_0x10c3b7,_0x553917,_0x345811,_0x348bff);}else{return{};}});break;case _0x7254('0x52'):_0x5b7332[_0x7254('0x4e')]=_0x7254('0x42')+_0x36e987+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x553917+'))';return getZohoUser(_0x5b7332,_0x7254('0x53'))[_0x7254('0x2a')](function(_0x38e296){if(_0x38e296)return _0x38e296;if(_0x348bff[_0x7254('0x45')]!=_0x7254('0x4f')){return createEndUser(_0x1dd18f,_0x36e987,_0x10c3b7,_0x553917,_0x345811,_0x348bff);}else{return{};}});break;}}function getCall(_0x4e1e38,_0x5e66c6,_0x24c532,_0x2cb7cd,_0x441d23,_0x10e1cb,_0x3b0002,_0x4c6838){logger['info'](_0x7254('0x54'));var _0x2d91ab={};_0x2d91ab[_0x7254('0x55')]={'name':!_[_0x7254('0x1c')](_0x2cb7cd['role'][_0x7254('0x18')])&&!_[_0x7254('0x1c')](_0x2cb7cd['profile'][_0x7254('0x18')])&&_0x2cb7cd['profile'][_0x7254('0x18')]==='administrator'?_0x2cb7cd[_0x7254('0x46')]['name']:!_['isNil'](_0x2cb7cd[_0x7254('0x47')])?_0x2cb7cd[_0x7254('0x47')]+'\x20'+_0x2cb7cd[_0x7254('0x48')]:_0x2cb7cd[_0x7254('0x48')],'id':_0x2cb7cd['id']};_0x2d91ab['Subject']=intUtil[_0x7254('0x56')](_0x10e1cb['Subjects'],_0x3b0002,'\x20');_0x2d91ab[_0x7254('0x57')]=intUtil[_0x7254('0x56')](_0x10e1cb[_0x7254('0x58')],_0x3b0002,'\x0a');if(_0x441d23[_0x7254('0x41')]===_0x7254('0x59')){_0x2d91ab[_0x7254('0x5a')]={'name':!_['isNil'](_0x441d23[_0x7254('0x5b')])?_0x441d23[_0x7254('0x5b')]:!_[_0x7254('0x1c')](_0x441d23[_0x7254('0x5c')])?_0x441d23[_0x7254('0x5c')]+'\x20'+_0x441d23[_0x7254('0x5d')]:_0x441d23['Last_Name'],'id':_0x441d23['id']};}if(_0x441d23[_0x7254('0x41')]===_0x7254('0x53')){_0x2d91ab[_0x7254('0x5e')]={'name':!_[_0x7254('0x1c')](_0x441d23[_0x7254('0x5b')])?_0x441d23[_0x7254('0x5b')]:!_[_0x7254('0x1c')](_0x441d23['First_Name'])?_0x441d23['First_Name']+'\x20'+_0x441d23[_0x7254('0x5d')]:_0x441d23['Last_Name'],'id':_0x441d23['id']};_0x2d91ab['$se_module']=_[_0x7254('0x44')](_0x441d23[_0x7254('0x41')]);}if(_0x3b0002[_0x7254('0x5f')]){_0x2d91ab['Call_Duration']=moment[_0x7254('0x60')](parseInt(_0x3b0002['talktime'])*0x3e8)[_0x7254('0x61')](_0x7254('0x62'));}else if(_0x3b0002[_0x7254('0x63')]&&_0x3b0002[_0x7254('0x64')]){_0x2d91ab[_0x7254('0x65')]=moment['utc'](moment(_0x3b0002[_0x7254('0x64')],_0x7254('0x66'))[_0x7254('0x67')](moment(_0x3b0002[_0x7254('0x68')],'YYYY-MM-DDTHH:mm:ss')))['format'](_0x7254('0x62'));}switch(_0x3b0002[_0x7254('0x69')]){case _0x7254('0x6a'):_0x2d91ab[_0x7254('0x6b')]=_0x7254('0x6c');break;case _0x7254('0x6d'):case _0x7254('0x6e'):_0x2d91ab[_0x7254('0x6b')]=_0x7254('0x6f');break;case _0x7254('0x70'):_0x2d91ab[_0x7254('0x6b')]=_0x7254('0x71');break;case _0x7254('0x72'):_0x2d91ab['Call_Result']=_0x7254('0x73');break;case _0x7254('0x74'):_0x2d91ab[_0x7254('0x6b')]='Timeout';default:}_0x2d91ab[_0x7254('0x75')]=(_0x4c6838===_0x7254('0x76')?moment(_0x3b0002[_0x7254('0x68')])[_0x7254('0x61')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x3b0002[_0x7254('0x77')])['format'](_0x7254('0x66')))||moment()[_0x7254('0x61')](_0x7254('0x66'));_0x2d91ab[_0x7254('0x78')]=_0x4c6838||'Inbound';_0x2d91ab=_[_0x7254('0x79')](_0x2d91ab,getCustomFields(_0x10e1cb['Fields'],_0x3b0002));return request({'method':_0x7254('0x25'),'uri':'https://www.zohoapis.'+_0x5e66c6+_0x7254('0x7a'),'headers':{'Authorization':_0x7254('0x33')+_0x4e1e38},'body':{'data':[_0x2d91ab]},'json':!![]})[_0x7254('0x2a')](function(_0x24619f){if(_0x24619f&&_0x24619f[_0x7254('0x40')][0x0][_0x7254('0x49')]===_0x7254('0x7b')){logger[_0x7254('0x38')]('Call\x20created!');return{'id':_0x24619f[_0x7254('0x40')][0x0]['details']['id']};}})[_0x7254('0x2c')](function(_0x16a9ef){logger[_0x7254('0x38')](_0x7254('0x7c'),_0x16a9ef[_0x7254('0x2e')]);console[_0x7254('0x4c')](_0x7254('0x7c'),_0x16a9ef);});}exports[_0x7254('0x7d')]=function(_0x599ffa,_0x19cc97,_0x5324cd,_0x231184,_0x6b8eb9,_0x2399ef){var _0x4578cf,_0x8620d0,_0x28abbf;_0x2399ef[_0x7254('0x7e')]=intUtil[_0x7254('0x7f')](_0x2399ef[_0x7254('0x7e')]);_0x2399ef[_0x7254('0x80')]=intUtil[_0x7254('0x7f')](_0x2399ef[_0x7254('0x80')]);if(_0x6b8eb9&&_0x6b8eb9[_0x7254('0x81')]){logger[_0x7254('0x38')](_0x7254('0x82'),_0x7254('0x83'));_0x19cc97[_0x7254('0x84')]=_0x2399ef['serverUrl']+'/api/voice/recordings/'+_0x19cc97[_0x7254('0x85')]+_0x7254('0x86')+md5(_0x19cc97['uniqueid']);}else{_0x19cc97['recordingURL']='';}var _0x4d8e70=_0x2399ef[_0x7254('0x7e')]===_0x7254('0x87')?'eu':_0x7254('0x88');return getAccessToken(_0x2399ef)[_0x7254('0x2a')](function(_0x55ae4b){_0x28abbf=_0x55ae4b;return getUser(_0x28abbf,_0x4d8e70,_0x2399ef,_0x231184[_0x7254('0x89')]);})[_0x7254('0x2a')](function(_0x5725fc){_0x4578cf=_0x5725fc;logger[_0x7254('0x38')](_0x7254('0x8a'),_0x4578cf['id']);return getEndUser(_0x28abbf,_0x4d8e70,_0x2399ef,_0x19cc97[_0x7254('0x8b')],_0x19cc97['calleridnum'],_0x4578cf,_0x5324cd);})['then'](function(_0x220066){_0x8620d0=_0x220066;return getCall(_0x28abbf,_0x4d8e70,_0x2399ef,_0x4578cf,_0x8620d0,_0x5324cd,_0x19cc97,_0x7254('0x8c'));})['then'](function(_0x261f78){if(_0x261f78){logger[_0x7254('0x38')](_0x7254('0x8d'),_0x261f78['id']);logger[_0x7254('0x38')](_0x7254('0x82'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7254('0x61')](_0x7254('0x8e'),_0x231184[_0x7254('0x18')]),'trigger:browser:url',{'uri':_0x7254('0x8f')+_0x2399ef['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x261f78['id']});}})['catch'](function(_0x34c284){logger['error']('[QUEUE]',JSON[_0x7254('0xd')](_0x34c284));});};exports[_0x7254('0x76')]=function(_0xc70c1b,_0x5d839e,_0x32cb1d,_0x5a0c41,_0x175379,_0x1d1334,_0x4b355f){var _0x1df29a,_0x3fec88,_0x3f268e;_0x1d1334[_0x7254('0x7e')]=intUtil[_0x7254('0x7f')](_0x1d1334[_0x7254('0x7e')]);_0x1d1334[_0x7254('0x80')]=intUtil['stripTrailingSlash'](_0x1d1334[_0x7254('0x80')]);if(_0x4b355f&&_0x4b355f['recordingFormat']&&_0x4b355f['recordingFormat']!==_0x7254('0x90')){logger[_0x7254('0x38')](_0x7254('0x91'),_0x7254('0x83'));_0x5d839e['recordingURL']=_0x1d1334[_0x7254('0x80')]+_0x7254('0x92')+_0x5d839e[_0x7254('0x85')]+_0x7254('0x86')+md5(_0x5d839e['uniqueid']);}var _0x1f4ba1=_0x1d1334['host']==='zoho.eu'?'eu':'com';return getAccessToken(_0x1d1334)[_0x7254('0x2a')](function(_0x1b7829){_0x3f268e=_0x1b7829;return getUser(_0x3f268e,_0x1f4ba1,_0x1d1334,_0x5a0c41['email']);})['then'](function(_0x2d1f90){_0x1df29a=_0x2d1f90;logger['info']('The\x20User\x20ID\x20is:',_0x1df29a['id']);return getEndUser(_0x3f268e,_0x1f4ba1,_0x1d1334,_0x5d839e['destcalleridname'],_0x5d839e['destcalleridnum'],_0x1df29a,_0x32cb1d);})[_0x7254('0x2a')](function(_0x12188d){_0x3fec88=_0x12188d;return getCall(_0x3f268e,_0x1f4ba1,_0x1d1334,_0x1df29a,_0x3fec88,_0x32cb1d,_0x5d839e,'Outbound');})['then'](function(_0x2d84ff){if(_0x2d84ff){logger[_0x7254('0x38')](_0x7254('0x8d'),_0x2d84ff['id']);logger[_0x7254('0x38')](_0x7254('0x91'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7254('0x61')](_0x7254('0x8e'),_0x5a0c41[_0x7254('0x18')]),_0x7254('0x93'),{'uri':_0x7254('0x8f')+_0x1d1334[_0x7254('0x7e')]+_0x7254('0x94')+_0x2d84ff['id']});}})[_0x7254('0x2c')](function(_0x58a3d7){logger['error'](_0x7254('0x91'),JSON[_0x7254('0xd')](_0x58a3d7));});};exports[_0x7254('0x95')]=function(_0x108db5,_0x47219f,_0x4296ce,_0x57cc93,_0x117875,_0x4120de){var _0x530b2d,_0x2bb853,_0x4abaa7;_0x4120de['host']=intUtil[_0x7254('0x7f')](_0x4120de['host']);_0x4120de['serverUrl']=intUtil[_0x7254('0x7f')](_0x4120de[_0x7254('0x80')]);if(_0x117875&&_0x117875['monitor_format']){logger['info']('['+_0x47219f[_0x7254('0x69')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x47219f[_0x7254('0x84')]=_0x4120de[_0x7254('0x80')]+'/api/voice/recordings/'+_0x47219f[_0x7254('0x85')]+_0x7254('0x86')+md5(_0x47219f[_0x7254('0x85')]);}else{_0x47219f[_0x7254('0x84')]='';}var _0x34637b=_0x4120de[_0x7254('0x7e')]===_0x7254('0x87')?'eu':_0x7254('0x88');return getAccessToken(_0x4120de)[_0x7254('0x2a')](function(_0xbbdc52){_0x4abaa7=_0xbbdc52;return getUser(_0x4abaa7,_0x34637b,_0x4120de);})[_0x7254('0x2a')](function(_0x4e3ea6){_0x530b2d=_0x4e3ea6;logger[_0x7254('0x38')](_0x7254('0x8a'),_0x530b2d['id']);return getEndUser(_0x4abaa7,_0x34637b,_0x4120de,_0x47219f[_0x7254('0x8b')],_0x47219f[_0x7254('0x96')],_0x530b2d,_0x4296ce);})['then'](function(_0x317b3c){_0x2bb853=_0x317b3c;return getCall(_0x4abaa7,_0x34637b,_0x4120de,_0x530b2d,_0x2bb853,_0x4296ce,_0x47219f,_0x7254('0x8c'));})[_0x7254('0x2a')](function(_0x4bc1b9){if(_0x4bc1b9){logger[_0x7254('0x38')](_0x7254('0x8d'),_0x4bc1b9['id']);}})[_0x7254('0x2c')](function(_0x69e4df){logger[_0x7254('0x3d')]('['+_0x47219f[_0x7254('0x69')]['toUpperCase']()+']',JSON[_0x7254('0xd')](_0x69e4df));});}; \ 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 3962c48..1c6b411 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 _0x7a54=['mustache','trigger','exec','data2','Script','data3','%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','shelljs'];(function(_0x3ea109,_0x57f9b0){var _0x4e1fac=function(_0x16839e){while(--_0x16839e){_0x3ea109['push'](_0x3ea109['shift']());}};_0x4e1fac(++_0x57f9b0);}(_0x7a54,0x106));var _0x47a5=function(_0x2e79b3,_0xd62752){_0x2e79b3=_0x2e79b3-0x0;var _0x43db1a=_0x7a54[_0x2e79b3];return _0x43db1a;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ No newline at end of file +var _0x7a54=['mustache','trigger','exec','data2','Script','data3','%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','shelljs'];(function(_0x31ac3a,_0x39cece){var _0x183fd4=function(_0x20ca9d){while(--_0x20ca9d){_0x31ac3a['push'](_0x31ac3a['shift']());}};_0x183fd4(++_0x39cece);}(_0x7a54,0x106));var _0x47a5=function(_0x21a36a,_0x1e7b72){_0x21a36a=_0x21a36a-0x0;var _0x3189f8=_0x7a54[_0x21a36a];return _0x3189f8;};'use strict';var util=require(_0x47a5('0x0'));var sh=require(_0x47a5('0x1'));var Mustache=require(_0x47a5('0x2'));var logger=require('../../../../config/logger')(_0x47a5('0x3'));exports[_0x47a5('0x4')]=function(_0x4880bf,_0x5f7f12){var _0x11bf85=_0x4880bf[_0x47a5('0x5')]?_0x4880bf[_0x47a5('0x5')]:_0x47a5('0x6');var _0x545a97=_0x4880bf[_0x47a5('0x7')]?Mustache['render'](_0x4880bf[_0x47a5('0x7')],_0x5f7f12):_0x5f7f12;sh[_0x47a5('0x4')](_0x545a97,function(_0x506eda,_0x194fb0,_0x5077f3){if(_0x506eda!==0x0){logger['error'](util['format'](_0x47a5('0x8'),_0x11bf85,_0x545a97,_0x506eda,_0x5077f3));}else{logger[_0x47a5('0x9')](util['format'](_0x47a5('0xa'),_0x11bf85,_0x545a97,_0x194fb0));}});}; \ 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 6776aff..58e7d0d 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 _0x7a54=['data6','parse','stack','data1','GET','DELETE','POST','PUT','render','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','name','request-promise','util','lodash','../../../../config/logger','trigger','toUpperCase','data2','data5'];(function(_0x517be4,_0x132cab){var _0x39fd7e=function(_0x14a83e){while(--_0x14a83e){_0x517be4['push'](_0x517be4['shift']());}};_0x39fd7e(++_0x132cab);}(_0x7a54,0x106));var _0x47a5=function(_0x3770a0,_0x355be8){_0x3770a0=_0x3770a0-0x0;var _0x143409=_0x7a54[_0x3770a0];return _0x143409;};'use strict';var rp=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var Mustache=require('mustache');var logger=require(_0x47a5('0x3'))(_0x47a5('0x4'));exports['exec']=function(_0x5f7f12,_0x11bf85){var _0x2a1a7e,_0x3717e1;var _0xfdf934={'method':_0x5f7f12['data1'][_0x47a5('0x5')](),'uri':Mustache['render'](_0x5f7f12[_0x47a5('0x6')],_0x11bf85),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5f7f12[_0x47a5('0x7')])==='number'&&parseInt(_0x5f7f12[_0x47a5('0x7')])>=0x1&&parseInt(_0x5f7f12['data5'])<=0xa?parseInt(_0x5f7f12['data5'])*0x3e8:0x5*0x3e8};try{_0xfdf934['headers']=_0x5f7f12[_0x47a5('0x8')]?JSON[_0x47a5('0x9')](Mustache['render'](_0x5f7f12[_0x47a5('0x8')],_0x11bf85)):{};}catch(_0x49e844){logger['error'](_0x49e844[_0x47a5('0xa')]);}switch(_0x5f7f12[_0x47a5('0xb')][_0x47a5('0x5')]()){case _0x47a5('0xc'):case _0x47a5('0xd'):_0x2a1a7e=null;_0xfdf934['qs']=_0x11bf85;break;case _0x47a5('0xe'):case _0x47a5('0xf'):if(_0x5f7f12['data7']){try{_0x2a1a7e=JSON[_0x47a5('0x9')](Mustache[_0x47a5('0x10')](_0x5f7f12[_0x47a5('0x11')],_0x11bf85));_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}catch(_0x139f25){logger[_0x47a5('0x13')](_0x139f25[_0x47a5('0xa')]);logger[_0x47a5('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2a1a7e=_0x11bf85;_0xfdf934[_0x47a5('0x12')]=_0x2a1a7e;}break;}logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x16'),_0x5f7f12[_0x47a5('0xb')],_0x5f7f12['data2'],JSON['stringify'](_0xfdf934)));rp(_0xfdf934)[_0x47a5('0x17')](function(_0x4b966e){_0x2a1a7e=!_['isNil'](_0x2a1a7e)?_0x47a5('0x18')+_0x2a1a7e:'';_0x3717e1=typeof _0x4b966e[_0x47a5('0x12')]===_0x47a5('0x19')?JSON[_0x47a5('0x1a')](_0x4b966e[_0x47a5('0x12')]):_0x4b966e[_0x47a5('0x12')];logger[_0x47a5('0x14')](util[_0x47a5('0x15')](_0x47a5('0x1b'),_0x5f7f12['data1'],_0x5f7f12[_0x47a5('0x6')],_0x4b966e[_0x47a5('0x1c')],_0x3717e1));})['catch'](function(_0x2b0360){logger[_0x47a5('0x13')](util[_0x47a5('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x5f7f12[_0x47a5('0xb')],_0x5f7f12[_0x47a5('0x6')],_0x2b0360[_0x47a5('0x1c')],_0x2b0360[_0x47a5('0x1d')],_0x2b0360['message']));});}; \ No newline at end of file +var _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x2fc126,_0x383d21){var _0x3a73dc=function(_0x3e0fa7){while(--_0x3e0fa7){_0x2fc126['push'](_0x2fc126['shift']());}};_0x3a73dc(++_0x383d21);}(_0xb10b,0x12a));var _0xbb10=function(_0x1d6528,_0x1c20a3){_0x1d6528=_0x1d6528-0x0;var _0x3928df=_0xb10b[_0x1d6528];return _0x3928df;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index bdf2fde..0a02af2 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 _0x6c32=['../../config/logger','client','Request','request','then','debug','rpc','routing','error','message','result','exports','jayson/promise'];(function(_0x2d1eee,_0x5b5f3a){var _0x2f471c=function(_0x39ac06){while(--_0x39ac06){_0x2d1eee['push'](_0x2d1eee['shift']());}};_0x2f471c(++_0x5b5f3a);}(_0x6c32,0xb5));var _0x26c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6c32[_0x321bb2];return _0x9c12ed;};'use strict';var jayson=require(_0x26c3('0x0'));var BPromise=require('bluebird');var logger=require(_0x26c3('0x1'))('routing');var client=jayson[_0x26c3('0x2')]['http']({'port':0x2329});client[_0x26c3('0x3')]=function(_0x2c29dc,_0x5e8a24){return new BPromise(function(_0x4c2de2,_0x16867a){return client[_0x26c3('0x4')](_0x2c29dc,_0x5e8a24)[_0x26c3('0x5')](function(_0x402393){logger[_0x26c3('0x6')](_0x26c3('0x7'),_0x26c3('0x8'),_0x2c29dc,_0x5e8a24,_0x402393);if(_0x402393[_0x26c3('0x9')]){logger[_0x26c3('0x9')](_0x26c3('0x7'),'routing',_0x2c29dc,_0x402393['error'][_0x26c3('0xa')],_0x5e8a24);return _0x16867a(_0x402393['error'][_0x26c3('0xa')]);}else{return _0x4c2de2(_0x402393[_0x26c3('0xb')]);}})['catch'](function(_0x18deda){logger[_0x26c3('0x9')](_0x26c3('0x7'),_0x26c3('0x8'),_0x2c29dc,_0x18deda,_0x5e8a24);return _0x16867a(_0x18deda);});});};module[_0x26c3('0xc')]=client; \ No newline at end of file +var _0xdfe7=['message','result','catch','exports','bluebird','../../config/logger','client','http','Request','then','debug','rpc','error','routing'];(function(_0x39a29c,_0x59a870){var _0x271c19=function(_0x45ef21){while(--_0x45ef21){_0x39a29c['push'](_0x39a29c['shift']());}};_0x271c19(++_0x59a870);}(_0xdfe7,0xc8));var _0x7dfe=function(_0x4e290c,_0x42c1c9){_0x4e290c=_0x4e290c-0x0;var _0x1aed03=_0xdfe7[_0x4e290c];return _0x1aed03;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x7dfe('0x0'));var logger=require(_0x7dfe('0x1'))('routing');var client=jayson[_0x7dfe('0x2')][_0x7dfe('0x3')]({'port':0x2329});client[_0x7dfe('0x4')]=function(_0xb0b7fb,_0x527490){return new BPromise(function(_0x2c07d2,_0x23ac4c){return client['request'](_0xb0b7fb,_0x527490)[_0x7dfe('0x5')](function(_0x3d8220){logger[_0x7dfe('0x6')](_0x7dfe('0x7'),'routing',_0xb0b7fb,_0x527490,_0x3d8220);if(_0x3d8220[_0x7dfe('0x8')]){logger[_0x7dfe('0x8')](_0x7dfe('0x7'),_0x7dfe('0x9'),_0xb0b7fb,_0x3d8220['error'][_0x7dfe('0xa')],_0x527490);return _0x23ac4c(_0x3d8220[_0x7dfe('0x8')][_0x7dfe('0xa')]);}else{return _0x2c07d2(_0x3d8220[_0x7dfe('0xb')]);}})[_0x7dfe('0xc')](function(_0x55f8be){logger[_0x7dfe('0x8')](_0x7dfe('0x7'),_0x7dfe('0x9'),_0xb0b7fb,_0x55f8be,_0x527490);return _0x23ac4c(_0x55f8be);});});};module[_0x7dfe('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 8c81aa3..ee769b3 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 _0xdbf5=['refresh','mailAccounts','listen','findOne','loginMailFrequency','catch','./server','./rpc/mailAccount','../../mysqldb','resolve','then','getMailAccounts','initMailAccounts'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x365b66,_0x2f1e4a){_0x365b66=_0x365b66-0x0;var _0x2da167=_0xdbf5[_0x365b66];return _0x2da167;};'use strict';var BPromise=require('bluebird');var server=require(_0x5dbf('0x0'));var Realtime=require('./realtime');var EmailChannel=require('./lib/email');var mailAccount=require(_0x5dbf('0x1'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0x5dbf('0x2'))['db'];function initRealtime(){return BPromise[_0x5dbf('0x3')]()[_0x5dbf('0x4')](mailAccount[_0x5dbf('0x5')]())[_0x5dbf('0x4')](realtime[_0x5dbf('0x6')]())[_0x5dbf('0x4')](function(){email[_0x5dbf('0x7')](realtime[_0x5dbf('0x8')]);return realtime;});}function main(){return server[_0x5dbf('0x9')](realtime,email)[_0x5dbf('0x4')](function(_0x93e657){return initRealtime();})['then'](function(_0x134810){return db['Setting'][_0x5dbf('0xa')]({'attributes':['id',_0x5dbf('0xb')],'raw':!![]});})[_0x5dbf('0x4')](function(_0x1813bb){return setInterval(initRealtime,_0x1813bb['loginMailFrequency']*0x3e8);})[_0x5dbf('0xc')](function(_0x521a31){console['log'](_0x521a31);});}main(); \ No newline at end of file +var _0x9a5a=['./realtime','./lib/email','./rpc/mailAccount','resolve','then','getMailAccounts','initMailAccounts','mailAccounts','listen','loginMailFrequency','catch','log','bluebird','./server'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9a5a,0x194));var _0xa9a5=function(_0x517c4a,_0x50338b){_0x517c4a=_0x517c4a-0x0;var _0x3346c0=_0x9a5a[_0x517c4a];return _0x3346c0;};'use strict';var BPromise=require(_0xa9a5('0x0'));var server=require(_0xa9a5('0x1'));var Realtime=require(_0xa9a5('0x2'));var EmailChannel=require(_0xa9a5('0x3'));var mailAccount=require(_0xa9a5('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require('../../mysqldb')['db'];function initRealtime(){return BPromise[_0xa9a5('0x5')]()[_0xa9a5('0x6')](mailAccount[_0xa9a5('0x7')]())[_0xa9a5('0x6')](realtime[_0xa9a5('0x8')]())[_0xa9a5('0x6')](function(){email['refresh'](realtime[_0xa9a5('0x9')]);return realtime;});}function main(){return server[_0xa9a5('0xa')](realtime,email)[_0xa9a5('0x6')](function(_0x1eafa6){return initRealtime();})[_0xa9a5('0x6')](function(_0x5f2e83){return db['Setting']['findOne']({'attributes':['id',_0xa9a5('0xb')],'raw':!![]});})[_0xa9a5('0x6')](function(_0x186fcf){return setInterval(initRealtime,_0x186fcf[_0xa9a5('0xb')]*0x3e8);})[_0xa9a5('0xc')](function(_0x3c0f91){console[_0xa9a5('0xd')](_0x3c0f91);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 952f789..148a09d 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 _0x5272=['hasOwnProperty','box','handleImapBox','bind','handleImapEmail','error','handleImapError','disabled','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','handleImapEnd','lastSync','send','Smtp','verify','verified','exports','moment','bluebird','ioredis','../../../config/logger','email','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','key','active','status','Imap','messageStatus','isNil','md5','refresh'];(function(_0x38e06f,_0x26f857){var _0x5cd1a3=function(_0x408835){while(--_0x408835){_0x38e06f['push'](_0x38e06f['shift']());}};_0x5cd1a3(++_0x26f857);}(_0x5272,0xae));var _0x2527=function(_0x4814d6,_0x40b387){_0x4814d6=_0x4814d6-0x0;var _0x283abe=_0x5272[_0x4814d6];return _0x283abe;};'use strict';var _=require('lodash');var moment=require(_0x2527('0x0'));var BPromise=require(_0x2527('0x1'));var md5=require('md5');var Redis=require(_0x2527('0x2'));var config=require('../../../config/environment');var logger=require(_0x2527('0x3'))(_0x2527('0x4'));config[_0x2527('0x5')]=_[_0x2527('0x6')](config[_0x2527('0x5')],{'host':_0x2527('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2527('0x5')]));var EmailImap=require(_0x2527('0x8'));var EmailSmtp=require(_0x2527('0x9'));var mailAccount=require(_0x2527('0xa'));var md5Accounts={};function EmailChannel(_0x67e197){logger[_0x2527('0xb')](_0x2527('0xc'));this[_0x2527('0xd')]=_0x67e197[_0x2527('0xd')];this[_0x2527('0xe')]={};this[_0x2527('0xf')]=new EmailSmtp();}EmailChannel[_0x2527('0x10')][_0x2527('0x11')]=function(_0x127467){var _0x198822=this[_0x2527('0xd')][_0x127467];var _0x38cc4f={'id':_0x198822['id'],'name':_0x198822['name'],'key':_0x198822[_0x2527('0x12')],'active':_0x198822[_0x2527('0x13')],'Imap':{'status':_0x198822['Imap'][_0x2527('0x14')],'messageStatus':_0x198822[_0x2527('0x15')][_0x2527('0x16')],'total':_0x198822[_0x2527('0x15')]['total']}};if(_[_0x2527('0x17')](md5Accounts[_0x127467])){md5Accounts[_0x127467]={};}var _0x1b6729=md5(JSON['stringify'](_0x38cc4f));if(md5Accounts[_0x127467][_0x2527('0x18')]!==_0x1b6729){md5Accounts[_0x127467][_0x2527('0x18')]=_0x1b6729;io[_0x2527('0x11')]('mailAccount:update',_0x38cc4f);}};EmailChannel[_0x2527('0x10')][_0x2527('0x19')]=function(_0x4d6efa){for(var _0xddbb83 in _0x4d6efa){if(_0x4d6efa[_0x2527('0x1a')](_0xddbb83)){if(_0x4d6efa[_0xddbb83][_0x2527('0x15')]&&_0x4d6efa[_0xddbb83][_0x2527('0x13')]){var _0x431cad=_0x4d6efa[_0xddbb83][_0x2527('0x15')];if(!this[_0x2527('0xe')][_0x2527('0x1a')](_0x431cad['id'])){this[_0x2527('0xe')][_0x431cad['id']]=new EmailImap(_0x431cad,_0x4d6efa[_0xddbb83][_0x2527('0x4')]);this['imapAccounts'][_0x431cad['id']]['on'](_0x2527('0x1b'),this[_0x2527('0x1c')][_0x2527('0x1d')](this,_0xddbb83));this[_0x2527('0xe')][_0x431cad['id']]['on'](_0x2527('0x4'),this[_0x2527('0x1e')][_0x2527('0x1d')](this,_0xddbb83));this[_0x2527('0xe')][_0x431cad['id']]['on']('end',this['handleImapEnd']['bind'](this,_0xddbb83));this[_0x2527('0xe')][_0x431cad['id']]['on'](_0x2527('0x1f'),this[_0x2527('0x20')]['bind'](this,_0xddbb83));}}else{if(_[_0x2527('0x17')](this[_0x2527('0xd')][_0xddbb83]['Imap'])){this[_0x2527('0xd')][_0xddbb83][_0x2527('0x15')]={};}this[_0x2527('0xd')][_0xddbb83]['Imap']['status']=_0x2527('0x21');this[_0x2527('0xd')][_0xddbb83][_0x2527('0x15')]['messageStatus']='';this[_0x2527('0x11')](_0xddbb83);}}}};EmailChannel['prototype']['handleImapBox']=function(_0x2a93a8,_0x250b6c){if(this[_0x2527('0xd')][_0x2a93a8]){this['mailAccounts'][_0x2a93a8][_0x2527('0x15')][_0x2527('0x14')]=_0x2527('0x22');this[_0x2527('0xd')][_0x2a93a8][_0x2527('0x15')][_0x2527('0x16')]=_0x250b6c['name'];if(_0x250b6c[_0x2527('0x23')]){this[_0x2527('0xd')][_0x2a93a8][_0x2527('0x15')][_0x2527('0x24')]=_0x250b6c[_0x2527('0x23')]['total'];}return this[_0x2527('0x11')](_0x2a93a8);}};EmailChannel[_0x2527('0x10')][_0x2527('0x1e')]=function(_0x2fc7db,_0x31eb9b){logger[_0x2527('0xb')](_0x2527('0x25'),_0x31eb9b[_0x2527('0x26')],_0x31eb9b['lastName'],_0x31eb9b['from'],_0x2fc7db);if(this['mailAccounts'][_0x2fc7db]){return mailAccount['notify'](_0x2fc7db,_0x31eb9b)[_0x2527('0x27')](function(_0x33d278){if(_0x33d278){logger['info']('Mail\x20accepted\x20from\x20routing');}})[_0x2527('0x28')](function(_0x75fd7f){logger['error'](_0x2527('0x29'),JSON[_0x2527('0x2a')](_0x75fd7f));});}};EmailChannel[_0x2527('0x10')][_0x2527('0x2b')]=function(_0x34f107){if(this[_0x2527('0xd')][_0x34f107]&&this[_0x2527('0xd')][_0x34f107]['Imap']){if(this[_0x2527('0xe')][this['mailAccounts'][_0x34f107][_0x2527('0x15')]['id']]){delete this[_0x2527('0xe')][this[_0x2527('0xd')][_0x34f107][_0x2527('0x15')]['id']];}this[_0x2527('0xd')][_0x34f107][_0x2527('0x15')][_0x2527('0x2c')]=moment();this[_0x2527('0x11')](_0x34f107);}};EmailChannel[_0x2527('0x10')][_0x2527('0x20')]=function(_0x17cc8b,_0xe179f7){if(this[_0x2527('0xd')][_0x17cc8b]){this[_0x2527('0xd')][_0x17cc8b][_0x2527('0x15')][_0x2527('0x14')]=_0x2527('0x1f');this[_0x2527('0xd')][_0x17cc8b][_0x2527('0x15')]['messageStatus']=_0xe179f7;return this[_0x2527('0x11')](_0x17cc8b);}};EmailChannel[_0x2527('0x10')]['sendMail']=function(_0x105c3f,_0x518160){return this[_0x2527('0xf')][_0x2527('0x2d')](_0x105c3f,_0x518160);};EmailChannel[_0x2527('0x10')]['verifySmtp']=function(_0x48ee58){var _0x3895b9=this;if(this[_0x2527('0xd')][_0x48ee58['id']]){if(_['isNil'](this['mailAccounts'][_0x48ee58['id']][_0x2527('0x2e')])){this['mailAccounts'][_0x48ee58['id']]['Smtp']={};}this[_0x2527('0xd')][_0x48ee58['id']][_0x2527('0x2e')][_0x2527('0x2c')]=moment();return new BPromise(function(_0x440438,_0x52eb8f){return _0x3895b9[_0x2527('0xf')][_0x2527('0x2f')](_0x48ee58)[_0x2527('0x27')](function(_0x2a11d6){_0x3895b9['mailAccounts'][_0x48ee58['id']]['Smtp'][_0x2527('0x14')]=_0x2527('0x30');_0x3895b9[_0x2527('0xd')][_0x48ee58['id']][_0x2527('0x2e')][_0x2527('0x16')]='';_0x3895b9[_0x2527('0x11')](_0x48ee58['id']);_0x440438(_0x2a11d6);})[_0x2527('0x28')](function(_0x201e64){_0x3895b9[_0x2527('0xd')][_0x48ee58['id']][_0x2527('0x2e')]['status']=_0x2527('0x1f');_0x3895b9[_0x2527('0xd')][_0x48ee58['id']][_0x2527('0x2e')]['messageStatus']=_0x201e64;_0x3895b9['emit'](_0x48ee58['id']);_0x52eb8f(_0x201e64);});});}return this[_0x2527('0xf')]['verify'](_0x48ee58);};module[_0x2527('0x31')]=EmailChannel; \ No newline at end of file +var _0x1f5b=['active','imapAccounts','email','box','handleImapBox','bind','handleImapEnd','error','handleImapError','disabled','prototype','connected','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','then','info','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','Smtp','verify','verified','lodash','md5','ioredis','../../../config/environment','../../../config/logger','defaults','redis','localhost','socket.io-emitter','./smtp','start\x20email\x20channel','mailAccounts','smtp','emit','name','key','status','messageStatus','Imap','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1f5b,0xbb));var _0xb1f5=function(_0x2c5df7,_0x11d4c0){_0x2c5df7=_0x2c5df7-0x0;var _0x191918=_0x1f5b[_0x2c5df7];return _0x191918;};'use strict';var _=require(_0xb1f5('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0xb1f5('0x1'));var Redis=require(_0xb1f5('0x2'));var config=require(_0xb1f5('0x3'));var logger=require(_0xb1f5('0x4'))('email');config['redis']=_[_0xb1f5('0x5')](config[_0xb1f5('0x6')],{'host':_0xb1f5('0x7'),'port':0x18eb});var io=require(_0xb1f5('0x8'))(new Redis(config[_0xb1f5('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xb1f5('0x9'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x221237){logger['info'](_0xb1f5('0xa'));this[_0xb1f5('0xb')]=_0x221237[_0xb1f5('0xb')];this['imapAccounts']={};this[_0xb1f5('0xc')]=new EmailSmtp();}EmailChannel['prototype'][_0xb1f5('0xd')]=function(_0x1e6dd3){var _0x1a4fa2=this['mailAccounts'][_0x1e6dd3];var _0x2d6cf6={'id':_0x1a4fa2['id'],'name':_0x1a4fa2[_0xb1f5('0xe')],'key':_0x1a4fa2[_0xb1f5('0xf')],'active':_0x1a4fa2['active'],'Imap':{'status':_0x1a4fa2['Imap'][_0xb1f5('0x10')],'messageStatus':_0x1a4fa2['Imap'][_0xb1f5('0x11')],'total':_0x1a4fa2[_0xb1f5('0x12')][_0xb1f5('0x13')]}};if(_[_0xb1f5('0x14')](md5Accounts[_0x1e6dd3])){md5Accounts[_0x1e6dd3]={};}var _0x220ac3=md5(JSON[_0xb1f5('0x15')](_0x2d6cf6));if(md5Accounts[_0x1e6dd3][_0xb1f5('0x1')]!==_0x220ac3){md5Accounts[_0x1e6dd3][_0xb1f5('0x1')]=_0x220ac3;io[_0xb1f5('0xd')](_0xb1f5('0x16'),_0x2d6cf6);}};EmailChannel['prototype'][_0xb1f5('0x17')]=function(_0x388960){for(var _0x1f86e2 in _0x388960){if(_0x388960[_0xb1f5('0x18')](_0x1f86e2)){if(_0x388960[_0x1f86e2][_0xb1f5('0x12')]&&_0x388960[_0x1f86e2][_0xb1f5('0x19')]){var _0x5d27f8=_0x388960[_0x1f86e2][_0xb1f5('0x12')];if(!this[_0xb1f5('0x1a')][_0xb1f5('0x18')](_0x5d27f8['id'])){this[_0xb1f5('0x1a')][_0x5d27f8['id']]=new EmailImap(_0x5d27f8,_0x388960[_0x1f86e2][_0xb1f5('0x1b')]);this['imapAccounts'][_0x5d27f8['id']]['on'](_0xb1f5('0x1c'),this[_0xb1f5('0x1d')]['bind'](this,_0x1f86e2));this[_0xb1f5('0x1a')][_0x5d27f8['id']]['on'](_0xb1f5('0x1b'),this['handleImapEmail'][_0xb1f5('0x1e')](this,_0x1f86e2));this[_0xb1f5('0x1a')][_0x5d27f8['id']]['on']('end',this[_0xb1f5('0x1f')]['bind'](this,_0x1f86e2));this[_0xb1f5('0x1a')][_0x5d27f8['id']]['on'](_0xb1f5('0x20'),this[_0xb1f5('0x21')][_0xb1f5('0x1e')](this,_0x1f86e2));}}else{if(_[_0xb1f5('0x14')](this[_0xb1f5('0xb')][_0x1f86e2][_0xb1f5('0x12')])){this[_0xb1f5('0xb')][_0x1f86e2][_0xb1f5('0x12')]={};}this['mailAccounts'][_0x1f86e2][_0xb1f5('0x12')][_0xb1f5('0x10')]=_0xb1f5('0x22');this[_0xb1f5('0xb')][_0x1f86e2]['Imap']['messageStatus']='';this['emit'](_0x1f86e2);}}}};EmailChannel[_0xb1f5('0x23')][_0xb1f5('0x1d')]=function(_0x335662,_0x566721){if(this[_0xb1f5('0xb')][_0x335662]){this['mailAccounts'][_0x335662]['Imap'][_0xb1f5('0x10')]=_0xb1f5('0x24');this[_0xb1f5('0xb')][_0x335662][_0xb1f5('0x12')][_0xb1f5('0x11')]=_0x566721[_0xb1f5('0xe')];if(_0x566721[_0xb1f5('0x25')]){this[_0xb1f5('0xb')][_0x335662][_0xb1f5('0x12')][_0xb1f5('0x13')]=_0x566721[_0xb1f5('0x25')][_0xb1f5('0x13')];}return this['emit'](_0x335662);}};EmailChannel['prototype'][_0xb1f5('0x26')]=function(_0x2d32a0,_0x44848a){logger['info'](_0xb1f5('0x27'),_0x44848a[_0xb1f5('0x28')],_0x44848a[_0xb1f5('0x29')],_0x44848a['from'],_0x2d32a0);if(this[_0xb1f5('0xb')][_0x2d32a0]){return mailAccount['notify'](_0x2d32a0,_0x44848a)[_0xb1f5('0x2a')](function(_0x330463){if(_0x330463){logger[_0xb1f5('0x2b')](_0xb1f5('0x2c'));}})[_0xb1f5('0x2d')](function(_0x42798e){logger[_0xb1f5('0x20')](_0xb1f5('0x2e'),JSON[_0xb1f5('0x15')](_0x42798e));});}};EmailChannel[_0xb1f5('0x23')]['handleImapEnd']=function(_0x5af92a){if(this[_0xb1f5('0xb')][_0x5af92a]&&this[_0xb1f5('0xb')][_0x5af92a]['Imap']){if(this['imapAccounts'][this[_0xb1f5('0xb')][_0x5af92a][_0xb1f5('0x12')]['id']]){delete this['imapAccounts'][this['mailAccounts'][_0x5af92a][_0xb1f5('0x12')]['id']];}this[_0xb1f5('0xb')][_0x5af92a][_0xb1f5('0x12')][_0xb1f5('0x2f')]=moment();this[_0xb1f5('0xd')](_0x5af92a);}};EmailChannel['prototype'][_0xb1f5('0x21')]=function(_0x18ca3a,_0xd6ac8b){if(this[_0xb1f5('0xb')][_0x18ca3a]){this[_0xb1f5('0xb')][_0x18ca3a][_0xb1f5('0x12')]['status']=_0xb1f5('0x20');this[_0xb1f5('0xb')][_0x18ca3a][_0xb1f5('0x12')][_0xb1f5('0x11')]=_0xd6ac8b;return this[_0xb1f5('0xd')](_0x18ca3a);}};EmailChannel['prototype'][_0xb1f5('0x30')]=function(_0x5334eb,_0x3eb6db){return this[_0xb1f5('0xc')][_0xb1f5('0x31')](_0x5334eb,_0x3eb6db);};EmailChannel['prototype']['verifySmtp']=function(_0x55e42a){var _0xc7ec1a=this;if(this[_0xb1f5('0xb')][_0x55e42a['id']]){if(_[_0xb1f5('0x14')](this[_0xb1f5('0xb')][_0x55e42a['id']][_0xb1f5('0x32')])){this[_0xb1f5('0xb')][_0x55e42a['id']][_0xb1f5('0x32')]={};}this[_0xb1f5('0xb')][_0x55e42a['id']][_0xb1f5('0x32')]['lastSync']=moment();return new BPromise(function(_0x55257c,_0x5b2439){return _0xc7ec1a[_0xb1f5('0xc')][_0xb1f5('0x33')](_0x55e42a)[_0xb1f5('0x2a')](function(_0x496f43){_0xc7ec1a['mailAccounts'][_0x55e42a['id']][_0xb1f5('0x32')][_0xb1f5('0x10')]=_0xb1f5('0x34');_0xc7ec1a['mailAccounts'][_0x55e42a['id']][_0xb1f5('0x32')][_0xb1f5('0x11')]='';_0xc7ec1a[_0xb1f5('0xd')](_0x55e42a['id']);_0x55257c(_0x496f43);})[_0xb1f5('0x2d')](function(_0x212628){_0xc7ec1a[_0xb1f5('0xb')][_0x55e42a['id']][_0xb1f5('0x32')]['status']=_0xb1f5('0x20');_0xc7ec1a['mailAccounts'][_0x55e42a['id']]['Smtp'][_0xb1f5('0x11')]=_0x212628;_0xc7ec1a['emit'](_0x55e42a['id']);_0x5b2439(_0x212628);});});}return this[_0xb1f5('0xc')]['verify'](_0x55e42a);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index a22e35e..813e703 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 _0xdcf0=['imap','lodash','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','INBOX','account','getAccount','once','ready','bind','handleEnd','error','handleError','connect','inherits','connTimeout','authentication','user','password','host','port','tls','required','getHost','service','anonymous@xcally.com','handleReady','openBox','mailbox','handleOpenBox','emit','readUnseen','prototype','handleCloseBox','end','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageAttributes','handleMessageBody','handleSimpleParser','handleMessageEnd','parser','stringify','textCode','hasOwnProperty','upperFirst'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdcf0,0x16e));var _0x0dcf=function(_0x2a4a6d,_0x2bb1cc){_0x2a4a6d=_0x2a4a6d-0x0;var _0x3e0dd2=_0xdcf0[_0x2a4a6d];return _0x3e0dd2;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require(_0x0dcf('0x0'));var _=require(_0x0dcf('0x1'));var rs=require('randomstring');var simpleParser=require(_0x0dcf('0x2'))[_0x0dcf('0x3')];var Iconv=require(_0x0dcf('0x4'))[_0x0dcf('0x5')];var EventEmitter=require(_0x0dcf('0x6'))[_0x0dcf('0x7')];var utils=require(_0x0dcf('0x8'));var logger=require(_0x0dcf('0x9'))(_0x0dcf('0xa'));function EmailImap(_0x44f09d,_0x543b74){this['mailbox']=_0x0dcf('0xb');this[_0x0dcf('0xc')]=this[_0x0dcf('0xd')](_0x44f09d,_0x543b74);this[_0x0dcf('0x0')]=new Imap(this['account']);this['imap'][_0x0dcf('0xe')](_0x0dcf('0xf'),this['handleReady'][_0x0dcf('0x10')](this));this['imap']['once']('end',this[_0x0dcf('0x11')][_0x0dcf('0x10')](this));this[_0x0dcf('0x0')]['on'](_0x0dcf('0x12'),this[_0x0dcf('0x13')][_0x0dcf('0x10')](this));this[_0x0dcf('0x0')][_0x0dcf('0x14')]();}util[_0x0dcf('0x15')](EmailImap,EventEmitter);EmailImap['prototype'][_0x0dcf('0xd')]=function(_0x1db0e6,_0xfca3a9){var _0x48414e={'connTimeout':_0x1db0e6[_0x0dcf('0x16')]?_0x1db0e6[_0x0dcf('0x16')]*0x3e8:0x2710,'authTimeout':_0x1db0e6['authTimeout']?_0x1db0e6['authTimeout']*0x3e8:0x1388};if(_['isNil'](_0x1db0e6['service'])){if(_0x1db0e6[_0x0dcf('0x17')]){_0x48414e[_0x0dcf('0x18')]=_0x1db0e6[_0x0dcf('0x18')];_0x48414e['password']=_0x1db0e6[_0x0dcf('0x19')];}_0x48414e['host']=_0x1db0e6[_0x0dcf('0x1a')];_0x48414e[_0x0dcf('0x1b')]=_0x1db0e6['port']||0x3e1;if(_0x1db0e6[_0x0dcf('0x1c')]){_0x48414e[_0x0dcf('0x1c')]=!![];}else{_0x48414e[_0x0dcf('0x1c')]=![];_0x48414e['autotls']=_0x0dcf('0x1d');}}else{_0x48414e['user']=_0x1db0e6['user'];_0x48414e[_0x0dcf('0x19')]=_0x1db0e6[_0x0dcf('0x19')];_0x48414e[_0x0dcf('0x1a')]=utils[_0x0dcf('0x1e')](_0x1db0e6[_0x0dcf('0x1f')]);_0x48414e[_0x0dcf('0x1b')]=0x3e1;_0x48414e[_0x0dcf('0x1c')]=!![];}_0x48414e[_0x0dcf('0xa')]=_0xfca3a9||_0x1db0e6[_0x0dcf('0x18')]||_0x0dcf('0x20');return _0x48414e;};EmailImap['prototype'][_0x0dcf('0x21')]=function(){this[_0x0dcf('0x0')][_0x0dcf('0x22')](this[_0x0dcf('0x23')],![],this['handleOpenBox'][_0x0dcf('0x10')](this));};EmailImap['prototype'][_0x0dcf('0x24')]=function(_0x5e56ca,_0x431349){if(_0x5e56ca){this[_0x0dcf('0x13')](_0x5e56ca,!![]);}else{this[_0x0dcf('0x25')]('box',_0x431349);this[_0x0dcf('0x26')]();}};EmailImap[_0x0dcf('0x27')][_0x0dcf('0x28')]=function(_0x4a7aff){if(_0x4a7aff){this[_0x0dcf('0x13')](_0x4a7aff,!![]);}else{this[_0x0dcf('0x0')][_0x0dcf('0x29')]();}};EmailImap['prototype'][_0x0dcf('0x26')]=function(){this[_0x0dcf('0x0')][_0x0dcf('0x2a')]([_0x0dcf('0x2b')],this[_0x0dcf('0x2c')]['bind'](this));};EmailImap[_0x0dcf('0x27')]['handleReadUnseen']=function(_0x440d9b,_0x5339bc){if(_0x440d9b){this['handleError'](_0x440d9b,!![]);}else{if(_0x5339bc[_0x0dcf('0x2d')]){try{var _0x3c92b8=this[_0x0dcf('0x0')][_0x0dcf('0x2e')](_0x5339bc,{'bodies':'','markSeen':!![]});_0x3c92b8['on']('message',this[_0x0dcf('0x2f')][_0x0dcf('0x10')](this));_0x3c92b8['once'](_0x0dcf('0x12'),this[_0x0dcf('0x30')][_0x0dcf('0x10')](this));_0x3c92b8[_0x0dcf('0xe')]('end',this[_0x0dcf('0x31')][_0x0dcf('0x10')](this));}catch(_0x57ed5f){logger[_0x0dcf('0x12')](_0x57ed5f);}}else{this[_0x0dcf('0x0')][_0x0dcf('0x32')](!![],this[_0x0dcf('0x28')][_0x0dcf('0x10')](this));}}};EmailImap['prototype'][_0x0dcf('0x2f')]=function(_0x2b876c,_0x41d7a8){_0x2b876c['on'](_0x0dcf('0x33'),this['handleMessageBody'][_0x0dcf('0x10')](this));_0x2b876c[_0x0dcf('0xe')]('attributes',this[_0x0dcf('0x34')][_0x0dcf('0x10')](this));_0x2b876c[_0x0dcf('0xe')](_0x0dcf('0x29'),this['handleMessageEnd'][_0x0dcf('0x10')](this));};EmailImap[_0x0dcf('0x27')][_0x0dcf('0x35')]=function(_0x3404e1,_0x35630a){simpleParser(_0x3404e1,{'Iconv':Iconv},this[_0x0dcf('0x36')][_0x0dcf('0x10')](this));};EmailImap[_0x0dcf('0x27')][_0x0dcf('0x34')]=function(_0x42be00){};EmailImap[_0x0dcf('0x27')][_0x0dcf('0x37')]=function(){};EmailImap[_0x0dcf('0x27')][_0x0dcf('0x36')]=function(_0x59f773,_0x45101f){if(_0x59f773){logger[_0x0dcf('0x12')](_0x59f773);}else{var _0x22c495=this;utils[_0x0dcf('0x38')](this[_0x0dcf('0xc')],_0x45101f,function(_0x4e48cb){_0x22c495['emit'](_0x0dcf('0xa'),_0x4e48cb);});}};EmailImap[_0x0dcf('0x27')][_0x0dcf('0x31')]=function(){this[_0x0dcf('0x0')]['closeBox'](!![],this[_0x0dcf('0x28')][_0x0dcf('0x10')](this));};EmailImap['prototype']['handleFetchError']=function(_0xf67022){this[_0x0dcf('0x13')](_0xf67022);this[_0x0dcf('0x0')][_0x0dcf('0x32')](!![],this[_0x0dcf('0x28')][_0x0dcf('0x10')](this));};EmailImap[_0x0dcf('0x27')][_0x0dcf('0x11')]=function(){this[_0x0dcf('0x25')](_0x0dcf('0x29'));};EmailImap[_0x0dcf('0x27')][_0x0dcf('0x13')]=function(_0x34fec0,_0x264e82){logger[_0x0dcf('0x12')](_0x0dcf('0x13'),this[_0x0dcf('0xc')][_0x0dcf('0xa')],JSON[_0x0dcf('0x39')](_0x34fec0));var _0x10eacb='';if(_0x34fec0){if(_0x34fec0[_0x0dcf('0x3a')]){_0x10eacb=_0x34fec0[_0x0dcf('0x3a')];}else{for(var _0x1c0f86 in _0x34fec0){if(_0x34fec0[_0x0dcf('0x3b')](_0x1c0f86)){_0x10eacb+=_[_0x0dcf('0x3c')](_0x1c0f86)+':\x20'+_0x34fec0[_0x1c0f86]+'\x0a';}}}}if(_0x264e82){this[_0x0dcf('0x0')]['end']();}else{this[_0x0dcf('0x25')]('error',_0x10eacb);this['emit'](_0x0dcf('0x29'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x6c5e=['error','connect','inherits','prototype','connTimeout','authTimeout','isNil','authentication','user','password','host','port','tls','required','getHost','service','anonymous@xcally.com','openBox','handleOpenBox','handleError','emit','box','handleCloseBox','end','readUnseen','search','UNSEEN','handleReadUnseen','message','handleFetchMessage','handleFetchError','handleFetchEnd','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','closeBox','stringify','textCode','hasOwnProperty','upperFirst','exports','imap','lodash','randomstring','mailparser','iconv','EventEmitter','./utils','email','mailbox','INBOX','account','getAccount','once','ready','handleReady','bind','handleEnd'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x6c5e,0xe7));var _0xe6c5=function(_0x21d6fa,_0x5e623a){_0x21d6fa=_0x21d6fa-0x0;var _0x405b62=_0x6c5e[_0x21d6fa];return _0x405b62;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require(_0xe6c5('0x0'));var _=require(_0xe6c5('0x1'));var rs=require(_0xe6c5('0x2'));var simpleParser=require(_0xe6c5('0x3'))['simpleParser'];var Iconv=require(_0xe6c5('0x4'))['Iconv'];var EventEmitter=require('events')[_0xe6c5('0x5')];var utils=require(_0xe6c5('0x6'));var logger=require('../../../config/logger')(_0xe6c5('0x7'));function EmailImap(_0x3c1a09,_0x40dae4){this[_0xe6c5('0x8')]=_0xe6c5('0x9');this[_0xe6c5('0xa')]=this[_0xe6c5('0xb')](_0x3c1a09,_0x40dae4);this['imap']=new Imap(this[_0xe6c5('0xa')]);this[_0xe6c5('0x0')][_0xe6c5('0xc')](_0xe6c5('0xd'),this[_0xe6c5('0xe')][_0xe6c5('0xf')](this));this['imap'][_0xe6c5('0xc')]('end',this[_0xe6c5('0x10')][_0xe6c5('0xf')](this));this[_0xe6c5('0x0')]['on'](_0xe6c5('0x11'),this['handleError'][_0xe6c5('0xf')](this));this['imap'][_0xe6c5('0x12')]();}util[_0xe6c5('0x13')](EmailImap,EventEmitter);EmailImap[_0xe6c5('0x14')][_0xe6c5('0xb')]=function(_0x10432e,_0x2b3204){var _0x4a57d0={'connTimeout':_0x10432e[_0xe6c5('0x15')]?_0x10432e[_0xe6c5('0x15')]*0x3e8:0x2710,'authTimeout':_0x10432e[_0xe6c5('0x16')]?_0x10432e[_0xe6c5('0x16')]*0x3e8:0x1388};if(_[_0xe6c5('0x17')](_0x10432e['service'])){if(_0x10432e[_0xe6c5('0x18')]){_0x4a57d0['user']=_0x10432e[_0xe6c5('0x19')];_0x4a57d0[_0xe6c5('0x1a')]=_0x10432e['password'];}_0x4a57d0[_0xe6c5('0x1b')]=_0x10432e[_0xe6c5('0x1b')];_0x4a57d0[_0xe6c5('0x1c')]=_0x10432e[_0xe6c5('0x1c')]||0x3e1;if(_0x10432e[_0xe6c5('0x1d')]){_0x4a57d0[_0xe6c5('0x1d')]=!![];}else{_0x4a57d0[_0xe6c5('0x1d')]=![];_0x4a57d0['autotls']=_0xe6c5('0x1e');}}else{_0x4a57d0[_0xe6c5('0x19')]=_0x10432e[_0xe6c5('0x19')];_0x4a57d0[_0xe6c5('0x1a')]=_0x10432e[_0xe6c5('0x1a')];_0x4a57d0['host']=utils[_0xe6c5('0x1f')](_0x10432e[_0xe6c5('0x20')]);_0x4a57d0[_0xe6c5('0x1c')]=0x3e1;_0x4a57d0[_0xe6c5('0x1d')]=!![];}_0x4a57d0[_0xe6c5('0x7')]=_0x2b3204||_0x10432e['user']||_0xe6c5('0x21');return _0x4a57d0;};EmailImap[_0xe6c5('0x14')][_0xe6c5('0xe')]=function(){this[_0xe6c5('0x0')][_0xe6c5('0x22')](this['mailbox'],![],this[_0xe6c5('0x23')][_0xe6c5('0xf')](this));};EmailImap['prototype'][_0xe6c5('0x23')]=function(_0xbb14e,_0x1e3dee){if(_0xbb14e){this[_0xe6c5('0x24')](_0xbb14e,!![]);}else{this[_0xe6c5('0x25')](_0xe6c5('0x26'),_0x1e3dee);this['readUnseen']();}};EmailImap[_0xe6c5('0x14')][_0xe6c5('0x27')]=function(_0x43bf92){if(_0x43bf92){this[_0xe6c5('0x24')](_0x43bf92,!![]);}else{this[_0xe6c5('0x0')][_0xe6c5('0x28')]();}};EmailImap[_0xe6c5('0x14')][_0xe6c5('0x29')]=function(){this[_0xe6c5('0x0')][_0xe6c5('0x2a')]([_0xe6c5('0x2b')],this[_0xe6c5('0x2c')][_0xe6c5('0xf')](this));};EmailImap[_0xe6c5('0x14')][_0xe6c5('0x2c')]=function(_0x2ea5b3,_0x262012){if(_0x2ea5b3){this['handleError'](_0x2ea5b3,!![]);}else{if(_0x262012['length']){try{var _0x54abf1=this[_0xe6c5('0x0')]['fetch'](_0x262012,{'bodies':'','markSeen':!![]});_0x54abf1['on'](_0xe6c5('0x2d'),this[_0xe6c5('0x2e')][_0xe6c5('0xf')](this));_0x54abf1[_0xe6c5('0xc')]('error',this[_0xe6c5('0x2f')][_0xe6c5('0xf')](this));_0x54abf1[_0xe6c5('0xc')](_0xe6c5('0x28'),this[_0xe6c5('0x30')][_0xe6c5('0xf')](this));}catch(_0x5664e6){logger['error'](_0x5664e6);}}else{this['imap']['closeBox'](!![],this[_0xe6c5('0x27')][_0xe6c5('0xf')](this));}}};EmailImap[_0xe6c5('0x14')][_0xe6c5('0x2e')]=function(_0x57753c,_0x13e7ea){_0x57753c['on'](_0xe6c5('0x31'),this[_0xe6c5('0x32')]['bind'](this));_0x57753c[_0xe6c5('0xc')](_0xe6c5('0x33'),this[_0xe6c5('0x34')][_0xe6c5('0xf')](this));_0x57753c['once']('end',this['handleMessageEnd']['bind'](this));};EmailImap[_0xe6c5('0x14')][_0xe6c5('0x32')]=function(_0x56340a,_0x31cbc2){simpleParser(_0x56340a,{'Iconv':Iconv},this[_0xe6c5('0x35')][_0xe6c5('0xf')](this));};EmailImap['prototype'][_0xe6c5('0x34')]=function(_0x17f43f){};EmailImap[_0xe6c5('0x14')][_0xe6c5('0x36')]=function(){};EmailImap['prototype'][_0xe6c5('0x35')]=function(_0x48d9dd,_0xd69a01){if(_0x48d9dd){logger[_0xe6c5('0x11')](_0x48d9dd);}else{var _0x4441e5=this;utils[_0xe6c5('0x37')](this[_0xe6c5('0xa')],_0xd69a01,function(_0x37cbef){_0x4441e5[_0xe6c5('0x25')]('email',_0x37cbef);});}};EmailImap[_0xe6c5('0x14')][_0xe6c5('0x30')]=function(){this[_0xe6c5('0x0')][_0xe6c5('0x38')](!![],this[_0xe6c5('0x27')][_0xe6c5('0xf')](this));};EmailImap[_0xe6c5('0x14')][_0xe6c5('0x2f')]=function(_0x5ec819){this[_0xe6c5('0x24')](_0x5ec819);this[_0xe6c5('0x0')]['closeBox'](!![],this[_0xe6c5('0x27')][_0xe6c5('0xf')](this));};EmailImap[_0xe6c5('0x14')][_0xe6c5('0x10')]=function(){this[_0xe6c5('0x25')](_0xe6c5('0x28'));};EmailImap[_0xe6c5('0x14')][_0xe6c5('0x24')]=function(_0x21e8d9,_0xf0471d){logger[_0xe6c5('0x11')](_0xe6c5('0x24'),this[_0xe6c5('0xa')][_0xe6c5('0x7')],JSON[_0xe6c5('0x39')](_0x21e8d9));var _0x210029='';if(_0x21e8d9){if(_0x21e8d9[_0xe6c5('0x3a')]){_0x210029=_0x21e8d9[_0xe6c5('0x3a')];}else{for(var _0x23ab02 in _0x21e8d9){if(_0x21e8d9[_0xe6c5('0x3b')](_0x23ab02)){_0x210029+=_[_0xe6c5('0x3c')](_0x23ab02)+':\x20'+_0x21e8d9[_0x23ab02]+'\x0a';}}}}if(_0xf0471d){this['imap']['end']();}else{this[_0xe6c5('0x25')](_0xe6c5('0x11'),_0x210029);this['emit']('end');}};module[_0xe6c5('0x3d')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 4a3ea4c..51793d1 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 _0xfed3=['send','compile','sendMail','verify','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype'];(function(_0x2d39e8,_0x36c897){var _0x487d9d=function(_0x3156b7){while(--_0x3156b7){_0x2d39e8['push'](_0x2d39e8['shift']());}};_0x487d9d(++_0x36c897);}(_0xfed3,0x14c));var _0x3fed=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0xfed3[_0x580647];return _0x5f0792;};'use strict';var nodemailer=require(_0x3fed('0x0'));var BPromise=require(_0x3fed('0x1'));var inlineBase64=require(_0x3fed('0x2'));function EmailSmtp(){}EmailSmtp[_0x3fed('0x3')][_0x3fed('0x4')]=function(_0x2ac77e,_0x21b802){return new BPromise(function(_0x3429d9,_0x14ddb4){var _0x503d33=nodemailer['createTransport'](_0x2ac77e);_0x503d33['use'](_0x3fed('0x5'),inlineBase64());_0x503d33[_0x3fed('0x6')](_0x21b802,function(_0x48b8aa,_0x46202c){if(_0x48b8aa){_0x14ddb4(_0x48b8aa['toString']());}else{_0x3429d9(_0x46202c);}});});};EmailSmtp['prototype'][_0x3fed('0x7')]=function(_0x16f363){return new BPromise(function(_0x318342,_0x49316b){var _0x5c0723=nodemailer['createTransport'](_0x16f363);_0x5c0723[_0x3fed('0x7')](function(_0x32a8bf,_0x4a945c){if(_0x32a8bf){_0x49316b(_0x32a8bf['toString']());}else{if(_0x4a945c){_0x318342(_0x4a945c);}else{_0x49316b('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x373a=['sendMail','toString','verify','createTransport','Not\x20verifired','exports','bluebird','nodemailer-plugin-inline-base64','prototype','send','use','compile'];(function(_0x8aa7bd,_0x5b41c1){var _0x396c84=function(_0x363b4e){while(--_0x363b4e){_0x8aa7bd['push'](_0x8aa7bd['shift']());}};_0x396c84(++_0x5b41c1);}(_0x373a,0xde));var _0xa373=function(_0x561cb7,_0x4f36a3){_0x561cb7=_0x561cb7-0x0;var _0x16d76b=_0x373a[_0x561cb7];return _0x16d76b;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0xa373('0x0'));var inlineBase64=require(_0xa373('0x1'));function EmailSmtp(){}EmailSmtp[_0xa373('0x2')][_0xa373('0x3')]=function(_0x425860,_0x4dbae9){return new BPromise(function(_0x2a0046,_0x59946b){var _0x30600a=nodemailer['createTransport'](_0x425860);_0x30600a[_0xa373('0x4')](_0xa373('0x5'),inlineBase64());_0x30600a[_0xa373('0x6')](_0x4dbae9,function(_0x26af28,_0x3c29a6){if(_0x26af28){_0x59946b(_0x26af28[_0xa373('0x7')]());}else{_0x2a0046(_0x3c29a6);}});});};EmailSmtp[_0xa373('0x2')][_0xa373('0x8')]=function(_0x5655d7){return new BPromise(function(_0x31b7bf,_0x8b8e63){var _0x4d0266=nodemailer[_0xa373('0x9')](_0x5655d7);_0x4d0266[_0xa373('0x8')](function(_0x26a395,_0x1a48a2){if(_0x26a395){_0x8b8e63(_0x26a395[_0xa373('0x7')]());}else{if(_0x1a48a2){_0x31b7bf(_0x1a48a2);}else{_0x8b8e63(_0xa373('0xa'));}}});});};module[_0xa373('0xb')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 14d44e3..3ad89ea 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 _0x5d89=['messageId','inReplyTo','date','format','YYYY-MM-DD\x20HH:mm:ss','filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','BodyHTML','

Empty\x20message

','Attachments','Data','getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','lodash','moment','randomstring','util','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','split','length','slice','join','Anonymous','pop','test','html','replace','includes','','body','textAsHtml','0x1?_0x249394[_0x95d8('0x12')]():'';}return'';}function getMails(_0x521f40,_0x51e80b){var _0x59c6a4='';for(var _0x3b715f=0x0;_0x3b715f<_0x51e80b['value']['length'];_0x3b715f+=0x1){if(_0x51e80b[_0x95d8('0x7')][_0x3b715f]['address']!==_0x521f40){if(!_['isEmpty'](_0x59c6a4)){_0x59c6a4+=',';}_0x59c6a4+=_0x51e80b[_0x95d8('0x7')][_0x3b715f][_0x95d8('0xc')]||_0x51e80b[_0x95d8('0x7')][_0x3b715f][_0x95d8('0x8')]||'';_0x59c6a4+='\x20<';_0x59c6a4+=_0x51e80b[_0x95d8('0x7')][_0x3b715f]['address']?_0x51e80b['value'][_0x3b715f][_0x95d8('0x8')]:'anonymous'+random[_0x95d8('0xa')](0x6)+_0x95d8('0xb');_0x59c6a4+='>';}}return _0x59c6a4;}function parseEmail(_0x1bfd84,_0x111d53,_0x2bd8d9){if(_0x111d53['html']){var _0x332740=/)<[^<]*)*<\/script>/gi;while(_0x332740[_0x95d8('0x13')](_0x111d53[_0x95d8('0x14')])){_0x111d53[_0x95d8('0x14')]=_0x111d53['html'][_0x95d8('0x15')](_0x332740,'');}if(_0x111d53[_0x95d8('0x14')][_0x95d8('0x16')](_0x95d8('0x17'))){var _0xb95644=[];_0x111d53['attachments']['forEach'](_0x4c34a2=>{_0xb95644[_0x95d8('0x18')](_0x4c34a2['filename']);});var _0x4a29dd=/]+>/g;var _0x473805=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0xc4b7ec=_0x111d53[_0x95d8('0x14')][_0x95d8('0x15')](_0x473805,_0x95d8('0x19'));var _0x1544ba=_0xc4b7ec[_0x95d8('0x15')](_0x4a29dd,_0x95d8('0x1a'));for(let _0x51f9fc=0x0;_0x51f9fc<_0xb95644[_0x95d8('0xe')];_0x51f9fc++){var _0x10c109=_0x1544ba[_0x95d8('0x15')]('_IMG','\x20[Attachment:\x20'+_0xb95644[_0x51f9fc]+_0x95d8('0x1b'));_0x1544ba=_0x10c109;}_0x111d53[_0x95d8('0x14')]=_0x1544ba;}_0x2bd8d9[_0x95d8('0x1c')]=_0x111d53['html'];}else{_0x2bd8d9[_0x95d8('0x1c')]=_0x111d53[_0x95d8('0x1d')];}if(_0x2bd8d9[_0x95d8('0x1c')]){_0x2bd8d9['body']=_0x2bd8d9['body'][_0x95d8('0x15')](/','body','Empty\x20message

','Attachments','Title','Data','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','address','generate','head','value','split','length','slice','join','name','Anonymous','pop'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x5b72,0x13d));var _0x25b7=function(_0x54168a,_0x381dee){_0x54168a=_0x54168a-0x0;var _0x5c7866=_0x5b72[_0x54168a];return _0x5c7866;};'use strict';var _=require('lodash');var moment=require('moment');var random=require(_0x25b7('0x0'));var fs=require('fs');var path=require(_0x25b7('0x1'));var util=require(_0x25b7('0x2'));var tnef=require(_0x25b7('0x3'));var logger=require(_0x25b7('0x4'))(_0x25b7('0x5'));var config=require(_0x25b7('0x6'));function getAddress(_0x161b20){var _0x1fe180=_['head'](_0x161b20['value']);return _0x1fe180&&_0x1fe180['address']?_0x1fe180[_0x25b7('0x7')]:'anonymous'+random[_0x25b7('0x8')](0x6)+'@xcally.com';}function getFirstName(_0x15e50d){var _0x2b6d09=_[_0x25b7('0x9')](_0x15e50d[_0x25b7('0xa')]);if(_0x2b6d09&&_0x2b6d09['name']){var _0x1db11e=_0x2b6d09['name'][_0x25b7('0xb')](/\s+/);return _0x1db11e[_0x25b7('0xc')]?_0x1db11e[_0x25b7('0xd')](0x0,-0x1)[_0x25b7('0xe')]('\x20'):_0x2b6d09[_0x25b7('0xf')];}return _0x25b7('0x10');}function getLastName(_0x38c206){var _0x55c416=_[_0x25b7('0x9')](_0x38c206['value']);if(_0x55c416&&_0x55c416['name']){var _0x1a28a4=_0x55c416[_0x25b7('0xf')][_0x25b7('0xb')](/\s+/);return _0x1a28a4['length']>0x1?_0x1a28a4[_0x25b7('0x11')]():'';}return'';}function getMails(_0x188688,_0x33487f){var _0x377b7c='';for(var _0x1c5523=0x0;_0x1c5523<_0x33487f[_0x25b7('0xa')][_0x25b7('0xc')];_0x1c5523+=0x1){if(_0x33487f[_0x25b7('0xa')][_0x1c5523][_0x25b7('0x7')]!==_0x188688){if(!_[_0x25b7('0x12')](_0x377b7c)){_0x377b7c+=',';}_0x377b7c+=_0x33487f[_0x25b7('0xa')][_0x1c5523]['name']||_0x33487f['value'][_0x1c5523][_0x25b7('0x7')]||'';_0x377b7c+='\x20<';_0x377b7c+=_0x33487f['value'][_0x1c5523][_0x25b7('0x7')]?_0x33487f[_0x25b7('0xa')][_0x1c5523][_0x25b7('0x7')]:'anonymous'+random[_0x25b7('0x8')](0x6)+_0x25b7('0x13');_0x377b7c+='>';}}return _0x377b7c;}function parseEmail(_0x40a262,_0x39a9c1,_0x5e4c2a){if(_0x39a9c1['html']){var _0x281fd8=/)<[^<]*)*<\/script>/gi;while(_0x281fd8[_0x25b7('0x14')](_0x39a9c1[_0x25b7('0x15')])){_0x39a9c1[_0x25b7('0x15')]=_0x39a9c1[_0x25b7('0x15')][_0x25b7('0x16')](_0x281fd8,'');}if(_0x39a9c1[_0x25b7('0x15')][_0x25b7('0x17')]('{_0x3363c6[_0x25b7('0x1a')](_0x14774e['filename']);});var _0x3b8fea=/]+>/g;var _0x22bae0=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0xd9c37d=_0x39a9c1[_0x25b7('0x15')]['replace'](_0x22bae0,'_SRC');var _0x4811bd=_0xd9c37d[_0x25b7('0x16')](_0x3b8fea,'_IMG');for(let _0x53c1c2=0x0;_0x53c1c2<_0x3363c6[_0x25b7('0xc')];_0x53c1c2++){var _0x2c85dc=_0x4811bd['replace'](_0x25b7('0x1b'),'\x20[Attachment:\x20'+_0x3363c6[_0x53c1c2]+_0x25b7('0x1c'));_0x4811bd=_0x2c85dc;}_0x39a9c1[_0x25b7('0x15')]=_0x4811bd;}_0x5e4c2a['body']=_0x39a9c1[_0x25b7('0x15')];}else{_0x5e4c2a[_0x25b7('0x1d')]=_0x39a9c1['textAsHtml'];}if(_0x5e4c2a[_0x25b7('0x1d')]){_0x5e4c2a[_0x25b7('0x1d')]=_0x5e4c2a[_0x25b7('0x1d')]['replace'](/0x0){if(this[_0x210d19+'Capacity']>0x0&&this[_0x210d19+_0xab6f('0x27')]>=this[_0x210d19+_0xab6f('0x28')]){return _0xab6f('0x29');}else{return _0xab6f('0x2a');}}else{return _0xab6f('0x2b');}};Agent[_0xab6f('0x25')][_0xab6f('0x24')]=function(){var _0x5634c5=[_0xab6f('0x2c'),_0xab6f('0x2d'),'openchannel',_0xab6f('0x2e'),_0xab6f('0x2f'),_0xab6f('0x30')];for(var _0x2e10a7=0x0;_0x2e10a7<_0x5634c5[_0xab6f('0x31')];_0x2e10a7+=0x1){var _0x4c2d80=this[_0xab6f('0x26')](_0x5634c5[_0x2e10a7]);if(this[_0x5634c5[_0x2e10a7]+_0xab6f('0x32')]!==_0x4c2d80){this[_0x5634c5[_0x2e10a7]+'StatusTime']=_[_0xab6f('0x33')](moment()[_0xab6f('0x34')]('x'));}this[_0x5634c5[_0x2e10a7]+_0xab6f('0x32')]=_0x4c2d80;}var _0x2f8ebc={'id':this['id'],'name':this[_0xab6f('0x5')],'online':this[_0xab6f('0x6')],'voicePause':this['voicePause'],'chatPause':this[_0xab6f('0x8')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xab6f('0xe')],'chatCapacity':this[_0xab6f('0xf')],'chatCurrentCapacity':this[_0xab6f('0x10')],'mailStatus':this[_0xab6f('0x11')],'mailStatusTime':this[_0xab6f('0x13')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0xab6f('0x15')],'faxStatus':this[_0xab6f('0x16')],'faxStatusTime':this[_0xab6f('0x17')],'faxCapacity':this[_0xab6f('0x35')],'faxCurrentCapacity':this[_0xab6f('0x18')],'smsStatus':this[_0xab6f('0x36')],'smsStatusTime':this[_0xab6f('0x19')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xab6f('0x1b')],'whatsappStatus':this[_0xab6f('0x37')],'whatsappStatusTime':this[_0xab6f('0x1c')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0xab6f('0x1e')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xab6f('0x38')],'openchannelCapacity':this[_0xab6f('0x20')],'openchannelCurrentCapacity':this[_0xab6f('0x21')],'busy':this[_0xab6f('0x39')],'busyQueue':this[_0xab6f('0x22')]};var _0x184cd4=md5(JSON[_0xab6f('0x3a')](_0x2f8ebc));if(this[_0xab6f('0x23')]!==_0x184cd4){this[_0xab6f('0x23')]=_0x184cd4;io['emit'](_0xab6f('0x3b'),_0x2f8ebc);}};module['exports']=Agent; \ No newline at end of file +var _0x43c8=['../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','updateRealtime','prototype','CurrentCapacity','Capacity','idle','mail','chat','openchannel','sms','whatsapp','Status','StatusTime','toNumber','faxCurrentCapacity','smsCurrentCapacity','busy','stringify','md5','user:save','exports','moment','ioredis'];(function(_0x3eb6da,_0x214af0){var _0x444827=function(_0x3998ad){while(--_0x3998ad){_0x3eb6da['push'](_0x3eb6da['shift']());}};_0x444827(++_0x214af0);}(_0x43c8,0xaf));var _0x843c=function(_0x6d9313,_0xdc4d71){_0x6d9313=_0x6d9313-0x0;var _0x175e0b=_0x43c8[_0x6d9313];return _0x175e0b;};'use strict';var _=require('lodash');var moment=require(_0x843c('0x0'));var md5=require('md5');var Redis=require(_0x843c('0x1'));var config=require(_0x843c('0x2'));config[_0x843c('0x3')]=_[_0x843c('0x4')](config[_0x843c('0x3')],{'host':_0x843c('0x5'),'port':0x18eb});var io=require(_0x843c('0x6'))(new Redis(config['redis']));function Agent(_0x160368){this['id']=_0x160368['id']||0x0;this[_0x843c('0x7')]=_0x160368[_0x843c('0x7')]||'';this[_0x843c('0x8')]=_0x160368[_0x843c('0x8')]||!![];this['voicePause']=_0x160368[_0x843c('0x9')]||![];this[_0x843c('0xa')]=_0x160368['chatPause']||![];this[_0x843c('0xb')]=_0x160368['mailPause']||![];this['faxPause']=_0x160368[_0x843c('0xc')]||![];this['smsPause']=_0x160368[_0x843c('0xd')]||![];this[_0x843c('0xe')]=_0x160368[_0x843c('0xe')]||![];this[_0x843c('0xf')]='unknown';this[_0x843c('0x10')]=0x0;this[_0x843c('0x11')]=_0x160368[_0x843c('0x11')]||0x0;this[_0x843c('0x12')]=0x0;this[_0x843c('0x13')]=_0x843c('0x14');this[_0x843c('0x15')]=0x0;this[_0x843c('0x16')]=_0x160368[_0x843c('0x16')]||0x0;this[_0x843c('0x17')]=0x0;this[_0x843c('0x18')]=_0x843c('0x14');this[_0x843c('0x19')]=0x0;this[_0x843c('0x1a')]=_0x160368[_0x843c('0x1a')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x843c('0x1b')]=_0x843c('0x14');this[_0x843c('0x1c')]=0x0;this[_0x843c('0x1d')]=_0x160368[_0x843c('0x1d')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x843c('0x1e')]=_0x843c('0x14');this[_0x843c('0x1f')]=0x0;this[_0x843c('0x20')]=_0x160368['whatsappCapacity']||0x0;this[_0x843c('0x21')]=0x0;this[_0x843c('0x22')]=_0x843c('0x14');this[_0x843c('0x23')]=0x0;this[_0x843c('0x24')]=_0x160368['openchannelCapacity']||0x0;this[_0x843c('0x25')]=0x0;this['busy']=![];this[_0x843c('0x26')]=undefined;this['md5']='';this[_0x843c('0x27')]();}Agent[_0x843c('0x28')]['getChannelStatus']=function(_0x179772){if(this[_0x179772+_0x843c('0x29')]>0x0){if(this[_0x179772+_0x843c('0x2a')]>0x0&&this[_0x179772+_0x843c('0x29')]>=this[_0x179772+'Capacity']){return'maxcapacity';}else{return'working';}}else{return _0x843c('0x2b');}};Agent[_0x843c('0x28')][_0x843c('0x27')]=function(){var _0x408bf1=[_0x843c('0x2c'),_0x843c('0x2d'),_0x843c('0x2e'),'fax',_0x843c('0x2f'),_0x843c('0x30')];for(var _0x1a6a52=0x0;_0x1a6a52<_0x408bf1['length'];_0x1a6a52+=0x1){var _0x2a34d2=this['getChannelStatus'](_0x408bf1[_0x1a6a52]);if(this[_0x408bf1[_0x1a6a52]+_0x843c('0x31')]!==_0x2a34d2){this[_0x408bf1[_0x1a6a52]+_0x843c('0x32')]=_[_0x843c('0x33')](moment()['format']('x'));}this[_0x408bf1[_0x1a6a52]+_0x843c('0x31')]=_0x2a34d2;}var _0x2a3c64={'id':this['id'],'name':this[_0x843c('0x7')],'online':this[_0x843c('0x8')],'voicePause':this[_0x843c('0x9')],'chatPause':this[_0x843c('0xa')],'mailPause':this['mailPause'],'smsPause':this[_0x843c('0xd')],'faxPause':this['faxPause'],'openchannelPause':this[_0x843c('0xe')],'chatStatus':this[_0x843c('0xf')],'chatStatusTime':this[_0x843c('0x10')],'chatCapacity':this[_0x843c('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x843c('0x13')],'mailStatusTime':this[_0x843c('0x15')],'mailCapacity':this[_0x843c('0x16')],'mailCurrentCapacity':this[_0x843c('0x17')],'faxStatus':this[_0x843c('0x18')],'faxStatusTime':this[_0x843c('0x19')],'faxCapacity':this[_0x843c('0x1a')],'faxCurrentCapacity':this[_0x843c('0x34')],'smsStatus':this[_0x843c('0x1b')],'smsStatusTime':this[_0x843c('0x1c')],'smsCapacity':this[_0x843c('0x1d')],'smsCurrentCapacity':this[_0x843c('0x35')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x843c('0x1f')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x843c('0x21')],'openchannelStatus':this[_0x843c('0x22')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x843c('0x24')],'openchannelCurrentCapacity':this[_0x843c('0x25')],'busy':this[_0x843c('0x36')],'busyQueue':this['busyQueue']};var _0x341f33=md5(JSON[_0x843c('0x37')](_0x2a3c64));if(this['md5']!==_0x341f33){this[_0x843c('0x38')]=_0x341f33;io['emit'](_0x843c('0x39'),_0x2a3c64);}};module[_0x843c('0x3a')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 411b508..e1d90e5 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 _0x6504=['updateRouting','updateRealtime','_rr','map','paused','length','online','loggedIn','chatPause','available','waiting','stringify','format','chat:queue:%s','emit','chat_queue:save','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x22df11,_0x41c82c){var _0x462e82=function(_0x41f528){while(--_0x41f528){_0x22df11['push'](_0x22df11['shift']());}};_0x462e82(++_0x41c82c);}(_0x6504,0x13c));var _0x4650=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6504[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4650('0x0'));var md5=require(_0x4650('0x1'));var util=require('util');var Redis=require(_0x4650('0x2'));var config=require(_0x4650('0x3'));config[_0x4650('0x4')]=_[_0x4650('0x5')](config[_0x4650('0x4')],{'host':_0x4650('0x6'),'port':0x18eb});var io=require(_0x4650('0x7'))(new Redis(config['redis']));function ChatQueue(_0x35e1da){this['id']=_0x35e1da['id']||0x0;this[_0x4650('0x8')]=_0x35e1da[_0x4650('0x8')]||'';this[_0x4650('0x9')]=_0x35e1da['timeout']||0xa;this[_0x4650('0xa')]=_0x35e1da[_0x4650('0xa')]||_0x4650('0xb');this[_0x4650('0xc')]=_0x35e1da['Agents'];this[_0x4650('0xd')]={};this['waiting']=0x0;this[_0x4650('0x1')]='';this[_0x4650('0xe')]();this[_0x4650('0xf')]();}ChatQueue['prototype'][_0x4650('0xe')]=function(){var _0x62aa6e=this['mapAgentsId'][_0x4650('0x10')];this[_0x4650('0xd')]=_[_0x4650('0x11')](this[_0x4650('0xc')],'id');this[_0x4650('0xd')][_0x4650('0x10')]=_0x62aa6e;};ChatQueue['prototype'][_0x4650('0xf')]=function(){this['loggedIn']=0x0;this[_0x4650('0x12')]=0x0;for(var _0x5f1c20=0x0;_0x5f1c20=0x0?this[_0x4650('0x17')]:0x0;var _0x2d7888={'id':this['id'],'available':this[_0x4650('0x17')],'loggedIn':this[_0x4650('0x15')],'name':this[_0x4650('0x8')],'paused':this['paused'],'waiting':this[_0x4650('0x18')]};var _0x3a4e3e=md5(JSON[_0x4650('0x19')](_0x2d7888));if(this[_0x4650('0x1')]!==_0x3a4e3e){this[_0x4650('0x1')]=_0x3a4e3e;io['to'](util[_0x4650('0x1a')](_0x4650('0x1b'),_0x2d7888[_0x4650('0x8')]))[_0x4650('0x1c')](_0x4650('0x1d'),_0x2d7888);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x64c5=['defaults','redis','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','_rr','map','prototype','loggedIn','paused','online','chatPause','available','stringify','chat:queue:%s','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment'];(function(_0x57cb7b,_0x1f3d38){var _0x1f596e=function(_0x5d12a7){while(--_0x5d12a7){_0x57cb7b['push'](_0x57cb7b['shift']());}};_0x1f596e(++_0x1f3d38);}(_0x64c5,0x109));var _0x564c=function(_0x38de0d,_0x2d69b9){_0x38de0d=_0x38de0d-0x0;var _0xb3ad6f=_0x64c5[_0x38de0d];return _0xb3ad6f;};'use strict';var _=require(_0x564c('0x0'));var md5=require(_0x564c('0x1'));var util=require(_0x564c('0x2'));var Redis=require(_0x564c('0x3'));var config=require(_0x564c('0x4'));config['redis']=_[_0x564c('0x5')](config[_0x564c('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x564c('0x7'))(new Redis(config[_0x564c('0x6')]));function ChatQueue(_0x2645d9){this['id']=_0x2645d9['id']||0x0;this['name']=_0x2645d9[_0x564c('0x8')]||'';this['timeout']=_0x2645d9['timeout']||0xa;this[_0x564c('0x9')]=_0x2645d9[_0x564c('0x9')]||_0x564c('0xa');this['Agents']=_0x2645d9[_0x564c('0xb')];this[_0x564c('0xc')]={};this[_0x564c('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0x564c('0xe')]();}ChatQueue['prototype']['updateRouting']=function(){var _0x1c592b=this['mapAgentsId'][_0x564c('0xf')];this['mapAgentsId']=_[_0x564c('0x10')](this[_0x564c('0xb')],'id');this[_0x564c('0xc')][_0x564c('0xf')]=_0x1c592b;};ChatQueue[_0x564c('0x11')][_0x564c('0xe')]=function(){this[_0x564c('0x12')]=0x0;this[_0x564c('0x13')]=0x0;for(var _0x13f4eb=0x0;_0x13f4eb=0x0?this['available']:0x0;var _0x36f0ec={'id':this['id'],'available':this[_0x564c('0x16')],'loggedIn':this[_0x564c('0x12')],'name':this[_0x564c('0x8')],'paused':this[_0x564c('0x13')],'waiting':this[_0x564c('0xd')]};var _0x182c75=md5(JSON[_0x564c('0x17')](_0x36f0ec));if(this[_0x564c('0x1')]!==_0x182c75){this[_0x564c('0x1')]=_0x182c75;io['to'](util['format'](_0x564c('0x18'),_0x36f0ec[_0x564c('0x8')]))['emit'](_0x564c('0x19'),_0x36f0ec);}};module[_0x564c('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 86c4fa7..7b7cad4 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 _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x525e0b,_0x3313bf){var _0x3ab14e=function(_0x4ccba0){while(--_0x4ccba0){_0x525e0b['push'](_0x525e0b['shift']());}};_0x3ab14e(++_0x3313bf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file +var _0xa9e0=['available','stringify','format','emit','exports','lodash','md5','util','redis','localhost','socket.io-emitter','name','timeout','beepall','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','Agents','_rr','loggedIn','paused','length','faxPause'];(function(_0x465c11,_0x4dcca0){var _0xb2a404=function(_0xf93a2f){while(--_0xf93a2f){_0x465c11['push'](_0x465c11['shift']());}};_0xb2a404(++_0x4dcca0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index c16bf3e..bcbff1d 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 _0xc6bb=['name','Intervals','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xc6bb,0x147));var _0xbc6b=function(_0x170cb5,_0x5960da){_0x170cb5=_0x170cb5-0x0;var _0x4e7050=_0xc6bb[_0x170cb5];return _0x4e7050;};'use strict';function Interval(_0x23070c){this['id']=_0x23070c['id']||0x0;this['name']=_0x23070c[_0xbc6b('0x0')]||'';this[_0xbc6b('0x1')]=_0x23070c['Intervals']||{};}module[_0xbc6b('0x2')]=Interval; \ No newline at end of file +var _0x516a=['exports','name','Intervals'];(function(_0x190e4a,_0x58a451){var _0x3167ad=function(_0x2948f4){while(--_0x2948f4){_0x190e4a['push'](_0x190e4a['shift']());}};_0x3167ad(++_0x58a451);}(_0x516a,0xe2));var _0xa516=function(_0x18a3ca,_0xd0022a){_0x18a3ca=_0x18a3ca-0x0;var _0x5c39f3=_0x516a[_0x18a3ca];return _0x5c39f3;};'use strict';function Interval(_0x143a69){this['id']=_0x143a69['id']||0x0;this['name']=_0x143a69[_0xa516('0x0')]||'';this['Intervals']=_0x143a69[_0xa516('0x1')]||{};}module[_0xa516('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 1ee9815..361b527 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 _0xc1b4=['updateRealtime','prototype','_rr','map','loggedIn','paused','online','mailPause','available','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','strategy','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x151e0b,_0x3bec86){var _0x5d4a5c=function(_0x1567f4){while(--_0x1567f4){_0x151e0b['push'](_0x151e0b['shift']());}};_0x5d4a5c(++_0x3bec86);}(_0xc1b4,0x10a));var _0x4c1b=function(_0x1a4feb,_0x23937c){_0x1a4feb=_0x1a4feb-0x0;var _0x211cd1=_0xc1b4[_0x1a4feb];return _0x211cd1;};'use strict';var _=require(_0x4c1b('0x0'));var md5=require(_0x4c1b('0x1'));var util=require('util');var Redis=require(_0x4c1b('0x2'));var config=require(_0x4c1b('0x3'));config[_0x4c1b('0x4')]=_[_0x4c1b('0x5')](config[_0x4c1b('0x4')],{'host':_0x4c1b('0x6'),'port':0x18eb});var io=require(_0x4c1b('0x7'))(new Redis(config[_0x4c1b('0x4')]));function MailQueue(_0x578c6d){this['id']=_0x578c6d['id']||0x0;this[_0x4c1b('0x8')]=_0x578c6d[_0x4c1b('0x8')]||'';this['timeout']=_0x578c6d['timeout']||0xa;this[_0x4c1b('0x9')]=_0x578c6d[_0x4c1b('0x9')]||'beepall';this[_0x4c1b('0xa')]=_0x578c6d[_0x4c1b('0xa')];this[_0x4c1b('0xb')]={};this[_0x4c1b('0xc')]=0x0;this[_0x4c1b('0x1')]='';this[_0x4c1b('0xd')]();this[_0x4c1b('0xe')]();}MailQueue[_0x4c1b('0xf')]['updateRouting']=function(){var _0x19906e=this['mapAgentsId'][_0x4c1b('0x10')];this[_0x4c1b('0xb')]=_[_0x4c1b('0x11')](this[_0x4c1b('0xa')],'id');this['mapAgentsId'][_0x4c1b('0x10')]=_0x19906e;};MailQueue[_0x4c1b('0xf')][_0x4c1b('0xe')]=function(){this[_0x4c1b('0x12')]=0x0;this[_0x4c1b('0x13')]=0x0;for(var _0x85678b=0x0;_0x85678b=0x0?this[_0x4c1b('0x16')]:0x0;var _0x45412f={'id':this['id'],'available':this[_0x4c1b('0x16')],'loggedIn':this[_0x4c1b('0x12')],'name':this['name'],'paused':this[_0x4c1b('0x13')],'waiting':this[_0x4c1b('0xc')]};var _0x197e5f=md5(JSON['stringify'](_0x45412f));if(this[_0x4c1b('0x1')]!==_0x197e5f){this[_0x4c1b('0x1')]=_0x197e5f;io['to'](util[_0x4c1b('0x17')](_0x4c1b('0x18'),_0x45412f[_0x4c1b('0x8')]))[_0x4c1b('0x19')](_0x4c1b('0x1a'),_0x45412f);}};module[_0x4c1b('0x1b')]=MailQueue; \ No newline at end of file +var _0x6af5=['available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','md5','util','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','online','mailPause'];(function(_0x1f83a5,_0x59843f){var _0x45edf0=function(_0x431e25){while(--_0x431e25){_0x1f83a5['push'](_0x1f83a5['shift']());}};_0x45edf0(++_0x59843f);}(_0x6af5,0x7b));var _0x56af=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x6af5[_0x4dc7b9];return _0x3ab114;};'use strict';var _=require('lodash');var md5=require(_0x56af('0x0'));var util=require(_0x56af('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x56af('0x2')]=_[_0x56af('0x3')](config[_0x56af('0x2')],{'host':_0x56af('0x4'),'port':0x18eb});var io=require(_0x56af('0x5'))(new Redis(config[_0x56af('0x2')]));function MailQueue(_0x261834){this['id']=_0x261834['id']||0x0;this[_0x56af('0x6')]=_0x261834[_0x56af('0x6')]||'';this[_0x56af('0x7')]=_0x261834[_0x56af('0x7')]||0xa;this[_0x56af('0x8')]=_0x261834['strategy']||_0x56af('0x9');this[_0x56af('0xa')]=_0x261834[_0x56af('0xa')];this[_0x56af('0xb')]={};this[_0x56af('0xc')]=0x0;this['md5']='';this[_0x56af('0xd')]();this['updateRealtime']();}MailQueue[_0x56af('0xe')][_0x56af('0xd')]=function(){var _0x1053b0=this[_0x56af('0xb')][_0x56af('0xf')];this[_0x56af('0xb')]=_[_0x56af('0x10')](this[_0x56af('0xa')],'id');this['mapAgentsId'][_0x56af('0xf')]=_0x1053b0;};MailQueue[_0x56af('0xe')][_0x56af('0x11')]=function(){this[_0x56af('0x12')]=0x0;this[_0x56af('0x13')]=0x0;for(var _0x2e988d=0x0;_0x2e988d=0x0?this[_0x56af('0x16')]:0x0;var _0x3589df={'id':this['id'],'available':this[_0x56af('0x16')],'loggedIn':this[_0x56af('0x12')],'name':this[_0x56af('0x6')],'paused':this[_0x56af('0x13')],'waiting':this[_0x56af('0xc')]};var _0x105f56=md5(JSON[_0x56af('0x17')](_0x3589df));if(this['md5']!==_0x105f56){this['md5']=_0x105f56;io['to'](util[_0x56af('0x18')](_0x56af('0x19'),_0x3589df[_0x56af('0x6')]))[_0x56af('0x1a')](_0x56af('0x1b'),_0x3589df);}};module[_0x56af('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 0b438c0..1f3335b 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 _0x819b=['util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','length','online','openchannelPause','available','paused','format','openchannel_queue:save','md5'];(function(_0x1ee8a6,_0x5ba991){var _0x55c71e=function(_0x4e5108){while(--_0x4e5108){_0x1ee8a6['push'](_0x1ee8a6['shift']());}};_0x55c71e(++_0x5ba991);}(_0x819b,0x1ed));var _0xb819=function(_0x2e7044,_0x5409b8){_0x2e7044=_0x2e7044-0x0;var _0x26a3c2=_0x819b[_0x2e7044];return _0x26a3c2;};'use strict';var _=require('lodash');var md5=require(_0xb819('0x0'));var util=require(_0xb819('0x1'));var Redis=require(_0xb819('0x2'));var config=require(_0xb819('0x3'));config[_0xb819('0x4')]=_[_0xb819('0x5')](config[_0xb819('0x4')],{'host':_0xb819('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb819('0x4')]));function OpenchannelQueue(_0x1f4f6c){this['id']=_0x1f4f6c['id']||0x0;this[_0xb819('0x7')]=_0x1f4f6c[_0xb819('0x7')]||'';this[_0xb819('0x8')]=_0x1f4f6c[_0xb819('0x8')]||0xa;this[_0xb819('0x9')]=_0x1f4f6c[_0xb819('0x9')]||'beepall';this[_0xb819('0xa')]=_0x1f4f6c[_0xb819('0xa')];this[_0xb819('0xb')]={};this[_0xb819('0xc')]=0x0;this['md5']='';this[_0xb819('0xd')]();this[_0xb819('0xe')]();}OpenchannelQueue['prototype']['updateRouting']=function(){var _0xe610da=this[_0xb819('0xb')][_0xb819('0xf')];this[_0xb819('0xb')]=_[_0xb819('0x10')](this[_0xb819('0xa')],'id');this[_0xb819('0xb')]['_rr']=_0xe610da;};OpenchannelQueue[_0xb819('0x11')]['updateRealtime']=function(){this[_0xb819('0x12')]=0x0;this['paused']=0x0;for(var _0x4eb04c=0x0;_0x4eb04c=0x0?this[_0xb819('0x16')]:0x0;var _0x102a82={'id':this['id'],'available':this[_0xb819('0x16')],'loggedIn':this[_0xb819('0x12')],'name':this['name'],'paused':this[_0xb819('0x17')],'waiting':this[_0xb819('0xc')]};var _0x56cc81=md5(JSON['stringify'](_0x102a82));if(this[_0xb819('0x0')]!==_0x56cc81){this[_0xb819('0x0')]=_0x56cc81;io['to'](util[_0xb819('0x18')]('openchannel:queue:%s',_0x102a82[_0xb819('0x7')]))['emit'](_0xb819('0x19'),_0x102a82);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x2920=['redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','map','_rr','updateRealtime','loggedIn','length','online','openchannelPause','paused','available','stringify','openchannel:queue:%s','openchannel_queue:save','md5','util','ioredis','../../../config/environment','defaults'];(function(_0x4e39e8,_0x5ebfe6){var _0x1b528d=function(_0x7cbe88){while(--_0x7cbe88){_0x4e39e8['push'](_0x4e39e8['shift']());}};_0x1b528d(++_0x5ebfe6);}(_0x2920,0x1e8));var _0x0292=function(_0x40dd26,_0x26e2ba){_0x40dd26=_0x40dd26-0x0;var _0x1434a7=_0x2920[_0x40dd26];return _0x1434a7;};'use strict';var _=require('lodash');var md5=require(_0x0292('0x0'));var util=require(_0x0292('0x1'));var Redis=require(_0x0292('0x2'));var config=require(_0x0292('0x3'));config['redis']=_[_0x0292('0x4')](config[_0x0292('0x5')],{'host':_0x0292('0x6'),'port':0x18eb});var io=require(_0x0292('0x7'))(new Redis(config[_0x0292('0x5')]));function OpenchannelQueue(_0x577ef4){this['id']=_0x577ef4['id']||0x0;this[_0x0292('0x8')]=_0x577ef4[_0x0292('0x8')]||'';this[_0x0292('0x9')]=_0x577ef4[_0x0292('0x9')]||0xa;this[_0x0292('0xa')]=_0x577ef4[_0x0292('0xa')]||_0x0292('0xb');this[_0x0292('0xc')]=_0x577ef4[_0x0292('0xc')];this[_0x0292('0xd')]={};this[_0x0292('0xe')]=0x0;this[_0x0292('0x0')]='';this[_0x0292('0xf')]();this['updateRealtime']();}OpenchannelQueue[_0x0292('0x10')]['updateRouting']=function(){var _0x1e023d=this[_0x0292('0xd')]['_rr'];this['mapAgentsId']=_[_0x0292('0x11')](this['Agents'],'id');this[_0x0292('0xd')][_0x0292('0x12')]=_0x1e023d;};OpenchannelQueue[_0x0292('0x10')][_0x0292('0x13')]=function(){this[_0x0292('0x14')]=0x0;this['paused']=0x0;for(var _0x4a8dce=0x0;_0x4a8dce=0x0?this[_0x0292('0x19')]:0x0;var _0x297081={'id':this['id'],'available':this[_0x0292('0x19')],'loggedIn':this['loggedIn'],'name':this[_0x0292('0x8')],'paused':this[_0x0292('0x18')],'waiting':this['waiting']};var _0x3a3ab6=md5(JSON[_0x0292('0x1a')](_0x297081));if(this['md5']!==_0x3a3ab6){this[_0x0292('0x0')]=_0x3a3ab6;io['to'](util['format'](_0x0292('0x1b'),_0x297081[_0x0292('0x8')]))['emit'](_0x0292('0x1c'),_0x297081);}};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 4018019..431b253 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 _0xb7e7=['util','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','length','online','paused','available','stringify','sms:queue:%s','emit','exports','lodash'];(function(_0x28eb5d,_0x46440e){var _0x586331=function(_0xa54929){while(--_0xa54929){_0x28eb5d['push'](_0x28eb5d['shift']());}};_0x586331(++_0x46440e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xb7e7[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x7b7e('0x0'));var md5=require('md5');var util=require(_0x7b7e('0x1'));var Redis=require('ioredis');var config=require(_0x7b7e('0x2'));config['redis']=_[_0x7b7e('0x3')](config['redis'],{'host':_0x7b7e('0x4'),'port':0x18eb});var io=require(_0x7b7e('0x5'))(new Redis(config[_0x7b7e('0x6')]));function SmsQueue(_0x52047f){this['id']=_0x52047f['id']||0x0;this['name']=_0x52047f[_0x7b7e('0x7')]||'';this[_0x7b7e('0x8')]=_0x52047f[_0x7b7e('0x8')]||0xa;this['strategy']=_0x52047f[_0x7b7e('0x9')]||_0x7b7e('0xa');this[_0x7b7e('0xb')]=_0x52047f[_0x7b7e('0xb')];this[_0x7b7e('0xc')]={};this[_0x7b7e('0xd')]=0x0;this[_0x7b7e('0xe')]='';this['updateRouting']();this[_0x7b7e('0xf')]();}SmsQueue[_0x7b7e('0x10')][_0x7b7e('0x11')]=function(){var _0x29b622=this[_0x7b7e('0xc')][_0x7b7e('0x12')];this[_0x7b7e('0xc')]=_[_0x7b7e('0x13')](this[_0x7b7e('0xb')],'id');this['mapAgentsId'][_0x7b7e('0x12')]=_0x29b622;};SmsQueue[_0x7b7e('0x10')]['updateRealtime']=function(){this[_0x7b7e('0x14')]=0x0;this['paused']=0x0;for(var _0x4c6011=0x0;_0x4c6011=0x0?this[_0x7b7e('0x18')]:0x0;var _0x200ef7={'id':this['id'],'available':this[_0x7b7e('0x18')],'loggedIn':this[_0x7b7e('0x14')],'name':this[_0x7b7e('0x7')],'paused':this[_0x7b7e('0x17')],'waiting':this[_0x7b7e('0xd')]};var _0x3bec7d=md5(JSON[_0x7b7e('0x19')](_0x200ef7));if(this[_0x7b7e('0xe')]!==_0x3bec7d){this[_0x7b7e('0xe')]=_0x3bec7d;io['to'](util['format'](_0x7b7e('0x1a'),_0x200ef7[_0x7b7e('0x7')]))[_0x7b7e('0x1b')]('sms_queue:save',_0x200ef7);}};module[_0x7b7e('0x1c')]=SmsQueue; \ No newline at end of file +var _0xcb91=['loggedIn','paused','length','online','available','stringify','sms:queue:%s','emit','sms_queue:save','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map'];(function(_0x18ada5,_0x4618ce){var _0xb3f7ff=function(_0x2a244c){while(--_0x2a244c){_0x18ada5['push'](_0x18ada5['shift']());}};_0xb3f7ff(++_0x4618ce);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x272638,_0x42b993){_0x272638=_0x272638-0x0;var _0x19d027=_0xcb91[_0x272638];return _0x19d027;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x1cb9('0x0'));var Redis=require(_0x1cb9('0x1'));var config=require(_0x1cb9('0x2'));config[_0x1cb9('0x3')]=_['defaults'](config[_0x1cb9('0x3')],{'host':_0x1cb9('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1cb9('0x3')]));function SmsQueue(_0x1b26cd){this['id']=_0x1b26cd['id']||0x0;this['name']=_0x1b26cd[_0x1cb9('0x5')]||'';this[_0x1cb9('0x6')]=_0x1b26cd['timeout']||0xa;this[_0x1cb9('0x7')]=_0x1b26cd[_0x1cb9('0x7')]||'beepall';this[_0x1cb9('0x8')]=_0x1b26cd['Agents'];this['mapAgentsId']={};this[_0x1cb9('0x9')]=0x0;this[_0x1cb9('0xa')]='';this[_0x1cb9('0xb')]();this[_0x1cb9('0xc')]();}SmsQueue[_0x1cb9('0xd')]['updateRouting']=function(){var _0x9b58f1=this[_0x1cb9('0xe')][_0x1cb9('0xf')];this[_0x1cb9('0xe')]=_[_0x1cb9('0x10')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x9b58f1;};SmsQueue[_0x1cb9('0xd')][_0x1cb9('0xc')]=function(){this[_0x1cb9('0x11')]=0x0;this[_0x1cb9('0x12')]=0x0;for(var _0x56884d=0x0;_0x56884d=0x0?this[_0x1cb9('0x15')]:0x0;var _0x4e1340={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1cb9('0x11')],'name':this[_0x1cb9('0x5')],'paused':this[_0x1cb9('0x12')],'waiting':this[_0x1cb9('0x9')]};var _0x280a84=md5(JSON[_0x1cb9('0x16')](_0x4e1340));if(this[_0x1cb9('0xa')]!==_0x280a84){this['md5']=_0x280a84;io['to'](util['format'](_0x1cb9('0x17'),_0x4e1340['name']))[_0x1cb9('0x18')](_0x1cb9('0x19'),_0x4e1340);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index e55787f..f61b5e1 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 _0xc6cf=['available','stringify','format','emit','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','loggedIn','paused','online','whatsappPause'];(function(_0x371cda,_0x32825d){var _0xa8927e=function(_0x4b25f2){while(--_0x4b25f2){_0x371cda['push'](_0x371cda['shift']());}};_0xa8927e(++_0x32825d);}(_0xc6cf,0xa6));var _0xfc6c=function(_0x2a2853,_0x56dfb4){_0x2a2853=_0x2a2853-0x0;var _0x2c8741=_0xc6cf[_0x2a2853];return _0x2c8741;};'use strict';var _=require(_0xfc6c('0x0'));var md5=require(_0xfc6c('0x1'));var util=require(_0xfc6c('0x2'));var Redis=require(_0xfc6c('0x3'));var config=require(_0xfc6c('0x4'));config[_0xfc6c('0x5')]=_[_0xfc6c('0x6')](config[_0xfc6c('0x5')],{'host':_0xfc6c('0x7'),'port':0x18eb});var io=require(_0xfc6c('0x8'))(new Redis(config[_0xfc6c('0x5')]));function WhatsappQueue(_0xdbee6e){this['id']=_0xdbee6e['id']||0x0;this[_0xfc6c('0x9')]=_0xdbee6e[_0xfc6c('0x9')]||'';this[_0xfc6c('0xa')]=_0xdbee6e[_0xfc6c('0xa')]||0xa;this[_0xfc6c('0xb')]=_0xdbee6e['strategy']||_0xfc6c('0xc');this[_0xfc6c('0xd')]=_0xdbee6e['Agents'];this[_0xfc6c('0xe')]={};this[_0xfc6c('0xf')]=0x0;this[_0xfc6c('0x1')]='';this['updateRouting']();this[_0xfc6c('0x10')]();}WhatsappQueue[_0xfc6c('0x11')]['updateRouting']=function(){var _0x36744e=this[_0xfc6c('0xe')][_0xfc6c('0x12')];this[_0xfc6c('0xe')]=_['map'](this['Agents'],'id');this[_0xfc6c('0xe')][_0xfc6c('0x12')]=_0x36744e;};WhatsappQueue['prototype'][_0xfc6c('0x10')]=function(){this[_0xfc6c('0x13')]=0x0;this[_0xfc6c('0x14')]=0x0;for(var _0x2905f3=0x0;_0x2905f3=0x0?this[_0xfc6c('0x17')]:0x0;var _0x868584={'id':this['id'],'available':this['available'],'loggedIn':this[_0xfc6c('0x13')],'name':this[_0xfc6c('0x9')],'paused':this['paused'],'waiting':this[_0xfc6c('0xf')]};var _0x50ee72=md5(JSON[_0xfc6c('0x18')](_0x868584));if(this[_0xfc6c('0x1')]!==_0x50ee72){this[_0xfc6c('0x1')]=_0x50ee72;io['to'](util[_0xfc6c('0x19')]('whatsapp:queue:%s',_0x868584['name']))[_0xfc6c('0x1a')]('whatsapp_queue:save',_0x868584);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x92a0=['_rr','map','updateRealtime','loggedIn','paused','length','online','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','prototype','mapAgentsId'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x92a0,0x1c1));var _0x092a=function(_0x36b8b4,_0x2c2fc8){_0x36b8b4=_0x36b8b4-0x0;var _0x16dda2=_0x92a0[_0x36b8b4];return _0x16dda2;};'use strict';var _=require('lodash');var md5=require(_0x092a('0x0'));var util=require('util');var Redis=require(_0x092a('0x1'));var config=require(_0x092a('0x2'));config[_0x092a('0x3')]=_[_0x092a('0x4')](config[_0x092a('0x3')],{'host':_0x092a('0x5'),'port':0x18eb});var io=require(_0x092a('0x6'))(new Redis(config[_0x092a('0x3')]));function WhatsappQueue(_0x4667f0){this['id']=_0x4667f0['id']||0x0;this['name']=_0x4667f0[_0x092a('0x7')]||'';this[_0x092a('0x8')]=_0x4667f0[_0x092a('0x8')]||0xa;this[_0x092a('0x9')]=_0x4667f0[_0x092a('0x9')]||'beepall';this[_0x092a('0xa')]=_0x4667f0[_0x092a('0xa')];this['mapAgentsId']={};this[_0x092a('0xb')]=0x0;this[_0x092a('0x0')]='';this[_0x092a('0xc')]();this['updateRealtime']();}WhatsappQueue[_0x092a('0xd')][_0x092a('0xc')]=function(){var _0x493f72=this[_0x092a('0xe')][_0x092a('0xf')];this[_0x092a('0xe')]=_[_0x092a('0x10')](this[_0x092a('0xa')],'id');this[_0x092a('0xe')]['_rr']=_0x493f72;};WhatsappQueue[_0x092a('0xd')][_0x092a('0x11')]=function(){this[_0x092a('0x12')]=0x0;this[_0x092a('0x13')]=0x0;for(var _0x33de9c=0x0;_0x33de9c=0x0?this[_0x092a('0x17')]:0x0;var _0x2fa07d={'id':this['id'],'available':this['available'],'loggedIn':this[_0x092a('0x12')],'name':this[_0x092a('0x7')],'paused':this[_0x092a('0x13')],'waiting':this[_0x092a('0xb')]};var _0x12b192=md5(JSON[_0x092a('0x18')](_0x2fa07d));if(this[_0x092a('0x0')]!==_0x12b192){this['md5']=_0x12b192;io['to'](util[_0x092a('0x19')](_0x092a('0x1a'),_0x2fa07d[_0x092a('0x7')]))[_0x092a('0x1b')]('whatsapp_queue:save',_0x2fa07d);}};module[_0x092a('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index df5aa23..e52db87 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 _0xf3cd=['../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','mailQueues','initFaxQueues','initWhatsappQueues','whatsappQueues','bluebird','util','lodash','moment','../model/agent'];(function(_0x5580d2,_0x53501e){var _0x491093=function(_0x381527){while(--_0x381527){_0x5580d2['push'](_0x5580d2['shift']());}};_0x491093(++_0x53501e);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x564821,_0x4d037e){_0x564821=_0x564821-0x0;var _0x2b604d=_0xf3cd[_0x564821];return _0x2b604d;};'use strict';var BPromise=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var _=require(_0xdf3c('0x2'));var moment=require(_0xdf3c('0x3'));var Agent=require(_0xdf3c('0x4'));var Interval=require(_0xdf3c('0x5'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0xdf3c('0x6'));var SmsQueue=require(_0xdf3c('0x7'));var MailQueue=require(_0xdf3c('0x8'));var FaxQueue=require('../model/faxQueue');var WhatsappQueue=require(_0xdf3c('0x9'));var Realtime=function(){this[_0xdf3c('0xa')]={};this[_0xdf3c('0xb')]={};this[_0xdf3c('0xc')]={};this[_0xdf3c('0xd')]={};this[_0xdf3c('0xe')]={};this['mailQueues']={};this[_0xdf3c('0xf')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0xdf3c('0x10')]={};this[_0xdf3c('0x11')]={};this['smsQueuesWaitingInteractions']={};this[_0xdf3c('0x12')]={};this[_0xdf3c('0x13')]={};};function freeIsNotKey(_0x2d420c,_0x21a6e5,_0x3a3154){var _0x1c456b=_[_0xdf3c('0x14')](_0x2d420c,function(_0x32d2db,_0x5e8925){return _0x32d2db[_0x3a3154];});for(var _0x1d483c in _0x21a6e5){if(_0x21a6e5[_0xdf3c('0x15')](_0x1d483c)){if(!_0x1c456b[_0x1d483c]){delete _0x21a6e5[_0x1d483c];}}}}Realtime[_0xdf3c('0x16')][_0xdf3c('0x17')]=function(_0x59e431,_0x2ae4ad){for(var _0x461079 in _0x2ae4ad){if(_0x59e431[_0xdf3c('0x15')](_0x461079)){_0x59e431[_0x461079]=_0x2ae4ad[_0x461079];}}};Realtime['prototype'][_0xdf3c('0x18')]=function(){var _0x38b01d=this;return function(_0x173041){if(_0x173041){freeIsNotKey(_0x173041,_0x38b01d[_0xdf3c('0xa')],'id');for(var _0x21e587=0x0,_0x1a7a5a={},_0x305ea5={};_0x21e587<_0x173041[_0xdf3c('0x19')];_0x21e587+=0x1){_0x1a7a5a=_0x173041[_0x21e587];if(_[_0xdf3c('0x1a')](_0x38b01d[_0xdf3c('0xa')][_0x1a7a5a['id']])){_0x38b01d['agents'][_0x1a7a5a['id']]=new Agent(_0x1a7a5a);}else{_0x38b01d[_0xdf3c('0x17')](_0x38b01d[_0xdf3c('0xa')][_0x1a7a5a['id']],_0x1a7a5a);}}}return _0x38b01d[_0xdf3c('0xa')];};};Realtime[_0xdf3c('0x16')][_0xdf3c('0x1b')]=function(){var _0x113b56=this;return function(_0x16b02b){if(_0x16b02b){freeIsNotKey(_0x16b02b,_0x113b56[_0xdf3c('0xb')],'id');for(var _0x426f3a=0x0,_0x18fb5f={},_0x267488={};_0x426f3a<_0x16b02b[_0xdf3c('0x19')];_0x426f3a+=0x1){_0x18fb5f=_0x16b02b[_0x426f3a];if(_[_0xdf3c('0x1a')](_0x113b56['intervals'][_0x18fb5f['id']])){_0x113b56['intervals'][_0x18fb5f['id']]=new Interval(_0x18fb5f);}else{_0x113b56[_0xdf3c('0x17')](_0x113b56['intervals'][_0x18fb5f['id']],_0x18fb5f);}}}return _0x113b56[_0xdf3c('0xb')];};};Realtime[_0xdf3c('0x16')][_0xdf3c('0x1c')]=function(){var _0x38b319=this;return function(_0x33652f){if(_0x33652f){freeIsNotKey(_0x33652f,_0x38b319[_0xdf3c('0xc')],'id');for(var _0x50d8ca=0x0,_0x22a164={},_0x213d75={};_0x50d8ca<_0x33652f[_0xdf3c('0x19')];_0x50d8ca+=0x1){_0x22a164=_0x33652f[_0x50d8ca];if(_[_0xdf3c('0x1a')](_0x38b319[_0xdf3c('0xc')][_0x22a164['id']])){_0x38b319[_0xdf3c('0xc')][_0x22a164['id']]=new OpenchannelQueue(_0x22a164);}else{_0x38b319[_0xdf3c('0x17')](_0x38b319[_0xdf3c('0xc')][_0x22a164['id']],_0x22a164);}_0x38b319[_0xdf3c('0xc')][_0x22a164['id']][_0xdf3c('0x1d')]();_0x38b319['openchannelQueues'][_0x22a164['id']][_0xdf3c('0x1e')]();}}return _0x38b319[_0xdf3c('0xc')];};};Realtime['prototype'][_0xdf3c('0x1f')]=function(){var _0x59659e=this;return function(_0x4eaced){if(_0x4eaced){freeIsNotKey(_0x4eaced,_0x59659e['chatQueues'],'id');for(var _0x14aac9=0x0,_0x186bba={},_0x52b8f6={};_0x14aac9<_0x4eaced['length'];_0x14aac9+=0x1){_0x186bba=_0x4eaced[_0x14aac9];if(_[_0xdf3c('0x1a')](_0x59659e[_0xdf3c('0xd')][_0x186bba['id']])){_0x59659e[_0xdf3c('0xd')][_0x186bba['id']]=new ChatQueue(_0x186bba);}else{_0x59659e[_0xdf3c('0x17')](_0x59659e['chatQueues'][_0x186bba['id']],_0x186bba);}_0x59659e[_0xdf3c('0xd')][_0x186bba['id']][_0xdf3c('0x1d')]();_0x59659e['chatQueues'][_0x186bba['id']]['updateRealtime']();}}return _0x59659e[_0xdf3c('0xd')];};};Realtime[_0xdf3c('0x16')][_0xdf3c('0x20')]=function(){var _0x540f3a=this;return function(_0x2355f6){if(_0x2355f6){freeIsNotKey(_0x2355f6,_0x540f3a[_0xdf3c('0xe')],'id');for(var _0x21e7b8=0x0,_0x10099e={},_0x575ae1={};_0x21e7b8<_0x2355f6[_0xdf3c('0x19')];_0x21e7b8+=0x1){_0x10099e=_0x2355f6[_0x21e7b8];if(_[_0xdf3c('0x1a')](_0x540f3a['smsQueues'][_0x10099e['id']])){_0x540f3a[_0xdf3c('0xe')][_0x10099e['id']]=new SmsQueue(_0x10099e);}else{_0x540f3a[_0xdf3c('0x17')](_0x540f3a[_0xdf3c('0xe')][_0x10099e['id']],_0x10099e);}_0x540f3a[_0xdf3c('0xe')][_0x10099e['id']]['updateRouting']();_0x540f3a[_0xdf3c('0xe')][_0x10099e['id']][_0xdf3c('0x1e')]();}}return _0x540f3a[_0xdf3c('0xe')];};};Realtime[_0xdf3c('0x16')]['initMailQueues']=function(){var _0x474564=this;return function(_0x3e7a4b){if(_0x3e7a4b){freeIsNotKey(_0x3e7a4b,_0x474564['mailQueues'],'id');for(var _0x4f68f9=0x0,_0x12cc19={},_0x588d02={};_0x4f68f9<_0x3e7a4b[_0xdf3c('0x19')];_0x4f68f9+=0x1){_0x12cc19=_0x3e7a4b[_0x4f68f9];if(_['isUndefined'](_0x474564['mailQueues'][_0x12cc19['id']])){_0x474564['mailQueues'][_0x12cc19['id']]=new MailQueue(_0x12cc19);}else{_0x474564[_0xdf3c('0x17')](_0x474564[_0xdf3c('0x21')][_0x12cc19['id']],_0x12cc19);}_0x474564[_0xdf3c('0x21')][_0x12cc19['id']][_0xdf3c('0x1d')]();_0x474564['mailQueues'][_0x12cc19['id']]['updateRealtime']();}}return _0x474564[_0xdf3c('0x21')];};};Realtime['prototype'][_0xdf3c('0x22')]=function(){var _0x17b502=this;return function(_0x3628ae){if(_0x3628ae){freeIsNotKey(_0x3628ae,_0x17b502[_0xdf3c('0xf')],'id');for(var _0x1004e9=0x0,_0x1e0cf2={},_0x1c7335={};_0x1004e9<_0x3628ae[_0xdf3c('0x19')];_0x1004e9+=0x1){_0x1e0cf2=_0x3628ae[_0x1004e9];if(_[_0xdf3c('0x1a')](_0x17b502['faxQueues'][_0x1e0cf2['id']])){_0x17b502[_0xdf3c('0xf')][_0x1e0cf2['id']]=new FaxQueue(_0x1e0cf2);}else{_0x17b502['mergeFromDatabase'](_0x17b502['faxQueues'][_0x1e0cf2['id']],_0x1e0cf2);}_0x17b502[_0xdf3c('0xf')][_0x1e0cf2['id']]['updateRouting']();_0x17b502[_0xdf3c('0xf')][_0x1e0cf2['id']]['updateRealtime']();}}return _0x17b502[_0xdf3c('0xf')];};};Realtime[_0xdf3c('0x16')][_0xdf3c('0x23')]=function(){var _0x1349a4=this;return function(_0x3098cb){if(_0x3098cb){freeIsNotKey(_0x3098cb,_0x1349a4[_0xdf3c('0x24')],'id');for(var _0x736ef5=0x0,_0x3d47fb={},_0x3cf131={};_0x736ef5<_0x3098cb[_0xdf3c('0x19')];_0x736ef5+=0x1){_0x3d47fb=_0x3098cb[_0x736ef5];if(_[_0xdf3c('0x1a')](_0x1349a4[_0xdf3c('0x24')][_0x3d47fb['id']])){_0x1349a4['whatsappQueues'][_0x3d47fb['id']]=new WhatsappQueue(_0x3d47fb);}else{_0x1349a4['mergeFromDatabase'](_0x1349a4[_0xdf3c('0x24')][_0x3d47fb['id']],_0x3d47fb);}_0x1349a4['whatsappQueues'][_0x3d47fb['id']][_0xdf3c('0x1d')]();_0x1349a4[_0xdf3c('0x24')][_0x3d47fb['id']][_0xdf3c('0x1e')]();}}return _0x1349a4[_0xdf3c('0x24')];};};module['exports']=Realtime; \ No newline at end of file +var _0x7fbe=['../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','mailQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','initWhatsappQueues','lodash','moment'];(function(_0x2e1794,_0x44c23e){var _0xd9c647=function(_0x230705){while(--_0x230705){_0x2e1794['push'](_0x2e1794['shift']());}};_0xd9c647(++_0x44c23e);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x49f509,_0x5c7395){_0x49f509=_0x49f509-0x0;var _0x1250d2=_0x7fbe[_0x49f509];return _0x1250d2;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xe7fb('0x0'));var moment=require(_0xe7fb('0x1'));var Agent=require(_0xe7fb('0x2'));var Interval=require(_0xe7fb('0x3'));var OpenchannelQueue=require(_0xe7fb('0x4'));var ChatQueue=require(_0xe7fb('0x5'));var SmsQueue=require(_0xe7fb('0x6'));var MailQueue=require(_0xe7fb('0x7'));var FaxQueue=require(_0xe7fb('0x8'));var WhatsappQueue=require(_0xe7fb('0x9'));var Realtime=function(){this[_0xe7fb('0xa')]={};this[_0xe7fb('0xb')]={};this[_0xe7fb('0xc')]={};this[_0xe7fb('0xd')]={};this['smsQueues']={};this[_0xe7fb('0xe')]={};this[_0xe7fb('0xf')]={};this[_0xe7fb('0x10')]={};this[_0xe7fb('0x11')]={};this['mailQueuesWaitingInteractions']={};this['openchannelQueuesWaitingInteractions']={};this[_0xe7fb('0x12')]={};this[_0xe7fb('0x13')]={};this[_0xe7fb('0x14')]={};};function freeIsNotKey(_0x348a73,_0x2a2223,_0x42435c){var _0x3e934b=_[_0xe7fb('0x15')](_0x348a73,function(_0x325035,_0x2fe8ab){return _0x325035[_0x42435c];});for(var _0x2437d4 in _0x2a2223){if(_0x2a2223[_0xe7fb('0x16')](_0x2437d4)){if(!_0x3e934b[_0x2437d4]){delete _0x2a2223[_0x2437d4];}}}}Realtime[_0xe7fb('0x17')][_0xe7fb('0x18')]=function(_0x7fe4d3,_0x598729){for(var _0x278b75 in _0x598729){if(_0x7fe4d3[_0xe7fb('0x16')](_0x278b75)){_0x7fe4d3[_0x278b75]=_0x598729[_0x278b75];}}};Realtime['prototype'][_0xe7fb('0x19')]=function(){var _0x37eb9f=this;return function(_0x482f7d){if(_0x482f7d){freeIsNotKey(_0x482f7d,_0x37eb9f[_0xe7fb('0xa')],'id');for(var _0x559129=0x0,_0x12fff6={},_0x18d23c={};_0x559129<_0x482f7d[_0xe7fb('0x1a')];_0x559129+=0x1){_0x12fff6=_0x482f7d[_0x559129];if(_[_0xe7fb('0x1b')](_0x37eb9f['agents'][_0x12fff6['id']])){_0x37eb9f[_0xe7fb('0xa')][_0x12fff6['id']]=new Agent(_0x12fff6);}else{_0x37eb9f['mergeFromDatabase'](_0x37eb9f[_0xe7fb('0xa')][_0x12fff6['id']],_0x12fff6);}}}return _0x37eb9f['agents'];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x1c')]=function(){var _0x3f96a7=this;return function(_0x182269){if(_0x182269){freeIsNotKey(_0x182269,_0x3f96a7['intervals'],'id');for(var _0x44466e=0x0,_0x5d1c87={},_0x11cae0={};_0x44466e<_0x182269['length'];_0x44466e+=0x1){_0x5d1c87=_0x182269[_0x44466e];if(_[_0xe7fb('0x1b')](_0x3f96a7['intervals'][_0x5d1c87['id']])){_0x3f96a7[_0xe7fb('0xb')][_0x5d1c87['id']]=new Interval(_0x5d1c87);}else{_0x3f96a7[_0xe7fb('0x18')](_0x3f96a7['intervals'][_0x5d1c87['id']],_0x5d1c87);}}}return _0x3f96a7[_0xe7fb('0xb')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x1d')]=function(){var _0x4dcb4b=this;return function(_0x469d50){if(_0x469d50){freeIsNotKey(_0x469d50,_0x4dcb4b[_0xe7fb('0xc')],'id');for(var _0x5da3d9=0x0,_0x5bea27={},_0x52f08b={};_0x5da3d9<_0x469d50[_0xe7fb('0x1a')];_0x5da3d9+=0x1){_0x5bea27=_0x469d50[_0x5da3d9];if(_['isUndefined'](_0x4dcb4b['openchannelQueues'][_0x5bea27['id']])){_0x4dcb4b[_0xe7fb('0xc')][_0x5bea27['id']]=new OpenchannelQueue(_0x5bea27);}else{_0x4dcb4b[_0xe7fb('0x18')](_0x4dcb4b[_0xe7fb('0xc')][_0x5bea27['id']],_0x5bea27);}_0x4dcb4b['openchannelQueues'][_0x5bea27['id']][_0xe7fb('0x1e')]();_0x4dcb4b[_0xe7fb('0xc')][_0x5bea27['id']][_0xe7fb('0x1f')]();}}return _0x4dcb4b[_0xe7fb('0xc')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x20')]=function(){var _0x380130=this;return function(_0x59e015){if(_0x59e015){freeIsNotKey(_0x59e015,_0x380130['chatQueues'],'id');for(var _0x1086e6=0x0,_0x3bdee9={},_0xead63={};_0x1086e6<_0x59e015['length'];_0x1086e6+=0x1){_0x3bdee9=_0x59e015[_0x1086e6];if(_[_0xe7fb('0x1b')](_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']])){_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']]=new ChatQueue(_0x3bdee9);}else{_0x380130[_0xe7fb('0x18')](_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']],_0x3bdee9);}_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']][_0xe7fb('0x1e')]();_0x380130[_0xe7fb('0xd')][_0x3bdee9['id']]['updateRealtime']();}}return _0x380130[_0xe7fb('0xd')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x21')]=function(){var _0x547a04=this;return function(_0x517d70){if(_0x517d70){freeIsNotKey(_0x517d70,_0x547a04[_0xe7fb('0x22')],'id');for(var _0x4a9fea=0x0,_0xac56b4={},_0x2f8774={};_0x4a9fea<_0x517d70[_0xe7fb('0x1a')];_0x4a9fea+=0x1){_0xac56b4=_0x517d70[_0x4a9fea];if(_[_0xe7fb('0x1b')](_0x547a04['smsQueues'][_0xac56b4['id']])){_0x547a04[_0xe7fb('0x22')][_0xac56b4['id']]=new SmsQueue(_0xac56b4);}else{_0x547a04[_0xe7fb('0x18')](_0x547a04[_0xe7fb('0x22')][_0xac56b4['id']],_0xac56b4);}_0x547a04[_0xe7fb('0x22')][_0xac56b4['id']][_0xe7fb('0x1e')]();_0x547a04['smsQueues'][_0xac56b4['id']][_0xe7fb('0x1f')]();}}return _0x547a04[_0xe7fb('0x22')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x23')]=function(){var _0x46f430=this;return function(_0x25e925){if(_0x25e925){freeIsNotKey(_0x25e925,_0x46f430[_0xe7fb('0xe')],'id');for(var _0x147eb1=0x0,_0x389903={},_0x59f9df={};_0x147eb1<_0x25e925[_0xe7fb('0x1a')];_0x147eb1+=0x1){_0x389903=_0x25e925[_0x147eb1];if(_[_0xe7fb('0x1b')](_0x46f430[_0xe7fb('0xe')][_0x389903['id']])){_0x46f430['mailQueues'][_0x389903['id']]=new MailQueue(_0x389903);}else{_0x46f430[_0xe7fb('0x18')](_0x46f430[_0xe7fb('0xe')][_0x389903['id']],_0x389903);}_0x46f430[_0xe7fb('0xe')][_0x389903['id']][_0xe7fb('0x1e')]();_0x46f430[_0xe7fb('0xe')][_0x389903['id']][_0xe7fb('0x1f')]();}}return _0x46f430[_0xe7fb('0xe')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x24')]=function(){var _0xebfe1d=this;return function(_0x29c34a){if(_0x29c34a){freeIsNotKey(_0x29c34a,_0xebfe1d[_0xe7fb('0xf')],'id');for(var _0x1544f2=0x0,_0x1c81fe={},_0xeb7c29={};_0x1544f2<_0x29c34a[_0xe7fb('0x1a')];_0x1544f2+=0x1){_0x1c81fe=_0x29c34a[_0x1544f2];if(_[_0xe7fb('0x1b')](_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']])){_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']]=new FaxQueue(_0x1c81fe);}else{_0xebfe1d['mergeFromDatabase'](_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']],_0x1c81fe);}_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']][_0xe7fb('0x1e')]();_0xebfe1d[_0xe7fb('0xf')][_0x1c81fe['id']]['updateRealtime']();}}return _0xebfe1d[_0xe7fb('0xf')];};};Realtime[_0xe7fb('0x17')][_0xe7fb('0x25')]=function(){var _0x413a13=this;return function(_0x49fe9d){if(_0x49fe9d){freeIsNotKey(_0x49fe9d,_0x413a13[_0xe7fb('0x10')],'id');for(var _0x451a6c=0x0,_0x34265f={},_0x62a8a1={};_0x451a6c<_0x49fe9d[_0xe7fb('0x1a')];_0x451a6c+=0x1){_0x34265f=_0x49fe9d[_0x451a6c];if(_[_0xe7fb('0x1b')](_0x413a13['whatsappQueues'][_0x34265f['id']])){_0x413a13[_0xe7fb('0x10')][_0x34265f['id']]=new WhatsappQueue(_0x34265f);}else{_0x413a13[_0xe7fb('0x18')](_0x413a13[_0xe7fb('0x10')][_0x34265f['id']],_0x34265f);}_0x413a13['whatsappQueues'][_0x34265f['id']][_0xe7fb('0x1e')]();_0x413a13[_0xe7fb('0x10')][_0x34265f['id']]['updateRealtime']();}}return _0x413a13['whatsappQueues'];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 8338e24..1e60af7 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 _0xb88c=['addTags','Request','AddTagsToChatInteraction','../client','update','UpdateChatInteraction'];(function(_0x4efb67,_0x115532){var _0x44ae10=function(_0x5437c9){while(--_0x5437c9){_0x4efb67['push'](_0x4efb67['shift']());}};_0x44ae10(++_0x115532);}(_0xb88c,0x1dd));var _0xcb88=function(_0x16292c,_0x451724){_0x16292c=_0x16292c-0x0;var _0xfb49b3=_0xb88c[_0x16292c];return _0xfb49b3;};'use strict';var client=require(_0xcb88('0x0'));exports[_0xcb88('0x1')]=function(_0x52cb78,_0x34ccf1){return client['Request'](_0xcb88('0x2'),{'body':_0x34ccf1,'options':{'where':{'id':_0x52cb78}},'log':'updateChatInteraction'});};exports[_0xcb88('0x3')]=function(_0x598459,_0x11bcfa){return client[_0xcb88('0x4')](_0xcb88('0x5'),{'body':_0x11bcfa,'options':{'where':{'id':_0x598459}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x3a0e=['addTags','addTagsToChatInteraction','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x119265,_0x46a5c0){var _0x21833a=function(_0x465c4b){while(--_0x465c4b){_0x119265['push'](_0x119265['shift']());}};_0x21833a(++_0x46a5c0);}(_0x3a0e,0x182));var _0xe3a0=function(_0x2431d6,_0x25189a){_0x2431d6=_0x2431d6-0x0;var _0x4d0f9b=_0x3a0e[_0x2431d6];return _0x4d0f9b;};'use strict';var client=require('../client');exports[_0xe3a0('0x0')]=function(_0x1db958,_0x1fa2a0){return client[_0xe3a0('0x1')](_0xe3a0('0x2'),{'body':_0x1fa2a0,'options':{'where':{'id':_0x1db958}},'log':_0xe3a0('0x3')});};exports[_0xe3a0('0x4')]=function(_0x4ef5da,_0x395e28){return client[_0xe3a0('0x1')]('AddTagsToChatInteraction',{'body':_0x395e28,'options':{'where':{'id':_0x4ef5da}},'log':_0xe3a0('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 2d6978b..7c16ca7 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 _0x9c7d=['../client','create'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x9c7d,0x66));var _0xd9c7=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c7d[_0x160c73];return _0xd9302;};'use strict';var client=require(_0xd9c7('0x0'));exports[_0xd9c7('0x1')]=function(_0x126abe){return client['Request']('CreateChatMessage',{'body':_0x126abe,'log':'createChatMessage'});}; \ No newline at end of file +var _0x4f3f=['../client','create','Request','CreateChatMessage','createChatMessage'];(function(_0x592c31,_0x528da9){var _0x44690b=function(_0x7b80c1){while(--_0x7b80c1){_0x592c31['push'](_0x592c31['shift']());}};_0x44690b(++_0x528da9);}(_0x4f3f,0xeb));var _0xf4f3=function(_0x11b81c,_0x5d6179){_0x11b81c=_0x11b81c-0x0;var _0x54a74a=_0x4f3f[_0x11b81c];return _0x54a74a;};'use strict';var client=require(_0xf4f3('0x0'));exports[_0xf4f3('0x1')]=function(_0x1d3063){return client[_0xf4f3('0x2')](_0xf4f3('0x3'),{'body':_0x1d3063,'log':_0xf4f3('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 6044790..a92d46c 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 _0x3ce9=['chatPause','../client','getChatQueues','Request','GetChatQueue','name','online'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3ce9,0xef));var _0x93ce=function(_0x388a5b,_0x176028){_0x388a5b=_0x388a5b-0x0;var _0x3fe853=_0x3ce9[_0x388a5b];return _0x3fe853;};'use strict';var client=require(_0x93ce('0x0'));exports[_0x93ce('0x1')]=function(){return function(){return client[_0x93ce('0x2')](_0x93ce('0x3'),{'options':{'raw':![],'attributes':['id',_0x93ce('0x4'),'timeout','strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0x93ce('0x4'),_0x93ce('0x5'),_0x93ce('0x6')]}]},'log':_0x93ce('0x1')});};}; \ No newline at end of file +var _0xff27=['GetChatQueue','name','strategy','User','Agents','../client','getChatQueues','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff27,0x1ed));var _0x7ff2=function(_0x540160,_0x24c6b6){_0x540160=_0x540160-0x0;var _0x476120=_0xff27[_0x540160];return _0x476120;};'use strict';var client=require(_0x7ff2('0x0'));exports[_0x7ff2('0x1')]=function(){return function(){return client[_0x7ff2('0x2')](_0x7ff2('0x3'),{'options':{'raw':![],'attributes':['id',_0x7ff2('0x4'),'timeout',_0x7ff2('0x5')],'include':[{'model':_0x7ff2('0x6'),'as':_0x7ff2('0x7'),'attributes':['id',_0x7ff2('0x4'),'online','chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 7526c1d..e809d30 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 _0xcf95=['create','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client'];(function(_0x5bbf47,_0x31d1cf){var _0x2446b5=function(_0x33881b){while(--_0x33881b){_0x5bbf47['push'](_0x5bbf47['shift']());}};_0x2446b5(++_0x31d1cf);}(_0xcf95,0xa1));var _0x5cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf95[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x5cf9('0x0'));exports[_0x5cf9('0x1')]=function(_0x4a9fcc){return client['Request']('CreateChatQueueReport',{'body':_0x4a9fcc,'log':_0x5cf9('0x2')});};exports[_0x5cf9('0x3')]=function(_0x24097a,_0x102b24){return client['Request'](_0x5cf9('0x4'),{'body':_0x102b24,'options':{'where':{'uniqueid':_0x24097a},'order':[['id',_0x5cf9('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xe1dc=['Request','CreateChatQueueReport','update','DESC','UpdateChatQueueReport','../client','create'];(function(_0x58ed4e,_0x3431de){var _0xa15bc4=function(_0x3af7a6){while(--_0x3af7a6){_0x58ed4e['push'](_0x58ed4e['shift']());}};_0xa15bc4(++_0x3431de);}(_0xe1dc,0x8a));var _0xce1d=function(_0x596e9f,_0x2cb0a6){_0x596e9f=_0x596e9f-0x0;var _0x480800=_0xe1dc[_0x596e9f];return _0x480800;};'use strict';var client=require(_0xce1d('0x0'));exports[_0xce1d('0x1')]=function(_0x247404){return client[_0xce1d('0x2')](_0xce1d('0x3'),{'body':_0x247404,'log':_0xce1d('0x3')});};exports[_0xce1d('0x4')]=function(_0x4d9fb3,_0xcc6bdf){return client['Request']('UpdateChatQueueReport',{'body':_0xcc6bdf,'options':{'where':{'uniqueid':_0x4d9fb3},'order':[['id',_0xce1d('0x5')]],'limit':0x1},'log':_0xce1d('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 2e8b593..1e97849 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 _0x8efa=['../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags','Request'];(function(_0x45b9b5,_0x46d85c){var _0x21b0b2=function(_0x29b866){while(--_0x29b866){_0x45b9b5['push'](_0x45b9b5['shift']());}};_0x21b0b2(++_0x46d85c);}(_0x8efa,0x1f2));var _0xa8ef=function(_0x525afa,_0xdf4337){_0x525afa=_0x525afa-0x0;var _0x5ddad6=_0x8efa[_0x525afa];return _0x5ddad6;};'use strict';var client=require(_0xa8ef('0x0'));exports[_0xa8ef('0x1')]=function(_0x254b2c,_0x42a3fc){return client['Request'](_0xa8ef('0x2'),{'body':_0x42a3fc,'options':{'where':{'id':_0x254b2c}},'log':_0xa8ef('0x3')});};exports[_0xa8ef('0x4')]=function(_0x25348e,_0x339098){return client[_0xa8ef('0x5')]('AddTagsToFaxInteraction',{'body':_0x339098,'options':{'where':{'id':_0x25348e}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0xa728=['addTagsToFaxInteraction','update','updateFaxInteraction','addTags','AddTagsToFaxInteraction'];(function(_0x32853a,_0x198efd){var _0xdd25b2=function(_0x304421){while(--_0x304421){_0x32853a['push'](_0x32853a['shift']());}};_0xdd25b2(++_0x198efd);}(_0xa728,0x1d2));var _0x8a72=function(_0x2f3ac8,_0x517d22){_0x2f3ac8=_0x2f3ac8-0x0;var _0x511a32=_0xa728[_0x2f3ac8];return _0x511a32;};'use strict';var client=require('../client');exports[_0x8a72('0x0')]=function(_0x209893,_0x1c41bd){return client['Request']('UpdateFaxInteraction',{'body':_0x1c41bd,'options':{'where':{'id':_0x209893}},'log':_0x8a72('0x1')});};exports[_0x8a72('0x2')]=function(_0x1d298e,_0x364b49){return client['Request'](_0x8a72('0x3'),{'body':_0x364b49,'options':{'where':{'id':_0x1d298e}},'log':_0x8a72('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 37439fd..ea5ba01 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 _0x24bd=['createFaxMessage','Request','CreateFaxMessage'];(function(_0x21c222,_0x406d0a){var _0x5ec82a=function(_0x11084a){while(--_0x11084a){_0x21c222['push'](_0x21c222['shift']());}};_0x5ec82a(++_0x406d0a);}(_0x24bd,0x97));var _0xd24b=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x24bd[_0x4e9628];return _0x27bc8c;};'use strict';var client=require('../client');exports['create']=function(_0x595b41){return client[_0xd24b('0x0')](_0xd24b('0x1'),{'body':_0x595b41,'log':_0xd24b('0x2')});}; \ No newline at end of file +var _0x6c07=['../client','create','Request','CreateFaxMessage'];(function(_0x455129,_0x28f859){var _0x309b7d=function(_0x2b1769){while(--_0x2b1769){_0x455129['push'](_0x455129['shift']());}};_0x309b7d(++_0x28f859);}(_0x6c07,0x8c));var _0x76c0=function(_0xf7dca8,_0x5e4d7c){_0xf7dca8=_0xf7dca8-0x0;var _0x1b0f0a=_0x6c07[_0xf7dca8];return _0x1b0f0a;};'use strict';var client=require(_0x76c0('0x0'));exports[_0x76c0('0x1')]=function(_0xdf06e5){return client[_0x76c0('0x2')](_0x76c0('0x3'),{'body':_0xdf06e5,'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 dd00131..a422d08 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 _0xeb9c=['Agents','online','../client','getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xeb9c,0x142));var _0xceb9=function(_0x349b1e,_0x114c00){_0x349b1e=_0x349b1e-0x0;var _0x3d1d8c=_0xeb9c[_0x349b1e];return _0x3d1d8c;};'use strict';var client=require(_0xceb9('0x0'));exports[_0xceb9('0x1')]=function(){return function(){return client[_0xceb9('0x2')](_0xceb9('0x3'),{'options':{'raw':![],'attributes':['id',_0xceb9('0x4'),_0xceb9('0x5'),_0xceb9('0x6')],'include':[{'model':_0xceb9('0x7'),'as':_0xceb9('0x8'),'attributes':['id','name',_0xceb9('0x9'),'faxPause']}]},'log':_0xceb9('0x1')});};}; \ No newline at end of file +var _0x79d4=['getFaxQueues','Request','GetFaxQueue','name','timeout','strategy','User','faxPause','../client'];(function(_0x436a0a,_0x2948e8){var _0x352a45=function(_0x5ed61d){while(--_0x5ed61d){_0x436a0a['push'](_0x436a0a['shift']());}};_0x352a45(++_0x2948e8);}(_0x79d4,0x8f));var _0x479d=function(_0x477a41,_0x15a1cc){_0x477a41=_0x477a41-0x0;var _0x39b8fe=_0x79d4[_0x477a41];return _0x39b8fe;};'use strict';var client=require(_0x479d('0x0'));exports[_0x479d('0x1')]=function(){return function(){return client[_0x479d('0x2')](_0x479d('0x3'),{'options':{'raw':![],'attributes':['id',_0x479d('0x4'),_0x479d('0x5'),_0x479d('0x6')],'include':[{'model':_0x479d('0x7'),'as':'Agents','attributes':['id',_0x479d('0x4'),'online',_0x479d('0x8')]}]},'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 aff727f..2affaf2 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 _0x3b0a=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','create'];(function(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0x3b0a,0xa9));var _0xa3b0=function(_0x4cec16,_0x5dc82d){_0x4cec16=_0x4cec16-0x0;var _0x34fb1e=_0x3b0a[_0x4cec16];return _0x34fb1e;};'use strict';var client=require('../client');exports[_0xa3b0('0x0')]=function(_0x5f557d){return client[_0xa3b0('0x1')](_0xa3b0('0x2'),{'body':_0x5f557d,'log':_0xa3b0('0x2')});};exports[_0xa3b0('0x3')]=function(_0x5c6332,_0x2c0bfe){return client[_0xa3b0('0x1')](_0xa3b0('0x4'),{'body':_0x2c0bfe,'options':{'where':{'uniqueid':_0x5c6332},'order':[['id','DESC']],'limit':0x1},'log':_0xa3b0('0x4')});}; \ No newline at end of file +var _0x05ee=['update','DESC','UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x05ee,0x88));var _0xe05e=function(_0x5c027f,_0xa40135){_0x5c027f=_0x5c027f-0x0;var _0x5392f3=_0x05ee[_0x5c027f];return _0x5392f3;};'use strict';var client=require(_0xe05e('0x0'));exports[_0xe05e('0x1')]=function(_0x38002d){return client[_0xe05e('0x2')](_0xe05e('0x3'),{'body':_0x38002d,'log':_0xe05e('0x3')});};exports[_0xe05e('0x4')]=function(_0x1f1c0a,_0x83013d){return client[_0xe05e('0x2')]('UpdateFaxQueueReport',{'body':_0x83013d,'options':{'where':{'uniqueid':_0x1f1c0a},'order':[['id',_0xe05e('0x5')]],'limit':0x1},'log':_0xe05e('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 52dc1e9..530282f 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 _0x8603=['GetInterval','Intervals','name','interval','getIntervals','Request'];(function(_0x4cb590,_0x767f92){var _0x2ed677=function(_0x4e4661){while(--_0x4e4661){_0x4cb590['push'](_0x4cb590['shift']());}};_0x2ed677(++_0x767f92);}(_0x8603,0x190));var _0x3860=function(_0x513d65,_0x156ef6){_0x513d65=_0x513d65-0x0;var _0x307aa9=_0x8603[_0x513d65];return _0x307aa9;};'use strict';var client=require('../client');exports[_0x3860('0x0')]=function(){return function(){return client[_0x3860('0x1')](_0x3860('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0x3860('0x3'),'attributes':['id',_0x3860('0x4'),_0x3860('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x9ccd=['Request','GetInterval','Intervals','interval','getIntervals','../client'];(function(_0x591fe1,_0x52ed29){var _0x3d494e=function(_0x380980){while(--_0x380980){_0x591fe1['push'](_0x591fe1['shift']());}};_0x3d494e(++_0x52ed29);}(_0x9ccd,0x1a3));var _0xd9cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ccd[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xd9cc('0x0'));exports['getIntervals']=function(){return function(){return client[_0xd9cc('0x1')](_0xd9cc('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0xd9cc('0x3'),'attributes':['id','name',_0xd9cc('0x4')]}]},'log':_0xd9cc('0x5')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index ab590e6..778841f 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 _0xca05=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0xc04091,_0xd149d1){var _0x23dba2=function(_0xffe26b){while(--_0xffe26b){_0xc04091['push'](_0xc04091['shift']());}};_0x23dba2(++_0xd149d1);}(_0xca05,0x192));var _0x5ca0=function(_0x3e2480,_0x2eed70){_0x3e2480=_0x3e2480-0x0;var _0x652c0=_0xca05[_0x3e2480];return _0x652c0;};'use strict';var client=require('../client');exports[_0x5ca0('0x0')]=function(_0x481e49,_0x4470e9){return client[_0x5ca0('0x1')](_0x5ca0('0x2'),{'body':_0x4470e9,'options':{'where':{'id':_0x481e49}},'log':_0x5ca0('0x3')});};exports[_0x5ca0('0x4')]=function(_0x4a23b2,_0x2ceb5c){return client[_0x5ca0('0x1')](_0x5ca0('0x5'),{'body':_0x2ceb5c,'options':{'where':{'id':_0x4a23b2}},'log':_0x5ca0('0x6')});}; \ No newline at end of file +var _0x3596=['addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction'];(function(_0x4ad855,_0x2314b0){var _0x25f9af=function(_0x5c1e04){while(--_0x5c1e04){_0x4ad855['push'](_0x4ad855['shift']());}};_0x25f9af(++_0x2314b0);}(_0x3596,0xce));var _0x6359=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x3596[_0x502c7d];return _0x30b7ed;};'use strict';var client=require(_0x6359('0x0'));exports[_0x6359('0x1')]=function(_0x3becd5,_0x3985d3){return client[_0x6359('0x2')](_0x6359('0x3'),{'body':_0x3985d3,'options':{'where':{'id':_0x3becd5}},'log':'updateMailInteraction'});};exports['addTags']=function(_0x454392,_0x11c50d){return client['Request']('AddTagsToMailInteraction',{'body':_0x11c50d,'options':{'where':{'id':_0x454392}},'log':_0x6359('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 4eb9bd2..b992659 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 _0x9342=['Request','CreateMailMessage','../client'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9342,0x77));var _0x2934=function(_0x4ee05b,_0xb06599){_0x4ee05b=_0x4ee05b-0x0;var _0x1135db=_0x9342[_0x4ee05b];return _0x1135db;};'use strict';var client=require(_0x2934('0x0'));exports['create']=function(_0x141342){return client[_0x2934('0x1')](_0x2934('0x2'),{'body':_0x141342,'log':'createMailMessage'});}; \ No newline at end of file +var _0x2e2a=['../client','create','CreateMailMessage','createMailMessage'];(function(_0x3c59ce,_0x16a2ba){var _0x1fa6a0=function(_0x533a14){while(--_0x533a14){_0x3c59ce['push'](_0x3c59ce['shift']());}};_0x1fa6a0(++_0x16a2ba);}(_0x2e2a,0xa0));var _0xa2e2=function(_0x47b78c,_0x1b6295){_0x47b78c=_0x47b78c-0x0;var _0x230522=_0x2e2a[_0x47b78c];return _0x230522;};'use strict';var client=require(_0xa2e2('0x0'));exports[_0xa2e2('0x1')]=function(_0xc900fa){return client['Request'](_0xa2e2('0x2'),{'body':_0xc900fa,'log':_0xa2e2('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index eafa0f9..648e2cb 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 _0xf83e=['strategy','User','Agents','online','mailPause','getMailQueues','../client','Request'];(function(_0x165235,_0x9089bc){var _0x1ab57e=function(_0x54f25d){while(--_0x54f25d){_0x165235['push'](_0x165235['shift']());}};_0x1ab57e(++_0x9089bc);}(_0xf83e,0x76));var _0xef83=function(_0x26764f,_0x43f4e7){_0x26764f=_0x26764f-0x0;var _0x53c715=_0xf83e[_0x26764f];return _0x53c715;};'use strict';var client=require(_0xef83('0x0'));exports['getMailQueues']=function(){return function(){return client[_0xef83('0x1')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name','timeout',_0xef83('0x2')],'include':[{'model':_0xef83('0x3'),'as':_0xef83('0x4'),'attributes':['id','name',_0xef83('0x5'),_0xef83('0x6')]}]},'log':_0xef83('0x7')});};}; \ No newline at end of file +var _0x579e=['timeout','User','Agents','online','getMailQueues','Request','GetMailQueue','name'];(function(_0x2b95fe,_0x786755){var _0x4f11e5=function(_0x4ee580){while(--_0x4ee580){_0x2b95fe['push'](_0x2b95fe['shift']());}};_0x4f11e5(++_0x786755);}(_0x579e,0x18c));var _0xe579=function(_0x480876,_0x1a435f){_0x480876=_0x480876-0x0;var _0x526cad=_0x579e[_0x480876];return _0x526cad;};'use strict';var client=require('../client');exports[_0xe579('0x0')]=function(){return function(){return client[_0xe579('0x1')](_0xe579('0x2'),{'options':{'raw':![],'attributes':['id',_0xe579('0x3'),_0xe579('0x4'),'strategy'],'include':[{'model':_0xe579('0x5'),'as':_0xe579('0x6'),'attributes':['id',_0xe579('0x3'),_0xe579('0x7'),'mailPause']}]},'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 44dbad6..12882c7 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 _0x70dc=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','../client'];(function(_0x5e8c25,_0x3dde6d){var _0x1797fb=function(_0xffcea5){while(--_0xffcea5){_0x5e8c25['push'](_0x5e8c25['shift']());}};_0x1797fb(++_0x3dde6d);}(_0x70dc,0x135));var _0xc70d=function(_0x24e24c,_0xebc953){_0x24e24c=_0x24e24c-0x0;var _0x30577f=_0x70dc[_0x24e24c];return _0x30577f;};'use strict';var client=require(_0xc70d('0x0'));exports['create']=function(_0x58880a){return client[_0xc70d('0x1')](_0xc70d('0x2'),{'body':_0x58880a,'log':_0xc70d('0x2')});};exports[_0xc70d('0x3')]=function(_0x10116e,_0x5075ee){return client[_0xc70d('0x1')](_0xc70d('0x4'),{'body':_0x5075ee,'options':{'where':{'uniqueid':_0x10116e},'order':[['id','DESC']],'limit':0x1},'log':_0xc70d('0x4')});}; \ No newline at end of file +var _0x3a20=['CreateMailQueueReport','update','UpdateMailQueueReport','create'];(function(_0x4ce02e,_0x4486a9){var _0x4aab50=function(_0xe75522){while(--_0xe75522){_0x4ce02e['push'](_0x4ce02e['shift']());}};_0x4aab50(++_0x4486a9);}(_0x3a20,0x77));var _0x03a2=function(_0x5abc5e,_0x5cc33a){_0x5abc5e=_0x5abc5e-0x0;var _0x47def0=_0x3a20[_0x5abc5e];return _0x47def0;};'use strict';var client=require('../client');exports[_0x03a2('0x0')]=function(_0x4f4229){return client['Request'](_0x03a2('0x1'),{'body':_0x4f4229,'log':_0x03a2('0x1')});};exports[_0x03a2('0x2')]=function(_0x1db317,_0x1dc775){return client['Request'](_0x03a2('0x3'),{'body':_0x1dc775,'options':{'where':{'uniqueid':_0x1db317},'order':[['id','DESC']],'limit':0x1},'log':_0x03a2('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 3938fd9..d6df9ab 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 _0x4216=['../client','update','Request','addTagsToChatInteraction'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x4216,0xdc));var _0x6421=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4216[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x6421('0x0'));exports[_0x6421('0x1')]=function(_0x1f56c6,_0x6a1c56){return client[_0x6421('0x2')]('UpdateOpenchannelInteraction',{'body':_0x6a1c56,'options':{'where':{'id':_0x1f56c6}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x451f7c,_0xe1b0ec){return client[_0x6421('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0xe1b0ec,'options':{'where':{'id':_0x451f7c}},'log':_0x6421('0x3')});}; \ No newline at end of file +var _0x11fd=['addTagsToChatInteraction','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags'];(function(_0x186320,_0x499d76){var _0x548c71=function(_0x47199c){while(--_0x47199c){_0x186320['push'](_0x186320['shift']());}};_0x548c71(++_0x499d76);}(_0x11fd,0x18d));var _0xd11f=function(_0x7913ee,_0x474e80){_0x7913ee=_0x7913ee-0x0;var _0x529d38=_0x11fd[_0x7913ee];return _0x529d38;};'use strict';var client=require('../client');exports[_0xd11f('0x0')]=function(_0x32e2e9,_0x169ec8){return client[_0xd11f('0x1')](_0xd11f('0x2'),{'body':_0x169ec8,'options':{'where':{'id':_0x32e2e9}},'log':_0xd11f('0x3')});};exports[_0xd11f('0x4')]=function(_0x34b384,_0x26cd03){return client[_0xd11f('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0x26cd03,'options':{'where':{'id':_0x34b384}},'log':_0xd11f('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 61defc6..baa6d7d 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 _0xedd9=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x251d9c,_0x580977){var _0x16ae64=function(_0x4d3b53){while(--_0x4d3b53){_0x251d9c['push'](_0x251d9c['shift']());}};_0x16ae64(++_0x580977);}(_0xedd9,0xfc));var _0x9edd=function(_0x6e6e45,_0x1d7bf3){_0x6e6e45=_0x6e6e45-0x0;var _0x5f21e0=_0xedd9[_0x6e6e45];return _0x5f21e0;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x3')});}; \ No newline at end of file +var _0x5b02=['create','Request','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b02,0xe9));var _0x25b0=function(_0x535edb,_0x35bc72){_0x535edb=_0x535edb-0x0;var _0x528327=_0x5b02[_0x535edb];return _0x528327;};'use strict';var client=require(_0x25b0('0x0'));exports[_0x25b0('0x1')]=function(_0x428458){return client[_0x25b0('0x2')]('CreateOpenchannelMessage',{'body':_0x428458,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 83e7f20..32a171d 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 _0x24b8=['GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues'];(function(_0x5d536f,_0x3fa5ae){var _0x3c995a=function(_0x5ac807){while(--_0x5ac807){_0x5d536f['push'](_0x5d536f['shift']());}};_0x3c995a(++_0x3fa5ae);}(_0x24b8,0x8a));var _0x824b=function(_0x9c532c,_0x4b0635){_0x9c532c=_0x9c532c-0x0;var _0x462e18=_0x24b8[_0x9c532c];return _0x462e18;};'use strict';var client=require(_0x824b('0x0'));exports[_0x824b('0x1')]=function(){return function(){return client['Request'](_0x824b('0x2'),{'options':{'raw':![],'attributes':['id',_0x824b('0x3'),_0x824b('0x4'),_0x824b('0x5')],'include':[{'model':_0x824b('0x6'),'as':_0x824b('0x7'),'attributes':['id','name',_0x824b('0x8'),_0x824b('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xbc6f=['Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','name','User'];(function(_0x13bf02,_0x138113){var _0x1509b9=function(_0x962b4c){while(--_0x962b4c){_0x13bf02['push'](_0x13bf02['shift']());}};_0x1509b9(++_0x138113);}(_0xbc6f,0xbb));var _0xfbc6=function(_0x436827,_0x570104){_0x436827=_0x436827-0x0;var _0x22434d=_0xbc6f[_0x436827];return _0x22434d;};'use strict';var client=require(_0xfbc6('0x0'));exports[_0xfbc6('0x1')]=function(){return function(){return client[_0xfbc6('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xfbc6('0x3'),'timeout','strategy'],'include':[{'model':_0xfbc6('0x4'),'as':_0xfbc6('0x5'),'attributes':['id',_0xfbc6('0x3'),_0xfbc6('0x6'),_0xfbc6('0x7')]}]},'log':_0xfbc6('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 2fa2dad..3f31123 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 _0x67fd=['Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','../client','create'];(function(_0x26d02f,_0x12307e){var _0x121816=function(_0x593bd8){while(--_0x593bd8){_0x26d02f['push'](_0x26d02f['shift']());}};_0x121816(++_0x12307e);}(_0x67fd,0xc1));var _0xd67f=function(_0x337182,_0x49b81b){_0x337182=_0x337182-0x0;var _0x2bddf4=_0x67fd[_0x337182];return _0x2bddf4;};'use strict';var client=require(_0xd67f('0x0'));exports[_0xd67f('0x1')]=function(_0x20685d){return client[_0xd67f('0x2')](_0xd67f('0x3'),{'body':_0x20685d,'log':'CreateOpenchannelQueueReport'});};exports['update']=function(_0x55f372,_0x2163b0){return client[_0xd67f('0x2')](_0xd67f('0x4'),{'body':_0x2163b0,'options':{'where':{'uniqueid':_0x55f372},'order':[['id','DESC']],'limit':0x1},'log':_0xd67f('0x4')});}; \ No newline at end of file +var _0x724a=['CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport','DESC'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x724a,0x19f));var _0xa724=function(_0x3d09e2,_0x58e784){_0x3d09e2=_0x3d09e2-0x0;var _0x5d03cd=_0x724a[_0x3d09e2];return _0x5d03cd;};'use strict';var client=require('../client');exports['create']=function(_0x4457d1){return client['Request'](_0xa724('0x0'),{'body':_0x4457d1,'log':_0xa724('0x0')});};exports[_0xa724('0x1')]=function(_0x477f1a,_0x24dac7){return client[_0xa724('0x2')](_0xa724('0x3'),{'body':_0x24dac7,'options':{'where':{'uniqueid':_0x477f1a},'order':[['id',_0xa724('0x4')]],'limit':0x1},'log':_0xa724('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 7abb198..fa5a243 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 _0xd050=['../client','Request','UpdateSmsInteraction','addTags'];(function(_0x25b43b,_0x1433bb){var _0xe9a6d9=function(_0x3d5da5){while(--_0x3d5da5){_0x25b43b['push'](_0x25b43b['shift']());}};_0xe9a6d9(++_0x1433bb);}(_0xd050,0x158));var _0x0d05=function(_0x4cde34,_0x54e24c){_0x4cde34=_0x4cde34-0x0;var _0x4cf4d8=_0xd050[_0x4cde34];return _0x4cf4d8;};'use strict';var client=require(_0x0d05('0x0'));exports['update']=function(_0x15b07a,_0x44f20a){return client[_0x0d05('0x1')](_0x0d05('0x2'),{'body':_0x44f20a,'options':{'where':{'id':_0x15b07a}},'log':'updateSmsInteraction'});};exports[_0x0d05('0x3')]=function(_0x1528b9,_0x2c7fa4){return client[_0x0d05('0x1')]('AddTagsToSmsInteraction',{'body':_0x2c7fa4,'options':{'where':{'id':_0x1528b9}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x9748=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x3d5e98,_0x53cb2b){var _0x411562=function(_0x24193a){while(--_0x24193a){_0x3d5e98['push'](_0x3d5e98['shift']());}};_0x411562(++_0x53cb2b);}(_0x9748,0x122));var _0x8974=function(_0x49b331,_0x45527b){_0x49b331=_0x49b331-0x0;var _0x4ca4b7=_0x9748[_0x49b331];return _0x4ca4b7;};'use strict';var client=require(_0x8974('0x0'));exports[_0x8974('0x1')]=function(_0x440124,_0x1ba05b){return client['Request'](_0x8974('0x2'),{'body':_0x1ba05b,'options':{'where':{'id':_0x440124}},'log':_0x8974('0x3')});};exports[_0x8974('0x4')]=function(_0x3ac75b,_0x39ad39){return client['Request'](_0x8974('0x5'),{'body':_0x39ad39,'options':{'where':{'id':_0x3ac75b}},'log':_0x8974('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index c4ea0ed..c41f5b6 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 _0x6db1=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x3c2e88,_0xf8ed3f){var _0x5536b0=function(_0x173500){while(--_0x173500){_0x3c2e88['push'](_0x3c2e88['shift']());}};_0x5536b0(++_0xf8ed3f);}(_0x6db1,0x13e));var _0x16db=function(_0x3cd161,_0x4dbac3){_0x3cd161=_0x3cd161-0x0;var _0x4bbdbf=_0x6db1[_0x3cd161];return _0x4bbdbf;};'use strict';var client=require(_0x16db('0x0'));exports[_0x16db('0x1')]=function(_0x13e841){return client[_0x16db('0x2')](_0x16db('0x3'),{'body':_0x13e841,'log':_0x16db('0x4')});}; \ No newline at end of file +var _0xebe1=['create','Request','../client'];(function(_0x43e99c,_0x21a2ba){var _0x20167e=function(_0x529bcd){while(--_0x529bcd){_0x43e99c['push'](_0x43e99c['shift']());}};_0x20167e(++_0x21a2ba);}(_0xebe1,0xf2));var _0x1ebe=function(_0x1a23d3,_0x19d8c0){_0x1a23d3=_0x1a23d3-0x0;var _0x14fff5=_0xebe1[_0x1a23d3];return _0x14fff5;};'use strict';var client=require(_0x1ebe('0x0'));exports[_0x1ebe('0x1')]=function(_0x1c5254){return client[_0x1ebe('0x2')]('CreateSmsMessage',{'body':_0x1c5254,'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 56468ad..026ebc4 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 _0x4a9a=['timeout','User','Agents','smsPause','getSmsQueues','Request','name'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0x4a9a,0x123));var _0xa4a9=function(_0x2ea9b9,_0x43cf28){_0x2ea9b9=_0x2ea9b9-0x0;var _0xff0b58=_0x4a9a[_0x2ea9b9];return _0xff0b58;};'use strict';var client=require('../client');exports[_0xa4a9('0x0')]=function(){return function(){return client[_0xa4a9('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0xa4a9('0x2'),_0xa4a9('0x3'),'strategy'],'include':[{'model':_0xa4a9('0x4'),'as':_0xa4a9('0x5'),'attributes':['id','name','online',_0xa4a9('0x6')]}]},'log':_0xa4a9('0x0')});};}; \ No newline at end of file +var _0xca72=['Request','name','strategy','User','Agents','smsPause','getSmsQueues'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xca72,0x1bf));var _0x2ca7=function(_0x2932cf,_0x362fd9){_0x2932cf=_0x2932cf-0x0;var _0x1711dd=_0xca72[_0x2932cf];return _0x1711dd;};'use strict';var client=require('../client');exports[_0x2ca7('0x0')]=function(){return function(){return client[_0x2ca7('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x2ca7('0x2'),'timeout',_0x2ca7('0x3')],'include':[{'model':_0x2ca7('0x4'),'as':_0x2ca7('0x5'),'attributes':['id',_0x2ca7('0x2'),'online',_0x2ca7('0x6')]}]},'log':_0x2ca7('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 0a3f79c..70c1ff4 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 _0x49d9=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0x49d9,0x13e));var _0x949d=function(_0x514c83,_0x3aab8e){_0x514c83=_0x514c83-0x0;var _0x117031=_0x49d9[_0x514c83];return _0x117031;};'use strict';var client=require(_0x949d('0x0'));exports[_0x949d('0x1')]=function(_0x2b5027){return client[_0x949d('0x2')](_0x949d('0x3'),{'body':_0x2b5027,'log':'CreateSmsQueueReport'});};exports[_0x949d('0x4')]=function(_0x2cb999,_0x29136d){return client[_0x949d('0x2')](_0x949d('0x5'),{'body':_0x29136d,'options':{'where':{'uniqueid':_0x2cb999},'order':[['id','DESC']],'limit':0x1},'log':_0x949d('0x5')});}; \ No newline at end of file +var _0x685f=['DESC','../client','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x1ff8b4,_0x1e0931){var _0x2a66e1=function(_0x40daf6){while(--_0x40daf6){_0x1ff8b4['push'](_0x1ff8b4['shift']());}};_0x2a66e1(++_0x1e0931);}(_0x685f,0xc7));var _0xf685=function(_0x38d45b,_0x54c034){_0x38d45b=_0x38d45b-0x0;var _0x112c3d=_0x685f[_0x38d45b];return _0x112c3d;};'use strict';var client=require(_0xf685('0x0'));exports['create']=function(_0x1af520){return client[_0xf685('0x1')](_0xf685('0x2'),{'body':_0x1af520,'log':_0xf685('0x2')});};exports[_0xf685('0x3')]=function(_0x35025f,_0x2ad5dd){return client[_0xf685('0x1')](_0xf685('0x4'),{'body':_0x2ad5dd,'options':{'where':{'uniqueid':_0x35025f},'order':[['id',_0xf685('0x5')]],'limit':0x1},'log':_0xf685('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index e85015b..5bf1fae 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 _0x0e01=['GetUser','voicePause','mailPause','smsPause','whatsappPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','smsCapacity','whatsappCapacity','../client','getAgents','Request'];(function(_0x163b50,_0x4535e9){var _0x2d8549=function(_0x3532f3){while(--_0x3532f3){_0x163b50['push'](_0x163b50['shift']());}};_0x2d8549(++_0x4535e9);}(_0x0e01,0x89));var _0x10e0=function(_0x1ee72a,_0x22998b){_0x1ee72a=_0x1ee72a-0x0;var _0x26a531=_0x0e01[_0x1ee72a];return _0x26a531;};'use strict';var client=require(_0x10e0('0x0'));exports[_0x10e0('0x1')]=function(){return function(){return client[_0x10e0('0x2')](_0x10e0('0x3'),{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id','name','online','pauseType','lastPauseAt',_0x10e0('0x4'),'chatPause',_0x10e0('0x5'),'faxPause',_0x10e0('0x6'),_0x10e0('0x7'),_0x10e0('0x8'),_0x10e0('0x9'),_0x10e0('0xa'),_0x10e0('0xb'),_0x10e0('0xc'),_0x10e0('0xd'),'openchannelCapacity']},'log':_0x10e0('0x1')});};}; \ No newline at end of file +var _0x7e2b=['whatsappPause','openchannelPause','chatCapacity','mailCapacity','faxCapacity','whatsappCapacity','openchannelCapacity','../client','getAgents','Request','GetUser','agent','name','online','pauseType','chatPause','faxPause'];(function(_0x298429,_0x489a97){var _0x26d669=function(_0x414ee7){while(--_0x414ee7){_0x298429['push'](_0x298429['shift']());}};_0x26d669(++_0x489a97);}(_0x7e2b,0xd3));var _0xb7e2=function(_0x289cf5,_0x501dfc){_0x289cf5=_0x289cf5-0x0;var _0x1f316d=_0x7e2b[_0x289cf5];return _0x1f316d;};'use strict';var client=require(_0xb7e2('0x0'));exports[_0xb7e2('0x1')]=function(){return function(){return client[_0xb7e2('0x2')](_0xb7e2('0x3'),{'options':{'raw':!![],'where':{'role':_0xb7e2('0x4')},'attributes':['id',_0xb7e2('0x5'),_0xb7e2('0x6'),_0xb7e2('0x7'),'lastPauseAt','voicePause',_0xb7e2('0x8'),'mailPause',_0xb7e2('0x9'),'smsPause',_0xb7e2('0xa'),_0xb7e2('0xb'),_0xb7e2('0xc'),_0xb7e2('0xd'),_0xb7e2('0xe'),'smsCapacity',_0xb7e2('0xf'),_0xb7e2('0x10')]},'log':'getAgents'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 32eda95..1289ac9 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 _0xc298=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update'];(function(_0x32fe84,_0x245dfb){var _0x21cf3f=function(_0x11507c){while(--_0x11507c){_0x32fe84['push'](_0x32fe84['shift']());}};_0x21cf3f(++_0x245dfb);}(_0xc298,0x143));var _0x8c29=function(_0x1662a0,_0x2a19cd){_0x1662a0=_0x1662a0-0x0;var _0xbb687f=_0xc298[_0x1662a0];return _0xbb687f;};'use strict';var client=require('../client');exports[_0x8c29('0x0')]=function(_0x19c394,_0x184d9f){return client[_0x8c29('0x1')](_0x8c29('0x2'),{'body':_0x184d9f,'options':{'where':{'id':_0x19c394}},'log':_0x8c29('0x3')});};exports['addTags']=function(_0x9da56d,_0x229bf9){return client[_0x8c29('0x1')](_0x8c29('0x4'),{'body':_0x229bf9,'options':{'where':{'id':_0x9da56d}},'log':_0x8c29('0x5')});}; \ No newline at end of file +var _0x2bd6=['../client','update','Request','updateWhatsappInteraction','addTags'];(function(_0xcbcfd1,_0x5e1f67){var _0x21ab7f=function(_0x46d8b4){while(--_0x46d8b4){_0xcbcfd1['push'](_0xcbcfd1['shift']());}};_0x21ab7f(++_0x5e1f67);}(_0x2bd6,0x1f4));var _0x62bd=function(_0x2a0183,_0x3fc93c){_0x2a0183=_0x2a0183-0x0;var _0x158c3a=_0x2bd6[_0x2a0183];return _0x158c3a;};'use strict';var client=require(_0x62bd('0x0'));exports[_0x62bd('0x1')]=function(_0x469dda,_0x30ace1){return client[_0x62bd('0x2')]('UpdateWhatsappInteraction',{'body':_0x30ace1,'options':{'where':{'id':_0x469dda}},'log':_0x62bd('0x3')});};exports[_0x62bd('0x4')]=function(_0x23ba52,_0x4a7608){return client[_0x62bd('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x4a7608,'options':{'where':{'id':_0x23ba52}},'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 4d49e8f..5ce518f 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 _0x8670=['create','Request','../client'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x8670,0x80));var _0x0867=function(_0x54f3e8,_0x3ed493){_0x54f3e8=_0x54f3e8-0x0;var _0x267b37=_0x8670[_0x54f3e8];return _0x267b37;};'use strict';var client=require(_0x0867('0x0'));exports[_0x0867('0x1')]=function(_0x3217b1){return client[_0x0867('0x2')]('CreateWhatsappMessage',{'body':_0x3217b1,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x155d=['CreateWhatsappMessage','../client','create','Request'];(function(_0x1da1ae,_0x19ee7b){var _0x4d7976=function(_0x343eb7){while(--_0x343eb7){_0x1da1ae['push'](_0x1da1ae['shift']());}};_0x4d7976(++_0x19ee7b);}(_0x155d,0xa1));var _0xd155=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x155d[_0x231e16];return _0x570a7c;};'use strict';var client=require(_0xd155('0x0'));exports[_0xd155('0x1')]=function(_0x34da96){return client[_0xd155('0x2')](_0xd155('0x3'),{'body':_0x34da96,'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 0d1a9b3..d7c9c4c 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 _0xdc9b=['../client','getWhatsappQueues','Request','name','timeout','Agents','whatsappPause'];(function(_0x3a4f0c,_0x308523){var _0x4d7f1b=function(_0x40111c){while(--_0x40111c){_0x3a4f0c['push'](_0x3a4f0c['shift']());}};_0x4d7f1b(++_0x308523);}(_0xdc9b,0x70));var _0xbdc9=function(_0xa61cd1,_0x428179){_0xa61cd1=_0xa61cd1-0x0;var _0x2be4fa=_0xdc9b[_0xa61cd1];return _0x2be4fa;};'use strict';var client=require(_0xbdc9('0x0'));exports[_0xbdc9('0x1')]=function(){return function(){return client[_0xbdc9('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xbdc9('0x3'),_0xbdc9('0x4'),'strategy'],'include':[{'model':'User','as':_0xbdc9('0x5'),'attributes':['id',_0xbdc9('0x3'),'online',_0xbdc9('0x6')]}]},'log':_0xbdc9('0x1')});};}; \ No newline at end of file +var _0xb688=['getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','Agents','online','whatsappPause'];(function(_0x3c6979,_0x54618f){var _0x1a4b83=function(_0x28722d){while(--_0x28722d){_0x3c6979['push'](_0x3c6979['shift']());}};_0x1a4b83(++_0x54618f);}(_0xb688,0xcf));var _0x8b68=function(_0x2da695,_0xd49cff){_0x2da695=_0x2da695-0x0;var _0x16eb47=_0xb688[_0x2da695];return _0x16eb47;};'use strict';var client=require('../client');exports[_0x8b68('0x0')]=function(){return function(){return client[_0x8b68('0x1')](_0x8b68('0x2'),{'options':{'raw':![],'attributes':['id',_0x8b68('0x3'),_0x8b68('0x4'),_0x8b68('0x5')],'include':[{'model':'User','as':_0x8b68('0x6'),'attributes':['id',_0x8b68('0x3'),_0x8b68('0x7'),_0x8b68('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index da62dd2..9a7730e 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 _0x1f8c=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','create'];(function(_0x17476f,_0x5d16be){var _0x1f71ff=function(_0x3e390e){while(--_0x3e390e){_0x17476f['push'](_0x17476f['shift']());}};_0x1f71ff(++_0x5d16be);}(_0x1f8c,0x1da));var _0xc1f8=function(_0x40ebff,_0x1dd15e){_0x40ebff=_0x40ebff-0x0;var _0x40122a=_0x1f8c[_0x40ebff];return _0x40122a;};'use strict';var client=require('../client');exports[_0xc1f8('0x0')]=function(_0x41c870){return client['Request'](_0xc1f8('0x1'),{'body':_0x41c870,'log':_0xc1f8('0x1')});};exports[_0xc1f8('0x2')]=function(_0x2c21de,_0x28ea90){return client['Request'](_0xc1f8('0x3'),{'body':_0x28ea90,'options':{'where':{'uniqueid':_0x2c21de},'order':[['id',_0xc1f8('0x4')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0x933e=['UpdateWhatsappQueueReport','DESC','create','Request','CreateWhatsappQueueReport'];(function(_0x31c989,_0x4da200){var _0x34e4a1=function(_0xcab8c5){while(--_0xcab8c5){_0x31c989['push'](_0x31c989['shift']());}};_0x34e4a1(++_0x4da200);}(_0x933e,0x12e));var _0xe933=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x933e[_0x40a045];return _0x1a687c;};'use strict';var client=require('../client');exports[_0xe933('0x0')]=function(_0x35de18){return client[_0xe933('0x1')](_0xe933('0x2'),{'body':_0x35de18,'log':_0xe933('0x2')});};exports['update']=function(_0x22764a,_0x2202ea){return client[_0xe933('0x1')](_0xe933('0x3'),{'body':_0x2202ea,'options':{'where':{'uniqueid':_0x22764a},'order':[['id',_0xe933('0x4')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 1c4727a..4939905 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 _0x166e=['[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','message','join','stop','find','agents','createQueue','channel','format','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log'];(function(_0x75e489,_0x36108f){var _0x4f0398=function(_0x44c449){while(--_0x44c449){_0x75e489['push'](_0x75e489['shift']());}};_0x4f0398(++_0x36108f);}(_0x166e,0x174));var _0xe166=function(_0x3693f6,_0x5af811){_0x3693f6=_0x3693f6-0x0;var _0x4458ad=_0x166e[_0x3693f6];return _0x4458ad;};'use strict';var schema=require(_0xe166('0x0'));var _=require(_0xe166('0x1'));var util=require(_0xe166('0x2'));var seqqueue=require(_0xe166('0x3'));var logger=require('../../../../config/logger')(_0xe166('0x4'));var strategy=require(_0xe166('0x5'));var queue=schema({'name':{'type':_0xe166('0x6'),'required':!![],'message':_0xe166('0x7')},'timeout':{'type':'number','message':_0xe166('0x8')}});function writeLog(_0x399719,_0x4770d7,_0x13bc0d){return logger[_0xe166('0x9')](util['format'](_0xe166('0xa'),_0x399719,_0x4770d7[_0xe166('0xb')],_0x13bc0d));}function handleFindAgent(_0x576471){return function(_0xad8e07){return _0xad8e07['name'][_0xe166('0xc')]()===_0x576471['toLowerCase']();};}exports[_0xe166('0xd')]=function(_0xb693be,_0x26c62d,_0x2301fa,_0x590155){return function(_0x2e313a){try{var _0x3303d4={'name':_0x26c62d[0x0],'timeout':_0x26c62d[0x1]};var _0x2fe5d8=queue[_0xe166('0x0')](_0x3303d4,{'typecast':!![]});if(_0x2fe5d8[_0xe166('0xe')]){logger[_0xe166('0xf')](_0xe166('0x10'),_0xb693be,_['map'](_0x2fe5d8,_0xe166('0x11'))[_0xe166('0x12')](',\x20'));_0x2e313a[_0xe166('0x13')]();}else{var _0x675fd1=_[_0xe166('0x14')](_0x2301fa[_0xe166('0x15')],handleFindAgent(_0x3303d4[_0xe166('0xb')]));if(_0x675fd1){var _0x46e92d=(_0x3303d4['timeout']||0xa)*0x3e8;var _0x5fbc5b,_0x57caac;var _0x1f9efc=seqqueue[_0xe166('0x16')](_0x46e92d);_0x1f9efc['id']=_0xb693be;_0x1f9efc['atimeout']=_0x46e92d;_0x1f9efc['channel']=_0x590155[_0xe166('0x17')];writeLog(_0xb693be,_0x675fd1,util[_0xe166('0x18')](_0xe166('0x19'),_0x46e92d));_0x2301fa[_0xe166('0x1a')][_0xb693be]['on'](_0xe166('0x1b'),function(){logger['info'](_0xe166('0x1c'),_0xb693be);clearTimeout(_0x57caac);_0x57caac=undefined;_0x1f9efc[_0xe166('0x1d')]();if(_0x2301fa['rules'][_0xb693be]){delete _0x2301fa['rules'][_0xb693be];}_0x2e313a[_0xe166('0x13')]();});_0x2301fa[_0xe166('0x1a')][_0xb693be]['on']('complete',function(){if(_0x2301fa[_0xe166('0x1a')][_0xb693be]){delete _0x2301fa[_0xe166('0x1a')][_0xb693be];}});_0x57caac=setTimeout(function(){logger[_0xe166('0x9')](_0xe166('0x1e'),_0xb693be);clearTimeout(_0x57caac);_0x1f9efc[_0xe166('0x1d')]();_0x2e313a[_0xe166('0x1f')]();},_0x46e92d);strategy[_0xe166('0x20')](_0x1f9efc,_0x675fd1,_0x2301fa,_0x590155);}else{logger[_0xe166('0xf')](_0xe166('0x21'),_0xb693be,_0x3303d4[_0xe166('0xb')]);_0x2e313a[_0xe166('0x13')]();}}}catch(_0x329741){console[_0xe166('0x22')](_0x329741);logger[_0xe166('0xf')](_0xe166('0x23'),_0xb693be,_0x329741[_0xe166('0x24')]);_0x2e313a[_0xe166('0x13')]();}};}; \ No newline at end of file +var _0xd00d=['info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','agents','timeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][QUEUE]\x20%s','stack','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','number','timeout\x20is\x20a\x20number'];(function(_0x332b9f,_0xea0354){var _0x4d2b6d=function(_0x55b3fe){while(--_0x55b3fe){_0x332b9f['push'](_0x332b9f['shift']());}};_0x4d2b6d(++_0xea0354);}(_0xd00d,0x1b2));var _0xdd00=function(_0x381379,_0x3f3b86){_0x381379=_0x381379-0x0;var _0x3e1063=_0xd00d[_0x381379];return _0x3e1063;};'use strict';var schema=require('validate');var _=require(_0xdd00('0x0'));var util=require(_0xdd00('0x1'));var seqqueue=require(_0xdd00('0x2'));var logger=require(_0xdd00('0x3'))(_0xdd00('0x4'));var strategy=require(_0xdd00('0x5'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0xdd00('0x6'),'message':_0xdd00('0x7')}});function writeLog(_0x3902b2,_0x27b544,_0xf8a8e4){return logger[_0xdd00('0x8')](util[_0xdd00('0x9')](_0xdd00('0xa'),_0x3902b2,_0x27b544[_0xdd00('0xb')],_0xf8a8e4));}function handleFindAgent(_0x32f86b){return function(_0x2467e5){return _0x2467e5[_0xdd00('0xb')][_0xdd00('0xc')]()===_0x32f86b[_0xdd00('0xc')]();};}exports[_0xdd00('0xd')]=function(_0x9269b2,_0x46bad9,_0x41b669,_0x5e5721){return function(_0x2a0ff1){try{var _0x1081e4={'name':_0x46bad9[0x0],'timeout':_0x46bad9[0x1]};var _0x329c4d=queue['validate'](_0x1081e4,{'typecast':!![]});if(_0x329c4d[_0xdd00('0xe')]){logger[_0xdd00('0xf')](_0xdd00('0x10'),_0x9269b2,_[_0xdd00('0x11')](_0x329c4d,_0xdd00('0x12'))[_0xdd00('0x13')](',\x20'));_0x2a0ff1[_0xdd00('0x14')]();}else{var _0x34a10a=_['find'](_0x41b669[_0xdd00('0x15')],handleFindAgent(_0x1081e4[_0xdd00('0xb')]));if(_0x34a10a){var _0xd3dcd5=(_0x1081e4[_0xdd00('0x16')]||0xa)*0x3e8;var _0x5afc34,_0x54a4ba;var _0x566675=seqqueue['createQueue'](_0xd3dcd5);_0x566675['id']=_0x9269b2;_0x566675['atimeout']=_0xd3dcd5;_0x566675[_0xdd00('0x17')]=_0x5e5721['channel'];writeLog(_0x9269b2,_0x34a10a,util[_0xdd00('0x9')](_0xdd00('0x18'),_0xd3dcd5));_0x41b669[_0xdd00('0x19')][_0x9269b2]['on'](_0xdd00('0x1a'),function(){logger[_0xdd00('0x8')](_0xdd00('0x1b'),_0x9269b2);clearTimeout(_0x54a4ba);_0x54a4ba=undefined;_0x566675[_0xdd00('0x1c')]();if(_0x41b669[_0xdd00('0x19')][_0x9269b2]){delete _0x41b669[_0xdd00('0x19')][_0x9269b2];}_0x2a0ff1[_0xdd00('0x14')]();});_0x41b669['rules'][_0x9269b2]['on']('complete',function(){if(_0x41b669[_0xdd00('0x19')][_0x9269b2]){delete _0x41b669['rules'][_0x9269b2];}});_0x54a4ba=setTimeout(function(){logger['info'](_0xdd00('0x1d'),_0x9269b2);clearTimeout(_0x54a4ba);_0x566675[_0xdd00('0x1c')]();_0x2a0ff1[_0xdd00('0x1e')]();},_0xd3dcd5);strategy[_0xdd00('0x1f')](_0x566675,_0x34a10a,_0x41b669,_0x5e5721);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x9269b2,_0x1081e4[_0xdd00('0xb')]);_0x2a0ff1[_0xdd00('0x14')]();}}}catch(_0x4f537e){console['log'](_0x4f537e);logger[_0xdd00('0xf')](_0xdd00('0x20'),_0x9269b2,_0x4f537e[_0xdd00('0x21')]);_0x2a0ff1['stop']();}};}; \ 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 49409df..8ccc2d9 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 _0xdb84=['catch','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','created','body','getMustacheRender','create','then','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','$LATEST','message','amazonlex','providerName','providerResponse','dialogState','Failed'];(function(_0x5d1bd8,_0x1836cb){var _0xa3e236=function(_0x554391){while(--_0x554391){_0x5d1bd8['push'](_0x5d1bd8['shift']());}};_0xa3e236(++_0x1836cb);}(_0xdb84,0x158));var _0x4db8=function(_0x3328fa,_0x6e1c0d){_0x3328fa=_0x3328fa-0x0;var _0x239bfc=_0xdb84[_0x3328fa];return _0x239bfc;};'use strict';var _=require(_0x4db8('0x0'));var moment=require(_0x4db8('0x1'));var AWS=require(_0x4db8('0x2'));var utils=require('./utils');var logger=require(_0x4db8('0x3'))(_0x4db8('0x4'));var rpc={'chatMessage':require(_0x4db8('0x5')),'openchannelMessage':require(_0x4db8('0x6')),'mailMessage':require(_0x4db8('0x7')),'smsMessage':require(_0x4db8('0x8')),'faxMessage':require(_0x4db8('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x4db8('0xa')]=function(_0x437e70,_0x55b169){return function(_0x44a51e){try{if(!_[_0x4db8('0xb')](this[_0x4db8('0xc')]['UserId'])){logger[_0x4db8('0xd')](_0x4db8('0xe'),_0x437e70,_0x4db8('0xf'));return _0x44a51e[_0x4db8('0x10')]();}var _0x1dba0f={'ContactId':this[_0x4db8('0x11')]['id'],'sentAt':moment()[_0x4db8('0x12')](_0x4db8('0x13')),'direction':_0x4db8('0x14')};if(this[_0x4db8('0x15')]===_0x4db8('0x16')||this[_0x4db8('0x15')]===_0x4db8('0x17')){_0x1dba0f[_0x4db8('0x18')]=this[_0x4db8('0xc')][_0x4db8('0x18')];}var _0x36acd6=this[_0x4db8('0x15')];if(_0x36acd6===_0x4db8('0x19')){_0x1dba0f[_0x4db8('0x1a')]=this[_0x4db8('0x1b')]['id'];}else{_0x1dba0f[_['upperFirst'](_0x36acd6)+_0x4db8('0x1c')]=this[_0x4db8('0x1b')]['id'];}_0x1dba0f[_[_0x4db8('0x1d')](_0x36acd6)+_0x4db8('0x1e')]=this[_0x4db8('0xc')]['id'];if(this['interaction'][_0x4db8('0x1f')]){var _0x7f0014=_0x55b169[0x4];if(!_['isEmpty'](_0x7f0014)){_0x1dba0f[_0x4db8('0x20')]=utils[_0x4db8('0x21')](_0x7f0014,this);return rpc[_0x36acd6+'Message'][_0x4db8('0x22')](_0x1dba0f)[_0x4db8('0x23')](function(_0x2896f4){logger[_0x4db8('0xd')]('[%s][AMAZONLEX]\x20%s',_0x437e70,_0x1dba0f['body']);})['catch'](function(_0x10052a){logger[_0x4db8('0x24')]('[%s][AMAZONLEX]\x20%s',_0x437e70,JSON[_0x4db8('0x25')](_0x10052a));})[_0x4db8('0x26')](function(){logger[_0x4db8('0xd')](_0x4db8('0x27'),_0x437e70);_0x44a51e['stop']();});}else{logger[_0x4db8('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x437e70);_0x44a51e[_0x4db8('0x28')]();}}else{var _0x2ab762=this;var _0x23399a=new AWS['LexRuntime']({'accessKeyId':_0x55b169[0x0],'secretAccessKey':_0x55b169[0x1],'region':_0x55b169[0x2]});var _0x2df0c5={'botAlias':_0x4db8('0x29'),'botName':_0x55b169[0x3],'inputText':this[_0x4db8('0x2a')][_0x4db8('0x20')],'userId':this[_0x4db8('0x15')]+':'+this['interaction']['id']['toString']()};_0x23399a['postText'](_0x2df0c5,function(_0x209eee,_0x50e5df){if(_0x209eee){logger[_0x4db8('0x24')](_0x4db8('0xe'),_0x437e70,_0x209eee['message']);_0x44a51e[_0x4db8('0x10')]();}else if(_0x50e5df&&_0x50e5df[_0x4db8('0x2a')]){_0x2ab762['body'][_0x4db8('0x2b')]=_0x50e5df;_0x1dba0f[_0x4db8('0x20')]=_0x50e5df[_0x4db8('0x2a')];_0x1dba0f[_0x4db8('0x2c')]=_0x4db8('0x2b');_0x1dba0f[_0x4db8('0x2d')]=JSON[_0x4db8('0x25')](_0x50e5df);return rpc[_0x36acd6+'Message']['create'](_0x1dba0f)[_0x4db8('0x23')](function(_0x4f5092){logger[_0x4db8('0xd')](_0x4db8('0xe'),_0x437e70,_0x1dba0f[_0x4db8('0x20')]);if(_0x50e5df[_0x4db8('0x2e')]==_0x4db8('0x2f')){_0x44a51e[_0x4db8('0x10')]();}else{_0x44a51e['stop']();}})[_0x4db8('0x30')](function(_0xc29af5){logger[_0x4db8('0x24')](_0x4db8('0xe'),_0x437e70,JSON[_0x4db8('0x25')](_0xc29af5));_0x44a51e[_0x4db8('0x10')]();});}else{_0x44a51e[_0x4db8('0x10')]();}});}}catch(_0x220297){logger['error'](_0x4db8('0xe'),_0x437e70,JSON['stringify'](_0x220297));_0x44a51e['stop']();}};}; \ No newline at end of file +var _0x2c21=['moment','aws-sdk','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','account','created','isEmpty','body','getMustacheRender','Message','then','[%s][AMAZONLEX]\x20%s','catch','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','postText','error','amazonlex','providerName','create','Failed','lodash'];(function(_0x5e13ae,_0x3be91c){var _0x1ea319=function(_0x36e9e4){while(--_0x36e9e4){_0x5e13ae['push'](_0x5e13ae['shift']());}};_0x1ea319(++_0x3be91c);}(_0x2c21,0x1d5));var _0x12c2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2c21[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x12c2('0x0'));var moment=require(_0x12c2('0x1'));var AWS=require(_0x12c2('0x2'));var utils=require(_0x12c2('0x3'));var logger=require(_0x12c2('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x12c2('0x5')),'mailMessage':require(_0x12c2('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x12c2('0x7'))};exports[_0x12c2('0x8')]=function(_0x38dd72,_0x4e7180){return function(_0x31ed4f){try{if(!_['isNil'](this[_0x12c2('0x9')][_0x12c2('0xa')])){logger[_0x12c2('0xb')]('[%s][AMAZONLEX]\x20%s',_0x38dd72,_0x12c2('0xc'));return _0x31ed4f[_0x12c2('0xd')]();}var _0x1b0b5d={'ContactId':this[_0x12c2('0xe')]['id'],'sentAt':moment()[_0x12c2('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x12c2('0x10')};if(this[_0x12c2('0x11')]===_0x12c2('0x12')||this[_0x12c2('0x11')]===_0x12c2('0x13')){_0x1b0b5d[_0x12c2('0x14')]=this[_0x12c2('0x9')][_0x12c2('0x14')];}var _0x2fd34a=this[_0x12c2('0x11')];if(_0x2fd34a===_0x12c2('0x15')){_0x1b0b5d[_0x12c2('0x16')]=this['account']['id'];}else{_0x1b0b5d[_[_0x12c2('0x17')](_0x2fd34a)+'AccountId']=this[_0x12c2('0x18')]['id'];}_0x1b0b5d[_[_0x12c2('0x17')](_0x2fd34a)+'InteractionId']=this['interaction']['id'];if(this['interaction'][_0x12c2('0x19')]){var _0x181efe=_0x4e7180[0x4];if(!_[_0x12c2('0x1a')](_0x181efe)){_0x1b0b5d[_0x12c2('0x1b')]=utils[_0x12c2('0x1c')](_0x181efe,this);return rpc[_0x2fd34a+_0x12c2('0x1d')]['create'](_0x1b0b5d)[_0x12c2('0x1e')](function(_0x5a7353){logger[_0x12c2('0xb')](_0x12c2('0x1f'),_0x38dd72,_0x1b0b5d[_0x12c2('0x1b')]);})[_0x12c2('0x20')](function(_0x24fa29){logger['error'](_0x12c2('0x1f'),_0x38dd72,JSON[_0x12c2('0x21')](_0x24fa29));})[_0x12c2('0x22')](function(){logger['info'](_0x12c2('0x23'),_0x38dd72);_0x31ed4f[_0x12c2('0x24')]();});}else{logger[_0x12c2('0xb')](_0x12c2('0x25'),_0x38dd72);_0x31ed4f[_0x12c2('0x24')]();}}else{var _0x38485c=this;var _0x5e39c9=new AWS[(_0x12c2('0x26'))]({'accessKeyId':_0x4e7180[0x0],'secretAccessKey':_0x4e7180[0x1],'region':_0x4e7180[0x2]});var _0x8cd515={'botAlias':_0x12c2('0x27'),'botName':_0x4e7180[0x3],'inputText':this[_0x12c2('0x28')][_0x12c2('0x1b')],'userId':this[_0x12c2('0x11')]+':'+this['interaction']['id']['toString']()};_0x5e39c9[_0x12c2('0x29')](_0x8cd515,function(_0x5555d6,_0xa3d28f){if(_0x5555d6){logger[_0x12c2('0x2a')]('[%s][AMAZONLEX]\x20%s',_0x38dd72,_0x5555d6[_0x12c2('0x28')]);_0x31ed4f['next']();}else if(_0xa3d28f&&_0xa3d28f[_0x12c2('0x28')]){_0x38485c[_0x12c2('0x1b')][_0x12c2('0x2b')]=_0xa3d28f;_0x1b0b5d['body']=_0xa3d28f[_0x12c2('0x28')];_0x1b0b5d[_0x12c2('0x2c')]=_0x12c2('0x2b');_0x1b0b5d['providerResponse']=JSON['stringify'](_0xa3d28f);return rpc[_0x2fd34a+'Message'][_0x12c2('0x2d')](_0x1b0b5d)[_0x12c2('0x1e')](function(_0x1141a2){logger[_0x12c2('0xb')](_0x12c2('0x1f'),_0x38dd72,_0x1b0b5d['body']);if(_0xa3d28f['dialogState']==_0x12c2('0x2e')){_0x31ed4f[_0x12c2('0xd')]();}else{_0x31ed4f[_0x12c2('0x24')]();}})['catch'](function(_0x457218){logger[_0x12c2('0x2a')]('[%s][AMAZONLEX]\x20%s',_0x38dd72,JSON[_0x12c2('0x21')](_0x457218));_0x31ed4f['next']();});}else{_0x31ed4f[_0x12c2('0xd')]();}});}}catch(_0x5bcd70){logger[_0x12c2('0x2a')](_0x12c2('0x1f'),_0x38dd72,JSON[_0x12c2('0x21')](_0x5bcd70));_0x31ed4f['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 75c0254..5e70fd4 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 _0x18f3=['../../rpc/faxMessage','../../rpc/whatsappMessage','../../mailRpc','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','mail','body','getMustacheRender','message','from','phone','subject','startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','InteractionId','Smtp','service','host','port','secure','auth','user','pass','inReplyTo','messageId','html','','replace','','auto-replied','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','Message','moment','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/smsMessage'];(function(_0x5c6688,_0x7b129){var _0x2104a6=function(_0x381bbc){while(--_0x381bbc){_0x5c6688['push'](_0x5c6688['shift']());}};_0x2104a6(++_0x7b129);}(_0x18f3,0x19f));var _0x318f=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x18f3[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var moment=require(_0x318f('0x0'));var utils=require(_0x318f('0x1'));var logger=require(_0x318f('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x318f('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x318f('0x4')),'faxMessage':require(_0x318f('0x5')),'whatsappMessage':require(_0x318f('0x6'))};var mailRpc=require(_0x318f('0x7'));exports['consequence']=function(_0x5f7340,_0x3579e8){return function(_0x49188c){try{if(_0x3579e8[0x0]==='1'&&(_['isNil'](this[_0x318f('0x8')]['created'])||!this[_0x318f('0x8')][_0x318f('0x9')])){logger[_0x318f('0xa')](_0x318f('0xb'),_0x5f7340,_0x318f('0xc'));return _0x49188c[_0x318f('0xd')]();}var _0x48abee=this[_0x318f('0xe')];var _0x1e9916={'ContactId':this[_0x318f('0xf')]['id'],'sentAt':moment()[_0x318f('0x10')](_0x318f('0x11')),'direction':_0x318f('0x12')};if(this[_0x318f('0xe')]===_0x318f('0x13')){_0x1e9916['body']=utils['getMustacheRender'](_0x3579e8[0x2],this);}else{_0x1e9916[_0x318f('0x14')]=utils[_0x318f('0x15')](_0x3579e8[0x1],this);}if(this[_0x318f('0x16')]){_0x1e9916['to']=this[_0x318f('0x16')][_0x318f('0x17')]||'';if(this[_0x318f('0xe')]===_0x318f('0x13')&&_0x3579e8[0x1]==='1'){_0x1e9916['cc']=this['message']['cc']||'';}_0x1e9916[_0x318f('0x17')]=this['message']['to']||'';_0x1e9916['phone']=this[_0x318f('0x16')][_0x318f('0x18')]||'';_0x1e9916['read']=!![];if(this['message'][_0x318f('0x19')]){_0x1e9916['subject']='';_0x1e9916[_0x318f('0x19')]+=_[_0x318f('0x1a')](this[_0x318f('0x16')][_0x318f('0x19')],_0x318f('0x1b'))?'':'Re:\x20';_0x1e9916[_0x318f('0x19')]+=this[_0x318f('0x16')][_0x318f('0x19')];}}if(this[_0x318f('0xe')]===_0x318f('0x1c')){_0x1e9916[_0x318f('0x1d')]=this[_0x318f('0x1e')]['id'];}else{_0x1e9916[_[_0x318f('0x1f')](this[_0x318f('0xe')])+'AccountId']=this['account']['id'];}_0x1e9916[_[_0x318f('0x1f')](this[_0x318f('0xe')])+_0x318f('0x20')]=this['interaction']['id'];if(rpc[this[_0x318f('0xe')]+'Message']){if(this[_0x318f('0xe')]==='mail'){var _0x47087a={'tls':{'rejectUnauthorized':![]}};if(this[_0x318f('0x1e')][_0x318f('0x21')][_0x318f('0x22')]){_0x47087a[_0x318f('0x22')]=this[_0x318f('0x1e')][_0x318f('0x21')][_0x318f('0x22')];}else{_0x47087a[_0x318f('0x23')]=this[_0x318f('0x1e')][_0x318f('0x21')][_0x318f('0x23')];_0x47087a[_0x318f('0x24')]=this[_0x318f('0x1e')][_0x318f('0x21')][_0x318f('0x24')];_0x47087a[_0x318f('0x25')]=this[_0x318f('0x1e')][_0x318f('0x21')][_0x318f('0x25')];}if(this[_0x318f('0x1e')][_0x318f('0x21')]['authentication']){_0x47087a[_0x318f('0x26')]={'user':this['account'][_0x318f('0x21')][_0x318f('0x27')],'pass':this[_0x318f('0x1e')][_0x318f('0x21')][_0x318f('0x28')]};}_0x1e9916[_0x318f('0x29')]=this[_0x318f('0x16')][_0x318f('0x2a')];_0x1e9916[_0x318f('0x2b')]=_0x318f('0x2c')+_[_0x318f('0x2d')](_0x1e9916[_0x318f('0x14')],_0x318f('0x2e'),'','','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','lodash','moment','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../mailRpc','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','channel','format','YYYY-MM-DD\x20HH:mm:ss','out','body','getMustacheRender','message','from','mail','phone','read','subject','startsWith','Re:\x20','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','Smtp','service'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xfc6d,0x1e6));var _0xdfc6=function(_0x49363f,_0x558747){_0x49363f=_0x49363f-0x0;var _0x2a6b67=_0xfc6d[_0x49363f];return _0x2a6b67;};'use strict';var _=require(_0xdfc6('0x0'));var moment=require(_0xdfc6('0x1'));var utils=require(_0xdfc6('0x2'));var logger=require(_0xdfc6('0x3'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xdfc6('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xdfc6('0x5')),'faxMessage':require(_0xdfc6('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};var mailRpc=require(_0xdfc6('0x7'));exports['consequence']=function(_0x87927f,_0x2fc9e6){return function(_0x2c45d6){try{if(_0x2fc9e6[0x0]==='1'&&(_[_0xdfc6('0x8')](this[_0xdfc6('0x9')][_0xdfc6('0xa')])||!this[_0xdfc6('0x9')][_0xdfc6('0xa')])){logger[_0xdfc6('0xb')](_0xdfc6('0xc'),_0x87927f,_0xdfc6('0xd'));return _0x2c45d6[_0xdfc6('0xe')]();}var _0xf15ae8=this[_0xdfc6('0xf')];var _0x2151c8={'ContactId':this['contact']['id'],'sentAt':moment()[_0xdfc6('0x10')](_0xdfc6('0x11')),'direction':_0xdfc6('0x12')};if(this[_0xdfc6('0xf')]==='mail'){_0x2151c8[_0xdfc6('0x13')]=utils[_0xdfc6('0x14')](_0x2fc9e6[0x2],this);}else{_0x2151c8[_0xdfc6('0x13')]=utils[_0xdfc6('0x14')](_0x2fc9e6[0x1],this);}if(this[_0xdfc6('0x15')]){_0x2151c8['to']=this[_0xdfc6('0x15')][_0xdfc6('0x16')]||'';if(this[_0xdfc6('0xf')]===_0xdfc6('0x17')&&_0x2fc9e6[0x1]==='1'){_0x2151c8['cc']=this[_0xdfc6('0x15')]['cc']||'';}_0x2151c8[_0xdfc6('0x16')]=this[_0xdfc6('0x15')]['to']||'';_0x2151c8['phone']=this[_0xdfc6('0x15')][_0xdfc6('0x18')]||'';_0x2151c8[_0xdfc6('0x19')]=!![];if(this[_0xdfc6('0x15')][_0xdfc6('0x1a')]){_0x2151c8[_0xdfc6('0x1a')]='';_0x2151c8[_0xdfc6('0x1a')]+=_[_0xdfc6('0x1b')](this[_0xdfc6('0x15')][_0xdfc6('0x1a')],'Re:')?'':_0xdfc6('0x1c');_0x2151c8['subject']+=this[_0xdfc6('0x15')][_0xdfc6('0x1a')];}}if(this[_0xdfc6('0xf')]==='chat'){_0x2151c8[_0xdfc6('0x1d')]=this[_0xdfc6('0x1e')]['id'];}else{_0x2151c8[_['upperFirst'](this[_0xdfc6('0xf')])+_0xdfc6('0x1f')]=this[_0xdfc6('0x1e')]['id'];}_0x2151c8[_[_0xdfc6('0x20')](this[_0xdfc6('0xf')])+_0xdfc6('0x21')]=this['interaction']['id'];if(rpc[this[_0xdfc6('0xf')]+'Message']){if(this[_0xdfc6('0xf')]===_0xdfc6('0x17')){var _0x240fa6={'tls':{'rejectUnauthorized':![]}};if(this[_0xdfc6('0x1e')][_0xdfc6('0x22')]['service']){_0x240fa6[_0xdfc6('0x23')]=this[_0xdfc6('0x1e')][_0xdfc6('0x22')][_0xdfc6('0x23')];}else{_0x240fa6[_0xdfc6('0x24')]=this['account'][_0xdfc6('0x22')]['host'];_0x240fa6['port']=this[_0xdfc6('0x1e')]['Smtp']['port'];_0x240fa6[_0xdfc6('0x25')]=this[_0xdfc6('0x1e')]['Smtp'][_0xdfc6('0x25')];}if(this['account'][_0xdfc6('0x22')][_0xdfc6('0x26')]){_0x240fa6['auth']={'user':this[_0xdfc6('0x1e')]['Smtp']['user'],'pass':this[_0xdfc6('0x1e')]['Smtp'][_0xdfc6('0x27')]};}_0x2151c8[_0xdfc6('0x28')]=this['message'][_0xdfc6('0x29')];_0x2151c8['html']=_0xdfc6('0x2a')+_['replace'](_0x2151c8[_0xdfc6('0x13')],_0xdfc6('0x2b'),_0xdfc6('0x2c'))+_0xdfc6('0x2d');_0x2151c8['headers']={'Auto-Submitted':_0xdfc6('0x2e'),'X-Auto-Response-Suppress':_0xdfc6('0x2f'),'Precedence':_0xdfc6('0x30')};return mailRpc[_0xdfc6('0x31')](_0x240fa6,_0x2151c8)[_0xdfc6('0x32')](function(_0x1c1af6){logger[_0xdfc6('0xb')](_0xdfc6('0x33'),_0x87927f);_0x2151c8[_0xdfc6('0x29')]=_0x1c1af6['message']['messageId'];return rpc[_0xf15ae8+_0xdfc6('0x34')]['create'](_0x2151c8);})[_0xdfc6('0x32')](function(_0x83675e){logger[_0xdfc6('0xb')](_0xdfc6('0xc'),_0x87927f,JSON[_0xdfc6('0x35')](_0x83675e));})[_0xdfc6('0x36')](function(_0x14c30c){logger[_0xdfc6('0x37')](_0xdfc6('0x38'),_0x87927f,JSON[_0xdfc6('0x35')](_0x14c30c));})[_0xdfc6('0x39')](function(){_0x2c45d6[_0xdfc6('0xe')]();});}else{return rpc[this[_0xdfc6('0xf')]+_0xdfc6('0x34')]['create'](_0x2151c8)['then'](function(_0x6c3e61){logger[_0xdfc6('0xb')](_0xdfc6('0xc'),_0x87927f,_0x2151c8[_0xdfc6('0x13')]);})['catch'](function(_0x2b4d91){logger[_0xdfc6('0x37')](_0xdfc6('0xc'),_0x87927f,JSON[_0xdfc6('0x35')](_0x2b4d91));})['finally'](function(){_0x2c45d6[_0xdfc6('0xe')]();});}}}catch(_0x53b5a1){logger[_0xdfc6('0x37')](_0xdfc6('0xc'),_0x87927f,JSON['stringify'](_0x53b5a1));_0x2c45d6['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index fe39cbb..917010a 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6bb4=['error','finally','stringify','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','system','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch'];(function(_0x5a8aa3,_0x2294d5){var _0x5d0458=function(_0x62d096){while(--_0x62d096){_0x5a8aa3['push'](_0x5a8aa3['shift']());}};_0x5d0458(++_0x2294d5);}(_0x6bb4,0x1a7));var _0x46bb=function(_0x58d2bf,_0x1a9e15){_0x58d2bf=_0x58d2bf-0x0;var _0x23d6ce=_0x6bb4[_0x58d2bf];return _0x23d6ce;};'use strict';var moment=require(_0x46bb('0x0'));var logger=require(_0x46bb('0x1'))(_0x46bb('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x46bb('0x3')),'smsInteraction':require(_0x46bb('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x46bb('0x5')),'whatsappInteraction':require(_0x46bb('0x6'))};exports[_0x46bb('0x7')]=function(_0x3c8bef,_0xdd2ba5,_0x2ae90f,_0x5dd7d6){return function(_0x4fa5c4){try{logger[_0x46bb('0x8')](_0x46bb('0x9'),_0x3c8bef,_0xdd2ba5[0x0]);var _0x57fb08={'closed':0x1,'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0x46bb('0xa'),'disposition':_0xdd2ba5[0x0]};if(rpc[_0x5dd7d6[_0x46bb('0xb')]+'Interaction']){rpc[_0x5dd7d6[_0x46bb('0xb')]+_0x46bb('0xc')][_0x46bb('0xd')](_0x5dd7d6['interaction']['id'],_0x57fb08)[_0x46bb('0xe')](function(_0x2f23e4){logger['info'](_0x46bb('0xf'),_0x3c8bef,_0x5dd7d6[_0x46bb('0x10')]['id']);})[_0x46bb('0x11')](function(_0x54cbac){logger[_0x46bb('0x12')]('[%s][CLOSE]\x20%s',_0x3c8bef,JSON['stringify'](_0x54cbac));})[_0x46bb('0x13')](function(){_0x4fa5c4['stop']();});}}catch(_0x30b3cd){logger[_0x46bb('0x12')]('[%s][CLOSE]\x20%s',_0x3c8bef,JSON[_0x46bb('0x14')](_0x30b3cd));_0x4fa5c4['stop']();}};}; \ No newline at end of file +var _0xd916=['routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd916,0x18a));var _0x6d91=function(_0x4860c5,_0x28cf03){_0x4860c5=_0x4860c5-0x0;var _0x289a2e=_0xd916[_0x4860c5];return _0x289a2e;};'use strict';var moment=require(_0x6d91('0x0'));var logger=require(_0x6d91('0x1'))(_0x6d91('0x2'));var rpc={'chatInteraction':require(_0x6d91('0x3')),'openchannelInteraction':require(_0x6d91('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x6d91('0x5')),'faxInteraction':require(_0x6d91('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x35101c,_0x1c4b6e,_0x59c589,_0x1f5cfc){return function(_0x3fcd82){try{logger[_0x6d91('0x7')](_0x6d91('0x8'),_0x35101c,_0x1c4b6e[0x0]);var _0x3b7135={'closed':0x1,'closedAt':moment()[_0x6d91('0x9')](_0x6d91('0xa')),'closeReason':'system','disposition':_0x1c4b6e[0x0]};if(rpc[_0x1f5cfc['channel']+'Interaction']){rpc[_0x1f5cfc['channel']+_0x6d91('0xb')][_0x6d91('0xc')](_0x1f5cfc[_0x6d91('0xd')]['id'],_0x3b7135)[_0x6d91('0xe')](function(_0xcffafb){logger['info'](_0x6d91('0xf'),_0x35101c,_0x1f5cfc[_0x6d91('0xd')]['id']);})[_0x6d91('0x10')](function(_0x218c03){logger[_0x6d91('0x11')](_0x6d91('0x12'),_0x35101c,JSON[_0x6d91('0x13')](_0x218c03));})[_0x6d91('0x14')](function(){_0x3fcd82[_0x6d91('0x15')]();});}}catch(_0x10a623){logger[_0x6d91('0x11')](_0x6d91('0x12'),_0x35101c,JSON[_0x6d91('0x13')](_0x10a623));_0x3fcd82[_0x6d91('0x15')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 00b90bb..15c3a4e 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc157=['dialogflow','result','speech','providerName','providerResponse','metadata','next','lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','isEmpty','getMustacheRender','Message','create','then','body','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message'];(function(_0xc637ef,_0x1fe189){var _0x5a8f9b=function(_0x718a4c){while(--_0x718a4c){_0xc637ef['push'](_0xc637ef['shift']());}};_0x5a8f9b(++_0x1fe189);}(_0xc157,0x1c9));var _0x7c15=function(_0x3bdda7,_0x402b3b){_0x3bdda7=_0x3bdda7-0x0;var _0x3b75f9=_0xc157[_0x3bdda7];return _0x3b75f9;};'use strict';var _=require(_0x7c15('0x0'));var moment=require(_0x7c15('0x1'));var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0x7c15('0x2'));var logger=require('../../../../config/logger')(_0x7c15('0x3'));var rpc={'chatMessage':require(_0x7c15('0x4')),'openchannelMessage':require(_0x7c15('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x7c15('0x6')),'faxMessage':require(_0x7c15('0x7')),'whatsappMessage':require(_0x7c15('0x8'))};exports['consequence']=function(_0x2c34a6,_0x336101){return function(_0x3a870f){try{if(!_['isNil'](this['interaction']['UserId'])){logger[_0x7c15('0x9')](_0x7c15('0xa'),_0x2c34a6,_0x7c15('0xb'));return _0x3a870f['next']();}var _0x5d7036={'ContactId':this[_0x7c15('0xc')]['id'],'sentAt':moment()[_0x7c15('0xd')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x7c15('0xe')]==='sms'||this[_0x7c15('0xe')]===_0x7c15('0xf')){_0x5d7036[_0x7c15('0x10')]=this[_0x7c15('0x11')][_0x7c15('0x10')];}var _0x462bb7=this[_0x7c15('0xe')];if(_0x462bb7===_0x7c15('0x12')){_0x5d7036[_0x7c15('0x13')]=this[_0x7c15('0x14')]['id'];}else{_0x5d7036[_['upperFirst'](_0x462bb7)+_0x7c15('0x15')]=this[_0x7c15('0x14')]['id'];}_0x5d7036[_[_0x7c15('0x16')](_0x462bb7)+_0x7c15('0x17')]=this[_0x7c15('0x11')]['id'];if(this[_0x7c15('0x11')]['created']){var _0x178a77=_0x336101[0x2];if(!_[_0x7c15('0x18')](_0x178a77)){_0x5d7036['body']=utils[_0x7c15('0x19')](_0x178a77,this);return rpc[_0x462bb7+_0x7c15('0x1a')][_0x7c15('0x1b')](_0x5d7036)[_0x7c15('0x1c')](function(_0x47cdd0){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x2c34a6,_0x5d7036[_0x7c15('0x1d')]);})[_0x7c15('0x1e')](function(_0x591b9e){logger[_0x7c15('0x1f')]('[%s][DIALOGFLOW]\x20%s',_0x2c34a6,JSON[_0x7c15('0x20')](_0x591b9e));})['finally'](function(){logger[_0x7c15('0x9')](_0x7c15('0x21'),_0x2c34a6);_0x3a870f[_0x7c15('0x22')]();});}else{logger['info'](_0x7c15('0x23'),_0x2c34a6);_0x3a870f[_0x7c15('0x22')]();}}else{var _0x529b9a=this;var _0x447c65=apiai(_0x336101[0x0],{'language':_0x336101[0x1]||'en'});return _0x447c65[_0x7c15('0x24')](this[_0x7c15('0x25')][_0x7c15('0x1d')],{'sessionId':md5(this['interaction']['id'])})[_0x7c15('0x1c')](function(_0x360993){_0x529b9a[_0x7c15('0x1d')][_0x7c15('0x26')]=_0x360993;_0x5d7036[_0x7c15('0x1d')]=_0x360993[_0x7c15('0x27')]['fulfillment'][_0x7c15('0x28')];_0x5d7036[_0x7c15('0x29')]=_0x7c15('0x26');_0x5d7036[_0x7c15('0x2a')]=JSON[_0x7c15('0x20')](_0x360993);return rpc[_0x462bb7+'Message'][_0x7c15('0x1b')](_0x5d7036)[_0x7c15('0x1c')](function(_0x2f3fc7){logger[_0x7c15('0x9')](_0x7c15('0xa'),_0x2c34a6,_0x5d7036[_0x7c15('0x1d')]);if(_0x360993['result'][_0x7c15('0x2b')]['endConversation']){_0x3a870f[_0x7c15('0x2c')]();}else{_0x3a870f[_0x7c15('0x22')]();}})['catch'](function(_0x37dbfd){logger[_0x7c15('0x1f')](_0x7c15('0xa'),_0x2c34a6,JSON[_0x7c15('0x20')](_0x37dbfd));_0x3a870f[_0x7c15('0x2c')]();});})[_0x7c15('0x1e')](function(_0x1fd161){logger[_0x7c15('0x1f')](_0x7c15('0xa'),_0x2c34a6,_0x1fd161[_0x7c15('0x25')]);_0x3a870f[_0x7c15('0x2c')]();});}}catch(_0x37ab48){logger[_0x7c15('0x1f')](_0x7c15('0xa'),_0x2c34a6,JSON[_0x7c15('0x20')](_0x37ab48));_0x3a870f[_0x7c15('0x22')]();}};}; \ No newline at end of file +var _0x9115=['routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','ChatWebsiteId','upperFirst','AccountId','account','created','body','getMustacheRender','Message','create','then','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','result','fulfillment','providerName','metadata','endConversation','catch','error','moment','apiai-promise','md5','./utils'];(function(_0x1a0e6a,_0x1b43de){var _0x4b3934=function(_0x81dc97){while(--_0x81dc97){_0x1a0e6a['push'](_0x1a0e6a['shift']());}};_0x4b3934(++_0x1b43de);}(_0x9115,0x8f));var _0x5911=function(_0x1b6563,_0x3bf0f1){_0x1b6563=_0x1b6563-0x0;var _0xdea7b8=_0x9115[_0x1b6563];return _0xdea7b8;};'use strict';var _=require('lodash');var moment=require(_0x5911('0x0'));var apiai=require(_0x5911('0x1'));var md5=require(_0x5911('0x2'));var utils=require(_0x5911('0x3'));var logger=require('../../../../config/logger')(_0x5911('0x4'));var rpc={'chatMessage':require(_0x5911('0x5')),'openchannelMessage':require(_0x5911('0x6')),'mailMessage':require(_0x5911('0x7')),'smsMessage':require(_0x5911('0x8')),'faxMessage':require(_0x5911('0x9')),'whatsappMessage':require(_0x5911('0xa'))};exports[_0x5911('0xb')]=function(_0x335f01,_0x43e5b5){return function(_0x495c70){try{if(!_[_0x5911('0xc')](this[_0x5911('0xd')]['UserId'])){logger[_0x5911('0xe')](_0x5911('0xf'),_0x335f01,_0x5911('0x10'));return _0x495c70[_0x5911('0x11')]();}var _0x54463c={'ContactId':this[_0x5911('0x12')]['id'],'sentAt':moment()[_0x5911('0x13')](_0x5911('0x14')),'direction':'out'};if(this[_0x5911('0x15')]===_0x5911('0x16')||this[_0x5911('0x15')]==='whatsapp'){_0x54463c[_0x5911('0x17')]=this[_0x5911('0xd')][_0x5911('0x17')];}var _0xf4ebd4=this[_0x5911('0x15')];if(_0xf4ebd4==='chat'){_0x54463c[_0x5911('0x18')]=this['account']['id'];}else{_0x54463c[_[_0x5911('0x19')](_0xf4ebd4)+_0x5911('0x1a')]=this[_0x5911('0x1b')]['id'];}_0x54463c[_['upperFirst'](_0xf4ebd4)+'InteractionId']=this[_0x5911('0xd')]['id'];if(this[_0x5911('0xd')][_0x5911('0x1c')]){var _0x2e5da4=_0x43e5b5[0x2];if(!_['isEmpty'](_0x2e5da4)){_0x54463c[_0x5911('0x1d')]=utils[_0x5911('0x1e')](_0x2e5da4,this);return rpc[_0xf4ebd4+_0x5911('0x1f')][_0x5911('0x20')](_0x54463c)[_0x5911('0x21')](function(_0xf76eda){logger[_0x5911('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x335f01,_0x54463c[_0x5911('0x1d')]);})['catch'](function(_0x458c9f){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x335f01,JSON[_0x5911('0x22')](_0x458c9f));})[_0x5911('0x23')](function(){logger[_0x5911('0xe')](_0x5911('0x24'),_0x335f01);_0x495c70[_0x5911('0x25')]();});}else{logger['info'](_0x5911('0x26'),_0x335f01);_0x495c70[_0x5911('0x25')]();}}else{var _0xc0d323=this;var _0x1be0bf=apiai(_0x43e5b5[0x0],{'language':_0x43e5b5[0x1]||'en'});return _0x1be0bf[_0x5911('0x27')](this[_0x5911('0x28')][_0x5911('0x1d')],{'sessionId':md5(this['interaction']['id'])})[_0x5911('0x21')](function(_0x5ead52){_0xc0d323['body'][_0x5911('0x29')]=_0x5ead52;_0x54463c[_0x5911('0x1d')]=_0x5ead52[_0x5911('0x2a')][_0x5911('0x2b')]['speech'];_0x54463c[_0x5911('0x2c')]=_0x5911('0x29');_0x54463c['providerResponse']=JSON['stringify'](_0x5ead52);return rpc[_0xf4ebd4+_0x5911('0x1f')][_0x5911('0x20')](_0x54463c)[_0x5911('0x21')](function(_0x32db85){logger[_0x5911('0xe')](_0x5911('0xf'),_0x335f01,_0x54463c[_0x5911('0x1d')]);if(_0x5ead52[_0x5911('0x2a')][_0x5911('0x2d')][_0x5911('0x2e')]){_0x495c70['next']();}else{_0x495c70[_0x5911('0x25')]();}})['catch'](function(_0x5b865d){logger['error'](_0x5911('0xf'),_0x335f01,JSON['stringify'](_0x5b865d));_0x495c70['next']();});})[_0x5911('0x2f')](function(_0x5167eb){logger[_0x5911('0x30')]('[%s][DIALOGFLOW]\x20%s',_0x335f01,_0x5167eb[_0x5911('0x28')]);_0x495c70['next']();});}}catch(_0x37d0da){logger[_0x5911('0x30')](_0x5911('0xf'),_0x335f01,JSON[_0x5911('0x22')](_0x37d0da));_0x495c70[_0x5911('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 50a899b..f4385a5 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x43b7=['routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','create','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','next','contact','format','channel','whatsapp','phone','chat','account','AccountId','upperFirst','created','getMustacheRender','Message','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','SessionsClient','detectIntent','then','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','push','fulfillmentText','all','message','lodash','moment','../../../../config/logger'];(function(_0xe81823,_0x324f10){var _0x5314dd=function(_0x226e95){while(--_0x226e95){_0xe81823['push'](_0xe81823['shift']());}};_0x5314dd(++_0x324f10);}(_0x43b7,0x183));var _0x743b=function(_0x51b40f,_0x56cd55){_0x51b40f=_0x51b40f-0x0;var _0x4078a5=_0x43b7[_0x51b40f];return _0x4078a5;};'use strict';var _=require(_0x743b('0x0'));var dialogflow=require('dialogflow');var md5=require('md5');var moment=require(_0x743b('0x1'));var Promise=require('bluebird');var logger=require(_0x743b('0x2'))(_0x743b('0x3'));var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x743b('0x4')),'mailMessage':require(_0x743b('0x5')),'smsMessage':require(_0x743b('0x6')),'faxMessage':require(_0x743b('0x7')),'whatsappMessage':require(_0x743b('0x8'))};function createMessage(_0x1b25ec,_0x2560ad,_0x515ed3,_0x542c29){return new Promise(function(_0x5c3a06,_0x58b553){var _0x4b9090=_[_0x743b('0x9')](_0x515ed3);_0x4b9090[_0x743b('0xa')]=_0x542c29;return rpc[_0x2560ad+'Message'][_0x743b('0xb')](_0x4b9090)['then'](function(){logger[_0x743b('0xc')](_0x743b('0xd'),_0x1b25ec,_0x4b9090[_0x743b('0xa')]);_0x5c3a06();})[_0x743b('0xe')](function(_0xd35fc){logger[_0x743b('0xf')](_0x743b('0xd'),_0x1b25ec,JSON[_0x743b('0x10')](_0xd35fc));_0x58b553(_0xd35fc);});});}exports[_0x743b('0x11')]=function(_0x31e885,_0x1a81e6){return function(_0x479b9b){try{if(!_[_0x743b('0x12')](this[_0x743b('0x13')][_0x743b('0x14')])){logger[_0x743b('0xc')](_0x743b('0xd'),_0x31e885,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x479b9b[_0x743b('0x15')]();}var _0x1ebd0c={'ContactId':this[_0x743b('0x16')]['id'],'sentAt':moment()[_0x743b('0x17')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x743b('0x18')]==='sms'||this[_0x743b('0x18')]===_0x743b('0x19')){_0x1ebd0c[_0x743b('0x1a')]=this[_0x743b('0x13')][_0x743b('0x1a')];}var _0x652f30=this[_0x743b('0x18')];if(_0x652f30===_0x743b('0x1b')){_0x1ebd0c['ChatWebsiteId']=this[_0x743b('0x1c')]['id'];}else{_0x1ebd0c[_['upperFirst'](_0x652f30)+_0x743b('0x1d')]=this[_0x743b('0x1c')]['id'];}_0x1ebd0c[_[_0x743b('0x1e')](_0x652f30)+'InteractionId']=this[_0x743b('0x13')]['id'];if(this['interaction'][_0x743b('0x1f')]){var _0x375fd1=_0x1a81e6[0x4];if(!_['isEmpty'](_0x375fd1)){_0x1ebd0c[_0x743b('0xa')]=utils[_0x743b('0x20')](_0x375fd1,this);return rpc[_0x652f30+_0x743b('0x21')][_0x743b('0xb')](_0x1ebd0c)['then'](function(_0x5754ee){logger[_0x743b('0xc')](_0x743b('0xd'),_0x31e885,_0x1ebd0c[_0x743b('0xa')]);})['catch'](function(_0x1220aa){logger[_0x743b('0xf')](_0x743b('0xd'),_0x31e885,JSON[_0x743b('0x10')](_0x1220aa));})[_0x743b('0x22')](function(){logger[_0x743b('0xc')](_0x743b('0x23'),_0x31e885);_0x479b9b[_0x743b('0x24')]();});}else{logger[_0x743b('0xc')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x31e885);_0x479b9b[_0x743b('0x24')]();}}else{var _0x15155b=this;var _0x2cfb4b=_0x1a81e6[0x2]['replace'](/\\n/g,'\x0a');var _0x2f8c31={'credentials':{'private_key':_0x2cfb4b,'client_email':_0x1a81e6[0x1]}};var _0x2b42a2=new dialogflow[(_0x743b('0x25'))](_0x2f8c31);var _0x32da37=_0x2b42a2['sessionPath'](_0x1a81e6[0x0],md5(_0x15155b['interaction']['id']));var _0x32673a={'session':_0x32da37,'queryInput':{'text':{'text':_0x15155b['message'][_0x743b('0xa')],'languageCode':_0x1a81e6[0x3]||'en'}}};return _0x2b42a2[_0x743b('0x26')](_0x32673a)[_0x743b('0x27')](function(_0x1479bc){if(_0x1479bc&&_0x1479bc[_0x743b('0x28')]){_0x15155b[_0x743b('0xa')][_0x743b('0x29')]=_0x1479bc;var _0x53df8f=_0x1479bc[0x0];var _0x4ce6da=_0x53df8f[_0x743b('0x2a')]['diagnosticInfo']&&_0x53df8f['queryResult'][_0x743b('0x2b')]['fields']?_0x53df8f[_0x743b('0x2a')][_0x743b('0x2b')][_0x743b('0x2c')][_0x743b('0x2d')][_0x743b('0x2e')]:![];_0x15155b[_0x743b('0xa')]['DIALOGFLOWV2_ACTION']=_0x53df8f['queryResult'][_0x743b('0x2f')];_0x15155b['body']['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x53df8f['queryResult'][_0x743b('0x30')];_0x15155b[_0x743b('0xa')][_0x743b('0x31')]=_0x53df8f[_0x743b('0x2a')][_0x743b('0x2b')]&&_0x53df8f[_0x743b('0x2a')]['diagnosticInfo'][_0x743b('0x2c')]?_0x53df8f['queryResult'][_0x743b('0x2b')]['fields'][_0x743b('0x2d')][_0x743b('0x2e')]:![];_0x15155b[_0x743b('0xa')][_0x743b('0x32')]=_0x53df8f[_0x743b('0x2a')][_0x743b('0x33')]['name'];_0x15155b[_0x743b('0xa')][_0x743b('0x34')]=_0x53df8f['queryResult']['intent'][_0x743b('0x35')];_0x15155b[_0x743b('0xa')][_0x743b('0x36')]=_0x53df8f[_0x743b('0x2a')]['intent']['isFallback'];_0x15155b[_0x743b('0xa')][_0x743b('0x37')]=_0x53df8f[_0x743b('0x2a')]['languageCode'];_0x15155b['body'][_0x743b('0x38')]=_0x53df8f['queryResult']['queryText'];_0x15155b[_0x743b('0xa')][_0x743b('0x39')]=_0x53df8f[_0x743b('0x2a')][_0x743b('0x3a')];_0x1ebd0c[_0x743b('0x3b')]=_0x743b('0x29');_0x1ebd0c[_0x743b('0x3c')]=JSON[_0x743b('0x10')](_0x1479bc);var _0xff7993=[];for(var _0x520cd6=0x0;_0x520cd6<_0x1479bc[_0x743b('0x28')];_0x520cd6++){var _0x2dfe73=_0x1479bc[_0x520cd6];if(_0x2dfe73&&_0x2dfe73[_0x743b('0x2a')]&&_0x2dfe73[_0x743b('0x2a')]['fulfillmentText']){_0xff7993[_0x743b('0x3d')](createMessage(_0x31e885,_0x652f30,_0x1ebd0c,_0x2dfe73[_0x743b('0x2a')][_0x743b('0x3e')]));}}return Promise[_0x743b('0x3f')](_0xff7993)[_0x743b('0x27')](function(){if(_0x4ce6da){_0x479b9b[_0x743b('0x15')]();}else{_0x479b9b['stop']();}})[_0x743b('0xe')](function(_0x3f1ae1){logger[_0x743b('0xf')](_0x743b('0xd'),_0x31e885,JSON[_0x743b('0x10')](_0x3f1ae1));_0x479b9b['next']();});}})['catch'](function(_0x16f1cc){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x31e885,_0x16f1cc[_0x743b('0x40')]);_0x479b9b[_0x743b('0x15')]();});}}catch(_0x2e48b9){logger[_0x743b('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x31e885,JSON[_0x743b('0x10')](_0x2e48b9));_0x479b9b[_0x743b('0x24')]();}};}; \ No newline at end of file +var _0xbae9=['DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','fulfillmentText','all','lodash','dialogflow','md5','bluebird','../../../../config/logger','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','body','then','[%s][DIALOGFLOWV2]\x20%s','catch','stringify','consequence','isNil','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','Message','error','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','detectIntent','length','dialogflowV2','diagnosticInfo','fields','queryResult','end_conversation','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xbae9,0x121));var _0x9bae=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xbae9[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0x9bae('0x0'));var dialogflow=require(_0x9bae('0x1'));var md5=require(_0x9bae('0x2'));var moment=require('moment');var Promise=require(_0x9bae('0x3'));var logger=require(_0x9bae('0x4'))(_0x9bae('0x5'));var utils=require(_0x9bae('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x9bae('0x7')),'mailMessage':require(_0x9bae('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x9bae('0x9'))};function createMessage(_0x46f071,_0x5d26d7,_0x36f0c2,_0x4b0a9b){return new Promise(function(_0x4d6a98,_0x4ed361){var _0xc344da=_['clone'](_0x36f0c2);_0xc344da[_0x9bae('0xa')]=_0x4b0a9b;return rpc[_0x5d26d7+'Message']['create'](_0xc344da)[_0x9bae('0xb')](function(){logger['info'](_0x9bae('0xc'),_0x46f071,_0xc344da[_0x9bae('0xa')]);_0x4d6a98();})[_0x9bae('0xd')](function(_0x1c6b48){logger['error'](_0x9bae('0xc'),_0x46f071,JSON[_0x9bae('0xe')](_0x1c6b48));_0x4ed361(_0x1c6b48);});});}exports[_0x9bae('0xf')]=function(_0x2afc2d,_0x404ae3){return function(_0x2aefec){try{if(!_[_0x9bae('0x10')](this['interaction'][_0x9bae('0x11')])){logger[_0x9bae('0x12')](_0x9bae('0xc'),_0x2afc2d,_0x9bae('0x13'));return _0x2aefec[_0x9bae('0x14')]();}var _0x399b8b={'ContactId':this['contact']['id'],'sentAt':moment()[_0x9bae('0x15')](_0x9bae('0x16')),'direction':_0x9bae('0x17')};if(this[_0x9bae('0x18')]===_0x9bae('0x19')||this['channel']===_0x9bae('0x1a')){_0x399b8b[_0x9bae('0x1b')]=this[_0x9bae('0x1c')][_0x9bae('0x1b')];}var _0xcd874e=this[_0x9bae('0x18')];if(_0xcd874e===_0x9bae('0x1d')){_0x399b8b[_0x9bae('0x1e')]=this[_0x9bae('0x1f')]['id'];}else{_0x399b8b[_[_0x9bae('0x20')](_0xcd874e)+_0x9bae('0x21')]=this[_0x9bae('0x1f')]['id'];}_0x399b8b[_[_0x9bae('0x20')](_0xcd874e)+_0x9bae('0x22')]=this[_0x9bae('0x1c')]['id'];if(this[_0x9bae('0x1c')][_0x9bae('0x23')]){var _0xd465a7=_0x404ae3[0x4];if(!_['isEmpty'](_0xd465a7)){_0x399b8b['body']=utils[_0x9bae('0x24')](_0xd465a7,this);return rpc[_0xcd874e+_0x9bae('0x25')]['create'](_0x399b8b)[_0x9bae('0xb')](function(_0x44a4e8){logger[_0x9bae('0x12')](_0x9bae('0xc'),_0x2afc2d,_0x399b8b[_0x9bae('0xa')]);})[_0x9bae('0xd')](function(_0x5d43a3){logger[_0x9bae('0x26')](_0x9bae('0xc'),_0x2afc2d,JSON[_0x9bae('0xe')](_0x5d43a3));})[_0x9bae('0x27')](function(){logger[_0x9bae('0x12')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2afc2d);_0x2aefec[_0x9bae('0x28')]();});}else{logger[_0x9bae('0x12')](_0x9bae('0x29'),_0x2afc2d);_0x2aefec[_0x9bae('0x28')]();}}else{var _0x5253ff=this;var _0x24d25c=_0x404ae3[0x2][_0x9bae('0x2a')](/\\n/g,'\x0a');var _0x222cf6={'credentials':{'private_key':_0x24d25c,'client_email':_0x404ae3[0x1]}};var _0x4502cf=new dialogflow[(_0x9bae('0x2b'))](_0x222cf6);var _0x4504c0=_0x4502cf['sessionPath'](_0x404ae3[0x0],md5(_0x5253ff[_0x9bae('0x1c')]['id']));var _0x32acd5={'session':_0x4504c0,'queryInput':{'text':{'text':_0x5253ff['message']['body'],'languageCode':_0x404ae3[0x3]||'en'}}};return _0x4502cf[_0x9bae('0x2c')](_0x32acd5)[_0x9bae('0xb')](function(_0x4ae4bc){if(_0x4ae4bc&&_0x4ae4bc[_0x9bae('0x2d')]){_0x5253ff[_0x9bae('0xa')][_0x9bae('0x2e')]=_0x4ae4bc;var _0x3efa6e=_0x4ae4bc[0x0];var _0x5a102c=_0x3efa6e['queryResult']['diagnosticInfo']&&_0x3efa6e['queryResult'][_0x9bae('0x2f')][_0x9bae('0x30')]?_0x3efa6e[_0x9bae('0x31')][_0x9bae('0x2f')][_0x9bae('0x30')][_0x9bae('0x32')]['boolValue']:![];_0x5253ff['body']['DIALOGFLOWV2_ACTION']=_0x3efa6e[_0x9bae('0x31')][_0x9bae('0x33')];_0x5253ff[_0x9bae('0xa')][_0x9bae('0x34')]=_0x3efa6e[_0x9bae('0x31')][_0x9bae('0x35')];_0x5253ff['body'][_0x9bae('0x36')]=_0x3efa6e[_0x9bae('0x31')][_0x9bae('0x2f')]&&_0x3efa6e[_0x9bae('0x31')][_0x9bae('0x2f')][_0x9bae('0x30')]?_0x3efa6e[_0x9bae('0x31')][_0x9bae('0x2f')][_0x9bae('0x30')]['end_conversation'][_0x9bae('0x37')]:![];_0x5253ff[_0x9bae('0xa')][_0x9bae('0x38')]=_0x3efa6e[_0x9bae('0x31')][_0x9bae('0x39')][_0x9bae('0x3a')];_0x5253ff[_0x9bae('0xa')][_0x9bae('0x3b')]=_0x3efa6e[_0x9bae('0x31')][_0x9bae('0x39')]['displayName'];_0x5253ff[_0x9bae('0xa')][_0x9bae('0x3c')]=_0x3efa6e[_0x9bae('0x31')][_0x9bae('0x39')][_0x9bae('0x3d')];_0x5253ff['body'][_0x9bae('0x3e')]=_0x3efa6e['queryResult'][_0x9bae('0x3f')];_0x5253ff['body'][_0x9bae('0x40')]=_0x3efa6e[_0x9bae('0x31')][_0x9bae('0x41')];_0x5253ff[_0x9bae('0xa')][_0x9bae('0x42')]=_0x3efa6e[_0x9bae('0x31')][_0x9bae('0x43')];_0x399b8b[_0x9bae('0x44')]=_0x9bae('0x2e');_0x399b8b['providerResponse']=JSON[_0x9bae('0xe')](_0x4ae4bc);var _0x59f3b7=[];for(var _0x150075=0x0;_0x150075<_0x4ae4bc[_0x9bae('0x2d')];_0x150075++){var _0x581e68=_0x4ae4bc[_0x150075];if(_0x581e68&&_0x581e68['queryResult']&&_0x581e68['queryResult'][_0x9bae('0x45')]){_0x59f3b7['push'](createMessage(_0x2afc2d,_0xcd874e,_0x399b8b,_0x581e68['queryResult'][_0x9bae('0x45')]));}}return Promise[_0x9bae('0x46')](_0x59f3b7)[_0x9bae('0xb')](function(){if(_0x5a102c){_0x2aefec[_0x9bae('0x14')]();}else{_0x2aefec[_0x9bae('0x28')]();}})[_0x9bae('0xd')](function(_0x553521){logger[_0x9bae('0x26')](_0x9bae('0xc'),_0x2afc2d,JSON[_0x9bae('0xe')](_0x553521));_0x2aefec[_0x9bae('0x14')]();});}})['catch'](function(_0xf5cfb5){logger[_0x9bae('0x26')](_0x9bae('0xc'),_0x2afc2d,_0xf5cfb5['message']);_0x2aefec['next']();});}}catch(_0x15c39f){logger[_0x9bae('0x26')](_0x9bae('0xc'),_0x2afc2d,JSON['stringify'](_0x15c39f));_0x2aefec[_0x9bae('0x28')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 3cf9116..a5bff49 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x516c=['string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','getMustacheRender','replace','length','error','message','stop','condition','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20%s','stringify','validate','./utils','../../../../config/logger','routing'];(function(_0x580aa4,_0x2d1c9d){var _0x6cceb1=function(_0x46e42e){while(--_0x46e42e){_0x580aa4['push'](_0x580aa4['shift']());}};_0x6cceb1(++_0x2d1c9d);}(_0x516c,0x10f));var _0xc516=function(_0x239a4f,_0x16427f){_0x239a4f=_0x239a4f-0x0;var _0x59f4f2=_0x516c[_0x239a4f];return _0x59f4f2;};'use strict';var schema=require(_0xc516('0x0'));var _=require('lodash');var htmlToText=require('html-to-text');var utils=require(_0xc516('0x1'));var logger=require(_0xc516('0x2'))(_0xc516('0x3'));var gotoif=schema({'condition':{'type':_0xc516('0x4'),'required':!![],'message':_0xc516('0x5')},'priorityTrue':{'type':_0xc516('0x6'),'message':_0xc516('0x7')},'priorityFalse':{'type':_0xc516('0x6'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0xc516('0x8')]=function(_0x4fcbf8,_0x2aa644){return function(_0x510203){try{var _0x298a95={'condition':htmlToText['fromString'](utils[_0xc516('0x9')](_0x2aa644[0x0],this),{'wordwrap':![]})[_0xc516('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2aa644[0x1],'priorityFalse':_0x2aa644[0x2]};var _0x44b47c=gotoif[_0xc516('0x0')](_0x298a95,{'typecast':!![]});if(_0x44b47c[_0xc516('0xb')]){logger[_0xc516('0xc')]('[%s][GOTOIF]\x20%s',_0x4fcbf8,_['map'](_0x44b47c,_0xc516('0xd'))['join'](',\x20'));_0x510203[_0xc516('0xe')]();}else{try{var _0x1a7084=eval('('+_0x298a95[_0xc516('0xf')]+')');var _0x5692ee=_0x1a7084?_0x298a95['priorityTrue']:_0x298a95[_0xc516('0x10')];logger[_0xc516('0x11')](_0xc516('0x12'),_0x4fcbf8,_0x298a95[_0xc516('0xf')],_0x1a7084,_0x5692ee||_0xc516('0x13'));if(_0x5692ee){var _0x13ae2d=_[_0xc516('0x14')](_0x510203['rules'](),{'p':_0x5692ee});if(_0x13ae2d>=0x0){logger[_0xc516('0x11')](_0xc516('0x15'),_0x4fcbf8,_0x5692ee||_0xc516('0x13'),_0x13ae2d);_0x510203[_0xc516('0x13')](_0x13ae2d);}else{logger[_0xc516('0x11')](_0xc516('0x16'),_0x4fcbf8,_0x5692ee||_0xc516('0x13'));_0x510203[_0xc516('0xe')]();}}else{_0x510203[_0xc516('0x13')]();}}catch(_0x6f8a88){logger[_0xc516('0xc')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x4fcbf8,_0x6f8a88[_0xc516('0xd')]);_0x510203[_0xc516('0xe')]();}}}catch(_0x29d273){logger[_0xc516('0xc')](_0xc516('0x17'),_0x4fcbf8,JSON[_0xc516('0x18')](_0x29d273));_0x510203[_0xc516('0xe')]();}};}; \ No newline at end of file +var _0x4bbd=['info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','validate','length','[%s][GOTOIF]\x20%s','map','join','condition','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules'];(function(_0x381526,_0x358cac){var _0x14c940=function(_0xa7606c){while(--_0xa7606c){_0x381526['push'](_0x381526['shift']());}};_0x14c940(++_0x358cac);}(_0x4bbd,0x18f));var _0xd4bb=function(_0x29ca22,_0x2fea42){_0x29ca22=_0x29ca22-0x0;var _0x1ed45f=_0x4bbd[_0x29ca22];return _0x1ed45f;};'use strict';var schema=require('validate');var _=require(_0xd4bb('0x0'));var htmlToText=require(_0xd4bb('0x1'));var utils=require(_0xd4bb('0x2'));var logger=require(_0xd4bb('0x3'))(_0xd4bb('0x4'));var gotoif=schema({'condition':{'type':_0xd4bb('0x5'),'required':!![],'message':_0xd4bb('0x6')},'priorityTrue':{'type':'number','message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':'number','message':_0xd4bb('0x7')}});exports[_0xd4bb('0x8')]=function(_0x49218d,_0x30a24e){return function(_0xf53093){try{var _0x4d860a={'condition':htmlToText['fromString'](utils[_0xd4bb('0x9')](_0x30a24e[0x0],this),{'wordwrap':![]})[_0xd4bb('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x30a24e[0x1],'priorityFalse':_0x30a24e[0x2]};var _0x497efe=gotoif[_0xd4bb('0xb')](_0x4d860a,{'typecast':!![]});if(_0x497efe[_0xd4bb('0xc')]){logger['error'](_0xd4bb('0xd'),_0x49218d,_[_0xd4bb('0xe')](_0x497efe,'message')[_0xd4bb('0xf')](',\x20'));_0xf53093['stop']();}else{try{var _0x110c6d=eval('('+_0x4d860a[_0xd4bb('0x10')]+')');var _0x54f966=_0x110c6d?_0x4d860a['priorityTrue']:_0x4d860a[_0xd4bb('0x11')];logger['info'](_0xd4bb('0x12'),_0x49218d,_0x4d860a['condition'],_0x110c6d,_0x54f966||_0xd4bb('0x13'));if(_0x54f966){var _0x64156f=_['findIndex'](_0xf53093[_0xd4bb('0x14')](),{'p':_0x54f966});if(_0x64156f>=0x0){logger[_0xd4bb('0x15')](_0xd4bb('0x16'),_0x49218d,_0x54f966||_0xd4bb('0x13'),_0x64156f);_0xf53093['next'](_0x64156f);}else{logger[_0xd4bb('0x15')](_0xd4bb('0x17'),_0x49218d,_0x54f966||'next');_0xf53093[_0xd4bb('0x18')]();}}else{_0xf53093[_0xd4bb('0x13')]();}}catch(_0x481155){logger['error'](_0xd4bb('0x19'),_0x49218d,_0x481155[_0xd4bb('0x1a')]);_0xf53093[_0xd4bb('0x18')]();}}}catch(_0xdaa1d3){logger['error']('[%s][GOTOIF]\x20%s',_0x49218d,JSON[_0xd4bb('0x1b')](_0xdaa1d3));_0xf53093['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 b946642..61bf1fc 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 _0x5908=['[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','stringify','lodash','../../../../config/logger','routing','validate','length','error','[%s][GOTOP]\x20%s','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules'];(function(_0x46fc6c,_0x297637){var _0x18694f=function(_0x34e1e0){while(--_0x34e1e0){_0x46fc6c['push'](_0x46fc6c['shift']());}};_0x18694f(++_0x297637);}(_0x5908,0x16c));var _0x8590=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x5908[_0x6cf19c];return _0xce14f3;};'use strict';var schema=require('validate');var _=require(_0x8590('0x0'));var logger=require(_0x8590('0x1'))(_0x8590('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x3518b9,_0x52a2ec){return function(_0x3c67e2){try{var _0x2f889b={'priority':_0x52a2ec[0x0]};var _0x5d1716=gotop[_0x8590('0x3')](_0x2f889b,{'typecast':!![]});if(_0x5d1716[_0x8590('0x4')]){logger[_0x8590('0x5')](_0x8590('0x6'),_0x3518b9,_['map'](_0x5d1716,_0x8590('0x7'))[_0x8590('0x8')](',\x20'));_0x3c67e2[_0x8590('0x9')]();}else{logger['info'](_0x8590('0xa'),_0x3518b9,_0x2f889b[_0x8590('0xb')]);if(_0x2f889b[_0x8590('0xb')]){var _0xa6b0b2=_[_0x8590('0xc')](_0x3c67e2[_0x8590('0xd')](),{'p':_0x2f889b[_0x8590('0xb')]});if(_0xa6b0b2>=0x0){logger['info'](_0x8590('0xe'),_0x3518b9,_0x2f889b[_0x8590('0xb')]||'next',_0xa6b0b2);_0x3c67e2['next'](_0xa6b0b2);}else{logger['info'](_0x8590('0xf'),_0x3518b9,_0x2f889b[_0x8590('0xb')]||'next');_0x3c67e2[_0x8590('0x9')]();}}else{_0x3c67e2[_0x8590('0x10')]();}}}catch(_0x160f3f){logger[_0x8590('0x5')](_0x8590('0x6'),_0x3518b9,JSON[_0x8590('0x11')](_0x160f3f));_0x3c67e2[_0x8590('0x9')]();}};}; \ No newline at end of file +var _0xf801=['consequence','length','[%s][GOTOP]\x20%s','map','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','stringify','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'];(function(_0x1796bc,_0x1d8a78){var _0x3a381f=function(_0x3a8e5d){while(--_0x3a8e5d){_0x1796bc['push'](_0x1796bc['shift']());}};_0x3a381f(++_0x1d8a78);}(_0xf801,0x13b));var _0x1f80=function(_0xc376e1,_0x1a2b83){_0xc376e1=_0xc376e1-0x0;var _0x63e01c=_0xf801[_0xc376e1];return _0x63e01c;};'use strict';var schema=require(_0x1f80('0x0'));var _=require('lodash');var logger=require(_0x1f80('0x1'))(_0x1f80('0x2'));var gotop=schema({'priority':{'type':_0x1f80('0x3'),'required':!![],'message':_0x1f80('0x4')}});exports[_0x1f80('0x5')]=function(_0x5b31f0,_0x319c06){return function(_0x3adcc7){try{var _0x2ba01a={'priority':_0x319c06[0x0]};var _0x80e669=gotop[_0x1f80('0x0')](_0x2ba01a,{'typecast':!![]});if(_0x80e669[_0x1f80('0x6')]){logger['error'](_0x1f80('0x7'),_0x5b31f0,_[_0x1f80('0x8')](_0x80e669,'message')[_0x1f80('0x9')](',\x20'));_0x3adcc7[_0x1f80('0xa')]();}else{logger[_0x1f80('0xb')](_0x1f80('0xc'),_0x5b31f0,_0x2ba01a[_0x1f80('0xd')]);if(_0x2ba01a[_0x1f80('0xd')]){var _0x5b9c98=_[_0x1f80('0xe')](_0x3adcc7[_0x1f80('0xf')](),{'p':_0x2ba01a['priority']});if(_0x5b9c98>=0x0){logger[_0x1f80('0xb')](_0x1f80('0x10'),_0x5b31f0,_0x2ba01a[_0x1f80('0xd')]||'next',_0x5b9c98);_0x3adcc7['next'](_0x5b9c98);}else{logger['info'](_0x1f80('0x11'),_0x5b31f0,_0x2ba01a[_0x1f80('0xd')]||_0x1f80('0x12'));_0x3adcc7[_0x1f80('0xa')]();}}else{_0x3adcc7[_0x1f80('0x12')]();}}}catch(_0xe9f89b){logger['error'](_0x1f80('0x7'),_0x5b31f0,JSON[_0x1f80('0x13')](_0xe9f89b));_0x3adcc7['stop']();}};}; \ 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 1ef1281..10bfa1e 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 _0x441a=['Message','create','then','[%s][MESSAGE]\x20%s','body','next','catch','stop','error','stringify','lodash','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','getMustacheRender','contact','channel','ChatWebsiteId','upperFirst','AccountId','account'];(function(_0x88faed,_0x5b4a9f){var _0x242df2=function(_0x19e40c){while(--_0x19e40c){_0x88faed['push'](_0x88faed['shift']());}};_0x242df2(++_0x5b4a9f);}(_0x441a,0x191));var _0xa441=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x441a[_0x2555d0];return _0x3bb486;};'use strict';var _=require(_0xa441('0x0'));var utils=require(_0xa441('0x1'));var logger=require(_0xa441('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xa441('0x3')),'mailMessage':require(_0xa441('0x4')),'smsMessage':require(_0xa441('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x814359,_0x19b7dc){return function(_0x1b6b64){try{var _0x1a39e3={'body':utils[_0xa441('0x6')](_0x19b7dc[0x0],this),'ContactId':this[_0xa441('0x7')]['id']};if(this[_0xa441('0x8')]==='chat'){_0x1a39e3[_0xa441('0x9')]=this['account']['id'];}else{_0x1a39e3[_[_0xa441('0xa')](this[_0xa441('0x8')])+_0xa441('0xb')]=this[_0xa441('0xc')]['id'];}_0x1a39e3[_[_0xa441('0xa')](this[_0xa441('0x8')])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0xa441('0x8')]+_0xa441('0xd')]){return rpc[this[_0xa441('0x8')]+_0xa441('0xd')][_0xa441('0xe')](_0x1a39e3)[_0xa441('0xf')](function(_0x3aaa34){logger['info'](_0xa441('0x10'),_0x814359,_0x1a39e3[_0xa441('0x11')]);_0x1b6b64[_0xa441('0x12')]();})[_0xa441('0x13')](function(_0x3fdfc9){logger['error']('[%s][MESSAGE]\x20%s',_0x814359,JSON['stringify'](_0x3fdfc9));_0x1b6b64[_0xa441('0x14')]();});}}catch(_0xeb428a){logger[_0xa441('0x15')](_0xa441('0x10'),_0x814359,JSON[_0xa441('0x16')](_0xeb428a));_0x1b6b64['stop']();}};}; \ No newline at end of file +var _0xf6c4=['routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','upperFirst','AccountId','interaction','Message','then','info','next','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','./utils','../../../../config/logger'];(function(_0x30e57b,_0x3f24fe){var _0x4a2cc7=function(_0x54ceba){while(--_0x54ceba){_0x30e57b['push'](_0x30e57b['shift']());}};_0x4a2cc7(++_0x3f24fe);}(_0xf6c4,0xad));var _0x4f6c=function(_0x412ddf,_0x40a0bf){_0x412ddf=_0x412ddf-0x0;var _0x4aad28=_0xf6c4[_0x412ddf];return _0x4aad28;};'use strict';var _=require('lodash');var utils=require(_0x4f6c('0x0'));var logger=require(_0x4f6c('0x1'))(_0x4f6c('0x2'));var rpc={'chatMessage':require(_0x4f6c('0x3')),'openchannelMessage':require(_0x4f6c('0x4')),'mailMessage':require(_0x4f6c('0x5')),'smsMessage':require(_0x4f6c('0x6')),'faxMessage':require(_0x4f6c('0x7')),'whatsappMessage':require(_0x4f6c('0x8'))};exports[_0x4f6c('0x9')]=function(_0x591b3c,_0x376ef9){return function(_0x54c720){try{var _0x107363={'body':utils[_0x4f6c('0xa')](_0x376ef9[0x0],this),'ContactId':this[_0x4f6c('0xb')]['id']};if(this[_0x4f6c('0xc')]==='chat'){_0x107363['ChatWebsiteId']=this['account']['id'];}else{_0x107363[_[_0x4f6c('0xd')](this[_0x4f6c('0xc')])+_0x4f6c('0xe')]=this['account']['id'];}_0x107363[_[_0x4f6c('0xd')](this[_0x4f6c('0xc')])+'InteractionId']=this[_0x4f6c('0xf')]['id'];if(rpc[this[_0x4f6c('0xc')]+_0x4f6c('0x10')]){return rpc[this['channel']+_0x4f6c('0x10')]['create'](_0x107363)[_0x4f6c('0x11')](function(_0x234423){logger[_0x4f6c('0x12')]('[%s][MESSAGE]\x20%s',_0x591b3c,_0x107363['body']);_0x54c720[_0x4f6c('0x13')]();})[_0x4f6c('0x14')](function(_0x2ca530){logger[_0x4f6c('0x15')](_0x4f6c('0x16'),_0x591b3c,JSON['stringify'](_0x2ca530));_0x54c720['stop']();});}}catch(_0x272d51){logger[_0x4f6c('0x15')](_0x4f6c('0x16'),_0x591b3c,JSON[_0x4f6c('0x17')](_0x272d51));_0x54c720[_0x4f6c('0x18')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 90880c1..cfcbf65 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 _0x0b00=['routing','consequence','[%s][NOOP]\x20%s','error','stop','./utils'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0x0b00,0x18b));var _0x00b0=function(_0x53c6e7,_0x505625){_0x53c6e7=_0x53c6e7-0x0;var _0x202c6b=_0x0b00[_0x53c6e7];return _0x202c6b;};'use strict';var utils=require(_0x00b0('0x0'));var logger=require('../../../../config/logger')(_0x00b0('0x1'));exports[_0x00b0('0x2')]=function(_0x555be7,_0x329f34){return function(_0x49f162){try{logger['info'](_0x00b0('0x3'),_0x555be7,utils['getMustacheRender'](_0x329f34[0x0],this));_0x49f162['next']();}catch(_0x3e3aae){logger[_0x00b0('0x4')]('[%s][NOOP]\x20%s',_0x555be7,JSON['stringify'](_0x3e3aae));_0x49f162[_0x00b0('0x5')]();}};}; \ No newline at end of file +var _0xd98a=['./utils','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop'];(function(_0x43c254,_0x3f7c8d){var _0x454952=function(_0x396dd4){while(--_0x396dd4){_0x43c254['push'](_0x43c254['shift']());}};_0x454952(++_0x3f7c8d);}(_0xd98a,0x1b9));var _0xad98=function(_0x35515f,_0x9f5a2c){_0x35515f=_0x35515f-0x0;var _0x2f9807=_0xd98a[_0x35515f];return _0x2f9807;};'use strict';var utils=require(_0xad98('0x0'));var logger=require('../../../../config/logger')('routing');exports[_0xad98('0x1')]=function(_0x56e2c8,_0x1d15a8){return function(_0x1d935d){try{logger[_0xad98('0x2')](_0xad98('0x3'),_0x56e2c8,utils[_0xad98('0x4')](_0x1d15a8[0x0],this));_0x1d935d[_0xad98('0x5')]();}catch(_0xd4d3a2){logger[_0xad98('0x6')](_0xad98('0x3'),_0x56e2c8,JSON[_0xad98('0x7')](_0xd4d3a2));_0x1d935d[_0xad98('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 136ee21..4703525 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 _0x34e8=['../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','channel','MessageId','chat','AccountId','WebsiteId','name','message','QueueReport','create','catch','error','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','map','join','Queues','createQueue','atimeout','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','stop','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account','queue','from','joinAt','emit','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport'];(function(_0x53bc10,_0x55f2c5){var _0x5666dc=function(_0x2b07cb){while(--_0x2b07cb){_0x53bc10['push'](_0x53bc10['shift']());}};_0x5666dc(++_0x55f2c5);}(_0x34e8,0x12c));var _0x834e=function(_0x1c7f7e,_0x31200e){_0x1c7f7e=_0x1c7f7e-0x0;var _0x3ea29b=_0x34e8[_0x1c7f7e];return _0x3ea29b;};'use strict';var schema=require(_0x834e('0x0'));var _=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var seqqueue=require(_0x834e('0x3'));var moment=require('moment');var Redis=require(_0x834e('0x4'));var config=require(_0x834e('0x5'));var logger=require(_0x834e('0x6'))(_0x834e('0x7'));var strategy=require(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));var attributes=['id',_0x834e('0xc'),_0x834e('0xd'),_0x834e('0xe'),_0x834e('0xf'),_0x834e('0x10')];function emit(_0x363786,_0x1af45a,_0x3bdda9){io['to'](_0x363786)[_0x834e('0x11')](_0x1af45a,_0x3bdda9);}function emitChannelQueueInteraction(_0x1e41fe,_0x36e124,_0x14038b,_0x2e1a37,_0x293514,_0x1e00de,_0x2fd95c,_0x538bb3){var _0x5e5b6d=_[_0x834e('0x12')](_0x14038b);_0x5e5b6d['queue_id']=_0x538bb3;_0x5e5b6d[_0x834e('0xe')]=_0x36e124;_0x5e5b6d[_0x834e('0xd')]=_0x2e1a37;_0x5e5b6d['id']=_0x293514;if(_0x1e00de){_0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514]=_['pick'](_0x5e5b6d,attributes);}else{delete _0x2fd95c[util[_0x834e('0x13')](_0x834e('0x14'),_0x1e41fe)][_0x293514];}emit(util['format'](_0x834e('0x15'),_0x1e41fe,_0x36e124),util['format'](_0x834e('0x16'),_0x1e41fe,_0x1e00de?_0x834e('0x17'):'remove'),_[_0x834e('0x18')](_0x5e5b6d,attributes));}var rpc={'openchannelQueueReport':require(_0x834e('0x19')),'mailQueueReport':require(_0x834e('0x1a')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x834e('0x1b')),'faxQueueReport':require(_0x834e('0x1c')),'whatsappQueueReport':require(_0x834e('0x1d'))};var queue=schema({'name':{'type':_0x834e('0x1e'),'required':!![],'message':_0x834e('0x1f')},'timeout':{'type':_0x834e('0x20'),'message':_0x834e('0x21')}});function startRouting(_0x595515,_0x2545b4,_0x1fd2c6,_0x113ff4){if(_0x595515&&_0x2545b4&&_0x1fd2c6){_0x2545b4[_0x834e('0x22')]+=0x1;var _0x4ab05d={'uniqueid':_0x595515,'from':_0x1fd2c6[_0x834e('0x23')]?_0x1fd2c6[_0x834e('0x23')]['from']:'','joinAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'ContactId':_0x1fd2c6[_0x834e('0x25')]?_0x1fd2c6['contact']['id']:null,'ListId':_0x1fd2c6['list']?_0x1fd2c6[_0x834e('0x26')]['id']:null};_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x28')]=_0x2545b4['id']||null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+_0x834e('0x29')]=_0x1fd2c6[_0x834e('0x2a')]?_0x1fd2c6[_0x834e('0x2a')]['id']:null;_0x4ab05d[_['upperFirst'](_0x1fd2c6[_0x834e('0x2b')])+_0x834e('0x2c')]=_0x1fd2c6['message']?_0x1fd2c6['message']['id']:null;_0x4ab05d[_[_0x834e('0x27')](_0x1fd2c6['channel'])+(_0x1fd2c6[_0x834e('0x2b')]!==_0x834e('0x2d')?_0x834e('0x2e'):_0x834e('0x2f'))]=_0x1fd2c6[_0x834e('0xd')]?_0x1fd2c6[_0x834e('0xd')]['id']:null;logger['info'](util['format']('[%s][START:QUEUE][NAME:%s]',_0x595515,_0x2545b4['name']));emitChannelQueueInteraction(_0x1fd2c6[_0x834e('0x2b')],_0x2545b4[_0x834e('0x30')],_0x4ab05d,_0x1fd2c6[_0x834e('0xd')]['name'],_0x1fd2c6[_0x834e('0x31')]['id'],!![],_0x113ff4,_0x2545b4['id']);if(rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0x1fd2c6[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x33')](_0x4ab05d)[_0x834e('0x34')](function(_0xfaf716){logger[_0x834e('0x35')]('create\x20queue\x20report');});}}}function stopRouting(_0xef9ec2,_0x5cad11,_0x2c75c2,_0x3787b0){if(_0xef9ec2&&_0x5cad11){_0x5cad11[_0x834e('0x22')]-=0x1;var _0x2b3418={'leaveAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'acceptAt':moment()[_0x834e('0x13')](_0x834e('0x24')),'reason':_0x834e('0x36')};logger[_0x834e('0x37')](util['format'](_0x834e('0x38'),_0xef9ec2,_0x5cad11[_0x834e('0x30')]));emitChannelQueueInteraction(_0x2c75c2[_0x834e('0x2b')],_0x5cad11[_0x834e('0x30')],_0x2c75c2['body'],_0x2c75c2[_0x834e('0xd')][_0x834e('0x30')],_0x2c75c2['message']['id'],![],_0x3787b0,_0x5cad11['id']);if(rpc[_0x2c75c2['channel']+'QueueReport']){return rpc[_0x2c75c2[_0x834e('0x2b')]+_0x834e('0x32')][_0x834e('0x39')](_0xef9ec2,_0x2b3418)[_0x834e('0x34')](function(_0x339e28){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function endRouting(_0x2c2d94,_0x513f36,_0xe103fe,_0x6a3ac){if(_0x2c2d94&&_0x513f36){_0x513f36['waiting']-=0x1;var _0x18ac3b={'leaveAt':moment()[_0x834e('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x834e('0x24')),'reason':_0x834e('0x3a')};logger[_0x834e('0x37')](util[_0x834e('0x13')](_0x834e('0x3b'),_0x2c2d94,_0x513f36['name']));emitChannelQueueInteraction(_0xe103fe[_0x834e('0x2b')],_0x513f36['name'],_0xe103fe['body'],_0xe103fe[_0x834e('0xd')]['name'],_0xe103fe[_0x834e('0x31')]['id'],![],_0x6a3ac);if(rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]){return rpc[_0xe103fe[_0x834e('0x2b')]+_0x834e('0x32')]['update'](_0x2c2d94,_0x18ac3b)[_0x834e('0x34')](function(_0x26b847){logger[_0x834e('0x35')]('update\x20queue\x20report');});}}}function handleFindQueue(_0x35380e){return function(_0x16ac45){return _0x16ac45['name'][_0x834e('0x3c')]()===_0x35380e['toLowerCase']();};}exports[_0x834e('0x3d')]=function(_0x585335,_0x4a18bb,_0x4a6942,_0x22ea21){return function(_0x16969b){try{var _0x3bcbf4={'name':_0x4a18bb[0x0],'timeout':_0x4a18bb[0x1]};var _0xbc1571=queue[_0x834e('0x0')](_0x3bcbf4,{'typecast':!![]});if(_0xbc1571[_0x834e('0x3e')]){logger[_0x834e('0x35')]('[%s][QUEUE]\x20%s',_0x585335,_[_0x834e('0x3f')](_0xbc1571,'message')[_0x834e('0x40')](',\x20'));_0x16969b['stop']();}else{var _0x1df5b0=_['find'](_0x4a6942[_0x22ea21[_0x834e('0x2b')]+_0x834e('0x41')],handleFindQueue(_0x3bcbf4['name']));if(_0x1df5b0){startRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);var _0x39e7b9=(_0x1df5b0[_0x834e('0x3a')]||0xa)*0x3e8;var _0xa880cb=(_0x3bcbf4[_0x834e('0x3a')]||0x14)*0x3e8;var _0x252ea0,_0x1a7149;if(_0x39e7b9>_0xa880cb){_0xa880cb=_0x39e7b9;}var _0xfa28da=seqqueue[_0x834e('0x42')](_0x39e7b9);_0xfa28da['id']=_0x585335;_0xfa28da[_0x834e('0x43')]=_0x39e7b9;_0xfa28da[_0x834e('0x44')]=_0xa880cb;_0xfa28da['channel']=_0x22ea21[_0x834e('0x2b')];_0x4a6942[_0x834e('0x45')][_0x585335]['on']('end',function(){logger[_0x834e('0x37')](_0x834e('0x46'),_0x585335);stopRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0x252ea0=undefined;_0xfa28da[_0x834e('0x47')](!![]);if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}_0x16969b[_0x834e('0x48')]();});_0x4a6942['rules'][_0x585335]['on']('complete',function(){if(_0x4a6942[_0x834e('0x45')][_0x585335]){delete _0x4a6942[_0x834e('0x45')][_0x585335];}});_0x252ea0=setTimeout(function(){logger[_0x834e('0x37')](_0x834e('0x49'),_0x585335);endRouting(_0x585335,_0x1df5b0,_0x22ea21,_0x4a6942);clearTimeout(_0x252ea0);_0xfa28da[_0x834e('0x47')](!![]);_0x16969b[_0x834e('0x4a')]();},_0xa880cb);switch(_0x1df5b0[_0x834e('0x4b')]){case _0x834e('0x4c'):strategy[_0x834e('0x4c')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);break;default:strategy[_0x834e('0x4d')](_0xfa28da,_0x1df5b0,_0x4a6942,_0x22ea21);}}else{logger[_0x834e('0x35')](_0x834e('0x4e'),_0x585335,_0x3bcbf4[_0x834e('0x30')]);_0x16969b[_0x834e('0x48')]();}}}catch(_0x2aa072){console[_0x834e('0x4f')](_0x2aa072);logger[_0x834e('0x35')](_0x834e('0x50'),_0x585335,_0x2aa072[_0x834e('0x51')]);_0x16969b[_0x834e('0x48')]();}};}; \ No newline at end of file +var _0x008c=['contact','list','upperFirst','QueueId','InteractionId','interaction','message','channel','info','[%s][START:QUEUE][NAME:%s]','name','account','QueueReport','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','body','update','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','timeout','createQueue','atimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','rrmemory','beepall','log','stack','validate','lodash','util','seq-queue','moment','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','queue','clone','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3aed02,_0x472a80){var _0x17881a=function(_0x197db6){while(--_0x197db6){_0x3aed02['push'](_0x3aed02['shift']());}};_0x17881a(++_0x472a80);}(_0x008c,0x188));var _0xc008=function(_0x43b1fb,_0x22e01e){_0x43b1fb=_0x43b1fb-0x0;var _0x2eb5bc=_0x008c[_0x43b1fb];return _0x2eb5bc;};'use strict';var schema=require(_0xc008('0x0'));var _=require(_0xc008('0x1'));var util=require(_0xc008('0x2'));var seqqueue=require(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var Redis=require('ioredis');var config=require(_0xc008('0x5'));var logger=require(_0xc008('0x6'))(_0xc008('0x7'));var strategy=require(_0xc008('0x8'));config[_0xc008('0x9')]=_[_0xc008('0xa')](config[_0xc008('0x9')],{'host':_0xc008('0xb'),'port':0x18eb});var io=require(_0xc008('0xc'))(new Redis(config['redis']));var attributes=['id',_0xc008('0xd'),'account',_0xc008('0xe'),'from','joinAt'];function emit(_0x27830d,_0x7231b4,_0x57c46d){io['to'](_0x27830d)['emit'](_0x7231b4,_0x57c46d);}function emitChannelQueueInteraction(_0x543eb8,_0x1eacfa,_0xc881aa,_0x5b2004,_0xae2dab,_0x332fd4,_0x2ea200,_0x2a5b4e){var _0x9ffa93=_[_0xc008('0xf')](_0xc881aa);_0x9ffa93[_0xc008('0xd')]=_0x2a5b4e;_0x9ffa93['queue']=_0x1eacfa;_0x9ffa93['account']=_0x5b2004;_0x9ffa93['id']=_0xae2dab;if(_0x332fd4){_0x2ea200[util[_0xc008('0x10')]('%sQueuesWaitingInteractions',_0x543eb8)][_0xae2dab]=_[_0xc008('0x11')](_0x9ffa93,attributes);}else{delete _0x2ea200[util[_0xc008('0x10')](_0xc008('0x12'),_0x543eb8)][_0xae2dab];}emit(util[_0xc008('0x10')](_0xc008('0x13'),_0x543eb8,_0x1eacfa),util['format']('%s_queue_waiting_interaction:%s',_0x543eb8,_0x332fd4?'save':_0xc008('0x14')),_[_0xc008('0x11')](_0x9ffa93,attributes));}var rpc={'openchannelQueueReport':require(_0xc008('0x15')),'mailQueueReport':require(_0xc008('0x16')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xc008('0x17'),'required':!![],'message':_0xc008('0x18')},'timeout':{'type':'number','message':_0xc008('0x19')}});function startRouting(_0x5906e6,_0x4bd611,_0x543e5d,_0x50261c){if(_0x5906e6&&_0x4bd611&&_0x543e5d){_0x4bd611[_0xc008('0x1a')]+=0x1;var _0x4b9726={'uniqueid':_0x5906e6,'from':_0x543e5d['body']?_0x543e5d['body']['from']:'','joinAt':moment()['format'](_0xc008('0x1b')),'ContactId':_0x543e5d[_0xc008('0x1c')]?_0x543e5d[_0xc008('0x1c')]['id']:null,'ListId':_0x543e5d[_0xc008('0x1d')]?_0x543e5d[_0xc008('0x1d')]['id']:null};_0x4b9726[_[_0xc008('0x1e')](_0x543e5d['channel'])+_0xc008('0x1f')]=_0x4bd611['id']||null;_0x4b9726[_['upperFirst'](_0x543e5d['channel'])+_0xc008('0x20')]=_0x543e5d[_0xc008('0x21')]?_0x543e5d[_0xc008('0x21')]['id']:null;_0x4b9726[_[_0xc008('0x1e')](_0x543e5d['channel'])+'MessageId']=_0x543e5d['message']?_0x543e5d[_0xc008('0x22')]['id']:null;_0x4b9726[_[_0xc008('0x1e')](_0x543e5d[_0xc008('0x23')])+(_0x543e5d[_0xc008('0x23')]!=='chat'?'AccountId':'WebsiteId')]=_0x543e5d['account']?_0x543e5d['account']['id']:null;logger[_0xc008('0x24')](util[_0xc008('0x10')](_0xc008('0x25'),_0x5906e6,_0x4bd611['name']));emitChannelQueueInteraction(_0x543e5d[_0xc008('0x23')],_0x4bd611[_0xc008('0x26')],_0x4b9726,_0x543e5d[_0xc008('0x27')][_0xc008('0x26')],_0x543e5d['message']['id'],!![],_0x50261c,_0x4bd611['id']);if(rpc[_0x543e5d[_0xc008('0x23')]+_0xc008('0x28')]){return rpc[_0x543e5d['channel']+'QueueReport']['create'](_0x4b9726)[_0xc008('0x29')](function(_0x267abd){logger[_0xc008('0x2a')](_0xc008('0x2b'));});}}}function stopRouting(_0x1de04b,_0xceebc3,_0x294f97,_0x22d8e8){if(_0x1de04b&&_0xceebc3){_0xceebc3[_0xc008('0x1a')]-=0x1;var _0x2b862d={'leaveAt':moment()[_0xc008('0x10')](_0xc008('0x1b')),'acceptAt':moment()['format'](_0xc008('0x1b')),'reason':_0xc008('0x2c')};logger['info'](util[_0xc008('0x10')](_0xc008('0x2d'),_0x1de04b,_0xceebc3[_0xc008('0x26')]));emitChannelQueueInteraction(_0x294f97[_0xc008('0x23')],_0xceebc3[_0xc008('0x26')],_0x294f97[_0xc008('0x2e')],_0x294f97[_0xc008('0x27')][_0xc008('0x26')],_0x294f97[_0xc008('0x22')]['id'],![],_0x22d8e8,_0xceebc3['id']);if(rpc[_0x294f97['channel']+_0xc008('0x28')]){return rpc[_0x294f97[_0xc008('0x23')]+_0xc008('0x28')][_0xc008('0x2f')](_0x1de04b,_0x2b862d)[_0xc008('0x29')](function(_0x315562){logger[_0xc008('0x2a')]('update\x20queue\x20report');});}}}function endRouting(_0x35f360,_0x21763f,_0x50e1d4,_0x399b64){if(_0x35f360&&_0x21763f){_0x21763f[_0xc008('0x1a')]-=0x1;var _0x5e38d5={'leaveAt':moment()[_0xc008('0x10')](_0xc008('0x1b')),'exitAt':moment()[_0xc008('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger['info'](util[_0xc008('0x10')]('[%s][END:QUEUE][NAME:%s]',_0x35f360,_0x21763f[_0xc008('0x26')]));emitChannelQueueInteraction(_0x50e1d4[_0xc008('0x23')],_0x21763f[_0xc008('0x26')],_0x50e1d4[_0xc008('0x2e')],_0x50e1d4[_0xc008('0x27')][_0xc008('0x26')],_0x50e1d4[_0xc008('0x22')]['id'],![],_0x399b64);if(rpc[_0x50e1d4[_0xc008('0x23')]+_0xc008('0x28')]){return rpc[_0x50e1d4[_0xc008('0x23')]+_0xc008('0x28')][_0xc008('0x2f')](_0x35f360,_0x5e38d5)[_0xc008('0x29')](function(_0x2bf3fd){logger['error'](_0xc008('0x30'));});}}}function handleFindQueue(_0x23c4db){return function(_0x30b7df){return _0x30b7df[_0xc008('0x26')]['toLowerCase']()===_0x23c4db[_0xc008('0x31')]();};}exports[_0xc008('0x32')]=function(_0xc8cb91,_0x36e7ae,_0x2d142d,_0x5706bb){return function(_0x398cdd){try{var _0x3323f4={'name':_0x36e7ae[0x0],'timeout':_0x36e7ae[0x1]};var _0x3794b0=queue[_0xc008('0x0')](_0x3323f4,{'typecast':!![]});if(_0x3794b0[_0xc008('0x33')]){logger['error'](_0xc008('0x34'),_0xc8cb91,_[_0xc008('0x35')](_0x3794b0,_0xc008('0x22'))[_0xc008('0x36')](',\x20'));_0x398cdd['stop']();}else{var _0x26cd05=_[_0xc008('0x37')](_0x2d142d[_0x5706bb[_0xc008('0x23')]+'Queues'],handleFindQueue(_0x3323f4[_0xc008('0x26')]));if(_0x26cd05){startRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);var _0x49a176=(_0x26cd05[_0xc008('0x38')]||0xa)*0x3e8;var _0x5d3a72=(_0x3323f4[_0xc008('0x38')]||0x14)*0x3e8;var _0x213014,_0x5a5d85;if(_0x49a176>_0x5d3a72){_0x5d3a72=_0x49a176;}var _0x31007c=seqqueue[_0xc008('0x39')](_0x49a176);_0x31007c['id']=_0xc8cb91;_0x31007c[_0xc008('0x3a')]=_0x49a176;_0x31007c['qtimeout']=_0x5d3a72;_0x31007c[_0xc008('0x23')]=_0x5706bb[_0xc008('0x23')];_0x2d142d[_0xc008('0x3b')][_0xc8cb91]['on'](_0xc008('0x3c'),function(){logger[_0xc008('0x24')](_0xc008('0x3d'),_0xc8cb91);stopRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);clearTimeout(_0x213014);_0x213014=undefined;_0x31007c['close'](!![]);if(_0x2d142d['rules'][_0xc8cb91]){delete _0x2d142d['rules'][_0xc8cb91];}_0x398cdd[_0xc008('0x3e')]();});_0x2d142d[_0xc008('0x3b')][_0xc8cb91]['on'](_0xc008('0x3f'),function(){if(_0x2d142d[_0xc008('0x3b')][_0xc8cb91]){delete _0x2d142d[_0xc008('0x3b')][_0xc8cb91];}});_0x213014=setTimeout(function(){logger[_0xc008('0x24')](_0xc008('0x40'),_0xc8cb91);endRouting(_0xc8cb91,_0x26cd05,_0x5706bb,_0x2d142d);clearTimeout(_0x213014);_0x31007c[_0xc008('0x41')](!![]);_0x398cdd['next']();},_0x5d3a72);switch(_0x26cd05['strategy']){case'rrmemory':strategy[_0xc008('0x42')](_0x31007c,_0x26cd05,_0x2d142d,_0x5706bb);break;default:strategy[_0xc008('0x43')](_0x31007c,_0x26cd05,_0x2d142d,_0x5706bb);}}else{logger[_0xc008('0x2a')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xc8cb91,_0x3323f4[_0xc008('0x26')]);_0x398cdd[_0xc008('0x3e')]();}}}catch(_0x17ab1a){console[_0xc008('0x44')](_0x17ab1a);logger[_0xc008('0x2a')](_0xc008('0x34'),_0xc8cb91,_0x17ab1a[_0xc008('0x45')]);_0x398cdd[_0xc008('0x3e')]();}};}; \ 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 938ca57..d458a0e 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 _0x2227=['routing','notificationId','squeue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','busy','busyQueue','showNotification','writeLog','RINGING','forcedOwnership','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','TIMEOUT','exports','lodash','uuid','./util'];(function(_0x5d73eb,_0x417b0c){var _0x529461=function(_0x2efbeb){while(--_0x2efbeb){_0x5d73eb['push'](_0x5d73eb['shift']());}};_0x529461(++_0x417b0c);}(_0x2227,0x147));var _0x7222=function(_0x568496,_0x565afd){_0x568496=_0x568496-0x0;var _0x26c5c1=_0x2227[_0x568496];return _0x26c5c1;};'use strict';var _=require(_0x7222('0x0'));var uuid=require(_0x7222('0x1'));var util=require(_0x7222('0x2'));var logger=require('../../../../../config/logger')(_0x7222('0x3'));var Agent=function(_0x2cd609,_0x2f93ad,_0x219473,_0x3c6457){this[_0x7222('0x4')]=uuid['v4']();this[_0x7222('0x5')]=_0x2cd609;this['agent']=_0x2f93ad;this[_0x7222('0x6')]=_0x219473;this['routing']=_0x3c6457;this['squeue'][_0x7222('0x7')](this[_0x7222('0x8')][_0x7222('0x9')](this),this[_0x7222('0xa')]['bind'](this));this[_0x7222('0x5')]['on'](_0x7222('0xb'),this[_0x7222('0xa')][_0x7222('0x9')](this));this[_0x7222('0x5')]['on'](_0x7222('0xc'),this[_0x7222('0xd')][_0x7222('0x9')](this));};Agent[_0x7222('0xe')][_0x7222('0x7')]=function(){this[_0x7222('0x5')]['push'](this[_0x7222('0x8')][_0x7222('0x9')](this),this[_0x7222('0xa')][_0x7222('0x9')](this));};Agent[_0x7222('0xe')][_0x7222('0xd')]=function(){this['handleTimeout'](!![]);};Agent[_0x7222('0xe')]['handleRun']=function(_0x241957){logger[_0x7222('0xf')](_0x7222('0x10'),this[_0x7222('0x5')]['id'],this[_0x7222('0x11')]['id']);if(_[_0x7222('0x12')](this[_0x7222('0x6')][_0x7222('0x13')][this[_0x7222('0x11')]['id']])){logger[_0x7222('0xf')](_0x7222('0x14'),this[_0x7222('0x5')]['id'],this[_0x7222('0x11')]['id']);setTimeout(this['push'][_0x7222('0x9')](this),0x3e8);}else{if(this[_0x7222('0x3')]['forcedOwnership']||util['isAgentAvailable'](this['squeue']['id'],this['realtime'][_0x7222('0x13')][this[_0x7222('0x11')]['id']],this['squeue'][_0x7222('0x15')],![])){this[_0x7222('0x6')][_0x7222('0x13')][this[_0x7222('0x11')]['id']][_0x7222('0x16')]=!![];this[_0x7222('0x6')][_0x7222('0x13')][this[_0x7222('0x11')]['id']][_0x7222('0x17')]=undefined;util[_0x7222('0x18')](this[_0x7222('0x4')],this[_0x7222('0x5')]['id'],this[_0x7222('0x6')][_0x7222('0x13')][this[_0x7222('0x11')]['id']],null,this[_0x7222('0x3')]);util[_0x7222('0x19')](this[_0x7222('0x5')]['id'],this[_0x7222('0x6')][_0x7222('0x13')][this[_0x7222('0x11')]['id']],_0x7222('0x1a')+(this[_0x7222('0x3')][_0x7222('0x1b')]?':FORCED':''));}else{logger[_0x7222('0xf')](_0x7222('0x1c'),this[_0x7222('0x5')]['id'],this[_0x7222('0x11')]['id']);setTimeout(this[_0x7222('0x7')][_0x7222('0x9')](this),0x3e8);}}};Agent['prototype'][_0x7222('0xa')]=function(_0x282170){if(_[_0x7222('0x12')](this[_0x7222('0x6')][_0x7222('0x13')][this['agent']['id']])){return logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x7222('0x11')]['id']);}else{logger['info'](_0x7222('0x1d'),this['squeue']['id'],this[_0x7222('0x11')]['id']);util[_0x7222('0x1e')](this[_0x7222('0x4')],this[_0x7222('0x5')]['id'],this['realtime'][_0x7222('0x13')][this[_0x7222('0x11')]['id']],null,this[_0x7222('0x3')]);this['realtime']['agents'][this[_0x7222('0x11')]['id']][_0x7222('0x16')]=![];this[_0x7222('0x6')][_0x7222('0x13')][this[_0x7222('0x11')]['id']][_0x7222('0x17')]=undefined;util[_0x7222('0x19')](this[_0x7222('0x5')]['id'],this['realtime'][_0x7222('0x13')][this['agent']['id']],_0x282170?'STOP':_0x7222('0x1f'));}if(!_0x282170){setTimeout(this[_0x7222('0x7')][_0x7222('0x9')](this),0x3e8);}};function agent(_0x247491,_0x5cf76f,_0x9b3855,_0x13cb86){return new Agent(_0x247491,_0x5cf76f,_0x9b3855,_0x13cb86);}module[_0x7222('0x20')]=agent; \ No newline at end of file +var _0x82aa=['busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy'];(function(_0xefb2c,_0x9e9e9c){var _0x379b74=function(_0x1d9ea6){while(--_0x1d9ea6){_0xefb2c['push'](_0xefb2c['shift']());}};_0x379b74(++_0x9e9e9c);}(_0x82aa,0xff));var _0xa82a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x82aa[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xa82a('0x0'));var uuid=require(_0xa82a('0x1'));var util=require(_0xa82a('0x2'));var logger=require(_0xa82a('0x3'))(_0xa82a('0x4'));var Agent=function(_0x186919,_0xa220ab,_0x5bebfc,_0x2b17a0){this[_0xa82a('0x5')]=uuid['v4']();this[_0xa82a('0x6')]=_0x186919;this[_0xa82a('0x7')]=_0xa220ab;this['realtime']=_0x5bebfc;this[_0xa82a('0x4')]=_0x2b17a0;this[_0xa82a('0x6')][_0xa82a('0x8')](this[_0xa82a('0x9')][_0xa82a('0xa')](this),this[_0xa82a('0xb')]['bind'](this));this['squeue']['on'](_0xa82a('0xc'),this[_0xa82a('0xb')][_0xa82a('0xa')](this));this[_0xa82a('0x6')]['on'](_0xa82a('0xd'),this[_0xa82a('0xe')][_0xa82a('0xa')](this));};Agent['prototype']['push']=function(){this['squeue'][_0xa82a('0x8')](this[_0xa82a('0x9')][_0xa82a('0xa')](this),this[_0xa82a('0xb')][_0xa82a('0xa')](this));};Agent[_0xa82a('0xf')][_0xa82a('0xe')]=function(){this[_0xa82a('0xb')](!![]);};Agent[_0xa82a('0xf')][_0xa82a('0x9')]=function(_0x505286){logger[_0xa82a('0x10')](_0xa82a('0x11'),this[_0xa82a('0x6')]['id'],this[_0xa82a('0x7')]['id']);if(_[_0xa82a('0x12')](this[_0xa82a('0x13')][_0xa82a('0x14')][this[_0xa82a('0x7')]['id']])){logger[_0xa82a('0x10')](_0xa82a('0x15'),this['squeue']['id'],this[_0xa82a('0x7')]['id']);setTimeout(this[_0xa82a('0x8')]['bind'](this),0x3e8);}else{if(this[_0xa82a('0x4')][_0xa82a('0x16')]||util[_0xa82a('0x17')](this[_0xa82a('0x6')]['id'],this[_0xa82a('0x13')][_0xa82a('0x14')][this[_0xa82a('0x7')]['id']],this[_0xa82a('0x6')]['channel'],![])){this['realtime'][_0xa82a('0x14')][this[_0xa82a('0x7')]['id']][_0xa82a('0x18')]=!![];this['realtime']['agents'][this[_0xa82a('0x7')]['id']][_0xa82a('0x19')]=undefined;util[_0xa82a('0x1a')](this['notificationId'],this['squeue']['id'],this[_0xa82a('0x13')][_0xa82a('0x14')][this[_0xa82a('0x7')]['id']],null,this['routing']);util[_0xa82a('0x1b')](this['squeue']['id'],this[_0xa82a('0x13')][_0xa82a('0x14')][this['agent']['id']],_0xa82a('0x1c')+(this[_0xa82a('0x4')][_0xa82a('0x16')]?_0xa82a('0x1d'):''));}else{logger['info'](_0xa82a('0x1e'),this['squeue']['id'],this[_0xa82a('0x7')]['id']);setTimeout(this[_0xa82a('0x8')][_0xa82a('0xa')](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0x3da3c8){if(_[_0xa82a('0x12')](this['realtime'][_0xa82a('0x14')][this[_0xa82a('0x7')]['id']])){return logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xa82a('0x6')]['id'],this[_0xa82a('0x7')]['id']);}else{logger['info'](_0xa82a('0x1f'),this['squeue']['id'],this[_0xa82a('0x7')]['id']);util[_0xa82a('0x20')](this[_0xa82a('0x5')],this[_0xa82a('0x6')]['id'],this[_0xa82a('0x13')]['agents'][this[_0xa82a('0x7')]['id']],null,this['routing']);this[_0xa82a('0x13')][_0xa82a('0x14')][this[_0xa82a('0x7')]['id']][_0xa82a('0x18')]=![];this[_0xa82a('0x13')][_0xa82a('0x14')][this['agent']['id']][_0xa82a('0x19')]=undefined;util[_0xa82a('0x1b')](this[_0xa82a('0x6')]['id'],this[_0xa82a('0x13')][_0xa82a('0x14')][this[_0xa82a('0x7')]['id']],_0x3da3c8?_0xa82a('0x21'):'TIMEOUT');}if(!_0x3da3c8){setTimeout(this[_0xa82a('0x8')][_0xa82a('0xa')](this),0x3e8);}};function agent(_0x38bbd7,_0x16f41d,_0x4781cc,_0x1ba1a9){return new Agent(_0x38bbd7,_0x16f41d,_0x4781cc,_0x1ba1a9);}module[_0xa82a('0x22')]=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 3edfd49..c242d28 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 _0x1641=['exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','queue','push','bind','handleTimeout','timeout','drained','handleDrained','prototype','handleRun','isNil','length','Agents','realtime','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','name','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification','STOP','TIMEOUT','busyQueue'];(function(_0x33666a,_0x2d8071){var _0xf75d0a=function(_0x6b15da){while(--_0x6b15da){_0x33666a['push'](_0x33666a['shift']());}};_0xf75d0a(++_0x2d8071);}(_0x1641,0xc7));var _0x1164=function(_0x35ea24,_0x2258ca){_0x35ea24=_0x35ea24-0x0;var _0x56ed55=_0x1641[_0x35ea24];return _0x56ed55;};'use strict';var _=require(_0x1164('0x0'));var uuid=require(_0x1164('0x1'));var util=require('./util');var logger=require(_0x1164('0x2'))(_0x1164('0x3'));var Beepall=function(_0x30cf98,_0x170c29,_0x5bbf36,_0x28da42){this[_0x1164('0x4')]=uuid['v4']();this[_0x1164('0x5')]=_0x30cf98;this[_0x1164('0x6')]=_0x170c29;this['realtime']=_0x5bbf36;this['routing']=_0x28da42;this[_0x1164('0x5')][_0x1164('0x7')](this['handleRun'][_0x1164('0x8')](this),this[_0x1164('0x9')]['bind'](this));this[_0x1164('0x5')]['on'](_0x1164('0xa'),this[_0x1164('0x9')][_0x1164('0x8')](this));this['squeue']['on'](_0x1164('0xb'),this[_0x1164('0xc')][_0x1164('0x8')](this));};Beepall[_0x1164('0xd')][_0x1164('0x7')]=function(){this[_0x1164('0x5')][_0x1164('0x7')](this[_0x1164('0xe')]['bind'](this),this['handleTimeout']['bind'](this));};Beepall[_0x1164('0xd')][_0x1164('0xc')]=function(_0x20aaf6){this['handleTimeout'](!![]);};Beepall[_0x1164('0xd')]['handleRun']=function(_0x4f710f){var _0x26e3ab=!![];if(!_[_0x1164('0xf')](this[_0x1164('0x6')])&&!_[_0x1164('0xf')](this[_0x1164('0x6')]['Agents'])&&this[_0x1164('0x6')]['Agents'][_0x1164('0x10')]>0x0){for(var _0xee5ae5=0x0,_0x108400;_0xee5ae50x0){for(var _0x5712aa=0x0,_0x45fc50;_0x5712aa0x0&&_0x385175[_0xc314e7+_0x995b('0x25')]>=_0x385175[_0xc314e7+'Capacity']){writeLog(_0x22918c,_0x385175,_0xc314e7['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x995b('0x26')]=function(_0x168954,_0x445358,_0xb34845,_0x401640,_0x599f45){return sendNotification(!![],_0x168954,_0x445358,_0xb34845,_0x401640,_0x599f45);};exports[_0x995b('0x27')]=function(_0x3cac34,_0x151e05,_0x2d9c75,_0x3796a8,_0x36c984){return sendNotification(![],_0x3cac34,_0x151e05,_0x2d9c75,_0x3796a8,_0x36c984);};exports[_0x995b('0x28')]=writeLog; \ No newline at end of file +var _0x7be9=['socket.io-emitter','emit','format','user:%s','name','user:save','split','\x20interaction','account','notificationSound','body','queue','msg','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','util','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','localhost'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7be9,0xff));var _0x97be=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x7be9[_0x3070dc];return _0x431489;};'use strict';var _=require('lodash');var util=require(_0x97be('0x0'));var utils=require(_0x97be('0x1'));var Mustache=require(_0x97be('0x2'));var Redis=require(_0x97be('0x3'));var config=require(_0x97be('0x4'));var logger=require(_0x97be('0x5'))(_0x97be('0x6'));config[_0x97be('0x7')]=_['defaults'](config['redis'],{'host':_0x97be('0x8'),'port':0x18eb});var io=require(_0x97be('0x9'))(new Redis(config[_0x97be('0x7')]));function emit(_0x4e8223,_0x402a1a,_0x449149){io['to'](_0x4e8223)[_0x97be('0xa')](_0x402a1a,_0x449149);}function sendNotification(_0x5876d4,_0x3c305c,_0x369f94,_0x15b177,_0x1a0bcb,_0x279bea){io['to'](util[_0x97be('0xb')](_0x97be('0xc'),_0x15b177[_0x97be('0xd')]))['emit'](_0x97be('0xe'),_0x15b177);var _0x36e0d5=_0x279bea||{};var _0x1317e9=_0x369f94[_0x97be('0xf')]('.');var _0x1ee711={'uniqueid':_0x3c305c,'channel':_0x1317e9[0x0],'id':_0x1317e9[0x1],'title':_0x1317e9[0x0]+_0x97be('0x10'),'interactionId':_0x1317e9[0x2],'queue':_0x1a0bcb?_0x1a0bcb['name']:null,'sound':_0x36e0d5[_0x97be('0x11')][_0x97be('0x12')],'shake':_0x36e0d5[_0x97be('0x11')]['notificationShake']};try{if(!_0x36e0d5[_0x97be('0x13')]){_0x36e0d5['body']={};}if(_0x1a0bcb){_0x36e0d5[_0x97be('0x13')]['queue']=_0x1a0bcb;}else if(_0x36e0d5['body'][_0x97be('0x14')]){delete _0x36e0d5[_0x97be('0x13')][_0x97be('0x14')];}_0x1ee711[_0x97be('0x15')]=utils['getMustacheRender'](_0x36e0d5[_0x97be('0x11')][_0x97be('0x16')],_0x36e0d5);}catch(_0x391299){_0x1ee711[_0x97be('0x15')]=_0x97be('0x17');logger[_0x97be('0x18')](util[_0x97be('0xb')](_0x97be('0x19'),_0x3c305c,_0x391299[_0x97be('0x1a')]));}io['to'](util[_0x97be('0xb')](_0x97be('0xc'),_0x15b177['name']))[_0x97be('0xa')](util['format'](_0x97be('0x1b'),_0x5876d4?_0x97be('0x1c'):_0x97be('0x1d')),_0x1ee711);}function writeLog(_0xf0a33b,_0x5b02ed,_0x154985){return logger[_0x97be('0x1e')](util[_0x97be('0xb')](_0x97be('0x1f'),_0xf0a33b,_0x5b02ed['name'],_0x154985));}exports['isAgentAvailable']=function(_0x288025,_0x2ee444,_0x201e2f,_0x4e6fac){if(_0x2ee444[_0x97be('0x20')]){writeLog(_0x288025,_0x2ee444,_0x97be('0x21'));return![];}if(!_0x2ee444['online']){writeLog(_0x288025,_0x2ee444,'OFFLINE');return![];}if(_0x2ee444[_0x201e2f+_0x97be('0x22')]){writeLog(_0x288025,_0x2ee444,_0x97be('0x23'));return![];}if(_0x4e6fac&&_0x2ee444[_0x97be('0x24')](_0x201e2f+_0x97be('0x25'))&&_0x2ee444[_0x97be('0x24')](_0x201e2f+_0x97be('0x26'))){if(_0x2ee444[_0x201e2f+'Capacity']>0x0&&_0x2ee444[_0x201e2f+'CurrentCapacity']>=_0x2ee444[_0x201e2f+'Capacity']){writeLog(_0x288025,_0x2ee444,_0x201e2f[_0x97be('0x27')]()+_0x97be('0x28'));return![];}}return!![];};exports[_0x97be('0x29')]=function(_0x49188b,_0x14a6d0,_0x34bea8,_0x996d32,_0x157ae1){return sendNotification(!![],_0x49188b,_0x14a6d0,_0x34bea8,_0x996d32,_0x157ae1);};exports[_0x97be('0x2a')]=function(_0x336681,_0x245023,_0x3022e3,_0x55a13c,_0x3a7265){return sendNotification(![],_0x336681,_0x245023,_0x3022e3,_0x55a13c,_0x3a7265);};exports[_0x97be('0x2b')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 8834e59..a0c55d3 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 _0x0a7a=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','./utils','../../../../config/logger','routing','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject'];(function(_0x5c0ff3,_0x4ff210){var _0x38204d=function(_0x16c0ec){while(--_0x16c0ec){_0x5c0ff3['push'](_0x5c0ff3['shift']());}};_0x38204d(++_0x4ff210);}(_0x0a7a,0x121));var _0xa0a7=function(_0x1c6160,_0x2012d7){_0x1c6160=_0x1c6160-0x0;var _0x59c5bf=_0x0a7a[_0x1c6160];return _0x59c5bf;};'use strict';var schema=require(_0xa0a7('0x0'));var sh=require(_0xa0a7('0x1'));var _=require('lodash');var utils=require(_0xa0a7('0x2'));var logger=require(_0xa0a7('0x3'))(_0xa0a7('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x1f3370,_0x3b9f91){return function(_0xcec9e0){try{var _0x125d57={'command':_0x3b9f91[0x0]};var _0xf31729=system['validate'](_0x125d57,{'typecast':!![]});if(_0xf31729[_0xa0a7('0x5')]){logger[_0xa0a7('0x6')](_0xa0a7('0x7'),_0x1f3370,_[_0xa0a7('0x8')](_0xf31729,_0xa0a7('0x9'))[_0xa0a7('0xa')](',\x20'));logger[_0xa0a7('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x1f3370);_0xcec9e0[_0xa0a7('0xc')]();}else{var _0x1355f2=this;var _0x3460b4=utils[_0xa0a7('0xd')](_0x3b9f91[0x0],this);logger[_0xa0a7('0xb')](_0xa0a7('0xe'),_0x1f3370,_0x3460b4);sh[_0xa0a7('0xf')](_[_0xa0a7('0x10')](_0x3460b4),function(_0x1c2fa2,_0x5679e9){logger[_0xa0a7('0xb')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x1f3370,_0x1c2fa2);if(_0x1c2fa2==0x0){var _0x145809=_0x5679e9['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xa0a7('0x11')](_0x3b9f91[0x1])||_[_0xa0a7('0x12')](_0x3b9f91[0x1])){logger[_0xa0a7('0xb')](_0xa0a7('0x13'),_0x1f3370);_0x1355f2[_0xa0a7('0x14')][_0x3b9f91[0x1]]=_0x145809;}else{logger[_0xa0a7('0xb')](_0xa0a7('0x15'),_0x1f3370,_0x3b9f91[0x1],_0x145809);_0x1355f2[_0xa0a7('0x14')][_0x3b9f91[0x1]]=_0x145809;}}_0xcec9e0['next']();});}}catch(_0x181297){logger[_0xa0a7('0x6')](_0xa0a7('0x7'),_0x1f3370,_[_0xa0a7('0x16')](_0x181297)?JSON['stringify'](_0x181297):_0x181297);logger[_0xa0a7('0xb')](_0xa0a7('0x17'),_0x1f3370);_0xcec9e0[_0xa0a7('0xc')]();}};}; \ No newline at end of file +var _0xe911=['isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','isObject','validate','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','[%s][SYSTEM]\x20result\x20code:\x20%s'];(function(_0x50445d,_0x4e568c){var _0x1bfa93=function(_0x549aff){while(--_0x549aff){_0x50445d['push'](_0x50445d['shift']());}};_0x1bfa93(++_0x4e568c);}(_0xe911,0x158));var _0x1e91=function(_0x342f7b,_0x40c79d){_0x342f7b=_0x342f7b-0x0;var _0x259225=_0xe911[_0x342f7b];return _0x259225;};'use strict';var schema=require(_0x1e91('0x0'));var sh=require(_0x1e91('0x1'));var _=require(_0x1e91('0x2'));var utils=require(_0x1e91('0x3'));var logger=require(_0x1e91('0x4'))(_0x1e91('0x5'));var system=schema({'command':{'type':_0x1e91('0x6'),'required':!![],'message':_0x1e91('0x7')}});exports[_0x1e91('0x8')]=function(_0x4a7146,_0x535a2c){return function(_0x305d65){try{var _0x4e49c5={'command':_0x535a2c[0x0]};var _0x1aabd1=system['validate'](_0x4e49c5,{'typecast':!![]});if(_0x1aabd1[_0x1e91('0x9')]){logger['error'](_0x1e91('0xa'),_0x4a7146,_[_0x1e91('0xb')](_0x1aabd1,_0x1e91('0xc'))[_0x1e91('0xd')](',\x20'));logger['info'](_0x1e91('0xe'),_0x4a7146);_0x305d65[_0x1e91('0xf')]();}else{var _0x3f5360=this;var _0x142800=utils[_0x1e91('0x10')](_0x535a2c[0x0],this);logger[_0x1e91('0x11')](_0x1e91('0x12'),_0x4a7146,_0x142800);sh['exec'](_['trim'](_0x142800),function(_0x181a2f,_0x52e8ff){logger[_0x1e91('0x11')](_0x1e91('0x13'),_0x4a7146,_0x181a2f);if(_0x181a2f==0x0){var _0x1d6dc7=_0x52e8ff['replace'](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x535a2c[0x1])||_[_0x1e91('0x14')](_0x535a2c[0x1])){logger[_0x1e91('0x11')](_0x1e91('0x15'),_0x4a7146);_0x3f5360[_0x1e91('0x16')][_0x535a2c[0x1]]=_0x1d6dc7;}else{logger[_0x1e91('0x11')](_0x1e91('0x17'),_0x4a7146,_0x535a2c[0x1],_0x1d6dc7);_0x3f5360[_0x1e91('0x16')][_0x535a2c[0x1]]=_0x1d6dc7;}}_0x305d65[_0x1e91('0xf')]();});}}catch(_0x574038){logger[_0x1e91('0x18')](_0x1e91('0xa'),_0x4a7146,_[_0x1e91('0x19')](_0x574038)?JSON['stringify'](_0x574038):_0x574038);logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x4a7146);_0x305d65[_0x1e91('0xf')]();}};}; \ 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 2701d41..7524b48 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 _0x1d38=['catch','error','stringify','finally','next','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','then','interaction'];(function(_0x57cb4f,_0x541f57){var _0x29bb45=function(_0x462bee){while(--_0x462bee){_0x57cb4f['push'](_0x57cb4f['shift']());}};_0x29bb45(++_0x541f57);}(_0x1d38,0x18e));var _0x81d3=function(_0x38d90e,_0x300c68){_0x38d90e=_0x38d90e-0x0;var _0x3eae1c=_0x1d38[_0x38d90e];return _0x3eae1c;};'use strict';var schema=require(_0x81d3('0x0'));var _=require(_0x81d3('0x1'));var rpc={'chatInteraction':require(_0x81d3('0x2')),'openchannelInteraction':require(_0x81d3('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x81d3('0x4')),'faxInteraction':require(_0x81d3('0x5')),'whatsappInteraction':require(_0x81d3('0x6'))};var logger=require('../../../../config/logger')(_0x81d3('0x7'));var tag=schema({'tag':{'type':_0x81d3('0x8'),'required':!![],'message':_0x81d3('0x9')}});exports['consequence']=function(_0x316d6e,_0x471f8a,_0x39943c,_0x38b034){return function(_0x80aba0){try{var _0x478b60={'tag':_0x471f8a[0x0]};var _0x5b98d5=tag['validate'](_0x478b60,{'typecast':!![]});if(_0x5b98d5[_0x81d3('0xa')]){logger['error'](_0x81d3('0xb'),_0x316d6e,_[_0x81d3('0xc')](_0x5b98d5,_0x81d3('0xd'))[_0x81d3('0xe')](',\x20'));logger[_0x81d3('0xf')](_0x81d3('0x10'),_0x316d6e);_0x80aba0['next']();}else{var _0x52d9d9={'ids':[_0x471f8a[0x0]]};if(rpc[_0x38b034[_0x81d3('0x11')]+_0x81d3('0x12')]){rpc[_0x38b034[_0x81d3('0x11')]+_0x81d3('0x12')][_0x81d3('0x13')](_0x38b034['interaction']['id'],_0x52d9d9)[_0x81d3('0x14')](function(_0x1cee9f){logger[_0x81d3('0xf')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x316d6e,_0x471f8a[0x1],_0x38b034[_0x81d3('0x11')],_0x38b034[_0x81d3('0x15')]['id']);})[_0x81d3('0x16')](function(_0x27b1d1){logger[_0x81d3('0x17')]('[%s][TAG]\x20%s',_0x316d6e,JSON[_0x81d3('0x18')](_0x27b1d1));logger['info'](_0x81d3('0x10'),_0x316d6e);})[_0x81d3('0x19')](function(){_0x80aba0[_0x81d3('0x1a')]();});}}}catch(_0x3436ce){logger[_0x81d3('0x17')]('[%s][TAG]\x20%s',_0x316d6e,_[_0x81d3('0x1b')](_0x3436ce)?JSON[_0x81d3('0x18')](_0x3436ce):_0x3436ce);logger[_0x81d3('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x316d6e);_0x80aba0['next']();}};}; \ No newline at end of file +var _0xc020=['error','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','[%s][TAG]\x20%s','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xc020,0x9e));var _0x0c02=function(_0x366388,_0x4595a6){_0x366388=_0x366388-0x0;var _0x41c97e=_0xc020[_0x366388];return _0x41c97e;};'use strict';var schema=require(_0x0c02('0x0'));var _=require(_0x0c02('0x1'));var rpc={'chatInteraction':require(_0x0c02('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x0c02('0x3')),'mailInteraction':require(_0x0c02('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x0c02('0x5'))(_0x0c02('0x6'));var tag=schema({'tag':{'type':_0x0c02('0x7'),'required':!![],'message':_0x0c02('0x8')}});exports[_0x0c02('0x9')]=function(_0x5dc18d,_0x3dd746,_0x2d1c12,_0x5becc0){return function(_0x40e6b1){try{var _0x171746={'tag':_0x3dd746[0x0]};var _0x7c367c=tag['validate'](_0x171746,{'typecast':!![]});if(_0x7c367c['length']){logger[_0x0c02('0xa')]('[%s][TAG]\x20%s',_0x5dc18d,_[_0x0c02('0xb')](_0x7c367c,_0x0c02('0xc'))[_0x0c02('0xd')](',\x20'));logger[_0x0c02('0xe')](_0x0c02('0xf'),_0x5dc18d);_0x40e6b1[_0x0c02('0x10')]();}else{var _0x33f04c={'ids':[_0x3dd746[0x0]]};if(rpc[_0x5becc0[_0x0c02('0x11')]+_0x0c02('0x12')]){rpc[_0x5becc0['channel']+_0x0c02('0x12')][_0x0c02('0x13')](_0x5becc0[_0x0c02('0x14')]['id'],_0x33f04c)[_0x0c02('0x15')](function(_0x37568a){logger[_0x0c02('0xe')](_0x0c02('0x16'),_0x5dc18d,_0x3dd746[0x1],_0x5becc0[_0x0c02('0x11')],_0x5becc0['interaction']['id']);})[_0x0c02('0x17')](function(_0x3dd78d){logger['error']('[%s][TAG]\x20%s',_0x5dc18d,JSON[_0x0c02('0x18')](_0x3dd78d));logger[_0x0c02('0xe')](_0x0c02('0xf'),_0x5dc18d);})[_0x0c02('0x19')](function(){_0x40e6b1[_0x0c02('0x10')]();});}}}catch(_0xf4c60b){logger[_0x0c02('0xa')](_0x0c02('0x1a'),_0x5dc18d,_[_0x0c02('0x1b')](_0xf4c60b)?JSON[_0x0c02('0x18')](_0xf4c60b):_0xf4c60b);logger['info'](_0x0c02('0xf'),_0x5dc18d);_0x40e6b1['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 995764f..0796b5c 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 _0x769c=['merge','body','contact','message','interaction','list','mustache','exports'];(function(_0x435008,_0x48359c){var _0x1e7065=function(_0x4c4114){while(--_0x4c4114){_0x435008['push'](_0x435008['shift']());}};_0x1e7065(++_0x48359c);}(_0x769c,0x96));var _0xc769=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x769c[_0x46698a];return _0x356db0;};'use strict';var Mustache=require(_0xc769('0x0'));var _=require('lodash');module[_0xc769('0x1')]={'getMustacheRender':function(_0x463db3,_0x4ec370){return Mustache['render'](_0x463db3,_[_0xc769('0x2')](_0x4ec370[_0xc769('0x3')],{'contact':_0x4ec370[_0xc769('0x4')],'message':_0x4ec370[_0xc769('0x5')],'account':_0x4ec370['account'],'interaction':_0x4ec370[_0xc769('0x6')],'list':_0x4ec370[_0xc769('0x7')]}))||'';}}; \ No newline at end of file +var _0x3eec=['lodash','exports','render','merge','body','contact','message','account','list','mustache'];(function(_0x1e35da,_0x2c298d){var _0x4a1bd8=function(_0x256186){while(--_0x256186){_0x1e35da['push'](_0x1e35da['shift']());}};_0x4a1bd8(++_0x2c298d);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x3d5225,_0x333416){_0x3d5225=_0x3d5225-0x0;var _0x549f90=_0x3eec[_0x3d5225];return _0x549f90;};'use strict';var Mustache=require(_0xc3ee('0x0'));var _=require(_0xc3ee('0x1'));module[_0xc3ee('0x2')]={'getMustacheRender':function(_0x3b1908,_0x484ade){return Mustache[_0xc3ee('0x3')](_0x3b1908,_[_0xc3ee('0x4')](_0x484ade[_0xc3ee('0x5')],{'contact':_0x484ade[_0xc3ee('0x6')],'message':_0x484ade[_0xc3ee('0x7')],'account':_0x484ade[_0xc3ee('0x8')],'interaction':_0x484ade['interaction'],'list':_0x484ade[_0xc3ee('0x9')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index b25dfd1..6d7b4cb 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 _0x008c=['lodash','util','path','jayson/promise','bluebird','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','isArray','applications','length','app','toLowerCase','autoreply','appdata','push','slice','join','dialogflow','dialogflowv2','split','amazonlex','tag','TagId','format','%s:%s:%s','./interval','condition','intervals','consequence','info','Push\x20new\x20rule','\x20|\x20','.js','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','agents','busyQueue','interaction','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','paused','mailQueues','name','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:'];(function(_0x5ecd2a,_0xa5a1d7){var _0x406b96=function(_0x5df158){while(--_0x5df158){_0x5ecd2a['push'](_0x5ecd2a['shift']());}};_0x406b96(++_0xa5a1d7);}(_0x008c,0x188));var _0xc008=function(_0x23aeaf,_0x241fa7){_0x23aeaf=_0x23aeaf-0x0;var _0x118109=_0x008c[_0x23aeaf];return _0x118109;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var fs=require('fs');var jayson=require(_0xc008('0x3'));var BPromise=require(_0xc008('0x4'));var uuid=require('uuid');var config=require(_0xc008('0x5'));var logger=require(_0xc008('0x6'))(_0xc008('0x7'));var rpc={'openchannelQueueReport':require(_0xc008('0x8')),'mailQueueReport':require(_0xc008('0x9')),'chatQueueReport':require(_0xc008('0xa')),'smsQueueReport':require(_0xc008('0xb')),'faxQueueReport':require(_0xc008('0xc')),'whatsappQueueReport':require(_0xc008('0xd'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x428fa9,_0x5aa09b,_0x30be38){return util['format']('%s.%s.%s',_0x428fa9,_0x5aa09b||0x0,_0x30be38||0x0);}function getIntervals(_0x27830d,_0x7231b4){var _0x57c46d=[];if(!_['isNil'](_0x7231b4['IntervalId'])&&!_[_0xc008('0xe')](_0x27830d[_0x7231b4[_0xc008('0xf')]])&&!_['isNil'](_0x27830d[_0x7231b4[_0xc008('0xf')]][_0xc008('0x10')])){_0x57c46d=_[_0xc008('0x11')](_0x27830d[_0x7231b4[_0xc008('0xf')]][_0xc008('0x10')],_0xc008('0x12'));}else if(!_[_0xc008('0xe')](_0x7231b4['interval'])){_0x57c46d=[_0x7231b4['interval']];}return _0x57c46d;}exports[_0xc008('0x13')]=function(_0x50c1ab){_0x50c1ab[_0xc008('0x14')]={};return new BPromise(function(_0x4584e1,_0x2073ef){var _0x339ffc={'Start':function(_0x3f0ecf){var _0x5ee00b=this;return new Promise(function(_0x5e894e,_0x4bd0f4){if(_0x3f0ecf){try{var _0x11ef38=[];var _0x15a6ad=getId(_0x3f0ecf[_0xc008('0x15')],_0x3f0ecf[_0xc008('0x16')]?_0x3f0ecf['message']['id']:0x0,_0x3f0ecf['interaction']?_0x3f0ecf['interaction']['id']:0x0);if(_0x3f0ecf['applications']&&_[_0xc008('0x17')](_0x3f0ecf[_0xc008('0x18')])&&_0x3f0ecf['applications'][_0xc008('0x19')]){for(var _0x5906e6=0x0;_0x5906e6<_0x3f0ecf['applications']['length'];_0x5906e6+=0x1){var _0x50261c=_0x3f0ecf[_0xc008('0x18')][_0x5906e6];if(fs['existsSync'](path['join'](__dirname,'applications',_0x50261c['app']+'.js'))){var _0x13a263=[];switch(_0x50261c[_0xc008('0x1a')][_0xc008('0x1b')]()){case _0xc008('0x1c'):var _0x11cc75=_0x50261c[_0xc008('0x1d')]['split'](',');if(_0x3f0ecf[_0xc008('0x15')]==='mail'){_0x13a263['push'](_0x11cc75[0x0]);_0x13a263[_0xc008('0x1e')](_0x11cc75[0x1]);_0x13a263[_0xc008('0x1e')](_0x11cc75[_0xc008('0x1f')](0x2,_0x11cc75[_0xc008('0x19')])['join'](','));}else{_0x13a263['push'](_0x11cc75[0x0]);_0x13a263['push'](_0x11cc75[_0xc008('0x1f')](0x1,_0x11cc75[_0xc008('0x19')])[_0xc008('0x20')](','));}break;case _0xc008('0x21'):var _0x5bebd9=_0x50261c['appdata']['split'](',');_0x13a263['push'](_0x5bebd9[0x0]);_0x13a263['push'](_0x5bebd9[0x1]);_0x13a263[_0xc008('0x1e')](_0x5bebd9[_0xc008('0x1f')](0x2,_0x5bebd9[_0xc008('0x19')])['join'](','));break;case _0xc008('0x22'):var _0x32390d=_0x50261c[_0xc008('0x1d')][_0xc008('0x23')](',');_0x13a263['push'](_0x32390d[0x0]);_0x13a263[_0xc008('0x1e')](_0x32390d[0x1]);_0x13a263[_0xc008('0x1e')](_0x32390d[0x2]);_0x13a263['push'](_0x32390d[0x3]);_0x13a263['push'](_0x32390d['slice'](0x4,_0x32390d[_0xc008('0x19')])[_0xc008('0x20')](','));break;case _0xc008('0x24'):var _0x10889f=_0x50261c[_0xc008('0x1d')][_0xc008('0x23')](',');_0x13a263[_0xc008('0x1e')](_0x10889f[0x0]);_0x13a263[_0xc008('0x1e')](_0x10889f[0x1]);_0x13a263[_0xc008('0x1e')](_0x10889f[0x2]);_0x13a263[_0xc008('0x1e')](_0x10889f[0x3]);_0x13a263[_0xc008('0x1e')](_0x10889f[_0xc008('0x1f')](0x4,_0x10889f['length'])[_0xc008('0x20')](','));break;case _0xc008('0x16'):_0x13a263['push'](_0x50261c[_0xc008('0x1d')]);break;case _0xc008('0x25'):_0x13a263[_0xc008('0x1e')](_0x50261c[_0xc008('0x26')]);_0x13a263[_0xc008('0x1e')](_0x50261c[_0xc008('0x1d')]);break;default:_0x13a263=_[_0xc008('0xe')](_0x50261c[_0xc008('0x1d')])?[]:_0x50261c[_0xc008('0x1d')]['split'](',');}var _0x415b87={'id':util[_0xc008('0x27')](_0xc008('0x28'),_0x15a6ad,_0x50261c['id'],_0x50261c[_0xc008('0x1a')]),'condition':require(_0xc008('0x29'))[_0xc008('0x2a')](_0x15a6ad,getIntervals(_0x50c1ab[_0xc008('0x2b')],_0x50261c),_0x50c1ab),'consequence':require('./applications/'+_0x50261c[_0xc008('0x1a')])[_0xc008('0x2c')](_0x15a6ad,_0x13a263,_0x50c1ab,_0x3f0ecf),'p':_0x50261c['priority']||0x0};logger[_0xc008('0x2d')](_0xc008('0x2e'),_0x415b87['id'],'on\x20interval',getIntervals(_0x50c1ab[_0xc008('0x2b')],_0x50261c)[_0xc008('0x20')](_0xc008('0x2f')));_0x11ef38['push'](_0x415b87);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path[_0xc008('0x20')](__dirname,'applications',_0x50261c[_0xc008('0x1a')]+_0xc008('0x30')));}}_0x50c1ab[_0xc008('0x14')][_0x15a6ad]=new RuleEngine(_0x11ef38);_0x50c1ab[_0xc008('0x14')][_0x15a6ad][_0xc008('0x31')](_0x3f0ecf,function(_0xa381d1){logger[_0xc008('0x2d')](_0xc008('0x32'),JSON[_0xc008('0x33')](_0xa381d1[_0xc008('0x34')]));if(_0x50c1ab[_0xc008('0x14')][_0x15a6ad]){_0x50c1ab[_0xc008('0x14')][_0x15a6ad][_0xc008('0x35')](_0xc008('0x36'));}});return _0x5e894e({'code':0xc8,'message':_0x3f0ecf});}else{logger['info'](_0xc008('0x37'));return _0x5e894e({'code':0xc8,'message':_0x3f0ecf});}}catch(_0x23c4db){logger[_0xc008('0x38')](_0x23c4db[_0xc008('0x39')]);return _0x4bd0f4(_0x5ee00b['error'](0x1f4,_0x23c4db));}}return _0x4bd0f4(_0xc008('0x3a'));});},'AcceptMessage':function(_0x15396b){var _0xc8cb91=this;return new Promise(function(_0x36e7ae,_0x2d142d){if(_0x15396b['agent']&&_0x15396b[_0xc008('0x3b')]['id']){if(_0x50c1ab[_0xc008('0x3c')][_0x15396b[_0xc008('0x3b')]['id']]){_0x50c1ab[_0xc008('0x3c')][_0x15396b[_0xc008('0x3b')]['id']]['busy']=![];_0x50c1ab[_0xc008('0x3c')][_0x15396b[_0xc008('0x3b')]['id']][_0xc008('0x3d')]=undefined;}}if(_0x15396b[_0xc008('0x16')]&&_0x15396b['message']['id']){try{var _0x26cd05=getId(_0x15396b[_0xc008('0x15')],_0x15396b[_0xc008('0x16')]?_0x15396b['message']['id']:0x0,_0x15396b[_0xc008('0x3e')]?_0x15396b['interaction']['id']:0x0);if(_0x50c1ab[_0xc008('0x14')][_0x26cd05]){_0x50c1ab['rules'][_0x26cd05][_0xc008('0x35')](_0xc008('0x3f'));if(rpc[_0x15396b['channel']+_0xc008('0x40')]){rpc[_0x15396b[_0xc008('0x15')]+_0xc008('0x40')]['update'](_0x26cd05,{'UserId':_0x15396b[_0xc008('0x16')][_0xc008('0x41')]})[_0xc008('0x42')](function(_0x44fc5d){logger[_0xc008('0x38')](_0xc008('0x43'));});}}return _0x36e7ae({'code':0xc8,'message':_0x15396b});}catch(_0x59ca2b){logger['error'](_0x59ca2b['stack']);return _0x2d142d(_0xc8cb91[_0xc008('0x38')](0x1f4,_0x59ca2b));}}logger[_0xc008('0x38')](_0xc008('0x44'));return _0x2d142d(_0xc8cb91[_0xc008('0x38')](0x1f4,_0xc008('0x44')));});},'RejectMessage':function(_0x24f6a4){var _0x2cf641=this;return new Promise(function(_0x33be4f,_0x572593){if(_0x24f6a4['agent']&&_0x24f6a4['agent']['id']){try{if(_0x50c1ab[_0xc008('0x3c')][_0x24f6a4[_0xc008('0x3b')]['id']]){_0x50c1ab[_0xc008('0x3c')][_0x24f6a4['agent']['id']][_0xc008('0x45')]=![];_0x50c1ab[_0xc008('0x3c')][_0x24f6a4[_0xc008('0x3b')]['id']][_0xc008('0x3d')]=undefined;}return _0x33be4f({'code':0xc8,'message':_0x24f6a4});}catch(_0x4981b4){logger[_0xc008('0x38')](_0x4981b4[_0xc008('0x39')]);return _0x572593(_0x2cf641[_0xc008('0x38')](0x1f4,_0x4981b4));}}logger[_0xc008('0x38')](_0xc008('0x44'));return _0x572593(_0x2cf641['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x223056){var _0x51cb14=this;return new Promise(function(_0x437fef,_0x36e6f8){if(_0x223056[_0xc008('0x15')]&&_0x223056['interaction']&&_0x223056[_0xc008('0x3e')]['id']){try{var _0x32b435=getId(_0x223056[_0xc008('0x15')],_0x223056[_0xc008('0x16')]?_0x223056[_0xc008('0x16')]['id']:0x0,_0x223056['interaction']?_0x223056[_0xc008('0x3e')]['id']:0x0);if(_0x50c1ab[_0xc008('0x14')][_0x32b435]){_0x50c1ab['rules'][_0x32b435][_0xc008('0x35')](_0xc008('0x3f'));}return _0x437fef({'code':0xc8,'message':_0x223056});}catch(_0x5b5fbf){logger['error'](_0x5b5fbf[_0xc008('0x39')]);return _0x36e6f8(_0x51cb14[_0xc008('0x38')](0x1f4,_0x5b5fbf));}}logger[_0xc008('0x38')](_0xc008('0x44'));return _0x36e6f8(_0x51cb14[_0xc008('0x38')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x57f1f9){var _0x34b72a=this;return new Promise(function(_0x5d815d,_0x3d7cce){if(_0x50c1ab[_0xc008('0x3c')][_0xc008('0x46')](_0x57f1f9['id'])){for(var _0x2f1105 in _0x57f1f9[_0xc008('0x47')]){if(_0x57f1f9[_0xc008('0x47')]['hasOwnProperty'](_0x2f1105)){if(_0x50c1ab[_0xc008('0x3c')][_0x57f1f9['id']][_0xc008('0x46')](_0x2f1105+_0xc008('0x48'))){_0x50c1ab[_0xc008('0x3c')][_0x57f1f9['id']][_0x2f1105+_0xc008('0x48')]=parseInt(_0x57f1f9['capacity'][_0x2f1105],0xa);}}}_0x50c1ab[_0xc008('0x3c')][_0x57f1f9['id']]['updateRealtime']();return _0x5d815d({'code':0xc8,'message':_0x50c1ab['agents'][_0x57f1f9['id']]});}else{return _0x3d7cce(_0x34b72a['error'](0x1f4,_0xc008('0x49')));}});},'Agents':function(_0x1bcbb1){return new Promise(function(_0x5dfb69,_0x5f58d7){var _0x3aeeab=_[_0xc008('0x4a')](_0x50c1ab[_0xc008('0x3c')]);_0x5dfb69({'count':_0x3aeeab['length'],'rows':_0x3aeeab});});},'ChatQueues':function(_0x3587c3){return new Promise(function(_0x1092cb,_0x12ba3f){var _0x1b5a22=[];for(var _0x5baff1 in _0x50c1ab[_0xc008('0x4b')]){if(_0x50c1ab['chatQueues'][_0xc008('0x46')](_0x5baff1)){var _0x422e1f=_0x50c1ab[_0xc008('0x4b')][_0x5baff1];var _0x943c91={'id':_0x422e1f['id'],'available':_0x422e1f[_0xc008('0x4c')],'loggedIn':_0x422e1f[_0xc008('0x4d')],'name':_0x422e1f['name'],'paused':_0x422e1f[_0xc008('0x4e')],'waiting':_0x422e1f['waiting']};_0x1b5a22['push'](_0x943c91);}}_0x1092cb({'count':_0x1b5a22[_0xc008('0x19')],'rows':_0x1b5a22});});},'MailQueues':function(_0x30aa1e){return new Promise(function(_0x56e755,_0xb1befa){var _0xb8ba7=[];for(var _0x3e373e in _0x50c1ab[_0xc008('0x4f')]){if(_0x50c1ab[_0xc008('0x4f')][_0xc008('0x46')](_0x3e373e)){var _0x12973b=_0x50c1ab['mailQueues'][_0x3e373e];var _0x16e052={'id':_0x12973b['id'],'available':_0x12973b[_0xc008('0x4c')],'loggedIn':_0x12973b[_0xc008('0x4d')],'name':_0x12973b[_0xc008('0x50')],'paused':_0x12973b[_0xc008('0x4e')],'waiting':_0x12973b[_0xc008('0x51')]};_0xb8ba7[_0xc008('0x1e')](_0x16e052);}}_0x56e755({'count':_0xb8ba7[_0xc008('0x19')],'rows':_0xb8ba7});});},'OpenchannelQueues':function(_0xbc430a){return new Promise(function(_0x37d193,_0x1bef66){var _0x2b5eb6=[];for(var _0x131b81 in _0x50c1ab[_0xc008('0x52')]){if(_0x50c1ab['openchannelQueues'][_0xc008('0x46')](_0x131b81)){var _0x2e5467=_0x50c1ab[_0xc008('0x52')][_0x131b81];var _0x566dea={'id':_0x2e5467['id'],'available':_0x2e5467[_0xc008('0x4c')],'loggedIn':_0x2e5467[_0xc008('0x4d')],'name':_0x2e5467['name'],'paused':_0x2e5467['paused'],'waiting':_0x2e5467[_0xc008('0x51')]};_0x2b5eb6[_0xc008('0x1e')](_0x566dea);}}_0x37d193({'count':_0x2b5eb6[_0xc008('0x19')],'rows':_0x2b5eb6});});},'SmsQueues':function(_0x39083c){return new Promise(function(_0x1a2ce7,_0x335f00){var _0x238852=[];for(var _0x38191e in _0x50c1ab[_0xc008('0x53')]){if(_0x50c1ab[_0xc008('0x53')][_0xc008('0x46')](_0x38191e)){var _0x490a60=_0x50c1ab[_0xc008('0x53')][_0x38191e];var _0x25a52b={'id':_0x490a60['id'],'available':_0x490a60[_0xc008('0x4c')],'loggedIn':_0x490a60[_0xc008('0x4d')],'name':_0x490a60['name'],'paused':_0x490a60[_0xc008('0x4e')],'waiting':_0x490a60['waiting']};_0x238852[_0xc008('0x1e')](_0x25a52b);}}_0x1a2ce7({'count':_0x238852[_0xc008('0x19')],'rows':_0x238852});});},'FaxQueues':function(_0x419257){return new Promise(function(_0x4ccffe,_0x1c31f5){var _0x2e5e2b=[];for(var _0xa80000 in _0x50c1ab['faxQueues']){if(_0x50c1ab[_0xc008('0x54')]['hasOwnProperty'](_0xa80000)){var _0x50ee03=_0x50c1ab[_0xc008('0x54')][_0xa80000];var _0x23012c={'id':_0x50ee03['id'],'available':_0x50ee03[_0xc008('0x4c')],'loggedIn':_0x50ee03[_0xc008('0x4d')],'name':_0x50ee03['name'],'paused':_0x50ee03[_0xc008('0x4e')],'waiting':_0x50ee03[_0xc008('0x51')]};_0x2e5e2b['push'](_0x23012c);}}_0x4ccffe({'count':_0x2e5e2b[_0xc008('0x19')],'rows':_0x2e5e2b});});},'WhatsappQueues':function(_0x5233bb){return new Promise(function(_0x278cbe,_0x50bfe5){var _0x20d08f=[];for(var _0x498cfb in _0x50c1ab[_0xc008('0x55')]){if(_0x50c1ab[_0xc008('0x55')][_0xc008('0x46')](_0x498cfb)){var _0x47337b=_0x50c1ab['whatsappQueues'][_0x498cfb];var _0x57752c={'id':_0x47337b['id'],'available':_0x47337b[_0xc008('0x4c')],'loggedIn':_0x47337b[_0xc008('0x4d')],'name':_0x47337b[_0xc008('0x50')],'paused':_0x47337b[_0xc008('0x4e')],'waiting':_0x47337b[_0xc008('0x51')]};_0x20d08f[_0xc008('0x1e')](_0x57752c);}}_0x278cbe({'count':_0x20d08f[_0xc008('0x19')],'rows':_0x20d08f});});},'ChatQueuesWaitingInteractions':function(_0x5be2f8){return new Promise(function(_0x3e535b,_0x530c2f){var _0x511477=_['values'](_0x50c1ab[_0xc008('0x56')]);_0x3e535b({'count':_0x511477[_0xc008('0x19')],'rows':_0x511477});});},'MailQueuesWaitingInteractions':function(_0x3b41b0){return new Promise(function(_0x233a85,_0xc2f684){var _0x2e9646=_[_0xc008('0x4a')](_0x50c1ab[_0xc008('0x57')]);_0x233a85({'count':_0x2e9646[_0xc008('0x19')],'rows':_0x2e9646});});},'OpenchannelQueuesWaitingInteractions':function(_0x551d38){return new Promise(function(_0x38b603,_0x1e6055){var _0x2b1b26=_[_0xc008('0x4a')](_0x50c1ab[_0xc008('0x58')]);_0x38b603({'count':_0x2b1b26[_0xc008('0x19')],'rows':_0x2b1b26});});},'SmsQueuesWaitingInteractions':function(_0x23d4ff){return new Promise(function(_0x2edb8e,_0x100dcd){var _0x41ac2a=_[_0xc008('0x4a')](_0x50c1ab[_0xc008('0x59')]);_0x2edb8e({'count':_0x41ac2a['length'],'rows':_0x41ac2a});});},'FaxQueuesWaitingInteractions':function(_0x4e7af3){return new Promise(function(_0x320e1d,_0x3104cd){var _0x41e92e=_['values'](_0x50c1ab[_0xc008('0x5a')]);_0x320e1d({'count':_0x41e92e[_0xc008('0x19')],'rows':_0x41e92e});});},'WhatsappQueuesWaitingInteractions':function(_0x4ed54b){return new Promise(function(_0x50dd7c,_0x4908c8){var _0x3fc44f=_[_0xc008('0x4a')](_0x50c1ab[_0xc008('0x5b')]);_0x50dd7c({'count':_0x3fc44f[_0xc008('0x19')],'rows':_0x3fc44f});});}};var _0x1101b8=jayson[_0xc008('0x5c')](_0x339ffc)[_0xc008('0x5d')]();_0x1101b8['on'](_0xc008('0x38'),function(_0x1161e6){logger[_0xc008('0x38')](JSON['stringify'](_0x1161e6));return _0x2073ef(_0x1161e6);});_0x1101b8['listen'](0x232c,_0xc008('0x5e'),function(){console[_0xc008('0x5f')](_0xc008('0x60'),0x232c);return _0x4584e1(_0xc008('0x61')+0x232c);});});}; \ No newline at end of file +var _0x6c32=['openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','message','interaction','isArray','applications','length','toLowerCase','split','channel','mail','push','slice','join','dialogflow','appdata','amazonlex','tag','TagId','%s:%s:%s','app','./interval','condition','./applications/','consequence','priority','info','Push\x20new\x20rule','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','stringify','matchPath','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','emit','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','end','capacity','hasOwnProperty','CurrentCapacity','values','chatQueues','loggedIn','name','paused','waiting','mailQueues','available'];(function(_0x1d6d5f,_0x195b5b){var _0x54420b=function(_0x48910f){while(--_0x48910f){_0x1d6d5f['push'](_0x1d6d5f['shift']());}};_0x54420b(++_0x195b5b);}(_0x6c32,0x6e));var _0x26c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6c32[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x26c3('0x0'));var util=require(_0x26c3('0x1'));var path=require(_0x26c3('0x2'));var fs=require('fs');var jayson=require(_0x26c3('0x3'));var BPromise=require(_0x26c3('0x4'));var uuid=require(_0x26c3('0x5'));var config=require(_0x26c3('0x6'));var logger=require(_0x26c3('0x7'))(_0x26c3('0x8'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x26c3('0x9')),'chatQueueReport':require(_0x26c3('0xa')),'smsQueueReport':require(_0x26c3('0xb')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x26c3('0xc'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x3dde22,_0x3ff8e7,_0x1a4c5b){return util[_0x26c3('0xd')](_0x26c3('0xe'),_0x3dde22,_0x3ff8e7||0x0,_0x1a4c5b||0x0);}function getIntervals(_0xda2203,_0x155187){var _0x380194=[];if(!_[_0x26c3('0xf')](_0x155187[_0x26c3('0x10')])&&!_['isNil'](_0xda2203[_0x155187['IntervalId']])&&!_['isNil'](_0xda2203[_0x155187['IntervalId']][_0x26c3('0x11')])){_0x380194=_[_0x26c3('0x12')](_0xda2203[_0x155187[_0x26c3('0x10')]][_0x26c3('0x11')],'interval');}else if(!_['isNil'](_0x155187[_0x26c3('0x13')])){_0x380194=[_0x155187[_0x26c3('0x13')]];}return _0x380194;}exports[_0x26c3('0x14')]=function(_0x3cd3c7){_0x3cd3c7[_0x26c3('0x15')]={};return new BPromise(function(_0x568d0b,_0x5d4e9d){var _0x2acfb1={'Start':function(_0xc14c69){var _0x4f4256=this;return new Promise(function(_0x4ed7c1,_0x124cb3){if(_0xc14c69){try{var _0x5e863f=[];var _0x3ce1ea=getId(_0xc14c69['channel'],_0xc14c69['message']?_0xc14c69[_0x26c3('0x16')]['id']:0x0,_0xc14c69['interaction']?_0xc14c69[_0x26c3('0x17')]['id']:0x0);if(_0xc14c69['applications']&&_[_0x26c3('0x18')](_0xc14c69[_0x26c3('0x19')])&&_0xc14c69[_0x26c3('0x19')][_0x26c3('0x1a')]){for(var _0x20317d=0x0;_0x20317d<_0xc14c69['applications']['length'];_0x20317d+=0x1){var _0x47657d=_0xc14c69[_0x26c3('0x19')][_0x20317d];if(fs['existsSync'](path['join'](__dirname,_0x26c3('0x19'),_0x47657d['app']+'.js'))){var _0x128fca=[];switch(_0x47657d['app'][_0x26c3('0x1b')]()){case'autoreply':var _0x367b62=_0x47657d['appdata'][_0x26c3('0x1c')](',');if(_0xc14c69[_0x26c3('0x1d')]===_0x26c3('0x1e')){_0x128fca[_0x26c3('0x1f')](_0x367b62[0x0]);_0x128fca[_0x26c3('0x1f')](_0x367b62[0x1]);_0x128fca[_0x26c3('0x1f')](_0x367b62[_0x26c3('0x20')](0x2,_0x367b62[_0x26c3('0x1a')])[_0x26c3('0x21')](','));}else{_0x128fca[_0x26c3('0x1f')](_0x367b62[0x0]);_0x128fca['push'](_0x367b62[_0x26c3('0x20')](0x1,_0x367b62['length'])['join'](','));}break;case _0x26c3('0x22'):var _0x13f843=_0x47657d['appdata'][_0x26c3('0x1c')](',');_0x128fca['push'](_0x13f843[0x0]);_0x128fca[_0x26c3('0x1f')](_0x13f843[0x1]);_0x128fca[_0x26c3('0x1f')](_0x13f843[_0x26c3('0x20')](0x2,_0x13f843[_0x26c3('0x1a')])[_0x26c3('0x21')](','));break;case'dialogflowv2':var _0x1d3331=_0x47657d[_0x26c3('0x23')][_0x26c3('0x1c')](',');_0x128fca[_0x26c3('0x1f')](_0x1d3331[0x0]);_0x128fca[_0x26c3('0x1f')](_0x1d3331[0x1]);_0x128fca[_0x26c3('0x1f')](_0x1d3331[0x2]);_0x128fca['push'](_0x1d3331[0x3]);_0x128fca[_0x26c3('0x1f')](_0x1d3331[_0x26c3('0x20')](0x4,_0x1d3331[_0x26c3('0x1a')])['join'](','));break;case _0x26c3('0x24'):var _0x19316e=_0x47657d[_0x26c3('0x23')][_0x26c3('0x1c')](',');_0x128fca[_0x26c3('0x1f')](_0x19316e[0x0]);_0x128fca[_0x26c3('0x1f')](_0x19316e[0x1]);_0x128fca['push'](_0x19316e[0x2]);_0x128fca[_0x26c3('0x1f')](_0x19316e[0x3]);_0x128fca[_0x26c3('0x1f')](_0x19316e['slice'](0x4,_0x19316e['length'])['join'](','));break;case'message':_0x128fca['push'](_0x47657d[_0x26c3('0x23')]);break;case _0x26c3('0x25'):_0x128fca['push'](_0x47657d[_0x26c3('0x26')]);_0x128fca[_0x26c3('0x1f')](_0x47657d['appdata']);break;default:_0x128fca=_['isNil'](_0x47657d[_0x26c3('0x23')])?[]:_0x47657d['appdata'][_0x26c3('0x1c')](',');}var _0x4fc9ff={'id':util[_0x26c3('0xd')](_0x26c3('0x27'),_0x3ce1ea,_0x47657d['id'],_0x47657d[_0x26c3('0x28')]),'condition':require(_0x26c3('0x29'))[_0x26c3('0x2a')](_0x3ce1ea,getIntervals(_0x3cd3c7['intervals'],_0x47657d),_0x3cd3c7),'consequence':require(_0x26c3('0x2b')+_0x47657d[_0x26c3('0x28')])[_0x26c3('0x2c')](_0x3ce1ea,_0x128fca,_0x3cd3c7,_0xc14c69),'p':_0x47657d[_0x26c3('0x2d')]||0x0};logger[_0x26c3('0x2e')](_0x26c3('0x2f'),_0x4fc9ff['id'],'on\x20interval',getIntervals(_0x3cd3c7['intervals'],_0x47657d)[_0x26c3('0x21')](_0x26c3('0x30')));_0x5e863f[_0x26c3('0x1f')](_0x4fc9ff);}else{logger[_0x26c3('0x31')](_0x26c3('0x32'),path['join'](__dirname,'applications',_0x47657d['app']+_0x26c3('0x33')));}}_0x3cd3c7[_0x26c3('0x15')][_0x3ce1ea]=new RuleEngine(_0x5e863f);_0x3cd3c7[_0x26c3('0x15')][_0x3ce1ea][_0x26c3('0x34')](_0xc14c69,function(_0x124690){logger['info']('Applications\x20executed',JSON[_0x26c3('0x35')](_0x124690[_0x26c3('0x36')]));if(_0x3cd3c7[_0x26c3('0x15')][_0x3ce1ea]){_0x3cd3c7[_0x26c3('0x15')][_0x3ce1ea]['emit'](_0x26c3('0x37'));}});return _0x4ed7c1({'code':0xc8,'message':_0xc14c69});}else{logger[_0x26c3('0x2e')](_0x26c3('0x38'));return _0x4ed7c1({'code':0xc8,'message':_0xc14c69});}}catch(_0x203c54){logger[_0x26c3('0x31')](_0x203c54[_0x26c3('0x39')]);return _0x124cb3(_0x4f4256[_0x26c3('0x31')](0x1f4,_0x203c54));}}return _0x124cb3(_0x26c3('0x3a'));});},'AcceptMessage':function(_0x306ef1){var _0x1c0d6c=this;return new Promise(function(_0x1b415e,_0xafc671){if(_0x306ef1[_0x26c3('0x3b')]&&_0x306ef1['agent']['id']){if(_0x3cd3c7[_0x26c3('0x3c')][_0x306ef1[_0x26c3('0x3b')]['id']]){_0x3cd3c7[_0x26c3('0x3c')][_0x306ef1[_0x26c3('0x3b')]['id']][_0x26c3('0x3d')]=![];_0x3cd3c7[_0x26c3('0x3c')][_0x306ef1['agent']['id']][_0x26c3('0x3e')]=undefined;}}if(_0x306ef1['message']&&_0x306ef1[_0x26c3('0x16')]['id']){try{var _0x50f5cb=getId(_0x306ef1[_0x26c3('0x1d')],_0x306ef1[_0x26c3('0x16')]?_0x306ef1['message']['id']:0x0,_0x306ef1[_0x26c3('0x17')]?_0x306ef1[_0x26c3('0x17')]['id']:0x0);if(_0x3cd3c7[_0x26c3('0x15')][_0x50f5cb]){_0x3cd3c7[_0x26c3('0x15')][_0x50f5cb][_0x26c3('0x3f')]('end');if(rpc[_0x306ef1[_0x26c3('0x1d')]+'QueueReport']){rpc[_0x306ef1[_0x26c3('0x1d')]+'QueueReport']['update'](_0x50f5cb,{'UserId':_0x306ef1[_0x26c3('0x16')][_0x26c3('0x40')]})[_0x26c3('0x41')](function(_0x50f4de){logger[_0x26c3('0x31')](_0x26c3('0x42'));});}}return _0x1b415e({'code':0xc8,'message':_0x306ef1});}catch(_0xe2a7e){logger[_0x26c3('0x31')](_0xe2a7e[_0x26c3('0x39')]);return _0xafc671(_0x1c0d6c[_0x26c3('0x31')](0x1f4,_0xe2a7e));}}logger['error'](_0x26c3('0x43'));return _0xafc671(_0x1c0d6c[_0x26c3('0x31')](0x1f4,_0x26c3('0x43')));});},'RejectMessage':function(_0x133cf7){var _0x551e22=this;return new Promise(function(_0x2f87de,_0x3f4ca9){if(_0x133cf7['agent']&&_0x133cf7[_0x26c3('0x3b')]['id']){try{if(_0x3cd3c7[_0x26c3('0x3c')][_0x133cf7['agent']['id']]){_0x3cd3c7[_0x26c3('0x3c')][_0x133cf7['agent']['id']][_0x26c3('0x3d')]=![];_0x3cd3c7[_0x26c3('0x3c')][_0x133cf7[_0x26c3('0x3b')]['id']][_0x26c3('0x3e')]=undefined;}return _0x2f87de({'code':0xc8,'message':_0x133cf7});}catch(_0x4365e4){logger[_0x26c3('0x31')](_0x4365e4[_0x26c3('0x39')]);return _0x3f4ca9(_0x551e22['error'](0x1f4,_0x4365e4));}}logger[_0x26c3('0x31')]('message\x20is\x20empty');return _0x3f4ca9(_0x551e22['error'](0x1f4,_0x26c3('0x43')));});},'AbandonInteraction':function(_0x3a46f9){var _0x3037ae=this;return new Promise(function(_0x4dc997,_0x4832a2){if(_0x3a46f9[_0x26c3('0x1d')]&&_0x3a46f9[_0x26c3('0x17')]&&_0x3a46f9[_0x26c3('0x17')]['id']){try{var _0x4d1ec7=getId(_0x3a46f9[_0x26c3('0x1d')],_0x3a46f9[_0x26c3('0x16')]?_0x3a46f9[_0x26c3('0x16')]['id']:0x0,_0x3a46f9['interaction']?_0x3a46f9[_0x26c3('0x17')]['id']:0x0);if(_0x3cd3c7['rules'][_0x4d1ec7]){_0x3cd3c7[_0x26c3('0x15')][_0x4d1ec7][_0x26c3('0x3f')](_0x26c3('0x44'));}return _0x4dc997({'code':0xc8,'message':_0x3a46f9});}catch(_0x499445){logger[_0x26c3('0x31')](_0x499445[_0x26c3('0x39')]);return _0x4832a2(_0x3037ae[_0x26c3('0x31')](0x1f4,_0x499445));}}logger[_0x26c3('0x31')](_0x26c3('0x43'));return _0x4832a2(_0x3037ae[_0x26c3('0x31')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x370b2e){var _0x306fef=this;return new Promise(function(_0x5be7d1,_0x394187){if(_0x3cd3c7['agents']['hasOwnProperty'](_0x370b2e['id'])){for(var _0x14a37a in _0x370b2e['capacity']){if(_0x370b2e[_0x26c3('0x45')][_0x26c3('0x46')](_0x14a37a)){if(_0x3cd3c7[_0x26c3('0x3c')][_0x370b2e['id']][_0x26c3('0x46')](_0x14a37a+'CurrentCapacity')){_0x3cd3c7['agents'][_0x370b2e['id']][_0x14a37a+_0x26c3('0x47')]=parseInt(_0x370b2e['capacity'][_0x14a37a],0xa);}}}_0x3cd3c7['agents'][_0x370b2e['id']]['updateRealtime']();return _0x5be7d1({'code':0xc8,'message':_0x3cd3c7[_0x26c3('0x3c')][_0x370b2e['id']]});}else{return _0x394187(_0x306fef['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x1c7d72){return new Promise(function(_0x531e38,_0xa7f1ad){var _0x30299d=_[_0x26c3('0x48')](_0x3cd3c7[_0x26c3('0x3c')]);_0x531e38({'count':_0x30299d['length'],'rows':_0x30299d});});},'ChatQueues':function(_0x400c6d){return new Promise(function(_0x47749e,_0x1fcbb6){var _0x2680f5=[];for(var _0x5926f7 in _0x3cd3c7[_0x26c3('0x49')]){if(_0x3cd3c7[_0x26c3('0x49')][_0x26c3('0x46')](_0x5926f7)){var _0x7aa03a=_0x3cd3c7[_0x26c3('0x49')][_0x5926f7];var _0x28cde2={'id':_0x7aa03a['id'],'available':_0x7aa03a['available'],'loggedIn':_0x7aa03a[_0x26c3('0x4a')],'name':_0x7aa03a[_0x26c3('0x4b')],'paused':_0x7aa03a[_0x26c3('0x4c')],'waiting':_0x7aa03a[_0x26c3('0x4d')]};_0x2680f5['push'](_0x28cde2);}}_0x47749e({'count':_0x2680f5[_0x26c3('0x1a')],'rows':_0x2680f5});});},'MailQueues':function(_0x452643){return new Promise(function(_0xf10de,_0x416373){var _0x4d4970=[];for(var _0x396de4 in _0x3cd3c7[_0x26c3('0x4e')]){if(_0x3cd3c7[_0x26c3('0x4e')][_0x26c3('0x46')](_0x396de4)){var _0x5d0453=_0x3cd3c7[_0x26c3('0x4e')][_0x396de4];var _0x595fdd={'id':_0x5d0453['id'],'available':_0x5d0453[_0x26c3('0x4f')],'loggedIn':_0x5d0453['loggedIn'],'name':_0x5d0453[_0x26c3('0x4b')],'paused':_0x5d0453[_0x26c3('0x4c')],'waiting':_0x5d0453['waiting']};_0x4d4970[_0x26c3('0x1f')](_0x595fdd);}}_0xf10de({'count':_0x4d4970[_0x26c3('0x1a')],'rows':_0x4d4970});});},'OpenchannelQueues':function(_0x266e2b){return new Promise(function(_0xe5c060,_0x41767d){var _0x4fbd2e=[];for(var _0x1dcf53 in _0x3cd3c7[_0x26c3('0x50')]){if(_0x3cd3c7[_0x26c3('0x50')][_0x26c3('0x46')](_0x1dcf53)){var _0x26cb5b=_0x3cd3c7[_0x26c3('0x50')][_0x1dcf53];var _0x38cd7e={'id':_0x26cb5b['id'],'available':_0x26cb5b['available'],'loggedIn':_0x26cb5b[_0x26c3('0x4a')],'name':_0x26cb5b[_0x26c3('0x4b')],'paused':_0x26cb5b[_0x26c3('0x4c')],'waiting':_0x26cb5b[_0x26c3('0x4d')]};_0x4fbd2e['push'](_0x38cd7e);}}_0xe5c060({'count':_0x4fbd2e[_0x26c3('0x1a')],'rows':_0x4fbd2e});});},'SmsQueues':function(_0x965869){return new Promise(function(_0x5f1c25,_0x4df2f){var _0x46f622=[];for(var _0x43da27 in _0x3cd3c7[_0x26c3('0x51')]){if(_0x3cd3c7[_0x26c3('0x51')][_0x26c3('0x46')](_0x43da27)){var _0x2addd3=_0x3cd3c7[_0x26c3('0x51')][_0x43da27];var _0x3afdc7={'id':_0x2addd3['id'],'available':_0x2addd3[_0x26c3('0x4f')],'loggedIn':_0x2addd3[_0x26c3('0x4a')],'name':_0x2addd3[_0x26c3('0x4b')],'paused':_0x2addd3['paused'],'waiting':_0x2addd3['waiting']};_0x46f622['push'](_0x3afdc7);}}_0x5f1c25({'count':_0x46f622['length'],'rows':_0x46f622});});},'FaxQueues':function(_0x15a6c1){return new Promise(function(_0x27869f,_0x2464c7){var _0x3fe81e=[];for(var _0x2c136c in _0x3cd3c7[_0x26c3('0x52')]){if(_0x3cd3c7[_0x26c3('0x52')][_0x26c3('0x46')](_0x2c136c)){var _0x55cdc8=_0x3cd3c7[_0x26c3('0x52')][_0x2c136c];var _0x134cee={'id':_0x55cdc8['id'],'available':_0x55cdc8[_0x26c3('0x4f')],'loggedIn':_0x55cdc8[_0x26c3('0x4a')],'name':_0x55cdc8[_0x26c3('0x4b')],'paused':_0x55cdc8[_0x26c3('0x4c')],'waiting':_0x55cdc8['waiting']};_0x3fe81e[_0x26c3('0x1f')](_0x134cee);}}_0x27869f({'count':_0x3fe81e[_0x26c3('0x1a')],'rows':_0x3fe81e});});},'WhatsappQueues':function(_0x4dc47c){return new Promise(function(_0x25a2cb,_0x252534){var _0x538e3f=[];for(var _0x153509 in _0x3cd3c7[_0x26c3('0x53')]){if(_0x3cd3c7[_0x26c3('0x53')]['hasOwnProperty'](_0x153509)){var _0x35890f=_0x3cd3c7[_0x26c3('0x53')][_0x153509];var _0x39fe7e={'id':_0x35890f['id'],'available':_0x35890f[_0x26c3('0x4f')],'loggedIn':_0x35890f[_0x26c3('0x4a')],'name':_0x35890f[_0x26c3('0x4b')],'paused':_0x35890f[_0x26c3('0x4c')],'waiting':_0x35890f['waiting']};_0x538e3f['push'](_0x39fe7e);}}_0x25a2cb({'count':_0x538e3f[_0x26c3('0x1a')],'rows':_0x538e3f});});},'ChatQueuesWaitingInteractions':function(_0x1ce607){return new Promise(function(_0x1c7387,_0x18189a){var _0x56b282=_[_0x26c3('0x48')](_0x3cd3c7['chatQueuesWaitingInteractions']);_0x1c7387({'count':_0x56b282['length'],'rows':_0x56b282});});},'MailQueuesWaitingInteractions':function(_0x407c93){return new Promise(function(_0x338ea0,_0x5d9223){var _0x3c6f6f=_['values'](_0x3cd3c7[_0x26c3('0x54')]);_0x338ea0({'count':_0x3c6f6f[_0x26c3('0x1a')],'rows':_0x3c6f6f});});},'OpenchannelQueuesWaitingInteractions':function(_0x3f0e89){return new Promise(function(_0x5bbaae,_0xc40965){var _0x585e76=_[_0x26c3('0x48')](_0x3cd3c7[_0x26c3('0x55')]);_0x5bbaae({'count':_0x585e76[_0x26c3('0x1a')],'rows':_0x585e76});});},'SmsQueuesWaitingInteractions':function(_0x3f3b87){return new Promise(function(_0x3d3144,_0x496135){var _0x52d532=_[_0x26c3('0x48')](_0x3cd3c7[_0x26c3('0x56')]);_0x3d3144({'count':_0x52d532['length'],'rows':_0x52d532});});},'FaxQueuesWaitingInteractions':function(_0x346429){return new Promise(function(_0x211668,_0x295463){var _0x4dd8a2=_[_0x26c3('0x48')](_0x3cd3c7[_0x26c3('0x57')]);_0x211668({'count':_0x4dd8a2['length'],'rows':_0x4dd8a2});});},'WhatsappQueuesWaitingInteractions':function(_0x5ebeab){return new Promise(function(_0x1440c9,_0x3d5bab){var _0x3da815=_[_0x26c3('0x48')](_0x3cd3c7[_0x26c3('0x58')]);_0x1440c9({'count':_0x3da815[_0x26c3('0x1a')],'rows':_0x3da815});});}};var _0x483458=jayson[_0x26c3('0x59')](_0x2acfb1)[_0x26c3('0x5a')]();_0x483458['on']('error',function(_0x4326a){logger[_0x26c3('0x31')](JSON[_0x26c3('0x35')](_0x4326a));return _0x5d4e9d(_0x4326a);});_0x483458['listen'](0x232c,_0x26c3('0x5b'),function(){console[_0x26c3('0x5c')](_0x26c3('0x5d'),0x232c);return _0x568d0b(_0x26c3('0x5e')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 04eba6a..525bfdf 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 _0xaee7=['routing','client','request','then','error','message','result','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','Command','format','iftime\x20%s','indexOf','true','catch','all','[%s][INTERVAL]\x20%s\x20%s','join','when','log','\x20|\x20','stack','bluebird','jayson/promise','lodash'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0xaee7,0x192));var _0x7aee=function(_0x24f424,_0x222001){_0x24f424=_0x24f424-0x0;var _0xfa875c=_0xaee7[_0x24f424];return _0xfa875c;};'use strict';var util=require('util');var BPromise=require(_0x7aee('0x0'));var jayson=require(_0x7aee('0x1'));var _=require(_0x7aee('0x2'));var logger=require('../../../config/logger')(_0x7aee('0x3'));var client=jayson[_0x7aee('0x4')]['http']({'port':0x232a});function request(_0x2b4b3b,_0x2e1327){return new BPromise(function(_0x12567a,_0x220fbe){return client[_0x7aee('0x5')](_0x2b4b3b,_0x2e1327)[_0x7aee('0x6')](function(_0x47102b){if(_0x47102b[_0x7aee('0x7')]){return _0x220fbe(_0x47102b['error'][_0x7aee('0x8')]);}else{return _0x12567a(_0x47102b[_0x7aee('0x9')]);}})['catch'](function(_0x56e56e){return _0x220fbe(_0x56e56e);});});}exports[_0x7aee('0xa')]=function(_0x91f7d7,_0x1fe4f4,_0x3127d4){return function(_0x36873e){if(_0x3127d4['rules']&&!_0x3127d4[_0x7aee('0xb')][_0x91f7d7]){logger[_0x7aee('0xc')](_0x7aee('0xd'),_0x91f7d7);return _0x36873e['stop']();}var _0xcc20d0=[];for(var _0x1c890f=0x0;_0x1c890f<_0x1fe4f4['length'];_0x1c890f+=0x1){_0xcc20d0['push'](request(_0x7aee('0xe'),{'command':util[_0x7aee('0xf')](_0x7aee('0x10'),_0x1fe4f4[_0x1c890f])})[_0x7aee('0x6')](function(_0x385f87){return _0x385f87&&_0x385f87[_0x7aee('0x8')]&&_0x385f87[_0x7aee('0x8')][_0x7aee('0x11')](_0x7aee('0x12'))>=0x0?!![]:![];})[_0x7aee('0x13')](function(_0xba80f5){logger[_0x7aee('0x7')]('[%s][INTERVAL]\x20%s',_0x91f7d7,_0x1fe4f4[_0x1c890f]);}));}BPromise[_0x7aee('0x14')](_0xcc20d0)[_0x7aee('0x6')](function(_0x53f179){var _0x51d793=_['some'](_0x53f179);logger['info'](_0x7aee('0x15'),_0x91f7d7,_0x1fe4f4[_0x7aee('0x16')]('\x20|\x20'),_0x51d793);_0x36873e[_0x7aee('0x17')](_0x51d793);})[_0x7aee('0x13')](function(_0x50c412){console[_0x7aee('0x18')](_0x50c412);logger[_0x7aee('0x7')](_0x7aee('0x15'),_0x91f7d7,_0x1fe4f4['join'](_0x7aee('0x19')),_0x50c412[_0x7aee('0x1a')]);_0x36873e['stop']();});};}; \ No newline at end of file +var _0xbdcc=['length','Command','format','indexOf','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','join','stack','stop','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','then','error','message','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0xbdcc,0xb6));var _0xcbdc=function(_0x172da7,_0x2ab894){_0x172da7=_0x172da7-0x0;var _0x1e9e8b=_0xbdcc[_0x172da7];return _0x1e9e8b;};'use strict';var util=require(_0xcbdc('0x0'));var BPromise=require(_0xcbdc('0x1'));var jayson=require(_0xcbdc('0x2'));var _=require(_0xcbdc('0x3'));var logger=require(_0xcbdc('0x4'))(_0xcbdc('0x5'));var client=jayson['client']['http']({'port':0x232a});function request(_0x205fb0,_0x1e8a62){return new BPromise(function(_0x49fa8a,_0x4031b2){return client['request'](_0x205fb0,_0x1e8a62)[_0xcbdc('0x6')](function(_0x5eee5b){if(_0x5eee5b[_0xcbdc('0x7')]){return _0x4031b2(_0x5eee5b['error'][_0xcbdc('0x8')]);}else{return _0x49fa8a(_0x5eee5b['result']);}})[_0xcbdc('0x9')](function(_0x106634){return _0x4031b2(_0x106634);});});}exports[_0xcbdc('0xa')]=function(_0x5aed79,_0x194308,_0xb6416e){return function(_0x211639){if(_0xb6416e[_0xcbdc('0xb')]&&!_0xb6416e['rules'][_0x5aed79]){logger[_0xcbdc('0xc')](_0xcbdc('0xd'),_0x5aed79);return _0x211639['stop']();}var _0x3b5594=[];for(var _0x2aac0b=0x0;_0x2aac0b<_0x194308[_0xcbdc('0xe')];_0x2aac0b+=0x1){_0x3b5594['push'](request(_0xcbdc('0xf'),{'command':util[_0xcbdc('0x10')]('iftime\x20%s',_0x194308[_0x2aac0b])})[_0xcbdc('0x6')](function(_0x56538a){return _0x56538a&&_0x56538a['message']&&_0x56538a['message'][_0xcbdc('0x11')](_0xcbdc('0x12'))>=0x0?!![]:![];})[_0xcbdc('0x9')](function(_0x57ec38){logger[_0xcbdc('0x7')](_0xcbdc('0x13'),_0x5aed79,_0x194308[_0x2aac0b]);}));}BPromise[_0xcbdc('0x14')](_0x3b5594)['then'](function(_0x4a254d){var _0x55e6ff=_['some'](_0x4a254d);logger[_0xcbdc('0xc')](_0xcbdc('0x15'),_0x5aed79,_0x194308['join'](_0xcbdc('0x16')),_0x55e6ff);_0x211639[_0xcbdc('0x17')](_0x55e6ff);})[_0xcbdc('0x9')](function(_0x1ebd1c){console[_0xcbdc('0x18')](_0x1ebd1c);logger[_0xcbdc('0x7')](_0xcbdc('0x15'),_0x5aed79,_0x194308[_0xcbdc('0x19')]('\x20|\x20'),_0x1ebd1c[_0xcbdc('0x1a')]);_0x211639[_0xcbdc('0x1b')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 7ccdd36..1dd613d 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 _0x39b3=['lodash','util','./utils','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','connectedlinenum','lastevent','getVoiceQueueByName','type','agentacw','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','format','[%s][agents][agentcalled]','now','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','debug','[%s][agents][agentringnoanswer]','timeout','reason','holdtime','ringtime','talktime','push','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','[%s][agents][agentconnect]','agentconnectAt','connectedlinename','answered_elsewhere','answeredelsewheremembername','agentcomplete','isNil','agentcompleteAt','diffTime','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transferexten','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','agentcalledAt','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent'];(function(_0x4a738e,_0x17f05b){var _0x85f0a3=function(_0x416feb){while(--_0x416feb){_0x4a738e['push'](_0x4a738e['shift']());}};_0x85f0a3(++_0x17f05b);}(_0x39b3,0xa6));var _0x339b=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x39b3[_0xefd519];return _0x4bb882;};'use strict';var _=require(_0x339b('0x0'));var util=require(_0x339b('0x1'));var utils=require(_0x339b('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x19e2b4,_0x32dc78){utils[_0x339b('0x3')](util['format'](_0x339b('0x4'),_0x19e2b4[_0x339b('0x5')],_0x19e2b4[_0x339b('0x6')],_0x19e2b4[_0x339b('0x7')],_0x19e2b4[_0x339b('0x8')],_0x19e2b4[_0x339b('0x9')],_0x19e2b4['calleridnum'],_0x19e2b4[_0x339b('0xa')],_0x19e2b4[_0x339b('0xb')]));if(_0x19e2b4[_0x339b('0x7')]){utils[_0x339b('0xc')](_0x19e2b4['queue'])['then'](function(_0x1b0d8b){if(_0x1b0d8b){_0x19e2b4[_0x339b('0xd')]=_0x1b0d8b['type'];_0x19e2b4[_0x339b('0xe')]=_0x19e2b4['agentcomplete']?_0x1b0d8b[_0x339b('0xf')]:![];_0x19e2b4[_0x339b('0x10')]=_0x19e2b4[_0x339b('0xe')]?_0x1b0d8b[_0x339b('0x11')]:0x0;}utils[_0x339b('0x12')](_0x339b('0x13'),_0x19e2b4);});}else{utils[_0x339b('0x12')](_0x339b('0x13'),_0x19e2b4);}if(_0x32dc78){delete transfers[_0x19e2b4[_0x339b('0x5')]];}else{delete agents[_0x19e2b4[_0x339b('0x14')]];}}exports[_0x339b('0x15')]=function(_0x4fcb50){try{utils['debug'](util[_0x339b('0x16')](_0x339b('0x17'),_0x4fcb50[_0x339b('0x5')]),_0x4fcb50);agents[_0x4fcb50[_0x339b('0x14')]]=_0x4fcb50;agents[_0x4fcb50['destuniqueid']]['agentcalledAt']=utils[_0x339b('0x18')]();agents[_0x4fcb50[_0x339b('0x14')]][_0x339b('0xb')]='called';agents[_0x4fcb50[_0x339b('0x14')]]['connectedlinenum']=null;agents[_0x4fcb50[_0x339b('0x14')]]['connectedlinename']=null;utils[_0x339b('0x3')](util[_0x339b('0x16')](_0x339b('0x19'),_0x4fcb50['uniqueid'],agents[_0x4fcb50[_0x339b('0x14')]][_0x339b('0x8')],_0x4fcb50[_0x339b('0x14')]));}catch(_0x175d3d){utils[_0x339b('0x1a')](util[_0x339b('0x16')]('[%s][agents][agentcalled]',_0x4fcb50[_0x339b('0x5')]),_0x175d3d);}};exports[_0x339b('0x1b')]=function(_0x26d915){try{if(!_['isNil'](agents[_0x26d915[_0x339b('0x14')]])){utils[_0x339b('0x1c')](util[_0x339b('0x16')](_0x339b('0x1d'),_0x26d915[_0x339b('0x5')]),_0x26d915);utils['info'](util[_0x339b('0x16')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x26d915[_0x339b('0x5')],agents[_0x26d915[_0x339b('0x14')]]['membername'],_0x26d915[_0x339b('0x14')]));agents[_0x26d915[_0x339b('0x14')]]['agentringnoanswer']=!![];agents[_0x26d915[_0x339b('0x14')]]['agentringnoanswerAt']=utils[_0x339b('0x18')]();agents[_0x26d915[_0x339b('0x14')]][_0x339b('0xb')]=_0x339b('0x1e');agents[_0x26d915['destuniqueid']][_0x339b('0x1f')]=_0x339b('0x1e');agents[_0x26d915[_0x339b('0x14')]][_0x339b('0x20')]=_0x26d915[_0x339b('0x21')]?parseInt(_0x26d915['ringtime'])/0x3e8:0x0;agents[_0x26d915[_0x339b('0x14')]][_0x339b('0x22')]=0x0;unanswered[_0x339b('0x23')](_0x26d915[_0x339b('0x14')]);}}catch(_0x1d8cec){utils[_0x339b('0x1a')](util[_0x339b('0x16')]('[%s][agents][agentringnoanswer]',_0x26d915[_0x339b('0x5')]),_0x1d8cec);}};exports['queuecallerabandon']=function(_0x128a0d){try{_[_0x339b('0x24')](agents,function(_0x187613,_0xa3cc3){if(_0x187613[_0x339b('0x5')]==_0x128a0d['uniqueid']&&!_[_0x339b('0x25')](unanswered,_0x187613[_0x339b('0x14')])){utils[_0x339b('0x1c')](util[_0x339b('0x16')](_0x339b('0x26'),_0x128a0d[_0x339b('0x5')]),_0x128a0d);utils[_0x339b('0x3')](util[_0x339b('0x16')](_0x339b('0x27'),_0x128a0d[_0x339b('0x5')],_0x187613[_0x339b('0x8')],_0x187613['destuniqueid']));_0x187613['agentringnoanswer']=!![];_0x187613[_0x339b('0x28')]=utils['now']();_0x187613[_0x339b('0xb')]=_0x339b('0x29');_0x187613[_0x339b('0x1f')]=_0x339b('0x29');_0x187613[_0x339b('0x20')]=_0x128a0d[_0x339b('0x20')];_0x187613['talktime']=0x0;writeDB(_0x187613);}});}catch(_0x21f97a){utils[_0x339b('0x1a')](util[_0x339b('0x16')](_0x339b('0x26'),_0x128a0d[_0x339b('0x5')]),_0x21f97a);}};exports['agentconnect']=function(_0x3a67b1){try{if(agents[_0x3a67b1[_0x339b('0x14')]]){utils[_0x339b('0x1c')](util['format'](_0x339b('0x2a'),_0x3a67b1[_0x339b('0x5')]),_0x3a67b1);utils[_0x339b('0x3')](util[_0x339b('0x16')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x3a67b1[_0x339b('0x5')],agents[_0x3a67b1[_0x339b('0x14')]][_0x339b('0x8')],_0x3a67b1['destuniqueid']));agents[_0x3a67b1[_0x339b('0x14')]][_0x339b('0x2b')]=utils[_0x339b('0x18')]();agents[_0x3a67b1['destuniqueid']][_0x339b('0xa')]=_0x3a67b1[_0x339b('0xa')];agents[_0x3a67b1[_0x339b('0x14')]]['connectedlinename']=_0x3a67b1[_0x339b('0x2c')];agents[_0x3a67b1['destuniqueid']]['holdtime']=_0x3a67b1[_0x339b('0x21')];agents[_0x3a67b1['destuniqueid']][_0x339b('0xb')]='connect';_[_0x339b('0x24')](agents,function(_0x1a0c9c,_0x5bab88){if(_0x1a0c9c[_0x339b('0x14')]!=_0x3a67b1[_0x339b('0x14')]&&_0x1a0c9c['uniqueid']==_0x3a67b1['uniqueid']){_0x1a0c9c['talktime']=0x0;_0x1a0c9c[_0x339b('0x20')]=_0x3a67b1[_0x339b('0x21')];_0x1a0c9c['agentringnoanswer']=!![];_0x1a0c9c[_0x339b('0x28')]=utils[_0x339b('0x18')]();_0x1a0c9c[_0x339b('0xb')]=_0x339b('0x2d');_0x1a0c9c['reason']=_0x339b('0x2d');_0x1a0c9c['answeredelsewheredestinationuniqueid']=_0x3a67b1[_0x339b('0x14')];_0x1a0c9c[_0x339b('0x2e')]=_0x3a67b1['membername'];writeDB(_0x1a0c9c);}});}}catch(_0x19eaab){utils[_0x339b('0x1a')](util[_0x339b('0x16')](_0x339b('0x2a'),_0x3a67b1['uniqueid']),_0x19eaab);}};exports[_0x339b('0x2f')]=function(_0x2413c9){try{if(!_[_0x339b('0x30')](agents[_0x2413c9[_0x339b('0x14')]])){utils[_0x339b('0x1c')](util['format']('[%s][agents][agentcomplete]',_0x2413c9[_0x339b('0x5')]),_0x2413c9);utils['info'](util[_0x339b('0x16')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2413c9[_0x339b('0x5')],agents[_0x2413c9[_0x339b('0x14')]][_0x339b('0x8')],_0x2413c9[_0x339b('0x14')]));agents[_0x2413c9[_0x339b('0x14')]][_0x339b('0x2f')]=!![];agents[_0x2413c9['destuniqueid']][_0x339b('0x31')]=utils[_0x339b('0x18')]();agents[_0x2413c9[_0x339b('0x14')]]['talktime']=utils[_0x339b('0x32')](agents[_0x2413c9[_0x339b('0x14')]][_0x339b('0x31')],agents[_0x2413c9['destuniqueid']][_0x339b('0x2b')]);agents[_0x2413c9[_0x339b('0x14')]][_0x339b('0x1f')]=_0x2413c9[_0x339b('0x1f')];agents[_0x2413c9['destuniqueid']][_0x339b('0xb')]=_0x339b('0x33');writeDB(agents[_0x2413c9[_0x339b('0x14')]]);}}catch(_0x5ae87f){utils[_0x339b('0x1a')](util['format'](_0x339b('0x34'),_0x2413c9['uniqueid']),_0x5ae87f);}};exports[_0x339b('0x35')]=function(_0x2c2e0c){try{if(!_[_0x339b('0x30')](agents[_0x2c2e0c[_0x339b('0x36')]])){utils[_0x339b('0x1c')](util[_0x339b('0x16')](_0x339b('0x37'),_0x2c2e0c[_0x339b('0x5')]),_0x2c2e0c);utils[_0x339b('0x3')](util[_0x339b('0x16')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x2c2e0c[_0x339b('0x5')],agents[_0x2c2e0c['transfereruniqueid']][_0x339b('0x8')],agents[_0x2c2e0c['transfereruniqueid']][_0x339b('0x5')]));agents[_0x2c2e0c[_0x339b('0x36')]][_0x339b('0x38')]=!![];agents[_0x2c2e0c['transfereruniqueid']]['transfertype']='blind';agents[_0x2c2e0c['transfereruniqueid']][_0x339b('0x39')]=_0x2c2e0c['extension'];agents[_0x2c2e0c[_0x339b('0x36')]][_0x339b('0x3a')]=agents[_0x2c2e0c['transfereruniqueid']][_0x339b('0x5')];}}catch(_0x4769fb){utils[_0x339b('0x1a')](util[_0x339b('0x16')](_0x339b('0x37'),_0x2c2e0c[_0x339b('0x5')]),_0x4769fb);}};exports[_0x339b('0x3b')]=function(_0x3d8bbc){try{utils['debug'](util[_0x339b('0x16')](_0x339b('0x3c'),_0x3d8bbc[_0x339b('0x3d')]),_0x3d8bbc);if(_0x3d8bbc[_0x339b('0x3d')]==_0x3d8bbc['origtransfererlinkedid']){if(!_[_0x339b('0x30')](agents[_0x3d8bbc[_0x339b('0x3e')]])){utils['info'](util[_0x339b('0x16')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x3d8bbc[_0x339b('0x3d')],agents[_0x3d8bbc[_0x339b('0x3e')]][_0x339b('0x8')]));agents[_0x3d8bbc['secondtransfereruniqueid']]['transfer']=!![];agents[_0x3d8bbc[_0x339b('0x3e')]][_0x339b('0x3f')]=_0x339b('0x40');agents[_0x3d8bbc[_0x339b('0x3e')]][_0x339b('0x39')]=_0x3d8bbc[_0x339b('0x41')];agents[_0x3d8bbc[_0x339b('0x3e')]][_0x339b('0x3a')]=_0x3d8bbc[_0x339b('0x3d')];}if(_0x3d8bbc[_0x339b('0x42')]&&agents[_0x3d8bbc[_0x339b('0x42')]]){agents[_0x3d8bbc[_0x339b('0x42')]][_0x339b('0x43')]=0x1;transfers[_0x3d8bbc[_0x339b('0x42')]]=_[_0x339b('0x44')](agents[_0x3d8bbc[_0x339b('0x42')]]);transfers[_0x3d8bbc[_0x339b('0x42')]][_0x339b('0x45')]=agents[_0x3d8bbc[_0x339b('0x3e')]][_0x339b('0x45')];transfers[_0x3d8bbc[_0x339b('0x42')]][_0x339b('0x46')]=agents[_0x3d8bbc[_0x339b('0x3e')]]['calleridname'];transfers[_0x3d8bbc['transfereeuniqueid']][_0x339b('0x47')]=utils['now']();transfers[_0x3d8bbc['transfereeuniqueid']][_0x339b('0x2b')]=utils[_0x339b('0x18')]();transfers[_0x3d8bbc[_0x339b('0x42')]][_0x339b('0x20')]=0x0;transfers[_0x3d8bbc[_0x339b('0x42')]][_0x339b('0x43')]=0x2;}}else if(_0x3d8bbc[_0x339b('0x3e')]==_0x3d8bbc['secondtransfererlinkedid']){if(!_[_0x339b('0x30')](agents[_0x3d8bbc[_0x339b('0x3d')]])){utils[_0x339b('0x3')](util[_0x339b('0x16')](_0x339b('0x48'),_0x3d8bbc[_0x339b('0x3d')],agents[_0x3d8bbc['origtransfereruniqueid']][_0x339b('0x8')]));agents[_0x3d8bbc[_0x339b('0x3d')]]['transfer']=!![];agents[_0x3d8bbc[_0x339b('0x3d')]][_0x339b('0x3f')]=_0x339b('0x40');agents[_0x3d8bbc[_0x339b('0x3d')]][_0x339b('0x39')]=_0x3d8bbc[_0x339b('0x49')];agents[_0x3d8bbc[_0x339b('0x3d')]]['transferuniqueid']=_0x3d8bbc[_0x339b('0x3e')];}if(_0x3d8bbc['transfertargetuniqueid']&&agents[_0x3d8bbc['transfertargetuniqueid']]){agents[_0x3d8bbc[_0x339b('0x4a')]][_0x339b('0x43')]=0x1;transfers[_0x3d8bbc[_0x339b('0x4a')]]=_[_0x339b('0x44')](agents[_0x3d8bbc['transfertargetuniqueid']]);transfers[_0x3d8bbc[_0x339b('0x4a')]][_0x339b('0x45')]=agents[_0x3d8bbc[_0x339b('0x3d')]][_0x339b('0x45')];transfers[_0x3d8bbc[_0x339b('0x4a')]][_0x339b('0x46')]=agents[_0x3d8bbc['origtransfereruniqueid']][_0x339b('0x46')];transfers[_0x3d8bbc[_0x339b('0x4a')]]['agentcalledAt']=utils['now']();transfers[_0x3d8bbc[_0x339b('0x4a')]][_0x339b('0x2b')]=utils[_0x339b('0x18')]();transfers[_0x3d8bbc[_0x339b('0x4a')]][_0x339b('0x20')]=0x0;transfers[_0x3d8bbc['transfertargetuniqueid']][_0x339b('0x43')]=0x2;}}}catch(_0x2cfe39){utils['error'](util['format'](_0x339b('0x3c'),_0x3d8bbc['origtransfereruniqueid']),_0x2cfe39);}};exports[_0x339b('0x4b')]=function(_0x200f87){try{utils[_0x339b('0x1c')](util['format'](_0x339b('0x4c'),_0x200f87[_0x339b('0x5')]),_0x200f87);if(agents[_0x200f87[_0x339b('0x5')]]&&agents[_0x200f87[_0x339b('0x5')]][_0x339b('0x1f')]===_0x339b('0x1e')){if(_0x200f87[_0x339b('0x4d')]==='21'){agents[_0x200f87[_0x339b('0x5')]]['reason']=_0x339b('0x4e');agents[_0x200f87[_0x339b('0x5')]][_0x339b('0xb')]=_0x339b('0x4e');}utils['info'](util[_0x339b('0x16')](_0x339b('0x4f'),_0x200f87[_0x339b('0x5')],agents[_0x200f87[_0x339b('0x5')]][_0x339b('0x8')],agents[_0x200f87[_0x339b('0x5')]][_0x339b('0x1f')],agents[_0x200f87[_0x339b('0x5')]][_0x339b('0xb')]));writeDB(agents[_0x200f87[_0x339b('0x5')]]);var _0x54e6c9=unanswered[_0x339b('0x50')](_0x200f87[_0x339b('0x5')]);if(_0x54e6c9>-0x1){unanswered[_0x339b('0x51')](_0x54e6c9,0x1);}}if(transfers[_0x200f87[_0x339b('0x5')]]){transfers[_0x200f87[_0x339b('0x5')]][_0x339b('0x2f')]=!![];transfers[_0x200f87[_0x339b('0x5')]][_0x339b('0x31')]=utils[_0x339b('0x18')]();transfers[_0x200f87[_0x339b('0x5')]]['talktime']=utils[_0x339b('0x32')](transfers[_0x200f87[_0x339b('0x5')]][_0x339b('0x31')],transfers[_0x200f87[_0x339b('0x5')]]['agentconnectAt']);transfers[_0x200f87[_0x339b('0x5')]][_0x339b('0x1f')]='agent';transfers[_0x200f87[_0x339b('0x5')]][_0x339b('0xb')]=_0x339b('0x33');utils['info'](util[_0x339b('0x16')](_0x339b('0x4f'),_0x200f87['uniqueid'],transfers[_0x200f87[_0x339b('0x5')]][_0x339b('0x8')],transfers[_0x200f87[_0x339b('0x5')]][_0x339b('0x1f')],transfers[_0x200f87[_0x339b('0x5')]]['lastevent']));writeDB(transfers[_0x200f87['uniqueid']],!![]);}if(agents[_0x200f87['uniqueid']]&&agents[_0x200f87[_0x339b('0x5')]][_0x339b('0x2b')]){agents[_0x200f87[_0x339b('0x5')]][_0x339b('0x2f')]=!![];agents[_0x200f87[_0x339b('0x5')]][_0x339b('0x31')]=utils[_0x339b('0x18')]();agents[_0x200f87['uniqueid']][_0x339b('0x22')]=utils[_0x339b('0x32')](agents[_0x200f87[_0x339b('0x5')]][_0x339b('0x31')],agents[_0x200f87['uniqueid']][_0x339b('0x2b')]);agents[_0x200f87[_0x339b('0x5')]][_0x339b('0x1f')]=agents[_0x200f87[_0x339b('0x5')]]['transfer']?_0x339b('0x38'):_0x339b('0x52');agents[_0x200f87[_0x339b('0x5')]][_0x339b('0xb')]=_0x339b('0x33');utils[_0x339b('0x3')](util[_0x339b('0x16')](_0x339b('0x4f'),_0x200f87['uniqueid'],agents[_0x200f87[_0x339b('0x5')]]['membername'],agents[_0x200f87[_0x339b('0x5')]][_0x339b('0x1f')],agents[_0x200f87[_0x339b('0x5')]][_0x339b('0xb')]));writeDB(agents[_0x200f87[_0x339b('0x5')]]);}}catch(_0x2b6e96){utils[_0x339b('0x1a')](util['format'](_0x339b('0x4c'),_0x200f87[_0x339b('0x5')]),_0x2b6e96);}}; \ No newline at end of file +var _0x779e=['reason','agentconnect','[%s][agents][agentconnect]','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','agentconnectAt','[%s][agents][agentcomplete]','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','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','channel','membername','interface','calleridnum','connectedlinenum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','push','error','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned'];(function(_0x5591c5,_0x2c5d9d){var _0x364e6b=function(_0x4fb079){while(--_0x4fb079){_0x5591c5['push'](_0x5591c5['shift']());}};_0x364e6b(++_0x2c5d9d);}(_0x779e,0x139));var _0xe779=function(_0x5e2c70,_0x108e64){_0x5e2c70=_0x5e2c70-0x0;var _0x1e6cbc=_0x779e[_0x5e2c70];return _0x1e6cbc;};'use strict';var _=require(_0xe779('0x0'));var util=require(_0xe779('0x1'));var utils=require(_0xe779('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x280fa3,_0xf43e6b){utils[_0xe779('0x3')](util[_0xe779('0x4')](_0xe779('0x5'),_0x280fa3[_0xe779('0x6')],_0x280fa3[_0xe779('0x7')],_0x280fa3['queue'],_0x280fa3[_0xe779('0x8')],_0x280fa3[_0xe779('0x9')],_0x280fa3[_0xe779('0xa')],_0x280fa3[_0xe779('0xb')],_0x280fa3[_0xe779('0xc')]));if(_0x280fa3[_0xe779('0xd')]){utils[_0xe779('0xe')](_0x280fa3[_0xe779('0xd')])[_0xe779('0xf')](function(_0x39d6c8){if(_0x39d6c8){_0x280fa3['type']=_0x39d6c8[_0xe779('0x10')];_0x280fa3[_0xe779('0x11')]=_0x280fa3[_0xe779('0x12')]?_0x39d6c8[_0xe779('0x13')]:![];_0x280fa3[_0xe779('0x14')]=_0x280fa3[_0xe779('0x11')]?_0x39d6c8[_0xe779('0x15')]:0x0;}utils[_0xe779('0x16')](_0xe779('0x17'),_0x280fa3);});}else{utils['request'](_0xe779('0x17'),_0x280fa3);}if(_0xf43e6b){delete transfers[_0x280fa3['uniqueid']];}else{delete agents[_0x280fa3[_0xe779('0x18')]];}}exports[_0xe779('0x19')]=function(_0x4fe9f4){try{utils[_0xe779('0x1a')](util['format'](_0xe779('0x1b'),_0x4fe9f4['uniqueid']),_0x4fe9f4);agents[_0x4fe9f4['destuniqueid']]=_0x4fe9f4;agents[_0x4fe9f4[_0xe779('0x18')]][_0xe779('0x1c')]=utils[_0xe779('0x1d')]();agents[_0x4fe9f4[_0xe779('0x18')]][_0xe779('0xc')]=_0xe779('0x1e');agents[_0x4fe9f4[_0xe779('0x18')]]['connectedlinenum']=null;agents[_0x4fe9f4['destuniqueid']][_0xe779('0x1f')]=null;utils[_0xe779('0x3')](util[_0xe779('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x4fe9f4[_0xe779('0x6')],agents[_0x4fe9f4[_0xe779('0x18')]][_0xe779('0x8')],_0x4fe9f4[_0xe779('0x18')]));}catch(_0x523e67){utils['error'](util['format']('[%s][agents][agentcalled]',_0x4fe9f4['uniqueid']),_0x523e67);}};exports[_0xe779('0x20')]=function(_0x34b5bd){try{if(!_['isNil'](agents[_0x34b5bd['destuniqueid']])){utils[_0xe779('0x1a')](util[_0xe779('0x4')](_0xe779('0x21'),_0x34b5bd[_0xe779('0x6')]),_0x34b5bd);utils[_0xe779('0x3')](util[_0xe779('0x4')](_0xe779('0x22'),_0x34b5bd[_0xe779('0x6')],agents[_0x34b5bd[_0xe779('0x18')]][_0xe779('0x8')],_0x34b5bd[_0xe779('0x18')]));agents[_0x34b5bd[_0xe779('0x18')]][_0xe779('0x20')]=!![];agents[_0x34b5bd[_0xe779('0x18')]][_0xe779('0x23')]=utils[_0xe779('0x1d')]();agents[_0x34b5bd[_0xe779('0x18')]]['lastevent']='timeout';agents[_0x34b5bd[_0xe779('0x18')]]['reason']=_0xe779('0x24');agents[_0x34b5bd[_0xe779('0x18')]][_0xe779('0x25')]=_0x34b5bd[_0xe779('0x26')]?parseInt(_0x34b5bd[_0xe779('0x26')])/0x3e8:0x0;agents[_0x34b5bd['destuniqueid']][_0xe779('0x27')]=0x0;unanswered[_0xe779('0x28')](_0x34b5bd['destuniqueid']);}}catch(_0x4910df){utils[_0xe779('0x29')](util[_0xe779('0x4')](_0xe779('0x21'),_0x34b5bd[_0xe779('0x6')]),_0x4910df);}};exports[_0xe779('0x2a')]=function(_0x51025e){try{_[_0xe779('0x2b')](agents,function(_0x5e6cb3,_0x47fed2){if(_0x5e6cb3[_0xe779('0x6')]==_0x51025e[_0xe779('0x6')]&&!_['includes'](unanswered,_0x5e6cb3[_0xe779('0x18')])){utils[_0xe779('0x1a')](util[_0xe779('0x4')](_0xe779('0x2c'),_0x51025e[_0xe779('0x6')]),_0x51025e);utils[_0xe779('0x3')](util[_0xe779('0x4')](_0xe779('0x2d'),_0x51025e[_0xe779('0x6')],_0x5e6cb3[_0xe779('0x8')],_0x5e6cb3[_0xe779('0x18')]));_0x5e6cb3[_0xe779('0x20')]=!![];_0x5e6cb3[_0xe779('0x23')]=utils[_0xe779('0x1d')]();_0x5e6cb3['lastevent']=_0xe779('0x2e');_0x5e6cb3[_0xe779('0x2f')]=_0xe779('0x2e');_0x5e6cb3[_0xe779('0x25')]=_0x51025e[_0xe779('0x25')];_0x5e6cb3[_0xe779('0x27')]=0x0;writeDB(_0x5e6cb3);}});}catch(_0x1e6de4){utils[_0xe779('0x29')](util['format'](_0xe779('0x2c'),_0x51025e[_0xe779('0x6')]),_0x1e6de4);}};exports[_0xe779('0x30')]=function(_0x390710){try{if(agents[_0x390710[_0xe779('0x18')]]){utils[_0xe779('0x1a')](util[_0xe779('0x4')](_0xe779('0x31'),_0x390710[_0xe779('0x6')]),_0x390710);utils[_0xe779('0x3')](util[_0xe779('0x4')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x390710[_0xe779('0x6')],agents[_0x390710[_0xe779('0x18')]][_0xe779('0x8')],_0x390710[_0xe779('0x18')]));agents[_0x390710['destuniqueid']]['agentconnectAt']=utils[_0xe779('0x1d')]();agents[_0x390710['destuniqueid']]['connectedlinenum']=_0x390710['connectedlinenum'];agents[_0x390710[_0xe779('0x18')]][_0xe779('0x1f')]=_0x390710[_0xe779('0x1f')];agents[_0x390710[_0xe779('0x18')]][_0xe779('0x25')]=_0x390710[_0xe779('0x26')];agents[_0x390710[_0xe779('0x18')]][_0xe779('0xc')]=_0xe779('0x32');_['forIn'](agents,function(_0x56db0e,_0x5ef751){if(_0x56db0e['destuniqueid']!=_0x390710[_0xe779('0x18')]&&_0x56db0e[_0xe779('0x6')]==_0x390710['uniqueid']){_0x56db0e['talktime']=0x0;_0x56db0e['holdtime']=_0x390710[_0xe779('0x26')];_0x56db0e[_0xe779('0x20')]=!![];_0x56db0e[_0xe779('0x23')]=utils['now']();_0x56db0e[_0xe779('0xc')]=_0xe779('0x33');_0x56db0e[_0xe779('0x2f')]=_0xe779('0x33');_0x56db0e[_0xe779('0x34')]=_0x390710[_0xe779('0x18')];_0x56db0e['answeredelsewheremembername']=_0x390710[_0xe779('0x8')];writeDB(_0x56db0e);}});}}catch(_0x37e93e){utils['error'](util['format'](_0xe779('0x31'),_0x390710[_0xe779('0x6')]),_0x37e93e);}};exports[_0xe779('0x12')]=function(_0xf3b21b){try{if(!_[_0xe779('0x35')](agents[_0xf3b21b[_0xe779('0x18')]])){utils[_0xe779('0x1a')](util[_0xe779('0x4')]('[%s][agents][agentcomplete]',_0xf3b21b['uniqueid']),_0xf3b21b);utils[_0xe779('0x3')](util['format'](_0xe779('0x36'),_0xf3b21b[_0xe779('0x6')],agents[_0xf3b21b['destuniqueid']][_0xe779('0x8')],_0xf3b21b[_0xe779('0x18')]));agents[_0xf3b21b[_0xe779('0x18')]][_0xe779('0x12')]=!![];agents[_0xf3b21b[_0xe779('0x18')]][_0xe779('0x37')]=utils['now']();agents[_0xf3b21b[_0xe779('0x18')]][_0xe779('0x27')]=utils['diffTime'](agents[_0xf3b21b[_0xe779('0x18')]]['agentcompleteAt'],agents[_0xf3b21b[_0xe779('0x18')]][_0xe779('0x38')]);agents[_0xf3b21b[_0xe779('0x18')]][_0xe779('0x2f')]=_0xf3b21b[_0xe779('0x2f')];agents[_0xf3b21b[_0xe779('0x18')]][_0xe779('0xc')]='complete';writeDB(agents[_0xf3b21b[_0xe779('0x18')]]);}}catch(_0x58c08d){utils[_0xe779('0x29')](util[_0xe779('0x4')](_0xe779('0x39'),_0xf3b21b[_0xe779('0x6')]),_0x58c08d);}};exports['blindtransfer']=function(_0x17fb86){try{if(!_['isNil'](agents[_0x17fb86[_0xe779('0x3a')]])){utils['debug'](util['format'](_0xe779('0x3b'),_0x17fb86['uniqueid']),_0x17fb86);utils[_0xe779('0x3')](util[_0xe779('0x4')](_0xe779('0x3c'),_0x17fb86[_0xe779('0x6')],agents[_0x17fb86[_0xe779('0x3a')]][_0xe779('0x8')],agents[_0x17fb86[_0xe779('0x3a')]][_0xe779('0x6')]));agents[_0x17fb86[_0xe779('0x3a')]][_0xe779('0x3d')]=!![];agents[_0x17fb86['transfereruniqueid']][_0xe779('0x3e')]=_0xe779('0x3f');agents[_0x17fb86['transfereruniqueid']][_0xe779('0x40')]=_0x17fb86[_0xe779('0x41')];agents[_0x17fb86['transfereruniqueid']][_0xe779('0x42')]=agents[_0x17fb86['transfereruniqueid']][_0xe779('0x6')];}}catch(_0x64722){utils[_0xe779('0x29')](util[_0xe779('0x4')](_0xe779('0x3b'),_0x17fb86[_0xe779('0x6')]),_0x64722);}};exports[_0xe779('0x43')]=function(_0x2d3d86){try{utils[_0xe779('0x1a')](util[_0xe779('0x4')](_0xe779('0x44'),_0x2d3d86[_0xe779('0x45')]),_0x2d3d86);if(_0x2d3d86[_0xe779('0x45')]==_0x2d3d86['origtransfererlinkedid']){if(!_[_0xe779('0x35')](agents[_0x2d3d86['secondtransfereruniqueid']])){utils[_0xe779('0x3')](util[_0xe779('0x4')](_0xe779('0x46'),_0x2d3d86[_0xe779('0x45')],agents[_0x2d3d86['secondtransfereruniqueid']]['membername']));agents[_0x2d3d86[_0xe779('0x47')]][_0xe779('0x3d')]=!![];agents[_0x2d3d86['secondtransfereruniqueid']]['transfertype']=_0xe779('0x48');agents[_0x2d3d86[_0xe779('0x47')]][_0xe779('0x40')]=_0x2d3d86[_0xe779('0x49')];agents[_0x2d3d86['secondtransfereruniqueid']]['transferuniqueid']=_0x2d3d86['origtransfereruniqueid'];}if(_0x2d3d86['transfereeuniqueid']&&agents[_0x2d3d86[_0xe779('0x4a')]]){agents[_0x2d3d86[_0xe779('0x4a')]][_0xe779('0x4b')]=0x1;transfers[_0x2d3d86[_0xe779('0x4a')]]=_[_0xe779('0x4c')](agents[_0x2d3d86[_0xe779('0x4a')]]);transfers[_0x2d3d86[_0xe779('0x4a')]]['calleridnum']=agents[_0x2d3d86[_0xe779('0x47')]][_0xe779('0xa')];transfers[_0x2d3d86[_0xe779('0x4a')]][_0xe779('0x4d')]=agents[_0x2d3d86[_0xe779('0x47')]][_0xe779('0x4d')];transfers[_0x2d3d86[_0xe779('0x4a')]][_0xe779('0x1c')]=utils[_0xe779('0x1d')]();transfers[_0x2d3d86[_0xe779('0x4a')]][_0xe779('0x38')]=utils['now']();transfers[_0x2d3d86[_0xe779('0x4a')]][_0xe779('0x25')]=0x0;transfers[_0x2d3d86['transfereeuniqueid']][_0xe779('0x4b')]=0x2;}}else if(_0x2d3d86[_0xe779('0x47')]==_0x2d3d86[_0xe779('0x4e')]){if(!_[_0xe779('0x35')](agents[_0x2d3d86['origtransfereruniqueid']])){utils['info'](util[_0xe779('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x2d3d86[_0xe779('0x45')],agents[_0x2d3d86[_0xe779('0x45')]]['membername']));agents[_0x2d3d86['origtransfereruniqueid']][_0xe779('0x3d')]=!![];agents[_0x2d3d86['origtransfereruniqueid']]['transfertype']=_0xe779('0x48');agents[_0x2d3d86[_0xe779('0x45')]][_0xe779('0x40')]=_0x2d3d86[_0xe779('0x4f')];agents[_0x2d3d86[_0xe779('0x45')]][_0xe779('0x42')]=_0x2d3d86[_0xe779('0x47')];}if(_0x2d3d86['transfertargetuniqueid']&&agents[_0x2d3d86[_0xe779('0x50')]]){agents[_0x2d3d86[_0xe779('0x50')]][_0xe779('0x4b')]=0x1;transfers[_0x2d3d86[_0xe779('0x50')]]=_[_0xe779('0x4c')](agents[_0x2d3d86[_0xe779('0x50')]]);transfers[_0x2d3d86[_0xe779('0x50')]][_0xe779('0xa')]=agents[_0x2d3d86['origtransfereruniqueid']][_0xe779('0xa')];transfers[_0x2d3d86[_0xe779('0x50')]][_0xe779('0x4d')]=agents[_0x2d3d86[_0xe779('0x45')]][_0xe779('0x4d')];transfers[_0x2d3d86['transfertargetuniqueid']][_0xe779('0x1c')]=utils['now']();transfers[_0x2d3d86[_0xe779('0x50')]][_0xe779('0x38')]=utils[_0xe779('0x1d')]();transfers[_0x2d3d86[_0xe779('0x50')]]['holdtime']=0x0;transfers[_0x2d3d86[_0xe779('0x50')]][_0xe779('0x4b')]=0x2;}}}catch(_0x51b160){utils[_0xe779('0x29')](util[_0xe779('0x4')](_0xe779('0x44'),_0x2d3d86[_0xe779('0x45')]),_0x51b160);}};exports[_0xe779('0x51')]=function(_0x525994){try{utils[_0xe779('0x1a')](util[_0xe779('0x4')](_0xe779('0x52'),_0x525994[_0xe779('0x6')]),_0x525994);if(agents[_0x525994['uniqueid']]&&agents[_0x525994['uniqueid']][_0xe779('0x2f')]===_0xe779('0x24')){if(_0x525994['cause']==='21'){agents[_0x525994[_0xe779('0x6')]][_0xe779('0x2f')]=_0xe779('0x53');agents[_0x525994['uniqueid']][_0xe779('0xc')]=_0xe779('0x53');}utils[_0xe779('0x3')](util[_0xe779('0x4')](_0xe779('0x54'),_0x525994[_0xe779('0x6')],agents[_0x525994[_0xe779('0x6')]][_0xe779('0x8')],agents[_0x525994[_0xe779('0x6')]][_0xe779('0x2f')],agents[_0x525994[_0xe779('0x6')]][_0xe779('0xc')]));writeDB(agents[_0x525994['uniqueid']]);var _0x9dbd5=unanswered[_0xe779('0x55')](_0x525994[_0xe779('0x6')]);if(_0x9dbd5>-0x1){unanswered[_0xe779('0x56')](_0x9dbd5,0x1);}}if(transfers[_0x525994[_0xe779('0x6')]]){transfers[_0x525994[_0xe779('0x6')]][_0xe779('0x12')]=!![];transfers[_0x525994[_0xe779('0x6')]][_0xe779('0x37')]=utils[_0xe779('0x1d')]();transfers[_0x525994[_0xe779('0x6')]]['talktime']=utils[_0xe779('0x57')](transfers[_0x525994[_0xe779('0x6')]][_0xe779('0x37')],transfers[_0x525994[_0xe779('0x6')]][_0xe779('0x38')]);transfers[_0x525994[_0xe779('0x6')]][_0xe779('0x2f')]=_0xe779('0x58');transfers[_0x525994['uniqueid']][_0xe779('0xc')]=_0xe779('0x59');utils[_0xe779('0x3')](util[_0xe779('0x4')](_0xe779('0x54'),_0x525994['uniqueid'],transfers[_0x525994[_0xe779('0x6')]][_0xe779('0x8')],transfers[_0x525994[_0xe779('0x6')]]['reason'],transfers[_0x525994[_0xe779('0x6')]][_0xe779('0xc')]));writeDB(transfers[_0x525994[_0xe779('0x6')]],!![]);}if(agents[_0x525994[_0xe779('0x6')]]&&agents[_0x525994[_0xe779('0x6')]]['agentconnectAt']){agents[_0x525994['uniqueid']][_0xe779('0x12')]=!![];agents[_0x525994[_0xe779('0x6')]]['agentcompleteAt']=utils[_0xe779('0x1d')]();agents[_0x525994[_0xe779('0x6')]]['talktime']=utils[_0xe779('0x57')](agents[_0x525994[_0xe779('0x6')]][_0xe779('0x37')],agents[_0x525994[_0xe779('0x6')]][_0xe779('0x38')]);agents[_0x525994[_0xe779('0x6')]]['reason']=agents[_0x525994[_0xe779('0x6')]][_0xe779('0x3d')]?_0xe779('0x3d'):'agent';agents[_0x525994['uniqueid']][_0xe779('0xc')]=_0xe779('0x59');utils[_0xe779('0x3')](util[_0xe779('0x4')](_0xe779('0x54'),_0x525994[_0xe779('0x6')],agents[_0x525994[_0xe779('0x6')]]['membername'],agents[_0x525994[_0xe779('0x6')]]['reason'],agents[_0x525994[_0xe779('0x6')]][_0xe779('0xc')]));writeDB(agents[_0x525994['uniqueid']]);}}catch(_0xe2cbd2){utils['error'](util['format']('[%s][agents][hangup]',_0x525994['uniqueid']),_0xe2cbd2);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index adf6090..1ca78ef 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 _0xe578=['FAILED','ANSWERED','BUSY','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','getUserByInternal','accountcode','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','context','systemanswertime','transfer','destinationchannel','disposition','toNumber','[%s][calls][hangup]','callerid','info','cause-txt','duration','diffTime','starttime','billableseconds','answertime','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','variable','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmcs-queue','xmd-queue','lastapplication','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','includes','hangup','noop','gotoif','lodash','util','./utils','NO\x20ANSWER'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xe578,0x1a4));var _0x8e57=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe578[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x8e57('0x0'));var util=require(_0x8e57('0x1'));var utils=require(_0x8e57('0x2'));var dispositions=[_0x8e57('0x3'),_0x8e57('0x4'),_0x8e57('0x4'),_0x8e57('0x3'),_0x8e57('0x3'),_0x8e57('0x3'),_0x8e57('0x5'),_0x8e57('0x6'),'FAILED','FAILED',_0x8e57('0x4')];var channels={};function writeDB(_0x30a379){utils['info'](util[_0x8e57('0x7')](_0x8e57('0x8'),_0x30a379[_0x8e57('0x9')],_0x30a379[_0x8e57('0xa')],_0x30a379[_0x8e57('0xb')],_0x30a379[_0x8e57('0xc')],_0x30a379[_0x8e57('0xd')],_0x30a379[_0x8e57('0xe')],_0x30a379['connectedlinenum'],_0x30a379['lastevent']));if(_0x30a379['accountcode']){utils[_0x8e57('0xf')](_0x30a379[_0x8e57('0x10')])[_0x8e57('0x11')](function(_0x170bdd){if(_0x170bdd){_0x30a379[_0x8e57('0x12')]=_0x170bdd['id'];}utils[_0x8e57('0x13')](_0x8e57('0x14'),_0x30a379);});}else{utils['request']('CreateVoiceCallReport',_0x30a379);}if(channels[_0x30a379[_0x8e57('0x9')]]){delete channels[_0x30a379[_0x8e57('0x9')]];}}exports[_0x8e57('0x15')]=function(_0x323238){try{utils[_0x8e57('0x16')](util[_0x8e57('0x7')](_0x8e57('0x17'),_0x323238[_0x8e57('0x9')]),_0x323238);if(_0x323238[_0x8e57('0x9')]==_0x323238[_0x8e57('0x18')]&&_0x323238[_0x8e57('0xa')]!=_0x8e57('0x19')){utils['info'](util[_0x8e57('0x7')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x323238[_0x8e57('0x9')],_0x323238['context'],_0x323238['exten']));channels[_0x323238[_0x8e57('0x9')]]={'uniqueid':_0x323238[_0x8e57('0x9')],'accountcode':_0x323238['accountcode'],'source':_0x323238[_0x8e57('0xe')],'destination':_0x323238[_0x8e57('0x1a')],'destinationcontext':_0x323238['context'],'channel':_0x323238[_0x8e57('0xa')],'starttime':utils[_0x8e57('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x8e57('0x3'),'amaflags':_0x8e57('0x1c')};}}catch(_0x3993d7){utils[_0x8e57('0x1d')](util[_0x8e57('0x7')](_0x8e57('0x17'),_0x323238[_0x8e57('0x9')]),_0x3993d7);}};exports[_0x8e57('0x1e')]=function(_0x257695){try{utils[_0x8e57('0x16')](util[_0x8e57('0x7')](_0x8e57('0x1f'),_0x257695[_0x8e57('0x9')]),_0x257695);if(!_[_0x8e57('0x20')](channels[_0x257695['uniqueid']])&&_0x257695[_0x8e57('0x21')]==0x6){utils['info'](util[_0x8e57('0x7')](_0x8e57('0x22'),_0x257695[_0x8e57('0x9')],_0x257695[_0x8e57('0x23')],_0x257695[_0x8e57('0xa')]));if(_[_0x8e57('0x20')](channels[_0x257695['uniqueid']][_0x8e57('0x24')])){channels[_0x257695['uniqueid']]['systemanswertime']=utils['now']();}}else if(!_[_0x8e57('0x20')](channels[_0x257695[_0x8e57('0x18')]])&&_0x257695['channelstate']==0x6&&_0x257695['context']!=_0x8e57('0x25')){utils['info'](util[_0x8e57('0x7')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x257695[_0x8e57('0x9')],_0x257695[_0x8e57('0x18')],_0x257695[_0x8e57('0x23')],_0x257695['channel']));channels[_0x257695[_0x8e57('0x18')]][_0x8e57('0x10')]=_0x257695['accountcode'];channels[_0x257695['linkedid']][_0x8e57('0x26')]=_0x257695[_0x8e57('0xa')];if(_[_0x8e57('0x20')](channels[_0x257695[_0x8e57('0x18')]]['answertime'])){channels[_0x257695[_0x8e57('0x18')]]['answertime']=utils[_0x8e57('0x1b')]();}channels[_0x257695[_0x8e57('0x18')]][_0x8e57('0x27')]=dispositions[_[_0x8e57('0x28')](_0x257695['channelstate'])]||'ANSWERED';}}catch(_0xfa55b2){utils[_0x8e57('0x1d')](util['format']('[%s][calls][newstate]',_0x257695[_0x8e57('0x9')]),_0xfa55b2);}};exports['hangup']=function(_0x3d840d){try{if(!_[_0x8e57('0x20')](channels[_0x3d840d[_0x8e57('0x9')]])){utils[_0x8e57('0x16')](util[_0x8e57('0x7')](_0x8e57('0x29'),_0x3d840d[_0x8e57('0x9')]),_0x3d840d);if(_['isNil'](channels[_0x3d840d[_0x8e57('0x9')]][_0x8e57('0x2a')])){channels[_0x3d840d[_0x8e57('0x9')]][_0x8e57('0x2a')]=_0x3d840d['calleridname']+'\x20<'+_0x3d840d[_0x8e57('0xe')]+'>';}utils[_0x8e57('0x2b')](util[_0x8e57('0x7')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x3d840d['uniqueid'],channels[_0x3d840d[_0x8e57('0x9')]][_0x8e57('0x2a')],_0x3d840d[_0x8e57('0x2c')]));channels[_0x3d840d['uniqueid']]['endtime']=utils[_0x8e57('0x1b')]();channels[_0x3d840d[_0x8e57('0x9')]][_0x8e57('0x2d')]=utils[_0x8e57('0x2e')](channels[_0x3d840d['uniqueid']]['endtime'],channels[_0x3d840d['uniqueid']][_0x8e57('0x2f')]);channels[_0x3d840d[_0x8e57('0x9')]][_0x8e57('0x30')]=channels[_0x3d840d[_0x8e57('0x9')]]['answertime']?utils['diffTime'](channels[_0x3d840d[_0x8e57('0x9')]]['endtime'],channels[_0x3d840d[_0x8e57('0x9')]][_0x8e57('0x31')]):0x0;writeDB(channels[_0x3d840d[_0x8e57('0x9')]]);}}catch(_0x10ca25){utils[_0x8e57('0x1d')](util[_0x8e57('0x7')]('[%s][calls][hangup]',_0x3d840d[_0x8e57('0x9')]),_0x10ca25);}};exports['attendedtransfer']=function(_0x3435bb){try{if(!_[_0x8e57('0x20')](channels[_0x3435bb[_0x8e57('0x32')]])){utils[_0x8e57('0x16')](util[_0x8e57('0x7')](_0x8e57('0x33'),_0x3435bb[_0x8e57('0x34')]),_0x3435bb);if(channels[_0x3435bb[_0x8e57('0x32')]][_0x8e57('0xa')]==_0x3435bb[_0x8e57('0x35')]){utils[_0x8e57('0x2b')](util[_0x8e57('0x7')](_0x8e57('0x36'),_0x3435bb[_0x8e57('0x34')],_0x3435bb[_0x8e57('0x32')],_0x3435bb['secondtransfererchannel']));channels[_0x3435bb[_0x8e57('0x32')]]['destinationchannel']=_0x3435bb[_0x8e57('0x37')];channels[_0x3435bb[_0x8e57('0x32')]]['userfield']=_0x8e57('0x38');}else if(channels[_0x3435bb[_0x8e57('0x32')]]['channel']=_0x3435bb[_0x8e57('0x39')]){utils[_0x8e57('0x2b')](util[_0x8e57('0x7')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x3435bb[_0x8e57('0x34')],_0x3435bb[_0x8e57('0x32')],_0x3435bb['origtransfererchannel']));channels[_0x3435bb[_0x8e57('0x32')]][_0x8e57('0x26')]=_0x3435bb['origtransfererchannel'];channels[_0x3435bb[_0x8e57('0x32')]][_0x8e57('0x3a')]='_attended';}}}catch(_0x198369){utils['error'](util[_0x8e57('0x7')](_0x8e57('0x33'),_0x3435bb[_0x8e57('0x34')]),_0x198369);}};exports[_0x8e57('0x3b')]=function(_0x2d20be){try{if(!_['isNil'](channels[_0x2d20be[_0x8e57('0x9')]])){utils[_0x8e57('0x16')](util[_0x8e57('0x7')](_0x8e57('0x3c'),_0x2d20be[_0x8e57('0x9')]),_0x2d20be);channels[_0x2d20be[_0x8e57('0x9')]][_0x8e57('0x3d')]=utils[_0x8e57('0x1b')]();utils[_0x8e57('0x2b')](util[_0x8e57('0x7')](_0x8e57('0x3e'),_0x2d20be[_0x8e57('0x9')],channels[_0x2d20be[_0x8e57('0x9')]][_0x8e57('0x3d')]));}}catch(_0x5e4d1b){utils[_0x8e57('0x1d')](util[_0x8e57('0x7')](_0x8e57('0x3c'),_0x2d20be['uniqueid']),_0x5e4d1b);}};exports[_0x8e57('0x3f')]=function(_0x1acd3a){try{if(!_[_0x8e57('0x20')](channels[_0x1acd3a[_0x8e57('0x9')]])){utils['debug'](util['format'](_0x8e57('0x40'),_0x1acd3a[_0x8e57('0x9')]),_0x1acd3a);if(!_[_0x8e57('0x20')](channels[_0x1acd3a[_0x8e57('0x9')]][_0x8e57('0x3d')])){channels[_0x1acd3a['uniqueid']][_0x8e57('0x41')]+=utils[_0x8e57('0x2e')](utils[_0x8e57('0x1b')](),channels[_0x1acd3a[_0x8e57('0x9')]][_0x8e57('0x3d')]);utils[_0x8e57('0x2b')](util['format'](_0x8e57('0x42'),_0x1acd3a[_0x8e57('0x9')],channels[_0x1acd3a[_0x8e57('0x9')]]['mohtime']));delete channels[_0x1acd3a[_0x8e57('0x9')]][_0x8e57('0x3d')];}}}catch(_0x45cfcb){utils['error'](util[_0x8e57('0x7')](_0x8e57('0x40'),_0x1acd3a[_0x8e57('0x9')]),_0x45cfcb);}};exports[_0x8e57('0x43')]=function(_0x2bb06e){try{if(!_['isNil'](channels[_0x2bb06e['uniqueid']])){utils[_0x8e57('0x16')](util[_0x8e57('0x7')](_0x8e57('0x44'),_0x2bb06e['uniqueid']),_0x2bb06e);if(!_[_0x8e57('0x20')](_0x2bb06e['variable'][_0x8e57('0x45')])){utils['info'](util[_0x8e57('0x7')](_0x8e57('0x46'),_0x2bb06e[_0x8e57('0x9')],_0x2bb06e[_0x8e57('0x47')]));channels[_0x2bb06e['uniqueid']]['source']=_0x2bb06e[_0x8e57('0x47')];}if(!_[_0x8e57('0x20')](_0x2bb06e['variable'][_0x8e57('0x48')])){utils[_0x8e57('0x2b')](util[_0x8e57('0x7')](_0x8e57('0x49'),_0x2bb06e[_0x8e57('0x9')],_0x2bb06e[_0x8e57('0x47')]));channels[_0x2bb06e[_0x8e57('0x9')]]['destination']=_0x2bb06e[_0x8e57('0x47')];channels[_0x2bb06e[_0x8e57('0x9')]][_0x8e57('0x2a')]='\x22'+_0x2bb06e[_0x8e57('0x47')]+_0x8e57('0x4a')+_0x2bb06e[_0x8e57('0x47')]+'>';}if(!_[_0x8e57('0x20')](_0x2bb06e[_0x8e57('0x4b')][_0x8e57('0x4c')])||!_[_0x8e57('0x20')](_0x2bb06e[_0x8e57('0x4b')]['xmd-callerid'])){utils[_0x8e57('0x2b')](util[_0x8e57('0x7')](_0x8e57('0x4d'),_0x2bb06e[_0x8e57('0x9')],!_[_0x8e57('0x20')](_0x2bb06e[_0x8e57('0x4b')][_0x8e57('0x4c')])?_0x8e57('0x4c'):_0x8e57('0x4e'),_0x2bb06e['value']));channels[_0x2bb06e[_0x8e57('0x9')]]['callerid']=_0x2bb06e[_0x8e57('0x47')];}if(!_['isNil'](_0x2bb06e[_0x8e57('0x4b')]['xmd-queue'])||!_[_0x8e57('0x20')](_0x2bb06e[_0x8e57('0x4b')][_0x8e57('0x4f')])){utils[_0x8e57('0x2b')](util[_0x8e57('0x7')](_0x8e57('0x4d'),_0x2bb06e[_0x8e57('0x9')],!_['isNil'](_0x2bb06e['variable'][_0x8e57('0x50')])?_0x8e57('0x50'):_0x8e57('0x4f'),_0x2bb06e[_0x8e57('0x47')]));channels[_0x2bb06e[_0x8e57('0x9')]][_0x8e57('0x51')]='Queue';channels[_0x2bb06e[_0x8e57('0x9')]][_0x8e57('0x52')]=_0x2bb06e[_0x8e57('0x47')];channels[_0x2bb06e['uniqueid']][_0x8e57('0xb')]=!![];}if(!_[_0x8e57('0x20')](_0x2bb06e[_0x8e57('0x4b')]['xmd-contactid'])){utils[_0x8e57('0x2b')](util[_0x8e57('0x7')](_0x8e57('0x53'),_0x2bb06e['uniqueid'],_0x2bb06e[_0x8e57('0x47')]));channels[_0x2bb06e[_0x8e57('0x9')]]['ContactId']=_0x2bb06e[_0x8e57('0x47')];}if(!_[_0x8e57('0x20')](_0x2bb06e['variable'][_0x8e57('0x54')])){utils[_0x8e57('0x2b')](util[_0x8e57('0x7')](_0x8e57('0x55'),_0x2bb06e[_0x8e57('0x9')],_0x2bb06e[_0x8e57('0x47')]));channels[_0x2bb06e[_0x8e57('0x9')]][_0x8e57('0x56')]=_0x2bb06e[_0x8e57('0x47')];}if(!_['isNil'](_0x2bb06e[_0x8e57('0x4b')][_0x8e57('0x57')])){utils[_0x8e57('0x2b')](util[_0x8e57('0x7')](_0x8e57('0x58'),_0x2bb06e[_0x8e57('0x9')],_0x2bb06e[_0x8e57('0x47')]));channels[_0x2bb06e[_0x8e57('0x9')]][_0x8e57('0x59')]=_0x2bb06e[_0x8e57('0x47')];}if(!_[_0x8e57('0x20')](_0x2bb06e['variable'][_0x8e57('0x5a')])){utils['info'](util['format'](_0x8e57('0x5b'),_0x2bb06e[_0x8e57('0x9')],_0x2bb06e[_0x8e57('0x47')]));channels[_0x2bb06e[_0x8e57('0x9')]]['sipcallid']=_0x2bb06e[_0x8e57('0x47')];}}}catch(_0x5b0631){utils[_0x8e57('0x1d')](util['format'](_0x8e57('0x44'),_0x2bb06e[_0x8e57('0x9')]),_0x5b0631);}};exports[_0x8e57('0x5c')]=function(_0x910fc){try{if(!_[_0x8e57('0x20')](channels[_0x910fc[_0x8e57('0x9')]])){utils[_0x8e57('0x16')](util[_0x8e57('0x7')](_0x8e57('0x5d'),_0x910fc[_0x8e57('0x9')]),_0x910fc);utils[_0x8e57('0x2b')](util[_0x8e57('0x7')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x910fc[_0x8e57('0x9')],_0x910fc[_0x8e57('0x5e')],_0x910fc[_0x8e57('0x5f')]));if(_0x910fc['application'][_0x8e57('0x60')]()==_0x8e57('0x61')&&_[_0x8e57('0x62')](_0x910fc['appdata'][_0x8e57('0x60')](),'cdr')){var _0x3496d9=_0x910fc[_0x8e57('0x5f')][_0x8e57('0x63')]('=');var _0x1799d6=_0x3496d9[0x0][_0x8e57('0x64')](_0x3496d9[0x0][_0x8e57('0x65')]('(')+0x1,_0x3496d9[0x0][_0x8e57('0x65')](')'));var _0x448ec6=_0x3496d9[0x1];channels[_0x910fc['uniqueid']][_0x1799d6]=_0x448ec6;}if(!_[_0x8e57('0x66')]([_0x8e57('0x67'),_0x8e57('0x68'),'execif',_0x8e57('0x61'),_0x8e57('0x69')],_0x910fc[_0x8e57('0x5e')][_0x8e57('0x60')]())){channels[_0x910fc[_0x8e57('0x9')]][_0x8e57('0x51')]=_0x910fc['application'];channels[_0x910fc['uniqueid']]['lastdata']=_0x910fc[_0x8e57('0x5f')];}}}catch(_0x3d9de8){utils[_0x8e57('0x1d')](util[_0x8e57('0x7')](_0x8e57('0x5d'),_0x910fc['uniqueid']),_0x3d9de8);}}; \ No newline at end of file +var _0x3f7f=['split','substring','lastIndexOf','noop','execif','gotoif','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','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','newstate','isNil','channelstate','systemanswertime','linkedid','transfer','answertime','error','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','duration','diffTime','endtime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','transfertargetchannel','origtransfererchannel','_attended','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith'];(function(_0x20374e,_0x2b77c3){var _0x1bf892=function(_0x17bc4c){while(--_0x17bc4c){_0x20374e['push'](_0x20374e['shift']());}};_0x1bf892(++_0x2b77c3);}(_0x3f7f,0x6f));var _0xf3f7=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x3f7f[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0xf3f7('0x0'));var utils=require(_0xf3f7('0x1'));var dispositions=[_0xf3f7('0x2'),'FAILED',_0xf3f7('0x3'),_0xf3f7('0x2'),_0xf3f7('0x2'),'NO\x20ANSWER',_0xf3f7('0x4'),_0xf3f7('0x5'),_0xf3f7('0x3'),_0xf3f7('0x3'),_0xf3f7('0x3')];var channels={};function writeDB(_0x516818){utils[_0xf3f7('0x6')](util[_0xf3f7('0x7')](_0xf3f7('0x8'),_0x516818[_0xf3f7('0x9')],_0x516818[_0xf3f7('0xa')],_0x516818[_0xf3f7('0xb')],_0x516818['membername'],_0x516818['interface'],_0x516818[_0xf3f7('0xc')],_0x516818[_0xf3f7('0xd')],_0x516818[_0xf3f7('0xe')]));if(_0x516818[_0xf3f7('0xf')]){utils[_0xf3f7('0x10')](_0x516818[_0xf3f7('0xf')])[_0xf3f7('0x11')](function(_0x51339b){if(_0x51339b){_0x516818[_0xf3f7('0x12')]=_0x51339b['id'];}utils[_0xf3f7('0x13')](_0xf3f7('0x14'),_0x516818);});}else{utils['request'](_0xf3f7('0x14'),_0x516818);}if(channels[_0x516818['uniqueid']]){delete channels[_0x516818[_0xf3f7('0x9')]];}}exports[_0xf3f7('0x15')]=function(_0x439337){try{utils[_0xf3f7('0x16')](util['format'](_0xf3f7('0x17'),_0x439337[_0xf3f7('0x9')]),_0x439337);if(_0x439337[_0xf3f7('0x9')]==_0x439337['linkedid']&&_0x439337[_0xf3f7('0xa')]!=_0xf3f7('0x18')){utils[_0xf3f7('0x6')](util['format'](_0xf3f7('0x19'),_0x439337['uniqueid'],_0x439337[_0xf3f7('0x1a')],_0x439337[_0xf3f7('0x1b')]));channels[_0x439337['uniqueid']]={'uniqueid':_0x439337[_0xf3f7('0x9')],'accountcode':_0x439337[_0xf3f7('0xf')],'source':_0x439337[_0xf3f7('0xc')],'destination':_0x439337[_0xf3f7('0x1b')],'destinationcontext':_0x439337[_0xf3f7('0x1a')],'channel':_0x439337[_0xf3f7('0xa')],'starttime':utils[_0xf3f7('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xf3f7('0x1d')};}}catch(_0x5382d3){utils['error'](util[_0xf3f7('0x7')](_0xf3f7('0x17'),_0x439337[_0xf3f7('0x9')]),_0x5382d3);}};exports[_0xf3f7('0x1e')]=function(_0x1e609b){try{utils[_0xf3f7('0x16')](util[_0xf3f7('0x7')]('[%s][calls][newstate]',_0x1e609b[_0xf3f7('0x9')]),_0x1e609b);if(!_[_0xf3f7('0x1f')](channels[_0x1e609b[_0xf3f7('0x9')]])&&_0x1e609b[_0xf3f7('0x20')]==0x6){utils[_0xf3f7('0x6')](util[_0xf3f7('0x7')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x1e609b[_0xf3f7('0x9')],_0x1e609b[_0xf3f7('0x1a')],_0x1e609b[_0xf3f7('0xa')]));if(_[_0xf3f7('0x1f')](channels[_0x1e609b[_0xf3f7('0x9')]]['systemanswertime'])){channels[_0x1e609b[_0xf3f7('0x9')]][_0xf3f7('0x21')]=utils['now']();}}else if(!_[_0xf3f7('0x1f')](channels[_0x1e609b[_0xf3f7('0x22')]])&&_0x1e609b['channelstate']==0x6&&_0x1e609b[_0xf3f7('0x1a')]!=_0xf3f7('0x23')){utils[_0xf3f7('0x6')](util[_0xf3f7('0x7')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1e609b[_0xf3f7('0x9')],_0x1e609b[_0xf3f7('0x22')],_0x1e609b[_0xf3f7('0x1a')],_0x1e609b[_0xf3f7('0xa')]));channels[_0x1e609b[_0xf3f7('0x22')]][_0xf3f7('0xf')]=_0x1e609b[_0xf3f7('0xf')];channels[_0x1e609b[_0xf3f7('0x22')]]['destinationchannel']=_0x1e609b['channel'];if(_[_0xf3f7('0x1f')](channels[_0x1e609b[_0xf3f7('0x22')]]['answertime'])){channels[_0x1e609b[_0xf3f7('0x22')]][_0xf3f7('0x24')]=utils[_0xf3f7('0x1c')]();}channels[_0x1e609b[_0xf3f7('0x22')]]['disposition']=dispositions[_['toNumber'](_0x1e609b['channelstate'])]||_0xf3f7('0x4');}}catch(_0x132a85){utils[_0xf3f7('0x25')](util[_0xf3f7('0x7')]('[%s][calls][newstate]',_0x1e609b['uniqueid']),_0x132a85);}};exports[_0xf3f7('0x26')]=function(_0x4a969b){try{if(!_['isNil'](channels[_0x4a969b[_0xf3f7('0x9')]])){utils['debug'](util[_0xf3f7('0x7')](_0xf3f7('0x27'),_0x4a969b[_0xf3f7('0x9')]),_0x4a969b);if(_[_0xf3f7('0x1f')](channels[_0x4a969b['uniqueid']][_0xf3f7('0x28')])){channels[_0x4a969b['uniqueid']][_0xf3f7('0x28')]=_0x4a969b['calleridname']+'\x20<'+_0x4a969b[_0xf3f7('0xc')]+'>';}utils['info'](util[_0xf3f7('0x7')](_0xf3f7('0x29'),_0x4a969b[_0xf3f7('0x9')],channels[_0x4a969b['uniqueid']][_0xf3f7('0x28')],_0x4a969b['cause-txt']));channels[_0x4a969b[_0xf3f7('0x9')]]['endtime']=utils['now']();channels[_0x4a969b[_0xf3f7('0x9')]][_0xf3f7('0x2a')]=utils[_0xf3f7('0x2b')](channels[_0x4a969b[_0xf3f7('0x9')]][_0xf3f7('0x2c')],channels[_0x4a969b[_0xf3f7('0x9')]]['starttime']);channels[_0x4a969b[_0xf3f7('0x9')]][_0xf3f7('0x2d')]=channels[_0x4a969b['uniqueid']][_0xf3f7('0x24')]?utils[_0xf3f7('0x2b')](channels[_0x4a969b[_0xf3f7('0x9')]][_0xf3f7('0x2c')],channels[_0x4a969b[_0xf3f7('0x9')]][_0xf3f7('0x24')]):0x0;writeDB(channels[_0x4a969b[_0xf3f7('0x9')]]);}}catch(_0x55bfc5){utils[_0xf3f7('0x25')](util[_0xf3f7('0x7')](_0xf3f7('0x27'),_0x4a969b[_0xf3f7('0x9')]),_0x55bfc5);}};exports[_0xf3f7('0x2e')]=function(_0x148c88){try{if(!_[_0xf3f7('0x1f')](channels[_0x148c88[_0xf3f7('0x2f')]])){utils[_0xf3f7('0x16')](util[_0xf3f7('0x7')](_0xf3f7('0x30'),_0x148c88[_0xf3f7('0x31')]),_0x148c88);if(channels[_0x148c88[_0xf3f7('0x2f')]][_0xf3f7('0xa')]==_0x148c88['transfereechannel']){utils[_0xf3f7('0x6')](util[_0xf3f7('0x7')](_0xf3f7('0x32'),_0x148c88[_0xf3f7('0x31')],_0x148c88[_0xf3f7('0x2f')],_0x148c88[_0xf3f7('0x33')]));channels[_0x148c88[_0xf3f7('0x2f')]][_0xf3f7('0x34')]=_0x148c88['secondtransfererchannel'];channels[_0x148c88[_0xf3f7('0x2f')]][_0xf3f7('0x35')]='_attended';}else if(channels[_0x148c88[_0xf3f7('0x2f')]][_0xf3f7('0xa')]=_0x148c88[_0xf3f7('0x36')]){utils[_0xf3f7('0x6')](util['format'](_0xf3f7('0x32'),_0x148c88[_0xf3f7('0x31')],_0x148c88[_0xf3f7('0x2f')],_0x148c88[_0xf3f7('0x37')]));channels[_0x148c88[_0xf3f7('0x2f')]][_0xf3f7('0x34')]=_0x148c88['origtransfererchannel'];channels[_0x148c88['localtwolinkedid']][_0xf3f7('0x35')]=_0xf3f7('0x38');}}}catch(_0x598b92){utils[_0xf3f7('0x25')](util[_0xf3f7('0x7')](_0xf3f7('0x30'),_0x148c88[_0xf3f7('0x31')]),_0x598b92);}};exports[_0xf3f7('0x39')]=function(_0x38acb2){try{if(!_[_0xf3f7('0x1f')](channels[_0x38acb2[_0xf3f7('0x9')]])){utils[_0xf3f7('0x16')](util['format']('[%s][calls][musiconholdstart]',_0x38acb2[_0xf3f7('0x9')]),_0x38acb2);channels[_0x38acb2[_0xf3f7('0x9')]][_0xf3f7('0x3a')]=utils[_0xf3f7('0x1c')]();utils[_0xf3f7('0x6')](util[_0xf3f7('0x7')](_0xf3f7('0x3b'),_0x38acb2['uniqueid'],channels[_0x38acb2[_0xf3f7('0x9')]][_0xf3f7('0x3a')]));}}catch(_0x4911e8){utils['error'](util[_0xf3f7('0x7')](_0xf3f7('0x3c'),_0x38acb2[_0xf3f7('0x9')]),_0x4911e8);}};exports[_0xf3f7('0x3d')]=function(_0x182dda){try{if(!_[_0xf3f7('0x1f')](channels[_0x182dda[_0xf3f7('0x9')]])){utils['debug'](util[_0xf3f7('0x7')](_0xf3f7('0x3e'),_0x182dda[_0xf3f7('0x9')]),_0x182dda);if(!_[_0xf3f7('0x1f')](channels[_0x182dda[_0xf3f7('0x9')]]['musiconholdstartAt'])){channels[_0x182dda[_0xf3f7('0x9')]][_0xf3f7('0x3f')]+=utils[_0xf3f7('0x2b')](utils[_0xf3f7('0x1c')](),channels[_0x182dda[_0xf3f7('0x9')]]['musiconholdstartAt']);utils['info'](util['format'](_0xf3f7('0x40'),_0x182dda[_0xf3f7('0x9')],channels[_0x182dda[_0xf3f7('0x9')]][_0xf3f7('0x3f')]));delete channels[_0x182dda[_0xf3f7('0x9')]][_0xf3f7('0x3a')];}}}catch(_0x3255e2){utils['error'](util['format'](_0xf3f7('0x3e'),_0x182dda[_0xf3f7('0x9')]),_0x3255e2);}};exports[_0xf3f7('0x41')]=function(_0x581e63){try{if(!_[_0xf3f7('0x1f')](channels[_0x581e63['uniqueid']])){utils[_0xf3f7('0x16')](util[_0xf3f7('0x7')](_0xf3f7('0x42'),_0x581e63[_0xf3f7('0x9')]),_0x581e63);if(!_[_0xf3f7('0x1f')](_0x581e63['variable'][_0xf3f7('0x43')])){utils[_0xf3f7('0x6')](util['format'](_0xf3f7('0x44'),_0x581e63[_0xf3f7('0x9')],_0x581e63['value']));channels[_0x581e63[_0xf3f7('0x9')]][_0xf3f7('0x45')]=_0x581e63[_0xf3f7('0x46')];}if(!_[_0xf3f7('0x1f')](_0x581e63[_0xf3f7('0x47')]['xmd-phone'])){utils[_0xf3f7('0x6')](util['format'](_0xf3f7('0x48'),_0x581e63[_0xf3f7('0x9')],_0x581e63['value']));channels[_0x581e63[_0xf3f7('0x9')]]['destination']=_0x581e63['value'];channels[_0x581e63['uniqueid']]['callerid']='\x22'+_0x581e63[_0xf3f7('0x46')]+_0xf3f7('0x49')+_0x581e63['value']+'>';}if(!_[_0xf3f7('0x1f')](_0x581e63['variable'][_0xf3f7('0x4a')])||!_[_0xf3f7('0x1f')](_0x581e63[_0xf3f7('0x47')][_0xf3f7('0x4b')])){utils[_0xf3f7('0x6')](util[_0xf3f7('0x7')](_0xf3f7('0x4c'),_0x581e63[_0xf3f7('0x9')],!_['isNil'](_0x581e63[_0xf3f7('0x47')][_0xf3f7('0x4a')])?_0xf3f7('0x4a'):'xmd-callerid',_0x581e63['value']));channels[_0x581e63['uniqueid']][_0xf3f7('0x28')]=_0x581e63[_0xf3f7('0x46')];}if(!_['isNil'](_0x581e63[_0xf3f7('0x47')][_0xf3f7('0x4d')])||!_[_0xf3f7('0x1f')](_0x581e63[_0xf3f7('0x47')][_0xf3f7('0x4e')])){utils[_0xf3f7('0x6')](util[_0xf3f7('0x7')](_0xf3f7('0x4c'),_0x581e63[_0xf3f7('0x9')],!_[_0xf3f7('0x1f')](_0x581e63[_0xf3f7('0x47')][_0xf3f7('0x4d')])?_0xf3f7('0x4d'):_0xf3f7('0x4e'),_0x581e63[_0xf3f7('0x46')]));channels[_0x581e63['uniqueid']][_0xf3f7('0x4f')]=_0xf3f7('0x50');channels[_0x581e63[_0xf3f7('0x9')]]['lastdata']=_0x581e63[_0xf3f7('0x46')];channels[_0x581e63[_0xf3f7('0x9')]][_0xf3f7('0xb')]=!![];}if(!_['isNil'](_0x581e63[_0xf3f7('0x47')][_0xf3f7('0x51')])){utils[_0xf3f7('0x6')](util[_0xf3f7('0x7')](_0xf3f7('0x52'),_0x581e63[_0xf3f7('0x9')],_0x581e63[_0xf3f7('0x46')]));channels[_0x581e63[_0xf3f7('0x9')]][_0xf3f7('0x53')]=_0x581e63[_0xf3f7('0x46')];}if(!_[_0xf3f7('0x1f')](_0x581e63[_0xf3f7('0x47')]['xmd-cdrtype'])){utils[_0xf3f7('0x6')](util[_0xf3f7('0x7')](_0xf3f7('0x54'),_0x581e63[_0xf3f7('0x9')],_0x581e63[_0xf3f7('0x46')]));channels[_0x581e63[_0xf3f7('0x9')]][_0xf3f7('0x55')]=_0x581e63['value'];}if(!_['isNil'](_0x581e63[_0xf3f7('0x47')][_0xf3f7('0x56')])){utils[_0xf3f7('0x6')](util['format'](_0xf3f7('0x57'),_0x581e63['uniqueid'],_0x581e63['value']));channels[_0x581e63[_0xf3f7('0x9')]][_0xf3f7('0x58')]=_0x581e63[_0xf3f7('0x46')];}if(!_[_0xf3f7('0x1f')](_0x581e63[_0xf3f7('0x47')][_0xf3f7('0x59')])){utils[_0xf3f7('0x6')](util[_0xf3f7('0x7')](_0xf3f7('0x5a'),_0x581e63[_0xf3f7('0x9')],_0x581e63[_0xf3f7('0x46')]));channels[_0x581e63['uniqueid']][_0xf3f7('0x59')]=_0x581e63[_0xf3f7('0x46')];}}}catch(_0x123c43){utils[_0xf3f7('0x25')](util['format'](_0xf3f7('0x42'),_0x581e63[_0xf3f7('0x9')]),_0x123c43);}};exports[_0xf3f7('0x5b')]=function(_0x15f999){try{if(!_['isNil'](channels[_0x15f999[_0xf3f7('0x9')]])){utils['debug'](util[_0xf3f7('0x7')](_0xf3f7('0x5c'),_0x15f999[_0xf3f7('0x9')]),_0x15f999);utils[_0xf3f7('0x6')](util['format'](_0xf3f7('0x5d'),_0x15f999[_0xf3f7('0x9')],_0x15f999['application'],_0x15f999[_0xf3f7('0x5e')]));if(_0x15f999[_0xf3f7('0x5f')][_0xf3f7('0x60')]()==_0xf3f7('0x61')&&_[_0xf3f7('0x62')](_0x15f999['appdata'][_0xf3f7('0x60')](),'cdr')){var _0x32c1fd=_0x15f999[_0xf3f7('0x5e')][_0xf3f7('0x63')]('=');var _0x4259fe=_0x32c1fd[0x0][_0xf3f7('0x64')](_0x32c1fd[0x0][_0xf3f7('0x65')]('(')+0x1,_0x32c1fd[0x0][_0xf3f7('0x65')](')'));var _0x7df168=_0x32c1fd[0x1];channels[_0x15f999['uniqueid']][_0x4259fe]=_0x7df168;}if(!_['includes']([_0xf3f7('0x26'),_0xf3f7('0x66'),_0xf3f7('0x67'),_0xf3f7('0x61'),_0xf3f7('0x68')],_0x15f999[_0xf3f7('0x5f')][_0xf3f7('0x60')]())){channels[_0x15f999[_0xf3f7('0x9')]][_0xf3f7('0x4f')]=_0x15f999['application'];channels[_0x15f999[_0xf3f7('0x9')]]['lastdata']=_0x15f999['appdata'];}}}catch(_0x3d8529){utils['error'](util[_0xf3f7('0x7')](_0xf3f7('0x5c'),_0x15f999[_0xf3f7('0x9')]),_0x3d8529);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 077b28d..0738a6b 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 _0x4790=['fullybooted','error','close','managerevent','./utils','connect','info','shutdown','[core]\x20shutdown'];(function(_0x2cf63a,_0x15d7ae){var _0x21cd67=function(_0x66d99f){while(--_0x66d99f){_0x2cf63a['push'](_0x2cf63a['shift']());}};_0x21cd67(++_0x15d7ae);}(_0x4790,0x1ab));var _0x0479=function(_0x500812,_0x296a3c){_0x500812=_0x500812-0x0;var _0x4add02=_0x4790[_0x500812];return _0x4add02;};'use strict';var utils=require(_0x0479('0x0'));exports[_0x0479('0x1')]=function(){utils[_0x0479('0x2')]('[core]\x20connected');};exports[_0x0479('0x3')]=function(){utils['info'](_0x0479('0x4'));};exports[_0x0479('0x5')]=function(){utils[_0x0479('0x2')]('[core]\x20fullybooted');};exports[_0x0479('0x6')]=function(_0x10423e){utils[_0x0479('0x6')]('[core]\x20error',_0x10423e);};exports[_0x0479('0x7')]=function(){utils[_0x0479('0x2')]('[core]\x20close');};exports[_0x0479('0x8')]=function(_0x13b150){}; \ No newline at end of file +var _0xfd47=['fullybooted','error','[core]\x20error','close','./utils','connect','info','[core]\x20connected','shutdown'];(function(_0xc2dcd8,_0x69768){var _0x53f809=function(_0x24f6fb){while(--_0x24f6fb){_0xc2dcd8['push'](_0xc2dcd8['shift']());}};_0x53f809(++_0x69768);}(_0xfd47,0x163));var _0x7fd4=function(_0xba746d,_0x11216c){_0xba746d=_0xba746d-0x0;var _0x5b136a=_0xfd47[_0xba746d];return _0x5b136a;};'use strict';var utils=require(_0x7fd4('0x0'));exports[_0x7fd4('0x1')]=function(){utils[_0x7fd4('0x2')](_0x7fd4('0x3'));};exports[_0x7fd4('0x4')]=function(){utils['info']('[core]\x20shutdown');};exports[_0x7fd4('0x5')]=function(){utils[_0x7fd4('0x2')]('[core]\x20fullybooted');};exports['error']=function(_0x43d5d3){utils[_0x7fd4('0x6')](_0x7fd4('0x7'),_0x43d5d3);};exports[_0x7fd4('0x8')]=function(){utils[_0x7fd4('0x2')]('[core]\x20close');};exports['managerevent']=function(_0x3f1f9b){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 4187202..aefefb5 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 _0xb0f1=['./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','isNil','debug','[%s][dials][dialbegin]','starttime','now','called','dialend','[%s][dials][dialend]','ANSWER','assign','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','duration','diffTime','holdtime','endtime','billableseconds','util'];(function(_0x5807cf,_0x49db95){var _0x2cb538=function(_0x23de11){while(--_0x23de11){_0x5807cf['push'](_0x5807cf['shift']());}};_0x2cb538(++_0x49db95);}(_0xb0f1,0x15d));var _0x1b0f=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xb0f1[_0x34bc30];return _0x5706de;};'use strict';var _=require('lodash');var util=require(_0x1b0f('0x0'));var utils=require(_0x1b0f('0x1'));var dials={};function writeDB(_0x209363){utils[_0x1b0f('0x2')](util[_0x1b0f('0x3')](_0x1b0f('0x4'),_0x209363[_0x1b0f('0x5')],_0x209363[_0x1b0f('0x6')],_0x209363[_0x1b0f('0x7')],_0x209363[_0x1b0f('0x8')],_0x209363[_0x1b0f('0x9')],_0x209363[_0x1b0f('0xa')]));utils['request'](_0x1b0f('0xb'),_0x209363);delete dials[_0x209363[_0x1b0f('0x5')]];}exports['newexten']=function(_0x15c697){try{utils['debug'](util['format'](_0x1b0f('0xc'),_0x15c697[_0x1b0f('0x5')]),_0x15c697);utils['info'](util[_0x1b0f('0x3')](_0x1b0f('0xd'),_0x15c697[_0x1b0f('0x5')],_0x15c697[_0x1b0f('0xe')],_0x15c697[_0x1b0f('0xf')]));if(_0x15c697[_0x1b0f('0xe')][_0x1b0f('0x10')]()=='set'&&_[_0x1b0f('0x11')](_0x15c697[_0x1b0f('0xf')][_0x1b0f('0x10')](),_0x1b0f('0x12'))){var _0x21207f=_0x15c697[_0x1b0f('0xf')][_0x1b0f('0x13')]('=');dials[_0x15c697['uniqueid']]={'routeId':_0x21207f[0x1]};}}catch(_0x4f253e){utils[_0x1b0f('0x14')](util[_0x1b0f('0x3')]('[%s][dials][newexten]',_0x15c697['uniqueid']),_0x4f253e);}};exports[_0x1b0f('0x15')]=function(_0x11c5b6){try{utils['debug'](util['format'](_0x1b0f('0x16'),_0x11c5b6['uniqueid']),_0x11c5b6);if(!_['isNil'](_0x11c5b6['variable']['outboundrouteid'])){utils[_0x1b0f('0x2')](util[_0x1b0f('0x3')](_0x1b0f('0x17'),_0x11c5b6['uniqueid'],_0x11c5b6[_0x1b0f('0x18')]));dials[_0x11c5b6['uniqueid']]={'routeId':_0x11c5b6['value']};}}catch(_0x2c8df7){utils['error'](util[_0x1b0f('0x3')](_0x1b0f('0x16'),_0x11c5b6[_0x1b0f('0x5')]),_0x2c8df7);}};exports[_0x1b0f('0x19')]=function(_0x1156bb){try{if(!_[_0x1b0f('0x1a')](dials[_0x1156bb['uniqueid']])){utils[_0x1b0f('0x1b')](util[_0x1b0f('0x3')](_0x1b0f('0x1c'),_0x1156bb['uniqueid']),_0x1156bb);dials[_0x1156bb[_0x1b0f('0x5')]]=_['assign'](dials[_0x1156bb[_0x1b0f('0x5')]],_0x1156bb);dials[_0x1156bb[_0x1b0f('0x5')]][_0x1b0f('0x1d')]=utils[_0x1b0f('0x1e')]();dials[_0x1156bb[_0x1b0f('0x5')]]['lastevent']=_0x1b0f('0x1f');utils[_0x1b0f('0x2')](util[_0x1b0f('0x3')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x1156bb[_0x1b0f('0x5')],dials[_0x1156bb['uniqueid']]['starttime']));}}catch(_0x53a098){utils[_0x1b0f('0x14')](util[_0x1b0f('0x3')](_0x1b0f('0x1c'),_0x1156bb[_0x1b0f('0x5')]),_0x53a098);}};exports[_0x1b0f('0x20')]=function(_0x460854){try{if(!_[_0x1b0f('0x1a')](dials[_0x460854['uniqueid']])){utils['debug'](util['format'](_0x1b0f('0x21'),_0x460854[_0x1b0f('0x5')]),_0x460854);dials[_0x460854[_0x1b0f('0x5')]][_0x1b0f('0xa')]=_0x460854['dialstatus'];if(_0x460854[_0x1b0f('0xa')]==_0x1b0f('0x22')){dials[_0x460854[_0x1b0f('0x5')]]=_[_0x1b0f('0x23')](dials[_0x460854[_0x1b0f('0x5')]],_0x460854);dials[_0x460854['uniqueid']][_0x1b0f('0x24')]=utils[_0x1b0f('0x1e')]();dials[_0x460854[_0x1b0f('0x5')]][_0x1b0f('0x25')]=_0x1b0f('0x26');utils[_0x1b0f('0x2')](util[_0x1b0f('0x3')](_0x1b0f('0x27'),_0x460854[_0x1b0f('0x5')],_0x460854[_0x1b0f('0xa')],dials[_0x460854[_0x1b0f('0x5')]][_0x1b0f('0x24')]));}else{utils[_0x1b0f('0x2')](util[_0x1b0f('0x3')](_0x1b0f('0x28'),_0x460854[_0x1b0f('0x5')],_0x460854[_0x1b0f('0xa')]));}}}catch(_0x157f39){utils[_0x1b0f('0x14')](util[_0x1b0f('0x3')](_0x1b0f('0x21'),_0x460854[_0x1b0f('0x5')]),_0x157f39);}};exports[_0x1b0f('0x29')]=function(_0x3675f3){try{if(!_['isNil'](dials[_0x3675f3[_0x1b0f('0x5')]])){utils[_0x1b0f('0x1b')](util[_0x1b0f('0x3')](_0x1b0f('0x2a'),_0x3675f3[_0x1b0f('0x5')]),_0x3675f3);utils['info'](util[_0x1b0f('0x3')](_0x1b0f('0x2b'),_0x3675f3[_0x1b0f('0x5')],_0x3675f3[_0x1b0f('0x8')],_0x3675f3[_0x1b0f('0x2c')],_0x3675f3['cause-txt']));dials[_0x3675f3['uniqueid']]=_['assign'](dials[_0x3675f3[_0x1b0f('0x5')]],{'endtime':utils[_0x1b0f('0x1e')](),'lastevent':'complete'});dials[_0x3675f3[_0x1b0f('0x5')]][_0x1b0f('0x2d')]=utils[_0x1b0f('0x2e')](dials[_0x3675f3['uniqueid']]['endtime'],dials[_0x3675f3['uniqueid']]['starttime']);dials[_0x3675f3[_0x1b0f('0x5')]][_0x1b0f('0x2f')]=utils[_0x1b0f('0x2e')](dials[_0x3675f3['uniqueid']][_0x1b0f('0x24')]||dials[_0x3675f3[_0x1b0f('0x5')]][_0x1b0f('0x30')],dials[_0x3675f3[_0x1b0f('0x5')]][_0x1b0f('0x1d')]);dials[_0x3675f3['uniqueid']][_0x1b0f('0x31')]=dials[_0x3675f3[_0x1b0f('0x5')]]['answertime']?utils[_0x1b0f('0x2e')](dials[_0x3675f3['uniqueid']][_0x1b0f('0x30')],dials[_0x3675f3['uniqueid']][_0x1b0f('0x24')]):0x0;writeDB(dials[_0x3675f3['uniqueid']]);}}catch(_0x2dca07){utils[_0x1b0f('0x14')](util[_0x1b0f('0x3')]('[%s][dials][hangup]',_0x3675f3[_0x1b0f('0x5')]),_0x2dca07);}}; \ No newline at end of file +var _0x2652=['connectedlinenum','dialstatus','CreateVoiceDialReport','debug','[%s][dials][newexten]','application','appdata','toLowerCase','set','cdr(routeid)','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','dialbegin','isNil','[%s][dials][dialbegin]','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','error','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','assign','complete','diffTime','endtime','billableseconds','lodash','util','./utils','info','format','uniqueid','channel','dialstring','calleridnum'];(function(_0x15cdcb,_0x4340e9){var _0x37b069=function(_0x304cfb){while(--_0x304cfb){_0x15cdcb['push'](_0x15cdcb['shift']());}};_0x37b069(++_0x4340e9);}(_0x2652,0x1f1));var _0x2265=function(_0x25cccc,_0x2e29a3){_0x25cccc=_0x25cccc-0x0;var _0x7a856=_0x2652[_0x25cccc];return _0x7a856;};'use strict';var _=require(_0x2265('0x0'));var util=require(_0x2265('0x1'));var utils=require(_0x2265('0x2'));var dials={};function writeDB(_0xfcb6d5){utils[_0x2265('0x3')](util[_0x2265('0x4')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0xfcb6d5[_0x2265('0x5')],_0xfcb6d5[_0x2265('0x6')],_0xfcb6d5[_0x2265('0x7')],_0xfcb6d5[_0x2265('0x8')],_0xfcb6d5[_0x2265('0x9')],_0xfcb6d5[_0x2265('0xa')]));utils['request'](_0x2265('0xb'),_0xfcb6d5);delete dials[_0xfcb6d5[_0x2265('0x5')]];}exports['newexten']=function(_0x46c647){try{utils[_0x2265('0xc')](util[_0x2265('0x4')](_0x2265('0xd'),_0x46c647[_0x2265('0x5')]),_0x46c647);utils['info'](util[_0x2265('0x4')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x46c647[_0x2265('0x5')],_0x46c647[_0x2265('0xe')],_0x46c647[_0x2265('0xf')]));if(_0x46c647[_0x2265('0xe')][_0x2265('0x10')]()==_0x2265('0x11')&&_['startsWith'](_0x46c647[_0x2265('0xf')]['toLowerCase'](),_0x2265('0x12'))){var _0xa0ca61=_0x46c647[_0x2265('0xf')]['split']('=');dials[_0x46c647[_0x2265('0x5')]]={'routeId':_0xa0ca61[0x1]};}}catch(_0x4b90e7){utils['error'](util[_0x2265('0x4')](_0x2265('0xd'),_0x46c647[_0x2265('0x5')]),_0x4b90e7);}};exports['varset']=function(_0x141fcb){try{utils[_0x2265('0xc')](util[_0x2265('0x4')](_0x2265('0x13'),_0x141fcb[_0x2265('0x5')]),_0x141fcb);if(!_['isNil'](_0x141fcb[_0x2265('0x14')][_0x2265('0x15')])){utils[_0x2265('0x3')](util[_0x2265('0x4')](_0x2265('0x16'),_0x141fcb[_0x2265('0x5')],_0x141fcb['value']));dials[_0x141fcb[_0x2265('0x5')]]={'routeId':_0x141fcb['value']};}}catch(_0x417185){utils['error'](util['format'](_0x2265('0x13'),_0x141fcb[_0x2265('0x5')]),_0x417185);}};exports[_0x2265('0x17')]=function(_0x29ad34){try{if(!_[_0x2265('0x18')](dials[_0x29ad34[_0x2265('0x5')]])){utils['debug'](util['format'](_0x2265('0x19'),_0x29ad34[_0x2265('0x5')]),_0x29ad34);dials[_0x29ad34['uniqueid']]=_['assign'](dials[_0x29ad34[_0x2265('0x5')]],_0x29ad34);dials[_0x29ad34[_0x2265('0x5')]][_0x2265('0x1a')]=utils[_0x2265('0x1b')]();dials[_0x29ad34[_0x2265('0x5')]][_0x2265('0x1c')]=_0x2265('0x1d');utils[_0x2265('0x3')](util['format'](_0x2265('0x1e'),_0x29ad34[_0x2265('0x5')],dials[_0x29ad34[_0x2265('0x5')]][_0x2265('0x1a')]));}}catch(_0x5265f8){utils[_0x2265('0x1f')](util[_0x2265('0x4')](_0x2265('0x19'),_0x29ad34[_0x2265('0x5')]),_0x5265f8);}};exports['dialend']=function(_0x3f37fc){try{if(!_[_0x2265('0x18')](dials[_0x3f37fc[_0x2265('0x5')]])){utils[_0x2265('0xc')](util[_0x2265('0x4')](_0x2265('0x20'),_0x3f37fc['uniqueid']),_0x3f37fc);dials[_0x3f37fc['uniqueid']][_0x2265('0xa')]=_0x3f37fc['dialstatus'];if(_0x3f37fc[_0x2265('0xa')]==_0x2265('0x21')){dials[_0x3f37fc['uniqueid']]=_['assign'](dials[_0x3f37fc['uniqueid']],_0x3f37fc);dials[_0x3f37fc['uniqueid']][_0x2265('0x22')]=utils['now']();dials[_0x3f37fc[_0x2265('0x5')]][_0x2265('0x1c')]=_0x2265('0x23');utils['info'](util[_0x2265('0x4')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x3f37fc[_0x2265('0x5')],_0x3f37fc[_0x2265('0xa')],dials[_0x3f37fc['uniqueid']][_0x2265('0x22')]));}else{utils[_0x2265('0x3')](util['format'](_0x2265('0x24'),_0x3f37fc[_0x2265('0x5')],_0x3f37fc[_0x2265('0xa')]));}}}catch(_0x2e6cc3){utils[_0x2265('0x1f')](util[_0x2265('0x4')](_0x2265('0x20'),_0x3f37fc[_0x2265('0x5')]),_0x2e6cc3);}};exports[_0x2265('0x25')]=function(_0x265842){try{if(!_[_0x2265('0x18')](dials[_0x265842['uniqueid']])){utils[_0x2265('0xc')](util['format']('[%s][dials][hangup]',_0x265842[_0x2265('0x5')]),_0x265842);utils[_0x2265('0x3')](util[_0x2265('0x4')](_0x2265('0x26'),_0x265842['uniqueid'],_0x265842[_0x2265('0x8')],_0x265842[_0x2265('0x27')],_0x265842[_0x2265('0x28')]));dials[_0x265842['uniqueid']]=_[_0x2265('0x29')](dials[_0x265842[_0x2265('0x5')]],{'endtime':utils[_0x2265('0x1b')](),'lastevent':_0x2265('0x2a')});dials[_0x265842[_0x2265('0x5')]]['duration']=utils[_0x2265('0x2b')](dials[_0x265842[_0x2265('0x5')]][_0x2265('0x2c')],dials[_0x265842[_0x2265('0x5')]]['starttime']);dials[_0x265842['uniqueid']]['holdtime']=utils[_0x2265('0x2b')](dials[_0x265842[_0x2265('0x5')]][_0x2265('0x22')]||dials[_0x265842[_0x2265('0x5')]][_0x2265('0x2c')],dials[_0x265842[_0x2265('0x5')]]['starttime']);dials[_0x265842['uniqueid']][_0x2265('0x2d')]=dials[_0x265842['uniqueid']]['answertime']?utils[_0x2265('0x2b')](dials[_0x265842[_0x2265('0x5')]][_0x2265('0x2c')],dials[_0x265842[_0x2265('0x5')]]['answertime']):0x0;writeDB(dials[_0x265842[_0x2265('0x5')]]);}}catch(_0x215250){utils[_0x2265('0x1f')](util[_0x2265('0x4')]('[%s][dials][hangup]',_0x265842[_0x2265('0x5')]),_0x215250);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 6e6ec16..6a649d5 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 _0xd561=['musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','origtransfereruniqueid','varset','newexten','newchannel','[%s][index][newchannel]','dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','asterisk','port','password','keepConnected','xdr','info','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','debug','uniqueid','agentcalled','[%s][index][agentcalled]','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave'];(function(_0x2c0ded,_0x3de22c){var _0x4473e5=function(_0x3705bc){while(--_0x3705bc){_0x2c0ded['push'](_0x2c0ded['shift']());}};_0x4473e5(++_0x3de22c);}(_0xd561,0x155));var _0x1d56=function(_0x145621,_0x1c4ec0){_0x145621=_0x145621-0x0;var _0x4cee99=_0xd561[_0x145621];return _0x4cee99;};var AsteriskManager=require('asterisk-manager');var config=require(_0x1d56('0x0'));var utils=require(_0x1d56('0x1'));var util=require(_0x1d56('0x2'));var ami=new AsteriskManager(config[_0x1d56('0x3')][_0x1d56('0x4')],config['asterisk']['ip'],config[_0x1d56('0x3')]['username'],config['asterisk'][_0x1d56('0x5')],!![]);ami[_0x1d56('0x6')]();if(config[_0x1d56('0x7')]&&config[_0x1d56('0x7')]['disabled']){utils[_0x1d56('0x8')]('XDR\x20DISABLED');}else{var agents=require(_0x1d56('0x9'));var calls=require(_0x1d56('0xa'));var queues=require(_0x1d56('0xb'));var recordings=require(_0x1d56('0xc'));var members=require(_0x1d56('0xd'));var dials=require(_0x1d56('0xe'));var transfers=require(_0x1d56('0xf'));var core=require(_0x1d56('0x10'));ami['on']('connect',core[_0x1d56('0x11')]);ami['on']('shutdown',core[_0x1d56('0x12')]);ami['on'](_0x1d56('0x13'),core[_0x1d56('0x13')]);ami['on'](_0x1d56('0x14'),core[_0x1d56('0x14')]);ami['on'](_0x1d56('0x15'),core[_0x1d56('0x15')]);ami['on'](_0x1d56('0x16'),core['managerevent']);ami['on'](_0x1d56('0x17'),function(_0x2d4cfb){try{utils['debug'](util[_0x1d56('0x18')](_0x1d56('0x19'),_0x2d4cfb[_0x1d56('0x1a')]),_0x2d4cfb);members[_0x1d56('0x17')](_0x2d4cfb);}catch(_0xbed72b){utils[_0x1d56('0x14')](util[_0x1d56('0x18')]('[%s][index][devicestatechange]',_0x2d4cfb[_0x1d56('0x1a')]),_0xbed72b);}});ami['on']('agentcalled',function(_0x331a95){try{utils[_0x1d56('0x1b')](util[_0x1d56('0x18')]('[%s][index][agentcalled]',_0x331a95[_0x1d56('0x1c')]),_0x331a95);agents[_0x1d56('0x1d')](_0x331a95);}catch(_0x142eb2){utils[_0x1d56('0x14')](util[_0x1d56('0x18')](_0x1d56('0x1e'),_0x331a95['uniqueid']),_0x142eb2);}});ami['on']('agentringnoanswer',function(_0xaf242d){try{utils[_0x1d56('0x1b')](util[_0x1d56('0x18')](_0x1d56('0x1f'),_0xaf242d[_0x1d56('0x1c')]),_0xaf242d);agents[_0x1d56('0x20')](_0xaf242d);}catch(_0x29a2af){utils[_0x1d56('0x14')](util['format'](_0x1d56('0x1f'),_0xaf242d[_0x1d56('0x1c')]),_0x29a2af);}});ami['on'](_0x1d56('0x21'),function(_0x46df2d){try{utils[_0x1d56('0x1b')](util[_0x1d56('0x18')](_0x1d56('0x22'),_0x46df2d[_0x1d56('0x1c')]),_0x46df2d);agents[_0x1d56('0x21')](_0x46df2d);queues[_0x1d56('0x21')](_0x46df2d);}catch(_0x2d4baa){utils[_0x1d56('0x14')](util[_0x1d56('0x18')]('[%s][index][agentconnect]',_0x46df2d[_0x1d56('0x1c')]),_0x2d4baa);}});ami['on']('agentcomplete',function(_0x9a91f1){try{utils[_0x1d56('0x1b')](util['format'](_0x1d56('0x23'),_0x9a91f1[_0x1d56('0x1c')]),_0x9a91f1);agents[_0x1d56('0x24')](_0x9a91f1);queues[_0x1d56('0x24')](_0x9a91f1);members[_0x1d56('0x24')](_0x9a91f1);}catch(_0x181fc1){utils[_0x1d56('0x14')](util[_0x1d56('0x18')]('[%s][index][agentcomplete]',_0x9a91f1[_0x1d56('0x1c')]),_0x181fc1);}});ami['on']('queuecallerabandon',function(_0x11b79a){try{utils['debug'](util[_0x1d56('0x18')](_0x1d56('0x25'),_0x11b79a[_0x1d56('0x1c')]),_0x11b79a);agents[_0x1d56('0x26')](_0x11b79a);queues[_0x1d56('0x26')](_0x11b79a);}catch(_0x32b8fe){utils[_0x1d56('0x14')](util['format'](_0x1d56('0x25'),_0x11b79a[_0x1d56('0x1c')]),_0x32b8fe);}});ami['on'](_0x1d56('0x27'),function(_0x1aa565){try{utils[_0x1d56('0x1b')](util['format'](_0x1d56('0x28'),_0x1aa565[_0x1d56('0x1c')]),_0x1aa565);queues[_0x1d56('0x27')](_0x1aa565);recordings['queuecallerjoin'](_0x1aa565);}catch(_0x5c37f0){utils[_0x1d56('0x14')](util[_0x1d56('0x18')](_0x1d56('0x28'),_0x1aa565[_0x1d56('0x1c')]),_0x5c37f0);}});ami['on']('queuecallerleave',function(_0x185b9b){try{utils[_0x1d56('0x1b')](util[_0x1d56('0x18')](_0x1d56('0x29'),_0x185b9b['uniqueid']),_0x185b9b);queues[_0x1d56('0x2a')](_0x185b9b);}catch(_0x1a0da5){utils[_0x1d56('0x14')](util['format'](_0x1d56('0x29'),_0x185b9b[_0x1d56('0x1c')]),_0x1a0da5);}});ami['on'](_0x1d56('0x2b'),function(_0x870a23){try{utils['debug'](util[_0x1d56('0x18')](_0x1d56('0x2c'),_0x870a23[_0x1d56('0x1c')]),_0x870a23);queues[_0x1d56('0x2b')](_0x870a23);calls[_0x1d56('0x2b')](_0x870a23);}catch(_0x17ed4a){utils[_0x1d56('0x14')](util[_0x1d56('0x18')](_0x1d56('0x2c'),_0x870a23['uniqueid']),_0x17ed4a);}});ami['on'](_0x1d56('0x2d'),function(_0x373929){try{utils[_0x1d56('0x1b')](util[_0x1d56('0x18')](_0x1d56('0x2e'),_0x373929[_0x1d56('0x1c')]),_0x373929);queues[_0x1d56('0x2d')](_0x373929);calls[_0x1d56('0x2d')](_0x373929);}catch(_0x1dce53){utils[_0x1d56('0x14')](util['format'](_0x1d56('0x2e'),_0x373929['uniqueid']),_0x1dce53);}});ami['on']('newstate',function(_0x3a5f67){try{utils['debug'](util[_0x1d56('0x18')](_0x1d56('0x2f'),_0x3a5f67[_0x1d56('0x1c')]),_0x3a5f67);calls[_0x1d56('0x30')](_0x3a5f67);recordings[_0x1d56('0x30')](_0x3a5f67);}catch(_0x486688){utils[_0x1d56('0x14')](util[_0x1d56('0x18')](_0x1d56('0x2f'),_0x3a5f67['uniqueid']),_0x486688);}});ami['on']('hangup',function(_0x5b4c7f){try{utils['debug'](util[_0x1d56('0x18')](_0x1d56('0x31'),_0x5b4c7f[_0x1d56('0x1c')]),_0x5b4c7f);calls['hangup'](_0x5b4c7f);recordings[_0x1d56('0x32')](_0x5b4c7f);dials[_0x1d56('0x32')](_0x5b4c7f);agents[_0x1d56('0x32')](_0x5b4c7f);queues[_0x1d56('0x32')](_0x5b4c7f);}catch(_0x2f6faa){utils[_0x1d56('0x14')](util[_0x1d56('0x18')](_0x1d56('0x31'),_0x5b4c7f[_0x1d56('0x1c')]),_0x2f6faa);}});ami['on'](_0x1d56('0x33'),function(_0x5e1faa){try{utils['debug'](util[_0x1d56('0x18')](_0x1d56('0x34'),_0x5e1faa[_0x1d56('0x1c')]),_0x5e1faa);members['cdr'](_0x5e1faa);}catch(_0x4e6729){utils[_0x1d56('0x14')](util[_0x1d56('0x18')](_0x1d56('0x34'),_0x5e1faa[_0x1d56('0x1c')]),_0x4e6729);}});ami['on']('blindtransfer',function(_0x39df12){try{utils['debug'](util[_0x1d56('0x18')](_0x1d56('0x35'),_0x39df12[_0x1d56('0x1c')]),_0x39df12);queues[_0x1d56('0x36')](_0x39df12);agents['blindtransfer'](_0x39df12);transfers['blindtransfer'](_0x39df12);}catch(_0x344fe6){utils[_0x1d56('0x14')](util[_0x1d56('0x18')](_0x1d56('0x35'),_0x39df12[_0x1d56('0x1c')]),_0x344fe6);}});ami['on'](_0x1d56('0x37'),function(_0x2cfd97){try{utils[_0x1d56('0x1b')](util[_0x1d56('0x18')]('[%s][index][attendedtransfer]',_0x2cfd97[_0x1d56('0x38')]),_0x2cfd97);queues['attendedtransfer'](_0x2cfd97);transfers[_0x1d56('0x37')](_0x2cfd97);agents[_0x1d56('0x37')](_0x2cfd97);calls['attendedtransfer'](_0x2cfd97);}catch(_0x1973f4){utils['error'](util[_0x1d56('0x18')]('[%s][index][attendedtransfer]',_0x2cfd97[_0x1d56('0x38')]),_0x1973f4);}});ami['on'](_0x1d56('0x39'),function(_0xd06ba3){try{utils[_0x1d56('0x1b')](util[_0x1d56('0x18')]('[%s][index][varset]',_0xd06ba3[_0x1d56('0x1c')]),_0xd06ba3);queues[_0x1d56('0x39')](_0xd06ba3);recordings[_0x1d56('0x39')](_0xd06ba3);calls[_0x1d56('0x39')](_0xd06ba3);dials[_0x1d56('0x39')](_0xd06ba3);}catch(_0x3d5cd7){utils[_0x1d56('0x14')](util['format']('[%s][index][varset]',_0xd06ba3[_0x1d56('0x1c')]),_0x3d5cd7);}});ami['on'](_0x1d56('0x3a'),function(_0x5d85d4){try{utils['debug'](util[_0x1d56('0x18')]('[%s][index][newexten]',_0x5d85d4[_0x1d56('0x1c')]),_0x5d85d4);calls[_0x1d56('0x3a')](_0x5d85d4);recordings[_0x1d56('0x3a')](_0x5d85d4);dials['newexten'](_0x5d85d4);}catch(_0x3b837b){utils['error'](util[_0x1d56('0x18')]('[%s][index][newexten]',_0x5d85d4[_0x1d56('0x1c')]),_0x3b837b);}});ami['on'](_0x1d56('0x3b'),function(_0x58b2bc){try{utils[_0x1d56('0x1b')](util[_0x1d56('0x18')](_0x1d56('0x3c'),_0x58b2bc[_0x1d56('0x1c')]),_0x58b2bc);calls[_0x1d56('0x3b')](_0x58b2bc);recordings['newchannel'](_0x58b2bc);}catch(_0xb66be9){utils['error'](util[_0x1d56('0x18')](_0x1d56('0x3c'),_0x58b2bc[_0x1d56('0x1c')]),_0xb66be9);}});ami['on'](_0x1d56('0x3d'),function(_0x379eb8){try{utils[_0x1d56('0x1b')](util[_0x1d56('0x18')]('[%s][index][dialbegin]',_0x379eb8[_0x1d56('0x1c')]),_0x379eb8);dials['dialbegin'](_0x379eb8);}catch(_0x3150ef){utils[_0x1d56('0x14')](util[_0x1d56('0x18')]('[%s]dialbegin',_0x379eb8[_0x1d56('0x1c')]),_0x3150ef);}});ami['on'](_0x1d56('0x3e'),function(_0x171349){try{utils[_0x1d56('0x1b')](util[_0x1d56('0x18')](_0x1d56('0x3f'),_0x171349[_0x1d56('0x1c')]),_0x171349);dials['dialend'](_0x171349);}catch(_0x3480a7){utils[_0x1d56('0x14')](util[_0x1d56('0x18')](_0x1d56('0x3f'),_0x171349['uniqueid']),_0x3480a7);}});} \ No newline at end of file +var _0x7617=['queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','blindtransfer','attendedtransfer','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','port','asterisk','password','keepConnected','xdr','disabled','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]'];(function(_0x3fe440,_0x18d0cb){var _0x30cf95=function(_0x1f7af5){while(--_0x1f7af5){_0x3fe440['push'](_0x3fe440['shift']());}};_0x30cf95(++_0x18d0cb);}(_0x7617,0x115));var _0x7761=function(_0x3a8be7,_0x141e7c){_0x3a8be7=_0x3a8be7-0x0;var _0x3d41a9=_0x7617[_0x3a8be7];return _0x3d41a9;};var AsteriskManager=require(_0x7761('0x0'));var config=require(_0x7761('0x1'));var utils=require('./utils');var util=require(_0x7761('0x2'));var ami=new AsteriskManager(config['asterisk'][_0x7761('0x3')],config[_0x7761('0x4')]['ip'],config[_0x7761('0x4')]['username'],config[_0x7761('0x4')][_0x7761('0x5')],!![]);ami[_0x7761('0x6')]();if(config[_0x7761('0x7')]&&config[_0x7761('0x7')][_0x7761('0x8')]){utils['info']('XDR\x20DISABLED');}else{var agents=require(_0x7761('0x9'));var calls=require('./calls.controller');var queues=require(_0x7761('0xa'));var recordings=require(_0x7761('0xb'));var members=require(_0x7761('0xc'));var dials=require('./dials.controller');var transfers=require(_0x7761('0xd'));var core=require(_0x7761('0xe'));ami['on'](_0x7761('0xf'),core[_0x7761('0xf')]);ami['on']('shutdown',core['shutdown']);ami['on'](_0x7761('0x10'),core[_0x7761('0x10')]);ami['on'](_0x7761('0x11'),core[_0x7761('0x11')]);ami['on'](_0x7761('0x12'),core[_0x7761('0x12')]);ami['on']('managerevent',core[_0x7761('0x13')]);ami['on'](_0x7761('0x14'),function(_0x3c9bdc){try{utils[_0x7761('0x15')](util[_0x7761('0x16')](_0x7761('0x17'),_0x3c9bdc['device']),_0x3c9bdc);members[_0x7761('0x14')](_0x3c9bdc);}catch(_0x29ca9d){utils[_0x7761('0x11')](util[_0x7761('0x16')](_0x7761('0x17'),_0x3c9bdc[_0x7761('0x18')]),_0x29ca9d);}});ami['on'](_0x7761('0x19'),function(_0x81800e){try{utils[_0x7761('0x15')](util[_0x7761('0x16')]('[%s][index][agentcalled]',_0x81800e[_0x7761('0x1a')]),_0x81800e);agents[_0x7761('0x19')](_0x81800e);}catch(_0x1ccd75){utils['error'](util[_0x7761('0x16')]('[%s][index][agentcalled]',_0x81800e[_0x7761('0x1a')]),_0x1ccd75);}});ami['on'](_0x7761('0x1b'),function(_0x221b85){try{utils['debug'](util['format'](_0x7761('0x1c'),_0x221b85['uniqueid']),_0x221b85);agents['agentringnoanswer'](_0x221b85);}catch(_0x27533c){utils[_0x7761('0x11')](util[_0x7761('0x16')]('[%s][index][agentringnoanswer]',_0x221b85[_0x7761('0x1a')]),_0x27533c);}});ami['on'](_0x7761('0x1d'),function(_0x5ccd64){try{utils['debug'](util['format'](_0x7761('0x1e'),_0x5ccd64['uniqueid']),_0x5ccd64);agents[_0x7761('0x1d')](_0x5ccd64);queues['agentconnect'](_0x5ccd64);}catch(_0x47e238){utils[_0x7761('0x11')](util[_0x7761('0x16')](_0x7761('0x1e'),_0x5ccd64['uniqueid']),_0x47e238);}});ami['on'](_0x7761('0x1f'),function(_0x42a31a){try{utils['debug'](util[_0x7761('0x16')](_0x7761('0x20'),_0x42a31a[_0x7761('0x1a')]),_0x42a31a);agents['agentcomplete'](_0x42a31a);queues[_0x7761('0x1f')](_0x42a31a);members[_0x7761('0x1f')](_0x42a31a);}catch(_0x4a8024){utils[_0x7761('0x11')](util[_0x7761('0x16')](_0x7761('0x20'),_0x42a31a[_0x7761('0x1a')]),_0x4a8024);}});ami['on'](_0x7761('0x21'),function(_0x115d71){try{utils[_0x7761('0x15')](util[_0x7761('0x16')]('[%s][index][queuecallerabandon]',_0x115d71['uniqueid']),_0x115d71);agents[_0x7761('0x21')](_0x115d71);queues[_0x7761('0x21')](_0x115d71);}catch(_0x529723){utils[_0x7761('0x11')](util[_0x7761('0x16')](_0x7761('0x22'),_0x115d71[_0x7761('0x1a')]),_0x529723);}});ami['on']('queuecallerjoin',function(_0x34fd0c){try{utils['debug'](util[_0x7761('0x16')](_0x7761('0x23'),_0x34fd0c['uniqueid']),_0x34fd0c);queues['queuecallerjoin'](_0x34fd0c);recordings[_0x7761('0x24')](_0x34fd0c);}catch(_0x144abb){utils[_0x7761('0x11')](util['format']('[%s][index][queuecallerjoin]',_0x34fd0c['uniqueid']),_0x144abb);}});ami['on'](_0x7761('0x25'),function(_0x3e5f70){try{utils[_0x7761('0x15')](util[_0x7761('0x16')](_0x7761('0x26'),_0x3e5f70[_0x7761('0x1a')]),_0x3e5f70);queues[_0x7761('0x25')](_0x3e5f70);}catch(_0x26f5cb){utils[_0x7761('0x11')](util[_0x7761('0x16')](_0x7761('0x26'),_0x3e5f70[_0x7761('0x1a')]),_0x26f5cb);}});ami['on'](_0x7761('0x27'),function(_0x11fcd2){try{utils[_0x7761('0x15')](util[_0x7761('0x16')](_0x7761('0x28'),_0x11fcd2['uniqueid']),_0x11fcd2);queues['musiconholdstart'](_0x11fcd2);calls['musiconholdstart'](_0x11fcd2);}catch(_0x46cb18){utils[_0x7761('0x11')](util[_0x7761('0x16')]('[%s][index][musiconholdstart]',_0x11fcd2[_0x7761('0x1a')]),_0x46cb18);}});ami['on']('musiconholdstop',function(_0x529130){try{utils['debug'](util[_0x7761('0x16')](_0x7761('0x29'),_0x529130[_0x7761('0x1a')]),_0x529130);queues[_0x7761('0x2a')](_0x529130);calls[_0x7761('0x2a')](_0x529130);}catch(_0x33638b){utils[_0x7761('0x11')](util['format'](_0x7761('0x29'),_0x529130[_0x7761('0x1a')]),_0x33638b);}});ami['on'](_0x7761('0x2b'),function(_0x44abf4){try{utils[_0x7761('0x15')](util[_0x7761('0x16')]('[%s][index][newstate]',_0x44abf4[_0x7761('0x1a')]),_0x44abf4);calls[_0x7761('0x2b')](_0x44abf4);recordings[_0x7761('0x2b')](_0x44abf4);}catch(_0x2f3dfc){utils['error'](util[_0x7761('0x16')](_0x7761('0x2c'),_0x44abf4['uniqueid']),_0x2f3dfc);}});ami['on'](_0x7761('0x2d'),function(_0x14785a){try{utils[_0x7761('0x15')](util[_0x7761('0x16')](_0x7761('0x2e'),_0x14785a[_0x7761('0x1a')]),_0x14785a);calls[_0x7761('0x2d')](_0x14785a);recordings[_0x7761('0x2d')](_0x14785a);dials['hangup'](_0x14785a);agents['hangup'](_0x14785a);queues[_0x7761('0x2d')](_0x14785a);}catch(_0x16a925){utils['error'](util['format']('[%s][index][hangup]',_0x14785a['uniqueid']),_0x16a925);}});ami['on'](_0x7761('0x2f'),function(_0x14a6da){try{utils['debug'](util[_0x7761('0x16')]('[%s][index][cdr]',_0x14a6da[_0x7761('0x1a')]),_0x14a6da);members[_0x7761('0x2f')](_0x14a6da);}catch(_0x30893a){utils[_0x7761('0x11')](util['format']('[%s][index][cdr]',_0x14a6da[_0x7761('0x1a')]),_0x30893a);}});ami['on'](_0x7761('0x30'),function(_0x3642d2){try{utils[_0x7761('0x15')](util[_0x7761('0x16')]('[%s][index][blindtransfer]',_0x3642d2[_0x7761('0x1a')]),_0x3642d2);queues[_0x7761('0x30')](_0x3642d2);agents[_0x7761('0x30')](_0x3642d2);transfers[_0x7761('0x30')](_0x3642d2);}catch(_0x356ce9){utils['error'](util['format']('[%s][index][blindtransfer]',_0x3642d2[_0x7761('0x1a')]),_0x356ce9);}});ami['on'](_0x7761('0x31'),function(_0x20a67d){try{utils[_0x7761('0x15')](util['format']('[%s][index][attendedtransfer]',_0x20a67d[_0x7761('0x32')]),_0x20a67d);queues[_0x7761('0x31')](_0x20a67d);transfers['attendedtransfer'](_0x20a67d);agents['attendedtransfer'](_0x20a67d);calls['attendedtransfer'](_0x20a67d);}catch(_0x4160cf){utils[_0x7761('0x11')](util['format']('[%s][index][attendedtransfer]',_0x20a67d[_0x7761('0x32')]),_0x4160cf);}});ami['on'](_0x7761('0x33'),function(_0x2a6127){try{utils[_0x7761('0x15')](util[_0x7761('0x16')](_0x7761('0x34'),_0x2a6127[_0x7761('0x1a')]),_0x2a6127);queues[_0x7761('0x33')](_0x2a6127);recordings['varset'](_0x2a6127);calls[_0x7761('0x33')](_0x2a6127);dials['varset'](_0x2a6127);}catch(_0xc4a51f){utils['error'](util[_0x7761('0x16')](_0x7761('0x34'),_0x2a6127['uniqueid']),_0xc4a51f);}});ami['on']('newexten',function(_0x443301){try{utils[_0x7761('0x15')](util[_0x7761('0x16')](_0x7761('0x35'),_0x443301[_0x7761('0x1a')]),_0x443301);calls[_0x7761('0x36')](_0x443301);recordings['newexten'](_0x443301);dials[_0x7761('0x36')](_0x443301);}catch(_0xec6b71){utils[_0x7761('0x11')](util[_0x7761('0x16')]('[%s][index][newexten]',_0x443301[_0x7761('0x1a')]),_0xec6b71);}});ami['on'](_0x7761('0x37'),function(_0x3c59f0){try{utils[_0x7761('0x15')](util[_0x7761('0x16')](_0x7761('0x38'),_0x3c59f0[_0x7761('0x1a')]),_0x3c59f0);calls[_0x7761('0x37')](_0x3c59f0);recordings['newchannel'](_0x3c59f0);}catch(_0x4ec784){utils[_0x7761('0x11')](util['format'](_0x7761('0x38'),_0x3c59f0[_0x7761('0x1a')]),_0x4ec784);}});ami['on'](_0x7761('0x39'),function(_0x552f90){try{utils[_0x7761('0x15')](util['format'](_0x7761('0x3a'),_0x552f90['uniqueid']),_0x552f90);dials[_0x7761('0x39')](_0x552f90);}catch(_0x24c63a){utils[_0x7761('0x11')](util[_0x7761('0x16')](_0x7761('0x3b'),_0x552f90[_0x7761('0x1a')]),_0x24c63a);}});ami['on'](_0x7761('0x3c'),function(_0x2c212a){try{utils[_0x7761('0x15')](util[_0x7761('0x16')]('[%s][index][dialend]',_0x2c212a[_0x7761('0x1a')]),_0x2c212a);dials[_0x7761('0x3c')](_0x2c212a);}catch(_0x737130){utils[_0x7761('0x11')](util[_0x7761('0x16')](_0x7761('0x3d'),_0x2c212a[_0x7761('0x1a')]),_0x737130);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 58f6c9b..6c103f0 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 _0x6d5a=['[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','membername','type','interface','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','error','format','[%s][members][writeDB]','some','startsWith','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','duration','diffTime','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][agentcomplete]','cdr','split','assign','data1','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','exitAt','destinationchannel','destination','data2','[%s][members][cdr]','util','./utils','Queue:','info'];(function(_0x39f74b,_0x51bcbc){var _0x11eb7c=function(_0xc0d3f2){while(--_0xc0d3f2){_0x39f74b['push'](_0x39f74b['shift']());}};_0x11eb7c(++_0x51bcbc);}(_0x6d5a,0x98));var _0xa6d5=function(_0x440084,_0x4716f7){_0x440084=_0x440084-0x0;var _0x3ae5ea=_0x6d5a[_0x440084];return _0x3ae5ea;};'use strict';var _=require('lodash');var util=require(_0xa6d5('0x0'));var utils=require(_0xa6d5('0x1'));var members={};var exclude=['Local/_attended@transfer',_0xa6d5('0x2')];function writeDB(_0x47f189){utils[_0xa6d5('0x3')](util['format'](_0xa6d5('0x4'),_0x47f189[_0xa6d5('0x5')],_0x47f189['interface'],_0x47f189['channel'],_0x47f189['data2'],_0x47f189[_0xa6d5('0x6')],_0x47f189[_0xa6d5('0x7')]));if(_0x47f189[_0xa6d5('0x8')]){utils[_0xa6d5('0x9')](_0x47f189[_0xa6d5('0x8')])[_0xa6d5('0xa')](function(_0x2dd54f){if(_0x2dd54f){_0x47f189[_0xa6d5('0x6')]=_0x2dd54f[_0xa6d5('0xb')];_0x47f189[_0xa6d5('0xc')]=_0x2dd54f[_0xa6d5('0xc')];utils[_0xa6d5('0xd')](_0xa6d5('0xe'),_0x47f189);}else{utils[_0xa6d5('0xf')](_0x47f189['interface']['split']('/')[0x1])[_0xa6d5('0xa')](function(_0x584dd6){if(_0x584dd6){_0x47f189[_0xa6d5('0x6')]=_0x584dd6[_0xa6d5('0xb')];_0x47f189['internal']=_0x584dd6[_0xa6d5('0xc')];utils['request'](_0xa6d5('0xe'),_0x47f189);}});}})['catch'](function(_0x52a8c3){utils[_0xa6d5('0x10')](util[_0xa6d5('0x11')](_0xa6d5('0x12'),_0x47f189['uniqueid']),_0x52a8c3);});}delete members[_0x47f189[_0xa6d5('0x8')]];}function startsWith(_0x17ea92,_0x259118){return _[_0xa6d5('0x13')](_0x17ea92,function(_0x2deda8){return _[_0xa6d5('0x14')](_0x259118,_0x2deda8);});}exports['devicestatechange']=function(_0x3ad666){try{utils[_0xa6d5('0x15')](util[_0xa6d5('0x11')](_0xa6d5('0x16'),members[_0x3ad666[_0xa6d5('0x17')]]?members[_0x3ad666['device']]['uniqueid']:_0x3ad666[_0xa6d5('0x17')]),_0x3ad666);utils[_0xa6d5('0x3')](util[_0xa6d5('0x11')](_0xa6d5('0x18'),members[_0x3ad666['device']]?members[_0x3ad666['device']]['uniqueid']:_0x3ad666['device'],_0x3ad666['state'],_0x3ad666[_0xa6d5('0x17')]));switch(_0x3ad666[_0xa6d5('0x19')]){case _0xa6d5('0x1a'):case _0xa6d5('0x1b'):if(!startsWith(exclude,_0x3ad666[_0xa6d5('0x17')])){members[_0x3ad666['device']]={'channel':_0xa6d5('0x1c'),'interface':_0x3ad666[_0xa6d5('0x17')],'type':_0xa6d5('0x1d'),'enterAt':utils[_0xa6d5('0x1e')](),'role':_0xa6d5('0x1f')};}break;case _0xa6d5('0x20'):if(!_[_0xa6d5('0x21')](members[_0x3ad666[_0xa6d5('0x17')]])){members[_0x3ad666['device']]['exitAt']=utils[_0xa6d5('0x1e')]();members[_0x3ad666[_0xa6d5('0x17')]][_0xa6d5('0x22')]=utils[_0xa6d5('0x23')](members[_0x3ad666[_0xa6d5('0x17')]]['exitAt'],members[_0x3ad666[_0xa6d5('0x17')]]['enterAt']);if(members[_0x3ad666[_0xa6d5('0x17')]][_0xa6d5('0x5')]){writeDB(members[_0x3ad666[_0xa6d5('0x17')]]);}}break;default:break;}}catch(_0x514dfd){utils[_0xa6d5('0x10')](util[_0xa6d5('0x11')](_0xa6d5('0x16'),members[_0x3ad666['device']]?members[_0x3ad666[_0xa6d5('0x17')]][_0xa6d5('0x5')]:_0x3ad666[_0xa6d5('0x17')]),_0x514dfd);}};exports[_0xa6d5('0x24')]=function(_0x2280aa){try{if(!_[_0xa6d5('0x21')](members[_0x2280aa[_0xa6d5('0x8')]])){utils[_0xa6d5('0x15')](util[_0xa6d5('0x11')]('[%s][members][agentcomplete]',_0x2280aa['uniqueid']),_0x2280aa);utils['info'](util[_0xa6d5('0x11')](_0xa6d5('0x25'),_0x2280aa[_0xa6d5('0x5')],_0x2280aa[_0xa6d5('0x8')],_0x2280aa[_0xa6d5('0x26')]));members[_0x2280aa['interface']]=_['assign'](members[_0x2280aa['interface']],{'data4':_0x2280aa['queue'],'uniqueid':_0x2280aa[_0xa6d5('0x5')]});}}catch(_0x1d92e0){utils[_0xa6d5('0x10')](util['format'](_0xa6d5('0x27'),_0x2280aa[_0xa6d5('0x5')]),_0x1d92e0);}};exports[_0xa6d5('0x28')]=function(_0x3bb246){try{utils[_0xa6d5('0x15')](util[_0xa6d5('0x11')]('[%s][members][cdr]',_0x3bb246[_0xa6d5('0x5')]),_0x3bb246);if(_0x3bb246['channel']){var _0xeb3cd6=_0x3bb246['channel'][_0xa6d5('0x29')]('-')[0x0];if(!_[_0xa6d5('0x21')](members[_0xeb3cd6])){members[_0xeb3cd6]=_[_0xa6d5('0x2a')](members[_0xeb3cd6],{'data1':members[_0xeb3cd6][_0xa6d5('0x2b')]||_0x3bb246['type'],'data2':members[_0xeb3cd6]['data2']||_0x3bb246[_0xa6d5('0x2c')],'data3':members[_0xeb3cd6][_0xa6d5('0x2d')]||_0x3bb246['destination'],'uniqueid':members[_0xeb3cd6][_0xa6d5('0x5')]||_0x3bb246['uniqueid']});utils['info'](util['format'](_0xa6d5('0x2e'),_0x3bb246[_0xa6d5('0x5')],members[_0xeb3cd6][_0xa6d5('0x2b')],members[_0xeb3cd6]['data2'],members[_0xeb3cd6]['data3']));if(members[_0xeb3cd6][_0xa6d5('0x2f')]){writeDB(members[_0xeb3cd6]);}}}if(_0x3bb246['destinationchannel']){var _0x1ebc12=_0x3bb246[_0xa6d5('0x30')][_0xa6d5('0x29')]('-')[0x0];if(!_['isNil'](members[_0x1ebc12])){members[_0x1ebc12]=_['assign'](members[_0x1ebc12],{'data1':members[_0x1ebc12][_0xa6d5('0x2b')]||_0x3bb246['type'],'data2':members[_0x1ebc12]['data2']||_0x3bb246[_0xa6d5('0x2c')],'data3':members[_0x1ebc12][_0xa6d5('0x2d')]||_0x3bb246[_0xa6d5('0x31')],'uniqueid':members[_0x1ebc12][_0xa6d5('0x5')]||_0x3bb246[_0xa6d5('0x5')]});utils[_0xa6d5('0x3')](util[_0xa6d5('0x11')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x3bb246[_0xa6d5('0x5')],members[_0x1ebc12][_0xa6d5('0x2b')],members[_0x1ebc12][_0xa6d5('0x32')],members[_0x1ebc12]['data3']));if(members[_0x1ebc12][_0xa6d5('0x2f')]){writeDB(members[_0x1ebc12]);}}}}catch(_0x2bb5ef){utils['error'](util[_0xa6d5('0x11')](_0xa6d5('0x33'),_0x3bb246[_0xa6d5('0x5')]),_0x2bb5ef);}}; \ No newline at end of file +var _0xe0b0=['internal','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','state','INUSE','TALKING','now','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','source','lodash','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','type','then','membername','name','request','CreateMemberReport','getUserByName','split'];(function(_0x4ac6b0,_0x202ea7){var _0x114a85=function(_0x279025){while(--_0x279025){_0x4ac6b0['push'](_0x4ac6b0['shift']());}};_0x114a85(++_0x202ea7);}(_0xe0b0,0x152));var _0x0e0b=function(_0x3c9845,_0x540479){_0x3c9845=_0x3c9845-0x0;var _0x2dc6bf=_0xe0b0[_0x3c9845];return _0x2dc6bf;};'use strict';var _=require(_0x0e0b('0x0'));var util=require('util');var utils=require(_0x0e0b('0x1'));var members={};var exclude=[_0x0e0b('0x2'),_0x0e0b('0x3')];function writeDB(_0x51aa26){utils[_0x0e0b('0x4')](util[_0x0e0b('0x5')](_0x0e0b('0x6'),_0x51aa26[_0x0e0b('0x7')],_0x51aa26[_0x0e0b('0x8')],_0x51aa26[_0x0e0b('0x9')],_0x51aa26[_0x0e0b('0xa')],_0x51aa26['membername'],_0x51aa26[_0x0e0b('0xb')]));if(_0x51aa26[_0x0e0b('0x8')]){utils['getUserByInterface'](_0x51aa26[_0x0e0b('0x8')])[_0x0e0b('0xc')](function(_0x329c5c){if(_0x329c5c){_0x51aa26[_0x0e0b('0xd')]=_0x329c5c[_0x0e0b('0xe')];_0x51aa26['internal']=_0x329c5c['internal'];utils[_0x0e0b('0xf')](_0x0e0b('0x10'),_0x51aa26);}else{utils[_0x0e0b('0x11')](_0x51aa26[_0x0e0b('0x8')][_0x0e0b('0x12')]('/')[0x1])[_0x0e0b('0xc')](function(_0xbd5204){if(_0xbd5204){_0x51aa26[_0x0e0b('0xd')]=_0xbd5204[_0x0e0b('0xe')];_0x51aa26[_0x0e0b('0x13')]=_0xbd5204['internal'];utils[_0x0e0b('0xf')](_0x0e0b('0x10'),_0x51aa26);}});}})[_0x0e0b('0x14')](function(_0x2bbec7){utils[_0x0e0b('0x15')](util[_0x0e0b('0x5')](_0x0e0b('0x16'),_0x51aa26[_0x0e0b('0x7')]),_0x2bbec7);});}delete members[_0x51aa26[_0x0e0b('0x8')]];}function startsWith(_0x3a201d,_0x2417f5){return _[_0x0e0b('0x17')](_0x3a201d,function(_0x194388){return _[_0x0e0b('0x18')](_0x2417f5,_0x194388);});}exports[_0x0e0b('0x19')]=function(_0x2ca36c){try{utils[_0x0e0b('0x1a')](util[_0x0e0b('0x5')](_0x0e0b('0x1b'),members[_0x2ca36c[_0x0e0b('0x1c')]]?members[_0x2ca36c[_0x0e0b('0x1c')]][_0x0e0b('0x7')]:_0x2ca36c[_0x0e0b('0x1c')]),_0x2ca36c);utils['info'](util[_0x0e0b('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x2ca36c[_0x0e0b('0x1c')]]?members[_0x2ca36c['device']]['uniqueid']:_0x2ca36c['device'],_0x2ca36c['state'],_0x2ca36c[_0x0e0b('0x1c')]));switch(_0x2ca36c[_0x0e0b('0x1d')]){case _0x0e0b('0x1e'):case'BUSY':if(!startsWith(exclude,_0x2ca36c['device'])){members[_0x2ca36c[_0x0e0b('0x1c')]]={'channel':'voice','interface':_0x2ca36c[_0x0e0b('0x1c')],'type':_0x0e0b('0x1f'),'enterAt':utils[_0x0e0b('0x20')](),'role':'agent'};}break;case _0x0e0b('0x21'):if(!_[_0x0e0b('0x22')](members[_0x2ca36c[_0x0e0b('0x1c')]])){members[_0x2ca36c[_0x0e0b('0x1c')]][_0x0e0b('0x23')]=utils[_0x0e0b('0x20')]();members[_0x2ca36c[_0x0e0b('0x1c')]][_0x0e0b('0x24')]=utils[_0x0e0b('0x25')](members[_0x2ca36c[_0x0e0b('0x1c')]][_0x0e0b('0x23')],members[_0x2ca36c['device']][_0x0e0b('0x26')]);if(members[_0x2ca36c['device']][_0x0e0b('0x7')]){writeDB(members[_0x2ca36c['device']]);}}break;default:break;}}catch(_0x2b0ab6){utils['error'](util[_0x0e0b('0x5')](_0x0e0b('0x1b'),members[_0x2ca36c[_0x0e0b('0x1c')]]?members[_0x2ca36c[_0x0e0b('0x1c')]]['uniqueid']:_0x2ca36c[_0x0e0b('0x1c')]),_0x2b0ab6);}};exports['agentcomplete']=function(_0x543182){try{if(!_[_0x0e0b('0x22')](members[_0x543182['interface']])){utils['debug'](util[_0x0e0b('0x5')](_0x0e0b('0x27'),_0x543182[_0x0e0b('0x7')]),_0x543182);utils[_0x0e0b('0x4')](util[_0x0e0b('0x5')](_0x0e0b('0x28'),_0x543182[_0x0e0b('0x7')],_0x543182['interface'],_0x543182['queue']));members[_0x543182['interface']]=_[_0x0e0b('0x29')](members[_0x543182['interface']],{'data4':_0x543182[_0x0e0b('0x2a')],'uniqueid':_0x543182[_0x0e0b('0x7')]});}}catch(_0x504022){utils[_0x0e0b('0x15')](util[_0x0e0b('0x5')]('[%s][members][agentcomplete]',_0x543182[_0x0e0b('0x7')]),_0x504022);}};exports[_0x0e0b('0x2b')]=function(_0x233a3d){try{utils[_0x0e0b('0x1a')](util['format'](_0x0e0b('0x2c'),_0x233a3d[_0x0e0b('0x7')]),_0x233a3d);if(_0x233a3d[_0x0e0b('0x9')]){var _0x34f8ff=_0x233a3d[_0x0e0b('0x9')][_0x0e0b('0x12')]('-')[0x0];if(!_[_0x0e0b('0x22')](members[_0x34f8ff])){members[_0x34f8ff]=_[_0x0e0b('0x29')](members[_0x34f8ff],{'data1':members[_0x34f8ff]['data1']||_0x233a3d[_0x0e0b('0xb')],'data2':members[_0x34f8ff]['data2']||_0x233a3d['source'],'data3':members[_0x34f8ff][_0x0e0b('0x2d')]||_0x233a3d[_0x0e0b('0x2e')],'uniqueid':members[_0x34f8ff][_0x0e0b('0x7')]||_0x233a3d['uniqueid']});utils['info'](util[_0x0e0b('0x5')](_0x0e0b('0x2f'),_0x233a3d[_0x0e0b('0x7')],members[_0x34f8ff][_0x0e0b('0x30')],members[_0x34f8ff][_0x0e0b('0xa')],members[_0x34f8ff][_0x0e0b('0x2d')]));if(members[_0x34f8ff]['exitAt']){writeDB(members[_0x34f8ff]);}}}if(_0x233a3d[_0x0e0b('0x31')]){var _0x2080f8=_0x233a3d['destinationchannel'][_0x0e0b('0x12')]('-')[0x0];if(!_['isNil'](members[_0x2080f8])){members[_0x2080f8]=_[_0x0e0b('0x29')](members[_0x2080f8],{'data1':members[_0x2080f8]['data1']||_0x233a3d[_0x0e0b('0xb')],'data2':members[_0x2080f8][_0x0e0b('0xa')]||_0x233a3d[_0x0e0b('0x32')],'data3':members[_0x2080f8][_0x0e0b('0x2d')]||_0x233a3d['destination'],'uniqueid':members[_0x2080f8][_0x0e0b('0x7')]||_0x233a3d[_0x0e0b('0x7')]});utils[_0x0e0b('0x4')](util[_0x0e0b('0x5')](_0x0e0b('0x2f'),_0x233a3d[_0x0e0b('0x7')],members[_0x2080f8][_0x0e0b('0x30')],members[_0x2080f8][_0x0e0b('0xa')],members[_0x2080f8][_0x0e0b('0x2d')]));if(members[_0x2080f8][_0x0e0b('0x23')]){writeDB(members[_0x2080f8]);}}}}catch(_0x29ad66){utils[_0x0e0b('0x15')](util[_0x0e0b('0x5')](_0x0e0b('0x2c'),_0x233a3d[_0x0e0b('0x7')]),_0x29ad66);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 36ddfe8..579eafa 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 _0x3ef7=['queuecallerexitAt','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleave','queuecallerleaveAt','diffTime','queuecallerjoinAt','count','membername','destaccountcode','queuecallerabandonAt','accountcode','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','lodash','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','uniqueid','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','error','hangup','isNil','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','queuecallerabandon'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x3ef7,0xa2));var _0x73ef=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3ef7[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x73ef('0x0'));var util=require('util');var utils=require(_0x73ef('0x1'));var queues={};function writeDB(_0x1fb7b0){utils[_0x73ef('0x2')](util[_0x73ef('0x3')](_0x73ef('0x4'),_0x1fb7b0['uniqueid'],_0x1fb7b0[_0x73ef('0x5')],_0x1fb7b0[_0x73ef('0x6')],_0x1fb7b0[_0x73ef('0x7')],_0x1fb7b0[_0x73ef('0x8')],_0x1fb7b0['accountcode'],_0x1fb7b0[_0x73ef('0x9')]));if(_0x1fb7b0[_0x73ef('0x6')]){utils[_0x73ef('0xa')](_0x1fb7b0[_0x73ef('0x6')])[_0x73ef('0xb')](function(_0x4cd5ce){if(_0x4cd5ce){_0x1fb7b0[_0x73ef('0xc')]=_0x4cd5ce[_0x73ef('0xc')];}utils['request'](_0x73ef('0xd'),_0x1fb7b0);});}else{utils[_0x73ef('0xe')](_0x73ef('0xd'),_0x1fb7b0);}if(_0x1fb7b0[_0x73ef('0xf')]){delete queues[_0x1fb7b0[_0x73ef('0xf')]];}else{delete queues[_0x1fb7b0['uniqueid']];}}exports[_0x73ef('0x10')]=function(_0x111ce3){try{utils[_0x73ef('0x11')](util[_0x73ef('0x3')](_0x73ef('0x12'),_0x111ce3[_0x73ef('0x13')]),_0x111ce3);utils[_0x73ef('0x2')](util[_0x73ef('0x3')](_0x73ef('0x14'),_0x111ce3[_0x73ef('0x13')],_0x111ce3[_0x73ef('0x6')],_0x111ce3[_0x73ef('0x15')]));queues[_0x111ce3[_0x73ef('0x13')]]=_['assign'](_0x111ce3,{'originalposition':_0x111ce3[_0x73ef('0x15')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x2d836c){utils[_0x73ef('0x16')](util[_0x73ef('0x3')]('[%s][queues][queuecallerjoin]',_0x111ce3[_0x73ef('0x13')]),_0x2d836c);}};exports[_0x73ef('0x17')]=function(_0x4bccf6){try{if(!_[_0x73ef('0x18')](queues[_0x4bccf6[_0x73ef('0x13')]])){utils[_0x73ef('0x11')](util[_0x73ef('0x3')](_0x73ef('0x19'),_0x4bccf6['uniqueid']),_0x4bccf6);if(queues[_0x4bccf6[_0x73ef('0x13')]]['queuecallerleaveAt']){if(!queues[_0x4bccf6[_0x73ef('0x13')]]['queuecallerabandon']&&!queues[_0x4bccf6[_0x73ef('0x13')]][_0x73ef('0x1a')]){queues[_0x4bccf6[_0x73ef('0x13')]][_0x73ef('0x1b')]=!![];queues[_0x4bccf6[_0x73ef('0x13')]][_0x73ef('0x1c')]=utils[_0x73ef('0x1d')]();queues[_0x4bccf6[_0x73ef('0x13')]]['queuecallerexitreason']=_0x73ef('0x1e');}utils[_0x73ef('0x2')](util[_0x73ef('0x3')](_0x73ef('0x1f'),_0x4bccf6['uniqueid'],queues[_0x4bccf6[_0x73ef('0x13')]][_0x73ef('0x20')],queues[_0x4bccf6[_0x73ef('0x13')]][_0x73ef('0x9')]));writeDB(queues[_0x4bccf6[_0x73ef('0x13')]]);}else if(queues[_0x4bccf6[_0x73ef('0x13')]][_0x73ef('0xf')]){utils[_0x73ef('0x2')](util[_0x73ef('0x3')](_0x73ef('0x21'),_0x4bccf6['uniqueid'],queues[_0x4bccf6[_0x73ef('0x13')]][_0x73ef('0x20')],queues[_0x4bccf6['uniqueid']]['transfereduniqueid']));queues[queues[_0x4bccf6[_0x73ef('0x13')]]['transfereduniqueid']]=queues[_0x4bccf6['uniqueid']];queues[queues[_0x4bccf6[_0x73ef('0x13')]][_0x73ef('0xf')]][_0x73ef('0x22')]=0x2;delete queues[_0x4bccf6[_0x73ef('0x13')]];}}}catch(_0x4e7a8b){utils[_0x73ef('0x16')](util['format'](_0x73ef('0x19'),_0x4bccf6['uniqueid']),_0x4e7a8b);}};exports[_0x73ef('0x23')]=function(_0x1b802f){try{utils[_0x73ef('0x11')](util[_0x73ef('0x3')](_0x73ef('0x24'),_0x1b802f[_0x73ef('0x13')]),_0x1b802f);if(!_[_0x73ef('0x18')](_0x1b802f['variable'][_0x73ef('0x25')])&&_0x1b802f[_0x73ef('0x26')][_0x73ef('0x27')]()!=='CONTINUE'){if(!_['isNil'](queues[_0x1b802f[_0x73ef('0x13')]])){queues[_0x1b802f[_0x73ef('0x13')]]['queuecallerabandon']=![];queues[_0x1b802f[_0x73ef('0x13')]]['queuecallerabandonAt']=null;queues[_0x1b802f[_0x73ef('0x13')]][_0x73ef('0x1a')]=!![];queues[_0x1b802f[_0x73ef('0x13')]]['queuecallerexitAt']=utils[_0x73ef('0x1d')]();queues[_0x1b802f[_0x73ef('0x13')]]['queuecallerexitreason']=_0x1b802f[_0x73ef('0x26')][_0x73ef('0x27')]();utils[_0x73ef('0x2')](util['format'](_0x73ef('0x28'),_0x1b802f[_0x73ef('0x13')],queues[_0x1b802f[_0x73ef('0x13')]]['name'],_0x1b802f[_0x73ef('0x26')],queues[_0x1b802f[_0x73ef('0x13')]][_0x73ef('0x9')]));writeDB(queues[_0x1b802f[_0x73ef('0x13')]]);}}else if(!_[_0x73ef('0x18')](_0x1b802f[_0x73ef('0x29')][_0x73ef('0x2a')])){if(!_[_0x73ef('0x18')](queues[_0x1b802f[_0x73ef('0x13')]])&&!queues[_0x1b802f[_0x73ef('0x13')]]['queuecallerabandon']){queues[_0x1b802f[_0x73ef('0x13')]][_0x73ef('0x2b')]=![];queues[_0x1b802f[_0x73ef('0x13')]]['queuecallerabandonAt']=null;queues[_0x1b802f[_0x73ef('0x13')]][_0x73ef('0x1a')]=!![];queues[_0x1b802f[_0x73ef('0x13')]][_0x73ef('0x2c')]=utils[_0x73ef('0x1d')]();queues[_0x1b802f['uniqueid']]['queuecallerexitreason']='EXITWITHKEY';utils[_0x73ef('0x2')](util[_0x73ef('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x1b802f[_0x73ef('0x13')],queues[_0x1b802f[_0x73ef('0x13')]][_0x73ef('0x20')],_0x1b802f['value'],queues[_0x1b802f[_0x73ef('0x13')]][_0x73ef('0x9')]));}}}catch(_0x376791){utils[_0x73ef('0x16')](util['format'](_0x73ef('0x24'),_0x1b802f[_0x73ef('0x13')]),_0x376791);}};exports[_0x73ef('0x2b')]=function(_0x455d64){try{if(!_[_0x73ef('0x18')](queues[_0x455d64[_0x73ef('0x13')]])){utils[_0x73ef('0x11')](util[_0x73ef('0x3')](_0x73ef('0x2d'),_0x455d64['uniqueid']),_0x455d64);queues[_0x455d64['uniqueid']][_0x73ef('0x1a')]=![];queues[_0x455d64[_0x73ef('0x13')]]['queuecallerexitAt']=null;queues[_0x455d64['uniqueid']][_0x73ef('0x2b')]=!![];queues[_0x455d64[_0x73ef('0x13')]]['queuecallerabandonAt']=utils['now']();queues[_0x455d64['uniqueid']]['queuecallerexitreason']=_0x73ef('0x2e');utils[_0x73ef('0x2')](util[_0x73ef('0x3')](_0x73ef('0x2f'),_0x455d64[_0x73ef('0x13')],queues[_0x455d64[_0x73ef('0x13')]][_0x73ef('0x20')],queues[_0x455d64['uniqueid']][_0x73ef('0x9')]));}}catch(_0x366e15){utils['error'](util[_0x73ef('0x3')]('[%s][queues][queuecallerabandon]',_0x455d64[_0x73ef('0x13')]),_0x366e15);}};exports['queuecallerleave']=function(_0x4ef667){try{if(!_[_0x73ef('0x18')](queues[_0x4ef667[_0x73ef('0x13')]])){utils['debug'](util[_0x73ef('0x3')](_0x73ef('0x30'),_0x4ef667[_0x73ef('0x13')]),_0x4ef667);utils['info'](util[_0x73ef('0x3')](_0x73ef('0x31'),_0x4ef667['uniqueid'],queues[_0x4ef667[_0x73ef('0x13')]]['name'],_0x4ef667[_0x73ef('0x32')],_0x4ef667[_0x73ef('0x33')]));queues[_0x4ef667[_0x73ef('0x13')]][_0x73ef('0x34')]=!![];queues[_0x4ef667[_0x73ef('0x13')]][_0x73ef('0x35')]=utils['now']();queues[_0x4ef667['uniqueid']]['holdtime']=utils[_0x73ef('0x36')](queues[_0x4ef667['uniqueid']]['queuecallerleaveAt'],queues[_0x4ef667[_0x73ef('0x13')]][_0x73ef('0x37')]);queues[_0x4ef667[_0x73ef('0x13')]][_0x73ef('0x15')]=_0x4ef667['position'];queues[_0x4ef667[_0x73ef('0x13')]][_0x73ef('0x38')]=_0x4ef667[_0x73ef('0x38')];queues[_0x4ef667['uniqueid']][_0x73ef('0x32')]=_0x4ef667[_0x73ef('0x32')];queues[_0x4ef667[_0x73ef('0x13')]]['connectedlinename']=_0x4ef667[_0x73ef('0x33')];}}catch(_0x15fd18){utils[_0x73ef('0x16')](util['format'](_0x73ef('0x30'),_0x4ef667[_0x73ef('0x13')]),_0x15fd18);}};exports['agentconnect']=function(_0x53efb7){try{if(!_[_0x73ef('0x18')](queues[_0x53efb7['uniqueid']])){utils[_0x73ef('0x11')](util[_0x73ef('0x3')]('[%s][queues][agentconnect]',_0x53efb7[_0x73ef('0x13')]),_0x53efb7);utils['info'](util[_0x73ef('0x3')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x53efb7[_0x73ef('0x13')],queues[_0x53efb7['uniqueid']][_0x73ef('0x20')],_0x53efb7[_0x73ef('0x39')],_0x53efb7[_0x73ef('0x3a')]));queues[_0x53efb7['uniqueid']][_0x73ef('0x2b')]=![];queues[_0x53efb7[_0x73ef('0x13')]][_0x73ef('0x2b')]=![];queues[_0x53efb7[_0x73ef('0x13')]][_0x73ef('0x3b')]=null;queues[_0x53efb7[_0x73ef('0x13')]]['queuecallerexit']=![];queues[_0x53efb7[_0x73ef('0x13')]]['queuecallerexitreason']=null;queues[_0x53efb7[_0x73ef('0x13')]][_0x73ef('0x2c')]=null;queues[_0x53efb7['uniqueid']]['assigned']=!![];queues[_0x53efb7['uniqueid']][_0x73ef('0x3c')]=_0x53efb7[_0x73ef('0x3a')];queues[_0x53efb7[_0x73ef('0x13')]][_0x73ef('0x7')]=_0x53efb7[_0x73ef('0x39')];}}catch(_0x2fa7e1){utils[_0x73ef('0x16')](util[_0x73ef('0x3')](_0x73ef('0x3d'),_0x53efb7[_0x73ef('0x13')]),_0x2fa7e1);}};exports[_0x73ef('0x3e')]=function(_0x3b74b9){try{if(!_[_0x73ef('0x18')](queues[_0x3b74b9[_0x73ef('0x13')]])){if(queues[_0x3b74b9[_0x73ef('0x13')]][_0x73ef('0x35')]){utils['debug'](util['format'](_0x73ef('0x3f'),_0x3b74b9[_0x73ef('0x13')]),_0x3b74b9);queues[_0x3b74b9[_0x73ef('0x13')]]['queuecallerabandon']=![];queues[_0x3b74b9[_0x73ef('0x13')]][_0x73ef('0x2b')]=![];queues[_0x3b74b9['uniqueid']][_0x73ef('0x3b')]=null;queues[_0x3b74b9['uniqueid']][_0x73ef('0x1a')]=![];queues[_0x3b74b9[_0x73ef('0x13')]][_0x73ef('0x2c')]=null;queues[_0x3b74b9[_0x73ef('0x13')]][_0x73ef('0x40')]=!![];queues[_0x3b74b9[_0x73ef('0x13')]][_0x73ef('0x7')]=_0x3b74b9['membername'];queues[_0x3b74b9[_0x73ef('0x13')]][_0x73ef('0x1b')]=!![];queues[_0x3b74b9[_0x73ef('0x13')]][_0x73ef('0x1c')]=utils[_0x73ef('0x1d')]();if(_0x3b74b9[_0x73ef('0x41')]==_0x73ef('0x42')){if(!queues[_0x3b74b9[_0x73ef('0x13')]][_0x73ef('0x42')]){queues[_0x3b74b9[_0x73ef('0x13')]][_0x73ef('0x9')]=_0x73ef('0x43');}}else{queues[_0x3b74b9['uniqueid']][_0x73ef('0x9')]=_0x73ef('0x44')+_0x3b74b9[_0x73ef('0x41')][_0x73ef('0x27')]();}utils['info'](util['format'](_0x73ef('0x45'),_0x3b74b9[_0x73ef('0x13')],queues[_0x3b74b9['uniqueid']][_0x73ef('0x20')],_0x3b74b9['membername'],queues[_0x3b74b9[_0x73ef('0x13')]][_0x73ef('0x9')]));writeDB(queues[_0x3b74b9[_0x73ef('0x13')]]);}}}catch(_0x16b070){utils[_0x73ef('0x16')](util[_0x73ef('0x3')](_0x73ef('0x3f'),_0x3b74b9['uniqueid']),_0x16b070);}};exports[_0x73ef('0x46')]=function(_0x462551){try{if(!_[_0x73ef('0x18')](queues[_0x462551['transfereeuniqueid']])){utils[_0x73ef('0x11')](util['format'](_0x73ef('0x47'),_0x462551['uniqueid']),_0x462551);queues[_0x462551[_0x73ef('0x48')]][_0x73ef('0x42')]=!![];queues[_0x462551[_0x73ef('0x48')]][_0x73ef('0x49')]='BLIND';queues[_0x462551[_0x73ef('0x48')]][_0x73ef('0x4a')]=_0x462551['extension'];queues[_0x462551[_0x73ef('0x48')]][_0x73ef('0x4b')]=_0x462551[_0x73ef('0x48')];queues[_0x462551[_0x73ef('0x48')]][_0x73ef('0x9')]=_0x73ef('0x4c');utils[_0x73ef('0x2')](util['format'](_0x73ef('0x4d'),_0x462551['uniqueid'],queues[_0x462551[_0x73ef('0x48')]][_0x73ef('0x20')],_0x462551[_0x73ef('0x48')],_0x462551['extension']));}}catch(_0x58705c){utils[_0x73ef('0x16')](util[_0x73ef('0x3')](_0x73ef('0x47'),_0x462551[_0x73ef('0x13')]),_0x58705c);}};exports[_0x73ef('0x4e')]=function(_0x1a05df){try{utils['debug'](util[_0x73ef('0x3')](_0x73ef('0x4f'),_0x1a05df[_0x73ef('0x50')]),_0x1a05df);if(_0x1a05df[_0x73ef('0x50')]==_0x1a05df[_0x73ef('0x51')]){if(!_[_0x73ef('0x18')](queues[_0x1a05df[_0x73ef('0x52')]])){utils[_0x73ef('0x2')](util['format'](_0x73ef('0x53'),_0x1a05df['origtransfereruniqueid'],queues[_0x1a05df[_0x73ef('0x52')]][_0x73ef('0x20')],_0x1a05df[_0x73ef('0x54')]));queues[_0x1a05df[_0x73ef('0x52')]][_0x73ef('0x42')]=!![];queues[_0x1a05df[_0x73ef('0x52')]]['transfertype']=_0x73ef('0x55');queues[_0x1a05df[_0x73ef('0x52')]][_0x73ef('0x4a')]=_0x1a05df['origtransfererexten'];queues[_0x1a05df[_0x73ef('0x52')]][_0x73ef('0x4b')]=_0x1a05df[_0x73ef('0x50')];queues[_0x1a05df[_0x73ef('0x52')]][_0x73ef('0x9')]=_0x73ef('0x56');}if(!_[_0x73ef('0x18')](queues[_0x1a05df['origtransfererlinkedid']])){if(_0x1a05df[_0x73ef('0x57')]&&queues[_0x1a05df[_0x73ef('0x57')]]){queues[_0x1a05df[_0x73ef('0x57')]][_0x73ef('0x22')]=0x1;queues[_0x1a05df[_0x73ef('0x48')]]=_[_0x73ef('0x58')](queues[_0x1a05df['transfereelinkedid']]);queues[_0x1a05df[_0x73ef('0x48')]]['transfereduniqueid']=_0x1a05df[_0x73ef('0x59')];queues[_0x1a05df[_0x73ef('0x48')]][_0x73ef('0x22')]=0x2;queues[_0x1a05df['transfereeuniqueid']]['calleridnum']=queues[_0x1a05df['secondtransfererlinkedid']][_0x73ef('0x8')];queues[_0x1a05df['transfereeuniqueid']][_0x73ef('0x5a')]=queues[_0x1a05df[_0x73ef('0x52')]]['calleridname'];queues[_0x1a05df[_0x73ef('0x48')]][_0x73ef('0x37')]=utils[_0x73ef('0x1d')]();queues[_0x1a05df['transfereeuniqueid']][_0x73ef('0x35')]=utils[_0x73ef('0x1d')]();queues[_0x1a05df['transfereeuniqueid']][_0x73ef('0x5b')]=0x0;queues[_0x1a05df['transfereeuniqueid']][_0x73ef('0x5c')]=0x0;utils[_0x73ef('0x2')](util[_0x73ef('0x3')](_0x73ef('0x5d'),_0x1a05df[_0x73ef('0x50')],queues[_0x1a05df['transfereeuniqueid']]['name'],queues[_0x1a05df[_0x73ef('0x48')]]['calleridnum'],queues[_0x1a05df[_0x73ef('0x48')]][_0x73ef('0x5a')]));}else{utils['info'](util[_0x73ef('0x3')](_0x73ef('0x5e'),_0x1a05df[_0x73ef('0x50')],queues[_0x1a05df[_0x73ef('0x51')]][_0x73ef('0x20')],_0x1a05df[_0x73ef('0x52')]));queues[_0x1a05df['origtransfererlinkedid']][_0x73ef('0xf')]=_0x1a05df[_0x73ef('0x52')];}}}else if(_0x1a05df[_0x73ef('0x5f')]==_0x1a05df['secondtransfererlinkedid']){if(!_[_0x73ef('0x18')](queues[_0x1a05df[_0x73ef('0x51')]])){utils['info'](util['format'](_0x73ef('0x60'),_0x1a05df[_0x73ef('0x50')],queues[_0x1a05df[_0x73ef('0x51')]][_0x73ef('0x20')],_0x1a05df[_0x73ef('0x5f')],_0x1a05df['secondtransfererexten']));queues[_0x1a05df[_0x73ef('0x51')]][_0x73ef('0x42')]=!![];queues[_0x1a05df[_0x73ef('0x51')]][_0x73ef('0x49')]='ATTENDED';queues[_0x1a05df[_0x73ef('0x51')]][_0x73ef('0x4a')]=_0x1a05df['secondtransfererexten'];queues[_0x1a05df[_0x73ef('0x51')]][_0x73ef('0x4b')]=_0x1a05df['secondtransfereruniqueid'];queues[_0x1a05df[_0x73ef('0x51')]][_0x73ef('0x9')]='ATTENDEDTRANSFER';}if(!_[_0x73ef('0x18')](queues[_0x1a05df[_0x73ef('0x52')]])){if(_0x1a05df[_0x73ef('0x61')]&&queues[_0x1a05df[_0x73ef('0x61')]]){queues[_0x1a05df[_0x73ef('0x61')]]['queuecallerenterreason']=0x1;queues[_0x1a05df[_0x73ef('0x59')]]=_[_0x73ef('0x58')](queues[_0x1a05df['transfertargetlinkedid']]);queues[_0x1a05df[_0x73ef('0x59')]][_0x73ef('0xf')]=_0x1a05df['transfertargetuniqueid'];queues[_0x1a05df[_0x73ef('0x59')]][_0x73ef('0x22')]=0x2;queues[_0x1a05df[_0x73ef('0x59')]][_0x73ef('0x8')]=queues[_0x1a05df[_0x73ef('0x51')]]['calleridnum'];queues[_0x1a05df[_0x73ef('0x59')]][_0x73ef('0x5a')]=queues[_0x1a05df[_0x73ef('0x51')]][_0x73ef('0x5a')];queues[_0x1a05df[_0x73ef('0x59')]][_0x73ef('0x37')]=utils[_0x73ef('0x1d')]();queues[_0x1a05df['transfertargetuniqueid']][_0x73ef('0x35')]=utils[_0x73ef('0x1d')]();queues[_0x1a05df[_0x73ef('0x59')]][_0x73ef('0x5b')]=0x0;queues[_0x1a05df[_0x73ef('0x59')]]['mohtime']=0x0;utils[_0x73ef('0x2')](util[_0x73ef('0x3')](_0x73ef('0x62'),_0x1a05df[_0x73ef('0x50')],queues[_0x1a05df[_0x73ef('0x59')]][_0x73ef('0x20')],queues[_0x1a05df[_0x73ef('0x59')]]['transfereduniqueid'],queues[_0x1a05df[_0x73ef('0x59')]][_0x73ef('0x8')],queues[_0x1a05df[_0x73ef('0x59')]][_0x73ef('0x5a')]));}else{utils['info'](util[_0x73ef('0x3')](_0x73ef('0x5e'),_0x1a05df[_0x73ef('0x50')],queues[_0x1a05df[_0x73ef('0x52')]][_0x73ef('0x20')],_0x1a05df[_0x73ef('0x51')]));queues[_0x1a05df[_0x73ef('0x52')]]['transfereduniqueid']=_0x1a05df['origtransfererlinkedid'];}}}}catch(_0x31a1ec){utils['error'](util['format'](_0x73ef('0x4f'),_0x1a05df[_0x73ef('0x50')]),_0x31a1ec);}};exports[_0x73ef('0x63')]=function(_0x168136){try{if(!_[_0x73ef('0x18')](queues[_0x168136[_0x73ef('0x13')]])){utils['debug'](util[_0x73ef('0x3')]('[%s][queues][musiconholdstart]',_0x168136[_0x73ef('0x13')]),_0x168136);queues[_0x168136[_0x73ef('0x13')]][_0x73ef('0x64')]=utils[_0x73ef('0x1d')]();utils['info'](util['format'](_0x73ef('0x65'),_0x168136[_0x73ef('0x13')],queues[_0x168136[_0x73ef('0x13')]][_0x73ef('0x20')],queues[_0x168136[_0x73ef('0x13')]][_0x73ef('0x64')]));}}catch(_0x3a3838){utils['error'](util[_0x73ef('0x3')]('[%s][queues][musiconholdstart]',_0x168136[_0x73ef('0x13')]),_0x3a3838);}};exports['musiconholdstop']=function(_0x432532){try{if(!_[_0x73ef('0x18')](queues[_0x432532[_0x73ef('0x13')]])){if(!_[_0x73ef('0x18')](queues[_0x432532[_0x73ef('0x13')]]['musiconholdstartAt'])){utils['debug'](util[_0x73ef('0x3')](_0x73ef('0x66'),_0x432532['uniqueid']),_0x432532);queues[_0x432532['uniqueid']][_0x73ef('0x5c')]+=utils[_0x73ef('0x36')](utils[_0x73ef('0x1d')](),queues[_0x432532[_0x73ef('0x13')]][_0x73ef('0x64')]);utils['info'](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x432532[_0x73ef('0x13')],queues[_0x432532['uniqueid']][_0x73ef('0x20')],queues[_0x432532['uniqueid']][_0x73ef('0x5c')]));delete queues[_0x432532['uniqueid']][_0x73ef('0x64')];}}}catch(_0x28cbf8){utils[_0x73ef('0x16')](util[_0x73ef('0x3')](_0x73ef('0x66'),_0x432532['uniqueid']),_0x28cbf8);}}; \ No newline at end of file +var _0xeda7=['musiconholdstop','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','position','assign','now','error','isNil','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','queuecallercompleteAt','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','holdtime','diffTime','queuecallerjoinAt','count','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','clone','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]'];(function(_0x2a84c8,_0x54502d){var _0x840d9c=function(_0x354fd1){while(--_0x354fd1){_0x2a84c8['push'](_0x2a84c8['shift']());}};_0x840d9c(++_0x54502d);}(_0xeda7,0x196));var _0x7eda=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xeda7[_0x3b0731];return _0x4204d7;};'use strict';var _=require(_0x7eda('0x0'));var util=require(_0x7eda('0x1'));var utils=require(_0x7eda('0x2'));var queues={};function writeDB(_0x241ba5){utils[_0x7eda('0x3')](util[_0x7eda('0x4')](_0x7eda('0x5'),_0x241ba5[_0x7eda('0x6')],_0x241ba5[_0x7eda('0x7')],_0x241ba5[_0x7eda('0x8')],_0x241ba5[_0x7eda('0x9')],_0x241ba5[_0x7eda('0xa')],_0x241ba5[_0x7eda('0xb')],_0x241ba5[_0x7eda('0xc')]));if(_0x241ba5[_0x7eda('0x8')]){utils[_0x7eda('0xd')](_0x241ba5[_0x7eda('0x8')])[_0x7eda('0xe')](function(_0x11576a){if(_0x11576a){_0x241ba5[_0x7eda('0xf')]=_0x11576a['type'];}utils[_0x7eda('0x10')]('CreateVoiceQueueReport',_0x241ba5);});}else{utils['request'](_0x7eda('0x11'),_0x241ba5);}if(_0x241ba5[_0x7eda('0x12')]){delete queues[_0x241ba5[_0x7eda('0x12')]];}else{delete queues[_0x241ba5[_0x7eda('0x6')]];}}exports['queuecallerjoin']=function(_0x53792a){try{utils[_0x7eda('0x13')](util[_0x7eda('0x4')](_0x7eda('0x14'),_0x53792a[_0x7eda('0x6')]),_0x53792a);utils['info'](util[_0x7eda('0x4')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x53792a[_0x7eda('0x6')],_0x53792a[_0x7eda('0x8')],_0x53792a[_0x7eda('0x15')]));queues[_0x53792a[_0x7eda('0x6')]]=_[_0x7eda('0x16')](_0x53792a,{'originalposition':_0x53792a[_0x7eda('0x15')],'queuecallerjoinAt':utils[_0x7eda('0x17')](),'mohtime':0x0});}catch(_0x237d47){utils[_0x7eda('0x18')](util['format']('[%s][queues][queuecallerjoin]',_0x53792a[_0x7eda('0x6')]),_0x237d47);}};exports['hangup']=function(_0x597ce9){try{if(!_[_0x7eda('0x19')](queues[_0x597ce9[_0x7eda('0x6')]])){utils[_0x7eda('0x13')](util[_0x7eda('0x4')](_0x7eda('0x1a'),_0x597ce9['uniqueid']),_0x597ce9);if(queues[_0x597ce9['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x597ce9[_0x7eda('0x6')]]['queuecallerabandon']&&!queues[_0x597ce9[_0x7eda('0x6')]][_0x7eda('0x1b')]){queues[_0x597ce9[_0x7eda('0x6')]][_0x7eda('0x1c')]=!![];queues[_0x597ce9['uniqueid']][_0x7eda('0x1d')]=utils[_0x7eda('0x17')]();queues[_0x597ce9[_0x7eda('0x6')]][_0x7eda('0xc')]='COMPLETEDBYAGENT';}utils['info'](util[_0x7eda('0x4')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x597ce9[_0x7eda('0x6')],queues[_0x597ce9[_0x7eda('0x6')]][_0x7eda('0x1e')],queues[_0x597ce9[_0x7eda('0x6')]][_0x7eda('0xc')]));writeDB(queues[_0x597ce9[_0x7eda('0x6')]]);}else if(queues[_0x597ce9[_0x7eda('0x6')]][_0x7eda('0x12')]){utils['info'](util[_0x7eda('0x4')](_0x7eda('0x1f'),_0x597ce9[_0x7eda('0x6')],queues[_0x597ce9['uniqueid']][_0x7eda('0x1e')],queues[_0x597ce9[_0x7eda('0x6')]][_0x7eda('0x12')]));queues[queues[_0x597ce9[_0x7eda('0x6')]][_0x7eda('0x12')]]=queues[_0x597ce9[_0x7eda('0x6')]];queues[queues[_0x597ce9[_0x7eda('0x6')]][_0x7eda('0x12')]][_0x7eda('0x20')]=0x2;delete queues[_0x597ce9[_0x7eda('0x6')]];}}}catch(_0x57ea9b){utils[_0x7eda('0x18')](util[_0x7eda('0x4')](_0x7eda('0x1a'),_0x597ce9[_0x7eda('0x6')]),_0x57ea9b);}};exports['varset']=function(_0x28aa9f){try{utils[_0x7eda('0x13')](util['format'](_0x7eda('0x21'),_0x28aa9f[_0x7eda('0x6')]),_0x28aa9f);if(!_['isNil'](_0x28aa9f[_0x7eda('0x22')][_0x7eda('0x23')])&&_0x28aa9f[_0x7eda('0x24')][_0x7eda('0x25')]()!==_0x7eda('0x26')){if(!_[_0x7eda('0x19')](queues[_0x28aa9f[_0x7eda('0x6')]])){queues[_0x28aa9f[_0x7eda('0x6')]][_0x7eda('0x27')]=![];queues[_0x28aa9f[_0x7eda('0x6')]]['queuecallerabandonAt']=null;queues[_0x28aa9f[_0x7eda('0x6')]]['queuecallerexit']=!![];queues[_0x28aa9f[_0x7eda('0x6')]][_0x7eda('0x28')]=utils[_0x7eda('0x17')]();queues[_0x28aa9f[_0x7eda('0x6')]]['queuecallerexitreason']=_0x28aa9f[_0x7eda('0x24')][_0x7eda('0x25')]();utils[_0x7eda('0x3')](util['format'](_0x7eda('0x29'),_0x28aa9f[_0x7eda('0x6')],queues[_0x28aa9f[_0x7eda('0x6')]]['name'],_0x28aa9f[_0x7eda('0x24')],queues[_0x28aa9f[_0x7eda('0x6')]][_0x7eda('0xc')]));writeDB(queues[_0x28aa9f[_0x7eda('0x6')]]);}}else if(!_['isNil'](_0x28aa9f[_0x7eda('0x22')][_0x7eda('0x2a')])){if(!_['isNil'](queues[_0x28aa9f[_0x7eda('0x6')]])&&!queues[_0x28aa9f[_0x7eda('0x6')]][_0x7eda('0x27')]){queues[_0x28aa9f[_0x7eda('0x6')]]['queuecallerabandon']=![];queues[_0x28aa9f[_0x7eda('0x6')]][_0x7eda('0x2b')]=null;queues[_0x28aa9f['uniqueid']]['queuecallerexit']=!![];queues[_0x28aa9f[_0x7eda('0x6')]][_0x7eda('0x28')]=utils['now']();queues[_0x28aa9f[_0x7eda('0x6')]][_0x7eda('0xc')]=_0x7eda('0x2c');utils[_0x7eda('0x3')](util['format']('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x28aa9f[_0x7eda('0x6')],queues[_0x28aa9f[_0x7eda('0x6')]][_0x7eda('0x1e')],_0x28aa9f[_0x7eda('0x24')],queues[_0x28aa9f['uniqueid']][_0x7eda('0xc')]));}}}catch(_0xcf604d){utils[_0x7eda('0x18')](util[_0x7eda('0x4')](_0x7eda('0x21'),_0x28aa9f[_0x7eda('0x6')]),_0xcf604d);}};exports['queuecallerabandon']=function(_0x41c87c){try{if(!_[_0x7eda('0x19')](queues[_0x41c87c[_0x7eda('0x6')]])){utils['debug'](util[_0x7eda('0x4')](_0x7eda('0x2d'),_0x41c87c[_0x7eda('0x6')]),_0x41c87c);queues[_0x41c87c[_0x7eda('0x6')]][_0x7eda('0x1b')]=![];queues[_0x41c87c[_0x7eda('0x6')]][_0x7eda('0x28')]=null;queues[_0x41c87c['uniqueid']]['queuecallerabandon']=!![];queues[_0x41c87c[_0x7eda('0x6')]][_0x7eda('0x2b')]=utils[_0x7eda('0x17')]();queues[_0x41c87c[_0x7eda('0x6')]][_0x7eda('0xc')]=_0x7eda('0x2e');utils[_0x7eda('0x3')](util[_0x7eda('0x4')](_0x7eda('0x2f'),_0x41c87c[_0x7eda('0x6')],queues[_0x41c87c[_0x7eda('0x6')]][_0x7eda('0x1e')],queues[_0x41c87c[_0x7eda('0x6')]][_0x7eda('0xc')]));}}catch(_0x5e59ce){utils[_0x7eda('0x18')](util[_0x7eda('0x4')](_0x7eda('0x2d'),_0x41c87c['uniqueid']),_0x5e59ce);}};exports[_0x7eda('0x30')]=function(_0x590984){try{if(!_[_0x7eda('0x19')](queues[_0x590984[_0x7eda('0x6')]])){utils[_0x7eda('0x13')](util[_0x7eda('0x4')]('[%s][queues][queuecallerleave]',_0x590984[_0x7eda('0x6')]),_0x590984);utils[_0x7eda('0x3')](util['format'](_0x7eda('0x31'),_0x590984['uniqueid'],queues[_0x590984[_0x7eda('0x6')]][_0x7eda('0x1e')],_0x590984[_0x7eda('0x32')],_0x590984[_0x7eda('0x33')]));queues[_0x590984['uniqueid']]['queuecallerleave']=!![];queues[_0x590984[_0x7eda('0x6')]][_0x7eda('0x34')]=utils[_0x7eda('0x17')]();queues[_0x590984[_0x7eda('0x6')]][_0x7eda('0x35')]=utils[_0x7eda('0x36')](queues[_0x590984[_0x7eda('0x6')]][_0x7eda('0x34')],queues[_0x590984[_0x7eda('0x6')]][_0x7eda('0x37')]);queues[_0x590984[_0x7eda('0x6')]]['position']=_0x590984[_0x7eda('0x15')];queues[_0x590984[_0x7eda('0x6')]][_0x7eda('0x38')]=_0x590984[_0x7eda('0x38')];queues[_0x590984[_0x7eda('0x6')]][_0x7eda('0x32')]=_0x590984['connectedlinenum'];queues[_0x590984[_0x7eda('0x6')]][_0x7eda('0x33')]=_0x590984['connectedlinename'];}}catch(_0x47530d){utils[_0x7eda('0x18')](util[_0x7eda('0x4')]('[%s][queues][queuecallerleave]',_0x590984[_0x7eda('0x6')]),_0x47530d);}};exports['agentconnect']=function(_0x389878){try{if(!_['isNil'](queues[_0x389878[_0x7eda('0x6')]])){utils[_0x7eda('0x13')](util['format'](_0x7eda('0x39'),_0x389878[_0x7eda('0x6')]),_0x389878);utils['info'](util[_0x7eda('0x4')](_0x7eda('0x3a'),_0x389878[_0x7eda('0x6')],queues[_0x389878[_0x7eda('0x6')]][_0x7eda('0x1e')],_0x389878[_0x7eda('0x3b')],_0x389878[_0x7eda('0x3c')]));queues[_0x389878[_0x7eda('0x6')]][_0x7eda('0x27')]=![];queues[_0x389878[_0x7eda('0x6')]][_0x7eda('0x27')]=![];queues[_0x389878[_0x7eda('0x6')]]['queuecallerabandonAt']=null;queues[_0x389878[_0x7eda('0x6')]]['queuecallerexit']=![];queues[_0x389878['uniqueid']][_0x7eda('0xc')]=null;queues[_0x389878[_0x7eda('0x6')]][_0x7eda('0x28')]=null;queues[_0x389878[_0x7eda('0x6')]]['assigned']=!![];queues[_0x389878[_0x7eda('0x6')]][_0x7eda('0xb')]=_0x389878[_0x7eda('0x3c')];queues[_0x389878[_0x7eda('0x6')]][_0x7eda('0x9')]=_0x389878['membername'];}}catch(_0x82c6fa){utils[_0x7eda('0x18')](util[_0x7eda('0x4')](_0x7eda('0x39'),_0x389878[_0x7eda('0x6')]),_0x82c6fa);}};exports[_0x7eda('0x3d')]=function(_0x58f95a){try{if(!_[_0x7eda('0x19')](queues[_0x58f95a[_0x7eda('0x6')]])){if(queues[_0x58f95a[_0x7eda('0x6')]][_0x7eda('0x34')]){utils[_0x7eda('0x13')](util[_0x7eda('0x4')](_0x7eda('0x3e'),_0x58f95a['uniqueid']),_0x58f95a);queues[_0x58f95a[_0x7eda('0x6')]][_0x7eda('0x27')]=![];queues[_0x58f95a[_0x7eda('0x6')]][_0x7eda('0x27')]=![];queues[_0x58f95a[_0x7eda('0x6')]][_0x7eda('0x2b')]=null;queues[_0x58f95a[_0x7eda('0x6')]][_0x7eda('0x1b')]=![];queues[_0x58f95a[_0x7eda('0x6')]][_0x7eda('0x28')]=null;queues[_0x58f95a[_0x7eda('0x6')]]['assigned']=!![];queues[_0x58f95a['uniqueid']]['lastAssignedTo']=_0x58f95a[_0x7eda('0x3b')];queues[_0x58f95a[_0x7eda('0x6')]][_0x7eda('0x1c')]=!![];queues[_0x58f95a[_0x7eda('0x6')]][_0x7eda('0x1d')]=utils[_0x7eda('0x17')]();if(_0x58f95a['reason']==_0x7eda('0x3f')){if(!queues[_0x58f95a[_0x7eda('0x6')]]['transfer']){queues[_0x58f95a['uniqueid']][_0x7eda('0xc')]=_0x7eda('0x40');}}else{queues[_0x58f95a['uniqueid']]['queuecallerexitreason']=_0x7eda('0x41')+_0x58f95a[_0x7eda('0x42')]['toUpperCase']();}utils[_0x7eda('0x3')](util[_0x7eda('0x4')](_0x7eda('0x43'),_0x58f95a['uniqueid'],queues[_0x58f95a[_0x7eda('0x6')]][_0x7eda('0x1e')],_0x58f95a[_0x7eda('0x3b')],queues[_0x58f95a[_0x7eda('0x6')]][_0x7eda('0xc')]));writeDB(queues[_0x58f95a[_0x7eda('0x6')]]);}}}catch(_0x11bd58){utils[_0x7eda('0x18')](util[_0x7eda('0x4')]('[%s][queues][agentcomplete]',_0x58f95a[_0x7eda('0x6')]),_0x11bd58);}};exports[_0x7eda('0x44')]=function(_0x91d708){try{if(!_[_0x7eda('0x19')](queues[_0x91d708[_0x7eda('0x45')]])){utils['debug'](util[_0x7eda('0x4')](_0x7eda('0x46'),_0x91d708[_0x7eda('0x6')]),_0x91d708);queues[_0x91d708[_0x7eda('0x45')]][_0x7eda('0x3f')]=!![];queues[_0x91d708['transfereeuniqueid']][_0x7eda('0x47')]='BLIND';queues[_0x91d708['transfereeuniqueid']][_0x7eda('0x48')]=_0x91d708['extension'];queues[_0x91d708[_0x7eda('0x45')]][_0x7eda('0x49')]=_0x91d708[_0x7eda('0x45')];queues[_0x91d708[_0x7eda('0x45')]][_0x7eda('0xc')]=_0x7eda('0x4a');utils['info'](util[_0x7eda('0x4')](_0x7eda('0x4b'),_0x91d708[_0x7eda('0x6')],queues[_0x91d708['transfereeuniqueid']]['name'],_0x91d708[_0x7eda('0x45')],_0x91d708[_0x7eda('0x4c')]));}}catch(_0x578134){utils[_0x7eda('0x18')](util[_0x7eda('0x4')](_0x7eda('0x46'),_0x91d708[_0x7eda('0x6')]),_0x578134);}};exports[_0x7eda('0x4d')]=function(_0x27e81f){try{utils[_0x7eda('0x13')](util[_0x7eda('0x4')](_0x7eda('0x4e'),_0x27e81f[_0x7eda('0x4f')]),_0x27e81f);if(_0x27e81f['origtransfereruniqueid']==_0x27e81f['origtransfererlinkedid']){if(!_[_0x7eda('0x19')](queues[_0x27e81f[_0x7eda('0x50')]])){utils['info'](util['format'](_0x7eda('0x51'),_0x27e81f[_0x7eda('0x4f')],queues[_0x27e81f['secondtransfererlinkedid']]['name'],_0x27e81f[_0x7eda('0x52')]));queues[_0x27e81f[_0x7eda('0x50')]]['transfer']=!![];queues[_0x27e81f['secondtransfererlinkedid']]['transfertype']=_0x7eda('0x53');queues[_0x27e81f[_0x7eda('0x50')]][_0x7eda('0x48')]=_0x27e81f[_0x7eda('0x52')];queues[_0x27e81f[_0x7eda('0x50')]][_0x7eda('0x49')]=_0x27e81f[_0x7eda('0x4f')];queues[_0x27e81f[_0x7eda('0x50')]][_0x7eda('0xc')]=_0x7eda('0x54');}if(!_[_0x7eda('0x19')](queues[_0x27e81f[_0x7eda('0x55')]])){if(_0x27e81f[_0x7eda('0x56')]&&queues[_0x27e81f['transfereelinkedid']]){queues[_0x27e81f[_0x7eda('0x56')]][_0x7eda('0x20')]=0x1;queues[_0x27e81f[_0x7eda('0x45')]]=_['clone'](queues[_0x27e81f[_0x7eda('0x56')]]);queues[_0x27e81f[_0x7eda('0x45')]][_0x7eda('0x12')]=_0x27e81f[_0x7eda('0x57')];queues[_0x27e81f[_0x7eda('0x45')]][_0x7eda('0x20')]=0x2;queues[_0x27e81f['transfereeuniqueid']][_0x7eda('0xa')]=queues[_0x27e81f[_0x7eda('0x50')]]['calleridnum'];queues[_0x27e81f[_0x7eda('0x45')]][_0x7eda('0x58')]=queues[_0x27e81f[_0x7eda('0x50')]][_0x7eda('0x58')];queues[_0x27e81f[_0x7eda('0x45')]]['queuecallerjoinAt']=utils[_0x7eda('0x17')]();queues[_0x27e81f[_0x7eda('0x45')]][_0x7eda('0x34')]=utils[_0x7eda('0x17')]();queues[_0x27e81f['transfereeuniqueid']]['holdtime']=0x0;queues[_0x27e81f['transfereeuniqueid']][_0x7eda('0x59')]=0x0;utils['info'](util[_0x7eda('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x27e81f[_0x7eda('0x4f')],queues[_0x27e81f['transfereeuniqueid']][_0x7eda('0x1e')],queues[_0x27e81f[_0x7eda('0x45')]][_0x7eda('0xa')],queues[_0x27e81f[_0x7eda('0x45')]][_0x7eda('0x58')]));}else{utils[_0x7eda('0x3')](util[_0x7eda('0x4')](_0x7eda('0x5a'),_0x27e81f[_0x7eda('0x4f')],queues[_0x27e81f[_0x7eda('0x55')]][_0x7eda('0x1e')],_0x27e81f['secondtransfererlinkedid']));queues[_0x27e81f['origtransfererlinkedid']][_0x7eda('0x12')]=_0x27e81f[_0x7eda('0x50')];}}}else if(_0x27e81f[_0x7eda('0x5b')]==_0x27e81f[_0x7eda('0x50')]){if(!_['isNil'](queues[_0x27e81f[_0x7eda('0x55')]])){utils[_0x7eda('0x3')](util[_0x7eda('0x4')](_0x7eda('0x5c'),_0x27e81f['origtransfereruniqueid'],queues[_0x27e81f[_0x7eda('0x55')]][_0x7eda('0x1e')],_0x27e81f['secondtransfereruniqueid'],_0x27e81f[_0x7eda('0x5d')]));queues[_0x27e81f['origtransfererlinkedid']][_0x7eda('0x3f')]=!![];queues[_0x27e81f[_0x7eda('0x55')]]['transfertype']=_0x7eda('0x53');queues[_0x27e81f['origtransfererlinkedid']][_0x7eda('0x48')]=_0x27e81f['secondtransfererexten'];queues[_0x27e81f['origtransfererlinkedid']]['transferuniqueid']=_0x27e81f['secondtransfereruniqueid'];queues[_0x27e81f[_0x7eda('0x55')]][_0x7eda('0xc')]=_0x7eda('0x54');}if(!_[_0x7eda('0x19')](queues[_0x27e81f[_0x7eda('0x50')]])){if(_0x27e81f['transfertargetlinkedid']&&queues[_0x27e81f[_0x7eda('0x5e')]]){queues[_0x27e81f[_0x7eda('0x5e')]][_0x7eda('0x20')]=0x1;queues[_0x27e81f[_0x7eda('0x57')]]=_[_0x7eda('0x5f')](queues[_0x27e81f['transfertargetlinkedid']]);queues[_0x27e81f['transfertargetuniqueid']][_0x7eda('0x12')]=_0x27e81f['transfertargetuniqueid'];queues[_0x27e81f['transfertargetuniqueid']][_0x7eda('0x20')]=0x2;queues[_0x27e81f[_0x7eda('0x57')]][_0x7eda('0xa')]=queues[_0x27e81f[_0x7eda('0x55')]][_0x7eda('0xa')];queues[_0x27e81f[_0x7eda('0x57')]][_0x7eda('0x58')]=queues[_0x27e81f[_0x7eda('0x55')]]['calleridname'];queues[_0x27e81f['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0x7eda('0x17')]();queues[_0x27e81f[_0x7eda('0x57')]][_0x7eda('0x34')]=utils['now']();queues[_0x27e81f[_0x7eda('0x57')]]['holdtime']=0x0;queues[_0x27e81f['transfertargetuniqueid']]['mohtime']=0x0;utils[_0x7eda('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x27e81f[_0x7eda('0x4f')],queues[_0x27e81f[_0x7eda('0x57')]]['name'],queues[_0x27e81f[_0x7eda('0x57')]][_0x7eda('0x12')],queues[_0x27e81f[_0x7eda('0x57')]][_0x7eda('0xa')],queues[_0x27e81f['transfertargetuniqueid']]['calleridname']));}else{utils[_0x7eda('0x3')](util[_0x7eda('0x4')](_0x7eda('0x5a'),_0x27e81f[_0x7eda('0x4f')],queues[_0x27e81f[_0x7eda('0x50')]][_0x7eda('0x1e')],_0x27e81f['origtransfererlinkedid']));queues[_0x27e81f[_0x7eda('0x50')]][_0x7eda('0x12')]=_0x27e81f[_0x7eda('0x55')];}}}}catch(_0xb988f2){utils[_0x7eda('0x18')](util[_0x7eda('0x4')](_0x7eda('0x4e'),_0x27e81f[_0x7eda('0x4f')]),_0xb988f2);}};exports['musiconholdstart']=function(_0x312265){try{if(!_[_0x7eda('0x19')](queues[_0x312265[_0x7eda('0x6')]])){utils['debug'](util[_0x7eda('0x4')]('[%s][queues][musiconholdstart]',_0x312265['uniqueid']),_0x312265);queues[_0x312265[_0x7eda('0x6')]][_0x7eda('0x60')]=utils[_0x7eda('0x17')]();utils['info'](util[_0x7eda('0x4')](_0x7eda('0x61'),_0x312265[_0x7eda('0x6')],queues[_0x312265['uniqueid']][_0x7eda('0x1e')],queues[_0x312265[_0x7eda('0x6')]][_0x7eda('0x60')]));}}catch(_0x1269ec){utils[_0x7eda('0x18')](util[_0x7eda('0x4')](_0x7eda('0x62'),_0x312265['uniqueid']),_0x1269ec);}};exports[_0x7eda('0x63')]=function(_0x5470a6){try{if(!_['isNil'](queues[_0x5470a6[_0x7eda('0x6')]])){if(!_[_0x7eda('0x19')](queues[_0x5470a6[_0x7eda('0x6')]][_0x7eda('0x60')])){utils[_0x7eda('0x13')](util[_0x7eda('0x4')](_0x7eda('0x64'),_0x5470a6['uniqueid']),_0x5470a6);queues[_0x5470a6[_0x7eda('0x6')]]['mohtime']+=utils[_0x7eda('0x36')](utils[_0x7eda('0x17')](),queues[_0x5470a6[_0x7eda('0x6')]][_0x7eda('0x60')]);utils['info'](util[_0x7eda('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x5470a6[_0x7eda('0x6')],queues[_0x5470a6[_0x7eda('0x6')]][_0x7eda('0x1e')],queues[_0x5470a6[_0x7eda('0x6')]]['mohtime']));delete queues[_0x5470a6[_0x7eda('0x6')]][_0x7eda('0x60')];}}}catch(_0x364693){utils[_0x7eda('0x18')](util[_0x7eda('0x4')](_0x7eda('0x64'),_0x5470a6['uniqueid']),_0x364693);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 92f670b..8a43f82 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 _0xa1aa=['set','startsWith','split','substring','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','[%s][recordings][queuecallerjoin]','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','then','membername','name','CreateVoiceRecording','request','debug','[%s][recordings][newchannel]','linkedid','context','exten','channel','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','value','.wav49','replace','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','error','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase'];(function(_0x446330,_0x2c8a47){var _0x8813ad=function(_0x304c99){while(--_0x304c99){_0x446330['push'](_0x446330['shift']());}};_0x8813ad(++_0x2c8a47);}(_0xa1aa,0x81));var _0xaa1a=function(_0x3570b8,_0x198e02){_0x3570b8=_0x3570b8-0x0;var _0xf481e6=_0xa1aa[_0x3570b8];return _0xf481e6;};'use strict';var _=require(_0xaa1a('0x0'));var util=require(_0xaa1a('0x1'));var utils=require(_0xaa1a('0x2'));var recordings={};function writeDB(_0x4823e4){utils[_0xaa1a('0x3')](util[_0xaa1a('0x4')](_0xaa1a('0x5'),_0x4823e4[_0xaa1a('0x6')]));if(_0x4823e4[_0xaa1a('0x7')]){utils['getUserByInternal'](_0x4823e4[_0xaa1a('0x7')])[_0xaa1a('0x8')](function(_0x4d916c){if(_0x4d916c){_0x4823e4[_0xaa1a('0x9')]=_0x4d916c[_0xaa1a('0xa')];_0x4823e4['UserId']=_0x4d916c['id'];}utils['request'](_0xaa1a('0xb'),_0x4823e4);});}else{utils[_0xaa1a('0xc')](_0xaa1a('0xb'),_0x4823e4);}}exports['newchannel']=function(_0x15b73b){try{utils[_0xaa1a('0xd')](util[_0xaa1a('0x4')](_0xaa1a('0xe'),_0x15b73b['uniqueid']),_0x15b73b);if(_0x15b73b[_0xaa1a('0x6')]==_0x15b73b[_0xaa1a('0xf')]){utils[_0xaa1a('0x3')](util[_0xaa1a('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x15b73b['uniqueid'],_0x15b73b[_0xaa1a('0x10')],_0x15b73b[_0xaa1a('0x11')]));recordings[_0x15b73b['uniqueid']]={'uniqueid':_0x15b73b['uniqueid'],'accountcode':_0x15b73b[_0xaa1a('0x7')],'exten':_0x15b73b['exten'],'context':_0x15b73b['context'],'channel':_0x15b73b[_0xaa1a('0x12')],'monitors':[]};}}catch(_0x535d7d){utils['error'](util[_0xaa1a('0x4')](_0xaa1a('0xe'),_0x15b73b['uniqueid']),_0x535d7d);}};exports['newstate']=function(_0x615231){try{utils['debug'](util[_0xaa1a('0x4')](_0xaa1a('0x13'),_0x615231[_0xaa1a('0x6')]),_0x615231);if(!_[_0xaa1a('0x14')](recordings[_0x615231[_0xaa1a('0x6')]])&&_0x615231[_0xaa1a('0x15')]==0x6){utils['info'](util[_0xaa1a('0x4')](_0xaa1a('0x16'),_0x615231[_0xaa1a('0x6')],_0x615231[_0xaa1a('0x10')],_0x615231[_0xaa1a('0x12')]));}else if(!_[_0xaa1a('0x14')](recordings[_0x615231[_0xaa1a('0xf')]])&&_0x615231['channelstate']==0x6&&_0x615231[_0xaa1a('0x10')]!=_0xaa1a('0x17')){utils['info'](util[_0xaa1a('0x4')](_0xaa1a('0x18'),_0x615231[_0xaa1a('0x6')],_0x615231[_0xaa1a('0xf')],_0x615231['context'],_0x615231[_0xaa1a('0x12')]));recordings[_0x615231[_0xaa1a('0xf')]][_0xaa1a('0x7')]=_0x615231['accountcode'];}}catch(_0x340cde){utils['error'](util[_0xaa1a('0x4')]('[%s][recordings][newstate]',_0x615231[_0xaa1a('0x6')]),_0x340cde);}};exports[_0xaa1a('0x19')]=function(_0x4edcff){try{if(!_[_0xaa1a('0x14')](_0x4edcff[_0xaa1a('0x1a')])&&!_[_0xaa1a('0x14')](_0x4edcff[_0xaa1a('0x1a')][_0xaa1a('0x1b')])){utils[_0xaa1a('0xd')](util[_0xaa1a('0x4')]('[%s][recordings][varset]',_0x4edcff['uniqueid']),_0x4edcff);utils[_0xaa1a('0x3')](util['format'](_0xaa1a('0x1c'),_0x4edcff[_0xaa1a('0x6')],_0x4edcff[_0xaa1a('0x1a')],_0x4edcff['value']));if(_[_0xaa1a('0x1d')](_0x4edcff[_0xaa1a('0x1e')],_0xaa1a('0x1f'))){_0x4edcff['value']=_0x4edcff[_0xaa1a('0x1e')][_0xaa1a('0x20')](_0xaa1a('0x1f'),'.WAV');}if(recordings[_0x4edcff[_0xaa1a('0xf')]]){var _0x2577a5=_['find'](recordings[_0x4edcff[_0xaa1a('0xf')]][_0xaa1a('0x21')],{'value':_0x4edcff[_0xaa1a('0x1e')]});if(_[_0xaa1a('0x14')](_0x2577a5)){recordings[_0x4edcff[_0xaa1a('0xf')]]['monitors'][_0xaa1a('0x22')]({'value':_0x4edcff[_0xaa1a('0x1e')]});}}}}catch(_0x1d2758){utils['error'](util[_0xaa1a('0x4')](_0xaa1a('0x23'),_0x4edcff[_0xaa1a('0x6')]),_0x1d2758);}};exports[_0xaa1a('0x24')]=function(_0x422ed5){try{if(!_[_0xaa1a('0x14')](recordings[_0x422ed5[_0xaa1a('0x6')]])){utils[_0xaa1a('0xd')](util['format'](_0xaa1a('0x25'),_0x422ed5[_0xaa1a('0x6')]),_0x422ed5);utils['info'](util[_0xaa1a('0x4')](_0xaa1a('0x26'),_0x422ed5['uniqueid'],_0x422ed5['calleridnum'],_0x422ed5['calleridname'],_0x422ed5['cause-txt']));recordings[_0x422ed5[_0xaa1a('0x6')]]['calleridnum']=_0x422ed5[_0xaa1a('0x27')];recordings[_0x422ed5[_0xaa1a('0x6')]][_0xaa1a('0x28')]=_0x422ed5[_0xaa1a('0x28')];recordings[_0x422ed5[_0xaa1a('0x6')]][_0xaa1a('0x29')]=_0x422ed5[_0xaa1a('0x29')];recordings[_0x422ed5[_0xaa1a('0x6')]][_0xaa1a('0x2a')]=_0x422ed5[_0xaa1a('0x2a')];if(recordings[_0x422ed5[_0xaa1a('0x6')]][_0xaa1a('0x2b')]==_0xaa1a('0x2c')&&recordings[_0x422ed5[_0xaa1a('0x6')]][_0xaa1a('0x7')]){recordings[_0x422ed5[_0xaa1a('0x6')]][_0xaa1a('0x29')]=recordings[_0x422ed5[_0xaa1a('0x6')]][_0xaa1a('0x7')];recordings[_0x422ed5[_0xaa1a('0x6')]]['connectedlinename']='';}recordings[_0x422ed5['uniqueid']][_0xaa1a('0x21')][_0xaa1a('0x2d')](function(_0x1f91aa){var _0x5ebf9e=_[_0xaa1a('0x2e')](recordings[_0x422ed5['uniqueid']]);_0x5ebf9e[_0xaa1a('0x1e')]=_0x1f91aa[_0xaa1a('0x1e')];writeDB(_0x5ebf9e);});delete recordings[_0x422ed5[_0xaa1a('0x6')]];}}catch(_0x56272f){utils[_0xaa1a('0x2f')](util['format'](_0xaa1a('0x25'),_0x422ed5[_0xaa1a('0x6')]),_0x56272f);}};exports[_0xaa1a('0x30')]=function(_0x1bb11b){try{if(!_[_0xaa1a('0x14')](recordings[_0x1bb11b[_0xaa1a('0x6')]])){utils['debug'](util[_0xaa1a('0x4')](_0xaa1a('0x31'),_0x1bb11b[_0xaa1a('0x6')]),_0x1bb11b);utils['info'](util[_0xaa1a('0x4')](_0xaa1a('0x32'),_0x1bb11b['uniqueid'],_0x1bb11b[_0xaa1a('0x33')],_0x1bb11b[_0xaa1a('0x34')]));if(_0x1bb11b['application'][_0xaa1a('0x35')]()==_0xaa1a('0x36')&&_[_0xaa1a('0x37')](_0x1bb11b[_0xaa1a('0x34')][_0xaa1a('0x35')](),'cdr')){var _0x369768=_0x1bb11b['appdata'][_0xaa1a('0x38')]('=');var _0x49dd38=_0x369768[0x0][_0xaa1a('0x39')](_0x369768[0x0]['lastIndexOf']('(')+0x1,_0x369768[0x0]['lastIndexOf'](')'));var _0x382113=_0x369768[0x1];recordings[_0x1bb11b[_0xaa1a('0x6')]][_0x49dd38]=_0x382113;}}}catch(_0x1a105b){utils[_0xaa1a('0x2f')](util['format'](_0xaa1a('0x31'),_0x1bb11b['uniqueid']),_0x1a105b);}};exports[_0xaa1a('0x3a')]=function(_0x4626e7){try{if(!_[_0xaa1a('0x14')](recordings[_0x4626e7['uniqueid']])){utils[_0xaa1a('0xd')](util[_0xaa1a('0x4')]('[%s][recordings][queuecallerjoin]',_0x4626e7['uniqueid']),_0x4626e7);utils[_0xaa1a('0x3')](util[_0xaa1a('0x4')](_0xaa1a('0x3b'),_0x4626e7[_0xaa1a('0x6')],_0x4626e7['queue']));recordings[_0x4626e7[_0xaa1a('0x6')]]['queue']=_0x4626e7['queue'];}}catch(_0xc4d2c0){utils[_0xaa1a('0x2f')](util['format'](_0xaa1a('0x3c'),_0x4626e7[_0xaa1a('0x6')]),_0xc4d2c0);}}; \ No newline at end of file +var _0xa095=['[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','format','[%s][recordings][writeDB]','uniqueid','accountcode','then','membername','name','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','info','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','cause-txt','calleridnum','calleridname','connectedlinenum','connectedlinename','type','forEach','clone','newexten','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]'];(function(_0xf8c6a9,_0x1ecbd9){var _0x12aeaa=function(_0x31745e){while(--_0x31745e){_0xf8c6a9['push'](_0xf8c6a9['shift']());}};_0x12aeaa(++_0x1ecbd9);}(_0xa095,0x7c));var _0x5a09=function(_0x8b8564,_0x162976){_0x8b8564=_0x8b8564-0x0;var _0x360c61=_0xa095[_0x8b8564];return _0x360c61;};'use strict';var _=require(_0x5a09('0x0'));var util=require(_0x5a09('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x3040be){utils['info'](util[_0x5a09('0x2')](_0x5a09('0x3'),_0x3040be[_0x5a09('0x4')]));if(_0x3040be[_0x5a09('0x5')]){utils['getUserByInternal'](_0x3040be[_0x5a09('0x5')])[_0x5a09('0x6')](function(_0x25edc3){if(_0x25edc3){_0x3040be[_0x5a09('0x7')]=_0x25edc3[_0x5a09('0x8')];_0x3040be['UserId']=_0x25edc3['id'];}utils['request']('CreateVoiceRecording',_0x3040be);});}else{utils[_0x5a09('0x9')](_0x5a09('0xa'),_0x3040be);}}exports[_0x5a09('0xb')]=function(_0x305724){try{utils[_0x5a09('0xc')](util[_0x5a09('0x2')](_0x5a09('0xd'),_0x305724[_0x5a09('0x4')]),_0x305724);if(_0x305724[_0x5a09('0x4')]==_0x305724[_0x5a09('0xe')]){utils[_0x5a09('0xf')](util[_0x5a09('0x2')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x305724[_0x5a09('0x4')],_0x305724[_0x5a09('0x10')],_0x305724[_0x5a09('0x11')]));recordings[_0x305724['uniqueid']]={'uniqueid':_0x305724[_0x5a09('0x4')],'accountcode':_0x305724['accountcode'],'exten':_0x305724[_0x5a09('0x11')],'context':_0x305724[_0x5a09('0x10')],'channel':_0x305724[_0x5a09('0x12')],'monitors':[]};}}catch(_0x2bf0a5){utils[_0x5a09('0x13')](util['format'](_0x5a09('0xd'),_0x305724[_0x5a09('0x4')]),_0x2bf0a5);}};exports[_0x5a09('0x14')]=function(_0x1cb5c0){try{utils[_0x5a09('0xc')](util[_0x5a09('0x2')](_0x5a09('0x15'),_0x1cb5c0[_0x5a09('0x4')]),_0x1cb5c0);if(!_[_0x5a09('0x16')](recordings[_0x1cb5c0['uniqueid']])&&_0x1cb5c0[_0x5a09('0x17')]==0x6){utils['info'](util[_0x5a09('0x2')](_0x5a09('0x18'),_0x1cb5c0[_0x5a09('0x4')],_0x1cb5c0[_0x5a09('0x10')],_0x1cb5c0[_0x5a09('0x12')]));}else if(!_[_0x5a09('0x16')](recordings[_0x1cb5c0[_0x5a09('0xe')]])&&_0x1cb5c0[_0x5a09('0x17')]==0x6&&_0x1cb5c0[_0x5a09('0x10')]!='transfer'){utils['info'](util['format']('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x1cb5c0[_0x5a09('0x4')],_0x1cb5c0['linkedid'],_0x1cb5c0['context'],_0x1cb5c0[_0x5a09('0x12')]));recordings[_0x1cb5c0['linkedid']][_0x5a09('0x5')]=_0x1cb5c0[_0x5a09('0x5')];}}catch(_0xb83db5){utils[_0x5a09('0x13')](util[_0x5a09('0x2')](_0x5a09('0x15'),_0x1cb5c0[_0x5a09('0x4')]),_0xb83db5);}};exports[_0x5a09('0x19')]=function(_0x42338d){try{if(!_[_0x5a09('0x16')](_0x42338d[_0x5a09('0x1a')])&&!_['isNil'](_0x42338d[_0x5a09('0x1a')][_0x5a09('0x1b')])){utils[_0x5a09('0xc')](util['format'](_0x5a09('0x1c'),_0x42338d['uniqueid']),_0x42338d);utils[_0x5a09('0xf')](util[_0x5a09('0x2')](_0x5a09('0x1d'),_0x42338d[_0x5a09('0x4')],_0x42338d[_0x5a09('0x1a')],_0x42338d[_0x5a09('0x1e')]));if(_[_0x5a09('0x1f')](_0x42338d[_0x5a09('0x1e')],_0x5a09('0x20'))){_0x42338d[_0x5a09('0x1e')]=_0x42338d['value'][_0x5a09('0x21')](_0x5a09('0x20'),_0x5a09('0x22'));}if(recordings[_0x42338d[_0x5a09('0xe')]]){var _0x3486df=_['find'](recordings[_0x42338d[_0x5a09('0xe')]][_0x5a09('0x23')],{'value':_0x42338d[_0x5a09('0x1e')]});if(_[_0x5a09('0x16')](_0x3486df)){recordings[_0x42338d[_0x5a09('0xe')]]['monitors'][_0x5a09('0x24')]({'value':_0x42338d[_0x5a09('0x1e')]});}}}}catch(_0x3571c3){utils[_0x5a09('0x13')](util[_0x5a09('0x2')](_0x5a09('0x1c'),_0x42338d[_0x5a09('0x4')]),_0x3571c3);}};exports[_0x5a09('0x25')]=function(_0x5f3547){try{if(!_[_0x5a09('0x16')](recordings[_0x5f3547['uniqueid']])){utils[_0x5a09('0xc')](util['format'](_0x5a09('0x26'),_0x5f3547[_0x5a09('0x4')]),_0x5f3547);utils['info'](util[_0x5a09('0x2')](_0x5a09('0x27'),_0x5f3547['uniqueid'],_0x5f3547['calleridnum'],_0x5f3547['calleridname'],_0x5f3547[_0x5a09('0x28')]));recordings[_0x5f3547[_0x5a09('0x4')]][_0x5a09('0x29')]=_0x5f3547[_0x5a09('0x29')];recordings[_0x5f3547[_0x5a09('0x4')]][_0x5a09('0x2a')]=_0x5f3547['calleridname'];recordings[_0x5f3547[_0x5a09('0x4')]][_0x5a09('0x2b')]=_0x5f3547[_0x5a09('0x2b')];recordings[_0x5f3547['uniqueid']][_0x5a09('0x2c')]=_0x5f3547[_0x5a09('0x2c')];if(recordings[_0x5f3547['uniqueid']][_0x5a09('0x2d')]=='outbound'&&recordings[_0x5f3547['uniqueid']][_0x5a09('0x5')]){recordings[_0x5f3547[_0x5a09('0x4')]][_0x5a09('0x2b')]=recordings[_0x5f3547[_0x5a09('0x4')]][_0x5a09('0x5')];recordings[_0x5f3547[_0x5a09('0x4')]][_0x5a09('0x2c')]='';}recordings[_0x5f3547['uniqueid']][_0x5a09('0x23')][_0x5a09('0x2e')](function(_0x62d653){var _0x44a386=_[_0x5a09('0x2f')](recordings[_0x5f3547['uniqueid']]);_0x44a386[_0x5a09('0x1e')]=_0x62d653['value'];writeDB(_0x44a386);});delete recordings[_0x5f3547[_0x5a09('0x4')]];}}catch(_0x89c002){utils[_0x5a09('0x13')](util[_0x5a09('0x2')](_0x5a09('0x26'),_0x5f3547[_0x5a09('0x4')]),_0x89c002);}};exports[_0x5a09('0x30')]=function(_0x3f4405){try{if(!_[_0x5a09('0x16')](recordings[_0x3f4405['uniqueid']])){utils[_0x5a09('0xc')](util['format']('[%s][recordings][newexten]',_0x3f4405[_0x5a09('0x4')]),_0x3f4405);utils[_0x5a09('0xf')](util[_0x5a09('0x2')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x3f4405[_0x5a09('0x4')],_0x3f4405['application'],_0x3f4405[_0x5a09('0x31')]));if(_0x3f4405['application'][_0x5a09('0x32')]()==_0x5a09('0x33')&&_[_0x5a09('0x34')](_0x3f4405['appdata']['toLowerCase'](),_0x5a09('0x35'))){var _0x438823=_0x3f4405['appdata']['split']('=');var _0x26a36b=_0x438823[0x0][_0x5a09('0x36')](_0x438823[0x0]['lastIndexOf']('(')+0x1,_0x438823[0x0][_0x5a09('0x37')](')'));var _0x1f6f6c=_0x438823[0x1];recordings[_0x3f4405['uniqueid']][_0x26a36b]=_0x1f6f6c;}}}catch(_0x294fdd){utils[_0x5a09('0x13')](util[_0x5a09('0x2')](_0x5a09('0x38'),_0x3f4405[_0x5a09('0x4')]),_0x294fdd);}};exports[_0x5a09('0x39')]=function(_0x4627ad){try{if(!_[_0x5a09('0x16')](recordings[_0x4627ad['uniqueid']])){utils[_0x5a09('0xc')](util[_0x5a09('0x2')](_0x5a09('0x3a'),_0x4627ad[_0x5a09('0x4')]),_0x4627ad);utils['info'](util[_0x5a09('0x2')](_0x5a09('0x3b'),_0x4627ad[_0x5a09('0x4')],_0x4627ad['queue']));recordings[_0x4627ad[_0x5a09('0x4')]][_0x5a09('0x3c')]=_0x4627ad[_0x5a09('0x3c')];}}catch(_0x52364a){utils[_0x5a09('0x13')](util[_0x5a09('0x2')](_0x5a09('0x3a'),_0x4627ad[_0x5a09('0x4')]),_0x52364a);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 44847f3..442f0e2 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 _0xb714=['[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','error','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','format','[%s][transfers][blindtransfer]'];(function(_0x1a87b3,_0x45ba68){var _0x37e84d=function(_0x39f49e){while(--_0x39f49e){_0x1a87b3['push'](_0x1a87b3['shift']());}};_0x37e84d(++_0x45ba68);}(_0xb714,0xe4));var _0x4b71=function(_0x4045ff,_0x46cbcd){_0x4045ff=_0x4045ff-0x0;var _0x5797ac=_0xb714[_0x4045ff];return _0x5797ac;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');function writeDB(_0x443a8a){utils[_0x4b71('0x0')](util['format'](_0x4b71('0x1'),_0x443a8a[_0x4b71('0x2')]===_0x4b71('0x3')?_0x443a8a[_0x4b71('0x4')]:_0x443a8a[_0x4b71('0x5')],_0x443a8a[_0x4b71('0x2')]));utils[_0x4b71('0x6')](_0x4b71('0x7'),_0x443a8a);}exports[_0x4b71('0x8')]=function(_0x5dd8e8){try{utils[_0x4b71('0x9')](util[_0x4b71('0xa')](_0x4b71('0xb'),_0x5dd8e8['uniqueid']),_0x5dd8e8);utils[_0x4b71('0x0')](util[_0x4b71('0xa')](_0x4b71('0xc'),_0x5dd8e8[_0x4b71('0x5')],_0x5dd8e8[_0x4b71('0xd')],_0x5dd8e8[_0x4b71('0xe')],_0x5dd8e8['transfereecalleridnum'],_0x5dd8e8[_0x4b71('0xf')]));_0x5dd8e8['type']='blind';writeDB(_0x5dd8e8);}catch(_0x19c5bf){utils[_0x4b71('0x10')](util[_0x4b71('0xa')]('[%s][transfers][blindtransfer]',_0x5dd8e8['uniqueid']),_0x19c5bf);}};exports[_0x4b71('0x11')]=function(_0x4279ed){try{utils[_0x4b71('0x9')](util['format']('[%s][transfers][attendedtransfer]',_0x4279ed[_0x4b71('0x4')]),_0x4279ed);utils[_0x4b71('0x0')](util['format'](_0x4b71('0x12'),_0x4279ed[_0x4b71('0x4')],_0x4279ed['origtransferercalleridnum'],_0x4279ed[_0x4b71('0x13')],_0x4279ed[_0x4b71('0x14')],_0x4279ed['transfertargetcalleridname']));_0x4279ed=_[_0x4b71('0x15')](_0x4279ed,{'transfererchannel':_0x4279ed[_0x4b71('0x16')],'transferercalleridnum':_0x4279ed[_0x4b71('0x17')],'transferercalleridname':_0x4279ed['origtransferercalleridname'],'transfererconnectedlinenum':_0x4279ed['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x4279ed[_0x4b71('0x18')],'transfereraccountcode':_0x4279ed[_0x4b71('0x19')],'transferercontext':_0x4279ed[_0x4b71('0x1a')],'transfererexten':_0x4279ed[_0x4b71('0x1b')],'transfererlinkedid':_0x4279ed[_0x4b71('0x1c')],'context':_0x4279ed[_0x4b71('0x1d')],'extension':_0x4279ed[_0x4b71('0x1e')],'type':_0x4b71('0x3')});if(_['isNil'](_0x4279ed['transfereechannel'])){_0x4279ed=_['assign'](_0x4279ed,{'transfereechannel':_0x4279ed[_0x4b71('0x1f')],'transfereecalleridnum':_0x4279ed[_0x4b71('0x14')],'transfereecalleridname':_0x4279ed[_0x4b71('0x20')],'transfereeconnectedlinenum':_0x4279ed[_0x4b71('0x21')],'transfereeconnectedlinename':_0x4279ed[_0x4b71('0x22')],'transfereeaccountcode':_0x4279ed[_0x4b71('0x23')],'transfereecontext':_0x4279ed[_0x4b71('0x24')],'transfereeexten':_0x4279ed[_0x4b71('0x25')],'transfereelinkedid':_0x4279ed[_0x4b71('0x26')]});}writeDB(_0x4279ed);}catch(_0x5eea90){utils[_0x4b71('0x10')](util[_0x4b71('0xa')](_0x4b71('0x27'),_0x4279ed[_0x4b71('0x4')]),_0x5eea90);}}; \ No newline at end of file +var _0x4fcf=['transfereechannel','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blindtransfer','debug','format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridname','blind','error','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','isNil'];(function(_0x545a17,_0x5572b7){var _0x155697=function(_0x48d39e){while(--_0x48d39e){_0x545a17['push'](_0x545a17['shift']());}};_0x155697(++_0x5572b7);}(_0x4fcf,0xca));var _0xf4fc=function(_0x4bb94e,_0x58f514){_0x4bb94e=_0x4bb94e-0x0;var _0x31c803=_0x4fcf[_0x4bb94e];return _0x31c803;};'use strict';var _=require(_0xf4fc('0x0'));var util=require('util');var utils=require(_0xf4fc('0x1'));function writeDB(_0x1c0389){utils[_0xf4fc('0x2')](util['format'](_0xf4fc('0x3'),_0x1c0389[_0xf4fc('0x4')]===_0xf4fc('0x5')?_0x1c0389[_0xf4fc('0x6')]:_0x1c0389[_0xf4fc('0x7')],_0x1c0389[_0xf4fc('0x4')]));utils['request'](_0xf4fc('0x8'),_0x1c0389);}exports[_0xf4fc('0x9')]=function(_0x5abf70){try{utils[_0xf4fc('0xa')](util[_0xf4fc('0xb')](_0xf4fc('0xc'),_0x5abf70[_0xf4fc('0x7')]),_0x5abf70);utils[_0xf4fc('0x2')](util['format'](_0xf4fc('0xd'),_0x5abf70[_0xf4fc('0x7')],_0x5abf70['transferercalleridnum'],_0x5abf70[_0xf4fc('0xe')],_0x5abf70['transfereecalleridnum'],_0x5abf70[_0xf4fc('0xf')]));_0x5abf70[_0xf4fc('0x4')]=_0xf4fc('0x10');writeDB(_0x5abf70);}catch(_0x44a402){utils[_0xf4fc('0x11')](util[_0xf4fc('0xb')](_0xf4fc('0xc'),_0x5abf70[_0xf4fc('0x7')]),_0x44a402);}};exports['attendedtransfer']=function(_0x2f1e5f){try{utils[_0xf4fc('0xa')](util[_0xf4fc('0xb')](_0xf4fc('0x12'),_0x2f1e5f['origtransfereruniqueid']),_0x2f1e5f);utils[_0xf4fc('0x2')](util[_0xf4fc('0xb')](_0xf4fc('0x13'),_0x2f1e5f[_0xf4fc('0x6')],_0x2f1e5f[_0xf4fc('0x14')],_0x2f1e5f[_0xf4fc('0x15')],_0x2f1e5f[_0xf4fc('0x16')],_0x2f1e5f['transfertargetcalleridname']));_0x2f1e5f=_[_0xf4fc('0x17')](_0x2f1e5f,{'transfererchannel':_0x2f1e5f[_0xf4fc('0x18')],'transferercalleridnum':_0x2f1e5f[_0xf4fc('0x14')],'transferercalleridname':_0x2f1e5f['origtransferercalleridname'],'transfererconnectedlinenum':_0x2f1e5f['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2f1e5f[_0xf4fc('0x19')],'transfereraccountcode':_0x2f1e5f[_0xf4fc('0x1a')],'transferercontext':_0x2f1e5f[_0xf4fc('0x1b')],'transfererexten':_0x2f1e5f[_0xf4fc('0x1c')],'transfererlinkedid':_0x2f1e5f[_0xf4fc('0x1d')],'context':_0x2f1e5f['origtransferercontext'],'extension':_0x2f1e5f[_0xf4fc('0x1e')],'type':_0xf4fc('0x5')});if(_[_0xf4fc('0x1f')](_0x2f1e5f[_0xf4fc('0x20')])){_0x2f1e5f=_[_0xf4fc('0x17')](_0x2f1e5f,{'transfereechannel':_0x2f1e5f['transfertargetchannel'],'transfereecalleridnum':_0x2f1e5f['transfertargetcalleridnum'],'transfereecalleridname':_0x2f1e5f[_0xf4fc('0x21')],'transfereeconnectedlinenum':_0x2f1e5f['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2f1e5f[_0xf4fc('0x22')],'transfereeaccountcode':_0x2f1e5f[_0xf4fc('0x23')],'transfereecontext':_0x2f1e5f[_0xf4fc('0x24')],'transfereeexten':_0x2f1e5f[_0xf4fc('0x25')],'transfereelinkedid':_0x2f1e5f[_0xf4fc('0x26')]});}writeDB(_0x2f1e5f);}catch(_0x4e9758){utils[_0xf4fc('0x11')](util[_0xf4fc('0xb')]('[%s][transfers][attendedtransfer]',_0x2f1e5f[_0xf4fc('0x6')]),_0x4e9758);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 90cf561..dd38f48 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 _0xb10b=['util','client','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','moment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb10b,0x12a));var _0xbb10=function(_0x3a13cf,_0x478c62){_0x3a13cf=_0x3a13cf-0x0;var _0x4817c=_0xb10b[_0x3a13cf];return _0x4817c;};'use strict';var BPromise=require(_0xbb10('0x0'));var jayson=require('jayson/promise');var moment=require(_0xbb10('0x1'));var util=require(_0xbb10('0x2'));var client=jayson[_0xbb10('0x3')]['http']({'port':0x2329});var logger=require(_0xbb10('0x4'))(_0xbb10('0x5'));exports[_0xbb10('0x6')]=function(_0x22320e,_0x49baf4){logger[_0xbb10('0x6')](_0x22320e,_0x49baf4?util['inspect'](_0x49baf4,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x7')]=function(_0x3cdd53,_0x513741){logger[_0xbb10('0x7')](_0x3cdd53,_0x513741?util[_0xbb10('0x8')](_0x513741,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0x9')]=function(_0x1c3ee5,_0x2353ef){logger[_0xbb10('0x9')](_0x1c3ee5,_0x2353ef?util[_0xbb10('0x8')](_0x2353ef,{'showHidden':![],'depth':null}):'');};exports[_0xbb10('0xa')]=function(_0x5ab04a,_0x4e47f8){return client[_0xbb10('0xa')](_0x5ab04a,{'body':_0x4e47f8})[_0xbb10('0xb')](function(_0xce64f3){logger['debug'](_0xbb10('0xc'),_0x5ab04a,_0xce64f3?util['inspect'](_0xce64f3,{'showHidden':![],'depth':null}):'');})[_0xbb10('0xd')](function(_0x916a32){logger[_0xbb10('0x9')](_0xbb10('0xc'),_0x5ab04a,_0x916a32?util[_0xbb10('0x8')](_0x916a32,{'showHidden':![],'depth':null}):'');});};function getUser(_0x147230){return client['request'](_0xbb10('0xe'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0xf'),_0xbb10('0x10'),_0xbb10('0x11')],'where':_0x147230,'limit':0x1}})[_0xbb10('0xb')](function(_0x2f2ebf){logger[_0xbb10('0x7')](_0xbb10('0x12'),JSON[_0xbb10('0x13')](_0x147230),_0x2f2ebf?util[_0xbb10('0x8')](_0x2f2ebf,{'showHidden':![],'depth':null}):'');return _0x2f2ebf['result'][_0xbb10('0x14')]?_0x2f2ebf[_0xbb10('0x15')][0x0]:null;});}exports[_0xbb10('0x16')]=function(_0x42db98){return new BPromise(function(_0x378da8,_0x1682a4){if(_0x42db98){return getUser({'internal':_0x42db98})[_0xbb10('0xb')](function(_0x30efc6){logger[_0xbb10('0x6')](_0xbb10('0x17'),_0x42db98,_0x30efc6?'found':_0xbb10('0x18'));return _0x378da8(_0x30efc6);})[_0xbb10('0xd')](function(_0x388fab){logger[_0xbb10('0x9')](_0xbb10('0x19'),_0x388fab?util[_0xbb10('0x8')](_0x388fab,{'showHidden':![],'depth':null}):'');return _0x378da8(null);});}return _0x378da8(null);});};exports['getUserByInterface']=function(_0x12f888){return new BPromise(function(_0x12ef77,_0x50aea1){if(_0x12f888){return getUser({'interface':_0x12f888})['then'](function(_0x8e2b97){logger[_0xbb10('0x6')](_0xbb10('0x1a'),_0x12f888,_0x8e2b97?_0xbb10('0x1b'):_0xbb10('0x18'));return _0x12ef77(_0x8e2b97);})[_0xbb10('0xd')](function(_0x407cb4){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x407cb4?util[_0xbb10('0x8')](_0x407cb4,{'showHidden':![],'depth':null}):'');return _0x12ef77(null);});}return _0x12ef77(null);});};exports[_0xbb10('0x1d')]=function(_0x26ad93){return new BPromise(function(_0x537898,_0x4fedac){if(_0x26ad93){return getUser({'name':_0x26ad93})['then'](function(_0xc93a04){logger[_0xbb10('0x6')](_0xbb10('0x1e'),_0x26ad93,_0xc93a04?'found':_0xbb10('0x18'));return _0x537898(_0xc93a04);})[_0xbb10('0xd')](function(_0x6ed43b){logger[_0xbb10('0x9')](_0xbb10('0x1f'),_0x6ed43b?util[_0xbb10('0x8')](_0x6ed43b,{'showHidden':![],'depth':null}):'');return _0x537898(null);});}return _0x537898(null);});};exports[_0xbb10('0x20')]=function(_0x4aabb9){return new BPromise(function(_0x3796c7,_0x21ac54){if(_0x4aabb9){return client[_0xbb10('0xa')](_0xbb10('0x21'),{'options':{'raw':!![],'attributes':['id',_0xbb10('0x10'),_0xbb10('0x22'),'acw',_0xbb10('0x23')],'where':{'name':_0x4aabb9},'limit':0x1}})['then'](function(_0x448d5c){logger['debug'](_0xbb10('0x24'),_0x4aabb9,_0x448d5c?util[_0xbb10('0x8')](_0x448d5c,{'showHidden':![],'depth':null}):'');logger[_0xbb10('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4aabb9,_0x448d5c?'found':_0xbb10('0x18'));return _0x3796c7(_0x448d5c[_0xbb10('0x15')]['length']?_0x448d5c[_0xbb10('0x15')][0x0]:null);})[_0xbb10('0xd')](function(_0x2f653f){logger[_0xbb10('0x9')](_0xbb10('0x25'),_0x2f653f?util[_0xbb10('0x8')](_0x2f653f,{'showHidden':![],'depth':null}):'');return _0x3796c7(null);});}return _0x3796c7(null);});};exports[_0xbb10('0x26')]=function(_0x4975f5,_0x25acb3){return moment(_0x4975f5)[_0xbb10('0x27')](_0x25acb3,_0xbb10('0x28'))[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2b')]=function(_0x188cbd,_0x10202c){return moment(_0x188cbd)[_0xbb10('0x2c')](_0x10202c,'seconds')[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x2d')]=function(_0x3c3c45,_0x570f5a){return moment(_0x3c3c45)[_0xbb10('0x2e')](moment(_0x570f5a),'seconds');};exports['sumTime']=function(_0x3eb3cc,_0x40c164){return parseInt(_0x3eb3cc,0xa)+parseInt(_0x40c164,0xa);};exports[_0xbb10('0x2f')]=function(){return moment()[_0xbb10('0x29')](_0xbb10('0x2a'));};exports[_0xbb10('0x30')]=function(_0x547062,_0x1e5bbd){if(_0x1e5bbd){return moment(_0x547062)[_0xbb10('0x30')](_0x1e5bbd);}return!![];};exports['isBefore']=function(_0x5e3fbd,_0x5cd55f){if(_0x5cd55f){return moment(_0x5e3fbd)[_0xbb10('0x31')](_0x5cd55f);}else if(_0x5e3fbd){return!![];}return![];}; \ No newline at end of file +var _0x7a54=['result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','YYYY-MM-DD\x20HH:mm:ss','subtract','format','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','xdr','info','debug','error','inspect','request','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','stringify'];(function(_0x4f2801,_0x366dd1){var _0x3ac22a=function(_0x39862a){while(--_0x39862a){_0x4f2801['push'](_0x4f2801['shift']());}};_0x3ac22a(++_0x366dd1);}(_0x7a54,0x106));var _0x47a5=function(_0x506e7e,_0x2e23d3){_0x506e7e=_0x506e7e-0x0;var _0x4316ff=_0x7a54[_0x506e7e];return _0x4316ff;};'use strict';var BPromise=require(_0x47a5('0x0'));var jayson=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var util=require('util');var client=jayson[_0x47a5('0x3')][_0x47a5('0x4')]({'port':0x2329});var logger=require('../../config/logger')(_0x47a5('0x5'));exports[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){logger[_0x47a5('0x6')](_0x2a1a7e,_0x3717e1?util['inspect'](_0x3717e1,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x7')]=function(_0x59199c,_0x343372){logger[_0x47a5('0x7')](_0x59199c,_0x343372?util['inspect'](_0x343372,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0x8')]=function(_0x5077f3,_0x5d90b3){logger['error'](_0x5077f3,_0x5d90b3?util[_0x47a5('0x9')](_0x5d90b3,{'showHidden':![],'depth':null}):'');};exports[_0x47a5('0xa')]=function(_0x5e31dd,_0x2eb0dd){return client['request'](_0x5e31dd,{'body':_0x2eb0dd})['then'](function(_0x1f47f4){logger[_0x47a5('0x7')](_0x47a5('0xb'),_0x5e31dd,_0x1f47f4?util[_0x47a5('0x9')](_0x1f47f4,{'showHidden':![],'depth':null}):'');})[_0x47a5('0xc')](function(_0xd308b8){logger[_0x47a5('0x8')]('[utils][request]\x20name:%s',_0x5e31dd,_0xd308b8?util[_0x47a5('0x9')](_0xd308b8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x221b54){return client[_0x47a5('0xa')](_0x47a5('0xd'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xe'),_0x47a5('0xf'),_0x47a5('0x10')],'where':_0x221b54,'limit':0x1}})[_0x47a5('0x11')](function(_0x4e99a8){logger[_0x47a5('0x7')](_0x47a5('0x12'),JSON[_0x47a5('0x13')](_0x221b54),_0x4e99a8?util[_0x47a5('0x9')](_0x4e99a8,{'showHidden':![],'depth':null}):'');return _0x4e99a8[_0x47a5('0x14')]['length']?_0x4e99a8['result'][0x0]:null;});}exports[_0x47a5('0x15')]=function(_0x4b966e){return new BPromise(function(_0x5247fd,_0x423a81){if(_0x4b966e){return getUser({'internal':_0x4b966e})[_0x47a5('0x11')](function(_0x2ce454){logger[_0x47a5('0x6')](_0x47a5('0x16'),_0x4b966e,_0x2ce454?_0x47a5('0x17'):_0x47a5('0x18'));return _0x5247fd(_0x2ce454);})[_0x47a5('0xc')](function(_0x3aed38){logger['error'](_0x47a5('0x19'),_0x3aed38?util[_0x47a5('0x9')](_0x3aed38,{'showHidden':![],'depth':null}):'');return _0x5247fd(null);});}return _0x5247fd(null);});};exports['getUserByInterface']=function(_0x2b0360){return new BPromise(function(_0x1f03f7,_0x36874d){if(_0x2b0360){return getUser({'interface':_0x2b0360})['then'](function(_0xb8ae6c){logger[_0x47a5('0x6')](_0x47a5('0x1a'),_0x2b0360,_0xb8ae6c?_0x47a5('0x17'):'notfound');return _0x1f03f7(_0xb8ae6c);})[_0x47a5('0xc')](function(_0x385687){logger['error'](_0x47a5('0x1b'),_0x385687?util[_0x47a5('0x9')](_0x385687,{'showHidden':![],'depth':null}):'');return _0x1f03f7(null);});}return _0x1f03f7(null);});};exports[_0x47a5('0x1c')]=function(_0x129ce5){return new BPromise(function(_0x3abd6a,_0x50bf17){if(_0x129ce5){return getUser({'name':_0x129ce5})['then'](function(_0x136745){logger['info'](_0x47a5('0x1d'),_0x129ce5,_0x136745?'found':_0x47a5('0x18'));return _0x3abd6a(_0x136745);})[_0x47a5('0xc')](function(_0x36ad34){logger[_0x47a5('0x8')](_0x47a5('0x1e'),_0x36ad34?util[_0x47a5('0x9')](_0x36ad34,{'showHidden':![],'depth':null}):'');return _0x3abd6a(null);});}return _0x3abd6a(null);});};exports[_0x47a5('0x1f')]=function(_0x136b14){return new BPromise(function(_0x16631f,_0x361bfa){if(_0x136b14){return client[_0x47a5('0xa')](_0x47a5('0x20'),{'options':{'raw':!![],'attributes':['id',_0x47a5('0xf'),'type',_0x47a5('0x21'),'acwTimeout'],'where':{'name':_0x136b14},'limit':0x1}})[_0x47a5('0x11')](function(_0x9ac908){logger[_0x47a5('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x136b14,_0x9ac908?util[_0x47a5('0x9')](_0x9ac908,{'showHidden':![],'depth':null}):'');logger[_0x47a5('0x6')](_0x47a5('0x22'),_0x136b14,_0x9ac908?_0x47a5('0x17'):'notfound');return _0x16631f(_0x9ac908['result'][_0x47a5('0x23')]?_0x9ac908[_0x47a5('0x14')][0x0]:null);})['catch'](function(_0x4e1006){logger[_0x47a5('0x8')](_0x47a5('0x24'),_0x4e1006?util['inspect'](_0x4e1006,{'showHidden':![],'depth':null}):'');return _0x16631f(null);});}return _0x16631f(null);});};exports[_0x47a5('0x25')]=function(_0x53119b,_0x122ed6){return moment(_0x53119b)[_0x47a5('0x26')](_0x122ed6,'seconds')['format'](_0x47a5('0x27'));};exports['subtractTime']=function(_0x403028,_0x87e4c9){return moment(_0x403028)[_0x47a5('0x28')](_0x87e4c9,'seconds')[_0x47a5('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x65542e,_0x5a8a7c){return moment(_0x65542e)[_0x47a5('0x2a')](moment(_0x5a8a7c),'seconds');};exports[_0x47a5('0x2b')]=function(_0x3534cb,_0x38c8d4){return parseInt(_0x3534cb,0xa)+parseInt(_0x38c8d4,0xa);};exports[_0x47a5('0x2c')]=function(){return moment()[_0x47a5('0x29')](_0x47a5('0x27'));};exports[_0x47a5('0x2d')]=function(_0x452be5,_0x1a0d23){if(_0x1a0d23){return moment(_0x452be5)['isAfter'](_0x1a0d23);}return!![];};exports[_0x47a5('0x2e')]=function(_0x10f136,_0x511c06){if(_0x511c06){return moment(_0x10f136)[_0x47a5('0x2e')](_0x511c06);}else if(_0x10f136){return!![];}return![];}; \ No newline at end of file